summaryrefslogtreecommitdiffstats
path: root/src/gui
diff options
context:
space:
mode:
Diffstat (limited to 'src/gui')
-rw-r--r--src/gui/CMakeLists.txt1030
-rw-r--r--src/gui/Qt5GuiConfigExtras.cmake.in193
-rw-r--r--src/gui/accessible/accessible.pri25
-rw-r--r--src/gui/accessible/linux/atspiadaptor.cpp2856
-rw-r--r--src/gui/accessible/linux/atspiadaptor_p.h194
-rw-r--r--src/gui/accessible/linux/dbusconnection.cpp149
-rw-r--r--src/gui/accessible/linux/dbusconnection_p.h61
-rw-r--r--src/gui/accessible/linux/dbusxml/Bus.xml17
-rw-r--r--src/gui/accessible/linux/dbusxml/Cache.xml21
-rw-r--r--src/gui/accessible/linux/dbusxml/DeviceEventController.xml66
-rw-r--r--src/gui/accessible/linux/dbusxml/Socket.xml23
-rw-r--r--src/gui/accessible/linux/qspi_constant_mappings.cpp128
-rw-r--r--src/gui/accessible/linux/qspi_constant_mappings_p.h107
-rw-r--r--src/gui/accessible/linux/qspi_struct_marshallers.cpp219
-rw-r--r--src/gui/accessible/linux/qspi_struct_marshallers_p.h164
-rw-r--r--src/gui/accessible/linux/qspiaccessiblebridge.cpp283
-rw-r--r--src/gui/accessible/linux/qspiaccessiblebridge_p.h69
-rw-r--r--src/gui/accessible/linux/qspiapplicationadaptor.cpp213
-rw-r--r--src/gui/accessible/linux/qspiapplicationadaptor_p.h62
-rw-r--r--src/gui/accessible/linux/qspidbuscache.cpp59
-rw-r--r--src/gui/accessible/linux/qspidbuscache_p.h46
-rw-r--r--src/gui/accessible/qaccessible.cpp479
-rw-r--r--src/gui/accessible/qaccessible.h515
-rw-r--r--src/gui/accessible/qaccessible_base.h420
-rw-r--r--src/gui/accessible/qaccessiblebridge.cpp46
-rw-r--r--src/gui/accessible/qaccessiblebridge.h44
-rw-r--r--src/gui/accessible/qaccessiblebridgeutils.cpp77
-rw-r--r--src/gui/accessible/qaccessiblebridgeutils_p.h34
-rw-r--r--src/gui/accessible/qaccessiblecache.cpp122
-rw-r--r--src/gui/accessible/qaccessiblecache_mac.mm40
-rw-r--r--src/gui/accessible/qaccessiblecache_p.h48
-rw-r--r--src/gui/accessible/qaccessibleobject.cpp50
-rw-r--r--src/gui/accessible/qaccessibleobject.h44
-rw-r--r--src/gui/accessible/qaccessibleplugin.cpp53
-rw-r--r--src/gui/accessible/qaccessibleplugin.h45
-rw-r--r--src/gui/accessible/qplatformaccessibility.cpp54
-rw-r--r--src/gui/accessible/qplatformaccessibility.h44
-rw-r--r--src/gui/animation/animation.pri2
-rw-r--r--src/gui/animation/qguivariantanimation.cpp40
-rw-r--r--src/gui/compat/removed_api.cpp70
-rw-r--r--src/gui/configure.cmake1386
-rw-r--r--src/gui/configure.json1998
-rw-r--r--src/gui/configure.pri84
-rw-r--r--src/gui/doc/images/qpainter-concentriccircles.pngbin31294 -> 95529 bytes
-rw-r--r--src/gui/doc/includes/QtGuiDoc23
-rw-r--r--src/gui/doc/includes/windows.h22
-rw-r--r--src/gui/doc/qtgui.qdocconf27
-rw-r--r--src/gui/doc/snippets/_clang-format2
-rw-r--r--src/gui/doc/snippets/brush/brush.cpp104
-rw-r--r--src/gui/doc/snippets/brush/gradientcreationsnippet.cpp68
-rw-r--r--src/gui/doc/snippets/clipboard/clipboard.pro3
-rw-r--r--src/gui/doc/snippets/clipboard/clipwindow.cpp69
-rw-r--r--src/gui/doc/snippets/clipboard/clipwindow.h53
-rw-r--r--src/gui/doc/snippets/clipboard/main.cpp51
-rw-r--r--src/gui/doc/snippets/code/doc_src_coordsys.cpp88
-rw-r--r--src/gui/doc/snippets/code/doc_src_richtext.cpp71
-rw-r--r--src/gui/doc/snippets/code/doc_src_richtext.qdoc51
-rw-r--r--src/gui/doc/snippets/code/src_gui_accessible_qaccessible.cpp70
-rw-r--r--src/gui/doc/snippets/code/src_gui_image_qicon.cpp106
-rw-r--r--src/gui/doc/snippets/code/src_gui_image_qimage.cpp76
-rw-r--r--src/gui/doc/snippets/code/src_gui_image_qimagereader.cpp67
-rw-r--r--src/gui/doc/snippets/code/src_gui_image_qimagewriter.cpp75
-rw-r--r--src/gui/doc/snippets/code/src_gui_image_qmovie.cpp65
-rw-r--r--src/gui/doc/snippets/code/src_gui_image_qpixmap.cpp69
-rw-r--r--src/gui/doc/snippets/code/src_gui_image_qpixmapcache.cpp71
-rw-r--r--src/gui/doc/snippets/code/src_gui_itemviews_qstandarditemmodel.cpp80
-rw-r--r--src/gui/doc/snippets/code/src_gui_kernel_qaction.cpp12
-rw-r--r--src/gui/doc/snippets/code/src_gui_kernel_qapplication.cpp153
-rw-r--r--src/gui/doc/snippets/code/src_gui_kernel_qclipboard.cpp67
-rw-r--r--src/gui/doc/snippets/code/src_gui_kernel_qevent.cpp64
-rw-r--r--src/gui/doc/snippets/code/src_gui_kernel_qguiapplication.cpp89
-rw-r--r--src/gui/doc/snippets/code/src_gui_kernel_qguiapplication_x11.cpp63
-rw-r--r--src/gui/doc/snippets/code/src_gui_kernel_qkeysequence.cpp76
-rw-r--r--src/gui/doc/snippets/code/src_gui_kernel_qshortcut.cpp18
-rw-r--r--src/gui/doc/snippets/code/src_gui_kernel_qshortcutmap.cpp60
-rw-r--r--src/gui/doc/snippets/code/src_gui_math3d_qquaternion.cpp73
-rw-r--r--src/gui/doc/snippets/code/src_gui_opengl_qopenglbuffer.cpp60
-rw-r--r--src/gui/doc/snippets/code/src_gui_opengl_qopengldebug.cpp100
-rw-r--r--src/gui/doc/snippets/code/src_gui_opengl_qopenglfunctions.cpp168
-rw-r--r--src/gui/doc/snippets/code/src_gui_painting_qbrush.cpp64
-rw-r--r--src/gui/doc/snippets/code/src_gui_painting_qcolor.cpp75
-rw-r--r--src/gui/doc/snippets/code/src_gui_painting_qmatrix.cpp72
-rw-r--r--src/gui/doc/snippets/code/src_gui_painting_qpainter.cpp213
-rw-r--r--src/gui/doc/snippets/code/src_gui_painting_qpainterpath.cpp113
-rw-r--r--src/gui/doc/snippets/code/src_gui_painting_qpen.cpp82
-rw-r--r--src/gui/doc/snippets/code/src_gui_painting_qregion.cpp63
-rw-r--r--src/gui/doc/snippets/code/src_gui_painting_qregion_unix.cpp58
-rw-r--r--src/gui/doc/snippets/code/src_gui_painting_qtransform.cpp65
-rw-r--r--src/gui/doc/snippets/code/src_gui_qopenglshaderprogram.cpp104
-rw-r--r--src/gui/doc/snippets/code/src_gui_text_qfont.cpp66
-rw-r--r--src/gui/doc/snippets/code/src_gui_text_qfontmetrics.cpp71
-rw-r--r--src/gui/doc/snippets/code/src_gui_text_qsyntaxhighlighter.cpp111
-rw-r--r--src/gui/doc/snippets/code/src_gui_text_qtextcursor.cpp73
-rw-r--r--src/gui/doc/snippets/code/src_gui_text_qtextdocument.cpp53
-rw-r--r--src/gui/doc/snippets/code/src_gui_text_qtextdocumentwriter.cpp57
-rw-r--r--src/gui/doc/snippets/code/src_gui_text_qtextlayout.cpp117
-rw-r--r--src/gui/doc/snippets/code/src_gui_util_qdesktopservices.cpp138
-rw-r--r--src/gui/doc/snippets/code/src_gui_util_qundostack.cpp72
-rw-r--r--src/gui/doc/snippets/code/src_gui_util_qvalidator.cpp139
-rw-r--r--src/gui/doc/snippets/code/src_gui_vulkan_qvulkanfunctions.cpp107
-rw-r--r--src/gui/doc/snippets/code/src_gui_vulkan_qvulkaninstance.cpp189
-rw-r--r--src/gui/doc/snippets/code/src_gui_vulkan_qvulkanwindow.cpp187
-rw-r--r--src/gui/doc/snippets/draganddrop/draganddrop.pro5
-rw-r--r--src/gui/doc/snippets/draganddrop/dragwidget.cpp54
-rw-r--r--src/gui/doc/snippets/draganddrop/dragwidget.h53
-rw-r--r--src/gui/doc/snippets/draganddrop/main.cpp51
-rw-r--r--src/gui/doc/snippets/draganddrop/mainwindow.cpp53
-rw-r--r--src/gui/doc/snippets/draganddrop/mainwindow.h53
-rw-r--r--src/gui/doc/snippets/dragging/dragging.pro5
-rw-r--r--src/gui/doc/snippets/dragging/main.cpp51
-rw-r--r--src/gui/doc/snippets/dragging/mainwindow.cpp51
-rw-r--r--src/gui/doc/snippets/dragging/mainwindow.h53
-rw-r--r--src/gui/doc/snippets/droparea.cpp150
-rw-r--r--src/gui/doc/snippets/droparea/droparea.cpp36
-rw-r--r--src/gui/doc/snippets/dropevents/dropevents.pro3
-rw-r--r--src/gui/doc/snippets/dropevents/main.cpp62
-rw-r--r--src/gui/doc/snippets/dropevents/window.cpp78
-rw-r--r--src/gui/doc/snippets/dropevents/window.h81
-rw-r--r--src/gui/doc/snippets/droprectangle/droprectangle.pro3
-rw-r--r--src/gui/doc/snippets/droprectangle/main.cpp61
-rw-r--r--src/gui/doc/snippets/droprectangle/window.cpp101
-rw-r--r--src/gui/doc/snippets/droprectangle/window.h81
-rw-r--r--src/gui/doc/snippets/image/image.cpp126
-rw-r--r--src/gui/doc/snippets/image/supportedformat.cpp58
-rw-r--r--src/gui/doc/snippets/matrix/matrix.cpp150
-rw-r--r--src/gui/doc/snippets/overview/using-qt-gui.cmake4
-rw-r--r--src/gui/doc/snippets/picture/picture.cpp99
-rw-r--r--src/gui/doc/snippets/plaintextlayout/main.cpp62
-rw-r--r--src/gui/doc/snippets/plaintextlayout/plaintextlayout.pro3
-rw-r--r--src/gui/doc/snippets/plaintextlayout/window.cpp150
-rw-r--r--src/gui/doc/snippets/plaintextlayout/window.h71
-rw-r--r--src/gui/doc/snippets/polygon/polygon.cpp147
-rw-r--r--src/gui/doc/snippets/qfileopenevent/Info.plist51
-rw-r--r--src/gui/doc/snippets/qfileopenevent/main.cpp64
-rw-r--r--src/gui/doc/snippets/qfontdatabase/main.cpp87
-rw-r--r--src/gui/doc/snippets/qfontdatabase/qfontdatabase_snippets.cpp34
-rw-r--r--src/gui/doc/snippets/qimagewriter/main.cpp78
-rw-r--r--src/gui/doc/snippets/qstatustipevent/main.cpp58
-rw-r--r--src/gui/doc/snippets/qtextobject/textobjectinterface.h54
-rw-r--r--src/gui/doc/snippets/rhioffscreen/color.frag16
-rw-r--r--src/gui/doc/snippets/rhioffscreen/color.vert18
-rw-r--r--src/gui/doc/snippets/rhioffscreen/main.cpp151
-rw-r--r--src/gui/doc/snippets/scribe-overview/main.cpp83
-rw-r--r--src/gui/doc/snippets/scribe-overview/scribe-overview.pro1
-rw-r--r--src/gui/doc/snippets/separations/finalwidget.cpp71
-rw-r--r--src/gui/doc/snippets/separations/finalwidget.h53
-rw-r--r--src/gui/doc/snippets/separations/main.cpp51
-rw-r--r--src/gui/doc/snippets/separations/screenwidget.cpp54
-rw-r--r--src/gui/doc/snippets/separations/screenwidget.h51
-rw-r--r--src/gui/doc/snippets/separations/separations.pro7
-rw-r--r--src/gui/doc/snippets/separations/separations.qdoc51
-rw-r--r--src/gui/doc/snippets/separations/viewer.cpp54
-rw-r--r--src/gui/doc/snippets/separations/viewer.h51
-rw-r--r--src/gui/doc/snippets/textblock-formats/main.cpp57
-rw-r--r--src/gui/doc/snippets/textblock-formats/textblock-formats.pro2
-rw-r--r--src/gui/doc/snippets/textblock-fragments/main.cpp62
-rw-r--r--src/gui/doc/snippets/textblock-fragments/mainwindow.cpp158
-rw-r--r--src/gui/doc/snippets/textblock-fragments/mainwindow.h75
-rw-r--r--src/gui/doc/snippets/textblock-fragments/textblock-fragments.pro6
-rw-r--r--src/gui/doc/snippets/textblock-fragments/xmlwriter.cpp63
-rw-r--r--src/gui/doc/snippets/textblock-fragments/xmlwriter.h52
-rw-r--r--src/gui/doc/snippets/textdocument-blocks/main.cpp58
-rw-r--r--src/gui/doc/snippets/textdocument-blocks/mainwindow.cpp70
-rw-r--r--src/gui/doc/snippets/textdocument-blocks/mainwindow.h51
-rw-r--r--src/gui/doc/snippets/textdocument-blocks/textdocument-blocks.pro6
-rw-r--r--src/gui/doc/snippets/textdocument-blocks/xmlwriter.cpp94
-rw-r--r--src/gui/doc/snippets/textdocument-blocks/xmlwriter.h71
-rw-r--r--src/gui/doc/snippets/textdocument-charformats/main.cpp55
-rw-r--r--src/gui/doc/snippets/textdocument-charformats/textdocument-charformats.pro1
-rw-r--r--src/gui/doc/snippets/textdocument-css/main.cpp55
-rw-r--r--src/gui/doc/snippets/textdocument-cursors/main.cpp55
-rw-r--r--src/gui/doc/snippets/textdocument-cursors/textdocument-cursors.pro1
-rw-r--r--src/gui/doc/snippets/textdocument-end/textdocumentendsnippet.cpp19
-rw-r--r--src/gui/doc/snippets/textdocument-find/main.cpp55
-rw-r--r--src/gui/doc/snippets/textdocument-find/textdocument-find.pro1
-rw-r--r--src/gui/doc/snippets/textdocument-frames/main.cpp55
-rw-r--r--src/gui/doc/snippets/textdocument-frames/mainwindow.cpp85
-rw-r--r--src/gui/doc/snippets/textdocument-frames/mainwindow.h57
-rw-r--r--src/gui/doc/snippets/textdocument-frames/textdocument-frames.pro6
-rw-r--r--src/gui/doc/snippets/textdocument-frames/xmlwriter.cpp128
-rw-r--r--src/gui/doc/snippets/textdocument-frames/xmlwriter.h74
-rw-r--r--src/gui/doc/snippets/textdocument-imagedrop/main.cpp60
-rw-r--r--src/gui/doc/snippets/textdocument-imagedrop/textdocument-imagedrop.pro2
-rw-r--r--src/gui/doc/snippets/textdocument-imagedrop/textedit.h53
-rw-r--r--src/gui/doc/snippets/textdocument-imageformat/main.cpp56
-rw-r--r--src/gui/doc/snippets/textdocument-imageformat/textdocument-imageformat.pro2
-rw-r--r--src/gui/doc/snippets/textdocument-images/main.cpp55
-rw-r--r--src/gui/doc/snippets/textdocument-images/textdocument-images.pro2
-rw-r--r--src/gui/doc/snippets/textdocument-listitems/main.cpp53
-rw-r--r--src/gui/doc/snippets/textdocument-listitems/mainwindow.cpp76
-rw-r--r--src/gui/doc/snippets/textdocument-listitems/mainwindow.h55
-rw-r--r--src/gui/doc/snippets/textdocument-listitems/textdocument-listitems.pro3
-rw-r--r--src/gui/doc/snippets/textdocument-listitemstyles/main.cpp52
-rw-r--r--src/gui/doc/snippets/textdocument-listitemstyles/mainwindow.cpp66
-rw-r--r--src/gui/doc/snippets/textdocument-listitemstyles/mainwindow.h55
-rw-r--r--src/gui/doc/snippets/textdocument-listitemstyles/textdocument-listitemstyles.pro3
-rw-r--r--src/gui/doc/snippets/textdocument-lists/mainwindow.cpp195
-rw-r--r--src/gui/doc/snippets/textdocument-printing/main.cpp56
-rw-r--r--src/gui/doc/snippets/textdocument-printing/mainwindow.cpp69
-rw-r--r--src/gui/doc/snippets/textdocument-printing/mainwindow.h60
-rw-r--r--src/gui/doc/snippets/textdocument-printing/textdocument-printing.pro3
-rw-r--r--src/gui/doc/snippets/textdocument-resources/main.cpp55
-rw-r--r--src/gui/doc/snippets/textdocument-resources/textdocument-resources.pro1
-rw-r--r--src/gui/doc/snippets/textdocument-selections/main.cpp56
-rw-r--r--src/gui/doc/snippets/textdocument-selections/mainwindow.cpp77
-rw-r--r--src/gui/doc/snippets/textdocument-selections/mainwindow.h61
-rw-r--r--src/gui/doc/snippets/textdocument-selections/textdocument-selections.pro4
-rw-r--r--src/gui/doc/snippets/textdocument-tables/main.cpp56
-rw-r--r--src/gui/doc/snippets/textdocument-tables/mainwindow.cpp98
-rw-r--r--src/gui/doc/snippets/textdocument-tables/mainwindow.h60
-rw-r--r--src/gui/doc/snippets/textdocument-tables/textdocument-tables.pro6
-rw-r--r--src/gui/doc/snippets/textdocument-tables/xmlwriter.cpp165
-rw-r--r--src/gui/doc/snippets/textdocument-tables/xmlwriter.h74
-rw-r--r--src/gui/doc/snippets/textdocument-texttable/main.cpp56
-rw-r--r--src/gui/doc/snippets/textdocumentendsnippet.cpp66
-rw-r--r--src/gui/doc/snippets/transform/main.cpp76
-rw-r--r--src/gui/doc/src/coordsys.qdoc71
-rw-r--r--src/gui/doc/src/dnd.qdoc58
-rw-r--r--src/gui/doc/src/dontdocument.qdoc60
-rw-r--r--src/gui/doc/src/external-resources.qdoc55
-rw-r--r--src/gui/doc/src/includes/qt-colors.qdocinc21
-rw-r--r--src/gui/doc/src/includes/svg-colors.qdocinc148
-rw-r--r--src/gui/doc/src/paintsystem.qdoc31
-rw-r--r--src/gui/doc/src/qt6-changes.qdoc151
-rw-r--r--src/gui/doc/src/qtgui-overview.qdoc187
-rw-r--r--src/gui/doc/src/qtgui.qdoc215
-rw-r--r--src/gui/doc/src/richtext.qdoc109
-rw-r--r--src/gui/gui.pro102
-rw-r--r--src/gui/image/image.pri102
-rw-r--r--src/gui/image/qabstractfileiconengine.cpp101
-rw-r--r--src/gui/image/qabstractfileiconengine_p.h62
-rw-r--r--src/gui/image/qabstractfileiconprovider.cpp280
-rw-r--r--src/gui/image/qabstractfileiconprovider.h48
-rw-r--r--src/gui/image/qabstractfileiconprovider_p.h52
-rw-r--r--src/gui/image/qbitmap.cpp185
-rw-r--r--src/gui/image/qbitmap.h62
-rw-r--r--src/gui/image/qbmphandler.cpp247
-rw-r--r--src/gui/image/qbmphandler_p.h45
-rw-r--r--src/gui/image/qicon.cpp1028
-rw-r--r--src/gui/image/qicon.h224
-rw-r--r--src/gui/image/qicon_p.h66
-rw-r--r--src/gui/image/qiconengine.cpp200
-rw-r--r--src/gui/image/qiconengine.h68
-rw-r--r--src/gui/image/qiconengine_p.h59
-rw-r--r--src/gui/image/qiconengineplugin.cpp42
-rw-r--r--src/gui/image/qiconengineplugin.h40
-rw-r--r--src/gui/image/qiconloader.cpp585
-rw-r--r--src/gui/image/qiconloader_p.h110
-rw-r--r--src/gui/image/qimage.cpp2141
-rw-r--r--src/gui/image/qimage.h326
-rw-r--r--src/gui/image/qimage_conversions.cpp2252
-rw-r--r--src/gui/image/qimage_darwin.mm49
-rw-r--r--src/gui/image/qimage_mips_dspr2.cpp40
-rw-r--r--src/gui/image/qimage_mips_dspr2_asm.S40
-rw-r--r--src/gui/image/qimage_neon.cpp42
-rw-r--r--src/gui/image/qimage_p.h346
-rw-r--r--src/gui/image/qimage_ssse3.cpp40
-rw-r--r--src/gui/image/qimageiohandler.cpp109
-rw-r--r--src/gui/image/qimageiohandler.h49
-rw-r--r--src/gui/image/qimagepixmapcleanuphooks.cpp40
-rw-r--r--src/gui/image/qimagepixmapcleanuphooks_p.h40
-rw-r--r--src/gui/image/qimagereader.cpp274
-rw-r--r--src/gui/image/qimagereader.h46
-rw-r--r--src/gui/image/qimagereaderwriterhelpers.cpp81
-rw-r--r--src/gui/image/qimagereaderwriterhelpers_p.h44
-rw-r--r--src/gui/image/qimagewriter.cpp139
-rw-r--r--src/gui/image/qimagewriter.h50
-rw-r--r--src/gui/image/qmovie.cpp141
-rw-r--r--src/gui/image/qmovie.h46
-rw-r--r--src/gui/image/qpaintengine_pic.cpp44
-rw-r--r--src/gui/image/qpaintengine_pic_p.h40
-rw-r--r--src/gui/image/qpicture.cpp65
-rw-r--r--src/gui/image/qpicture.h45
-rw-r--r--src/gui/image/qpicture_p.h48
-rw-r--r--src/gui/image/qpixmap.cpp320
-rw-r--r--src/gui/image/qpixmap.h94
-rw-r--r--src/gui/image/qpixmap_blitter.cpp42
-rw-r--r--src/gui/image/qpixmap_blitter_p.h58
-rw-r--r--src/gui/image/qpixmap_raster.cpp40
-rw-r--r--src/gui/image/qpixmap_raster_p.h40
-rw-r--r--src/gui/image/qpixmap_win.cpp193
-rw-r--r--src/gui/image/qpixmap_win_p.h38
-rw-r--r--src/gui/image/qpixmapcache.cpp270
-rw-r--r--src/gui/image/qpixmapcache.h76
-rw-r--r--src/gui/image/qpixmapcache_p.h43
-rw-r--r--src/gui/image/qplatformpixmap.cpp64
-rw-r--r--src/gui/image/qplatformpixmap.h42
-rw-r--r--src/gui/image/qpnghandler.cpp194
-rw-r--r--src/gui/image/qpnghandler.pri0
-rw-r--r--src/gui/image/qpnghandler_p.h44
-rw-r--r--src/gui/image/qppmhandler.cpp157
-rw-r--r--src/gui/image/qppmhandler_p.h44
-rw-r--r--src/gui/image/qxbmhandler.cpp128
-rw-r--r--src/gui/image/qxbmhandler_p.h44
-rw-r--r--src/gui/image/qxpmhandler.cpp227
-rw-r--r--src/gui/image/qxpmhandler_p.h44
-rw-r--r--src/gui/itemmodels/itemmodels.pri8
-rw-r--r--src/gui/itemmodels/qfileinfogatherer.cpp463
-rw-r--r--src/gui/itemmodels/qfileinfogatherer_p.h199
-rw-r--r--src/gui/itemmodels/qfilesystemmodel.cpp2224
-rw-r--r--src/gui/itemmodels/qfilesystemmodel.h150
-rw-r--r--src/gui/itemmodels/qfilesystemmodel_p.h308
-rw-r--r--src/gui/itemmodels/qstandarditemmodel.cpp365
-rw-r--r--src/gui/itemmodels/qstandarditemmodel.h84
-rw-r--r--src/gui/itemmodels/qstandarditemmodel_p.h68
-rw-r--r--src/gui/kernel/kernel.pri183
-rw-r--r--src/gui/kernel/qaction.cpp (renamed from src/gui/kernel/qguiaction.cpp)786
-rw-r--r--src/gui/kernel/qaction.h (renamed from src/gui/kernel/qguiaction.h)177
-rw-r--r--src/gui/kernel/qaction_p.h102
-rw-r--r--src/gui/kernel/qactiongroup.cpp328
-rw-r--r--src/gui/kernel/qactiongroup.h74
-rw-r--r--src/gui/kernel/qactiongroup_p.h57
-rw-r--r--src/gui/kernel/qclipboard.cpp94
-rw-r--r--src/gui/kernel/qclipboard.h40
-rw-r--r--src/gui/kernel/qcursor.cpp135
-rw-r--r--src/gui/kernel/qcursor.h67
-rw-r--r--src/gui/kernel/qcursor_p.h40
-rw-r--r--src/gui/kernel/qdnd.cpp42
-rw-r--r--src/gui/kernel/qdnd_p.h42
-rw-r--r--src/gui/kernel/qdrag.cpp79
-rw-r--r--src/gui/kernel/qdrag.h44
-rw-r--r--src/gui/kernel/qevent.cpp2951
-rw-r--r--src/gui/kernel/qevent.h1175
-rw-r--r--src/gui/kernel/qevent_p.h135
-rw-r--r--src/gui/kernel/qeventpoint.cpp619
-rw-r--r--src/gui/kernel/qeventpoint.h142
-rw-r--r--src/gui/kernel/qeventpoint_p.h141
-rw-r--r--src/gui/kernel/qgenericplugin.cpp42
-rw-r--r--src/gui/kernel/qgenericplugin.h40
-rw-r--r--src/gui/kernel/qgenericpluginfactory.cpp51
-rw-r--r--src/gui/kernel/qgenericpluginfactory.h40
-rw-r--r--src/gui/kernel/qguiaction_p.h128
-rw-r--r--src/gui/kernel/qguiactiongroup.cpp345
-rw-r--r--src/gui/kernel/qguiactiongroup.h104
-rw-r--r--src/gui/kernel/qguiactiongroup_p.h91
-rw-r--r--src/gui/kernel/qguiapplication.cpp1956
-rw-r--r--src/gui/kernel/qguiapplication.h67
-rw-r--r--src/gui/kernel/qguiapplication_p.h253
-rw-r--r--src/gui/kernel/qguiapplication_platform.h68
-rw-r--r--src/gui/kernel/qguishortcut.cpp354
-rw-r--r--src/gui/kernel/qguishortcut.h98
-rw-r--r--src/gui/kernel/qguishortcut_p.h92
-rw-r--r--src/gui/kernel/qguivariant.cpp341
-rw-r--r--src/gui/kernel/qhighdpiscaling.cpp741
-rw-r--r--src/gui/kernel/qhighdpiscaling_p.h209
-rw-r--r--src/gui/kernel/qinputdevice.cpp395
-rw-r--r--src/gui/kernel/qinputdevice.h101
-rw-r--r--src/gui/kernel/qinputdevice_p.h81
-rw-r--r--src/gui/kernel/qinputdevicemanager.cpp46
-rw-r--r--src/gui/kernel/qinputdevicemanager_p.h48
-rw-r--r--src/gui/kernel/qinputdevicemanager_p_p.h42
-rw-r--r--src/gui/kernel/qinputmethod.cpp64
-rw-r--r--src/gui/kernel/qinputmethod.h45
-rw-r--r--src/gui/kernel/qinputmethod_p.h40
-rw-r--r--src/gui/kernel/qinternalmimedata.cpp85
-rw-r--r--src/gui/kernel/qinternalmimedata_p.h44
-rw-r--r--src/gui/kernel/qkeymapper.cpp123
-rw-r--r--src/gui/kernel/qkeymapper_p.h74
-rw-r--r--src/gui/kernel/qkeysequence.cpp422
-rw-r--r--src/gui/kernel/qkeysequence.h70
-rw-r--r--src/gui/kernel/qkeysequence_p.h55
-rw-r--r--src/gui/kernel/qoffscreensurface.cpp149
-rw-r--r--src/gui/kernel/qoffscreensurface.h51
-rw-r--r--src/gui/kernel/qoffscreensurface_p.h59
-rw-r--r--src/gui/kernel/qoffscreensurface_platform.h41
-rw-r--r--src/gui/kernel/qopenglcontext.cpp675
-rw-r--r--src/gui/kernel/qopenglcontext.h127
-rw-r--r--src/gui/kernel/qopenglcontext_p.h77
-rw-r--r--src/gui/kernel/qopenglcontext_platform.h93
-rw-r--r--src/gui/kernel/qopenglwindow.cpp698
-rw-r--r--src/gui/kernel/qopenglwindow.h107
-rw-r--r--src/gui/kernel/qpaintdevicewindow.cpp70
-rw-r--r--src/gui/kernel/qpaintdevicewindow.h44
-rw-r--r--src/gui/kernel/qpaintdevicewindow_p.h47
-rw-r--r--src/gui/kernel/qpalette.cpp515
-rw-r--r--src/gui/kernel/qpalette.h94
-rw-r--r--src/gui/kernel/qpalette_p.h77
-rw-r--r--src/gui/kernel/qpixelformat.cpp46
-rw-r--r--src/gui/kernel/qpixelformat.h213
-rw-r--r--src/gui/kernel/qplatformclipboard.cpp40
-rw-r--r--src/gui/kernel/qplatformclipboard.h40
-rw-r--r--src/gui/kernel/qplatformcursor.cpp48
-rw-r--r--src/gui/kernel/qplatformcursor.h40
-rw-r--r--src/gui/kernel/qplatformdialoghelper.cpp180
-rw-r--r--src/gui/kernel/qplatformdialoghelper.h103
-rw-r--r--src/gui/kernel/qplatformdrag.cpp40
-rw-r--r--src/gui/kernel/qplatformdrag.h40
-rw-r--r--src/gui/kernel/qplatformgraphicsbuffer.cpp46
-rw-r--r--src/gui/kernel/qplatformgraphicsbuffer.h40
-rw-r--r--src/gui/kernel/qplatformgraphicsbufferhelper.cpp142
-rw-r--r--src/gui/kernel/qplatformgraphicsbufferhelper.h42
-rw-r--r--src/gui/kernel/qplatforminputcontext.cpp157
-rw-r--r--src/gui/kernel/qplatforminputcontext.h48
-rw-r--r--src/gui/kernel/qplatforminputcontext_p.h40
-rw-r--r--src/gui/kernel/qplatforminputcontextfactory.cpp81
-rw-r--r--src/gui/kernel/qplatforminputcontextfactory_p.h43
-rw-r--r--src/gui/kernel/qplatforminputcontextplugin.cpp42
-rw-r--r--src/gui/kernel/qplatforminputcontextplugin_p.h40
-rw-r--r--src/gui/kernel/qplatformintegration.cpp140
-rw-r--r--src/gui/kernel/qplatformintegration.h95
-rw-r--r--src/gui/kernel/qplatformintegrationfactory.cpp83
-rw-r--r--src/gui/kernel/qplatformintegrationfactory_p.h40
-rw-r--r--src/gui/kernel/qplatformintegrationplugin.cpp48
-rw-r--r--src/gui/kernel/qplatformintegrationplugin.h40
-rw-r--r--src/gui/kernel/qplatformkeymapper.cpp38
-rw-r--r--src/gui/kernel/qplatformkeymapper.h36
-rw-r--r--src/gui/kernel/qplatformmenu.cpp44
-rw-r--r--src/gui/kernel/qplatformmenu.h49
-rw-r--r--src/gui/kernel/qplatformmenu_p.h55
-rw-r--r--src/gui/kernel/qplatformnativeinterface.cpp46
-rw-r--r--src/gui/kernel/qplatformnativeinterface.h41
-rw-r--r--src/gui/kernel/qplatformoffscreensurface.cpp40
-rw-r--r--src/gui/kernel/qplatformoffscreensurface.h59
-rw-r--r--src/gui/kernel/qplatformopenglcontext.cpp56
-rw-r--r--src/gui/kernel/qplatformopenglcontext.h84
-rw-r--r--src/gui/kernel/qplatformscreen.cpp142
-rw-r--r--src/gui/kernel/qplatformscreen.h52
-rw-r--r--src/gui/kernel/qplatformscreen_p.h82
-rw-r--r--src/gui/kernel/qplatformservices.cpp66
-rw-r--r--src/gui/kernel/qplatformservices.h60
-rw-r--r--src/gui/kernel/qplatformsessionmanager.cpp52
-rw-r--r--src/gui/kernel/qplatformsessionmanager.h44
-rw-r--r--src/gui/kernel/qplatformsharedgraphicscache.cpp62
-rw-r--r--src/gui/kernel/qplatformsharedgraphicscache.h61
-rw-r--r--src/gui/kernel/qplatformsurface.cpp51
-rw-r--r--src/gui/kernel/qplatformsurface.h42
-rw-r--r--src/gui/kernel/qplatformsystemtrayicon.cpp42
-rw-r--r--src/gui/kernel/qplatformsystemtrayicon.h44
-rw-r--r--src/gui/kernel/qplatformtheme.cpp252
-rw-r--r--src/gui/kernel/qplatformtheme.h85
-rw-r--r--src/gui/kernel/qplatformtheme_p.h42
-rw-r--r--src/gui/kernel/qplatformthemefactory.cpp91
-rw-r--r--src/gui/kernel/qplatformthemefactory_p.h40
-rw-r--r--src/gui/kernel/qplatformthemeplugin.cpp42
-rw-r--r--src/gui/kernel/qplatformthemeplugin.h40
-rw-r--r--src/gui/kernel/qplatformwindow.cpp180
-rw-r--r--src/gui/kernel/qplatformwindow.h49
-rw-r--r--src/gui/kernel/qplatformwindow_p.h149
-rw-r--r--src/gui/kernel/qpointingdevice.cpp823
-rw-r--r--src/gui/kernel/qpointingdevice.h134
-rw-r--r--src/gui/kernel/qpointingdevice_p.h112
-rw-r--r--src/gui/kernel/qrasterwindow.cpp58
-rw-r--r--src/gui/kernel/qrasterwindow.h41
-rw-r--r--src/gui/kernel/qscreen.cpp324
-rw-r--r--src/gui/kernel/qscreen.h64
-rw-r--r--src/gui/kernel/qscreen_p.h74
-rw-r--r--src/gui/kernel/qscreen_platform.h61
-rw-r--r--src/gui/kernel/qsessionmanager.cpp53
-rw-r--r--src/gui/kernel/qsessionmanager.h40
-rw-r--r--src/gui/kernel/qsessionmanager_p.h44
-rw-r--r--src/gui/kernel/qshapedpixmapdndwindow.cpp50
-rw-r--r--src/gui/kernel/qshapedpixmapdndwindow_p.h40
-rw-r--r--src/gui/kernel/qshortcut.cpp580
-rw-r--r--src/gui/kernel/qshortcut.h200
-rw-r--r--src/gui/kernel/qshortcut_p.h59
-rw-r--r--src/gui/kernel/qshortcutmap.cpp331
-rw-r--r--src/gui/kernel/qshortcutmap_p.h50
-rw-r--r--src/gui/kernel/qsimpledrag.cpp71
-rw-r--r--src/gui/kernel/qsimpledrag_p.h41
-rw-r--r--src/gui/kernel/qstylehints.cpp128
-rw-r--r--src/gui/kernel/qstylehints.h75
-rw-r--r--src/gui/kernel/qstylehints_p.h54
-rw-r--r--src/gui/kernel/qsurface.cpp55
-rw-r--r--src/gui/kernel/qsurface.h45
-rw-r--r--src/gui/kernel/qsurfaceformat.cpp176
-rw-r--r--src/gui/kernel/qsurfaceformat.h70
-rw-r--r--src/gui/kernel/qt_gui_pch.h41
-rw-r--r--src/gui/kernel/qtestsupport_gui.cpp171
-rw-r--r--src/gui/kernel/qtestsupport_gui.h90
-rw-r--r--src/gui/kernel/qtguiglobal.h55
-rw-r--r--src/gui/kernel/qtguiglobal_p.h40
-rw-r--r--src/gui/kernel/qtouchdevice.cpp292
-rw-r--r--src/gui/kernel/qtouchdevice.h101
-rw-r--r--src/gui/kernel/qtouchdevice_p.h87
-rw-r--r--src/gui/kernel/qwindow.cpp812
-rw-r--r--src/gui/kernel/qwindow.h104
-rw-r--r--src/gui/kernel/qwindow_p.h92
-rw-r--r--src/gui/kernel/qwindowdefs.h46
-rw-r--r--src/gui/kernel/qwindowdefs_win.h46
-rw-r--r--src/gui/kernel/qwindowsysteminterface.cpp1018
-rw-r--r--src/gui/kernel/qwindowsysteminterface.h206
-rw-r--r--src/gui/kernel/qwindowsysteminterface_p.h217
-rw-r--r--src/gui/math3d/math3d.pri15
-rw-r--r--src/gui/math3d/qgenericmatrix.cpp52
-rw-r--r--src/gui/math3d/qgenericmatrix.h82
-rw-r--r--src/gui/math3d/qmatrix4x4.cpp291
-rw-r--r--src/gui/math3d/qmatrix4x4.h375
-rw-r--r--src/gui/math3d/qquaternion.cpp264
-rw-r--r--src/gui/math3d/qquaternion.h274
-rw-r--r--src/gui/math3d/qvector2d.cpp590
-rw-r--r--src/gui/math3d/qvector2d.h293
-rw-r--r--src/gui/math3d/qvector3d.cpp793
-rw-r--r--src/gui/math3d/qvector3d.h320
-rw-r--r--src/gui/math3d/qvector4d.cpp674
-rw-r--r--src/gui/math3d/qvector4d.h321
-rw-r--r--src/gui/math3d/qvectornd.cpp1642
-rw-r--r--src/gui/math3d/qvectornd.h1086
-rw-r--r--src/gui/opengl/opengl.pri123
-rw-r--r--src/gui/opengl/platform/egl/qeglconvenience.cpp596
-rw-r--r--src/gui/opengl/platform/egl/qeglconvenience_p.h91
-rw-r--r--src/gui/opengl/platform/egl/qeglpbuffer.cpp63
-rw-r--r--src/gui/opengl/platform/egl/qeglpbuffer_p.h44
-rw-r--r--src/gui/opengl/platform/egl/qeglplatformcontext.cpp838
-rw-r--r--src/gui/opengl/platform/egl/qeglplatformcontext_p.h115
-rw-r--r--src/gui/opengl/platform/egl/qeglstreamconvenience.cpp87
-rw-r--r--src/gui/opengl/platform/egl/qeglstreamconvenience_p.h179
-rw-r--r--src/gui/opengl/platform/egl/qt_egl_p.h97
-rw-r--r--src/gui/opengl/platform/unix/qglxconvenience.cpp437
-rw-r--r--src/gui/opengl/platform/unix/qglxconvenience_p.h57
-rw-r--r--src/gui/opengl/qopengl.cpp121
-rw-r--r--src/gui/opengl/qopengl.h114
-rw-r--r--src/gui/opengl/qopengl2pexvertexarray.cpp173
-rw-r--r--src/gui/opengl/qopengl2pexvertexarray_p.h168
-rw-r--r--src/gui/opengl/qopengl_p.h44
-rw-r--r--src/gui/opengl/qopenglbuffer.cpp618
-rw-r--r--src/gui/opengl/qopenglbuffer.h145
-rw-r--r--src/gui/opengl/qopenglcustomshaderstage.cpp137
-rw-r--r--src/gui/opengl/qopenglcustomshaderstage_p.h90
-rw-r--r--src/gui/opengl/qopenglengineshadermanager.cpp898
-rw-r--r--src/gui/opengl/qopenglengineshadermanager_p.h507
-rw-r--r--src/gui/opengl/qopenglengineshadersource_p.h970
-rw-r--r--src/gui/opengl/qopenglext.h2
-rw-r--r--src/gui/opengl/qopenglextensions_p.h56
-rw-r--r--src/gui/opengl/qopenglextrafunctions.h44
-rw-r--r--src/gui/opengl/qopenglframebufferobject.cpp1857
-rw-r--r--src/gui/opengl/qopenglframebufferobject.h200
-rw-r--r--src/gui/opengl/qopenglframebufferobject_p.h153
-rw-r--r--src/gui/opengl/qopenglfunctions.cpp506
-rw-r--r--src/gui/opengl/qopenglfunctions.h334
-rw-r--r--src/gui/opengl/qopenglfunctions_1_0.cpp136
-rw-r--r--src/gui/opengl/qopenglfunctions_1_0.h1929
-rw-r--r--src/gui/opengl/qopenglfunctions_1_1.cpp154
-rw-r--r--src/gui/opengl/qopenglfunctions_1_1.h2119
-rw-r--r--src/gui/opengl/qopenglfunctions_1_2.cpp172
-rw-r--r--src/gui/opengl/qopenglfunctions_1_2.h2357
-rw-r--r--src/gui/opengl/qopenglfunctions_1_3.cpp190
-rw-r--r--src/gui/opengl/qopenglfunctions_1_3.h2643
-rw-r--r--src/gui/opengl/qopenglfunctions_1_4.cpp208
-rw-r--r--src/gui/opengl/qopenglfunctions_1_4.h2923
-rw-r--r--src/gui/opengl/qopenglfunctions_1_5.cpp217
-rw-r--r--src/gui/opengl/qopenglfunctions_1_5.h3046
-rw-r--r--src/gui/opengl/qopenglfunctions_2_0.cpp227
-rw-r--r--src/gui/opengl/qopenglfunctions_2_0.h3614
-rw-r--r--src/gui/opengl/qopenglfunctions_2_1.cpp236
-rw-r--r--src/gui/opengl/qopenglfunctions_2_1.h3659
-rw-r--r--src/gui/opengl/qopenglfunctions_3_0.cpp246
-rw-r--r--src/gui/opengl/qopenglfunctions_3_0.h4173
-rw-r--r--src/gui/opengl/qopenglfunctions_3_1.cpp205
-rw-r--r--src/gui/opengl/qopenglfunctions_3_1.h1601
-rw-r--r--src/gui/opengl/qopenglfunctions_3_2_compatibility.cpp265
-rw-r--r--src/gui/opengl/qopenglfunctions_3_2_compatibility.h4377
-rw-r--r--src/gui/opengl/qopenglfunctions_3_2_core.cpp215
-rw-r--r--src/gui/opengl/qopenglfunctions_3_2_core.h1720
-rw-r--r--src/gui/opengl/qopenglfunctions_3_3_compatibility.cpp282
-rw-r--r--src/gui/opengl/qopenglfunctions_3_3_compatibility.h4734
-rw-r--r--src/gui/opengl/qopenglfunctions_3_3_core.cpp224
-rw-r--r--src/gui/opengl/qopenglfunctions_3_3_core.h2141
-rw-r--r--src/gui/opengl/qopenglfunctions_4_0_compatibility.cpp291
-rw-r--r--src/gui/opengl/qopenglfunctions_4_0_compatibility.h5019
-rw-r--r--src/gui/opengl/qopenglfunctions_4_0_core.cpp233
-rw-r--r--src/gui/opengl/qopenglfunctions_4_0_core.h2422
-rw-r--r--src/gui/opengl/qopenglfunctions_4_1_compatibility.cpp300
-rw-r--r--src/gui/opengl/qopenglfunctions_4_1_compatibility.h5556
-rw-r--r--src/gui/opengl/qopenglfunctions_4_1_core.cpp242
-rw-r--r--src/gui/opengl/qopenglfunctions_4_1_core.h2955
-rw-r--r--src/gui/opengl/qopenglfunctions_4_2_compatibility.cpp309
-rw-r--r--src/gui/opengl/qopenglfunctions_4_2_compatibility.h5647
-rw-r--r--src/gui/opengl/qopenglfunctions_4_2_core.cpp251
-rw-r--r--src/gui/opengl/qopenglfunctions_4_2_core.h3042
-rw-r--r--src/gui/opengl/qopenglfunctions_4_3_compatibility.cpp318
-rw-r--r--src/gui/opengl/qopenglfunctions_4_3_compatibility.h5854
-rw-r--r--src/gui/opengl/qopenglfunctions_4_3_core.cpp260
-rw-r--r--src/gui/opengl/qopenglfunctions_4_3_core.h3246
-rw-r--r--src/gui/opengl/qopenglfunctions_4_4_compatibility.cpp326
-rw-r--r--src/gui/opengl/qopenglfunctions_4_4_compatibility.h5976
-rw-r--r--src/gui/opengl/qopenglfunctions_4_4_core.cpp269
-rw-r--r--src/gui/opengl/qopenglfunctions_4_4_core.h3430
-rw-r--r--src/gui/opengl/qopenglfunctions_4_5_compatibility.cpp344
-rw-r--r--src/gui/opengl/qopenglfunctions_4_5_compatibility.h6694
-rw-r--r--src/gui/opengl/qopenglfunctions_4_5_core.cpp278
-rw-r--r--src/gui/opengl/qopenglfunctions_4_5_core.h4072
-rw-r--r--src/gui/opengl/qopenglfunctions_es2.cpp106
-rw-r--r--src/gui/opengl/qopenglfunctions_es2.h931
-rw-r--r--src/gui/opengl/qopenglgradientcache.cpp276
-rw-r--r--src/gui/opengl/qopenglgradientcache_p.h108
-rw-r--r--src/gui/opengl/qopenglpaintdevice.cpp372
-rw-r--r--src/gui/opengl/qopenglpaintdevice.h95
-rw-r--r--src/gui/opengl/qopenglpaintdevice_p.h88
-rw-r--r--src/gui/opengl/qopenglpaintengine.cpp2701
-rw-r--r--src/gui/opengl/qopenglpaintengine_p.h396
-rw-r--r--src/gui/opengl/qopenglpixeltransferoptions.cpp263
-rw-r--r--src/gui/opengl/qopenglpixeltransferoptions.h100
-rw-r--r--src/gui/opengl/qopenglprogrambinarycache.cpp112
-rw-r--r--src/gui/opengl/qopenglprogrambinarycache_p.h61
-rw-r--r--src/gui/opengl/qopenglshadercache_p.h86
-rw-r--r--src/gui/opengl/qopenglshaderprogram.cpp3812
-rw-r--r--src/gui/opengl/qopenglshaderprogram.h318
-rw-r--r--src/gui/opengl/qopengltexture.cpp4986
-rw-r--r--src/gui/opengl/qopengltexture.h663
-rw-r--r--src/gui/opengl/qopengltexture_p.h184
-rw-r--r--src/gui/opengl/qopengltextureblitter.cpp682
-rw-r--r--src/gui/opengl/qopengltextureblitter.h94
-rw-r--r--src/gui/opengl/qopengltexturecache.cpp198
-rw-r--r--src/gui/opengl/qopengltexturecache_p.h108
-rw-r--r--src/gui/opengl/qopengltextureglyphcache.cpp485
-rw-r--r--src/gui/opengl/qopengltextureglyphcache_p.h181
-rw-r--r--src/gui/opengl/qopengltexturehelper.cpp589
-rw-r--r--src/gui/opengl/qopengltexturehelper_p.h797
-rw-r--r--src/gui/opengl/qopengltextureuploader.cpp381
-rw-r--r--src/gui/opengl/qopengltextureuploader_p.h84
-rw-r--r--src/gui/opengl/qopenglversionfunctions.cpp353
-rw-r--r--src/gui/opengl/qopenglversionfunctions.h1912
-rw-r--r--src/gui/opengl/qopenglversionfunctionsfactory.cpp163
-rw-r--r--src/gui/opengl/qopenglversionfunctionsfactory_p.h83
-rw-r--r--src/gui/opengl/qopenglvertexarrayobject.cpp531
-rw-r--r--src/gui/opengl/qopenglvertexarrayobject.h111
-rw-r--r--src/gui/opengl/qopenglvertexarrayobject_p.h125
-rw-r--r--src/gui/opengl/qt_attribution.json4
-rw-r--r--src/gui/painting/painting.pri175
-rw-r--r--src/gui/painting/qbackingstore.cpp165
-rw-r--r--src/gui/painting/qbackingstore.h40
-rw-r--r--src/gui/painting/qbackingstoredefaultcompositor.cpp676
-rw-r--r--src/gui/painting/qbackingstoredefaultcompositor_p.h110
-rw-r--r--src/gui/painting/qbackingstorerhisupport.cpp327
-rw-r--r--src/gui/painting/qbackingstorerhisupport_p.h77
-rw-r--r--src/gui/painting/qbezier.cpp62
-rw-r--r--src/gui/painting/qbezier_p.h46
-rw-r--r--src/gui/painting/qblendfunctions.cpp50
-rw-r--r--src/gui/painting/qblendfunctions_p.h97
-rw-r--r--src/gui/painting/qblittable.cpp40
-rw-r--r--src/gui/painting/qblittable_p.h40
-rw-r--r--src/gui/painting/qbrush.cpp468
-rw-r--r--src/gui/painting/qbrush.h96
-rw-r--r--src/gui/painting/qcmyk_p.h88
-rw-r--r--src/gui/painting/qcolor.cpp794
-rw-r--r--src/gui/painting/qcolor.h519
-rw-r--r--src/gui/painting/qcolor_p.h44
-rw-r--r--src/gui/painting/qcolorclut_p.h127
-rw-r--r--src/gui/painting/qcolormatrix_p.h299
-rw-r--r--src/gui/painting/qcolorspace.cpp990
-rw-r--r--src/gui/painting/qcolorspace.h126
-rw-r--r--src/gui/painting/qcolorspace_p.h110
-rw-r--r--src/gui/painting/qcolortransferfunction_p.h116
-rw-r--r--src/gui/painting/qcolortransfertable_p.h201
-rw-r--r--src/gui/painting/qcolortransform.cpp1748
-rw-r--r--src/gui/painting/qcolortransform.h76
-rw-r--r--src/gui/painting/qcolortransform_p.h72
-rw-r--r--src/gui/painting/qcolortrc_p.h61
-rw-r--r--src/gui/painting/qcolortrclut.cpp126
-rw-r--r--src/gui/painting/qcolortrclut_p.h132
-rw-r--r--src/gui/painting/qcompositionfunctions.cpp1330
-rw-r--r--src/gui/painting/qcoregraphics.mm215
-rw-r--r--src/gui/painting/qcoregraphics_p.h75
-rw-r--r--src/gui/painting/qcosmeticstroker.cpp155
-rw-r--r--src/gui/painting/qcosmeticstroker_p.h45
-rw-r--r--src/gui/painting/qcssutil.cpp65
-rw-r--r--src/gui/painting/qcssutil_p.h40
-rw-r--r--src/gui/painting/qdatabuffer_p.h68
-rw-r--r--src/gui/painting/qdrawhelper.cpp4354
-rw-r--r--src/gui/painting/qdrawhelper_avx2.cpp481
-rw-r--r--src/gui/painting/qdrawhelper_mips_dsp.cpp44
-rw-r--r--src/gui/painting/qdrawhelper_mips_dsp_asm.S42
-rw-r--r--src/gui/painting/qdrawhelper_mips_dsp_p.h40
-rw-r--r--src/gui/painting/qdrawhelper_mips_dspr2_asm.S40
-rw-r--r--src/gui/painting/qdrawhelper_neon.cpp71
-rw-r--r--src/gui/painting/qdrawhelper_neon_asm.S42
-rw-r--r--src/gui/painting/qdrawhelper_neon_p.h40
-rw-r--r--src/gui/painting/qdrawhelper_p.h473
-rw-r--r--src/gui/painting/qdrawhelper_sse2.cpp150
-rw-r--r--src/gui/painting/qdrawhelper_sse4.cpp252
-rw-r--r--src/gui/painting/qdrawhelper_ssse3.cpp44
-rw-r--r--src/gui/painting/qdrawhelper_x86_p.h43
-rw-r--r--src/gui/painting/qdrawingprimitive_sse2_p.h54
-rw-r--r--src/gui/painting/qemulationpaintengine.cpp44
-rw-r--r--src/gui/painting/qemulationpaintengine_p.h40
-rw-r--r--src/gui/painting/qfixed_p.h207
-rw-r--r--src/gui/painting/qgrayraster.c236
-rw-r--r--src/gui/painting/qgrayraster_p.h40
-rw-r--r--src/gui/painting/qicc.cpp1089
-rw-r--r--src/gui/painting/qicc_p.h41
-rw-r--r--src/gui/painting/qimageeffects.cpp327
-rw-r--r--src/gui/painting/qimagescale.cpp907
-rw-r--r--src/gui/painting/qimagescale_neon.cpp238
-rw-r--r--src/gui/painting/qimagescale_p.h43
-rw-r--r--src/gui/painting/qimagescale_sse4.cpp266
-rw-r--r--src/gui/painting/qmath_p.h56
-rw-r--r--src/gui/painting/qmatrix.cpp1190
-rw-r--r--src/gui/painting/qmatrix.h194
-rw-r--r--src/gui/painting/qmemrotate.cpp151
-rw-r--r--src/gui/painting/qmemrotate_p.h42
-rw-r--r--src/gui/painting/qoutlinemapper.cpp74
-rw-r--r--src/gui/painting/qoutlinemapper_p.h56
-rw-r--r--src/gui/painting/qpagedpaintdevice.cpp355
-rw-r--r--src/gui/painting/qpagedpaintdevice.h225
-rw-r--r--src/gui/painting/qpagedpaintdevice_p.h47
-rw-r--r--src/gui/painting/qpagelayout.cpp267
-rw-r--r--src/gui/painting/qpagelayout.h78
-rw-r--r--src/gui/painting/qpageranges.cpp367
-rw-r--r--src/gui/painting/qpageranges.h89
-rw-r--r--src/gui/painting/qpageranges_p.h33
-rw-r--r--src/gui/painting/qpagesize.cpp103
-rw-r--r--src/gui/painting/qpagesize.h81
-rw-r--r--src/gui/painting/qpaintdevice.cpp41
-rw-r--r--src/gui/painting/qpaintdevice.h47
-rw-r--r--src/gui/painting/qpaintdevice.qdoc35
-rw-r--r--src/gui/painting/qpaintengine.cpp94
-rw-r--r--src/gui/painting/qpaintengine.h51
-rw-r--r--src/gui/painting/qpaintengine_blitter.cpp40
-rw-r--r--src/gui/painting/qpaintengine_blitter_p.h40
-rw-r--r--src/gui/painting/qpaintengine_p.h40
-rw-r--r--src/gui/painting/qpaintengine_raster.cpp560
-rw-r--r--src/gui/painting/qpaintengine_raster_p.h71
-rw-r--r--src/gui/painting/qpaintengineex.cpp100
-rw-r--r--src/gui/painting/qpaintengineex_p.h40
-rw-r--r--src/gui/painting/qpainter.cpp981
-rw-r--r--src/gui/painting/qpainter.h156
-rw-r--r--src/gui/painting/qpainter_p.h113
-rw-r--r--src/gui/painting/qpainterpath.cpp331
-rw-r--r--src/gui/painting/qpainterpath.h109
-rw-r--r--src/gui/painting/qpainterpath_p.h195
-rw-r--r--src/gui/painting/qpathclipper.cpp66
-rw-r--r--src/gui/painting/qpathclipper_p.h54
-rw-r--r--src/gui/painting/qpathsimplifier.cpp62
-rw-r--r--src/gui/painting/qpathsimplifier_p.h40
-rw-r--r--src/gui/painting/qpdf.cpp829
-rw-r--r--src/gui/painting/qpdf.qrc7
-rw-r--r--src/gui/painting/qpdf_p.h153
-rw-r--r--src/gui/painting/qpdfwriter.cpp233
-rw-r--r--src/gui/painting/qpdfwriter.h73
-rw-r--r--src/gui/painting/qpen.cpp216
-rw-r--r--src/gui/painting/qpen.h63
-rw-r--r--src/gui/painting/qpen_p.h52
-rw-r--r--src/gui/painting/qpixellayout.cpp2436
-rw-r--r--src/gui/painting/qpixellayout_p.h335
-rw-r--r--src/gui/painting/qplatformbackingstore.cpp604
-rw-r--r--src/gui/painting/qplatformbackingstore.h142
-rw-r--r--src/gui/painting/qpolygon.cpp184
-rw-r--r--src/gui/painting/qpolygon.h167
-rw-r--r--src/gui/painting/qpolygonclipper_p.h316
-rw-r--r--src/gui/painting/qrasterbackingstore.cpp83
-rw-r--r--src/gui/painting/qrasterbackingstore_p.h46
-rw-r--r--src/gui/painting/qrasterdefs_p.h48
-rw-r--r--src/gui/painting/qrasterizer.cpp597
-rw-r--r--src/gui/painting/qrasterizer_p.h41
-rw-r--r--src/gui/painting/qrbtree_p.h44
-rw-r--r--src/gui/painting/qregion.cpp240
-rw-r--r--src/gui/painting/qregion.h101
-rw-r--r--src/gui/painting/qrgb.h62
-rw-r--r--src/gui/painting/qrgba64.h112
-rw-r--r--src/gui/painting/qrgba64.qdoc28
-rw-r--r--src/gui/painting/qrgba64_p.h219
-rw-r--r--src/gui/painting/qrgbafloat.h126
-rw-r--r--src/gui/painting/qrgbafloat.qdoc241
-rw-r--r--src/gui/painting/qrhibackingstore.cpp68
-rw-r--r--src/gui/painting/qrhibackingstore_p.h34
-rw-r--r--src/gui/painting/qstroker.cpp106
-rw-r--r--src/gui/painting/qstroker_p.h57
-rw-r--r--src/gui/painting/qt_attribution.json30
-rw-r--r--src/gui/painting/qt_mips_asm_dsp_p.h46
-rw-r--r--src/gui/painting/qtextureglyphcache.cpp90
-rw-r--r--src/gui/painting/qtextureglyphcache_p.h72
-rw-r--r--src/gui/painting/qtransform.cpp944
-rw-r--r--src/gui/painting/qtransform.h239
-rw-r--r--src/gui/painting/qtriangulatingstroker.cpp86
-rw-r--r--src/gui/painting/qtriangulatingstroker_p.h56
-rw-r--r--src/gui/painting/qtriangulator.cpp71
-rw-r--r--src/gui/painting/qtriangulator_p.h54
-rw-r--r--src/gui/painting/qvectorpath_p.h40
-rw-r--r--src/gui/painting/shaders/backingstorecompose.frag25
-rw-r--r--src/gui/painting/shaders/backingstorecompose.frag.qsbbin0 -> 1657 bytes
-rw-r--r--src/gui/painting/shaders/backingstorecompose.vert19
-rw-r--r--src/gui/painting/shaders/backingstorecompose.vert.qsbbin0 -> 1408 bytes
-rw-r--r--src/gui/painting/webgradients.binaryjsonbin50792 -> 0 bytes
-rw-r--r--src/gui/painting/webgradients.cpp533
-rw-r--r--src/gui/painting/webgradients.css909
-rw-r--r--src/gui/platform/android/qandroidnativeinterface.cpp54
-rw-r--r--src/gui/platform/darwin/qappleiconengine.mm464
-rw-r--r--src/gui/platform/darwin/qappleiconengine_p.h64
-rw-r--r--src/gui/platform/darwin/qapplekeymapper.mm717
-rw-r--r--src/gui/platform/darwin/qapplekeymapper_p.h82
-rw-r--r--src/gui/platform/darwin/qmacmimeregistry.mm118
-rw-r--r--src/gui/platform/darwin/qmacmimeregistry_p.h42
-rw-r--r--src/gui/platform/darwin/qutimimeconverter.h62
-rw-r--r--src/gui/platform/darwin/qutimimeconverter.mm823
-rw-r--r--src/gui/platform/ios/PrivacyInfo.xcprivacy23
-rw-r--r--src/gui/platform/macos/qcocoanativeinterface.mm86
-rw-r--r--src/gui/platform/platform.pri1
-rw-r--r--src/gui/platform/unix/dbusmenu/qdbusmenuadaptor.cpp133
-rw-r--r--src/gui/platform/unix/dbusmenu/qdbusmenuadaptor_p.h147
-rw-r--r--src/gui/platform/unix/dbusmenu/qdbusmenubar.cpp147
-rw-r--r--src/gui/platform/unix/dbusmenu/qdbusmenubar_p.h56
-rw-r--r--src/gui/platform/unix/dbusmenu/qdbusmenuconnection.cpp114
-rw-r--r--src/gui/platform/unix/dbusmenu/qdbusmenuconnection_p.h68
-rw-r--r--src/gui/platform/unix/dbusmenu/qdbusmenuregistrarproxy.cpp30
-rw-r--r--src/gui/platform/unix/dbusmenu/qdbusmenuregistrarproxy_p.h84
-rw-r--r--src/gui/platform/unix/dbusmenu/qdbusmenutypes.cpp279
-rw-r--r--src/gui/platform/unix/dbusmenu/qdbusmenutypes_p.h120
-rw-r--r--src/gui/platform/unix/dbusmenu/qdbusplatformmenu.cpp274
-rw-r--r--src/gui/platform/unix/dbusmenu/qdbusplatformmenu_p.h155
-rw-r--r--src/gui/platform/unix/dbustray/qdbustrayicon.cpp347
-rw-r--r--src/gui/platform/unix/dbustray/qdbustrayicon_p.h132
-rw-r--r--src/gui/platform/unix/dbustray/qdbustraytypes.cpp181
-rw-r--r--src/gui/platform/unix/dbustray/qdbustraytypes_p.h73
-rw-r--r--src/gui/platform/unix/dbustray/qstatusnotifieritemadaptor.cpp161
-rw-r--r--src/gui/platform/unix/dbustray/qstatusnotifieritemadaptor_p.h174
-rw-r--r--src/gui/platform/unix/dbustray/qxdgnotificationproxy.cpp19
-rw-r--r--src/gui/platform/unix/dbustray/qxdgnotificationproxy_p.h110
-rw-r--r--src/gui/platform/unix/qeventdispatcher_glib.cpp92
-rw-r--r--src/gui/platform/unix/qeventdispatcher_glib_p.h52
-rw-r--r--src/gui/platform/unix/qgenericunixeventdispatcher.cpp21
-rw-r--r--src/gui/platform/unix/qgenericunixeventdispatcher_p.h31
-rw-r--r--src/gui/platform/unix/qgenericunixservices.cpp613
-rw-r--r--src/gui/platform/unix/qgenericunixservices_p.h49
-rw-r--r--src/gui/platform/unix/qgenericunixthemes.cpp1351
-rw-r--r--src/gui/platform/unix/qgenericunixthemes_p.h123
-rw-r--r--src/gui/platform/unix/qtx11extras.cpp514
-rw-r--r--src/gui/platform/unix/qtx11extras_p.h75
-rw-r--r--src/gui/platform/unix/qunixeventdispatcher.cpp31
-rw-r--r--src/gui/platform/unix/qunixeventdispatcher_qpa_p.h36
-rw-r--r--src/gui/platform/unix/qunixnativeinterface.cpp311
-rw-r--r--src/gui/platform/unix/qxkbcommon.cpp831
-rw-r--r--src/gui/platform/unix/qxkbcommon_3rdparty.cpp187
-rw-r--r--src/gui/platform/unix/qxkbcommon_p.h128
-rw-r--r--src/gui/platform/wasm/qlocalfileapi.cpp211
-rw-r--r--src/gui/platform/wasm/qlocalfileapi_p.h94
-rw-r--r--src/gui/platform/wasm/qwasmlocalfileaccess.cpp335
-rw-r--r--src/gui/platform/wasm/qwasmlocalfileaccess_p.h55
-rw-r--r--src/gui/platform/wasm/qwasmnativeinterface.cpp17
-rw-r--r--src/gui/platform/wasm/wasm.pri3
-rw-r--r--src/gui/platform/windows/qwindowsguieventdispatcher.cpp201
-rw-r--r--src/gui/platform/windows/qwindowsguieventdispatcher_p.h40
-rw-r--r--src/gui/platform/windows/qwindowsmimeconverter.cpp170
-rw-r--r--src/gui/platform/windows/qwindowsmimeconverter.h43
-rw-r--r--src/gui/platform/windows/qwindowsnativeinterface.cpp312
-rw-r--r--src/gui/platform/windows/qwindowsthemecache.cpp79
-rw-r--r--src/gui/platform/windows/qwindowsthemecache_p.h35
-rw-r--r--src/gui/qt_cmdline.cmake38
-rw-r--r--src/gui/qtgui.tracepoints19
-rw-r--r--src/gui/rhi/MiniEngine_LICENSE.txt (renamed from src/gui/painting/WEBGRADIENTS_LICENSE.txt)5
-rw-r--r--src/gui/rhi/cs_mipmap_p.h939
-rw-r--r--src/gui/rhi/cs_tdr_p.h225
-rw-r--r--src/gui/rhi/mipmap.hlsl117
-rw-r--r--src/gui/rhi/qrhi.cpp7215
-rw-r--r--src/gui/rhi/qrhi.h2026
-rw-r--r--src/gui/rhi/qrhi_p.h2111
-rw-r--r--src/gui/rhi/qrhi_p_p.h551
-rw-r--r--src/gui/rhi/qrhi_platform.h175
-rw-r--r--src/gui/rhi/qrhid3d11.cpp3465
-rw-r--r--src/gui/rhi/qrhid3d11_p.h887
-rw-r--r--src/gui/rhi/qrhid3d11_p_p.h728
-rw-r--r--src/gui/rhi/qrhid3d12.cpp6569
-rw-r--r--src/gui/rhi/qrhid3d12_p.h1248
-rw-r--r--src/gui/rhi/qrhid3dhelpers.cpp172
-rw-r--r--src/gui/rhi/qrhid3dhelpers_p.h53
-rw-r--r--src/gui/rhi/qrhigles2.cpp4681
-rw-r--r--src/gui/rhi/qrhigles2_p.h1163
-rw-r--r--src/gui/rhi/qrhigles2_p_p.h851
-rw-r--r--src/gui/rhi/qrhimetal.mm4564
-rw-r--r--src/gui/rhi/qrhimetal_p.h530
-rw-r--r--src/gui/rhi/qrhimetal_p_p.h463
-rw-r--r--src/gui/rhi/qrhinull.cpp469
-rw-r--r--src/gui/rhi/qrhinull_p.h310
-rw-r--r--src/gui/rhi/qrhinull_p_p.h305
-rw-r--r--src/gui/rhi/qrhiprofiler.cpp606
-rw-r--r--src/gui/rhi/qrhiprofiler_p.h120
-rw-r--r--src/gui/rhi/qrhiprofiler_p_p.h121
-rw-r--r--src/gui/rhi/qrhivulkan.cpp4523
-rw-r--r--src/gui/rhi/qrhivulkan_p.h1061
-rw-r--r--src/gui/rhi/qrhivulkan_p_p.h957
-rw-r--r--src/gui/rhi/qrhivulkanext_p.h81
-rw-r--r--src/gui/rhi/qshader.cpp753
-rw-r--r--src/gui/rhi/qshader.h241
-rw-r--r--src/gui/rhi/qshader_p.h268
-rw-r--r--src/gui/rhi/qshader_p_p.h92
-rw-r--r--src/gui/rhi/qshaderdescription.cpp1770
-rw-r--r--src/gui/rhi/qshaderdescription.h386
-rw-r--r--src/gui/rhi/qshaderdescription_p.h358
-rw-r--r--src/gui/rhi/qshaderdescription_p_p.h98
-rw-r--r--src/gui/rhi/qt_attribution.json16
-rw-r--r--src/gui/rhi/rhi.pri57
-rw-r--r--src/gui/rhi/tdr.hlsl9
-rw-r--r--src/gui/rhi/test.hlsl24
-rw-r--r--src/gui/rhi/vs_test_p.h237
-rw-r--r--src/gui/text/coretext/qcoretextfontdatabase.mm1023
-rw-r--r--src/gui/text/coretext/qcoretextfontdatabase_p.h84
-rw-r--r--src/gui/text/coretext/qfontengine_coretext.mm1000
-rw-r--r--src/gui/text/coretext/qfontengine_coretext_p.h121
-rw-r--r--src/gui/text/freetype/qfontengine_ft.cpp2318
-rw-r--r--src/gui/text/freetype/qfontengine_ft_p.h354
-rw-r--r--src/gui/text/freetype/qfreetypefontdatabase.cpp361
-rw-r--r--src/gui/text/freetype/qfreetypefontdatabase_p.h59
-rw-r--r--src/gui/text/qabstracttextdocumentlayout.cpp59
-rw-r--r--src/gui/text/qabstracttextdocumentlayout.h45
-rw-r--r--src/gui/text/qabstracttextdocumentlayout_p.h56
-rw-r--r--src/gui/text/qcssparser.cpp548
-rw-r--r--src/gui/text/qcssparser_p.h167
-rw-r--r--src/gui/text/qcssscanner.cpp42
-rw-r--r--src/gui/text/qdistancefield.cpp54
-rw-r--r--src/gui/text/qdistancefield_p.h40
-rw-r--r--src/gui/text/qfont.cpp1226
-rw-r--r--src/gui/text/qfont.h181
-rw-r--r--src/gui/text/qfont_p.h137
-rw-r--r--src/gui/text/qfontdatabase.cpp1320
-rw-r--r--src/gui/text/qfontdatabase.h110
-rw-r--r--src/gui/text/qfontdatabase_p.h270
-rw-r--r--src/gui/text/qfontengine.cpp696
-rw-r--r--src/gui/text/qfontengine_p.h162
-rw-r--r--src/gui/text/qfontengine_qpf2.cpp627
-rw-r--r--src/gui/text/qfontengine_qpf2_p.h241
-rw-r--r--src/gui/text/qfontengineglyphcache.cpp40
-rw-r--r--src/gui/text/qfontengineglyphcache_p.h42
-rw-r--r--src/gui/text/qfontinfo.h50
-rw-r--r--src/gui/text/qfontmetrics.cpp573
-rw-r--r--src/gui/text/qfontmetrics.h106
-rw-r--r--src/gui/text/qfontsubset.cpp214
-rw-r--r--src/gui/text/qfontsubset_agl.cpp40
-rw-r--r--src/gui/text/qfontsubset_p.h55
-rw-r--r--src/gui/text/qfragmentmap.cpp40
-rw-r--r--src/gui/text/qfragmentmap_p.h40
-rw-r--r--src/gui/text/qglyphrun.cpp139
-rw-r--r--src/gui/text/qglyphrun.h62
-rw-r--r--src/gui/text/qglyphrun_p.h49
-rw-r--r--src/gui/text/qharfbuzzng.cpp173
-rw-r--r--src/gui/text/qharfbuzzng_p.h63
-rw-r--r--src/gui/text/qinputcontrol.cpp47
-rw-r--r--src/gui/text/qinputcontrol_p.h41
-rw-r--r--src/gui/text/qplatformfontdatabase.cpp277
-rw-r--r--src/gui/text/qplatformfontdatabase.h61
-rw-r--r--src/gui/text/qrawfont.cpp115
-rw-r--r--src/gui/text/qrawfont.h65
-rw-r--r--src/gui/text/qrawfont_p.h40
-rw-r--r--src/gui/text/qstatictext.cpp70
-rw-r--r--src/gui/text/qstatictext.h46
-rw-r--r--src/gui/text/qstatictext_p.h43
-rw-r--r--src/gui/text/qsyntaxhighlighter.cpp74
-rw-r--r--src/gui/text/qsyntaxhighlighter.h40
-rw-r--r--src/gui/text/qt_attribution.json2
-rw-r--r--src/gui/text/qtextcursor.cpp100
-rw-r--r--src/gui/text/qtextcursor.h51
-rw-r--r--src/gui/text/qtextcursor_p.h40
-rw-r--r--src/gui/text/qtextdocument.cpp1442
-rw-r--r--src/gui/text/qtextdocument.h92
-rw-r--r--src/gui/text/qtextdocument_p.cpp101
-rw-r--r--src/gui/text/qtextdocument_p.h120
-rw-r--r--src/gui/text/qtextdocumentfragment.cpp224
-rw-r--r--src/gui/text/qtextdocumentfragment.h55
-rw-r--r--src/gui/text/qtextdocumentfragment_p.h48
-rw-r--r--src/gui/text/qtextdocumentlayout.cpp229
-rw-r--r--src/gui/text/qtextdocumentlayout_p.h40
-rw-r--r--src/gui/text/qtextdocumentwriter.cpp102
-rw-r--r--src/gui/text/qtextdocumentwriter.h45
-rw-r--r--src/gui/text/qtextengine.cpp1009
-rw-r--r--src/gui/text/qtextengine_p.h143
-rw-r--r--src/gui/text/qtextformat.cpp571
-rw-r--r--src/gui/text/qtextformat.h182
-rw-r--r--src/gui/text/qtextformat_p.h58
-rw-r--r--src/gui/text/qtexthtmlparser.cpp710
-rw-r--r--src/gui/text/qtexthtmlparser_p.h91
-rw-r--r--src/gui/text/qtextimagehandler.cpp271
-rw-r--r--src/gui/text/qtextimagehandler_p.h40
-rw-r--r--src/gui/text/qtextlayout.cpp1089
-rw-r--r--src/gui/text/qtextlayout.h111
-rw-r--r--src/gui/text/qtextlist.cpp107
-rw-r--r--src/gui/text/qtextlist.h46
-rw-r--r--src/gui/text/qtextmarkdownimporter.cpp301
-rw-r--r--src/gui/text/qtextmarkdownimporter_p.h57
-rw-r--r--src/gui/text/qtextmarkdownwriter.cpp471
-rw-r--r--src/gui/text/qtextmarkdownwriter_p.h43
-rw-r--r--src/gui/text/qtextobject.cpp157
-rw-r--r--src/gui/text/qtextobject.h113
-rw-r--r--src/gui/text/qtextobject_p.h40
-rw-r--r--src/gui/text/qtextodfwriter.cpp185
-rw-r--r--src/gui/text/qtextodfwriter_p.h52
-rw-r--r--src/gui/text/qtextoption.cpp89
-rw-r--r--src/gui/text/qtextoption.h63
-rw-r--r--src/gui/text/qtexttable.cpp93
-rw-r--r--src/gui/text/qtexttable.h40
-rw-r--r--src/gui/text/qtexttable_p.h51
-rw-r--r--src/gui/text/qzip.cpp1366
-rw-r--r--src/gui/text/qzipreader_p.h127
-rw-r--r--src/gui/text/qzipwriter_p.h117
-rw-r--r--src/gui/text/text.pri124
-rw-r--r--src/gui/text/unix/qfontconfigdatabase.cpp1136
-rw-r--r--src/gui/text/unix/qfontconfigdatabase_p.h46
-rw-r--r--src/gui/text/unix/qfontenginemultifontconfig.cpp58
-rw-r--r--src/gui/text/unix/qfontenginemultifontconfig_p.h39
-rw-r--r--src/gui/text/unix/qgenericunixfontdatabase_p.h31
-rw-r--r--src/gui/text/windows/qwindowsdirectwritefontdatabase.cpp809
-rw-r--r--src/gui/text/windows/qwindowsdirectwritefontdatabase_p.h75
-rw-r--r--src/gui/text/windows/qwindowsfontdatabase.cpp1291
-rw-r--r--src/gui/text/windows/qwindowsfontdatabase_ft.cpp424
-rw-r--r--src/gui/text/windows/qwindowsfontdatabase_ft_p.h46
-rw-r--r--src/gui/text/windows/qwindowsfontdatabase_p.h159
-rw-r--r--src/gui/text/windows/qwindowsfontdatabasebase.cpp1013
-rw-r--r--src/gui/text/windows/qwindowsfontdatabasebase_p.h115
-rw-r--r--src/gui/text/windows/qwindowsfontengine.cpp1151
-rw-r--r--src/gui/text/windows/qwindowsfontengine_p.h143
-rw-r--r--src/gui/text/windows/qwindowsfontenginedirectwrite.cpp1180
-rw-r--r--src/gui/text/windows/qwindowsfontenginedirectwrite_p.h140
-rw-r--r--src/gui/text/windows/qwindowsnativeimage.cpp122
-rw-r--r--src/gui/text/windows/qwindowsnativeimage_p.h54
-rw-r--r--src/gui/util/qabstractlayoutstyleinfo.cpp40
-rw-r--r--src/gui/util/qabstractlayoutstyleinfo_p.h40
-rw-r--r--src/gui/util/qastchandler.cpp53
-rw-r--r--src/gui/util/qastchandler_p.h41
-rw-r--r--src/gui/util/qdesktopservices.cpp233
-rw-r--r--src/gui/util/qdesktopservices.h68
-rw-r--r--src/gui/util/qedidparser.cpp256
-rw-r--r--src/gui/util/qedidparser_p.h57
-rw-r--r--src/gui/util/qedidvendortable_p.h2507
-rw-r--r--src/gui/util/qgraphicsframecapture.cpp123
-rw-r--r--src/gui/util/qgraphicsframecapture_p.h55
-rw-r--r--src/gui/util/qgraphicsframecapture_p_p.h67
-rw-r--r--src/gui/util/qgraphicsframecapturemetal.mm169
-rw-r--r--src/gui/util/qgraphicsframecapturemetal_p_p.h57
-rw-r--r--src/gui/util/qgraphicsframecapturerenderdoc.cpp310
-rw-r--r--src/gui/util/qgraphicsframecapturerenderdoc_p_p.h53
-rw-r--r--src/gui/util/qgridlayoutengine.cpp356
-rw-r--r--src/gui/util/qgridlayoutengine_p.h212
-rw-r--r--src/gui/util/qhexstring_p.h42
-rw-r--r--src/gui/util/qktxhandler.cpp305
-rw-r--r--src/gui/util/qktxhandler_p.h46
-rw-r--r--src/gui/util/qlayoutpolicy.cpp42
-rw-r--r--src/gui/util/qlayoutpolicy_p.h70
-rw-r--r--src/gui/util/qpkmhandler.cpp53
-rw-r--r--src/gui/util/qpkmhandler_p.h41
-rw-r--r--src/gui/util/qshaderformat.cpp145
-rw-r--r--src/gui/util/qshaderformat_p.h122
-rw-r--r--src/gui/util/qshadergenerator.cpp594
-rw-r--r--src/gui/util/qshadergenerator_p.h79
-rw-r--r--src/gui/util/qshadergraph.cpp262
-rw-r--r--src/gui/util/qshadergraph_p.h123
-rw-r--r--src/gui/util/qshadergraphloader.cpp269
-rw-r--r--src/gui/util/qshadergraphloader_p.h99
-rw-r--r--src/gui/util/qshaderlanguage.cpp54
-rw-r--r--src/gui/util/qshaderlanguage_p.h164
-rw-r--r--src/gui/util/qshadernode.cpp172
-rw-r--r--src/gui/util/qshadernode_p.h128
-rw-r--r--src/gui/util/qshadernodeport.cpp55
-rw-r--r--src/gui/util/qshadernodeport_p.h88
-rw-r--r--src/gui/util/qshadernodesloader.cpp289
-rw-r--r--src/gui/util/qshadernodesloader_p.h96
-rw-r--r--src/gui/util/qtexturefiledata.cpp223
-rw-r--r--src/gui/util/qtexturefiledata_p.h65
-rw-r--r--src/gui/util/qtexturefilehandler_p.h42
-rw-r--r--src/gui/util/qtexturefilereader.cpp42
-rw-r--r--src/gui/util/qtexturefilereader_p.h40
-rw-r--r--src/gui/util/qundogroup.cpp479
-rw-r--r--src/gui/util/qundogroup.h64
-rw-r--r--src/gui/util/qundostack.cpp1354
-rw-r--r--src/gui/util/qundostack.h121
-rw-r--r--src/gui/util/qundostack_p.h68
-rw-r--r--src/gui/util/qvalidator.cpp459
-rw-r--r--src/gui/util/qvalidator.h80
-rw-r--r--src/gui/util/util.pri48
-rw-r--r--src/gui/vulkan/KHRONOS_LICENSE.txt20
-rw-r--r--src/gui/vulkan/LICENSE.txt83
-rw-r--r--src/gui/vulkan/licenseheader.h.in2
-rw-r--r--src/gui/vulkan/qbasicvulkanplatforminstance.cpp460
-rw-r--r--src/gui/vulkan/qbasicvulkanplatforminstance_p.h88
-rw-r--r--src/gui/vulkan/qplatformvulkaninstance.cpp58
-rw-r--r--src/gui/vulkan/qplatformvulkaninstance.h56
-rw-r--r--src/gui/vulkan/qt_attribution.json12
-rw-r--r--src/gui/vulkan/qvulkandefaultinstance.cpp85
-rw-r--r--src/gui/vulkan/qvulkandefaultinstance_p.h46
-rw-r--r--src/gui/vulkan/qvulkanfunctions.cpp56
-rw-r--r--src/gui/vulkan/qvulkaninstance.cpp293
-rw-r--r--src/gui/vulkan/qvulkaninstance.h124
-rw-r--r--src/gui/vulkan/qvulkaninstance_p.h60
-rw-r--r--src/gui/vulkan/qvulkanwindow.cpp292
-rw-r--r--src/gui/vulkan/qvulkanwindow.h85
-rw-r--r--src/gui/vulkan/qvulkanwindow_p.h57
-rw-r--r--src/gui/vulkan/vk.xml19936
-rw-r--r--src/gui/vulkan/vulkan.pri61
1074 files changed, 157686 insertions, 218278 deletions
diff --git a/src/gui/CMakeLists.txt b/src/gui/CMakeLists.txt
new file mode 100644
index 0000000000..cef71318d8
--- /dev/null
+++ b/src/gui/CMakeLists.txt
@@ -0,0 +1,1030 @@
+# Copyright (C) 2022 The Qt Company Ltd.
+# SPDX-License-Identifier: BSD-3-Clause
+
+qt_find_package(X11_XCB)
+qt_find_package(WrapHarfbuzz PROVIDED_TARGETS WrapHarfbuzz::WrapHarfbuzz)
+qt_find_package(WrapPNG PROVIDED_TARGETS WrapPNG::WrapPNG)
+qt_find_package(WrapFreetype PROVIDED_TARGETS WrapFreetype::WrapFreetype)
+
+if (QT_FEATURE_gui)
+ if(WIN32)
+ set(_default_platform "windows")
+ elseif(ANDROID)
+ set(_default_platform "android")
+ elseif(MACOS)
+ set(_default_platform "cocoa")
+ elseif(UIKIT)
+ set(_default_platform "ios")
+ elseif(WATCHOS)
+ set(_default_platform "minimal")
+ elseif(QNX)
+ set(_default_platform "qnx")
+ elseif(INTEGRITY)
+ set(_default_platform "eglfs")
+ elseif(HAIKU)
+ set(_default_platform "haiku")
+ elseif(WASM)
+ set(_default_platform "wasm")
+ else()
+ set(_default_platform "xcb")
+ endif()
+
+ set(QT_QPA_DEFAULT_PLATFORM "${_default_platform}" CACHE STRING "QPA default platform")
+endif()
+
+# Silence warnings in 3rdparty code
+if ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU")
+ set_source_files_properties(../3rdparty/md4c/md4c.c PROPERTIES COMPILE_FLAGS "-Wno-unused-parameter -Wno-sign-compare -Wno-missing-field-initializers")
+elseif ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang" OR "${CMAKE_CXX_COMPILER_ID}" STREQUAL "AppleClang")
+ set_source_files_properties(../3rdparty/md4c/md4c.c PROPERTIES COMPILE_FLAGS "-Wno-unused-parameter -Wno-sign-compare -Wno-missing-field-initializers -Wno-missing-braces")
+endif()
+
+# Silence AUTOMOC warning 'No relevant classes found. No output generated.'
+if (NOT UNIX)
+ set_source_files_properties(kernel/qplatformwindow_p.h
+ PROPERTIES SKIP_AUTOMOC TRUE)
+endif()
+
+unset(qmake_module_config)
+if(QT_FEATURE_opengl)
+ list(APPEND qmake_module_config opengl)
+endif()
+
+qt_internal_add_module(Gui
+ PLUGIN_TYPES accessiblebridge platforms platforms/darwin xcbglintegrations platformthemes platforminputcontexts generic iconengines imageformats egldeviceintegrations
+ FEATURE_DEPENDENCIES
+ Qt::Network
+ QMAKE_MODULE_CONFIG "${qmake_module_config}"
+ SOURCES
+ compat/removed_api.cpp
+ image/qabstractfileiconengine.cpp image/qabstractfileiconengine_p.h
+ image/qabstractfileiconprovider.cpp image/qabstractfileiconprovider.h image/qabstractfileiconprovider_p.h
+ image/qbitmap.cpp image/qbitmap.h
+ image/qbmphandler.cpp image/qbmphandler_p.h
+ image/qicon.cpp image/qicon.h image/qicon_p.h
+ image/qiconengine.cpp image/qiconengine.h image/qiconengine_p.h
+ image/qiconengineplugin.cpp image/qiconengineplugin.h
+ image/qiconloader.cpp image/qiconloader_p.h
+ image/qimage.cpp image/qimage.h image/qimage_p.h
+ image/qimage_conversions.cpp
+ image/qimageiohandler.cpp image/qimageiohandler.h
+ image/qimagepixmapcleanuphooks.cpp image/qimagepixmapcleanuphooks_p.h
+ image/qimagereader.cpp image/qimagereader.h
+ image/qimagereaderwriterhelpers.cpp image/qimagereaderwriterhelpers_p.h
+ image/qimagewriter.cpp image/qimagewriter.h
+ image/qpaintengine_pic.cpp image/qpaintengine_pic_p.h
+ image/qpicture.cpp image/qpicture.h image/qpicture_p.h
+ image/qpixmap.cpp image/qpixmap.h
+ image/qpixmap_blitter.cpp image/qpixmap_blitter_p.h
+ image/qpixmap_raster.cpp image/qpixmap_raster_p.h
+ image/qpixmapcache.cpp image/qpixmapcache.h image/qpixmapcache_p.h
+ image/qplatformpixmap.cpp image/qplatformpixmap.h
+ image/qppmhandler.cpp image/qppmhandler_p.h
+ image/qxbmhandler.cpp image/qxbmhandler_p.h
+ image/qxpmhandler.cpp image/qxpmhandler_p.h
+ kernel/qclipboard.cpp kernel/qclipboard.h
+ kernel/qcursor.cpp kernel/qcursor.h kernel/qcursor_p.h
+ kernel/qeventpoint.cpp kernel/qeventpoint.h kernel/qeventpoint_p.h
+ kernel/qevent.cpp kernel/qevent.h kernel/qevent_p.h
+ kernel/qgenericplugin.cpp kernel/qgenericplugin.h
+ kernel/qgenericpluginfactory.cpp kernel/qgenericpluginfactory.h
+ kernel/qguiapplication.cpp kernel/qguiapplication.h kernel/qguiapplication_p.h kernel/qguiapplication_platform.h
+ kernel/qguivariant.cpp
+ kernel/qhighdpiscaling.cpp kernel/qhighdpiscaling_p.h
+ kernel/qinputdevice.cpp kernel/qinputdevice.h kernel/qinputdevice_p.h
+ kernel/qinputdevicemanager.cpp kernel/qinputdevicemanager_p.h
+ kernel/qinputdevicemanager_p_p.h
+ kernel/qinputmethod.cpp kernel/qinputmethod.h kernel/qinputmethod_p.h
+ kernel/qinternalmimedata.cpp kernel/qinternalmimedata_p.h
+ kernel/qkeymapper.cpp kernel/qkeymapper_p.h
+ kernel/qoffscreensurface.cpp kernel/qoffscreensurface.h kernel/qoffscreensurface_p.h
+ kernel/qoffscreensurface_platform.h
+ kernel/qopenglcontext.h
+ kernel/qpaintdevicewindow.cpp kernel/qpaintdevicewindow.h kernel/qpaintdevicewindow_p.h
+ kernel/qpalette.cpp kernel/qpalette.h kernel/qpalette_p.h
+ kernel/qpixelformat.cpp kernel/qpixelformat.h
+ kernel/qplatformclipboard.cpp kernel/qplatformclipboard.h
+ kernel/qplatformcursor.cpp kernel/qplatformcursor.h
+ kernel/qplatformdialoghelper.cpp kernel/qplatformdialoghelper.h
+ kernel/qplatformgraphicsbuffer.cpp kernel/qplatformgraphicsbuffer.h
+ kernel/qplatformgraphicsbufferhelper.cpp kernel/qplatformgraphicsbufferhelper.h
+ kernel/qplatforminputcontext.cpp kernel/qplatforminputcontext.h kernel/qplatforminputcontext_p.h
+ kernel/qplatforminputcontextfactory.cpp kernel/qplatforminputcontextfactory_p.h
+ kernel/qplatforminputcontextplugin.cpp kernel/qplatforminputcontextplugin_p.h
+ kernel/qplatformintegration.cpp kernel/qplatformintegration.h
+ kernel/qplatformintegrationfactory.cpp kernel/qplatformintegrationfactory_p.h
+ kernel/qplatformintegrationplugin.cpp kernel/qplatformintegrationplugin.h
+ kernel/qplatformkeymapper.cpp kernel/qplatformkeymapper.h
+ kernel/qplatformmenu.cpp kernel/qplatformmenu.h kernel/qplatformmenu_p.h
+ kernel/qplatformnativeinterface.cpp kernel/qplatformnativeinterface.h
+ kernel/qplatformoffscreensurface.cpp kernel/qplatformoffscreensurface.h
+ kernel/qplatformopenglcontext.h
+ kernel/qplatformscreen.cpp kernel/qplatformscreen.h kernel/qplatformscreen_p.h
+ kernel/qplatformservices.cpp kernel/qplatformservices.h
+ kernel/qplatformsessionmanager.cpp kernel/qplatformsessionmanager.h
+ kernel/qplatformsharedgraphicscache.cpp kernel/qplatformsharedgraphicscache.h
+ kernel/qplatformsurface.cpp kernel/qplatformsurface.h
+ kernel/qplatformsystemtrayicon.cpp kernel/qplatformsystemtrayicon.h
+ kernel/qplatformtheme.cpp kernel/qplatformtheme.h kernel/qplatformtheme_p.h
+ kernel/qplatformthemefactory.cpp kernel/qplatformthemefactory_p.h
+ kernel/qplatformthemeplugin.cpp kernel/qplatformthemeplugin.h
+ kernel/qplatformwindow.cpp kernel/qplatformwindow.h kernel/qplatformwindow_p.h
+ kernel/qpointingdevice.cpp kernel/qpointingdevice.h kernel/qpointingdevice_p.h
+ kernel/qrasterwindow.cpp kernel/qrasterwindow.h
+ kernel/qscreen.cpp kernel/qscreen.h kernel/qscreen_p.h kernel/qscreen_platform.h
+ kernel/qsessionmanager.cpp kernel/qsessionmanager.h kernel/qsessionmanager_p.h
+ kernel/qstylehints.cpp kernel/qstylehints.h kernel/qstylehints_p.h
+ kernel/qsurface.cpp kernel/qsurface.h
+ kernel/qsurfaceformat.cpp kernel/qsurfaceformat.h
+ kernel/qtestsupport_gui.cpp kernel/qtestsupport_gui.h
+ kernel/qtguiglobal.h kernel/qtguiglobal_p.h
+ kernel/qwindow.cpp kernel/qwindow.h kernel/qwindow_p.h
+ kernel/qwindowdefs.h
+ kernel/qwindowsysteminterface.cpp kernel/qwindowsysteminterface.h kernel/qwindowsysteminterface_p.h
+ math3d/qgenericmatrix.cpp math3d/qgenericmatrix.h
+ math3d/qmatrix4x4.cpp math3d/qmatrix4x4.h
+ math3d/qquaternion.cpp math3d/qquaternion.h
+ math3d/qvector2d.h
+ math3d/qvector3d.h
+ math3d/qvector4d.h
+ math3d/qvectornd.cpp math3d/qvectornd.h
+ opengl/qopengl.h
+ opengl/qopenglext.h
+ opengl/qopenglfunctions.h
+ opengl/qopenglextrafunctions.h
+ painting/qbackingstore.cpp painting/qbackingstore.h
+ painting/qbackingstoredefaultcompositor.cpp painting/qbackingstoredefaultcompositor_p.h
+ painting/qbackingstorerhisupport.cpp painting/qbackingstorerhisupport_p.h
+ painting/qbezier.cpp painting/qbezier_p.h
+ painting/qblendfunctions.cpp painting/qblendfunctions_p.h
+ painting/qblittable.cpp painting/qblittable_p.h
+ painting/qbrush.cpp painting/qbrush.h
+ painting/qcolor.cpp painting/qcolor.h painting/qcolor_p.h
+ painting/qcolorclut_p.h
+ painting/qcolormatrix_p.h
+ painting/qcolorspace.cpp painting/qcolorspace.h painting/qcolorspace_p.h
+ painting/qcolortransferfunction_p.h
+ painting/qcolortransfertable_p.h
+ painting/qcolortransform.cpp painting/qcolortransform.h painting/qcolortransform_p.h
+ painting/qcolortrc_p.h
+ painting/qcolortrclut.cpp painting/qcolortrclut_p.h
+ painting/qcompositionfunctions.cpp
+ painting/qcosmeticstroker.cpp painting/qcosmeticstroker_p.h
+ painting/qcmyk_p.h
+ painting/qdatabuffer_p.h
+ painting/qdrawhelper_p.h
+ painting/qdrawhelper_x86_p.h
+ painting/qdrawingprimitive_sse2_p.h
+ painting/qemulationpaintengine.cpp painting/qemulationpaintengine_p.h
+ painting/qfixed_p.h
+ painting/qgrayraster.c painting/qgrayraster_p.h
+ painting/qicc.cpp painting/qicc_p.h
+ painting/qimageeffects.cpp
+ painting/qimagescale.cpp painting/qimagescale_p.h
+ painting/qmath_p.h
+ painting/qmemrotate.cpp painting/qmemrotate_p.h
+ painting/qoutlinemapper.cpp painting/qoutlinemapper_p.h
+ painting/qpagedpaintdevice.cpp painting/qpagedpaintdevice.h painting/qpagedpaintdevice_p.h
+ painting/qpagelayout.cpp painting/qpagelayout.h
+ painting/qpageranges.cpp painting/qpageranges.h painting/qpageranges_p.h
+ painting/qpagesize.cpp painting/qpagesize.h
+ painting/qpaintdevice.cpp painting/qpaintdevice.h
+ painting/qpaintengine.cpp painting/qpaintengine.h painting/qpaintengine_p.h
+ painting/qpaintengine_blitter.cpp painting/qpaintengine_blitter_p.h
+ painting/qpaintengine_raster.cpp painting/qpaintengine_raster_p.h
+ painting/qpaintengineex.cpp painting/qpaintengineex_p.h
+ painting/qpainter.cpp painting/qpainter.h painting/qpainter_p.h
+ painting/qpainterpath.cpp painting/qpainterpath.h painting/qpainterpath_p.h
+ painting/qpathclipper.cpp painting/qpathclipper_p.h
+ painting/qpathsimplifier.cpp painting/qpathsimplifier_p.h
+ painting/qpdf.cpp painting/qpdf_p.h
+ painting/qpdfwriter.cpp painting/qpdfwriter.h
+ painting/qpen.cpp painting/qpen.h painting/qpen_p.h
+ painting/qpixellayout.cpp painting/qpixellayout_p.h
+ painting/qplatformbackingstore.cpp painting/qplatformbackingstore.h
+ painting/qpolygon.cpp painting/qpolygon.h
+ painting/qrasterdefs_p.h
+ painting/qrasterizer.cpp painting/qrasterizer_p.h
+ painting/qrbtree_p.h
+ painting/qregion.cpp painting/qregion.h
+ painting/qrgb.h
+ painting/qrgba64.h painting/qrgba64_p.h
+ painting/qrgbafloat.h
+ painting/qstroker.cpp painting/qstroker_p.h
+ painting/qtextureglyphcache.cpp painting/qtextureglyphcache_p.h
+ painting/qtransform.cpp painting/qtransform.h
+ painting/qtriangulatingstroker.cpp painting/qtriangulatingstroker_p.h
+ painting/qtriangulator.cpp painting/qtriangulator_p.h
+ painting/qvectorpath_p.h
+ rhi/qrhi.cpp rhi/qrhi.h rhi/qrhi_platform.h rhi/qrhi_p.h
+ rhi/qrhinull.cpp rhi/qrhinull_p.h
+ rhi/qshader.cpp rhi/qshader.h rhi/qshader_p.h
+ rhi/qshaderdescription.cpp rhi/qshaderdescription.h rhi/qshaderdescription_p.h
+ text/qabstracttextdocumentlayout.cpp text/qabstracttextdocumentlayout.h text/qabstracttextdocumentlayout_p.h
+ text/qdistancefield.cpp text/qdistancefield_p.h
+ text/qfont.cpp text/qfont.h text/qfont_p.h
+ text/qfontdatabase.cpp text/qfontdatabase.h text/qfontdatabase_p.h
+ text/qfontengine.cpp text/qfontengine_p.h
+ text/qfontengineglyphcache.cpp text/qfontengineglyphcache_p.h
+ text/qfontinfo.h
+ text/qfontmetrics.cpp text/qfontmetrics.h
+ text/qfontsubset.cpp text/qfontsubset_p.h
+ text/qfragmentmap.cpp text/qfragmentmap_p.h
+ text/qglyphrun.cpp text/qglyphrun.h text/qglyphrun_p.h
+ text/qinputcontrol.cpp text/qinputcontrol_p.h
+ text/qplatformfontdatabase.cpp text/qplatformfontdatabase.h
+ text/qrawfont.cpp text/qrawfont.h text/qrawfont_p.h
+ text/qstatictext.cpp text/qstatictext.h text/qstatictext_p.h
+ text/qsyntaxhighlighter.cpp text/qsyntaxhighlighter.h
+ text/qtextcursor.cpp text/qtextcursor.h text/qtextcursor_p.h
+ text/qtextdocument.cpp text/qtextdocument.h text/qtextdocument_p.cpp text/qtextdocument_p.h
+ text/qtextdocumentfragment.cpp text/qtextdocumentfragment.h text/qtextdocumentfragment_p.h
+ text/qtextdocumentlayout.cpp text/qtextdocumentlayout_p.h
+ text/qtextdocumentwriter.cpp text/qtextdocumentwriter.h
+ text/qtextengine.cpp text/qtextengine_p.h
+ text/qtextformat.cpp text/qtextformat.h text/qtextformat_p.h
+ text/qtexthtmlparser.cpp text/qtexthtmlparser_p.h
+ text/qtextimagehandler.cpp text/qtextimagehandler_p.h
+ text/qtextlayout.cpp text/qtextlayout.h
+ text/qtextlist.cpp text/qtextlist.h
+ text/qtextobject.cpp text/qtextobject.h text/qtextobject_p.h
+ text/qtextoption.cpp text/qtextoption.h
+ text/qtexttable.cpp text/qtexttable.h text/qtexttable_p.h
+ util/qabstractlayoutstyleinfo.cpp util/qabstractlayoutstyleinfo_p.h
+ util/qastchandler.cpp util/qastchandler_p.h
+ util/qdesktopservices.cpp util/qdesktopservices.h
+ util/qgridlayoutengine.cpp util/qgridlayoutengine_p.h
+ util/qhexstring_p.h
+ util/qktxhandler.cpp util/qktxhandler_p.h
+ util/qlayoutpolicy.cpp util/qlayoutpolicy_p.h
+ util/qpkmhandler.cpp util/qpkmhandler_p.h
+ util/qtexturefiledata.cpp util/qtexturefiledata_p.h
+ util/qtexturefilehandler_p.h
+ util/qtexturefilereader.cpp util/qtexturefilereader_p.h
+ util/qvalidator.cpp util/qvalidator.h
+ DEFINES
+ QT_NO_CONTEXTLESS_CONNECT
+ QT_NO_FOREACH
+ QT_NO_USING_NAMESPACE
+ QT_USE_NODISCARD_FILE_OPEN
+ QT_QPA_DEFAULT_PLATFORM_NAME="${QT_QPA_DEFAULT_PLATFORM}"
+ INCLUDE_DIRECTORIES
+ ../3rdparty/VulkanMemoryAllocator
+ ../3rdparty/D3D12MemoryAllocator
+ LIBRARIES
+ Qt::CorePrivate
+ PUBLIC_LIBRARIES
+ Qt::Core
+ PRIVATE_MODULE_INTERFACE
+ Qt::CorePrivate
+ NO_PCH_SOURCES
+ compat/removed_api.cpp
+ painting/qdrawhelper.cpp
+ PRECOMPILED_HEADER
+ "kernel/qt_gui_pch.h"
+ GENERATE_CPP_EXPORTS
+ QPA_HEADER_FILTERS
+ "(^|/)qplatform.+\\.h$|(^|/)qwindowsystem.+\\.h$"
+ RHI_HEADER_FILTERS
+ "(^|/)qrhi\\.h$|(^|/)qrhi_platform\\.h$|(^|/)qshader\\.h$|(^|/)qshaderdescription\\.h$"
+)
+
+# Resources:
+if(QT_FEATURE_pdf)
+ set_source_files_properties("../3rdparty/icc/sRGB2014.icc"
+ PROPERTIES QT_RESOURCE_ALIAS "sRGB2014.icc"
+ )
+ set(qpdf_resource_files
+ "../3rdparty/icc/sRGB2014.icc"
+ "painting/qpdfa_metadata.xml"
+ )
+ qt_internal_add_resource(Gui "qpdf"
+ PREFIX
+ "/qpdf/"
+ BASE
+ "painting"
+ FILES
+ ${qpdf_resource_files}
+ )
+endif()
+
+if(WIN32 OR (UNIX AND NOT APPLE))
+ set_target_properties(Gui PROPERTIES UNITY_BUILD OFF) # X11 define clashes/Windows oddities.
+endif()
+
+qt_internal_add_resource(Gui "gui_shaders"
+ PREFIX
+ "/qt-project.org/gui"
+ FILES
+ "painting/shaders/backingstorecompose.vert.qsb"
+ "painting/shaders/backingstorecompose.frag.qsb"
+)
+
+if(QT_FEATURE_reduce_relocations AND UNIX AND GCC)
+ target_link_options(Gui PRIVATE
+ "LINKER:--dynamic-list=${CMAKE_CURRENT_LIST_DIR}/QtGui.dynlist")
+endif()
+
+qt_internal_extend_target(Gui CONDITION QT_FEATURE_standarditemmodel
+ SOURCES
+ itemmodels/qstandarditemmodel.cpp itemmodels/qstandarditemmodel.h itemmodels/qstandarditemmodel_p.h
+)
+
+# With qmake, gui's opengl.pri used CONFIG += opengl, where opengl.prf
+# used direct public linkage against either libGLESv2 or libGL, depending
+# on the opengl _feature_. This is done by hand now here (where the
+# feature is available).
+# On Windows with 'dynamic' OpenGL we must not link to opengl32.
+# DO NOT MOVE THIS TO THE BEGINNING OF THE FILE, the feature variables are not
+# available until the qt_internal_add_module call.
+if(QT_FEATURE_opengl)
+ if(QT_FEATURE_opengles2)
+ find_package(GLESv2)
+ target_link_libraries(Gui PUBLIC GLESv2::GLESv2)
+
+ if(INTEGRITY AND _qt_igy_gui_libs)
+ qt_internal_extend_target(Gui
+ LIBRARIES
+ IntegrityPlatformGraphics::IntegrityPlatformGraphics
+ )
+ endif()
+
+ elseif(NOT QT_FEATURE_opengl_dynamic)
+ target_link_libraries(Gui PUBLIC WrapOpenGL::WrapOpenGL)
+ endif()
+endif()
+
+qt_internal_extend_target(Gui CONDITION QT_FEATURE_opengl
+ SOURCES
+ kernel/qopenglcontext.cpp kernel/qopenglcontext_p.h
+ kernel/qopenglcontext_platform.h
+ kernel/qplatformopenglcontext.cpp
+ opengl/qopengl.cpp opengl/qopengl_p.h
+ opengl/qopenglextensions_p.h
+ opengl/qopenglfunctions.cpp
+ opengl/qopenglprogrambinarycache.cpp opengl/qopenglprogrambinarycache_p.h
+ rhi/qrhigles2.cpp rhi/qrhigles2_p.h
+)
+
+qt_internal_extend_target(Gui CONDITION MACOS
+ SOURCES
+ platform/macos/qcocoanativeinterface.mm
+ LIBRARIES
+ ${FWAppKit}
+ ${FWCarbon}
+ PUBLIC_LIBRARIES
+ ${FWAppKit}
+)
+
+qt_internal_extend_target(Gui CONDITION WASM
+ SOURCES
+ platform/wasm/qwasmnativeinterface.cpp
+)
+
+qt_internal_extend_target(Gui CONDITION APPLE
+ SOURCES
+ image/qimage_darwin.mm
+ painting/qcoregraphics.mm painting/qcoregraphics_p.h
+ painting/qrasterbackingstore.cpp painting/qrasterbackingstore_p.h
+ painting/qrhibackingstore.cpp painting/qrhibackingstore_p.h
+ platform/darwin/qmacmimeregistry.mm platform/darwin/qmacmimeregistry_p.h
+ platform/darwin/qutimimeconverter.mm platform/darwin/qutimimeconverter.h
+ platform/darwin/qapplekeymapper.mm platform/darwin/qapplekeymapper_p.h
+ platform/darwin/qappleiconengine.mm platform/darwin/qappleiconengine_p.h
+ text/coretext/qcoretextfontdatabase.mm text/coretext/qcoretextfontdatabase_p.h
+ text/coretext/qfontengine_coretext.mm text/coretext/qfontengine_coretext_p.h
+ LIBRARIES
+ ${FWCoreFoundation}
+ ${FWCoreGraphics}
+ ${FWCoreText}
+ ${FWFoundation}
+ PUBLIC_LIBRARIES
+ ${FWImageIO}
+)
+
+qt_internal_extend_target(Gui CONDITION QT_FEATURE_animation
+ SOURCES
+ animation/qguivariantanimation.cpp
+)
+
+qt_internal_extend_target(Gui CONDITION WIN32
+ SOURCES
+ image/qpixmap_win.cpp image/qpixmap_win_p.h
+ kernel/qwindowdefs_win.h
+ platform/windows/qwindowsguieventdispatcher.cpp platform/windows/qwindowsguieventdispatcher_p.h
+ platform/windows/qwindowsmimeconverter.h platform/windows/qwindowsmimeconverter.cpp
+ platform/windows/qwindowsnativeinterface.cpp
+ platform/windows/qwindowsthemecache.cpp platform/windows/qwindowsthemecache_p.h
+ rhi/qrhid3d11.cpp rhi/qrhid3d11_p.h
+ rhi/qrhid3dhelpers.cpp rhi/qrhid3dhelpers_p.h
+ rhi/vs_test_p.h
+ rhi/qrhid3d12.cpp rhi/qrhid3d12_p.h
+ rhi/cs_mipmap_p.h
+ ../3rdparty/D3D12MemoryAllocator/D3D12MemAlloc.h
+ ../3rdparty/D3D12MemoryAllocator/D3D12MemAlloc.cpp
+ text/windows/qwindowsfontdatabase.cpp text/windows/qwindowsfontdatabase_p.h
+ text/windows/qwindowsfontdatabasebase.cpp text/windows/qwindowsfontdatabasebase_p.h
+ text/windows/qwindowsfontengine.cpp text/windows/qwindowsfontengine_p.h
+ text/windows/qwindowsnativeimage.cpp text/windows/qwindowsnativeimage_p.h
+ LIBRARIES
+ advapi32
+ gdi32
+ ole32
+ shell32
+ user32
+ uxtheme
+ PUBLIC_LIBRARIES
+ d3d11
+ dxgi
+ dxguid
+ d3d12
+)
+
+if(QT_FEATURE_graphicsframecapture)
+ qt_internal_extend_target(Gui
+ SOURCES
+ util/qgraphicsframecapture_p.h util/qgraphicsframecapture.cpp
+ util/qgraphicsframecapture_p_p.h
+ )
+
+ qt_internal_extend_target(Gui CONDITION (WIN32 OR (UNIX AND NOT APPLE)) AND QT_FEATURE_library
+ LIBRARIES
+ RenderDoc::RenderDoc
+ SOURCES
+ util/qgraphicsframecapturerenderdoc_p_p.h util/qgraphicsframecapturerenderdoc.cpp
+ )
+
+ qt_internal_extend_target(Gui CONDITION IOS OR MACOS
+ SOURCES
+ util/qgraphicsframecapturemetal_p_p.h util/qgraphicsframecapturemetal.mm
+ PUBLIC_LIBRARIES
+ ${FWMetal}
+ )
+endif()
+
+if(QT_FEATURE_egl)
+ qt_find_package(EGL)
+endif()
+
+qt_internal_extend_target(Gui CONDITION QT_FEATURE_egl
+ SOURCES
+ opengl/platform/egl/qeglconvenience.cpp opengl/platform/egl/qeglconvenience_p.h
+ opengl/platform/egl/qeglstreamconvenience.cpp opengl/platform/egl/qeglstreamconvenience_p.h
+ opengl/platform/egl/qt_egl_p.h
+ LIBRARIES
+ EGL::EGL
+)
+
+# These two headers are always installed, their contents are guarded with
+# "#if QT_CONFIG(accessibility)", so if QT_FEATURE_accessibility is not
+# enabled, they are just duds.
+qt_internal_extend_target(Gui
+ SOURCES
+ accessible/qaccessible.h accessible/qplatformaccessibility.h
+)
+
+qt_internal_extend_target(Gui CONDITION QT_FEATURE_accessibility
+ SOURCES
+ accessible/qaccessible.cpp accessible/qaccessible_base.h
+ accessible/qaccessiblebridge.cpp accessible/qaccessiblebridge.h
+ accessible/qaccessiblebridgeutils.cpp accessible/qaccessiblebridgeutils_p.h
+ accessible/qaccessiblecache.cpp accessible/qaccessiblecache_p.h
+ accessible/qaccessibleobject.cpp accessible/qaccessibleobject.h
+ accessible/qaccessibleplugin.cpp accessible/qaccessibleplugin.h
+ accessible/qplatformaccessibility.cpp
+)
+
+qt_internal_extend_target(Gui CONDITION APPLE AND QT_FEATURE_accessibility
+ SOURCES
+ accessible/qaccessiblecache_mac.mm
+ LIBRARIES
+ ${FWFoundation}
+)
+
+if(QT_FEATURE_accessibility AND QT_FEATURE_accessibility_atspi_bridge)
+ set(atspi_accessibility ON)
+else()
+ set(atspi_accessibility OFF)
+endif()
+
+qt_internal_extend_target(Gui CONDITION atspi_accessibility
+ SOURCES
+ accessible/linux/atspiadaptor.cpp accessible/linux/atspiadaptor_p.h
+ accessible/linux/dbusconnection.cpp accessible/linux/dbusconnection_p.h
+ accessible/linux/qspi_constant_mappings.cpp accessible/linux/qspi_constant_mappings_p.h
+ accessible/linux/qspi_struct_marshallers.cpp accessible/linux/qspi_struct_marshallers_p.h
+ accessible/linux/qspiaccessiblebridge.cpp accessible/linux/qspiaccessiblebridge_p.h
+ accessible/linux/qspiapplicationadaptor.cpp accessible/linux/qspiapplicationadaptor_p.h
+ accessible/linux/qspidbuscache.cpp accessible/linux/qspidbuscache_p.h
+ DBUS_ADAPTOR_SOURCES
+ accessible/linux/dbusxml/Cache.xml
+ accessible/linux/dbusxml/DeviceEventController.xml
+ DBUS_ADAPTOR_FLAGS
+ "-i" "QtGui/private/qspi_struct_marshallers_p.h"
+ DBUS_INTERFACE_SOURCES
+ accessible/linux/dbusxml/Bus.xml
+ accessible/linux/dbusxml/Socket.xml
+ DBUS_INTERFACE_FLAGS
+ "-i" "QtGui/private/qspi_struct_marshallers_p.h"
+)
+
+if(atspi_accessibility)
+ qt_internal_add_target_include_dirs(Gui PkgConfig::ATSPI2)
+endif()
+
+qt_internal_extend_target(Gui CONDITION QT_FEATURE_action
+ SOURCES
+ kernel/qaction.cpp kernel/qaction.h kernel/qaction_p.h
+ kernel/qactiongroup.cpp kernel/qactiongroup.h kernel/qactiongroup_p.h
+)
+
+qt_internal_extend_target(Gui CONDITION QT_FEATURE_draganddrop
+ SOURCES
+ kernel/qdnd.cpp kernel/qdnd_p.h
+ kernel/qdrag.cpp kernel/qdrag.h
+ kernel/qplatformdrag.cpp kernel/qplatformdrag.h
+ kernel/qshapedpixmapdndwindow.cpp kernel/qshapedpixmapdndwindow_p.h
+ kernel/qsimpledrag.cpp kernel/qsimpledrag_p.h
+)
+
+qt_internal_extend_target(Gui CONDITION QT_FEATURE_shortcut
+ SOURCES
+ kernel/qkeysequence.cpp kernel/qkeysequence.h kernel/qkeysequence_p.h
+ kernel/qshortcut.cpp kernel/qshortcut.h kernel/qshortcut_p.h
+ kernel/qshortcutmap.cpp kernel/qshortcutmap_p.h
+)
+
+qt_internal_extend_target(Gui CONDITION QT_FEATURE_movie
+ SOURCES
+ image/qmovie.cpp image/qmovie.h
+)
+
+qt_internal_extend_target(Gui CONDITION QT_FEATURE_png
+ SOURCES
+ image/qpnghandler.cpp image/qpnghandler_p.h
+ LIBRARIES
+ WrapPNG::WrapPNG
+)
+
+qt_internal_extend_target(Gui
+ CONDITION
+ QT_FEATURE_png AND WIN32 AND MINGW AND
+ (CMAKE_CXX_COMPILER_VESION VERSION_EQUAL "8.1.0")
+ COMPILE_OPTIONS
+ -fno-reorder-blocks-and-partition
+)
+
+if(TEST_architecture_arch STREQUAL x86_64)
+ qt_internal_extend_target(Gui
+ SOURCES
+ painting/qdrawhelper_sse2.cpp
+ )
+else()
+ qt_internal_add_simd_part(Gui SIMD sse2
+ SOURCES
+ painting/qdrawhelper_sse2.cpp
+ )
+endif()
+
+qt_internal_add_simd_part(Gui SIMD ssse3
+ SOURCES
+ image/qimage_ssse3.cpp
+ painting/qdrawhelper_ssse3.cpp
+)
+
+qt_internal_add_simd_part(Gui SIMD sse4_1
+ SOURCES
+ painting/qdrawhelper_sse4.cpp
+ painting/qimagescale_sse4.cpp
+)
+
+qt_internal_add_simd_part(Gui SIMD arch_haswell
+ SOURCES
+ painting/qdrawhelper_avx2.cpp
+ EXCLUDE_OSX_ARCHITECTURES
+ arm64
+)
+
+qt_internal_add_simd_part(Gui SIMD neon
+ SOURCES
+ image/qimage_neon.cpp
+ painting/qdrawhelper_neon.cpp painting/qdrawhelper_neon_p.h
+ painting/qimagescale_neon.cpp
+)
+
+if(NOT ANDROID)
+ qt_internal_add_simd_part(Gui SIMD mips_dsp
+ SOURCES
+ painting/qdrawhelper_mips_dsp.cpp painting/qdrawhelper_mips_dsp_p.h
+ painting/qdrawhelper_mips_dsp_asm.S
+ painting/qt_mips_asm_dsp_p.h
+ )
+
+ qt_internal_add_simd_part(Gui SIMD mips_dspr2
+ SOURCES
+ image/qimage_mips_dspr2.cpp
+ image/qimage_mips_dspr2_asm.S
+ painting/qdrawhelper_mips_dspr2_asm.S
+ )
+endif()
+
+qt_internal_extend_target(Gui CONDITION ANDROID
+ SOURCES
+ platform/android/qandroidnativeinterface.cpp
+ painting/qrasterbackingstore.cpp painting/qrasterbackingstore_p.h
+ painting/qrhibackingstore.cpp painting/qrhibackingstore_p.h
+)
+
+qt_internal_extend_target(Gui CONDITION ANDROID AND (TEST_architecture_arch STREQUAL arm64 OR TEST_architecture_arch STREQUAL arm)
+ SOURCES
+ image/qimage_neon.cpp
+ painting/qdrawhelper_neon.cpp painting/qdrawhelper_neon_p.h
+ painting/qimagescale_neon.cpp
+)
+
+qt_internal_extend_target(Gui CONDITION ANDROID AND (TEST_architecture_arch STREQUAL i386 OR TEST_architecture_arch STREQUAL x86_64)
+ SOURCES
+ image/qimage_ssse3.cpp
+ painting/qdrawhelper_sse2.cpp
+ painting/qdrawhelper_ssse3.cpp
+ DEFINES
+ QT_COMPILER_SUPPORTS_SSE2 QT_COMPILER_SUPPORTS_SSE2
+ QT_COMPILER_SUPPORTS_SSE3 QT_COMPILER_SUPPORTS_SSE3
+ QT_COMPILER_SUPPORTS_SSSE3 QT_COMPILER_SUPPORTS_SSSE3
+)
+
+if (MINGW AND CMAKE_CXX_COMPILER_VERSION VERSION_EQUAL 8.1.0)
+ # https://gcc.gnu.org/bugzilla/show_bug.cgi?id=86048
+ set_source_files_properties(image/qpnghandler.cpp
+ PROPERTIES COMPILE_OPTIONS -fno-reorder-blocks-and-partition
+ )
+endif()
+
+qt_internal_extend_target(Gui CONDITION QT_FEATURE_harfbuzz
+ SOURCES
+ text/qharfbuzzng.cpp text/qharfbuzzng_p.h
+ LIBRARIES
+ WrapHarfbuzz::WrapHarfbuzz
+)
+
+qt_internal_extend_target(Gui CONDITION QT_FEATURE_harfbuzz AND UIKIT
+ LIBRARIES
+ ${FWCoreText}
+)
+
+qt_internal_extend_target(Gui CONDITION QT_FEATURE_textodfwriter
+ SOURCES
+ text/qtextodfwriter.cpp text/qtextodfwriter_p.h
+)
+
+qt_internal_extend_target(Gui CONDITION QT_FEATURE_textmarkdownreader
+ SOURCES
+ text/qtextmarkdownimporter.cpp text/qtextmarkdownimporter_p.h
+)
+
+qt_internal_extend_target(Gui CONDITION QT_FEATURE_system_textmarkdownreader AND QT_FEATURE_textmarkdownreader
+ LIBRARIES
+ WrapSystemMd4c::WrapSystemMd4c
+)
+
+qt_internal_extend_target(Gui CONDITION QT_FEATURE_textmarkdownreader AND NOT QT_FEATURE_system_textmarkdownreader
+ SOURCES
+ ../3rdparty/md4c/md4c.c ../3rdparty/md4c/md4c.h
+ DEFINES
+ MD4C_USE_UTF8
+ INCLUDE_DIRECTORIES
+ ../3rdparty/md4c
+)
+
+qt_internal_extend_target(Gui CONDITION QT_FEATURE_textmarkdownwriter
+ SOURCES
+ text/qtextmarkdownwriter.cpp text/qtextmarkdownwriter_p.h
+)
+
+qt_internal_extend_target(Gui CONDITION QT_FEATURE_cssparser
+ SOURCES
+ painting/qcssutil.cpp painting/qcssutil_p.h
+ text/qcssparser.cpp text/qcssparser_p.h
+)
+
+qt_internal_extend_target(Gui CONDITION QT_FEATURE_freetype
+ SOURCES
+ text/freetype/qfontengine_ft.cpp text/freetype/qfontengine_ft_p.h
+ text/freetype/qfreetypefontdatabase.cpp text/freetype/qfreetypefontdatabase_p.h
+ LIBRARIES
+ WrapFreetype::WrapFreetype
+)
+
+qt_internal_extend_target(Gui CONDITION UNIX AND NOT APPLE
+ SOURCES
+ text/unix/qgenericunixfontdatabase_p.h
+)
+
+qt_internal_extend_target(Gui CONDITION QT_FEATURE_fontconfig AND QT_FEATURE_freetype AND UNIX AND NOT APPLE
+ SOURCES
+ text/unix/qfontconfigdatabase.cpp text/unix/qfontconfigdatabase_p.h
+ text/unix/qfontenginemultifontconfig.cpp text/unix/qfontenginemultifontconfig_p.h
+ LIBRARIES
+ Fontconfig::Fontconfig
+)
+
+qt_internal_extend_target(Gui CONDITION APPLE AND NOT MACOS
+ LIBRARIES
+ ${FWUIKit}
+)
+
+qt_internal_extend_target(Gui CONDITION APPLE AND QT_FEATURE_freetype
+ LIBRARIES
+ WrapFreetype::WrapFreetype
+)
+
+qt_internal_extend_target(Gui CONDITION QT_FEATURE_freetype AND WIN32
+ SOURCES
+ text/windows/qwindowsfontdatabase_ft.cpp text/windows/qwindowsfontdatabase_ft_p.h
+ LIBRARIES
+ WrapFreetype::WrapFreetype
+)
+
+qt_internal_extend_target(Gui CONDITION QT_FEATURE_direct2d AND QT_FEATURE_directwrite AND WIN32
+ SOURCES
+ text/windows/qwindowsfontenginedirectwrite.cpp text/windows/qwindowsfontenginedirectwrite_p.h
+ LIBRARIES
+ d2d1
+)
+
+qt_internal_extend_target(Gui CONDITION QT_FEATURE_direct2d AND QT_FEATURE_directwrite AND QT_FEATURE_directwrite3 AND WIN32
+ SOURCES
+ text/windows/qwindowsdirectwritefontdatabase.cpp text/windows/qwindowsdirectwritefontdatabase_p.h
+ LIBRARIES
+ dwrite
+)
+
+qt_internal_extend_target(Gui CONDITION QT_FEATURE_direct2d AND QT_FEATURE_directwrite AND WIN32 AND NOT QT_FEATURE_directwrite3
+ LIBRARIES
+ dwrite
+)
+
+qt_internal_extend_target(Gui CONDITION MINGW AND WIN32
+ LIBRARIES
+ uuid
+)
+
+# Only enable the Pixman draw-helpers on platforms that support the GAS syntax of their asm files
+# Note: These helpers are only used for 16-bit surfaces, so excluding them does not generally
+# exclude neon-drawhelpers on these platforms.
+if(UNIX AND NOT ANDROID AND NOT INTEGRITY AND NOT (TEST_architecture_arch STREQUAL "arm64") AND NOT UIKIT AND NOT QT_IS_MACOS_UNIVERSAL)
+ qt_internal_extend_target(Gui DEFINES ENABLE_PIXMAN_DRAWHELPERS)
+ qt_internal_add_simd_part(Gui SIMD neon
+ SOURCES
+ ../3rdparty/pixman/pixman-arm-neon-asm.S
+ painting/qdrawhelper_neon_asm.S
+ )
+endif()
+
+qt_internal_extend_target(Gui CONDITION ANDROID AND TEST_architecture_arch STREQUAL x86_64
+ SOURCES
+ painting/qdrawhelper_sse4.cpp
+ painting/qimagescale_sse4.cpp
+ DEFINES
+ QT_COMPILER_SUPPORTS_SSE4_1
+ QT_COMPILER_SUPPORTS_SSE4_2
+)
+
+qt_internal_extend_target(Gui CONDITION QT_FEATURE_system_zlib
+ LIBRARIES
+ WrapZLIB::WrapZLIB
+)
+
+qt_internal_extend_target(Gui CONDITION NOT QT_FEATURE_system_zlib
+ INCLUDE_DIRECTORIES
+ ../3rdparty/zlib/src
+)
+
+qt_internal_extend_target(Gui CONDITION NOT QT_FEATURE_system_zlib AND NOT no_core_dep
+ LIBRARIES
+ Qt::Core
+)
+
+qt_internal_extend_target(Gui CONDITION QT_FEATURE_undocommand
+ SOURCES
+ util/qundostack.cpp util/qundostack.h util/qundostack_p.h
+)
+
+qt_internal_extend_target(Gui CONDITION QT_FEATURE_undogroup
+ SOURCES
+ util/qundogroup.cpp util/qundogroup.h
+)
+
+qt_internal_extend_target(Gui CONDITION QT_FEATURE_opengl AND QT_FEATURE_xlib AND NOT QT_FEATURE_opengles2
+ SOURCES
+ opengl/platform/unix/qglxconvenience.cpp opengl/platform/unix/qglxconvenience_p.h
+ LIBRARIES
+ X11::X11
+)
+
+qt_internal_extend_target(Gui CONDITION QT_FEATURE_opengles2
+ SOURCES
+ opengl/qopengles2ext.h
+)
+
+qt_internal_extend_target(Gui CONDITION QT_FEATURE_egl AND QT_FEATURE_opengl AND NOT WASM
+ SOURCES
+ opengl/platform/egl/qeglpbuffer.cpp opengl/platform/egl/qeglpbuffer_p.h
+ opengl/platform/egl/qeglplatformcontext.cpp opengl/platform/egl/qeglplatformcontext_p.h
+)
+
+qt_internal_extend_target(Gui CONDITION QT_FEATURE_egl AND NOT QT_FEATURE_egl_x11
+ DEFINES
+ QT_EGL_NO_X11
+)
+
+qt_internal_extend_target(Gui CONDITION QT_FEATURE_dlopen AND QT_FEATURE_egl
+ LIBRARIES
+ ${CMAKE_DL_LIBS}
+)
+
+qt_internal_extend_target(Gui CONDITION QT_FEATURE_standarditemmodel
+ SOURCES
+ itemmodels/qstandarditemmodel.cpp itemmodels/qstandarditemmodel.h itemmodels/qstandarditemmodel_p.h
+)
+
+qt_internal_extend_target(Gui CONDITION QT_FEATURE_filesystemmodel
+ SOURCES
+ itemmodels/qfileinfogatherer.cpp itemmodels/qfileinfogatherer_p.h
+ itemmodels/qfilesystemmodel.cpp itemmodels/qfilesystemmodel.h itemmodels/qfilesystemmodel_p.h
+)
+
+qt_internal_extend_target(Gui CONDITION QT_FEATURE_vulkan
+ SOURCES
+ rhi/qrhivulkan.cpp rhi/qrhivulkan_p.h
+ vulkan/qbasicvulkanplatforminstance.cpp vulkan/qbasicvulkanplatforminstance_p.h
+ vulkan/qplatformvulkaninstance.cpp vulkan/qplatformvulkaninstance.h
+ vulkan/qvulkandefaultinstance.cpp vulkan/qvulkandefaultinstance_p.h
+ vulkan/qvulkanfunctions.cpp
+ vulkan/qvulkaninstance.cpp vulkan/qvulkaninstance.h vulkan/qvulkaninstance_p.h
+ vulkan/qvulkanwindow.cpp vulkan/qvulkanwindow.h vulkan/qvulkanwindow_p.h
+)
+if(QT_FEATURE_vulkan)
+ qt_internal_add_target_include_dirs_and_optionally_propagate(
+ Gui WrapVulkanHeaders::WrapVulkanHeaders)
+endif()
+
+# We must always generate syncqt-injected header files,
+# because we added a custom command earlier for those for framework builds.
+set(vulkan_fun "qvulkanfunctions.h")
+set(vulkan_fun_p "qvulkanfunctions_p.h")
+set(vulkan_fun_outputs "vulkan/${vulkan_fun}" "vulkan/${vulkan_fun_p}")
+set(vulkan_fun_command_content COMMAND "${CMAKE_COMMAND}" -E make_directory "vulkan")
+if (QT_FEATURE_vulkan)
+ set(vulkan_fun_p_cpp "qvulkanfunctions_p.cpp")
+ list(APPEND vulkan_fun_outputs "vulkan/${vulkan_fun_p_cpp}")
+
+ if(NOT "${QT_HOST_PATH}" STREQUAL "")
+ set(host_executable_suffix "")
+ if(CMAKE_HOST_WIN32)
+ set(host_executable_suffix ".exe")
+ endif()
+ qt_path_join(qvkgen
+ "${QT_HOST_PATH}"
+ "${QT${PROJECT_VERSION_MAJOR}_HOST_INFO_LIBEXECDIR}"
+ "qvkgen${host_executable_suffix}")
+ else()
+ set(qvkgen "${QT_CMAKE_EXPORT_NAMESPACE}::qvkgen")
+ endif()
+
+ list(APPEND vulkan_fun_command_content
+ COMMAND "${qvkgen}"
+ "${CMAKE_CURRENT_SOURCE_DIR}/vulkan/vk.xml"
+ "${CMAKE_CURRENT_SOURCE_DIR}/vulkan/licenseheader.h.in"
+ "${CMAKE_CURRENT_BINARY_DIR}/vulkan/qvulkanfunctions"
+ DEPENDS vulkan/vk.xml ${qvkgen}
+ COMMENT "Generating vulkan data"
+ )
+
+ qt_internal_extend_target(Gui
+ SOURCES
+ "${CMAKE_CURRENT_BINARY_DIR}/vulkan/${vulkan_fun}"
+ "${CMAKE_CURRENT_BINARY_DIR}/vulkan/${vulkan_fun_p}"
+ "${CMAKE_CURRENT_BINARY_DIR}/vulkan/${vulkan_fun_p_cpp}"
+ )
+else()
+ foreach(file ${vulkan_fun_outputs})
+ list(APPEND vulkan_fun_command_content
+ COMMAND "${CMAKE_COMMAND}" -E touch "${file}")
+ endforeach()
+endif()
+add_custom_command(
+ OUTPUT ${vulkan_fun_outputs}
+ ${vulkan_fun_command_content}
+ WORKING_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}"
+ VERBATIM
+)
+
+qt_internal_extend_target(Gui CONDITION WASM
+ SOURCES
+ platform/wasm/qlocalfileapi.cpp platform/wasm/qlocalfileapi_p.h
+ platform/wasm/qwasmlocalfileaccess.cpp platform/wasm/qwasmlocalfileaccess_p.h
+)
+
+qt_internal_extend_target(Gui CONDITION UNIX
+ SOURCES
+ platform/unix/qunixnativeinterface.cpp
+)
+
+qt_internal_extend_target(Gui CONDITION UNIX AND NOT WASM
+ SOURCES
+ platform/unix/qgenericunixeventdispatcher.cpp platform/unix/qgenericunixeventdispatcher_p.h
+ platform/unix/qunixeventdispatcher.cpp
+ platform/unix/qunixeventdispatcher_qpa_p.h
+)
+
+qt_internal_extend_target(Gui CONDITION QT_FEATURE_glib AND UNIX
+ SOURCES
+ platform/unix/qeventdispatcher_glib.cpp platform/unix/qeventdispatcher_glib_p.h
+ LIBRARIES
+ GLIB2::GLIB2
+)
+
+qt_internal_extend_target(Gui CONDITION UNIX AND (QT_FEATURE_xcb OR NOT UIKIT)
+ SOURCES
+ platform/unix/qgenericunixservices.cpp platform/unix/qgenericunixservices_p.h
+)
+
+qt_internal_extend_target(Gui CONDITION UNIX AND (QT_FEATURE_xcb)
+ SOURCES
+ platform/unix/qtx11extras.cpp platform/unix/qtx11extras_p.h
+)
+
+qt_internal_extend_target(Gui CONDITION TARGET Qt::DBus AND UNIX AND (QT_FEATURE_xcb OR NOT UIKIT)
+ LIBRARIES
+ Qt::DBus
+)
+
+qt_internal_extend_target(Gui CONDITION UNIX AND (QT_FEATURE_xcb OR NOT MACOS) AND (QT_FEATURE_xcb OR NOT UIKIT)
+ SOURCES
+ platform/unix/qgenericunixthemes.cpp platform/unix/qgenericunixthemes_p.h
+)
+
+qt_internal_extend_target(Gui CONDITION TARGET Qt::DBus AND UNIX AND (QT_FEATURE_xcb OR NOT MACOS) AND (QT_FEATURE_xcb OR NOT UIKIT)
+ SOURCES
+ platform/unix/dbusmenu/qdbusmenuadaptor.cpp platform/unix/dbusmenu/qdbusmenuadaptor_p.h
+ platform/unix/dbusmenu/qdbusmenubar.cpp platform/unix/dbusmenu/qdbusmenubar_p.h
+ platform/unix/dbusmenu/qdbusmenuconnection.cpp platform/unix/dbusmenu/qdbusmenuconnection_p.h
+ platform/unix/dbusmenu/qdbusmenuregistrarproxy.cpp platform/unix/dbusmenu/qdbusmenuregistrarproxy_p.h
+ platform/unix/dbusmenu/qdbusmenutypes.cpp platform/unix/dbusmenu/qdbusmenutypes_p.h
+ platform/unix/dbusmenu/qdbusplatformmenu.cpp platform/unix/dbusmenu/qdbusplatformmenu_p.h
+)
+
+qt_internal_extend_target(Gui CONDITION QT_FEATURE_systemtrayicon AND TARGET Qt::DBus AND UNIX AND (QT_FEATURE_xcb OR NOT MACOS) AND (QT_FEATURE_xcb OR NOT UIKIT)
+ SOURCES
+ platform/unix/dbustray/qdbustrayicon.cpp platform/unix/dbustray/qdbustrayicon_p.h
+ platform/unix/dbustray/qdbustraytypes.cpp platform/unix/dbustray/qdbustraytypes_p.h
+ platform/unix/dbustray/qstatusnotifieritemadaptor.cpp platform/unix/dbustray/qstatusnotifieritemadaptor_p.h
+ platform/unix/dbustray/qxdgnotificationproxy.cpp platform/unix/dbustray/qxdgnotificationproxy_p.h
+)
+
+qt_internal_extend_target(Gui CONDITION QT_FEATURE_xkbcommon AND UNIX
+ SOURCES
+ platform/unix/qxkbcommon.cpp platform/unix/qxkbcommon_p.h
+ platform/unix/qxkbcommon_3rdparty.cpp
+ LIBRARIES
+ XKB::XKB
+ PRIVATE_MODULE_INTERFACE
+ XKB::XKB
+)
+
+qt_internal_extend_target(Gui CONDITION QT_FEATURE_metal
+ SOURCES
+ rhi/qrhimetal.mm rhi/qrhimetal_p.h
+ PUBLIC_LIBRARIES
+ ${FWMetal}
+)
+
+qt_internal_extend_target(Gui
+ SOURCES
+ painting/qdrawhelper.cpp painting/qdrawhelper_neon_p.h
+ NO_PCH_SOURCES
+ "painting/qdrawhelper.cpp"
+)
+
+qt_internal_extend_target(Gui CONDITION (QT_FEATURE_eglfs OR QT_FEATURE_xcb OR QT_FEATURE_direct2d OR WIN32)
+ SOURCES
+ util/qedidparser.cpp util/qedidparser_p.h
+ util/qedidvendortable_p.h
+)
+
+qt_internal_generate_tracepoints(Gui gui
+ SOURCES
+ image/qimage.cpp image/qimagereader.cpp image/qpixmap.cpp kernel/qguiapplication.cpp
+ text/qfontdatabase.cpp
+)
+qt_internal_add_docs(Gui
+ doc/qtgui.qdocconf
+)
+
+if(IOS)
+ qt_internal_set_apple_privacy_manifest(Gui
+ "${CMAKE_CURRENT_SOURCE_DIR}/platform/ios/PrivacyInfo.xcprivacy")
+endif()
+
+qt_internal_add_optimize_full_flags()
diff --git a/src/gui/Qt5GuiConfigExtras.cmake.in b/src/gui/Qt5GuiConfigExtras.cmake.in
deleted file mode 100644
index 84dbbfebd4..0000000000
--- a/src/gui/Qt5GuiConfigExtras.cmake.in
+++ /dev/null
@@ -1,193 +0,0 @@
-
-!!IF !isEmpty(CMAKE_ANGLE_EGL_DLL_RELEASE)
-
-!!IF isEmpty(CMAKE_INCLUDE_DIR_IS_ABSOLUTE)
-set(Qt5Gui_EGL_INCLUDE_DIRS \"${_qt5$${CMAKE_MODULE_NAME}_install_prefix}/$$CMAKE_INCLUDE_DIR/QtANGLE\")
-!!ELSE
-set(Qt5Gui_EGL_INCLUDE_DIRS \"$$CMAKE_INCLUDE_DIR/QtANGLE\")
-!!ENDIF
-
-_qt5_Gui_check_file_exists(${Qt5Gui_EGL_INCLUDE_DIRS})
-
-list(APPEND Qt5Gui_INCLUDE_DIRS ${Qt5Gui_EGL_INCLUDE_DIRS})
-set_property(TARGET Qt5::Gui APPEND PROPERTY INTERFACE_INCLUDE_DIRECTORIES ${Qt5Gui_EGL_INCLUDE_DIRS})
-set(Qt5Gui_OPENGL_INCLUDE_DIRS ${Qt5Gui_EGL_INCLUDE_DIRS})
-
-macro(_populate_qt5gui_gl_target_properties TargetName Configuration LIB_LOCATION IMPLIB_LOCATION)
- set_property(TARGET Qt5::${TargetName} APPEND PROPERTY IMPORTED_CONFIGURATIONS ${Configuration})
-
-!!IF isEmpty(CMAKE_DLL_DIR_IS_ABSOLUTE)
- set(imported_location \"${_qt5Gui_install_prefix}/$${CMAKE_DLL_DIR}${LIB_LOCATION}\")
-!!ELSE
- set(imported_location \"$${CMAKE_DLL_DIR}${LIB_LOCATION}\")
-!!ENDIF
-
-!!IF isEmpty(CMAKE_LIB_DIR_IS_ABSOLUTE)
- set(imported_implib \"${_qt5Gui_install_prefix}/$${CMAKE_LIB_DIR}${IMPLIB_LOCATION}\")
-!!ELSE
- set(imported_implib \"$${CMAKE_LIB_DIR}${IMPLIB_LOCATION}\")
-!!ENDIF
-
- set_target_properties(Qt5::${TargetName} PROPERTIES
- \"IMPORTED_LOCATION_${Configuration}\" ${imported_location}
- \"IMPORTED_IMPLIB_${Configuration}\" ${imported_implib}
- )
-endmacro()
-
-add_library(Qt5::Gui_EGL SHARED IMPORTED)
-_populate_qt5gui_gl_target_properties(Gui_EGL RELEASE $${CMAKE_ANGLE_EGL_DLL_RELEASE} $${CMAKE_ANGLE_EGL_IMPLIB_RELEASE})
-add_library(Qt5::Gui_GLESv2 SHARED IMPORTED)
-_populate_qt5gui_gl_target_properties(Gui_GLESv2 RELEASE $${CMAKE_ANGLE_GLES2_DLL_RELEASE} $${CMAKE_ANGLE_GLES2_IMPLIB_RELEASE})
-
-set_property(TARGET Qt5::Gui_EGL APPEND PROPERTY INTERFACE_INCLUDE_DIRECTORIES ${Qt5Gui_EGL_INCLUDE_DIRS})
-set_property(TARGET Qt5::Gui_GLESv2 APPEND PROPERTY INTERFACE_INCLUDE_DIRECTORIES ${Qt5Gui_OPENGL_INCLUDE_DIRS})
-
-!!IF !isEmpty(CMAKE_DEBUG_TYPE)
-_populate_qt5gui_gl_target_properties(Gui_EGL DEBUG $${CMAKE_ANGLE_EGL_DLL_DEBUG} $${CMAKE_ANGLE_EGL_IMPLIB_DEBUG})
-_populate_qt5gui_gl_target_properties(Gui_GLESv2 DEBUG $${CMAKE_ANGLE_GLES2_DLL_DEBUG} $${CMAKE_ANGLE_GLES2_IMPLIB_DEBUG})
-!!ENDIF
-
-set(Qt5Gui_EGL_LIBRARIES Qt5::Gui_EGL)
-set(Qt5Gui_OPENGL_LIBRARIES Qt5::Gui_GLESv2)
-
-!!ELSE
-
-!!IF !isEmpty(CMAKE_GL_INCDIRS)
-
-set(_GL_INCDIRS $$CMAKE_GL_INCDIRS)
-find_path(_qt5gui_OPENGL_INCLUDE_DIR $$CMAKE_GL_HEADER_NAME
- PATHS ${_GL_INCDIRS}
-)
-if (NOT _qt5gui_OPENGL_INCLUDE_DIR)
- message(FATAL_ERROR \"Failed to find \\\"$$CMAKE_GL_HEADER_NAME\\\" in \\\"${_GL_INCDIRS}\\\".\")
-endif()
-unset(_GL_INCDIRS)
-
-# Don\'t check for existence of the "_qt5gui_OPENGL_INCLUDE_DIR" because it is
-# optional.
-
-list(APPEND Qt5Gui_INCLUDE_DIRS ${_qt5gui_OPENGL_INCLUDE_DIR})
-set_property(TARGET Qt5::Gui APPEND PROPERTY INTERFACE_INCLUDE_DIRECTORIES ${_qt5gui_OPENGL_INCLUDE_DIR})
-
-unset(_qt5gui_OPENGL_INCLUDE_DIR CACHE)
-
-!!ENDIF
-
-macro(_qt5gui_find_extra_libs Name Libs LibDir IncDirs)
- set(Qt5Gui_${Name}_LIBRARIES)
-!!IF !mac
- set(Qt5Gui_${Name}_INCLUDE_DIRS ${IncDirs})
-!!ELSE
- foreach(_dir ${IncDirs})
- if (EXISTS ${_dir})
- list(APPEND Qt5Gui_${Name}_INCLUDE_DIRS ${_dir})
- else()
- find_path(_actual_dir ${_dir}) # Look in sdk directories
- if (_actual_dir)
- list(APPEND Qt5Gui_${Name}_INCLUDE_DIRS ${_actual_dir})
- endif()
- unset(_actual_dir CACHE)
- endif()
- endforeach()
-!!ENDIF
- foreach(_lib ${Libs})
- if (IS_ABSOLUTE ${_lib})
- get_filename_component(_libFile ${_lib} NAME_WE)
- if (_libFile MATCHES \"^${CMAKE_SHARED_LIBRARY_PREFIX}(.*)\")
- set(_libFile ${CMAKE_MATCH_1})
- endif()
- else()
- set(_libFile ${_lib})
- endif()
-
- string(REGEX REPLACE "[^_A-Za-z0-9]" "_" _cmake_lib_name ${_libFile})
- if (NOT TARGET Qt5::Gui_${_cmake_lib_name} AND NOT _Qt5Gui_${_cmake_lib_name}_LIBRARY_DONE)
- if (IS_ABSOLUTE ${_lib})
- set(Qt5Gui_${_cmake_lib_name}_LIBRARY ${_lib})
- else()
- find_library(Qt5Gui_${_cmake_lib_name}_LIBRARY ${_lib}
-!!IF !isEmpty(CROSS_COMPILE)
- PATHS \"${LibDir}\"
-!!IF !mac
- NO_DEFAULT_PATH
-!!ENDIF
-!!ENDIF
- )
- endif()
-!!IF mac
- set(Qt5Gui_${_cmake_lib_name}_LIBRARY "${Qt5Gui_${_cmake_lib_name}_LIBRARY}/${_lib}")
- if (NOT EXISTS "${Qt5Gui_${_cmake_lib_name}_LIBRARY}")
- set(Qt5Gui_${_cmake_lib_name}_LIBRARY)
- endif()
-!!ENDIF
- if (NOT Qt5Gui_${_cmake_lib_name}_LIBRARY)
- # The above find_library call doesn\'t work for finding
- # libraries in Windows SDK paths outside of the proper
- # environment, even if the libraries are present. In other
- # cases it is OK for the libraries to not be found
- # because they are optional dependencies of Qt5Gui, needed
- # only if the qopengl.h header is used.
- # We try to find the libraries in the first place because Qt may be
- # compiled with another set of GL libraries (such as coming
- # from ANGLE). The point of these find calls is to try to
- # find the same binaries as Qt is compiled with (as they are
- # in the interface of QtGui), so an effort is made to do so
- # above with paths known to qmake.
- set(_Qt5Gui_${_cmake_lib_name}_LIBRARY_DONE TRUE)
- unset(Qt5Gui_${_cmake_lib_name}_LIBRARY CACHE)
- else()
- add_library(Qt5::Gui_${_cmake_lib_name} SHARED IMPORTED)
- set_property(TARGET Qt5::Gui_${_cmake_lib_name} APPEND PROPERTY INTERFACE_INCLUDE_DIRECTORIES ${Qt5Gui_${Name}_INCLUDE_DIRS})
-
- set_property(TARGET Qt5::Gui_${_cmake_lib_name} APPEND PROPERTY IMPORTED_CONFIGURATIONS RELEASE)
- _qt5_Gui_check_file_exists(\"${Qt5Gui_${_cmake_lib_name}_LIBRARY}\")
- set_property(TARGET Qt5::Gui_${_cmake_lib_name} PROPERTY IMPORTED_LOCATION_RELEASE \"${Qt5Gui_${_cmake_lib_name}_LIBRARY}\")
-
-!!IF !isEmpty(CMAKE_WINDOWS_BUILD)
- set_property(TARGET Qt5::Gui_${_cmake_lib_name} PROPERTY IMPORTED_IMPLIB_RELEASE \"${Qt5Gui_${_cmake_lib_name}_LIBRARY}\")
-!!ENDIF
- unset(Qt5Gui_${_cmake_lib_name}_LIBRARY CACHE)
-
- find_library(Qt5Gui_${_cmake_lib_name}_LIBRARY_DEBUG ${_lib}d
- PATHS \"${LibDir}\"
-!!IF !mac
- NO_DEFAULT_PATH
-!!ENDIF
- )
- if (Qt5Gui_${_cmake_lib_name}_LIBRARY_DEBUG)
- set_property(TARGET Qt5::Gui_${_cmake_lib_name} APPEND PROPERTY IMPORTED_CONFIGURATIONS DEBUG)
- _qt5_Gui_check_file_exists(\"${Qt5Gui_${_cmake_lib_name}_LIBRARY_DEBUG}\")
- set_property(TARGET Qt5::Gui_${_cmake_lib_name} PROPERTY IMPORTED_LOCATION_DEBUG \"${Qt5Gui_${_cmake_lib_name}_LIBRARY_DEBUG}\")
-!!IF !isEmpty(CMAKE_WINDOWS_BUILD)
- set_property(TARGET Qt5::Gui_${_cmake_lib_name} PROPERTY IMPORTED_IMPLIB_DEBUG \"${Qt5Gui_${_cmake_lib_name}_LIBRARY_DEBUG}\")
-!!ENDIF
- endif()
- unset(Qt5Gui_${_cmake_lib_name}_LIBRARY_DEBUG CACHE)
- list(APPEND Qt5Gui_${Name}_LIBRARIES Qt5::Gui_${_cmake_lib_name})
- endif()
- endif()
- endforeach()
-endmacro()
-
-
-!!IF !isEmpty(CMAKE_EGL_LIBS)
-_qt5gui_find_extra_libs(EGL \"$$CMAKE_EGL_LIBS\" \"$$CMAKE_EGL_LIBDIR\" \"$$CMAKE_EGL_INCDIRS\")
-!!ENDIF
-
-!!IF !isEmpty(CMAKE_OPENGL_LIBS)
-_qt5gui_find_extra_libs(OPENGL \"$$CMAKE_OPENGL_LIBS\" \"$$CMAKE_OPENGL_LIBDIR\" \"$$CMAKE_OPENGL_INCDIRS\")
-
-!!ENDIF
-
-!!ENDIF
-
-set(Qt5Gui_OPENGL_IMPLEMENTATION $$CMAKE_QT_OPENGL_IMPLEMENTATION)
-
-get_target_property(_configs Qt5::Gui IMPORTED_CONFIGURATIONS)
-foreach(_config ${_configs})
- set_property(TARGET Qt5::Gui APPEND PROPERTY
- IMPORTED_LINK_DEPENDENT_LIBRARIES_${_config}
- ${Qt5Gui_EGL_LIBRARIES} ${Qt5Gui_OPENGL_LIBRARIES}
- )
-endforeach()
-unset(_configs)
diff --git a/src/gui/accessible/accessible.pri b/src/gui/accessible/accessible.pri
deleted file mode 100644
index 8dd821fe6a..0000000000
--- a/src/gui/accessible/accessible.pri
+++ /dev/null
@@ -1,25 +0,0 @@
-# Qt accessibility module
-
-qtConfig(accessibility) {
- HEADERS += \
- accessible/qaccessible.h \
- accessible/qaccessiblecache_p.h \
- accessible/qaccessibleobject.h \
- accessible/qaccessibleplugin.h \
- accessible/qplatformaccessibility.h
-
- SOURCES += accessible/qaccessible.cpp \
- accessible/qaccessiblecache.cpp \
- accessible/qaccessibleobject.cpp \
- accessible/qaccessibleplugin.cpp \
- accessible/qplatformaccessibility.cpp
-
- HEADERS += accessible/qaccessiblebridge.h
- SOURCES += accessible/qaccessiblebridge.cpp
-
- mac {
- OBJECTIVE_SOURCES += accessible/qaccessiblecache_mac.mm
-
- LIBS_PRIVATE += -framework Foundation
- }
-}
diff --git a/src/gui/accessible/linux/atspiadaptor.cpp b/src/gui/accessible/linux/atspiadaptor.cpp
new file mode 100644
index 0000000000..b3269a2a95
--- /dev/null
+++ b/src/gui/accessible/linux/atspiadaptor.cpp
@@ -0,0 +1,2856 @@
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
+
+#include "atspiadaptor_p.h"
+#include "qspiaccessiblebridge_p.h"
+
+#include <QtGui/qwindow.h>
+#include <QtGui/qguiapplication.h>
+#include <qdbusmessage.h>
+#include <qdbusreply.h>
+#include <qclipboard.h>
+
+#include <QtCore/qloggingcategory.h>
+#include <QtCore/qtversion.h>
+
+#if QT_CONFIG(accessibility)
+#include "socket_interface.h"
+#include "qspi_constant_mappings_p.h"
+#include <QtCore/private/qstringiterator_p.h>
+#include <QtGui/private/qaccessiblebridgeutils_p.h>
+
+#include "qspiapplicationadaptor_p.h"
+/*!
+ \class AtSpiAdaptor
+ \internal
+
+ \brief AtSpiAdaptor is the main class to forward between QAccessibleInterface and AT-SPI DBus
+
+ AtSpiAdaptor implements the functions specified in all at-spi interfaces.
+ It sends notifications coming from Qt via dbus and listens to incoming dbus requests.
+*/
+
+// ATSPI_COORD_TYPE_PARENT was added in at-spi 2.30, define here for older versions
+#if ATSPI_COORD_TYPE_COUNT < 3
+#define ATSPI_COORD_TYPE_PARENT 2
+#endif
+
+QT_BEGIN_NAMESPACE
+
+using namespace Qt::StringLiterals;
+
+Q_LOGGING_CATEGORY(lcAccessibilityAtspi, "qt.accessibility.atspi")
+Q_LOGGING_CATEGORY(lcAccessibilityAtspiCreation, "qt.accessibility.atspi.creation")
+
+AtSpiAdaptor::AtSpiAdaptor(DBusConnection *connection, QObject *parent)
+ : QDBusVirtualObject(parent), m_dbus(connection)
+ , sendFocus(0)
+ , sendObject(0)
+ , sendObject_active_descendant_changed(0)
+ , sendObject_attributes_changed(0)
+ , sendObject_bounds_changed(0)
+ , sendObject_children_changed(0)
+// , sendObject_children_changed_add(0)
+// , sendObject_children_changed_remove(0)
+ , sendObject_column_deleted(0)
+ , sendObject_column_inserted(0)
+ , sendObject_column_reordered(0)
+ , sendObject_link_selected(0)
+ , sendObject_model_changed(0)
+ , sendObject_property_change(0)
+ , sendObject_property_change_accessible_description(0)
+ , sendObject_property_change_accessible_name(0)
+ , sendObject_property_change_accessible_parent(0)
+ , sendObject_property_change_accessible_role(0)
+ , sendObject_property_change_accessible_table_caption(0)
+ , sendObject_property_change_accessible_table_column_description(0)
+ , sendObject_property_change_accessible_table_column_header(0)
+ , sendObject_property_change_accessible_table_row_description(0)
+ , sendObject_property_change_accessible_table_row_header(0)
+ , sendObject_property_change_accessible_table_summary(0)
+ , sendObject_property_change_accessible_value(0)
+ , sendObject_row_deleted(0)
+ , sendObject_row_inserted(0)
+ , sendObject_row_reordered(0)
+ , sendObject_selection_changed(0)
+ , sendObject_state_changed(0)
+ , sendObject_text_attributes_changed(0)
+ , sendObject_text_bounds_changed(0)
+ , sendObject_text_caret_moved(0)
+ , sendObject_text_changed(0)
+// , sendObject_text_changed_delete(0)
+// , sendObject_text_changed_insert(0)
+ , sendObject_text_selection_changed(0)
+ , sendObject_value_changed(0)
+ , sendObject_visible_data_changed(0)
+ , sendWindow(0)
+ , sendWindow_activate(0)
+ , sendWindow_close(0)
+ , sendWindow_create(0)
+ , sendWindow_deactivate(0)
+// , sendWindow_desktop_create(0)
+// , sendWindow_desktop_destroy(0)
+ , sendWindow_lower(0)
+ , sendWindow_maximize(0)
+ , sendWindow_minimize(0)
+ , sendWindow_move(0)
+ , sendWindow_raise(0)
+ , sendWindow_reparent(0)
+ , sendWindow_resize(0)
+ , sendWindow_restore(0)
+ , sendWindow_restyle(0)
+ , sendWindow_shade(0)
+ , sendWindow_unshade(0)
+{
+ m_applicationAdaptor = new QSpiApplicationAdaptor(m_dbus->connection(), this);
+ connect(m_applicationAdaptor, SIGNAL(windowActivated(QObject*,bool)), this, SLOT(windowActivated(QObject*,bool)));
+
+ updateEventListeners();
+ bool success = m_dbus->connection().connect("org.a11y.atspi.Registry"_L1, "/org/a11y/atspi/registry"_L1,
+ "org.a11y.atspi.Registry"_L1, "EventListenerRegistered"_L1, this,
+ SLOT(eventListenerRegistered(QString,QString)));
+ success = success && m_dbus->connection().connect("org.a11y.atspi.Registry"_L1, "/org/a11y/atspi/registry"_L1,
+ "org.a11y.atspi.Registry"_L1, "EventListenerDeregistered"_L1, this,
+ SLOT(eventListenerDeregistered(QString,QString)));
+}
+
+AtSpiAdaptor::~AtSpiAdaptor()
+{
+}
+
+/*!
+ Provide DBus introspection.
+ */
+QString AtSpiAdaptor::introspect(const QString &path) const
+{
+ static const QLatin1StringView accessibleIntrospection(
+ " <interface name=\"org.a11y.atspi.Accessible\">\n"
+ " <property access=\"read\" type=\"s\" name=\"Name\"/>\n"
+ " <property access=\"read\" type=\"s\" name=\"Description\"/>\n"
+ " <property access=\"read\" type=\"(so)\" name=\"Parent\">\n"
+ " <annotation value=\"QSpiObjectReference\" name=\"org.qtproject.QtDBus.QtTypeName\"/>\n"
+ " </property>\n"
+ " <property access=\"read\" type=\"i\" name=\"ChildCount\"/>\n"
+ " <method name=\"GetChildAtIndex\">\n"
+ " <arg direction=\"in\" type=\"i\" name=\"index\"/>\n"
+ " <arg direction=\"out\" type=\"(so)\"/>\n"
+ " <annotation value=\"QSpiObjectReference\" name=\"org.qtproject.QtDBus.QtTypeName.Out0\"/>\n"
+ " </method>\n"
+ " <method name=\"GetChildren\">\n"
+ " <arg direction=\"out\" type=\"a(so)\"/>\n"
+ " <annotation value=\"QSpiObjectReferenceArray\" name=\"org.qtproject.QtDBus.QtTypeName.Out0\"/>\n"
+ " </method>\n"
+ " <method name=\"GetIndexInParent\">\n"
+ " <arg direction=\"out\" type=\"i\"/>\n"
+ " </method>\n"
+ " <method name=\"GetRelationSet\">\n"
+ " <arg direction=\"out\" type=\"a(ua(so))\"/>\n"
+ " <annotation value=\"QSpiRelationArray\" name=\"org.qtproject.QtDBus.QtTypeName.Out0\"/>\n"
+ " </method>\n"
+ " <method name=\"GetRole\">\n"
+ " <arg direction=\"out\" type=\"u\"/>\n"
+ " </method>\n"
+ " <method name=\"GetRoleName\">\n"
+ " <arg direction=\"out\" type=\"s\"/>\n"
+ " </method>\n"
+ " <method name=\"GetLocalizedRoleName\">\n"
+ " <arg direction=\"out\" type=\"s\"/>\n"
+ " </method>\n"
+ " <method name=\"GetState\">\n"
+ " <arg direction=\"out\" type=\"au\"/>\n"
+ " <annotation value=\"QSpiUIntList\" name=\"org.qtproject.QtDBus.QtTypeName.Out0\"/>\n"
+ " </method>\n"
+ " <method name=\"GetAttributes\">\n"
+ " <arg direction=\"out\" type=\"a{ss}\"/>\n"
+ " <annotation value=\"QSpiAttributeSet\" name=\"org.qtproject.QtDBus.QtTypeName.Out0\"/>\n"
+ " </method>\n"
+ " <method name=\"GetApplication\">\n"
+ " <arg direction=\"out\" type=\"(so)\"/>\n"
+ " <annotation value=\"QSpiObjectReference\" name=\"org.qtproject.QtDBus.QtTypeName.Out0\"/>\n"
+ " </method>\n"
+ " <method name=\"GetAccessibleId\">\n"
+ " <arg direction=\"out\" type=\"s\"/>\n"
+ " </method>\n"
+ " </interface>\n"
+ );
+
+ static const QLatin1StringView actionIntrospection(
+ " <interface name=\"org.a11y.atspi.Action\">\n"
+ " <property access=\"read\" type=\"i\" name=\"NActions\"/>\n"
+ " <method name=\"GetDescription\">\n"
+ " <arg direction=\"in\" type=\"i\" name=\"index\"/>\n"
+ " <arg direction=\"out\" type=\"s\"/>\n"
+ " </method>\n"
+ " <method name=\"GetName\">\n"
+ " <arg direction=\"in\" type=\"i\" name=\"index\"/>\n"
+ " <arg direction=\"out\" type=\"s\"/>\n"
+ " </method>\n"
+ " <method name=\"GetKeyBinding\">\n"
+ " <arg direction=\"in\" type=\"i\" name=\"index\"/>\n"
+ " <arg direction=\"out\" type=\"s\"/>\n"
+ " </method>\n"
+ " <method name=\"GetActions\">\n"
+ " <arg direction=\"out\" type=\"a(sss)\" name=\"index\"/>\n"
+ " <annotation value=\"QSpiActionArray\" name=\"org.qtproject.QtDBus.QtTypeName.Out0\"/>\n"
+ " </method>\n"
+ " <method name=\"DoAction\">\n"
+ " <arg direction=\"in\" type=\"i\" name=\"index\"/>\n"
+ " <arg direction=\"out\" type=\"b\"/>\n"
+ " </method>\n"
+ " </interface>\n"
+ );
+
+ static const QLatin1StringView applicationIntrospection(
+ " <interface name=\"org.a11y.atspi.Application\">\n"
+ " <property access=\"read\" type=\"s\" name=\"ToolkitName\"/>\n"
+ " <property access=\"read\" type=\"s\" name=\"Version\"/>\n"
+ " <property access=\"readwrite\" type=\"i\" name=\"Id\"/>\n"
+ " <method name=\"GetLocale\">\n"
+ " <arg direction=\"in\" type=\"u\" name=\"lctype\"/>\n"
+ " <arg direction=\"out\" type=\"s\"/>\n"
+ " </method>\n"
+ " <method name=\"GetApplicationBusAddress\">\n"
+ " <arg direction=\"out\" type=\"s\" name=\"address\"/>\n"
+ " </method>\n"
+ " </interface>\n"
+ );
+
+ static const QLatin1StringView componentIntrospection(
+ " <interface name=\"org.a11y.atspi.Component\">\n"
+ " <method name=\"Contains\">\n"
+ " <arg direction=\"in\" type=\"i\" name=\"x\"/>\n"
+ " <arg direction=\"in\" type=\"i\" name=\"y\"/>\n"
+ " <arg direction=\"in\" type=\"u\" name=\"coord_type\"/>\n"
+ " <arg direction=\"out\" type=\"b\"/>\n"
+ " </method>\n"
+ " <method name=\"GetAccessibleAtPoint\">\n"
+ " <arg direction=\"in\" type=\"i\" name=\"x\"/>\n"
+ " <arg direction=\"in\" type=\"i\" name=\"y\"/>\n"
+ " <arg direction=\"in\" type=\"u\" name=\"coord_type\"/>\n"
+ " <arg direction=\"out\" type=\"(so)\"/>\n"
+ " <annotation value=\"QSpiObjectReference\" name=\"org.qtproject.QtDBus.QtTypeName.Out0\"/>\n"
+ " </method>\n"
+ " <method name=\"GetExtents\">\n"
+ " <arg direction=\"in\" type=\"u\" name=\"coord_type\"/>\n"
+ " <arg direction=\"out\" type=\"(iiii)\"/>\n"
+ " <annotation value=\"QSpiRect\" name=\"org.qtproject.QtDBus.QtTypeName.Out0\"/>\n"
+ " </method>\n"
+ " <method name=\"GetPosition\">\n"
+ " <arg direction=\"in\" type=\"u\" name=\"coord_type\"/>\n"
+ " <arg direction=\"out\" type=\"i\" name=\"x\"/>\n"
+ " <arg direction=\"out\" type=\"i\" name=\"y\"/>\n"
+ " </method>\n"
+ " <method name=\"GetSize\">\n"
+ " <arg direction=\"out\" type=\"i\" name=\"width\"/>\n"
+ " <arg direction=\"out\" type=\"i\" name=\"height\"/>\n"
+ " </method>\n"
+ " <method name=\"GetLayer\">\n"
+ " <arg direction=\"out\" type=\"u\"/>\n"
+ " </method>\n"
+ " <method name=\"GetMDIZOrder\">\n"
+ " <arg direction=\"out\" type=\"n\"/>\n"
+ " </method>\n"
+ " <method name=\"GrabFocus\">\n"
+ " <arg direction=\"out\" type=\"b\"/>\n"
+ " </method>\n"
+ " <method name=\"GetAlpha\">\n"
+ " <arg direction=\"out\" type=\"d\"/>\n"
+ " </method>\n"
+ " <method name=\"SetExtents\">\n"
+ " <arg direction=\"in\" type=\"i\" name=\"x\"/>\n"
+ " <arg direction=\"in\" type=\"i\" name=\"y\"/>\n"
+ " <arg direction=\"in\" type=\"i\" name=\"width\"/>\n"
+ " <arg direction=\"in\" type=\"i\" name=\"height\"/>\n"
+ " <arg direction=\"in\" type=\"u\" name=\"coord_type\"/>\n"
+ " <arg direction=\"out\" type=\"b\"/>\n"
+ " </method>\n"
+ " <method name=\"SetPosition\">\n"
+ " <arg direction=\"in\" type=\"i\" name=\"x\"/>\n"
+ " <arg direction=\"in\" type=\"i\" name=\"y\"/>\n"
+ " <arg direction=\"in\" type=\"u\" name=\"coord_type\"/>\n"
+ " <arg direction=\"out\" type=\"b\"/>\n"
+ " </method>\n"
+ " <method name=\"SetSize\">\n"
+ " <arg direction=\"in\" type=\"i\" name=\"width\"/>\n"
+ " <arg direction=\"in\" type=\"i\" name=\"height\"/>\n"
+ " <arg direction=\"out\" type=\"b\"/>\n"
+ " </method>\n"
+ " </interface>\n"
+ );
+
+ static const QLatin1StringView editableTextIntrospection(
+ " <interface name=\"org.a11y.atspi.EditableText\">\n"
+ " <method name=\"SetTextContents\">\n"
+ " <arg direction=\"in\" type=\"s\" name=\"newContents\"/>\n"
+ " <arg direction=\"out\" type=\"b\"/>\n"
+ " </method>\n"
+ " <method name=\"InsertText\">\n"
+ " <arg direction=\"in\" type=\"i\" name=\"position\"/>\n"
+ " <arg direction=\"in\" type=\"s\" name=\"text\"/>\n"
+ " <arg direction=\"in\" type=\"i\" name=\"length\"/>\n"
+ " <arg direction=\"out\" type=\"b\"/>\n"
+ " </method>\n"
+ " <method name=\"CopyText\">\n"
+ " <arg direction=\"in\" type=\"i\" name=\"startPos\"/>\n"
+ " <arg direction=\"in\" type=\"i\" name=\"endPos\"/>\n"
+ " </method>\n"
+ " <method name=\"CutText\">\n"
+ " <arg direction=\"in\" type=\"i\" name=\"startPos\"/>\n"
+ " <arg direction=\"in\" type=\"i\" name=\"endPos\"/>\n"
+ " <arg direction=\"out\" type=\"b\"/>\n"
+ " </method>\n"
+ " <method name=\"DeleteText\">\n"
+ " <arg direction=\"in\" type=\"i\" name=\"startPos\"/>\n"
+ " <arg direction=\"in\" type=\"i\" name=\"endPos\"/>\n"
+ " <arg direction=\"out\" type=\"b\"/>\n"
+ " </method>\n"
+ " <method name=\"PasteText\">\n"
+ " <arg direction=\"in\" type=\"i\" name=\"position\"/>\n"
+ " <arg direction=\"out\" type=\"b\"/>\n"
+ " </method>\n"
+ " </interface>\n"
+ );
+
+ static const QLatin1StringView selectionIntrospection(
+ " <interface name=\"org.a11y.atspi.Selection\">\n"
+ " <property name=\"NSelectedChildren\" type=\"i\" access=\"read\"/>\n"
+ " <method name=\"GetSelectedChild\">\n"
+ " <arg direction=\"in\" name=\"selectedChildIndex\" type=\"i\"/>\n"
+ " <arg direction=\"out\" type=\"(so)\"/>\n"
+ " <annotation name=\"org.qtproject.QtDBus.QtTypeName.Out0\" value=\"QSpiObjectReference\"/>\n"
+ " </method>\n"
+ " <method name=\"SelectChild\">\n"
+ " <arg direction=\"in\" name=\"childIndex\" type=\"i\"/>\n"
+ " <arg direction=\"out\" type=\"b\"/>\n"
+ " </method>\n"
+ " <method name=\"DeselectSelectedChild\">\n"
+ " <arg direction=\"in\" name=\"selectedChildIndex\" type=\"i\"/>\n"
+ " <arg direction=\"out\" type=\"b\"/>\n"
+ " </method>\n"
+ " <method name=\"IsChildSelected\">\n"
+ " <arg direction=\"in\" name=\"childIndex\" type=\"i\"/>\n"
+ " <arg direction=\"out\" type=\"b\"/>\n"
+ " </method>\n"
+ " <method name=\"SelectAll\">\n"
+ " <arg direction=\"out\" type=\"b\"/>\n"
+ " </method>\n"
+ " <method name=\"ClearSelection\">\n"
+ " <arg direction=\"out\" type=\"b\"/>\n"
+ " </method>\n"
+ " <method name=\"DeselectChild\">\n"
+ " <arg direction=\"in\" name=\"childIndex\" type=\"i\"/>\n"
+ " <arg direction=\"out\" type=\"b\"/>\n"
+ " </method>\n"
+ " </interface>\n"
+ );
+
+ static const QLatin1StringView tableIntrospection(
+ " <interface name=\"org.a11y.atspi.Table\">\n"
+ " <property access=\"read\" type=\"i\" name=\"NRows\"/>\n"
+ " <property access=\"read\" type=\"i\" name=\"NColumns\"/>\n"
+ " <property access=\"read\" type=\"(so)\" name=\"Caption\">\n"
+ " <annotation value=\"QSpiObjectReference\" name=\"org.qtproject.QtDBus.QtTypeName\"/>\n"
+ " </property>\n"
+ " <property access=\"read\" type=\"(so)\" name=\"Summary\">\n"
+ " <annotation value=\"QSpiObjectReference\" name=\"org.qtproject.QtDBus.QtTypeName\"/>\n"
+ " </property>\n"
+ " <property access=\"read\" type=\"i\" name=\"NSelectedRows\"/>\n"
+ " <property access=\"read\" type=\"i\" name=\"NSelectedColumns\"/>\n"
+ " <method name=\"GetAccessibleAt\">\n"
+ " <arg direction=\"in\" type=\"i\" name=\"row\"/>\n"
+ " <arg direction=\"in\" type=\"i\" name=\"column\"/>\n"
+ " <arg direction=\"out\" type=\"(so)\"/>\n"
+ " <annotation value=\"QSpiObjectReference\" name=\"org.qtproject.QtDBus.QtTypeName.Out0\"/>\n"
+ " </method>\n"
+ " <method name=\"GetIndexAt\">\n"
+ " <arg direction=\"in\" type=\"i\" name=\"row\"/>\n"
+ " <arg direction=\"in\" type=\"i\" name=\"column\"/>\n"
+ " <arg direction=\"out\" type=\"i\"/>\n"
+ " </method>\n"
+ " <method name=\"GetRowAtIndex\">\n"
+ " <arg direction=\"in\" type=\"i\" name=\"index\"/>\n"
+ " <arg direction=\"out\" type=\"i\"/>\n"
+ " </method>\n"
+ " <method name=\"GetColumnAtIndex\">\n"
+ " <arg direction=\"in\" type=\"i\" name=\"index\"/>\n"
+ " <arg direction=\"out\" type=\"i\"/>\n"
+ " </method>\n"
+ " <method name=\"GetRowDescription\">\n"
+ " <arg direction=\"in\" type=\"i\" name=\"row\"/>\n"
+ " <arg direction=\"out\" type=\"s\"/>\n"
+ " </method>\n"
+ " <method name=\"GetColumnDescription\">\n"
+ " <arg direction=\"in\" type=\"i\" name=\"column\"/>\n"
+ " <arg direction=\"out\" type=\"s\"/>\n"
+ " </method>\n"
+ " <method name=\"GetRowExtentAt\">\n"
+ " <arg direction=\"in\" type=\"i\" name=\"row\"/>\n"
+ " <arg direction=\"in\" type=\"i\" name=\"column\"/>\n"
+ " <arg direction=\"out\" type=\"i\"/>\n"
+ " </method>\n"
+ " <method name=\"GetColumnExtentAt\">\n"
+ " <arg direction=\"in\" type=\"i\" name=\"row\"/>\n"
+ " <arg direction=\"in\" type=\"i\" name=\"column\"/>\n"
+ " <arg direction=\"out\" type=\"i\"/>\n"
+ " </method>\n"
+ " <method name=\"GetRowHeader\">\n"
+ " <arg direction=\"in\" type=\"i\" name=\"row\"/>\n"
+ " <arg direction=\"out\" type=\"(so)\"/>\n"
+ " <annotation value=\"QSpiObjectReference\" name=\"org.qtproject.QtDBus.QtTypeName.Out0\"/>\n"
+ " </method>\n"
+ " <method name=\"GetColumnHeader\">\n"
+ " <arg direction=\"in\" type=\"i\" name=\"column\"/>\n"
+ " <arg direction=\"out\" type=\"(so)\"/>\n"
+ " <annotation value=\"QSpiObjectReference\" name=\"org.qtproject.QtDBus.QtTypeName.Out0\"/>\n"
+ " </method>\n"
+ " <method name=\"GetSelectedRows\">\n"
+ " <arg direction=\"out\" type=\"ai\"/>\n"
+ " <annotation value=\"QSpiIntList\" name=\"org.qtproject.QtDBus.QtTypeName.Out0\"/>\n"
+ " </method>\n"
+ " <method name=\"GetSelectedColumns\">\n"
+ " <arg direction=\"out\" type=\"ai\"/>\n"
+ " <annotation value=\"QSpiIntList\" name=\"org.qtproject.QtDBus.QtTypeName.Out0\"/>\n"
+ " </method>\n"
+ " <method name=\"IsRowSelected\">\n"
+ " <arg direction=\"in\" type=\"i\" name=\"row\"/>\n"
+ " <arg direction=\"out\" type=\"b\"/>\n"
+ " </method>\n"
+ " <method name=\"IsColumnSelected\">\n"
+ " <arg direction=\"in\" type=\"i\" name=\"column\"/>\n"
+ " <arg direction=\"out\" type=\"b\"/>\n"
+ " </method>\n"
+ " <method name=\"IsSelected\">\n"
+ " <arg direction=\"in\" type=\"i\" name=\"row\"/>\n"
+ " <arg direction=\"in\" type=\"i\" name=\"column\"/>\n"
+ " <arg direction=\"out\" type=\"b\"/>\n"
+ " </method>\n"
+ " <method name=\"AddRowSelection\">\n"
+ " <arg direction=\"in\" type=\"i\" name=\"row\"/>\n"
+ " <arg direction=\"out\" type=\"b\"/>\n"
+ " </method>\n"
+ " <method name=\"AddColumnSelection\">\n"
+ " <arg direction=\"in\" type=\"i\" name=\"column\"/>\n"
+ " <arg direction=\"out\" type=\"b\"/>\n"
+ " </method>\n"
+ " <method name=\"RemoveRowSelection\">\n"
+ " <arg direction=\"in\" type=\"i\" name=\"row\"/>\n"
+ " <arg direction=\"out\" type=\"b\"/>\n"
+ " </method>\n"
+ " <method name=\"RemoveColumnSelection\">\n"
+ " <arg direction=\"in\" type=\"i\" name=\"column\"/>\n"
+ " <arg direction=\"out\" type=\"b\"/>\n"
+ " </method>\n"
+ " <method name=\"GetRowColumnExtentsAtIndex\">\n"
+ " <arg direction=\"in\" type=\"i\" name=\"index\"/>\n"
+ " <arg direction=\"out\" type=\"b\"/>\n"
+ " <arg direction=\"out\" type=\"i\" name=\"row\"/>\n"
+ " <arg direction=\"out\" type=\"i\" name=\"col\"/>\n"
+ " <arg direction=\"out\" type=\"i\" name=\"row_extents\"/>\n"
+ " <arg direction=\"out\" type=\"i\" name=\"col_extents\"/>\n"
+ " <arg direction=\"out\" type=\"b\" name=\"is_selected\"/>\n"
+ " </method>\n"
+ " </interface>\n"
+ );
+
+ static const QLatin1StringView tableCellIntrospection(
+ " <interface name=\"org.a11y.atspi.TableCell\">\n"
+ " <property access=\"read\" name=\"ColumnSpan\" type=\"i\" />\n"
+ " <property access=\"read\" name=\"Position\" type=\"(ii)\">\n"
+ " <annotation name=\"org.qtproject.QtDBus.QtTypeName\" value=\"QPoint\"/>\n"
+ " </property>\n"
+ " <property access=\"read\" name=\"RowSpan\" type=\"i\" />\n"
+ " <property access=\"read\" name=\"Table\" type=\"(so)\" >\n"
+ " <annotation name=\"org.qtproject.QtDBus.QtTypeName\" value=\"QSpiObjectReference\"/>\n"
+ " </property>\n"
+ " <method name=\"GetRowColumnSpan\">\n"
+ " <arg direction=\"out\" type=\"b\" />\n"
+ " <arg direction=\"out\" name=\"row\" type=\"i\" />\n"
+ " <arg direction=\"out\" name=\"col\" type=\"i\" />\n"
+ " <arg direction=\"out\" name=\"row_extents\" type=\"i\" />\n"
+ " <arg direction=\"out\" name=\"col_extents\" type=\"i\" />\n"
+ " </method>\n"
+ " <method name=\"GetColumnHeaderCells\">\n"
+ " <arg direction=\"out\" type=\"a(so)\"/>\n"
+ " <annotation value=\"QSpiObjectReferenceArray\" name=\"org.qtproject.QtDBus.QtTypeName.Out0\"/>\n"
+ " </method>\n"
+ " <method name=\"GetRowHeaderCells\">\n"
+ " <arg direction=\"out\" type=\"a(so)\"/>\n"
+ " <annotation value=\"QSpiObjectReferenceArray\" name=\"org.qtproject.QtDBus.QtTypeName.Out0\"/>\n"
+ " </method>\n"
+ " </interface>\n"
+ );
+
+ static const QLatin1StringView textIntrospection(
+ " <interface name=\"org.a11y.atspi.Text\">\n"
+ " <property access=\"read\" type=\"i\" name=\"CharacterCount\"/>\n"
+ " <property access=\"read\" type=\"i\" name=\"CaretOffset\"/>\n"
+ " <method name=\"GetStringAtOffset\">\n"
+ " <arg direction=\"in\" name=\"offset\" type=\"i\"/>\n"
+ " <arg direction=\"in\" name=\"granularity\" type=\"u\"/>\n"
+ " <arg direction=\"out\" type=\"s\"/>\n"
+ " <arg direction=\"out\" name=\"startOffset\" type=\"i\"/>\n"
+ " <arg direction=\"out\" name=\"endOffset\" type=\"i\"/>\n"
+ " </method>\n"
+ " <method name=\"GetText\">\n"
+ " <arg direction=\"in\" type=\"i\" name=\"startOffset\"/>\n"
+ " <arg direction=\"in\" type=\"i\" name=\"endOffset\"/>\n"
+ " <arg direction=\"out\" type=\"s\"/>\n"
+ " </method>\n"
+ " <method name=\"SetCaretOffset\">\n"
+ " <arg direction=\"in\" type=\"i\" name=\"offset\"/>\n"
+ " <arg direction=\"out\" type=\"b\"/>\n"
+ " </method>\n"
+ " <method name=\"GetTextBeforeOffset\">\n"
+ " <arg direction=\"in\" type=\"i\" name=\"offset\"/>\n"
+ " <arg direction=\"in\" type=\"u\" name=\"type\"/>\n"
+ " <arg direction=\"out\" type=\"s\"/>\n"
+ " <arg direction=\"out\" type=\"i\" name=\"startOffset\"/>\n"
+ " <arg direction=\"out\" type=\"i\" name=\"endOffset\"/>\n"
+ " </method>\n"
+ " <method name=\"GetTextAtOffset\">\n"
+ " <arg direction=\"in\" type=\"i\" name=\"offset\"/>\n"
+ " <arg direction=\"in\" type=\"u\" name=\"type\"/>\n"
+ " <arg direction=\"out\" type=\"s\"/>\n"
+ " <arg direction=\"out\" type=\"i\" name=\"startOffset\"/>\n"
+ " <arg direction=\"out\" type=\"i\" name=\"endOffset\"/>\n"
+ " </method>\n"
+ " <method name=\"GetTextAfterOffset\">\n"
+ " <arg direction=\"in\" type=\"i\" name=\"offset\"/>\n"
+ " <arg direction=\"in\" type=\"u\" name=\"type\"/>\n"
+ " <arg direction=\"out\" type=\"s\"/>\n"
+ " <arg direction=\"out\" type=\"i\" name=\"startOffset\"/>\n"
+ " <arg direction=\"out\" type=\"i\" name=\"endOffset\"/>\n"
+ " </method>\n"
+ " <method name=\"GetCharacterAtOffset\">\n"
+ " <arg direction=\"in\" type=\"i\" name=\"offset\"/>\n"
+ " <arg direction=\"out\" type=\"i\"/>\n"
+ " </method>\n"
+ " <method name=\"GetAttributeValue\">\n"
+ " <arg direction=\"in\" type=\"i\" name=\"offset\"/>\n"
+ " <arg direction=\"in\" type=\"s\" name=\"attributeName\"/>\n"
+ " <arg direction=\"out\" type=\"s\"/>\n"
+ " </method>\n"
+ " <method name=\"GetAttributes\">\n"
+ " <arg direction=\"in\" type=\"i\" name=\"offset\"/>\n"
+ " <arg direction=\"out\" type=\"a{ss}\"/>\n"
+ " <arg direction=\"out\" type=\"i\" name=\"startOffset\"/>\n"
+ " <arg direction=\"out\" type=\"i\" name=\"endOffset\"/>\n"
+ " <annotation value=\"QSpiAttributeSet\" name=\"org.qtproject.QtDBus.QtTypeName.Out0\"/>\n"
+ " </method>\n"
+ " <method name=\"GetDefaultAttributes\">\n"
+ " <arg direction=\"out\" type=\"a{ss}\"/>\n"
+ " <annotation value=\"QSpiAttributeSet\" name=\"org.qtproject.QtDBus.QtTypeName.Out0\"/>\n"
+ " </method>\n"
+ " <method name=\"GetCharacterExtents\">\n"
+ " <arg direction=\"in\" type=\"i\" name=\"offset\"/>\n"
+ " <arg direction=\"out\" type=\"i\" name=\"x\"/>\n"
+ " <arg direction=\"out\" type=\"i\" name=\"y\"/>\n"
+ " <arg direction=\"out\" type=\"i\" name=\"width\"/>\n"
+ " <arg direction=\"out\" type=\"i\" name=\"height\"/>\n"
+ " <arg direction=\"in\" type=\"u\" name=\"coordType\"/>\n"
+ " </method>\n"
+ " <method name=\"GetOffsetAtPoint\">\n"
+ " <arg direction=\"in\" type=\"i\" name=\"x\"/>\n"
+ " <arg direction=\"in\" type=\"i\" name=\"y\"/>\n"
+ " <arg direction=\"in\" type=\"u\" name=\"coordType\"/>\n"
+ " <arg direction=\"out\" type=\"i\"/>\n"
+ " </method>\n"
+ " <method name=\"GetNSelections\">\n"
+ " <arg direction=\"out\" type=\"i\"/>\n"
+ " </method>\n"
+ " <method name=\"GetSelection\">\n"
+ " <arg direction=\"in\" type=\"i\" name=\"selectionNum\"/>\n"
+ " <arg direction=\"out\" type=\"i\" name=\"startOffset\"/>\n"
+ " <arg direction=\"out\" type=\"i\" name=\"endOffset\"/>\n"
+ " </method>\n"
+ " <method name=\"AddSelection\">\n"
+ " <arg direction=\"in\" type=\"i\" name=\"startOffset\"/>\n"
+ " <arg direction=\"in\" type=\"i\" name=\"endOffset\"/>\n"
+ " <arg direction=\"out\" type=\"b\"/>\n"
+ " </method>\n"
+ " <method name=\"RemoveSelection\">\n"
+ " <arg direction=\"in\" type=\"i\" name=\"selectionNum\"/>\n"
+ " <arg direction=\"out\" type=\"b\"/>\n"
+ " </method>\n"
+ " <method name=\"SetSelection\">\n"
+ " <arg direction=\"in\" type=\"i\" name=\"selectionNum\"/>\n"
+ " <arg direction=\"in\" type=\"i\" name=\"startOffset\"/>\n"
+ " <arg direction=\"in\" type=\"i\" name=\"endOffset\"/>\n"
+ " <arg direction=\"out\" type=\"b\"/>\n"
+ " </method>\n"
+ " <method name=\"GetRangeExtents\">\n"
+ " <arg direction=\"in\" type=\"i\" name=\"startOffset\"/>\n"
+ " <arg direction=\"in\" type=\"i\" name=\"endOffset\"/>\n"
+ " <arg direction=\"out\" type=\"i\" name=\"x\"/>\n"
+ " <arg direction=\"out\" type=\"i\" name=\"y\"/>\n"
+ " <arg direction=\"out\" type=\"i\" name=\"width\"/>\n"
+ " <arg direction=\"out\" type=\"i\" name=\"height\"/>\n"
+ " <arg direction=\"in\" type=\"u\" name=\"coordType\"/>\n"
+ " </method>\n"
+ " <method name=\"GetBoundedRanges\">\n"
+ " <arg direction=\"in\" type=\"i\" name=\"x\"/>\n"
+ " <arg direction=\"in\" type=\"i\" name=\"y\"/>\n"
+ " <arg direction=\"in\" type=\"i\" name=\"width\"/>\n"
+ " <arg direction=\"in\" type=\"i\" name=\"height\"/>\n"
+ " <arg direction=\"in\" type=\"u\" name=\"coordType\"/>\n"
+ " <arg direction=\"in\" type=\"u\" name=\"xClipType\"/>\n"
+ " <arg direction=\"in\" type=\"u\" name=\"yClipType\"/>\n"
+ " <arg direction=\"out\" type=\"a(iisv)\"/>\n"
+ " <annotation value=\"QSpiRangeList\" name=\"org.qtproject.QtDBus.QtTypeName.Out0\"/>\n"
+ " </method>\n"
+ " <method name=\"GetAttributeRun\">\n"
+ " <arg direction=\"in\" type=\"i\" name=\"offset\"/>\n"
+ " <arg direction=\"in\" type=\"b\" name=\"includeDefaults\"/>\n"
+ " <arg direction=\"out\" type=\"a{ss}\"/>\n"
+ " <arg direction=\"out\" type=\"i\" name=\"startOffset\"/>\n"
+ " <arg direction=\"out\" type=\"i\" name=\"endOffset\"/>\n"
+ " <annotation value=\"QSpiAttributeSet\" name=\"org.qtproject.QtDBus.QtTypeName.Out0\"/>\n"
+ " </method>\n"
+ " <method name=\"GetDefaultAttributeSet\">\n"
+ " <arg direction=\"out\" type=\"a{ss}\"/>\n"
+ " <annotation value=\"QSpiAttributeSet\" name=\"org.qtproject.QtDBus.QtTypeName.Out0\"/>\n"
+ " </method>\n"
+ " <method name=\"ScrollSubstringTo\">\n"
+ " <arg direction=\"in\" name=\"startOffset\" type=\"i\"/>\n"
+ " <arg direction=\"in\" name=\"endOffset\" type=\"i\"/>\n"
+ " <arg direction=\"in\" name=\"type\" type=\"u\"/>\n"
+ " <arg direction=\"out\" type=\"b\"/>\n"
+ " </method>\n"
+ " </interface>\n"
+ );
+
+ static const QLatin1StringView valueIntrospection(
+ " <interface name=\"org.a11y.atspi.Value\">\n"
+ " <property access=\"read\" type=\"d\" name=\"MinimumValue\"/>\n"
+ " <property access=\"read\" type=\"d\" name=\"MaximumValue\"/>\n"
+ " <property access=\"read\" type=\"d\" name=\"MinimumIncrement\"/>\n"
+ " <property access=\"readwrite\" type=\"d\" name=\"CurrentValue\"/>\n"
+ " <method name=\"SetCurrentValue\">\n"
+ " <arg direction=\"in\" type=\"d\" name=\"value\"/>\n"
+ " </method>\n"
+ " </interface>\n"
+ );
+
+ QAccessibleInterface * interface = interfaceFromPath(path);
+ if (!interface) {
+ qCWarning(lcAccessibilityAtspi) << "Could not find accessible on path:" << path;
+ return QString();
+ }
+
+ QStringList interfaces = accessibleInterfaces(interface);
+
+ QString xml;
+ xml.append(accessibleIntrospection);
+
+ if (interfaces.contains(ATSPI_DBUS_INTERFACE_COMPONENT ""_L1))
+ xml.append(componentIntrospection);
+ if (interfaces.contains(ATSPI_DBUS_INTERFACE_TEXT ""_L1))
+ xml.append(textIntrospection);
+ if (interfaces.contains(ATSPI_DBUS_INTERFACE_EDITABLE_TEXT ""_L1))
+ xml.append(editableTextIntrospection);
+ if (interfaces.contains(ATSPI_DBUS_INTERFACE_ACTION ""_L1))
+ xml.append(actionIntrospection);
+ if (interfaces.contains(ATSPI_DBUS_INTERFACE_SELECTION ""_L1))
+ xml.append(selectionIntrospection);
+ if (interfaces.contains(ATSPI_DBUS_INTERFACE_TABLE ""_L1))
+ xml.append(tableIntrospection);
+ if (interfaces.contains(ATSPI_DBUS_INTERFACE_TABLE_CELL ""_L1))
+ xml.append(tableCellIntrospection);
+ if (interfaces.contains(ATSPI_DBUS_INTERFACE_VALUE ""_L1))
+ xml.append(valueIntrospection);
+ if (path == QSPI_OBJECT_PATH_ROOT ""_L1)
+ xml.append(applicationIntrospection);
+
+ return xml;
+}
+
+void AtSpiAdaptor::setBitFlag(const QString &flag)
+{
+ Q_ASSERT(flag.size());
+
+ // assume we don't get nonsense - look at first letter only
+ switch (flag.at(0).toLower().toLatin1()) {
+ case 'o': {
+ if (flag.size() <= 8) { // Object::
+ sendObject = 1;
+ } else { // Object:Foo:Bar
+ QString right = flag.mid(7);
+ if (false) {
+ } else if (right.startsWith("ActiveDescendantChanged"_L1)) {
+ sendObject_active_descendant_changed = 1;
+ } else if (right.startsWith("AttributesChanged"_L1)) {
+ sendObject_attributes_changed = 1;
+ } else if (right.startsWith("BoundsChanged"_L1)) {
+ sendObject_bounds_changed = 1;
+ } else if (right.startsWith("ChildrenChanged"_L1)) {
+ sendObject_children_changed = 1;
+ } else if (right.startsWith("ColumnDeleted"_L1)) {
+ sendObject_column_deleted = 1;
+ } else if (right.startsWith("ColumnInserted"_L1)) {
+ sendObject_column_inserted = 1;
+ } else if (right.startsWith("ColumnReordered"_L1)) {
+ sendObject_column_reordered = 1;
+ } else if (right.startsWith("LinkSelected"_L1)) {
+ sendObject_link_selected = 1;
+ } else if (right.startsWith("ModelChanged"_L1)) {
+ sendObject_model_changed = 1;
+ } else if (right.startsWith("PropertyChange"_L1)) {
+ if (right == "PropertyChange:AccessibleDescription"_L1) {
+ sendObject_property_change_accessible_description = 1;
+ } else if (right == "PropertyChange:AccessibleName"_L1) {
+ sendObject_property_change_accessible_name = 1;
+ } else if (right == "PropertyChange:AccessibleParent"_L1) {
+ sendObject_property_change_accessible_parent = 1;
+ } else if (right == "PropertyChange:AccessibleRole"_L1) {
+ sendObject_property_change_accessible_role = 1;
+ } else if (right == "PropertyChange:TableCaption"_L1) {
+ sendObject_property_change_accessible_table_caption = 1;
+ } else if (right == "PropertyChange:TableColumnDescription"_L1) {
+ sendObject_property_change_accessible_table_column_description = 1;
+ } else if (right == "PropertyChange:TableColumnHeader"_L1) {
+ sendObject_property_change_accessible_table_column_header = 1;
+ } else if (right == "PropertyChange:TableRowDescription"_L1) {
+ sendObject_property_change_accessible_table_row_description = 1;
+ } else if (right == "PropertyChange:TableRowHeader"_L1) {
+ sendObject_property_change_accessible_table_row_header = 1;
+ } else if (right == "PropertyChange:TableSummary"_L1) {
+ sendObject_property_change_accessible_table_summary = 1;
+ } else if (right == "PropertyChange:AccessibleValue"_L1) {
+ sendObject_property_change_accessible_value = 1;
+ } else {
+ sendObject_property_change = 1;
+ }
+ } else if (right.startsWith("RowDeleted"_L1)) {
+ sendObject_row_deleted = 1;
+ } else if (right.startsWith("RowInserted"_L1)) {
+ sendObject_row_inserted = 1;
+ } else if (right.startsWith("RowReordered"_L1)) {
+ sendObject_row_reordered = 1;
+ } else if (right.startsWith("SelectionChanged"_L1)) {
+ sendObject_selection_changed = 1;
+ } else if (right.startsWith("StateChanged"_L1)) {
+ sendObject_state_changed = 1;
+ } else if (right.startsWith("TextAttributesChanged"_L1)) {
+ sendObject_text_attributes_changed = 1;
+ } else if (right.startsWith("TextBoundsChanged"_L1)) {
+ sendObject_text_bounds_changed = 1;
+ } else if (right.startsWith("TextCaretMoved"_L1)) {
+ sendObject_text_caret_moved = 1;
+ } else if (right.startsWith("TextChanged"_L1)) {
+ sendObject_text_changed = 1;
+ } else if (right.startsWith("TextSelectionChanged"_L1)) {
+ sendObject_text_selection_changed = 1;
+ } else if (right.startsWith("ValueChanged"_L1)) {
+ sendObject_value_changed = 1;
+ } else if (right.startsWith("VisibleDataChanged"_L1)
+ || right.startsWith("VisibledataChanged"_L1)) { // typo in libatspi
+ sendObject_visible_data_changed = 1;
+ } else {
+ qCWarning(lcAccessibilityAtspi) << "Subscription string not handled:" << flag;
+ }
+ }
+ break;
+ }
+ case 'w': { // window
+ if (flag.size() <= 8) {
+ sendWindow = 1;
+ } else { // object:Foo:Bar
+ QString right = flag.mid(7);
+ if (false) {
+ } else if (right.startsWith("Activate"_L1)) {
+ sendWindow_activate = 1;
+ } else if (right.startsWith("Close"_L1)) {
+ sendWindow_close= 1;
+ } else if (right.startsWith("Create"_L1)) {
+ sendWindow_create = 1;
+ } else if (right.startsWith("Deactivate"_L1)) {
+ sendWindow_deactivate = 1;
+ } else if (right.startsWith("Lower"_L1)) {
+ sendWindow_lower = 1;
+ } else if (right.startsWith("Maximize"_L1)) {
+ sendWindow_maximize = 1;
+ } else if (right.startsWith("Minimize"_L1)) {
+ sendWindow_minimize = 1;
+ } else if (right.startsWith("Move"_L1)) {
+ sendWindow_move = 1;
+ } else if (right.startsWith("Raise"_L1)) {
+ sendWindow_raise = 1;
+ } else if (right.startsWith("Reparent"_L1)) {
+ sendWindow_reparent = 1;
+ } else if (right.startsWith("Resize"_L1)) {
+ sendWindow_resize = 1;
+ } else if (right.startsWith("Restore"_L1)) {
+ sendWindow_restore = 1;
+ } else if (right.startsWith("Restyle"_L1)) {
+ sendWindow_restyle = 1;
+ } else if (right.startsWith("Shade"_L1)) {
+ sendWindow_shade = 1;
+ } else if (right.startsWith("Unshade"_L1)) {
+ sendWindow_unshade = 1;
+ } else if (right.startsWith("DesktopCreate"_L1)) {
+ // ignore this one
+ } else if (right.startsWith("DesktopDestroy"_L1)) {
+ // ignore this one
+ } else {
+ qCWarning(lcAccessibilityAtspi) << "Subscription string not handled:" << flag;
+ }
+ }
+ break;
+ }
+ case 'f': {
+ sendFocus = 1;
+ break;
+ }
+ case 'd': { // document is not implemented
+ break;
+ }
+ case 't': { // terminal is not implemented
+ break;
+ }
+ case 'm': { // mouse* is handled in a different way by the gnome atspi stack
+ break;
+ }
+ default:
+ qCWarning(lcAccessibilityAtspi) << "Subscription string not handled:" << flag;
+ }
+}
+
+/*!
+ Checks via dbus which events should be sent.
+ */
+void AtSpiAdaptor::updateEventListeners()
+{
+ QDBusMessage m = QDBusMessage::createMethodCall("org.a11y.atspi.Registry"_L1,
+ "/org/a11y/atspi/registry"_L1,
+ "org.a11y.atspi.Registry"_L1, "GetRegisteredEvents"_L1);
+ QDBusReply<QSpiEventListenerArray> listenersReply = m_dbus->connection().call(m);
+ if (listenersReply.isValid()) {
+ const QSpiEventListenerArray evList = listenersReply.value();
+ for (const QSpiEventListener &ev : evList)
+ setBitFlag(ev.eventName);
+ m_applicationAdaptor->sendEvents(!evList.isEmpty());
+ } else {
+ qCDebug(lcAccessibilityAtspi) << "Could not query active accessibility event listeners.";
+ }
+}
+
+void AtSpiAdaptor::eventListenerDeregistered(const QString &/*bus*/, const QString &/*path*/)
+{
+// qCDebug(lcAccessibilityAtspi) << "AtSpiAdaptor::eventListenerDeregistered: " << bus << path;
+ updateEventListeners();
+}
+
+void AtSpiAdaptor::eventListenerRegistered(const QString &/*bus*/, const QString &/*path*/)
+{
+// qCDebug(lcAccessibilityAtspi) << "AtSpiAdaptor::eventListenerRegistered: " << bus << path;
+ updateEventListeners();
+}
+
+/*!
+ This slot needs to get called when a \a window has be activated or deactivated (become focused).
+ When \a active is true, the window just received focus, otherwise it lost the focus.
+ */
+void AtSpiAdaptor::windowActivated(QObject* window, bool active)
+{
+ if (!(sendWindow || sendWindow_activate))
+ return;
+
+ QAccessibleInterface *iface = QAccessible::queryAccessibleInterface(window);
+ // If the window has been quickly activated or disabled, it will cause a crash.
+ if (iface == nullptr)
+ return;
+ Q_ASSERT(!active || iface->isValid());
+
+ QString windowTitle;
+ // in dtor it may be invalid
+ if (iface->isValid())
+ windowTitle = iface->text(QAccessible::Name);
+
+ QDBusVariant data;
+ data.setVariant(windowTitle);
+
+ QVariantList args = packDBusSignalArguments(QString(), 0, 0, QVariant::fromValue(data));
+
+ QString status = active ? "Activate"_L1 : "Deactivate"_L1;
+ QString path = pathForObject(window);
+ sendDBusSignal(path, ATSPI_DBUS_INTERFACE_EVENT_WINDOW ""_L1, status, args);
+
+ QVariantList stateArgs = packDBusSignalArguments("active"_L1, active ? 1 : 0, 0, variantForPath(path));
+ sendDBusSignal(path, ATSPI_DBUS_INTERFACE_EVENT_OBJECT ""_L1, "StateChanged"_L1, stateArgs);
+}
+
+QVariantList AtSpiAdaptor::packDBusSignalArguments(const QString &type, int data1, int data2, const QVariant &variantData) const
+{
+ QVariantList arguments;
+ arguments << type << data1 << data2 << variantData
+ << QVariant::fromValue(QSpiObjectReference(m_dbus->connection(), QDBusObjectPath(QSPI_OBJECT_PATH_ROOT)));
+ return arguments;
+}
+
+QVariant AtSpiAdaptor::variantForPath(const QString &path) const
+{
+ QDBusVariant data;
+ data.setVariant(QVariant::fromValue(QSpiObjectReference(m_dbus->connection(), QDBusObjectPath(path))));
+ return QVariant::fromValue(data);
+}
+
+bool AtSpiAdaptor::sendDBusSignal(const QString &path, const QString &interface, const QString &signalName, const QVariantList &arguments) const
+{
+ QDBusMessage message = QDBusMessage::createSignal(path, interface, signalName);
+ message.setArguments(arguments);
+ return m_dbus->connection().send(message);
+}
+
+QAccessibleInterface *AtSpiAdaptor::interfaceFromPath(const QString& dbusPath) const
+{
+ if (dbusPath == QSPI_OBJECT_PATH_ROOT ""_L1)
+ return QAccessible::queryAccessibleInterface(qApp);
+
+ QStringList parts = dbusPath.split(u'/');
+ if (parts.size() != 6) {
+ qCDebug(lcAccessibilityAtspi) << "invalid path: " << dbusPath;
+ return nullptr;
+ }
+
+ QString objectString = parts.at(5);
+ QAccessible::Id id = objectString.toUInt();
+
+ // The id is always in the range [INT_MAX+1, UINT_MAX]
+ if ((int)id >= 0)
+ qCWarning(lcAccessibilityAtspi) << "No accessible object found for id: " << id;
+
+ return QAccessible::accessibleInterface(id);
+}
+
+void AtSpiAdaptor::notifyStateChange(QAccessibleInterface *interface, const QString &state, int value)
+{
+ QString path = pathForInterface(interface);
+ QVariantList stateArgs = packDBusSignalArguments(state, value, 0, variantForPath(path));
+ sendDBusSignal(path, ATSPI_DBUS_INTERFACE_EVENT_OBJECT ""_L1, "StateChanged"_L1, stateArgs);
+}
+
+
+/*!
+ This function gets called when Qt notifies about accessibility updates.
+*/
+void AtSpiAdaptor::notify(QAccessibleEvent *event)
+{
+ switch (event->type()) {
+ case QAccessible::ObjectCreated:
+ if (sendObject || sendObject_children_changed)
+ notifyAboutCreation(event->accessibleInterface());
+ break;
+ case QAccessible::ObjectShow: {
+ if (sendObject || sendObject_state_changed) {
+ notifyStateChange(event->accessibleInterface(), "showing"_L1, 1);
+ }
+ break;
+ }
+ case QAccessible::ObjectHide: {
+ if (sendObject || sendObject_state_changed) {
+ notifyStateChange(event->accessibleInterface(), "showing"_L1, 0);
+ }
+ break;
+ }
+ case QAccessible::ObjectDestroyed: {
+ if (sendObject || sendObject_state_changed)
+ notifyAboutDestruction(event->accessibleInterface());
+ break;
+ }
+ case QAccessible::ObjectReorder: {
+ if (sendObject || sendObject_children_changed)
+ childrenChanged(event->accessibleInterface());
+ break;
+ }
+ case QAccessible::NameChanged: {
+ if (sendObject || sendObject_property_change || sendObject_property_change_accessible_name) {
+ QAccessibleInterface *iface = event->accessibleInterface();
+ if (!iface) {
+ qCDebug(lcAccessibilityAtspi,
+ "NameChanged event from invalid accessible.");
+ return;
+ }
+
+ QString path = pathForInterface(iface);
+ QVariantList args = packDBusSignalArguments(
+ "accessible-name"_L1, 0, 0,
+ QVariant::fromValue(QDBusVariant(iface->text(QAccessible::Name))));
+ sendDBusSignal(path, ATSPI_DBUS_INTERFACE_EVENT_OBJECT ""_L1,
+ "PropertyChange"_L1, args);
+ }
+ break;
+ }
+ case QAccessible::DescriptionChanged: {
+ if (sendObject || sendObject_property_change || sendObject_property_change_accessible_description) {
+ QAccessibleInterface *iface = event->accessibleInterface();
+ if (!iface) {
+ qCDebug(lcAccessibilityAtspi,
+ "DescriptionChanged event from invalid accessible.");
+ return;
+ }
+
+ QString path = pathForInterface(iface);
+ QVariantList args = packDBusSignalArguments(
+ "accessible-description"_L1, 0, 0,
+ QVariant::fromValue(QDBusVariant(iface->text(QAccessible::Description))));
+ sendDBusSignal(path, ATSPI_DBUS_INTERFACE_EVENT_OBJECT ""_L1,
+ "PropertyChange"_L1, args);
+ }
+ break;
+ }
+ case QAccessible::Focus: {
+ if (sendFocus || sendObject || sendObject_state_changed)
+ sendFocusChanged(event->accessibleInterface());
+ break;
+ }
+ case QAccessible::TextInserted:
+ case QAccessible::TextRemoved:
+ case QAccessible::TextUpdated: {
+ if (sendObject || sendObject_text_changed) {
+ QAccessibleInterface * iface = event->accessibleInterface();
+ if (!iface || !iface->textInterface()) {
+ qCWarning(lcAccessibilityAtspi) << "Received text event for invalid interface.";
+ return;
+ }
+ QString path = pathForInterface(iface);
+
+ int changePosition = 0;
+ int cursorPosition = 0;
+ QString textRemoved;
+ QString textInserted;
+
+ if (event->type() == QAccessible::TextInserted) {
+ QAccessibleTextInsertEvent *textEvent = static_cast<QAccessibleTextInsertEvent*>(event);
+ textInserted = textEvent->textInserted();
+ changePosition = textEvent->changePosition();
+ cursorPosition = textEvent->cursorPosition();
+ } else if (event->type() == QAccessible::TextRemoved) {
+ QAccessibleTextRemoveEvent *textEvent = static_cast<QAccessibleTextRemoveEvent*>(event);
+ textRemoved = textEvent->textRemoved();
+ changePosition = textEvent->changePosition();
+ cursorPosition = textEvent->cursorPosition();
+ } else if (event->type() == QAccessible::TextUpdated) {
+ QAccessibleTextUpdateEvent *textEvent = static_cast<QAccessibleTextUpdateEvent*>(event);
+ textInserted = textEvent->textInserted();
+ textRemoved = textEvent->textRemoved();
+ changePosition = textEvent->changePosition();
+ cursorPosition = textEvent->cursorPosition();
+ }
+
+ QDBusVariant data;
+
+ if (!textRemoved.isEmpty()) {
+ data.setVariant(QVariant::fromValue(textRemoved));
+ QVariantList args = packDBusSignalArguments("delete"_L1, changePosition, textRemoved.size(), QVariant::fromValue(data));
+ sendDBusSignal(path, ATSPI_DBUS_INTERFACE_EVENT_OBJECT ""_L1,
+ "TextChanged"_L1, args);
+ }
+
+ if (!textInserted.isEmpty()) {
+ data.setVariant(QVariant::fromValue(textInserted));
+ QVariantList args = packDBusSignalArguments("insert"_L1, changePosition, textInserted.size(), QVariant::fromValue(data));
+ sendDBusSignal(path, ATSPI_DBUS_INTERFACE_EVENT_OBJECT ""_L1,
+ "TextChanged"_L1, args);
+ }
+
+ // send a cursor update
+ Q_UNUSED(cursorPosition);
+// QDBusVariant cursorData;
+// cursorData.setVariant(QVariant::fromValue(cursorPosition));
+// QVariantList args = packDBusSignalArguments(QString(), cursorPosition, 0, QVariant::fromValue(cursorData));
+// sendDBusSignal(path, ATSPI_DBUS_INTERFACE_EVENT_OBJECT ""_L1,
+// "TextCaretMoved"_L1, args);
+ }
+ break;
+ }
+ case QAccessible::TextCaretMoved: {
+ if (sendObject || sendObject_text_caret_moved) {
+ QAccessibleInterface * iface = event->accessibleInterface();
+ if (!iface || !iface->textInterface()) {
+ qCWarning(lcAccessibilityAtspi) << "Sending TextCaretMoved from object that does not implement text interface: " << iface;
+ return;
+ }
+
+ QString path = pathForInterface(iface);
+ QDBusVariant cursorData;
+ int pos = iface->textInterface()->cursorPosition();
+ cursorData.setVariant(QVariant::fromValue(pos));
+ QVariantList args = packDBusSignalArguments(QString(), pos, 0, QVariant::fromValue(cursorData));
+ sendDBusSignal(path, ATSPI_DBUS_INTERFACE_EVENT_OBJECT ""_L1,
+ "TextCaretMoved"_L1, args);
+ }
+ break;
+ }
+ case QAccessible::TextSelectionChanged: {
+ if (sendObject || sendObject_text_selection_changed) {
+ QAccessibleInterface * iface = event->accessibleInterface();
+ QString path = pathForInterface(iface);
+ QVariantList args = packDBusSignalArguments(QString(), 0, 0, QVariant::fromValue(QDBusVariant(QVariant(QString()))));
+ sendDBusSignal(path, ATSPI_DBUS_INTERFACE_EVENT_OBJECT ""_L1,
+ "TextSelectionChanged"_L1, args);
+ }
+ break;
+ }
+ case QAccessible::ValueChanged: {
+ if (sendObject || sendObject_value_changed || sendObject_property_change_accessible_value) {
+ QAccessibleInterface * iface = event->accessibleInterface();
+ if (!iface) {
+ qCWarning(lcAccessibilityAtspi) << "ValueChanged event from invalid accessible.";
+ return;
+ }
+ if (iface->valueInterface()) {
+ QString path = pathForInterface(iface);
+ QVariantList args = packDBusSignalArguments("accessible-value"_L1, 0, 0, variantForPath(path));
+ sendDBusSignal(path, ATSPI_DBUS_INTERFACE_EVENT_OBJECT ""_L1,
+ "PropertyChange"_L1, args);
+ } else if (iface->role() == QAccessible::ComboBox) {
+ // Combo Box with AT-SPI likes to be special
+ // It requires a name-change to update caches and then selection-changed
+ QString path = pathForInterface(iface);
+ QVariantList args1 = packDBusSignalArguments(
+ "accessible-name"_L1, 0, 0,
+ QVariant::fromValue(QDBusVariant(iface->text(QAccessible::Name))));
+ sendDBusSignal(path, ATSPI_DBUS_INTERFACE_EVENT_OBJECT ""_L1,
+ "PropertyChange"_L1, args1);
+ QVariantList args2 = packDBusSignalArguments(QString(), 0, 0, QVariant::fromValue(QDBusVariant(QVariant(0))));
+ sendDBusSignal(path, ATSPI_DBUS_INTERFACE_EVENT_OBJECT ""_L1,
+ "SelectionChanged"_L1, args2);
+ } else {
+ qCWarning(lcAccessibilityAtspi) << "ValueChanged event and no ValueInterface or ComboBox: " << iface;
+ }
+ }
+ break;
+ }
+ case QAccessible::SelectionAdd:
+ case QAccessible::SelectionRemove:
+ case QAccessible::Selection: {
+ QAccessibleInterface * iface = event->accessibleInterface();
+ if (!iface) {
+ qCWarning(lcAccessibilityAtspi) << "Selection event from invalid accessible.";
+ return;
+ }
+ // send event for change of selected state for the interface itself
+ QString path = pathForInterface(iface);
+ int selected = iface->state().selected ? 1 : 0;
+ QVariantList stateArgs = packDBusSignalArguments("selected"_L1, selected, 0, variantForPath(path));
+ sendDBusSignal(path, ATSPI_DBUS_INTERFACE_EVENT_OBJECT ""_L1, "StateChanged"_L1, stateArgs);
+
+ // send SelectionChanged event for the parent
+ QAccessibleInterface* parent = iface->parent();
+ if (!parent) {
+ qCDebug(lcAccessibilityAtspi) << "No valid parent in selection event.";
+ return;
+ }
+
+ QString parentPath = pathForInterface(parent);
+ QVariantList args = packDBusSignalArguments(QString(), 0, 0, variantForPath(parentPath));
+ sendDBusSignal(parentPath, QLatin1String(ATSPI_DBUS_INTERFACE_EVENT_OBJECT),
+ QLatin1String("SelectionChanged"), args);
+ break;
+ }
+ case QAccessible::SelectionWithin: {
+ QAccessibleInterface * iface = event->accessibleInterface();
+ if (!iface) {
+ qCWarning(lcAccessibilityAtspi) << "SelectionWithin event from invalid accessible.";
+ return;
+ }
+
+ QString path = pathForInterface(iface);
+ QVariantList args = packDBusSignalArguments(QString(), 0, 0, variantForPath(path));
+ sendDBusSignal(path, QLatin1String(ATSPI_DBUS_INTERFACE_EVENT_OBJECT), QLatin1String("SelectionChanged"), args);
+ break;
+ }
+ case QAccessible::StateChanged: {
+ if (sendObject || sendObject_state_changed || sendWindow || sendWindow_activate) {
+ QAccessible::State stateChange = static_cast<QAccessibleStateChangeEvent*>(event)->changedStates();
+ if (stateChange.checked) {
+ QAccessibleInterface * iface = event->accessibleInterface();
+ if (!iface) {
+ qCWarning(lcAccessibilityAtspi) << "StateChanged event from invalid accessible.";
+ return;
+ }
+ int checked = iface->state().checked;
+ notifyStateChange(iface, "checked"_L1, checked);
+ } else if (stateChange.active) {
+ QAccessibleInterface * iface = event->accessibleInterface();
+ if (!iface || !(iface->role() == QAccessible::Window && (sendWindow || sendWindow_activate)))
+ return;
+ int isActive = iface->state().active;
+ QString windowTitle = iface->text(QAccessible::Name);
+ QDBusVariant data;
+ data.setVariant(windowTitle);
+ QVariantList args = packDBusSignalArguments(QString(), 0, 0, QVariant::fromValue(data));
+ QString status = isActive ? "Activate"_L1 : "Deactivate"_L1;
+ QString path = pathForInterface(iface);
+ sendDBusSignal(path, ATSPI_DBUS_INTERFACE_EVENT_WINDOW ""_L1, status, args);
+ notifyStateChange(iface, "active"_L1, isActive);
+ } else if (stateChange.disabled) {
+ QAccessibleInterface *iface = event->accessibleInterface();
+ QAccessible::State state = iface->state();
+ bool enabled = !state.disabled;
+
+ notifyStateChange(iface, "enabled"_L1, enabled);
+ notifyStateChange(iface, "sensitive"_L1, enabled);
+ } else if (stateChange.focused) {
+ QAccessibleInterface *iface = event->accessibleInterface();
+ QAccessible::State state = iface->state();
+ bool focused = state.focused;
+ notifyStateChange(iface, "focused"_L1, focused);
+ }
+ }
+ break;
+ }
+ case QAccessible::TableModelChanged: {
+ QAccessibleInterface *interface = event->accessibleInterface();
+ if (!interface || !interface->isValid()) {
+ qCWarning(lcAccessibilityAtspi) << "TableModelChanged event from invalid accessible.";
+ return;
+ }
+
+ const QString path = pathForInterface(interface);
+ QAccessibleTableModelChangeEvent *tableModelEvent = static_cast<QAccessibleTableModelChangeEvent*>(event);
+ switch (tableModelEvent->modelChangeType()) {
+ case QAccessibleTableModelChangeEvent::ColumnsInserted: {
+ if (sendObject || sendObject_column_inserted) {
+ const int firstColumn = tableModelEvent->firstColumn();
+ const int insertedColumnCount = tableModelEvent->lastColumn() - firstColumn + 1;
+ QVariantList args = packDBusSignalArguments(QString(), firstColumn, insertedColumnCount, QVariant::fromValue(QDBusVariant(QVariant(QString()))));
+ sendDBusSignal(path, ATSPI_DBUS_INTERFACE_EVENT_OBJECT ""_L1, "ColumnInserted"_L1, args);
+ }
+ break;
+ }
+ case QAccessibleTableModelChangeEvent::ColumnsRemoved: {
+ if (sendObject || sendObject_column_deleted) {
+ const int firstColumn = tableModelEvent->firstColumn();
+ const int removedColumnCount = tableModelEvent->lastColumn() - firstColumn + 1;
+ QVariantList args = packDBusSignalArguments(QString(), firstColumn, removedColumnCount, QVariant::fromValue(QDBusVariant(QVariant(QString()))));
+ sendDBusSignal(path, ATSPI_DBUS_INTERFACE_EVENT_OBJECT ""_L1, "ColumnDeleted"_L1, args);
+ }
+ break;
+ }
+ case QAccessibleTableModelChangeEvent::RowsInserted: {
+ if (sendObject || sendObject_row_inserted) {
+ const int firstRow = tableModelEvent->firstRow();
+ const int insertedRowCount = tableModelEvent->lastRow() - firstRow + 1;
+ QVariantList args = packDBusSignalArguments(QString(), firstRow, insertedRowCount, QVariant::fromValue(QDBusVariant(QVariant(QString()))));
+ sendDBusSignal(path, ATSPI_DBUS_INTERFACE_EVENT_OBJECT ""_L1, "RowInserted"_L1, args);
+ }
+ break;
+ }
+ case QAccessibleTableModelChangeEvent::RowsRemoved: {
+ if (sendObject || sendObject_row_deleted) {
+ const int firstRow = tableModelEvent->firstRow();
+ const int removedRowCount = tableModelEvent->lastRow() - firstRow + 1;
+ QVariantList args = packDBusSignalArguments(QString(), firstRow, removedRowCount, QVariant::fromValue(QDBusVariant(QVariant(QString()))));
+ sendDBusSignal(path, ATSPI_DBUS_INTERFACE_EVENT_OBJECT ""_L1, "RowDeleted"_L1, args);
+ }
+ break;
+ }
+ case QAccessibleTableModelChangeEvent::ModelChangeType::ModelReset: {
+ if (sendObject || sendObject_model_changed) {
+ QVariantList args = packDBusSignalArguments(QString(), 0, 0, QVariant::fromValue(QDBusVariant(QVariant(QString()))));
+ sendDBusSignal(path, ATSPI_DBUS_INTERFACE_EVENT_OBJECT ""_L1, "ModelChanged"_L1, args);
+ }
+ break;
+ }
+ case QAccessibleTableModelChangeEvent::DataChanged: {
+ if (sendObject || sendObject_visible_data_changed) {
+ QVariantList args = packDBusSignalArguments(QString(), 0, 0, QVariant::fromValue(QDBusVariant(QVariant(QString()))));
+ sendDBusSignal(path, ATSPI_DBUS_INTERFACE_EVENT_OBJECT ""_L1, "VisibleDataChanged"_L1, args);
+ }
+ break;
+ }
+ }
+ break;
+ }
+
+ // For now we ignore these events
+ case QAccessible::ParentChanged:
+ case QAccessible::DialogStart:
+ case QAccessible::DialogEnd:
+ case QAccessible::PopupMenuStart:
+ case QAccessible::PopupMenuEnd:
+ case QAccessible::SoundPlayed:
+ case QAccessible::Alert:
+ case QAccessible::ForegroundChanged:
+ case QAccessible::MenuStart:
+ case QAccessible::MenuEnd:
+ case QAccessible::ContextHelpStart:
+ case QAccessible::ContextHelpEnd:
+ case QAccessible::DragDropStart:
+ case QAccessible::DragDropEnd:
+ case QAccessible::ScrollingStart:
+ case QAccessible::ScrollingEnd:
+ case QAccessible::MenuCommand:
+ case QAccessible::ActionChanged:
+ case QAccessible::ActiveDescendantChanged:
+ case QAccessible::AttributeChanged:
+ case QAccessible::DocumentContentChanged:
+ case QAccessible::DocumentLoadComplete:
+ case QAccessible::DocumentLoadStopped:
+ case QAccessible::DocumentReload:
+ case QAccessible::HyperlinkEndIndexChanged:
+ case QAccessible::HyperlinkNumberOfAnchorsChanged:
+ case QAccessible::HyperlinkSelectedLinkChanged:
+ case QAccessible::HypertextLinkActivated:
+ case QAccessible::HypertextLinkSelected:
+ case QAccessible::HyperlinkStartIndexChanged:
+ case QAccessible::HypertextChanged:
+ case QAccessible::HypertextNLinksChanged:
+ case QAccessible::ObjectAttributeChanged:
+ case QAccessible::PageChanged:
+ case QAccessible::SectionChanged:
+ case QAccessible::TableCaptionChanged:
+ case QAccessible::TableColumnDescriptionChanged:
+ case QAccessible::TableColumnHeaderChanged:
+ case QAccessible::TableRowDescriptionChanged:
+ case QAccessible::TableRowHeaderChanged:
+ case QAccessible::TableSummaryChanged:
+ case QAccessible::TextAttributeChanged:
+ case QAccessible::TextColumnChanged:
+ case QAccessible::VisibleDataChanged:
+ case QAccessible::LocationChanged:
+ case QAccessible::HelpChanged:
+ case QAccessible::DefaultActionChanged:
+ case QAccessible::AcceleratorChanged:
+ case QAccessible::InvalidEvent:
+ break;
+ }
+}
+
+void AtSpiAdaptor::sendFocusChanged(QAccessibleInterface *interface) const
+{
+ static QString lastFocusPath;
+ // "remove" old focus
+ if (!lastFocusPath.isEmpty()) {
+ QVariantList stateArgs = packDBusSignalArguments("focused"_L1, 0, 0, variantForPath(lastFocusPath));
+ sendDBusSignal(lastFocusPath, ATSPI_DBUS_INTERFACE_EVENT_OBJECT ""_L1,
+ "StateChanged"_L1, stateArgs);
+ }
+ // send new focus
+ {
+ QString path = pathForInterface(interface);
+
+ QVariantList stateArgs = packDBusSignalArguments("focused"_L1, 1, 0, variantForPath(path));
+ sendDBusSignal(path, ATSPI_DBUS_INTERFACE_EVENT_OBJECT ""_L1,
+ "StateChanged"_L1, stateArgs);
+
+ QVariantList focusArgs = packDBusSignalArguments(QString(), 0, 0, variantForPath(path));
+ sendDBusSignal(path, ATSPI_DBUS_INTERFACE_EVENT_FOCUS ""_L1, "Focus"_L1, focusArgs);
+ lastFocusPath = path;
+ }
+}
+
+void AtSpiAdaptor::childrenChanged(QAccessibleInterface *interface) const
+{
+ QString parentPath = pathForInterface(interface);
+ int childCount = interface->childCount();
+ for (int i = 0; i < interface->childCount(); ++i) {
+ QString childPath = pathForInterface(interface->child(i));
+ QVariantList args = packDBusSignalArguments("add"_L1, childCount, 0, childPath);
+ sendDBusSignal(parentPath, ATSPI_DBUS_INTERFACE_EVENT_OBJECT ""_L1, "ChildrenChanged"_L1, args);
+ }
+}
+
+void AtSpiAdaptor::notifyAboutCreation(QAccessibleInterface *interface) const
+{
+ // notify about the new child of our parent
+ QAccessibleInterface * parent = interface->parent();
+ if (!parent) {
+ qCDebug(lcAccessibilityAtspi) << "AtSpiAdaptor::notifyAboutCreation: Could not find parent for " << interface->object();
+ return;
+ }
+ QString path = pathForInterface(interface);
+ int childCount = parent->childCount();
+ QString parentPath = pathForInterface(parent);
+ QVariantList args = packDBusSignalArguments("add"_L1, childCount, 0, variantForPath(path));
+ sendDBusSignal(parentPath, ATSPI_DBUS_INTERFACE_EVENT_OBJECT ""_L1, "ChildrenChanged"_L1, args);
+}
+
+void AtSpiAdaptor::notifyAboutDestruction(QAccessibleInterface *interface) const
+{
+ if (!interface || !interface->isValid())
+ return;
+
+ QAccessibleInterface * parent = interface->parent();
+ if (!parent) {
+ qCDebug(lcAccessibilityAtspi) << "AtSpiAdaptor::notifyAboutDestruction: Could not find parent for " << interface->object();
+ return;
+ }
+ QString path = pathForInterface(interface);
+
+ // this is in the destructor. we have no clue which child we used to be.
+ // FIXME
+ int childIndex = -1;
+ // if (child) {
+ // childIndex = child;
+ // } else {
+ // childIndex = parent->indexOfChild(interface);
+ // }
+
+ QString parentPath = pathForInterface(parent);
+ QVariantList args = packDBusSignalArguments("remove"_L1, childIndex, 0, variantForPath(path));
+ sendDBusSignal(parentPath, ATSPI_DBUS_INTERFACE_EVENT_OBJECT ""_L1, "ChildrenChanged"_L1, args);
+}
+
+/*!
+ Handle incoming DBus message.
+ This function dispatches the dbus message to the right interface handler.
+ */
+bool AtSpiAdaptor::handleMessage(const QDBusMessage &message, const QDBusConnection &connection)
+{
+ // get accessible interface
+ QAccessibleInterface * accessible = interfaceFromPath(message.path());
+ if (!accessible) {
+ qCWarning(lcAccessibilityAtspi) << "Could not find accessible on path:" << message.path();
+ return false;
+ }
+ if (!accessible->isValid()) {
+ qCWarning(lcAccessibilityAtspi) << "Accessible invalid:" << accessible << message.path();
+ return false;
+ }
+
+ QString interface = message.interface();
+ QString function = message.member();
+
+ // qCDebug(lcAccessibilityAtspi) << "AtSpiAdaptor::handleMessage: " << interface << function;
+
+ if (function == "Introspect"_L1) {
+ //introspect(message.path());
+ return false;
+ }
+
+ // handle properties like regular functions
+ if (interface == "org.freedesktop.DBus.Properties"_L1) {
+ interface = message.arguments().at(0).toString();
+ // Get/Set + Name
+ function = message.member() + message.arguments().at(1).toString();
+ }
+
+ // switch interface to call
+ if (interface == ATSPI_DBUS_INTERFACE_ACCESSIBLE ""_L1)
+ return accessibleInterface(accessible, function, message, connection);
+ if (interface == ATSPI_DBUS_INTERFACE_APPLICATION ""_L1)
+ return applicationInterface(accessible, function, message, connection);
+ if (interface == ATSPI_DBUS_INTERFACE_COMPONENT ""_L1)
+ return componentInterface(accessible, function, message, connection);
+ if (interface == ATSPI_DBUS_INTERFACE_ACTION ""_L1)
+ return actionInterface(accessible, function, message, connection);
+ if (interface == ATSPI_DBUS_INTERFACE_SELECTION ""_L1)
+ return selectionInterface(accessible, function, message, connection);
+ if (interface == ATSPI_DBUS_INTERFACE_TEXT ""_L1)
+ return textInterface(accessible, function, message, connection);
+ if (interface == ATSPI_DBUS_INTERFACE_EDITABLE_TEXT ""_L1)
+ return editableTextInterface(accessible, function, message, connection);
+ if (interface == ATSPI_DBUS_INTERFACE_VALUE ""_L1)
+ return valueInterface(accessible, function, message, connection);
+ if (interface == ATSPI_DBUS_INTERFACE_TABLE ""_L1)
+ return tableInterface(accessible, function, message, connection);
+ if (interface == ATSPI_DBUS_INTERFACE_TABLE_CELL ""_L1)
+ return tableCellInterface(accessible, function, message, connection);
+
+ qCDebug(lcAccessibilityAtspi) << "AtSpiAdaptor::handleMessage with unknown interface: " << message.path() << interface << function;
+ return false;
+}
+
+// Application
+bool AtSpiAdaptor::applicationInterface(QAccessibleInterface *interface, const QString &function, const QDBusMessage &message, const QDBusConnection &connection)
+{
+ if (message.path() != ATSPI_DBUS_PATH_ROOT ""_L1) {
+ qCWarning(lcAccessibilityAtspi) << "Could not find application interface for:" << message.path() << interface;
+ return false;
+ }
+
+ if (function == "SetId"_L1) {
+ Q_ASSERT(message.signature() == "ssv"_L1);
+ QVariant value = qvariant_cast<QDBusVariant>(message.arguments().at(2)).variant();
+
+ m_applicationId = value.toInt();
+ return true;
+ }
+ if (function == "GetId"_L1) {
+ Q_ASSERT(message.signature() == "ss"_L1);
+ QDBusMessage reply = message.createReply(QVariant::fromValue(QDBusVariant(m_applicationId)));
+ return connection.send(reply);
+ }
+ if (function == "GetToolkitName"_L1) {
+ Q_ASSERT(message.signature() == "ss"_L1);
+ QDBusMessage reply = message.createReply(QVariant::fromValue(QDBusVariant("Qt"_L1)));
+ return connection.send(reply);
+ }
+ if (function == "GetVersion"_L1) {
+ Q_ASSERT(message.signature() == "ss"_L1);
+ QDBusMessage reply = message.createReply(QVariant::fromValue(QDBusVariant(QLatin1StringView(qVersion()))));
+ return connection.send(reply);
+ }
+ if (function == "GetLocale"_L1) {
+ Q_ASSERT(message.signature() == "u"_L1);
+ QDBusMessage reply = message.createReply(QVariant::fromValue(QLocale().name()));
+ return connection.send(reply);
+ }
+ qCDebug(lcAccessibilityAtspi) << "AtSpiAdaptor::applicationInterface " << message.path() << interface << function;
+ return false;
+}
+
+/*!
+ Register this application as accessible on the accessibility DBus.
+ */
+void AtSpiAdaptor::registerApplication()
+{
+ OrgA11yAtspiSocketInterface *registry;
+ registry = new OrgA11yAtspiSocketInterface(QSPI_REGISTRY_NAME ""_L1,
+ QSPI_OBJECT_PATH_ROOT ""_L1, m_dbus->connection());
+
+ QDBusPendingReply<QSpiObjectReference> reply;
+ QSpiObjectReference ref = QSpiObjectReference(m_dbus->connection(), QDBusObjectPath(QSPI_OBJECT_PATH_ROOT));
+ reply = registry->Embed(ref);
+ reply.waitForFinished(); // TODO: make this async
+ if (reply.isValid ()) {
+ const QSpiObjectReference &socket = reply.value();
+ accessibilityRegistry = QSpiObjectReference(socket);
+ } else {
+ qCWarning(lcAccessibilityAtspi) << "Error in contacting registry:"
+ << reply.error().name()
+ << reply.error().message();
+ }
+ delete registry;
+}
+
+namespace {
+QString accessibleIdForAccessible(QAccessibleInterface *accessible)
+{
+ QString result;
+ while (accessible) {
+ if (!result.isEmpty())
+ result.prepend(u'.');
+ if (auto obj = accessible->object()) {
+ const QString name = obj->objectName();
+ if (!name.isEmpty())
+ result.prepend(name);
+ else
+ result.prepend(QString::fromUtf8(obj->metaObject()->className()));
+ }
+ accessible = accessible->parent();
+ }
+ return result;
+}
+} // namespace
+
+// Accessible
+bool AtSpiAdaptor::accessibleInterface(QAccessibleInterface *interface, const QString &function, const QDBusMessage &message, const QDBusConnection &connection)
+{
+ if (function == "GetRole"_L1) {
+ sendReply(connection, message, (uint) getRole(interface));
+ } else if (function == "GetName"_L1) {
+ sendReply(connection, message, QVariant::fromValue(QDBusVariant(interface->text(QAccessible::Name))));
+ } else if (function == "GetRoleName"_L1) {
+ sendReply(connection, message, QSpiAccessibleBridge::namesForRole(interface->role()).name());
+ } else if (function == "GetLocalizedRoleName"_L1) {
+ sendReply(connection, message, QVariant::fromValue(QSpiAccessibleBridge::namesForRole(interface->role()).localizedName()));
+ } else if (function == "GetChildCount"_L1) {
+ sendReply(connection, message, QVariant::fromValue(QDBusVariant(interface->childCount())));
+ } else if (function == "GetIndexInParent"_L1) {
+ int childIndex = -1;
+ QAccessibleInterface * parent = interface->parent();
+ if (parent) {
+ childIndex = parent->indexOfChild(interface);
+ if (childIndex < 0) {
+ qCDebug(lcAccessibilityAtspi) << "GetIndexInParent get invalid index: " << childIndex << interface;
+ }
+ }
+ sendReply(connection, message, childIndex);
+ } else if (function == "GetParent"_L1) {
+ QString path;
+ QAccessibleInterface * parent = interface->parent();
+ if (!parent) {
+ path = ATSPI_DBUS_PATH_NULL ""_L1;
+ } else if (parent->role() == QAccessible::Application) {
+ path = ATSPI_DBUS_PATH_ROOT ""_L1;
+ } else {
+ path = pathForInterface(parent);
+ }
+ // Parent is a property, so it needs to be wrapped inside an extra variant.
+ sendReply(connection, message, QVariant::fromValue(
+ QDBusVariant(QVariant::fromValue(QSpiObjectReference(connection, QDBusObjectPath(path))))));
+ } else if (function == "GetChildAtIndex"_L1) {
+ const int index = message.arguments().at(0).toInt();
+ if (index < 0) {
+ sendReply(connection, message, QVariant::fromValue(
+ QSpiObjectReference(connection, QDBusObjectPath(ATSPI_DBUS_PATH_NULL))));
+ } else {
+ QAccessibleInterface * childInterface = interface->child(index);
+ sendReply(connection, message, QVariant::fromValue(
+ QSpiObjectReference(connection, QDBusObjectPath(pathForInterface(childInterface)))));
+ }
+ } else if (function == "GetInterfaces"_L1) {
+ sendReply(connection, message, accessibleInterfaces(interface));
+ } else if (function == "GetDescription"_L1) {
+ sendReply(connection, message, QVariant::fromValue(QDBusVariant(interface->text(QAccessible::Description))));
+ } else if (function == "GetState"_L1) {
+ quint64 spiState = spiStatesFromQState(interface->state());
+ if (interface->tableInterface()) {
+ // For tables, setting manages_descendants should
+ // indicate to the client that it cannot cache these
+ // interfaces.
+ setSpiStateBit(&spiState, ATSPI_STATE_MANAGES_DESCENDANTS);
+ }
+ QAccessible::Role role = interface->role();
+ if (role == QAccessible::TreeItem ||
+ role == QAccessible::ListItem) {
+ /* Transient means libatspi2 will not cache items.
+ This is important because when adding/removing an item
+ the cache becomes outdated and we don't change the paths of
+ items in lists/trees/tables. */
+ setSpiStateBit(&spiState, ATSPI_STATE_TRANSIENT);
+ }
+ sendReply(connection, message,
+ QVariant::fromValue(spiStateSetFromSpiStates(spiState)));
+ } else if (function == "GetAttributes"_L1) {
+ sendReply(connection, message, QVariant::fromValue(QSpiAttributeSet()));
+ } else if (function == "GetRelationSet"_L1) {
+ sendReply(connection, message, QVariant::fromValue(relationSet(interface, connection)));
+ } else if (function == "GetApplication"_L1) {
+ sendReply(connection, message, QVariant::fromValue(
+ QSpiObjectReference(connection, QDBusObjectPath(QSPI_OBJECT_PATH_ROOT))));
+ } else if (function == "GetChildren"_L1) {
+ QSpiObjectReferenceArray children;
+ const int numChildren = interface->childCount();
+ children.reserve(numChildren);
+ for (int i = 0; i < numChildren; ++i) {
+ QString childPath = pathForInterface(interface->child(i));
+ QSpiObjectReference ref(connection, QDBusObjectPath(childPath));
+ children << ref;
+ }
+ connection.send(message.createReply(QVariant::fromValue(children)));
+ } else if (function == "GetAccessibleId"_L1) {
+ sendReply(connection, message,
+ QVariant::fromValue(QDBusVariant(accessibleIdForAccessible(interface))));
+ } else {
+ qCWarning(lcAccessibilityAtspi) << "AtSpiAdaptor::accessibleInterface does not implement" << function << message.path();
+ return false;
+ }
+ return true;
+}
+
+AtspiRole AtSpiAdaptor::getRole(QAccessibleInterface *interface) const
+{
+ if ((interface->role() == QAccessible::EditableText) && interface->state().passwordEdit)
+ return ATSPI_ROLE_PASSWORD_TEXT;
+ return QSpiAccessibleBridge::namesForRole(interface->role()).spiRole();
+}
+
+QStringList AtSpiAdaptor::accessibleInterfaces(QAccessibleInterface *interface) const
+{
+ QStringList ifaces;
+ qCDebug(lcAccessibilityAtspiCreation) << "AtSpiAdaptor::accessibleInterfaces create: " << interface->object();
+ ifaces << u"" ATSPI_DBUS_INTERFACE_ACCESSIBLE ""_s;
+
+ if ( (!interface->rect().isEmpty()) ||
+ (interface->object() && interface->object()->isWidgetType()) ||
+ (interface->role() == QAccessible::ListItem) ||
+ (interface->role() == QAccessible::Cell) ||
+ (interface->role() == QAccessible::TreeItem) ||
+ (interface->role() == QAccessible::Row) ||
+ (interface->object() && interface->object()->inherits("QSGItem"))
+ ) {
+ ifaces << u"" ATSPI_DBUS_INTERFACE_COMPONENT ""_s;
+ } else {
+ qCDebug(lcAccessibilityAtspiCreation) << " IS NOT a component";
+ }
+ if (interface->role() == QAccessible::Application)
+ ifaces << u"" ATSPI_DBUS_INTERFACE_APPLICATION ""_s;
+
+ if (interface->actionInterface() || interface->valueInterface())
+ ifaces << u"" ATSPI_DBUS_INTERFACE_ACTION ""_s;
+
+ if (interface->selectionInterface())
+ ifaces << ATSPI_DBUS_INTERFACE_SELECTION ""_L1;
+
+ if (interface->textInterface())
+ ifaces << u"" ATSPI_DBUS_INTERFACE_TEXT ""_s;
+
+ if (interface->editableTextInterface())
+ ifaces << u"" ATSPI_DBUS_INTERFACE_EDITABLE_TEXT ""_s;
+
+ if (interface->valueInterface())
+ ifaces << u"" ATSPI_DBUS_INTERFACE_VALUE ""_s;
+
+ if (interface->tableInterface())
+ ifaces << u"" ATSPI_DBUS_INTERFACE_TABLE ""_s;
+
+ if (interface->tableCellInterface())
+ ifaces << u"" ATSPI_DBUS_INTERFACE_TABLE_CELL ""_s;
+
+ return ifaces;
+}
+
+QSpiRelationArray AtSpiAdaptor::relationSet(QAccessibleInterface *interface, const QDBusConnection &connection) const
+{
+ typedef QPair<QAccessibleInterface*, QAccessible::Relation> RelationPair;
+ const QList<RelationPair> relationInterfaces = interface->relations();
+
+ QSpiRelationArray relations;
+ for (const RelationPair &pair : relationInterfaces) {
+// FIXME: this loop seems a bit strange... "related" always have one item when we check.
+//And why is it a list, when it always have one item? And it seems to assume that the QAccessible::Relation enum maps directly to AtSpi
+ QSpiObjectReferenceArray related;
+
+ QDBusObjectPath path = QDBusObjectPath(pathForInterface(pair.first));
+ related.append(QSpiObjectReference(connection, path));
+
+ if (!related.isEmpty())
+ relations.append(QSpiRelationArrayEntry(qAccessibleRelationToAtSpiRelation(pair.second), related));
+ }
+ return relations;
+}
+
+void AtSpiAdaptor::sendReply(const QDBusConnection &connection, const QDBusMessage &message, const QVariant &argument) const
+{
+ QDBusMessage reply = message.createReply(argument);
+ connection.send(reply);
+}
+
+
+QString AtSpiAdaptor::pathForObject(QObject *object) const
+{
+ Q_ASSERT(object);
+
+ if (inheritsQAction(object)) {
+ qCWarning(lcAccessibilityAtspi) << "AtSpiAdaptor::pathForObject: Creating path with QAction as object.";
+ }
+
+ QAccessibleInterface *iface = QAccessible::queryAccessibleInterface(object);
+ return pathForInterface(iface);
+}
+
+QString AtSpiAdaptor::pathForInterface(QAccessibleInterface *interface) const
+{
+ if (!interface || !interface->isValid())
+ return u"" ATSPI_DBUS_PATH_NULL ""_s;
+ if (interface->role() == QAccessible::Application)
+ return u"" QSPI_OBJECT_PATH_ROOT ""_s;
+
+ QAccessible::Id id = QAccessible::uniqueId(interface);
+ Q_ASSERT((int)id < 0);
+ return QSPI_OBJECT_PATH_PREFIX ""_L1 + QString::number(id);
+}
+
+bool AtSpiAdaptor::inheritsQAction(QObject *object)
+{
+ const QMetaObject *mo = object->metaObject();
+ while (mo) {
+ const QLatin1StringView cn(mo->className());
+ if (cn == "QAction"_L1)
+ return true;
+ mo = mo->superClass();
+ }
+ return false;
+}
+
+// Component
+static QAccessibleInterface * getWindow(QAccessibleInterface * interface)
+{
+ // find top-level window in a11y hierarchy (either has a
+ // corresponding role or is a direct child of the application object)
+ QAccessibleInterface* app = QAccessible::queryAccessibleInterface(qApp);
+ while (interface && interface->role() != QAccessible::Dialog
+ && interface->role() != QAccessible::Window && interface->parent() != app)
+ interface = interface->parent();
+
+ return interface;
+}
+
+bool AtSpiAdaptor::componentInterface(QAccessibleInterface *interface, const QString &function, const QDBusMessage &message, const QDBusConnection &connection)
+{
+ if (function == "Contains"_L1) {
+ bool ret = false;
+ int x = message.arguments().at(0).toInt();
+ int y = message.arguments().at(1).toInt();
+ uint coordType = message.arguments().at(2).toUInt();
+ if (!isValidCoordType(coordType))
+ return false;
+ ret = getExtents(interface, coordType).contains(x, y);
+ sendReply(connection, message, ret);
+ } else if (function == "GetAccessibleAtPoint"_L1) {
+ QPoint point(message.arguments().at(0).toInt(), message.arguments().at(1).toInt());
+ uint coordType = message.arguments().at(2).toUInt();
+ if (!isValidCoordType(coordType))
+ return false;
+ QPoint screenPos = translateToScreenCoordinates(interface, point, coordType);
+
+ QAccessibleInterface * childInterface(interface->childAt(screenPos.x(), screenPos.y()));
+ QAccessibleInterface * iface = nullptr;
+ while (childInterface) {
+ iface = childInterface;
+ childInterface = iface->childAt(screenPos.x(), screenPos.y());
+ }
+ if (iface) {
+ QString path = pathForInterface(iface);
+ sendReply(connection, message, QVariant::fromValue(
+ QSpiObjectReference(connection, QDBusObjectPath(path))));
+ } else {
+ sendReply(connection, message, QVariant::fromValue(
+ QSpiObjectReference(connection, QDBusObjectPath(ATSPI_DBUS_PATH_NULL))));
+ }
+ } else if (function == "GetAlpha"_L1) {
+ sendReply(connection, message, (double) 1.0);
+ } else if (function == "GetExtents"_L1) {
+ uint coordType = message.arguments().at(0).toUInt();
+ if (!isValidCoordType(coordType))
+ return false;
+ sendReply(connection, message, QVariant::fromValue(getExtents(interface, coordType)));
+ } else if (function == "GetLayer"_L1) {
+ sendReply(connection, message, QVariant::fromValue((uint)1));
+ } else if (function == "GetMDIZOrder"_L1) {
+ sendReply(connection, message, QVariant::fromValue((short)0));
+ } else if (function == "GetPosition"_L1) {
+ uint coordType = message.arguments().at(0).toUInt();
+ if (!isValidCoordType(coordType))
+ return false;
+ QRect rect = getExtents(interface, coordType);
+ QVariantList pos;
+ pos << rect.x() << rect.y();
+ connection.send(message.createReply(pos));
+ } else if (function == "GetSize"_L1) {
+ QRect rect = interface->rect();
+ QVariantList size;
+ size << rect.width() << rect.height();
+ connection.send(message.createReply(size));
+ } else if (function == "GrabFocus"_L1) {
+ QAccessibleActionInterface *actionIface = interface->actionInterface();
+ if (actionIface && actionIface->actionNames().contains(QAccessibleActionInterface::setFocusAction())) {
+ actionIface->doAction(QAccessibleActionInterface::setFocusAction());
+ sendReply(connection, message, true);
+ } else {
+ sendReply(connection, message, false);
+ }
+ } else if (function == "SetExtents"_L1) {
+// int x = message.arguments().at(0).toInt();
+// int y = message.arguments().at(1).toInt();
+// int width = message.arguments().at(2).toInt();
+// int height = message.arguments().at(3).toInt();
+// uint coordinateType = message.arguments().at(4).toUInt();
+ qCDebug(lcAccessibilityAtspi) << "SetExtents is not implemented.";
+ sendReply(connection, message, false);
+ } else if (function == "SetPosition"_L1) {
+// int x = message.arguments().at(0).toInt();
+// int y = message.arguments().at(1).toInt();
+// uint coordinateType = message.arguments().at(2).toUInt();
+ qCDebug(lcAccessibilityAtspi) << "SetPosition is not implemented.";
+ sendReply(connection, message, false);
+ } else if (function == "SetSize"_L1) {
+// int width = message.arguments().at(0).toInt();
+// int height = message.arguments().at(1).toInt();
+ qCDebug(lcAccessibilityAtspi) << "SetSize is not implemented.";
+ sendReply(connection, message, false);
+ } else {
+ qCWarning(lcAccessibilityAtspi) << "AtSpiAdaptor::componentInterface does not implement" << function << message.path();
+ return false;
+ }
+ return true;
+}
+
+QRect AtSpiAdaptor::getExtents(QAccessibleInterface *interface, uint coordType)
+{
+ return translateFromScreenCoordinates(interface, interface->rect(), coordType);
+}
+
+// Action interface
+bool AtSpiAdaptor::actionInterface(QAccessibleInterface *interface, const QString &function, const QDBusMessage &message, const QDBusConnection &connection)
+{
+ if (function == "GetNActions"_L1) {
+ int count = QAccessibleBridgeUtils::effectiveActionNames(interface).size();
+ sendReply(connection, message, QVariant::fromValue(QDBusVariant(QVariant::fromValue(count))));
+ } else if (function == "DoAction"_L1) {
+ int index = message.arguments().at(0).toInt();
+ const QStringList actionNames = QAccessibleBridgeUtils::effectiveActionNames(interface);
+ if (index < 0 || index >= actionNames.size())
+ return false;
+ const QString actionName = actionNames.at(index);
+ bool success = QAccessibleBridgeUtils::performEffectiveAction(interface, actionName);
+ sendReply(connection, message, success);
+ } else if (function == "GetActions"_L1) {
+ sendReply(connection, message, QVariant::fromValue(getActions(interface)));
+ } else if (function == "GetName"_L1) {
+ int index = message.arguments().at(0).toInt();
+ const QStringList actionNames = QAccessibleBridgeUtils::effectiveActionNames(interface);
+ if (index < 0 || index >= actionNames.size())
+ return false;
+ sendReply(connection, message, actionNames.at(index));
+ } else if (function == "GetDescription"_L1) {
+ int index = message.arguments().at(0).toInt();
+ const QStringList actionNames = QAccessibleBridgeUtils::effectiveActionNames(interface);
+ if (index < 0 || index >= actionNames.size())
+ return false;
+ QString description;
+ if (QAccessibleActionInterface *actionIface = interface->actionInterface())
+ description = actionIface->localizedActionDescription(actionNames.at(index));
+ else
+ description = qAccessibleLocalizedActionDescription(actionNames.at(index));
+ sendReply(connection, message, description);
+ } else if (function == "GetKeyBinding"_L1) {
+ int index = message.arguments().at(0).toInt();
+ const QStringList actionNames = QAccessibleBridgeUtils::effectiveActionNames(interface);
+ if (index < 0 || index >= actionNames.size())
+ return false;
+ QStringList keyBindings;
+ if (QAccessibleActionInterface *actionIface = interface->actionInterface())
+ keyBindings = actionIface->keyBindingsForAction(actionNames.at(index));
+ if (keyBindings.isEmpty()) {
+ QString acc = interface->text(QAccessible::Accelerator);
+ if (!acc.isEmpty())
+ keyBindings.append(acc);
+ }
+ if (keyBindings.size() > 0)
+ sendReply(connection, message, keyBindings.join(u';'));
+ else
+ sendReply(connection, message, QString());
+ } else {
+ qCWarning(lcAccessibilityAtspi) << "AtSpiAdaptor::actionInterface does not implement" << function << message.path();
+ return false;
+ }
+ return true;
+}
+
+QSpiActionArray AtSpiAdaptor::getActions(QAccessibleInterface *interface) const
+{
+ QAccessibleActionInterface *actionInterface = interface->actionInterface();
+ QSpiActionArray actions;
+ const QStringList actionNames = QAccessibleBridgeUtils::effectiveActionNames(interface);
+ actions.reserve(actionNames.size());
+ for (const QString &actionName : actionNames) {
+ QSpiAction action;
+
+ action.name = actionName;
+ if (actionInterface) {
+ action.description = actionInterface->localizedActionDescription(actionName);
+ const QStringList keyBindings = actionInterface->keyBindingsForAction(actionName);
+ if (!keyBindings.isEmpty())
+ action.keyBinding = keyBindings.front();
+ } else {
+ action.description = qAccessibleLocalizedActionDescription(actionName);
+ }
+
+ actions.append(std::move(action));
+ }
+ return actions;
+}
+
+// Text interface
+bool AtSpiAdaptor::textInterface(QAccessibleInterface *interface, const QString &function, const QDBusMessage &message, const QDBusConnection &connection)
+{
+ if (!interface->textInterface())
+ return false;
+
+ // properties
+ if (function == "GetCaretOffset"_L1) {
+ sendReply(connection, message, QVariant::fromValue(QDBusVariant(QVariant::fromValue(interface->textInterface()->cursorPosition()))));
+ } else if (function == "GetCharacterCount"_L1) {
+ sendReply(connection, message, QVariant::fromValue(QDBusVariant(QVariant::fromValue(interface->textInterface()->characterCount()))));
+
+ // functions
+ } else if (function == "AddSelection"_L1) {
+ int startOffset = message.arguments().at(0).toInt();
+ int endOffset = message.arguments().at(1).toInt();
+ int lastSelection = interface->textInterface()->selectionCount();
+ interface->textInterface()->setSelection(lastSelection, startOffset, endOffset);
+ sendReply(connection, message, (interface->textInterface()->selectionCount() > lastSelection));
+ } else if (function == "GetAttributeRun"_L1) {
+ int offset = message.arguments().at(0).toInt();
+ bool includeDefaults = message.arguments().at(1).toBool();
+ Q_UNUSED(includeDefaults);
+ connection.send(message.createReply(getAttributes(interface, offset, includeDefaults)));
+ } else if (function == "GetAttributeValue"_L1) {
+ int offset = message.arguments().at(0).toInt();
+ QString attributeName = message.arguments().at(1).toString();
+ connection.send(message.createReply(QVariant(getAttributeValue(interface, offset, attributeName))));
+ } else if (function == "GetAttributes"_L1) {
+ int offset = message.arguments().at(0).toInt();
+ connection.send(message.createReply(getAttributes(interface, offset, true)));
+ } else if (function == "GetBoundedRanges"_L1) {
+ int x = message.arguments().at(0).toInt();
+ int y = message.arguments().at(1).toInt();
+ int width = message.arguments().at(2).toInt();
+ int height = message.arguments().at(3).toInt();
+ uint coordType = message.arguments().at(4).toUInt();
+ uint xClipType = message.arguments().at(5).toUInt();
+ uint yClipType = message.arguments().at(6).toUInt();
+ Q_UNUSED(x);
+ Q_UNUSED(y);
+ Q_UNUSED(width);
+ Q_UNUSED(height);
+ Q_UNUSED(coordType);
+ Q_UNUSED(xClipType);
+ Q_UNUSED(yClipType);
+ qCDebug(lcAccessibilityAtspi) << "Not implemented: QSpiAdaptor::GetBoundedRanges";
+ sendReply(connection, message, QVariant::fromValue(QSpiTextRangeList()));
+ } else if (function == "GetCharacterAtOffset"_L1) {
+ int offset = message.arguments().at(0).toInt();
+ int start;
+ int end;
+ const QString charString = interface->textInterface()
+ ->textAtOffset(offset, QAccessible::CharBoundary, &start, &end);
+ int codePoint = 0;
+ QStringIterator stringIt(charString);
+ if (stringIt.hasNext())
+ codePoint = static_cast<int>(stringIt.peekNext());
+ sendReply(connection, message, codePoint);
+ } else if (function == "GetCharacterExtents"_L1) {
+ int offset = message.arguments().at(0).toInt();
+ int coordType = message.arguments().at(1).toUInt();
+ connection.send(message.createReply(getCharacterExtents(interface, offset, coordType)));
+ } else if (function == "GetDefaultAttributeSet"_L1 || function == "GetDefaultAttributes"_L1) {
+ // GetDefaultAttributes is deprecated in favour of GetDefaultAttributeSet.
+ // Empty set seems reasonable. There is no default attribute set.
+ sendReply(connection, message, QVariant::fromValue(QSpiAttributeSet()));
+ } else if (function == "GetNSelections"_L1) {
+ sendReply(connection, message, interface->textInterface()->selectionCount());
+ } else if (function == "GetOffsetAtPoint"_L1) {
+ qCDebug(lcAccessibilityAtspi) << message.signature();
+ Q_ASSERT(!message.signature().isEmpty());
+ QPoint point(message.arguments().at(0).toInt(), message.arguments().at(1).toInt());
+ uint coordType = message.arguments().at(2).toUInt();
+ if (!isValidCoordType(coordType))
+ return false;
+ QPoint screenPos = translateToScreenCoordinates(interface, point, coordType);
+ int offset = interface->textInterface()->offsetAtPoint(screenPos);
+ sendReply(connection, message, offset);
+ } else if (function == "GetRangeExtents"_L1) {
+ int startOffset = message.arguments().at(0).toInt();
+ int endOffset = message.arguments().at(1).toInt();
+ uint coordType = message.arguments().at(2).toUInt();
+ connection.send(message.createReply(getRangeExtents(interface, startOffset, endOffset, coordType)));
+ } else if (function == "GetSelection"_L1) {
+ int selectionNum = message.arguments().at(0).toInt();
+ int start, end;
+ interface->textInterface()->selection(selectionNum, &start, &end);
+ if (start < 0)
+ start = end = interface->textInterface()->cursorPosition();
+ QVariantList sel;
+ sel << start << end;
+ connection.send(message.createReply(sel));
+ } else if (function == "GetStringAtOffset"_L1) {
+ int offset = message.arguments().at(0).toInt();
+ uint granularity = message.arguments().at(1).toUInt();
+ if (!isValidAtspiTextGranularity(granularity))
+ return false;
+ int startOffset, endOffset;
+ QString text = interface->textInterface()->textAtOffset(offset, qAccessibleBoundaryTypeFromAtspiTextGranularity(granularity), &startOffset, &endOffset);
+ QVariantList ret;
+ ret << text << startOffset << endOffset;
+ connection.send(message.createReply(ret));
+ } else if (function == "GetText"_L1) {
+ int startOffset = message.arguments().at(0).toInt();
+ int endOffset = message.arguments().at(1).toInt();
+ if (endOffset == -1) // AT-SPI uses -1 to signal all characters
+ endOffset = interface->textInterface()->characterCount();
+ sendReply(connection, message, interface->textInterface()->text(startOffset, endOffset));
+ } else if (function == "GetTextAfterOffset"_L1) {
+ int offset = message.arguments().at(0).toInt();
+ int type = message.arguments().at(1).toUInt();
+ int startOffset, endOffset;
+ QString text = interface->textInterface()->textAfterOffset(offset, qAccessibleBoundaryTypeFromAtspiBoundaryType(type), &startOffset, &endOffset);
+ QVariantList ret;
+ ret << text << startOffset << endOffset;
+ connection.send(message.createReply(ret));
+ } else if (function == "GetTextAtOffset"_L1) {
+ int offset = message.arguments().at(0).toInt();
+ int type = message.arguments().at(1).toUInt();
+ int startOffset, endOffset;
+ QString text = interface->textInterface()->textAtOffset(offset, qAccessibleBoundaryTypeFromAtspiBoundaryType(type), &startOffset, &endOffset);
+ QVariantList ret;
+ ret << text << startOffset << endOffset;
+ connection.send(message.createReply(ret));
+ } else if (function == "GetTextBeforeOffset"_L1) {
+ int offset = message.arguments().at(0).toInt();
+ int type = message.arguments().at(1).toUInt();
+ int startOffset, endOffset;
+ QString text = interface->textInterface()->textBeforeOffset(offset, qAccessibleBoundaryTypeFromAtspiBoundaryType(type), &startOffset, &endOffset);
+ QVariantList ret;
+ ret << text << startOffset << endOffset;
+ connection.send(message.createReply(ret));
+ } else if (function == "RemoveSelection"_L1) {
+ int selectionNum = message.arguments().at(0).toInt();
+ interface->textInterface()->removeSelection(selectionNum);
+ sendReply(connection, message, true);
+ } else if (function == "SetCaretOffset"_L1) {
+ int offset = message.arguments().at(0).toInt();
+ interface->textInterface()->setCursorPosition(offset);
+ sendReply(connection, message, true);
+ } else if (function == "ScrollSubstringTo"_L1) {
+ int startOffset = message.arguments().at(0).toInt();
+ int endOffset = message.arguments().at(1).toInt();
+ // ignore third parameter (scroll type), since QAccessibleTextInterface::scrollToSubstring doesn't have that
+ qCInfo(lcAccessibilityAtspi) << "AtSpiAdaptor::ScrollSubstringTo doesn'take take scroll type into account.";
+ interface->textInterface()->scrollToSubstring(startOffset, endOffset);
+ sendReply(connection, message, true);
+ } else if (function == "SetSelection"_L1) {
+ int selectionNum = message.arguments().at(0).toInt();
+ int startOffset = message.arguments().at(1).toInt();
+ int endOffset = message.arguments().at(2).toInt();
+ interface->textInterface()->setSelection(selectionNum, startOffset, endOffset);
+ sendReply(connection, message, true);
+ } else {
+ qCWarning(lcAccessibilityAtspi) << "AtSpiAdaptor::textInterface does not implement" << function << message.path();
+ return false;
+ }
+ return true;
+}
+
+QAccessible::TextBoundaryType AtSpiAdaptor::qAccessibleBoundaryTypeFromAtspiBoundaryType(int atspiTextBoundaryType)
+{
+ switch (atspiTextBoundaryType) {
+ case ATSPI_TEXT_BOUNDARY_CHAR:
+ return QAccessible::CharBoundary;
+ case ATSPI_TEXT_BOUNDARY_WORD_START:
+ case ATSPI_TEXT_BOUNDARY_WORD_END:
+ return QAccessible::WordBoundary;
+ case ATSPI_TEXT_BOUNDARY_SENTENCE_START:
+ case ATSPI_TEXT_BOUNDARY_SENTENCE_END:
+ return QAccessible::SentenceBoundary;
+ case ATSPI_TEXT_BOUNDARY_LINE_START:
+ case ATSPI_TEXT_BOUNDARY_LINE_END:
+ return QAccessible::LineBoundary;
+ }
+ Q_ASSERT_X(0, "", "Requested invalid boundary type.");
+ return QAccessible::CharBoundary;
+}
+
+bool AtSpiAdaptor::isValidAtspiTextGranularity(uint atspiTextGranularity)
+{
+ if (atspiTextGranularity == ATSPI_TEXT_GRANULARITY_CHAR
+ || atspiTextGranularity == ATSPI_TEXT_GRANULARITY_WORD
+ || atspiTextGranularity == ATSPI_TEXT_GRANULARITY_SENTENCE
+ || atspiTextGranularity == ATSPI_TEXT_GRANULARITY_LINE
+ || atspiTextGranularity == ATSPI_TEXT_GRANULARITY_PARAGRAPH)
+ return true;
+
+ qCWarning(lcAccessibilityAtspi) << "Unknown value" << atspiTextGranularity << "for AT-SPI text granularity type";
+ return false;
+}
+
+QAccessible::TextBoundaryType AtSpiAdaptor::qAccessibleBoundaryTypeFromAtspiTextGranularity(uint atspiTextGranularity)
+{
+ Q_ASSERT(isValidAtspiTextGranularity(atspiTextGranularity));
+
+ switch (atspiTextGranularity) {
+ case ATSPI_TEXT_GRANULARITY_CHAR:
+ return QAccessible::CharBoundary;
+ case ATSPI_TEXT_GRANULARITY_WORD:
+ return QAccessible::WordBoundary;
+ case ATSPI_TEXT_GRANULARITY_SENTENCE:
+ return QAccessible::SentenceBoundary;
+ case ATSPI_TEXT_GRANULARITY_LINE:
+ return QAccessible::LineBoundary;
+ case ATSPI_TEXT_GRANULARITY_PARAGRAPH:
+ return QAccessible::ParagraphBoundary;
+ }
+ return QAccessible::CharBoundary;
+}
+
+namespace
+{
+ struct AtSpiAttribute {
+ QString name;
+ QString value;
+ AtSpiAttribute(const QString &aName, const QString &aValue) : name(aName), value(aValue) {}
+ bool isNull() const { return name.isNull() || value.isNull(); }
+ };
+
+ QString atspiColor(const QString &ia2Color)
+ {
+ // "rgb(%u,%u,%u)" -> "%u,%u,%u"
+ return ia2Color.mid(4, ia2Color.size() - (4+1)).replace(u"\\,"_s, u","_s);
+ }
+
+ QString atspiSize(const QString &ia2Size)
+ {
+ // "%fpt" -> "%f"
+ return ia2Size.left(ia2Size.size() - 2);
+ }
+
+ AtSpiAttribute atspiTextAttribute(const QString &ia2Name, const QString &ia2Value)
+ {
+ QString name = ia2Name;
+ QString value = ia2Value;
+
+ // IAccessible2: https://wiki.linuxfoundation.org/accessibility/iaccessible2/textattributes
+ // ATK attribute names: https://gitlab.gnome.org/GNOME/orca/-/blob/master/src/orca/text_attribute_names.py
+ // ATK attribute values: https://gnome.pages.gitlab.gnome.org/atk/AtkText.html#AtkTextAttribute
+
+ // https://bugzilla.gnome.org/show_bug.cgi?id=744553 "ATK docs provide no guidance for allowed values of some text attributes"
+ // specifically for "weight", "invalid", "language" and value range for colors
+
+ if (ia2Name == "background-color"_L1) {
+ name = QStringLiteral("bg-color");
+ value = atspiColor(value);
+ } else if (ia2Name == "font-family"_L1) {
+ name = QStringLiteral("family-name");
+ } else if (ia2Name == "color"_L1) {
+ name = QStringLiteral("fg-color");
+ value = atspiColor(value);
+ } else if (ia2Name == "text-align"_L1) {
+ name = QStringLiteral("justification");
+ if (value == "justify"_L1) {
+ value = QStringLiteral("fill");
+ } else if (value != "left"_L1 && value != "right"_L1 && value != "center"_L1) {
+ qCDebug(lcAccessibilityAtspi) << "Unknown text-align attribute value \""
+ << value << "\" cannot be translated to AT-SPI.";
+ value = QString();
+ }
+ } else if (ia2Name == "font-size"_L1) {
+ name = QStringLiteral("size");
+ value = atspiSize(value);
+ } else if (ia2Name == "font-style"_L1) {
+ name = QStringLiteral("style");
+ if (value != "normal"_L1 && value != "italic"_L1 && value != "oblique"_L1) {
+ qCDebug(lcAccessibilityAtspi) << "Unknown font-style attribute value \"" << value
+ << "\" cannot be translated to AT-SPI.";
+ value = QString();
+ }
+ } else if (ia2Name == "text-underline-type"_L1) {
+ name = QStringLiteral("underline");
+ if (value != "none"_L1 && value != "single"_L1 && value != "double"_L1) {
+ qCDebug(lcAccessibilityAtspi) << "Unknown text-underline-type attribute value \""
+ << value << "\" cannot be translated to AT-SPI.";
+ value = QString();
+ }
+ } else if (ia2Name == "font-weight"_L1) {
+ name = QStringLiteral("weight");
+ if (value == "normal"_L1)
+ // Orca seems to accept all IAccessible2 values except for "normal"
+ // (on which it produces traceback and fails to read any following text attributes),
+ // but that is the default value, so omit it anyway
+ value = QString();
+ } else if (((ia2Name == "text-line-through-style"_L1 || ia2Name == "text-line-through-type"_L1) && (ia2Value != "none"_L1))
+ || (ia2Name == "text-line-through-text"_L1 && !ia2Value.isEmpty())) {
+ // if any of the above is set, set "strikethrough" to true, but don't explicitly set
+ // to false otherwise, since any of the others might still be set to indicate strikethrough
+ // and no strikethrough is assumed anyway when nothing is explicitly set
+ name = QStringLiteral("strikethrough");
+ value = QStringLiteral("true");
+ } else if (ia2Name == "text-position"_L1) {
+ name = QStringLiteral("vertical-align");
+ if (value != "baseline"_L1 && value != "super"_L1 && value != "sub"_L1) {
+ qCDebug(lcAccessibilityAtspi) << "Unknown text-position attribute value \"" << value
+ << "\" cannot be translated to AT-SPI.";
+ value = QString();
+ }
+ } else if (ia2Name == "writing-mode"_L1) {
+ name = QStringLiteral("direction");
+ if (value == "lr"_L1)
+ value = QStringLiteral("ltr");
+ else if (value == "rl"_L1)
+ value = QStringLiteral("rtl");
+ else if (value == "tb"_L1) {
+ // IAccessible2 docs refer to XSL, which specifies "tb" is shorthand for "tb-rl"; so at least give a hint about the horizontal direction (ATK does not support vertical direction in this attribute (yet))
+ value = QStringLiteral("rtl");
+ qCDebug(lcAccessibilityAtspi) << "writing-mode attribute value \"tb\" translated only w.r.t. horizontal direction; vertical direction ignored";
+ } else {
+ qCDebug(lcAccessibilityAtspi) << "Unknown writing-mode attribute value \"" << value
+ << "\" cannot be translated to AT-SPI.";
+ value = QString();
+ }
+ } else if (ia2Name == "language"_L1) {
+ // OK - ATK has no docs on the format of the value, IAccessible2 has reasonable format - leave it at that now
+ } else if (ia2Name == "invalid"_L1) {
+ // OK - ATK docs are vague but suggest they support the same range of values as IAccessible2
+ } else {
+ // attribute we know nothing about
+ name = QString();
+ value = QString();
+ }
+ return AtSpiAttribute(name, value);
+ }
+}
+
+// FIXME all attribute methods below should share code
+QVariantList AtSpiAdaptor::getAttributes(QAccessibleInterface *interface, int offset, bool includeDefaults) const
+{
+ Q_UNUSED(includeDefaults);
+
+ QSpiAttributeSet set;
+ int startOffset;
+ int endOffset;
+
+ QString joined = interface->textInterface()->attributes(offset, &startOffset, &endOffset);
+ const QStringList attributes = joined.split(u';', Qt::SkipEmptyParts, Qt::CaseSensitive);
+ for (const QString &attr : attributes) {
+ QStringList items = attr.split(u':', Qt::SkipEmptyParts, Qt::CaseSensitive);
+ if (items.count() == 2)
+ {
+ AtSpiAttribute attribute = atspiTextAttribute(items[0], items[1]);
+ if (!attribute.isNull())
+ set[attribute.name] = attribute.value;
+ }
+ }
+
+ QVariantList list;
+ list << QVariant::fromValue(set) << startOffset << endOffset;
+
+ return list;
+}
+
+QString AtSpiAdaptor::getAttributeValue(QAccessibleInterface *interface, int offset, const QString &attributeName) const
+{
+ QString joined;
+ QSpiAttributeSet map;
+ int startOffset;
+ int endOffset;
+
+ joined = interface->textInterface()->attributes(offset, &startOffset, &endOffset);
+ const QStringList attributes = joined.split (u';', Qt::SkipEmptyParts, Qt::CaseSensitive);
+ for (const QString& attr : attributes) {
+ QStringList items;
+ items = attr.split(u':', Qt::SkipEmptyParts, Qt::CaseSensitive);
+ AtSpiAttribute attribute = atspiTextAttribute(items[0], items[1]);
+ if (!attribute.isNull())
+ map[attribute.name] = attribute.value;
+ }
+ return map[attributeName];
+}
+
+QList<QVariant> AtSpiAdaptor::getCharacterExtents(QAccessibleInterface *interface, int offset, uint coordType) const
+{
+ QRect rect = interface->textInterface()->characterRect(offset);
+ rect = translateFromScreenCoordinates(interface, rect, coordType);
+ return QList<QVariant>() << rect.x() << rect.y() << rect.width() << rect.height();
+}
+
+QList<QVariant> AtSpiAdaptor::getRangeExtents(QAccessibleInterface *interface,
+ int startOffset, int endOffset, uint coordType) const
+{
+ if (endOffset == -1)
+ endOffset = interface->textInterface()->characterCount();
+
+ QAccessibleTextInterface *textInterface = interface->textInterface();
+ if (endOffset <= startOffset || !textInterface)
+ return QList<QVariant>() << -1 << -1 << 0 << 0;
+
+ QRect rect = textInterface->characterRect(startOffset);
+ for (int i=startOffset + 1; i <= endOffset; i++)
+ rect = rect | textInterface->characterRect(i);
+
+ rect = translateFromScreenCoordinates(interface, rect, coordType);
+ return QList<QVariant>() << rect.x() << rect.y() << rect.width() << rect.height();
+}
+
+bool AtSpiAdaptor::isValidCoordType(uint coordType)
+{
+ if (coordType == ATSPI_COORD_TYPE_SCREEN || coordType == ATSPI_COORD_TYPE_WINDOW || coordType == ATSPI_COORD_TYPE_PARENT)
+ return true;
+
+ qCWarning(lcAccessibilityAtspi) << "Unknown value" << coordType << "for AT-SPI coord type";
+ return false;
+}
+
+QRect AtSpiAdaptor::translateFromScreenCoordinates(QAccessibleInterface *interface, const QRect &screenRect, uint targetCoordType)
+{
+ Q_ASSERT(isValidCoordType(targetCoordType));
+
+ QAccessibleInterface *upper = nullptr;
+ if (targetCoordType == ATSPI_COORD_TYPE_WINDOW)
+ upper = getWindow(interface);
+ else if (targetCoordType == ATSPI_COORD_TYPE_PARENT)
+ upper = interface->parent();
+
+ QRect rect = screenRect;
+ if (upper)
+ rect.translate(-upper->rect().x(), -upper->rect().y());
+
+ return rect;
+}
+
+QPoint AtSpiAdaptor::translateToScreenCoordinates(QAccessibleInterface *interface, const QPoint &pos, uint fromCoordType)
+{
+ Q_ASSERT(isValidCoordType(fromCoordType));
+
+ QAccessibleInterface *upper = nullptr;
+ if (fromCoordType == ATSPI_COORD_TYPE_WINDOW)
+ upper = getWindow(interface);
+ else if (fromCoordType == ATSPI_COORD_TYPE_PARENT)
+ upper = interface->parent();
+
+ QPoint screenPos = pos;
+ if (upper)
+ screenPos += upper->rect().topLeft();
+
+ return screenPos;
+}
+
+// Editable Text interface
+static QString textForRange(QAccessibleInterface *accessible, int startOffset, int endOffset)
+{
+ if (QAccessibleTextInterface *textIface = accessible->textInterface()) {
+ if (endOffset == -1)
+ endOffset = textIface->characterCount();
+ return textIface->text(startOffset, endOffset);
+ }
+ QString txt = accessible->text(QAccessible::Value);
+ if (endOffset == -1)
+ endOffset = txt.size();
+ return txt.mid(startOffset, endOffset - startOffset);
+}
+
+static void replaceTextFallback(QAccessibleInterface *accessible, long startOffset, long endOffset, const QString &txt)
+{
+ QString t = textForRange(accessible, 0, -1);
+ if (endOffset == -1)
+ endOffset = t.size();
+ if (endOffset - startOffset == 0)
+ t.insert(startOffset, txt);
+ else
+ t.replace(startOffset, endOffset - startOffset, txt);
+ accessible->setText(QAccessible::Value, t);
+}
+
+bool AtSpiAdaptor::editableTextInterface(QAccessibleInterface *interface, const QString &function, const QDBusMessage &message, const QDBusConnection &connection)
+{
+ if (function == "CopyText"_L1) {
+#ifndef QT_NO_CLIPBOARD
+ int startOffset = message.arguments().at(0).toInt();
+ int endOffset = message.arguments().at(1).toInt();
+ const QString t = textForRange(interface, startOffset, endOffset);
+ QGuiApplication::clipboard()->setText(t);
+#endif
+ connection.send(message.createReply(true));
+ } else if (function == "CutText"_L1) {
+#ifndef QT_NO_CLIPBOARD
+ int startOffset = message.arguments().at(0).toInt();
+ int endOffset = message.arguments().at(1).toInt();
+ const QString t = textForRange(interface, startOffset, endOffset);
+ if (QAccessibleEditableTextInterface *editableTextIface = interface->editableTextInterface())
+ editableTextIface->deleteText(startOffset, endOffset);
+ else
+ replaceTextFallback(interface, startOffset, endOffset, QString());
+ QGuiApplication::clipboard()->setText(t);
+#endif
+ connection.send(message.createReply(true));
+ } else if (function == "DeleteText"_L1) {
+ int startOffset = message.arguments().at(0).toInt();
+ int endOffset = message.arguments().at(1).toInt();
+ if (QAccessibleEditableTextInterface *editableTextIface = interface->editableTextInterface())
+ editableTextIface->deleteText(startOffset, endOffset);
+ else
+ replaceTextFallback(interface, startOffset, endOffset, QString());
+ connection.send(message.createReply(true));
+ } else if (function == "InsertText"_L1) {
+ int position = message.arguments().at(0).toInt();
+ QString text = message.arguments().at(1).toString();
+ int length = message.arguments().at(2).toInt();
+ text.resize(length);
+ if (QAccessibleEditableTextInterface *editableTextIface = interface->editableTextInterface())
+ editableTextIface->insertText(position, text);
+ else
+ replaceTextFallback(interface, position, position, text);
+ connection.send(message.createReply(true));
+ } else if (function == "PasteText"_L1) {
+#ifndef QT_NO_CLIPBOARD
+ int position = message.arguments().at(0).toInt();
+ const QString txt = QGuiApplication::clipboard()->text();
+ if (QAccessibleEditableTextInterface *editableTextIface = interface->editableTextInterface())
+ editableTextIface->insertText(position, txt);
+ else
+ replaceTextFallback(interface, position, position, txt);
+#endif
+ connection.send(message.createReply(true));
+ } else if (function == "SetTextContents"_L1) {
+ QString newContents = message.arguments().at(0).toString();
+ if (QAccessibleEditableTextInterface *editableTextIface = interface->editableTextInterface())
+ editableTextIface->replaceText(0, interface->textInterface()->characterCount(), newContents);
+ else
+ replaceTextFallback(interface, 0, -1, newContents);
+ connection.send(message.createReply(true));
+ } else if (function.isEmpty()) {
+ connection.send(message.createReply());
+ } else {
+ qCWarning(lcAccessibilityAtspi) << "AtSpiAdaptor::editableTextInterface does not implement" << function << message.path();
+ return false;
+ }
+ return true;
+}
+
+// Value interface
+bool AtSpiAdaptor::valueInterface(QAccessibleInterface *interface, const QString &function, const QDBusMessage &message, const QDBusConnection &connection)
+{
+ QAccessibleValueInterface *valueIface = interface->valueInterface();
+ if (!valueIface)
+ return false;
+
+ if (function == "SetCurrentValue"_L1) {
+ QDBusVariant v = qvariant_cast<QDBusVariant>(message.arguments().at(2));
+ double value = v.variant().toDouble();
+ //Temporary fix
+ //See https://bugzilla.gnome.org/show_bug.cgi?id=652596
+ valueIface->setCurrentValue(value);
+ connection.send(message.createReply());
+ } else {
+ QVariant value;
+ if (function == "GetCurrentValue"_L1)
+ value = valueIface->currentValue();
+ else if (function == "GetMaximumValue"_L1)
+ value = valueIface->maximumValue();
+ else if (function == "GetMinimumIncrement"_L1)
+ value = valueIface->minimumStepSize();
+ else if (function == "GetMinimumValue"_L1)
+ value = valueIface->minimumValue();
+ else {
+ qCWarning(lcAccessibilityAtspi) << "AtSpiAdaptor::valueInterface does not implement" << function << message.path();
+ return false;
+ }
+ if (!value.canConvert<double>()) {
+ qCWarning(lcAccessibilityAtspi) << "AtSpiAdaptor::valueInterface: Could not convert to double:" << function;
+ }
+
+ // explicitly convert to dbus-variant containing one double since atspi expects that
+ // everything else might fail to convert back on the other end
+ connection.send(message.createReply(
+ QVariant::fromValue(QDBusVariant(QVariant::fromValue(value.toDouble())))));
+ }
+ return true;
+}
+
+// Selection interface
+bool AtSpiAdaptor::selectionInterface(QAccessibleInterface *interface, const QString &function, const QDBusMessage &message, const QDBusConnection &connection)
+{
+ QAccessibleSelectionInterface* selectionInterface = interface->selectionInterface();
+ if (!selectionInterface) {
+ qCWarning(lcAccessibilityAtspi) << "Could not find selection interface for: " << message.path() << interface;
+ return false;
+ }
+
+ if (function == "ClearSelection"_L1 ) {
+ connection.send(message.createReply(QVariant::fromValue((selectionInterface->clear()))));
+ } else if (function == "DeselectChild"_L1 ) {
+ int childIndex = message.arguments().at(0).toInt();
+ bool ret = false;
+ QAccessibleInterface *child = interface->child(childIndex);
+ if (child)
+ ret = selectionInterface->unselect(child);
+ connection.send(message.createReply(QVariant::fromValue(ret)));
+ } else if (function == "DeselectSelectedChild"_L1 ) {
+ int selectionIndex = message.arguments().at(0).toInt();
+ bool ret = false;
+ QAccessibleInterface *selectedChild = selectionInterface->selectedItem(selectionIndex);
+ if (selectedChild)
+ ret = selectionInterface->unselect(selectedChild);
+ connection.send(message.createReply(QVariant::fromValue(ret)));
+ } else if (function == "GetNSelectedChildren"_L1) {
+ connection.send(message.createReply(QVariant::fromValue(QDBusVariant(
+ QVariant::fromValue(selectionInterface->selectedItemCount())))));
+ } else if (function == "GetSelectedChild"_L1) {
+ int selectionIndex = message.arguments().at(0).toInt();
+ QSpiObjectReference ref(connection, QDBusObjectPath(pathForInterface(selectionInterface->selectedItem(selectionIndex))));
+ connection.send(message.createReply(QVariant::fromValue(ref)));
+ } else if (function == "IsChildSelected"_L1 ) {
+ int childIndex = message.arguments().at(0).toInt();
+ bool ret = false;
+ QAccessibleInterface *child = interface->child(childIndex);
+ if (child)
+ ret = selectionInterface->isSelected(child);
+ connection.send(message.createReply(QVariant::fromValue(ret)));
+ } else if (function == "SelectAll"_L1 ) {
+ connection.send(message.createReply(QVariant::fromValue(selectionInterface->selectAll())));
+ } else if (function == "SelectChild"_L1 ) {
+ int childIndex = message.arguments().at(0).toInt();
+ bool ret = false;
+ QAccessibleInterface *child = interface->child(childIndex);
+ if (child)
+ ret = selectionInterface->select(child);
+ connection.send(message.createReply(QVariant::fromValue(ret)));
+ } else {
+ qCWarning(lcAccessibilityAtspi) << "AtSpiAdaptor::selectionInterface does not implement " << function << message.path();
+ return false;
+ }
+
+ return true;
+}
+
+
+// Table interface
+bool AtSpiAdaptor::tableInterface(QAccessibleInterface *interface, const QString &function, const QDBusMessage &message, const QDBusConnection &connection)
+{
+ if (!(interface->tableInterface() || interface->tableCellInterface())) {
+ qCWarning(lcAccessibilityAtspi) << "Qt AtSpiAdaptor: Could not find table interface for:" << message.path() << interface;
+ return false;
+ }
+
+ if (function == "GetCaption"_L1) {
+ QAccessibleInterface * captionInterface= interface->tableInterface()->caption();
+ if (captionInterface) {
+ QSpiObjectReference ref = QSpiObjectReference(connection, QDBusObjectPath(pathForInterface(captionInterface)));
+ sendReply(connection, message, QVariant::fromValue(QDBusVariant(QVariant::fromValue(ref))));
+ } else {
+ sendReply(connection, message, QVariant::fromValue(QDBusVariant(QVariant::fromValue(
+ QSpiObjectReference(connection, QDBusObjectPath(ATSPI_DBUS_PATH_NULL))))));
+ }
+ } else if (function == "GetNColumns"_L1) {
+ connection.send(message.createReply(QVariant::fromValue(QDBusVariant(
+ QVariant::fromValue(interface->tableInterface()->columnCount())))));
+ } else if (function == "GetNRows"_L1) {
+ connection.send(message.createReply(QVariant::fromValue(QDBusVariant(
+ QVariant::fromValue(interface->tableInterface()->rowCount())))));
+ } else if (function == "GetNSelectedColumns"_L1) {
+ connection.send(message.createReply(QVariant::fromValue(QDBusVariant(
+ QVariant::fromValue(interface->tableInterface()->selectedColumnCount())))));
+ } else if (function == "GetNSelectedRows"_L1) {
+ connection.send(message.createReply(QVariant::fromValue(QDBusVariant(
+ QVariant::fromValue(interface->tableInterface()->selectedRowCount())))));
+ } else if (function == "GetSummary"_L1) {
+ QAccessibleInterface *summary = interface->tableInterface() ? interface->tableInterface()->summary() : nullptr;
+ QSpiObjectReference ref(connection, QDBusObjectPath(pathForInterface(summary)));
+ connection.send(message.createReply(QVariant::fromValue(QDBusVariant(QVariant::fromValue(ref)))));
+ } else if (function == "GetAccessibleAt"_L1) {
+ int row = message.arguments().at(0).toInt();
+ int column = message.arguments().at(1).toInt();
+ if ((row < 0) ||
+ (column < 0) ||
+ (row >= interface->tableInterface()->rowCount()) ||
+ (column >= interface->tableInterface()->columnCount())) {
+ qCWarning(lcAccessibilityAtspi) << "Invalid index for tableInterface GetAccessibleAt (" << row << "," << column << ')';
+ return false;
+ }
+
+ QSpiObjectReference ref;
+ QAccessibleInterface * cell(interface->tableInterface()->cellAt(row, column));
+ if (cell) {
+ ref = QSpiObjectReference(connection, QDBusObjectPath(pathForInterface(cell)));
+ } else {
+ qCWarning(lcAccessibilityAtspi) << "No cell interface returned for" << interface->object() << row << column;
+ ref = QSpiObjectReference();
+ }
+ connection.send(message.createReply(QVariant::fromValue(ref)));
+
+ } else if (function == "GetIndexAt"_L1) {
+ int row = message.arguments().at(0).toInt();
+ int column = message.arguments().at(1).toInt();
+ QAccessibleInterface *cell = interface->tableInterface()->cellAt(row, column);
+ if (!cell) {
+ qCWarning(lcAccessibilityAtspi) << "AtSpiAdaptor::GetIndexAt(" << row << ',' << column << ") did not find a cell." << interface;
+ return false;
+ }
+ int index = interface->indexOfChild(cell);
+ qCDebug(lcAccessibilityAtspi) << "QSpiAdaptor::GetIndexAt row:" << row << " col:" << column << " logical index:" << index;
+ Q_ASSERT(index > 0);
+ connection.send(message.createReply(index));
+ } else if ((function == "GetColumnAtIndex"_L1) || (function == "GetRowAtIndex"_L1)) {
+ int index = message.arguments().at(0).toInt();
+ int ret = -1;
+ if (index >= 0) {
+ QAccessibleInterface * cell = interface->child(index);
+ if (cell) {
+ if (function == "GetColumnAtIndex"_L1) {
+ if (cell->role() == QAccessible::ColumnHeader) {
+ ret = index;
+ } else if (cell->role() == QAccessible::RowHeader) {
+ ret = -1;
+ } else {
+ if (!cell->tableCellInterface()) {
+ qCWarning(lcAccessibilityAtspi).nospace() << "AtSpiAdaptor::" << function << " No table cell interface: " << cell;
+ return false;
+ }
+ ret = cell->tableCellInterface()->columnIndex();
+ }
+ } else {
+ if (cell->role() == QAccessible::ColumnHeader) {
+ ret = -1;
+ } else if (cell->role() == QAccessible::RowHeader) {
+ ret = index % interface->tableInterface()->columnCount();
+ } else {
+ if (!cell->tableCellInterface()) {
+ qCWarning(lcAccessibilityAtspi).nospace() << "AtSpiAdaptor::" << function << " No table cell interface: " << cell;
+ return false;
+ }
+ ret = cell->tableCellInterface()->rowIndex();
+ }
+ }
+ } else {
+ qCWarning(lcAccessibilityAtspi).nospace() << "AtSpiAdaptor::" << function << " No cell at index: " << index << " " << interface;
+ return false;
+ }
+ }
+ connection.send(message.createReply(ret));
+
+ } else if (function == "GetColumnDescription"_L1) {
+ int column = message.arguments().at(0).toInt();
+ connection.send(message.createReply(interface->tableInterface()->columnDescription(column)));
+ } else if (function == "GetRowDescription"_L1) {
+ int row = message.arguments().at(0).toInt();
+ connection.send(message.createReply(interface->tableInterface()->rowDescription(row)));
+
+
+
+ } else if (function == "GetRowColumnExtentsAtIndex"_L1) {
+ int index = message.arguments().at(0).toInt();
+ bool success = false;
+
+ int row = -1;
+ int col = -1;
+ int rowExtents = -1;
+ int colExtents = -1;
+ bool isSelected = false;
+
+ int cols = interface->tableInterface()->columnCount();
+ if (cols > 0) {
+ row = index / cols;
+ col = index % cols;
+ if (QAccessibleInterface *cell = interface->tableInterface()->cellAt(row, col)) {
+ if (QAccessibleTableCellInterface *cellIface = cell->tableCellInterface()) {
+ row = cellIface->rowIndex();
+ col = cellIface->columnIndex();
+ rowExtents = cellIface->rowExtent();
+ colExtents = cellIface->columnExtent();
+ isSelected = cellIface->isSelected();
+ success = true;
+ }
+ }
+ }
+ QVariantList list;
+ list << success << row << col << rowExtents << colExtents << isSelected;
+ connection.send(message.createReply(list));
+
+ } else if (function == "GetColumnExtentAt"_L1) {
+ int row = message.arguments().at(0).toInt();
+ int column = message.arguments().at(1).toInt();
+ int columnExtent = 0;
+ if (QAccessibleInterface *cell = interface->tableInterface()->cellAt(row, column)) {
+ if (QAccessibleTableCellInterface *cellIface = cell->tableCellInterface())
+ columnExtent = cellIface->columnExtent();
+ }
+ connection.send(message.createReply(columnExtent));
+
+ } else if (function == "GetRowExtentAt"_L1) {
+ int row = message.arguments().at(0).toInt();
+ int column = message.arguments().at(1).toInt();
+ int rowExtent = 0;
+ if (QAccessibleInterface *cell = interface->tableInterface()->cellAt(row, column)) {
+ if (QAccessibleTableCellInterface *cellIface = cell->tableCellInterface())
+ rowExtent = cellIface->rowExtent();
+ }
+ connection.send(message.createReply(rowExtent));
+
+ } else if (function == "GetColumnHeader"_L1) {
+ int column = message.arguments().at(0).toInt();
+ QSpiObjectReference ref;
+
+ QAccessibleInterface * cell(interface->tableInterface()->cellAt(0, column));
+ if (cell && cell->tableCellInterface()) {
+ QList<QAccessibleInterface*> header = cell->tableCellInterface()->columnHeaderCells();
+ if (header.size() > 0) {
+ ref = QSpiObjectReference(connection, QDBusObjectPath(pathForInterface(header.takeAt(0))));
+ }
+ }
+ connection.send(message.createReply(QVariant::fromValue(ref)));
+
+ } else if (function == "GetRowHeader"_L1) {
+ int row = message.arguments().at(0).toInt();
+ QSpiObjectReference ref;
+ QAccessibleInterface *cell = interface->tableInterface()->cellAt(row, 0);
+ if (cell && cell->tableCellInterface()) {
+ QList<QAccessibleInterface*> header = cell->tableCellInterface()->rowHeaderCells();
+ if (header.size() > 0) {
+ ref = QSpiObjectReference(connection, QDBusObjectPath(pathForInterface(header.takeAt(0))));
+ }
+ }
+ connection.send(message.createReply(QVariant::fromValue(ref)));
+
+ } else if (function == "GetSelectedColumns"_L1) {
+ connection.send(message.createReply(QVariant::fromValue(interface->tableInterface()->selectedColumns())));
+ } else if (function == "GetSelectedRows"_L1) {
+ connection.send(message.createReply(QVariant::fromValue(interface->tableInterface()->selectedRows())));
+ } else if (function == "IsColumnSelected"_L1) {
+ int column = message.arguments().at(0).toInt();
+ connection.send(message.createReply(interface->tableInterface()->isColumnSelected(column)));
+ } else if (function == "IsRowSelected"_L1) {
+ int row = message.arguments().at(0).toInt();
+ connection.send(message.createReply(interface->tableInterface()->isRowSelected(row)));
+ } else if (function == "IsSelected"_L1) {
+ int row = message.arguments().at(0).toInt();
+ int column = message.arguments().at(1).toInt();
+ bool selected = false;
+ if (QAccessibleInterface* cell = interface->tableInterface()->cellAt(row, column)) {
+ if (QAccessibleTableCellInterface *cellIface = cell->tableCellInterface())
+ selected = cellIface->isSelected();
+ }
+ connection.send(message.createReply(selected));
+ } else if (function == "AddColumnSelection"_L1) {
+ int column = message.arguments().at(0).toInt();
+ connection.send(message.createReply(interface->tableInterface()->selectColumn(column)));
+ } else if (function == "AddRowSelection"_L1) {
+ int row = message.arguments().at(0).toInt();
+ connection.send(message.createReply(interface->tableInterface()->selectRow(row)));
+ } else if (function == "RemoveColumnSelection"_L1) {
+ int column = message.arguments().at(0).toInt();
+ connection.send(message.createReply(interface->tableInterface()->unselectColumn(column)));
+ } else if (function == "RemoveRowSelection"_L1) {
+ int row = message.arguments().at(0).toInt();
+ connection.send(message.createReply(interface->tableInterface()->unselectRow(row)));
+ } else {
+ qCWarning(lcAccessibilityAtspi) << "AtSpiAdaptor::tableInterface does not implement" << function << message.path();
+ return false;
+ }
+ return true;
+}
+
+// Table cell interface
+bool AtSpiAdaptor::tableCellInterface(QAccessibleInterface *interface, const QString &function, const QDBusMessage &message, const QDBusConnection &connection)
+{
+ QAccessibleTableCellInterface* cellInterface = interface->tableCellInterface();
+ if (!cellInterface) {
+ qCWarning(lcAccessibilityAtspi) << "Could not find table cell interface for: " << message.path() << interface;
+ return false;
+ }
+
+ if (function == "GetColumnHeaderCells"_L1) {
+ QSpiObjectReferenceArray headerCells;
+ const auto headerCellInterfaces = cellInterface->columnHeaderCells();
+ headerCells.reserve(headerCellInterfaces.size());
+ for (QAccessibleInterface *cell : headerCellInterfaces) {
+ const QString childPath = pathForInterface(cell);
+ const QSpiObjectReference ref(connection, QDBusObjectPath(childPath));
+ headerCells << ref;
+ }
+ connection.send(message.createReply(QVariant::fromValue(headerCells)));
+ } else if (function == "GetColumnSpan"_L1) {
+ connection.send(message.createReply(QVariant::fromValue(QDBusVariant(
+ QVariant::fromValue(cellInterface->columnExtent())))));
+ } else if (function == "GetPosition"_L1) {
+ const int row = cellInterface->rowIndex();
+ const int column = cellInterface->columnIndex();
+ connection.send(message.createReply(QVariant::fromValue(QDBusVariant(
+ QVariant::fromValue(QPoint(row, column))))));
+ } else if (function == "GetRowHeaderCells"_L1) {
+ QSpiObjectReferenceArray headerCells;
+ const auto headerCellInterfaces = cellInterface->rowHeaderCells();
+ headerCells.reserve(headerCellInterfaces.size());
+ for (QAccessibleInterface *cell : headerCellInterfaces) {
+ const QString childPath = pathForInterface(cell);
+ const QSpiObjectReference ref(connection, QDBusObjectPath(childPath));
+ headerCells << ref;
+ }
+ connection.send(message.createReply(QVariant::fromValue(headerCells)));
+ } else if (function == "GetRowSpan"_L1) {
+ connection.send(message.createReply(QVariant::fromValue(QDBusVariant(
+ QVariant::fromValue(cellInterface->rowExtent())))));
+ } else if (function == "GetRowColumnSpan"_L1) {
+ QVariantList list;
+ list << cellInterface->rowIndex() << cellInterface->columnIndex() << cellInterface->rowExtent() << cellInterface->columnExtent();
+ connection.send(message.createReply(list));
+ } else if (function == "GetTable"_L1) {
+ QSpiObjectReference ref;
+ QAccessibleInterface* table = cellInterface->table();
+ if (table && table->tableInterface())
+ ref = QSpiObjectReference(connection, QDBusObjectPath(pathForInterface(table)));
+ connection.send(message.createReply(QVariant::fromValue(QDBusVariant(QVariant::fromValue(ref)))));
+ } else {
+ qCWarning(lcAccessibilityAtspi) << "AtSpiAdaptor::tableCellInterface does not implement" << function << message.path();
+ return false;
+ }
+
+ return true;
+}
+
+QT_END_NAMESPACE
+
+#include "moc_atspiadaptor_p.cpp"
+#endif // QT_CONFIG(accessibility)
diff --git a/src/gui/accessible/linux/atspiadaptor_p.h b/src/gui/accessible/linux/atspiadaptor_p.h
new file mode 100644
index 0000000000..3a890f3d7d
--- /dev/null
+++ b/src/gui/accessible/linux/atspiadaptor_p.h
@@ -0,0 +1,194 @@
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
+
+
+#ifndef ATSPIADAPTOR_H
+#define ATSPIADAPTOR_H
+
+//
+// W A R N I N G
+// -------------
+//
+// This file is not part of the Qt API. It exists purely as an
+// implementation detail. This header file may change from version to
+// version without notice, or even be removed.
+//
+// We mean it.
+//
+
+#include <atspi/atspi-constants.h>
+
+#include <QtGui/private/qtguiglobal_p.h>
+#include <QtDBus/qdbusvirtualobject.h>
+#include <QtGui/qaccessible.h>
+
+#include "dbusconnection_p.h"
+#include "qspi_struct_marshallers_p.h"
+
+QT_REQUIRE_CONFIG(accessibility);
+
+QT_BEGIN_NAMESPACE
+
+class QAccessibleInterface;
+class QSpiApplicationAdaptor;
+
+
+class AtSpiAdaptor :public QDBusVirtualObject
+{
+ Q_OBJECT
+
+public:
+ explicit AtSpiAdaptor(DBusConnection *connection, QObject *parent = nullptr);
+ ~AtSpiAdaptor();
+
+ void registerApplication();
+ QString introspect(const QString &path) const override;
+ bool handleMessage(const QDBusMessage &message, const QDBusConnection &connection) override;
+ void notify(QAccessibleEvent *event);
+
+public Q_SLOTS:
+ void eventListenerRegistered(const QString &bus, const QString &path);
+ void eventListenerDeregistered(const QString &bus, const QString &path);
+ void windowActivated(QObject* window, bool active);
+
+private:
+ void updateEventListeners();
+ void setBitFlag(const QString &flag);
+
+ // sending messages
+ QVariantList packDBusSignalArguments(const QString &type, int data1, int data2, const QVariant &variantData) const;
+ bool sendDBusSignal(const QString &path, const QString &interface, const QString &name, const QVariantList &arguments) const;
+ QVariant variantForPath(const QString &path) const;
+
+ void sendFocusChanged(QAccessibleInterface *interface) const;
+ void notifyAboutCreation(QAccessibleInterface *interface) const;
+ void notifyAboutDestruction(QAccessibleInterface *interface) const;
+ void childrenChanged(QAccessibleInterface *interface) const;
+
+ // handlers for the different accessible interfaces
+ bool applicationInterface(QAccessibleInterface *interface, const QString &function, const QDBusMessage &message, const QDBusConnection &connection);
+ bool accessibleInterface(QAccessibleInterface *interface, const QString &function, const QDBusMessage &message, const QDBusConnection &connection);
+ bool componentInterface(QAccessibleInterface *interface, const QString &function, const QDBusMessage &message, const QDBusConnection &connection);
+ bool actionInterface(QAccessibleInterface *interface, const QString &function, const QDBusMessage &message, const QDBusConnection &connection);
+ bool textInterface(QAccessibleInterface *interface, const QString &function, const QDBusMessage &message, const QDBusConnection &connection);
+ bool editableTextInterface(QAccessibleInterface *interface, const QString &function, const QDBusMessage &message, const QDBusConnection &connection);
+ bool valueInterface(QAccessibleInterface *interface, const QString &function, const QDBusMessage &message, const QDBusConnection &connection);
+ bool selectionInterface(QAccessibleInterface *interface, const QString &function, const QDBusMessage &message, const QDBusConnection &connection);
+ bool tableInterface(QAccessibleInterface *interface, const QString &function, const QDBusMessage &message, const QDBusConnection &connection);
+ bool tableCellInterface(QAccessibleInterface *interface, const QString &function, const QDBusMessage &message, const QDBusConnection &connection);
+
+ void sendReply(const QDBusConnection &connection, const QDBusMessage &message, const QVariant &argument) const;
+
+ QAccessibleInterface *interfaceFromPath(const QString& dbusPath) const;
+ QString pathForInterface(QAccessibleInterface *interface) const;
+ QString pathForObject(QObject *object) const;
+
+ void notifyStateChange(QAccessibleInterface *interface, const QString& state, int value);
+
+ // accessible helper functions
+ AtspiRole getRole(QAccessibleInterface *interface) const;
+ QSpiRelationArray relationSet(QAccessibleInterface *interface, const QDBusConnection &connection) const;
+ QStringList accessibleInterfaces(QAccessibleInterface *interface) const;
+
+ // component helper functions
+ static QRect getExtents(QAccessibleInterface *interface, uint coordType);
+ static bool isValidCoordType(uint coordType);
+ static QRect translateFromScreenCoordinates(QAccessibleInterface *interface, const QRect &rect, uint targetCoordType);
+ static QPoint translateToScreenCoordinates(QAccessibleInterface *interface, const QPoint &pos, uint fromCoordType);
+
+ // action helper functions
+ QSpiActionArray getActions(QAccessibleInterface *interface) const;
+
+ // text helper functions
+ QVariantList getAttributes(QAccessibleInterface *, int offset, bool includeDefaults) const;
+ QString getAttributeValue(QAccessibleInterface *, int offset, const QString &attributeName) const;
+ QList<QVariant> getCharacterExtents(QAccessibleInterface *, int offset, uint coordType) const;
+ QList<QVariant> getRangeExtents(QAccessibleInterface *, int startOffset, int endOffset, uint coordType) const;
+ static QAccessible::TextBoundaryType qAccessibleBoundaryTypeFromAtspiBoundaryType(int atspiTextBoundaryType);
+ static bool isValidAtspiTextGranularity(uint coordType);
+ static QAccessible::TextBoundaryType qAccessibleBoundaryTypeFromAtspiTextGranularity(uint atspiTextGranularity);
+ static bool inheritsQAction(QObject *object);
+
+ // private vars
+ QSpiObjectReference accessibilityRegistry;
+ DBusConnection *m_dbus;
+ QSpiApplicationAdaptor *m_applicationAdaptor;
+
+ /// Assigned from the accessibility registry.
+ int m_applicationId;
+
+ // Bit fields - which updates to send
+
+ // AT-SPI has some events that we do not care about:
+ // document
+ // document-load-complete
+ // document-load-stopped
+ // document-reload
+ uint sendFocus : 1;
+ // mouse abs/rel/button
+
+ // all of object
+ uint sendObject : 1;
+ uint sendObject_active_descendant_changed : 1;
+ uint sendObject_attributes_changed : 1;
+ uint sendObject_bounds_changed : 1;
+ uint sendObject_children_changed : 1;
+// uint sendObject_children_changed_add : 1;
+// uint sendObject_children_changed_remove : 1;
+ uint sendObject_column_deleted : 1;
+ uint sendObject_column_inserted : 1;
+ uint sendObject_column_reordered : 1;
+ uint sendObject_link_selected : 1;
+ uint sendObject_model_changed : 1;
+ uint sendObject_property_change : 1;
+ uint sendObject_property_change_accessible_description : 1;
+ uint sendObject_property_change_accessible_name : 1;
+ uint sendObject_property_change_accessible_parent : 1;
+ uint sendObject_property_change_accessible_role : 1;
+ uint sendObject_property_change_accessible_table_caption : 1;
+ uint sendObject_property_change_accessible_table_column_description : 1;
+ uint sendObject_property_change_accessible_table_column_header : 1;
+ uint sendObject_property_change_accessible_table_row_description : 1;
+ uint sendObject_property_change_accessible_table_row_header : 1;
+ uint sendObject_property_change_accessible_table_summary : 1;
+ uint sendObject_property_change_accessible_value : 1;
+ uint sendObject_row_deleted : 1;
+ uint sendObject_row_inserted : 1;
+ uint sendObject_row_reordered : 1;
+ uint sendObject_selection_changed : 1;
+ uint sendObject_state_changed : 1;
+ uint sendObject_text_attributes_changed : 1;
+ uint sendObject_text_bounds_changed : 1;
+ uint sendObject_text_caret_moved : 1;
+ uint sendObject_text_changed : 1;
+// uint sendObject_text_changed_delete : 1;
+// uint sendObject_text_changed_insert : 1;
+ uint sendObject_text_selection_changed : 1;
+ uint sendObject_value_changed : 1;
+ uint sendObject_visible_data_changed : 1;
+
+ // we don't implement terminal
+ // terminal-application_changed/charwidth_changed/columncount_changed/line_changed/linecount_changed
+ uint sendWindow : 1;
+ uint sendWindow_activate : 1;
+ uint sendWindow_close: 1;
+ uint sendWindow_create : 1;
+ uint sendWindow_deactivate : 1;
+// uint sendWindow_desktop_create : 1;
+// uint sendWindow_desktop_destroy : 1;
+ uint sendWindow_lower : 1;
+ uint sendWindow_maximize : 1;
+ uint sendWindow_minimize : 1;
+ uint sendWindow_move : 1;
+ uint sendWindow_raise : 1;
+ uint sendWindow_reparent : 1;
+ uint sendWindow_resize : 1;
+ uint sendWindow_restore : 1;
+ uint sendWindow_restyle : 1;
+ uint sendWindow_shade : 1;
+ uint sendWindow_unshade : 1;
+};
+
+QT_END_NAMESPACE
+
+#endif
diff --git a/src/gui/accessible/linux/dbusconnection.cpp b/src/gui/accessible/linux/dbusconnection.cpp
new file mode 100644
index 0000000000..10bd10927e
--- /dev/null
+++ b/src/gui/accessible/linux/dbusconnection.cpp
@@ -0,0 +1,149 @@
+// Copyright (C) 2022 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
+
+
+
+#include "dbusconnection_p.h"
+
+#include <QtDBus/QDBusMessage>
+#include <QtDBus/QDBusServiceWatcher>
+#include <qdebug.h>
+
+#include <QDBusConnectionInterface>
+#include "bus_interface.h"
+
+#include <QtGui/qguiapplication.h>
+#include <qpa/qplatformnativeinterface.h>
+
+QT_BEGIN_NAMESPACE
+
+using namespace Qt::StringLiterals;
+
+/* note: do not change these to QStringLiteral;
+ we are unloaded before QtDBus is done using the strings.
+ */
+#define A11Y_SERVICE "org.a11y.Bus"_L1
+#define A11Y_PATH "/org/a11y/bus"_L1
+
+/*!
+ \class DBusConnection
+ \internal
+ \brief Connects to the accessibility dbus.
+
+ This is usually a different bus from the session bus.
+*/
+DBusConnection::DBusConnection(QObject *parent)
+ : QObject(parent), m_a11yConnection(QString()), m_enabled(false)
+{
+ // If the bus is explicitly set via env var it overrides everything else.
+ QByteArray addressEnv = qgetenv("AT_SPI_BUS_ADDRESS");
+ if (!addressEnv.isEmpty()) {
+ m_enabled = true;
+ connectA11yBus(QString::fromLocal8Bit(addressEnv));
+ return;
+ }
+
+ // Start monitoring if "org.a11y.Bus" is registered as DBus service.
+ QDBusConnection c = QDBusConnection::sessionBus();
+ if (!c.isConnected()) {
+ return;
+ }
+
+ dbusWatcher = new QDBusServiceWatcher(A11Y_SERVICE, c, QDBusServiceWatcher::WatchForRegistration, this);
+ connect(dbusWatcher, SIGNAL(serviceRegistered(QString)), this, SLOT(serviceRegistered()));
+
+ // If it is registered already, setup a11y right away
+ if (c.interface()->isServiceRegistered(A11Y_SERVICE))
+ serviceRegistered();
+
+ if (QGuiApplication::platformName().startsWith("xcb"_L1)) {
+ // In addition try if there is an xatom exposing the bus address, this allows applications run as root to work
+ QString address = getAddressFromXCB();
+ if (!address.isEmpty()) {
+ m_enabled = true;
+ connectA11yBus(address);
+ }
+ }
+}
+
+QString DBusConnection::getAddressFromXCB()
+{
+ QGuiApplication *app = qobject_cast<QGuiApplication *>(QCoreApplication::instance());
+ if (!app)
+ return QString();
+ QPlatformNativeInterface *platformNativeInterface = app->platformNativeInterface();
+ QByteArray *addressByteArray = reinterpret_cast<QByteArray*>(
+ platformNativeInterface->nativeResourceForIntegration(QByteArrayLiteral("AtspiBus")));
+ if (addressByteArray) {
+ QString address = QString::fromLatin1(*addressByteArray);
+ delete addressByteArray;
+ return address;
+ }
+ return QString();
+}
+
+// We have the a11y registry on the session bus.
+// Subscribe to updates about a11y enabled state.
+// Find out the bus address
+void DBusConnection::serviceRegistered()
+{
+ // listen to enabled changes
+ QDBusConnection c = QDBusConnection::sessionBus();
+ OrgA11yStatusInterface *a11yStatus = new OrgA11yStatusInterface(A11Y_SERVICE, A11Y_PATH, c, this);
+
+ //The variable was introduced because on some embedded platforms there are custom accessibility
+ //clients which don't set Status.ScreenReaderEnabled to true. The variable is also useful for
+ //debugging.
+ static const bool a11yAlwaysOn = qEnvironmentVariableIsSet("QT_LINUX_ACCESSIBILITY_ALWAYS_ON");
+
+ bool enabled = a11yAlwaysOn || a11yStatus->screenReaderEnabled() || a11yStatus->isEnabled();
+
+ if (enabled != m_enabled) {
+ m_enabled = enabled;
+ if (m_a11yConnection.isConnected()) {
+ emit enabledChanged(m_enabled);
+ } else {
+ QDBusConnection c = QDBusConnection::sessionBus();
+ QDBusMessage m = QDBusMessage::createMethodCall(A11Y_SERVICE, A11Y_PATH, A11Y_SERVICE,
+ "GetAddress"_L1);
+ c.callWithCallback(m, this, SLOT(connectA11yBus(QString)), SLOT(dbusError(QDBusError)));
+ }
+ }
+
+ // connect(a11yStatus, ); QtDbus doesn't support notifications for property changes yet
+}
+
+void DBusConnection::serviceUnregistered()
+{
+ emit enabledChanged(false);
+}
+
+void DBusConnection::connectA11yBus(const QString &address)
+{
+ if (address.isEmpty()) {
+ qWarning("Could not find Accessibility DBus address.");
+ return;
+ }
+ m_a11yConnection = QDBusConnection(QDBusConnection::connectToBus(address, "a11y"_L1));
+
+ if (m_enabled)
+ emit enabledChanged(true);
+}
+
+void DBusConnection::dbusError(const QDBusError &error)
+{
+ qWarning() << "Accessibility encountered a DBus error:" << error;
+}
+
+/*!
+ Returns the DBus connection that got established.
+ Or an invalid connection if not yet connected.
+*/
+QDBusConnection DBusConnection::connection() const
+{
+ return m_a11yConnection;
+}
+
+QT_END_NAMESPACE
+
+#include "moc_dbusconnection_p.cpp"
diff --git a/src/gui/accessible/linux/dbusconnection_p.h b/src/gui/accessible/linux/dbusconnection_p.h
new file mode 100644
index 0000000000..8b231c5ad0
--- /dev/null
+++ b/src/gui/accessible/linux/dbusconnection_p.h
@@ -0,0 +1,61 @@
+// Copyright (C) 2020 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
+
+
+#ifndef DBUSCONNECTION_H
+#define DBUSCONNECTION_H
+
+//
+// W A R N I N G
+// -------------
+//
+// This file is not part of the Qt API. It exists purely as an
+// implementation detail. This header file may change from version to
+// version without notice, or even be removed.
+//
+// We mean it.
+//
+
+#include <QtCore/QObject>
+#include <QtCore/QString>
+#include <QtDBus/QDBusConnection>
+#include <QtDBus/QDBusVariant>
+#include <QtCore/private/qglobal_p.h>
+Q_MOC_INCLUDE(<QtDBus/QDBusError>)
+
+QT_BEGIN_NAMESPACE
+
+class QDBusServiceWatcher;
+
+class DBusConnection : public QObject
+{
+ Q_OBJECT
+
+public:
+ DBusConnection(QObject *parent = nullptr);
+ QDBusConnection connection() const;
+ bool isEnabled() const { return m_enabled; }
+
+Q_SIGNALS:
+ // Emitted when the global accessibility status changes to enabled
+ void enabledChanged(bool enabled);
+
+private Q_SLOTS:
+ QString getAddressFromXCB();
+ void serviceRegistered();
+ void serviceUnregistered();
+ void connectA11yBus(const QString &address);
+
+ void dbusError(const QDBusError &error);
+
+private:
+ QString getAccessibilityBusAddress() const;
+
+ QDBusServiceWatcher *dbusWatcher;
+ QDBusConnection m_a11yConnection;
+ bool m_enabled;
+};
+
+QT_END_NAMESPACE
+
+#endif // DBUSCONNECTION_H
diff --git a/src/gui/accessible/linux/dbusxml/Bus.xml b/src/gui/accessible/linux/dbusxml/Bus.xml
new file mode 100644
index 0000000000..5a33e335a1
--- /dev/null
+++ b/src/gui/accessible/linux/dbusxml/Bus.xml
@@ -0,0 +1,17 @@
+<!DOCTYPE node PUBLIC "-//freedesktop//DTD D-BUS Object Introspection 1.0//EN"
+ "http://www.freedesktop.org/standards/dbus/1.0/introspect.dtd">
+<node>
+ <interface name="org.a11y.Status">
+ <property type="b" name="IsEnabled" access="readwrite">
+ </property>
+ <property type="b" name="ScreenReaderEnabled" access="readwrite">
+ </property>
+ </interface>
+ <interface name="org.a11y.Bus">
+ <method name="GetAddress">
+ <arg type="s" name="address" direction="out">
+ </arg>
+ </method>
+ </interface>
+</node>
+
diff --git a/src/gui/accessible/linux/dbusxml/Cache.xml b/src/gui/accessible/linux/dbusxml/Cache.xml
new file mode 100644
index 0000000000..01c52810ac
--- /dev/null
+++ b/src/gui/accessible/linux/dbusxml/Cache.xml
@@ -0,0 +1,21 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<node name="/node">
+<interface name="org.a11y.atspi.Cache">
+
+ <method name="GetItems">
+ <arg name="nodes" type="a((so)(so)a(so)assusau)" direction="out"/>
+ <annotation name="org.qtproject.QtDBus.QtTypeName.Out0" value="QSpiAccessibleCacheArray"/>
+ </method>
+
+ <signal name="AddAccessible">
+ <arg name="nodeAdded" type="((so)(so)a(so)assusau)"/>
+ <annotation name="org.qtproject.QtDBus.QtTypeName.Out0" value="QSpiAccessibleCacheItem"/>
+ </signal>
+
+ <signal name="RemoveAccessible">
+ <arg name="nodeRemoved" type="(so)"/>
+ <annotation name="org.qtproject.QtDBus.QtTypeName.Out0" value="QSpiObjectReference"/>
+ </signal>
+
+</interface>
+</node>
diff --git a/src/gui/accessible/linux/dbusxml/DeviceEventController.xml b/src/gui/accessible/linux/dbusxml/DeviceEventController.xml
new file mode 100644
index 0000000000..d4c26ef7e7
--- /dev/null
+++ b/src/gui/accessible/linux/dbusxml/DeviceEventController.xml
@@ -0,0 +1,66 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<node name="/node">
+<interface name="org.a11y.atspi.DeviceEventController">
+
+<!--
+ <method name="RegisterKeystrokeListener">
+ <arg direction="in" name="listener" type="o"/>
+ <arg direction="in" name="keys" type="a(iisi)">
+ <annotation name="com.trolltech.QtDBus.QtTypeName.In1" value="QSpiKeyTypeArray"/>
+ </arg>
+ <arg direction="in" name="mask" type="u"/>
+ <arg direction="in" name="type" type="au">
+ <annotation name="com.trolltech.QtDBus.QtTypeName.In3" value="QSpiEventTypeArray"/>
+ </arg>
+ <arg direction="in" name="mode" type="(bbb)">
+ <annotation name="com.trolltech.QtDBus.QtTypeName.In4" value="QSpiEventMode"/>
+ </arg>
+ <arg direction="out" type="b"/>
+ </method>
+
+ <method name="DeregisterKeystrokeListener">
+ <arg direction="in" name="listener" type="o"/>
+ <arg direction="in" name="keys" type="a(iisi)">
+ <annotation name="com.trolltech.QtDBus.QtTypeName.In1" value="QSpiKeyTypeArray"/>
+ </arg>
+ <arg direction="in" name="mask" type="u"/>
+ <arg direction="in" name="type" type="u"/>
+ </method>
+
+ <method name="RegisterDeviceEventListener">
+ <arg direction="in" name="listener" type="o"/>
+ <arg direction="in" name="types" type="u"/>
+ <arg direction="out" type="b"/>
+ </method>
+
+ <method name="DeregisterDeviceEventListener">
+ <arg direction="in" name="listener" type="o"/>
+ <arg direction="in" name="types" type="u"/>
+ </method>
+
+ <method name="GenerateKeyboardEvent">
+ <arg direction="in" name="keycode" type="i"/>
+ <arg direction="in" name="keystring" type="s"/>
+ <arg direction="in" name="type" type="u"/>
+ </method>
+
+ <method name="GenerateMouseEvent">
+ <arg direction="in" name="x" type="i"/>
+ <arg direction="in" name="y" type="i"/>
+ <arg direction="in" name="eventName" type="s"/>
+ </method>
+-->
+
+ <method name="NotifyListenersSync">
+ <arg direction="in" name="event" type="(uinnisb)"/>
+ <arg direction="out" type="b"/>
+ <annotation name="org.qtproject.QtDBus.QtTypeName.In0" value="QSpiDeviceEvent"/>
+ </method>
+
+ <method name="NotifyListenersAsync">
+ <arg direction="in" name="event" type="(uinnisb)"/>
+ <annotation name="org.qtproject.QtDBus.QtTypeName.In0" value="QSpiDeviceEvent"/>
+ </method>
+
+</interface>
+</node>
diff --git a/src/gui/accessible/linux/dbusxml/Socket.xml b/src/gui/accessible/linux/dbusxml/Socket.xml
new file mode 100644
index 0000000000..f9ac76d2c8
--- /dev/null
+++ b/src/gui/accessible/linux/dbusxml/Socket.xml
@@ -0,0 +1,23 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<node name="/node">
+<interface name="org.a11y.atspi.Socket">
+
+ <method name="Embed">
+ <arg direction="in" name="plug" type="(so)"/>
+ <annotation name="org.qtproject.QtDBus.QtTypeName.In0" value="QSpiObjectReference"/>
+ <arg direction="out" name="socket" type="(so)"/>
+ <annotation name="org.qtproject.QtDBus.QtTypeName.Out0" value="QSpiObjectReference"/>
+ </method>
+
+ <method name="Unembed">
+ <arg direction="in" name="plug" type="(so)"/>
+ <annotation name="org.qtproject.QtDBus.QtTypeName.In0" value="QSpiObjectReference"/>
+ </method>
+
+ <signal name="Available">
+ <arg direction="in" name="socket" type="(so)"/>
+ <annotation name="org.qtproject.QtDBus.QtTypeName.In0" value="QSpiObjectReference"/>
+ </signal>
+
+</interface>
+</node>
diff --git a/src/gui/accessible/linux/qspi_constant_mappings.cpp b/src/gui/accessible/linux/qspi_constant_mappings.cpp
new file mode 100644
index 0000000000..e5b6e3f634
--- /dev/null
+++ b/src/gui/accessible/linux/qspi_constant_mappings.cpp
@@ -0,0 +1,128 @@
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
+
+
+#include "qspi_constant_mappings_p.h"
+
+#include <qobject.h>
+#include <qdebug.h>
+
+// FIXME the assignment of roles is quite arbitrary, at some point go through this list and sort and check that it makes sense
+// "calendar" "check menu item" "color chooser" "column header" "dateeditor" "desktop icon" "desktop frame"
+// "directory pane" "drawing area" "file chooser" "fontchooser" "frame" "glass pane" "html container" "icon"
+// "internal frame" "option pane" "password text" "radio menu item" "root pane" "row header" "scroll pane"
+// "tear off menu item" "terminal" "toggle button" "tree table" "unknown" "viewport" "header" "footer" "paragraph"
+// "ruler" "autocomplete" "edit bar" "embedded component" "entry" "caption"
+// "heading" "page" "section" "redundant object" "form" "input method window" "menu"
+
+#if QT_CONFIG(accessibility)
+QT_BEGIN_NAMESPACE
+
+quint64 spiStatesFromQState(QAccessible::State state)
+{
+ quint64 spiState = 0;
+
+ if (state.active)
+ setSpiStateBit(&spiState, ATSPI_STATE_ACTIVE);
+ if (state.editable)
+ setSpiStateBit(&spiState, ATSPI_STATE_EDITABLE);
+ if (!state.disabled) {
+ setSpiStateBit(&spiState, ATSPI_STATE_ENABLED);
+ setSpiStateBit(&spiState, ATSPI_STATE_SENSITIVE);
+ }
+ if (state.selected)
+ setSpiStateBit(&spiState, ATSPI_STATE_SELECTED);
+ if (state.focused)
+ setSpiStateBit(&spiState, ATSPI_STATE_FOCUSED);
+ if (state.pressed)
+ setSpiStateBit(&spiState, ATSPI_STATE_PRESSED);
+ if (state.checkable)
+ setSpiStateBit(&spiState, ATSPI_STATE_CHECKABLE);
+ if (state.checked)
+ setSpiStateBit(&spiState, ATSPI_STATE_CHECKED);
+ if (state.checkStateMixed)
+ setSpiStateBit(&spiState, ATSPI_STATE_INDETERMINATE);
+ if (state.readOnly)
+ setSpiStateBit(&spiState, ATSPI_STATE_READ_ONLY);
+ // if (state.HotTracked)
+ if (state.defaultButton)
+ setSpiStateBit(&spiState, ATSPI_STATE_IS_DEFAULT);
+ if (state.expandable)
+ setSpiStateBit(&spiState, ATSPI_STATE_EXPANDABLE);
+ if (state.expanded)
+ setSpiStateBit(&spiState, ATSPI_STATE_EXPANDED);
+ if (state.collapsed)
+ setSpiStateBit(&spiState, ATSPI_STATE_COLLAPSED);
+ if (state.busy)
+ setSpiStateBit(&spiState, ATSPI_STATE_BUSY);
+ if (state.marqueed || state.animated)
+ setSpiStateBit(&spiState, ATSPI_STATE_ANIMATED);
+ if (!state.invisible && !state.offscreen) {
+ setSpiStateBit(&spiState, ATSPI_STATE_SHOWING);
+ setSpiStateBit(&spiState, ATSPI_STATE_VISIBLE);
+ }
+ if (state.sizeable)
+ setSpiStateBit(&spiState, ATSPI_STATE_RESIZABLE);
+ // if (state.Movable)
+ // if (state.SelfVoicing)
+ if (state.focusable)
+ setSpiStateBit(&spiState, ATSPI_STATE_FOCUSABLE);
+ if (state.selectable)
+ setSpiStateBit(&spiState, ATSPI_STATE_SELECTABLE);
+ // if (state.Linked)
+ if (state.traversed)
+ setSpiStateBit(&spiState, ATSPI_STATE_VISITED);
+ if (state.multiSelectable)
+ setSpiStateBit(&spiState, ATSPI_STATE_MULTISELECTABLE);
+ if (state.extSelectable)
+ setSpiStateBit(&spiState, ATSPI_STATE_SELECTABLE);
+ // if (state.Protected)
+ if (state.hasPopup)
+ setSpiStateBit(&spiState, ATSPI_STATE_HAS_POPUP);
+ if (state.modal)
+ setSpiStateBit(&spiState, ATSPI_STATE_MODAL);
+ if (state.multiLine)
+ setSpiStateBit(&spiState, ATSPI_STATE_MULTI_LINE);
+
+ return spiState;
+}
+
+QSpiUIntList spiStateSetFromSpiStates(quint64 states)
+{
+ uint low = states & 0xFFFFFFFF;
+ uint high = (states >> 32) & 0xFFFFFFFF;
+
+ QSpiUIntList stateList;
+ stateList.append(low);
+ stateList.append(high);
+ return stateList;
+}
+
+AtspiRelationType qAccessibleRelationToAtSpiRelation(QAccessible::Relation relation)
+{
+ // direction of the relation is "inversed" in Qt and AT-SPI
+ switch (relation) {
+ case QAccessible::Label:
+ return ATSPI_RELATION_LABELLED_BY;
+ case QAccessible::Labelled:
+ return ATSPI_RELATION_LABEL_FOR;
+ case QAccessible::Controller:
+ return ATSPI_RELATION_CONTROLLED_BY;
+ case QAccessible::Controlled:
+ return ATSPI_RELATION_CONTROLLER_FOR;
+ case QAccessible::DescriptionFor:
+ return ATSPI_RELATION_DESCRIBED_BY;
+ case QAccessible::Described:
+ return ATSPI_RELATION_DESCRIPTION_FOR;
+ case QAccessible::FlowsFrom:
+ return ATSPI_RELATION_FLOWS_TO;
+ case QAccessible::FlowsTo:
+ return ATSPI_RELATION_FLOWS_FROM;
+ default:
+ qWarning() << "Cannot return AT-SPI relation for:" << relation;
+ }
+ return ATSPI_RELATION_NULL;
+}
+
+QT_END_NAMESPACE
+#endif // QT_CONFIG(accessibility)
diff --git a/src/gui/accessible/linux/qspi_constant_mappings_p.h b/src/gui/accessible/linux/qspi_constant_mappings_p.h
new file mode 100644
index 0000000000..ea571181e6
--- /dev/null
+++ b/src/gui/accessible/linux/qspi_constant_mappings_p.h
@@ -0,0 +1,107 @@
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
+
+//
+// W A R N I N G
+// -------------
+//
+// This file is not part of the Qt API. It exists purely as an
+// implementation detail. This header file may change from version to
+// version without notice, or even be removed.
+//
+// We mean it.
+//
+
+/*
+ * This file contains AT-SPI constants and mappings between QAccessible
+ * and AT-SPI constants such as 'role' and 'state' enumerations.
+ */
+
+#ifndef Q_SPI_CONSTANT_MAPPINGS_H
+#define Q_SPI_CONSTANT_MAPPINGS_H
+
+#include "qspi_struct_marshallers_p.h"
+
+#include <QtGui/private/qtguiglobal_p.h>
+#include <QtGui/QAccessible>
+#include <atspi/atspi-constants.h>
+
+QT_REQUIRE_CONFIG(accessibility);
+
+// interface names from at-spi2-core/atspi/atspi-misc-private.h
+#define ATSPI_DBUS_NAME_REGISTRY "org.a11y.atspi.Registry"
+#define ATSPI_DBUS_PATH_REGISTRY "/org/a11y/atspi/registry"
+#define ATSPI_DBUS_INTERFACE_REGISTRY "org.a11y.atspi.Registry"
+
+#define ATSPI_DBUS_PATH_ROOT "/org/a11y/atspi/accessible/root"
+
+#define ATSPI_DBUS_PATH_DEC "/org/a11y/atspi/registry/deviceeventcontroller"
+#define ATSPI_DBUS_INTERFACE_DEC "org.a11y.atspi.DeviceEventController"
+#define ATSPI_DBUS_INTERFACE_DEVICE_EVENT_LISTENER "org.a11y.atspi.DeviceEventListener"
+
+#define ATSPI_DBUS_INTERFACE_CACHE "org.a11y.atspi.Cache"
+#define ATSPI_DBUS_INTERFACE_ACCESSIBLE "org.a11y.atspi.Accessible"
+#define ATSPI_DBUS_INTERFACE_ACTION "org.a11y.atspi.Action"
+#define ATSPI_DBUS_INTERFACE_APPLICATION "org.a11y.atspi.Application"
+#define ATSPI_DBUS_INTERFACE_COLLECTION "org.a11y.atspi.Collection"
+#define ATSPI_DBUS_INTERFACE_COMPONENT "org.a11y.atspi.Component"
+#define ATSPI_DBUS_INTERFACE_DOCUMENT "org.a11y.atspi.Document"
+#define ATSPI_DBUS_INTERFACE_EDITABLE_TEXT "org.a11y.atspi.EditableText"
+#define ATSPI_DBUS_INTERFACE_EVENT_KEYBOARD "org.a11y.atspi.Event.Keyboard"
+#define ATSPI_DBUS_INTERFACE_EVENT_MOUSE "org.a11y.atspi.Event.Mouse"
+#define ATSPI_DBUS_INTERFACE_EVENT_OBJECT "org.a11y.atspi.Event.Object"
+#define ATSPI_DBUS_INTERFACE_HYPERLINK "org.a11y.atspi.Hyperlink"
+#define ATSPI_DBUS_INTERFACE_HYPERTEXT "org.a11y.atspi.Hypertext"
+#define ATSPI_DBUS_INTERFACE_IMAGE "org.a11y.atspi.Image"
+#define ATSPI_DBUS_INTERFACE_SELECTION "org.a11y.atspi.Selection"
+#define ATSPI_DBUS_INTERFACE_TABLE "org.a11y.atspi.Table"
+#define ATSPI_DBUS_INTERFACE_TEXT "org.a11y.atspi.Text"
+#define ATSPI_DBUS_INTERFACE_VALUE "org.a11y.atspi.Value"
+#define ATSPI_DBUS_INTERFACE_SOCKET "org.a11y.atspi.Socket"
+
+// missing from at-spi2-core:
+#define ATSPI_DBUS_INTERFACE_EVENT_WINDOW "org.a11y.atspi.Event.Window"
+#define ATSPI_DBUS_INTERFACE_EVENT_FOCUS "org.a11y.atspi.Event.Focus"
+
+#define QSPI_OBJECT_PATH_ACCESSIBLE "/org/a11y/atspi/accessible"
+#define QSPI_OBJECT_PATH_PREFIX "/org/a11y/atspi/accessible/"
+#define QSPI_OBJECT_PATH_ROOT QSPI_OBJECT_PATH_PREFIX "root"
+
+#define QSPI_REGISTRY_NAME "org.a11y.atspi.Registry"
+
+QT_BEGIN_NAMESPACE
+
+struct RoleNames {
+ RoleNames() {}
+ RoleNames(AtspiRole r, const QString& n, const QString& ln)
+ :m_spiRole(r), m_name(n), m_localizedName(ln)
+ {}
+
+ AtspiRole spiRole() const {return m_spiRole;}
+ QString name() const {return m_name;}
+ QString localizedName() const {return m_localizedName;}
+
+private:
+ AtspiRole m_spiRole = ATSPI_ROLE_INVALID;
+ QString m_name;
+ QString m_localizedName;
+};
+
+inline void setSpiStateBit(quint64* state, AtspiStateType spiState)
+{
+ *state |= quint64(1) << spiState;
+}
+
+inline void unsetSpiStateBit(quint64* state, AtspiStateType spiState)
+{
+ *state &= ~(quint64(1) << spiState);
+}
+
+quint64 spiStatesFromQState(QAccessible::State state);
+QSpiUIntList spiStateSetFromSpiStates(quint64 states);
+
+AtspiRelationType qAccessibleRelationToAtSpiRelation(QAccessible::Relation relation);
+
+QT_END_NAMESPACE
+
+#endif /* Q_SPI_CONSTANT_MAPPINGS_H */
diff --git a/src/gui/accessible/linux/qspi_struct_marshallers.cpp b/src/gui/accessible/linux/qspi_struct_marshallers.cpp
new file mode 100644
index 0000000000..032a9fe8b1
--- /dev/null
+++ b/src/gui/accessible/linux/qspi_struct_marshallers.cpp
@@ -0,0 +1,219 @@
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
+
+
+#include "qspi_struct_marshallers_p.h"
+
+#include <atspi/atspi-constants.h>
+#include <QtCore/qdebug.h>
+#include <QtDBus/qdbusmetatype.h>
+
+#include "qspiaccessiblebridge_p.h"
+
+#if QT_CONFIG(accessibility)
+QT_BEGIN_NAMESPACE
+
+QT_IMPL_METATYPE_EXTERN(QSpiIntList)
+QT_IMPL_METATYPE_EXTERN(QSpiUIntList)
+QT_IMPL_METATYPE_EXTERN(QSpiObjectReference)
+QT_IMPL_METATYPE_EXTERN(QSpiObjectReferenceArray)
+QT_IMPL_METATYPE_EXTERN(QSpiAccessibleCacheItem)
+QT_IMPL_METATYPE_EXTERN(QSpiAccessibleCacheArray)
+QT_IMPL_METATYPE_EXTERN(QSpiAction)
+QT_IMPL_METATYPE_EXTERN(QSpiActionArray)
+QT_IMPL_METATYPE_EXTERN(QSpiEventListener)
+QT_IMPL_METATYPE_EXTERN(QSpiEventListenerArray)
+QT_IMPL_METATYPE_EXTERN(QSpiRelationArrayEntry)
+QT_IMPL_METATYPE_EXTERN(QSpiRelationArray)
+QT_IMPL_METATYPE_EXTERN(QSpiTextRange)
+QT_IMPL_METATYPE_EXTERN(QSpiTextRangeList)
+QT_IMPL_METATYPE_EXTERN(QSpiAttributeSet)
+QT_IMPL_METATYPE_EXTERN(QSpiAppUpdate)
+QT_IMPL_METATYPE_EXTERN(QSpiDeviceEvent)
+
+QSpiObjectReference::QSpiObjectReference()
+ : path(QDBusObjectPath(ATSPI_DBUS_PATH_NULL))
+{}
+
+/* QSpiAccessibleCacheArray */
+/*---------------------------------------------------------------------------*/
+
+QDBusArgument &operator<<(QDBusArgument &argument, const QSpiAccessibleCacheItem &item)
+{
+ argument.beginStructure();
+ argument << item.path;
+ argument << item.application;
+ argument << item.parent;
+ argument << item.children;
+ argument << item.supportedInterfaces;
+ argument << item.name;
+ argument << item.role;
+ argument << item.description;
+ argument << item.state;
+ argument.endStructure();
+ return argument;
+}
+
+const QDBusArgument &operator>>(const QDBusArgument &argument, QSpiAccessibleCacheItem &item)
+{
+ argument.beginStructure();
+ argument >> item.path;
+ argument >> item.application;
+ argument >> item.parent;
+ argument >> item.children;
+ argument >> item.supportedInterfaces;
+ argument >> item.name;
+ argument >> item.role;
+ argument >> item.description;
+ argument >> item.state;
+ argument.endStructure();
+ return argument;
+}
+
+/* QSpiObjectReference */
+/*---------------------------------------------------------------------------*/
+
+QDBusArgument &operator<<(QDBusArgument &argument, const QSpiObjectReference &address)
+{
+ argument.beginStructure();
+ argument << address.service;
+ argument << address.path;
+ argument.endStructure();
+ return argument;
+}
+
+const QDBusArgument &operator>>(const QDBusArgument &argument, QSpiObjectReference &address)
+{
+ argument.beginStructure();
+ argument >> address.service;
+ argument >> address.path;
+ argument.endStructure();
+ return argument;
+}
+
+/* QSpiAction */
+/*---------------------------------------------------------------------------*/
+
+QDBusArgument &operator<<(QDBusArgument &argument, const QSpiAction &action)
+{
+ argument.beginStructure();
+ argument << action.name;
+ argument << action.description;
+ argument << action.keyBinding;
+ argument.endStructure();
+ return argument;
+}
+
+const QDBusArgument &operator>>(const QDBusArgument &argument, QSpiAction &action)
+{
+ argument.beginStructure();
+ argument >> action.name;
+ argument >> action.description;
+ argument >> action.keyBinding;
+ argument.endStructure();
+ return argument;
+}
+
+
+QDBusArgument &operator<<(QDBusArgument &argument, const QSpiEventListener &ev)
+{
+ argument.beginStructure();
+ argument << ev.listenerAddress;
+ argument << ev.eventName;
+ argument.endStructure();
+ return argument;
+}
+
+const QDBusArgument &operator>>(const QDBusArgument &argument, QSpiEventListener &ev)
+{
+ argument.beginStructure();
+ argument >> ev.listenerAddress;
+ argument >> ev.eventName;
+ argument.endStructure();
+ return argument;
+}
+
+/* QSpiAppUpdate */
+/*---------------------------------------------------------------------------*/
+
+QDBusArgument &operator<<(QDBusArgument &argument, const QSpiAppUpdate &update) {
+ argument.beginStructure();
+ argument << update.type << update.address;
+ argument.endStructure();
+ return argument;
+}
+
+const QDBusArgument &operator>>(const QDBusArgument &argument, QSpiAppUpdate &update) {
+ argument.beginStructure();
+ argument >> update.type >> update.address;
+ argument.endStructure();
+ return argument;
+}
+
+/* QSpiRelationArrayEntry */
+/*---------------------------------------------------------------------------*/
+
+QDBusArgument &operator<<(QDBusArgument &argument, const QSpiRelationArrayEntry &entry) {
+ argument.beginStructure();
+ argument << entry.first << entry.second;
+ argument.endStructure();
+ return argument;
+}
+
+const QDBusArgument &operator>>(const QDBusArgument &argument, QSpiRelationArrayEntry &entry) {
+ argument.beginStructure();
+ argument >> entry.first >> entry.second;
+ argument.endStructure();
+ return argument;
+}
+
+/* QSpiDeviceEvent */
+/*---------------------------------------------------------------------------*/
+
+QDBusArgument &operator<<(QDBusArgument &argument, const QSpiDeviceEvent &event) {
+ argument.beginStructure();
+ argument << event.type
+ << event.id
+ << event.hardwareCode
+ << event.modifiers
+ << event.timestamp
+ << event.text
+ << event.isText;
+ argument.endStructure();
+ return argument;
+}
+
+const QDBusArgument &operator>>(const QDBusArgument &argument, QSpiDeviceEvent &event) {
+ argument.beginStructure();
+ argument >> event.type
+ >> event.id
+ >> event.hardwareCode
+ >> event.modifiers
+ >> event.timestamp
+ >> event.text
+ >> event.isText;
+ argument.endStructure();
+ return argument;
+}
+
+void qSpiInitializeStructTypes()
+{
+ qDBusRegisterMetaType<QSpiIntList>();
+ qDBusRegisterMetaType<QSpiUIntList>();
+ qDBusRegisterMetaType<QSpiAccessibleCacheItem>();
+ qDBusRegisterMetaType<QSpiAccessibleCacheArray>();
+ qDBusRegisterMetaType<QSpiObjectReference>();
+ qDBusRegisterMetaType<QSpiObjectReferenceArray>();
+ qDBusRegisterMetaType<QSpiAttributeSet>();
+ qDBusRegisterMetaType<QSpiAction>();
+ qDBusRegisterMetaType<QSpiActionArray>();
+ qDBusRegisterMetaType<QSpiEventListener>();
+ qDBusRegisterMetaType<QSpiEventListenerArray>();
+ qDBusRegisterMetaType<QSpiDeviceEvent>();
+ qDBusRegisterMetaType<QSpiAppUpdate>();
+ qDBusRegisterMetaType<QSpiRelationArrayEntry>();
+ qDBusRegisterMetaType<QSpiRelationArray>();
+}
+
+QT_END_NAMESPACE
+#endif // QT_CONFIG(accessibility)
diff --git a/src/gui/accessible/linux/qspi_struct_marshallers_p.h b/src/gui/accessible/linux/qspi_struct_marshallers_p.h
new file mode 100644
index 0000000000..4338b49dd2
--- /dev/null
+++ b/src/gui/accessible/linux/qspi_struct_marshallers_p.h
@@ -0,0 +1,164 @@
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
+
+
+#ifndef Q_SPI_STRUCT_MARSHALLERS_H
+#define Q_SPI_STRUCT_MARSHALLERS_H
+
+//
+// W A R N I N G
+// -------------
+//
+// This file is not part of the Qt API. It exists purely as an
+// implementation detail. This header file may change from version to
+// version without notice, or even be removed.
+//
+// We mean it.
+//
+
+#include <QtGui/private/qtguiglobal_p.h>
+#include <QtCore/qlist.h>
+#include <QtCore/qpair.h>
+#include <QtDBus/QDBusArgument>
+#include <QtDBus/QDBusConnection>
+#include <QtDBus/QDBusObjectPath>
+
+QT_REQUIRE_CONFIG(accessibility);
+
+QT_BEGIN_NAMESPACE
+
+using QSpiIntList = QList<int>;
+using QSpiUIntList = QList<uint>;
+
+// FIXME: make this copy on write
+struct QSpiObjectReference
+{
+ QString service;
+ QDBusObjectPath path;
+
+ QSpiObjectReference();
+ QSpiObjectReference(const QDBusConnection& connection, const QDBusObjectPath& path)
+ : service(connection.baseService()), path(path) {}
+};
+Q_DECLARE_TYPEINFO(QSpiObjectReference, Q_RELOCATABLE_TYPE); // QDBusObjectPath is movable, even though it
+ // cannot be marked that way until Qt 6
+
+QDBusArgument &operator<<(QDBusArgument &argument, const QSpiObjectReference &address);
+const QDBusArgument &operator>>(const QDBusArgument &argument, QSpiObjectReference &address);
+
+typedef QList<QSpiObjectReference> QSpiObjectReferenceArray;
+
+struct QSpiAccessibleCacheItem
+{
+ QSpiObjectReference path;
+ QSpiObjectReference application;
+ QSpiObjectReference parent;
+ QSpiObjectReferenceArray children;
+ QStringList supportedInterfaces;
+ QString name;
+ uint role;
+ QString description;
+ QSpiUIntList state;
+};
+Q_DECLARE_TYPEINFO(QSpiAccessibleCacheItem, Q_RELOCATABLE_TYPE);
+
+typedef QList<QSpiAccessibleCacheItem> QSpiAccessibleCacheArray;
+
+QDBusArgument &operator<<(QDBusArgument &argument, const QSpiAccessibleCacheItem &item);
+const QDBusArgument &operator>>(const QDBusArgument &argument, QSpiAccessibleCacheItem &item);
+
+struct QSpiAction
+{
+ QString name;
+ QString description;
+ QString keyBinding;
+};
+Q_DECLARE_TYPEINFO(QSpiAction, Q_RELOCATABLE_TYPE);
+
+typedef QList<QSpiAction> QSpiActionArray;
+
+QDBusArgument &operator<<(QDBusArgument &argument, const QSpiAction &action);
+const QDBusArgument &operator>>(const QDBusArgument &argument, QSpiAction &action);
+
+struct QSpiEventListener
+{
+ QString listenerAddress;
+ QString eventName;
+};
+Q_DECLARE_TYPEINFO(QSpiEventListener, Q_RELOCATABLE_TYPE);
+
+typedef QList<QSpiEventListener> QSpiEventListenerArray;
+
+QDBusArgument &operator<<(QDBusArgument &argument, const QSpiEventListener &action);
+const QDBusArgument &operator>>(const QDBusArgument &argument, QSpiEventListener &action);
+
+typedef QPair<unsigned int, QSpiObjectReferenceArray> QSpiRelationArrayEntry;
+typedef QList<QSpiRelationArrayEntry> QSpiRelationArray;
+
+//a(iisv)
+struct QSpiTextRange {
+ int startOffset;
+ int endOffset;
+ QString contents;
+ QVariant v;
+};
+Q_DECLARE_TYPEINFO(QSpiTextRange, Q_RELOCATABLE_TYPE);
+
+typedef QList<QSpiTextRange> QSpiTextRangeList;
+typedef QMap <QString, QString> QSpiAttributeSet;
+
+enum QSpiAppUpdateType {
+ QSPI_APP_UPDATE_ADDED = 0,
+ QSPI_APP_UPDATE_REMOVED = 1
+};
+Q_DECLARE_TYPEINFO(QSpiAppUpdateType, Q_PRIMITIVE_TYPE);
+
+struct QSpiAppUpdate {
+ int type; /* Is an application added or removed */
+ QString address; /* D-Bus address of application added or removed */
+};
+Q_DECLARE_TYPEINFO(QSpiAppUpdate, Q_RELOCATABLE_TYPE);
+
+QDBusArgument &operator<<(QDBusArgument &argument, const QSpiAppUpdate &update);
+const QDBusArgument &operator>>(const QDBusArgument &argument, QSpiAppUpdate &update);
+
+struct QSpiDeviceEvent {
+ unsigned int type;
+ int id;
+ int hardwareCode;
+ int modifiers;
+ int timestamp;
+ QString text;
+ bool isText;
+};
+Q_DECLARE_TYPEINFO(QSpiDeviceEvent, Q_RELOCATABLE_TYPE);
+
+QDBusArgument &operator<<(QDBusArgument &argument, const QSpiDeviceEvent &event);
+const QDBusArgument &operator>>(const QDBusArgument &argument, QSpiDeviceEvent &event);
+
+void qSpiInitializeStructTypes();
+
+QT_END_NAMESPACE
+
+QT_DECL_METATYPE_EXTERN(QSpiIntList, /* not exported */)
+QT_DECL_METATYPE_EXTERN(QSpiUIntList, /* not exported */)
+QT_DECL_METATYPE_EXTERN(QSpiObjectReference, /* not exported */)
+QT_DECL_METATYPE_EXTERN(QSpiObjectReferenceArray, /* not exported */)
+QT_DECL_METATYPE_EXTERN(QSpiAccessibleCacheItem, /* not exported */)
+QT_DECL_METATYPE_EXTERN(QSpiAccessibleCacheArray, /* not exported */)
+QT_DECL_METATYPE_EXTERN(QSpiAction, /* not exported */)
+QT_DECL_METATYPE_EXTERN(QSpiActionArray, /* not exported */)
+QT_DECL_METATYPE_EXTERN(QSpiEventListener, /* not exported */)
+QT_DECL_METATYPE_EXTERN(QSpiEventListenerArray, /* not exported */)
+QT_DECL_METATYPE_EXTERN(QSpiRelationArrayEntry, /* not exported */)
+QT_DECL_METATYPE_EXTERN(QSpiRelationArray, /* not exported */)
+QT_DECL_METATYPE_EXTERN(QSpiTextRange, /* not exported */)
+QT_DECL_METATYPE_EXTERN(QSpiTextRangeList, /* not exported */)
+QT_DECL_METATYPE_EXTERN(QSpiAttributeSet, /* not exported */)
+QT_DECL_METATYPE_EXTERN(QSpiAppUpdate, /* not exported */)
+QT_DECL_METATYPE_EXTERN(QSpiDeviceEvent, /* not exported */)
+
+// For qdbusxml2cpp-generated code
+QT_USE_NAMESPACE
+
+#endif /* Q_SPI_STRUCT_MARSHALLERS_H */
diff --git a/src/gui/accessible/linux/qspiaccessiblebridge.cpp b/src/gui/accessible/linux/qspiaccessiblebridge.cpp
new file mode 100644
index 0000000000..de2e7d5fc0
--- /dev/null
+++ b/src/gui/accessible/linux/qspiaccessiblebridge.cpp
@@ -0,0 +1,283 @@
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
+
+
+#include "qspiaccessiblebridge_p.h"
+
+#include <atspi/atspi-constants.h>
+#include <private/qguiapplication_p.h>
+#include <qpa/qplatformintegration.h>
+#include <qstring.h>
+
+#include "atspiadaptor_p.h"
+
+#include "qspidbuscache_p.h"
+#include "qspi_constant_mappings_p.h"
+#include "dbusconnection_p.h"
+#include "qspi_struct_marshallers_p.h"
+
+#if QT_CONFIG(accessibility)
+#include "deviceeventcontroller_adaptor.h"
+
+QT_BEGIN_NAMESPACE
+
+using namespace Qt::StringLiterals;
+
+/*!
+ \class QSpiAccessibleBridge
+ \internal
+*/
+
+QSpiAccessibleBridge::QSpiAccessibleBridge()
+ : cache(nullptr), dec(nullptr), dbusAdaptor(nullptr)
+{
+ dbusConnection = new DBusConnection();
+ connect(dbusConnection, SIGNAL(enabledChanged(bool)), this, SLOT(enabledChanged(bool)));
+ // Now that we have connected the signal, make sure we didn't miss a change,
+ // e.g. when running as root or when AT_SPI_BUS_ADDRESS is set by hand.
+ // But do that only on next loop, once dbus is really settled.
+ QTimer::singleShot(
+ 0, this, [this]{
+ if (dbusConnection->isEnabled() && dbusConnection->connection().isConnected())
+ enabledChanged(true);
+ });
+}
+
+void QSpiAccessibleBridge::enabledChanged(bool enabled)
+{
+ setActive(enabled);
+ updateStatus();
+}
+
+QSpiAccessibleBridge::~QSpiAccessibleBridge()
+{
+ delete dbusConnection;
+} // Qt currently doesn't delete plugins.
+
+QDBusConnection QSpiAccessibleBridge::dBusConnection() const
+{
+ return dbusConnection->connection();
+}
+
+void QSpiAccessibleBridge::updateStatus()
+{
+ // create the adaptor to handle everything if we are in enabled state
+ if (!dbusAdaptor && isActive()) {
+ qSpiInitializeStructTypes();
+ initializeConstantMappings();
+
+ cache = new QSpiDBusCache(dbusConnection->connection(), this);
+ dec = new DeviceEventControllerAdaptor(this);
+
+ dbusConnection->connection().registerObject(ATSPI_DBUS_PATH_DEC ""_L1, this, QDBusConnection::ExportAdaptors);
+
+ dbusAdaptor = new AtSpiAdaptor(dbusConnection, this);
+ dbusConnection->connection().registerVirtualObject(QSPI_OBJECT_PATH_ACCESSIBLE ""_L1, dbusAdaptor, QDBusConnection::SubPath);
+ dbusAdaptor->registerApplication();
+ }
+}
+
+void QSpiAccessibleBridge::notifyAccessibilityUpdate(QAccessibleEvent *event)
+{
+ if (!dbusAdaptor)
+ return;
+ if (isActive() && event->accessibleInterface())
+ dbusAdaptor->notify(event);
+}
+
+struct RoleMapping {
+ QAccessible::Role role;
+ AtspiRole spiRole;
+ const char *name;
+};
+
+static RoleMapping map[] = {
+ //: Role of an accessible object - the object is in an invalid state or could not be constructed
+ { QAccessible::NoRole, ATSPI_ROLE_INVALID, QT_TRANSLATE_NOOP("QSpiAccessibleBridge", "invalid role") },
+ //: Role of an accessible object
+ { QAccessible::TitleBar, ATSPI_ROLE_TEXT, QT_TRANSLATE_NOOP("QSpiAccessibleBridge", "title bar") },
+ //: Role of an accessible object
+ { QAccessible::MenuBar, ATSPI_ROLE_MENU_BAR, QT_TRANSLATE_NOOP("QSpiAccessibleBridge", "menu bar") },
+ //: Role of an accessible object
+ { QAccessible::ScrollBar, ATSPI_ROLE_SCROLL_BAR, QT_TRANSLATE_NOOP("QSpiAccessibleBridge", "scroll bar") },
+ //: Role of an accessible object - the grip is usually used for resizing another object
+ { QAccessible::Grip, ATSPI_ROLE_UNKNOWN, QT_TRANSLATE_NOOP("QSpiAccessibleBridge", "grip") },
+ //: Role of an accessible object
+ { QAccessible::Sound, ATSPI_ROLE_UNKNOWN, QT_TRANSLATE_NOOP("QSpiAccessibleBridge", "sound") },
+ //: Role of an accessible object
+ { QAccessible::Cursor, ATSPI_ROLE_UNKNOWN, QT_TRANSLATE_NOOP("QSpiAccessibleBridge", "cursor") },
+ //: Role of an accessible object
+ { QAccessible::Caret, ATSPI_ROLE_UNKNOWN, QT_TRANSLATE_NOOP("QSpiAccessibleBridge", "text caret") },
+ //: Role of an accessible object
+ { QAccessible::AlertMessage, ATSPI_ROLE_ALERT, QT_TRANSLATE_NOOP("QSpiAccessibleBridge", "alert message") },
+ //: Role of an accessible object: a window with frame and title
+ { QAccessible::Window, ATSPI_ROLE_FRAME, QT_TRANSLATE_NOOP("QSpiAccessibleBridge", "frame") },
+ //: Role of an accessible object
+ { QAccessible::Client, ATSPI_ROLE_FILLER, QT_TRANSLATE_NOOP("QSpiAccessibleBridge", "filler") },
+ //: Role of an accessible object
+ { QAccessible::PopupMenu, ATSPI_ROLE_POPUP_MENU, QT_TRANSLATE_NOOP("QSpiAccessibleBridge", "popup menu") },
+ //: Role of an accessible object
+ { QAccessible::MenuItem, ATSPI_ROLE_MENU_ITEM, QT_TRANSLATE_NOOP("QSpiAccessibleBridge", "menu item") },
+ //: Role of an accessible object
+ { QAccessible::ToolTip, ATSPI_ROLE_TOOL_TIP, QT_TRANSLATE_NOOP("QSpiAccessibleBridge", "tool tip") },
+ //: Role of an accessible object
+ { QAccessible::Application, ATSPI_ROLE_APPLICATION, QT_TRANSLATE_NOOP("QSpiAccessibleBridge", "application") },
+ //: Role of an accessible object
+ { QAccessible::Document, ATSPI_ROLE_DOCUMENT_FRAME, QT_TRANSLATE_NOOP("QSpiAccessibleBridge", "document") },
+ //: Role of an accessible object
+ { QAccessible::Pane, ATSPI_ROLE_PANEL, QT_TRANSLATE_NOOP("QSpiAccessibleBridge", "panel") },
+ //: Role of an accessible object
+ { QAccessible::Chart, ATSPI_ROLE_CHART, QT_TRANSLATE_NOOP("QSpiAccessibleBridge", "chart") },
+ //: Role of an accessible object
+ { QAccessible::Dialog, ATSPI_ROLE_DIALOG, QT_TRANSLATE_NOOP("QSpiAccessibleBridge", "dialog") },
+ //: Role of an accessible object
+ { QAccessible::Border, ATSPI_ROLE_FRAME, QT_TRANSLATE_NOOP("QSpiAccessibleBridge", "frame") },
+ //: Role of an accessible object
+ { QAccessible::Grouping, ATSPI_ROLE_PANEL, QT_TRANSLATE_NOOP("QSpiAccessibleBridge", "panel") },
+ //: Role of an accessible object
+ { QAccessible::Separator, ATSPI_ROLE_SEPARATOR, QT_TRANSLATE_NOOP("QSpiAccessibleBridge", "separator") },
+ //: Role of an accessible object
+ { QAccessible::ToolBar, ATSPI_ROLE_TOOL_BAR, QT_TRANSLATE_NOOP("QSpiAccessibleBridge", "tool bar") },
+ //: Role of an accessible object
+ { QAccessible::StatusBar, ATSPI_ROLE_STATUS_BAR, QT_TRANSLATE_NOOP("QSpiAccessibleBridge", "status bar") },
+ //: Role of an accessible object
+ { QAccessible::Table, ATSPI_ROLE_TABLE, QT_TRANSLATE_NOOP("QSpiAccessibleBridge", "table") },
+ //: Role of an accessible object - part of a table
+ { QAccessible::ColumnHeader, ATSPI_ROLE_TABLE_COLUMN_HEADER, QT_TRANSLATE_NOOP("QSpiAccessibleBridge", "column header") },
+ //: Role of an accessible object - part of a table
+ { QAccessible::RowHeader, ATSPI_ROLE_TABLE_ROW_HEADER, QT_TRANSLATE_NOOP("QSpiAccessibleBridge", "row header") },
+ //: Role of an accessible object - part of a table
+ { QAccessible::Column, ATSPI_ROLE_TABLE_CELL, QT_TRANSLATE_NOOP("QSpiAccessibleBridge", "column") },
+ //: Role of an accessible object - part of a table
+ { QAccessible::Row, ATSPI_ROLE_TABLE_ROW, QT_TRANSLATE_NOOP("QSpiAccessibleBridge", "row") },
+ //: Role of an accessible object - part of a table
+ { QAccessible::Cell, ATSPI_ROLE_TABLE_CELL, QT_TRANSLATE_NOOP("QSpiAccessibleBridge", "cell") },
+ //: Role of an accessible object
+ { QAccessible::Link, ATSPI_ROLE_LINK, QT_TRANSLATE_NOOP("QSpiAccessibleBridge", "link") },
+ //: Role of an accessible object
+ { QAccessible::HelpBalloon, ATSPI_ROLE_DIALOG, QT_TRANSLATE_NOOP("QSpiAccessibleBridge", "help balloon") },
+ //: Role of an accessible object - a helper dialog
+ { QAccessible::Assistant, ATSPI_ROLE_DIALOG, QT_TRANSLATE_NOOP("QSpiAccessibleBridge", "assistant") },
+ //: Role of an accessible object
+ { QAccessible::List, ATSPI_ROLE_LIST, QT_TRANSLATE_NOOP("QSpiAccessibleBridge", "list") },
+ //: Role of an accessible object
+ { QAccessible::ListItem, ATSPI_ROLE_LIST_ITEM, QT_TRANSLATE_NOOP("QSpiAccessibleBridge", "list item") },
+ //: Role of an accessible object
+ { QAccessible::Tree, ATSPI_ROLE_TREE, QT_TRANSLATE_NOOP("QSpiAccessibleBridge", "tree") },
+ //: Role of an accessible object
+ { QAccessible::TreeItem, ATSPI_ROLE_TABLE_CELL, QT_TRANSLATE_NOOP("QSpiAccessibleBridge", "tree item") },
+ //: Role of an accessible object
+ { QAccessible::PageTab, ATSPI_ROLE_PAGE_TAB, QT_TRANSLATE_NOOP("QSpiAccessibleBridge", "page tab") },
+ //: Role of an accessible object
+ { QAccessible::PropertyPage, ATSPI_ROLE_PAGE_TAB, QT_TRANSLATE_NOOP("QSpiAccessibleBridge", "property page") },
+ //: Role of an accessible object
+ { QAccessible::Indicator, ATSPI_ROLE_UNKNOWN, QT_TRANSLATE_NOOP("QSpiAccessibleBridge", "indicator") },
+ //: Role of an accessible object
+ { QAccessible::Graphic, ATSPI_ROLE_IMAGE, QT_TRANSLATE_NOOP("QSpiAccessibleBridge", "graphic") },
+ //: Role of an accessible object
+ { QAccessible::StaticText, ATSPI_ROLE_LABEL, QT_TRANSLATE_NOOP("QSpiAccessibleBridge", "label") },
+ //: Role of an accessible object
+ { QAccessible::EditableText, ATSPI_ROLE_TEXT, QT_TRANSLATE_NOOP("QSpiAccessibleBridge", "text") },
+ //: Role of an accessible object
+ { QAccessible::PushButton, ATSPI_ROLE_PUSH_BUTTON, QT_TRANSLATE_NOOP("QSpiAccessibleBridge", "push button") },
+ //: Role of an accessible object
+ { QAccessible::CheckBox, ATSPI_ROLE_CHECK_BOX, QT_TRANSLATE_NOOP("QSpiAccessibleBridge", "check box") },
+ //: Role of an accessible object
+ { QAccessible::RadioButton, ATSPI_ROLE_RADIO_BUTTON, QT_TRANSLATE_NOOP("QSpiAccessibleBridge", "radio button") },
+ //: Role of an accessible object
+ { QAccessible::ComboBox, ATSPI_ROLE_COMBO_BOX, QT_TRANSLATE_NOOP("QSpiAccessibleBridge", "combo box") },
+ //: Role of an accessible object
+ { QAccessible::ProgressBar, ATSPI_ROLE_PROGRESS_BAR, QT_TRANSLATE_NOOP("QSpiAccessibleBridge", "progress bar") },
+ //: Role of an accessible object
+ { QAccessible::Dial, ATSPI_ROLE_DIAL, QT_TRANSLATE_NOOP("QSpiAccessibleBridge", "dial") },
+ //: Role of an accessible object
+ { QAccessible::HotkeyField, ATSPI_ROLE_TEXT, QT_TRANSLATE_NOOP("QSpiAccessibleBridge", "hotkey field") },
+ //: Role of an accessible object
+ { QAccessible::Slider, ATSPI_ROLE_SLIDER, QT_TRANSLATE_NOOP("QSpiAccessibleBridge", "slider") },
+ //: Role of an accessible object
+ { QAccessible::SpinBox, ATSPI_ROLE_SPIN_BUTTON, QT_TRANSLATE_NOOP("QSpiAccessibleBridge", "spin box") },
+ //: Role of an accessible object
+ { QAccessible::Canvas, ATSPI_ROLE_CANVAS, QT_TRANSLATE_NOOP("QSpiAccessibleBridge", "canvas") },
+ //: Role of an accessible object
+ { QAccessible::Animation, ATSPI_ROLE_ANIMATION, QT_TRANSLATE_NOOP("QSpiAccessibleBridge", "animation") },
+ //: Role of an accessible object
+ { QAccessible::Equation, ATSPI_ROLE_TEXT, QT_TRANSLATE_NOOP("QSpiAccessibleBridge", "equation") },
+ //: Role of an accessible object
+ { QAccessible::ButtonDropDown, ATSPI_ROLE_PUSH_BUTTON, QT_TRANSLATE_NOOP("QSpiAccessibleBridge", "button with drop down") },
+ //: Role of an accessible object
+#if ATSPI_ROLE_COUNT > 130
+ { QAccessible::ButtonMenu, ATSPI_ROLE_PUSH_BUTTON_MENU, QT_TRANSLATE_NOOP("QSpiAccessibleBridge", "button menu") },
+#else
+ { QAccessible::ButtonMenu, ATSPI_ROLE_PUSH_BUTTON, QT_TRANSLATE_NOOP("QSpiAccessibleBridge", "button menu") },
+#endif
+ //: Role of an accessible object - a button that expands a grid.
+ { QAccessible::ButtonDropGrid, ATSPI_ROLE_PUSH_BUTTON, QT_TRANSLATE_NOOP("QSpiAccessibleBridge", "button with drop down grid") },
+ //: Role of an accessible object - blank space between other objects.
+ { QAccessible::Whitespace, ATSPI_ROLE_FILLER, QT_TRANSLATE_NOOP("QSpiAccessibleBridge", "space") },
+ //: Role of an accessible object
+ { QAccessible::PageTabList, ATSPI_ROLE_PAGE_TAB_LIST, QT_TRANSLATE_NOOP("QSpiAccessibleBridge", "page tab list") },
+ //: Role of an accessible object
+ { QAccessible::Clock, ATSPI_ROLE_UNKNOWN, QT_TRANSLATE_NOOP("QSpiAccessibleBridge", "clock") },
+ //: Role of an accessible object
+ { QAccessible::Splitter, ATSPI_ROLE_SPLIT_PANE, QT_TRANSLATE_NOOP("QSpiAccessibleBridge", "splitter") },
+ //: Role of an accessible object
+ { QAccessible::LayeredPane, ATSPI_ROLE_LAYERED_PANE, QT_TRANSLATE_NOOP("QSpiAccessibleBridge", "layered pane") },
+ //: Role of an accessible object
+ { QAccessible::WebDocument, ATSPI_ROLE_DOCUMENT_WEB, QT_TRANSLATE_NOOP("QSpiAccessibleBridge", "web document") },
+ //: Role of an accessible object
+ { QAccessible::Paragraph, ATSPI_ROLE_PARAGRAPH, QT_TRANSLATE_NOOP("QSpiAccessibleBridge", "paragraph") },
+ //: Role of an accessible object
+ { QAccessible::Section, ATSPI_ROLE_SECTION, QT_TRANSLATE_NOOP("QSpiAccessibleBridge", "section") },
+ //: Role of an accessible object
+ { QAccessible::ColorChooser, ATSPI_ROLE_COLOR_CHOOSER, QT_TRANSLATE_NOOP("QSpiAccessibleBridge", "color chooser") },
+ //: Role of an accessible object
+ { QAccessible::Footer, ATSPI_ROLE_FOOTER, QT_TRANSLATE_NOOP("QSpiAccessibleBridge", "footer") },
+ //: Role of an accessible object
+ { QAccessible::Form, ATSPI_ROLE_FORM, QT_TRANSLATE_NOOP("QSpiAccessibleBridge", "form") },
+ //: Role of an accessible object
+ { QAccessible::Heading, ATSPI_ROLE_HEADING, QT_TRANSLATE_NOOP("QSpiAccessibleBridge", "heading") },
+ //: Role of an accessible object
+ { QAccessible::Note, ATSPI_ROLE_COMMENT, QT_TRANSLATE_NOOP("QSpiAccessibleBridge", "note") },
+ //: Role of an accessible object
+ { QAccessible::ComplementaryContent, ATSPI_ROLE_SECTION, QT_TRANSLATE_NOOP("QSpiAccessibleBridge", "complementary content") },
+ //: Role of an accessible object
+ { QAccessible::Terminal, ATSPI_ROLE_TERMINAL, QT_TRANSLATE_NOOP("QSpiAccessibleBridge", "terminal") },
+ //: Role of an accessible object
+ { QAccessible::Desktop, ATSPI_ROLE_DESKTOP_FRAME, QT_TRANSLATE_NOOP("QSpiAccessibleBridge", "desktop") },
+ //: Role of an accessible object
+ { QAccessible::Notification, ATSPI_ROLE_NOTIFICATION, QT_TRANSLATE_NOOP("QSpiAccessibleBridge", "notification") },
+ //: Role of an accessible object
+ { QAccessible::UserRole, ATSPI_ROLE_UNKNOWN, QT_TRANSLATE_NOOP("QSpiAccessibleBridge", "unknown") }
+};
+
+void QSpiAccessibleBridge::initializeConstantMappings()
+{
+ for (uint i = 0; i < sizeof(map) / sizeof(RoleMapping); ++i)
+ m_spiRoleMapping.insert(map[i].role, RoleNames(map[i].spiRole, QLatin1StringView(map[i].name), tr(map[i].name)));
+
+ // -1 because we have button duplicated, as PushButton and Button.
+ Q_ASSERT_X(m_spiRoleMapping.size() ==
+ QAccessible::staticMetaObject.enumerator(
+ QAccessible::staticMetaObject.indexOfEnumerator("Role")).keyCount() - 1,
+ "", "Handle all QAccessible::Role members in qSpiRoleMapping");
+}
+
+QSpiAccessibleBridge *QSpiAccessibleBridge::instance()
+{
+ if (auto integration = QGuiApplicationPrivate::platformIntegration()) {
+ if (auto accessibility = integration->accessibility())
+ return static_cast<QSpiAccessibleBridge *>(accessibility);
+ }
+ return nullptr;
+}
+
+RoleNames QSpiAccessibleBridge::namesForRole(QAccessible::Role role)
+{
+ auto brigde = QSpiAccessibleBridge::instance();
+ return brigde ? brigde->spiRoleNames().value(role) : RoleNames();
+}
+
+QT_END_NAMESPACE
+
+#include "moc_qspiaccessiblebridge_p.cpp"
+#endif // QT_CONFIG(accessibility)
diff --git a/src/gui/accessible/linux/qspiaccessiblebridge_p.h b/src/gui/accessible/linux/qspiaccessiblebridge_p.h
new file mode 100644
index 0000000000..5ad48c5cc4
--- /dev/null
+++ b/src/gui/accessible/linux/qspiaccessiblebridge_p.h
@@ -0,0 +1,69 @@
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
+
+
+#ifndef QSPIACCESSIBLEBRIDGE_H
+#define QSPIACCESSIBLEBRIDGE_H
+
+//
+// W A R N I N G
+// -------------
+//
+// This file is not part of the Qt API. It exists purely as an
+// implementation detail. This header file may change from version to
+// version without notice, or even be removed.
+//
+// We mean it.
+//
+
+#include <QtGui/private/qtguiglobal_p.h>
+#include <QtDBus/qdbusconnection.h>
+#include <qpa/qplatformaccessibility.h>
+#include <QtCore/qhash.h>
+
+class DeviceEventControllerAdaptor;
+
+QT_REQUIRE_CONFIG(accessibility);
+
+QT_BEGIN_NAMESPACE
+
+class DBusConnection;
+class QSpiDBusCache;
+class AtSpiAdaptor;
+struct RoleNames;
+
+class Q_GUI_EXPORT QSpiAccessibleBridge: public QObject, public QPlatformAccessibility
+{
+ Q_OBJECT
+public:
+ using SpiRoleMapping = QHash <QAccessible::Role, RoleNames>;
+
+ QSpiAccessibleBridge();
+
+ virtual ~QSpiAccessibleBridge();
+
+ void notifyAccessibilityUpdate(QAccessibleEvent *event) override;
+ QDBusConnection dBusConnection() const;
+
+ const SpiRoleMapping &spiRoleNames() const { return m_spiRoleMapping; }
+
+ static QSpiAccessibleBridge *instance();
+ static RoleNames namesForRole(QAccessible::Role role);
+
+public Q_SLOTS:
+ void enabledChanged(bool enabled);
+
+private:
+ void initializeConstantMappings();
+ void updateStatus();
+
+ QSpiDBusCache *cache;
+ DeviceEventControllerAdaptor *dec;
+ AtSpiAdaptor *dbusAdaptor;
+ DBusConnection* dbusConnection;
+ SpiRoleMapping m_spiRoleMapping;
+};
+
+QT_END_NAMESPACE
+
+#endif
diff --git a/src/gui/accessible/linux/qspiapplicationadaptor.cpp b/src/gui/accessible/linux/qspiapplicationadaptor.cpp
new file mode 100644
index 0000000000..37d7648984
--- /dev/null
+++ b/src/gui/accessible/linux/qspiapplicationadaptor.cpp
@@ -0,0 +1,213 @@
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
+
+
+#include "qspiapplicationadaptor_p.h"
+
+#include <QtCore/qcoreapplication.h>
+#include <QtDBus/qdbuspendingreply.h>
+#include <qdebug.h>
+
+#if QT_CONFIG(accessibility)
+#include "deviceeventcontroller_adaptor.h"
+#include "atspi/atspi-constants.h"
+
+#if __has_include(<xcb/xproto.h>)
+#include <xcb/xproto.h>
+#endif
+
+//#define KEYBOARD_DEBUG
+
+QT_BEGIN_NAMESPACE
+
+using namespace Qt::Literals::StringLiterals;
+
+/*!
+ \class QSpiApplicationAdaptor
+ \internal
+
+ \brief QSpiApplicationAdaptor
+
+ QSpiApplicationAdaptor
+*/
+
+QSpiApplicationAdaptor::QSpiApplicationAdaptor(const QDBusConnection &connection, QObject *parent)
+ : QObject(parent), dbusConnection(connection)
+{
+}
+
+enum QSpiKeyEventType {
+ QSPI_KEY_EVENT_PRESS,
+ QSPI_KEY_EVENT_RELEASE,
+ QSPI_KEY_EVENT_LAST_DEFINED
+};
+
+void QSpiApplicationAdaptor::sendEvents(bool active)
+{
+ if (active) {
+ qApp->installEventFilter(this);
+ } else {
+ qApp->removeEventFilter(this);
+ }
+}
+
+
+bool QSpiApplicationAdaptor::eventFilter(QObject *target, QEvent *event)
+{
+ if (!event->spontaneous())
+ return false;
+
+ switch (event->type()) {
+ case QEvent::WindowActivate:
+ emit windowActivated(target, true);
+ break;
+ case QEvent::WindowDeactivate:
+ emit windowActivated(target, false);
+ break;
+ case QEvent::KeyPress:
+ case QEvent::KeyRelease: {
+ QKeyEvent *keyEvent = static_cast <QKeyEvent *>(event);
+ QSpiDeviceEvent de;
+
+ if (event->type() == QEvent::KeyPress)
+ de.type = QSPI_KEY_EVENT_PRESS;
+ else
+ de.type = QSPI_KEY_EVENT_RELEASE;
+
+ de.id = keyEvent->nativeVirtualKey();
+ de.hardwareCode = keyEvent->nativeScanCode();
+
+ de.timestamp = QDateTime::currentMSecsSinceEpoch();
+
+ if (keyEvent->key() == Qt::Key_Tab)
+ de.text = QStringLiteral("Tab");
+ else if (keyEvent->key() == Qt::Key_Backtab)
+ de.text = QStringLiteral("Backtab");
+ else if (keyEvent->key() == Qt::Key_Control)
+ de.text = QStringLiteral("Control_L");
+ else if (keyEvent->key() == Qt::Key_Left)
+ de.text = (keyEvent->modifiers() & Qt::KeypadModifier) ? QStringLiteral("KP_Left") : QStringLiteral("Left");
+ else if (keyEvent->key() == Qt::Key_Right)
+ de.text = (keyEvent->modifiers() & Qt::KeypadModifier) ? QStringLiteral("KP_Right") : QStringLiteral("Right");
+ else if (keyEvent->key() == Qt::Key_Up)
+ de.text = (keyEvent->modifiers() & Qt::KeypadModifier) ? QStringLiteral("KP_Up") : QStringLiteral("Up");
+ else if (keyEvent->key() == Qt::Key_Down)
+ de.text = (keyEvent->modifiers() & Qt::KeypadModifier) ? QStringLiteral("KP_Down") : QStringLiteral("Down");
+ else if (keyEvent->key() == Qt::Key_Enter || keyEvent->key() == Qt::Key_Return)
+ de.text = QStringLiteral("Return");
+ else if (keyEvent->key() == Qt::Key_Backspace)
+ de.text = QStringLiteral("BackSpace");
+ else if (keyEvent->key() == Qt::Key_Delete)
+ de.text = QStringLiteral("Delete");
+ else if (keyEvent->key() == Qt::Key_PageUp)
+ de.text = (keyEvent->modifiers() & Qt::KeypadModifier) ? QStringLiteral("KP_Page_Up") : QStringLiteral("Page_Up");
+ else if (keyEvent->key() == Qt::Key_PageDown)
+ de.text = (keyEvent->modifiers() & Qt::KeypadModifier) ? QStringLiteral("KP_Page_Up") : QStringLiteral("Page_Down");
+ else if (keyEvent->key() == Qt::Key_Home)
+ de.text = (keyEvent->modifiers() & Qt::KeypadModifier) ? QStringLiteral("KP_Home") : QStringLiteral("Home");
+ else if (keyEvent->key() == Qt::Key_End)
+ de.text = (keyEvent->modifiers() & Qt::KeypadModifier) ? QStringLiteral("KP_End") : QStringLiteral("End");
+ else if (keyEvent->key() == Qt::Key_Clear && (keyEvent->modifiers() & Qt::KeypadModifier))
+ de.text = QStringLiteral("KP_Begin"); // Key pad 5
+ else if (keyEvent->key() == Qt::Key_Escape)
+ de.text = QStringLiteral("Escape");
+ else if (keyEvent->key() == Qt::Key_Space)
+ de.text = QStringLiteral("space");
+ else if (keyEvent->key() == Qt::Key_CapsLock)
+ de.text = QStringLiteral("Caps_Lock");
+ else if (keyEvent->key() == Qt::Key_NumLock)
+ de.text = QStringLiteral("Num_Lock");
+ else if (keyEvent->key() == Qt::Key_Insert)
+ de.text = QStringLiteral("Insert");
+ else
+ de.text = keyEvent->text();
+
+ // This is a bit dubious, Gnome uses some gtk function here.
+ // Long term the spec will hopefully change to just use keycodes.
+ de.isText = !de.text.isEmpty();
+
+ de.modifiers = 0;
+ if ((keyEvent->modifiers() & Qt::ShiftModifier) && (keyEvent->key() != Qt::Key_Shift))
+ de.modifiers |= 1 << ATSPI_MODIFIER_SHIFT;
+#ifdef XCB_MOD_MASK_LOCK
+ if (QGuiApplication::platformName().startsWith("xcb"_L1)) {
+ // TODO rather introduce Qt::CapslockModifier into KeyboardModifier
+ if (keyEvent->nativeModifiers() & XCB_MOD_MASK_LOCK )
+ de.modifiers |= 1 << ATSPI_MODIFIER_SHIFTLOCK;
+ }
+#endif
+ if ((keyEvent->modifiers() & Qt::ControlModifier) && (keyEvent->key() != Qt::Key_Control))
+ de.modifiers |= 1 << ATSPI_MODIFIER_CONTROL;
+ if ((keyEvent->modifiers() & Qt::AltModifier) && (keyEvent->key() != Qt::Key_Alt))
+ de.modifiers |= 1 << ATSPI_MODIFIER_ALT;
+ if ((keyEvent->modifiers() & Qt::MetaModifier) && (keyEvent->key() != Qt::Key_Meta))
+ de.modifiers |= 1 << ATSPI_MODIFIER_META;
+
+#ifdef KEYBOARD_DEBUG
+ qDebug() << "Key event text:" << event->type() << de.text
+ << "native virtual key:" << de.id
+ << "hardware code/scancode:" << de.hardwareCode
+ << "modifiers:" << de.modifiers
+ << "text:" << de.text;
+#endif
+
+ QDBusMessage m = QDBusMessage::createMethodCall(QStringLiteral("org.a11y.atspi.Registry"),
+ QStringLiteral("/org/a11y/atspi/registry/deviceeventcontroller"),
+ QStringLiteral("org.a11y.atspi.DeviceEventController"), QStringLiteral("NotifyListenersSync"));
+ m.setArguments(QVariantList() << QVariant::fromValue(de));
+
+ // FIXME: this is critical, the timeout should probably be pretty low to allow normal processing
+ int timeout = 100;
+ bool sent = dbusConnection.callWithCallback(m, this, SLOT(notifyKeyboardListenerCallback(QDBusMessage)),
+ SLOT(notifyKeyboardListenerError(QDBusError,QDBusMessage)), timeout);
+ if (sent) {
+ //queue the event and send it after callback
+ keyEvents.enqueue(QPair<QPointer<QObject>, QKeyEvent*> (QPointer<QObject>(target), copyKeyEvent(keyEvent)));
+ return true;
+ }
+ }
+ default:
+ break;
+ }
+ return false;
+}
+
+QKeyEvent* QSpiApplicationAdaptor::copyKeyEvent(QKeyEvent* old)
+{
+ return new QKeyEvent(old->type(), old->key(), old->modifiers(),
+ old->nativeScanCode(), old->nativeVirtualKey(), old->nativeModifiers(),
+ old->text(), old->isAutoRepeat(), old->count());
+}
+
+void QSpiApplicationAdaptor::notifyKeyboardListenerCallback(const QDBusMessage& message)
+{
+ if (!keyEvents.size()) {
+ qWarning("QSpiApplication::notifyKeyboardListenerCallback with no queued key called");
+ return;
+ }
+ Q_ASSERT(message.arguments().size() == 1);
+ if (message.arguments().at(0).toBool() == true) {
+ QPair<QPointer<QObject>, QKeyEvent*> event = keyEvents.dequeue();
+ delete event.second;
+ } else {
+ QPair<QPointer<QObject>, QKeyEvent*> event = keyEvents.dequeue();
+ if (event.first)
+ QCoreApplication::postEvent(event.first.data(), event.second);
+ }
+}
+
+void QSpiApplicationAdaptor::notifyKeyboardListenerError(const QDBusError& error, const QDBusMessage& /*message*/)
+{
+ qWarning() << "QSpiApplication::keyEventError " << error.name() << error.message();
+ while (!keyEvents.isEmpty()) {
+ QPair<QPointer<QObject>, QKeyEvent*> event = keyEvents.dequeue();
+ if (event.first)
+ QCoreApplication::postEvent(event.first.data(), event.second);
+ }
+}
+
+QT_END_NAMESPACE
+
+#include "moc_qspiapplicationadaptor_p.cpp"
+
+#endif // QT_CONFIG(accessibility)
diff --git a/src/gui/accessible/linux/qspiapplicationadaptor_p.h b/src/gui/accessible/linux/qspiapplicationadaptor_p.h
new file mode 100644
index 0000000000..b852951385
--- /dev/null
+++ b/src/gui/accessible/linux/qspiapplicationadaptor_p.h
@@ -0,0 +1,62 @@
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
+
+#ifndef Q_SPI_APPLICATION_H
+#define Q_SPI_APPLICATION_H
+
+//
+// W A R N I N G
+// -------------
+//
+// This file is not part of the Qt API. It exists purely as an
+// implementation detail. This header file may change from version to
+// version without notice, or even be removed.
+//
+// We mean it.
+//
+
+#include <QtGui/private/qtguiglobal_p.h>
+#include <QtCore/QPointer>
+#include <QtCore/QQueue>
+#include <QtDBus/QDBusConnection>
+#include <QtGui/QAccessibleInterface>
+Q_MOC_INCLUDE(<QtDBus/QDBusMessage>)
+
+QT_REQUIRE_CONFIG(accessibility);
+
+QT_BEGIN_NAMESPACE
+
+/*
+ * Used for the root object.
+ *
+ * Uses the root object reference and reports its parent as the desktop object.
+ */
+class QSpiApplicationAdaptor :public QObject
+{
+ Q_OBJECT
+
+public:
+ QSpiApplicationAdaptor(const QDBusConnection &connection, QObject *parent);
+ virtual ~QSpiApplicationAdaptor() {}
+ void sendEvents(bool active);
+
+Q_SIGNALS:
+ void windowActivated(QObject* window, bool active);
+
+protected:
+ bool eventFilter(QObject *obj, QEvent *event) override;
+
+private Q_SLOTS:
+ void notifyKeyboardListenerCallback(const QDBusMessage& message);
+ void notifyKeyboardListenerError(const QDBusError& error, const QDBusMessage& message);
+
+private:
+ static QKeyEvent* copyKeyEvent(QKeyEvent*);
+
+ QQueue<QPair<QPointer<QObject>, QKeyEvent*> > keyEvents;
+ QDBusConnection dbusConnection;
+};
+
+QT_END_NAMESPACE
+
+#endif
diff --git a/src/gui/accessible/linux/qspidbuscache.cpp b/src/gui/accessible/linux/qspidbuscache.cpp
new file mode 100644
index 0000000000..fc5d87c319
--- /dev/null
+++ b/src/gui/accessible/linux/qspidbuscache.cpp
@@ -0,0 +1,59 @@
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
+
+
+#include "qspidbuscache_p.h"
+#include "qspiaccessiblebridge_p.h"
+
+#if QT_CONFIG(accessibility)
+#include "cache_adaptor.h"
+
+#define QSPI_OBJECT_PATH_CACHE "/org/a11y/atspi/cache"
+
+QT_BEGIN_NAMESPACE
+
+using namespace Qt::StringLiterals;
+
+/*!
+ \class QSpiDBusCache
+ \internal
+ \brief This class is responsible for the AT-SPI cache interface.
+
+ The idea behind the cache is that starting an application would
+ result in many dbus calls. The way GTK/Gail/ATK work is that
+ they create accessibles for all objects on startup.
+ In order to avoid querying all the objects individually via DBus
+ they get sent by using the GetItems call of the cache.
+
+ Additionally the AddAccessible and RemoveAccessible signals
+ are responsible for adding/removing objects from the cache.
+
+ Currently the Qt bridge chooses to ignore these.
+*/
+
+QSpiDBusCache::QSpiDBusCache(QDBusConnection c, QObject* parent)
+ : QObject(parent)
+{
+ new CacheAdaptor(this);
+ c.registerObject(QSPI_OBJECT_PATH_CACHE ""_L1, this, QDBusConnection::ExportAdaptors);
+}
+
+void QSpiDBusCache::emitAddAccessible(const QSpiAccessibleCacheItem& item)
+{
+ emit AddAccessible(item);
+}
+
+void QSpiDBusCache::emitRemoveAccessible(const QSpiObjectReference& item)
+{
+ emit RemoveAccessible(item);
+}
+
+QSpiAccessibleCacheArray QSpiDBusCache::GetItems()
+{
+ return QSpiAccessibleCacheArray();
+}
+
+QT_END_NAMESPACE
+
+#include "moc_qspidbuscache_p.cpp"
+#endif // QT_CONFIG(accessibility)
diff --git a/src/gui/accessible/linux/qspidbuscache_p.h b/src/gui/accessible/linux/qspidbuscache_p.h
new file mode 100644
index 0000000000..7a6e111f14
--- /dev/null
+++ b/src/gui/accessible/linux/qspidbuscache_p.h
@@ -0,0 +1,46 @@
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
+
+
+#ifndef Q_SPI_CACHE_H
+#define Q_SPI_CACHE_H
+
+//
+// W A R N I N G
+// -------------
+//
+// This file is not part of the Qt API. It exists purely as an
+// implementation detail. This header file may change from version to
+// version without notice, or even be removed.
+//
+// We mean it.
+//
+
+#include <QtGui/private/qtguiglobal_p.h>
+#include <QtCore/QObject>
+#include "qspi_struct_marshallers_p.h"
+
+QT_REQUIRE_CONFIG(accessibility);
+
+QT_BEGIN_NAMESPACE
+
+class QSpiDBusCache : public QObject
+{
+ Q_OBJECT
+
+public:
+ explicit QSpiDBusCache(QDBusConnection c, QObject* parent = nullptr);
+ void emitAddAccessible(const QSpiAccessibleCacheItem& item);
+ void emitRemoveAccessible(const QSpiObjectReference& item);
+
+Q_SIGNALS:
+ void AddAccessible(const QSpiAccessibleCacheItem &nodeAdded);
+ void RemoveAccessible(const QSpiObjectReference &nodeRemoved);
+
+public Q_SLOTS:
+ QSpiAccessibleCacheArray GetItems();
+};
+
+QT_END_NAMESPACE
+
+#endif /* Q_SPI_CACHE_H */
diff --git a/src/gui/accessible/qaccessible.cpp b/src/gui/accessible/qaccessible.cpp
index 7922d6fb06..46bca16dad 100644
--- a/src/gui/accessible/qaccessible.cpp
+++ b/src/gui/accessible/qaccessible.cpp
@@ -1,41 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the QtGui module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2020 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#include "qaccessible.h"
@@ -54,11 +18,14 @@
#include <QtCore/qdebug.h>
#include <QtCore/qloggingcategory.h>
#include <QtCore/qmetaobject.h>
+#include <QtCore/private/qmetaobject_p.h>
#include <QtCore/qhash.h>
#include <private/qfactoryloader_p.h>
QT_BEGIN_NAMESPACE
+using namespace Qt::StringLiterals;
+
Q_LOGGING_CATEGORY(lcAccessibilityCore, "qt.accessibility.core");
/*!
@@ -162,7 +129,6 @@ Q_LOGGING_CATEGORY(lcAccessibilityCore, "qt.accessibility.core");
\value hasPopup The object opens a popup.
\value hotTracked The object's appearance is sensitive to the mouse cursor position.
\value invalid The object is no longer valid (because it has been deleted).
- \value invalidEntry Input validation current input invalid.
\value invisible The object is not visible to the user.
\value linked The object is linked to another object, e.g. a hyperlink.
\value marqueed The object displays scrolling contents, e.g. a log view.
@@ -252,7 +218,7 @@ Q_LOGGING_CATEGORY(lcAccessibilityCore, "qt.accessibility.core");
\value ObjectHide An object is hidden; for example, with QWidget::hide().
Any children the object that is hidden has do not send
this event. It is not sent when an object is hidden as
- it is being obcured by others.
+ it is being obscured by others.
\value ObjectReorder A layout or item view has added, removed, or moved an
object (Qt does not use this event).
\value ObjectShow An object is displayed; for example, with
@@ -309,7 +275,7 @@ Q_LOGGING_CATEGORY(lcAccessibilityCore, "qt.accessibility.core");
\value AlertMessage An object that is used to alert the user.
\value Animation An object that displays an animation.
\value Application The application's main window.
- \value Assistant An object that provids interactive help.
+ \value Assistant An object that provides interactive help.
\value Border An object that represents a border.
\value ButtonDropDown A button that drops down a list of items.
\value ButtonDropGrid A button that drops down a grid.
@@ -388,14 +354,29 @@ Q_LOGGING_CATEGORY(lcAccessibilityCore, "qt.accessibility.core");
\enum QAccessible::RelationFlag
This enum type defines bit flags that can be combined to indicate
- the relationship between two accessible objects.
-
- \value Label The first object is the label of the second object.
- \value Labelled The first object is labelled by the second object.
- \value Controller The first object controls the second object.
- \value Controlled The first object is controlled by the second object.
- \value AllRelations Used as a mask to specify that we are interesting in information
- about all relations
+ the relationship between two accessible objects. It is used by
+ the relations() function, which returns a list of all the related
+ interfaces of the calling object, together with the relations
+ for each object.
+
+ Each entry in the list is a QPair where the \c second member stores
+ the relation type(s) between the \c returned object represented by the
+ \c first member and the \c origin (the caller) interface/object.
+
+ In the table below, the \c returned object refers to the object in
+ the returned list, and the \c origin object is the one represented
+ by the calling interface.
+
+ \value Label The \c returned object is the label for the \c origin object.
+ \value Labelled The \c returned object is labelled by the \c origin object.
+ \value Controller The \c returned object controls the \c origin object.
+ \value Controlled The \c returned object is controlled by the \c origin object.
+ \value [since 6.6] DescriptionFor The \c returned object provides a description for the \c origin object.
+ \value [since 6.6] Described The \c returned object is described by the \c origin object.
+ \value [since 6.6] FlowsFrom Content logically flows from the \c returned object to the \c origin object.
+ \value [since 6.6] FlowsTo Content logically flows to the \c returned object from the \c origin object.
+ \value AllRelations Used as a mask to specify that we are interesting in information
+ about all relations
Implementations of relations() return a combination of these flags.
Some values are mutually exclusive.
@@ -431,6 +412,43 @@ Q_LOGGING_CATEGORY(lcAccessibilityCore, "qt.accessibility.core");
\sa QAccessibleTextInterface
*/
+/*! \enum QAccessible::Attribute
+ This enum describes different types of attributes used by the
+ \l QAccessibleAttributesInterface.
+ \since 6.8
+
+ These attributes are comparable to the concept of properties/(object)
+ attributes found in ARIA, AT-SPI2, IAccessible, UIA and NSAccessibility
+ and are mapped to their platform counterpart where applicable.
+
+ Each attribute is handled as a key-value pair, with the values of this
+ enumeration being used as keys.
+
+ Attribute values are represented in a \l QVariant. The type of the value
+ stored in the \l QVariant is fixed and specified below for each of the
+ attribute types.
+
+ \value Custom value type: \a QHash<QString, QString>
+ The \a Custom attribute is special in that
+ it can effectively represent multiple attributes at
+ once, since it itself is a \l QHash used to represent
+ key-value pairs.
+ For platforms supporting custom key-value pairs for
+ attributes, those set in the \a Custom attribute
+ are bridged to the platform layer without applying any
+ translation to platform-specific attributes. In general,
+ the other, more strongly typed attributes should be used.
+ This attribute can e.g. be used for prototyping
+ before officially adding an official new enumeration value
+ for a specific feature.
+ \value Level value type: \a int
+ Defines the hierarchical level of an element within a structure,
+ e.g. the heading level of a heading. This attribute conceptually
+ matches the "aria-level" property in ARIA.
+
+ \sa QAccessibleAttributesInterface
+*/
+
/*!
\enum QAccessible::InterfaceType
@@ -448,11 +466,14 @@ Q_LOGGING_CATEGORY(lcAccessibilityCore, "qt.accessibility.core");
\omitvalue ImageInterface \omit For objects that represent an image. This interface is generally less important. \endomit
\value TableInterface For lists, tables and trees.
\value TableCellInterface For cells in a TableInterface object.
+ \value HyperlinkInterface For hyperlink nodes (usually embedded as children of text nodes)
+ \value [since 6.5] SelectionInterface For non-text objects that support selection of child objects.
+ \value [since 6.8] AttributesInterface For objects that support object-specific attributes.
- \sa QAccessibleInterface::interface_cast(), QAccessibleTextInterface, QAccessibleValueInterface, QAccessibleActionInterface, QAccessibleTableInterface, QAccessibleTableCellInterface
+ \sa QAccessibleInterface::interface_cast(), QAccessibleTextInterface, QAccessibleValueInterface, QAccessibleActionInterface, QAccessibleTableInterface, QAccessibleTableCellInterface, QAccessibleSelectionInterface, QAccessibleAttributesInterface
*/
-#ifndef QT_NO_ACCESSIBILITY
+#if QT_CONFIG(accessibility)
/*!
Destroys the QAccessibleInterface.
@@ -469,8 +490,8 @@ QAccessibleInterface::~QAccessibleInterface()
/* accessible widgets plugin discovery stuff */
-Q_GLOBAL_STATIC_WITH_ARGS(QFactoryLoader, loader,
- (QAccessibleFactoryInterface_iid, QLatin1String("/accessible")))
+Q_GLOBAL_STATIC_WITH_ARGS(QFactoryLoader, acLoader,
+ (QAccessibleFactoryInterface_iid, "/accessible"_L1))
typedef QHash<QString, QAccessiblePlugin*> QAccessiblePluginsHash;
Q_GLOBAL_STATIC(QAccessiblePluginsHash, qAccessiblePlugins)
@@ -619,7 +640,6 @@ QAccessible::RootObjectHandler QAccessible::installRootObjectHandler(RootObjectH
QAccessible::ActivationObserver::~ActivationObserver()
{
- // must be empty until ### Qt 6
}
/*!
@@ -675,21 +695,40 @@ QAccessibleInterface *QAccessible::queryAccessibleInterface(QObject *object)
if (!object)
return nullptr;
- if (Id id = QAccessibleCache::instance()->objectToId.value(object))
+ if (Id id = QAccessibleCache::instance()->idForObject(object))
return QAccessibleCache::instance()->interfaceForId(id);
// Create a QAccessibleInterface for the object class. Start by the most
// derived class and walk up the class hierarchy.
const QMetaObject *mo = object->metaObject();
+ const auto *objectPriv = QObjectPrivate::get(object);
+ /*
+ We do not want to cache each and every QML metaobject (Button_QMLTYPE_124,
+ Button_QMLTYPE_125, etc.). Those dynamic metaobjects shouldn't have an
+ accessible interface in any case. Instead, we start the whole checking
+ with the first non-dynamic meta-object. To avoid potential regressions
+ in other areas of Qt that also use dynamic metaobjects, we only do this
+ for objects that are QML-related (approximated by checking whether they
+ have ddata set).
+ */
+ const bool qmlRelated = !objectPriv->isDeletingChildren &&
+ objectPriv->declarativeData;
+ while (qmlRelated && mo) {
+ auto mop = QMetaObjectPrivate::get(mo);
+ if (!mop || !(mop->flags & DynamicMetaObject))
+ break;
+
+ mo = mo->superClass();
+ };
while (mo) {
- const QString cn = QLatin1String(mo->className());
+ const QString cn = QLatin1StringView(mo->className());
// Check if the class has a InterfaceFactory installed.
- for (int i = qAccessibleFactories()->count(); i > 0; --i) {
+ for (int i = qAccessibleFactories()->size(); i > 0; --i) {
InterfaceFactory factory = qAccessibleFactories()->at(i - 1);
if (QAccessibleInterface *iface = factory(cn, object)) {
QAccessibleCache::instance()->insert(object, iface);
- Q_ASSERT(QAccessibleCache::instance()->objectToId.contains(object));
+ Q_ASSERT(QAccessibleCache::instance()->containsObject(object));
return iface;
}
}
@@ -697,9 +736,9 @@ QAccessibleInterface *QAccessible::queryAccessibleInterface(QObject *object)
// no entry in the cache try to create it using the plugin loader.
if (!qAccessiblePlugins()->contains(cn)) {
QAccessiblePlugin *factory = nullptr; // 0 means "no plugin found". This is cached as well.
- const int index = loader()->indexOf(cn);
+ const int index = acLoader()->indexOf(cn);
if (index != -1)
- factory = qobject_cast<QAccessiblePlugin *>(loader()->instance(index));
+ factory = qobject_cast<QAccessiblePlugin *>(acLoader()->instance(index));
qAccessiblePlugins()->insert(cn, factory);
}
@@ -708,9 +747,9 @@ QAccessibleInterface *QAccessible::queryAccessibleInterface(QObject *object)
QAccessiblePlugin *factory = qAccessiblePlugins()->value(cn);
if (factory) {
QAccessibleInterface *result = factory->create(cn, object);
- if (result) { // Need this condition because of QDesktopScreenWidget
+ if (result) {
QAccessibleCache::instance()->insert(object, result);
- Q_ASSERT(QAccessibleCache::instance()->objectToId.contains(object));
+ Q_ASSERT(QAccessibleCache::instance()->containsObject(object));
}
return result;
}
@@ -720,7 +759,7 @@ QAccessibleInterface *QAccessible::queryAccessibleInterface(QObject *object)
if (object == qApp) {
QAccessibleInterface *appInterface = new QAccessibleApplication;
QAccessibleCache::instance()->insert(object, appInterface);
- Q_ASSERT(QAccessibleCache::instance()->objectToId.contains(qApp));
+ Q_ASSERT(QAccessibleCache::instance()->containsObject(qApp));
return appInterface;
}
@@ -802,7 +841,7 @@ bool QAccessible::isActive()
*/
void QAccessible::setActive(bool active)
{
- for (int i = 0; i < qAccessibleActivationObservers()->count() ;++i)
+ for (int i = 0; i < qAccessibleActivationObservers()->size() ;++i)
qAccessibleActivationObservers()->at(i)->accessibilityActiveChanged(active);
}
@@ -865,26 +904,17 @@ void QAccessible::updateAccessibility(QAccessibleEvent *event)
if (iface->tableInterface())
iface->tableInterface()->modelChange(static_cast<QAccessibleTableModelChangeEvent*>(event));
}
+ }
- if (updateHandler) {
- updateHandler(event);
- return;
- }
+ if (updateHandler) {
+ updateHandler(event);
+ return;
}
if (QPlatformAccessibility *pfAccessibility = platformAccessibility())
pfAccessibility->notifyAccessibilityUpdate(event);
}
-#if QT_DEPRECATED_SINCE(5, 0)
-/*!
- \obsolete
- \fn void QAccessible::updateAccessibility(QObject *object, int child, Event reason);
-
- \brief Use QAccessible::updateAccessibility(QAccessibleEvent*) instead.
-*/
-#endif
-
/*!
\internal
\brief getBoundaries is a helper function to find the accessible text boundaries for QTextCursor based documents.
@@ -1095,15 +1125,16 @@ QPair< int, int > QAccessible::qAccessibleTextBoundaryHelper(const QTextCursor &
relations, unless they are handled in a specific way such as in tree views.
It will typically return the labelled-by and label relations.
- It is possible to filter the relations by using \a match.
+ It is possible to filter the relations by using the optional parameter \a match.
It should never return itself.
\sa parent(), child()
*/
-QVector<QPair<QAccessibleInterface*, QAccessible::Relation> >
-QAccessibleInterface::relations(QAccessible::Relation /*match = QAccessible::AllRelations*/) const
+QList<QPair<QAccessibleInterface*, QAccessible::Relation>>
+QAccessibleInterface::relations(QAccessible::Relation match) const
{
- return QVector<QPair<QAccessibleInterface*, QAccessible::Relation> >();
+ Q_UNUSED(match);
+ return { };
}
/*!
@@ -1123,7 +1154,7 @@ QAccessibleInterface *QAccessibleInterface::focusChild() const
If there are no children at this position this function returns \nullptr.
The returned accessible must be a child, but not necessarily a direct child.
- This function is only relyable for visible objects (invisible
+ This function is only reliable for visible objects (invisible
object might not be laid out correctly).
All visual objects provide this information.
@@ -1296,6 +1327,11 @@ QColor QAccessibleInterface::backgroundColor() const
*/
/*!
+ \fn QAccessibleSelectionInterface *QAccessibleInterface::selectionInterface()
+ \since 6.5
+*/
+
+/*!
\class QAccessibleEvent
\ingroup accessibility
\inmodule QtGui
@@ -1334,7 +1370,6 @@ QColor QAccessibleInterface::backgroundColor() const
*/
QAccessibleEvent::~QAccessibleEvent()
{
- // must be empty until ### Qt 6
}
/*! \fn QAccessible::Event QAccessibleEvent::type() const
@@ -1414,7 +1449,6 @@ QAccessible::Id QAccessibleEvent::uniqueId() const
*/
QAccessibleValueChangeEvent::~QAccessibleValueChangeEvent()
{
- // must be empty until ### Qt 6
}
/*!
@@ -1458,7 +1492,6 @@ QAccessibleValueChangeEvent::~QAccessibleValueChangeEvent()
*/
QAccessibleStateChangeEvent::~QAccessibleStateChangeEvent()
{
- // must be empty until ### Qt 6
}
/*!
@@ -1538,7 +1571,6 @@ QAccessibleStateChangeEvent::~QAccessibleStateChangeEvent()
*/
QAccessibleTableModelChangeEvent::~QAccessibleTableModelChangeEvent()
{
- // must be empty until ### Qt 6
}
/*!
\class QAccessibleTextCursorEvent
@@ -1567,7 +1599,6 @@ QAccessibleTableModelChangeEvent::~QAccessibleTableModelChangeEvent()
*/
QAccessibleTextCursorEvent::~QAccessibleTextCursorEvent()
{
- // must be empty until ### Qt 6
}
@@ -1608,7 +1639,6 @@ QAccessibleTextCursorEvent::~QAccessibleTextCursorEvent()
*/
QAccessibleTextInsertEvent::~QAccessibleTextInsertEvent()
{
- // must be empty until ### Qt 6
}
@@ -1651,7 +1681,6 @@ QAccessibleTextInsertEvent::~QAccessibleTextInsertEvent()
*/
QAccessibleTextRemoveEvent::~QAccessibleTextRemoveEvent()
{
- // must be empty until ### Qt 6
}
/*!
@@ -1664,8 +1693,8 @@ QAccessibleTextRemoveEvent::~QAccessibleTextRemoveEvent()
/*!
\fn QAccessibleTextInsertEvent::QAccessibleTextInsertEvent(QAccessibleInterface *iface, int position, const QString &text)
- Constructs a new QAccessibleTextInsertEvent event for \a iface. The text has been inserted at
- \a position.
+ Constructs a new QAccessibleTextInsertEvent event for \a iface. The \a text has been inserted
+ at \a position.
*/
/*!
@@ -1713,7 +1742,6 @@ QAccessibleTextRemoveEvent::~QAccessibleTextRemoveEvent()
*/
QAccessibleTextUpdateEvent::~QAccessibleTextUpdateEvent()
{
- // must be empty until ### Qt 6
}
@@ -1748,7 +1776,6 @@ QAccessibleTextUpdateEvent::~QAccessibleTextUpdateEvent()
*/
QAccessibleTextSelectionEvent::~QAccessibleTextSelectionEvent()
{
- // must be empty until ### Qt 6
}
@@ -1817,11 +1844,6 @@ void QAccessibleInterface::virtual_hook(int /*id*/, void * /*data*/)
interfaces. For example a line edit should implement the
QAccessibleTextInterface.
- Qt's QLineEdit for example has its accessibility support
- implemented in QAccessibleLineEdit.
-
- \snippet code/src_gui_accessible_qaccessible.cpp 3
-
\sa QAccessible::InterfaceType, QAccessibleTextInterface,
QAccessibleValueInterface, QAccessibleActionInterface,
QAccessibleTableInterface, QAccessibleTableCellInterface
@@ -1843,12 +1865,6 @@ const char *qAccessibleEventString(QAccessible::Event event)
return QAccessible::staticMetaObject.enumerator(eventEnum).valueToKey(event);
}
-/*! \internal */
-bool operator==(const QAccessible::State &first, const QAccessible::State &second)
-{
- return memcmp(&first, &second, sizeof(QAccessible::State)) == 0;
-}
-
#ifndef QT_NO_DEBUG_STREAM
/*! \internal */
Q_GUI_EXPORT QDebug operator<<(QDebug d, const QAccessibleInterface *iface)
@@ -1871,16 +1887,16 @@ Q_GUI_EXPORT QDebug operator<<(QDebug d, const QAccessibleInterface *iface)
QStringList stateStrings;
QAccessible::State st = iface->state();
if (st.focusable)
- stateStrings << QLatin1String("focusable");
+ stateStrings << u"focusable"_s;
if (st.focused)
- stateStrings << QLatin1String("focused");
+ stateStrings << u"focused"_s;
if (st.selected)
- stateStrings << QLatin1String("selected");
+ stateStrings << u"selected"_s;
if (st.invisible)
- stateStrings << QLatin1String("invisible");
+ stateStrings << u"invisible"_s;
if (!stateStrings.isEmpty())
- d << stateStrings.join(QLatin1Char('|'));
+ d << stateStrings.join(u'|');
if (!st.invisible)
d << "rect=" << iface->rect();
@@ -1978,7 +1994,6 @@ QDebug operator<<(QDebug d, const QAccessibleEvent &ev)
*/
QAccessibleTextInterface::~QAccessibleTextInterface()
{
- // must be empty until ### Qt 6
}
/*!
@@ -2029,7 +2044,7 @@ QAccessibleTextInterface::~QAccessibleTextInterface()
\fn void QAccessibleTextInterface::selection(int selectionIndex, int *startOffset, int *endOffset) const
Returns a selection. The size of the selection is returned in \a startOffset and \a endOffset.
- If there is no selection both \a startOffset and \a endOffset are 0.
+ If there is no selection both \a startOffset and \a endOffset are \nullptr.
The accessibility APIs support multiple selections. For most widgets though, only one selection
is supported with \a selectionIndex equal to 0.
@@ -2052,7 +2067,7 @@ static QString textLineBoundary(int beforeAtAfter, const QString &text, int offs
{
Q_ASSERT(beforeAtAfter >= -1 && beforeAtAfter <= 1);
Q_ASSERT(*startOffset == -1 && *endOffset == -1);
- int length = text.length();
+ int length = text.size();
Q_ASSERT(offset >= 0 && offset <= length);
// move offset into the right range (if asking for line before or after
@@ -2101,10 +2116,10 @@ QString QAccessibleTextInterface::textBeforeOffset(int offset, QAccessible::Text
const QString txt = text(0, characterCount());
if (offset == -1)
- offset = txt.length();
+ offset = txt.size();
*startOffset = *endOffset = -1;
- if (txt.isEmpty() || offset <= 0 || offset > txt.length())
+ if (txt.isEmpty() || offset <= 0 || offset > txt.size())
return QString();
// type initialized just to silence a compiler warning [-Werror=maybe-uninitialized]
@@ -2175,10 +2190,10 @@ QString QAccessibleTextInterface::textAfterOffset(int offset, QAccessible::TextB
const QString txt = text(0, characterCount());
if (offset == -1)
- offset = txt.length();
+ offset = txt.size();
*startOffset = *endOffset = -1;
- if (txt.isEmpty() || offset < 0 || offset >= txt.length())
+ if (txt.isEmpty() || offset < 0 || offset >= txt.size())
return QString();
// type initialized just to silence a compiler warning [-Werror=maybe-uninitialized]
@@ -2213,20 +2228,20 @@ QString QAccessibleTextInterface::textAfterOffset(int offset, QAccessible::TextB
int toNext = boundary.toNextBoundary();
if ((boundary.boundaryReasons() & (QTextBoundaryFinder::StartOfItem | QTextBoundaryFinder::EndOfItem)))
break;
- if (toNext < 0 || toNext >= txt.length())
+ if (toNext < 0 || toNext >= txt.size())
break; // not found, the boundary might not exist
}
- Q_ASSERT(boundary.position() <= txt.length());
+ Q_ASSERT(boundary.position() <= txt.size());
*startOffset = boundary.position();
while (true) {
int toNext = boundary.toNextBoundary();
if ((boundary.boundaryReasons() & (QTextBoundaryFinder::StartOfItem | QTextBoundaryFinder::EndOfItem)))
break;
- if (toNext < 0 || toNext >= txt.length())
+ if (toNext < 0 || toNext >= txt.size())
break; // not found, the boundary might not exist
}
- Q_ASSERT(boundary.position() <= txt.length());
+ Q_ASSERT(boundary.position() <= txt.size());
*endOffset = boundary.position();
if ((*startOffset == -1) || (*endOffset == -1) || (*startOffset == *endOffset)) {
@@ -2260,13 +2275,13 @@ QString QAccessibleTextInterface::textAtOffset(int offset, QAccessible::TextBoun
const QString txt = text(0, characterCount());
if (offset == -1)
- offset = txt.length();
+ offset = txt.size();
*startOffset = *endOffset = -1;
- if (txt.isEmpty() || offset < 0 || offset > txt.length())
+ if (txt.isEmpty() || offset < 0 || offset > txt.size())
return QString();
- if (offset == txt.length() && boundaryType == QAccessible::CharBoundary)
+ if (offset == txt.size() && boundaryType == QAccessible::CharBoundary)
return QString();
// type initialized just to silence a compiler warning [-Werror=maybe-uninitialized]
@@ -2287,7 +2302,7 @@ QString QAccessibleTextInterface::textAtOffset(int offset, QAccessible::TextBoun
return textLineBoundary(0, txt, offset, startOffset, endOffset);
case QAccessible::NoBoundary:
*startOffset = 0;
- *endOffset = txt.length();
+ *endOffset = txt.size();
return txt;
default:
Q_UNREACHABLE();
@@ -2305,11 +2320,11 @@ QString QAccessibleTextInterface::textAtOffset(int offset, QAccessible::TextBoun
Q_ASSERT(boundary.position() >= 0);
*startOffset = boundary.position();
- while (boundary.toNextBoundary() < txt.length()) {
+ while (boundary.toNextBoundary() < txt.size()) {
if ((boundary.boundaryReasons() & (QTextBoundaryFinder::StartOfItem | QTextBoundaryFinder::EndOfItem)))
break;
}
- Q_ASSERT(boundary.position() <= txt.length());
+ Q_ASSERT(boundary.position() <= txt.size());
*endOffset = boundary.position();
return txt.mid(*startOffset, *endOffset - *startOffset);
@@ -2367,7 +2382,6 @@ QString QAccessibleTextInterface::textAtOffset(int offset, QAccessible::TextBoun
*/
QAccessibleEditableTextInterface::~QAccessibleEditableTextInterface()
{
- // must be empty until ### Qt 6
}
/*!
@@ -2412,7 +2426,6 @@ QAccessibleEditableTextInterface::~QAccessibleEditableTextInterface()
*/
QAccessibleValueInterface::~QAccessibleValueInterface()
{
- // must be empty until ### Qt 6
}
/*!
@@ -2449,8 +2462,8 @@ QAccessibleValueInterface::~QAccessibleValueInterface()
\fn QVariant QAccessibleValueInterface::minimumStepSize() const
Returns the minimum step size for the accessible.
- This is the smalles increment that makes sense when changing the value.
- When programatically changing the value it should always be a multiple
+ This is the smallest increment that makes sense when changing the value.
+ When programmatically changing the value it should always be a multiple
of the minimum step size.
Some tools use this value even when the setCurrentValue does not
@@ -2476,7 +2489,6 @@ QAccessibleValueInterface::~QAccessibleValueInterface()
*/
QAccessibleImageInterface::~QAccessibleImageInterface()
{
- // must be empty until ### Qt 6
}
/*!
@@ -2496,7 +2508,6 @@ QAccessibleImageInterface::~QAccessibleImageInterface()
*/
QAccessibleTableCellInterface::~QAccessibleTableCellInterface()
{
- // must be empty until ### Qt 6
}
/*!
@@ -2550,6 +2561,7 @@ QAccessibleTableCellInterface::~QAccessibleTableCellInterface()
/*!
\class QAccessibleTableInterface
+ \inmodule QtGui
\ingroup accessibility
\brief The QAccessibleTableInterface class implements support for
@@ -2564,7 +2576,6 @@ QAccessibleTableCellInterface::~QAccessibleTableCellInterface()
*/
QAccessibleTableInterface::~QAccessibleTableInterface()
{
- // must be empty until ### Qt 6
}
/*!
@@ -2636,7 +2647,7 @@ QAccessibleTableInterface::~QAccessibleTableInterface()
/*!
\fn virtual QList<int> QAccessibleTableInterface::selectedRows() const
- Returns the list of currently selected columns.
+ Returns the list of currently selected rows.
*/
/*!
@@ -2697,6 +2708,7 @@ QAccessibleTableInterface::~QAccessibleTableInterface()
/*!
\class QAccessibleActionInterface
+ \inmodule QtGui
\ingroup accessibility
\brief The QAccessibleActionInterface class implements support for
@@ -2721,7 +2733,7 @@ QAccessibleTableInterface::~QAccessibleTableInterface()
\row \li \l toggleAction() \li toggles the item (checkbox, radio button, switch, ...)
\row \li \l decreaseAction() \li decrease the value of the accessible (e.g. spinbox)
\row \li \l increaseAction() \li increase the value of the accessible (e.g. spinbox)
- \row \li \l pressAction() \li press or click or activate the accessible (should correspont to clicking the object with the mouse)
+ \row \li \l pressAction() \li press or click or activate the accessible (should correspond to clicking the object with the mouse)
\row \li \l setFocusAction() \li set the focus to this accessible
\row \li \l showMenuAction() \li show a context menu, corresponds to right-clicks
\endtable
@@ -2740,7 +2752,6 @@ QAccessibleTableInterface::~QAccessibleTableInterface()
*/
QAccessibleActionInterface::~QAccessibleActionInterface()
{
- // must be empty until ### Qt 6
}
/*!
@@ -2989,13 +3000,207 @@ QString QAccessibleActionInterface::nextPageAction()
return accessibleActionStrings()->nextPageAction;
}
+
+/*!
+ \since 6.5
+ \class QAccessibleSelectionInterface
+ \inmodule QtGui
+ \ingroup accessibility
+
+ \brief The QAccessibleSelectionInterface class implements support for
+ selection handling.
+
+ It provides methods for both, retrieving the current selection
+ as well as modifying the selection.
+
+ Only selections of direct children are supported.
+*/
+
+/*!
+
+ Destroys the QAccessibleSelectionInterface.
+*/
+QAccessibleSelectionInterface::~QAccessibleSelectionInterface()
+{
+}
+
+/*!
+ \fn virtual int QAccessibleSelectionInterface::selectedItemCount() const
+
+ Returns the total number of selected accessible items.
+*/
+
+/*!
+ \fn virtual QList<QAccessibleInterface *> QAccessibleSelectionInterface::selectedItems() const
+
+ Returns the list of selected accessible items.
+*/
+
+/*!
+ Returns the selected accessible item at index \a selectionIndex in the selection.
+
+ Note that the index refers to the n-th selected accessible item (i.e. the index in the current selection),
+ which generally differs from the index that would be passed to \l QAccessibleInterface::child()
+ in order to retrieve the same item.
+
+ The default implementation uses \a selectionIndex to retrieve the item from the list
+ of selected items retrieved by \l QAccessibleSelectionInterface::selectedItems().
+
+ In particular for implementations dealing with many selected items, reimplementing
+ this method in a more efficient way may be desirable for performance reasons.
+*/
+QAccessibleInterface* QAccessibleSelectionInterface::selectedItem(int selectionIndex) const
+{
+ QList<QAccessibleInterface*> items = selectedItems();
+ if (selectionIndex < 0 || selectionIndex > items.length() -1) {
+ qCWarning(lcAccessibilityCore) << "Selection index" << selectionIndex << "out of range.";
+ return nullptr;
+ }
+
+ return items.at(selectionIndex);
+}
+
+/*!
+ Returns whether \a childItem is part of the current selection.
+
+ The default implementation checks whether \a childItem is contained
+ in the list of items retrieved by \l QAccessibleSelectionInterface::selectedItems.
+*/
+bool QAccessibleSelectionInterface::isSelected(QAccessibleInterface *childItem) const
+{
+ return selectedItems().contains(childItem);
+}
+
+/*!
+ \fn virtual bool QAccessibleSelectionInterface::select(QAccessibleInterface *childItem)
+
+ Adds \a childItem to the selection.
+ Returns whether \a childItem has actually been added to the selection.
+
+ For implementations that only allow single selections,
+ this may replace the current selection.
+*/
+
+/*!
+ \fn virtual bool QAccessibleSelectionInterface::unselect(QAccessibleInterface *childItem)
+
+ Removes \a childItem from the selection.
+
+ Returns whether the accessible item has actually been removed from the selection.
+*/
+
+/*!
+ \fn virtual bool QAccessibleSelectionInterface::selectAll()
+
+ Selects all accessible child items.
+
+ Returns whether all accessible child items have actually been added to the selection.
+*/
+
+/*!
+ \fn virtual bool QAccessibleSelectionInterface::clear()
+
+ Unselects all accessible child items.
+
+ Returns whether all accessible child items have actually been removed from the selection,
+ i.e. whether the selection is empty after this method has been called.
+*/
+
+
+/*!
+ \since 6.8
+ \class QAccessibleAttributesInterface
+ \inmodule QtGui
+ \ingroup accessibility
+
+ \brief The QAccessibleAttributesInterface class implements support for
+ reporting attributes for an accessible object.
+
+ Attributes are key-value pairs. Values are stored in \l QVariant.
+
+ The \a QAccessible::Attributes enumeration describes the available keys and
+ documents which type to use for the value of each key.
+
+ While the text-specific attributes handled by \l QAccessibleTextInterface::attributes
+ are specific to objects implementing text and are specific to a specific text
+ position/offset, the attributes handled by the \l QAccessibleAttributesInterface
+ can be used for objects of any role and apply for the whole object.
+
+ Classes already implementing \l QAccessibleTextInterface for text-specific attrtibutes
+ may want to implement \l QAccessibleAttributesInterface in addition for object-specific
+ attributes.
+*/
+
+/*!
+
+ Destroys the QAccessibleAttributesInterface.
+*/
+QAccessibleAttributesInterface::~QAccessibleAttributesInterface()
+{
+}
+
+/*!
+ \fn QList<QAccessible::Attribute> QAccessibleAttributesInterface::attributeKeys() const
+
+ Returns the keys of all attributes the object supports. The \l QAccessible::Attribute
+ enumeration describes available keys.
+*/
+
+/*!
+ \fn QVariant QAccessibleAttributesInterface::attributeValue(QAccessible::Attribute key) const
+
+ Returns the value of the attribute \a key of this object.
+
+ If the specificed attribute is not set for this object, an invalid
+ \l QVariant is returned.
+*/
+
/*! \internal */
QString qAccessibleLocalizedActionDescription(const QString &actionName)
{
return accessibleActionStrings()->localizedDescription(actionName);
}
-#endif // QT_NO_ACCESSIBILITY
+/*!
+ \internal
+ \fn QString QAccessibleHyperlinkInterface::anchor() const
+
+ The logical/human readable name of the hyperlink
+*/
+
+/*!
+ \internal
+ \fn QString QAccessibleHyperlinkInterface::anchorTarget() const
+
+ The target url of the hyperlink
+*/
+
+/*!
+ \internal
+ \fn int QAccessibleHyperlinkInterface::startIndex() const
+
+ Returns the start index that will refer to the first character in the text where the hyperlink
+ begins. The index corresponds to the index that the QAccessibleTextInterface needs in order
+ to find the start of the hyperlink.
+
+*/
+
+/*!
+ \internal
+ \fn int QAccessibleHyperlinkInterface::endIndex() const
+
+ Returns the end index that will refer to the first character in the text where the hyperlink
+ begins. The index corresponds to the index that the QAccessibleTextInterface needs in order
+ to find the end of the hyperlink.
+*/
+
+QAccessibleHyperlinkInterface::~QAccessibleHyperlinkInterface()
+{
+
+}
+
+#endif // QT_CONFIG(accessibility)
QT_END_NAMESPACE
+#include "moc_qaccessible_base.cpp"
diff --git a/src/gui/accessible/qaccessible.h b/src/gui/accessible/qaccessible.h
index 2220efd5cb..0a92e76c73 100644
--- a/src/gui/accessible/qaccessible.h
+++ b/src/gui/accessible/qaccessible.h
@@ -1,60 +1,30 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the QtGui module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2020 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
-#include <QtGui/qtguiglobal.h>
-#ifndef QT_NO_ACCESSIBILITY
+#if 0
+// keep existing syncqt header working after the move of the class
+// into qaccessible_base
+#pragma qt_class(QAccessible)
+#endif
+
#ifndef QACCESSIBLE_H
#define QACCESSIBLE_H
+#include <QtGui/qtguiglobal.h>
+
+#if QT_CONFIG(accessibility)
#include <QtCore/qcoreapplication.h>
#include <QtCore/qdebug.h>
#include <QtCore/qglobal.h>
+#include <QtCore/qlist.h>
#include <QtCore/qobject.h>
#include <QtCore/qrect.h>
#include <QtCore/qset.h>
-#include <QtCore/qvector.h>
#include <QtCore/qvariant.h>
#include <QtGui/qcolor.h>
#include <QtGui/qevent.h>
-
-#include <stdlib.h>
+#include <QtGui/qaccessible_base.h>
QT_BEGIN_NAMESPACE
@@ -63,388 +33,6 @@ class QAccessibleEvent;
class QWindow;
class QTextCursor;
-class Q_GUI_EXPORT QAccessible
-{
- Q_GADGET
-public:
-
- enum Event {
- SoundPlayed = 0x0001,
- Alert = 0x0002,
- ForegroundChanged = 0x0003,
- MenuStart = 0x0004,
- MenuEnd = 0x0005,
- PopupMenuStart = 0x0006,
- PopupMenuEnd = 0x0007,
- ContextHelpStart = 0x000C,
- ContextHelpEnd = 0x000D,
- DragDropStart = 0x000E,
- DragDropEnd = 0x000F,
- DialogStart = 0x0010,
- DialogEnd = 0x0011,
- ScrollingStart = 0x0012,
- ScrollingEnd = 0x0013,
-
- MenuCommand = 0x0018,
-
- // Values from IAccessible2
- ActionChanged = 0x0101,
- ActiveDescendantChanged = 0x0102,
- AttributeChanged = 0x0103,
- DocumentContentChanged = 0x0104,
- DocumentLoadComplete = 0x0105,
- DocumentLoadStopped = 0x0106,
- DocumentReload = 0x0107,
- HyperlinkEndIndexChanged = 0x0108,
- HyperlinkNumberOfAnchorsChanged = 0x0109,
- HyperlinkSelectedLinkChanged = 0x010A,
- HypertextLinkActivated = 0x010B,
- HypertextLinkSelected = 0x010C,
- HyperlinkStartIndexChanged = 0x010D,
- HypertextChanged = 0x010E,
- HypertextNLinksChanged = 0x010F,
- ObjectAttributeChanged = 0x0110,
- PageChanged = 0x0111,
- SectionChanged = 0x0112,
- TableCaptionChanged = 0x0113,
- TableColumnDescriptionChanged = 0x0114,
- TableColumnHeaderChanged = 0x0115,
- TableModelChanged = 0x0116,
- TableRowDescriptionChanged = 0x0117,
- TableRowHeaderChanged = 0x0118,
- TableSummaryChanged = 0x0119,
- TextAttributeChanged = 0x011A,
- TextCaretMoved = 0x011B,
- // TextChanged = 0x011C, is deprecated in IA2, use TextUpdated
- TextColumnChanged = 0x011D,
- TextInserted = 0x011E,
- TextRemoved = 0x011F,
- TextUpdated = 0x0120,
- TextSelectionChanged = 0x0121,
- VisibleDataChanged = 0x0122,
-
- ObjectCreated = 0x8000,
- ObjectDestroyed = 0x8001,
- ObjectShow = 0x8002,
- ObjectHide = 0x8003,
- ObjectReorder = 0x8004,
- Focus = 0x8005,
- Selection = 0x8006,
- SelectionAdd = 0x8007,
- SelectionRemove = 0x8008,
- SelectionWithin = 0x8009,
- StateChanged = 0x800A,
- LocationChanged = 0x800B,
- NameChanged = 0x800C,
- DescriptionChanged = 0x800D,
- ValueChanged = 0x800E,
- ParentChanged = 0x800F,
- HelpChanged = 0x80A0,
- DefaultActionChanged = 0x80B0,
- AcceleratorChanged = 0x80C0,
-
- InvalidEvent
- };
- Q_ENUM(Event)
-
- // 64 bit enums seem hard on some platforms (windows...)
- // which makes using a bit field a sensible alternative
- struct State {
- // http://msdn.microsoft.com/en-us/library/ms697270.aspx
- quint64 disabled : 1; // used to be Unavailable
- quint64 selected : 1;
- quint64 focusable : 1;
- quint64 focused : 1;
- quint64 pressed : 1;
- quint64 checkable : 1;
- quint64 checked : 1;
- quint64 checkStateMixed : 1; // used to be Mixed
- quint64 readOnly : 1;
- quint64 hotTracked : 1;
- quint64 defaultButton : 1;
- quint64 expanded : 1;
- quint64 collapsed : 1;
- quint64 busy : 1;
- quint64 expandable : 1;
- quint64 marqueed : 1;
- quint64 animated : 1;
- quint64 invisible : 1;
- quint64 offscreen : 1;
- quint64 sizeable : 1;
- quint64 movable : 1;
- quint64 selfVoicing : 1;
- quint64 selectable : 1;
- quint64 linked : 1;
- quint64 traversed : 1;
- quint64 multiSelectable : 1;
- quint64 extSelectable : 1;
- quint64 passwordEdit : 1; // used to be Protected
- quint64 hasPopup : 1;
- quint64 modal : 1;
-
- // IA2 - we chose to not add some IA2 states for now
- // Below the ones that seem helpful
- quint64 active : 1;
- quint64 invalid : 1; // = defunct
- quint64 editable : 1;
- quint64 multiLine : 1;
- quint64 selectableText : 1;
- quint64 supportsAutoCompletion : 1;
-
- quint64 searchEdit : 1;
-
- // quint64 horizontal : 1;
- // quint64 vertical : 1;
- // quint64 invalidEntry : 1;
- // quint64 managesDescendants : 1;
- // quint64 singleLine : 1; // we have multi line, this is redundant.
- // quint64 stale : 1;
- // quint64 transient : 1;
- // quint64 pinned : 1;
-
- // Apple - see http://mattgemmell.com/2010/12/19/accessibility-for-iphone-and-ipad-apps/
- // quint64 playsSound : 1;
- // quint64 summaryElement : 1;
- // quint64 updatesFrequently : 1;
- // quint64 adjustable : 1;
- // more and not included here: http://developer.apple.com/library/mac/#documentation/UserExperience/Reference/Accessibility_RoleAttribute_Ref/Attributes.html
-
- // MSAA
- // quint64 alertLow : 1;
- // quint64 alertMedium : 1;
- // quint64 alertHigh : 1;
-
- State() {
- memset(this, 0, sizeof(State));
- }
- };
-
-
-
-
-
- enum Role {
- NoRole = 0x00000000,
- TitleBar = 0x00000001,
- MenuBar = 0x00000002,
- ScrollBar = 0x00000003,
- Grip = 0x00000004,
- Sound = 0x00000005,
- Cursor = 0x00000006,
- Caret = 0x00000007,
- AlertMessage = 0x00000008,
- Window = 0x00000009,
- Client = 0x0000000A,
- PopupMenu = 0x0000000B,
- MenuItem = 0x0000000C,
- ToolTip = 0x0000000D,
- Application = 0x0000000E,
- Document = 0x0000000F,
- Pane = 0x00000010,
- Chart = 0x00000011,
- Dialog = 0x00000012,
- Border = 0x00000013,
- Grouping = 0x00000014,
- Separator = 0x00000015,
- ToolBar = 0x00000016,
- StatusBar = 0x00000017,
- Table = 0x00000018,
- ColumnHeader = 0x00000019,
- RowHeader = 0x0000001A,
- Column = 0x0000001B,
- Row = 0x0000001C,
- Cell = 0x0000001D,
- Link = 0x0000001E,
- HelpBalloon = 0x0000001F,
- Assistant = 0x00000020,
- List = 0x00000021,
- ListItem = 0x00000022,
- Tree = 0x00000023,
- TreeItem = 0x00000024,
- PageTab = 0x00000025,
- PropertyPage = 0x00000026,
- Indicator = 0x00000027,
- Graphic = 0x00000028,
- StaticText = 0x00000029,
- EditableText = 0x0000002A, // Editable, selectable, etc.
- Button = 0x0000002B,
-#ifndef Q_QDOC
- PushButton = Button, // deprecated
-#endif
- CheckBox = 0x0000002C,
- RadioButton = 0x0000002D,
- ComboBox = 0x0000002E,
- // DropList = 0x0000002F,
- ProgressBar = 0x00000030,
- Dial = 0x00000031,
- HotkeyField = 0x00000032,
- Slider = 0x00000033,
- SpinBox = 0x00000034,
- Canvas = 0x00000035, // Diagram for MSAA
- Animation = 0x00000036,
- Equation = 0x00000037,
- ButtonDropDown = 0x00000038, // The object represents a button that expands a grid.
- ButtonMenu = 0x00000039,
- ButtonDropGrid = 0x0000003A,
- Whitespace = 0x0000003B, // The object represents blank space between other objects.
- PageTabList = 0x0000003C,
- Clock = 0x0000003D,
- Splitter = 0x0000003E,
- // Reserved space in case MSAA roles needs to be added
-
- // Additional Qt roles where enum value does not map directly to MSAA:
- LayeredPane = 0x00000080,
- Terminal = 0x00000081,
- Desktop = 0x00000082,
- Paragraph = 0x00000083,
- WebDocument = 0x00000084,
- Section = 0x00000085,
- Notification = 0x00000086,
-
- // IAccessible2 roles
- // IA2_ROLE_CANVAS = 0x401, ### Qt 6 use this one instead of Canvas above
- // IA2_ROLE_CAPTION = 0x402,
- // IA2_ROLE_CHECK_MENU_ITEM = 0x403,
- ColorChooser = 0x404,
- // IA2_ROLE_DATE_EDITOR = 0x405,
- // IA2_ROLE_DESKTOP_ICON = 0x406,
- // IA2_ROLE_DESKTOP_PANE = 0x407,
- // IA2_ROLE_DIRECTORY_PANE = 0x408,
- // IA2_ROLE_EDITBAR = 0x409,
- // IA2_ROLE_EMBEDDED_OBJECT = 0x40A,
- // IA2_ROLE_ENDNOTE = 0x40B,
- // IA2_ROLE_FILE_CHOOSER = 0x40C,
- // IA2_ROLE_FONT_CHOOSER = 0x40D,
- Footer = 0x40E,
- // IA2_ROLE_FOOTNOTE = 0x40F,
- Form = 0x410,
- // some platforms (windows and at-spi) use Frame for regular windows
- // because window was taken for tool/dock windows by MSAA
- // Frame = 0x411,
- // IA2_ROLE_GLASS_PANE = 0x412,
- // IA2_ROLE_HEADER = 0x413,
- Heading = 0x414,
- // IA2_ROLE_ICON = 0x415,
- // IA2_ROLE_IMAGE_MAP = 0x416,
- // IA2_ROLE_INPUT_METHOD_WINDOW = 0x417,
- // IA2_ROLE_INTERNAL_FRAME = 0x418,
- // IA2_ROLE_LABEL = 0x419,
- // IA2_ROLE_LAYERED_PANE = 0x41A,
- Note = 0x41B,
- // IA2_ROLE_OPTION_PANE = 0x41C,
- // IA2_ROLE_PAGE = 0x41D,
- // IA2_ROLE_PARAGRAPH = 0x42E,
- // IA2_ROLE_RADIO_MENU_ITEM = 0x41F,
- // IA2_ROLE_REDUNDANT_OBJECT = 0x420,
- // IA2_ROLE_ROOT_PANE = 0x421,
- // IA2_ROLE_RULER = 0x422,
- // IA2_ROLE_SCROLL_PANE = 0x423,
- // IA2_ROLE_SECTION = 0x424,
- // IA2_ROLE_SHAPE = 0x425,
- // IA2_ROLE_SPLIT_PANE = 0x426,
- // IA2_ROLE_TEAR_OFF_MENU = 0x427,
- // IA2_ROLE_TERMINAL = 0x428,
- // IA2_ROLE_TEXT_FRAME = 0x429,
- // IA2_ROLE_TOGGLE_BUTTON = 0x42A,
- // IA2_ROLE_VIEW_PORT = 0x42B,
- ComplementaryContent = 0x42C,
-
- UserRole = 0x0000ffff
- };
- Q_ENUM(Role)
-
- enum Text {
- Name = 0,
- Description,
- Value,
- Help,
- Accelerator,
- DebugDescription,
- UserText = 0x0000ffff
- };
-
- enum RelationFlag {
- Label = 0x00000001,
- Labelled = 0x00000002,
- Controller = 0x00000004,
- Controlled = 0x00000008,
- AllRelations = 0xffffffff
- };
- Q_DECLARE_FLAGS(Relation, RelationFlag)
-
- enum InterfaceType
- {
- TextInterface,
- EditableTextInterface,
- ValueInterface,
- ActionInterface,
- ImageInterface,
- TableInterface,
- TableCellInterface
- };
-
- enum TextBoundaryType {
- CharBoundary,
- WordBoundary,
- SentenceBoundary,
- ParagraphBoundary,
- LineBoundary,
- NoBoundary
- };
-
- typedef QAccessibleInterface*(*InterfaceFactory)(const QString &key, QObject*);
- typedef void(*UpdateHandler)(QAccessibleEvent *event);
- typedef void(*RootObjectHandler)(QObject*);
-
- typedef unsigned Id;
-
- static void installFactory(InterfaceFactory);
- static void removeFactory(InterfaceFactory);
- static UpdateHandler installUpdateHandler(UpdateHandler);
- static RootObjectHandler installRootObjectHandler(RootObjectHandler);
-
- class Q_GUI_EXPORT ActivationObserver
- {
- public:
- virtual ~ActivationObserver();
- virtual void accessibilityActiveChanged(bool active) = 0;
- };
- static void installActivationObserver(ActivationObserver *);
- static void removeActivationObserver(ActivationObserver *);
-
- static QAccessibleInterface *queryAccessibleInterface(QObject *);
- static Id uniqueId(QAccessibleInterface *iface);
- static QAccessibleInterface *accessibleInterface(Id uniqueId);
- static Id registerAccessibleInterface(QAccessibleInterface *iface);
- static void deleteAccessibleInterface(Id uniqueId);
-
-
-#if QT_DEPRECATED_SINCE(5, 0)
- QT_DEPRECATED static inline void updateAccessibility(QObject *object, int child, Event reason);
-#endif
- static void updateAccessibility(QAccessibleEvent *event);
-
- static bool isActive();
- static void setActive(bool active);
- static void setRootObject(QObject *object);
-
- static void cleanup();
-
- static QPair< int, int > qAccessibleTextBoundaryHelper(const QTextCursor &cursor, TextBoundaryType boundaryType);
-
-private:
- static UpdateHandler updateHandler;
- static RootObjectHandler rootObjectHandler;
-
- QAccessible() {}
-
- friend class QAccessibleCache;
-};
-
-Q_GUI_EXPORT bool operator==(const QAccessible::State &first, const QAccessible::State &second);
-
-Q_DECLARE_OPERATORS_FOR_FLAGS(QAccessible::Relation)
-
class QAccessible2Interface;
class QAccessibleTextInterface;
class QAccessibleEditableTextInterface;
@@ -453,6 +41,9 @@ class QAccessibleActionInterface;
class QAccessibleImageInterface;
class QAccessibleTableInterface;
class QAccessibleTableCellInterface;
+class QAccessibleHyperlinkInterface;
+class QAccessibleSelectionInterface;
+class QAccessibleAttributesInterface;
class QAccessibleTableModelChangeEvent;
class Q_GUI_EXPORT QAccessibleInterface
@@ -467,7 +58,8 @@ public:
virtual QWindow *window() const;
// relations
- virtual QVector<QPair<QAccessibleInterface*, QAccessible::Relation> > relations(QAccessible::Relation match = QAccessible::AllRelations) const;
+ virtual QList<QPair<QAccessibleInterface *, QAccessible::Relation>>
+ relations(QAccessible::Relation match = QAccessible::AllRelations) const;
virtual QAccessibleInterface *focusChild() const;
virtual QAccessibleInterface *childAt(int x, int y) const = 0;
@@ -509,6 +101,15 @@ public:
inline QAccessibleTableCellInterface *tableCellInterface()
{ return reinterpret_cast<QAccessibleTableCellInterface *>(interface_cast(QAccessible::TableCellInterface)); }
+ inline QAccessibleHyperlinkInterface *hyperlinkInterface()
+ { return reinterpret_cast<QAccessibleHyperlinkInterface *>(interface_cast(QAccessible::HyperlinkInterface)); }
+
+ inline QAccessibleSelectionInterface *selectionInterface()
+ { return reinterpret_cast<QAccessibleSelectionInterface *>(interface_cast(QAccessible::SelectionInterface)); }
+
+ inline QAccessibleAttributesInterface *attributesInterface()
+ { return reinterpret_cast<QAccessibleAttributesInterface *>(interface_cast(QAccessible::AttributesInterface)); }
+
virtual void virtual_hook(int id, void *data);
virtual void *interface_cast(QAccessible::InterfaceType)
@@ -660,6 +261,41 @@ public:
virtual QPoint imagePosition() const = 0;
};
+class Q_GUI_EXPORT QAccessibleHyperlinkInterface
+{
+public:
+ virtual ~QAccessibleHyperlinkInterface();
+
+ virtual QString anchor() const = 0;
+ virtual QString anchorTarget() const = 0;
+ virtual int startIndex() const = 0;
+ virtual int endIndex() const = 0;
+ virtual bool isValid() const = 0;
+};
+
+class Q_GUI_EXPORT QAccessibleSelectionInterface
+{
+public:
+ virtual ~QAccessibleSelectionInterface();
+
+ virtual int selectedItemCount() const = 0;
+ virtual QList<QAccessibleInterface*> selectedItems() const = 0;
+ virtual QAccessibleInterface* selectedItem(int selectionIndex) const;
+ virtual bool isSelected(QAccessibleInterface *childItem) const;
+ virtual bool select(QAccessibleInterface *childItem) = 0;
+ virtual bool unselect(QAccessibleInterface *childItem) = 0;
+ virtual bool selectAll() = 0;
+ virtual bool clear() = 0;
+};
+
+class Q_GUI_EXPORT QAccessibleAttributesInterface
+{
+public:
+ virtual ~QAccessibleAttributesInterface();
+ virtual QList<QAccessible::Attribute> attributeKeys() const = 0;
+ virtual QVariant attributeValue(QAccessible::Attribute key) const = 0;
+};
+
class Q_GUI_EXPORT QAccessibleEvent
{
@@ -683,7 +319,7 @@ public:
}
inline QAccessibleEvent(QAccessibleInterface *iface, QAccessible::Event typ)
- : m_type(typ), m_object(nullptr)
+ : m_type(typ)
{
Q_ASSERT(iface);
Q_ASSERT(m_type != QAccessible::ValueChanged);
@@ -695,6 +331,7 @@ public:
Q_ASSERT(m_type != QAccessible::TextUpdated);
Q_ASSERT(m_type != QAccessible::TableModelChanged);
m_uniqueId = QAccessible::uniqueId(iface);
+ m_object = iface->object();
}
virtual ~QAccessibleEvent();
@@ -716,6 +353,7 @@ protected:
QAccessible::Id m_uniqueId;
};
+ friend class QTestAccessibility;
};
class Q_GUI_EXPORT QAccessibleStateChangeEvent :public QAccessibleEvent
@@ -803,13 +441,13 @@ class Q_GUI_EXPORT QAccessibleTextInsertEvent : public QAccessibleTextCursorEven
{
public:
inline QAccessibleTextInsertEvent(QObject *obj, int position, const QString &text)
- : QAccessibleTextCursorEvent(obj, position + text.length())
+ : QAccessibleTextCursorEvent(obj, position + int(text.size()))
, m_position(position), m_text(text)
{
m_type = QAccessible::TextInserted;
}
inline QAccessibleTextInsertEvent(QAccessibleInterface *iface, int position, const QString &text)
- : QAccessibleTextCursorEvent(iface, position + text.length())
+ : QAccessibleTextCursorEvent(iface, position + int(text.size()))
, m_position(position), m_text(text)
{
m_type = QAccessible::TextInserted;
@@ -863,13 +501,13 @@ class Q_GUI_EXPORT QAccessibleTextUpdateEvent : public QAccessibleTextCursorEven
{
public:
inline QAccessibleTextUpdateEvent(QObject *obj, int position, const QString &oldText, const QString &text)
- : QAccessibleTextCursorEvent(obj, position + text.length())
+ : QAccessibleTextCursorEvent(obj, position + int(text.size()))
, m_position(position), m_oldText(oldText), m_text(text)
{
m_type = QAccessible::TextUpdated;
}
inline QAccessibleTextUpdateEvent(QAccessibleInterface *iface, int position, const QString &oldText, const QString &text)
- : QAccessibleTextCursorEvent(iface, position + text.length())
+ : QAccessibleTextCursorEvent(iface, position + int(text.size()))
, m_position(position), m_oldText(oldText), m_text(text)
{
m_type = QAccessible::TextUpdated;
@@ -967,7 +605,7 @@ protected:
int m_lastColumn;
};
-#ifndef Q_CLANG_QDOC
+#ifndef Q_QDOC
#define QAccessibleInterface_iid "org.qt-project.Qt.QAccessibleInterface"
Q_DECLARE_INTERFACE(QAccessibleInterface, QAccessibleInterface_iid)
#endif
@@ -981,18 +619,7 @@ Q_GUI_EXPORT QDebug operator<<(QDebug d, const QAccessibleInterface *iface);
Q_GUI_EXPORT QDebug operator<<(QDebug d, const QAccessibleEvent &ev);
#endif
-#if QT_DEPRECATED_SINCE(5, 0)
-inline void QAccessible::updateAccessibility(QObject *object, int child, Event reason)
-{
- Q_ASSERT(object);
-
- QAccessibleEvent ev(object, reason);
- ev.setChild(child);
- updateAccessibility(&ev);
-}
-#endif
-
QT_END_NAMESPACE
+#endif // QT_CONFIG(accessibility)
#endif // QACCESSIBLE_H
-#endif //!QT_NO_ACCESSIBILITY
diff --git a/src/gui/accessible/qaccessible_base.h b/src/gui/accessible/qaccessible_base.h
new file mode 100644
index 0000000000..2d2b1de316
--- /dev/null
+++ b/src/gui/accessible/qaccessible_base.h
@@ -0,0 +1,420 @@
+// Copyright (C) 2022 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
+
+#ifndef QACCESSIBLE_BASE_H
+#define QACCESSIBLE_BASE_H
+
+#include <QtGui/qtguiglobal.h>
+#if QT_CONFIG(accessibility)
+
+#if 0
+// QAccessible class is handled in qaccessible.h
+#pragma qt_sync_stop_processing
+#endif
+
+#include <QtCore/qobjectdefs.h>
+
+#include <cstring> // memset, memcmp
+
+QT_BEGIN_NAMESPACE
+
+class QAccessibleInterface;
+class QAccessibleEvent;
+class QTextCursor;
+
+class Q_GUI_EXPORT QAccessible
+{
+ Q_GADGET
+public:
+
+ enum Event {
+ SoundPlayed = 0x0001,
+ Alert = 0x0002,
+ ForegroundChanged = 0x0003,
+ MenuStart = 0x0004,
+ MenuEnd = 0x0005,
+ PopupMenuStart = 0x0006,
+ PopupMenuEnd = 0x0007,
+ ContextHelpStart = 0x000C,
+ ContextHelpEnd = 0x000D,
+ DragDropStart = 0x000E,
+ DragDropEnd = 0x000F,
+ DialogStart = 0x0010,
+ DialogEnd = 0x0011,
+ ScrollingStart = 0x0012,
+ ScrollingEnd = 0x0013,
+
+ MenuCommand = 0x0018,
+
+ // Values from IAccessible2
+ ActionChanged = 0x0101,
+ ActiveDescendantChanged = 0x0102,
+ AttributeChanged = 0x0103,
+ DocumentContentChanged = 0x0104,
+ DocumentLoadComplete = 0x0105,
+ DocumentLoadStopped = 0x0106,
+ DocumentReload = 0x0107,
+ HyperlinkEndIndexChanged = 0x0108,
+ HyperlinkNumberOfAnchorsChanged = 0x0109,
+ HyperlinkSelectedLinkChanged = 0x010A,
+ HypertextLinkActivated = 0x010B,
+ HypertextLinkSelected = 0x010C,
+ HyperlinkStartIndexChanged = 0x010D,
+ HypertextChanged = 0x010E,
+ HypertextNLinksChanged = 0x010F,
+ ObjectAttributeChanged = 0x0110,
+ PageChanged = 0x0111,
+ SectionChanged = 0x0112,
+ TableCaptionChanged = 0x0113,
+ TableColumnDescriptionChanged = 0x0114,
+ TableColumnHeaderChanged = 0x0115,
+ TableModelChanged = 0x0116,
+ TableRowDescriptionChanged = 0x0117,
+ TableRowHeaderChanged = 0x0118,
+ TableSummaryChanged = 0x0119,
+ TextAttributeChanged = 0x011A,
+ TextCaretMoved = 0x011B,
+ // TextChanged = 0x011C, is deprecated in IA2, use TextUpdated
+ TextColumnChanged = 0x011D,
+ TextInserted = 0x011E,
+ TextRemoved = 0x011F,
+ TextUpdated = 0x0120,
+ TextSelectionChanged = 0x0121,
+ VisibleDataChanged = 0x0122,
+
+ ObjectCreated = 0x8000,
+ ObjectDestroyed = 0x8001,
+ ObjectShow = 0x8002,
+ ObjectHide = 0x8003,
+ ObjectReorder = 0x8004,
+ Focus = 0x8005,
+ Selection = 0x8006,
+ SelectionAdd = 0x8007,
+ SelectionRemove = 0x8008,
+ SelectionWithin = 0x8009,
+ StateChanged = 0x800A,
+ LocationChanged = 0x800B,
+ NameChanged = 0x800C,
+ DescriptionChanged = 0x800D,
+ ValueChanged = 0x800E,
+ ParentChanged = 0x800F,
+ HelpChanged = 0x80A0,
+ DefaultActionChanged = 0x80B0,
+ AcceleratorChanged = 0x80C0,
+
+ InvalidEvent
+ };
+ Q_ENUM(Event)
+
+ // 64 bit enums seem hard on some platforms (windows...)
+ // which makes using a bit field a sensible alternative
+ struct State {
+ // http://msdn.microsoft.com/en-us/library/ms697270.aspx
+ quint64 disabled : 1; // used to be Unavailable
+ quint64 selected : 1;
+ quint64 focusable : 1;
+ quint64 focused : 1;
+ quint64 pressed : 1;
+ quint64 checkable : 1;
+ quint64 checked : 1;
+ quint64 checkStateMixed : 1; // used to be Mixed
+ quint64 readOnly : 1;
+ quint64 hotTracked : 1;
+ quint64 defaultButton : 1;
+ quint64 expanded : 1;
+ quint64 collapsed : 1;
+ quint64 busy : 1;
+ quint64 expandable : 1;
+ quint64 marqueed : 1;
+ quint64 animated : 1;
+ quint64 invisible : 1;
+ quint64 offscreen : 1;
+ quint64 sizeable : 1;
+ quint64 movable : 1;
+ quint64 selfVoicing : 1;
+ quint64 selectable : 1;
+ quint64 linked : 1;
+ quint64 traversed : 1;
+ quint64 multiSelectable : 1;
+ quint64 extSelectable : 1;
+ quint64 passwordEdit : 1; // used to be Protected
+ quint64 hasPopup : 1;
+ quint64 modal : 1;
+
+ // IA2 - we chose to not add some IA2 states for now
+ // Below the ones that seem helpful
+ quint64 active : 1;
+ quint64 invalid : 1; // = defunct
+ quint64 editable : 1;
+ quint64 multiLine : 1;
+ quint64 selectableText : 1;
+ quint64 supportsAutoCompletion : 1;
+
+ quint64 searchEdit : 1;
+
+ // quint64 horizontal : 1;
+ // quint64 vertical : 1;
+ // quint64 invalidEntry : 1;
+ // quint64 managesDescendants : 1;
+ // quint64 singleLine : 1; // we have multi line, this is redundant.
+ // quint64 stale : 1;
+ // quint64 transient : 1;
+ // quint64 pinned : 1;
+
+ // Apple - see http://mattgemmell.com/2010/12/19/accessibility-for-iphone-and-ipad-apps/
+ // quint64 playsSound : 1;
+ // quint64 summaryElement : 1;
+ // quint64 updatesFrequently : 1;
+ // quint64 adjustable : 1;
+ // more and not included here: http://developer.apple.com/library/mac/#documentation/UserExperience/Reference/Accessibility_RoleAttribute_Ref/Attributes.html
+
+ // MSAA
+ // quint64 alertLow : 1;
+ // quint64 alertMedium : 1;
+ // quint64 alertHigh : 1;
+
+ State() {
+ std::memset(this, 0, sizeof(State));
+ }
+ friend inline bool operator==(const QAccessible::State &first, const QAccessible::State &second)
+ {
+ return std::memcmp(&first, &second, sizeof(QAccessible::State)) == 0;
+ }
+ };
+
+
+
+
+
+ enum Role {
+ NoRole = 0x00000000,
+ TitleBar = 0x00000001,
+ MenuBar = 0x00000002,
+ ScrollBar = 0x00000003,
+ Grip = 0x00000004,
+ Sound = 0x00000005,
+ Cursor = 0x00000006,
+ Caret = 0x00000007,
+ AlertMessage = 0x00000008,
+ Window = 0x00000009,
+ Client = 0x0000000A,
+ PopupMenu = 0x0000000B,
+ MenuItem = 0x0000000C,
+ ToolTip = 0x0000000D,
+ Application = 0x0000000E,
+ Document = 0x0000000F,
+ Pane = 0x00000010,
+ Chart = 0x00000011,
+ Dialog = 0x00000012,
+ Border = 0x00000013,
+ Grouping = 0x00000014,
+ Separator = 0x00000015,
+ ToolBar = 0x00000016,
+ StatusBar = 0x00000017,
+ Table = 0x00000018,
+ ColumnHeader = 0x00000019,
+ RowHeader = 0x0000001A,
+ Column = 0x0000001B,
+ Row = 0x0000001C,
+ Cell = 0x0000001D,
+ Link = 0x0000001E,
+ HelpBalloon = 0x0000001F,
+ Assistant = 0x00000020,
+ List = 0x00000021,
+ ListItem = 0x00000022,
+ Tree = 0x00000023,
+ TreeItem = 0x00000024,
+ PageTab = 0x00000025,
+ PropertyPage = 0x00000026,
+ Indicator = 0x00000027,
+ Graphic = 0x00000028,
+ StaticText = 0x00000029,
+ EditableText = 0x0000002A, // Editable, selectable, etc.
+ Button = 0x0000002B,
+#ifndef Q_QDOC
+ PushButton = Button, // deprecated
+#endif
+ CheckBox = 0x0000002C,
+ RadioButton = 0x0000002D,
+ ComboBox = 0x0000002E,
+ // DropList = 0x0000002F,
+ ProgressBar = 0x00000030,
+ Dial = 0x00000031,
+ HotkeyField = 0x00000032,
+ Slider = 0x00000033,
+ SpinBox = 0x00000034,
+ Canvas = 0x00000035, // MSAA: ROLE_SYSTEM_DIAGRAM - The object represents a graphical image that is used to diagram data.
+ Animation = 0x00000036,
+ Equation = 0x00000037,
+ ButtonDropDown = 0x00000038, // The object represents a button that expands a grid.
+ ButtonMenu = 0x00000039,
+ ButtonDropGrid = 0x0000003A,
+ Whitespace = 0x0000003B, // The object represents blank space between other objects.
+ PageTabList = 0x0000003C,
+ Clock = 0x0000003D,
+ Splitter = 0x0000003E,
+ // Reserved space in case MSAA roles needs to be added
+
+ // Additional Qt roles where enum value does not map directly to MSAA:
+ LayeredPane = 0x00000080,
+ Terminal = 0x00000081,
+ Desktop = 0x00000082,
+ Paragraph = 0x00000083,
+ WebDocument = 0x00000084,
+ Section = 0x00000085,
+ Notification = 0x00000086,
+
+ // IAccessible2 roles
+ // IA2_ROLE_CANVAS = 0x401, // An object that can be drawn into and to manage events from the objects drawn into it
+ // IA2_ROLE_CAPTION = 0x402,
+ // IA2_ROLE_CHECK_MENU_ITEM = 0x403,
+ ColorChooser = 0x404,
+ // IA2_ROLE_DATE_EDITOR = 0x405,
+ // IA2_ROLE_DESKTOP_ICON = 0x406,
+ // IA2_ROLE_DESKTOP_PANE = 0x407,
+ // IA2_ROLE_DIRECTORY_PANE = 0x408,
+ // IA2_ROLE_EDITBAR = 0x409,
+ // IA2_ROLE_EMBEDDED_OBJECT = 0x40A,
+ // IA2_ROLE_ENDNOTE = 0x40B,
+ // IA2_ROLE_FILE_CHOOSER = 0x40C,
+ // IA2_ROLE_FONT_CHOOSER = 0x40D,
+ Footer = 0x40E,
+ // IA2_ROLE_FOOTNOTE = 0x40F,
+ Form = 0x410,
+ // some platforms (windows and at-spi) use Frame for regular windows
+ // because window was taken for tool/dock windows by MSAA
+ // Frame = 0x411,
+ // IA2_ROLE_GLASS_PANE = 0x412,
+ // IA2_ROLE_HEADER = 0x413,
+ Heading = 0x414,
+ // IA2_ROLE_ICON = 0x415,
+ // IA2_ROLE_IMAGE_MAP = 0x416,
+ // IA2_ROLE_INPUT_METHOD_WINDOW = 0x417,
+ // IA2_ROLE_INTERNAL_FRAME = 0x418,
+ // IA2_ROLE_LABEL = 0x419,
+ // IA2_ROLE_LAYERED_PANE = 0x41A,
+ Note = 0x41B,
+ // IA2_ROLE_OPTION_PANE = 0x41C,
+ // IA2_ROLE_PAGE = 0x41D,
+ // IA2_ROLE_PARAGRAPH = 0x42E,
+ // IA2_ROLE_RADIO_MENU_ITEM = 0x41F,
+ // IA2_ROLE_REDUNDANT_OBJECT = 0x420,
+ // IA2_ROLE_ROOT_PANE = 0x421,
+ // IA2_ROLE_RULER = 0x422,
+ // IA2_ROLE_SCROLL_PANE = 0x423,
+ // IA2_ROLE_SECTION = 0x424,
+ // IA2_ROLE_SHAPE = 0x425,
+ // IA2_ROLE_SPLIT_PANE = 0x426,
+ // IA2_ROLE_TEAR_OFF_MENU = 0x427,
+ // IA2_ROLE_TERMINAL = 0x428,
+ // IA2_ROLE_TEXT_FRAME = 0x429,
+ // IA2_ROLE_TOGGLE_BUTTON = 0x42A,
+ // IA2_ROLE_VIEW_PORT = 0x42B,
+ ComplementaryContent = 0x42C,
+
+ UserRole = 0x0000ffff
+ };
+ Q_ENUM(Role)
+
+ enum Text {
+ Name = 0,
+ Description,
+ Value,
+ Help,
+ Accelerator,
+ DebugDescription,
+ UserText = 0x0000ffff
+ };
+
+ enum RelationFlag {
+ Label = 0x00000001,
+ Labelled = 0x00000002,
+ Controller = 0x00000004,
+ Controlled = 0x00000008,
+ DescriptionFor = 0x00000010,
+ Described = 0x00000020,
+ FlowsFrom = 0x00000040,
+ FlowsTo = 0x00000080,
+ AllRelations = 0xffffffff
+ };
+ Q_DECLARE_FLAGS(Relation, RelationFlag)
+
+ enum InterfaceType
+ {
+ TextInterface,
+ EditableTextInterface,
+ ValueInterface,
+ ActionInterface,
+ ImageInterface,
+ TableInterface,
+ TableCellInterface,
+ HyperlinkInterface,
+ SelectionInterface,
+ AttributesInterface,
+ };
+
+ enum TextBoundaryType {
+ CharBoundary,
+ WordBoundary,
+ SentenceBoundary,
+ ParagraphBoundary,
+ LineBoundary,
+ NoBoundary
+ };
+
+ enum class Attribute {
+ Custom,
+ Level,
+ };
+
+ typedef QAccessibleInterface*(*InterfaceFactory)(const QString &key, QObject*);
+ typedef void(*UpdateHandler)(QAccessibleEvent *event);
+ typedef void(*RootObjectHandler)(QObject*);
+
+ typedef unsigned Id;
+
+ static void installFactory(InterfaceFactory);
+ static void removeFactory(InterfaceFactory);
+ static UpdateHandler installUpdateHandler(UpdateHandler);
+ static RootObjectHandler installRootObjectHandler(RootObjectHandler);
+
+ class Q_GUI_EXPORT ActivationObserver
+ {
+ public:
+ virtual ~ActivationObserver();
+ virtual void accessibilityActiveChanged(bool active) = 0;
+ };
+ static void installActivationObserver(ActivationObserver *);
+ static void removeActivationObserver(ActivationObserver *);
+
+ static QAccessibleInterface *queryAccessibleInterface(QObject *);
+ static Id uniqueId(QAccessibleInterface *iface);
+ static QAccessibleInterface *accessibleInterface(Id uniqueId);
+ static Id registerAccessibleInterface(QAccessibleInterface *iface);
+ static void deleteAccessibleInterface(Id uniqueId);
+
+ static void updateAccessibility(QAccessibleEvent *event);
+
+ static bool isActive();
+ static void setActive(bool active);
+ static void setRootObject(QObject *object);
+
+ static void cleanup();
+
+ static QPair< int, int > qAccessibleTextBoundaryHelper(const QTextCursor &cursor, TextBoundaryType boundaryType);
+
+private:
+ static UpdateHandler updateHandler;
+ static RootObjectHandler rootObjectHandler;
+
+ QAccessible() {}
+
+ friend class QAccessibleCache;
+};
+
+Q_DECLARE_OPERATORS_FOR_FLAGS(QAccessible::Relation)
+
+QT_END_NAMESPACE
+
+#endif // QT_CONFIG(accessibility)
+#endif // QACCESSIBLE_BASE_H
diff --git a/src/gui/accessible/qaccessiblebridge.cpp b/src/gui/accessible/qaccessiblebridge.cpp
index c6a417e063..a8b54b0c68 100644
--- a/src/gui/accessible/qaccessiblebridge.cpp
+++ b/src/gui/accessible/qaccessiblebridge.cpp
@@ -1,45 +1,9 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the QtGui module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#include "qaccessiblebridge.h"
-#ifndef QT_NO_ACCESSIBILITY
+#if QT_CONFIG(accessibility)
QT_BEGIN_NAMESPACE
@@ -138,4 +102,6 @@ QAccessibleBridgePlugin::~QAccessibleBridgePlugin()
QT_END_NAMESPACE
-#endif // QT_NO_ACCESSIBILITY
+#include "moc_qaccessiblebridge.cpp"
+
+#endif // QT_CONFIG(accessibility)
diff --git a/src/gui/accessible/qaccessiblebridge.h b/src/gui/accessible/qaccessiblebridge.h
index 168889135b..4d817c8e58 100644
--- a/src/gui/accessible/qaccessiblebridge.h
+++ b/src/gui/accessible/qaccessiblebridge.h
@@ -1,41 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the QtGui module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#ifndef QACCESSIBLEBRIDGE_H
#define QACCESSIBLEBRIDGE_H
@@ -47,7 +11,7 @@
QT_BEGIN_NAMESPACE
-#ifndef QT_NO_ACCESSIBILITY
+#if QT_CONFIG(accessibility)
class QAccessibleInterface;
class QAccessibleEvent;
@@ -72,7 +36,7 @@ public:
virtual QAccessibleBridge *create(const QString &key) = 0;
};
-#endif // QT_NO_ACCESSIBILITY
+#endif // QT_CONFIG(accessibility)
QT_END_NAMESPACE
diff --git a/src/gui/accessible/qaccessiblebridgeutils.cpp b/src/gui/accessible/qaccessiblebridgeutils.cpp
new file mode 100644
index 0000000000..994f95fee9
--- /dev/null
+++ b/src/gui/accessible/qaccessiblebridgeutils.cpp
@@ -0,0 +1,77 @@
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
+#include "qaccessiblebridgeutils_p.h"
+#include <QtCore/qmath.h>
+
+QT_BEGIN_NAMESPACE
+
+namespace QAccessibleBridgeUtils {
+
+static bool performAction(QAccessibleInterface *iface, const QString &actionName)
+{
+ if (QAccessibleActionInterface *actionIface = iface->actionInterface()) {
+ if (actionIface->actionNames().contains(actionName)) {
+ actionIface->doAction(actionName);
+ return true;
+ }
+ }
+ return false;
+}
+
+QStringList effectiveActionNames(QAccessibleInterface *iface)
+{
+ QStringList actions;
+ if (QAccessibleActionInterface *actionIface = iface->actionInterface())
+ actions = actionIface->actionNames();
+
+ if (iface->valueInterface()) {
+ if (!actions.contains(QAccessibleActionInterface::increaseAction()))
+ actions << QAccessibleActionInterface::increaseAction();
+ if (!actions.contains(QAccessibleActionInterface::decreaseAction()))
+ actions << QAccessibleActionInterface::decreaseAction();
+ }
+ return actions;
+}
+
+bool performEffectiveAction(QAccessibleInterface *iface, const QString &actionName)
+{
+ if (!iface)
+ return false;
+ if (performAction(iface, actionName))
+ return true;
+ if (actionName != QAccessibleActionInterface::increaseAction()
+ && actionName != QAccessibleActionInterface::decreaseAction())
+ return false;
+
+ QAccessibleValueInterface *valueIface = iface->valueInterface();
+ if (!valueIface)
+ return false;
+ bool success;
+ const QVariant currentVariant = valueIface->currentValue();
+ double stepSize = valueIface->minimumStepSize().toDouble(&success);
+ if (!success || qFuzzyIsNull(stepSize)) {
+ const double min = valueIface->minimumValue().toDouble(&success);
+ if (!success)
+ return false;
+ const double max = valueIface->maximumValue().toDouble(&success);
+ if (!success)
+ return false;
+ stepSize = (max - min) / 10; // this is pretty arbitrary, we just need to provide something
+ const int typ = currentVariant.userType();
+ if (typ != QMetaType::Float && typ != QMetaType::Double) {
+ // currentValue is an integer. Round it up to ensure stepping in case it was below 1
+ stepSize = qCeil(stepSize);
+ }
+ }
+ const double current = currentVariant.toDouble(&success);
+ if (!success)
+ return false;
+ if (actionName == QAccessibleActionInterface::decreaseAction())
+ stepSize = -stepSize;
+ valueIface->setCurrentValue(current + stepSize);
+ return true;
+}
+
+} //namespace
+
+QT_END_NAMESPACE
diff --git a/src/gui/accessible/qaccessiblebridgeutils_p.h b/src/gui/accessible/qaccessiblebridgeutils_p.h
new file mode 100644
index 0000000000..b65a4d0b6c
--- /dev/null
+++ b/src/gui/accessible/qaccessiblebridgeutils_p.h
@@ -0,0 +1,34 @@
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
+
+#ifndef QACCESSIBLEBRIDGEUTILS_H
+#define QACCESSIBLEBRIDGEUTILS_H
+
+//
+// W A R N I N G
+// -------------
+//
+// This file is not part of the Qt API. It exists for the convenience
+// of other Qt classes. This header file may change from version to
+// version without notice, or even be removed.
+//
+// We mean it.
+//
+
+#include <QtGui/private/qtguiglobal_p.h>
+
+#include <QtCore/qstringlist.h>
+#include <QtGui/qaccessible.h>
+
+QT_REQUIRE_CONFIG(accessibility);
+
+QT_BEGIN_NAMESPACE
+
+namespace QAccessibleBridgeUtils {
+ Q_GUI_EXPORT QStringList effectiveActionNames(QAccessibleInterface *iface);
+ Q_GUI_EXPORT bool performEffectiveAction(QAccessibleInterface *iface, const QString &actionName);
+}
+
+QT_END_NAMESPACE
+
+#endif //QACCESSIBLEBRIDGEUTILS_H
diff --git a/src/gui/accessible/qaccessiblecache.cpp b/src/gui/accessible/qaccessiblecache.cpp
index 20376a54c4..b41a2481f9 100644
--- a/src/gui/accessible/qaccessiblecache.cpp
+++ b/src/gui/accessible/qaccessiblecache.cpp
@@ -1,47 +1,11 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the QtGui module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#include "qaccessiblecache_p.h"
#include <QtCore/qdebug.h>
#include <QtCore/qloggingcategory.h>
-#ifndef QT_NO_ACCESSIBILITY
+#if QT_CONFIG(accessibility)
QT_BEGIN_NAMESPACE
@@ -84,18 +48,18 @@ QAccessibleCache *QAccessibleCache::instance()
QAccessible::Id QAccessibleCache::acquireId() const
{
static const QAccessible::Id FirstId = QAccessible::Id(INT_MAX) + 1;
- static QAccessible::Id lastUsedId = FirstId;
+ static QAccessible::Id nextId = FirstId;
- while (idToInterface.contains(lastUsedId)) {
+ while (idToInterface.contains(nextId)) {
// (wrap back when when we reach UINT_MAX - 1)
// -1 because on Android -1 is taken for the "View" so just avoid it completely for consistency
- if (lastUsedId == UINT_MAX - 1)
- lastUsedId = FirstId;
+ if (nextId == UINT_MAX - 1)
+ nextId = FirstId;
else
- ++lastUsedId;
+ ++nextId;
}
- return lastUsedId;
+ return nextId++;
}
QAccessibleInterface *QAccessibleCache::interfaceForId(QAccessible::Id id) const
@@ -108,20 +72,51 @@ QAccessible::Id QAccessibleCache::idForInterface(QAccessibleInterface *iface) co
return interfaceToId.value(iface);
}
+QAccessible::Id QAccessibleCache::idForObject(QObject *obj) const
+{
+ if (obj) {
+ const QMetaObject *mo = obj->metaObject();
+ for (auto pair : objectToId.values(obj)) {
+ if (pair.second == mo) {
+ return pair.first;
+ }
+ }
+ }
+ return 0;
+}
+
+/*!
+ * \internal
+ *
+ * returns true if the cache has an interface for the object and its corresponding QMetaObject
+ */
+bool QAccessibleCache::containsObject(QObject *obj) const
+{
+ if (obj) {
+ const QMetaObject *mo = obj->metaObject();
+ for (auto pair : objectToId.values(obj)) {
+ if (pair.second == mo) {
+ return true;
+ }
+ }
+ }
+ return false;
+}
+
QAccessible::Id QAccessibleCache::insert(QObject *object, QAccessibleInterface *iface) const
{
Q_ASSERT(iface);
- Q_UNUSED(object)
+ Q_UNUSED(object);
// object might be 0
- Q_ASSERT(!objectToId.contains(object));
+ Q_ASSERT(!containsObject(object));
Q_ASSERT_X(!interfaceToId.contains(iface), "", "Accessible interface inserted into cache twice!");
QAccessible::Id id = acquireId();
QObject *obj = iface->object();
Q_ASSERT(object == obj);
if (obj) {
- objectToId.insert(obj, id);
+ objectToId.insert(obj, qMakePair(id, obj->metaObject()));
connect(obj, &QObject::destroyed, this, &QAccessibleCache::objectDestroyed);
}
idToInterface.insert(id, iface);
@@ -132,8 +127,33 @@ QAccessible::Id QAccessibleCache::insert(QObject *object, QAccessibleInterface *
void QAccessibleCache::objectDestroyed(QObject* obj)
{
- QAccessible::Id id = objectToId.value(obj);
- if (id) {
+ /*
+ In some cases we might add a not fully-constructed object to the cache. This might happen with
+ for instance QWidget subclasses that are in the construction phase. If updateAccessibility() is
+ called in the constructor of QWidget (directly or indirectly), it will end up asking for the
+ classname of that widget in order to know which accessibility interface subclass the
+ accessibility factory should instantiate and return. However, since that requires a virtual
+ call to metaObject(), it will return the metaObject() of QWidget (not for the subclass), and so
+ the factory will ultimately return a rather generic QAccessibleWidget instead of a more
+ specialized interface. Even though it is a "incomplete" interface it will be put in the cache
+ and it will be usable as if the object is a widget. In order for the cache to not just return
+ the same generic QAccessibleWidget for that object, we have to check if the cache matches
+ the objects QMetaObject. We therefore use a QMultiHash and also store the QMetaObject * in
+ the value. We therefore might potentially store several values for the corresponding object
+ (in theory one for each level in the class inheritance chain)
+
+ This means that after the object have been fully constructed, we will at some point again query
+ for the interface for the same object, but now its metaObject() returns the correct
+ QMetaObject, so it won't return the QAccessibleWidget that is associated with the object in the
+ cache. Instead it will go to the factory and create the _correct_ specialized interface for the
+ object. If that succeeded, it will also put that entry in the cache. We will therefore in those
+ cases insert *two* cache entries for the same object (using QMultiHash). They both must live
+ until the object is destroyed.
+
+ So when the object is destroyed we might have to delete two entries from the cache.
+ */
+ for (auto pair : objectToId.values(obj)) {
+ QAccessible::Id id = pair.first;
Q_ASSERT_X(idToInterface.contains(id), "", "QObject with accessible interface deleted, where interface not in cache!");
deleteInterface(id, obj);
}
@@ -159,4 +179,6 @@ void QAccessibleCache::deleteInterface(QAccessible::Id id, QObject *obj)
QT_END_NAMESPACE
+#include "moc_qaccessiblecache_p.cpp"
+
#endif
diff --git a/src/gui/accessible/qaccessiblecache_mac.mm b/src/gui/accessible/qaccessiblecache_mac.mm
index 3f49eb98fd..77a9613d38 100644
--- a/src/gui/accessible/qaccessiblecache_mac.mm
+++ b/src/gui/accessible/qaccessiblecache_mac.mm
@@ -1,41 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the QtGui module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#include "qaccessiblecache_p.h"
diff --git a/src/gui/accessible/qaccessiblecache_p.h b/src/gui/accessible/qaccessiblecache_p.h
index cf1ed04f35..d1abca0f5d 100644
--- a/src/gui/accessible/qaccessiblecache_p.h
+++ b/src/gui/accessible/qaccessiblecache_p.h
@@ -1,41 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the QtGui module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#ifndef QACCESSIBLECACHE_P
#define QACCESSIBLECACHE_P
@@ -57,7 +21,7 @@
#include "qaccessible.h"
-#ifndef QT_NO_ACCESSIBILITY
+#if QT_CONFIG(accessibility)
Q_FORWARD_DECLARE_OBJC_CLASS(QT_MANGLE_NAMESPACE(QMacAccessibilityElement));
@@ -72,6 +36,8 @@ public:
static QAccessibleCache *instance();
QAccessibleInterface *interfaceForId(QAccessible::Id id) const;
QAccessible::Id idForInterface(QAccessibleInterface *iface) const;
+ QAccessible::Id idForObject(QObject *obj) const;
+ bool containsObject(QObject *obj) const;
QAccessible::Id insert(QObject *object, QAccessibleInterface *iface) const;
void deleteInterface(QAccessible::Id id, QObject *obj = nullptr);
@@ -88,7 +54,7 @@ private:
mutable QHash<QAccessible::Id, QAccessibleInterface *> idToInterface;
mutable QHash<QAccessibleInterface *, QAccessible::Id> interfaceToId;
- mutable QHash<QObject *, QAccessible::Id> objectToId;
+ mutable QMultiHash<QObject *, QPair<QAccessible::Id, const QMetaObject*>> objectToId;
#ifdef Q_OS_MAC
void removeCocoaElement(QAccessible::Id axid);
@@ -101,6 +67,6 @@ private:
QT_END_NAMESPACE
-#endif // QT_NO_ACCESSIBILITY
+#endif // QT_CONFIG(accessibility)
#endif
diff --git a/src/gui/accessible/qaccessibleobject.cpp b/src/gui/accessible/qaccessibleobject.cpp
index 771cfda574..61d3a90632 100644
--- a/src/gui/accessible/qaccessibleobject.cpp
+++ b/src/gui/accessible/qaccessibleobject.cpp
@@ -1,45 +1,9 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the QtGui module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#include "qaccessibleobject.h"
-#ifndef QT_NO_ACCESSIBILITY
+#if QT_CONFIG(accessibility)
#include <QtGui/QGuiApplication>
#include <QtGui/QWindow>
@@ -160,7 +124,7 @@ static QObjectList topLevelObjects()
{
QObjectList list;
const QWindowList tlw(QGuiApplication::topLevelWindows());
- for (int i = 0; i < tlw.count(); ++i) {
+ for (int i = 0; i < tlw.size(); ++i) {
QWindow *w = tlw.at(i);
if (w->type() != Qt::Popup && w->type() != Qt::Desktop) {
if (QAccessibleInterface *root = w->accessibleRoot()) {
@@ -176,7 +140,7 @@ static QObjectList topLevelObjects()
/*! \reimp */
int QAccessibleApplication::childCount() const
{
- return topLevelObjects().count();
+ return topLevelObjects().size();
}
/*! \reimp */
@@ -196,7 +160,7 @@ QAccessibleInterface *QAccessibleApplication::parent() const
QAccessibleInterface *QAccessibleApplication::child(int index) const
{
const QObjectList tlo(topLevelObjects());
- if (index >= 0 && index < tlo.count())
+ if (index >= 0 && index < tlo.size())
return QAccessible::queryAccessibleInterface(tlo.at(index));
return nullptr;
}
@@ -239,4 +203,4 @@ QAccessible::State QAccessibleApplication::state() const
QT_END_NAMESPACE
-#endif //QT_NO_ACCESSIBILITY
+#endif // QT_CONFIG(accessibility)
diff --git a/src/gui/accessible/qaccessibleobject.h b/src/gui/accessible/qaccessibleobject.h
index fd07d33a18..8e7dd1399c 100644
--- a/src/gui/accessible/qaccessibleobject.h
+++ b/src/gui/accessible/qaccessibleobject.h
@@ -1,41 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the QtGui module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#ifndef QACCESSIBLEOBJECT_H
#define QACCESSIBLEOBJECT_H
@@ -46,7 +10,7 @@
QT_BEGIN_NAMESPACE
-#ifndef QT_NO_ACCESSIBILITY
+#if QT_CONFIG(accessibility)
class QAccessibleObjectPrivate;
class QObject;
@@ -93,7 +57,7 @@ public:
QAccessible::State state() const override;
};
-#endif // QT_NO_ACCESSIBILITY
+#endif // QT_CONFIG(accessibility)
QT_END_NAMESPACE
diff --git a/src/gui/accessible/qaccessibleplugin.cpp b/src/gui/accessible/qaccessibleplugin.cpp
index 27497858b5..524d67bf35 100644
--- a/src/gui/accessible/qaccessibleplugin.cpp
+++ b/src/gui/accessible/qaccessibleplugin.cpp
@@ -1,45 +1,9 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the QtGui module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include <QtCore/qglobal.h>
-
-#ifndef QT_NO_ACCESSIBILITY
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
+
+#include <QtGui/qtguiglobal.h>
+
+#if QT_CONFIG(accessibility)
#include "qaccessibleplugin.h"
#include "qaccessible.h"
@@ -48,6 +12,7 @@ QT_BEGIN_NAMESPACE
/*!
\class QAccessiblePlugin
+ \inmodule QtGui
\brief The QAccessiblePlugin class provides an abstract base class
for plugins provinding accessibility information for user interface elements.
@@ -89,4 +54,6 @@ QAccessiblePlugin::~QAccessiblePlugin()
QT_END_NAMESPACE
-#endif // QT_NO_ACCESSIBILITY
+#include "moc_qaccessibleplugin.cpp"
+
+#endif // QT_CONFIG(accessibility)
diff --git a/src/gui/accessible/qaccessibleplugin.h b/src/gui/accessible/qaccessibleplugin.h
index 68e6a839d8..014f714b09 100644
--- a/src/gui/accessible/qaccessibleplugin.h
+++ b/src/gui/accessible/qaccessibleplugin.h
@@ -1,41 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the QtGui module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#ifndef QACCESSIBLEPLUGIN_H
#define QACCESSIBLEPLUGIN_H
@@ -47,9 +11,8 @@
QT_BEGIN_NAMESPACE
-#ifndef QT_NO_ACCESSIBILITY
+#if QT_CONFIG(accessibility)
-class QStringList;
class QAccessibleInterface;
#define QAccessibleFactoryInterface_iid "org.qt-project.Qt.QAccessibleFactoryInterface"
@@ -66,7 +29,7 @@ public:
virtual QAccessibleInterface *create(const QString &key, QObject *object) = 0;
};
-#endif // QT_NO_ACCESSIBILITY
+#endif // QT_CONFIG(accessibility)
QT_END_NAMESPACE
diff --git a/src/gui/accessible/qplatformaccessibility.cpp b/src/gui/accessible/qplatformaccessibility.cpp
index 4813b83963..ae7635ff7c 100644
--- a/src/gui/accessible/qplatformaccessibility.cpp
+++ b/src/gui/accessible/qplatformaccessibility.cpp
@@ -1,41 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the QtGui module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#include "qplatformaccessibility.h"
#include <private/qfactoryloader_p.h>
#include "qaccessibleplugin.h"
@@ -47,13 +11,15 @@
QT_BEGIN_NAMESPACE
-#ifndef QT_NO_ACCESSIBILITY
+using namespace Qt::StringLiterals;
+
+#if QT_CONFIG(accessibility)
/* accessiblebridge plugin discovery stuff */
Q_GLOBAL_STATIC_WITH_ARGS(QFactoryLoader, bridgeloader,
- (QAccessibleBridgeFactoryInterface_iid, QLatin1String("/accessiblebridge")))
+ (QAccessibleBridgeFactoryInterface_iid, "/accessiblebridge"_L1))
-Q_GLOBAL_STATIC(QVector<QAccessibleBridge *>, bridges)
+Q_GLOBAL_STATIC(QList<QAccessibleBridge *>, bridges)
/*!
\class QPlatformAccessibility
@@ -84,7 +50,7 @@ void QPlatformAccessibility::notifyAccessibilityUpdate(QAccessibleEvent *event)
if (!bridges() || bridges()->isEmpty())
return;
- for (int i = 0; i < bridges()->count(); ++i)
+ for (int i = 0; i < bridges()->size(); ++i)
bridges()->at(i)->notifyAccessibilityUpdate(event);
}
@@ -97,7 +63,7 @@ void QPlatformAccessibility::setRootObject(QObject *o)
if (!o)
return;
- for (int i = 0; i < bridges()->count(); ++i) {
+ for (int i = 0; i < bridges()->size(); ++i) {
QAccessibleInterface *iface = QAccessible::queryAccessibleInterface(o);
bridges()->at(i)->setRootObject(iface);
}
@@ -139,6 +105,6 @@ void QPlatformAccessibility::setActive(bool active)
QAccessible::setActive(active);
}
-#endif // QT_NO_ACCESSIBILITY
+#endif // QT_CONFIG(accessibility)
QT_END_NAMESPACE
diff --git a/src/gui/accessible/qplatformaccessibility.h b/src/gui/accessible/qplatformaccessibility.h
index 5d668c2bd6..004fcfb40f 100644
--- a/src/gui/accessible/qplatformaccessibility.h
+++ b/src/gui/accessible/qplatformaccessibility.h
@@ -1,41 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the QtGui module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#ifndef QPLATFORMACCESSIBILITY_H
#define QPLATFORMACCESSIBILITY_H
@@ -50,7 +14,7 @@
#include <QtGui/qtguiglobal.h>
-#ifndef QT_NO_ACCESSIBILITY
+#if QT_CONFIG(accessibility)
#include <QtCore/qobject.h>
#include <QtGui/qaccessible.h>
@@ -78,6 +42,6 @@ private:
QT_END_NAMESPACE
-#endif // QT_NO_ACCESSIBILITY
+#endif // QT_CONFIG(accessibility)
#endif // QPLATFORMACCESSIBILITY_H
diff --git a/src/gui/animation/animation.pri b/src/gui/animation/animation.pri
deleted file mode 100644
index add9ae7119..0000000000
--- a/src/gui/animation/animation.pri
+++ /dev/null
@@ -1,2 +0,0 @@
-SOURCES += \
- animation/qguivariantanimation.cpp
diff --git a/src/gui/animation/qguivariantanimation.cpp b/src/gui/animation/qguivariantanimation.cpp
index 8afe77ed46..2a7f1a6db2 100644
--- a/src/gui/animation/qguivariantanimation.cpp
+++ b/src/gui/animation/qguivariantanimation.cpp
@@ -1,41 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the QtGui module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#include <QtGui/qtguiglobal.h>
#include <QtCore/qvariantanimation.h>
diff --git a/src/gui/compat/removed_api.cpp b/src/gui/compat/removed_api.cpp
new file mode 100644
index 0000000000..a642c33c42
--- /dev/null
+++ b/src/gui/compat/removed_api.cpp
@@ -0,0 +1,70 @@
+// Copyright (C) 2023 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
+
+#define QT_GUI_BUILD_REMOVED_API
+
+#include "qtguiglobal.h"
+
+QT_USE_NAMESPACE
+
+#if QT_GUI_REMOVED_SINCE(6, 4)
+
+#include "qpagesize.h" // removed duplicate declaration of op==
+ // (still caused an symbol on some platforms)
+
+// #include "qotherheader.h"
+// // implement removed functions from qotherheader.h
+// order sections alphabetically
+
+#endif // QT_GUI_REMOVED_SINCE(6, 4)
+
+#if QT_GUI_REMOVED_SINCE(6, 6)
+
+#include "qpixmapcache.h" // inlined API
+
+// #include "qotherheader.h"
+// // implement removed functions from qotherheader.h
+// order sections alphabetically
+
+#endif // QT_GUI_REMOVED_SINCE(6, 6)
+
+#if QT_GUI_REMOVED_SINCE(6, 7)
+
+#include "qtextdocument.h"
+
+bool Qt::mightBeRichText(const QString& text)
+{
+ return Qt::mightBeRichText(qToStringViewIgnoringNull(text));
+}
+
+#endif // QT_GUI_REMOVED_SINCE(6, 7)
+
+#if QT_GUI_REMOVED_SINCE(6, 8)
+
+#include "qpagelayout.h"
+
+bool QPageLayout::setMargins(const QMarginsF &margins)
+{
+ return setMargins(margins, OutOfBoundsPolicy::Reject);
+}
+
+bool QPageLayout::setLeftMargin(qreal leftMargin)
+{
+ return setLeftMargin(leftMargin, OutOfBoundsPolicy::Reject);
+}
+
+bool QPageLayout::setRightMargin(qreal rightMargin)
+{
+ return setRightMargin(rightMargin, OutOfBoundsPolicy::Reject);
+}
+
+bool QPageLayout::setTopMargin(qreal topMargin)
+{
+ return setTopMargin(topMargin, OutOfBoundsPolicy::Reject);
+}
+
+// #include "qotherheader.h"
+// // implement removed functions from qotherheader.h
+// order sections alphabetically
+
+#endif // QT_GUI_REMOVED_SINCE(6, 8)
diff --git a/src/gui/configure.cmake b/src/gui/configure.cmake
new file mode 100644
index 0000000000..da08863ac6
--- /dev/null
+++ b/src/gui/configure.cmake
@@ -0,0 +1,1386 @@
+# Copyright (C) 2022 The Qt Company Ltd.
+# SPDX-License-Identifier: BSD-3-Clause
+
+
+
+#### Inputs
+
+# input freetype
+set(INPUT_freetype "undefined" CACHE STRING "")
+set_property(CACHE INPUT_freetype PROPERTY STRINGS undefined no qt system)
+
+# input harfbuzz
+set(INPUT_harfbuzz "undefined" CACHE STRING "")
+set_property(CACHE INPUT_harfbuzz PROPERTY STRINGS undefined no qt system)
+
+# input libjpeg
+set(INPUT_libjpeg "undefined" CACHE STRING "")
+set_property(CACHE INPUT_libjpeg PROPERTY STRINGS undefined no qt system)
+
+# input libmd4c
+set(INPUT_libmd4c "undefined" CACHE STRING "")
+set_property(CACHE INPUT_libmd4c PROPERTY STRINGS undefined no qt system)
+
+# input libpng
+set(INPUT_libpng "undefined" CACHE STRING "")
+set_property(CACHE INPUT_libpng PROPERTY STRINGS undefined no qt system)
+
+
+
+#### Libraries
+qt_set01(X11_SUPPORTED LINUX OR HPUX OR FREEBSD OR NETBSD OR OPENBSD OR SOLARIS OR
+ HURD)
+qt_find_package(ATSPI2 PROVIDED_TARGETS PkgConfig::ATSPI2 MODULE_NAME gui QMAKE_LIB atspi)
+qt_find_package(DirectFB PROVIDED_TARGETS PkgConfig::DirectFB MODULE_NAME gui QMAKE_LIB directfb)
+qt_find_package(Libdrm PROVIDED_TARGETS Libdrm::Libdrm MODULE_NAME gui QMAKE_LIB drm)
+qt_find_package(EGL PROVIDED_TARGETS EGL::EGL MODULE_NAME gui QMAKE_LIB egl)
+if(INTEGRITY AND _qt_igy_gui_libs)
+ qt_find_package(IntegrityPlatformGraphics
+ PROVIDED_TARGETS IntegrityPlatformGraphics::IntegrityPlatformGraphics
+ MODULE_NAME gui QMAKE_LIB integrity_platform_graphics)
+endif()
+qt_find_package(WrapSystemFreetype 2.2.0 PROVIDED_TARGETS WrapSystemFreetype::WrapSystemFreetype MODULE_NAME gui QMAKE_LIB freetype)
+if(QT_FEATURE_system_zlib)
+ qt_add_qmake_lib_dependency(freetype zlib)
+endif()
+qt_find_package(Fontconfig PROVIDED_TARGETS Fontconfig::Fontconfig MODULE_NAME gui QMAKE_LIB fontconfig)
+qt_add_qmake_lib_dependency(fontconfig freetype)
+qt_find_package(gbm PROVIDED_TARGETS gbm::gbm MODULE_NAME gui QMAKE_LIB gbm)
+qt_find_package(WrapSystemHarfbuzz 2.6.0 PROVIDED_TARGETS WrapSystemHarfbuzz::WrapSystemHarfbuzz MODULE_NAME gui QMAKE_LIB harfbuzz)
+qt_find_package(Libinput PROVIDED_TARGETS Libinput::Libinput MODULE_NAME gui QMAKE_LIB libinput)
+qt_find_package(WrapSystemJpeg PROVIDED_TARGETS WrapSystemJpeg::WrapSystemJpeg MODULE_NAME gui QMAKE_LIB libjpeg)
+qt_find_package(WrapSystemMd4c PROVIDED_TARGETS WrapSystemMd4c::WrapSystemMd4c MODULE_NAME gui QMAKE_LIB libmd4c)
+qt_find_package(WrapSystemPNG PROVIDED_TARGETS WrapSystemPNG::WrapSystemPNG MODULE_NAME gui QMAKE_LIB libpng)
+if(QT_FEATURE_system_zlib)
+ qt_add_qmake_lib_dependency(libpng zlib)
+endif()
+qt_find_package(Mtdev PROVIDED_TARGETS PkgConfig::Mtdev MODULE_NAME gui QMAKE_LIB mtdev)
+qt_find_package(WrapOpenGL PROVIDED_TARGETS WrapOpenGL::WrapOpenGL MODULE_NAME gui QMAKE_LIB opengl)
+qt_find_package(GLESv2 PROVIDED_TARGETS GLESv2::GLESv2 MODULE_NAME gui QMAKE_LIB opengl_es2)
+qt_find_package(Tslib PROVIDED_TARGETS PkgConfig::Tslib MODULE_NAME gui QMAKE_LIB tslib)
+qt_find_package(WrapVulkanHeaders PROVIDED_TARGETS WrapVulkanHeaders::WrapVulkanHeaders
+ MODULE_NAME gui QMAKE_LIB vulkan MARK_OPTIONAL)
+if((LINUX) OR QT_FIND_ALL_PACKAGES_ALWAYS)
+ qt_find_package(Wayland PROVIDED_TARGETS Wayland::Server MODULE_NAME gui QMAKE_LIB wayland_server)
+ qt_find_package(Wayland PROVIDED_TARGETS Wayland::Client MODULE_NAME gui QMAKE_LIB wayland_client)
+endif()
+if((X11_SUPPORTED) OR QT_FIND_ALL_PACKAGES_ALWAYS)
+ qt_find_package(X11 PROVIDED_TARGETS X11::X11 MODULE_NAME gui QMAKE_LIB xlib)
+endif()
+if((X11_SUPPORTED) OR QT_FIND_ALL_PACKAGES_ALWAYS)
+ qt_find_package(X11 PROVIDED_TARGETS X11::SM X11::ICE MODULE_NAME gui QMAKE_LIB x11sm)
+endif()
+if((X11_SUPPORTED) OR QT_FIND_ALL_PACKAGES_ALWAYS)
+ qt_find_package(XCB 1.11 PROVIDED_TARGETS XCB::XCB MODULE_NAME gui QMAKE_LIB xcb)
+endif()
+if((X11_SUPPORTED) OR QT_FIND_ALL_PACKAGES_ALWAYS)
+ qt_find_package(XCB 0.1.1 COMPONENTS CURSOR PROVIDED_TARGETS XCB::CURSOR MODULE_NAME gui QMAKE_LIB xcb_cursor)
+endif()
+if((X11_SUPPORTED) OR QT_FIND_ALL_PACKAGES_ALWAYS)
+ qt_find_package(XCB 0.3.9 COMPONENTS ICCCM PROVIDED_TARGETS XCB::ICCCM MODULE_NAME gui QMAKE_LIB xcb_icccm)
+endif()
+qt_add_qmake_lib_dependency(xcb_icccm xcb)
+if((X11_SUPPORTED) OR QT_FIND_ALL_PACKAGES_ALWAYS)
+ qt_find_package(XCB 0.3.9 COMPONENTS IMAGE PROVIDED_TARGETS XCB::IMAGE MODULE_NAME gui QMAKE_LIB xcb_image)
+endif()
+qt_add_qmake_lib_dependency(xcb_image xcb_shm xcb)
+if((X11_SUPPORTED) OR QT_FIND_ALL_PACKAGES_ALWAYS)
+ qt_find_package(XCB 0.3.9 COMPONENTS KEYSYMS PROVIDED_TARGETS XCB::KEYSYMS MODULE_NAME gui QMAKE_LIB xcb_keysyms)
+endif()
+qt_add_qmake_lib_dependency(xcb_keysyms xcb)
+if((X11_SUPPORTED) OR QT_FIND_ALL_PACKAGES_ALWAYS)
+ qt_find_package(XCB 0.3.9 COMPONENTS RENDERUTIL PROVIDED_TARGETS XCB::RENDERUTIL MODULE_NAME gui QMAKE_LIB xcb_renderutil)
+endif()
+qt_add_qmake_lib_dependency(xcb_renderutil xcb xcb_render)
+if((X11_SUPPORTED) OR QT_FIND_ALL_PACKAGES_ALWAYS)
+ qt_find_package(XCB COMPONENTS RANDR PROVIDED_TARGETS XCB::RANDR MODULE_NAME gui QMAKE_LIB xcb_randr)
+endif()
+qt_add_qmake_lib_dependency(xcb_randr xcb)
+if((X11_SUPPORTED) OR QT_FIND_ALL_PACKAGES_ALWAYS)
+ qt_find_package(XCB COMPONENTS SHAPE PROVIDED_TARGETS XCB::SHAPE MODULE_NAME gui QMAKE_LIB xcb_shape)
+endif()
+qt_add_qmake_lib_dependency(xcb_shape xcb)
+if((X11_SUPPORTED) OR QT_FIND_ALL_PACKAGES_ALWAYS)
+ qt_find_package(XCB COMPONENTS SHM PROVIDED_TARGETS XCB::SHM MODULE_NAME gui QMAKE_LIB xcb_shm)
+endif()
+qt_add_qmake_lib_dependency(xcb_shm xcb)
+if((X11_SUPPORTED) OR QT_FIND_ALL_PACKAGES_ALWAYS)
+ qt_find_package(XCB COMPONENTS SYNC PROVIDED_TARGETS XCB::SYNC MODULE_NAME gui QMAKE_LIB xcb_sync)
+endif()
+qt_add_qmake_lib_dependency(xcb_sync xcb)
+if((X11_SUPPORTED) OR QT_FIND_ALL_PACKAGES_ALWAYS)
+ qt_find_package(XCB COMPONENTS XFIXES PROVIDED_TARGETS XCB::XFIXES MODULE_NAME gui QMAKE_LIB xcb_xfixes)
+endif()
+qt_add_qmake_lib_dependency(xcb_xfixes xcb)
+if((X11_SUPPORTED) OR QT_FIND_ALL_PACKAGES_ALWAYS)
+ qt_find_package(X11_XCB PROVIDED_TARGETS X11::XCB MODULE_NAME gui QMAKE_LIB xcb_xlib)
+endif()
+qt_add_qmake_lib_dependency(xcb_xlib xcb xlib)
+if((X11_SUPPORTED) OR QT_FIND_ALL_PACKAGES_ALWAYS)
+ qt_find_package(XCB COMPONENTS XKB PROVIDED_TARGETS XCB::XKB MODULE_NAME gui QMAKE_LIB xcb_xkb)
+endif()
+qt_add_qmake_lib_dependency(xcb_xkb xcb)
+if((X11_SUPPORTED) OR QT_FIND_ALL_PACKAGES_ALWAYS)
+ qt_find_package(XCB COMPONENTS RENDER PROVIDED_TARGETS XCB::RENDER MODULE_NAME gui QMAKE_LIB xcb_render)
+endif()
+qt_add_qmake_lib_dependency(xcb_render xcb)
+if((X11_SUPPORTED) OR QT_FIND_ALL_PACKAGES_ALWAYS)
+ qt_find_package(XCB COMPONENTS GLX PROVIDED_TARGETS XCB::GLX MODULE_NAME gui QMAKE_LIB xcb_glx)
+endif()
+qt_add_qmake_lib_dependency(xcb_glx xcb)
+if((X11_SUPPORTED) OR QT_FIND_ALL_PACKAGES_ALWAYS)
+ qt_find_package(XCB 1.12 COMPONENTS XINPUT PROVIDED_TARGETS XCB::XINPUT MODULE_NAME gui QMAKE_LIB xcb_xinput)
+endif()
+qt_add_qmake_lib_dependency(xcb_xinput xcb)
+if((X11_SUPPORTED) OR QT_FIND_ALL_PACKAGES_ALWAYS)
+ qt_find_package(XKB 0.5.0 PROVIDED_TARGETS XKB::XKB MODULE_NAME gui QMAKE_LIB xkbcommon)
+endif()
+if((X11_SUPPORTED) OR QT_FIND_ALL_PACKAGES_ALWAYS)
+ qt_find_package(XKB_COMMON_X11 0.5.0 PROVIDED_TARGETS PkgConfig::XKB_COMMON_X11 MODULE_NAME gui QMAKE_LIB xkbcommon_x11)
+endif()
+if((X11_SUPPORTED) OR QT_FIND_ALL_PACKAGES_ALWAYS)
+ qt_find_package(XRender 0.6 PROVIDED_TARGETS PkgConfig::XRender MODULE_NAME gui QMAKE_LIB xrender)
+endif()
+qt_add_qmake_lib_dependency(xrender xlib)
+
+qt_find_package(RenderDoc PROVIDED_TARGETS RenderDoc::RenderDoc)
+
+#### Tests
+
+# drm_atomic
+qt_config_compile_test(drm_atomic
+ LABEL "DRM Atomic API"
+ LIBRARIES
+ Libdrm::Libdrm
+ CODE
+"#include <stdlib.h>
+#include <stdint.h>
+extern \"C\" {
+#include <xf86drmMode.h>
+#include <xf86drm.h>
+}
+
+int main(void)
+{
+ /* BEGIN TEST: */
+drmModeAtomicReq *request;
+ /* END TEST: */
+ return 0;
+}
+")
+
+# egl-x11
+qt_config_compile_test(egl_x11
+ LABEL "EGL on X11"
+ LIBRARIES
+ EGL::EGL
+ X11::X11
+ CODE
+"// Check if EGL is compatible with X. Some EGL implementations, typically on
+// embedded devices, are not intended to be used together with X. EGL support
+// has to be disabled in plugins like xcb in this case since the native display,
+// window and pixmap types will be different than what an X-based platform
+// plugin would expect.
+#define USE_X11
+#include <EGL/egl.h>
+#include <X11/Xlib.h>
+
+int main(void)
+{
+ /* BEGIN TEST: */
+Display *dpy = EGL_DEFAULT_DISPLAY;
+EGLNativeDisplayType egldpy = XOpenDisplay(\"\");
+dpy = egldpy;
+EGLNativeWindowType w = XCreateWindow(dpy, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0);
+XDestroyWindow(dpy, w);
+XCloseDisplay(dpy);
+ /* END TEST: */
+ return 0;
+}
+")
+
+# egl-brcm
+qt_config_compile_test(egl_brcm
+ LABEL "Broadcom EGL (Raspberry Pi)"
+ LIBRARIES
+ EGL::EGL
+ CODE
+"#include <EGL/egl.h>
+#include <bcm_host.h>
+
+int main(void)
+{
+ /* BEGIN TEST: */
+vc_dispmanx_display_open(0);
+ /* END TEST: */
+ return 0;
+}
+"# FIXME: use: unmapped library: bcm_host
+)
+
+# egl-egldevice
+qt_config_compile_test(egl_egldevice
+ LABEL "EGLDevice"
+ LIBRARIES
+ EGL::EGL
+ CODE
+"#include <EGL/egl.h>
+#include <EGL/eglext.h>
+
+int main(void)
+{
+ /* BEGIN TEST: */
+EGLDeviceEXT device = 0;
+EGLStreamKHR stream = 0;
+EGLOutputLayerEXT layer = 0;
+(void) EGL_DRM_CRTC_EXT;
+(void) EGL_DRM_MASTER_FD_EXT;
+ /* END TEST: */
+ return 0;
+}
+")
+
+# egl-mali
+qt_config_compile_test(egl_mali
+ LABEL "Mali EGL"
+ LIBRARIES
+ EGL::EGL
+ CODE
+"#include <EGL/fbdev_window.h>
+#include <EGL/egl.h>
+#include <GLES2/gl2.h>
+
+int main(void)
+{
+ /* BEGIN TEST: */
+fbdev_window *w = 0;
+ /* END TEST: */
+ return 0;
+}
+")
+
+# egl-mali-2
+qt_config_compile_test(egl_mali_2
+ LABEL "Mali 2 EGL"
+ LIBRARIES
+ EGL::EGL
+ CODE
+"#include <EGL/egl.h>
+#include <GLES2/gl2.h>
+
+int main(void)
+{
+ /* BEGIN TEST: */
+mali_native_window *w = 0;
+ /* END TEST: */
+ return 0;
+}
+")
+
+# egl-viv
+qt_config_compile_test(egl_viv
+ LABEL "i.Mx6 EGL"
+ LIBRARIES
+ EGL::EGL
+ COMPILE_OPTIONS
+ "-DEGL_API_FB=1"
+ CODE
+"#include <EGL/egl.h>
+#include <EGL/eglvivante.h>
+
+int main(void)
+{
+ /* BEGIN TEST: */
+#ifdef __INTEGRITY
+fbGetDisplay();
+#else
+// Do not rely on fbGetDisplay(), since the signature has changed over time.
+// Stick to fbGetDisplayByIndex().
+fbGetDisplayByIndex(0);
+#endif
+ /* END TEST: */
+ return 0;
+}
+"# FIXME: qmake: ['DEFINES += EGL_API_FB=1', '!integrity: DEFINES += LINUX=1']
+)
+
+set(test_libs EGL::EGL)
+if(INTEGRITY AND _qt_igy_gui_libs)
+ set(test_libs ${test_libs} IntegrityPlatformGraphics::IntegrityPlatformGraphics)
+endif()
+
+# egl-openwfd
+qt_config_compile_test(egl_openwfd
+ LABEL "OpenWFD EGL"
+ LIBRARIES
+ ${test_libs}
+ CODE
+"#include <wfd.h>
+
+int main(void)
+{
+ /* BEGIN TEST: */
+wfdEnumerateDevices(nullptr, 0, nullptr);
+ /* END TEST: */
+ return 0;
+}
+")
+
+# egl-rcar
+qt_config_compile_test(egl_rcar
+ LABEL "RCAR EGL"
+ LIBRARIES
+ EGL::EGL
+ GLESv2::GLESv2
+ CODE
+"#include <EGL/egl.h>
+extern \"C\" {
+extern unsigned long PVRGrfxServerInit(void);
+}
+
+int main(void)
+{
+ /* BEGIN TEST: */
+PVRGrfxServerInit();
+ /* END TEST: */
+ return 0;
+}
+")
+
+# evdev
+qt_config_compile_test(evdev
+ LABEL "evdev"
+ CODE
+"#if defined(__FreeBSD__)
+# include <dev/evdev/input.h>
+#else
+# include <linux/input.h>
+# include <linux/kd.h>
+#endif
+enum {
+ e1 = ABS_PRESSURE,
+ e2 = ABS_X,
+ e3 = REL_X,
+ e4 = SYN_REPORT,
+};
+
+int main(void)
+{
+ /* BEGIN TEST: */
+input_event buf[32];
+(void) buf;
+ /* END TEST: */
+ return 0;
+}
+")
+
+# integrityfb
+qt_config_compile_test(integrityfb
+ LABEL "INTEGRITY framebuffer"
+ CODE
+"#include <device/fbdriver.h>
+
+int main(void)
+{
+ /* BEGIN TEST: */
+FBDriver *driver = 0;
+ /* END TEST: */
+ return 0;
+}
+")
+
+# linuxfb
+qt_config_compile_test(linuxfb
+ LABEL "LinuxFB"
+ CODE
+"#include <linux/fb.h>
+#include <sys/kd.h>
+#include <sys/ioctl.h>
+
+int main(void)
+{
+ /* BEGIN TEST: */
+fb_fix_screeninfo finfo;
+fb_var_screeninfo vinfo;
+int fd = 3;
+ioctl(fd, FBIOGET_FSCREENINFO, &finfo);
+ioctl(fd, FBIOGET_VSCREENINFO, &vinfo);
+ /* END TEST: */
+ return 0;
+}
+")
+
+# opengles3
+if(WASM)
+ set(extra_compiler_options "-s FULL_ES3=1")
+endif()
+
+set(test_libs GLESv2::GLESv2)
+if(INTEGRITY AND _qt_igy_gui_libs)
+ set(test_libs ${test_libs} IntegrityPlatformGraphics::IntegrityPlatformGraphics)
+endif()
+
+qt_config_compile_test(opengles3
+ LABEL "OpenGL ES 3.0"
+ LIBRARIES
+ ${test_libs}
+ COMPILE_OPTIONS ${extra_compiler_options}
+ CODE
+"#ifdef __APPLE__
+# include <OpenGLES/ES3/gl.h>
+#else
+# define GL_GLEXT_PROTOTYPES
+# include <GLES3/gl3.h>
+#endif
+
+int main(void)
+{
+ /* BEGIN TEST: */
+static GLfloat f[6];
+glGetStringi(GL_EXTENSIONS, 0);
+glReadBuffer(GL_COLOR_ATTACHMENT1);
+glUniformMatrix2x3fv(0, 0, GL_FALSE, f);
+glMapBufferRange(GL_ARRAY_BUFFER, 0, 0, GL_MAP_READ_BIT);
+ /* END TEST: */
+ return 0;
+}
+")
+
+
+# opengles31
+qt_config_compile_test(opengles31
+ LABEL "OpenGL ES 3.1"
+ LIBRARIES
+ ${test_libs}
+ CODE
+"#include <GLES3/gl31.h>
+
+int main(void)
+{
+ /* BEGIN TEST: */
+glDispatchCompute(1, 1, 1);
+glProgramUniform1i(0, 0, 0);
+ /* END TEST: */
+ return 0;
+}
+")
+
+# opengles32
+qt_config_compile_test(opengles32
+ LABEL "OpenGL ES 3.2"
+ LIBRARIES
+ ${test_libs}
+ CODE
+"#include <GLES3/gl32.h>
+
+int main(void)
+{
+ /* BEGIN TEST: */
+glFramebufferTexture(GL_TEXTURE_2D, GL_DEPTH_STENCIL_ATTACHMENT, 1, 0);
+ /* END TEST: */
+ return 0;
+}
+")
+
+# xcb_syslibs
+qt_config_compile_test(xcb_syslibs
+ LABEL "XCB (extensions)"
+ LIBRARIES
+ XCB::CURSOR
+ XCB::ICCCM
+ XCB::IMAGE
+ XCB::KEYSYMS
+ XCB::RANDR
+ XCB::RENDER
+ XCB::RENDERUTIL
+ XCB::SHAPE
+ XCB::SHM
+ XCB::SYNC
+ XCB::XFIXES
+ XCB::XKB
+ XCB::XCB
+ CODE
+"// xkb.h is using a variable called 'explicit', which is a reserved keyword in C++
+#define explicit dont_use_cxx_explicit
+#include <xcb/xcb.h>
+#include <xcb/xcb_image.h>
+#include <xcb/xcb_keysyms.h>
+#include <xcb/xcb_cursor.h>
+#include <xcb/randr.h>
+#include <xcb/render.h>
+#include <xcb/shape.h>
+#include <xcb/shm.h>
+#include <xcb/sync.h>
+#include <xcb/xfixes.h>
+#include <xcb/xcb_icccm.h>
+#include <xcb/xcb_renderutil.h>
+#include <xcb/xkb.h>
+#undef explicit
+
+int main(void)
+{
+ /* BEGIN TEST: */
+int primaryScreen = 0;
+xcb_connection_t *c = xcb_connect(\"\", &primaryScreen);
+/* RENDER */
+xcb_generic_error_t *error = nullptr;
+xcb_render_query_pict_formats_cookie_t formatsCookie =
+ xcb_render_query_pict_formats(c);
+xcb_render_query_pict_formats_reply_t *formatsReply =
+ xcb_render_query_pict_formats_reply(c, formatsCookie, &error);
+/* RENDERUTIL: xcb_renderutil.h include won't compile unless version >= 0.3.9 */
+xcb_render_util_find_standard_format(nullptr, XCB_PICT_STANDARD_ARGB_32);
+/* XKB: This takes more arguments in xcb-xkb < 1.11 */
+xcb_xkb_get_kbd_by_name_replies_key_names_value_list_sizeof(nullptr, 0, 0, 0, 0, 0, 0, 0, 0);
+ /* END TEST: */
+ return 0;
+}
+")
+
+# libinput_hires_wheel_support
+qt_config_compile_test(libinput_hires_wheel_support
+ LABEL "libinput hires wheel support"
+ LIBRARIES
+ Libinput::Libinput
+ CODE
+"#include <libinput.h>
+int main(void)
+{
+ /* BEGIN TEST: */
+libinput_event_type type = LIBINPUT_EVENT_POINTER_SCROLL_WHEEL;
+libinput_event_pointer_get_scroll_value_v120(nullptr, LIBINPUT_POINTER_AXIS_SCROLL_VERTICAL);
+ /* END TEST: */
+ return 0;
+}
+")
+
+# directwrite (assumes DirectWrite2)
+qt_config_compile_test(directwrite
+ LABEL "WINDOWS directwrite"
+ LIBRARIES
+ dwrite
+ CODE
+"#include <dwrite_2.h>
+int main(int, char **)
+{
+ IUnknown *factory = nullptr;
+ DWriteCreateFactory(DWRITE_FACTORY_TYPE_SHARED, __uuidof(IDWriteFactory2),
+ &factory);
+ return 0;
+}
+")
+
+# directwrite3 (not present in MinGW)
+qt_config_compile_test(directwrite3
+ LABEL "WINDOWS directwrite3"
+ LIBRARIES
+ dwrite
+ CODE
+"#include <dwrite_3.h>
+int main(int, char **)
+{
+ IUnknown *factory = nullptr;
+ DWriteCreateFactory(DWRITE_FACTORY_TYPE_SHARED, __uuidof(IDWriteFactory6),
+ &factory);
+ return 0;
+}
+")
+
+qt_config_compile_test(d2d1
+ LABEL "WINDOWS Direct2D"
+ LIBRARIES
+ d2d1
+ CODE
+"#include <d2d1.h>
+int main(int, char **)
+{
+ void *factory = nullptr;
+ D2D1_FACTORY_OPTIONS options;
+ ZeroMemory(&options, sizeof(D2D1_FACTORY_OPTIONS));
+ D2D1CreateFactory(D2D1_FACTORY_TYPE_SINGLE_THREADED, GUID{}, &options, &factory);
+ return 0;
+}
+")
+
+qt_config_compile_test(d2d1_1
+ LABEL "WINDOWS Direct2D 1.1"
+ LIBRARIES
+ d2d1
+ CODE
+"#include <d2d1_1.h>
+int main(int, char **)
+{
+ ID2D1Factory1 *d2dFactory;
+ D2D1CreateFactory(D2D1_FACTORY_TYPE_SINGLE_THREADED, &d2dFactory);
+ return 0;
+}
+")
+
+qt_config_compile_test(renderdoc
+ LIBRARIES
+ RenderDoc::RenderDoc
+ LABEL "RenderDoc header check"
+ CODE
+"#include <renderdoc_app.h>
+int main(int, char **)
+{
+ if (RENDERDOC_Version::eRENDERDOC_API_Version_1_6_0)
+ return 0;
+ return 0;
+}
+")
+
+
+#### Features
+
+qt_feature("accessibility-atspi-bridge" PUBLIC PRIVATE
+ LABEL "ATSPI Bridge"
+ CONDITION QT_FEATURE_accessibility AND QT_FEATURE_dbus AND ATSPI2_FOUND
+)
+qt_feature_definition("accessibility-atspi-bridge" "QT_NO_ACCESSIBILITY_ATSPI_BRIDGE" NEGATE VALUE "1")
+qt_feature("directfb" PRIVATE
+ SECTION "Platform plugins"
+ LABEL "DirectFB"
+ AUTODETECT OFF
+ CONDITION DirectFB_FOUND
+)
+qt_feature("directwrite" PRIVATE
+ LABEL "DirectWrite"
+ CONDITION TEST_directwrite
+ EMIT_IF WIN32
+)
+qt_feature("directwrite3" PRIVATE
+ LABEL "DirectWrite 3"
+ CONDITION QT_FEATURE_directwrite AND TEST_directwrite3
+ EMIT_IF WIN32
+)
+qt_feature("direct2d" PRIVATE
+ LABEL "Direct 2D"
+ CONDITION WIN32 AND NOT WINRT AND TEST_d2d1
+)
+qt_feature("direct2d1_1" PRIVATE
+ LABEL "Direct 2D 1.1"
+ CONDITION QT_FEATURE_direct2d AND TEST_d2d1_1
+)
+qt_feature("evdev" PRIVATE
+ LABEL "evdev"
+ CONDITION QT_FEATURE_thread AND TEST_evdev
+)
+qt_feature("freetype" PUBLIC PRIVATE
+ SECTION "Fonts"
+ LABEL "FreeType"
+ PURPOSE "Supports the FreeType 2 font engine (and its supported font formats)."
+)
+qt_feature_definition("freetype" "QT_NO_FREETYPE" NEGATE VALUE "1")
+qt_feature("system-freetype" PRIVATE
+ LABEL " Using system FreeType"
+ AUTODETECT NOT MSVC
+ CONDITION QT_FEATURE_freetype AND WrapSystemFreetype_FOUND
+ ENABLE INPUT_freetype STREQUAL 'system'
+ DISABLE INPUT_freetype STREQUAL 'qt'
+)
+qt_feature("fontconfig" PUBLIC PRIVATE
+ LABEL "Fontconfig"
+ AUTODETECT NOT APPLE
+ CONDITION NOT WIN32 AND QT_FEATURE_system_freetype AND Fontconfig_FOUND
+)
+qt_feature_definition("fontconfig" "QT_NO_FONTCONFIG" NEGATE VALUE "1")
+qt_feature("gbm"
+ LABEL "GBM"
+ CONDITION gbm_FOUND
+)
+qt_feature_config("gbm" QMAKE_PUBLIC_QT_CONFIG)
+qt_feature("harfbuzz" PUBLIC PRIVATE
+ LABEL "HarfBuzz"
+)
+qt_feature_definition("harfbuzz" "QT_NO_HARFBUZZ" NEGATE VALUE "1")
+qt_feature("system-harfbuzz" PRIVATE
+ LABEL " Using system HarfBuzz"
+ AUTODETECT NOT APPLE AND NOT WIN32
+ CONDITION QT_FEATURE_harfbuzz AND WrapSystemHarfbuzz_FOUND
+ ENABLE INPUT_harfbuzz STREQUAL 'system'
+ DISABLE INPUT_harfbuzz STREQUAL 'qt'
+)
+qt_feature("qqnx_imf" PRIVATE
+ LABEL "IMF"
+ CONDITION libs.imf OR FIXME
+ EMIT_IF QNX
+)
+qt_feature("integrityfb" PRIVATE
+ SECTION "Platform plugins"
+ LABEL "INTEGRITY framebuffer"
+ CONDITION INTEGRITY AND TEST_integrityfb
+)
+qt_feature("kms" PRIVATE
+ LABEL "KMS"
+ CONDITION Libdrm_FOUND
+)
+qt_feature_config("kms" QMAKE_PUBLIC_QT_CONFIG)
+qt_feature("drm_atomic" PRIVATE
+ LABEL "DRM Atomic API"
+ CONDITION Libdrm_FOUND AND TEST_drm_atomic
+)
+qt_feature("libinput" PRIVATE
+ LABEL "libinput"
+ CONDITION QT_FEATURE_libudev AND Libinput_FOUND
+)
+qt_feature("integrityhid" PRIVATE
+ LABEL "INTEGRITY HID"
+ CONDITION INTEGRITY AND libs.integrityhid OR FIXME
+)
+qt_feature("libinput-axis-api" PRIVATE
+ LABEL "axis API in libinput"
+ CONDITION QT_FEATURE_libinput AND ON
+)
+qt_feature("libinput-hires-wheel-support" PRIVATE
+ LABEL "HiRes wheel support in libinput"
+ CONDITION QT_FEATURE_libinput AND TEST_libinput_hires_wheel_support
+)
+qt_feature("lgmon"
+ LABEL "lgmon"
+ CONDITION libs.lgmon OR FIXME
+ EMIT_IF QNX
+)
+qt_feature_config("lgmon" QMAKE_PRIVATE_CONFIG)
+qt_feature("linuxfb" PRIVATE
+ SECTION "Platform plugins"
+ LABEL "LinuxFB"
+ CONDITION TEST_linuxfb AND QT_FEATURE_regularexpression
+)
+qt_feature("vsp2" PRIVATE
+ LABEL "VSP2"
+ AUTODETECT OFF
+ CONDITION libs.v4l2 OR FIXME
+)
+qt_feature("vnc" PRIVATE
+ SECTION "Platform plugins"
+ LABEL "VNC"
+ CONDITION ( UNIX AND NOT ANDROID AND NOT APPLE AND NOT WASM ) AND ( QT_FEATURE_regularexpression AND QT_FEATURE_network )
+)
+qt_feature("mtdev" PRIVATE
+ LABEL "mtdev"
+ CONDITION Mtdev_FOUND
+)
+qt_feature("opengles2" PUBLIC
+ LABEL "OpenGL ES 2.0"
+ CONDITION NOT WIN32 AND NOT WATCHOS AND NOT QT_FEATURE_opengl_desktop AND GLESv2_FOUND
+ ENABLE INPUT_opengl STREQUAL 'es2'
+ DISABLE INPUT_opengl STREQUAL 'desktop' OR INPUT_opengl STREQUAL 'dynamic' OR INPUT_opengl STREQUAL 'no'
+)
+qt_feature_config("opengles2" QMAKE_PUBLIC_QT_CONFIG)
+qt_feature("opengles3" PUBLIC
+ LABEL "OpenGL ES 3.0"
+ CONDITION QT_FEATURE_opengles2 AND TEST_opengles3
+)
+qt_feature("opengles31" PUBLIC
+ LABEL "OpenGL ES 3.1"
+ CONDITION QT_FEATURE_opengles3 AND TEST_opengles31
+)
+qt_feature("opengles32" PUBLIC
+ LABEL "OpenGL ES 3.2"
+ CONDITION QT_FEATURE_opengles31 AND TEST_opengles32
+)
+qt_feature("opengl-desktop"
+ LABEL "Desktop OpenGL"
+ AUTODETECT NOT WIN32
+ CONDITION ( WIN32 AND ( MSVC OR WrapOpenGL_FOUND ) ) OR ( NOT WATCHOS AND NOT WIN32 AND NOT WASM AND WrapOpenGL_FOUND )
+ ENABLE INPUT_opengl STREQUAL 'desktop'
+ DISABLE INPUT_opengl STREQUAL 'es2' OR INPUT_opengl STREQUAL 'dynamic' OR INPUT_opengl STREQUAL 'no'
+)
+qt_feature("opengl-dynamic"
+ LABEL "Dynamic OpenGL"
+ CONDITION WIN32
+ DISABLE INPUT_opengl STREQUAL 'no' OR INPUT_opengl STREQUAL 'desktop'
+)
+qt_feature("dynamicgl" PUBLIC
+ LABEL "Dynamic OpenGL: dynamicgl"
+ CONDITION QT_FEATURE_opengl_dynamic
+ DISABLE INPUT_opengl STREQUAL 'no' OR INPUT_opengl STREQUAL 'desktop'
+)
+qt_feature_definition("opengl-dynamic" "QT_OPENGL_DYNAMIC")
+qt_feature("opengl" PUBLIC
+ LABEL "OpenGL"
+ CONDITION QT_FEATURE_opengl_desktop OR QT_FEATURE_opengl_dynamic OR QT_FEATURE_opengles2
+)
+qt_feature_definition("opengl" "QT_NO_OPENGL" NEGATE VALUE "1")
+qt_feature("vkgen" PRIVATE
+ LABEL "vkgen"
+ CONDITION QT_FEATURE_xmlstreamreader
+)
+qt_feature("vulkan" PUBLIC
+ LABEL "Vulkan"
+ CONDITION QT_FEATURE_library AND QT_FEATURE_vkgen AND WrapVulkanHeaders_FOUND
+)
+qt_feature("metal" PUBLIC
+ LABEL "Metal"
+ CONDITION MACOS OR IOS OR VISIONOS
+)
+qt_feature("vkkhrdisplay" PRIVATE
+ SECTION "Platform plugins"
+ LABEL "VK_KHR_display"
+ CONDITION NOT ANDROID AND NOT APPLE AND NOT WIN32 AND NOT WASM AND QT_FEATURE_vulkan
+)
+qt_feature("openvg" PUBLIC
+ LABEL "OpenVG"
+ CONDITION libs.openvg OR FIXME
+)
+qt_feature("egl" PUBLIC
+ LABEL "EGL"
+ CONDITION ( QT_FEATURE_opengl OR QT_FEATURE_openvg ) AND EGL_FOUND AND ( QT_FEATURE_dlopen OR NOT UNIX OR INTEGRITY )
+)
+qt_feature_definition("egl" "QT_NO_EGL" NEGATE VALUE "1")
+qt_feature("egl_x11" PRIVATE
+ LABEL "EGL on X11"
+ CONDITION QT_FEATURE_thread AND QT_FEATURE_egl AND TEST_egl_x11
+)
+qt_feature("eglfs" PRIVATE
+ SECTION "Platform plugins"
+ LABEL "EGLFS"
+ CONDITION NOT ANDROID AND NOT APPLE AND NOT WIN32 AND NOT WASM AND NOT QNX AND QT_FEATURE_egl
+)
+qt_feature("eglfs_brcm" PRIVATE
+ LABEL "EGLFS Raspberry Pi"
+ CONDITION QT_FEATURE_eglfs AND TEST_egl_brcm
+)
+qt_feature("eglfs_egldevice" PRIVATE
+ LABEL "EGLFS EGLDevice"
+ CONDITION QT_FEATURE_eglfs AND TEST_egl_egldevice AND QT_FEATURE_kms
+)
+qt_feature("eglfs_gbm" PRIVATE
+ LABEL "EGLFS GBM"
+ CONDITION QT_FEATURE_eglfs AND gbm_FOUND AND QT_FEATURE_kms
+)
+qt_feature("eglfs_vsp2" PRIVATE
+ LABEL "EGLFS VSP2"
+ CONDITION QT_FEATURE_eglfs AND gbm_FOUND AND QT_FEATURE_kms AND QT_FEATURE_vsp2
+)
+qt_feature("eglfs_mali" PRIVATE
+ LABEL "EGLFS Mali"
+ CONDITION QT_FEATURE_eglfs AND ( TEST_egl_mali OR TEST_egl_mali_2 )
+)
+qt_feature("eglfs_viv" PRIVATE
+ LABEL "EGLFS i.Mx6"
+ CONDITION QT_FEATURE_eglfs AND TEST_egl_viv
+)
+qt_feature("eglfs_rcar" PRIVATE
+ LABEL "EGLFS RCAR"
+ CONDITION INTEGRITY AND QT_FEATURE_eglfs AND TEST_egl_rcar
+)
+qt_feature("eglfs_viv_wl" PRIVATE
+ LABEL "EGLFS i.Mx6 Wayland"
+ CONDITION QT_FEATURE_eglfs_viv AND TARGET Wayland::Server
+)
+qt_feature("eglfs_openwfd" PRIVATE
+ LABEL "EGLFS OpenWFD"
+ CONDITION INTEGRITY AND QT_FEATURE_eglfs AND TEST_egl_openwfd
+)
+qt_feature("eglfs_x11" PRIVATE
+ LABEL "EGLFS X11"
+ CONDITION QT_FEATURE_eglfs AND QT_FEATURE_xcb_xlib AND QT_FEATURE_egl_x11
+)
+qt_feature("gif" PRIVATE
+ LABEL "GIF"
+ CONDITION QT_FEATURE_imageformatplugin
+)
+qt_feature_definition("gif" "QT_NO_IMAGEFORMAT_GIF" NEGATE)
+qt_feature("ico" PUBLIC PRIVATE
+ LABEL "ICO"
+ CONDITION QT_FEATURE_imageformatplugin
+)
+qt_feature_definition("ico" "QT_NO_ICO" NEGATE VALUE "1")
+qt_feature("jpeg" PRIVATE
+ LABEL "JPEG"
+ CONDITION QT_FEATURE_imageformatplugin
+ DISABLE INPUT_libjpeg STREQUAL 'no'
+)
+qt_feature_definition("jpeg" "QT_NO_IMAGEFORMAT_JPEG" NEGATE VALUE "1")
+qt_feature("system-jpeg" PRIVATE
+ LABEL " Using system libjpeg"
+ CONDITION QT_FEATURE_jpeg AND JPEG_FOUND
+ ENABLE INPUT_libjpeg STREQUAL 'system'
+ DISABLE INPUT_libjpeg STREQUAL 'qt'
+)
+qt_feature("png" PRIVATE
+ LABEL "PNG"
+ DISABLE INPUT_libpng STREQUAL 'no'
+)
+qt_feature_definition("png" "QT_NO_IMAGEFORMAT_PNG" NEGATE)
+qt_feature("system-png" PRIVATE
+ LABEL " Using system libpng"
+ AUTODETECT QT_FEATURE_system_zlib
+ CONDITION QT_FEATURE_png AND WrapSystemPNG_FOUND
+ ENABLE INPUT_libpng STREQUAL 'system'
+ DISABLE INPUT_libpng STREQUAL 'qt'
+)
+qt_feature("imageio-text-loading" PRIVATE
+ LABEL "Image Text section loading"
+)
+qt_feature_definition("imageio-text-loading" "QT_NO_IMAGEIO_TEXT_LOADING" NEGATE)
+qt_feature("sessionmanager" PUBLIC
+ SECTION "Kernel"
+ LABEL "Session Management"
+ PURPOSE "Provides an interface to the windowing system's session management."
+)
+qt_feature_definition("sessionmanager" "QT_NO_SESSIONMANAGER" NEGATE VALUE "1")
+qt_feature("tslib" PRIVATE
+ LABEL "tslib"
+ CONDITION Tslib_FOUND AND NOT INTEGRITY
+)
+qt_feature("tuiotouch" PRIVATE
+ LABEL "TuioTouch"
+ PURPOSE "Provides the TuioTouch input plugin."
+ CONDITION QT_FEATURE_network AND QT_FEATURE_udpsocket
+)
+qt_feature("xcb" PUBLIC
+ SECTION "Platform plugins"
+ LABEL "XCB"
+ AUTODETECT NOT APPLE
+ CONDITION QT_FEATURE_thread AND TARGET XCB::XCB AND TEST_xcb_syslibs AND QT_FEATURE_xkbcommon_x11
+)
+qt_feature("xcb-glx-plugin" PUBLIC
+ LABEL "GLX Plugin"
+ CONDITION QT_FEATURE_xcb_xlib AND QT_FEATURE_opengl AND NOT QT_FEATURE_opengles2
+ EMIT_IF QT_FEATURE_xcb
+)
+qt_feature("xcb-glx" PRIVATE
+ LABEL " XCB GLX"
+ CONDITION XCB_GLX_FOUND
+ EMIT_IF QT_FEATURE_xcb AND QT_FEATURE_xcb_glx_plugin
+)
+qt_feature("xcb-egl-plugin" PRIVATE
+ LABEL "EGL-X11 Plugin"
+ CONDITION QT_FEATURE_egl AND QT_FEATURE_opengl
+ EMIT_IF QT_FEATURE_xcb
+)
+qt_feature("xcb-native-painting" PRIVATE
+ LABEL "Native painting (experimental)"
+ AUTODETECT OFF
+ CONDITION QT_FEATURE_xcb_xlib AND QT_FEATURE_fontconfig AND XRender_FOUND
+ EMIT_IF QT_FEATURE_xcb
+)
+qt_feature("xrender" PRIVATE
+ LABEL "XRender for native painting"
+ CONDITION QT_FEATURE_xcb_native_painting
+ EMIT_IF QT_FEATURE_xcb AND QT_FEATURE_xcb_native_painting
+)
+qt_feature("xcb-xlib" PRIVATE
+ LABEL "XCB Xlib"
+ CONDITION QT_FEATURE_xlib AND X11_XCB_FOUND
+)
+qt_feature("xcb-sm" PRIVATE
+ LABEL "xcb-sm"
+ CONDITION QT_FEATURE_sessionmanager AND X11_SM_FOUND
+ EMIT_IF QT_FEATURE_xcb
+)
+qt_feature("system-xcb-xinput" PRIVATE
+ LABEL "Using system-provided xcb-xinput"
+ AUTODETECT OFF
+ CONDITION XCB_XINPUT_FOUND
+ ENABLE INPUT_bundled_xcb_xinput STREQUAL 'no'
+ DISABLE INPUT_bundled_xcb_xinput STREQUAL 'yes'
+ EMIT_IF QT_FEATURE_xcb
+)
+qt_feature("xkbcommon" PRIVATE
+ LABEL "xkbcommon"
+ CONDITION XKB_FOUND
+)
+qt_feature("xkbcommon-x11" PRIVATE
+ LABEL "xkbcommon-x11"
+ CONDITION QT_FEATURE_xkbcommon AND XKB_COMMON_X11_FOUND
+)
+qt_feature("xlib" PRIVATE
+ LABEL "XLib"
+ AUTODETECT NOT APPLE OR QT_FEATURE_xcb
+ CONDITION X11_FOUND
+)
+qt_feature("texthtmlparser" PUBLIC
+ SECTION "Kernel"
+ LABEL "HtmlParser"
+ PURPOSE "Provides a parser for HTML."
+)
+qt_feature_definition("texthtmlparser" "QT_NO_TEXTHTMLPARSER" NEGATE VALUE "1")
+qt_feature("textmarkdownreader" PUBLIC
+ SECTION "Kernel"
+ LABEL "MarkdownReader"
+ PURPOSE "Provides a Markdown (CommonMark and GitHub) reader"
+ ENABLE INPUT_libmd4c STREQUAL 'system' OR INPUT_libmd4c STREQUAL 'qt' OR INPUT_libmd4c STREQUAL 'yes'
+ DISABLE INPUT_libmd4c STREQUAL 'no'
+)
+qt_feature("system-textmarkdownreader" PUBLIC
+ SECTION "Kernel"
+ LABEL " Using system libmd4c"
+ CONDITION QT_FEATURE_textmarkdownreader AND WrapSystemMd4c_FOUND
+ ENABLE INPUT_libmd4c STREQUAL 'system'
+ DISABLE INPUT_libmd4c STREQUAL 'qt'
+)
+qt_feature("textmarkdownwriter" PUBLIC
+ SECTION "Kernel"
+ LABEL "MarkdownWriter"
+ CONDITION QT_FEATURE_regularexpression
+ PURPOSE "Provides a Markdown (CommonMark and GitHub) writer"
+)
+qt_feature("textodfwriter" PUBLIC
+ SECTION "Kernel"
+ LABEL "OdfWriter"
+ PURPOSE "Provides an ODF writer."
+ CONDITION QT_FEATURE_xmlstreamwriter
+)
+qt_feature_definition("textodfwriter" "QT_NO_TEXTODFWRITER" NEGATE VALUE "1")
+qt_feature("cssparser" PUBLIC
+ SECTION "Kernel"
+ LABEL "CssParser"
+ PURPOSE "Provides a parser for Cascading Style Sheets."
+)
+qt_feature_definition("cssparser" "QT_NO_CSSPARSER" NEGATE VALUE "1")
+qt_feature("draganddrop" PUBLIC
+ SECTION "Kernel"
+ LABEL "Drag and Drop"
+ PURPOSE "Supports the drag and drop mechanism."
+ CONDITION QT_FEATURE_imageformat_xpm
+)
+qt_feature_definition("draganddrop" "QT_NO_DRAGANDDROP" NEGATE VALUE "1")
+qt_feature("action" PUBLIC
+ SECTION "Kernel"
+ LABEL "Q(Gui)Action(Group)"
+ PURPOSE "Provides abstract user interface actions."
+)
+qt_feature_definition("action" "QT_NO_ACTION" NEGATE VALUE "1")
+qt_feature("cursor" PUBLIC
+ SECTION "Kernel"
+ LABEL "QCursor"
+ PURPOSE "Provides mouse cursors."
+)
+qt_feature_definition("cursor" "QT_NO_CURSOR" NEGATE VALUE "1")
+qt_feature("clipboard" PUBLIC
+ SECTION "Kernel"
+ LABEL "QClipboard"
+ PURPOSE "Provides cut and paste operations."
+ CONDITION NOT INTEGRITY AND NOT QNX AND NOT rtems
+)
+qt_feature_definition("clipboard" "QT_NO_CLIPBOARD" NEGATE VALUE "1")
+qt_feature("wheelevent" PUBLIC
+ SECTION "Kernel"
+ LABEL "QWheelEvent"
+ PURPOSE "Supports wheel events."
+)
+qt_feature_definition("wheelevent" "QT_NO_WHEELEVENT" NEGATE VALUE "1")
+qt_feature("tabletevent" PUBLIC
+ SECTION "Kernel"
+ LABEL "QTabletEvent"
+ PURPOSE "Supports tablet events."
+)
+qt_feature_definition("tabletevent" "QT_NO_TABLETEVENT" NEGATE VALUE "1")
+qt_feature("im" PUBLIC
+ SECTION "Kernel"
+ LABEL "QInputContext"
+ PURPOSE "Provides complex input methods."
+ CONDITION QT_FEATURE_library
+)
+qt_feature_definition("im" "QT_NO_IM" NEGATE VALUE "1")
+qt_feature("highdpiscaling" PUBLIC
+ SECTION "Kernel"
+ LABEL "High DPI Scaling"
+ PURPOSE "Provides automatic scaling of DPI-unaware applications on high-DPI displays."
+)
+qt_feature_definition("highdpiscaling" "QT_NO_HIGHDPISCALING" NEGATE VALUE "1")
+qt_feature("validator" PUBLIC
+ SECTION "Widgets"
+ LABEL "QValidator"
+ PURPOSE "Supports validation of input text."
+)
+qt_feature_definition("validator" "QT_NO_VALIDATOR" NEGATE VALUE "1")
+qt_feature("standarditemmodel" PUBLIC
+ SECTION "ItemViews"
+ LABEL "QStandardItemModel"
+ PURPOSE "Provides a generic model for storing custom data."
+ CONDITION QT_FEATURE_itemmodel
+)
+qt_feature_definition("standarditemmodel" "QT_NO_STANDARDITEMMODEL" NEGATE VALUE "1")
+qt_feature("filesystemmodel" PUBLIC
+ SECTION "File I/O"
+ LABEL "QFileSystemModel"
+ PURPOSE "Provides a data model for the local filesystem."
+ CONDITION QT_FEATURE_itemmodel
+)
+qt_feature_definition("filesystemmodel" "QT_NO_FILESYSTEMMODEL" NEGATE VALUE "1")
+qt_feature("imageformatplugin" PUBLIC
+ SECTION "Images"
+ LABEL "QImageIOPlugin"
+ PURPOSE "Provides a base for writing a image format plugins."
+)
+qt_feature_definition("imageformatplugin" "QT_NO_IMAGEFORMATPLUGIN" NEGATE VALUE "1")
+qt_feature("movie" PUBLIC
+ SECTION "Images"
+ LABEL "QMovie"
+ PURPOSE "Supports animated images."
+)
+qt_feature_definition("movie" "QT_NO_MOVIE" NEGATE VALUE "1")
+qt_feature("imageformat_bmp" PUBLIC
+ SECTION "Images"
+ LABEL "BMP Image Format"
+ PURPOSE "Supports Microsoft's Bitmap image file format."
+)
+qt_feature_definition("imageformat_bmp" "QT_NO_IMAGEFORMAT_BMP" NEGATE VALUE "1")
+qt_feature("imageformat_ppm" PUBLIC
+ SECTION "Images"
+ LABEL "PPM Image Format"
+ PURPOSE "Supports the Portable Pixmap image file format."
+)
+qt_feature_definition("imageformat_ppm" "QT_NO_IMAGEFORMAT_PPM" NEGATE VALUE "1")
+qt_feature("imageformat_xbm" PUBLIC
+ SECTION "Images"
+ LABEL "XBM Image Format"
+ PURPOSE "Supports the X11 Bitmap image file format."
+)
+qt_feature_definition("imageformat_xbm" "QT_NO_IMAGEFORMAT_XBM" NEGATE VALUE "1")
+qt_feature("imageformat_xpm" PUBLIC
+ SECTION "Images"
+ LABEL "XPM Image Format"
+ PURPOSE "Supports the X11 Pixmap image file format."
+)
+qt_feature_definition("imageformat_xpm" "QT_NO_IMAGEFORMAT_XPM" NEGATE VALUE "1")
+qt_feature("imageformat_png" PUBLIC
+ SECTION "Images"
+ LABEL "PNG Image Format"
+ PURPOSE "Supports the Portable Network Graphics image file format."
+)
+qt_feature_definition("imageformat_png" "QT_NO_IMAGEFORMAT_PNG" NEGATE VALUE "1")
+qt_feature("imageformat_jpeg" PUBLIC
+ SECTION "Images"
+ LABEL "JPEG Image Format"
+ PURPOSE "Supports the Joint Photographic Experts Group image file format."
+)
+qt_feature_definition("imageformat_jpeg" "QT_NO_IMAGEFORMAT_JPEG" NEGATE VALUE "1")
+qt_feature("image_heuristic_mask" PUBLIC
+ SECTION "Images"
+ LABEL "QImage::createHeuristicMask()"
+ PURPOSE "Supports creating a 1-bpp heuristic mask for images."
+)
+qt_feature_definition("image_heuristic_mask" "QT_NO_IMAGE_HEURISTIC_MASK" NEGATE VALUE "1")
+qt_feature("image_text" PUBLIC
+ SECTION "Images"
+ LABEL "Image Text"
+ PURPOSE "Supports image file text strings."
+)
+qt_feature_definition("image_text" "QT_NO_IMAGE_TEXT" NEGATE VALUE "1")
+qt_feature("picture" PUBLIC
+ SECTION "Painting"
+ LABEL "QPicture"
+ PURPOSE "Supports recording and replaying QPainter commands."
+)
+qt_feature_definition("picture" "QT_NO_PICTURE" NEGATE VALUE "1")
+qt_feature("colornames" PUBLIC
+ SECTION "Painting"
+ LABEL "Color Names"
+ PURPOSE "Supports color names such as \"red\", used by QColor and by some HTML documents."
+)
+qt_feature_definition("colornames" "QT_NO_COLORNAMES" NEGATE VALUE "1")
+qt_feature("pdf" PUBLIC
+ SECTION "Painting"
+ LABEL "QPdf"
+ PURPOSE "Provides a PDF backend for QPainter."
+ CONDITION QT_FEATURE_temporaryfile
+)
+qt_feature_definition("pdf" "QT_NO_PDF" NEGATE VALUE "1")
+qt_feature("desktopservices" PUBLIC
+ SECTION "Utilities"
+ LABEL "QDesktopServices"
+ PURPOSE "Provides methods for accessing common desktop services."
+)
+qt_feature_definition("desktopservices" "QT_NO_DESKTOPSERVICES" NEGATE VALUE "1")
+qt_feature("systemtrayicon" PUBLIC
+ SECTION "Utilities"
+ LABEL "QSystemTrayIcon"
+ PURPOSE "Provides an icon for an application in the system tray."
+ CONDITION QT_FEATURE_temporaryfile
+)
+qt_feature_definition("systemtrayicon" "QT_NO_SYSTEMTRAYICON" NEGATE VALUE "1")
+qt_feature("accessibility" PUBLIC
+ SECTION "Utilities"
+ LABEL "Accessibility"
+ PURPOSE "Provides accessibility support."
+)
+qt_feature_definition("accessibility" "QT_NO_ACCESSIBILITY" NEGATE VALUE "1")
+qt_feature("multiprocess" PRIVATE
+ SECTION "Utilities"
+ LABEL "Multi process"
+ PURPOSE "Provides support for detecting the desktop environment, launching external processes and opening URLs."
+ CONDITION NOT INTEGRITY AND NOT rtems
+)
+qt_feature("whatsthis" PUBLIC
+ SECTION "Widget Support"
+ LABEL "QWhatsThis"
+ PURPOSE "Supports displaying \"What's this\" help."
+)
+qt_feature_definition("whatsthis" "QT_NO_WHATSTHIS" NEGATE VALUE "1")
+qt_feature("raster-64bit" PRIVATE
+ SECTION "Painting"
+ LABEL "QPainter - 64 bit raster"
+ PURPOSE "Internal painting support for 64 bit (16 bpc) rasterization."
+)
+qt_feature("raster-fp" PRIVATE
+ SECTION "Painting"
+ LABEL "QPainter - floating point raster"
+ PURPOSE "Internal painting support for floating point rasterization."
+ CONDITION NOT VXWORKS # QTBUG-115777
+)
+qt_feature("undocommand" PUBLIC
+ SECTION "Utilities"
+ LABEL "QUndoCommand"
+ PURPOSE "Applies (redo or) undo of a single change in a document."
+)
+qt_feature_definition("undocommand" "QT_NO_UNDOCOMMAND" NEGATE VALUE "1")
+qt_feature("undostack" PUBLIC
+ SECTION "Utilities"
+ LABEL "QUndoStack"
+ PURPOSE "Provides the ability to (redo or) undo a list of changes in a document."
+ CONDITION QT_FEATURE_undocommand
+)
+qt_feature_definition("undostack" "QT_NO_UNDOSTACK" NEGATE VALUE "1")
+qt_feature("undogroup" PUBLIC
+ SECTION "Utilities"
+ LABEL "QUndoGroup"
+ PURPOSE "Provides the ability to cluster QUndoCommands."
+ CONDITION QT_FEATURE_undostack
+)
+qt_feature("graphicsframecapture" PRIVATE
+ SECTION "Utilities"
+ LABEL "QGraphicsFrameCapture"
+ PURPOSE "Provides a way to capture 3D graphics API calls for a rendered frame."
+ CONDITION TEST_renderdoc OR (MACOS OR IOS)
+)
+qt_feature_definition("undogroup" "QT_NO_UNDOGROUP" NEGATE VALUE "1")
+qt_feature("wayland" PUBLIC
+ SECTION "Platform plugins"
+ LABEL "Wayland"
+ CONDITION TARGET Wayland::Client
+)
+
+qt_configure_add_summary_section(NAME "Qt Gui")
+qt_configure_add_summary_entry(ARGS "accessibility")
+qt_configure_add_summary_entry(ARGS "freetype")
+qt_configure_add_summary_entry(ARGS "system-freetype")
+qt_configure_add_summary_entry(ARGS "harfbuzz")
+qt_configure_add_summary_entry(ARGS "system-harfbuzz")
+qt_configure_add_summary_entry(ARGS "fontconfig")
+qt_configure_add_summary_section(NAME "Image formats")
+qt_configure_add_summary_entry(ARGS "gif")
+qt_configure_add_summary_entry(ARGS "ico")
+qt_configure_add_summary_entry(ARGS "jpeg")
+qt_configure_add_summary_entry(ARGS "system-jpeg")
+qt_configure_add_summary_entry(ARGS "png")
+qt_configure_add_summary_entry(ARGS "system-png")
+qt_configure_end_summary_section() # end of "Image formats" section
+qt_configure_add_summary_section(NAME "Text formats")
+qt_configure_add_summary_entry(ARGS "texthtmlparser")
+qt_configure_add_summary_entry(ARGS "cssparser")
+qt_configure_add_summary_entry(ARGS "textodfwriter")
+qt_configure_add_summary_entry(ARGS "textmarkdownreader")
+qt_configure_add_summary_entry(ARGS "system-textmarkdownreader")
+qt_configure_add_summary_entry(ARGS "textmarkdownwriter")
+qt_configure_end_summary_section() # end of "Text formats" section
+qt_configure_add_summary_entry(ARGS "egl")
+qt_configure_add_summary_entry(ARGS "openvg")
+qt_configure_add_summary_section(NAME "OpenGL")
+qt_configure_add_summary_entry(ARGS "opengl-desktop")
+qt_configure_add_summary_entry(
+ ARGS "opengl-dynamic"
+ CONDITION WIN32
+)
+qt_configure_add_summary_entry(ARGS "opengles2")
+qt_configure_add_summary_entry(ARGS "opengles3")
+qt_configure_add_summary_entry(ARGS "opengles31")
+qt_configure_add_summary_entry(ARGS "opengles32")
+qt_configure_end_summary_section() # end of "OpenGL" section
+qt_configure_add_summary_entry(ARGS "vulkan")
+qt_configure_add_summary_entry(ARGS "metal")
+qt_configure_add_summary_entry(ARGS "graphicsframecapture")
+qt_configure_add_summary_entry(ARGS "sessionmanager")
+qt_configure_end_summary_section() # end of "Qt Gui" section
+qt_configure_add_summary_section(NAME "Features used by QPA backends")
+qt_configure_add_summary_entry(ARGS "evdev")
+qt_configure_add_summary_entry(ARGS "libinput")
+qt_configure_add_summary_entry(ARGS "libinput_hires_wheel_support")
+qt_configure_add_summary_entry(ARGS "integrityhid")
+qt_configure_add_summary_entry(ARGS "mtdev")
+qt_configure_add_summary_entry(ARGS "tslib")
+qt_configure_add_summary_entry(ARGS "xkbcommon")
+qt_configure_add_summary_section(NAME "X11 specific")
+qt_configure_add_summary_entry(ARGS "xlib")
+qt_configure_add_summary_entry(ARGS "xcb-xlib")
+qt_configure_add_summary_entry(ARGS "egl_x11")
+qt_configure_add_summary_entry(ARGS "xkbcommon-x11")
+qt_configure_add_summary_entry(ARGS "xcb-sm")
+qt_configure_end_summary_section() # end of "X11 specific" section
+qt_configure_end_summary_section() # end of "Features used by QPA backends" section
+qt_configure_add_summary_section(NAME "QPA backends")
+qt_configure_add_summary_entry(ARGS "directfb")
+qt_configure_add_summary_entry(ARGS "eglfs")
+qt_configure_add_summary_section(NAME "EGLFS details")
+qt_configure_add_summary_entry(ARGS "eglfs_openwfd")
+qt_configure_add_summary_entry(ARGS "eglfs_viv")
+qt_configure_add_summary_entry(ARGS "eglfs_viv_wl")
+qt_configure_add_summary_entry(ARGS "eglfs_rcar")
+qt_configure_add_summary_entry(ARGS "eglfs_egldevice")
+qt_configure_add_summary_entry(ARGS "eglfs_gbm")
+qt_configure_add_summary_entry(ARGS "eglfs_vsp2")
+qt_configure_add_summary_entry(ARGS "eglfs_mali")
+qt_configure_add_summary_entry(ARGS "eglfs_brcm")
+qt_configure_add_summary_entry(ARGS "eglfs_x11")
+qt_configure_end_summary_section() # end of "EGLFS details" section
+qt_configure_add_summary_entry(ARGS "linuxfb")
+qt_configure_add_summary_entry(ARGS "vnc")
+qt_configure_add_summary_entry(ARGS "vkkhrdisplay")
+qt_configure_add_summary_entry(
+ ARGS "integrityfb"
+ CONDITION INTEGRITY
+)
+qt_configure_add_summary_section(NAME "QNX")
+qt_configure_add_summary_entry(ARGS "lgmon")
+qt_configure_add_summary_entry(ARGS "qqnx_imf")
+qt_configure_end_summary_section() # end of "QNX" section
+qt_configure_add_summary_section(NAME "XCB")
+qt_configure_add_summary_entry(ARGS "system-xcb-xinput")
+qt_configure_add_summary_section(NAME "GL integrations")
+qt_configure_add_summary_entry(ARGS "xcb-glx-plugin")
+qt_configure_add_summary_entry(ARGS "xcb-glx")
+qt_configure_add_summary_entry(ARGS "xcb-egl-plugin")
+qt_configure_end_summary_section() # end of "GL integrations" section
+qt_configure_end_summary_section() # end of "XCB" section
+qt_configure_add_summary_section(NAME "Windows")
+qt_configure_add_summary_entry(ARGS "direct2d")
+qt_configure_add_summary_entry(ARGS "direct2d1_1")
+qt_configure_add_summary_entry(ARGS "directwrite")
+qt_configure_add_summary_entry(ARGS "directwrite3")
+qt_configure_end_summary_section() # end of "Windows" section
+qt_configure_end_summary_section() # end of "QPA backends" section
+qt_configure_add_report_entry(
+ TYPE NOTE
+ MESSAGE "XCB support on macOS is minimal and untested. Some features will not work properly or at all (e.g. OpenGL, desktop services or accessibility), or may depend on your system and XQuartz setup."
+ CONDITION QT_FEATURE_xcb AND APPLE
+)
+qt_configure_add_report_entry(
+ TYPE NOTE
+ MESSAGE "Disabling X11 Accessibility Bridge: D-Bus or AT-SPI is missing."
+ CONDITION QT_FEATURE_accessibility AND QT_FEATURE_xcb AND NOT QT_FEATURE_accessibility_atspi_bridge
+)
+qt_configure_add_report_entry(
+ TYPE WARNING
+ MESSAGE "No QPA platform plugin enabled! This will produce a Qt that cannot run GUI applications. See \"Platform backends\" in the output of --help."
+ CONDITION QT_FEATURE_gui AND LINUX AND NOT ANDROID AND NOT QT_FEATURE_xcb AND NOT QT_FEATURE_eglfs AND NOT QT_FEATURE_directfb AND NOT QT_FEATURE_linuxfb
+)
+qt_configure_add_report_entry(
+ TYPE ERROR
+ MESSAGE "The OpenGL functionality tests failed! You might need to modify the OpenGL package search path by setting the OpenGL_DIR CMake variable to the OpenGL library's installation directory."
+ CONDITION QT_FEATURE_gui AND NOT WATCHOS AND NOT VISIONOS AND ( NOT INPUT_opengl STREQUAL 'no' ) AND NOT QT_FEATURE_opengl_desktop AND NOT QT_FEATURE_opengles2 AND NOT QT_FEATURE_opengl_dynamic
+)
+qt_configure_add_report_entry(
+ TYPE WARNING
+ MESSAGE "Accessibility disabled. This configuration of Qt is unsupported."
+ CONDITION NOT QT_FEATURE_accessibility
+)
+qt_configure_add_report_entry(
+ TYPE ERROR
+ MESSAGE "XCB plugin requires xkbcommon and xkbcommon-x11, but -no-xkbcommon was provided."
+ CONDITION ( NOT INPUT_xcb STREQUAL '' ) AND ( NOT INPUT_xcb STREQUAL 'no' ) AND INPUT_xkbcommon STREQUAL 'no'
+)
diff --git a/src/gui/configure.json b/src/gui/configure.json
deleted file mode 100644
index 3891ff4070..0000000000
--- a/src/gui/configure.json
+++ /dev/null
@@ -1,1998 +0,0 @@
-{
- "module": "gui",
- "depends": [
- "core-private",
- "network"
- ],
- "testDir": "../../config.tests",
-
- "commandline": {
- "options": {
- "accessibility": "boolean",
- "angle": "boolean",
- "combined-angle-lib": "boolean",
- "direct2d": "boolean",
- "directfb": "boolean",
- "directwrite": "boolean",
- "egl": "boolean",
- "eglfs": "boolean",
- "evdev": "boolean",
- "fontconfig": "boolean",
- "freetype": { "type": "enum", "values": [ "no", "qt", "system" ] },
- "gbm": "boolean",
- "gif": "boolean",
- "harfbuzz": { "type": "enum", "values": [ "no", "qt", "system" ] },
- "ico": "boolean",
- "imf": { "type": "boolean", "name": "qqnx_imf" },
- "kms": "boolean",
- "lgmon": "boolean",
- "libinput": "boolean",
- "libjpeg": { "type": "enum", "values": [ "no", "qt", "system" ] },
- "libmd4c": { "type": "enum", "values": [ "no", "qt", "system" ] },
- "libpng": { "type": "enum", "values": [ "no", "qt", "system" ] },
- "linuxfb": "boolean",
- "mtdev": "boolean",
- "opengl": { "type": "optionalString", "values": [ "no", "yes", "desktop", "es2", "dynamic" ] },
- "opengl-es-2": { "type": "void", "name": "opengl", "value": "es2" },
- "opengles3": "boolean",
- "openvg": "boolean",
- "qpa": { "type": "string", "name": "qpa_default_platform" },
- "qpa-platform-guard": "boolean",
- "sm": { "type": "boolean", "name": "sessionmanager" },
- "tslib": "boolean",
- "vulkan": "boolean",
- "xcb": "boolean",
- "bundled-xcb-xinput": "boolean",
- "xcb-native-painting": "boolean",
- "xcb-xlib": "boolean",
- "xkbcommon": "boolean"
- }
- },
-
- "libraries": {
- "atspi": {
- "label": "atspi",
- "sources": [
- { "type": "pkgConfig", "args": "atspi-2" }
- ]
- },
- "bcm_host": {
- "export": "",
- "headers": ["bcm_host.h"],
- "sources": [
- { "type": "pkgConfig", "args": "bcm_host" },
- { "type": "makeSpec", "spec": "BCM_HOST" }
- ]
- },
- "dxguid": {
- "label": "DirectX GUID",
- "sources": [
- "-ldxguid"
- ]
- },
- "dxgi": {
- "label": "DirectX GI",
- "headers": "dxgi.h",
- "sources": [
- "-ldxgi"
- ]
- },
- "dxgi1_2": {
- "label": "DirectX GI 1.2",
- "test": {
- "main": [
- "// fails with mingw-w64 5.4.0 - declaration is missing from header",
- "IDXGISurface1 *surface;",
- "(void) surface;"
- ]
- },
- "headers": "dxgi1_2.h",
- "sources": [
- "-ldxgi"
- ]
- },
- "d3d9": {
- "label": "Direct3D 9",
- "headers": "d3d9.h",
- "sources": [
- "-ld3d9"
- ]
- },
- "d3d11": {
- "label": "Direct3D 11",
- "headers": "d3d11.h",
- "sources": [
- "-ld3d11"
- ]
- },
- "d3d11_1": {
- "label": "Direct3D 11.1",
- "headers": "d3d11_1.h",
- "sources": [
- "-ld3d11"
- ]
- },
- "d3dcompiler": {
- "label": "Direct3D Shader Compiler Library",
- "headers": "d3dcompiler.h",
- "sources": [
- "-ld3dcompiler"
- ]
- },
- "d2d1": {
- "label": "Direct2D 1",
- "headers": [ "d2d1.h", "d2d1helper.h" ],
- "sources": [
- "-ld2d1"
- ]
- },
- "d2d1_1": {
- "label": "Direct2D 1.1",
- "test": {
- "main": [
- "ID2D1Factory1 *d2dFactory;",
- "D2D1CreateFactory(D2D1_FACTORY_TYPE_SINGLE_THREADED, &d2dFactory);"
- ]
- },
- "headers": [ "d2d1_1.h", "d2d1_1helper.h" ],
- "sources": [
- "-ld2d1"
- ]
- },
- "directfb": {
- "label": "DirectFB",
- "test": {
- "tail": [
- "#ifdef __typeof__",
- "# error DirectFB headers are unclean and cannot compile",
- "#endif"
- ]
- },
- "headers": "directfb.h",
- "sources": [
- { "type": "pkgConfig", "args": "directfb" }
- ]
- },
- "dwrite": {
- "label": "DirectWrite",
- "test": {
- "main": [
- "IDWriteFactory *factory = 0;",
- "DWriteCreateFactory(DWRITE_FACTORY_TYPE_SHARED, __uuidof(IDWriteFactory),",
- " (IUnknown **)(&factory));"
- ]
- },
- "headers": "dwrite.h",
- "sources": [
- "-ldwrite"
- ]
- },
- "dwrite_1": {
- "label": "DirectWrite 1",
- "headers": "dwrite_1.h",
- "sources": [
- "-ldwrite"
- ]
- },
- "dwrite_2": {
- "label": "DirectWrite 2",
- "test": {
- "main": [
- "IUnknown *factory = 0;",
- "(void)(size_t(DWRITE_E_NOCOLOR) + sizeof(IDWriteFontFace2));",
- "DWriteCreateFactory(DWRITE_FACTORY_TYPE_SHARED, __uuidof(IDWriteFactory2),",
- " &factory);"
- ]
- },
- "headers": "dwrite_2.h",
- "sources": [
- "-ldwrite"
- ]
- },
- "drm": {
- "label": "KMS",
- "test": {
- "head": [
- "#include <stdlib.h>",
- "#include <stdint.h>",
- "extern \"C\" {"
- ],
- "tail": [
- "}"
- ],
- "main": "(void) drmModeGetCrtc(0, 0);"
- },
- "headers": [ "xf86drmMode.h", "xf86drm.h" ],
- "sources": [
- { "type": "pkgConfig", "args": "libdrm" },
- { "libs": "-ldrm", "condition": "!config.integrity" },
- { "libs": "-ldrm-nvdc -lposix -livfs -lnvll -lnvdc -lnvrm -lnvrm_graphics -lnvos -lnvtegrahv", "condition": "config.integrity" }
- ]
- },
- "egl": {
- "label": "EGL",
- "test": {
- "main": [
- "EGLint x = 0; EGLDisplay dpy = 0; EGLContext ctx = 0;",
- "eglDestroyContext(dpy, ctx);"
- ]
- },
- "headers": "EGL/egl.h",
- "sources": [
- { "type": "pkgConfig", "args": "egl" },
- { "type": "makeSpec", "spec": "EGL" }
- ]
- },
- "freetype": {
- "label": "FreeType",
- "test": {
- "tail": [
- "#include FT_FREETYPE_H",
- "#if ((FREETYPE_MAJOR*10000 + FREETYPE_MINOR*100 + FREETYPE_PATCH) < 20200)",
- "# error This version of freetype is too old.",
- "#endif"
- ],
- "main": [
- "FT_Face face = 0;"
- ]
- },
- "headers": "ft2build.h",
- "sources": [
- { "type": "pkgConfig", "args": "freetype2" },
- { "type": "freetype", "libs": "-lfreetype", "condition": "!config.wasm" },
- { "libs": "-s USE_FREETYPE=1", "condition": "config.wasm" },
- { "libs": "-lfreetype" }
- ],
- "use": [
- { "lib": "zlib", "condition": "features.system-zlib" }
- ]
- },
- "fontconfig": {
- "label": "Fontconfig",
- "test": {
- "tail": [
- "#ifndef FC_RGBA_UNKNOWN",
- "# error This version of fontconfig is too old, it is missing the FC_RGBA_UNKNOWN define",
- "#endif"
- ],
- "main": [
- "FcPattern *pattern = 0;"
- ]
- },
- "headers": "fontconfig/fontconfig.h",
- "sources": [
- { "type": "pkgConfig", "args": "fontconfig" },
- { "type": "freetype", "libs": "-lfontconfig" }
- ],
- "use": "freetype"
- },
- "gbm": {
- "label": "GBM",
- "test": {
- "head": [
- "#include <stdlib.h>",
- "#include <stdint.h>",
- "extern \"C\" {"
- ],
- "tail": [
- "}"
- ],
- "main": "gbm_surface *surface = 0;"
- },
- "headers": "gbm.h",
- "sources": [
- { "type": "pkgConfig", "args": "gbm" }
- ]
- },
- "harfbuzz": {
- "label": "HarfBuzz",
- "test": {
- "tail": [
- "#if !HB_VERSION_ATLEAST(1, 6, 0)",
- "# error This version of harfbuzz is too old.",
- "#endif"
- ],
- "main": [
- "hb_buffer_t *buffer = hb_buffer_create();",
- "const uint16_t string[] = { 'A', 'b', 'c' };",
- "hb_buffer_add_utf16(buffer, string, 3, 0, 3);",
- "hb_buffer_guess_segment_properties(buffer);",
- "hb_buffer_set_flags(buffer, hb_buffer_flags_t(HB_BUFFER_FLAG_PRESERVE_DEFAULT_IGNORABLES));",
- "hb_buffer_destroy(buffer);"
- ]
- },
- "headers": "harfbuzz/hb.h",
- "sources": [
- "-lharfbuzz"
- ]
- },
- "imf": {
- "label": "IMF",
- "export": "",
- "test": {
- "main": "imf_client_init();"
- },
- "headers": "imf/imf_client.h",
- "sources": [
- "-linput_client"
- ]
- },
- "lgmon": {
- "label": "lgmon",
- "test": {
- "main": "lgmon_supported(getpid());"
- },
- "headers": "lgmon.h",
- "sources": [
- "-llgmon"
- ]
- },
- "libinput": {
- "label": "libinput",
- "test": {
- "main": "libinput_udev_create_context(NULL, NULL, NULL);"
- },
- "headers": "libinput.h",
- "sources": [
- { "type": "pkgConfig", "args": "libinput" }
- ]
- },
- "integrityhid": {
- "label": "integrityhid",
- "test": {
- "head": [
- "#include <stdlib.h>",
- "#include <stdint.h>"
- ],
- "main": [
- "HIDDriver *driver;",
- "uintptr_t devicecontext;",
- "uint32_t device_id;",
- "gh_hid_enum_devices(driver, &device_id, &devicecontext);"
- ]
- },
- "headers": "device/hiddriver.h",
- "sources": [
- { "libs": "-lhiddev -lusbhid -lusb" }
- ]
- },
- "libjpeg": {
- "label": "libjpeg",
- "test": {
- "head": [
- "#include <sys/types.h>",
- "#include <stdio.h>",
- "extern \"C\" {"
- ],
- "tail": [
- "}",
- "",
- "j_compress_ptr cinfo;"
- ],
- "main": "jpeg_create_compress(cinfo);"
- },
- "headers": "jpeglib.h",
- "sources": [
- { "libs": "-llibjpeg", "condition": "config.msvc" },
- "-ljpeg"
- ]
- },
- "libmd4c": {
- "label": "libmd4c",
- "test": {
- "main": "md_parse(\"hello\", 5, nullptr, nullptr);"
- },
- "headers": "md4c.h",
- "sources": [
- { "type": "pkgConfig", "args": "md4c" },
- { "libs": "-lmd4c" }
- ]
- },
- "libpng": {
- "label": "libpng",
- "test": {
- "main": "(void) png_create_read_struct(PNG_LIBPNG_VER_STRING,0,0,0);"
- },
- "headers": "png.h",
- "sources": [
- { "type": "pkgConfig", "args": "libpng" },
- { "libs": "-llibpng16", "condition": "config.msvc" },
- { "libs": "-llibpng", "condition": "config.msvc" },
- { "libs": "-lpng16", "condition": "!config.msvc" },
- { "libs": "-lpng", "condition": "!config.msvc" },
- { "libs": "-s USE_LIBPNG=1", "condition": "config.wasm" }
- ],
- "use": [
- { "lib": "zlib", "condition": "features.system-zlib" }
- ]
- },
- "mtdev": {
- "label": "mtdev",
- "test": {
- "main": [
- "mtdev m;",
- "mtdev_open(&m, 0);"
- ]
- },
- "headers": "mtdev.h",
- "sources": [
- { "type": "pkgConfig", "args": "mtdev" }
- ]
- },
- "opengl": {
- "label": "Desktop OpenGL",
- "test": {
- "head": [
- "#ifdef __APPLE__",
- "# include <OpenGL/gl.h>",
- "#else",
- "# define GL_GLEXT_PROTOTYPES",
- "#endif"
- ],
- "main": [
- "glBegin(GL_TRIANGLES);",
- " glVertex2f(20.0f, 10.0f);",
- " glVertex2f(10.0f, 30.0f);",
- " glVertex2f(20.0f, 50.0f);",
- "glEnd();"
- ]
- },
- "headers": [
- {
- "condition": "!config.darwin",
- "headers": "GL/gl.h"
- }
- ],
- "sources": [
- { "type": "pkgConfig", "args": "gl", "condition": "!config.darwin" },
- { "type": "makeSpec", "spec": "OPENGL" }
- ]
- },
- "opengl_es2": {
- "label": "OpenGL ES 2.0",
- "test": {
- "head": [
- "#ifdef __APPLE__",
- "# include <OpenGLES/ES2/gl.h>",
- "#else",
- "# define GL_GLEXT_PROTOTYPES",
- "#endif"
- ],
- "main": [
- "glUniform1f(1, GLfloat(1.0));",
- "glClear(GL_COLOR_BUFFER_BIT);"
- ]
- },
- "headers": [
- {
- "condition": "!config.darwin",
- "headers": "GLES2/gl2.h"
- }
- ],
- "sources": [
- { "type": "pkgConfig", "args": "glesv2", "condition": "!config.darwin" },
- { "type": "makeSpec", "spec": "OPENGL_ES2" }
- ]
- },
- "openvg": {
- "label": "OpenVG",
- "test": {
- "main": "VGint i = 2; vgFlush();"
- },
- "headers": "VG/openvg.h",
- "sources": [
- { "type": "pkgConfig", "args": "vg" },
- { "type": "makeSpec", "spec": "OPENVG" }
- ]
- },
- "tslib": {
- "label": "tslib",
- "test": {
- "main": "ts_setup(nullptr, 0);"
- },
- "headers": "tslib.h",
- "sources": [
- "-lts"
- ]
- },
- "v4l2": {
- "label": "V4L2",
- "test": {
- "head": [
- "#include <cstddef>",
- "extern \"C\" {"
- ],
- "tail": [
- "}"
- ],
- "main": [
- "v4l2_format fmt;",
- "media_pad *pad = nullptr;",
- "media_device *device = media_device_new(\"/dev/media\");",
- "v4l2_subdev_set_format(nullptr, nullptr, 0, V4L2_SUBDEV_FORMAT_ACTIVE);"
- ]
- },
- "headers": [ "mediactl/mediactl.h", "mediactl/v4l2subdev.h" ],
- "sources": [
- { "type": "pkgConfig", "args": "libv4l2 libmediactl" },
- "-lmediactl -lv4l2 -lv4l2subdev"
- ]
- },
- "vulkan": {
- "label": "Vulkan",
- "test": {
- "comment": "Note: Qt does not rely on linking to a Vulkan library directly.",
- "tail": [
- "// The pData parameter has changed from uint32_t* to void* at some point.",
- "// Ensure the headers have the updated one to prevent compile errors later on.",
- "PFN_vkCmdUpdateBuffer cmdUpdBuf;",
- "void testUpdateBuffer(VkCommandBuffer commandBuffer, VkBuffer dstBuffer, VkDeviceSize dstOffset, VkDeviceSize dataSize, const void* pData)",
- "{",
- " cmdUpdBuf(commandBuffer, dstBuffer, dstOffset, dataSize, pData);",
- "}"
- ],
- "main": [
- "VkInstanceCreateInfo info;",
- "testUpdateBuffer(0, 0, 0, 0, 0);"
- ]
- },
- "headers": "vulkan/vulkan.h",
- "sources": [
- { "type": "pkgConfig", "args": "vulkan" },
- { "type": "makeSpec", "spec": "VULKAN" }
- ]
- },
- "wayland_server": {
- "label": "Wayland Server",
- "test": {
- "main": "wl_display_create();"
- },
- "headers": "wayland-server.h",
- "sources": [
- { "type": "pkgConfig", "args": "wayland-server" }
- ]
- },
- "xlib": {
- "label": "XLib",
- "test": {
- "main": [
- "Display *d = XOpenDisplay(NULL);",
- "XCloseDisplay(d);"
- ]
- },
- "headers": "X11/Xlib.h",
- "sources": [
- { "type": "makeSpec", "spec": "X11" }
- ]
- },
- "x11sm": {
- "label": "X11 session management",
- "sources": [
- { "type": "pkgConfig", "args": "sm ice" }
- ]
- },
- "xcb": {
- "label": "XCB >= 1.11",
- "test": {
- "main": [
- "int primaryScreen = 0;",
- "(void)xcb_connect(\"\", &primaryScreen);",
- "/* XCB_PACKED define was added in libxcb 1.11 */",
- "#ifdef XCB_PACKED",
- " return 0;",
- "#else",
- " return -1;",
- "#endif"
- ]
- },
- "headers": "xcb/xcb.h",
- "sources": [
- { "type": "pkgConfig", "args": "xcb >= 1.11" },
- "-lxcb"
- ]
- },
- "xcb_icccm": {
- "label": "XCB ICCCM >= 0.3.9",
- "headers": "xcb/xcb_icccm.h",
- "sources": [
- { "type": "pkgConfig", "args": "xcb-icccm >= 0.3.9" },
- "-lxcb-icccm"
- ],
- "use": "xcb"
- },
- "xcb_image": {
- "label": "XCB Image >= 0.3.9",
- "headers": "xcb/xcb_image.h",
- "sources": [
- { "type": "pkgConfig", "args": "xcb-image >= 0.3.9" },
- "-lxcb-image"
- ],
- "use": "xcb_shm xcb"
- },
- "xcb_keysyms": {
- "label": "XCB Keysyms >= 0.3.9",
- "headers": "xcb/xcb_keysyms.h",
- "sources": [
- { "type": "pkgConfig", "args": "xcb-keysyms >= 0.3.9" },
- "-lxcb-keysyms"
- ],
- "use": "xcb"
- },
- "xcb_renderutil": {
- "label": "XCB Renderutil >= 0.3.9",
- "headers": "xcb/xcb_renderutil.h",
- "sources": [
- { "type": "pkgConfig", "args": "xcb-renderutil >= 0.3.9" },
- "-lxcb-render-util"
- ],
- "use": "xcb xcb_render"
- },
- "xcb_randr": {
- "label": "XCB RandR",
- "headers": "xcb/randr.h",
- "sources": [
- { "type": "pkgConfig", "args": "xcb-randr" },
- "-lxcb-randr"
- ],
- "use": "xcb"
- },
- "xcb_shape": {
- "label": "XCB Shape",
- "headers": "xcb/shape.h",
- "sources": [
- { "type": "pkgConfig", "args": "xcb-shape" },
- "-lxcb-shape"
- ],
- "use": "xcb"
- },
- "xcb_shm": {
- "label": "XCB SHM",
- "headers": "xcb/shm.h",
- "sources": [
- { "type": "pkgConfig", "args": "xcb-shm" },
- "-lxcb-shm"
- ],
- "use": "xcb"
- },
- "xcb_sync": {
- "label": "XCB Sync",
- "headers": "xcb/sync.h",
- "sources": [
- { "type": "pkgConfig", "args": "xcb-sync" },
- "-lxcb-sync"
- ],
- "use": "xcb"
- },
- "xcb_xfixes": {
- "label": "XCB Xfixes",
- "headers": "xcb/xfixes.h",
- "sources": [
- { "type": "pkgConfig", "args": "xcb-xfixes" },
- "-lxcb-xfixes"
- ],
- "use": "xcb"
- },
- "xcb_xinerama": {
- "label": "XCB Xinerama",
- "headers": "xcb/xinerama.h",
- "sources": [
- { "type": "pkgConfig", "args": "xcb-xinerama" },
- "-lxcb-xinerama"
- ],
- "use": "xcb"
- },
- "xcb_xlib": {
- "label": "XCB Xlib",
- "test": {
- "main": "(void) XGetXCBConnection((Display *)0);"
- },
- "headers": "X11/Xlib-xcb.h",
- "sources": [
- { "type": "pkgConfig", "args": "x11-xcb" },
- "-lX11-xcb"
- ],
- "use": "xcb xlib"
- },
- "xcb_xkb": {
- "label": "XCB XKB",
- "headers": "xcb/xkb.h",
- "sources": [
- { "type": "pkgConfig", "args": "xcb-xkb" },
- "-lxcb-xkb"
- ],
- "use": "xcb"
- },
- "xcb_render": {
- "label": "XCB XRender",
- "headers": "xcb/render.h",
- "sources": [
- { "type": "pkgConfig", "args": "xcb-render" },
- "-lxcb-render"
- ],
- "use": "xcb"
- },
- "xcb_glx": {
- "label": "XCB GLX",
- "test": {
- "main": [
- "xcb_connection_t *connection = 0;",
- "xcb_generic_error_t *error = 0;",
- "xcb_glx_query_version_cookie_t xglx_query_cookie = xcb_glx_query_version(",
- " connection, XCB_GLX_MAJOR_VERSION, XCB_GLX_MINOR_VERSION);",
- "xcb_glx_query_version_reply(connection, xglx_query_cookie, &error);"
- ]
- },
- "headers": "xcb/glx.h",
- "sources": [
- { "type": "pkgConfig", "args": "xcb-glx" },
- "-lxcb-glx"
- ],
- "use": "xcb"
- },
- "xcb_xinput": {
- "label": "XCB XInput",
- "test": {
- "main": [
- "xcb_connection_t *connection = 0;",
- "xcb_generic_error_t *error = 0;",
- "xcb_input_xi_query_version_cookie_t xinput_query_cookie = xcb_input_xi_query_version(",
- " connection, XCB_INPUT_MAJOR_VERSION, XCB_INPUT_MINOR_VERSION);",
- "xcb_input_xi_query_version_reply(connection, xinput_query_cookie, &error);"
- ]
- },
- "headers": "xcb/xinput.h",
- "sources": [
- { "type": "pkgConfig", "args": "xcb-xinput >= 1.12" },
- "-lxcb-xinput"
- ],
- "use": "xcb"
- },
- "xkbcommon": {
- "label": "xkbcommon >= 0.5.0",
- "test": {
- "main": "xkb_context_new(XKB_CONTEXT_NO_FLAGS);"
- },
- "headers": [ "xkbcommon/xkbcommon.h" ],
- "sources": [
- { "type": "pkgConfig", "args": "xkbcommon >= 0.5.0" },
- "-lxkbcommon"
- ]
- },
- "xkbcommon_x11": {
- "label": "xkbcommon-x11",
- "test": {
- "main": "xkb_x11_setup_xkb_extension_flags flag = XKB_X11_SETUP_XKB_EXTENSION_NO_FLAGS;"
- },
- "headers": [ "xkbcommon/xkbcommon-x11.h" ],
- "sources": [
- { "type": "pkgConfig", "args": "xkbcommon-x11" },
- "-lxkbcommon -lxkbcommon-x11"
- ]
- },
- "xrender": {
- "label": "XRender for native painting",
- "test": {
- "tail": [
- "#if RENDER_MAJOR == 0 && RENDER_MINOR < 5",
- "# error Required Xrender version 0.6 not found.",
- "#endif"
- ],
- "main": "XRenderPictFormat *format = 0;"
- },
- "headers": "X11/extensions/Xrender.h",
- "sources": [
- "-lXrender"
- ],
- "use": "xlib"
- }
- },
-
- "tests": {
- "angle_d3d11_qdtd": {
- "label": "D3D11_QUERY_DATA_TIMESTAMP_DISJOINT",
- "type": "compile",
- "test": {
- "include": "d3d11.h",
- "main": [
- "D3D11_QUERY_DATA_TIMESTAMP_DISJOINT qdtd;",
- "(void) qdtd;"
- ]
- }
- },
- "fxc": {
- "label": "Direct3D Shader Compiler",
- "type": "fxc",
- "log": "value"
- },
- "drm_atomic": {
- "label": "DRM Atomic API",
- "type": "compile",
- "test": {
- "head": [
- "#include <stdlib.h>",
- "#include <stdint.h>",
- "extern \"C\" {"
- ],
- "include": [
- "xf86drmMode.h",
- "xf86drm.h"
- ],
- "tail": [
- "}"
- ],
- "main": "drmModeAtomicReq *request;"
- },
- "use": "drm"
- },
- "egl-x11": {
- "label": "EGL on X11",
- "type": "compile",
- "test": {
- "head": [
- "// Check if EGL is compatible with X. Some EGL implementations, typically on",
- "// embedded devices, are not intended to be used together with X. EGL support",
- "// has to be disabled in plugins like xcb in this case since the native display,",
- "// window and pixmap types will be different than what an X-based platform",
- "// plugin would expect."
- ],
- "include": [ "EGL/egl.h", "X11/Xlib.h" ],
- "main": [
- "Display *dpy = EGL_DEFAULT_DISPLAY;",
- "EGLNativeDisplayType egldpy = XOpenDisplay(\"\");",
- "dpy = egldpy;",
- "EGLNativeWindowType w = XCreateWindow(dpy, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0);",
- "XDestroyWindow(dpy, w);",
- "XCloseDisplay(dpy);"
- ]
- },
- "use": "egl xlib"
- },
- "egl-brcm": {
- "label": "Broadcom EGL (Raspberry Pi)",
- "type": "compile",
- "test": {
- "include": [ "EGL/egl.h", "bcm_host.h" ],
- "main": "vc_dispmanx_display_open(0);"
- },
- "use": "egl bcm_host"
- },
- "egl-egldevice": {
- "label": "EGLDevice",
- "type": "compile",
- "test": {
- "include": [ "EGL/egl.h", "EGL/eglext.h" ],
- "main": [
- "EGLDeviceEXT device = 0;",
- "EGLStreamKHR stream = 0;",
- "EGLOutputLayerEXT layer = 0;",
- "(void) EGL_DRM_CRTC_EXT;"
- ]
- },
- "use": "egl"
- },
- "egl-mali": {
- "label": "Mali EGL",
- "type": "compile",
- "test": {
- "include": [ "EGL/fbdev_window.h", "EGL/egl.h", "GLES2/gl2.h" ],
- "main": "fbdev_window *w = 0;"
- },
- "use": "egl"
- },
- "egl-mali-2": {
- "label": "Mali 2 EGL",
- "type": "compile",
- "test": {
- "include": [ "EGL/egl.h", "GLES2/gl2.h" ],
- "main": "mali_native_window *w = 0;"
- },
- "use": "egl"
- },
- "egl-viv": {
- "label": "i.Mx6 EGL",
- "type": "compile",
- "test": {
- "include": [ "EGL/egl.h", "EGL/eglvivante.h" ],
- "main": [
- "#ifdef __INTEGRITY",
- "fbGetDisplay();",
- "#else",
- "// Do not rely on fbGetDisplay(), since the signature has changed over time.",
- "// Stick to fbGetDisplayByIndex().",
- "fbGetDisplayByIndex(0);",
- "#endif"
- ],
- "qmake": [
- "DEFINES += EGL_API_FB=1",
- "!integrity: DEFINES += LINUX=1"
- ]
- },
- "use": "egl"
- },
- "egl-openwfd": {
- "label": "OpenWFD EGL",
- "type": "compile",
- "test": {
- "include": [ "wfd.h" ],
- "main": [
- "wfdEnumerateDevices(nullptr, 0, nullptr);"
- ]
- },
- "use": "egl"
- },
- "egl-rcar": {
- "label": "RCAR EGL",
- "type": "compile",
- "test": {
- "include": [ "EGL/egl.h" ],
- "tail": [
- "extern \"C\" {",
- "extern unsigned long PVRGrfxServerInit(void);",
- "}"
- ],
- "main": [
- "PVRGrfxServerInit();"
- ]
- },
- "use": "egl opengl_es2"
- },
- "evdev": {
- "label": "evdev",
- "type": "compile",
- "test": {
- "head": [
- "#if defined(__FreeBSD__)",
- "# include <dev/evdev/input.h>",
- "#else",
- "# include <linux/input.h>",
- "# include <linux/kd.h>",
- "#endif",
- "enum {",
- " e1 = ABS_PRESSURE,",
- " e2 = ABS_X,",
- " e3 = REL_X,",
- " e4 = SYN_REPORT,",
- "};"
- ],
- "main": [
- "input_event buf[32];",
- "(void) buf;"
- ]
- }
- },
- "integrityfb": {
- "label": "INTEGRITY framebuffer",
- "type": "compile",
- "test": {
- "include": "device/fbdriver.h",
- "main": "FBDriver *driver = 0;"
- }
- },
- "libinput_axis_api": {
- "label": "axis API in libinput",
- "type": "compile",
- "test": {
- "include": "libinput.h",
- "main": "libinput_event_pointer_has_axis(nullptr, LIBINPUT_POINTER_AXIS_SCROLL_VERTICAL);"
- },
- "use": "libinput"
- },
- "linuxfb": {
- "label": "LinuxFB",
- "type": "compile",
- "test": {
- "include": [ "linux/fb.h", "sys/kd.h", "sys/ioctl.h" ],
- "main": [
- "fb_fix_screeninfo finfo;",
- "fb_var_screeninfo vinfo;",
- "int fd = 3;",
- "ioctl(fd, FBIOGET_FSCREENINFO, &finfo);",
- "ioctl(fd, FBIOGET_VSCREENINFO, &vinfo);"
- ]
- }
- },
- "opengles3": {
- "label": "OpenGL ES 3.0",
- "type": "compile",
- "test": {
- "head": [
- "#ifdef __APPLE__",
- "# include <OpenGLES/ES3/gl.h>",
- "#else",
- "# define GL_GLEXT_PROTOTYPES",
- "# include <GLES3/gl3.h>",
- "#endif"
- ],
- "main": [
- "static GLfloat f[6];",
- "glGetStringi(GL_EXTENSIONS, 0);",
- "glReadBuffer(GL_COLOR_ATTACHMENT1);",
- "glUniformMatrix2x3fv(0, 0, GL_FALSE, f);",
- "glMapBufferRange(GL_ARRAY_BUFFER, 0, 0, GL_MAP_READ_BIT);"
- ]
- },
- "comment": [
- "The library is expected to be the same as in ES 2.0 (libGLESv2).",
- "The difference is the header and the presence of the functions in",
- "the library."
- ],
- "use": "opengl_es2"
- },
- "opengles31": {
- "label": "OpenGL ES 3.1",
- "type": "compile",
- "test": {
- "include": "GLES3/gl31.h",
- "main": [
- "glDispatchCompute(1, 1, 1);",
- "glProgramUniform1i(0, 0, 0);"
- ]
- },
- "use": "opengl_es2"
- },
- "opengles32": {
- "label": "OpenGL ES 3.2",
- "type": "compile",
- "test": {
- "include": "GLES3/gl32.h",
- "main": "glFramebufferTexture(GL_TEXTURE_2D, GL_DEPTH_STENCIL_ATTACHMENT, 1, 0);"
- },
- "use": "opengl_es2"
- },
- "qpa_default_platform": {
- "label": "default QPA platform",
- "type": "qpaDefaultPlatform",
- "log": "value"
- },
- "xcb_syslibs": {
- "label": "XCB (extensions)",
- "type": "compile",
- "test": {
- "head": [
- "// xkb.h is using a variable called 'explicit', which is a reserved keyword in C++",
- "#define explicit dont_use_cxx_explicit"
- ],
- "tail": "#undef explicit",
- "include": [
- "xcb/xcb.h",
- "xcb/xcb_image.h",
- "xcb/xcb_keysyms.h",
- "xcb/randr.h",
- "xcb/render.h",
- "xcb/shape.h",
- "xcb/shm.h",
- "xcb/sync.h",
- "xcb/xfixes.h",
- "xcb/xinerama.h",
- "xcb/xcb_icccm.h",
- "xcb/xcb_renderutil.h",
- "xcb/xkb.h"
- ],
- "main": [
- "int primaryScreen = 0;",
- "xcb_connection_t *c = xcb_connect(\"\", &primaryScreen);",
-
- "/* RENDER */",
- "xcb_generic_error_t *error = nullptr;",
- "xcb_render_query_pict_formats_cookie_t formatsCookie =",
- " xcb_render_query_pict_formats(c);",
- "xcb_render_query_pict_formats_reply_t *formatsReply =",
- " xcb_render_query_pict_formats_reply(c, formatsCookie, &error);",
-
- "/* RENDERUTIL: xcb_renderutil.h include won't compile unless version >= 0.3.9 */",
- "xcb_render_util_find_standard_format(nullptr, XCB_PICT_STANDARD_ARGB_32);",
-
- "/* XKB: This takes more arguments in xcb-xkb < 1.11 */",
- "xcb_xkb_get_kbd_by_name_replies_key_names_value_list_sizeof(nullptr, 0, 0, 0, 0, 0, 0, 0, 0);"
- ]
- },
- "use": "xcb_icccm xcb_image xcb_keysyms xcb_randr xcb_render xcb_renderutil xcb_shape xcb_shm xcb_sync xcb_xfixes xcb_xinerama xcb_xkb xcb"
- },
- "x11prefix": {
- "label": "X11 prefix",
- "type": "getPkgConfigVariable",
- "pkg-config-args": "x11",
- "pkg-config-variable": "prefix",
- "value": "/usr",
- "log": "value"
- }
- },
-
- "features": {
- "accessibility-atspi-bridge": {
- "label": "ATSPI Bridge",
- "condition": "features.accessibility && features.xcb && features.dbus && libs.atspi",
- "output": [ "privateFeature", "feature" ]
- },
- "angle": {
- "label": "ANGLE",
- "autoDetect": "features.opengles2 || features.opengl-dynamic",
- "condition": "!features.opengl-desktop && features.dxguid && tests.fxc && (features.direct3d9 || (config.winrt && features.direct3d11 && libs.d3dcompiler))",
- "output": [
- "publicFeature",
- { "type": "define", "name": "QT_OPENGL_ES_2_ANGLE" },
- { "type": "varAssign", "name": "QMAKE_FXC_LOCATION", "value": "tests.fxc.value" }
- ]
- },
- "angle_d3d11_qdtd": {
- "label": "D3D11_QUERY_DATA_TIMESTAMP_DISJOINT",
- "condition": "features.angle && tests.angle_d3d11_qdtd",
- "output": [ "privateFeature" ]
- },
- "combined-angle-lib": {
- "label": "Combined ANGLE Library",
- "autoDetect": false,
- "condition": "features.angle",
- "output": [ "publicFeature" ]
- },
- "directfb": {
- "label": "DirectFB",
- "section": "Platform plugins",
- "autoDetect": false,
- "condition": "libs.directfb",
- "output": [ "privateFeature" ]
- },
- "directwrite": {
- "label": "DirectWrite",
- "emitIf": "config.win32",
- "condition": "libs.dwrite",
- "output": [ "privateFeature" ]
- },
- "directwrite1": {
- "label": "DirectWrite 1",
- "emitIf": "config.win32",
- "condition": "libs.dwrite_1",
- "output": [ "privateFeature" ]
- },
- "directwrite2": {
- "label": "DirectWrite 2",
- "emitIf": "config.win32",
- "condition": "features.directwrite1 && libs.dwrite_2",
- "output": [ "privateFeature" ]
- },
- "dxguid": {
- "label": "DirectX GUID",
- "condition": "config.win32 && libs.dxguid",
- "output": [ "privateFeature" ]
- },
- "direct3d9": {
- "label": "Direct 3D 9",
- "condition": "config.win32 && !config.winrt && libs.d3d9",
- "output": [ "privateFeature" ]
- },
- "dxgi": {
- "label": "DirectX GI",
- "condition": "config.win32 && libs.dxgi",
- "output": [ "privateFeature" ]
- },
- "dxgi1_2": {
- "label": "DirectX GI 1.2",
- "condition": "features.dxgi && libs.dxgi1_2",
- "output": [ "privateFeature" ]
- },
- "direct3d11": {
- "label": "Direct 3D 11",
- "condition": "features.dxgi && libs.d3d11",
- "output": [ "privateFeature" ]
- },
- "direct3d11_1": {
- "label": "Direct 3D 11.1",
- "condition": "features.direct3d11 && features.dxgi1_2 && libs.d3d11_1",
- "output": [ "privateFeature" ]
- },
- "direct2d": {
- "label": "Direct 2D",
- "condition": "config.win32 && !config.winrt && features.direct3d11 && libs.d2d1",
- "output": [ "privateFeature" ]
- },
- "direct2d1_1": {
- "label": "Direct 2D 1.1",
- "condition": "features.direct2d && libs.d2d1_1",
- "output": [ "privateFeature" ]
- },
- "evdev": {
- "label": "evdev",
- "condition": "features.thread && tests.evdev",
- "output": [ "privateFeature" ]
- },
- "freetype": {
- "label": "FreeType",
- "purpose": "Supports the FreeType 2 font engine (and its supported font formats).",
- "section": "Fonts",
- "output": [ "privateFeature", "feature" ]
- },
- "system-freetype": {
- "label": " Using system FreeType",
- "enable": "input.freetype == 'system'",
- "disable": "input.freetype == 'qt'",
- "autoDetect": "!config.msvc",
- "condition": "features.freetype && libs.freetype",
- "output": [ "privateFeature" ]
- },
- "fontconfig": {
- "label": "Fontconfig",
- "autoDetect": "!config.darwin",
- "condition": "!config.msvc && features.system-freetype && libs.fontconfig",
- "output": [ "privateFeature", "feature" ]
- },
- "gbm": {
- "label": "GBM",
- "condition": "libs.gbm",
- "output": [ "publicQtConfig" ]
- },
- "harfbuzz": {
- "label": "HarfBuzz",
- "output": [ "privateFeature", "feature" ]
- },
- "system-harfbuzz": {
- "label": " Using system HarfBuzz",
- "enable": "input.harfbuzz == 'system'",
- "disable": "input.harfbuzz == 'qt'",
- "autoDetect": "!config.darwin && !config.win32",
- "condition": "features.harfbuzz && libs.harfbuzz",
- "output": [ "privateFeature" ]
- },
- "qqnx_imf": {
- "label": "IMF",
- "emitIf": "config.qnx",
- "condition": "libs.imf",
- "output": [ "privateFeature" ]
- },
- "integrityfb": {
- "label": "INTEGRITY framebuffer",
- "section": "Platform plugins",
- "condition": "config.integrity && tests.integrityfb",
- "output": [ "privateFeature" ]
- },
- "kms": {
- "label": "KMS",
- "condition": "libs.drm",
- "output": [ "publicQtConfig", "privateFeature" ]
- },
- "drm_atomic": {
- "label": "DRM Atomic API",
- "condition": "libs.drm && tests.drm_atomic",
- "output": [ "privateFeature" ]
- },
- "libinput": {
- "label": "libinput",
- "condition": "features.libudev && libs.libinput",
- "output": [ "privateFeature" ]
- },
- "integrityhid": {
- "label": "INTEGRITY HID",
- "condition": "config.integrity && libs.integrityhid",
- "output": [ "privateFeature" ]
- },
- "libinput-axis-api": {
- "label": "axis API in libinput",
- "condition": "features.libinput && tests.libinput_axis_api",
- "output": [ "privateFeature" ]
- },
- "lgmon": {
- "label": "lgmon",
- "emitIf": "config.qnx",
- "condition": "libs.lgmon",
- "output": [ "privateConfig" ]
- },
- "linuxfb": {
- "label": "LinuxFB",
- "section": "Platform plugins",
- "condition": "tests.linuxfb && features.regularexpression",
- "output": [ "privateFeature" ]
- },
- "vsp2": {
- "label": "VSP2",
- "condition": "libs.v4l2",
- "autoDetect": false,
- "output": [ "privateFeature" ]
- },
- "vnc": {
- "label": "VNC",
- "section": "Platform plugins",
- "condition": [
- "config.unix && !config.android && !config.darwin",
- "features.regularexpression && features.network"
- ],
- "output": [ "privateFeature" ]
- },
- "mtdev": {
- "label": "mtdev",
- "condition": "libs.mtdev",
- "output": [ "privateFeature" ]
- },
- "opengles2": {
- "label": "OpenGL ES 2.0",
- "enable": "input.opengl == 'es2' || input.angle == 'yes'",
- "disable": "input.opengl == 'desktop' || input.opengl == 'dynamic' || input.opengl == 'no'",
- "condition": "(config.win32 && !features.opengl-dynamic) || (!config.watchos && !features.opengl-desktop && libs.opengl_es2)",
- "output": [
- "publicFeature",
- "publicQtConfig",
- { "type": "define", "name": "QT_OPENGL_ES" },
- { "type": "define", "name": "QT_OPENGL_ES_2" }
- ]
- },
- "opengles3": {
- "label": "OpenGL ES 3.0",
- "condition": "features.opengles2 && !features.angle && tests.opengles3",
- "output": [
- "publicFeature",
- { "type": "define", "name": "QT_OPENGL_ES_3" }
- ]
- },
- "opengles31": {
- "label": "OpenGL ES 3.1",
- "condition": "features.opengles3 && tests.opengles31",
- "output": [
- "publicFeature",
- { "type": "define", "name": "QT_OPENGL_ES_3_1" }
- ]
- },
- "opengles32": {
- "label": "OpenGL ES 3.2",
- "condition": "features.opengles31 && tests.opengles32",
- "output": [
- "publicFeature",
- { "type": "define", "name": "QT_OPENGL_ES_3_2" }
- ]
- },
- "opengl-desktop": {
- "label": "Desktop OpenGL",
- "autoDetect": "!config.win32",
- "enable": "input.opengl == 'desktop'",
- "disable": "input.opengl == 'es2' || input.opengl == 'dynamic' || input.opengl == 'no'",
- "condition": "(config.win32 && !config.winrt && !features.opengles2 && (config.msvc || libs.opengl))
- || (!config.watchos && !config.win32 && !config.wasm && libs.opengl)"
- },
- "opengl-dynamic": {
- "label": "Dynamic OpenGL",
- "disable": "input.angle == 'yes' || input.opengl == 'no' || input.opengl == 'desktop'",
- "condition": "config.win32 && !config.winrt",
- "output": [
- { "type": "publicFeature", "name": "dynamicgl" },
- { "type": "define", "name": "QT_OPENGL_DYNAMIC" }
- ]
- },
- "opengl": {
- "label": "OpenGL",
- "condition": "features.opengl-desktop || features.opengl-dynamic || features.opengles2",
- "output": [ "publicFeature", "feature" ]
- },
- "vkgen": {
- "label": "vkgen",
- "condition": "features.xmlstreamreader",
- "output": [ "privateFeature" ]
- },
- "vulkan": {
- "label": "Vulkan",
- "condition": "features.vkgen && libs.vulkan",
- "output": [ "publicFeature" ]
- },
- "openvg": {
- "label": "OpenVG",
- "condition": "libs.openvg",
- "output": [ "publicFeature" ]
- },
- "egl": {
- "label": "EGL",
- "condition": "(features.opengl || features.openvg) && (features.angle || libs.egl) && (features.dlopen || !config.unix || config.integrity)",
- "output": [ "privateFeature", "feature" ]
- },
- "egl_x11": {
- "label": "EGL on X11",
- "condition": "features.thread && features.egl && tests.egl-x11",
- "output": [ "privateFeature" ]
- },
- "eglfs": {
- "label": "EGLFS",
- "section": "Platform plugins",
- "condition": "!config.android && !config.darwin && !config.win32 && !config.wasm && features.egl",
- "output": [ "privateFeature" ]
- },
- "eglfs_brcm": {
- "label": "EGLFS Raspberry Pi",
- "condition": "features.eglfs && tests.egl-brcm",
- "output": [ "privateFeature" ]
- },
- "eglfs_egldevice": {
- "label": "EGLFS EGLDevice",
- "condition": "features.eglfs && tests.egl-egldevice && features.kms",
- "output": [ "privateFeature" ]
- },
- "eglfs_gbm": {
- "label": "EGLFS GBM",
- "condition": "features.eglfs && features.gbm && features.kms",
- "output": [ "privateFeature" ]
- },
- "eglfs_vsp2": {
- "label": "EGLFS VSP2",
- "condition": "features.eglfs && features.gbm && features.kms && features.vsp2",
- "output": [ "privateFeature" ]
- },
- "eglfs_mali": {
- "label": "EGLFS Mali",
- "condition": "features.eglfs && (tests.egl-mali || tests.egl-mali-2)",
- "output": [ "privateFeature" ]
- },
- "eglfs_viv": {
- "label": "EGLFS i.Mx6",
- "condition": "features.eglfs && tests.egl-viv",
- "output": [ "privateFeature" ]
- },
- "eglfs_rcar": {
- "label": "EGLFS RCAR",
- "condition": "config.integrity && features.eglfs && tests.egl-rcar",
- "output": [ "privateFeature" ]
- },
- "eglfs_viv_wl": {
- "label": "EGLFS i.Mx6 Wayland",
- "condition": "features.eglfs_viv && libs.wayland_server",
- "output": [ "privateFeature" ]
- },
- "eglfs_openwfd": {
- "label": "EGLFS OpenWFD",
- "condition": "config.integrity && features.eglfs && tests.egl-openwfd",
- "output": [ "privateFeature" ]
- },
- "eglfs_x11": {
- "label": "EGLFS X11",
- "condition": "features.eglfs && features.xcb-xlib && features.egl_x11",
- "output": [ "privateFeature" ]
- },
- "gif": {
- "label": "GIF",
- "condition": "features.imageformatplugin",
- "output": [
- "privateFeature",
- { "type": "define", "negative": true, "name": "QT_NO_IMAGEFORMAT_GIF" }
- ]
- },
- "ico": {
- "label": "ICO",
- "condition": "features.imageformatplugin",
- "output": [ "privateFeature", "feature" ]
- },
- "jpeg": {
- "label": "JPEG",
- "disable": "input.libjpeg == 'no'",
- "condition": "features.imageformatplugin",
- "output": [
- "privateFeature",
- { "type": "define", "negative": true, "name": "QT_NO_IMAGEFORMAT_JPEG" }
- ]
- },
- "system-jpeg": {
- "label": " Using system libjpeg",
- "disable": "input.libjpeg == 'qt'",
- "enable": "input.libjpeg == 'system'",
- "condition": "features.jpeg && libs.libjpeg",
- "output": [ "privateFeature" ]
- },
- "png": {
- "label": "PNG",
- "disable": "input.libpng == 'no'",
- "output": [
- "privateFeature",
- { "type": "define", "negative": true, "name": "QT_NO_IMAGEFORMAT_PNG" }
- ]
- },
- "system-png": {
- "label": " Using system libpng",
- "disable": "input.libpng == 'qt'",
- "enable": "input.libpng == 'system'",
- "autoDetect": "features.system-zlib",
- "condition": "features.png && libs.libpng",
- "output": [ "privateFeature" ]
- },
- "qpa_default_platform": {
- "label": "QPA default platform",
- "condition": "features.gui",
- "output": [
- { "type": "define", "name": "QT_QPA_DEFAULT_PLATFORM_NAME", "value": "tests.qpa_default_platform.name" },
- { "type": "varAssign", "public": true, "name": "QT_DEFAULT_QPA_PLUGIN", "value": "tests.qpa_default_platform.plugin",
- "condition": "!features.shared" }
- ]
- },
- "sessionmanager": {
- "label": "Session Management",
- "purpose": "Provides an interface to the windowing system's session management.",
- "section": "Kernel",
- "output": [ "publicFeature", "feature" ]
- },
- "tslib": {
- "label": "tslib",
- "condition": "libs.tslib",
- "output": [ "privateFeature" ]
- },
- "tuiotouch": {
- "label": "TuioTouch",
- "purpose": "Provides the TuioTouch input plugin.",
- "condition": "features.network && features.udpsocket",
- "output": [ "privateFeature" ]
- },
- "xcb": {
- "label": "XCB",
- "section": "Platform plugins",
- "autoDetect": "!config.darwin",
- "condition": "features.thread && libs.xcb && tests.xcb_syslibs && features.xkbcommon-x11",
- "output": [ "privateFeature" ]
- },
- "x11-prefix": {
- "label": "X11 prefix",
- "emitIf": "features.xcb",
- "output": [ { "type": "varAssign", "name": "QMAKE_X11_PREFIX", "value": "tests.x11prefix.value" } ]
- },
- "xcb-glx-plugin": {
- "label": "GLX Plugin",
- "emitIf": "features.xcb",
- "condition": "features.xcb-xlib && features.opengl && !features.opengles2",
- "output": [ "privateFeature" ]
- },
- "xcb-glx": {
- "label": " XCB GLX",
- "emitIf": "features.xcb && features.xcb-glx-plugin",
- "condition": "libs.xcb_glx",
- "output": [ "privateFeature" ]
- },
- "xcb-egl-plugin": {
- "label": "EGL-X11 Plugin",
- "emitIf": "features.xcb",
- "condition": "features.egl_x11 && features.opengl",
- "output": [ "privateFeature" ]
- },
- "xcb-native-painting": {
- "label": "Native painting (experimental)",
- "autoDetect": false,
- "emitIf": "features.xcb",
- "condition": "features.xcb-xlib && features.fontconfig && libs.xrender",
- "output": [ "privateFeature" ]
- },
- "xrender": {
- "label": "XRender for native painting",
- "emitIf": "features.xcb && features.xcb-native-painting",
- "condition": "features.xcb-native-painting",
- "output": [ "privateFeature" ]
- },
- "xcb-xlib": {
- "label": "XCB Xlib",
- "condition": "features.xlib && libs.xcb_xlib",
- "output": [ "privateFeature" ]
- },
- "xcb-sm": {
- "label": "xcb-sm",
- "emitIf": "features.xcb",
- "condition": "features.sessionmanager && libs.x11sm",
- "output": [ "privateFeature" ]
- },
- "system-xcb-xinput": {
- "label": "Using system-provided xcb-xinput",
- "emitIf": "features.xcb",
- "disable": "input.bundled-xcb-xinput == 'yes'",
- "enable": "input.bundled-xcb-xinput == 'no'",
- "condition": "libs.xcb_xinput",
- "output": [ "privateFeature" ]
- },
- "xkbcommon": {
- "label": "xkbcommon",
- "condition": "libs.xkbcommon",
- "output": [ "privateFeature" ]
- },
- "xkbcommon-x11": {
- "label": "xkbcommon-x11",
- "condition": "features.xkbcommon && libs.xkbcommon_x11",
- "output": [ "privateFeature" ]
- },
- "xlib": {
- "label": "XLib",
- "autoDetect": "!config.darwin || features.xcb",
- "condition": "libs.xlib",
- "output": [ "privateFeature" ]
- },
- "texthtmlparser": {
- "label": "HtmlParser",
- "purpose": "Provides a parser for HTML.",
- "section": "Kernel",
- "output": [ "publicFeature", "feature" ]
- },
- "textmarkdownreader": {
- "label": "MarkdownReader",
- "disable": "input.libmd4c == 'no'",
- "enable": "input.libmd4c == 'system' || input.libmd4c == 'qt' || input.libmd4c == 'yes'",
- "purpose": "Provides a Markdown (CommonMark and GitHub) reader",
- "section": "Kernel",
- "output": [ "publicFeature" ]
- },
- "system-textmarkdownreader": {
- "label": " Using system libmd4c",
- "disable": "input.libmd4c == 'qt'",
- "enable": "input.libmd4c == 'system'",
- "section": "Kernel",
- "condition": "libs.libmd4c",
- "output": [ "publicFeature" ]
- },
- "textmarkdownwriter": {
- "label": "MarkdownWriter",
- "purpose": "Provides a Markdown (CommonMark) writer",
- "section": "Kernel",
- "output": [ "publicFeature" ]
- },
- "textodfwriter": {
- "label": "OdfWriter",
- "purpose": "Provides an ODF writer.",
- "section": "Kernel",
- "condition": "features.xmlstreamwriter",
- "output": [ "publicFeature", "feature" ]
- },
- "cssparser": {
- "label": "CssParser",
- "purpose": "Provides a parser for Cascading Style Sheets.",
- "section": "Kernel",
- "output": [ "publicFeature", "feature" ]
- },
- "draganddrop": {
- "label": "Drag and Drop",
- "purpose": "Supports the drag and drop mechansim.",
- "section": "Kernel",
- "condition": "features.imageformat_xpm",
- "output": [ "publicFeature", "feature" ]
- },
- "action": {
- "label": "Q(Gui)Action(Group)",
- "purpose": "Provides abstract user interface actions.",
- "section": "Kernel",
- "output": [ "publicFeature", "feature" ]
- },
- "cursor": {
- "label": "QCursor",
- "purpose": "Provides mouse cursors.",
- "section": "Kernel",
- "output": [ "publicFeature", "feature" ]
- },
- "clipboard": {
- "label": "QClipboard",
- "purpose": "Provides cut and paste operations.",
- "section": "Kernel",
- "condition": "!config.integrity && !config.qnx && !config.rtems",
- "output": [ "publicFeature", "feature" ]
- },
- "wheelevent": {
- "label": "QWheelEvent",
- "purpose": "Supports wheel events.",
- "section": "Kernel",
- "output": [ "publicFeature", "feature" ]
- },
- "tabletevent": {
- "label": "QTabletEvent",
- "purpose": "Supports tablet events.",
- "section": "Kernel",
- "output": [ "publicFeature", "feature" ]
- },
- "im": {
- "label": "QInputContext",
- "purpose": "Provides complex input methods.",
- "section": "Kernel",
- "condition": "features.library",
- "output": [ "publicFeature", "feature" ]
- },
- "highdpiscaling": {
- "label": "High DPI Scaling",
- "purpose": "Provides automatic scaling of DPI-unaware applications on high-DPI displays.",
- "section": "Kernel",
- "output": [ "publicFeature", "feature" ]
- },
- "validator": {
- "label": "QValidator",
- "purpose": "Supports validation of input text.",
- "section": "Widgets",
- "output": [ "publicFeature", "feature" ]
- },
- "standarditemmodel": {
- "label": "QStandardItemModel",
- "purpose": "Provides a generic model for storing custom data.",
- "section": "ItemViews",
- "condition": "features.itemmodel",
- "output": [ "publicFeature", "feature" ]
- },
- "imageformatplugin": {
- "label": "QImageIOPlugin",
- "purpose": "Provides a base for writing a image format plugins.",
- "section": "Images",
- "output": [ "publicFeature", "feature" ]
- },
- "movie": {
- "label": "QMovie",
- "purpose": "Supports animated images.",
- "section": "Images",
- "output": [ "publicFeature", "feature" ]
- },
- "imageformat_bmp": {
- "label": "BMP Image Format",
- "purpose": "Supports Microsoft's Bitmap image file format.",
- "section": "Images",
- "output": [ "publicFeature", "feature" ]
- },
- "imageformat_ppm": {
- "label": "PPM Image Format",
- "purpose": "Supports the Portable Pixmap image file format.",
- "section": "Images",
- "output": [ "publicFeature", "feature" ]
- },
- "imageformat_xbm": {
- "label": "XBM Image Format",
- "purpose": "Supports the X11 Bitmap image file format.",
- "section": "Images",
- "output": [ "publicFeature", "feature" ]
- },
- "imageformat_xpm": {
- "label": "XPM Image Format",
- "purpose": "Supports the X11 Pixmap image file format.",
- "section": "Images",
- "output": [ "publicFeature", "feature" ]
- },
- "imageformat_png": {
- "label": "PNG Image Format",
- "purpose": "Supports the Portable Network Graphics image file format.",
- "section": "Images",
- "output": [ "publicFeature", "feature" ]
- },
- "imageformat_jpeg": {
- "label": "JPEG Image Format",
- "purpose": "Supports the Joint Photographic Experts Group image file format.",
- "section": "Images",
- "output": [ "publicFeature", "feature" ]
- },
- "image_heuristic_mask": {
- "label": "QImage::createHeuristicMask()",
- "purpose": "Supports creating a 1-bpp heuristic mask for images.",
- "section": "Images",
- "output": [ "publicFeature", "feature" ]
- },
- "image_text": {
- "label": "Image Text",
- "purpose": "Supports image file text strings.",
- "section": "Images",
- "output": [ "publicFeature", "feature" ]
- },
- "picture": {
- "label": "QPicture",
- "purpose": "Supports recording and replaying QPainter commands.",
- "section": "Painting",
- "output": [ "publicFeature", "feature" ]
- },
- "colornames": {
- "label": "Color Names",
- "purpose": "Supports color names such as \"red\", used by QColor and by some HTML documents.",
- "section": "Painting",
- "output": [ "publicFeature", "feature" ]
- },
- "pdf": {
- "label": "QPdf",
- "purpose": "Provides a PDF backend for QPainter.",
- "section": "Painting",
- "condition": "features.temporaryfile",
- "output": [ "publicFeature", "feature" ]
- },
- "desktopservices": {
- "label": "QDesktopServices",
- "purpose": "Provides methods for accessing common desktop services.",
- "section": "Utilities",
- "output": [ "publicFeature", "feature" ]
- },
- "systemtrayicon": {
- "label": "QSystemTrayIcon",
- "purpose": "Provides an icon for an application in the system tray.",
- "section": "Utilities",
- "condition": "features.temporaryfile",
- "output": [ "publicFeature", "feature" ]
- },
- "accessibility": {
- "label": "Accessibility",
- "purpose": "Provides accessibility support.",
- "section": "Utilities",
- "condition": "features.properties",
- "output": [ "publicFeature", "feature" ]
- },
- "multiprocess": {
- "label": "Multi process",
- "purpose": "Provides support for detecting the desktop environment, launching external processes and opening URLs.",
- "section": "Utilities",
- "condition": "!config.integrity && !config.rtems",
- "output": [ "privateFeature" ]
- },
- "whatsthis": {
- "label": "QWhatsThis",
- "purpose": "Supports displaying \"What's this\" help.",
- "section": "Widget Support",
- "output": [ "publicFeature", "feature" ]
- },
- "raster-64bit": {
- "label": "QPainter - 64 bit raster",
- "purpose": "Internal painting support for 64 bit (16 bpc) rasterization.",
- "section": "Painting",
- "output": [ "privateFeature" ]
- }
- },
-
- "earlyReport": [
- {
- "type": "error",
- "condition": "input.xcb != '' && input.xcb != 'no' && input.xkbcommon == 'no'",
- "message": "XCB plugin requires xkbcommon and xkbcommon-x11, but -no-xkbcommon was provided."
- }
- ],
-
- "report": [
- {
- "type": "note",
- "condition": "features.xcb && config.darwin",
- "message": "XCB support on macOS is minimal and untested. Some features will
-not work properly or at all (e.g. OpenGL, desktop services or accessibility),
-or may depend on your system and XQuartz setup."
- },
- {
- "type": "note",
- "condition": "features.accessibility && features.xcb && !features.accessibility-atspi-bridge",
- "message": "Disabling X11 Accessibility Bridge: D-Bus or AT-SPI is missing."
- },
- {
- "type": "warning",
- "condition": "input.qpa-platform-guard != ''",
- "message": "The [-no]-qpa-platform-guard argument is deprecated and has no effect."
- },
- {
- "type": "warning",
- "condition": "features.gui && config.linux && !config.android && !features.xcb && !features.eglfs && !features.directfb && !features.linuxfb",
- "message": "No QPA platform plugin enabled! This will
-produce a Qt that cannot run GUI applications.
-See \"Platform backends\" in the output of --help."
- },
- {
- "type": "warning",
- "condition": "config.win32 && (features.opengles2 || features.opengl-dynamic) && !features.angle",
- "message": "Using OpenGL ES 2.0 on Windows without ANGLE.
-The build will most likely fail.
-Specify -opengl desktop to use regular OpenGL."
- },
- {
- "type": "warning",
- "condition": "config.darwin && features.system-harfbuzz",
- "message": "On OS X, AAT is supported only with -qt-harfbuzz."
- },
- {
- "type": "error",
- "condition": "features.gui && !config.watchos && input.opengl != 'no' && !features.opengl-desktop && !features.opengles2 && !features.opengl-dynamic",
- "message": "The OpenGL functionality tests failed!
-You might need to modify the include and library search paths by editing QMAKE_INCDIR_OPENGL[_ES2],
-QMAKE_LIBDIR_OPENGL[_ES2] and QMAKE_LIBS_OPENGL[_ES2] in the mkspec for your platform."
- },
- {
- "type": "warning",
- "condition": "!features.accessibility",
- "message": "Accessibility disabled. This configuration of Qt is unsupported."
- }
- ],
-
- "summary": [
- {
- "section": "Qt Gui",
- "entries": [
- "accessibility",
- "freetype",
- "system-freetype",
- "harfbuzz",
- "system-harfbuzz",
- "fontconfig",
- {
- "section": "Image formats",
- "entries": [
- "gif", "ico", "jpeg", "system-jpeg", "png", "system-png"
- ]
- },
- {
- "section": "Text formats",
- "entries": [
- "texthtmlparser", "cssparser", "textodfwriter", "textmarkdownreader", "system-textmarkdownreader", "textmarkdownwriter"
- ]
- },
- "egl",
- "openvg",
- {
- "section": "OpenGL",
- "entries": [
- {
- "type": "feature",
- "args": "angle",
- "condition": "config.win32"
- },
- {
- "type": "feature",
- "args": "combined-angle-lib",
- "condition": "features.angle"
- },
- "opengl-desktop",
- {
- "type": "feature",
- "args": "opengl-dynamic",
- "condition": "config.win32"
- },
- "opengles2",
- "opengles3",
- "opengles31",
- "opengles32"
- ]
- },
- "vulkan",
- "sessionmanager"
- ]
- },
- {
- "section": "Features used by QPA backends",
- "entries": [
- "evdev",
- "libinput",
- "integrityhid",
- "mtdev",
- "tslib",
- "xkbcommon",
- {
- "section": "X11 specific",
- "entries": [
- "xlib",
- "xcb-xlib",
- "egl_x11",
- "xkbcommon-x11"
- ]
- }
- ]
- },
- {
- "section": "QPA backends",
- "entries": [
- "directfb", "eglfs",
- {
- "section": "EGLFS details",
- "condition": "features.eglfs",
- "entries": [
- "eglfs_openwfd", "eglfs_viv", "eglfs_viv_wl", "eglfs_rcar", "eglfs_egldevice", "eglfs_gbm", "eglfs_vsp2", "eglfs_mali", "eglfs_brcm", "eglfs_x11"
- ]
- },
- "linuxfb", "vnc",
- {
- "type": "feature",
- "condition": "config.integrity",
- "args": "integrityfb"
- },
- {
- "section": "QNX",
- "condition": "config.qnx",
- "entries": [
- "lgmon", "qqnx_imf"
- ]
- },
- {
- "section": "XCB",
- "condition": "features.xcb",
- "entries": [
- "system-xcb-xinput", "xcb-native-painting",
- {
- "section": "GL integrations",
- "entries": [
- "xcb-glx-plugin",
- "xcb-glx",
- "xcb-egl-plugin"
- ]
- }
- ]
- },
- {
- "section": "Windows",
- "condition": "config.win32",
- "entries": [
- "direct2d", "directwrite", "directwrite2"
- ]
- }
- ]
- }
- ]
-}
diff --git a/src/gui/configure.pri b/src/gui/configure.pri
deleted file mode 100644
index 490ef0df28..0000000000
--- a/src/gui/configure.pri
+++ /dev/null
@@ -1,84 +0,0 @@
-# custom tests
-
-defineTest(qtConfLibrary_freetype) {
- input = $$eval($${2}.alias)
- isEmpty(config.input.$${input}.incdir) {
- TRY_INCLUDEPATHS = $$EXTRA_INCLUDEPATH $$QMAKE_INCDIR_X11
- haiku: TRY_INCLUDEPATHS += /system/develop/headers
- TRY_INCLUDEPATHS += $$QMAKE_DEFAULT_INCDIRS
- for (p, TRY_INCLUDEPATHS) {
- includedir = $$p/freetype2
- exists($$includedir) {
- config.input.$${input}.incdir = $$includedir
- export(config.input.$${input}.incdir)
- break()
- }
- }
- }
- qtConfLibrary_inline($$1, $$2): return(true)
- return(false)
-}
-
-# Check for Direct X shader compiler 'fxc'.
-# Up to Direct X SDK June 2010 and for MinGW, this is pointed to by the
-# DXSDK_DIR variable. Starting with Windows Kit 8, it is included in
-# the Windows SDK.
-defineTest(qtConfTest_fxc) {
- !mingw {
- fxc = $$qtConfFindInPath("fxc.exe")
- } else {
- equals(QMAKE_HOST.arch, x86_64): \
- fns = x64/fxc.exe
- else: \
- fns = x86/fxc.exe
- dxdir = $$(DXSDK_DIR)
- !isEmpty(dxdir) {
- fxc = $$dxdir/Utilities/bin/$$fns
- } else {
- winkitbindir = $$(WindowsSdkVerBinPath)
- !isEmpty(winkitbindir) {
- fxc = $$winkitbindir/$$fns
- } else {
- winkitdir = $$(WindowsSdkDir)
- !isEmpty(winkitdir): \
- fxc = $$winkitdir/bin/$$fns
- }
- }
- }
-
- !isEmpty(fxc):exists($$fxc) {
- $${1}.value = $$clean_path($$fxc)
- export($${1}.value)
- $${1}.cache += value
- export($${1}.cache)
- return(true)
- }
- return(false)
-}
-
-defineTest(qtConfTest_qpaDefaultPlatform) {
- name =
- !isEmpty(config.input.qpa_default_platform): name = $$config.input.qpa_default_platform
- else: !isEmpty(QT_QPA_DEFAULT_PLATFORM): name = $$QT_QPA_DEFAULT_PLATFORM
- else: winrt: name = winrt
- else: win32: name = windows
- else: android: name = android
- else: macos: name = cocoa
- else: if(ios|tvos): name = ios
- else: watchos: name = minimal
- else: qnx: name = qnx
- else: integrity: name = integrityfb
- else: haiku: name = haiku
- else: wasm: name = wasm
- else: name = xcb
-
- $${1}.value = $$name
- $${1}.plugin = q$$name
- $${1}.name = "\"$$name\""
- export($${1}.value)
- export($${1}.plugin)
- export($${1}.name)
- $${1}.cache += value plugin name
- export($${1}.cache)
- return(true)
-}
diff --git a/src/gui/doc/images/qpainter-concentriccircles.png b/src/gui/doc/images/qpainter-concentriccircles.png
index 4889dcd76d..d9489a4162 100644
--- a/src/gui/doc/images/qpainter-concentriccircles.png
+++ b/src/gui/doc/images/qpainter-concentriccircles.png
Binary files differ
diff --git a/src/gui/doc/includes/QtGuiDoc b/src/gui/doc/includes/QtGuiDoc
new file mode 100644
index 0000000000..e8fa73786e
--- /dev/null
+++ b/src/gui/doc/includes/QtGuiDoc
@@ -0,0 +1,23 @@
+#include <QtGui/QtGui>
+
+// vulkan
+#include <QtGui/QVulkanDeviceFunctions>
+#include <QtGui/QVulkanExtension>
+#include <QtGui/QVulkanFunctions>
+#include <QtGui/QVulkanInfoVector>
+#include <QtGui/QVulkanInstance>
+#include <QtGui/QVulkanLayer>
+#include <QtGui/QVulkanWindow>
+#include <QtGui/QVulkanWindowRenderer>
+
+// native platform interfaces
+#include <QtGui/qpa/qplatformmenu_p.h>
+#include <QtGui/qpa/qplatformwindow_p.h>
+#include <QtGui/qpa/qplatformscreen_p.h>
+#include <QtGui/private/qguiapplication_p.h>
+#include <QtGui/private/qkeymapper_p.h>
+
+// rhi
+#include <QtGui/rhi/qrhi.h>
+#include <QtGui/rhi/qshader.h>
+#include <QtGui/rhi/qshaderdescription.h>
diff --git a/src/gui/doc/includes/windows.h b/src/gui/doc/includes/windows.h
new file mode 100644
index 0000000000..b4824c2e93
--- /dev/null
+++ b/src/gui/doc/includes/windows.h
@@ -0,0 +1,22 @@
+// Copyright (C) 2020 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
+
+#pragma once
+
+//
+// W A R N I N G
+// -------------
+//
+// This file is not part of the Qt API. It exists purely as an
+// implementation detail. This header file may change from version to
+// version without notice, or even be removed.
+//
+// We mean it.
+//
+
+// Dummy declarations for generating docs on non-Windows platforms
+#if !defined(Q_OS_WIN) && defined(Q_QDOC)
+typedef struct _FORMATETC {} FORMATETC;
+typedef struct _STGMEDIUM {} STGMEDIUM;
+typedef void *IDataObject;
+#endif
diff --git a/src/gui/doc/qtgui.qdocconf b/src/gui/doc/qtgui.qdocconf
index 76dd6d7ea1..b94f11849c 100644
--- a/src/gui/doc/qtgui.qdocconf
+++ b/src/gui/doc/qtgui.qdocconf
@@ -5,6 +5,9 @@ project = QtGui
description = Qt GUI Reference Documentation
version = $QT_VERSION
+includepaths += ./includes
+moduleheader = QtGuiDoc
+
examplesinstallpath = gui
qhp.projects = QtGui
@@ -15,10 +18,6 @@ qhp.QtGui.virtualFolder = qtgui
qhp.QtGui.indexTitle = Qt GUI
qhp.QtGui.indexRoot =
-qhp.QtGui.filterAttributes = qtgui $QT_VERSION qtrefdoc
-qhp.QtGui.customFilters.Qt.name = QtGui $QT_VERSION
-qhp.QtGui.customFilters.Qt.filterAttributes = qtgui $QT_VERSION
-
qhp.QtGui.subprojects = classes
qhp.QtGui.subprojects.classes.title = C++ Classes
qhp.QtGui.subprojects.classes.indexTitle = Qt GUI C++ Classes
@@ -30,18 +29,20 @@ tagfile = ../../../doc/qtgui/qtgui.tags
depends += \
qtcore \
qtimageformats \
- qtmacextras \
- qtmultimedia \
qtnetwork \
qtopengl \
- qtplatformheaders \
+ qtprintsupport \
qtsvg \
qtqml \
qtquick \
qtwidgets \
qtdoc \
qmake \
- qttestlib
+ qtcmake \
+ qtshadertools \
+ qttestlib \
+ qtplatformintegration \
+ qthelp
headerdirs += ..
@@ -51,6 +52,7 @@ sourcedirs += .. \
exampledirs += ../../../examples/gui \
../../../examples/vulkan \
+ ../../widgets/doc/snippets \
snippets
imagedirs += images \
@@ -58,9 +60,10 @@ imagedirs += images \
../../../doc/src/images
# Included in qttestlib.qdocconf instead
-excludefiles += ../kernel/qtestsupport_gui.cpp
+excludefiles += ../kernel/qtestsupport_gui.cpp \
+ ../painting/qdrawhelper_ssse3.cpp
-manifestmeta.highlighted.names = "QtGui/Analog Clock Window Example"
+manifestmeta.highlighted.names = "QtGui/Hello Vulkan Cubes Example"
navigation.landingpage = "Qt GUI"
navigation.cppclassespage = "Qt GUI C++ Classes"
@@ -70,3 +73,7 @@ spurious += "Undocumented enum item '.*' in QGradient::Preset"
# \svgcolor {#ffdead}
macro.svgcolor.HTML = "<div style=\"padding:10px;color:#fff;background:\1;\"></div>"
+macro.svgcolor.DocBook = "<db:phrase role=\"color:\1\">&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;</db:phrase>"
+
+# Enforce zero documentation warnings
+warninglimit = 0
diff --git a/src/gui/doc/snippets/_clang-format b/src/gui/doc/snippets/_clang-format
new file mode 100644
index 0000000000..8e9b87bb47
--- /dev/null
+++ b/src/gui/doc/snippets/_clang-format
@@ -0,0 +1,2 @@
+# Ignore formatting of snippet code.
+DisableFormat: true
diff --git a/src/gui/doc/snippets/brush/brush.cpp b/src/gui/doc/snippets/brush/brush.cpp
index 505316e5e2..83b5e2108a 100644
--- a/src/gui/doc/snippets/brush/brush.cpp
+++ b/src/gui/doc/snippets/brush/brush.cpp
@@ -1,96 +1,24 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the documentation of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:BSD$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** BSD License Usage
-** Alternatively, you may use this file under the terms of the BSD license
-** as follows:
-**
-** "Redistribution and use in source and binary forms, with or without
-** modification, are permitted provided that the following conditions are
-** met:
-** * Redistributions of source code must retain the above copyright
-** notice, this list of conditions and the following disclaimer.
-** * Redistributions in binary form must reproduce the above copyright
-** notice, this list of conditions and the following disclaimer in
-** the documentation and/or other materials provided with the
-** distribution.
-** * Neither the name of The Qt Company Ltd nor the names of its
-** contributors may be used to endorse or promote products derived
-** from this software without specific prior written permission.
-**
-**
-** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause
+#include <QLinearGradient>
-#include <QtGui>
+namespace brush {
+void wrapper() {
-int main()
-{
- QWidget anyPaintDevice;
- {
- // PEN SNIPPET
- QPainter painter;
- QPen pen(Qt::red, 2); // red solid line, 2 pixels wide
- painter.begin(&anyPaintDevice); // paint something
- painter.setPen(pen); // set the red, wide pen
- painter.drawRect(40,30, 200,100); // draw a rectangle
- painter.setPen(Qt::blue); // set blue pen, 0 pixel width
- painter.drawLine(40,30, 240,130); // draw a diagonal in rectangle
- painter.end(); // painting done
- }
- {
- // BRUSH SNIPPET
- QPainter painter;
- QBrush brush(Qt::yellow); // yellow solid pattern
- painter.begin(&anyPaintDevice); // paint something
- painter.setBrush(brush); // set the yellow brush
- painter.setPen(Qt::NoPen); // do not draw outline
- painter.drawRect(40,30, 200,100); // draw filled rectangle
- painter.setBrush(Qt::NoBrush); // do not fill
- painter.setPen(Qt::black); // set black pen, 0 pixel width
- painter.drawRect(10,10, 30,20); // draw rectangle outline
- painter.end(); // painting done
- }
-
- // LINEAR
//! [0]
- QLinearGradient linearGrad(QPointF(100, 100), QPointF(200, 200));
- linearGrad.setColorAt(0, Qt::black);
- linearGrad.setColorAt(1, Qt::white);
+QLinearGradient linearGrad(QPointF(100, 100), QPointF(200, 200));
+linearGrad.setColorAt(0, Qt::black);
+linearGrad.setColorAt(1, Qt::white);
//! [0]
- // RADIAL
+
//! [1]
- QRadialGradient radialGrad(QPointF(100, 100), 100);
- radialGrad.setColorAt(0, Qt::red);
- radialGrad.setColorAt(0.5, Qt::blue);
- radialGrad.setColorAt(1, Qt::green);
+QRadialGradient radialGrad(QPointF(100, 100), 100);
+radialGrad.setColorAt(0, Qt::red);
+radialGrad.setColorAt(0.5, Qt::blue);
+radialGrad.setColorAt(1, Qt::green);
//! [1]
-}
+
+} // wrapper
+} // brush
diff --git a/src/gui/doc/snippets/brush/gradientcreationsnippet.cpp b/src/gui/doc/snippets/brush/gradientcreationsnippet.cpp
index 4bae7b755f..5f98df40f0 100644
--- a/src/gui/doc/snippets/brush/gradientcreationsnippet.cpp
+++ b/src/gui/doc/snippets/brush/gradientcreationsnippet.cpp
@@ -1,58 +1,11 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the documentation of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:BSD$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** BSD License Usage
-** Alternatively, you may use this file under the terms of the BSD license
-** as follows:
-**
-** "Redistribution and use in source and binary forms, with or without
-** modification, are permitted provided that the following conditions are
-** met:
-** * Redistributions of source code must retain the above copyright
-** notice, this list of conditions and the following disclaimer.
-** * Redistributions in binary form must reproduce the above copyright
-** notice, this list of conditions and the following disclaimer in
-** the documentation and/or other materials provided with the
-** distribution.
-** * Neither the name of The Qt Company Ltd nor the names of its
-** contributors may be used to endorse or promote products derived
-** from this software without specific prior written permission.
-**
-**
-** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause
-#include <QtGui>
+#include <QBrush>
-int main(int argv, char **args)
-{
- QApplication app(argv, args);
+namespace gradientcreationsnippet {
+
+void wrapper() {
//! [0]
QRadialGradient gradient(50, 50, 50, 50, 50);
@@ -62,11 +15,6 @@ int main(int argv, char **args)
QBrush brush(gradient);
//! [0]
- QWidget widget;
- QPalette palette;
- palette.setBrush(widget.backgroundRole(), brush);
- widget.setPalette(palette);
- widget.show();
+} // wrapper
- return app.exec();
-}
+} // gradientcreationsnippet
diff --git a/src/gui/doc/snippets/clipboard/clipboard.pro b/src/gui/doc/snippets/clipboard/clipboard.pro
deleted file mode 100644
index a26fea6b57..0000000000
--- a/src/gui/doc/snippets/clipboard/clipboard.pro
+++ /dev/null
@@ -1,3 +0,0 @@
-HEADERS = clipwindow.h
-SOURCES = clipwindow.cpp \
- main.cpp
diff --git a/src/gui/doc/snippets/clipboard/clipwindow.cpp b/src/gui/doc/snippets/clipboard/clipwindow.cpp
index d1b39070fa..4ed0c81f7f 100644
--- a/src/gui/doc/snippets/clipboard/clipwindow.cpp
+++ b/src/gui/doc/snippets/clipboard/clipwindow.cpp
@@ -1,54 +1,8 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the documentation of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:BSD$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** BSD License Usage
-** Alternatively, you may use this file under the terms of the BSD license
-** as follows:
-**
-** "Redistribution and use in source and binary forms, with or without
-** modification, are permitted provided that the following conditions are
-** met:
-** * Redistributions of source code must retain the above copyright
-** notice, this list of conditions and the following disclaimer.
-** * Redistributions in binary form must reproduce the above copyright
-** notice, this list of conditions and the following disclaimer in
-** the documentation and/or other materials provided with the
-** distribution.
-** * Neither the name of The Qt Company Ltd nor the names of its
-** contributors may be used to endorse or promote products derived
-** from this software without specific prior written permission.
-**
-**
-** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause
#include <QtWidgets>
+#include <QMimeData>
#include "clipwindow.h"
@@ -70,8 +24,6 @@ ClipWindow::ClipWindow(QWidget *parent)
connect(clipboard, &QClipboard::dataChanged,
this, &ClipWindow::updateClipboard);
//! [0]
- connect(mimeTypeCombo, QOverload<QString>::of(&QComboBox::activated),
- this, &ClipWindow::updateData);
QVBoxLayout *currentLayout = new QVBoxLayout(currentItem);
currentLayout->addWidget(mimeTypeLabel);
@@ -91,21 +43,26 @@ ClipWindow::ClipWindow(QWidget *parent)
//! [1]
void ClipWindow::updateClipboard()
{
+ mimeTypeCombo->clear();
+
QStringList formats = clipboard->mimeData()->formats();
- QByteArray data = clipboard->mimeData()->data(format);
+ if (formats.isEmpty())
+ return;
+
+ for (const auto &format : formats) {
+ QByteArray data = clipboard->mimeData()->data(format);
+ // ...
+ }
//! [1]
- mimeTypeCombo->clear();
- mimeTypeCombo->insertStringList(formats);
+ mimeTypeCombo->addItems(formats);
int size = clipboard->mimeData()->data(formats[0]).size();
QListWidgetItem *newItem = new QListWidgetItem(previousItems);
newItem->setText(tr("%1 (%2 bytes)").arg(formats[0]).arg(size));
updateData(formats[0]);
-//! [2]
}
-//! [2]
void ClipWindow::updateData(const QString &format)
{
diff --git a/src/gui/doc/snippets/clipboard/clipwindow.h b/src/gui/doc/snippets/clipboard/clipwindow.h
index 81e50a3c89..d22fd4f744 100644
--- a/src/gui/doc/snippets/clipboard/clipwindow.h
+++ b/src/gui/doc/snippets/clipboard/clipwindow.h
@@ -1,52 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the documentation of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:BSD$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** BSD License Usage
-** Alternatively, you may use this file under the terms of the BSD license
-** as follows:
-**
-** "Redistribution and use in source and binary forms, with or without
-** modification, are permitted provided that the following conditions are
-** met:
-** * Redistributions of source code must retain the above copyright
-** notice, this list of conditions and the following disclaimer.
-** * Redistributions in binary form must reproduce the above copyright
-** notice, this list of conditions and the following disclaimer in
-** the documentation and/or other materials provided with the
-** distribution.
-** * Neither the name of The Qt Company Ltd nor the names of its
-** contributors may be used to endorse or promote products derived
-** from this software without specific prior written permission.
-**
-**
-** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause
#ifndef CLIPWINDOW_H
#define CLIPWINDOW_H
@@ -65,7 +18,7 @@ class ClipWindow : public QMainWindow
Q_OBJECT
public:
- ClipWindow(QWidget *parent = 0);
+ explicit ClipWindow(QWidget *parent = nullptr);
public slots:
void updateClipboard();
diff --git a/src/gui/doc/snippets/clipboard/main.cpp b/src/gui/doc/snippets/clipboard/main.cpp
index 08d41df483..9d68f539d1 100644
--- a/src/gui/doc/snippets/clipboard/main.cpp
+++ b/src/gui/doc/snippets/clipboard/main.cpp
@@ -1,52 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the documentation of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:BSD$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** BSD License Usage
-** Alternatively, you may use this file under the terms of the BSD license
-** as follows:
-**
-** "Redistribution and use in source and binary forms, with or without
-** modification, are permitted provided that the following conditions are
-** met:
-** * Redistributions of source code must retain the above copyright
-** notice, this list of conditions and the following disclaimer.
-** * Redistributions in binary form must reproduce the above copyright
-** notice, this list of conditions and the following disclaimer in
-** the documentation and/or other materials provided with the
-** distribution.
-** * Neither the name of The Qt Company Ltd nor the names of its
-** contributors may be used to endorse or promote products derived
-** from this software without specific prior written permission.
-**
-**
-** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause
#include <QApplication>
diff --git a/src/gui/doc/snippets/code/doc_src_coordsys.cpp b/src/gui/doc/snippets/code/doc_src_coordsys.cpp
index 147c146b44..03da9ef31a 100644
--- a/src/gui/doc/snippets/code/doc_src_coordsys.cpp
+++ b/src/gui/doc/snippets/code/doc_src_coordsys.cpp
@@ -1,52 +1,20 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the documentation of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:BSD$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** BSD License Usage
-** Alternatively, you may use this file under the terms of the BSD license
-** as follows:
-**
-** "Redistribution and use in source and binary forms, with or without
-** modification, are permitted provided that the following conditions are
-** met:
-** * Redistributions of source code must retain the above copyright
-** notice, this list of conditions and the following disclaimer.
-** * Redistributions in binary form must reproduce the above copyright
-** notice, this list of conditions and the following disclaimer in
-** the documentation and/or other materials provided with the
-** distribution.
-** * Neither the name of The Qt Company Ltd nor the names of its
-** contributors may be used to endorse or promote products derived
-** from this software without specific prior written permission.
-**
-**
-** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause
+#include <QPainter>
+#include <QWidget>
+
+namespace doc_src_coordsys {
+struct SnippetWrappers : public QWidget
+{
+ void wrapper0();
+ void wrapper1();
+ void wrapper2();
+ void wrapper3();
+ void wrapper4();
+};
+
+
+void SnippetWrappers::wrapper0() {
//! [0]
QPainter painter(this);
@@ -56,6 +24,10 @@ painter.setPen(Qt::darkGreen);
painter.drawRect(1, 2, 6, 4);
//! [0]
+} // wrapper0
+
+
+void SnippetWrappers::wrapper1() {
//! [1]
QPainter painter(this);
@@ -64,6 +36,10 @@ painter.setPen(Qt::darkGreen);
painter.drawLine(2, 7, 6, 1);
//! [1]
+} // wrapper2
+
+
+void SnippetWrappers::wrapper2() {
//! [2]
QPainter painter(this);
@@ -74,6 +50,10 @@ painter.setPen(Qt::darkGreen);
painter.drawRect(1, 2, 6, 4);
//! [2]
+} // wrapper2
+
+
+void SnippetWrappers::wrapper3() {
//! [3]
QPainter painter(this);
@@ -83,6 +63,10 @@ painter.setPen(Qt::darkGreen);
painter.drawLine(2, 7, 6, 1);
//! [3]
+} // wrapper3
+
+
+void SnippetWrappers::wrapper4() {
//! [4]
QPainter painter(this);
@@ -91,9 +75,13 @@ painter.setWindow(QRect(-50, -50, 100, 100));
//! [5]
-int side = qMin(width(), height())
+int side = qMin(width(), height());
int x = (width() - side / 2);
int y = (height() - side / 2);
painter.setViewport(x, y, side, side);
//! [5]
+
+} // wrapper4
+
+} // doc_src_coordsys
diff --git a/src/gui/doc/snippets/code/doc_src_richtext.cpp b/src/gui/doc/snippets/code/doc_src_richtext.cpp
index fb7ab1b571..8d7e76503a 100644
--- a/src/gui/doc/snippets/code/doc_src_richtext.cpp
+++ b/src/gui/doc/snippets/code/doc_src_richtext.cpp
@@ -1,53 +1,11 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the documentation of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:BSD$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** BSD License Usage
-** Alternatively, you may use this file under the terms of the BSD license
-** as follows:
-**
-** "Redistribution and use in source and binary forms, with or without
-** modification, are permitted provided that the following conditions are
-** met:
-** * Redistributions of source code must retain the above copyright
-** notice, this list of conditions and the following disclaimer.
-** * Redistributions in binary form must reproduce the above copyright
-** notice, this list of conditions and the following disclaimer in
-** the documentation and/or other materials provided with the
-** distribution.
-** * Neither the name of The Qt Company Ltd nor the names of its
-** contributors may be used to endorse or promote products derived
-** from this software without specific prior written permission.
-**
-**
-** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause
+#include <QTextDocument>
+#include <QTextEdit>
+namespace doc_src_richtext {
+
+void wrapper() {
//! [0]
QTextDocument *newDocument = new QTextDocument;
//! [0]
@@ -57,8 +15,13 @@ QTextDocument *newDocument = new QTextDocument;
QTextEdit *editor = new QTextEdit;
QTextDocument *editorDocument = editor->document();
//! [1]
+Q_UNUSED(newDocument);
+Q_UNUSED(editorDocument);
+} // wrapper
-
+void wrapper2() {
+auto parent = new QTextEdit();
+QString aStringContainingHTMLtext;
//! [2]
QTextEdit *editor = new QTextEdit(parent);
editor->setHtml(aStringContainingHTMLtext);
@@ -69,7 +32,7 @@ editor->show();
//! [3]
QTextDocument *document = editor->document();
//! [3]
-
+Q_UNUSED(document);
//! [4]
QTextCursor cursor = editor->textCursor();
@@ -81,6 +44,9 @@ editor->setTextCursor(cursor);
//! [5]
+QTextEdit textEdit;
+QTextCursor textCursor;
+QString paragraphText;
//! [6]
textEdit.show();
@@ -93,3 +59,6 @@ for (int i = 0; i < 1000; ++i) {
textCursor.endEditBlock();
//! [6]
+
+} // wrapper2
+} // doc_src_richtext
diff --git a/src/gui/doc/snippets/code/doc_src_richtext.qdoc b/src/gui/doc/snippets/code/doc_src_richtext.qdoc
index 17faf1ac86..0c69514210 100644
--- a/src/gui/doc/snippets/code/doc_src_richtext.qdoc
+++ b/src/gui/doc/snippets/code/doc_src_richtext.qdoc
@@ -1,52 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the documentation of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:BSD$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** BSD License Usage
-** Alternatively, you may use this file under the terms of the BSD license
-** as follows:
-**
-** "Redistribution and use in source and binary forms, with or without
-** modification, are permitted provided that the following conditions are
-** met:
-** * Redistributions of source code must retain the above copyright
-** notice, this list of conditions and the following disclaimer.
-** * Redistributions in binary form must reproduce the above copyright
-** notice, this list of conditions and the following disclaimer in
-** the documentation and/or other materials provided with the
-** distribution.
-** * Neither the name of The Qt Company Ltd nor the names of its
-** contributors may be used to endorse or promote products derived
-** from this software without specific prior written permission.
-**
-**
-** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GFDL-1.3-no-invariants-only
//! [7]
<meta http-equiv="Content-Type" content="text/html; charset=EUC-JP" />
diff --git a/src/gui/doc/snippets/code/src_gui_accessible_qaccessible.cpp b/src/gui/doc/snippets/code/src_gui_accessible_qaccessible.cpp
index 2fd76d08c7..621d00a401 100644
--- a/src/gui/doc/snippets/code/src_gui_accessible_qaccessible.cpp
+++ b/src/gui/doc/snippets/code/src_gui_accessible_qaccessible.cpp
@@ -1,55 +1,16 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the documentation of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:BSD$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** BSD License Usage
-** Alternatively, you may use this file under the terms of the BSD license
-** as follows:
-**
-** "Redistribution and use in source and binary forms, with or without
-** modification, are permitted provided that the following conditions are
-** met:
-** * Redistributions of source code must retain the above copyright
-** notice, this list of conditions and the following disclaimer.
-** * Redistributions in binary form must reproduce the above copyright
-** notice, this list of conditions and the following disclaimer in
-** the documentation and/or other materials provided with the
-** distribution.
-** * Neither the name of The Qt Company Ltd nor the names of its
-** contributors may be used to endorse or promote products derived
-** from this software without specific prior written permission.
-**
-**
-** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause
+#include <QAccessible>
+
+namespace src_gui_accessible_qaccessible {
+class MyWidget
+{
+ void setFocus(Qt::FocusReason reason);
+};
+QAccessibleInterface *f = nullptr;
//! [1]
-typedef QAccessibleInterface* myFactoryFunction(const QString &key, QObject *);
+typedef QAccessibleInterface *myFactoryFunction(const QString &key, QObject *);
//! [1]
//! [2]
@@ -61,11 +22,4 @@ void MyWidget::setFocus(Qt::FocusReason reason)
}
//! [2]
-//! [3]
-void *QAccessibleLineEdit::interface_cast(QAccessible::InterfaceType t)
-{
- if (t == QAccessible::TextInterface)
- return static_cast<QAccessibleTextInterface*>(this);
- return QAccessibleWidget::interface_cast(t);
-}
-//! [3]
+} // src_gui_accessible_qaccessible
diff --git a/src/gui/doc/snippets/code/src_gui_image_qicon.cpp b/src/gui/doc/snippets/code/src_gui_image_qicon.cpp
index faad6574a7..a7f27a7fdd 100644
--- a/src/gui/doc/snippets/code/src_gui_image_qicon.cpp
+++ b/src/gui/doc/snippets/code/src_gui_image_qicon.cpp
@@ -1,84 +1,66 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the documentation of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:BSD$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** BSD License Usage
-** Alternatively, you may use this file under the terms of the BSD license
-** as follows:
-**
-** "Redistribution and use in source and binary forms, with or without
-** modification, are permitted provided that the following conditions are
-** met:
-** * Redistributions of source code must retain the above copyright
-** notice, this list of conditions and the following disclaimer.
-** * Redistributions in binary form must reproduce the above copyright
-** notice, this list of conditions and the following disclaimer in
-** the documentation and/or other materials provided with the
-** distribution.
-** * Neither the name of The Qt Company Ltd nor the names of its
-** contributors may be used to endorse or promote products derived
-** from this software without specific prior written permission.
-**
-**
-** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause
+#include <QIcon>
+#include <QPainter>
+#include <QToolButton>
+
+namespace src_gui_image_qicon {
+
+struct MyWidget : public QWidget
+{
+ void drawIcon(QPainter *painter, const QRect &rect);
+ bool isChecked() { return true; }
+ QIcon icon;
+};
+
+void wrapper0() {
//! [0]
QToolButton *button = new QToolButton;
-button->setIcon(QIcon("open.xpm"));
+button->setIcon(QIcon("open.png"));
//! [0]
+//! [addFile]
+QIcon openIcon("open.png");
+openIcon.addFile("open-disabled.png", QIcon::Disabled);
+//! [addFile]
//! [1]
button->setIcon(QIcon());
//! [1]
+} // wrapper0
+
//! [2]
-void MyWidget::drawIcon(QPainter *painter, QPoint pos)
+void MyWidget::drawIcon(QPainter *painter, const QRect &rect)
{
- QPixmap pixmap = icon.pixmap(QSize(22, 22),
- isEnabled() ? QIcon::Normal
- : QIcon::Disabled,
- isChecked() ? QIcon::On
- : QIcon::Off);
- painter->drawPixmap(pos, pixmap);
+ icon.paint(painter, rect, Qt::AlignCenter, isEnabled() ? QIcon::Normal
+ : QIcon::Disabled,
+ isChecked() ? QIcon::On
+ : QIcon::Off);
}
//! [2]
-//! [3]
- QIcon undoicon = QIcon::fromTheme("edit-undo");
-//! [3]
+
+void wrapper1() {
+
+//! [fromTheme]
+QIcon undoicon = QIcon::fromTheme(QIcon::ThemeIcon::EditUndo);
+//! [fromTheme]
+
+} // wrapper1
+
//! [4]
- QIcon undoicon = QIcon::fromTheme("edit-undo", QIcon(":/undo.png"));
+QIcon undoicon = QIcon::fromTheme(QIcon::ThemeIcon::EditUndo, QIcon(":/undo.png"));
//! [4]
+
+void wrapper2(){
//! [5]
- QIcon::setFallbackSearchPaths(QIcon::fallbackSearchPaths() << "my/search/path");
+QIcon::setFallbackSearchPaths(QIcon::fallbackSearchPaths() << "my/search/path");
//! [5]
+
+} // wrapper2
+} // src_gui_image_qicon
diff --git a/src/gui/doc/snippets/code/src_gui_image_qimage.cpp b/src/gui/doc/snippets/code/src_gui_image_qimage.cpp
index e4e641a5e0..759b085be4 100644
--- a/src/gui/doc/snippets/code/src_gui_image_qimage.cpp
+++ b/src/gui/doc/snippets/code/src_gui_image_qimage.cpp
@@ -1,53 +1,10 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the documentation of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:BSD$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** BSD License Usage
-** Alternatively, you may use this file under the terms of the BSD license
-** as follows:
-**
-** "Redistribution and use in source and binary forms, with or without
-** modification, are permitted provided that the following conditions are
-** met:
-** * Redistributions of source code must retain the above copyright
-** notice, this list of conditions and the following disclaimer.
-** * Redistributions in binary form must reproduce the above copyright
-** notice, this list of conditions and the following disclaimer in
-** the documentation and/or other materials provided with the
-** distribution.
-** * Neither the name of The Qt Company Ltd nor the names of its
-** contributors may be used to endorse or promote products derived
-** from this software without specific prior written permission.
-**
-**
-** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause
+#include <QImage>
+#include <QRgb>
+namespace src_gui_image_qimage {
+void wrapper0() {
//! [0]
QImage image(3, 3, QImage::Format_RGB32);
QRgb value;
@@ -63,6 +20,9 @@ value = qRgb(237, 187, 51); // 0xffedba31
image.setPixel(2, 1, value);
//! [0]
+} // wrapper0
+void wrapper1() {
+
//! [1]
QImage image(3, 3, QImage::Format_Indexed8);
@@ -88,5 +48,21 @@ image.setPixel(2, 1, 1);
static const char * const start_xpm[] = {
"16 15 8 1",
"a c #cec6bd",
-....
+ // etc.
+};
//! [2]
+
+
+//! [scanLine]
+for (int y = 0; y < image.height(); ++y) {
+ QRgb *line = reinterpret_cast<QRgb*>(image.scanLine(y));
+ for (int x = 0; x < image.width(); ++x) {
+ QRgb &rgb = line[x];
+ rgb = qRgba(qRed(rgb), qGreen(0), qBlue(rgb), qAlpha(rgb));
+ }
+}
+//! [scanLine]
+
+Q_UNUSED(start_xpm);
+} // wrapper1
+} // src_gui_image_qimage
diff --git a/src/gui/doc/snippets/code/src_gui_image_qimagereader.cpp b/src/gui/doc/snippets/code/src_gui_image_qimagereader.cpp
index ac26126758..c703cc580a 100644
--- a/src/gui/doc/snippets/code/src_gui_image_qimagereader.cpp
+++ b/src/gui/doc/snippets/code/src_gui_image_qimagereader.cpp
@@ -1,58 +1,18 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the documentation of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:BSD$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** BSD License Usage
-** Alternatively, you may use this file under the terms of the BSD license
-** as follows:
-**
-** "Redistribution and use in source and binary forms, with or without
-** modification, are permitted provided that the following conditions are
-** met:
-** * Redistributions of source code must retain the above copyright
-** notice, this list of conditions and the following disclaimer.
-** * Redistributions in binary form must reproduce the above copyright
-** notice, this list of conditions and the following disclaimer in
-** the documentation and/or other materials provided with the
-** distribution.
-** * Neither the name of The Qt Company Ltd nor the names of its
-** contributors may be used to endorse or promote products derived
-** from this software without specific prior written permission.
-**
-**
-** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause
+#include <QImage>
+#include <QImageReader>
+
+namespace src_gui_image_qimagereader {
+void wrapper0() {
//! [0]
QImageReader reader;
reader.setFormat("png"); // same as reader.setFormat("PNG");
//! [0]
+} // wrapper0
+
//! [1]
QImageReader reader("image.png");
@@ -60,6 +20,8 @@ QImageReader reader("image.png");
//! [1]
+void wrapper1() {
+
//! [2]
QImage icon(64, 64, QImage::Format_RGB32);
QImageReader reader("icon_64x64.bmp");
@@ -68,9 +30,16 @@ if (reader.read(&icon)) {
}
//! [2]
+} // wrapper1
+
+
+void wrapper2() {
//! [3]
QImageReader reader(":/image.png");
if (reader.supportsOption(QImageIOHandler::Size))
qDebug() << "Size:" << reader.size();
//! [3]
+
+} // wrapper2
+} // src_gui_image_qimagereader
diff --git a/src/gui/doc/snippets/code/src_gui_image_qimagewriter.cpp b/src/gui/doc/snippets/code/src_gui_image_qimagewriter.cpp
index c0b2544858..98b1fcdc9d 100644
--- a/src/gui/doc/snippets/code/src_gui_image_qimagewriter.cpp
+++ b/src/gui/doc/snippets/code/src_gui_image_qimagewriter.cpp
@@ -1,58 +1,21 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the documentation of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:BSD$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** BSD License Usage
-** Alternatively, you may use this file under the terms of the BSD license
-** as follows:
-**
-** "Redistribution and use in source and binary forms, with or without
-** modification, are permitted provided that the following conditions are
-** met:
-** * Redistributions of source code must retain the above copyright
-** notice, this list of conditions and the following disclaimer.
-** * Redistributions in binary form must reproduce the above copyright
-** notice, this list of conditions and the following disclaimer in
-** the documentation and/or other materials provided with the
-** distribution.
-** * Neither the name of The Qt Company Ltd nor the names of its
-** contributors may be used to endorse or promote products derived
-** from this software without specific prior written permission.
-**
-**
-** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause
+#include <QImage>
+#include <QImageWriter>
+
+namespace src_gui_image_qimagewriter {
+
+void wrapper0() {
//! [0]
QImageWriter writer;
writer.setFormat("png"); // same as writer.setFormat("PNG");
//! [0]
+} // wrapper0
+
+
+void wrapper1() {
//! [1]
QImage image("some/image.jpeg");
@@ -61,6 +24,11 @@ writer.setText("Author", "John Smith");
writer.write(image);
//! [1]
+} // wrapper1
+
+
+void wrapper2() {
+QString fileName;
//! [2]
QImageWriter writer(fileName);
@@ -68,9 +36,18 @@ if (writer.supportsOption(QImageIOHandler::Description))
writer.setText("Author", "John Smith");
//! [2]
+} // wrapper 2
+
+
+void wrapper3() {
+QImage image;
+
//! [3]
QImageWriter writer("some/image.dds");
if (writer.supportsOption(QImageIOHandler::SubType))
writer.setSubType("A8R8G8B8");
writer.write(image);
//! [3]
+
+} // wrapper3
+} // src_gui_image_qimagewriter
diff --git a/src/gui/doc/snippets/code/src_gui_image_qmovie.cpp b/src/gui/doc/snippets/code/src_gui_image_qmovie.cpp
index 3ed458a3db..390f69a703 100644
--- a/src/gui/doc/snippets/code/src_gui_image_qmovie.cpp
+++ b/src/gui/doc/snippets/code/src_gui_image_qmovie.cpp
@@ -1,52 +1,12 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the documentation of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:BSD$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** BSD License Usage
-** Alternatively, you may use this file under the terms of the BSD license
-** as follows:
-**
-** "Redistribution and use in source and binary forms, with or without
-** modification, are permitted provided that the following conditions are
-** met:
-** * Redistributions of source code must retain the above copyright
-** notice, this list of conditions and the following disclaimer.
-** * Redistributions in binary form must reproduce the above copyright
-** notice, this list of conditions and the following disclaimer in
-** the documentation and/or other materials provided with the
-** distribution.
-** * Neither the name of The Qt Company Ltd nor the names of its
-** contributors may be used to endorse or promote products derived
-** from this software without specific prior written permission.
-**
-**
-** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause
+#include <QLabel>
+#include <QMovie>
+
+namespace src_gui_image_qmovie {
+
+void wrapper0() {
+
//! [0]
QLabel label;
@@ -56,8 +16,15 @@ label.setMovie(movie);
movie->start();
//! [0]
+} // wrapper0
+
+
+void wrapper1() {
//! [1]
QMovie movie("racecar.gif");
movie.setSpeed(200); // 2x speed
//! [1]
+
+} // wrapper1
+} // src_gui_image_qmovie
diff --git a/src/gui/doc/snippets/code/src_gui_image_qpixmap.cpp b/src/gui/doc/snippets/code/src_gui_image_qpixmap.cpp
index b76e7b6e8d..2ef59d8f24 100644
--- a/src/gui/doc/snippets/code/src_gui_image_qpixmap.cpp
+++ b/src/gui/doc/snippets/code/src_gui_image_qpixmap.cpp
@@ -1,68 +1,27 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the documentation of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:BSD$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** BSD License Usage
-** Alternatively, you may use this file under the terms of the BSD license
-** as follows:
-**
-** "Redistribution and use in source and binary forms, with or without
-** modification, are permitted provided that the following conditions are
-** met:
-** * Redistributions of source code must retain the above copyright
-** notice, this list of conditions and the following disclaimer.
-** * Redistributions in binary form must reproduce the above copyright
-** notice, this list of conditions and the following disclaimer in
-** the documentation and/or other materials provided with the
-** distribution.
-** * Neither the name of The Qt Company Ltd nor the names of its
-** contributors may be used to endorse or promote products derived
-** from this software without specific prior written permission.
-**
-**
-** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause
+#include <QBitmap>
+#include <QPixmap>
-//! [0]
-static const char * const start_xpm[]={
- "16 15 8 1",
- "a c #cec6bd",
-....
-//! [0]
+namespace src_gui_image_qpixmap {
+void wrapper0() {
//! [1]
QPixmap myPixmap;
myPixmap.setMask(myPixmap.createHeuristicMask());
//! [1]
+} // wrapper0
+
+
+void wrapper1() {
+
//! [2]
QPixmap pixmap("background.png");
QRegion exposed;
pixmap.scroll(10, 10, pixmap.rect(), &exposed);
//! [2]
+
+} // wrapper1
+} // src_gui_image_qpixmap
diff --git a/src/gui/doc/snippets/code/src_gui_image_qpixmapcache.cpp b/src/gui/doc/snippets/code/src_gui_image_qpixmapcache.cpp
index 3870237ac3..9d2566c540 100644
--- a/src/gui/doc/snippets/code/src_gui_image_qpixmapcache.cpp
+++ b/src/gui/doc/snippets/code/src_gui_image_qpixmapcache.cpp
@@ -1,66 +1,12 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the documentation of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:BSD$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** BSD License Usage
-** Alternatively, you may use this file under the terms of the BSD license
-** as follows:
-**
-** "Redistribution and use in source and binary forms, with or without
-** modification, are permitted provided that the following conditions are
-** met:
-** * Redistributions of source code must retain the above copyright
-** notice, this list of conditions and the following disclaimer.
-** * Redistributions in binary form must reproduce the above copyright
-** notice, this list of conditions and the following disclaimer in
-** the documentation and/or other materials provided with the
-** distribution.
-** * Neither the name of The Qt Company Ltd nor the names of its
-** contributors may be used to endorse or promote products derived
-** from this software without specific prior written permission.
-**
-**
-** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-//! [0]
-QPixmap* pp;
-QPixmap p;
-if ((pp=QPixmapCache::find("my_big_image", pm))) {
- p = *pp;
-} else {
- p.load("bigimage.png");
- QPixmapCache::insert("my_big_image", new QPixmap(p));
-}
-painter->drawPixmap(0, 0, p);
-//! [0]
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause
+#include <QPainter>
+#include <QPixmap>
+#include <QPixmapCache>
+namespace src_gui_image_qpixmapcache {
+void wrapper0(QPainter *painter) {
//! [1]
QPixmap pm;
if (!QPixmapCache::find("my_big_image", &pm)) {
@@ -69,3 +15,6 @@ if (!QPixmapCache::find("my_big_image", &pm)) {
}
painter->drawPixmap(0, 0, pm);
//! [1]
+
+} // wrapper0
+} // src_gui_image_qpixmapcache
diff --git a/src/gui/doc/snippets/code/src_gui_itemviews_qstandarditemmodel.cpp b/src/gui/doc/snippets/code/src_gui_itemviews_qstandarditemmodel.cpp
index a7e22e549d..a608312424 100644
--- a/src/gui/doc/snippets/code/src_gui_itemviews_qstandarditemmodel.cpp
+++ b/src/gui/doc/snippets/code/src_gui_itemviews_qstandarditemmodel.cpp
@@ -1,52 +1,19 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the documentation of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:BSD$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** BSD License Usage
-** Alternatively, you may use this file under the terms of the BSD license
-** as follows:
-**
-** "Redistribution and use in source and binary forms, with or without
-** modification, are permitted provided that the following conditions are
-** met:
-** * Redistributions of source code must retain the above copyright
-** notice, this list of conditions and the following disclaimer.
-** * Redistributions in binary form must reproduce the above copyright
-** notice, this list of conditions and the following disclaimer in
-** the documentation and/or other materials provided with the
-** distribution.
-** * Neither the name of The Qt Company Ltd nor the names of its
-** contributors may be used to endorse or promote products derived
-** from this software without specific prior written permission.
-**
-**
-** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause
+#include <QStandardItemModel>
+#include <QTreeView>
+#include <QWidget>
+
+namespace src_gui_itemviews_qstandarditemmodel {
+struct MyWidget : public QWidget
+{
+ void wrapper2();
+ void clicked(const QModelIndex &index);
+ QModelIndex index() { return QModelIndex(); }
+ QStandardItemModel *myStandardItemModel;
+};
+
+void wrapper0() {
//! [0]
QStandardItemModel model(4, 4);
@@ -58,6 +25,10 @@ for (int row = 0; row < model.rowCount(); ++row) {
}
//! [0]
+} // wrapper0
+
+
+void wrapper1() {
//! [1]
QStandardItemModel model;
@@ -69,7 +40,10 @@ for (int i = 0; i < 4; ++i) {
}
//! [1]
+} // wrapper1
+
+void MyWidget::wrapper2() {
//! [2]
QTreeView *treeView = new QTreeView(this);
treeView->setModel(myStandardItemModel);
@@ -77,6 +51,8 @@ connect(treeView, &QTreeView::clicked,
this, &MyWidget::clicked);
//! [2]
+} // wrapper2
+
//! [3]
void MyWidget::clicked(const QModelIndex &index)
@@ -87,6 +63,12 @@ void MyWidget::clicked(const QModelIndex &index)
//! [3]
+void wrapper3() {
+QTreeView *treeView = nullptr;
+MyWidget *item = nullptr;
//! [4]
treeView->scrollTo(item->index());
//! [4]
+
+} // wrapper3
+} // src_gui_itemviews_qstandarditemmodel
diff --git a/src/gui/doc/snippets/code/src_gui_kernel_qaction.cpp b/src/gui/doc/snippets/code/src_gui_kernel_qaction.cpp
new file mode 100644
index 0000000000..054b40d7c0
--- /dev/null
+++ b/src/gui/doc/snippets/code/src_gui_kernel_qaction.cpp
@@ -0,0 +1,12 @@
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause
+
+//! [0]
+QApplication app(argc, argv);
+app.setAttribute(Qt::AA_DontShowIconsInMenus); // Icons are *no longer shown* in menus
+// ...
+QAction *myAction = new QAction();
+// ...
+myAction->setIcon(SomeIcon);
+myAction->setIconVisibleInMenu(true); // Icon *will* be shown in menus for *this* action.
+//! [0]
diff --git a/src/gui/doc/snippets/code/src_gui_kernel_qapplication.cpp b/src/gui/doc/snippets/code/src_gui_kernel_qapplication.cpp
index f1f51c0582..9455cacf1c 100644
--- a/src/gui/doc/snippets/code/src_gui_kernel_qapplication.cpp
+++ b/src/gui/doc/snippets/code/src_gui_kernel_qapplication.cpp
@@ -1,122 +1,30 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the documentation of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:BSD$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** BSD License Usage
-** Alternatively, you may use this file under the terms of the BSD license
-** as follows:
-**
-** "Redistribution and use in source and binary forms, with or without
-** modification, are permitted provided that the following conditions are
-** met:
-** * Redistributions of source code must retain the above copyright
-** notice, this list of conditions and the following disclaimer.
-** * Redistributions in binary form must reproduce the above copyright
-** notice, this list of conditions and the following disclaimer in
-** the documentation and/or other materials provided with the
-** distribution.
-** * Neither the name of The Qt Company Ltd nor the names of its
-** contributors may be used to endorse or promote products derived
-** from this software without specific prior written permission.
-**
-**
-** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause
+#include <QApplication>
+#include <QStyleFactory>
+#include <QWidget>
-//! [0]
-QCoreApplication* createApplication(int &argc, char *argv[])
-{
- for (int i = 1; i < argc; ++i)
- if (!qstrcmp(argv[i], "-no-gui"))
- return new QCoreApplication(argc, argv);
- return new QApplication(argc, argv);
-}
-
-int main(int argc, char* argv[])
-{
- QScopedPointer<QCoreApplication> app(createApplication(argc, argv));
-
- if (qobject_cast<QApplication *>(app.data())) {
- // start GUI version...
- } else {
- // start non-GUI version...
- }
-
- return app->exec();
-}
-//! [0]
-
-//! [1]
-QApplication::setStyle(QStyleFactory::create("fusion"));
-//! [1]
-
-
-//! [2]
-int main(int argc, char *argv[])
+namespace src_gui_kernel_qapplication {
+struct MyWidget
{
- QApplication::setColorSpec(QApplication::ManyColor);
- QApplication app(argc, argv);
- ...
- return app.exec();
-}
-//! [2]
-
-
-//! [3]
-QSize MyWidget::sizeHint() const
-{
- return QSize(80, 25).expandedTo(QApplication::globalStrut());
-}
-//! [3]
-
-
-//! [4]
-void showAllHiddenTopLevelWidgets()
-{
- const auto topLevelWidgets = QApplication::topLevelWidgets();
- for (QWidget *widget : topLevelWidgets) {
- if (widget->isHidden())
- widget->show();
- }
-}
-//! [4]
-
-
-//! [5]
-void updateAllWidgets()
-{
- const auto topLevelWidgets = QApplication::topLevelWidgets();
- for (QWidget *widget : topLevelWidgets)
- widget->update();
-}
-//! [5]
-
+ QSize sizeHint() const;
+
+ int foo = 0;
+ MyWidget operator- (MyWidget& other)
+ {
+ MyWidget tmp = other;
+ return tmp;
+ };
+ int manhattanLength() { return 0; }
+};
+
+void startTheDrag() {};
+void wrapper1() {
+MyWidget startPos;
+MyWidget currentPos;
+int x = 0;
+int y = 0;
//! [6]
if ((startPos - currentPos).manhattanLength() >=
@@ -124,15 +32,6 @@ if ((startPos - currentPos).manhattanLength() >=
startTheDrag();
//! [6]
-//! [7]
-QWidget *widget = qApp->widgetAt(x, y);
-if (widget)
- widget = widget->window();
-//! [7]
-
+} // wrapper1
-//! [8]
-QWidget *widget = qApp->widgetAt(point);
-if (widget)
- widget = widget->window();
-//! [8]
+} // src_gui_kernel_qapplication
diff --git a/src/gui/doc/snippets/code/src_gui_kernel_qclipboard.cpp b/src/gui/doc/snippets/code/src_gui_kernel_qclipboard.cpp
index 8581510133..61792521ca 100644
--- a/src/gui/doc/snippets/code/src_gui_kernel_qclipboard.cpp
+++ b/src/gui/doc/snippets/code/src_gui_kernel_qclipboard.cpp
@@ -1,57 +1,20 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the documentation of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:BSD$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** BSD License Usage
-** Alternatively, you may use this file under the terms of the BSD license
-** as follows:
-**
-** "Redistribution and use in source and binary forms, with or without
-** modification, are permitted provided that the following conditions are
-** met:
-** * Redistributions of source code must retain the above copyright
-** notice, this list of conditions and the following disclaimer.
-** * Redistributions in binary form must reproduce the above copyright
-** notice, this list of conditions and the following disclaimer in
-** the documentation and/or other materials provided with the
-** distribution.
-** * Neither the name of The Qt Company Ltd nor the names of its
-** contributors may be used to endorse or promote products derived
-** from this software without specific prior written permission.
-**
-**
-** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause
+#include <QClipboard>
+#include <QGuiApplication>
+#include <QMimeData>
+
+namespace src_gui_kernel_qclipboard {
+void wrapper() {
+QString newText;
+QString image;
+QClipboard::Mode mode = QClipboard::Mode::Clipboard;
+
//! [0]
QClipboard *clipboard = QGuiApplication::clipboard();
QString originalText = clipboard->text();
-...
+// etc.
clipboard->setText(newText);
//! [0]
@@ -61,3 +24,7 @@ QMimeData *data = new QMimeData;
data->setImageData(image);
clipboard->setMimeData(data, mode);
//! [1]
+
+
+} // wrapper
+} // src_gui_kernel_qclipboard
diff --git a/src/gui/doc/snippets/code/src_gui_kernel_qevent.cpp b/src/gui/doc/snippets/code/src_gui_kernel_qevent.cpp
index 44ce54a9bb..c24e755e92 100644
--- a/src/gui/doc/snippets/code/src_gui_kernel_qevent.cpp
+++ b/src/gui/doc/snippets/code/src_gui_kernel_qevent.cpp
@@ -1,52 +1,15 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the documentation of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:BSD$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** BSD License Usage
-** Alternatively, you may use this file under the terms of the BSD license
-** as follows:
-**
-** "Redistribution and use in source and binary forms, with or without
-** modification, are permitted provided that the following conditions are
-** met:
-** * Redistributions of source code must retain the above copyright
-** notice, this list of conditions and the following disclaimer.
-** * Redistributions in binary form must reproduce the above copyright
-** notice, this list of conditions and the following disclaimer in
-** the documentation and/or other materials provided with the
-** distribution.
-** * Neither the name of The Qt Company Ltd nor the names of its
-** contributors may be used to endorse or promote products derived
-** from this software without specific prior written permission.
-**
-**
-** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause
+#include <QWheelEvent>
+
+namespace src_gui_kernel_qevent {
+class MyWidget //: public QWidget
+{
+ void wheelEvent(QWheelEvent *event);
+ void scrollWithPixels(QPoint point);
+ void scrollWithDegrees(QPoint point);
+};
+
//! [0]
void MyWidget::wheelEvent(QWheelEvent *event)
@@ -64,3 +27,6 @@ void MyWidget::wheelEvent(QWheelEvent *event)
event->accept();
}
//! [0]
+
+
+} // src_gui_kernel_qevent
diff --git a/src/gui/doc/snippets/code/src_gui_kernel_qguiapplication.cpp b/src/gui/doc/snippets/code/src_gui_kernel_qguiapplication.cpp
index a399d444e1..347b47403e 100644
--- a/src/gui/doc/snippets/code/src_gui_kernel_qguiapplication.cpp
+++ b/src/gui/doc/snippets/code/src_gui_kernel_qguiapplication.cpp
@@ -1,59 +1,29 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the documentation of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:BSD$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** BSD License Usage
-** Alternatively, you may use this file under the terms of the BSD license
-** as follows:
-**
-** "Redistribution and use in source and binary forms, with or without
-** modification, are permitted provided that the following conditions are
-** met:
-** * Redistributions of source code must retain the above copyright
-** notice, this list of conditions and the following disclaimer.
-** * Redistributions in binary form must reproduce the above copyright
-** notice, this list of conditions and the following disclaimer in
-** the documentation and/or other materials provided with the
-** distribution.
-** * Neither the name of The Qt Company Ltd nor the names of its
-** contributors may be used to endorse or promote products derived
-** from this software without specific prior written permission.
-**
-**
-** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause
+#include <QApplication>
+#include <QMessageBox>
+#include <QSessionManager>
+#include <QWidget>
+
+namespace src_gui_kernel_qguiapplication {
+struct MyMainWidget : public QWidget
+{
+ MyMainWidget(QWidget *parent);
+ void commitData(QSessionManager& manager);
+ bool saveDocument() { return true; };
+ QStringList restartCommand() { return QStringList(); };
+ QStringList discardCommand() { return QStringList(); };
+};
+MyMainWidget *mainWindow = nullptr;
+void do_something(QString command) { Q_UNUSED(command); };
+MyMainWidget mySession(nullptr);
//! [0]
int main(int argc, char *argv[])
{
QApplication::setDesktopSettingsAware(false);
QApplication app(argc, argv);
- ...
+ // ...
return app.exec();
}
//! [0]
@@ -61,9 +31,8 @@ int main(int argc, char *argv[])
//! [1]
MyMainWidget::MyMainWidget(QWidget *parent)
- :QWidget(parent)
+ : QWidget(parent)
{
- QGuiApplication::setFallbackSessionManagementEnabled(false);
connect(qApp, &QGuiApplication::commitDataRequest,
this, &MyMainWidget::commitData);
}
@@ -97,20 +66,12 @@ void MyMainWidget::commitData(QSessionManager& manager)
//! [1]
+/* wrap snippet 2
+
//! [2]
appname -session id
//! [2]
+*/ // wrap snippet 2
-//! [3]
-const QStringList commands = mySession.restartCommand();
-for (const QString &command : commands)
- do_something(command);
-//! [3]
-
-
-//! [4]
-const QStringList commands = mySession.discardCommand();
-for (const QString &command : mySession.discardCommand())
- do_something(command);
-//! [4]
+} // src_gui_kernel_qguiapplication
diff --git a/src/gui/doc/snippets/code/src_gui_kernel_qguiapplication_x11.cpp b/src/gui/doc/snippets/code/src_gui_kernel_qguiapplication_x11.cpp
index 961ecd6cde..b73f887af2 100644
--- a/src/gui/doc/snippets/code/src_gui_kernel_qguiapplication_x11.cpp
+++ b/src/gui/doc/snippets/code/src_gui_kernel_qguiapplication_x11.cpp
@@ -1,55 +1,20 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the documentation of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:BSD$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** BSD License Usage
-** Alternatively, you may use this file under the terms of the BSD license
-** as follows:
-**
-** "Redistribution and use in source and binary forms, with or without
-** modification, are permitted provided that the following conditions are
-** met:
-** * Redistributions of source code must retain the above copyright
-** notice, this list of conditions and the following disclaimer.
-** * Redistributions in binary form must reproduce the above copyright
-** notice, this list of conditions and the following disclaimer in
-** the documentation and/or other materials provided with the
-** distribution.
-** * Neither the name of The Qt Company Ltd nor the names of its
-** contributors may be used to endorse or promote products derived
-** from this software without specific prior written permission.
-**
-**
-** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause
+#include <QCursor>
+#include <QGuiApplication>
+
+namespace src_gui_kernel_qguiapplication_x11 {
+void calculateHugeMandelbrot();
+
+void wrapper() {
+
//! [0]
QGuiApplication::setOverrideCursor(QCursor(Qt::WaitCursor));
calculateHugeMandelbrot(); // lunch time...
QGuiApplication::restoreOverrideCursor();
//! [0]
+
+
+} // wrapper
+} // src_gui_kernel_qguiapplication_x11
diff --git a/src/gui/doc/snippets/code/src_gui_kernel_qkeysequence.cpp b/src/gui/doc/snippets/code/src_gui_kernel_qkeysequence.cpp
index 2c49dd2d3d..0f335dd0a0 100644
--- a/src/gui/doc/snippets/code/src_gui_kernel_qkeysequence.cpp
+++ b/src/gui/doc/snippets/code/src_gui_kernel_qkeysequence.cpp
@@ -1,69 +1,39 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the documentation of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:BSD$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** BSD License Usage
-** Alternatively, you may use this file under the terms of the BSD license
-** as follows:
-**
-** "Redistribution and use in source and binary forms, with or without
-** modification, are permitted provided that the following conditions are
-** met:
-** * Redistributions of source code must retain the above copyright
-** notice, this list of conditions and the following disclaimer.
-** * Redistributions in binary form must reproduce the above copyright
-** notice, this list of conditions and the following disclaimer in
-** the documentation and/or other materials provided with the
-** distribution.
-** * Neither the name of The Qt Company Ltd nor the names of its
-** contributors may be used to endorse or promote products derived
-** from this software without specific prior written permission.
-**
-**
-** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause
+#include <QKeySequence>
+#include <QMenu>
+#include <QTranslator>
+
+
+namespace src_gui_kernel_qkeysequence {
+struct Wrapper : public QWidget
+{ void wrapper(); };
+
+/* Wrap non-compilable code snippet
//! [0]
QKeySequence(QKeySequence::Print);
QKeySequence(tr("Ctrl+P"));
QKeySequence(tr("Ctrl+p"));
-QKeySequence(Qt::CTRL + Qt::Key_P);
+QKeySequence(Qt::CTRL | Qt::Key_P);
+QKeySequence(Qt::CTRL + Qt::Key_P); // deprecated
//! [0]
//! [1]
QKeySequence(tr("Ctrl+X, Ctrl+C"));
-QKeySequence(Qt::CTRL + Qt::Key_X, Qt::CTRL + Qt::Key_C);
+QKeySequence(Qt::CTRL | Qt::Key_X, Qt::CTRL | Qt::Key_C);
+QKeySequence(Qt::CTRL + Qt::Key_X, Qt::CTRL + Qt::Key_C); // deprecated
//! [1]
+*/ // Wrap non-compilable code snippet
+void Wrapper::wrapper() {
//! [2]
QMenu *file = new QMenu(this);
-file->addAction(tr("&Open..."), this, SLOT(open()),
- QKeySequence(tr("Ctrl+O", "File|Open")));
+file->addAction(tr("&Open..."), QKeySequence(tr("Ctrl+O", "File|Open")),
+ this, &MainWindow::open);
//! [2]
+
+} // Wrapper::wrapper
+} // src_gui_kernel_qkeysequence
diff --git a/src/gui/doc/snippets/code/src_gui_kernel_qshortcut.cpp b/src/gui/doc/snippets/code/src_gui_kernel_qshortcut.cpp
new file mode 100644
index 0000000000..d67aea1288
--- /dev/null
+++ b/src/gui/doc/snippets/code/src_gui_kernel_qshortcut.cpp
@@ -0,0 +1,18 @@
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause
+
+//! [0]
+shortcut = new QShortcut(QKeySequence(tr("Ctrl+O", "File|Open")),
+ parent);
+//! [0]
+
+
+//! [1]
+setKey(0); // no signal emitted
+setKey(QKeySequence()); // no signal emitted
+setKey(0x3b1); // Greek letter alpha
+setKey(Qt::Key_D); // 'd', e.g. to delete
+setKey('q'); // 'q', e.g. to quit
+setKey(Qt::CTRL | Qt::Key_P); // Ctrl+P, e.g. to print document
+setKey("Ctrl+P"); // Ctrl+P, e.g. to print document
+//! [1]
diff --git a/src/gui/doc/snippets/code/src_gui_kernel_qshortcutmap.cpp b/src/gui/doc/snippets/code/src_gui_kernel_qshortcutmap.cpp
index 8bb0726c77..c08b318a4d 100644
--- a/src/gui/doc/snippets/code/src_gui_kernel_qshortcutmap.cpp
+++ b/src/gui/doc/snippets/code/src_gui_kernel_qshortcutmap.cpp
@@ -1,53 +1,15 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the documentation of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:BSD$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** BSD License Usage
-** Alternatively, you may use this file under the terms of the BSD license
-** as follows:
-**
-** "Redistribution and use in source and binary forms, with or without
-** modification, are permitted provided that the following conditions are
-** met:
-** * Redistributions of source code must retain the above copyright
-** notice, this list of conditions and the following disclaimer.
-** * Redistributions in binary form must reproduce the above copyright
-** notice, this list of conditions and the following disclaimer in
-** the documentation and/or other materials provided with the
-** distribution.
-** * Neither the name of The Qt Company Ltd nor the names of its
-** contributors may be used to endorse or promote products derived
-** from this software without specific prior written permission.
-**
-**
-** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause
+#include <QKeySequence>
+
+namespace src_gui_kernel_qshortcutmap {
+
+void wrapper() {
+QKeySequence key;
//! [0]
key = QKeySequence();
//! [0]
+
+} // wrapper
+} // src_gui_kernel_qshortcutmap
diff --git a/src/gui/doc/snippets/code/src_gui_math3d_qquaternion.cpp b/src/gui/doc/snippets/code/src_gui_math3d_qquaternion.cpp
index 8da438e3a7..6f27ba9db9 100644
--- a/src/gui/doc/snippets/code/src_gui_math3d_qquaternion.cpp
+++ b/src/gui/doc/snippets/code/src_gui_math3d_qquaternion.cpp
@@ -1,57 +1,28 @@
-/****************************************************************************
-**
-** Copyright (C) 2018 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the documentation of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:BSD$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** BSD License Usage
-** Alternatively, you may use this file under the terms of the BSD license
-** as follows:
-**
-** "Redistribution and use in source and binary forms, with or without
-** modification, are permitted provided that the following conditions are
-** met:
-** * Redistributions of source code must retain the above copyright
-** notice, this list of conditions and the following disclaimer.
-** * Redistributions in binary form must reproduce the above copyright
-** notice, this list of conditions and the following disclaimer in
-** the documentation and/or other materials provided with the
-** distribution.
-** * Neither the name of The Qt Company Ltd nor the names of its
-** contributors may be used to endorse or promote products derived
-** from this software without specific prior written permission.
-**
-**
-** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2018 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause
+#include <QQuaternion>
+#include <QVector3D>
+
+
+namespace src_gui_math3d_qquaternion {
+QQuaternion q;
+QVector3D vector;
+void wrapper0() {
//! [0]
- QVector3D result = q.rotatedVector(vector);
+QVector3D result = q.rotatedVector(vector);
//! [0]
+Q_UNUSED(result);
+} // wrapper0
+
+
+void wrapper1() {
+
//! [1]
- QVector3D result = (q * QQuaternion(0, vector) * q.conjugated()).vector();
+QVector3D result = (q * QQuaternion(0, vector) * q.conjugated()).vector();
//! [1]
+
+Q_UNUSED(result);
+} // wrapper1
+} // src_gui_math3d_qquaternion
diff --git a/src/gui/doc/snippets/code/src_gui_opengl_qopenglbuffer.cpp b/src/gui/doc/snippets/code/src_gui_opengl_qopenglbuffer.cpp
deleted file mode 100644
index 57dc909598..0000000000
--- a/src/gui/doc/snippets/code/src_gui_opengl_qopenglbuffer.cpp
+++ /dev/null
@@ -1,60 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2018 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the documentation of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:BSD$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** BSD License Usage
-** Alternatively, you may use this file under the terms of the BSD license
-** as follows:
-**
-** "Redistribution and use in source and binary forms, with or without
-** modification, are permitted provided that the following conditions are
-** met:
-** * Redistributions of source code must retain the above copyright
-** notice, this list of conditions and the following disclaimer.
-** * Redistributions in binary form must reproduce the above copyright
-** notice, this list of conditions and the following disclaimer in
-** the documentation and/or other materials provided with the
-** distribution.
-** * Neither the name of The Qt Company Ltd nor the names of its
-** contributors may be used to endorse or promote products derived
-** from this software without specific prior written permission.
-**
-**
-** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-//! [0]
- QOpenGLBuffer buffer1(QOpenGLBuffer::IndexBuffer);
- buffer1.create();
-
- QOpenGLBuffer buffer2 = buffer1;
-//! [0]
-
-//! [1]
- QOpenGLBuffer::release(QOpenGLBuffer::VertexBuffer);
-//! [1]
diff --git a/src/gui/doc/snippets/code/src_gui_opengl_qopengldebug.cpp b/src/gui/doc/snippets/code/src_gui_opengl_qopengldebug.cpp
deleted file mode 100644
index e82447a174..0000000000
--- a/src/gui/doc/snippets/code/src_gui_opengl_qopengldebug.cpp
+++ /dev/null
@@ -1,100 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2018 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the documentation of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:BSD$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** BSD License Usage
-** Alternatively, you may use this file under the terms of the BSD license
-** as follows:
-**
-** "Redistribution and use in source and binary forms, with or without
-** modification, are permitted provided that the following conditions are
-** met:
-** * Redistributions of source code must retain the above copyright
-** notice, this list of conditions and the following disclaimer.
-** * Redistributions in binary form must reproduce the above copyright
-** notice, this list of conditions and the following disclaimer in
-** the documentation and/or other materials provided with the
-** distribution.
-** * Neither the name of The Qt Company Ltd nor the names of its
-** contributors may be used to endorse or promote products derived
-** from this software without specific prior written permission.
-**
-**
-** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-//! [0]
- GLenum error = GL_NO_ERROR;
- do {
- error = glGetError();
- if (error != GL_NO_ERROR)
- // handle the error
- } while (error != GL_NO_ERROR);
-//! [0]
-
-//! [1]
- QSurfaceFormat format;
- // asks for a OpenGL 3.2 debug context using the Core profile
- format.setMajorVersion(3);
- format.setMinorVersion(2);
- format.setProfile(QSurfaceFormat::CoreProfile);
- format.setOption(QSurfaceFormat::DebugContext);
-
- QOpenGLContext *context = new QOpenGLContext;
- context->setFormat(format);
- context->create();
-//! [1]
-
-//! [2]
- QOpenGLContext *ctx = QOpenGLContext::currentContext();
- QOpenGLDebugLogger *logger = new QOpenGLDebugLogger(this);
-
- logger->initialize(); // initializes in the current context, i.e. ctx
-//! [2]
-
-//! [3]
- ctx->hasExtension(QByteArrayLiteral("GL_KHR_debug"))
-//! [3]
-
-//! [4]
- const QList<QOpenGLDebugMessage> messages = logger->loggedMessages();
- for (const QOpenGLDebugMessage &message : messages)
- qDebug() << message;
-//! [4]
-
-//! [5]
- connect(logger, &QOpenGLDebugLogger::messageLogged, receiver, &LogHandler::handleLoggedMessage);
- logger->startLogging();
-//! [5]
-
-//! [6]
- QOpenGLDebugMessage message =
- QOpenGLDebugMessage::createApplicationMessage(QStringLiteral("Custom message"));
-
- logger->logMessage(message);
-//! [6]
diff --git a/src/gui/doc/snippets/code/src_gui_opengl_qopenglfunctions.cpp b/src/gui/doc/snippets/code/src_gui_opengl_qopenglfunctions.cpp
index e072c110f2..14531446a1 100644
--- a/src/gui/doc/snippets/code/src_gui_opengl_qopenglfunctions.cpp
+++ b/src/gui/doc/snippets/code/src_gui_opengl_qopenglfunctions.cpp
@@ -1,112 +1,86 @@
-/****************************************************************************
-**
-** Copyright (C) 2018 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the documentation of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:BSD$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** BSD License Usage
-** Alternatively, you may use this file under the terms of the BSD license
-** as follows:
-**
-** "Redistribution and use in source and binary forms, with or without
-** modification, are permitted provided that the following conditions are
-** met:
-** * Redistributions of source code must retain the above copyright
-** notice, this list of conditions and the following disclaimer.
-** * Redistributions in binary form must reproduce the above copyright
-** notice, this list of conditions and the following disclaimer in
-** the documentation and/or other materials provided with the
-** distribution.
-** * Neither the name of The Qt Company Ltd nor the names of its
-** contributors may be used to endorse or promote products derived
-** from this software without specific prior written permission.
-**
-**
-** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2018 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause
+#include <QOpenGLFunctions>
+#include <QtOpenGL/QOpenGLWindow>
+
+#include <QSurface>
+#include <QWidget>
+#include <QWindow>
+
+namespace src_gui_opengl_qopenglfunctions {
//! [0]
- class MyGLWindow : public QWindow, protected QOpenGLFunctions
- {
- Q_OBJECT
- public:
- MyGLWindow(QScreen *screen = 0);
-
- protected:
- void initializeGL();
- void paintGL();
-
- QOpenGLContext *m_context;
- };
-
- MyGLWindow(QScreen *screen)
- : QWindow(screen), QOpenGLWidget(parent)
- {
- setSurfaceType(OpenGLSurface);
- create();
-
- // Create an OpenGL context
- m_context = new QOpenGLContext;
- m_context->create();
-
- // Setup scene and render it
- initializeGL();
- paintGL();
- }
-
- void MyGLWindow::initializeGL()
- {
- m_context->makeCurrent(this);
- initializeOpenGLFunctions();
- }
+class MyGLWindow : public QWindow, protected QOpenGLFunctions
+{
+ Q_OBJECT
+public:
+ explicit MyGLWindow(QScreen *screen = nullptr);
+
+protected:
+ void initializeGL();
+ void paintGL();
+
+ QOpenGLContext *m_context;
+};
+
+MyGLWindow::MyGLWindow(QScreen *screen)
+ : QWindow(screen)
+{
+ setSurfaceType(OpenGLSurface);
+ create();
+
+ // Create an OpenGL context
+ m_context = new QOpenGLContext;
+ m_context->create();
+
+ // Setup scene and render it
+ initializeGL();
+ paintGL();
+};
+
+void MyGLWindow::initializeGL()
+{
+ m_context->makeCurrent(this);
+ initializeOpenGLFunctions();
+}
//! [0]
+
+int textureId = 0;
+
//! [1]
- void MyGLWindow::paintGL()
- {
- m_context->makeCurrent(this);
- glActiveTexture(GL_TEXTURE1);
- glBindTexture(GL_TEXTURE_2D, textureId);
- ...
- m_context->swapBuffers(this);
- m_context->doneCurrent();
- }
+void MyGLWindow::paintGL()
+{
+ m_context->makeCurrent(this);
+ glActiveTexture(GL_TEXTURE1);
+ glBindTexture(GL_TEXTURE_2D, textureId);
+ // ...
+ m_context->swapBuffers(this);
+ m_context->doneCurrent();
+}
//! [1]
+
+void wrapper0() {
//! [2]
- QOpenGLFunctions glFuncs(QOpenGLContext::currentContext());
- glFuncs.glActiveTexture(GL_TEXTURE1);
+QOpenGLFunctions glFuncs(QOpenGLContext::currentContext());
+glFuncs.glActiveTexture(GL_TEXTURE1);
//! [2]
+} // wrapper0
+
+void wrapper1() {
//! [3]
- QOpenGLFunctions *glFuncs = QOpenGLContext::currentContext()->functions();
- glFuncs->glActiveTexture(GL_TEXTURE1);
+QOpenGLFunctions *glFuncs = QOpenGLContext::currentContext()->functions();
+glFuncs->glActiveTexture(GL_TEXTURE1);
//! [3]
+
//! [4]
- QOpenGLFunctions funcs(QOpenGLContext::currentContext());
- bool npot = funcs.hasOpenGLFeature(QOpenGLFunctions::NPOTTextures);
+QOpenGLFunctions funcs(QOpenGLContext::currentContext());
+bool npot = funcs.hasOpenGLFeature(QOpenGLFunctions::NPOTTextures);
//! [4]
+
+Q_UNUSED(npot);
+} // wrapper1
+} // src_gui_opengl_qopenglfunctions
diff --git a/src/gui/doc/snippets/code/src_gui_painting_qbrush.cpp b/src/gui/doc/snippets/code/src_gui_painting_qbrush.cpp
index 786d6ca183..69eedff7d1 100644
--- a/src/gui/doc/snippets/code/src_gui_painting_qbrush.cpp
+++ b/src/gui/doc/snippets/code/src_gui_painting_qbrush.cpp
@@ -1,52 +1,14 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the documentation of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:BSD$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** BSD License Usage
-** Alternatively, you may use this file under the terms of the BSD license
-** as follows:
-**
-** "Redistribution and use in source and binary forms, with or without
-** modification, are permitted provided that the following conditions are
-** met:
-** * Redistributions of source code must retain the above copyright
-** notice, this list of conditions and the following disclaimer.
-** * Redistributions in binary form must reproduce the above copyright
-** notice, this list of conditions and the following disclaimer in
-** the documentation and/or other materials provided with the
-** distribution.
-** * Neither the name of The Qt Company Ltd nor the names of its
-** contributors may be used to endorse or promote products derived
-** from this software without specific prior written permission.
-**
-**
-** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause
+#include <QPainter>
+
+namespace src_gui_painting_qbrush {
+
+struct Wrapper : public QPaintDevice {
+ void wrapper();
+};
+void Wrapper::wrapper() {
+
//! [0]
QPainter painter(this);
@@ -59,3 +21,7 @@ painter.setBrush(Qt::NoBrush);
painter.setPen(Qt::darkGreen);
painter.drawRect(40, 40, 100, 100);
//! [0]
+
+
+} // Wrapper::wrapper
+} // src_gui_painting_qbrush
diff --git a/src/gui/doc/snippets/code/src_gui_painting_qcolor.cpp b/src/gui/doc/snippets/code/src_gui_painting_qcolor.cpp
index 5285a19a0a..0a2bc832ff 100644
--- a/src/gui/doc/snippets/code/src_gui_painting_qcolor.cpp
+++ b/src/gui/doc/snippets/code/src_gui_painting_qcolor.cpp
@@ -1,59 +1,32 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the documentation of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:BSD$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** BSD License Usage
-** Alternatively, you may use this file under the terms of the BSD license
-** as follows:
-**
-** "Redistribution and use in source and binary forms, with or without
-** modification, are permitted provided that the following conditions are
-** met:
-** * Redistributions of source code must retain the above copyright
-** notice, this list of conditions and the following disclaimer.
-** * Redistributions in binary form must reproduce the above copyright
-** notice, this list of conditions and the following disclaimer in
-** the documentation and/or other materials provided with the
-** distribution.
-** * Neither the name of The Qt Company Ltd nor the names of its
-** contributors may be used to endorse or promote products derived
-** from this software without specific prior written permission.
-**
-**
-** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause
+#include <QPainter>
+
+namespace src_gui_painting_qcolor {
+int width() { return 1; };
+int height() { return 1; };
+QPainter painter;
+void wrapper() {
+
//! [0]
// Specify semi-transparent red
painter.setBrush(QColor(255, 0, 0, 127));
-painter.drawRect(0, 0, width()/2, height());
+painter.drawRect(0, 0, width() / 2, height());
// Specify semi-transparent blue
painter.setBrush(QColor(0, 0, 255, 127));
-painter.drawRect(0, 0, width(), height()/2);
+painter.drawRect(0, 0, width(), height() / 2);
//! [0]
+
+//! [QRgb]
+const QRgb rgb1 = 0x88112233;
+const QRgb rgb2 = QColor("red").rgb();
+const QRgb rgb3 = qRgb(qRed(rgb1), qGreen(rgb2), qBlue(rgb2));
+const QRgb rgb4 = qRgba(qRed(rgb1), qGreen(rgb2), qBlue(rgb2), qAlpha(rgb1));
+//! [QRgb]
+Q_UNUSED(rgb3);
+Q_UNUSED(rgb4);
+
+} // wrapper
+} // src_gui_painting_qcolor
diff --git a/src/gui/doc/snippets/code/src_gui_painting_qmatrix.cpp b/src/gui/doc/snippets/code/src_gui_painting_qmatrix.cpp
deleted file mode 100644
index 30beec799a..0000000000
--- a/src/gui/doc/snippets/code/src_gui_painting_qmatrix.cpp
+++ /dev/null
@@ -1,72 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the documentation of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:BSD$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** BSD License Usage
-** Alternatively, you may use this file under the terms of the BSD license
-** as follows:
-**
-** "Redistribution and use in source and binary forms, with or without
-** modification, are permitted provided that the following conditions are
-** met:
-** * Redistributions of source code must retain the above copyright
-** notice, this list of conditions and the following disclaimer.
-** * Redistributions in binary form must reproduce the above copyright
-** notice, this list of conditions and the following disclaimer in
-** the documentation and/or other materials provided with the
-** distribution.
-** * Neither the name of The Qt Company Ltd nor the names of its
-** contributors may be used to endorse or promote products derived
-** from this software without specific prior written permission.
-**
-**
-** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-//! [0]
-x' = m11*x + m21*y + dx
-y' = m22*y + m12*x + dy
-//! [0]
-
-
-//! [1]
-x' = m11*x + m21*y + dx
-y' = m22*y + m12*x + dy
-//! [1]
-
-
-//! [2]
-x' = m11*x + m21*y + dx
-y' = m22*y + m12*x + dy
-//! [2]
-
-
-//! [3]
-x' = m11*x + m21*y + dx
-y' = m22*y + m12*x + dy
-//! [3]
diff --git a/src/gui/doc/snippets/code/src_gui_painting_qpainter.cpp b/src/gui/doc/snippets/code/src_gui_painting_qpainter.cpp
index 37fae52778..cfbf3e44a2 100644
--- a/src/gui/doc/snippets/code/src_gui_painting_qpainter.cpp
+++ b/src/gui/doc/snippets/code/src_gui_painting_qpainter.cpp
@@ -1,52 +1,25 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the documentation of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:BSD$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** BSD License Usage
-** Alternatively, you may use this file under the terms of the BSD license
-** as follows:
-**
-** "Redistribution and use in source and binary forms, with or without
-** modification, are permitted provided that the following conditions are
-** met:
-** * Redistributions of source code must retain the above copyright
-** notice, this list of conditions and the following disclaimer.
-** * Redistributions in binary form must reproduce the above copyright
-** notice, this list of conditions and the following disclaimer in
-** the documentation and/or other materials provided with the
-** distribution.
-** * Neither the name of The Qt Company Ltd nor the names of its
-** contributors may be used to endorse or promote products derived
-** from this software without specific prior written permission.
-**
-**
-** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause
+#include <QOpenGLFunctions>
+#include <QPaintEvent>
+#include <QPainter>
+#include <QPainterPath>
+#include <QPicture>
+#include <QRectF>
+#include <QWidget>
+
+
+namespace src_gui_painting_qpainter {
+struct SimpleExampleWidget : public QPaintDevice {
+ void paintEvent(QPaintEvent *);
+ QRect rect();
+};
+struct MyWidget : public QWidget
+{
+ void paintEvent(QPaintEvent *);
+};
+QLine drawingCode;
+
//! [0]
void SimpleExampleWidget::paintEvent(QPaintEvent *)
@@ -64,21 +37,49 @@ void MyWidget::paintEvent(QPaintEvent *)
{
QPainter p;
p.begin(this);
- p.drawLine(...); // drawing code
+ p.drawLine(drawingCode); // drawing code
p.end();
}
//! [1]
+} // src_gui_painting_qpainter
+namespace src_gui_painting_qpainter2 {
+struct MyWidget : public QWidget
+{
+ void paintEvent(QPaintEvent *);
+ int background() { return 0; }
+ void wrapper1();
+ void wrapper2();
+ void wrapper3();
+ void wrapper4();
+ void wrapper5();
+ void wrapper6();
+ void wrapper7();
+ void wrapper8();
+ void wrapper9();
+ void wrapper10();
+ void wrapper11();
+ void wrapper12();
+ void wrapper13();
+ void wrapper14();
+ void wrapper15();
+ void concentricCircles();
+};
+QLine drawingCode;
//! [2]
void MyWidget::paintEvent(QPaintEvent *)
{
QPainter p(this);
- p.drawLine(...); // drawing code
+ p.drawLine(drawingCode); // drawing code
}
//! [2]
+void wrapper0() {
+QPainter *painter = nullptr;
+QPainter *painter2 = nullptr;
+QPaintDevice *myWidget = nullptr;
//! [3]
painter->begin(0); // impossible - paint device cannot be 0
@@ -89,17 +90,17 @@ painter->begin(myWidget);
painter2->begin(myWidget); // impossible - only one painter at a time
//! [3]
+} // wrapper0
-//! [4]
-void QPainter::rotate(qreal angle)
-{
- QMatrix matrix;
- matrix.rotate(angle);
- setWorldMatrix(matrix, true);
-}
-//! [4]
+namespace QPainterWrapper {
+struct QPainter {
+ void rotate(qreal angle);
+ void setWorldTransform(QTransform matrix, bool);
+};
+} // QPainterWrapper
+void MyWidget::wrapper1() {
//! [5]
QPainterPath path;
path.moveTo(20, 80);
@@ -114,10 +115,13 @@ painter.drawPath(path);
//! [6]
QLineF line(10.0, 80.0, 90.0, 20.0);
-QPainter(this);
+QPainter painter(this);
painter.drawLine(line);
//! [6]
+} // MyWidget::wrapper1()
+
+void MyWidget::wrapper2() {
//! [7]
QRectF rectangle(10.0, 20.0, 80.0, 60.0);
@@ -126,6 +130,10 @@ QPainter painter(this);
painter.drawRect(rectangle);
//! [7]
+} // MyWidget::wrapper2
+
+
+void MyWidget::wrapper3() {
//! [8]
QRectF rectangle(10.0, 20.0, 80.0, 60.0);
@@ -134,6 +142,10 @@ QPainter painter(this);
painter.drawRoundedRect(rectangle, 20.0, 15.0);
//! [8]
+} // MyWidget::wrapper3
+
+
+void MyWidget::wrapper4() {
//! [9]
QRectF rectangle(10.0, 20.0, 80.0, 60.0);
@@ -142,6 +154,10 @@ QPainter painter(this);
painter.drawEllipse(rectangle);
//! [9]
+} // MyWidget::wrapper4
+
+
+void MyWidget::wrapper5() {
//! [10]
QRectF rectangle(10.0, 20.0, 80.0, 60.0);
@@ -152,6 +168,10 @@ QPainter painter(this);
painter.drawArc(rectangle, startAngle, spanAngle);
//! [10]
+} // MyWidget::wrapper5
+
+
+void MyWidget::wrapper6() {
//! [11]
QRectF rectangle(10.0, 20.0, 80.0, 60.0);
@@ -162,6 +182,11 @@ QPainter painter(this);
painter.drawPie(rectangle, startAngle, spanAngle);
//! [11]
+} // MyWidget::wrapper6
+
+
+void MyWidget::wrapper7() {
+QRect rect;
//! [12]
QRectF rectangle(10.0, 20.0, 80.0, 60.0);
@@ -171,7 +196,11 @@ int spanAngle = 120 * 16;
QPainter painter(this);
painter.drawChord(rect, startAngle, spanAngle);
//! [12]
+Q_UNUSED(rectangle);
+} // MyWidget::wrapper7
+
+void MyWidget::wrapper8() {
//! [13]
static const QPointF points[3] = {
@@ -184,7 +213,10 @@ QPainter painter(this);
painter.drawPolyline(points, 3);
//! [13]
+} // MyWidget::wrapper8
+
+void MyWidget::wrapper9() {
//! [14]
static const QPointF points[4] = {
QPointF(10.0, 80.0),
@@ -197,6 +229,10 @@ QPainter painter(this);
painter.drawPolygon(points, 4);
//! [14]
+} // MyWidget::wrapper9
+
+
+void MyWidget::wrapper10() {
//! [15]
static const QPointF points[4] = {
@@ -216,31 +252,52 @@ QRectF target(10.0, 20.0, 80.0, 60.0);
QRectF source(0.0, 0.0, 70.0, 40.0);
QPixmap pixmap(":myPixmap.png");
-QPainter(this);
+QPainter painter(this);
painter.drawPixmap(target, pixmap, source);
//! [16]
+} // MyWidget::wrapper10
+
+
+void MyWidget::wrapper11() {
+QRect rect;
//! [17]
QPainter painter(this);
painter.drawText(rect, Qt::AlignCenter, tr("Qt\nProject"));
//! [17]
+} // MyWidget::wrapper11
+
+
+QRectF fillRect(QRect rect, int background) {
+ Q_UNUSED(rect);
+ Q_UNUSED(background);
+ return QRectF();
+};
+void MyWidget::wrapper12() {
+QRect rectangle;
//! [18]
QPicture picture;
-QPointF point(10.0, 20.0)
+QPointF point(10.0, 20.0);
picture.load("drawing.pic");
QPainter painter(this);
painter.drawPicture(0, 0, picture);
//! [18]
+Q_UNUSED(point);
+
//! [19]
-fillRect(rectangle, background()).
+fillRect(rectangle, background());
//! [19]
+} // MyWidget::wrapper12
+
+
+void MyWidget::wrapper13() {
//! [20]
QRectF target(10.0, 20.0, 80.0, 60.0);
@@ -251,6 +308,10 @@ QPainter painter(this);
painter.drawImage(target, image, source);
//! [20]
+} // MyWidget::wrapper13
+
+
+void MyWidget::wrapper14() {
//! [21]
QPainter painter(this);
@@ -268,6 +329,11 @@ glDisable(GL_SCISSOR_TEST);
painter.endNativePainting();
//! [21]
+} // MyWidget::wrapper14
+
+
+void MyWidget::wrapper15() {
+
//! [drawText]
QPainter painter(this);
QFont font = painter.font();
@@ -287,3 +353,24 @@ pen.setStyle(Qt::DashLine);
painter.setPen(pen);
painter.drawRect(rectangle.adjusted(0, 0, -pen.width(), -pen.width()));
//! [drawText]
+
+
+} // MyWidget::wrapper15
+
+void MyWidget::concentricCircles()
+{
+//! [renderHint]
+ QPainter painter(this);
+ painter.setRenderHint(QPainter::Antialiasing, true);
+//! [renderHint]
+ int diameter = 50;
+//! [floatBased]
+ painter.drawEllipse(QRectF(-diameter / 2.0, -diameter / 2.0, diameter, diameter));
+//! [floatBased]
+//! [intBased]
+ painter.drawEllipse(QRect(-diameter / 2, -diameter / 2, diameter, diameter));
+//! [intBased]
+
+} // MyWidget::concentricCircles
+
+} // src_gui_painting_qpainter2 \ No newline at end of file
diff --git a/src/gui/doc/snippets/code/src_gui_painting_qpainterpath.cpp b/src/gui/doc/snippets/code/src_gui_painting_qpainterpath.cpp
index e6d72fce12..cd538b750c 100644
--- a/src/gui/doc/snippets/code/src_gui_painting_qpainterpath.cpp
+++ b/src/gui/doc/snippets/code/src_gui_painting_qpainterpath.cpp
@@ -1,52 +1,26 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the documentation of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:BSD$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** BSD License Usage
-** Alternatively, you may use this file under the terms of the BSD license
-** as follows:
-**
-** "Redistribution and use in source and binary forms, with or without
-** modification, are permitted provided that the following conditions are
-** met:
-** * Redistributions of source code must retain the above copyright
-** notice, this list of conditions and the following disclaimer.
-** * Redistributions in binary form must reproduce the above copyright
-** notice, this list of conditions and the following disclaimer in
-** the documentation and/or other materials provided with the
-** distribution.
-** * Neither the name of The Qt Company Ltd nor the names of its
-** contributors may be used to endorse or promote products derived
-** from this software without specific prior written permission.
-**
-**
-** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause
+#include <QLinearGradient>
+#include <QPainter>
+#include <QPainterPath>
+#include <QPen>
+
+namespace src_gui_painting_qpainterpath {
+struct Wrapper : QPaintDevice
+{
+ Q_OBJECT
+
+ void wrapper0();
+ void wrapper1();
+ void wrapper2();
+ void wrapper3();
+ void wrapper4();
+ void wrapper5();
+ void wrapper6();
+ void wrapper7();
+};
+
+void Wrapper::wrapper0() {
//! [0]
QPainterPath path;
@@ -65,6 +39,13 @@ painter.setBrush(QColor(122, 163, 39));
painter.drawPath(path);
//! [0]
+} // Wrapper::wrapper0
+
+
+void Wrapper::wrapper1() {
+const QPointF c1;
+const QPointF c2;
+const QPointF endPoint;
//! [1]
QLinearGradient myGradient;
@@ -79,13 +60,17 @@ painter.setPen(myPen);
painter.drawPath(myPath);
//! [1]
+} // Wrapper::wrapper1
-//! [2]
+
+void Wrapper::wrapper2() {
+const QRectF boundingRect;
+qreal startAngle = 0;
+qreal sweepLength = 0;
+QPointF center;
QLinearGradient myGradient;
QPen myPen;
-
-QPointF center, startPoint;
-
+//! [2]
QPainterPath myPath;
myPath.moveTo(center);
myPath.arcTo(boundingRect, startAngle,
@@ -97,6 +82,10 @@ painter.setPen(myPen);
painter.drawPath(myPath);
//! [2]
+} // Wrapper::wrapper2
+
+
+void Wrapper::wrapper3() {
//! [3]
QLinearGradient myGradient;
@@ -112,6 +101,10 @@ painter.setPen(myPen);
painter.drawPath(myPath);
//! [3]
+} // Wrapper::wrapper3
+
+
+void Wrapper::wrapper4() {
//! [4]
QLinearGradient myGradient;
@@ -127,6 +120,10 @@ painter.setPen(myPen);
painter.drawPath(myPath);
//! [4]
+} // Wrapper::wrapper4
+
+
+void Wrapper::wrapper5() {
//! [5]
QLinearGradient myGradient;
@@ -142,6 +139,12 @@ painter.setPen(myPen);
painter.drawPath(myPath);
//! [5]
+} // Wrapper::wrapper5
+
+
+void Wrapper::wrapper6() {
+qreal x = 0;
+qreal y = 0;
//! [6]
QLinearGradient myGradient;
@@ -157,3 +160,7 @@ painter.setBrush(myGradient);
painter.setPen(myPen);
painter.drawPath(myPath);
//! [6]
+
+
+} // Wrapper::wrapper6
+} // src_gui_painting_qpainterpath
diff --git a/src/gui/doc/snippets/code/src_gui_painting_qpen.cpp b/src/gui/doc/snippets/code/src_gui_painting_qpen.cpp
index d899418a3f..a9c21afb9f 100644
--- a/src/gui/doc/snippets/code/src_gui_painting_qpen.cpp
+++ b/src/gui/doc/snippets/code/src_gui_painting_qpen.cpp
@@ -1,52 +1,18 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the documentation of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:BSD$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** BSD License Usage
-** Alternatively, you may use this file under the terms of the BSD license
-** as follows:
-**
-** "Redistribution and use in source and binary forms, with or without
-** modification, are permitted provided that the following conditions are
-** met:
-** * Redistributions of source code must retain the above copyright
-** notice, this list of conditions and the following disclaimer.
-** * Redistributions in binary form must reproduce the above copyright
-** notice, this list of conditions and the following disclaimer in
-** the documentation and/or other materials provided with the
-** distribution.
-** * Neither the name of The Qt Company Ltd nor the names of its
-** contributors may be used to endorse or promote products derived
-** from this software without specific prior written permission.
-**
-**
-** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause
+#include <QPainter>
+#include <QPen>
+
+namespace src_gui_painting_qpen {
+struct Wrapper : QPaintDevice
+{
+ void wrapper0();
+ void wrapper1();
+ void wrapper2();
+ void wrapper3();
+};
+
+void Wrapper::wrapper0() {
//! [0]
QPainter painter(this);
@@ -54,6 +20,10 @@ QPen pen(Qt::green, 3, Qt::DashDotLine, Qt::RoundCap, Qt::RoundJoin);
painter.setPen(pen);
//! [0]
+} // Wrapper::wrapper0
+
+
+void Wrapper::wrapper1() {
//! [1]
QPainter painter(this);
@@ -68,10 +38,14 @@ pen.setJoinStyle(Qt::RoundJoin);
painter.setPen(pen);
//! [1]
+} // Wrapper::wrapper1
+
+
+void Wrapper::wrapper2() {
//! [2]
QPen pen;
-QVector<qreal> dashes;
+QList<qreal> dashes;
qreal space = 4;
dashes << 1 << space << 3 << space << 9 << space
@@ -80,12 +54,18 @@ dashes << 1 << space << 3 << space << 9 << space
pen.setDashPattern(dashes);
//! [2]
+} // Wrapper::wrapper2
+
+void Wrapper::wrapper3() {
//! [3]
QPen pen;
-QVector<qreal> dashes;
+QList<qreal> dashes;
qreal space = 4;
dashes << 1 << space << 3 << space << 9 << space
<< 27 << space << 9 << space;
pen.setDashPattern(dashes);
//! [3]
+
+} // Wrapper::wrapper3
+} // src_gui_painting_qpen
diff --git a/src/gui/doc/snippets/code/src_gui_painting_qregion.cpp b/src/gui/doc/snippets/code/src_gui_painting_qregion.cpp
index 496791dc0f..6401c29de5 100644
--- a/src/gui/doc/snippets/code/src_gui_painting_qregion.cpp
+++ b/src/gui/doc/snippets/code/src_gui_painting_qregion.cpp
@@ -1,52 +1,13 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the documentation of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:BSD$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** BSD License Usage
-** Alternatively, you may use this file under the terms of the BSD license
-** as follows:
-**
-** "Redistribution and use in source and binary forms, with or without
-** modification, are permitted provided that the following conditions are
-** met:
-** * Redistributions of source code must retain the above copyright
-** notice, this list of conditions and the following disclaimer.
-** * Redistributions in binary form must reproduce the above copyright
-** notice, this list of conditions and the following disclaimer in
-** the documentation and/or other materials provided with the
-** distribution.
-** * Neither the name of The Qt Company Ltd nor the names of its
-** contributors may be used to endorse or promote products derived
-** from this software without specific prior written permission.
-**
-**
-** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause
+#include <QPaintEvent>
+#include <QPainter>
+
+namespace src_gui_painting_qregion {
+struct MyWidget : public QPaintDevice
+{
+ void paintEvent(QPaintEvent *);
+};
//! [0]
void MyWidget::paintEvent(QPaintEvent *)
@@ -58,6 +19,8 @@ void MyWidget::paintEvent(QPaintEvent *)
QPainter painter(this);
painter.setClipRegion(r3);
- ... // paint clipped graphics
+ // ... // paint clipped graphics
}
//! [0]
+
+} // src_gui_painting_qregion
diff --git a/src/gui/doc/snippets/code/src_gui_painting_qregion_unix.cpp b/src/gui/doc/snippets/code/src_gui_painting_qregion_unix.cpp
index ab22507c4f..26a95566d4 100644
--- a/src/gui/doc/snippets/code/src_gui_painting_qregion_unix.cpp
+++ b/src/gui/doc/snippets/code/src_gui_painting_qregion_unix.cpp
@@ -1,53 +1,10 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the documentation of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:BSD$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** BSD License Usage
-** Alternatively, you may use this file under the terms of the BSD license
-** as follows:
-**
-** "Redistribution and use in source and binary forms, with or without
-** modification, are permitted provided that the following conditions are
-** met:
-** * Redistributions of source code must retain the above copyright
-** notice, this list of conditions and the following disclaimer.
-** * Redistributions in binary form must reproduce the above copyright
-** notice, this list of conditions and the following disclaimer in
-** the documentation and/or other materials provided with the
-** distribution.
-** * Neither the name of The Qt Company Ltd nor the names of its
-** contributors may be used to endorse or promote products derived
-** from this software without specific prior written permission.
-**
-**
-** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause
+#include <QRegion>
+namespace src_gui_painting_qregion_unix {
+
+void wrapper() {
//! [0]
QRegion r1(10, 10, 20, 20);
r1.isEmpty(); // false
@@ -62,3 +19,6 @@ r3.isEmpty(); // true
r3 = r1.united(r2); // r3: union of r1 and r2
r3.isEmpty(); // false
//! [0]
+
+} // wrapper
+} // src_gui_painting_qregion_unix
diff --git a/src/gui/doc/snippets/code/src_gui_painting_qtransform.cpp b/src/gui/doc/snippets/code/src_gui_painting_qtransform.cpp
index 4acc2f12b7..fbc6d9add8 100644
--- a/src/gui/doc/snippets/code/src_gui_painting_qtransform.cpp
+++ b/src/gui/doc/snippets/code/src_gui_painting_qtransform.cpp
@@ -1,57 +1,13 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the documentation of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:BSD$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** BSD License Usage
-** Alternatively, you may use this file under the terms of the BSD license
-** as follows:
-**
-** "Redistribution and use in source and binary forms, with or without
-** modification, are permitted provided that the following conditions are
-** met:
-** * Redistributions of source code must retain the above copyright
-** notice, this list of conditions and the following disclaimer.
-** * Redistributions in binary form must reproduce the above copyright
-** notice, this list of conditions and the following disclaimer in
-** the documentation and/or other materials provided with the
-** distribution.
-** * Neither the name of The Qt Company Ltd nor the names of its
-** contributors may be used to endorse or promote products derived
-** from this software without specific prior written permission.
-**
-**
-** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause
+
+namespace src_gui_painting_qtransform {
+/* wrap non-code snippets
//! [0]
x' = m11*x + m21*y + dx
y' = m22*y + m12*x + dy
-if (is not affine) {
+if (!isAffine()) {
w' = m13*x + m23*y + m33
x' /= w'
y' /= w'
@@ -62,7 +18,7 @@ if (is not affine) {
//! [1]
x' = m11*x + m21*y + dx
y' = m22*y + m12*x + dy
-if (is not affine) {
+if (!isAffine()) {
w' = m13*x + m23*y + m33
x' /= w'
y' /= w'
@@ -73,7 +29,7 @@ if (is not affine) {
//! [2]
x' = m11*x + m21*y + dx
y' = m22*y + m12*x + dy
-if (is not affine) {
+if (!isAffine()) {
w' = m13*x + m23*y + m33
x' /= w'
y' /= w'
@@ -84,9 +40,12 @@ if (is not affine) {
//! [3]
x' = m11*x + m21*y + dx
y' = m22*y + m12*x + dy
-if (is not affine) {
+if (!isAffine()) {
w' = m13*x + m23*y + m33
x' /= w'
y' /= w'
}
//! [3]
+
+*/ // wrap non-code snippets
+} // src_gui_painting_qtransform
diff --git a/src/gui/doc/snippets/code/src_gui_qopenglshaderprogram.cpp b/src/gui/doc/snippets/code/src_gui_qopenglshaderprogram.cpp
deleted file mode 100644
index 8e67a2270c..0000000000
--- a/src/gui/doc/snippets/code/src_gui_qopenglshaderprogram.cpp
+++ /dev/null
@@ -1,104 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the documentation of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:BSD$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** BSD License Usage
-** Alternatively, you may use this file under the terms of the BSD license
-** as follows:
-**
-** "Redistribution and use in source and binary forms, with or without
-** modification, are permitted provided that the following conditions are
-** met:
-** * Redistributions of source code must retain the above copyright
-** notice, this list of conditions and the following disclaimer.
-** * Redistributions in binary form must reproduce the above copyright
-** notice, this list of conditions and the following disclaimer in
-** the documentation and/or other materials provided with the
-** distribution.
-** * Neither the name of The Qt Company Ltd nor the names of its
-** contributors may be used to endorse or promote products derived
-** from this software without specific prior written permission.
-**
-**
-** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-//! [0]
-QOpenGLShader shader(QOpenGLShader::Vertex);
-shader.compileSourceCode(code);
-
-QOpenGLShaderProgram program(context);
-program.addShader(&shader);
-program.link();
-
-program.bind();
-//! [0]
-
-//! [1]
-program.addShaderFromSourceCode(QOpenGLShader::Vertex,
- "attribute highp vec4 vertex;\n"
- "uniform highp mat4 matrix;\n"
- "void main(void)\n"
- "{\n"
- " gl_Position = matrix * vertex;\n"
- "}");
-program.addShaderFromSourceCode(QOpenGLShader::Fragment,
- "uniform mediump vec4 color;\n"
- "void main(void)\n"
- "{\n"
- " gl_FragColor = color;\n"
- "}");
-program.link();
-program.bind();
-
-int vertexLocation = program.attributeLocation("vertex");
-int matrixLocation = program.uniformLocation("matrix");
-int colorLocation = program.uniformLocation("color");
-//! [1]
-
-//! [2]
-static GLfloat const triangleVertices[] = {
- 60.0f, 10.0f, 0.0f,
- 110.0f, 110.0f, 0.0f,
- 10.0f, 110.0f, 0.0f
-};
-
-QColor color(0, 255, 0, 255);
-
-QMatrix4x4 pmvMatrix;
-pmvMatrix.ortho(rect());
-
-program.enableAttributeArray(vertexLocation);
-program.setAttributeArray(vertexLocation, triangleVertices, 3);
-program.setUniformValue(matrixLocation, pmvMatrix);
-program.setUniformValue(colorLocation, color);
-
-glDrawArrays(GL_TRIANGLES, 0, 3);
-
-program.disableAttributeArray(vertexLocation);
-//! [2]
diff --git a/src/gui/doc/snippets/code/src_gui_text_qfont.cpp b/src/gui/doc/snippets/code/src_gui_text_qfont.cpp
index 1901ca9b10..d62730e918 100644
--- a/src/gui/doc/snippets/code/src_gui_text_qfont.cpp
+++ b/src/gui/doc/snippets/code/src_gui_text_qfont.cpp
@@ -1,53 +1,12 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the documentation of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:BSD$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** BSD License Usage
-** Alternatively, you may use this file under the terms of the BSD license
-** as follows:
-**
-** "Redistribution and use in source and binary forms, with or without
-** modification, are permitted provided that the following conditions are
-** met:
-** * Redistributions of source code must retain the above copyright
-** notice, this list of conditions and the following disclaimer.
-** * Redistributions in binary form must reproduce the above copyright
-** notice, this list of conditions and the following disclaimer in
-** the documentation and/or other materials provided with the
-** distribution.
-** * Neither the name of The Qt Company Ltd nor the names of its
-** contributors may be used to endorse or promote products derived
-** from this software without specific prior written permission.
-**
-**
-** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause
+#include <QFont>
+#include <QFontInfo>
+#include <QFontMetrics>
+namespace src_gui_text_qfont {
+
+void wrapper0() {
//! [0]
QFont serifFont("Times", 10, QFont::Bold);
QFont sansFont("Helvetica [Cronyx]", 12);
@@ -58,7 +17,11 @@ QFont sansFont("Helvetica [Cronyx]", 12);
QFont f("Helvetica");
//! [1]
+} // wrapper0
+
+void wrapper1() {
+QFont f1;
//! [2]
QFont f("Helvetica [Cronyx]");
//! [2]
@@ -75,3 +38,8 @@ QFontMetrics fm(f1);
int textWidthInPixels = fm.horizontalAdvance("How many pixels wide is this text?");
int textHeightInPixels = fm.height();
//! [4]
+
+Q_UNUSED(textWidthInPixels);
+Q_UNUSED(textHeightInPixels);
+} // wrapper
+} // src_gui_text_qfont
diff --git a/src/gui/doc/snippets/code/src_gui_text_qfontmetrics.cpp b/src/gui/doc/snippets/code/src_gui_text_qfontmetrics.cpp
index 6b478d3297..4650ad8d8f 100644
--- a/src/gui/doc/snippets/code/src_gui_text_qfontmetrics.cpp
+++ b/src/gui/doc/snippets/code/src_gui_text_qfontmetrics.cpp
@@ -1,64 +1,33 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the documentation of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:BSD$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** BSD License Usage
-** Alternatively, you may use this file under the terms of the BSD license
-** as follows:
-**
-** "Redistribution and use in source and binary forms, with or without
-** modification, are permitted provided that the following conditions are
-** met:
-** * Redistributions of source code must retain the above copyright
-** notice, this list of conditions and the following disclaimer.
-** * Redistributions in binary form must reproduce the above copyright
-** notice, this list of conditions and the following disclaimer in
-** the documentation and/or other materials provided with the
-** distribution.
-** * Neither the name of The Qt Company Ltd nor the names of its
-** contributors may be used to endorse or promote products derived
-** from this software without specific prior written permission.
-**
-**
-** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause
+#include <QFont>
+#include <QFontMetrics>
+namespace src_gui_text_qfontmetrics {
+
+void wrapper0() {
//! [0]
QFont font("times", 24);
QFontMetrics fm(font);
-int pixelsWide = fm.horizontalAdvance("What's the width of this text?");
+int pixelsWide = fm.horizontalAdvance("What's the advance width of this text?");
int pixelsHigh = fm.height();
//! [0]
+Q_UNUSED(pixelsWide);
+Q_UNUSED(pixelsHigh);
+} // wrapper0
+
+void wrapper1() {
//! [1]
QFont font("times", 24);
QFontMetricsF fm(font);
-qreal pixelsWide = fm.horizontalAdvance("What's the width of this text?");
+qreal pixelsWide = fm.horizontalAdvance("What's the advance width of this text?");
qreal pixelsHigh = fm.height();
//! [1]
+
+Q_UNUSED(pixelsWide);
+Q_UNUSED(pixelsHigh);
+} // wrapper1
+
+} //src_gui_text_qfontmetrics
diff --git a/src/gui/doc/snippets/code/src_gui_text_qsyntaxhighlighter.cpp b/src/gui/doc/snippets/code/src_gui_text_qsyntaxhighlighter.cpp
index bb27eb9612..fa4798ea04 100644
--- a/src/gui/doc/snippets/code/src_gui_text_qsyntaxhighlighter.cpp
+++ b/src/gui/doc/snippets/code/src_gui_text_qsyntaxhighlighter.cpp
@@ -1,52 +1,23 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the documentation of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:BSD$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** BSD License Usage
-** Alternatively, you may use this file under the terms of the BSD license
-** as follows:
-**
-** "Redistribution and use in source and binary forms, with or without
-** modification, are permitted provided that the following conditions are
-** met:
-** * Redistributions of source code must retain the above copyright
-** notice, this list of conditions and the following disclaimer.
-** * Redistributions in binary form must reproduce the above copyright
-** notice, this list of conditions and the following disclaimer in
-** the documentation and/or other materials provided with the
-** distribution.
-** * Neither the name of The Qt Company Ltd nor the names of its
-** contributors may be used to endorse or promote products derived
-** from this software without specific prior written permission.
-**
-**
-** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause
+#include <QChar>
+#include <QList>
+#include <QRegularExpression>
+#include <QSyntaxHighlighter>
+#include <QTextBlockUserData>
+#include <QTextEdit>
+#include <QTextObject>
+
+namespace src_gui_text_qsyntaxhighlighter {
+struct MyHighlighter : public QSyntaxHighlighter
+{
+ explicit MyHighlighter(QTextDocument *document) : QSyntaxHighlighter(document) { Q_UNUSED(document); }
+
+ void highlightBlock(const QString &text);
+ void wrapper();
+
+ QString text;
+};
//! [0]
QTextEdit *editor = new QTextEdit;
@@ -63,15 +34,14 @@ void MyHighlighter::highlightBlock(const QString &text)
QRegularExpression expression("\\bMy[A-Za-z]+\\b");
QRegularExpressionMatchIterator i = expression.globalMatch(text);
- while (i.hasNext())
- {
- QRegularExpressionMatch match = i.next();
- setFormat(match.capturedStart(), match.capturedLength(), myClassFormat);
+ while (i.hasNext()) {
+ QRegularExpressionMatch match = i.next();
+ setFormat(match.capturedStart(), match.capturedLength(), myClassFormat);
}
}
//! [1]
-
+void MyHighlighter::wrapper() {
//! [2]
QTextCharFormat multiLineCommentFormat;
multiLineCommentFormat.setForeground(Qt::red);
@@ -86,32 +56,35 @@ if (previousBlockState() != 1)
startIndex = text.indexOf(startExpression);
while (startIndex >= 0) {
- QRegularExpressionMatch endMatch;
- int endIndex = text.indexOf(endExpression, startIndex, &endMatch);
- int commentLength;
- if (endIndex == -1) {
- setCurrentBlockState(1);
- commentLength = text.length() - startIndex;
- } else {
- commentLength = endIndex - startIndex
- + endMatch.capturedLength();
- }
- setFormat(startIndex, commentLength, multiLineCommentFormat);
- startIndex = text.indexOf(startExpression,
- startIndex + commentLength);
+ QRegularExpressionMatch endMatch;
+ int endIndex = text.indexOf(endExpression, startIndex, &endMatch);
+ int commentLength;
+ if (endIndex == -1) {
+ setCurrentBlockState(1);
+ commentLength = text.length() - startIndex;
+ } else {
+ commentLength = endIndex - startIndex
+ + endMatch.capturedLength();
+ }
+ setFormat(startIndex, commentLength, multiLineCommentFormat);
+ startIndex = text.indexOf(startExpression,
+ startIndex + commentLength);
}
//! [2]
+} // MyHighlighter::wrapper
//! [3]
struct ParenthesisInfo
{
- QChar char;
+ QChar character;
int position;
};
struct BlockData : public QTextBlockUserData
{
- QVector<ParenthesisInfo> parentheses;
+ QList<ParenthesisInfo> parentheses;
};
//! [3]
+
+} // src_gui_text_qsyntaxhighlighter
diff --git a/src/gui/doc/snippets/code/src_gui_text_qtextcursor.cpp b/src/gui/doc/snippets/code/src_gui_text_qtextcursor.cpp
index d66cc1407f..1438474b98 100644
--- a/src/gui/doc/snippets/code/src_gui_text_qtextcursor.cpp
+++ b/src/gui/doc/snippets/code/src_gui_text_qtextcursor.cpp
@@ -1,52 +1,15 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the documentation of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:BSD$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** BSD License Usage
-** Alternatively, you may use this file under the terms of the BSD license
-** as follows:
-**
-** "Redistribution and use in source and binary forms, with or without
-** modification, are permitted provided that the following conditions are
-** met:
-** * Redistributions of source code must retain the above copyright
-** notice, this list of conditions and the following disclaimer.
-** * Redistributions in binary form must reproduce the above copyright
-** notice, this list of conditions and the following disclaimer in
-** the documentation and/or other materials provided with the
-** distribution.
-** * Neither the name of The Qt Company Ltd nor the names of its
-** contributors may be used to endorse or promote products derived
-** from this software without specific prior written permission.
-**
-**
-** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause
+#include <QImage>
+#include <QTextCursor>
+#include <QTextDocument>
+
+namespace src_gui_text_qtextcursor {
+QTextDocument *textDocument = nullptr;
+
+void wrapper0() {
+QTextCursor cursor;
+
//! [0]
cursor.clearSelection();
@@ -56,12 +19,15 @@ cursor.insertText("Hello World");
//! [1]
-QImage img = ...
+QImage img;
textDocument->addResource(QTextDocument::ImageResource, QUrl("myimage"), img);
cursor.insertImage("myimage");
//! [1]
+} // wrapper0
+
+void wrapper1() {
//! [2]
QTextCursor cursor(textDocument);
cursor.beginEditBlock();
@@ -71,8 +37,10 @@ cursor.endEditBlock();
textDocument->undo();
//! [2]
+} // wrapper1
+void wrapper2() {
//! [3]
QTextCursor cursor(textDocument);
cursor.beginEditBlock();
@@ -80,7 +48,7 @@ cursor.insertText("Hello");
cursor.insertText("World");
cursor.endEditBlock();
-...
+// ...
cursor.joinPreviousEditBlock();
cursor.insertText("Hey");
@@ -88,3 +56,6 @@ cursor.endEditBlock();
textDocument->undo();
//! [3]
+} // wrapper2
+
+} // src_gui_text_qtextcursor
diff --git a/src/gui/doc/snippets/code/src_gui_text_qtextdocument.cpp b/src/gui/doc/snippets/code/src_gui_text_qtextdocument.cpp
deleted file mode 100644
index 66a8bc7b5e..0000000000
--- a/src/gui/doc/snippets/code/src_gui_text_qtextdocument.cpp
+++ /dev/null
@@ -1,53 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the documentation of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:BSD$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** BSD License Usage
-** Alternatively, you may use this file under the terms of the BSD license
-** as follows:
-**
-** "Redistribution and use in source and binary forms, with or without
-** modification, are permitted provided that the following conditions are
-** met:
-** * Redistributions of source code must retain the above copyright
-** notice, this list of conditions and the following disclaimer.
-** * Redistributions in binary form must reproduce the above copyright
-** notice, this list of conditions and the following disclaimer in
-** the documentation and/or other materials provided with the
-** distribution.
-** * Neither the name of The Qt Company Ltd nor the names of its
-** contributors may be used to endorse or promote products derived
-** from this software without specific prior written permission.
-**
-**
-** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-//! [0]
-<html><head><meta http-equiv="Content-Type" content="text/html; charset=utf-8"></head><body>...
-//! [0]
diff --git a/src/gui/doc/snippets/code/src_gui_text_qtextdocumentwriter.cpp b/src/gui/doc/snippets/code/src_gui_text_qtextdocumentwriter.cpp
index 06aab74e10..a55857cb88 100644
--- a/src/gui/doc/snippets/code/src_gui_text_qtextdocumentwriter.cpp
+++ b/src/gui/doc/snippets/code/src_gui_text_qtextdocumentwriter.cpp
@@ -1,55 +1,14 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the documentation of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:BSD$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** BSD License Usage
-** Alternatively, you may use this file under the terms of the BSD license
-** as follows:
-**
-** "Redistribution and use in source and binary forms, with or without
-** modification, are permitted provided that the following conditions are
-** met:
-** * Redistributions of source code must retain the above copyright
-** notice, this list of conditions and the following disclaimer.
-** * Redistributions in binary form must reproduce the above copyright
-** notice, this list of conditions and the following disclaimer in
-** the documentation and/or other materials provided with the
-** distribution.
-** * Neither the name of The Qt Company Ltd nor the names of its
-** contributors may be used to endorse or promote products derived
-** from this software without specific prior written permission.
-**
-**
-** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause
+#include <QTextDocumentWriter>
+namespace src_gui_text_qtextdocumentwriter {
+
+void wrapper() {
//! [0]
QTextDocumentWriter writer;
writer.setFormat("odf"); // same as writer.setFormat("ODF");
//! [0]
+} // wrapper
+} // src_gui_text_qtextdocumentwriter
diff --git a/src/gui/doc/snippets/code/src_gui_text_qtextlayout.cpp b/src/gui/doc/snippets/code/src_gui_text_qtextlayout.cpp
index 4244f0ce6d..70ec6b01ea 100644
--- a/src/gui/doc/snippets/code/src_gui_text_qtextlayout.cpp
+++ b/src/gui/doc/snippets/code/src_gui_text_qtextlayout.cpp
@@ -1,59 +1,31 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the documentation of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:BSD$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** BSD License Usage
-** Alternatively, you may use this file under the terms of the BSD license
-** as follows:
-**
-** "Redistribution and use in source and binary forms, with or without
-** modification, are permitted provided that the following conditions are
-** met:
-** * Redistributions of source code must retain the above copyright
-** notice, this list of conditions and the following disclaimer.
-** * Redistributions in binary form must reproduce the above copyright
-** notice, this list of conditions and the following disclaimer in
-** the documentation and/or other materials provided with the
-** distribution.
-** * Neither the name of The Qt Company Ltd nor the names of its
-** contributors may be used to endorse or promote products derived
-** from this software without specific prior written permission.
-**
-**
-** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause
+#include <QFont>
+#include <QFontMetrics>
+#include <QPainter>
+#include <QTextLayout>
+#include <QTextLine>
+
+namespace src_gui_text_qtextlayout {
+struct Wrapper : public QPaintDevice
+{
+ void wrapper1();
+ void elided();
+};
+QTextLayout textLayout;
+
+
+void wrapper0() {
+qreal lineWidth = 0;
+QFont aFont;
+QFontMetrics fontMetrics(aFont);
//! [0]
int leading = fontMetrics.leading();
qreal height = 0;
textLayout.setCacheEnabled(true);
textLayout.beginLayout();
-while (1) {
+while (true) {
QTextLine line = textLayout.createLine();
if (!line.isValid())
break;
@@ -66,8 +38,53 @@ while (1) {
textLayout.endLayout();
//! [0]
+} // wrapper0
+
+
+void Wrapper::wrapper1() {
//! [1]
QPainter painter(this);
textLayout.draw(&painter, QPoint(0, 0));
//! [1]
+
+} // Wrapper::wrapper1
+
+void Wrapper::elided() {
+
+QString content;
+
+//! [elided]
+QPainter painter(this);
+QFontMetrics fontMetrics = painter.fontMetrics();
+
+int lineSpacing = fontMetrics.lineSpacing();
+int y = 0;
+
+QTextLayout textLayout(content, painter.font());
+textLayout.beginLayout();
+while (true) {
+ QTextLine line = textLayout.createLine();
+
+ if (!line.isValid())
+ break;
+
+ line.setLineWidth(width());
+ const int nextLineY = y + lineSpacing;
+
+ if (height() >= nextLineY + lineSpacing) {
+ line.draw(&painter, QPoint(0, y));
+ y = nextLineY;
+ } else {
+ const QString lastLine = content.mid(line.textStart());
+ const QString elidedLastLine = fontMetrics.elidedText(lastLine, Qt::ElideRight, width());
+ painter.drawText(QPoint(0, y + fontMetrics.ascent()), elidedLastLine);
+ line = textLayout.createLine();
+ break;
+ }
+}
+textLayout.endLayout();
+//! [elided]
+}
+
+} // src_gui_text_qtextlayout
diff --git a/src/gui/doc/snippets/code/src_gui_util_qdesktopservices.cpp b/src/gui/doc/snippets/code/src_gui_util_qdesktopservices.cpp
index b9a8d8d90e..13deb88bc8 100644
--- a/src/gui/doc/snippets/code/src_gui_util_qdesktopservices.cpp
+++ b/src/gui/doc/snippets/code/src_gui_util_qdesktopservices.cpp
@@ -1,73 +1,48 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the documentation of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:BSD$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** BSD License Usage
-** Alternatively, you may use this file under the terms of the BSD license
-** as follows:
-**
-** "Redistribution and use in source and binary forms, with or without
-** modification, are permitted provided that the following conditions are
-** met:
-** * Redistributions of source code must retain the above copyright
-** notice, this list of conditions and the following disclaimer.
-** * Redistributions in binary form must reproduce the above copyright
-** notice, this list of conditions and the following disclaimer in
-** the documentation and/or other materials provided with the
-** distribution.
-** * Neither the name of The Qt Company Ltd nor the names of its
-** contributors may be used to endorse or promote products derived
-** from this software without specific prior written permission.
-**
-**
-** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause
+#include <QDesktopServices>
+#include <QObject>
+#include <QStandardPaths>
+#include <QUrl>
+
+namespace src_gui_util_qdesktopservices {
//! [0]
class MyHelpHandler : public QObject
{
Q_OBJECT
public:
- ...
+ // ...
public slots:
void showHelp(const QUrl &url);
};
+//! [0]
+void wrapper0() {
+MyHelpHandler *helpInstance = nullptr;
+//! [setUrlHandler]
QDesktopServices::setUrlHandler("help", helpInstance, "showHelp");
-//! [0]
+//! [setUrlHandler]
+} // wrapper
+
+
+/* comment wrapper 1
//! [1]
mailto:user@foo.com?subject=Test&body=Just a test
//! [1]
+*/ // comment wrapper 1
+
+
+void wrapper1() {
//! [2]
-QDesktopServices::openUrl(QUrl("file:///C:/Documents and Settings/All Users/Desktop", QUrl::TolerantMode));
+QDesktopServices::openUrl(QUrl("file:///C:/Program Files", QUrl::TolerantMode));
//! [2]
+}
+
+
+/* comment wrapper 2
//! [3]
<key>LSApplicationQueriesSchemes</key>
@@ -88,11 +63,56 @@ QDesktopServices::openUrl(QUrl("file:///C:/Documents and Settings/All Users/Desk
</array>
//! [4]
-//! [5]
-QDesktopServices::storageLocation(QDesktopServices::DataLocation)
-//! [5]
+*/ // comment wrapper 2
+
+/* comment wrapper 3
+//! [7]
+<key>com.apple.developer.associated-domains</key>
+<array>
+ <string>applinks:your.domain.com</string>
+</array>
+//! [7]
+
+//! [8]
+{
+ "applinks": {
+ "apps": [],
+ "details": [{
+ "appIDs" : [ "ABCDE12345.com.example.app" ],
+ "components": [{
+ "/": "/help",
+ "?": { "topic": "?*"}
+ }]
+ }]
+ }
+}
+//! [8]
+
+//! [9]
+<intent-filter>
+ <action android:name="android.intent.action.VIEW" />
+ <category android:name="android.intent.category.DEFAULT" />
+ <category android:name="android.intent.category.BROWSABLE" />
+ <data android:scheme="https" android:host="your.domain.com" android:port="1337" android:path="/help"/>
+</intent-filter>
+//! [9]
+
+//! [10]
+<intent-filter android:autoVerify="true">
+//! [10]
+
+//! [11]
+[{
+ "relation": ["delegate_permission/common.handle_all_urls"],
+ "target": {
+ "namespace": "android_app",
+ "package_name": "com.example.app",
+ "sha256_cert_fingerprints":
+ ["14:6D:E9:83:C5:73:06:50:D8:EE:B9:95:2F:34:FC:64:16:A0:83:42:E6:1D:BE:A8:8A:04:96:B2:3F:CF:44:E5"]
+ }
+}]
+//! [11]
+
+*/ // comment wrapper 3
-//! [6]
-QStandardPaths::writableLocation(QStandardPaths::GenericDataLocation) +
- "/data/organization/application"
-//! [6]
+} // src_gui_util_qdesktopservices
diff --git a/src/gui/doc/snippets/code/src_gui_util_qundostack.cpp b/src/gui/doc/snippets/code/src_gui_util_qundostack.cpp
new file mode 100644
index 0000000000..fe3ced1d02
--- /dev/null
+++ b/src/gui/doc/snippets/code/src_gui_util_qundostack.cpp
@@ -0,0 +1,72 @@
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause
+
+//! [0]
+class AppendText : public QUndoCommand
+{
+public:
+ AppendText(QString *doc, const QString &text)
+ : m_document(doc), m_text(text) { setText("append text"); }
+ void undo() override
+ { m_document->chop(m_text.length()); }
+ void redo() override
+ { m_document->append(m_text); }
+private:
+ QString *m_document;
+ QString m_text;
+};
+//! [0]
+
+
+//! [1]
+MyCommand *command1 = new MyCommand();
+stack->push(command1);
+MyCommand *command2 = new MyCommand();
+stack->push(command2);
+
+stack->undo();
+
+MyCommand *command3 = new MyCommand();
+stack->push(command3); // command2 gets deleted
+//! [1]
+
+
+//! [2]
+QUndoCommand *insertRed = new QUndoCommand(); // an empty command
+insertRed->setText("insert red text");
+
+new InsertText(document, idx, text, insertRed); // becomes child of insertRed
+new SetColor(document, idx, text.length(), Qt::red, insertRed);
+
+stack.push(insertRed);
+//! [2]
+
+
+//! [3]
+bool AppendText::mergeWith(const QUndoCommand *other)
+{
+ if (other->id() != id()) // make sure other is also an AppendText command
+ return false;
+ m_text += static_cast<const AppendText*>(other)->m_text;
+ return true;
+}
+//! [3]
+
+
+//! [4]
+stack.beginMacro("insert red text");
+stack.push(new InsertText(document, idx, text));
+stack.push(new SetColor(document, idx, text.length(), Qt::red));
+stack.endMacro(); // indexChanged() is emitted
+//! [4]
+
+
+//! [5]
+QUndoCommand *insertRed = new QUndoCommand(); // an empty command
+insertRed->setText("insert red text");
+
+new InsertText(document, idx, text, insertRed); // becomes child of insertRed
+new SetColor(document, idx, text.length(), Qt::red, insertRed);
+
+stack.push(insertRed);
+//! [5]
diff --git a/src/gui/doc/snippets/code/src_gui_util_qvalidator.cpp b/src/gui/doc/snippets/code/src_gui_util_qvalidator.cpp
index cc73ad9a19..f562126ffd 100644
--- a/src/gui/doc/snippets/code/src_gui_util_qvalidator.cpp
+++ b/src/gui/doc/snippets/code/src_gui_util_qvalidator.cpp
@@ -1,53 +1,19 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the documentation of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:BSD$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** BSD License Usage
-** Alternatively, you may use this file under the terms of the BSD license
-** as follows:
-**
-** "Redistribution and use in source and binary forms, with or without
-** modification, are permitted provided that the following conditions are
-** met:
-** * Redistributions of source code must retain the above copyright
-** notice, this list of conditions and the following disclaimer.
-** * Redistributions in binary form must reproduce the above copyright
-** notice, this list of conditions and the following disclaimer in
-** the documentation and/or other materials provided with the
-** distribution.
-** * Neither the name of The Qt Company Ltd nor the names of its
-** contributors may be used to endorse or promote products derived
-** from this software without specific prior written permission.
-**
-**
-** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause
+#include <QLineEdit>
+#include <QValidator>
+#include <QWidget>
+
+namespace src_gui_util_qvalidator {
+
+struct Wrapper : public QWidget {
+ void wrapper0();
+ void wrapper1();
+ void wrapper2();
+ void wrapper3();
+};
+
+void Wrapper::wrapper0() {
//! [0]
QValidator *validator = new QIntValidator(100, 999, this);
QLineEdit *edit = new QLineEdit(this);
@@ -84,7 +50,11 @@ v.validate(str, pos); // returns Invalid
str = "12cm";
v.validate(str, pos); // returns Invalid
//! [1]
+} // Wrapper::wrapper0
+void Wrapper::wrapper1() {
+QString s;
+QIntValidator v(100, 900, this);
//! [2]
int pos = 0;
@@ -98,51 +68,10 @@ v.validate(s, pos); // returns Intermediate
s = "50";
v.validate(s, pos); // returns Acceptable
//! [2]
+} // Wrapper::wrapper1
-//! [3]
-// regexp: optional '-' followed by between 1 and 3 digits
-QRegExp rx("-?\\d{1,3}");
-QValidator *validator = new QRegExpValidator(rx, this);
-
-QLineEdit *edit = new QLineEdit(this);
-edit->setValidator(validator);
-//! [3]
-
-
-//! [4]
-// integers 1 to 9999
-QRegExp rx("[1-9]\\d{0,3}");
-// the validator treats the regexp as "^[1-9]\\d{0,3}$"
-QRegExpValidator v(rx, 0);
-QString s;
-int pos = 0;
-
-s = "0"; v.validate(s, pos); // returns Invalid
-s = "12345"; v.validate(s, pos); // returns Invalid
-s = "1"; v.validate(s, pos); // returns Acceptable
-
-rx.setPattern("\\S+"); // one or more non-whitespace characters
-v.setRegExp(rx);
-s = "myfile.txt"; v.validate(s, pos); // Returns Acceptable
-s = "my file.txt"; v.validate(s, pos); // Returns Invalid
-
-// A, B or C followed by exactly five digits followed by W, X, Y or Z
-rx.setPattern("[A-C]\\d{5}[W-Z]");
-v.setRegExp(rx);
-s = "a12345Z"; v.validate(s, pos); // Returns Invalid
-s = "A12345Z"; v.validate(s, pos); // Returns Acceptable
-s = "B12"; v.validate(s, pos); // Returns Intermediate
-
-// match most 'readme' files
-rx.setPattern("read\\S?me(\.(txt|asc|1st))?");
-rx.setCaseSensitive(false);
-v.setRegExp(rx);
-s = "readme"; v.validate(s, pos); // Returns Acceptable
-s = "README.1ST"; v.validate(s, pos); // Returns Acceptable
-s = "read me.txt"; v.validate(s, pos); // Returns Invalid
-s = "readm"; v.validate(s, pos); // Returns Intermediate
-//! [4]
+void Wrapper::wrapper2() {
//! [5]
// regexp: optional '-' followed by between 1 and 3 digits
@@ -178,7 +107,7 @@ s = "A12345Z"; v.validate(s, pos); // Returns Acceptable
s = "B12"; v.validate(s, pos); // Returns Intermediate
// match most 'readme' files
-re.setPattern("read\\S?me(\.(txt|asc|1st))?");
+re.setPattern("read\\S?me(\\.(txt|asc|1st))?");
re.setPatternOptions(QRegularExpression::CaseInsensitiveOption);
v.setRegularExpression(re);
s = "readme"; v.validate(s, pos); // Returns Acceptable
@@ -186,3 +115,25 @@ s = "README.1ST"; v.validate(s, pos); // Returns Acceptable
s = "read me.txt"; v.validate(s, pos); // Returns Invalid
s = "readm"; v.validate(s, pos); // Returns Intermediate
//! [6]
+
+} // Wrapper::wrapper2
+
+void Wrapper::wrapper3()
+{
+//! [7]
+QString input = "0.98765e2";
+QDoubleValidator val;
+val.setLocale(QLocale::C);
+val.setNotation(QDoubleValidator::ScientificNotation);
+val.fixup(input); // input == "9.8765e+01"
+//! [7]
+//! [8]
+input = "-1234.6789";
+val.setDecimals(2);
+val.setLocale(QLocale::C);
+val.setNotation(QDoubleValidator::StandardNotation);
+val.fixup(input); // input == "-1234.68"
+//! [8]
+} // Wrapper::wrapper3
+
+} // src_gui_util_qvalidator
diff --git a/src/gui/doc/snippets/code/src_gui_vulkan_qvulkanfunctions.cpp b/src/gui/doc/snippets/code/src_gui_vulkan_qvulkanfunctions.cpp
index 0d13873f38..700d933f43 100644
--- a/src/gui/doc/snippets/code/src_gui_vulkan_qvulkanfunctions.cpp
+++ b/src/gui/doc/snippets/code/src_gui_vulkan_qvulkanfunctions.cpp
@@ -1,70 +1,49 @@
-/****************************************************************************
-**
-** Copyright (C) 2018 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the documentation of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:BSD$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** BSD License Usage
-** Alternatively, you may use this file under the terms of the BSD license
-** as follows:
-**
-** "Redistribution and use in source and binary forms, with or without
-** modification, are permitted provided that the following conditions are
-** met:
-** * Redistributions of source code must retain the above copyright
-** notice, this list of conditions and the following disclaimer.
-** * Redistributions in binary form must reproduce the above copyright
-** notice, this list of conditions and the following disclaimer in
-** the documentation and/or other materials provided with the
-** distribution.
-** * Neither the name of The Qt Company Ltd nor the names of its
-** contributors may be used to endorse or promote products derived
-** from this software without specific prior written permission.
-**
-**
-** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2018 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause
+
+#include <QVulkanDeviceFunctions>
+#include <QVulkanFunctions>
+#include <QVulkanInstance>
+
+namespace src_gui_vulkan_qvulkanfunctions {
+
+struct Window {
+ void init();
+ QVulkanInstance *vulkanInstance() { return nullptr; }
+};
//! [0]
- void Window::render()
- {
- QVulkanInstance *inst = vulkanInstance();
- QVulkanFunctions *f = inst->functions();
- ...
- VkResult err = f->vkAllocateCommandBuffers(device, &cmdBufInfo, &cmdBuf);
- ...
- }
+void Window::init()
+{
+ QVulkanInstance *inst = vulkanInstance();
+ QVulkanFunctions *f = inst->functions();
+ // ...
+ uint32_t count = 0;
+ VkResult err = f->vkEnumeratePhysicalDevices(inst->vkInstance(), &count, nullptr);
+ // ...
+}
//! [0]
+} // namespace src_gui_vulkan_qvulkanfunctions {
+
+
+namespace src_gui_vulkan_qvulkanfunctions2 {
+struct Window {
+ void render();
+ QVulkanInstance *vulkanInstance() { return nullptr; }
+};
+VkDevice_T *device = nullptr;
+VkCommandBufferAllocateInfo cmdBufInfo;
+VkCommandBuffer cmdBuf;
+
//! [1]
- void Window::render()
- {
- QVulkanInstance *inst = vulkanInstance();
- QVulkanDeviceFunctions *df = inst->deviceFunctions(device);
- VkResult err = df->vkAllocateCommandBuffers(device, &cmdBufInfo, &cmdBuf);
- ...
- }
+void Window::render()
+{
+ QVulkanInstance *inst = vulkanInstance();
+ QVulkanDeviceFunctions *df = inst->deviceFunctions(device);
+ VkResult err = df->vkAllocateCommandBuffers(device, &cmdBufInfo, &cmdBuf);
+ // ...
+}
//! [1]
+
+} // src_gui_vulkan_qvulkanfunctions2
diff --git a/src/gui/doc/snippets/code/src_gui_vulkan_qvulkaninstance.cpp b/src/gui/doc/snippets/code/src_gui_vulkan_qvulkaninstance.cpp
index 14ef9ed2d4..bfb7c7c3a4 100644
--- a/src/gui/doc/snippets/code/src_gui_vulkan_qvulkaninstance.cpp
+++ b/src/gui/doc/snippets/code/src_gui_vulkan_qvulkaninstance.cpp
@@ -1,52 +1,19 @@
-/****************************************************************************
-**
-** Copyright (C) 2018 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the documentation of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:BSD$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** BSD License Usage
-** Alternatively, you may use this file under the terms of the BSD license
-** as follows:
-**
-** "Redistribution and use in source and binary forms, with or without
-** modification, are permitted provided that the following conditions are
-** met:
-** * Redistributions of source code must retain the above copyright
-** notice, this list of conditions and the following disclaimer.
-** * Redistributions in binary form must reproduce the above copyright
-** notice, this list of conditions and the following disclaimer in
-** the documentation and/or other materials provided with the
-** distribution.
-** * Neither the name of The Qt Company Ltd nor the names of its
-** contributors may be used to endorse or promote products derived
-** from this software without specific prior written permission.
-**
-**
-** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2018 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause
+
+#include <QGuiApplication>
+#include <QVulkanFunctions>
+#include <QVulkanInstance>
+#include <QWindow>
+
+namespace src_gui_vulkan_qvulkaninstance {
+
+struct Window {
+ void setVulkanInstance(QVulkanInstance *instance) { Q_UNUSED(instance); }
+ void show();
+};
+Window *window = nullptr;
+
//! [0]
int main(int argc, char **argv)
@@ -57,7 +24,7 @@
if (!inst.create())
return 1;
- ...
+ // ...
window->setVulkanInstance(&inst);
window->show();
@@ -65,82 +32,100 @@
}
//! [0]
+
+void wrapper0() {
//! [1]
QVulkanInstance inst;
// Enable validation layer, if supported. Messages go to qDebug by default.
- inst.setLayers(QByteArrayList() << "VK_LAYER_LUNARG_standard_validation");
+ inst.setLayers({ "VK_LAYER_KHRONOS_validation" });
bool ok = inst.create();
- if (!ok)
- ... // Vulkan not available
- if (!inst.layers().contains("VK_LAYER_LUNARG_standard_validation"))
- ... // validation layer not available
+ if (!ok) {
+ // ... Vulkan not available
+ }
+
+ if (!inst.layers().contains("VK_LAYER_KHRONOS_validation")) {
+ // ... validation layer not available
+ }
//! [1]
+}
+
+void wrapper1() {
//! [2]
QVulkanInstance inst;
- if (inst.supportedLayers().contains("VK_LAYER_LUNARG_standard_validation"))
- ...
-
+ if (inst.supportedLayers().contains("VK_LAYER_KHRONOS_validation")) {
+ // ...
+ }
bool ok = inst.create();
- ...
+ // ...
//! [2]
+Q_UNUSED(ok);
+} // wrapper1
+} // src_gui_vulkan_qvulkaninstance
+
+
+namespace src_gui_vulkan_qvulkaninstance2 {
+
//! [3]
- class VulkanWindow : public QWindow
- {
- public:
- VulkanWindow() {
- setSurfaceType(VulkanSurface);
- }
+class VulkanWindow : public QWindow
+{
+public:
+ VulkanWindow() {
+ setSurfaceType(VulkanSurface);
+ }
- void exposeEvent(QExposeEvent *) {
- if (isExposed()) {
- if (!m_initialized) {
- m_initialized = true;
- // initialize device, swapchain, etc.
- QVulkanInstance *inst = vulkanInstance();
- QVulkanFunctions *f = inst->functions();
- uint32_t devCount = 0;
- f->vkEnumeratePhysicalDevices(inst->vkInstance(), &devCount, nullptr);
- ...
- // build the first frame
- render();
- }
+ void exposeEvent(QExposeEvent *) {
+ if (isExposed()) {
+ if (!m_initialized) {
+ m_initialized = true;
+ // initialize device, swapchain, etc.
+ QVulkanInstance *inst = vulkanInstance();
+ QVulkanFunctions *f = inst->functions();
+ uint32_t devCount = 0;
+ f->vkEnumeratePhysicalDevices(inst->vkInstance(), &devCount, nullptr);
+ // ...
+ // build the first frame
+ render();
}
}
+ }
- bool event(QEvent *e) {
- if (e->type() == QEvent::UpdateRequest)
- render();
- return QWindow::event(e);
- }
+ bool event(QEvent *e) {
+ if (e->type() == QEvent::UpdateRequest)
+ render();
+ return QWindow::event(e);
+ }
- void render() {
- ...
- requestUpdate(); // render continuously
- }
+ void render() {
+ // ...
+ requestUpdate(); // render continuously
+ }
- private:
- bool m_initialized = false;
- };
+private:
+ bool m_initialized = false;
+};
- int main(int argc, char **argv)
- {
- QGuiApplication app(argc, argv);
+int main(int argc, char **argv)
+{
+ QGuiApplication app(argc, argv);
- QVulkanInstance inst;
- if (!inst.create()) {
- qWarning("Vulkan not available");
- return 1;
- }
+ QVulkanInstance inst;
+ if (!inst.create()) {
+ qWarning("Vulkan not available");
+ return 1;
+ }
- VulkanWindow window;
- window.showMaximized();
+ VulkanWindow window;
+ window.showMaximized();
- return app.exec();
+ return app.exec();
- }
+}
//! [3]
+
+
+} // src_gui_vulkan_qvulkaninstance2
diff --git a/src/gui/doc/snippets/code/src_gui_vulkan_qvulkanwindow.cpp b/src/gui/doc/snippets/code/src_gui_vulkan_qvulkanwindow.cpp
index 81d51233a3..7f9abb638e 100644
--- a/src/gui/doc/snippets/code/src_gui_vulkan_qvulkanwindow.cpp
+++ b/src/gui/doc/snippets/code/src_gui_vulkan_qvulkanwindow.cpp
@@ -1,132 +1,105 @@
-/****************************************************************************
-**
-** Copyright (C) 2018 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the documentation of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:BSD$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** BSD License Usage
-** Alternatively, you may use this file under the terms of the BSD license
-** as follows:
-**
-** "Redistribution and use in source and binary forms, with or without
-** modification, are permitted provided that the following conditions are
-** met:
-** * Redistributions of source code must retain the above copyright
-** notice, this list of conditions and the following disclaimer.
-** * Redistributions in binary form must reproduce the above copyright
-** notice, this list of conditions and the following disclaimer in
-** the documentation and/or other materials provided with the
-** distribution.
-** * Neither the name of The Qt Company Ltd nor the names of its
-** contributors may be used to endorse or promote products derived
-** from this software without specific prior written permission.
-**
-**
-** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2018 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause
+#include <QGuiApplication>
+#include <QVulkanDeviceFunctions>
+#include <QVulkanWindow>
+namespace src_gui_vulkan_qvulkanwindow {
+VkCommandBuffer commandBuffer;
+const VkRenderPassBeginInfo *renderPassBegin = nullptr;
+VkSubpassContents contents;
//! [0]
- class VulkanRenderer : public QVulkanWindowRenderer
- {
- public:
- VulkanRenderer(QVulkanWindow *w) : m_window(w) { }
-
- void initResources() override
- {
- m_devFuncs = m_window->vulkanInstance()->deviceFunctions(m_window->device());
- ...
- }
- void initSwapChainResources() override { ... }
- void releaseSwapChainResources() override { ... }
- void releaseResources() override { ... }
-
- void startNextFrame() override
- {
- VkCommandBuffer cmdBuf = m_window->currentCommandBuffer();
- ...
- m_devFuncs->vkCmdBeginRenderPass(...);
- ...
- m_window->frameReady();
- }
-
- private:
- QVulkanWindow *m_window;
- QVulkanDeviceFunctions *m_devFuncs;
- };
-
- class VulkanWindow : public QVulkanWindow
- {
- public:
- QVulkanWindowRenderer *createRenderer() override {
- return new VulkanRenderer(this);
- }
- };
-
- int main(int argc, char *argv[])
- {
- QGuiApplication app(argc, argv);
-
- QVulkanInstance inst;
- // enable the standard validation layers, when available
- inst.setLayers(QByteArrayList() << "VK_LAYER_LUNARG_standard_validation");
- if (!inst.create())
- qFatal("Failed to create Vulkan instance: %d", inst.errorCode());
-
- VulkanWindow w;
- w.setVulkanInstance(&inst);
- w.showMaximized();
-
- return app.exec();
- }
+class VulkanRenderer : public QVulkanWindowRenderer
+{
+public:
+ VulkanRenderer(QVulkanWindow *w) : m_window(w), m_devFuncs(nullptr) { }
+
+ void initResources() override
+ {
+ m_devFuncs = m_window->vulkanInstance()->deviceFunctions(m_window->device());
+ // ..
+ }
+ void initSwapChainResources() override { /* ... */ }
+ void releaseSwapChainResources() override { /* ... */ }
+ void releaseResources() override { /* ... */ }
+
+ void startNextFrame() override
+ {
+ VkCommandBuffer cmdBuf = m_window->currentCommandBuffer();
+ // ...
+ m_devFuncs->vkCmdBeginRenderPass(commandBuffer, renderPassBegin, contents);
+ // ...
+ m_window->frameReady();
+ }
+
+private:
+ QVulkanWindow *m_window;
+ QVulkanDeviceFunctions *m_devFuncs;
+};
+
+class VulkanWindow : public QVulkanWindow
+{
+public:
+ QVulkanWindowRenderer *createRenderer() override {
+ return new VulkanRenderer(this);
+ }
+};
+
+int main(int argc, char *argv[])
+{
+ QGuiApplication app(argc, argv);
+
+ QVulkanInstance inst;
+ // enable the standard validation layers, when available
+ inst.setLayers({ "VK_LAYER_KHRONOS_validation" });
+ if (!inst.create())
+ qFatal("Failed to create Vulkan instance: %d", inst.errorCode());
+
+ VulkanWindow w;
+ w.setVulkanInstance(&inst);
+ w.showMaximized();
+
+ return app.exec();
+}
//! [0]
//! [1]
class Renderer {
- ...
+ void startNextFrame();
+ // ...
+
VkDescriptorBufferInfo m_uniformBufInfo[QVulkanWindow::MAX_CONCURRENT_FRAME_COUNT];
+ QVulkanWindow *m_window = nullptr;
};
void Renderer::startNextFrame()
{
VkDescriptorBufferInfo &uniformBufInfo(m_uniformBufInfo[m_window->currentFrame()]);
- ...
+ // ...
}
//! [1]
+} // src_gui_vulkan_qvulkanwindow
+
+
+namespace src_gui_vulkan_qvulkanwindow2 {
+
//! [2]
class Renderer {
- ...
+ void startNextFrame();
+ // ...
+
VkDescriptorBufferInfo m_uniformBufInfo[QVulkanWindow::MAX_CONCURRENT_FRAME_COUNT];
+ QVulkanWindow *m_window = nullptr;
};
void Renderer::startNextFrame()
{
const int count = m_window->concurrentFrameCount();
- for (int i = 0; i < count; ++i)
- m_uniformBufInfo[i] = ...
- ...
+ // for (int i = 0; i < count; ++i)
+ // m_uniformBufInfo[i] = ...
+ // ...
}
//! [2]
+
+} // src_gui_vulkan_qvulkanwindow2
diff --git a/src/gui/doc/snippets/draganddrop/draganddrop.pro b/src/gui/doc/snippets/draganddrop/draganddrop.pro
deleted file mode 100644
index 67bc32bd10..0000000000
--- a/src/gui/doc/snippets/draganddrop/draganddrop.pro
+++ /dev/null
@@ -1,5 +0,0 @@
-HEADERS = dragwidget.h \
- mainwindow.h
-SOURCES = dragwidget.cpp \
- main.cpp \
- mainwindow.cpp
diff --git a/src/gui/doc/snippets/draganddrop/dragwidget.cpp b/src/gui/doc/snippets/draganddrop/dragwidget.cpp
index 16a7efac6c..4f592de10b 100644
--- a/src/gui/doc/snippets/draganddrop/dragwidget.cpp
+++ b/src/gui/doc/snippets/draganddrop/dragwidget.cpp
@@ -1,54 +1,10 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the documentation of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:BSD$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** BSD License Usage
-** Alternatively, you may use this file under the terms of the BSD license
-** as follows:
-**
-** "Redistribution and use in source and binary forms, with or without
-** modification, are permitted provided that the following conditions are
-** met:
-** * Redistributions of source code must retain the above copyright
-** notice, this list of conditions and the following disclaimer.
-** * Redistributions in binary form must reproduce the above copyright
-** notice, this list of conditions and the following disclaimer in
-** the documentation and/or other materials provided with the
-** distribution.
-** * Neither the name of The Qt Company Ltd nor the names of its
-** contributors may be used to endorse or promote products derived
-** from this software without specific prior written permission.
-**
-**
-** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause
#include <QtGui>
+#include <QLabel>
+#include <QHBoxLayout>
+#include <QApplication>
#include "dragwidget.h"
diff --git a/src/gui/doc/snippets/draganddrop/dragwidget.h b/src/gui/doc/snippets/draganddrop/dragwidget.h
index 709f9338bf..2861104a00 100644
--- a/src/gui/doc/snippets/draganddrop/dragwidget.h
+++ b/src/gui/doc/snippets/draganddrop/dragwidget.h
@@ -1,52 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the documentation of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:BSD$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** BSD License Usage
-** Alternatively, you may use this file under the terms of the BSD license
-** as follows:
-**
-** "Redistribution and use in source and binary forms, with or without
-** modification, are permitted provided that the following conditions are
-** met:
-** * Redistributions of source code must retain the above copyright
-** notice, this list of conditions and the following disclaimer.
-** * Redistributions in binary form must reproduce the above copyright
-** notice, this list of conditions and the following disclaimer in
-** the documentation and/or other materials provided with the
-** distribution.
-** * Neither the name of The Qt Company Ltd nor the names of its
-** contributors may be used to endorse or promote products derived
-** from this software without specific prior written permission.
-**
-**
-** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause
#ifndef DRAGWIDGET_H
#define DRAGWIDGET_H
@@ -66,7 +19,7 @@ class DragWidget : public QFrame
Q_OBJECT
public:
- DragWidget(QWidget *parent);
+ explicit DragWidget(QWidget *parent = nullptr);
void setData(const QString &mimetype, const QByteArray &newData);
signals:
diff --git a/src/gui/doc/snippets/draganddrop/main.cpp b/src/gui/doc/snippets/draganddrop/main.cpp
index 95a6b3ff00..12e3317a25 100644
--- a/src/gui/doc/snippets/draganddrop/main.cpp
+++ b/src/gui/doc/snippets/draganddrop/main.cpp
@@ -1,52 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the documentation of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:BSD$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** BSD License Usage
-** Alternatively, you may use this file under the terms of the BSD license
-** as follows:
-**
-** "Redistribution and use in source and binary forms, with or without
-** modification, are permitted provided that the following conditions are
-** met:
-** * Redistributions of source code must retain the above copyright
-** notice, this list of conditions and the following disclaimer.
-** * Redistributions in binary form must reproduce the above copyright
-** notice, this list of conditions and the following disclaimer in
-** the documentation and/or other materials provided with the
-** distribution.
-** * Neither the name of The Qt Company Ltd nor the names of its
-** contributors may be used to endorse or promote products derived
-** from this software without specific prior written permission.
-**
-**
-** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause
#include <QtGui>
diff --git a/src/gui/doc/snippets/draganddrop/mainwindow.cpp b/src/gui/doc/snippets/draganddrop/mainwindow.cpp
index 11311a0b57..c6f4454f5e 100644
--- a/src/gui/doc/snippets/draganddrop/mainwindow.cpp
+++ b/src/gui/doc/snippets/draganddrop/mainwindow.cpp
@@ -1,52 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the documentation of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:BSD$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** BSD License Usage
-** Alternatively, you may use this file under the terms of the BSD license
-** as follows:
-**
-** "Redistribution and use in source and binary forms, with or without
-** modification, are permitted provided that the following conditions are
-** met:
-** * Redistributions of source code must retain the above copyright
-** notice, this list of conditions and the following disclaimer.
-** * Redistributions in binary form must reproduce the above copyright
-** notice, this list of conditions and the following disclaimer in
-** the documentation and/or other materials provided with the
-** distribution.
-** * Neither the name of The Qt Company Ltd nor the names of its
-** contributors may be used to endorse or promote products derived
-** from this software without specific prior written permission.
-**
-**
-** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause
#include <QtWidgets>
@@ -66,7 +19,7 @@ MainWindow::MainWindow(QWidget *parent)
connect(dragWidget, &DragWidget::mimeTypes,
this, &MainWindow::setMimeTypes);
- connect(dragWidget, &DragWidget:dragResult,
+ connect(dragWidget, &DragWidget::dragResult,
this, &MainWindow::setDragResult);
QVBoxLayout *mainLayout = new QVBoxLayout(centralWidget);
diff --git a/src/gui/doc/snippets/draganddrop/mainwindow.h b/src/gui/doc/snippets/draganddrop/mainwindow.h
index 784371d4af..7c24115a4d 100644
--- a/src/gui/doc/snippets/draganddrop/mainwindow.h
+++ b/src/gui/doc/snippets/draganddrop/mainwindow.h
@@ -1,52 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the documentation of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:BSD$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** BSD License Usage
-** Alternatively, you may use this file under the terms of the BSD license
-** as follows:
-**
-** "Redistribution and use in source and binary forms, with or without
-** modification, are permitted provided that the following conditions are
-** met:
-** * Redistributions of source code must retain the above copyright
-** notice, this list of conditions and the following disclaimer.
-** * Redistributions in binary form must reproduce the above copyright
-** notice, this list of conditions and the following disclaimer in
-** the documentation and/or other materials provided with the
-** distribution.
-** * Neither the name of The Qt Company Ltd nor the names of its
-** contributors may be used to endorse or promote products derived
-** from this software without specific prior written permission.
-**
-**
-** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause
#ifndef MAINWINDOW_H
#define MAINWINDOW_H
@@ -67,7 +20,7 @@ class MainWindow : public QMainWindow
Q_OBJECT
public:
- MainWindow(QWidget *parent = 0);
+ explicit MainWindow(QWidget *parent = nullptr);
public slots:
void setDragResult(const QString &actionText);
diff --git a/src/gui/doc/snippets/dragging/dragging.pro b/src/gui/doc/snippets/dragging/dragging.pro
deleted file mode 100644
index 0a16eb19bf..0000000000
--- a/src/gui/doc/snippets/dragging/dragging.pro
+++ /dev/null
@@ -1,5 +0,0 @@
-QT += widgets
-HEADERS += mainwindow.h
-RESOURCES += images.qrc
-SOURCES += main.cpp \
- mainwindow.cpp
diff --git a/src/gui/doc/snippets/dragging/main.cpp b/src/gui/doc/snippets/dragging/main.cpp
index b08a18b894..a266be0fb9 100644
--- a/src/gui/doc/snippets/dragging/main.cpp
+++ b/src/gui/doc/snippets/dragging/main.cpp
@@ -1,52 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the documentation of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:BSD$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** BSD License Usage
-** Alternatively, you may use this file under the terms of the BSD license
-** as follows:
-**
-** "Redistribution and use in source and binary forms, with or without
-** modification, are permitted provided that the following conditions are
-** met:
-** * Redistributions of source code must retain the above copyright
-** notice, this list of conditions and the following disclaimer.
-** * Redistributions in binary form must reproduce the above copyright
-** notice, this list of conditions and the following disclaimer in
-** the documentation and/or other materials provided with the
-** distribution.
-** * Neither the name of The Qt Company Ltd nor the names of its
-** contributors may be used to endorse or promote products derived
-** from this software without specific prior written permission.
-**
-**
-** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause
#include <QtGui>
diff --git a/src/gui/doc/snippets/dragging/mainwindow.cpp b/src/gui/doc/snippets/dragging/mainwindow.cpp
index 5614c9351b..8eecfa53b7 100644
--- a/src/gui/doc/snippets/dragging/mainwindow.cpp
+++ b/src/gui/doc/snippets/dragging/mainwindow.cpp
@@ -1,52 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the documentation of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:BSD$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** BSD License Usage
-** Alternatively, you may use this file under the terms of the BSD license
-** as follows:
-**
-** "Redistribution and use in source and binary forms, with or without
-** modification, are permitted provided that the following conditions are
-** met:
-** * Redistributions of source code must retain the above copyright
-** notice, this list of conditions and the following disclaimer.
-** * Redistributions in binary form must reproduce the above copyright
-** notice, this list of conditions and the following disclaimer in
-** the documentation and/or other materials provided with the
-** distribution.
-** * Neither the name of The Qt Company Ltd nor the names of its
-** contributors may be used to endorse or promote products derived
-** from this software without specific prior written permission.
-**
-**
-** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause
#include <QtGui>
diff --git a/src/gui/doc/snippets/dragging/mainwindow.h b/src/gui/doc/snippets/dragging/mainwindow.h
index 8a8e43b223..9d2a18e55e 100644
--- a/src/gui/doc/snippets/dragging/mainwindow.h
+++ b/src/gui/doc/snippets/dragging/mainwindow.h
@@ -1,52 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the documentation of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:BSD$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** BSD License Usage
-** Alternatively, you may use this file under the terms of the BSD license
-** as follows:
-**
-** "Redistribution and use in source and binary forms, with or without
-** modification, are permitted provided that the following conditions are
-** met:
-** * Redistributions of source code must retain the above copyright
-** notice, this list of conditions and the following disclaimer.
-** * Redistributions in binary form must reproduce the above copyright
-** notice, this list of conditions and the following disclaimer in
-** the documentation and/or other materials provided with the
-** distribution.
-** * Neither the name of The Qt Company Ltd nor the names of its
-** contributors may be used to endorse or promote products derived
-** from this software without specific prior written permission.
-**
-**
-** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause
#ifndef MAINWINDOW_H
#define MAINWINDOW_H
@@ -65,7 +18,7 @@ class MainWindow : public QMainWindow
Q_OBJECT
public:
- MainWindow(QWidget *parent = 0);
+ explicit MainWindow(QWidget *parent = nullptr);
protected:
void mousePressEvent(QMouseEvent *event) override;
diff --git a/src/gui/doc/snippets/droparea.cpp b/src/gui/doc/snippets/droparea.cpp
deleted file mode 100644
index c0fdbf9617..0000000000
--- a/src/gui/doc/snippets/droparea.cpp
+++ /dev/null
@@ -1,150 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the documentation of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:BSD$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** BSD License Usage
-** Alternatively, you may use this file under the terms of the BSD license
-** as follows:
-**
-** "Redistribution and use in source and binary forms, with or without
-** modification, are permitted provided that the following conditions are
-** met:
-** * Redistributions of source code must retain the above copyright
-** notice, this list of conditions and the following disclaimer.
-** * Redistributions in binary form must reproduce the above copyright
-** notice, this list of conditions and the following disclaimer in
-** the documentation and/or other materials provided with the
-** distribution.
-** * Neither the name of The Qt Company Ltd nor the names of its
-** contributors may be used to endorse or promote products derived
-** from this software without specific prior written permission.
-**
-**
-** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include <QtGui>
-
-#include "droparea.h"
-
-DropArea::DropArea(QWidget *parent)
- : QLabel(parent)
-{
- setMinimumSize(200, 200);
- setFrameStyle(QFrame::Sunken | QFrame::StyledPanel);
- setAlignment(Qt::AlignCenter);
- setAcceptDrops(true);
- setAutoFillBackground(true);
- clear();
-}
-
-void DropArea::dragEnterEvent(QDragEnterEvent *event)
-{
- setText(tr("<drop content>"));
- setBackgroundRole(QPalette::Highlight);
-
- event->acceptProposedAction();
- emit changed(event->mimeData());
-}
-
-void DropArea::dragMoveEvent(QDragMoveEvent *event)
-{
- event->acceptProposedAction();
-}
-
-void DropArea::dropEvent(QDropEvent *event)
-{
- const QMimeData *mimeData = event->mimeData();
-
- if (mimeData->hasImage()) {
- setPixmap(qvariant_cast<QPixmap>(mimeData->imageData()));
- } else if (mimeData->hasHtml()) {
- setText(mimeData->html());
- setTextFormat(Qt::RichText);
- } else if (mimeData->hasText()) {
- setText(mimeData->text());
- setTextFormat(Qt::PlainText);
- } else {
- setText(tr("Cannot display data"));
- }
-
- setBackgroundRole(QPalette::Dark);
- event->acceptProposedAction();
-}
-
-//![0]
-void DropArea::paste()
-{
- const QClipboard *clipboard = QApplication::clipboard();
- const QMimeData *mimeData = clipboard->mimeData();
-
- if (mimeData->hasImage()) {
- setPixmap(qvariant_cast<QPixmap>(mimeData->imageData()));
- } else if (mimeData->hasHtml()) {
- setText(mimeData->html());
- setTextFormat(Qt::RichText);
- } else if (mimeData->hasText()) {
- setText(mimeData->text());
- setTextFormat(Qt::PlainText);
- } else {
- setText(tr("Cannot display data"));
- }
-//![0]
-
- emit changed(mimeData);
- setBackgroundRole(QPalette::Dark);
- //event->acceptProposedAction();
-}
-
-void DropArea::dragLeaveEvent(QDragLeaveEvent *event)
-{
- clear();
- event->accept();
-}
-
-void DropArea::clear()
-{
- setText(tr("<drop content>"));
- setBackgroundRole(QPalette::Dark);
-
- emit changed();
-}
-
-QPixmap DropArea::extractPixmap(const QByteArray &data, const QString &format)
-{
- const QList<QByteArray> imageFormats = QImageReader::supportedImageFormats();
- QPixmap pixmap;
-
- for (const QByteArray &imageFormat : imageFormats) {
- if (format.mid(6) == QString(imageFormat)) {
- pixmap.loadFromData(data, imageFormat);
- break;
- }
- }
- return pixmap;
-}
diff --git a/src/gui/doc/snippets/droparea/droparea.cpp b/src/gui/doc/snippets/droparea/droparea.cpp
new file mode 100644
index 0000000000..6b3583acff
--- /dev/null
+++ b/src/gui/doc/snippets/droparea/droparea.cpp
@@ -0,0 +1,36 @@
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause
+#include <QApplication>
+#include <QClipboard>
+#include <QMimeData>
+#include <QWidget>
+
+namespace droparea {
+struct DropArea : public QWidget {
+ void paste();
+ void setPixmap(QPixmap);
+ void setText(QString);
+ void setTextFormat(Qt::TextFormat);
+};
+
+//![0]
+void DropArea::paste()
+{
+ const QClipboard *clipboard = QApplication::clipboard();
+ const QMimeData *mimeData = clipboard->mimeData();
+
+ if (mimeData->hasImage()) {
+ setPixmap(qvariant_cast<QPixmap>(mimeData->imageData()));
+ } else if (mimeData->hasHtml()) {
+ setText(mimeData->html());
+ setTextFormat(Qt::RichText);
+ } else if (mimeData->hasText()) {
+ setText(mimeData->text());
+ setTextFormat(Qt::PlainText);
+ } else {
+ setText(tr("Cannot display data"));
+ }
+}
+//![0]
+
+} // droparea
diff --git a/src/gui/doc/snippets/dropevents/dropevents.pro b/src/gui/doc/snippets/dropevents/dropevents.pro
deleted file mode 100644
index 6283406f25..0000000000
--- a/src/gui/doc/snippets/dropevents/dropevents.pro
+++ /dev/null
@@ -1,3 +0,0 @@
-HEADERS = window.h
-SOURCES = main.cpp \
- window.cpp
diff --git a/src/gui/doc/snippets/dropevents/main.cpp b/src/gui/doc/snippets/dropevents/main.cpp
deleted file mode 100644
index 077df53c0f..0000000000
--- a/src/gui/doc/snippets/dropevents/main.cpp
+++ /dev/null
@@ -1,62 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the documentation of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:BSD$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** BSD License Usage
-** Alternatively, you may use this file under the terms of the BSD license
-** as follows:
-**
-** "Redistribution and use in source and binary forms, with or without
-** modification, are permitted provided that the following conditions are
-** met:
-** * Redistributions of source code must retain the above copyright
-** notice, this list of conditions and the following disclaimer.
-** * Redistributions in binary form must reproduce the above copyright
-** notice, this list of conditions and the following disclaimer in
-** the documentation and/or other materials provided with the
-** distribution.
-** * Neither the name of The Qt Company Ltd nor the names of its
-** contributors may be used to endorse or promote products derived
-** from this software without specific prior written permission.
-**
-**
-** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include <QtGui>
-
-#include "window.h"
-
-int main(int argc, char *argv[])
-{
- QApplication app(argc, argv);
-
- Window *window = new Window;
- window->show();
- return app.exec();
-}
diff --git a/src/gui/doc/snippets/dropevents/window.cpp b/src/gui/doc/snippets/dropevents/window.cpp
index c3445bcc75..753bb8705f 100644
--- a/src/gui/doc/snippets/dropevents/window.cpp
+++ b/src/gui/doc/snippets/dropevents/window.cpp
@@ -1,56 +1,30 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the documentation of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:BSD$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** BSD License Usage
-** Alternatively, you may use this file under the terms of the BSD license
-** as follows:
-**
-** "Redistribution and use in source and binary forms, with or without
-** modification, are permitted provided that the following conditions are
-** met:
-** * Redistributions of source code must retain the above copyright
-** notice, this list of conditions and the following disclaimer.
-** * Redistributions in binary form must reproduce the above copyright
-** notice, this list of conditions and the following disclaimer in
-** the documentation and/or other materials provided with the
-** distribution.
-** * Neither the name of The Qt Company Ltd nor the names of its
-** contributors may be used to endorse or promote products derived
-** from this software without specific prior written permission.
-**
-**
-** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause
+#include <QComboBox>
+#include <QDragEnterEvent>
+#include <QLabel>
+#include <QMimeData>
+#include <QTextBrowser>
+#include <QVBoxLayout>
+#include <QWidget>
-#include <QtGui>
+namespace dropevents {
+class Window : public QWidget
+{
+
+public:
+ explicit Window(QWidget *parent = nullptr);
-#include "window.h"
+protected:
+ void dragEnterEvent(QDragEnterEvent *event) override;
+ void dropEvent(QDropEvent *event) override;
+
+private:
+ QComboBox *mimeTypeCombo = nullptr;
+ QTextBrowser *textBrowser = nullptr;
+ QString oldText;
+ QStringList oldMimeTypes;
+};
//! [0]
Window::Window(QWidget *parent)
@@ -95,3 +69,5 @@ void Window::dropEvent(QDropEvent *event)
event->acceptProposedAction();
}
//! [4]
+
+} // dropevents
diff --git a/src/gui/doc/snippets/dropevents/window.h b/src/gui/doc/snippets/dropevents/window.h
deleted file mode 100644
index 6ac35181ed..0000000000
--- a/src/gui/doc/snippets/dropevents/window.h
+++ /dev/null
@@ -1,81 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the documentation of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:BSD$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** BSD License Usage
-** Alternatively, you may use this file under the terms of the BSD license
-** as follows:
-**
-** "Redistribution and use in source and binary forms, with or without
-** modification, are permitted provided that the following conditions are
-** met:
-** * Redistributions of source code must retain the above copyright
-** notice, this list of conditions and the following disclaimer.
-** * Redistributions in binary form must reproduce the above copyright
-** notice, this list of conditions and the following disclaimer in
-** the documentation and/or other materials provided with the
-** distribution.
-** * Neither the name of The Qt Company Ltd nor the names of its
-** contributors may be used to endorse or promote products derived
-** from this software without specific prior written permission.
-**
-**
-** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef WINDOW_H
-#define WINDOW_H
-
-#include <QString>
-#include <QStringList>
-#include <QWidget>
-
-class QComboBox;
-class QFrame;
-class QTextBrowser;
-
-class Window : public QWidget
-{
- Q_OBJECT
-
-public:
- Window(QWidget *parent = 0);
-
-protected:
- void dragEnterEvent(QDragEnterEvent *event) override;
- void dropEvent(QDropEvent *event) override;
-
-private:
- QComboBox *mimeTypeCombo;
- QFrame *dropFrame;
- QTextBrowser *textBrowser;
- QString oldText;
- QStringList oldMimeTypes;
-};
-
-#endif
diff --git a/src/gui/doc/snippets/droprectangle/droprectangle.pro b/src/gui/doc/snippets/droprectangle/droprectangle.pro
deleted file mode 100644
index 6283406f25..0000000000
--- a/src/gui/doc/snippets/droprectangle/droprectangle.pro
+++ /dev/null
@@ -1,3 +0,0 @@
-HEADERS = window.h
-SOURCES = main.cpp \
- window.cpp
diff --git a/src/gui/doc/snippets/droprectangle/main.cpp b/src/gui/doc/snippets/droprectangle/main.cpp
deleted file mode 100644
index d09c5b2d4c..0000000000
--- a/src/gui/doc/snippets/droprectangle/main.cpp
+++ /dev/null
@@ -1,61 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the documentation of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:BSD$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** BSD License Usage
-** Alternatively, you may use this file under the terms of the BSD license
-** as follows:
-**
-** "Redistribution and use in source and binary forms, with or without
-** modification, are permitted provided that the following conditions are
-** met:
-** * Redistributions of source code must retain the above copyright
-** notice, this list of conditions and the following disclaimer.
-** * Redistributions in binary form must reproduce the above copyright
-** notice, this list of conditions and the following disclaimer in
-** the documentation and/or other materials provided with the
-** distribution.
-** * Neither the name of The Qt Company Ltd nor the names of its
-** contributors may be used to endorse or promote products derived
-** from this software without specific prior written permission.
-**
-**
-** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include <QtGui>
-
-#include "window.h"
-
-int main(int argc, char *argv[])
-{
- QApplication app(argc, argv);
- Window *window = new Window;
- window->show();
- return app.exec();
-}
diff --git a/src/gui/doc/snippets/droprectangle/window.cpp b/src/gui/doc/snippets/droprectangle/window.cpp
index 47b66931ea..351f4d12c1 100644
--- a/src/gui/doc/snippets/droprectangle/window.cpp
+++ b/src/gui/doc/snippets/droprectangle/window.cpp
@@ -1,90 +1,19 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the documentation of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:BSD$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** BSD License Usage
-** Alternatively, you may use this file under the terms of the BSD license
-** as follows:
-**
-** "Redistribution and use in source and binary forms, with or without
-** modification, are permitted provided that the following conditions are
-** met:
-** * Redistributions of source code must retain the above copyright
-** notice, this list of conditions and the following disclaimer.
-** * Redistributions in binary form must reproduce the above copyright
-** notice, this list of conditions and the following disclaimer in
-** the documentation and/or other materials provided with the
-** distribution.
-** * Neither the name of The Qt Company Ltd nor the names of its
-** contributors may be used to endorse or promote products derived
-** from this software without specific prior written permission.
-**
-**
-** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause
+#include <QDragMoveEvent>
+#include <QFrame>
+#include <QMimeData>
+#include <QWidget>
-#include <QtGui>
+namespace droprectangle {
-#include "window.h"
-
-Window::Window(QWidget *parent)
- : QWidget(parent)
+struct Window : public QWidget
{
- QLabel *textLabel = new QLabel(tr("Data:"), this);
- textBrowser = new QTextBrowser(this);
-
- QLabel *mimeTypeLabel = new QLabel(tr("MIME types:"), this);
- mimeTypeCombo = new QComboBox(this);
-
- dropFrame = new QFrame(this);
- dropFrame->setFrameStyle(QFrame::StyledPanel | QFrame::Sunken);
- QLabel *dropLabel = new QLabel(tr("Drop items here"), dropFrame);
- dropLabel->setAlignment(Qt::AlignHCenter);
-
- QVBoxLayout *dropFrameLayout = new QVBoxLayout(dropFrame);
- dropFrameLayout->addWidget(dropLabel);
+ void dragMoveEvent(QDragMoveEvent *event);
- QHBoxLayout *dropLayout = new QHBoxLayout;
- dropLayout->addStretch(0);
- dropLayout->addWidget(dropFrame);
- dropLayout->addStretch(0);
+ QFrame *dropFrame = nullptr;
+};
- QVBoxLayout *mainLayout = new QVBoxLayout(this);
- mainLayout->addWidget(textLabel);
- mainLayout->addWidget(textBrowser);
- mainLayout->addWidget(mimeTypeLabel);
- mainLayout->addWidget(mimeTypeCombo);
- mainLayout->addSpacing(32);
- mainLayout->addLayout(dropLayout);
-
- setAcceptDrops(true);
- setWindowTitle(tr("Drop Rectangle"));
-}
//! [0]
void Window::dragMoveEvent(QDragMoveEvent *event)
@@ -96,11 +25,5 @@ void Window::dragMoveEvent(QDragMoveEvent *event)
}
//! [0]
-void Window::dropEvent(QDropEvent *event)
-{
- textBrowser->setPlainText(event->mimeData()->text());
- mimeTypeCombo->clear();
- mimeTypeCombo->addItems(event->mimeData()->formats());
- event->acceptProposedAction();
-}
+} // droprectangle
diff --git a/src/gui/doc/snippets/droprectangle/window.h b/src/gui/doc/snippets/droprectangle/window.h
deleted file mode 100644
index 5a9ef75d3b..0000000000
--- a/src/gui/doc/snippets/droprectangle/window.h
+++ /dev/null
@@ -1,81 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the documentation of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:BSD$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** BSD License Usage
-** Alternatively, you may use this file under the terms of the BSD license
-** as follows:
-**
-** "Redistribution and use in source and binary forms, with or without
-** modification, are permitted provided that the following conditions are
-** met:
-** * Redistributions of source code must retain the above copyright
-** notice, this list of conditions and the following disclaimer.
-** * Redistributions in binary form must reproduce the above copyright
-** notice, this list of conditions and the following disclaimer in
-** the documentation and/or other materials provided with the
-** distribution.
-** * Neither the name of The Qt Company Ltd nor the names of its
-** contributors may be used to endorse or promote products derived
-** from this software without specific prior written permission.
-**
-**
-** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef WINDOW_H
-#define WINDOW_H
-
-#include <QString>
-#include <QStringList>
-#include <QWidget>
-
-class QComboBox;
-class QFrame;
-class QTextBrowser;
-
-class Window : public QWidget
-{
- Q_OBJECT
-
-public:
- Window(QWidget *parent = 0);
-
-protected:
- void dragMoveEvent(QDragMoveEvent *event) override;
- void dropEvent(QDropEvent *event) override;
-
-private:
- QComboBox *mimeTypeCombo;
- QFrame *dropFrame;
- QTextBrowser *textBrowser;
- QString oldText;
- QStringList oldMimeTypes;
-};
-
-#endif
diff --git a/src/gui/doc/snippets/image/image.cpp b/src/gui/doc/snippets/image/image.cpp
index c3b9abc364..82703c5c0f 100644
--- a/src/gui/doc/snippets/image/image.cpp
+++ b/src/gui/doc/snippets/image/image.cpp
@@ -1,114 +1,30 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the documentation of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:BSD$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** BSD License Usage
-** Alternatively, you may use this file under the terms of the BSD license
-** as follows:
-**
-** "Redistribution and use in source and binary forms, with or without
-** modification, are permitted provided that the following conditions are
-** met:
-** * Redistributions of source code must retain the above copyright
-** notice, this list of conditions and the following disclaimer.
-** * Redistributions in binary form must reproduce the above copyright
-** notice, this list of conditions and the following disclaimer in
-** the documentation and/or other materials provided with the
-** distribution.
-** * Neither the name of The Qt Company Ltd nor the names of its
-** contributors may be used to endorse or promote products derived
-** from this software without specific prior written permission.
-**
-**
-** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause
#include <QtGui>
+namespace image {
+void wrapper0() {
-int main()
-{
- int x, y;
- {
- // BIT ACCESS
- QImage image;
- // sets bit at (x, y) to 1
- if (image.format() == QImage::Format_MonoLSB)
- image.scanLine(y)[x >> 3] |= 1 << (x & 7);
- else
- image.scanLine(y)[x >> 3] |= 1 << (7 - (x & 7));
- }
+//! [0]
+QImage image;
+QByteArray ba;
+QBuffer buffer(&ba);
+buffer.open(QIODevice::WriteOnly);
+image.save(&buffer, "PNG"); // writes image into ba in PNG format
+//! [0]
- {
- // 8-BIT ACCESS
- QImage image;
- // set entry 19 in the color table to yellow
- image.setColor(19, qRgb(255, 255, 0));
+} // wrapper0
- // set 8 bit pixel at (x,y) to value yellow (in color table)
- image.scanLine(y)[x] = 19;
- }
- {
- // 32-BIT
- QImage image;
- // sets 32 bit pixel at (x,y) to yellow.
- uint *ptr = reinterpret_cast<uint *>(image.scanLine(y)) + x;
- *ptr = qRgb(255, 255, 0);
- }
+void wrapper1() {
- {
- // SAVE
-//! [0]
- QImage image;
- QByteArray ba;
- QBuffer buffer(&ba);
- buffer.open(QIODevice::WriteOnly);
- image.save(&buffer, "PNG"); // writes image into ba in PNG format
-//! [0]
- }
-
- {
- // PIX SAVE
//! [1]
- QPixmap pixmap;
- QByteArray bytes;
- QBuffer buffer(&bytes);
- buffer.open(QIODevice::WriteOnly);
- pixmap.save(&buffer, "PNG"); // writes pixmap into bytes in PNG format
+QPixmap pixmap;
+QByteArray bytes;
+QBuffer buffer(&bytes);
+buffer.open(QIODevice::WriteOnly);
+pixmap.save(&buffer, "PNG"); // writes pixmap into bytes in PNG format
//! [1]
- }
- {
- // MASK
-//! [2]
- QPixmap alpha("image-with-alpha.png");
- QPixmap alphacopy = alpha;
- alphacopy.setMask(alphacopy.mask());
-//! [2]
- }
-}
+} // wrapper1
+
+} // image
diff --git a/src/gui/doc/snippets/image/supportedformat.cpp b/src/gui/doc/snippets/image/supportedformat.cpp
index a537d2cdc3..61aed40c57 100644
--- a/src/gui/doc/snippets/image/supportedformat.cpp
+++ b/src/gui/doc/snippets/image/supportedformat.cpp
@@ -1,62 +1,14 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the documentation of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:BSD$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** BSD License Usage
-** Alternatively, you may use this file under the terms of the BSD license
-** as follows:
-**
-** "Redistribution and use in source and binary forms, with or without
-** modification, are permitted provided that the following conditions are
-** met:
-** * Redistributions of source code must retain the above copyright
-** notice, this list of conditions and the following disclaimer.
-** * Redistributions in binary form must reproduce the above copyright
-** notice, this list of conditions and the following disclaimer in
-** the documentation and/or other materials provided with the
-** distribution.
-** * Neither the name of The Qt Company Ltd nor the names of its
-** contributors may be used to endorse or promote products derived
-** from this software without specific prior written permission.
-**
-**
-** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause
#include <QtGui>
-int main(int argv, char **args)
-{
+void wrapper() {
//! [0]
QImageWriter writer;
writer.setFormat("png");
if (writer.supportsOption(QImageIOHandler::Description))
qDebug() << "Png supports embedded text";
//! [0]
- return 0;
-}
+
+} // wrapper
diff --git a/src/gui/doc/snippets/matrix/matrix.cpp b/src/gui/doc/snippets/matrix/matrix.cpp
deleted file mode 100644
index 115dc3d508..0000000000
--- a/src/gui/doc/snippets/matrix/matrix.cpp
+++ /dev/null
@@ -1,150 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the documentation of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:BSD$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** BSD License Usage
-** Alternatively, you may use this file under the terms of the BSD license
-** as follows:
-**
-** "Redistribution and use in source and binary forms, with or without
-** modification, are permitted provided that the following conditions are
-** met:
-** * Redistributions of source code must retain the above copyright
-** notice, this list of conditions and the following disclaimer.
-** * Redistributions in binary form must reproduce the above copyright
-** notice, this list of conditions and the following disclaimer in
-** the documentation and/or other materials provided with the
-** distribution.
-** * Neither the name of The Qt Company Ltd nor the names of its
-** contributors may be used to endorse or promote products derived
-** from this software without specific prior written permission.
-**
-**
-** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include <QtGui>
-#include <cmath>
-
-class SimpleTransformation : public QWidget
-{
- void paintEvent(QPaintEvent *) override;
-};
-
-//! [0]
-void SimpleTransformation::paintEvent(QPaintEvent *)
-{
- QPainter painter(this);
- painter.setPen(QPen(Qt::blue, 1, Qt::DashLine));
- painter.drawRect(0, 0, 100, 100);
-
- painter.rotate(45);
-
- painter.setFont(QFont("Helvetica", 24));
- painter.setPen(QPen(Qt::black, 1));
- painter.drawText(20, 10, "QMatrix");
-}
-//! [0]
-
-class CombinedTransformation : public QWidget
-{
- void paintEvent(QPaintEvent *) override;
-};
-
-//! [1]
-void CombinedTransformation::paintEvent(QPaintEvent *)
-{
- QPainter painter(this);
- painter.setPen(QPen(Qt::blue, 1, Qt::DashLine));
- painter.drawRect(0, 0, 100, 100);
-
- QMatrix matrix;
- matrix.translate(50, 50);
- matrix.rotate(45);
- matrix.scale(0.5, 1.0);
- painter.setMatrix(matrix);
-
- painter.setFont(QFont("Helvetica", 24));
- painter.setPen(QPen(Qt::black, 1));
- painter.drawText(20, 10, "QMatrix");
-}
-//! [1]
-
-class BasicOperations : public QWidget
-{
- void paintEvent(QPaintEvent *) override;
-};
-
-//! [2]
-void BasicOperations::paintEvent(QPaintEvent *)
-{
- double pi = 3.14;
-
- double a = pi/180 * 45.0;
- double sina = sin(a);
- double cosa = cos(a);
-
- QMatrix translationMatrix(1, 0, 0, 1, 50.0, 50.0);
- QMatrix rotationMatrix(cosa, sina, -sina, cosa, 0, 0);
- QMatrix scalingMatrix(0.5, 0, 0, 1.0, 0, 0);
-
- QMatrix matrix;
- matrix = scalingMatrix * rotationMatrix * translationMatrix;
-
- QPainter painter(this);
- painter.setPen(QPen(Qt::blue, 1, Qt::DashLine));
- painter.drawRect(0, 0, 100, 100);
-
- painter.setMatrix(matrix);
-
- painter.setFont(QFont("Helvetica", 24));
- painter.setPen(QPen(Qt::black, 1));
- painter.drawText(20, 10, "QMatrix");
-}
-//! [2]
-
-int main(int argc, char **argv)
-{
- QApplication app(argc, argv);
-
- QWidget widget;
-
- SimpleTransformation *simpleWidget = new SimpleTransformation;
- CombinedTransformation *combinedWidget = new CombinedTransformation;
- BasicOperations *basicWidget = new BasicOperations;
-
- QVBoxLayout *layout = new QVBoxLayout;
- layout->addWidget(simpleWidget);
- layout->addWidget(combinedWidget);
- layout->addWidget(basicWidget);
- widget.setLayout(layout);
-
- widget.show();
- widget.resize(130, 350);
- return app.exec();
-}
diff --git a/src/gui/doc/snippets/overview/using-qt-gui.cmake b/src/gui/doc/snippets/overview/using-qt-gui.cmake
index aecfa458a0..4f774c43ff 100644
--- a/src/gui/doc/snippets/overview/using-qt-gui.cmake
+++ b/src/gui/doc/snippets/overview/using-qt-gui.cmake
@@ -1,2 +1,2 @@
-find_package(Qt5 COMPONENTS Gui REQUIRED)
-target_link_libraries(mytarget Qt5::Gui)
+find_package(Qt6 REQUIRED COMPONENTS Gui)
+target_link_libraries(mytarget PRIVATE Qt6::Gui)
diff --git a/src/gui/doc/snippets/picture/picture.cpp b/src/gui/doc/snippets/picture/picture.cpp
index 807c263b19..2faf0dde5f 100644
--- a/src/gui/doc/snippets/picture/picture.cpp
+++ b/src/gui/doc/snippets/picture/picture.cpp
@@ -1,82 +1,33 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the documentation of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:BSD$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** BSD License Usage
-** Alternatively, you may use this file under the terms of the BSD license
-** as follows:
-**
-** "Redistribution and use in source and binary forms, with or without
-** modification, are permitted provided that the following conditions are
-** met:
-** * Redistributions of source code must retain the above copyright
-** notice, this list of conditions and the following disclaimer.
-** * Redistributions in binary form must reproduce the above copyright
-** notice, this list of conditions and the following disclaimer in
-** the documentation and/or other materials provided with the
-** distribution.
-** * Neither the name of The Qt Company Ltd nor the names of its
-** contributors may be used to endorse or promote products derived
-** from this software without specific prior written permission.
-**
-**
-** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause
#include <QtWidgets>
-void myProcessing(const QString &)
-{
-}
-
-int main()
+namespace picture {
+void wrapper0()
{
- QWidget myWidget;
- {
- // RECORD
//! [0]
- QPicture picture;
- QPainter painter;
- painter.begin(&picture); // paint in picture
- painter.drawEllipse(10,20, 80,70); // draw an ellipse
- painter.end(); // painting done
- picture.save("drawing.pic"); // save picture
+QPicture picture;
+QPainter painter;
+painter.begin(&picture); // paint in picture
+painter.drawEllipse(10,20, 80,70); // draw an ellipse
+painter.end(); // painting done
+picture.save("drawing.pic"); // save picture
//! [0]
- }
- {
- // REPLAY
+} // wrapper0
+
+
+void wrapper1() {
+QImage myImage;
+
//! [1]
- QPicture picture;
- picture.load("drawing.pic"); // load picture
- QPainter painter;
- painter.begin(&myImage); // paint in myImage
- painter.drawPicture(0, 0, picture); // draw the picture at (0,0)
- painter.end(); // painting done
+QPicture picture;
+picture.load("drawing.pic"); // load picture
+QPainter painter;
+painter.begin(&myImage); // paint in myImage
+painter.drawPicture(0, 0, picture); // draw the picture at (0,0)
+painter.end(); // painting done
//! [1]
- }
+
+} // wrapper1
+} // picture
diff --git a/src/gui/doc/snippets/plaintextlayout/main.cpp b/src/gui/doc/snippets/plaintextlayout/main.cpp
deleted file mode 100644
index 1a50c27091..0000000000
--- a/src/gui/doc/snippets/plaintextlayout/main.cpp
+++ /dev/null
@@ -1,62 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the documentation of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:BSD$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** BSD License Usage
-** Alternatively, you may use this file under the terms of the BSD license
-** as follows:
-**
-** "Redistribution and use in source and binary forms, with or without
-** modification, are permitted provided that the following conditions are
-** met:
-** * Redistributions of source code must retain the above copyright
-** notice, this list of conditions and the following disclaimer.
-** * Redistributions in binary form must reproduce the above copyright
-** notice, this list of conditions and the following disclaimer in
-** the documentation and/or other materials provided with the
-** distribution.
-** * Neither the name of The Qt Company Ltd nor the names of its
-** contributors may be used to endorse or promote products derived
-** from this software without specific prior written permission.
-**
-**
-** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include <QtGui>
-
-#include "window.h"
-
-int main(int argc, char *argv[])
-{
- QApplication app(argc, argv);
- Window *window = new Window;
- window->resize(337, 343);
- window->show();
- return app.exec();
-}
diff --git a/src/gui/doc/snippets/plaintextlayout/plaintextlayout.pro b/src/gui/doc/snippets/plaintextlayout/plaintextlayout.pro
deleted file mode 100644
index 6283406f25..0000000000
--- a/src/gui/doc/snippets/plaintextlayout/plaintextlayout.pro
+++ /dev/null
@@ -1,3 +0,0 @@
-HEADERS = window.h
-SOURCES = main.cpp \
- window.cpp
diff --git a/src/gui/doc/snippets/plaintextlayout/window.cpp b/src/gui/doc/snippets/plaintextlayout/window.cpp
index 9bc4df05f1..77ed9d4e54 100644
--- a/src/gui/doc/snippets/plaintextlayout/window.cpp
+++ b/src/gui/doc/snippets/plaintextlayout/window.cpp
@@ -1,118 +1,66 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the documentation of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:BSD$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** BSD License Usage
-** Alternatively, you may use this file under the terms of the BSD license
-** as follows:
-**
-** "Redistribution and use in source and binary forms, with or without
-** modification, are permitted provided that the following conditions are
-** met:
-** * Redistributions of source code must retain the above copyright
-** notice, this list of conditions and the following disclaimer.
-** * Redistributions in binary form must reproduce the above copyright
-** notice, this list of conditions and the following disclaimer in
-** the documentation and/or other materials provided with the
-** distribution.
-** * Neither the name of The Qt Company Ltd nor the names of its
-** contributors may be used to endorse or promote products derived
-** from this software without specific prior written permission.
-**
-**
-** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause
+#include <QPainter>
+#include <QTextLayout>
+#include <QWidget>
-#include <QtGui>
-#include <math.h>
-
-#include "window.h"
-
-Window::Window(QWidget *parent)
- : QWidget(parent)
+namespace plaintextlayout {
+class Window : public QWidget
{
- text = QString("Support for text rendering and layout in Qt 4 has been "
- "redesigned around a system that allows textual content to "
- "be represented in a more flexible way than was possible "
- "with Qt 3. Qt 4 also provides a more convenient "
- "programming interface for editing documents. These "
- "improvements are made available through a reimplementation "
- "of the existing text rendering engine, and the "
- "introduction of several new classes. "
- "See the relevant module overview for a detailed discussion "
- "of this framework. The following sections provide a brief "
- "overview of the main concepts behind Scribe.");
+protected:
+ void paintEvent(QPaintEvent *event) override;
- setWindowTitle(tr("Plain Text Layout"));
-}
+private:
+ QFont font;
+ QString text;
+};
void Window::paintEvent(QPaintEvent *event)
{
+
//! [0]
- QTextLayout textLayout(text, font);
- qreal margin = 10;
- qreal radius = qMin(width()/2.0, height()/2.0) - margin;
- QFontMetrics fm(font);
+QTextLayout textLayout(text, font);
+qreal margin = 10;
+qreal radius = qMin(width()/2.0, height()/2.0) - margin;
+QFontMetrics fm(font);
- qreal lineHeight = fm.height();
- qreal y = 0;
+qreal lineHeight = fm.height();
+qreal y = 0;
- textLayout.beginLayout();
+textLayout.beginLayout();
- while (1) {
- // create a new line
- QTextLine line = textLayout.createLine();
- if (!line.isValid())
- break;
+while (1) {
+ // create a new line
+ QTextLine line = textLayout.createLine();
+ if (!line.isValid())
+ break;
- qreal x1 = qMax(0.0, pow(pow(radius,2)-pow(radius-y,2), 0.5));
- qreal x2 = qMax(0.0, pow(pow(radius,2)-pow(radius-(y+lineHeight),2), 0.5));
- qreal x = qMax(x1, x2) + margin;
- qreal lineWidth = (width() - margin) - x;
+ qreal x1 = qMax(0.0, pow(pow(radius,2)-pow(radius-y,2), 0.5));
+ qreal x2 = qMax(0.0, pow(pow(radius,2)-pow(radius-(y+lineHeight),2), 0.5));
+ qreal x = qMax(x1, x2) + margin;
+ qreal lineWidth = (width() - margin) - x;
- line.setLineWidth(lineWidth);
- line.setPosition(QPointF(x, margin+y));
- y += line.height();
- }
+ line.setLineWidth(lineWidth);
+ line.setPosition(QPointF(x, margin+y));
+ y += line.height();
+}
- textLayout.endLayout();
+textLayout.endLayout();
- QPainter painter;
- painter.begin(this);
- painter.setRenderHint(QPainter::Antialiasing);
- painter.fillRect(rect(), Qt::white);
- painter.setBrush(QBrush(Qt::black));
- painter.setPen(QPen(Qt::black));
- textLayout.draw(&painter, QPoint(0,0));
+QPainter painter;
+painter.begin(this);
+painter.setRenderHint(QPainter::Antialiasing);
+painter.fillRect(rect(), Qt::white);
+painter.setBrush(QBrush(Qt::black));
+painter.setPen(QPen(Qt::black));
+textLayout.draw(&painter, QPoint(0,0));
- painter.setBrush(QBrush(QColor("#a6ce39")));
- painter.setPen(QPen(Qt::black));
- painter.drawEllipse(QRectF(-radius, margin, 2*radius, 2*radius));
- painter.end();
+painter.setBrush(QBrush(QColor("#a6ce39")));
+painter.setPen(QPen(Qt::black));
+painter.drawEllipse(QRectF(-radius, margin, 2*radius, 2*radius));
+painter.end();
//! [0]
+
+Q_UNUSED(event);
}
+} // plaintextlayout
diff --git a/src/gui/doc/snippets/plaintextlayout/window.h b/src/gui/doc/snippets/plaintextlayout/window.h
deleted file mode 100644
index 8552ecd4ba..0000000000
--- a/src/gui/doc/snippets/plaintextlayout/window.h
+++ /dev/null
@@ -1,71 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the documentation of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:BSD$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** BSD License Usage
-** Alternatively, you may use this file under the terms of the BSD license
-** as follows:
-**
-** "Redistribution and use in source and binary forms, with or without
-** modification, are permitted provided that the following conditions are
-** met:
-** * Redistributions of source code must retain the above copyright
-** notice, this list of conditions and the following disclaimer.
-** * Redistributions in binary form must reproduce the above copyright
-** notice, this list of conditions and the following disclaimer in
-** the documentation and/or other materials provided with the
-** distribution.
-** * Neither the name of The Qt Company Ltd nor the names of its
-** contributors may be used to endorse or promote products derived
-** from this software without specific prior written permission.
-**
-**
-** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef WINDOW_H
-#define WINDOW_H
-
-#include <QWidget>
-
-class Window : public QWidget
-{
- Q_OBJECT
-
-public:
- Window(QWidget *parent = 0);
-
-protected:
- void paintEvent(QPaintEvent *event) override;
-
-private:
- QFont font;
- QString text;
-};
-
-#endif
diff --git a/src/gui/doc/snippets/polygon/polygon.cpp b/src/gui/doc/snippets/polygon/polygon.cpp
index b387a0432e..4afb586135 100644
--- a/src/gui/doc/snippets/polygon/polygon.cpp
+++ b/src/gui/doc/snippets/polygon/polygon.cpp
@@ -1,122 +1,75 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the documentation of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:BSD$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** BSD License Usage
-** Alternatively, you may use this file under the terms of the BSD license
-** as follows:
-**
-** "Redistribution and use in source and binary forms, with or without
-** modification, are permitted provided that the following conditions are
-** met:
-** * Redistributions of source code must retain the above copyright
-** notice, this list of conditions and the following disclaimer.
-** * Redistributions in binary form must reproduce the above copyright
-** notice, this list of conditions and the following disclaimer in
-** the documentation and/or other materials provided with the
-** distribution.
-** * Neither the name of The Qt Company Ltd nor the names of its
-** contributors may be used to endorse or promote products derived
-** from this software without specific prior written permission.
-**
-**
-** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause
+#include <QPolygon>
+namespace polygon {
-#include <QtGui>
-
-int main()
+void wrapper() {
{
- {
- // STREAM
+// STREAM
//! [0]
- QPolygon polygon;
- polygon << QPoint(10, 20) << QPoint(20, 30);
+QPolygon polygon;
+polygon << QPoint(10, 20) << QPoint(20, 30);
//! [0]
- }
+}
- {
- // STREAMF
+{
+// STREAMF
//! [1]
- QPolygonF polygon;
- polygon << QPointF(10.4, 20.5) << QPointF(20.2, 30.2);
+QPolygonF polygon;
+polygon << QPointF(10.4, 20.5) << QPointF(20.2, 30.2);
//! [1]
- }
+}
- {
- // SETPOINTS
+{
+// SETPOINTS
//! [2]
- static const int points[] = { 10, 20, 30, 40 };
- QPolygon polygon;
- polygon.setPoints(2, points);
+static const int points[] = { 10, 20, 30, 40 };
+QPolygon polygon;
+polygon.setPoints(2, points);
//! [2]
- }
+}
- {
- // SETPOINTS2
+{
+// SETPOINTS2
//! [3]
- QPolygon polygon;
- polygon.setPoints(2, 10, 20, 30, 40);
+QPolygon polygon;
+polygon.setPoints(2, 10, 20, 30, 40);
//! [3]
- }
+}
- {
- // PUTPOINTS
+{
+// PUTPOINTS
//! [4]
- QPolygon polygon(1);
- polygon[0] = QPoint(4, 5);
- polygon.putPoints(1, 2, 6,7, 8,9);
+QPolygon polygon(1);
+polygon[0] = QPoint(4, 5);
+polygon.putPoints(1, 2, 6,7, 8,9);
//! [4]
- }
+}
- {
- // PUTPOINTS2
+{
+// PUTPOINTS2
//! [5]
- QPolygon polygon(3);
- polygon.putPoints(0, 3, 4,5, 0,0, 8,9);
- polygon.putPoints(1, 1, 6,7);
+QPolygon polygon(3);
+polygon.putPoints(0, 3, 4,5, 0,0, 8,9);
+polygon.putPoints(1, 1, 6,7);
//! [5]
- }
+}
- {
- // PUTPOINTS3
+{
+// PUTPOINTS3
//! [6]
- QPolygon polygon1;
- polygon1.putPoints(0, 3, 1,2, 0,0, 5,6);
- // polygon1 is now the three-point polygon(1,2, 0,0, 5,6);
+QPolygon polygon1;
+polygon1.putPoints(0, 3, 1,2, 0,0, 5,6);
+// polygon1 is now the three-point polygon(1,2, 0,0, 5,6);
- QPolygon polygon2;
- polygon2.putPoints(0, 3, 4,4, 5,5, 6,6);
- // polygon2 is now (4,4, 5,5, 6,6);
+QPolygon polygon2;
+polygon2.putPoints(0, 3, 4,4, 5,5, 6,6);
+// polygon2 is now (4,4, 5,5, 6,6);
- polygon1.putPoints(2, 3, polygon2);
- // polygon1 is now the five-point polygon(1,2, 0,0, 4,4, 5,5, 6,6);
+polygon1.putPoints(2, 3, polygon2);
+// polygon1 is now the five-point polygon(1,2, 0,0, 4,4, 5,5, 6,6);
//! [6]
- }
- return 0;
}
+
+} // wrapper
+} // polygon
diff --git a/src/gui/doc/snippets/qfileopenevent/Info.plist b/src/gui/doc/snippets/qfileopenevent/Info.plist
index 85311bb037..98ab05e708 100644
--- a/src/gui/doc/snippets/qfileopenevent/Info.plist
+++ b/src/gui/doc/snippets/qfileopenevent/Info.plist
@@ -1,52 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2015 Samuel Gaist <samuel.gaist@edeltech.ch>
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the documentation of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:BSD$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** BSD License Usage
-** Alternatively, you may use this file under the terms of the BSD license
-** as follows:
-**
-** "Redistribution and use in source and binary forms, with or without
-** modification, are permitted provided that the following conditions are
-** met:
-** * Redistributions of source code must retain the above copyright
-** notice, this list of conditions and the following disclaimer.
-** * Redistributions in binary form must reproduce the above copyright
-** notice, this list of conditions and the following disclaimer in
-** the documentation and/or other materials provided with the
-** distribution.
-** * Neither the name of The Qt Company Ltd nor the names of its
-** contributors may be used to endorse or promote products derived
-** from this software without specific prior written permission.
-**
-**
-** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2015 Samuel Gaist <samuel.gaist@edeltech.ch>
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause
//! [Custom Info.plist]
<?xml version="1.0" encoding="UTF-8"?>
diff --git a/src/gui/doc/snippets/qfileopenevent/main.cpp b/src/gui/doc/snippets/qfileopenevent/main.cpp
index f18e763bbc..a94ff58137 100644
--- a/src/gui/doc/snippets/qfileopenevent/main.cpp
+++ b/src/gui/doc/snippets/qfileopenevent/main.cpp
@@ -1,57 +1,11 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 Samuel Gaist <samuel.gaist@edeltech.ch>
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the documentation of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:BSD$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** BSD License Usage
-** Alternatively, you may use this file under the terms of the BSD license
-** as follows:
-**
-** "Redistribution and use in source and binary forms, with or without
-** modification, are permitted provided that the following conditions are
-** met:
-** * Redistributions of source code must retain the above copyright
-** notice, this list of conditions and the following disclaimer.
-** * Redistributions in binary form must reproduce the above copyright
-** notice, this list of conditions and the following disclaimer in
-** the documentation and/or other materials provided with the
-** distribution.
-** * Neither the name of The Qt Company Ltd nor the names of its
-** contributors may be used to endorse or promote products derived
-** from this software without specific prior written permission.
-**
-**
-** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2023 Samuel Gaist <samuel.gaist@edeltech.ch>
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause
//! [QApplication subclass]
#include <QApplication>
+#include <QDebug>
#include <QFileOpenEvent>
-#include <QtDebug>
+#include <QPushButton>
class MyApplication : public QApplication
{
@@ -65,7 +19,15 @@ public:
{
if (event->type() == QEvent::FileOpen) {
QFileOpenEvent *openEvent = static_cast<QFileOpenEvent *>(event);
- qDebug() << "Open file" << openEvent->file();
+ const QUrl url = openEvent->url();
+ if (url.isLocalFile()) {
+ QFile localFile(url.toLocalFile());
+ // read from local file
+ } else if (url.isValid()) {
+ // process according to the URL's schema
+ } else {
+ // parse openEvent->file()
+ }
}
return QApplication::event(event);
diff --git a/src/gui/doc/snippets/qfontdatabase/main.cpp b/src/gui/doc/snippets/qfontdatabase/main.cpp
deleted file mode 100644
index 5a5aa7b485..0000000000
--- a/src/gui/doc/snippets/qfontdatabase/main.cpp
+++ /dev/null
@@ -1,87 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the documentation of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:BSD$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** BSD License Usage
-** Alternatively, you may use this file under the terms of the BSD license
-** as follows:
-**
-** "Redistribution and use in source and binary forms, with or without
-** modification, are permitted provided that the following conditions are
-** met:
-** * Redistributions of source code must retain the above copyright
-** notice, this list of conditions and the following disclaimer.
-** * Redistributions in binary form must reproduce the above copyright
-** notice, this list of conditions and the following disclaimer in
-** the documentation and/or other materials provided with the
-** distribution.
-** * Neither the name of The Qt Company Ltd nor the names of its
-** contributors may be used to endorse or promote products derived
-** from this software without specific prior written permission.
-**
-**
-** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include <QtWidgets>
-
-int main(int argc, char **argv)
-{
- QApplication app(argc, argv);
-
-//! [0]
- QFontDatabase database;
- QTreeWidget fontTree;
- fontTree.setColumnCount(2);
- fontTree.setHeaderLabels(QStringList() << "Font" << "Smooth Sizes");
-
- const QStringList fontFamilies = database.families();
- for (const QString &family : fontFamilies) {
- QTreeWidgetItem *familyItem = new QTreeWidgetItem(&fontTree);
- familyItem->setText(0, family);
-
- const QStringList fontStyles = database.styles(family);
- for (const QString &style : fontStyles) {
- QTreeWidgetItem *styleItem = new QTreeWidgetItem(familyItem);
- styleItem->setText(0, style);
-
- QString sizes;
- const QList<int> smoothSizes = database.smoothSizes(family, style)
- for (int points : smoothSizes)
- sizes += QString::number(points) + ' ';
-
- styleItem->setText(1, sizes.trimmed());
- }
-//! [0] //! [1]
- }
-//! [1]
-
- fontTree.resizeColumnToContents(0);
- fontTree.show();
- return app.exec();
-}
diff --git a/src/gui/doc/snippets/qfontdatabase/qfontdatabase_snippets.cpp b/src/gui/doc/snippets/qfontdatabase/qfontdatabase_snippets.cpp
new file mode 100644
index 0000000000..5b6bfe14cf
--- /dev/null
+++ b/src/gui/doc/snippets/qfontdatabase/qfontdatabase_snippets.cpp
@@ -0,0 +1,34 @@
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause
+
+#include <QtWidgets>
+
+namespace qfontdatabase_snippets {
+void wrapper()
+{
+//! [0]
+QTreeWidget fontTree;
+fontTree.setColumnCount(2);
+fontTree.setHeaderLabels(QStringList() << "Font" << "Smooth Sizes");
+
+const QStringList fontFamilies = QFontDatabase::families();
+for (const QString &family : fontFamilies) {
+ QTreeWidgetItem *familyItem = new QTreeWidgetItem(&fontTree);
+ familyItem->setText(0, family);
+
+ const QStringList fontStyles = QFontDatabase::styles(family);
+ for (const QString &style : fontStyles) {
+ QTreeWidgetItem *styleItem = new QTreeWidgetItem(familyItem);
+ styleItem->setText(0, style);
+
+ QString sizes;
+ const QList<int> smoothSizes = QFontDatabase::smoothSizes(family, style);
+ for (const auto &points : smoothSizes)
+ sizes += QString::number(points) + ' ';
+
+ styleItem->setText(1, sizes.trimmed());
+ }
+}
+//! [0]
+} // wrapper
+} // qfontdatabase_snippets
diff --git a/src/gui/doc/snippets/qimagewriter/main.cpp b/src/gui/doc/snippets/qimagewriter/main.cpp
index 3758110356..ffb0b8eda5 100644
--- a/src/gui/doc/snippets/qimagewriter/main.cpp
+++ b/src/gui/doc/snippets/qimagewriter/main.cpp
@@ -1,71 +1,19 @@
-/****************************************************************************
-**
-** Copyright (C) 2018 Samuel Gaist <samuel.gaist@idiap.ch>
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the documentation of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:BSD$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** BSD License Usage
-** Alternatively, you may use this file under the terms of the BSD license
-** as follows:
-**
-** "Redistribution and use in source and binary forms, with or without
-** modification, are permitted provided that the following conditions are
-** met:
-** * Redistributions of source code must retain the above copyright
-** notice, this list of conditions and the following disclaimer.
-** * Redistributions in binary form must reproduce the above copyright
-** notice, this list of conditions and the following disclaimer in
-** the documentation and/or other materials provided with the
-** distribution.
-** * Neither the name of The Qt Company Ltd nor the names of its
-** contributors may be used to endorse or promote products derived
-** from this software without specific prior written permission.
-**
-**
-** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
+// Copyright (C) 2018 Samuel Gaist <samuel.gaist@idiap.ch>
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause
#include <QtGui>
-int main(int argc, char **argv)
-{
- QApplication app(argc, argv);
-
+void wrapper() {
//! [0]
- QString imagePath(QStringLiteral("path/image.jpeg"));
- QImage image(64, 64, QImage::Format_RGB32);
- image.fill(Qt::red);
- {
- QImageWriter writer(imagePath);
- writer.write(image);
- }
+QString imagePath(QStringLiteral("path/image.jpeg"));
+QImage image(64, 64, QImage::Format_RGB32);
+image.fill(Qt::red);
+{
+ QImageWriter writer(imagePath);
+ writer.write(image);
+}
- QFile::rename(imagePath,
- QStringLiteral("path/other_image.jpeg"));
+QFile::rename(imagePath,
+ QStringLiteral("path/other_image.jpeg"));
//! [0]
- return 0;
-}
+} // wrapper
diff --git a/src/gui/doc/snippets/qstatustipevent/main.cpp b/src/gui/doc/snippets/qstatustipevent/main.cpp
index cc43c56334..c6f2c8da3a 100644
--- a/src/gui/doc/snippets/qstatustipevent/main.cpp
+++ b/src/gui/doc/snippets/qstatustipevent/main.cpp
@@ -1,60 +1,14 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the documentation of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:BSD$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** BSD License Usage
-** Alternatively, you may use this file under the terms of the BSD license
-** as follows:
-**
-** "Redistribution and use in source and binary forms, with or without
-** modification, are permitted provided that the following conditions are
-** met:
-** * Redistributions of source code must retain the above copyright
-** notice, this list of conditions and the following disclaimer.
-** * Redistributions in binary form must reproduce the above copyright
-** notice, this list of conditions and the following disclaimer in
-** the documentation and/or other materials provided with the
-** distribution.
-** * Neither the name of The Qt Company Ltd nor the names of its
-** contributors may be used to endorse or promote products derived
-** from this software without specific prior written permission.
-**
-**
-** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include <QtGui>
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause
#include <QApplication>
+#include <QMainWindow>
+#include <QMenuBar>
+#include <QStatusBar>
class MainWindow : public QMainWindow
{
public:
- MainWindow(QWidget *parent = 0);
+ explicit MainWindow(QWidget *parent = nullptr);
};
//! [0] //! [1]
diff --git a/src/gui/doc/snippets/qtextobject/textobjectinterface.h b/src/gui/doc/snippets/qtextobject/textobjectinterface.h
index b93cc55ca7..f17b233cb8 100644
--- a/src/gui/doc/snippets/qtextobject/textobjectinterface.h
+++ b/src/gui/doc/snippets/qtextobject/textobjectinterface.h
@@ -1,52 +1,7 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the documentation of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:BSD$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** BSD License Usage
-** Alternatively, you may use this file under the terms of the BSD license
-** as follows:
-**
-** "Redistribution and use in source and binary forms, with or without
-** modification, are permitted provided that the following conditions are
-** met:
-** * Redistributions of source code must retain the above copyright
-** notice, this list of conditions and the following disclaimer.
-** * Redistributions in binary form must reproduce the above copyright
-** notice, this list of conditions and the following disclaimer in
-** the documentation and/or other materials provided with the
-** distribution.
-** * Neither the name of The Qt Company Ltd nor the names of its
-** contributors may be used to endorse or promote products derived
-** from this software without specific prior written permission.
-**
-**
-** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause
+#include <QObject>
+#include <QTextObjectInterface>
//! [0]
class SvgTextObject : public QObject, public QTextObjectInterface
@@ -54,3 +9,4 @@ class SvgTextObject : public QObject, public QTextObjectInterface
Q_OBJECT
Q_INTERFACES(QTextObjectInterface)
//! [0]
+};
diff --git a/src/gui/doc/snippets/rhioffscreen/color.frag b/src/gui/doc/snippets/rhioffscreen/color.frag
new file mode 100644
index 0000000000..ad9d953d02
--- /dev/null
+++ b/src/gui/doc/snippets/rhioffscreen/color.frag
@@ -0,0 +1,16 @@
+//! [0]
+#version 440
+
+layout(location = 0) in vec3 v_color;
+layout(location = 0) out vec4 fragColor;
+
+layout(std140, binding = 0) uniform buf {
+ mat4 mvp;
+ float opacity;
+};
+
+void main()
+{
+ fragColor = vec4(v_color * opacity, opacity);
+}
+//! [0]
diff --git a/src/gui/doc/snippets/rhioffscreen/color.vert b/src/gui/doc/snippets/rhioffscreen/color.vert
new file mode 100644
index 0000000000..0010e55561
--- /dev/null
+++ b/src/gui/doc/snippets/rhioffscreen/color.vert
@@ -0,0 +1,18 @@
+//! [0]
+#version 440
+
+layout(location = 0) in vec4 position;
+layout(location = 1) in vec3 color;
+layout(location = 0) out vec3 v_color;
+
+layout(std140, binding = 0) uniform buf {
+ mat4 mvp;
+ float opacity;
+};
+
+void main()
+{
+ v_color = color;
+ gl_Position = mvp * position;
+}
+//! [0]
diff --git a/src/gui/doc/snippets/rhioffscreen/main.cpp b/src/gui/doc/snippets/rhioffscreen/main.cpp
new file mode 100644
index 0000000000..c2c6f74dc1
--- /dev/null
+++ b/src/gui/doc/snippets/rhioffscreen/main.cpp
@@ -0,0 +1,151 @@
+// Copyright (C) 2023 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause
+
+//! [0]
+#include <QGuiApplication>
+#include <QImage>
+#include <QFile>
+#include <rhi/qrhi.h>
+
+int main(int argc, char **argv)
+{
+ QGuiApplication app(argc, argv);
+
+#if QT_CONFIG(vulkan)
+ QVulkanInstance inst;
+#endif
+ std::unique_ptr<QRhi> rhi;
+#if defined(Q_OS_WIN)
+ QRhiD3D12InitParams params;
+ rhi.reset(QRhi::create(QRhi::D3D12, &params));
+#elif QT_CONFIG(metal)
+ QRhiMetalInitParams params;
+ rhi.reset(QRhi::create(QRhi::Metal, &params));
+#elif QT_CONFIG(vulkan)
+ inst.setExtensions(QRhiVulkanInitParams::preferredInstanceExtensions());
+ if (inst.create()) {
+ QRhiVulkanInitParams params;
+ params.inst = &inst;
+ rhi.reset(QRhi::create(QRhi::Vulkan, &params));
+ } else {
+ qFatal("Failed to create Vulkan instance");
+ }
+#endif
+ if (rhi)
+ qDebug() << rhi->backendName() << rhi->driverInfo();
+ else
+ qFatal("Failed to initialize RHI");
+
+ float rotation = 0.0f;
+ float opacity = 1.0f;
+ int opacityDir = 1;
+
+ std::unique_ptr<QRhiTexture> tex(rhi->newTexture(QRhiTexture::RGBA8,
+ QSize(1280, 720),
+ 1,
+ QRhiTexture::RenderTarget | QRhiTexture::UsedAsTransferSource));
+ tex->create();
+ std::unique_ptr<QRhiTextureRenderTarget> rt(rhi->newTextureRenderTarget({ tex.get() }));
+ std::unique_ptr<QRhiRenderPassDescriptor> rp(rt->newCompatibleRenderPassDescriptor());
+ rt->setRenderPassDescriptor(rp.get());
+ rt->create();
+
+ QMatrix4x4 viewProjection = rhi->clipSpaceCorrMatrix();
+ viewProjection.perspective(45.0f, 1280 / 720.f, 0.01f, 1000.0f);
+ viewProjection.translate(0, 0, -4);
+
+ static float vertexData[] = { // Y up, CCW
+ 0.0f, 0.5f, 1.0f, 0.0f, 0.0f,
+ -0.5f, -0.5f, 0.0f, 1.0f, 0.0f,
+ 0.5f, -0.5f, 0.0f, 0.0f, 1.0f,
+ };
+
+ std::unique_ptr<QRhiBuffer> vbuf(rhi->newBuffer(QRhiBuffer::Immutable,
+ QRhiBuffer::VertexBuffer,
+ sizeof(vertexData)));
+ vbuf->create();
+
+ std::unique_ptr<QRhiBuffer> ubuf(rhi->newBuffer(QRhiBuffer::Dynamic,
+ QRhiBuffer::UniformBuffer,
+ 64 + 4));
+ ubuf->create();
+
+ std::unique_ptr<QRhiShaderResourceBindings> srb(rhi->newShaderResourceBindings());
+ srb->setBindings({
+ QRhiShaderResourceBinding::uniformBuffer(0,
+ QRhiShaderResourceBinding::VertexStage | QRhiShaderResourceBinding::FragmentStage,
+ ubuf.get())
+ });
+ srb->create();
+
+ std::unique_ptr<QRhiGraphicsPipeline> ps(rhi->newGraphicsPipeline());
+ QRhiGraphicsPipeline::TargetBlend premulAlphaBlend;
+ premulAlphaBlend.enable = true;
+ ps->setTargetBlends({ premulAlphaBlend });
+ static auto getShader = [](const QString &name) {
+ QFile f(name);
+ return f.open(QIODevice::ReadOnly) ? QShader::fromSerialized(f.readAll()) : QShader();
+ };
+ ps->setShaderStages({
+ { QRhiShaderStage::Vertex, getShader(QLatin1String("color.vert.qsb")) },
+ { QRhiShaderStage::Fragment, getShader(QLatin1String("color.frag.qsb")) }
+ });
+ QRhiVertexInputLayout inputLayout;
+ inputLayout.setBindings({
+ { 5 * sizeof(float) }
+ });
+ inputLayout.setAttributes({
+ { 0, 0, QRhiVertexInputAttribute::Float2, 0 },
+ { 0, 1, QRhiVertexInputAttribute::Float3, 2 * sizeof(float) }
+ });
+ ps->setVertexInputLayout(inputLayout);
+ ps->setShaderResourceBindings(srb.get());
+ ps->setRenderPassDescriptor(rp.get());
+ ps->create();
+
+ QRhiCommandBuffer *cb;
+ for (int frame = 0; frame < 20; ++frame) {
+ rhi->beginOffscreenFrame(&cb);
+
+ QRhiResourceUpdateBatch *u = rhi->nextResourceUpdateBatch();
+ if (frame == 0)
+ u->uploadStaticBuffer(vbuf.get(), vertexData);
+
+ QMatrix4x4 mvp = viewProjection;
+ mvp.rotate(rotation, 0, 1, 0);
+ u->updateDynamicBuffer(ubuf.get(), 0, 64, mvp.constData());
+ rotation += 5.0f;
+
+ u->updateDynamicBuffer(ubuf.get(), 64, 4, &opacity);
+ opacity += opacityDir * 0.2f;
+ if (opacity < 0.0f || opacity > 1.0f) {
+ opacityDir *= -1;
+ opacity = qBound(0.0f, opacity, 1.0f);
+ }
+
+ cb->beginPass(rt.get(), Qt::green, { 1.0f, 0 }, u);
+ cb->setGraphicsPipeline(ps.get());
+ cb->setViewport({ 0, 0, 1280, 720 });
+ cb->setShaderResources();
+ const QRhiCommandBuffer::VertexInput vbufBinding(vbuf.get(), 0);
+ cb->setVertexInput(0, 1, &vbufBinding);
+ cb->draw(3);
+ QRhiReadbackResult readbackResult;
+ u = rhi->nextResourceUpdateBatch();
+ u->readBackTexture({ tex.get() }, &readbackResult);
+ cb->endPass(u);
+
+ rhi->endOffscreenFrame();
+
+ QImage image(reinterpret_cast<const uchar *>(readbackResult.data.constData()),
+ readbackResult.pixelSize.width(),
+ readbackResult.pixelSize.height(),
+ QImage::Format_RGBA8888_Premultiplied);
+ if (rhi->isYUpInFramebuffer())
+ image = image.mirrored();
+ image.save(QString::asprintf("frame%d.png", frame));
+ }
+
+ return 0;
+}
+//! [0]
diff --git a/src/gui/doc/snippets/scribe-overview/main.cpp b/src/gui/doc/snippets/scribe-overview/main.cpp
index 6a0ff7a341..c58c93ec6c 100644
--- a/src/gui/doc/snippets/scribe-overview/main.cpp
+++ b/src/gui/doc/snippets/scribe-overview/main.cpp
@@ -1,83 +1,36 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the documentation of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:BSD$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** BSD License Usage
-** Alternatively, you may use this file under the terms of the BSD license
-** as follows:
-**
-** "Redistribution and use in source and binary forms, with or without
-** modification, are permitted provided that the following conditions are
-** met:
-** * Redistributions of source code must retain the above copyright
-** notice, this list of conditions and the following disclaimer.
-** * Redistributions in binary form must reproduce the above copyright
-** notice, this list of conditions and the following disclaimer in
-** the documentation and/or other materials provided with the
-** distribution.
-** * Neither the name of The Qt Company Ltd nor the names of its
-** contributors may be used to endorse or promote products derived
-** from this software without specific prior written permission.
-**
-**
-** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include <QtGui>
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause
+#include <QApplication>
+#include <QTextEdit>
void mergeFormat(QTextEdit *edit)
{
//! [0]
- QTextDocument *document = edit->document();
- QTextCursor cursor(document);
+QTextDocument *document = edit->document();
+QTextCursor cursor(document);
- cursor.movePosition(QTextCursor::Start);
- cursor.movePosition(QTextCursor::EndOfLine, QTextCursor::KeepAnchor);
+cursor.movePosition(QTextCursor::Start);
+cursor.movePosition(QTextCursor::EndOfLine, QTextCursor::KeepAnchor);
- QTextCharFormat format;
- format.setFontWeight(QFont::Bold);
+QTextCharFormat format;
+format.setFontWeight(QFont::Bold);
- cursor.mergeCharFormat(format);
+cursor.mergeCharFormat(format);
//! [0]
}
int main(int argc, char *argv[])
{
- QWidget *parent = 0;
- QString aStringContainingHTMLtext("<h1>Scribe Overview</h1>");
+QWidget *parent = nullptr;
+QString aStringContainingHTMLtext("<h1>Scribe Overview</h1>");
- QApplication app(argc, argv);
+QApplication app(argc, argv);
//! [1]
- QTextEdit *editor = new QTextEdit(parent);
- editor->setHtml(aStringContainingHTMLtext);
- editor->show();
+QTextEdit *editor = new QTextEdit(parent);
+editor->setHtml(aStringContainingHTMLtext);
+editor->show();
//! [1]
- return app.exec();
+return app.exec();
}
diff --git a/src/gui/doc/snippets/scribe-overview/scribe-overview.pro b/src/gui/doc/snippets/scribe-overview/scribe-overview.pro
deleted file mode 100644
index 16181f21cf..0000000000
--- a/src/gui/doc/snippets/scribe-overview/scribe-overview.pro
+++ /dev/null
@@ -1 +0,0 @@
-SOURCES = main.cpp
diff --git a/src/gui/doc/snippets/separations/finalwidget.cpp b/src/gui/doc/snippets/separations/finalwidget.cpp
index 4cc8abe7aa..3c308d9df8 100644
--- a/src/gui/doc/snippets/separations/finalwidget.cpp
+++ b/src/gui/doc/snippets/separations/finalwidget.cpp
@@ -1,52 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the documentation of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:BSD$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** BSD License Usage
-** Alternatively, you may use this file under the terms of the BSD license
-** as follows:
-**
-** "Redistribution and use in source and binary forms, with or without
-** modification, are permitted provided that the following conditions are
-** met:
-** * Redistributions of source code must retain the above copyright
-** notice, this list of conditions and the following disclaimer.
-** * Redistributions in binary form must reproduce the above copyright
-** notice, this list of conditions and the following disclaimer in
-** the documentation and/or other materials provided with the
-** distribution.
-** * Neither the name of The Qt Company Ltd nor the names of its
-** contributors may be used to endorse or promote products derived
-** from this software without specific prior written permission.
-**
-**
-** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause
/*
finalwidget.cpp
@@ -54,9 +7,16 @@ finalwidget.cpp
A widget to display an image and a label containing a description.
*/
-#include <QtGui>
#include "finalwidget.h"
+#include <QApplication>
+#include <QBuffer>
+#include <QDrag>
+#include <QLabel>
+#include <QMimeData>
+#include <QMouseEvent>
+#include <QVBoxLayout>
+
FinalWidget::FinalWidget(QWidget *parent, const QString &name,
const QSize &labelSize)
: QFrame(parent)
@@ -68,10 +28,9 @@ FinalWidget::FinalWidget(QWidget *parent, const QString &name,
imageLabel->setMinimumSize(labelSize);
nameLabel = new QLabel(name);
- QVBoxLayout *layout = new QVBoxLayout;
+ QVBoxLayout *layout = new QVBoxLayout(this);
layout->addWidget(imageLabel, 1);
layout->addWidget(nameLabel, 0);
- setLayout(layout);
}
/*!
@@ -96,7 +55,7 @@ void FinalWidget::mouseMoveEvent(QMouseEvent *event)
QByteArray output;
QBuffer outputBuffer(&output);
outputBuffer.open(QIODevice::WriteOnly);
- imageLabel->pixmap()->toImage().save(&outputBuffer, "PNG");
+ imageLabel->pixmap().toImage().save(&outputBuffer, "PNG");
mimeData->setData("image/png", output);
//! [0]
/*
@@ -105,13 +64,11 @@ void FinalWidget::mouseMoveEvent(QMouseEvent *event)
//! [1]
*/
drag->setMimeData(mimeData);
- drag->setPixmap(imageLabel->pixmap()->scaled(64, 64, Qt::KeepAspectRatio));
+ drag->setPixmap(imageLabel->pixmap().scaled(64, 64, Qt::KeepAspectRatio));
//! [2]
drag->setHotSpot(QPoint(drag->pixmap().width()/2,
drag->pixmap().height()));
//! [2]
-
- drag->start();
}
/*!
@@ -124,7 +81,7 @@ void FinalWidget::mousePressEvent(QMouseEvent *event)
dragStartPosition = event->pos();
}
-const QPixmap* FinalWidget::pixmap() const
+QPixmap FinalWidget::pixmap() const
{
return imageLabel->pixmap();
}
diff --git a/src/gui/doc/snippets/separations/finalwidget.h b/src/gui/doc/snippets/separations/finalwidget.h
index 886a5dfaf3..da65ca8be2 100644
--- a/src/gui/doc/snippets/separations/finalwidget.h
+++ b/src/gui/doc/snippets/separations/finalwidget.h
@@ -1,52 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the documentation of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:BSD$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** BSD License Usage
-** Alternatively, you may use this file under the terms of the BSD license
-** as follows:
-**
-** "Redistribution and use in source and binary forms, with or without
-** modification, are permitted provided that the following conditions are
-** met:
-** * Redistributions of source code must retain the above copyright
-** notice, this list of conditions and the following disclaimer.
-** * Redistributions in binary form must reproduce the above copyright
-** notice, this list of conditions and the following disclaimer in
-** the documentation and/or other materials provided with the
-** distribution.
-** * Neither the name of The Qt Company Ltd nor the names of its
-** contributors may be used to endorse or promote products derived
-** from this software without specific prior written permission.
-**
-**
-** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause
#ifndef FINALWIDGET_H
#define FINALWIDGET_H
@@ -68,7 +21,7 @@ class FinalWidget : public QFrame
public:
FinalWidget(QWidget *parent, const QString &name, const QSize &labelSize);
void setPixmap(const QPixmap &pixmap);
- const QPixmap *pixmap() const;
+ QPixmap pixmap() const;
protected:
void mouseMoveEvent(QMouseEvent *event) override;
diff --git a/src/gui/doc/snippets/separations/main.cpp b/src/gui/doc/snippets/separations/main.cpp
index a730f193a8..d3b63ceeb5 100644
--- a/src/gui/doc/snippets/separations/main.cpp
+++ b/src/gui/doc/snippets/separations/main.cpp
@@ -1,52 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the documentation of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:BSD$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** BSD License Usage
-** Alternatively, you may use this file under the terms of the BSD license
-** as follows:
-**
-** "Redistribution and use in source and binary forms, with or without
-** modification, are permitted provided that the following conditions are
-** met:
-** * Redistributions of source code must retain the above copyright
-** notice, this list of conditions and the following disclaimer.
-** * Redistributions in binary form must reproduce the above copyright
-** notice, this list of conditions and the following disclaimer in
-** the documentation and/or other materials provided with the
-** distribution.
-** * Neither the name of The Qt Company Ltd nor the names of its
-** contributors may be used to endorse or promote products derived
-** from this software without specific prior written permission.
-**
-**
-** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause
#include <QApplication>
#include "viewer.h"
diff --git a/src/gui/doc/snippets/separations/screenwidget.cpp b/src/gui/doc/snippets/separations/screenwidget.cpp
index d562991d26..223de95962 100644
--- a/src/gui/doc/snippets/separations/screenwidget.cpp
+++ b/src/gui/doc/snippets/separations/screenwidget.cpp
@@ -1,52 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the documentation of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:BSD$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** BSD License Usage
-** Alternatively, you may use this file under the terms of the BSD license
-** as follows:
-**
-** "Redistribution and use in source and binary forms, with or without
-** modification, are permitted provided that the following conditions are
-** met:
-** * Redistributions of source code must retain the above copyright
-** notice, this list of conditions and the following disclaimer.
-** * Redistributions in binary form must reproduce the above copyright
-** notice, this list of conditions and the following disclaimer in
-** the documentation and/or other materials provided with the
-** distribution.
-** * Neither the name of The Qt Company Ltd nor the names of its
-** contributors may be used to endorse or promote products derived
-** from this software without specific prior written permission.
-**
-**
-** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause
/*
screenwidget.cpp
@@ -108,12 +61,11 @@ ScreenWidget::ScreenWidget(QWidget *parent, QColor initialColor,
connect(colorButton, &QPushButton::clicked, this, &ScreenWidget::setColor);
connect(invertButton, &QPushButton::clicked, this, &ScreenWidget::invertImage);
- QGridLayout *gridLayout = new QGridLayout;
+ QGridLayout *gridLayout = new QGridLayout(this);
gridLayout->addWidget(imageLabel, 0, 0, 1, 2);
gridLayout->addWidget(nameLabel, 1, 0);
gridLayout->addWidget(colorButton, 1, 1);
gridLayout->addWidget(invertButton, 2, 1, 1, 1);
- setLayout(gridLayout);
}
/*!
diff --git a/src/gui/doc/snippets/separations/screenwidget.h b/src/gui/doc/snippets/separations/screenwidget.h
index 1fc839be65..ae2d736851 100644
--- a/src/gui/doc/snippets/separations/screenwidget.h
+++ b/src/gui/doc/snippets/separations/screenwidget.h
@@ -1,52 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the documentation of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:BSD$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** BSD License Usage
-** Alternatively, you may use this file under the terms of the BSD license
-** as follows:
-**
-** "Redistribution and use in source and binary forms, with or without
-** modification, are permitted provided that the following conditions are
-** met:
-** * Redistributions of source code must retain the above copyright
-** notice, this list of conditions and the following disclaimer.
-** * Redistributions in binary form must reproduce the above copyright
-** notice, this list of conditions and the following disclaimer in
-** the documentation and/or other materials provided with the
-** distribution.
-** * Neither the name of The Qt Company Ltd nor the names of its
-** contributors may be used to endorse or promote products derived
-** from this software without specific prior written permission.
-**
-**
-** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause
#ifndef SCREENWIDGET_H
#define SCREENWIDGET_H
diff --git a/src/gui/doc/snippets/separations/separations.pro b/src/gui/doc/snippets/separations/separations.pro
deleted file mode 100644
index 48af2c8472..0000000000
--- a/src/gui/doc/snippets/separations/separations.pro
+++ /dev/null
@@ -1,7 +0,0 @@
-HEADERS = finalwidget.h \
- screenwidget.h \
- viewer.h
-SOURCES = finalwidget.cpp \
- main.cpp \
- screenwidget.cpp \
- viewer.cpp
diff --git a/src/gui/doc/snippets/separations/separations.qdoc b/src/gui/doc/snippets/separations/separations.qdoc
index ecb35012ee..ee567030bb 100644
--- a/src/gui/doc/snippets/separations/separations.qdoc
+++ b/src/gui/doc/snippets/separations/separations.qdoc
@@ -1,52 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the documentation of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:BSD$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** BSD License Usage
-** Alternatively, you may use this file under the terms of the BSD license
-** as follows:
-**
-** "Redistribution and use in source and binary forms, with or without
-** modification, are permitted provided that the following conditions are
-** met:
-** * Redistributions of source code must retain the above copyright
-** notice, this list of conditions and the following disclaimer.
-** * Redistributions in binary form must reproduce the above copyright
-** notice, this list of conditions and the following disclaimer in
-** the documentation and/or other materials provided with the
-** distribution.
-** * Neither the name of The Qt Company Ltd nor the names of its
-** contributors may be used to endorse or promote products derived
-** from this software without specific prior written permission.
-**
-**
-** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GFDL-1.3-no-invariants-only
/*
\example painting/separations
diff --git a/src/gui/doc/snippets/separations/viewer.cpp b/src/gui/doc/snippets/separations/viewer.cpp
index 018b397f1a..87378a3852 100644
--- a/src/gui/doc/snippets/separations/viewer.cpp
+++ b/src/gui/doc/snippets/separations/viewer.cpp
@@ -1,52 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the documentation of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:BSD$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** BSD License Usage
-** Alternatively, you may use this file under the terms of the BSD license
-** as follows:
-**
-** "Redistribution and use in source and binary forms, with or without
-** modification, are permitted provided that the following conditions are
-** met:
-** * Redistributions of source code must retain the above copyright
-** notice, this list of conditions and the following disclaimer.
-** * Redistributions in binary form must reproduce the above copyright
-** notice, this list of conditions and the following disclaimer in
-** the documentation and/or other materials provided with the
-** distribution.
-** * Neither the name of The Qt Company Ltd nor the names of its
-** contributors may be used to endorse or promote products derived
-** from this software without specific prior written permission.
-**
-**
-** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause
/*
viewer.cpp
@@ -145,7 +98,6 @@ QFrame* Viewer::createCentralWidget()
QFrame* frame = new QFrame(this);
grid = new QGridLayout(frame);
grid->setSpacing(8);
- grid->setMargin(4);
layout()->setSizeConstraint(QLayout::SetFixedSize);
@@ -324,7 +276,7 @@ void Viewer::saveImage()
QString newImageFile = QFileInfo(info.absoluteDir(),
info.baseName() + ".png").absoluteFilePath();
- if (!finalWidget->pixmap()->save(newImageFile, "PNG"))
+ if (!finalWidget->pixmap().save(newImageFile, "PNG"))
(void) QMessageBox::warning(this, tr("Cannot save file"),
tr("The file could not be saved."),
QMessageBox::Cancel, QMessageBox::NoButton,
diff --git a/src/gui/doc/snippets/separations/viewer.h b/src/gui/doc/snippets/separations/viewer.h
index 5dfba3a209..869372cb83 100644
--- a/src/gui/doc/snippets/separations/viewer.h
+++ b/src/gui/doc/snippets/separations/viewer.h
@@ -1,52 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the documentation of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:BSD$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** BSD License Usage
-** Alternatively, you may use this file under the terms of the BSD license
-** as follows:
-**
-** "Redistribution and use in source and binary forms, with or without
-** modification, are permitted provided that the following conditions are
-** met:
-** * Redistributions of source code must retain the above copyright
-** notice, this list of conditions and the following disclaimer.
-** * Redistributions in binary form must reproduce the above copyright
-** notice, this list of conditions and the following disclaimer in
-** the documentation and/or other materials provided with the
-** distribution.
-** * Neither the name of The Qt Company Ltd nor the names of its
-** contributors may be used to endorse or promote products derived
-** from this software without specific prior written permission.
-**
-**
-** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause
#ifndef VIEWER_H
#define VIEWER_H
diff --git a/src/gui/doc/snippets/textblock-formats/main.cpp b/src/gui/doc/snippets/textblock-formats/main.cpp
index daa8f67f8b..d9ca3eff35 100644
--- a/src/gui/doc/snippets/textblock-formats/main.cpp
+++ b/src/gui/doc/snippets/textblock-formats/main.cpp
@@ -1,61 +1,14 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the documentation of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:BSD$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** BSD License Usage
-** Alternatively, you may use this file under the terms of the BSD license
-** as follows:
-**
-** "Redistribution and use in source and binary forms, with or without
-** modification, are permitted provided that the following conditions are
-** met:
-** * Redistributions of source code must retain the above copyright
-** notice, this list of conditions and the following disclaimer.
-** * Redistributions in binary form must reproduce the above copyright
-** notice, this list of conditions and the following disclaimer in
-** the documentation and/or other materials provided with the
-** distribution.
-** * Neither the name of The Qt Company Ltd nor the names of its
-** contributors may be used to endorse or promote products derived
-** from this software without specific prior written permission.
-**
-**
-** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include <QtGui>
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause
+#include <QApplication>
+#include <QTextEdit>
QString tr(const char *text)
{
return QApplication::translate(text, text);
}
-int main(int argc, char *argv[])
+int main_textblock_formats(int argc, char *argv[])
{
QApplication app(argc, argv);
diff --git a/src/gui/doc/snippets/textblock-formats/textblock-formats.pro b/src/gui/doc/snippets/textblock-formats/textblock-formats.pro
deleted file mode 100644
index d664835b09..0000000000
--- a/src/gui/doc/snippets/textblock-formats/textblock-formats.pro
+++ /dev/null
@@ -1,2 +0,0 @@
-QT += xml
-SOURCES = main.cpp
diff --git a/src/gui/doc/snippets/textblock-fragments/main.cpp b/src/gui/doc/snippets/textblock-fragments/main.cpp
deleted file mode 100644
index 60afcac7b5..0000000000
--- a/src/gui/doc/snippets/textblock-fragments/main.cpp
+++ /dev/null
@@ -1,62 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the documentation of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:BSD$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** BSD License Usage
-** Alternatively, you may use this file under the terms of the BSD license
-** as follows:
-**
-** "Redistribution and use in source and binary forms, with or without
-** modification, are permitted provided that the following conditions are
-** met:
-** * Redistributions of source code must retain the above copyright
-** notice, this list of conditions and the following disclaimer.
-** * Redistributions in binary form must reproduce the above copyright
-** notice, this list of conditions and the following disclaimer in
-** the documentation and/or other materials provided with the
-** distribution.
-** * Neither the name of The Qt Company Ltd nor the names of its
-** contributors may be used to endorse or promote products derived
-** from this software without specific prior written permission.
-**
-**
-** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include <QtGui>
-
-#include "mainwindow.h"
-
-int main(int argc, char *argv[])
-{
- QApplication app(argc, argv);
- MainWindow *window = new MainWindow;
- window->resize(640, 480);
- window->show();
- return app.exec();
-}
diff --git a/src/gui/doc/snippets/textblock-fragments/mainwindow.cpp b/src/gui/doc/snippets/textblock-fragments/mainwindow.cpp
deleted file mode 100644
index 236d6952e6..0000000000
--- a/src/gui/doc/snippets/textblock-fragments/mainwindow.cpp
+++ /dev/null
@@ -1,158 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the documentation of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:BSD$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** BSD License Usage
-** Alternatively, you may use this file under the terms of the BSD license
-** as follows:
-**
-** "Redistribution and use in source and binary forms, with or without
-** modification, are permitted provided that the following conditions are
-** met:
-** * Redistributions of source code must retain the above copyright
-** notice, this list of conditions and the following disclaimer.
-** * Redistributions in binary form must reproduce the above copyright
-** notice, this list of conditions and the following disclaimer in
-** the documentation and/or other materials provided with the
-** distribution.
-** * Neither the name of The Qt Company Ltd nor the names of its
-** contributors may be used to endorse or promote products derived
-** from this software without specific prior written permission.
-**
-**
-** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include <QtWidgets>
-
-#include "mainwindow.h"
-#include "xmlwriter.h"
-
-MainWindow::MainWindow()
-{
- QMenu *fileMenu = new QMenu(tr("&File"));
-
- QAction *saveAction = fileMenu->addAction(tr("&Save..."));
- saveAction->setShortcut(tr("Ctrl+S"));
-
- QAction *quitAction = fileMenu->addAction(tr("E&xit"));
- quitAction->setShortcut(tr("Ctrl+Q"));
-
- QMenu *insertMenu = new QMenu(tr("&Insert"));
-
- QAction *calendarAction = insertMenu->addAction(tr("&Calendar"));
- calendarAction->setShortcut(tr("Ctrl+I"));
-
- menuBar()->addMenu(fileMenu);
- menuBar()->addMenu(insertMenu);
-
- editor = new QTextEdit(this);
-
- connect(saveAction, &QAction::triggered, this, &MainWindow::saveFile);
- connect(quitAction, &QAction::triggered, this, &MainWindow::close);
- connect(calendarAction, &QAction::triggered, this, &MainWindow::insertCalendar);
-
- setCentralWidget(editor);
- setWindowTitle(tr("Text Document Writer"));
-}
-
-void MainWindow::saveFile()
-{
- QString fileName = QFileDialog::getSaveFileName(this,
- tr("Save document as:"), "", tr("XML (*.xml)"));
-
- if (!fileName.isEmpty()) {
- if (writeXml(fileName))
- setWindowTitle(fileName);
- else
- QMessageBox::warning(this, tr("Warning"),
- tr("Failed to save the document."), QMessageBox::Cancel,
- QMessageBox::NoButton);
- }
-}
-
-void MainWindow::insertCalendar()
-{
- QTextCursor cursor(editor->textCursor());
- cursor.movePosition(QTextCursor::Start);
-
- QTextCharFormat format(cursor.charFormat());
- format.setFontFamily("Courier");
-
- QTextCharFormat boldFormat = format;
- boldFormat.setFontWeight(QFont::Bold);
-
- cursor.insertBlock();
- cursor.insertText(" ", boldFormat);
-
- QDate date = QDate::currentDate();
- int year = date.year(), month = date.month();
-
- for (int weekDay = 1; weekDay <= 7; ++weekDay) {
- cursor.insertText(QString("%1 ").arg(QLocale::system().dayName(weekDay), 3),
- boldFormat);
- }
-
- cursor.insertBlock();
- cursor.insertText(" ", format);
-
- for (int column = 1; column < QDate(year, month, 1).dayOfWeek(); ++column) {
- cursor.insertText(" ", format);
- }
-
- for (int day = 1; day <= date.daysInMonth(); ++day) {
- int weekDay = QDate(year, month, day).dayOfWeek();
-
- if (QDate(year, month, day) == date)
- cursor.insertText(QString("%1 ").arg(day, 3), boldFormat);
- else
- cursor.insertText(QString("%1 ").arg(day, 3), format);
-
- if (weekDay == 7) {
- cursor.insertBlock();
- cursor.insertText(" ", format);
- }
- }
-}
-
-bool MainWindow::writeXml(const QString &fileName)
-{
- XmlWriter documentWriter(editor->document());
-
- QDomDocument *domDocument = documentWriter.toXml();
- QFile file(fileName);
-
- if (file.open(QFile::WriteOnly)) {
- QTextStream textStream(&file);
-
- textStream << domDocument->toByteArray(1);
- return true;
- }
- else
- return false;
-}
diff --git a/src/gui/doc/snippets/textblock-fragments/mainwindow.h b/src/gui/doc/snippets/textblock-fragments/mainwindow.h
deleted file mode 100644
index 0ce579c158..0000000000
--- a/src/gui/doc/snippets/textblock-fragments/mainwindow.h
+++ /dev/null
@@ -1,75 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the documentation of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:BSD$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** BSD License Usage
-** Alternatively, you may use this file under the terms of the BSD license
-** as follows:
-**
-** "Redistribution and use in source and binary forms, with or without
-** modification, are permitted provided that the following conditions are
-** met:
-** * Redistributions of source code must retain the above copyright
-** notice, this list of conditions and the following disclaimer.
-** * Redistributions in binary form must reproduce the above copyright
-** notice, this list of conditions and the following disclaimer in
-** the documentation and/or other materials provided with the
-** distribution.
-** * Neither the name of The Qt Company Ltd nor the names of its
-** contributors may be used to endorse or promote products derived
-** from this software without specific prior written permission.
-**
-**
-** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef WINDOW_H
-#define WINDOW_H
-
-#include <QMainWindow>
-
-class QTextEdit;
-
-class MainWindow : public QMainWindow
-{
- Q_OBJECT
-
-public:
- MainWindow();
-
-public slots:
- void insertCalendar();
- void saveFile();
-
-private:
- bool writeXml(const QString &fileName);
-
- QTextEdit *editor;
-};
-
-#endif
diff --git a/src/gui/doc/snippets/textblock-fragments/textblock-fragments.pro b/src/gui/doc/snippets/textblock-fragments/textblock-fragments.pro
deleted file mode 100644
index 83ed78e573..0000000000
--- a/src/gui/doc/snippets/textblock-fragments/textblock-fragments.pro
+++ /dev/null
@@ -1,6 +0,0 @@
-QT += xml
-HEADERS = mainwindow.h \
- xmlwriter.h
-SOURCES = main.cpp \
- mainwindow.cpp \
- xmlwriter.cpp
diff --git a/src/gui/doc/snippets/textblock-fragments/xmlwriter.cpp b/src/gui/doc/snippets/textblock-fragments/xmlwriter.cpp
index 1172b39847..ce9dab80f9 100644
--- a/src/gui/doc/snippets/textblock-fragments/xmlwriter.cpp
+++ b/src/gui/doc/snippets/textblock-fragments/xmlwriter.cpp
@@ -1,57 +1,9 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the documentation of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:BSD$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** BSD License Usage
-** Alternatively, you may use this file under the terms of the BSD license
-** as follows:
-**
-** "Redistribution and use in source and binary forms, with or without
-** modification, are permitted provided that the following conditions are
-** met:
-** * Redistributions of source code must retain the above copyright
-** notice, this list of conditions and the following disclaimer.
-** * Redistributions in binary form must reproduce the above copyright
-** notice, this list of conditions and the following disclaimer in
-** the documentation and/or other materials provided with the
-** distribution.
-** * Neither the name of The Qt Company Ltd nor the names of its
-** contributors may be used to endorse or promote products derived
-** from this software without specific prior written permission.
-**
-**
-** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include <QtGui>
-
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause
#include "xmlwriter.h"
+#include <QTextDocument>
+
QDomDocument *XmlWriter::toXml()
{
QDomImplementation implementation;
@@ -120,8 +72,15 @@ void XmlWriter::readFragment(const QTextBlock &currentBlock,
void XmlWriter::processBlock(const QTextBlock &currentBlock)
{
+ // Dummy use of specified parameter currentBlock
+ QTextBlock localBlock;
+ localBlock = currentBlock;
+
}
void XmlWriter::processFragment(const QTextFragment &currentFragment)
{
+ // Dummy use of specified parameter currentFragment
+ QTextFragment localFragment;
+ localFragment = currentFragment;
}
diff --git a/src/gui/doc/snippets/textblock-fragments/xmlwriter.h b/src/gui/doc/snippets/textblock-fragments/xmlwriter.h
index a9562e7c42..910a87b50e 100644
--- a/src/gui/doc/snippets/textblock-fragments/xmlwriter.h
+++ b/src/gui/doc/snippets/textblock-fragments/xmlwriter.h
@@ -1,57 +1,11 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the documentation of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:BSD$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** BSD License Usage
-** Alternatively, you may use this file under the terms of the BSD license
-** as follows:
-**
-** "Redistribution and use in source and binary forms, with or without
-** modification, are permitted provided that the following conditions are
-** met:
-** * Redistributions of source code must retain the above copyright
-** notice, this list of conditions and the following disclaimer.
-** * Redistributions in binary form must reproduce the above copyright
-** notice, this list of conditions and the following disclaimer in
-** the documentation and/or other materials provided with the
-** distribution.
-** * Neither the name of The Qt Company Ltd nor the names of its
-** contributors may be used to endorse or promote products derived
-** from this software without specific prior written permission.
-**
-**
-** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause
#ifndef XMLWRITER_H
#define XMLWRITER_H
#include <QDomDocument>
+#include <QTextBlock>
class QTextDocument;
diff --git a/src/gui/doc/snippets/textdocument-blocks/main.cpp b/src/gui/doc/snippets/textdocument-blocks/main.cpp
index 60afcac7b5..026cd59961 100644
--- a/src/gui/doc/snippets/textdocument-blocks/main.cpp
+++ b/src/gui/doc/snippets/textdocument-blocks/main.cpp
@@ -1,62 +1,16 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the documentation of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:BSD$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** BSD License Usage
-** Alternatively, you may use this file under the terms of the BSD license
-** as follows:
-**
-** "Redistribution and use in source and binary forms, with or without
-** modification, are permitted provided that the following conditions are
-** met:
-** * Redistributions of source code must retain the above copyright
-** notice, this list of conditions and the following disclaimer.
-** * Redistributions in binary form must reproduce the above copyright
-** notice, this list of conditions and the following disclaimer in
-** the documentation and/or other materials provided with the
-** distribution.
-** * Neither the name of The Qt Company Ltd nor the names of its
-** contributors may be used to endorse or promote products derived
-** from this software without specific prior written permission.
-**
-**
-** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause
#include <QtGui>
#include "mainwindow.h"
+#include <QApplication>
int main(int argc, char *argv[])
{
QApplication app(argc, argv);
- MainWindow *window = new MainWindow;
- window->resize(640, 480);
- window->show();
+ MainWindow window;
+ window.resize(640, 480);
+ window.show();
return app.exec();
}
diff --git a/src/gui/doc/snippets/textdocument-blocks/mainwindow.cpp b/src/gui/doc/snippets/textdocument-blocks/mainwindow.cpp
index 849f0e957f..a55336b01c 100644
--- a/src/gui/doc/snippets/textdocument-blocks/mainwindow.cpp
+++ b/src/gui/doc/snippets/textdocument-blocks/mainwindow.cpp
@@ -1,57 +1,9 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the documentation of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:BSD$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** BSD License Usage
-** Alternatively, you may use this file under the terms of the BSD license
-** as follows:
-**
-** "Redistribution and use in source and binary forms, with or without
-** modification, are permitted provided that the following conditions are
-** met:
-** * Redistributions of source code must retain the above copyright
-** notice, this list of conditions and the following disclaimer.
-** * Redistributions in binary form must reproduce the above copyright
-** notice, this list of conditions and the following disclaimer in
-** the documentation and/or other materials provided with the
-** distribution.
-** * Neither the name of The Qt Company Ltd nor the names of its
-** contributors may be used to endorse or promote products derived
-** from this software without specific prior written permission.
-**
-**
-** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause
#include <QtWidgets>
#include "mainwindow.h"
-#include "xmlwriter.h"
MainWindow::MainWindow()
{
@@ -146,21 +98,3 @@ void MainWindow::insertCalendar()
//! [3]
}
-bool MainWindow::writeXml(const QString &fileName)
-{
- XmlWriter documentWriter(editor->document());
-
- QDomDocument *domDocument = documentWriter.toXml();
- QFile file(fileName);
-
- if (file.open(QFile::WriteOnly)) {
- QTextStream textStream(&file);
- textStream.setCodec(QTextCodec::codecForName("UTF-8"));
-
- textStream << domDocument->toString(1).toUtf8();
- file.close();
- return true;
- }
- else
- return false;
-}
diff --git a/src/gui/doc/snippets/textdocument-blocks/mainwindow.h b/src/gui/doc/snippets/textdocument-blocks/mainwindow.h
index 0ce579c158..32fdcfd1c8 100644
--- a/src/gui/doc/snippets/textdocument-blocks/mainwindow.h
+++ b/src/gui/doc/snippets/textdocument-blocks/mainwindow.h
@@ -1,52 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the documentation of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:BSD$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** BSD License Usage
-** Alternatively, you may use this file under the terms of the BSD license
-** as follows:
-**
-** "Redistribution and use in source and binary forms, with or without
-** modification, are permitted provided that the following conditions are
-** met:
-** * Redistributions of source code must retain the above copyright
-** notice, this list of conditions and the following disclaimer.
-** * Redistributions in binary form must reproduce the above copyright
-** notice, this list of conditions and the following disclaimer in
-** the documentation and/or other materials provided with the
-** distribution.
-** * Neither the name of The Qt Company Ltd nor the names of its
-** contributors may be used to endorse or promote products derived
-** from this software without specific prior written permission.
-**
-**
-** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause
#ifndef WINDOW_H
#define WINDOW_H
diff --git a/src/gui/doc/snippets/textdocument-blocks/textdocument-blocks.pro b/src/gui/doc/snippets/textdocument-blocks/textdocument-blocks.pro
deleted file mode 100644
index 83ed78e573..0000000000
--- a/src/gui/doc/snippets/textdocument-blocks/textdocument-blocks.pro
+++ /dev/null
@@ -1,6 +0,0 @@
-QT += xml
-HEADERS = mainwindow.h \
- xmlwriter.h
-SOURCES = main.cpp \
- mainwindow.cpp \
- xmlwriter.cpp
diff --git a/src/gui/doc/snippets/textdocument-blocks/xmlwriter.cpp b/src/gui/doc/snippets/textdocument-blocks/xmlwriter.cpp
deleted file mode 100644
index b6bea4730b..0000000000
--- a/src/gui/doc/snippets/textdocument-blocks/xmlwriter.cpp
+++ /dev/null
@@ -1,94 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the documentation of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:BSD$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** BSD License Usage
-** Alternatively, you may use this file under the terms of the BSD license
-** as follows:
-**
-** "Redistribution and use in source and binary forms, with or without
-** modification, are permitted provided that the following conditions are
-** met:
-** * Redistributions of source code must retain the above copyright
-** notice, this list of conditions and the following disclaimer.
-** * Redistributions in binary form must reproduce the above copyright
-** notice, this list of conditions and the following disclaimer in
-** the documentation and/or other materials provided with the
-** distribution.
-** * Neither the name of The Qt Company Ltd nor the names of its
-** contributors may be used to endorse or promote products derived
-** from this software without specific prior written permission.
-**
-**
-** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include <QtGui>
-
-#include "xmlwriter.h"
-
-QDomDocument *XmlWriter::toXml()
-{
- QDomImplementation implementation;
- QDomDocumentType docType = implementation.createDocumentType(
- "scribe-document", "scribe", "qt.nokia.com/scribe");
-
- document = new QDomDocument(docType);
-
- // ### This processing instruction is required to ensure that any kind
- // of encoding is given when the document is written.
- QDomProcessingInstruction process = document->createProcessingInstruction(
- "xml", "version=\"1.0\" encoding=\"utf-8\"");
- document->appendChild(process);
-
- QDomElement documentElement = document->createElement("document");
- document->appendChild(documentElement);
-
- QTextBlock firstBlock = textDocument->begin();
- createItems(documentElement, firstBlock);
-
- return document;
-}
-
-void XmlWriter::createItems(QDomElement &parent, const QTextBlock &block)
-{
- QTextBlock currentBlock = block;
-
- while (currentBlock.isValid()) {
- QDomElement blockElement = document->createElement("block");
- blockElement.setAttribute("length", currentBlock.length());
- parent.appendChild(blockElement);
-
- if (!(currentBlock.text().isNull())) {
- QDomText textNode = document->createTextNode(currentBlock.text());
- blockElement.appendChild(textNode);
- }
-
- currentBlock = currentBlock.next();
- }
-}
diff --git a/src/gui/doc/snippets/textdocument-blocks/xmlwriter.h b/src/gui/doc/snippets/textdocument-blocks/xmlwriter.h
deleted file mode 100644
index e9455550d1..0000000000
--- a/src/gui/doc/snippets/textdocument-blocks/xmlwriter.h
+++ /dev/null
@@ -1,71 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the documentation of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:BSD$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** BSD License Usage
-** Alternatively, you may use this file under the terms of the BSD license
-** as follows:
-**
-** "Redistribution and use in source and binary forms, with or without
-** modification, are permitted provided that the following conditions are
-** met:
-** * Redistributions of source code must retain the above copyright
-** notice, this list of conditions and the following disclaimer.
-** * Redistributions in binary form must reproduce the above copyright
-** notice, this list of conditions and the following disclaimer in
-** the documentation and/or other materials provided with the
-** distribution.
-** * Neither the name of The Qt Company Ltd nor the names of its
-** contributors may be used to endorse or promote products derived
-** from this software without specific prior written permission.
-**
-**
-** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef XMLWRITER_H
-#define XMLWRITER_H
-
-#include <QDomDocument>
-
-class QTextDocument;
-
-class XmlWriter
-{
-public:
- XmlWriter(QTextDocument *document) : textDocument(document) {}
- QDomDocument *toXml();
-
-private:
- void createItems(QDomElement &parent, const QTextBlock &block);
-
- QDomDocument *document;
- QTextDocument *textDocument;
-};
-
-#endif
diff --git a/src/gui/doc/snippets/textdocument-charformats/main.cpp b/src/gui/doc/snippets/textdocument-charformats/main.cpp
index 55a8eca9db..381f204cae 100644
--- a/src/gui/doc/snippets/textdocument-charformats/main.cpp
+++ b/src/gui/doc/snippets/textdocument-charformats/main.cpp
@@ -1,54 +1,7 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the documentation of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:BSD$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** BSD License Usage
-** Alternatively, you may use this file under the terms of the BSD license
-** as follows:
-**
-** "Redistribution and use in source and binary forms, with or without
-** modification, are permitted provided that the following conditions are
-** met:
-** * Redistributions of source code must retain the above copyright
-** notice, this list of conditions and the following disclaimer.
-** * Redistributions in binary form must reproduce the above copyright
-** notice, this list of conditions and the following disclaimer in
-** the documentation and/or other materials provided with the
-** distribution.
-** * Neither the name of The Qt Company Ltd nor the names of its
-** contributors may be used to endorse or promote products derived
-** from this software without specific prior written permission.
-**
-**
-** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include <QtGui>
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause
+#include <QApplication>
+#include <QTextEdit>
QString tr(const char *text)
{
diff --git a/src/gui/doc/snippets/textdocument-charformats/textdocument-charformats.pro b/src/gui/doc/snippets/textdocument-charformats/textdocument-charformats.pro
deleted file mode 100644
index 16181f21cf..0000000000
--- a/src/gui/doc/snippets/textdocument-charformats/textdocument-charformats.pro
+++ /dev/null
@@ -1 +0,0 @@
-SOURCES = main.cpp
diff --git a/src/gui/doc/snippets/textdocument-css/main.cpp b/src/gui/doc/snippets/textdocument-css/main.cpp
index d8aac0c5f5..8ac28adbc3 100644
--- a/src/gui/doc/snippets/textdocument-css/main.cpp
+++ b/src/gui/doc/snippets/textdocument-css/main.cpp
@@ -1,54 +1,7 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the documentation of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:BSD$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** BSD License Usage
-** Alternatively, you may use this file under the terms of the BSD license
-** as follows:
-**
-** "Redistribution and use in source and binary forms, with or without
-** modification, are permitted provided that the following conditions are
-** met:
-** * Redistributions of source code must retain the above copyright
-** notice, this list of conditions and the following disclaimer.
-** * Redistributions in binary form must reproduce the above copyright
-** notice, this list of conditions and the following disclaimer in
-** the documentation and/or other materials provided with the
-** distribution.
-** * Neither the name of The Qt Company Ltd nor the names of its
-** contributors may be used to endorse or promote products derived
-** from this software without specific prior written permission.
-**
-**
-** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include <QtGui>
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause
+#include <QApplication>
+#include <QTextBrowser>
int main(int argc, char **argv)
{
diff --git a/src/gui/doc/snippets/textdocument-cursors/main.cpp b/src/gui/doc/snippets/textdocument-cursors/main.cpp
index c19047b4e3..b71874a889 100644
--- a/src/gui/doc/snippets/textdocument-cursors/main.cpp
+++ b/src/gui/doc/snippets/textdocument-cursors/main.cpp
@@ -1,54 +1,7 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the documentation of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:BSD$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** BSD License Usage
-** Alternatively, you may use this file under the terms of the BSD license
-** as follows:
-**
-** "Redistribution and use in source and binary forms, with or without
-** modification, are permitted provided that the following conditions are
-** met:
-** * Redistributions of source code must retain the above copyright
-** notice, this list of conditions and the following disclaimer.
-** * Redistributions in binary form must reproduce the above copyright
-** notice, this list of conditions and the following disclaimer in
-** the documentation and/or other materials provided with the
-** distribution.
-** * Neither the name of The Qt Company Ltd nor the names of its
-** contributors may be used to endorse or promote products derived
-** from this software without specific prior written permission.
-**
-**
-** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include <QtGui>
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause
+#include <QApplication>
+#include <QTextEdit>
QString tr(const char *text)
{
diff --git a/src/gui/doc/snippets/textdocument-cursors/textdocument-cursors.pro b/src/gui/doc/snippets/textdocument-cursors/textdocument-cursors.pro
deleted file mode 100644
index 16181f21cf..0000000000
--- a/src/gui/doc/snippets/textdocument-cursors/textdocument-cursors.pro
+++ /dev/null
@@ -1 +0,0 @@
-SOURCES = main.cpp
diff --git a/src/gui/doc/snippets/textdocument-end/textdocumentendsnippet.cpp b/src/gui/doc/snippets/textdocument-end/textdocumentendsnippet.cpp
new file mode 100644
index 0000000000..1653fd4d2f
--- /dev/null
+++ b/src/gui/doc/snippets/textdocument-end/textdocumentendsnippet.cpp
@@ -0,0 +1,19 @@
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause
+
+#include <QtGui>
+#include <iostream>
+
+namespace textdocumentendsnippet {
+void wrapper()
+{
+ QString contentString("One\nTwp\nThree");
+ QTextDocument *doc = new QTextDocument(contentString);
+
+//! [0]
+for (QTextBlock it = doc->begin(); it != doc->end(); it = it.next())
+ std::cout << it.text().toStdString() << "\n";
+//! [0]
+
+} // wrapper
+} //textdocumentendsnippet
diff --git a/src/gui/doc/snippets/textdocument-find/main.cpp b/src/gui/doc/snippets/textdocument-find/main.cpp
index 2021760e48..4b3948b114 100644
--- a/src/gui/doc/snippets/textdocument-find/main.cpp
+++ b/src/gui/doc/snippets/textdocument-find/main.cpp
@@ -1,54 +1,7 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the documentation of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:BSD$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** BSD License Usage
-** Alternatively, you may use this file under the terms of the BSD license
-** as follows:
-**
-** "Redistribution and use in source and binary forms, with or without
-** modification, are permitted provided that the following conditions are
-** met:
-** * Redistributions of source code must retain the above copyright
-** notice, this list of conditions and the following disclaimer.
-** * Redistributions in binary form must reproduce the above copyright
-** notice, this list of conditions and the following disclaimer in
-** the documentation and/or other materials provided with the
-** distribution.
-** * Neither the name of The Qt Company Ltd nor the names of its
-** contributors may be used to endorse or promote products derived
-** from this software without specific prior written permission.
-**
-**
-** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include <QtGui>
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause
+#include <QApplication>
+#include <QTextEdit>
QString tr(const char *text)
{
diff --git a/src/gui/doc/snippets/textdocument-find/textdocument-find.pro b/src/gui/doc/snippets/textdocument-find/textdocument-find.pro
deleted file mode 100644
index 16181f21cf..0000000000
--- a/src/gui/doc/snippets/textdocument-find/textdocument-find.pro
+++ /dev/null
@@ -1 +0,0 @@
-SOURCES = main.cpp
diff --git a/src/gui/doc/snippets/textdocument-frames/main.cpp b/src/gui/doc/snippets/textdocument-frames/main.cpp
index d5ee759b8f..71c21ac803 100644
--- a/src/gui/doc/snippets/textdocument-frames/main.cpp
+++ b/src/gui/doc/snippets/textdocument-frames/main.cpp
@@ -1,56 +1,7 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the documentation of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:BSD$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** BSD License Usage
-** Alternatively, you may use this file under the terms of the BSD license
-** as follows:
-**
-** "Redistribution and use in source and binary forms, with or without
-** modification, are permitted provided that the following conditions are
-** met:
-** * Redistributions of source code must retain the above copyright
-** notice, this list of conditions and the following disclaimer.
-** * Redistributions in binary form must reproduce the above copyright
-** notice, this list of conditions and the following disclaimer in
-** the documentation and/or other materials provided with the
-** distribution.
-** * Neither the name of The Qt Company Ltd nor the names of its
-** contributors may be used to endorse or promote products derived
-** from this software without specific prior written permission.
-**
-**
-** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include <QtGui>
-
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause
#include "mainwindow.h"
+#include <QApplication>
int main(int argc, char *argv[])
{
diff --git a/src/gui/doc/snippets/textdocument-frames/mainwindow.cpp b/src/gui/doc/snippets/textdocument-frames/mainwindow.cpp
index edfadb4c77..5b9adbaf3b 100644
--- a/src/gui/doc/snippets/textdocument-frames/mainwindow.cpp
+++ b/src/gui/doc/snippets/textdocument-frames/mainwindow.cpp
@@ -1,57 +1,9 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the documentation of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:BSD$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** BSD License Usage
-** Alternatively, you may use this file under the terms of the BSD license
-** as follows:
-**
-** "Redistribution and use in source and binary forms, with or without
-** modification, are permitted provided that the following conditions are
-** met:
-** * Redistributions of source code must retain the above copyright
-** notice, this list of conditions and the following disclaimer.
-** * Redistributions in binary form must reproduce the above copyright
-** notice, this list of conditions and the following disclaimer in
-** the documentation and/or other materials provided with the
-** distribution.
-** * Neither the name of The Qt Company Ltd nor the names of its
-** contributors may be used to endorse or promote products derived
-** from this software without specific prior written permission.
-**
-**
-** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause
#include <QtWidgets>
#include "mainwindow.h"
-#include "xmlwriter.h"
MainWindow::MainWindow()
{
@@ -66,6 +18,12 @@ MainWindow::MainWindow()
menuBar()->addMenu(fileMenu);
editor = new QTextEdit;
+//! [rootframe]
+ QTextDocument *editorDocument = editor->document();
+ QTextFrame *root = editorDocument->rootFrame();
+//! [rootframe]
+ processFrame(root);
+
QTextCursor cursor(editor->textCursor());
cursor.movePosition(QTextCursor::Start);
@@ -151,21 +109,24 @@ void MainWindow::saveFile()
QMessageBox::NoButton);
}
}
-bool MainWindow::writeXml(const QString &fileName)
+
+void MainWindow::processBlock(QTextBlock)
{
- XmlWriter documentWriter(editor->document());
+}
- QDomDocument *domDocument = documentWriter.toXml();
- QFile file(fileName);
+void MainWindow::processFrame(QTextFrame *frame)
+{
+//! [4]
+ QTextFrame::iterator it;
+ for (it = frame->begin(); !(it.atEnd()); ++it) {
- if (file.open(QFile::WriteOnly)) {
- QTextStream textStream(&file);
- textStream.setCodec(QTextCodec::codecForName("UTF-8"));
+ QTextFrame *childFrame = it.currentFrame();
+ QTextBlock childBlock = it.currentBlock();
- textStream << domDocument->toString(1).toUtf8();
- file.close();
- return true;
+ if (childFrame)
+ processFrame(childFrame);
+ else if (childBlock.isValid())
+ processBlock(childBlock);
}
- else
- return false;
+//! [4]
}
diff --git a/src/gui/doc/snippets/textdocument-frames/mainwindow.h b/src/gui/doc/snippets/textdocument-frames/mainwindow.h
index d4f41c81c0..e535d67f32 100644
--- a/src/gui/doc/snippets/textdocument-frames/mainwindow.h
+++ b/src/gui/doc/snippets/textdocument-frames/mainwindow.h
@@ -1,52 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the documentation of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:BSD$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** BSD License Usage
-** Alternatively, you may use this file under the terms of the BSD license
-** as follows:
-**
-** "Redistribution and use in source and binary forms, with or without
-** modification, are permitted provided that the following conditions are
-** met:
-** * Redistributions of source code must retain the above copyright
-** notice, this list of conditions and the following disclaimer.
-** * Redistributions in binary form must reproduce the above copyright
-** notice, this list of conditions and the following disclaimer in
-** the documentation and/or other materials provided with the
-** distribution.
-** * Neither the name of The Qt Company Ltd nor the names of its
-** contributors may be used to endorse or promote products derived
-** from this software without specific prior written permission.
-**
-**
-** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause
#ifndef WINDOW_H
#define WINDOW_H
@@ -54,6 +7,8 @@
#include <QMainWindow>
class QTextEdit;
+class QTextFrame;
+class QTextBlock;
class MainWindow : public QMainWindow
{
@@ -67,8 +22,10 @@ public slots:
private:
bool writeXml(const QString &fileName);
+ void processBlock(QTextBlock);
+ void processFrame(QTextFrame *frame);
- QTextEdit *editor;
+ QTextEdit *editor = nullptr;
};
#endif
diff --git a/src/gui/doc/snippets/textdocument-frames/textdocument-frames.pro b/src/gui/doc/snippets/textdocument-frames/textdocument-frames.pro
deleted file mode 100644
index 91ae50f491..0000000000
--- a/src/gui/doc/snippets/textdocument-frames/textdocument-frames.pro
+++ /dev/null
@@ -1,6 +0,0 @@
-SOURCES = main.cpp \
- mainwindow.cpp \
- xmlwriter.cpp
-HEADERS = mainwindow.h \
- xmlwriter.h
-QT += xml
diff --git a/src/gui/doc/snippets/textdocument-frames/xmlwriter.cpp b/src/gui/doc/snippets/textdocument-frames/xmlwriter.cpp
deleted file mode 100644
index 137e88d904..0000000000
--- a/src/gui/doc/snippets/textdocument-frames/xmlwriter.cpp
+++ /dev/null
@@ -1,128 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the documentation of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:BSD$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** BSD License Usage
-** Alternatively, you may use this file under the terms of the BSD license
-** as follows:
-**
-** "Redistribution and use in source and binary forms, with or without
-** modification, are permitted provided that the following conditions are
-** met:
-** * Redistributions of source code must retain the above copyright
-** notice, this list of conditions and the following disclaimer.
-** * Redistributions in binary form must reproduce the above copyright
-** notice, this list of conditions and the following disclaimer in
-** the documentation and/or other materials provided with the
-** distribution.
-** * Neither the name of The Qt Company Ltd nor the names of its
-** contributors may be used to endorse or promote products derived
-** from this software without specific prior written permission.
-**
-**
-** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include <QtGui>
-
-#include "xmlwriter.h"
-
-QDomDocument *XmlWriter::toXml()
-{
- QDomImplementation implementation;
- QDomDocumentType docType = implementation.createDocumentType(
- "scribe-document", "scribe", "qt.nokia.com/scribe");
-
- document = new QDomDocument(docType);
-
- // ### This processing instruction is required to ensure that any kind
- // of encoding is given when the document is written.
- QDomProcessingInstruction process = document->createProcessingInstruction(
- "xml", "version=\"1.0\" encoding=\"utf-8\"");
- document->appendChild(process);
-
- QDomElement documentElement = document->createElement("document");
- document->appendChild(documentElement);
-
-//! [0]
- QTextFrame *root = textDocument->rootFrame();
-//! [0]
-
- if (root)
- processFrame(documentElement, root);
-
- return document;
-}
-
-void XmlWriter::processBlock(QDomElement &parent, const QTextBlock &block)
-{
- QDomElement blockElement = document->createElement("block");
- blockElement.setAttribute("position", block.position());
- blockElement.setAttribute("length", block.length());
- parent.appendChild(blockElement);
-
- QTextBlock::iterator it;
- for (it = block.begin(); !(it.atEnd()); ++it) {
- QTextFragment fragment = it.fragment();
-
- if (fragment.isValid()) {
- QDomElement fragmentElement = document->createElement("fragment");
- blockElement.appendChild(fragmentElement);
-
- fragmentElement.setAttribute("length", fragment.length());
- QDomText fragmentText = document->createTextNode(fragment.text());
-
- fragmentElement.appendChild(fragmentText);
- }
- }
-}
-
-void XmlWriter::processFrame(QDomElement &parent, QTextFrame *frame)
-{
- QDomElement frameElement = document->createElement("frame");
- frameElement.setAttribute("begin", frame->firstPosition());
- frameElement.setAttribute("end", frame->lastPosition());
- parent.appendChild(frameElement);
-
-//! [1]
- QDomElement frameElement = ...
-
- QTextFrame::iterator it;
- for (it = frame->begin(); !(it.atEnd()); ++it) {
-
- QTextFrame *childFrame = it.currentFrame();
- QTextBlock childBlock = it.currentBlock();
-
- if (childFrame)
-//! [1] //! [2]
- processFrame(frameElement, childFrame);
- else if (childBlock.isValid())
- processBlock(frameElement, childBlock);
- }
-//! [2]
-}
diff --git a/src/gui/doc/snippets/textdocument-frames/xmlwriter.h b/src/gui/doc/snippets/textdocument-frames/xmlwriter.h
deleted file mode 100644
index 156f383867..0000000000
--- a/src/gui/doc/snippets/textdocument-frames/xmlwriter.h
+++ /dev/null
@@ -1,74 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the documentation of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:BSD$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** BSD License Usage
-** Alternatively, you may use this file under the terms of the BSD license
-** as follows:
-**
-** "Redistribution and use in source and binary forms, with or without
-** modification, are permitted provided that the following conditions are
-** met:
-** * Redistributions of source code must retain the above copyright
-** notice, this list of conditions and the following disclaimer.
-** * Redistributions in binary form must reproduce the above copyright
-** notice, this list of conditions and the following disclaimer in
-** the documentation and/or other materials provided with the
-** distribution.
-** * Neither the name of The Qt Company Ltd nor the names of its
-** contributors may be used to endorse or promote products derived
-** from this software without specific prior written permission.
-**
-**
-** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef XMLWRITER_H
-#define XMLWRITER_H
-
-#include <QDomDocument>
-
-class QTextDocument;
-
-class XmlWriter
-{
-public:
- XmlWriter(QTextDocument *document) : textDocument(document) {}
- QDomDocument *toXml();
-
-private:
- void processBlock(QDomElement &parent, const QTextBlock &block);
- void processFrame(QDomElement &parent, QTextFrame *frame);
-
- QDomDocument *document;
-//! [0]
- QTextDocument *textDocument;
-//! [0]
-};
-
-#endif
diff --git a/src/gui/doc/snippets/textdocument-imagedrop/main.cpp b/src/gui/doc/snippets/textdocument-imagedrop/main.cpp
index 198555c579..6a451db44a 100644
--- a/src/gui/doc/snippets/textdocument-imagedrop/main.cpp
+++ b/src/gui/doc/snippets/textdocument-imagedrop/main.cpp
@@ -1,62 +1,14 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the documentation of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:BSD$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** BSD License Usage
-** Alternatively, you may use this file under the terms of the BSD license
-** as follows:
-**
-** "Redistribution and use in source and binary forms, with or without
-** modification, are permitted provided that the following conditions are
-** met:
-** * Redistributions of source code must retain the above copyright
-** notice, this list of conditions and the following disclaimer.
-** * Redistributions in binary form must reproduce the above copyright
-** notice, this list of conditions and the following disclaimer in
-** the documentation and/or other materials provided with the
-** distribution.
-** * Neither the name of The Qt Company Ltd nor the names of its
-** contributors may be used to endorse or promote products derived
-** from this software without specific prior written permission.
-**
-**
-** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include <QtGui>
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause
#include "textedit.h"
+#include <QApplication>
int main(int argc, char * argv[])
{
QApplication app(argc, argv);
- TextEdit *textEdit = new TextEdit;
- textEdit->show();
+ TextEdit textEdit;
+ textEdit.show();
return app.exec();
-} \ No newline at end of file
+}
diff --git a/src/gui/doc/snippets/textdocument-imagedrop/textdocument-imagedrop.pro b/src/gui/doc/snippets/textdocument-imagedrop/textdocument-imagedrop.pro
deleted file mode 100644
index 96d3038a09..0000000000
--- a/src/gui/doc/snippets/textdocument-imagedrop/textdocument-imagedrop.pro
+++ /dev/null
@@ -1,2 +0,0 @@
-SOURCES = textedit.cpp main.cpp
-HEADERS = textedit.h \ No newline at end of file
diff --git a/src/gui/doc/snippets/textdocument-imagedrop/textedit.h b/src/gui/doc/snippets/textdocument-imagedrop/textedit.h
index 3f570884ba..86f31a0edf 100644
--- a/src/gui/doc/snippets/textdocument-imagedrop/textedit.h
+++ b/src/gui/doc/snippets/textdocument-imagedrop/textedit.h
@@ -1,52 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the documentation of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:BSD$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** BSD License Usage
-** Alternatively, you may use this file under the terms of the BSD license
-** as follows:
-**
-** "Redistribution and use in source and binary forms, with or without
-** modification, are permitted provided that the following conditions are
-** met:
-** * Redistributions of source code must retain the above copyright
-** notice, this list of conditions and the following disclaimer.
-** * Redistributions in binary form must reproduce the above copyright
-** notice, this list of conditions and the following disclaimer in
-** the documentation and/or other materials provided with the
-** distribution.
-** * Neither the name of The Qt Company Ltd nor the names of its
-** contributors may be used to endorse or promote products derived
-** from this software without specific prior written permission.
-**
-**
-** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause
#ifndef TEXTEDIT_H
#define TEXTEDIT_H
@@ -58,7 +11,7 @@ class TextEdit : public QTextEdit
Q_OBJECT
public:
- TextEdit(QWidget *parent=0);
+ explicit TextEdit(QWidget *parent = nullptr);
bool canInsertFromMimeData( const QMimeData *source ) const override;
void insertFromMimeData( const QMimeData *source ) override;
};
diff --git a/src/gui/doc/snippets/textdocument-imageformat/main.cpp b/src/gui/doc/snippets/textdocument-imageformat/main.cpp
index 89b09dc9b1..f626c6fef4 100644
--- a/src/gui/doc/snippets/textdocument-imageformat/main.cpp
+++ b/src/gui/doc/snippets/textdocument-imageformat/main.cpp
@@ -1,54 +1,8 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the documentation of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:BSD$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** BSD License Usage
-** Alternatively, you may use this file under the terms of the BSD license
-** as follows:
-**
-** "Redistribution and use in source and binary forms, with or without
-** modification, are permitted provided that the following conditions are
-** met:
-** * Redistributions of source code must retain the above copyright
-** notice, this list of conditions and the following disclaimer.
-** * Redistributions in binary form must reproduce the above copyright
-** notice, this list of conditions and the following disclaimer in
-** the documentation and/or other materials provided with the
-** distribution.
-** * Neither the name of The Qt Company Ltd nor the names of its
-** contributors may be used to endorse or promote products derived
-** from this software without specific prior written permission.
-**
-**
-** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include <QtGui>
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause
+#include <QApplication>
+#include <QTextBlock>
+#include <QTextEdit>
QString tr(const char *text)
{
diff --git a/src/gui/doc/snippets/textdocument-imageformat/textdocument-imageformat.pro b/src/gui/doc/snippets/textdocument-imageformat/textdocument-imageformat.pro
deleted file mode 100644
index 1c6437050a..0000000000
--- a/src/gui/doc/snippets/textdocument-imageformat/textdocument-imageformat.pro
+++ /dev/null
@@ -1,2 +0,0 @@
-SOURCES = main.cpp
-RESOURCES += images.qrc
diff --git a/src/gui/doc/snippets/textdocument-images/main.cpp b/src/gui/doc/snippets/textdocument-images/main.cpp
index a3314f0c9e..d9fd232388 100644
--- a/src/gui/doc/snippets/textdocument-images/main.cpp
+++ b/src/gui/doc/snippets/textdocument-images/main.cpp
@@ -1,54 +1,7 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the documentation of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:BSD$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** BSD License Usage
-** Alternatively, you may use this file under the terms of the BSD license
-** as follows:
-**
-** "Redistribution and use in source and binary forms, with or without
-** modification, are permitted provided that the following conditions are
-** met:
-** * Redistributions of source code must retain the above copyright
-** notice, this list of conditions and the following disclaimer.
-** * Redistributions in binary form must reproduce the above copyright
-** notice, this list of conditions and the following disclaimer in
-** the documentation and/or other materials provided with the
-** distribution.
-** * Neither the name of The Qt Company Ltd nor the names of its
-** contributors may be used to endorse or promote products derived
-** from this software without specific prior written permission.
-**
-**
-** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include <QtGui>
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause
+#include <QApplication>
+#include <QTextEdit>
QString tr(const char *text)
{
diff --git a/src/gui/doc/snippets/textdocument-images/textdocument-images.pro b/src/gui/doc/snippets/textdocument-images/textdocument-images.pro
deleted file mode 100644
index 1c6437050a..0000000000
--- a/src/gui/doc/snippets/textdocument-images/textdocument-images.pro
+++ /dev/null
@@ -1,2 +0,0 @@
-SOURCES = main.cpp
-RESOURCES += images.qrc
diff --git a/src/gui/doc/snippets/textdocument-listitems/main.cpp b/src/gui/doc/snippets/textdocument-listitems/main.cpp
index 60afcac7b5..44afd4775f 100644
--- a/src/gui/doc/snippets/textdocument-listitems/main.cpp
+++ b/src/gui/doc/snippets/textdocument-listitems/main.cpp
@@ -1,54 +1,9 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the documentation of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:BSD$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** BSD License Usage
-** Alternatively, you may use this file under the terms of the BSD license
-** as follows:
-**
-** "Redistribution and use in source and binary forms, with or without
-** modification, are permitted provided that the following conditions are
-** met:
-** * Redistributions of source code must retain the above copyright
-** notice, this list of conditions and the following disclaimer.
-** * Redistributions in binary form must reproduce the above copyright
-** notice, this list of conditions and the following disclaimer in
-** the documentation and/or other materials provided with the
-** distribution.
-** * Neither the name of The Qt Company Ltd nor the names of its
-** contributors may be used to endorse or promote products derived
-** from this software without specific prior written permission.
-**
-**
-** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause
#include <QtGui>
+#include <QApplication>
+#include <QTextEdit>
#include "mainwindow.h"
diff --git a/src/gui/doc/snippets/textdocument-listitems/mainwindow.cpp b/src/gui/doc/snippets/textdocument-listitems/mainwindow.cpp
index c39dacfe29..324f1937d9 100644
--- a/src/gui/doc/snippets/textdocument-listitems/mainwindow.cpp
+++ b/src/gui/doc/snippets/textdocument-listitems/mainwindow.cpp
@@ -1,73 +1,29 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the documentation of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:BSD$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** BSD License Usage
-** Alternatively, you may use this file under the terms of the BSD license
-** as follows:
-**
-** "Redistribution and use in source and binary forms, with or without
-** modification, are permitted provided that the following conditions are
-** met:
-** * Redistributions of source code must retain the above copyright
-** notice, this list of conditions and the following disclaimer.
-** * Redistributions in binary form must reproduce the above copyright
-** notice, this list of conditions and the following disclaimer in
-** the documentation and/or other materials provided with the
-** distribution.
-** * Neither the name of The Qt Company Ltd nor the names of its
-** contributors may be used to endorse or promote products derived
-** from this software without specific prior written permission.
-**
-**
-** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include <QtGui>
-
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause
#include "mainwindow.h"
+#include <QMenu>
+#include <QMenuBar>
+#include <QTextEdit>
+#include <QTextList>
+#include <QTreeWidget>
+
MainWindow::MainWindow()
{
QMenu *fileMenu = new QMenu(tr("&File"));
- fileMenu->addAction(tr("E&xit"), this, SLOT(close()),
- QKeySequence(tr("Ctrl+Q", "File|Exit")));
+ fileMenu->addAction(tr("E&xit"), QKeySequence(tr("Ctrl+Q", "File|Exit")),
+ this, &QWidget::close);
QMenu *actionsMenu = new QMenu(tr("&Actions"));
actionsMenu->addAction(tr("&Highlight List Items"),
- this, SLOT(highlightListItems()));
- actionsMenu->addAction(tr("&Show Current List"), this, SLOT(showList()));
+ this, &MainWindow::highlightListItems);
+ actionsMenu->addAction(tr("&Show Current List"), this, &MainWindow::showList);
QMenu *insertMenu = new QMenu(tr("&Insert"));
- insertMenu->addAction(tr("&List"), this, SLOT(insertList()),
- QKeySequence(tr("Ctrl+L", "Insert|List")));
+ insertMenu->addAction(tr("&List"), QKeySequence(tr("Ctrl+L", "Insert|List")),
+ this, &MainWindow::insertList);
menuBar()->addMenu(fileMenu);
menuBar()->addMenu(insertMenu);
@@ -127,9 +83,9 @@ void MainWindow::showList()
headerLabels << tr("Lists");
treeWidget->setHeaderLabels(headerLabels);
- QTreeWidgetItem *parentItem = 0;
+ QTreeWidgetItem *parentItem = nullptr;
QTreeWidgetItem *item;
- QTreeWidgetItem *lastItem = 0;
+ QTreeWidgetItem *lastItem = nullptr;
parentItems.clear();
previousItems.clear();
diff --git a/src/gui/doc/snippets/textdocument-listitems/mainwindow.h b/src/gui/doc/snippets/textdocument-listitems/mainwindow.h
index 1dc94632b6..9dd441c2d3 100644
--- a/src/gui/doc/snippets/textdocument-listitems/mainwindow.h
+++ b/src/gui/doc/snippets/textdocument-listitems/mainwindow.h
@@ -1,52 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the documentation of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:BSD$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** BSD License Usage
-** Alternatively, you may use this file under the terms of the BSD license
-** as follows:
-**
-** "Redistribution and use in source and binary forms, with or without
-** modification, are permitted provided that the following conditions are
-** met:
-** * Redistributions of source code must retain the above copyright
-** notice, this list of conditions and the following disclaimer.
-** * Redistributions in binary form must reproduce the above copyright
-** notice, this list of conditions and the following disclaimer in
-** the documentation and/or other materials provided with the
-** distribution.
-** * Neither the name of The Qt Company Ltd nor the names of its
-** contributors may be used to endorse or promote products derived
-** from this software without specific prior written permission.
-**
-**
-** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause
#ifndef WINDOW_H
#define WINDOW_H
@@ -75,8 +28,8 @@ public slots:
private:
QString currentFile;
- QTextEdit *editor;
- QTextDocument *document;
+ QTextEdit *editor = nullptr;
+ QTextDocument *document = nullptr;
QList<QTextList*> listStructures;
QList<QTreeWidgetItem*> previousItems;
QList<QTreeWidgetItem*> parentItems;
diff --git a/src/gui/doc/snippets/textdocument-listitems/textdocument-listitems.pro b/src/gui/doc/snippets/textdocument-listitems/textdocument-listitems.pro
deleted file mode 100644
index 5da8d6e1a1..0000000000
--- a/src/gui/doc/snippets/textdocument-listitems/textdocument-listitems.pro
+++ /dev/null
@@ -1,3 +0,0 @@
-HEADERS = mainwindow.h
-SOURCES = main.cpp \
- mainwindow.cpp
diff --git a/src/gui/doc/snippets/textdocument-listitemstyles/main.cpp b/src/gui/doc/snippets/textdocument-listitemstyles/main.cpp
index 60afcac7b5..27d478e05c 100644
--- a/src/gui/doc/snippets/textdocument-listitemstyles/main.cpp
+++ b/src/gui/doc/snippets/textdocument-listitemstyles/main.cpp
@@ -1,54 +1,8 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the documentation of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:BSD$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** BSD License Usage
-** Alternatively, you may use this file under the terms of the BSD license
-** as follows:
-**
-** "Redistribution and use in source and binary forms, with or without
-** modification, are permitted provided that the following conditions are
-** met:
-** * Redistributions of source code must retain the above copyright
-** notice, this list of conditions and the following disclaimer.
-** * Redistributions in binary form must reproduce the above copyright
-** notice, this list of conditions and the following disclaimer in
-** the documentation and/or other materials provided with the
-** distribution.
-** * Neither the name of The Qt Company Ltd nor the names of its
-** contributors may be used to endorse or promote products derived
-** from this software without specific prior written permission.
-**
-**
-** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause
#include <QtGui>
+#include <QApplication>
#include "mainwindow.h"
diff --git a/src/gui/doc/snippets/textdocument-listitemstyles/mainwindow.cpp b/src/gui/doc/snippets/textdocument-listitemstyles/mainwindow.cpp
index b39bc0bd10..bd692f15b9 100644
--- a/src/gui/doc/snippets/textdocument-listitemstyles/mainwindow.cpp
+++ b/src/gui/doc/snippets/textdocument-listitemstyles/mainwindow.cpp
@@ -1,68 +1,22 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the documentation of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:BSD$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** BSD License Usage
-** Alternatively, you may use this file under the terms of the BSD license
-** as follows:
-**
-** "Redistribution and use in source and binary forms, with or without
-** modification, are permitted provided that the following conditions are
-** met:
-** * Redistributions of source code must retain the above copyright
-** notice, this list of conditions and the following disclaimer.
-** * Redistributions in binary form must reproduce the above copyright
-** notice, this list of conditions and the following disclaimer in
-** the documentation and/or other materials provided with the
-** distribution.
-** * Neither the name of The Qt Company Ltd nor the names of its
-** contributors may be used to endorse or promote products derived
-** from this software without specific prior written permission.
-**
-**
-** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include <QtGui>
-
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause
#include "mainwindow.h"
+#include <QMenu>
+#include <QMenuBar>
+#include <QTextEdit>
+
MainWindow::MainWindow()
{
QMenu *fileMenu = new QMenu(tr("&File"));
- fileMenu->addAction(tr("E&xit"), this, SLOT(close()),
- QKeySequence(tr("Ctrl+Q", "File|Exit")));
+ fileMenu->addAction(tr("E&xit"), QKeySequence(tr("Ctrl+Q", "File|Exit")),
+ this, SLOT(close()));
QMenu *insertMenu = new QMenu(tr("&Insert"));
- insertMenu->addAction(tr("&List"), this, SLOT(insertList()),
- QKeySequence(tr("Ctrl+L", "Insert|List")));
+ insertMenu->addAction(tr("&List"), QKeySequence(tr("Ctrl+L", "Insert|List")),
+ this, SLOT(insertList()));
menuBar()->addMenu(fileMenu);
menuBar()->addMenu(insertMenu);
diff --git a/src/gui/doc/snippets/textdocument-listitemstyles/mainwindow.h b/src/gui/doc/snippets/textdocument-listitemstyles/mainwindow.h
index baf9be5f0d..ff03d07be7 100644
--- a/src/gui/doc/snippets/textdocument-listitemstyles/mainwindow.h
+++ b/src/gui/doc/snippets/textdocument-listitemstyles/mainwindow.h
@@ -1,52 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the documentation of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:BSD$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** BSD License Usage
-** Alternatively, you may use this file under the terms of the BSD license
-** as follows:
-**
-** "Redistribution and use in source and binary forms, with or without
-** modification, are permitted provided that the following conditions are
-** met:
-** * Redistributions of source code must retain the above copyright
-** notice, this list of conditions and the following disclaimer.
-** * Redistributions in binary form must reproduce the above copyright
-** notice, this list of conditions and the following disclaimer in
-** the documentation and/or other materials provided with the
-** distribution.
-** * Neither the name of The Qt Company Ltd nor the names of its
-** contributors may be used to endorse or promote products derived
-** from this software without specific prior written permission.
-**
-**
-** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause
#ifndef WINDOW_H
#define WINDOW_H
@@ -68,8 +21,8 @@ public slots:
private:
QString currentFile;
- QTextEdit *editor;
- QTextDocument *document;
+ QTextEdit *editor = nullptr;
+ QTextDocument *document = nullptr;
};
#endif
diff --git a/src/gui/doc/snippets/textdocument-listitemstyles/textdocument-listitemstyles.pro b/src/gui/doc/snippets/textdocument-listitemstyles/textdocument-listitemstyles.pro
deleted file mode 100644
index 5da8d6e1a1..0000000000
--- a/src/gui/doc/snippets/textdocument-listitemstyles/textdocument-listitemstyles.pro
+++ /dev/null
@@ -1,3 +0,0 @@
-HEADERS = mainwindow.h
-SOURCES = main.cpp \
- mainwindow.cpp
diff --git a/src/gui/doc/snippets/textdocument-lists/mainwindow.cpp b/src/gui/doc/snippets/textdocument-lists/mainwindow.cpp
index 785f7ebcc9..0a4b076f63 100644
--- a/src/gui/doc/snippets/textdocument-lists/mainwindow.cpp
+++ b/src/gui/doc/snippets/textdocument-lists/mainwindow.cpp
@@ -1,184 +1,22 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the documentation of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:BSD$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** BSD License Usage
-** Alternatively, you may use this file under the terms of the BSD license
-** as follows:
-**
-** "Redistribution and use in source and binary forms, with or without
-** modification, are permitted provided that the following conditions are
-** met:
-** * Redistributions of source code must retain the above copyright
-** notice, this list of conditions and the following disclaimer.
-** * Redistributions in binary form must reproduce the above copyright
-** notice, this list of conditions and the following disclaimer in
-** the documentation and/or other materials provided with the
-** distribution.
-** * Neither the name of The Qt Company Ltd nor the names of its
-** contributors may be used to endorse or promote products derived
-** from this software without specific prior written permission.
-**
-**
-** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause
+#include <QTextEdit>
+#include <QTextList>
-#include <QtWidgets>
-
-#include "mainwindow.h"
-
-MainWindow::MainWindow()
-{
- QMenu *fileMenu = new QMenu(tr("&File"));
-
- fileMenu->addAction(tr("E&xit"), this, SLOT(close()),
- QKeySequence(tr("Ctrl+Q", "File|Exit")));
-
- QMenu *editMenu = new QMenu(tr("&Edit"));
-
- cutAction = editMenu->addAction(tr("Cu&t"), this, SLOT(cutSelection()),
- QKeySequence(tr("Ctrl+X", "Edit|Cut")));
- copyAction = editMenu->addAction(tr("&Copy"), this, SLOT(copySelection()),
- QKeySequence(tr("Ctrl+C", "Edit|Copy")));
- pasteAction = editMenu->addAction(tr("&Paste"), this,
- SLOT(pasteSelection()), QKeySequence(tr("Ctrl+V", "Edit|Paste")));
-
- QMenu *selectMenu = new QMenu(tr("&Select"));
- selectMenu->addAction(tr("&Word"), this, SLOT(selectWord()));
- selectMenu->addAction(tr("&Line"), this, SLOT(selectLine()));
- selectMenu->addAction(tr("&Block"), this, SLOT(selectBlock()));
- selectMenu->addAction(tr("&Frame"), this, SLOT(selectFrame()));
-
- QMenu *insertMenu = new QMenu(tr("&Insert"));
-
- insertMenu->addAction(tr("&List"), this, SLOT(insertList()),
- QKeySequence(tr("Ctrl+L", "Insert|List")));
-
- menuBar()->addMenu(fileMenu);
- menuBar()->addMenu(editMenu);
- menuBar()->addMenu(selectMenu);
- menuBar()->addMenu(insertMenu);
-
- editor = new QTextEdit(this);
- document = new QTextDocument(this);
- editor->setDocument(document);
-
- connect(editor, &QTextEdit::selectionChanged,
- this, &MainWindow::updateMenus);
-
- updateMenus();
-
- setCentralWidget(editor);
- setWindowTitle(tr("Text Document Writer"));
-}
-
-void MainWindow::cutSelection()
-{
- QTextCursor cursor = editor->textCursor();
- if (cursor.hasSelection()) {
- selection = cursor.selection();
- cursor.removeSelectedText();
- }
-}
-
-void MainWindow::copySelection()
-{
- QTextCursor cursor = editor->textCursor();
- if (cursor.hasSelection()) {
- selection = cursor.selection();
- cursor.clearSelection();
- }
-}
-
-void MainWindow::pasteSelection()
-{
- QTextCursor cursor = editor->textCursor();
- cursor.insertFragment(selection);
-}
-
-void MainWindow::selectWord()
-{
- QTextCursor cursor = editor->textCursor();
- QTextBlock block = cursor.block();
-
- cursor.beginEditBlock();
- cursor.movePosition(QTextCursor::StartOfWord);
- cursor.movePosition(QTextCursor::EndOfWord, QTextCursor::KeepAnchor);
- cursor.endEditBlock();
-
- editor->setTextCursor(cursor);
-}
-
-void MainWindow::selectLine()
+namespace textdocument_lists {
+struct MainWindow
{
- QTextCursor cursor = editor->textCursor();
- QTextBlock block = cursor.block();
+ void insertList();
- cursor.beginEditBlock();
- cursor.movePosition(QTextCursor::StartOfLine);
- cursor.movePosition(QTextCursor::EndOfLine, QTextCursor::KeepAnchor);
- cursor.endEditBlock();
-
- editor->setTextCursor(cursor);
-}
-
-void MainWindow::selectBlock()
-{
- QTextCursor cursor = editor->textCursor();
- QTextBlock block = cursor.block();
-
- cursor.beginEditBlock();
- cursor.movePosition(QTextCursor::StartOfBlock);
- cursor.movePosition(QTextCursor::EndOfBlock, QTextCursor::KeepAnchor);
- cursor.endEditBlock();
-
- editor->setTextCursor(cursor);
-}
-
-void MainWindow::selectFrame()
-{
- QTextCursor cursor = editor->textCursor();
- QTextFrame *frame = cursor.currentFrame();
-
- cursor.beginEditBlock();
- cursor.setPosition(frame->firstPosition());
- cursor.setPosition(frame->lastPosition(), QTextCursor::KeepAnchor);
- cursor.endEditBlock();
-
- editor->setTextCursor(cursor);
-}
+private:
+ QTextEdit *editor = nullptr;
+};
void MainWindow::insertList()
{
QTextCursor cursor = editor->textCursor();
- cursor.beginEditBlock();
-
QTextList *list = cursor.currentList();
+
//! [0]
QTextListFormat listFormat;
if (list) {
@@ -189,15 +27,6 @@ void MainWindow::insertList()
listFormat.setStyle(QTextListFormat::ListDisc);
cursor.insertList(listFormat);
//! [0]
-
- cursor.endEditBlock();
}
-void MainWindow::updateMenus()
-{
- QTextCursor cursor = editor->textCursor();
- cutAction->setEnabled(cursor.hasSelection());
- copyAction->setEnabled(cursor.hasSelection());
-
- pasteAction->setEnabled(!selection.isEmpty());
-}
+} //textdocument_lists
diff --git a/src/gui/doc/snippets/textdocument-printing/main.cpp b/src/gui/doc/snippets/textdocument-printing/main.cpp
index 60afcac7b5..c0e5d49f7c 100644
--- a/src/gui/doc/snippets/textdocument-printing/main.cpp
+++ b/src/gui/doc/snippets/textdocument-printing/main.cpp
@@ -1,57 +1,9 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the documentation of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:BSD$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** BSD License Usage
-** Alternatively, you may use this file under the terms of the BSD license
-** as follows:
-**
-** "Redistribution and use in source and binary forms, with or without
-** modification, are permitted provided that the following conditions are
-** met:
-** * Redistributions of source code must retain the above copyright
-** notice, this list of conditions and the following disclaimer.
-** * Redistributions in binary form must reproduce the above copyright
-** notice, this list of conditions and the following disclaimer in
-** the documentation and/or other materials provided with the
-** distribution.
-** * Neither the name of The Qt Company Ltd nor the names of its
-** contributors may be used to endorse or promote products derived
-** from this software without specific prior written permission.
-**
-**
-** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include <QtGui>
-
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause
#include "mainwindow.h"
+#include <QApplication>
+
int main(int argc, char *argv[])
{
QApplication app(argc, argv);
diff --git a/src/gui/doc/snippets/textdocument-printing/mainwindow.cpp b/src/gui/doc/snippets/textdocument-printing/mainwindow.cpp
index a7bd90a9f1..ff16d6f0da 100644
--- a/src/gui/doc/snippets/textdocument-printing/mainwindow.cpp
+++ b/src/gui/doc/snippets/textdocument-printing/mainwindow.cpp
@@ -1,63 +1,20 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the documentation of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:BSD$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** BSD License Usage
-** Alternatively, you may use this file under the terms of the BSD license
-** as follows:
-**
-** "Redistribution and use in source and binary forms, with or without
-** modification, are permitted provided that the following conditions are
-** met:
-** * Redistributions of source code must retain the above copyright
-** notice, this list of conditions and the following disclaimer.
-** * Redistributions in binary form must reproduce the above copyright
-** notice, this list of conditions and the following disclaimer in
-** the documentation and/or other materials provided with the
-** distribution.
-** * Neither the name of The Qt Company Ltd nor the names of its
-** contributors may be used to endorse or promote products derived
-** from this software without specific prior written permission.
-**
-**
-** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include <QtGui>
-
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause
#include "mainwindow.h"
+#include <QMenu>
+#include <QMenuBar>
+#include <QTextEdit>
+#include <QFileDialog>
+#include <QPrinter>
+#include <QPrintDialog>
+
MainWindow::MainWindow()
{
QMenu *fileMenu = new QMenu(tr("&File"));
- fileMenu->addAction(tr("&Open..."), this, SLOT(openFile()),
- QKeySequence(tr("Ctrl+O", "File|Open")));
+ fileMenu->addAction(tr("&Open..."), QKeySequence(tr("Ctrl+O", "File|Open"))
+ this, SLOT(openFile()));
printAction = fileMenu->addAction(tr("&Print..."), this, SLOT(printFile()));
printAction->setEnabled(false);
@@ -65,8 +22,8 @@ MainWindow::MainWindow()
pdfPrintAction = fileMenu->addAction(tr("Print as P&DF..."), this, SLOT(printPdf()));
pdfPrintAction->setEnabled(false);
- fileMenu->addAction(tr("E&xit"), this, SLOT(close()),
- QKeySequence(tr("Ctrl+Q", "File|Exit")));
+ fileMenu->addAction(tr("E&xit"), QKeySequence(tr("Ctrl+Q", "File|Exit")),
+ this, SLOT(close()));
menuBar()->addMenu(fileMenu);
diff --git a/src/gui/doc/snippets/textdocument-printing/mainwindow.h b/src/gui/doc/snippets/textdocument-printing/mainwindow.h
index 7b73c4139d..f58d5ec49e 100644
--- a/src/gui/doc/snippets/textdocument-printing/mainwindow.h
+++ b/src/gui/doc/snippets/textdocument-printing/mainwindow.h
@@ -1,52 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the documentation of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:BSD$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** BSD License Usage
-** Alternatively, you may use this file under the terms of the BSD license
-** as follows:
-**
-** "Redistribution and use in source and binary forms, with or without
-** modification, are permitted provided that the following conditions are
-** met:
-** * Redistributions of source code must retain the above copyright
-** notice, this list of conditions and the following disclaimer.
-** * Redistributions in binary form must reproduce the above copyright
-** notice, this list of conditions and the following disclaimer in
-** the documentation and/or other materials provided with the
-** distribution.
-** * Neither the name of The Qt Company Ltd nor the names of its
-** contributors may be used to endorse or promote products derived
-** from this software without specific prior written permission.
-**
-**
-** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause
#ifndef MAINWINDOW_H
#define MAINWINDOW_H
@@ -70,13 +23,14 @@ public slots:
void openFile();
void printFile();
void printPdf();
+ void updateMenus();
private:
- QAction *printAction;
- QAction *pdfPrintAction;
+ QAction *printAction = nullptr;
+ QAction *pdfPrintAction = nullptr;
QString currentFile;
- QTextEdit *editor;
- QTextDocument *document;
+ QTextEdit *editor = nullptr;
+ QTextDocument *document = nullptr;
};
#endif
diff --git a/src/gui/doc/snippets/textdocument-printing/textdocument-printing.pro b/src/gui/doc/snippets/textdocument-printing/textdocument-printing.pro
deleted file mode 100644
index 5da8d6e1a1..0000000000
--- a/src/gui/doc/snippets/textdocument-printing/textdocument-printing.pro
+++ /dev/null
@@ -1,3 +0,0 @@
-HEADERS = mainwindow.h
-SOURCES = main.cpp \
- mainwindow.cpp
diff --git a/src/gui/doc/snippets/textdocument-resources/main.cpp b/src/gui/doc/snippets/textdocument-resources/main.cpp
index 6712b5b2ec..8b9f16098e 100644
--- a/src/gui/doc/snippets/textdocument-resources/main.cpp
+++ b/src/gui/doc/snippets/textdocument-resources/main.cpp
@@ -1,54 +1,7 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the documentation of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:BSD$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** BSD License Usage
-** Alternatively, you may use this file under the terms of the BSD license
-** as follows:
-**
-** "Redistribution and use in source and binary forms, with or without
-** modification, are permitted provided that the following conditions are
-** met:
-** * Redistributions of source code must retain the above copyright
-** notice, this list of conditions and the following disclaimer.
-** * Redistributions in binary form must reproduce the above copyright
-** notice, this list of conditions and the following disclaimer in
-** the documentation and/or other materials provided with the
-** distribution.
-** * Neither the name of The Qt Company Ltd nor the names of its
-** contributors may be used to endorse or promote products derived
-** from this software without specific prior written permission.
-**
-**
-** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include <QtGui>
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause
+#include <QApplication>
+#include <QTextEdit>
QString tr(const char *text)
{
diff --git a/src/gui/doc/snippets/textdocument-resources/textdocument-resources.pro b/src/gui/doc/snippets/textdocument-resources/textdocument-resources.pro
deleted file mode 100644
index 16181f21cf..0000000000
--- a/src/gui/doc/snippets/textdocument-resources/textdocument-resources.pro
+++ /dev/null
@@ -1 +0,0 @@
-SOURCES = main.cpp
diff --git a/src/gui/doc/snippets/textdocument-selections/main.cpp b/src/gui/doc/snippets/textdocument-selections/main.cpp
index 60afcac7b5..c0e5d49f7c 100644
--- a/src/gui/doc/snippets/textdocument-selections/main.cpp
+++ b/src/gui/doc/snippets/textdocument-selections/main.cpp
@@ -1,57 +1,9 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the documentation of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:BSD$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** BSD License Usage
-** Alternatively, you may use this file under the terms of the BSD license
-** as follows:
-**
-** "Redistribution and use in source and binary forms, with or without
-** modification, are permitted provided that the following conditions are
-** met:
-** * Redistributions of source code must retain the above copyright
-** notice, this list of conditions and the following disclaimer.
-** * Redistributions in binary form must reproduce the above copyright
-** notice, this list of conditions and the following disclaimer in
-** the documentation and/or other materials provided with the
-** distribution.
-** * Neither the name of The Qt Company Ltd nor the names of its
-** contributors may be used to endorse or promote products derived
-** from this software without specific prior written permission.
-**
-**
-** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include <QtGui>
-
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause
#include "mainwindow.h"
+#include <QApplication>
+
int main(int argc, char *argv[])
{
QApplication app(argc, argv);
diff --git a/src/gui/doc/snippets/textdocument-selections/mainwindow.cpp b/src/gui/doc/snippets/textdocument-selections/mainwindow.cpp
index 9253e87670..6e1d051d4b 100644
--- a/src/gui/doc/snippets/textdocument-selections/mainwindow.cpp
+++ b/src/gui/doc/snippets/textdocument-selections/mainwindow.cpp
@@ -1,86 +1,38 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the documentation of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:BSD$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** BSD License Usage
-** Alternatively, you may use this file under the terms of the BSD license
-** as follows:
-**
-** "Redistribution and use in source and binary forms, with or without
-** modification, are permitted provided that the following conditions are
-** met:
-** * Redistributions of source code must retain the above copyright
-** notice, this list of conditions and the following disclaimer.
-** * Redistributions in binary form must reproduce the above copyright
-** notice, this list of conditions and the following disclaimer in
-** the documentation and/or other materials provided with the
-** distribution.
-** * Neither the name of The Qt Company Ltd nor the names of its
-** contributors may be used to endorse or promote products derived
-** from this software without specific prior written permission.
-**
-**
-** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause
+#include "mainwindow.h"
#include <QtWidgets>
-#include "mainwindow.h"
-
MainWindow::MainWindow()
{
QMenu *fileMenu = new QMenu(tr("&File"));
- fileMenu->addAction(tr("&Open..."), this, SLOT(openFile()),
- QKeySequence(tr("Ctrl+O", "File|Open")));
+ fileMenu->addAction(tr("&Open..."), QKeySequence(tr("Ctrl+O", "File|Open")),
+ this, &MainWindow::openFile);
- QAction *quitAction = fileMenu->addAction(tr("E&xit"), this, SLOT(close()));
+ QAction *quitAction = fileMenu->addAction(tr("E&xit"), this, &MainWindow::close);
quitAction->setShortcut(tr("Ctrl+Q"));
QMenu *editMenu = new QMenu(tr("&Edit"));
- cutAction = editMenu->addAction(tr("Cu&t"), this, SLOT(cutSelection()));
+ cutAction = editMenu->addAction(tr("Cu&t"), this, &MainWindow::cutSelection);
cutAction->setShortcut(tr("Ctrl+X"));
cutAction->setEnabled(false);
- copyAction = editMenu->addAction(tr("&Copy"), this, SLOT(copySelection()));
+ copyAction = editMenu->addAction(tr("&Copy"), this, &MainWindow::copySelection);
copyAction->setShortcut(tr("Ctrl+C"));
copyAction->setEnabled(false);
- pasteAction = editMenu->addAction(tr("&Paste"), this, SLOT(pasteSelection()));
+ pasteAction = editMenu->addAction(tr("&Paste"), this, &MainWindow::pasteSelection);
pasteAction->setShortcut(tr("Ctrl+V"));
pasteAction->setEnabled(false);
QMenu *selectMenu = new QMenu(tr("&Select"));
- selectMenu->addAction(tr("&Word"), this, SLOT(selectWord()));
- selectMenu->addAction(tr("&Line"), this, SLOT(selectLine()));
- selectMenu->addAction(tr("&Block"), this, SLOT(selectBlock()));
- selectMenu->addAction(tr("&Frame"), this, SLOT(selectFrame()));
+ selectMenu->addAction(tr("&Word"), this, &MainWindow::selectWord);
+ selectMenu->addAction(tr("&Line"), this, &MainWindow::selectLine);
+ selectMenu->addAction(tr("&Block"), this, &MainWindow::selectBlock);
+ selectMenu->addAction(tr("&Frame"), this, &MainWindow::selectFrame);
menuBar()->addMenu(fileMenu);
menuBar()->addMenu(editMenu);
@@ -151,7 +103,6 @@ void MainWindow::pasteSelection()
void MainWindow::selectWord()
{
QTextCursor cursor = editor->textCursor();
- QTextBlock block = cursor.block();
//! [0]
cursor.beginEditBlock();
@@ -168,7 +119,6 @@ void MainWindow::selectWord()
void MainWindow::selectLine()
{
QTextCursor cursor = editor->textCursor();
- QTextBlock block = cursor.block();
cursor.beginEditBlock();
cursor.movePosition(QTextCursor::StartOfLine);
@@ -181,7 +131,6 @@ void MainWindow::selectLine()
void MainWindow::selectBlock()
{
QTextCursor cursor = editor->textCursor();
- QTextBlock block = cursor.block();
cursor.beginEditBlock();
cursor.movePosition(QTextCursor::StartOfBlock);
diff --git a/src/gui/doc/snippets/textdocument-selections/mainwindow.h b/src/gui/doc/snippets/textdocument-selections/mainwindow.h
index 7b75b13e82..31bd7a2d64 100644
--- a/src/gui/doc/snippets/textdocument-selections/mainwindow.h
+++ b/src/gui/doc/snippets/textdocument-selections/mainwindow.h
@@ -1,52 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the documentation of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:BSD$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** BSD License Usage
-** Alternatively, you may use this file under the terms of the BSD license
-** as follows:
-**
-** "Redistribution and use in source and binary forms, with or without
-** modification, are permitted provided that the following conditions are
-** met:
-** * Redistributions of source code must retain the above copyright
-** notice, this list of conditions and the following disclaimer.
-** * Redistributions in binary form must reproduce the above copyright
-** notice, this list of conditions and the following disclaimer in
-** the documentation and/or other materials provided with the
-** distribution.
-** * Neither the name of The Qt Company Ltd nor the names of its
-** contributors may be used to endorse or promote products derived
-** from this software without specific prior written permission.
-**
-**
-** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause
#ifndef WINDOW_H
#define WINDOW_H
@@ -77,12 +30,12 @@ public slots:
void updateMenus();
private:
- QAction *cutAction;
- QAction *copyAction;
- QAction *pasteAction;
+ QAction *cutAction = nullptr;
+ QAction *copyAction = nullptr;
+ QAction *pasteAction = nullptr;
QString currentFile;
- QTextEdit *editor;
- QTextDocument *document;
+ QTextEdit *editor = nullptr;
+ QTextDocument *document = nullptr;
QTextDocumentFragment selection;
};
diff --git a/src/gui/doc/snippets/textdocument-selections/textdocument-selections.pro b/src/gui/doc/snippets/textdocument-selections/textdocument-selections.pro
deleted file mode 100644
index 253c452723..0000000000
--- a/src/gui/doc/snippets/textdocument-selections/textdocument-selections.pro
+++ /dev/null
@@ -1,4 +0,0 @@
-QT += xml
-HEADERS = mainwindow.h
-SOURCES = main.cpp \
- mainwindow.cpp
diff --git a/src/gui/doc/snippets/textdocument-tables/main.cpp b/src/gui/doc/snippets/textdocument-tables/main.cpp
index f37ea92dc4..87ce7e46da 100644
--- a/src/gui/doc/snippets/textdocument-tables/main.cpp
+++ b/src/gui/doc/snippets/textdocument-tables/main.cpp
@@ -1,57 +1,9 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the documentation of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:BSD$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** BSD License Usage
-** Alternatively, you may use this file under the terms of the BSD license
-** as follows:
-**
-** "Redistribution and use in source and binary forms, with or without
-** modification, are permitted provided that the following conditions are
-** met:
-** * Redistributions of source code must retain the above copyright
-** notice, this list of conditions and the following disclaimer.
-** * Redistributions in binary form must reproduce the above copyright
-** notice, this list of conditions and the following disclaimer in
-** the documentation and/or other materials provided with the
-** distribution.
-** * Neither the name of The Qt Company Ltd nor the names of its
-** contributors may be used to endorse or promote products derived
-** from this software without specific prior written permission.
-**
-**
-** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include <QtGui>
-
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause
#include "mainwindow.h"
+#include <QApplication>
+
int main(int argc, char *argv[])
{
QApplication app(argc, argv);
diff --git a/src/gui/doc/snippets/textdocument-tables/mainwindow.cpp b/src/gui/doc/snippets/textdocument-tables/mainwindow.cpp
index bd976a8ce4..02f31f8807 100644
--- a/src/gui/doc/snippets/textdocument-tables/mainwindow.cpp
+++ b/src/gui/doc/snippets/textdocument-tables/mainwindow.cpp
@@ -1,57 +1,9 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the documentation of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:BSD$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** BSD License Usage
-** Alternatively, you may use this file under the terms of the BSD license
-** as follows:
-**
-** "Redistribution and use in source and binary forms, with or without
-** modification, are permitted provided that the following conditions are
-** met:
-** * Redistributions of source code must retain the above copyright
-** notice, this list of conditions and the following disclaimer.
-** * Redistributions in binary form must reproduce the above copyright
-** notice, this list of conditions and the following disclaimer in
-** the documentation and/or other materials provided with the
-** distribution.
-** * Neither the name of The Qt Company Ltd nor the names of its
-** contributors may be used to endorse or promote products derived
-** from this software without specific prior written permission.
-**
-**
-** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause
#include <QtWidgets>
#include "mainwindow.h"
-#include "xmlwriter.h"
MainWindow::MainWindow()
{
@@ -83,7 +35,7 @@ MainWindow::MainWindow()
//! [2]
QTextTableFormat tableFormat;
tableFormat.setBackground(QColor("#e0e0e0"));
- QVector<QTextLength> constraints;
+ QList<QTextLength> constraints;
constraints << QTextLength(QTextLength::PercentageLength, 16);
constraints << QTextLength(QTextLength::PercentageLength, 28);
constraints << QTextLength(QTextLength::PercentageLength, 28);
@@ -132,9 +84,9 @@ MainWindow::MainWindow()
}
//! [8]
- connect(saveAction, &QAction:triggered, this, &MainWindow::saveFile);
- connect(quitAction, &QAction:triggered, this, &MainWindow::close);
- connect(showTableAction, &QAction:triggered, this, &MainWindow::showTable);
+ connect(saveAction, &QAction::triggered, this, &MainWindow::saveFile);
+ connect(quitAction, &QAction::triggered, this, &MainWindow::close);
+ connect(showTableAction, &QAction::triggered, this, &MainWindow::showTable);
setCentralWidget(editor);
setWindowTitle(tr("Text Document Tables"));
@@ -194,21 +146,35 @@ void MainWindow::showTable()
tableWidget->show();
}
-bool MainWindow::writeXml(const QString &fileName)
+void MainWindow::processFrame(QTextFrame *)
{
- XmlWriter documentWriter(editor->document());
+}
+
+void MainWindow::processBlock(QTextBlock)
+{
+}
- QDomDocument *domDocument = documentWriter.toXml();
- QFile file(fileName);
+void MainWindow::processTable(QTextTable *table)
+{
+ QTextFrame *frame = qobject_cast<QTextFrame *>(table);
+//! [13]
+ QTextFrame::iterator it;
+ for (it = frame->begin(); !(it.atEnd()); ++it) {
+
+ QTextFrame *childFrame = it.currentFrame();
+ QTextBlock childBlock = it.currentBlock();
- if (file.open(QFile::WriteOnly)) {
- QTextStream textStream(&file);
- textStream.setCodec(QTextCodec::codecForName("UTF-8"));
+ if (childFrame) {
+ QTextTable *childTable = qobject_cast<QTextTable*>(childFrame);
- textStream << domDocument->toString(1).toUtf8();
- file.close();
- return true;
+ if (childTable)
+ processTable(childTable);
+ else
+ processFrame(childFrame);
+
+ } else if (childBlock.isValid()) {
+ processBlock(childBlock);
+ }
}
- else
- return false;
+//! [13]
}
diff --git a/src/gui/doc/snippets/textdocument-tables/mainwindow.h b/src/gui/doc/snippets/textdocument-tables/mainwindow.h
index dc26cf3650..3885478e6c 100644
--- a/src/gui/doc/snippets/textdocument-tables/mainwindow.h
+++ b/src/gui/doc/snippets/textdocument-tables/mainwindow.h
@@ -1,59 +1,14 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the documentation of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:BSD$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** BSD License Usage
-** Alternatively, you may use this file under the terms of the BSD license
-** as follows:
-**
-** "Redistribution and use in source and binary forms, with or without
-** modification, are permitted provided that the following conditions are
-** met:
-** * Redistributions of source code must retain the above copyright
-** notice, this list of conditions and the following disclaimer.
-** * Redistributions in binary form must reproduce the above copyright
-** notice, this list of conditions and the following disclaimer in
-** the documentation and/or other materials provided with the
-** distribution.
-** * Neither the name of The Qt Company Ltd nor the names of its
-** contributors may be used to endorse or promote products derived
-** from this software without specific prior written permission.
-**
-**
-** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause
#ifndef WINDOW_H
#define WINDOW_H
#include <QMainWindow>
class QTextEdit;
+class QTextFrame;
+class QTextBlock;
+class QTextTable;
class MainWindow : public QMainWindow
{
@@ -68,8 +23,11 @@ public slots:
private:
bool writeXml(const QString &fileName);
+ void processFrame(QTextFrame *);
+ void processBlock(QTextBlock);
+ void processTable(QTextTable *table);
- QTextEdit *editor;
+ QTextEdit *editor = nullptr;
};
#endif
diff --git a/src/gui/doc/snippets/textdocument-tables/textdocument-tables.pro b/src/gui/doc/snippets/textdocument-tables/textdocument-tables.pro
deleted file mode 100644
index 91ae50f491..0000000000
--- a/src/gui/doc/snippets/textdocument-tables/textdocument-tables.pro
+++ /dev/null
@@ -1,6 +0,0 @@
-SOURCES = main.cpp \
- mainwindow.cpp \
- xmlwriter.cpp
-HEADERS = mainwindow.h \
- xmlwriter.h
-QT += xml
diff --git a/src/gui/doc/snippets/textdocument-tables/xmlwriter.cpp b/src/gui/doc/snippets/textdocument-tables/xmlwriter.cpp
deleted file mode 100644
index e082fc8c7f..0000000000
--- a/src/gui/doc/snippets/textdocument-tables/xmlwriter.cpp
+++ /dev/null
@@ -1,165 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the documentation of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:BSD$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** BSD License Usage
-** Alternatively, you may use this file under the terms of the BSD license
-** as follows:
-**
-** "Redistribution and use in source and binary forms, with or without
-** modification, are permitted provided that the following conditions are
-** met:
-** * Redistributions of source code must retain the above copyright
-** notice, this list of conditions and the following disclaimer.
-** * Redistributions in binary form must reproduce the above copyright
-** notice, this list of conditions and the following disclaimer in
-** the documentation and/or other materials provided with the
-** distribution.
-** * Neither the name of The Qt Company Ltd nor the names of its
-** contributors may be used to endorse or promote products derived
-** from this software without specific prior written permission.
-**
-**
-** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include <QtGui>
-
-#include "xmlwriter.h"
-
-QDomDocument *XmlWriter::toXml()
-{
- QDomImplementation implementation;
- QDomDocumentType docType = implementation.createDocumentType(
- "scribe-document", "scribe", "qt.nokia.com/scribe");
-
- document = new QDomDocument(docType);
-
- // ### This processing instruction is required to ensure that any kind
- // of encoding is given when the document is written.
- QDomProcessingInstruction process = document->createProcessingInstruction(
- "xml", "version=\"1.0\" encoding=\"utf-8\"");
- document->appendChild(process);
-
- QDomElement documentElement = document->createElement("document");
- document->appendChild(documentElement);
-
- QTextFrame *root = textDocument->rootFrame();
-
- if (root)
- processFrame(documentElement, root);
-
- return document;
-}
-
-void XmlWriter::processBlock(QDomElement &parent, const QTextBlock &block)
-{
- QDomElement blockElement = document->createElement("block");
- blockElement.setAttribute("position", block.position());
- blockElement.setAttribute("length", block.length());
- parent.appendChild(blockElement);
-
- QTextBlock::iterator it;
- for (it = block.begin(); !(it.atEnd()); ++it) {
- QTextFragment fragment = it.fragment();
-
- if (fragment.isValid()) {
- QDomElement fragmentElement = document->createElement("fragment");
- blockElement.appendChild(fragmentElement);
-
- fragmentElement.setAttribute("length", fragment.length());
- QDomText fragmentText = document->createTextNode(fragment.text());
-
- fragmentElement.appendChild(fragmentText);
- }
- }
-}
-
-void XmlWriter::processFrame(QDomElement &parent, QTextFrame *frame)
-{
- QDomElement frameElement = document->createElement("frame");
- frameElement.setAttribute("begin", frame->firstPosition());
- frameElement.setAttribute("end", frame->lastPosition());
- parent.appendChild(frameElement);
-
-//! [0]
- QDomElement frameElement = ...
-
- QTextFrame::iterator it;
- for (it = frame->begin(); !(it.atEnd()); ++it) {
-
- QTextFrame *childFrame = it.currentFrame();
- QTextBlock childBlock = it.currentBlock();
-
- if (childFrame) {
- QTextTable *childTable = qobject_cast<QTextTable*>(childFrame);
-
- if (childTable)
- processTable(frameElement, childTable);
- else
- processFrame(frameElement, childFrame);
-
- } else if (childBlock.isValid())
-//! [0] //! [1]
- processBlock(frameElement, childBlock);
- }
-//! [1]
-}
-
-void XmlWriter::processTable(QDomElement &parent, QTextTable *table)
-{
- QDomElement element = document->createElement("table");
-
- for (int row = 0; row < table->rows(); ++row) {
- for (int column = 0; column < table->columns(); ++column) {
- QTextTableCell cell = table->cellAt(row, column);
- processTableCell(element, cell);
- }
- }
- parent.appendChild(element);
-}
-
-void XmlWriter::processTableCell(QDomElement &parent, const QTextTableCell &cell)
-{
- QDomElement element = document->createElement("cell");
- element.setAttribute("row", cell.row());
- element.setAttribute("column", cell.column());
-
- QTextFrame::iterator it;
- for (it = cell.begin(); !(it.atEnd()); ++it) {
-
- QTextFrame *childFrame = it.currentFrame();
- QTextBlock childBlock = it.currentBlock();
-
- if (childFrame)
- processFrame(element, childFrame);
- else if (childBlock.isValid())
- processBlock(element, childBlock);
- }
- parent.appendChild(element);
-}
diff --git a/src/gui/doc/snippets/textdocument-tables/xmlwriter.h b/src/gui/doc/snippets/textdocument-tables/xmlwriter.h
deleted file mode 100644
index 049e55df20..0000000000
--- a/src/gui/doc/snippets/textdocument-tables/xmlwriter.h
+++ /dev/null
@@ -1,74 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the documentation of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:BSD$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** BSD License Usage
-** Alternatively, you may use this file under the terms of the BSD license
-** as follows:
-**
-** "Redistribution and use in source and binary forms, with or without
-** modification, are permitted provided that the following conditions are
-** met:
-** * Redistributions of source code must retain the above copyright
-** notice, this list of conditions and the following disclaimer.
-** * Redistributions in binary form must reproduce the above copyright
-** notice, this list of conditions and the following disclaimer in
-** the documentation and/or other materials provided with the
-** distribution.
-** * Neither the name of The Qt Company Ltd nor the names of its
-** contributors may be used to endorse or promote products derived
-** from this software without specific prior written permission.
-**
-**
-** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef XMLWRITER_H
-#define XMLWRITER_H
-
-#include <QDomDocument>
-
-class QTextDocument;
-
-class XmlWriter
-{
-public:
- XmlWriter(QTextDocument *document) : textDocument(document) {}
- QDomDocument *toXml();
-
-private:
- void processBlock(QDomElement &parent, const QTextBlock &block);
- void processFrame(QDomElement &parent, QTextFrame *frame);
- void processTable(QDomElement &parent, QTextTable *table);
- void processTableCell(QDomElement &parent, const QTextTableCell &cell);
-
- QDomDocument *document;
- QTextDocument *textDocument;
-};
-
-#endif
diff --git a/src/gui/doc/snippets/textdocument-texttable/main.cpp b/src/gui/doc/snippets/textdocument-texttable/main.cpp
index 518624634e..69c7580a7e 100644
--- a/src/gui/doc/snippets/textdocument-texttable/main.cpp
+++ b/src/gui/doc/snippets/textdocument-texttable/main.cpp
@@ -1,54 +1,8 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the documentation of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:BSD$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** BSD License Usage
-** Alternatively, you may use this file under the terms of the BSD license
-** as follows:
-**
-** "Redistribution and use in source and binary forms, with or without
-** modification, are permitted provided that the following conditions are
-** met:
-** * Redistributions of source code must retain the above copyright
-** notice, this list of conditions and the following disclaimer.
-** * Redistributions in binary form must reproduce the above copyright
-** notice, this list of conditions and the following disclaimer in
-** the documentation and/or other materials provided with the
-** distribution.
-** * Neither the name of The Qt Company Ltd nor the names of its
-** contributors may be used to endorse or promote products derived
-** from this software without specific prior written permission.
-**
-**
-** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include <QtGui>
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause
+#include <QApplication>
+#include <QTextEdit>
+#include <QTextTable>
int main(int argc, char * argv[])
{
diff --git a/src/gui/doc/snippets/textdocumentendsnippet.cpp b/src/gui/doc/snippets/textdocumentendsnippet.cpp
deleted file mode 100644
index cb7abd5ca7..0000000000
--- a/src/gui/doc/snippets/textdocumentendsnippet.cpp
+++ /dev/null
@@ -1,66 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the documentation of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:BSD$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** BSD License Usage
-** Alternatively, you may use this file under the terms of the BSD license
-** as follows:
-**
-** "Redistribution and use in source and binary forms, with or without
-** modification, are permitted provided that the following conditions are
-** met:
-** * Redistributions of source code must retain the above copyright
-** notice, this list of conditions and the following disclaimer.
-** * Redistributions in binary form must reproduce the above copyright
-** notice, this list of conditions and the following disclaimer in
-** the documentation and/or other materials provided with the
-** distribution.
-** * Neither the name of The Qt Company Ltd nor the names of its
-** contributors may be used to endorse or promote products derived
-** from this software without specific prior written permission.
-**
-**
-** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include <QtGui>
-#include <iostream.h>
-
-int main(int argv, char **args)
-{
- QString contentString("One\nTwp\nThree");
-
- QTextDocument *doc = new QTextDocument(contentString);
-
-//! [0]
- for (QTextBlock it = doc->begin(); it != doc->end(); it = it.next())
- cout << it.text().toStdString() << Qt::endl;
-//! [0]
-
- return 0;
-}
diff --git a/src/gui/doc/snippets/transform/main.cpp b/src/gui/doc/snippets/transform/main.cpp
index e30a3b63bf..cedffe218c 100644
--- a/src/gui/doc/snippets/transform/main.cpp
+++ b/src/gui/doc/snippets/transform/main.cpp
@@ -1,55 +1,11 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the documentation of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:BSD$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** BSD License Usage
-** Alternatively, you may use this file under the terms of the BSD license
-** as follows:
-**
-** "Redistribution and use in source and binary forms, with or without
-** modification, are permitted provided that the following conditions are
-** met:
-** * Redistributions of source code must retain the above copyright
-** notice, this list of conditions and the following disclaimer.
-** * Redistributions in binary form must reproduce the above copyright
-** notice, this list of conditions and the following disclaimer in
-** the documentation and/or other materials provided with the
-** distribution.
-** * Neither the name of The Qt Company Ltd nor the names of its
-** contributors may be used to endorse or promote products derived
-** from this software without specific prior written permission.
-**
-**
-** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include <QtGui>
-#include <cmath>
+// Copyright (C) 2021 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause
+#include <QApplication>
+#include <QtMath>
+#include <QPainter>
+#include <QVBoxLayout>
+#include <QWidget>
+
class SimpleTransformation : public QWidget
{
@@ -103,18 +59,15 @@ class BasicOperations : public QWidget
//! [2]
void BasicOperations::paintEvent(QPaintEvent *)
{
- double pi = 3.14;
-
- double a = pi/180 * 45.0;
+ const double a = qDegreesToRadians(45.0);
double sina = sin(a);
double cosa = cos(a);
- QTransform translationTransform(1, 0, 0, 1, 50.0, 50.0);
- QTransform rotationTransform(cosa, sina, -sina, cosa, 0, 0);
- QTransform scalingTransform(0.5, 0, 0, 1.0, 0, 0);
+ QTransform scale(0.5, 0, 0, 1.0, 0, 0);
+ QTransform rotate(cosa, sina, -sina, cosa, 0, 0);
+ QTransform translate(1, 0, 0, 1, 50.0, 50.0);
- QTransform transform;
- transform = scalingTransform * rotationTransform * translationTransform;
+ QTransform transform = scale * rotate * translate;
QPainter painter(this);
painter.setPen(QPen(Qt::blue, 1, Qt::DashLine));
@@ -138,11 +91,10 @@ int main(int argc, char **argv)
CombinedTransformation *combinedWidget = new CombinedTransformation;
BasicOperations *basicWidget = new BasicOperations;
- QVBoxLayout *layout = new QVBoxLayout;
+ QVBoxLayout *layout = new QVBoxLayout(&widget);
layout->addWidget(simpleWidget);
layout->addWidget(combinedWidget);
layout->addWidget(basicWidget);
- widget.setLayout(layout);
widget.show();
widget.resize(130, 350);
diff --git a/src/gui/doc/src/coordsys.qdoc b/src/gui/doc/src/coordsys.qdoc
index 1018b2122b..087916635b 100644
--- a/src/gui/doc/src/coordsys.qdoc
+++ b/src/gui/doc/src/coordsys.qdoc
@@ -1,29 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the documentation of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:FDL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Free Documentation License Usage
-** Alternatively, this file may be used under the terms of the GNU Free
-** Documentation License version 1.3 as published by the Free Software
-** Foundation and appearing in the file included in the packaging of
-** this file. Please review the following information to ensure
-** the GNU Free Documentation License version 1.3 requirements
-** will be met: https://www.gnu.org/licenses/fdl-1.3.html.
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GFDL-1.3-no-invariants-only
/*!
\page coordsys.html
@@ -111,7 +87,7 @@
\endtable
When rendering with a pen with an even number of pixels, the
- pixels will be rendered symetrically around the mathematical
+ pixels will be rendered symmetrically around the mathematical
defined points, while rendering with a pen with an odd number of
pixels, the spare pixel will be rendered to the right and below
the mathematical point as in the one pixel case. See the QRectF
@@ -119,7 +95,7 @@
\table
\header
- \li {3,1} QRectF
+ \li {2,1} QRectF
\row
\li \inlineimage qrect-diagram-zero.png
\li \inlineimage qrectf-diagram-one.png
@@ -160,7 +136,7 @@
\section2 Anti-aliased Painting
If you set QPainter's \l {QPainter::Antialiasing}{anti-aliasing}
- render hint, the pixels will be rendered symetrically on both
+ render hint, the pixels will be rendered symmetrically on both
sides of the mathematically defined points:
\table
@@ -237,11 +213,11 @@
\row
\li {2,1}
- \snippet analogclock/main.cpp 1
+ \snippet ../widgets/widgets/analogclock/analogclock.cpp 9
We translate the coordinate system so that point (0, 0) is in the
widget's center, instead of being at the top-left corner. We also
- scale the system by \c side / 100, where \c side is either the
+ scale the system by \c side / 200, where \c side is either the
widget's width or the height, whichever is shortest. We want the
clock to be square, even if the device isn't.
@@ -251,7 +227,7 @@
See also the \l {Window-Viewport Conversion} section.
- \snippet analogclock/main.cpp 2
+ \snippet ../widgets/widgets/analogclock/analogclock.cpp 18
We draw the clock's hour hand by rotating the coordinate system
and calling QPainter::drawConvexPolygon(). Thank's to the
@@ -259,26 +235,35 @@
The polygon is specified as an array of alternating \e x, \e y
values, stored in the \c hourHand static variable (defined at the
- beginning of the function), which corresponds to the four points
- (2, 0), (0, 2), (-2, 0), and (0, -25).
+ beginning of the function), which corresponds to the three points
+ (7, 8), (-7, 8), (0, -40).
The calls to QPainter::save() and QPainter::restore() surrounding
the code guarantees that the code that follows won't be disturbed
by the transformations we've used.
- \snippet analogclock/main.cpp 3
+ \snippet ../widgets/widgets/analogclock/analogclock.cpp 21
+
+ After that, we draw the hour markers for the clock face, which
+ consists of twelve short lines at 30-degree intervals. When that
+ loop is done, the painter has been rotated a full circle back to
+ its original state, so we don't need to save and restore the state.
+
+ \snippet ../widgets/widgets/analogclock/analogclock.cpp 24
We do the same for the clock's minute hand, which is defined by
- the four points (1, 0), (0, 1), (-1, 0), and (0, -40). These
+ the three points (7, 8), (-7, 8), (0, -70). These
coordinates specify a hand that is thinner and longer than the
minute hand.
- \snippet analogclock/main.cpp 4
+ \snippet ../widgets/widgets/analogclock/analogclock.cpp 27
- Finally, we draw the clock face, which consists of twelve short
- lines at 30-degree intervals. At the end of that, the painter is
- rotated in a way which isn't very useful, but we're done with
- painting so that doesn't matter.
+ Finally, we draw the minute markers for the clock face, which
+ consists of sixty short lines at 6-degree intervals. We skip every
+ fifth minute marker because we don't want to draw over the hour
+ markers. At the end of that, the painter is rotated in a way which
+ isn't very useful, but we're done with painting so that doesn't
+ matter.
\endtable
For more information about the transformation matrix, see the
@@ -434,7 +419,7 @@
\li
A vectorial specification of a 2D shape. Painter paths are the
ultimate painting primitive, in the sense that any shape
- (rectange, ellipse, spline) or combination of shapes can be
+ (rectangle, ellipse, spline) or combination of shapes can be
expressed as a path. A path specifies both an outline and an area.
\row
\li QRegion
@@ -446,5 +431,5 @@
\endtable
\endomit
- \sa {Analog Clock Window Example}
+ \sa {Analog Clock}
*/
diff --git a/src/gui/doc/src/dnd.qdoc b/src/gui/doc/src/dnd.qdoc
index 945c485705..7a756b304e 100644
--- a/src/gui/doc/src/dnd.qdoc
+++ b/src/gui/doc/src/dnd.qdoc
@@ -1,31 +1,8 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the documentation of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:FDL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Free Documentation License Usage
-** Alternatively, this file may be used under the terms of the GNU Free
-** Documentation License version 1.3 as published by the Free Software
-** Foundation and appearing in the file included in the packaging of
-** this file. Please review the following information to ensure
-** the GNU Free Documentation License version 1.3 requirements
-** will be met: https://www.gnu.org/licenses/fdl-1.3.html.
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GFDL-1.3-no-invariants-only
/*!
+ \keyword Drag and Drop in Qt
\page dnd.html
\title Drag and Drop
\brief An overview of the drag and drop system provided by Qt.
@@ -358,7 +335,9 @@
For example, we can copy the contents of a QLineEdit to the clipboard
with the following code:
- \snippet ../widgets/widgets/charactermap/mainwindow.cpp 11
+ \code
+ QGuiApplication::clipboard()->setText(lineEdit->text(), QClipboard::Clipboard);
+ \endcode
Data with different MIME types can also be put on the clipboard.
Construct a QMimeData object and set data with setData() function in
@@ -377,8 +356,6 @@
using one of the MIME types that can be used to represent it:
\snippet clipboard/clipwindow.cpp 1
- \dots
- \snippet clipboard/clipwindow.cpp 2
The \l{QClipboard::selectionChanged()}{selectionChanged()} signal can
be used on X11 to monitor the mouse selection.
@@ -389,23 +366,20 @@
\li \l{draganddrop/draggableicons}{Draggable Icons}
\li \l{draganddrop/draggabletext}{Draggable Text}
\li \l{draganddrop/dropsite}{Drop Site}
- \li \l{draganddrop/fridgemagnets}{Fridge Magnets}
- \li \l{draganddrop/puzzle}{Drag and Drop Puzzle}
\endlist
\section1 Interoperating with Other Applications
- On X11, the public \l{http://www.newplanetsoftware.com/xdnd/}{XDND
- protocol} is used, while on Windows Qt uses the OLE standard, and
- Qt for \macos uses the Cocoa Drag Manager. On X11, XDND uses MIME,
- so no translation is necessary. The Qt API is the same regardless of
- the platform. On Windows, MIME-aware applications can communicate by
- using clipboard format names that are MIME types. Already some
- Windows applications use MIME naming conventions for their
- clipboard formats.
+ On X11, the public
+ \l{https://freedesktop.org/wiki/Specifications/XDND}{XDND protocol} is
+ used, while on Windows Qt uses the OLE standard, and Qt for \macos uses the
+ Cocoa Drag Manager. On X11, XDND uses MIME, so no translation is necessary.
+ The Qt API is the same regardless of the platform. On Windows, MIME-aware
+ applications can communicate by using clipboard format names that are MIME
+ types. Some Windows applications already use MIME naming conventions for
+ their clipboard formats.
Custom classes for translating proprietary clipboard formats can be
- registered by reimplementing QWinMime on Windows or
- QMacPasteboardMime on \macos.
-
+ registered by reimplementing QWindowsMimeConverter on Windows or
+ QUtiMimeConverter on \macos.
*/
diff --git a/src/gui/doc/src/dontdocument.qdoc b/src/gui/doc/src/dontdocument.qdoc
index b360acefc1..5f19ea9e73 100644
--- a/src/gui/doc/src/dontdocument.qdoc
+++ b/src/gui/doc/src/dontdocument.qdoc
@@ -1,63 +1,9 @@
-/****************************************************************************
-**
-** Copyright (C) 2019 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the documentation of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:FDL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Free Documentation License Usage
-** Alternatively, this file may be used under the terms of the GNU Free
-** Documentation License version 1.3 as published by the Free Software
-** Foundation and appearing in the file included in the packaging of
-** this file. Please review the following information to ensure
-** the GNU Free Documentation License version 1.3 requirements
-** will be met: https://www.gnu.org/licenses/fdl-1.3.html.
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2019 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GFDL-1.3-no-invariants-only
/*!
\dontdocument (QTypeInfo QScreenOrientationChangeEvent QApplicationStateChangeEvent
- QImageTextKeyLang QMetaTypeId QAbstractUndoItem
- QOpenGLVersionStatus
- QOpenGLVersionFunctionsBackend
- QOpenGLVersionFunctionsStorage
- QOpenGLFunctions_1_0_CoreBackend
- QOpenGLFunctions_1_1_CoreBackend
- QOpenGLFunctions_1_2_CoreBackend
- QOpenGLFunctions_1_3_CoreBackend
- QOpenGLFunctions_1_4_CoreBackend
- QOpenGLFunctions_1_5_CoreBackend
- QOpenGLFunctions_2_0_CoreBackend
- QOpenGLFunctions_2_1_CoreBackend
- QOpenGLFunctions_3_0_CoreBackend
- QOpenGLFunctions_3_1_CoreBackend
- QOpenGLFunctions_3_2_CoreBackend
- QOpenGLFunctions_3_3_CoreBackend
- QOpenGLFunctions_4_0_CoreBackend
- QOpenGLFunctions_4_1_CoreBackend
- QOpenGLFunctions_4_2_CoreBackend
- QOpenGLFunctions_4_3_CoreBackend
- QOpenGLFunctions_4_4_CoreBackend
- QOpenGLFunctions_4_5_CoreBackend
- QOpenGLFunctions_1_0_DeprecatedBackend
- QOpenGLFunctions_1_1_DeprecatedBackend
- QOpenGLFunctions_1_2_DeprecatedBackend
- QOpenGLFunctions_1_3_DeprecatedBackend
- QOpenGLFunctions_1_4_DeprecatedBackend
- QOpenGLFunctions_2_0_DeprecatedBackend
- QOpenGLFunctions_3_0_DeprecatedBackend
- QOpenGLFunctions_3_3_DeprecatedBackend
- QOpenGLFunctions_4_5_DeprecatedBackend
+ QMetaTypeId QAbstractUndoItem
QTextFrameLayoutData QPlatformDropQtResponse QPlatformDragQtResponse
QPlatformOffscreenSurface QColorDialogOptions QFontDialogOptions
QFileDialogOptions QMessageDialogOptions QMessageDialogOptions::CustomButton
diff --git a/src/gui/doc/src/external-resources.qdoc b/src/gui/doc/src/external-resources.qdoc
index 0addbb21cd..16bca2475d 100644
--- a/src/gui/doc/src/external-resources.qdoc
+++ b/src/gui/doc/src/external-resources.qdoc
@@ -1,29 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the documentation of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:FDL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Free Documentation License Usage
-** Alternatively, this file may be used under the terms of the GNU Free
-** Documentation License version 1.3 as published by the Free Software
-** Foundation and appearing in the file included in the packaging of
-** this file. Please review the following information to ensure
-** the GNU Free Documentation License version 1.3 requirements
-** will be met: https://www.gnu.org/licenses/fdl-1.3.html.
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GFDL-1.3-no-invariants-only
/*!
@@ -32,13 +8,13 @@
*/
/*!
- \externalpage http://www.linux-foundation.org/en/Accessibility/IAccessible2
+ \externalpage https://accessibility.linuxfoundation.org/a11yspecs/ia2/docs/html/index.html
\title IAccessible2 Specification
*/
/*!
- \externalpage http://czyborra.com/
- \title Roman Czyborra's
+ \externalpage https://www.unicode.org/reports/tr17/
+ \title UTR17
*/
/*!
@@ -53,15 +29,24 @@
/*!
\externalpage https://standards.freedesktop.org/icon-theme-spec/icon-theme-spec-latest.html
- \title Icon Theme Specification
+ \title Freedesktop Icon Theme Specification
*/
/*!
+ \externalpage https://specifications.freedesktop.org/icon-naming-spec/icon-naming-spec-latest.html
+ \title Freedesktop Icon Naming Specification
+*/
+/*!
\externalpage https://standards.freedesktop.org/icon-theme-spec/icon-theme-spec-latest.html#directory_layout
\title Icon Theme Specification - Directory Layout
*/
/*!
+ \externalpage https://freedesktop.org/
+ \title Freedesktop
+*/
+
+/*!
\externalpage https://www.khronos.org/vulkan/
\title Vulkan
*/
@@ -70,3 +55,13 @@
\externalpage https://www.lunarg.com/vulkan-sdk/
\title LunarG Vulkan SDK
*/
+
+/*!
+ \externalpage https://developer.android.com/reference/androidx/core/content/FileProvider
+ \title Android: FileProvider
+*/
+
+/*!
+ \externalpage https://developer.android.com/training/secure-file-sharing/setup-sharing.html
+ \title Android: Setting up file sharing
+*/
diff --git a/src/gui/doc/src/includes/qt-colors.qdocinc b/src/gui/doc/src/includes/qt-colors.qdocinc
index 4c082323b6..d98c0a908a 100644
--- a/src/gui/doc/src/includes/qt-colors.qdocinc
+++ b/src/gui/doc/src/includes/qt-colors.qdocinc
@@ -3,84 +3,105 @@
\li Name
\li Hex
\li Color
+
\row
\li Color0
\li #000000
\li \svgcolor {#000000}
+
\row
\li Color1
\li #ffffff
\li \svgcolor {#ffffff}
+
\row
\li Black
\li #000000
\li \svgcolor {#000000}
+
\row
\li White
\li #ffffff
\li \svgcolor {#ffffff}
+
\row
\li DarkGray
\li #808080
\li \svgcolor {#808080}
+
\row
\li Gray
\li #a0a0a4
\li \svgcolor {#a0a0a4}
+
\row
\li LightGray
\li #c0c0c0
\li \svgcolor {#c0c0c0}
+
\row
\li Red
\li #ff0000
\li \svgcolor {#ff0000}
+
\row
\li Green
\li #00ff00
\li \svgcolor {#00ff00}
+
\row
\li Blue
\li #0000ff
\li \svgcolor {#0000ff}
+
\row
\li Cyan
\li #00ffff
\li \svgcolor {#00ffff}
+
\row
\li Magenta
\li #ff00ff
\li \svgcolor {#ff00ff}
+
\row
\li Yellow
\li #ffff00
\li \svgcolor {#ffff00}
+
\row
\li DarkRed
\li #800000
\li \svgcolor {#800000}
+
\row
\li DarkGreen
\li #008000
\li \svgcolor {#008000}
+
\row
\li DarkBlue
\li #000080
\li \svgcolor {#000080}
+
\row
\li DarkCyan
\li #008080
\li \svgcolor {#008080}
+
\row
\li DarkMagenta
\li #800080
\li \svgcolor {#800080}
+
\row
\li DarkYellow
\li #808000
\li \svgcolor {#808000}
+
\row
\li Transparent
\li #00000000
\li (transparent)
+
\endtable
diff --git a/src/gui/doc/src/includes/svg-colors.qdocinc b/src/gui/doc/src/includes/svg-colors.qdocinc
index 4e5fb56d5e..c28cbabbf7 100644
--- a/src/gui/doc/src/includes/svg-colors.qdocinc
+++ b/src/gui/doc/src/includes/svg-colors.qdocinc
@@ -3,592 +3,740 @@
\li Name
\li Hex
\li Color
+
\row
\li aliceblue
\li #f0f8ff
\li \svgcolor {#f0f8ff}
+
\row
\li antiquewhite
\li #faebd7
\li \svgcolor {#faebd7}
+
\row
\li aqua
\li #00ffff
\li \svgcolor {#00ffff}
+
\row
\li aquamarine
\li #7fffd4
\li \svgcolor {#7fffd4}
+
\row
\li azure
\li #f0ffff
\li \svgcolor {#f0ffff}
+
\row
\li beige
\li #f5f5dc
\li \svgcolor {#f5f5dc}
+
\row
\li bisque
\li #ffe4c4
\li \svgcolor {#ffe4c4}
+
\row
\li black
\li #000000
\li \svgcolor {#000000}
+
\row
\li blanchedalmond
\li #ffebcd
\li \svgcolor {#ffebcd}
+
\row
\li blue
\li #0000ff
\li \svgcolor {#0000ff}
+
\row
\li blueviolet
\li #8a2be2
\li \svgcolor {#8a2be2}
+
\row
\li brown
\li #a52a2a
\li \svgcolor {#a52a2a}
+
\row
\li burlywood
\li #deb887
\li \svgcolor {#deb887}
+
\row
\li cadetblue
\li #5f9ea0
\li \svgcolor {#5f9ea0}
+
\row
\li chartreuse
\li #7fff00
\li \svgcolor {#7fff00}
+
\row
\li chocolate
\li #d2691e
\li \svgcolor {#d2691e}
+
\row
\li coral
\li #ff7f50
\li \svgcolor {#ff7f50}
+
\row
\li cornflowerblue
\li #6495ed
\li \svgcolor {#6495ed}
+
\row
\li cornsilk
\li #fff8dc
\li \svgcolor {#fff8dc}
+
\row
\li crimson
\li #dc143c
\li \svgcolor {#dc143c}
+
\row
\li cyan
\li #00ffff
\li \svgcolor {#00ffff}
+
\row
\li darkblue
\li #00008b
\li \svgcolor {#00008b}
+
\row
\li darkcyan
\li #008b8b
\li \svgcolor {#008b8b}
+
\row
\li darkgoldenrod
\li #b8860b
\li \svgcolor {#b8860b}
+
\row
\li darkgray
\li #a9a9a9
\li \svgcolor {#a9a9a9}
+
\row
\li darkgreen
\li #006400
\li \svgcolor {#006400}
+
\row
\li darkgrey
\li #a9a9a9
\li \svgcolor {#a9a9a9}
+
\row
\li darkkhaki
\li #bdb76b
\li \svgcolor {#bdb76b}
+
\row
\li darkmagenta
\li #8b008b
\li \svgcolor {#8b008b}
+
\row
\li darkolivegreen
\li #556b2f
\li \svgcolor {#556b2f}
+
\row
\li darkorange
\li #ff8c00
\li \svgcolor {#ff8c00}
+
\row
\li darkorchid
\li #9932cc
\li \svgcolor {#9932cc}
+
\row
\li darkred
\li #8b0000
\li \svgcolor {#8b0000}
+
\row
\li darksalmon
\li #e9967a
\li \svgcolor {#e9967a}
+
\row
\li darkseagreen
\li #8fbc8f
\li \svgcolor {#8fbc8f}
+
\row
\li darkslateblue
\li #483d8b
\li \svgcolor {#483d8b}
+
\row
\li darkslategray
\li #2f4f4f
\li \svgcolor {#2f4f4f}
+
\row
\li darkslategrey
\li #2f4f4f
\li \svgcolor {#2f4f4f}
+
\row
\li darkturquoise
\li #00ced1
\li \svgcolor {#00ced1}
+
\row
\li darkviolet
\li #9400d3
\li \svgcolor {#9400d3}
+
\row
\li deeppink
\li #ff1493
\li \svgcolor {#ff1493}
+
\row
\li deepskyblue
\li #00bfff
\li \svgcolor {#00bfff}
+
\row
\li dimgray
\li #696969
\li \svgcolor {#696969}
+
\row
\li dimgrey
\li #696969
\li \svgcolor {#696969}
+
\row
\li dodgerblue
\li #1e90ff
\li \svgcolor {#1e90ff}
+
\row
\li firebrick
\li #b22222
\li \svgcolor {#b22222}
+
\row
\li floralwhite
\li #fffaf0
\li \svgcolor {#fffaf0}
+
\row
\li forestgreen
\li #228b22
\li \svgcolor {#228b22}
+
\row
\li fuchsia
\li #ff00ff
\li \svgcolor {#ff00ff}
+
\row
\li gainsboro
\li #dcdcdc
\li \svgcolor {#dcdcdc}
+
\row
\li ghostwhite
\li #f8f8ff
\li \svgcolor {#f8f8ff}
+
\row
\li gold
\li #ffd700
\li \svgcolor {#ffd700}
+
\row
\li goldenrod
\li #daa520
\li \svgcolor {#daa520}
+
\row
\li gray
\li #808080
\li \svgcolor {#808080}
+
\row
\li grey
\li #808080
\li \svgcolor {#808080}
+
\row
\li green
\li #008000
\li \svgcolor {#008000}
+
\row
\li greenyellow
\li #adff2f
\li \svgcolor {#adff2f}
+
\row
\li honeydew
\li #f0fff0
\li \svgcolor {#f0fff0}
+
\row
\li hotpink
\li #ff69b4
\li \svgcolor {#ff69b4}
+
\row
\li indianred
\li #cd5c5c
\li \svgcolor {#cd5c5c}
+
\row
\li indigo
\li #4b0082
\li \svgcolor {#4b0082}
+
\row
\li ivory
\li #fffff0
\li \svgcolor {#fffff0}
+
\row
\li khaki
\li #f0e68c
\li \svgcolor {#f0e68c}
+
\row
\li lavender
\li #e6e6fa
\li \svgcolor {#e6e6fa}
+
\row
\li lavenderblush
\li #fff0f5
\li \svgcolor {#fff0f5}
+
\row
\li lawngreen
\li #7cfc00
\li \svgcolor {#7cfc00}
+
\row
\li lemonchiffon
\li #fffacd
\li \svgcolor {#fffacd}
+
\row
\li lightblue
\li #add8e6
\li \svgcolor {#add8e6}
+
\row
\li lightcoral
\li #f08080
\li \svgcolor {#f08080}
+
\row
\li lightcyan
\li #e0ffff
\li \svgcolor {#e0ffff}
+
\row
\li lightgoldenrodyellow
\li #fafad2
\li \svgcolor {#fafad2}
+
\row
\li lightgray
\li #d3d3d3
\li \svgcolor {#d3d3d3}
+
\row
\li lightgreen
\li #90ee90
\li \svgcolor {#90ee90}
+
\row
\li lightgrey
\li #d3d3d3
\li \svgcolor {#d3d3d3}
+
\row
\li lightpink
\li #ffb6c1
\li \svgcolor {#ffb6c1}
+
\row
\li lightsalmon
\li #ffa07a
\li \svgcolor {#ffa07a}
+
\row
\li lightseagreen
\li #20b2aa
\li \svgcolor {#20b2aa}
+
\row
\li lightskyblue
\li #87cefa
\li \svgcolor {#87cefa}
+
\row
\li lightslategray
\li #778899
\li \svgcolor {#778899}
+
\row
\li lightslategrey
\li #778899
\li \svgcolor {#778899}
+
\row
\li lightsteelblue
\li #b0c4de
\li \svgcolor {#b0c4de}
+
\row
\li lightyellow
\li #ffffe0
\li \svgcolor {#ffffe0}
+
\row
\li lime
\li #00ff00
\li \svgcolor {#00ff00}
+
\row
\li limegreen
\li #32cd32
\li \svgcolor {#32cd32}
+
\row
\li linen
\li #faf0e6
\li \svgcolor {#faf0e6}
+
\row
\li magenta
\li #ff00ff
\li \svgcolor {#ff00ff}
+
\row
\li maroon
\li #800000
\li \svgcolor {#800000}
+
\row
\li mediumaquamarine
\li #66cdaa
\li \svgcolor {#66cdaa}
+
\row
\li mediumblue
\li #0000cd
\li \svgcolor {#0000cd}
+
\row
\li mediumorchid
\li #ba55d3
\li \svgcolor {#ba55d3}
+
\row
\li mediumpurple
\li #9370db
\li \svgcolor {#9370db}
+
\row
\li mediumseagreen
\li #3cb371
\li \svgcolor {#3cb371}
+
\row
\li mediumslateblue
\li #7b68ee
\li \svgcolor {#7b68ee}
+
\row
\li mediumspringgreen
\li #00fa9a
\li \svgcolor {#00fa9a}
+
\row
\li mediumturquoise
\li #48d1cc
\li \svgcolor {#48d1cc}
+
\row
\li mediumvioletred
\li #c71585
\li \svgcolor {#c71585}
+
\row
\li midnightblue
\li #191970
\li \svgcolor {#191970}
+
\row
\li mintcream
\li #f5fffa
\li \svgcolor {#f5fffa}
+
\row
\li mistyrose
\li #ffe4e1
\li \svgcolor {#ffe4e1}
+
\row
\li moccasin
\li #ffe4b5
\li \svgcolor {#ffe4b5}
+
\row
\li navajowhite
\li #ffdead
\li \svgcolor {#ffdead}
+
\row
\li navy
\li #000080
\li \svgcolor {#000080}
+
\row
\li oldlace
\li #fdf5e6
\li \svgcolor {#fdf5e6}
+
\row
\li olive
\li #808000
\li \svgcolor {#808000}
+
\row
\li olivedrab
\li #6b8e23
\li \svgcolor {#6b8e23}
+
\row
\li orange
\li #ffa500
\li \svgcolor {#ffa500}
+
\row
\li orangered
\li #ff4500
\li \svgcolor {#ff4500}
+
\row
\li orchid
\li #da70d6
\li \svgcolor {#da70d6}
+
\row
\li palegoldenrod
\li #eee8aa
\li \svgcolor {#eee8aa}
+
\row
\li palegreen
\li #98fb98
\li \svgcolor {#98fb98}
+
\row
\li paleturquoise
\li #afeeee
\li \svgcolor {#afeeee}
+
\row
\li palevioletred
\li #db7093
\li \svgcolor {#db7093}
+
\row
\li papayawhip
\li #ffefd5
\li \svgcolor {#ffefd5}
+
\row
\li peachpuff
\li #ffdab9
\li \svgcolor {#ffdab9}
+
\row
\li peru
\li #cd853f
\li \svgcolor {#cd853f}
+
\row
\li pink
\li #ffc0cb
\li \svgcolor {#ffc0cb}
+
\row
\li plum
\li #dda0dd
\li \svgcolor {#dda0dd}
+
\row
\li powderblue
\li #b0e0e6
\li \svgcolor {#b0e0e6}
+
\row
\li purple
\li #800080
\li \svgcolor {#800080}
+
\row
\li red
\li #ff0000
\li \svgcolor {#ff0000}
+
\row
\li rosybrown
\li #bc8f8f
\li \svgcolor {#bc8f8f}
+
\row
\li royalblue
\li #4169e1
\li \svgcolor {#4169e1}
+
\row
\li saddlebrown
\li #8b4513
\li \svgcolor {#8b4513}
+
\row
\li salmon
\li #fa8072
\li \svgcolor {#fa8072}
+
\row
\li sandybrown
\li #f4a460
\li \svgcolor {#f4a460}
+
\row
\li seagreen
\li #2e8b57
\li \svgcolor {#2e8b57}
+
\row
\li seashell
\li #fff5ee
\li \svgcolor {#fff5ee}
+
\row
\li sienna
\li #a0522d
\li \svgcolor {#a0522d}
+
\row
\li silver
\li #c0c0c0
\li \svgcolor {#c0c0c0}
+
\row
\li skyblue
\li #87ceeb
\li \svgcolor {#87ceeb}
+
\row
\li slateblue
\li #6a5acd
\li \svgcolor {#6a5acd}
+
\row
\li slategray
\li #708090
\li \svgcolor {#708090}
+
\row
\li slategrey
\li #708090
\li \svgcolor {#708090}
+
\row
\li snow
\li #fffafa
\li \svgcolor {#fffafa}
+
\row
\li springgreen
\li #00ff7f
\li \svgcolor {#00ff7f}
+
\row
\li steelblue
\li #4682b4
\li \svgcolor {#4682b4}
+
\row
\li tan
\li #d2b48c
\li \svgcolor {#d2b48c}
+
\row
\li teal
\li #008080
\li \svgcolor {#008080}
+
\row
\li thistle
\li #d8bfd8
\li \svgcolor {#d8bfd8}
+
\row
\li tomato
\li #ff6347
\li \svgcolor {#ff6347}
+
\row
\li turquoise
\li #40e0d0
\li \svgcolor {#40e0d0}
+
\row
\li violet
\li #ee82ee
\li \svgcolor {#ee82ee}
+
\row
\li wheat
\li #f5deb3
\li \svgcolor {#f5deb3}
+
\row
\li white
\li #ffffff
\li \svgcolor {#ffffff}
+
\row
\li whitesmoke
\li #f5f5f5
\li \svgcolor {#f5f5f5}
+
\row
\li yellow
\li #ffff00
\li \svgcolor {#ffff00}
+
\row
\li yellowgreen
\li #9acd32
\li \svgcolor {#9acd32}
+
\endtable
diff --git a/src/gui/doc/src/paintsystem.qdoc b/src/gui/doc/src/paintsystem.qdoc
index 98d71e9e55..f3a5248db1 100644
--- a/src/gui/doc/src/paintsystem.qdoc
+++ b/src/gui/doc/src/paintsystem.qdoc
@@ -1,29 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the documentation of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:FDL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Free Documentation License Usage
-** Alternatively, this file may be used under the terms of the GNU Free
-** Documentation License version 1.3 as published by the Free Software
-** Foundation and appearing in the file included in the packaging of
-** this file. Please review the following information to ensure
-** the GNU Free Documentation License version 1.3 requirements
-** will be met: https://www.gnu.org/licenses/fdl-1.3.html.
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GFDL-1.3-no-invariants-only
/*!
\group painting
@@ -93,7 +69,6 @@
\page paintsystem-devices.html
\title Paint Devices and Backends
- \contentspage The Paint System
\nextpage Drawing and Filling
\section1 Creating a Paint Device
@@ -185,7 +160,6 @@
\title Drawing and Filling
\previouspage Paint Devices and Backends
- \contentspage The Paint System
\nextpage Coordinate System
\section1 Drawing
@@ -303,7 +277,6 @@
\title Reading and Writing Image Files
\previouspage Coordinate System
- \contentspage The Paint System
The most common way to read images is through QImage and QPixmap's
constructors, or by calling the QImage::load() and QPixmap::load()
diff --git a/src/gui/doc/src/qt6-changes.qdoc b/src/gui/doc/src/qt6-changes.qdoc
new file mode 100644
index 0000000000..60e1bffba8
--- /dev/null
+++ b/src/gui/doc/src/qt6-changes.qdoc
@@ -0,0 +1,151 @@
+// Copyright (C) 2020 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GFDL-1.3-no-invariants-only
+
+/*!
+ \page gui-changes-qt6.html
+ \title Changes to Qt GUI
+ \ingroup changes-qt-5-to-6
+ \brief Kernel, Text, Painting, and Utility classes are modified.
+
+ Qt 6 is a result of the conscious effort to make the framework more
+ efficient and easy to use.
+
+ We try to maintain binary and source compatibility for all the public
+ APIs in each release. But some changes were inevitable in an effort to
+ make Qt a better framework.
+
+ In this topic we summarize those changes in Qt GUI, and provide
+ guidance to handle them.
+
+ \section1 Kernel classes
+
+ \section2 The QBitmap class
+
+ Implicit construction of a QBitmap from a QPixmap is no longer supported.
+ The constructor and assignment operator have been made explicit and marked as
+ deprecated. Use the new static factory function \l{QBitmap::}{fromPixmap} instead.
+
+ \section2 The QCursor class
+
+ Implicit construction of a QCursor from a QPixmap is no longer supported, the
+ constructor has been made explicit.
+
+ \section2 The QKeyCombination class
+
+ QKeyCombination is a new class for storing a combination of a key with an
+ optional modifier. It should be used as a replacement for combining values from
+ the Qt::Key enum with a modifier in a type-safe way.
+
+ We recommend migrating code that currently uses operator+() to combine a key and
+ modifiers, as future C++ standards are likely to declare arithmetic operations
+ between unrelated enumeration types as illegal. Use operator|(), and change
+ APIs that expect an \c int to expect a QKeyCombination instead.
+
+ Existing APIs that expect an \c int for a key combination can be called using
+ QKeyCombination::toCombined().
+
+ \section1 Text classes
+
+ \section2 The QFontDatabase class
+
+ The QFontDatabase class has now only static member functions. The constructor
+ has been deprecated. Instead of e.g.
+
+ \code
+ const QStringList fontFamilies = QFontDatabase().families();
+ \endcode
+
+ use
+
+ \code
+ const QStringList fontFamilies = QFontDatabase::families();
+ \endcode
+
+ \section2 The QFont class
+
+ The numerical values of the QFont::Weight enumerator have been changed to
+ be in line with OpenType weight values. QFont::setWeight() expects an enum value
+ instead of an \c int, and code that calls the setter with an integer will fail to
+ compile. To continue to use old integer values, use QFont::setLegacyWeight().
+
+ \section1 Painting classes
+
+ See the porting guide for \l{Changes to Qt Print Support}{Qt Print Support} for
+ information about \l{QPagedPaintDevice} and other printing related classes.
+
+ \section1 Utility classes
+
+ \section2 QIntValidator and QDoubleValidator
+
+ The \l{QIntValidator::}{setRange()} method is no longer marked as virtual.
+
+ \section1 OpenGL classes
+
+ With the introduction of Qt RHI as the rendering foundation in Qt,
+ most classes prefixed by \c QOpenGL have been moved into the \l{Qt OpenGL}
+ module.
+
+ More details can be found in \l{Changes to Qt OpenGL}{the Qt OpenGL porting guide}.
+
+ One notable exception is the class \l QOpenGLContext, which still resides in
+ Qt GUI.
+
+ In addition, the class \l QOpenGLWidget has been moved to a new module, named
+ Qt OpenGL Widgets.
+
+ \section2 The QOpenGLContext class
+
+ The QOpenGLContext::versionFunctions() function is replaced by
+ QOpenGLVersionFunctionsFactory::get(). QOpenGLVersionFunctionsFactory is a public
+ class now, part of the \l{Qt OpenGL} module.
+
+ \section2 ANGLE
+
+ On Windows, ANGLE, a third-party OpenGL ES to Direct 3D translator, is no
+ longer included in Qt. This means Qt::AA_UseOpenGLES and the environment
+ variable \c{QT_OPENGL=angle} no longer have any effect.
+ In \l{Dynamically Loading OpenGL}{dynamic OpenGL builds} there is no automatic fallback to ANGLE in
+ case OpenGL proper fails to initialize. For QWindow or QWidget based
+ applications using OpenGL directly, for example via QOpenGLWidget, this means
+ that OpenGL proper is the only option at run time. However, the alternative of
+ using a pure software OpenGL implementation, such as Mesa llvmpipe that is
+ shipped with the pre-built Qt packages, is still available. For Qt Quick and Qt
+ Quick 3D applications, Qt 6 introduces support for Direct 3D 11, Vulkan, and
+ Metal, in addition to OpenGL. On Windows the default choice is Direct 3D,
+ therefore the removal of ANGLE is alleviated by having support for graphics
+ APIs other than OpenGL as well.
+
+ \section2 Native clipboard integration
+
+ Qt 5 provided interfaces for integrating platform specific or custom
+ clipboard formats into Qt through \c QMacPasteboardMime in \c QtMacExtras,
+ and \c QWindowsMime from the Windows QPA API. Since Qt 6.6, the
+ equivalent functionality is provided by the classes QUtiMimeConverter for
+ \macos, and the QWindowsMimeConverter for Windows.
+
+ Porting from QWindowsMime to QWindowsMimeConverter requires practically no
+ changes, as the virtual interface is identical. However, in Qt 6 it is no
+ longer needed to register a QWindowsMimeConverter implementation;
+ instantiating the type implicitly registers the converter.
+
+ Porting a QMacPasteboardMime to QUtiMimeConverter requires renaming some of
+ the virtual functions. Note that the \c{QMacPasteboardMime} API used the
+ outdated term \c{flavor} for the native clipboard format on \macos, whereas
+ the platform now uses \c{Uniform Type Identifiers}, i.e. \c{UTI}s, which Qt
+ has adapted for function and parameter names.
+
+ The \c{mimeFor} and \c{flavorFor} functions are replaced by the
+ \l{QUtiMimeConverter::}{mimeForUti} and \l{QUtiMimeConverter::}{utiForMime}
+ implementations, respectively. Those should return the name of the mime
+ type or \c{UTI} that the converter can convert the input format to, so a
+ port usually just involves renaming existing overrides. The
+ \c{convertToMime}, \c{convertFromMime}, and \c{count} functions in
+ QUtiMimeConverter are identical to their QMacPasteboardMime versions.
+
+ The \c{canConvert}, \c{converterName} functions are no longer needed, they
+ are implied by implementation of the above functions, so overrides of those
+ functions can be removed.
+
+ As with the the QWindowsMimeConverter, registration is done by instantiating
+ the type.
+*/
diff --git a/src/gui/doc/src/qtgui-overview.qdoc b/src/gui/doc/src/qtgui-overview.qdoc
new file mode 100644
index 0000000000..446479c9be
--- /dev/null
+++ b/src/gui/doc/src/qtgui-overview.qdoc
@@ -0,0 +1,187 @@
+// Copyright (C) 2022 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GFDL-1.3-no-invariants-only
+
+/*!
+ \page qtgui-overview.html
+ \title Qt GUI Overview
+ \brief An overview of the Qt GUI module.
+
+ The Qt GUI module provides classes for windowing system integration, event
+ handling, OpenGL and OpenGL ES integration, 2D graphics, basic imaging,
+ fonts, and text. These classes are used internally by Qt's user interface
+ technologies but can also be used directly, for example to write
+ applications using low-level OpenGL ES graphics APIs.
+
+ For application developers writing user interfaces, Qt provides higher level
+ APIs, like Qt Quick, that are much more suitable than the enablers found in
+ the Qt GUI module.
+
+ \section1 Application Windows
+
+ The most important classes in the Qt GUI module are QGuiApplication and
+ QWindow. A Qt application that wants to show content on screen has to use
+ these. QGuiApplication contains the main event loop, where all events from
+ the window system and other sources are processed and dispatched. It also
+ handles the application's initialization and finalization.
+
+ The \l QWindow class represents a window in the underlying windowing system.
+ It provides a number of virtual functions to handle events (\l {QEvent})
+ from the windowing system, such as touch-input, exposure, focus, key
+ strokes, and geometry changes.
+
+ \section1 2D Graphics
+
+ The Qt GUI module contains classes for 2D graphics, imaging, fonts,
+ and advanced typography.
+
+ A \l QWindow created with the surface type \l {QSurface::RasterSurface} can
+ be used in combination with \l {QBackingStore} and \l {QPainter}, Qt's
+ highly optimized 2D vector graphics API. QPainter supports drawing lines,
+ polygons, vector paths, images, and text. For more information, see \l{Paint
+ System} and \l {Raster Window Example}.
+
+ Qt can load and save images using the \l QImage and \l QPixmap classes. By
+ default, Qt supports the most common image formats including JPEG and PNG
+ among others. Users can add support for additional formats via the \l
+ QImageIOPlugin class. For more information, see \l {Reading and Writing
+ Image Files}.
+
+ Typography in Qt is done with \l QTextDocument, which uses the \l QPainter
+ API in combination with Qt's font classes, primarily QFont. Applications
+ that prefer more low-level APIs to text and font handling can use classes
+ like QRawFont and QGlyphRun.
+
+ \section1 RHI Graphics
+
+ The Qt Rendering Hardware Interface is an abstraction for hardware accelerated
+ graphics APIs, such as, \l{https://www.khronos.org/opengl/}{OpenGL},
+ \l{https://www.khronos.org/opengles/}{OpenGL ES},
+ \l{https://docs.microsoft.com/en-us/windows/desktop/direct3d}{Direct3D},
+ \l{https://developer.apple.com/metal/}{Metal}, and
+ \l{https://www.khronos.org/vulkan/}{Vulkan}.
+
+ As an alternative to using OpenGL or Vulkan directly to render to a
+ QWindow, \l QRhi and the related classes provide a portable, cross-platform
+ 3D graphics and compute API complemented by a shader conditioning and
+ transpiling pipeline. This way applications can avoid directly depending on
+ a single, and, in some cases, vendor or platform-specific 3D API.
+
+ Below is a list of the main RHI-related classes. These are complemented by
+ a number of additional classes and structs.
+
+ \list
+ \li QRhi
+ \li QShader
+ \li QShaderDescription
+ \li QRhiCommandBuffer
+ \li QRhiResourceUpdateBatch
+ \li QRhiBuffer
+ \li QRhiRenderBuffer
+ \li QRhiTexture
+ \li QRhiSampler
+ \li QRhiTextureRenderTarget
+ \li QRhiShaderResourceBindings
+ \li QRhiGraphicsPipeline
+ \li QRhiComputePipeline
+ \li QRhiSwapChain
+ \endlist
+
+ See the \l{RHI Window Example} for an introductory example of creating a
+ portable, cross-platform application that performs accelerated 3D rendering
+ onto a QWindow using QRhi.
+
+ Working directly with QWindow is the most advanced and often the most
+ flexible way of rendering with the QRhi API. It is the most low-level
+ approach, however, and limited in the sense that Qt's UI technologies,
+ widgets and Qt Quick, are not utilized at all. In many cases applications
+ will rather want to integrate QRhi-based rendering into a widget or Qt
+ Quick-based user interface. QWidget-based applications may choose to embed
+ the window as a native child into the widget hierarchy via
+ QWidget::createWindowContainer(), but in many cases \l QRhiWidget will
+ offer a more convenient enabler to integrate QRhi-based rendering into a
+ widget UI. Qt Quick provides its own set of enablers for extending the
+ 2D/3D scene with QRhi-based custom rendering.
+
+ \note The RHI family of APIs are currently offered with a limited
+ compatibility guarantee, as opposed to regular Qt public APIs. See \l QRhi
+ for details.
+
+ \section1 3D Matrix and Vector Math
+
+ The Qt GUI module also contains a few math classes to aid with the most
+ common mathematical operations related to 3D graphics. These classes
+ include \l {QMatrix4x4}, \l {QVector2D}, \l {QVector3D}, \l {QVector4D},
+ and \l {QQuaternion}.
+
+ \section1 OpenGL and OpenGL ES Integration
+
+ QWindow supports rendering using OpenGL and OpenGL ES, depending on what the
+ platform supports. OpenGL rendering is enabled by setting the QWindow's
+ surface type to QSurface::OpenGLSurface, choosing the format attributes with
+ QSurfaceFormat, and then creating a QOpenGLContext to manage the native
+ OpenGL context. In addition, Qt has QOpenGLPaintDevice, which enables the
+ use of OpenGL accelerated QPainter rendering, as well as convenience classes
+ that simplify the writing of OpenGL code and hides the complexities of
+ extension handling and the differences between OpenGL ES 2 and desktop
+ OpenGL. The convenience classes include QOpenGLFunctions that lets an
+ application use all the OpenGL ES 2 functions on desktop OpenGL without
+ having to manually resolve the OpenGL function pointers. This enables
+ cross-platform development of applications targeting mobile or embedded
+ devices, and provides classes that wrap native OpenGL functionality in a
+ simpler Qt API:
+
+ \list
+ \li QOpenGLBuffer
+ \li QOpenGLFramebufferObject
+ \li QOpenGLShaderProgram
+ \li QOpenGLTexture
+ \li QOpenGLDebugLogger
+ \li QOpenGLTimerQuery
+ \li QOpenGLVertexArrayObject
+ \endlist
+
+ Finally, to provide better support for the newer versions (3.0 and
+ higher) of OpenGL, a versioned function wrapper mechanism is also available:
+ The QOpenGLFunction_N_N family of classes expose all the functions in a
+ given OpenGL version and profile, allowing easy development of desktop
+ applications that rely on modern, desktop-only OpenGL features.
+
+ For more information, see the \l {OpenGL Window Example}.
+
+ A \l {QWindow} created with the \l {QSurface::OpenGLSurface} can be used in
+ combination with \l QPainter and \l QOpenGLPaintDevice to have OpenGL
+ hardware-accelerated 2D graphics by sacrificing some of the visual quality.
+
+ \section1 Vulkan Integration
+
+ Qt GUI has support for the \l {Vulkan} API. Qt applications require the
+ presence of the \l{LunarG Vulkan SDK}.
+
+ On Windows, the SDK sets the environment variable \c {VULKAN_SDK},
+ which will be detected by the \c {configure} script.
+
+ On Android, Vulkan headers were added in API level 24 of the NDK.
+
+ The main relevant classes for low-level Vulkan support are:
+
+ \list
+ \li QVulkanInstance
+ \li QVulkanFunctions
+ \li QVulkanDeviceFunctions
+ \endlist
+
+ In addition, \l QVulkanWindow provides a convenience subclass of QWindow
+ that makes it easier to get started with implementing Vulkan-based
+ rendering targeting a QWindow. Using this helper class is completely
+ optional; applications with more advanced Vulkan-based renderers may
+ instead want to use a QWindow with the \l {QSurface::VulkanSurface} type
+ directly.
+
+ For more information, see the \l{Hello Vulkan Widget Example}
+ and the \l {Hello Vulkan Triangle Example}.
+
+ \section1 Drag and Drop
+
+ Qt GUI includes support for drag and drop. The \l{Drag and Drop} overview
+ has more information.
+*/
diff --git a/src/gui/doc/src/qtgui.qdoc b/src/gui/doc/src/qtgui.qdoc
index c4e7d32de1..2a1d69d4d3 100644
--- a/src/gui/doc/src/qtgui.qdoc
+++ b/src/gui/doc/src/qtgui.qdoc
@@ -1,45 +1,34 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the documentation of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:FDL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Free Documentation License Usage
-** Alternatively, this file may be used under the terms of the GNU Free
-** Documentation License version 1.3 as published by the Free Software
-** Foundation and appearing in the file included in the packaging of
-** this file. Please review the following information to ensure
-** the GNU Free Documentation License version 1.3 requirements
-** will be met: https://www.gnu.org/licenses/fdl-1.3.html.
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2022 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GFDL-1.3-no-invariants-only
/*!
\module QtGui
\title Qt GUI C++ Classes
\ingroup modules
+ \qtcmakepackage Gui
\qtvariable gui
\brief The Qt GUI module provides the basic enablers for graphical
applications written with Qt.
- The Qt GUI module provides classes for windowing system
- integration, event handling, OpenGL and OpenGL ES integration,
- Vulkan integration, 2D graphics, imaging, fonts and typography.
- These classes are used internally by Qt's user interface technologies
- and can also be used directly, for instance to write applications using
- low-level OpenGL ES graphics APIs.
+ The \l{Qt GUI} page contains information about how to use the module.
+*/
+
+/*!
+ \module QtGuiPrivate
+ \title Qt GUI Private C++ Classes
+ \qtcmakepackage Gui
+ \qtvariable gui-private
+
+ \brief Provides access to private GUI functionality.
+
+ Use the following CMake commands in your \c {CMakeLists.txt} to access
+ private Qt GUI APIs:
+
+ \badcode
+ find_package(Qt6 REQUIRED COMPONENTS Gui)
+ target_link_libraries(mytarget PRIVATE Qt6::GuiPrivate)
+ \endcode
*/
/*!
@@ -48,21 +37,24 @@
The Qt GUI module provides classes for windowing system
integration, event handling, OpenGL and OpenGL ES integration, 2D
- graphics, basic imaging, fonts and text. These classes are used
- internally by Qt's user interface technologies and can also be
- used directly, for instance to write applications using low-level
+ graphics, basic imaging, fonts, and text. These classes are used
+ internally by Qt's user interface technologies but can also be
+ used directly, for example to write applications using low-level
OpenGL ES graphics APIs.
For application developers writing user interfaces, Qt provides
- higher level API's, like Qt Quick, that are much more suitable
+ higher level APIs, like Qt Quick, that are much more suitable
than the enablers found in the Qt GUI module.
\if !defined(qtforpython)
- \include module-use.qdocinc using qt module
- \quotefile overview/using-qt-gui.cmake
+ \section1 Using the Module
+
+ \include {module-use.qdocinc} {using the c++ api}
+
+ \section2 Building with CMake
- See also the \l[QtDoc]{Building with CMake} overview.
+ \include {module-use.qdocinc} {building with cmake} {Gui}
\section2 Building with qmake
@@ -72,131 +64,42 @@
\snippet code/doc_src_qtgui.pro 1
\endif
- \section1 Application Windows
-
- The most important classes in the Qt GUI module are
- QGuiApplication and QWindow. A Qt application that wants to show
- content on screen, will need to make use of these. QGuiApplication
- contains the main event loop, where all events from the window
- system and other sources are processed and dispatched. It also
- handles the application's initialization and finalization.
-
- The \l QWindow class represents a window in the underlying
- windowing system. It provides a number of virtual functions to
- handle events (\l {QEvent}) from the windowing system, such as
- touch-input, exposure, focus, key strokes and geometry changes.
-
-
-
- \section1 2D Graphics
-
- The Qt GUI module contains classes for 2D graphics, imaging, fonts
- and advanced typography.
-
- A \l QWindow created with the surface type \l
- {QSurface::RasterSurface} can be used in combination with \l
- {QBackingStore} and \l {QPainter}, Qt's highly optimized 2D vector
- graphics API. QPainter supports drawing lines, polygons, vector
- paths, images and text. For more information, see \l{Paint
- System} and \l {Raster Window Example}.
-
- Qt can load and save images using the \l QImage and \l QPixmap
- classes. By default, Qt supports the most common image formats
- including JPEG and PNG among others. Users can add support for
- additional formats via the \l QImageIOPlugin class. For more
- information, see \l {Reading and Writing Image Files}
-
- Typography in Qt is done with \l QTextDocument which uses the \l
- QPainter API in combination with Qt's font classes, primarily
- QFont. Applications that prefer more low-level APIs to text
- and font handling, classes like QRawFont and QGlyphRun can be
- used.
-
-
-
- \section1 OpenGL and OpenGL ES Integration
-
- QWindow supports rendering using OpenGL and OpenGL ES, depending
- on what the platform supports. OpenGL rendering is enabled by
- setting the QWindow's surface type to QSurface::OpenGLSurface,
- choosing the format attributes with QSurfaceFormat, and then
- creating a QOpenGLContext to manage the native OpenGL context. In
- addition, Qt has QOpenGLPaintDevice, which enables the use of
- OpenGL accelerated QPainter rendering, as well as convenience
- classes that simplify the writing of OpenGL code and hides the
- complexities of extension handling and the differences between
- OpenGL ES 2 and desktop OpenGL. The convenience classes include
- QOpenGLFunctions that lets an application use all the OpenGL ES 2
- functions on desktop OpenGL without having to manually resolve the
- OpenGL function pointers, thus allowing cross-platform development
- of applications targeting mobile or embedded devices, and some
- classes that wrap native OpenGL functionality in a simpler Qt API:
+ \section1 Articles and Guides
\list
- \li QOpenGLBuffer
- \li QOpenGLFramebufferObject
- \li QOpenGLShaderProgram
- \li QOpenGLTexture
- \li QOpenGLDebugLogger
- \li QOpenGLTimerQuery
- \li QOpenGLVertexArrayObject
+ \li \l {Qt GUI Overview}
+ \list
+ \li \l {Application Windows} {Qt GUI Application Windows}
+ \li \l {2D Graphics} {Qt GUI 2D Graphics}
+ \li \l {RHI Graphics} {Qt GUI Accelerated 2D and 3D Graphics using the Qt RHI}
+ \li \l {3D Matrix and Vector Math} {Qt GUI Matrix and Vector Math}
+ \li \l {OpenGL and OpenGL ES Integration}
+ {Qt GUI OpenGL and OpenGL ES Integration}
+ \li \l {Vulkan Integration} {Qt GUI Vulkan Integration}
+ \endlist
\endlist
- Finally, in order to provide better support for the newer versions
- (3.0 and higher) of OpenGL, a versioned function wrapper mechanism
- is also available: The QOpenGLFunction_N_N family of classes
- expose all the functions in a given OpenGL version and profile,
- allowing easy development of desktop applications relying on
- modern, desktop-only OpenGL features.
-
- For more information, see the \l {OpenGL Window Example}.
-
- The Qt GUI module also contains a few math classes to aid with the
- most common mathmatical operations related to 3D graphics. These
- classes include \l {QMatrix4x4}, \l {QVector4D} and \l {QQuaternion}
-
- A \l {QWindow} created with the \l {QSurface::OpenGLSurface} can
- be used in combination with \l QPainter and \l QOpenGLPaintDevice
- to have OpenGL hardware accelerated 2D graphics, by sacrificing
- some of the visual quality.
-
-
-
- \section1 Vulkan Integration
-
- Qt 5.10 added support for \l {Vulkan}. This requires
- the presence of the \l{LunarG Vulkan SDK}.
-
- On Windows, the SDK sets the environment variable \c {VULKAN_SDK},
- which will be detected by the \c {configure} script.
-
- On Android, Vulkan headers were added in API level 24 of the NDK.
-
- Relevant classes:
+ \section1 Reference
\list
- \li QVulkanDeviceFunctions
- \li QVulkanExtension
- \li QVulkanFunctions
- \li QVulkanInfoVector
- \li QVulkanInstance
- \li QVulkanWindow
- \li QVulkanWindowRenderer
+ \li \l{Qt GUI C++ Classes}
+ \list
+ \li \l{Event Classes}
+ \li \l{Painting Classes}
+ \li \l{Rendering in 3D}
+ \endlist
\endlist
- For more information, see the \l{Hello Vulkan Widget Example}
- and the \l {Hello Vulkan Window Example}.
+ \section1 Module Evolution
- \section1 Drag and Drop
-
- More info in \l{Drag and Drop}
+ \l{Changes to Qt GUI} lists important changes in the module API
+ and functionality that were done for the Qt 6 series of Qt.
\section1 Licenses and Attributions
Qt GUI is available under commercial licenses from \l{The Qt Company}.
- In addition, it is available under free software licenses. Since Qt 5.4,
- these free software licenses are
- \l{GNU Lesser General Public License, version 3}, or
+ In addition, it is available under free software licenses:
+ The \l{GNU Lesser General Public License, version 3}, or
the \l{GNU General Public License, version 2}.
See \l{Qt Licensing} for further details.
@@ -204,14 +107,4 @@
modules under following permissive licenses:
\generatelist{groupsbymodule attributions-qtgui}
-
- \section1 Reference
- \list
- \li \l{Qt GUI C++ Classes}
- \list
- \li \l{Event Classes}
- \li \l{Painting Classes}
- \li \l{Rendering in 3D}
- \endlist
- \endlist
*/
diff --git a/src/gui/doc/src/richtext.qdoc b/src/gui/doc/src/richtext.qdoc
index 24fd4240b3..10d9962850 100644
--- a/src/gui/doc/src/richtext.qdoc
+++ b/src/gui/doc/src/richtext.qdoc
@@ -1,29 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the documentation of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:FDL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Free Documentation License Usage
-** Alternatively, this file may be used under the terms of the GNU Free
-** Documentation License version 1.3 as published by the Free Software
-** Foundation and appearing in the file included in the packaging of
-** this file. Please review the following information to ensure
-** the GNU Free Documentation License version 1.3 requirements
-** will be met: https://www.gnu.org/licenses/fdl-1.3.html.
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GFDL-1.3-no-invariants-only
/*!
\group richtext-processing
@@ -35,10 +11,9 @@
\page richtext.html
\title Rich Text Processing
\brief An overview of Qt's rich text processing, editing and display features.
-
+ \ingroup explanations-ui
\ingroup frameworks-technologies
\ingroup qt-basic-concepts
- \ingroup best-practices
\nextpage Rich Text Document Structure
@@ -83,7 +58,6 @@
/*!
\page richtext-structure.html
- \contentspage richtext.html Contents
\previouspage Rich Text Processing
\nextpage The QTextCursor Interface
@@ -180,8 +154,7 @@
We obtain the root frame in the following manner:
- \snippet textdocument-frames/xmlwriter.h 0
- \snippet textdocument-frames/xmlwriter.cpp 0
+ \snippet textdocument-frames/mainwindow.cpp rootframe
When navigating the document structure, it is useful to begin at the
root frame because it provides access to the entire document structure.
@@ -267,8 +240,7 @@
child frames. We can inspect the contents of a frame by using a
QTextFrame::iterator to traverse the frame's child elements:
- \snippet textdocument-frames/xmlwriter.cpp 1
- \snippet textdocument-frames/xmlwriter.cpp 2
+ \snippet textdocument-frames/mainwindow.cpp 4
Note that the iterator selects both frames and blocks, so it is necessary
to check which it is referring to. This allows us to navigate the document
@@ -292,8 +264,7 @@
document, we can test whether it represents a table, and deal with it in a
different way:
- \snippet textdocument-tables/xmlwriter.cpp 0
- \snippet textdocument-tables/xmlwriter.cpp 1
+ \snippet textdocument-tables/mainwindow.cpp 13
The cells within an existing table can be examined by iterating through
the rows and columns.
@@ -349,7 +320,6 @@
/*!
\page richtext-cursor.html
- \contentspage richtext.html Contents
\previouspage Rich Text Document Structure
\nextpage Document Layouts
@@ -656,7 +626,6 @@
/*!
\page richtext-layouts.html
- \contentspage richtext.html Contents
\previouspage The QTextCursor Interface
\nextpage Common Rich Text Editing Tasks
@@ -707,7 +676,6 @@
/*!
\page richtext-common-tasks.html
- \contentspage richtext.html Contents
\previouspage Document Layouts
\nextpage Advanced Rich Text Processing
@@ -800,7 +768,6 @@
/*!
\page richtext-advanced-processing.html
- \contentspage richtext.html Contents
\previouspage Common Rich Text Editing Tasks
\nextpage Supported HTML Subset
@@ -849,7 +816,6 @@
\title Supported HTML Subset
\brief Describes the support for HTML markup in text widgets.
- \contentspage richtext.html Contents
\previouspage Common Rich Text Editing Tasks
Qt's text widgets are able to display rich text, specified using a subset of \l {http://www.w3.org/TR/html401/}{HTML 4}
@@ -872,7 +838,11 @@
\section1 Supported Tags
The following table lists the HTML tags supported by Qt's
- \l{Rich Text Processing}{rich text} engine:
+ \l{Rich Text Processing}{rich text} engine.
+
+ \note The functionality implemented for tags listed below is a subset of
+ the full HTML 4 specification. Not all attributes are supported,
+ see comments for each tag.
\table 70%
\header \li Tag
@@ -1197,16 +1167,16 @@
\li none | dotted | dashed | dot-dash | dot-dot-dash | solid | double | groove | ridge | inset | outset
\li Border style for text tables and table cells.
\row \li \c border-top-style
- \li <color>
+ \li <border-style>
\li Top border style for table cells.
\row \li \c border-bottom-style
- \li <color>
+ \li <border-style>
\li Bottom border style for table cells.
\row \li \c border-left-style
- \li <color>
+ \li <border-style>
\li Left border style for table cells.
\row \li \c border-right-style
- \li <color>
+ \li <border-style>
\li Right border style for table cells.
\row \li \c border-width
\li <width>px
@@ -1269,6 +1239,55 @@
\row \li \c word-spacing
\li <width>px
\li Specifies an alternate spacing between each word.
+ \row \li \c line-height
+ \li <number>[% | px | pt | cm]
+ \li Specifies the height of a line. It can be one of the
+ following:
+ \list
+ \li fixed line height in pixels, points, or centimeters.
+ \li a percentage of the current font size.
+ \endlist
+ \endtable
+
+ \section1 Qt-specific CSS properties
+
+ Besides the standard CSS properties listed earlier, the following
+ Qt-specific properties can also be used to style a text block:
+
+ \table
+ \header \li Property
+ \li Values
+ \li Description
+ \row
+ \li \c -qt-block-indent
+ \li \c <number>
+ \li Indents the text block by the specified no. spaces.
+ \row
+ \li \c -qt-list-indent
+ \li \c <number>
+ \li Indents the list items by the specified no. of spaces.
+ \row
+ \li \c -qt-list-number-prefix
+ \li \c <string>
+ \li Prefixes the given string to list number in an HTML ordered list.
+ \row
+ \li \c -qt-list-number-suffix
+ \li <string>
+ \li Suffixes the given string to list number in an HTML ordered list.
+ \row
+ \li \c -qt-paragraph-type
+ \li \c empty
+ \li Hides the text block.
+ \row
+ \li \c -qt-table-type
+ \li \c{root | frame}
+ \li \c root renders the text blocks inline without borders and
+ indentation, whereas \c frame renders them on a new line
+ with a frame around.
+ \row
+ \li \c -qt-user-state
+ \li \c <number>
+ \li Adds it as user data for the text block.
\endtable
\section1 Supported CSS Selectors
diff --git a/src/gui/gui.pro b/src/gui/gui.pro
deleted file mode 100644
index 350d4c5ee3..0000000000
--- a/src/gui/gui.pro
+++ /dev/null
@@ -1,102 +0,0 @@
-TARGET = QtGui
-QT = core-private
-
-qtConfig(opengl.*): MODULE_CONFIG = opengl
-
-DEFINES += QT_NO_USING_NAMESPACE QT_NO_FOREACH
-
-QMAKE_DOCS = $$PWD/doc/qtgui.qdocconf
-
-MODULE_PLUGIN_TYPES = \
- platforms \
- platforms/darwin \
- xcbglintegrations \
- platformthemes \
- platforminputcontexts \
- generic \
- iconengines \
- imageformats \
- egldeviceintegrations
-
-# This is here only because the platform plugin is no module, obviously.
-qtConfig(angle) {
- MODULE_AUX_INCLUDES = \
- \$\$QT_MODULE_INCLUDE_BASE/QtANGLE
-}
-
-# Code coverage with TestCocoon
-# The following is required as extra compilers use $$QMAKE_CXX instead of $(CXX).
-# Without this, testcocoon.prf is read only after $$QMAKE_CXX is used by the
-# extra compilers.
-testcocoon {
- load(testcocoon)
-}
-
-osx: LIBS_PRIVATE += -framework AppKit
-darwin: LIBS_PRIVATE += -framework CoreGraphics
-
-CONFIG += simd optimize_full
-
-include(accessible/accessible.pri)
-include(kernel/kernel.pri)
-include(image/image.pri)
-include(text/text.pri)
-include(painting/painting.pri)
-include(util/util.pri)
-include(math3d/math3d.pri)
-include(opengl/opengl.pri)
-qtConfig(animation): include(animation/animation.pri)
-include(itemmodels/itemmodels.pri)
-include(vulkan/vulkan.pri)
-include(platform/platform.pri)
-include(rhi/rhi.pri)
-
-QMAKE_LIBS += $$QMAKE_LIBS_GUI
-
-load(qt_module)
-load(cmake_functions)
-
-win32: CMAKE_WINDOWS_BUILD = True
-
-qtConfig(angle) {
- CMAKE_GL_INCDIRS = $$CMAKE_INCLUDE_DIR
- CMAKE_ANGLE_EGL_DLL_RELEASE = libEGL.dll
- CMAKE_ANGLE_EGL_IMPLIB_RELEASE = libEGL.$${QMAKE_EXTENSION_STATICLIB}
- CMAKE_ANGLE_GLES2_DLL_RELEASE = libGLESv2.dll
- CMAKE_ANGLE_GLES2_IMPLIB_RELEASE = libGLESv2.$${QMAKE_EXTENSION_STATICLIB}
- CMAKE_ANGLE_EGL_DLL_DEBUG = libEGLd.dll
- CMAKE_ANGLE_EGL_IMPLIB_DEBUG = libEGLd.$${QMAKE_EXTENSION_STATICLIB}
- CMAKE_ANGLE_GLES2_DLL_DEBUG = libGLESv2d.dll
- CMAKE_ANGLE_GLES2_IMPLIB_DEBUG = libGLESv2d.$${QMAKE_EXTENSION_STATICLIB}
-
- CMAKE_QT_OPENGL_IMPLEMENTATION = GLESv2
-} else {
- qtConfig(egl) {
- CMAKE_EGL_LIBS = $$cmakeProcessLibs($$QMAKE_LIBS_EGL)
- !isEmpty(QMAKE_LIBDIR_EGL): CMAKE_EGL_LIBDIR += $$cmakeTargetPath($$QMAKE_LIBDIR_EGL)
- }
-
- qtConfig(opengles2) {
- !isEmpty(QMAKE_INCDIR_OPENGL_ES2): CMAKE_GL_INCDIRS = $$cmakeTargetPaths($$QMAKE_INCDIR_OPENGL_ES2)
- CMAKE_OPENGL_INCDIRS = $$cmakePortablePaths($$QMAKE_INCDIR_OPENGL_ES2)
- CMAKE_OPENGL_LIBS = $$cmakeProcessLibs($$QMAKE_LIBS_OPENGL_ES2)
- !isEmpty(QMAKE_LIBDIR_OPENGL_ES2): CMAKE_OPENGL_LIBDIR = $$cmakePortablePaths($$QMAKE_LIBDIR_OPENGL_ES2)
- CMAKE_GL_HEADER_NAME = GLES2/gl2.h
- CMAKE_QT_OPENGL_IMPLEMENTATION = GLESv2
- } else: qtConfig(opengl) {
- !isEmpty(QMAKE_INCDIR_OPENGL): CMAKE_GL_INCDIRS = $$cmakeTargetPaths($$QMAKE_INCDIR_OPENGL)
- CMAKE_OPENGL_INCDIRS = $$cmakePortablePaths($$QMAKE_INCDIR_OPENGL)
- !qtConfig(dynamicgl): CMAKE_OPENGL_LIBS = $$cmakeProcessLibs($$QMAKE_LIBS_OPENGL)
- !isEmpty(QMAKE_LIBDIR_OPENGL): CMAKE_OPENGL_LIBDIR = $$cmakePortablePaths($$QMAKE_LIBDIR_OPENGL)
- CMAKE_GL_HEADER_NAME = GL/gl.h
- mac: CMAKE_GL_HEADER_NAME = gl.h
- CMAKE_QT_OPENGL_IMPLEMENTATION = GL
- }
-}
-
-qtConfig(egl): CMAKE_EGL_INCDIRS = $$cmakePortablePaths($$QMAKE_INCDIR_EGL)
-
-QMAKE_DYNAMIC_LIST_FILE = $$PWD/QtGui.dynlist
-
-TRACEPOINT_PROVIDER = $$PWD/qtgui.tracepoints
-CONFIG += qt_tracepoints metatypes install_metatypes
diff --git a/src/gui/image/image.pri b/src/gui/image/image.pri
deleted file mode 100644
index 760b737ec3..0000000000
--- a/src/gui/image/image.pri
+++ /dev/null
@@ -1,102 +0,0 @@
-# -*-mode:sh-*-
-# Qt image handling
-
-# Qt kernel module
-
-HEADERS += \
- image/qbitmap.h \
- image/qimage.h \
- image/qimage_p.h \
- image/qimageiohandler.h \
- image/qimagereader.h \
- image/qimagereaderwriterhelpers_p.h \
- image/qimagewriter.h \
- image/qpaintengine_pic_p.h \
- image/qpicture.h \
- image/qpicture_p.h \
- image/qpixmap.h \
- image/qpixmap_raster_p.h \
- image/qpixmap_blitter_p.h \
- image/qpixmapcache.h \
- image/qpixmapcache_p.h \
- image/qplatformpixmap.h \
- image/qimagepixmapcleanuphooks_p.h \
- image/qicon.h \
- image/qicon_p.h \
- image/qiconloader_p.h \
- image/qiconengine.h \
- image/qiconengineplugin.h \
-
-SOURCES += \
- image/qbitmap.cpp \
- image/qimage.cpp \
- image/qimage_conversions.cpp \
- image/qimageiohandler.cpp \
- image/qimagereader.cpp \
- image/qimagereaderwriterhelpers.cpp \
- image/qimagewriter.cpp \
- image/qpaintengine_pic.cpp \
- image/qpicture.cpp \
- image/qpixmap.cpp \
- image/qpixmapcache.cpp \
- image/qplatformpixmap.cpp \
- image/qpixmap_raster.cpp \
- image/qpixmap_blitter.cpp \
- image/qimagepixmapcleanuphooks.cpp \
- image/qicon.cpp \
- image/qiconloader.cpp \
- image/qiconengine.cpp \
- image/qiconengineplugin.cpp \
-
-qtConfig(movie) {
- HEADERS += image/qmovie.h
- SOURCES += image/qmovie.cpp
-}
-
-win32:!winrt: SOURCES += image/qpixmap_win.cpp
-
-darwin: OBJECTIVE_SOURCES += image/qimage_darwin.mm
-
-# Built-in image format support
-HEADERS += \
- image/qbmphandler_p.h \
- image/qppmhandler_p.h \
- image/qxbmhandler_p.h \
- image/qxpmhandler_p.h
-
-SOURCES += \
- image/qbmphandler.cpp \
- image/qppmhandler.cpp \
- image/qxbmhandler.cpp \
- image/qxpmhandler.cpp
-
-qtConfig(png) {
- HEADERS += image/qpnghandler_p.h
- SOURCES += image/qpnghandler.cpp
- QMAKE_USE_PRIVATE += libpng
-
- win32:mingw {
- # https://gcc.gnu.org/bugzilla/show_bug.cgi?id=86048
- GCC_VERSION = "$${QMAKE_GCC_MAJOR_VERSION}.$${QMAKE_GCC_MINOR_VERSION}.$${QMAKE_GCC_PATCH_VERSION}"
- equals(GCC_VERSION, "8.1.0") {
- QMAKE_CXXFLAGS += -fno-reorder-blocks-and-partition
- }
- }
-}
-
-# SIMD
-!android {
- SSSE3_SOURCES += image/qimage_ssse3.cpp
- NEON_SOURCES += image/qimage_neon.cpp
- MIPS_DSPR2_SOURCES += image/qimage_mips_dspr2.cpp
- MIPS_DSPR2_ASM += image/qimage_mips_dspr2_asm.S
-} else {
- # see https://developer.android.com/ndk/guides/abis
- arm64-v8a {
- SOURCES += image/qimage_neon.cpp
- }
- x86 | x86_64 {
- DEFINES += QT_COMPILER_SUPPORTS_SSE2 QT_COMPILER_SUPPORTS_SSE3 QT_COMPILER_SUPPORTS_SSSE3
- SOURCES += image/qimage_ssse3.cpp
- }
-}
diff --git a/src/gui/image/qabstractfileiconengine.cpp b/src/gui/image/qabstractfileiconengine.cpp
new file mode 100644
index 0000000000..ffbe088d20
--- /dev/null
+++ b/src/gui/image/qabstractfileiconengine.cpp
@@ -0,0 +1,101 @@
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
+
+#include "qabstractfileiconengine_p.h"
+
+#include <qpixmapcache.h>
+
+QT_BEGIN_NAMESPACE
+
+using namespace Qt::StringLiterals;
+
+/*!
+ \class QAbstractFileIconEngine
+ \brief Helper base class for retrieving icons for files for usage by QFileIconProvider and related.
+
+ Reimplement availableSizes() and new virtual filePixmap() and return icons created
+ with this engine from QPlatformTheme::fileIcon().
+
+ Note: The class internally caches pixmaps for files by suffix (with the exception
+ of some files on Windows), but not for directories (since directory icons may have
+ overlay icons on Windows). You might want to cache pixmaps for directories
+ in your implementation.
+
+ \since 5.8
+ \internal
+ \sa QFileIconProvider::DontUseCustomDirectoryIcons, QPlatformTheme
+ \ingroup qpa
+*/
+QPixmap QAbstractFileIconEngine::pixmap(const QSize &size, QIcon::Mode mode,
+ QIcon::State state)
+{
+ Q_UNUSED(mode);
+ Q_UNUSED(state);
+
+ if (!size.isValid())
+ return QPixmap();
+
+ QString key = cacheKey();
+ if (key.isEmpty())
+ return filePixmap(size, mode, state);
+
+ key += u'_' + QString::number(size.width());
+
+ QPixmap result;
+ if (!QPixmapCache::find(key, &result)) {
+ result = filePixmap(size, mode, state);
+ if (!result.isNull())
+ QPixmapCache::insert(key, result);
+ }
+
+ return result;
+}
+
+QPixmap QAbstractFileIconEngine::scaledPixmap(const QSize &size, QIcon::Mode mode, QIcon::State state, qreal scale)
+{
+ Q_UNUSED(scale); // (size is pre-multiplied by scale)
+ return pixmap(size, mode, state);
+}
+
+QSize QAbstractFileIconEngine::actualSize(const QSize &size, QIcon::Mode mode,
+ QIcon::State state)
+{
+ const QList<QSize> &sizes = availableSizes(mode, state);
+ const int numberSizes = sizes.size();
+ if (numberSizes == 0)
+ return QSize();
+
+ // Find the smallest available size whose area is still larger than the input
+ // size. Otherwise, use the largest area available size. (We don't assume the
+ // platform theme sizes are sorted, hence the extra logic.)
+ const int sizeArea = size.width() * size.height();
+ QSize actualSize = sizes.first();
+ int actualArea = actualSize.width() * actualSize.height();
+ for (int i = 1; i < numberSizes; ++i) {
+ const QSize &s = sizes.at(i);
+ const int a = s.width() * s.height();
+ if ((sizeArea <= a && a < actualArea) || (actualArea < sizeArea && actualArea < a)) {
+ actualSize = s;
+ actualArea = a;
+ }
+ }
+
+ if (!actualSize.isNull() && (actualSize.width() > size.width() || actualSize.height() > size.height()))
+ actualSize.scale(size, Qt::KeepAspectRatio);
+
+ return actualSize;
+}
+
+/* Reimplement to return a cache key for the entry. An empty result indicates
+ * the icon should not be cached (for example, directory icons having custom icons). */
+QString QAbstractFileIconEngine::cacheKey() const
+{
+ if (!m_fileInfo.isFile() || m_fileInfo.isSymLink() || m_fileInfo.isExecutable())
+ return QString();
+
+ const QString &suffix = m_fileInfo.suffix();
+ return "qt_."_L1
+ + (suffix.isEmpty() ? m_fileInfo.fileName() : suffix); // handle "Makefile" ;)
+}
+
+QT_END_NAMESPACE
diff --git a/src/gui/image/qabstractfileiconengine_p.h b/src/gui/image/qabstractfileiconengine_p.h
new file mode 100644
index 0000000000..99d16d3224
--- /dev/null
+++ b/src/gui/image/qabstractfileiconengine_p.h
@@ -0,0 +1,62 @@
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
+
+#ifndef QABSTRACTFILEICONENGINE_P_H
+#define QABSTRACTFILEICONENGINE_P_H
+
+//
+// W A R N I N G
+// -------------
+//
+// This file is not part of the Qt API. It exists purely as an
+// implementation detail. This header file may change from version to
+// version without notice, or even be removed.
+//
+// We mean it.
+//
+
+#include <QtCore/qfileinfo.h>
+#include <private/qicon_p.h>
+#include <qpa/qplatformtheme.h>
+
+QT_BEGIN_NAMESPACE
+
+class Q_GUI_EXPORT QAbstractFileIconEngine : public QPixmapIconEngine
+{
+public:
+ explicit QAbstractFileIconEngine(const QFileInfo &info, QPlatformTheme::IconOptions opts)
+ : QPixmapIconEngine(), m_fileInfo(info), m_options(opts) {}
+
+ QPixmap pixmap(const QSize &size, QIcon::Mode mode, QIcon::State) override;
+ QPixmap scaledPixmap(const QSize &size, QIcon::Mode mode, QIcon::State, qreal scale) override;
+ QSize actualSize(const QSize &size, QIcon::Mode mode, QIcon::State state) override;
+ bool isNull() override { return false; }
+
+ QFileInfo fileInfo() const { return m_fileInfo; }
+ QPlatformTheme::IconOptions options() const { return m_options; }
+
+ // Helper to convert a sequence of ints to a list of QSize
+ template <class It> static QList<QSize> toSizeList(It i1, It i2);
+
+protected:
+ virtual QPixmap filePixmap(const QSize &size, QIcon::Mode mode, QIcon::State) = 0;
+ virtual QString cacheKey() const;
+
+private:
+ const QFileInfo m_fileInfo;
+ const QPlatformTheme::IconOptions m_options;
+};
+
+template <class It>
+inline QList<QSize> QAbstractFileIconEngine::toSizeList(It i1, It i2)
+{
+ QList<QSize> result;
+ result.reserve(int(i2 - i1));
+ for ( ; i1 != i2; ++i1)
+ result.append(QSize(*i1, *i1));
+ return result;
+}
+
+QT_END_NAMESPACE
+
+#endif // QABSTRACTFILEICONENGINE_P_H
diff --git a/src/gui/image/qabstractfileiconprovider.cpp b/src/gui/image/qabstractfileiconprovider.cpp
new file mode 100644
index 0000000000..71b6a0b03d
--- /dev/null
+++ b/src/gui/image/qabstractfileiconprovider.cpp
@@ -0,0 +1,280 @@
+// Copyright (C) 2020 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
+
+#include "qabstractfileiconprovider.h"
+
+#include <qguiapplication.h>
+#include <private/qguiapplication_p.h>
+#include <qpa/qplatformtheme.h>
+#include <qicon.h>
+#if QT_CONFIG(mimetype)
+#include <qmimedatabase.h>
+#endif
+
+
+#include <private/qabstractfileiconprovider_p.h>
+#include <private/qfilesystementry_p.h>
+
+QT_BEGIN_NAMESPACE
+
+using namespace Qt::StringLiterals;
+
+QAbstractFileIconProviderPrivate::QAbstractFileIconProviderPrivate(QAbstractFileIconProvider *q)
+ : q_ptr(q)
+{}
+
+QAbstractFileIconProviderPrivate::~QAbstractFileIconProviderPrivate() = default;
+
+using IconTypeCache = QHash<QAbstractFileIconProvider::IconType, QIcon>;
+Q_GLOBAL_STATIC(IconTypeCache, iconTypeCache)
+
+void QAbstractFileIconProviderPrivate::clearIconTypeCache()
+{
+ iconTypeCache()->clear();
+}
+
+QIcon QAbstractFileIconProviderPrivate::getPlatformThemeIcon(QAbstractFileIconProvider::IconType type) const
+{
+ auto theme = QGuiApplicationPrivate::platformTheme();
+ if (theme == nullptr)
+ return {};
+
+ auto &cache = *iconTypeCache();
+ auto it = cache.find(type);
+ if (it == cache.end()) {
+ const auto sp = [&]() -> QPlatformTheme::StandardPixmap {
+ switch (type) {
+ case QAbstractFileIconProvider::Computer:
+ return QPlatformTheme::ComputerIcon;
+ case QAbstractFileIconProvider::Desktop:
+ return QPlatformTheme::DesktopIcon;
+ case QAbstractFileIconProvider::Trashcan:
+ return QPlatformTheme::TrashIcon;
+ case QAbstractFileIconProvider::Network:
+ return QPlatformTheme::DriveNetIcon;
+ case QAbstractFileIconProvider::Drive:
+ return QPlatformTheme::DriveHDIcon;
+ case QAbstractFileIconProvider::Folder:
+ return QPlatformTheme::DirIcon;
+ case QAbstractFileIconProvider::File:
+ break;
+ // no default on purpose; we want warnings when the type enum is extended
+ }
+ return QPlatformTheme::FileIcon;
+ }();
+
+ const auto sizesHint = theme->themeHint(QPlatformTheme::IconPixmapSizes);
+ auto sizes = sizesHint.value<QList<QSize>>();
+ if (sizes.isEmpty())
+ sizes.append({64, 64});
+
+ QIcon icon;
+ for (const auto &size : sizes)
+ icon.addPixmap(theme->standardPixmap(sp, size));
+ it = cache.insert(type, icon);
+ }
+ return it.value();
+}
+
+QIcon QAbstractFileIconProviderPrivate::getIconThemeIcon(QAbstractFileIconProvider::IconType type) const
+{
+ switch (type) {
+ case QAbstractFileIconProvider::Computer:
+ return QIcon::fromTheme("computer"_L1);
+ case QAbstractFileIconProvider::Desktop:
+ return QIcon::fromTheme("user-desktop"_L1);
+ case QAbstractFileIconProvider::Trashcan:
+ return QIcon::fromTheme("user-trash"_L1);
+ case QAbstractFileIconProvider::Network:
+ return QIcon::fromTheme("network-workgroup"_L1);
+ case QAbstractFileIconProvider::Drive:
+ return QIcon::fromTheme("drive-harddisk"_L1);
+ case QAbstractFileIconProvider::Folder:
+ return QIcon::fromTheme("folder"_L1);
+ case QAbstractFileIconProvider::File:
+ return QIcon::fromTheme("text-x-generic"_L1);
+ // no default on purpose; we want warnings when the type enum is extended
+ }
+ return QIcon::fromTheme("text-x-generic"_L1);
+}
+
+static inline QPlatformTheme::IconOptions toThemeIconOptions(QAbstractFileIconProvider::Options options)
+{
+ QPlatformTheme::IconOptions result;
+ if (options.testFlag(QAbstractFileIconProvider::DontUseCustomDirectoryIcons))
+ result |= QPlatformTheme::DontUseCustomDirectoryIcons;
+ return result;
+}
+
+QIcon QAbstractFileIconProviderPrivate::getPlatformThemeIcon(const QFileInfo &info) const
+{
+ if (auto theme = QGuiApplicationPrivate::platformTheme())
+ return theme->fileIcon(info, toThemeIconOptions(options));
+ return {};
+}
+
+QIcon QAbstractFileIconProviderPrivate::getIconThemeIcon(const QFileInfo &info) const
+{
+ if (info.isRoot())
+ return getIconThemeIcon(QAbstractFileIconProvider::Drive);
+ if (info.isDir())
+ return getIconThemeIcon(QAbstractFileIconProvider::Folder);
+#if QT_CONFIG(mimetype)
+ return QIcon::fromTheme(mimeDatabase.mimeTypeForFile(info).iconName());
+#else
+ return QIcon::fromTheme("text-x-generic"_L1);
+#endif
+}
+
+/*!
+ \class QAbstractFileIconProvider
+
+ \inmodule QtGui
+ \since 6.0
+
+ \brief The QAbstractFileIconProvider class provides file icons for the QFileSystemModel class.
+*/
+
+/*!
+ \enum QAbstractFileIconProvider::IconType
+
+ \value Computer The icon used for the computing device as a whole
+ \value Desktop The icon for the special "Desktop" directory of the user
+ \value Trashcan The icon for the user's "Trash" place in the desktop's file manager
+ \value Network The icon for the “Network Servers” place in the desktop's file manager,
+ and workgroups within the network
+ \value Drive The icon used for disk drives
+ \value Folder The standard folder icon used to represent directories on local filesystems
+ \value File The icon used for generic text file types
+*/
+
+/*!
+ \enum QAbstractFileIconProvider::Option
+
+ \value DontUseCustomDirectoryIcons Always use the default directory icon.
+ Some platforms allow the user to set a different icon. Custom icon lookup
+ cause a big performance impact over network or removable drives.
+*/
+
+/*!
+ Constructs a file icon provider.
+*/
+QAbstractFileIconProvider::QAbstractFileIconProvider()
+ : d_ptr(new QAbstractFileIconProviderPrivate(this))
+{
+}
+
+/*!
+ \internal
+*/
+QAbstractFileIconProvider::QAbstractFileIconProvider(QAbstractFileIconProviderPrivate &dd)
+ : d_ptr(&dd)
+{}
+
+/*!
+ Destroys the file icon provider.
+*/
+
+QAbstractFileIconProvider::~QAbstractFileIconProvider() = default;
+
+
+/*!
+ Sets \a options that affect the icon provider.
+ \sa options()
+*/
+
+void QAbstractFileIconProvider::setOptions(QAbstractFileIconProvider::Options options)
+{
+ Q_D(QAbstractFileIconProvider);
+ d->options = options;
+}
+
+/*!
+ Returns all the options that affect the icon provider.
+ By default, all options are disabled.
+ \sa setOptions()
+*/
+
+QAbstractFileIconProvider::Options QAbstractFileIconProvider::options() const
+{
+ Q_D(const QAbstractFileIconProvider);
+ return d->options;
+}
+
+/*!
+ Returns an icon set for the given \a type, using the current
+ icon theme.
+
+ \sa QIcon::fromTheme
+*/
+
+QIcon QAbstractFileIconProvider::icon(IconType type) const
+{
+ Q_D(const QAbstractFileIconProvider);
+ const QIcon result = d->getIconThemeIcon(type);
+ return result.isNull() ? d->getPlatformThemeIcon(type) : result;
+}
+
+/*!
+ Returns an icon for the file described by \a info, using the
+ current icon theme.
+
+ \sa QIcon::fromTheme
+*/
+
+QIcon QAbstractFileIconProvider::icon(const QFileInfo &info) const
+{
+ Q_D(const QAbstractFileIconProvider);
+ const QIcon result = d->getIconThemeIcon(info);
+ return result.isNull() ? d->getPlatformThemeIcon(info) : result;
+}
+
+
+QString QAbstractFileIconProviderPrivate::getFileType(const QFileInfo &info)
+{
+ if (QFileSystemEntry::isRootPath(info.absoluteFilePath()))
+ return QGuiApplication::translate("QAbstractFileIconProvider", "Drive");
+ if (info.isFile()) {
+#if QT_CONFIG(mimetype)
+ const QMimeType mimeType = QMimeDatabase().mimeTypeForFile(info);
+ return mimeType.comment().isEmpty() ? mimeType.name() : mimeType.comment();
+#else
+ return QGuiApplication::translate("QAbstractFileIconProvider", "File");
+#endif
+ }
+
+ if (info.isDir())
+#ifdef Q_OS_WIN
+ return QGuiApplication::translate("QAbstractFileIconProvider", "File Folder", "Match Windows Explorer");
+#else
+ return QGuiApplication::translate("QAbstractFileIconProvider", "Folder", "All other platforms");
+#endif
+ // Windows - "File Folder"
+ // macOS - "Folder"
+ // Konqueror - "Folder"
+ // Nautilus - "folder"
+
+ if (info.isSymLink())
+#ifdef Q_OS_MACOS
+ return QGuiApplication::translate("QAbstractFileIconProvider", "Alias", "macOS Finder");
+#else
+ return QGuiApplication::translate("QAbstractFileIconProvider", "Shortcut", "All other platforms");
+#endif
+ // macOS - "Alias"
+ // Windows - "Shortcut"
+ // Konqueror - "Folder" or "TXT File" i.e. what it is pointing to
+ // Nautilus - "link to folder" or "link to object file", same as Konqueror
+
+ return QGuiApplication::translate("QAbstractFileIconProvider", "Unknown");
+}
+
+/*!
+ Returns the type of the file described by \a info.
+*/
+
+QString QAbstractFileIconProvider::type(const QFileInfo &info) const
+{
+ return QAbstractFileIconProviderPrivate::getFileType(info);
+}
+
+QT_END_NAMESPACE
diff --git a/src/gui/image/qabstractfileiconprovider.h b/src/gui/image/qabstractfileiconprovider.h
new file mode 100644
index 0000000000..df5f642521
--- /dev/null
+++ b/src/gui/image/qabstractfileiconprovider.h
@@ -0,0 +1,48 @@
+// Copyright (C) 2020 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
+
+#ifndef QABSTRACTFILEICONPROVIDER_H
+#define QABSTRACTFILEICONPROVIDER_H
+
+#include <QtGui/qtguiglobal.h>
+#include <QtCore/qfileinfo.h>
+#include <QtCore/qscopedpointer.h>
+#include <QtGui/qicon.h>
+
+QT_BEGIN_NAMESPACE
+
+class QAbstractFileIconProviderPrivate;
+
+class Q_GUI_EXPORT QAbstractFileIconProvider
+{
+public:
+ enum IconType { Computer, Desktop, Trashcan, Network, Drive, Folder, File };
+ enum Option {
+ DontUseCustomDirectoryIcons = 0x00000001
+ };
+ Q_DECLARE_FLAGS(Options, Option)
+
+ QAbstractFileIconProvider();
+ virtual ~QAbstractFileIconProvider();
+
+ virtual QIcon icon(IconType) const;
+ virtual QIcon icon(const QFileInfo &) const;
+ virtual QString type(const QFileInfo &) const;
+
+ virtual void setOptions(Options);
+ virtual Options options() const;
+
+protected:
+ QAbstractFileIconProvider(QAbstractFileIconProviderPrivate &dd);
+ QScopedPointer<QAbstractFileIconProviderPrivate> d_ptr;
+
+private:
+ Q_DECLARE_PRIVATE(QAbstractFileIconProvider)
+ Q_DISABLE_COPY(QAbstractFileIconProvider)
+};
+
+Q_DECLARE_OPERATORS_FOR_FLAGS(QAbstractFileIconProvider::Options)
+
+QT_END_NAMESPACE
+
+#endif // QABSTRACTFILEICONPROVIDER_H
diff --git a/src/gui/image/qabstractfileiconprovider_p.h b/src/gui/image/qabstractfileiconprovider_p.h
new file mode 100644
index 0000000000..f53be0f06c
--- /dev/null
+++ b/src/gui/image/qabstractfileiconprovider_p.h
@@ -0,0 +1,52 @@
+// Copyright (C) 2020 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
+
+#ifndef QABSTRACTFILEICONPROVIDER_P_H
+#define QABSTRACTFILEICONPROVIDER_P_H
+
+//
+// W A R N I N G
+// -------------
+//
+// This file is not part of the Qt API. It exists purely as an
+// implementation detail. This header file may change from version to
+// version without notice, or even be removed.
+//
+// We mean it.
+//
+
+#include <QtGui/private/qtguiglobal_p.h>
+#if QT_CONFIG(mimetype)
+#include <QtCore/QMimeDatabase>
+#endif
+#include "qabstractfileiconprovider.h"
+
+QT_BEGIN_NAMESPACE
+
+class Q_GUI_EXPORT QAbstractFileIconProviderPrivate
+{
+ Q_DECLARE_PUBLIC(QAbstractFileIconProvider)
+
+public:
+ QAbstractFileIconProviderPrivate(QAbstractFileIconProvider *q);
+ virtual ~QAbstractFileIconProviderPrivate();
+
+ QIcon getPlatformThemeIcon(QAbstractFileIconProvider::IconType type) const;
+ QIcon getIconThemeIcon(QAbstractFileIconProvider::IconType type) const;
+ QIcon getPlatformThemeIcon(const QFileInfo &info) const;
+ QIcon getIconThemeIcon(const QFileInfo &info) const;
+
+ static void clearIconTypeCache();
+ static QString getFileType(const QFileInfo &info);
+
+ QAbstractFileIconProvider *q_ptr = nullptr;
+ QAbstractFileIconProvider::Options options = {};
+
+#if QT_CONFIG(mimetype)
+ QMimeDatabase mimeDatabase;
+#endif
+};
+
+QT_END_NAMESPACE
+
+#endif // QABSTRACTFILEICONPROVIDER_P_H
diff --git a/src/gui/image/qbitmap.cpp b/src/gui/image/qbitmap.cpp
index 455045eb57..2208cca1be 100644
--- a/src/gui/image/qbitmap.cpp
+++ b/src/gui/image/qbitmap.cpp
@@ -1,41 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the QtGui module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#include "qbitmap.h"
#include <qpa/qplatformpixmap.h>
@@ -46,6 +10,8 @@
#include <qpainter.h>
#include <private/qguiapplication_p.h>
+#include <memory>
+
QT_BEGIN_NAMESPACE
/*!
@@ -114,44 +80,36 @@ QBitmap::QBitmap()
\sa clear()
*/
-
QBitmap::QBitmap(int w, int h)
: QPixmap(QSize(w, h), QPlatformPixmap::BitmapType)
{
}
/*!
+ \deprecated [6.0] Use fromPixmap instead.
+
Constructs a bitmap with the given \a size. The pixels in the
bitmap are uninitialized.
\sa clear()
*/
-
QBitmap::QBitmap(const QSize &size)
: QPixmap(size, QPlatformPixmap::BitmapType)
{
}
/*!
- \fn QBitmap::clear()
-
- Clears the bitmap, setting all its bits to Qt::color0.
+ \internal
+ This dtor must stay empty until Qt 7 (was inline until 6.2).
*/
+QBitmap::~QBitmap() = default;
/*!
- Constructs a bitmap that is a copy of the given \a pixmap.
-
- If the pixmap has a depth greater than 1, the resulting bitmap
- will be dithered automatically.
+ \fn QBitmap::clear()
- \sa QPixmap::depth(), fromImage(), fromData()
+ Clears the bitmap, setting all its bits to Qt::color0.
*/
-QBitmap::QBitmap(const QPixmap &pixmap)
-{
- QBitmap::operator=(pixmap);
-}
-
/*!
Constructs a bitmap from the file specified by the given \a
fileName. If the file does not exist, or has an unknown format,
@@ -163,7 +121,6 @@ QBitmap::QBitmap(const QPixmap &pixmap)
\sa QPixmap::isNull(), QImageReader::imageFormat()
*/
-
QBitmap::QBitmap(const QString& fileName, const char *format)
: QPixmap(QSize(0, 0), QPlatformPixmap::BitmapType)
{
@@ -171,41 +128,6 @@ QBitmap::QBitmap(const QString& fileName, const char *format)
}
/*!
- \overload
-
- Assigns the given \a pixmap to this bitmap and returns a reference
- to this bitmap.
-
- If the pixmap has a depth greater than 1, the resulting bitmap
- will be dithered automatically.
-
- \sa QPixmap::depth()
- */
-
-QBitmap &QBitmap::operator=(const QPixmap &pixmap)
-{
- if (pixmap.isNull()) { // a null pixmap
- QBitmap(0, 0).swap(*this);
- } else if (pixmap.depth() == 1) { // 1-bit pixmap
- QPixmap::operator=(pixmap); // shallow assignment
- } else { // n-bit depth pixmap
- *this = fromImage(pixmap.toImage()); // will dither image
- }
- return *this;
-}
-
-#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
-
-/*!
- Destroys the bitmap.
-*/
-QBitmap::~QBitmap()
-{
-}
-
-#endif
-
-/*!
\fn void QBitmap::swap(QBitmap &other)
\since 4.8
@@ -218,7 +140,7 @@ QBitmap::~QBitmap()
*/
QBitmap::operator QVariant() const
{
- return QVariant(QVariant::Bitmap, this);
+ return QVariant::fromValue(*this);
}
static QBitmap makeBitmap(QImage &&image, Qt::ImageConversionFlags flags)
@@ -233,10 +155,10 @@ static QBitmap makeBitmap(QImage &&image, Qt::ImageConversionFlags flags)
image.setColor(1, c0);
}
- QScopedPointer<QPlatformPixmap> data(QGuiApplicationPrivate::platformIntegration()->createPlatformPixmap(QPlatformPixmap::BitmapType));
+ std::unique_ptr<QPlatformPixmap> data(QGuiApplicationPrivate::platformIntegration()->createPlatformPixmap(QPlatformPixmap::BitmapType));
data->fromImageInPlace(image, flags | Qt::MonoOnly);
- return QPixmap(data.take());
+ return QBitmap::fromPixmap(QPixmap(data.release()));
}
/*!
@@ -274,7 +196,7 @@ QBitmap QBitmap::fromImage(QImage &&image, Qt::ImageConversionFlags flags)
Constructs a bitmap with the given \a size, and sets the contents to
the \a bits supplied.
- The bitmap data has to be byte aligned and provided in in the bit
+ The bitmap data has to be byte aligned and provided in the bit
order specified by \a monoFormat. The mono format must be either
QImage::Format_Mono or QImage::Format_MonoLSB. Use
QImage::Format_Mono to specify data on the XBM format.
@@ -290,7 +212,7 @@ QBitmap QBitmap::fromData(const QSize &size, const uchar *bits, QImage::Format m
image.setColor(0, QColor(Qt::color0).rgb());
image.setColor(1, QColor(Qt::color1).rgb());
- // Need to memcpy each line separatly since QImage is 32bit aligned and
+ // Need to memcpy each line separately since QImage is 32bit aligned and
// this data is only byte aligned...
int bytesPerLine = (size.width() + 7) / 8;
for (int y = 0; y < size.height(); ++y)
@@ -299,29 +221,76 @@ QBitmap QBitmap::fromData(const QSize &size, const uchar *bits, QImage::Format m
}
/*!
- Returns a copy of this bitmap, transformed according to the given
- \a matrix.
+ Returns a copy of the given \a pixmap converted to a bitmap.
- \sa QPixmap::transformed()
- */
-QBitmap QBitmap::transformed(const QTransform &matrix) const
+ If the pixmap has a depth greater than 1, the resulting bitmap
+ will be dithered automatically.
+
+ \since 6.0
+
+ \sa QPixmap::depth()
+*/
+
+QBitmap QBitmap::fromPixmap(const QPixmap &pixmap)
{
- QBitmap bm = QPixmap::transformed(matrix);
- return bm;
+ if (pixmap.isNull()) { // a null pixmap
+ return QBitmap(0, 0);
+ } else if (pixmap.depth() == 1) { // 1-bit pixmap
+ QBitmap bm;
+ if (pixmap.paintingActive()) { // make a deep copy
+ pixmap.copy().swap(bm);
+ } else {
+ bm.data = pixmap.data; // shallow assignment
+ }
+ return bm;
+ }
+ // n-bit depth pixmap, will dither image
+ return fromImage(pixmap.toImage());
}
-#if QT_DEPRECATED_SINCE(5, 13)
+#if QT_DEPRECATED_SINCE(6, 0)
/*!
- \overload
- \obsolete
+ \deprecated [6.0] Use fromPixmap instead.
+ Constructs a bitmap that is a copy of the given \a pixmap.
+
+ If the pixmap has a depth greater than 1, the resulting bitmap
+ will be dithered automatically.
- This convenience function converts the \a matrix to a QTransform
- and calls the overloaded function.
+ \sa QPixmap::depth(), fromImage(), fromData()
*/
-QBitmap QBitmap::transformed(const QMatrix &matrix) const
+QBitmap::QBitmap(const QPixmap &pixmap)
+{
+ *this = QBitmap::fromPixmap(pixmap);
+}
+
+/*!
+ \deprecated [6.0] Use fromPixmap instead.
+ \overload
+
+ Assigns the given \a pixmap to this bitmap and returns a reference
+ to this bitmap.
+
+ If the pixmap has a depth greater than 1, the resulting bitmap
+ will be dithered automatically.
+
+ \sa QPixmap::depth()
+ */
+QBitmap &QBitmap::operator=(const QPixmap &pixmap)
{
- return transformed(QTransform(matrix));
+ *this = QBitmap::fromPixmap(pixmap);
+ return *this;
}
#endif
+/*!
+ Returns a copy of this bitmap, transformed according to the given
+ \a matrix.
+
+ \sa QPixmap::transformed()
+ */
+QBitmap QBitmap::transformed(const QTransform &matrix) const
+{
+ return QBitmap::fromPixmap(QPixmap::transformed(matrix));
+}
+
QT_END_NAMESPACE
diff --git a/src/gui/image/qbitmap.h b/src/gui/image/qbitmap.h
index 3cc360f670..77d276ab14 100644
--- a/src/gui/image/qbitmap.h
+++ b/src/gui/image/qbitmap.h
@@ -1,41 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the QtGui module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#ifndef QBITMAP_H
#define QBITMAP_H
@@ -52,20 +16,17 @@ class Q_GUI_EXPORT QBitmap : public QPixmap
{
public:
QBitmap();
- QBitmap(const QPixmap &);
+#if QT_DEPRECATED_SINCE(6, 0)
+ QT_DEPRECATED_VERSION_X_6_0("Use fromPixmap instead.") explicit QBitmap(const QPixmap &);
+#endif
QBitmap(int w, int h);
explicit QBitmap(const QSize &);
explicit QBitmap(const QString &fileName, const char *format = nullptr);
- // ### Qt 6: don't inherit QPixmap
-#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
- QBitmap(const QBitmap &other) : QPixmap(other) {}
- // QBitmap(QBitmap &&other) : QPixmap(std::move(other)) {} // QPixmap doesn't, yet, have a move ctor
- QBitmap &operator=(const QBitmap &other) { QPixmap::operator=(other); return *this; }
- QBitmap &operator=(QBitmap &&other) noexcept { QPixmap::operator=(std::move(other)); return *this; }
- ~QBitmap();
-#endif
+ ~QBitmap() override;
- QBitmap &operator=(const QPixmap &);
+#if QT_DEPRECATED_SINCE(6, 0)
+ QT_DEPRECATED_VERSION_X_6_0("Use fromPixmap instead.") QBitmap &operator=(const QPixmap &);
+#endif
inline void swap(QBitmap &other) { QPixmap::swap(other); } // prevent QBitmap<->QPixmap swaps
operator QVariant() const;
@@ -75,11 +36,8 @@ public:
static QBitmap fromImage(QImage &&image, Qt::ImageConversionFlags flags = Qt::AutoColor);
static QBitmap fromData(const QSize &size, const uchar *bits,
QImage::Format monoFormat = QImage::Format_MonoLSB);
+ static QBitmap fromPixmap(const QPixmap &pixmap);
-#if QT_DEPRECATED_SINCE(5, 13)
- QT_DEPRECATED_X("Use QBitmap::transformed(QTransform) instead")
- QBitmap transformed(const QMatrix &) const;
-#endif
QBitmap transformed(const QTransform &matrix) const;
typedef QExplicitlySharedDataPointer<QPlatformPixmap> DataPtr;
diff --git a/src/gui/image/qbmphandler.cpp b/src/gui/image/qbmphandler.cpp
index 32b6131309..798ba7f4b3 100644
--- a/src/gui/image/qbmphandler.cpp
+++ b/src/gui/image/qbmphandler.cpp
@@ -1,49 +1,13 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the QtGui module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#include "private/qbmphandler_p.h"
#ifndef QT_NO_IMAGEFORMAT_BMP
#include <qimage.h>
+#include <qlist.h>
#include <qvariant.h>
-#include <qvector.h>
QT_BEGIN_NAMESPACE
@@ -104,6 +68,7 @@ const int BMP_RGB = 0; // no compression
const int BMP_RLE8 = 1; // run-length encoded, 8 bits
const int BMP_RLE4 = 2; // run-length encoded, 4 bits
const int BMP_BITFIELDS = 3; // RGB values encoded in data as bit-fields
+const int BMP_ALPHABITFIELDS = 4; // RGBA values encoded in data as bit-fields
static QDataStream &operator>>(QDataStream &s, BMP_INFOHDR &bi)
@@ -147,19 +112,65 @@ static QDataStream &operator<<(QDataStream &s, const BMP_INFOHDR &bi)
s << bi.biSizeImage;
s << bi.biXPelsPerMeter << bi.biYPelsPerMeter;
s << bi.biClrUsed << bi.biClrImportant;
+
+ if (bi.biSize >= BMP_WIN4) {
+ s << bi.biRedMask << bi.biGreenMask << bi.biBlueMask << bi.biAlphaMask;
+ s << bi.biCSType;
+
+ for (int i = 0; i < 9; i++)
+ s << bi.biEndpoints[i];
+
+ s << bi.biGammaRed;
+ s << bi.biGammaGreen;
+ s << bi.biGammaBlue;
+ }
+
+ if (bi.biSize >= BMP_WIN5) {
+ s << bi.biIntent;
+ s << bi.biProfileData;
+ s << bi.biProfileSize;
+ s << bi.biReserved;
+ }
+
return s;
}
-static int calc_shift(uint mask)
+static uint calc_shift(uint mask)
{
- int result = 0;
- while (mask && !(mask & 1)) {
+ uint result = 0;
+ while ((mask >= 0x100) || (!(mask & 1) && mask)) {
result++;
mask >>= 1;
}
return result;
}
+static uint calc_scale(uint low_mask)
+{
+ uint result = 8;
+ while (low_mask && result) {
+ result--;
+ low_mask >>= 1;
+ }
+ return result;
+}
+
+static inline uint apply_scale(uint value, uint scale)
+{
+ if (!(scale & 0x07)) // return immediately if scale == 8 or 0
+ return value;
+
+ uint filled = 8 - scale;
+ uint result = value << scale;
+
+ do {
+ result |= result >> filled;
+ filled <<= 1;
+ } while (filled < 8);
+
+ return result;
+}
+
static bool read_dib_fileheader(QDataStream &s, BMP_FILEHDR &bf)
{
// read BMP file header
@@ -188,19 +199,21 @@ static bool read_dib_infoheader(QDataStream &s, BMP_INFOHDR &bi)
if (!(comp == BMP_RGB || (nbits == 4 && comp == BMP_RLE4) ||
(nbits == 8 && comp == BMP_RLE8) || ((nbits == 16 || nbits == 32) && comp == BMP_BITFIELDS)))
return false; // weird compression type
+ if (bi.biHeight == INT_MIN)
+ return false; // out of range for positive int
if (bi.biWidth <= 0 || !bi.biHeight || quint64(bi.biWidth) * qAbs(bi.biHeight) > 16384 * 16384)
return false;
return true;
}
-static bool read_dib_body(QDataStream &s, const BMP_INFOHDR &bi, qint64 offset, qint64 startpos, QImage &image)
+static bool read_dib_body(QDataStream &s, const BMP_INFOHDR &bi, qint64 datapos, qint64 startpos, QImage &image)
{
QIODevice* d = s.device();
if (d->atEnd()) // end of stream/file
return false;
#if 0
- qDebug("offset...........%lld", offset);
+ qDebug("offset...........%lld", datapos);
qDebug("startpos.........%lld", startpos);
qDebug("biSize...........%d", bi.biSize);
qDebug("biWidth..........%d", bi.biWidth);
@@ -220,33 +233,38 @@ static bool read_dib_body(QDataStream &s, const BMP_INFOHDR &bi, qint64 offset,
uint green_mask = 0;
uint blue_mask = 0;
uint alpha_mask = 0;
- int red_shift = 0;
- int green_shift = 0;
- int blue_shift = 0;
- int alpha_shift = 0;
- int red_scale = 0;
- int green_scale = 0;
- int blue_scale = 0;
- int alpha_scale = 0;
+ uint red_shift = 0;
+ uint green_shift = 0;
+ uint blue_shift = 0;
+ uint alpha_shift = 0;
+ uint red_scale = 0;
+ uint green_scale = 0;
+ uint blue_scale = 0;
+ uint alpha_scale = 0;
+ bool bitfields = comp == BMP_BITFIELDS || comp == BMP_ALPHABITFIELDS;
if (!d->isSequential())
- d->seek(startpos + BMP_FILEHDR_SIZE + bi.biSize); // goto start of colormap or masks
+ d->seek(startpos + bi.biSize); // goto start of colormap or masks
if (bi.biSize >= BMP_WIN4) {
red_mask = bi.biRedMask;
green_mask = bi.biGreenMask;
blue_mask = bi.biBlueMask;
alpha_mask = bi.biAlphaMask;
- } else if (comp == BMP_BITFIELDS && (nbits == 16 || nbits == 32)) {
+ } else if (bitfields && (nbits == 16 || nbits == 32)) {
if (d->read((char *)&red_mask, sizeof(red_mask)) != sizeof(red_mask))
return false;
if (d->read((char *)&green_mask, sizeof(green_mask)) != sizeof(green_mask))
return false;
if (d->read((char *)&blue_mask, sizeof(blue_mask)) != sizeof(blue_mask))
return false;
+ if (comp == BMP_ALPHABITFIELDS && d->read((char *)&alpha_mask, sizeof(alpha_mask)) != sizeof(alpha_mask))
+ return false;
}
- bool transp = (comp == BMP_BITFIELDS) && alpha_mask;
+ bool transp = bitfields || (comp == BMP_RGB && nbits == 32 && alpha_mask == 0xff000000);
+ transp = transp && alpha_mask;
+
int ncols = 0;
int depth = 0;
QImage::Format format;
@@ -262,9 +280,13 @@ static bool read_dib_body(QDataStream &s, const BMP_INFOHDR &bi, qint64 offset,
depth = 8;
format = QImage::Format_Indexed8;
break;
- default:
+ case 1:
depth = 1;
format = QImage::Format_Mono;
+ break;
+ default:
+ return false;
+ break;
}
if (depth != 32) {
@@ -276,17 +298,8 @@ static bool read_dib_body(QDataStream &s, const BMP_INFOHDR &bi, qint64 offset,
if (bi.biHeight < 0)
h = -h; // support images with negative height
- if (image.size() != QSize(w, h) || image.format() != format) {
- image = QImage(w, h, format);
- if (image.isNull()) // could not create image
- return false;
- if (ncols)
- image.setColorCount(ncols); // Ensure valid QImage
- }
-
- image.setDotsPerMeterX(bi.biXPelsPerMeter);
- image.setDotsPerMeterY(bi.biYPelsPerMeter);
-
+ if (!QImageIOHandler::allocateImage(QSize(w, h), format, &image))
+ return false;
if (ncols > 0) { // read color table
image.setColorCount(ncols);
uchar rgb[4];
@@ -298,23 +311,23 @@ static bool read_dib_body(QDataStream &s, const BMP_INFOHDR &bi, qint64 offset,
if (d->atEnd()) // truncated file
return false;
}
- } else if (comp == BMP_BITFIELDS && (nbits == 16 || nbits == 32)) {
+ } else if (bitfields && (nbits == 16 || nbits == 32)) {
red_shift = calc_shift(red_mask);
if (((red_mask >> red_shift) + 1) == 0)
return false;
- red_scale = 256 / ((red_mask >> red_shift) + 1);
+ red_scale = calc_scale(red_mask >> red_shift);
green_shift = calc_shift(green_mask);
if (((green_mask >> green_shift) + 1) == 0)
return false;
- green_scale = 256 / ((green_mask >> green_shift) + 1);
+ green_scale = calc_scale(green_mask >> green_shift);
blue_shift = calc_shift(blue_mask);
if (((blue_mask >> blue_shift) + 1) == 0)
return false;
- blue_scale = 256 / ((blue_mask >> blue_shift) + 1);
+ blue_scale = calc_scale(blue_mask >> blue_shift);
alpha_shift = calc_shift(alpha_mask);
if (((alpha_mask >> alpha_shift) + 1) == 0)
return false;
- alpha_scale = 256 / ((alpha_mask >> alpha_shift) + 1);
+ alpha_scale = calc_scale(alpha_mask >> alpha_shift);
} else if (comp == BMP_RGB && (nbits == 24 || nbits == 32)) {
blue_mask = 0x000000ff;
green_mask = 0x0000ff00;
@@ -322,19 +335,26 @@ static bool read_dib_body(QDataStream &s, const BMP_INFOHDR &bi, qint64 offset,
blue_shift = 0;
green_shift = 8;
red_shift = 16;
- blue_scale = green_scale = red_scale = 1;
+ blue_scale = green_scale = red_scale = 0;
+ if (transp) {
+ alpha_shift = calc_shift(alpha_mask);
+ if (((alpha_mask >> alpha_shift) + 1) == 0)
+ return false;
+ alpha_scale = calc_scale(alpha_mask >> alpha_shift);
+ }
} else if (comp == BMP_RGB && nbits == 16) {
blue_mask = 0x001f;
green_mask = 0x03e0;
red_mask = 0x7c00;
blue_shift = 0;
- green_shift = 2;
- red_shift = 7;
- red_scale = 1;
- green_scale = 1;
- blue_scale = 8;
+ green_shift = 5;
+ red_shift = 10;
+ blue_scale = green_scale = red_scale = 3;
}
+ image.setDotsPerMeterX(bi.biXPelsPerMeter);
+ image.setDotsPerMeterY(bi.biYPelsPerMeter);
+
#if 0
qDebug("Rmask: %08x Rshift: %08x Rscale:%08x", red_mask, red_shift, red_scale);
qDebug("Gmask: %08x Gshift: %08x Gscale:%08x", green_mask, green_shift, green_scale);
@@ -342,10 +362,9 @@ static bool read_dib_body(QDataStream &s, const BMP_INFOHDR &bi, qint64 offset,
qDebug("Amask: %08x Ashift: %08x Ascale:%08x", alpha_mask, alpha_shift, alpha_scale);
#endif
- // offset can be bogus, be careful
- if (offset>=0 && startpos + offset > d->pos()) {
+ if (datapos >= 0 && datapos > d->pos()) {
if (!d->isSequential())
- d->seek(startpos + offset); // start of image data
+ d->seek(datapos); // start of image data
}
int bpl = image.bytesPerLine();
@@ -538,10 +557,10 @@ static bool read_dib_body(QDataStream &s, const BMP_INFOHDR &bi, qint64 offset,
c |= *(uchar*)(b+2)<<16;
if (nbits > 24)
c |= *(uchar*)(b+3)<<24;
- *p++ = qRgba(((c & red_mask) >> red_shift) * red_scale,
- ((c & green_mask) >> green_shift) * green_scale,
- ((c & blue_mask) >> blue_shift) * blue_scale,
- transp ? ((c & alpha_mask) >> alpha_shift) * alpha_scale : 0xff);
+ *p++ = qRgba(apply_scale((c & red_mask) >> red_shift, red_scale),
+ apply_scale((c & green_mask) >> green_shift, green_scale),
+ apply_scale((c & blue_mask) >> blue_shift, blue_scale),
+ transp ? apply_scale((c & alpha_mask) >> alpha_shift, alpha_scale) : 0xff);
b += nbits/8;
}
}
@@ -563,7 +582,6 @@ static bool read_dib_body(QDataStream &s, const BMP_INFOHDR &bi, qint64 offset,
return true;
}
-// this is also used in qmime_win.cpp
bool qt_write_dib(QDataStream &s, const QImage &image, int bpl, int bpl_bmp, int nbits)
{
QIODevice* d = s.device();
@@ -590,8 +608,8 @@ bool qt_write_dib(QDataStream &s, const QImage &image, int bpl, int bpl_bmp, int
if (image.depth() != 32) { // write color table
uchar *color_table = new uchar[4*image.colorCount()];
uchar *rgb = color_table;
- QVector<QRgb> c = image.colorTable();
- for (int i=0; i<image.colorCount(); i++) {
+ const QList<QRgb> c = image.colorTable();
+ for (int i = 0; i < image.colorCount(); i++) {
*rgb++ = qBlue (c[i]);
*rgb++ = qGreen(c[i]);
*rgb++ = qRed (c[i]);
@@ -650,15 +668,6 @@ bool qt_write_dib(QDataStream &s, const QImage &image, int bpl, int bpl_bmp, int
return true;
}
-// this is also used in qmime_win.cpp
-bool qt_read_dib(QDataStream &s, QImage &image)
-{
- BMP_INFOHDR bi;
- if (!read_dib_infoheader(s, bi))
- return false;
- return read_dib_body(s, bi, -1, -BMP_FILEHDR_SIZE, image);
-}
-
QBmpHandler::QBmpHandler(InternalFormat fmt) :
m_format(fmt), state(Ready)
{
@@ -741,9 +750,32 @@ bool QBmpHandler::read(QImage *image)
s.setByteOrder(QDataStream::LittleEndian);
// read image
+ qint64 datapos = startpos;
+ if (m_format == BmpFormat) {
+ datapos += fileHeader.bfOffBits;
+ } else {
+ // QTBUG-100351: We have no file header when reading dib format so we have to depend on the size of the
+ // buffer and the biSizeImage value to find where the pixel data starts since there's sometimes optional
+ // color mask values after biSize, like for example when pasting from the windows snipping tool.
+ if (infoHeader.biSizeImage > 0 && infoHeader.biSizeImage < d->size()) {
+ datapos = d->size() - infoHeader.biSizeImage;
+ } else {
+ // And sometimes biSizeImage is not filled in like when pasting from Microsoft Edge, so then we just
+ // have to assume the optional color mask values are there.
+ datapos += infoHeader.biSize;
+
+ if (infoHeader.biBitCount == 16 || infoHeader.biBitCount == 32) {
+ if (infoHeader.biCompression == BMP_BITFIELDS) {
+ datapos += 12;
+ } else if (infoHeader.biCompression == BMP_ALPHABITFIELDS) {
+ datapos += 16;
+ }
+ }
+ }
+ }
const bool readSuccess = m_format == BmpFormat ?
- read_dib_body(s, infoHeader, fileHeader.bfOffBits, startpos, *image) :
- read_dib_body(s, infoHeader, -1, startpos - BMP_FILEHDR_SIZE, *image);
+ read_dib_body(s, infoHeader, datapos, startpos + BMP_FILEHDR_SIZE, *image) :
+ read_dib_body(s, infoHeader, datapos, startpos, *image);
if (!readSuccess)
return false;
@@ -777,9 +809,9 @@ bool QBmpHandler::write(const QImage &img)
}
int nbits;
- int bpl_bmp;
+ qsizetype bpl_bmp;
// Calculate a minimum bytes-per-line instead of using whatever value this QImage is using internally.
- int bpl = ((image.width() * image.depth() + 31) >> 5) << 2;
+ qsizetype bpl = ((image.width() * image.depth() + 31) >> 5) << 2;
if (image.depth() == 8 && image.colorCount() <= 16) {
bpl_bmp = (((bpl+1)/2+3)/4)*4;
@@ -791,6 +823,8 @@ bool QBmpHandler::write(const QImage &img)
bpl_bmp = bpl;
nbits = image.depth();
}
+ if (qsizetype(int(bpl_bmp)) != bpl_bmp)
+ return false;
if (m_format == DibFormat) {
QDataStream dibStream(device());
@@ -813,6 +847,8 @@ bool QBmpHandler::write(const QImage &img)
bf.bfReserved2 = 0;
bf.bfOffBits = BMP_FILEHDR_SIZE + BMP_WIN + image.colorCount() * 4;
bf.bfSize = bf.bfOffBits + bpl_bmp*image.height();
+ if (qsizetype(bf.bfSize) != bf.bfOffBits + bpl_bmp*image.height())
+ return false;
s << bf;
// write image
@@ -843,7 +879,7 @@ QVariant QBmpHandler::option(ImageOption option) const
case 32:
case 24:
case 16:
- if (infoHeader.biCompression == BMP_BITFIELDS && infoHeader.biSize >= BMP_WIN4 && infoHeader.biAlphaMask)
+ if ((infoHeader.biCompression == BMP_BITFIELDS || infoHeader.biCompression == BMP_ALPHABITFIELDS) && infoHeader.biSize >= BMP_WIN4 && infoHeader.biAlphaMask)
format = QImage::Format_ARGB32;
else
format = QImage::Format_RGB32;
@@ -866,13 +902,6 @@ void QBmpHandler::setOption(ImageOption option, const QVariant &value)
Q_UNUSED(value);
}
-#if QT_DEPRECATED_SINCE(5, 13)
-QByteArray QBmpHandler::name() const
-{
- return formatName();
-}
-#endif
-
QT_END_NAMESPACE
#endif // QT_NO_IMAGEFORMAT_BMP
diff --git a/src/gui/image/qbmphandler_p.h b/src/gui/image/qbmphandler_p.h
index 33b5b9c501..0ba0946afe 100644
--- a/src/gui/image/qbmphandler_p.h
+++ b/src/gui/image/qbmphandler_p.h
@@ -1,41 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the QtGui module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#ifndef QBMPHANDLER_P_H
#define QBMPHANDLER_P_H
@@ -98,7 +62,7 @@ struct BMP_INFOHDR { // BMP information header
// BMP-Handler, which is also able to read and write the DIB
// (Device-Independent-Bitmap) format used internally in the Windows operating
// system for OLE/clipboard operations. DIB is a subset of BMP (without file
-// header). The Windows-Lighthouse plugin accesses the DIB-functionality.
+// header). The Windows platform plugin accesses the DIB-functionality.
class QBmpHandler : public QImageIOHandler
{
@@ -113,9 +77,6 @@ public:
bool read(QImage *image) override;
bool write(const QImage &image) override;
-#if QT_DEPRECATED_SINCE(5, 13)
- QByteArray name() const override;
-#endif
static bool canRead(QIODevice *device);
QVariant option(ImageOption option) const override;
diff --git a/src/gui/image/qicon.cpp b/src/gui/image/qicon.cpp
index 19be066d23..086ac37a07 100644
--- a/src/gui/image/qicon.cpp
+++ b/src/gui/image/qicon.cpp
@@ -1,42 +1,6 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Copyright (C) 2015 Olivier Goffart <ogoffart@woboq.com>
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the QtGui module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2020 The Qt Company Ltd.
+// Copyright (C) 2015 Olivier Goffart <ogoffart@woboq.com>
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#include "qicon.h"
#include "qicon_p.h"
@@ -61,11 +25,14 @@
#include "private/qhexstring_p.h"
#include "private/qguiapplication_p.h"
+#include "private/qoffsetstringarray_p.h"
#include "qpa/qplatformtheme.h"
#ifndef QT_NO_ICON
QT_BEGIN_NAMESPACE
+using namespace Qt::StringLiterals;
+
/*!
\enum QIcon::Mode
@@ -101,7 +68,7 @@ QT_BEGIN_NAMESPACE
static int nextSerialNumCounter()
{
- static QBasicAtomicInt serial = Q_BASIC_ATOMIC_INITIALIZER(0);
+ Q_CONSTINIT static QBasicAtomicInt serial = Q_BASIC_ATOMIC_INITIALIZER(0);
return 1 + serial.fetchAndAddRelaxed(1);
}
@@ -124,25 +91,6 @@ static void qt_cleanup_icon_cache()
qtIconCache()->clear();
}
-/*! \internal
-
- Returns the effective device pixel ratio, using
- the provided window pointer if possible.
-
- if Qt::AA_UseHighDpiPixmaps is not set this function
- returns 1.0 to keep non-hihdpi aware code working.
-*/
-static qreal qt_effective_device_pixel_ratio(QWindow *window = nullptr)
-{
- if (!qApp->testAttribute(Qt::AA_UseHighDpiPixmaps))
- return qreal(1.0);
-
- if (window)
- return window->devicePixelRatio();
-
- return qApp->devicePixelRatio(); // Don't know which window to target.
-}
-
QIconPrivate::QIconPrivate(QIconEngine *e)
: engine(e), ref(1),
serialNum(nextSerialNumCounter()),
@@ -151,6 +99,11 @@ QIconPrivate::QIconPrivate(QIconEngine *e)
{
}
+void QIconPrivate::clearIconCache()
+{
+ qt_cleanup_icon_cache();
+}
+
/*! \internal
Computes the displayDevicePixelRatio for a pixmap.
@@ -190,21 +143,40 @@ QPixmapIconEngine::~QPixmapIconEngine()
void QPixmapIconEngine::paint(QPainter *painter, const QRect &rect, QIcon::Mode mode, QIcon::State state)
{
- qreal dpr = 1.0;
- if (QCoreApplication::testAttribute(Qt::AA_UseHighDpiPixmaps)) {
- auto paintDevice = painter->device();
- dpr = paintDevice ? paintDevice->devicePixelRatioF() : qApp->devicePixelRatio();
- }
+ auto paintDevice = painter->device();
+ qreal dpr = paintDevice ? paintDevice->devicePixelRatio() : qApp->devicePixelRatio();
const QSize pixmapSize = rect.size() * dpr;
- QPixmap px = pixmap(pixmapSize, mode, state);
+ QPixmap px = scaledPixmap(pixmapSize, mode, state, dpr);
painter->drawPixmap(rect, px);
}
static inline int area(const QSize &s) { return s.width() * s.height(); }
-// returns the smallest of the two that is still larger than or equal to size.
-static QPixmapIconEngineEntry *bestSizeMatch( const QSize &size, QPixmapIconEngineEntry *pa, QPixmapIconEngineEntry *pb)
-{
+// Returns the smallest of the two that is still larger than or equal to size.
+// Pixmaps at the correct scale are preferred, pixmaps at lower scale are
+// used as fallbacks. We assume that the pixmap set is complete, in the sense
+// that no 2x pixmap is going to be a better match than a 3x pixmap for the the
+// target scale of 3 (It's OK if 3x pixmaps are missing - we'll fall back to
+// the 2x pixmaps then.)
+static QPixmapIconEngineEntry *bestSizeScaleMatch(const QSize &size, qreal scale, QPixmapIconEngineEntry *pa, QPixmapIconEngineEntry *pb)
+{
+
+ // scale: we can only differentiate on scale if the scale differs
+ if (pa->scale != pb->scale) {
+
+ // Score the pixmaps: 0 is an exact scale match, positive
+ // scores have more detail than requested, negative scores
+ // have less detail than requested.
+ qreal ascore = pa->scale - scale;
+ qreal bscore = pb->scale - scale;
+
+ // always prefer positive scores to prevent upscaling
+ if ((ascore < 0) != (bscore < 0))
+ return bscore < 0 ? pa : pb;
+ // Take the one closest to 0
+ return (qAbs(ascore) < qAbs(bscore)) ? pa : pb;
+ }
+
int s = area(size);
if (pa->size == QSize() && pa->pixmap.isNull()) {
pa->pixmap = QPixmap(pa->fileName);
@@ -226,13 +198,13 @@ static QPixmapIconEngineEntry *bestSizeMatch( const QSize &size, QPixmapIconEngi
return pb;
}
-QPixmapIconEngineEntry *QPixmapIconEngine::tryMatch(const QSize &size, QIcon::Mode mode, QIcon::State state)
+QPixmapIconEngineEntry *QPixmapIconEngine::tryMatch(const QSize &size, qreal scale, QIcon::Mode mode, QIcon::State state)
{
QPixmapIconEngineEntry *pe = nullptr;
- for (int i = 0; i < pixmaps.count(); ++i)
+ for (int i = 0; i < pixmaps.size(); ++i)
if (pixmaps.at(i).mode == mode && pixmaps.at(i).state == state) {
if (pe)
- pe = bestSizeMatch(size, &pixmaps[i], pe);
+ pe = bestSizeScaleMatch(size, scale, &pixmaps[i], pe);
else
pe = &pixmaps[i];
}
@@ -240,42 +212,42 @@ QPixmapIconEngineEntry *QPixmapIconEngine::tryMatch(const QSize &size, QIcon::Mo
}
-QPixmapIconEngineEntry *QPixmapIconEngine::bestMatch(const QSize &size, QIcon::Mode mode, QIcon::State state, bool sizeOnly)
+QPixmapIconEngineEntry *QPixmapIconEngine::bestMatch(const QSize &size, qreal scale, QIcon::Mode mode, QIcon::State state, bool sizeOnly)
{
- QPixmapIconEngineEntry *pe = tryMatch(size, mode, state);
+ QPixmapIconEngineEntry *pe = tryMatch(size, scale, mode, state);
while (!pe){
QIcon::State oppositeState = (state == QIcon::On) ? QIcon::Off : QIcon::On;
if (mode == QIcon::Disabled || mode == QIcon::Selected) {
QIcon::Mode oppositeMode = (mode == QIcon::Disabled) ? QIcon::Selected : QIcon::Disabled;
- if ((pe = tryMatch(size, QIcon::Normal, state)))
+ if ((pe = tryMatch(size, scale, QIcon::Normal, state)))
break;
- if ((pe = tryMatch(size, QIcon::Active, state)))
+ if ((pe = tryMatch(size, scale, QIcon::Active, state)))
break;
- if ((pe = tryMatch(size, mode, oppositeState)))
+ if ((pe = tryMatch(size, scale, mode, oppositeState)))
break;
- if ((pe = tryMatch(size, QIcon::Normal, oppositeState)))
+ if ((pe = tryMatch(size, scale, QIcon::Normal, oppositeState)))
break;
- if ((pe = tryMatch(size, QIcon::Active, oppositeState)))
+ if ((pe = tryMatch(size, scale, QIcon::Active, oppositeState)))
break;
- if ((pe = tryMatch(size, oppositeMode, state)))
+ if ((pe = tryMatch(size, scale, oppositeMode, state)))
break;
- if ((pe = tryMatch(size, oppositeMode, oppositeState)))
+ if ((pe = tryMatch(size, scale, oppositeMode, oppositeState)))
break;
} else {
QIcon::Mode oppositeMode = (mode == QIcon::Normal) ? QIcon::Active : QIcon::Normal;
- if ((pe = tryMatch(size, oppositeMode, state)))
+ if ((pe = tryMatch(size, scale, oppositeMode, state)))
break;
- if ((pe = tryMatch(size, mode, oppositeState)))
+ if ((pe = tryMatch(size, scale, mode, oppositeState)))
break;
- if ((pe = tryMatch(size, oppositeMode, oppositeState)))
+ if ((pe = tryMatch(size, scale, oppositeMode, oppositeState)))
break;
- if ((pe = tryMatch(size, QIcon::Disabled, state)))
+ if ((pe = tryMatch(size, scale, QIcon::Disabled, state)))
break;
- if ((pe = tryMatch(size, QIcon::Selected, state)))
+ if ((pe = tryMatch(size, scale, QIcon::Selected, state)))
break;
- if ((pe = tryMatch(size, QIcon::Disabled, oppositeState)))
+ if ((pe = tryMatch(size, scale, QIcon::Disabled, oppositeState)))
break;
- if ((pe = tryMatch(size, QIcon::Selected, oppositeState)))
+ if ((pe = tryMatch(size, scale, QIcon::Selected, oppositeState)))
break;
}
@@ -294,13 +266,19 @@ QPixmapIconEngineEntry *QPixmapIconEngine::bestMatch(const QSize &size, QIcon::M
QPixmap QPixmapIconEngine::pixmap(const QSize &size, QIcon::Mode mode, QIcon::State state)
{
+ return scaledPixmap(size, mode, state, 1.0);
+}
+
+QPixmap QPixmapIconEngine::scaledPixmap(const QSize &size, QIcon::Mode mode, QIcon::State state, qreal scale)
+{
+
QPixmap pm;
- QPixmapIconEngineEntry *pe = bestMatch(size, mode, state, false);
+ QPixmapIconEngineEntry *pe = bestMatch(size, scale, mode, state, false);
if (pe)
pm = pe->pixmap;
if (pm.isNull()) {
- int idx = pixmaps.count();
+ int idx = pixmaps.size();
while (--idx >= 0) {
if (pe == &pixmaps.at(idx)) {
pixmaps.remove(idx);
@@ -317,7 +295,7 @@ QPixmap QPixmapIconEngine::pixmap(const QSize &size, QIcon::Mode mode, QIcon::St
if (!actualSize.isNull() && (actualSize.width() > size.width() || actualSize.height() > size.height()))
actualSize.scale(size, Qt::KeepAspectRatio);
- QString key = QLatin1String("qt_")
+ QString key = "qt_"_L1
% HexString<quint64>(pm.cacheKey())
% HexString<uint>(pe ? pe->mode : QIcon::Normal)
% HexString<quint64>(QGuiApplication::palette().cacheKey())
@@ -354,7 +332,13 @@ QPixmap QPixmapIconEngine::pixmap(const QSize &size, QIcon::Mode mode, QIcon::St
QSize QPixmapIconEngine::actualSize(const QSize &size, QIcon::Mode mode, QIcon::State state)
{
QSize actualSize;
- if (QPixmapIconEngineEntry *pe = bestMatch(size, mode, state, true))
+
+ // The returned actual size is the size in device independent pixels,
+ // so we limit the search to scale 1 and assume that e.g. @2x versions
+ // does not proviode extra actual sizes not also provided by the 1x versions.
+ qreal scale = 1;
+
+ if (QPixmapIconEngineEntry *pe = bestMatch(size, scale, mode, state, true))
actualSize = pe->size;
if (actualSize.isNull())
@@ -365,11 +349,27 @@ QSize QPixmapIconEngine::actualSize(const QSize &size, QIcon::Mode mode, QIcon::
return actualSize;
}
+QList<QSize> QPixmapIconEngine::availableSizes(QIcon::Mode mode, QIcon::State state)
+{
+ QList<QSize> sizes;
+ for (QPixmapIconEngineEntry &pe : pixmaps) {
+ if (pe.mode != mode || pe.state != state)
+ continue;
+ if (pe.size.isEmpty() && pe.pixmap.isNull()) {
+ pe.pixmap = QPixmap(pe.fileName);
+ pe.size = pe.pixmap.size();
+ }
+ if (!pe.size.isEmpty() && !sizes.contains(pe.size))
+ sizes.push_back(pe.size);
+ }
+ return sizes;
+}
+
void QPixmapIconEngine::addPixmap(const QPixmap &pixmap, QIcon::Mode mode, QIcon::State state)
{
if (!pixmap.isNull()) {
- QPixmapIconEngineEntry *pe = tryMatch(pixmap.size(), mode, state);
- if(pe && pe->size == pixmap.size()) {
+ QPixmapIconEngineEntry *pe = tryMatch(pixmap.size(), pixmap.devicePixelRatio(), mode, state);
+ if (pe && pe->size == pixmap.size() && pe->scale == pixmap.devicePixelRatio()) {
pe->pixmap = pixmap;
pe->fileName.clear();
} else {
@@ -385,7 +385,7 @@ static inline int origIcoDepth(const QImage &image)
return s.isEmpty() ? 32 : s.toInt();
}
-static inline int findBySize(const QVector<QImage> &images, const QSize &size)
+static inline int findBySize(const QList<QImage> &images, const QSize &size)
{
for (int i = 0; i < images.size(); ++i) {
if (images.at(i).size() == size)
@@ -426,7 +426,7 @@ void QPixmapIconEngine::addFile(const QString &fileName, const QSize &size, QIco
{
if (fileName.isEmpty())
return;
- const QString abs = fileName.startsWith(QLatin1Char(':')) ? fileName : QFileInfo(fileName).absoluteFilePath();
+ const QString abs = fileName.startsWith(u':') ? fileName : QFileInfo(fileName).absoluteFilePath();
const bool ignoreSize = !size.isValid();
ImageReader imageReader(abs);
const QByteArray format = imageReader.format();
@@ -449,7 +449,7 @@ void QPixmapIconEngine::addFile(const QString &fileName, const QSize &size, QIco
// these files may contain low-resolution images. As this information is lost,
// ICOReader sets the original format as an image text key value. Read all matching
// images into a list trying to find the highest quality per size.
- QVector<QImage> icoImages;
+ QList<QImage> icoImages;
while (imageReader.read(&image)) {
if (ignoreSize || image.size() == size) {
const int position = findBySize(icoImages, image.size());
@@ -461,15 +461,20 @@ void QPixmapIconEngine::addFile(const QString &fileName, const QSize &size, QIco
}
}
}
- for (const QImage &i : qAsConst(icoImages))
+ for (const QImage &i : std::as_const(icoImages))
pixmaps += QPixmapIconEngineEntry(abs, i, mode, state);
if (icoImages.isEmpty() && !ignoreSize) // Add placeholder with the filename and empty pixmap for the size.
pixmaps += QPixmapIconEngineEntry(abs, size, mode, state);
}
+bool QPixmapIconEngine::isNull()
+{
+ return pixmaps.isEmpty();
+}
+
QString QPixmapIconEngine::key() const
{
- return QLatin1String("QPixmapIconEngine");
+ return "QPixmapIconEngine"_L1;
}
QIconEngine *QPixmapIconEngine::clone() const
@@ -525,35 +530,12 @@ bool QPixmapIconEngine::write(QDataStream &out) const
return true;
}
-void QPixmapIconEngine::virtual_hook(int id, void *data)
-{
- switch (id) {
- case QIconEngine::AvailableSizesHook: {
- QIconEngine::AvailableSizesArgument &arg =
- *reinterpret_cast<QIconEngine::AvailableSizesArgument*>(data);
- arg.sizes.clear();
- for (int i = 0; i < pixmaps.size(); ++i) {
- QPixmapIconEngineEntry &pe = pixmaps[i];
- if (pe.size == QSize() && pe.pixmap.isNull()) {
- pe.pixmap = QPixmap(pe.fileName);
- pe.size = pe.pixmap.size();
- }
- if (pe.mode == arg.mode && pe.state == arg.state && !pe.size.isEmpty())
- arg.sizes.push_back(pe.size);
- }
- break;
- }
- default:
- QIconEngine::virtual_hook(id, data);
- }
-}
-
-Q_GLOBAL_STATIC_WITH_ARGS(QFactoryLoader, loader,
- (QIconEngineFactoryInterface_iid, QLatin1String("/iconengines"), Qt::CaseInsensitive))
+Q_GLOBAL_STATIC_WITH_ARGS(QFactoryLoader, iceLoader,
+ (QIconEngineFactoryInterface_iid, "/iconengines"_L1, Qt::CaseInsensitive))
QFactoryLoader *qt_iconEngineFactoryLoader()
{
- return loader();
+ return iceLoader();
}
@@ -569,15 +551,26 @@ QFactoryLoader *qt_iconEngineFactoryLoader()
A QIcon can generate smaller, larger, active, and disabled pixmaps
from the set of pixmaps it is given. Such pixmaps are used by Qt
- widgets to show an icon representing a particular action.
+ UI components to show an icon representing a particular action.
+
+ \section1 Creating an icon from image files
- The simplest use of QIcon is to create one from a QPixmap file or
- resource, and then use it, allowing Qt to work out all the required
- icon styles and sizes. For example:
+ The simplest way to construct a QIcon is to create one from one or
+ several image files or resources. For example:
\snippet code/src_gui_image_qicon.cpp 0
- To undo a QIcon, simply set a null icon in its place:
+ QIcon can store several images for different states, and Qt will
+ select the image that is the closest match for the action's current
+ state.
+
+ \snippet code/src_gui_image_qicon.cpp addFile
+
+ Qt will generate the required icon styles and sizes when needed,
+ e.g. the pixmap for the QIcon::Disabled state might be generated by
+ graying out one of the provided pixmaps.
+
+ To clear the icon, simply set a null icon in its place:
\snippet code/src_gui_image_qicon.cpp 1
@@ -585,31 +578,54 @@ QFactoryLoader *qt_iconEngineFactoryLoader()
QImageWriter::supportedImageFormats() functions to retrieve a
complete list of the supported file formats.
- When you retrieve a pixmap using pixmap(QSize, Mode, State), and no
- pixmap for this given size, mode and state has been added with
- addFile() or addPixmap(), then QIcon will generate one on the
- fly. This pixmap generation happens in a QIconEngine. The default
- engine scales pixmaps down if required, but never up, and it uses
- the current style to calculate a disabled appearance. By using
- custom icon engines, you can customize every aspect of generated
- icons. With QIconEnginePlugin it is possible to register different
- icon engines for different file suffixes, making it possible for
- third parties to provide additional icon engines to those included
+ \section1 Creating an icon from a theme or icon library
+
+ The most convenient way to construct an icon is by using the
+ \l{QIcon::}{fromTheme()} factory function. Qt implements access to
+ the native icon library on platforms that support the
+ \l {Freedesktop Icon Theme Specification}. Since Qt 6.7, Qt also
+ provides access to the native icon library on macOS, iOS, and
+ Windows 10 and 11. On Android, Qt can access icons from the Material
+ design system as long as the
+ \l{https://github.com/google/material-design-icons/tree/master/font}
+ {MaterialIcons-Regular} font is available on the system, or bundled
+ as a resource at \c{:/qt-project.org/icons/MaterialIcons-Regular.ttf}
+ with the application.
+
+ \snippet code/src_gui_image_qicon.cpp fromTheme
+
+ Applications can use the same theming specification to provide
+ their own icon library. See below for an example theme description
+ and the corresponding directory structure for the image files.
+ Icons from an application-provided theme take precedence over the
+ native icon library.
+
+ In addition, it is possible to provide custom \l {QIconEngine}
+ {icon engines}. This allows applications to customize every aspect
+ of generated icons. With QIconEnginePlugin it is possible to register
+ different icon engines for different file suffixes, making it possible
+ for third parties to provide additional icon engines to those included
with Qt.
- \note Since Qt 4.2, an icon engine that supports SVG is included.
-
\section1 Making Classes that Use QIcon
If you write your own widgets that have an option to set a small
pixmap, consider allowing a QIcon to be set for that pixmap. The
Qt class QToolButton is an example of such a widget.
- Provide a method to set a QIcon, and when you draw the icon, choose
- whichever pixmap is appropriate for the current state of your widget.
- For example:
+ Provide a method to set a QIcon, and paint the QIcon with
+ \l{QIcon::}{paint}, choosing the appropriate parameters based
+ on the current state of your widget. For example:
+
\snippet code/src_gui_image_qicon.cpp 2
+ When you retrieve a pixmap using pixmap(QSize, Mode, State), and no
+ pixmap for this given size, mode and state has been added with
+ addFile() or addPixmap(), then QIcon will generate one on the
+ fly. This pixmap generation happens in a QIconEngine. The default
+ engine scales pixmaps down if required, but never up, and it uses
+ the current style to calculate a disabled appearance.
+
You might also make use of the \c Active mode, perhaps making your
widget \c Active when the mouse is over the widget (see \l
QWidget::enterEvent()), while the mouse is pressed pending the
@@ -623,17 +639,19 @@ QFactoryLoader *qt_iconEngineFactoryLoader()
\section1 High DPI Icons
- There are two ways that QIcon supports \l {High DPI Displays}{high DPI}
- icons: via \l addFile() and \l fromTheme().
+ Icons that are provided by the native icon library are usually based
+ on vector graphics, and will automatically be rendered in the appropriate
+ resolution.
- \l addFile() is useful if you have your own custom directory structure and do
- not need to use the \l {Icon Theme Specification}{freedesktop.org Icon Theme
- Specification}. Icons created via this approach use Qt's \l {High Resolution
- Versions of Images}{"@nx" high DPI syntax}.
+ When providing your own image files via \l addFile(), then QIcon will
+ use Qt's \l {High Resolution Versions of Images}{"@nx" high DPI syntax}.
+ This is useful if you have your own custom directory structure and do not
+ use follow \l {Freedesktop Icon Theme Specification}.
- Using \l fromTheme() is necessary if you plan on following the Icon Theme
- Specification. To make QIcon use the high DPI version of an image, add an
- additional entry to the appropriate \c index.theme file:
+ When providing an application theme, then you need to follow the Icon Theme
+ Specification to specify which files to use for different resolutions.
+ To make QIcon use the high DPI version of an image, add an additional entry
+ to the appropriate \c index.theme file:
\badcode
[Icon Theme]
@@ -665,8 +683,6 @@ QFactoryLoader *qt_iconEngineFactoryLoader()
│ └── appointment-new.png
└── index.theme
\endcode
-
- \sa {fowler}{GUI Design Handbook: Iconic Label}, {Icons Example}
*/
@@ -782,27 +798,9 @@ QIcon &QIcon::operator=(const QIcon &other)
*/
QIcon::operator QVariant() const
{
- return QVariant(QVariant::Icon, this);
+ return QVariant::fromValue(*this);
}
-/*! \fn int QIcon::serialNumber() const
- \obsolete
-
- Returns a number that identifies the contents of this
- QIcon object. Distinct QIcon objects can have
- the same serial number if they refer to the same contents
- (but they don't have to). Also, the serial number of
- a QIcon object may change during its lifetime.
-
- Use cacheKey() instead.
-
- A null icon always has a serial number of 0.
-
- Serial numbers are mostly useful in conjunction with caching.
-
- \sa QPixmap::serialNumber()
-*/
-
/*!
Returns a number that identifies the contents of this QIcon
object. Distinct QIcon objects can have the same key if
@@ -826,11 +824,8 @@ qint64 QIcon::cacheKey() const
/*!
Returns a pixmap with the requested \a size, \a mode, and \a
state, generating one if necessary. The pixmap might be smaller than
- requested, but never larger.
-
- Setting the Qt::AA_UseHighDpiPixmaps application attribute enables this
- function to return pixmaps that are larger than the requested size. Such
- images will have a devicePixelRatio larger than 1.
+ requested, but never larger, unless the device-pixel ratio of the returned
+ pixmap is larger than 1.
\sa actualSize(), paint()
*/
@@ -838,7 +833,8 @@ QPixmap QIcon::pixmap(const QSize &size, Mode mode, State state) const
{
if (!d)
return QPixmap();
- return pixmap(nullptr, size, mode, state);
+ const qreal dpr = -1; // don't know target dpr
+ return pixmap(size, dpr, mode, state);
}
/*!
@@ -847,11 +843,8 @@ QPixmap QIcon::pixmap(const QSize &size, Mode mode, State state) const
\overload
Returns a pixmap of size QSize(\a w, \a h). The pixmap might be smaller than
- requested, but never larger.
-
- Setting the Qt::AA_UseHighDpiPixmaps application attribute enables this
- function to return pixmaps that are larger than the requested size. Such
- images will have a devicePixelRatio larger than 1.
+ requested, but never larger, unless the device-pixel ratio of the returned
+ pixmap is larger than 1.
*/
/*!
@@ -860,29 +853,45 @@ QPixmap QIcon::pixmap(const QSize &size, Mode mode, State state) const
\overload
Returns a pixmap of size QSize(\a extent, \a extent). The pixmap might be smaller
- than requested, but never larger.
-
- Setting the Qt::AA_UseHighDpiPixmaps application attribute enables this
- function to return pixmaps that are larger than the requested size. Such
- images will have a devicePixelRatio larger than 1.
+ than requested, but never larger, unless the device-pixel ratio of the returned
+ pixmap is larger than 1.
*/
-/*! Returns the actual size of the icon for the requested \a size, \a
- mode, and \a state. The result might be smaller than requested, but
- never larger. The returned size is in device-independent pixels (This
- is relevant for high-dpi pixmaps.)
+/*!
+ \overload
+ \since 6.0
- \sa pixmap(), paint()
+ Returns a pixmap with the requested \a size, \a devicePixelRatio, \a mode, and \a
+ state, generating one if necessary.
+
+ \sa actualSize(), paint()
*/
-QSize QIcon::actualSize(const QSize &size, Mode mode, State state) const
+QPixmap QIcon::pixmap(const QSize &size, qreal devicePixelRatio, Mode mode, State state) const
{
if (!d)
- return QSize();
- return actualSize(nullptr, size, mode, state);
+ return QPixmap();
+
+ // Use the global devicePixelRatio if the caller does not know the target dpr
+ if (devicePixelRatio == -1)
+ devicePixelRatio = qApp->devicePixelRatio();
+
+ // Handle the simple normal-dpi case
+ if (!(devicePixelRatio > 1.0)) {
+ QPixmap pixmap = d->engine->pixmap(size, mode, state);
+ pixmap.setDevicePixelRatio(1.0);
+ return pixmap;
+ }
+
+ // Try get a pixmap that is big enough to be displayed at device pixel resolution.
+ QPixmap pixmap = d->engine->scaledPixmap(size * devicePixelRatio, mode, state, devicePixelRatio);
+ pixmap.setDevicePixelRatio(d->pixmapDevicePixelRatio(devicePixelRatio, size, pixmap.size()));
+ return pixmap;
}
+#if QT_DEPRECATED_SINCE(6, 0)
/*!
\since 5.1
+ \deprecated [6.0] Use pixmap(size, devicePixelRatio) instead.
Returns a pixmap with the requested \a window \a size, \a mode, and \a
state, generating one if necessary.
@@ -893,29 +902,44 @@ QSize QIcon::actualSize(const QSize &size, Mode mode, State state) const
\sa actualSize(), paint()
*/
+
QPixmap QIcon::pixmap(QWindow *window, const QSize &size, Mode mode, State state) const
{
if (!d)
return QPixmap();
- qreal devicePixelRatio = qt_effective_device_pixel_ratio(window);
+ qreal devicePixelRatio = window ? window->devicePixelRatio() : qApp->devicePixelRatio();
+ return pixmap(size, devicePixelRatio, mode, state);
+}
+#endif
+
+
+/*! Returns the actual size of the icon for the requested \a size, \a
+ mode, and \a state. The result might be smaller than requested, but
+ never larger. The returned size is in device-independent pixels (This
+ is relevant for high-dpi pixmaps.)
+
+ \sa pixmap(), paint()
+*/
+QSize QIcon::actualSize(const QSize &size, Mode mode, State state) const
+{
+ if (!d)
+ return QSize();
+
+ const qreal devicePixelRatio = qApp->devicePixelRatio();
// Handle the simple normal-dpi case:
- if (!(devicePixelRatio > 1.0)) {
- QPixmap pixmap = d->engine->pixmap(size, mode, state);
- pixmap.setDevicePixelRatio(1.0);
- return pixmap;
- }
+ if (!(devicePixelRatio > 1.0))
+ return d->engine->actualSize(size, mode, state);
- // Try get a pixmap that is big enough to be displayed at device pixel resolution.
- QIconEngine::ScaledPixmapArgument scalePixmapArg = { size * devicePixelRatio, mode, state, devicePixelRatio, QPixmap() };
- d->engine->virtual_hook(QIconEngine::ScaledPixmapHook, reinterpret_cast<void*>(&scalePixmapArg));
- scalePixmapArg.pixmap.setDevicePixelRatio(d->pixmapDevicePixelRatio(devicePixelRatio, size, scalePixmapArg.pixmap.size()));
- return scalePixmapArg.pixmap;
+ const QSize actualSize = d->engine->actualSize(size * devicePixelRatio, mode, state);
+ return actualSize / d->pixmapDevicePixelRatio(devicePixelRatio, size, actualSize);
}
+#if QT_DEPRECATED_SINCE(6, 0)
/*!
\since 5.1
+ \deprecated [6.0] Use actualSize(size) instead.
Returns the actual size of the icon for the requested \a window \a size, \a
mode, and \a state.
@@ -925,12 +949,13 @@ QPixmap QIcon::pixmap(QWindow *window, const QSize &size, Mode mode, State state
\sa actualSize(), pixmap(), paint()
*/
+
QSize QIcon::actualSize(QWindow *window, const QSize &size, Mode mode, State state) const
{
if (!d)
return QSize();
- qreal devicePixelRatio = qt_effective_device_pixel_ratio(window);
+ qreal devicePixelRatio = window ? window->devicePixelRatio() : qApp->devicePixelRatio();
// Handle the simple normal-dpi case:
if (!(devicePixelRatio > 1.0))
@@ -939,6 +964,7 @@ QSize QIcon::actualSize(QWindow *window, const QSize &size, Mode mode, State sta
QSize actualSize = d->engine->actualSize(size * devicePixelRatio, mode, state);
return actualSize / d->pixmapDevicePixelRatio(devicePixelRatio, size, actualSize);
}
+#endif
/*!
Uses the \a painter to paint the icon with specified \a alignment,
@@ -1042,9 +1068,9 @@ void QIcon::addPixmap(const QPixmap &pixmap, Mode mode, State state)
static QIconEngine *iconEngineFromSuffix(const QString &fileName, const QString &suffix)
{
if (!suffix.isEmpty()) {
- const int index = loader()->indexOf(suffix);
+ const int index = iceLoader()->indexOf(suffix);
if (index != -1) {
- if (QIconEnginePlugin *factory = qobject_cast<QIconEnginePlugin*>(loader()->instance(index))) {
+ if (QIconEnginePlugin *factory = qobject_cast<QIconEnginePlugin*>(iceLoader()->instance(index))) {
return factory->create(fileName);
}
}
@@ -1126,10 +1152,9 @@ QList<QSize> QIcon::availableSizes(Mode mode, State state) const
Returns the name used to create the icon, if available.
Depending on the way the icon was created, it may have an associated
- name. This is the case for icons created with fromTheme() or icons
- using a QIconEngine which supports the QIconEngine::IconNameHook.
+ name. This is the case for icons created with fromTheme().
- \sa fromTheme(), QIconEngine
+ \sa fromTheme(), QIconEngine::iconName()
*/
QString QIcon::name() const
{
@@ -1142,6 +1167,10 @@ QString QIcon::name() const
\since 4.6
Sets the search paths for icon themes to \a paths.
+
+ The content of \a paths should follow the theme format
+ documented by setThemeName().
+
\sa themeSearchPaths(), fromTheme(), setThemeName()
*/
void QIcon::setThemeSearchPaths(const QStringList &paths)
@@ -1150,20 +1179,14 @@ void QIcon::setThemeSearchPaths(const QStringList &paths)
}
/*!
- \since 4.6
-
- Returns the search paths for icon themes.
-
- The default value will depend on the platform:
+ \since 4.6
- On X11, the search path will use the XDG_DATA_DIRS environment
- variable if available.
+ Returns the search paths for icon themes.
- By default all platforms will have the resource directory
- \c{:\icons} as a fallback. You can use "rcc -project" to generate a
- resource file from your icon theme.
+ The default search paths will be defined by the platform.
+ All platforms will also have the resource directory \c{:\icons} as a fallback.
- \sa setThemeSearchPaths(), fromTheme(), setThemeName()
+ \sa setThemeSearchPaths(), fromTheme(), setThemeName()
*/
QStringList QIcon::themeSearchPaths()
{
@@ -1175,7 +1198,13 @@ QStringList QIcon::themeSearchPaths()
Returns the fallback search paths for icons.
- The default value will depend on the platform.
+ The fallback search paths are consulted for standalone
+ icon files if the \l{themeName()}{current icon theme}
+ or \l{fallbackThemeName()}{fallback icon theme} do
+ not provide results for an icon lookup.
+
+ If not set, the fallback search paths will be defined
+ by the platform.
\sa setFallbackSearchPaths(), themeSearchPaths()
*/
@@ -1189,7 +1218,12 @@ QStringList QIcon::fallbackSearchPaths()
Sets the fallback search paths for icons to \a paths.
- \note To add some path without replacing existing ones:
+ The fallback search paths are consulted for standalone
+ icon files if the \l{themeName()}{current icon theme}
+ or \l{fallbackThemeName()}{fallback icon theme} do
+ not provide results for an icon lookup.
+
+ For example:
\snippet code/src_gui_image_qicon.cpp 5
@@ -1205,11 +1239,15 @@ void QIcon::setFallbackSearchPaths(const QStringList &paths)
Sets the current icon theme to \a name.
- The \a name should correspond to a directory name in the
- themeSearchPath() containing an index.theme
- file describing its contents.
+ The theme will be will be looked up in themeSearchPaths().
- \sa themeSearchPaths(), themeName()
+ At the moment the only supported icon theme format is the
+ \l{Freedesktop Icon Theme Specification}. The \a name should
+ correspond to a directory name in the themeSearchPath()
+ containing an \c index.theme file describing its contents.
+
+ \sa themeSearchPaths(), themeName(),
+ {Freedesktop Icon Theme Specification}
*/
void QIcon::setThemeName(const QString &name)
{
@@ -1221,8 +1259,12 @@ void QIcon::setThemeName(const QString &name)
Returns the name of the current icon theme.
- On X11, the current icon theme depends on your desktop
- settings. On other platforms it is not set by default.
+ If not set, the current icon theme will be defined by the
+ platform.
+
+ \note Platform icon themes are only implemented on
+ \l{Freedesktop} based systems at the moment, and the
+ icon theme depends on your desktop settings.
\sa setThemeName(), themeSearchPaths(), fromTheme(),
hasThemeIcon()
@@ -1237,8 +1279,12 @@ QString QIcon::themeName()
Returns the name of the fallback icon theme.
- On X11, if not set, the fallback icon theme depends on your desktop
- settings. On other platforms it is not set by default.
+ If not set, the fallback icon theme will be defined by the
+ platform.
+
+ \note Platform fallback icon themes are only implemented on
+ \l{Freedesktop} based systems at the moment, and the
+ icon theme depends on your desktop settings.
\sa setFallbackThemeName(), themeName()
*/
@@ -1252,9 +1298,16 @@ QString QIcon::fallbackThemeName()
Sets the fallback icon theme to \a name.
- The \a name should correspond to a directory name in the
- themeSearchPath() containing an index.theme
- file describing its contents.
+ The fallback icon theme is consulted for icons not provided by
+ the \l{themeName()}{current icon theme}, or if the \l{themeName()}
+ {current icon theme} does not exist.
+
+ The \a name should correspond to theme in the same format
+ as documented by setThemeName(), and will be looked up
+ in themeSearchPaths().
+
+ \note Fallback icon themes should be set before creating
+ QGuiApplication, to ensure correct initialization.
\sa fallbackThemeName(), themeSearchPaths(), themeName()
*/
@@ -1266,67 +1319,63 @@ void QIcon::setFallbackThemeName(const QString &name)
/*!
\since 4.6
- Returns the QIcon corresponding to \a name in the current
- icon theme.
+ Returns the QIcon corresponding to \a name in the
+ \l{themeName()}{current icon theme}.
- The latest version of the freedesktop icon specification and naming
- specification can be obtained here:
-
- \list
- \li \l{http://standards.freedesktop.org/icon-theme-spec/icon-theme-spec-latest.html}
- \li \l{http://standards.freedesktop.org/icon-naming-spec/icon-naming-spec-latest.html}
- \endlist
+ If the current theme does not provide an icon for \a name,
+ the \l{fallbackThemeName()}{fallback icon theme} is consulted,
+ before falling back to looking up standalone icon files in the
+ \l{QIcon::fallbackSearchPaths()}{fallback icon search path}.
+ Finally, the platform's native icon library is consulted.
To fetch an icon from the current icon theme:
- \snippet code/src_gui_image_qicon.cpp 3
-
- \note By default, only X11 will support themed icons. In order to
- use themed icons on Mac and Windows, you will have to bundle a
- compliant theme in one of your themeSearchPaths() and set the
- appropriate themeName().
-
- \note Qt will make use of GTK's icon-theme.cache if present to speed up
- the lookup. These caches can be generated using gtk-update-icon-cache:
- \l{https://developer.gnome.org/gtk3/stable/gtk-update-icon-cache.html}.
+ \snippet code/src_gui_image_qicon.cpp fromTheme
- \note If an icon can't be found in the current theme, then it will be
- searched in fallbackSearchPaths() as an unthemed icon.
+ If an \l{themeName()}{icon theme} has not been explicitly
+ set via setThemeName() a platform defined icon theme will
+ be used.
- \sa themeName(), setThemeName(), themeSearchPaths(), fallbackSearchPaths()
+ \sa themeName(), fallbackThemeName(), setThemeName(), themeSearchPaths(), fallbackSearchPaths(),
+ {Freedesktop Icon Naming Specification}
*/
QIcon QIcon::fromTheme(const QString &name)
{
- QIcon icon;
- if (qtIconCache()->contains(name)) {
- icon = *qtIconCache()->object(name);
- } else if (QDir::isAbsolutePath(name)) {
+ if (QIcon *cachedIcon = qtIconCache()->object(name))
+ return *cachedIcon;
+
+ if (QDir::isAbsolutePath(name))
return QIcon(name);
- } else {
- QPlatformTheme * const platformTheme = QGuiApplicationPrivate::platformTheme();
- bool hasUserTheme = QIconLoader::instance()->hasUserTheme();
- QIconEngine * const engine = (platformTheme && !hasUserTheme) ? platformTheme->createIconEngine(name)
- : new QIconLoaderEngine(name);
- QIcon *cachedIcon = new QIcon(engine);
- icon = *cachedIcon;
- qtIconCache()->insert(name, cachedIcon);
- }
+ QIcon icon(new QThemeIconEngine(name));
+ qtIconCache()->insert(name, new QIcon(icon));
return icon;
}
/*!
\overload
- Returns the QIcon corresponding to \a name in the current
- icon theme. If no such icon is found in the current theme
- \a fallback is returned instead.
+ Returns the QIcon corresponding to \a name in the
+ \l{themeName()}{current icon theme}.
+
+ If the current theme does not provide an icon for \a name,
+ the \l{fallbackThemeName()}{fallback icon theme} is consulted,
+ before falling back to looking up standalone icon files in the
+ \l{QIcon::fallbackSearchPaths()}{fallback icon search path}.
+ Finally, the platform's native icon library is consulted.
+
+ If no icon is found \a fallback is returned.
- If you want to provide a guaranteed fallback for platforms that
- do not support theme icons, you can use the second argument:
+ This is useful to provide a guaranteed fallback, regardless of
+ whether the current set of icon themes and fallbacks paths
+ support the requested icon.
+
+ For example:
\snippet code/src_gui_image_qicon.cpp 4
+
+ \sa fallbackThemeName(), fallbackSearchPaths()
*/
QIcon QIcon::fromTheme(const QString &name, const QIcon &fallback)
{
@@ -1342,7 +1391,8 @@ QIcon QIcon::fromTheme(const QString &name, const QIcon &fallback)
\since 4.6
Returns \c true if there is an icon available for \a name in the
- current icon theme, otherwise returns \c false.
+ current icon theme or any of the fallbacks, as described by
+ fromTheme(), otherwise returns \c false.
\sa themeSearchPaths(), fromTheme(), setThemeName()
*/
@@ -1353,6 +1403,401 @@ bool QIcon::hasThemeIcon(const QString &name)
return icon.name() == name;
}
+static constexpr auto themeIconMapping = qOffsetStringArray(
+ "address-book-new",
+ "application-exit",
+ "appointment-new",
+ "call-start",
+ "call-stop",
+ "contact-new",
+ "document-new",
+ "document-open",
+ "document-open-recent",
+ "document-page-setup",
+ "document-print",
+ "document-print-preview",
+ "document-properties",
+ "document-revert",
+ "document-save",
+ "document-save-as",
+ "document-send",
+ "edit-clear",
+ "edit-copy",
+ "edit-cut",
+ "edit-delete",
+ "edit-find",
+ "edit-paste",
+ "edit-redo",
+ "edit-select-all",
+ "edit-undo",
+ "folder-new",
+ "format-indent-less",
+ "format-indent-more",
+ "format-justify-center",
+ "format-justify-fill",
+ "format-justify-left",
+ "format-justify-right",
+ "format-text-direction-ltr",
+ "format-text-direction-rtl",
+ "format-text-bold",
+ "format-text-italic",
+ "format-text-underline",
+ "format-text-strikethrough",
+ "go-down",
+ "go-home",
+ "go-next",
+ "go-previous",
+ "go-up",
+ "help-about",
+ "help-faq",
+ "insert-image",
+ "insert-link",
+ "insert-text",
+ "list-add",
+ "list-remove",
+ "mail-forward",
+ "mail-mark-important",
+ "mail-mark-read",
+ "mail-mark-unread",
+ "mail-message-new",
+ "mail-reply-all",
+ "mail-reply-sender",
+ "mail-send",
+ "media-eject",
+ "media-playback-pause",
+ "media-playback-start",
+ "media-playback-stop",
+ "media-record",
+ "media-seek-backward",
+ "media-seek-forward",
+ "media-skip-backward",
+ "media-skip-forward",
+ "object-rotate-left",
+ "object-rotate-right",
+ "process-stop",
+ "system-lock-screen",
+ "system-log-out",
+ "system-search",
+ "system-reboot",
+ "system-shutdown",
+ "tools-check-spelling",
+ "view-fullscreen",
+ "view-refresh",
+ "view-restore",
+ "window-close",
+ "window-new",
+ "zoom-fit-best",
+ "zoom-in",
+ "zoom-out",
+
+ "audio-card",
+ "audio-input-microphone",
+ "battery",
+ "camera-photo",
+ "camera-video",
+ "camera-web",
+ "computer",
+ "drive-harddisk",
+ "drive-optical",
+ "input-gaming",
+ "input-keyboard",
+ "input-mouse",
+ "input-tablet",
+ "media-flash",
+ "media-optical",
+ "media-tape",
+ "multimedia-player",
+ "network-wired",
+ "network-wireless",
+ "phone",
+ "printer",
+ "scanner",
+ "video-display",
+
+ "appointment-missed",
+ "appointment-soon",
+ "audio-volume-high",
+ "audio-volume-low",
+ "audio-volume-medium",
+ "audio-volume-muted",
+ "battery-caution",
+ "battery-low",
+ "dialog-error",
+ "dialog-information",
+ "dialog-password",
+ "dialog-question",
+ "dialog-warning",
+ "folder-drag-accept",
+ "folder-open",
+ "folder-visiting",
+ "image-loading",
+ "image-missing",
+ "mail-attachment",
+ "mail-unread",
+ "mail-read",
+ "mail-replied",
+ "media-playlist-repeat",
+ "media-playlist-shuffle",
+ "network-offline",
+ "printer-printing",
+ "security-high",
+ "security-low",
+ "software-update-available",
+ "software-update-urgent",
+ "sync-error",
+ "sync-synchronizing",
+ "user-available",
+ "user-offline",
+ "weather-clear",
+ "weather-clear-night",
+ "weather-few-clouds",
+ "weather-few-clouds-night",
+ "weather-fog",
+ "weather-showers",
+ "weather-snow",
+ "weather-storm"
+);
+static_assert(QIcon::ThemeIcon::NThemeIcons == QIcon::ThemeIcon(themeIconMapping.count()));
+
+static constexpr QLatin1StringView themeIconName(QIcon::ThemeIcon icon)
+{
+ using ThemeIconIndex = std::underlying_type_t<QIcon::ThemeIcon>;
+ const auto index = static_cast<ThemeIconIndex>(icon);
+ Q_ASSERT(index < themeIconMapping.count());
+ return QLatin1StringView(themeIconMapping.viewAt(index));
+}
+
+/*!
+ \enum QIcon::ThemeIcon
+ \since 6.7
+
+ This enum provides access to icons that are provided by most
+ icon theme implementations.
+
+ \value AddressBookNew The icon for the action to create a new address book.
+ \value ApplicationExit The icon for exiting an application.
+ \value AppointmentNew The icon for the action to create a new appointment.
+ \value CallStart The icon for initiating or accepting a call.
+ \value CallStop The icon for stopping a current call.
+ \value ContactNew The icon for the action to create a new contact.
+ \value DocumentNew The icon for the action to create a new document.
+ \value DocumentOpen The icon for the action to open a document.
+ \value DocumentOpenRecent The icon for the action to open a document that was recently opened.
+ \value DocumentPageSetup The icon for the \e{page setup} action.
+ \value DocumentPrint The icon for the \e{print} action.
+ \value DocumentPrintPreview The icon for the \e{print preview} action.
+ \value DocumentProperties The icon for the action to view the properties of a document.
+ \value DocumentRevert The icon for the action of reverting to a previous version of a document.
+ \value DocumentSave The icon for the \e{save} action.
+ \value DocumentSaveAs The icon for the \e{save as} action.
+ \value DocumentSend The icon for the \e{send} action.
+ \value EditClear The icon for the \e{clear} action.
+ \value EditCopy The icon for the \e{copy} action.
+ \value EditCut The icon for the \e{cut} action.
+ \value EditDelete The icon for the \e{delete} action.
+ \value EditFind The icon for the \e{find} action.
+ \value EditPaste The icon for the \e{paste} action.
+ \value EditRedo The icon for the \e{redo} action.
+ \value EditSelectAll The icon for the \e{select all} action.
+ \value EditUndo The icon for the \e{undo} action.
+ \value FolderNew The icon for creating a new folder.
+ \value FormatIndentLess The icon for the \e{decrease indent formatting} action.
+ \value FormatIndentMore The icon for the \e{increase indent formatting} action.
+ \value FormatJustifyCenter The icon for the \e{center justification formatting} action.
+ \value FormatJustifyFill The icon for the \e{fill justification formatting} action.
+ \value FormatJustifyLeft The icon for the \e{left justification formatting} action.
+ \value FormatJustifyRight The icon for the \e{right justification} action.
+ \value FormatTextDirectionLtr The icon for the \e{left-to-right text formatting} action.
+ \value FormatTextDirectionRtl The icon for the \e{right-to-left formatting} action.
+ \value FormatTextBold The icon for the \e{bold text formatting} action.
+ \value FormatTextItalic The icon for the \e{italic text formatting} action.
+ \value FormatTextUnderline The icon for the \e{underlined text formatting} action.
+ \value FormatTextStrikethrough The icon for the \e{strikethrough text formatting} action.
+ \value GoDown The icon for the \e{go down in a list} action.
+ \value GoHome The icon for the \e{go to home location} action.
+ \value GoNext The icon for the \e{go to the next item in a list} action.
+ \value GoPrevious The icon for the \e{go to the previous item in a list} action.
+ \value GoUp The icon for the \e{go up in a list} action.
+ \value HelpAbout The icon for the \e{About} item in the Help menu.
+ \value HelpFaq The icon for the \e{FAQ} item in the Help menu.
+ \value InsertImage The icon for the \e{insert image} action of an application.
+ \value InsertLink The icon for the \e{insert link} action of an application.
+ \value InsertText The icon for the \e{insert text} action of an application.
+ \value ListAdd The icon for the \e{add to list} action.
+ \value ListRemove The icon for the \e{remove from list} action.
+ \value MailForward The icon for the \e{forward} action.
+ \value MailMarkImportant The icon for the \e{mark as important} action.
+ \value MailMarkRead The icon for the \e{mark as read} action.
+ \value MailMarkUnread The icon for the \e{mark as unread} action.
+ \value MailMessageNew The icon for the \e{compose new mail} action.
+ \value MailReplyAll The icon for the \e{reply to all} action.
+ \value MailReplySender The icon for the \e{reply to sender} action.
+ \value MailSend The icon for the \e{send} action.
+ \value MediaEject The icon for the \e{eject} action of a media player or file manager.
+ \value MediaPlaybackPause The icon for the \e{pause} action of a media player.
+ \value MediaPlaybackStart The icon for the \e{start playback} action of a media player.
+ \value MediaPlaybackStop The icon for the \e{stop} action of a media player.
+ \value MediaRecord The icon for the \e{record} action of a media application.
+ \value MediaSeekBackward The icon for the \e{seek backward} action of a media player.
+ \value MediaSeekForward The icon for the \e{seek forward} action of a media player.
+ \value MediaSkipBackward The icon for the \e{skip backward} action of a media player.
+ \value MediaSkipForward The icon for the \e{skip forward} action of a media player.
+ \value ObjectRotateLeft The icon for the \e{rotate left} action performed on an object.
+ \value ObjectRotateRight The icon for the \e{rotate right} action performed on an object.
+ \value ProcessStop The icon for the \e{stop action in applications with} actions that
+ may take a while to process, such as web page loading in a browser.
+ \value SystemLockScreen The icon for the \e{lock screen} action.
+ \value SystemLogOut The icon for the \e{log out} action.
+ \value SystemSearch The icon for the \e{search} action.
+ \value SystemReboot The icon for the \e{reboot} action.
+ \value SystemShutdown The icon for the \e{shutdown} action.
+ \value ToolsCheckSpelling The icon for the \e{check spelling} action.
+ \value ViewFullscreen The icon for the \e{fullscreen} action.
+ \value ViewRefresh The icon for the \e{refresh} action.
+ \value ViewRestore The icon for leaving the fullscreen view.
+ \value WindowClose The icon for the \e{close window} action.
+ \value WindowNew The icon for the \e{new window} action.
+ \value ZoomFitBest The icon for the \e{best fit} action.
+ \value ZoomIn The icon for the \e{zoom in} action.
+ \value ZoomOut The icon for the \e{zoom out} action.
+
+ \value AudioCard The icon for the audio rendering device.
+ \value AudioInputMicrophone The icon for the microphone audio input device.
+ \value Battery The icon for the system battery device.
+ \value CameraPhoto The icon for a digital still camera devices.
+ \value CameraVideo The icon for a video camera device.
+ \value CameraWeb The icon for a web camera device.
+ \value Computer The icon for the computing device as a whole.
+ \value DriveHarddisk The icon for hard disk drives.
+ \value DriveOptical The icon for optical media drives such as CD and DVD.
+ \value InputGaming The icon for the gaming input device.
+ \value InputKeyboard The icon for the keyboard input device.
+ \value InputMouse The icon for the mousing input device.
+ \value InputTablet The icon for graphics tablet input devices.
+ \value MediaFlash The icon for flash media, such as a memory stick.
+ \value MediaOptical The icon for physical optical media such as CD and DVD.
+ \value MediaTape The icon for generic physical tape media.
+ \value MultimediaPlayer The icon for generic multimedia playing devices.
+ \value NetworkWired The icon for wired network connections.
+ \value NetworkWireless The icon for wireless network connections.
+ \value Phone The icon for phone devices.
+ \value Printer The icon for a printer device.
+ \value Scanner The icon for a scanner device.
+ \value VideoDisplay The icon for the monitor that video gets displayed on.
+
+ \value AppointmentMissed The icon for when an appointment was missed.
+ \value AppointmentSoon The icon for when an appointment will occur soon.
+ \value AudioVolumeHigh The icon used to indicate high audio volume.
+ \value AudioVolumeLow The icon used to indicate low audio volume.
+ \value AudioVolumeMedium The icon used to indicate medium audio volume.
+ \value AudioVolumeMuted The icon used to indicate the muted state for audio playback.
+ \value BatteryCaution The icon used when the battery is below 40%.
+ \value BatteryLow The icon used when the battery is below 20%.
+ \value DialogError The icon used when a dialog is opened to explain an error
+ condition to the user.
+ \value DialogInformation The icon used when a dialog is opened to give information to the
+ user that may be pertinent to the requested action.
+ \value DialogPassword The icon used when a dialog requesting the authentication
+ credentials for a user is opened.
+ \value DialogQuestion The icon used when a dialog is opened to ask a simple question
+ to the user.
+ \value DialogWarning The icon used when a dialog is opened to warn the user of
+ impending issues with the requested action.
+ \value FolderDragAccept The icon used for a folder while an acceptable object is being
+ dragged onto it.
+ \value FolderOpen The icon used for folders, while their contents are being displayed
+ within the same window.
+ \value FolderVisiting The icon used for folders, while their contents are being displayed
+ in another window.
+ \value ImageLoading The icon used while another image is being loaded.
+ \value ImageMissing The icon used when another image could not be loaded.
+ \value MailAttachment The icon for a message that contains attachments.
+ \value MailUnread The icon for an unread message.
+ \value MailRead The icon for a read message.
+ \value MailReplied The icon for a message that has been replied to.
+ \value MediaPlaylistRepeat The icon for the repeat mode of a media player.
+ \value MediaPlaylistShuffle The icon for the shuffle mode of a media player.
+ \value NetworkOffline The icon used to indicate that the device is not connected to the
+ network.
+ \value PrinterPrinting The icon used while a print job is successfully being spooled to a
+ printing device.
+ \value SecurityHigh The icon used to indicate that the security level of an item is
+ known to be high.
+ \value SecurityLow The icon used to indicate that the security level of an item is
+ known to be low.
+ \value SoftwareUpdateAvailable The icon used to indicate that an update is available.
+ \value SoftwareUpdateUrgent The icon used to indicate that an urgent update is available.
+ \value SyncError The icon used when an error occurs while attempting to synchronize
+ data across devices.
+ \value SyncSynchronizing The icon used while data is successfully synchronizing across
+ devices.
+ \value UserAvailable The icon used to indicate that a user is available.
+ \value UserOffline The icon used to indicate that a user is not available.
+ \value WeatherClear The icon used to indicate that the sky is clear.
+ \value WeatherClearNight The icon used to indicate that the sky is clear
+ during the night.
+ \value WeatherFewClouds The icon used to indicate that the sky is partly cloudy.
+ \value WeatherFewCloudsNight The icon used to indicate that the sky is partly cloudy
+ during the night.
+ \value WeatherFog The icon used to indicate that the weather is foggy.
+ \value WeatherShowers The icon used to indicate that rain showers are occurring.
+ \value WeatherSnow The icon used to indicate that snow is falling.
+ \value WeatherStorm The icon used to indicate that the weather is stormy.
+
+ \omitvalue NThemeIcons
+
+ \sa {QIcon#Creating an icon from a theme or icon library},
+ fromTheme()
+*/
+
+/*!
+ \since 6.7
+ \overload
+
+ Returns \c true if there is an icon available for \a icon in the
+ current icon theme or any of the fallbacks, as described by
+ fromTheme(), otherwise returns \c false.
+
+ \sa fromTheme()
+*/
+bool QIcon::hasThemeIcon(QIcon::ThemeIcon icon)
+{
+ return hasThemeIcon(themeIconName(icon));
+}
+
+/*!
+ \fn QIcon QIcon::fromTheme(QIcon::ThemeIcon icon)
+ \fn QIcon QIcon::fromTheme(QIcon::ThemeIcon icon, const QIcon &fallback)
+ \since 6.7
+ \overload
+
+ Returns the QIcon corresponding to \a icon in the
+ \l{themeName()}{current icon theme}.
+
+ If the current theme does not provide an icon for \a icon,
+ the \l{fallbackThemeName()}{fallback icon theme} is consulted,
+ before falling back to looking up standalone icon files in the
+ \l{QIcon::fallbackSearchPaths()}{fallback icon search path}.
+ Finally, the platform's native icon library is consulted.
+
+ If no icon is found and a \a fallback is provided, \a fallback is
+ returned. This is useful to provide a guaranteed fallback, regardless
+ of whether the current set of icon themes and fallbacks paths
+ support the requested icon.
+
+ If no icon is found and no \a fallback is provided, a default
+ constructed, empty QIcon is returned.
+*/
+QIcon QIcon::fromTheme(QIcon::ThemeIcon icon)
+{
+ return fromTheme(themeIconName(icon));
+}
+
+QIcon QIcon::fromTheme(QIcon::ThemeIcon icon, const QIcon &fallback)
+{
+ return fromTheme(themeIconName(icon), fallback);
+}
+
/*!
\since 5.6
@@ -1362,10 +1807,9 @@ bool QIcon::hasThemeIcon(const QString &name)
*/
void QIcon::setIsMask(bool isMask)
{
+ detach();
if (!d)
d = new QIconPrivate(new QPixmapIconEngine);
- else
- detach();
d->is_mask = isMask;
}
@@ -1445,16 +1889,16 @@ QDataStream &operator>>(QDataStream &s, QIcon &icon)
icon = QIcon();
QString key;
s >> key;
- if (key == QLatin1String("QPixmapIconEngine")) {
+ if (key == "QPixmapIconEngine"_L1) {
icon.d = new QIconPrivate(new QPixmapIconEngine);
icon.d->engine->read(s);
- } else if (key == QLatin1String("QIconLoaderEngine")) {
- icon.d = new QIconPrivate(new QIconLoaderEngine());
+ } else if (key == "QIconLoaderEngine"_L1 || key == "QThemeIconEngine"_L1) {
+ icon.d = new QIconPrivate(new QThemeIconEngine);
icon.d->engine->read(s);
} else {
- const int index = loader()->indexOf(key);
+ const int index = iceLoader()->indexOf(key);
if (index != -1) {
- if (QIconEnginePlugin *factory = qobject_cast<QIconEnginePlugin*>(loader()->instance(index))) {
+ if (QIconEnginePlugin *factory = qobject_cast<QIconEnginePlugin*>(iceLoader()->instance(index))) {
if (QIconEngine *engine= factory->create()) {
icon.d = new QIconPrivate(engine);
engine->read(s);
@@ -1527,7 +1971,7 @@ QDebug operator<<(QDebug dbg, const QIcon &i)
\internal
\since 5.6
Attempts to find a suitable @Nx file for the given \a targetDevicePixelRatio
- Returns the the \a baseFileName if no such file was found.
+ Returns the \a baseFileName if no such file was found.
Given base foo.png and a target dpr of 2.5, this function will look for
foo@3x.png, then foo@2x, then fall back to foo.png if not found.
@@ -1545,17 +1989,17 @@ QString qt_findAtNxFile(const QString &baseFileName, qreal targetDevicePixelRati
if (disableNxImageLoading)
return baseFileName;
- int dotIndex = baseFileName.lastIndexOf(QLatin1Char('.'));
+ int dotIndex = baseFileName.lastIndexOf(u'.');
if (dotIndex == -1) { /* no dot */
dotIndex = baseFileName.size(); /* append */
- } else if (dotIndex >= 2 && baseFileName[dotIndex - 1] == QLatin1Char('9')
- && baseFileName[dotIndex - 2] == QLatin1Char('.')) {
+ } else if (dotIndex >= 2 && baseFileName[dotIndex - 1] == u'9'
+ && baseFileName[dotIndex - 2] == u'.') {
// If the file has a .9.* (9-patch image) extension, we must ensure that the @nx goes before it.
dotIndex -= 2;
}
QString atNxfileName = baseFileName;
- atNxfileName.insert(dotIndex, QLatin1String("@2x"));
+ atNxfileName.insert(dotIndex, "@2x"_L1);
// Check for @Nx, ..., @3x, @2x file versions,
for (int n = qMin(qCeil(targetDevicePixelRatio), 9); n > 1; --n) {
atNxfileName[dotIndex + 1] = QLatin1Char('0' + n);
diff --git a/src/gui/image/qicon.h b/src/gui/image/qicon.h
index 735a3e134d..5100ada548 100644
--- a/src/gui/image/qicon.h
+++ b/src/gui/image/qicon.h
@@ -1,41 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the QtGui module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#ifndef QICON_H
#define QICON_H
@@ -58,20 +22,178 @@ public:
enum Mode { Normal, Disabled, Active, Selected };
enum State { On, Off };
+ enum class ThemeIcon {
+ AddressBookNew,
+ ApplicationExit,
+ AppointmentNew,
+ CallStart,
+ CallStop,
+ ContactNew,
+ DocumentNew,
+ DocumentOpen,
+ DocumentOpenRecent,
+ DocumentPageSetup,
+ DocumentPrint,
+ DocumentPrintPreview,
+ DocumentProperties,
+ DocumentRevert,
+ DocumentSave,
+ DocumentSaveAs,
+ DocumentSend,
+ EditClear,
+ EditCopy,
+ EditCut,
+ EditDelete,
+ EditFind,
+ EditPaste,
+ EditRedo,
+ EditSelectAll,
+ EditUndo,
+ FolderNew,
+ FormatIndentLess,
+ FormatIndentMore,
+ FormatJustifyCenter,
+ FormatJustifyFill,
+ FormatJustifyLeft,
+ FormatJustifyRight,
+ FormatTextDirectionLtr,
+ FormatTextDirectionRtl,
+ FormatTextBold,
+ FormatTextItalic,
+ FormatTextUnderline,
+ FormatTextStrikethrough,
+ GoDown,
+ GoHome,
+ GoNext,
+ GoPrevious,
+ GoUp,
+ HelpAbout,
+ HelpFaq,
+ InsertImage,
+ InsertLink,
+ InsertText,
+ ListAdd,
+ ListRemove,
+ MailForward,
+ MailMarkImportant,
+ MailMarkRead,
+ MailMarkUnread,
+ MailMessageNew,
+ MailReplyAll,
+ MailReplySender,
+ MailSend,
+ MediaEject,
+ MediaPlaybackPause,
+ MediaPlaybackStart,
+ MediaPlaybackStop,
+ MediaRecord,
+ MediaSeekBackward,
+ MediaSeekForward,
+ MediaSkipBackward,
+ MediaSkipForward,
+ ObjectRotateLeft,
+ ObjectRotateRight,
+ ProcessStop,
+ SystemLockScreen,
+ SystemLogOut,
+ SystemSearch,
+ SystemReboot,
+ SystemShutdown,
+ ToolsCheckSpelling,
+ ViewFullscreen,
+ ViewRefresh,
+ ViewRestore,
+ WindowClose,
+ WindowNew,
+ ZoomFitBest,
+ ZoomIn,
+ ZoomOut,
+
+ AudioCard,
+ AudioInputMicrophone,
+ Battery,
+ CameraPhoto,
+ CameraVideo,
+ CameraWeb,
+ Computer,
+ DriveHarddisk,
+ DriveOptical,
+ InputGaming,
+ InputKeyboard,
+ InputMouse,
+ InputTablet,
+ MediaFlash,
+ MediaOptical,
+ MediaTape,
+ MultimediaPlayer,
+ NetworkWired,
+ NetworkWireless,
+ Phone,
+ Printer,
+ Scanner,
+ VideoDisplay,
+
+ AppointmentMissed,
+ AppointmentSoon,
+ AudioVolumeHigh,
+ AudioVolumeLow,
+ AudioVolumeMedium,
+ AudioVolumeMuted,
+ BatteryCaution,
+ BatteryLow,
+ DialogError,
+ DialogInformation,
+ DialogPassword,
+ DialogQuestion,
+ DialogWarning,
+ FolderDragAccept,
+ FolderOpen,
+ FolderVisiting,
+ ImageLoading,
+ ImageMissing,
+ MailAttachment,
+ MailUnread,
+ MailRead,
+ MailReplied,
+ MediaPlaylistRepeat,
+ MediaPlaylistShuffle,
+ NetworkOffline,
+ PrinterPrinting,
+ SecurityHigh,
+ SecurityLow,
+ SoftwareUpdateAvailable,
+ SoftwareUpdateUrgent,
+ SyncError,
+ SyncSynchronizing,
+ UserAvailable,
+ UserOffline,
+ WeatherClear,
+ WeatherClearNight,
+ WeatherFewClouds,
+ WeatherFewCloudsNight,
+ WeatherFog,
+ WeatherShowers,
+ WeatherSnow,
+ WeatherStorm,
+
+ NThemeIcons
+ };
+
QIcon() noexcept;
QIcon(const QPixmap &pixmap);
QIcon(const QIcon &other);
QIcon(QIcon &&other) noexcept
- : d(other.d)
- { other.d = nullptr; }
+ : d(std::exchange(other.d, nullptr))
+ {}
explicit QIcon(const QString &fileName); // file or resource name
explicit QIcon(QIconEngine *engine);
~QIcon();
QIcon &operator=(const QIcon &other);
- inline QIcon &operator=(QIcon &&other) noexcept
- { swap(other); return *this; }
+ QT_MOVE_ASSIGNMENT_OPERATOR_IMPL_VIA_MOVE_AND_SWAP(QIcon)
inline void swap(QIcon &other) noexcept
- { qSwap(d, other.d); }
+ { qt_ptr_swap(d, other.d); }
+ bool operator==(const QIcon &) const = delete;
+ bool operator!=(const QIcon &) const = delete;
operator QVariant() const;
@@ -80,10 +202,17 @@ public:
{ return pixmap(QSize(w, h), mode, state); }
inline QPixmap pixmap(int extent, Mode mode = Normal, State state = Off) const
{ return pixmap(QSize(extent, extent), mode, state); }
+ QPixmap pixmap(const QSize &size, qreal devicePixelRatio, Mode mode = Normal, State state = Off) const;
+#if QT_DEPRECATED_SINCE(6, 0)
+ QT_DEPRECATED_VERSION_X_6_0("Use pixmap(size, devicePixelRatio) instead")
QPixmap pixmap(QWindow *window, const QSize &size, Mode mode = Normal, State state = Off) const;
+#endif
QSize actualSize(const QSize &size, Mode mode = Normal, State state = Off) const;
+#if QT_DEPRECATED_SINCE(6, 0)
+ QT_DEPRECATED_VERSION_X_6_0("Use actualSize(size) instead")
QSize actualSize(QWindow *window, const QSize &size, Mode mode = Normal, State state = Off) const;
+#endif
QString name() const;
@@ -95,9 +224,6 @@ public:
bool isDetached() const;
void detach();
-#if QT_DEPRECATED_SINCE(5, 0)
- QT_DEPRECATED inline int serialNumber() const { return cacheKey() >> 32; }
-#endif
qint64 cacheKey() const;
void addPixmap(const QPixmap &pixmap, Mode mode = Normal, State state = Off);
@@ -112,6 +238,10 @@ public:
static QIcon fromTheme(const QString &name, const QIcon &fallback);
static bool hasThemeIcon(const QString &name);
+ static QIcon fromTheme(ThemeIcon icon);
+ static QIcon fromTheme(ThemeIcon icon, const QIcon &fallback);
+ static bool hasThemeIcon(ThemeIcon icon);
+
static QStringList themeSearchPaths();
static void setThemeSearchPaths(const QStringList &searchpath);
@@ -124,8 +254,6 @@ public:
static QString fallbackThemeName();
static void setFallbackThemeName(const QString &name);
- Q_DUMMY_COMPARISON_OPERATOR(QIcon)
-
private:
QIconPrivate *d;
#if !defined(QT_NO_DATASTREAM)
diff --git a/src/gui/image/qicon_p.h b/src/gui/image/qicon_p.h
index e384ff9e49..c5bf120620 100644
--- a/src/gui/image/qicon_p.h
+++ b/src/gui/image/qicon_p.h
@@ -1,41 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the QtGui module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#ifndef QICON_P_H
#define QICON_P_H
@@ -78,33 +42,33 @@ public:
int serialNum;
int detach_no;
bool is_mask;
+
+ static void clearIconCache();
};
struct QPixmapIconEngineEntry
{
- QPixmapIconEngineEntry():mode(QIcon::Normal), state(QIcon::Off){}
+ QPixmapIconEngineEntry():scale(1), mode(QIcon::Normal), state(QIcon::Off){}
QPixmapIconEngineEntry(const QPixmap &pm, QIcon::Mode m = QIcon::Normal, QIcon::State s = QIcon::Off)
- :pixmap(pm), size(pm.size()), mode(m), state(s){}
+ :pixmap(pm), size(pm.size()), scale(pm.devicePixelRatio()), mode(m), state(s){}
QPixmapIconEngineEntry(const QString &file, const QSize &sz = QSize(), QIcon::Mode m = QIcon::Normal, QIcon::State s = QIcon::Off)
- :fileName(file), size(sz), mode(m), state(s){}
+ :fileName(file), size(sz), scale(1), mode(m), state(s){}
QPixmapIconEngineEntry(const QString &file, const QImage &image, QIcon::Mode m = QIcon::Normal, QIcon::State s = QIcon::Off);
QPixmap pixmap;
QString fileName;
QSize size;
+ qreal scale;
QIcon::Mode mode;
QIcon::State state;
bool isNull() const {return (fileName.isEmpty() && pixmap.isNull()); }
};
-Q_DECLARE_TYPEINFO(QPixmapIconEngineEntry, Q_MOVABLE_TYPE);
+Q_DECLARE_TYPEINFO(QPixmapIconEngineEntry, Q_RELOCATABLE_TYPE);
inline QPixmapIconEngineEntry::QPixmapIconEngineEntry(const QString &file, const QImage &image, QIcon::Mode m, QIcon::State s)
- : fileName(file), size(image.size()), mode(m), state(s)
+ : fileName(file), size(image.size()), scale(image.devicePixelRatio()), mode(m), state(s)
{
pixmap.convertFromImage(image);
- // Reset the devicePixelRatio. The pixmap may be loaded from a @2x file,
- // but be used as a 1x pixmap by QIcon.
- pixmap.setDevicePixelRatio(1.0);
}
class Q_GUI_EXPORT QPixmapIconEngine : public QIconEngine {
@@ -114,20 +78,22 @@ public:
~QPixmapIconEngine();
void paint(QPainter *painter, const QRect &rect, QIcon::Mode mode, QIcon::State state) override;
QPixmap pixmap(const QSize &size, QIcon::Mode mode, QIcon::State state) override;
- QPixmapIconEngineEntry *bestMatch(const QSize &size, QIcon::Mode mode, QIcon::State state, bool sizeOnly);
+ QPixmap scaledPixmap(const QSize &size, QIcon::Mode mode, QIcon::State state, qreal scale) override;
+ QPixmapIconEngineEntry *bestMatch(const QSize &size, qreal scale, QIcon::Mode mode, QIcon::State state, bool sizeOnly);
QSize actualSize(const QSize &size, QIcon::Mode mode, QIcon::State state) override;
+ QList<QSize> availableSizes(QIcon::Mode mode, QIcon::State state) override;
void addPixmap(const QPixmap &pixmap, QIcon::Mode mode, QIcon::State state) override;
void addFile(const QString &fileName, const QSize &size, QIcon::Mode mode, QIcon::State state) override;
+ bool isNull() override;
QString key() const override;
QIconEngine *clone() const override;
bool read(QDataStream &in) override;
bool write(QDataStream &out) const override;
- void virtual_hook(int id, void *data) override;
private:
- QPixmapIconEngineEntry *tryMatch(const QSize &size, QIcon::Mode mode, QIcon::State state);
- QVector<QPixmapIconEngineEntry> pixmaps;
+ QPixmapIconEngineEntry *tryMatch(const QSize &size, qreal scale, QIcon::Mode mode, QIcon::State state);
+ QList<QPixmapIconEngineEntry> pixmaps;
friend Q_GUI_EXPORT QDataStream &operator<<(QDataStream &s, const QIcon &icon);
friend class QIconThemeEngine;
diff --git a/src/gui/image/qiconengine.cpp b/src/gui/image/qiconengine.cpp
index 3033112df0..78273bdeb3 100644
--- a/src/gui/image/qiconengine.cpp
+++ b/src/gui/image/qiconengine.cpp
@@ -1,43 +1,8 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the QtGui module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#include "qiconengine.h"
+#include "qiconengine_p.h"
#include "qpainter.h"
QT_BEGIN_NAMESPACE
@@ -154,24 +119,14 @@ void QIconEngine::addFile(const QString &/*fileName*/, const QSize &/*size*/, QI
These enum values are used for virtual_hook() to allow additional
queries to icon engine without breaking binary compatibility.
- \value AvailableSizesHook Allows to query the sizes of the
- contained pixmaps for pixmap-based engines. The \a data argument
- of the virtual_hook() function is a AvailableSizesArgument pointer
- that should be filled with icon sizes. Engines that work in terms
- of a scalable, vectorial format normally return an empty list.
-
- \value IconNameHook Allows to query the name used to create the
- icon, for example when instantiating an icon using
- QIcon::fromTheme().
-
\value IsNullHook Allow to query if this engine represents a null
icon. The \a data argument of the virtual_hook() is a pointer to a
bool that can be set to true if the icon is null. This enum value
was added in Qt 5.7.
\value ScaledPixmapHook Provides a way to get a pixmap that is scaled
- according to the given scale (typically equal to the \l {Glossary Of High
- DPI Terms}{device pixel ratio}). The \a data argument of the virtual_hook()
+ according to the given scale (typically equal to the \l {High
+ DPI}{device pixel ratio}). The \a data argument of the virtual_hook()
function is a \l ScaledPixmapArgument pointer that contains both the input and
output arguments. This enum value was added in Qt 5.9.
@@ -179,41 +134,6 @@ void QIconEngine::addFile(const QString &/*fileName*/, const QSize &/*size*/, QI
*/
/*!
- \class QIconEngine::AvailableSizesArgument
- \since 4.5
-
- \inmodule QtGui
-
- This struct represents arguments to virtual_hook() function when
- \a id parameter is QIconEngine::AvailableSizesHook.
-
- \sa virtual_hook(), QIconEngine::IconEngineHook
- */
-
-/*!
- \variable QIconEngine::AvailableSizesArgument::mode
- \brief the requested mode of an image.
-
- \sa QIcon::Mode
-*/
-
-/*!
- \variable QIconEngine::AvailableSizesArgument::state
- \brief the requested state of an image.
-
- \sa QIcon::State
-*/
-
-/*!
- \variable QIconEngine::AvailableSizesArgument::sizes
-
- \brief image sizes that are available with specified \a mode and
- \a state. This is an output parameter and is filled after call to
- virtual_hook(). Engines that work in terms of a scalable,
- vectorial format normally return an empty list.
-*/
-
-/*!
\class QIconEngine::ScaledPixmapArgument
\since 5.9
@@ -223,8 +143,8 @@ void QIconEngine::addFile(const QString &/*fileName*/, const QSize &/*size*/, QI
the \a id parameter is QIconEngine::ScaledPixmapHook.
The struct provides a way for icons created via \l QIcon::fromTheme()
- to return pixmaps that are designed for the current \l {Glossary Of High
- DPI Terms}{device pixel ratio}. The scale for such an icon is specified
+ to return pixmaps that are designed for the current \l {High
+ DPI}{device pixel ratio}. The scale for such an icon is specified
using the \l {Icon Theme Specification - Directory Layout}{Scale directory key}
in the appropriate \c index.theme file.
@@ -316,12 +236,6 @@ bool QIconEngine::write(QDataStream &) const
void QIconEngine::virtual_hook(int id, void *data)
{
switch (id) {
- case QIconEngine::AvailableSizesHook: {
- QIconEngine::AvailableSizesArgument &arg =
- *reinterpret_cast<QIconEngine::AvailableSizesArgument*>(data);
- arg.sizes.clear();
- break;
- }
case QIconEngine::ScaledPixmapHook: {
// We don't have any notion of scale besides "@nx", so just call pixmap() here.
QIconEngine::ScaledPixmapArgument &arg =
@@ -339,30 +253,20 @@ void QIconEngine::virtual_hook(int id, void *data)
Returns sizes of all images that are contained in the engine for the
specific \a mode and \a state.
-
- \include qiconengine-virtualhookhelper.qdocinc
*/
-QList<QSize> QIconEngine::availableSizes(QIcon::Mode mode, QIcon::State state) const
+QList<QSize> QIconEngine::availableSizes(QIcon::Mode /*mode*/, QIcon::State /*state*/)
{
- AvailableSizesArgument arg;
- arg.mode = mode;
- arg.state = state;
- const_cast<QIconEngine *>(this)->virtual_hook(QIconEngine::AvailableSizesHook, reinterpret_cast<void*>(&arg));
- return arg.sizes;
+ return {};
}
/*!
\since 4.7
Returns the name used to create the engine, if available.
-
- \include qiconengine-virtualhookhelper.qdocinc
*/
-QString QIconEngine::iconName() const
+QString QIconEngine::iconName()
{
- QString name;
- const_cast<QIconEngine *>(this)->virtual_hook(QIconEngine::IconNameHook, reinterpret_cast<void*>(&name));
- return name;
+ return QString();
}
/*!
@@ -372,10 +276,10 @@ QString QIconEngine::iconName() const
\include qiconengine-virtualhookhelper.qdocinc
*/
-bool QIconEngine::isNull() const
+bool QIconEngine::isNull()
{
bool isNull = false;
- const_cast<QIconEngine *>(this)->virtual_hook(QIconEngine::IsNullHook, &isNull);
+ virtual_hook(QIconEngine::IsNullHook, &isNull);
return isNull;
}
@@ -384,8 +288,8 @@ bool QIconEngine::isNull() const
Returns a pixmap for the given \a size, \a mode, \a state and \a scale.
- The \a scale argument is typically equal to the \l {Glossary Of High DPI
- Terms}{device pixel ratio} of the display.
+ The \a scale argument is typically equal to the \l {High DPI}
+ {device pixel ratio} of the display.
\include qiconengine-virtualhookhelper.qdocinc
@@ -404,4 +308,78 @@ QPixmap QIconEngine::scaledPixmap(const QSize &size, QIcon::Mode mode, QIcon::St
return arg.pixmap;
}
+
+// ------- QProxyIconEngine -----
+
+void QProxyIconEngine::paint(QPainter *painter, const QRect &rect, QIcon::Mode mode, QIcon::State state)
+{
+ proxiedEngine()->paint(painter, rect, mode, state);
+}
+
+QSize QProxyIconEngine::actualSize(const QSize &size, QIcon::Mode mode, QIcon::State state)
+{
+ return proxiedEngine()->actualSize(size, mode, state);
+}
+
+QPixmap QProxyIconEngine::pixmap(const QSize &size, QIcon::Mode mode, QIcon::State state)
+{
+ return proxiedEngine()->pixmap(size, mode, state);
+}
+
+void QProxyIconEngine::addPixmap(const QPixmap &pixmap, QIcon::Mode mode, QIcon::State state)
+{
+ proxiedEngine()->addPixmap(pixmap, mode, state);
+}
+
+void QProxyIconEngine::addFile(const QString &fileName, const QSize &size, QIcon::Mode mode, QIcon::State state)
+{
+ proxiedEngine()->addFile(fileName, size, mode, state);
+}
+
+QString QProxyIconEngine::key() const
+{
+ return proxiedEngine()->key();
+}
+
+QIconEngine *QProxyIconEngine::clone() const
+{
+ return proxiedEngine()->clone();
+}
+
+bool QProxyIconEngine::read(QDataStream &in)
+{
+ return proxiedEngine()->read(in);
+}
+
+bool QProxyIconEngine::write(QDataStream &out) const
+{
+ return proxiedEngine()->write(out);
+}
+
+QList<QSize> QProxyIconEngine::availableSizes(QIcon::Mode mode, QIcon::State state)
+{
+ return proxiedEngine()->availableSizes(mode, state);
+}
+
+QString QProxyIconEngine::iconName()
+{
+ return proxiedEngine()->iconName();
+}
+
+bool QProxyIconEngine::isNull()
+{
+ return proxiedEngine()->isNull();
+}
+
+QPixmap QProxyIconEngine::scaledPixmap(const QSize &size, QIcon::Mode mode, QIcon::State state, qreal scale)
+{
+ return proxiedEngine()->scaledPixmap(size, mode, state, scale);
+}
+
+void QProxyIconEngine::virtual_hook(int id, void *data)
+{
+ proxiedEngine()->virtual_hook(id, data);
+}
+
+
QT_END_NAMESPACE
diff --git a/src/gui/image/qiconengine.h b/src/gui/image/qiconengine.h
index 89fed5ccda..61411b0660 100644
--- a/src/gui/image/qiconengine.h
+++ b/src/gui/image/qiconengine.h
@@ -1,41 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the QtGui module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#ifndef QICONENGINE_H
#define QICONENGINE_H
@@ -51,7 +15,6 @@ class Q_GUI_EXPORT QIconEngine
{
public:
QIconEngine();
- QIconEngine(const QIconEngine &other); // ### Qt6: make protected
virtual ~QIconEngine();
virtual void paint(QPainter *painter, const QRect &rect, QIcon::Mode mode, QIcon::State state) = 0;
virtual QSize actualSize(const QSize &size, QIcon::Mode mode, QIcon::State state);
@@ -65,21 +28,14 @@ public:
virtual bool read(QDataStream &in);
virtual bool write(QDataStream &out) const;
- enum IconEngineHook { AvailableSizesHook = 1, IconNameHook, IsNullHook, ScaledPixmapHook };
-
- struct AvailableSizesArgument
- {
- QIcon::Mode mode;
- QIcon::State state;
- QList<QSize> sizes;
- };
-
virtual QList<QSize> availableSizes(QIcon::Mode mode = QIcon::Normal,
- QIcon::State state = QIcon::Off) const;
+ QIcon::State state = QIcon::Off);
+
+ virtual QString iconName();
+ virtual bool isNull();
+ virtual QPixmap scaledPixmap(const QSize &size, QIcon::Mode mode, QIcon::State state, qreal scale);
- virtual QString iconName() const;
- bool isNull() const; // ### Qt6 make virtual
- QPixmap scaledPixmap(const QSize &size, QIcon::Mode mode, QIcon::State state, qreal scale); // ### Qt6 make virtual
+ enum IconEngineHook { IsNullHook = 3, ScaledPixmapHook };
struct ScaledPixmapArgument
{
@@ -90,17 +46,15 @@ public:
QPixmap pixmap;
};
- // ### Qt6: move content to proper virtual functions
virtual void virtual_hook(int id, void *data);
+protected:
+ QIconEngine(const QIconEngine &other);
+
private:
QIconEngine &operator=(const QIconEngine &other) = delete;
};
-#if QT_DEPRECATED_SINCE(5, 0)
-typedef QIconEngine QIconEngineV2;
-#endif
-
QT_END_NAMESPACE
#endif // QICONENGINE_H
diff --git a/src/gui/image/qiconengine_p.h b/src/gui/image/qiconengine_p.h
new file mode 100644
index 0000000000..3cf0998429
--- /dev/null
+++ b/src/gui/image/qiconengine_p.h
@@ -0,0 +1,59 @@
+// Copyright (C) 2023 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
+
+#ifndef QICONENGINE_P_H
+#define QICONENGINE_P_H
+
+#include <QtGui/private/qtguiglobal_p.h>
+
+#ifndef QT_NO_ICON
+//
+// W A R N I N G
+// -------------
+//
+// This file is not part of the Qt API. It exists purely as an
+// implementation detail. This header file may change from version to
+// version without notice, or even be removed.
+//
+// We mean it.
+//
+
+#include <QtGui/QIcon>
+#include <QtGui/QIconEngine>
+
+QT_BEGIN_NAMESPACE
+
+class QIconEngine;
+
+class QProxyIconEngine : public QIconEngine
+{
+public:
+ void paint(QPainter *painter, const QRect &rect, QIcon::Mode mode, QIcon::State state) override;
+ QSize actualSize(const QSize &size, QIcon::Mode mode, QIcon::State state) override;
+ QPixmap pixmap(const QSize &size, QIcon::Mode mode, QIcon::State state) override;
+
+ void addPixmap(const QPixmap &pixmap, QIcon::Mode mode, QIcon::State state) override;
+ void addFile(const QString &fileName, const QSize &size, QIcon::Mode mode, QIcon::State state) override;
+
+ QString key() const override;
+ QIconEngine *clone() const override;
+ bool read(QDataStream &in) override;
+ bool write(QDataStream &out) const override;
+
+ QList<QSize> availableSizes(QIcon::Mode mode = QIcon::Normal,
+ QIcon::State state = QIcon::Off) override;
+
+ QString iconName() override;
+ bool isNull() override;
+ QPixmap scaledPixmap(const QSize &size, QIcon::Mode mode, QIcon::State state, qreal scale) override;
+
+ void virtual_hook(int id, void *data) override;
+protected:
+ virtual QIconEngine *proxiedEngine() const = 0;
+};
+
+QT_END_NAMESPACE
+
+#endif // QT_NO_ICON
+
+#endif // QICONENGINE_P_H
diff --git a/src/gui/image/qiconengineplugin.cpp b/src/gui/image/qiconengineplugin.cpp
index ca80ee50a7..f75b5370f1 100644
--- a/src/gui/image/qiconengineplugin.cpp
+++ b/src/gui/image/qiconengineplugin.cpp
@@ -1,41 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the QtGui module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#include "qiconengineplugin.h"
#include "qiconengine.h"
@@ -97,3 +61,5 @@ QIconEnginePlugin::~QIconEnginePlugin()
QT_END_NAMESPACE
+
+#include "moc_qiconengineplugin.cpp"
diff --git a/src/gui/image/qiconengineplugin.h b/src/gui/image/qiconengineplugin.h
index f2a1c0107a..b005baff0b 100644
--- a/src/gui/image/qiconengineplugin.h
+++ b/src/gui/image/qiconengineplugin.h
@@ -1,41 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the QtGui module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#ifndef QICONENGINEPLUGIN_H
#define QICONENGINEPLUGIN_H
diff --git a/src/gui/image/qiconloader.cpp b/src/gui/image/qiconloader.cpp
index e67b387981..982b9a26b4 100644
--- a/src/gui/image/qiconloader.cpp
+++ b/src/gui/image/qiconloader.cpp
@@ -1,41 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the QtGui module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#ifndef QT_NO_ICON
#include <private/qiconloader_p.h>
@@ -50,6 +14,7 @@
#include <QtCore/qmath.h>
#include <QtCore/QList>
#include <QtCore/QDir>
+#include <QtCore/qloggingcategory.h>
#if QT_CONFIG(settings)
#include <QtCore/QSettings>
#endif
@@ -59,6 +24,10 @@
QT_BEGIN_NAMESPACE
+Q_LOGGING_CATEGORY(lcIconLoader, "qt.gui.icon.loader")
+
+using namespace Qt::StringLiterals;
+
Q_GLOBAL_STATIC(QIconLoader, iconLoaderInstance)
/* Theme to use in last resort, if the theme does not have the icon, neither the parents */
@@ -79,6 +48,9 @@ QIconLoader::QIconLoader() :
static inline QString systemThemeName()
{
+ const auto override = qgetenv("QT_QPA_SYSTEM_ICON_THEME");
+ if (!override.isEmpty())
+ return QString::fromLocal8Bit(override);
if (const QPlatformTheme *theme = QGuiApplicationPrivate::platformTheme()) {
const QVariant themeHint = theme->themeHint(QPlatformTheme::SystemIconThemeName);
if (themeHint.isValid())
@@ -112,19 +84,31 @@ extern QFactoryLoader *qt_iconEngineFactoryLoader(); // qicon.cpp
void QIconLoader::ensureInitialized()
{
if (!m_initialized) {
+ if (!QGuiApplicationPrivate::platformTheme())
+ return; // it's too early: try again later (QTBUG-74252)
m_initialized = true;
-
- Q_ASSERT(qApp);
-
m_systemTheme = systemThemeName();
if (m_systemTheme.isEmpty())
m_systemTheme = systemFallbackThemeName();
- if (qt_iconEngineFactoryLoader()->keyMap().key(QLatin1String("svg"), -1) != -1)
+ if (qt_iconEngineFactoryLoader()->keyMap().key("svg"_L1, -1) != -1)
m_supportsSvg = true;
+
+ qCDebug(lcIconLoader) << "Initialized icon loader with system theme"
+ << m_systemTheme << "and SVG support" << m_supportsSvg;
}
}
+/*!
+ \internal
+ Gets an instance.
+
+ \l QIcon::setFallbackThemeName() should be called before QGuiApplication is
+ created, to avoid a race condition (QTBUG-74252). When this function is
+ called from there, ensureInitialized() does not succeed because there
+ is no QPlatformTheme yet, so systemThemeName() is empty, and we don't want
+ m_systemTheme to get initialized to the fallback theme instead of the normal one.
+*/
QIconLoader *QIconLoader::instance()
{
iconLoaderInstance()->ensureInitialized();
@@ -135,21 +119,45 @@ QIconLoader *QIconLoader::instance()
// icons if the theme has changed.
void QIconLoader::updateSystemTheme()
{
- // Only change if this is not explicitly set by the user
- if (m_userTheme.isEmpty()) {
- QString theme = systemThemeName();
- if (theme.isEmpty())
- theme = fallbackThemeName();
- if (theme != m_systemTheme) {
- m_systemTheme = theme;
- invalidateKey();
- }
- }
+ const QString currentSystemTheme = m_systemTheme;
+ m_systemTheme = systemThemeName();
+ if (m_systemTheme.isEmpty())
+ m_systemTheme = systemFallbackThemeName();
+ if (m_systemTheme != currentSystemTheme)
+ qCDebug(lcIconLoader) << "Updated system theme to" << m_systemTheme;
+ // Invalidate even if the system theme name hasn't changed, as the
+ // theme itself may have changed its underlying icon lookup logic.
+ if (!hasUserTheme())
+ invalidateKey();
+}
+
+void QIconLoader::invalidateKey()
+{
+ // Invalidating the key here will result in QThemeIconEngine
+ // recreating the actual engine the next time the icon is used.
+ // We don't need to clear the QIcon cache itself.
+ m_themeKey++;
+}
+
+QString QIconLoader::themeName() const
+{
+ return m_userTheme.isEmpty() ? m_systemTheme : m_userTheme;
}
void QIconLoader::setThemeName(const QString &themeName)
{
+ if (m_userTheme == themeName)
+ return;
+
+ qCDebug(lcIconLoader) << "Setting user theme name to" << themeName;
+
+ const bool hadUserTheme = hasUserTheme();
m_userTheme = themeName;
+ // if we cleared the user theme, then reset search paths as well,
+ // otherwise we'll keep looking in the user-defined search paths for
+ // a system-provide theme, which will never work.
+ if (!hasUserTheme() && hadUserTheme)
+ setThemeSearchPath(systemIconSearchPaths());
invalidateKey();
}
@@ -160,11 +168,14 @@ QString QIconLoader::fallbackThemeName() const
void QIconLoader::setFallbackThemeName(const QString &themeName)
{
+ qCDebug(lcIconLoader) << "Setting fallback theme name to" << themeName;
m_userFallbackTheme = themeName;
+ invalidateKey();
}
void QIconLoader::setThemeSearchPath(const QStringList &searchPaths)
{
+ qCDebug(lcIconLoader) << "Setting theme search path to" << searchPaths;
m_iconDirs = searchPaths;
themeList.clear();
invalidateKey();
@@ -175,13 +186,14 @@ QStringList QIconLoader::themeSearchPaths() const
if (m_iconDirs.isEmpty()) {
m_iconDirs = systemIconSearchPaths();
// Always add resource directory as search path
- m_iconDirs.append(QLatin1String(":/icons"));
+ m_iconDirs.append(":/icons"_L1);
}
return m_iconDirs;
}
void QIconLoader::setFallbackSearchPaths(const QStringList &searchPaths)
{
+ qCDebug(lcIconLoader) << "Setting fallback search path to" << searchPaths;
m_fallbackDirs = searchPaths;
invalidateKey();
}
@@ -205,7 +217,7 @@ class QIconCacheGtkReader
{
public:
explicit QIconCacheGtkReader(const QString &themeDir);
- QVector<const char *> lookup(const QStringRef &);
+ QList<const char *> lookup(QStringView);
bool isValid() const { return m_isValid; }
private:
QFile m_file;
@@ -236,8 +248,8 @@ private:
QIconCacheGtkReader::QIconCacheGtkReader(const QString &dirName)
: m_isValid(false)
{
- QFileInfo info(dirName + QLatin1String("/icon-theme.cache"));
- if (!info.exists() || info.lastModified() < QFileInfo(dirName).lastModified())
+ QFileInfo info(dirName + "/icon-theme.cache"_L1);
+ if (!info.exists() || info.lastModified(QTimeZone::UTC) < QFileInfo(dirName).lastModified(QTimeZone::UTC))
return;
m_file.setFileName(info.absoluteFilePath());
if (!m_file.open(QFile::ReadOnly))
@@ -252,13 +264,13 @@ QIconCacheGtkReader::QIconCacheGtkReader(const QString &dirName)
m_isValid = true;
// Check that all the directories are older than the cache
- auto lastModified = info.lastModified();
+ const QDateTime lastModified = info.lastModified(QTimeZone::UTC);
quint32 dirListOffset = read32(8);
quint32 dirListLen = read32(dirListOffset);
for (uint i = 0; i < dirListLen; ++i) {
quint32 offset = read32(dirListOffset + 4 + 4 * i);
- if (!m_isValid || offset >= m_size || lastModified < QFileInfo(dirName + QLatin1Char('/')
- + QString::fromUtf8(reinterpret_cast<const char*>(m_data + offset))).lastModified()) {
+ if (!m_isValid || offset >= m_size || lastModified < QFileInfo(dirName + u'/'
+ + QString::fromUtf8(reinterpret_cast<const char*>(m_data + offset))).lastModified(QTimeZone::UTC)) {
m_isValid = false;
return;
}
@@ -278,9 +290,9 @@ static quint32 icon_name_hash(const char *p)
with this name is present. The char* are pointers to the mapped data.
For example, this would return { "32x32/apps", "24x24/apps" , ... }
*/
-QVector<const char *> QIconCacheGtkReader::lookup(const QStringRef &name)
+QList<const char *> QIconCacheGtkReader::lookup(QStringView name)
{
- QVector<const char *> ret;
+ QList<const char *> ret;
if (!isValid() || name.isEmpty())
return ret;
@@ -336,7 +348,7 @@ QIconTheme::QIconTheme(const QString &themeName)
const QStringList iconDirs = QIcon::themeSearchPaths();
for ( int i = 0 ; i < iconDirs.size() ; ++i) {
QDir iconDir(iconDirs[i]);
- QString themeDir = iconDir.path() + QLatin1Char('/') + themeName;
+ QString themeDir = iconDir.path() + u'/' + themeName;
QFileInfo themeDirInfo(themeDir);
if (themeDirInfo.isDir()) {
@@ -345,77 +357,96 @@ QIconTheme::QIconTheme(const QString &themeName)
}
if (!m_valid) {
- themeIndex.setFileName(themeDir + QLatin1String("/index.theme"));
- if (themeIndex.exists())
- m_valid = true;
+ themeIndex.setFileName(themeDir + "/index.theme"_L1);
+ m_valid = themeIndex.exists();
+ qCDebug(lcIconLoader) << "Probing theme file at" << themeIndex.fileName() << m_valid;
}
}
#if QT_CONFIG(settings)
- if (themeIndex.exists()) {
+ if (m_valid) {
const QSettings indexReader(themeIndex.fileName(), QSettings::IniFormat);
const QStringList keys = indexReader.allKeys();
for (const QString &key : keys) {
- if (key.endsWith(QLatin1String("/Size"))) {
+ if (key.endsWith("/Size"_L1)) {
// Note the QSettings ini-format does not accept
// slashes in key names, hence we have to cheat
if (int size = indexReader.value(key).toInt()) {
QString directoryKey = key.left(key.size() - 5);
QIconDirInfo dirInfo(directoryKey);
dirInfo.size = size;
- QString type = indexReader.value(directoryKey +
- QLatin1String("/Type")
- ).toString();
+ QString type = indexReader.value(directoryKey + "/Type"_L1).toString();
- if (type == QLatin1String("Fixed"))
+ if (type == "Fixed"_L1)
dirInfo.type = QIconDirInfo::Fixed;
- else if (type == QLatin1String("Scalable"))
+ else if (type == "Scalable"_L1)
dirInfo.type = QIconDirInfo::Scalable;
else
dirInfo.type = QIconDirInfo::Threshold;
dirInfo.threshold = indexReader.value(directoryKey +
- QLatin1String("/Threshold"),
- 2).toInt();
+ "/Threshold"_L1,
+ 2).toInt();
+
+ dirInfo.minSize = indexReader.value(directoryKey + "/MinSize"_L1, size).toInt();
- dirInfo.minSize = indexReader.value(directoryKey +
- QLatin1String("/MinSize"),
- size).toInt();
+ dirInfo.maxSize = indexReader.value(directoryKey + "/MaxSize"_L1, size).toInt();
- dirInfo.maxSize = indexReader.value(directoryKey +
- QLatin1String("/MaxSize"),
- size).toInt();
+ dirInfo.scale = indexReader.value(directoryKey + "/Scale"_L1, 1).toInt();
+
+ const QString context = indexReader.value(directoryKey + "/Context"_L1).toString();
+ dirInfo.context = [context]() {
+ if (context == "Applications"_L1)
+ return QIconDirInfo::Applications;
+ else if (context == "MimeTypes"_L1)
+ return QIconDirInfo::MimeTypes;
+ else
+ return QIconDirInfo::UnknownContext;
+ }();
- dirInfo.scale = indexReader.value(directoryKey +
- QLatin1String("/Scale"),
- 1).toInt();
m_keyList.append(dirInfo);
}
}
}
// Parent themes provide fallbacks for missing icons
- m_parents = indexReader.value(
- QLatin1String("Icon Theme/Inherits")).toStringList();
+ m_parents = indexReader.value("Icon Theme/Inherits"_L1).toStringList();
m_parents.removeAll(QString());
-
- // Ensure a default platform fallback for all themes
- if (m_parents.isEmpty()) {
- const QString fallback = QIconLoader::instance()->fallbackThemeName();
- if (!fallback.isEmpty())
- m_parents.append(fallback);
- }
-
- // Ensure that all themes fall back to hicolor
- if (!m_parents.contains(QLatin1String("hicolor")))
- m_parents.append(QLatin1String("hicolor"));
}
#endif // settings
}
+QStringList QIconTheme::parents() const
+{
+ // Respect explicitly declared parents
+ QStringList result = m_parents;
+
+ // Ensure a default fallback for all themes
+ const QString fallback = QIconLoader::instance()->fallbackThemeName();
+ if (!fallback.isEmpty())
+ result.append(fallback);
+
+ // Ensure that all themes fall back to hicolor as the last theme
+ result.removeAll("hicolor"_L1);
+ result.append("hicolor"_L1);
+
+ return result;
+}
+
+QDebug operator<<(QDebug debug, const std::unique_ptr<QIconLoaderEngineEntry> &entry)
+{
+ QDebugStateSaver saver(debug);
+ debug.noquote() << entry->filename;
+ return debug;
+}
+
QThemeIconInfo QIconLoader::findIconHelper(const QString &themeName,
const QString &iconName,
- QStringList &visited) const
+ QStringList &visited,
+ DashRule rule) const
{
+ qCDebug(lcIconLoader) << "Finding icon" << iconName << "in theme" << themeName
+ << "skipping" << visited;
+
QThemeIconInfo info;
Q_ASSERT(!themeName.isEmpty());
@@ -425,22 +456,25 @@ QThemeIconInfo QIconLoader::findIconHelper(const QString &themeName,
QIconTheme &theme = themeList[themeName];
if (!theme.isValid()) {
theme = QIconTheme(themeName);
- if (!theme.isValid())
- theme = QIconTheme(fallbackThemeName());
+ if (!theme.isValid()) {
+ qCDebug(lcIconLoader) << "Theme" << themeName << "not found";
+ return info;
+ }
}
const QStringList contentDirs = theme.contentDirs();
- QStringRef iconNameFallback(&iconName);
+ QStringView iconNameFallback(iconName);
+ bool searchingGenericFallback = m_iconName.length() > iconName.length();
// Iterate through all icon's fallbacks in current theme
- while (info.entries.isEmpty()) {
- const QString svgIconName = iconNameFallback + QLatin1String(".svg");
- const QString pngIconName = iconNameFallback + QLatin1String(".png");
+ if (info.entries.empty()) {
+ const QString svgIconName = iconNameFallback + ".svg"_L1;
+ const QString pngIconName = iconNameFallback + ".png"_L1;
// Add all relevant files
for (int i = 0; i < contentDirs.size(); ++i) {
- QVector<QIconDirInfo> subDirs = theme.keyList();
+ QList<QIconDirInfo> subDirs = theme.keyList();
// Try to reduce the amount of subDirs by looking in the GTK+ cache in order to save
// a massive amount of file stat (especially if the icon is not there)
@@ -448,9 +482,9 @@ QThemeIconInfo QIconLoader::findIconHelper(const QString &themeName,
if (cache->isValid()) {
const auto result = cache->lookup(iconNameFallback);
if (cache->isValid()) {
- const QVector<QIconDirInfo> subDirsCopy = subDirs;
+ const QList<QIconDirInfo> subDirsCopy = subDirs;
subDirs.clear();
- subDirs.reserve(result.count());
+ subDirs.reserve(result.size());
for (const char *s : result) {
QString path = QString::fromUtf8(s);
auto it = std::find_if(subDirsCopy.cbegin(), subDirsCopy.cend(),
@@ -463,94 +497,109 @@ QThemeIconInfo QIconLoader::findIconHelper(const QString &themeName,
}
}
- QString contentDir = contentDirs.at(i) + QLatin1Char('/');
+ QString contentDir = contentDirs.at(i) + u'/';
for (int j = 0; j < subDirs.size() ; ++j) {
const QIconDirInfo &dirInfo = subDirs.at(j);
- const QString subDir = contentDir + dirInfo.path + QLatin1Char('/');
+ if (searchingGenericFallback &&
+ (dirInfo.context == QIconDirInfo::Applications ||
+ dirInfo.context == QIconDirInfo::MimeTypes))
+ continue;
+
+ const QString subDir = contentDir + dirInfo.path + u'/';
const QString pngPath = subDir + pngIconName;
if (QFile::exists(pngPath)) {
- PixmapEntry *iconEntry = new PixmapEntry;
+ auto iconEntry = std::make_unique<PixmapEntry>();
iconEntry->dir = dirInfo;
iconEntry->filename = pngPath;
// Notice we ensure that pixmap entries always come before
// scalable to preserve search order afterwards
- info.entries.prepend(iconEntry);
+ info.entries.insert(info.entries.begin(), std::move(iconEntry));
} else if (m_supportsSvg) {
const QString svgPath = subDir + svgIconName;
if (QFile::exists(svgPath)) {
- ScalableEntry *iconEntry = new ScalableEntry;
+ auto iconEntry = std::make_unique<ScalableEntry>();
iconEntry->dir = dirInfo;
iconEntry->filename = svgPath;
- info.entries.append(iconEntry);
+ info.entries.push_back(std::move(iconEntry));
}
}
}
}
- if (!info.entries.isEmpty()) {
+ if (!info.entries.empty()) {
info.iconName = iconNameFallback.toString();
- break;
}
-
- // If it's possible - find next fallback for the icon
- const int indexOfDash = iconNameFallback.lastIndexOf(QLatin1Char('-'));
- if (indexOfDash == -1)
- break;
-
- iconNameFallback.truncate(indexOfDash);
}
- if (info.entries.isEmpty()) {
+ if (info.entries.empty()) {
const QStringList parents = theme.parents();
+ qCDebug(lcIconLoader) << "Did not find matching icons in theme;"
+ << "trying parent themes" << parents
+ << "skipping visited" << visited;
+
// Search recursively through inherited themes
for (int i = 0 ; i < parents.size() ; ++i) {
const QString parentTheme = parents.at(i).trimmed();
if (!visited.contains(parentTheme)) // guard against recursion
- info = findIconHelper(parentTheme, iconName, visited);
+ info = findIconHelper(parentTheme, iconName, visited, QIconLoader::NoFallBack);
- if (!info.entries.isEmpty()) // success
+ if (!info.entries.empty()) // success
break;
}
}
+
+ if (rule == QIconLoader::FallBack && info.entries.empty()) {
+ // If it's possible - find next fallback for the icon
+ const int indexOfDash = iconNameFallback.lastIndexOf(u'-');
+ if (indexOfDash != -1) {
+ qCDebug(lcIconLoader) << "Did not find matching icons in all themes;"
+ << "trying dash fallback";
+ iconNameFallback.truncate(indexOfDash);
+ QStringList _visited;
+ info = findIconHelper(themeName, iconNameFallback.toString(), _visited, QIconLoader::FallBack);
+ }
+ }
+
return info;
}
QThemeIconInfo QIconLoader::lookupFallbackIcon(const QString &iconName) const
{
+ qCDebug(lcIconLoader) << "Looking up fallback icon" << iconName;
+
QThemeIconInfo info;
- const QString pngIconName = iconName + QLatin1String(".png");
- const QString xpmIconName = iconName + QLatin1String(".xpm");
- const QString svgIconName = iconName + QLatin1String(".svg");
+ const QString pngIconName = iconName + ".png"_L1;
+ const QString xpmIconName = iconName + ".xpm"_L1;
+ const QString svgIconName = iconName + ".svg"_L1;
const auto searchPaths = QIcon::fallbackSearchPaths();
for (const QString &iconDir: searchPaths) {
QDir currentDir(iconDir);
+ std::unique_ptr<QIconLoaderEngineEntry> iconEntry;
if (currentDir.exists(pngIconName)) {
- PixmapEntry *iconEntry = new PixmapEntry;
+ iconEntry = std::make_unique<PixmapEntry>();
iconEntry->dir.type = QIconDirInfo::Fallback;
iconEntry->filename = currentDir.filePath(pngIconName);
- info.entries.append(iconEntry);
- break;
} else if (currentDir.exists(xpmIconName)) {
- PixmapEntry *iconEntry = new PixmapEntry;
+ iconEntry = std::make_unique<PixmapEntry>();
iconEntry->dir.type = QIconDirInfo::Fallback;
iconEntry->filename = currentDir.filePath(xpmIconName);
- info.entries.append(iconEntry);
- break;
} else if (m_supportsSvg &&
currentDir.exists(svgIconName)) {
- ScalableEntry *iconEntry = new ScalableEntry;
+ iconEntry = std::make_unique<ScalableEntry>();
iconEntry->dir.type = QIconDirInfo::Fallback;
iconEntry->filename = currentDir.filePath(svgIconName);
- info.entries.append(iconEntry);
+ }
+ if (iconEntry) {
+ info.entries.push_back(std::move(iconEntry));
break;
}
}
- if (!info.entries.isEmpty())
+ if (!info.entries.empty())
info.iconName = iconName;
return info;
@@ -558,81 +607,168 @@ QThemeIconInfo QIconLoader::lookupFallbackIcon(const QString &iconName) const
QThemeIconInfo QIconLoader::loadIcon(const QString &name) const
{
- if (!themeName().isEmpty()) {
- QStringList visited;
- const QThemeIconInfo iconInfo = findIconHelper(themeName(), name, visited);
- if (!iconInfo.entries.isEmpty())
- return iconInfo;
+ qCDebug(lcIconLoader) << "Loading icon" << name;
+
+ m_iconName = name;
+ QThemeIconInfo iconInfo;
+ QStringList visitedThemes;
+ if (!themeName().isEmpty())
+ iconInfo = findIconHelper(themeName(), name, visitedThemes, QIconLoader::FallBack);
+
+ if (iconInfo.entries.empty() && !fallbackThemeName().isEmpty())
+ iconInfo = findIconHelper(fallbackThemeName(), name, visitedThemes, QIconLoader::FallBack);
+
+ if (iconInfo.entries.empty())
+ iconInfo = lookupFallbackIcon(name);
+
+ qCDebug(lcIconLoader) << "Resulting icon entries" << iconInfo.entries;
+ return iconInfo;
+}
+
+#ifndef QT_NO_DEBUG_STREAM
+QDebug operator<<(QDebug debug, QIconEngine *engine)
+{
+ QDebugStateSaver saver(debug);
+ debug.nospace();
+ if (engine) {
+ debug.noquote() << engine->key() << "(";
+ debug << static_cast<const void *>(engine);
+ if (!engine->isNull())
+ debug.quote() << ", " << engine->iconName();
+ else
+ debug << ", null";
+ debug << ")";
+ } else {
+ debug << "QIconEngine(nullptr)";
+ }
+ return debug;
+}
+#endif
- return lookupFallbackIcon(name);
+QIconEngine *QIconLoader::iconEngine(const QString &iconName) const
+{
+ qCDebug(lcIconLoader) << "Resolving icon engine for icon" << iconName;
+
+ std::unique_ptr<QIconEngine> iconEngine;
+ if (hasUserTheme())
+ iconEngine.reset(new QIconLoaderEngine(iconName));
+ if (!iconEngine || iconEngine->isNull()) {
+ qCDebug(lcIconLoader) << "Icon is not available from theme or fallback theme.";
+ if (auto *platformTheme = QGuiApplicationPrivate::platformTheme()) {
+ qCDebug(lcIconLoader) << "Trying platform engine.";
+ std::unique_ptr<QIconEngine> themeEngine(platformTheme->createIconEngine(iconName));
+ if (themeEngine && !themeEngine->isNull()) {
+ iconEngine = std::move(themeEngine);
+ qCDebug(lcIconLoader) << "Icon provided by platform engine.";
+ }
+ }
}
+ // We need to maintain the invariant that the QIcon has a valid engine
+ if (!iconEngine)
+ iconEngine.reset(new QIconLoaderEngine(iconName));
- return QThemeIconInfo();
+ qCDebug(lcIconLoader) << "Resulting engine" << iconEngine.get();
+ return iconEngine.release();
}
+/*!
+ \internal
+ \class QThemeIconEngine
+ \inmodule QtGui
-// -------- Icon Loader Engine -------- //
+ \brief A named-based icon engine for providing theme icons.
+ The engine supports invalidation of prior lookups, e.g. when
+ the platform theme changes or the user sets an explicit icon
+ theme.
-QIconLoaderEngine::QIconLoaderEngine(const QString& iconName)
- : m_iconName(iconName), m_key(0)
+ The actual icon lookup is handed over to an engine provided
+ by QIconLoader::iconEngine().
+*/
+
+QThemeIconEngine::QThemeIconEngine(const QString& iconName)
+ : QProxyIconEngine()
+ , m_iconName(iconName)
{
}
-QIconLoaderEngine::~QIconLoaderEngine()
+QThemeIconEngine::QThemeIconEngine(const QThemeIconEngine &other)
+ : QProxyIconEngine()
+ , m_iconName(other.m_iconName)
{
- qDeleteAll(m_info.entries);
}
-QIconLoaderEngine::QIconLoaderEngine(const QIconLoaderEngine &other)
- : QIconEngine(other),
- m_iconName(other.m_iconName),
- m_key(0)
+QString QThemeIconEngine::key() const
{
+ // Although we proxy the underlying engine, that's an implementation
+ // detail, so from the point of view of QIcon, and in terms of
+ // serialization, we are the one and only theme icon engine.
+ return u"QThemeIconEngine"_s;
}
-QIconEngine *QIconLoaderEngine::clone() const
+QIconEngine *QThemeIconEngine::clone() const
{
- return new QIconLoaderEngine(*this);
+ return new QThemeIconEngine(*this);
}
-bool QIconLoaderEngine::read(QDataStream &in) {
+bool QThemeIconEngine::read(QDataStream &in) {
in >> m_iconName;
return true;
}
-bool QIconLoaderEngine::write(QDataStream &out) const
+bool QThemeIconEngine::write(QDataStream &out) const
{
out << m_iconName;
return true;
}
-bool QIconLoaderEngine::hasIcon() const
+QIconEngine *QThemeIconEngine::proxiedEngine() const
{
- return !(m_info.entries.isEmpty());
+ const auto *iconLoader = QIconLoader::instance();
+ auto mostRecentThemeKey = iconLoader->themeKey();
+ if (mostRecentThemeKey != m_themeKey) {
+ qCDebug(lcIconLoader) << "Theme key" << mostRecentThemeKey << "is different"
+ << "than cached key" << m_themeKey << "for icon" << m_iconName;
+ m_proxiedEngine.reset(iconLoader->iconEngine(m_iconName));
+ m_themeKey = mostRecentThemeKey;
+ }
+ return m_proxiedEngine.get();
}
-// Lazily load the icon
-void QIconLoaderEngine::ensureLoaded()
+/*!
+ \internal
+ \class QIconLoaderEngine
+ \inmodule QtGui
+
+ \brief An icon engine based on icon entries collected by QIconLoader.
+
+ The design and implementation of QIconLoader is based on
+ the XDG icon specification.
+*/
+
+QIconLoaderEngine::QIconLoaderEngine(const QString& iconName)
+ : m_iconName(iconName)
+ , m_info(QIconLoader::instance()->loadIcon(m_iconName))
{
- if (!(QIconLoader::instance()->themeKey() == m_key)) {
- qDeleteAll(m_info.entries);
- m_info.entries.clear();
- m_info.iconName.clear();
+}
- Q_ASSERT(m_info.entries.size() == 0);
- m_info = QIconLoader::instance()->loadIcon(m_iconName);
- m_key = QIconLoader::instance()->themeKey();
- }
+QIconLoaderEngine::~QIconLoaderEngine() = default;
+
+QIconEngine *QIconLoaderEngine::clone() const
+{
+ Q_UNREACHABLE();
+ return nullptr; // Cannot be cloned
+}
+
+bool QIconLoaderEngine::hasIcon() const
+{
+ return !(m_info.entries.empty());
}
void QIconLoaderEngine::paint(QPainter *painter, const QRect &rect,
QIcon::Mode mode, QIcon::State state)
{
- const qreal dpr = !qApp->testAttribute(Qt::AA_UseHighDpiPixmaps) ?
- qreal(1.0) : painter->device()->devicePixelRatioF();
-
- QSize pixmapSize = rect.size() * dpr;
+ QSize pixmapSize = rect.size() * painter->device()->devicePixelRatio();
painter->drawPixmap(rect, pixmap(pixmapSize, mode, state));
}
@@ -702,25 +838,21 @@ QIconLoaderEngineEntry *QIconLoaderEngine::entryForSize(const QThemeIconInfo &in
// Note that m_info.entries are sorted so that png-files
// come first
- const int numEntries = info.entries.size();
-
// Search for exact matches first
- for (int i = 0; i < numEntries; ++i) {
- QIconLoaderEngineEntry *entry = info.entries.at(i);
+ for (const auto &entry : info.entries) {
if (directoryMatchesSize(entry->dir, iconsize, scale)) {
- return entry;
+ return entry.get();
}
}
// Find the minimum distance icon
int minimalSize = INT_MAX;
QIconLoaderEngineEntry *closestMatch = nullptr;
- for (int i = 0; i < numEntries; ++i) {
- QIconLoaderEngineEntry *entry = info.entries.at(i);
+ for (const auto &entry : info.entries) {
int distance = directorySizeDistance(entry->dir, iconsize, scale);
if (distance < minimalSize) {
minimalSize = distance;
- closestMatch = entry;
+ closestMatch = entry.get();
}
}
return closestMatch;
@@ -738,8 +870,6 @@ QSize QIconLoaderEngine::actualSize(const QSize &size, QIcon::Mode mode,
Q_UNUSED(mode);
Q_UNUSED(state);
- ensureLoaded();
-
QIconLoaderEngineEntry *entry = entryForSize(m_info, size);
if (entry) {
const QIconDirInfo &dir = entry->dir;
@@ -748,7 +878,7 @@ QSize QIconLoaderEngine::actualSize(const QSize &size, QIcon::Mode mode,
} else if (dir.type == QIconDirInfo::Fallback) {
return QIcon(entry->filename).actualSize(size, mode, state);
} else {
- int result = qMin<int>(dir.size, qMin(size.width(), size.height()));
+ int result = qMin<int>(dir.size * dir.scale, qMin(size.width(), size.height()));
return QSize(result, result);
}
}
@@ -770,7 +900,7 @@ QPixmap PixmapEntry::pixmap(const QSize &size, QIcon::Mode mode, QIcon::State st
if (!actualSize.isNull() && (actualSize.width() > size.width() || actualSize.height() > size.height()))
actualSize.scale(size, Qt::KeepAspectRatio);
- QString key = QLatin1String("$qt_theme_")
+ QString key = "$qt_theme_"_L1
% HexString<qint64>(basePixmap.cacheKey())
% HexString<int>(mode)
% HexString<qint64>(QGuiApplication::palette().cacheKey())
@@ -797,15 +927,17 @@ QPixmap ScalableEntry::pixmap(const QSize &size, QIcon::Mode mode, QIcon::State
if (svgIcon.isNull())
svgIcon = QIcon(filename);
- // Simply reuse svg icon engine
- return svgIcon.pixmap(size, mode, state);
+ // Bypass QIcon API, as that will scale by device pixel ratio of the
+ // highest DPR screen since we're not passing on any QWindow.
+ if (QIconEngine *engine = svgIcon.data_ptr() ? svgIcon.data_ptr()->engine : nullptr)
+ return engine->pixmap(size, mode, state);
+
+ return QPixmap();
}
QPixmap QIconLoaderEngine::pixmap(const QSize &size, QIcon::Mode mode,
QIcon::State state)
{
- ensureLoaded();
-
QIconLoaderEngineEntry *entry = entryForSize(m_info, size);
if (entry)
return entry->pixmap(size, mode, state);
@@ -815,58 +947,45 @@ QPixmap QIconLoaderEngine::pixmap(const QSize &size, QIcon::Mode mode,
QString QIconLoaderEngine::key() const
{
- return QLatin1String("QIconLoaderEngine");
+ return u"QIconLoaderEngine"_s;
+}
+
+QString QIconLoaderEngine::iconName()
+{
+ return m_info.iconName;
}
-void QIconLoaderEngine::virtual_hook(int id, void *data)
+bool QIconLoaderEngine::isNull()
{
- ensureLoaded();
+ return m_info.entries.empty();
+}
- switch (id) {
- case QIconEngine::AvailableSizesHook:
- {
- QIconEngine::AvailableSizesArgument &arg
- = *reinterpret_cast<QIconEngine::AvailableSizesArgument*>(data);
- const int N = m_info.entries.size();
- QList<QSize> sizes;
- sizes.reserve(N);
+QPixmap QIconLoaderEngine::scaledPixmap(const QSize &size, QIcon::Mode mode, QIcon::State state, qreal scale)
+{
+ const int integerScale = qCeil(scale);
+ QIconLoaderEngineEntry *entry = entryForSize(m_info, size / integerScale, integerScale);
+ return entry ? entry->pixmap(size, mode, state) : QPixmap();
+}
- // Gets all sizes from the DirectoryInfo entries
- for (int i = 0; i < N; ++i) {
- const QIconLoaderEngineEntry *entry = m_info.entries.at(i);
- if (entry->dir.type == QIconDirInfo::Fallback) {
- sizes.append(QIcon(entry->filename).availableSizes());
- } else {
- int size = entry->dir.size;
- sizes.append(QSize(size, size));
- }
- }
- arg.sizes.swap(sizes); // commit
- }
- break;
- case QIconEngine::IconNameHook:
- {
- QString &name = *reinterpret_cast<QString*>(data);
- name = m_info.iconName;
- }
- break;
- case QIconEngine::IsNullHook:
- {
- *reinterpret_cast<bool*>(data) = m_info.entries.isEmpty();
- }
- break;
- case QIconEngine::ScaledPixmapHook:
- {
- QIconEngine::ScaledPixmapArgument &arg = *reinterpret_cast<QIconEngine::ScaledPixmapArgument*>(data);
- // QIcon::pixmap() multiplies size by the device pixel ratio.
- const int integerScale = qCeil(arg.scale);
- QIconLoaderEngineEntry *entry = entryForSize(m_info, arg.size / integerScale, integerScale);
- arg.pixmap = entry ? entry->pixmap(arg.size, arg.mode, arg.state) : QPixmap();
+QList<QSize> QIconLoaderEngine::availableSizes(QIcon::Mode mode, QIcon::State state)
+{
+ Q_UNUSED(mode);
+ Q_UNUSED(state);
+
+ const qsizetype N = qsizetype(m_info.entries.size());
+ QList<QSize> sizes;
+ sizes.reserve(N);
+
+ // Gets all sizes from the DirectoryInfo entries
+ for (const auto &entry : m_info.entries) {
+ if (entry->dir.type == QIconDirInfo::Fallback) {
+ sizes.append(QIcon(entry->filename).availableSizes());
+ } else {
+ int size = entry->dir.size;
+ sizes.append(QSize(size, size));
}
- break;
- default:
- QIconEngine::virtual_hook(id, data);
}
+ return sizes;
}
QT_END_NAMESPACE
diff --git a/src/gui/image/qiconloader_p.h b/src/gui/image/qiconloader_p.h
index fac18b5d79..3cfa9381d1 100644
--- a/src/gui/image/qiconloader_p.h
+++ b/src/gui/image/qiconloader_p.h
@@ -1,41 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the QtGui module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#ifndef QICONLOADER_P_H
#define QICONLOADER_P_H
@@ -58,11 +22,15 @@
#include <QtGui/QIconEngine>
#include <QtGui/QPixmapCache>
#include <private/qicon_p.h>
+#include <private/qiconengine_p.h>
#include <private/qfactoryloader_p.h>
#include <QtCore/QHash>
-#include <QtCore/QVector>
+#include <QtCore/QList>
#include <QtCore/QTypeInfo>
+#include <vector>
+#include <memory>
+
QT_BEGIN_NAMESPACE
class QIconLoader;
@@ -70,6 +38,7 @@ class QIconLoader;
struct QIconDirInfo
{
enum Type { Fixed, Scalable, Threshold, Fallback };
+ enum Context { UnknownContext, Applications, MimeTypes };
QIconDirInfo(const QString &_path = QString()) :
path(_path),
size(0),
@@ -77,7 +46,8 @@ struct QIconDirInfo
minSize(0),
threshold(0),
scale(1),
- type(Threshold) {}
+ type(Threshold),
+ context(UnknownContext) {}
QString path;
short size;
short maxSize;
@@ -85,8 +55,9 @@ struct QIconDirInfo
short threshold;
short scale;
Type type;
+ Context context;
};
-Q_DECLARE_TYPEINFO(QIconDirInfo, Q_MOVABLE_TYPE);
+Q_DECLARE_TYPEINFO(QIconDirInfo, Q_RELOCATABLE_TYPE);
class QIconLoaderEngineEntry
{
@@ -111,7 +82,7 @@ struct PixmapEntry : public QIconLoaderEngineEntry
QPixmap basePixmap;
};
-typedef QList<QIconLoaderEngineEntry*> QThemeIconEntries;
+using QThemeIconEntries = std::vector<std::unique_ptr<QIconLoaderEngineEntry>>;
struct QThemeIconInfo
{
@@ -119,6 +90,27 @@ struct QThemeIconInfo
QString iconName;
};
+class QThemeIconEngine : public QProxyIconEngine
+{
+public:
+ QThemeIconEngine(const QString& iconName = QString());
+ QIconEngine *clone() const override;
+ bool read(QDataStream &in) override;
+ bool write(QDataStream &out) const override;
+
+protected:
+ QIconEngine *proxiedEngine() const override;
+
+private:
+ QThemeIconEngine(const QThemeIconEngine &other);
+ QString key() const override;
+
+ QString m_iconName;
+ mutable uint m_themeKey = 0;
+
+ mutable std::unique_ptr<QIconEngine> m_proxiedEngine;
+};
+
class QIconLoaderEngine : public QIconEngine
{
public:
@@ -129,21 +121,22 @@ public:
QPixmap pixmap(const QSize &size, QIcon::Mode mode, QIcon::State state) override;
QSize actualSize(const QSize &size, QIcon::Mode mode, QIcon::State state) override;
QIconEngine *clone() const override;
- bool read(QDataStream &in) override;
- bool write(QDataStream &out) const override;
+
+ QString iconName() override;
+ bool isNull() override;
+ QPixmap scaledPixmap(const QSize &size, QIcon::Mode mode, QIcon::State state, qreal scale) override;
+ QList<QSize> availableSizes(QIcon::Mode mode, QIcon::State state) override;
Q_GUI_EXPORT static QIconLoaderEngineEntry *entryForSize(const QThemeIconInfo &info, const QSize &size, int scale = 1);
private:
+ Q_DISABLE_COPY(QIconLoaderEngine)
+
QString key() const override;
bool hasIcon() const;
- void ensureLoaded();
- void virtual_hook(int id, void *data) override;
- QIconLoaderEngine(const QIconLoaderEngine &other);
- QThemeIconInfo m_info;
QString m_iconName;
- uint m_key;
+ QThemeIconInfo m_info;
friend class QIconLoader;
};
@@ -155,17 +148,17 @@ class QIconTheme
public:
QIconTheme(const QString &name);
QIconTheme() : m_valid(false) {}
- QStringList parents() { return m_parents; }
- QVector<QIconDirInfo> keyList() { return m_keyList; }
+ QStringList parents() const;
+ QList<QIconDirInfo> keyList() { return m_keyList; }
QStringList contentDirs() { return m_contentDirs; }
bool isValid() { return m_valid; }
private:
QStringList m_contentDirs;
- QVector<QIconDirInfo> m_keyList;
+ QList<QIconDirInfo> m_keyList;
QStringList m_parents;
bool m_valid;
public:
- QVector<QSharedPointer<QIconCacheGtkReader>> m_gtkCaches;
+ QList<QSharedPointer<QIconCacheGtkReader>> m_gtkCaches;
};
class Q_GUI_EXPORT QIconLoader
@@ -175,7 +168,7 @@ public:
QThemeIconInfo loadIcon(const QString &iconName) const;
uint themeKey() const { return m_themeKey; }
- QString themeName() const { return m_userTheme.isEmpty() ? m_systemTheme : m_userTheme; }
+ QString themeName() const;
void setThemeName(const QString &themeName);
QString fallbackThemeName() const;
void setFallbackThemeName(const QString &themeName);
@@ -187,14 +180,18 @@ public:
QIconDirInfo dirInfo(int dirindex);
static QIconLoader *instance();
void updateSystemTheme();
- void invalidateKey() { m_themeKey++; }
+ void invalidateKey();
void ensureInitialized();
bool hasUserTheme() const { return !m_userTheme.isEmpty(); }
+ QIconEngine *iconEngine(const QString &iconName) const;
+
private:
+ enum DashRule { FallBack, NoFallBack };
QThemeIconInfo findIconHelper(const QString &themeName,
const QString &iconName,
- QStringList &visited) const;
+ QStringList &visited,
+ DashRule rule) const;
QThemeIconInfo lookupFallbackIcon(const QString &iconName) const;
uint m_themeKey;
@@ -207,6 +204,7 @@ private:
mutable QStringList m_iconDirs;
mutable QHash <QString, QIconTheme> themeList;
mutable QStringList m_fallbackDirs;
+ mutable QString m_iconName;
};
QT_END_NAMESPACE
diff --git a/src/gui/image/qimage.cpp b/src/gui/image/qimage.cpp
index 99d64737c5..3bbf21320e 100644
--- a/src/gui/image/qimage.cpp
+++ b/src/gui/image/qimage.cpp
@@ -1,52 +1,17 @@
-/****************************************************************************
-**
-** Copyright (C) 2018 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the QtGui module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2022 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#include "qimage.h"
#include "qbuffer.h"
#include "qdatastream.h"
#include "qcolortransform.h"
+#include "qfloat16.h"
#include "qmap.h"
-#include "qmatrix.h"
#include "qtransform.h"
#include "qimagereader.h"
#include "qimagewriter.h"
+#include "qrgbafloat.h"
#include "qstringlist.h"
#include "qvariant.h"
#include "qimagepixmapcleanuphooks_p.h"
@@ -56,10 +21,11 @@
#include <stdlib.h>
#include <limits.h>
#include <qpa/qplatformpixmap.h>
+#include <private/qcolorspace_p.h>
#include <private/qcolortransform_p.h>
-#include <private/qdrawhelper_p.h>
#include <private/qmemrotate_p.h>
#include <private/qimagescale_p.h>
+#include <private/qpixellayout_p.h>
#include <private/qsimd_p.h>
#include <qhash.h>
@@ -69,12 +35,25 @@
#include <private/qimage_p.h>
#include <private/qfont_p.h>
+#if QT_CONFIG(thread)
+#include <qsemaphore.h>
+#include <qthreadpool.h>
+#include <private/qthreadpool_p.h>
+#endif
+
+#include <qtgui_tracepoints_p.h>
+
+#include <memory>
+
QT_BEGIN_NAMESPACE
+class QCmyk32;
-static inline bool isLocked(QImageData *data)
-{
- return data != nullptr && data->is_locked;
-}
+using namespace Qt::StringLiterals;
+
+// MSVC 19.28 does show spurious warning "C4723: potential divide by 0" for code that divides
+// by height() in release builds. Anyhow, all the code paths in this file are only executed
+// for valid QImage's, where height() cannot be 0. Therefore disable the warning.
+QT_WARNING_DISABLE_MSVC(4723)
#if defined(Q_CC_DEC) && defined(__alpha) && (__DECCXX_VER-0 >= 50190001)
#pragma message disable narrowptr
@@ -87,6 +66,17 @@ static inline bool isLocked(QImageData *data)
return QImage(); \
}
+Q_TRACE_PREFIX(qtgui,
+ "#include <qimagereader.h>"
+);
+
+Q_TRACE_METADATA(qtgui,
+"ENUM { } QImage::Format;" \
+"FLAGS { } Qt::ImageConversionFlags;"
+);
+
+Q_TRACE_PARAM_REPLACE(Qt::AspectRatioMode, int);
+Q_TRACE_PARAM_REPLACE(Qt::TransformationMode, int);
static QImage rotated90(const QImage &src);
static QImage rotated180(const QImage &src);
@@ -94,7 +84,7 @@ static QImage rotated270(const QImage &src);
static int next_qimage_serial_number()
{
- static QBasicAtomicInt serial = Q_BASIC_ATOMIC_INITIALIZER(0);
+ Q_CONSTINIT static QBasicAtomicInt serial = Q_BASIC_ATOMIC_INITIALIZER(0);
return 1 + serial.fetchAndAddRelaxed(1);
}
@@ -106,7 +96,7 @@ QImageData::QImageData()
dpmx(qt_defaultDpiX() * 100 / qreal(2.54)),
dpmy(qt_defaultDpiY() * 100 / qreal(2.54)),
offset(0, 0), own_data(true), ro_data(false), has_alpha_clut(false),
- is_cached(false), is_locked(false), cleanupFunction(nullptr), cleanupInfo(nullptr),
+ is_cached(false), cleanupFunction(nullptr), cleanupInfo(nullptr),
paintEngine(nullptr)
{
}
@@ -118,11 +108,13 @@ QImageData::QImageData()
Creates a new image data.
Returns \nullptr if invalid parameters are give or anything else failed.
*/
-QImageData * QImageData::create(const QSize &size, QImage::Format format)
+QImageData * Q_TRACE_INSTRUMENT(qtgui) QImageData::create(const QSize &size, QImage::Format format)
{
- if (size.isEmpty() || format == QImage::Format_Invalid)
+ if (size.isEmpty() || format <= QImage::Format_Invalid || format >= QImage::NImageFormats)
return nullptr; // invalid parameter(s)
+ Q_TRACE_SCOPE(QImageData_create, size, format);
+
int width = size.width();
int height = size.height();
int depth = qt_depthForFormat(format);
@@ -130,7 +122,7 @@ QImageData * QImageData::create(const QSize &size, QImage::Format format)
if (!params.isValid())
return nullptr;
- QScopedPointer<QImageData> d(new QImageData);
+ auto d = std::make_unique<QImageData>();
switch (format) {
case QImage::Format_Mono:
@@ -158,7 +150,7 @@ QImageData * QImageData::create(const QSize &size, QImage::Format format)
return nullptr;
d->ref.ref();
- return d.take();
+ return d.release();
}
QImageData::~QImageData()
@@ -173,7 +165,7 @@ QImageData::~QImageData()
data = nullptr;
}
-#if defined(_M_ARM)
+#if defined(_M_ARM) && defined(_MSC_VER)
#pragma optimize("", off)
#endif
@@ -280,6 +272,24 @@ bool QImageData::checkForAlphaPixels() const
bits += bytes_per_line;
}
} break;
+ case QImage::Format_RGBA16FPx4:
+ case QImage::Format_RGBA16FPx4_Premultiplied: {
+ uchar *bits = data;
+ for (int y = 0; y < height && !has_alpha_pixels; ++y) {
+ for (int x = 0; x < width; ++x)
+ has_alpha_pixels |= ((qfloat16 *)bits)[x * 4 + 3] < 1.0f;
+ bits += bytes_per_line;
+ }
+ } break;
+ case QImage::Format_RGBA32FPx4:
+ case QImage::Format_RGBA32FPx4_Premultiplied: {
+ uchar *bits = data;
+ for (int y = 0; y < height && !has_alpha_pixels; ++y) {
+ for (int x = 0; x < width; ++x)
+ has_alpha_pixels |= ((float *)bits)[x * 4 + 3] < 1.0f;
+ bits += bytes_per_line;
+ }
+ } break;
case QImage::Format_RGB32:
case QImage::Format_RGB16:
@@ -294,6 +304,9 @@ bool QImageData::checkForAlphaPixels() const
case QImage::Format_Grayscale8:
case QImage::Format_Grayscale16:
case QImage::Format_RGBX64:
+ case QImage::Format_RGBX16FPx4:
+ case QImage::Format_RGBX32FPx4:
+ case QImage::Format_CMYK8888:
break;
case QImage::Format_Invalid:
case QImage::NImageFormats:
@@ -303,7 +316,7 @@ bool QImageData::checkForAlphaPixels() const
return has_alpha_pixels;
}
-#if defined(_M_ARM)
+#if defined(_M_ARM) && defined(_MSC_VER)
#pragma optimize("", on)
#endif
@@ -350,7 +363,7 @@ bool QImageData::checkForAlphaPixels() const
refer to the \l{How to Create Qt Plugins}{Plugin HowTo}.
\warning Painting on a QImage with the format
- QImage::Format_Indexed8 is not supported.
+ QImage::Format_Indexed8 or QImage::Format_CMYK8888 is not supported.
\tableofcontents
@@ -418,7 +431,7 @@ bool QImageData::checkForAlphaPixels() const
The color of a pixel can be retrieved by passing its coordinates
to the pixel() function. The pixel() function returns the color
- as a QRgb value indepedent of the image's format.
+ as a QRgb value independent of the image's format.
In case of monochrome and 8-bit images, the colorCount() and
colorTable() functions provide information about the color
@@ -533,7 +546,7 @@ bool QImageData::checkForAlphaPixels() const
8-bit images are stored using 8-bit indexes into a color table,
i.e. they have a single byte per pixel. The color table is a
- QVector<QRgb>, and the QRgb typedef is equivalent to an unsigned
+ QList<QRgb>, and the QRgb typedef is equivalent to an unsigned
int containing an ARGB quadruplet on the format 0xAARRGGBB.
32-bit images have no color table; instead, each pixel contains an
@@ -606,8 +619,8 @@ bool QImageData::checkForAlphaPixels() const
\endtable
- \sa QImageReader, QImageWriter, QPixmap, QSvgRenderer, {Image Composition Example},
- {Image Viewer Example}, {Scribble Example}, {Pixelator Example}
+ \sa QImageReader, QImageWriter, QPixmap, QSvgRenderer,
+ {Image Composition Example}, {Scribble Example}
*/
/*!
@@ -700,30 +713,62 @@ bool QImageData::checkForAlphaPixels() const
The unused bits are always zero.
\value Format_ARGB4444_Premultiplied The image is stored using a
premultiplied 16-bit ARGB format (4-4-4-4).
- \value Format_RGBX8888 The image is stored using a 32-bit byte-ordered RGB(x) format (8-8-8-8).
- This is the same as the Format_RGBA8888 except alpha must always be 255. (added in Qt 5.2)
- \value Format_RGBA8888 The image is stored using a 32-bit byte-ordered RGBA format (8-8-8-8).
+ \value [since 5.2]
+ Format_RGBX8888 The image is stored using a 32-bit byte-ordered RGB(x) format (8-8-8-8).
+ This is the same as the Format_RGBA8888 except alpha must always be 255.
+ \value [since 5.2]
+ Format_RGBA8888 The image is stored using a 32-bit byte-ordered RGBA format (8-8-8-8).
Unlike ARGB32 this is a byte-ordered format, which means the 32bit
encoding differs between big endian and little endian architectures,
being respectively (0xRRGGBBAA) and (0xAABBGGRR). The order of the colors
- is the same on any architecture if read as bytes 0xRR,0xGG,0xBB,0xAA. (added in Qt 5.2)
- \value Format_RGBA8888_Premultiplied The image is stored using a
- premultiplied 32-bit byte-ordered RGBA format (8-8-8-8). (added in Qt 5.2)
- \value Format_BGR30 The image is stored using a 32-bit BGR format (x-10-10-10). (added in Qt 5.4)
- \value Format_A2BGR30_Premultiplied The image is stored using a 32-bit premultiplied ABGR format (2-10-10-10). (added in Qt 5.4)
- \value Format_RGB30 The image is stored using a 32-bit RGB format (x-10-10-10). (added in Qt 5.4)
- \value Format_A2RGB30_Premultiplied The image is stored using a 32-bit premultiplied ARGB format (2-10-10-10). (added in Qt 5.4)
- \value Format_Alpha8 The image is stored using an 8-bit alpha only format. (added in Qt 5.5)
- \value Format_Grayscale8 The image is stored using an 8-bit grayscale format. (added in Qt 5.5)
- \value Format_Grayscale16 The image is stored using an 16-bit grayscale format. (added in Qt 5.13)
- \value Format_RGBX64 The image is stored using a 64-bit halfword-ordered RGB(x) format (16-16-16-16).
- This is the same as the Format_RGBA64 except alpha must always be 65535. (added in Qt 5.12)
- \value Format_RGBA64 The image is stored using a 64-bit halfword-ordered RGBA format (16-16-16-16). (added in Qt 5.12)
- \value Format_RGBA64_Premultiplied The image is stored using a premultiplied 64-bit halfword-ordered
- RGBA format (16-16-16-16). (added in Qt 5.12)
- \value Format_BGR888 The image is stored using a 24-bit BGR format. (added in Qt 5.14)
-
- \note Drawing into a QImage with QImage::Format_Indexed8 is not
+ is the same on any architecture if read as bytes 0xRR,0xGG,0xBB,0xAA.
+ \value [since 5.2]
+ Format_RGBA8888_Premultiplied The image is stored using a
+ premultiplied 32-bit byte-ordered RGBA format (8-8-8-8).
+ \value [since 5.4]
+ Format_BGR30 The image is stored using a 32-bit BGR format (x-10-10-10).
+ \value [since 5.4]
+ Format_A2BGR30_Premultiplied The image is stored using a 32-bit premultiplied ABGR format (2-10-10-10).
+ \value [since 5.4]
+ Format_RGB30 The image is stored using a 32-bit RGB format (x-10-10-10).
+ \value [since 5.4]
+ Format_A2RGB30_Premultiplied The image is stored using a 32-bit premultiplied ARGB format (2-10-10-10).
+ \value [since 5.5]
+ Format_Alpha8 The image is stored using an 8-bit alpha only format.
+ \value [since 5.5]
+ Format_Grayscale8 The image is stored using an 8-bit grayscale format.
+ \value [since 5.13]
+ Format_Grayscale16 The image is stored using an 16-bit grayscale format.
+ \value [since 5.12]
+ Format_RGBX64 The image is stored using a 64-bit halfword-ordered RGB(x) format (16-16-16-16).
+ This is the same as the Format_RGBA64 except alpha must always be 65535.
+ \value [since 5.12]
+ Format_RGBA64 The image is stored using a 64-bit halfword-ordered RGBA format (16-16-16-16).
+ \value [since 5.12]
+ Format_RGBA64_Premultiplied The image is stored using a premultiplied 64-bit halfword-ordered
+ RGBA format (16-16-16-16).
+ \value [since 5.14]
+ Format_BGR888 The image is stored using a 24-bit BGR format.
+ \value [since 6.2]
+ Format_RGBX16FPx4 The image is stored using a four 16-bit halfword floating point RGBx format (16FP-16FP-16FP-16FP).
+ This is the same as the Format_RGBA16FPx4 except alpha must always be 1.0.
+ \value [since 6.2]
+ Format_RGBA16FPx4 The image is stored using a four 16-bit halfword floating point RGBA format (16FP-16FP-16FP-16FP).
+ \value [since 6.2]
+ Format_RGBA16FPx4_Premultiplied The image is stored using a premultiplied four 16-bit halfword floating point
+ RGBA format (16FP-16FP-16FP-16FP).
+ \value [since 6.2]
+ Format_RGBX32FPx4 The image is stored using a four 32-bit floating point RGBx format (32FP-32FP-32FP-32FP).
+ This is the same as the Format_RGBA32FPx4 except alpha must always be 1.0.
+ \value [since 6.2]
+ Format_RGBA32FPx4 The image is stored using a four 32-bit floating point RGBA format (32FP-32FP-32FP-32FP).
+ \value [since 6.2]
+ Format_RGBA32FPx4_Premultiplied The image is stored using a premultiplied four 32-bit floating point
+ RGBA format (32FP-32FP-32FP-32FP).
+ \value [since 6.8]
+ Format_CMYK8888 The image is stored using a 32-bit byte-ordered CMYK format.
+
+ \note Drawing into a QImage with format QImage::Format_Indexed8 or QImage::Format_CMYK8888 is not
supported.
\note Avoid most rendering directly to most of these formats using QPainter. Rendering
@@ -781,9 +826,9 @@ QImage::QImage(const QSize &size, Format format)
-QImageData *QImageData::create(uchar *data, int width, int height, int bpl, QImage::Format format, bool readOnly, QImageCleanupFunction cleanupFunction, void *cleanupInfo)
+QImageData *QImageData::create(uchar *data, int width, int height, qsizetype bpl, QImage::Format format, bool readOnly, QImageCleanupFunction cleanupFunction, void *cleanupInfo)
{
- if (width <= 0 || height <= 0 || !data || format == QImage::Format_Invalid)
+ if (width <= 0 || height <= 0 || !data || format <= QImage::Format_Invalid || format >= QImage::NImageFormats)
return nullptr;
const int depth = qt_depthForFormat(format);
@@ -793,13 +838,13 @@ QImageData *QImageData::create(uchar *data, int width, int height, int bpl, QIm
if (bpl > 0) {
// can't overflow, because has calculateImageParameters already done this multiplication
- const int min_bytes_per_line = (width * depth + 7)/8;
+ const qsizetype min_bytes_per_line = (qsizetype(width) * depth + 7)/8;
if (bpl < min_bytes_per_line)
return nullptr;
// recalculate the total with this value
params.bytesPerLine = bpl;
- if (mul_overflow<qsizetype>(bpl, height, &params.totalSize))
+ if (qMulOverflow<qsizetype>(bpl, height, &params.totalSize))
return nullptr;
}
@@ -894,13 +939,13 @@ QImage::QImage(const uchar* data, int width, int height, Format format, QImageCl
initially empty and must be sufficiently expanded with
setColorCount() or setColorTable() before the image is used.
*/
-QImage::QImage(uchar *data, int width, int height, int bytesPerLine, Format format, QImageCleanupFunction cleanupFunction, void *cleanupInfo)
+
+QImage::QImage(uchar *data, int width, int height, qsizetype bytesPerLine, Format format, QImageCleanupFunction cleanupFunction, void *cleanupInfo)
:QPaintDevice()
{
d = QImageData::create(data, width, height, bytesPerLine, format, false, cleanupFunction, cleanupInfo);
}
-
/*!
Constructs an image with the given \a width, \a height and \a
format, that uses an existing memory buffer, \a data. The \a width
@@ -926,7 +971,7 @@ QImage::QImage(uchar *data, int width, int height, int bytesPerLine, Format form
data being changed.
*/
-QImage::QImage(const uchar *data, int width, int height, int bytesPerLine, Format format, QImageCleanupFunction cleanupFunction, void *cleanupInfo)
+QImage::QImage(const uchar *data, int width, int height, qsizetype bytesPerLine, Format format, QImageCleanupFunction cleanupFunction, void *cleanupInfo)
:QPaintDevice()
{
d = QImageData::create(const_cast<uchar*>(data), width, height, bytesPerLine, format, true, cleanupFunction, cleanupInfo);
@@ -985,7 +1030,7 @@ QImage::QImage(const char * const xpm[])
if (!xpm)
return;
if (!qt_read_xpm_image_or_array(nullptr, xpm, *this))
- // Issue: Warning because the constructor may be ambigious
+ // Issue: Warning because the constructor may be ambiguous
qWarning("QImage::QImage(), XPM is not supported");
}
#endif // QT_NO_IMAGEFORMAT_XPM
@@ -1002,7 +1047,7 @@ QImage::QImage(const char * const xpm[])
QImage::QImage(const QImage &image)
: QPaintDevice()
{
- if (image.paintingActive() || isLocked(image.d)) {
+ if (image.paintingActive()) {
d = nullptr;
image.copy().swap(*this);
} else {
@@ -1034,7 +1079,7 @@ QImage::~QImage()
QImage &QImage::operator=(const QImage &image)
{
- if (image.paintingActive() || isLocked(image.d)) {
+ if (image.paintingActive()) {
operator=(image.copy());
} else {
if (image.d)
@@ -1067,7 +1112,7 @@ int QImage::devType() const
*/
QImage::operator QVariant() const
{
- return QVariant(QVariant::Image, this);
+ return QVariant::fromValue(*this);
}
/*!
@@ -1096,6 +1141,28 @@ void QImage::detach()
}
+/*!
+ \internal
+
+ A variant for metadata-only detach, which will not detach readonly image data,
+ and only invalidate caches of the image data if asked to.
+
+ \sa detach(), isDetached()
+*/
+void QImage::detachMetadata(bool invalidateCache)
+{
+ if (d) {
+ if (d->is_cached && d->ref.loadRelaxed() == 1)
+ QImagePixmapCleanupHooks::executeImageHooks(cacheKey());
+
+ if (d->ref.loadRelaxed() != 1)
+ *this = copy();
+
+ if (d && invalidateCache)
+ ++d->detach_no;
+ }
+}
+
static void copyPhysicalMetadata(QImageData *dst, const QImageData *src)
{
dst->dpmx = src->dpmx;
@@ -1105,9 +1172,10 @@ static void copyPhysicalMetadata(QImageData *dst, const QImageData *src)
static void copyMetadata(QImageData *dst, const QImageData *src)
{
- // Doesn't copy colortable and alpha_clut, or offset.
+ // Doesn't copy colortable and alpha_clut.
copyPhysicalMetadata(dst, src);
dst->text = src->text;
+ dst->offset = src->offset;
dst->colorSpace = src->colorSpace;
}
@@ -1152,8 +1220,9 @@ static void copyMetadata(QImage *dst, const QImage &src)
\sa QImage()
*/
-QImage QImage::copy(const QRect& r) const
+QImage Q_TRACE_INSTRUMENT(qtgui) QImage::copy(const QRect& r) const
{
+ Q_TRACE_SCOPE(QImage_copy, r);
if (!d)
return QImage();
@@ -1165,13 +1234,12 @@ QImage QImage::copy(const QRect& r) const
// Qt for Embedded Linux can create images with non-default bpl
// make sure we don't crash.
if (image.d->nbytes != d->nbytes) {
- int bpl = qMin(bytesPerLine(), image.bytesPerLine());
+ qsizetype bpl = qMin(bytesPerLine(), image.bytesPerLine());
for (int i = 0; i < height(); i++)
memcpy(image.scanLine(i), scanLine(i), bpl);
} else
memcpy(image.bits(), bits(), d->nbytes);
image.d->colortable = d->colortable;
- image.d->offset = d->offset;
image.d->has_alpha_clut = d->has_alpha_clut;
copyMetadata(image.d, d);
return image;
@@ -1224,7 +1292,7 @@ QImage QImage::copy(const QRect& r) const
if (byteAligned) {
const uchar *src = d->data + ((x * d->depth) >> 3) + y * d->bytes_per_line;
uchar *dest = image.d->data + ((dx * d->depth) >> 3) + dy * image.d->bytes_per_line;
- const int bytes_to_copy = (pixels_to_copy * d->depth) >> 3;
+ const qsizetype bytes_to_copy = (qsizetype(pixels_to_copy) * d->depth) >> 3;
for (int i = 0; i < lines_to_copy; ++i) {
memcpy(dest, src, bytes_to_copy);
src += d->bytes_per_line;
@@ -1260,7 +1328,6 @@ QImage QImage::copy(const QRect& r) const
}
copyMetadata(image.d, d);
- image.d->offset = offset();
image.d->has_alpha_clut = d->has_alpha_clut;
return image;
}
@@ -1307,7 +1374,7 @@ int QImage::height() const
Returns the size of the image, i.e. its width() and height().
- \sa {QImage#Image Information}{Image Information}
+ \sa {QImage#Image Information}{Image Information}, deviceIndependentSize()
*/
QSize QImage::size() const
{
@@ -1345,15 +1412,6 @@ int QImage::depth() const
}
/*!
- \obsolete
- \fn int QImage::numColors() const
-
- Returns the size of the color table for the image.
-
- \sa setColorCount()
-*/
-
-/*!
\since 4.6
\fn int QImage::colorCount() const
@@ -1381,25 +1439,17 @@ int QImage::colorCount() const
\sa colorTable(), setColor(), {QImage#Image Transformations}{Image
Transformations}
*/
-#if QT_VERSION >= QT_VERSION_CHECK(6,0,0)
-void QImage::setColorTable(const QVector<QRgb> &colors)
-#else
-void QImage::setColorTable(const QVector<QRgb> colors)
-#endif
+void QImage::setColorTable(const QList<QRgb> &colors)
{
if (!d)
return;
- detach();
+ detachMetadata(true);
// In case detach() ran out of memory
if (!d)
return;
-#if QT_VERSION >= QT_VERSION_CHECK(6,0,0)
d->colortable = colors;
-#else
- d->colortable = std::move(const_cast<QVector<QRgb>&>(colors));
-#endif
d->has_alpha_clut = false;
for (int i = 0; i < d->colortable.size(); ++i) {
if (qAlpha(d->colortable.at(i)) != 255) {
@@ -1415,9 +1465,9 @@ void QImage::setColorTable(const QVector<QRgb> colors)
\sa setColorTable(), colorCount(), color()
*/
-QVector<QRgb> QImage::colorTable() const
+QList<QRgb> QImage::colorTable() const
{
- return d ? d->colortable : QVector<QRgb>();
+ return d ? d->colortable : QList<QRgb>();
}
/*!
@@ -1457,7 +1507,7 @@ qreal QImage::devicePixelRatio() const
high-DPI image rather than a large image
(see \l{Drawing High Resolution Versions of Pixmaps and Images}).
- \sa devicePixelRatio()
+ \sa devicePixelRatio(), deviceIndependentSize()
*/
void QImage::setDevicePixelRatio(qreal scaleFactor)
{
@@ -1467,35 +1517,34 @@ void QImage::setDevicePixelRatio(qreal scaleFactor)
if (scaleFactor == d->devicePixelRatio)
return;
- detach();
+ detachMetadata();
if (d)
d->devicePixelRatio = scaleFactor;
}
-#if QT_DEPRECATED_SINCE(5, 10)
/*!
- \since 4.6
- \obsolete
- Returns the number of bytes occupied by the image data.
+ Returns the size of the image in device independent pixels.
- Note this method should never be called on an image larger than 2 gigabytes.
- Instead use sizeInBytes().
+ This value should be used when using the image size in user interface
+ size calculations.
- \sa sizeInBytes(), bytesPerLine(), bits(), {QImage#Image Information}{Image
- Information}
+ The return value is equivalent to image.size() / image.devicePixelRatio().
+
+ \since 6.2
*/
-int QImage::byteCount() const
+QSizeF QImage::deviceIndependentSize() const
{
- Q_ASSERT(!d || d->nbytes < std::numeric_limits<int>::max());
- return d ? int(d->nbytes) : 0;
+ if (!d)
+ return QSizeF(0, 0);
+ return QSizeF(d->width, d->height) / d->devicePixelRatio;
}
-#endif
+
/*!
\since 5.10
Returns the image data size in bytes.
- \sa byteCount(), bytesPerLine(), bits(), {QImage#Image Information}{Image
+ \sa bytesPerLine(), bits(), {QImage#Image Information}{Image
Information}
*/
qsizetype QImage::sizeInBytes() const
@@ -1510,17 +1559,10 @@ qsizetype QImage::sizeInBytes() const
\sa scanLine()
*/
-#if QT_VERSION >= QT_VERSION_CHECK(6,0,0)
qsizetype QImage::bytesPerLine() const
{
return d ? d->bytes_per_line : 0;
}
-#else
-int QImage::bytesPerLine() const
-{
- return d ? d->bytes_per_line : 0;
-}
-#endif
/*!
@@ -1560,7 +1602,7 @@ void QImage::setColor(int i, QRgb c)
qWarning("QImage::setColor: Index out of bound %d", i);
return;
}
- detach();
+ detachMetadata(true);
// In case detach() run out of memory
if (!d)
@@ -1580,6 +1622,10 @@ void QImage::setColor(int i, QRgb c)
it follows the native alignment of 64-bit integers (64-bit for most
platforms, but notably 32-bit on i386).
+ For example, to remove the green component of each pixel in an image:
+
+ \snippet code/src_gui_image_qimage.cpp scanLine
+
\warning If you are accessing 32-bpp image data, cast the returned
pointer to \c{QRgb*} (QRgb has a 32-bit size) and use it to
read/write the pixel value. You cannot use the \c{uchar*} pointer
@@ -1621,7 +1667,9 @@ const uchar *QImage::scanLine(int i) const
Returns a pointer to the pixel data at the scanline with index \a
i. The first scanline is at index 0.
- The scanline data is aligned on a 32-bit boundary.
+ The scanline data is as minimum 32-bit aligned. For 64-bit formats
+ it follows the native alignment of 64-bit integers (64-bit for most
+ platforms, but notably 32-bit on i386).
Note that QImage uses \l{Implicit Data Sharing} {implicit data
sharing}, but this function does \e not perform a deep copy of the
@@ -1702,11 +1750,11 @@ const uchar *QImage::constBits() const
the depth is 8, the lowest 8 bits are used and if the depth is 16
the lowest 16 bits are used.
- Note: QImage::pixel() returns the color of the pixel at the given
- coordinates while QColor::pixel() returns the pixel value of the
- underlying window system (essentially an index value), so normally
- you will want to use QImage::pixel() to use a color from an
- existing image or QColor::rgb() to use a specific color.
+ If the image depth is higher than 32bit the result is undefined.
+
+ \note There are no corresponding value getter, though QImage::pixelIndex()
+ will return the same value for indexed formats, and QImage::pixel() for
+ RGB32, ARGB32, and ARGB32PM formats.
\sa depth(), {QImage#Image Transformations}{Image Transformations}
*/
@@ -1737,18 +1785,40 @@ void QImage::fill(uint pixel)
w, d->height, d->bytes_per_line);
return;
} else if (d->depth == 16) {
+ if (d->format == Format_RGB444)
+ pixel |= 0xf000;
qt_rectfill<quint16>(reinterpret_cast<quint16*>(d->data), pixel,
0, 0, d->width, d->height, d->bytes_per_line);
return;
} else if (d->depth == 24) {
+ if (d->format == Format_RGB666)
+ pixel |= 0xfc0000;
qt_rectfill<quint24>(reinterpret_cast<quint24*>(d->data), pixel,
0, 0, d->width, d->height, d->bytes_per_line);
return;
- } else if (d->depth == 64) {
+ } else if (d->format >= QImage::Format_RGBX64 && d->format <= QImage::Format_RGBA64_Premultiplied) {
qt_rectfill<quint64>(reinterpret_cast<quint64*>(d->data), QRgba64::fromArgb32(pixel),
0, 0, d->width, d->height, d->bytes_per_line);
return;
+ } else if (d->format >= QImage::Format_RGBX16FPx4 && d->format <= QImage::Format_RGBA16FPx4_Premultiplied) {
+ quint64 cu;
+ QRgbaFloat16 cf = QRgbaFloat16::fromArgb32(pixel);
+ ::memcpy(&cu, &cf, sizeof(quint64));
+ qt_rectfill<quint64>(reinterpret_cast<quint64*>(d->data), cu,
+ 0, 0, d->width, d->height, d->bytes_per_line);
+ return;
+ } else if (d->format >= QImage::Format_RGBX32FPx4 && d->format <= QImage::Format_RGBA32FPx4_Premultiplied) {
+ QRgbaFloat32 cf = QRgbaFloat32::fromArgb32(pixel);
+ uchar *data = d->data;
+ for (int y = 0; y < d->height; ++y) {
+ QRgbaFloat32 *line = reinterpret_cast<QRgbaFloat32 *>(data);
+ for (int x = 0; x < d->width; ++x)
+ line[x] = cf;
+ data += d->bytes_per_line;
+ }
+ return;
}
+ Q_ASSERT(d->depth == 32);
if (d->format == Format_RGB32)
pixel |= 0xff000000;
@@ -1809,6 +1879,8 @@ void QImage::fill(const QColor &color)
if (!d)
return;
+ QRgba64 opaque = color.rgba64();
+ opaque.setAlpha(65535);
switch (d->format) {
case QImage::Format_RGB32:
case QImage::Format_ARGB32:
@@ -1827,12 +1899,10 @@ void QImage::fill(const QColor &color)
fill(ARGB2RGBA(qPremultiply(color.rgba())));
break;
case QImage::Format_BGR30:
- case QImage::Format_A2BGR30_Premultiplied:
- fill(qConvertRgb64ToRgb30<PixelOrderBGR>(color.rgba64()));
+ fill(qConvertRgb64ToRgb30<PixelOrderBGR>(opaque));
break;
case QImage::Format_RGB30:
- case QImage::Format_A2RGB30_Premultiplied:
- fill(qConvertRgb64ToRgb30<PixelOrderRGB>(color.rgba64()));
+ fill(qConvertRgb64ToRgb30<PixelOrderRGB>(opaque));
break;
case QImage::Format_RGB16:
fill((uint) qConvertRgb32To16(color.rgba()));
@@ -1855,19 +1925,43 @@ void QImage::fill(const QColor &color)
else
fill((uint) 0);
break;
- case QImage::Format_RGBX64: {
- QRgba64 c = color.rgba64();
- c.setAlpha(65535);
- qt_rectfill<quint64>(reinterpret_cast<quint64*>(d->data), c,
+ case QImage::Format_RGBX64:
+ qt_rectfill<quint64>(reinterpret_cast<quint64*>(d->data), opaque,
0, 0, d->width, d->height, d->bytes_per_line);
break;
-
- }
case QImage::Format_RGBA64:
- case QImage::Format_RGBA64_Premultiplied:
qt_rectfill<quint64>(reinterpret_cast<quint64*>(d->data), color.rgba64(),
0, 0, d->width, d->height, d->bytes_per_line);
break;
+ case QImage::Format_RGBA64_Premultiplied:
+ qt_rectfill<quint64>(reinterpret_cast<quint64 *>(d->data), color.rgba64().premultiplied(),
+ 0, 0, d->width, d->height, d->bytes_per_line);
+ break;
+ case QImage::Format_RGBX16FPx4:
+ case QImage::Format_RGBA16FPx4:
+ case QImage::Format_RGBA16FPx4_Premultiplied:
+ case QImage::Format_RGBX32FPx4:
+ case QImage::Format_RGBA32FPx4:
+ case QImage::Format_RGBA32FPx4_Premultiplied:{
+ float r, g, b, a;
+ color.getRgbF(&r, &g, &b, &a);
+ if (!hasAlphaChannel())
+ a = 1.0f;
+ if (depth() == 64) {
+ QRgbaFloat16 c16{qfloat16(r), qfloat16(g), qfloat16(b), qfloat16(a)};
+ if (d->format == Format_RGBA16FPx4_Premultiplied)
+ c16 = c16.premultiplied();
+ qt_rectfill<QRgbaFloat16>(reinterpret_cast<QRgbaFloat16 *>(d->data), c16,
+ 0, 0, d->width, d->height, d->bytes_per_line);
+ } else {
+ QRgbaFloat32 c32{r, g, b, a};
+ if (d->format == Format_RGBA32FPx4_Premultiplied)
+ c32 = c32.premultiplied();
+ qt_rectfill<QRgbaFloat32>(reinterpret_cast<QRgbaFloat32 *>(d->data), c32,
+ 0, 0, d->width, d->height, d->bytes_per_line);
+ }
+ break;
+ }
default: {
QPainter p(this);
p.setCompositionMode(QPainter::CompositionMode_Source);
@@ -1911,7 +2005,13 @@ void QImage::invertPixels(InvertMode mode)
QImage::Format originalFormat = d->format;
// Inverting premultiplied pixels would produce invalid image data.
if (hasAlphaChannel() && qPixelLayouts[d->format].premultiplied) {
- if (depth() > 32) {
+ if (d->format == QImage::Format_RGBA16FPx4_Premultiplied) {
+ if (!d->convertInPlace(QImage::Format_RGBA16FPx4, { }))
+ *this = convertToFormat(QImage::Format_RGBA16FPx4);
+ } else if (d->format == QImage::Format_RGBA32FPx4_Premultiplied) {
+ if (!d->convertInPlace(QImage::Format_RGBA32FPx4, { }))
+ *this = convertToFormat(QImage::Format_RGBA32FPx4);
+ } else if (depth() > 32) {
if (!d->convertInPlace(QImage::Format_RGBA64, { }))
*this = convertToFormat(QImage::Format_RGBA64);
} else {
@@ -1922,16 +2022,40 @@ void QImage::invertPixels(InvertMode mode)
if (depth() < 32) {
// This assumes no alpha-channel as the only formats with non-premultipled alpha are 32bit.
- int bpl = (d->width * d->depth + 7) / 8;
+ qsizetype bpl = (qsizetype(d->width) * d->depth + 7) / 8;
int pad = d->bytes_per_line - bpl;
uchar *sl = d->data;
for (int y=0; y<d->height; ++y) {
- for (int x=0; x<bpl; ++x)
+ for (qsizetype x=0; x<bpl; ++x)
*sl++ ^= 0xff;
sl += pad;
}
- }
- else if (depth() == 64) {
+ } else if (format() >= QImage::Format_RGBX16FPx4 && format() <= QImage::Format_RGBA16FPx4_Premultiplied) {
+ qfloat16 *p = reinterpret_cast<qfloat16 *>(d->data);
+ qfloat16 *end = reinterpret_cast<qfloat16 *>(d->data + d->nbytes);
+ while (p < end) {
+ p[0] = qfloat16(1) - p[0];
+ p[1] = qfloat16(1) - p[1];
+ p[2] = qfloat16(1) - p[2];
+ if (mode == InvertRgba)
+ p[3] = qfloat16(1) - p[3];
+ p += 4;
+ }
+ } else if (format() >= QImage::Format_RGBX32FPx4 && format() <= QImage::Format_RGBA32FPx4_Premultiplied) {
+ uchar *data = d->data;
+ for (int y = 0; y < d->height; ++y) {
+ float *p = reinterpret_cast<float *>(data);
+ for (int x = 0; x < d->width; ++x) {
+ p[0] = 1.0f - p[0];
+ p[1] = 1.0f - p[1];
+ p[2] = 1.0f - p[2];
+ if (mode == InvertRgba)
+ p[3] = 1.0f - p[3];
+ p += 4;
+ }
+ data += d->bytes_per_line;
+ }
+ } else if (depth() == 64) {
quint16 *p = (quint16*)d->data;
quint16 *end = (quint16*)(d->data + d->nbytes);
quint16 xorbits = 0xffff;
@@ -2020,7 +2144,7 @@ void QImage::setColorCount(int colorCount)
return;
}
- detach();
+ detachMetadata(true);
// In case detach() ran out of memory
if (!d)
@@ -2029,7 +2153,7 @@ void QImage::setColorCount(int colorCount)
if (colorCount == d->colortable.size())
return;
if (colorCount <= 0) { // use no color table
- d->colortable = QVector<QRgb>();
+ d->colortable.clear();
return;
}
int nc = d->colortable.size();
@@ -2057,7 +2181,20 @@ QImage::Format QImage::format() const
The specified image conversion \a flags control how the image data
is handled during the conversion process.
- \sa {Image Formats}
+ \sa convertTo(), {Image Formats}
+*/
+
+/*!
+ \fn QImage QImage::convertedTo(Format format, Qt::ImageConversionFlags flags) const &
+ \fn QImage QImage::convertedTo(Format format, Qt::ImageConversionFlags flags) &&
+ \since 6.0
+
+ Returns a copy of the image in the given \a format.
+
+ The specified image conversion \a flags control how the image data
+ is handled during the conversion process.
+
+ \sa convertTo(), {Image Formats}
*/
/*!
@@ -2068,7 +2205,7 @@ QImage QImage::convertToFormat_helper(Format format, Qt::ImageConversionFlags fl
if (!d || d->format == format)
return *this;
- if (format == Format_Invalid || d->format == Format_Invalid)
+ if (d->format == Format_Invalid || format <= Format_Invalid || format >= NImageFormats)
return QImage();
const QPixelLayout *destLayout = &qPixelLayouts[format];
@@ -2076,7 +2213,12 @@ QImage QImage::convertToFormat_helper(Format format, Qt::ImageConversionFlags fl
if (!converter && format > QImage::Format_Indexed8 && d->format > QImage::Format_Indexed8) {
if (qt_highColorPrecision(d->format, !destLayout->hasAlphaChannel)
&& qt_highColorPrecision(format, !hasAlphaChannel())) {
- converter = convert_generic_to_rgb64;
+#if QT_CONFIG(raster_fp)
+ if (qt_fpColorPrecision(d->format) && qt_fpColorPrecision(format))
+ converter = convert_generic_over_rgba32f;
+ else
+#endif
+ converter = convert_generic_over_rgb64;
} else
converter = convert_generic;
}
@@ -2085,7 +2227,6 @@ QImage QImage::convertToFormat_helper(Format format, Qt::ImageConversionFlags fl
QIMAGE_SANITYCHECK_MEMORY(image);
- image.d->offset = offset();
copyMetadata(image.d, d);
converter(image.d, d, flags);
@@ -2124,7 +2265,7 @@ static inline int pixel_distance(QRgb p1, QRgb p2) {
return abs(r1 - r2) + abs(g1 - g2) + abs(b1 - b2) + abs(a1 - a2);
}
-static inline int closestMatch(QRgb pixel, const QVector<QRgb> &clut) {
+static inline int closestMatch(QRgb pixel, const QList<QRgb> &clut) {
int idx = 0;
int current_distance = INT_MAX;
for (int i=0; i<clut.size(); ++i) {
@@ -2138,16 +2279,11 @@ static inline int closestMatch(QRgb pixel, const QVector<QRgb> &clut) {
}
static QImage convertWithPalette(const QImage &src, QImage::Format format,
- const QVector<QRgb> &clut) {
+ const QList<QRgb> &clut) {
QImage dest(src.size(), format);
dest.setColorTable(clut);
- QString textsKeys = src.text();
- const auto textKeyList = textsKeys.splitRef(QLatin1Char('\n'), QString::SkipEmptyParts);
- for (const auto &textKey : textKeyList) {
- const auto textKeySplitted = textKey.split(QLatin1String(": "));
- dest.setText(textKeySplitted[0].toString(), textKeySplitted[1].toString());
- }
+ copyMetadata(QImageData::get(dest), QImageData::get(src));
int h = src.height();
int w = src.width();
@@ -2169,7 +2305,7 @@ static QImage convertWithPalette(const QImage &src, QImage::Format format,
}
}
} else {
- QVector<QRgb> table = clut;
+ QList<QRgb> table = clut;
table.resize(2);
for (int y=0; y<h; ++y) {
const QRgb *src_pixels = (const QRgb *) src.scanLine(y);
@@ -2198,12 +2334,12 @@ static QImage convertWithPalette(const QImage &src, QImage::Format format,
and will use a straightforward nearest color approach, with no
dithering.
*/
-QImage QImage::convertToFormat(Format format, const QVector<QRgb> &colorTable, Qt::ImageConversionFlags flags) const
+QImage QImage::convertToFormat(Format format, const QList<QRgb> &colorTable, Qt::ImageConversionFlags flags) const
{
if (!d || d->format == format)
return *this;
- if (format == QImage::Format_Invalid)
+ if (format <= QImage::Format_Invalid || format >= QImage::NImageFormats)
return QImage();
if (format <= QImage::Format_Indexed8)
return convertWithPalette(convertToFormat(QImage::Format_ARGB32, flags), format, colorTable);
@@ -2248,6 +2384,7 @@ bool QImage::reinterpretAsFormat(Format format)
// In case detach() ran out of memory
if (!d) {
d = oldD;
+ d->ref.ref();
return false;
}
}
@@ -2259,17 +2396,20 @@ bool QImage::reinterpretAsFormat(Format format)
/*!
\since 5.13
- Detach and convert the image to the given \a format in place.
+ Converts the image to the given \a format in place, detaching if necessary.
The specified image conversion \a flags control how the image data
is handled during the conversion process.
- \sa convertToFormat()
+ \sa convertedTo()
*/
void QImage::convertTo(Format format, Qt::ImageConversionFlags flags)
{
- if (!d || format == QImage::Format_Invalid)
+ if (!d || format <= QImage::Format_Invalid || format >= QImage::NImageFormats)
+ return;
+
+ if (d->format == format)
return;
detach();
@@ -2411,6 +2551,14 @@ QRgb QImage::pixel(int x, int y) const
case Format_RGBA64: // Match ARGB32 behavior.
case Format_RGBA64_Premultiplied:
return reinterpret_cast<const QRgba64 *>(s)[x].toArgb32();
+ case Format_RGBX16FPx4:
+ case Format_RGBA16FPx4: // Match ARGB32 behavior.
+ case Format_RGBA16FPx4_Premultiplied:
+ return reinterpret_cast<const QRgbaFloat16 *>(s)[x].toArgb32();
+ case Format_RGBX32FPx4:
+ case Format_RGBA32FPx4: // Match ARGB32 behavior.
+ case Format_RGBA32FPx4_Premultiplied:
+ return reinterpret_cast<const QRgbaFloat32 *>(s)[x].toArgb32();
default:
break;
}
@@ -2487,7 +2635,7 @@ void QImage::setPixel(int x, int y, uint index_or_rgb)
((uint *)s)[x] = index_or_rgb;
return;
case Format_RGB16:
- ((quint16 *)s)[x] = qConvertRgb32To16(qUnpremultiply(index_or_rgb));
+ ((quint16 *)s)[x] = qConvertRgb32To16(index_or_rgb);
return;
case Format_RGBX8888:
((uint *)s)[x] = ARGB2RGBA(0xff000000 | index_or_rgb);
@@ -2508,6 +2656,27 @@ void QImage::setPixel(int x, int y, uint index_or_rgb)
case Format_A2RGB30_Premultiplied:
((uint *)s)[x] = qConvertArgb32ToA2rgb30<PixelOrderRGB>(index_or_rgb);
return;
+ case Format_RGBX64:
+ ((QRgba64 *)s)[x] = QRgba64::fromArgb32(index_or_rgb | 0xff000000);
+ return;
+ case Format_RGBA64:
+ case Format_RGBA64_Premultiplied:
+ ((QRgba64 *)s)[x] = QRgba64::fromArgb32(index_or_rgb);
+ return;
+ case Format_RGBX16FPx4:
+ ((QRgbaFloat16 *)s)[x] = QRgbaFloat16::fromArgb32(index_or_rgb | 0xff000000);
+ return;
+ case Format_RGBA16FPx4:
+ case Format_RGBA16FPx4_Premultiplied:
+ ((QRgbaFloat16 *)s)[x] = QRgbaFloat16::fromArgb32(index_or_rgb);
+ return;
+ case Format_RGBX32FPx4:
+ ((QRgbaFloat32 *)s)[x] = QRgbaFloat32::fromArgb32(index_or_rgb | 0xff000000);
+ return;
+ case Format_RGBA32FPx4:
+ case Format_RGBA32FPx4_Premultiplied:
+ ((QRgbaFloat32 *)s)[x] = QRgbaFloat32::fromArgb32(index_or_rgb);
+ return;
case Format_Invalid:
case NImageFormats:
Q_ASSERT(false);
@@ -2517,7 +2686,10 @@ void QImage::setPixel(int x, int y, uint index_or_rgb)
}
const QPixelLayout *layout = &qPixelLayouts[d->format];
- layout->storeFromARGB32PM(s, &index_or_rgb, x, 1, nullptr, nullptr);
+ if (!hasAlphaChannel())
+ layout->storeFromRGB32(s, &index_or_rgb, x, 1, nullptr, nullptr);
+ else
+ layout->storeFromARGB32PM(s, &index_or_rgb, x, 1, nullptr, nullptr);
}
/*!
@@ -2569,6 +2741,26 @@ QColor QImage::pixelColor(int x, int y) const
quint16 v = reinterpret_cast<const quint16 *>(s)[x];
return QColor(qRgba64(v, v, v, 0xffff));
}
+ case Format_RGBX16FPx4:
+ case Format_RGBA16FPx4:
+ case Format_RGBA16FPx4_Premultiplied: {
+ QRgbaFloat16 p = reinterpret_cast<const QRgbaFloat16 *>(s)[x];
+ if (d->format == Format_RGBA16FPx4_Premultiplied)
+ p = p.unpremultiplied();
+ QColor color;
+ color.setRgbF(p.red(), p.green(), p.blue(), p.alpha());
+ return color;
+ }
+ case Format_RGBX32FPx4:
+ case Format_RGBA32FPx4:
+ case Format_RGBA32FPx4_Premultiplied: {
+ QRgbaFloat32 p = reinterpret_cast<const QRgbaFloat32 *>(s)[x];
+ if (d->format == Format_RGBA32FPx4_Premultiplied)
+ p = p.unpremultiplied();
+ QColor color;
+ color.setRgbF(p.red(), p.green(), p.blue(), p.alpha());
+ return color;
+ }
default:
c = QRgba64::fromArgb32(pixel(x, y));
break;
@@ -2640,13 +2832,36 @@ void QImage::setPixelColor(int x, int y, const QColor &color)
((uint *)s)[x] = qConvertRgb64ToRgb30<PixelOrderRGB>(c);
return;
case Format_RGBX64:
- ((QRgba64 *)s)[x] = color.rgba64();
- ((QRgba64 *)s)[x].setAlpha(65535);
- return;
case Format_RGBA64:
case Format_RGBA64_Premultiplied:
- ((QRgba64 *)s)[x] = color.rgba64();
+ ((QRgba64 *)s)[x] = c;
+ return;
+ case Format_RGBX16FPx4:
+ case Format_RGBA16FPx4:
+ case Format_RGBA16FPx4_Premultiplied: {
+ float r, g, b, a;
+ color.getRgbF(&r, &g, &b, &a);
+ if (d->format == Format_RGBX16FPx4)
+ a = 1.0f;
+ QRgbaFloat16 c16f{qfloat16(r), qfloat16(g), qfloat16(b), qfloat16(a)};
+ if (d->format == Format_RGBA16FPx4_Premultiplied)
+ c16f = c16f.premultiplied();
+ ((QRgbaFloat16 *)s)[x] = c16f;
+ return;
+ }
+ case Format_RGBX32FPx4:
+ case Format_RGBA32FPx4:
+ case Format_RGBA32FPx4_Premultiplied: {
+ float r, g, b, a;
+ color.getRgbF(&r, &g, &b, &a);
+ if (d->format == Format_RGBX32FPx4)
+ a = 1.0f;
+ QRgbaFloat32 c32f{r, g, b, a};
+ if (d->format == Format_RGBA32FPx4_Premultiplied)
+ c32f = c32f.premultiplied();
+ ((QRgbaFloat32 *)s)[x] = c32f;
return;
+ }
default:
setPixel(x, y, c.toArgb32());
return;
@@ -2803,7 +3018,7 @@ bool QImage::isGrayscale() const
\sa isNull(), {QImage#Image Transformations}{Image
Transformations}
*/
-QImage QImage::scaled(const QSize& s, Qt::AspectRatioMode aspectMode, Qt::TransformationMode mode) const
+QImage Q_TRACE_INSTRUMENT(qtgui) QImage::scaled(const QSize& s, Qt::AspectRatioMode aspectMode, Qt::TransformationMode mode) const
{
if (!d) {
qWarning("QImage::scaled: Image is a null image");
@@ -2819,6 +3034,8 @@ QImage QImage::scaled(const QSize& s, Qt::AspectRatioMode aspectMode, Qt::Transf
if (newSize == size())
return *this;
+ Q_TRACE_SCOPE(QImage_scaled, s, aspectMode, mode);
+
QTransform wm = QTransform::fromScale((qreal)newSize.width() / width(), (qreal)newSize.height() / height());
QImage img = transformed(wm, mode);
return img;
@@ -2838,7 +3055,7 @@ QImage QImage::scaled(const QSize& s, Qt::AspectRatioMode aspectMode, Qt::Transf
\sa {QImage#Image Transformations}{Image Transformations}
*/
-QImage QImage::scaledToWidth(int w, Qt::TransformationMode mode) const
+QImage Q_TRACE_INSTRUMENT(qtgui) QImage::scaledToWidth(int w, Qt::TransformationMode mode) const
{
if (!d) {
qWarning("QImage::scaleWidth: Image is a null image");
@@ -2847,6 +3064,8 @@ QImage QImage::scaledToWidth(int w, Qt::TransformationMode mode) const
if (w <= 0)
return QImage();
+ Q_TRACE_SCOPE(QImage_scaledToWidth, w, mode);
+
qreal factor = (qreal) w / width();
QTransform wm = QTransform::fromScale(factor, factor);
return transformed(wm, mode);
@@ -2866,7 +3085,7 @@ QImage QImage::scaledToWidth(int w, Qt::TransformationMode mode) const
\sa {QImage#Image Transformations}{Image Transformations}
*/
-QImage QImage::scaledToHeight(int h, Qt::TransformationMode mode) const
+QImage Q_TRACE_INSTRUMENT(qtgui) QImage::scaledToHeight(int h, Qt::TransformationMode mode) const
{
if (!d) {
qWarning("QImage::scaleHeight: Image is a null image");
@@ -2875,58 +3094,13 @@ QImage QImage::scaledToHeight(int h, Qt::TransformationMode mode) const
if (h <= 0)
return QImage();
+ Q_TRACE_SCOPE(QImage_scaledToHeight, h, mode);
+
qreal factor = (qreal) h / height();
QTransform wm = QTransform::fromScale(factor, factor);
return transformed(wm, mode);
}
-
-/*!
- \fn QMatrix QImage::trueMatrix(const QMatrix &matrix, int width, int height)
-
- Returns the actual matrix used for transforming an image with the
- given \a width, \a height and \a matrix.
-
- When transforming an image using the transformed() function, the
- transformation matrix is internally adjusted to compensate for
- unwanted translation, i.e. transformed() returns the smallest
- image containing all transformed points of the original image.
- This function returns the modified matrix, which maps points
- correctly from the original image into the new image.
-
- \sa transformed(), {QImage#Image Transformations}{Image
- Transformations}
-*/
-QMatrix QImage::trueMatrix(const QMatrix &matrix, int w, int h)
-{
- return trueMatrix(QTransform(matrix), w, h).toAffine();
-}
-
-/*!
- Returns a copy of the image that is transformed using the given
- transformation \a matrix and transformation \a mode.
-
- The returned image will normally have the same {Image Formats}{format} as
- the original image. However, a complex transformation may result in an
- image where not all pixels are covered by the transformed pixels of the
- original image. In such cases, those background pixels will be assigned a
- transparent color value, and the transformed image will be given a format
- with an alpha channel, even if the orginal image did not have that.
-
- The transformation \a matrix is internally adjusted to compensate
- for unwanted translation; i.e. the image produced is the smallest
- image that contains all the transformed points of the original
- image. Use the trueMatrix() function to retrieve the actual matrix
- used for transforming an image.
-
- \sa trueMatrix(), {QImage#Image Transformations}{Image
- Transformations}
-*/
-QImage QImage::transformed(const QMatrix &matrix, Qt::TransformationMode mode) const
-{
- return transformed(QTransform(matrix), mode);
-}
-
/*!
Builds and returns a 1-bpp mask from the alpha buffer in this
image. Returns a null image if the image's format is
@@ -2944,7 +3118,7 @@ QImage QImage::transformed(const QMatrix &matrix, Qt::TransformationMode mode) c
\sa createHeuristicMask(), {QImage#Image Transformations}{Image
Transformations}
*/
-QImage QImage::createAlphaMask(Qt::ImageConversionFlags flags) const
+QImage Q_TRACE_INSTRUMENT(qtgui) QImage::createAlphaMask(Qt::ImageConversionFlags flags) const
{
if (!d || d->format == QImage::Format_RGB32)
return QImage();
@@ -3100,6 +3274,8 @@ QImage QImage::createMaskFromColor(QRgb color, Qt::MaskMode mode) const
QIMAGE_SANITYCHECK_MEMORY(maskImage);
maskImage.fill(0);
uchar *s = maskImage.bits();
+ if (!s)
+ return QImage();
if (depth() == 32) {
for (int h = 0; h < d->height; h++) {
@@ -3136,7 +3312,17 @@ QImage QImage::createMaskFromColor(QRgb color, Qt::MaskMode mode) const
Note that the original image is not changed.
- \sa {QImage#Image Transformations}{Image Transformations}
+ \sa mirror(), {QImage#Image Transformations}{Image Transformations}
+*/
+
+/*!
+ \fn void QImage::mirror(bool horizontal = false, bool vertical = true)
+ \since 6.0
+
+ Mirrors of the image in the horizontal and/or the vertical direction depending
+ on whether \a horizontal and \a vertical are set to true or false.
+
+ \sa mirrored(), {QImage#Image Transformations}{Image Transformations}
*/
template<class T> inline void do_mirror_data(QImageData *dst, QImageData *src,
@@ -3236,6 +3422,9 @@ inline void do_mirror(QImageData *dst, QImageData *src, bool horizontal, bool ve
}
switch (depth) {
+ case 128:
+ do_mirror_data<QRgbaFloat32>(dst, src, dstX0, dstY0, dstXIncr, dstYIncr, w, h);
+ break;
case 64:
do_mirror_data<quint64>(dst, src, dstX0, dstY0, dstXIncr, dstYIncr, w, h);
break;
@@ -3348,7 +3537,17 @@ void QImage::mirrored_inplace(bool horizontal, bool vertical)
The original QImage is not changed.
- \sa {QImage#Image Transformations}{Image Transformations}
+ \sa rgbSwap(), {QImage#Image Transformations}{Image Transformations}
+*/
+
+/*!
+ \fn void QImage::rgbSwap()
+ \since 6.0
+
+ Swaps the values of the red and blue components of all pixels, effectively converting
+ an RGB image to an BGR image.
+
+ \sa rgbSwapped(), {QImage#Image Transformations}{Image Transformations}
*/
static inline void rgbSwapped_generic(int width, int height, const QImage *src, QImage *dst, const QPixelLayout* layout)
@@ -3371,11 +3570,13 @@ static inline void rgbSwapped_generic(int width, int height, const QImage *src,
/*!
\internal
*/
-QImage QImage::rgbSwapped_helper() const
+QImage Q_TRACE_INSTRUMENT(qtgui) QImage::rgbSwapped_helper() const
{
if (isNull())
return *this;
+ Q_TRACE_SCOPE(QImage_rgbSwapped_helper);
+
QImage res;
switch (d->format) {
@@ -3450,25 +3651,9 @@ QImage QImage::rgbSwapped_helper() const
}
}
break;
- case Format_RGBX64:
- case Format_RGBA64:
- case Format_RGBA64_Premultiplied:
- res = QImage(d->width, d->height, d->format);
- QIMAGE_SANITYCHECK_MEMORY(res);
- for (int i = 0; i < d->height; i++) {
- QRgba64 *q = reinterpret_cast<QRgba64 *>(res.scanLine(i));
- const QRgba64 *p = reinterpret_cast<const QRgba64 *>(constScanLine(i));
- const QRgba64 *end = p + d->width;
- while (p < end) {
- QRgba64 c = *p;
- *q = QRgba64::fromRgba64(c.blue(), c.green(), c.red(), c.alpha());
- p++;
- q++;
- }
- }
- break;
default:
res = QImage(d->width, d->height, d->format);
+ QIMAGE_SANITYCHECK_MEMORY(res);
rgbSwapped_generic(d->width, d->height, this, &res, &qPixelLayouts[d->format]);
break;
}
@@ -3562,19 +3747,6 @@ void QImage::rgbSwapped_inplace()
}
}
break;
- case Format_RGBX64:
- case Format_RGBA64:
- case Format_RGBA64_Premultiplied:
- for (int i = 0; i < d->height; i++) {
- QRgba64 *p = reinterpret_cast<QRgba64 *>(scanLine(i));
- QRgba64 *end = p + d->width;
- while (p < end) {
- QRgba64 c = *p;
- *p = QRgba64::fromRgba64(c.blue(), c.green(), c.red(), c.alpha());
- p++;
- }
- }
- break;
default:
rgbSwapped_generic(d->width, d->height, this, this, &qPixelLayouts[d->format]);
break;
@@ -3620,11 +3792,10 @@ bool QImage::load(QIODevice* device, const char* format)
}
/*!
- \fn bool QImage::loadFromData(const uchar *data, int len, const char *format)
+ \since 6.2
- Loads an image from the first \a len bytes of the given binary \a
- data. Returns \c true if the image was successfully loaded; otherwise
- invalidates the image and returns \c false.
+ Loads an image from the given QByteArrayView \a data. Returns \c true if the image was
+ successfully loaded; otherwise invalidates the image and returns \c false.
The loader attempts to read the image using the specified \a format, e.g.,
PNG or JPG. If \a format is not specified (which is the default), the
@@ -3633,13 +3804,26 @@ bool QImage::load(QIODevice* device, const char* format)
\sa {QImage#Reading and Writing Image Files}{Reading and Writing Image Files}
*/
-bool QImage::loadFromData(const uchar *data, int len, const char *format)
+bool QImage::loadFromData(QByteArrayView data, const char *format)
{
- *this = fromData(data, len, format);
+ *this = fromData(data, format);
return !isNull();
}
/*!
+ \fn bool QImage::loadFromData(const uchar *data, int len, const char *format)
+
+ \overload
+
+ Loads an image from the first \a len bytes of the given binary \a data.
+*/
+
+bool QImage::loadFromData(const uchar *buf, int len, const char *format)
+{
+ return loadFromData(QByteArrayView(buf, len), format);
+}
+
+/*!
\fn bool QImage::loadFromData(const QByteArray &data, const char *format)
\overload
@@ -3648,12 +3832,11 @@ bool QImage::loadFromData(const uchar *data, int len, const char *format)
*/
/*!
- \fn QImage QImage::fromData(const uchar *data, int size, const char *format)
+ \since 6.2
- Constructs a QImage from the first \a size bytes of the given
- binary \a data. The loader attempts to read the image using the
- specified \a format. If \a format is not specified (which is the default),
- the loader probes the data for a header to guess the file format.
+ Constructs an image from the given QByteArrayView \a data. The loader attempts to read the image
+ using the specified \a format. If \a format is not specified (which is the default), the loader
+ probes the data for a header to guess the file format.
If \a format is specified, it must be one of the values returned by
QImageReader::supportedImageFormats().
@@ -3663,9 +3846,9 @@ bool QImage::loadFromData(const uchar *data, int len, const char *format)
\sa load(), save(), {QImage#Reading and Writing Image Files}{Reading and Writing Image Files}
*/
-QImage QImage::fromData(const uchar *data, int size, const char *format)
+QImage QImage::fromData(QByteArrayView data, const char *format)
{
- QByteArray a = QByteArray::fromRawData(reinterpret_cast<const char *>(data), size);
+ QByteArray a = QByteArray::fromRawData(data.constData(), data.size());
QBuffer b;
b.setData(a);
b.open(QIODevice::ReadOnly);
@@ -3673,18 +3856,32 @@ QImage QImage::fromData(const uchar *data, int size, const char *format)
}
/*!
+ \fn QImage QImage::fromData(const uchar *data, int size, const char *format)
+
+ \overload
+
+ Constructs a QImage from the first \a size bytes of the given binary \a data.
+*/
+
+QImage QImage::fromData(const uchar *data, int size, const char *format)
+{
+ return fromData(QByteArrayView(data, size), format);
+}
+
+/*!
\fn QImage QImage::fromData(const QByteArray &data, const char *format)
\overload
- Loads an image from the given QByteArray \a data.
+ Constructs a QImage from the given QByteArray \a data.
+
*/
/*!
Saves the image to the file with the given \a fileName, using the
given image file \a format and \a quality factor. If \a format is
- 0, QImage will attempt to guess the format by looking at \a fileName's
- suffix.
+ \nullptr, QImage will attempt to guess the format by looking at
+ \a fileName's suffix.
The \a quality factor must be in the range 0 to 100 or -1. Specify
0 to obtain small compressed files, 100 for large uncompressed
@@ -3729,10 +3926,15 @@ bool QImage::save(QIODevice* device, const char* format, int quality) const
bool QImageData::doImageIO(const QImage *image, QImageWriter *writer, int quality) const
{
if (quality > 100 || quality < -1)
- qWarning("QPixmap::save: Quality out of range [-1, 100]");
+ qWarning("QImage::save: Quality out of range [-1, 100]");
if (quality >= 0)
writer->setQuality(qMin(quality,100));
- return writer->write(*image);
+ const bool result = writer->write(*image);
+#ifdef QT_DEBUG
+ if (!result)
+ qWarning("QImage::save: failed to write image - %s", qPrintable(writer->errorString()));
+#endif
+ return result;
}
/*****************************************************************************
@@ -3817,7 +4019,7 @@ bool QImage::operator==(const QImage & i) const
return false;
// obviously different stuff?
- if (i.d->height != d->height || i.d->width != d->width || i.d->format != d->format)
+ if (i.d->height != d->height || i.d->width != d->width || i.d->format != d->format || i.d->colorSpace != d->colorSpace)
return false;
if (d->format != Format_RGB32) {
@@ -3835,8 +4037,8 @@ bool QImage::operator==(const QImage & i) const
} else {
const int w = width();
const int h = height();
- const QVector<QRgb> &colortable = d->colortable;
- const QVector<QRgb> &icolortable = i.d->colortable;
+ const QList<QRgb> &colortable = d->colortable;
+ const QList<QRgb> &icolortable = i.d->colortable;
for (int y=0; y<h; ++y) {
for (int x=0; x<w; ++x) {
if (colortable[pixelIndex(x, y)] != icolortable[i.pixelIndex(x, y)])
@@ -3921,9 +4123,9 @@ int QImage::dotsPerMeterY() const
*/
void QImage::setDotsPerMeterX(int x)
{
- if (!d || !x)
+ if (!d || !x || d->dpmx == x)
return;
- detach();
+ detachMetadata();
if (d)
d->dpmx = x;
@@ -3943,9 +4145,9 @@ void QImage::setDotsPerMeterX(int x)
*/
void QImage::setDotsPerMeterY(int y)
{
- if (!d || !y)
+ if (!d || !y || d->dpmy == y)
return;
- detach();
+ detachMetadata();
if (d)
d->dpmy = y;
@@ -3975,9 +4177,9 @@ QPoint QImage::offset() const
*/
void QImage::setOffset(const QPoint& p)
{
- if (!d)
+ if (!d || d->offset == p)
return;
- detach();
+ detachMetadata();
if (d)
d->offset = p;
@@ -4013,7 +4215,7 @@ QString QImage::text(const QString &key) const
QString tmp;
for (auto it = d->text.begin(), end = d->text.end(); it != end; ++it)
- tmp += it.key() + QLatin1String(": ") + it.value().simplified() + QLatin1String("\n\n");
+ tmp += it.key() + ": "_L1 + it.value().simplified() + "\n\n"_L1;
if (!tmp.isEmpty())
tmp.chop(2); // remove final \n\n
return tmp;
@@ -4047,78 +4249,17 @@ void QImage::setText(const QString &key, const QString &value)
{
if (!d)
return;
- detach();
+ detachMetadata();
if (d)
d->text.insert(key, value);
}
/*!
- \fn QString QImage::text(const char* key, const char* language) const
- \obsolete
-
- Returns the text recorded for the given \a key in the given \a
- language, or in a default language if \a language is 0.
-
- Use text() instead.
-
- The language the text is recorded in is no longer relevant since
- the text is always set using QString and UTF-8 representation.
-*/
-
-/*!
- \fn QString QImage::text(const QImageTextKeyLang& keywordAndLanguage) const
- \overload
- \obsolete
-
- Returns the text recorded for the given \a keywordAndLanguage.
-
- Use text() instead.
-
- The language the text is recorded in is no longer relevant since
- the text is always set using QString and UTF-8 representation.
-*/
-
-/*!
- \fn void QImage::setText(const char* key, const char* language, const QString& text)
- \obsolete
-
- Sets the image text to the given \a text and associate it with the
- given \a key. The text is recorded in the specified \a language,
- or in a default language if \a language is 0.
-
- Use setText() instead.
-
- The language the text is recorded in is no longer relevant since
- the text is always set using QString and UTF-8 representation.
-
- \omit
- Records string \a for the keyword \a key. The \a key should be
- a portable keyword recognizable by other software - some suggested
- values can be found in
- \l{http://www.libpng.org/pub/png/spec/1.2/png-1.2-pdg.html#C.Anc-text}
- {the PNG specification}. \a s can be any text. \a lang should
- specify the language code (see
- \l{http://www.rfc-editor.org/rfc/rfc1766.txt}{RFC 1766}) or 0.
- \endomit
-*/
-
-/*
- Sets the image bits to the \a pixmap contents and returns a
- reference to the image.
-
- If the image shares data with other images, it will first
- dereference the shared data.
-
- Makes a call to QPixmap::convertToImage().
-*/
-
-/*!
\internal
Used by QPainter to retrieve a paint engine for the image.
*/
-
QPaintEngine *QImage::paintEngine() const
{
if (!d)
@@ -4250,8 +4391,8 @@ int QImage::metric(PaintDeviceMetric metric) const
trigy += m12;
// END OF MACRO
bool qt_xForm_helper(const QTransform &trueMat, int xoffset, int type, int depth,
- uchar *dptr, int dbpl, int p_inc, int dHeight,
- const uchar *sptr, int sbpl, int sWidth, int sHeight)
+ uchar *dptr, qsizetype dbpl, int p_inc, int dHeight,
+ const uchar *sptr, qsizetype sbpl, int sWidth, int sHeight)
{
int m11 = int(trueMat.m11()*4096.0);
int m12 = int(trueMat.m12()*4096.0);
@@ -4364,22 +4505,6 @@ bool qt_xForm_helper(const QTransform &trueMat, int xoffset, int type, int depth
#undef IWX_LSB
#undef IWX_PIX
-/*! \fn int QImage::serialNumber() const
- \obsolete
- Returns a number that identifies the contents of this
- QImage object. Distinct QImage objects can only have the same
- serial number if they refer to the same contents (but they don't
- have to).
-
- Use cacheKey() instead.
-
- \warning The serial number doesn't necessarily change when the
- image is altered. This means that it may be dangerous to use
- it as a cache key.
-
- \sa operator==()
-*/
-
/*!
Returns a number that identifies the contents of this QImage
object. Distinct QImage objects can only have the same key if they
@@ -4410,187 +4535,57 @@ bool QImage::isDetached() const
/*!
- \obsolete
Sets the alpha channel of this image to the given \a alphaChannel.
- If \a alphaChannel is an 8 bit grayscale image, the intensity values are
- written into this buffer directly. Otherwise, \a alphaChannel is converted
- to 32 bit and the intensity of the RGB pixel values is used.
-
- Note that the image will be converted to the Format_ARGB32_Premultiplied
- format if the function succeeds.
+ If \a alphaChannel is an 8 bit alpha image, the alpha values are
+ used directly. Otherwise, \a alphaChannel is converted to 8 bit
+ grayscale and the intensity of the pixel values is used.
- Use one of the composition modes in QPainter::CompositionMode instead.
+ If the image already has an alpha channel, the existing alpha channel
+ is multiplied with the new one. If the image doesn't have an alpha
+ channel it will be converted to a format that does.
- \warning This function is expensive.
+ The operation is similar to painting \a alphaChannel as an alpha image
+ over this image using \c QPainter::CompositionMode_DestinationIn.
- \sa alphaChannel(), {QImage#Image Transformations}{Image
- Transformations}, {QImage#Image Formats}{Image Formats}
+ \sa hasAlphaChannel(),
+ {QImage#Image Transformations}{Image Transformations},
+ {QImage#Image Formats}{Image Formats}
*/
void QImage::setAlphaChannel(const QImage &alphaChannel)
{
- if (!d)
+ if (!d || alphaChannel.isNull())
return;
- int w = d->width;
- int h = d->height;
-
- if (w != alphaChannel.d->width || h != alphaChannel.d->height) {
- qWarning("QImage::setAlphaChannel: "
- "Alpha channel must have same dimensions as the target image");
- return;
- }
-
if (d->paintEngine && d->paintEngine->isActive()) {
qWarning("QImage::setAlphaChannel: "
"Unable to set alpha channel while image is being painted on");
return;
}
- if (d->format == QImage::Format_ARGB32_Premultiplied)
+ const Format alphaFormat = qt_alphaVersionForPainting(d->format);
+ if (d->format == alphaFormat)
detach();
else
- *this = convertToFormat(QImage::Format_ARGB32_Premultiplied);
+ convertTo(alphaFormat);
if (isNull())
return;
- // Slight optimization since alphachannels are returned as 8-bit grays.
- if (alphaChannel.format() == QImage::Format_Alpha8 ||( alphaChannel.d->depth == 8 && alphaChannel.isGrayscale())) {
- const uchar *src_data = alphaChannel.d->data;
- uchar *dest_data = d->data;
- for (int y=0; y<h; ++y) {
- const uchar *src = src_data;
- QRgb *dest = (QRgb *)dest_data;
- for (int x=0; x<w; ++x) {
- int alpha = *src;
- int destAlpha = qt_div_255(alpha * qAlpha(*dest));
- *dest = ((destAlpha << 24)
- | (qt_div_255(qRed(*dest) * alpha) << 16)
- | (qt_div_255(qGreen(*dest) * alpha) << 8)
- | (qt_div_255(qBlue(*dest) * alpha)));
- ++dest;
- ++src;
- }
- src_data += alphaChannel.d->bytes_per_line;
- dest_data += d->bytes_per_line;
- }
-
- } else {
- const QImage sourceImage = alphaChannel.convertToFormat(QImage::Format_RGB32);
- if (sourceImage.isNull())
- return;
- const uchar *src_data = sourceImage.d->data;
- uchar *dest_data = d->data;
- for (int y=0; y<h; ++y) {
- const QRgb *src = (const QRgb *) src_data;
- QRgb *dest = (QRgb *) dest_data;
- for (int x=0; x<w; ++x) {
- int alpha = qGray(*src);
- int destAlpha = qt_div_255(alpha * qAlpha(*dest));
- *dest = ((destAlpha << 24)
- | (qt_div_255(qRed(*dest) * alpha) << 16)
- | (qt_div_255(qGreen(*dest) * alpha) << 8)
- | (qt_div_255(qBlue(*dest) * alpha)));
- ++dest;
- ++src;
- }
- src_data += sourceImage.d->bytes_per_line;
- dest_data += d->bytes_per_line;
- }
- }
-}
-
-
-/*!
- \obsolete
-
- Returns the alpha channel of the image as a new grayscale QImage in which
- each pixel's red, green, and blue values are given the alpha value of the
- original image. The color depth of the returned image is 8-bit.
-
- You can see an example of use of this function in QPixmap's
- \l{QPixmap::}{alphaChannel()}, which works in the same way as
- this function on QPixmaps.
-
- Most usecases for this function can be replaced with QPainter and
- using composition modes.
-
- Note this returns a color-indexed image if you want the alpha channel in
- the alpha8 format instead use convertToFormat(Format_Alpha8) on the source
- image.
-
- \warning This is an expensive function.
-
- \sa setAlphaChannel(), hasAlphaChannel(), convertToFormat(),
- {QPixmap#Pixmap Information}{Pixmap},
- {QImage#Image Transformations}{Image Transformations}
-*/
-
-QImage QImage::alphaChannel() const
-{
- if (!d)
- return QImage();
-
- int w = d->width;
- int h = d->height;
-
- QImage image(w, h, Format_Indexed8);
- image.setColorCount(256);
-
- // set up gray scale table.
- for (int i=0; i<256; ++i)
- image.setColor(i, qRgb(i, i, i));
-
- if (!hasAlphaChannel()) {
- image.fill(255);
- return image;
- }
-
- if (d->format == Format_Indexed8) {
- const uchar *src_data = d->data;
- uchar *dest_data = image.d->data;
- for (int y=0; y<h; ++y) {
- const uchar *src = src_data;
- uchar *dest = dest_data;
- for (int x=0; x<w; ++x) {
- *dest = qAlpha(d->colortable.at(*src));
- ++dest;
- ++src;
- }
- src_data += d->bytes_per_line;
- dest_data += image.d->bytes_per_line;
- }
- } else if (d->format == Format_Alpha8) {
- const uchar *src_data = d->data;
- uchar *dest_data = image.d->data;
- memcpy(dest_data, src_data, d->bytes_per_line * h);
- } else {
- QImage alpha32 = *this;
- bool canSkipConversion = (d->format == Format_ARGB32 || d->format == Format_ARGB32_Premultiplied);
-#if Q_BYTE_ORDER == Q_LITTLE_ENDIAN
- canSkipConversion = canSkipConversion || (d->format == Format_RGBA8888 || d->format == Format_RGBA8888_Premultiplied);
-#endif
- if (!canSkipConversion)
- alpha32 = convertToFormat(Format_ARGB32);
-
- const uchar *src_data = alpha32.d->data;
- uchar *dest_data = image.d->data;
- for (int y=0; y<h; ++y) {
- const QRgb *src = (const QRgb *) src_data;
- uchar *dest = dest_data;
- for (int x=0; x<w; ++x) {
- *dest = qAlpha(*src);
- ++dest;
- ++src;
- }
- src_data += alpha32.d->bytes_per_line;
- dest_data += image.d->bytes_per_line;
- }
- }
+ QImage sourceImage;
+ if (alphaChannel.format() == QImage::Format_Alpha8 || (alphaChannel.d->depth == 8 && alphaChannel.isGrayscale()))
+ sourceImage = alphaChannel;
+ else
+ sourceImage = alphaChannel.convertToFormat(QImage::Format_Grayscale8);
+ if (!sourceImage.reinterpretAsFormat(QImage::Format_Alpha8))
+ return;
- return image;
+ QPainter painter(this);
+ if (sourceImage.size() != size())
+ painter.setRenderHint(QPainter::SmoothPixmapTransform);
+ painter.setCompositionMode(QPainter::CompositionMode_DestinationIn);
+ painter.drawImage(rect(), sourceImage);
}
/*!
@@ -4651,8 +4646,12 @@ int QImage::bitPlaneCount() const
bpc = 12;
break;
case QImage::Format_RGBX64:
+ case QImage::Format_RGBX16FPx4:
bpc = 48;
break;
+ case QImage::Format_RGBX32FPx4:
+ bpc = 96;
+ break;
default:
bpc = qt_depthForFormat(d->format);
break;
@@ -4661,10 +4660,18 @@ int QImage::bitPlaneCount() const
}
/*!
+ \internal
Returns a smoothly scaled copy of the image. The returned image has a size
of width \a w by height \a h pixels.
+
+ The function operates internally on \c Format_RGB32, \c Format_ARGB32_Premultiplied,
+ \c Format_RGBX8888, \c Format_RGBA8888_Premultiplied, \c Format_RGBX64,
+ or \c Format_RGBA64_Premultiplied and will convert to those formats
+ if necessary. To avoid unnecessary conversion the result is returned in the format
+ internally used, and not in the original format.
*/
-QImage QImage::smoothScaled(int w, int h) const {
+QImage QImage::smoothScaled(int w, int h) const
+{
QImage src = *this;
switch (src.format()) {
case QImage::Format_RGB32:
@@ -4678,14 +4685,28 @@ QImage QImage::smoothScaled(int w, int h) const {
case QImage::Format_RGBA64_Premultiplied:
break;
case QImage::Format_RGBA64:
- src = src.convertToFormat(QImage::Format_RGBA64_Premultiplied);
+ case QImage::Format_Grayscale16:
+ src.convertTo(QImage::Format_RGBA64_Premultiplied);
+ break;
+#endif
+#if QT_CONFIG(raster_fp)
+ case QImage::Format_RGBX32FPx4:
+ case QImage::Format_RGBA32FPx4_Premultiplied:
+ break;
+ case QImage::Format_RGBX16FPx4:
+ src.convertTo(QImage::Format_RGBX32FPx4);
+ break;
+ case QImage::Format_RGBA16FPx4:
+ case QImage::Format_RGBA16FPx4_Premultiplied:
+ case QImage::Format_RGBA32FPx4:
+ src.convertTo(QImage::Format_RGBA32FPx4_Premultiplied);
break;
#endif
default:
if (src.hasAlphaChannel())
- src = src.convertToFormat(QImage::Format_ARGB32_Premultiplied);
+ src.convertTo(QImage::Format_ARGB32_Premultiplied);
else
- src = src.convertToFormat(QImage::Format_RGB32);
+ src.convertTo(QImage::Format_RGB32);
}
src = qSmoothScaleImage(src, w, h);
if (!src.isNull())
@@ -4696,6 +4717,8 @@ QImage QImage::smoothScaled(int w, int h) const {
static QImage rotated90(const QImage &image)
{
QImage out(image.height(), image.width(), image.format());
+ if (out.isNull())
+ return out;
copyMetadata(&out, image);
if (image.colorCount() > 0)
out.setColorTable(image.colorTable());
@@ -4724,6 +4747,8 @@ static QImage rotated180(const QImage &image)
return image.mirrored(true, true);
QImage out(image.width(), image.height(), image.format());
+ if (out.isNull())
+ return out;
copyMetadata(&out, image);
if (image.colorCount() > 0)
out.setColorTable(image.colorTable());
@@ -4736,6 +4761,8 @@ static QImage rotated180(const QImage &image)
static QImage rotated270(const QImage &image)
{
QImage out(image.height(), image.width(), image.format());
+ if (out.isNull())
+ return out;
copyMetadata(&out, image);
if (image.colorCount() > 0)
out.setColorTable(image.colorTable());
@@ -4766,7 +4793,7 @@ static QImage rotated270(const QImage &image)
image where not all pixels are covered by the transformed pixels of the
original image. In such cases, those background pixels will be assigned a
transparent color value, and the transformed image will be given a format
- with an alpha channel, even if the orginal image did not have that.
+ with an alpha channel, even if the original image did not have that.
The transformation \a matrix is internally adjusted to compensate
for unwanted translation; i.e. the image produced is the smallest
@@ -4781,14 +4808,19 @@ static QImage rotated270(const QImage &image)
Transformations}
*/
-QImage QImage::transformed(const QTransform &matrix, Qt::TransformationMode mode ) const
+QImage Q_TRACE_INSTRUMENT(qtgui) QImage::transformed(const QTransform &matrix, Qt::TransformationMode mode ) const
{
if (!d)
return QImage();
+ Q_TRACE_PARAM_REPLACE(const QTransform &, double[9]);
+ Q_TRACE_SCOPE(QImage_transformed, QList<double>({matrix.m11(), matrix.m12(), matrix.m13(),
+ matrix.m21(), matrix.m22(), matrix.m23(),
+ matrix.m31(), matrix.m32(), matrix.m33()}).data(), mode);
+
// source image data
- int ws = width();
- int hs = height();
+ const int ws = width();
+ const int hs = height();
// target image data
int wd;
@@ -4798,20 +4830,20 @@ QImage QImage::transformed(const QTransform &matrix, Qt::TransformationMode mode
QTransform mat = trueMatrix(matrix, ws, hs);
bool complex_xform = false;
bool scale_xform = false;
+ bool nonpaintable_scale_xform = false;
if (mat.type() <= QTransform::TxScale) {
if (mat.type() == QTransform::TxNone) // identity matrix
return *this;
else if (mat.m11() == -1. && mat.m22() == -1.)
return rotated180(*this);
- if (mode == Qt::FastTransformation) {
- hd = qRound(qAbs(mat.m22()) * hs);
- wd = qRound(qAbs(mat.m11()) * ws);
- } else {
- hd = int(qAbs(mat.m22()) * hs + 0.9999);
- wd = int(qAbs(mat.m11()) * ws + 0.9999);
- }
+ hd = qRound(qAbs(mat.m22()) * hs);
+ wd = qRound(qAbs(mat.m11()) * ws);
scale_xform = true;
+ // The paint-based scaling is only bilinear, and has problems
+ // with scaling smoothly more than 2x down.
+ if (hd * 2 < hs || wd * 2 < ws)
+ nonpaintable_scale_xform = true;
} else {
if (mat.type() <= QTransform::TxRotate && mat.m11() == 0 && mat.m22() == 0) {
if (mat.m12() == 1. && mat.m21() == -1.)
@@ -4831,28 +4863,62 @@ QImage QImage::transformed(const QTransform &matrix, Qt::TransformationMode mode
if (wd == 0 || hd == 0)
return QImage();
- // Make use of the optimized algorithm when we're scaling
if (scale_xform && mode == Qt::SmoothTransformation) {
- if (mat.m11() < 0.0F && mat.m22() < 0.0F) { // horizontal/vertical flip
- return smoothScaled(wd, hd).mirrored(true, true);
- } else if (mat.m11() < 0.0F) { // horizontal flip
- return smoothScaled(wd, hd).mirrored(true, false);
- } else if (mat.m22() < 0.0F) { // vertical flip
- return smoothScaled(wd, hd).mirrored(false, true);
- } else { // no flipping
- return smoothScaled(wd, hd);
+ switch (format()) {
+ case QImage::Format_RGB32:
+ case QImage::Format_ARGB32_Premultiplied:
+#if Q_BYTE_ORDER == Q_LITTLE_ENDIAN
+ case QImage::Format_RGBX8888:
+#endif
+ case QImage::Format_RGBA8888_Premultiplied:
+#if QT_CONFIG(raster_64bit)
+ case QImage::Format_RGBX64:
+ case QImage::Format_RGBA64_Premultiplied:
+#endif
+ // Use smoothScaled for scaling when we can do so without conversion.
+ if (mat.m11() > 0.0F && mat.m22() > 0.0F)
+ return smoothScaled(wd, hd);
+ break;
+ default:
+ break;
+ }
+ // Otherwise only use it when the scaling factor demands it, or the image is large enough to scale multi-threaded
+ if (nonpaintable_scale_xform
+#if QT_CONFIG(thread) && !defined(Q_OS_WASM)
+ || (ws * hs) >= (1<<20)
+#endif
+ ) {
+ QImage scaledImage;
+ if (mat.m11() < 0.0F && mat.m22() < 0.0F) { // horizontal/vertical flip
+ scaledImage = smoothScaled(wd, hd).mirrored(true, true);
+ } else if (mat.m11() < 0.0F) { // horizontal flip
+ scaledImage = smoothScaled(wd, hd).mirrored(true, false);
+ } else if (mat.m22() < 0.0F) { // vertical flip
+ scaledImage = smoothScaled(wd, hd).mirrored(false, true);
+ } else { // no flipping
+ scaledImage = smoothScaled(wd, hd);
+ }
+
+ switch (format()) {
+ case QImage::Format_Mono:
+ case QImage::Format_MonoLSB:
+ case QImage::Format_Indexed8:
+ return scaledImage;
+ default:
+ return scaledImage.convertToFormat(format());
+ }
}
}
int bpp = depth();
- int sbpl = bytesPerLine();
+ qsizetype sbpl = bytesPerLine();
const uchar *sptr = bits();
QImage::Format target_format = d->format;
if (complex_xform || mode == Qt::SmoothTransformation) {
- if (d->format < QImage::Format_RGB32 || !hasAlphaChannel()) {
+ if (d->format < QImage::Format_RGB32 || (!hasAlphaChannel() && complex_xform)) {
target_format = qt_alphaVersion(d->format);
}
}
@@ -4881,7 +4947,14 @@ QImage QImage::transformed(const QTransform &matrix, Qt::TransformationMode mode
if (target_format >= QImage::Format_RGB32) {
// Prevent QPainter from applying devicePixelRatio corrections
- const QImage sImage = (devicePixelRatio() != 1) ? QImage(constBits(), width(), height(), format()) : *this;
+ QImage sImage = (devicePixelRatio() != 1) ? QImage(constBits(), width(), height(), format()) : *this;
+ if (sImage.d != d
+ && (d->format == QImage::Format_MonoLSB
+ || d->format == QImage::Format_Mono
+ || d->format == QImage::Format_Indexed8)) {
+ sImage.d->colortable = d->colortable;
+ sImage.d->has_alpha_clut = d->has_alpha_clut;
+ }
Q_ASSERT(sImage.devicePixelRatio() == 1);
Q_ASSERT(sImage.devicePixelRatio() == dImage.devicePixelRatio());
@@ -4901,7 +4974,7 @@ QImage QImage::transformed(const QTransform &matrix, Qt::TransformationMode mode
// create target image (some of the code is from QImage::copy())
int type = format() == Format_Mono ? QT_XFORM_TYPE_MSBFIRST : QT_XFORM_TYPE_LSBFIRST;
- int dbpl = dImage.bytesPerLine();
+ qsizetype dbpl = dImage.bytesPerLine();
qt_xForm_helper(mat, 0, type, bpp, dImage.bits(), dbpl, 0, hd, sptr, sbpl, ws, hs);
}
copyMetadata(dImage.d, d);
@@ -4951,9 +5024,12 @@ void QImage::setColorSpace(const QColorSpace &colorSpace)
return;
if (d->colorSpace == colorSpace)
return;
- if (!isDetached()) // Detach only if shared, not for read-only data.
- detach();
- d->colorSpace = colorSpace;
+ if (colorSpace.isValid() && !qt_compatibleColorModel(pixelFormat().colorModel(), colorSpace.colorModel()))
+ return;
+
+ detachMetadata(false);
+ if (d)
+ d->colorSpace = colorSpace;
}
/*!
@@ -4963,20 +5039,60 @@ void QImage::setColorSpace(const QColorSpace &colorSpace)
If the image has no valid color space, the method does nothing.
+ \note If \a colorSpace is not compatible with the current format, the image
+ will be converted to one that is.
+
\sa convertedToColorSpace(), setColorSpace()
*/
void QImage::convertToColorSpace(const QColorSpace &colorSpace)
{
- if (!d)
- return;
- if (!d->colorSpace.isValid())
+ if (!d || !d->colorSpace.isValid())
return;
- if (!colorSpace.isValid()) {
+ if (!colorSpace.isValidTarget()) {
qWarning() << "QImage::convertToColorSpace: Output colorspace is not valid";
return;
}
- detach();
+ if (d->colorSpace == colorSpace)
+ return;
+ if (!qt_compatibleColorModel(pixelFormat().colorModel(), colorSpace.colorModel())) {
+ *this = convertedToColorSpace(colorSpace);
+ return;
+ }
applyColorTransform(d->colorSpace.transformationToColorSpace(colorSpace));
+ if (d->ref.loadRelaxed() != 1)
+ detachMetadata(false);
+ d->colorSpace = colorSpace;
+}
+
+/*!
+ \since 6.8
+
+ Converts the image to \a colorSpace and \a format.
+
+ If the image has no valid color space, the method does nothing,
+ nor if the color space is not compatible with with the format.
+
+ The specified image conversion \a flags control how the image data
+ is handled during the format conversion process.
+
+ \sa convertedToColorSpace(), setColorSpace()
+*/
+void QImage::convertToColorSpace(const QColorSpace &colorSpace, QImage::Format format, Qt::ImageConversionFlags flags)
+{
+ if (!d || !d->colorSpace.isValid())
+ return;
+ if (!colorSpace.isValidTarget()) {
+ qWarning() << "QImage::convertToColorSpace: Output colorspace is not valid";
+ return;
+ }
+ if (!qt_compatibleColorModel(toPixelFormat(format).colorModel(), colorSpace.colorModel())) {
+ qWarning() << "QImage::convertToColorSpace: Color space is not compatible with format";
+ return;
+ }
+
+ if (d->colorSpace == colorSpace)
+ return convertTo(format, flags);
+ applyColorTransform(d->colorSpace.transformationToColorSpace(colorSpace), format, flags);
d->colorSpace = colorSpace;
}
@@ -4987,14 +5103,56 @@ void QImage::convertToColorSpace(const QColorSpace &colorSpace)
If the image has no valid color space, a null QImage is returned.
- \sa convertToColorSpace()
+ \note If \a colorSpace is not compatible with the current format,
+ the returned image will also be converted to a format this is.
+ For more control over returned image format, see the three argument
+ overload of this method.
+
+ \sa convertToColorSpace(), colorTransformed()
*/
QImage QImage::convertedToColorSpace(const QColorSpace &colorSpace) const
{
- if (!d || !d->colorSpace.isValid() || !colorSpace.isValid())
+ if (!d || !d->colorSpace.isValid())
return QImage();
- QImage image = copy();
- image.convertToColorSpace(colorSpace);
+ if (!colorSpace.isValidTarget()) {
+ qWarning() << "QImage::convertedToColorSpace: Output colorspace is not valid";
+ return QImage();
+ }
+ if (d->colorSpace == colorSpace)
+ return *this;
+ QImage image = colorTransformed(d->colorSpace.transformationToColorSpace(colorSpace));
+ image.setColorSpace(colorSpace);
+ return image;
+}
+
+/*!
+ \since 6.8
+
+ Returns the image converted to \a colorSpace and \a format.
+
+ If the image has no valid color space, a null QImage is returned.
+
+ The specified image conversion \a flags control how the image data
+ is handled during the format conversion process.
+
+ \sa colorTransformed()
+*/
+QImage QImage::convertedToColorSpace(const QColorSpace &colorSpace, QImage::Format format, Qt::ImageConversionFlags flags) const
+{
+ if (!d || !d->colorSpace.isValid())
+ return QImage();
+ if (!colorSpace.isValidTarget()) {
+ qWarning() << "QImage::convertedToColorSpace: Output colorspace is not valid";
+ return QImage();
+ }
+ if (!qt_compatibleColorModel(toPixelFormat(format).colorModel(), colorSpace.colorModel())) {
+ qWarning() << "QImage::convertedToColorSpace: Color space is not compatible with format";
+ return QImage();
+ }
+ if (d->colorSpace == colorSpace)
+ return convertedTo(format, flags);
+ QImage image = colorTransformed(d->colorSpace.transformationToColorSpace(colorSpace), format, flags);
+ image.setColorSpace(colorSpace);
return image;
}
@@ -5017,52 +5175,677 @@ QColorSpace QImage::colorSpace() const
*/
void QImage::applyColorTransform(const QColorTransform &transform)
{
+ if (transform.isIdentity())
+ return;
+
+ if (!qt_compatibleColorModel(pixelFormat().colorModel(), QColorTransformPrivate::get(transform)->colorSpaceIn->colorModel) ||
+ !qt_compatibleColorModel(pixelFormat().colorModel(), QColorTransformPrivate::get(transform)->colorSpaceOut->colorModel)) {
+ qWarning() << "QImage::applyColorTransform can not apply format switching transform without switching format";
+ return;
+ }
+
+ detach();
+ if (!d)
+ return;
+ if (pixelFormat().colorModel() == QPixelFormat::Indexed) {
+ for (int i = 0; i < d->colortable.size(); ++i)
+ d->colortable[i] = transform.map(d->colortable[i]);
+ return;
+ }
QImage::Format oldFormat = format();
- if (depth() > 32) {
- if (format() != QImage::Format_RGBX64 && format() != QImage::Format_RGBA64
- && format() != QImage::Format_RGBA64_Premultiplied)
- *this = std::move(*this).convertToFormat(QImage::Format_RGBA64);
- } else if (format() != QImage::Format_ARGB32 && format() != QImage::Format_RGB32
- && format() != QImage::Format_ARGB32_Premultiplied) {
+ if (qt_fpColorPrecision(oldFormat)) {
+ if (oldFormat != QImage::Format_RGBX32FPx4 && oldFormat != QImage::Format_RGBA32FPx4
+ && oldFormat != QImage::Format_RGBA32FPx4_Premultiplied)
+ convertTo(QImage::Format_RGBA32FPx4);
+ } else if (depth() > 32) {
+ if (oldFormat != QImage::Format_RGBX64 && oldFormat != QImage::Format_RGBA64
+ && oldFormat != QImage::Format_RGBA64_Premultiplied)
+ convertTo(QImage::Format_RGBA64);
+ } else if (oldFormat != QImage::Format_ARGB32 && oldFormat != QImage::Format_RGB32
+ && oldFormat != QImage::Format_ARGB32_Premultiplied && oldFormat != QImage::Format_CMYK8888
+ && oldFormat != QImage::Format_Grayscale8 && oldFormat != QImage::Format_Grayscale16) {
if (hasAlphaChannel())
- *this = std::move(*this).convertToFormat(QImage::Format_ARGB32);
+ convertTo(QImage::Format_ARGB32);
else
- *this = std::move(*this).convertToFormat(QImage::Format_RGB32);
+ convertTo(QImage::Format_RGB32);
}
QColorTransformPrivate::TransformFlags flags = QColorTransformPrivate::Unpremultiplied;
switch (format()) {
case Format_ARGB32_Premultiplied:
case Format_RGBA64_Premultiplied:
+ case Format_RGBA32FPx4_Premultiplied:
flags = QColorTransformPrivate::Premultiplied;
break;
+ case Format_Grayscale8:
+ case Format_Grayscale16:
case Format_RGB32:
+ case Format_CMYK8888:
case Format_RGBX64:
+ case Format_RGBX32FPx4:
flags = QColorTransformPrivate::InputOpaque;
break;
case Format_ARGB32:
case Format_RGBA64:
+ case Format_RGBA32FPx4:
break;
default:
Q_UNREACHABLE();
}
- if (depth() > 32) {
- for (int i = 0; i < height(); ++i) {
- QRgba64 *scanline = reinterpret_cast<QRgba64 *>(scanLine(i));
- transform.d->apply(scanline, scanline, width(), flags);
- }
+ std::function<void(int,int)> transformSegment;
+
+ if (format() == Format_Grayscale8) {
+ transformSegment = [&](int yStart, int yEnd) {
+ for (int y = yStart; y < yEnd; ++y) {
+ uint8_t *scanline = reinterpret_cast<uint8_t *>(d->data + y * d->bytes_per_line);
+ QColorTransformPrivate::get(transform)->applyGray(scanline, scanline, width(), flags);
+ }
+ };
+ } else if (format() == Format_Grayscale16) {
+ transformSegment = [&](int yStart, int yEnd) {
+ for (int y = yStart; y < yEnd; ++y) {
+ uint16_t *scanline = reinterpret_cast<uint16_t *>(d->data + y * d->bytes_per_line);
+ QColorTransformPrivate::get(transform)->applyGray(scanline, scanline, width(), flags);
+ }
+ };
+ } else if (qt_fpColorPrecision(format())) {
+ transformSegment = [&](int yStart, int yEnd) {
+ for (int y = yStart; y < yEnd; ++y) {
+ QRgbaFloat32 *scanline = reinterpret_cast<QRgbaFloat32 *>(d->data + y * d->bytes_per_line);
+ QColorTransformPrivate::get(transform)->apply(scanline, scanline, width(), flags);
+ }
+ };
+ } else if (depth() > 32) {
+ transformSegment = [&](int yStart, int yEnd) {
+ for (int y = yStart; y < yEnd; ++y) {
+ QRgba64 *scanline = reinterpret_cast<QRgba64 *>(d->data + y * d->bytes_per_line);
+ QColorTransformPrivate::get(transform)->apply(scanline, scanline, width(), flags);
+ }
+ };
+ } else if (oldFormat == QImage::Format_CMYK8888) {
+ transformSegment = [&](int yStart, int yEnd) {
+ for (int y = yStart; y < yEnd; ++y) {
+ QCmyk32 *scanline = reinterpret_cast<QCmyk32 *>(d->data + y * d->bytes_per_line);
+ QColorTransformPrivate::get(transform)->apply(scanline, scanline, width(), flags);
+ }
+ };
} else {
- for (int i = 0; i < height(); ++i) {
- QRgb *scanline = reinterpret_cast<QRgb *>(scanLine(i));
- transform.d->apply(scanline, scanline, width(), flags);
- }
+ transformSegment = [&](int yStart, int yEnd) {
+ for (int y = yStart; y < yEnd; ++y) {
+ QRgb *scanline = reinterpret_cast<QRgb *>(d->data + y * d->bytes_per_line);
+ QColorTransformPrivate::get(transform)->apply(scanline, scanline, width(), flags);
+ }
+ };
}
+#if QT_CONFIG(thread) && !defined(Q_OS_WASM)
+ int segments = (qsizetype(width()) * height()) >> 16;
+ segments = std::min(segments, height());
+ QThreadPool *threadPool = QThreadPoolPrivate::qtGuiInstance();
+ if (segments > 1 && threadPool && !threadPool->contains(QThread::currentThread())) {
+ QSemaphore semaphore;
+ int y = 0;
+ for (int i = 0; i < segments; ++i) {
+ int yn = (height() - y) / (segments - i);
+ threadPool->start([&, y, yn]() {
+ transformSegment(y, y + yn);
+ semaphore.release(1);
+ });
+ y += yn;
+ }
+ semaphore.acquire(segments);
+ } else
+#endif
+ transformSegment(0, height());
+
if (oldFormat != format())
*this = std::move(*this).convertToFormat(oldFormat);
}
+/*!
+ \since 6.8
+
+ Applies the color transformation \a transform to all pixels in the image, and converts the format of the image to \a toFormat.
+
+ The specified image conversion \a flags control how the image data
+ is handled during the format conversion process.
+*/
+void QImage::applyColorTransform(const QColorTransform &transform, QImage::Format toFormat, Qt::ImageConversionFlags flags)
+{
+ if (!d)
+ return;
+ if (transform.isIdentity())
+ return convertTo(toFormat, flags);
+
+ *this = colorTransformed(transform, toFormat, flags);
+}
+
+/*!
+ \since 6.4
+
+ Returns the image color transformed using \a transform on all pixels in the image.
+
+ \note If \a transform has a source color space which is incompatible with the format of this image,
+ returns a null QImage. If \a transform has a target color space which is incompatible with the format
+ of this image, the image will also be converted to a compatible format. For more control about the
+ choice of the target pixel format, see the three argument overload of this method.
+
+ \sa applyColorTransform()
+*/
+QImage QImage::colorTransformed(const QColorTransform &transform) const &
+{
+ if (!d)
+ return QImage();
+ if (transform.isIdentity())
+ return *this;
+
+ QColorSpace::ColorModel inColorModel = QColorTransformPrivate::get(transform)->colorSpaceIn->colorModel;
+ QColorSpace::ColorModel outColorModel = QColorTransformPrivate::get(transform)->colorSpaceOut->colorModel;
+ if (!qt_compatibleColorModel(pixelFormat().colorModel(), inColorModel)) {
+ qWarning() << "QImage::colorTransformed: Invalid input color space for transform";
+ return QImage();
+ }
+ if (!qt_compatibleColorModel(pixelFormat().colorModel(), outColorModel)) {
+ // All model switching transforms are opaque in at least one end.
+ switch (outColorModel) {
+ case QColorSpace::ColorModel::Rgb:
+ return colorTransformed(transform, qt_highColorPrecision(format(), true) ? QImage::Format_RGBX64 : QImage::Format_RGB32);
+ case QColorSpace::ColorModel::Gray:
+ return colorTransformed(transform, qt_highColorPrecision(format(), true) ? QImage::Format_Grayscale16 : QImage::Format_Grayscale8);
+ case QColorSpace::ColorModel::Cmyk:
+ return colorTransformed(transform, QImage::Format_CMYK8888);
+ case QColorSpace::ColorModel::Undefined:
+ break;
+ }
+ return QImage();
+ }
+
+ QImage image = copy();
+ image.applyColorTransform(transform);
+ return image;
+}
+
+static bool isRgb32Data(QImage::Format f)
+{
+ switch (f) {
+ case QImage::Format_RGB32:
+ case QImage::Format_ARGB32:
+ case QImage::Format_ARGB32_Premultiplied:
+ return true;
+ default:
+ break;
+ }
+ return false;
+}
+
+static bool isRgb64Data(QImage::Format f)
+{
+ switch (f) {
+ case QImage::Format_RGBX64:
+ case QImage::Format_RGBA64:
+ case QImage::Format_RGBA64_Premultiplied:
+ return true;
+ default:
+ break;
+ }
+ return false;
+}
+
+static bool isRgb32fpx4Data(QImage::Format f)
+{
+ switch (f) {
+ case QImage::Format_RGBX32FPx4:
+ case QImage::Format_RGBA32FPx4:
+ case QImage::Format_RGBA32FPx4_Premultiplied:
+ return true;
+ default:
+ break;
+ }
+ return false;
+}
+
+/*!
+ \since 6.8
+
+ Returns the image color transformed using \a transform on all pixels in the image, returning an image of format \a toFormat.
+
+ The specified image conversion \a flags control how the image data
+ is handled during the format conversion process.
+
+ \note If \a transform has a source color space which is incompatible with the format of this image,
+ or a target color space that is incompatible with \a toFormat, returns a null QImage.
+
+ \sa applyColorTransform()
+*/
+QImage QImage::colorTransformed(const QColorTransform &transform, QImage::Format toFormat, Qt::ImageConversionFlags flags) const &
+{
+ if (!d)
+ return QImage();
+ if (toFormat == QImage::Format_Invalid)
+ toFormat = format();
+ if (transform.isIdentity())
+ return convertedTo(toFormat, flags);
+
+ QColorSpace::ColorModel inColorModel = QColorTransformPrivate::get(transform)->colorSpaceIn->colorModel;
+ QColorSpace::ColorModel outColorModel = QColorTransformPrivate::get(transform)->colorSpaceOut->colorModel;
+ if (!qt_compatibleColorModel(pixelFormat().colorModel(), inColorModel)) {
+ qWarning() << "QImage::colorTransformed: Invalid input color space for transform";
+ return QImage();
+ }
+ if (!qt_compatibleColorModel(toPixelFormat(toFormat).colorModel(), outColorModel)) {
+ qWarning() << "QImage::colorTransformed: Invalid output color space for transform";
+ return QImage();
+ }
+
+ QImage fromImage = *this;
+
+ QImage::Format tmpFormat = toFormat;
+ switch (toFormat) {
+ case QImage::Format_RGB32:
+ case QImage::Format_ARGB32:
+ case QImage::Format_ARGB32_Premultiplied:
+ case QImage::Format_RGBX32FPx4:
+ case QImage::Format_RGBA32FPx4:
+ case QImage::Format_RGBA32FPx4_Premultiplied:
+ case QImage::Format_RGBX64:
+ case QImage::Format_RGBA64:
+ case QImage::Format_RGBA64_Premultiplied:
+ case QImage::Format_Grayscale8:
+ case QImage::Format_Grayscale16:
+ case QImage::Format_CMYK8888:
+ // can be output natively
+ break;
+ case QImage::Format_RGB16:
+ case QImage::Format_RGB444:
+ case QImage::Format_RGB555:
+ case QImage::Format_RGB666:
+ case QImage::Format_RGB888:
+ case QImage::Format_BGR888:
+ case QImage::Format_RGBX8888:
+ tmpFormat = QImage::Format_RGB32;
+ break;
+ case QImage::Format_Mono:
+ case QImage::Format_MonoLSB:
+ case QImage::Format_Indexed8:
+ case QImage::Format_ARGB8565_Premultiplied:
+ case QImage::Format_ARGB6666_Premultiplied:
+ case QImage::Format_ARGB8555_Premultiplied:
+ case QImage::Format_ARGB4444_Premultiplied:
+ case QImage::Format_RGBA8888:
+ case QImage::Format_RGBA8888_Premultiplied:
+ tmpFormat = QImage::Format_ARGB32;
+ break;
+ case QImage::Format_BGR30:
+ case QImage::Format_RGB30:
+ tmpFormat = QImage::Format_RGBX64;
+ break;
+ case QImage::Format_A2BGR30_Premultiplied:
+ case QImage::Format_A2RGB30_Premultiplied:
+ tmpFormat = QImage::Format_RGBA64;
+ break;
+ case QImage::Format_RGBX16FPx4:
+ case QImage::Format_RGBA16FPx4:
+ case QImage::Format_RGBA16FPx4_Premultiplied:
+ tmpFormat = QImage::Format_RGBA32FPx4;
+ break;
+ case QImage::Format_Alpha8:
+ return convertedTo(QImage::Format_Alpha8);
+ case QImage::Format_Invalid:
+ case QImage::NImageFormats:
+ Q_UNREACHABLE();
+ break;
+ }
+ QColorSpace::ColorModel inColorData = qt_csColorData(pixelFormat().colorModel());
+ QColorSpace::ColorModel outColorData = qt_csColorData(toPixelFormat(toFormat).colorModel());
+ // Ensure only precision increasing transforms
+ if (inColorData != outColorData) {
+ if (fromImage.format() == QImage::Format_Grayscale8 && outColorData == QColorSpace::ColorModel::Rgb)
+ tmpFormat = QImage::Format_RGB32;
+ else if (tmpFormat == QImage::Format_Grayscale8 && qt_highColorPrecision(fromImage.format()))
+ tmpFormat = QImage::Format_Grayscale16;
+ else if (fromImage.format() == QImage::Format_Grayscale16 && outColorData == QColorSpace::ColorModel::Rgb)
+ tmpFormat = QImage::Format_RGBX64;
+ } else {
+ if (tmpFormat == QImage::Format_Grayscale8 && fromImage.format() == QImage::Format_Grayscale16)
+ tmpFormat = QImage::Format_Grayscale16;
+ else if (qt_fpColorPrecision(fromImage.format()) && !qt_fpColorPrecision(tmpFormat))
+ tmpFormat = QImage::Format_RGBA32FPx4;
+ else if (isRgb32Data(tmpFormat) && qt_highColorPrecision(fromImage.format(), true))
+ tmpFormat = QImage::Format_RGBA64;
+ }
+
+ QImage toImage(size(), tmpFormat);
+ copyMetadata(&toImage, *this);
+
+ std::function<void(int, int)> transformSegment;
+ QColorTransformPrivate::TransformFlags transFlags = QColorTransformPrivate::Unpremultiplied;
+
+ if (inColorData != outColorData) {
+ // Needs color model switching transform
+ if (inColorData == QColorSpace::ColorModel::Gray && outColorData == QColorSpace::ColorModel::Rgb) {
+ // Gray -> RGB
+ if (format() == QImage::Format_Grayscale8) {
+ transformSegment = [&](int yStart, int yEnd) {
+ for (int y = yStart; y < yEnd; ++y) {
+ const quint8 *in_scanline = reinterpret_cast<const quint8 *>(d->data + y * d->bytes_per_line);
+ QRgb *out_scanline = reinterpret_cast<QRgb *>(toImage.d->data + y * toImage.bytesPerLine());
+ QColorTransformPrivate::get(transform)->applyGray(out_scanline, in_scanline, width(), QColorTransformPrivate::InputOpaque);
+ }
+ };
+ } else {
+ transformSegment = [&](int yStart, int yEnd) {
+ for (int y = yStart; y < yEnd; ++y) {
+ const quint16 *in_scanline = reinterpret_cast<const quint16 *>(d->data + y * d->bytes_per_line);
+ QRgba64 *out_scanline = reinterpret_cast<QRgba64 *>(toImage.d->data + y * toImage.bytesPerLine());
+ QColorTransformPrivate::get(transform)->applyGray(out_scanline, in_scanline, width(), QColorTransformPrivate::InputOpaque);
+ }
+ };
+ }
+ } else if (inColorData == QColorSpace::ColorModel::Gray && outColorData == QColorSpace::ColorModel::Cmyk) {
+ // Gray -> CMYK
+ if (format() == QImage::Format_Grayscale8) {
+ transformSegment = [&](int yStart, int yEnd) {
+ for (int y = yStart; y < yEnd; ++y) {
+ const quint8 *in_scanline = reinterpret_cast<const quint8 *>(d->data + y * d->bytes_per_line);
+ QCmyk32 *out_scanline = reinterpret_cast<QCmyk32 *>(toImage.d->data + y * toImage.bytesPerLine());
+ QColorTransformPrivate::get(transform)->applyGray(out_scanline, in_scanline, width(), QColorTransformPrivate::InputOpaque);
+ }
+ };
+ } else {
+ transformSegment = [&](int yStart, int yEnd) {
+ for (int y = yStart; y < yEnd; ++y) {
+ const quint16 *in_scanline = reinterpret_cast<const quint16 *>(d->data + y * d->bytes_per_line);
+ QCmyk32 *out_scanline = reinterpret_cast<QCmyk32 *>(toImage.d->data + y * toImage.bytesPerLine());
+ QColorTransformPrivate::get(transform)->applyGray(out_scanline, in_scanline, width(), QColorTransformPrivate::InputOpaque);
+ }
+ };
+ }
+ } else if (inColorData == QColorSpace::ColorModel::Rgb && outColorData == QColorSpace::ColorModel::Gray) {
+ // RGB -> Gray
+ if (tmpFormat == QImage::Format_Grayscale8) {
+ fromImage.convertTo(QImage::Format_RGB32);
+ transformSegment = [&](int yStart, int yEnd) {
+ for (int y = yStart; y < yEnd; ++y) {
+ const QRgb *in_scanline = reinterpret_cast<const QRgb *>(fromImage.constBits() + y * fromImage.bytesPerLine());
+ quint8 *out_scanline = reinterpret_cast<quint8 *>(toImage.d->data + y * toImage.bytesPerLine());
+ QColorTransformPrivate::get(transform)->applyReturnGray(out_scanline, in_scanline, width(), QColorTransformPrivate::InputOpaque);
+ }
+ };
+ } else {
+ fromImage.convertTo(QImage::Format_RGBX64);
+ transformSegment = [&](int yStart, int yEnd) {
+ for (int y = yStart; y < yEnd; ++y) {
+ const QRgba64 *in_scanline = reinterpret_cast<const QRgba64 *>(fromImage.constBits() + y * fromImage.bytesPerLine());
+ quint16 *out_scanline = reinterpret_cast<quint16 *>(toImage.d->data + y * toImage.bytesPerLine());
+ QColorTransformPrivate::get(transform)->applyReturnGray(out_scanline, in_scanline, width(), QColorTransformPrivate::InputOpaque);
+ }
+ };
+ }
+ } else if (inColorData == QColorSpace::ColorModel::Cmyk && outColorData == QColorSpace::ColorModel::Gray) {
+ // CMYK -> Gray
+ if (tmpFormat == QImage::Format_Grayscale8) {
+ transformSegment = [&](int yStart, int yEnd) {
+ for (int y = yStart; y < yEnd; ++y) {
+ const QCmyk32 *in_scanline = reinterpret_cast<const QCmyk32 *>(fromImage.constBits() + y * fromImage.bytesPerLine());
+ quint8 *out_scanline = reinterpret_cast<quint8 *>(toImage.d->data + y * toImage.bytesPerLine());
+ QColorTransformPrivate::get(transform)->applyReturnGray(out_scanline, in_scanline, width(), QColorTransformPrivate::InputOpaque);
+ }
+ };
+ } else {
+ transformSegment = [&](int yStart, int yEnd) {
+ for (int y = yStart; y < yEnd; ++y) {
+ const QCmyk32 *in_scanline = reinterpret_cast<const QCmyk32 *>(fromImage.constBits() + y * fromImage.bytesPerLine());
+ quint16 *out_scanline = reinterpret_cast<quint16 *>(toImage.d->data + y * toImage.bytesPerLine());
+ QColorTransformPrivate::get(transform)->applyReturnGray(out_scanline, in_scanline, width(), QColorTransformPrivate::InputOpaque);
+ }
+ };
+ }
+ } else if (inColorData == QColorSpace::ColorModel::Cmyk && outColorData == QColorSpace::ColorModel::Rgb) {
+ // CMYK -> RGB
+ if (isRgb32Data(tmpFormat) ) {
+ transformSegment = [&](int yStart, int yEnd) {
+ for (int y = yStart; y < yEnd; ++y) {
+ const QCmyk32 *in_scanline = reinterpret_cast<const QCmyk32 *>(fromImage.constBits() + y * fromImage.bytesPerLine());
+ QRgb *out_scanline = reinterpret_cast<QRgb *>(toImage.d->data + y * toImage.bytesPerLine());
+ QColorTransformPrivate::get(transform)->apply(out_scanline, in_scanline, width(), QColorTransformPrivate::InputOpaque);
+ }
+ };
+ } else if (isRgb64Data(tmpFormat)) {
+ transformSegment = [&](int yStart, int yEnd) {
+ for (int y = yStart; y < yEnd; ++y) {
+ const QCmyk32 *in_scanline = reinterpret_cast<const QCmyk32 *>(fromImage.constBits() + y * fromImage.bytesPerLine());
+ QRgba64 *out_scanline = reinterpret_cast<QRgba64 *>(toImage.d->data + y * toImage.bytesPerLine());
+ QColorTransformPrivate::get(transform)->apply(out_scanline, in_scanline, width(), QColorTransformPrivate::InputOpaque);
+ }
+ };
+ } else {
+ Q_ASSERT(isRgb32fpx4Data(tmpFormat));
+ transformSegment = [&](int yStart, int yEnd) {
+ for (int y = yStart; y < yEnd; ++y) {
+ const QCmyk32 *in_scanline = reinterpret_cast<const QCmyk32 *>(fromImage.constBits() + y * fromImage.bytesPerLine());
+ QRgbaFloat32 *out_scanline = reinterpret_cast<QRgbaFloat32 *>(toImage.d->data + y * toImage.bytesPerLine());
+ QColorTransformPrivate::get(transform)->apply(out_scanline, in_scanline, width(), QColorTransformPrivate::InputOpaque);
+ }
+ };
+ }
+ } else if (inColorData == QColorSpace::ColorModel::Rgb && outColorData == QColorSpace::ColorModel::Cmyk) {
+ // RGB -> CMYK
+ if (!fromImage.hasAlphaChannel())
+ transFlags = QColorTransformPrivate::InputOpaque;
+ else if (qPixelLayouts[fromImage.format()].premultiplied)
+ transFlags = QColorTransformPrivate::Premultiplied;
+ if (isRgb32Data(fromImage.format()) ) {
+ transformSegment = [&](int yStart, int yEnd) {
+ for (int y = yStart; y < yEnd; ++y) {
+ const QRgb *in_scanline = reinterpret_cast<const QRgb *>(fromImage.constBits() + y * fromImage.bytesPerLine());
+ QCmyk32 *out_scanline = reinterpret_cast<QCmyk32 *>(toImage.d->data + y * toImage.bytesPerLine());
+ QColorTransformPrivate::get(transform)->apply(out_scanline, in_scanline, width(), transFlags);
+ }
+ };
+ } else if (isRgb64Data(fromImage.format())) {
+ transformSegment = [&](int yStart, int yEnd) {
+ for (int y = yStart; y < yEnd; ++y) {
+ const QRgba64 *in_scanline = reinterpret_cast<const QRgba64 *>(fromImage.constBits() + y * fromImage.bytesPerLine());
+ QCmyk32 *out_scanline = reinterpret_cast<QCmyk32 *>(toImage.d->data + y * toImage.bytesPerLine());
+ QColorTransformPrivate::get(transform)->apply(out_scanline, in_scanline, width(), transFlags);
+ }
+ };
+ } else {
+ Q_ASSERT(isRgb32fpx4Data(fromImage.format()));
+ transformSegment = [&](int yStart, int yEnd) {
+ for (int y = yStart; y < yEnd; ++y) {
+ const QRgbaFloat32 *in_scanline = reinterpret_cast<const QRgbaFloat32 *>(fromImage.constBits() + y * fromImage.bytesPerLine());
+ QCmyk32 *out_scanline = reinterpret_cast<QCmyk32 *>(toImage.d->data + y * toImage.bytesPerLine());
+ QColorTransformPrivate::get(transform)->apply(out_scanline, in_scanline, width(), transFlags);
+ }
+ };
+ }
+ } else {
+ Q_UNREACHABLE();
+ }
+ } else {
+ // Conversion on same color model
+ if (pixelFormat().colorModel() == QPixelFormat::Indexed) {
+ for (int i = 0; i < d->colortable.size(); ++i)
+ fromImage.d->colortable[i] = transform.map(d->colortable[i]);
+ return fromImage.convertedTo(toFormat, flags);
+ }
+
+ QImage::Format oldFormat = format();
+ if (qt_fpColorPrecision(oldFormat)) {
+ if (oldFormat != QImage::Format_RGBX32FPx4 && oldFormat != QImage::Format_RGBA32FPx4
+ && oldFormat != QImage::Format_RGBA32FPx4_Premultiplied)
+ fromImage.convertTo(QImage::Format_RGBA32FPx4);
+ } else if (qt_highColorPrecision(oldFormat, true)) {
+ if (oldFormat != QImage::Format_RGBX64 && oldFormat != QImage::Format_RGBA64
+ && oldFormat != QImage::Format_RGBA64_Premultiplied && oldFormat != QImage::Format_Grayscale16)
+ fromImage.convertTo(QImage::Format_RGBA64);
+ } else if (oldFormat != QImage::Format_ARGB32 && oldFormat != QImage::Format_RGB32
+ && oldFormat != QImage::Format_ARGB32_Premultiplied && oldFormat != QImage::Format_CMYK8888
+ && oldFormat != QImage::Format_Grayscale8 && oldFormat != QImage::Format_Grayscale16) {
+ if (hasAlphaChannel())
+ fromImage.convertTo(QImage::Format_ARGB32);
+ else
+ fromImage.convertTo(QImage::Format_RGB32);
+ }
+
+ if (!fromImage.hasAlphaChannel())
+ transFlags = QColorTransformPrivate::InputOpaque;
+ else if (qPixelLayouts[fromImage.format()].premultiplied)
+ transFlags = QColorTransformPrivate::Premultiplied;
+
+ if (fromImage.format() == Format_Grayscale8) {
+ transformSegment = [&](int yStart, int yEnd) {
+ for (int y = yStart; y < yEnd; ++y) {
+ const quint8 *in_scanline = reinterpret_cast<const quint8 *>(fromImage.constBits() + y * fromImage.bytesPerLine());
+ if (tmpFormat == Format_Grayscale8) {
+ quint8 *out_scanline = reinterpret_cast<quint8 *>(toImage.d->data + y * toImage.bytesPerLine());
+ QColorTransformPrivate::get(transform)->applyGray(out_scanline, in_scanline, width(), transFlags);
+ } else {
+ Q_ASSERT(tmpFormat == Format_Grayscale16);
+ quint16 *out_scanline = reinterpret_cast<quint16 *>(toImage.d->data + y * toImage.bytesPerLine());
+ QColorTransformPrivate::get(transform)->applyGray(out_scanline, in_scanline, width(), transFlags);
+ }
+ }
+ };
+ } else if (fromImage.format() == Format_Grayscale16) {
+ transformSegment = [&](int yStart, int yEnd) {
+ for (int y = yStart; y < yEnd; ++y) {
+ const quint16 *in_scanline = reinterpret_cast<const quint16 *>(fromImage.constBits() + y * fromImage.bytesPerLine());
+ quint16 *out_scanline = reinterpret_cast<quint16 *>(toImage.d->data + y * toImage.bytesPerLine());
+ QColorTransformPrivate::get(transform)->applyGray(out_scanline, in_scanline, width(), transFlags);
+ }
+ };
+ } else if (fromImage.format() == Format_CMYK8888) {
+ Q_ASSERT(tmpFormat == Format_CMYK8888);
+ transformSegment = [&](int yStart, int yEnd) {
+ for (int y = yStart; y < yEnd; ++y) {
+ const QCmyk32 *in_scanline = reinterpret_cast<const QCmyk32 *>(fromImage.constBits() + y * fromImage.bytesPerLine());
+ QCmyk32 *out_scanline = reinterpret_cast<QCmyk32 *>(toImage.d->data + y * toImage.bytesPerLine());
+ QColorTransformPrivate::get(transform)->apply(out_scanline, in_scanline, width(), transFlags);
+ }
+ };
+ } else if (isRgb32fpx4Data(fromImage.format())) {
+ Q_ASSERT(isRgb32fpx4Data(tmpFormat));
+ transformSegment = [&](int yStart, int yEnd) {
+ for (int y = yStart; y < yEnd; ++y) {
+ const QRgbaFloat32 *in_scanline = reinterpret_cast<const QRgbaFloat32 *>(fromImage.constBits() + y * fromImage.bytesPerLine());
+ QRgbaFloat32 *out_scanline = reinterpret_cast<QRgbaFloat32 *>(toImage.d->data + y * toImage.bytesPerLine());
+ QColorTransformPrivate::get(transform)->apply(out_scanline, in_scanline, width(), transFlags);
+ }
+ };
+ } else if (isRgb64Data(fromImage.format())) {
+ transformSegment = [&](int yStart, int yEnd) {
+ for (int y = yStart; y < yEnd; ++y) {
+ const QRgba64 *in_scanline = reinterpret_cast<const QRgba64 *>(fromImage.constBits() + y * fromImage.bytesPerLine());
+ if (isRgb32fpx4Data(tmpFormat)) {
+ QRgbaFloat32 *out_scanline = reinterpret_cast<QRgbaFloat32 *>(toImage.d->data + y * toImage.bytesPerLine());
+ QColorTransformPrivate::get(transform)->apply(out_scanline, in_scanline, width(), transFlags);
+ } else {
+ Q_ASSERT(isRgb64Data(tmpFormat));
+ QRgba64 *out_scanline = reinterpret_cast<QRgba64 *>(toImage.d->data + y * toImage.bytesPerLine());
+ QColorTransformPrivate::get(transform)->apply(out_scanline, in_scanline, width(), transFlags);
+ }
+ }
+ };
+ } else {
+ transformSegment = [&](int yStart, int yEnd) {
+ for (int y = yStart; y < yEnd; ++y) {
+ const QRgb *in_scanline = reinterpret_cast<const QRgb *>(fromImage.constBits() + y * fromImage.bytesPerLine());
+ if (isRgb32fpx4Data(tmpFormat)) {
+ QRgbaFloat32 *out_scanline = reinterpret_cast<QRgbaFloat32 *>(toImage.d->data + y * toImage.bytesPerLine());
+ QColorTransformPrivate::get(transform)->apply(out_scanline, in_scanline, width(), transFlags);
+ } else if (isRgb64Data(tmpFormat)) {
+ QRgba64 *out_scanline = reinterpret_cast<QRgba64 *>(toImage.d->data + y * toImage.bytesPerLine());
+ QColorTransformPrivate::get(transform)->apply(out_scanline, in_scanline, width(), transFlags);
+ } else {
+ Q_ASSERT(isRgb32Data(tmpFormat));
+ QRgb *out_scanline = reinterpret_cast<QRgb *>(toImage.d->data + y * toImage.bytesPerLine());
+ QColorTransformPrivate::get(transform)->apply(out_scanline, in_scanline, width(), transFlags);
+ }
+ }
+ };
+ }
+ }
+
+#if QT_CONFIG(thread) && !defined(Q_OS_WASM)
+ int segments = (qsizetype(width()) * height()) >> 16;
+ segments = std::min(segments, height());
+ QThreadPool *threadPool = QThreadPoolPrivate::qtGuiInstance();
+ if (segments > 1 && threadPool && !threadPool->contains(QThread::currentThread())) {
+ QSemaphore semaphore;
+ int y = 0;
+ for (int i = 0; i < segments; ++i) {
+ int yn = (height() - y) / (segments - i);
+ threadPool->start([&, y, yn]() {
+ transformSegment(y, y + yn);
+ semaphore.release(1);
+ });
+ y += yn;
+ }
+ semaphore.acquire(segments);
+ } else
+#endif
+ transformSegment(0, height());
+
+ if (tmpFormat != toFormat)
+ toImage.convertTo(toFormat);
+
+ return toImage;
+}
+
+/*!
+ \since 6.4
+ \overload
+
+ Returns the image color transformed using \a transform on all pixels in the image.
+
+ \sa applyColorTransform()
+*/
+QImage QImage::colorTransformed(const QColorTransform &transform) &&
+{
+ if (!d)
+ return QImage();
+
+ QColorSpace::ColorModel inColorModel = QColorTransformPrivate::get(transform)->colorSpaceIn->colorModel;
+ QColorSpace::ColorModel outColorModel = QColorTransformPrivate::get(transform)->colorSpaceOut->colorModel;
+ if (!qt_compatibleColorModel(pixelFormat().colorModel(), inColorModel)) {
+ qWarning() << "QImage::colorTransformed: Invalid input color space for transform";
+ return QImage();
+ }
+ if (!qt_compatibleColorModel(pixelFormat().colorModel(), outColorModel)) {
+ // There is currently no inplace conversion of both colorspace and format, so just use the normal version.
+ switch (outColorModel) {
+ case QColorSpace::ColorModel::Rgb:
+ return colorTransformed(transform, qt_highColorPrecision(format(), true) ? QImage::Format_RGBX64 : QImage::Format_RGB32);
+ case QColorSpace::ColorModel::Gray:
+ return colorTransformed(transform, qt_highColorPrecision(format(), true) ? QImage::Format_Grayscale16 : QImage::Format_Grayscale8);
+ case QColorSpace::ColorModel::Cmyk:
+ return colorTransformed(transform, QImage::Format_CMYK8888);
+ case QColorSpace::ColorModel::Undefined:
+ break;
+ }
+ return QImage();
+ }
+
+ applyColorTransform(transform);
+ return std::move(*this);
+}
+
+/*!
+ \since 6.8
+ \overload
+
+ Returns the image color transformed using \a transform on all pixels in the image.
+
+ \sa applyColorTransform()
+*/
+QImage QImage::colorTransformed(const QColorTransform &transform, QImage::Format format, Qt::ImageConversionFlags flags) &&
+{
+ // There is currently no inplace conversion of both colorspace and format, so just use the normal version.
+ return colorTransformed(transform, format, flags);
+}
bool QImageData::convertInPlace(QImage::Format newFormat, Qt::ImageConversionFlags flags)
{
@@ -5076,12 +5859,20 @@ bool QImageData::convertInPlace(QImage::Format newFormat, Qt::ImageConversionFla
InPlace_Image_Converter converter = qimage_inplace_converter_map[format][newFormat];
if (converter)
return converter(this, flags);
- else if (format > QImage::Format_Indexed8 && newFormat > QImage::Format_Indexed8 && !qimage_converter_map[format][newFormat])
+ if (format > QImage::Format_Indexed8 && newFormat > QImage::Format_Indexed8 && !qimage_converter_map[format][newFormat]) {
// Convert inplace generic, but only if there are no direct converters,
// any direct ones are probably better even if not inplace.
+ if (qt_highColorPrecision(newFormat, !qPixelLayouts[newFormat].hasAlphaChannel)
+ && qt_highColorPrecision(format, !qPixelLayouts[format].hasAlphaChannel)) {
+#if QT_CONFIG(raster_fp)
+ if (qt_fpColorPrecision(format) && qt_fpColorPrecision(newFormat))
+ return convert_generic_inplace_over_rgba32f(this, newFormat, flags);
+#endif
+ return convert_generic_inplace_over_rgb64(this, newFormat, flags);
+ }
return convert_generic_inplace(this, newFormat, flags);
- else
- return false;
+ }
+ return false;
}
/*!
@@ -5122,51 +5913,7 @@ QDebug operator<<(QDebug dbg, const QImage &i)
}
#endif
-/*!
- \fn void QImage::setNumColors(int n)
- \obsolete
-
- Resizes the color table to contain \a n entries.
-
- \sa setColorCount()
- */
-
-/*!
- \fn int QImage::numBytes() const
- \obsolete
-
- Returns the number of bytes occupied by the image data.
-
- \sa sizeInBytes()
- */
-
-/*!
- \fn QStringList QImage::textLanguages() const
- \obsolete
-
- Returns the language identifiers for which some texts are recorded.
- Note that if you want to iterate over the list, you should iterate over a copy.
-
- The language the text is recorded in is no longer relevant since the text is
- always set using QString and UTF-8 representation.
-
- \sa textKeys()
- */
-
-/*!
- \fn QList<QImageTextKeyLang> QImage::textList() const
- \obsolete
-
- Returns a list of QImageTextKeyLang objects that enumerate all the texts
- key/language pairs set for this image.
-
- The language the text is recorded in is no longer relevant since the text
- is always set using QString and UTF-8 representation.
-
- \sa textKeys()
- */
-
-static Q_CONSTEXPR QPixelFormat pixelformats[] = {
+static constexpr QPixelFormat pixelformats[] = {
//QImage::Format_Invalid:
QPixelFormat(),
//QImage::Format_Mono:
@@ -5546,8 +6293,99 @@ static Q_CONSTEXPR QPixelFormat pixelformats[] = {
/*PREMULTIPLIED*/ QPixelFormat::NotPremultiplied,
/*INTERPRETATION*/ QPixelFormat::UnsignedByte,
/*BYTE ORDER*/ QPixelFormat::CurrentSystemEndian),
+ //QImage::Format_RGBX16FPx4:
+ QPixelFormat(QPixelFormat::RGB,
+ /*RED*/ 16,
+ /*GREEN*/ 16,
+ /*BLUE*/ 16,
+ /*FOURTH*/ 0,
+ /*FIFTH*/ 0,
+ /*ALPHA*/ 16,
+ /*ALPHA USAGE*/ QPixelFormat::IgnoresAlpha,
+ /*ALPHA POSITION*/ QPixelFormat::AtEnd,
+ /*PREMULTIPLIED*/ QPixelFormat::NotPremultiplied,
+ /*INTERPRETATION*/ QPixelFormat::FloatingPoint,
+ /*BYTE ORDER*/ QPixelFormat::CurrentSystemEndian),
+ //QImage::Format_RGBA16FPx4:
+ QPixelFormat(QPixelFormat::RGB,
+ /*RED*/ 16,
+ /*GREEN*/ 16,
+ /*BLUE*/ 16,
+ /*FOURTH*/ 0,
+ /*FIFTH*/ 0,
+ /*ALPHA*/ 16,
+ /*ALPHA USAGE*/ QPixelFormat::UsesAlpha,
+ /*ALPHA POSITION*/ QPixelFormat::AtEnd,
+ /*PREMULTIPLIED*/ QPixelFormat::NotPremultiplied,
+ /*INTERPRETATION*/ QPixelFormat::FloatingPoint,
+ /*BYTE ORDER*/ QPixelFormat::CurrentSystemEndian),
+ //QImage::Format_RGBA16FPx4_Premultiplied:
+ QPixelFormat(QPixelFormat::RGB,
+ /*RED*/ 16,
+ /*GREEN*/ 16,
+ /*BLUE*/ 16,
+ /*FOURTH*/ 0,
+ /*FIFTH*/ 0,
+ /*ALPHA*/ 16,
+ /*ALPHA USAGE*/ QPixelFormat::UsesAlpha,
+ /*ALPHA POSITION*/ QPixelFormat::AtEnd,
+ /*PREMULTIPLIED*/ QPixelFormat::Premultiplied,
+ /*INTERPRETATION*/ QPixelFormat::FloatingPoint,
+ /*BYTE ORDER*/ QPixelFormat::CurrentSystemEndian),
+ //QImage::Format_RGBX32FPx4:
+ QPixelFormat(QPixelFormat::RGB,
+ /*RED*/ 32,
+ /*GREEN*/ 32,
+ /*BLUE*/ 32,
+ /*FOURTH*/ 0,
+ /*FIFTH*/ 0,
+ /*ALPHA*/ 32,
+ /*ALPHA USAGE*/ QPixelFormat::IgnoresAlpha,
+ /*ALPHA POSITION*/ QPixelFormat::AtEnd,
+ /*PREMULTIPLIED*/ QPixelFormat::NotPremultiplied,
+ /*INTERPRETATION*/ QPixelFormat::FloatingPoint,
+ /*BYTE ORDER*/ QPixelFormat::CurrentSystemEndian),
+ //QImage::Format_RGBA32FPx4:
+ QPixelFormat(QPixelFormat::RGB,
+ /*RED*/ 32,
+ /*GREEN*/ 32,
+ /*BLUE*/ 32,
+ /*FOURTH*/ 0,
+ /*FIFTH*/ 0,
+ /*ALPHA*/ 32,
+ /*ALPHA USAGE*/ QPixelFormat::UsesAlpha,
+ /*ALPHA POSITION*/ QPixelFormat::AtEnd,
+ /*PREMULTIPLIED*/ QPixelFormat::NotPremultiplied,
+ /*INTERPRETATION*/ QPixelFormat::FloatingPoint,
+ /*BYTE ORDER*/ QPixelFormat::CurrentSystemEndian),
+ //QImage::Format_RGBA32FPx4_Premultiplied:
+ QPixelFormat(QPixelFormat::RGB,
+ /*RED*/ 32,
+ /*GREEN*/ 32,
+ /*BLUE*/ 32,
+ /*FOURTH*/ 0,
+ /*FIFTH*/ 0,
+ /*ALPHA*/ 32,
+ /*ALPHA USAGE*/ QPixelFormat::UsesAlpha,
+ /*ALPHA POSITION*/ QPixelFormat::AtEnd,
+ /*PREMULTIPLIED*/ QPixelFormat::Premultiplied,
+ /*INTERPRETATION*/ QPixelFormat::FloatingPoint,
+ /*BYTE ORDER*/ QPixelFormat::CurrentSystemEndian),
+ //QImage::Format_CMYK8888:
+ QPixelFormat(QPixelFormat::CMYK,
+ /*RED*/ 8,
+ /*GREEN*/ 8,
+ /*BLUE*/ 8,
+ /*FOURTH*/ 8,
+ /*FIFTH*/ 0,
+ /*ALPHA*/ 0,
+ /*ALPHA USAGE*/ QPixelFormat::IgnoresAlpha,
+ /*ALPHA POSITION*/ QPixelFormat::AtBeginning,
+ /*PREMULTIPLIED*/ QPixelFormat::NotPremultiplied,
+ /*INTERPRETATION*/ QPixelFormat::UnsignedInteger,
+ /*BYTE ORDER*/ QPixelFormat::CurrentSystemEndian),
};
-Q_STATIC_ASSERT(sizeof(pixelformats) / sizeof(*pixelformats) == QImage::NImageFormats);
+static_assert(sizeof(pixelformats) / sizeof(*pixelformats) == QImage::NImageFormats);
/*!
Returns the QImage::Format as a QPixelFormat
@@ -5562,7 +6400,7 @@ QPixelFormat QImage::pixelFormat() const noexcept
*/
QPixelFormat QImage::toPixelFormat(QImage::Format format) noexcept
{
- Q_ASSERT(static_cast<int>(format) < NImageFormats);
+ Q_ASSERT(static_cast<int>(format) < NImageFormats && static_cast<int>(format) >= 0);
return pixelformats[format];
}
@@ -5606,14 +6444,13 @@ QMap<QString, QString> qt_getImageText(const QImage &image, const QString &descr
QMap<QString, QString> qt_getImageTextFromDescription(const QString &description)
{
QMap<QString, QString> text;
- const auto pairs = description.splitRef(QLatin1String("\n\n"));
- for (const QStringRef &pair : pairs) {
- int index = pair.indexOf(QLatin1Char(':'));
- if (index >= 0 && pair.indexOf(QLatin1Char(' ')) < index) {
+ for (const auto &pair : QStringView{description}.tokenize(u"\n\n")) {
+ int index = pair.indexOf(u':');
+ if (index >= 0 && pair.indexOf(u' ') < index) {
if (!pair.trimmed().isEmpty())
- text.insert(QLatin1String("Description"), pair.toString().simplified());
+ text.insert("Description"_L1, pair.toString().simplified());
} else {
- const QStringRef key = pair.left(index);
+ const auto key = pair.left(index);
if (!key.trimmed().isEmpty())
text.insert(key.toString(), pair.mid(index + 2).toString().simplified());
}
@@ -5622,3 +6459,5 @@ QMap<QString, QString> qt_getImageTextFromDescription(const QString &description
}
QT_END_NAMESPACE
+
+#include "moc_qimage.cpp"
diff --git a/src/gui/image/qimage.h b/src/gui/image/qimage.h
index 73c960f13f..cba50e5e4c 100644
--- a/src/gui/image/qimage.h
+++ b/src/gui/image/qimage.h
@@ -1,41 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the QtGui module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2021 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#ifndef QIMAGE_H
#define QIMAGE_H
@@ -47,12 +11,10 @@
#include <QtGui/qpixelformat.h>
#include <QtGui/qtransform.h>
#include <QtCore/qbytearray.h>
+#include <QtCore/qbytearrayview.h>
#include <QtCore/qrect.h>
#include <QtCore/qstring.h>
-
-#if QT_DEPRECATED_SINCE(5, 0)
-#include <QtCore/qstringlist.h>
-#endif
+#include <QtCore/qcontainerfwd.h>
#if defined(Q_OS_DARWIN) || defined(Q_QDOC)
Q_FORWARD_DECLARE_MUTABLE_CG_TYPE(CGImage);
@@ -64,34 +26,10 @@ QT_BEGIN_NAMESPACE
class QColorSpace;
class QColorTransform;
class QIODevice;
-class QMatrix;
-class QStringList;
class QTransform;
class QVariant;
-template <class T> class QVector;
struct QImageData;
-class QImageDataMisc; // internal
-#if QT_DEPRECATED_SINCE(5, 0)
-class QImageTextKeyLang {
-public:
- QT_DEPRECATED QImageTextKeyLang(const char* k, const char* l) : key(k), lang(l) { }
- QT_DEPRECATED QImageTextKeyLang() { }
-
- QByteArray key;
- QByteArray lang;
-
- bool operator< (const QImageTextKeyLang& other) const
- { return key < other.key || (key==other.key && lang < other.lang); }
- bool operator== (const QImageTextKeyLang& other) const
- { return key==other.key && lang==other.lang; }
- inline bool operator!= (const QImageTextKeyLang &other) const
- { return !operator==(other); }
-private:
- friend class QImage;
- QImageTextKeyLang(bool /*dummy*/) {}
-};
-#endif
typedef void (*QImageCleanupFunction)(void*);
@@ -131,6 +69,13 @@ public:
Format_RGBA64_Premultiplied,
Format_Grayscale16,
Format_BGR888,
+ Format_RGBX16FPx4,
+ Format_RGBA16FPx4,
+ Format_RGBA16FPx4_Premultiplied,
+ Format_RGBX32FPx4,
+ Format_RGBA32FPx4,
+ Format_RGBA32FPx4_Premultiplied,
+ Format_CMYK8888,
#ifndef Q_QDOC
NImageFormats
#endif
@@ -142,8 +87,8 @@ public:
QImage(int width, int height, Format format);
QImage(uchar *data, int width, int height, Format format, QImageCleanupFunction cleanupFunction = nullptr, void *cleanupInfo = nullptr);
QImage(const uchar *data, int width, int height, Format format, QImageCleanupFunction cleanupFunction = nullptr, void *cleanupInfo = nullptr);
- QImage(uchar *data, int width, int height, int bytesPerLine, Format format, QImageCleanupFunction cleanupFunction = nullptr, void *cleanupInfo = nullptr);
- QImage(const uchar *data, int width, int height, int bytesPerLine, Format format, QImageCleanupFunction cleanupFunction = nullptr, void *cleanupInfo = nullptr);
+ QImage(uchar *data, int width, int height, qsizetype bytesPerLine, Format format, QImageCleanupFunction cleanupFunction = nullptr, void *cleanupInfo = nullptr);
+ QImage(const uchar *data, int width, int height, qsizetype bytesPerLine, Format format, QImageCleanupFunction cleanupFunction = nullptr, void *cleanupInfo = nullptr);
#ifndef QT_NO_IMAGEFORMAT_XPM
explicit QImage(const char * const xpm[]);
@@ -151,16 +96,15 @@ public:
explicit QImage(const QString &fileName, const char *format = nullptr);
QImage(const QImage &);
- inline QImage(QImage &&other) noexcept
- : QPaintDevice(), d(nullptr)
- { qSwap(d, other.d); }
+ QImage(QImage &&other) noexcept
+ : QPaintDevice(), d(std::exchange(other.d, nullptr))
+ {}
~QImage();
QImage &operator=(const QImage &);
- inline QImage &operator=(QImage &&other) noexcept
- { qSwap(d, other.d); return *this; }
- inline void swap(QImage &other) noexcept
- { qSwap(d, other.d); }
+ QT_MOVE_ASSIGNMENT_OPERATOR_IMPL_VIA_MOVE_AND_SWAP(QImage)
+ void swap(QImage &other) noexcept
+ { qt_ptr_swap(d, other.d); }
bool isNull() const;
@@ -172,24 +116,29 @@ public:
void detach();
bool isDetached() const;
- QImage copy(const QRect &rect = QRect()) const;
- inline QImage copy(int x, int y, int w, int h) const
- { return copy(QRect(x, y, w, h)); }
+ [[nodiscard]] QImage copy(const QRect &rect = QRect()) const;
+ [[nodiscard]] QImage copy(int x, int y, int w, int h) const
+ { return copy(QRect(x, y, w, h)); }
Format format() const;
- Q_REQUIRED_RESULT Q_ALWAYS_INLINE QImage convertToFormat(Format f, Qt::ImageConversionFlags flags = Qt::AutoColor) const &
+ [[nodiscard]] QImage convertToFormat(Format f, Qt::ImageConversionFlags flags = Qt::AutoColor) const &
{ return convertToFormat_helper(f, flags); }
- Q_REQUIRED_RESULT Q_ALWAYS_INLINE QImage convertToFormat(Format f, Qt::ImageConversionFlags flags = Qt::AutoColor) &&
+ [[nodiscard]] QImage convertToFormat(Format f, Qt::ImageConversionFlags flags = Qt::AutoColor) &&
{
if (convertToFormat_inplace(f, flags))
return std::move(*this);
else
return convertToFormat_helper(f, flags);
}
- Q_REQUIRED_RESULT QImage convertToFormat(Format f, const QVector<QRgb> &colorTable, Qt::ImageConversionFlags flags = Qt::AutoColor) const;
- bool reinterpretAsFormat(Format f);
+ [[nodiscard]] QImage convertToFormat(Format f, const QList<QRgb> &colorTable,
+ Qt::ImageConversionFlags flags = Qt::AutoColor) const;
+ bool reinterpretAsFormat(Format f);
+ [[nodiscard]] QImage convertedTo(Format f, Qt::ImageConversionFlags flags = Qt::AutoColor) const &
+ { return convertToFormat(f, flags); }
+ [[nodiscard]] QImage convertedTo(Format f, Qt::ImageConversionFlags flags = Qt::AutoColor) &&
+ { return convertToFormat(f, flags); }
void convertTo(Format f, Qt::ImageConversionFlags flags = Qt::AutoColor);
int width() const;
@@ -212,19 +161,12 @@ public:
const uchar *bits() const;
const uchar *constBits() const;
-#if QT_DEPRECATED_SINCE(5, 10)
- QT_DEPRECATED_X("Use sizeInBytes") int byteCount() const;
-#endif
qsizetype sizeInBytes() const;
uchar *scanLine(int);
const uchar *scanLine(int) const;
const uchar *constScanLine(int) const;
-#if QT_VERSION >= QT_VERSION_CHECK(6,0,0)
qsizetype bytesPerLine() const;
-#else
- int bytesPerLine() const;
-#endif
bool valid(int x, int y) const;
bool valid(const QPoint &pt) const;
@@ -244,15 +186,12 @@ public:
void setPixelColor(int x, int y, const QColor &c);
void setPixelColor(const QPoint &pt, const QColor &c);
- QVector<QRgb> colorTable() const;
-#if QT_VERSION >= QT_VERSION_CHECK(6,0,0)
- void setColorTable(const QVector<QRgb> &colors);
-#else
- void setColorTable(const QVector<QRgb> colors);
-#endif
+ QList<QRgb> colorTable() const;
+ void setColorTable(const QList<QRgb> &colors);
qreal devicePixelRatio() const;
void setDevicePixelRatio(qreal scaleFactor);
+ QSizeF deviceIndependentSize() const;
void fill(uint pixel);
void fill(const QColor &color);
@@ -261,57 +200,65 @@ public:
bool hasAlphaChannel() const;
void setAlphaChannel(const QImage &alphaChannel);
- QImage alphaChannel() const;
- QImage createAlphaMask(Qt::ImageConversionFlags flags = Qt::AutoColor) const;
+ [[nodiscard]] QImage createAlphaMask(Qt::ImageConversionFlags flags = Qt::AutoColor) const;
#ifndef QT_NO_IMAGE_HEURISTIC_MASK
- QImage createHeuristicMask(bool clipTight = true) const;
+ [[nodiscard]] QImage createHeuristicMask(bool clipTight = true) const;
#endif
- QImage createMaskFromColor(QRgb color, Qt::MaskMode mode = Qt::MaskInColor) const;
-
- inline QImage scaled(int w, int h, Qt::AspectRatioMode aspectMode = Qt::IgnoreAspectRatio,
- Qt::TransformationMode mode = Qt::FastTransformation) const
- { return scaled(QSize(w, h), aspectMode, mode); }
- QImage scaled(const QSize &s, Qt::AspectRatioMode aspectMode = Qt::IgnoreAspectRatio,
- Qt::TransformationMode mode = Qt::FastTransformation) const;
- QImage scaledToWidth(int w, Qt::TransformationMode mode = Qt::FastTransformation) const;
- QImage scaledToHeight(int h, Qt::TransformationMode mode = Qt::FastTransformation) const;
- QImage transformed(const QMatrix &matrix, Qt::TransformationMode mode = Qt::FastTransformation) const;
- static QMatrix trueMatrix(const QMatrix &, int w, int h);
- QImage transformed(const QTransform &matrix, Qt::TransformationMode mode = Qt::FastTransformation) const;
+ [[nodiscard]] QImage createMaskFromColor(QRgb color, Qt::MaskMode mode = Qt::MaskInColor) const;
+
+ [[nodiscard]] QImage scaled(int w, int h, Qt::AspectRatioMode aspectMode = Qt::IgnoreAspectRatio,
+ Qt::TransformationMode mode = Qt::FastTransformation) const
+ { return scaled(QSize(w, h), aspectMode, mode); }
+ [[nodiscard]] QImage scaled(const QSize &s, Qt::AspectRatioMode aspectMode = Qt::IgnoreAspectRatio,
+ Qt::TransformationMode mode = Qt::FastTransformation) const;
+ [[nodiscard]] QImage scaledToWidth(int w, Qt::TransformationMode mode = Qt::FastTransformation) const;
+ [[nodiscard]] QImage scaledToHeight(int h, Qt::TransformationMode mode = Qt::FastTransformation) const;
+ [[nodiscard]] QImage transformed(const QTransform &matrix, Qt::TransformationMode mode = Qt::FastTransformation) const;
static QTransform trueMatrix(const QTransform &, int w, int h);
- QImage mirrored(bool horizontally = false, bool vertically = true) const &
- { return mirrored_helper(horizontally, vertically); }
- QImage &&mirrored(bool horizontally = false, bool vertically = true) &&
- { mirrored_inplace(horizontally, vertically); return std::move(*this); }
- QImage rgbSwapped() const &
- { return rgbSwapped_helper(); }
- QImage &&rgbSwapped() &&
- { rgbSwapped_inplace(); return std::move(*this); }
+
+ [[nodiscard]] QImage mirrored(bool horizontally = false, bool vertically = true) const &
+ { return mirrored_helper(horizontally, vertically); }
+ [[nodiscard]] QImage mirrored(bool horizontally = false, bool vertically = true) &&
+ { mirrored_inplace(horizontally, vertically); return std::move(*this); }
+ [[nodiscard]] QImage rgbSwapped() const &
+ { return rgbSwapped_helper(); }
+ [[nodiscard]] QImage rgbSwapped() &&
+ { rgbSwapped_inplace(); return std::move(*this); }
+ void mirror(bool horizontally = false, bool vertically = true)
+ { mirrored_inplace(horizontally, vertically); }
+ void rgbSwap()
+ { rgbSwapped_inplace(); }
void invertPixels(InvertMode = InvertRgb);
QColorSpace colorSpace() const;
- QImage convertedToColorSpace(const QColorSpace &) const;
- void convertToColorSpace(const QColorSpace &);
- void setColorSpace(const QColorSpace &);
-
+ [[nodiscard]] QImage convertedToColorSpace(const QColorSpace &colorSpace) const;
+ [[nodiscard]] QImage convertedToColorSpace(const QColorSpace &colorSpace, QImage::Format format, Qt::ImageConversionFlags flags = Qt::AutoColor) const;
+ void convertToColorSpace(const QColorSpace &colorSpace);
+ void convertToColorSpace(const QColorSpace &colorSpace, QImage::Format format, Qt::ImageConversionFlags flags = Qt::AutoColor);
+ void setColorSpace(const QColorSpace &colorSpace);
+
+ QImage colorTransformed(const QColorTransform &transform) const &;
+ QImage colorTransformed(const QColorTransform &transform, QImage::Format format, Qt::ImageConversionFlags flags = Qt::AutoColor) const &;
+ QImage colorTransformed(const QColorTransform &transform) &&;
+ QImage colorTransformed(const QColorTransform &transform, QImage::Format format, Qt::ImageConversionFlags flags = Qt::AutoColor) &&;
void applyColorTransform(const QColorTransform &transform);
+ void applyColorTransform(const QColorTransform &transform, QImage::Format format, Qt::ImageConversionFlags flags = Qt::AutoColor);
- bool load(QIODevice *device, const char* format);
+ bool load(QIODevice *device, const char *format);
bool load(const QString &fileName, const char *format = nullptr);
- bool loadFromData(const uchar *buf, int len, const char *format = nullptr);
- inline bool loadFromData(const QByteArray &data, const char *aformat = nullptr)
- { return loadFromData(reinterpret_cast<const uchar *>(data.constData()), data.size(), aformat); }
+ bool loadFromData(QByteArrayView data, const char *format = nullptr);
+ bool loadFromData(const uchar *buf, int len, const char *format = nullptr); // ### Qt 7: qsizetype
+ bool loadFromData(const QByteArray &data, const char *format = nullptr) // ### Qt 7: drop
+ { return loadFromData(QByteArrayView(data), format); }
bool save(const QString &fileName, const char *format = nullptr, int quality = -1) const;
bool save(QIODevice *device, const char *format = nullptr, int quality = -1) const;
- static QImage fromData(const uchar *data, int size, const char *format = nullptr);
- inline static QImage fromData(const QByteArray &data, const char *format = nullptr)
- { return fromData(reinterpret_cast<const uchar *>(data.constData()), data.size(), format); }
+ static QImage fromData(QByteArrayView data, const char *format = nullptr);
+ static QImage fromData(const uchar *data, int size, const char *format = nullptr); // ### Qt 7: qsizetype
+ static QImage fromData(const QByteArray &data, const char *format = nullptr) // ### Qt 7: drop
+ { return fromData(QByteArrayView(data), format); }
-#if QT_DEPRECATED_SINCE(5, 0)
- QT_DEPRECATED inline int serialNumber() const { return cacheKey() >> 32; }
-#endif
qint64 cacheKey() const;
QPaintEngine *paintEngine() const override;
@@ -336,19 +283,11 @@ public:
#if defined(Q_OS_DARWIN) || defined(Q_QDOC)
CGImageRef toCGImage() const Q_DECL_CF_RETURNS_RETAINED;
#endif
-
-#if QT_DEPRECATED_SINCE(5, 0)
- QT_DEPRECATED inline QString text(const char *key, const char *lang = nullptr) const;
- QT_DEPRECATED inline QList<QImageTextKeyLang> textList() const;
- QT_DEPRECATED inline QStringList textLanguages() const;
- QT_DEPRECATED inline QString text(const QImageTextKeyLang&) const;
- QT_DEPRECATED inline void setText(const char* key, const char* lang, const QString&);
-#endif
-
-#if QT_DEPRECATED_SINCE(5, 0)
- QT_DEPRECATED inline int numColors() const;
- QT_DEPRECATED inline void setNumColors(int);
- QT_DEPRECATED inline int numBytes() const;
+#if defined(Q_OS_WIN) || defined(Q_QDOC)
+ HBITMAP toHBITMAP() const;
+ HICON toHICON(const QImage &mask = {}) const;
+ static QImage fromHBITMAP(HBITMAP hbitmap);
+ static QImage fromHICON(HICON icon);
#endif
protected:
@@ -361,13 +300,15 @@ protected:
bool convertToFormat_inplace(Format format, Qt::ImageConversionFlags flags);
QImage smoothScaled(int w, int h) const;
+ void detachMetadata(bool invalidateCache = false);
+
private:
- friend class QWSOnScreenSurface;
QImageData *d;
friend class QRasterPlatformPixmap;
friend class QBlittablePlatformPixmap;
friend class QPixmapCacheEntry;
+ friend struct QImageData;
public:
typedef QImageData * DataPtr;
@@ -385,99 +326,6 @@ inline void QImage::setPixel(const QPoint &pt, uint index_or_rgb) { setPixel(pt.
inline QColor QImage::pixelColor(const QPoint &pt) const { return pixelColor(pt.x(), pt.y()); }
inline void QImage::setPixelColor(const QPoint &pt, const QColor &c) { setPixelColor(pt.x(), pt.y(), c); }
-#if QT_DEPRECATED_SINCE(5, 0)
-
-QT_WARNING_PUSH
-QT_WARNING_DISABLE_DEPRECATED
-
-inline QString QImage::text(const char* key, const char* lang) const
-{
- if (!d)
- return QString();
- QString k = QString::fromLatin1(key);
- if (lang && *lang)
- k += QLatin1Char('/') + QString::fromLatin1(lang);
- return text(k);
-}
-
-inline QList<QImageTextKeyLang> QImage::textList() const
-{
- QList<QImageTextKeyLang> imageTextKeys;
- if (!d)
- return imageTextKeys;
- QStringList keys = textKeys();
- for (int i = 0; i < keys.size(); ++i) {
- int index = keys.at(i).indexOf(QLatin1Char('/'));
- if (index > 0) {
- QImageTextKeyLang tkl(true);
- tkl.key = keys.at(i).left(index).toLatin1();
- tkl.lang = keys.at(i).mid(index+1).toLatin1();
- imageTextKeys += tkl;
- }
- }
-
- return imageTextKeys;
-}
-
-inline QStringList QImage::textLanguages() const
-{
- if (!d)
- return QStringList();
- QStringList keys = textKeys();
- QStringList languages;
- for (int i = 0; i < keys.size(); ++i) {
- int index = keys.at(i).indexOf(QLatin1Char('/'));
- if (index > 0)
- languages += keys.at(i).mid(index+1);
- }
-
- return languages;
-}
-
-inline QString QImage::text(const QImageTextKeyLang&kl) const
-{
- if (!d)
- return QString();
- QString k = QString::fromLatin1(kl.key.constData());
- if (!kl.lang.isEmpty())
- k += QLatin1Char('/') + QString::fromLatin1(kl.lang.constData());
- return text(k);
-}
-
-inline void QImage::setText(const char* key, const char* lang, const QString &s)
-{
- if (!d)
- return;
- detach();
-
- // In case detach() ran out of memory
- if (!d)
- return;
-
- QString k = QString::fromLatin1(key);
- if (lang && *lang)
- k += QLatin1Char('/') + QString::fromLatin1(lang);
- setText(k, s);
-}
-
-QT_WARNING_POP
-
-inline int QImage::numColors() const
-{
- return colorCount();
-}
-
-inline void QImage::setNumColors(int n)
-{
- setColorCount(n);
-}
-
-inline int QImage::numBytes() const
-{
- return int(sizeInBytes());
-}
-#endif
-
// QImage stream functions
#if !defined(QT_NO_DATASTREAM)
diff --git a/src/gui/image/qimage_conversions.cpp b/src/gui/image/qimage_conversions.cpp
index 27088698ec..a806954df2 100644
--- a/src/gui/image/qimage_conversions.cpp
+++ b/src/gui/image/qimage_conversions.cpp
@@ -1,49 +1,28 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the QtGui module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2021 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
-#include <private/qdrawhelper_p.h>
#include <private/qguiapplication_p.h>
+#include <private/qcolortransform_p.h>
#include <private/qcolortrclut_p.h>
+#include <private/qcmyk_p.h>
+#include <private/qdrawhelper_p.h>
#include <private/qendian_p.h>
+#include <private/qpixellayout_p.h>
#include <private/qsimd_p.h>
#include <private/qimage_p.h>
+
#include <qendian.h>
+#include <qrgbafloat.h>
+#if QT_CONFIG(thread)
+#include <qsemaphore.h>
+#include <qthreadpool.h>
+#include <private/qthreadpool_p.h>
+#ifdef Q_OS_WASM
+// WebAssembly has threads; however we can't block the main thread.
+#else
+#define QT_USE_THREAD_PARALLEL_IMAGE_CONVERSIONS
+#endif
+#endif
QT_BEGIN_NAMESPACE
@@ -58,7 +37,7 @@ struct QDefaultColorTables
}
}
- QVector<QRgb> gray, alpha;
+ QList<QRgb> gray, alpha;
};
Q_GLOBAL_STATIC(QDefaultColorTables, defaultColorTables);
@@ -119,9 +98,9 @@ void qGamma_correct_back_to_linear_cs(QImage *image)
*****************************************************************************/
// The drawhelper conversions from/to RGB32 are passthroughs which is not always correct for general image conversion
-#if !defined(__ARM_NEON__)
+#if !defined(__ARM_NEON__) || !(Q_BYTE_ORDER == Q_LITTLE_ENDIAN)
static void QT_FASTCALL storeRGB32FromARGB32PM(uchar *dest, const uint *src, int index, int count,
- const QVector<QRgb> *, QDitherInfo *)
+ const QList<QRgb> *, QDitherInfo *)
{
uint *d = reinterpret_cast<uint *>(dest) + index;
for (int i = 0; i < count; ++i)
@@ -130,7 +109,7 @@ static void QT_FASTCALL storeRGB32FromARGB32PM(uchar *dest, const uint *src, int
#endif
static void QT_FASTCALL storeRGB32FromARGB32(uchar *dest, const uint *src, int index, int count,
- const QVector<QRgb> *, QDitherInfo *)
+ const QList<QRgb> *, QDitherInfo *)
{
uint *d = reinterpret_cast<uint *>(dest) + index;
for (int i = 0; i < count; ++i)
@@ -138,7 +117,7 @@ static void QT_FASTCALL storeRGB32FromARGB32(uchar *dest, const uint *src, int i
}
static const uint *QT_FASTCALL fetchRGB32ToARGB32PM(uint *buffer, const uchar *src, int index, int count,
- const QVector<QRgb> *, QDitherInfo *)
+ const QList<QRgb> *, QDitherInfo *)
{
const uint *s = reinterpret_cast<const uint *>(src) + index;
for (int i = 0; i < count; ++i)
@@ -148,10 +127,10 @@ static const uint *QT_FASTCALL fetchRGB32ToARGB32PM(uint *buffer, const uchar *s
#ifdef QT_COMPILER_SUPPORTS_SSE4_1
extern void QT_FASTCALL storeRGB32FromARGB32PM_sse4(uchar *dest, const uint *src, int index, int count,
- const QVector<QRgb> *, QDitherInfo *);
-#elif defined(__ARM_NEON__)
+ const QList<QRgb> *, QDitherInfo *);
+#elif defined(__ARM_NEON__) && (Q_BYTE_ORDER == Q_LITTLE_ENDIAN)
extern void QT_FASTCALL storeRGB32FromARGB32PM_neon(uchar *dest, const uint *src, int index, int count,
- const QVector<QRgb> *, QDitherInfo *);
+ const QList<QRgb> *, QDitherInfo *);
#endif
void convert_generic(QImageData *dest, const QImageData *src, Qt::ImageConversionFlags flags)
@@ -159,12 +138,8 @@ void convert_generic(QImageData *dest, const QImageData *src, Qt::ImageConversio
// Cannot be used with indexed formats.
Q_ASSERT(dest->format > QImage::Format_Indexed8);
Q_ASSERT(src->format > QImage::Format_Indexed8);
- uint buf[BufferSize];
- uint *buffer = buf;
const QPixelLayout *srcLayout = &qPixelLayouts[src->format];
const QPixelLayout *destLayout = &qPixelLayouts[dest->format];
- const uchar *srcData = src->data;
- uchar *destData = dest->data;
FetchAndConvertPixelsFunc fetch = srcLayout->fetchToARGB32PM;
ConvertAndStorePixelsFunc store = destLayout->storeFromARGB32PM;
@@ -181,7 +156,7 @@ void convert_generic(QImageData *dest, const QImageData *src, Qt::ImageConversio
store = storeRGB32FromARGB32PM_sse4;
else
store = storeRGB32FromARGB32PM;
-#elif defined(__ARM_NEON__)
+#elif defined(__ARM_NEON__) && (Q_BYTE_ORDER == Q_LITTLE_ENDIAN)
store = storeRGB32FromARGB32PM_neon;
#else
store = storeRGB32FromARGB32PM;
@@ -191,66 +166,174 @@ void convert_generic(QImageData *dest, const QImageData *src, Qt::ImageConversio
if (srcLayout->hasAlphaChannel && !srcLayout->premultiplied &&
!destLayout->hasAlphaChannel && destLayout->storeFromRGB32) {
// Avoid unnecessary premultiply and unpremultiply when converting from unpremultiplied src format.
- fetch = qPixelLayouts[src->format + 1].fetchToARGB32PM;
+ fetch = qPixelLayouts[qt_toPremultipliedFormat(src->format)].fetchToARGB32PM;
if (dest->format == QImage::Format_RGB32)
store = storeRGB32FromARGB32;
else
store = destLayout->storeFromRGB32;
}
- QDitherInfo dither;
- QDitherInfo *ditherPtr = nullptr;
- if ((flags & Qt::PreferDither) && (flags & Qt::Dither_Mask) != Qt::ThresholdDither)
- ditherPtr = &dither;
- for (int y = 0; y < src->height; ++y) {
- dither.y = y;
- int x = 0;
- while (x < src->width) {
- dither.x = x;
- int l = src->width - x;
- if (destLayout->bpp == QPixelLayout::BPP32)
- buffer = reinterpret_cast<uint *>(destData) + x;
- else
- l = qMin(l, BufferSize);
- const uint *ptr = fetch(buffer, srcData, x, l, nullptr, ditherPtr);
- store(destData, ptr, x, l, nullptr, ditherPtr);
- x += l;
+ auto convertSegment = [=](int yStart, int yEnd) {
+ uint buf[BufferSize];
+ uint *buffer = buf;
+ const uchar *srcData = src->data + src->bytes_per_line * yStart;
+ uchar *destData = dest->data + dest->bytes_per_line * yStart;
+ QDitherInfo dither;
+ QDitherInfo *ditherPtr = nullptr;
+ if ((flags & Qt::PreferDither) && (flags & Qt::Dither_Mask) != Qt::ThresholdDither)
+ ditherPtr = &dither;
+ for (int y = yStart; y < yEnd; ++y) {
+ dither.y = y;
+ int x = 0;
+ while (x < src->width) {
+ dither.x = x;
+ int l = src->width - x;
+ if (destLayout->bpp == QPixelLayout::BPP32)
+ buffer = reinterpret_cast<uint *>(destData) + x;
+ else
+ l = qMin(l, BufferSize);
+ const uint *ptr = fetch(buffer, srcData, x, l, nullptr, ditherPtr);
+ store(destData, ptr, x, l, nullptr, ditherPtr);
+ x += l;
+ }
+ srcData += src->bytes_per_line;
+ destData += dest->bytes_per_line;
}
- srcData += src->bytes_per_line;
- destData += dest->bytes_per_line;
- }
+ };
+
+#ifdef QT_USE_THREAD_PARALLEL_IMAGE_CONVERSIONS
+ int segments = (qsizetype(src->width) * src->height) >> 16;
+ segments = std::min(segments, src->height);
+
+ QThreadPool *threadPool = QThreadPoolPrivate::qtGuiInstance();
+ if (segments <= 1 || !threadPool || threadPool->contains(QThread::currentThread()))
+ return convertSegment(0, src->height);
+
+ QSemaphore semaphore;
+ int y = 0;
+ for (int i = 0; i < segments; ++i) {
+ int yn = (src->height - y) / (segments - i);
+ threadPool->start([&, y, yn]() {
+ convertSegment(y, y + yn);
+ semaphore.release(1);
+ });
+ y += yn;
+ }
+ semaphore.acquire(segments);
+#else
+ convertSegment(0, src->height);
+#endif
}
-void convert_generic_to_rgb64(QImageData *dest, const QImageData *src, Qt::ImageConversionFlags)
+void convert_generic_over_rgb64(QImageData *dest, const QImageData *src, Qt::ImageConversionFlags)
{
Q_ASSERT(dest->format > QImage::Format_Indexed8);
Q_ASSERT(src->format > QImage::Format_Indexed8);
- QRgba64 buf[BufferSize];
- QRgba64 *buffer = buf;
const QPixelLayout *srcLayout = &qPixelLayouts[src->format];
const QPixelLayout *destLayout = &qPixelLayouts[dest->format];
- const uchar *srcData = src->data;
- uchar *destData = dest->data;
const FetchAndConvertPixelsFunc64 fetch = srcLayout->fetchToRGBA64PM;
const ConvertAndStorePixelsFunc64 store = qStoreFromRGBA64PM[dest->format];
- for (int y = 0; y < src->height; ++y) {
- int x = 0;
- while (x < src->width) {
- int l = src->width - x;
- if (destLayout->bpp == QPixelLayout::BPP64)
- buffer = reinterpret_cast<QRgba64 *>(destData) + x;
- else
- l = qMin(l, BufferSize);
- const QRgba64 *ptr = fetch(buffer, srcData, x, l, nullptr, nullptr);
- store(destData, ptr, x, l, nullptr, nullptr);
- x += l;
+ auto convertSegment = [=](int yStart, int yEnd) {
+ QRgba64 buf[BufferSize];
+ QRgba64 *buffer = buf;
+ const uchar *srcData = src->data + yStart * src->bytes_per_line;
+ uchar *destData = dest->data + yStart * dest->bytes_per_line;
+ for (int y = yStart; y < yEnd; ++y) {
+ int x = 0;
+ while (x < src->width) {
+ int l = src->width - x;
+ if (destLayout->bpp == QPixelLayout::BPP64)
+ buffer = reinterpret_cast<QRgba64 *>(destData) + x;
+ else
+ l = qMin(l, BufferSize);
+ const QRgba64 *ptr = fetch(buffer, srcData, x, l, nullptr, nullptr);
+ store(destData, ptr, x, l, nullptr, nullptr);
+ x += l;
+ }
+ srcData += src->bytes_per_line;
+ destData += dest->bytes_per_line;
}
- srcData += src->bytes_per_line;
- destData += dest->bytes_per_line;
- }
+ };
+#ifdef QT_USE_THREAD_PARALLEL_IMAGE_CONVERSIONS
+ int segments = (qsizetype(src->width) * src->height) >> 16;
+ segments = std::min(segments, src->height);
+
+ QThreadPool *threadPool = QThreadPoolPrivate::qtGuiInstance();
+ if (segments <= 1 || !threadPool || threadPool->contains(QThread::currentThread()))
+ return convertSegment(0, src->height);
+
+ QSemaphore semaphore;
+ int y = 0;
+ for (int i = 0; i < segments; ++i) {
+ int yn = (src->height - y) / (segments - i);
+ threadPool->start([&, y, yn]() {
+ convertSegment(y, y + yn);
+ semaphore.release(1);
+ });
+ y += yn;
+ }
+ semaphore.acquire(segments);
+#else
+ convertSegment(0, src->height);
+#endif
+}
+
+#if QT_CONFIG(raster_fp)
+void convert_generic_over_rgba32f(QImageData *dest, const QImageData *src, Qt::ImageConversionFlags)
+{
+ Q_ASSERT(dest->format >= QImage::Format_RGBX16FPx4);
+ Q_ASSERT(src->format >= QImage::Format_RGBX16FPx4);
+
+ const FetchAndConvertPixelsFuncFP fetch = qFetchToRGBA32F[src->format];
+ const ConvertAndStorePixelsFuncFP store = qStoreFromRGBA32F[dest->format];
+
+ auto convertSegment = [=](int yStart, int yEnd) {
+ QRgbaFloat32 buf[BufferSize];
+ QRgbaFloat32 *buffer = buf;
+ const uchar *srcData = src->data + yStart * src->bytes_per_line;
+ uchar *destData = dest->data + yStart * dest->bytes_per_line;
+ for (int y = yStart; y < yEnd; ++y) {
+ int x = 0;
+ while (x < src->width) {
+ int l = src->width - x;
+ if (dest->depth == 128)
+ buffer = reinterpret_cast<QRgbaFloat32 *>(destData) + x;
+ else
+ l = qMin(l, BufferSize);
+ const QRgbaFloat32 *ptr = fetch(buffer, srcData, x, l, nullptr, nullptr);
+ store(destData, ptr, x, l, nullptr, nullptr);
+ x += l;
+ }
+ srcData += src->bytes_per_line;
+ destData += dest->bytes_per_line;
+ }
+ };
+#ifdef QT_USE_THREAD_PARALLEL_IMAGE_CONVERSIONS
+ int segments = (qsizetype(src->width) * src->height) >> 16;
+ segments = std::min(segments, src->height);
+
+ QThreadPool *threadPool = QThreadPoolPrivate::qtGuiInstance();
+ if (segments <= 1 || !threadPool || threadPool->contains(QThread::currentThread()))
+ return convertSegment(0, src->height);
+
+ QSemaphore semaphore;
+ int y = 0;
+ for (int i = 0; i < segments; ++i) {
+ int yn = (src->height - y) / (segments - i);
+ threadPool->start([&, y, yn]() {
+ convertSegment(y, y + yn);
+ semaphore.release(1);
+ });
+ y += yn;
+ }
+ semaphore.acquire(segments);
+#else
+ convertSegment(0, src->height);
+#endif
}
+#endif
bool convert_generic_inplace(QImageData *data, QImage::Format dst_format, Qt::ImageConversionFlags flags)
{
@@ -265,15 +348,9 @@ bool convert_generic_inplace(QImageData *data, QImage::Format dst_format, Qt::Im
const QPixelLayout *destLayout = &qPixelLayouts[dst_format];
// The precision here is only ARGB32PM so don't convert between higher accuracy
- // formats (assert instead when we have a convert_generic_over_rgb64_inplace).
- if (qt_highColorPrecision(data->format, !destLayout->hasAlphaChannel)
- && qt_highColorPrecision(dst_format, !srcLayout->hasAlphaChannel))
- return false;
-
- uint buf[BufferSize];
- uint *buffer = buf;
- uchar *srcData = data->data;
- uchar *destData = data->data;
+ // formats.
+ Q_ASSERT(!qt_highColorPrecision(data->format, !destLayout->hasAlphaChannel)
+ || !qt_highColorPrecision(dst_format, !srcLayout->hasAlphaChannel));
QImageData::ImageSizeParameters params = { data->bytes_per_line, data->nbytes };
if (data->depth != destDepth) {
@@ -282,7 +359,7 @@ bool convert_generic_inplace(QImageData *data, QImage::Format dst_format, Qt::Im
return false;
}
- Q_ASSERT(destLayout->bpp != QPixelLayout::BPP64);
+ Q_ASSERT(destLayout->bpp < QPixelLayout::BPP64);
FetchAndConvertPixelsFunc fetch = srcLayout->fetchToARGB32PM;
ConvertAndStorePixelsFunc store = destLayout->storeFromARGB32PM;
if (!srcLayout->hasAlphaChannel && destLayout->storeFromRGB32) {
@@ -297,7 +374,7 @@ bool convert_generic_inplace(QImageData *data, QImage::Format dst_format, Qt::Im
store = storeRGB32FromARGB32PM_sse4;
else
store = storeRGB32FromARGB32PM;
-#elif defined(__ARM_NEON__)
+#elif defined(__ARM_NEON__) && (Q_BYTE_ORDER == Q_LITTLE_ENDIAN)
store = storeRGB32FromARGB32PM_neon;
#else
store = storeRGB32FromARGB32PM;
@@ -307,34 +384,164 @@ bool convert_generic_inplace(QImageData *data, QImage::Format dst_format, Qt::Im
if (srcLayout->hasAlphaChannel && !srcLayout->premultiplied &&
!destLayout->hasAlphaChannel && destLayout->storeFromRGB32) {
// Avoid unnecessary premultiply and unpremultiply when converting from unpremultiplied src format.
- fetch = qPixelLayouts[data->format + 1].fetchToARGB32PM;
+ fetch = qPixelLayouts[qt_toPremultipliedFormat(data->format)].fetchToARGB32PM;
if (data->format == QImage::Format_RGB32)
store = storeRGB32FromARGB32;
else
store = destLayout->storeFromRGB32;
}
- QDitherInfo dither;
- QDitherInfo *ditherPtr = nullptr;
- if ((flags & Qt::PreferDither) && (flags & Qt::Dither_Mask) != Qt::ThresholdDither)
- ditherPtr = &dither;
-
- for (int y = 0; y < data->height; ++y) {
- dither.y = y;
- int x = 0;
- while (x < data->width) {
- dither.x = x;
- int l = data->width - x;
- if (srcLayout->bpp == QPixelLayout::BPP32)
- buffer = reinterpret_cast<uint *>(srcData) + x;
- else
- l = qMin(l, BufferSize);
- const uint *ptr = fetch(buffer, srcData, x, l, nullptr, ditherPtr);
- store(destData, ptr, x, l, nullptr, ditherPtr);
- x += l;
+
+ auto convertSegment = [=](int yStart, int yEnd) {
+ uint buf[BufferSize];
+ uint *buffer = buf;
+ uchar *srcData = data->data + data->bytes_per_line * yStart;
+ uchar *destData = srcData; // This can be temporarily wrong if we doing a shrinking conversion
+ QDitherInfo dither;
+ QDitherInfo *ditherPtr = nullptr;
+ if ((flags & Qt::PreferDither) && (flags & Qt::Dither_Mask) != Qt::ThresholdDither)
+ ditherPtr = &dither;
+ for (int y = yStart; y < yEnd; ++y) {
+ dither.y = y;
+ int x = 0;
+ while (x < data->width) {
+ dither.x = x;
+ int l = data->width - x;
+ if (srcLayout->bpp == QPixelLayout::BPP32)
+ buffer = reinterpret_cast<uint *>(srcData) + x;
+ else
+ l = qMin(l, BufferSize);
+ const uint *ptr = fetch(buffer, srcData, x, l, nullptr, ditherPtr);
+ store(destData, ptr, x, l, nullptr, ditherPtr);
+ x += l;
+ }
+ srcData += data->bytes_per_line;
+ destData += params.bytesPerLine;
+ }
+ };
+#ifdef QT_USE_THREAD_PARALLEL_IMAGE_CONVERSIONS
+ int segments = (qsizetype(data->width) * data->height) >> 16;
+ segments = std::min(segments, data->height);
+ QThreadPool *threadPool = QThreadPoolPrivate::qtGuiInstance();
+ if (segments > 1 && threadPool && !threadPool->contains(QThread::currentThread())) {
+ QSemaphore semaphore;
+ int y = 0;
+ for (int i = 0; i < segments; ++i) {
+ int yn = (data->height - y) / (segments - i);
+ threadPool->start([&, y, yn]() {
+ convertSegment(y, y + yn);
+ semaphore.release(1);
+ });
+ y += yn;
+ }
+ semaphore.acquire(segments);
+ if (data->bytes_per_line != params.bytesPerLine) {
+ // Compress segments to a continuous block
+ y = 0;
+ for (int i = 0; i < segments; ++i) {
+ int yn = (data->height - y) / (segments - i);
+ uchar *srcData = data->data + data->bytes_per_line * y;
+ uchar *destData = data->data + params.bytesPerLine * y;
+ if (srcData != destData)
+ memmove(destData, srcData, params.bytesPerLine * yn);
+ y += yn;
+ }
+ }
+ } else
+#endif
+ convertSegment(0, data->height);
+ if (params.totalSize != data->nbytes) {
+ Q_ASSERT(params.totalSize < data->nbytes);
+ void *newData = realloc(data->data, params.totalSize);
+ if (newData) {
+ data->data = (uchar *)newData;
+ data->nbytes = params.totalSize;
}
- srcData += data->bytes_per_line;
- destData += params.bytesPerLine;
+ data->bytes_per_line = params.bytesPerLine;
+ }
+ data->depth = destDepth;
+ data->format = dst_format;
+ return true;
+}
+
+bool convert_generic_inplace_over_rgb64(QImageData *data, QImage::Format dst_format, Qt::ImageConversionFlags)
+{
+ Q_ASSERT(data->format > QImage::Format_Indexed8);
+ Q_ASSERT(dst_format > QImage::Format_Indexed8);
+ const int destDepth = qt_depthForFormat(dst_format);
+ if (data->depth < destDepth)
+ return false;
+
+ const QPixelLayout *srcLayout = &qPixelLayouts[data->format];
+ const QPixelLayout *destLayout = &qPixelLayouts[dst_format];
+
+ QImageData::ImageSizeParameters params = { data->bytes_per_line, data->nbytes };
+ if (data->depth != destDepth) {
+ params = QImageData::calculateImageParameters(data->width, data->height, destDepth);
+ if (!params.isValid())
+ return false;
}
+
+ FetchAndConvertPixelsFunc64 fetch = srcLayout->fetchToRGBA64PM;
+ ConvertAndStorePixelsFunc64 store = qStoreFromRGBA64PM[dst_format];
+ if (srcLayout->hasAlphaChannel && !srcLayout->premultiplied &&
+ destLayout->hasAlphaChannel && !destLayout->premultiplied) {
+ // Avoid unnecessary premultiply and unpremultiply when converting between two unpremultiplied formats.
+ fetch = qPixelLayouts[qt_toPremultipliedFormat(data->format)].fetchToRGBA64PM;
+ store = qStoreFromRGBA64PM[qt_toPremultipliedFormat(dst_format)];
+ }
+
+ auto convertSegment = [=](int yStart, int yEnd) {
+ QRgba64 buf[BufferSize];
+ QRgba64 *buffer = buf;
+ uchar *srcData = data->data + yStart * data->bytes_per_line;
+ uchar *destData = srcData;
+ for (int y = yStart; y < yEnd; ++y) {
+ int x = 0;
+ while (x < data->width) {
+ int l = data->width - x;
+ if (srcLayout->bpp == QPixelLayout::BPP64)
+ buffer = reinterpret_cast<QRgba64 *>(srcData) + x;
+ else
+ l = qMin(l, BufferSize);
+ const QRgba64 *ptr = fetch(buffer, srcData, x, l, nullptr, nullptr);
+ store(destData, ptr, x, l, nullptr, nullptr);
+ x += l;
+ }
+ srcData += data->bytes_per_line;
+ destData += params.bytesPerLine;
+ }
+ };
+#ifdef QT_USE_THREAD_PARALLEL_IMAGE_CONVERSIONS
+ int segments = (qsizetype(data->width) * data->height) >> 16;
+ segments = std::min(segments, data->height);
+ QThreadPool *threadPool = QThreadPoolPrivate::qtGuiInstance();
+ if (segments > 1 && threadPool && !threadPool->contains(QThread::currentThread())) {
+ QSemaphore semaphore;
+ int y = 0;
+ for (int i = 0; i < segments; ++i) {
+ int yn = (data->height - y) / (segments - i);
+ threadPool->start([&, y, yn]() {
+ convertSegment(y, y + yn);
+ semaphore.release(1);
+ });
+ y += yn;
+ }
+ semaphore.acquire(segments);
+ if (data->bytes_per_line != params.bytesPerLine) {
+ // Compress segments to a continuous block
+ y = 0;
+ for (int i = 0; i < segments; ++i) {
+ int yn = (data->height - y) / (segments - i);
+ uchar *srcData = data->data + data->bytes_per_line * y;
+ uchar *destData = data->data + params.bytesPerLine * y;
+ if (srcData != destData)
+ memmove(destData, srcData, params.bytesPerLine * yn);
+ y += yn;
+ }
+ }
+ } else
+#endif
+ convertSegment(0, data->height);
if (params.totalSize != data->nbytes) {
Q_ASSERT(params.totalSize < data->nbytes);
void *newData = realloc(data->data, params.totalSize);
@@ -343,12 +550,107 @@ bool convert_generic_inplace(QImageData *data, QImage::Format dst_format, Qt::Im
data->nbytes = params.totalSize;
}
data->bytes_per_line = params.bytesPerLine;
- data->depth = destDepth;
}
+ data->depth = destDepth;
data->format = dst_format;
return true;
}
+#if QT_CONFIG(raster_fp)
+bool convert_generic_inplace_over_rgba32f(QImageData *data, QImage::Format dst_format, Qt::ImageConversionFlags)
+{
+ Q_ASSERT(data->format >= QImage::Format_RGBX16FPx4);
+ Q_ASSERT(dst_format >= QImage::Format_RGBX16FPx4);
+ const int destDepth = qt_depthForFormat(dst_format);
+ if (data->depth < destDepth)
+ return false;
+
+ const QPixelLayout *srcLayout = &qPixelLayouts[data->format];
+ const QPixelLayout *destLayout = &qPixelLayouts[dst_format];
+
+ QImageData::ImageSizeParameters params = { data->bytes_per_line, data->nbytes };
+ if (data->depth != destDepth) {
+ params = QImageData::calculateImageParameters(data->width, data->height, destDepth);
+ if (!params.isValid())
+ return false;
+ }
+
+ FetchAndConvertPixelsFuncFP fetch = qFetchToRGBA32F[data->format];
+ ConvertAndStorePixelsFuncFP store = qStoreFromRGBA32F[dst_format];
+ if (srcLayout->hasAlphaChannel && !srcLayout->premultiplied &&
+ destLayout->hasAlphaChannel && !destLayout->premultiplied) {
+ // Avoid unnecessary premultiply and unpremultiply when converting between two unpremultiplied formats.
+ fetch = qFetchToRGBA32F[qt_toPremultipliedFormat(data->format)];
+ store = qStoreFromRGBA32F[qt_toPremultipliedFormat(dst_format)];
+ }
+
+ auto convertSegment = [=](int yStart, int yEnd) {
+ QRgbaFloat32 buf[BufferSize];
+ QRgbaFloat32 *buffer = buf;
+ uchar *srcData = data->data + yStart * data->bytes_per_line;
+ uchar *destData = srcData;
+ for (int y = yStart; y < yEnd; ++y) {
+ int x = 0;
+ while (x < data->width) {
+ int l = data->width - x;
+ if (srcLayout->bpp == QPixelLayout::BPP32FPx4)
+ buffer = reinterpret_cast<QRgbaFloat32 *>(srcData) + x;
+ else
+ l = qMin(l, BufferSize);
+ const QRgbaFloat32 *ptr = fetch(buffer, srcData, x, l, nullptr, nullptr);
+ store(destData, ptr, x, l, nullptr, nullptr);
+ x += l;
+ }
+ srcData += data->bytes_per_line;
+ destData += params.bytesPerLine;
+ }
+ };
+#ifdef QT_USE_THREAD_PARALLEL_IMAGE_CONVERSIONS
+ int segments = (qsizetype(data->width) * data->height) >> 16;
+ segments = std::min(segments, data->height);
+ QThreadPool *threadPool = QThreadPoolPrivate::qtGuiInstance();
+ if (segments > 1 && threadPool && !threadPool->contains(QThread::currentThread())) {
+ QSemaphore semaphore;
+ int y = 0;
+ for (int i = 0; i < segments; ++i) {
+ int yn = (data->height - y) / (segments - i);
+ threadPool->start([&, y, yn]() {
+ convertSegment(y, y + yn);
+ semaphore.release(1);
+ });
+ y += yn;
+ }
+ semaphore.acquire(segments);
+ if (data->bytes_per_line != params.bytesPerLine) {
+ // Compress segments to a continuous block
+ y = 0;
+ for (int i = 0; i < segments; ++i) {
+ int yn = (data->height - y) / (segments - i);
+ uchar *srcData = data->data + data->bytes_per_line * y;
+ uchar *destData = data->data + params.bytesPerLine * y;
+ if (srcData != destData)
+ memmove(destData, srcData, params.bytesPerLine * yn);
+ y += yn;
+ }
+ }
+ } else
+#endif
+ convertSegment(0, data->height);
+ if (params.totalSize != data->nbytes) {
+ Q_ASSERT(params.totalSize < data->nbytes);
+ void *newData = realloc(data->data, params.totalSize);
+ if (newData) {
+ data->data = (uchar *)newData;
+ data->nbytes = params.totalSize;
+ }
+ data->bytes_per_line = params.bytesPerLine;
+ }
+ data->depth = destDepth;
+ data->format = dst_format;
+ return true;
+}
+#endif
+
static void convert_passthrough(QImageData *dest, const QImageData *src, Qt::ImageConversionFlags)
{
Q_ASSERT(src->width == dest->width);
@@ -530,7 +832,7 @@ static bool convert_ARGB_to_RGBA_inplace(QImageData *data, Qt::ImageConversionFl
const int pad = (data->bytes_per_line >> 2) - data->width;
quint32 *rgb_data = (quint32 *) data->data;
- Q_CONSTEXPR uint mask = (DestFormat == QImage::Format_RGBX8888) ? 0xff000000 : 0;
+ constexpr uint mask = (DestFormat == QImage::Format_RGBX8888) ? 0xff000000 : 0;
for (int i = 0; i < data->height; ++i) {
const quint32 *end = rgb_data + data->width;
@@ -576,7 +878,7 @@ static bool convert_RGBA_to_ARGB_inplace(QImageData *data, Qt::ImageConversionFl
const int pad = (data->bytes_per_line >> 2) - data->width;
QRgb *rgb_data = (QRgb *) data->data;
- Q_CONSTEXPR uint mask = (DestFormat == QImage::Format_RGB32) ? 0xff000000 : 0;
+ constexpr uint mask = (DestFormat == QImage::Format_RGB32) ? 0xff000000 : 0;
for (int i = 0; i < data->height; ++i) {
const QRgb *end = rgb_data + data->width;
@@ -731,8 +1033,7 @@ static inline uint qUnpremultiplyRgb30(uint rgb30)
case 3:
return rgb30;
}
- Q_UNREACHABLE();
- return 0;
+ Q_UNREACHABLE_RETURN(0);
}
template<bool rgbswap>
@@ -1021,11 +1322,11 @@ static void convert_ARGB32_to_RGBA64(QImageData *dest, const QImageData *src, Qt
const uchar *src_data = src->data;
uchar *dest_data = dest->data;
- const FetchAndConvertPixelsFunc64 fetch = qPixelLayouts[src->format + 1].fetchToRGBA64PM;
+ const FetchAndConvertPixelsFunc64 fetch = qPixelLayouts[qt_toPremultipliedFormat(src->format)].fetchToRGBA64PM;
for (int i = 0; i < src->height; ++i) {
fetch(reinterpret_cast<QRgba64 *>(dest_data), src_data, 0, src->width, nullptr, nullptr);
- src_data += src->bytes_per_line;;
+ src_data += src->bytes_per_line;
dest_data += dest->bytes_per_line;
}
}
@@ -1074,103 +1375,107 @@ static bool convert_RGBA64_to_RGBx64_inplace(QImageData *data, Qt::ImageConversi
return true;
}
-static void convert_RGBA64_to_RGBA64PM(QImageData *dest, const QImageData *src, Qt::ImageConversionFlags)
+static void convert_gray16_to_RGBA64(QImageData *dest, const QImageData *src, Qt::ImageConversionFlags)
{
- Q_ASSERT(src->format == QImage::Format_RGBA64);
- Q_ASSERT(dest->format == QImage::Format_RGBA64_Premultiplied);
+ Q_ASSERT(src->format == QImage::Format_Grayscale16);
+ Q_ASSERT(dest->format == QImage::Format_RGBA64 || dest->format == QImage::Format_RGBX64 ||
+ dest->format == QImage::Format_RGBA64_Premultiplied);
Q_ASSERT(src->width == dest->width);
Q_ASSERT(src->height == dest->height);
- const int src_pad = (src->bytes_per_line >> 3) - src->width;
- const int dest_pad = (dest->bytes_per_line >> 3) - dest->width;
- const QRgba64 *src_data = reinterpret_cast<const QRgba64 *>(src->data);
- QRgba64 *dest_data = reinterpret_cast<QRgba64 *>(dest->data);
+ const qsizetype sbpl = src->bytes_per_line;
+ const qsizetype dbpl = dest->bytes_per_line;
+ const uchar *src_data = src->data;
+ uchar *dest_data = dest->data;
for (int i = 0; i < src->height; ++i) {
- const QRgba64 *end = src_data + src->width;
- while (src_data < end) {
- *dest_data = src_data->premultiplied();
- ++src_data;
- ++dest_data;
- }
- src_data += src_pad;
- dest_data += dest_pad;
- }
-}
-
-static bool convert_RGBA64_to_RGBA64PM_inplace(QImageData *data, Qt::ImageConversionFlags)
-{
- Q_ASSERT(data->format == QImage::Format_RGBA64);
-
- const int pad = (data->bytes_per_line >> 3) - data->width;
- QRgba64 *rgb_data = reinterpret_cast<QRgba64 *>(data->data);
-
- for (int i = 0; i < data->height; ++i) {
- const QRgba64 *end = rgb_data + data->width;
- while (rgb_data < end) {
- *rgb_data = rgb_data->premultiplied();
- ++rgb_data;
+ const quint16 *src_line = reinterpret_cast<const quint16 *>(src_data);
+ QRgba64 *dest_line = reinterpret_cast<QRgba64 *>(dest_data);
+ for (int j = 0; j < src->width; ++j) {
+ quint16 s = src_line[j];
+ dest_line[j] = qRgba64(s, s, s, 0xFFFF);
}
- rgb_data += pad;
+ src_data += sbpl;
+ dest_data += dbpl;
}
- data->format = QImage::Format_RGBA64_Premultiplied;
- return true;
}
-template<bool MaskAlpha>
-static void convert_RGBA64PM_to_RGBA64(QImageData *dest, const QImageData *src, Qt::ImageConversionFlags)
+template<bool Premultiplied>
+static void convert_ARGB_to_gray8(QImageData *dest, const QImageData *src, Qt::ImageConversionFlags)
{
- Q_ASSERT(src->format == QImage::Format_RGBA64_Premultiplied);
- Q_ASSERT(dest->format == QImage::Format_RGBA64 || dest->format == QImage::Format_RGBX64);
+ Q_ASSERT(dest->format == QImage::Format_Grayscale8);
+ Q_ASSERT(src->format == QImage::Format_RGB32 ||
+ src->format == QImage::Format_ARGB32 ||
+ src->format == QImage::Format_ARGB32_Premultiplied);
Q_ASSERT(src->width == dest->width);
Q_ASSERT(src->height == dest->height);
- const int src_pad = (src->bytes_per_line >> 3) - src->width;
- const int dest_pad = (dest->bytes_per_line >> 3) - dest->width;
- const QRgba64 *src_data = reinterpret_cast<const QRgba64 *>(src->data);
- QRgba64 *dest_data = reinterpret_cast<QRgba64 *>(dest->data);
+ const qsizetype sbpl = src->bytes_per_line;
+ const qsizetype dbpl = dest->bytes_per_line;
+ const uchar *src_data = src->data;
+ uchar *dest_data = dest->data;
+
+ QColorSpace fromCS = src->colorSpace.isValid() ? src->colorSpace : QColorSpace::SRgb;
+ QColorTransform tf = QColorSpacePrivate::get(fromCS)->transformationToXYZ();
+ const QColorTransformPrivate *tfd = QColorTransformPrivate::get(tf);
+ QColorTransformPrivate::TransformFlags flags = Premultiplied
+ ? QColorTransformPrivate::InputPremultiplied
+ : QColorTransformPrivate::Unpremultiplied;
for (int i = 0; i < src->height; ++i) {
- const QRgba64 *end = src_data + src->width;
- while (src_data < end) {
- *dest_data = src_data->unpremultiplied();
- if (MaskAlpha)
- dest_data->setAlpha(65535);
- ++src_data;
- ++dest_data;
- }
- src_data += src_pad;
- dest_data += dest_pad;
+ const QRgb *src_line = reinterpret_cast<const QRgb *>(src_data);
+ tfd->applyReturnGray(dest_data, src_line, src->width, flags);
+ src_data += sbpl;
+ dest_data += dbpl;
}
}
-template<bool MaskAlpha>
-static bool convert_RGBA64PM_to_RGBA64_inplace(QImageData *data, Qt::ImageConversionFlags)
+template<bool Premultiplied>
+static void convert_ARGB_to_gray16(QImageData *dest, const QImageData *src, Qt::ImageConversionFlags)
{
- Q_ASSERT(data->format == QImage::Format_RGBA64_Premultiplied);
+ Q_ASSERT(dest->format == QImage::Format_Grayscale16);
+ Q_ASSERT(src->format == QImage::Format_RGB32 ||
+ src->format == QImage::Format_ARGB32 ||
+ src->format == QImage::Format_ARGB32_Premultiplied);
+ Q_ASSERT(src->width == dest->width);
+ Q_ASSERT(src->height == dest->height);
- const int pad = (data->bytes_per_line >> 3) - data->width;
- QRgba64 *rgb_data = reinterpret_cast<QRgba64 *>(data->data);
+ const qsizetype sbpl = src->bytes_per_line;
+ const qsizetype dbpl = dest->bytes_per_line;
+ const uchar *src_data = src->data;
+ uchar *dest_data = dest->data;
- for (int i = 0; i < data->height; ++i) {
- const QRgba64 *end = rgb_data + data->width;
- while (rgb_data < end) {
- *rgb_data = rgb_data->unpremultiplied();
- if (MaskAlpha)
- rgb_data->setAlpha(65535);
- ++rgb_data;
+ QColorSpace fromCS = src->colorSpace.isValid() ? src->colorSpace : QColorSpace::SRgb;
+ QColorTransform tf = QColorSpacePrivate::get(fromCS)->transformationToXYZ();
+ const QColorTransformPrivate *tfd = QColorTransformPrivate::get(tf);
+ QColorTransformPrivate::TransformFlags flags = Premultiplied
+ ? QColorTransformPrivate::InputPremultiplied
+ : QColorTransformPrivate::Unpremultiplied;
+
+ QRgba64 tmp_line[BufferSize];
+ for (int i = 0; i < src->height; ++i) {
+ const QRgb *src_line = reinterpret_cast<const QRgb *>(src_data);
+ quint16 *dest_line = reinterpret_cast<quint16 *>(dest_data);
+ int j = 0;
+ while (j < src->width) {
+ const int len = std::min(src->width - j, BufferSize);
+ for (int k = 0; k < len; ++k)
+ tmp_line[k] = QRgba64::fromArgb32(src_line[j + k]);
+ tfd->applyReturnGray(dest_line + j, tmp_line, len, flags);
+ j += len;
}
- rgb_data += pad;
+ src_data += sbpl;
+ dest_data += dbpl;
}
- data->format = MaskAlpha ? QImage::Format_RGBX64 : QImage::Format_RGBA64;
- return true;
}
-static void convert_gray16_to_RGBA64(QImageData *dest, const QImageData *src, Qt::ImageConversionFlags)
+template<bool Premultiplied>
+static void convert_RGBA64_to_gray8(QImageData *dest, const QImageData *src, Qt::ImageConversionFlags)
{
- Q_ASSERT(src->format == QImage::Format_Grayscale16);
- Q_ASSERT(dest->format == QImage::Format_RGBA64 || dest->format == QImage::Format_RGBX64 ||
- dest->format == QImage::Format_RGBA64_Premultiplied);
+ Q_ASSERT(dest->format == QImage::Format_Grayscale8);
+ Q_ASSERT(src->format == QImage::Format_RGBX64 ||
+ src->format == QImage::Format_RGBA64 ||
+ src->format == QImage::Format_RGBA64_Premultiplied);
Q_ASSERT(src->width == dest->width);
Q_ASSERT(src->height == dest->height);
@@ -1179,22 +1484,36 @@ static void convert_gray16_to_RGBA64(QImageData *dest, const QImageData *src, Qt
const uchar *src_data = src->data;
uchar *dest_data = dest->data;
+ QColorSpace fromCS = src->colorSpace.isValid() ? src->colorSpace : QColorSpace::SRgb;
+ QColorTransform tf = QColorSpacePrivate::get(fromCS)->transformationToXYZ();
+ const QColorTransformPrivate *tfd = QColorTransformPrivate::get(tf);
+ QColorTransformPrivate::TransformFlags flags = Premultiplied
+ ? QColorTransformPrivate::InputPremultiplied
+ : QColorTransformPrivate::Unpremultiplied;
+
+ quint16 gray_line[BufferSize];
for (int i = 0; i < src->height; ++i) {
- const quint16 *src_line = reinterpret_cast<const quint16 *>(src_data);
- QRgba64 *dest_line = reinterpret_cast<QRgba64 *>(dest_data);
- for (int j = 0; j < src->width; ++j) {
- quint16 s = src_line[j];
- dest_line[j] = qRgba64(s, s, s, 0xFFFF);
+ const QRgba64 *src_line = reinterpret_cast<const QRgba64 *>(src_data);
+ uchar *dest_line = dest_data;
+ int j = 0;
+ while (j < src->width) {
+ const int len = std::min(src->width - j, BufferSize);
+ tfd->applyReturnGray(gray_line, src_line + j, len, flags);
+ for (int k = 0; k < len; ++k)
+ dest_line[j + k] = qt_div_257(gray_line[k]);
+ j += len;
}
src_data += sbpl;
dest_data += dbpl;
}
}
+template<bool Premultiplied>
static void convert_RGBA64_to_gray16(QImageData *dest, const QImageData *src, Qt::ImageConversionFlags)
{
Q_ASSERT(dest->format == QImage::Format_Grayscale16);
Q_ASSERT(src->format == QImage::Format_RGBX64 ||
+ src->format == QImage::Format_RGBA64 ||
src->format == QImage::Format_RGBA64_Premultiplied);
Q_ASSERT(src->width == dest->width);
Q_ASSERT(src->height == dest->height);
@@ -1204,21 +1523,74 @@ static void convert_RGBA64_to_gray16(QImageData *dest, const QImageData *src, Qt
const uchar *src_data = src->data;
uchar *dest_data = dest->data;
+ QColorSpace fromCS = src->colorSpace.isValid() ? src->colorSpace : QColorSpace::SRgb;
+ QColorTransform tf = QColorSpacePrivate::get(fromCS)->transformationToXYZ();
+ const QColorTransformPrivate *tfd = QColorTransformPrivate::get(tf);
+ QColorTransformPrivate::TransformFlags flags = Premultiplied
+ ? QColorTransformPrivate::InputPremultiplied
+ : QColorTransformPrivate::Unpremultiplied;
+
for (int i = 0; i < src->height; ++i) {
const QRgba64 *src_line = reinterpret_cast<const QRgba64 *>(src_data);
quint16 *dest_line = reinterpret_cast<quint16 *>(dest_data);
- for (int j = 0; j < src->width; ++j) {
- QRgba64 s = src_line[j].unpremultiplied();
- dest_line[j] = qGray(s.red(), s.green(), s.blue());
- }
+ tfd->applyReturnGray(dest_line, src_line, src->width, flags);
src_data += sbpl;
dest_data += dbpl;
}
}
-static QVector<QRgb> fix_color_table(const QVector<QRgb> &ctbl, QImage::Format format)
+template<bool MaskAlpha>
+static void convert_RGBA16FPM_to_RGBA16F(QImageData *dest, const QImageData *src, Qt::ImageConversionFlags)
+{
+ Q_ASSERT(src->format == QImage::Format_RGBA16FPx4_Premultiplied);
+ Q_ASSERT(dest->format == QImage::Format_RGBA16FPx4 || dest->format == QImage::Format_RGBX16FPx4);
+ Q_ASSERT(src->width == dest->width);
+ Q_ASSERT(src->height == dest->height);
+
+ const int src_pad = (src->bytes_per_line >> 3) - src->width;
+ const int dest_pad = (dest->bytes_per_line >> 3) - dest->width;
+ const QRgbaFloat16 *src_data = reinterpret_cast<const QRgbaFloat16 *>(src->data);
+ QRgbaFloat16 *dest_data = reinterpret_cast<QRgbaFloat16 *>(dest->data);
+
+ for (int i = 0; i < src->height; ++i) {
+ const QRgbaFloat16 *end = src_data + src->width;
+ while (src_data < end) {
+ *dest_data = src_data->unpremultiplied();
+ if (MaskAlpha)
+ dest_data->setAlpha(1.0f);
+ ++src_data;
+ ++dest_data;
+ }
+ src_data += src_pad;
+ dest_data += dest_pad;
+ }
+}
+
+template<bool MaskAlpha>
+static bool convert_RGBA16FPM_to_RGBA16F_inplace(QImageData *data, Qt::ImageConversionFlags)
+{
+ Q_ASSERT(data->format == QImage::Format_RGBA16FPx4_Premultiplied);
+
+ const int pad = (data->bytes_per_line >> 3) - data->width;
+ QRgbaFloat16 *rgb_data = reinterpret_cast<QRgbaFloat16 *>(data->data);
+
+ for (int i = 0; i < data->height; ++i) {
+ const QRgbaFloat16 *end = rgb_data + data->width;
+ while (rgb_data < end) {
+ *rgb_data = rgb_data->unpremultiplied();
+ if (MaskAlpha)
+ rgb_data->setAlpha(1.0f);
+ ++rgb_data;
+ }
+ rgb_data += pad;
+ }
+ data->format = MaskAlpha ? QImage::Format_RGBX16FPx4 : QImage::Format_RGBA16FPx4;
+ return true;
+}
+
+static QList<QRgb> fix_color_table(const QList<QRgb> &ctbl, QImage::Format format)
{
- QVector<QRgb> colorTable = ctbl;
+ QList<QRgb> colorTable = ctbl;
if (format == QImage::Format_RGB32) {
// check if the color table has alpha
for (int i = 0; i < colorTable.size(); ++i)
@@ -1552,7 +1924,7 @@ static void convert_RGB_to_Indexed8(QImageData *dst, const QImageData *src, Qt::
int pix=0;
if (!dst->colortable.isEmpty()) {
- QVector<QRgb> ctbl = dst->colortable;
+ QList<QRgb> ctbl = dst->colortable;
dst->colortable.resize(256);
// Preload palette into table.
// Almost same code as pixel insertion below
@@ -1815,7 +2187,7 @@ static void convert_Indexed8_to_X32(QImageData *dest, const QImageData *src, Qt:
Q_ASSERT(src->width == dest->width);
Q_ASSERT(src->height == dest->height);
- QVector<QRgb> colorTable = src->has_alpha_clut ? fix_color_table(src->colortable, dest->format) : src->colortable;
+ QList<QRgb> colorTable = src->has_alpha_clut ? fix_color_table(src->colortable, dest->format) : src->colortable;
if (colorTable.size() == 0) {
colorTable.resize(256);
for (int i=0; i<256; ++i)
@@ -1855,7 +2227,7 @@ static void convert_Mono_to_X32(QImageData *dest, const QImageData *src, Qt::Ima
Q_ASSERT(src->width == dest->width);
Q_ASSERT(src->height == dest->height);
- QVector<QRgb> colorTable = fix_color_table(src->colortable, dest->format);
+ QList<QRgb> colorTable = fix_color_table(src->colortable, dest->format);
// Default to black / white colors
if (colorTable.size() < 2) {
@@ -1895,7 +2267,7 @@ static void convert_Mono_to_Indexed8(QImageData *dest, const QImageData *src, Qt
Q_ASSERT(src->width == dest->width);
Q_ASSERT(src->height == dest->height);
- QVector<QRgb> ctbl = src->colortable;
+ QList<QRgb> ctbl = src->colortable;
if (ctbl.size() > 2) {
ctbl.resize(2);
} else if (ctbl.size() < 2) {
@@ -1928,13 +2300,28 @@ static void convert_Mono_to_Indexed8(QImageData *dest, const QImageData *src, Qt
}
}
+static void copy_8bit_pixels(QImageData *dest, const QImageData *src)
+{
+ if (src->bytes_per_line == dest->bytes_per_line) {
+ memcpy(dest->data, src->data, src->bytes_per_line * src->height);
+ } else {
+ const uchar *sdata = src->data;
+ uchar *ddata = dest->data;
+ for (int y = 0; y < src->height; ++y) {
+ memcpy(ddata, sdata, src->width);
+ sdata += src->bytes_per_line;
+ ddata += dest->bytes_per_line;
+ }
+ }
+}
+
static void convert_Indexed8_to_Alpha8(QImageData *dest, const QImageData *src, Qt::ImageConversionFlags)
{
Q_ASSERT(src->format == QImage::Format_Indexed8);
Q_ASSERT(dest->format == QImage::Format_Alpha8);
uchar translate[256];
- const QVector<QRgb> &colors = src->colortable;
+ const QList<QRgb> &colors = src->colortable;
bool simpleCase = (colors.size() == 256);
for (int i = 0; i < colors.size(); ++i) {
uchar alpha = qAlpha(colors[i]);
@@ -1943,11 +2330,15 @@ static void convert_Indexed8_to_Alpha8(QImageData *dest, const QImageData *src,
}
if (simpleCase)
- memcpy(dest->data, src->data, src->bytes_per_line * src->height);
+ copy_8bit_pixels(dest, src);
else {
- qsizetype size = src->bytes_per_line * src->height;
- for (qsizetype i = 0; i < size; ++i) {
- dest->data[i] = translate[src->data[i]];
+ const uchar *sdata = src->data;
+ uchar *ddata = dest->data;
+ for (int y = 0; y < src->height; ++y) {
+ for (int x = 0; x < src->width; ++x)
+ ddata[x] = translate[sdata[x]];
+ sdata += src->bytes_per_line;
+ ddata += dest->bytes_per_line;
}
}
}
@@ -1958,21 +2349,31 @@ static void convert_Indexed8_to_Grayscale8(QImageData *dest, const QImageData *s
Q_ASSERT(dest->format == QImage::Format_Grayscale8);
uchar translate[256];
- const QVector<QRgb> &colors = src->colortable;
+ const QList<QRgb> &colors = src->colortable;
bool simpleCase = (colors.size() == 256);
+ for (int i = 0; i < colors.size() && simpleCase; ++i) {
+ if (colors[i] != qRgb(i, i, i))
+ simpleCase = false;
+ }
+ if (simpleCase) {
+ copy_8bit_pixels(dest, src);
+ return;
+ }
+
+ QColorSpace fromCS = src->colorSpace.isValid() ? src->colorSpace : QColorSpace::SRgb;
+ QColorTransform tf = QColorSpacePrivate::get(fromCS)->transformationToXYZ();
for (int i = 0; i < colors.size(); ++i) {
- uchar gray = qGray(colors[i]);
- translate[i] = gray;
- simpleCase = simpleCase && (gray == i);
+ QRgba64 c16 = tf.map(QRgba64::fromArgb32(colors[i]));
+ translate[i] = c16.green8(); // Y from XYZ ends up in the G channel
}
- if (simpleCase)
- memcpy(dest->data, src->data, src->bytes_per_line * src->height);
- else {
- qsizetype size = src->bytes_per_line * src->height;
- for (qsizetype i = 0; i < size; ++i) {
- dest->data[i] = translate[src->data[i]];
- }
+ const uchar *sdata = src->data;
+ uchar *ddata = dest->data;
+ for (int y = 0; y < src->height; ++y) {
+ for (int x = 0; x < src->width; ++x)
+ ddata[x] = translate[sdata[x]];
+ sdata += src->bytes_per_line;
+ ddata += dest->bytes_per_line;
}
}
@@ -1981,7 +2382,7 @@ static bool convert_Indexed8_to_Alpha8_inplace(QImageData *data, Qt::ImageConver
Q_ASSERT(data->format == QImage::Format_Indexed8);
// Just check if this is an Alpha8 in Indexed8 disguise.
- const QVector<QRgb> &colors = data->colortable;
+ const QList<QRgb> &colors = data->colortable;
if (colors.size() != 256)
return false;
for (int i = 0; i < colors.size(); ++i) {
@@ -2000,11 +2401,11 @@ static bool convert_Indexed8_to_Grayscale8_inplace(QImageData *data, Qt::ImageCo
Q_ASSERT(data->format == QImage::Format_Indexed8);
// Just check if this is a Grayscale8 in Indexed8 disguise.
- const QVector<QRgb> &colors = data->colortable;
+ const QList<QRgb> &colors = data->colortable;
if (colors.size() != 256)
return false;
for (int i = 0; i < colors.size(); ++i) {
- if (i != qGray(colors[i]))
+ if (colors[i] != qRgb(i, i, i))
return false;
}
@@ -2019,7 +2420,7 @@ static void convert_Alpha8_to_Indexed8(QImageData *dest, const QImageData *src,
Q_ASSERT(src->format == QImage::Format_Alpha8);
Q_ASSERT(dest->format == QImage::Format_Indexed8);
- memcpy(dest->data, src->data, src->bytes_per_line * src->height);
+ copy_8bit_pixels(dest, src);
dest->colortable = defaultColorTables->alpha;
}
@@ -2029,8 +2430,7 @@ static void convert_Grayscale8_to_Indexed8(QImageData *dest, const QImageData *s
Q_ASSERT(src->format == QImage::Format_Grayscale8);
Q_ASSERT(dest->format == QImage::Format_Indexed8);
- memcpy(dest->data, src->data, src->bytes_per_line * src->height);
-
+ copy_8bit_pixels(dest, src);
dest->colortable = defaultColorTables->gray;
}
@@ -2055,1117 +2455,291 @@ static bool convert_Grayscale8_to_Indexed8_inplace(QImageData *data, Qt::ImageCo
return true;
}
-
-// first index source, second dest
-Image_Converter qimage_converter_map[QImage::NImageFormats][QImage::NImageFormats] =
+template <bool SourceIsPremultiplied>
+static void convert_ARGB32_to_CMYK8888(QImageData *dest, const QImageData *src, Qt::ImageConversionFlags)
{
- {
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
- },
- {
- 0,
- 0,
- swap_bit_order,
- convert_Mono_to_Indexed8,
- convert_Mono_to_X32,
- convert_Mono_to_X32,
- convert_Mono_to_X32,
- 0,
- 0,
- 0,
- 0,
- 0,
- 0,
- 0,
- 0,
- 0,
- 0,
- 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
- }, // Format_Mono
-
- {
- 0,
- swap_bit_order,
- 0,
- convert_Mono_to_Indexed8,
- convert_Mono_to_X32,
- convert_Mono_to_X32,
- convert_Mono_to_X32,
- 0,
- 0,
- 0,
- 0,
- 0,
- 0,
- 0,
- 0,
- 0,
- 0,
- 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
- }, // Format_MonoLSB
-
- {
- 0,
- convert_X_to_Mono,
- convert_X_to_Mono,
- 0,
- convert_Indexed8_to_X32,
- convert_Indexed8_to_X32,
- convert_Indexed8_to_X32,
- 0,
- 0,
- 0,
- 0,
- 0,
- 0,
- 0,
- 0,
- 0,
- 0,
- 0,
- 0, 0, 0, 0, 0,
- convert_Indexed8_to_Alpha8,
- convert_Indexed8_to_Grayscale8,
- 0, 0, 0, 0, 0
- }, // Format_Indexed8
-
- {
- 0,
- convert_X_to_Mono,
- convert_X_to_Mono,
- convert_RGB_to_Indexed8,
- 0,
- mask_alpha_converter,
- mask_alpha_converter,
- 0,
- 0,
- 0,
- 0,
- 0,
- 0,
- 0,
- 0,
- 0,
- 0,
- 0,
- 0,
- 0,
- 0,
- 0,
- 0,
- 0, 0,
- 0, 0, 0, 0, 0
- }, // Format_RGB32
-
- {
- 0,
- convert_X_to_Mono,
- convert_X_to_Mono,
- convert_ARGB_to_Indexed8,
- mask_alpha_converter,
- 0,
- 0,
- 0,
- 0,
- 0,
- 0,
- 0,
- 0,
- 0,
- 0,
- 0,
- convert_ARGB_to_RGBx,
- convert_ARGB_to_RGBA,
- 0,
- 0,
- convert_ARGB_to_A2RGB30<PixelOrderBGR, false>,
- 0,
- convert_ARGB_to_A2RGB30<PixelOrderRGB, false>,
- 0, 0,
- 0,
- convert_ARGB32_to_RGBA64<false>,
- 0, 0, 0
- }, // Format_ARGB32
-
- {
- 0,
- convert_ARGB_PM_to_Mono,
- convert_ARGB_PM_to_Mono,
- convert_ARGB_PM_to_Indexed8,
- 0,
- 0,
- 0,
- 0,
- 0,
- 0,
- 0,
- 0,
- 0,
- 0,
- 0,
- 0,
- 0,
- 0,
- convert_ARGB_to_RGBA,
- 0, 0, 0, 0,
- 0, 0,
- 0, 0, 0, 0, 0
- }, // Format_ARGB32_Premultiplied
-
- {
- 0,
- 0,
- 0,
- 0,
- 0,
- 0,
- 0,
- 0,
- 0,
- 0,
- 0,
- 0,
- 0,
- 0,
- 0,
- 0,
- 0,
- 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
- }, // Format_RGB16
-
- {
- 0,
- 0,
- 0,
- 0,
- 0,
- 0,
- 0,
- 0,
- 0,
- 0,
- 0,
- 0,
- 0,
- 0,
- 0,
- 0,
- 0,
- 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
- }, // Format_ARGB8565_Premultiplied
-
- {
- 0,
- 0,
- 0,
- 0,
- 0,
- 0,
- 0,
- 0,
- 0,
- 0,
- 0,
- 0,
- 0,
- 0,
- 0,
- 0,
- 0,
- 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
- }, // Format_RGB666
-
- {
- 0,
- 0,
- 0,
- 0,
- 0,
- 0,
- 0,
- 0,
- 0,
- 0,
- 0,
- 0,
- 0,
- 0,
- 0,
- 0,
- 0,
- 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
- }, // Format_ARGB6666_Premultiplied
-
- {
- 0,
- 0,
- 0,
- 0,
- 0,
- 0,
- 0,
- 0,
- 0,
- 0,
- 0,
- 0,
- 0,
- 0,
- 0,
- 0,
- 0,
- 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
- }, // Format_RGB555
+ Q_ASSERT(src->format == QImage::Format_RGB32 ||
+ src->format == QImage::Format_ARGB32 ||
+ src->format == QImage::Format_ARGB32_Premultiplied);
+ Q_ASSERT(dest->format == QImage::Format_CMYK8888);
+ Q_ASSERT(src->width == dest->width);
+ Q_ASSERT(src->height == dest->height);
- {
- 0,
- 0,
- 0,
- 0,
- 0,
- 0,
- 0,
- 0,
- 0,
- 0,
- 0,
- 0,
- 0,
- 0,
- 0,
- 0,
- 0,
- 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
- }, // Format_ARGB8555_Premultiplied
+ const uchar *src_data = src->data;
+ uchar *dest_data = dest->data;
+ for (int y = 0; y < src->height; ++y) {
+ const QRgb *srcRgba = reinterpret_cast<const QRgb *>(src_data);
+ uint *destCmyk = reinterpret_cast<uint *>(dest_data);
- {
- 0,
- 0,
- 0,
- 0,
- convert_RGB888_to_RGB<false>,
- convert_RGB888_to_RGB<false>,
- convert_RGB888_to_RGB<false>,
- 0,
- 0,
- 0,
- 0,
- 0,
- 0,
- 0, // self
- 0,
- 0,
- convert_RGB888_to_RGB<true>,
- convert_RGB888_to_RGB<true>,
- convert_RGB888_to_RGB<true>,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- convert_rgbswap_generic,
- }, // Format_RGB888
+ for (int x = 0; x < src->width; ++x) {
+ QRgb sourcePixel = srcRgba[x];
+ if constexpr (SourceIsPremultiplied)
+ sourcePixel = qUnpremultiply(sourcePixel);
- {
- 0,
- 0,
- 0,
- 0,
- 0,
- 0,
- 0,
- 0,
- 0,
- 0,
- 0,
- 0,
- 0,
- 0,
- 0,
- 0,
- 0,
- 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
- }, // Format_RGB444
+ destCmyk[x] = QCmyk32::fromRgba(sourcePixel).toUint();
+ }
- {
- 0,
- 0,
- 0,
- 0,
- 0,
- 0,
- 0,
- 0,
- 0,
- 0,
- 0,
- 0,
- 0,
- 0,
- 0,
- 0,
- 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
- }, // Format_ARGB4444_Premultiplied
- {
- 0,
- 0,
- 0,
- 0,
- convert_RGBA_to_RGB,
- convert_RGBA_to_ARGB,
- convert_RGBA_to_ARGB,
- 0,
- 0,
- 0,
- 0,
- 0,
- 0,
- 0,
- 0,
- 0,
- 0,
- convert_passthrough,
- convert_passthrough,
- 0,
- 0,
- 0,
- 0,
- 0, 0,
- 0, 0, 0, 0, 0
- }, // Format_RGBX8888
- {
- 0,
- 0,
- 0,
- 0,
- convert_RGBA_to_RGB,
- convert_RGBA_to_ARGB,
- 0,
- 0,
- 0,
- 0,
- 0,
- 0,
- 0,
- 0,
- 0,
- 0,
- mask_alpha_converter_RGBx,
- 0,
- 0,
- 0,
- convert_ARGB_to_A2RGB30<PixelOrderBGR, true>,
- 0,
- convert_ARGB_to_A2RGB30<PixelOrderRGB, true>,
- 0, 0,
- 0,
- convert_ARGB32_to_RGBA64<true>,
- 0, 0, 0
- }, // Format_RGBA8888
+ src_data += src->bytes_per_line;;
+ dest_data += dest->bytes_per_line;
+ }
+}
- {
- 0,
- 0,
- 0,
- 0,
- 0,
- 0,
- convert_RGBA_to_ARGB,
- 0,
- 0,
- 0,
- 0,
- 0,
- 0,
- 0,
- 0,
- 0,
- 0,
- 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
- }, // Format_RGBA8888_Premultiplied
+// first index source, second dest
+Image_Converter qimage_converter_map[QImage::NImageFormats][QImage::NImageFormats] = {};
+InPlace_Image_Converter qimage_inplace_converter_map[QImage::NImageFormats][QImage::NImageFormats] = {};
- {
- 0,
- 0,
- 0,
- 0,
- 0,
- 0,
- 0,
- 0,
- 0,
- 0,
- 0,
- 0,
- 0,
- 0,
- 0,
- 0,
- 0,
- 0,
- 0,
- 0,
- convert_passthrough,
- convert_rgbswap_generic,
- convert_rgbswap_generic,
- 0, 0,
- 0, 0, 0, 0, 0
- }, // Format_BGR30
- {
- 0,
- 0,
- 0,
- 0,
- 0,
- convert_A2RGB30_PM_to_ARGB<PixelOrderBGR, false>,
- 0,
- 0,
- 0,
- 0,
- 0,
- 0,
- 0,
- 0,
- 0,
- 0,
- 0,
- convert_A2RGB30_PM_to_ARGB<PixelOrderBGR, true>,
- 0,
- convert_A2RGB30_PM_to_RGB30<false>,
- 0,
- convert_A2RGB30_PM_to_RGB30<true>,
- convert_rgbswap_generic,
- 0, 0,
- 0, 0, 0, 0, 0
- }, // Format_A2BGR30_Premultiplied
- {
- 0,
- 0,
- 0,
- 0,
- 0,
- 0,
- 0,
- 0,
- 0,
- 0,
- 0,
- 0,
- 0,
- 0,
- 0,
- 0,
- 0,
- 0,
- 0,
- convert_rgbswap_generic,
- convert_rgbswap_generic,
- 0,
- convert_passthrough,
- 0, 0, 0, 0, 0, 0, 0
- }, // Format_RGB30
- {
- 0,
- 0,
- 0,
- 0,
- 0,
- convert_A2RGB30_PM_to_ARGB<PixelOrderRGB, false>,
- 0,
- 0,
- 0,
- 0,
- 0,
- 0,
- 0,
- 0,
- 0,
- 0,
- 0,
- convert_A2RGB30_PM_to_ARGB<PixelOrderRGB, true>,
- 0,
- convert_A2RGB30_PM_to_RGB30<true>,
- convert_rgbswap_generic,
- convert_A2RGB30_PM_to_RGB30<false>,
- 0,
- 0, 0,
- 0, 0, 0, 0, 0
- }, // Format_A2RGB30_Premultiplied
- {
- 0,
- 0,
- 0,
- convert_Alpha8_to_Indexed8,
- 0,
- 0,
- 0,
- 0,
- 0,
- 0,
- 0,
- 0,
- 0,
- 0,
- 0,
- 0,
- 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
- }, // Format_Alpha8
- {
- 0,
- 0,
- 0,
- convert_Grayscale8_to_Indexed8,
- 0,
- 0,
- 0,
- 0,
- 0,
- 0,
- 0,
- 0,
- 0,
- 0,
- 0,
- 0,
- 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
- }, // Format_Grayscale8
- {
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, // self
- convert_passthrough,
- convert_passthrough,
- convert_RGBA64_to_gray16,
- 0
- }, // Format_RGBX64
- {
- 0,
- 0,
- 0,
- 0,
- 0,
- convert_RGBA64_to_ARGB32<false>,
- 0,
- 0,
- 0,
- 0,
- 0,
- 0,
- 0,
- 0,
- 0,
- 0,
- 0,
- convert_RGBA64_to_ARGB32<true>,
- 0,
- 0, 0, 0, 0,
- 0, 0,
- convert_RGBA64_to_RGBx64,
- 0, // self
- convert_RGBA64_to_RGBA64PM,
- 0,
- 0
- }, // Format_RGBA64
- {
- 0,
- 0,
- 0,
- 0,
- 0,
- 0,
- 0,
- 0,
- 0,
- 0,
- 0,
- 0,
- 0,
- 0,
- 0,
- 0,
- 0,
- 0,
- 0,
- 0, 0, 0, 0,
- 0, 0,
- convert_RGBA64PM_to_RGBA64<true>,
- convert_RGBA64PM_to_RGBA64<false>,
- 0, // self
- convert_RGBA64_to_gray16,
- 0
- }, // Format_RGBA64_Premultiplied
- {
- 0,
- 0,
- 0,
- 0,
- 0,
- 0,
- 0,
- 0,
- 0,
- 0,
- 0,
- 0,
- 0,
- 0,
- 0,
- 0,
- 0,
- 0,
- 0,
- 0,
- 0,
- 0,
- 0,
- 0, 0,
- convert_gray16_to_RGBA64,
- convert_gray16_to_RGBA64,
- convert_gray16_to_RGBA64,
- 0, // self
- 0
- }, // Format_Grayscale16
- {
- 0,
- 0,
- 0,
- 0,
- 0, 0, 0,
- 0,
- 0,
- 0,
- 0,
- 0,
- 0,
- convert_rgbswap_generic,
- 0,
- 0,
+static void qInitImageConversions()
+{
+ // Some conversions can not be generic, other are just hard to make as fast in the generic converter.
+
+ // All conversions to and from indexed formats can not be generic and needs to go over RGB32 or ARGB32
+ qimage_converter_map[QImage::Format_Mono][QImage::Format_MonoLSB] = swap_bit_order;
+ qimage_converter_map[QImage::Format_Mono][QImage::Format_Indexed8] = convert_Mono_to_Indexed8;
+ qimage_converter_map[QImage::Format_Mono][QImage::Format_RGB32] = convert_Mono_to_X32;
+ qimage_converter_map[QImage::Format_Mono][QImage::Format_ARGB32] = convert_Mono_to_X32;
+ qimage_converter_map[QImage::Format_Mono][QImage::Format_ARGB32_Premultiplied] = convert_Mono_to_X32;
+
+ qimage_converter_map[QImage::Format_MonoLSB][QImage::Format_Mono] = swap_bit_order;
+ qimage_converter_map[QImage::Format_MonoLSB][QImage::Format_Indexed8] = convert_Mono_to_Indexed8;
+ qimage_converter_map[QImage::Format_MonoLSB][QImage::Format_RGB32] = convert_Mono_to_X32;
+ qimage_converter_map[QImage::Format_MonoLSB][QImage::Format_ARGB32] = convert_Mono_to_X32;
+ qimage_converter_map[QImage::Format_MonoLSB][QImage::Format_ARGB32_Premultiplied] = convert_Mono_to_X32;
+
+ qimage_converter_map[QImage::Format_Indexed8][QImage::Format_Mono] = convert_X_to_Mono;
+ qimage_converter_map[QImage::Format_Indexed8][QImage::Format_MonoLSB] = convert_X_to_Mono;
+ qimage_converter_map[QImage::Format_Indexed8][QImage::Format_RGB32] = convert_Indexed8_to_X32;
+ qimage_converter_map[QImage::Format_Indexed8][QImage::Format_ARGB32] = convert_Indexed8_to_X32;
+ qimage_converter_map[QImage::Format_Indexed8][QImage::Format_ARGB32_Premultiplied] = convert_Indexed8_to_X32;
+ // Indexed8, Alpha8 and Grayscale8 have a special relationship that can be short-cut.
+ qimage_converter_map[QImage::Format_Indexed8][QImage::Format_Grayscale8] = convert_Indexed8_to_Grayscale8;
+ qimage_converter_map[QImage::Format_Indexed8][QImage::Format_Alpha8] = convert_Indexed8_to_Alpha8;
+
+ qimage_converter_map[QImage::Format_RGB32][QImage::Format_Mono] = convert_X_to_Mono;
+ qimage_converter_map[QImage::Format_RGB32][QImage::Format_MonoLSB] = convert_X_to_Mono;
+ qimage_converter_map[QImage::Format_RGB32][QImage::Format_Indexed8] = convert_RGB_to_Indexed8;
+ qimage_converter_map[QImage::Format_RGB32][QImage::Format_ARGB32] = mask_alpha_converter;
+ qimage_converter_map[QImage::Format_RGB32][QImage::Format_ARGB32_Premultiplied] = mask_alpha_converter;
+ qimage_converter_map[QImage::Format_RGB32][QImage::Format_Grayscale8] = convert_ARGB_to_gray8<false>;
+ qimage_converter_map[QImage::Format_RGB32][QImage::Format_Grayscale16] = convert_ARGB_to_gray16<false>;
+
+ qimage_converter_map[QImage::Format_ARGB32][QImage::Format_Mono] = convert_X_to_Mono;
+ qimage_converter_map[QImage::Format_ARGB32][QImage::Format_MonoLSB] = convert_X_to_Mono;
+ qimage_converter_map[QImage::Format_ARGB32][QImage::Format_Indexed8] = convert_ARGB_to_Indexed8;
+ qimage_converter_map[QImage::Format_ARGB32][QImage::Format_RGB32] = mask_alpha_converter;
+ qimage_converter_map[QImage::Format_ARGB32][QImage::Format_RGBX8888] = convert_ARGB_to_RGBx;
+ qimage_converter_map[QImage::Format_ARGB32][QImage::Format_RGBA8888] = convert_ARGB_to_RGBA;
+ // ARGB32 has higher precision than ARGB32PM and needs explicit conversions to other higher color-precision formats with alpha
+ qimage_converter_map[QImage::Format_ARGB32][QImage::Format_A2BGR30_Premultiplied] = convert_ARGB_to_A2RGB30<PixelOrderBGR, false>;
+ qimage_converter_map[QImage::Format_ARGB32][QImage::Format_A2RGB30_Premultiplied] = convert_ARGB_to_A2RGB30<PixelOrderRGB, false>;
+ qimage_converter_map[QImage::Format_ARGB32][QImage::Format_RGBA64] = convert_ARGB32_to_RGBA64<false>;
+ qimage_converter_map[QImage::Format_ARGB32][QImage::Format_Grayscale8] = convert_ARGB_to_gray8<false>;
+ qimage_converter_map[QImage::Format_ARGB32][QImage::Format_Grayscale16] = convert_ARGB_to_gray16<false>;
+
+ qimage_converter_map[QImage::Format_ARGB32_Premultiplied][QImage::Format_Mono] = convert_ARGB_PM_to_Mono;
+ qimage_converter_map[QImage::Format_ARGB32_Premultiplied][QImage::Format_MonoLSB] = convert_ARGB_PM_to_Mono;
+ qimage_converter_map[QImage::Format_ARGB32_Premultiplied][QImage::Format_Indexed8] = convert_ARGB_PM_to_Indexed8;
+ qimage_converter_map[QImage::Format_ARGB32_Premultiplied][QImage::Format_RGBA8888_Premultiplied] = convert_ARGB_to_RGBA;
+ qimage_converter_map[QImage::Format_ARGB32_Premultiplied][QImage::Format_Grayscale8] = convert_ARGB_to_gray8<true>;
+ qimage_converter_map[QImage::Format_ARGB32_Premultiplied][QImage::Format_Grayscale16] = convert_ARGB_to_gray16<true>;
+
+ qimage_converter_map[QImage::Format_RGB888][QImage::Format_RGB32] = convert_RGB888_to_RGB<false>;
+ qimage_converter_map[QImage::Format_RGB888][QImage::Format_ARGB32] = convert_RGB888_to_RGB<false>;
+ qimage_converter_map[QImage::Format_RGB888][QImage::Format_ARGB32_Premultiplied] = convert_RGB888_to_RGB<false>;
+ qimage_converter_map[QImage::Format_RGB888][QImage::Format_RGBX8888] = convert_RGB888_to_RGB<true>;
+ qimage_converter_map[QImage::Format_RGB888][QImage::Format_RGBA8888] = convert_RGB888_to_RGB<true>;
+ qimage_converter_map[QImage::Format_RGB888][QImage::Format_RGBA8888_Premultiplied] = convert_RGB888_to_RGB<true>;
+ qimage_converter_map[QImage::Format_RGB888][QImage::Format_BGR888] = convert_rgbswap_generic;
+
+ qimage_converter_map[QImage::Format_RGBX8888][QImage::Format_RGB32] = convert_RGBA_to_RGB;
+ qimage_converter_map[QImage::Format_RGBX8888][QImage::Format_ARGB32] = convert_RGBA_to_ARGB;
+ qimage_converter_map[QImage::Format_RGBX8888][QImage::Format_ARGB32_Premultiplied] = convert_RGBA_to_ARGB;
+ qimage_converter_map[QImage::Format_RGBX8888][QImage::Format_RGBA8888] = convert_passthrough;
+ qimage_converter_map[QImage::Format_RGBX8888][QImage::Format_RGBA8888_Premultiplied] = convert_passthrough;
+
+ qimage_converter_map[QImage::Format_RGBA8888][QImage::Format_RGB32] = convert_RGBA_to_RGB;
+ qimage_converter_map[QImage::Format_RGBA8888][QImage::Format_ARGB32] = convert_RGBA_to_ARGB;
+ qimage_converter_map[QImage::Format_RGBA8888][QImage::Format_RGBX8888] = mask_alpha_converter_RGBx;
+ qimage_converter_map[QImage::Format_RGBA8888][QImage::Format_A2BGR30_Premultiplied] = convert_ARGB_to_A2RGB30<PixelOrderBGR, true>;
+ qimage_converter_map[QImage::Format_RGBA8888][QImage::Format_A2RGB30_Premultiplied] = convert_ARGB_to_A2RGB30<PixelOrderRGB, true>;
+ qimage_converter_map[QImage::Format_RGBA8888][QImage::Format_RGBA64] = convert_ARGB32_to_RGBA64<true>;
+
+ qimage_converter_map[QImage::Format_RGBA8888_Premultiplied][QImage::Format_ARGB32_Premultiplied] = convert_RGBA_to_ARGB;
+
+ qimage_converter_map[QImage::Format_BGR30][QImage::Format_A2BGR30_Premultiplied] = convert_passthrough;
+ qimage_converter_map[QImage::Format_BGR30][QImage::Format_RGB30] = convert_rgbswap_generic;
+ qimage_converter_map[QImage::Format_BGR30][QImage::Format_A2RGB30_Premultiplied] = convert_rgbswap_generic;
+
+ qimage_converter_map[QImage::Format_A2BGR30_Premultiplied][QImage::Format_ARGB32] = convert_A2RGB30_PM_to_ARGB<PixelOrderBGR, false>;
+ qimage_converter_map[QImage::Format_A2BGR30_Premultiplied][QImage::Format_RGBA8888] = convert_A2RGB30_PM_to_ARGB<PixelOrderBGR, true>;
+ qimage_converter_map[QImage::Format_A2BGR30_Premultiplied][QImage::Format_BGR30] = convert_A2RGB30_PM_to_RGB30<false>;
+ qimage_converter_map[QImage::Format_A2BGR30_Premultiplied][QImage::Format_RGB30] = convert_A2RGB30_PM_to_RGB30<true>;
+ qimage_converter_map[QImage::Format_A2BGR30_Premultiplied][QImage::Format_A2RGB30_Premultiplied] = convert_rgbswap_generic;
+
+ qimage_converter_map[QImage::Format_RGB30][QImage::Format_BGR30] = convert_rgbswap_generic;
+ qimage_converter_map[QImage::Format_RGB30][QImage::Format_A2BGR30_Premultiplied] = convert_rgbswap_generic;
+ qimage_converter_map[QImage::Format_RGB30][QImage::Format_A2RGB30_Premultiplied] = convert_passthrough;
+
+ qimage_converter_map[QImage::Format_A2RGB30_Premultiplied][QImage::Format_ARGB32] = convert_A2RGB30_PM_to_ARGB<PixelOrderRGB, false>;
+ qimage_converter_map[QImage::Format_A2RGB30_Premultiplied][QImage::Format_RGBA8888] = convert_A2RGB30_PM_to_ARGB<PixelOrderRGB, true>;
+ qimage_converter_map[QImage::Format_A2RGB30_Premultiplied][QImage::Format_BGR30] = convert_A2RGB30_PM_to_RGB30<true>;
+ qimage_converter_map[QImage::Format_A2RGB30_Premultiplied][QImage::Format_A2BGR30_Premultiplied] = convert_rgbswap_generic;
+ qimage_converter_map[QImage::Format_A2RGB30_Premultiplied][QImage::Format_RGB30] = convert_A2RGB30_PM_to_RGB30<false>;
+
+ qimage_converter_map[QImage::Format_Grayscale8][QImage::Format_Indexed8] = convert_Grayscale8_to_Indexed8;
+ qimage_converter_map[QImage::Format_Alpha8][QImage::Format_Indexed8] = convert_Alpha8_to_Indexed8;
+
+ qimage_converter_map[QImage::Format_RGBX64][QImage::Format_RGBA64] = convert_passthrough;
+ qimage_converter_map[QImage::Format_RGBX64][QImage::Format_RGBA64_Premultiplied] = convert_passthrough;
+ qimage_converter_map[QImage::Format_RGBX64][QImage::Format_Grayscale8] = convert_RGBA64_to_gray8<false>;
+ qimage_converter_map[QImage::Format_RGBX64][QImage::Format_Grayscale16] = convert_RGBA64_to_gray16<false>;
+
+ qimage_converter_map[QImage::Format_RGBA64][QImage::Format_ARGB32] = convert_RGBA64_to_ARGB32<false>;
+ qimage_converter_map[QImage::Format_RGBA64][QImage::Format_RGBA8888] = convert_RGBA64_to_ARGB32<true>;
+ qimage_converter_map[QImage::Format_RGBA64][QImage::Format_RGBX64] = convert_RGBA64_to_RGBx64;
+ qimage_converter_map[QImage::Format_RGBA64][QImage::Format_Grayscale8] = convert_RGBA64_to_gray8<false>;
+ qimage_converter_map[QImage::Format_RGBA64][QImage::Format_Grayscale16] = convert_RGBA64_to_gray16<false>;
+
+ qimage_converter_map[QImage::Format_RGBA64_Premultiplied][QImage::Format_Grayscale8] = convert_RGBA64_to_gray8<true>;
+ qimage_converter_map[QImage::Format_RGBA64_Premultiplied][QImage::Format_Grayscale16] = convert_RGBA64_to_gray16<true>;
+
+ qimage_converter_map[QImage::Format_Grayscale16][QImage::Format_RGBX64] = convert_gray16_to_RGBA64;
+ qimage_converter_map[QImage::Format_Grayscale16][QImage::Format_RGBA64] = convert_gray16_to_RGBA64;
+ qimage_converter_map[QImage::Format_Grayscale16][QImage::Format_RGBA64_Premultiplied] = convert_gray16_to_RGBA64;
+
+ qimage_converter_map[QImage::Format_BGR888][QImage::Format_RGB888] = convert_rgbswap_generic;
#if Q_BYTE_ORDER == Q_LITTLE_ENDIAN
- convert_RGB888_to_RGB<false>,
- convert_RGB888_to_RGB<false>,
- convert_RGB888_to_RGB<false>,
-#else
- 0, 0, 0,
+ qimage_converter_map[QImage::Format_BGR888][QImage::Format_RGBX8888] = convert_RGB888_to_RGB<false>;
+ qimage_converter_map[QImage::Format_BGR888][QImage::Format_RGBA8888] = convert_RGB888_to_RGB<false>;
+ qimage_converter_map[QImage::Format_BGR888][QImage::Format_RGBA8888_Premultiplied] = convert_RGB888_to_RGB<false>;
#endif
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, // self
- }, // Format_BGR888
-};
-InPlace_Image_Converter qimage_inplace_converter_map[QImage::NImageFormats][QImage::NImageFormats] =
-{
- {
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
- },
- {
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
- }, // Format_Mono
- {
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
- }, // Format_MonoLSB
- {
- 0,
- 0,
- 0,
- 0,
- 0,
- 0,
- 0,
- 0,
- 0,
- 0,
- 0,
- 0,
- 0,
- 0,
- 0,
- 0,
- 0,
- 0,
- 0, 0, 0, 0, 0,
- convert_Indexed8_to_Alpha8_inplace,
- convert_Indexed8_to_Grayscale8_inplace,
- 0, 0, 0, 0, 0
- }, // Format_Indexed8
- {
- 0,
- 0,
- 0,
- 0,
- 0,
- mask_alpha_converter_inplace<QImage::Format_ARGB32>,
- mask_alpha_converter_inplace<QImage::Format_ARGB32_Premultiplied>,
- 0,
- 0,
- 0,
- 0,
- 0,
- 0,
- 0,
- 0,
- 0,
- 0,
- 0,
- 0,
- 0,
- 0,
- 0,
- 0,
- 0, 0,
- 0, 0, 0, 0, 0
- }, // Format_RGB32
- {
- 0,
- 0,
- 0,
- 0,
- mask_alpha_converter_inplace<QImage::Format_RGB32>,
- 0,
- 0,
- 0,
- 0,
- 0,
- 0,
- 0,
- 0,
- 0,
- 0,
- 0,
- convert_ARGB_to_RGBA_inplace<QImage::Format_RGBX8888>,
- convert_ARGB_to_RGBA_inplace<QImage::Format_RGBA8888>,
- 0,
- 0,
- convert_ARGB_to_A2RGB30_inplace<PixelOrderBGR, false>,
- 0,
- convert_ARGB_to_A2RGB30_inplace<PixelOrderRGB, false>,
- 0, 0,
- 0, 0, 0, 0, 0
- }, // Format_ARGB32
- {
- 0,
- 0,
- 0,
- 0,
- 0,
- 0,
- 0,
- 0,
- 0,
- 0,
- 0,
- 0,
- 0,
- 0,
- 0,
- 0,
- 0,
- 0,
- convert_ARGB_to_RGBA_inplace<QImage::Format_RGBA8888_Premultiplied>,
- 0, 0, 0, 0,
- 0, 0,
- 0, 0, 0, 0, 0
- }, // Format_ARGB32_Premultiplied
- {
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
- }, // Format_RGB16
- {
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
- }, // Format_ARGB8565_Premultiplied
- {
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
- }, // Format_RGB666
- {
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
- }, // Format_ARGB6666_Premultiplied
- {
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
- }, // Format_RGB555
- {
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
- }, // Format_ARGB8555_Premultiplied
- {
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- convert_rgbswap_generic_inplace
- }, // Format_RGB888
- {
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
- }, // Format_RGB444
- {
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
- }, // Format_ARGB4444_Premultiplied
- {
- 0,
- 0,
- 0,
- 0,
- convert_RGBA_to_ARGB_inplace<QImage::Format_RGB32>,
- convert_RGBA_to_ARGB_inplace<QImage::Format_ARGB32>,
- convert_RGBA_to_ARGB_inplace<QImage::Format_ARGB32_Premultiplied>,
- 0,
- 0,
- 0,
- 0,
- 0,
- 0,
- 0,
- 0,
- 0,
- 0,
- convert_passthrough_inplace<QImage::Format_RGBA8888>,
- convert_passthrough_inplace<QImage::Format_RGBA8888_Premultiplied>,
- 0,
- 0,
- 0,
- 0,
- 0, 0,
- 0, 0, 0, 0, 0
- }, // Format_RGBX8888
- {
- 0,
- 0,
- 0,
- 0,
- convert_RGBA_to_ARGB_inplace<QImage::Format_RGB32>,
- convert_RGBA_to_ARGB_inplace<QImage::Format_ARGB32>,
- 0,
- 0,
- 0,
- 0,
- 0,
- 0,
- 0,
- 0,
- 0,
- 0,
- mask_alpha_converter_rgbx_inplace,
- 0,
- 0,
- 0,
- convert_ARGB_to_A2RGB30_inplace<PixelOrderBGR, true>,
- 0,
- convert_ARGB_to_A2RGB30_inplace<PixelOrderRGB, true>,
- 0, 0,
- 0, 0, 0, 0, 0
- }, // Format_RGBA8888
- {
- 0,
- 0,
- 0,
- 0,
- 0,
- 0,
- convert_RGBA_to_ARGB_inplace<QImage::Format_ARGB32_Premultiplied>,
- 0,
- 0,
- 0,
- 0,
- 0,
- 0,
- 0,
- 0,
- 0,
- 0,
- 0,
- 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
- }, // Format_RGBA8888_Premultiplied
- {
- 0,
- 0,
- 0,
- 0,
- 0,
- 0,
- 0,
- 0,
- 0,
- 0,
- 0,
- 0,
- 0,
- 0,
- 0,
- 0,
- 0,
- 0,
- 0,
- 0, // self
- convert_passthrough_inplace<QImage::Format_A2BGR30_Premultiplied>,
- convert_rgbswap_generic_inplace,
- convert_BGR30_to_A2RGB30_inplace,
- 0, 0,
- 0, 0, 0, 0, 0
- }, // Format_BGR30
- {
- 0,
- 0,
- 0,
- 0,
- 0,
- convert_A2RGB30_PM_to_ARGB_inplace<PixelOrderBGR, false>,
- 0,
- 0,
- 0,
- 0,
- 0,
- 0,
- 0,
- 0,
- 0,
- 0,
- 0,
- convert_A2RGB30_PM_to_ARGB_inplace<PixelOrderBGR, true>,
- 0,
- convert_A2RGB30_PM_to_RGB30_inplace<false>,
- 0, // self
- convert_A2RGB30_PM_to_RGB30_inplace<true>,
- convert_rgbswap_generic_inplace,
- 0, 0, 0, 0, 0, 0, 0
- }, // Format_A2BGR30_Premultiplied
- {
- 0,
- 0,
- 0,
- 0,
- 0,
- 0,
- 0,
- 0,
- 0,
- 0,
- 0,
- 0,
- 0,
- 0,
- 0,
- 0,
- 0,
- 0,
- 0,
- convert_rgbswap_generic_inplace,
- convert_BGR30_to_A2RGB30_inplace,
- 0, // self
- convert_passthrough_inplace<QImage::Format_A2RGB30_Premultiplied>,
- 0, 0, 0, 0, 0, 0, 0
- }, // Format_RGB30
- {
- 0,
- 0,
- 0,
- 0,
- 0,
- convert_A2RGB30_PM_to_ARGB_inplace<PixelOrderRGB, false>,
- 0,
- 0,
- 0,
- 0,
- 0,
- 0,
- 0,
- 0,
- 0,
- 0,
- 0,
- convert_A2RGB30_PM_to_ARGB_inplace<PixelOrderRGB, true>,
- 0,
- convert_A2RGB30_PM_to_RGB30_inplace<true>,
- convert_rgbswap_generic_inplace,
- convert_A2RGB30_PM_to_RGB30_inplace<false>,
- 0, // self
- 0, 0,
- 0, 0, 0, 0, 0
- }, // Format_A2RGB30_Premultiplied
- {
- 0,
- 0,
- 0,
- convert_Alpha8_to_Indexed8_inplace,
- 0,
- 0,
- 0,
- 0,
- 0,
- 0,
- 0,
- 0,
- 0,
- 0,
- 0,
- 0,
- 0,
- 0,
- 0,
- 0, 0, 0, 0,
- 0, // self
- 0,
- 0, 0, 0, 0, 0
- }, // Format_Alpha8
- {
- 0,
- 0,
- 0,
- convert_Grayscale8_to_Indexed8_inplace,
- 0,
- 0,
- 0,
- 0,
- 0,
- 0,
- 0,
- 0,
- 0,
- 0,
- 0,
- 0,
- 0,
- 0,
- 0,
- 0, 0, 0, 0,
- 0,
- 0, // self
- 0, 0, 0, 0, 0
- }, // Format_Grayscale8
- {
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, // self
- convert_passthrough_inplace<QImage::Format_RGBA64>,
- convert_passthrough_inplace<QImage::Format_RGBA64_Premultiplied>,
- 0, 0
- }, // Format_RGBX64
- {
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- convert_RGBA64_to_RGBx64_inplace,
- 0, // self
- convert_RGBA64_to_RGBA64PM_inplace,
- 0, 0
- }, // Format_RGBA64
- {
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- convert_RGBA64PM_to_RGBA64_inplace<true>,
- convert_RGBA64PM_to_RGBA64_inplace<false>,
- 0, // self
- 0, 0
- }, // Format_RGBA64_Premultiplied
- {
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
- }, // Format_Grayscale16
- {
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- convert_rgbswap_generic_inplace,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
- }, // Format_BGR888
-};
-
-static void qInitImageConversions()
-{
+ qimage_converter_map[QImage::Format_RGBX16FPx4][QImage::Format_RGBA16FPx4] = convert_passthrough;
+ qimage_converter_map[QImage::Format_RGBX16FPx4][QImage::Format_RGBA16FPx4_Premultiplied] = convert_passthrough;
+
+ qimage_converter_map[QImage::Format_RGBX32FPx4][QImage::Format_RGBA32FPx4] = convert_passthrough;
+ qimage_converter_map[QImage::Format_RGBX32FPx4][QImage::Format_RGBA32FPx4_Premultiplied] = convert_passthrough;
+
+ qimage_converter_map[QImage::Format_CMYK8888][QImage::Format_CMYK8888] = convert_passthrough;
+ qimage_converter_map[QImage::Format_RGB32][QImage::Format_CMYK8888] = convert_ARGB32_to_CMYK8888<false>;
+ qimage_converter_map[QImage::Format_ARGB32][QImage::Format_CMYK8888] = convert_ARGB32_to_CMYK8888<false>;
+ qimage_converter_map[QImage::Format_ARGB32_Premultiplied][QImage::Format_CMYK8888] = convert_ARGB32_to_CMYK8888<true>;
+
+ // Inline converters:
+ qimage_inplace_converter_map[QImage::Format_Indexed8][QImage::Format_Grayscale8] =
+ convert_Indexed8_to_Grayscale8_inplace;
+ qimage_inplace_converter_map[QImage::Format_Indexed8][QImage::Format_Alpha8] =
+ convert_Indexed8_to_Alpha8_inplace;
+
+ qimage_inplace_converter_map[QImage::Format_RGB32][QImage::Format_ARGB32] =
+ mask_alpha_converter_inplace<QImage::Format_ARGB32>;
+ qimage_inplace_converter_map[QImage::Format_RGB32][QImage::Format_ARGB32_Premultiplied] =
+ mask_alpha_converter_inplace<QImage::Format_ARGB32_Premultiplied>;
+
+ qimage_inplace_converter_map[QImage::Format_ARGB32][QImage::Format_RGB32] =
+ mask_alpha_converter_inplace<QImage::Format_RGB32>;
+ qimage_inplace_converter_map[QImage::Format_ARGB32][QImage::Format_RGBX8888] =
+ convert_ARGB_to_RGBA_inplace<QImage::Format_RGBX8888>;
+ qimage_inplace_converter_map[QImage::Format_ARGB32][QImage::Format_RGBA8888] =
+ convert_ARGB_to_RGBA_inplace<QImage::Format_RGBA8888>;
+ qimage_inplace_converter_map[QImage::Format_ARGB32][QImage::Format_A2BGR30_Premultiplied] =
+ convert_ARGB_to_A2RGB30_inplace<PixelOrderBGR, false>;
+ qimage_inplace_converter_map[QImage::Format_ARGB32][QImage::Format_A2RGB30_Premultiplied] =
+ convert_ARGB_to_A2RGB30_inplace<PixelOrderRGB, false>;
+
+ qimage_inplace_converter_map[QImage::Format_ARGB32_Premultiplied][QImage::Format_RGBA8888_Premultiplied] =
+ convert_ARGB_to_RGBA_inplace<QImage::Format_RGBA8888_Premultiplied>;
+
+ qimage_inplace_converter_map[QImage::Format_RGB888][QImage::Format_BGR888] =
+ convert_rgbswap_generic_inplace;
+
+ qimage_inplace_converter_map[QImage::Format_RGBX8888][QImage::Format_RGB32] =
+ convert_RGBA_to_ARGB_inplace<QImage::Format_RGB32>;
+ qimage_inplace_converter_map[QImage::Format_RGBX8888][QImage::Format_ARGB32] =
+ convert_RGBA_to_ARGB_inplace<QImage::Format_ARGB32>;
+ qimage_inplace_converter_map[QImage::Format_RGBX8888][QImage::Format_ARGB32_Premultiplied] =
+ convert_RGBA_to_ARGB_inplace<QImage::Format_ARGB32_Premultiplied>;
+ qimage_inplace_converter_map[QImage::Format_RGBX8888][QImage::Format_RGBA8888] =
+ convert_passthrough_inplace<QImage::Format_RGBA8888>;
+ qimage_inplace_converter_map[QImage::Format_RGBX8888][QImage::Format_RGBA8888_Premultiplied] =
+ convert_passthrough_inplace<QImage::Format_RGBA8888_Premultiplied>;
+
+ qimage_inplace_converter_map[QImage::Format_RGBA8888][QImage::Format_RGB32] =
+ convert_RGBA_to_ARGB_inplace<QImage::Format_RGB32>;
+ qimage_inplace_converter_map[QImage::Format_RGBA8888][QImage::Format_ARGB32] =
+ convert_RGBA_to_ARGB_inplace<QImage::Format_ARGB32>;
+ qimage_inplace_converter_map[QImage::Format_RGBA8888][QImage::Format_RGBX8888] =
+ mask_alpha_converter_rgbx_inplace;
+ qimage_inplace_converter_map[QImage::Format_RGBA8888][QImage::Format_A2BGR30_Premultiplied] =
+ convert_ARGB_to_A2RGB30_inplace<PixelOrderBGR, true>;
+ qimage_inplace_converter_map[QImage::Format_RGBA8888][QImage::Format_A2RGB30_Premultiplied] =
+ convert_ARGB_to_A2RGB30_inplace<PixelOrderRGB, true>;
+
+ qimage_inplace_converter_map[QImage::Format_RGBA8888_Premultiplied][QImage::Format_ARGB32_Premultiplied] =
+ convert_RGBA_to_ARGB_inplace<QImage::Format_ARGB32_Premultiplied>;
+
+ qimage_inplace_converter_map[QImage::Format_BGR30][QImage::Format_A2BGR30_Premultiplied] =
+ convert_passthrough_inplace<QImage::Format_A2BGR30_Premultiplied>;
+ qimage_inplace_converter_map[QImage::Format_BGR30][QImage::Format_RGB30] =
+ convert_rgbswap_generic_inplace;
+ qimage_inplace_converter_map[QImage::Format_BGR30][QImage::Format_A2RGB30_Premultiplied] =
+ convert_BGR30_to_A2RGB30_inplace;
+
+ qimage_inplace_converter_map[QImage::Format_A2BGR30_Premultiplied][QImage::Format_ARGB32] =
+ convert_A2RGB30_PM_to_ARGB_inplace<PixelOrderBGR, false>;
+ qimage_inplace_converter_map[QImage::Format_A2BGR30_Premultiplied][QImage::Format_RGBA8888] =
+ convert_A2RGB30_PM_to_ARGB_inplace<PixelOrderBGR, true>;
+ qimage_inplace_converter_map[QImage::Format_A2BGR30_Premultiplied][QImage::Format_BGR30] =
+ convert_A2RGB30_PM_to_RGB30_inplace<false>;
+ qimage_inplace_converter_map[QImage::Format_A2BGR30_Premultiplied][QImage::Format_RGB30] =
+ convert_A2RGB30_PM_to_RGB30_inplace<true>;
+ qimage_inplace_converter_map[QImage::Format_A2BGR30_Premultiplied][QImage::Format_A2RGB30_Premultiplied] =
+ convert_rgbswap_generic_inplace;
+
+ qimage_inplace_converter_map[QImage::Format_RGB30][QImage::Format_BGR30] =
+ convert_rgbswap_generic_inplace;
+ qimage_inplace_converter_map[QImage::Format_RGB30][QImage::Format_A2BGR30_Premultiplied] =
+ convert_BGR30_to_A2RGB30_inplace;
+ qimage_inplace_converter_map[QImage::Format_RGB30][QImage::Format_A2RGB30_Premultiplied] =
+ convert_passthrough_inplace<QImage::Format_A2RGB30_Premultiplied>;
+
+ qimage_inplace_converter_map[QImage::Format_A2RGB30_Premultiplied][QImage::Format_ARGB32] =
+ convert_A2RGB30_PM_to_ARGB_inplace<PixelOrderRGB, false>;
+ qimage_inplace_converter_map[QImage::Format_A2RGB30_Premultiplied][QImage::Format_RGBA8888] =
+ convert_A2RGB30_PM_to_ARGB_inplace<PixelOrderRGB, true>;
+ qimage_inplace_converter_map[QImage::Format_A2RGB30_Premultiplied][QImage::Format_BGR30] =
+ convert_A2RGB30_PM_to_RGB30_inplace<true>;
+ qimage_inplace_converter_map[QImage::Format_A2RGB30_Premultiplied][QImage::Format_A2BGR30_Premultiplied] =
+ convert_rgbswap_generic_inplace;
+ qimage_inplace_converter_map[QImage::Format_A2RGB30_Premultiplied][QImage::Format_RGB30] =
+ convert_A2RGB30_PM_to_RGB30_inplace<false>;
+
+ qimage_inplace_converter_map[QImage::Format_Grayscale8][QImage::Format_Indexed8] =
+ convert_Grayscale8_to_Indexed8_inplace;
+ qimage_inplace_converter_map[QImage::Format_Alpha8][QImage::Format_Indexed8] =
+ convert_Alpha8_to_Indexed8_inplace;
+
+ qimage_inplace_converter_map[QImage::Format_RGBX64][QImage::Format_RGBA64] =
+ convert_passthrough_inplace<QImage::Format_RGBA64>;
+ qimage_inplace_converter_map[QImage::Format_RGBX64][QImage::Format_RGBA64_Premultiplied] =
+ convert_passthrough_inplace<QImage::Format_RGBA64_Premultiplied>;
+
+ qimage_inplace_converter_map[QImage::Format_RGBA64][QImage::Format_RGBX64] =
+ convert_RGBA64_to_RGBx64_inplace;
+
+ qimage_inplace_converter_map[QImage::Format_BGR888][QImage::Format_RGB888] =
+ convert_rgbswap_generic_inplace;
+
+ qimage_inplace_converter_map[QImage::Format_RGBX16FPx4][QImage::Format_RGBA16FPx4] =
+ convert_passthrough_inplace<QImage::Format_RGBA16FPx4>;
+ qimage_inplace_converter_map[QImage::Format_RGBX16FPx4][QImage::Format_RGBA16FPx4_Premultiplied] =
+ convert_passthrough_inplace<QImage::Format_RGBA16FPx4_Premultiplied>;
+
+ qimage_inplace_converter_map[QImage::Format_RGBX32FPx4][QImage::Format_RGBA32FPx4] =
+ convert_passthrough_inplace<QImage::Format_RGBA32FPx4>;
+ qimage_inplace_converter_map[QImage::Format_RGBX32FPx4][QImage::Format_RGBA32FPx4_Premultiplied] =
+ convert_passthrough_inplace<QImage::Format_RGBA32FPx4_Premultiplied>;
+
+ // Now architecture specific conversions:
#if defined(__SSE2__) && defined(QT_COMPILER_SUPPORTS_SSSE3)
if (qCpuHasFeature(SSSE3)) {
extern void convert_RGB888_to_RGB32_ssse3(QImageData *dest, const QImageData *src, Qt::ImageConversionFlags);
diff --git a/src/gui/image/qimage_darwin.mm b/src/gui/image/qimage_darwin.mm
index 7ca1a0869a..3744da2e32 100644
--- a/src/gui/image/qimage_darwin.mm
+++ b/src/gui/image/qimage_darwin.mm
@@ -1,41 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2017 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the QtGui module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2017 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#include "qimage.h"
@@ -48,8 +12,9 @@
QT_BEGIN_NAMESPACE
/*!
- Creates a \c CGImage equivalent to this QImage. Returns a
- \c CGImageRef handle.
+ \brief Creates a \c CGImage equivalent to this QImage.
+
+ Returns a \c CGImageRef handle.
The returned CGImageRef partakes in the QImage implicit sharing,
and holds a reference to the QImage data. CGImage is immutable
@@ -87,12 +52,12 @@ QT_BEGIN_NAMESPACE
Other formats are not supported; this function returns a null
CGImageRef for those cases. Users of this function may then
- convert the QImage to a supported formate first, for example
+ convert the QImage to a supported format first, for example
Format_ARGB32_Premultiplied.
The CGImageRef color space is set to the sRGB color space.
- \sa QtMac::toNSImage()
+ \ingroup platform-type-conversions
*/
CGImageRef QImage::toCGImage() const
{
diff --git a/src/gui/image/qimage_mips_dspr2.cpp b/src/gui/image/qimage_mips_dspr2.cpp
index 13cca12cfa..5022e21ee8 100644
--- a/src/gui/image/qimage_mips_dspr2.cpp
+++ b/src/gui/image/qimage_mips_dspr2.cpp
@@ -1,41 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2013 Imagination Technologies Limited, www.imgtec.com
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the QtGui module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2013 Imagination Technologies Limited, www.imgtec.com
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#include "qimage.h"
#include <private/qimage_p.h>
diff --git a/src/gui/image/qimage_mips_dspr2_asm.S b/src/gui/image/qimage_mips_dspr2_asm.S
index 15beab29dc..61bccdb3d1 100644
--- a/src/gui/image/qimage_mips_dspr2_asm.S
+++ b/src/gui/image/qimage_mips_dspr2_asm.S
@@ -1,41 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2013 Imagination Technologies Limited, www.imgtec.com
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the QtGui module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2013 Imagination Technologies Limited, www.imgtec.com
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#include "../painting/qt_mips_asm_dsp_p.h"
diff --git a/src/gui/image/qimage_neon.cpp b/src/gui/image/qimage_neon.cpp
index 9dbcb11db5..b513dc2894 100644
--- a/src/gui/image/qimage_neon.cpp
+++ b/src/gui/image/qimage_neon.cpp
@@ -1,41 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the QtGui module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#include <qimage.h>
#include <private/qimage_p.h>
@@ -54,7 +18,7 @@ Q_GUI_EXPORT void QT_FASTCALL qt_convert_rgb888_to_rgb32_neon(quint32 *dst, cons
// align dst on 128 bits
const int offsetToAlignOn16Bytes = (reinterpret_cast<quintptr>(dst) >> 2) & 0x3;
- for (int i = 0; i < offsetToAlignOn16Bytes; ++i) {
+ for (int i = 0; i < qMin(len, offsetToAlignOn16Bytes); ++i) {
*dst++ = qRgb(src[0], src[1], src[2]);
src += 3;
}
diff --git a/src/gui/image/qimage_p.h b/src/gui/image/qimage_p.h
index 9277472c3c..0d42f94253 100644
--- a/src/gui/image/qimage_p.h
+++ b/src/gui/image/qimage_p.h
@@ -1,41 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the QtGui module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2021 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#ifndef QIMAGE_P_H
#define QIMAGE_P_H
@@ -51,13 +15,14 @@
// We mean it.
//
-#include <QtGui/qcolorspace.h>
#include <QtGui/private/qtguiglobal_p.h>
+#include <QtGui/qcolorspace.h>
#include <QtGui/qimage.h>
#include <QtCore/private/qnumeric_p.h>
+#include <QtCore/qlist.h>
+#include <QtCore/qmap.h>
+#include <QtCore/qttypetraits.h>
-#include <QMap>
-#include <QVector>
QT_BEGIN_NAMESPACE
@@ -67,7 +32,10 @@ struct Q_GUI_EXPORT QImageData { // internal image data
QImageData();
~QImageData();
static QImageData *create(const QSize &size, QImage::Format format);
- static QImageData *create(uchar *data, int w, int h, int bpl, QImage::Format format, bool readOnly, QImageCleanupFunction cleanupFunction = nullptr, void *cleanupInfo = nullptr);
+ static QImageData *create(uchar *data, int w, int h, qsizetype bpl, QImage::Format format, bool readOnly, QImageCleanupFunction cleanupFunction = nullptr, void *cleanupInfo = nullptr);
+
+ static QImageData *get(QImage &img) noexcept { return img.d; }
+ static const QImageData *get(const QImage &img) noexcept { return img.d; }
QAtomicInt ref;
@@ -76,7 +44,7 @@ struct Q_GUI_EXPORT QImageData { // internal image data
int depth;
qsizetype nbytes; // number of bytes data
qreal devicePixelRatio;
- QVector<QRgb> colortable;
+ QList<QRgb> colortable;
uchar *data;
QImage::Format format;
qsizetype bytes_per_line;
@@ -91,7 +59,6 @@ struct Q_GUI_EXPORT QImageData { // internal image data
uint ro_data : 1;
uint has_alpha_clut : 1;
uint is_cached : 1;
- uint is_locked : 1;
QImageCleanupFunction cleanupFunction;
void* cleanupInfo;
@@ -127,18 +94,18 @@ QImageData::calculateImageParameters(qsizetype width, qsizetype height, qsizetyp
// calculate the size, taking care of overflows
qsizetype bytes_per_line;
- if (mul_overflow(width, depth, &bytes_per_line))
+ if (qMulOverflow(width, depth, &bytes_per_line))
return invalid;
- if (add_overflow(bytes_per_line, qsizetype(31), &bytes_per_line))
+ if (qAddOverflow(bytes_per_line, qsizetype(31), &bytes_per_line))
return invalid;
// bytes per scanline (must be multiple of 4)
bytes_per_line = (bytes_per_line >> 5) << 2; // can't overflow
qsizetype total_size;
- if (mul_overflow(height, bytes_per_line, &total_size))
+ if (qMulOverflow(height, bytes_per_line, &total_size))
return invalid;
qsizetype dummy;
- if (mul_overflow(height, qsizetype(sizeof(uchar *)), &dummy))
+ if (qMulOverflow(height, qsizetype(sizeof(uchar *)), &dummy))
return invalid; // why is this here?
#if 1 || QT_VERSION < QT_VERSION_CHECK(6,0,0) // ### can only fix this if QImage dimensions are not int anymore
// Disallow images where width * depth calculations might overflow
@@ -156,15 +123,20 @@ extern Image_Converter qimage_converter_map[QImage::NImageFormats][QImage::NImag
extern InPlace_Image_Converter qimage_inplace_converter_map[QImage::NImageFormats][QImage::NImageFormats];
void convert_generic(QImageData *dest, const QImageData *src, Qt::ImageConversionFlags);
-void convert_generic_to_rgb64(QImageData *dest, const QImageData *src, Qt::ImageConversionFlags);
+void convert_generic_over_rgb64(QImageData *dest, const QImageData *src, Qt::ImageConversionFlags);
bool convert_generic_inplace(QImageData *data, QImage::Format dst_format, Qt::ImageConversionFlags);
+bool convert_generic_inplace_over_rgb64(QImageData *data, QImage::Format dst_format, Qt::ImageConversionFlags);
+#if QT_CONFIG(raster_fp)
+void convert_generic_over_rgba32f(QImageData *dest, const QImageData *src, Qt::ImageConversionFlags);
+bool convert_generic_inplace_over_rgba32f(QImageData *data, QImage::Format dst_format, Qt::ImageConversionFlags);
+#endif
void dither_to_Mono(QImageData *dst, const QImageData *src, Qt::ImageConversionFlags flags, bool fromalpha);
const uchar *qt_get_bitflip_array();
Q_GUI_EXPORT void qGamma_correct_back_to_linear_cs(QImage *image);
-#if defined(_M_ARM) // QTBUG-42038
+#if defined(_M_ARM) && defined(_MSC_VER) // QTBUG-42038
#pragma optimize("", off)
#endif
inline int qt_depthForFormat(QImage::Format format)
@@ -213,13 +185,24 @@ inline int qt_depthForFormat(QImage::Format format)
case QImage::Format_RGBX64:
case QImage::Format_RGBA64:
case QImage::Format_RGBA64_Premultiplied:
+ case QImage::Format_RGBX16FPx4:
+ case QImage::Format_RGBA16FPx4:
+ case QImage::Format_RGBA16FPx4_Premultiplied:
depth = 64;
break;
+ case QImage::Format_RGBX32FPx4:
+ case QImage::Format_RGBA32FPx4:
+ case QImage::Format_RGBA32FPx4_Premultiplied:
+ depth = 128;
+ break;
+ case QImage::Format_CMYK8888:
+ depth = 32;
+ break;
}
return depth;
}
-#if defined(_M_ARM)
+#if defined(_M_ARM) && defined(_MSC_VER)
#pragma optimize("", on)
#endif
@@ -244,16 +227,49 @@ inline QImage::Format qt_opaqueVersion(QImage::Format format)
case QImage::Format_RGBA64:
case QImage::Format_RGBA64_Premultiplied:
return QImage::Format_RGBX64;
+ case QImage::Format_RGBA16FPx4:
+ case QImage::Format_RGBA16FPx4_Premultiplied:
+ return QImage::Format_RGBX16FPx4;
+ case QImage::Format_RGBA32FPx4:
+ case QImage::Format_RGBA32FPx4_Premultiplied:
+ return QImage::Format_RGBX32FPx4;
case QImage::Format_ARGB32_Premultiplied:
case QImage::Format_ARGB32:
- default:
return QImage::Format_RGB32;
+ case QImage::Format_RGB16:
+ case QImage::Format_RGB32:
+ case QImage::Format_RGB444:
+ case QImage::Format_RGB555:
+ case QImage::Format_RGB666:
+ case QImage::Format_RGB888:
+ case QImage::Format_BGR888:
+ case QImage::Format_RGBX8888:
+ case QImage::Format_BGR30:
+ case QImage::Format_RGB30:
+ case QImage::Format_RGBX64:
+ case QImage::Format_RGBX16FPx4:
+ case QImage::Format_RGBX32FPx4:
+ case QImage::Format_Grayscale8:
+ case QImage::Format_Grayscale16:
+ case QImage::Format_CMYK8888:
+ return format;
+ case QImage::Format_Mono:
+ case QImage::Format_MonoLSB:
+ case QImage::Format_Indexed8:
+ case QImage::Format_Alpha8:
+ case QImage::Format_Invalid:
+ case QImage::NImageFormats:
+ break;
}
+ return QImage::Format_RGB32;
}
inline QImage::Format qt_alphaVersion(QImage::Format format)
{
switch (format) {
+ case QImage::Format_RGB32:
+ case QImage::Format_ARGB32:
+ return QImage::Format_ARGB32_Premultiplied;
case QImage::Format_RGB16:
return QImage::Format_ARGB8565_Premultiplied;
case QImage::Format_RGB555:
@@ -263,19 +279,120 @@ inline QImage::Format qt_alphaVersion(QImage::Format format)
case QImage::Format_RGB444:
return QImage::Format_ARGB4444_Premultiplied;
case QImage::Format_RGBX8888:
+ case QImage::Format_RGBA8888:
return QImage::Format_RGBA8888_Premultiplied;
case QImage::Format_BGR30:
return QImage::Format_A2BGR30_Premultiplied;
case QImage::Format_RGB30:
return QImage::Format_A2RGB30_Premultiplied;
case QImage::Format_RGBX64:
+ case QImage::Format_RGBA64:
+ case QImage::Format_Grayscale16:
return QImage::Format_RGBA64_Premultiplied;
- default:
+ case QImage::Format_RGBX16FPx4:
+ case QImage::Format_RGBA16FPx4:
+ return QImage::Format_RGBA16FPx4_Premultiplied;
+ case QImage::Format_RGBX32FPx4:
+ case QImage::Format_RGBA32FPx4:
+ return QImage::Format_RGBA32FPx4_Premultiplied;
+ case QImage::Format_ARGB32_Premultiplied:
+ case QImage::Format_ARGB8565_Premultiplied:
+ case QImage::Format_ARGB8555_Premultiplied:
+ case QImage::Format_ARGB6666_Premultiplied:
+ case QImage::Format_ARGB4444_Premultiplied:
+ case QImage::Format_RGBA8888_Premultiplied:
+ case QImage::Format_A2BGR30_Premultiplied:
+ case QImage::Format_A2RGB30_Premultiplied:
+ case QImage::Format_RGBA64_Premultiplied:
+ case QImage::Format_RGBA16FPx4_Premultiplied:
+ case QImage::Format_RGBA32FPx4_Premultiplied:
+ return format;
+ case QImage::Format_Mono:
+ case QImage::Format_MonoLSB:
+ case QImage::Format_Indexed8:
+ case QImage::Format_RGB888:
+ case QImage::Format_BGR888:
+ case QImage::Format_Alpha8:
+ case QImage::Format_Grayscale8:
+ case QImage::Format_Invalid:
+ case QImage::Format_CMYK8888:
+ case QImage::NImageFormats:
break;
}
return QImage::Format_ARGB32_Premultiplied;
}
+// Returns an opaque version that is compatible with format
+inline QImage::Format qt_maybeDataCompatibleOpaqueVersion(QImage::Format format)
+{
+ switch (format) {
+ case QImage::Format_ARGB6666_Premultiplied:
+ return QImage::Format_RGB666;
+ case QImage::Format_ARGB4444_Premultiplied:
+ return QImage::Format_RGB444;
+ case QImage::Format_RGBA8888:
+ case QImage::Format_RGBA8888_Premultiplied:
+ return QImage::Format_RGBX8888;
+ case QImage::Format_A2BGR30_Premultiplied:
+ return QImage::Format_BGR30;
+ case QImage::Format_A2RGB30_Premultiplied:
+ return QImage::Format_RGB30;
+ case QImage::Format_RGBA64:
+ case QImage::Format_RGBA64_Premultiplied:
+ return QImage::Format_RGBX64;
+ case QImage::Format_RGBA16FPx4:
+ case QImage::Format_RGBA16FPx4_Premultiplied:
+ return QImage::Format_RGBX16FPx4;
+ case QImage::Format_RGBA32FPx4:
+ case QImage::Format_RGBA32FPx4_Premultiplied:
+ return QImage::Format_RGBX32FPx4;
+ case QImage::Format_ARGB32_Premultiplied:
+ case QImage::Format_ARGB32:
+ return QImage::Format_RGB32;
+ case QImage::Format_RGB16:
+ case QImage::Format_RGB32:
+ case QImage::Format_RGB444:
+ case QImage::Format_RGB555:
+ case QImage::Format_RGB666:
+ case QImage::Format_RGB888:
+ case QImage::Format_BGR888:
+ case QImage::Format_RGBX8888:
+ case QImage::Format_BGR30:
+ case QImage::Format_RGB30:
+ case QImage::Format_RGBX64:
+ case QImage::Format_RGBX16FPx4:
+ case QImage::Format_RGBX32FPx4:
+ case QImage::Format_Grayscale8:
+ case QImage::Format_Grayscale16:
+ case QImage::Format_CMYK8888:
+ return format; // Already opaque
+ case QImage::Format_Mono:
+ case QImage::Format_MonoLSB:
+ case QImage::Format_Indexed8:
+ case QImage::Format_ARGB8565_Premultiplied:
+ case QImage::Format_ARGB8555_Premultiplied:
+ case QImage::Format_Alpha8:
+ case QImage::Format_Invalid:
+ case QImage::NImageFormats:
+ break;
+ }
+ return format; // No compatible opaque versions
+}
+
+constexpr QImage::Format qt_toUnpremultipliedFormat(QImage::Format format)
+{
+ // Assumes input is already a premultiplied format with an unpremultiplied counterpart
+ // This abuses the fact unpremultiplied formats are always before their premultiplied counterparts.
+ return static_cast<QImage::Format>(qToUnderlying(format) - 1);
+}
+
+constexpr QImage::Format qt_toPremultipliedFormat(QImage::Format format)
+{
+ // Assumes input is already an unpremultiplied format
+ // This abuses the fact unpremultiplied formats are always before their premultiplied counterparts.
+ return static_cast<QImage::Format>(qToUnderlying(format) + 1);
+}
+
inline bool qt_highColorPrecision(QImage::Format format, bool opaque = false)
{
// Formats with higher color precision than ARGB32_Premultiplied.
@@ -291,6 +408,28 @@ inline bool qt_highColorPrecision(QImage::Format format, bool opaque = false)
case QImage::Format_RGBA64:
case QImage::Format_RGBA64_Premultiplied:
case QImage::Format_Grayscale16:
+ case QImage::Format_RGBX16FPx4:
+ case QImage::Format_RGBA16FPx4:
+ case QImage::Format_RGBA16FPx4_Premultiplied:
+ case QImage::Format_RGBX32FPx4:
+ case QImage::Format_RGBA32FPx4:
+ case QImage::Format_RGBA32FPx4_Premultiplied:
+ return true;
+ default:
+ break;
+ }
+ return false;
+}
+
+inline bool qt_fpColorPrecision(QImage::Format format)
+{
+ switch (format) {
+ case QImage::Format_RGBX16FPx4:
+ case QImage::Format_RGBA16FPx4:
+ case QImage::Format_RGBA16FPx4_Premultiplied:
+ case QImage::Format_RGBX32FPx4:
+ case QImage::Format_RGBA32FPx4:
+ case QImage::Format_RGBA32FPx4_Premultiplied:
return true;
default:
break;
@@ -298,16 +437,107 @@ inline bool qt_highColorPrecision(QImage::Format format, bool opaque = false)
return false;
}
+inline QColorSpace::ColorModel qt_csColorData(QPixelFormat::ColorModel format)
+{
+ switch (format) {
+ case QPixelFormat::ColorModel::RGB:
+ case QPixelFormat::ColorModel::BGR:
+ case QPixelFormat::ColorModel::Indexed:
+ return QColorSpace::ColorModel::Rgb;
+ case QPixelFormat::ColorModel::Alpha:
+ return QColorSpace::ColorModel::Undefined; // No valid colors
+ case QPixelFormat::ColorModel::Grayscale:
+ return QColorSpace::ColorModel::Gray;
+ case QPixelFormat::ColorModel::CMYK:
+ return QColorSpace::ColorModel::Cmyk;
+ default:
+ break;
+ }
+ return QColorSpace::ColorModel::Undefined;
+}
-inline QImage::Format qt_maybeAlphaVersionWithSameDepth(QImage::Format format)
+inline bool qt_compatibleColorModel(QPixelFormat::ColorModel data, QColorSpace::ColorModel cs)
{
- const QImage::Format toFormat = qt_alphaVersion(format);
- return qt_depthForFormat(format) == qt_depthForFormat(toFormat) ? toFormat : format;
+ QColorSpace::ColorModel dataCs = qt_csColorData(data);
+
+ if (data == QPixelFormat::ColorModel::Alpha)
+ return true; // Alpha data has no colors and can be handled by any color space
+
+ if (cs == QColorSpace::ColorModel::Undefined || dataCs == QColorSpace::ColorModel::Undefined)
+ return false;
+
+ if (dataCs == cs)
+ return true; // Matching color models
+
+ if (dataCs == QColorSpace::ColorModel::Gray)
+ return true; // Can apply any CS with white point to Gray data
+
+ return false;
+}
+
+inline QImage::Format qt_maybeDataCompatibleAlphaVersion(QImage::Format format)
+{
+ switch (format) {
+ case QImage::Format_RGB32:
+ return QImage::Format_ARGB32_Premultiplied;
+ case QImage::Format_RGB666:
+ return QImage::Format_ARGB6666_Premultiplied;
+ case QImage::Format_RGB444:
+ return QImage::Format_ARGB4444_Premultiplied;
+ case QImage::Format_RGBX8888:
+ return QImage::Format_RGBA8888_Premultiplied;
+ case QImage::Format_BGR30:
+ return QImage::Format_A2BGR30_Premultiplied;
+ case QImage::Format_RGB30:
+ return QImage::Format_A2RGB30_Premultiplied;
+ case QImage::Format_RGBX64:
+ return QImage::Format_RGBA64_Premultiplied;
+ case QImage::Format_RGBX16FPx4:
+ return QImage::Format_RGBA16FPx4_Premultiplied;
+ case QImage::Format_RGBX32FPx4:
+ return QImage::Format_RGBA32FPx4_Premultiplied;
+ case QImage::Format_ARGB32:
+ case QImage::Format_ARGB32_Premultiplied:
+ case QImage::Format_ARGB8565_Premultiplied:
+ case QImage::Format_ARGB8555_Premultiplied:
+ case QImage::Format_ARGB6666_Premultiplied:
+ case QImage::Format_ARGB4444_Premultiplied:
+ case QImage::Format_RGBA8888:
+ case QImage::Format_RGBA8888_Premultiplied:
+ case QImage::Format_A2BGR30_Premultiplied:
+ case QImage::Format_A2RGB30_Premultiplied:
+ case QImage::Format_Alpha8:
+ case QImage::Format_RGBA64:
+ case QImage::Format_RGBA64_Premultiplied:
+ case QImage::Format_RGBA16FPx4:
+ case QImage::Format_RGBA16FPx4_Premultiplied:
+ case QImage::Format_RGBA32FPx4:
+ case QImage::Format_RGBA32FPx4_Premultiplied:
+ return format; // Already alpha versions
+ case QImage::Format_Mono:
+ case QImage::Format_MonoLSB:
+ case QImage::Format_Indexed8:
+ case QImage::Format_RGB16:
+ case QImage::Format_RGB555:
+ case QImage::Format_RGB888:
+ case QImage::Format_BGR888:
+ case QImage::Format_Grayscale8:
+ case QImage::Format_Grayscale16:
+ case QImage::Format_CMYK8888:
+ case QImage::Format_Invalid:
+ case QImage::NImageFormats:
+ break;
+ }
+ return format; // No data-compatible alpha version
}
inline QImage::Format qt_opaqueVersionForPainting(QImage::Format format)
{
- return qt_opaqueVersion(format);
+ QImage::Format toFormat = qt_opaqueVersion(format);
+ // If we are switching depth anyway upgrade to RGB32
+ if (qt_depthForFormat(format) != qt_depthForFormat(toFormat) && qt_depthForFormat(toFormat) <= 32)
+ toFormat = QImage::Format_RGB32;
+ return toFormat;
}
inline QImage::Format qt_alphaVersionForPainting(QImage::Format format)
@@ -315,7 +545,7 @@ inline QImage::Format qt_alphaVersionForPainting(QImage::Format format)
QImage::Format toFormat = qt_alphaVersion(format);
#if defined(__ARM_NEON__) || defined(__SSE2__)
// If we are switching depth anyway and we have optimized ARGB32PM routines, upgrade to that.
- if (qt_depthForFormat(format) != qt_depthForFormat(toFormat))
+ if (qt_depthForFormat(format) != qt_depthForFormat(toFormat) && qt_depthForFormat(toFormat) <= 32)
toFormat = QImage::Format_ARGB32_Premultiplied;
#endif
return toFormat;
diff --git a/src/gui/image/qimage_ssse3.cpp b/src/gui/image/qimage_ssse3.cpp
index fb81a1a6c3..40f52b6ce6 100644
--- a/src/gui/image/qimage_ssse3.cpp
+++ b/src/gui/image/qimage_ssse3.cpp
@@ -1,41 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the QtGui module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#include <qimage.h>
#include <private/qimage_p.h>
diff --git a/src/gui/image/qimageiohandler.cpp b/src/gui/image/qimageiohandler.cpp
index 0c9083a16e..1dcfd9a074 100644
--- a/src/gui/image/qimageiohandler.cpp
+++ b/src/gui/image/qimageiohandler.cpp
@@ -1,41 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the QtGui module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
/*!
\class QImageIOHandler
@@ -160,18 +124,15 @@
variants should return a list of supported variant names
(QList<QByteArray>) in this option.
- \value OptimizedWrite. A handler which supports this option
+ \value OptimizedWrite A handler which supports this option
is expected to turn on optimization flags when writing.
- \value ProgressiveScanWrite. A handler which supports
+ \value ProgressiveScanWrite A handler which supports
this option is expected to write the image as a progressive scan image.
- \value ImageTransformation. A handler which supports this option can read
+ \value ImageTransformation A handler which supports this option can read
the transformation metadata of an image. A handler that supports this option
should not apply the transformation itself.
-
- \value TransformedByDefault. A handler that reports support for this feature
- will have image transformation metadata applied by default on read.
*/
/*! \enum QImageIOHandler::Transformation
@@ -224,7 +185,7 @@
An image format plugin can support three capabilities: reading (\l
CanRead), writing (\l CanWrite) and \e incremental reading (\l
- CanReadIncremental). Reimplement capabilities() in you subclass to
+ CanReadIncremental). Reimplement capabilities() in your subclass to
expose the capabilities of your image format.
create() should create an instance of your QImageIOHandler
@@ -264,13 +225,17 @@
*/
#include "qimageiohandler.h"
+#include "qimage_p.h"
#include <qbytearray.h>
-#include <qimage.h>
+#include <qimagereader.h>
+#include <qloggingcategory.h>
#include <qvariant.h>
QT_BEGIN_NAMESPACE
+Q_LOGGING_CATEGORY(lcImageIo, "qt.gui.imageio")
+
class QIODevice;
class QImageIOHandlerPrivate
@@ -417,17 +382,6 @@ QByteArray QImageIOHandler::format() const
*/
/*!
- \obsolete
-
- Use format() instead.
-*/
-
-QByteArray QImageIOHandler::name() const // ### Qt6: remove
-{
- return format();
-}
-
-/*!
Writes the image \a image to the assigned device. Returns \c true on
success; otherwise returns \c false.
@@ -563,6 +517,45 @@ int QImageIOHandler::nextImageDelay() const
return 0;
}
+/*!
+ \since 6.0
+
+ This is a convenience method for the reading function in subclasses. Image
+ format handlers must reject loading an image if the required allocation
+ would exceeed the current allocation limit. This function checks the
+ parameters and limit, and does the allocation if it is valid and required.
+ Upon successful return, \a image will be a valid, detached QImage of the
+ given \a size and \a format.
+
+ \sa QImageReader::allocationLimit()
+*/
+bool QImageIOHandler::allocateImage(QSize size, QImage::Format format, QImage *image)
+{
+ Q_ASSERT(image);
+ if (size.isEmpty() || format <= QImage::Format_Invalid || format >= QImage::NImageFormats)
+ return false;
+
+ if (image->size() == size && image->format() == format) {
+ image->detach();
+ } else {
+ if (const int mbLimit = QImageReader::allocationLimit()) {
+ qsizetype depth = qMax(qt_depthForFormat(format), 32); // Effective gui depth = 32
+ QImageData::ImageSizeParameters szp =
+ QImageData::calculateImageParameters(size.width(), size.height(), depth);
+ if (!szp.isValid())
+ return false;
+ const qsizetype mb = szp.totalSize >> 20;
+ if (mb > mbLimit || (mb == mbLimit && szp.totalSize % (1 << 20))) {
+ qCWarning(lcImageIo, "QImageIOHandler: Rejecting image as it exceeds the current "
+ "allocation limit of %i megabytes", mbLimit);
+ return false;
+ }
+ }
+ *image = QImage(size, format);
+ }
+ return !image->isNull();
+}
+
#ifndef QT_NO_IMAGEFORMATPLUGIN
/*!
@@ -618,3 +611,5 @@ QImageIOPlugin::~QImageIOPlugin()
#endif // QT_NO_IMAGEFORMATPLUGIN
QT_END_NAMESPACE
+
+#include "moc_qimageiohandler.cpp"
diff --git a/src/gui/image/qimageiohandler.h b/src/gui/image/qimageiohandler.h
index a4acf9dfe0..ccd215203a 100644
--- a/src/gui/image/qimageiohandler.h
+++ b/src/gui/image/qimageiohandler.h
@@ -1,46 +1,11 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the QtGui module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#ifndef QIMAGEIOHANDLER_H
#define QIMAGEIOHANDLER_H
#include <QtGui/qtguiglobal.h>
+#include <QtGui/qimage.h>
#include <QtCore/qiodevice.h>
#include <QtCore/qplugin.h>
#include <QtCore/qfactoryinterface.h>
@@ -69,9 +34,6 @@ public:
void setFormat(const QByteArray &format) const;
QByteArray format() const;
- QT_DEPRECATED_X("Use QImageIOHandler::format() instead")
- virtual QByteArray name() const;
-
virtual bool canRead() const = 0;
virtual bool read(QImage *image) = 0;
virtual bool write(const QImage &image);
@@ -96,9 +58,6 @@ public:
OptimizedWrite,
ProgressiveScanWrite,
ImageTransformation
-#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
- , TransformedByDefault
-#endif
};
enum Transformation {
@@ -126,6 +85,8 @@ public:
virtual int currentImageNumber() const;
virtual QRect currentImageRect() const;
+ static bool allocateImage(QSize size, QImage::Format format, QImage *image);
+
protected:
QImageIOHandler(QImageIOHandlerPrivate &dd);
QScopedPointer<QImageIOHandlerPrivate> d_ptr;
diff --git a/src/gui/image/qimagepixmapcleanuphooks.cpp b/src/gui/image/qimagepixmapcleanuphooks.cpp
index f383e7a60e..f6d891eed9 100644
--- a/src/gui/image/qimagepixmapcleanuphooks.cpp
+++ b/src/gui/image/qimagepixmapcleanuphooks.cpp
@@ -1,41 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the QtGui module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#include "qimagepixmapcleanuphooks_p.h"
#include <qpa/qplatformpixmap.h>
diff --git a/src/gui/image/qimagepixmapcleanuphooks_p.h b/src/gui/image/qimagepixmapcleanuphooks_p.h
index 29144c6656..3a3d5aa5f8 100644
--- a/src/gui/image/qimagepixmapcleanuphooks_p.h
+++ b/src/gui/image/qimagepixmapcleanuphooks_p.h
@@ -1,41 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the QtGui module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#ifndef QIMAGEPIXMAP_CLEANUPHOOKS_P_H
#define QIMAGEPIXMAP_CLEANUPHOOKS_P_H
diff --git a/src/gui/image/qimagereader.cpp b/src/gui/image/qimagereader.cpp
index 5e3b608d20..9366e9cbb1 100644
--- a/src/gui/image/qimagereader.cpp
+++ b/src/gui/image/qimagereader.cpp
@@ -1,41 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the QtGui module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
//#define QIMAGEREADER_DEBUG
@@ -47,7 +11,6 @@
\inmodule QtGui
\reentrant
\ingroup painting
- \ingroup io
The most common way to read images is through QImage and QPixmap's
constructors, or by calling QImage::load() and
@@ -101,8 +64,8 @@
This can be disabled by setting the environment variable
\c QT_HIGHDPI_DISABLE_2X_IMAGE_LOADING.
- \sa QImageWriter, QImageIOHandler, QImageIOPlugin, QMimeDatabase
- \sa QImage::devicePixelRatio(), QPixmap::devicePixelRatio(), QIcon, QPainter::drawPixmap(), QPainter::drawImage(), Qt::AA_UseHighDpiPixmaps
+ \sa QImageWriter, QImageIOHandler, QImageIOPlugin, QMimeDatabase, QColorSpace
+ \sa QImage::devicePixelRatio(), QPixmap::devicePixelRatio(), QIcon, QPainter::drawPixmap(), QPainter::drawImage()
*/
/*!
@@ -172,6 +135,10 @@
QT_BEGIN_NAMESPACE
using namespace QImageReaderWriterHelpers;
+using namespace Qt::StringLiterals;
+
+Q_TRACE_POINT(qtgui, QImageReader_read_before_reading, QImageReader *reader, const QString &filename);
+Q_TRACE_POINT(qtgui, QImageReader_read_after_reading, QImageReader *reader, bool result);
static QImageIOHandler *createReadHandlerHelper(QIODevice *device,
const QByteArray &format,
@@ -186,7 +153,7 @@ static QImageIOHandler *createReadHandlerHelper(QIODevice *device,
QByteArray suffix;
#ifndef QT_NO_IMAGEFORMATPLUGIN
- static QBasicMutex mutex;
+ Q_CONSTINIT static QBasicMutex mutex;
const auto locker = qt_scoped_lock(mutex);
typedef QMultiMap<int, QString> PluginKeyMap;
@@ -271,7 +238,7 @@ static QImageIOHandler *createReadHandlerHelper(QIODevice *device,
}
}
} else {
- const int testIndex = keyMap.key(QLatin1String(testFormat), -1);
+ const int testIndex = keyMap.key(QLatin1StringView(testFormat), -1);
if (testIndex != -1) {
QImageIOPlugin *plugin = qobject_cast<QImageIOPlugin *>(l->instance(testIndex));
if (plugin && plugin->capabilities(device, testFormat) & QImageIOPlugin::CanRead) {
@@ -492,8 +459,12 @@ public:
QString errorString;
QImageReader *q;
+
+ static int maxAlloc;
};
+int QImageReaderPrivate::maxAlloc = 256; // 256 MB is enough for an 8K 64bpp image
+
/*!
\internal
*/
@@ -515,9 +486,9 @@ QImageReaderPrivate::QImageReaderPrivate(QImageReader *qq)
*/
QImageReaderPrivate::~QImageReaderPrivate()
{
+ delete handler;
if (deleteDevice)
delete device;
- delete handler;
}
/*!
@@ -525,6 +496,9 @@ QImageReaderPrivate::~QImageReaderPrivate()
*/
bool QImageReaderPrivate::initHandler()
{
+ if (handler)
+ return true;
+
// check some preconditions
if (!device || (!deleteDevice && !device->isOpen() && !device->open(QIODevice::ReadOnly))) {
imageReaderError = QImageReader::DeviceError;
@@ -534,7 +508,7 @@ bool QImageReaderPrivate::initHandler()
// probe the file extension
if (deleteDevice && !device->isOpen() && !device->open(QIODevice::ReadOnly) && autoDetectImageFormat) {
- Q_ASSERT(qobject_cast<QFile*>(device) != 0); // future-proofing; for now this should always be the case, so...
+ Q_ASSERT(qobject_cast<QFile*>(device) != nullptr); // future-proofing; for now this should always be the case, so...
QFile *file = static_cast<QFile *>(device);
if (file->error() == QFileDevice::ResourceError) {
@@ -555,14 +529,15 @@ bool QImageReaderPrivate::initHandler()
int currentExtension = 0;
QString fileName = file->fileName();
+ bool fileIsOpen;
do {
- file->setFileName(fileName + QLatin1Char('.')
- + QLatin1String(extensions.at(currentExtension++).constData()));
- file->open(QIODevice::ReadOnly);
- } while (!file->isOpen() && currentExtension < extensions.size());
+ file->setFileName(fileName + u'.'
+ + QLatin1StringView(extensions.at(currentExtension++).constData()));
+ fileIsOpen = file->open(QIODevice::ReadOnly);
+ } while (!fileIsOpen && currentExtension < extensions.size());
- if (!device->isOpen()) {
+ if (!fileIsOpen) {
imageReaderError = QImageReader::FileNotFoundError;
errorString = QImageReader::tr("File not found");
file->setFileName(fileName); // restore the old file name
@@ -571,7 +546,7 @@ bool QImageReaderPrivate::initHandler()
}
// assign a handler
- if (!handler && (handler = createReadHandlerHelper(device, format, autoDetectImageFormat, ignoresFormatAndExtension)) == nullptr) {
+ if ((handler = createReadHandlerHelper(device, format, autoDetectImageFormat, ignoresFormatAndExtension)) == nullptr) {
imageReaderError = QImageReader::UnsupportedFormatError;
errorString = QImageReader::tr("Unsupported image format");
return false;
@@ -584,7 +559,7 @@ bool QImageReaderPrivate::initHandler()
*/
void QImageReaderPrivate::getText()
{
- if (text.isEmpty() && (handler || initHandler()) && handler->supportsOption(QImageIOHandler::Description))
+ if (text.isEmpty() && q->supportsOption(QImageIOHandler::Description))
text = qt_getImageTextFromDescription(handler->option(QImageIOHandler::Description).toString());
}
@@ -765,7 +740,7 @@ bool QImageReader::decideFormatFromContent() const
otherwise left unchanged.
If the device is not already open, QImageReader will attempt to
- open the device in \l QIODevice::ReadOnly mode by calling
+ open the device in \l {QIODeviceBase::}{ReadOnly} mode by calling
open(). Note that this does not work for certain devices, such as
QProcess, QTcpSocket and QUdpSocket, where more logic is required
to open the device.
@@ -774,12 +749,12 @@ bool QImageReader::decideFormatFromContent() const
*/
void QImageReader::setDevice(QIODevice *device)
{
+ delete d->handler;
+ d->handler = nullptr;
if (d->device && d->deleteDevice)
delete d->device;
d->device = device;
d->deleteDevice = false;
- delete d->handler;
- d->handler = nullptr;
d->text.clear();
}
@@ -795,7 +770,7 @@ QIODevice *QImageReader::device() const
/*!
Sets the file name of QImageReader to \a fileName. Internally,
QImageReader will create a QFile object and open it in \l
- QIODevice::ReadOnly mode, and use this when reading images.
+ {QIODeviceBase::}{ReadOnly} mode, and use this when reading images.
If \a fileName does not include a file extension (e.g., .png or .bmp),
QImageReader will cycle through all supported extensions until it finds
@@ -874,10 +849,7 @@ int QImageReader::quality() const
*/
QSize QImageReader::size() const
{
- if (!d->initHandler())
- return QSize();
-
- if (d->handler->supportsOption(QImageIOHandler::Size))
+ if (supportsOption(QImageIOHandler::Size))
return d->handler->option(QImageIOHandler::Size).toSize();
return QSize();
@@ -897,10 +869,7 @@ QSize QImageReader::size() const
*/
QImage::Format QImageReader::imageFormat() const
{
- if (!d->initHandler())
- return QImage::Format_Invalid;
-
- if (d->handler->supportsOption(QImageIOHandler::ImageFormat))
+ if (supportsOption(QImageIOHandler::ImageFormat))
return (QImage::Format)d->handler->option(QImageIOHandler::ImageFormat).toInt();
return QImage::Format_Invalid;
@@ -972,6 +941,10 @@ QRect QImageReader::clipRect() const
support scaling), QImageReader will use QImage::scale() with
Qt::SmoothScaling.
+ If only one dimension is set in \a size, the other one will be
+ computed from the image's \l {size()} {natural size} so as to
+ maintain the aspect ratio.
+
\sa scaledSize(), setClipRect(), setScaledClipRect()
*/
void QImageReader::setScaledSize(const QSize &size)
@@ -1022,9 +995,7 @@ QRect QImageReader::scaledClipRect() const
*/
void QImageReader::setBackgroundColor(const QColor &color)
{
- if (!d->initHandler())
- return;
- if (d->handler->supportsOption(QImageIOHandler::BackgroundColor))
+ if (supportsOption(QImageIOHandler::BackgroundColor))
d->handler->setOption(QImageIOHandler::BackgroundColor, color);
}
@@ -1039,9 +1010,7 @@ void QImageReader::setBackgroundColor(const QColor &color)
*/
QColor QImageReader::backgroundColor() const
{
- if (!d->initHandler())
- return QColor();
- if (d->handler->supportsOption(QImageIOHandler::BackgroundColor))
+ if (supportsOption(QImageIOHandler::BackgroundColor))
return qvariant_cast<QColor>(d->handler->option(QImageIOHandler::BackgroundColor));
return QColor();
}
@@ -1056,9 +1025,7 @@ QColor QImageReader::backgroundColor() const
*/
bool QImageReader::supportsAnimation() const
{
- if (!d->initHandler())
- return false;
- if (d->handler->supportsOption(QImageIOHandler::Animation))
+ if (supportsOption(QImageIOHandler::Animation))
return d->handler->option(QImageIOHandler::Animation).toBool();
return false;
}
@@ -1070,10 +1037,7 @@ bool QImageReader::supportsAnimation() const
*/
QByteArray QImageReader::subType() const
{
- if (!d->initHandler())
- return QByteArray();
-
- if (d->handler->supportsOption(QImageIOHandler::SubType))
+ if (supportsOption(QImageIOHandler::SubType))
return d->handler->option(QImageIOHandler::SubType).toByteArray();
return QByteArray();
}
@@ -1085,11 +1049,8 @@ QByteArray QImageReader::subType() const
*/
QList<QByteArray> QImageReader::supportedSubTypes() const
{
- if (!d->initHandler())
- return QList<QByteArray>();
-
- if (d->handler->supportsOption(QImageIOHandler::SupportedSubTypes))
- return d->handler->option(QImageIOHandler::SupportedSubTypes).value< QList<QByteArray> >();
+ if (supportsOption(QImageIOHandler::SupportedSubTypes))
+ return qvariant_cast<QList<QByteArray> >(d->handler->option(QImageIOHandler::SupportedSubTypes));
return QList<QByteArray>();
}
@@ -1104,7 +1065,7 @@ QList<QByteArray> QImageReader::supportedSubTypes() const
QImageIOHandler::Transformations QImageReader::transformation() const
{
int option = QImageIOHandler::TransformationNone;
- if (d->initHandler() && d->handler->supportsOption(QImageIOHandler::ImageTransformation))
+ if (supportsOption(QImageIOHandler::ImageTransformation))
option = d->handler->option(QImageIOHandler::ImageTransformation).toInt();
return QImageIOHandler::Transformations(option);
}
@@ -1138,10 +1099,6 @@ bool QImageReader::autoTransform() const
case QImageReaderPrivate::DoNotApplyTransform:
return false;
case QImageReaderPrivate::UsePluginDefault:
-#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
- if (d->initHandler())
- return d->handler->supportsOption(QImageIOHandler::TransformedByDefault);
-#endif
Q_FALLTHROUGH();
default:
break;
@@ -1150,39 +1107,6 @@ bool QImageReader::autoTransform() const
}
/*!
- \since 5.6
-
- This is an image format specific function that forces images with
- gamma information to be gamma corrected to \a gamma. For image formats
- that do not support gamma correction, this value is ignored.
-
- To gamma correct to a standard PC color-space, set gamma to \c 1/2.2.
-
- \sa gamma()
-*/
-void QImageReader::setGamma(float gamma)
-{
- if (d->initHandler() && d->handler->supportsOption(QImageIOHandler::Gamma))
- d->handler->setOption(QImageIOHandler::Gamma, gamma);
-}
-
-/*!
- \since 5.6
-
- Returns the gamma level of the decoded image. If setGamma() has been
- called and gamma correction is supported it will return the gamma set.
- If gamma level is not supported by the image format, \c 0.0 is returned.
-
- \sa setGamma()
-*/
-float QImageReader::gamma() const
-{
- if (d->initHandler() && d->handler->supportsOption(QImageIOHandler::Gamma))
- return d->handler->option(QImageIOHandler::Gamma).toFloat();
- return 0.0;
-}
-
-/*!
Returns \c true if an image can be read for the device (i.e., the
image format is supported, and the device seems to contain valid
data); otherwise returns \c false.
@@ -1256,31 +1180,48 @@ bool QImageReader::read(QImage *image)
return false;
}
- if (!d->handler && !d->initHandler())
+ if (!d->initHandler())
return false;
+ QSize scaledSize = d->scaledSize;
+ if ((scaledSize.width() <= 0 && scaledSize.height() > 0) ||
+ (scaledSize.height() <= 0 && scaledSize.width() > 0)) {
+ // if only one dimension is given, let's try to calculate the second one
+ // based on the original image size and maintaining the aspect ratio
+ if (const QSize originalSize = size(); !originalSize.isEmpty()) {
+ if (scaledSize.width() <= 0) {
+ const auto ratio = qreal(scaledSize.height()) / originalSize.height();
+ scaledSize.setWidth(qRound(originalSize.width() * ratio));
+ } else {
+ const auto ratio = qreal(scaledSize.width()) / originalSize.width();
+ scaledSize.setHeight(qRound(originalSize.height() * ratio));
+ }
+ }
+ }
+
+ const bool supportScaledSize = supportsOption(QImageIOHandler::ScaledSize) && scaledSize.isValid();
+ const bool supportClipRect = supportsOption(QImageIOHandler::ClipRect) && !d->clipRect.isNull();
+ const bool supportScaledClipRect = supportsOption(QImageIOHandler::ScaledClipRect) && !d->scaledClipRect.isNull();
+
// set the handler specific options.
- if (d->handler->supportsOption(QImageIOHandler::ScaledSize) && d->scaledSize.isValid()) {
- if ((d->handler->supportsOption(QImageIOHandler::ClipRect) && !d->clipRect.isNull())
- || d->clipRect.isNull()) {
+ if (supportScaledSize) {
+ if (supportClipRect || d->clipRect.isNull()) {
// Only enable the ScaledSize option if there is no clip rect, or
// if the handler also supports ClipRect.
- d->handler->setOption(QImageIOHandler::ScaledSize, d->scaledSize);
+ d->handler->setOption(QImageIOHandler::ScaledSize, scaledSize);
}
}
- if (d->handler->supportsOption(QImageIOHandler::ClipRect) && !d->clipRect.isNull())
+ if (supportClipRect)
d->handler->setOption(QImageIOHandler::ClipRect, d->clipRect);
- if (d->handler->supportsOption(QImageIOHandler::ScaledClipRect) && !d->scaledClipRect.isNull())
+ if (supportScaledClipRect)
d->handler->setOption(QImageIOHandler::ScaledClipRect, d->scaledClipRect);
- if (d->handler->supportsOption(QImageIOHandler::Quality))
+ if (supportsOption(QImageIOHandler::Quality))
d->handler->setOption(QImageIOHandler::Quality, d->quality);
// read the image
+ QString filename = fileName();
if (Q_TRACE_ENABLED(QImageReader_read_before_reading)) {
- QString fileName = QStringLiteral("unknown");
- if (QFile *file = qobject_cast<QFile *>(d->device))
- fileName = file->fileName();
- Q_TRACE(QImageReader_read_before_reading, this, fileName);
+ Q_TRACE(QImageReader_read_before_reading, this, filename.isEmpty() ? u"unknown"_s : filename);
}
const bool result = d->handler->read(image);
@@ -1295,9 +1236,9 @@ bool QImageReader::read(QImage *image)
// provide default implementations for any unsupported image
// options
- if (d->handler->supportsOption(QImageIOHandler::ClipRect) && !d->clipRect.isNull()) {
- if (d->handler->supportsOption(QImageIOHandler::ScaledSize) && d->scaledSize.isValid()) {
- if (d->handler->supportsOption(QImageIOHandler::ScaledClipRect) && !d->scaledClipRect.isNull()) {
+ if (supportClipRect) {
+ if (supportScaledSize) {
+ if (supportScaledClipRect) {
// all features are supported by the handler; nothing to do.
} else {
// the image is already scaled, so apply scaled clipping.
@@ -1305,12 +1246,12 @@ bool QImageReader::read(QImage *image)
*image = image->copy(d->scaledClipRect);
}
} else {
- if (d->handler->supportsOption(QImageIOHandler::ScaledClipRect) && !d->scaledClipRect.isNull()) {
+ if (supportScaledClipRect) {
// supports scaled clipping but not scaling, most
// likely a broken handler.
} else {
- if (d->scaledSize.isValid()) {
- *image = image->scaled(d->scaledSize, Qt::IgnoreAspectRatio, Qt::SmoothTransformation);
+ if (scaledSize.isValid()) {
+ *image = image->scaled(scaledSize, Qt::IgnoreAspectRatio, Qt::SmoothTransformation);
}
if (d->scaledClipRect.isValid()) {
*image = image->copy(d->scaledClipRect);
@@ -1318,8 +1259,8 @@ bool QImageReader::read(QImage *image)
}
}
} else {
- if (d->handler->supportsOption(QImageIOHandler::ScaledSize) && d->scaledSize.isValid() && d->clipRect.isNull()) {
- if (d->handler->supportsOption(QImageIOHandler::ScaledClipRect) && !d->scaledClipRect.isNull()) {
+ if (supportScaledSize && d->clipRect.isNull()) {
+ if (supportScaledClipRect) {
// nothing to do (ClipRect is ignored!)
} else {
// provide all workarounds.
@@ -1328,7 +1269,7 @@ bool QImageReader::read(QImage *image)
}
}
} else {
- if (d->handler->supportsOption(QImageIOHandler::ScaledClipRect) && !d->scaledClipRect.isNull()) {
+ if (supportScaledClipRect) {
// this makes no sense; a handler that supports
// ScaledClipRect but not ScaledSize is broken, and we
// can't work around it.
@@ -1336,8 +1277,8 @@ bool QImageReader::read(QImage *image)
// provide all workarounds.
if (d->clipRect.isValid())
*image = image->copy(d->clipRect);
- if (d->scaledSize.isValid())
- *image = image->scaled(d->scaledSize, Qt::IgnoreAspectRatio, Qt::SmoothTransformation);
+ if (scaledSize.isValid())
+ *image = image->scaled(scaledSize, Qt::IgnoreAspectRatio, Qt::SmoothTransformation);
if (d->scaledClipRect.isValid())
*image = image->copy(d->scaledClipRect);
}
@@ -1347,8 +1288,8 @@ bool QImageReader::read(QImage *image)
// successful read; check for "@Nx" file name suffix and set device pixel ratio.
static bool disableNxImageLoading = !qEnvironmentVariableIsEmpty("QT_HIGHDPI_DISABLE_2X_IMAGE_LOADING");
if (!disableNxImageLoading) {
- const QByteArray suffix = QFileInfo(fileName()).baseName().right(3).toLatin1();
- if (suffix.length() == 3 && suffix[0] == '@' && suffix[1] >= '2' && suffix[1] <= '9' && suffix[2] == 'x')
+ const QByteArray suffix = QFileInfo(filename).baseName().right(3).toLatin1();
+ if (suffix.size() == 3 && suffix[0] == '@' && suffix[1] >= '2' && suffix[1] <= '9' && suffix[2] == 'x')
image->setDevicePixelRatio(suffix[1] - '0');
}
if (autoTransform())
@@ -1608,4 +1549,47 @@ QList<QByteArray> QImageReader::imageFormatsForMimeType(const QByteArray &mimeTy
QImageReaderWriterHelpers::CanRead);
}
+/*!
+ \since 6.0
+
+ Returns the current allocation limit, in megabytes.
+
+ \sa setAllocationLimit()
+*/
+int QImageReader::allocationLimit()
+{
+ static int envLimit = []() {
+ bool ok = false;
+ int res = qEnvironmentVariableIntValue("QT_IMAGEIO_MAXALLOC", &ok);
+ return ok ? res : -1;
+ }();
+
+ return envLimit >= 0 ? envLimit : QImageReaderPrivate::maxAlloc;
+}
+
+/*!
+ \since 6.0
+
+ Sets the allocation limit to \a mbLimit megabytes. Images that would
+ require a QImage memory allocation above this limit will be rejected.
+ If \a mbLimit is 0, the allocation size check will be disabled.
+
+ This limit helps applications avoid unexpectedly large memory usage from
+ loading corrupt image files. It is normally not needed to change it. The
+ default limit is large enough for all commonly used image sizes.
+
+ At runtime, this value may be overridden by the environment variable \c QT_IMAGEIO_MAXALLOC.
+
+ \note The memory requirements are calculated for a minimum of 32 bits per pixel, since Qt will
+ typically convert an image to that depth when it is used in GUI. This means that the effective
+ allocation limit is significantly smaller than \a mbLimit when reading 1 bpp and 8 bpp images.
+
+ \sa allocationLimit()
+*/
+void QImageReader::setAllocationLimit(int mbLimit)
+{
+ if (mbLimit >= 0)
+ QImageReaderPrivate::maxAlloc = mbLimit;
+}
+
QT_END_NAMESPACE
diff --git a/src/gui/image/qimagereader.h b/src/gui/image/qimagereader.h
index 4e9a08b6e6..c5ea883c83 100644
--- a/src/gui/image/qimagereader.h
+++ b/src/gui/image/qimagereader.h
@@ -1,41 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the QtGui module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#ifndef QIMAGEREADER_H
#define QIMAGEREADER_H
@@ -53,7 +17,6 @@ class QColor;
class QIODevice;
class QRect;
class QSize;
-class QStringList;
class QImageReaderPrivate;
class Q_GUI_EXPORT QImageReader
@@ -117,9 +80,6 @@ public:
void setAutoTransform(bool enabled);
bool autoTransform() const;
- void setGamma(float gamma);
- float gamma() const;
-
QByteArray subType() const;
QList<QByteArray> supportedSubTypes() const;
@@ -145,6 +105,8 @@ public:
static QList<QByteArray> supportedImageFormats();
static QList<QByteArray> supportedMimeTypes();
static QList<QByteArray> imageFormatsForMimeType(const QByteArray &mimeType);
+ static int allocationLimit();
+ static void setAllocationLimit(int mbLimit);
private:
Q_DISABLE_COPY(QImageReader)
diff --git a/src/gui/image/qimagereaderwriterhelpers.cpp b/src/gui/image/qimagereaderwriterhelpers.cpp
index dd56d887a7..502b0f95f0 100644
--- a/src/gui/image/qimagereaderwriterhelpers.cpp
+++ b/src/gui/image/qimagereaderwriterhelpers.cpp
@@ -1,57 +1,23 @@
-/****************************************************************************
-**
-** Copyright (C) 2018 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the QtGui module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2018 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#include "private/qimagereaderwriterhelpers_p.h"
-#include <qjsonarray.h>
+#include <qcborarray.h>
#include <qmutex.h>
#include <private/qfactoryloader_p.h>
QT_BEGIN_NAMESPACE
+using namespace Qt::StringLiterals;
+
namespace QImageReaderWriterHelpers {
#ifndef QT_NO_IMAGEFORMATPLUGIN
-Q_GLOBAL_STATIC_WITH_ARGS(QFactoryLoader, loader,
- (QImageIOHandlerFactoryInterface_iid, QLatin1String("/imageformats")))
-Q_GLOBAL_STATIC(QMutex, loaderMutex)
+Q_GLOBAL_STATIC_WITH_ARGS(QFactoryLoader, irhLoader,
+ (QImageIOHandlerFactoryInterface_iid, "/imageformats"_L1))
+Q_GLOBAL_STATIC(QMutex, irhLoaderMutex)
static void appendImagePluginFormats(QFactoryLoader *loader,
QImageIOPlugin::Capability cap,
@@ -81,13 +47,12 @@ static void appendImagePluginMimeTypes(QFactoryLoader *loader,
QList<QByteArray> *result,
QList<QByteArray> *resultKeys = nullptr)
{
- QList<QJsonObject> metaDataList = loader->metaData();
-
+ QList<QPluginParsedMetaData> metaDataList = loader->metaData();
const int pluginCount = metaDataList.size();
for (int i = 0; i < pluginCount; ++i) {
- const QJsonObject metaData = metaDataList.at(i).value(QLatin1String("MetaData")).toObject();
- const QJsonArray keys = metaData.value(QLatin1String("Keys")).toArray();
- const QJsonArray mimeTypes = metaData.value(QLatin1String("MimeTypes")).toArray();
+ const QCborMap metaData = metaDataList.at(i).value(QtPluginMetaDataKeys::MetaData).toMap();
+ const QCborArray keys = metaData.value("Keys"_L1).toArray();
+ const QCborArray mimeTypes = metaData.value("MimeTypes"_L1).toArray();
QImageIOPlugin *plugin = qobject_cast<QImageIOPlugin *>(loader->instance(i));
const int keyCount = keys.size();
for (int k = 0; k < keyCount; ++k) {
@@ -103,9 +68,9 @@ static void appendImagePluginMimeTypes(QFactoryLoader *loader,
QSharedPointer<QFactoryLoader> pluginLoader()
{
- loaderMutex()->lock();
- return QSharedPointer<QFactoryLoader>(loader(), [](QFactoryLoader *) {
- loaderMutex()->unlock();
+ irhLoaderMutex()->lock();
+ return QSharedPointer<QFactoryLoader>(irhLoader(), [](QFactoryLoader *) {
+ irhLoaderMutex()->unlock();
});
}
@@ -124,7 +89,7 @@ QList<QByteArray> supportedImageFormats(Capability cap)
formats << _qt_BuiltInFormats[i].extension;
#ifndef QT_NO_IMAGEFORMATPLUGIN
- appendImagePluginFormats(loader(), pluginCapability(cap), &formats);
+ appendImagePluginFormats(irhLoader(), pluginCapability(cap), &formats);
#endif // QT_NO_IMAGEFORMATPLUGIN
std::sort(formats.begin(), formats.end());
@@ -132,15 +97,17 @@ QList<QByteArray> supportedImageFormats(Capability cap)
return formats;
}
+static constexpr QByteArrayView imagePrefix() noexcept { return "image/"; }
+
QList<QByteArray> supportedMimeTypes(Capability cap)
{
QList<QByteArray> mimeTypes;
mimeTypes.reserve(_qt_NumFormats);
for (const auto &fmt : _qt_BuiltInFormats)
- mimeTypes.append(QByteArrayLiteral("image/") + fmt.mimeType);
+ mimeTypes.emplace_back(imagePrefix() + fmt.mimeType);
#ifndef QT_NO_IMAGEFORMATPLUGIN
- appendImagePluginMimeTypes(loader(), pluginCapability(cap), &mimeTypes);
+ appendImagePluginMimeTypes(irhLoader(), pluginCapability(cap), &mimeTypes);
#endif // QT_NO_IMAGEFORMATPLUGIN
std::sort(mimeTypes.begin(), mimeTypes.end());
@@ -148,11 +115,11 @@ QList<QByteArray> supportedMimeTypes(Capability cap)
return mimeTypes;
}
-QList<QByteArray> imageFormatsForMimeType(const QByteArray &mimeType, Capability cap)
+QList<QByteArray> imageFormatsForMimeType(QByteArrayView mimeType, Capability cap)
{
QList<QByteArray> formats;
- if (mimeType.startsWith("image/")) {
- const QByteArray type = mimeType.mid(sizeof("image/") - 1);
+ if (mimeType.startsWith(imagePrefix())) {
+ const QByteArrayView type = mimeType.mid(imagePrefix().size());
for (const auto &fmt : _qt_BuiltInFormats) {
if (fmt.mimeType == type && !formats.contains(fmt.extension))
formats << fmt.extension;
@@ -162,7 +129,7 @@ QList<QByteArray> imageFormatsForMimeType(const QByteArray &mimeType, Capability
#ifndef QT_NO_IMAGEFORMATPLUGIN
QList<QByteArray> mimeTypes;
QList<QByteArray> keys;
- appendImagePluginMimeTypes(loader(), pluginCapability(cap), &mimeTypes, &keys);
+ appendImagePluginMimeTypes(irhLoader(), pluginCapability(cap), &mimeTypes, &keys);
for (int i = 0; i < mimeTypes.size(); ++i) {
if (mimeTypes.at(i) == mimeType) {
const auto &key = keys.at(i);
diff --git a/src/gui/image/qimagereaderwriterhelpers_p.h b/src/gui/image/qimagereaderwriterhelpers_p.h
index 6fe418a8ab..930a57b536 100644
--- a/src/gui/image/qimagereaderwriterhelpers_p.h
+++ b/src/gui/image/qimagereaderwriterhelpers_p.h
@@ -1,41 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2018 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the QtGui module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2018 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#ifndef QIMAGEREADERWRITERHELPERS_P_H
#define QIMAGEREADERWRITERHELPERS_P_H
@@ -118,7 +82,7 @@ static const _qt_BuiltInFormatStruct _qt_BuiltInFormats[] = {
{"xpm", "x-xpixmap"},
#endif
};
-Q_STATIC_ASSERT(_qt_NumFormats == sizeof _qt_BuiltInFormats / sizeof *_qt_BuiltInFormats);
+static_assert(_qt_NumFormats == sizeof _qt_BuiltInFormats / sizeof *_qt_BuiltInFormats);
#ifndef QT_NO_IMAGEFORMATPLUGIN
QSharedPointer<QFactoryLoader> pluginLoader();
@@ -130,7 +94,7 @@ enum Capability {
};
QList<QByteArray> supportedImageFormats(Capability cap);
QList<QByteArray> supportedMimeTypes(Capability cap);
-QList<QByteArray> imageFormatsForMimeType(const QByteArray &mimeType, Capability cap);
+QList<QByteArray> imageFormatsForMimeType(QByteArrayView mimeType, Capability cap);
}
diff --git a/src/gui/image/qimagewriter.cpp b/src/gui/image/qimagewriter.cpp
index 9dcc955fe2..d2176e4189 100644
--- a/src/gui/image/qimagewriter.cpp
+++ b/src/gui/image/qimagewriter.cpp
@@ -1,41 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the QtGui module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
/*!
\class QImageWriter
@@ -45,21 +9,19 @@
\inmodule QtGui
\reentrant
\ingroup painting
- \ingroup io
- QImageWriter supports setting format specific options, such as the
- gamma level, compression level and quality, prior to storing the
+ QImageWriter supports setting format specific options, such as
+ compression level and quality, prior to storing the
image. If you do not need such options, you can use QImage::save()
or QPixmap::save() instead.
To store an image, you start by constructing a QImageWriter
object. Pass either a file name or a device pointer, and the
image format to QImageWriter's constructor. You can then set
- several options, such as the gamma level (by calling setGamma())
- and quality (by calling setQuality()). canWrite() returns \c true if
- QImageWriter can write the image (i.e., the image format is
- supported and the device is open for writing). Call write() to
- write the image to the device.
+ several options, such as quality (by calling setQuality()).
+ canWrite() returns \c true if QImageWriter can write the image
+ (i.e., the image format is supported and the device is open for
+ writing). Call write() to write the image to the device.
If any error occurs when writing the image, write() will return
false. You can then call error() to find the type of error that
@@ -81,7 +43,7 @@
\snippet qimagewriter/main.cpp 0
- \sa QImageReader, QImageIOHandler, QImageIOPlugin
+ \sa QImageReader, QImageIOHandler, QImageIOPlugin, QColorSpace
*/
/*!
@@ -134,6 +96,8 @@
QT_BEGIN_NAMESPACE
+using namespace Qt::StringLiterals;
+
static QImageIOHandler *createWriteHandlerHelper(QIODevice *device,
const QByteArray &format)
{
@@ -154,7 +118,7 @@ static QImageIOHandler *createWriteHandlerHelper(QIODevice *device,
// if there's no format, see if \a device is a file, and if so, find
// the file suffix and find support for that format among our plugins.
// this allows plugins to override our built-in handlers.
- if (QFile *file = qobject_cast<QFile *>(device)) {
+ if (QFileDevice *file = qobject_cast<QFileDevice *>(device)) {
if (!(suffix = QFileInfo(file->fileName()).suffix().toLower().toLatin1()).isEmpty()) {
#ifndef QT_NO_IMAGEFORMATPLUGIN
const int index = keyMap.key(QString::fromLatin1(suffix), -1);
@@ -350,9 +314,9 @@ QImageWriter::QImageWriter(const QString &fileName, const QByteArray &format)
*/
QImageWriter::~QImageWriter()
{
+ delete d->handler;
if (d->deleteDevice)
delete d->device;
- delete d->handler;
delete d;
}
@@ -397,13 +361,13 @@ QByteArray QImageWriter::format() const
*/
void QImageWriter::setDevice(QIODevice *device)
{
+ delete d->handler;
+ d->handler = nullptr;
if (d->device && d->deleteDevice)
delete d->device;
d->device = device;
d->deleteDevice = false;
- delete d->handler;
- d->handler = nullptr;
}
/*!
@@ -429,17 +393,17 @@ void QImageWriter::setFileName(const QString &fileName)
}
/*!
- If the currently assigned device is a QFile, or if setFileName()
+ If the currently assigned device is a file, or if setFileName()
has been called, this function returns the name of the file
QImageWriter writes to. Otherwise (i.e., if no device has been
- assigned or the device is not a QFile), an empty QString is
+ assigned or the device is not a file), an empty QString is
returned.
\sa setFileName(), setDevice()
*/
QString QImageWriter::fileName() const
{
- QFile *file = qobject_cast<QFile *>(d->device);
+ QFileDevice *file = qobject_cast<QFileDevice *>(d->device);
return file ? file->fileName() : QString();
}
@@ -499,31 +463,6 @@ int QImageWriter::compression() const
}
/*!
- This is an image format specific function that sets the gamma
- level of the image to \a gamma. For image formats that do not
- support setting the gamma level, this value is ignored.
-
- The value range of \a gamma depends on the image format. For
- example, the "png" format supports a gamma range from 0.0 to 1.0.
-
- \sa quality()
-*/
-void QImageWriter::setGamma(float gamma)
-{
- d->gamma = gamma;
-}
-
-/*!
- Returns the gamma level of the image.
-
- \sa setGamma()
-*/
-float QImageWriter::gamma() const
-{
- return d->gamma;
-}
-
-/*!
\since 5.4
This is an image format specific function that sets the
@@ -561,7 +500,7 @@ QList<QByteArray> QImageWriter::supportedSubTypes() const
{
if (!supportsOption(QImageIOHandler::SupportedSubTypes))
return QList<QByteArray>();
- return d->handler->option(QImageIOHandler::SupportedSubTypes).value< QList<QByteArray> >();
+ return qvariant_cast<QList<QByteArray> >(d->handler->option(QImageIOHandler::SupportedSubTypes));
}
/*!
@@ -648,40 +587,6 @@ QImageIOHandler::Transformations QImageWriter::transformation() const
return d->transformation;
}
-#if QT_DEPRECATED_SINCE(5, 13)
-/*!
- \obsolete
-
- Use setText() instead.
-
- This is an image format specific function that sets the
- description of the image to \a description. For image formats that
- do not support setting the description, this value is ignored.
-
- The contents of \a description depends on the image format.
-
- \sa description()
-*/
-void QImageWriter::setDescription(const QString &description)
-{
- d->description = description;
-}
-
-/*!
- \obsolete
-
- Use QImageReader::text() instead.
-
- Returns the description of the image.
-
- \sa setDescription()
-*/
-QString QImageWriter::description() const
-{
- return d->description;
-}
-#endif
-
/*!
\since 4.1
@@ -706,8 +611,8 @@ QString QImageWriter::description() const
void QImageWriter::setText(const QString &key, const QString &text)
{
if (!d->description.isEmpty())
- d->description += QLatin1String("\n\n");
- d->description += key.simplified() + QLatin1String(": ") + text.simplified();
+ d->description += "\n\n"_L1;
+ d->description += key.simplified() + ": "_L1 + text.simplified();
}
/*!
@@ -779,7 +684,7 @@ bool QImageWriter::write(const QImage &image)
if (!d->handler->write(img))
return false;
- if (QFile *file = qobject_cast<QFile *>(d->device))
+ if (QFileDevice *file = qobject_cast<QFileDevice *>(d->device))
file->flush();
return true;
}
diff --git a/src/gui/image/qimagewriter.h b/src/gui/image/qimagewriter.h
index ef84a59b7c..b01161025a 100644
--- a/src/gui/image/qimagewriter.h
+++ b/src/gui/image/qimagewriter.h
@@ -1,41 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the QtGui module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#ifndef QIMAGEWRITER_H
#define QIMAGEWRITER_H
@@ -84,9 +48,6 @@ public:
void setCompression(int compression);
int compression() const;
- void setGamma(float gamma);
- float gamma() const;
-
void setSubType(const QByteArray &type);
QByteArray subType() const;
QList<QByteArray> supportedSubTypes() const;
@@ -100,13 +61,6 @@ public:
QImageIOHandler::Transformations transformation() const;
void setTransformation(QImageIOHandler::Transformations orientation);
-#if QT_DEPRECATED_SINCE(5, 13)
- QT_DEPRECATED_X("Use QImageWriter::setText() instead")
- void setDescription(const QString &description);
- QT_DEPRECATED_X("Use QImageReader::text() instead")
- QString description() const;
-#endif
-
void setText(const QString &key, const QString &text);
bool canWrite() const;
diff --git a/src/gui/image/qmovie.cpp b/src/gui/image/qmovie.cpp
index 79019d0fdf..0d13639d35 100644
--- a/src/gui/image/qmovie.cpp
+++ b/src/gui/image/qmovie.cpp
@@ -1,41 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the QtGui module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
/*!
\class QMovie
@@ -45,9 +9,7 @@
\brief The QMovie class is a convenience class for playing movies
with QImageReader.
- This class is used to show simple animations without sound. If you want
- to display video and media content, use the \l{Qt Multimedia}
- multimedia framework instead.
+ This class is used to show simple animations without sound.
First, create a QMovie object by passing either the name of a file or a
pointer to a QIODevice containing an animated image format to QMovie's
@@ -91,7 +53,7 @@
Call supportedFormats() for a list of formats that QMovie supports.
- \sa QLabel, QImageReader, {Movie Example}
+ \sa QLabel, QImageReader
*/
/*! \enum QMovie::MovieState
@@ -182,17 +144,20 @@
#include "qrect.h"
#include "qelapsedtimer.h"
#include "qtimer.h"
-#include "qpair.h"
#include "qmap.h"
#include "qlist.h"
#include "qbuffer.h"
#include "qdir.h"
+#include "qloggingcategory.h"
#include "private/qobject_p.h"
+#include "private/qproperty_p.h"
#define QMOVIE_INVALID_DELAY -1
QT_BEGIN_NAMESPACE
+Q_DECLARE_LOGGING_CATEGORY(lcImageIo)
+
class QFrameInfo
{
public:
@@ -222,7 +187,7 @@ public:
static inline QFrameInfo endMarker()
{ return QFrameInfo(true); }
};
-Q_DECLARE_TYPEINFO(QFrameInfo, Q_MOVABLE_TYPE);
+Q_DECLARE_TYPEINFO(QFrameInfo, Q_RELOCATABLE_TYPE);
class QMoviePrivate : public QObjectPrivate
{
@@ -249,20 +214,24 @@ public:
void _q_loadNextFrame();
void _q_loadNextFrame(bool starting);
- QImageReader *reader;
- int speed;
- QMovie::MovieState movieState;
+ QImageReader *reader = nullptr;
+
+ void setSpeed(int percentSpeed) { q_func()->setSpeed(percentSpeed); }
+ Q_OBJECT_COMPAT_PROPERTY_WITH_ARGS(QMoviePrivate, int, speed, &QMoviePrivate::setSpeed, 100)
+
+ QMovie::MovieState movieState = QMovie::NotRunning;
QRect frameRect;
QPixmap currentPixmap;
- int currentFrameNumber;
- int nextFrameNumber;
- int greatestFrameNumber;
- int nextDelay;
- int playCounter;
- qint64 initialDevicePos;
- QMovie::CacheMode cacheMode;
- bool haveReadAll;
- bool isFirstIteration;
+ int currentFrameNumber = -1;
+ int nextFrameNumber = 0;
+ int greatestFrameNumber = -1;
+ int nextDelay = 0;
+ int playCounter = -1;
+ qint64 initialDevicePos = 0;
+ Q_OBJECT_BINDABLE_PROPERTY_WITH_ARGS(QMoviePrivate, QMovie::CacheMode, cacheMode,
+ QMovie::CacheNone)
+ bool haveReadAll = false;
+ bool isFirstIteration = true;
QMap<int, QFrameInfo> frameMap;
QString absoluteFilePath;
@@ -272,10 +241,6 @@ public:
/*! \internal
*/
QMoviePrivate::QMoviePrivate(QMovie *qq)
- : reader(nullptr), speed(100), movieState(QMovie::NotRunning),
- currentFrameNumber(-1), nextFrameNumber(0), greatestFrameNumber(-1),
- nextDelay(0), playCounter(-1),
- cacheMode(QMovie::CacheNone), haveReadAll(false), isFirstIteration(true)
{
q_ptr = qq;
nextImageTimer.setSingleShot(true);
@@ -343,6 +308,19 @@ QFrameInfo QMoviePrivate::infoForFrame(int frameNumber)
return QFrameInfo(); // Invalid
}
+ // For an animated image format, the tradition is that QMovie calls read()
+ // until canRead() == false, because the number of frames may not be known
+ // in advance; but if we're abusing a multi-frame format as an animation,
+ // canRead() may remain true, and we need to stop after reading the maximum
+ // number of frames that the image provides.
+ const bool supportsAnimation = reader->supportsOption(QImageIOHandler::Animation);
+ const int stopAtFrame = supportsAnimation ? -1 : frameCount();
+
+ // For an animated image format, QImageIOHandler::nextImageDelay() should
+ // provide the time to wait until showing the next frame; but multi-frame
+ // formats are not expected to provide this value, so use 1000 ms by default.
+ const auto nextFrameDelay = [&]() { return supportsAnimation ? reader->nextImageDelay() : 1000; };
+
if (cacheMode == QMovie::CacheNone) {
if (frameNumber != currentFrameNumber+1) {
// Non-sequential frame access
@@ -372,8 +350,12 @@ QFrameInfo QMoviePrivate::infoForFrame(int frameNumber)
}
}
}
- if (reader->canRead()) {
+ qCDebug(lcImageIo, "CacheNone: read frame %d of %d", frameNumber, stopAtFrame);
+ if (stopAtFrame > 0 ? (frameNumber < stopAtFrame) : reader->canRead()) {
// reader says we can read. Attempt to actually read image
+ // But if it's a non-animated multi-frame format and we know the frame count, stop there.
+ if (stopAtFrame > 0)
+ reader->jumpToImage(frameNumber);
QImage anImage = reader->read();
if (anImage.isNull()) {
// Reading image failed.
@@ -381,7 +363,7 @@ QFrameInfo QMoviePrivate::infoForFrame(int frameNumber)
}
if (frameNumber > greatestFrameNumber)
greatestFrameNumber = frameNumber;
- return QFrameInfo(QPixmap::fromImage(std::move(anImage)), reader->nextImageDelay());
+ return QFrameInfo(QPixmap::fromImage(std::move(anImage)), nextFrameDelay());
} else if (frameNumber != 0) {
// We've read all frames now. Return an end marker
haveReadAll = true;
@@ -397,15 +379,19 @@ QFrameInfo QMoviePrivate::infoForFrame(int frameNumber)
if (frameNumber > greatestFrameNumber) {
// Frame hasn't been read from file yet. Try to do it
for (int i = greatestFrameNumber + 1; i <= frameNumber; ++i) {
- if (reader->canRead()) {
+ qCDebug(lcImageIo, "CacheAll: read frame %d of %d", frameNumber, stopAtFrame);
+ if (stopAtFrame > 0 ? (frameNumber < stopAtFrame) : reader->canRead()) {
// reader says we can read. Attempt to actually read image
+ // But if it's a non-animated multi-frame format and we know the frame count, stop there.
+ if (stopAtFrame > 0)
+ reader->jumpToImage(frameNumber);
QImage anImage = reader->read();
if (anImage.isNull()) {
// Reading image failed.
return QFrameInfo(); // Invalid
}
greatestFrameNumber = i;
- QFrameInfo info(QPixmap::fromImage(std::move(anImage)), reader->nextImageDelay());
+ QFrameInfo info(QPixmap::fromImage(std::move(anImage)), nextFrameDelay());
// Cache it!
frameMap.insert(i, info);
if (i == frameNumber) {
@@ -463,11 +449,7 @@ bool QMoviePrivate::next()
}
// Image and delay OK, update internal state
currentFrameNumber = nextFrameNumber++;
- QSize scaledSize = reader->scaledSize();
- if (scaledSize.isValid() && (scaledSize != info.pixmap.size()))
- currentPixmap = QPixmap::fromImage( info.pixmap.toImage().scaled(scaledSize) );
- else
- currentPixmap = info.pixmap;
+ currentPixmap = info.pixmap;
if (!speed)
return true;
@@ -930,7 +912,12 @@ void QMovie::setSpeed(int percentSpeed)
Q_D(QMovie);
if (!d->speed && d->movieState == Running)
d->nextImageTimer.start(nextFrameDelay());
- d->speed = percentSpeed;
+ if (percentSpeed != d->speed) {
+ d->speed = percentSpeed;
+ d->speed.notify();
+ } else {
+ d->speed.removeBindingUnlessInWrapper();
+ }
}
int QMovie::speed() const
@@ -939,6 +926,12 @@ int QMovie::speed() const
return d->speed;
}
+QBindable<int> QMovie::bindableSpeed()
+{
+ Q_D(QMovie);
+ return &d->speed;
+}
+
/*!
Starts the movie. QMovie will enter \l Running state, and start emitting
updated() and resized() as the movie progresses.
@@ -1024,7 +1017,7 @@ QList<QByteArray> QMovie::supportedFormats()
return !QImageReader(&buffer, format).supportsOption(QImageIOHandler::Animation);
};
- list.erase(std::remove_if(list.begin(), list.end(), doesntSupportAnimation), list.end());
+ list.removeIf(doesntSupportAnimation);
return list;
}
@@ -1061,6 +1054,12 @@ void QMovie::setCacheMode(CacheMode cacheMode)
d->cacheMode = cacheMode;
}
+QBindable<QMovie::CacheMode> QMovie::bindableCacheMode()
+{
+ Q_D(QMovie);
+ return &d->cacheMode;
+}
+
QT_END_NAMESPACE
#include "moc_qmovie.cpp"
diff --git a/src/gui/image/qmovie.h b/src/gui/image/qmovie.h
index e13c528894..874e6189ba 100644
--- a/src/gui/image/qmovie.h
+++ b/src/gui/image/qmovie.h
@@ -1,41 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the QtGui module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#ifndef QMOVIE_H
#define QMOVIE_H
@@ -64,8 +28,8 @@ class Q_GUI_EXPORT QMovie : public QObject
{
Q_OBJECT
Q_DECLARE_PRIVATE(QMovie)
- Q_PROPERTY(int speed READ speed WRITE setSpeed)
- Q_PROPERTY(CacheMode cacheMode READ cacheMode WRITE setCacheMode)
+ Q_PROPERTY(int speed READ speed WRITE setSpeed BINDABLE bindableSpeed)
+ Q_PROPERTY(CacheMode cacheMode READ cacheMode WRITE setCacheMode BINDABLE bindableCacheMode)
public:
enum MovieState {
NotRunning,
@@ -115,12 +79,14 @@ public:
int currentFrameNumber() const;
int speed() const;
+ QBindable<int> bindableSpeed();
QSize scaledSize();
void setScaledSize(const QSize &size);
CacheMode cacheMode() const;
void setCacheMode(CacheMode mode);
+ QBindable<CacheMode> bindableCacheMode();
Q_SIGNALS:
void started();
diff --git a/src/gui/image/qpaintengine_pic.cpp b/src/gui/image/qpaintengine_pic.cpp
index e89cac452a..438305742c 100644
--- a/src/gui/image/qpaintengine_pic.cpp
+++ b/src/gui/image/qpaintengine_pic.cpp
@@ -1,41 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the QtGui module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#include "private/qpaintengine_p.h"
#include "private/qpainter_p.h"
@@ -140,8 +104,8 @@ bool QPicturePaintEngine::end()
}
d->s << (quint32) d->pic_d->trecs; // write number of records
d->pic_d->pictb.seek(cs_start);
- QByteArray buf = d->pic_d->pictb.buffer();
- quint16 cs = (quint16) qChecksum(buf.constData() + data_start, pos - data_start);
+ const QByteArray buf = d->pic_d->pictb.buffer();
+ quint16 cs = (quint16) qChecksum(QByteArrayView(buf.constData() + data_start, pos - data_start));
d->s << cs; // write checksum
d->pic_d->pictb.close();
setActive(false);
diff --git a/src/gui/image/qpaintengine_pic_p.h b/src/gui/image/qpaintengine_pic_p.h
index c9e4b43197..44d0eb63db 100644
--- a/src/gui/image/qpaintengine_pic_p.h
+++ b/src/gui/image/qpaintengine_pic_p.h
@@ -1,41 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the QtGui module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#ifndef QPAINTENGINE_PIC_P_H
#define QPAINTENGINE_PIC_P_H
diff --git a/src/gui/image/qpicture.cpp b/src/gui/image/qpicture.cpp
index d469ac8aae..da8c5ef1e5 100644
--- a/src/gui/image/qpicture.cpp
+++ b/src/gui/image/qpicture.cpp
@@ -1,41 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the QtGui module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#include "qpicture.h"
#include <private/qpicture_p.h>
@@ -54,7 +18,6 @@
#include "qpainter.h"
#include "qpainterpath.h"
#include "qpixmap.h"
-#include "qregexp.h"
#include "qregion.h"
#include "qdebug.h"
#include <QtCore/private/qlocking_p.h>
@@ -258,9 +221,6 @@ void QPicture::setData(const char* data, uint size)
Loads a picture from the file specified by \a fileName and returns
true if successful; otherwise invalidates the picture and returns \c false.
- Please note that the \a format parameter has been deprecated and
- will have no effect.
-
\sa save()
*/
@@ -293,9 +253,6 @@ bool QPicture::load(QIODevice *dev)
Saves a picture to the file specified by \a fileName and returns
true if successful; otherwise returns \c false.
- Please note that the \a format parameter has been deprecated and
- will have no effect.
-
\sa load()
*/
@@ -365,6 +322,8 @@ void QPicture::setBoundingRect(const QRect &r)
This function does exactly the same as QPainter::drawPicture()
with (x, y) = (0, 0).
+
+ \note The state of the painter isn't preserved by this function.
*/
bool QPicture::play(QPainter *painter)
@@ -465,7 +424,7 @@ bool QPicture::exec(QPainter *painter, QDataStream &s, int nrecords)
QPen pen;
QBrush brush;
QRegion rgn;
- QMatrix wmatrix;
+ qreal wmatrix[6];
QTransform matrix;
QTransform worldMatrix = painter->transform();
@@ -820,8 +779,12 @@ bool QPicture::exec(QPainter *painter, QDataStream &s, int nrecords)
if (d->formatMajor >= 8) {
s >> matrix >> i_8;
} else {
- s >> wmatrix >> i_8;
- matrix = QTransform(wmatrix);
+ s >> wmatrix[0] >> wmatrix[1]
+ >> wmatrix[2] >> wmatrix[3]
+ >> wmatrix[4] >> wmatrix[5] >> i_8;
+ matrix = QTransform(wmatrix[0], wmatrix[1],
+ wmatrix[2], wmatrix[3],
+ wmatrix[4], wmatrix[5]);
}
// i_8 is always false due to updateXForm() in qpaintengine_pic.cpp
painter->setTransform(matrix * worldMatrix, i_8);
@@ -851,6 +814,8 @@ bool QPicture::exec(QPainter *painter, QDataStream &s, int nrecords)
bool(ul & QPainter::Antialiasing));
painter->setRenderHint(QPainter::SmoothPixmapTransform,
bool(ul & QPainter::SmoothPixmapTransform));
+ painter->setRenderHint(QPainter::NonCosmeticBrushPatterns,
+ bool(ul & QPainter::NonCosmeticBrushPatterns));
break;
case QPicturePrivate::PdcSetCompositionMode:
s >> ul;
@@ -1041,10 +1006,10 @@ bool QPicturePrivate::checkFormat()
int cs_start = sizeof(quint32); // pos of checksum word
int data_start = cs_start + sizeof(quint16);
quint16 cs,ccs;
- QByteArray buf = pictb.buffer(); // pointer to data
+ const QByteArray buf = pictb.buffer(); // pointer to data
s >> cs; // read checksum
- ccs = (quint16) qChecksum(buf.constData() + data_start, buf.size() - data_start);
+ ccs = (quint16) qChecksum(QByteArrayView(buf.constData() + data_start, buf.size() - data_start));
if (ccs != cs) {
qWarning("QPicturePaintEngine::checkFormat: Invalid checksum %x, %x expected",
ccs, cs);
diff --git a/src/gui/image/qpicture.h b/src/gui/image/qpicture.h
index 34860985ed..bc8be6c4e9 100644
--- a/src/gui/image/qpicture.h
+++ b/src/gui/image/qpicture.h
@@ -1,49 +1,13 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the QtGui module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#ifndef QPICTURE_H
#define QPICTURE_H
#include <QtGui/qtguiglobal.h>
#include <QtCore/qiodevice.h>
+#include <QtCore/qshareddata.h>
#include <QtCore/qstringlist.h>
-#include <QtCore/qsharedpointer.h>
#include <QtGui/qpaintdevice.h>
QT_BEGIN_NAMESPACE
@@ -77,8 +41,7 @@ public:
void setBoundingRect(const QRect &r);
QPicture& operator=(const QPicture &p);
- inline QPicture &operator=(QPicture &&other) noexcept
- { qSwap(d_ptr, other.d_ptr); return *this; }
+ QT_MOVE_ASSIGNMENT_OPERATOR_IMPL_VIA_PURE_SWAP(QPicture)
inline void swap(QPicture &other) noexcept
{ d_ptr.swap(other.d_ptr); }
void detach();
diff --git a/src/gui/image/qpicture_p.h b/src/gui/image/qpicture_p.h
index 67db9aa354..c512f49320 100644
--- a/src/gui/image/qpicture_p.h
+++ b/src/gui/image/qpicture_p.h
@@ -1,41 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the QtGui module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#ifndef QPICTURE_P_H
#define QPICTURE_P_H
@@ -54,13 +18,13 @@
#include <QtGui/private/qtguiglobal_p.h>
#include "QtCore/qatomic.h"
#include "QtCore/qbuffer.h"
+#include "QtCore/qlist.h"
#include "QtCore/qobjectdefs.h"
-#include "QtCore/qvector.h"
+#include "QtCore/qrect.h"
#include "QtGui/qpicture.h"
#include "QtGui/qpixmap.h"
#include "QtGui/qpen.h"
#include "QtGui/qbrush.h"
-#include "QtCore/qrect.h"
#include "private/qobject_p.h"
QT_BEGIN_NAMESPACE
@@ -158,8 +122,8 @@ public:
QRect override_rect;
QScopedPointer<QPaintEngine> paintEngine;
bool in_memory_only;
- QVector<QImage> image_list;
- QVector<QPixmap> pixmap_list;
+ QList<QImage> image_list;
+ QList<QPixmap> pixmap_list;
QList<QBrush> brush_list;
QList<QPen> pen_list;
};
diff --git a/src/gui/image/qpixmap.cpp b/src/gui/image/qpixmap.cpp
index 3fce64cb20..89b8d5303b 100644
--- a/src/gui/image/qpixmap.cpp
+++ b/src/gui/image/qpixmap.cpp
@@ -1,41 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the QtGui module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2021 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#include <qglobal.h>
@@ -66,25 +30,33 @@
#include "qpixmap_raster_p.h"
#include "private/qhexstring_p.h"
+#include <qtgui_tracepoints_p.h>
+
+#include <memory>
+
QT_BEGIN_NAMESPACE
+using namespace Qt::StringLiterals;
+
+Q_TRACE_PARAM_REPLACE(Qt::AspectRatioMode, int);
+Q_TRACE_PARAM_REPLACE(Qt::TransformationMode, int);
+
+// MSVC 19.28 does show spurious warning "C4723: potential divide by 0" for code that divides
+// by height() in release builds. Anyhow, all the code paths in this file are only executed
+// for valid QPixmap's, where height() cannot be 0. Therefore disable the warning.
+QT_WARNING_DISABLE_MSVC(4723)
+
static bool qt_pixmap_thread_test()
{
if (Q_UNLIKELY(!QCoreApplication::instance())) {
qFatal("QPixmap: Must construct a QGuiApplication before a QPixmap");
return false;
}
-
- if (qApp->thread() != QThread::currentThread()) {
- bool fail = false;
- if (!QGuiApplicationPrivate::platformIntegration()->hasCapability(QPlatformIntegration::ThreadedPixmaps)) {
- printf("Lighthouse plugin does not support threaded pixmaps!\n");
- fail = true;
- }
- if (fail) {
- qWarning("QPixmap: It is not safe to use pixmaps outside the GUI thread");
- return false;
- }
+ if (QGuiApplicationPrivate::instance()
+ && qApp->thread() != QThread::currentThread()
+ && !QGuiApplicationPrivate::platformIntegration()->hasCapability(QPlatformIntegration::ThreadedPixmaps)) {
+ qWarning("QPixmap: It is not safe to use pixmaps outside the GUI thread on this platform");
+ return false;
}
return true;
}
@@ -222,6 +194,14 @@ QPixmap::QPixmap(const QPixmap &pixmap)
}
}
+/*! \fn QPixmap::QPixmap(QPixmap &&other)
+ Move-constructs a QPixmap instance from \a other.
+
+ \sa swap() operator=(QPixmap&&)
+*/
+
+QT_DEFINE_QESDP_SPECIALIZATION_DTOR(QPlatformPixmap)
+
/*!
Constructs a pixmap from the given \a xpm data, which must be a
valid XPM image.
@@ -231,7 +211,7 @@ QPixmap::QPixmap(const QPixmap &pixmap)
Note that it's possible to squeeze the XPM variable a little bit
by using an unusual declaration:
- \snippet code/src_gui_image_qpixmap.cpp 0
+ \snippet code/src_gui_image_qimage.cpp 2
The extra \c const makes the entire definition read-only, which is
slightly more efficient (for example, when the code is in a shared
@@ -402,7 +382,7 @@ QPixmap &QPixmap::operator=(const QPixmap &pixmap)
*/
QPixmap::operator QVariant() const
{
- return QVariant(QVariant::Pixmap, this);
+ return QVariant::fromValue(*this);
}
/*!
@@ -438,7 +418,7 @@ QImage QPixmap::toImage() const
}
/*!
- \fn QMatrix QPixmap::trueMatrix(const QTransform &matrix, int width, int height)
+ \fn QTransform QPixmap::trueMatrix(const QTransform &matrix, int width, int height)
Returns the actual matrix used for transforming a pixmap with the
given \a width, \a height and \a matrix.
@@ -459,19 +439,6 @@ QTransform QPixmap::trueMatrix(const QTransform &m, int w, int h)
}
/*!
- \overload
-
- This convenience function loads the matrix \a m into a
- QTransform and calls the overloaded function with the
- QTransform and the width \a w and the height \a h.
- */
-QMatrix QPixmap::trueMatrix(const QMatrix &m, int w, int h)
-{
- return trueMatrix(QTransform(m), w, h).toAffine();
-}
-
-
-/*!
\fn bool QPixmap::isQBitmap() const
Returns \c true if this is a QBitmap; otherwise returns \c false.
@@ -636,7 +603,7 @@ qreal QPixmap::devicePixelRatio() const
high-DPI pixmap rather than a large pixmap
(see \l{Drawing High Resolution Versions of Pixmaps and Images}).
- \sa devicePixelRatio()
+ \sa devicePixelRatio(), deviceIndependentSize()
*/
void QPixmap::setDevicePixelRatio(qreal scaleFactor)
{
@@ -650,6 +617,23 @@ void QPixmap::setDevicePixelRatio(qreal scaleFactor)
data->setDevicePixelRatio(scaleFactor);
}
+/*!
+ Returns the size of the pixmap in device independent pixels.
+
+ This value should be used when using the pixmap size in user interface
+ size calculations.
+
+ The return value is equivalent to pixmap.size() / pixmap.devicePixelRatio().
+
+ \since 6.2
+*/
+QSizeF QPixmap::deviceIndependentSize() const
+{
+ if (!data)
+ return QSizeF(0, 0);
+ return QSizeF(data->width(), data->height()) / data->devicePixelRatio();
+}
+
#ifndef QT_NO_IMAGE_HEURISTIC_MASK
/*!
Creates and returns a heuristic mask for this pixmap.
@@ -731,9 +715,9 @@ bool QPixmap::load(const QString &fileName, const char *format, Qt::ImageConvers
if (info.completeSuffix().isEmpty() || info.exists()) {
const bool inGuiThread = qApp->thread() == QThread::currentThread();
- QString key = QLatin1String("qt_pixmap")
+ QString key = "qt_pixmap"_L1
% info.absoluteFilePath()
- % HexString<uint>(info.lastModified().toSecsSinceEpoch())
+ % HexString<uint>(info.lastModified(QTimeZone::UTC).toSecsSinceEpoch())
% HexString<quint64>(info.size())
% HexString<uint>(data ? data->pixelType() : QPlatformPixmap::PixmapType);
@@ -813,8 +797,8 @@ bool QPixmap::loadFromData(const uchar *buf, uint len, const char *format, Qt::I
0 to obtain small compressed files, 100 for large uncompressed
files, and -1 to use the default settings.
- If \a format is 0, an image format will be chosen from \a fileName's
- suffix.
+ If \a format is \nullptr, an image format will be chosen from
+ \a fileName's suffix.
\sa {QPixmap#Reading and Writing Image Files}{Reading and Writing
Image Files}
@@ -858,37 +842,6 @@ bool QPixmap::doImageIO(QImageWriter *writer, int quality) const
}
-#if QT_DEPRECATED_SINCE(5, 13)
-/*!
- \obsolete
-
- Use QPainter or the fill(QColor) overload instead.
-*/
-
-void QPixmap::fill(const QPaintDevice *device, const QPoint &p)
-{
- Q_UNUSED(device)
- Q_UNUSED(p)
- qWarning("this function is deprecated, ignored");
-}
-
-
-/*!
- \fn void QPixmap::fill(const QPaintDevice *device, int x, int y)
- \obsolete
-
- Use QPainter or the fill(QColor) overload instead.
-*/
-void QPixmap::fill(const QPaintDevice *device, int xofs, int yofs)
-{
- Q_UNUSED(device)
- Q_UNUSED(xofs)
- Q_UNUSED(yofs)
- qWarning("this function is deprecated, ignored");
-}
-#endif
-
-
/*!
Fills the pixmap with the given \a color.
@@ -919,26 +872,12 @@ void QPixmap::fill(const QColor &color)
// it will be filled with new pixel data anyway.
QPlatformPixmap *d = data->createCompatiblePlatformPixmap();
d->resize(data->width(), data->height());
+ d->setDevicePixelRatio(data->devicePixelRatio());
data = d;
}
data->fill(color);
}
-/*! \fn int QPixmap::serialNumber() const
- \obsolete
- Returns a number that identifies the contents of this QPixmap
- object. Distinct QPixmap objects can only have the same serial
- number if they refer to the same contents (but they don't have
- to).
-
- Use cacheKey() instead.
-
- \warning The serial number doesn't necessarily change when
- the pixmap is altered. This means that it may be dangerous to use
- it as a cache key. For caching pixmaps, we recommend using the
- QPixmapCache class whenever possible.
-*/
-
/*!
Returns a number that identifies this QPixmap. Distinct QPixmap
objects can only have the same cache key if they refer to the same
@@ -970,38 +909,6 @@ static void sendResizeEvents(QWidget *target)
}
#endif
-#if QT_DEPRECATED_SINCE(5, 13)
-/*!
- \obsolete
-
- Use QWidget::grab() instead.
-*/
-QPixmap QPixmap::grabWidget(QObject *widget, const QRect &rectangle)
-{
- QPixmap pixmap;
- qWarning("QPixmap::grabWidget is deprecated, use QWidget::grab() instead");
- if (!widget)
- return pixmap;
- QMetaObject::invokeMethod(widget, "grab", Qt::DirectConnection,
- Q_RETURN_ARG(QPixmap, pixmap),
- Q_ARG(QRect, rectangle));
- return pixmap;
-}
-
-/*!
- \fn QPixmap QPixmap::grabWidget(QObject *widget, int x, int y, int w, int h)
- \obsolete
-
- Use QWidget::grab() instead.
-*/
-QPixmap QPixmap::grabWidget(QObject *widget, int x, int y, int w, int h)
-{
-QT_WARNING_PUSH
-QT_WARNING_DISABLE_DEPRECATED
- return grabWidget(widget, QRect(x, y, w, h));
-QT_WARNING_POP
-}
-#endif
/*****************************************************************************
QPixmap stream functions
@@ -1128,7 +1035,7 @@ bool QPixmap::convertFromImage(const QImage &image, Qt::ImageConversionFlags fla
Transformations}
*/
-QPixmap QPixmap::scaled(const QSize& s, Qt::AspectRatioMode aspectMode, Qt::TransformationMode mode) const
+QPixmap Q_TRACE_INSTRUMENT(qtgui) QPixmap::scaled(const QSize& s, Qt::AspectRatioMode aspectMode, Qt::TransformationMode mode) const
{
if (isNull()) {
qWarning("QPixmap::scaled: Pixmap is a null pixmap");
@@ -1144,6 +1051,8 @@ QPixmap QPixmap::scaled(const QSize& s, Qt::AspectRatioMode aspectMode, Qt::Tran
if (newSize == size())
return *this;
+ Q_TRACE_SCOPE(QPixmap_scaled, s, aspectMode, mode);
+
QTransform wm = QTransform::fromScale((qreal)newSize.width() / width(),
(qreal)newSize.height() / height());
QPixmap pix = transformed(wm, mode);
@@ -1164,7 +1073,7 @@ QPixmap QPixmap::scaled(const QSize& s, Qt::AspectRatioMode aspectMode, Qt::Tran
\sa isNull(), {QPixmap#Pixmap Transformations}{Pixmap
Transformations}
*/
-QPixmap QPixmap::scaledToWidth(int w, Qt::TransformationMode mode) const
+QPixmap Q_TRACE_INSTRUMENT(qtgui) QPixmap::scaledToWidth(int w, Qt::TransformationMode mode) const
{
if (isNull()) {
qWarning("QPixmap::scaleWidth: Pixmap is a null pixmap");
@@ -1173,6 +1082,8 @@ QPixmap QPixmap::scaledToWidth(int w, Qt::TransformationMode mode) const
if (w <= 0)
return QPixmap();
+ Q_TRACE_SCOPE(QPixmap_scaledToWidth, w, mode);
+
qreal factor = (qreal) w / width();
QTransform wm = QTransform::fromScale(factor, factor);
return transformed(wm, mode);
@@ -1192,7 +1103,7 @@ QPixmap QPixmap::scaledToWidth(int w, Qt::TransformationMode mode) const
\sa isNull(), {QPixmap#Pixmap Transformations}{Pixmap
Transformations}
*/
-QPixmap QPixmap::scaledToHeight(int h, Qt::TransformationMode mode) const
+QPixmap Q_TRACE_INSTRUMENT(qtgui) QPixmap::scaledToHeight(int h, Qt::TransformationMode mode) const
{
if (isNull()) {
qWarning("QPixmap::scaleHeight: Pixmap is a null pixmap");
@@ -1201,6 +1112,8 @@ QPixmap QPixmap::scaledToHeight(int h, Qt::TransformationMode mode) const
if (h <= 0)
return QPixmap();
+ Q_TRACE_SCOPE(QPixmap_scaledToHeight, h, mode);
+
qreal factor = (qreal) h / height();
QTransform wm = QTransform::fromScale(factor, factor);
return transformed(wm, mode);
@@ -1234,24 +1147,6 @@ QPixmap QPixmap::transformed(const QTransform &transform,
}
/*!
- \overload
-
- This convenience function loads the \a matrix into a
- QTransform and calls the overloaded function.
- */
-QPixmap QPixmap::transformed(const QMatrix &matrix, Qt::TransformationMode mode) const
-{
- return transformed(QTransform(matrix), mode);
-}
-
-
-
-
-
-
-
-
-/*!
\class QPixmap
\inmodule QtGui
@@ -1385,8 +1280,9 @@ QPixmap QPixmap::transformed(const QMatrix &matrix, Qt::TransformationMode mode)
QPixmap using the fromImage(). If this is too expensive an
operation, you can use QBitmap::fromImage() instead.
- To convert a QPixmap to and from HICON you can use the QtWinExtras
- functions QtWin::toHICON() and QtWin::fromHICON() respectively.
+ To convert a QPixmap to and from HICON you can use the
+ QImage::toHICON() and QImage::fromHICON() functions respectively
+ (after converting the QPixmap to a QImage, as explained above).
\section1 Pixmap Transformations
@@ -1515,7 +1411,7 @@ void QPixmap::detach()
return;
// QPixmap.data member may be QRuntimePlatformPixmap so use handle() function to get
- // the actual underlaying runtime pixmap data.
+ // the actual underlying runtime pixmap data.
QPlatformPixmap *pd = handle();
QPlatformPixmap::ClassId id = pd->classId();
if (id == QPlatformPixmap::RasterClass) {
@@ -1557,9 +1453,9 @@ QPixmap QPixmap::fromImage(const QImage &image, Qt::ImageConversionFlags flags)
return QPixmap();
}
- QScopedPointer<QPlatformPixmap> data(QGuiApplicationPrivate::platformIntegration()->createPlatformPixmap(QPlatformPixmap::PixmapType));
+ std::unique_ptr<QPlatformPixmap> data(QGuiApplicationPrivate::platformIntegration()->createPlatformPixmap(QPlatformPixmap::PixmapType));
data->fromImage(image, flags);
- return QPixmap(data.take());
+ return QPixmap(data.release());
}
/*!
@@ -1584,9 +1480,9 @@ QPixmap QPixmap::fromImageInPlace(QImage &image, Qt::ImageConversionFlags flags)
return QPixmap();
}
- QScopedPointer<QPlatformPixmap> data(QGuiApplicationPrivate::platformIntegration()->createPlatformPixmap(QPlatformPixmap::PixmapType));
+ std::unique_ptr<QPlatformPixmap> data(QGuiApplicationPrivate::platformIntegration()->createPlatformPixmap(QPlatformPixmap::PixmapType));
data->fromImageInPlace(image, flags);
- return QPixmap(data.take());
+ return QPixmap(data.release());
}
/*!
@@ -1608,67 +1504,11 @@ QPixmap QPixmap::fromImageReader(QImageReader *imageReader, Qt::ImageConversionF
return QPixmap();
}
- QScopedPointer<QPlatformPixmap> data(QGuiApplicationPrivate::platformIntegration()->createPlatformPixmap(QPlatformPixmap::PixmapType));
+ std::unique_ptr<QPlatformPixmap> data(QGuiApplicationPrivate::platformIntegration()->createPlatformPixmap(QPlatformPixmap::PixmapType));
data->fromImageReader(imageReader, flags);
- return QPixmap(data.take());
+ return QPixmap(data.release());
}
-#if QT_DEPRECATED_SINCE(5, 13)
-/*!
- \fn QPixmap QPixmap::grabWindow(WId window, int x, int y, int
- width, int height)
-
- Creates and returns a pixmap constructed by grabbing the contents
- of the given \a window restricted by QRect(\a x, \a y, \a width,
- \a height).
-
- The arguments (\a{x}, \a{y}) specify the offset in the window,
- whereas (\a{width}, \a{height}) specify the area to be copied. If
- \a width is negative, the function copies everything to the right
- border of the window. If \a height is negative, the function
- copies everything to the bottom of the window.
-
- The window system identifier (\c WId) can be retrieved using the
- QWidget::winId() function. The rationale for using a window
- identifier and not a QWidget, is to enable grabbing of windows
- that are not part of the application, window system frames, and so
- on.
-
- The grabWindow() function grabs pixels from the screen, not from
- the window, i.e. if there is another window partially or entirely
- over the one you grab, you get pixels from the overlying window,
- too. The mouse cursor is generally not grabbed.
-
- Note on X11 that if the given \a window doesn't have the same depth
- as the root window, and another window partially or entirely
- obscures the one you grab, you will \e not get pixels from the
- overlying window. The contents of the obscured areas in the
- pixmap will be undefined and uninitialized.
-
- On Windows Vista and above grabbing a layered window, which is
- created by setting the Qt::WA_TranslucentBackground attribute, will
- not work. Instead grabbing the desktop widget should work.
-
- \warning In general, grabbing an area outside the screen is not
- safe. This depends on the underlying window system.
-
- \warning The function is deprecated in Qt 5.0 since there might be
- platform plugins in which window system identifiers (\c WId)
- are local to a screen. Use QScreen::grabWindow() instead.
-
- \sa grabWidget(), {Screenshot Example}
- \sa QScreen
- \deprecated
-*/
-
-QPixmap QPixmap::grabWindow(WId window, int x, int y, int w, int h)
-{
- qWarning("this function is deprecated, use QScreen::grabWindow() instead."
- " Defaulting to primary screen.");
- return QGuiApplication::primaryScreen()->grabWindow(window, x, y, w, h);
-}
-#endif
-
/*!
\internal
*/
@@ -1696,16 +1536,4 @@ QDebug operator<<(QDebug dbg, const QPixmap &r)
}
#endif
-/*!
- \fn QPixmap QPixmap::alphaChannel() const
-
- Most use cases for this can be achieved using a QPainter and QPainter::CompositionMode instead.
-*/
-
-/*!
- \fn void QPixmap::setAlphaChannel(const QPixmap &p)
-
- Most use cases for this can be achieved using \a p with QPainter and QPainter::CompositionMode instead.
-*/
-
QT_END_NAMESPACE
diff --git a/src/gui/image/qpixmap.h b/src/gui/image/qpixmap.h
index 8c1395857e..5be98be14d 100644
--- a/src/gui/image/qpixmap.h
+++ b/src/gui/image/qpixmap.h
@@ -1,41 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the QtGui module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#ifndef QPIXMAP_H
#define QPIXMAP_H
@@ -44,8 +8,8 @@
#include <QtGui/qpaintdevice.h>
#include <QtGui/qcolor.h>
#include <QtCore/qnamespace.h>
+#include <QtCore/qshareddata.h>
#include <QtCore/qstring.h> // char*->QString conversion
-#include <QtCore/qsharedpointer.h>
#include <QtGui/qimage.h>
#include <QtGui/qtransform.h>
@@ -57,6 +21,7 @@ class QImageReader;
class QColor;
class QVariant;
class QPlatformPixmap;
+QT_DECLARE_QESDP_SPECIALIZATION_DTOR_WITH_EXPORT(QPlatformPixmap, Q_GUI_EXPORT)
class Q_GUI_EXPORT QPixmap : public QPaintDevice
{
@@ -70,13 +35,15 @@ public:
explicit QPixmap(const char * const xpm[]);
#endif
QPixmap(const QPixmap &);
+ QPixmap(QPixmap &&other) noexcept : QPaintDevice(), data(std::move(other.data)) {}
~QPixmap();
QPixmap &operator=(const QPixmap &);
- inline QPixmap &operator=(QPixmap &&other) noexcept
- { qSwap(data, other.data); return *this; }
+ QT_MOVE_ASSIGNMENT_OPERATOR_IMPL_VIA_MOVE_AND_SWAP(QPixmap)
inline void swap(QPixmap &other) noexcept
- { qSwap(data, other.data); }
+ { data.swap(other.data); }
+ bool operator==(const QPixmap &) const = delete;
+ bool operator!=(const QPixmap &) const = delete;
operator QVariant() const;
@@ -92,18 +59,13 @@ public:
static int defaultDepth();
void fill(const QColor &fillColor = Qt::white);
-#if QT_DEPRECATED_SINCE(5, 13)
- QT_DEPRECATED_X("Use QPainter or fill(QColor)")
- void fill(const QPaintDevice *device, const QPoint &ofs);
- QT_DEPRECATED_X("Use QPainter or fill(QColor)")
- void fill(const QPaintDevice *device, int xofs, int yofs);
-#endif
QBitmap mask() const;
void setMask(const QBitmap &);
qreal devicePixelRatio() const;
void setDevicePixelRatio(qreal scaleFactor);
+ QSizeF deviceIndependentSize() const;
bool hasAlpha() const;
bool hasAlphaChannel() const;
@@ -113,15 +75,6 @@ public:
#endif
QBitmap createMaskFromColor(const QColor &maskColor, Qt::MaskMode mode = Qt::MaskInColor) const;
-#if QT_DEPRECATED_SINCE(5, 13)
- QT_DEPRECATED_X("Use QScreen::grabWindow() instead")
- static QPixmap grabWindow(WId, int x = 0, int y = 0, int w = -1, int h = -1);
- QT_DEPRECATED_X("Use QWidget::grab() instead")
- static QPixmap grabWidget(QObject *widget, const QRect &rect);
- QT_DEPRECATED_X("Use QWidget::grab() instead")
- static QPixmap grabWidget(QObject *widget, int x = 0, int y = 0, int w = -1, int h = -1);
-#endif
-
inline QPixmap scaled(int w, int h, Qt::AspectRatioMode aspectMode = Qt::IgnoreAspectRatio,
Qt::TransformationMode mode = Qt::FastTransformation) const
{ return scaled(QSize(w, h), aspectMode, mode); }
@@ -129,8 +82,6 @@ public:
Qt::TransformationMode mode = Qt::FastTransformation) const;
QPixmap scaledToWidth(int w, Qt::TransformationMode mode = Qt::FastTransformation) const;
QPixmap scaledToHeight(int h, Qt::TransformationMode mode = Qt::FastTransformation) const;
- QPixmap transformed(const QMatrix &, Qt::TransformationMode mode = Qt::FastTransformation) const;
- static QMatrix trueMatrix(const QMatrix &m, int w, int h);
QPixmap transformed(const QTransform &, Qt::TransformationMode mode = Qt::FastTransformation) const;
static QTransform trueMatrix(const QTransform &m, int w, int h);
@@ -156,9 +107,6 @@ public:
inline void scroll(int dx, int dy, int x, int y, int width, int height, QRegion *exposed = nullptr);
void scroll(int dx, int dy, const QRect &rect, QRegion *exposed = nullptr);
-#if QT_DEPRECATED_SINCE(5, 0)
- QT_DEPRECATED inline int serialNumber() const { return cacheKey() >> 32; }
-#endif
qint64 cacheKey() const;
bool isDetached() const;
@@ -170,11 +118,6 @@ public:
inline bool operator!() const { return isNull(); }
-#if QT_DEPRECATED_SINCE(5, 0)
- QT_DEPRECATED inline QPixmap alphaChannel() const;
- QT_DEPRECATED inline void setAlphaChannel(const QPixmap &);
-#endif
-
protected:
int metric(PaintDeviceMetric) const override;
static QPixmap fromImageInPlace(QImage &image, Qt::ImageConversionFlags flags = Qt::AutoColor);
@@ -186,7 +129,6 @@ private:
QPixmap(const QSize &s, int type);
void doInit(int, int, int);
- Q_DUMMY_COMPARISON_OPERATOR(QPixmap)
friend class QPlatformPixmap;
friend class QBitmap;
friend class QPaintDevice;
@@ -221,23 +163,9 @@ inline void QPixmap::scroll(int dx, int dy, int ax, int ay, int awidth, int ahei
inline bool QPixmap::loadFromData(const QByteArray &buf, const char *format,
Qt::ImageConversionFlags flags)
{
- return loadFromData(reinterpret_cast<const uchar *>(buf.constData()), buf.size(), format, flags);
+ return loadFromData(reinterpret_cast<const uchar *>(buf.constData()), uint(buf.size()), format, flags);
}
-#if QT_DEPRECATED_SINCE(5, 0)
-inline QPixmap QPixmap::alphaChannel() const
-{
- return QPixmap::fromImage(toImage().alphaChannel());
-}
-
-inline void QPixmap::setAlphaChannel(const QPixmap &p)
-{
- QImage image = toImage();
- image.setAlphaChannel(p.toImage());
- *this = QPixmap::fromImage(image);
-
-}
-#endif
/*****************************************************************************
QPixmap stream functions
diff --git a/src/gui/image/qpixmap_blitter.cpp b/src/gui/image/qpixmap_blitter.cpp
index aeed1e3b34..41563bf380 100644
--- a/src/gui/image/qpixmap_blitter.cpp
+++ b/src/gui/image/qpixmap_blitter.cpp
@@ -1,41 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the QtGui module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#include "qpixmap_blitter_p.h"
@@ -260,7 +224,7 @@ void QBlittablePlatformPixmap::markRasterOverlayImpl(const QRectF &rect)
if (!showRasterOverlay)
return;
QRectF transformationRect = clipAndTransformRect(rect);
- if(!transformationRect.isEmpty()) {
+ if (!transformationRect.isEmpty()) {
QPainter p(overlay());
p.setBrush(m_overlayColor);
p.setCompositionMode(QPainter::CompositionMode_Source);
diff --git a/src/gui/image/qpixmap_blitter_p.h b/src/gui/image/qpixmap_blitter_p.h
index d70cbcdcc3..89928026a2 100644
--- a/src/gui/image/qpixmap_blitter_p.h
+++ b/src/gui/image/qpixmap_blitter_p.h
@@ -1,41 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the QtGui module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#ifndef QPIXMAP_BLITTER_P_H
#define QPIXMAP_BLITTER_P_H
@@ -120,7 +84,7 @@ inline void QBlittablePlatformPixmap::markRasterOverlay(const QRectF &rect)
#ifdef QT_BLITTER_RASTEROVERLAY
markRasterOverlayImpl(rect);
#else
- Q_UNUSED(rect)
+ Q_UNUSED(rect);
#endif
}
@@ -129,7 +93,7 @@ inline void QBlittablePlatformPixmap::markRasterOverlay(const QVectorPath &path)
#ifdef QT_BLITTER_RASTEROVERLAY
markRasterOverlayImpl(path.convertToPainterPath().boundingRect());
#else
- Q_UNUSED(path)
+ Q_UNUSED(path);
#endif
}
@@ -141,8 +105,8 @@ inline void QBlittablePlatformPixmap::markRasterOverlay(const QPointF &pos, cons
rect.moveBottomLeft(pos);
markRasterOverlay(rect);
#else
- Q_UNUSED(pos)
- Q_UNUSED(ti)
+ Q_UNUSED(pos);
+ Q_UNUSED(ti);
#endif
}
@@ -153,8 +117,8 @@ inline void QBlittablePlatformPixmap::markRasterOverlay(const QRect *rects, int
markRasterOverlay(rects[i]);
}
#else
- Q_UNUSED(rects)
- Q_UNUSED(rectCount)
+ Q_UNUSED(rects);
+ Q_UNUSED(rectCount);
#endif
}
inline void QBlittablePlatformPixmap::markRasterOverlay(const QRectF *rects, int rectCount)
@@ -164,8 +128,8 @@ inline void QBlittablePlatformPixmap::markRasterOverlay(const QRectF *rects, int
markRasterOverlay(rects[i]);
}
#else
- Q_UNUSED(rects)
- Q_UNUSED(rectCount)
+ Q_UNUSED(rects);
+ Q_UNUSED(rectCount);
#endif
}
@@ -203,7 +167,7 @@ inline void QBlittablePlatformPixmap::unmarkRasterOverlay(const QRectF &rect)
#ifdef QT_BLITTER_RASTEROVERLAY
unmarkRasterOverlayImpl(rect);
#else
- Q_UNUSED(rect)
+ Q_UNUSED(rect);
#endif
}
diff --git a/src/gui/image/qpixmap_raster.cpp b/src/gui/image/qpixmap_raster.cpp
index 2732bbd197..6e10bdd562 100644
--- a/src/gui/image/qpixmap_raster.cpp
+++ b/src/gui/image/qpixmap_raster.cpp
@@ -1,41 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the QtGui module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#include "qpixmap.h"
diff --git a/src/gui/image/qpixmap_raster_p.h b/src/gui/image/qpixmap_raster_p.h
index fe2a1e581d..5f5c117002 100644
--- a/src/gui/image/qpixmap_raster_p.h
+++ b/src/gui/image/qpixmap_raster_p.h
@@ -1,41 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the QtGui module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#ifndef QPIXMAP_RASTER_P_H
#define QPIXMAP_RASTER_P_H
diff --git a/src/gui/image/qpixmap_win.cpp b/src/gui/image/qpixmap_win.cpp
index 8aad77b991..fc601bccfc 100644
--- a/src/gui/image/qpixmap_win.cpp
+++ b/src/gui/image/qpixmap_win.cpp
@@ -1,44 +1,9 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the QtGui module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#include "qbitmap.h"
#include "qpixmap.h"
+#include <private/qpixmap_win_p.h>
#include <qpa/qplatformpixmap.h>
#include "qpixmap_raster_p.h"
@@ -121,7 +86,7 @@ static inline void copyImageDataCreateAlpha(const uchar *data, QImage *target)
const uint mask = target->format() == QImage::Format_RGB32 ? 0xff000000 : 0;
const int height = target->height();
const int width = target->width();
- const int bytesPerLine = width * int(sizeof(QRgb));
+ const qsizetype bytesPerLine = width * sizeof(QRgb);
for (int y = 0; y < height; ++y) {
QRgb *dest = reinterpret_cast<QRgb *>(target->scanLine(y));
const QRgb *src = reinterpret_cast<const QRgb *>(data + y * bytesPerLine);
@@ -181,7 +146,7 @@ static QImage copyImageData(const BITMAPINFOHEADER &header, const RGBQUAD *color
}
if (colorTableSize) {
Q_ASSERT(colorTableIn);
- QVector<QRgb> colorTable;
+ QList<QRgb> colorTable;
colorTable.reserve(colorTableSize);
std::transform(colorTableIn, colorTableIn + colorTableSize,
std::back_inserter(colorTable), rgbQuadToQRgb);
@@ -199,7 +164,7 @@ static QImage copyImageData(const BITMAPINFOHEADER &header, const RGBQUAD *color
Q_ASSERT(DWORD(image.sizeInBytes()) == header.biSizeImage);
memcpy(image.bits(), data, header.biSizeImage);
if (format == QImage::Format_RGB888)
- image = image.rgbSwapped();
+ image = std::move(image).rgbSwapped();
break;
default:
Q_UNREACHABLE();
@@ -228,9 +193,9 @@ enum HBitmapFormat
HBitmapAlpha
};
-Q_GUI_EXPORT HBITMAP qt_createIconMask(const QBitmap &bitmap)
+static HBITMAP qt_createIconMask(QImage bm)
{
- QImage bm = bitmap.toImage().convertToFormat(QImage::Format_Mono);
+ Q_ASSERT(bm.format() == QImage::Format_Mono);
const int w = bm.width();
const int h = bm.height();
const int bpl = ((w+15)/16)*2; // bpl, 16 bit alignment
@@ -242,6 +207,11 @@ Q_GUI_EXPORT HBITMAP qt_createIconMask(const QBitmap &bitmap)
return hbm;
}
+HBITMAP qt_createIconMask(const QBitmap &bitmap)
+{
+ return qt_createIconMask(bitmap.toImage().convertToFormat(QImage::Format_Mono));
+}
+
static inline QImage::Format format32(int hbitmapFormat)
{
switch (hbitmapFormat) {
@@ -255,7 +225,7 @@ static inline QImage::Format format32(int hbitmapFormat)
return QImage::Format_ARGB32_Premultiplied;
}
-Q_GUI_EXPORT HBITMAP qt_imageToWinHBITMAP(const QImage &imageIn, int hbitmapFormat = 0)
+HBITMAP qt_imageToWinHBITMAP(const QImage &imageIn, int hbitmapFormat)
{
if (imageIn.isNull())
return nullptr;
@@ -335,6 +305,7 @@ Q_GUI_EXPORT HBITMAP qt_imageToWinHBITMAP(const QImage &imageIn, int hbitmapForm
return nullptr;
}
if (!pixels) {
+ DeleteObject(bitmap);
qErrnoWarning("%s, did not allocate pixel data", __FUNCTION__);
return nullptr;
}
@@ -344,7 +315,44 @@ Q_GUI_EXPORT HBITMAP qt_imageToWinHBITMAP(const QImage &imageIn, int hbitmapForm
return bitmap;
}
-Q_GUI_EXPORT HBITMAP qt_pixmapToWinHBITMAP(const QPixmap &p, int hbitmapFormat = 0)
+/*!
+ \since 6.0
+
+ \brief Creates a \c HBITMAP equivalent of the QImage.
+
+ Returns the \c HBITMAP handle.
+
+ It is the caller's responsibility to free the \c HBITMAP data
+ after use.
+
+ For usage with standard GDI calls, such as \c BitBlt(), the image
+ should have the format QImage::Format_RGB32.
+
+ When using the resulting HBITMAP for the \c AlphaBlend() GDI function,
+ the image should have the format QImage::Format_ARGB32_Premultiplied
+ (use convertToFormat()).
+
+ When using the resulting HBITMAP as application icon or a systray icon,
+ the image should have the format QImage::Format_ARGB32.
+
+ \ingroup platform-type-conversions
+
+ \sa fromHBITMAP(), convertToFormat()
+*/
+HBITMAP QImage::toHBITMAP() const
+{
+ switch (format()) {
+ case QImage::Format_ARGB32:
+ return qt_imageToWinHBITMAP(*this, HBitmapAlpha);
+ case QImage::Format_ARGB32_Premultiplied:
+ return qt_imageToWinHBITMAP(*this, HBitmapPremultipliedAlpha);
+ default:
+ break;
+ }
+ return qt_imageToWinHBITMAP(*this);
+}
+
+HBITMAP qt_pixmapToWinHBITMAP(const QPixmap &p, int hbitmapFormat)
{
if (p.isNull())
return nullptr;
@@ -443,7 +451,7 @@ static QImage imageFromWinHBITMAP_GetDiBits(HBITMAP bitmap, bool forceQuads, int
return copyImageData(info.bmiHeader, bmiColorTable256.bmiColors, data.data(), imageFormat);
}
-Q_GUI_EXPORT QImage qt_imageFromWinHBITMAP(HBITMAP bitmap, int hbitmapFormat = 0)
+QImage qt_imageFromWinHBITMAP(HBITMAP bitmap, int hbitmapFormat)
{
QImage result = imageFromWinHBITMAP_DibSection(bitmap, hbitmapFormat);
if (result.isNull())
@@ -451,26 +459,70 @@ Q_GUI_EXPORT QImage qt_imageFromWinHBITMAP(HBITMAP bitmap, int hbitmapFormat = 0
return result;
}
-Q_GUI_EXPORT QPixmap qt_pixmapFromWinHBITMAP(HBITMAP bitmap, int hbitmapFormat = 0)
+/*!
+ \since 6.0
+
+ \brief Returns a QImage that is equivalent to the given \a hbitmap.
+
+ HBITMAP does not store information about the alpha channel.
+
+ In the standard case, the alpha channel is ignored and a fully
+ opaque image is created (typically of format QImage::Format_RGB32).
+
+ There are cases where the alpha channel is used, though, for example
+ for application icon or systray icons. In that case,
+ \c reinterpretAsFormat(QImage::Format_ARGB32) should be called
+ on the returned image to ensure the format is correct.
+
+ \ingroup platform-type-conversions
+
+ \sa toHBITMAP(), reinterpretAsFormat()
+*/
+QImage QImage::fromHBITMAP(HBITMAP hbitmap)
+{
+ return qt_imageFromWinHBITMAP(hbitmap);
+}
+
+QPixmap qt_pixmapFromWinHBITMAP(HBITMAP bitmap, int hbitmapFormat)
{
return QPixmap::fromImage(imageFromWinHBITMAP_GetDiBits(bitmap, /* forceQuads */ true, hbitmapFormat));
}
-Q_GUI_EXPORT HICON qt_pixmapToWinHICON(const QPixmap &p)
+/*!
+ \since 6.0
+
+ \brief Creates a \c HICON equivalent of the QPixmap, applying the mask
+ \a mask.
+
+ If \a mask is not null, it needs to be of format QImage::Format_Mono.
+ Returns the \c HICON handle.
+
+ It is the caller's responsibility to free the \c HICON data after use.
+
+ \ingroup platform-type-conversions
+
+ \sa fromHICON()
+*/
+HICON QImage::toHICON(const QImage &mask) const
{
- if (p.isNull())
+ if (!mask.isNull() && mask.format() != QImage::Format_Mono) {
+ qWarning("QImage::toHICON(): Mask must be empty or have format Format_Mono");
return nullptr;
+ }
- QBitmap maskBitmap = p.mask();
- if (maskBitmap.isNull()) {
- maskBitmap = QBitmap(p.size());
- maskBitmap.fill(Qt::color1);
+ if (isNull())
+ return nullptr;
+
+ auto effectiveMask = mask;
+ if (effectiveMask.isNull()) {
+ effectiveMask = QImage(size(), QImage::Format_Mono);
+ effectiveMask.fill(Qt::color1);
}
ICONINFO ii;
ii.fIcon = true;
- ii.hbmMask = qt_createIconMask(maskBitmap);
- ii.hbmColor = qt_pixmapToWinHBITMAP(p, HBitmapAlpha);
+ ii.hbmMask = qt_createIconMask(effectiveMask);
+ ii.hbmColor = qt_imageToWinHBITMAP(*this, HBitmapAlpha);
ii.xHotspot = 0;
ii.yHotspot = 0;
@@ -482,7 +534,16 @@ Q_GUI_EXPORT HICON qt_pixmapToWinHICON(const QPixmap &p)
return hIcon;
}
-Q_GUI_EXPORT QImage qt_imageFromWinHBITMAP(HDC hdc, HBITMAP bitmap, int w, int h)
+HICON qt_pixmapToWinHICON(const QPixmap &p)
+{
+ QImage mask;
+ QBitmap maskBitmap = p.mask();
+ if (!maskBitmap.isNull())
+ mask = maskBitmap.toImage().convertToFormat(QImage::Format_Mono);
+ return p.toImage().toHICON(mask);
+}
+
+QImage qt_imageFromWinHBITMAP(HDC hdc, HBITMAP bitmap, int w, int h)
{
QImage image(w, h, QImage::Format_ARGB32_Premultiplied);
if (image.isNull())
@@ -520,7 +581,16 @@ static inline bool hasAlpha(const QImage &image)
return false;
}
-Q_GUI_EXPORT QPixmap qt_pixmapFromWinHICON(HICON icon)
+/*!
+ \since 6.0
+
+ \brief Returns a QImage that is equivalent to the given \a icon.
+
+ \ingroup platform-type-conversions
+
+ \sa toHICON()
+*/
+QImage QImage::fromHICON(HICON icon)
{
HDC screenDevice = GetDC(nullptr);
HDC hdc = CreateCompatibleDC(screenDevice);
@@ -531,7 +601,7 @@ Q_GUI_EXPORT QPixmap qt_pixmapFromWinHICON(HICON icon)
if (!result) {
qErrnoWarning("QPixmap::fromWinHICON(), failed to GetIconInfo()");
DeleteDC(hdc);
- return QPixmap();
+ return {};
}
const int w = int(iconinfo.xHotspot) * 2;
@@ -570,7 +640,12 @@ Q_GUI_EXPORT QPixmap qt_pixmapFromWinHICON(HICON icon)
SelectObject(hdc, oldhdc); //restore state
DeleteObject(winBitmap);
DeleteDC(hdc);
- return QPixmap::fromImage(std::move(image));
+ return image;
+}
+
+QPixmap qt_pixmapFromWinHICON(HICON icon)
+{
+ return QPixmap::fromImage(QImage::fromHICON(icon));
}
QT_END_NAMESPACE
diff --git a/src/gui/image/qpixmap_win_p.h b/src/gui/image/qpixmap_win_p.h
new file mode 100644
index 0000000000..64abca3428
--- /dev/null
+++ b/src/gui/image/qpixmap_win_p.h
@@ -0,0 +1,38 @@
+// Copyright (C) 2023 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
+
+#ifndef QPIXMAP_WIN_P_H
+#define QPIXMAP_WIN_P_H
+
+//
+// W A R N I N G
+// -------------
+//
+// This file is not part of the Qt API. It exists purely as an
+// implementation detail. This header file may change from version to
+// version without notice, or even be removed.
+//
+// We mean it.
+//
+
+#include <QtGui/private/qtguiglobal_p.h>
+#include <QtCore/qt_windows.h>
+
+QT_BEGIN_NAMESPACE
+
+class QBitmap;
+class QImage;
+class QPixmap;
+
+Q_GUI_EXPORT HBITMAP qt_createIconMask(const QBitmap &bitmap);
+Q_GUI_EXPORT HBITMAP qt_imageToWinHBITMAP(const QImage &imageIn, int hbitmapFormat = 0);
+Q_GUI_EXPORT HBITMAP qt_pixmapToWinHBITMAP(const QPixmap &p, int hbitmapFormat = 0);
+Q_GUI_EXPORT QImage qt_imageFromWinHBITMAP(HBITMAP bitmap, int hbitmapFormat = 0);
+Q_GUI_EXPORT QPixmap qt_pixmapFromWinHBITMAP(HBITMAP bitmap, int hbitmapFormat = 0);
+Q_GUI_EXPORT HICON qt_pixmapToWinHICON(const QPixmap &p);
+Q_GUI_EXPORT QImage qt_imageFromWinHBITMAP(HDC hdc, HBITMAP bitmap, int w, int h);
+Q_GUI_EXPORT QPixmap qt_pixmapFromWinHICON(HICON icon);
+
+QT_END_NAMESPACE
+
+#endif // QPIXMAP_WIN_P_H
diff --git a/src/gui/image/qpixmapcache.cpp b/src/gui/image/qpixmapcache.cpp
index 9709df9e0c..45c9743f93 100644
--- a/src/gui/image/qpixmapcache.cpp
+++ b/src/gui/image/qpixmapcache.cpp
@@ -1,43 +1,6 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the QtGui module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#define Q_TEST_QPIXMAPCACHE
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
+
#include "qpixmapcache.h"
#include "qobject.h"
#include "qdebug.h"
@@ -45,6 +8,8 @@
#include "qthread.h"
#include "qcoreapplication.h"
+using namespace std::chrono_literals;
+
QT_BEGIN_NAMESPACE
/*!
@@ -93,14 +58,14 @@ QT_BEGIN_NAMESPACE
static const int cache_limit_default = 10240; // 10 MB cache limit
-static inline int cost(const QPixmap &pixmap)
+static inline qsizetype cost(const QPixmap &pixmap)
{
- // make sure to do a 64bit calculation
- const qint64 costKb = static_cast<qint64>(pixmap.width()) *
- pixmap.height() * pixmap.depth() / (8 * 1024);
- const qint64 costMax = std::numeric_limits<int>::max();
+ // make sure to do a 64bit calculation; qsizetype might be smaller
+ const qint64 costKb = static_cast<qint64>(pixmap.width())
+ * pixmap.height() * pixmap.depth() / (8 * 1024);
+ const qint64 costMax = std::numeric_limits<qsizetype>::max();
// a small pixmap should have at least a cost of 1(kb)
- return static_cast<int>(qBound(1LL, costKb, costMax));
+ return static_cast<qsizetype>(qBound(1LL, costKb, costMax));
}
static inline bool qt_pixmapcache_thread_test()
@@ -219,7 +184,6 @@ public:
void timerEvent(QTimerEvent *) override;
bool insert(const QString& key, const QPixmap &pixmap, int cost);
QPixmapCache::Key insert(const QPixmap &pixmap, int cost);
- bool replace(const QPixmapCache::Key &key, const QPixmap &pixmap, int cost);
bool remove(const QString &key);
bool remove(const QPixmapCache::Key &key);
@@ -239,7 +203,8 @@ public:
bool flushDetachedPixmaps(bool nt);
private:
- enum { soon_time = 10000, flush_time = 30000 };
+ static constexpr auto soon_time = 10s;
+ static constexpr auto flush_time = 30s;
int *keyArray;
int theid;
int ps;
@@ -253,9 +218,15 @@ QT_BEGIN_INCLUDE_NAMESPACE
#include "qpixmapcache.moc"
QT_END_INCLUDE_NAMESPACE
-uint qHash(const QPixmapCache::Key &k)
+/*!
+ size_t QPixmapCache::qHash(const Key &key, size_t seed = 0);
+ \since 6.6
+
+ Returns the hash value for the \a key, using \a seed to seed the calculation.
+*/
+size_t QPixmapCache::Key::hash(size_t seed) const noexcept
{
- return qHash(QPMCache::get(k)->key);
+ return qHash(this->d ? this->d->key : 0, seed);
}
QPMCache::QPMCache()
@@ -286,24 +257,14 @@ QPMCache::~QPMCache()
*/
bool QPMCache::flushDetachedPixmaps(bool nt)
{
- int mc = maxCost();
- setMaxCost(nt ? totalCost() * 3 / 4 : totalCost() -1);
+ auto mc = maxCost();
+ const qsizetype currentTotal = totalCost();
+ const qsizetype oldSize = size();
+ if (currentTotal)
+ setMaxCost(nt ? currentTotal * 3 / 4 : currentTotal - 1);
setMaxCost(mc);
ps = totalCost();
-
- bool any = false;
- QHash<QString, QPixmapCache::Key>::iterator it = cacheKeys.begin();
- while (it != cacheKeys.end()) {
- if (!contains(it.value())) {
- releaseKey(it.value());
- it = cacheKeys.erase(it);
- any = true;
- } else {
- ++it;
- }
- }
-
- return any;
+ return size() != oldSize;
}
void QPMCache::timerEvent(QTimerEvent *)
@@ -322,22 +283,14 @@ void QPMCache::timerEvent(QTimerEvent *)
QPixmap *QPMCache::object(const QString &key) const
{
- QPixmapCache::Key cacheKey = cacheKeys.value(key);
- if (!cacheKey.d || !cacheKey.d->isValid) {
- const_cast<QPMCache *>(this)->cacheKeys.remove(key);
- return nullptr;
- }
- QPixmap *ptr = QCache<QPixmapCache::Key, QPixmapCacheEntry>::object(cacheKey);
- //We didn't find the pixmap in the cache, the key is not valid anymore
- if (!ptr) {
- const_cast<QPMCache *>(this)->cacheKeys.remove(key);
- }
- return ptr;
+ if (const auto it = cacheKeys.find(key); it != cacheKeys.cend())
+ return object(it.value());
+ return nullptr;
}
QPixmap *QPMCache::object(const QPixmapCache::Key &key) const
{
- Q_ASSERT(key.d->isValid);
+ Q_ASSERT(key.isValid());
QPixmap *ptr = QCache<QPixmapCache::Key, QPixmapCacheEntry>::object(key);
//We didn't find the pixmap in the cache, the key is not valid anymore
if (!ptr)
@@ -347,31 +300,24 @@ QPixmap *QPMCache::object(const QPixmapCache::Key &key) const
bool QPMCache::insert(const QString& key, const QPixmap &pixmap, int cost)
{
- QPixmapCache::Key &cacheKey = cacheKeys[key];
//If for the same key we add already a pixmap we should delete it
- if (cacheKey.d)
- QCache<QPixmapCache::Key, QPixmapCacheEntry>::remove(cacheKey);
-
- //we create a new key the old one has been removed
- cacheKey = createKey();
+ remove(key);
- bool success = QCache<QPixmapCache::Key, QPixmapCacheEntry>::insert(cacheKey, new QPixmapCacheEntry(cacheKey, pixmap), cost);
- if (success) {
- if (!theid) {
- theid = startTimer(flush_time);
- t = false;
- }
- } else {
- //Insertion failed we released the new allocated key
- cacheKeys.remove(key);
+ // this will create a new key; the old one has been removed
+ auto k = insert(pixmap, cost);
+ if (k.isValid()) {
+ k.d->stringKey = key;
+ cacheKeys[key] = std::move(k);
+ return true;
}
- return success;
+ return false;
}
QPixmapCache::Key QPMCache::insert(const QPixmap &pixmap, int cost)
{
- QPixmapCache::Key cacheKey = createKey();
+ QPixmapCache::Key cacheKey = createKey(); // invalidated by ~QPixmapCacheEntry on failed insert
bool success = QCache<QPixmapCache::Key, QPixmapCacheEntry>::insert(cacheKey, new QPixmapCacheEntry(cacheKey, pixmap), cost);
+ Q_ASSERT(success || !cacheKey.isValid());
if (success) {
if (!theid) {
theid = startTimer(flush_time);
@@ -381,34 +327,10 @@ QPixmapCache::Key QPMCache::insert(const QPixmap &pixmap, int cost)
return cacheKey;
}
-bool QPMCache::replace(const QPixmapCache::Key &key, const QPixmap &pixmap, int cost)
-{
- Q_ASSERT(key.d->isValid);
- //If for the same key we had already an entry so we should delete the pixmap and use the new one
- QCache<QPixmapCache::Key, QPixmapCacheEntry>::remove(key);
-
- QPixmapCache::Key cacheKey = createKey();
-
- bool success = QCache<QPixmapCache::Key, QPixmapCacheEntry>::insert(cacheKey, new QPixmapCacheEntry(cacheKey, pixmap), cost);
- if (success) {
- if(!theid) {
- theid = startTimer(flush_time);
- t = false;
- }
- const_cast<QPixmapCache::Key&>(key) = cacheKey;
- }
- return success;
-}
-
bool QPMCache::remove(const QString &key)
{
- auto cacheKey = cacheKeys.constFind(key);
- //The key was not in the cache
- if (cacheKey == cacheKeys.constEnd())
- return false;
- const bool result = QCache<QPixmapCache::Key, QPixmapCacheEntry>::remove(cacheKey.value());
- cacheKeys.erase(cacheKey);
- return result;
+ const auto cacheKey = cacheKeys.take(key);
+ return cacheKey.isValid() && remove(cacheKey);
}
bool QPMCache::remove(const QPixmapCache::Key &key)
@@ -420,7 +342,7 @@ void QPMCache::resizeKeyArray(int size)
{
if (size <= keyArraySize || size == 0)
return;
- keyArray = q_check_ptr(reinterpret_cast<int *>(realloc(keyArray,
+ keyArray = q_check_ptr(static_cast<int *>(realloc(keyArray,
size * sizeof(int))));
for (int i = keyArraySize; i != size; ++i)
keyArray[i] = i + 1;
@@ -441,13 +363,18 @@ QPixmapCache::Key QPMCache::createKey()
void QPMCache::releaseKey(const QPixmapCache::Key &key)
{
- if (key.d->key > keyArraySize || key.d->key <= 0)
+ QPixmapCache::KeyData *keyData = key.d;
+ if (!keyData)
+ return;
+ if (!keyData->stringKey.isNull())
+ cacheKeys.remove(keyData->stringKey);
+ if (keyData->key > keyArraySize || keyData->key <= 0)
return;
- key.d->key--;
- keyArray[key.d->key] = freeKey;
- freeKey = key.d->key;
- key.d->isValid = false;
- key.d->key = 0;
+ keyData->key--;
+ keyArray[keyData->key] = freeKey;
+ freeKey = keyData->key;
+ keyData->isValid = false;
+ keyData->key = 0;
}
void QPMCache::clear()
@@ -457,10 +384,17 @@ void QPMCache::clear()
freeKey = 0;
keyArraySize = 0;
//Mark all keys as invalid
- QList<QPixmapCache::Key> keys = QCache<QPixmapCache::Key, QPixmapCacheEntry>::keys();
- for (int i = 0; i < keys.size(); ++i)
- keys.at(i).d->isValid = false;
+ const QList<QPixmapCache::Key> keys = QCache<QPixmapCache::Key, QPixmapCacheEntry>::keys();
+ for (const auto &key : keys) {
+ if (key.d)
+ key.d->isValid = false;
+ }
QCache<QPixmapCache::Key, QPixmapCacheEntry>::clear();
+ // Nothing left to flush; stop the timer
+ if (theid) {
+ killTimer(theid);
+ theid = 0;
+ }
}
QPixmapCache::KeyData* QPMCache::getKeyData(QPixmapCache::Key *key)
@@ -482,45 +416,6 @@ QPixmapCacheEntry::~QPixmapCacheEntry()
pm_cache()->releaseKey(key);
}
-#if QT_DEPRECATED_SINCE(5, 13)
-/*!
- \obsolete
- \overload
-
- Use bool find(const QString &, QPixmap *) instead.
-
- Returns the pixmap associated with the \a key in the cache, or
- null if there is no such pixmap.
-
- \warning If valid, you should copy the pixmap immediately (this is
- fast). Subsequent insertions into the cache could cause the
- pointer to become invalid. For this reason, we recommend you use
- bool find(const QString&, QPixmap*) instead.
-
- Example:
- \snippet code/src_gui_image_qpixmapcache.cpp 0
-*/
-
-QPixmap *QPixmapCache::find(const QString &key)
-{
- if (!qt_pixmapcache_thread_test())
- return nullptr;
- return pm_cache()->object(key);
-}
-
-
-/*!
- \obsolete
-
- Use bool find(const QString &, QPixmap *) instead.
-*/
-
-bool QPixmapCache::find(const QString &key, QPixmap &pixmap)
-{
- return find(key, &pixmap);
-}
-#endif
-
/*!
Looks for a cached pixmap associated with the given \a key in the cache.
If the pixmap is found, the function sets \a pixmap to that pixmap and
@@ -534,7 +429,7 @@ bool QPixmapCache::find(const QString &key, QPixmap &pixmap)
bool QPixmapCache::find(const QString &key, QPixmap *pixmap)
{
- if (!qt_pixmapcache_thread_test())
+ if (key.isEmpty() || !qt_pixmapcache_thread_test())
return false;
QPixmap *ptr = pm_cache()->object(key);
if (ptr && pixmap)
@@ -586,7 +481,7 @@ bool QPixmapCache::find(const Key &key, QPixmap *pixmap)
bool QPixmapCache::insert(const QString &key, const QPixmap &pixmap)
{
- if (!qt_pixmapcache_thread_test())
+ if (key.isEmpty() || !qt_pixmapcache_thread_test())
return false;
return pm_cache()->insert(key, pixmap, cost(pixmap));
}
@@ -613,24 +508,25 @@ QPixmapCache::Key QPixmapCache::insert(const QPixmap &pixmap)
return pm_cache()->insert(pixmap, cost(pixmap));
}
+#if QT_DEPRECATED_SINCE(6, 6)
/*!
+ \fn bool QPixmapCache::replace(const Key &key, const QPixmap &pixmap)
+
+ \deprecated [6.6] Use \c{remove(key); key = insert(pixmap);} instead.
+
Replaces the pixmap associated with the given \a key with the \a pixmap
specified. Returns \c true if the \a pixmap has been correctly inserted into
the cache; otherwise returns \c false.
+ The passed \a key is updated to reference \a pixmap now. Other copies of \a
+ key, if any, still refer to the old pixmap, which is, however, removed from
+ the cache by this function.
+
\sa setCacheLimit(), insert()
\since 4.6
*/
-bool QPixmapCache::replace(const Key &key, const QPixmap &pixmap)
-{
- if (!qt_pixmapcache_thread_test())
- return false;
- //The key is not valid anymore, a flush happened before probably
- if (!key.d || !key.d->isValid)
- return false;
- return pm_cache()->replace(key, pixmap, cost(pixmap));
-}
+#endif // QT_DEPRECATED_SINCE(6, 6)
/*!
Returns the cache limit (in kilobytes).
@@ -642,6 +538,8 @@ bool QPixmapCache::replace(const Key &key, const QPixmap &pixmap)
int QPixmapCache::cacheLimit()
{
+ if (!qt_pixmapcache_thread_test())
+ return 0;
return pm_cache()->maxCost();
}
@@ -665,7 +563,7 @@ void QPixmapCache::setCacheLimit(int n)
*/
void QPixmapCache::remove(const QString &key)
{
- if (!qt_pixmapcache_thread_test())
+ if (key.isEmpty() || !qt_pixmapcache_thread_test())
return;
pm_cache()->remove(key);
}
@@ -703,13 +601,17 @@ void QPixmapCache::clear()
}
}
-void QPixmapCache::flushDetachedPixmaps()
+Q_AUTOTEST_EXPORT void qt_qpixmapcache_flush_detached_pixmaps() // for tst_qpixmapcache
{
+ if (!qt_pixmapcache_thread_test())
+ return;
pm_cache()->flushDetachedPixmaps(true);
}
-int QPixmapCache::totalUsed()
+Q_AUTOTEST_EXPORT int qt_qpixmapcache_qpixmapcache_total_used() // for tst_qpixmapcache
{
+ if (!qt_pixmapcache_thread_test())
+ return 0;
return (pm_cache()->totalCost()+1023) / 1024;
}
diff --git a/src/gui/image/qpixmapcache.h b/src/gui/image/qpixmapcache.h
index 55af35a5d9..72ee1b797f 100644
--- a/src/gui/image/qpixmapcache.h
+++ b/src/gui/image/qpixmapcache.h
@@ -1,41 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the QtGui module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#ifndef QPIXMAPCACHE_H
#define QPIXMAPCACHE_H
@@ -63,10 +27,14 @@ public:
{ return !operator==(key); }
Key &operator =(const Key &other);
- void swap(Key &other) noexcept { qSwap(d, other.d); }
+ void swap(Key &other) noexcept { qt_ptr_swap(d, other.d); }
bool isValid() const noexcept;
private:
+ friend size_t qHash(const QPixmapCache::Key &k, size_t seed = 0) noexcept
+ { return k.hash(seed); }
+ size_t hash(size_t seed) const noexcept;
+
KeyData *d;
friend class QPMCache;
friend class QPixmapCache;
@@ -74,27 +42,33 @@ public:
static int cacheLimit();
static void setCacheLimit(int);
-#if QT_DEPRECATED_SINCE(5, 13)
- QT_DEPRECATED_X("Use bool find(const QString &, QPixmap *) instead")
- static QPixmap *find(const QString &key);
- QT_DEPRECATED_X("Use bool find(const QString &, QPixmap *) instead")
- static bool find(const QString &key, QPixmap &pixmap);
-#endif
static bool find(const QString &key, QPixmap *pixmap);
static bool find(const Key &key, QPixmap *pixmap);
static bool insert(const QString &key, const QPixmap &pixmap);
static Key insert(const QPixmap &pixmap);
+#if QT_DEPRECATED_SINCE(6, 6)
+ QT_DEPRECATED_VERSION_X_6_6("Use remove(key), followed by key = insert(pixmap).")
+ QT_GUI_INLINE_SINCE(6, 6)
static bool replace(const Key &key, const QPixmap &pixmap);
+#endif
static void remove(const QString &key);
static void remove(const Key &key);
static void clear();
-
-#ifdef Q_TEST_QPIXMAPCACHE
- static void flushDetachedPixmaps();
- static int totalUsed();
-#endif
};
-Q_DECLARE_SHARED_NOT_MOVABLE_UNTIL_QT6(QPixmapCache::Key)
+Q_DECLARE_SHARED(QPixmapCache::Key)
+
+#if QT_DEPRECATED_SINCE(6, 6)
+#if QT_GUI_INLINE_IMPL_SINCE(6, 6)
+bool QPixmapCache::replace(const Key &key, const QPixmap &pixmap)
+{
+ if (!key.isValid())
+ return false;
+ remove(key);
+ const_cast<Key&>(key) = insert(pixmap);
+ return key.isValid();
+}
+#endif // QT_GUI_INLINE_IMPL_SINCE(6, 6)
+#endif // QT_DEPRECATED_SINCE(6, 6)
QT_END_NAMESPACE
diff --git a/src/gui/image/qpixmapcache_p.h b/src/gui/image/qpixmapcache_p.h
index ab8e2b7558..43c4d9784c 100644
--- a/src/gui/image/qpixmapcache_p.h
+++ b/src/gui/image/qpixmapcache_p.h
@@ -1,41 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the QtGui module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#ifndef QPIXMAPCACHE_P_H
#define QPIXMAPCACHE_P_H
@@ -59,8 +23,6 @@
QT_BEGIN_NAMESPACE
-uint qHash(const QPixmapCache::Key &k);
-
class QPixmapCache::KeyData
{
public:
@@ -69,6 +31,7 @@ public:
: isValid(other.isValid), key(other.key), ref(1) {}
~KeyData() {}
+ QString stringKey;
bool isValid;
int key;
int ref;
diff --git a/src/gui/image/qplatformpixmap.cpp b/src/gui/image/qplatformpixmap.cpp
index 493f55514e..a297736095 100644
--- a/src/gui/image/qplatformpixmap.cpp
+++ b/src/gui/image/qplatformpixmap.cpp
@@ -1,41 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the QtGui module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#include "qplatformpixmap.h"
#include <qpa/qplatformintegration.h>
@@ -83,7 +47,7 @@ QPlatformPixmap::QPlatformPixmap(PixelType pixelType, int objectId)
QPlatformPixmap::~QPlatformPixmap()
{
- // Sometimes the pixmap cleanup hooks will be called from derrived classes, which will
+ // Sometimes the pixmap cleanup hooks will be called from derived classes, which will
// then set is_cached to false. For example, on X11 Qt GUI needs to delete the GLXPixmap
// or EGL Pixmap Surface for a given pixmap _before_ the native X11 pixmap is deleted,
// otherwise some drivers will leak the GL surface. In this case, QX11PlatformPixmap will
@@ -101,10 +65,10 @@ QPlatformPixmap *QPlatformPixmap::createCompatiblePlatformPixmap() const
return d;
}
-static QImage makeBitmapCompliantIfNeeded(QPlatformPixmap *d, const QImage &image, Qt::ImageConversionFlags flags)
+static QImage makeBitmapCompliantIfNeeded(QPlatformPixmap *d, QImage image, Qt::ImageConversionFlags flags)
{
if (d->pixelType() == QPlatformPixmap::BitmapType) {
- QImage img = image.convertToFormat(QImage::Format_MonoLSB, flags);
+ QImage img = std::move(image).convertToFormat(QImage::Format_MonoLSB, flags);
// make sure image.color(0) == Qt::color0 (white)
// and image.color(1) == Qt::color1 (black)
@@ -134,7 +98,7 @@ bool QPlatformPixmap::fromFile(const QString &fileName, const char *format,
QImage image = QImageReader(fileName, format).read();
if (image.isNull())
return false;
- fromImage(makeBitmapCompliantIfNeeded(this, image, flags), flags);
+ fromImage(makeBitmapCompliantIfNeeded(this, std::move(image), flags), flags);
return !isNull();
}
@@ -146,7 +110,7 @@ bool QPlatformPixmap::fromData(const uchar *buf, uint len, const char *format, Q
QImage image = QImageReader(&b, format).read();
if (image.isNull())
return false;
- fromImage(makeBitmapCompliantIfNeeded(this, image, flags), flags);
+ fromImage(makeBitmapCompliantIfNeeded(this, std::move(image), flags), flags);
return !isNull();
}
@@ -168,9 +132,9 @@ QBitmap QPlatformPixmap::mask() const
if (!hasAlphaChannel())
return QBitmap();
- const QImage img = toImage();
+ QImage img = toImage();
bool shouldConvert = (img.format() != QImage::Format_ARGB32 && img.format() != QImage::Format_ARGB32_Premultiplied);
- const QImage image = (shouldConvert ? img.convertToFormat(QImage::Format_ARGB32_Premultiplied) : img);
+ const QImage image = (shouldConvert ? std::move(img).convertToFormat(QImage::Format_ARGB32_Premultiplied) : img);
const int w = image.width();
const int h = image.height();
@@ -183,7 +147,7 @@ QBitmap QPlatformPixmap::mask() const
mask.setColor(0, QColor(Qt::color0).rgba());
mask.setColor(1, QColor(Qt::color1).rgba());
- const int bpl = mask.bytesPerLine();
+ const qsizetype bpl = mask.bytesPerLine();
for (int y = 0; y < h; ++y) {
const QRgb *src = reinterpret_cast<const QRgb*>(image.scanLine(y));
@@ -196,7 +160,7 @@ QBitmap QPlatformPixmap::mask() const
}
}
- return QBitmap::fromImage(mask);
+ return QBitmap::fromImage(std::move(mask));
}
void QPlatformPixmap::setMask(const QBitmap &mask)
@@ -204,7 +168,7 @@ void QPlatformPixmap::setMask(const QBitmap &mask)
QImage image = toImage();
if (mask.size().isEmpty()) {
if (image.depth() != 1) { // hw: ????
- image = image.convertToFormat(QImage::Format_RGB32);
+ image = std::move(image).convertToFormat(QImage::Format_RGB32);
}
} else {
const int w = image.width();
@@ -216,7 +180,7 @@ void QPlatformPixmap::setMask(const QBitmap &mask)
for (int y = 0; y < h; ++y) {
const uchar *mscan = imageMask.scanLine(y);
uchar *tscan = image.scanLine(y);
- int bytesPerLine = image.bytesPerLine();
+ qsizetype bytesPerLine = image.bytesPerLine();
for (int i = 0; i < bytesPerLine; ++i)
tscan[i] &= mscan[i];
}
@@ -224,7 +188,7 @@ void QPlatformPixmap::setMask(const QBitmap &mask)
}
default: {
const QImage imageMask = mask.toImage().convertToFormat(QImage::Format_MonoLSB);
- image = image.convertToFormat(QImage::Format_ARGB32_Premultiplied);
+ image = std::move(image).convertToFormat(QImage::Format_ARGB32_Premultiplied);
for (int y = 0; y < h; ++y) {
const uchar *mscan = imageMask.scanLine(y);
QRgb *tscan = (QRgb *)image.scanLine(y);
diff --git a/src/gui/image/qplatformpixmap.h b/src/gui/image/qplatformpixmap.h
index 7635ac2949..be86bf8850 100644
--- a/src/gui/image/qplatformpixmap.h
+++ b/src/gui/image/qplatformpixmap.h
@@ -1,41 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the QtGui module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#ifndef QPLATFORMPIXMAP_H
#define QPLATFORMPIXMAP_H
@@ -163,7 +127,7 @@ private:
# define QT_XFORM_TYPE_MSBFIRST 0
# define QT_XFORM_TYPE_LSBFIRST 1
-Q_GUI_EXPORT bool qt_xForm_helper(const QTransform&, int, int, int, uchar*, int, int, int, const uchar*, int, int, int);
+Q_GUI_EXPORT bool qt_xForm_helper(const QTransform&, int, int, int, uchar*, qsizetype, int, int, const uchar*, qsizetype, int, int);
QT_END_NAMESPACE
diff --git a/src/gui/image/qpnghandler.cpp b/src/gui/image/qpnghandler.cpp
index 251f09fe52..615a36fa36 100644
--- a/src/gui/image/qpnghandler.cpp
+++ b/src/gui/image/qpnghandler.cpp
@@ -1,42 +1,6 @@
-/****************************************************************************
-**
-** Copyright (C) 2013 Samuel Gaist <samuel.gaist@edeltech.ch>
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the QtGui module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2013 Samuel Gaist <samuel.gaist@edeltech.ch>
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#include "private/qpnghandler_p.h"
@@ -45,9 +9,8 @@
#include <qdebug.h>
#include <qiodevice.h>
#include <qimage.h>
-#include <qlist.h>
+#include <qloggingcategory.h>
#include <qvariant.h>
-#include <qvector.h>
#include <private/qimage_p.h> // for qt_getImageText
@@ -82,6 +45,10 @@
QT_BEGIN_NAMESPACE
+using namespace Qt::StringLiterals;
+
+Q_DECLARE_LOGGING_CATEGORY(lcImageIo)
+
// avoid going through QImage::scanLine() which calls detach
#define FAST_SCAN_LINE(data, bpl, y) (data + (y) * bpl)
@@ -100,7 +67,7 @@ public:
ReadingEnd,
Error
};
- // Defines the order of how the various ways of setting colorspace overrides eachother:
+ // Defines the order of how the various ways of setting colorspace overrides each other:
enum ColorSpaceState {
Undefined = 0,
GammaChrm = 1, // gAMA+cHRM chunks
@@ -198,7 +165,7 @@ void iod_read_fn(png_structp png_ptr, png_bytep data, png_size_t length)
QPngHandlerPrivate *d = (QPngHandlerPrivate *)png_get_io_ptr(png_ptr);
QIODevice *in = d->q->device();
- if (d->state == QPngHandlerPrivate::ReadingEnd && !in->isSequential() && (in->size() - in->pos()) < 4 && length == 4) {
+ if (d->state == QPngHandlerPrivate::ReadingEnd && !in->isSequential() && in->size() > 0 && (in->size() - in->pos()) < 4 && length == 4) {
// Workaround for certain malformed PNGs that lack the final crc bytes
uchar endcrc[4] = { 0xae, 0x42, 0x60, 0x82 };
memcpy(data, endcrc, 4);
@@ -239,7 +206,7 @@ void qpiw_flush_fn(png_structp /* png_ptr */)
}
static
-void setup_qt(QImage& image, png_structp png_ptr, png_infop info_ptr, QSize scaledSize, bool *doScaledRead)
+bool setup_qt(QImage& image, png_structp png_ptr, png_infop info_ptr, QSize scaledSize, bool *doScaledRead)
{
png_uint_32 width = 0;
png_uint_32 height = 0;
@@ -252,6 +219,7 @@ void setup_qt(QImage& image, png_structp png_ptr, png_infop info_ptr, QSize scal
int num_palette;
int interlace_method = PNG_INTERLACE_LAST;
png_get_IHDR(png_ptr, info_ptr, &width, &height, &bit_depth, &color_type, &interlace_method, nullptr, nullptr);
+ QSize size(width, height);
png_set_interlace_handling(png_ptr);
if (color_type == PNG_COLOR_TYPE_GRAY) {
@@ -259,11 +227,8 @@ void setup_qt(QImage& image, png_structp png_ptr, png_infop info_ptr, QSize scal
if (bit_depth == 1 && png_get_channels(png_ptr, info_ptr) == 1) {
png_set_invert_mono(png_ptr);
png_read_update_info(png_ptr, info_ptr);
- if (image.size() != QSize(width, height) || image.format() != QImage::Format_Mono) {
- image = QImage(width, height, QImage::Format_Mono);
- if (image.isNull())
- return;
- }
+ if (!QImageIOHandler::allocateImage(size, QImage::Format_Mono, &image))
+ return false;
image.setColorCount(2);
image.setColor(1, qRgb(0,0,0));
image.setColor(0, qRgb(255,255,255));
@@ -279,12 +244,8 @@ void setup_qt(QImage& image, png_structp png_ptr, png_infop info_ptr, QSize scal
} else if (bit_depth == 16
&& png_get_channels(png_ptr, info_ptr) == 1
&& !png_get_valid(png_ptr, info_ptr, PNG_INFO_tRNS)) {
- if (image.size() != QSize(width, height) || image.format() != QImage::Format_Grayscale16) {
- image = QImage(width, height, QImage::Format_Grayscale16);
- if (image.isNull())
- return;
- }
-
+ if (!QImageIOHandler::allocateImage(size, QImage::Format_Grayscale16, &image))
+ return false;
png_read_update_info(png_ptr, info_ptr);
if (QSysInfo::ByteOrder == QSysInfo::LittleEndian)
png_set_swap(png_ptr);
@@ -296,33 +257,23 @@ void setup_qt(QImage& image, png_structp png_ptr, png_infop info_ptr, QSize scal
png_set_expand(png_ptr);
png_set_gray_to_rgb(png_ptr);
QImage::Format format = hasMask ? QImage::Format_RGBA64 : QImage::Format_RGBX64;
- if (image.size() != QSize(width, height) || image.format() != format) {
- image = QImage(width, height, format);
- if (image.isNull())
- return;
- }
+ if (!QImageIOHandler::allocateImage(size, format, &image))
+ return false;
png_read_update_info(png_ptr, info_ptr);
if (QSysInfo::ByteOrder == QSysInfo::LittleEndian)
png_set_swap(png_ptr);
} else if (bit_depth == 8 && !png_get_valid(png_ptr, info_ptr, PNG_INFO_tRNS)) {
png_set_expand(png_ptr);
- if (image.size() != QSize(width, height) || image.format() != QImage::Format_Grayscale8) {
- image = QImage(width, height, QImage::Format_Grayscale8);
- if (image.isNull())
- return;
- }
-
+ if (!QImageIOHandler::allocateImage(size, QImage::Format_Grayscale8, &image))
+ return false;
png_read_update_info(png_ptr, info_ptr);
} else {
if (bit_depth < 8)
png_set_packing(png_ptr);
int ncols = bit_depth < 8 ? 1 << bit_depth : 256;
png_read_update_info(png_ptr, info_ptr);
- if (image.size() != QSize(width, height) || image.format() != QImage::Format_Indexed8) {
- image = QImage(width, height, QImage::Format_Indexed8);
- if (image.isNull())
- return;
- }
+ if (!QImageIOHandler::allocateImage(size, QImage::Format_Indexed8, &image))
+ return false;
image.setColorCount(ncols);
for (int i=0; i<ncols; i++) {
int c = i*255/(ncols-1);
@@ -344,12 +295,10 @@ void setup_qt(QImage& image, png_structp png_ptr, png_infop info_ptr, QSize scal
png_set_packing(png_ptr);
png_read_update_info(png_ptr, info_ptr);
png_get_IHDR(png_ptr, info_ptr, &width, &height, &bit_depth, &color_type, nullptr, nullptr, nullptr);
+ size = QSize(width, height);
QImage::Format format = bit_depth == 1 ? QImage::Format_Mono : QImage::Format_Indexed8;
- if (image.size() != QSize(width, height) || image.format() != format) {
- image = QImage(width, height, format);
- if (image.isNull())
- return;
- }
+ if (!QImageIOHandler::allocateImage(size, format, &image))
+ return false;
png_get_PLTE(png_ptr, info_ptr, &palette, &num_palette);
image.setColorCount((format == QImage::Format_Mono) ? 2 : num_palette);
int i = 0;
@@ -387,11 +336,8 @@ void setup_qt(QImage& image, png_structp png_ptr, png_infop info_ptr, QSize scal
}
if (!(color_type & PNG_COLOR_MASK_COLOR))
png_set_gray_to_rgb(png_ptr);
- if (image.size() != QSize(width, height) || image.format() != format) {
- image = QImage(width, height, format);
- if (image.isNull())
- return;
- }
+ if (!QImageIOHandler::allocateImage(size, format, &image))
+ return false;
png_read_update_info(png_ptr, info_ptr);
if (QSysInfo::ByteOrder == QSysInfo::LittleEndian)
png_set_swap(png_ptr);
@@ -422,11 +368,8 @@ void setup_qt(QImage& image, png_structp png_ptr, png_infop info_ptr, QSize scal
if (doScaledRead)
*doScaledRead = true;
}
- if (image.size() != outSize || image.format() != format) {
- image = QImage(outSize, format);
- if (image.isNull())
- return;
- }
+ if (!QImageIOHandler::allocateImage(outSize, format, &image))
+ return false;
if (QSysInfo::ByteOrder == QSysInfo::BigEndian)
png_set_swap_alpha(png_ptr);
@@ -438,6 +381,7 @@ void setup_qt(QImage& image, png_structp png_ptr, png_infop info_ptr, QSize scal
png_read_update_info(png_ptr, info_ptr);
}
+ return true;
}
static void read_image_scaled(QImage *outImage, png_structp png_ptr, png_infop info_ptr,
@@ -455,7 +399,7 @@ static void read_image_scaled(QImage *outImage, png_structp png_ptr, png_infop i
png_get_IHDR(png_ptr, info_ptr, &width, &height, &bit_depth, &color_type, nullptr, nullptr, nullptr);
png_get_oFFs(png_ptr, info_ptr, &offset_x, &offset_y, &unit_type);
uchar *data = outImage->bits();
- int bpl = outImage->bytesPerLine();
+ qsizetype bpl = outImage->bytesPerLine();
if (scaledSize.isEmpty() || !width || !height)
return;
@@ -522,7 +466,7 @@ static void read_image_scaled(QImage *outImage, png_structp png_ptr, png_infop i
extern "C" {
static void qt_png_warning(png_structp /*png_ptr*/, png_const_charp message)
{
- qWarning("libpng warning: %s", message);
+ qCInfo(lcImageIo, "libpng warning: %s", message);
}
}
@@ -530,6 +474,7 @@ static void qt_png_warning(png_structp /*png_ptr*/, png_const_charp message)
void QPngHandlerPrivate::readPngTexts(png_info *info)
{
+#ifndef QT_NO_IMAGEIO_TEXT_LOADING
png_textp text_ptr;
int num_text=0;
png_get_text(png_ptr, info, &text_ptr, &num_text);
@@ -546,12 +491,15 @@ void QPngHandlerPrivate::readPngTexts(png_info *info)
value = QString::fromLatin1(text_ptr->text, int(text_ptr->text_length));
}
if (!description.isEmpty())
- description += QLatin1String("\n\n");
- description += key + QLatin1String(": ") + value.simplified();
+ description += "\n\n"_L1;
+ description += key + ": "_L1 + value.simplified();
readTexts.append(key);
readTexts.append(value);
text_ptr++;
}
+#else
+ Q_UNUSED(info);
+#endif
}
@@ -606,31 +554,31 @@ bool QPngHandlerPrivate::readPngHeader()
#endif
png_uint_32 profLen;
png_get_iCCP(png_ptr, info_ptr, &name, &compressionType, &profileData, &profLen);
- colorSpace = QColorSpace::fromIccProfile(QByteArray::fromRawData((const char *)profileData, profLen));
- if (!colorSpace.isValid()) {
- qWarning() << "QPngHandler: Failed to parse ICC profile";
- } else {
- QColorSpacePrivate *csD = QColorSpacePrivate::getWritable(colorSpace);
+ Q_UNUSED(name);
+ Q_UNUSED(compressionType);
+ if (profLen > 0) {
+ colorSpace = QColorSpace::fromIccProfile(QByteArray((const char *)profileData, profLen));
+ QColorSpacePrivate *csD = QColorSpacePrivate::get(colorSpace);
if (csD->description.isEmpty())
csD->description = QString::fromLatin1((const char *)name);
colorSpaceState = Icc;
}
}
#endif
- if (png_get_valid(png_ptr, info_ptr, PNG_INFO_sRGB)) {
+ if (colorSpaceState <= Srgb && png_get_valid(png_ptr, info_ptr, PNG_INFO_sRGB)) {
int rendering_intent = -1;
png_get_sRGB(png_ptr, info_ptr, &rendering_intent);
// We don't actually care about the rendering_intent, just that it is valid
- if (rendering_intent >= 0 && rendering_intent <= 3 && colorSpaceState <= Srgb) {
+ if (rendering_intent >= 0 && rendering_intent <= 3) {
colorSpace = QColorSpace::SRgb;
colorSpaceState = Srgb;
}
}
- if (png_get_valid(png_ptr, info_ptr, PNG_INFO_gAMA)) {
+ if (colorSpaceState <= GammaChrm && png_get_valid(png_ptr, info_ptr, PNG_INFO_gAMA)) {
double file_gamma = 0.0;
png_get_gAMA(png_ptr, info_ptr, &file_gamma);
fileGamma = file_gamma;
- if (fileGamma > 0.0f && colorSpaceState <= GammaChrm) {
+ if (fileGamma > 0.0f) {
QColorSpacePrimaries primaries;
if (png_get_valid(png_ptr, info_ptr, PNG_INFO_cHRM)) {
double white_x, white_y, red_x, red_y;
@@ -645,10 +593,10 @@ bool QPngHandlerPrivate::readPngHeader()
}
if (primaries.areValid()) {
colorSpace = QColorSpace(primaries.whitePoint, primaries.redPoint, primaries.greenPoint, primaries.bluePoint,
- QColorSpace::TransferFunction::Gamma, fileGamma);
+ QColorSpace::TransferFunction::Gamma, 1.0f / fileGamma);
} else {
colorSpace = QColorSpace(QColorSpace::Primaries::SRgb,
- QColorSpace::TransferFunction::Gamma, fileGamma);
+ QColorSpace::TransferFunction::Gamma, 1.0f / fileGamma);
}
colorSpaceState = GammaChrm;
}
@@ -680,14 +628,12 @@ bool QPngHandlerPrivate::readPngImage(QImage *outImage)
// This configuration forces gamma correction and
// thus changes the output colorspace
png_set_gamma(png_ptr, 1.0f / gamma, fileGamma);
- colorSpace = colorSpace.withTransferFunction(QColorSpace::TransferFunction::Gamma, 1.0f / gamma);
+ colorSpace.setTransferFunction(QColorSpace::TransferFunction::Gamma, 1.0f / gamma);
colorSpaceState = GammaChrm;
}
bool doScaledRead = false;
- setup_qt(*outImage, png_ptr, info_ptr, scaledSize, &doScaledRead);
-
- if (outImage->isNull()) {
+ if (!setup_qt(*outImage, png_ptr, info_ptr, scaledSize, &doScaledRead)) {
png_destroy_read_struct(&png_ptr, &info_ptr, &end_info);
png_ptr = nullptr;
amp.deallocate();
@@ -709,7 +655,7 @@ bool QPngHandlerPrivate::readPngImage(QImage *outImage)
png_get_IHDR(png_ptr, info_ptr, &width, &height, &bit_depth, &color_type, nullptr, nullptr, nullptr);
png_get_oFFs(png_ptr, info_ptr, &offset_x, &offset_y, &unit_type);
uchar *data = outImage->bits();
- int bpl = outImage->bytesPerLine();
+ qsizetype bpl = outImage->bytesPerLine();
amp.row_pointers = new png_bytep[height];
for (uint y = 0; y < height; y++)
@@ -851,12 +797,12 @@ static void set_text(const QImage &image, png_structp png_ptr, png_infop info_pt
QMap<QString, QString>::ConstIterator it = text.constBegin();
int i = 0;
while (it != text.constEnd()) {
- text_ptr[i].key = qstrdup(it.key().leftRef(79).toLatin1().constData());
- bool noCompress = (it.value().length() < 40);
+ text_ptr[i].key = qstrdup(QStringView{it.key()}.left(79).toLatin1().constData());
+ bool noCompress = (it.value().size() < 40);
#ifdef PNG_iTXt_SUPPORTED
bool needsItxt = false;
- for (const QChar c : it.value()) {
+ for (QChar c : it.value()) {
uchar ch = c.cell();
if (c.row() || (ch < 0x20 && ch != '\n') || (ch > 0x7e && ch < 0xa0)) {
needsItxt = true;
@@ -916,6 +862,9 @@ bool QPNGImageWriter::writeImage(const QImage& image, int compression_in, const
}
png_set_error_fn(png_ptr, nullptr, nullptr, qt_png_warning);
+#ifdef PNG_BENIGN_ERRORS_SUPPORTED
+ png_set_benign_errors(png_ptr, 1);
+#endif
info_ptr = png_create_info_struct(png_ptr);
if (!info_ptr) {
@@ -931,7 +880,7 @@ bool QPNGImageWriter::writeImage(const QImage& image, int compression_in, const
int compression = compression_in;
if (compression >= 0) {
if (compression > 9) {
- qWarning("PNG: Compression %d out of range", compression);
+ qCWarning(lcImageIo, "PNG: Compression %d out of range", compression);
compression = 9;
}
png_set_compression_level(png_ptr, compression);
@@ -977,15 +926,15 @@ bool QPNGImageWriter::writeImage(const QImage& image, int compression_in, const
color_type, 0, 0, 0); // sets #channels
#ifdef PNG_iCCP_SUPPORTED
- if (image.colorSpace().isValid()) {
- QColorSpace cs = image.colorSpace();
- // Support the old gamma making it override transferfunction.
- if (gamma != 0.0 && !qFuzzyCompare(cs.gamma(), 1.0f / gamma))
- cs = cs.withTransferFunction(QColorSpace::TransferFunction::Gamma, 1.0f / gamma);
- QByteArray iccProfileName = QColorSpacePrivate::get(cs)->description.toLatin1();
+ QColorSpace cs = image.colorSpace();
+ // Support the old gamma making it override transferfunction (if possible)
+ if (cs.isValid() && gamma != 0.0 && !qFuzzyCompare(cs.gamma(), 1.0f / gamma))
+ cs = cs.withTransferFunction(QColorSpace::TransferFunction::Gamma, 1.0f / gamma);
+ QByteArray iccProfile = cs.iccProfile();
+ if (!iccProfile.isEmpty()) {
+ QByteArray iccProfileName = cs.description().toLatin1();
if (iccProfileName.isEmpty())
iccProfileName = QByteArrayLiteral("Custom");
- QByteArray iccProfile = cs.iccProfile();
png_set_iCCP(png_ptr, info_ptr,
#if PNG_LIBPNG_VER < 10500
iccProfileName.data(), PNG_COMPRESSION_TYPE_BASE, iccProfile.data(),
@@ -993,7 +942,7 @@ bool QPNGImageWriter::writeImage(const QImage& image, int compression_in, const
iccProfileName.constData(), PNG_COMPRESSION_TYPE_BASE,
(png_const_bytep)iccProfile.constData(),
#endif
- iccProfile.length());
+ iccProfile.size());
} else
#endif
if (gamma != 0.0) {
@@ -1224,7 +1173,7 @@ bool QPngHandler::canRead() const
bool QPngHandler::canRead(QIODevice *device)
{
if (!device) {
- qWarning("QPngHandler::canRead() called with no device");
+ qCWarning(lcImageIo, "QPngHandler::canRead() called with no device");
return false;
}
@@ -1293,13 +1242,6 @@ void QPngHandler::setOption(ImageOption option, const QVariant &value)
d->scaledSize = value.toSize();
}
-#if QT_DEPRECATED_SINCE(5, 13)
-QByteArray QPngHandler::name() const
-{
- return "png";
-}
-#endif
-
QT_END_NAMESPACE
#endif // QT_NO_IMAGEFORMAT_PNG
diff --git a/src/gui/image/qpnghandler.pri b/src/gui/image/qpnghandler.pri
deleted file mode 100644
index e69de29bb2..0000000000
--- a/src/gui/image/qpnghandler.pri
+++ /dev/null
diff --git a/src/gui/image/qpnghandler_p.h b/src/gui/image/qpnghandler_p.h
index 5d4da97395..fa4a7788f7 100644
--- a/src/gui/image/qpnghandler_p.h
+++ b/src/gui/image/qpnghandler_p.h
@@ -1,41 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the QtGui module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#ifndef QPNGHANDLER_P_H
#define QPNGHANDLER_P_H
@@ -69,10 +33,6 @@ public:
bool read(QImage *image) override;
bool write(const QImage &image) override;
-#if QT_DEPRECATED_SINCE(5, 13)
- QByteArray name() const override;
-#endif
-
QVariant option(ImageOption option) const override;
void setOption(ImageOption option, const QVariant &value) override;
bool supportsOption(ImageOption option) const override;
diff --git a/src/gui/image/qppmhandler.cpp b/src/gui/image/qppmhandler.cpp
index 13ee2eadd2..3a4af46195 100644
--- a/src/gui/image/qppmhandler.cpp
+++ b/src/gui/image/qppmhandler.cpp
@@ -1,54 +1,23 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the QtGui module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#include "private/qppmhandler_p.h"
#ifndef QT_NO_IMAGEFORMAT_PPM
+#include <qdebug.h>
#include <qimage.h>
-#include <qvariant.h>
-#include <qvector.h>
-#include <ctype.h>
+#include <qlist.h>
+#include <qloggingcategory.h>
#include <qrgba64.h>
+#include <qvariant.h>
+#include <private/qlocale_p.h>
+#include <private/qtools_p.h>
QT_BEGIN_NAMESPACE
+Q_DECLARE_LOGGING_CATEGORY(lcImageIo)
+
/*****************************************************************************
PBM/PGM/PPM (ASCII and RAW) image read/write functions
*****************************************************************************/
@@ -63,7 +32,7 @@ static void discard_pbm_line(QIODevice *d)
} while (res > 0 && buf[res-1] != '\n');
}
-static int read_pbm_int(QIODevice *d)
+static int read_pbm_int(QIODevice *d, bool *ok, int maxDigits = -1)
{
char c;
int val = -1;
@@ -72,7 +41,7 @@ static int read_pbm_int(QIODevice *d)
for (;;) {
if (!d->getChar(&c)) // end of file
break;
- digit = isdigit((uchar) c);
+ digit = QtMiscUtils::isAsciiDigit(c);
if (val != -1) {
if (digit) {
const int cValue = c - '0';
@@ -81,6 +50,8 @@ static int read_pbm_int(QIODevice *d)
} else {
hasOverflow = true;
}
+ if (maxDigits > 0 && --maxDigits == 0)
+ break;
continue;
} else {
if (c == '#') // comment
@@ -90,13 +61,17 @@ static int read_pbm_int(QIODevice *d)
}
if (digit) // first digit
val = c - '0';
- else if (isspace((uchar) c))
+ else if (ascii_isspace(c))
continue;
else if (c == '#')
discard_pbm_line(d);
else
break;
+ if (maxDigits > 0 && --maxDigits == 0)
+ break;
}
+ if (val < 0)
+ *ok = false;
return hasOverflow ? -1 : val;
}
@@ -106,23 +81,24 @@ static bool read_pbm_header(QIODevice *device, char& type, int& w, int& h, int&
if (device->read(buf, 3) != 3) // read P[1-6]<white-space>
return false;
- if (!(buf[0] == 'P' && isdigit((uchar) buf[1]) && isspace((uchar) buf[2])))
+ if (!(buf[0] == 'P' && QtMiscUtils::isAsciiDigit(buf[1]) && ascii_isspace(buf[2])))
return false;
type = buf[1];
if (type < '1' || type > '6')
return false;
- w = read_pbm_int(device); // get image width
- h = read_pbm_int(device); // get image height
+ bool ok = true;
+ w = read_pbm_int(device, &ok); // get image width
+ h = read_pbm_int(device, &ok); // get image height
if (type == '1' || type == '4')
mcc = 1; // ignore max color component
else
- mcc = read_pbm_int(device); // get max color component
+ mcc = read_pbm_int(device, &ok); // get max color component
- if (w <= 0 || w > 32767 || h <= 0 || h > 32767 || mcc <= 0 || mcc > 0xffff)
- return false; // weird P.M image
+ if (!ok || w <= 0 || w > 32767 || h <= 0 || h > 32767 || mcc <= 0 || mcc > 0xffff)
+ return false; // weird P.M image
return true;
}
@@ -135,7 +111,7 @@ static inline QRgb scale_pbm_color(quint16 mx, quint16 rv, quint16 gv, quint16 b
static bool read_pbm_body(QIODevice *device, char type, int w, int h, int mcc, QImage *outImage)
{
int nbits, y;
- int pbm_bpl;
+ qsizetype pbm_bpl;
bool raw;
QImage::Format format;
@@ -160,13 +136,10 @@ static bool read_pbm_body(QIODevice *device, char type, int w, int h, int mcc, Q
}
raw = type >= '4';
- if (outImage->size() != QSize(w, h) || outImage->format() != format) {
- *outImage = QImage(w, h, format);
- if (outImage->isNull())
- return false;
- }
+ if (!QImageIOHandler::allocateImage(QSize(w, h), format, outImage))
+ return false;
- pbm_bpl = (nbits*w+7)/8; // bytes per scanline in PBM
+ pbm_bpl = (qsizetype(w) * nbits + 7) / 8; // bytes per scanline in PBM
if (raw) { // read raw data
if (nbits == 32) { // type 6
@@ -225,26 +198,26 @@ static bool read_pbm_body(QIODevice *device, char type, int w, int h, int mcc, Q
if (device->read((char *)p, pbm_bpl) != pbm_bpl)
return false;
if (nbits == 8 && mcc < 255) {
- for (int i = 0; i < pbm_bpl; i++)
+ for (qsizetype i = 0; i < pbm_bpl; i++)
p[i] = (p[i] * 255) / mcc;
}
}
}
} else { // read ascii data
uchar *p;
- int n;
- char buf;
- for (y = 0; (y < h) && (device->peek(&buf, 1) == 1); y++) {
+ qsizetype n;
+ bool ok = true;
+ for (y = 0; y < h && ok; y++) {
p = outImage->scanLine(y);
n = pbm_bpl;
if (nbits == 1) {
int b;
int bitsLeft = w;
- while (n--) {
+ while (n-- && ok) {
b = 0;
for (int i=0; i<8; i++) {
if (i < bitsLeft)
- b = (b << 1) | (read_pbm_int(device) & 1);
+ b = (b << 1) | (read_pbm_int(device, &ok, 1) & 1);
else
b = (b << 1) | (0 & 1); // pad it our self if we need to
}
@@ -253,36 +226,38 @@ static bool read_pbm_body(QIODevice *device, char type, int w, int h, int mcc, Q
}
} else if (nbits == 8) {
if (mcc == 255) {
- while (n--) {
- *p++ = read_pbm_int(device);
+ while (n-- && ok) {
+ *p++ = read_pbm_int(device, &ok);
}
} else {
- while (n--) {
- *p++ = (read_pbm_int(device) & 0xffff) * 255 / mcc;
+ while (n-- && ok) {
+ *p++ = (read_pbm_int(device, &ok) & 0xffff) * 255 / mcc;
}
}
} else { // 32 bits
n /= 4;
int r, g, b;
if (mcc == 255) {
- while (n--) {
- r = read_pbm_int(device);
- g = read_pbm_int(device);
- b = read_pbm_int(device);
+ while (n-- && ok) {
+ r = read_pbm_int(device, &ok);
+ g = read_pbm_int(device, &ok);
+ b = read_pbm_int(device, &ok);
*((QRgb*)p) = qRgb(r, g, b);
p += 4;
}
} else {
- while (n--) {
- r = read_pbm_int(device);
- g = read_pbm_int(device);
- b = read_pbm_int(device);
+ while (n-- && ok) {
+ r = read_pbm_int(device, &ok);
+ g = read_pbm_int(device, &ok);
+ b = read_pbm_int(device, &ok);
*((QRgb*)p) = scale_pbm_color(mcc, r, g, b);
p += 4;
}
}
}
}
+ if (!ok)
+ return false;
}
if (format == QImage::Format_Mono) {
@@ -294,13 +269,12 @@ static bool read_pbm_body(QIODevice *device, char type, int w, int h, int mcc, Q
return true;
}
-static bool write_pbm_image(QIODevice *out, const QImage &sourceImage, const QByteArray &sourceFormat)
+static bool write_pbm_image(QIODevice *out, const QImage &sourceImage, QByteArrayView sourceFormat)
{
QByteArray str;
QImage image = sourceImage;
- QByteArray format = sourceFormat;
+ const QByteArrayView format = sourceFormat.left(3); // ignore RAW part
- format = format.left(3); // ignore RAW part
bool gray = format == "pgm";
if (format == "pbm") {
@@ -351,7 +325,7 @@ static bool write_pbm_image(QIODevice *out, const QImage &sourceImage, const QBy
switch (image.depth()) {
case 1: {
str.insert(1, '4');
- if (out->write(str, str.length()) != str.length())
+ if (out->write(str, str.size()) != str.size())
return false;
w = (w+7)/8;
for (uint y=0; y<h; y++) {
@@ -365,12 +339,12 @@ static bool write_pbm_image(QIODevice *out, const QImage &sourceImage, const QBy
case 8: {
str.insert(1, gray ? '5' : '6');
str.append("255\n");
- if (out->write(str, str.length()) != str.length())
+ if (out->write(str, str.size()) != str.size())
return false;
- uint bpl = w * (gray ? 1 : 3);
+ qsizetype bpl = qsizetype(w) * (gray ? 1 : 3);
uchar *buf = new uchar[bpl];
if (image.format() == QImage::Format_Indexed8) {
- QVector<QRgb> color = image.colorTable();
+ const QList<QRgb> color = image.colorTable();
for (uint y=0; y<h; y++) {
const uchar *b = image.constScanLine(y);
uchar *p = buf;
@@ -388,7 +362,7 @@ static bool write_pbm_image(QIODevice *out, const QImage &sourceImage, const QBy
*p++ = qBlue(rgb);
}
}
- if (bpl != (uint)out->write((char*)buf, bpl))
+ if (bpl != (qsizetype)out->write((char*)buf, bpl))
return false;
}
} else {
@@ -407,7 +381,7 @@ static bool write_pbm_image(QIODevice *out, const QImage &sourceImage, const QBy
*p++ = color;
}
}
- if (bpl != (uint)out->write((char*)buf, bpl))
+ if (bpl != (qsizetype)out->write((char*)buf, bpl))
return false;
}
}
@@ -418,9 +392,9 @@ static bool write_pbm_image(QIODevice *out, const QImage &sourceImage, const QBy
case 32: {
str.insert(1, '6');
str.append("255\n");
- if (out->write(str, str.length()) != str.length())
+ if (out->write(str, str.size()) != str.size())
return false;
- uint bpl = w * 3;
+ qsizetype bpl = qsizetype(w) * 3;
uchar *buf = new uchar[bpl];
for (uint y=0; y<h; y++) {
const QRgb *b = reinterpret_cast<const QRgb *>(image.constScanLine(y));
@@ -432,7 +406,7 @@ static bool write_pbm_image(QIODevice *out, const QImage &sourceImage, const QBy
*p++ = qGreen(rgb);
*p++ = qBlue(rgb);
}
- if (bpl != (uint)out->write((char*)buf, bpl))
+ if (bpl != (qsizetype)out->write((char*)buf, bpl))
return false;
}
delete [] buf;
@@ -476,7 +450,7 @@ bool QPpmHandler::canRead() const
bool QPpmHandler::canRead(QIODevice *device, QByteArray *subType)
{
if (!device) {
- qWarning("QPpmHandler::canRead() called with no device");
+ qCWarning(lcImageIo, "QPpmHandler::canRead() called with no device");
return false;
}
@@ -576,13 +550,6 @@ void QPpmHandler::setOption(ImageOption option, const QVariant &value)
subType = value.toByteArray().toLower();
}
-#if QT_DEPRECATED_SINCE(5, 13)
-QByteArray QPpmHandler::name() const
-{
- return subType.isEmpty() ? QByteArray("ppm") : subType;
-}
-#endif
-
QT_END_NAMESPACE
#endif // QT_NO_IMAGEFORMAT_PPM
diff --git a/src/gui/image/qppmhandler_p.h b/src/gui/image/qppmhandler_p.h
index 2f3811b759..49663ebc53 100644
--- a/src/gui/image/qppmhandler_p.h
+++ b/src/gui/image/qppmhandler_p.h
@@ -1,41 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the QtGui module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#ifndef QPPMHANDLER_P_H
#define QPPMHANDLER_P_H
@@ -67,10 +31,6 @@ public:
bool read(QImage *image) override;
bool write(const QImage &image) override;
-#if QT_DEPRECATED_SINCE(5, 13)
- QByteArray name() const override;
-#endif
-
static bool canRead(QIODevice *device, QByteArray *subType = nullptr);
QVariant option(ImageOption option) const override;
diff --git a/src/gui/image/qxbmhandler.cpp b/src/gui/image/qxbmhandler.cpp
index 3cd15b3e4d..8206fe3b29 100644
--- a/src/gui/image/qxbmhandler.cpp
+++ b/src/gui/image/qxbmhandler.cpp
@@ -1,41 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the QtGui module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#include <qplatformdefs.h>
#include "private/qxbmhandler_p.h"
@@ -44,22 +8,25 @@
#include <qimage.h>
#include <qiodevice.h>
-#include <qregexp.h>
+#include <qloggingcategory.h>
#include <qvariant.h>
+#include <private/qtools_p.h>
#include <stdio.h>
-#include <ctype.h>
QT_BEGIN_NAMESPACE
+using namespace QtMiscUtils;
+
+Q_DECLARE_LOGGING_CATEGORY(lcImageIo)
+
/*****************************************************************************
X bitmap image read/write functions
*****************************************************************************/
static inline int hex2byte(char *p)
{
- return ((isdigit((uchar) *p) ? *p - '0' : toupper((uchar) *p) - 'A' + 10) << 4) |
- (isdigit((uchar) *(p+1)) ? *(p+1) - '0' : toupper((uchar) *(p+1)) - 'A' + 10);
+ return QtMiscUtils::fromHex(p[0]) * 16 | QtMiscUtils::fromHex(p[1]);
}
static bool read_xbm_header(QIODevice *device, int& w, int& h)
@@ -67,8 +34,6 @@ static bool read_xbm_header(QIODevice *device, int& w, int& h)
const int buflen = 300;
const int maxlen = 4096;
char buf[buflen + 1];
- QRegExp r1(QLatin1String("^#define[ \t]+[a-zA-Z0-9._]+[ \t]+"));
- QRegExp r2(QLatin1String("[0-9]+"));
qint64 readBytes = 0;
qint64 totalReadBytes = 0;
@@ -90,30 +55,36 @@ static bool read_xbm_header(QIODevice *device, int& w, int& h)
return false;
}
- buf[readBytes - 1] = '\0';
- QString sbuf;
- sbuf = QString::fromLatin1(buf);
+ auto parseDefine = [] (const char *buf, int len) -> int {
+ auto checkChar = [] (char ch) -> bool {
+ return isAsciiLetterOrNumber(ch)
+ || ch == '_' || ch == '.';
+ };
+ auto isAsciiSpace = [] (char ch) -> bool {
+ return ch == ' ' || ch == '\t';
+ };
+ const char define[] = "#define";
+ constexpr size_t defineLen = sizeof(define) - 1;
+ if (strncmp(buf, define, defineLen) != 0)
+ return 0;
+ int index = defineLen;
+ while (buf[index] && isAsciiSpace(buf[index]))
+ ++index;
+ while (buf[index] && checkChar(buf[index]))
+ ++index;
+ while (buf[index] && isAsciiSpace(buf[index]))
+ ++index;
+
+ return QByteArray(buf + index, len - index).toInt();
+ };
+
// "#define .._width <num>"
- if (r1.indexIn(sbuf) == 0 &&
- r2.indexIn(sbuf, r1.matchedLength()) == r1.matchedLength())
- w = QByteArray(&buf[r1.matchedLength()]).trimmed().toInt();
- else
- return false;
+ w = parseDefine(buf, readBytes - 1);
- // "#define .._height <num>"
readBytes = device->readLine(buf, buflen);
- if (readBytes <= 0)
- return false;
- buf[readBytes - 1] = '\0';
-
- sbuf = QString::fromLatin1(buf);
-
- if (r1.indexIn(sbuf) == 0 &&
- r2.indexIn(sbuf, r1.matchedLength()) == r1.matchedLength())
- h = QByteArray(&buf[r1.matchedLength()]).trimmed().toInt();
- else
- return false;
+ // "#define .._height <num>"
+ h = parseDefine(buf, readBytes - 1);
// format error
if (w <= 0 || w > 32767 || h <= 0 || h > 32767)
@@ -142,11 +113,8 @@ static bool read_xbm_body(QIODevice *device, int w, int h, QImage *outImage)
p = strstr(buf, "0x");
} while (!p);
- if (outImage->size() != QSize(w, h) || outImage->format() != QImage::Format_MonoLSB) {
- *outImage = QImage(w, h, QImage::Format_MonoLSB);
- if (outImage->isNull())
- return false;
- }
+ if (!QImageIOHandler::allocateImage(QSize(w, h), QImage::Format_MonoLSB, outImage))
+ return false;
outImage->fill(Qt::color0); // in case the image data does not cover the full image
@@ -159,8 +127,11 @@ static bool read_xbm_body(QIODevice *device, int w, int h, QImage *outImage)
w = (w+7)/8; // byte width
while (y < h) { // for all encoded bytes...
- if (p) { // p = "0x.."
- *b++ = hex2byte(p+2);
+ if (p && p < (buf + readBytes - 3)) { // p = "0x.."
+ const int byte = hex2byte(p + 2);
+ if (byte < 0) // non-hex char encountered
+ return false;
+ *b++ = byte;
p += 2;
if (++x == w && ++y < h) {
b = outImage->scanLine(y);
@@ -193,7 +164,7 @@ static bool write_xbm_image(const QImage &sourceImage, QIODevice *device, const
int h = image.height();
int i;
QString s = fileName; // get file base name
- int msize = s.length() + 100;
+ int msize = s.size() + 100;
char *buf = new char[msize];
qsnprintf(buf, msize, "#define %s_width %d\n", s.toUtf8().data(), w);
@@ -289,7 +260,10 @@ bool QXbmHandler::canRead() const
bool QXbmHandler::canRead(QIODevice *device)
{
- QImage image;
+ if (!device) {
+ qCWarning(lcImageIo, "QXbmHandler::canRead() called with no device");
+ return false;
+ }
// it's impossible to tell whether we can load an XBM or not when
// it's from a sequential device, as the only way to do it is to
@@ -297,6 +271,7 @@ bool QXbmHandler::canRead(QIODevice *device)
if (device->isSequential())
return false;
+ QImage image;
qint64 oldPos = device->pos();
bool success = read_xbm_image(device, &image);
device->seek(oldPos);
@@ -357,13 +332,6 @@ void QXbmHandler::setOption(ImageOption option, const QVariant &value)
fileName = value.toString();
}
-#if QT_DEPRECATED_SINCE(5, 13)
-QByteArray QXbmHandler::name() const
-{
- return "xbm";
-}
-#endif
-
QT_END_NAMESPACE
#endif // QT_NO_IMAGEFORMAT_XBM
diff --git a/src/gui/image/qxbmhandler_p.h b/src/gui/image/qxbmhandler_p.h
index ae590a1944..6a04faa42b 100644
--- a/src/gui/image/qxbmhandler_p.h
+++ b/src/gui/image/qxbmhandler_p.h
@@ -1,41 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the QtGui module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#ifndef QXBMHANDLER_P_H
#define QXBMHANDLER_P_H
@@ -66,10 +30,6 @@ public:
bool read(QImage *image) override;
bool write(const QImage &image) override;
-#if QT_DEPRECATED_SINCE(5, 13)
- QByteArray name() const override;
-#endif
-
static bool canRead(QIODevice *device);
QVariant option(ImageOption option) const override;
diff --git a/src/gui/image/qxpmhandler.cpp b/src/gui/image/qxpmhandler.cpp
index f9424b62bb..50f9f035a6 100644
--- a/src/gui/image/qxpmhandler.cpp
+++ b/src/gui/image/qxpmhandler.cpp
@@ -1,58 +1,31 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the QtGui module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#include "private/qxpmhandler_p.h"
#ifndef QT_NO_IMAGEFORMAT_XPM
-#include <private/qcolor_p.h>
#include <qbytearraymatcher.h>
+#include <qdebug.h>
#include <qimage.h>
+#include <qloggingcategory.h>
#include <qmap.h>
-#include <qregexp.h>
#include <qtextstream.h>
#include <qvariant.h>
+#include <private/qcolor_p.h>
+#include <private/qduplicatetracker_p.h> // for easier std::pmr detection
+#include <private/qtools_p.h>
+
#include <algorithm>
+#include <array>
QT_BEGIN_NAMESPACE
+using namespace QtMiscUtils;
+
+Q_DECLARE_LOGGING_CATEGORY(lcImageIo)
+
static quint64 xpmHash(const QString &str)
{
unsigned int hashValue = 0;
@@ -748,15 +721,12 @@ inline bool operator<(const char *name, const XPMRGBData &data)
inline bool operator<(const XPMRGBData &data, const char *name)
{ return qstrcmp(data.name, name) < 0; }
-static inline bool qt_get_named_xpm_rgb(const char *name_no_space, QRgb *rgb)
+static inline std::optional<QRgb> qt_get_named_xpm_rgb(const char *name_no_space)
{
const XPMRGBData *r = std::lower_bound(xpmRgbTbl, xpmRgbTbl + xpmRgbTblSize, name_no_space);
- if ((r != xpmRgbTbl + xpmRgbTblSize) && !(name_no_space < *r)) {
- *rgb = r->value;
- return true;
- } else {
- return false;
- }
+ if ((r != xpmRgbTbl + xpmRgbTblSize) && !(name_no_space < *r))
+ return r->value;
+ return {};
}
/*****************************************************************************
@@ -766,17 +736,24 @@ static QString fbname(const QString &fileName) // get file basename (sort of)
{
QString s = fileName;
if (!s.isEmpty()) {
- int i;
- if ((i = s.lastIndexOf(QLatin1Char('/'))) >= 0)
- s = s.mid(i);
- if ((i = s.lastIndexOf(QLatin1Char('\\'))) >= 0)
- s = s.mid(i);
- QRegExp r(QLatin1String("[a-zA-Z][a-zA-Z0-9_]*"));
- int p = r.indexIn(s);
- if (p == -1)
+ int i = qMax(s.lastIndexOf(u'/'), s.lastIndexOf(u'\\'));
+ if (i < 0)
+ i = 0;
+ auto checkChar = [](QChar ch) -> bool {
+ uchar uc = ch.unicode();
+ return isAsciiLetterOrNumber(uc) || uc == '_';
+ };
+ int start = -1;
+ for (; i < s.size(); ++i) {
+ if (checkChar(s.at(i))) {
+ start = i;
+ } else if (start > 0)
+ break;
+ }
+ if (start < 0)
s.clear();
else
- s = s.mid(p, r.matchedLength());
+ s = s.mid(start, i - start);
}
if (s.isEmpty())
s = QString::fromLatin1("dummy");
@@ -873,11 +850,8 @@ static bool read_xpm_body(
// create it in correct format (Format_RGB32 vs Format_ARGB32,
// depending on absence or presence of "c none", respectively)
if (ncols <= 256) {
- if (image.size() != QSize(w, h) || image.format() != QImage::Format_Indexed8) {
- image = QImage(w, h, QImage::Format_Indexed8);
- if (image.isNull())
- return false;
- }
+ if (!QImageIOHandler::allocateImage(QSize(w, h), QImage::Format_Indexed8, &image))
+ return false;
image.setColorCount(ncols);
}
@@ -887,7 +861,7 @@ static bool read_xpm_body(
for(currentColor=0; currentColor < ncols; ++currentColor) {
if (!read_xpm_string(buf, device, source, index, state)) {
- qWarning("QImage: XPM color specification missing");
+ qCWarning(lcImageIo, "XPM color specification missing");
return false;
}
QByteArray index;
@@ -902,7 +876,7 @@ static bool read_xpm_body(
if (i < 0)
i = tokens.indexOf("m");
if (i < 0) {
- qWarning("QImage: XPM color specification is missing: %s", buf.constData());
+ qCWarning(lcImageIo, "XPM color specification is missing: %s", buf.constData());
return false; // no c/g/g4/m specification at all
}
QByteArray color;
@@ -910,7 +884,7 @@ static bool read_xpm_body(
color.append(tokens.at(i));
}
if (color.isEmpty()) {
- qWarning("QImage: XPM color value is missing from specification: %s", buf.constData());
+ qCWarning(lcImageIo, "XPM color value is missing from specification: %s", buf.constData());
return false; // no color value
}
buf = color;
@@ -919,25 +893,25 @@ static bool read_xpm_body(
int transparentColor = currentColor;
if (ncols <= 256) {
image.setColor(transparentColor, 0);
- colorMap.insert(xpmHash(QLatin1String(index.constData())), transparentColor);
+ colorMap.insert(xpmHash(QLatin1StringView(index.constData())), transparentColor);
} else {
- colorMap.insert(xpmHash(QLatin1String(index.constData())), 0);
+ colorMap.insert(xpmHash(QLatin1StringView(index.constData())), 0);
}
} else {
- QRgb c_rgb;
- if (((buf.length()-1) % 3) && (buf[0] == '#')) {
- buf.truncate(((buf.length()-1) / 4 * 3) + 1); // remove alpha channel left by imagemagick
+ QRgb c_rgb = 0;
+ if (((buf.size()-1) % 3) && (buf[0] == '#')) {
+ buf.truncate(((buf.size()-1) / 4 * 3) + 1); // remove alpha channel left by imagemagick
}
if (buf[0] == '#') {
- qt_get_hex_rgb(buf, &c_rgb);
+ c_rgb = qt_get_hex_rgb(buf).value_or(0);
} else {
- qt_get_named_xpm_rgb(buf, &c_rgb);
+ c_rgb = qt_get_named_xpm_rgb(buf).value_or(0);
}
if (ncols <= 256) {
image.setColor(currentColor, 0xff000000 | c_rgb);
- colorMap.insert(xpmHash(QLatin1String(index.constData())), currentColor);
+ colorMap.insert(xpmHash(QLatin1StringView(index.constData())), currentColor);
} else {
- colorMap.insert(xpmHash(QLatin1String(index.constData())), 0xff000000 | c_rgb);
+ colorMap.insert(xpmHash(QLatin1StringView(index.constData())), 0xff000000 | c_rgb);
}
}
}
@@ -946,23 +920,20 @@ static bool read_xpm_body(
// Now we can create 32-bit image of appropriate format
QImage::Format format = hasTransparency ?
QImage::Format_ARGB32 : QImage::Format_RGB32;
- if (image.size() != QSize(w, h) || image.format() != format) {
- image = QImage(w, h, format);
- if (image.isNull())
- return false;
- }
+ if (!QImageIOHandler::allocateImage(QSize(w, h), format, &image))
+ return false;
}
// Read pixels
for(int y=0; y<h; y++) {
if (!read_xpm_string(buf, device, source, index, state)) {
- qWarning("QImage: XPM pixels missing on image line %d", y);
+ qCWarning(lcImageIo, "XPM pixels missing on image line %d", y);
return false;
}
if (image.depth() == 8) {
uchar *p = image.scanLine(y);
uchar *d = (uchar *)buf.data();
- uchar *end = d + buf.length();
+ uchar *end = d + buf.size();
int x;
if (cpp == 1) {
char b[2];
@@ -974,7 +945,7 @@ static bool read_xpm_body(
} else {
char b[16];
b[cpp] = '\0';
- for (x=0; x<w && d<end; x++) {
+ for (x = 0; x < w && d + cpp <= end; x++) {
memcpy(b, (char *)d, cpp);
*p++ = (uchar)colorMap[xpmHash(b)];
d += cpp;
@@ -982,24 +953,24 @@ static bool read_xpm_body(
}
// avoid uninitialized memory for malformed xpms
if (x < w) {
- qWarning("QImage: XPM pixels missing on image line %d (possibly a C++ trigraph).", y);
+ qCWarning(lcImageIo, "XPM pixels missing on image line %d (possibly a C++ trigraph).", y);
memset(p, 0, w - x);
}
} else {
QRgb *p = (QRgb*)image.scanLine(y);
uchar *d = (uchar *)buf.data();
- uchar *end = d + buf.length();
+ uchar *end = d + buf.size();
int x;
char b[16];
b[cpp] = '\0';
- for (x=0; x<w && d<end; x++) {
+ for (x = 0; x < w && d + cpp <= end; x++) {
memcpy(b, (char *)d, cpp);
*p++ = (QRgb)colorMap[xpmHash(b)];
d += cpp;
}
// avoid uninitialized memory for malformed xpms
if (x < w) {
- qWarning("QImage: XPM pixels missing on image line %d (possibly a C++ trigraph).", y);
+ qCWarning(lcImageIo, "XPM pixels missing on image line %d (possibly a C++ trigraph).", y);
memset(p, 0, (w - x)*4);
}
}
@@ -1039,7 +1010,7 @@ bool qt_read_xpm_image_or_array(QIODevice *device, const char * const * source,
if ((readBytes = device->readLine(buf.data(), buf.size())) < 0)
return false;
- static Q_RELAXED_CONSTEXPR auto matcher = qMakeStaticByteArrayMatcher("/* XPM");
+ static constexpr auto matcher = qMakeStaticByteArrayMatcher("/* XPM");
if (matcher.indexIn(buf) != 0) {
while (readBytes > 0) {
@@ -1056,15 +1027,23 @@ bool qt_read_xpm_image_or_array(QIODevice *device, const char * const * source,
return read_xpm_body(device, source, index, state, cpp, ncols, w, h, image);
}
-static const char* xpm_color_name(int cpp, int index)
+namespace {
+template <size_t N>
+struct CharBuffer : std::array<char, N>
+{
+ CharBuffer() {} // avoid value-initializing the whole array
+};
+}
+
+static const char* xpm_color_name(int cpp, int index, CharBuffer<5> && returnable = {})
{
- static char returnable[5];
static const char code[] = ".#abcdefghijklmnopqrstuvwxyzABCD"
"EFGHIJKLMNOPQRSTUVWXYZ0123456789";
// cpp is limited to 4 and index is limited to 64^cpp
if (cpp > 1) {
if (cpp > 2) {
if (cpp > 3) {
+ returnable[4] = '\0';
returnable[3] = code[index % 64];
index /= 64;
} else
@@ -1084,7 +1063,7 @@ static const char* xpm_color_name(int cpp, int index)
returnable[1] = '\0';
returnable[0] = code[index];
- return returnable;
+ return returnable.data();
}
@@ -1100,18 +1079,25 @@ static bool write_xpm_image(const QImage &sourceImage, QIODevice *device, const
else
image = sourceImage;
- QMap<QRgb, int> colorMap;
+#ifdef __cpp_lib_memory_resource
+ char buffer[1024];
+ std::pmr::monotonic_buffer_resource res{&buffer, sizeof buffer};
+ std::pmr::map<QRgb, int> colorMap(&res);
+#else
+ std::map<QRgb, int> colorMap;
+#endif
- int w = image.width(), h = image.height(), ncolors = 0;
- int x, y;
+ const int w = image.width();
+ const int h = image.height();
+ int ncolors = 0;
// build color table
- for(y=0; y<h; y++) {
+ for (int y = 0; y < h; ++y) {
const QRgb *yp = reinterpret_cast<const QRgb *>(image.constScanLine(y));
- for(x=0; x<w; x++) {
- QRgb color = *(yp + x);
- if (!colorMap.contains(color))
- colorMap.insert(color, ncolors++);
+ for (int x = 0; x < w; ++x) {
+ const auto [it, inserted] = colorMap.try_emplace(yp[x], ncolors);
+ if (inserted)
+ ++ncolors;
}
}
@@ -1121,8 +1107,11 @@ static bool write_xpm_image(const QImage &sourceImage, QIODevice *device, const
++cpp;
// limit to 4 characters per pixel
// 64^4 colors is enough for a 4096x4096 image
- if (cpp > 4)
- break;
+ if (cpp > 4) {
+ qCWarning(lcImageIo, "Qt does not support writing XPM images with more than "
+ "64^4 colors (requested: %d colors).", ncolors);
+ return false;
+ }
}
// write header
@@ -1132,36 +1121,21 @@ static bool write_xpm_image(const QImage &sourceImage, QIODevice *device, const
<< '\"' << w << ' ' << h << ' ' << ncolors << ' ' << cpp << '\"';
// write palette
- QMap<QRgb, int>::Iterator c = colorMap.begin();
- while (c != colorMap.end()) {
- QRgb color = c.key();
+ for (const auto &[color, index] : colorMap) {
const QString line = image.format() != QImage::Format_RGB32 && !qAlpha(color)
- ? QString::asprintf("\"%s c None\"", xpm_color_name(cpp, *c))
- : QString::asprintf("\"%s c #%02x%02x%02x\"", xpm_color_name(cpp, *c),
+ ? QString::asprintf("\"%s c None\"", xpm_color_name(cpp, index))
+ : QString::asprintf("\"%s c #%02x%02x%02x\"", xpm_color_name(cpp, index),
qRed(color), qGreen(color), qBlue(color));
- ++c;
s << ',' << Qt::endl << line;
}
// write pixels, limit to 4 characters per pixel
- QByteArray line;
- for(y=0; y<h; y++) {
- line.clear();
+ for (int y = 0; y < h; ++y) {
+ s << ',' << Qt::endl << '\"';
const QRgb *yp = reinterpret_cast<const QRgb *>(image.constScanLine(y));
- for(x=0; x<w; x++) {
- int color = (int)(*(yp + x));
- const QByteArray chars(xpm_color_name(cpp, colorMap[color]));
- line.append(chars[0]);
- if (cpp > 1) {
- line.append(chars[1]);
- if (cpp > 2) {
- line.append(chars[2]);
- if (cpp > 3)
- line.append(chars[3]);
- }
- }
- }
- s << ',' << Qt::endl << '\"' << line << '\"';
+ for (int x = 0; x < w; ++x)
+ s << xpm_color_name(cpp, colorMap[yp[x]]);
+ s << '\"';
}
s << "};" << Qt::endl;
return (s.status() == QTextStream::Ok);
@@ -1216,7 +1190,7 @@ bool QXpmHandler::canRead() const
bool QXpmHandler::canRead(QIODevice *device)
{
if (!device) {
- qWarning("QXpmHandler::canRead() called with no device");
+ qCWarning(lcImageIo, "QXpmHandler::canRead() called with no device");
return false;
}
@@ -1280,13 +1254,6 @@ void QXpmHandler::setOption(ImageOption option, const QVariant &value)
fileName = value.toString();
}
-#if QT_DEPRECATED_SINCE(5, 13)
-QByteArray QXpmHandler::name() const
-{
- return "xpm";
-}
-#endif
-
QT_END_NAMESPACE
#endif // QT_NO_IMAGEFORMAT_XPM
diff --git a/src/gui/image/qxpmhandler_p.h b/src/gui/image/qxpmhandler_p.h
index a4dd88cd17..c55653f3ec 100644
--- a/src/gui/image/qxpmhandler_p.h
+++ b/src/gui/image/qxpmhandler_p.h
@@ -1,41 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the QtGui module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#ifndef QXPMHANDLER_P_H
#define QXPMHANDLER_P_H
@@ -68,10 +32,6 @@ public:
static bool canRead(QIODevice *device);
-#if QT_DEPRECATED_SINCE(5, 13)
- QByteArray name() const override;
-#endif
-
QVariant option(ImageOption option) const override;
void setOption(ImageOption option, const QVariant &value) override;
bool supportsOption(ImageOption option) const override;
diff --git a/src/gui/itemmodels/itemmodels.pri b/src/gui/itemmodels/itemmodels.pri
deleted file mode 100644
index cab0594174..0000000000
--- a/src/gui/itemmodels/itemmodels.pri
+++ /dev/null
@@ -1,8 +0,0 @@
-!qtConfig(standarditemmodel): return()
-
-HEADERS += \
- itemmodels/qstandarditemmodel.h \
- itemmodels/qstandarditemmodel_p.h \
-
-SOURCES += \
- itemmodels/qstandarditemmodel.cpp \
diff --git a/src/gui/itemmodels/qfileinfogatherer.cpp b/src/gui/itemmodels/qfileinfogatherer.cpp
new file mode 100644
index 0000000000..41fb0a0db5
--- /dev/null
+++ b/src/gui/itemmodels/qfileinfogatherer.cpp
@@ -0,0 +1,463 @@
+// Copyright (C) 2020 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
+
+#include "qfileinfogatherer_p.h"
+#include <qcoreapplication.h>
+#include <qdebug.h>
+#include <qdirlisting.h>
+#include <private/qabstractfileiconprovider_p.h>
+#include <private/qfileinfo_p.h>
+#ifndef Q_OS_WIN
+# include <unistd.h>
+# include <sys/types.h>
+#endif
+#if defined(Q_OS_VXWORKS)
+# include "qplatformdefs.h"
+#endif
+
+QT_BEGIN_NAMESPACE
+
+using namespace Qt::StringLiterals;
+
+#ifdef QT_BUILD_INTERNAL
+Q_CONSTINIT static QBasicAtomicInt fetchedRoot = Q_BASIC_ATOMIC_INITIALIZER(false);
+Q_AUTOTEST_EXPORT void qt_test_resetFetchedRoot()
+{
+ fetchedRoot.storeRelaxed(false);
+}
+
+Q_AUTOTEST_EXPORT bool qt_test_isFetchedRoot()
+{
+ return fetchedRoot.loadRelaxed();
+}
+#endif
+
+static QString translateDriveName(const QFileInfo &drive)
+{
+ QString driveName = drive.absoluteFilePath();
+#ifdef Q_OS_WIN
+ if (driveName.startsWith(u'/')) // UNC host
+ return drive.fileName();
+ if (driveName.endsWith(u'/'))
+ driveName.chop(1);
+#endif // Q_OS_WIN
+ return driveName;
+}
+
+/*!
+ Creates thread
+*/
+QFileInfoGatherer::QFileInfoGatherer(QObject *parent)
+ : QThread(parent)
+ , m_iconProvider(&defaultProvider)
+{
+ start(LowPriority);
+}
+
+/*!
+ Destroys thread
+*/
+QFileInfoGatherer::~QFileInfoGatherer()
+{
+ requestAbort();
+ wait();
+}
+
+bool QFileInfoGatherer::event(QEvent *event)
+{
+ if (event->type() == QEvent::DeferredDelete && isRunning()) {
+ // We have been asked to shut down later but were blocked,
+ // so the owning QFileSystemModel proceeded with its shut-down
+ // and deferred the destruction of the gatherer.
+ // If we are still blocked now, then we have three bad options:
+ // terminate, wait forever (preventing the process from shutting down),
+ // or accept a memory leak.
+ requestAbort();
+ if (!wait(5000)) {
+ // If the application is shutting down, then we terminate.
+ // Otherwise assume that sooner or later the thread will finish,
+ // and we delete it then.
+ if (QCoreApplication::closingDown())
+ terminate();
+ else
+ connect(this, &QThread::finished, this, [this]{ delete this; });
+ return true;
+ }
+ }
+
+ return QThread::event(event);
+}
+
+void QFileInfoGatherer::requestAbort()
+{
+ requestInterruption();
+ QMutexLocker locker(&mutex);
+ condition.wakeAll();
+}
+
+void QFileInfoGatherer::setResolveSymlinks(bool enable)
+{
+ Q_UNUSED(enable);
+#ifdef Q_OS_WIN
+ m_resolveSymlinks = enable;
+#endif
+}
+
+void QFileInfoGatherer::driveAdded()
+{
+ fetchExtendedInformation(QString(), QStringList());
+}
+
+void QFileInfoGatherer::driveRemoved()
+{
+ QStringList drives;
+ const QFileInfoList driveInfoList = QDir::drives();
+ for (const QFileInfo &fi : driveInfoList)
+ drives.append(translateDriveName(fi));
+ emit newListOfFiles(QString(), drives);
+}
+
+bool QFileInfoGatherer::resolveSymlinks() const
+{
+#ifdef Q_OS_WIN
+ return m_resolveSymlinks;
+#else
+ return false;
+#endif
+}
+
+void QFileInfoGatherer::setIconProvider(QAbstractFileIconProvider *provider)
+{
+ m_iconProvider = provider;
+}
+
+QAbstractFileIconProvider *QFileInfoGatherer::iconProvider() const
+{
+ return m_iconProvider;
+}
+
+/*!
+ Fetch extended information for all \a files in \a path
+
+ \sa updateFile(), update(), resolvedName()
+*/
+void QFileInfoGatherer::fetchExtendedInformation(const QString &path, const QStringList &files)
+{
+ QMutexLocker locker(&mutex);
+ // See if we already have this dir/file in our queue
+ qsizetype loc = 0;
+ while ((loc = this->path.lastIndexOf(path, loc - 1)) != -1) {
+ if (this->files.at(loc) == files)
+ return;
+ }
+
+#if QT_CONFIG(thread)
+ this->path.push(path);
+ this->files.push(files);
+ condition.wakeAll();
+#else // !QT_CONFIG(thread)
+ getFileInfos(path, files);
+#endif // QT_CONFIG(thread)
+
+#if QT_CONFIG(filesystemwatcher)
+ if (files.isEmpty()
+ && !path.isEmpty()
+ && !path.startsWith("//"_L1) /*don't watch UNC path*/) {
+ if (!watchedDirectories().contains(path))
+ watchPaths(QStringList(path));
+ }
+#endif
+}
+
+/*!
+ Fetch extended information for all \a filePath
+
+ \sa fetchExtendedInformation()
+*/
+void QFileInfoGatherer::updateFile(const QString &filePath)
+{
+ QString dir = filePath.mid(0, filePath.lastIndexOf(u'/'));
+ QString fileName = filePath.mid(dir.size() + 1);
+ fetchExtendedInformation(dir, QStringList(fileName));
+}
+
+QStringList QFileInfoGatherer::watchedFiles() const
+{
+#if QT_CONFIG(filesystemwatcher)
+ if (m_watcher)
+ return m_watcher->files();
+#endif
+ return {};
+}
+
+QStringList QFileInfoGatherer::watchedDirectories() const
+{
+#if QT_CONFIG(filesystemwatcher)
+ if (m_watcher)
+ return m_watcher->directories();
+#endif
+ return {};
+}
+
+void QFileInfoGatherer::createWatcher()
+{
+#if QT_CONFIG(filesystemwatcher)
+ m_watcher = new QFileSystemWatcher(this);
+ connect(m_watcher, &QFileSystemWatcher::directoryChanged, this, &QFileInfoGatherer::list);
+ connect(m_watcher, &QFileSystemWatcher::fileChanged, this, &QFileInfoGatherer::updateFile);
+# if defined(Q_OS_WIN)
+ const QVariant listener = m_watcher->property("_q_driveListener");
+ if (listener.canConvert<QObject *>()) {
+ if (QObject *driveListener = listener.value<QObject *>()) {
+ connect(driveListener, SIGNAL(driveAdded()), this, SLOT(driveAdded()));
+ connect(driveListener, SIGNAL(driveRemoved()), this, SLOT(driveRemoved()));
+ }
+ }
+# endif // Q_OS_WIN
+#endif
+}
+
+void QFileInfoGatherer::watchPaths(const QStringList &paths)
+{
+#if QT_CONFIG(filesystemwatcher)
+ if (m_watching) {
+ if (m_watcher == nullptr)
+ createWatcher();
+ m_watcher->addPaths(paths);
+ }
+#else
+ Q_UNUSED(paths);
+#endif
+}
+
+void QFileInfoGatherer::unwatchPaths(const QStringList &paths)
+{
+#if QT_CONFIG(filesystemwatcher)
+ if (m_watcher && !paths.isEmpty())
+ m_watcher->removePaths(paths);
+#else
+ Q_UNUSED(paths);
+#endif
+}
+
+bool QFileInfoGatherer::isWatching() const
+{
+ bool result = false;
+#if QT_CONFIG(filesystemwatcher)
+ QMutexLocker locker(&mutex);
+ result = m_watching;
+#endif
+ return result;
+}
+
+/*! \internal
+
+ If \a v is \c false, the QFileSystemWatcher used internally will be deleted
+ and subsequent calls to watchPaths() will do nothing.
+
+ If \a v is \c true, subsequent calls to watchPaths() will add those paths to
+ the filesystem watcher; watchPaths() will initialize a QFileSystemWatcher if
+ one hasn't already been initialized.
+*/
+void QFileInfoGatherer::setWatching(bool v)
+{
+#if QT_CONFIG(filesystemwatcher)
+ QMutexLocker locker(&mutex);
+ if (v != m_watching) {
+ m_watching = v;
+ if (!m_watching)
+ delete std::exchange(m_watcher, nullptr);
+ }
+#else
+ Q_UNUSED(v);
+#endif
+}
+
+/*
+ List all files in \a directoryPath
+
+ \sa listed()
+*/
+void QFileInfoGatherer::clear()
+{
+#if QT_CONFIG(filesystemwatcher)
+ QMutexLocker locker(&mutex);
+ unwatchPaths(watchedFiles());
+ unwatchPaths(watchedDirectories());
+#endif
+}
+
+/*
+ Remove a \a path from the watcher
+
+ \sa listed()
+*/
+void QFileInfoGatherer::removePath(const QString &path)
+{
+#if QT_CONFIG(filesystemwatcher)
+ QMutexLocker locker(&mutex);
+ unwatchPaths(QStringList(path));
+#else
+ Q_UNUSED(path);
+#endif
+}
+
+/*
+ List all files in \a directoryPath
+
+ \sa listed()
+*/
+void QFileInfoGatherer::list(const QString &directoryPath)
+{
+ fetchExtendedInformation(directoryPath, QStringList());
+}
+
+/*
+ Until aborted wait to fetch a directory or files
+*/
+void QFileInfoGatherer::run()
+{
+ forever {
+ // Disallow termination while we are holding a mutex or can be
+ // woken up cleanly.
+ setTerminationEnabled(false);
+ QMutexLocker locker(&mutex);
+ while (!isInterruptionRequested() && path.isEmpty())
+ condition.wait(&mutex);
+ if (isInterruptionRequested())
+ return;
+ const QString thisPath = std::as_const(path).front();
+ path.pop_front();
+ const QStringList thisList = std::as_const(files).front();
+ files.pop_front();
+ locker.unlock();
+
+ // Some of the system APIs we call when gathering file infomration
+ // might hang (e.g. waiting for network), so we explicitly allow
+ // termination now.
+ setTerminationEnabled(true);
+ getFileInfos(thisPath, thisList);
+ }
+}
+
+QExtendedInformation QFileInfoGatherer::getInfo(const QFileInfo &fileInfo) const
+{
+ QExtendedInformation info(fileInfo);
+ if (m_iconProvider) {
+ info.icon = m_iconProvider->icon(fileInfo);
+ info.displayType = m_iconProvider->type(fileInfo);
+ } else {
+ info.displayType = QAbstractFileIconProviderPrivate::getFileType(fileInfo);
+ }
+#if QT_CONFIG(filesystemwatcher)
+ // ### Not ready to listen all modifications by default
+ static const bool watchFiles = qEnvironmentVariableIsSet("QT_FILESYSTEMMODEL_WATCH_FILES");
+ if (watchFiles) {
+ if (!fileInfo.exists() && !fileInfo.isSymLink()) {
+ const_cast<QFileInfoGatherer *>(this)->
+ unwatchPaths(QStringList(fileInfo.absoluteFilePath()));
+ } else {
+ const QString path = fileInfo.absoluteFilePath();
+ if (!path.isEmpty() && fileInfo.exists() && fileInfo.isFile() && fileInfo.isReadable()
+ && !watchedFiles().contains(path)) {
+ const_cast<QFileInfoGatherer *>(this)->watchPaths(QStringList(path));
+ }
+ }
+ }
+#endif // filesystemwatcher
+
+#ifdef Q_OS_WIN
+ if (m_resolveSymlinks && info.isSymLink(/* ignoreNtfsSymLinks = */ true)) {
+ QFileInfo resolvedInfo(QFileInfo(fileInfo.symLinkTarget()).canonicalFilePath());
+ if (resolvedInfo.exists()) {
+ emit nameResolved(fileInfo.filePath(), resolvedInfo.fileName());
+ }
+ }
+#endif
+ return info;
+}
+
+/*
+ Get specific file info's, batch the files so update when we have 100
+ items and every 200ms after that
+ */
+void QFileInfoGatherer::getFileInfos(const QString &path, const QStringList &files)
+{
+ // List drives
+ if (path.isEmpty()) {
+#ifdef QT_BUILD_INTERNAL
+ fetchedRoot.storeRelaxed(true);
+#endif
+ QList<std::pair<QString, QFileInfo>> updatedFiles;
+ auto addToUpdatedFiles = [&updatedFiles](QFileInfo &&fileInfo) {
+ fileInfo.stat();
+ updatedFiles.emplace_back(std::pair{translateDriveName(fileInfo), fileInfo});
+ };
+
+ if (files.isEmpty()) {
+ // QDir::drives() calls QFSFileEngine::drives() which creates the QFileInfoList on
+ // the stack and return it, so this list is not shared, so no detaching.
+ QFileInfoList infoList = QDir::drives();
+ updatedFiles.reserve(infoList.size());
+ for (auto rit = infoList.rbegin(), rend = infoList.rend(); rit != rend; ++rit)
+ addToUpdatedFiles(std::move(*rit));
+ } else {
+ updatedFiles.reserve(files.size());
+ for (auto rit = files.crbegin(), rend = files.crend(); rit != rend; ++rit)
+ addToUpdatedFiles(QFileInfo(*rit));
+ }
+ emit updates(path, updatedFiles);
+ return;
+ }
+
+ QElapsedTimer base;
+ base.start();
+ QFileInfo fileInfo;
+ bool firstTime = true;
+ QList<std::pair<QString, QFileInfo>> updatedFiles;
+ QStringList filesToCheck = files;
+
+ QStringList allFiles;
+ if (files.isEmpty()) {
+ constexpr auto dirFilters = QDir::AllEntries | QDir::System | QDir::Hidden;
+ for (const auto &dirEntry : QDirListing(path, dirFilters)) {
+ if (isInterruptionRequested())
+ break;
+ fileInfo = dirEntry.fileInfo();
+ fileInfo.stat();
+ allFiles.append(fileInfo.fileName());
+ fetch(fileInfo, base, firstTime, updatedFiles, path);
+ }
+ }
+ if (!allFiles.isEmpty())
+ emit newListOfFiles(path, allFiles);
+
+ QStringList::const_iterator filesIt = filesToCheck.constBegin();
+ while (!isInterruptionRequested() && filesIt != filesToCheck.constEnd()) {
+ fileInfo.setFile(path + QDir::separator() + *filesIt);
+ ++filesIt;
+ fileInfo.stat();
+ fetch(fileInfo, base, firstTime, updatedFiles, path);
+ }
+ if (!updatedFiles.isEmpty())
+ emit updates(path, updatedFiles);
+ emit directoryLoaded(path);
+}
+
+void QFileInfoGatherer::fetch(const QFileInfo &fileInfo, QElapsedTimer &base, bool &firstTime,
+ QList<std::pair<QString, QFileInfo>> &updatedFiles, const QString &path)
+{
+ updatedFiles.emplace_back(std::pair(fileInfo.fileName(), fileInfo));
+ QElapsedTimer current;
+ current.start();
+ if ((firstTime && updatedFiles.size() > 100) || base.msecsTo(current) > 1000) {
+ emit updates(path, updatedFiles);
+ updatedFiles.clear();
+ base = current;
+ firstTime = false;
+ }
+}
+
+QT_END_NAMESPACE
+
+#include "moc_qfileinfogatherer_p.cpp"
diff --git a/src/gui/itemmodels/qfileinfogatherer_p.h b/src/gui/itemmodels/qfileinfogatherer_p.h
new file mode 100644
index 0000000000..3d5f59c22e
--- /dev/null
+++ b/src/gui/itemmodels/qfileinfogatherer_p.h
@@ -0,0 +1,199 @@
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
+
+#ifndef QFILEINFOGATHERER_H
+#define QFILEINFOGATHERER_H
+
+//
+// W A R N I N G
+// -------------
+//
+// This file is not part of the Qt API. It exists purely as an
+// implementation detail. This header file may change from version to
+// version without notice, or even be removed.
+//
+// We mean it.
+//
+
+#include <QtGui/private/qtguiglobal_p.h>
+
+#include <qthread.h>
+#include <qmutex.h>
+#include <qwaitcondition.h>
+#if QT_CONFIG(filesystemwatcher)
+#include <qfilesystemwatcher.h>
+#endif
+#include <qabstractfileiconprovider.h>
+#include <qstack.h>
+#include <qdatetime.h>
+#include <qdir.h>
+#include <qelapsedtimer.h>
+
+#include <private/qfilesystemengine_p.h>
+
+#include <utility>
+
+QT_REQUIRE_CONFIG(filesystemmodel);
+
+QT_BEGIN_NAMESPACE
+
+class QExtendedInformation {
+public:
+ enum Type { Dir, File, System };
+
+ QExtendedInformation() {}
+ QExtendedInformation(const QFileInfo &info) : mFileInfo(info) {}
+
+ inline bool isDir() { return type() == Dir; }
+ inline bool isFile() { return type() == File; }
+ inline bool isSystem() { return type() == System; }
+
+ bool operator ==(const QExtendedInformation &fileInfo) const {
+ return mFileInfo == fileInfo.mFileInfo
+ && displayType == fileInfo.displayType
+ && permissions() == fileInfo.permissions()
+ && lastModified(QTimeZone::UTC) == fileInfo.lastModified(QTimeZone::UTC);
+ }
+
+#ifndef QT_NO_FSFILEENGINE
+ bool isCaseSensitive() const {
+ return QFileSystemEngine::isCaseSensitive();
+ }
+#endif
+
+ QFile::Permissions permissions() const {
+ return mFileInfo.permissions();
+ }
+
+ Type type() const {
+ if (mFileInfo.isDir()) {
+ return QExtendedInformation::Dir;
+ }
+ if (mFileInfo.isFile()) {
+ return QExtendedInformation::File;
+ }
+ if (!mFileInfo.exists() && mFileInfo.isSymLink()) {
+ return QExtendedInformation::System;
+ }
+ return QExtendedInformation::System;
+ }
+
+ bool isSymLink(bool ignoreNtfsSymLinks = false) const
+ {
+ if (ignoreNtfsSymLinks) {
+#ifdef Q_OS_WIN
+ return !mFileInfo.suffix().compare(QLatin1StringView("lnk"), Qt::CaseInsensitive);
+#endif
+ }
+ return mFileInfo.isSymLink();
+ }
+
+ bool isHidden() const {
+ return mFileInfo.isHidden();
+ }
+
+ QFileInfo fileInfo() const {
+ return mFileInfo;
+ }
+
+ QDateTime lastModified(const QTimeZone &tz) const {
+ return mFileInfo.lastModified(tz);
+ }
+
+ qint64 size() const {
+ qint64 size = -1;
+ if (type() == QExtendedInformation::Dir)
+ size = 0;
+ if (type() == QExtendedInformation::File)
+ size = mFileInfo.size();
+ if (!mFileInfo.exists() && !mFileInfo.isSymLink())
+ size = -1;
+ return size;
+ }
+
+ QString displayType;
+ QIcon icon;
+
+private :
+ QFileInfo mFileInfo;
+};
+
+class QFileIconProvider;
+
+class Q_GUI_EXPORT QFileInfoGatherer : public QThread
+{
+Q_OBJECT
+
+Q_SIGNALS:
+ void updates(const QString &directory, const QList<std::pair<QString, QFileInfo>> &updates);
+ void newListOfFiles(const QString &directory, const QStringList &listOfFiles) const;
+ void nameResolved(const QString &fileName, const QString &resolvedName) const;
+ void directoryLoaded(const QString &path);
+
+public:
+ explicit QFileInfoGatherer(QObject *parent = nullptr);
+ ~QFileInfoGatherer();
+
+ QStringList watchedFiles() const;
+ QStringList watchedDirectories() const;
+ void watchPaths(const QStringList &paths);
+ void unwatchPaths(const QStringList &paths);
+
+ bool isWatching() const;
+ void setWatching(bool v);
+
+ // only callable from this->thread():
+ void clear();
+ void removePath(const QString &path);
+ QExtendedInformation getInfo(const QFileInfo &info) const;
+ QAbstractFileIconProvider *iconProvider() const;
+ bool resolveSymlinks() const;
+
+ void requestAbort();
+
+public Q_SLOTS:
+ void list(const QString &directoryPath);
+ void fetchExtendedInformation(const QString &path, const QStringList &files);
+ void updateFile(const QString &path);
+ void setResolveSymlinks(bool enable);
+ void setIconProvider(QAbstractFileIconProvider *provider);
+
+private Q_SLOTS:
+ void driveAdded();
+ void driveRemoved();
+
+protected:
+ bool event(QEvent *event) override;
+
+private:
+ void run() override;
+ // called by run():
+ void getFileInfos(const QString &path, const QStringList &files);
+ void fetch(const QFileInfo &info, QElapsedTimer &base, bool &firstTime,
+ QList<std::pair<QString, QFileInfo>> &updatedFiles, const QString &path);
+
+private:
+ void createWatcher();
+
+ mutable QMutex mutex;
+ // begin protected by mutex
+ QWaitCondition condition;
+ QStack<QString> path;
+ QStack<QStringList> files;
+ // end protected by mutex
+
+#if QT_CONFIG(filesystemwatcher)
+ QFileSystemWatcher *m_watcher = nullptr;
+#endif
+ QAbstractFileIconProvider *m_iconProvider; // not accessed by run()
+ QAbstractFileIconProvider defaultProvider;
+#ifdef Q_OS_WIN
+ bool m_resolveSymlinks = true; // not accessed by run()
+#endif
+#if QT_CONFIG(filesystemwatcher)
+ bool m_watching = true;
+#endif
+};
+
+QT_END_NAMESPACE
+#endif // QFILEINFOGATHERER_H
diff --git a/src/gui/itemmodels/qfilesystemmodel.cpp b/src/gui/itemmodels/qfilesystemmodel.cpp
new file mode 100644
index 0000000000..290891322f
--- /dev/null
+++ b/src/gui/itemmodels/qfilesystemmodel.cpp
@@ -0,0 +1,2224 @@
+// Copyright (C) 2020 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
+
+#include "qfilesystemmodel_p.h"
+#include "qfilesystemmodel.h"
+#include <qabstractfileiconprovider.h>
+#include <qlocale.h>
+#include <qmimedata.h>
+#include <qurl.h>
+#include <qdebug.h>
+#include <QtCore/qcollator.h>
+#if QT_CONFIG(regularexpression)
+# include <QtCore/qregularexpression.h>
+#endif
+
+#include <algorithm>
+
+#ifdef Q_OS_WIN
+# include <QtCore/QVarLengthArray>
+# include <qt_windows.h>
+# include <shlobj.h>
+#endif
+
+QT_BEGIN_NAMESPACE
+
+using namespace Qt::StringLiterals;
+
+/*!
+ \enum QFileSystemModel::Roles
+ \value FileIconRole
+ \value FilePathRole
+ \value FileNameRole
+ \value FilePermissions
+ \value FileInfoRole The QFileInfo object for the index
+*/
+
+/*!
+ \class QFileSystemModel
+ \since 4.4
+
+ \brief The QFileSystemModel class provides a data model for the local filesystem.
+
+ \ingroup model-view
+ \inmodule QtGui
+
+ This class provides access to the local filesystem, providing functions
+ for renaming and removing files and directories, and for creating new
+ directories. In the simplest case, it can be used with a suitable display
+ widget as part of a browser or filter.
+
+ QFileSystemModel can be accessed using the standard interface provided by
+ QAbstractItemModel, but it also provides some convenience functions that are
+ specific to a directory model.
+ The fileInfo(), isDir(), fileName() and filePath() functions provide information
+ about the underlying files and directories related to items in the model.
+ Directories can be created and removed using mkdir(), rmdir().
+
+ \note QFileSystemModel requires an instance of \l QApplication.
+
+ \section1 Example Usage
+
+ A directory model that displays the contents of a default directory
+ is usually constructed with a parent object:
+
+ \snippet shareddirmodel/main.cpp 2
+
+ A tree view can be used to display the contents of the model
+
+ \snippet shareddirmodel/main.cpp 4
+
+ and the contents of a particular directory can be displayed by
+ setting the tree view's root index:
+
+ \snippet shareddirmodel/main.cpp 7
+
+ The view's root index can be used to control how much of a
+ hierarchical model is displayed. QFileSystemModel provides a convenience
+ function that returns a suitable model index for a path to a
+ directory within the model.
+
+ \section1 Caching and Performance
+
+ QFileSystemModel will not fetch any files or directories until setRootPath()
+ is called. This will prevent any unnecessary querying on the file system
+ until that point such as listing the drives on Windows.
+
+ QFileSystemModel uses a separate thread to populate itself so it will not
+ cause the main thread to hang as the file system is being queried.
+ Calls to rowCount() will return 0 until the model populates a directory.
+
+ QFileSystemModel keeps a cache with file information. The cache is
+ automatically kept up to date using the QFileSystemWatcher.
+
+ \sa {Model Classes}
+*/
+
+/*!
+ \fn bool QFileSystemModel::rmdir(const QModelIndex &index)
+
+ Removes the directory corresponding to the model item \a index in the
+ file system model and \b{deletes the corresponding directory from the
+ file system}, returning true if successful. If the directory cannot be
+ removed, false is returned.
+
+ \warning This function deletes directories from the file system; it does
+ \b{not} move them to a location where they can be recovered.
+
+ \sa remove()
+*/
+
+/*!
+ \fn QString QFileSystemModel::fileName(const QModelIndex &index) const
+
+ Returns the file name for the item stored in the model under the given
+ \a index.
+*/
+
+/*!
+ \fn QIcon QFileSystemModel::fileIcon(const QModelIndex &index) const
+
+ Returns the icon for the item stored in the model under the given
+ \a index.
+*/
+
+/*!
+ \fn QFileInfo QFileSystemModel::fileInfo(const QModelIndex &index) const
+
+ Returns the QFileInfo for the item stored in the model under the given
+ \a index.
+*/
+QFileInfo QFileSystemModel::fileInfo(const QModelIndex &index) const
+{
+ Q_D(const QFileSystemModel);
+ return d->node(index)->fileInfo();
+}
+
+/*!
+ \fn void QFileSystemModel::rootPathChanged(const QString &newPath);
+
+ This signal is emitted whenever the root path has been changed to a \a newPath.
+*/
+
+/*!
+ \fn void QFileSystemModel::fileRenamed(const QString &path, const QString &oldName, const QString &newName)
+
+ This signal is emitted whenever a file with the \a oldName is successfully
+ renamed to \a newName. The file is located in the directory \a path.
+*/
+
+/*!
+ \since 4.7
+ \fn void QFileSystemModel::directoryLoaded(const QString &path)
+
+ This signal is emitted when the gatherer thread has finished to load the \a path.
+
+*/
+
+/*!
+ \fn bool QFileSystemModel::remove(const QModelIndex &index)
+
+ Removes the model item \a index from the file system model and \b{deletes the
+ corresponding file from the file system}, returning true if successful. If the
+ item cannot be removed, false is returned.
+
+ \warning This function deletes files from the file system; it does \b{not}
+ move them to a location where they can be recovered.
+
+ \sa rmdir()
+*/
+
+bool QFileSystemModel::remove(const QModelIndex &aindex)
+{
+ Q_D(QFileSystemModel);
+
+ const QString path = d->filePath(aindex);
+ const QFileInfo fileInfo(path);
+#if QT_CONFIG(filesystemwatcher) && defined(Q_OS_WIN)
+ // QTBUG-65683: Remove file system watchers prior to deletion to prevent
+ // failure due to locked files on Windows.
+ const QStringList watchedPaths = d->unwatchPathsAt(aindex);
+#endif // filesystemwatcher && Q_OS_WIN
+ const bool success = (fileInfo.isFile() || fileInfo.isSymLink())
+ ? QFile::remove(path) : QDir(path).removeRecursively();
+#if QT_CONFIG(filesystemwatcher) && defined(Q_OS_WIN)
+ if (!success)
+ d->watchPaths(watchedPaths);
+#endif // filesystemwatcher && Q_OS_WIN
+ return success;
+}
+
+/*!
+ Constructs a file system model with the given \a parent.
+*/
+QFileSystemModel::QFileSystemModel(QObject *parent) :
+ QFileSystemModel(*new QFileSystemModelPrivate, parent)
+{
+}
+
+/*!
+ \internal
+*/
+QFileSystemModel::QFileSystemModel(QFileSystemModelPrivate &dd, QObject *parent)
+ : QAbstractItemModel(dd, parent)
+{
+ Q_D(QFileSystemModel);
+ d->init();
+}
+
+/*!
+ Destroys this file system model.
+*/
+QFileSystemModel::~QFileSystemModel() = default;
+
+/*!
+ \reimp
+*/
+QModelIndex QFileSystemModel::index(int row, int column, const QModelIndex &parent) const
+{
+ Q_D(const QFileSystemModel);
+ if (row < 0 || column < 0 || row >= rowCount(parent) || column >= columnCount(parent))
+ return QModelIndex();
+
+ // get the parent node
+ QFileSystemModelPrivate::QFileSystemNode *parentNode = (d->indexValid(parent) ? d->node(parent) :
+ const_cast<QFileSystemModelPrivate::QFileSystemNode*>(&d->root));
+ Q_ASSERT(parentNode);
+
+ // now get the internal pointer for the index
+ const int i = d->translateVisibleLocation(parentNode, row);
+ if (i >= parentNode->visibleChildren.size())
+ return QModelIndex();
+ const QString &childName = parentNode->visibleChildren.at(i);
+ const QFileSystemModelPrivate::QFileSystemNode *indexNode = parentNode->children.value(childName);
+ Q_ASSERT(indexNode);
+
+ return createIndex(row, column, const_cast<QFileSystemModelPrivate::QFileSystemNode*>(indexNode));
+}
+
+/*!
+ \reimp
+*/
+QModelIndex QFileSystemModel::sibling(int row, int column, const QModelIndex &idx) const
+{
+ if (row == idx.row() && column < columnCount(idx.parent())) {
+ // cheap sibling operation: just adjust the column:
+ return createIndex(row, column, idx.internalPointer());
+ } else {
+ // for anything else: call the default implementation
+ // (this could probably be optimized, too):
+ return QAbstractItemModel::sibling(row, column, idx);
+ }
+}
+
+/*!
+ \overload
+
+ Returns the model item index for the given \a path and \a column.
+*/
+QModelIndex QFileSystemModel::index(const QString &path, int column) const
+{
+ Q_D(const QFileSystemModel);
+ QFileSystemModelPrivate::QFileSystemNode *node = d->node(path, false);
+ return d->index(node, column);
+}
+
+/*!
+ \internal
+
+ Return the QFileSystemNode that goes to index.
+ */
+QFileSystemModelPrivate::QFileSystemNode *QFileSystemModelPrivate::node(const QModelIndex &index) const
+{
+ if (!index.isValid())
+ return const_cast<QFileSystemNode*>(&root);
+ QFileSystemModelPrivate::QFileSystemNode *indexNode = static_cast<QFileSystemModelPrivate::QFileSystemNode*>(index.internalPointer());
+ Q_ASSERT(indexNode);
+ return indexNode;
+}
+
+#ifdef Q_OS_WIN32
+static QString qt_GetLongPathName(const QString &strShortPath)
+{
+ if (strShortPath.isEmpty()
+ || strShortPath == "."_L1 || strShortPath == ".."_L1)
+ return strShortPath;
+ if (strShortPath.length() == 2 && strShortPath.endsWith(u':'))
+ return strShortPath.toUpper();
+ const QString absPath = QDir(strShortPath).absolutePath();
+ if (absPath.startsWith("//"_L1)
+ || absPath.startsWith("\\\\"_L1)) // unc
+ return QDir::fromNativeSeparators(absPath);
+ if (absPath.startsWith(u'/'))
+ return QString();
+ const QString inputString = "\\\\?\\"_L1 + QDir::toNativeSeparators(absPath);
+ QVarLengthArray<TCHAR, MAX_PATH> buffer(MAX_PATH);
+ DWORD result = ::GetLongPathName((wchar_t*)inputString.utf16(),
+ buffer.data(),
+ buffer.size());
+ if (result > DWORD(buffer.size())) {
+ buffer.resize(result);
+ result = ::GetLongPathName((wchar_t*)inputString.utf16(),
+ buffer.data(),
+ buffer.size());
+ }
+ if (result > 4) {
+ QString longPath = QString::fromWCharArray(buffer.data() + 4); // ignoring prefix
+ longPath[0] = longPath.at(0).toUpper(); // capital drive letters
+ return QDir::fromNativeSeparators(longPath);
+ } else {
+ return QDir::fromNativeSeparators(strShortPath);
+ }
+}
+#endif
+
+/*!
+ \internal
+
+ Given a path return the matching QFileSystemNode or &root if invalid
+*/
+QFileSystemModelPrivate::QFileSystemNode *QFileSystemModelPrivate::node(const QString &path, bool fetch) const
+{
+ Q_Q(const QFileSystemModel);
+ Q_UNUSED(q);
+ if (path.isEmpty() || path == myComputer() || path.startsWith(u':'))
+ return const_cast<QFileSystemModelPrivate::QFileSystemNode*>(&root);
+
+ // Construct the nodes up to the new root path if they need to be built
+ QString absolutePath;
+#ifdef Q_OS_WIN32
+ QString longPath = qt_GetLongPathName(path);
+#else
+ QString longPath = path;
+#endif
+ if (longPath == rootDir.path())
+ absolutePath = rootDir.absolutePath();
+ else
+ absolutePath = QDir(longPath).absolutePath();
+
+ // ### TODO can we use bool QAbstractFileEngine::caseSensitive() const?
+ QStringList pathElements = absolutePath.split(u'/', Qt::SkipEmptyParts);
+ if ((pathElements.isEmpty())
+#if !defined(Q_OS_WIN)
+ && QDir::fromNativeSeparators(longPath) != "/"_L1
+#endif
+ )
+ return const_cast<QFileSystemModelPrivate::QFileSystemNode*>(&root);
+ QModelIndex index = QModelIndex(); // start with "My Computer"
+ QString elementPath;
+ QChar separator = u'/';
+ QString trailingSeparator;
+#if defined(Q_OS_WIN)
+ if (absolutePath.startsWith("//"_L1)) { // UNC path
+ QString host = "\\\\"_L1 + pathElements.constFirst();
+ if (absolutePath == QDir::fromNativeSeparators(host))
+ absolutePath.append(u'/');
+ if (longPath.endsWith(u'/') && !absolutePath.endsWith(u'/'))
+ absolutePath.append(u'/');
+ if (absolutePath.endsWith(u'/'))
+ trailingSeparator = "\\"_L1;
+ int r = 0;
+ auto rootNode = const_cast<QFileSystemModelPrivate::QFileSystemNode*>(&root);
+ auto it = root.children.constFind(host);
+ if (it != root.children.cend()) {
+ host = it.key(); // Normalize case for lookup in visibleLocation()
+ } else {
+ if (pathElements.count() == 1 && !absolutePath.endsWith(u'/'))
+ return rootNode;
+ QFileInfo info(host);
+ if (!info.exists())
+ return rootNode;
+ QFileSystemModelPrivate *p = const_cast<QFileSystemModelPrivate*>(this);
+ p->addNode(rootNode, host,info);
+ p->addVisibleFiles(rootNode, QStringList(host));
+ }
+ r = rootNode->visibleLocation(host);
+ r = translateVisibleLocation(rootNode, r);
+ index = q->index(r, 0, QModelIndex());
+ pathElements.pop_front();
+ separator = u'\\';
+ elementPath = host;
+ elementPath.append(separator);
+ } else {
+ if (!pathElements.at(0).contains(u':')) {
+ QString rootPath = QDir(longPath).rootPath();
+ pathElements.prepend(rootPath);
+ }
+ if (pathElements.at(0).endsWith(u'/'))
+ pathElements[0].chop(1);
+ }
+#else
+ // add the "/" item, since it is a valid path element on Unix
+ if (absolutePath[0] == u'/')
+ pathElements.prepend("/"_L1);
+#endif
+
+ QFileSystemModelPrivate::QFileSystemNode *parent = node(index);
+
+ for (int i = 0; i < pathElements.size(); ++i) {
+ QString element = pathElements.at(i);
+ if (i != 0)
+ elementPath.append(separator);
+ elementPath.append(element);
+ if (i == pathElements.size() - 1)
+ elementPath.append(trailingSeparator);
+#ifdef Q_OS_WIN
+ // On Windows, "filename " and "filename" are equivalent and
+ // "filename . " and "filename" are equivalent
+ // "filename......." and "filename" are equivalent Task #133928
+ // whereas "filename .txt" is still "filename .txt"
+ // If after stripping the characters there is nothing left then we
+ // just return the parent directory as it is assumed that the path
+ // is referring to the parent
+ while (element.endsWith(u'.') || element.endsWith(u' '))
+ element.chop(1);
+ // Only filenames that can't possibly exist will be end up being empty
+ if (element.isEmpty())
+ return parent;
+#endif
+ bool alreadyExisted = parent->children.contains(element);
+
+ // we couldn't find the path element, we create a new node since we
+ // _know_ that the path is valid
+ if (alreadyExisted) {
+ if ((parent->children.size() == 0)
+ || (parent->caseSensitive()
+ && parent->children.value(element)->fileName != element)
+ || (!parent->caseSensitive()
+ && parent->children.value(element)->fileName.toLower() != element.toLower()))
+ alreadyExisted = false;
+ }
+
+ QFileSystemModelPrivate::QFileSystemNode *node;
+ if (!alreadyExisted) {
+ // Someone might call ::index("file://cookie/monster/doesn't/like/veggies"),
+ // a path that doesn't exists, I.E. don't blindly create directories.
+ QFileInfo info(elementPath);
+ if (!info.exists())
+ return const_cast<QFileSystemModelPrivate::QFileSystemNode*>(&root);
+ QFileSystemModelPrivate *p = const_cast<QFileSystemModelPrivate*>(this);
+ node = p->addNode(parent, element,info);
+#if QT_CONFIG(filesystemwatcher)
+ node->populate(fileInfoGatherer->getInfo(info));
+#endif
+ } else {
+ node = parent->children.value(element);
+ }
+
+ Q_ASSERT(node);
+ if (!node->isVisible) {
+ // It has been filtered out
+ if (alreadyExisted && node->hasInformation() && !fetch)
+ return const_cast<QFileSystemModelPrivate::QFileSystemNode*>(&root);
+
+ QFileSystemModelPrivate *p = const_cast<QFileSystemModelPrivate*>(this);
+ p->addVisibleFiles(parent, QStringList(element));
+ if (!p->bypassFilters.contains(node))
+ p->bypassFilters[node] = 1;
+ QString dir = q->filePath(this->index(parent));
+ if (!node->hasInformation() && fetch) {
+ Fetching f = { std::move(dir), std::move(element), node };
+ p->toFetch.append(std::move(f));
+ p->fetchingTimer.start(0, const_cast<QFileSystemModel*>(q));
+ }
+ }
+ parent = node;
+ }
+
+ return parent;
+}
+
+/*!
+ \reimp
+*/
+void QFileSystemModel::timerEvent(QTimerEvent *event)
+{
+ Q_D(QFileSystemModel);
+ if (event->timerId() == d->fetchingTimer.timerId()) {
+ d->fetchingTimer.stop();
+#if QT_CONFIG(filesystemwatcher)
+ for (int i = 0; i < d->toFetch.size(); ++i) {
+ const QFileSystemModelPrivate::QFileSystemNode *node = d->toFetch.at(i).node;
+ if (!node->hasInformation()) {
+ d->fileInfoGatherer->fetchExtendedInformation(d->toFetch.at(i).dir,
+ QStringList(d->toFetch.at(i).file));
+ } else {
+ // qDebug("yah!, you saved a little gerbil soul");
+ }
+ }
+#endif
+ d->toFetch.clear();
+ }
+}
+
+/*!
+ Returns \c true if the model item \a index represents a directory;
+ otherwise returns \c false.
+*/
+bool QFileSystemModel::isDir(const QModelIndex &index) const
+{
+ // This function is for public usage only because it could create a file info
+ Q_D(const QFileSystemModel);
+ if (!index.isValid())
+ return true;
+ QFileSystemModelPrivate::QFileSystemNode *n = d->node(index);
+ if (n->hasInformation())
+ return n->isDir();
+ return fileInfo(index).isDir();
+}
+
+/*!
+ Returns the size in bytes of \a index. If the file does not exist, 0 is returned.
+ */
+qint64 QFileSystemModel::size(const QModelIndex &index) const
+{
+ Q_D(const QFileSystemModel);
+ if (!index.isValid())
+ return 0;
+ return d->node(index)->size();
+}
+
+/*!
+ Returns the type of file \a index such as "Directory" or "JPEG file".
+ */
+QString QFileSystemModel::type(const QModelIndex &index) const
+{
+ Q_D(const QFileSystemModel);
+ if (!index.isValid())
+ return QString();
+ return d->node(index)->type();
+}
+
+/*!
+ Returns the date and time (in local time) when \a index was last modified.
+
+ This is an overloaded function, equivalent to calling:
+ \code
+ lastModified(index, QTimeZone::LocalTime);
+ \endcode
+
+ If \a index is invalid, a default constructed QDateTime is returned.
+ */
+QDateTime QFileSystemModel::lastModified(const QModelIndex &index) const
+{
+ return lastModified(index, QTimeZone::LocalTime);
+}
+
+/*!
+ \since 6.6
+ Returns the date and time, in the time zone \a tz, when
+ \a index was last modified.
+
+ Typical arguments for \a tz are \c QTimeZone::UTC or \c QTimeZone::LocalTime.
+ UTC does not require any conversion from the time returned by the native file
+ system API, therefore getting the time in UTC is potentially faster. LocalTime
+ is typically chosen if the time is shown to the user.
+
+ If \a index is invalid, a default constructed QDateTime is returned.
+ */
+QDateTime QFileSystemModel::lastModified(const QModelIndex &index, const QTimeZone &tz) const
+{
+ Q_D(const QFileSystemModel);
+ if (!index.isValid())
+ return QDateTime();
+ return d->node(index)->lastModified(tz);
+}
+
+/*!
+ \reimp
+*/
+QModelIndex QFileSystemModel::parent(const QModelIndex &index) const
+{
+ Q_D(const QFileSystemModel);
+ if (!d->indexValid(index))
+ return QModelIndex();
+
+ QFileSystemModelPrivate::QFileSystemNode *indexNode = d->node(index);
+ Q_ASSERT(indexNode != nullptr);
+ QFileSystemModelPrivate::QFileSystemNode *parentNode = indexNode->parent;
+ if (parentNode == nullptr || parentNode == &d->root)
+ return QModelIndex();
+
+ // get the parent's row
+ QFileSystemModelPrivate::QFileSystemNode *grandParentNode = parentNode->parent;
+ Q_ASSERT(grandParentNode->children.contains(parentNode->fileName));
+ int visualRow = d->translateVisibleLocation(grandParentNode, grandParentNode->visibleLocation(grandParentNode->children.value(parentNode->fileName)->fileName));
+ if (visualRow == -1)
+ return QModelIndex();
+ return createIndex(visualRow, 0, parentNode);
+}
+
+/*
+ \internal
+
+ return the index for node
+*/
+QModelIndex QFileSystemModelPrivate::index(const QFileSystemModelPrivate::QFileSystemNode *node, int column) const
+{
+ Q_Q(const QFileSystemModel);
+ QFileSystemModelPrivate::QFileSystemNode *parentNode = (node ? node->parent : nullptr);
+ if (node == &root || !parentNode)
+ return QModelIndex();
+
+ // get the parent's row
+ Q_ASSERT(node);
+ if (!node->isVisible)
+ return QModelIndex();
+
+ int visualRow = translateVisibleLocation(parentNode, parentNode->visibleLocation(node->fileName));
+ return q->createIndex(visualRow, column, const_cast<QFileSystemNode*>(node));
+}
+
+/*!
+ \reimp
+*/
+bool QFileSystemModel::hasChildren(const QModelIndex &parent) const
+{
+ Q_D(const QFileSystemModel);
+ if (parent.column() > 0)
+ return false;
+
+ if (!parent.isValid()) // drives
+ return true;
+
+ const QFileSystemModelPrivate::QFileSystemNode *indexNode = d->node(parent);
+ Q_ASSERT(indexNode);
+ return (indexNode->isDir());
+}
+
+/*!
+ \reimp
+ */
+bool QFileSystemModel::canFetchMore(const QModelIndex &parent) const
+{
+ Q_D(const QFileSystemModel);
+ if (!d->setRootPath)
+ return false;
+ const QFileSystemModelPrivate::QFileSystemNode *indexNode = d->node(parent);
+ return (!indexNode->populatedChildren);
+}
+
+/*!
+ \reimp
+ */
+void QFileSystemModel::fetchMore(const QModelIndex &parent)
+{
+ Q_D(QFileSystemModel);
+ if (!d->setRootPath)
+ return;
+ QFileSystemModelPrivate::QFileSystemNode *indexNode = d->node(parent);
+ if (indexNode->populatedChildren)
+ return;
+ indexNode->populatedChildren = true;
+#if QT_CONFIG(filesystemwatcher)
+ d->fileInfoGatherer->list(filePath(parent));
+#endif
+}
+
+/*!
+ \reimp
+*/
+int QFileSystemModel::rowCount(const QModelIndex &parent) const
+{
+ Q_D(const QFileSystemModel);
+ if (parent.column() > 0)
+ return 0;
+
+ if (!parent.isValid())
+ return d->root.visibleChildren.size();
+
+ const QFileSystemModelPrivate::QFileSystemNode *parentNode = d->node(parent);
+ return parentNode->visibleChildren.size();
+}
+
+/*!
+ \reimp
+*/
+int QFileSystemModel::columnCount(const QModelIndex &parent) const
+{
+ return (parent.column() > 0) ? 0 : QFileSystemModelPrivate::NumColumns;
+}
+
+/*!
+ Returns the data stored under the given \a role for the item "My Computer".
+
+ \sa Qt::ItemDataRole
+ */
+QVariant QFileSystemModel::myComputer(int role) const
+{
+#if QT_CONFIG(filesystemwatcher)
+ Q_D(const QFileSystemModel);
+#endif
+ switch (role) {
+ case Qt::DisplayRole:
+ return QFileSystemModelPrivate::myComputer();
+#if QT_CONFIG(filesystemwatcher)
+ case Qt::DecorationRole:
+ if (auto *provider = d->fileInfoGatherer->iconProvider())
+ return provider->icon(QAbstractFileIconProvider::Computer);
+ break;
+#endif
+ }
+ return QVariant();
+}
+
+/*!
+ \reimp
+*/
+QVariant QFileSystemModel::data(const QModelIndex &index, int role) const
+{
+ Q_D(const QFileSystemModel);
+ if (!index.isValid() || index.model() != this)
+ return QVariant();
+
+ switch (role) {
+ case Qt::EditRole:
+ if (index.column() == QFileSystemModelPrivate::NameColumn)
+ return d->name(index);
+ Q_FALLTHROUGH();
+ case Qt::DisplayRole:
+ switch (index.column()) {
+ case QFileSystemModelPrivate::NameColumn: return d->displayName(index);
+ case QFileSystemModelPrivate::SizeColumn: return d->size(index);
+ case QFileSystemModelPrivate::TypeColumn: return d->type(index);
+ case QFileSystemModelPrivate::TimeColumn: return d->time(index);
+ default:
+ qWarning("data: invalid display value column %d", index.column());
+ break;
+ }
+ break;
+ case FilePathRole:
+ return filePath(index);
+ case FileNameRole:
+ return d->name(index);
+ case FileInfoRole:
+ return QVariant::fromValue(fileInfo(index));
+ case Qt::DecorationRole:
+ if (index.column() == QFileSystemModelPrivate::NameColumn) {
+ QIcon icon = d->icon(index);
+#if QT_CONFIG(filesystemwatcher)
+ if (icon.isNull()) {
+ using P = QAbstractFileIconProvider;
+ if (auto *provider = d->fileInfoGatherer->iconProvider())
+ icon = provider->icon(d->node(index)->isDir() ? P::Folder: P::File);
+ }
+#endif // filesystemwatcher
+ return icon;
+ }
+ break;
+ case Qt::TextAlignmentRole:
+ if (index.column() == QFileSystemModelPrivate::SizeColumn)
+ return QVariant(Qt::AlignTrailing | Qt::AlignVCenter);
+ break;
+ case FilePermissions:
+ int p = permissions(index);
+ return p;
+ }
+
+ return QVariant();
+}
+
+/*!
+ \internal
+*/
+QString QFileSystemModelPrivate::size(const QModelIndex &index) const
+{
+ if (!index.isValid())
+ return QString();
+ const QFileSystemNode *n = node(index);
+ if (n->isDir()) {
+#ifdef Q_OS_MAC
+ return "--"_L1;
+#else
+ return ""_L1;
+#endif
+ // Windows - ""
+ // OS X - "--"
+ // Konqueror - "4 KB"
+ // Nautilus - "9 items" (the number of children)
+ }
+ return size(n->size());
+}
+
+QString QFileSystemModelPrivate::size(qint64 bytes)
+{
+ return QLocale::system().formattedDataSize(bytes);
+}
+
+/*!
+ \internal
+*/
+QString QFileSystemModelPrivate::time(const QModelIndex &index) const
+{
+ if (!index.isValid())
+ return QString();
+#if QT_CONFIG(datestring)
+ return QLocale::system().toString(node(index)->lastModified(QTimeZone::LocalTime), QLocale::ShortFormat);
+#else
+ Q_UNUSED(index);
+ return QString();
+#endif
+}
+
+/*
+ \internal
+*/
+QString QFileSystemModelPrivate::type(const QModelIndex &index) const
+{
+ if (!index.isValid())
+ return QString();
+ return node(index)->type();
+}
+
+/*!
+ \internal
+*/
+QString QFileSystemModelPrivate::name(const QModelIndex &index) const
+{
+ if (!index.isValid())
+ return QString();
+ QFileSystemNode *dirNode = node(index);
+ if (
+#if QT_CONFIG(filesystemwatcher)
+ fileInfoGatherer->resolveSymlinks() &&
+#endif
+ !resolvedSymLinks.isEmpty() && dirNode->isSymLink(/* ignoreNtfsSymLinks = */ true)) {
+ QString fullPath = QDir::fromNativeSeparators(filePath(index));
+ return resolvedSymLinks.value(fullPath, dirNode->fileName);
+ }
+ return dirNode->fileName;
+}
+
+/*!
+ \internal
+*/
+QString QFileSystemModelPrivate::displayName(const QModelIndex &index) const
+{
+#if defined(Q_OS_WIN)
+ QFileSystemNode *dirNode = node(index);
+ if (!dirNode->volumeName.isEmpty())
+ return dirNode->volumeName;
+#endif
+ return name(index);
+}
+
+/*!
+ \internal
+*/
+QIcon QFileSystemModelPrivate::icon(const QModelIndex &index) const
+{
+ if (!index.isValid())
+ return QIcon();
+ return node(index)->icon();
+}
+
+/*!
+ \reimp
+*/
+bool QFileSystemModel::setData(const QModelIndex &idx, const QVariant &value, int role)
+{
+ Q_D(QFileSystemModel);
+ if (!idx.isValid()
+ || idx.column() != 0
+ || role != Qt::EditRole
+ || (flags(idx) & Qt::ItemIsEditable) == 0) {
+ return false;
+ }
+
+ QString newName = value.toString();
+ QString oldName = idx.data().toString();
+ if (newName == oldName)
+ return true;
+
+ const QString parentPath = filePath(parent(idx));
+
+ if (newName.isEmpty() || QDir::toNativeSeparators(newName).contains(QDir::separator()))
+ return false;
+
+#if QT_CONFIG(filesystemwatcher) && defined(Q_OS_WIN)
+ // QTBUG-65683: Remove file system watchers prior to renaming to prevent
+ // failure due to locked files on Windows.
+ const QStringList watchedPaths = d->unwatchPathsAt(idx);
+#endif // filesystemwatcher && Q_OS_WIN
+ if (!QDir(parentPath).rename(oldName, newName)) {
+#if QT_CONFIG(filesystemwatcher) && defined(Q_OS_WIN)
+ d->watchPaths(watchedPaths);
+#endif
+ return false;
+ } else {
+ /*
+ *After re-naming something we don't want the selection to change*
+ - can't remove rows and later insert
+ - can't quickly remove and insert
+ - index pointer can't change because treeview doesn't use persistent index's
+
+ - if this get any more complicated think of changing it to just
+ use layoutChanged
+ */
+
+ QFileSystemModelPrivate::QFileSystemNode *indexNode = d->node(idx);
+ QFileSystemModelPrivate::QFileSystemNode *parentNode = indexNode->parent;
+ int visibleLocation = parentNode->visibleLocation(parentNode->children.value(indexNode->fileName)->fileName);
+
+ parentNode->visibleChildren.removeAt(visibleLocation);
+ std::unique_ptr<QFileSystemModelPrivate::QFileSystemNode> nodeToRename(parentNode->children.take(oldName));
+ nodeToRename->fileName = newName;
+ nodeToRename->parent = parentNode;
+#if QT_CONFIG(filesystemwatcher)
+ nodeToRename->populate(d->fileInfoGatherer->getInfo(QFileInfo(parentPath, newName)));
+#endif
+ nodeToRename->isVisible = true;
+ parentNode->children[newName] = nodeToRename.release();
+ parentNode->visibleChildren.insert(visibleLocation, newName);
+
+ d->delayedSort();
+ emit fileRenamed(parentPath, oldName, newName);
+ }
+ return true;
+}
+
+/*!
+ \reimp
+*/
+QVariant QFileSystemModel::headerData(int section, Qt::Orientation orientation, int role) const
+{
+ switch (role) {
+ case Qt::DecorationRole:
+ if (section == 0) {
+ // ### TODO oh man this is ugly and doesn't even work all the way!
+ // it is still 2 pixels off
+ QImage pixmap(16, 1, QImage::Format_ARGB32_Premultiplied);
+ pixmap.fill(Qt::transparent);
+ return pixmap;
+ }
+ break;
+ case Qt::TextAlignmentRole:
+ return Qt::AlignLeft;
+ }
+
+ if (orientation != Qt::Horizontal || role != Qt::DisplayRole)
+ return QAbstractItemModel::headerData(section, orientation, role);
+
+ QString returnValue;
+ switch (section) {
+ case QFileSystemModelPrivate::NameColumn:
+ returnValue = tr("Name");
+ break;
+ case QFileSystemModelPrivate::SizeColumn:
+ returnValue = tr("Size");
+ break;
+ case QFileSystemModelPrivate::TypeColumn:
+ returnValue =
+#ifdef Q_OS_MAC
+ tr("Kind", "Match OS X Finder");
+#else
+ tr("Type", "All other platforms");
+#endif
+ break;
+ // Windows - Type
+ // OS X - Kind
+ // Konqueror - File Type
+ // Nautilus - Type
+ case QFileSystemModelPrivate::TimeColumn:
+ returnValue = tr("Date Modified");
+ break;
+ default: return QVariant();
+ }
+ return returnValue;
+}
+
+/*!
+ \reimp
+*/
+Qt::ItemFlags QFileSystemModel::flags(const QModelIndex &index) const
+{
+ Q_D(const QFileSystemModel);
+ Qt::ItemFlags flags = QAbstractItemModel::flags(index);
+ if (!index.isValid())
+ return flags;
+
+ QFileSystemModelPrivate::QFileSystemNode *indexNode = d->node(index);
+ if (d->nameFilterDisables && !d->passNameFilters(indexNode)) {
+ flags &= ~Qt::ItemIsEnabled;
+ // ### TODO you shouldn't be able to set this as the current item, task 119433
+ return flags;
+ }
+
+ flags |= Qt::ItemIsDragEnabled;
+
+ if (!indexNode->isDir())
+ flags |= Qt::ItemNeverHasChildren;
+ if (d->readOnly)
+ return flags;
+ if ((index.column() == 0) && indexNode->permissions() & QFile::WriteUser) {
+ flags |= Qt::ItemIsEditable;
+ if (indexNode->isDir())
+ flags |= Qt::ItemIsDropEnabled;
+ }
+ return flags;
+}
+
+/*!
+ \internal
+*/
+void QFileSystemModelPrivate::performDelayedSort()
+{
+ Q_Q(QFileSystemModel);
+ q->sort(sortColumn, sortOrder);
+}
+
+
+/*
+ \internal
+ Helper functor used by sort()
+*/
+class QFileSystemModelSorter
+{
+public:
+ inline QFileSystemModelSorter(int column) : sortColumn(column)
+ {
+ naturalCompare.setNumericMode(true);
+ naturalCompare.setCaseSensitivity(Qt::CaseInsensitive);
+ }
+
+ bool compareNodes(const QFileSystemModelPrivate::QFileSystemNode *l,
+ const QFileSystemModelPrivate::QFileSystemNode *r) const
+ {
+ switch (sortColumn) {
+ case QFileSystemModelPrivate::NameColumn: {
+#ifndef Q_OS_MAC
+ // place directories before files
+ bool left = l->isDir();
+ bool right = r->isDir();
+ if (left ^ right)
+ return left;
+#endif
+ return naturalCompare.compare(l->fileName, r->fileName) < 0;
+ }
+ case QFileSystemModelPrivate::SizeColumn:
+ {
+ // Directories go first
+ bool left = l->isDir();
+ bool right = r->isDir();
+ if (left ^ right)
+ return left;
+
+ qint64 sizeDifference = l->size() - r->size();
+ if (sizeDifference == 0)
+ return naturalCompare.compare(l->fileName, r->fileName) < 0;
+
+ return sizeDifference < 0;
+ }
+ case QFileSystemModelPrivate::TypeColumn:
+ {
+ int compare = naturalCompare.compare(l->type(), r->type());
+ if (compare == 0)
+ return naturalCompare.compare(l->fileName, r->fileName) < 0;
+
+ return compare < 0;
+ }
+ case QFileSystemModelPrivate::TimeColumn:
+ {
+ const QDateTime left = l->lastModified(QTimeZone::UTC);
+ const QDateTime right = r->lastModified(QTimeZone::UTC);
+ if (left == right)
+ return naturalCompare.compare(l->fileName, r->fileName) < 0;
+
+ return left < right;
+ }
+ }
+ Q_ASSERT(false);
+ return false;
+ }
+
+ bool operator()(const QFileSystemModelPrivate::QFileSystemNode *l,
+ const QFileSystemModelPrivate::QFileSystemNode *r) const
+ {
+ return compareNodes(l, r);
+ }
+
+
+private:
+ QCollator naturalCompare;
+ int sortColumn;
+};
+
+/*
+ \internal
+
+ Sort all of the children of parent
+*/
+void QFileSystemModelPrivate::sortChildren(int column, const QModelIndex &parent)
+{
+ Q_Q(QFileSystemModel);
+ QFileSystemModelPrivate::QFileSystemNode *indexNode = node(parent);
+ if (indexNode->children.size() == 0)
+ return;
+
+ QList<QFileSystemModelPrivate::QFileSystemNode *> values;
+
+ for (auto iterator = indexNode->children.constBegin(), cend = indexNode->children.constEnd(); iterator != cend; ++iterator) {
+ if (filtersAcceptsNode(iterator.value())) {
+ values.append(iterator.value());
+ } else {
+ iterator.value()->isVisible = false;
+ }
+ }
+ QFileSystemModelSorter ms(column);
+ std::sort(values.begin(), values.end(), ms);
+ // First update the new visible list
+ indexNode->visibleChildren.clear();
+ //No more dirty item we reset our internal dirty index
+ indexNode->dirtyChildrenIndex = -1;
+ indexNode->visibleChildren.reserve(values.size());
+ for (QFileSystemNode *node : std::as_const(values)) {
+ indexNode->visibleChildren.append(node->fileName);
+ node->isVisible = true;
+ }
+
+ if (!disableRecursiveSort) {
+ for (int i = 0; i < q->rowCount(parent); ++i) {
+ const QModelIndex childIndex = q->index(i, 0, parent);
+ QFileSystemModelPrivate::QFileSystemNode *indexNode = node(childIndex);
+ //Only do a recursive sort on visible nodes
+ if (indexNode->isVisible)
+ sortChildren(column, childIndex);
+ }
+ }
+}
+
+/*!
+ \reimp
+*/
+void QFileSystemModel::sort(int column, Qt::SortOrder order)
+{
+ Q_D(QFileSystemModel);
+ if (d->sortOrder == order && d->sortColumn == column && !d->forceSort)
+ return;
+
+ emit layoutAboutToBeChanged();
+ QModelIndexList oldList = persistentIndexList();
+ QList<QPair<QFileSystemModelPrivate::QFileSystemNode *, int>> oldNodes;
+ oldNodes.reserve(oldList.size());
+ for (const QModelIndex &oldNode : oldList) {
+ QPair<QFileSystemModelPrivate::QFileSystemNode*, int> pair(d->node(oldNode), oldNode.column());
+ oldNodes.append(pair);
+ }
+
+ if (!(d->sortColumn == column && d->sortOrder != order && !d->forceSort)) {
+ //we sort only from where we are, don't need to sort all the model
+ d->sortChildren(column, index(rootPath()));
+ d->sortColumn = column;
+ d->forceSort = false;
+ }
+ d->sortOrder = order;
+
+ QModelIndexList newList;
+ newList.reserve(oldNodes.size());
+ for (const auto &[node, col]: std::as_const(oldNodes))
+ newList.append(d->index(node, col));
+
+ changePersistentIndexList(oldList, newList);
+ emit layoutChanged();
+}
+
+/*!
+ Returns a list of MIME types that can be used to describe a list of items
+ in the model.
+*/
+QStringList QFileSystemModel::mimeTypes() const
+{
+ return QStringList("text/uri-list"_L1);
+}
+
+/*!
+ Returns an object that contains a serialized description of the specified
+ \a indexes. The format used to describe the items corresponding to the
+ indexes is obtained from the mimeTypes() function.
+
+ If the list of indexes is empty, \nullptr is returned rather than a
+ serialized empty list.
+*/
+QMimeData *QFileSystemModel::mimeData(const QModelIndexList &indexes) const
+{
+ QList<QUrl> urls;
+ QList<QModelIndex>::const_iterator it = indexes.begin();
+ for (; it != indexes.end(); ++it)
+ if ((*it).column() == QFileSystemModelPrivate::NameColumn)
+ urls << QUrl::fromLocalFile(filePath(*it));
+ QMimeData *data = new QMimeData();
+ data->setUrls(urls);
+ return data;
+}
+
+/*!
+ Handles the \a data supplied by a drag and drop operation that ended with
+ the given \a action over the row in the model specified by the \a row and
+ \a column and by the \a parent index. Returns true if the operation was
+ successful.
+
+ \sa supportedDropActions()
+*/
+bool QFileSystemModel::dropMimeData(const QMimeData *data, Qt::DropAction action,
+ int row, int column, const QModelIndex &parent)
+{
+ Q_UNUSED(row);
+ Q_UNUSED(column);
+ if (!parent.isValid() || isReadOnly())
+ return false;
+
+ bool success = true;
+ QString to = filePath(parent) + QDir::separator();
+
+ QList<QUrl> urls = data->urls();
+ QList<QUrl>::const_iterator it = urls.constBegin();
+
+ switch (action) {
+ case Qt::CopyAction:
+ for (; it != urls.constEnd(); ++it) {
+ QString path = (*it).toLocalFile();
+ success = QFile::copy(path, to + QFileInfo(path).fileName()) && success;
+ }
+ break;
+ case Qt::LinkAction:
+ for (; it != urls.constEnd(); ++it) {
+ QString path = (*it).toLocalFile();
+ success = QFile::link(path, to + QFileInfo(path).fileName()) && success;
+ }
+ break;
+ case Qt::MoveAction:
+ for (; it != urls.constEnd(); ++it) {
+ QString path = (*it).toLocalFile();
+ success = QFile::rename(path, to + QFileInfo(path).fileName()) && success;
+ }
+ break;
+ default:
+ return false;
+ }
+
+ return success;
+}
+
+/*!
+ \reimp
+*/
+Qt::DropActions QFileSystemModel::supportedDropActions() const
+{
+ return Qt::CopyAction | Qt::MoveAction | Qt::LinkAction;
+}
+
+/*!
+ \reimp
+*/
+QHash<int, QByteArray> QFileSystemModel::roleNames() const
+{
+ auto ret = QAbstractItemModel::roleNames();
+ ret.insert(QFileSystemModel::FileIconRole,
+ QByteArrayLiteral("fileIcon")); // == Qt::decoration
+ ret.insert(QFileSystemModel::FilePathRole, QByteArrayLiteral("filePath"));
+ ret.insert(QFileSystemModel::FileNameRole, QByteArrayLiteral("fileName"));
+ ret.insert(QFileSystemModel::FilePermissions, QByteArrayLiteral("filePermissions"));
+ ret.insert(QFileSystemModel::FileInfoRole, QByteArrayLiteral("fileInfo"));
+ return ret;
+}
+
+/*!
+ \enum QFileSystemModel::Option
+ \since 5.14
+
+ \value DontWatchForChanges Do not add file watchers to the paths.
+ This reduces overhead when using the model for simple tasks
+ like line edit completion.
+
+ \value DontResolveSymlinks Don't resolve symlinks in the file
+ system model. By default, symlinks are resolved.
+
+ \value DontUseCustomDirectoryIcons Always use the default directory icon.
+ Some platforms allow the user to set a different icon. Custom icon lookup
+ causes a big performance impact over network or removable drives.
+ This sets the QFileIconProvider::DontUseCustomDirectoryIcons
+ option in the icon provider accordingly.
+
+ \sa resolveSymlinks
+*/
+
+/*!
+ \since 5.14
+ Sets the given \a option to be enabled if \a on is true; otherwise,
+ clears the given \a option.
+
+ Options should be set before changing properties.
+
+ \sa options, testOption()
+*/
+void QFileSystemModel::setOption(Option option, bool on)
+{
+ QFileSystemModel::Options previousOptions = options();
+ setOptions(previousOptions.setFlag(option, on));
+}
+
+/*!
+ \since 5.14
+
+ Returns \c true if the given \a option is enabled; otherwise, returns
+ false.
+
+ \sa options, setOption()
+*/
+bool QFileSystemModel::testOption(Option option) const
+{
+ return options().testFlag(option);
+}
+
+/*!
+ \property QFileSystemModel::options
+ \brief the various options that affect the model
+ \since 5.14
+
+ By default, all options are disabled.
+
+ Options should be set before changing properties.
+
+ \sa setOption(), testOption()
+*/
+void QFileSystemModel::setOptions(Options options)
+{
+ const Options changed = (options ^ QFileSystemModel::options());
+
+ if (changed.testFlag(DontResolveSymlinks))
+ setResolveSymlinks(!options.testFlag(DontResolveSymlinks));
+
+#if QT_CONFIG(filesystemwatcher)
+ Q_D(QFileSystemModel);
+ if (changed.testFlag(DontWatchForChanges))
+ d->fileInfoGatherer->setWatching(!options.testFlag(DontWatchForChanges));
+#endif
+
+ if (changed.testFlag(DontUseCustomDirectoryIcons)) {
+ if (auto provider = iconProvider()) {
+ QAbstractFileIconProvider::Options providerOptions = provider->options();
+ providerOptions.setFlag(QAbstractFileIconProvider::DontUseCustomDirectoryIcons,
+ options.testFlag(QFileSystemModel::DontUseCustomDirectoryIcons));
+ provider->setOptions(providerOptions);
+ } else {
+ qWarning("Setting QFileSystemModel::DontUseCustomDirectoryIcons has no effect when no provider is used");
+ }
+ }
+}
+
+QFileSystemModel::Options QFileSystemModel::options() const
+{
+ QFileSystemModel::Options result;
+ result.setFlag(DontResolveSymlinks, !resolveSymlinks());
+#if QT_CONFIG(filesystemwatcher)
+ Q_D(const QFileSystemModel);
+ result.setFlag(DontWatchForChanges, !d->fileInfoGatherer->isWatching());
+#else
+ result.setFlag(DontWatchForChanges);
+#endif
+ if (auto provider = iconProvider()) {
+ result.setFlag(DontUseCustomDirectoryIcons,
+ provider->options().testFlag(QAbstractFileIconProvider::DontUseCustomDirectoryIcons));
+ }
+ return result;
+}
+
+/*!
+ Returns the path of the item stored in the model under the
+ \a index given.
+*/
+QString QFileSystemModel::filePath(const QModelIndex &index) const
+{
+ Q_D(const QFileSystemModel);
+ QString fullPath = d->filePath(index);
+ QFileSystemModelPrivate::QFileSystemNode *dirNode = d->node(index);
+ if (dirNode->isSymLink()
+#if QT_CONFIG(filesystemwatcher)
+ && d->fileInfoGatherer->resolveSymlinks()
+#endif
+ && d->resolvedSymLinks.contains(fullPath)
+ && dirNode->isDir()) {
+ QFileInfo fullPathInfo(dirNode->fileInfo());
+ if (!dirNode->hasInformation())
+ fullPathInfo = QFileInfo(fullPath);
+ QString canonicalPath = fullPathInfo.canonicalFilePath();
+ auto *canonicalNode = d->node(fullPathInfo.canonicalFilePath(), false);
+ QFileInfo resolvedInfo = canonicalNode->fileInfo();
+ if (!canonicalNode->hasInformation())
+ resolvedInfo = QFileInfo(canonicalPath);
+ if (resolvedInfo.exists())
+ return resolvedInfo.filePath();
+ }
+ return fullPath;
+}
+
+QString QFileSystemModelPrivate::filePath(const QModelIndex &index) const
+{
+ Q_Q(const QFileSystemModel);
+ Q_UNUSED(q);
+ if (!index.isValid())
+ return QString();
+ Q_ASSERT(index.model() == q);
+
+ QStringList path;
+ QModelIndex idx = index;
+ while (idx.isValid()) {
+ QFileSystemModelPrivate::QFileSystemNode *dirNode = node(idx);
+ if (dirNode)
+ path.prepend(dirNode->fileName);
+ idx = idx.parent();
+ }
+ QString fullPath = QDir::fromNativeSeparators(path.join(QDir::separator()));
+#if !defined(Q_OS_WIN)
+ if ((fullPath.size() > 2) && fullPath[0] == u'/' && fullPath[1] == u'/')
+ fullPath = fullPath.mid(1);
+#else
+ if (fullPath.length() == 2 && fullPath.endsWith(u':'))
+ fullPath.append(u'/');
+#endif
+ return fullPath;
+}
+
+/*!
+ Create a directory with the \a name in the \a parent model index.
+*/
+QModelIndex QFileSystemModel::mkdir(const QModelIndex &parent, const QString &name)
+{
+ Q_D(QFileSystemModel);
+ if (!parent.isValid())
+ return parent;
+
+ QDir dir(filePath(parent));
+ if (!dir.mkdir(name))
+ return QModelIndex();
+ QFileSystemModelPrivate::QFileSystemNode *parentNode = d->node(parent);
+ d->addNode(parentNode, name, QFileInfo());
+ Q_ASSERT(parentNode->children.contains(name));
+ QFileSystemModelPrivate::QFileSystemNode *node = parentNode->children[name];
+#if QT_CONFIG(filesystemwatcher)
+ node->populate(d->fileInfoGatherer->getInfo(QFileInfo(dir.absolutePath() + QDir::separator() + name)));
+#endif
+ d->addVisibleFiles(parentNode, QStringList(name));
+ return d->index(node);
+}
+
+/*!
+ Returns the complete OR-ed together combination of QFile::Permission for the \a index.
+ */
+QFile::Permissions QFileSystemModel::permissions(const QModelIndex &index) const
+{
+ Q_D(const QFileSystemModel);
+ return d->node(index)->permissions();
+}
+
+/*!
+ Sets the directory that is being watched by the model to \a newPath by
+ installing a \l{QFileSystemWatcher}{file system watcher} on it. Any
+ changes to files and directories within this directory will be
+ reflected in the model.
+
+ If the path is changed, the rootPathChanged() signal will be emitted.
+
+ \note This function does not change the structure of the model or
+ modify the data available to views. In other words, the "root" of
+ the model is \e not changed to include only files and directories
+ within the directory specified by \a newPath in the file system.
+ */
+QModelIndex QFileSystemModel::setRootPath(const QString &newPath)
+{
+ Q_D(QFileSystemModel);
+#ifdef Q_OS_WIN
+#ifdef Q_OS_WIN32
+ QString longNewPath = qt_GetLongPathName(newPath);
+#else
+ QString longNewPath = QDir::fromNativeSeparators(newPath);
+#endif
+#else
+ QString longNewPath = newPath;
+#endif
+ //we remove .. and . from the given path if exist
+ if (!newPath.isEmpty())
+ longNewPath = QDir::cleanPath(longNewPath);
+
+ d->setRootPath = true;
+
+ //user don't ask for the root path ("") but the conversion failed
+ if (!newPath.isEmpty() && longNewPath.isEmpty())
+ return d->index(rootPath());
+
+ if (d->rootDir.path() == longNewPath)
+ return d->index(rootPath());
+
+ auto node = d->node(longNewPath);
+ QFileInfo newPathInfo;
+ if (node && node->hasInformation())
+ newPathInfo = node->fileInfo();
+ else
+ newPathInfo = QFileInfo(longNewPath);
+
+ bool showDrives = (longNewPath.isEmpty() || longNewPath == QFileSystemModelPrivate::myComputer());
+ if (!showDrives && !newPathInfo.exists())
+ return d->index(rootPath());
+
+ //We remove the watcher on the previous path
+ if (!rootPath().isEmpty() && rootPath() != "."_L1) {
+ //This remove the watcher for the old rootPath
+#if QT_CONFIG(filesystemwatcher)
+ d->fileInfoGatherer->removePath(rootPath());
+#endif
+ //This line "marks" the node as dirty, so the next fetchMore
+ //call on the path will ask the gatherer to install a watcher again
+ //But it doesn't re-fetch everything
+ d->node(rootPath())->populatedChildren = false;
+ }
+
+ // We have a new valid root path
+ d->rootDir = QDir(longNewPath);
+ QModelIndex newRootIndex;
+ if (showDrives) {
+ // otherwise dir will become '.'
+ d->rootDir.setPath(""_L1);
+ } else {
+ newRootIndex = d->index(d->rootDir.path());
+ }
+ fetchMore(newRootIndex);
+ emit rootPathChanged(longNewPath);
+ d->forceSort = true;
+ d->delayedSort();
+ return newRootIndex;
+}
+
+/*!
+ The currently set root path
+
+ \sa rootDirectory()
+*/
+QString QFileSystemModel::rootPath() const
+{
+ Q_D(const QFileSystemModel);
+ return d->rootDir.path();
+}
+
+/*!
+ The currently set directory
+
+ \sa rootPath()
+*/
+QDir QFileSystemModel::rootDirectory() const
+{
+ Q_D(const QFileSystemModel);
+ QDir dir(d->rootDir);
+ dir.setNameFilters(nameFilters());
+ dir.setFilter(filter());
+ return dir;
+}
+
+/*!
+ Sets the \a provider of file icons for the directory model.
+*/
+void QFileSystemModel::setIconProvider(QAbstractFileIconProvider *provider)
+{
+ Q_D(QFileSystemModel);
+#if QT_CONFIG(filesystemwatcher)
+ d->fileInfoGatherer->setIconProvider(provider);
+#endif
+ d->root.updateIcon(provider, QString());
+}
+
+/*!
+ Returns the file icon provider for this directory model.
+*/
+QAbstractFileIconProvider *QFileSystemModel::iconProvider() const
+{
+#if QT_CONFIG(filesystemwatcher)
+ Q_D(const QFileSystemModel);
+ return d->fileInfoGatherer->iconProvider();
+#else
+ return nullptr;
+#endif
+}
+
+/*!
+ Sets the directory model's filter to that specified by \a filters.
+
+ Note that the filter you set should always include the QDir::AllDirs enum value,
+ otherwise QFileSystemModel won't be able to read the directory structure.
+
+ \sa QDir::Filters
+*/
+void QFileSystemModel::setFilter(QDir::Filters filters)
+{
+ Q_D(QFileSystemModel);
+ if (d->filters == filters)
+ return;
+ const bool changingCaseSensitivity =
+ filters.testFlag(QDir::CaseSensitive) != d->filters.testFlag(QDir::CaseSensitive);
+ d->filters = filters;
+ if (changingCaseSensitivity)
+ d->rebuildNameFilterRegexps();
+ d->forceSort = true;
+ d->delayedSort();
+}
+
+/*!
+ Returns the filter specified for the directory model.
+
+ If a filter has not been set, the default filter is QDir::AllEntries |
+ QDir::NoDotAndDotDot | QDir::AllDirs.
+
+ \sa QDir::Filters
+*/
+QDir::Filters QFileSystemModel::filter() const
+{
+ Q_D(const QFileSystemModel);
+ return d->filters;
+}
+
+/*!
+ \property QFileSystemModel::resolveSymlinks
+ \brief Whether the directory model should resolve symbolic links
+
+ This is only relevant on Windows.
+
+ By default, this property is \c true.
+
+ \sa QFileSystemModel::Options
+*/
+void QFileSystemModel::setResolveSymlinks(bool enable)
+{
+#if QT_CONFIG(filesystemwatcher)
+ Q_D(QFileSystemModel);
+ d->fileInfoGatherer->setResolveSymlinks(enable);
+#else
+ Q_UNUSED(enable);
+#endif
+}
+
+bool QFileSystemModel::resolveSymlinks() const
+{
+#if QT_CONFIG(filesystemwatcher)
+ Q_D(const QFileSystemModel);
+ return d->fileInfoGatherer->resolveSymlinks();
+#else
+ return false;
+#endif
+}
+
+/*!
+ \property QFileSystemModel::readOnly
+ \brief Whether the directory model allows writing to the file system
+
+ If this property is set to false, the directory model will allow renaming, copying
+ and deleting of files and directories.
+
+ This property is \c true by default
+*/
+void QFileSystemModel::setReadOnly(bool enable)
+{
+ Q_D(QFileSystemModel);
+ d->readOnly = enable;
+}
+
+bool QFileSystemModel::isReadOnly() const
+{
+ Q_D(const QFileSystemModel);
+ return d->readOnly;
+}
+
+/*!
+ \property QFileSystemModel::nameFilterDisables
+ \brief Whether files that don't pass the name filter are hidden or disabled
+
+ This property is \c true by default
+*/
+void QFileSystemModel::setNameFilterDisables(bool enable)
+{
+ Q_D(QFileSystemModel);
+ if (d->nameFilterDisables == enable)
+ return;
+ d->nameFilterDisables = enable;
+ d->forceSort = true;
+ d->delayedSort();
+}
+
+bool QFileSystemModel::nameFilterDisables() const
+{
+ Q_D(const QFileSystemModel);
+ return d->nameFilterDisables;
+}
+
+/*!
+ Sets the name \a filters to apply against the existing files.
+*/
+void QFileSystemModel::setNameFilters(const QStringList &filters)
+{
+#if QT_CONFIG(regularexpression)
+ Q_D(QFileSystemModel);
+
+ if (!d->bypassFilters.isEmpty()) {
+ // update the bypass filter to only bypass the stuff that must be kept around
+ d->bypassFilters.clear();
+ // We guarantee that rootPath will stick around
+ QPersistentModelIndex root(index(rootPath()));
+ const QModelIndexList persistentList = persistentIndexList();
+ for (const auto &persistentIndex : persistentList) {
+ QFileSystemModelPrivate::QFileSystemNode *node = d->node(persistentIndex);
+ while (node) {
+ if (d->bypassFilters.contains(node))
+ break;
+ if (node->isDir())
+ d->bypassFilters[node] = true;
+ node = node->parent;
+ }
+ }
+ }
+
+ d->nameFilters = filters;
+ d->rebuildNameFilterRegexps();
+ d->forceSort = true;
+ d->delayedSort();
+#else
+ Q_UNUSED(filters);
+#endif
+}
+
+/*!
+ Returns a list of filters applied to the names in the model.
+*/
+QStringList QFileSystemModel::nameFilters() const
+{
+#if QT_CONFIG(regularexpression)
+ Q_D(const QFileSystemModel);
+ return d->nameFilters;
+#else
+ return QStringList();
+#endif
+}
+
+/*!
+ \reimp
+*/
+bool QFileSystemModel::event(QEvent *event)
+{
+#if QT_CONFIG(filesystemwatcher)
+ Q_D(QFileSystemModel);
+ if (event->type() == QEvent::LanguageChange) {
+ d->root.retranslateStrings(d->fileInfoGatherer->iconProvider(), QString());
+ return true;
+ }
+#endif
+ return QAbstractItemModel::event(event);
+}
+
+bool QFileSystemModel::rmdir(const QModelIndex &aindex)
+{
+ QString path = filePath(aindex);
+ const bool success = QDir().rmdir(path);
+#if QT_CONFIG(filesystemwatcher)
+ if (success) {
+ QFileSystemModelPrivate * d = const_cast<QFileSystemModelPrivate*>(d_func());
+ d->fileInfoGatherer->removePath(path);
+ }
+#endif
+ return success;
+}
+
+/*!
+ \internal
+
+ Performed quick listing and see if any files have been added or removed,
+ then fetch more information on visible files.
+ */
+void QFileSystemModelPrivate::directoryChanged(const QString &directory, const QStringList &files)
+{
+ QFileSystemModelPrivate::QFileSystemNode *parentNode = node(directory, false);
+ if (parentNode->children.size() == 0)
+ return;
+ QStringList toRemove;
+ QStringList newFiles = files;
+ std::sort(newFiles.begin(), newFiles.end());
+ for (auto i = parentNode->children.constBegin(), cend = parentNode->children.constEnd(); i != cend; ++i) {
+ QStringList::iterator iterator = std::lower_bound(newFiles.begin(), newFiles.end(), i.value()->fileName);
+ if ((iterator == newFiles.end()) || (i.value()->fileName < *iterator))
+ toRemove.append(i.value()->fileName);
+ }
+ for (int i = 0 ; i < toRemove.size() ; ++i )
+ removeNode(parentNode, toRemove[i]);
+}
+
+#if defined(Q_OS_WIN)
+static QString volumeName(const QString &path)
+{
+ IShellItem *item = nullptr;
+ const QString native = QDir::toNativeSeparators(path);
+ HRESULT hr = SHCreateItemFromParsingName(reinterpret_cast<const wchar_t *>(native.utf16()),
+ nullptr, IID_IShellItem,
+ reinterpret_cast<void **>(&item));
+ if (FAILED(hr))
+ return QString();
+ LPWSTR name = nullptr;
+ hr = item->GetDisplayName(SIGDN_NORMALDISPLAY, &name);
+ if (FAILED(hr))
+ return QString();
+ QString result = QString::fromWCharArray(name);
+ CoTaskMemFree(name);
+ item->Release();
+ return result;
+}
+#endif // Q_OS_WIN
+
+/*!
+ \internal
+
+ Adds a new file to the children of parentNode
+
+ *WARNING* this will change the count of children
+*/
+QFileSystemModelPrivate::QFileSystemNode* QFileSystemModelPrivate::addNode(QFileSystemNode *parentNode, const QString &fileName, const QFileInfo& info)
+{
+ // In the common case, itemLocation == count() so check there first
+ QFileSystemModelPrivate::QFileSystemNode *node = new QFileSystemModelPrivate::QFileSystemNode(fileName, parentNode);
+#if QT_CONFIG(filesystemwatcher)
+ node->populate(info);
+#else
+ Q_UNUSED(info);
+#endif
+#if defined(Q_OS_WIN)
+ //The parentNode is "" so we are listing the drives
+ if (parentNode->fileName.isEmpty())
+ node->volumeName = volumeName(fileName);
+#endif
+ Q_ASSERT(!parentNode->children.contains(fileName));
+ parentNode->children.insert(fileName, node);
+ return node;
+}
+
+/*!
+ \internal
+
+ File at parentNode->children(itemLocation) has been removed, remove from the lists
+ and emit signals if necessary
+
+ *WARNING* this will change the count of children and could change visibleChildren
+ */
+void QFileSystemModelPrivate::removeNode(QFileSystemModelPrivate::QFileSystemNode *parentNode, const QString& name)
+{
+ Q_Q(QFileSystemModel);
+ QModelIndex parent = index(parentNode);
+ bool indexHidden = isHiddenByFilter(parentNode, parent);
+
+ int vLocation = parentNode->visibleLocation(name);
+ if (vLocation >= 0 && !indexHidden)
+ q->beginRemoveRows(parent, translateVisibleLocation(parentNode, vLocation),
+ translateVisibleLocation(parentNode, vLocation));
+ QFileSystemNode * node = parentNode->children.take(name);
+ delete node;
+ // cleanup sort files after removing rather then re-sorting which is O(n)
+ if (vLocation >= 0)
+ parentNode->visibleChildren.removeAt(vLocation);
+ if (vLocation >= 0 && !indexHidden)
+ q->endRemoveRows();
+}
+
+/*!
+ \internal
+
+ File at parentNode->children(itemLocation) was not visible before, but now should be
+ and emit signals if necessary.
+
+ *WARNING* this will change the visible count
+ */
+void QFileSystemModelPrivate::addVisibleFiles(QFileSystemNode *parentNode, const QStringList &newFiles)
+{
+ Q_Q(QFileSystemModel);
+ QModelIndex parent = index(parentNode);
+ bool indexHidden = isHiddenByFilter(parentNode, parent);
+ if (!indexHidden) {
+ q->beginInsertRows(parent, parentNode->visibleChildren.size() , parentNode->visibleChildren.size() + newFiles.size() - 1);
+ }
+
+ if (parentNode->dirtyChildrenIndex == -1)
+ parentNode->dirtyChildrenIndex = parentNode->visibleChildren.size();
+
+ for (const auto &newFile : newFiles) {
+ parentNode->visibleChildren.append(newFile);
+ parentNode->children.value(newFile)->isVisible = true;
+ }
+ if (!indexHidden)
+ q->endInsertRows();
+}
+
+/*!
+ \internal
+
+ File was visible before, but now should NOT be
+
+ *WARNING* this will change the visible count
+ */
+void QFileSystemModelPrivate::removeVisibleFile(QFileSystemNode *parentNode, int vLocation)
+{
+ Q_Q(QFileSystemModel);
+ if (vLocation == -1)
+ return;
+ QModelIndex parent = index(parentNode);
+ bool indexHidden = isHiddenByFilter(parentNode, parent);
+ if (!indexHidden)
+ q->beginRemoveRows(parent, translateVisibleLocation(parentNode, vLocation),
+ translateVisibleLocation(parentNode, vLocation));
+ parentNode->children.value(parentNode->visibleChildren.at(vLocation))->isVisible = false;
+ parentNode->visibleChildren.removeAt(vLocation);
+ if (!indexHidden)
+ q->endRemoveRows();
+}
+
+/*!
+ \internal
+
+ The thread has received new information about files,
+ update and emit dataChanged if it has actually changed.
+ */
+void QFileSystemModelPrivate::fileSystemChanged(const QString &path,
+ const QList<std::pair<QString, QFileInfo>> &updates)
+{
+#if QT_CONFIG(filesystemwatcher)
+ Q_Q(QFileSystemModel);
+ QList<QString> rowsToUpdate;
+ QStringList newFiles;
+ QFileSystemModelPrivate::QFileSystemNode *parentNode = node(path, false);
+ QModelIndex parentIndex = index(parentNode);
+ for (const auto &update : updates) {
+ QString fileName = update.first;
+ Q_ASSERT(!fileName.isEmpty());
+ QExtendedInformation info = fileInfoGatherer->getInfo(update.second);
+ bool previouslyHere = parentNode->children.contains(fileName);
+ if (!previouslyHere) {
+ addNode(parentNode, fileName, info.fileInfo());
+ }
+ QFileSystemModelPrivate::QFileSystemNode * node = parentNode->children.value(fileName);
+ bool isCaseSensitive = parentNode->caseSensitive();
+ if (isCaseSensitive) {
+ if (node->fileName != fileName)
+ continue;
+ } else {
+ if (QString::compare(node->fileName,fileName,Qt::CaseInsensitive) != 0)
+ continue;
+ }
+ if (isCaseSensitive) {
+ Q_ASSERT(node->fileName == fileName);
+ } else {
+ node->fileName = fileName;
+ }
+
+ if (*node != info ) {
+ node->populate(info);
+ bypassFilters.remove(node);
+ // brand new information.
+ if (filtersAcceptsNode(node)) {
+ if (!node->isVisible) {
+ newFiles.append(fileName);
+ } else {
+ rowsToUpdate.append(fileName);
+ }
+ } else {
+ if (node->isVisible) {
+ int visibleLocation = parentNode->visibleLocation(fileName);
+ removeVisibleFile(parentNode, visibleLocation);
+ } else {
+ // The file is not visible, don't do anything
+ }
+ }
+ }
+ }
+
+ // bundle up all of the changed signals into as few as possible.
+ std::sort(rowsToUpdate.begin(), rowsToUpdate.end());
+ QString min;
+ QString max;
+ for (const QString &value : std::as_const(rowsToUpdate)) {
+ //##TODO is there a way to bundle signals with QString as the content of the list?
+ /*if (min.isEmpty()) {
+ min = value;
+ if (i != rowsToUpdate.count() - 1)
+ continue;
+ }
+ if (i != rowsToUpdate.count() - 1) {
+ if ((value == min + 1 && max.isEmpty()) || value == max + 1) {
+ max = value;
+ continue;
+ }
+ }*/
+ max = value;
+ min = value;
+ int visibleMin = parentNode->visibleLocation(min);
+ int visibleMax = parentNode->visibleLocation(max);
+ if (visibleMin >= 0
+ && visibleMin < parentNode->visibleChildren.size()
+ && parentNode->visibleChildren.at(visibleMin) == min
+ && visibleMax >= 0) {
+ // don't use NumColumns here, a subclass might override columnCount
+ const int lastColumn = q->columnCount(parentIndex) - 1;
+ const QModelIndex top = q->index(translateVisibleLocation(parentNode, visibleMin),
+ QFileSystemModelPrivate::NameColumn, parentIndex);
+ const QModelIndex bottom = q->index(translateVisibleLocation(parentNode, visibleMax),
+ lastColumn, parentIndex);
+ // We document that emitting dataChanged with indexes that don't have the
+ // same parent is undefined behavior.
+ Q_ASSERT(bottom.parent() == top.parent());
+ emit q->dataChanged(top, bottom);
+ }
+
+ /*min = QString();
+ max = QString();*/
+ }
+
+ if (newFiles.size() > 0) {
+ addVisibleFiles(parentNode, newFiles);
+ }
+
+ if (newFiles.size() > 0 || (sortColumn != 0 && rowsToUpdate.size() > 0)) {
+ forceSort = true;
+ delayedSort();
+ }
+#else
+ Q_UNUSED(path);
+ Q_UNUSED(updates);
+#endif // filesystemwatcher
+}
+
+/*!
+ \internal
+*/
+void QFileSystemModelPrivate::resolvedName(const QString &fileName, const QString &resolvedName)
+{
+ resolvedSymLinks[fileName] = resolvedName;
+}
+
+#if QT_CONFIG(filesystemwatcher) && defined(Q_OS_WIN)
+// Remove file system watchers at/below the index and return a list of previously
+// watched files. This should be called prior to operations like rename/remove
+// which might fail due to watchers on platforms like Windows. The watchers
+// should be restored on failure.
+QStringList QFileSystemModelPrivate::unwatchPathsAt(const QModelIndex &index)
+{
+ const QFileSystemModelPrivate::QFileSystemNode *indexNode = node(index);
+ if (indexNode == nullptr)
+ return QStringList();
+ const Qt::CaseSensitivity caseSensitivity = indexNode->caseSensitive()
+ ? Qt::CaseSensitive : Qt::CaseInsensitive;
+ const QString path = indexNode->fileInfo().absoluteFilePath();
+
+ QStringList result;
+ const auto filter = [path, caseSensitivity] (const QString &watchedPath)
+ {
+ const int pathSize = path.size();
+ if (pathSize == watchedPath.size()) {
+ return path.compare(watchedPath, caseSensitivity) == 0;
+ } else if (watchedPath.size() > pathSize) {
+ return watchedPath.at(pathSize) == u'/'
+ && watchedPath.startsWith(path, caseSensitivity);
+ }
+ return false;
+ };
+
+ const QStringList &watchedFiles = fileInfoGatherer->watchedFiles();
+ std::copy_if(watchedFiles.cbegin(), watchedFiles.cend(),
+ std::back_inserter(result), filter);
+
+ const QStringList &watchedDirectories = fileInfoGatherer->watchedDirectories();
+ std::copy_if(watchedDirectories.cbegin(), watchedDirectories.cend(),
+ std::back_inserter(result), filter);
+
+ fileInfoGatherer->unwatchPaths(result);
+ return result;
+}
+#endif // filesystemwatcher && Q_OS_WIN
+
+QFileSystemModelPrivate::QFileSystemModelPrivate()
+#if QT_CONFIG(filesystemwatcher)
+ : fileInfoGatherer(new QFileInfoGatherer)
+#endif // filesystemwatcher
+{
+}
+
+QFileSystemModelPrivate::~QFileSystemModelPrivate()
+{
+#if QT_CONFIG(filesystemwatcher)
+ fileInfoGatherer->requestAbort();
+ if (!fileInfoGatherer->wait(1000)) {
+ // If the thread hangs, perhaps because the network was disconnected
+ // while the gatherer was stat'ing a remote file, then don't block
+ // shutting down the model (which might block a file dialog and the
+ // main thread). Schedule the gatherer for later deletion; it's
+ // destructor will wait for the thread to finish.
+ auto *rawGatherer = fileInfoGatherer.release();
+ rawGatherer->deleteLater();
+ }
+#endif // filesystemwatcher
+}
+
+/*!
+ \internal
+*/
+void QFileSystemModelPrivate::init()
+{
+ Q_Q(QFileSystemModel);
+
+ delayedSortTimer.setSingleShot(true);
+
+ qRegisterMetaType<QList<std::pair<QString, QFileInfo>>>();
+#if QT_CONFIG(filesystemwatcher)
+ QObjectPrivate::connect(fileInfoGatherer.get(), &QFileInfoGatherer::newListOfFiles,
+ this, &QFileSystemModelPrivate::directoryChanged);
+ QObjectPrivate::connect(fileInfoGatherer.get(), &QFileInfoGatherer::updates,
+ this, &QFileSystemModelPrivate::fileSystemChanged);
+ QObjectPrivate::connect(fileInfoGatherer.get(), &QFileInfoGatherer::nameResolved,
+ this, &QFileSystemModelPrivate::resolvedName);
+ q->connect(fileInfoGatherer.get(), &QFileInfoGatherer::directoryLoaded,
+ q, &QFileSystemModel::directoryLoaded);
+#endif // filesystemwatcher
+ QObjectPrivate::connect(&delayedSortTimer, &QTimer::timeout,
+ this, &QFileSystemModelPrivate::performDelayedSort,
+ Qt::QueuedConnection);
+}
+
+/*!
+ \internal
+
+ Returns \c false if node doesn't pass the filters otherwise true
+
+ QDir::Modified is not supported
+ QDir::Drives is not supported
+*/
+bool QFileSystemModelPrivate::filtersAcceptsNode(const QFileSystemNode *node) const
+{
+ // When the model is set to only show files, then a node representing a dir
+ // should be hidden regardless of bypassFilters.
+ // QTBUG-74471
+ const bool hideDirs = (filters & (QDir::Dirs | QDir::AllDirs)) == 0;
+ const bool shouldHideDirNode = hideDirs && node->isDir();
+
+ // always accept drives
+ if (node->parent == &root || (!shouldHideDirNode && bypassFilters.contains(node)))
+ return true;
+
+ // If we don't know anything yet don't accept it
+ if (!node->hasInformation())
+ return false;
+
+ const bool filterPermissions = ((filters & QDir::PermissionMask)
+ && (filters & QDir::PermissionMask) != QDir::PermissionMask);
+ const bool hideFiles = !(filters & QDir::Files);
+ const bool hideReadable = !(!filterPermissions || (filters & QDir::Readable));
+ const bool hideWritable = !(!filterPermissions || (filters & QDir::Writable));
+ const bool hideExecutable = !(!filterPermissions || (filters & QDir::Executable));
+ const bool hideHidden = !(filters & QDir::Hidden);
+ const bool hideSystem = !(filters & QDir::System);
+ const bool hideSymlinks = (filters & QDir::NoSymLinks);
+ const bool hideDot = (filters & QDir::NoDot);
+ const bool hideDotDot = (filters & QDir::NoDotDot);
+
+ // Note that we match the behavior of entryList and not QFileInfo on this.
+ bool isDot = (node->fileName == "."_L1);
+ bool isDotDot = (node->fileName == ".."_L1);
+ if ( (hideHidden && !(isDot || isDotDot) && node->isHidden())
+ || (hideSystem && node->isSystem())
+ || (hideDirs && node->isDir())
+ || (hideFiles && node->isFile())
+ || (hideSymlinks && node->isSymLink())
+ || (hideReadable && node->isReadable())
+ || (hideWritable && node->isWritable())
+ || (hideExecutable && node->isExecutable())
+ || (hideDot && isDot)
+ || (hideDotDot && isDotDot))
+ return false;
+
+ return nameFilterDisables || passNameFilters(node);
+}
+
+/*
+ \internal
+
+ Returns \c true if node passes the name filters and should be visible.
+ */
+bool QFileSystemModelPrivate::passNameFilters(const QFileSystemNode *node) const
+{
+#if QT_CONFIG(regularexpression)
+ if (nameFilters.isEmpty())
+ return true;
+
+ // Check the name regularexpression filters
+ if (!(node->isDir() && (filters & QDir::AllDirs))) {
+ const auto matchesNodeFileName = [node](const QRegularExpression &re)
+ {
+ return node->fileName.contains(re);
+ };
+ return std::any_of(nameFiltersRegexps.begin(),
+ nameFiltersRegexps.end(),
+ matchesNodeFileName);
+ }
+#else
+ Q_UNUSED(node);
+#endif
+ return true;
+}
+
+#if QT_CONFIG(regularexpression)
+void QFileSystemModelPrivate::rebuildNameFilterRegexps()
+{
+ nameFiltersRegexps.clear();
+ nameFiltersRegexps.reserve(nameFilters.size());
+ const auto cs = (filters & QDir::CaseSensitive) ? Qt::CaseSensitive : Qt::CaseInsensitive;
+ const auto convertWildcardToRegexp = [cs](const QString &nameFilter)
+ {
+ return QRegularExpression::fromWildcard(nameFilter, cs);
+ };
+ std::transform(nameFilters.constBegin(),
+ nameFilters.constEnd(),
+ std::back_inserter(nameFiltersRegexps),
+ convertWildcardToRegexp);
+}
+#endif
+
+QT_END_NAMESPACE
+
+#include "moc_qfilesystemmodel.cpp"
diff --git a/src/gui/itemmodels/qfilesystemmodel.h b/src/gui/itemmodels/qfilesystemmodel.h
new file mode 100644
index 0000000000..1fd1041f15
--- /dev/null
+++ b/src/gui/itemmodels/qfilesystemmodel.h
@@ -0,0 +1,150 @@
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
+
+#ifndef QFILESYSTEMMODEL_H
+#define QFILESYSTEMMODEL_H
+
+#include <QtGui/qtguiglobal.h>
+#include <QtCore/qabstractitemmodel.h>
+#include <QtCore/qpair.h>
+#include <QtCore/qdir.h>
+#include <QtGui/qicon.h>
+
+QT_REQUIRE_CONFIG(filesystemmodel);
+
+QT_BEGIN_NAMESPACE
+
+class ExtendedInformation;
+class QFileSystemModelPrivate;
+class QAbstractFileIconProvider;
+
+class Q_GUI_EXPORT QFileSystemModel : public QAbstractItemModel
+{
+ Q_OBJECT
+ Q_PROPERTY(bool resolveSymlinks READ resolveSymlinks WRITE setResolveSymlinks)
+ Q_PROPERTY(bool readOnly READ isReadOnly WRITE setReadOnly)
+ Q_PROPERTY(bool nameFilterDisables READ nameFilterDisables WRITE setNameFilterDisables)
+ Q_PROPERTY(Options options READ options WRITE setOptions)
+
+Q_SIGNALS:
+ void rootPathChanged(const QString &newPath);
+ void fileRenamed(const QString &path, const QString &oldName, const QString &newName);
+ void directoryLoaded(const QString &path);
+
+public:
+ // ### Qt 7: renumber these values to be before Qt::UserRole comment.
+ enum Roles {
+ FileIconRole = Qt::DecorationRole,
+ FileInfoRole = Qt::UserRole - 1,
+ FilePathRole = Qt::UserRole + 1,
+ FileNameRole = Qt::UserRole + 2,
+ FilePermissions = Qt::UserRole + 3,
+ };
+
+ enum Option
+ {
+ DontWatchForChanges = 0x00000001,
+ DontResolveSymlinks = 0x00000002,
+ DontUseCustomDirectoryIcons = 0x00000004
+ };
+ Q_ENUM(Option)
+ Q_DECLARE_FLAGS(Options, Option)
+
+ explicit QFileSystemModel(QObject *parent = nullptr);
+ ~QFileSystemModel();
+
+ QModelIndex index(int row, int column, const QModelIndex &parent = QModelIndex()) const override;
+ QModelIndex index(const QString &path, int column = 0) const;
+ QModelIndex parent(const QModelIndex &child) const override;
+ using QObject::parent;
+ QModelIndex sibling(int row, int column, const QModelIndex &idx) const override;
+ bool hasChildren(const QModelIndex &parent = QModelIndex()) const override;
+ bool canFetchMore(const QModelIndex &parent) const override;
+ void fetchMore(const QModelIndex &parent) override;
+
+ int rowCount(const QModelIndex &parent = QModelIndex()) const override;
+ int columnCount(const QModelIndex &parent = QModelIndex()) const override;
+
+ QVariant myComputer(int role = Qt::DisplayRole) const;
+ QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const override;
+ bool setData(const QModelIndex &index, const QVariant &value, int role = Qt::EditRole) override;
+
+ QVariant headerData(int section, Qt::Orientation orientation, int role = Qt::DisplayRole) const override;
+
+ Qt::ItemFlags flags(const QModelIndex &index) const override;
+
+ void sort(int column, Qt::SortOrder order = Qt::AscendingOrder) override;
+
+ QStringList mimeTypes() const override;
+ QMimeData *mimeData(const QModelIndexList &indexes) const override;
+ bool dropMimeData(const QMimeData *data, Qt::DropAction action,
+ int row, int column, const QModelIndex &parent) override;
+ Qt::DropActions supportedDropActions() const override;
+ QHash<int, QByteArray> roleNames() const override;
+
+ // QFileSystemModel specific API
+ QModelIndex setRootPath(const QString &path);
+ QString rootPath() const;
+ QDir rootDirectory() const;
+
+ void setIconProvider(QAbstractFileIconProvider *provider);
+ QAbstractFileIconProvider *iconProvider() const;
+
+ void setFilter(QDir::Filters filters);
+ QDir::Filters filter() const;
+
+ void setResolveSymlinks(bool enable);
+ bool resolveSymlinks() const;
+
+ void setReadOnly(bool enable);
+ bool isReadOnly() const;
+
+ void setNameFilterDisables(bool enable);
+ bool nameFilterDisables() const;
+
+ void setNameFilters(const QStringList &filters);
+ QStringList nameFilters() const;
+
+ void setOption(Option option, bool on = true);
+ bool testOption(Option option) const;
+ void setOptions(Options options);
+ Options options() const;
+
+ QString filePath(const QModelIndex &index) const;
+ bool isDir(const QModelIndex &index) const;
+ qint64 size(const QModelIndex &index) const;
+ QString type(const QModelIndex &index) const;
+
+ QDateTime lastModified(const QModelIndex &index) const;
+ QDateTime lastModified(const QModelIndex &index, const QTimeZone &tz) const;
+
+ QModelIndex mkdir(const QModelIndex &parent, const QString &name);
+ bool rmdir(const QModelIndex &index);
+ inline QString fileName(const QModelIndex &index) const;
+ inline QIcon fileIcon(const QModelIndex &index) const;
+ QFile::Permissions permissions(const QModelIndex &index) const;
+ QFileInfo fileInfo(const QModelIndex &index) const;
+ bool remove(const QModelIndex &index);
+
+protected:
+ QFileSystemModel(QFileSystemModelPrivate &, QObject *parent = nullptr);
+ void timerEvent(QTimerEvent *event) override;
+ bool event(QEvent *event) override;
+
+private:
+ Q_DECLARE_PRIVATE(QFileSystemModel)
+ Q_DISABLE_COPY(QFileSystemModel)
+
+ friend class QFileDialogPrivate;
+};
+
+inline QString QFileSystemModel::fileName(const QModelIndex &aindex) const
+{ return aindex.data(Qt::DisplayRole).toString(); }
+inline QIcon QFileSystemModel::fileIcon(const QModelIndex &aindex) const
+{ return qvariant_cast<QIcon>(aindex.data(Qt::DecorationRole)); }
+
+Q_DECLARE_OPERATORS_FOR_FLAGS(QFileSystemModel::Options)
+
+QT_END_NAMESPACE
+
+#endif // QFILESYSTEMMODEL_H
diff --git a/src/gui/itemmodels/qfilesystemmodel_p.h b/src/gui/itemmodels/qfilesystemmodel_p.h
new file mode 100644
index 0000000000..e01b0d56e6
--- /dev/null
+++ b/src/gui/itemmodels/qfilesystemmodel_p.h
@@ -0,0 +1,308 @@
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
+
+#ifndef QFILESYSTEMMODEL_P_H
+#define QFILESYSTEMMODEL_P_H
+
+//
+// W A R N I N G
+// -------------
+//
+// This file is not part of the Qt API. It exists purely as an
+// implementation detail. This header file may change from version to
+// version without notice, or even be removed.
+//
+// We mean it.
+//
+
+#include <QtGui/private/qtguiglobal_p.h>
+#include "qfilesystemmodel.h"
+
+#include <private/qabstractitemmodel_p.h>
+#include <qabstractitemmodel.h>
+#include "qfileinfogatherer_p.h"
+#include <qpair.h>
+#include <qdir.h>
+#include <qicon.h>
+#include <qfileinfo.h>
+#include <qtimer.h>
+#include <qhash.h>
+
+#include <vector>
+
+QT_REQUIRE_CONFIG(filesystemmodel);
+
+QT_BEGIN_NAMESPACE
+
+class ExtendedInformation;
+class QFileSystemModelPrivate;
+class QFileIconProvider;
+
+#if defined(Q_OS_WIN)
+class QFileSystemModelNodePathKey : public QString
+{
+public:
+ QFileSystemModelNodePathKey() {}
+ QFileSystemModelNodePathKey(const QString &other) : QString(other) {}
+ QFileSystemModelNodePathKey(const QFileSystemModelNodePathKey &other) : QString(other) {}
+ bool operator==(const QFileSystemModelNodePathKey &other) const { return !compare(other, Qt::CaseInsensitive); }
+};
+
+Q_DECLARE_TYPEINFO(QFileSystemModelNodePathKey, Q_RELOCATABLE_TYPE);
+
+inline size_t qHash(const QFileSystemModelNodePathKey &key, size_t seed = 0)
+{
+ return qHash(key.toCaseFolded(), seed);
+}
+#else // Q_OS_WIN
+typedef QString QFileSystemModelNodePathKey;
+#endif
+
+class Q_GUI_EXPORT QFileSystemModelPrivate : public QAbstractItemModelPrivate
+{
+ Q_DECLARE_PUBLIC(QFileSystemModel)
+
+public:
+ enum {
+ NameColumn,
+ SizeColumn,
+ TypeColumn,
+ TimeColumn,
+ NumColumns = 4
+ };
+
+ class QFileSystemNode
+ {
+ public:
+ Q_DISABLE_COPY_MOVE(QFileSystemNode)
+
+ explicit QFileSystemNode(const QString &filename = QString(), QFileSystemNode *p = nullptr)
+ : fileName(filename), parent(p) {}
+ ~QFileSystemNode() {
+ qDeleteAll(children);
+ delete info;
+ }
+
+ QString fileName;
+#if defined(Q_OS_WIN)
+ QString volumeName;
+#endif
+
+ inline qint64 size() const { if (info && !info->isDir()) return info->size(); return 0; }
+ inline QString type() const { if (info) return info->displayType; return QLatin1StringView(""); }
+ inline QDateTime lastModified(const QTimeZone &tz) const { return info ? info->lastModified(tz) : QDateTime(); }
+ inline QFile::Permissions permissions() const { if (info) return info->permissions(); return { }; }
+ inline bool isReadable() const { return ((permissions() & QFile::ReadUser) != 0); }
+ inline bool isWritable() const { return ((permissions() & QFile::WriteUser) != 0); }
+ inline bool isExecutable() const { return ((permissions() & QFile::ExeUser) != 0); }
+ inline bool isDir() const {
+ if (info)
+ return info->isDir();
+ if (children.size() > 0)
+ return true;
+ return false;
+ }
+ inline QFileInfo fileInfo() const { if (info) return info->fileInfo(); return QFileInfo(); }
+ inline bool isFile() const { if (info) return info->isFile(); return true; }
+ inline bool isSystem() const { if (info) return info->isSystem(); return true; }
+ inline bool isHidden() const { if (info) return info->isHidden(); return false; }
+ inline bool isSymLink(bool ignoreNtfsSymLinks = false) const { return info && info->isSymLink(ignoreNtfsSymLinks); }
+ inline bool caseSensitive() const { if (info) return info->isCaseSensitive(); return false; }
+ inline QIcon icon() const { if (info) return info->icon; return QIcon(); }
+
+ inline bool operator <(const QFileSystemNode &node) const {
+ if (caseSensitive() || node.caseSensitive())
+ return fileName < node.fileName;
+ return QString::compare(fileName, node.fileName, Qt::CaseInsensitive) < 0;
+ }
+ inline bool operator >(const QString &name) const {
+ if (caseSensitive())
+ return fileName > name;
+ return QString::compare(fileName, name, Qt::CaseInsensitive) > 0;
+ }
+ inline bool operator <(const QString &name) const {
+ if (caseSensitive())
+ return fileName < name;
+ return QString::compare(fileName, name, Qt::CaseInsensitive) < 0;
+ }
+ inline bool operator !=(const QExtendedInformation &fileInfo) const {
+ return !operator==(fileInfo);
+ }
+ bool operator ==(const QString &name) const {
+ if (caseSensitive())
+ return fileName == name;
+ return QString::compare(fileName, name, Qt::CaseInsensitive) == 0;
+ }
+ bool operator ==(const QExtendedInformation &fileInfo) const {
+ return info && (*info == fileInfo);
+ }
+
+ inline bool hasInformation() const { return info != nullptr; }
+
+ void populate(const QExtendedInformation &fileInfo) {
+ if (!info)
+ info = new QExtendedInformation(fileInfo.fileInfo());
+ (*info) = fileInfo;
+ }
+
+ // children shouldn't normally be accessed directly, use node()
+ inline int visibleLocation(const QString &childName) {
+ return visibleChildren.indexOf(childName);
+ }
+ void updateIcon(QAbstractFileIconProvider *iconProvider, const QString &path) {
+ if (!iconProvider)
+ return;
+
+ if (info)
+ info->icon = iconProvider->icon(QFileInfo(path));
+
+ for (QFileSystemNode *child : std::as_const(children)) {
+ //On windows the root (My computer) has no path so we don't want to add a / for nothing (e.g. /C:/)
+ if (!path.isEmpty()) {
+ if (path.endsWith(u'/'))
+ child->updateIcon(iconProvider, path + child->fileName);
+ else
+ child->updateIcon(iconProvider, path + u'/' + child->fileName);
+ } else
+ child->updateIcon(iconProvider, child->fileName);
+ }
+ }
+
+ void retranslateStrings(QAbstractFileIconProvider *iconProvider, const QString &path) {
+ if (!iconProvider)
+ return;
+
+ if (info)
+ info->displayType = iconProvider->type(QFileInfo(path));
+ for (QFileSystemNode *child : std::as_const(children)) {
+ //On windows the root (My computer) has no path so we don't want to add a / for nothing (e.g. /C:/)
+ if (!path.isEmpty()) {
+ if (path.endsWith(u'/'))
+ child->retranslateStrings(iconProvider, path + child->fileName);
+ else
+ child->retranslateStrings(iconProvider, path + u'/' + child->fileName);
+ } else
+ child->retranslateStrings(iconProvider, child->fileName);
+ }
+ }
+
+ QHash<QFileSystemModelNodePathKey, QFileSystemNode *> children;
+ QList<QString> visibleChildren;
+ QExtendedInformation *info = nullptr;
+ QFileSystemNode *parent;
+ int dirtyChildrenIndex = -1;
+ bool populatedChildren = false;
+ bool isVisible = false;
+ };
+
+ QFileSystemModelPrivate();
+ ~QFileSystemModelPrivate();
+ void init();
+ /*
+ \internal
+
+ Return true if index which is owned by node is hidden by the filter.
+ */
+ inline bool isHiddenByFilter(QFileSystemNode *indexNode, const QModelIndex &index) const
+ {
+ return (indexNode != &root && !index.isValid());
+ }
+ QFileSystemNode *node(const QModelIndex &index) const;
+ QFileSystemNode *node(const QString &path, bool fetch = true) const;
+ inline QModelIndex index(const QString &path, int column = 0) { return index(node(path), column); }
+ QModelIndex index(const QFileSystemNode *node, int column = 0) const;
+ bool filtersAcceptsNode(const QFileSystemNode *node) const;
+ bool passNameFilters(const QFileSystemNode *node) const;
+ void removeNode(QFileSystemNode *parentNode, const QString &name);
+ QFileSystemNode* addNode(QFileSystemNode *parentNode, const QString &fileName, const QFileInfo &info);
+ void addVisibleFiles(QFileSystemNode *parentNode, const QStringList &newFiles);
+ void removeVisibleFile(QFileSystemNode *parentNode, int visibleLocation);
+ void sortChildren(int column, const QModelIndex &parent);
+
+ inline int translateVisibleLocation(QFileSystemNode *parent, int row) const {
+ if (sortOrder != Qt::AscendingOrder) {
+ if (parent->dirtyChildrenIndex == -1)
+ return parent->visibleChildren.size() - row - 1;
+
+ if (row < parent->dirtyChildrenIndex)
+ return parent->dirtyChildrenIndex - row - 1;
+ }
+
+ return row;
+ }
+
+ inline static QString myComputer() {
+ // ### TODO We should query the system to find out what the string should be
+ // XP == "My Computer",
+ // Vista == "Computer",
+ // OS X == "Computer" (sometime user generated) "Benjamin's PowerBook G4"
+#ifdef Q_OS_WIN
+ return QFileSystemModel::tr("My Computer");
+#else
+ return QFileSystemModel::tr("Computer");
+#endif
+ }
+
+ inline void delayedSort() {
+ if (!delayedSortTimer.isActive())
+ delayedSortTimer.start(0);
+ }
+
+ QIcon icon(const QModelIndex &index) const;
+ QString name(const QModelIndex &index) const;
+ QString displayName(const QModelIndex &index) const;
+ QString filePath(const QModelIndex &index) const;
+ QString size(const QModelIndex &index) const;
+ static QString size(qint64 bytes);
+ QString type(const QModelIndex &index) const;
+ QString time(const QModelIndex &index) const;
+
+ void directoryChanged(const QString &directory, const QStringList &list);
+ void performDelayedSort();
+ void fileSystemChanged(const QString &path, const QList<std::pair<QString, QFileInfo>> &);
+ void resolvedName(const QString &fileName, const QString &resolvedName);
+
+ QDir rootDir;
+#if QT_CONFIG(filesystemwatcher)
+# ifdef Q_OS_WIN
+ QStringList unwatchPathsAt(const QModelIndex &);
+ void watchPaths(const QStringList &paths) { fileInfoGatherer->watchPaths(paths); }
+# endif // Q_OS_WIN
+ std::unique_ptr<QFileInfoGatherer> fileInfoGatherer;
+#endif // filesystemwatcher
+ QTimer delayedSortTimer;
+ QHash<const QFileSystemNode*, bool> bypassFilters;
+#if QT_CONFIG(regularexpression)
+ QStringList nameFilters;
+ std::vector<QRegularExpression> nameFiltersRegexps;
+ void rebuildNameFilterRegexps();
+#endif
+ QHash<QString, QString> resolvedSymLinks;
+
+ QFileSystemNode root;
+
+ struct Fetching {
+ QString dir;
+ QString file;
+ const QFileSystemNode *node;
+ };
+ QList<Fetching> toFetch;
+
+ QBasicTimer fetchingTimer;
+
+ QDir::Filters filters = QDir::AllEntries | QDir::NoDotAndDotDot | QDir::AllDirs;
+ int sortColumn = 0;
+ Qt::SortOrder sortOrder = Qt::AscendingOrder;
+ bool forceSort = true;
+ bool readOnly = true;
+ bool setRootPath = false;
+ bool nameFilterDisables = true; // false on windows, true on mac and unix
+ // This flag is an optimization for QFileDialog. It enables a sort which is
+ // not recursive, meaning we sort only what we see.
+ bool disableRecursiveSort = false;
+};
+Q_DECLARE_TYPEINFO(QFileSystemModelPrivate::Fetching, Q_RELOCATABLE_TYPE);
+
+QT_END_NAMESPACE
+
+#endif
diff --git a/src/gui/itemmodels/qstandarditemmodel.cpp b/src/gui/itemmodels/qstandarditemmodel.cpp
index 2998808b54..8b3e381431 100644
--- a/src/gui/itemmodels/qstandarditemmodel.cpp
+++ b/src/gui/itemmodels/qstandarditemmodel.cpp
@@ -1,41 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the QtGui module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#include "qstandarditemmodel.h"
@@ -44,17 +8,22 @@
#include <QtCore/qmap.h>
#include <QtCore/qpair.h>
#include <QtCore/qvariant.h>
-#include <QtCore/qvector.h>
#include <QtCore/qstringlist.h>
#include <QtCore/qbitarray.h>
#include <QtCore/qmimedata.h>
-
+#include <QtCore/qiodevice.h>
+#include <private/qduplicatetracker_p.h>
#include <private/qstandarditemmodel_p.h>
#include <qdebug.h>
#include <algorithm>
QT_BEGIN_NAMESPACE
+// Used internally to store the flags
+namespace {
+constexpr auto DataFlagsRole = Qt::ItemDataRole(Qt::UserRole - 1);
+}
+
static inline QString qStandardItemModelDataListMimeType()
{
return QStringLiteral("application/x-qstandarditemmodeldatalist");
@@ -138,10 +107,19 @@ void QStandardItemPrivate::setChild(int row, int column, QStandardItem *item,
return;
}
}
+
+ // setting the model to nullptr invalidates the persistent index which we want to avoid
+ if (!item && oldItem)
+ oldItem->d_func()->setModel(nullptr);
+
+ children.replace(index, item);
+
+ // since now indexFromItem() does no longer return a valid index, the persistent index
+ // will not be invalidated anymore
if (oldItem)
oldItem->d_func()->setModel(nullptr);
delete oldItem;
- children.replace(index, item);
+
if (item)
item->d_func()->lastKnownIndex = index;
@@ -181,7 +159,7 @@ void QStandardItemPrivate::childDeleted(QStandardItem *child)
int index = childIndex(child);
Q_ASSERT(index != -1);
const auto modelIndex = child->index();
- children.replace(index, 0);
+ children.replace(index, nullptr);
emit model->dataChanged(modelIndex, modelIndex);
}
@@ -265,11 +243,11 @@ void QStandardItemPrivate::setItemData(const QMap<int, QVariant> &roles)
std::sort(values.begin(), values.end(), byRole);
/*
- Create a vector of QStandardItemData that will contain the original values
+ Create a list of QStandardItemData that will contain the original values
if the matching role is not contained in roles, the new value if it is and
if the new value is an invalid QVariant, it will be removed.
*/
- QVector<QStandardItemData> newValues;
+ QList<QStandardItemData> newValues;
newValues.reserve(values.size());
roleMapStandardItemDataUnion(roles.keyValueBegin(),
roles.keyValueEnd(),
@@ -279,7 +257,7 @@ void QStandardItemPrivate::setItemData(const QMap<int, QVariant> &roles)
if (newValues != values) {
values.swap(newValues);
if (model) {
- QVector<int> roleKeys;
+ QList<int> roleKeys;
roleKeys.reserve(roles.size() + 1);
bool hasEditRole = false;
bool hasDisplayRole = false;
@@ -302,14 +280,12 @@ void QStandardItemPrivate::setItemData(const QMap<int, QVariant> &roles)
/*!
\internal
*/
-const QMap<int, QVariant> QStandardItemPrivate::itemData() const
+QMap<int, QVariant> QStandardItemPrivate::itemData() const
{
QMap<int, QVariant> result;
- QVector<QStandardItemData>::const_iterator it;
- for (it = values.cbegin(); it != values.cend(); ++it){
- // Qt::UserRole - 1 is used internally to store the flags
- if (it->role != Qt::UserRole - 1)
- result.insert(it->role, it->value);
+ for (const auto &data : values) {
+ if (data.role != DataFlagsRole)
+ result.insert(data.role, data.value);
}
return result;
}
@@ -323,8 +299,8 @@ void QStandardItemPrivate::sortChildren(int column, Qt::SortOrder order)
if (column >= columnCount())
return;
- QVector<QPair<QStandardItem*, int> > sortable;
- QVector<int> unsortable;
+ QList<QPair<QStandardItem*, int> > sortable;
+ QList<int> unsortable;
sortable.reserve(rowCount());
unsortable.reserve(rowCount());
@@ -346,11 +322,11 @@ void QStandardItemPrivate::sortChildren(int column, Qt::SortOrder order)
}
QModelIndexList changedPersistentIndexesFrom, changedPersistentIndexesTo;
- QVector<QStandardItem*> sorted_children(children.count());
+ QList<QStandardItem*> sorted_children(children.size());
for (int i = 0; i < rowCount(); ++i) {
- int r = (i < sortable.count()
+ int r = (i < sortable.size()
? sortable.at(i).second
- : unsortable.at(i - sortable.count()));
+ : unsortable.at(i - sortable.size()));
for (int c = 0; c < columnCount(); ++c) {
QStandardItem *itm = q->child(r, c);
sorted_children[childIndex(i, c)] = itm;
@@ -371,7 +347,7 @@ void QStandardItemPrivate::sortChildren(int column, Qt::SortOrder order)
model->changePersistentIndexList(changedPersistentIndexesFrom, changedPersistentIndexesTo);
}
- QVector<QStandardItem*>::iterator it;
+ QList<QStandardItem*>::iterator it;
for (it = children.begin(); it != children.end(); ++it) {
if (*it)
(*it)->d_func()->sortChildren(column, order);
@@ -397,8 +373,8 @@ void QStandardItemPrivate::setModel(QStandardItemModel *mod)
itm->d_func()->model->d_func()->invalidatePersistentIndex(itm->d_func()->model->indexFromItem(itm));
}
itm->d_func()->model = mod;
- const QVector<QStandardItem*> &childList = itm->d_func()->children;
- for (int i = 0; i < childList.count(); ++i) {
+ const QList<QStandardItem*> &childList = itm->d_func()->children;
+ for (int i = 0; i < childList.size(); ++i) {
QStandardItem *chi = childList.at(i);
if (chi)
stack.push(chi);
@@ -411,9 +387,7 @@ void QStandardItemPrivate::setModel(QStandardItemModel *mod)
\internal
*/
QStandardItemModelPrivate::QStandardItemModelPrivate()
- : root(new QStandardItem),
- itemPrototype(nullptr),
- sortRole(Qt::DisplayRole)
+ : root(new QStandardItem), itemPrototype(nullptr)
{
root->setFlags(Qt::ItemIsDropEnabled);
}
@@ -433,6 +407,7 @@ void QStandardItemModelPrivate::init()
Q_Q(QStandardItemModel);
QObject::connect(q, SIGNAL(dataChanged(QModelIndex,QModelIndex)),
q, SLOT(_q_emitItemChanged(QModelIndex,QModelIndex)));
+ roleNames = QAbstractItemModelPrivate::defaultRoleNames();
}
/*!
@@ -460,7 +435,7 @@ bool QStandardItemPrivate::insertRows(int row, const QList<QStandardItem*> &item
Q_Q(QStandardItem);
if ((row < 0) || (row > rowCount()) || items.isEmpty())
return false;
- int count = items.count();
+ int count = items.size();
if (model)
model->d_func()->rowsAboutToBeInserted(q, row, row + count - 1);
if (rowCount() == 0) {
@@ -472,9 +447,9 @@ bool QStandardItemPrivate::insertRows(int row, const QList<QStandardItem*> &item
rows += count;
int index = childIndex(row, 0);
if (index != -1)
- children.insert(index, columnCount() * count, 0);
+ children.insert(index, columnCount() * count, nullptr);
}
- for (int i = 0; i < items.count(); ++i) {
+ for (int i = 0; i < items.size(); ++i) {
QStandardItem *item = items.at(i);
item->d_func()->model = model;
item->d_func()->parent = q;
@@ -502,11 +477,11 @@ bool QStandardItemPrivate::insertRows(int row, int count, const QList<QStandardI
rows += count;
int index = childIndex(row, 0);
if (index != -1)
- children.insert(index, columnCount() * count, 0);
+ children.insert(index, columnCount() * count, nullptr);
}
if (!items.isEmpty()) {
int index = childIndex(row, 0);
- int limit = qMin(items.count(), columnCount() * count);
+ int limit = qMin(items.size(), columnCount() * count);
for (int i = 0; i < limit; ++i) {
QStandardItem *item = items.at(i);
if (item) {
@@ -546,12 +521,12 @@ bool QStandardItemPrivate::insertColumns(int column, int count, const QList<QSta
columns += count;
int index = childIndex(0, column);
for (int row = 0; row < rowCount(); ++row) {
- children.insert(index, count, 0);
+ children.insert(index, count, nullptr);
index += columnCount();
}
}
if (!items.isEmpty()) {
- int limit = qMin(items.count(), rowCount() * count);
+ int limit = qMin(items.size(), rowCount() * count);
for (int i = 0; i < limit; ++i) {
QStandardItem *item = items.at(i);
if (item) {
@@ -579,7 +554,7 @@ bool QStandardItemPrivate::insertColumns(int column, int count, const QList<QSta
/*!
\internal
*/
-void QStandardItemModelPrivate::itemChanged(QStandardItem *item, const QVector<int> &roles)
+void QStandardItemModelPrivate::itemChanged(QStandardItem *item, const QList<int> &roles)
{
Q_Q(QStandardItemModel);
Q_ASSERT(item);
@@ -652,7 +627,7 @@ void QStandardItemModelPrivate::rowsInserted(QStandardItem *parent,
{
Q_Q(QStandardItemModel);
if (parent == root.data())
- rowHeaderItems.insert(row, count, 0);
+ rowHeaderItems.insert(row, count, nullptr);
q->endInsertRows();
}
@@ -664,7 +639,7 @@ void QStandardItemModelPrivate::columnsInserted(QStandardItem *parent,
{
Q_Q(QStandardItemModel);
if (parent == root.data())
- columnHeaderItems.insert(column, count, 0);
+ columnHeaderItems.insert(column, count, nullptr);
q->endInsertColumns();
}
@@ -868,7 +843,7 @@ QStandardItem &QStandardItem::operator=(const QStandardItem &other)
QStandardItem::~QStandardItem()
{
Q_D(QStandardItem);
- for (QStandardItem *child : qAsConst(d->children)) {
+ for (QStandardItem *child : std::as_const(d->children)) {
if (child)
child->d_func()->setModel(nullptr);
delete child;
@@ -897,9 +872,15 @@ QStandardItem *QStandardItem::parent() const
Sets the item's data for the given \a role to the specified \a value.
If you subclass QStandardItem and reimplement this function, your
- reimplementation should call emitDataChanged() if you do not call
- the base implementation of setData(). This will ensure that e.g.
- views using the model are notified of the changes.
+ reimplementation should:
+ \list
+ \li call emitDataChanged() if you do not call the base implementation of
+ setData(). This will ensure that e.g. views using the model are notified
+ of the changes
+ \li call the base implementation for roles you don't handle, otherwise
+ setting flags, e.g. by calling setFlags(), setCheckable(), setEditable()
+ etc., will not work.
+ \endlist
\note The default implementation treats Qt::EditRole and Qt::DisplayRole
as referring to the same data.
@@ -910,17 +891,18 @@ void QStandardItem::setData(const QVariant &value, int role)
{
Q_D(QStandardItem);
role = (role == Qt::EditRole) ? Qt::DisplayRole : role;
- const QVector<int> roles((role == Qt::DisplayRole) ?
- QVector<int>({Qt::DisplayRole, Qt::EditRole}) :
- QVector<int>({role}));
- QVector<QStandardItemData>::iterator it;
- for (it = d->values.begin(); it != d->values.end(); ++it) {
+ const QList<int> roles((role == Qt::DisplayRole) ?
+ QList<int>({Qt::DisplayRole, Qt::EditRole}) :
+ QList<int>({role}));
+ for (auto it = d->values.begin(); it != d->values.end(); ++it) {
if ((*it).role == role) {
if (value.isValid()) {
- if ((*it).value.type() == value.type() && (*it).value == value)
+ if ((*it).value.userType() == value.userType() && (*it).value == value)
return;
(*it).value = value;
} else {
+ // Don't need to assign proper it after erase() since we
+ // return unconditionally in this code path.
d->values.erase(it);
}
if (d->model)
@@ -945,29 +927,49 @@ void QStandardItem::clearData()
return;
d->values.clear();
if (d->model)
- d->model->d_func()->itemChanged(this, QVector<int>{});
+ d->model->d_func()->itemChanged(this, QList<int>{});
}
/*!
Returns the item's data for the given \a role, or an invalid
QVariant if there is no data for the role.
+ If you reimplement this function, your reimplementation should call
+ the base implementation for roles you don't handle, otherwise getting
+ flags, e.g. by calling flags(), isCheckable(), isEditable() etc.,
+ will not work.
+
\note The default implementation treats Qt::EditRole and Qt::DisplayRole
as referring to the same data.
*/
QVariant QStandardItem::data(int role) const
{
Q_D(const QStandardItem);
- role = (role == Qt::EditRole) ? Qt::DisplayRole : role;
- QVector<QStandardItemData>::const_iterator it;
- for (it = d->values.begin(); it != d->values.end(); ++it) {
- if ((*it).role == role)
- return (*it).value;
+ const int r = (role == Qt::EditRole) ? Qt::DisplayRole : role;
+ for (const auto &value : d->values) {
+ if (value.role == r)
+ return value.value;
}
return QVariant();
}
/*!
+ \since 6.0
+
+ Fills the \a roleDataSpan span with the data from this item.
+
+ The default implementation simply calls data() for each role
+ in the span.
+
+ \sa data()
+*/
+void QStandardItem::multiData(QModelRoleDataSpan roleDataSpan) const
+{
+ for (auto &roleData : roleDataSpan)
+ roleData.setData(data(roleData.role()));
+}
+
+/*!
\since 4.4
Causes the model associated with this item to emit a
@@ -996,7 +998,7 @@ void QStandardItem::emitDataChanged()
*/
void QStandardItem::setFlags(Qt::ItemFlags flags)
{
- setData((int)flags, Qt::UserRole - 1);
+ setData((int)flags, DataFlagsRole);
}
/*!
@@ -1011,7 +1013,7 @@ void QStandardItem::setFlags(Qt::ItemFlags flags)
*/
Qt::ItemFlags QStandardItem::flags() const
{
- QVariant v = data(Qt::UserRole - 1);
+ QVariant v = data(DataFlagsRole);
if (!v.isValid())
return (Qt::ItemIsSelectable|Qt::ItemIsEnabled|Qt::ItemIsEditable
|Qt::ItemIsDragEnabled|Qt::ItemIsDropEnabled);
@@ -1362,24 +1364,6 @@ void QStandardItem::setCheckable(bool checkable)
*/
/*!
- \fn void QStandardItem::setTristate(bool tristate)
- \obsolete
-
- Use QStandardItem::setAutoTristate(bool tristate) instead.
- For a tristate checkbox that the user can change between all three
- states, use QStandardItem::setUserTristate(bool tristate) instead.
-*/
-
-/*!
- \fn void QStandardItem::isTristate() const
- \obsolete
-
- Use QStandardItem::isAutoTristate() instead.
- For a tristate checkbox that the user can change between all three
- states, use QStandardItem::isUserTristate() instead.
-*/
-
-/*!
Determines that the item is tristate and controlled by QTreeWidget if \a tristate
is \c true.
This enables automatic management of the state of parent items in QTreeWidget
@@ -1433,13 +1417,6 @@ void QStandardItem::setUserTristate(bool tristate)
\sa setUserTristate(), isCheckable(), checkState()
*/
-#if QT_DEPRECATED_SINCE(5, 6)
-void QStandardItem::setTristate(bool tristate)
-{
- setAutoTristate(tristate);
-}
-#endif
-
#if QT_CONFIG(draganddrop)
/*!
@@ -1625,8 +1602,8 @@ void QStandardItem::insertRow(int row, const QList<QStandardItem*> &items)
Q_D(QStandardItem);
if (row < 0)
return;
- if (columnCount() < items.count())
- setColumnCount(items.count());
+ if (columnCount() < items.size())
+ setColumnCount(items.size());
d->insertRows(row, 1, items);
}
@@ -1654,8 +1631,8 @@ void QStandardItem::insertColumn(int column, const QList<QStandardItem*> &items)
Q_D(QStandardItem);
if (column < 0)
return;
- if (rowCount() < items.count())
- setRowCount(items.count());
+ if (rowCount() < items.size())
+ setRowCount(items.size());
d->insertColumns(column, 1, items);
}
@@ -1894,10 +1871,37 @@ QStandardItem *QStandardItem::takeChild(int row, int column)
QStandardItem *item = nullptr;
int index = d->childIndex(row, column);
if (index != -1) {
+ QModelIndex changedIdx;
item = d->children.at(index);
- if (item)
- item->d_func()->setParentAndModel(nullptr, nullptr);
- d->children.replace(index, 0);
+ if (item) {
+ QStandardItemPrivate *const item_d = item->d_func();
+ if (d->model) {
+ QStandardItemModelPrivate *const model_d = d->model->d_func();
+ const int savedRows = item_d->rows;
+ const int savedCols = item_d->columns;
+ const QVector<QStandardItem*> savedChildren = item_d->children;
+ if (savedRows > 0) {
+ model_d->rowsAboutToBeRemoved(item, 0, savedRows - 1);
+ item_d->rows = 0;
+ item_d->children = QVector<QStandardItem*>(); //slightly faster than clear
+ model_d->rowsRemoved(item, 0, savedRows);
+ }
+ if (savedCols > 0) {
+ model_d->columnsAboutToBeRemoved(item, 0, savedCols - 1);
+ item_d->columns = 0;
+ item_d->children = QVector<QStandardItem*>(); //slightly faster than clear
+ model_d->columnsRemoved(item, 0, savedCols);
+ }
+ item_d->rows = savedRows;
+ item_d->columns = savedCols;
+ item_d->children = savedChildren;
+ changedIdx = d->model->indexFromItem(item);
+ }
+ item_d->setParentAndModel(nullptr, nullptr);
+ }
+ d->children.replace(index, nullptr);
+ if (changedIdx.isValid())
+ d->model->dataChanged(changedIdx, changedIdx);
}
return item;
}
@@ -2122,8 +2126,8 @@ QDataStream &operator<<(QDataStream &out, const QStandardItem &item)
that interface (such as QListView, QTableView and QTreeView, and your own
custom views). For performance and flexibility, you may want to subclass
QAbstractItemModel to provide support for different kinds of data
- repositories. For example, the QDirModel provides a model interface to the
- underlying file system.
+ repositories. For example, the QFileSystemModel provides a model interface
+ to the underlying file system.
When you want a list or tree, you typically create an empty
QStandardItemModel and use appendRow() to add items to the model, and
@@ -2211,9 +2215,9 @@ QStandardItemModel::QStandardItemModel(int rows, int columns, QObject *parent)
Q_D(QStandardItemModel);
d->init();
d->root->insertColumns(0, columns);
- d->columnHeaderItems.insert(0, columns, 0);
+ d->columnHeaderItems.insert(0, columns, nullptr);
d->root->insertRows(0, rows);
- d->rowHeaderItems.insert(0, rows, 0);
+ d->rowHeaderItems.insert(0, rows, nullptr);
d->root->d_func()->setModel(this);
}
@@ -2249,6 +2253,15 @@ void QStandardItemModel::setItemRoleNames(const QHash<int,QByteArray> &roleNames
}
/*!
+ reimp
+*/
+QHash<int, QByteArray> QStandardItemModel::roleNames() const
+{
+ Q_D(const QStandardItemModel);
+ return d->roleNames;
+}
+
+/*!
Removes all items (including header items) from the model and sets the
number of rows and columns to zero.
@@ -2532,9 +2545,9 @@ QStandardItem *QStandardItemModel::verticalHeaderItem(int row) const
void QStandardItemModel::setHorizontalHeaderLabels(const QStringList &labels)
{
Q_D(QStandardItemModel);
- if (columnCount() < labels.count())
- setColumnCount(labels.count());
- for (int i = 0; i < labels.count(); ++i) {
+ if (columnCount() < labels.size())
+ setColumnCount(labels.size());
+ for (int i = 0; i < labels.size(); ++i) {
QStandardItem *item = horizontalHeaderItem(i);
if (!item) {
item = d->createItem();
@@ -2555,9 +2568,9 @@ void QStandardItemModel::setHorizontalHeaderLabels(const QStringList &labels)
void QStandardItemModel::setVerticalHeaderLabels(const QStringList &labels)
{
Q_D(QStandardItemModel);
- if (rowCount() < labels.count())
- setRowCount(labels.count());
- for (int i = 0; i < labels.count(); ++i) {
+ if (rowCount() < labels.size())
+ setRowCount(labels.size());
+ for (int i = 0; i < labels.size(); ++i) {
QStandardItem *item = verticalHeaderItem(i);
if (!item) {
item = d->createItem();
@@ -2761,7 +2774,7 @@ QStandardItem *QStandardItemModel::takeHorizontalHeaderItem(int column)
QStandardItem *headerItem = d->columnHeaderItems.at(column);
if (headerItem) {
headerItem->d_func()->setParentAndModel(nullptr, nullptr);
- d->columnHeaderItems.replace(column, 0);
+ d->columnHeaderItems.replace(column, nullptr);
}
return headerItem;
}
@@ -2783,7 +2796,7 @@ QStandardItem *QStandardItemModel::takeVerticalHeaderItem(int row)
QStandardItem *headerItem = d->rowHeaderItems.at(row);
if (headerItem) {
headerItem->d_func()->setParentAndModel(nullptr, nullptr);
- d->rowHeaderItems.replace(row, 0);
+ d->rowHeaderItems.replace(row, nullptr);
}
return headerItem;
}
@@ -2809,6 +2822,12 @@ void QStandardItemModel::setSortRole(int role)
d->sortRole = role;
}
+QBindable<int> QStandardItemModel::bindableSortRole()
+{
+ Q_D(QStandardItemModel);
+ return &d->sortRole;
+}
+
/*!
\reimp
*/
@@ -2832,6 +2851,18 @@ QVariant QStandardItemModel::data(const QModelIndex &index, int role) const
/*!
\reimp
*/
+void QStandardItemModel::multiData(const QModelIndex &index, QModelRoleDataSpan roleDataSpan) const
+{
+ // Cannot offer a better implementation; users may be overriding
+ // data(), and thus multiData() may fall out of sync for them.
+ // The base class' implementation will simply call data() in a loop,
+ // so it's fine.
+ QAbstractItemModel::multiData(index, roleDataSpan);
+}
+
+/*!
+ \reimp
+*/
Qt::ItemFlags QStandardItemModel::flags(const QModelIndex &index) const
{
Q_D(const QStandardItemModel);
@@ -2860,14 +2891,6 @@ bool QStandardItemModel::hasChildren(const QModelIndex &parent) const
/*!
\reimp
*/
-QModelIndex QStandardItemModel::sibling(int row, int column, const QModelIndex &idx) const
-{
- return QAbstractItemModel::sibling(row, column, idx);
-}
-
-/*!
- \reimp
-*/
QVariant QStandardItemModel::headerData(int section, Qt::Orientation orientation, int role) const
{
Q_D(const QStandardItemModel);
@@ -3010,20 +3033,9 @@ bool QStandardItemModel::setData(const QModelIndex &index, const QVariant &value
return true;
}
-#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
/*!
\reimp
*/
-#else
-/*!
- \since 5.12
- Removes the data stored in all the roles for the given \a index.
- Returns \c true if \a index is valid and data was cleared, \c false
- otherwise.
-
- \sa setData(), data()
-*/
-#endif
bool QStandardItemModel::clearItemData(const QModelIndex &index)
{
if (!checkIndex(index, CheckIndexOption::IndexIsValid))
@@ -3104,21 +3116,21 @@ QStringList QStandardItemModel::mimeTypes() const
*/
QMimeData *QStandardItemModel::mimeData(const QModelIndexList &indexes) const
{
- QMimeData *data = QAbstractItemModel::mimeData(indexes);
- if(!data)
+ std::unique_ptr<QMimeData> data(QAbstractItemModel::mimeData(indexes));
+ if (!data)
return nullptr;
const QString format = qStandardItemModelDataListMimeType();
if (!mimeTypes().contains(format))
- return data;
+ return data.release();
QByteArray encoded;
QDataStream stream(&encoded, QIODevice::WriteOnly);
QSet<QStandardItem*> itemsSet;
QStack<QStandardItem*> stack;
- itemsSet.reserve(indexes.count());
- stack.reserve(indexes.count());
- for (int i = 0; i < indexes.count(); ++i) {
+ itemsSet.reserve(indexes.size());
+ stack.reserve(indexes.size());
+ for (int i = 0; i < indexes.size(); ++i) {
if (QStandardItem *item = itemFromIndex(indexes.at(i))) {
itemsSet << item;
stack.push(item);
@@ -3128,28 +3140,27 @@ QMimeData *QStandardItemModel::mimeData(const QModelIndexList &indexes) const
}
}
- //remove duplicates childrens
+ //remove duplicates children
{
- QSet<QStandardItem *> seen;
+ QDuplicateTracker<QStandardItem *> seen;
while (!stack.isEmpty()) {
QStandardItem *itm = stack.pop();
- if (seen.contains(itm))
+ if (seen.hasSeen(itm))
continue;
- seen.insert(itm);
- const QVector<QStandardItem*> &childList = itm->d_func()->children;
- for (int i = 0; i < childList.count(); ++i) {
+ const QList<QStandardItem*> &childList = itm->d_func()->children;
+ for (int i = 0; i < childList.size(); ++i) {
QStandardItem *chi = childList.at(i);
if (chi) {
- itemsSet.erase(itemsSet.constFind(chi));
+ itemsSet.remove(chi);
stack.push(chi);
}
}
}
}
- stack.reserve(itemsSet.count());
- for (QStandardItem *item : qAsConst(itemsSet))
+ stack.reserve(itemsSet.size());
+ for (QStandardItem *item : std::as_const(itemsSet))
stack.push(item);
//stream everything recursively
@@ -3158,12 +3169,12 @@ QMimeData *QStandardItemModel::mimeData(const QModelIndexList &indexes) const
if (itemsSet.contains(item)) //if the item is selection 'top-level', stream its position
stream << item->row() << item->column();
- stream << *item << item->columnCount() << item->d_ptr->children.count();
+ stream << *item << item->columnCount() << int(item->d_ptr->children.size());
stack += item->d_ptr->children;
}
data->setData(format, encoded);
- return data;
+ return data.release();
}
@@ -3222,8 +3233,8 @@ bool QStandardItemModel::dropMimeData(const QMimeData *data, Qt::DropAction acti
int left = INT_MAX;
int bottom = 0;
int right = 0;
- QVector<int> rows, columns;
- QVector<QStandardItem *> items;
+ QList<int> rows, columns;
+ QList<QStandardItem *> items;
while (!stream.atEnd()) {
int r, c;
@@ -3246,16 +3257,16 @@ bool QStandardItemModel::dropMimeData(const QMimeData *data, Qt::DropAction acti
int dragColumnCount = right - left + 1;
// Compute the number of continuous rows upon insertion and modify the rows to match
- QVector<int> rowsToInsert(bottom + 1);
- for (int i = 0; i < rows.count(); ++i)
+ QList<int> rowsToInsert(bottom + 1);
+ for (int i = 0; i < rows.size(); ++i)
rowsToInsert[rows.at(i)] = 1;
- for (int i = 0; i < rowsToInsert.count(); ++i) {
+ for (int i = 0; i < rowsToInsert.size(); ++i) {
if (rowsToInsert.at(i) == 1){
rowsToInsert[i] = dragRowCount;
++dragRowCount;
}
}
- for (int i = 0; i < rows.count(); ++i)
+ for (int i = 0; i < rows.size(); ++i)
rows[i] = top + rowsToInsert.at(rows.at(i));
QBitArray isWrittenTo(dragRowCount * dragColumnCount);
@@ -3275,7 +3286,7 @@ bool QStandardItemModel::dropMimeData(const QMimeData *data, Qt::DropAction acti
if (!parentItem)
parentItem = invisibleRootItem();
- QVector<QPersistentModelIndex> newIndexes(items.size());
+ QList<QPersistentModelIndex> newIndexes(items.size());
// set the data in the table
for (int j = 0; j < items.size(); ++j) {
int relativeRow = rows.at(j) - top;
diff --git a/src/gui/itemmodels/qstandarditemmodel.h b/src/gui/itemmodels/qstandarditemmodel.h
index f1c6e6df5c..a5ae05feeb 100644
--- a/src/gui/itemmodels/qstandarditemmodel.h
+++ b/src/gui/itemmodels/qstandarditemmodel.h
@@ -1,41 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the QtGui module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#ifndef QSTANDARDITEMMODEL_H
#define QSTANDARDITEMMODEL_H
@@ -66,6 +30,7 @@ public:
virtual ~QStandardItem();
virtual QVariant data(int role = Qt::UserRole + 1) const;
+ virtual void multiData(QModelRoleDataSpan roleDataSpan) const;
virtual void setData(const QVariant &value, int role = Qt::UserRole + 1);
void clearData();
@@ -79,12 +44,10 @@ public:
}
inline void setIcon(const QIcon &icon);
-#ifndef QT_NO_TOOLTIP
inline QString toolTip() const {
return qvariant_cast<QString>(data(Qt::ToolTipRole));
}
inline void setToolTip(const QString &toolTip);
-#endif
#ifndef QT_NO_STATUSTIP
inline QString statusTip() const {
@@ -111,7 +74,7 @@ public:
inline void setFont(const QFont &font);
inline Qt::Alignment textAlignment() const {
- return Qt::Alignment(qvariant_cast<int>(data(Qt::TextAlignmentRole)));
+ return qvariant_cast<Qt::Alignment>(data(Qt::TextAlignmentRole));
}
inline void setTextAlignment(Qt::Alignment textAlignment);
@@ -144,48 +107,43 @@ public:
void setFlags(Qt::ItemFlags flags);
inline bool isEnabled() const {
- return (flags() & Qt::ItemIsEnabled) != 0;
+ return bool(flags() & Qt::ItemIsEnabled);
}
void setEnabled(bool enabled);
inline bool isEditable() const {
- return (flags() & Qt::ItemIsEditable) != 0;
+ return bool(flags() & Qt::ItemIsEditable);
}
void setEditable(bool editable);
inline bool isSelectable() const {
- return (flags() & Qt::ItemIsSelectable) != 0;
+ return bool(flags() & Qt::ItemIsSelectable);
}
void setSelectable(bool selectable);
inline bool isCheckable() const {
- return (flags() & Qt::ItemIsUserCheckable) != 0;
+ return bool(flags() & Qt::ItemIsUserCheckable);
}
void setCheckable(bool checkable);
inline bool isAutoTristate() const {
- return (flags() & Qt::ItemIsAutoTristate) != 0;
+ return bool(flags() & Qt::ItemIsAutoTristate);
}
void setAutoTristate(bool tristate);
inline bool isUserTristate() const {
- return (flags() & Qt::ItemIsUserTristate) != 0;
+ return bool(flags() & Qt::ItemIsUserTristate);
}
void setUserTristate(bool tristate);
-#if QT_DEPRECATED_SINCE(5, 6)
- QT_DEPRECATED bool isTristate() const { return isAutoTristate(); }
- QT_DEPRECATED void setTristate(bool tristate);
-#endif
-
#if QT_CONFIG(draganddrop)
inline bool isDragEnabled() const {
- return (flags() & Qt::ItemIsDragEnabled) != 0;
+ return bool(flags() & Qt::ItemIsDragEnabled);
}
void setDragEnabled(bool dragEnabled);
inline bool isDropEnabled() const {
- return (flags() & Qt::ItemIsDropEnabled) != 0;
+ return bool(flags() & Qt::ItemIsDropEnabled);
}
void setDropEnabled(bool dropEnabled);
#endif // QT_CONFIG(draganddrop)
@@ -260,10 +218,8 @@ inline void QStandardItem::setText(const QString &atext)
inline void QStandardItem::setIcon(const QIcon &aicon)
{ setData(aicon, Qt::DecorationRole); }
-#ifndef QT_NO_TOOLTIP
inline void QStandardItem::setToolTip(const QString &atoolTip)
{ setData(atoolTip, Qt::ToolTipRole); }
-#endif
#ifndef QT_NO_STATUSTIP
inline void QStandardItem::setStatusTip(const QString &astatusTip)
@@ -282,7 +238,7 @@ inline void QStandardItem::setFont(const QFont &afont)
{ setData(afont, Qt::FontRole); }
inline void QStandardItem::setTextAlignment(Qt::Alignment atextAlignment)
-{ setData(int(atextAlignment), Qt::TextAlignmentRole); }
+{ setData(QVariant::fromValue(atextAlignment), Qt::TextAlignmentRole); }
inline void QStandardItem::setBackground(const QBrush &abrush)
{ setData(abrush, Qt::BackgroundRole); }
@@ -322,7 +278,7 @@ class QStandardItemModelPrivate;
class Q_GUI_EXPORT QStandardItemModel : public QAbstractItemModel
{
Q_OBJECT
- Q_PROPERTY(int sortRole READ sortRole WRITE setSortRole)
+ Q_PROPERTY(int sortRole READ sortRole WRITE setSortRole BINDABLE bindableSortRole)
public:
explicit QStandardItemModel(QObject *parent = nullptr);
@@ -330,6 +286,7 @@ public:
~QStandardItemModel();
void setItemRoleNames(const QHash<int,QByteArray> &roleNames);
+ QHash<int, QByteArray> roleNames() const override;
QModelIndex index(int row, int column, const QModelIndex &parent = QModelIndex()) const override;
QModelIndex parent(const QModelIndex &child) const override;
@@ -337,16 +294,11 @@ public:
int rowCount(const QModelIndex &parent = QModelIndex()) const override;
int columnCount(const QModelIndex &parent = QModelIndex()) const override;
bool hasChildren(const QModelIndex &parent = QModelIndex()) const override;
- // Qt 6: Remove
- QModelIndex sibling(int row, int column, const QModelIndex &idx) const override;
QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const override;
+ void multiData(const QModelIndex &index, QModelRoleDataSpan roleDataSpan) const override;
bool setData(const QModelIndex &index, const QVariant &value, int role = Qt::EditRole) override;
- bool clearItemData(const QModelIndex &index)
-#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
- override
-#endif
- ;
+ bool clearItemData(const QModelIndex &index) override;
QVariant headerData(int section, Qt::Orientation orientation,
int role = Qt::DisplayRole) const override;
@@ -416,13 +368,13 @@ public:
int sortRole() const;
void setSortRole(int role);
+ QBindable<int> bindableSortRole();
QStringList mimeTypes() const override;
QMimeData *mimeData(const QModelIndexList &indexes) const override;
bool dropMimeData (const QMimeData *data, Qt::DropAction action, int row, int column, const QModelIndex &parent) override;
Q_SIGNALS:
- // ### Qt 6: add changed roles
void itemChanged(QStandardItem *item);
protected:
diff --git a/src/gui/itemmodels/qstandarditemmodel_p.h b/src/gui/itemmodels/qstandarditemmodel_p.h
index 97c2e6f01b..a0c3f8a161 100644
--- a/src/gui/itemmodels/qstandarditemmodel_p.h
+++ b/src/gui/itemmodels/qstandarditemmodel_p.h
@@ -1,41 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the QtGui module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#ifndef QSTANDARDITEMMODEL_P_H
#define QSTANDARDITEMMODEL_P_H
@@ -51,6 +15,8 @@
// We mean it.
//
+#include <QtGui/qstandarditemmodel.h>
+
#include <QtGui/private/qtguiglobal_p.h>
#include "private/qabstractitemmodel_p.h"
@@ -58,7 +24,6 @@
#include <QtCore/qpair.h>
#include <QtCore/qstack.h>
#include <QtCore/qvariant.h>
-#include <QtCore/qvector.h>
#include <QtCore/qdebug.h>
QT_REQUIRE_CONFIG(standarditemmodel);
@@ -69,13 +34,15 @@ class QStandardItemData
{
public:
inline QStandardItemData() : role(-1) {}
- inline QStandardItemData(int r, const QVariant &v) : role(r), value(v) {}
- inline QStandardItemData(const std::pair<const int&, const QVariant&> &p) : role(p.first), value(p.second) {}
+ inline QStandardItemData(int r, const QVariant &v) :
+ role(r == Qt::EditRole ? Qt::DisplayRole : r), value(v) {}
+ inline QStandardItemData(const std::pair<const int&, const QVariant&> &p) :
+ role(p.first == Qt::EditRole ? Qt::DisplayRole : p.first), value(p.second) {}
int role;
QVariant value;
inline bool operator==(const QStandardItemData &other) const { return role == other.role && value == other.value; }
};
-Q_DECLARE_TYPEINFO(QStandardItemData, Q_MOVABLE_TYPE);
+Q_DECLARE_TYPEINFO(QStandardItemData, Q_RELOCATABLE_TYPE);
#ifndef QT_NO_DATASTREAM
@@ -138,7 +105,7 @@ public:
// backwards through the children
int backwardIter = childsLastIndexInParent - 1;
int forwardIter = childsLastIndexInParent;
- Q_FOREVER {
+ for (;;) {
if (forwardIter <= lastChild) {
if (children.at(forwardIter) == child) {
childsLastIndexInParent = forwardIter;
@@ -181,7 +148,7 @@ public:
void changeFlags(bool enable, Qt::ItemFlags f);
void setItemData(const QMap<int, QVariant> &roles);
- const QMap<int, QVariant> itemData() const;
+ QMap<int, QVariant> itemData() const;
bool insertRows(int row, int count, const QList<QStandardItem*> &items);
bool insertRows(int row, const QList<QStandardItem*> &items);
@@ -191,8 +158,8 @@ public:
QStandardItemModel *model;
QStandardItem *parent;
- QVector<QStandardItemData> values;
- QVector<QStandardItem*> children;
+ QList<QStandardItemData> values;
+ QList<QStandardItem *> children;
int rows;
int columns;
@@ -228,7 +195,7 @@ public:
}
void sort(QStandardItem *parent, int column, Qt::SortOrder order);
- void itemChanged(QStandardItem *item, const QVector<int> &roles = QVector<int>());
+ void itemChanged(QStandardItem *item, const QList<int> &roles = QList<int>());
void rowsAboutToBeInserted(QStandardItem *parent, int start, int end);
void columnsAboutToBeInserted(QStandardItem *parent, int start, int end);
void rowsAboutToBeRemoved(QStandardItem *parent, int start, int end);
@@ -243,11 +210,12 @@ public:
void decodeDataRecursive(QDataStream &stream, QStandardItem *item);
- QVector<QStandardItem*> columnHeaderItems;
- QVector<QStandardItem*> rowHeaderItems;
+ QList<QStandardItem *> columnHeaderItems;
+ QList<QStandardItem *> rowHeaderItems;
+ QHash<int, QByteArray> roleNames;
QScopedPointer<QStandardItem> root;
const QStandardItem *itemPrototype;
- int sortRole;
+ Q_OBJECT_BINDABLE_PROPERTY_WITH_ARGS(QStandardItemModelPrivate, int, sortRole, Qt::DisplayRole)
};
QT_END_NAMESPACE
diff --git a/src/gui/kernel/kernel.pri b/src/gui/kernel/kernel.pri
deleted file mode 100644
index 3784abdacc..0000000000
--- a/src/gui/kernel/kernel.pri
+++ /dev/null
@@ -1,183 +0,0 @@
-# Qt kernel module
-
-# Only used on platforms with CONFIG += precompile_header
-PRECOMPILED_HEADER = kernel/qt_gui_pch.h
-
-
-KERNEL_P= kernel
-HEADERS += \
- kernel/qtguiglobal.h \
- kernel/qtguiglobal_p.h \
- kernel/qgenericpluginfactory.h \
- kernel/qgenericplugin.h \
- kernel/qwindowsysteminterface.h \
- kernel/qwindowsysteminterface_p.h \
- kernel/qplatformintegration.h \
- kernel/qplatformscreen.h \
- kernel/qplatformscreen_p.h \
- kernel/qplatforminputcontext.h \
- kernel/qplatforminputcontext_p.h \
- kernel/qplatforminputcontextfactory_p.h \
- kernel/qplatforminputcontextplugin_p.h \
- kernel/qplatformintegrationfactory_p.h \
- kernel/qplatformintegrationplugin.h \
- kernel/qplatformtheme.h \
- kernel/qplatformtheme_p.h \
- kernel/qplatformthemefactory_p.h \
- kernel/qplatformthemeplugin.h \
- kernel/qplatformwindow.h \
- kernel/qplatformoffscreensurface.h \
- kernel/qplatformwindow_p.h \
- kernel/qplatformcursor.h \
- kernel/qplatformclipboard.h \
- kernel/qplatformnativeinterface.h \
- kernel/qplatformmenu.h \
- kernel/qsurfaceformat.h \
- kernel/qguiapplication.h \
- kernel/qguiapplication_p.h \
- kernel/qwindow_p.h \
- kernel/qwindow.h \
- kernel/qoffscreensurface.h \
- kernel/qplatformsurface.h \
- kernel/qsurface.h \
- kernel/qclipboard.h \
- kernel/qcursor.h \
- kernel/qcursor_p.h \
- kernel/qevent.h \
- kernel/qevent_p.h \
- kernel/qinputmethod.h \
- kernel/qinputmethod_p.h \
- kernel/qinternalmimedata_p.h \
- kernel/qkeymapper_p.h \
- kernel/qpalette.h \
- kernel/qsessionmanager.h \
- kernel/qsessionmanager_p.h \
- kernel/qwindowdefs.h \
- kernel/qscreen.h \
- kernel/qscreen_p.h \
- kernel/qstylehints.h \
- kernel/qtouchdevice.h \
- kernel/qtouchdevice_p.h \
- kernel/qplatformsharedgraphicscache.h \
- kernel/qplatformdialoghelper.h \
- kernel/qplatformservices.h \
- kernel/qplatformsystemtrayicon.h \
- kernel/qplatformsessionmanager.h \
- kernel/qpixelformat.h \
- kernel/qpaintdevicewindow.h \
- kernel/qpaintdevicewindow_p.h \
- kernel/qrasterwindow.h \
- kernel/qplatformgraphicsbuffer.h \
- kernel/qplatformgraphicsbufferhelper.h \
- kernel/qinputdevicemanager_p.h \
- kernel/qinputdevicemanager_p_p.h \
- kernel/qhighdpiscaling_p.h \
- kernel/qtestsupport_gui.h
-
-SOURCES += \
- kernel/qgenericpluginfactory.cpp \
- kernel/qgenericplugin.cpp \
- kernel/qwindowsysteminterface.cpp \
- kernel/qplatforminputcontextfactory.cpp \
- kernel/qplatforminputcontextplugin.cpp \
- kernel/qplatforminputcontext.cpp \
- kernel/qplatformintegration.cpp \
- kernel/qplatformscreen.cpp \
- kernel/qplatformintegrationfactory.cpp \
- kernel/qplatformintegrationplugin.cpp \
- kernel/qplatformtheme.cpp \
- kernel/qplatformthemefactory.cpp \
- kernel/qplatformthemeplugin.cpp \
- kernel/qplatformwindow.cpp \
- kernel/qplatformoffscreensurface.cpp \
- kernel/qplatformcursor.cpp \
- kernel/qplatformclipboard.cpp \
- kernel/qplatformnativeinterface.cpp \
- kernel/qsessionmanager.cpp \
- kernel/qsurfaceformat.cpp \
- kernel/qguiapplication.cpp \
- kernel/qwindow.cpp \
- kernel/qoffscreensurface.cpp \
- kernel/qplatformsurface.cpp \
- kernel/qsurface.cpp \
- kernel/qclipboard.cpp \
- kernel/qcursor.cpp \
- kernel/qevent.cpp \
- kernel/qinputmethod.cpp \
- kernel/qinternalmimedata.cpp \
- kernel/qkeymapper.cpp \
- kernel/qpalette.cpp \
- kernel/qguivariant.cpp \
- kernel/qscreen.cpp \
- kernel/qstylehints.cpp \
- kernel/qtouchdevice.cpp \
- kernel/qplatformsharedgraphicscache.cpp \
- kernel/qplatformdialoghelper.cpp \
- kernel/qplatformservices.cpp \
- kernel/qplatformsystemtrayicon.cpp \
- kernel/qplatformsessionmanager.cpp \
- kernel/qplatformmenu.cpp \
- kernel/qpixelformat.cpp \
- kernel/qpaintdevicewindow.cpp \
- kernel/qrasterwindow.cpp \
- kernel/qplatformgraphicsbuffer.cpp \
- kernel/qplatformgraphicsbufferhelper.cpp \
- kernel/qinputdevicemanager.cpp \
- kernel/qhighdpiscaling.cpp \
- kernel/qtestsupport_gui.cpp
-
-qtConfig(action) {
- HEADERS += \
- kernel/qguiaction.h \
- kernel/qguiaction_p.h \
- kernel/qguiactiongroup.h \
- kernel/qguiactiongroup_p.h
-
- SOURCES += \
- kernel/qguiactiongroup.cpp \
- kernel/qguiaction.cpp
-}
-
-qtConfig(draganddrop) {
- HEADERS += \
- kernel/qdnd_p.h \
- kernel/qdrag.h \
- kernel/qplatformdrag.h \
- kernel/qshapedpixmapdndwindow_p.h \
- kernel/qsimpledrag_p.h
-
- SOURCES += \
- kernel/qdnd.cpp \
- kernel/qdrag.cpp \
- kernel/qplatformdrag.cpp \
- kernel/qshapedpixmapdndwindow.cpp \
- kernel/qsimpledrag.cpp
-}
-
-qtConfig(opengl) {
- HEADERS += \
- kernel/qplatformopenglcontext.h \
- kernel/qopenglcontext.h \
- kernel/qopenglcontext_p.h \
- kernel/qopenglwindow.h
-
- SOURCES += \
- kernel/qplatformopenglcontext.cpp \
- kernel/qopenglcontext.cpp \
- kernel/qopenglwindow.cpp
-}
-
-qtConfig(shortcut) {
- HEADERS += \
- kernel/qguishortcut.h \
- kernel/qguishortcut_p.h \
- kernel/qshortcutmap_p.h \
- kernel/qkeysequence.h \
- kernel/qkeysequence_p.h
- SOURCES += \
- kernel/qguishortcut.cpp \
- kernel/qshortcutmap.cpp \
- kernel/qkeysequence.cpp
-}
-
-win32:HEADERS+=kernel/qwindowdefs_win.h
diff --git a/src/gui/kernel/qguiaction.cpp b/src/gui/kernel/qaction.cpp
index 7c7d86f5ab..c67cfd53b1 100644
--- a/src/gui/kernel/qguiaction.cpp
+++ b/src/gui/kernel/qaction.cpp
@@ -1,46 +1,10 @@
-/****************************************************************************
-**
-** Copyright (C) 2019 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the QtGui module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "qguiaction.h"
-#include "qguiactiongroup.h"
-
-#include "qguiaction_p.h"
+// Copyright (C) 2020 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
+
+#include "qaction.h"
+#include "qactiongroup.h"
+
+#include "qaction_p.h"
#include "qguiapplication.h"
#include "qevent.h"
#include "qlist.h"
@@ -59,24 +23,31 @@
QT_BEGIN_NAMESPACE
+using namespace Qt::StringLiterals;
+
/*
internal: guesses a descriptive text from a text suited for a menu entry
*/
static QString qt_strippedText(QString s)
{
- s.remove(QLatin1String("..."));
+ s.remove("..."_L1);
for (int i = 0; i < s.size(); ++i) {
- if (s.at(i) == QLatin1Char('&'))
+ if (s.at(i) == u'&')
s.remove(i, 1);
}
return s.trimmed();
}
-QGuiActionPrivate::QGuiActionPrivate() :
+QActionPrivate *QGuiApplicationPrivate::createActionPrivate() const
+{
+ return new QActionPrivate;
+}
+
+QActionPrivate::QActionPrivate() :
#if QT_CONFIG(shortcut)
autorepeat(1),
#endif
- enabled(1), forceDisabled(0), visible(1), forceInvisible(0), checkable(0),
+ enabled(1), explicitEnabled(0), explicitEnabledValue(1), visible(1), forceInvisible(0), checkable(0),
checked(0), separator(0), fontSet(false),
iconVisibleInMenu(-1), shortcutVisibleInContextMenu(-1)
{
@@ -85,17 +56,21 @@ QGuiActionPrivate::QGuiActionPrivate() :
#if QT_CONFIG(shortcut)
static bool dummy(QObject *, Qt::ShortcutContext) { return false; } // only for GUI testing.
-QShortcutMap::ContextMatcher QGuiActionPrivate::contextMatcher() const
+QShortcutMap::ContextMatcher QActionPrivate::contextMatcher() const
{
return dummy;
-}
+};
#endif // QT_CONFIG(shortcut)
-QGuiActionPrivate::~QGuiActionPrivate() = default;
+QActionPrivate::~QActionPrivate() = default;
+
+void QActionPrivate::destroy()
+{
+}
-void QGuiActionPrivate::sendDataChanged()
+void QActionPrivate::sendDataChanged()
{
- Q_Q(QGuiAction);
+ Q_Q(QAction);
QActionEvent e(QEvent::ActionChanged, q);
QCoreApplication::sendEvent(q, &e);
@@ -103,68 +78,68 @@ void QGuiActionPrivate::sendDataChanged()
}
#if QT_CONFIG(shortcut)
-void QGuiActionPrivate::redoGrab(QShortcutMap &map)
-{
- Q_Q(QGuiAction);
- if (shortcutId)
- map.removeShortcut(shortcutId, q);
- if (shortcut.isEmpty())
- return;
- shortcutId = map.addShortcut(q, shortcut, shortcutContext, contextMatcher());
- if (!enabled)
- map.setShortcutEnabled(false, shortcutId, q);
- if (!autorepeat)
- map.setShortcutAutoRepeat(false, shortcutId, q);
-}
-
-void QGuiActionPrivate::redoGrabAlternate(QShortcutMap &map)
+void QActionPrivate::redoGrab(QShortcutMap &map)
{
- Q_Q(QGuiAction);
- for(int i = 0; i < alternateShortcutIds.count(); ++i) {
- if (const int id = alternateShortcutIds.at(i))
+ Q_Q(QAction);
+ for (int id : std::as_const(shortcutIds)) {
+ if (id)
map.removeShortcut(id, q);
}
- alternateShortcutIds.clear();
- if (alternateShortcuts.isEmpty())
- return;
- for(int i = 0; i < alternateShortcuts.count(); ++i) {
- const QKeySequence& alternate = alternateShortcuts.at(i);
- if (!alternate.isEmpty())
- alternateShortcutIds.append(map.addShortcut(q, alternate, shortcutContext, contextMatcher()));
+
+ shortcutIds.clear();
+ for (const QKeySequence &shortcut : std::as_const(shortcuts)) {
+ if (!shortcut.isEmpty())
+ shortcutIds.append(map.addShortcut(q, shortcut, shortcutContext, contextMatcher()));
else
- alternateShortcutIds.append(0);
+ shortcutIds.append(0);
}
if (!enabled) {
- for(int i = 0; i < alternateShortcutIds.count(); ++i) {
- const int id = alternateShortcutIds.at(i);
- map.setShortcutEnabled(false, id, q);
+ for (int id : std::as_const(shortcutIds)) {
+ if (id)
+ map.setShortcutEnabled(false, id, q);
}
}
if (!autorepeat) {
- for(int i = 0; i < alternateShortcutIds.count(); ++i) {
- const int id = alternateShortcutIds.at(i);
- map.setShortcutAutoRepeat(false, id, q);
+ for (int id : std::as_const(shortcutIds)) {
+ if (id)
+ map.setShortcutAutoRepeat(false, id, q);
}
}
}
-void QGuiActionPrivate::setShortcutEnabled(bool enable, QShortcutMap &map)
+void QActionPrivate::setShortcutEnabled(bool enable, QShortcutMap &map)
{
- Q_Q(QGuiAction);
- if (shortcutId)
- map.setShortcutEnabled(enable, shortcutId, q);
- for(int i = 0; i < alternateShortcutIds.count(); ++i) {
- if (const int id = alternateShortcutIds.at(i))
+ Q_Q(QAction);
+ for (int id : std::as_const(shortcutIds)) {
+ if (id)
map.setShortcutEnabled(enable, id, q);
}
}
#endif // QT_NO_SHORTCUT
+bool QActionPrivate::showStatusText(QObject *object, const QString &str)
+{
+ if (QObject *receiver = object ? object : parent) {
+ QStatusTipEvent tip(str);
+ QCoreApplication::sendEvent(receiver, &tip);
+ return true;
+ }
+ return false;
+}
+
+void QActionPrivate::setMenu(QObject *)
+{
+}
+
+QObject *QActionPrivate::menu() const
+{
+ return nullptr;
+}
/*!
- \class QGuiAction
- \brief QGuiAction is the base class for actions, an abstract user interface
- action that can be inserted into widgets.
+ \class QAction
+ \brief The QAction class provides an abstraction for user commands
+ that can be added to different user interface components.
\since 6.0
\inmodule QtGui
@@ -175,44 +150,57 @@ void QGuiActionPrivate::setShortcutEnabled(bool enable, QShortcutMap &map)
user interface used, it is useful to represent each command as
an \e action.
- Actions can be added to menus and toolbars, and will
- automatically keep them in sync. For example, in a word processor,
- if the user presses a Bold toolbar button, the Bold menu item
+ Actions can be added to user interface elements such as menus and toolbars,
+ and will automatically keep the UI in sync. For example, in a word
+ processor, if the user presses a Bold toolbar button, the Bold menu item
will automatically be checked.
- Actions can be created as independent objects, but they may
- also be created during the construction of menus; the QMenu class
- contains convenience functions for creating actions suitable for
- use as menu items.
-
- A QGuiAction may contain an icon, menu text, a shortcut, status text,
- "What's This?" text, and a tooltip. Most of these can be set in
- the constructor. They can also be set independently with
- setIcon(), setText(), setIconText(), setShortcut(),
- setStatusTip(), setWhatsThis(), and setToolTip(). For menu items,
- it is possible to set an individual font with setFont().
+ A QAction may contain an icon, descriptive text, icon text, a keyboard
+ shortcut, status text, "What's This?" text, and a tooltip. All properties
+ can be set independently with setIcon(), setText(), setIconText(),
+ setShortcut(), setStatusTip(), setWhatsThis(), and setToolTip(). Icon and
+ text, as the two most important properties, can also be set in the
+ constructor. It's possible to set an individual font with setFont(), which
+ e.g. menus respect when displaying the action as a menu item.
We recommend that actions are created as children of the window
they are used in. In most cases actions will be children of
the application's main window.
- \sa QMenu, QToolBar, {Application Example}
+ \section1 QAction in widget applications
+
+ Once a QAction has been created, it should be added to the relevant
+ menu and toolbar, then connected to the slot which will perform
+ the action.
+
+ Actions are added to widgets using QWidget::addAction() or
+ QGraphicsWidget::addAction(). Note that an action must be added to a
+ widget before it can be used. This is also true when the shortcut should
+ be global (i.e., Qt::ApplicationShortcut as Qt::ShortcutContext).
+
+ Actions can be created as independent objects. But they may
+ also be created during the construction of menus. The QMenu class
+ contains convenience functions for creating actions suitable for
+ use as menu items.
+
+
+ \sa QMenu, QToolBar
*/
/*!
- \fn void QGuiAction::trigger()
+ \fn void QAction::trigger()
This is a convenience slot that calls activate(Trigger).
*/
/*!
- \fn void QGuiAction::hover()
+ \fn void QAction::hover()
This is a convenience slot that calls activate(Hover).
*/
/*!
- \enum QGuiAction::MenuRole
+ \enum QAction::MenuRole
This enum describes how an action should be moved into the application menu on \macos.
@@ -239,8 +227,8 @@ void QGuiActionPrivate::setShortcutEnabled(bool enable, QShortcutMap &map)
\note The \a parent argument is optional since Qt 5.7.
*/
-QGuiAction::QGuiAction(QObject *parent)
- : QGuiAction(*new QGuiActionPrivate, parent)
+QAction::QAction(QObject *parent)
+ : QAction(*QGuiApplicationPrivate::instance()->createActionPrivate(), parent)
{
}
@@ -249,18 +237,16 @@ QGuiAction::QGuiAction(QObject *parent)
parent is an action group the action will be automatically
inserted into the group.
- The action uses a stripped version of \a text (e.g. "\&Menu
- Option..." becomes "Menu Option") as descriptive text for
- tool buttons. You can override this by setting a specific
- description with setText(). The same text will be used for
- tooltips unless you specify a different text using
- setToolTip().
+ A stripped version of \a text (for example, "\&Menu Option..." becomes
+ "Menu Option") will be used for tooltips and icon text unless you specify a
+ different text using setToolTip() or setIconText(), respectively.
+ \sa text
*/
-QGuiAction::QGuiAction(const QString &text, QObject *parent)
- : QGuiAction(parent)
+QAction::QAction(const QString &text, QObject *parent)
+ : QAction(parent)
{
- Q_D(QGuiAction);
+ Q_D(QAction);
d->text = text;
}
@@ -269,78 +255,69 @@ QGuiAction::QGuiAction(const QString &text, QObject *parent)
parent. If \a parent is an action group the action will be
automatically inserted into the group.
- The action uses a stripped version of \a text (e.g. "\&Menu
- Option..." becomes "Menu Option") as descriptive text for
- tool buttons. You can override this by setting a specific
- description with setText(). The same text will be used for
- tooltips unless you specify a different text using
- setToolTip().
+ A stripped version of \a text (for example, "\&Menu Option..." becomes
+ "Menu Option") will be used for tooltips and icon text unless you specify a
+ different text using setToolTip() or setIconText(), respectively.
+
+ \sa text, icon
*/
-QGuiAction::QGuiAction(const QIcon &icon, const QString &text, QObject *parent)
- : QGuiAction(text, parent)
+QAction::QAction(const QIcon &icon, const QString &text, QObject *parent)
+ : QAction(text, parent)
{
- Q_D(QGuiAction);
+ Q_D(QAction);
d->icon = icon;
}
/*!
\internal
*/
-QGuiAction::QGuiAction(QGuiActionPrivate &dd, QObject *parent)
+QAction::QAction(QActionPrivate &dd, QObject *parent)
: QObject(dd, parent)
{
- Q_D(QGuiAction);
- d->group = qobject_cast<QGuiActionGroup *>(parent);
+ Q_D(QAction);
+ d->group = qobject_cast<QActionGroup *>(parent);
if (d->group)
d->group->addAction(this);
}
#if QT_CONFIG(shortcut)
/*!
- \property QGuiAction::shortcut
+ \property QAction::shortcut
\brief the action's primary shortcut key
Valid keycodes for this property can be found in \l Qt::Key and
\l Qt::Modifier. There is no default shortcut key.
*/
-void QGuiAction::setShortcut(const QKeySequence &shortcut)
-{
- QAPP_CHECK("setShortcut");
- Q_D(QGuiAction);
- if (d->shortcut == shortcut)
- return;
+/*!
+ Sets \a shortcut as the sole shortcut that triggers the action.
- d->shortcut = shortcut;
- d->redoGrab(QGuiApplicationPrivate::instance()->shortcutMap);
- d->sendDataChanged();
+ \sa shortcut, setShortcuts()
+*/
+void QAction::setShortcut(const QKeySequence &shortcut)
+{
+ if (shortcut.isEmpty())
+ setShortcuts({});
+ else
+ setShortcuts({ shortcut });
}
/*!
Sets \a shortcuts as the list of shortcuts that trigger the
action. The first element of the list is the primary shortcut.
- \sa shortcut
+ \sa shortcut, setShortcut()
*/
-void QGuiAction::setShortcuts(const QList<QKeySequence> &shortcuts)
+void QAction::setShortcuts(const QList<QKeySequence> &shortcuts)
{
- Q_D(QGuiAction);
-
- QList <QKeySequence> listCopy = shortcuts;
-
- QKeySequence primary;
- if (!listCopy.isEmpty())
- primary = listCopy.takeFirst();
+ QAPP_CHECK("setShortcuts");
+ Q_D(QAction);
- if (d->shortcut == primary && d->alternateShortcuts == listCopy)
+ if (d->shortcuts == shortcuts)
return;
- QAPP_CHECK("setShortcuts");
-
- d->shortcut = primary;
- d->alternateShortcuts = listCopy;
+ d->shortcuts = shortcuts;
d->redoGrab(QGuiApplicationPrivate::instance()->shortcutMap);
- d->redoGrabAlternate(QGuiApplicationPrivate::instance()->shortcutMap);
d->sendDataChanged();
}
@@ -352,7 +329,7 @@ void QGuiAction::setShortcuts(const QList<QKeySequence> &shortcuts)
\sa QKeySequence::keyBindings()
*/
-void QGuiAction::setShortcuts(QKeySequence::StandardKey key)
+void QAction::setShortcuts(QKeySequence::StandardKey key)
{
QList <QKeySequence> list = QKeySequence::keyBindings(key);
setShortcuts(list);
@@ -363,10 +340,12 @@ void QGuiAction::setShortcuts(QKeySequence::StandardKey key)
\sa setShortcuts()
*/
-QKeySequence QGuiAction::shortcut() const
+QKeySequence QAction::shortcut() const
{
- Q_D(const QGuiAction);
- return d->shortcut;
+ Q_D(const QAction);
+ if (d->shortcuts.isEmpty())
+ return QKeySequence();
+ return d->shortcuts.first();
}
/*!
@@ -375,44 +354,38 @@ QKeySequence QGuiAction::shortcut() const
\sa setShortcuts()
*/
-QList<QKeySequence> QGuiAction::shortcuts() const
+QList<QKeySequence> QAction::shortcuts() const
{
- Q_D(const QGuiAction);
- QList <QKeySequence> shortcuts;
- if (!d->shortcut.isEmpty())
- shortcuts << d->shortcut;
- if (!d->alternateShortcuts.isEmpty())
- shortcuts << d->alternateShortcuts;
- return shortcuts;
+ Q_D(const QAction);
+ return d->shortcuts;
}
/*!
- \property QGuiAction::shortcutContext
+ \property QAction::shortcutContext
\brief the context for the action's shortcut
Valid values for this property can be found in \l Qt::ShortcutContext.
The default value is Qt::WindowShortcut.
*/
-void QGuiAction::setShortcutContext(Qt::ShortcutContext context)
+void QAction::setShortcutContext(Qt::ShortcutContext context)
{
- Q_D(QGuiAction);
+ Q_D(QAction);
if (d->shortcutContext == context)
return;
QAPP_CHECK("setShortcutContext");
d->shortcutContext = context;
d->redoGrab(QGuiApplicationPrivate::instance()->shortcutMap);
- d->redoGrabAlternate(QGuiApplicationPrivate::instance()->shortcutMap);
d->sendDataChanged();
}
-Qt::ShortcutContext QGuiAction::shortcutContext() const
+Qt::ShortcutContext QAction::shortcutContext() const
{
- Q_D(const QGuiAction);
+ Q_D(const QAction);
return d->shortcutContext;
}
/*!
- \property QGuiAction::autoRepeat
+ \property QAction::autoRepeat
\brief whether the action can auto repeat
If true, the action will auto repeat when the keyboard shortcut
@@ -420,40 +393,39 @@ Qt::ShortcutContext QGuiAction::shortcutContext() const
enabled on the system.
The default value is true.
*/
-void QGuiAction::setAutoRepeat(bool on)
+void QAction::setAutoRepeat(bool on)
{
- Q_D(QGuiAction);
+ Q_D(QAction);
if (d->autorepeat == on)
return;
QAPP_CHECK("setAutoRepeat");
d->autorepeat = on;
d->redoGrab(QGuiApplicationPrivate::instance()->shortcutMap);
- d->redoGrabAlternate(QGuiApplicationPrivate::instance()->shortcutMap);
d->sendDataChanged();
}
-bool QGuiAction::autoRepeat() const
+bool QAction::autoRepeat() const
{
- Q_D(const QGuiAction);
+ Q_D(const QAction);
return d->autorepeat;
}
#endif // QT_CONFIG(shortcut)
/*!
- \property QGuiAction::font
+ \property QAction::font
\brief the action's font
The font property is used to render the text set on the
- QAction. The font will can be considered a hint as it will not be
+ QAction. The font can be considered a hint as it will not be
consulted in all cases based upon application and style.
By default, this property contains the application's default font.
\sa setText()
*/
-void QGuiAction::setFont(const QFont &font)
+void QAction::setFont(const QFont &font)
{
- Q_D(QGuiAction);
+ Q_D(QAction);
if (d->font == font)
return;
@@ -462,9 +434,9 @@ void QGuiAction::setFont(const QFont &font)
d->sendDataChanged();
}
-QFont QGuiAction::font() const
+QFont QAction::font() const
{
- Q_D(const QGuiAction);
+ Q_D(const QAction);
return d->font;
}
@@ -472,16 +444,20 @@ QFont QGuiAction::font() const
/*!
Destroys the object and frees allocated resources.
*/
-QGuiAction::~QGuiAction()
+QAction::~QAction()
{
- Q_D(QGuiAction);
+ Q_D(QAction);
+
+ d->destroy();
+
if (d->group)
d->group->removeAction(this);
#if QT_CONFIG(shortcut)
- if (d->shortcutId && qApp) {
- QGuiApplicationPrivate::instance()->shortcutMap.removeShortcut(d->shortcutId, this);
- for (int id : qAsConst(d->alternateShortcutIds))
- QGuiApplicationPrivate::instance()->shortcutMap.removeShortcut(id, this);
+ if (qApp) {
+ for (int id : std::as_const(d->shortcutIds)) {
+ if (id)
+ QGuiApplicationPrivate::instance()->shortcutMap.removeShortcut(id, this);
+ }
}
#endif
}
@@ -492,18 +468,18 @@ QGuiAction::~QGuiAction()
Actions within the group will be mutually exclusive.
- \sa QGuiActionGroup, guiActionGroup()
+ \sa QActionGroup, actionGroup()
*/
-void QGuiAction::setActionGroup(QGuiActionGroup *group)
+void QAction::setActionGroup(QActionGroup *group)
{
- Q_D(QGuiAction);
- if(group == d->group)
+ Q_D(QAction);
+ if (group == d->group)
return;
- if(d->group)
+ if (d->group)
d->group->removeAction(this);
d->group = group;
- if(group)
+ if (group)
group->addAction(this);
d->sendDataChanged();
}
@@ -512,17 +488,53 @@ void QGuiAction::setActionGroup(QGuiActionGroup *group)
Returns the action group for this action. If no action group manages
this action, then \nullptr will be returned.
- \sa QGuiActionGroup, setActionGroup()
+ \sa QActionGroup, setActionGroup()
*/
-QGuiActionGroup *QGuiAction::guiActionGroup() const
+QActionGroup *QAction::actionGroup() const
{
- Q_D(const QGuiAction);
+ Q_D(const QAction);
return d->group;
}
+/*!
+ \since 6.0
+ Returns a list of objects this action has been added to.
+
+ \sa QWidget::addAction(), QGraphicsWidget::addAction()
+*/
+QList<QObject*> QAction::associatedObjects() const
+{
+ Q_D(const QAction);
+ return d->associatedObjects;
+}
/*!
- \property QGuiAction::icon
+ \fn QWidget *QAction::parentWidget() const
+ \deprecated [6.0] Use parent() with qobject_cast() instead.
+
+ Returns the parent widget.
+*/
+
+/*!
+ \fn QList<QWidget*> QAction::associatedWidgets() const
+ \deprecated [6.0] Use associatedObjects() with qobject_cast() instead.
+
+ Returns a list of widgets this action has been added to.
+
+ \sa QWidget::addAction(), associatedObjects(), associatedGraphicsWidgets()
+*/
+
+/*!
+ \fn QList<QWidget*> QAction::associatedGraphicsWidgets() const
+ \deprecated [6.0] Use associatedObjects() with qobject_cast() instead.
+
+ Returns a list of graphics widgets this action has been added to.
+
+ \sa QGraphicsWidget::addAction(), associatedObjects(), associatedWidgets()
+*/
+
+/*!
+ \property QAction::icon
\brief the action's icon
In toolbars, the icon is used as the tool button icon; in menus,
@@ -532,16 +544,16 @@ QGuiActionGroup *QGuiAction::guiActionGroup() const
If a null icon (QIcon::isNull()) is passed into this function,
the icon of the action is cleared.
*/
-void QGuiAction::setIcon(const QIcon &icon)
+void QAction::setIcon(const QIcon &icon)
{
- Q_D(QGuiAction);
+ Q_D(QAction);
d->icon = icon;
d->sendDataChanged();
}
-QIcon QGuiAction::icon() const
+QIcon QAction::icon() const
{
- Q_D(const QGuiAction);
+ Q_D(const QAction);
return d->icon;
}
@@ -554,9 +566,9 @@ QIcon QGuiAction::icon() const
\sa isSeparator()
*/
-void QGuiAction::setSeparator(bool b)
+void QAction::setSeparator(bool b)
{
- Q_D(QGuiAction);
+ Q_D(QAction);
if (d->separator == b)
return;
@@ -570,14 +582,14 @@ void QGuiAction::setSeparator(bool b)
\sa setSeparator()
*/
-bool QGuiAction::isSeparator() const
+bool QAction::isSeparator() const
{
- Q_D(const QGuiAction);
+ Q_D(const QAction);
return d->separator;
}
/*!
- \property QGuiAction::text
+ \property QAction::text
\brief the action's descriptive text
If the action is added to a menu, the menu option will consist of
@@ -586,11 +598,19 @@ bool QGuiAction::isSeparator() const
by using setText(), the action's description icon text will be
used as text. There is no default text.
+ Certain UI elements, such as menus or buttons, can use '&' in front of a
+ character to automatically create a mnemonic (a shortcut) for that
+ character. For example, "&File" for a menu will create the shortcut
+ \uicontrol Alt+F, which will open the File menu. "E&xit" will create the
+ shortcut \uicontrol Alt+X for a button, or in a menu allow navigating to
+ the menu item by pressing "x". (use '&&' to display an actual ampersand).
+ The widget might consume and perform an action on a given shortcut.
+
\sa iconText
*/
-void QGuiAction::setText(const QString &text)
+void QAction::setText(const QString &text)
{
- Q_D(QGuiAction);
+ Q_D(QAction);
if (d->text == text)
return;
@@ -598,19 +618,19 @@ void QGuiAction::setText(const QString &text)
d->sendDataChanged();
}
-QString QGuiAction::text() const
+QString QAction::text() const
{
- Q_D(const QGuiAction);
+ Q_D(const QAction);
QString s = d->text;
- if(s.isEmpty()) {
+ if (s.isEmpty()) {
s = d->iconText;
- s.replace(QLatin1Char('&'), QLatin1String("&&"));
+ s.replace(u'&', "&&"_L1);
}
return s;
}
/*!
- \property QGuiAction::iconText
+ \property QAction::iconText
\brief the action's descriptive icon text
If QToolBar::toolButtonStyle is set to a value that permits text to
@@ -628,9 +648,9 @@ QString QGuiAction::text() const
\sa setToolTip(), setStatusTip()
*/
-void QGuiAction::setIconText(const QString &text)
+void QAction::setIconText(const QString &text)
{
- Q_D(QGuiAction);
+ Q_D(QAction);
if (d->iconText == text)
return;
@@ -638,16 +658,16 @@ void QGuiAction::setIconText(const QString &text)
d->sendDataChanged();
}
-QString QGuiAction::iconText() const
+QString QAction::iconText() const
{
- Q_D(const QGuiAction);
+ Q_D(const QAction);
if (d->iconText.isEmpty())
return qt_strippedText(d->text);
return d->iconText;
}
/*!
- \property QGuiAction::toolTip
+ \property QAction::toolTip
\brief the action's tooltip
This text is used for the tooltip. If no tooltip is specified,
@@ -657,9 +677,9 @@ QString QGuiAction::iconText() const
\sa setStatusTip(), setShortcut()
*/
-void QGuiAction::setToolTip(const QString &tooltip)
+void QAction::setToolTip(const QString &tooltip)
{
- Q_D(QGuiAction);
+ Q_D(QAction);
if (d->tooltip == tooltip)
return;
@@ -667,9 +687,9 @@ void QGuiAction::setToolTip(const QString &tooltip)
d->sendDataChanged();
}
-QString QGuiAction::toolTip() const
+QString QAction::toolTip() const
{
- Q_D(const QGuiAction);
+ Q_D(const QAction);
if (d->tooltip.isEmpty()) {
if (!d->text.isEmpty())
return qt_strippedText(d->text);
@@ -679,7 +699,7 @@ QString QGuiAction::toolTip() const
}
/*!
- \property QGuiAction::statusTip
+ \property QAction::statusTip
\brief the action's status tip
The status tip is displayed on all status bars provided by the
@@ -689,9 +709,9 @@ QString QGuiAction::toolTip() const
\sa setToolTip(), showStatusText()
*/
-void QGuiAction::setStatusTip(const QString &statustip)
+void QAction::setStatusTip(const QString &statustip)
{
- Q_D(QGuiAction);
+ Q_D(QAction);
if (d->statustip == statustip)
return;
@@ -699,14 +719,28 @@ void QGuiAction::setStatusTip(const QString &statustip)
d->sendDataChanged();
}
-QString QGuiAction::statusTip() const
+QString QAction::statusTip() const
{
- Q_D(const QGuiAction);
+ Q_D(const QAction);
return d->statustip;
}
/*!
- \property QGuiAction::whatsThis
+ Updates the relevant status bar for the UI represented by \a object by sending a
+ QStatusTipEvent. Returns \c true if an event was sent, otherwise returns \c false.
+
+ If a null widget is specified, the event is sent to the action's parent.
+
+ \sa statusTip
+*/
+bool QAction::showStatusText(QObject *object)
+{
+ Q_D(QAction);
+ return d->showStatusText(object, statusTip());
+}
+
+/*!
+ \property QAction::whatsThis
\brief the action's "What's This?" help text
The "What's This?" text is used to provide a brief description of
@@ -715,9 +749,9 @@ QString QGuiAction::statusTip() const
\sa QWhatsThis
*/
-void QGuiAction::setWhatsThis(const QString &whatsthis)
+void QAction::setWhatsThis(const QString &whatsthis)
{
- Q_D(QGuiAction);
+ Q_D(QAction);
if (d->whatsthis == whatsthis)
return;
@@ -725,14 +759,14 @@ void QGuiAction::setWhatsThis(const QString &whatsthis)
d->sendDataChanged();
}
-QString QGuiAction::whatsThis() const
+QString QAction::whatsThis() const
{
- Q_D(const QGuiAction);
+ Q_D(const QAction);
return d->whatsthis;
}
/*!
- \enum QGuiAction::Priority
+ \enum QAction::Priority
This enum defines priorities for actions in user interface.
@@ -749,7 +783,7 @@ QString QGuiAction::whatsThis() const
/*!
- \property QGuiAction::priority
+ \property QAction::priority
\brief the actions's priority in the user interface.
@@ -760,9 +794,9 @@ QString QGuiAction::whatsThis() const
mode set, then actions with LowPriority will not show the text
labels.
*/
-void QGuiAction::setPriority(Priority priority)
+void QAction::setPriority(Priority priority)
{
- Q_D(QGuiAction);
+ Q_D(QAction);
if (d->priority == priority)
return;
@@ -770,14 +804,14 @@ void QGuiAction::setPriority(Priority priority)
d->sendDataChanged();
}
-QGuiAction::Priority QGuiAction::priority() const
+QAction::Priority QAction::priority() const
{
- Q_D(const QGuiAction);
+ Q_D(const QAction);
return d->priority;
}
/*!
- \property QGuiAction::checkable
+ \property QAction::checkable
\brief whether the action is a checkable action
A checkable action is one which has an on/off state. For example,
@@ -790,42 +824,46 @@ QGuiAction::Priority QGuiAction::priority() const
on the state of others. For example, "Left Align", "Center" and
"Right Align" toggle actions are mutually exclusive. To achieve
exclusive toggling, add the relevant toggle actions to a
- QGuiActionGroup with the QGuiActionGroup::exclusive property set to
+ QActionGroup with the QActionGroup::exclusive property set to
true.
\sa setChecked()
*/
-void QGuiAction::setCheckable(bool b)
+void QAction::setCheckable(bool b)
{
- Q_D(QGuiAction);
+ Q_D(QAction);
if (d->checkable == b)
return;
d->checkable = b;
- d->checked = false;
+ QPointer<QAction> guard(this);
d->sendDataChanged();
+ if (guard)
+ emit checkableChanged(b);
+ if (guard && d->checked)
+ emit toggled(b);
}
-bool QGuiAction::isCheckable() const
+bool QAction::isCheckable() const
{
- Q_D(const QGuiAction);
+ Q_D(const QAction);
return d->checkable;
}
/*!
- \fn void QGuiAction::toggle()
+ \fn void QAction::toggle()
This is a convenience function for the \l checked property.
Connect to it to change the checked state to its opposite state.
*/
-void QGuiAction::toggle()
+void QAction::toggle()
{
- Q_D(QGuiAction);
+ Q_D(QAction);
setChecked(!d->checked);
}
/*!
- \property QGuiAction::checked
+ \property QAction::checked
\brief whether the action is checked.
Only checkable actions can be checked. By default, this is false
@@ -836,27 +874,29 @@ void QGuiAction::toggle()
\sa checkable, toggled()
*/
-void QGuiAction::setChecked(bool b)
+void QAction::setChecked(bool b)
{
- Q_D(QGuiAction);
- if (!d->checkable || d->checked == b)
+ Q_D(QAction);
+ if (d->checked == b)
return;
- QPointer<QGuiAction> guard(this);
d->checked = b;
+ if (!d->checkable)
+ return;
+ QPointer<QAction> guard(this);
d->sendDataChanged();
if (guard)
emit toggled(b);
}
-bool QGuiAction::isChecked() const
+bool QAction::isChecked() const
{
- Q_D(const QGuiAction);
- return d->checked;
+ Q_D(const QAction);
+ return d->checked && d->checkable;
}
/*!
- \fn void QGuiAction::setDisabled(bool b)
+ \fn void QAction::setDisabled(bool b)
This is a convenience function for the \l enabled property, that
is useful for signals--slots connections. If \a b is true the
@@ -864,7 +904,7 @@ bool QGuiAction::isChecked() const
*/
/*!
- \property QGuiAction::enabled
+ \property QAction::enabled
\brief whether the action is enabled
Disabled actions cannot be chosen by the user. They do not
@@ -884,30 +924,58 @@ bool QGuiAction::isChecked() const
\sa text
*/
-void QGuiAction::setEnabled(bool b)
+void QAction::setEnabled(bool b)
{
- Q_D(QGuiAction);
- if (b == d->enabled && b != d->forceDisabled)
- return;
- d->forceDisabled = !b;
- if (b && (!d->visible || (d->group && !d->group->isEnabled())))
+ Q_D(QAction);
+ if (d->explicitEnabledValue == b && d->explicitEnabled)
return;
+ d->explicitEnabledValue = b;
+ d->explicitEnabled = true;
QAPP_CHECK("setEnabled");
- d->enabled = b;
+ d->setEnabled(b, false);
+}
+
+bool QActionPrivate::setEnabled(bool b, bool byGroup)
+{
+ Q_Q(QAction);
+ if (b && !visible)
+ b = false;
+ if (b && !byGroup && (group && !group->isEnabled()))
+ b = false;
+ if (b && byGroup && explicitEnabled)
+ b = explicitEnabledValue;
+
+ if (b == enabled)
+ return false;
+
+ enabled = b;
#if QT_CONFIG(shortcut)
- d->setShortcutEnabled(b, QGuiApplicationPrivate::instance()->shortcutMap);
+ setShortcutEnabled(b, QGuiApplicationPrivate::instance()->shortcutMap);
#endif
- d->sendDataChanged();
+ QPointer guard(q);
+ sendDataChanged();
+ if (guard)
+ emit q->enabledChanged(b);
+ return true;
}
-bool QGuiAction::isEnabled() const
+void QAction::resetEnabled()
{
- Q_D(const QGuiAction);
+ Q_D(QAction);
+ if (!d->explicitEnabled)
+ return;
+ d->explicitEnabled = false;
+ d->setEnabled(true, false);
+}
+
+bool QAction::isEnabled() const
+{
+ Q_D(const QAction);
return d->enabled;
}
/*!
- \property QGuiAction::visible
+ \property QAction::visible
\brief whether the action can be seen (e.g. in menus and toolbars)
If \e visible is true the action can be seen (e.g. in menus and
@@ -919,37 +987,55 @@ bool QGuiAction::isEnabled() const
By default, this property is \c true (actions are visible).
*/
-void QGuiAction::setVisible(bool b)
+void QAction::setVisible(bool b)
{
- Q_D(QGuiAction);
- if (b == d->visible && b != d->forceInvisible)
+ Q_D(QAction);
+ if (b != d->forceInvisible)
return;
- QAPP_CHECK("setVisible");
d->forceInvisible = !b;
- d->visible = b;
- d->enabled = b && !d->forceDisabled && (!d->group || d->group->isEnabled()) ;
-#if QT_CONFIG(shortcut)
- d->setShortcutEnabled(d->enabled, QGuiApplicationPrivate::instance()->shortcutMap);
-#endif
- d->sendDataChanged();
+ if (b && d->group && !d->group->isVisible())
+ return;
+ d->setVisible(b);
}
+void QActionPrivate::setVisible(bool b)
+{
+ Q_Q(QAction);
+ if (b == visible)
+ return;
+ QAPP_CHECK("setVisible");
+ visible = b;
+ bool enable = visible;
+ if (enable && explicitEnabled)
+ enable = explicitEnabledValue;
+ QPointer guard(q);
+ if (!setEnabled(enable, false))
+ sendDataChanged();
+ if (guard)
+ emit q->visibleChanged();
+}
-bool QGuiAction::isVisible() const
+bool QAction::isVisible() const
{
- Q_D(const QGuiAction);
+ Q_D(const QAction);
return d->visible;
}
/*!
\reimp
*/
-bool QGuiAction::event(QEvent *e)
+bool QAction::event(QEvent *e)
{
+ Q_D(QAction);
+ if (e->type() == QEvent::ActionChanged) {
+ for (auto object : std::as_const(d->associatedObjects))
+ QCoreApplication::sendEvent(object, e);
+ }
+
#if QT_CONFIG(shortcut)
if (e->type() == QEvent::Shortcut) {
QShortcutEvent *se = static_cast<QShortcutEvent *>(e);
- Q_ASSERT_X(se->key() == d_func()->shortcut || d_func()->alternateShortcuts.contains(se->key()),
+ Q_ASSERT_X(d_func()->shortcutIds.contains(se->shortcutId()),
"QAction::event",
"Received shortcut event from incorrect shortcut");
if (se->isAmbiguous())
@@ -967,20 +1053,20 @@ bool QGuiAction::event(QEvent *e)
\sa setData()
*/
-QVariant QGuiAction::data() const
+QVariant QAction::data() const
{
- Q_D(const QGuiAction);
+ Q_D(const QAction);
return d->userData;
}
/*!
- Sets the action's internal data to the given \a userData.
+ Sets the action's internal data to the given \a data.
\sa data()
*/
-void QGuiAction::setData(const QVariant &data)
+void QAction::setData(const QVariant &data)
{
- Q_D(QGuiAction);
+ Q_D(QAction);
if (d->userData == data)
return;
d->userData = data;
@@ -990,19 +1076,22 @@ void QGuiAction::setData(const QVariant &data)
/*!
Sends the relevant signals for ActionEvent \a event.
- Action based widgets use this API to cause the QAction
+ Action-based widgets use this API to cause the QAction
to emit signals as well as emitting their own.
*/
-void QGuiAction::activate(ActionEvent event)
+void QAction::activate(ActionEvent event)
{
- Q_D(QGuiAction);
- if(event == Trigger) {
+ Q_D(QAction);
+ if (event == Trigger) {
+ // Ignore even explicit triggers when explicitly disabled
+ if ((d->explicitEnabled && !d->explicitEnabledValue) || (d->group && !d->group->isEnabled()))
+ return;
QPointer<QObject> guard = this;
- if(d->checkable) {
+ if (d->checkable) {
// the checked action of an exclusive group may not be unchecked
if (d->checked && (d->group
- && d->group->exclusionPolicy() == QGuiActionGroup::ExclusionPolicy::Exclusive
- && d->group->checkedGuiAction() == this)) {
+ && d->group->exclusionPolicy() == QActionGroup::ExclusionPolicy::Exclusive
+ && d->group->checkedAction() == this)) {
if (!guard.isNull())
emit triggered(true);
return;
@@ -1011,13 +1100,13 @@ void QGuiAction::activate(ActionEvent event)
}
if (!guard.isNull())
emit triggered(d->checked);
- } else if(event == Hover) {
+ } else if (event == Hover) {
emit hovered();
}
}
/*!
- \fn void QGuiAction::triggered(bool checked)
+ \fn void QAction::triggered(bool checked)
This signal is emitted when an action is activated by the user;
for example, when the user clicks a menu option, toolbar button,
@@ -1032,7 +1121,7 @@ void QGuiAction::activate(ActionEvent event)
*/
/*!
- \fn void QGuiAction::toggled(bool checked)
+ \fn void QAction::toggled(bool checked)
This signal is emitted whenever a checkable action changes its
isChecked() status. This can be the result of a user interaction,
@@ -1046,7 +1135,7 @@ void QGuiAction::activate(ActionEvent event)
*/
/*!
- \fn void QGuiAction::hovered()
+ \fn void QAction::hovered()
This signal is emitted when an action is highlighted by the user;
for example, when the user pauses with the cursor over a menu option,
@@ -1056,7 +1145,7 @@ void QGuiAction::activate(ActionEvent event)
*/
/*!
- \fn void QGuiAction::changed()
+ \fn void QAction::changed()
This signal is emitted when an action has changed. If you
are only interested in actions in a given widget, you can
@@ -1067,7 +1156,7 @@ void QGuiAction::activate(ActionEvent event)
*/
/*!
- \enum QGuiAction::ActionEvent
+ \enum QAction::ActionEvent
This enum type is used when calling QAction::activate()
@@ -1077,7 +1166,7 @@ void QGuiAction::activate(ActionEvent event)
*/
/*!
- \property QGuiAction::menuRole
+ \property QAction::menuRole
\brief the action's menu role
This indicates what role the action serves in the application menu on
@@ -1088,9 +1177,9 @@ void QGuiAction::activate(ActionEvent event)
bar in \macos (usually just before the first application window is
shown).
*/
-void QGuiAction::setMenuRole(MenuRole menuRole)
+void QAction::setMenuRole(MenuRole menuRole)
{
- Q_D(QGuiAction);
+ Q_D(QAction);
if (d->menuRole == menuRole)
return;
@@ -1098,14 +1187,41 @@ void QGuiAction::setMenuRole(MenuRole menuRole)
d->sendDataChanged();
}
-QGuiAction::MenuRole QGuiAction::menuRole() const
+QAction::MenuRole QAction::menuRole() const
{
- Q_D(const QGuiAction);
+ Q_D(const QAction);
return d->menuRole;
}
/*!
- \property QGuiAction::iconVisibleInMenu
+ \fn QMenu *QAction::menu() const
+
+ Returns the menu contained by this action.
+
+ In widget applications, actions that contain menus can be used to create menu
+ items with submenus, or inserted into toolbars to create buttons with popup menus.
+
+ \sa QMenu::addAction(), QMenu::menuInAction()
+*/
+QObject* QAction::menuObject() const
+{
+ Q_D(const QAction);
+ return d->menu();
+}
+
+/*!
+ \fn void QAction::setMenu(QMenu *menu)
+
+ Sets the menu contained by this action to the specified \a menu.
+*/
+void QAction::setMenuObject(QObject *object)
+{
+ Q_D(QAction);
+ d->setMenu(object);
+}
+
+/*!
+ \property QAction::iconVisibleInMenu
\brief Whether or not an action should show an icon in a menu
In some applications, it may make sense to have actions with icons in the
@@ -1114,16 +1230,16 @@ QGuiAction::MenuRole QGuiAction::menuRole() const
The default is to follow whether the Qt::AA_DontShowIconsInMenus attribute
is set for the application. Explicitly settings this property overrides
- the presence (or abscence) of the attribute.
+ the presence (or absence) of the attribute.
For example:
\snippet code/src_gui_kernel_qaction.cpp 0
\sa icon, QCoreApplication::setAttribute()
*/
-void QGuiAction::setIconVisibleInMenu(bool visible)
+void QAction::setIconVisibleInMenu(bool visible)
{
- Q_D(QGuiAction);
+ Q_D(QAction);
if (d->iconVisibleInMenu == -1 || visible != bool(d->iconVisibleInMenu)) {
int oldValue = d->iconVisibleInMenu;
d->iconVisibleInMenu = visible;
@@ -1135,9 +1251,9 @@ void QGuiAction::setIconVisibleInMenu(bool visible)
}
}
-bool QGuiAction::isIconVisibleInMenu() const
+bool QAction::isIconVisibleInMenu() const
{
- Q_D(const QGuiAction);
+ Q_D(const QAction);
if (d->iconVisibleInMenu == -1) {
return !QCoreApplication::testAttribute(Qt::AA_DontShowIconsInMenus);
}
@@ -1145,7 +1261,7 @@ bool QGuiAction::isIconVisibleInMenu() const
}
/*!
- \property QGuiAction::shortcutVisibleInContextMenu
+ \property QAction::shortcutVisibleInContextMenu
\brief Whether or not an action should show a shortcut in a context menu
In some applications, it may make sense to have actions with shortcuts in
@@ -1153,14 +1269,13 @@ bool QGuiAction::isIconVisibleInMenu() const
shown via a context menu, when it is false, it is not shown.
The default is to follow whether the Qt::AA_DontShowShortcutsInContextMenus attribute
- is set for the application, falling back to the widget style hint.
- Explicitly setting this property overrides the presence (or abscence) of the attribute.
+ is set for the application. Explicitly setting this property overrides the attribute.
\sa shortcut, QCoreApplication::setAttribute()
*/
-void QGuiAction::setShortcutVisibleInContextMenu(bool visible)
+void QAction::setShortcutVisibleInContextMenu(bool visible)
{
- Q_D(QGuiAction);
+ Q_D(QAction);
if (d->shortcutVisibleInContextMenu == -1 || visible != bool(d->shortcutVisibleInContextMenu)) {
int oldValue = d->shortcutVisibleInContextMenu;
d->shortcutVisibleInContextMenu = visible;
@@ -1172,18 +1287,16 @@ void QGuiAction::setShortcutVisibleInContextMenu(bool visible)
}
}
-bool QGuiAction::isShortcutVisibleInContextMenu() const
+bool QAction::isShortcutVisibleInContextMenu() const
{
- Q_D(const QGuiAction);
- if (d->shortcutVisibleInContextMenu == -1) {
- return !QCoreApplication::testAttribute(Qt::AA_DontShowShortcutsInContextMenus)
- && QGuiApplication::styleHints()->showShortcutsInContextMenus();
- }
+ Q_D(const QAction);
+ if (d->shortcutVisibleInContextMenu == -1)
+ return !QCoreApplication::testAttribute(Qt::AA_DontShowShortcutsInContextMenus);
return d->shortcutVisibleInContextMenu;
}
#ifndef QT_NO_DEBUG_STREAM
-Q_GUI_EXPORT QDebug operator<<(QDebug d, const QGuiAction *action)
+Q_GUI_EXPORT QDebug operator<<(QDebug d, const QAction *action)
{
QDebugStateSaver saver(d);
d.nospace();
@@ -1195,11 +1308,12 @@ Q_GUI_EXPORT QDebug operator<<(QDebug d, const QGuiAction *action)
if (action->isCheckable())
d << " checked=" << action->isChecked();
#if QT_CONFIG(shortcut)
- if (!action->shortcut().isEmpty())
- d << " shortcut=" << action->shortcut();
+ if (!action->shortcuts().isEmpty())
+ d << " shortcuts=" << action->shortcuts();
#endif
d << " menuRole=";
QtDebugUtils::formatQEnum(d, action->menuRole());
+ d << " enabled=" << action->isEnabled();
d << " visible=" << action->isVisible();
} else {
d << '0';
@@ -1211,4 +1325,4 @@ Q_GUI_EXPORT QDebug operator<<(QDebug d, const QGuiAction *action)
QT_END_NAMESPACE
-#include "moc_qguiaction.cpp"
+#include "moc_qaction.cpp"
diff --git a/src/gui/kernel/qguiaction.h b/src/gui/kernel/qaction.h
index 454f66893f..d805599138 100644
--- a/src/gui/kernel/qguiaction.h
+++ b/src/gui/kernel/qaction.h
@@ -1,44 +1,8 @@
-/****************************************************************************
-**
-** Copyright (C) 2019 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the QtGui module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef QGUIACTION_H
-#define QGUIACTION_H
+// Copyright (C) 2020 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
+
+#ifndef QACTION_H
+#define QACTION_H
#include <QtGui/qtguiglobal.h>
#if QT_CONFIG(shortcut)
@@ -47,23 +11,30 @@
#include <QtGui/qicon.h>
#include <QtCore/qstring.h>
#include <QtCore/qvariant.h>
+#include <QtCore/qobject.h>
QT_REQUIRE_CONFIG(action);
QT_BEGIN_NAMESPACE
class QActionEvent;
-class QGuiActionGroup;
-class QGuiActionPrivate;
+class QActionGroup;
+class QActionPrivate;
+class QMenu;
+#if QT_DEPRECATED_SINCE(6,0)
+class QWidget;
+class QGraphicsWidget;
+#endif
-class Q_GUI_EXPORT QGuiAction : public QObject
+class Q_GUI_EXPORT QAction : public QObject
{
Q_OBJECT
- Q_DECLARE_PRIVATE(QGuiAction)
+ Q_DECLARE_PRIVATE(QAction)
- Q_PROPERTY(bool checkable READ isCheckable WRITE setCheckable NOTIFY changed)
+ Q_PROPERTY(bool checkable READ isCheckable WRITE setCheckable NOTIFY checkableChanged FINAL)
Q_PROPERTY(bool checked READ isChecked WRITE setChecked NOTIFY toggled)
- Q_PROPERTY(bool enabled READ isEnabled WRITE setEnabled NOTIFY changed)
+ Q_PROPERTY(bool enabled READ isEnabled WRITE setEnabled NOTIFY enabledChanged
+ RESET resetEnabled FINAL)
Q_PROPERTY(QIcon icon READ icon WRITE setIcon NOTIFY changed)
Q_PROPERTY(QString text READ text WRITE setText NOTIFY changed)
Q_PROPERTY(QString iconText READ iconText WRITE setIconText NOTIFY changed)
@@ -73,14 +44,17 @@ class Q_GUI_EXPORT QGuiAction : public QObject
Q_PROPERTY(QFont font READ font WRITE setFont NOTIFY changed)
#if QT_CONFIG(shortcut)
Q_PROPERTY(QKeySequence shortcut READ shortcut WRITE setShortcut NOTIFY changed)
- Q_PROPERTY(Qt::ShortcutContext shortcutContext READ shortcutContext WRITE setShortcutContext NOTIFY changed)
+ Q_PROPERTY(Qt::ShortcutContext shortcutContext READ shortcutContext WRITE setShortcutContext
+ NOTIFY changed)
Q_PROPERTY(bool autoRepeat READ autoRepeat WRITE setAutoRepeat NOTIFY changed)
#endif // QT_CONFIG(shortcut)
- Q_PROPERTY(bool visible READ isVisible WRITE setVisible NOTIFY changed)
+ Q_PROPERTY(bool visible READ isVisible WRITE setVisible NOTIFY visibleChanged FINAL)
Q_PROPERTY(MenuRole menuRole READ menuRole WRITE setMenuRole NOTIFY changed)
- Q_PROPERTY(bool iconVisibleInMenu READ isIconVisibleInMenu WRITE setIconVisibleInMenu NOTIFY changed)
- Q_PROPERTY(bool shortcutVisibleInContextMenu READ isShortcutVisibleInContextMenu WRITE setShortcutVisibleInContextMenu NOTIFY changed)
- Q_PROPERTY(Priority priority READ priority WRITE setPriority)
+ Q_PROPERTY(bool iconVisibleInMenu READ isIconVisibleInMenu WRITE setIconVisibleInMenu
+ NOTIFY changed)
+ Q_PROPERTY(bool shortcutVisibleInContextMenu READ isShortcutVisibleInContextMenu
+ WRITE setShortcutVisibleInContextMenu NOTIFY changed)
+ Q_PROPERTY(Priority priority READ priority WRITE setPriority NOTIFY changed)
public:
// note this is copied into qplatformmenu.h, which must stay in sync
@@ -91,14 +65,59 @@ public:
NormalPriority = 128,
HighPriority = 256};
Q_ENUM(Priority)
- explicit QGuiAction(QObject *parent = nullptr);
- explicit QGuiAction(const QString &text, QObject *parent = nullptr);
- explicit QGuiAction(const QIcon &icon, const QString &text, QObject *parent = nullptr);
-
- ~QGuiAction();
+ explicit QAction(QObject *parent = nullptr);
+ explicit QAction(const QString &text, QObject *parent = nullptr);
+ explicit QAction(const QIcon &icon, const QString &text, QObject *parent = nullptr);
+
+ ~QAction();
+
+ QList<QObject *> associatedObjects() const;
+
+#if QT_DEPRECATED_SINCE(6,0)
+#ifdef Q_QDOC
+ QWidget *parentWidget() const;
+ QList<QWidget*> associatedWidgets() const;
+ QList<QGraphicsWidget*> associatedGraphicsWidgets() const;
+#else
+ /*
+ These are templates so that instantiation happens only in calling code, when
+ QWidget, QMenu, and QGraphicsWidget can be expected to be fully defined.
+ */
+ template<typename T = QWidget*>
+ QT_DEPRECATED_VERSION_X_6_0("Use parent() with qobject_cast() instead")
+ T parentWidget() const
+ {
+ auto result = parent();
+ while (result && !qobject_cast<T>(result))
+ result = result->parent();
+ return static_cast<T>(result);
+ }
+
+ template<typename T = QWidget*>
+ QT_DEPRECATED_VERSION_X_6_0("Use associatedObjects() with qobject_cast() instead")
+ QList<T> associatedWidgets() const
+ {
+ QList<T> result;
+ for (auto object : associatedObjects())
+ if (auto widget = qobject_cast<T>(object))
+ result.append(widget);
+ return result;
+ }
+ template<typename T = QGraphicsWidget*>
+ QT_DEPRECATED_VERSION_X_6_0("Use associatedObjects() with qobject_cast() instead")
+ QList<T> associatedGraphicsWidgets() const
+ {
+ QList<T> result;
+ for (auto object : associatedObjects())
+ if (auto graphicsWidget = qobject_cast<T>(object))
+ result.append(graphicsWidget);
+ return result;
+ }
+#endif
+#endif
- void setActionGroup(QGuiActionGroup *group);
- QGuiActionGroup *guiActionGroup() const;
+ void setActionGroup(QActionGroup *group);
+ QActionGroup *actionGroup() const;
void setIcon(const QIcon &icon);
QIcon icon() const;
@@ -159,15 +178,33 @@ public:
void setMenuRole(MenuRole menuRole);
MenuRole menuRole() const;
+#ifdef Q_QDOC
+ QMenu *menu() const;
+ void setMenu(QMenu *menu);
+#else
+ template<typename T = QMenu*>
+ T menu() const
+ {
+ return qobject_cast<T>(menuObject());
+ }
+ template<typename T = QMenu*>
+ void setMenu(T m)
+ {
+ setMenuObject(m);
+ }
+#endif
+
void setIconVisibleInMenu(bool visible);
bool isIconVisibleInMenu() const;
void setShortcutVisibleInContextMenu(bool show);
bool isShortcutVisibleInContextMenu() const;
+ bool showStatusText(QObject *object = nullptr);
+
protected:
bool event(QEvent *) override;
- QGuiAction(QGuiActionPrivate &dd, QObject *parent);
+ QAction(QActionPrivate &dd, QObject *parent);
public Q_SLOTS:
void trigger() { activate(Trigger); }
@@ -175,24 +212,36 @@ public Q_SLOTS:
void setChecked(bool);
void toggle();
void setEnabled(bool);
+ void resetEnabled();
inline void setDisabled(bool b) { setEnabled(!b); }
void setVisible(bool);
Q_SIGNALS:
void changed();
+ void enabledChanged(bool enabled);
+ void checkableChanged(bool checkable);
+ void visibleChanged();
void triggered(bool checked = false);
void hovered();
void toggled(bool);
private:
- Q_DISABLE_COPY(QGuiAction)
- friend class QGuiActionGroup;
+ Q_DISABLE_COPY(QAction)
+ friend class QActionGroup;
+ friend class QWidget;
+ friend class QMenu;
+ friend class QMenuPrivate;
+ friend class QToolButton;
+ friend class QGraphicsWidget;
+
+ QObject *menuObject() const;
+ void setMenuObject(QObject *object);
};
#ifndef QT_NO_DEBUG_STREAM
-Q_GUI_EXPORT QDebug operator<<(QDebug, const QGuiAction *);
+Q_GUI_EXPORT QDebug operator<<(QDebug, const QAction *);
#endif
QT_END_NAMESPACE
-#endif // QGUIACTION_H
+#endif // QACTION_H
diff --git a/src/gui/kernel/qaction_p.h b/src/gui/kernel/qaction_p.h
new file mode 100644
index 0000000000..e79cc26b4d
--- /dev/null
+++ b/src/gui/kernel/qaction_p.h
@@ -0,0 +1,102 @@
+// Copyright (C) 2019 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
+
+#ifndef QACTION_P_H
+#define QACTION_P_H
+
+//
+// W A R N I N G
+// -------------
+//
+// This file is not part of the Qt API. It exists for the convenience
+// of other Qt classes. This header file may change from version to
+// version without notice, or even be removed.
+//
+// We mean it.
+//
+
+#include <QtGui/private/qtguiglobal_p.h>
+#include <QtGui/qaction.h>
+#include <QtGui/qfont.h>
+#if QT_CONFIG(shortcut)
+# include <QtGui/private/qshortcutmap_p.h>
+#endif
+
+#include <QtCore/qpointer.h>
+#include "private/qobject_p.h"
+
+QT_REQUIRE_CONFIG(action);
+
+QT_BEGIN_NAMESPACE
+
+class QShortcutMap;
+
+class Q_GUI_EXPORT QActionPrivate : public QObjectPrivate
+{
+ Q_DECLARE_PUBLIC(QAction)
+public:
+ QActionPrivate();
+ ~QActionPrivate();
+
+ virtual void destroy();
+
+#if QT_CONFIG(shortcut)
+ virtual QShortcutMap::ContextMatcher contextMatcher() const;
+#endif
+
+ static QActionPrivate *get(QAction *q)
+ {
+ return q->d_func();
+ }
+
+ bool setEnabled(bool enable, bool byGroup);
+ void setVisible(bool b);
+
+ QPointer<QActionGroup> group;
+ QString text;
+ QString iconText;
+ QIcon icon;
+ QString tooltip;
+ QString statustip;
+ QString whatsthis;
+#if QT_CONFIG(shortcut)
+ QList<QKeySequence> shortcuts;
+#endif
+ QVariant userData;
+
+ QObjectList associatedObjects;
+ virtual QObject *menu() const;
+ virtual void setMenu(QObject *menu);
+
+#if QT_CONFIG(shortcut)
+ QList<int> shortcutIds;
+ Qt::ShortcutContext shortcutContext = Qt::WindowShortcut;
+ uint autorepeat : 1;
+#endif
+ QFont font;
+ uint enabled : 1, explicitEnabled : 1, explicitEnabledValue : 1;
+ uint visible : 1, forceInvisible : 1;
+ uint checkable : 1;
+ uint checked : 1;
+ uint separator : 1;
+ uint fontSet : 1;
+
+ int iconVisibleInMenu : 2; // Only has values -1, 0, and 1
+ int shortcutVisibleInContextMenu : 2; // Only has values -1, 0, and 1
+
+ QAction::MenuRole menuRole = QAction::TextHeuristicRole;
+ QAction::Priority priority = QAction::NormalPriority;
+
+#if QT_CONFIG(shortcut)
+ void redoGrab(QShortcutMap &map);
+ void redoGrabAlternate(QShortcutMap &map);
+ void setShortcutEnabled(bool enable, QShortcutMap &map);
+#endif // QT_NO_SHORTCUT
+
+ bool showStatusText(QObject *widget, const QString &str);
+ void sendDataChanged();
+};
+
+QT_END_NAMESPACE
+
+#endif // QACTION_P_H
diff --git a/src/gui/kernel/qactiongroup.cpp b/src/gui/kernel/qactiongroup.cpp
new file mode 100644
index 0000000000..7fb5b4ad46
--- /dev/null
+++ b/src/gui/kernel/qactiongroup.cpp
@@ -0,0 +1,328 @@
+// Copyright (C) 2019 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
+
+#include "qactiongroup.h"
+
+#include "qaction.h"
+#include "qaction_p.h"
+#include "qactiongroup_p.h"
+#include "qevent.h"
+#include "qlist.h"
+
+QT_BEGIN_NAMESPACE
+
+QActionGroupPrivate::QActionGroupPrivate() :
+ enabled(1), visible(1)
+{
+}
+
+QActionGroupPrivate::~QActionGroupPrivate() = default;
+
+void QActionGroup::_q_actionChanged()
+{
+ Q_D(QActionGroup);
+ auto action = qobject_cast<QAction*>(sender());
+ Q_ASSERT_X(action != nullptr, "QActionGroup::_q_actionChanged", "internal error");
+ if (d->exclusionPolicy != QActionGroup::ExclusionPolicy::None) {
+ if (action->isChecked()) {
+ if (action != d->current) {
+ if (!d->current.isNull())
+ d->current->setChecked(false);
+ d->current = action;
+ }
+ } else if (action == d->current) {
+ d->current = nullptr;
+ }
+ }
+}
+
+void QActionGroup::_q_actionTriggered()
+{
+ auto action = qobject_cast<QAction*>(sender());
+ Q_ASSERT_X(action != nullptr, "QActionGroup::_q_actionTriggered", "internal error");
+ emit triggered(action);
+}
+
+void QActionGroup::_q_actionHovered()
+{
+ auto action = qobject_cast<QAction*>(sender());
+ Q_ASSERT_X(action != nullptr, "QActionGroup::_q_actionHovered", "internal error");
+ emit hovered(action);
+}
+
+/*!
+ \class QActionGroup
+ \brief The QActionGroup class groups actions together.
+ \since 6.0
+
+ \inmodule QtGui
+
+ QActionGroup is a base class for classes grouping
+ classes inhheriting QAction objects together.
+
+ In some situations it is useful to group QAction objects together.
+ For example, if you have a \uicontrol{Left Align} action, a \uicontrol{Right
+ Align} action, a \uicontrol{Justify} action, and a \uicontrol{Center} action,
+ only one of these actions should be active at any one time. One
+ simple way of achieving this is to group the actions together in
+ an action group, inheriting QActionGroup.
+
+ \sa QAction
+*/
+
+/*!
+ \enum QActionGroup::ExclusionPolicy
+
+ This enum specifies the different policies that can be used to
+ control how the group performs exclusive checking on checkable actions.
+
+ \value None
+ The actions in the group can be checked independently of each other.
+
+ \value Exclusive
+ Exactly one action can be checked at any one time.
+ This is the default policy.
+
+ \value ExclusiveOptional
+ At most one action can be checked at any one time. The actions
+ can also be all unchecked.
+
+ \sa exclusionPolicy
+*/
+
+/*!
+ Constructs an action group for the \a parent object.
+
+ The action group is exclusive by default. Call setExclusive(false)
+ to make the action group non-exclusive. To make the group exclusive
+ but allow unchecking the active action call instead
+ setExclusionPolicy(QActionGroup::ExclusionPolicy::ExclusiveOptional)
+*/
+QActionGroup::QActionGroup(QObject* parent) :
+ QActionGroup(*new QActionGroupPrivate, parent)
+{
+}
+
+QActionGroup::QActionGroup(QActionGroupPrivate &dd, QObject *parent) :
+ QObject(dd, parent)
+{
+}
+
+/*!
+ Destroys the action group.
+*/
+QActionGroup::~QActionGroup() = default;
+
+/*!
+ \fn QAction *QActionGroup::addAction(QAction *action)
+
+ Adds the \a action to this group, and returns it.
+
+ Normally an action is added to a group by creating it with the
+ group as its parent, so this function is not usually used.
+
+ \sa QAction::setActionGroup()
+*/
+QAction *QActionGroup::addAction(QAction* a)
+{
+ Q_D(QActionGroup);
+ if (!d->actions.contains(a)) {
+ d->actions.append(a);
+ QObject::connect(a, &QAction::triggered, this, &QActionGroup::_q_actionTriggered);
+ QObject::connect(a, &QAction::changed, this, &QActionGroup::_q_actionChanged);
+ QObject::connect(a, &QAction::hovered, this, &QActionGroup::_q_actionHovered);
+ }
+ a->d_func()->setEnabled(d->enabled, true);
+ if (!a->d_func()->forceInvisible)
+ a->d_func()->setVisible(d->visible);
+ if (a->isChecked())
+ d->current = a;
+ QActionGroup *oldGroup = a->d_func()->group;
+ if (oldGroup != this) {
+ if (oldGroup)
+ oldGroup->removeAction(a);
+ a->d_func()->group = this;
+ a->d_func()->sendDataChanged();
+ }
+ return a;
+}
+
+/*!
+ Creates and returns an action with \a text. The newly created
+ action is a child of this action group.
+
+ Normally an action is added to a group by creating it with the
+ group as parent, so this function is not usually used.
+
+ \sa QAction::setActionGroup()
+*/
+QAction *QActionGroup::addAction(const QString &text)
+{
+ return new QAction(text, this);
+}
+
+/*!
+ Creates and returns an action with \a text and an \a icon. The
+ newly created action is a child of this action group.
+
+ Normally an action is added to a group by creating it with the
+ group as its parent, so this function is not usually used.
+
+ \sa QAction::setActionGroup()
+*/
+QAction *QActionGroup::addAction(const QIcon &icon, const QString &text)
+{
+ return new QAction(icon, text, this);
+}
+
+/*!
+ Removes the \a action from this group. The action will have no
+ parent as a result.
+
+ \sa QAction::setActionGroup()
+*/
+void QActionGroup::removeAction(QAction *action)
+{
+ Q_D(QActionGroup);
+ if (d->actions.removeAll(action)) {
+ if (action == d->current)
+ d->current = nullptr;
+ QObject::disconnect(action, &QAction::triggered, this, &QActionGroup::_q_actionTriggered);
+ QObject::disconnect(action, &QAction::changed, this, &QActionGroup::_q_actionChanged);
+ QObject::disconnect(action, &QAction::hovered, this, &QActionGroup::_q_actionHovered);
+ action->d_func()->group = nullptr;
+ }
+}
+
+/*!
+ Returns the list of this groups's actions. This may be empty.
+*/
+QList<QAction*> QActionGroup::actions() const
+{
+ Q_D(const QActionGroup);
+ return d->actions;
+}
+
+/*!
+ \brief Enable or disable the group exclusion checking
+
+ This is a convenience method that calls
+ setExclusionPolicy(ExclusionPolicy::Exclusive) when \a b is true,
+ else setExclusionPolicy(QActionGroup::ExclusionPolicy::None).
+
+ \sa QActionGroup::exclusionPolicy
+*/
+void QActionGroup::setExclusive(bool b)
+{
+ setExclusionPolicy(b ? QActionGroup::ExclusionPolicy::Exclusive
+ : QActionGroup::ExclusionPolicy::None);
+}
+
+/*!
+ \brief Returns true if the group is exclusive
+
+ The group is exclusive if the ExclusionPolicy is either Exclusive
+ or ExclusionOptional.
+
+*/
+bool QActionGroup::isExclusive() const
+{
+ return exclusionPolicy() != QActionGroup::ExclusionPolicy::None;
+}
+
+/*!
+ \property QActionGroup::exclusionPolicy
+ \brief This property holds the group exclusive checking policy
+
+ If exclusionPolicy is set to Exclusive, only one checkable
+ action in the action group can ever be active at any time. If the user
+ chooses another checkable action in the group, the one they chose becomes
+ active and the one that was active becomes inactive. If exclusionPolicy is
+ set to ExclusionOptional the group is exclusive but the active checkable
+ action in the group can be unchecked leaving the group with no actions
+ checked.
+
+ \sa QAction::checkable
+*/
+void QActionGroup::setExclusionPolicy(QActionGroup::ExclusionPolicy policy)
+{
+ Q_D(QActionGroup);
+ d->exclusionPolicy = policy;
+}
+
+QActionGroup::ExclusionPolicy QActionGroup::exclusionPolicy() const
+{
+ Q_D(const QActionGroup);
+ return d->exclusionPolicy;
+}
+
+/*!
+ \fn void QActionGroup::setDisabled(bool b)
+
+ This is a convenience function for the \l enabled property, that
+ is useful for signals--slots connections. If \a b is true the
+ action group is disabled; otherwise it is enabled.
+*/
+
+/*!
+ \property QActionGroup::enabled
+ \brief whether the action group is enabled
+
+ Each action in the group will be enabled or disabled unless it
+ has been explicitly disabled.
+
+ \sa QAction::setEnabled()
+*/
+void QActionGroup::setEnabled(bool b)
+{
+ Q_D(QActionGroup);
+ d->enabled = b;
+ for (auto action : std::as_const(d->actions)) {
+ action->d_func()->setEnabled(b, true);
+ }
+}
+
+bool QActionGroup::isEnabled() const
+{
+ Q_D(const QActionGroup);
+ return d->enabled;
+}
+
+/*!
+ Returns the currently checked action in the group, or \nullptr if
+ none are checked.
+*/
+QAction *QActionGroup::checkedAction() const
+{
+ Q_D(const QActionGroup);
+ return d->current.data();
+}
+
+/*!
+ \property QActionGroup::visible
+ \brief whether the action group is visible
+
+ Each action in the action group will match the visible state of
+ this group unless it has been explicitly hidden.
+
+ \sa QAction::setEnabled()
+*/
+void QActionGroup::setVisible(bool b)
+{
+ Q_D(QActionGroup);
+ d->visible = b;
+ for (auto action : std::as_const(d->actions)) {
+ if (!action->d_func()->forceInvisible)
+ action->d_func()->setVisible(b);
+ }
+}
+
+bool QActionGroup::isVisible() const
+{
+ Q_D(const QActionGroup);
+ return d->visible;
+}
+
+QT_END_NAMESPACE
+
+#include "moc_qactiongroup.cpp"
diff --git a/src/gui/kernel/qactiongroup.h b/src/gui/kernel/qactiongroup.h
new file mode 100644
index 0000000000..d0830aeccb
--- /dev/null
+++ b/src/gui/kernel/qactiongroup.h
@@ -0,0 +1,74 @@
+// Copyright (C) 2019 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
+
+#ifndef QACTIONGROUP_H
+#define QACTIONGROUP_H
+
+#include <QtGui/qtguiglobal.h>
+#include <QtGui/qaction.h>
+
+QT_REQUIRE_CONFIG(action);
+
+QT_BEGIN_NAMESPACE
+
+class QActionGroupPrivate;
+
+class Q_GUI_EXPORT QActionGroup : public QObject
+{
+ Q_OBJECT
+ Q_DECLARE_PRIVATE(QActionGroup)
+
+ Q_PROPERTY(QActionGroup::ExclusionPolicy exclusionPolicy READ exclusionPolicy WRITE setExclusionPolicy)
+ Q_PROPERTY(bool enabled READ isEnabled WRITE setEnabled)
+ Q_PROPERTY(bool visible READ isVisible WRITE setVisible)
+
+public:
+ enum class ExclusionPolicy {
+ None,
+ Exclusive,
+ ExclusiveOptional
+ };
+ Q_ENUM(ExclusionPolicy)
+
+ explicit QActionGroup(QObject *parent);
+ ~QActionGroup();
+
+ QAction *addAction(QAction *a);
+ QAction *addAction(const QString &text);
+ QAction *addAction(const QIcon &icon, const QString &text);
+ void removeAction(QAction *a);
+ QList<QAction*> actions() const;
+ QAction *checkedAction() const;
+
+ bool isExclusive() const;
+ bool isEnabled() const;
+ bool isVisible() const;
+ ExclusionPolicy exclusionPolicy() const;
+
+
+public Q_SLOTS:
+ void setEnabled(bool);
+ inline void setDisabled(bool b) { setEnabled(!b); }
+ void setVisible(bool);
+ void setExclusive(bool);
+ void setExclusionPolicy(ExclusionPolicy policy);
+
+Q_SIGNALS:
+ void triggered(QAction *);
+ void hovered(QAction *);
+
+private Q_SLOTS:
+ void _q_actionTriggered();
+ void _q_actionHovered();
+ void _q_actionChanged();
+
+protected:
+ QActionGroup(QActionGroupPrivate &dd, QObject *parent);
+
+private:
+ Q_DISABLE_COPY(QActionGroup)
+};
+
+QT_END_NAMESPACE
+
+#endif // QACTIONGROUP_H
diff --git a/src/gui/kernel/qactiongroup_p.h b/src/gui/kernel/qactiongroup_p.h
new file mode 100644
index 0000000000..ba939a2b10
--- /dev/null
+++ b/src/gui/kernel/qactiongroup_p.h
@@ -0,0 +1,57 @@
+// Copyright (C) 2019 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
+
+#ifndef QGUIACTIONGROUP_P_H
+#define QGUIACTIONGROUP_P_H
+
+//
+// W A R N I N G
+// -------------
+//
+// This file is not part of the Qt API. It exists for the convenience
+// of other Qt classes. This header file may change from version to
+// version without notice, or even be removed.
+//
+// We mean it.
+//
+
+#include <QtGui/private/qtguiglobal_p.h>
+#include <QtGui/qactiongroup.h>
+#include <QtGui/qfont.h>
+#if QT_CONFIG(shortcut)
+# include <QtGui/private/qshortcutmap_p.h>
+#endif
+
+#include <QtCore/qpointer.h>
+#include "private/qobject_p.h"
+
+QT_REQUIRE_CONFIG(action);
+
+QT_BEGIN_NAMESPACE
+
+class Q_GUI_EXPORT QActionGroupPrivate : public QObjectPrivate
+{
+ Q_DECLARE_PUBLIC(QActionGroup)
+public:
+ enum Signal { Triggered, Hovered };
+
+ QActionGroupPrivate();
+ ~QActionGroupPrivate();
+
+ virtual void emitSignal(Signal, QAction *) {}
+
+ QList<QAction *> actions;
+ QPointer<QAction> current;
+ uint enabled : 1;
+ uint visible : 1;
+ QActionGroup::ExclusionPolicy exclusionPolicy = QActionGroup::ExclusionPolicy::Exclusive;
+
+private:
+ void _q_actionTriggered(); //private slot
+ void _q_actionChanged(); //private slot
+ void _q_actionHovered(); //private slot
+};
+
+QT_END_NAMESPACE
+
+#endif // QACTIONGROUP_P_H
diff --git a/src/gui/kernel/qclipboard.cpp b/src/gui/kernel/qclipboard.cpp
index db22ef2486..6a36862a04 100644
--- a/src/gui/kernel/qclipboard.cpp
+++ b/src/gui/kernel/qclipboard.cpp
@@ -1,41 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the QtGui module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#include "qclipboard.h"
@@ -46,9 +10,7 @@
#include "qvariant.h"
#include "qbuffer.h"
#include "qimage.h"
-#if QT_CONFIG(textcodec)
-#include "qtextcodec.h"
-#endif
+#include "private/qstringconverter_p.h"
#include "private/qguiapplication_p.h"
#include <qpa/qplatformintegration.h>
@@ -56,6 +18,8 @@
QT_BEGIN_NAMESPACE
+using namespace Qt::StringLiterals;
+
/*!
\class QClipboard
\brief The QClipboard class provides access to the window system clipboard.
@@ -85,7 +49,7 @@ QT_BEGIN_NAMESPACE
A typical example of the use of these functions follows:
- \snippet droparea.cpp 0
+ \snippet droparea/droparea.cpp 0
\section1 Notes for X11 Users
@@ -139,16 +103,9 @@ QT_BEGIN_NAMESPACE
\endlist
- \section1 Notes for Universal Windows Platform Users
-
- \list
-
- \li The Universal Windows Platform only allows to query the
- clipboard in case the application is active and an application
- window has focus. Accessing the clipboard data when in background
- will fail due to access denial.
+ \section1 Notes for Android Users
- \endlist
+ On Android only these mime types are supported: text/plain, text/html, and text/uri-list.
\sa QGuiApplication
*/
@@ -283,33 +240,27 @@ QString QClipboard::text(QString &subtype, Mode mode) const
const QStringList formats = data->formats();
if (subtype.isEmpty()) {
- if (formats.contains(QLatin1String("text/plain")))
- subtype = QLatin1String("plain");
+ if (formats.contains("text/plain"_L1))
+ subtype = "plain"_L1;
else {
- for (int i = 0; i < formats.size(); ++i)
- if (formats.at(i).startsWith(QLatin1String("text/"))) {
- subtype = formats.at(i).mid(5);
+ for (const auto &format : formats) {
+ if (format.startsWith("text/"_L1)) {
+ subtype = format.sliced(5);
break;
}
+ }
if (subtype.isEmpty())
return QString();
}
- } else if (!formats.contains(QLatin1String("text/") + subtype)) {
+ } else if (!formats.contains("text/"_L1 + subtype)) {
return QString();
}
- const QByteArray rawData = data->data(QLatin1String("text/") + subtype);
-
-#if QT_CONFIG(textcodec)
- QTextCodec* codec = QTextCodec::codecForMib(106); // utf-8 is default
- if (subtype == QLatin1String("html"))
- codec = QTextCodec::codecForHtml(rawData, codec);
- else
- codec = QTextCodec::codecForUtfText(rawData, codec);
- return codec->toUnicode(rawData);
-#else // textcodec
- return rawData;
-#endif // textcodec
+ const QByteArray rawData = data->data("text/"_L1 + subtype);
+ auto encoding = QStringConverter::encodingForData(rawData);
+ if (!encoding)
+ encoding = QStringConverter::Utf8;
+ return QStringDecoder(*encoding).decode(rawData);
}
/*!
@@ -602,12 +553,13 @@ void QClipboard::emitChanged(Mode mode)
case FindBuffer:
emit findBufferChanged();
break;
- default:
- break;
}
+
emit changed(mode);
}
QT_END_NAMESPACE
+#include "moc_qclipboard.cpp"
+
#endif // QT_NO_CLIPBOARD
diff --git a/src/gui/kernel/qclipboard.h b/src/gui/kernel/qclipboard.h
index e91444d3dc..42b8bad026 100644
--- a/src/gui/kernel/qclipboard.h
+++ b/src/gui/kernel/qclipboard.h
@@ -1,41 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the QtGui module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#ifndef QCLIPBOARD_H
#define QCLIPBOARD_H
diff --git a/src/gui/kernel/qcursor.cpp b/src/gui/kernel/qcursor.cpp
index 4ae5412367..8e7747559a 100644
--- a/src/gui/kernel/qcursor.cpp
+++ b/src/gui/kernel/qcursor.cpp
@@ -1,41 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the QtGui module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2021 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#include "qcursor.h"
@@ -150,7 +114,7 @@ QT_BEGIN_NAMESPACE
\li Qt::DragLinkCursor \li \c dnd-link or \c link
\endtable
- \sa QWidget, {fowler}{GUI Design Handbook: Cursors}
+ \sa QWidget
*/
/*!
@@ -175,6 +139,8 @@ QT_BEGIN_NAMESPACE
\fn void QCursor::swap(QCursor &other)
Swaps this cursor with the \a other cursor.
+
+ \since 5.7
*/
/*!
@@ -249,7 +215,8 @@ void QCursor::setPos(QScreen *screen, int x, int y)
{
if (screen) {
if (QPlatformCursor *cursor = screen->handle()->cursor()) {
- const QPoint devicePos = QHighDpi::toNativePixels(QPoint(x, y), screen);
+ const QPoint pos(x, y);
+ const QPoint devicePos = QHighDpi::toNativePixels(pos, screen->virtualSiblingAt(pos));
// Need to check, since some X servers generate null mouse move
// events, causing looping in applications which call setPos() on
// every mouse move event.
@@ -323,7 +290,7 @@ QDataStream &operator<<(QDataStream &s, const QCursor &c)
if (isPixmap)
s << c.pixmap();
else
- s << *c.bitmap() << *c.mask();
+ s << c.bitmap() << c.mask();
s << c.hotSpot();
}
return s;
@@ -472,14 +439,12 @@ QCursor::QCursor()
QCursor::QCursor(Qt::CursorShape shape)
: d(nullptr)
{
- if (!QCursorData::initialized)
- QCursorData::initialize();
+ QCursorData::initialize();
setShape(shape);
}
/*!
- \fn bool operator==(const QCursor &lhs, const QCursor &rhs)
- \relates QCursor
+ \fn bool QCursor::operator==(const QCursor &lhs, const QCursor &rhs)
\since 5.10
Equality operator. Returns \c true if \a lhs and \a rhs
@@ -517,8 +482,7 @@ bool operator==(const QCursor &lhs, const QCursor &rhs) noexcept
}
/*!
- \fn bool operator!=(const QCursor &lhs, const QCursor &rhs)
- \relates QCursor
+ \fn bool QCursor::operator!=(const QCursor &lhs, const QCursor &rhs)
\since 5.10
Inequality operator. Returns the equivalent of !(\a lhs == \a rhs).
@@ -527,15 +491,13 @@ bool operator==(const QCursor &lhs, const QCursor &rhs) noexcept
*/
/*!
- Returns the cursor shape identifier. The return value is one of
- the \l Qt::CursorShape enum values (cast to an int).
+ Returns the cursor shape identifier.
\sa setShape()
*/
Qt::CursorShape QCursor::shape() const
{
- if (!QCursorData::initialized)
- QCursorData::initialize();
+ QCursorData::initialize();
return d->cshape;
}
@@ -548,8 +510,7 @@ Qt::CursorShape QCursor::shape() const
*/
void QCursor::setShape(Qt::CursorShape shape)
{
- if (!QCursorData::initialized)
- QCursorData::initialize();
+ QCursorData::initialize();
QCursorData *c = uint(shape) <= Qt::LastCursor ? qt_cursorTable[shape] : nullptr;
if (!c)
c = qt_cursorTable[0];
@@ -564,26 +525,55 @@ void QCursor::setShape(Qt::CursorShape shape)
}
/*!
- Returns the cursor bitmap, or \nullptr if it is one of the
+ \fn QBitmap QCursor::bitmap(Qt::ReturnByValueConstant) const
+ \since 5.15
+ \deprecated Use the overload without argument instead.
+
+ Returns the cursor bitmap, or a null bitmap if it is one of the
standard cursors.
+
+ Previously, Qt provided a version of \c bitmap() which returned the bitmap
+ by-pointer. That version is now removed. To maintain compatibility
+ with old code, this function was provided to differentiate between the by-pointer
+ function and the by-value function.
*/
-const QBitmap *QCursor::bitmap() const
+
+/*!
+ Returns the cursor bitmap, or a null bitmap if it is one of the
+ standard cursors.
+*/
+QBitmap QCursor::bitmap() const
{
- if (!QCursorData::initialized)
- QCursorData::initialize();
- return d->bm;
+ QCursorData::initialize();
+ if (d->bm)
+ return *(d->bm);
+ return QBitmap();
}
/*!
- Returns the cursor bitmap mask, or \nullptr if it is one of the
+ \fn QBitmap QCursor::mask(Qt::ReturnByValueConstant) const
+ \since 5.15
+ \deprecated Use the overload without argument instead.
+
+ Returns the cursor bitmap mask, or a null bitmap if it is one of the
standard cursors.
+
+ Previously, Qt provided a version of \c mask() which returned the bitmap
+ by-pointer. That version is now removed. To maintain compatibility
+ with old code, this function was provided to differentiate between the by-pointer
+ function and the by-value function.
*/
-const QBitmap *QCursor::mask() const
+/*!
+ Returns the cursor bitmap mask, or a null bitmap if it is one of the
+ standard cursors.
+*/
+QBitmap QCursor::mask() const
{
- if (!QCursorData::initialized)
- QCursorData::initialize();
- return d->bmm;
+ QCursorData::initialize();
+ if (d->bmm)
+ return *(d->bmm);
+ return QBitmap();
}
/*!
@@ -593,8 +583,7 @@ const QBitmap *QCursor::mask() const
QPixmap QCursor::pixmap() const
{
- if (!QCursorData::initialized)
- QCursorData::initialize();
+ QCursorData::initialize();
return d->pixmap;
}
@@ -605,8 +594,7 @@ QPixmap QCursor::pixmap() const
QPoint QCursor::hotSpot() const
{
- if (!QCursorData::initialized)
- QCursorData::initialize();
+ QCursorData::initialize();
return QPoint(d->hx, d->hy);
}
@@ -616,8 +604,7 @@ QPoint QCursor::hotSpot() const
QCursor::QCursor(const QCursor &c)
{
- if (!QCursorData::initialized)
- QCursorData::initialize();
+ QCursorData::initialize();
d = c.d;
d->ref.ref();
}
@@ -640,8 +627,7 @@ QCursor::~QCursor()
QCursor &QCursor::operator=(const QCursor &c)
{
- if (!QCursorData::initialized)
- QCursorData::initialize();
+ QCursorData::initialize();
if (c.d)
c.d->ref.ref();
if (d && !d->ref.deref())
@@ -655,7 +641,7 @@ QCursor &QCursor::operator=(const QCursor &c)
*/
QCursor::operator QVariant() const
{
- return QVariant(QVariant::Cursor, this);
+ return QVariant::fromValue(*this);
}
#ifndef QT_NO_DEBUG_STREAM
@@ -688,7 +674,7 @@ QCursorData::~QCursorData()
/*! \internal */
void QCursorData::cleanup()
{
- if(!QCursorData::initialized)
+ if (!QCursorData::initialized)
return;
for (int shape = 0; shape <= Qt::LastCursor; ++shape) {
@@ -712,8 +698,7 @@ void QCursorData::initialize()
QCursorData *QCursorData::setBitmap(const QBitmap &bitmap, const QBitmap &mask, int hotX, int hotY, qreal devicePixelRatio)
{
- if (!QCursorData::initialized)
- QCursorData::initialize();
+ QCursorData::initialize();
if (bitmap.depth() != 1 || mask.depth() != 1 || bitmap.size() != mask.size()) {
qWarning("QCursor: Cannot create bitmap cursor; invalid bitmap(s)");
QCursorData *c = qt_cursorTable[0];
diff --git a/src/gui/kernel/qcursor.h b/src/gui/kernel/qcursor.h
index 7966e35840..3aeef52094 100644
--- a/src/gui/kernel/qcursor.h
+++ b/src/gui/kernel/qcursor.h
@@ -1,41 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the QtGui module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#ifndef QCURSOR_H
#define QCURSOR_H
@@ -43,6 +7,7 @@
#include <QtGui/qtguiglobal.h>
#include <QtCore/qpoint.h>
#include <QtGui/qwindowdefs.h>
+#include <QtGui/qbitmap.h>
QT_BEGIN_NAMESPACE
@@ -82,23 +47,29 @@ public:
QCursor();
QCursor(Qt::CursorShape shape);
QCursor(const QBitmap &bitmap, const QBitmap &mask, int hotX=-1, int hotY=-1);
- QCursor(const QPixmap &pixmap, int hotX=-1, int hotY=-1);
+ explicit QCursor(const QPixmap &pixmap, int hotX=-1, int hotY=-1);
QCursor(const QCursor &cursor);
~QCursor();
QCursor &operator=(const QCursor &cursor);
- QCursor(QCursor &&other) noexcept : d(other.d) { other.d = nullptr; }
- inline QCursor &operator=(QCursor &&other) noexcept
- { swap(other); return *this; }
+ QCursor(QCursor &&other) noexcept : d(std::exchange(other.d, nullptr)) {}
+ QT_MOVE_ASSIGNMENT_OPERATOR_IMPL_VIA_MOVE_AND_SWAP(QCursor)
- void swap(QCursor &other) noexcept { qSwap(d, other.d); }
+ void swap(QCursor &other) noexcept { qt_ptr_swap(d, other.d); }
operator QVariant() const;
Qt::CursorShape shape() const;
void setShape(Qt::CursorShape newShape);
- const QBitmap *bitmap() const;
- const QBitmap *mask() const;
+#if QT_DEPRECATED_SINCE(6, 0)
+ QT_DEPRECATED_VERSION_X_6_0("Use the overload without argument instead.")
+ QBitmap bitmap(Qt::ReturnByValueConstant) const { return bitmap(); }
+ QT_DEPRECATED_VERSION_X_6_0("Use the overload without argument instead.")
+ QBitmap mask(Qt::ReturnByValueConstant) const { return mask(); }
+#endif // QT_DEPRECATED_SINCE(6, 0)
+ QBitmap bitmap() const;
+ QBitmap mask() const;
+
QPixmap pixmap() const;
QPoint hotSpot() const;
@@ -111,12 +82,10 @@ public:
private:
friend Q_GUI_EXPORT bool operator==(const QCursor &lhs, const QCursor &rhs) noexcept;
+ friend inline bool operator!=(const QCursor &lhs, const QCursor &rhs) noexcept { return !(lhs == rhs); }
QCursorData *d;
};
-Q_DECLARE_SHARED_NOT_MOVABLE_UNTIL_QT6(QCursor)
-
-Q_GUI_EXPORT bool operator==(const QCursor &lhs, const QCursor &rhs) noexcept;
-inline bool operator!=(const QCursor &lhs, const QCursor &rhs) noexcept { return !(lhs == rhs); }
+Q_DECLARE_SHARED(QCursor)
/*****************************************************************************
QCursor stream functions
diff --git a/src/gui/kernel/qcursor_p.h b/src/gui/kernel/qcursor_p.h
index 37245a793f..52ea15b59a 100644
--- a/src/gui/kernel/qcursor_p.h
+++ b/src/gui/kernel/qcursor_p.h
@@ -1,41 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the QtGui module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#ifndef QCURSOR_P_H
#define QCURSOR_P_H
diff --git a/src/gui/kernel/qdnd.cpp b/src/gui/kernel/qdnd.cpp
index fe766c900e..248a1e83ed 100644
--- a/src/gui/kernel/qdnd.cpp
+++ b/src/gui/kernel/qdnd.cpp
@@ -1,41 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the QtGui module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#include "qdnd_p.h"
@@ -123,3 +87,5 @@ Qt::DropAction QDragManager::drag(QDrag *o)
}
QT_END_NAMESPACE
+
+#include "moc_qdnd_p.cpp"
diff --git a/src/gui/kernel/qdnd_p.h b/src/gui/kernel/qdnd_p.h
index abb30986a5..b5a2e015f4 100644
--- a/src/gui/kernel/qdnd_p.h
+++ b/src/gui/kernel/qdnd_p.h
@@ -1,41 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the QtGui module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#ifndef QDND_P_H
#define QDND_P_H
@@ -63,6 +27,8 @@
#include "private/qobject_p.h"
#include "QtGui/qbackingstore.h"
+#include <QtCore/qpointer.h>
+
QT_REQUIRE_CONFIG(draganddrop);
QT_BEGIN_NAMESPACE
diff --git a/src/gui/kernel/qdrag.cpp b/src/gui/kernel/qdrag.cpp
index 3712eace15..4e707e4915 100644
--- a/src/gui/kernel/qdrag.cpp
+++ b/src/gui/kernel/qdrag.cpp
@@ -1,41 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the QtGui module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#include <qdrag.h>
#include "private/qguiapplication_p.h"
@@ -45,6 +9,8 @@
#include <qpoint.h>
#include "qdnd_p.h"
+#include <QtCore/qpointer.h>
+
QT_BEGIN_NAMESPACE
/*!
@@ -99,9 +65,8 @@ QT_BEGIN_NAMESPACE
\l{QWidget::mouseMoveEvent()}{mouseMoveEvent()} to check whether a QDrag is
required.
- \sa {Drag and Drop}, QClipboard, QMimeData, QMacPasteboardMime,
- {Draggable Icons Example}, {Draggable Text Example}, {Drop Site Example},
- {Fridge Magnets Example}
+ \sa {Drag and Drop}, QClipboard, QMimeData, {Draggable Icons Example},
+ {Draggable Text Example}, {Drop Site Example}
*/
/*!
@@ -287,36 +252,6 @@ Qt::DropAction QDrag::exec(Qt::DropActions supportedActions, Qt::DropAction defa
return d->executed_action;
}
-#if QT_DEPRECATED_SINCE(5, 13)
-/*!
- \obsolete
-
- \b{Note:} It is recommended to use exec() instead of this function.
-
- Starts the drag and drop operation and returns a value indicating the requested
- drop action when it is completed. The drop actions that the user can choose
- from are specified in \a request. Qt::CopyAction is always allowed.
-
- \b{Note:} Although the drag and drop operation can take some time, this function
- does not block the event loop. Other events are still delivered to the application
- while the operation is performed.
-
- \sa exec()
-*/
-Qt::DropAction QDrag::start(Qt::DropActions request)
-{
- Q_D(QDrag);
- if (!d->data) {
- qWarning("QDrag: No mimedata set before starting the drag");
- return d->executed_action;
- }
- d->supported_actions = request | Qt::CopyAction;
- d->default_action = Qt::IgnoreAction;
- d->executed_action = QDragManager::self()->drag(this);
- return d->executed_action;
-}
-#endif
-
/*!
Sets the drag \a cursor for the \a action. This allows you
to override the default native cursors. To revert to using the
@@ -423,3 +358,5 @@ void QDrag::cancel()
*/
QT_END_NAMESPACE
+
+#include "moc_qdrag.cpp"
diff --git a/src/gui/kernel/qdrag.h b/src/gui/kernel/qdrag.h
index 7acd5088bd..65314fd20c 100644
--- a/src/gui/kernel/qdrag.h
+++ b/src/gui/kernel/qdrag.h
@@ -1,41 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the QtGui module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#ifndef QDRAG_H
#define QDRAG_H
@@ -74,10 +38,6 @@ public:
QObject *source() const;
QObject *target() const;
-#if QT_DEPRECATED_SINCE(5, 13)
- QT_DEPRECATED_X("Use QDrag::exec() instead")
- Qt::DropAction start(Qt::DropActions supportedActions = Qt::CopyAction);
-#endif
Qt::DropAction exec(Qt::DropActions supportedActions = Qt::MoveAction);
Qt::DropAction exec(Qt::DropActions supportedActions, Qt::DropAction defaultAction);
diff --git a/src/gui/kernel/qevent.cpp b/src/gui/kernel/qevent.cpp
index ede68f0719..d8c11d72a6 100644
--- a/src/gui/kernel/qevent.cpp
+++ b/src/gui/kernel/qevent.cpp
@@ -1,64 +1,59 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the QtGui module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2020 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#include "qevent.h"
+
#include "qcursor.h"
#include "private/qguiapplication_p.h"
-#include "private/qtouchdevice_p.h"
+#include "private/qinputdevice_p.h"
+#include "private/qpointingdevice_p.h"
#include "qpa/qplatformintegration.h"
#include "private/qevent_p.h"
+#include "private/qeventpoint_p.h"
+
#include "qfile.h"
#include "qhashfunctions.h"
#include "qmetaobject.h"
#include "qmimedata.h"
#include "qevent_p.h"
#include "qmath.h"
+#include "qloggingcategory.h"
+#include "qpointer.h"
#if QT_CONFIG(draganddrop)
#include <qpa/qplatformdrag.h>
#include <private/qdnd_p.h>
#endif
+#if QT_CONFIG(shortcut)
+#include <private/qshortcut_p.h>
+#endif
+
#include <private/qdebug_p.h>
+#define Q_IMPL_POINTER_EVENT(Class) \
+ Class::Class(const Class &) = default; \
+ Class::~Class() = default; \
+ Class* Class::clone() const \
+ { \
+ auto c = new Class(*this); \
+ for (auto &point : c->m_points) \
+ QMutableEventPoint::detach(point); \
+ QEvent *e = c; \
+ /* check that covariant return is safe to add */ \
+ Q_ASSERT(reinterpret_cast<quintptr>(c) == reinterpret_cast<quintptr>(e)); \
+ return c; \
+ }
+
+
+
QT_BEGIN_NAMESPACE
+static_assert(sizeof(QMutableTouchEvent) == sizeof(QTouchEvent));
+static_assert(sizeof(QMutableSinglePointEvent) == sizeof(QSinglePointEvent));
+static_assert(sizeof(QMouseEvent) == sizeof(QSinglePointEvent));
+static_assert(sizeof(QVector2D) == sizeof(quint64));
+
/*!
\class QEnterEvent
\ingroup events
@@ -72,70 +67,70 @@ QT_BEGIN_NAMESPACE
*/
/*!
- Constructs an enter event object.
+ Constructs an enter event object originating from \a device.
- The points \a localPos, \a windowPos and \a screenPos specify the
+ The points \a localPos, \a scenePos and \a globalPos specify the
mouse cursor's position relative to the receiving widget or item,
- window, and screen, respectively.
+ window, and screen or desktop, respectively.
*/
-
-QEnterEvent::QEnterEvent(const QPointF &localPos, const QPointF &windowPos, const QPointF &screenPos)
- : QEvent(QEvent::Enter)
- , l(localPos)
- , w(windowPos)
- , s(screenPos)
+QEnterEvent::QEnterEvent(const QPointF &localPos, const QPointF &scenePos, const QPointF &globalPos, const QPointingDevice *device)
+ : QSinglePointEvent(QEvent::Enter, device, localPos, scenePos, globalPos, Qt::NoButton, Qt::NoButton, Qt::NoModifier)
{
}
-/*!
- \internal
-*/
-QEnterEvent::~QEnterEvent()
-{
-}
+Q_IMPL_POINTER_EVENT(QEnterEvent)
/*!
\fn QPoint QEnterEvent::globalPos() const
+ \deprecated [6.0] Use globalPosition() instead.
Returns the global position of the mouse cursor \e{at the time of the event}.
*/
/*!
\fn int QEnterEvent::globalX() const
+ \deprecated [6.0] Use globalPosition().x() instead.
Returns the global position on the X-axis of the mouse cursor \e{at the time of the event}.
*/
/*!
\fn int QEnterEvent::globalY() const
+ \deprecated [6.0] Use globalPosition().y() instead.
Returns the global position on the Y-axis of the mouse cursor \e{at the time of the event}.
*/
/*!
\fn QPointF QEnterEvent::localPos() const
+ \deprecated [6.0] Use position() instead.
Returns the mouse cursor's position relative to the receiving widget.
*/
/*!
\fn QPoint QEnterEvent::pos() const
+ \deprecated [6.0] Use position().toPoint() instead.
Returns the position of the mouse cursor relative to the receiving widget.
*/
/*!
\fn QPointF QEnterEvent::screenPos() const
+ \deprecated [6.0] Use globalPosition() instead.
Returns the position of the mouse cursor relative to the receiving screen.
*/
/*!
\fn QPointF QEnterEvent::windowPos() const
+ \deprecated [6.0] Use scenePosition() instead.
Returns the position of the mouse cursor relative to the receiving window.
*/
/*!
\fn int QEnterEvent::x() const
+ \deprecated [6.0] Use position().x() instead.
Returns the x position of the mouse cursor relative to the receiving widget.
*/
/*!
\fn int QEnterEvent::y() const
+ \deprecated [6.0] Use position().y() instead.
Returns the y position of the mouse cursor relative to the receiving widget.
*/
@@ -152,16 +147,47 @@ QEnterEvent::~QEnterEvent()
/*!
\internal
*/
-QInputEvent::QInputEvent(Type type, Qt::KeyboardModifiers modifiers)
- : QEvent(type), modState(modifiers), ts(0)
+QInputEvent::QInputEvent(Type type, const QInputDevice *dev, Qt::KeyboardModifiers modifiers)
+ : QEvent(type, QEvent::InputEventTag{}), m_dev(dev), m_modState(modifiers), m_reserved(0)
{}
/*!
\internal
*/
-QInputEvent::~QInputEvent()
-{
-}
+QInputEvent::QInputEvent(QEvent::Type type, QEvent::PointerEventTag, const QInputDevice *dev, Qt::KeyboardModifiers modifiers)
+ : QEvent(type, QEvent::PointerEventTag{}), m_dev(dev), m_modState(modifiers), m_reserved(0)
+{}
+
+/*!
+ \internal
+*/
+QInputEvent::QInputEvent(QEvent::Type type, QEvent::SinglePointEventTag, const QInputDevice *dev, Qt::KeyboardModifiers modifiers)
+ : QEvent(type, QEvent::SinglePointEventTag{}), m_dev(dev), m_modState(modifiers), m_reserved(0)
+{}
+
+Q_IMPL_EVENT_COMMON(QInputEvent)
+
+/*!
+ \fn QInputDevice *QInputEvent::device() const
+ \since 6.0
+
+ Returns the source device that generated the original event.
+
+ In case of a synthesized event, for example a mouse event that was
+ generated from a touch event, \c device() continues to return the touchscreen
+ device, so that you can tell that it did not come from an actual mouse.
+ Thus \c {mouseEvent.source()->type() != QInputDevice::DeviceType::Mouse}
+ is one possible replacement for the Qt 5 expression
+ \c {mouseEvent.source() == Qt::MouseEventSynthesizedByQt}.
+
+ \sa QPointerEvent::pointingDevice()
+*/
+
+/*!
+ \fn QInputDevice::DeviceType QInputEvent::deviceType() const
+
+ Returns the type of device that generated the event.
+*/
/*!
\fn Qt::KeyboardModifiers QInputEvent::modifiers() const
@@ -180,14 +206,14 @@ QInputEvent::~QInputEvent()
*/
/*!
- \fn ulong QInputEvent::timestamp() const
+ \fn quint64 QInputEvent::timestamp() const
Returns the window system's timestamp for this event.
It will normally be in milliseconds since some arbitrary point
in time, such as the time when the system was started.
*/
-/*! \fn void QInputEvent::setTimestamp(ulong atimestamp)
+/*! \fn void QInputEvent::setTimestamp(quint64 atimestamp)
\internal
@@ -195,6 +221,406 @@ QInputEvent::~QInputEvent()
*/
/*!
+ \class QPointerEvent
+ \since 6.0
+ \inmodule QtGui
+
+ \brief A base class for pointer events.
+*/
+
+/*!
+ \fn qsizetype QPointerEvent::pointCount() const
+
+ Returns the number of points in this pointer event.
+*/
+
+/*!
+ Returns a QEventPoint reference for the point at index \a i.
+*/
+QEventPoint &QPointerEvent::point(qsizetype i)
+{
+ return m_points[i];
+}
+
+/*!
+ \fn const QList<QEventPoint> &QPointerEvent::points() const
+
+ Returns a list of points in this pointer event.
+*/
+
+/*!
+ \fn QPointingDevice::PointerType QPointerEvent::pointerType() const
+
+ Returns the type of point that generated the event.
+*/
+
+/*!
+ \internal
+*/
+QPointerEvent::QPointerEvent(QEvent::Type type, const QPointingDevice *dev,
+ Qt::KeyboardModifiers modifiers, const QList<QEventPoint> &points)
+ : QInputEvent(type, QEvent::PointerEventTag{}, dev, modifiers), m_points(points)
+{
+}
+
+/*!
+ \internal
+*/
+QPointerEvent::QPointerEvent(QEvent::Type type, QEvent::SinglePointEventTag, const QInputDevice *dev, Qt::KeyboardModifiers modifiers)
+ : QInputEvent(type, QEvent::SinglePointEventTag{}, dev, modifiers)
+{
+}
+
+Q_IMPL_POINTER_EVENT(QPointerEvent);
+
+/*!
+ Returns the point whose \l {QEventPoint::id()}{id} matches the given \a id,
+ or \c nullptr if no such point is found.
+*/
+QEventPoint *QPointerEvent::pointById(int id)
+{
+ for (auto &p : m_points) {
+ if (p.id() == id)
+ return &p;
+ }
+ return nullptr;
+}
+
+/*!
+ Returns \c true if every point in points() has either an exclusiveGrabber()
+ or one or more passiveGrabbers().
+*/
+bool QPointerEvent::allPointsGrabbed() const
+{
+ for (const auto &p : points()) {
+ if (!exclusiveGrabber(p) && passiveGrabbers(p).isEmpty())
+ return false;
+ }
+ return true;
+}
+
+/*!
+ Returns \c true if isPointAccepted() is \c true for every point in
+ points(); otherwise \c false.
+*/
+bool QPointerEvent::allPointsAccepted() const
+{
+ for (const auto &p : points()) {
+ if (!p.isAccepted())
+ return false;
+ }
+ return true;
+}
+
+/*!
+ \reimp
+*/
+void QPointerEvent::setAccepted(bool accepted)
+{
+ QEvent::setAccepted(accepted);
+ for (auto &p : m_points)
+ p.setAccepted(accepted);
+}
+
+/*!
+ Returns the source device from which this event originates.
+
+ This is the same as QInputEvent::device() but typecast for convenience.
+*/
+const QPointingDevice *QPointerEvent::pointingDevice() const
+{
+ return static_cast<const QPointingDevice *>(m_dev);
+}
+
+/*! \internal
+ Sets the timestamp for this event and its points().
+*/
+void QPointerEvent::setTimestamp(quint64 timestamp)
+{
+ QInputEvent::setTimestamp(timestamp);
+ for (auto &p : m_points)
+ QMutableEventPoint::setTimestamp(p, timestamp);
+}
+
+/*!
+ Returns the object which has been set to receive all future update events
+ and the release event containing the given \a point.
+
+ It's mainly for use in Qt Quick at this time.
+*/
+QObject *QPointerEvent::exclusiveGrabber(const QEventPoint &point) const
+{
+ Q_ASSERT(pointingDevice());
+ auto persistentPoint = QPointingDevicePrivate::get(pointingDevice())->queryPointById(point.id());
+ if (Q_UNLIKELY(!persistentPoint)) {
+ qWarning() << "point is not in activePoints" << point;
+ return nullptr;
+ }
+ return persistentPoint->exclusiveGrabber;
+}
+
+/*!
+ Informs the delivery logic that the given \a exclusiveGrabber is to
+ receive all future update events and the release event containing
+ the given \a point, and that delivery to other items can be skipped.
+
+ It's mainly for use in Qt Quick at this time.
+*/
+void QPointerEvent::setExclusiveGrabber(const QEventPoint &point, QObject *exclusiveGrabber)
+{
+ Q_ASSERT(pointingDevice());
+ auto devPriv = QPointingDevicePrivate::get(const_cast<QPointingDevice *>(pointingDevice()));
+ devPriv->setExclusiveGrabber(this, point, exclusiveGrabber);
+}
+
+/*!
+ Returns the list of objects that have been requested to receive all
+ future update events and the release event containing the given \a point.
+
+ It's only for use by \l {Qt Quick Input Handlers}.
+
+ \sa QPointerEvent::addPassiveGrabber()
+*/
+QList<QPointer<QObject> > QPointerEvent::passiveGrabbers(const QEventPoint &point) const
+{
+ Q_ASSERT(pointingDevice());
+ auto persistentPoint = QPointingDevicePrivate::get(pointingDevice())->queryPointById(point.id());
+ if (Q_UNLIKELY(!persistentPoint)) {
+ qWarning() << "point is not in activePoints" << point;
+ return {};
+ }
+ return persistentPoint->passiveGrabbers;
+}
+
+/*!
+ Informs the delivery logic that the given \a grabber is to receive all
+ future update events and the release event containing the given \a point,
+ regardless where else those events may be delivered.
+
+ It's only for use by \l {Qt Quick Input Handlers}.
+
+ Returns \c false if \a grabber was already added, \c true otherwise.
+*/
+bool QPointerEvent::addPassiveGrabber(const QEventPoint &point, QObject *grabber)
+{
+ Q_ASSERT(pointingDevice());
+ auto devPriv = QPointingDevicePrivate::get(const_cast<QPointingDevice *>(pointingDevice()));
+ return devPriv->addPassiveGrabber(this, point, grabber);
+}
+
+/*!
+ Removes the passive \a grabber from the given \a point if it was previously added.
+ Returns \c true if it had been a passive grabber before, \c false if not.
+
+ It's only for use by \l {Qt Quick Input Handlers}.
+
+ \sa QPointerEvent::addPassiveGrabber()
+*/
+bool QPointerEvent::removePassiveGrabber(const QEventPoint &point, QObject *grabber)
+{
+ Q_ASSERT(pointingDevice());
+ auto devPriv = QPointingDevicePrivate::get(const_cast<QPointingDevice *>(pointingDevice()));
+ return devPriv->removePassiveGrabber(this, point, grabber);
+}
+
+/*!
+ Removes all passive grabbers from the given \a point.
+
+ It's only for use by \l {Qt Quick Input Handlers}.
+
+ \sa QPointerEvent::addPassiveGrabber()
+*/
+void QPointerEvent::clearPassiveGrabbers(const QEventPoint &point)
+{
+ Q_ASSERT(pointingDevice());
+ auto devPriv = QPointingDevicePrivate::get(const_cast<QPointingDevice *>(pointingDevice()));
+ devPriv->clearPassiveGrabbers(this, point);
+}
+
+/*!
+ \class QSinglePointEvent
+ \since 6.0
+ \inmodule QtGui
+
+ \brief A base class for pointer events containing a single point, such as
+ mouse events.
+*/
+
+/*! \fn Qt::MouseButton QSinglePointEvent::button() const
+
+ Returns the button that caused the event.
+
+ The returned value is always Qt::NoButton for mouse move events, as
+ well as \l TabletMove, \l TabletEnterProximity, and
+ \l TabletLeaveProximity events.
+
+ \sa buttons()
+*/
+
+/*! \fn Qt::MouseButtons QSinglePointEvent::buttons() const
+
+ Returns the button state when the event was generated.
+
+ The button state is a combination of Qt::LeftButton, Qt::RightButton,
+ and Qt::MiddleButton using the OR operator.
+
+ For mouse move or \l TabletMove events, this is all buttons that are
+ pressed down.
+
+ For mouse press, double click, or \l TabletPress events, this includes
+ the button that caused the event.
+
+ For mouse release or \l TabletRelease events, this excludes the button
+ that caused the event.
+
+ \sa button()
+*/
+
+/*! \fn QPointF QSinglePointEvent::position() const
+
+ Returns the position of the point in this event, relative to the widget or
+ item that received the event.
+
+ If you move your widgets around in response to mouse events, use
+ globalPosition() instead.
+
+ \sa globalPosition()
+*/
+
+/*! \fn QPointF QSinglePointEvent::scenePosition() const
+
+ Returns the position of the point in this event, relative to the window or
+ scene.
+
+ \sa QEventPoint::scenePosition
+*/
+
+/*! \fn QPointF QSinglePointEvent::globalPosition() const
+
+ Returns the position of the point in this event on the screen or virtual
+ desktop.
+
+ \note The global position of a mouse pointer is recorded \e{at the time
+ of the event}. This is important on asynchronous window systems
+ such as X11; whenever you move your widgets around in response to
+ mouse events, globalPosition() can differ a lot from the current
+ cursor position returned by QCursor::pos().
+
+ \sa position()
+*/
+
+/*!
+ \internal
+*/
+QSinglePointEvent::QSinglePointEvent(QEvent::Type type, const QPointingDevice *dev,
+ const QPointF &localPos, const QPointF &scenePos, const QPointF &globalPos,
+ Qt::MouseButton button, Qt::MouseButtons buttons,
+ Qt::KeyboardModifiers modifiers, Qt::MouseEventSource source)
+ : QPointerEvent(type, QEvent::SinglePointEventTag{}, dev, modifiers),
+ m_button(button),
+ m_mouseState(buttons),
+ m_source(source),
+ m_reserved(0), m_reserved2(0),
+ m_doubleClick(false), m_phase(0), m_invertedScrolling(0)
+{
+ bool isPress = (button != Qt::NoButton && (button | buttons) == buttons);
+ bool isWheel = (type == QEvent::Type::Wheel);
+ auto devPriv = QPointingDevicePrivate::get(const_cast<QPointingDevice *>(pointingDevice()));
+ auto epd = devPriv->pointById(0);
+ QEventPoint &p = epd->eventPoint;
+ Q_ASSERT(p.device() == dev);
+ // p is a reference to a non-detached instance that lives in QPointingDevicePrivate::activePoints.
+ // Update persistent info in that instance.
+ if (isPress || isWheel)
+ QMutableEventPoint::setGlobalLastPosition(p, globalPos);
+ else
+ QMutableEventPoint::setGlobalLastPosition(p, p.globalPosition());
+ QMutableEventPoint::setGlobalPosition(p, globalPos);
+ if (isWheel && p.state() != QEventPoint::State::Updated)
+ QMutableEventPoint::setGlobalPressPosition(p, globalPos);
+ if (type == MouseButtonDblClick)
+ QMutableEventPoint::setState(p, QEventPoint::State::Stationary);
+ else if (button == Qt::NoButton || isWheel)
+ QMutableEventPoint::setState(p, QEventPoint::State::Updated);
+ else if (isPress)
+ QMutableEventPoint::setState(p, QEventPoint::State::Pressed);
+ else
+ QMutableEventPoint::setState(p, QEventPoint::State::Released);
+ QMutableEventPoint::setScenePosition(p, scenePos);
+ // Now detach, and update the detached instance with ephemeral state.
+ QMutableEventPoint::detach(p);
+ QMutableEventPoint::setPosition(p, localPos);
+ m_points.append(p);
+}
+
+/*! \internal
+ Constructs a single-point event with the given \a point, which must be an instance
+ (or copy of one) that already exists in QPointingDevicePrivate::activePoints.
+ Unlike the other constructor, it does not modify the given \a point in any way.
+ This is useful when synthesizing a QMouseEvent from one point taken from a QTouchEvent, for example.
+
+ \sa QMutableSinglePointEvent()
+*/
+QSinglePointEvent::QSinglePointEvent(QEvent::Type type, const QPointingDevice *dev, const QEventPoint &point,
+ Qt::MouseButton button, Qt::MouseButtons buttons,
+ Qt::KeyboardModifiers modifiers, Qt::MouseEventSource source)
+ : QPointerEvent(type, QEvent::SinglePointEventTag{}, dev, modifiers),
+ m_button(button),
+ m_mouseState(buttons),
+ m_source(source),
+ m_reserved(0), m_reserved2(0),
+ m_doubleClick(false), m_phase(0), m_invertedScrolling(0)
+{
+ m_points << point;
+}
+
+Q_IMPL_POINTER_EVENT(QSinglePointEvent)
+
+/*!
+ Returns \c true if this event represents a \l {button()}{button} being pressed.
+*/
+bool QSinglePointEvent::isBeginEvent() const
+{
+ // A double-click event does not begin a sequence: it comes after a press event,
+ // and while it tells which button caused the double-click, it doesn't represent
+ // a change of button state. So it's an update event.
+ return m_button != Qt::NoButton && m_mouseState.testFlag(m_button)
+ && type() != QEvent::MouseButtonDblClick;
+}
+
+/*!
+ Returns \c true if this event does not include a change in \l {buttons()}{button state}.
+*/
+bool QSinglePointEvent::isUpdateEvent() const
+{
+ // A double-click event is an update event even though it tells which button
+ // caused the double-click, because a MouseButtonPress event was sent right before it.
+ return m_button == Qt::NoButton || type() == QEvent::MouseButtonDblClick;
+}
+
+/*!
+ Returns \c true if this event represents a \l {button()}{button} being released.
+*/
+bool QSinglePointEvent::isEndEvent() const
+{
+ return m_button != Qt::NoButton && !m_mouseState.testFlag(m_button);
+}
+
+/*!
+ \property QSinglePointEvent::exclusivePointGrabber
+ \brief the object that will receive future updates
+
+ The exclusive grabber is an object that has chosen to receive all future
+ update events and the release event containing the same point that this
+ event carries.
+
+ Setting the exclusivePointGrabber property is a convenience equivalent to:
+ \code
+ setExclusiveGrabber(points().first(), exclusiveGrabber);
+ \endcode
+*/
+
+/*!
\class QMouseEvent
\ingroup events
\inmodule QtGui
@@ -226,10 +652,10 @@ QInputEvent::~QInputEvent()
\l{QInputEvent::modifiers()}{modifiers()} function, inherited from
QInputEvent.
- The functions pos(), x(), and y() give the cursor position
- relative to the widget that receives the mouse event. If you
- move the widget as a result of the mouse event, use the global
- position returned by globalPos() to avoid a shaking motion.
+ The position() function gives the cursor position
+ relative to the widget or item that receives the mouse event.
+ If you move the widget as a result of the mouse event, use the
+ global position returned by globalPosition() to avoid a shaking motion.
The QWidget::setEnabled() function can be used to enable or
disable mouse and keyboard events for a widget.
@@ -243,8 +669,11 @@ QInputEvent::~QInputEvent()
QCursor::pos()
*/
+#if QT_DEPRECATED_SINCE(6, 4)
/*!
- Constructs a mouse event object.
+ \deprecated [6.4] Use another constructor instead (global position is required).
+
+ Constructs a mouse event object originating from \a device.
The \a type parameter must be one of QEvent::MouseButtonPress,
QEvent::MouseButtonRelease, QEvent::MouseButtonDblClick,
@@ -259,22 +688,25 @@ QInputEvent::~QInputEvent()
The mouse and keyboard states at the time of the event are specified by
\a buttons and \a modifiers.
- The screenPos() is initialized to QCursor::pos(), which may not
+ The globalPosition() is initialized to QCursor::pos(), which may not
be appropriate. Use the other constructor to specify the global
position explicitly.
*/
QMouseEvent::QMouseEvent(Type type, const QPointF &localPos, Qt::MouseButton button,
- Qt::MouseButtons buttons, Qt::KeyboardModifiers modifiers)
- : QInputEvent(type, modifiers), l(localPos), w(localPos), b(button), mouseState(buttons), caps(0)
-{
-#ifndef QT_NO_CURSOR
- s = QCursor::pos();
+ Qt::MouseButtons buttons, Qt::KeyboardModifiers modifiers, const QPointingDevice *device)
+ : QSinglePointEvent(type, device, localPos, localPos,
+#ifdef QT_NO_CURSOR
+ localPos,
+#else
+ QCursor::pos(),
#endif
+ button, buttons, modifiers)
+{
}
-
+#endif
/*!
- Constructs a mouse event object.
+ Constructs a mouse event object originating from \a device.
The \a type parameter must be QEvent::MouseButtonPress,
QEvent::MouseButtonRelease, QEvent::MouseButtonDblClick,
@@ -282,7 +714,7 @@ QMouseEvent::QMouseEvent(Type type, const QPointF &localPos, Qt::MouseButton but
The \a localPos is the mouse cursor's position relative to the
receiving widget or item. The cursor's position in screen coordinates is
- specified by \a screenPos. The window position is set to the same value
+ specified by \a globalPos. The window position is set to the same value
as \a localPos. The \a button that caused the event is
given as a value from the \l Qt::MouseButton enum. If the event \a
type is \l MouseMove, the appropriate button for this event is
@@ -291,111 +723,104 @@ QMouseEvent::QMouseEvent(Type type, const QPointF &localPos, Qt::MouseButton but
modifiers.
*/
-QMouseEvent::QMouseEvent(Type type, const QPointF &localPos, const QPointF &screenPos,
+QMouseEvent::QMouseEvent(Type type, const QPointF &localPos, const QPointF &globalPos,
Qt::MouseButton button, Qt::MouseButtons buttons,
- Qt::KeyboardModifiers modifiers)
- : QMouseEvent(type, localPos, localPos, screenPos, button, buttons, modifiers)
-{}
-
-/*!
- Constructs a mouse event object.
-
- The \a type parameter must be QEvent::MouseButtonPress,
- QEvent::MouseButtonRelease, QEvent::MouseButtonDblClick,
- or QEvent::MouseMove.
-
- The points \a localPos, \a windowPos and \a screenPos specify the
- mouse cursor's position relative to the receiving widget or item,
- window, and screen, respectively.
-
- The \a button that caused the event is
- given as a value from the \l Qt::MouseButton enum. If the event \a
- type is \l MouseMove, the appropriate button for this event is
- Qt::NoButton. \a buttons is the state of all buttons at the
- time of the event, \a modifiers the state of all keyboard
- modifiers.
-
-*/
-QMouseEvent::QMouseEvent(Type type, const QPointF &localPos, const QPointF &windowPos, const QPointF &screenPos,
- Qt::MouseButton button, Qt::MouseButtons buttons,
- Qt::KeyboardModifiers modifiers)
- : QInputEvent(type, modifiers), l(localPos), w(windowPos), s(screenPos), b(button), mouseState(buttons), caps(0)
-{}
+ Qt::KeyboardModifiers modifiers, const QPointingDevice *device)
+ : QMouseEvent(type, localPos, localPos, globalPos, button, buttons, modifiers, device)
+{
+}
/*!
- \since 5.6
-
Constructs a mouse event object.
The \a type parameter must be QEvent::MouseButtonPress,
QEvent::MouseButtonRelease, QEvent::MouseButtonDblClick,
or QEvent::MouseMove.
- The points \a localPos, \a windowPos and \a screenPos specify the
+ The points \a localPos, \a scenePos and \a globalPos specify the
mouse cursor's position relative to the receiving widget or item,
- window, and screen, respectively.
+ window, and screen or desktop, respectively.
The \a button that caused the event is given as a value from the
\l Qt::MouseButton enum. If the event \a type is \l MouseMove,
the appropriate button for this event is Qt::NoButton. \a buttons
is the state of all buttons at the time of the event, \a modifiers
is the state of all keyboard modifiers.
-
- The source of the event is specified by \a source.
-
*/
-QMouseEvent::QMouseEvent(QEvent::Type type, const QPointF &localPos, const QPointF &windowPos, const QPointF &screenPos,
+QMouseEvent::QMouseEvent(QEvent::Type type, const QPointF &localPos,
+ const QPointF &scenePos, const QPointF &globalPos,
Qt::MouseButton button, Qt::MouseButtons buttons,
- Qt::KeyboardModifiers modifiers, Qt::MouseEventSource source)
- : QMouseEvent(type, localPos, windowPos, screenPos, button, buttons, modifiers)
+ Qt::KeyboardModifiers modifiers, const QPointingDevice *device)
+ : QSinglePointEvent(type, device, localPos, scenePos, globalPos, button, buttons, modifiers)
{
- QGuiApplicationPrivate::setMouseEventSource(this, source);
}
-/*!
- \internal
-*/
-QMouseEvent::~QMouseEvent()
+QMouseEvent::QMouseEvent(QEvent::Type type, const QPointF &localPos, const QPointF &windowPos,
+ const QPointF &globalPos, Qt::MouseButton button, Qt::MouseButtons buttons,
+ Qt::KeyboardModifiers modifiers, Qt::MouseEventSource source,
+ const QPointingDevice *device)
+ : QSinglePointEvent(type, device, localPos, windowPos, globalPos, button, buttons, modifiers, source)
{
}
+Q_IMPL_POINTER_EVENT(QMouseEvent)
+
/*!
- \since 5.3
+ \fn Qt::MouseEventSource QMouseEvent::source() const
+ \since 5.3
+ \deprecated [6.0] Use pointingDevice() instead.
- Returns information about the mouse event source.
+ Returns information about the mouse event source.
- The mouse event source can be used to distinguish between genuine
- and artificial mouse events. The latter are events that are
- synthesized from touch events by the operating system or Qt itself.
+ The mouse event source can be used to distinguish between genuine
+ and artificial mouse events. The latter are events that are
+ synthesized from touch events by the operating system or Qt itself.
+ This enum tells you from where it was synthesized; but often
+ it's more useful to know from which device it was synthesized,
+ so try to use pointingDevice() instead.
- \note Many platforms provide no such information. On such platforms
- \l Qt::MouseEventNotSynthesized is returned always.
+ \note Many platforms provide no such information. On such platforms
+ \l Qt::MouseEventNotSynthesized is returned always.
- \sa Qt::MouseEventSource
- \sa QGraphicsSceneMouseEvent::source()
- */
+ \sa Qt::MouseEventSource
+ \sa QGraphicsSceneMouseEvent::source()
+
+ \note In Qt 5-based code, source() was often used to attempt to distinguish
+ mouse events from an actual mouse vs. those that were synthesized because
+ some legacy QQuickItem or QWidget subclass did not react to a QTouchEvent.
+ However, you could not tell whether it was synthesized from a QTouchEvent
+ or a QTabletEvent, and other information was lost. pointingDevice()
+ tells you the specific device that it came from, so you might check
+ \c {pointingDevice()->type()} or \c {pointingDevice()->capabilities()} to
+ decide how to react to this event. But it's even better to react to the
+ original event rather than handling only mouse events.
+*/
+// Note: the docs mention 6.0 as a deprecation version. That is correct and
+// intended, because we want our users to stop using it! Internally we will
+// deprecate it when we port our code away from using it.
Qt::MouseEventSource QMouseEvent::source() const
{
- return QGuiApplicationPrivate::mouseEventSource(this);
+ return Qt::MouseEventSource(m_source);
}
/*!
- \since 5.3
+ \since 5.3
- Returns the mouse event flags.
+ Returns the mouse event flags.
- The mouse event flags provide additional information about a mouse event.
+ The mouse event flags provide additional information about a mouse event.
- \sa Qt::MouseEventFlag
- \sa QGraphicsSceneMouseEvent::flags()
- */
+ \sa Qt::MouseEventFlag
+ \sa QGraphicsSceneMouseEvent::flags()
+*/
Qt::MouseEventFlags QMouseEvent::flags() const
{
- return QGuiApplicationPrivate::mouseEventFlags(this);
+ return (m_doubleClick ? Qt::MouseEventCreatedDoubleClick : Qt::NoMouseEventFlag);
}
/*!
\fn QPointF QMouseEvent::localPos() const
+ \deprecated [6.0] Use position() instead.
\since 5.0
@@ -423,6 +848,7 @@ Qt::MouseEventFlags QMouseEvent::flags() const
/*!
\fn QPointF QMouseEvent::windowPos() const
+ \deprecated [6.0] Use scenePosition() instead.
\since 5.0
@@ -438,6 +864,7 @@ Qt::MouseEventFlags QMouseEvent::flags() const
/*!
\fn QPointF QMouseEvent::screenPos() const
+ \deprecated [6.0] Use globalPosition() instead.
\since 5.0
@@ -449,6 +876,7 @@ Qt::MouseEventFlags QMouseEvent::flags() const
/*!
\fn QPoint QMouseEvent::pos() const
+ \deprecated [6.0] Use position() instead.
Returns the position of the mouse cursor, relative to the widget
that received the event.
@@ -462,6 +890,7 @@ Qt::MouseEventFlags QMouseEvent::flags() const
/*!
\fn QPoint QMouseEvent::globalPos() const
+ \deprecated [6.0] Use globalPosition().toPoint() instead.
Returns the global position of the mouse cursor \e{at the time
of the event}. This is important on asynchronous window systems
@@ -475,6 +904,7 @@ Qt::MouseEventFlags QMouseEvent::flags() const
/*!
\fn int QMouseEvent::x() const
+ \deprecated [6.0] Use position().x() instead.
Returns the x position of the mouse cursor, relative to the
widget that received the event.
@@ -484,6 +914,7 @@ Qt::MouseEventFlags QMouseEvent::flags() const
/*!
\fn int QMouseEvent::y() const
+ \deprecated [6.0] Use position().y() instead.
Returns the y position of the mouse cursor, relative to the
widget that received the event.
@@ -493,6 +924,7 @@ Qt::MouseEventFlags QMouseEvent::flags() const
/*!
\fn int QMouseEvent::globalX() const
+ \deprecated [6.0] Use globalPosition().x() instead.
Returns the global x position of the mouse cursor at the time of
the event.
@@ -502,6 +934,7 @@ Qt::MouseEventFlags QMouseEvent::flags() const
/*!
\fn int QMouseEvent::globalY() const
+ \deprecated [6.0] Use globalPosition().y() instead.
Returns the global y position of the mouse cursor at the time of
the event.
@@ -510,31 +943,6 @@ Qt::MouseEventFlags QMouseEvent::flags() const
*/
/*!
- \fn Qt::MouseButton QMouseEvent::button() const
-
- Returns the button that caused the event.
-
- Note that the returned value is always Qt::NoButton for mouse
- move events.
-
- \sa buttons(), Qt::MouseButton
-*/
-
-/*!
- \fn Qt::MouseButton QMouseEvent::buttons() const
-
- Returns the button state when the event was generated. The button
- state is a combination of Qt::LeftButton, Qt::RightButton,
- Qt::MidButton using the OR operator. For mouse move events,
- this is all buttons that are pressed down. For mouse press and
- double click events this includes the button that caused the
- event. For mouse release events this excludes the button that
- caused the event.
-
- \sa button(), Qt::MouseButton
-*/
-
-/*!
\class QHoverEvent
\ingroup events
\inmodule QtGui
@@ -584,6 +992,7 @@ Qt::MouseEventFlags QMouseEvent::flags() const
/*!
\fn QPoint QHoverEvent::pos() const
+ \deprecated [6.0] Use position().toPoint() instead.
Returns the position of the mouse cursor, relative to the widget
that received the event.
@@ -609,6 +1018,7 @@ Qt::MouseEventFlags QMouseEvent::flags() const
/*!
\fn const QPointF &QHoverEvent::posF() const
+ \deprecated [6.0] Use position() instead.
Returns the position of the mouse cursor, relative to the widget
that received the event.
@@ -633,29 +1043,47 @@ Qt::MouseEventFlags QMouseEvent::flags() const
*/
/*!
- Constructs a hover event object.
+ Constructs a hover event object originating from \a device.
The \a type parameter must be QEvent::HoverEnter,
QEvent::HoverLeave, or QEvent::HoverMove.
- The \a pos is the current mouse cursor's position relative to the
- receiving widget, while \a oldPos is its previous such position.
+ The \a scenePos is the current mouse cursor's position relative to the
+ receiving window or scene, \a oldPos is its previous such position, and
+ \a globalPos is the mouse position in absolute coordinates.
\a modifiers hold the state of all keyboard modifiers at the time
of the event.
*/
-QHoverEvent::QHoverEvent(Type type, const QPointF &pos, const QPointF &oldPos, Qt::KeyboardModifiers modifiers)
- : QInputEvent(type, modifiers), p(pos), op(oldPos)
+QHoverEvent::QHoverEvent(Type type, const QPointF &scenePos, const QPointF &globalPos, const QPointF &oldPos,
+ Qt::KeyboardModifiers modifiers, const QPointingDevice *device)
+ : QSinglePointEvent(type, device, scenePos, scenePos, globalPos, Qt::NoButton, Qt::NoButton, modifiers), m_oldPos(oldPos)
{
}
+#if QT_DEPRECATED_SINCE(6, 3)
/*!
- \internal
+ \deprecated [6.3] Use the other constructor instead (global position is required).
+
+ Constructs a hover event object originating from \a device.
+
+ The \a type parameter must be QEvent::HoverEnter,
+ QEvent::HoverLeave, or QEvent::HoverMove.
+
+ The \a pos is the current mouse cursor's position relative to the
+ receiving widget, while \a oldPos is its previous such position.
+ \a modifiers hold the state of all keyboard modifiers at the time
+ of the event.
*/
-QHoverEvent::~QHoverEvent()
+QHoverEvent::QHoverEvent(Type type, const QPointF &pos, const QPointF &oldPos,
+ Qt::KeyboardModifiers modifiers, const QPointingDevice *device)
+ : QSinglePointEvent(type, device, pos, pos, pos, Qt::NoButton, Qt::NoButton, modifiers), m_oldPos(oldPos)
{
}
+#endif
+Q_IMPL_POINTER_EVENT(QHoverEvent)
+#if QT_CONFIG(wheelevent)
/*!
\class QWheelEvent
\brief The QWheelEvent class contains parameters that describe a wheel event.
@@ -667,13 +1095,13 @@ QHoverEvent::~QHoverEvent()
if that widget does not handle the event they are sent to the
focus widget. Wheel events are generated for both mouse wheels
and trackpad scroll gestures. There are two ways to read the
- wheel event delta: angleDelta() returns the delta in wheel
- degrees. This value is always provided. pixelDelta() returns
- the delta in screen pixels and is available on platforms that
+ wheel event delta: angleDelta() returns the deltas in wheel
+ degrees. These values are always provided. pixelDelta() returns
+ the deltas in screen pixels, and is available on platforms that
have high-resolution trackpads, such as \macos. If that is the
- case, source() will return Qt::MouseEventSynthesizedBySystem.
+ case, device()->type() will return QInputDevice::DeviceType::Touchpad.
- The functions pos() and globalPos() return the mouse cursor's
+ The functions position() and globalPosition() return the mouse cursor's
location at the time of the event.
A wheel event contains a special accept flag that indicates
@@ -697,20 +1125,18 @@ QHoverEvent::~QHoverEvent()
*/
/*!
- \fn Qt::MouseButtons QWheelEvent::buttons() const
-
- Returns the mouse state when the event occurred.
-*/
-
-/*!
\fn Qt::MouseEventSource QWheelEvent::source() const
\since 5.5
+ \deprecated [6.0] Use pointingDevice() instead.
Returns information about the wheel event source.
The source can be used to distinguish between events that come from a mouse
with a physical wheel and events that are generated by some other means,
such as a flick gesture on a touchpad.
+ This enum tells you from where it was synthesized; but often
+ it's more useful to know from which device it was synthesized,
+ so try to use pointingDevice() instead.
\note Many platforms provide no such information. On such platforms
\l Qt::MouseEventNotSynthesized is returned always.
@@ -743,106 +1169,6 @@ QHoverEvent::~QHoverEvent()
\l inverted always returns false.
*/
-#if QT_DEPRECATED_SINCE(5, 15)
-/*!
- \fn Qt::Orientation QWheelEvent::orientation() const
- \obsolete
-
- Use angleDelta() instead.
-*/
-#endif
-
-#if QT_CONFIG(wheelevent)
-#if QT_DEPRECATED_SINCE(5, 15)
-/*!
- \obsolete
- This constructor has been deprecated.
-*/
-QWheelEvent::QWheelEvent(const QPointF &pos, int delta,
- Qt::MouseButtons buttons, Qt::KeyboardModifiers modifiers,
- Qt::Orientation orient)
- : QInputEvent(Wheel, modifiers), p(pos), qt4D(delta), qt4O(orient), mouseState(buttons),
- src(Qt::MouseEventNotSynthesized), invertedScrolling(false), ph(Qt::NoScrollPhase)
-{
- g = QCursor::pos();
- if (orient == Qt::Vertical)
- angleD = QPoint(0, delta);
- else
- angleD = QPoint(delta, 0);
-}
-
-/*!
- \obsolete
- This constructor has been deprecated.
-*/
-QWheelEvent::QWheelEvent(const QPointF &pos, const QPointF& globalPos, int delta,
- Qt::MouseButtons buttons, Qt::KeyboardModifiers modifiers,
- Qt::Orientation orient)
- : QInputEvent(Wheel, modifiers), p(pos), g(globalPos), qt4D(delta), qt4O(orient), mouseState(buttons),
- src(Qt::MouseEventNotSynthesized), invertedScrolling(false), ph(Qt::NoScrollPhase)
-{
- if (orient == Qt::Vertical)
- angleD = QPoint(0, delta);
- else
- angleD = QPoint(delta, 0);
-}
-
-/*!
- \obsolete
- This constructor has been deprecated.
-*/
-QT_WARNING_PUSH
-QT_WARNING_DISABLE_DEPRECATED
-QWheelEvent::QWheelEvent(const QPointF &pos, const QPointF& globalPos,
- QPoint pixelDelta, QPoint angleDelta, int qt4Delta, Qt::Orientation qt4Orientation,
- Qt::MouseButtons buttons, Qt::KeyboardModifiers modifiers)
- : QWheelEvent(pos, globalPos, pixelDelta, angleDelta, qt4Delta, qt4Orientation,
- buttons, modifiers, Qt::NoScrollPhase)
-{}
-QT_WARNING_POP
-
-/*!
- \obsolete
- This constructor has been deprecated.
-*/
-QT_WARNING_PUSH
-QT_WARNING_DISABLE_DEPRECATED
-QWheelEvent::QWheelEvent(const QPointF &pos, const QPointF& globalPos,
- QPoint pixelDelta, QPoint angleDelta, int qt4Delta, Qt::Orientation qt4Orientation,
- Qt::MouseButtons buttons, Qt::KeyboardModifiers modifiers, Qt::ScrollPhase phase)
- : QWheelEvent(pos, globalPos, pixelDelta, angleDelta, qt4Delta, qt4Orientation,
- buttons, modifiers, phase, Qt::MouseEventNotSynthesized)
-{}
-QT_WARNING_POP
-
-/*!
- \obsolete
- This constructor has been deprecated.
-*/
-
-QT_WARNING_PUSH
-QT_WARNING_DISABLE_DEPRECATED
-QWheelEvent::QWheelEvent(const QPointF &pos, const QPointF& globalPos,
- QPoint pixelDelta, QPoint angleDelta, int qt4Delta, Qt::Orientation qt4Orientation,
- Qt::MouseButtons buttons, Qt::KeyboardModifiers modifiers, Qt::ScrollPhase phase, Qt::MouseEventSource source)
- : QWheelEvent(pos, globalPos, pixelDelta, angleDelta, qt4Delta, qt4Orientation,
- buttons, modifiers, phase, source, false)
-{}
-QT_WARNING_POP
-
-/*!
- \obsolete
- This constructor has been deprecated.
-*/
-QWheelEvent::QWheelEvent(const QPointF &pos, const QPointF& globalPos,
- QPoint pixelDelta, QPoint angleDelta, int qt4Delta, Qt::Orientation qt4Orientation,
- Qt::MouseButtons buttons, Qt::KeyboardModifiers modifiers, Qt::ScrollPhase phase, Qt::MouseEventSource source, bool inverted)
- : QInputEvent(Wheel, modifiers), p(pos), g(globalPos), pixelD(pixelDelta),
- angleD(angleDelta), qt4D(qt4Delta), qt4O(qt4Orientation), mouseState(buttons), src(source),
- invertedScrolling(inverted), ph(phase)
-{}
-#endif // QT_DEPRECATED_SINCE(5, 15)
-
/*!
Constructs a wheel event object.
@@ -852,43 +1178,60 @@ QWheelEvent::QWheelEvent(const QPointF &pos, const QPointF& globalPos,
by \a globalPos.
\a pixelDelta contains the scrolling distance in pixels on screen, while
- \a angleDelta contains the wheel rotation distance. \a pixelDelta is
+ \a angleDelta contains the wheel rotation angle. \a pixelDelta is
optional and can be null.
The mouse and keyboard states at the time of the event are specified by
\a buttons and \a modifiers.
- The scrolling phase of the event is specified by \a phase.
-
- If the wheel event comes from a physical mouse wheel, \a source is set to
- Qt::MouseEventNotSynthesized. If it comes from a gesture detected by the
- operating system, or from a non-mouse hardware device, such that \a
- pixelDelta is directly related to finger movement, \a source is set to
- Qt::MouseEventSynthesizedBySystem. If it comes from Qt, source would be set
- to Qt::MouseEventSynthesizedByQt.
+ The scrolling phase of the event is specified by \a phase, and the
+ \a source indicates whether this is a genuine or artificial (synthesized)
+ event.
If the system is configured to invert the delta values delivered with the
event (such as natural scrolling of the touchpad on macOS), \a inverted
should be \c true. Otherwise, \a inverted is \c false
- \sa position(), globalPosition(), angleDelta(), pixelDelta(), phase(), inverted(), source()
+ The device from which the wheel event originated is specified by \a device.
+
+ \sa position(), globalPosition(), angleDelta(), pixelDelta(), phase(), inverted(), device()
*/
-QWheelEvent::QWheelEvent(QPointF pos, QPointF globalPos, QPoint pixelDelta, QPoint angleDelta,
- Qt::MouseButtons buttons, Qt::KeyboardModifiers modifiers, Qt::ScrollPhase phase,
- bool inverted, Qt::MouseEventSource source)
- : QInputEvent(Wheel, modifiers), p(pos), g(globalPos), pixelD(pixelDelta), angleD(angleDelta),
- qt4O(qAbs(angleDelta.x()) > qAbs(angleDelta.y()) ? Qt::Horizontal : Qt::Vertical),
- mouseState(buttons), src(source), invertedScrolling(inverted), ph(phase)
+QWheelEvent::QWheelEvent(const QPointF &pos, const QPointF &globalPos, QPoint pixelDelta, QPoint angleDelta,
+ Qt::MouseButtons buttons, Qt::KeyboardModifiers modifiers, Qt::ScrollPhase phase,
+ bool inverted, Qt::MouseEventSource source, const QPointingDevice *device)
+ : QSinglePointEvent(Wheel, device, pos, pos, globalPos, Qt::NoButton, buttons, modifiers, source),
+ m_pixelDelta(pixelDelta), m_angleDelta(angleDelta)
{
- qt4D = (qt4O == Qt::Horizontal ? angleDelta.x() : angleDelta.y());
+ m_phase = phase;
+ m_invertedScrolling = inverted;
}
+Q_IMPL_POINTER_EVENT(QWheelEvent)
+
/*!
- \internal
+ Returns \c true if this event's phase() is Qt::ScrollBegin.
*/
-QWheelEvent::~QWheelEvent()
+bool QWheelEvent::isBeginEvent() const
{
+ return m_phase == Qt::ScrollBegin;
}
+
+/*!
+ Returns \c true if this event's phase() is Qt::ScrollUpdate or Qt::ScrollMomentum.
+*/
+bool QWheelEvent::isUpdateEvent() const
+{
+ return m_phase == Qt::ScrollUpdate || m_phase == Qt::ScrollMomentum;
+}
+
+/*!
+ Returns \c true if this event's phase() is Qt::ScrollEnd.
+*/
+bool QWheelEvent::isEndEvent() const
+{
+ return m_phase == Qt::ScrollEnd;
+}
+
#endif // QT_CONFIG(wheelevent)
/*!
@@ -908,16 +1251,22 @@ QWheelEvent::~QWheelEvent()
\li scrolling is about to begin, but the distance did not yet change (Qt::ScrollBegin),
\li or scrolling has ended and the distance did not change anymore (Qt::ScrollEnd).
\endlist
- \note On X11 this value is driver specific and unreliable, use angleDelta() instead
+ \note On X11 this value is driver-specific and unreliable, use angleDelta() instead.
*/
/*!
\fn QPoint QWheelEvent::angleDelta() const
- Returns the distance that the wheel is rotated, in eighths of a
- degree. A positive value indicates that the wheel was rotated
- forwards away from the user; a negative value indicates that the
- wheel was rotated backwards toward the user.
+ Returns the relative amount that the wheel was rotated, in eighths of a
+ degree. A positive value indicates that the wheel was rotated forwards away
+ from the user; a negative value indicates that the wheel was rotated
+ backwards toward the user. \c angleDelta().y() provides the angle through
+ which the common vertical mouse wheel was rotated since the previous event.
+ \c angleDelta().x() provides the angle through which the horizontal mouse
+ wheel was rotated, if the mouse has a horizontal wheel; otherwise it stays
+ at zero. Some mice allow the user to tilt the wheel to perform horizontal
+ scrolling, and some touchpads support a horizontal scrolling gesture; that
+ will also appear in \c angleDelta().x().
Most mouse types work in steps of 15 degrees, in which case the
delta value is a multiple of 120; i.e., 120 units * 1/8 = 15 degrees.
@@ -926,7 +1275,9 @@ QWheelEvent::~QWheelEvent()
that are less than 120 units (less than 15 degrees). To support this
possibility, you can either cumulatively add the delta values from events
until the value of 120 is reached, then scroll the widget, or you can
- partially scroll the widget in response to each wheel event.
+ partially scroll the widget in response to each wheel event. But to
+ provide a more native feel, you should prefer \l pixelDelta() on platforms
+ where it's available.
Example:
@@ -937,99 +1288,11 @@ QWheelEvent::~QWheelEvent()
\li scrolling is about to begin, but the distance did not yet change (Qt::ScrollBegin),
\li or scrolling has ended and the distance did not change anymore (Qt::ScrollEnd).
\endlist
-*/
-
-/*!
- \fn QPoint QWheelEvent::position() const
-
- Returns the position of the mouse cursor relative to the widget
- that received the event.
-
- If you move your widgets around in response to mouse events,
- use globalPosition() instead of this function.
- \sa globalPosition()
+ \sa pixelDelta()
*/
/*!
- \fn QPoint QWheelEvent::globalPosition() const
-
- Returns the global position of the mouse pointer \e{at the time
- of the event}. This is important on asynchronous window systems
- such as X11; whenever you move your widgets around in response to
- mouse events, globalPosition() can differ a lot from the current
- cursor position returned by QCursor::pos().
-
- \sa position()
-*/
-
-#if QT_DEPRECATED_SINCE(5, 15)
-/*!
- \fn int QWheelEvent::delta() const
- \obsolete
-
- This function has been deprecated, use pixelDelta() or angleDelta() instead.
-*/
-
-/*!
- \fn QPoint QWheelEvent::pos() const
- \obsolete
-
- This function has been deprecated, use position() instead.
-*/
-
-/*!
- \fn int QWheelEvent::x() const
- \obsolete
-
- This function has been deprecated, use position() instead.
-*/
-
-/*!
- \fn int QWheelEvent::y() const
- \obsolete
-
- This function has been deprecated, use position() instead.
-*/
-
-
-/*!
- \fn QPoint QWheelEvent::globalPos() const
- \obsolete
-
- This function has been deprecated, use globalPosition() instead.
-*/
-
-/*!
- \fn int QWheelEvent::globalX() const
- \obsolete
-
- This function has been deprecated, use globalPosition() instead.
-*/
-
-/*!
- \fn int QWheelEvent::globalY() const
- \obsolete
-
- This function has been deprecated, use globalPosition() instead.
-*/
-
-/*!
- \fn const QPointF &QWheelEvent::posF() const
- \obsolete
-
- This function has been deprecated, use position() instead.
-*/
-
-/*!
- \fn const QPointF &QWheelEvent::globalPosF() const
- \obsolete
-
- This function has been deprecated, use globalPosition() instead.
-*/
-#endif
-
-/*!
\fn Qt::ScrollPhase QWheelEvent::phase() const
\since 5.2
@@ -1084,10 +1347,10 @@ QWheelEvent::~QWheelEvent()
in the event.
*/
QKeyEvent::QKeyEvent(Type type, int key, Qt::KeyboardModifiers modifiers, const QString& text,
- bool autorep, ushort count)
- : QInputEvent(type, modifiers), txt(text), k(key),
- nScanCode(0), nVirtualKey(0), nModifiers(0),
- c(count), autor(autorep)
+ bool autorep, quint16 count)
+ : QInputEvent(type, QInputDevice::primaryKeyboard(), modifiers), m_text(text), m_key(key),
+ m_scanCode(0), m_virtualKey(0), m_nativeModifiers(0),
+ m_count(count), m_autoRepeat(autorep)
{
if (type == QEvent::ShortcutOverride)
ignore();
@@ -1113,36 +1376,27 @@ QKeyEvent::QKeyEvent(Type type, int key, Qt::KeyboardModifiers modifiers, const
*/
QKeyEvent::QKeyEvent(Type type, int key, Qt::KeyboardModifiers modifiers,
quint32 nativeScanCode, quint32 nativeVirtualKey, quint32 nativeModifiers,
- const QString &text, bool autorep, ushort count)
- : QInputEvent(type, modifiers), txt(text), k(key),
- nScanCode(nativeScanCode), nVirtualKey(nativeVirtualKey), nModifiers(nativeModifiers),
- c(count), autor(autorep)
+ const QString &text, bool autorep, quint16 count, const QInputDevice *device)
+ : QInputEvent(type, device, modifiers), m_text(text), m_key(key),
+ m_scanCode(nativeScanCode), m_virtualKey(nativeVirtualKey), m_nativeModifiers(nativeModifiers),
+ m_count(count), m_autoRepeat(autorep)
{
if (type == QEvent::ShortcutOverride)
ignore();
}
-/*!
- \internal
-*/
-QKeyEvent::~QKeyEvent()
-{
-}
+Q_IMPL_EVENT_COMMON(QKeyEvent)
/*!
- \fn quint32 QKeyEvent::nativeScanCode() const
- \since 4.2
-
- Returns the native scan code of the key event. If the key event
- does not contain this data 0 is returned.
+ \fn quint32 QKeyEvent::nativeScanCode() const
+ \since 4.2
- Note: The native scan code may be 0, even if the key event contains
- extended information.
+ Returns the native scan code of the key event. If the key event
+ does not contain this data 0 is returned.
- Note: On Mac OS/X, this function is not useful, because there is no
- way to get the scan code from Carbon or Cocoa. The function always
- returns 1 (or 0 in the case explained above).
+ \note The native scan code may be 0, even if the key event contains
+ extended information.
*/
/*!
@@ -1152,7 +1406,7 @@ QKeyEvent::~QKeyEvent()
Returns the native virtual key, or key sym of the key event.
If the key event does not contain this data 0 is returned.
- Note: The native virtual key may be 0, even if the key event contains extended information.
+ \note The native virtual key may be 0, even if the key event contains extended information.
*/
/*!
@@ -1162,7 +1416,7 @@ QKeyEvent::~QKeyEvent()
Returns the native modifiers of a key event.
If the key event does not contain this data 0 is returned.
- Note: The native modifiers may be 0, even if the key event contains extended information.
+ \note The native modifiers may be 0, even if the key event contains extended information.
*/
/*!
@@ -1189,12 +1443,13 @@ QKeyEvent::~QKeyEvent()
Returns the Unicode text that this key generated.
- Return values when modifier keys such as
- Shift, Control, Alt, and Meta are pressed
- differ among platforms and could return an empty string.
+ The text is not limited to the printable range of Unicode
+ code points, and may include control characters or characters
+ from other Unicode categories, including QChar::Other_PrivateUse.
- \note \l key() will always return a valid value,
- independent of modifier keys.
+ The text may also be empty, for example when modifier keys such as
+ Shift, Control, Alt, and Meta are pressed (depending on the platform).
+ The key() function will always return a valid value.
\sa Qt::WA_KeyCompression
*/
@@ -1225,6 +1480,15 @@ Qt::KeyboardModifiers QKeyEvent::modifiers() const
return QInputEvent::modifiers();
}
+/*!
+ \fn QKeyCombination QKeyEvent::keyCombination() const
+
+ Returns a QKeyCombination object containing both the key() and
+ the modifiers() carried by this event.
+
+ \since 6.0
+*/
+
#if QT_CONFIG(shortcut)
/*!
\fn bool QKeyEvent::matches(QKeySequence::StandardKey key) const
@@ -1297,12 +1561,7 @@ QFocusEvent::QFocusEvent(Type type, Qt::FocusReason reason)
: QEvent(type), m_reason(reason)
{}
-/*!
- \internal
-*/
-QFocusEvent::~QFocusEvent()
-{
-}
+Q_IMPL_EVENT_COMMON(QFocusEvent)
/*!
Returns the reason for this focus event.
@@ -1375,12 +1634,7 @@ QPaintEvent::QPaintEvent(const QRect &paintRect)
{}
-/*!
- \internal
-*/
-QPaintEvent::~QPaintEvent()
-{
-}
+Q_IMPL_EVENT_COMMON(QPaintEvent)
/*!
\fn const QRect &QPaintEvent::rect() const
@@ -1419,15 +1673,10 @@ QPaintEvent::~QPaintEvent()
\a pos and \a oldPos respectively.
*/
QMoveEvent::QMoveEvent(const QPoint &pos, const QPoint &oldPos)
- : QEvent(Move), p(pos), oldp(oldPos)
+ : QEvent(Move), m_pos(pos), m_oldPos(oldPos)
{}
-/*!
- \internal
-*/
-QMoveEvent::~QMoveEvent()
-{
-}
+Q_IMPL_EVENT_COMMON(QMoveEvent)
/*!
\fn const QPoint &QMoveEvent::pos() const
@@ -1450,12 +1699,16 @@ QMoveEvent::~QMoveEvent()
\ingroup events
- Expose events are sent to windows when an area of the window is invalidated,
- for example when window exposure in the windowing system changes.
+ Expose events are sent to windows when they move between the un-exposed and
+ exposed states.
- A Window with a client area that is completely covered by another window, or
- is otherwise not visible may be considered obscured by Qt and may in such
- cases not receive expose events.
+ An exposed window is potentially visible to the user. If the window is moved
+ off screen, is made totally obscured by another window, is minimized, or
+ similar, an expose event is sent to the window, and isExposed() might
+ change to false.
+
+ Expose events should not be used to paint. Handle QPaintEvent
+ instead.
The event handler QWindow::exposeEvent() receives expose events.
*/
@@ -1466,16 +1719,11 @@ QMoveEvent::~QMoveEvent()
*/
QExposeEvent::QExposeEvent(const QRegion &exposeRegion)
: QEvent(Expose)
- , rgn(exposeRegion)
+ , m_region(exposeRegion)
{
}
-/*!
- \internal
-*/
-QExposeEvent::~QExposeEvent()
-{
-}
+Q_IMPL_EVENT_COMMON(QExposeEvent)
/*!
\class QPlatformSurfaceEvent
@@ -1519,15 +1767,11 @@ QPlatformSurfaceEvent::QPlatformSurfaceEvent(SurfaceEventType surfaceEventType)
{
}
-/*!
- \internal
-*/
-QPlatformSurfaceEvent::~QPlatformSurfaceEvent()
-{
-}
+Q_IMPL_EVENT_COMMON(QPlatformSurfaceEvent)
/*!
\fn const QRegion &QExposeEvent::region() const
+ \deprecated [6.0] Use QPaintEvent instead.
Returns the window area that has been exposed. The region is given in local coordinates.
*/
@@ -1551,15 +1795,10 @@ QPlatformSurfaceEvent::~QPlatformSurfaceEvent()
size and \a oldSize respectively.
*/
QResizeEvent::QResizeEvent(const QSize &size, const QSize &oldSize)
- : QEvent(Resize), s(size), olds(oldSize)
+ : QEvent(Resize), m_size(size), m_oldSize(oldSize)
{}
-/*!
- \internal
-*/
-QResizeEvent::~QResizeEvent()
-{
-}
+Q_IMPL_EVENT_COMMON(QResizeEvent)
/*!
\fn const QSize &QResizeEvent::size() const
@@ -1601,10 +1840,6 @@ QResizeEvent::~QResizeEvent()
special handling, you should reimplement the event handler and
ignore() the event.
- The \l{mainwindows/application#close event handler}{closeEvent() in the
- Application example} shows a close event handler that
- asks whether to save a document before closing.
-
If you want the widget to be deleted when it is closed, create it
with the Qt::WA_DeleteOnClose flag. This is very useful for
independent top-level windows in a multi-window application.
@@ -1634,11 +1869,7 @@ QCloseEvent::QCloseEvent()
: QEvent(Close)
{}
-/*! \internal
-*/
-QCloseEvent::~QCloseEvent()
-{
-}
+Q_IMPL_EVENT_COMMON(QCloseEvent)
/*!
\class QIconDragEvent
@@ -1667,10 +1898,7 @@ QIconDragEvent::QIconDragEvent()
: QEvent(IconDrag)
{ ignore(); }
-/*! \internal */
-QIconDragEvent::~QIconDragEvent()
-{
-}
+Q_IMPL_EVENT_COMMON(QIconDragEvent)
/*!
\class QContextMenuEvent
@@ -1687,11 +1915,6 @@ QIconDragEvent::~QIconDragEvent()
When this event occurs it is customary to show a QMenu with a
context menu, if this is relevant to the context.
-
- Context menu events contain a special accept flag that indicates
- whether the receiver accepted the event. If the event handler does
- not accept the event then, if possible, whatever triggered the event will be
- handled as a regular input event.
*/
#ifndef QT_NO_CONTEXTMENU
@@ -1704,34 +1927,19 @@ QIconDragEvent::~QIconDragEvent()
The \a pos parameter specifies the mouse position relative to the
receiving widget. \a globalPos is the mouse position in absolute
- coordinates.
-*/
-QContextMenuEvent::QContextMenuEvent(Reason reason, const QPoint &pos, const QPoint &globalPos)
- : QContextMenuEvent(reason, pos, globalPos, Qt::NoModifier)
-{}
-
-/*!
- Constructs a context menu event object with the accept parameter
- flag set to false.
-
- The \a reason parameter must be QContextMenuEvent::Mouse or
- QContextMenuEvent::Keyboard.
-
- The \a pos parameter specifies the mouse position relative to the
- receiving widget. \a globalPos is the mouse position in absolute
coordinates. The \a modifiers holds the keyboard modifiers.
*/
QContextMenuEvent::QContextMenuEvent(Reason reason, const QPoint &pos, const QPoint &globalPos,
Qt::KeyboardModifiers modifiers)
- : QInputEvent(ContextMenu, modifiers), p(pos), gp(globalPos), reas(reason)
+ : QInputEvent(ContextMenu, QPointingDevice::primaryPointingDevice(), modifiers), m_pos(pos), m_globalPos(globalPos), m_reason(reason)
{}
+Q_IMPL_EVENT_COMMON(QContextMenuEvent)
-/*! \internal */
-QContextMenuEvent::~QContextMenuEvent()
-{
-}
+#if QT_DEPRECATED_SINCE(6, 4)
/*!
+ \deprecated [6.4] Use the other constructor instead (global position is required).
+
Constructs a context menu event object with the accept parameter
flag set to false.
@@ -1746,12 +1954,13 @@ QContextMenuEvent::~QContextMenuEvent()
position explicitly.
*/
QContextMenuEvent::QContextMenuEvent(Reason reason, const QPoint &pos)
- : QInputEvent(ContextMenu), p(pos), reas(reason)
+ : QInputEvent(ContextMenu, QInputDevice::primaryKeyboard()), m_pos(pos), m_reason(reason)
{
#ifndef QT_NO_CURSOR
- gp = QCursor::pos();
+ m_globalPos = QCursor::pos();
#endif
}
+#endif
/*!
\fn const QPoint &QContextMenuEvent::pos() const
@@ -1886,7 +2095,7 @@ QContextMenuEvent::QContextMenuEvent(Reason reason, const QPoint &pos)
has to be inserted to the widgets text directly before the preedit
string.
- If the commitString() should replace parts of the of the text in
+ If the commitString() should replace parts of the text in
the editor, replacementLength() will contain the number of
characters to be replaced. replacementStart() contains the position
at which characters are to be replaced relative from the start of
@@ -2022,7 +2231,7 @@ QContextMenuEvent::QContextMenuEvent(Reason reason, const QPoint &pos)
\sa setCommitString()
*/
QInputMethodEvent::QInputMethodEvent()
- : QEvent(QEvent::InputMethod), replace_from(0), replace_length(0)
+ : QEvent(QEvent::InputMethod), m_replacementStart(0), m_replacementLength(0)
{
}
@@ -2037,24 +2246,12 @@ QInputMethodEvent::QInputMethodEvent()
\sa preeditString(), attributes()
*/
QInputMethodEvent::QInputMethodEvent(const QString &preeditText, const QList<Attribute> &attributes)
- : QEvent(QEvent::InputMethod), preedit(preeditText), attrs(attributes),
- replace_from(0), replace_length(0)
+ : QEvent(QEvent::InputMethod), m_preedit(preeditText), m_attributes(attributes),
+ m_replacementStart(0), m_replacementLength(0)
{
}
-/*!
- Constructs a copy of \a other.
-*/
-QInputMethodEvent::QInputMethodEvent(const QInputMethodEvent &other)
- : QEvent(QEvent::InputMethod), preedit(other.preedit), attrs(other.attrs),
- commit(other.commit), replace_from(other.replace_from), replace_length(other.replace_length)
-{
-}
-
-QInputMethodEvent::~QInputMethodEvent()
-{
- // must be empty until ### Qt 6
-}
+Q_IMPL_EVENT_COMMON(QInputMethodEvent)
/*!
Sets the commit string to \a commitString.
@@ -2064,7 +2261,7 @@ QInputMethodEvent::~QInputMethodEvent()
result of the input operations and has to be inserted to the
widgets text directly before the preedit string.
- If the commit string should replace parts of the of the text in
+ If the commit string should replace parts of the text in
the editor, \a replaceLength specifies the number of
characters to be replaced. \a replaceFrom specifies the position
at which characters are to be replaced relative from the start of
@@ -2074,9 +2271,9 @@ QInputMethodEvent::~QInputMethodEvent()
*/
void QInputMethodEvent::setCommitString(const QString &commitString, int replaceFrom, int replaceLength)
{
- commit = commitString;
- replace_from = replaceFrom;
- replace_length = replaceLength;
+ m_commit = commitString;
+ m_replacementStart = replaceFrom;
+ m_replacementLength = replaceLength;
}
/*!
@@ -2161,12 +2358,7 @@ QInputMethodQueryEvent::QInputMethodQueryEvent(Qt::InputMethodQueries queries)
{
}
-/*!
- \internal
- */
-QInputMethodQueryEvent::~QInputMethodQueryEvent()
-{
-}
+Q_IMPL_EVENT_COMMON(QInputMethodQueryEvent)
/*!
Sets property \a query to \a value.
@@ -2215,14 +2407,14 @@ QVariant QInputMethodQueryEvent::value(Qt::InputMethodQuery query) const
(pressing the stylus tip against the tablet surface is equivalent to a left
mouse button). But tablet events also pass through some extra information
that the tablet device driver provides; for example, you might want to do
- subpixel rendering with higher resolution coordinates (\l hiResGlobalX()
- and \l hiResGlobalY()), adjust color brightness based on the \l pressure()
- of the tool against the tablet surface, use different brushes depending on
- the type of tool in use (\l device()), modulate the brush shape in some way
- according to the X-axis and Y-axis tilt of the tool with respect to the
- tablet surface (\l xTilt() and \l yTilt()), and use a virtual eraser
- instead of a brush if the user switches to the other end of a double-ended
- stylus (\l pointerType()).
+ subpixel rendering with higher resolution coordinates (\l globalPosF()),
+ adjust color brightness based on the \l pressure() of the tool against the
+ tablet surface, use different brushes depending on the type of tool in use
+ (\l deviceType()), modulate the brush shape in some way according to the
+ X-axis and Y-axis tilt of the tool with respect to the tablet surface
+ (\l xTilt() and \l yTilt()), and use a virtual eraser instead of a brush if
+ the user switches to the other end of a double-ended stylus
+ (\l pointerType()).
Every event contains an accept flag that indicates whether the receiver
wants the event. You should call QTabletEvent::accept() if you handle the
@@ -2243,11 +2435,6 @@ QVariant QInputMethodQueryEvent::value(Qt::InputMethodQuery query) const
If the tablet events are rejected, the synthetic mouse events may be
compressed for efficiency.
- New in Qt 5.4: QTabletEvent includes all information available from the
- device, including \l QTabletEvent::buttons(). Previously it was not
- possible to accept all tablet events and also know which stylus buttons
- were pressed.
-
Note that pressing the stylus button while the stylus hovers over the
tablet will generate a button press on some types of tablets, while on
other types it will be necessary to press the stylus against the tablet
@@ -2270,188 +2457,60 @@ QVariant QInputMethodQueryEvent::value(Qt::InputMethodQuery query) const
*/
/*!
- \enum QTabletEvent::TabletDevice
-
- This enum defines what type of device is generating the event.
-
- \value NoDevice No device, or an unknown device.
- \value Puck A Puck (a device that is similar to a flat mouse with
- a transparent circle with cross-hairs).
- \value Stylus A Stylus.
- \value Airbrush An airbrush
- \value FourDMouse A 4D Mouse.
- \value RotationStylus A special stylus that also knows about rotation
- (a 6D stylus). \since 4.1
- \omitvalue XFreeEraser
-*/
-
-/*!
- \enum QTabletEvent::PointerType
-
- This enum defines what type of point is generating the event.
-
- \value UnknownPointer An unknown device.
- \value Pen Tip end of a stylus-like device (the narrow end of the pen).
- \value Cursor Any puck-like device.
- \value Eraser Eraser end of a stylus-like device (the broad end of the pen).
-
- \sa pointerType()
-*/
-
-/*!
- Construct a tablet event of the given \a type.
-
- The \a pos parameter indicates where the event occurred in the
- widget; \a globalPos is the corresponding position in absolute
- coordinates.
+ Construct a tablet event of the given \a type.
- \a pressure contains the pressure exerted on the \a device.
+ The \a pos parameter indicates where the event occurred in the widget;
+ \a globalPos is the corresponding position in absolute coordinates.
- \a pointerType describes the type of pen that is being used.
+ \a pressure gives the pressure exerted on the device \a dev.
- \a xTilt and \a yTilt contain the device's degree of tilt from the
- x and y axes respectively.
+ \a xTilt and \a yTilt give the device's degree of tilt from the
+ x and y axes respectively.
- \a keyState specifies which keyboard modifiers are pressed (e.g.,
- \uicontrol{Ctrl}).
+ \a keyState specifies which keyboard modifiers are pressed (e.g.,
+ \uicontrol{Ctrl}).
- The \a uniqueID parameter contains the unique ID for the current device.
+ The \a z parameter gives the Z coordinate of the device on the tablet;
+ this is usually given by a wheel on a 4D mouse. If the device does not
+ support a Z-axis (i.e. \l QPointingDevice::capabilities() does not include
+ \c ZPosition), pass \c 0 here.
- The \a z parameter contains the coordinate of the device on the tablet, this
- is usually given by a wheel on 4D mouse. If the device does not support a
- Z-axis, pass zero here.
+ The \a tangentialPressure parameter gives the tangential pressure
+ thumbwheel value from an airbrush. If the device does not support
+ tangential pressure (i.e. \l QPointingDevice::capabilities() does not
+ include \c TangentialPressure), pass \c 0 here.
- The \a tangentialPressure parameter contins the tangential pressure of an air
- brush. If the device does not support tangential pressure, pass 0 here.
+ \a rotation gives the device's rotation in degrees.
+ 4D mice, the Wacom Art Pen, and the Apple Pencil support rotation.
+ If the device does not support rotation (i.e. \l QPointingDevice::capabilities()
+ does not include \c Rotation), pass \c 0 here.
- \a rotation contains the device's rotation in degrees.
- 4D mice, the Wacom Art Pen, and the Apple Pencil support rotation.
- If the device does not support rotation, pass 0 here.
-
- The \a button that caused the event is given as a value from the
- \l Qt::MouseButton enum. If the event \a type is not \l TabletPress or
- \l TabletRelease, the appropriate button for this event is \l Qt::NoButton.
-
- \a buttons is the state of all buttons at the time of the event.
-
- \sa pos(), globalPos(), device(), pressure(), xTilt(), yTilt(), uniqueId(), rotation(),
- tangentialPressure(), z()
-*/
-
-QTabletEvent::QTabletEvent(Type type, const QPointF &pos, const QPointF &globalPos,
- int device, int pointerType,
- qreal pressure, int xTilt, int yTilt, qreal tangentialPressure,
- qreal rotation, int z, Qt::KeyboardModifiers keyState, qint64 uniqueID,
- Qt::MouseButton button, Qt::MouseButtons buttons)
- : QInputEvent(type, keyState),
- mPos(pos),
- mGPos(globalPos),
- mDev(device),
- mPointerType(pointerType),
- mXT(xTilt),
- mYT(yTilt),
- mZ(z),
- mPress(pressure),
- mTangential(tangentialPressure),
- mRot(rotation),
- mUnique(uniqueID),
- mExtra(new QTabletEventPrivate(button, buttons))
-{
-}
-
-/*!
- Construct a tablet event of the given \a type.
-
- The \a pos parameter indicates where the event occurred in the
- widget; \a globalPos is the corresponding position in absolute
- coordinates.
-
- \a pressure contains the pressure exerted on the \a device.
-
- \a pointerType describes the type of pen that is being used.
-
- \a xTilt and \a yTilt contain the device's degree of tilt from the
- x and y axes respectively.
-
- \a keyState specifies which keyboard modifiers are pressed (e.g.,
- \uicontrol{Ctrl}).
-
- The \a uniqueID parameter contains the unique ID for the current device.
-
- The \a z parameter contains the coordinate of the device on the tablet, this
- is usually given by a wheel on 4D mouse. If the device does not support a
- Z-axis, pass zero here.
-
- The \a tangentialPressure parameter contins the tangential pressure of an air
- brush. If the device does not support tangential pressure, pass 0 here.
+ The \a button that caused the event is given as a value from the
+ \l Qt::MouseButton enum. If the event \a type is not \l TabletPress or
+ \l TabletRelease, the appropriate button for this event is \l Qt::NoButton.
- \a rotation contains the device's rotation in degrees. 4D mice support
- rotation. If the device does not support rotation, pass 0 here.
+ \a buttons is the state of all buttons at the time of the event.
- \sa pos(), globalPos(), device(), pressure(), xTilt(), yTilt(), uniqueId(), rotation(),
+ \sa pos(), globalPos(), device(), pressure(), xTilt(), yTilt(), uniqueId(), rotation(),
tangentialPressure(), z()
-
- \deprecated in 5.4: use the constructor with MouseButton status
-*/
-
-QTabletEvent::QTabletEvent(Type type, const QPointF &pos, const QPointF &globalPos,
- int device, int pointerType,
- qreal pressure, int xTilt, int yTilt, qreal tangentialPressure,
- qreal rotation, int z, Qt::KeyboardModifiers keyState, qint64 uniqueID)
- : QTabletEvent(type, pos, globalPos, device, pointerType, pressure, xTilt, yTilt,
- tangentialPressure, rotation, z, keyState, uniqueID, Qt::NoButton, Qt::NoButton)
-{
-}
-
-/*!
- \internal
-*/
-QTabletEvent::~QTabletEvent()
-{
- delete static_cast<QTabletEventPrivate *>(mExtra);
-}
-
-/*!
- Returns the button that caused the event.
-
- Note that the returned value is always Qt::NoButton for \l TabletMove,
- \l TabletEnterProximity and \l TabletLeaveProximity events.
-
- \sa buttons(), Qt::MouseButton
-*/
-Qt::MouseButton QTabletEvent::button() const
-{
- return static_cast<QTabletEventPrivate *>(mExtra)->b;
-}
-
-/*!
- Returns the button state when the event was generated. The button state is
- a combination of buttons from the \l Qt::MouseButton enum using the OR
- operator. For \l TabletMove events, this is all buttons that are pressed
- down. For \l TabletPress events this includes the button that caused the
- event. For \l TabletRelease events this excludes the button that caused the
- event.
-
- \sa button(), Qt::MouseButton
*/
-Qt::MouseButtons QTabletEvent::buttons() const
+QTabletEvent::QTabletEvent(Type type, const QPointingDevice *dev, const QPointF &pos, const QPointF &globalPos,
+ qreal pressure, float xTilt, float yTilt,
+ float tangentialPressure, qreal rotation, float z,
+ Qt::KeyboardModifiers keyState,
+ Qt::MouseButton button, Qt::MouseButtons buttons)
+ : QSinglePointEvent(type, dev, pos, pos, globalPos, button, buttons, keyState),
+ m_tangential(tangentialPressure),
+ m_xTilt(xTilt),
+ m_yTilt(yTilt),
+ m_z(z)
{
- return static_cast<QTabletEventPrivate *>(mExtra)->buttonState;
+ QEventPoint &p = point(0);
+ QMutableEventPoint::setPressure(p, pressure);
+ QMutableEventPoint::setRotation(p, rotation);
}
-/*!
- \fn TabletDevices QTabletEvent::device() const
-
- Returns the type of device that generated the event.
-
- \sa TabletDevice
-*/
-
-/*!
- \fn PointerType QTabletEvent::pointerType() const
-
- Returns the type of point that generated the event.
-*/
+Q_IMPL_POINTER_EVENT(QTabletEvent)
/*!
\fn qreal QTabletEvent::tangentialPressure() const
@@ -2462,6 +2521,8 @@ Qt::MouseButtons QTabletEvent::buttons() const
direction from the neutrual position. If the device does not support
tangential pressure, this value is always 0.0.
+ \note The value is stored as a single-precision float.
+
\sa pressure()
*/
@@ -2486,7 +2547,7 @@ Qt::MouseButtons QTabletEvent::buttons() const
*/
/*!
- \fn int QTabletEvent::xTilt() const
+ \fn qreal QTabletEvent::xTilt() const
Returns the angle between the device (a pen, for example) and the
perpendicular in the direction of the x axis.
@@ -2495,22 +2556,27 @@ Qt::MouseButtons QTabletEvent::buttons() const
\image qtabletevent-tilt.png
+ \note The value is stored as a single-precision float.
+
\sa yTilt()
*/
/*!
- \fn int QTabletEvent::yTilt() const
+ \fn qreal QTabletEvent::yTilt() const
Returns the angle between the device (a pen, for example) and the
perpendicular in the direction of the y axis.
Positive values are towards the bottom of the tablet. The angle is
within the range -60 to +60 degrees.
+ \note The value is stored as a single-precision float.
+
\sa xTilt()
*/
/*!
\fn QPoint QTabletEvent::pos() const
+ \deprecated [6.0] Use position().toPoint() instead.
Returns the position of the device, relative to the widget that
received the event.
@@ -2523,6 +2589,7 @@ Qt::MouseButtons QTabletEvent::buttons() const
/*!
\fn int QTabletEvent::x() const
+ \deprecated [6.0] Use position().x() instead.
Returns the x position of the device, relative to the widget that
received the event.
@@ -2532,6 +2599,7 @@ Qt::MouseButtons QTabletEvent::buttons() const
/*!
\fn int QTabletEvent::y() const
+ \deprecated [6.0] Use position().y() instead.
Returns the y position of the device, relative to the widget that
received the event.
@@ -2540,17 +2608,20 @@ Qt::MouseButtons QTabletEvent::buttons() const
*/
/*!
- \fn int QTabletEvent::z() const
+ \fn qreal QTabletEvent::z() const
Returns the z position of the device. Typically this is represented by a
wheel on a 4D Mouse. If the device does not support a Z-axis, this value is
always zero. This is \b not the same as pressure.
+ \note The value is stored as a single-precision float.
+
\sa pressure()
*/
/*!
\fn QPoint QTabletEvent::globalPos() const
+ \deprecated [6.0] Use globalPosition().toPoint() instead.
Returns the global position of the device \e{at the time of the
event}. This is important on asynchronous windows systems like X11;
@@ -2563,24 +2634,27 @@ Qt::MouseButtons QTabletEvent::buttons() const
/*!
\fn int QTabletEvent::globalX() const
+ \deprecated [6.0] Use globalPosition().x() instead.
Returns the global x position of the mouse pointer at the time of
the event.
- \sa globalY(), globalPos(), hiResGlobalX()
+ \sa globalY(), globalPos()
*/
/*!
\fn int QTabletEvent::globalY() const
+ \deprecated [6.0] Use globalPosition().y() instead.
Returns the global y position of the tablet device at the time of
the event.
- \sa globalX(), globalPos(), hiResGlobalY()
+ \sa globalX(), globalPos()
*/
/*!
\fn qint64 QTabletEvent::uniqueId() const
+ \deprecated [6.0] Use pointingDevice().uniqueId() instead.
Returns a unique ID for the current device, making it possible
to differentiate between multiple devices being used at the same
@@ -2603,19 +2677,8 @@ Qt::MouseButtons QTabletEvent::buttons() const
*/
/*!
- \fn qreal &QTabletEvent::hiResGlobalX() const
-
- The high precision x position of the tablet device.
-*/
-
-/*!
- \fn qreal &QTabletEvent::hiResGlobalY() const
-
- The high precision y position of the tablet device.
-*/
-
-/*!
\fn const QPointF &QTabletEvent::posF() const
+ \deprecated [6.0] Use position() instead.
Returns the position of the device, relative to the widget that
received the event.
@@ -2628,7 +2691,7 @@ Qt::MouseButtons QTabletEvent::buttons() const
/*!
\fn const QPointF &QTabletEvent::globalPosF() const
-
+ \deprecated [6.0] Use globalPosition() instead.
Returns the global position of the device \e{at the time of the
event}. This is important on asynchronous windows systems like X11;
whenever you move your widgets around in response to mouse events,
@@ -2649,8 +2712,10 @@ Qt::MouseButtons QTabletEvent::buttons() const
\ingroup events
Native gesture events are generated by the operating system, typically by
- interpreting touch events. Gesture events are high-level events such
- as zoom or rotate.
+ interpreting trackpad touch events. Gesture events are high-level events
+ such as zoom, rotate or pan. Several types hold incremental values: that is,
+ value() and delta() provide the difference from the previous event to the
+ current event.
\table
\header
@@ -2660,7 +2725,7 @@ Qt::MouseButtons QTabletEvent::buttons() const
\row
\li Qt::ZoomNativeGesture
\li Magnification delta in percent.
- \li \macos: Two-finger pinch.
+ \li \macos and Wayland: Two-finger pinch.
\row
\li Qt::SmartZoomNativeGesture
\li Boolean magnification state.
@@ -2668,10 +2733,17 @@ Qt::MouseButtons QTabletEvent::buttons() const
\row
\li Qt::RotateNativeGesture
\li Rotation delta in degrees.
- \li \macos: Two-finger rotate.
+ \li \macos and Wayland: Two-finger rotate.
+ \row
+ \li Qt::SwipeNativeGesture
+ \li Swipe angle in degrees.
+ \li \macos: Configurable in trackpad settings.
+ \row
+ \li Qt::PanNativeGesture
+ \li Displacement delta in pixels.
+ \li Wayland: Three or more fingers moving as a group, in any direction.
\endtable
-
In addition, BeginNativeGesture and EndNativeGesture are sent before and after
gesture event streams:
@@ -2681,48 +2753,88 @@ Qt::MouseButtons QTabletEvent::buttons() const
ZoomNativeGesture
EndNativeGesture
- \sa Qt::NativeGestureType, QGestureEvent
-*/
+ The event stream may include interleaved gestures of different types:
+ for example the two-finger pinch gesture generates a stream of Zoom and
+ Rotate events, and PanNativeGesture may sometimes be interleaved with
+ those, depending on the platform.
-#if QT_DEPRECATED_SINCE(5, 10)
-/*!
- \deprecated The QTouchDevice parameter is now required
+ Other types are standalone events: SmartZoomNativeGesture and
+ SwipeNativeGesture occur only once each time the gesture is detected.
+
+ \note On a touchpad, moving two fingers as a group (the two-finger flick gesture)
+ is usually reserved for scrolling; in that case, Qt generates QWheelEvents.
+ This is the reason that three or more fingers are needed to generate a
+ PanNativeGesture.
+
+ \sa Qt::NativeGestureType, QGestureEvent, QWheelEvent
*/
-QNativeGestureEvent::QNativeGestureEvent(Qt::NativeGestureType type, const QPointF &localPos, const QPointF &windowPos,
- const QPointF &screenPos, qreal realValue, ulong sequenceId, quint64 intValue)
- : QInputEvent(QEvent::NativeGesture), mGestureType(type),
- mLocalPos(localPos), mWindowPos(windowPos), mScreenPos(screenPos), mRealValue(realValue),
- mSequenceId(sequenceId), mIntValue(intValue)
-{ }
-#endif
+#if QT_DEPRECATED_SINCE(6, 2)
/*!
+ \deprecated [6.2] Use the other constructor, because \a intValue is no longer stored separately.
+
Constructs a native gesture event of type \a type originating from \a device.
- The points \a localPos, \a windowPos and \a screenPos specify the
+ The points \a localPos, \a scenePos and \a globalPos specify the
gesture position relative to the receiving widget or item,
- window, and screen, respectively.
+ window, and screen or desktop, respectively.
\a realValue is the \macos event parameter, \a sequenceId and \a intValue are the Windows event parameters.
\since 5.10
+
+ \note It's not possible to store realValue and \a intValue simultaneously:
+ one or the other must be zero. If \a realValue == 0 and \a intValue != 0,
+ it is stored in the same variable, such that value() returns the value
+ given as \a intValue.
*/
-QNativeGestureEvent::QNativeGestureEvent(Qt::NativeGestureType type, const QTouchDevice *device, const QPointF &localPos, const QPointF &windowPos,
- const QPointF &screenPos, qreal realValue, ulong sequenceId, quint64 intValue)
- : QInputEvent(QEvent::NativeGesture), mGestureType(type),
- mLocalPos(localPos), mWindowPos(windowPos), mScreenPos(screenPos), mRealValue(realValue),
- mSequenceId(sequenceId), mIntValue(intValue), mDevice(device)
+QNativeGestureEvent::QNativeGestureEvent(Qt::NativeGestureType type, const QPointingDevice *device,
+ const QPointF &localPos, const QPointF &scenePos,
+ const QPointF &globalPos, qreal realValue, quint64 sequenceId,
+ quint64 intValue)
+ : QSinglePointEvent(QEvent::NativeGesture, device, localPos, scenePos, globalPos, Qt::NoButton,
+ Qt::NoButton, Qt::NoModifier),
+ m_sequenceId(sequenceId), m_realValue(realValue), m_gestureType(type)
{
+ if (qIsNull(realValue) && intValue != 0)
+ m_realValue = intValue;
}
-
-QNativeGestureEvent::~QNativeGestureEvent()
- = default;
+#endif // deprecated
/*!
- \fn const QTouchDevice *QNativeGestureEvent::device() const
- \since 5.10
+ Constructs a native gesture event of type \a type originating from \a device
+ describing a gesture at \a scenePos in which \a fingerCount fingers are involved.
+
+ The points \a localPos, \a scenePos and \a globalPos specify the gesture
+ position relative to the receiving widget or item, window, and screen or
+ desktop, respectively.
+
+ \a value has a gesture-dependent interpretation: for RotateNativeGesture or
+ SwipeNativeGesture, it's an angle in degrees. For ZoomNativeGesture,
+ \a value is an incremental scaling factor, usually much less than 1,
+ indicating that the target item should have its scale adjusted like this:
+ item.scale = item.scale * (1 + event.value)
+
+ For PanNativeGesture, \a delta gives the distance in pixels that the
+ viewport, widget or item should be moved or panned.
+
+ \note The \a delta is stored in single precision (QVector2D), so \l delta()
+ may return slightly different values in some cases. This is subject to change
+ in future versions of Qt.
- Returns the device.
+ \since 6.2
*/
+QNativeGestureEvent::QNativeGestureEvent(Qt::NativeGestureType type, const QPointingDevice *device, int fingerCount,
+ const QPointF &localPos, const QPointF &scenePos,
+ const QPointF &globalPos, qreal value, const QPointF &delta,
+ quint64 sequenceId)
+ : QSinglePointEvent(QEvent::NativeGesture, device, localPos, scenePos, globalPos, Qt::NoButton,
+ Qt::NoButton, Qt::NoModifier),
+ m_sequenceId(sequenceId), m_delta(delta), m_realValue(value), m_gestureType(type), m_fingerCount(fingerCount)
+{
+ Q_ASSERT(fingerCount < 16); // we store it in 4 bits unsigned
+}
+
+Q_IMPL_POINTER_EVENT(QNativeGestureEvent)
/*!
\fn QNativeGestureEvent::gestureType() const
@@ -2732,19 +2844,40 @@ QNativeGestureEvent::~QNativeGestureEvent()
*/
/*!
+ \fn QNativeGestureEvent::fingerCount() const
+ \since 6.2
+
+ Returns the number of fingers participating in the gesture, if known.
+ When gestureType() is Qt::BeginNativeGesture or Qt::EndNativeGesture, often
+ this information is unknown, and fingerCount() returns \c 0.
+*/
+
+/*!
\fn QNativeGestureEvent::value() const
\since 5.2
Returns the gesture value. The value should be interpreted based on the
- gesture type. For example, a Zoom gesture provides a scale factor while a Rotate
+ gesture type. For example, a Zoom gesture provides a scale factor delta while a Rotate
gesture provides a rotation delta.
\sa QNativeGestureEvent, gestureType()
*/
/*!
+ \fn QNativeGestureEvent::delta() const
+ \since 6.2
+
+ Returns the distance moved since the previous event, in pixels.
+ A Pan gesture provides the distance in pixels by which the target widget,
+ item or viewport contents should be moved.
+
+ \sa QPanGesture::delta()
+*/
+
+/*!
\fn QPoint QNativeGestureEvent::globalPos() const
\since 5.2
+ \deprecated [6.0] Use globalPosition().toPoint() instead.
Returns the position of the gesture as a QPointF in screen coordinates
*/
@@ -2752,6 +2885,7 @@ QNativeGestureEvent::~QNativeGestureEvent()
/*!
\fn QPoint QNativeGestureEvent::pos() const
\since 5.2
+ \deprecated [6.0] Use position().toPoint() instead.
Returns the position of the mouse cursor, relative to the widget
or item that received the event.
@@ -2760,6 +2894,7 @@ QNativeGestureEvent::~QNativeGestureEvent()
/*!
\fn QPointF QNativeGestureEvent::localPos() const
\since 5.2
+ \deprecated [6.0] Use position() instead.
Returns the position of the gesture as a QPointF, relative to the
widget or item that received the event.
@@ -2768,6 +2903,7 @@ QNativeGestureEvent::~QNativeGestureEvent()
/*!
\fn QPointF QNativeGestureEvent::screenPos() const
\since 5.2
+ \deprecated [6.0] Use globalPosition() instead.
Returns the position of the gesture as a QPointF in screen coordinates.
*/
@@ -2775,6 +2911,7 @@ QNativeGestureEvent::~QNativeGestureEvent()
/*!
\fn QPointF QNativeGestureEvent::windowPos() const
\since 5.2
+ \deprecated [6.0] Use scenePosition() instead.
Returns the position of the gesture as a QPointF, relative to the
window that received the event.
@@ -2797,15 +2934,10 @@ QNativeGestureEvent::~QNativeGestureEvent()
QDragMoveEvent::QDragMoveEvent(const QPoint& pos, Qt::DropActions actions, const QMimeData *data,
Qt::MouseButtons buttons, Qt::KeyboardModifiers modifiers, Type type)
: QDropEvent(pos, actions, data, buttons, modifiers, type)
- , rect(pos, QSize(1, 1))
+ , m_rect(pos, QSize(1, 1))
{}
-/*!
- Destroys the event.
-*/
-QDragMoveEvent::~QDragMoveEvent()
-{
-}
+Q_IMPL_EVENT_COMMON(QDragMoveEvent)
/*!
\fn void QDragMoveEvent::accept(const QRect &rectangle)
@@ -2909,19 +3041,16 @@ QDragMoveEvent::~QDragMoveEvent()
*/
QDropEvent::QDropEvent(const QPointF& pos, Qt::DropActions actions, const QMimeData *data,
Qt::MouseButtons buttons, Qt::KeyboardModifiers modifiers, Type type)
- : QEvent(type), p(pos), mouseState(buttons),
- modState(modifiers), act(actions),
- mdata(data)
+ : QEvent(type), m_pos(pos), m_mouseState(buttons),
+ m_modState(modifiers), m_actions(actions),
+ m_data(data)
{
- default_action = QGuiApplicationPrivate::platformIntegration()->drag()->defaultAction(act, modifiers);
- drop_action = default_action;
+ m_defaultAction = m_dropAction =
+ QGuiApplicationPrivate::platformIntegration()->drag()->defaultAction(m_actions, modifiers);
ignore();
}
-/*! \internal */
-QDropEvent::~QDropEvent()
-{
-}
+Q_IMPL_EVENT_COMMON(QDropEvent)
/*!
@@ -2945,31 +3074,56 @@ QObject* QDropEvent::source() const
void QDropEvent::setDropAction(Qt::DropAction action)
{
- if (!(action & act) && action != Qt::IgnoreAction)
- action = default_action;
- drop_action = action;
+ if (!(action & m_actions) && action != Qt::IgnoreAction)
+ action = m_defaultAction;
+ m_dropAction = action;
}
/*!
\fn QPoint QDropEvent::pos() const
+ \deprecated [6.0] Use position().toPoint() instead.
Returns the position where the drop was made.
*/
/*!
\fn const QPointF& QDropEvent::posF() const
+ \deprecated [6.0] Use position() instead.
+
+ Returns the position where the drop was made.
+*/
+
+/*!
+ \fn QPointF QDropEvent::position() const
+ \since 6.0
Returns the position where the drop was made.
*/
/*!
\fn Qt::MouseButtons QDropEvent::mouseButtons() const
+ \deprecated [6.0] Use buttons() instead.
- Returns the mouse buttons that are pressed..
+ Returns the mouse buttons that are pressed.
+*/
+
+/*!
+ \fn Qt::MouseButtons QDropEvent::buttons() const
+ \since 6.0
+
+ Returns the mouse buttons that are pressed.
*/
/*!
\fn Qt::KeyboardModifiers QDropEvent::keyboardModifiers() const
+ \deprecated [6.0] Use modifiers() instead.
+
+ Returns the modifier keys that are pressed.
+*/
+
+/*!
+ \fn Qt::KeyboardModifiers QDropEvent::modifiers() const
+ \since 6.0
Returns the modifier keys that are pressed.
*/
@@ -3062,11 +3216,7 @@ QDragEnterEvent::QDragEnterEvent(const QPoint& point, Qt::DropActions actions, c
: QDragMoveEvent(point, actions, data, buttons, modifiers, DragEnter)
{}
-/*! \internal
-*/
-QDragEnterEvent::~QDragEnterEvent()
-{
-}
+Q_IMPL_EVENT_COMMON(QDragEnterEvent)
/*!
\class QDragMoveEvent
@@ -3120,11 +3270,8 @@ QDragLeaveEvent::QDragLeaveEvent()
: QEvent(DragLeave)
{}
-/*! \internal
-*/
-QDragLeaveEvent::~QDragLeaveEvent()
-{
-}
+Q_IMPL_EVENT_COMMON(QDragLeaveEvent)
+
#endif // QT_CONFIG(draganddrop)
/*!
@@ -3153,7 +3300,7 @@ QDragLeaveEvent::~QDragLeaveEvent()
\sa pos(), globalPos()
*/
QHelpEvent::QHelpEvent(Type type, const QPoint &pos, const QPoint &globalPos)
- : QEvent(type), p(pos), gp(globalPos)
+ : QEvent(type), m_pos(pos), m_globalPos(globalPos)
{}
/*!
@@ -3206,11 +3353,7 @@ QHelpEvent::QHelpEvent(Type type, const QPoint &pos, const QPoint &globalPos)
\sa pos(), globalX(), globalY()
*/
-/*! \internal
-*/
-QHelpEvent::~QHelpEvent()
-{
-}
+Q_IMPL_EVENT_COMMON(QHelpEvent)
#ifndef QT_NO_STATUSTIP
@@ -3262,14 +3405,10 @@ QHelpEvent::~QHelpEvent()
\sa tip()
*/
QStatusTipEvent::QStatusTipEvent(const QString &tip)
- : QEvent(StatusTip), s(tip)
+ : QEvent(StatusTip), m_tip(tip)
{}
-/*! \internal
-*/
-QStatusTipEvent::~QStatusTipEvent()
-{
-}
+Q_IMPL_EVENT_COMMON(QStatusTipEvent)
/*!
\fn QString QStatusTipEvent::tip() const
@@ -3302,14 +3441,10 @@ QStatusTipEvent::~QStatusTipEvent()
\sa href()
*/
QWhatsThisClickedEvent::QWhatsThisClickedEvent(const QString &href)
- : QEvent(WhatsThisClicked), s(href)
+ : QEvent(WhatsThisClicked), m_href(href)
{}
-/*! \internal
-*/
-QWhatsThisClickedEvent::~QWhatsThisClickedEvent()
-{
-}
+Q_IMPL_EVENT_COMMON(QWhatsThisClickedEvent)
/*!
\fn QString QWhatsThisClickedEvent::href() const
@@ -3325,7 +3460,7 @@ QWhatsThisClickedEvent::~QWhatsThisClickedEvent()
/*!
\class QActionEvent
\brief The QActionEvent class provides an event that is generated
- when a QGuiAction is added, removed, or changed.
+ when a QAction is added, removed, or changed.
\ingroup events
\inmodule QtGui
@@ -3336,7 +3471,7 @@ QWhatsThisClickedEvent::~QWhatsThisClickedEvent()
QWidget::actionEvent() to create \l{QToolButton}s for the
actions.
- \sa QGuiAction, QWidget::addAction(), QWidget::removeAction(), QWidget::actions()
+ \sa QAction, QWidget::addAction(), QWidget::removeAction(), QWidget::actions()
*/
/*!
@@ -3345,17 +3480,13 @@ QWhatsThisClickedEvent::~QWhatsThisClickedEvent()
\a action is the action that is changed, added, or removed. If \a
type is ActionAdded, the action is to be inserted before the
- action \a before. If \a before is 0, the action is appended.
+ action \a before. If \a before is \nullptr, the action is appended.
*/
-QActionEvent::QActionEvent(int type, QGuiAction *action, QGuiAction *before)
- : QEvent(static_cast<QEvent::Type>(type)), act(action), bef(before)
+QActionEvent::QActionEvent(int type, QAction *action, QAction *before)
+ : QEvent(static_cast<QEvent::Type>(type)), m_action(action), m_before(before)
{}
-/*! \internal
-*/
-QActionEvent::~QActionEvent()
-{
-}
+Q_IMPL_EVENT_COMMON(QActionEvent)
/*!
\fn QAction *QActionEvent::action() const
@@ -3405,11 +3536,7 @@ QHideEvent::QHideEvent()
: QEvent(Hide)
{}
-/*! \internal
-*/
-QHideEvent::~QHideEvent()
-{
-}
+Q_IMPL_EVENT_COMMON(QHideEvent)
/*!
\class QShowEvent
@@ -3435,11 +3562,7 @@ QShowEvent::QShowEvent()
: QEvent(Show)
{}
-/*! \internal
-*/
-QShowEvent::~QShowEvent()
-{
-}
+Q_IMPL_EVENT_COMMON(QShowEvent)
/*!
\class QFileOpenEvent
@@ -3470,10 +3593,15 @@ QShowEvent::~QShowEvent()
\snippet qfileopenevent/Info.plist Custom Info.plist
- The following implementation of a QApplication subclass prints the path to
- the file that was, for example, dropped on the Dock icon of the application.
+ The following implementation of a QApplication subclass shows how to handle
+ QFileOpenEvent to open the file that was, for example, dropped on the Dock
+ icon of the application.
\snippet qfileopenevent/main.cpp QApplication subclass
+
+ Note how \c{QFileOpenEvent::file()} is not guaranteed to be the name of a
+ local file that can be opened using QFile. The contents of the string depend
+ on the source application.
*/
/*!
@@ -3482,7 +3610,7 @@ QShowEvent::~QShowEvent()
Constructs a file open event for the given \a file.
*/
QFileOpenEvent::QFileOpenEvent(const QString &file)
- : QEvent(FileOpen), f(file), m_url(QUrl::fromLocalFile(file))
+ : QEvent(FileOpen), m_file(file), m_url(QUrl::fromLocalFile(file))
{
}
@@ -3492,33 +3620,32 @@ QFileOpenEvent::QFileOpenEvent(const QString &file)
Constructs a file open event for the given \a url.
*/
QFileOpenEvent::QFileOpenEvent(const QUrl &url)
- : QEvent(FileOpen), f(url.toLocalFile()), m_url(url)
+ : QEvent(FileOpen), m_file(url.toLocalFile()), m_url(url)
{
}
-
-/*! \internal
-*/
-QFileOpenEvent::~QFileOpenEvent()
-{
-}
+Q_IMPL_EVENT_COMMON(QFileOpenEvent)
/*!
\fn QString QFileOpenEvent::file() const
- Returns the file that is being opened.
+ Returns the name of the file that the application should open.
+
+ This is not guaranteed to be the path to a local file.
*/
/*!
\fn QUrl QFileOpenEvent::url() const
- Returns the url that is being opened.
+ Returns the url that the application should open.
\since 4.6
*/
+#if QT_DEPRECATED_SINCE(6, 6)
/*!
\fn bool QFileOpenEvent::openFile(QFile &file, QIODevice::OpenMode flags) const
+ \deprecated [6.6] interpret the string returned by file()
Opens a QFile on the \a file referenced by this event in the mode specified
by \a flags. Returns \c true if successful; otherwise returns \c false.
@@ -3530,9 +3657,10 @@ QFileOpenEvent::~QFileOpenEvent()
*/
bool QFileOpenEvent::openFile(QFile &file, QIODevice::OpenMode flags) const
{
- file.setFileName(f);
+ file.setFileName(m_file);
return file.open(flags);
}
+#endif
#ifndef QT_NO_TOOLBAR
/*!
@@ -3556,14 +3684,10 @@ bool QFileOpenEvent::openFile(QFile &file, QIODevice::OpenMode flags) const
Construct a QToolBarChangeEvent given the current button state in \a state.
*/
QToolBarChangeEvent::QToolBarChangeEvent(bool t)
- : QEvent(ToolBarChange), tog(t)
+ : QEvent(ToolBarChange), m_toggle(t)
{}
-/*! \internal
-*/
-QToolBarChangeEvent::~QToolBarChangeEvent()
-{
-}
+Q_IMPL_EVENT_COMMON(QToolBarChangeEvent)
/*!
\fn bool QToolBarChangeEvent::toggle() const
@@ -3588,21 +3712,40 @@ QToolBarChangeEvent::~QToolBarChangeEvent()
Constructs a shortcut event for the given \a key press,
associated with the QShortcut ID \a id.
+ \deprecated use the other constructor
+
\a ambiguous specifies whether there is more than one QShortcut
for the same key sequence.
*/
QShortcutEvent::QShortcutEvent(const QKeySequence &key, int id, bool ambiguous)
- : QEvent(Shortcut), sequence(key), ambig(ambiguous), sid(id)
+ : QEvent(Shortcut), m_sequence(key), m_shortcutId(id), m_ambiguous(ambiguous)
{
}
/*!
- Destroys the event object.
+ Constructs a shortcut event for the given \a key press,
+ associated with the QShortcut \a shortcut.
+ \since 6.5
+
+ \a ambiguous specifies whether there is more than one QShortcut
+ for the same key sequence.
*/
-QShortcutEvent::~QShortcutEvent()
+QShortcutEvent::QShortcutEvent(const QKeySequence &key, const QShortcut *shortcut, bool ambiguous)
+ : QEvent(Shortcut), m_sequence(key), m_shortcutId(0), m_ambiguous(ambiguous)
{
+ if (shortcut) {
+ auto priv = static_cast<const QShortcutPrivate *>(QShortcutPrivate::get(shortcut));
+ auto index = priv->sc_sequences.indexOf(key);
+ if (index < 0) {
+ qWarning() << "Given QShortcut does not contain key-sequence " << key;
+ return;
+ }
+ m_shortcutId = priv->sc_ids[index];
+ }
}
+Q_IMPL_EVENT_COMMON(QShortcutEvent)
+
#endif // QT_CONFIG(shortcut)
#ifndef QT_NO_DEBUG_STREAM
@@ -3614,7 +3757,7 @@ static inline void formatTouchEvent(QDebug d, const QTouchEvent &t)
d << " device: " << t.device()->name();
d << " states: ";
QtDebugUtils::formatQFlags(d, t.touchPointStates());
- d << ", " << t.touchPoints().size() << " points: " << t.touchPoints() << ')';
+ d << ", " << t.points().size() << " points: " << t.points() << ')';
}
static void formatUnicodeString(QDebug d, const QString &s)
@@ -3628,6 +3771,13 @@ static void formatUnicodeString(QDebug d, const QString &s)
d << Qt::dec << '"';
}
+static QDebug operator<<(QDebug dbg, const QInputMethodEvent::Attribute &attr)
+{
+ dbg << "[type= " << attr.type << ", start=" << attr.start << ", length=" << attr.length
+ << ", value=" << attr.value << ']';
+ return dbg;
+}
+
static inline void formatInputMethodEvent(QDebug d, const QInputMethodEvent *e)
{
d << "QInputMethodEvent(";
@@ -3643,15 +3793,15 @@ static inline void formatInputMethodEvent(QDebug d, const QInputMethodEvent *e)
d << ", replacementStart=" << e->replacementStart() << ", replacementLength="
<< e->replacementLength();
}
- if (const int attributeCount = e->attributes().size()) {
+ const auto attributes = e->attributes();
+ auto it = attributes.cbegin();
+ const auto end = attributes.cend();
+ if (it != end) {
d << ", attributes= {";
- for (int a = 0; a < attributeCount; ++a) {
- const QInputMethodEvent::Attribute &at = e->attributes().at(a);
- if (a)
- d << ',';
- d << "[type= " << at.type << ", start=" << at.start << ", length=" << at.length
- << ", value=" << at.value << ']';
- }
+ d << *it;
+ ++it;
+ for (; it != end; ++it)
+ d << ',' << *it;
d << '}';
}
d << ')';
@@ -3812,13 +3962,13 @@ static void formatDropEvent(QDebug d, const QDropEvent *e)
d << ", possibleActions=";
QtDebugUtils::formatQFlags(d, e->possibleActions());
d << ", posF=";
- QtDebugUtils::formatQPoint(d, e->posF());
+ QtDebugUtils::formatQPoint(d, e->position());
if (type == QEvent::DragMove || type == QEvent::DragEnter)
d << ", answerRect=" << static_cast<const QDragMoveEvent *>(e)->answerRect();
d << ", formats=" << e->mimeData()->formats();
- QtDebugUtils::formatNonNullQFlags(d, ", keyboardModifiers=", e->keyboardModifiers());
+ QtDebugUtils::formatNonNullQFlags(d, ", keyboardModifiers=", e->modifiers());
d << ", ";
- QtDebugUtils::formatQFlags(d, e->mouseButtons());
+ QtDebugUtils::formatQFlags(d, e->buttons());
}
# endif // QT_CONFIG(draganddrop)
@@ -3831,45 +3981,61 @@ static void formatTabletEvent(QDebug d, const QTabletEvent *e)
d << eventClassName(type) << '(';
QtDebugUtils::formatQEnum(d, type);
- d << ", device=";
- QtDebugUtils::formatQEnum(d, e->device());
- d << ", pointerType=";
- QtDebugUtils::formatQEnum(d, e->pointerType());
- d << ", uniqueId=" << e->uniqueId()
- << ", pos=" << e->posF()
- << ", z=" << e->z()
- << ", xTilt=" << e->xTilt()
- << ", yTilt=" << e->yTilt()
- << ", ";
+ d << ' ';
QtDebugUtils::formatQFlags(d, e->buttons());
+ d << " pos=";
+ QtDebugUtils::formatQPoint(d, e->position());
+ d << " z=" << e->z()
+ << " xTilt=" << e->xTilt()
+ << " yTilt=" << e->yTilt();
if (type == QEvent::TabletPress || type == QEvent::TabletMove)
- d << ", pressure=" << e->pressure();
- if (e->device() == QTabletEvent::RotationStylus || e->device() == QTabletEvent::FourDMouse)
- d << ", rotation=" << e->rotation();
- if (e->device() == QTabletEvent::Airbrush)
- d << ", tangentialPressure=" << e->tangentialPressure();
+ d << " pressure=" << e->pressure();
+ if (e->device()->hasCapability(QInputDevice::Capability::Rotation))
+ d << " rotation=" << e->rotation();
+ if (e->deviceType() == QInputDevice::DeviceType::Airbrush)
+ d << " tangentialPressure=" << e->tangentialPressure();
+ d << " dev=" << e->device() << ')';
}
# endif // QT_CONFIG(tabletevent)
-QDebug operator<<(QDebug dbg, const QTouchEvent::TouchPoint &tp)
+QDebug operator<<(QDebug dbg, const QEventPoint *tp)
+{
+ if (!tp) {
+ dbg << "QEventPoint(0x0)";
+ return dbg;
+ }
+ return operator<<(dbg, *tp);
+}
+
+QDebug operator<<(QDebug dbg, const QEventPoint &tp)
{
QDebugStateSaver saver(dbg);
dbg.nospace();
- dbg << "TouchPoint(" << Qt::hex << tp.id() << Qt::dec << " (";
- QtDebugUtils::formatQPoint(dbg, tp.pos());
- dbg << ") ";
+ dbg << "QEventPoint(id=" << tp.id() << " ts=" << tp.timestamp();
+ dbg << " pos=";
+ QtDebugUtils::formatQPoint(dbg, tp.position());
+ dbg << " scn=";
+ QtDebugUtils::formatQPoint(dbg, tp.scenePosition());
+ dbg << " gbl=";
+ QtDebugUtils::formatQPoint(dbg, tp.globalPosition());
+ dbg << ' ';
QtDebugUtils::formatQEnum(dbg, tp.state());
- dbg << " pressure " << tp.pressure() << " ellipse ("
- << tp.ellipseDiameters().width() << " x " << tp.ellipseDiameters().height()
- << " angle " << tp.rotation() << ") vel (";
+ if (!qFuzzyIsNull(tp.pressure()) && !qFuzzyCompare(tp.pressure(), 1))
+ dbg << " pressure=" << tp.pressure();
+ if (!tp.ellipseDiameters().isEmpty() || !qFuzzyIsNull(tp.rotation())) {
+ dbg << " ellipse=("
+ << tp.ellipseDiameters().width() << "x" << tp.ellipseDiameters().height()
+ << " \u2221 " << tp.rotation() << ')';
+ }
+ dbg << " vel=";
QtDebugUtils::formatQPoint(dbg, tp.velocity().toPointF());
- dbg << ") start (";
- QtDebugUtils::formatQPoint(dbg, tp.startPos());
- dbg << ") last (";
- QtDebugUtils::formatQPoint(dbg, tp.lastPos());
- dbg << ") delta (";
- QtDebugUtils::formatQPoint(dbg, tp.pos() - tp.lastPos());
+ dbg << " press=";
+ QtDebugUtils::formatQPoint(dbg, tp.pressPosition());
+ dbg << " last=";
+ QtDebugUtils::formatQPoint(dbg, tp.lastPosition());
+ dbg << " \u0394 ";
+ QtDebugUtils::formatQPoint(dbg, tp.position() - tp.lastPosition());
dbg << ')';
return dbg;
}
@@ -3884,9 +4050,10 @@ QDebug operator<<(QDebug dbg, const QEvent *e)
}
// More useful event output could be added here
const QEvent::Type type = e->type();
+ bool isMouse = false;
switch (type) {
case QEvent::Expose:
- dbg << "QExposeEvent(" << static_cast<const QExposeEvent *>(e)->region() << ')';
+ dbg << "QExposeEvent()";
break;
case QEvent::Paint:
dbg << "QPaintEvent(" << static_cast<const QPaintEvent *>(e)->region() << ')';
@@ -3899,43 +4066,50 @@ QDebug operator<<(QDebug dbg, const QEvent *e)
case QEvent::NonClientAreaMouseMove:
case QEvent::NonClientAreaMouseButtonRelease:
case QEvent::NonClientAreaMouseButtonDblClick:
+ isMouse = true;
+ Q_FALLTHROUGH();
+ case QEvent::HoverEnter:
+ case QEvent::HoverMove:
+ case QEvent::HoverLeave:
{
- const QMouseEvent *me = static_cast<const QMouseEvent*>(e);
- const Qt::MouseButton button = me->button();
- const Qt::MouseButtons buttons = me->buttons();
- dbg << "QMouseEvent(";
+ const QSinglePointEvent *spe = static_cast<const QSinglePointEvent*>(e);
+ const Qt::MouseButton button = spe->button();
+ const Qt::MouseButtons buttons = spe->buttons();
+ dbg << eventClassName(type) << '(';
QtDebugUtils::formatQEnum(dbg, type);
- if (type != QEvent::MouseMove && type != QEvent::NonClientAreaMouseMove) {
- dbg << ", ";
- QtDebugUtils::formatQEnum(dbg, button);
+ if (isMouse) {
+ if (type != QEvent::MouseMove && type != QEvent::NonClientAreaMouseMove) {
+ dbg << ' ';
+ QtDebugUtils::formatQEnum(dbg, button);
+ }
+ if (buttons && button != buttons) {
+ dbg << " btns=";
+ QtDebugUtils::formatQFlags(dbg, buttons);
+ }
}
- if (buttons && button != buttons) {
- dbg << ", buttons=";
- QtDebugUtils::formatQFlags(dbg, buttons);
+ QtDebugUtils::formatNonNullQFlags(dbg, ", ", spe->modifiers());
+ dbg << " pos=";
+ QtDebugUtils::formatQPoint(dbg, spe->position());
+ dbg << " scn=";
+ QtDebugUtils::formatQPoint(dbg, spe->scenePosition());
+ dbg << " gbl=";
+ QtDebugUtils::formatQPoint(dbg, spe->globalPosition());
+ dbg << " dev=" << spe->device() << ')';
+ if (isMouse) {
+ auto src = static_cast<const QMouseEvent*>(e)->source();
+ if (src != Qt::MouseEventNotSynthesized) {
+ dbg << " source=";
+ QtDebugUtils::formatQEnum(dbg, src);
+ }
}
- QtDebugUtils::formatNonNullQFlags(dbg, ", ", me->modifiers());
- dbg << ", localPos=";
- QtDebugUtils::formatQPoint(dbg, me->localPos());
- dbg << ", screenPos=";
- QtDebugUtils::formatQPoint(dbg, me->screenPos());
- QtDebugUtils::formatNonNullQEnum(dbg, ", ", me->source());
- QtDebugUtils::formatNonNullQFlags(dbg, ", flags=", me->flags());
- dbg << ')';
}
break;
# if QT_CONFIG(wheelevent)
case QEvent::Wheel: {
const QWheelEvent *we = static_cast<const QWheelEvent *>(e);
dbg << "QWheelEvent(" << we->phase();
-QT_WARNING_PUSH
-QT_WARNING_DISABLE_DEPRECATED // delta() and orientation()
if (!we->pixelDelta().isNull() || !we->angleDelta().isNull())
dbg << ", pixelDelta=" << we->pixelDelta() << ", angleDelta=" << we->angleDelta();
-#if QT_DEPRECATED_SINCE(5, 14)
- else if (int qt4Delta = we->delta())
- dbg << ", delta=" << qt4Delta << ", orientation=" << we->orientation();
-#endif
-QT_WARNING_POP
dbg << ')';
}
break;
@@ -3954,6 +4128,10 @@ QT_WARNING_POP
dbg << ", text=" << ke->text();
if (ke->isAutoRepeat())
dbg << ", autorepeat, count=" << ke->count();
+ if (dbg.verbosity() > QDebug::DefaultVerbosity) {
+ dbg << ", nativeScanCode=" << ke->nativeScanCode();
+ dbg << ", nativeVirtualKey=" << ke->nativeVirtualKey();
+ }
dbg << ')';
}
break;
@@ -4024,9 +4202,15 @@ QT_WARNING_POP
const QNativeGestureEvent *ne = static_cast<const QNativeGestureEvent *>(e);
dbg << "QNativeGestureEvent(";
QtDebugUtils::formatQEnum(dbg, ne->gestureType());
- dbg << ", localPos=";
- QtDebugUtils::formatQPoint(dbg, ne->localPos());
- dbg << ", value=" << ne->value() << ')';
+ dbg << ", fingerCount=" << ne->fingerCount() << ", localPos=";
+ QtDebugUtils::formatQPoint(dbg, ne->position());
+ if (!qIsNull(ne->value()))
+ dbg << ", value=" << ne->value();
+ if (!ne->delta().isNull()) {
+ dbg << ", delta=";
+ QtDebugUtils::formatQPoint(dbg, ne->delta());
+ }
+ dbg << ')';
}
break;
# endif // !QT_NO_GESTURES
@@ -4050,7 +4234,7 @@ QT_WARNING_POP
break;
# endif // QT_CONFIG(tabletevent)
case QEvent::Enter:
- dbg << "QEnterEvent(" << static_cast<const QEnterEvent *>(e)->pos() << ')';
+ dbg << "QEnterEvent(" << static_cast<const QEnterEvent *>(e)->position() << ')';
break;
case QEvent::Timer:
dbg << "QTimerEvent(id=" << static_cast<const QTimerEvent *>(e)->timerId() << ')';
@@ -4114,6 +4298,8 @@ QT_WARNING_POP
/*!
\fn int QShortcutEvent::shortcutId() const
+ \deprecated
+
Returns the ID of the QShortcut object for which this event was
generated.
@@ -4145,8 +4331,8 @@ QT_WARNING_POP
/*! \internal
*/
-QWindowStateChangeEvent::QWindowStateChangeEvent(Qt::WindowStates s, bool isOverride)
- : QEvent(WindowStateChange), ostate(s), m_override(isOverride)
+QWindowStateChangeEvent::QWindowStateChangeEvent(Qt::WindowStates oldState, bool isOverride)
+ : QEvent(WindowStateChange), m_oldStates(oldState), m_override(isOverride)
{
}
@@ -4157,11 +4343,7 @@ bool QWindowStateChangeEvent::isOverride() const
return m_override;
}
-/*! \internal
-*/
-QWindowStateChangeEvent::~QWindowStateChangeEvent()
-{
-}
+Q_IMPL_EVENT_COMMON(QWindowStateChangeEvent)
/*!
@@ -4207,15 +4389,18 @@ QWindowStateChangeEvent::~QWindowStateChangeEvent()
gestures. Whenever such a decision is made (the gesture is recognized), the clients will be
notified with a QEvent::TouchCancel event so they can update their state accordingly.
- The touchPoints() function returns a list of all touch points contained in the event. Note that
- this list may be empty, for example in case of a QEvent::TouchCancel event. Information about
- each touch point can be retrieved using the QTouchEvent::TouchPoint class. The
- Qt::TouchPointState enum describes the different states that a touch point may have.
+ The pointCount() and point() functions can be used to access and iterate individual
+ touch points.
+
+ The points() function returns a list of all touch points contained in the event.
+ Note that this list may be empty, for example in case of a QEvent::TouchCancel event.
+ Each point is an instance of the QEventPoint class. The QEventPoint::State enum
+ describes the different states that a touch point may have.
- \note The list of touchPoints() will never be partial: A touch event will always contain a touch
- point for each existing physical touch contacts targetting the window or widget to which the
+ \note The list of points() will never be partial: A touch event will always contain a touch
+ point for each existing physical touch contacts targeting the window or widget to which the
event is sent. For instance, assuming that all touches target the same window or widget, an
- event with a condition of touchPoints().count()==2 is guaranteed to imply that the number of
+ event with a condition of points().count()==2 is guaranteed to imply that the number of
fingers touching the touchscreen or touchpad is exactly two.
\section1 Event Delivery and Propagation
@@ -4288,690 +4473,95 @@ QWindowStateChangeEvent::~QWindowStateChangeEvent()
\endlist
- \sa QTouchEvent::TouchPoint, Qt::TouchPointState, Qt::WA_AcceptTouchEvents,
+ \sa QEventPoint, QEventPoint::State, Qt::WA_AcceptTouchEvents,
QGraphicsItem::acceptTouchEvents()
*/
/*!
- Constructs a QTouchEvent with the given \a eventType, \a device, and
- \a touchPoints. The \a touchPointStates and \a modifiers
- are the current touch point states and keyboard modifiers at the time of
- the event.
+ Constructs a QTouchEvent with the given \a eventType, \a device,
+ \a touchPoints, and current keyboard \a modifiers at the time of the event.
*/
+
QTouchEvent::QTouchEvent(QEvent::Type eventType,
- QTouchDevice *device,
+ const QPointingDevice *device,
Qt::KeyboardModifiers modifiers,
- Qt::TouchPointStates touchPointStates,
- const QList<QTouchEvent::TouchPoint> &touchPoints)
- : QInputEvent(eventType, modifiers),
- _window(nullptr),
- _target(nullptr),
- _device(device),
- _touchPointStates(touchPointStates),
- _touchPoints(touchPoints)
-{ }
-
-/*!
- Destroys the QTouchEvent.
-*/
-QTouchEvent::~QTouchEvent()
-{ }
-
-/*! \fn QWindow *QTouchEvent::window() const
-
- Returns the window on which the event occurred. Useful for doing
- global-local mapping on data like rawScreenPositions() which,
- for performance reasons, only stores the global positions in the
- touch event.
-*/
-
-/*! \fn QObject *QTouchEvent::target() const
-
- Returns the target object within the window on which the event occurred.
- This is typically a QWidget or a QQuickItem. May be 0 when no specific target is available.
-*/
-
-/*! \fn QTouchEvent::TouchPoint::TouchPoint(TouchPoint &&other)
-
- Move-constructs a TouchPoint instance, making it point to the same
- object that \a other was pointing to.
-*/
-
-/*! \fn Qt::TouchPointStates QTouchEvent::touchPointStates() const
-
- Returns a bitwise OR of all the touch point states for this event.
-*/
-
-/*! \fn const QList<QTouchEvent::TouchPoint> &QTouchEvent::touchPoints() const
-
- Returns the list of touch points contained in the touch event.
-*/
-
-/*! \fn QTouchDevice* QTouchEvent::device() const
-
- Returns the touch device from which this touch event originates.
-*/
-
-/*! \fn void QTouchEvent::setWindow(QWindow *window)
-
- \internal
-
- Sets the window for this event.
-*/
-
-/*! \fn void QTouchEvent::setTarget(QObject *target)
-
- \internal
-
- Sets the target within the window (typically a widget) for this event.
-*/
-
-/*! \fn void QTouchEvent::setTouchPointStates(Qt::TouchPointStates touchPointStates)
-
- \internal
-
- Sets a bitwise OR of all the touch point states for this event.
-*/
-
-/*! \fn void QTouchEvent::setTouchPoints(const QList<QTouchEvent::TouchPoint> &touchPoints)
-
- \internal
-
- Sets the list of touch points for this event.
-*/
-
-/*! \fn void QTouchEvent::setDevice(QTouchDevice *adevice)
-
- \internal
-
- Sets the device to \a adevice.
-*/
-
-/*! \class QTouchEvent::TouchPoint
- \brief The TouchPoint class provides information about a touch point in a QTouchEvent.
- \since 4.6
- \inmodule QtGui
-
- \image touchpoint-metrics.png
-*/
-
-/*! \enum TouchPoint::InfoFlag
-
- The values of this enum describe additional information about a touch point.
-
- \value Pen Indicates that the contact has been made by a designated pointing device (e.g. a pen) instead of a finger.
- \value Token Indicates that the contact has been made by a fiducial object (e.g. a knob or other token) instead of a finger.
-*/
-
-/*!
- \internal
-
- Constructs a QTouchEvent::TouchPoint for use in a QTouchEvent.
-*/
-QTouchEvent::TouchPoint::TouchPoint(int id)
- : d(new QTouchEventTouchPointPrivate(id))
-{ }
-
-/*!
- \fn QTouchEvent::TouchPoint::TouchPoint(const QTouchEvent::TouchPoint &other)
- \internal
-
- Constructs a copy of \a other.
-*/
-QTouchEvent::TouchPoint::TouchPoint(const QTouchEvent::TouchPoint &other)
- : d(other.d)
+ const QList<QEventPoint> &touchPoints)
+ : QPointerEvent(eventType, device, modifiers, touchPoints),
+ m_target(nullptr)
{
- d->ref.ref();
-}
-
-/*!
- \internal
-
- Destroys the QTouchEvent::TouchPoint.
-*/
-QTouchEvent::TouchPoint::~TouchPoint()
-{
- if (d && !d->ref.deref())
- delete d;
-}
-
-/*!
- Returns the id number of this touch point.
-
- Do not assume that id numbers start at zero or that they are sequential.
- Such an assumption is often false due to the way the underlying drivers work.
-*/
-int QTouchEvent::TouchPoint::id() const
-{
- return d->id;
-}
-
-/*!
- \since 5.8
- Returns the unique ID of this touch point or token, if any.
-
- It is normally invalid (see \l {QPointingDeviceUniqueId::isValid()} {isValid()}),
- because touchscreens cannot uniquely identify fingers. But when the
- \l {TouchPoint::InfoFlag} {Token} flag is set, it is expected to uniquely
- identify a specific token (fiducial object).
-
- \sa flags
-*/
-QPointingDeviceUniqueId QTouchEvent::TouchPoint::uniqueId() const
-{
- return d->uniqueId;
-}
-
-/*!
- Returns the current state of this touch point.
-*/
-Qt::TouchPointState QTouchEvent::TouchPoint::state() const
-{
- return Qt::TouchPointState(int(d->state));
-}
-
-/*!
- Returns the position of this touch point, relative to the widget
- or QGraphicsItem that received the event.
-
- \sa startPos(), lastPos(), screenPos(), scenePos(), normalizedPos()
-*/
-QPointF QTouchEvent::TouchPoint::pos() const
-{
- return d->pos;
-}
-
-/*!
- Returns the scene position of this touch point.
-
- The scene position is the position in QGraphicsScene coordinates
- if the QTouchEvent is handled by a QGraphicsItem::touchEvent()
- reimplementation, and identical to the screen position for
- widgets.
-
- \sa startScenePos(), lastScenePos(), pos()
-*/
-QPointF QTouchEvent::TouchPoint::scenePos() const
-{
- return d->scenePos;
-}
-
-/*!
- Returns the screen position of this touch point.
-
- \sa startScreenPos(), lastScreenPos(), pos()
-*/
-QPointF QTouchEvent::TouchPoint::screenPos() const
-{
- return d->screenPos;
-}
-
-/*!
- Returns the normalized position of this touch point.
-
- The coordinates are normalized to the size of the touch device,
- i.e. (0,0) is the top-left corner and (1,1) is the bottom-right corner.
-
- \sa startNormalizedPos(), lastNormalizedPos(), pos()
-*/
-QPointF QTouchEvent::TouchPoint::normalizedPos() const
-{
- return d->normalizedPos;
-}
-
-/*!
- Returns the starting position of this touch point, relative to the
- widget or QGraphicsItem that received the event.
-
- \sa pos(), lastPos()
-*/
-QPointF QTouchEvent::TouchPoint::startPos() const
-{
- return d->startPos;
-}
-
-/*!
- Returns the starting scene position of this touch point.
-
- The scene position is the position in QGraphicsScene coordinates
- if the QTouchEvent is handled by a QGraphicsItem::touchEvent()
- reimplementation, and identical to the screen position for
- widgets.
-
- \sa scenePos(), lastScenePos()
-*/
-QPointF QTouchEvent::TouchPoint::startScenePos() const
-{
- return d->startScenePos;
-}
-
-/*!
- Returns the starting screen position of this touch point.
-
- \sa screenPos(), lastScreenPos()
-*/
-QPointF QTouchEvent::TouchPoint::startScreenPos() const
-{
- return d->startScreenPos;
-}
-
-/*!
- Returns the normalized starting position of this touch point.
-
- The coordinates are normalized to the size of the touch device,
- i.e. (0,0) is the top-left corner and (1,1) is the bottom-right corner.
-
- \sa normalizedPos(), lastNormalizedPos()
-*/
-QPointF QTouchEvent::TouchPoint::startNormalizedPos() const
-{
- return d->startNormalizedPos;
-}
-
-/*!
- Returns the position of this touch point from the previous touch
- event, relative to the widget or QGraphicsItem that received the event.
-
- \sa pos(), startPos()
-*/
-QPointF QTouchEvent::TouchPoint::lastPos() const
-{
- return d->lastPos;
-}
-
-/*!
- Returns the scene position of this touch point from the previous
- touch event.
-
- The scene position is the position in QGraphicsScene coordinates
- if the QTouchEvent is handled by a QGraphicsItem::touchEvent()
- reimplementation, and identical to the screen position for
- widgets.
-
- \sa scenePos(), startScenePos()
-*/
-QPointF QTouchEvent::TouchPoint::lastScenePos() const
-{
- return d->lastScenePos;
-}
-
-/*!
- Returns the screen position of this touch point from the previous
- touch event.
-
- \sa screenPos(), startScreenPos()
-*/
-QPointF QTouchEvent::TouchPoint::lastScreenPos() const
-{
- return d->lastScreenPos;
-}
-
-/*!
- Returns the normalized position of this touch point from the
- previous touch event.
-
- The coordinates are normalized to the size of the touch device,
- i.e. (0,0) is the top-left corner and (1,1) is the bottom-right corner.
-
- \sa normalizedPos(), startNormalizedPos()
-*/
-QPointF QTouchEvent::TouchPoint::lastNormalizedPos() const
-{
- return d->lastNormalizedPos;
-}
-
-/*!
- Returns the rect for this touch point, relative to the widget
- or QGraphicsItem that received the event. The rect is centered
- around the point returned by pos().
-
- \note This function returns an empty rect if the device does not report touch point sizes.
-
- \obsolete This function is deprecated in 5.9 because it returns the outer bounds
- of the touchpoint regardless of rotation, whereas a touchpoint is more correctly
- modeled as an ellipse at position pos() with ellipseDiameters()
- which are independent of rotation().
-
- \sa scenePos(), ellipseDiameters()
-*/
-QRectF QTouchEvent::TouchPoint::rect() const
-{
- QRectF ret(QPointF(), d->ellipseDiameters);
- ret.moveCenter(d->pos);
- return ret;
-}
-
-/*!
- Returns the rect for this touch point in scene coordinates.
-
- \note This function returns an empty rect if the device does not report touch point sizes.
-
- \obsolete This function is deprecated in 5.9 because it returns the outer bounds
- of the touchpoint regardless of rotation, whereas a touchpoint is more correctly
- modeled as an ellipse at position scenePos() with ellipseDiameters()
- which are independent of rotation().
-
- \sa scenePos(), ellipseDiameters()
-*/
-QRectF QTouchEvent::TouchPoint::sceneRect() const
-{
- QRectF ret(QPointF(), d->ellipseDiameters);
- ret.moveCenter(d->scenePos);
- return ret;
+ for (QEventPoint &point : m_points) {
+ m_touchPointStates |= point.state();
+ QMutableEventPoint::setDevice(point, device);
+ }
}
+#if QT_DEPRECATED_SINCE(6, 0)
/*!
- Returns the rect for this touch point in screen coordinates.
-
- \note This function returns an empty rect if the device does not report touch point sizes.
+ \deprecated [6.0] Use another constructor.
- \obsolete This function is deprecated because it returns the outer bounds of the
- touchpoint regardless of rotation, whereas a touchpoint is more correctly
- modeled as an ellipse at position screenPos() with ellipseDiameters()
- which are independent of rotation().
-
- \sa screenPos(), ellipseDiameters()
+ Constructs a QTouchEvent with the given \a eventType, \a device, and
+ \a touchPoints. The \a touchPointStates and \a modifiers are the current
+ touch point states and keyboard modifiers at the time of the event.
*/
-QRectF QTouchEvent::TouchPoint::screenRect() const
+QTouchEvent::QTouchEvent(QEvent::Type eventType,
+ const QPointingDevice *device,
+ Qt::KeyboardModifiers modifiers,
+ QEventPoint::States touchPointStates,
+ const QList<QEventPoint> &touchPoints)
+ : QPointerEvent(eventType, device, modifiers, touchPoints),
+ m_target(nullptr),
+ m_touchPointStates(touchPointStates)
{
- QRectF ret(QPointF(), d->ellipseDiameters);
- ret.moveCenter(d->screenPos);
- return ret;
+ for (QEventPoint &point : m_points)
+ QMutableEventPoint::setDevice(point, device);
}
+#endif // QT_DEPRECATED_SINCE(6, 0)
-/*!
- Returns the pressure of this touch point. The return value is in
- the range 0.0 to 1.0.
-*/
-qreal QTouchEvent::TouchPoint::pressure() const
-{
- return d->pressure;
-}
+Q_IMPL_POINTER_EVENT(QTouchEvent)
/*!
- \since 5.8
- Returns the angular orientation of this touch point. The return value is in degrees,
- where zero (the default) indicates the finger or token is pointing upwards,
- a negative angle means it's rotated to the left, and a positive angle means
- it's rotated to the right. Most touchscreens do not detect rotation, so
- zero is the most common value.
+ Returns true if this event includes at least one newly-pressed touchpoint.
*/
-qreal QTouchEvent::TouchPoint::rotation() const
+bool QTouchEvent::isBeginEvent() const
{
- return d->rotation;
+ return m_touchPointStates.testFlag(QEventPoint::State::Pressed);
}
/*!
- \since 5.9
- Returns the width and height of the bounding ellipse of this touch point.
- The return value is in logical pixels. Most touchscreens do not detect the
- shape of the contact point, so a null size is the most common value.
- In other cases the diameters may be nonzero and equal (the ellipse is
- approximated as a circle).
+ Returns true if this event does not include newly-pressed or newly-released
+ touchpoints.
*/
-QSizeF QTouchEvent::TouchPoint::ellipseDiameters() const
+bool QTouchEvent::isUpdateEvent() const
{
- return d->ellipseDiameters;
+ return !m_touchPointStates.testFlag(QEventPoint::State::Pressed) &&
+ !m_touchPointStates.testFlag(QEventPoint::State::Released);
}
/*!
- Returns a velocity vector for this touch point.
- The vector is in the screen's coordinate system, using pixels per seconds for the magnitude.
-
- \note The returned vector is only valid if the touch device's capabilities include QTouchDevice::Velocity.
-
- \sa QTouchDevice::capabilities(), device()
+ Returns true if this event includes at least one newly-released touchpoint.
*/
-QVector2D QTouchEvent::TouchPoint::velocity() const
-{
- return d->velocity;
-}
-
-/*!
- Returns additional information about the touch point.
-
- \sa QTouchEvent::TouchPoint::InfoFlags
- */
-QTouchEvent::TouchPoint::InfoFlags QTouchEvent::TouchPoint::flags() const
-{
- return d->flags;
-}
-
-/*!
- \since 5.0
- Returns the raw, unfiltered positions for the touch point. The positions are in native screen coordinates.
- To get local coordinates you can use mapFromGlobal() of the QWindow returned by QTouchEvent::window().
-
- \note Returns an empty vector if the touch device's capabilities do not include QTouchDevice::RawPositions.
-
- \note Native screen coordinates refer to the native orientation of the screen which, in case of
- mobile devices, is typically portrait. This means that on systems capable of screen orientation
- changes the positions in this list will not reflect the current orientation (unlike pos(),
- screenPos(), etc.) and will always be reported in the native orientation.
-
- \sa QTouchDevice::capabilities(), device(), window()
- */
-QVector<QPointF> QTouchEvent::TouchPoint::rawScreenPositions() const
-{
- return d->rawScreenPositions;
-}
-
-/*! \internal */
-void QTouchEvent::TouchPoint::setId(int id)
-{
- if (d->ref.loadRelaxed() != 1)
- d = d->detach();
- d->id = id;
-}
-
-/*! \internal */
-void QTouchEvent::TouchPoint::setUniqueId(qint64 uid)
-{
- if (d->ref.loadRelaxed() != 1)
- d = d->detach();
- d->uniqueId = QPointingDeviceUniqueId::fromNumericId(uid);
-}
-
-/*! \internal */
-void QTouchEvent::TouchPoint::setState(Qt::TouchPointStates state)
-{
- if (d->ref.loadRelaxed() != 1)
- d = d->detach();
- d->state = state;
-}
-
-/*! \internal */
-void QTouchEvent::TouchPoint::setPos(const QPointF &pos)
-{
- if (d->ref.loadRelaxed() != 1)
- d = d->detach();
- d->pos = pos;
-}
-
-/*! \internal */
-void QTouchEvent::TouchPoint::setScenePos(const QPointF &scenePos)
-{
- if (d->ref.loadRelaxed() != 1)
- d = d->detach();
- d->scenePos = scenePos;
-}
-
-/*! \internal */
-void QTouchEvent::TouchPoint::setScreenPos(const QPointF &screenPos)
-{
- if (d->ref.loadRelaxed() != 1)
- d = d->detach();
- d->screenPos = screenPos;
-}
-
-/*! \internal */
-void QTouchEvent::TouchPoint::setNormalizedPos(const QPointF &normalizedPos)
-{
- if (d->ref.loadRelaxed() != 1)
- d = d->detach();
- d->normalizedPos = normalizedPos;
-}
-
-/*! \internal */
-void QTouchEvent::TouchPoint::setStartPos(const QPointF &startPos)
+bool QTouchEvent::isEndEvent() const
{
- if (d->ref.loadRelaxed() != 1)
- d = d->detach();
- d->startPos = startPos;
+ return m_touchPointStates.testFlag(QEventPoint::State::Released);
}
-/*! \internal */
-void QTouchEvent::TouchPoint::setStartScenePos(const QPointF &startScenePos)
-{
- if (d->ref.loadRelaxed() != 1)
- d = d->detach();
- d->startScenePos = startScenePos;
-}
-
-/*! \internal */
-void QTouchEvent::TouchPoint::setStartScreenPos(const QPointF &startScreenPos)
-{
- if (d->ref.loadRelaxed() != 1)
- d = d->detach();
- d->startScreenPos = startScreenPos;
-}
-
-/*! \internal */
-void QTouchEvent::TouchPoint::setStartNormalizedPos(const QPointF &startNormalizedPos)
-{
- if (d->ref.loadRelaxed() != 1)
- d = d->detach();
- d->startNormalizedPos = startNormalizedPos;
-}
-
-/*! \internal */
-void QTouchEvent::TouchPoint::setLastPos(const QPointF &lastPos)
-{
- if (d->ref.loadRelaxed() != 1)
- d = d->detach();
- d->lastPos = lastPos;
-}
-
-/*! \internal */
-void QTouchEvent::TouchPoint::setLastScenePos(const QPointF &lastScenePos)
-{
- if (d->ref.loadRelaxed() != 1)
- d = d->detach();
- d->lastScenePos = lastScenePos;
-}
-
-/*! \internal */
-void QTouchEvent::TouchPoint::setLastScreenPos(const QPointF &lastScreenPos)
-{
- if (d->ref.loadRelaxed() != 1)
- d = d->detach();
- d->lastScreenPos = lastScreenPos;
-}
-
-/*! \internal */
-void QTouchEvent::TouchPoint::setLastNormalizedPos(const QPointF &lastNormalizedPos)
-{
- if (d->ref.loadRelaxed() != 1)
- d = d->detach();
- d->lastNormalizedPos = lastNormalizedPos;
-}
+/*! \fn QObject *QTouchEvent::target() const
-// ### remove the following 3 setRect functions and their usages soon
-/*! \internal
- \obsolete
+ Returns the target object within the window on which the event occurred.
+ This is typically a QWidget or a QQuickItem. May be 0 when no specific target is available.
*/
-void QTouchEvent::TouchPoint::setRect(const QRectF &rect)
-{
- if (d->ref.loadRelaxed() != 1)
- d = d->detach();
- d->pos = rect.center();
- d->ellipseDiameters = rect.size();
-}
-/*! \internal
- \obsolete
-*/
-void QTouchEvent::TouchPoint::setSceneRect(const QRectF &sceneRect)
-{
- if (d->ref.loadRelaxed() != 1)
- d = d->detach();
- d->scenePos = sceneRect.center();
- d->ellipseDiameters = sceneRect.size();
-}
+/*! \fn QEventPoint::States QTouchEvent::touchPointStates() const
-/*! \internal
- \obsolete
+ Returns a bitwise OR of all the touch point states for this event.
*/
-void QTouchEvent::TouchPoint::setScreenRect(const QRectF &screenRect)
-{
- if (d->ref.loadRelaxed() != 1)
- d = d->detach();
- d->screenPos = screenRect.center();
- d->ellipseDiameters = screenRect.size();
-}
-/*! \internal */
-void QTouchEvent::TouchPoint::setPressure(qreal pressure)
-{
- if (d->ref.loadRelaxed() != 1)
- d = d->detach();
- d->pressure = pressure;
-}
+/*! \fn const QList<QEventPoint> &QTouchEvent::touchPoints() const
+ \deprecated [6.0] Use points() instead.
-/*! \internal */
-void QTouchEvent::TouchPoint::setRotation(qreal angle)
-{
- if (d->ref.loadRelaxed() != 1)
- d = d->detach();
- d->rotation = angle;
-}
+ Returns a reference to the list of touch points contained in the touch event.
-/*! \internal */
-void QTouchEvent::TouchPoint::setEllipseDiameters(const QSizeF &dia)
-{
- if (d->ref.loadRelaxed() != 1)
- d = d->detach();
- d->ellipseDiameters = dia;
-}
-
-/*! \internal */
-void QTouchEvent::TouchPoint::setVelocity(const QVector2D &v)
-{
- if (d->ref.loadRelaxed() != 1)
- d = d->detach();
- d->velocity = v;
-}
-
-/*! \internal */
-void QTouchEvent::TouchPoint::setRawScreenPositions(const QVector<QPointF> &positions)
-{
- if (d->ref.loadRelaxed() != 1)
- d = d->detach();
- d->rawScreenPositions = positions;
-}
-
-/*!
- \internal
-*/
-void QTouchEvent::TouchPoint::setFlags(InfoFlags flags)
-{
- if (d->ref.loadRelaxed() != 1)
- d = d->detach();
- d->flags = flags;
-}
-
-/*!
- \fn QTouchEvent::TouchPoint &QTouchEvent::TouchPoint::operator=(const QTouchEvent::TouchPoint &other)
- \internal
- */
-
-/*!
- \fn QTouchEvent::TouchPoint &QTouchEvent::TouchPoint::operator=(QTouchEvent::TouchPoint &&other)
- \internal
- */
-/*!
- \fn void QTouchEvent::TouchPoint::swap(TouchPoint &other);
- \internal
+ \sa QPointerEvent::point(), QPointerEvent::pointCount()
*/
/*!
@@ -4986,8 +4576,8 @@ void QTouchEvent::TouchPoint::setFlags(InfoFlags flags)
The object receiving this event should set viewportSize, maxContentPos and contentPos.
It also should accept this event to indicate that scrolling should be started.
- It is not guaranteed that a QScrollEvent will be sent after an acceepted
- QScrollPrepareEvent, e.g. in a case where the maximum content position is (0,0).
+ It is not guaranteed that a QScrollEvent will be sent after an accepted
+ QScrollPrepareEvent, e.g. in a case where the maximum content position is (0, 0).
\sa QScrollEvent, QScroller
*/
@@ -4997,52 +4587,34 @@ void QTouchEvent::TouchPoint::setFlags(InfoFlags flags)
The \a startPos is the position of a touch or mouse event that started the scrolling.
*/
QScrollPrepareEvent::QScrollPrepareEvent(const QPointF &startPos)
- : QEvent(QEvent::ScrollPrepare), m_target(nullptr), m_startPos(startPos)
+ : QEvent(QEvent::ScrollPrepare), m_startPos(startPos)
{
- Q_UNUSED(m_target);
}
-/*!
- Destroys QScrollEvent.
-*/
-QScrollPrepareEvent::~QScrollPrepareEvent()
-{
-}
+Q_IMPL_EVENT_COMMON(QScrollPrepareEvent)
/*!
+ \fn QPointF QScrollPrepareEvent::startPos() const
+
Returns the position of the touch or mouse event that started the scrolling.
*/
-QPointF QScrollPrepareEvent::startPos() const
-{
- return m_startPos;
-}
/*!
+ \fn QSizeF QScrollPrepareEvent::viewportSize() const
Returns size of the area that is to be scrolled as set by setViewportSize
\sa setViewportSize()
*/
-QSizeF QScrollPrepareEvent::viewportSize() const
-{
- return m_viewportSize;
-}
/*!
+ \fn QRectF QScrollPrepareEvent::contentPosRange() const
Returns the range of coordinates for the content as set by setContentPosRange().
*/
-QRectF QScrollPrepareEvent::contentPosRange() const
-{
- return m_contentPosRange;
-}
/*!
+ \fn QPointF QScrollPrepareEvent::contentPos() const
Returns the current position of the content as set by setContentPos.
*/
-QPointF QScrollPrepareEvent::contentPos() const
-{
- return m_contentPos;
-}
-
/*!
Sets the size of the area that is to be scrolled to \a size.
@@ -5117,33 +4689,26 @@ QScrollEvent::QScrollEvent(const QPointF &contentPos, const QPointF &overshootDi
{
}
-/*!
- Destroys QScrollEvent.
-*/
-QScrollEvent::~QScrollEvent()
-{
-}
+Q_IMPL_EVENT_COMMON(QScrollEvent)
/*!
+ \fn QPointF QScrollEvent::contentPos() const
+
Returns the new scroll position.
*/
-QPointF QScrollEvent::contentPos() const
-{
- return m_contentPos;
-}
/*!
+ \fn QPointF QScrollEvent::overshootDistance() const
+
Returns the new overshoot distance.
See QScroller for an explanation of the term overshoot.
\sa QScroller
*/
-QPointF QScrollEvent::overshootDistance() const
-{
- return m_overshoot;
-}
/*!
+ \fn QScrollEvent::ScrollState QScrollEvent::scrollState() const
+
Returns the current scroll state as a combination of ScrollStateFlag values.
ScrollStarted (or ScrollFinished) will be set, if this scroll event is the first (or last) event in a scrolling activity.
Please note that both values can be set at the same time, if the activity consists of a single QScrollEvent.
@@ -5151,10 +4716,6 @@ QPointF QScrollEvent::overshootDistance() const
A widget could for example revert selections when scrolling is started and stopped.
*/
-QScrollEvent::ScrollState QScrollEvent::scrollState() const
-{
- return m_state;
-}
/*!
Creates a new QScreenOrientationChangeEvent
@@ -5165,28 +4726,19 @@ QScreenOrientationChangeEvent::QScreenOrientationChangeEvent(QScreen *screen, Qt
{
}
-/*!
- Destroys QScreenOrientationChangeEvent.
-*/
-QScreenOrientationChangeEvent::~QScreenOrientationChangeEvent()
-{
-}
+Q_IMPL_EVENT_COMMON(QScreenOrientationChangeEvent)
/*!
+ \fn QScreen *QScreenOrientationChangeEvent::screen() const
+
Returns the screen whose orientation changed.
*/
-QScreen *QScreenOrientationChangeEvent::screen() const
-{
- return m_screen;
-}
/*!
+ \fn Qt::ScreenOrientation QScreenOrientationChangeEvent::orientation() const
+
Returns the orientation of the screen.
*/
-Qt::ScreenOrientation QScreenOrientationChangeEvent::orientation() const
-{
- return m_orientation;
-}
/*!
Creates a new QApplicationStateChangeEvent.
@@ -5197,108 +4749,73 @@ QApplicationStateChangeEvent::QApplicationStateChangeEvent(Qt::ApplicationState
{
}
+Q_IMPL_EVENT_COMMON(QApplicationStateChangeEvent)
+
/*!
+ \fn Qt::ApplicationState QApplicationStateChangeEvent::applicationState() const
+
Returns the state of the application.
*/
-Qt::ApplicationState QApplicationStateChangeEvent::applicationState() const
-{
- return m_applicationState;
-}
/*!
- \class QPointingDeviceUniqueId
- \since 5.8
- \ingroup events
+ \class QChildWindowEvent
\inmodule QtGui
+ \since 6.7
+ \brief The QChildWindowEvent class contains event parameters for
+ child window changes.
- \brief QPointingDeviceUniqueId identifies a unique object, such as a tagged token
- or stylus, which is used with a pointing device.
-
- QPointingDeviceUniqueIds can be compared for equality, and can be used as keys in a QHash.
- You get access to the numerical ID via numericId(), if the device supports such IDs.
- For future extensions, though, you should not use that function, but compare objects
- of this type using the equality operator.
-
- This class is a thin wrapper around an integer ID. You pass it into and out of
- functions by value.
+ \ingroup events
- This type actively prevents you from holding it in a QList, because doing so would
- be very inefficient. Use a QVector instead, which has the same API as QList, but more
- efficient storage.
+ Child window events are sent to windows when children are
+ added or removed.
- \sa QTouchEvent::TouchPoint
+ In both cases you can only rely on the child being a QWindow
+ — not any subclass thereof. This is because in the
+ QEvent::ChildWindowAdded case the subclass is not yet fully
+ constructed, and in the QEvent::ChildWindowRemoved case it
+ might have already been destructed.
*/
/*!
- \fn QPointingDeviceUniqueId::QPointingDeviceUniqueId()
- Constructs an invalid unique pointer ID.
-*/
+ Constructs a child window event object of a particular \a type
+ for the \a childWindow.
-/*!
- Constructs a unique pointer ID from numeric ID \a id.
+ \a type can be QEvent::ChildWindowAdded or QEvent::ChildWindowRemoved.
+
+ \sa child()
*/
-QPointingDeviceUniqueId QPointingDeviceUniqueId::fromNumericId(qint64 id)
+QChildWindowEvent::QChildWindowEvent(Type type, QWindow *childWindow)
+ : QEvent(type), c(childWindow)
{
- QPointingDeviceUniqueId result;
- result.m_numericId = id;
- return result;
}
-/*!
- \fn bool QPointingDeviceUniqueId::isValid() const
-
- Returns whether this unique pointer ID is valid, that is, it represents an actual
- pointer.
-*/
+Q_IMPL_EVENT_COMMON(QChildWindowEvent)
/*!
- \property QPointingDeviceUniqueId::numericId
- \brief the numeric unique ID of the token represented by a touchpoint
+ \fn QWindow *QChildWindowEvent::child() const
- If the device provides a numeric ID, isValid() returns true, and this
- property provides the numeric ID;
- otherwise it is -1.
-
- You should not use the value of this property in portable code, but
- instead rely on equality to identify pointers.
-
- \sa isValid()
+ Returns the child window that was added or removed.
*/
-qint64 QPointingDeviceUniqueId::numericId() const noexcept
-{
- return m_numericId;
-}
-/*!
- \relates QPointingDeviceUniqueId
- \since 5.8
+QMutableTouchEvent::~QMutableTouchEvent()
+ = default;
- Returns whether the two unique pointer IDs \a lhs and \a rhs identify the same pointer
- (\c true) or not (\c false).
+/*! \internal
+ Add the given \a point.
*/
-bool operator==(QPointingDeviceUniqueId lhs, QPointingDeviceUniqueId rhs) noexcept
+void QMutableTouchEvent::addPoint(const QEventPoint &point)
{
- return lhs.numericId() == rhs.numericId();
+ m_points.append(point);
+ auto &added = m_points.last();
+ if (!added.device())
+ QMutableEventPoint::setDevice(added, pointingDevice());
+ m_touchPointStates |= point.state();
}
-/*!
- \fn bool operator!=(QPointingDeviceUniqueId lhs, QPointingDeviceUniqueId rhs)
- \relates QPointingDeviceUniqueId
- \since 5.8
-
- Returns whether the two unique pointer IDs \a lhs and \a rhs identify different pointers
- (\c true) or not (\c false).
-*/
-
-/*!
- \relates QPointingDeviceUniqueId
- \since 5.8
- Returns the hash value for \a key, using \a seed to seed the calculation.
-*/
-uint qHash(QPointingDeviceUniqueId key, uint seed) noexcept
-{
- return qHash(key.numericId(), seed);
-}
+QMutableSinglePointEvent::~QMutableSinglePointEvent()
+ = default;
QT_END_NAMESPACE
+
+#include "moc_qevent.cpp"
diff --git a/src/gui/kernel/qevent.h b/src/gui/kernel/qevent.h
index 6f3215652b..a24f0c471c 100644
--- a/src/gui/kernel/qevent.h
+++ b/src/gui/kernel/qevent.h
@@ -1,427 +1,476 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the QtGui module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2020 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#ifndef QEVENT_H
#define QEVENT_H
+#if 0
+#pragma qt_class(QtEvents)
+#endif
+
#include <QtGui/qtguiglobal.h>
-#include <QtGui/qwindowdefs.h>
-#include <QtGui/qregion.h>
+
+#include <QtCore/qcoreevent.h>
+#include <QtCore/qiodevice.h>
+#include <QtCore/qlist.h>
#include <QtCore/qnamespace.h>
#include <QtCore/qstring.h>
+#include <QtCore/qurl.h>
+#include <QtCore/qvariant.h>
+#include <QtGui/qeventpoint.h>
+#include <QtGui/qpointingdevice.h>
+#include <QtGui/qregion.h>
+#include <QtGui/qwindowdefs.h>
+
#if QT_CONFIG(shortcut)
# include <QtGui/qkeysequence.h>
#endif
-#include <QtCore/qcoreevent.h>
-#include <QtCore/qvariant.h>
-#include <QtCore/qmap.h> // ### Qt 6: Remove
-#include <QtCore/qvector.h>
-#include <QtCore/qset.h> // ### Qt 6: Remove
-#include <QtCore/qurl.h>
-#include <QtCore/qfile.h> // ### Qt 6: Replace by <QtCore/qiodevice.h> and forward declare QFile
-#include <QtGui/qvector2d.h>
-#include <QtGui/qtouchdevice.h> // ### Qt 6: Replace by forward declaration
-QT_BEGIN_NAMESPACE
+class tst_QEvent;
+QT_BEGIN_NAMESPACE
-class QGuiAction;
-#ifndef QT_NO_GESTURES
+class QFile;
+class QAction;
+class QMouseEvent;
+template <typename T> class QPointer;
+class QPointerEvent;
+class QScreen;
+#if QT_CONFIG(shortcut)
+class QShortcut;
+#endif
+class QTabletEvent;
+class QTouchEvent;
+#if QT_CONFIG(gestures)
class QGesture;
#endif
-class QScreen;
class Q_GUI_EXPORT QInputEvent : public QEvent
{
+ Q_DECL_EVENT_COMMON(QInputEvent)
public:
- explicit QInputEvent(Type type, Qt::KeyboardModifiers modifiers = Qt::NoModifier);
- ~QInputEvent();
- inline Qt::KeyboardModifiers modifiers() const { return modState; }
- inline void setModifiers(Qt::KeyboardModifiers amodifiers) { modState = amodifiers; }
- inline ulong timestamp() const { return ts; }
- inline void setTimestamp(ulong atimestamp) { ts = atimestamp; }
+ explicit QInputEvent(Type type, const QInputDevice *m_dev, Qt::KeyboardModifiers modifiers = Qt::NoModifier);
+
+ const QInputDevice *device() const { return m_dev; }
+ QInputDevice::DeviceType deviceType() const { return m_dev ? m_dev->type() : QInputDevice::DeviceType::Unknown; }
+ inline Qt::KeyboardModifiers modifiers() const { return m_modState; }
+ inline void setModifiers(Qt::KeyboardModifiers modifiers) { m_modState = modifiers; }
+ inline quint64 timestamp() const { return m_timeStamp; }
+ virtual void setTimestamp(quint64 timestamp) { m_timeStamp = timestamp; }
+
protected:
- Qt::KeyboardModifiers modState;
- ulong ts;
+ QInputEvent(Type type, PointerEventTag, const QInputDevice *dev, Qt::KeyboardModifiers modifiers = Qt::NoModifier);
+ QInputEvent(Type type, SinglePointEventTag, const QInputDevice *dev, Qt::KeyboardModifiers modifiers = Qt::NoModifier);
+
+ const QInputDevice *m_dev = nullptr;
+ quint64 m_timeStamp = 0;
+ Qt::KeyboardModifiers m_modState = Qt::NoModifier;
+ // fill up to the closest 8-byte aligned size: 48
+ quint32 m_reserved = 0;
};
-class Q_GUI_EXPORT QEnterEvent : public QEvent
+class Q_GUI_EXPORT QPointerEvent : public QInputEvent
{
+ Q_GADGET
+ Q_DECL_EVENT_COMMON(QPointerEvent)
public:
- QEnterEvent(const QPointF &localPos, const QPointF &windowPos, const QPointF &screenPos);
- ~QEnterEvent();
+ explicit QPointerEvent(Type type, const QPointingDevice *dev,
+ Qt::KeyboardModifiers modifiers = Qt::NoModifier, const QList<QEventPoint> &points = {});
-#ifndef QT_NO_INTEGER_EVENT_COORDINATES
- inline QPoint pos() const { return l.toPoint(); }
- inline QPoint globalPos() const { return s.toPoint(); }
- inline int x() const { return qRound(l.x()); }
- inline int y() const { return qRound(l.y()); }
- inline int globalX() const { return qRound(s.x()); }
- inline int globalY() const { return qRound(s.y()); }
-#endif
- const QPointF &localPos() const { return l; }
- const QPointF &windowPos() const { return w; }
- const QPointF &screenPos() const { return s; }
+ const QPointingDevice *pointingDevice() const;
+ QPointingDevice::PointerType pointerType() const {
+ return pointingDevice() ? pointingDevice()->pointerType() : QPointingDevice::PointerType::Unknown;
+ }
+ void setTimestamp(quint64 timestamp) override;
+ qsizetype pointCount() const { return m_points.size(); }
+ QEventPoint &point(qsizetype i);
+ const QList<QEventPoint> &points() const { return m_points; }
+ QEventPoint *pointById(int id);
+ bool allPointsGrabbed() const;
+ virtual bool isBeginEvent() const { return false; }
+ virtual bool isUpdateEvent() const { return false; }
+ virtual bool isEndEvent() const { return false; }
+ bool allPointsAccepted() const;
+ virtual void setAccepted(bool accepted) override;
+ QObject *exclusiveGrabber(const QEventPoint &point) const;
+ void setExclusiveGrabber(const QEventPoint &point, QObject *exclusiveGrabber);
+ QList<QPointer <QObject>> passiveGrabbers(const QEventPoint &point) const;
+ void clearPassiveGrabbers(const QEventPoint &point);
+ bool addPassiveGrabber(const QEventPoint &point, QObject *grabber);
+ bool removePassiveGrabber(const QEventPoint &point, QObject *grabber);
+
+protected:
+ QPointerEvent(Type type, SinglePointEventTag, const QInputDevice *dev, Qt::KeyboardModifiers modifiers = Qt::NoModifier);
+
+ QList<QEventPoint> m_points;
+};
+
+class Q_GUI_EXPORT QSinglePointEvent : public QPointerEvent
+{
+ Q_GADGET
+ Q_PROPERTY(QObject *exclusivePointGrabber READ exclusivePointGrabber
+ WRITE setExclusivePointGrabber)
+
+ Q_DECL_EVENT_COMMON(QSinglePointEvent)
+public:
+ inline Qt::MouseButton button() const { return m_button; }
+ inline Qt::MouseButtons buttons() const { return m_mouseState; }
+
+ inline QPointF position() const
+ { Q_ASSERT(!m_points.isEmpty()); return m_points.first().position(); }
+ inline QPointF scenePosition() const
+ { Q_ASSERT(!m_points.isEmpty()); return m_points.first().scenePosition(); }
+ inline QPointF globalPosition() const
+ { Q_ASSERT(!m_points.isEmpty()); return m_points.first().globalPosition(); }
+
+ bool isBeginEvent() const override;
+ bool isUpdateEvent() const override;
+ bool isEndEvent() const override;
+
+ QObject *exclusivePointGrabber() const
+ { return QPointerEvent::exclusiveGrabber(points().first()); }
+ void setExclusivePointGrabber(QObject *exclusiveGrabber)
+ { QPointerEvent::setExclusiveGrabber(points().first(), exclusiveGrabber); }
protected:
- QPointF l, w, s;
+ friend class ::tst_QEvent;
+ QSinglePointEvent(Type type, const QPointingDevice *dev, const QEventPoint &point,
+ Qt::MouseButton button, Qt::MouseButtons buttons,
+ Qt::KeyboardModifiers modifiers, Qt::MouseEventSource source);
+ QSinglePointEvent(Type type, const QPointingDevice *dev, const QPointF &localPos,
+ const QPointF &scenePos, const QPointF &globalPos,
+ Qt::MouseButton button, Qt::MouseButtons buttons,
+ Qt::KeyboardModifiers modifiers,
+ Qt::MouseEventSource source = Qt::MouseEventNotSynthesized);
+
+ Qt::MouseButton m_button = Qt::NoButton;
+ Qt::MouseButtons m_mouseState = Qt::NoButton;
+ Qt::MouseEventSource m_source;
+ /*
+ Fill up to the next 8-byte aligned size: 88
+ We have 32bits left, use some for QSinglePointEvent subclasses so that
+ we don't end up with gaps.
+ */
+ // split this in two quint16; with a quint32, MSVC would 32-bit align it
+ quint16 m_reserved;
+ quint16 m_reserved2 : 11;
+ // for QMouseEvent
+ quint16 m_doubleClick : 1;
+ // for QWheelEvent
+ quint16 m_phase : 3;
+ quint16 m_invertedScrolling : 1;
+};
+
+class Q_GUI_EXPORT QEnterEvent : public QSinglePointEvent
+{
+ Q_DECL_EVENT_COMMON(QEnterEvent)
+public:
+ QEnterEvent(const QPointF &localPos, const QPointF &scenePos, const QPointF &globalPos,
+ const QPointingDevice *device = QPointingDevice::primaryPointingDevice());
+
+#if QT_DEPRECATED_SINCE(6, 0)
+#ifndef QT_NO_INTEGER_EVENT_COORDINATES
+ QT_DEPRECATED_VERSION_X_6_0("Use position()")
+ inline QPoint pos() const { return position().toPoint(); }
+ QT_DEPRECATED_VERSION_X_6_0("Use globalPosition()")
+ inline QPoint globalPos() const { return globalPosition().toPoint(); }
+ QT_DEPRECATED_VERSION_X_6_0("Use position()")
+ inline int x() const { return qRound(position().x()); }
+ QT_DEPRECATED_VERSION_X_6_0("Use position()")
+ inline int y() const { return qRound(position().y()); }
+ QT_DEPRECATED_VERSION_X_6_0("Use globalPosition()")
+ inline int globalX() const { return qRound(globalPosition().x()); }
+ QT_DEPRECATED_VERSION_X_6_0("Use globalPosition()")
+ inline int globalY() const { return qRound(globalPosition().y()); }
+#endif
+ QT_DEPRECATED_VERSION_X_6_0("Use position()")
+ QPointF localPos() const { return position(); }
+ QT_DEPRECATED_VERSION_X_6_0("Use scenePosition()")
+ QPointF windowPos() const { return scenePosition(); }
+ QT_DEPRECATED_VERSION_X_6_0("Use globalPosition()")
+ QPointF screenPos() const { return globalPosition(); }
+#endif // QT_DEPRECATED_SINCE(6, 0)
};
-class Q_GUI_EXPORT QMouseEvent : public QInputEvent
+class Q_GUI_EXPORT QMouseEvent : public QSinglePointEvent
{
+ Q_DECL_EVENT_COMMON(QMouseEvent)
public:
+#if QT_DEPRECATED_SINCE(6, 4)
+ QT_DEPRECATED_VERSION_X_6_4("Use another constructor")
QMouseEvent(Type type, const QPointF &localPos, Qt::MouseButton button,
- Qt::MouseButtons buttons, Qt::KeyboardModifiers modifiers);
- QMouseEvent(Type type, const QPointF &localPos, const QPointF &screenPos,
+ Qt::MouseButtons buttons, Qt::KeyboardModifiers modifiers,
+ const QPointingDevice *device = QPointingDevice::primaryPointingDevice());
+#endif
+ QMouseEvent(Type type, const QPointF &localPos, const QPointF &globalPos,
Qt::MouseButton button, Qt::MouseButtons buttons,
- Qt::KeyboardModifiers modifiers);
- QMouseEvent(Type type, const QPointF &localPos, const QPointF &windowPos, const QPointF &screenPos,
+ Qt::KeyboardModifiers modifiers,
+ const QPointingDevice *device = QPointingDevice::primaryPointingDevice());
+ QMouseEvent(Type type, const QPointF &localPos, const QPointF &scenePos, const QPointF &globalPos,
Qt::MouseButton button, Qt::MouseButtons buttons,
- Qt::KeyboardModifiers modifiers);
- QMouseEvent(Type type, const QPointF &localPos, const QPointF &windowPos, const QPointF &screenPos,
+ Qt::KeyboardModifiers modifiers,
+ const QPointingDevice *device = QPointingDevice::primaryPointingDevice());
+ QMouseEvent(Type type, const QPointF &localPos, const QPointF &scenePos, const QPointF &globalPos,
Qt::MouseButton button, Qt::MouseButtons buttons,
- Qt::KeyboardModifiers modifiers, Qt::MouseEventSource source);
- ~QMouseEvent();
+ Qt::KeyboardModifiers modifiers, Qt::MouseEventSource source,
+ const QPointingDevice *device = QPointingDevice::primaryPointingDevice());
#ifndef QT_NO_INTEGER_EVENT_COORDINATES
- inline QPoint pos() const { return l.toPoint(); }
- inline QPoint globalPos() const { return s.toPoint(); }
- inline int x() const { return qRound(l.x()); }
- inline int y() const { return qRound(l.y()); }
- inline int globalX() const { return qRound(s.x()); }
- inline int globalY() const { return qRound(s.y()); }
+ inline QPoint pos() const { return position().toPoint(); }
#endif
- const QPointF &localPos() const { return l; }
- const QPointF &windowPos() const { return w; }
- const QPointF &screenPos() const { return s; }
-
- inline Qt::MouseButton button() const { return b; }
- inline Qt::MouseButtons buttons() const { return mouseState; }
-
- inline void setLocalPos(const QPointF &localPosition) { l = localPosition; }
-
-#if QT_DEPRECATED_SINCE(5, 0)
- QT_DEPRECATED inline QPointF posF() const { return l; }
-#endif
-
+#if QT_DEPRECATED_SINCE(6, 0)
+#ifndef QT_NO_INTEGER_EVENT_COORDINATES
+ QT_DEPRECATED_VERSION_X_6_0("Use globalPosition()")
+ inline QPoint globalPos() const { return globalPosition().toPoint(); }
+ QT_DEPRECATED_VERSION_X_6_0("Use position()")
+ inline int x() const { return qRound(position().x()); }
+ QT_DEPRECATED_VERSION_X_6_0("Use position()")
+ inline int y() const { return qRound(position().y()); }
+ QT_DEPRECATED_VERSION_X_6_0("Use globalPosition()")
+ inline int globalX() const { return qRound(globalPosition().x()); }
+ QT_DEPRECATED_VERSION_X_6_0("Use globalPosition()")
+ inline int globalY() const { return qRound(globalPosition().y()); }
+#endif // QT_NO_INTEGER_EVENT_COORDINATES
+ QT_DEPRECATED_VERSION_X_6_0("Use position()")
+ QPointF localPos() const { return position(); }
+ QT_DEPRECATED_VERSION_X_6_0("Use scenePosition()")
+ QPointF windowPos() const { return scenePosition(); }
+ QT_DEPRECATED_VERSION_X_6_0("Use globalPosition()")
+ QPointF screenPos() const { return globalPosition(); }
+#endif // QT_DEPRECATED_SINCE(6, 0)
Qt::MouseEventSource source() const;
Qt::MouseEventFlags flags() const;
-
-protected:
- QPointF l, w, s;
- Qt::MouseButton b;
- Qt::MouseButtons mouseState;
- int caps;
- QVector2D velocity;
-
- friend class QGuiApplicationPrivate;
};
-class Q_GUI_EXPORT QHoverEvent : public QInputEvent
+class Q_GUI_EXPORT QHoverEvent : public QSinglePointEvent
{
+ Q_DECL_EVENT_COMMON(QHoverEvent)
public:
- QHoverEvent(Type type, const QPointF &pos, const QPointF &oldPos, Qt::KeyboardModifiers modifiers = Qt::NoModifier);
- ~QHoverEvent();
+ QHoverEvent(Type type, const QPointF &scenePos, const QPointF &globalPos, const QPointF &oldPos,
+ Qt::KeyboardModifiers modifiers = Qt::NoModifier,
+ const QPointingDevice *device = QPointingDevice::primaryPointingDevice());
+#if QT_DEPRECATED_SINCE(6, 3)
+ QT_DEPRECATED_VERSION_X_6_3("Use the other constructor")
+ QHoverEvent(Type type, const QPointF &pos, const QPointF &oldPos,
+ Qt::KeyboardModifiers modifiers = Qt::NoModifier,
+ const QPointingDevice *device = QPointingDevice::primaryPointingDevice());
+#endif
+#if QT_DEPRECATED_SINCE(6, 0)
#ifndef QT_NO_INTEGER_EVENT_COORDINATES
- inline QPoint pos() const { return p.toPoint(); }
- inline QPoint oldPos() const { return op.toPoint(); }
+ QT_DEPRECATED_VERSION_X_6_0("Use position()")
+ inline QPoint pos() const { return position().toPoint(); }
#endif
- inline const QPointF &posF() const { return p; }
- inline const QPointF &oldPosF() const { return op; }
+ QT_DEPRECATED_VERSION_X_6_0("Use position()")
+ inline QPointF posF() const { return position(); }
+#endif // QT_DEPRECATED_SINCE(6, 0)
+
+ bool isUpdateEvent() const override { return true; }
+
+ // TODO deprecate when we figure out an actual replacement (point history?)
+ inline QPoint oldPos() const { return m_oldPos.toPoint(); }
+ inline QPointF oldPosF() const { return m_oldPos; }
protected:
- QPointF p, op;
+ QPointF m_oldPos; // TODO remove?
};
#if QT_CONFIG(wheelevent)
-class Q_GUI_EXPORT QWheelEvent : public QInputEvent
+class Q_GUI_EXPORT QWheelEvent : public QSinglePointEvent
{
+ Q_GADGET
+ Q_PROPERTY(const QPointingDevice *device READ pointingDevice)
+ Q_PROPERTY(QPoint pixelDelta READ pixelDelta)
+ Q_PROPERTY(QPoint angleDelta READ angleDelta)
+ Q_PROPERTY(Qt::ScrollPhase phase READ phase)
+ Q_PROPERTY(bool inverted READ inverted)
+
+ Q_DECL_EVENT_COMMON(QWheelEvent)
public:
enum { DefaultDeltasPerStep = 120 };
-#if QT_DEPRECATED_SINCE(5, 15)
- // Actually deprecated since 5.0, in docs
- QT_DEPRECATED_VERSION_X_5_15("Use the last QWheelEvent constructor taking pixelDelta, angleDelta, phase, and inverted")
- QWheelEvent(const QPointF &pos, int delta,
- Qt::MouseButtons buttons, Qt::KeyboardModifiers modifiers,
- Qt::Orientation orient = Qt::Vertical);
- // Actually deprecated since 5.0, in docs
- QT_DEPRECATED_VERSION_X_5_15("Use the last QWheelEvent constructor taking pixelDelta, angleDelta, phase, and inverted")
- QWheelEvent(const QPointF &pos, const QPointF& globalPos, int delta,
- Qt::MouseButtons buttons, Qt::KeyboardModifiers modifiers,
- Qt::Orientation orient = Qt::Vertical);
- QT_DEPRECATED_VERSION_X_5_15("Use the last QWheelEvent constructor taking pixelDelta, angleDelta, phase, and inverted")
- QWheelEvent(const QPointF &pos, const QPointF& globalPos,
- QPoint pixelDelta, QPoint angleDelta, int qt4Delta, Qt::Orientation qt4Orientation,
- Qt::MouseButtons buttons, Qt::KeyboardModifiers modifiers);
- QT_DEPRECATED_VERSION_X_5_15("Use the last QWheelEvent constructor taking pixelDelta, angleDelta, phase, and inverted")
- QWheelEvent(const QPointF &pos, const QPointF& globalPos,
- QPoint pixelDelta, QPoint angleDelta, int qt4Delta, Qt::Orientation qt4Orientation,
- Qt::MouseButtons buttons, Qt::KeyboardModifiers modifiers, Qt::ScrollPhase phase);
- QT_DEPRECATED_VERSION_X_5_15("Use the last QWheelEvent constructor taking pixelDelta, angleDelta, phase, and inverted")
- QWheelEvent(const QPointF &pos, const QPointF &globalPos, QPoint pixelDelta, QPoint angleDelta,
- int qt4Delta, Qt::Orientation qt4Orientation, Qt::MouseButtons buttons,
- Qt::KeyboardModifiers modifiers, Qt::ScrollPhase phase, Qt::MouseEventSource source);
- QT_DEPRECATED_VERSION_X_5_15("Use the last QWheelEvent constructor taking pixelDelta, angleDelta, phase, and inverted")
QWheelEvent(const QPointF &pos, const QPointF &globalPos, QPoint pixelDelta, QPoint angleDelta,
- int qt4Delta, Qt::Orientation qt4Orientation, Qt::MouseButtons buttons,
- Qt::KeyboardModifiers modifiers, Qt::ScrollPhase phase, Qt::MouseEventSource source, bool inverted);
-#endif
-
- QWheelEvent(QPointF pos, QPointF globalPos, QPoint pixelDelta, QPoint angleDelta,
Qt::MouseButtons buttons, Qt::KeyboardModifiers modifiers, Qt::ScrollPhase phase,
- bool inverted, Qt::MouseEventSource source = Qt::MouseEventNotSynthesized);
- ~QWheelEvent();
-
-
- inline QPoint pixelDelta() const { return pixelD; }
- inline QPoint angleDelta() const { return angleD; }
-
-#if QT_DEPRECATED_SINCE(5, 15)
- // Actually deprecated since 5.0, in docs
- QT_DEPRECATED_VERSION_X_5_15("Use angleDelta()")
- inline int delta() const { return qt4D; }
- // Actually deprecated since 5.0, in docs
- QT_DEPRECATED_VERSION_X_5_15("Use angleDelta()")
- inline Qt::Orientation orientation() const { return qt4O; }
-#ifndef QT_NO_INTEGER_EVENT_COORDINATES
- QT_DEPRECATED_VERSION_X_5_15("Use position()")
- inline QPoint pos() const { return p.toPoint(); }
- QT_DEPRECATED_VERSION_X_5_15("Use globalPosition()")
- inline QPoint globalPos() const { return g.toPoint(); }
- QT_DEPRECATED_VERSION_X_5_15("Use position()")
- inline int x() const { return int(p.x()); }
- QT_DEPRECATED_VERSION_X_5_15("Use position()")
- inline int y() const { return int(p.y()); }
- QT_DEPRECATED_VERSION_X_5_15("Use globalPosition()")
- inline int globalX() const { return int(g.x()); }
- QT_DEPRECATED_VERSION_X_5_15("Use globalPosition()")
- inline int globalY() const { return int(g.y()); }
-#endif
- QT_DEPRECATED_VERSION_X_5_15("Use position()")
- inline const QPointF &posF() const { return p; }
- QT_DEPRECATED_VERSION_X_5_15("Use globalPosition()")
- inline const QPointF &globalPosF() const { return g; }
-#endif // QT_DEPRECATED_SINCE(5, 15)
-
- inline QPointF position() const { return p; }
- inline QPointF globalPosition() const { return g; }
+ bool inverted, Qt::MouseEventSource source = Qt::MouseEventNotSynthesized,
+ const QPointingDevice *device = QPointingDevice::primaryPointingDevice());
- inline Qt::MouseButtons buttons() const { return mouseState; }
+ inline QPoint pixelDelta() const { return m_pixelDelta; }
+ inline QPoint angleDelta() const { return m_angleDelta; }
- inline Qt::ScrollPhase phase() const { return Qt::ScrollPhase(ph); }
- inline bool inverted() const { return invertedScrolling; }
+ inline Qt::ScrollPhase phase() const { return Qt::ScrollPhase(m_phase); }
+ inline bool inverted() const { return m_invertedScrolling; }
+ inline bool isInverted() const { return m_invertedScrolling; }
+ inline bool hasPixelDelta() const { return !m_pixelDelta.isNull(); }
- Qt::MouseEventSource source() const { return Qt::MouseEventSource(src); }
+ bool isBeginEvent() const override;
+ bool isUpdateEvent() const override;
+ bool isEndEvent() const override;
+ Qt::MouseEventSource source() const { return Qt::MouseEventSource(m_source); }
protected:
- QPointF p;
- QPointF g;
- QPoint pixelD;
- QPoint angleD;
- int qt4D = 0;
- Qt::Orientation qt4O = Qt::Vertical;
- Qt::MouseButtons mouseState = Qt::NoButton;
- uint _unused_ : 2; // Kept for binary compatibility
- uint src: 2;
- bool invertedScrolling : 1;
- uint ph : 3;
- int reserved : 24;
-
- friend class QApplication;
+ QPoint m_pixelDelta;
+ QPoint m_angleDelta;
};
#endif
#if QT_CONFIG(tabletevent)
-class Q_GUI_EXPORT QTabletEvent : public QInputEvent
+class Q_GUI_EXPORT QTabletEvent : public QSinglePointEvent
{
- Q_GADGET
+ Q_DECL_EVENT_COMMON(QTabletEvent)
public:
- enum TabletDevice { NoDevice, Puck, Stylus, Airbrush, FourDMouse,
- XFreeEraser /*internal*/, RotationStylus };
- Q_ENUM(TabletDevice)
- enum PointerType { UnknownPointer, Pen, Cursor, Eraser };
- Q_ENUM(PointerType)
- QTabletEvent(Type t, const QPointF &pos, const QPointF &globalPos,
- int device, int pointerType, qreal pressure, int xTilt, int yTilt,
- qreal tangentialPressure, qreal rotation, int z,
- Qt::KeyboardModifiers keyState, qint64 uniqueID); // ### remove in Qt 6
- QTabletEvent(Type t, const QPointF &pos, const QPointF &globalPos,
- int device, int pointerType, qreal pressure, int xTilt, int yTilt,
- qreal tangentialPressure, qreal rotation, int z,
- Qt::KeyboardModifiers keyState, qint64 uniqueID,
+ QTabletEvent(Type t, const QPointingDevice *device,
+ const QPointF &pos, const QPointF &globalPos,
+ qreal pressure, float xTilt, float yTilt,
+ float tangentialPressure, qreal rotation, float z,
+ Qt::KeyboardModifiers keyState,
Qt::MouseButton button, Qt::MouseButtons buttons);
- ~QTabletEvent();
- inline QPoint pos() const { return mPos.toPoint(); }
- inline QPoint globalPos() const { return mGPos.toPoint(); }
-#if QT_DEPRECATED_SINCE(5,0)
- QT_DEPRECATED inline const QPointF &hiResGlobalPos() const { return mPos; }
+#if QT_DEPRECATED_SINCE(6, 0)
+ QT_DEPRECATED_VERSION_X_6_0("Use position()")
+ inline QPoint pos() const { return position().toPoint(); }
+ QT_DEPRECATED_VERSION_X_6_0("Use globalPosition()")
+ inline QPoint globalPos() const { return globalPosition().toPoint(); }
+
+ QT_DEPRECATED_VERSION_X_6_0("Use position()")
+ inline const QPointF posF() const { return position(); }
+ QT_DEPRECATED_VERSION_X_6_0("Use globalPosition()")
+ inline const QPointF globalPosF() const { return globalPosition(); }
+ QT_DEPRECATED_VERSION_X_6_0("Use position().x()")
+ inline int x() const { return qRound(position().x()); }
+ QT_DEPRECATED_VERSION_X_6_0("Use position().y()")
+ inline int y() const { return qRound(position().y()); }
+ QT_DEPRECATED_VERSION_X_6_0("Use globalPosition().x()")
+ inline int globalX() const { return qRound(globalPosition().x()); }
+ QT_DEPRECATED_VERSION_X_6_0("Use globalPosition().y()")
+ inline int globalY() const { return qRound(globalPosition().y()); }
+ QT_DEPRECATED_VERSION_X_6_0("use globalPosition().x()")
+ inline qreal hiResGlobalX() const { return globalPosition().x(); }
+ QT_DEPRECATED_VERSION_X_6_0("use globalPosition().y()")
+ inline qreal hiResGlobalY() const { return globalPosition().y(); }
+ QT_DEPRECATED_VERSION_X_6_0("use pointingDevice().uniqueId()")
+ inline qint64 uniqueId() const { return pointingDevice() ? pointingDevice()->uniqueId().numericId() : -1; }
#endif
-
- inline const QPointF &posF() const { return mPos; }
- inline const QPointF &globalPosF() const { return mGPos; }
-
- inline int x() const { return qRound(mPos.x()); }
- inline int y() const { return qRound(mPos.y()); }
- inline int globalX() const { return qRound(mGPos.x()); }
- inline int globalY() const { return qRound(mGPos.y()); }
- inline qreal hiResGlobalX() const { return mGPos.x(); }
- inline qreal hiResGlobalY() const { return mGPos.y(); }
- inline TabletDevice device() const { return TabletDevice(mDev); }
- inline PointerType pointerType() const { return PointerType(mPointerType); }
- inline qint64 uniqueId() const { return mUnique; }
- inline qreal pressure() const { return mPress; }
- inline int z() const { return mZ; }
- inline qreal tangentialPressure() const { return mTangential; }
- inline qreal rotation() const { return mRot; }
- inline int xTilt() const { return mXT; }
- inline int yTilt() const { return mYT; }
- Qt::MouseButton button() const;
- Qt::MouseButtons buttons() const;
+ inline qreal pressure() const { Q_ASSERT(!points().isEmpty()); return points().first().pressure(); }
+ inline qreal rotation() const { Q_ASSERT(!points().isEmpty()); return points().first().rotation(); }
+ inline qreal z() const { return m_z; }
+ inline qreal tangentialPressure() const { return m_tangential; }
+ inline qreal xTilt() const { return m_xTilt; }
+ inline qreal yTilt() const { return m_yTilt; }
protected:
- QPointF mPos, mGPos;
- int mDev, mPointerType, mXT, mYT, mZ;
- qreal mPress, mTangential, mRot;
- qint64 mUnique;
-
- // QTabletEventPrivate for extra storage.
- // ### Qt 6: QPointingEvent will have Buttons, QTabletEvent will inherit
- void *mExtra;
+ float m_tangential;
+ float m_xTilt;
+ float m_yTilt;
+ float m_z;
};
#endif // QT_CONFIG(tabletevent)
-#ifndef QT_NO_GESTURES
-class Q_GUI_EXPORT QNativeGestureEvent : public QInputEvent
+#if QT_CONFIG(gestures)
+class Q_GUI_EXPORT QNativeGestureEvent : public QSinglePointEvent
{
+ Q_DECL_EVENT_COMMON(QNativeGestureEvent)
public:
-#if QT_DEPRECATED_SINCE(5, 10)
- QT_DEPRECATED QNativeGestureEvent(Qt::NativeGestureType type, const QPointF &localPos, const QPointF &windowPos,
- const QPointF &screenPos, qreal value, ulong sequenceId, quint64 intArgument);
+#if QT_DEPRECATED_SINCE(6, 2)
+ QT_DEPRECATED_VERSION_X_6_2("Use the other constructor")
+ QNativeGestureEvent(Qt::NativeGestureType type, const QPointingDevice *dev, const QPointF &localPos, const QPointF &scenePos,
+ const QPointF &globalPos, qreal value, quint64 sequenceId, quint64 intArgument);
+#endif
+ QNativeGestureEvent(Qt::NativeGestureType type, const QPointingDevice *dev, int fingerCount,
+ const QPointF &localPos, const QPointF &scenePos, const QPointF &globalPos,
+ qreal value, const QPointF &delta, quint64 sequenceId = UINT64_MAX);
+
+ Qt::NativeGestureType gestureType() const { return m_gestureType; }
+ int fingerCount() const { return m_fingerCount; }
+ qreal value() const { return m_realValue; }
+ QPointF delta() const {
+#if QT_VERSION < QT_VERSION_CHECK(7, 0, 0)
+ return m_delta.toPointF();
+#else
+ return m_delta;
#endif
- QNativeGestureEvent(Qt::NativeGestureType type, const QTouchDevice *dev, const QPointF &localPos, const QPointF &windowPos,
- const QPointF &screenPos, qreal value, ulong sequenceId, quint64 intArgument);
- ~QNativeGestureEvent();
- Qt::NativeGestureType gestureType() const { return mGestureType; }
- qreal value() const { return mRealValue; }
+ }
+#if QT_DEPRECATED_SINCE(6, 0)
#ifndef QT_NO_INTEGER_EVENT_COORDINATES
- inline const QPoint pos() const { return mLocalPos.toPoint(); }
- inline const QPoint globalPos() const { return mScreenPos.toPoint(); }
+ QT_DEPRECATED_VERSION_X_6_0("Use position().toPoint()")
+ inline const QPoint pos() const { return position().toPoint(); }
+ QT_DEPRECATED_VERSION_X_6_0("Use globalPosition().toPoint()")
+ inline const QPoint globalPos() const { return globalPosition().toPoint(); }
+#endif
+ QT_DEPRECATED_VERSION_X_6_0("Use position()")
+ QPointF localPos() const { return position(); }
+ QT_DEPRECATED_VERSION_X_6_0("Use scenePosition()")
+ QPointF windowPos() const { return scenePosition(); }
+ QT_DEPRECATED_VERSION_X_6_0("Use globalPosition()")
+ QPointF screenPos() const { return globalPosition(); }
#endif
- const QPointF &localPos() const { return mLocalPos; }
- const QPointF &windowPos() const { return mWindowPos; }
- const QPointF &screenPos() const { return mScreenPos; }
-
- const QTouchDevice *device() const { return mDevice; }
protected:
- Qt::NativeGestureType mGestureType;
- QPointF mLocalPos;
- QPointF mWindowPos;
- QPointF mScreenPos;
- qreal mRealValue;
- ulong mSequenceId;
- quint64 mIntValue;
- const QTouchDevice *mDevice;
+ quint64 m_sequenceId;
+#if QT_VERSION < QT_VERSION_CHECK(7, 0, 0)
+ QVector2D m_delta;
+#else
+ QPointF m_delta;
+#endif
+ qreal m_realValue;
+ Qt::NativeGestureType m_gestureType;
+ quint32 m_fingerCount : 4;
+ quint32 m_reserved : 28;
};
-#endif // QT_NO_GESTURES
+#endif // QT_CONFIG(gestures)
class Q_GUI_EXPORT QKeyEvent : public QInputEvent
{
+ Q_DECL_EVENT_COMMON(QKeyEvent)
public:
QKeyEvent(Type type, int key, Qt::KeyboardModifiers modifiers, const QString& text = QString(),
- bool autorep = false, ushort count = 1);
+ bool autorep = false, quint16 count = 1);
QKeyEvent(Type type, int key, Qt::KeyboardModifiers modifiers,
quint32 nativeScanCode, quint32 nativeVirtualKey, quint32 nativeModifiers,
- const QString &text = QString(), bool autorep = false, ushort count = 1);
- ~QKeyEvent();
+ const QString &text = QString(), bool autorep = false, quint16 count = 1,
+ const QInputDevice *device = QInputDevice::primaryKeyboard());
- int key() const { return k; }
+ int key() const { return m_key; }
#if QT_CONFIG(shortcut)
bool matches(QKeySequence::StandardKey key) const;
#endif
Qt::KeyboardModifiers modifiers() const;
- inline QString text() const { return txt; }
- inline bool isAutoRepeat() const { return autor; }
- inline int count() const { return int(c); }
-
- inline quint32 nativeScanCode() const { return nScanCode; }
- inline quint32 nativeVirtualKey() const { return nVirtualKey; }
- inline quint32 nativeModifiers() const { return nModifiers; }
-
- // Functions for the extended key event information
-#if QT_DEPRECATED_SINCE(5, 0)
- static inline QKeyEvent *createExtendedKeyEvent(Type type, int key, Qt::KeyboardModifiers modifiers,
- quint32 nativeScanCode, quint32 nativeVirtualKey,
- quint32 nativeModifiers,
- const QString& text = QString(), bool autorep = false,
- ushort count = 1)
+ QKeyCombination keyCombination() const
{
- return new QKeyEvent(type, key, modifiers,
- nativeScanCode, nativeVirtualKey, nativeModifiers,
- text, autorep, count);
+ return QKeyCombination(modifiers(), Qt::Key(m_key));
}
+ inline QString text() const { return m_text; }
+ inline bool isAutoRepeat() const { return m_autoRepeat; }
+ inline int count() const { return int(m_count); }
- inline bool hasExtendedInfo() const { return true; }
-#endif
+ inline quint32 nativeScanCode() const { return m_scanCode; }
+ inline quint32 nativeVirtualKey() const { return m_virtualKey; }
+ inline quint32 nativeModifiers() const { return m_nativeModifiers; }
+
+#if QT_CONFIG(shortcut)
+ friend inline bool operator==(QKeyEvent *e, QKeySequence::StandardKey key)
+ { return (e ? e->matches(key) : false); }
+ friend inline bool operator==(QKeySequence::StandardKey key, QKeyEvent *e)
+ { return (e ? e->matches(key) : false); }
+#endif // QT_CONFIG(shortcut)
protected:
- QString txt;
- int k;
- quint32 nScanCode;
- quint32 nVirtualKey;
- quint32 nModifiers;
- ushort c;
- ushort autor:1;
- // ushort reserved:15;
+ QString m_text;
+ int m_key;
+ quint32 m_scanCode;
+ quint32 m_virtualKey;
+ quint32 m_nativeModifiers;
+ quint16 m_count : 15;
+ quint16 m_autoRepeat : 1;
};
class Q_GUI_EXPORT QFocusEvent : public QEvent
{
+ Q_DECL_EVENT_COMMON(QFocusEvent)
public:
explicit QFocusEvent(Type type, Qt::FocusReason reason=Qt::OtherFocusReason);
- ~QFocusEvent();
inline bool gotFocus() const { return type() == FocusIn; }
inline bool lostFocus() const { return type() == FocusOut; }
@@ -435,10 +484,10 @@ private:
class Q_GUI_EXPORT QPaintEvent : public QEvent
{
+ Q_DECL_EVENT_COMMON(QPaintEvent)
public:
explicit QPaintEvent(const QRegion& paintRegion);
explicit QPaintEvent(const QRect &paintRect);
- ~QPaintEvent();
inline const QRect &rect() const { return m_rect; }
inline const QRegion &region() const { return m_region; }
@@ -451,31 +500,36 @@ protected:
class Q_GUI_EXPORT QMoveEvent : public QEvent
{
+ Q_DECL_EVENT_COMMON(QMoveEvent)
public:
QMoveEvent(const QPoint &pos, const QPoint &oldPos);
- ~QMoveEvent();
- inline const QPoint &pos() const { return p; }
- inline const QPoint &oldPos() const { return oldp;}
+ inline const QPoint &pos() const { return m_pos; }
+ inline const QPoint &oldPos() const { return m_oldPos;}
protected:
- QPoint p, oldp;
+ QPoint m_pos, m_oldPos;
friend class QApplication;
};
class Q_GUI_EXPORT QExposeEvent : public QEvent
{
+ Q_DECL_EVENT_COMMON(QExposeEvent)
public:
- explicit QExposeEvent(const QRegion &rgn);
- ~QExposeEvent();
+ explicit QExposeEvent(const QRegion &m_region);
- inline const QRegion &region() const { return rgn; }
+#if QT_DEPRECATED_SINCE(6, 0)
+ QT_DEPRECATED_VERSION_X_6_0("Handle QPaintEvent instead")
+ inline const QRegion &region() const { return m_region; }
+#endif
protected:
- QRegion rgn;
+ QRegion m_region;
+ friend class QWidgetWindow;
};
class Q_GUI_EXPORT QPlatformSurfaceEvent : public QEvent
{
+ Q_DECL_EVENT_COMMON(QPlatformSurfaceEvent)
public:
enum SurfaceEventType {
SurfaceCreated,
@@ -483,7 +537,6 @@ public:
};
explicit QPlatformSurfaceEvent(SurfaceEventType surfaceEventType);
- ~QPlatformSurfaceEvent();
inline SurfaceEventType surfaceEventType() const { return m_surfaceEventType; }
@@ -493,81 +546,84 @@ protected:
class Q_GUI_EXPORT QResizeEvent : public QEvent
{
+ Q_DECL_EVENT_COMMON(QResizeEvent)
public:
QResizeEvent(const QSize &size, const QSize &oldSize);
- ~QResizeEvent();
- inline const QSize &size() const { return s; }
- inline const QSize &oldSize()const { return olds;}
+ inline const QSize &size() const { return m_size; }
+ inline const QSize &oldSize()const { return m_oldSize;}
protected:
- QSize s, olds;
+ QSize m_size, m_oldSize;
friend class QApplication;
};
class Q_GUI_EXPORT QCloseEvent : public QEvent
{
+ Q_DECL_EVENT_COMMON(QCloseEvent)
public:
QCloseEvent();
- ~QCloseEvent();
};
class Q_GUI_EXPORT QIconDragEvent : public QEvent
{
+ Q_DECL_EVENT_COMMON(QIconDragEvent)
public:
QIconDragEvent();
- ~QIconDragEvent();
};
class Q_GUI_EXPORT QShowEvent : public QEvent
{
+ Q_DECL_EVENT_COMMON(QShowEvent)
public:
QShowEvent();
- ~QShowEvent();
};
class Q_GUI_EXPORT QHideEvent : public QEvent
{
+ Q_DECL_EVENT_COMMON(QHideEvent)
public:
QHideEvent();
- ~QHideEvent();
};
#ifndef QT_NO_CONTEXTMENU
class Q_GUI_EXPORT QContextMenuEvent : public QInputEvent
{
+ Q_DECL_EVENT_COMMON(QContextMenuEvent)
public:
enum Reason { Mouse, Keyboard, Other };
QContextMenuEvent(Reason reason, const QPoint &pos, const QPoint &globalPos,
- Qt::KeyboardModifiers modifiers);
- QContextMenuEvent(Reason reason, const QPoint &pos, const QPoint &globalPos);
+ Qt::KeyboardModifiers modifiers = Qt::NoModifier);
+#if QT_DEPRECATED_SINCE(6, 4)
+ QT_DEPRECATED_VERSION_X_6_4("Use the other constructor")
QContextMenuEvent(Reason reason, const QPoint &pos);
- ~QContextMenuEvent();
+#endif
- inline int x() const { return p.x(); }
- inline int y() const { return p.y(); }
- inline int globalX() const { return gp.x(); }
- inline int globalY() const { return gp.y(); }
+ inline int x() const { return m_pos.x(); }
+ inline int y() const { return m_pos.y(); }
+ inline int globalX() const { return m_globalPos.x(); }
+ inline int globalY() const { return m_globalPos.y(); }
- inline const QPoint& pos() const { return p; }
- inline const QPoint& globalPos() const { return gp; }
+ inline const QPoint& pos() const { return m_pos; }
+ inline const QPoint& globalPos() const { return m_globalPos; }
- inline Reason reason() const { return Reason(reas); }
+ inline Reason reason() const { return Reason(m_reason); }
protected:
- QPoint p;
- QPoint gp;
- uint reas : 8;
+ QPoint m_pos;
+ QPoint m_globalPos;
+ uint m_reason : 8;
};
#endif // QT_NO_CONTEXTMENU
#ifndef QT_NO_INPUTMETHOD
class Q_GUI_EXPORT QInputMethodEvent : public QEvent
{
+ Q_DECL_EVENT_COMMON(QInputMethodEvent)
public:
enum AttributeType {
TextFormat,
@@ -588,32 +644,42 @@ public:
};
QInputMethodEvent();
QInputMethodEvent(const QString &preeditText, const QList<Attribute> &attributes);
- ~QInputMethodEvent();
void setCommitString(const QString &commitString, int replaceFrom = 0, int replaceLength = 0);
- inline const QList<Attribute> &attributes() const { return attrs; }
- inline const QString &preeditString() const { return preedit; }
+ inline const QList<Attribute> &attributes() const { return m_attributes; }
+ inline const QString &preeditString() const { return m_preedit; }
- inline const QString &commitString() const { return commit; }
- inline int replacementStart() const { return replace_from; }
- inline int replacementLength() const { return replace_length; }
+ inline const QString &commitString() const { return m_commit; }
+ inline int replacementStart() const { return m_replacementStart; }
+ inline int replacementLength() const { return m_replacementLength; }
- QInputMethodEvent(const QInputMethodEvent &other);
+ inline friend bool operator==(const QInputMethodEvent::Attribute &lhs,
+ const QInputMethodEvent::Attribute &rhs)
+ {
+ return lhs.type == rhs.type && lhs.start == rhs.start
+ && lhs.length == rhs.length && lhs.value == rhs.value;
+ }
+
+ inline friend bool operator!=(const QInputMethodEvent::Attribute &lhs,
+ const QInputMethodEvent::Attribute &rhs)
+ {
+ return !(lhs == rhs);
+ }
private:
- QString preedit;
- QList<Attribute> attrs;
- QString commit;
- int replace_from;
- int replace_length;
+ QString m_preedit;
+ QString m_commit;
+ QList<Attribute> m_attributes;
+ int m_replacementStart;
+ int m_replacementLength;
};
-Q_DECLARE_TYPEINFO(QInputMethodEvent::Attribute, Q_MOVABLE_TYPE);
+Q_DECLARE_TYPEINFO(QInputMethodEvent::Attribute, Q_RELOCATABLE_TYPE);
class Q_GUI_EXPORT QInputMethodQueryEvent : public QEvent
{
+ Q_DECL_EVENT_COMMON(QInputMethodQueryEvent)
public:
explicit QInputMethodQueryEvent(Qt::InputMethodQueries queries);
- ~QInputMethodQueryEvent();
Qt::InputMethodQueries queries() const { return m_queries; }
@@ -626,9 +692,9 @@ private:
QVariant value;
};
friend QTypeInfo<QueryPair>;
- QVector<QueryPair> m_values;
+ QList<QueryPair> m_values;
};
-Q_DECLARE_TYPEINFO(QInputMethodQueryEvent::QueryPair, Q_MOVABLE_TYPE);
+Q_DECLARE_TYPEINFO(QInputMethodQueryEvent::QueryPair, Q_RELOCATABLE_TYPE);
#endif // QT_NO_INPUTMETHOD
@@ -638,190 +704,208 @@ class QMimeData;
class Q_GUI_EXPORT QDropEvent : public QEvent
{
+ Q_DECL_EVENT_COMMON(QDropEvent)
public:
QDropEvent(const QPointF& pos, Qt::DropActions actions, const QMimeData *data,
Qt::MouseButtons buttons, Qt::KeyboardModifiers modifiers, Type type = Drop);
- ~QDropEvent();
-
- inline QPoint pos() const { return p.toPoint(); }
- inline const QPointF &posF() const { return p; }
- inline Qt::MouseButtons mouseButtons() const { return mouseState; }
- inline Qt::KeyboardModifiers keyboardModifiers() const { return modState; }
- inline Qt::DropActions possibleActions() const { return act; }
- inline Qt::DropAction proposedAction() const { return default_action; }
- inline void acceptProposedAction() { drop_action = default_action; accept(); }
-
- inline Qt::DropAction dropAction() const { return drop_action; }
+#if QT_DEPRECATED_SINCE(6, 0)
+ QT_DEPRECATED_VERSION_X_6_0("Use position().toPoint()")
+ inline QPoint pos() const { return position().toPoint(); }
+ QT_DEPRECATED_VERSION_X_6_0("Use position()")
+ inline QPointF posF() const { return position(); }
+ QT_DEPRECATED_VERSION_X_6_0("Use buttons()")
+ inline Qt::MouseButtons mouseButtons() const { return buttons(); }
+ QT_DEPRECATED_VERSION_X_6_0("Use modifiers()")
+ inline Qt::KeyboardModifiers keyboardModifiers() const { return modifiers(); }
+#endif // QT_DEPRECATED_SINCE(6, 0)
+
+ QPointF position() const { return m_pos; }
+ inline Qt::MouseButtons buttons() const { return m_mouseState; }
+ inline Qt::KeyboardModifiers modifiers() const { return m_modState; }
+
+ inline Qt::DropActions possibleActions() const { return m_actions; }
+ inline Qt::DropAction proposedAction() const { return m_defaultAction; }
+ inline void acceptProposedAction() { m_dropAction = m_defaultAction; accept(); }
+
+ inline Qt::DropAction dropAction() const { return m_dropAction; }
void setDropAction(Qt::DropAction action);
QObject* source() const;
- inline const QMimeData *mimeData() const { return mdata; }
+ inline const QMimeData *mimeData() const { return m_data; }
protected:
friend class QApplication;
- QPointF p;
- Qt::MouseButtons mouseState;
- Qt::KeyboardModifiers modState;
- Qt::DropActions act;
- Qt::DropAction drop_action;
- Qt::DropAction default_action;
- const QMimeData *mdata;
+ QPointF m_pos;
+ Qt::MouseButtons m_mouseState;
+ Qt::KeyboardModifiers m_modState;
+ Qt::DropActions m_actions;
+ Qt::DropAction m_dropAction;
+ Qt::DropAction m_defaultAction;
+ const QMimeData *m_data;
};
class Q_GUI_EXPORT QDragMoveEvent : public QDropEvent
{
+ Q_DECL_EVENT_COMMON(QDragMoveEvent)
public:
QDragMoveEvent(const QPoint &pos, Qt::DropActions actions, const QMimeData *data,
Qt::MouseButtons buttons, Qt::KeyboardModifiers modifiers, Type type = DragMove);
- ~QDragMoveEvent();
- inline QRect answerRect() const { return rect; }
+ inline QRect answerRect() const { return m_rect; }
inline void accept() { QDropEvent::accept(); }
inline void ignore() { QDropEvent::ignore(); }
- inline void accept(const QRect & r) { accept(); rect = r; }
- inline void ignore(const QRect & r) { ignore(); rect = r; }
+ inline void accept(const QRect & r) { accept(); m_rect = r; }
+ inline void ignore(const QRect & r) { ignore(); m_rect = r; }
protected:
- QRect rect;
+ QRect m_rect;
};
class Q_GUI_EXPORT QDragEnterEvent : public QDragMoveEvent
{
+ Q_DECL_EVENT_COMMON(QDragEnterEvent)
public:
QDragEnterEvent(const QPoint &pos, Qt::DropActions actions, const QMimeData *data,
Qt::MouseButtons buttons, Qt::KeyboardModifiers modifiers);
- ~QDragEnterEvent();
};
class Q_GUI_EXPORT QDragLeaveEvent : public QEvent
{
+ Q_DECL_EVENT_COMMON(QDragLeaveEvent)
public:
QDragLeaveEvent();
- ~QDragLeaveEvent();
};
#endif // QT_CONFIG(draganddrop)
class Q_GUI_EXPORT QHelpEvent : public QEvent
{
+ Q_DECL_EVENT_COMMON(QHelpEvent)
public:
QHelpEvent(Type type, const QPoint &pos, const QPoint &globalPos);
- ~QHelpEvent();
- inline int x() const { return p.x(); }
- inline int y() const { return p.y(); }
- inline int globalX() const { return gp.x(); }
- inline int globalY() const { return gp.y(); }
+ inline int x() const { return m_pos.x(); }
+ inline int y() const { return m_pos.y(); }
+ inline int globalX() const { return m_globalPos.x(); }
+ inline int globalY() const { return m_globalPos.y(); }
- inline const QPoint& pos() const { return p; }
- inline const QPoint& globalPos() const { return gp; }
+ inline const QPoint& pos() const { return m_pos; }
+ inline const QPoint& globalPos() const { return m_globalPos; }
private:
- QPoint p;
- QPoint gp;
+ QPoint m_pos;
+ QPoint m_globalPos;
};
#ifndef QT_NO_STATUSTIP
class Q_GUI_EXPORT QStatusTipEvent : public QEvent
{
+ Q_DECL_EVENT_COMMON(QStatusTipEvent)
public:
explicit QStatusTipEvent(const QString &tip);
- ~QStatusTipEvent();
- inline QString tip() const { return s; }
+ inline QString tip() const { return m_tip; }
private:
- QString s;
+ QString m_tip;
};
#endif
#if QT_CONFIG(whatsthis)
class Q_GUI_EXPORT QWhatsThisClickedEvent : public QEvent
{
+ Q_DECL_EVENT_COMMON(QWhatsThisClickedEvent)
public:
explicit QWhatsThisClickedEvent(const QString &href);
- ~QWhatsThisClickedEvent();
- inline QString href() const { return s; }
+ inline QString href() const { return m_href; }
private:
- QString s;
+ QString m_href;
};
#endif
#if QT_CONFIG(action)
class Q_GUI_EXPORT QActionEvent : public QEvent
{
- QGuiAction *act, *bef;
+ Q_DECL_EVENT_COMMON(QActionEvent)
public:
- QActionEvent(int type, QGuiAction *action, QGuiAction *before = nullptr);
- ~QActionEvent();
+ QActionEvent(int type, QAction *action, QAction *before = nullptr);
- inline QGuiAction *action() const { return act; }
- inline QGuiAction *before() const { return bef; }
+ inline QAction *action() const { return m_action; }
+ inline QAction *before() const { return m_before; }
+private:
+ QAction *m_action;
+ QAction *m_before;
};
#endif // QT_CONFIG(action)
class Q_GUI_EXPORT QFileOpenEvent : public QEvent
{
+ Q_DECL_EVENT_COMMON(QFileOpenEvent)
public:
explicit QFileOpenEvent(const QString &file);
explicit QFileOpenEvent(const QUrl &url);
- ~QFileOpenEvent();
- inline QString file() const { return f; }
+ inline QString file() const { return m_file; }
QUrl url() const { return m_url; }
+#if QT_DEPRECATED_SINCE(6, 6)
+ QT_DEPRECATED_VERSION_X_6_6("Interpret the string returned by file()")
bool openFile(QFile &file, QIODevice::OpenMode flags) const;
+#endif
private:
- QString f;
+ QString m_file;
QUrl m_url;
};
#ifndef QT_NO_TOOLBAR
class Q_GUI_EXPORT QToolBarChangeEvent : public QEvent
{
+ Q_DECL_EVENT_COMMON(QToolBarChangeEvent)
public:
explicit QToolBarChangeEvent(bool t);
- ~QToolBarChangeEvent();
- inline bool toggle() const { return tog; }
+ inline bool toggle() const { return m_toggle; }
private:
- uint tog : 1;
+ bool m_toggle;
};
#endif
#if QT_CONFIG(shortcut)
class Q_GUI_EXPORT QShortcutEvent : public QEvent
{
+ Q_DECL_EVENT_COMMON(QShortcutEvent)
public:
+ // Note this is publicly deprecated, but should remain as internal constructor:
QShortcutEvent(const QKeySequence &key, int id, bool ambiguous = false);
- ~QShortcutEvent();
+ QShortcutEvent(const QKeySequence &key, const QShortcut *shortcut = nullptr, bool ambiguous = false);
- inline const QKeySequence &key() const { return sequence; }
- inline int shortcutId() const { return sid; }
- inline bool isAmbiguous() const { return ambig; }
+ inline const QKeySequence &key() const { return m_sequence; }
+ // Note this is publicly deprecated, but should remain as internal getter:
+ inline int shortcutId() const { return m_shortcutId; }
+ inline bool isAmbiguous() const { return m_ambiguous; }
protected:
- QKeySequence sequence;
- bool ambig;
- int sid;
+ QKeySequence m_sequence;
+ int m_shortcutId;
+ bool m_ambiguous;
};
#endif
class Q_GUI_EXPORT QWindowStateChangeEvent: public QEvent
{
+ Q_DECL_EVENT_COMMON(QWindowStateChangeEvent)
public:
- explicit QWindowStateChangeEvent(Qt::WindowStates aOldState, bool isOverride = false);
- ~QWindowStateChangeEvent();
+ explicit QWindowStateChangeEvent(Qt::WindowStates oldState, bool isOverride = false);
- inline Qt::WindowStates oldState() const { return ostate; }
+ inline Qt::WindowStates oldState() const { return m_oldStates; }
bool isOverride() const;
private:
- Qt::WindowStates ostate;
+ Qt::WindowStates m_oldStates;
bool m_override;
};
@@ -829,221 +913,68 @@ private:
Q_GUI_EXPORT QDebug operator<<(QDebug, const QEvent *);
#endif
-#if QT_CONFIG(shortcut)
-inline bool operator==(QKeyEvent *e, QKeySequence::StandardKey key){return (e ? e->matches(key) : false);}
-inline bool operator==(QKeySequence::StandardKey key, QKeyEvent *e){return (e ? e->matches(key) : false);}
-#endif // QT_CONFIG(shortcut)
-
-class Q_GUI_EXPORT QPointingDeviceUniqueId
-{
- Q_GADGET
- Q_PROPERTY(qint64 numericId READ numericId CONSTANT)
-public:
- Q_ALWAYS_INLINE
- Q_DECL_CONSTEXPR QPointingDeviceUniqueId() noexcept : m_numericId(-1) {}
- // compiler-generated copy/move ctor/assignment operators are ok!
- // compiler-generated dtor is ok!
-
- static QPointingDeviceUniqueId fromNumericId(qint64 id);
-
- Q_ALWAYS_INLINE Q_DECL_CONSTEXPR bool isValid() const noexcept { return m_numericId != -1; }
- qint64 numericId() const noexcept;
-
-private:
- // TODO: for TUIO 2, or any other type of complex token ID, an internal
- // array (or hash) can be added to hold additional properties.
- // In this case, m_numericId will then turn into an index into that array (or hash).
- qint64 m_numericId;
-};
-Q_DECLARE_TYPEINFO(QPointingDeviceUniqueId, Q_MOVABLE_TYPE);
-
-Q_GUI_EXPORT bool operator==(QPointingDeviceUniqueId lhs, QPointingDeviceUniqueId rhs) noexcept;
-inline bool operator!=(QPointingDeviceUniqueId lhs, QPointingDeviceUniqueId rhs) noexcept
-{ return !operator==(lhs, rhs); }
-Q_GUI_EXPORT uint qHash(QPointingDeviceUniqueId key, uint seed = 0) noexcept;
-
-
-
-class QTouchEventTouchPointPrivate;
-class Q_GUI_EXPORT QTouchEvent : public QInputEvent
+class Q_GUI_EXPORT QTouchEvent : public QPointerEvent
{
+ Q_DECL_EVENT_COMMON(QTouchEvent)
public:
- class Q_GUI_EXPORT TouchPoint
- {
- public:
- enum InfoFlag {
- Pen = 0x0001,
- Token = 0x0002
- };
-#ifndef Q_MOC_RUN
- // otherwise moc gives
- // Error: Meta object features not supported for nested classes
- Q_DECLARE_FLAGS(InfoFlags, InfoFlag)
-#endif
-
- explicit TouchPoint(int id = -1);
- TouchPoint(const TouchPoint &other);
- TouchPoint(TouchPoint &&other) noexcept
- : d(nullptr)
- { qSwap(d, other.d); }
- TouchPoint &operator=(TouchPoint &&other) noexcept
- { qSwap(d, other.d); return *this; }
- ~TouchPoint();
-
- TouchPoint &operator=(const TouchPoint &other)
- { if ( d != other.d ) { TouchPoint copy(other); swap(copy); } return *this; }
-
- void swap(TouchPoint &other) noexcept
- { qSwap(d, other.d); }
-
- int id() const;
- QPointingDeviceUniqueId uniqueId() const;
-
- Qt::TouchPointState state() const;
-
- QPointF pos() const;
- QPointF startPos() const;
- QPointF lastPos() const;
-
- QPointF scenePos() const;
- QPointF startScenePos() const;
- QPointF lastScenePos() const;
-
- QPointF screenPos() const;
- QPointF startScreenPos() const;
- QPointF lastScreenPos() const;
-
- QPointF normalizedPos() const;
- QPointF startNormalizedPos() const;
- QPointF lastNormalizedPos() const;
-
- QRectF rect() const;
- QRectF sceneRect() const;
- QRectF screenRect() const;
-
- qreal pressure() const;
- qreal rotation() const;
- QSizeF ellipseDiameters() const;
-
- QVector2D velocity() const;
- InfoFlags flags() const;
- QVector<QPointF> rawScreenPositions() const;
-
- // internal
- void setId(int id);
- void setUniqueId(qint64 uid);
- void setState(Qt::TouchPointStates state);
- void setPos(const QPointF &pos);
- void setScenePos(const QPointF &scenePos);
- void setScreenPos(const QPointF &screenPos);
- void setNormalizedPos(const QPointF &normalizedPos);
- void setStartPos(const QPointF &startPos);
- void setStartScenePos(const QPointF &startScenePos);
- void setStartScreenPos(const QPointF &startScreenPos);
- void setStartNormalizedPos(const QPointF &startNormalizedPos);
- void setLastPos(const QPointF &lastPos);
- void setLastScenePos(const QPointF &lastScenePos);
- void setLastScreenPos(const QPointF &lastScreenPos);
- void setLastNormalizedPos(const QPointF &lastNormalizedPos);
- void setRect(const QRectF &rect); // deprecated
- void setSceneRect(const QRectF &sceneRect); // deprecated
- void setScreenRect(const QRectF &screenRect); // deprecated
- void setPressure(qreal pressure);
- void setRotation(qreal angle);
- void setEllipseDiameters(const QSizeF &dia);
- void setVelocity(const QVector2D &v);
- void setFlags(InfoFlags flags);
- void setRawScreenPositions(const QVector<QPointF> &positions);
-
- private:
- QTouchEventTouchPointPrivate *d;
- friend class QGuiApplication;
- friend class QGuiApplicationPrivate;
- friend class QApplication;
- friend class QApplicationPrivate;
- friend class QQuickPointerTouchEvent;
- friend class QQuickMultiPointTouchArea;
- };
-
-#if QT_DEPRECATED_SINCE(5, 0)
- enum DeviceType {
- TouchScreen,
- TouchPad
- };
-#endif
+ using TouchPoint = QEventPoint; // source compat
explicit QTouchEvent(QEvent::Type eventType,
- QTouchDevice *device = nullptr,
+ const QPointingDevice *device = nullptr,
Qt::KeyboardModifiers modifiers = Qt::NoModifier,
- Qt::TouchPointStates touchPointStates = Qt::TouchPointStates(),
- const QList<QTouchEvent::TouchPoint> &touchPoints = QList<QTouchEvent::TouchPoint>());
- ~QTouchEvent();
-
- inline QWindow *window() const { return _window; }
- inline QObject *target() const { return _target; }
-#if QT_DEPRECATED_SINCE(5, 0)
- QT_DEPRECATED inline QTouchEvent::DeviceType deviceType() const { return static_cast<DeviceType>(int(_device->type())); }
+ const QList<QEventPoint> &touchPoints = {});
+#if QT_DEPRECATED_SINCE(6, 0)
+ QT_DEPRECATED_VERSION_X_6_0("Use another constructor")
+ explicit QTouchEvent(QEvent::Type eventType,
+ const QPointingDevice *device,
+ Qt::KeyboardModifiers modifiers,
+ QEventPoint::States touchPointStates,
+ const QList<QEventPoint> &touchPoints = {});
#endif
- inline Qt::TouchPointStates touchPointStates() const { return _touchPointStates; }
- inline const QList<QTouchEvent::TouchPoint> &touchPoints() const { return _touchPoints; }
- inline QTouchDevice *device() const { return _device; }
- // internal
- inline void setWindow(QWindow *awindow) { _window = awindow; }
- inline void setTarget(QObject *atarget) { _target = atarget; }
- inline void setTouchPointStates(Qt::TouchPointStates aTouchPointStates) { _touchPointStates = aTouchPointStates; }
- inline void setTouchPoints(const QList<QTouchEvent::TouchPoint> &atouchPoints) { _touchPoints = atouchPoints; }
- inline void setDevice(QTouchDevice *adevice) { _device = adevice; }
+ inline QObject *target() const { return m_target; }
+ inline QEventPoint::States touchPointStates() const { return m_touchPointStates; }
+#if QT_DEPRECATED_SINCE(6, 0)
+ QT_DEPRECATED_VERSION_X_6_0("Use points()")
+ const QList<QEventPoint> &touchPoints() const { return points(); }
+#endif
+ bool isBeginEvent() const override;
+ bool isUpdateEvent() const override;
+ bool isEndEvent() const override;
protected:
- QWindow *_window;
- QObject *_target;
- QTouchDevice *_device;
- Qt::TouchPointStates _touchPointStates;
- QList<QTouchEvent::TouchPoint> _touchPoints;
-
- friend class QGuiApplication;
- friend class QGuiApplicationPrivate;
- friend class QApplication;
- friend class QApplicationPrivate;
-#ifndef QT_NO_GRAPHICSVIEW
- friend class QGraphicsScenePrivate; // direct access to _touchPoints
-#endif
+ QObject *m_target = nullptr;
+ QEventPoint::States m_touchPointStates = QEventPoint::State::Unknown;
+ quint32 m_reserved : 24;
};
-Q_DECLARE_TYPEINFO(QTouchEvent::TouchPoint, Q_MOVABLE_TYPE);
-Q_DECLARE_OPERATORS_FOR_FLAGS(QTouchEvent::TouchPoint::InfoFlags)
-
-#ifndef QT_NO_DEBUG_STREAM
-Q_GUI_EXPORT QDebug operator<<(QDebug, const QTouchEvent::TouchPoint &);
-#endif
class Q_GUI_EXPORT QScrollPrepareEvent : public QEvent
{
+ Q_DECL_EVENT_COMMON(QScrollPrepareEvent)
public:
explicit QScrollPrepareEvent(const QPointF &startPos);
- ~QScrollPrepareEvent();
- QPointF startPos() const;
+ QPointF startPos() const { return m_startPos; }
- QSizeF viewportSize() const;
- QRectF contentPosRange() const;
- QPointF contentPos() const;
+ QSizeF viewportSize() const { return m_viewportSize; }
+ QRectF contentPosRange() const { return m_contentPosRange; }
+ QPointF contentPos() const { return m_contentPos; }
void setViewportSize(const QSizeF &size);
void setContentPosRange(const QRectF &rect);
void setContentPos(const QPointF &pos);
private:
- QObject* m_target; // Qt 6 remove.
- QPointF m_startPos;
- QSizeF m_viewportSize;
QRectF m_contentPosRange;
+ QSizeF m_viewportSize;
+ QPointF m_startPos;
QPointF m_contentPos;
};
class Q_GUI_EXPORT QScrollEvent : public QEvent
{
+ Q_DECL_EVENT_COMMON(QScrollEvent)
public:
enum ScrollState
{
@@ -1053,11 +984,10 @@ public:
};
QScrollEvent(const QPointF &contentPos, const QPointF &overshoot, ScrollState scrollState);
- ~QScrollEvent();
- QPointF contentPos() const;
- QPointF overshootDistance() const;
- ScrollState scrollState() const;
+ QPointF contentPos() const { return m_contentPos; }
+ QPointF overshootDistance() const { return m_overshoot; }
+ ScrollState scrollState() const { return m_state; }
private:
QPointF m_contentPos;
@@ -1067,12 +997,12 @@ private:
class Q_GUI_EXPORT QScreenOrientationChangeEvent : public QEvent
{
+ Q_DECL_EVENT_COMMON(QScreenOrientationChangeEvent)
public:
QScreenOrientationChangeEvent(QScreen *screen, Qt::ScreenOrientation orientation);
- ~QScreenOrientationChangeEvent();
- QScreen *screen() const;
- Qt::ScreenOrientation orientation() const;
+ QScreen *screen() const { return m_screen; }
+ Qt::ScreenOrientation orientation() const { return m_orientation; }
private:
QScreen *m_screen;
@@ -1081,14 +1011,27 @@ private:
class Q_GUI_EXPORT QApplicationStateChangeEvent : public QEvent
{
+ Q_DECL_EVENT_COMMON(QApplicationStateChangeEvent)
public:
explicit QApplicationStateChangeEvent(Qt::ApplicationState state);
- Qt::ApplicationState applicationState() const;
+
+ Qt::ApplicationState applicationState() const { return m_applicationState; }
private:
Qt::ApplicationState m_applicationState;
};
+class Q_GUI_EXPORT QChildWindowEvent : public QEvent
+{
+ Q_DECL_EVENT_COMMON(QChildWindowEvent)
+public:
+ explicit QChildWindowEvent(Type type, QWindow *childWindow);
+ QWindow *child() const { return c; }
+
+private:
+ QWindow *c;
+};
+
QT_END_NAMESPACE
#endif // QEVENT_H
diff --git a/src/gui/kernel/qevent_p.h b/src/gui/kernel/qevent_p.h
index b7645496f8..96ef8f123e 100644
--- a/src/gui/kernel/qevent_p.h
+++ b/src/gui/kernel/qevent_p.h
@@ -1,114 +1,69 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the QtGui module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2020 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#ifndef QEVENT_P_H
#define QEVENT_P_H
-#include <QtGui/private/qtguiglobal_p.h>
-#include <QtCore/qurl.h>
-#include <QtGui/qevent.h>
-
-
-QT_BEGIN_NAMESPACE
-
//
// W A R N I N G
// -------------
//
-// This file is not part of the Qt API. It exists purely as an
-// implementation detail. This header file may change from version to
+// This file is not part of the Qt API. It exists for the convenience
+// of other Qt classes. This header file may change from version to
// version without notice, or even be removed.
//
// We mean it.
//
-class QTouchEventTouchPointPrivate
+#include <QtGui/private/qtguiglobal_p.h>
+#include <QtCore/qurl.h>
+#include <QtGui/qevent.h>
+#include <QtGui/qwindow.h>
+
+QT_BEGIN_NAMESPACE
+
+class QPointingDevice;
+
+class Q_GUI_EXPORT QMutableTouchEvent : public QTouchEvent
{
public:
- inline QTouchEventTouchPointPrivate(int id)
- : ref(1),
- id(id),
- state(Qt::TouchPointReleased),
- pressure(-1),
- rotation(0),
- ellipseDiameters(0, 0),
- stationaryWithModifiedProperty(false)
- { }
-
- inline QTouchEventTouchPointPrivate *detach()
- {
- QTouchEventTouchPointPrivate *d = new QTouchEventTouchPointPrivate(*this);
- d->ref.storeRelaxed(1);
- if (!this->ref.deref())
- delete this;
- return d;
- }
-
- QAtomicInt ref;
- int id;
- QPointingDeviceUniqueId uniqueId;
- Qt::TouchPointStates state;
- QPointF pos, scenePos, screenPos, normalizedPos,
- startPos, startScenePos, startScreenPos, startNormalizedPos,
- lastPos, lastScenePos, lastScreenPos, lastNormalizedPos;
- qreal pressure;
- qreal rotation;
- QSizeF ellipseDiameters;
- QVector2D velocity;
- QTouchEvent::TouchPoint::InfoFlags flags;
- bool stationaryWithModifiedProperty : 1;
- QVector<QPointF> rawScreenPositions;
+ QMutableTouchEvent(QEvent::Type eventType = QEvent::TouchBegin,
+ const QPointingDevice *device = nullptr,
+ Qt::KeyboardModifiers modifiers = Qt::NoModifier,
+ const QList<QEventPoint> &touchPoints = QList<QEventPoint>()) :
+ QTouchEvent(eventType, device, modifiers, touchPoints) { }
+ ~QMutableTouchEvent() override;
+
+ static QMutableTouchEvent *from(QTouchEvent *e) { return static_cast<QMutableTouchEvent *>(e); }
+
+ static QMutableTouchEvent &from(QTouchEvent &e) { return static_cast<QMutableTouchEvent &>(e); }
+
+ void setTarget(QObject *target) { m_target = target; }
+
+ void addPoint(const QEventPoint &point);
};
-#if QT_CONFIG(tabletevent)
-class QTabletEventPrivate
+class Q_GUI_EXPORT QMutableSinglePointEvent : public QSinglePointEvent
{
public:
- inline QTabletEventPrivate(Qt::MouseButton button, Qt::MouseButtons buttons)
- : b(button),
- buttonState(buttons)
- { }
+ QMutableSinglePointEvent(const QSinglePointEvent &other) : QSinglePointEvent(other) {}
+ QMutableSinglePointEvent(Type type = QEvent::None, const QPointingDevice *device = nullptr, const QEventPoint &point = QEventPoint(),
+ Qt::MouseButton button = Qt::NoButton, Qt::MouseButtons buttons = Qt::NoButton,
+ Qt::KeyboardModifiers modifiers = Qt::NoModifier,
+ Qt::MouseEventSource source = Qt::MouseEventSynthesizedByQt) :
+ QSinglePointEvent(type, device, point, button, buttons, modifiers, source) { }
+ ~QMutableSinglePointEvent() override;
+
+ static QMutableSinglePointEvent *from(QSinglePointEvent *e) { return static_cast<QMutableSinglePointEvent *>(e); }
+
+ static QMutableSinglePointEvent &from(QSinglePointEvent &e) { return static_cast<QMutableSinglePointEvent &>(e); }
+
+ void setSource(Qt::MouseEventSource s) { m_source = s; }
+
+ bool isDoubleClick() { return m_doubleClick; }
- Qt::MouseButton b;
- Qt::MouseButtons buttonState;
+ void setDoubleClick(bool d = true) { m_doubleClick = d; }
};
-#endif // QT_CONFIG(tabletevent)
QT_END_NAMESPACE
diff --git a/src/gui/kernel/qeventpoint.cpp b/src/gui/kernel/qeventpoint.cpp
new file mode 100644
index 0000000000..66d4f44ea0
--- /dev/null
+++ b/src/gui/kernel/qeventpoint.cpp
@@ -0,0 +1,619 @@
+// Copyright (C) 2020 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
+
+#include "qeventpoint.h"
+#include "private/qeventpoint_p.h"
+#include "private/qpointingdevice_p.h"
+
+QT_BEGIN_NAMESPACE
+
+Q_LOGGING_CATEGORY(lcPointerVel, "qt.pointer.velocity")
+Q_LOGGING_CATEGORY(lcEPDetach, "qt.pointer.eventpoint.detach")
+
+QT_DEFINE_QESDP_SPECIALIZATION_DTOR(QEventPointPrivate)
+
+/*! \class QEventPoint
+ \brief The QEventPoint class provides information about a point in a QPointerEvent.
+ \since 6.0
+ \inmodule QtGui
+*/
+
+/*!
+ \enum QEventPoint::State
+
+ Specifies the state of this event point.
+
+ \value Unknown
+ Unknown state.
+
+ \value Stationary
+ The event point did not move.
+
+ \value Pressed
+ The touch point or button is pressed.
+
+ \value Updated
+ The event point was updated.
+
+ \value Released
+ The touch point or button was released.
+*/
+
+/*!
+ \internal
+ Constructs an invalid event point with the given \a id and the \a device
+ from which it originated.
+
+ This acts as a default constructor in usages like QMap<int, QEventPoint>,
+ as in qgraphicsscene_p.h.
+*/
+QEventPoint::QEventPoint(int id, const QPointingDevice *device)
+ : d(new QEventPointPrivate(id, device)) {}
+
+/*!
+ Constructs an event point with the given \a pointId, \a state,
+ \a scenePosition and \a globalPosition.
+*/
+QEventPoint::QEventPoint(int pointId, State state, const QPointF &scenePosition, const QPointF &globalPosition)
+ : d(new QEventPointPrivate(pointId, state, scenePosition, globalPosition)) {}
+
+/*!
+ Constructs an event point by making a shallow copy of \a other.
+*/
+QEventPoint::QEventPoint(const QEventPoint &other) noexcept = default;
+
+/*!
+ Assigns \a other to this event point and returns a reference to this
+ event point.
+*/
+QEventPoint &QEventPoint::operator=(const QEventPoint &other) noexcept = default;
+
+/*!
+ \fn QEventPoint::QEventPoint(QEventPoint &&other) noexcept
+
+ Constructs an event point by moving \a other.
+*/
+
+/*!
+ \fn QEventPoint &QEventPoint::operator=(QEventPoint &&other) noexcept
+
+ Move-assigns \a other to this event point instance.
+*/
+
+/*!
+ Returns \c true if this event point is equal to \a other, otherwise
+ return \c false.
+*/
+bool QEventPoint::operator==(const QEventPoint &other) const noexcept
+{
+ if (d == other.d)
+ return true;
+ if (!d || !other.d)
+ return false;
+ return *d == *other.d;
+}
+
+/*!
+ \fn bool QEventPoint::operator!=(const QEventPoint &other) const noexcept
+
+ Returns \c true if this event point is not equal to \a other, otherwise
+ return \c false.
+*/
+
+/*!
+ Destroys the event point.
+*/
+QEventPoint::~QEventPoint() = default;
+
+/*! \fn QPointF QEventPoint::pos() const
+ \deprecated [6.0] Use position() instead.
+
+ Returns the position of this point, relative to the widget
+ or item that received the event.
+*/
+
+/*!
+ \property QEventPoint::position
+ \brief the position of this point.
+
+ The position is relative to the widget or item that received the event.
+*/
+QPointF QEventPoint::position() const
+{ return d ? d->pos : QPointF(); }
+
+/*!
+ \property QEventPoint::pressPosition
+ \brief the position at which this point was pressed.
+
+ The position is relative to the widget or item that received the event.
+
+ \sa position
+*/
+QPointF QEventPoint::pressPosition() const
+{ return d ? d->globalPressPos - d->globalPos + d->pos : QPointF(); }
+
+/*!
+ \property QEventPoint::grabPosition
+ \brief the position at which this point was grabbed.
+
+ The position is relative to the widget or item that received the event.
+
+ \sa position
+*/
+QPointF QEventPoint::grabPosition() const
+{ return d ? d->globalGrabPos - d->globalPos + d->pos : QPointF(); }
+
+/*!
+ \property QEventPoint::lastPosition
+ \brief the position of this point from the previous press or move event.
+
+ The position is relative to the widget or item that received the event.
+
+ \sa position, pressPosition
+*/
+QPointF QEventPoint::lastPosition() const
+{ return d ? d->globalLastPos - d->globalPos + d->pos : QPointF(); }
+
+/*!
+ \property QEventPoint::scenePosition
+ \brief the scene position of this point.
+
+ The scene position is the position relative to QQuickWindow if handled in QQuickItem::event(),
+ in QGraphicsScene coordinates if handled by an override of QGraphicsItem::touchEvent(),
+ or the window position in widget applications.
+
+ \sa scenePressPosition, position, globalPosition
+*/
+QPointF QEventPoint::scenePosition() const
+{ return d ? d->scenePos : QPointF(); }
+
+/*!
+ \property QEventPoint::scenePressPosition
+ \brief the scene position at which this point was pressed.
+
+ The scene position is the position relative to QQuickWindow if handled in QQuickItem::event(),
+ in QGraphicsScene coordinates if handled by an override of QGraphicsItem::touchEvent(),
+ or the window position in widget applications.
+
+ \sa scenePosition, pressPosition, globalPressPosition
+*/
+QPointF QEventPoint::scenePressPosition() const
+{ return d ? d->globalPressPos - d->globalPos + d->scenePos : QPointF(); }
+
+/*!
+ \property QEventPoint::sceneGrabPosition
+ \brief the scene position at which this point was grabbed.
+
+ The scene position is the position relative to QQuickWindow if handled in QQuickItem::event(),
+ in QGraphicsScene coordinates if handled by an override of QGraphicsItem::touchEvent(),
+ or the window position in widget applications.
+
+ \sa scenePosition, grabPosition, globalGrabPosition
+*/
+QPointF QEventPoint::sceneGrabPosition() const
+{ return d ? d->globalGrabPos - d->globalPos + d->scenePos : QPointF(); }
+
+/*!
+ \property QEventPoint::sceneLastPosition
+ \brief the scene position of this point from the previous press or move event.
+
+ The scene position is the position relative to QQuickWindow if handled in QQuickItem::event(),
+ in QGraphicsScene coordinates if handled by an override of QGraphicsItem::touchEvent(),
+ or the window position in widget applications.
+
+ \sa scenePosition, scenePressPosition
+*/
+QPointF QEventPoint::sceneLastPosition() const
+{ return d ? d->globalLastPos - d->globalPos + d->scenePos : QPointF(); }
+
+/*!
+ \property QEventPoint::globalPosition
+ \brief the global position of this point.
+
+ The global position is relative to the screen or virtual desktop.
+
+ \sa globalPressPosition, position, scenePosition
+*/
+QPointF QEventPoint::globalPosition() const
+{ return d ? d->globalPos : QPointF(); }
+
+/*!
+ \property QEventPoint::globalPressPosition
+ \brief the global position at which this point was pressed.
+
+ The global position is relative to the screen or virtual desktop.
+
+ \sa globalPosition, pressPosition, scenePressPosition
+*/
+QPointF QEventPoint::globalPressPosition() const
+{ return d ? d->globalPressPos : QPointF(); }
+
+/*!
+ \property QEventPoint::globalGrabPosition
+ \brief the global position at which this point was grabbed.
+
+ The global position is relative to the screen or virtual desktop.
+
+ \sa globalPosition, grabPosition, sceneGrabPosition
+*/
+QPointF QEventPoint::globalGrabPosition() const
+{ return d ? d->globalGrabPos : QPointF(); }
+
+/*!
+ \property QEventPoint::globalLastPosition
+ \brief the global position of this point from the previous press or move event.
+
+ The global position is relative to the screen or virtual desktop.
+
+ \sa globalPosition, lastPosition, sceneLastPosition
+*/
+QPointF QEventPoint::globalLastPosition() const
+{ return d ? d->globalLastPos : QPointF(); }
+
+/*!
+ \property QEventPoint::velocity
+ \brief a velocity vector, in units of pixels per second, in the coordinate.
+ system of the screen or desktop.
+
+ \note If the device's capabilities include QInputDevice::Velocity, it means
+ velocity comes from the operating system (perhaps the touch hardware or
+ driver provides it). But usually the \c Velocity capability is not set,
+ indicating that the velocity is calculated by Qt, using a simple Kalman
+ filter to provide a smoothed average velocity rather than an instantaneous
+ value. Effectively it tells how fast and in what direction the user has
+ been dragging this point over the last few events, with the most recent
+ event having the strongest influence.
+
+ \sa QInputDevice::capabilities(), QInputEvent::device()
+*/
+QVector2D QEventPoint::velocity() const
+{ return d ? d->velocity : QVector2D(); }
+
+/*!
+ \property QEventPoint::state
+ \brief the current state of the event point.
+*/
+QEventPoint::State QEventPoint::state() const
+{ return d ? d->state : QEventPoint::State::Unknown; }
+
+/*!
+ \property QEventPoint::device
+ \brief the pointing device from which this event point originates.
+*/
+const QPointingDevice *QEventPoint::device() const
+{ return d ? d->device : nullptr; }
+
+/*!
+ \property QEventPoint::id
+ \brief the ID number of this event point.
+
+ \note Do not assume that ID numbers start at zero or that they are
+ sequential. Such an assumption is often false due to the way
+ the underlying drivers work.
+*/
+int QEventPoint::id() const
+{ return d ? d->pointId : -1; }
+
+/*!
+ \property QEventPoint::uniqueId
+ \brief the unique ID of this point or token, if any.
+
+ It is often invalid (see \l {QPointingDeviceUniqueId::isValid()} {isValid()}),
+ because touchscreens cannot uniquely identify fingers.
+
+ When it comes from a QTabletEvent, it identifies the serial number of the
+ stylus in use.
+
+ It may identify a specific token (fiducial object) when the TUIO driver is
+ in use with a touchscreen that supports them.
+*/
+QPointingDeviceUniqueId QEventPoint::uniqueId() const
+{ return d ? d->uniqueId : QPointingDeviceUniqueId(); }
+
+/*!
+ \property QEventPoint::timestamp
+ \brief the most recent time at which this point was included in a QPointerEvent.
+
+ \sa QPointerEvent::timestamp()
+*/
+ulong QEventPoint::timestamp() const
+{ return d ? d->timestamp : 0; }
+
+/*!
+ \property QEventPoint::lastTimestamp
+ \brief the time from the previous QPointerEvent that contained this point.
+
+ \sa globalLastPosition
+*/
+ulong QEventPoint::lastTimestamp() const
+{ return d ? d->lastTimestamp : 0; }
+
+/*!
+ \property QEventPoint::pressTimestamp
+ \brief the most recent time at which this point was pressed.
+
+ \sa timestamp
+*/
+ulong QEventPoint::pressTimestamp() const
+{ return d ? d->pressTimestamp : 0; }
+
+/*!
+ \property QEventPoint::timeHeld
+ \brief the duration, in seconds, since this point was pressed and not released.
+
+ \sa pressTimestamp, timestamp
+*/
+qreal QEventPoint::timeHeld() const
+{ return d ? (d->timestamp - d->pressTimestamp) / qreal(1000) : 0.0; }
+
+/*!
+ \property QEventPoint::pressure
+ \brief the pressure of this point.
+
+ The return value is in the range \c 0.0 to \c 1.0.
+*/
+qreal QEventPoint::pressure() const
+{ return d ? d->pressure : 0.0; }
+
+/*!
+ \property QEventPoint::rotation
+ \brief the angular orientation of this point.
+
+ The return value is in degrees, where zero (the default) indicates the finger,
+ token or stylus is pointing upwards, a negative angle means it's rotated to the
+ left, and a positive angle means it's rotated to the right.
+ Most touchscreens do not detect rotation, so zero is the most common value.
+*/
+qreal QEventPoint::rotation() const
+{ return d ? d->rotation : 0.0; }
+
+/*!
+ \property QEventPoint::ellipseDiameters
+ \brief the width and height of the bounding ellipse of the touch point.
+
+ The return value is in logical pixels. Most touchscreens do not detect the
+ shape of the contact point, and no mice or tablet devices can detect it,
+ so a null size is the most common value. On some touchscreens the diameters
+ may be nonzero and always equal (the ellipse is approximated as a circle).
+*/
+QSizeF QEventPoint::ellipseDiameters() const
+{ return d ? d->ellipseDiameters : QSizeF(); }
+
+/*!
+ \property QEventPoint::accepted
+ \brief the accepted state of the event point.
+
+ In widget-based applications, this property is not used, as it's only meaningful
+ for a widget to accept or reject a complete QInputEvent.
+
+ In Qt Quick however, it's normal for an Item or Event Handler to accept
+ only the individual points in a QTouchEvent that are actually participating
+ in a gesture, while other points can be delivered to other items or
+ handlers. For the sake of consistency, that applies to any QPointerEvent;
+ and delivery is done only when all points in a QPointerEvent have been
+ accepted.
+
+ \sa QEvent::accepted
+*/
+void QEventPoint::setAccepted(bool accepted)
+{
+ if (d)
+ d->accept = accepted;
+}
+
+bool QEventPoint::isAccepted() const
+{ return d ? d->accept : false; }
+
+
+/*!
+ \fn QPointF QEventPoint::normalizedPos() const
+ \deprecated [6.0] Use normalizedPosition() instead.
+*/
+
+/*!
+ Returns the normalized position of this point.
+
+ The coordinates are calculated by transforming globalPosition() into the
+ space of QInputDevice::availableVirtualGeometry(), i.e. \c (0, 0) is the
+ top-left corner and \c (1, 1) is the bottom-right corner.
+
+ \sa globalPosition
+*/
+QPointF QEventPoint::normalizedPosition() const
+{
+ if (!d)
+ return {};
+
+ auto geom = d->device->availableVirtualGeometry();
+ if (geom.isNull())
+ return QPointF();
+ return (globalPosition() - geom.topLeft()) / geom.width();
+}
+
+#if QT_DEPRECATED_SINCE(6, 0)
+/*!
+ \deprecated [6.0] Use globalPressPosition() instead.
+
+ Returns the normalized press position of this point.
+*/
+QPointF QEventPoint::startNormalizedPos() const
+{
+ if (!d)
+ return {};
+
+ auto geom = d->device->availableVirtualGeometry();
+ if (geom.isNull())
+ return QPointF();
+ return (globalPressPosition() - geom.topLeft()) / geom.width();
+}
+
+/*!
+ \deprecated [6.0] Use globalLastPosition() instead.
+
+ Returns the normalized position of this point from the previous press or
+ move event.
+
+ The coordinates are normalized to QInputDevice::availableVirtualGeometry(),
+ i.e. \c (0, 0) is the top-left corner and \c (1, 1) is the bottom-right corner.
+
+ \sa normalizedPosition(), globalPressPosition()
+*/
+QPointF QEventPoint::lastNormalizedPos() const
+{
+ if (!d)
+ return {};
+
+ auto geom = d->device->availableVirtualGeometry();
+ if (geom.isNull())
+ return QPointF();
+ return (globalLastPosition() - geom.topLeft()) / geom.width();
+}
+#endif // QT_DEPRECATED_SINCE(6, 0)
+
+/*! \internal
+ This class is explicitly shared, which means if you construct an event and
+ then the point(s) that it holds are modified before the event is delivered,
+ the event will be seen to hold the modified points. The workaround is that
+ any code which modifies an eventpoint that could already be included in an
+ event, or code that wants to save an eventpoint for later, has
+ responsibility to detach before calling any setters, so as to hold and
+ modify an independent copy. (The independent copy can then be used in a
+ subsequent event.)
+*/
+void QMutableEventPoint::detach(QEventPoint &p)
+{
+ if (p.d)
+ p.d.detach();
+ else
+ p.d.reset(new QEventPointPrivate(-1, nullptr));
+}
+
+/*! \internal
+ Update \a target state from the \a other point, assuming that \a target
+ contains state from the previous event and \a other contains new
+ values that came in from a device.
+
+ That is: global position and other valuators will be updated, but
+ the following properties will not be updated:
+
+ \list
+ \li properties that are not likely to be set after a fresh touchpoint
+ has been received from a device
+ \li properties that should be persistent between events (such as grabbers)
+ \endlist
+*/
+void QMutableEventPoint::update(const QEventPoint &other, QEventPoint &target)
+{
+ detach(target);
+ setPressure(target, other.pressure());
+
+ switch (other.state()) {
+ case QEventPoint::State::Pressed:
+ setGlobalPressPosition(target, other.globalPosition());
+ setGlobalLastPosition(target, other.globalPosition());
+ if (target.pressure() < 0)
+ setPressure(target, 1);
+ break;
+
+ case QEventPoint::State::Released:
+ if (target.globalPosition() != other.globalPosition())
+ setGlobalLastPosition(target, target.globalPosition());
+ setPressure(target, 0);
+ break;
+
+ default: // update or stationary
+ if (target.globalPosition() != other.globalPosition())
+ setGlobalLastPosition(target, target.globalPosition());
+ if (target.pressure() < 0)
+ setPressure(target, 1);
+ break;
+ }
+
+ setState(target, other.state());
+ setPosition(target, other.position());
+ setScenePosition(target, other.scenePosition());
+ setGlobalPosition(target, other.globalPosition());
+ setEllipseDiameters(target, other.ellipseDiameters());
+ setRotation(target, other.rotation());
+ setVelocity(target, other.velocity());
+ setUniqueId(target, other.uniqueId()); // for TUIO
+}
+
+/*! \internal
+ Set the timestamp from the event that updated this point's positions,
+ and calculate a new value for velocity().
+
+ The velocity calculation is done here because none of the QPointerEvent
+ subclass constructors take the timestamp directly, and because
+ QGuiApplication traditionally constructs an event first and then sets its
+ timestamp (see for example QGuiApplicationPrivate::processMouseEvent()).
+
+ This function looks up the corresponding instance in QPointingDevicePrivate::activePoints,
+ and assumes that its timestamp() still holds the previous time when this point
+ was updated, its velocity() holds this point's last-known velocity, and
+ its globalPosition() and globalLastPosition() hold this point's current
+ and previous positions, respectively. We assume timestamps are in milliseconds.
+
+ The velocity calculation is skipped if the platform has promised to
+ provide velocities already by setting the QInputDevice::Velocity capability.
+*/
+void QMutableEventPoint::setTimestamp(QEventPoint &p, ulong t)
+{
+ // On mouse press, if the mouse has moved from its last-known location,
+ // QGuiApplicationPrivate::processMouseEvent() sends first a mouse move and
+ // then a press. Both events will get the same timestamp. So we need to set
+ // the press timestamp and position even when the timestamp isn't advancing,
+ // but skip setting lastTimestamp and velocity because those need a time delta.
+ if (p.d) {
+ if (p.state() == QEventPoint::State::Pressed) {
+ p.d->pressTimestamp = t;
+ p.d->globalPressPos = p.d->globalPos;
+ }
+ if (p.d->timestamp == t)
+ return;
+ }
+ detach(p);
+ if (p.device()) {
+ // get the persistent instance out of QPointingDevicePrivate::activePoints
+ // (which sometimes might be the same as this instance)
+ QEventPointPrivate *pd = QPointingDevicePrivate::get(
+ const_cast<QPointingDevice *>(p.d->device))->pointById(p.id())->eventPoint.d.get();
+ if (t > pd->timestamp) {
+ pd->lastTimestamp = pd->timestamp;
+ pd->timestamp = t;
+ if (p.state() == QEventPoint::State::Pressed)
+ pd->pressTimestamp = t;
+ if (pd->lastTimestamp > 0 && !p.device()->capabilities().testFlag(QInputDevice::Capability::Velocity)) {
+ // calculate instantaneous velocity according to time and distance moved since the previous point
+ QVector2D newVelocity = QVector2D(pd->globalPos - pd->globalLastPos) / (t - pd->lastTimestamp) * 1000;
+ // VERY simple kalman filter: does a weighted average
+ // where the older velocities get less and less significant
+ static const float KalmanGain = 0.7f;
+ pd->velocity = newVelocity * KalmanGain + pd->velocity * (1.0f - KalmanGain);
+ qCDebug(lcPointerVel) << "velocity" << newVelocity << "filtered" << pd->velocity <<
+ "based on movement" << pd->globalLastPos << "->" << pd->globalPos <<
+ "over time" << pd->lastTimestamp << "->" << pd->timestamp;
+ }
+ if (p.d != pd) {
+ p.d->lastTimestamp = pd->lastTimestamp;
+ p.d->velocity = pd->velocity;
+ }
+ }
+ }
+ p.d->timestamp = t;
+}
+
+/*!
+ \fn void QMutableEventPoint::setPosition(QPointF pos)
+ \internal
+
+ Sets the localized position.
+ Often events need to be localized before delivery to specific widgets or
+ items. This can be done directly, or in a copy (for which we have a copy
+ constructor), depending on whether the original point needs to be retained.
+ Usually it's calculated by mapping scenePosition() to the target anyway.
+*/
+
+QT_END_NAMESPACE
+
+#include "moc_qeventpoint.cpp"
diff --git a/src/gui/kernel/qeventpoint.h b/src/gui/kernel/qeventpoint.h
new file mode 100644
index 0000000000..518faecee2
--- /dev/null
+++ b/src/gui/kernel/qeventpoint.h
@@ -0,0 +1,142 @@
+// Copyright (C) 2020 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
+
+#ifndef QEVENTPOINT_H
+#define QEVENTPOINT_H
+
+#include <QtGui/qtguiglobal.h>
+#include <QtGui/qvector2d.h>
+#include <QtGui/qpointingdevice.h>
+#include <QtCore/qshareddata.h>
+#include <QtCore/qmetatype.h>
+
+QT_BEGIN_NAMESPACE
+
+class QEventPointPrivate;
+QT_DECLARE_QESDP_SPECIALIZATION_DTOR_WITH_EXPORT(QEventPointPrivate, Q_GUI_EXPORT)
+class QMutableEventPoint;
+
+class Q_GUI_EXPORT QEventPoint
+{
+ Q_GADGET
+ Q_PROPERTY(bool accepted READ isAccepted WRITE setAccepted)
+ Q_PROPERTY(const QPointingDevice *device READ device CONSTANT)
+ Q_PROPERTY(int id READ id CONSTANT)
+ Q_PROPERTY(QPointingDeviceUniqueId uniqueId READ uniqueId CONSTANT)
+ Q_PROPERTY(State state READ state CONSTANT)
+ Q_PROPERTY(ulong timestamp READ timestamp CONSTANT)
+ Q_PROPERTY(ulong pressTimestamp READ pressTimestamp CONSTANT)
+ Q_PROPERTY(ulong lastTimestamp READ lastTimestamp CONSTANT)
+ Q_PROPERTY(qreal timeHeld READ timeHeld CONSTANT)
+ Q_PROPERTY(qreal pressure READ pressure CONSTANT)
+ Q_PROPERTY(qreal rotation READ rotation CONSTANT)
+ Q_PROPERTY(QSizeF ellipseDiameters READ ellipseDiameters CONSTANT)
+ Q_PROPERTY(QVector2D velocity READ velocity CONSTANT)
+ Q_PROPERTY(QPointF position READ position CONSTANT)
+ Q_PROPERTY(QPointF pressPosition READ pressPosition CONSTANT)
+ Q_PROPERTY(QPointF grabPosition READ grabPosition CONSTANT)
+ Q_PROPERTY(QPointF lastPosition READ lastPosition CONSTANT)
+ Q_PROPERTY(QPointF scenePosition READ scenePosition CONSTANT)
+ Q_PROPERTY(QPointF scenePressPosition READ scenePressPosition CONSTANT)
+ Q_PROPERTY(QPointF sceneGrabPosition READ sceneGrabPosition CONSTANT)
+ Q_PROPERTY(QPointF sceneLastPosition READ sceneLastPosition CONSTANT)
+ Q_PROPERTY(QPointF globalPosition READ globalPosition CONSTANT)
+ Q_PROPERTY(QPointF globalPressPosition READ globalPressPosition CONSTANT)
+ Q_PROPERTY(QPointF globalGrabPosition READ globalGrabPosition CONSTANT)
+ Q_PROPERTY(QPointF globalLastPosition READ globalLastPosition CONSTANT)
+public:
+ enum State : quint8 {
+ Unknown = Qt::TouchPointUnknownState,
+ Stationary = Qt::TouchPointStationary,
+ Pressed = Qt::TouchPointPressed,
+ Updated = Qt::TouchPointMoved,
+ Released = Qt::TouchPointReleased
+ };
+ Q_DECLARE_FLAGS(States, State)
+ Q_FLAG(States)
+
+ explicit QEventPoint(int id = -1, const QPointingDevice *device = nullptr);
+ QEventPoint(int pointId, State state, const QPointF &scenePosition, const QPointF &globalPosition);
+ QEventPoint(const QEventPoint &other) noexcept;
+ QEventPoint &operator=(const QEventPoint &other) noexcept;
+ QEventPoint(QEventPoint && other) noexcept = default;
+ QT_MOVE_ASSIGNMENT_OPERATOR_IMPL_VIA_PURE_SWAP(QEventPoint)
+ bool operator==(const QEventPoint &other) const noexcept;
+ bool operator!=(const QEventPoint &other) const noexcept { return !operator==(other); }
+ ~QEventPoint();
+ inline void swap(QEventPoint &other) noexcept
+ { d.swap(other.d); }
+
+ QPointF position() const;
+ QPointF pressPosition() const;
+ QPointF grabPosition() const;
+ QPointF lastPosition() const;
+ QPointF scenePosition() const;
+ QPointF scenePressPosition() const;
+ QPointF sceneGrabPosition() const;
+ QPointF sceneLastPosition() const;
+ QPointF globalPosition() const;
+ QPointF globalPressPosition() const;
+ QPointF globalGrabPosition() const;
+ QPointF globalLastPosition() const;
+ QPointF normalizedPosition() const;
+
+#if QT_DEPRECATED_SINCE(6, 0)
+ // QEventPoint replaces QTouchEvent::TouchPoint, so we need all its old accessors, for now
+ QT_DEPRECATED_VERSION_X_6_0("Use position()")
+ QPointF pos() const { return position(); }
+ QT_DEPRECATED_VERSION_X_6_0("Use pressPosition()")
+ QPointF startPos() const { return pressPosition(); }
+ QT_DEPRECATED_VERSION_X_6_0("Use scenePosition()")
+ QPointF scenePos() const { return scenePosition(); }
+ QT_DEPRECATED_VERSION_X_6_0("Use scenePressPosition()")
+ QPointF startScenePos() const { return scenePressPosition(); }
+ QT_DEPRECATED_VERSION_X_6_0("Use globalPosition()")
+ QPointF screenPos() const { return globalPosition(); }
+ QT_DEPRECATED_VERSION_X_6_0("Use globalPressPosition()")
+ QPointF startScreenPos() const { return globalPressPosition(); }
+ QT_DEPRECATED_VERSION_X_6_0("Use globalPressPosition()")
+ QPointF startNormalizedPos() const;
+ QT_DEPRECATED_VERSION_X_6_0("Use normalizedPosition()")
+ QPointF normalizedPos() const { return normalizedPosition(); }
+ QT_DEPRECATED_VERSION_X_6_0("Use lastPosition()")
+ QPointF lastPos() const { return lastPosition(); }
+ QT_DEPRECATED_VERSION_X_6_0("Use sceneLastPosition()")
+ QPointF lastScenePos() const { return sceneLastPosition(); }
+ QT_DEPRECATED_VERSION_X_6_0("Use globalLastPosition()")
+ QPointF lastScreenPos() const { return globalLastPosition(); }
+ QT_DEPRECATED_VERSION_X_6_0("Use globalLastPosition()")
+ QPointF lastNormalizedPos() const;
+#endif // QT_DEPRECATED_SINCE(6, 0)
+ QVector2D velocity() const;
+ State state() const;
+ const QPointingDevice *device() const;
+ int id() const;
+ QPointingDeviceUniqueId uniqueId() const;
+ ulong timestamp() const;
+ ulong lastTimestamp() const;
+ ulong pressTimestamp() const;
+ qreal timeHeld() const;
+ qreal pressure() const;
+ qreal rotation() const;
+ QSizeF ellipseDiameters() const;
+
+ bool isAccepted() const;
+ void setAccepted(bool accepted = true);
+
+private:
+ QExplicitlySharedDataPointer<QEventPointPrivate> d;
+ friend class QMutableEventPoint;
+ friend class QPointerEvent;
+};
+
+#ifndef QT_NO_DEBUG_STREAM
+Q_GUI_EXPORT QDebug operator<<(QDebug, const QEventPoint *);
+Q_GUI_EXPORT QDebug operator<<(QDebug, const QEventPoint &);
+#endif
+
+Q_DECLARE_SHARED(QEventPoint)
+
+QT_END_NAMESPACE
+
+#endif // QEVENTPOINT_H
diff --git a/src/gui/kernel/qeventpoint_p.h b/src/gui/kernel/qeventpoint_p.h
new file mode 100644
index 0000000000..c339c7e3e1
--- /dev/null
+++ b/src/gui/kernel/qeventpoint_p.h
@@ -0,0 +1,141 @@
+// Copyright (C) 2020 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
+
+#ifndef QEVENTPOINT_P_H
+#define QEVENTPOINT_P_H
+
+//
+// W A R N I N G
+// -------------
+//
+// This file is not part of the Qt API. It exists for the convenience
+// of other Qt classes. This header file may change from version to
+// version without notice, or even be removed.
+//
+// We mean it.
+//
+
+#include <QtGui/private/qtguiglobal_p.h>
+#include <QtGui/qevent.h>
+
+#include <QtCore/qloggingcategory.h>
+#include <QtCore/qpointer.h>
+
+QT_BEGIN_NAMESPACE
+
+Q_DECLARE_LOGGING_CATEGORY(lcPointerVel);
+Q_DECLARE_LOGGING_CATEGORY(lcEPDetach);
+
+class QPointingDevice;
+
+class QEventPointPrivate : public QSharedData
+{
+public:
+ QEventPointPrivate(int id, const QPointingDevice *device)
+ : device(device), pointId(id) { }
+
+ QEventPointPrivate(int pointId, QEventPoint::State state, const QPointF &scenePosition, const QPointF &globalPosition)
+ : scenePos(scenePosition), globalPos(globalPosition), pointId(pointId), state(state)
+ {
+ if (state == QEventPoint::State::Released)
+ pressure = 0;
+ }
+ inline bool operator==(const QEventPointPrivate &other) const
+ {
+ return device == other.device
+ && window == other.window
+ && target == other.target
+ && pos == other.pos
+ && scenePos == other.scenePos
+ && globalPos == other.globalPos
+ && globalPressPos == other.globalPressPos
+ && globalGrabPos == other.globalGrabPos
+ && globalLastPos == other.globalLastPos
+ && pressure == other.pressure
+ && rotation == other.rotation
+ && ellipseDiameters == other.ellipseDiameters
+ && velocity == other.velocity
+ && timestamp == other.timestamp
+ && lastTimestamp == other.lastTimestamp
+ && pressTimestamp == other.pressTimestamp
+ && uniqueId == other.uniqueId
+ && pointId == other.pointId
+ && state == other.state;
+ }
+
+ const QPointingDevice *device = nullptr;
+ QPointer<QWindow> window;
+ QPointer<QObject> target;
+ QPointF pos, scenePos, globalPos,
+ globalPressPos, globalGrabPos, globalLastPos;
+ qreal pressure = 1;
+ qreal rotation = 0;
+ QSizeF ellipseDiameters = QSizeF(0, 0);
+ QVector2D velocity;
+ ulong timestamp = 0;
+ ulong lastTimestamp = 0;
+ ulong pressTimestamp = 0;
+ QPointingDeviceUniqueId uniqueId;
+ int pointId = -1;
+ QEventPoint::State state = QEventPoint::State::Unknown;
+ bool accept = false;
+};
+
+// Private subclasses to allow accessing and modifying protected variables.
+// These should NOT hold any extra state.
+
+class QMutableEventPoint
+{
+public:
+ static QEventPoint withTimeStamp(ulong timestamp, int pointId, QEventPoint::State state,
+ QPointF position, QPointF scenePosition, QPointF globalPosition)
+ {
+ QEventPoint p(pointId, state, scenePosition, globalPosition);
+ p.d->timestamp = timestamp;
+ p.d->pos = position;
+ return p;
+ }
+
+ static Q_GUI_EXPORT void update(const QEventPoint &from, QEventPoint &to);
+
+ static Q_GUI_EXPORT void detach(QEventPoint &p);
+
+#define TRIVIAL_SETTER(type, field, Field) \
+ static void set##Field (QEventPoint &p, type arg) { p.d->field = std::move(arg); } \
+ /* end */
+
+ TRIVIAL_SETTER(int, pointId, Id)
+ TRIVIAL_SETTER(const QPointingDevice *, device, Device)
+
+ // not trivial:
+ static Q_GUI_EXPORT void setTimestamp(QEventPoint &p, ulong t);
+
+ TRIVIAL_SETTER(ulong, pressTimestamp, PressTimestamp)
+ TRIVIAL_SETTER(QEventPoint::State, state, State)
+ TRIVIAL_SETTER(QPointingDeviceUniqueId, uniqueId, UniqueId)
+ TRIVIAL_SETTER(QPointF, pos, Position)
+ TRIVIAL_SETTER(QPointF, scenePos, ScenePosition)
+ TRIVIAL_SETTER(QPointF, globalPos, GlobalPosition)
+
+ TRIVIAL_SETTER(QPointF, globalPressPos, GlobalPressPosition)
+ TRIVIAL_SETTER(QPointF, globalGrabPos, GlobalGrabPosition)
+ TRIVIAL_SETTER(QPointF, globalLastPos, GlobalLastPosition)
+ TRIVIAL_SETTER(QSizeF, ellipseDiameters, EllipseDiameters)
+ TRIVIAL_SETTER(qreal, pressure, Pressure)
+ TRIVIAL_SETTER(qreal, rotation, Rotation)
+ TRIVIAL_SETTER(QVector2D, velocity, Velocity)
+
+ static QWindow *window(const QEventPoint &p) { return p.d->window.data(); }
+
+ TRIVIAL_SETTER(QWindow *, window, Window)
+
+ static QObject *target(const QEventPoint &p) { return p.d->target.data(); }
+
+ TRIVIAL_SETTER(QObject *, target, Target)
+
+#undef TRIVIAL_SETTER
+};
+
+QT_END_NAMESPACE
+
+#endif // QEVENTPOINT_P_H
diff --git a/src/gui/kernel/qgenericplugin.cpp b/src/gui/kernel/qgenericplugin.cpp
index a53b60b008..8411faeb1f 100644
--- a/src/gui/kernel/qgenericplugin.cpp
+++ b/src/gui/kernel/qgenericplugin.cpp
@@ -1,41 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the QtGui module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#include "qgenericplugin.h"
@@ -94,3 +58,5 @@ QGenericPlugin::~QGenericPlugin()
*/
QT_END_NAMESPACE
+
+#include "moc_qgenericplugin.cpp"
diff --git a/src/gui/kernel/qgenericplugin.h b/src/gui/kernel/qgenericplugin.h
index 69b4f29854..f76228dc8a 100644
--- a/src/gui/kernel/qgenericplugin.h
+++ b/src/gui/kernel/qgenericplugin.h
@@ -1,41 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the QtGui module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#ifndef QGENERICPLUGIN_H
#define QGENERICPLUGIN_H
diff --git a/src/gui/kernel/qgenericpluginfactory.cpp b/src/gui/kernel/qgenericpluginfactory.cpp
index 9f41b948c0..5ce13ad5e1 100644
--- a/src/gui/kernel/qgenericpluginfactory.cpp
+++ b/src/gui/kernel/qgenericpluginfactory.cpp
@@ -1,41 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the QtGui module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#include "qgenericpluginfactory.h"
@@ -46,9 +10,10 @@
QT_BEGIN_NAMESPACE
-Q_GLOBAL_STATIC_WITH_ARGS(QFactoryLoader, loader,
- (QGenericPluginFactoryInterface_iid,
- QLatin1String("/generic"), Qt::CaseInsensitive))
+using namespace Qt::StringLiterals;
+
+Q_GLOBAL_STATIC_WITH_ARGS(QFactoryLoader, gpLoader,
+ (QGenericPluginFactoryInterface_iid, "/generic"_L1, Qt::CaseInsensitive))
/*!
\class QGenericPluginFactory
@@ -69,7 +34,7 @@ Q_GLOBAL_STATIC_WITH_ARGS(QFactoryLoader, loader,
*/
QObject *QGenericPluginFactory::create(const QString& key, const QString &specification)
{
- return qLoadPlugin<QObject, QGenericPlugin>(loader(), key.toLower(), specification);
+ return qLoadPlugin<QObject, QGenericPlugin>(gpLoader(), key.toLower(), specification);
}
/*!
@@ -84,7 +49,7 @@ QStringList QGenericPluginFactory::keys()
typedef QMultiMap<int, QString> PluginKeyMap;
typedef PluginKeyMap::const_iterator PluginKeyMapConstIterator;
- const PluginKeyMap keyMap = loader()->keyMap();
+ const PluginKeyMap keyMap = gpLoader()->keyMap();
const PluginKeyMapConstIterator cend = keyMap.constEnd();
for (PluginKeyMapConstIterator it = keyMap.constBegin(); it != cend; ++it)
if (!list.contains(it.value()))
diff --git a/src/gui/kernel/qgenericpluginfactory.h b/src/gui/kernel/qgenericpluginfactory.h
index 9cc77a0590..710c983310 100644
--- a/src/gui/kernel/qgenericpluginfactory.h
+++ b/src/gui/kernel/qgenericpluginfactory.h
@@ -1,41 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the QtGui module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#ifndef QGENERICPLUGINFACTORY_H
#define QGENERICPLUGINFACTORY_H
diff --git a/src/gui/kernel/qguiaction_p.h b/src/gui/kernel/qguiaction_p.h
deleted file mode 100644
index 3358ed1070..0000000000
--- a/src/gui/kernel/qguiaction_p.h
+++ /dev/null
@@ -1,128 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2019 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the QtGui module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef QGUIACTION_P_H
-#define QGUIACTION_P_H
-
-//
-// W A R N I N G
-// -------------
-//
-// This file is not part of the Qt API. It exists for the convenience
-// of other Qt classes. This header file may change from version to
-// version without notice, or even be removed.
-//
-// We mean it.
-//
-
-#include <QtGui/private/qtguiglobal_p.h>
-#include <QtGui/qguiaction.h>
-#include <QtGui/qfont.h>
-#if QT_CONFIG(shortcut)
-# include <QtGui/private/qshortcutmap_p.h>
-#endif
-#include "private/qobject_p.h"
-
-QT_REQUIRE_CONFIG(action);
-
-QT_BEGIN_NAMESPACE
-
-class QShortcutMap;
-
-class Q_GUI_EXPORT QGuiActionPrivate : public QObjectPrivate
-{
- Q_DECLARE_PUBLIC(QGuiAction)
-public:
- QGuiActionPrivate();
- ~QGuiActionPrivate();
-
-#if QT_CONFIG(shortcut)
- virtual QShortcutMap::ContextMatcher contextMatcher() const;
-#endif
-
- static QGuiActionPrivate *get(QGuiAction *q)
- {
- return q->d_func();
- }
-
-
- QPointer<QGuiActionGroup> group;
- QString text;
- QString iconText;
- QIcon icon;
- QString tooltip;
- QString statustip;
- QString whatsthis;
-#if QT_CONFIG(shortcut)
- QKeySequence shortcut;
- QList<QKeySequence> alternateShortcuts;
-#endif
- QVariant userData;
-#if QT_CONFIG(shortcut)
- int shortcutId = 0;
- QVector<int> alternateShortcutIds;
- Qt::ShortcutContext shortcutContext = Qt::WindowShortcut;
- uint autorepeat : 1;
-#endif
- QFont font;
- uint enabled : 1, forceDisabled : 1;
- uint visible : 1, forceInvisible : 1;
- uint checkable : 1;
- uint checked : 1;
- uint separator : 1;
- uint fontSet : 1;
-
- int iconVisibleInMenu : 2; // Only has values -1, 0, and 1
- int shortcutVisibleInContextMenu : 2; // Only has values -1, 0, and 1
-
- QGuiAction::MenuRole menuRole = QGuiAction::TextHeuristicRole;
- QGuiAction::Priority priority = QGuiAction::NormalPriority;
-
-#if QT_CONFIG(shortcut)
- void redoGrab(QShortcutMap &map);
- void redoGrabAlternate(QShortcutMap &map);
- void setShortcutEnabled(bool enable, QShortcutMap &map);
-#endif // QT_NO_SHORTCUT
-
- void sendDataChanged();
-};
-
-QT_END_NAMESPACE
-
-#endif // QACTION_P_H
diff --git a/src/gui/kernel/qguiactiongroup.cpp b/src/gui/kernel/qguiactiongroup.cpp
deleted file mode 100644
index 82f5e0a0af..0000000000
--- a/src/gui/kernel/qguiactiongroup.cpp
+++ /dev/null
@@ -1,345 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2019 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the QtGui module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "qguiactiongroup.h"
-
-#include "qguiaction.h"
-#include "qguiaction_p.h"
-#include "qguiactiongroup_p.h"
-#include "qevent.h"
-#include "qlist.h"
-
-QT_BEGIN_NAMESPACE
-
-QGuiActionGroupPrivate::QGuiActionGroupPrivate() :
- enabled(1), visible(1)
-{
-}
-
-QGuiActionGroupPrivate::~QGuiActionGroupPrivate() = default;
-
-void QGuiActionGroup::_q_actionChanged()
-{
- Q_D(QGuiActionGroup);
- auto action = qobject_cast<QGuiAction*>(sender());
- Q_ASSERT_X(action != nullptr, "QGuiActionGroup::_q_actionChanged", "internal error");
- if (d->exclusionPolicy != QGuiActionGroup::ExclusionPolicy::None) {
- if (action->isChecked()) {
- if (action != d->current) {
- if (!d->current.isNull())
- d->current->setChecked(false);
- d->current = action;
- }
- } else if (action == d->current) {
- d->current = nullptr;
- }
- }
-}
-
-void QGuiActionGroup::_q_actionTriggered()
-{
- Q_D(QGuiActionGroup);
- auto action = qobject_cast<QGuiAction*>(sender());
- Q_ASSERT_X(action != nullptr, "QGuiActionGroup::_q_actionTriggered", "internal error");
- d->emitSignal(QGuiActionGroupPrivate::Triggered, action);
-}
-
-void QGuiActionGroup::_q_actionHovered()
-{
- Q_D(QGuiActionGroup);
- auto action = qobject_cast<QGuiAction*>(sender());
- Q_ASSERT_X(action != nullptr, "QGuiActionGroup::_q_actionHovered", "internal error");
- d->emitSignal(QGuiActionGroupPrivate::Hovered, action);
-}
-
-/*!
- \class QGuiActionGroup
- \brief The QGuiActionGroup class groups actions together.
- \since 6.0
-
- \inmodule QtGui
-
- QGuiActionGroup is a base class for classes grouping
- classes inhheriting QGuiAction objects together.
-
- In some situations it is useful to group QGuiAction objects together.
- For example, if you have a \uicontrol{Left Align} action, a \uicontrol{Right
- Align} action, a \uicontrol{Justify} action, and a \uicontrol{Center} action,
- only one of these actions should be active at any one time. One
- simple way of achieving this is to group the actions together in
- an action group, inheriting QGuiActionGroup.
-
- \sa QGuiAction
-*/
-
-/*!
- \enum QGuiActionGroup::ExclusionPolicy
-
- This enum specifies the different policies that can be used to
- control how the group performs exclusive checking on checkable actions.
-
- \value None
- The actions in the group can be checked independently of each other.
-
- \value Exclusive
- Exactly one action can be checked at any one time.
- This is the default policy.
-
- \value ExclusiveOptional
- At most one action can be checked at any one time. The actions
- can also be all unchecked.
-
- \sa exclusionPolicy
-*/
-
-/*!
- Constructs an action group for the \a parent object.
-
- The action group is exclusive by default. Call setExclusive(false)
- to make the action group non-exclusive. To make the group exclusive
- but allow unchecking the active action call instead
- setExclusionPolicy(QGuiActionGroup::ExclusionPolicy::ExclusiveOptional)
-*/
-QGuiActionGroup::QGuiActionGroup(QObject* parent) :
- QGuiActionGroup(*new QGuiActionGroupPrivate, parent)
-{
-}
-
-QGuiActionGroup::QGuiActionGroup(QGuiActionGroupPrivate &dd, QObject *parent) :
- QObject(dd, parent)
-{
-}
-
-/*!
- Destroys the action group.
-*/
-QGuiActionGroup::~QGuiActionGroup() = default;
-
-/*!
- \fn QGuiAction *QGuiActionGroup::addAction(QGuiAction *action)
-
- Adds the \a action to this group, and returns it.
-
- Normally an action is added to a group by creating it with the
- group as its parent, so this function is not usually used.
-
- \sa QGuiAction::setActionGroup()
-*/
-QGuiAction *QGuiActionGroup::addAction(QGuiAction* a)
-{
- Q_D(QGuiActionGroup);
- if (!d->actions.contains(a)) {
- d->actions.append(a);
- QObject::connect(a, &QGuiAction::triggered, this, &QGuiActionGroup::_q_actionTriggered);
- QObject::connect(a, &QGuiAction::changed, this, &QGuiActionGroup::_q_actionChanged);
- QObject::connect(a, &QGuiAction::hovered, this, &QGuiActionGroup::_q_actionHovered);
- }
- if (!a->d_func()->forceDisabled) {
- a->setEnabled(d->enabled);
- a->d_func()->forceDisabled = false;
- }
- if (!a->d_func()->forceInvisible) {
- a->setVisible(d->visible);
- a->d_func()->forceInvisible = false;
- }
- if (a->isChecked())
- d->current = a;
- QGuiActionGroup *oldGroup = a->d_func()->group;
- if (oldGroup != this) {
- if (oldGroup)
- oldGroup->removeAction(a);
- a->d_func()->group = this;
- a->d_func()->sendDataChanged();
- }
- return a;
-}
-
-/*!
- Removes the \a action from this group. The action will have no
- parent as a result.
-
- \sa QGuiAction::setActionGroup()
-*/
-void QGuiActionGroup::removeAction(QGuiAction *action)
-{
- Q_D(QGuiActionGroup);
- if (d->actions.removeAll(action)) {
- if (action == d->current)
- d->current = nullptr;
- QObject::disconnect(action, &QGuiAction::triggered, this, &QGuiActionGroup::_q_actionTriggered);
- QObject::disconnect(action, &QGuiAction::changed, this, &QGuiActionGroup::_q_actionChanged);
- QObject::disconnect(action, &QGuiAction::hovered, this, &QGuiActionGroup::_q_actionHovered);
- action->d_func()->group = nullptr;
- }
-}
-
-/*!
- Returns the list of this groups's actions. This may be empty.
-*/
-QList<QGuiAction*> QGuiActionGroup::guiActions() const
-{
- Q_D(const QGuiActionGroup);
- return d->actions;
-}
-
-/*!
- \brief Enable or disable the group exclusion checking
-
- This is a convenience method that calls
- setExclusionPolicy(ExclusionPolicy::Exclusive).
-
- \sa QGuiActionGroup::exclusionPolicy
-*/
-void QGuiActionGroup::setExclusive(bool b)
-{
- setExclusionPolicy(b ? QGuiActionGroup::ExclusionPolicy::Exclusive
- : QGuiActionGroup::ExclusionPolicy::None);
-}
-
-/*!
- \brief Returs true if the group is exclusive
-
- The group is exclusive if the ExclusionPolicy is either Exclusive
- or ExclusionOptional.
-
-*/
-bool QGuiActionGroup::isExclusive() const
-{
- return exclusionPolicy() != QGuiActionGroup::ExclusionPolicy::None;
-}
-
-/*!
- \property QGuiActionGroup::exclusionPolicy
- \brief This property holds the group exclusive checking policy
-
- If exclusionPolicy is set to Exclusive, only one checkable
- action in the action group can ever be active at any time. If the user
- chooses another checkable action in the group, the one they chose becomes
- active and the one that was active becomes inactive. If exclusionPolicy is
- set to ExclusionOptional the group is exclusive but the active checkable
- action in the group can be unchecked leaving the group with no actions
- checked.
-
- \sa QGuiAction::checkable
-*/
-void QGuiActionGroup::setExclusionPolicy(QGuiActionGroup::ExclusionPolicy policy)
-{
- Q_D(QGuiActionGroup);
- d->exclusionPolicy = policy;
-}
-
-QGuiActionGroup::ExclusionPolicy QGuiActionGroup::exclusionPolicy() const
-{
- Q_D(const QGuiActionGroup);
- return d->exclusionPolicy;
-}
-
-/*!
- \fn void QGuiActionGroup::setDisabled(bool b)
-
- This is a convenience function for the \l enabled property, that
- is useful for signals--slots connections. If \a b is true the
- action group is disabled; otherwise it is enabled.
-*/
-
-/*!
- \property QGuiActionGroup::enabled
- \brief whether the action group is enabled
-
- Each action in the group will be enabled or disabled unless it
- has been explicitly disabled.
-
- \sa QGuiAction::setEnabled()
-*/
-void QGuiActionGroup::setEnabled(bool b)
-{
- Q_D(QGuiActionGroup);
- d->enabled = b;
- for (auto action : qAsConst(d->actions)) {
- if (!action->d_func()->forceDisabled) {
- action->setEnabled(b);
- action->d_func()->forceDisabled = false;
- }
- }
-}
-
-bool QGuiActionGroup::isEnabled() const
-{
- Q_D(const QGuiActionGroup);
- return d->enabled;
-}
-
-/*!
- Returns the currently checked action in the group, or \nullptr if
- none are checked.
-*/
-QGuiAction *QGuiActionGroup::checkedGuiAction() const
-{
- Q_D(const QGuiActionGroup);
- return d->current.data();
-}
-
-/*!
- \property QGuiActionGroup::visible
- \brief whether the action group is visible
-
- Each action in the action group will match the visible state of
- this group unless it has been explicitly hidden.
-
- \sa QGuiAction::setEnabled()
-*/
-void QGuiActionGroup::setVisible(bool b)
-{
- Q_D(QGuiActionGroup);
- d->visible = b;
- for (auto action : qAsConst(d->actions)) {
- if (!action->d_func()->forceInvisible) {
- action->setVisible(b);
- action->d_func()->forceInvisible = false;
- }
- }
-}
-
-bool QGuiActionGroup::isVisible() const
-{
- Q_D(const QGuiActionGroup);
- return d->visible;
-}
-
-QT_END_NAMESPACE
diff --git a/src/gui/kernel/qguiactiongroup.h b/src/gui/kernel/qguiactiongroup.h
deleted file mode 100644
index ef08fb2e04..0000000000
--- a/src/gui/kernel/qguiactiongroup.h
+++ /dev/null
@@ -1,104 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2019 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the QtGui module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef QGUIACTIONGROUP_H
-#define QGUIACTIONGROUP_H
-
-#include <QtGui/qtguiglobal.h>
-#include <QtGui/qguiaction.h>
-
-QT_REQUIRE_CONFIG(action);
-
-QT_BEGIN_NAMESPACE
-
-class QGuiActionGroupPrivate;
-
-class Q_GUI_EXPORT QGuiActionGroup : public QObject
-{
- Q_OBJECT
- Q_DECLARE_PRIVATE(QGuiActionGroup)
-
- Q_PROPERTY(QGuiActionGroup::ExclusionPolicy exclusionPolicy READ exclusionPolicy WRITE setExclusionPolicy)
- Q_PROPERTY(bool enabled READ isEnabled WRITE setEnabled)
- Q_PROPERTY(bool visible READ isVisible WRITE setVisible)
-
-public:
- enum class ExclusionPolicy {
- None,
- Exclusive,
- ExclusiveOptional
- };
- Q_ENUM(ExclusionPolicy)
-
- explicit QGuiActionGroup(QObject *parent);
- ~QGuiActionGroup();
-
- QGuiAction *addAction(QGuiAction *a);
- void removeAction(QGuiAction *a);
- QList<QGuiAction*> guiActions() const;
- QGuiAction *checkedGuiAction() const;
-
- bool isExclusive() const;
- bool isEnabled() const;
- bool isVisible() const;
- ExclusionPolicy exclusionPolicy() const;
-
-
-public Q_SLOTS:
- void setEnabled(bool);
- inline void setDisabled(bool b) { setEnabled(!b); }
- void setVisible(bool);
- void setExclusive(bool);
- void setExclusionPolicy(ExclusionPolicy policy);
-
-private Q_SLOTS:
- void _q_actionTriggered();
- void _q_actionHovered();
- void _q_actionChanged();
-
-protected:
- QGuiActionGroup(QGuiActionGroupPrivate &dd, QObject *parent);
-
-private:
- Q_DISABLE_COPY(QGuiActionGroup)
-};
-
-QT_END_NAMESPACE
-
-#endif // QGUIACTIONGROUP_H
diff --git a/src/gui/kernel/qguiactiongroup_p.h b/src/gui/kernel/qguiactiongroup_p.h
deleted file mode 100644
index 99a58262c9..0000000000
--- a/src/gui/kernel/qguiactiongroup_p.h
+++ /dev/null
@@ -1,91 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2019 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the QtGui module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef QGUIACTIONGROUP_P_H
-#define QGUIACTIONGROUP_P_H
-
-//
-// W A R N I N G
-// -------------
-//
-// This file is not part of the Qt API. It exists for the convenience
-// of other Qt classes. This header file may change from version to
-// version without notice, or even be removed.
-//
-// We mean it.
-//
-
-#include <QtGui/private/qtguiglobal_p.h>
-#include <QtGui/qguiactiongroup.h>
-#include <QtGui/qfont.h>
-#if QT_CONFIG(shortcut)
-# include <QtGui/private/qshortcutmap_p.h>
-#endif
-#include "private/qobject_p.h"
-
-QT_REQUIRE_CONFIG(action);
-
-QT_BEGIN_NAMESPACE
-
-class Q_GUI_EXPORT QGuiActionGroupPrivate : public QObjectPrivate
-{
- Q_DECLARE_PUBLIC(QGuiActionGroup)
-public:
- enum Signal { Triggered, Hovered };
-
- QGuiActionGroupPrivate();
- ~QGuiActionGroupPrivate();
-
- virtual void emitSignal(Signal, QGuiAction *) {}
-
- QList<QGuiAction *> actions;
- QPointer<QGuiAction> current;
- uint enabled : 1;
- uint visible : 1;
- QGuiActionGroup::ExclusionPolicy exclusionPolicy = QGuiActionGroup::ExclusionPolicy::Exclusive;
-
-private:
- void _q_actionTriggered(); //private slot
- void _q_actionChanged(); //private slot
- void _q_actionHovered(); //private slot
-};
-
-QT_END_NAMESPACE
-
-#endif // QACTIONGROUP_P_H
diff --git a/src/gui/kernel/qguiapplication.cpp b/src/gui/kernel/qguiapplication.cpp
index d231869d40..c97374e975 100644
--- a/src/gui/kernel/qguiapplication.cpp
+++ b/src/gui/kernel/qguiapplication.cpp
@@ -1,69 +1,40 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Copyright (C) 2016 Intel Corporation.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the QtGui module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2021 The Qt Company Ltd.
+// Copyright (C) 2016 Intel Corporation.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#include "qguiapplication.h"
#include "private/qguiapplication_p.h"
+#include "private/qabstractfileiconprovider_p.h"
#include <qpa/qplatformintegrationfactory_p.h>
#include "private/qevent_p.h"
+#include "private/qeventpoint_p.h"
+#include "private/qiconloader_p.h"
#include "qfont.h"
-#include "qtouchdevice.h"
+#include "qpointingdevice.h"
#include <qpa/qplatformfontdatabase.h>
#include <qpa/qplatformwindow.h>
#include <qpa/qplatformnativeinterface.h>
#include <qpa/qplatformtheme.h>
#include <qpa/qplatformintegration.h>
+#include <qpa/qplatformkeymapper.h>
#include <QtCore/QAbstractEventDispatcher>
+#include <QtCore/QFileInfo>
#include <QtCore/QStandardPaths>
#include <QtCore/QVariant>
#include <QtCore/private/qcoreapplication_p.h>
#include <QtCore/private/qabstracteventdispatcher_p.h>
+#include <QtCore/private/qminimalflatset_p.h>
#include <QtCore/qmutex.h>
#include <QtCore/private/qthread_p.h>
#include <QtCore/private/qlocking_p.h>
+#include <QtCore/private/qflatmap_p.h>
#include <QtCore/qdir.h>
#include <QtCore/qlibraryinfo.h>
-#include <QtCore/qnumeric.h>
+#include <QtCore/private/qnumeric_p.h>
#include <QtDebug>
-#ifndef QT_NO_ACCESSIBILITY
+#if QT_CONFIG(accessibility)
#include "qaccessible.h"
#endif
#include <qpalette.h>
@@ -74,6 +45,7 @@
#include <QtGui/qgenericpluginfactory.h>
#include <QtGui/qstylehints.h>
+#include <QtGui/private/qstylehints_p.h>
#include <QtGui/qinputmethod.h>
#include <QtGui/qpixmapcache.h>
#include <qpa/qplatforminputcontext.h>
@@ -82,11 +54,14 @@
#include <qpa/qwindowsysteminterface.h>
#include <qpa/qwindowsysteminterface_p.h>
#include "private/qwindow_p.h"
+#include "private/qicon_p.h"
#include "private/qcursor_p.h"
-#include "private/qopenglcontext_p.h"
+#if QT_CONFIG(opengl)
+# include "private/qopenglcontext_p.h"
+#endif
#include "private/qinputdevicemanager_p.h"
#include "private/qinputmethod_p.h"
-#include "private/qtouchdevice_p.h"
+#include "private/qpointingdevice_p.h"
#include <qpa/qplatformthemefactory_p.h>
@@ -120,12 +95,21 @@
#include <emscripten.h>
#endif
+#if QT_CONFIG(vulkan)
+#include <private/qvulkandefaultinstance_p.h>
+#endif
+
#include <qtgui_tracepoints_p.h>
-#include <ctype.h>
+#include <private/qtools_p.h>
+
+#include <limits>
QT_BEGIN_NAMESPACE
+using namespace Qt::StringLiterals;
+using namespace QtMiscUtils;
+
// Helper macro for static functions to check on the existence of the application class.
#define CHECK_QAPP_INSTANCE(...) \
if (Q_LIKELY(QCoreApplication::instance())) { \
@@ -134,88 +118,82 @@ QT_BEGIN_NAMESPACE
return __VA_ARGS__; \
}
-Q_GUI_EXPORT bool qt_is_gui_used = true;
-
-Qt::MouseButtons QGuiApplicationPrivate::mouse_buttons = Qt::NoButton;
-Qt::KeyboardModifiers QGuiApplicationPrivate::modifier_buttons = Qt::NoModifier;
+Q_CORE_EXPORT void qt_call_post_routines();
+Q_CONSTINIT Q_GUI_EXPORT bool qt_is_tty_app = false;
-QPointF QGuiApplicationPrivate::lastCursorPosition(qInf(), qInf());
+Q_CONSTINIT Qt::MouseButtons QGuiApplicationPrivate::mouse_buttons = Qt::NoButton;
+Q_CONSTINIT Qt::KeyboardModifiers QGuiApplicationPrivate::modifier_buttons = Qt::NoModifier;
-QWindow *QGuiApplicationPrivate::currentMouseWindow = nullptr;
+Q_CONSTINIT QGuiApplicationPrivate::QLastCursorPosition QGuiApplicationPrivate::lastCursorPosition;
-QString QGuiApplicationPrivate::styleOverride;
+Q_CONSTINIT QWindow *QGuiApplicationPrivate::currentMouseWindow = nullptr;
-Qt::ApplicationState QGuiApplicationPrivate::applicationState = Qt::ApplicationInactive;
+Q_CONSTINIT QString QGuiApplicationPrivate::styleOverride;
-Qt::HighDpiScaleFactorRoundingPolicy QGuiApplicationPrivate::highDpiScaleFactorRoundingPolicy =
- Qt::HighDpiScaleFactorRoundingPolicy::RoundPreferFloor;
-bool QGuiApplicationPrivate::highDpiScalingUpdated = false;
+Q_CONSTINIT Qt::ApplicationState QGuiApplicationPrivate::applicationState = Qt::ApplicationInactive;
-QPointer<QWindow> QGuiApplicationPrivate::currentDragWindow;
+Q_CONSTINIT Qt::HighDpiScaleFactorRoundingPolicy QGuiApplicationPrivate::highDpiScaleFactorRoundingPolicy =
+ Qt::HighDpiScaleFactorRoundingPolicy::PassThrough;
-QVector<QGuiApplicationPrivate::TabletPointData> QGuiApplicationPrivate::tabletDevicePoints;
+Q_CONSTINIT QPointer<QWindow> QGuiApplicationPrivate::currentDragWindow;
-QPlatformIntegration *QGuiApplicationPrivate::platform_integration = nullptr;
-QPlatformTheme *QGuiApplicationPrivate::platform_theme = nullptr;
+Q_CONSTINIT QList<QGuiApplicationPrivate::TabletPointData> QGuiApplicationPrivate::tabletDevicePoints; // TODO remove
-QList<QObject *> QGuiApplicationPrivate::generic_plugin_list;
+Q_CONSTINIT QPlatformIntegration *QGuiApplicationPrivate::platform_integration = nullptr;
+Q_CONSTINIT QPlatformTheme *QGuiApplicationPrivate::platform_theme = nullptr;
-#ifndef QT_NO_SESSIONMANAGER
-bool QGuiApplicationPrivate::is_fallback_session_management_enabled = true;
-#endif
+Q_CONSTINIT QList<QObject *> QGuiApplicationPrivate::generic_plugin_list;
enum ApplicationResourceFlags
{
- ApplicationPaletteExplicitlySet = 0x1,
ApplicationFontExplicitlySet = 0x2
};
-static unsigned applicationResourceFlags = 0;
+Q_CONSTINIT static unsigned applicationResourceFlags = 0;
-QIcon *QGuiApplicationPrivate::app_icon = nullptr;
+Q_CONSTINIT QIcon *QGuiApplicationPrivate::app_icon = nullptr;
-QString *QGuiApplicationPrivate::platform_name = nullptr;
-QString *QGuiApplicationPrivate::displayName = nullptr;
-QString *QGuiApplicationPrivate::desktopFileName = nullptr;
+Q_CONSTINIT QString *QGuiApplicationPrivate::platform_name = nullptr;
+Q_CONSTINIT QString *QGuiApplicationPrivate::displayName = nullptr;
+Q_CONSTINIT QString *QGuiApplicationPrivate::desktopFileName = nullptr;
-QPalette *QGuiApplicationPrivate::app_pal = nullptr; // default application palette
+Q_CONSTINIT QPalette *QGuiApplicationPrivate::app_pal = nullptr; // default application palette
-ulong QGuiApplicationPrivate::mousePressTime = 0;
-Qt::MouseButton QGuiApplicationPrivate::mousePressButton = Qt::NoButton;
-int QGuiApplicationPrivate::mousePressX = 0;
-int QGuiApplicationPrivate::mousePressY = 0;
+Q_CONSTINIT Qt::MouseButton QGuiApplicationPrivate::mousePressButton = Qt::NoButton;
-static int mouseDoubleClickDistance = -1;
-static int touchDoubleTapDistance = -1;
+Q_CONSTINIT static int mouseDoubleClickDistance = 0;
+Q_CONSTINIT static int touchDoubleTapDistance = 0;
-QWindow *QGuiApplicationPrivate::currentMousePressWindow = nullptr;
+Q_CONSTINIT QWindow *QGuiApplicationPrivate::currentMousePressWindow = nullptr;
-static Qt::LayoutDirection layout_direction = Qt::LayoutDirectionAuto;
-static bool force_reverse = false;
+Q_CONSTINIT static Qt::LayoutDirection layout_direction = Qt::LayoutDirectionAuto;
+Q_CONSTINIT static Qt::LayoutDirection effective_layout_direction = Qt::LeftToRight;
+Q_CONSTINIT static bool force_reverse = false;
-QGuiApplicationPrivate *QGuiApplicationPrivate::self = nullptr;
-QTouchDevice *QGuiApplicationPrivate::m_fakeTouchDevice = nullptr;
-int QGuiApplicationPrivate::m_fakeMouseSourcePointId = 0;
+Q_CONSTINIT QGuiApplicationPrivate *QGuiApplicationPrivate::self = nullptr;
+Q_CONSTINIT int QGuiApplicationPrivate::m_fakeMouseSourcePointId = -1;
#ifndef QT_NO_CLIPBOARD
-QClipboard *QGuiApplicationPrivate::qt_clipboard = nullptr;
+Q_CONSTINIT QClipboard *QGuiApplicationPrivate::qt_clipboard = nullptr;
#endif
-QList<QScreen *> QGuiApplicationPrivate::screen_list;
+Q_CONSTINIT QList<QScreen *> QGuiApplicationPrivate::screen_list;
+
+Q_CONSTINIT QWindowList QGuiApplicationPrivate::window_list;
+Q_CONSTINIT QWindow *QGuiApplicationPrivate::focus_window = nullptr;
-QWindowList QGuiApplicationPrivate::window_list;
-QWindow *QGuiApplicationPrivate::focus_window = nullptr;
+Q_CONSTINIT static QBasicMutex applicationFontMutex;
+Q_CONSTINIT QFont *QGuiApplicationPrivate::app_font = nullptr;
+Q_CONSTINIT QStyleHints *QGuiApplicationPrivate::styleHints = nullptr;
+Q_CONSTINIT bool QGuiApplicationPrivate::obey_desktop_settings = true;
-static QBasicMutex applicationFontMutex;
-QFont *QGuiApplicationPrivate::app_font = nullptr;
-QStyleHints *QGuiApplicationPrivate::styleHints = nullptr;
-bool QGuiApplicationPrivate::obey_desktop_settings = true;
+Q_CONSTINIT QInputDeviceManager *QGuiApplicationPrivate::m_inputDeviceManager = nullptr;
-QInputDeviceManager *QGuiApplicationPrivate::m_inputDeviceManager = nullptr;
+Q_CONSTINIT qreal QGuiApplicationPrivate::m_maxDevicePixelRatio = 0.0;
-qreal QGuiApplicationPrivate::m_maxDevicePixelRatio = 0.0;
+Q_CONSTINIT static qreal fontSmoothingGamma = 1.7;
-static qreal fontSmoothingGamma = 1.7;
+Q_CONSTINIT bool QGuiApplicationPrivate::quitOnLastWindowClosed = true;
extern void qRegisterGuiVariant();
#if QT_CONFIG(animation)
@@ -228,22 +206,7 @@ static bool qt_detectRTLLanguage()
(QGuiApplication::tr("QT_LAYOUT_DIRECTION",
"Translate this string to the string 'LTR' in left-to-right"
" languages or to 'RTL' in right-to-left languages (such as Hebrew"
- " and Arabic) to get proper widget layout.") == QLatin1String("RTL"));
-}
-
-static void initPalette()
-{
- if (!QGuiApplicationPrivate::app_pal)
- if (const QPalette *themePalette = QGuiApplicationPrivate::platformTheme()->palette())
- QGuiApplicationPrivate::app_pal = new QPalette(*themePalette);
- if (!QGuiApplicationPrivate::app_pal)
- QGuiApplicationPrivate::app_pal = new QPalette(Qt::gray);
-}
-
-static inline void clearPalette()
-{
- delete QGuiApplicationPrivate::app_pal;
- QGuiApplicationPrivate::app_pal = nullptr;
+ " and Arabic) to get proper widget layout.") == "RTL"_L1);
}
static void initFontUnlocked()
@@ -273,7 +236,7 @@ static void initThemeHints()
static bool checkNeedPortalSupport()
{
#if QT_CONFIG(dbus)
- return !QStandardPaths::locate(QStandardPaths::RuntimeLocation, QLatin1String("flatpak-info")).isEmpty() || qEnvironmentVariableIsSet("SNAP");
+ return QFileInfo::exists("/.flatpak-info"_L1) || qEnvironmentVariableIsSet("SNAP");
#else
return false;
#endif // QT_CONFIG(dbus)
@@ -300,20 +263,20 @@ struct QWindowGeometrySpecification
static inline int nextGeometryToken(const QByteArray &a, int &pos, char *op)
{
*op = 0;
- const int size = a.size();
+ const qsizetype size = a.size();
if (pos >= size)
return -1;
*op = a.at(pos);
if (*op == '+' || *op == '-' || *op == 'x')
pos++;
- else if (isdigit(*op))
+ else if (isAsciiDigit(*op))
*op = 'x'; // If it starts with a digit, it is supposed to be a width specification.
else
return -1;
const int numberPos = pos;
- for ( ; pos < size && isdigit(a.at(pos)); ++pos) ;
+ for ( ; pos < size && isAsciiDigit(a.at(pos)); ++pos) ;
bool ok;
const int result = a.mid(numberPos, pos - numberPos).toInt(&ok);
@@ -482,7 +445,6 @@ static QWindowGeometrySpecification windowGeometrySpecification = Q_WINDOW_GEOME
postEvent(),
sendPostedEvents(),
removePostedEvents(),
- hasPendingEvents(),
notify().
\row
@@ -600,9 +562,36 @@ static QWindowGeometrySpecification windowGeometrySpecification = Q_WINDOW_GEOME
The following parameters are available for \c {-platform windows}:
\list
+ \li \c {altgr}, detect the key \c {AltGr} found on some keyboards as
+ Qt::GroupSwitchModifier (since Qt 5.12).
+ \li \c {darkmode=[0|1|2]} controls how Qt responds to the activation
+ of the \e{Dark Mode for applications} introduced in Windows 10
+ 1903 (since Qt 5.15).
+
+ A value of 0 disables dark mode support.
+
+ A value of 1 causes Qt to switch the window borders to black
+ when \e{Dark Mode for applications} is activated and no High
+ Contrast Theme is in use. This is intended for applications
+ that implement their own theming.
+
+ A value of 2 will in addition cause the Windows Vista style to
+ be deactivated and switch to the Windows style using a
+ simplified palette in dark mode. This is currently
+ experimental pending the introduction of new style that
+ properly adapts to dark mode.
+
+ As of Qt 6.5, the default value is 2; to disable dark mode
+ support, set the value to 0 or 1.
+
\li \c {dialogs=[xp|none]}, \c xp uses XP-style native dialogs and
\c none disables them.
+
\li \c {fontengine=freetype}, uses the FreeType font engine.
+ \li \c {fontengine=gdi}, uses the legacy GDI-based
+ font database and defaults to using the GDI font
+ engine (which is otherwise only used for some font types
+ or font properties.) (Since Qt 6.8).
\li \c {menus=[native|none]}, controls the use of native menus.
Native menus are implemented using Win32 API and are simpler than
@@ -611,10 +600,24 @@ static QWindowGeometrySpecification windowGeometrySpecification = Q_WINDOW_GEOME
provide hover signals. They are mainly intended for Qt Quick.
By default, they will be used if the application is not an
instance of QApplication or for Qt Quick Controls 2
- applications.
+ applications (since Qt 5.10).
- \li \c {altgr}, detect the key \c {AltGr} found on some keyboards as
- Qt::GroupSwitchModifier.
+ \li \c {nocolorfonts} Turn off DirectWrite Color fonts
+ (since Qt 5.8).
+
+ \li \c {nodirectwrite} Turn off DirectWrite fonts (since Qt 5.8). This implicitly
+ also selects the GDI font engine.
+
+ \li \c {nomousefromtouch} Ignores mouse events synthesized
+ from touch events by the operating system.
+
+ \li \c {nowmpointer} Switches from Pointer Input Messages handling
+ to legacy mouse handling (since Qt 5.12).
+ \li \c {reverse} Activates Right-to-left mode (experimental).
+ Windows title bars will be shown accordingly in Right-to-left locales
+ (since Qt 5.13).
+ \li \c {tabletabsoluterange=<value>} Sets a value for mouse mode detection
+ of WinTab tablets (Legacy, since Qt 5.3).
\endlist
The following parameter is available for \c {-platform cocoa} (on macOS):
@@ -631,9 +634,9 @@ static QWindowGeometrySpecification windowGeometrySpecification = Q_WINDOW_GEOME
#ifdef Q_QDOC
QGuiApplication::QGuiApplication(int &argc, char **argv)
#else
-QGuiApplication::QGuiApplication(int &argc, char **argv, int flags)
+QGuiApplication::QGuiApplication(int &argc, char **argv, int)
#endif
- : QCoreApplication(*new QGuiApplicationPrivate(argc, argv, flags))
+ : QCoreApplication(*new QGuiApplicationPrivate(argc, argv))
{
d_func()->init();
@@ -655,6 +658,8 @@ QGuiApplication::~QGuiApplication()
{
Q_D(QGuiApplication);
+ qt_call_post_routines();
+
d->eventDispatcher->closingDown();
d->eventDispatcher = nullptr;
@@ -668,7 +673,7 @@ QGuiApplication::~QGuiApplication()
d->session_manager = nullptr;
#endif //QT_NO_SESSIONMANAGER
- clearPalette();
+ QGuiApplicationPrivate::clearPalette();
QFontDatabase::removeAllApplicationFonts();
#ifndef QT_NO_CURSOR
@@ -687,23 +692,16 @@ QGuiApplication::~QGuiApplication()
QGuiApplicationPrivate::desktopFileName = nullptr;
QGuiApplicationPrivate::mouse_buttons = Qt::NoButton;
QGuiApplicationPrivate::modifier_buttons = Qt::NoModifier;
- QGuiApplicationPrivate::lastCursorPosition = {qInf(), qInf()};
+ QGuiApplicationPrivate::lastCursorPosition.reset();
QGuiApplicationPrivate::currentMousePressWindow = QGuiApplicationPrivate::currentMouseWindow = nullptr;
QGuiApplicationPrivate::applicationState = Qt::ApplicationInactive;
- QGuiApplicationPrivate::highDpiScaleFactorRoundingPolicy =
- Qt::HighDpiScaleFactorRoundingPolicy::RoundPreferFloor;
- QGuiApplicationPrivate::highDpiScalingUpdated = false;
+ QGuiApplicationPrivate::highDpiScaleFactorRoundingPolicy = Qt::HighDpiScaleFactorRoundingPolicy::PassThrough;
QGuiApplicationPrivate::currentDragWindow = nullptr;
QGuiApplicationPrivate::tabletDevicePoints.clear();
-#ifndef QT_NO_SESSIONMANAGER
- QGuiApplicationPrivate::is_fallback_session_management_enabled = true;
-#endif
- QGuiApplicationPrivate::mousePressTime = 0;
- QGuiApplicationPrivate::mousePressX = QGuiApplicationPrivate::mousePressY = 0;
}
-QGuiApplicationPrivate::QGuiApplicationPrivate(int &argc, char **argv, int flags)
- : QCoreApplicationPrivate(argc, argv, flags),
+QGuiApplicationPrivate::QGuiApplicationPrivate(int &argc, char **argv)
+ : QCoreApplicationPrivate(argc, argv),
inputMethod(nullptr),
lastTouchType(QEvent::TouchEnd),
ownGlobalShareContext(false)
@@ -752,13 +750,37 @@ QString QGuiApplication::applicationDisplayName()
}
/*!
+ Sets the application's badge to \a number.
+
+ Useful for providing feedback to the user about the number
+ of unread messages or similar.
+
+ The badge will be overlaid on the application's icon in the Dock
+ on \macos, the home screen icon on iOS, or the task bar on Windows
+ and Linux.
+
+ If the number is outside the range supported by the platform, the
+ number will be clamped to the supported range. If the number does
+ not fit within the badge, the number may be visually elided.
+
+ Setting the number to 0 will clear the badge.
+
+ \since 6.5
+ \sa applicationName
+*/
+void QGuiApplication::setBadgeNumber(qint64 number)
+{
+ QGuiApplicationPrivate::platformIntegration()->setApplicationBadge(number);
+}
+
+/*!
\property QGuiApplication::desktopFileName
\brief the base name of the desktop entry for this application
\since 5.7
- This is the file name, without the full path, of the desktop entry
- that represents this application according to the freedesktop desktop
- entry specification.
+ This is the file name, without the full path or the trailing ".desktop"
+ extension of the desktop entry that represents this application
+ according to the freedesktop desktop entry specification.
This property gives a precise indication of what desktop entry represents
the application and it is needed by the windowing system to retrieve
@@ -772,6 +794,15 @@ void QGuiApplication::setDesktopFileName(const QString &name)
if (!QGuiApplicationPrivate::desktopFileName)
QGuiApplicationPrivate::desktopFileName = new QString;
*QGuiApplicationPrivate::desktopFileName = name;
+ if (name.endsWith(QLatin1String(".desktop"))) { // ### Qt 7: remove
+ const QString filePath = QStandardPaths::locate(QStandardPaths::ApplicationsLocation, name);
+ if (!filePath.isEmpty()) {
+ qWarning("QGuiApplication::setDesktopFileName: the specified desktop file name "
+ "ends with .desktop. For compatibility reasons, the .desktop suffix will "
+ "be removed. Please specify a desktop file name without .desktop suffix");
+ (*QGuiApplicationPrivate::desktopFileName).chop(8);
+ }
+ }
}
QString QGuiApplication::desktopFileName()
@@ -798,7 +829,7 @@ QWindow *QGuiApplication::modalWindow()
CHECK_QAPP_INSTANCE(nullptr)
if (QGuiApplicationPrivate::self->modalWindowList.isEmpty())
return nullptr;
- return QGuiApplicationPrivate::self->modalWindowList.first();
+ return QGuiApplicationPrivate::self->modalWindowList.constFirst();
}
static void updateBlockedStatusRecursion(QWindow *window, bool shouldBeBlocked)
@@ -849,7 +880,7 @@ void QGuiApplicationPrivate::showModalWindow(QWindow *modal)
}
}
- for (QWindow *window : qAsConst(QGuiApplicationPrivate::window_list)) {
+ for (QWindow *window : std::as_const(QGuiApplicationPrivate::window_list)) {
if (needsWindowBlockedEvent(window) && !window->d_func()->blockedByModalWindow)
updateBlockedStatus(window);
}
@@ -861,12 +892,23 @@ void QGuiApplicationPrivate::hideModalWindow(QWindow *window)
{
self->modalWindowList.removeAll(window);
- for (QWindow *window : qAsConst(QGuiApplicationPrivate::window_list)) {
+ for (QWindow *window : std::as_const(QGuiApplicationPrivate::window_list)) {
if (needsWindowBlockedEvent(window) && window->d_func()->blockedByModalWindow)
updateBlockedStatus(window);
}
}
+Qt::WindowModality QGuiApplicationPrivate::defaultModality() const
+{
+ return Qt::NonModal;
+}
+
+bool QGuiApplicationPrivate::windowNeverBlocked(QWindow *window) const
+{
+ Q_UNUSED(window);
+ return false;
+}
+
/*
Returns \c true if \a window is blocked by a modal window. If \a
blockingWindow is non-zero, *blockingWindow will be set to the blocking
@@ -874,55 +916,40 @@ void QGuiApplicationPrivate::hideModalWindow(QWindow *window)
*/
bool QGuiApplicationPrivate::isWindowBlocked(QWindow *window, QWindow **blockingWindow) const
{
+ Q_ASSERT_X(window, Q_FUNC_INFO, "The window must not be null");
+
QWindow *unused = nullptr;
if (!blockingWindow)
blockingWindow = &unused;
+ *blockingWindow = nullptr;
- if (modalWindowList.isEmpty()) {
- *blockingWindow = nullptr;
+ if (modalWindowList.isEmpty() || windowNeverBlocked(window))
return false;
- }
- for (int i = 0; i < modalWindowList.count(); ++i) {
+ for (int i = 0; i < modalWindowList.size(); ++i) {
QWindow *modalWindow = modalWindowList.at(i);
// A window is not blocked by another modal window if the two are
// the same, or if the window is a child of the modal window.
- if (window == modalWindow || modalWindow->isAncestorOf(window, QWindow::IncludeTransients)) {
- *blockingWindow = nullptr;
+ if (window == modalWindow || modalWindow->isAncestorOf(window, QWindow::IncludeTransients))
return false;
- }
- Qt::WindowModality windowModality = modalWindow->modality();
- switch (windowModality) {
+ switch (modalWindow->modality() == Qt::NonModal ? defaultModality()
+ : modalWindow->modality()) {
case Qt::ApplicationModal:
- {
- if (modalWindow != window) {
- *blockingWindow = modalWindow;
- return true;
- }
- break;
- }
- case Qt::WindowModal:
- {
- QWindow *w = window;
+ *blockingWindow = modalWindow;
+ return true;
+ case Qt::WindowModal: {
+ // Find the nearest ancestor of window which is also an ancestor of modal window to
+ // determine if the modal window blocks the window.
+ auto *current = window;
do {
- QWindow *m = modalWindow;
- do {
- if (m == w) {
- *blockingWindow = m;
- return true;
- }
- QWindow *p = m->parent();
- if (!p)
- p = m->transientParent();
- m = p;
- } while (m);
- QWindow *p = w->parent();
- if (!p)
- p = w->transientParent();
- w = p;
- } while (w);
+ if (current->isAncestorOf(modalWindow, QWindow::IncludeTransients)) {
+ *blockingWindow = modalWindow;
+ return true;
+ }
+ current = current->parent(QWindow::IncludeTransients);
+ } while (current);
break;
}
default:
@@ -930,13 +957,14 @@ bool QGuiApplicationPrivate::isWindowBlocked(QWindow *window, QWindow **blocking
break;
}
}
- *blockingWindow = nullptr;
return false;
}
/*!
Returns the QWindow that receives events tied to focus,
such as key events.
+
+ \sa QWindow::requestActivate()
*/
QWindow *QGuiApplication::focusWindow()
{
@@ -1114,7 +1142,7 @@ qreal QGuiApplication::devicePixelRatio() const
return QGuiApplicationPrivate::m_maxDevicePixelRatio;
QGuiApplicationPrivate::m_maxDevicePixelRatio = 1.0; // make sure we never return 0.
- for (QScreen *screen : qAsConst(QGuiApplicationPrivate::screen_list))
+ for (QScreen *screen : std::as_const(QGuiApplicationPrivate::screen_list))
QGuiApplicationPrivate::m_maxDevicePixelRatio = qMax(QGuiApplicationPrivate::m_maxDevicePixelRatio, screen->devicePixelRatio());
return QGuiApplicationPrivate::m_maxDevicePixelRatio;
@@ -1152,9 +1180,6 @@ QWindow *QGuiApplication::topLevelAt(const QPoint &pos)
EGL and OpenGL ES 2.0 without an actual windowing system (like X11
or Wayland). For more information, see \l{EGLFS}.
\li \c ios (also used for tvOS)
- \li \c kms is an experimental platform plugin using kernel modesetting
- and \l{http://dri.freedesktop.org/wiki/DRM}{DRM} (Direct Rendering
- Manager).
\li \c linuxfb writes directly to the framebuffer. For more information,
see \l{LinuxFB}.
\li \c minimal is provided as an examples for developers who want to
@@ -1162,34 +1187,52 @@ QWindow *QGuiApplication::topLevelAt(const QPoint &pos)
run GUI applications in environments without a GUI, such as servers.
\li \c minimalegl is an example plugin.
\li \c offscreen
- \li \c openwfd
\li \c qnx
\li \c windows
- \li \c wayland is a platform plugin for modern Linux desktops and some
- embedded systems.
- \li \c xcb is the X11 plugin used on regular desktop Linux platforms.
+ \li \c wayland is a platform plugin for the Wayland display server protocol,
+ used on some Linux desktops and embedded systems.
+ \li \c xcb is a plugin for the X11 window system, used on some desktop Linux platforms.
\endlist
+ \note Calling this function without a QGuiApplication will return the default
+ platform name, if available. The default platform name is not affected by the
+ \c{-platform} command line option, or the \c QT_QPA_PLATFORM environment variable.
+
For more information about the platform plugins for embedded Linux devices,
see \l{Qt for Embedded Linux}.
*/
QString QGuiApplication::platformName()
{
- return QGuiApplicationPrivate::platform_name ?
- *QGuiApplicationPrivate::platform_name : QString();
+ if (!QGuiApplication::instance()) {
+#ifdef QT_QPA_DEFAULT_PLATFORM_NAME
+ return QStringLiteral(QT_QPA_DEFAULT_PLATFORM_NAME);
+#else
+ return QString();
+#endif
+ } else {
+ return QGuiApplicationPrivate::platform_name ?
+ *QGuiApplicationPrivate::platform_name : QString();
+ }
}
Q_LOGGING_CATEGORY(lcQpaPluginLoading, "qt.qpa.plugin");
+Q_LOGGING_CATEGORY(lcQpaTheme, "qt.qpa.theme");
+Q_LOGGING_CATEGORY(lcPtrDispatch, "qt.pointer.dispatch");
static void init_platform(const QString &pluginNamesWithArguments, const QString &platformPluginPath, const QString &platformThemeName, int &argc, char **argv)
{
- QStringList plugins = pluginNamesWithArguments.split(QLatin1Char(';'), QString::SkipEmptyParts);
+ qCDebug(lcQpaPluginLoading) << "init_platform called with"
+ << "pluginNamesWithArguments" << pluginNamesWithArguments
+ << "platformPluginPath" << platformPluginPath
+ << "platformThemeName" << platformThemeName;
+
+ QStringList plugins = pluginNamesWithArguments.split(u';', Qt::SkipEmptyParts);
QStringList platformArguments;
QStringList availablePlugins = QPlatformIntegrationFactory::keys(platformPluginPath);
for (const auto &pluginArgument : plugins) {
// Split into platform name and arguments
- QStringList arguments = pluginArgument.split(QLatin1Char(':'), QString::SkipEmptyParts);
+ QStringList arguments = pluginArgument.split(u':', Qt::SkipEmptyParts);
if (arguments.isEmpty())
continue;
const QString name = arguments.takeFirst().toLower();
@@ -1199,10 +1242,16 @@ static void init_platform(const QString &pluginNamesWithArguments, const QString
argumentsKey[0] = argumentsKey.at(0).toUpper();
arguments.append(QLibraryInfo::platformPluginArguments(argumentsKey));
+ qCDebug(lcQpaPluginLoading) << "Attempting to load Qt platform plugin" << name << "with arguments" << arguments;
+
// Create the platform integration.
QGuiApplicationPrivate::platform_integration = QPlatformIntegrationFactory::create(name, arguments, argc, argv, platformPluginPath);
if (Q_UNLIKELY(!QGuiApplicationPrivate::platform_integration)) {
if (availablePlugins.contains(name)) {
+ if (name == QStringLiteral("xcb") && QVersionNumber::compare(QLibraryInfo::version(), QVersionNumber(6, 5, 0)) >= 0) {
+ qCWarning(lcQpaPluginLoading).nospace().noquote()
+ << "From 6.5.0, xcb-cursor0 or libxcb-cursor0 is needed to load the Qt xcb platform plugin.";
+ }
qCInfo(lcQpaPluginLoading).nospace().noquote()
<< "Could not load the Qt platform plugin \"" << name << "\" in \""
<< QDir::toNativeSeparators(platformPluginPath) << "\" even though it was found.";
@@ -1212,6 +1261,7 @@ static void init_platform(const QString &pluginNamesWithArguments, const QString
<< QDir::toNativeSeparators(platformPluginPath) << "\"";
}
} else {
+ qCDebug(lcQpaPluginLoading) << "Successfully loaded Qt platform plugin" << name;
QGuiApplicationPrivate::platform_name = new QString(name);
platformArguments = arguments;
break;
@@ -1223,69 +1273,74 @@ static void init_platform(const QString &pluginNamesWithArguments, const QString
"Reinstalling the application may fix this problem.\n");
if (!availablePlugins.isEmpty())
- fatalMessage += QStringLiteral("\nAvailable platform plugins are: %1.\n").arg(availablePlugins.join(QLatin1String(", ")));
+ fatalMessage += "\nAvailable platform plugins are: %1.\n"_L1.arg(availablePlugins.join(", "_L1));
-#if defined(Q_OS_WIN) && !defined(Q_OS_WINRT)
+#if defined(Q_OS_WIN)
// Windows: Display message box unless it is a console application
// or debug build showing an assert box.
if (!QLibraryInfo::isDebugBuild() && !GetConsoleWindow())
MessageBox(0, (LPCTSTR)fatalMessage.utf16(), (LPCTSTR)(QCoreApplication::applicationName().utf16()), MB_OK | MB_ICONERROR);
-#endif // Q_OS_WIN && !Q_OS_WINRT
+#endif // Q_OS_WIN
qFatal("%s", qPrintable(fatalMessage));
return;
}
- // Many platforms have created QScreens at this point. Finish initializing
- // QHighDpiScaling to be prepared for early calls to qt_defaultDpi().
- if (QGuiApplication::primaryScreen()) {
- QGuiApplicationPrivate::highDpiScalingUpdated = true;
- QHighDpiScaling::updateHighDpiScaling();
- }
-
// Create the platform theme:
// 1) Fetch the platform name from the environment if present.
QStringList themeNames;
- if (!platformThemeName.isEmpty())
+ if (!platformThemeName.isEmpty()) {
+ qCDebug(lcQpaTheme) << "Adding" << platformThemeName << "from environment to list of theme names";
themeNames.append(platformThemeName);
+ }
// 2) Special case - check whether it's a flatpak or snap app to use xdg-desktop-portal platform theme for portals support
if (checkNeedPortalSupport()) {
+ qCDebug(lcQpaTheme) << "Adding xdgdesktopportal to list of theme names";
themeNames.append(QStringLiteral("xdgdesktopportal"));
}
// 3) Ask the platform integration for a list of theme names
- themeNames += QGuiApplicationPrivate::platform_integration->themeNames();
+ const auto platformIntegrationThemeNames = QGuiApplicationPrivate::platform_integration->themeNames();
+ qCDebug(lcQpaTheme) << "Adding platform integration's theme names to list of theme names:" << platformIntegrationThemeNames;
+ themeNames += platformIntegrationThemeNames;
// 4) Look for a theme plugin.
- for (const QString &themeName : qAsConst(themeNames)) {
+ for (const QString &themeName : std::as_const(themeNames)) {
+ qCDebug(lcQpaTheme) << "Attempting to create platform theme" << themeName << "via QPlatformThemeFactory::create";
QGuiApplicationPrivate::platform_theme = QPlatformThemeFactory::create(themeName, platformPluginPath);
- if (QGuiApplicationPrivate::platform_theme)
+ if (QGuiApplicationPrivate::platform_theme) {
+ qCDebug(lcQpaTheme) << "Successfully created platform theme" << themeName;
break;
+ }
}
// 5) If no theme plugin was found ask the platform integration to
// create a theme
if (!QGuiApplicationPrivate::platform_theme) {
- for (const QString &themeName : qAsConst(themeNames)) {
+ for (const QString &themeName : std::as_const(themeNames)) {
+ qCDebug(lcQpaTheme) << "Attempting to create platform theme" << themeName << "via createPlatformTheme";
QGuiApplicationPrivate::platform_theme = QGuiApplicationPrivate::platform_integration->createPlatformTheme(themeName);
- if (QGuiApplicationPrivate::platform_theme)
+ if (QGuiApplicationPrivate::platform_theme) {
+ qCDebug(lcQpaTheme) << "Successfully created platform theme" << themeName;
break;
+ }
}
// No error message; not having a theme plugin is allowed.
}
// 6) Fall back on the built-in "null" platform theme.
- if (!QGuiApplicationPrivate::platform_theme)
+ if (!QGuiApplicationPrivate::platform_theme) {
+ qCDebug(lcQpaTheme) << "Failed to create platform theme; using \"null\" platform theme";
QGuiApplicationPrivate::platform_theme = new QPlatformTheme;
+ }
-#ifndef QT_NO_PROPERTIES
// Set arguments as dynamic properties on the native interface as
// boolean 'foo' or strings: 'foo=bar'
if (!platformArguments.isEmpty()) {
if (QObject *nativeInterface = QGuiApplicationPrivate::platform_integration->nativeInterface()) {
- for (const QString &argument : qAsConst(platformArguments)) {
- const int equalsPos = argument.indexOf(QLatin1Char('='));
+ for (const QString &argument : std::as_const(platformArguments)) {
+ const qsizetype equalsPos = argument.indexOf(u'=');
const QByteArray name =
equalsPos != -1 ? argument.left(equalsPos).toUtf8() : argument.toUtf8();
const QVariant value =
@@ -1294,22 +1349,24 @@ static void init_platform(const QString &pluginNamesWithArguments, const QString
}
}
}
-#endif
- fontSmoothingGamma = QGuiApplicationPrivate::platformIntegration()->styleHint(QPlatformIntegration::FontSmoothingGamma).toReal();
+ const auto platformIntegration = QGuiApplicationPrivate::platformIntegration();
+ fontSmoothingGamma = platformIntegration->styleHint(QPlatformIntegration::FontSmoothingGamma).toReal();
+ QCoreApplication::setAttribute(Qt::AA_DontShowShortcutsInContextMenus,
+ !QGuiApplication::styleHints()->showShortcutsInContextMenus());
}
static void init_plugins(const QList<QByteArray> &pluginList)
{
- for (int i = 0; i < pluginList.count(); ++i) {
+ for (int i = 0; i < pluginList.size(); ++i) {
QByteArray pluginSpec = pluginList.at(i);
- int colonPos = pluginSpec.indexOf(':');
+ qsizetype colonPos = pluginSpec.indexOf(':');
QObject *plugin;
if (colonPos < 0)
- plugin = QGenericPluginFactory::create(QLatin1String(pluginSpec), QString());
+ plugin = QGenericPluginFactory::create(QLatin1StringView(pluginSpec), QString());
else
- plugin = QGenericPluginFactory::create(QLatin1String(pluginSpec.mid(0, colonPos)),
- QLatin1String(pluginSpec.mid(colonPos+1)));
+ plugin = QGenericPluginFactory::create(QLatin1StringView(pluginSpec.mid(0, colonPos)),
+ QLatin1StringView(pluginSpec.mid(colonPos+1)));
if (plugin)
QGuiApplicationPrivate::generic_plugin_list.append(plugin);
else
@@ -1362,11 +1419,11 @@ void QGuiApplicationPrivate::addQtOptions(QList<QCommandLineOption> *options)
QGuiApplication::tr("ID of the X11 Visual to use."), QStringLiteral("id")));
// Not using the "QStringList names" solution for those aliases, because it makes the first column too wide
options->append(QCommandLineOption(QStringLiteral("geometry"),
- QGuiApplication::tr("Alias for --windowgeometry."), QStringLiteral("geometry")));
+ QGuiApplication::tr("Alias for --qwindowgeometry."), QStringLiteral("geometry")));
options->append(QCommandLineOption(QStringLiteral("icon"),
- QGuiApplication::tr("Alias for --windowicon."), QStringLiteral("icon")));
+ QGuiApplication::tr("Alias for --qwindowicon."), QStringLiteral("icon")));
options->append(QCommandLineOption(QStringLiteral("title"),
- QGuiApplication::tr("Alias for --windowtitle."), QStringLiteral("title")));
+ QGuiApplication::tr("Alias for --qwindowtitle."), QStringLiteral("title")));
}
}
#endif // QT_CONFIG(commandlineparser)
@@ -1384,31 +1441,41 @@ void QGuiApplicationPrivate::createPlatformIntegration()
platformName = QT_QPA_DEFAULT_PLATFORM_NAME;
#endif
#if defined(Q_OS_UNIX) && !defined(Q_OS_DARWIN)
- QByteArray sessionType = qgetenv("XDG_SESSION_TYPE");
- if (!sessionType.isEmpty()) {
- if (sessionType == QByteArrayLiteral("x11") && !platformName.contains(QByteArrayLiteral("xcb"))) {
- platformName = QByteArrayLiteral("xcb");
- } else if (sessionType == QByteArrayLiteral("wayland") && !platformName.contains(QByteArrayLiteral("wayland"))) {
- QByteArray currentDesktop = qgetenv("XDG_CURRENT_DESKTOP").toLower();
- QByteArray sessionDesktop = qgetenv("XDG_SESSION_DESKTOP").toLower();
- if (currentDesktop.contains("gnome") || sessionDesktop.contains("gnome")) {
- qInfo() << "Warning: Ignoring XDG_SESSION_TYPE=wayland on Gnome."
- << "Use QT_QPA_PLATFORM=wayland to run on Wayland anyway.";
- } else {
- platformName = QByteArrayLiteral("wayland");
- }
- }
+ QList<QByteArray> platformArguments = platformName.split(':');
+ QByteArray platformPluginBase = platformArguments.first();
+
+ const bool hasWaylandDisplay = qEnvironmentVariableIsSet("WAYLAND_DISPLAY");
+ const bool isWaylandSessionType = qgetenv("XDG_SESSION_TYPE") == "wayland";
+
+ QVector<QByteArray> preferredPlatformOrder;
+ const bool defaultIsXcb = platformPluginBase == "xcb";
+ const QByteArray xcbPlatformName = defaultIsXcb ? platformName : "xcb";
+ if (qEnvironmentVariableIsSet("DISPLAY")) {
+ preferredPlatformOrder << xcbPlatformName;
+ if (defaultIsXcb)
+ platformName.clear();
}
-#ifdef QT_QPA_DEFAULT_PLATFORM_NAME
- // Add it as fallback in case XDG_SESSION_TYPE is something wrong
- if (!platformName.contains(QT_QPA_DEFAULT_PLATFORM_NAME))
- platformName += QByteArrayLiteral(";" QT_QPA_DEFAULT_PLATFORM_NAME);
-#endif
+
+ const bool defaultIsWayland = !defaultIsXcb && platformPluginBase.startsWith("wayland");
+ const QByteArray waylandPlatformName = defaultIsWayland ? platformName : "wayland";
+ if (hasWaylandDisplay || isWaylandSessionType) {
+ preferredPlatformOrder.prepend(waylandPlatformName);
+
+ if (defaultIsWayland)
+ platformName.clear();
+ }
+
+ if (!platformName.isEmpty())
+ preferredPlatformOrder.append(platformName);
+
+ platformName = preferredPlatformOrder.join(';');
#endif
+ bool platformExplicitlySelected = false;
QByteArray platformNameEnv = qgetenv("QT_QPA_PLATFORM");
if (!platformNameEnv.isEmpty()) {
platformName = platformNameEnv;
+ platformExplicitlySelected = true;
}
QString platformThemeName = QString::fromLocal8Bit(qgetenv("QT_QPA_PLATFORMTHEME"));
@@ -1431,10 +1498,12 @@ void QGuiApplicationPrivate::createPlatformIntegration()
++arg;
if (strcmp(arg, "-platformpluginpath") == 0) {
if (++i < argc)
- platformPluginPath = QString::fromLocal8Bit(argv[i]);
+ platformPluginPath = QFile::decodeName(argv[i]);
} else if (strcmp(arg, "-platform") == 0) {
- if (++i < argc)
+ if (++i < argc) {
+ platformExplicitlySelected = true;
platformName = argv[i];
+ }
} else if (strcmp(arg, "-platformtheme") == 0) {
if (++i < argc)
platformThemeName = QString::fromLocal8Bit(argv[i]);
@@ -1446,7 +1515,7 @@ void QGuiApplicationPrivate::createPlatformIntegration()
firstWindowTitle = QString::fromLocal8Bit(argv[i]);
} else if (strcmp(arg, "-qwindowicon") == 0 || (xcbIsDefault && strcmp(arg, "-icon") == 0)) {
if (++i < argc) {
- icon = QString::fromLocal8Bit(argv[i]);
+ icon = QFile::decodeName(argv[i]);
}
} else {
argv[j++] = argv[i];
@@ -1458,7 +1527,11 @@ void QGuiApplicationPrivate::createPlatformIntegration()
argc = j;
}
- init_platform(QLatin1String(platformName), platformPluginPath, platformThemeName, argc, argv);
+ Q_UNUSED(platformExplicitlySelected);
+
+ init_platform(QLatin1StringView(platformName), platformPluginPath, platformThemeName, argc, argv);
+ if (const QPlatformTheme *theme = platformTheme())
+ QStyleHintsPrivate::get(QGuiApplication::styleHints())->updateColorScheme(theme->colorScheme());
if (!icon.isEmpty())
forcedWindowIcon = QDir::isAbsolutePath(icon) ? QIcon(icon) : QIcon::fromTheme(icon);
@@ -1477,7 +1550,11 @@ void QGuiApplicationPrivate::createEventDispatcher()
if (platform_integration == nullptr)
createPlatformIntegration();
- // The platform integration should not mess with the event dispatcher
+ // The platform integration should not result in creating an event dispatcher
+ Q_ASSERT_X(!threadData.loadRelaxed()->eventDispatcher, "QGuiApplication",
+ "Creating the platform integration resulted in creating an event dispatcher");
+
+ // Nor should it mess with the QCoreApplication's event dispatcher
Q_ASSERT(!eventDispatcher);
eventDispatcher = platform_integration->createEventDispatcher();
@@ -1489,14 +1566,9 @@ void QGuiApplicationPrivate::eventDispatcherReady()
createPlatformIntegration();
platform_integration->initialize();
-
- // All platforms should have added screens at this point. Finish
- // QHighDpiScaling initialization if it has not been done so already.
- if (!QGuiApplicationPrivate::highDpiScalingUpdated)
- QHighDpiScaling::updateHighDpiScaling();
}
-void QGuiApplicationPrivate::init()
+void Q_TRACE_INSTRUMENT(qtgui) QGuiApplicationPrivate::init()
{
Q_TRACE_SCOPE(QGuiApplicationPrivate_init);
@@ -1546,12 +1618,12 @@ void QGuiApplicationPrivate::init()
} else if (strncmp(arg, "-psn_", 5) == 0) {
// eat "-psn_xxxx" on Mac, which is passed when starting an app from Finder.
// special hack to change working directory (for an app bundle) when running from finder
- if (QDir::currentPath() == QLatin1String("/")) {
+ if (QDir::currentPath() == "/"_L1) {
QCFType<CFURLRef> bundleURL(CFBundleCopyBundleURL(CFBundleGetMainBundle()));
QString qbundlePath = QCFString(CFURLCopyFileSystemPath(bundleURL,
kCFURLPOSIXPathStyle));
- if (qbundlePath.endsWith(QLatin1String(".app")))
- QDir::setCurrent(qbundlePath.section(QLatin1Char('/'), 0, -2));
+ if (qbundlePath.endsWith(".app"_L1))
+ QDir::setCurrent(qbundlePath.section(u'/', 0, -2));
}
#endif
#ifndef QT_NO_SESSIONMANAGER
@@ -1559,7 +1631,7 @@ void QGuiApplicationPrivate::init()
++i;
if (argv[i] && *argv[i]) {
session_id = QString::fromLatin1(argv[i]);
- int p = session_id.indexOf(QLatin1Char('_'));
+ qsizetype p = session_id.indexOf(u'_');
if (p >= 0) {
session_key = session_id.mid(p +1);
session_id = session_id.left(p);
@@ -1594,7 +1666,7 @@ void QGuiApplicationPrivate::init()
if (platform_integration == nullptr)
createPlatformIntegration();
- initPalette();
+ updatePalette();
QFont::initialize();
initThemeHints();
@@ -1655,8 +1727,8 @@ void QGuiApplicationPrivate::init()
Q_UNUSED(loadTestability);
#endif // QT_CONFIG(library)
- if (layout_direction == Qt::LayoutDirectionAuto || force_reverse)
- QGuiApplication::setLayoutDirection(qt_detectRTLLanguage() ? Qt::RightToLeft : Qt::LeftToRight);
+ // trigger changed signal and event delivery
+ QGuiApplication::setLayoutDirection(layout_direction);
if (!QGuiApplicationPrivate::displayName)
QObject::connect(q, &QGuiApplication::applicationNameChanged,
@@ -1670,7 +1742,7 @@ QGuiApplicationPrivate::~QGuiApplicationPrivate()
is_app_closing = true;
is_app_running = false;
- for (int i = 0; i < generic_plugin_list.count(); ++i)
+ for (int i = 0; i < generic_plugin_list.size(); ++i)
delete generic_plugin_list.at(i);
generic_plugin_list.clear();
@@ -1682,7 +1754,7 @@ QGuiApplicationPrivate::~QGuiApplicationPrivate()
QCursorData::cleanup();
#endif
- layout_direction = Qt::LeftToRight;
+ layout_direction = Qt::LayoutDirectionAuto;
cleanupThreadData();
@@ -1701,6 +1773,10 @@ QGuiApplicationPrivate::~QGuiApplicationPrivate()
}
#endif
+#if QT_CONFIG(vulkan)
+ QVulkanDefaultInstance::cleanup();
+#endif
+
platform_integration->destroy();
delete platform_theme;
@@ -1710,6 +1786,8 @@ QGuiApplicationPrivate::~QGuiApplicationPrivate()
window_list.clear();
screen_list.clear();
+
+ self = nullptr;
}
#if 0
@@ -1723,7 +1801,7 @@ void restoreOverrideCursor();
static QFont font();
static QFont font(const QWidget*);
static QFont font(const char *className);
-static void setFont(const QFont &, const char* className = 0);
+static void setFont(const QFont &, const char *className = nullptr);
static QFontMetrics fontMetrics();
#ifndef QT_NO_CLIPBOARD
@@ -1733,7 +1811,7 @@ static QClipboard *clipboard();
/*!
Returns the current state of the modifier keys on the keyboard. The current
- state is updated sychronously as the event queue is emptied of events that
+ state is updated synchronously as the event queue is emptied of events that
will spontaneously change the keyboard state (QEvent::KeyPress and
QEvent::KeyRelease events).
@@ -1769,7 +1847,7 @@ Qt::KeyboardModifiers QGuiApplication::queryKeyboardModifiers()
{
CHECK_QAPP_INSTANCE(Qt::KeyboardModifiers{})
QPlatformIntegration *pi = QGuiApplicationPrivate::platformIntegration();
- return pi->queryKeyboardModifiers();
+ return pi->keyMapper()->queryKeyboardModifiers();
}
/*!
@@ -1791,6 +1869,7 @@ Qt::MouseButtons QGuiApplication::mouseButtons()
}
/*!
+ \internal
Returns the platform's native interface, for platform specific
functionality.
*/
@@ -1801,6 +1880,7 @@ QPlatformNativeInterface *QGuiApplication::platformNativeInterface()
}
/*!
+ \internal
Returns a function pointer from the platformplugin matching \a function
*/
QFunctionPointer QGuiApplication::platformFunction(const QByteArray &function)
@@ -1825,9 +1905,10 @@ QFunctionPointer QGuiApplication::platformFunction(const QByteArray &function)
Generally, no user interaction can take place before calling exec().
- To make your application perform idle processing, e.g., executing a special
- function whenever there are no pending events, use a QTimer with 0 timeout.
- More advanced idle processing schemes can be achieved using processEvents().
+ To make your application perform idle processing, e.g., executing a
+ special function whenever there are no pending events, use a QChronoTimer
+ with 0ns timeout. More advanced idle processing schemes can be achieved
+ using processEvents().
We recommend that you connect clean-up code to the
\l{QCoreApplication::}{aboutToQuit()} signal, instead of putting it in your
@@ -1839,12 +1920,66 @@ QFunctionPointer QGuiApplication::platformFunction(const QByteArray &function)
*/
int QGuiApplication::exec()
{
-#ifndef QT_NO_ACCESSIBILITY
+#if QT_CONFIG(accessibility)
QAccessible::setRootObject(qApp);
#endif
return QCoreApplication::exec();
}
+void QGuiApplicationPrivate::captureGlobalModifierState(QEvent *e)
+{
+ if (e->spontaneous()) {
+ // Capture the current mouse and keyboard states. Doing so here is
+ // required in order to support Qt Test synthesized events. Real mouse
+ // and keyboard state updates from the platform plugin are managed by
+ // QGuiApplicationPrivate::process(Mouse|Wheel|Key|Touch|Tablet)Event();
+ // ### FIXME: Qt Test should not call qapp->notify(), but rather route
+ // the events through the proper QPA interface. This is required to
+ // properly generate all other events such as enter/leave etc.
+ switch (e->type()) {
+ case QEvent::MouseButtonPress: {
+ QMouseEvent *me = static_cast<QMouseEvent *>(e);
+ QGuiApplicationPrivate::modifier_buttons = me->modifiers();
+ QGuiApplicationPrivate::mouse_buttons |= me->button();
+ break;
+ }
+ case QEvent::MouseButtonDblClick: {
+ QMouseEvent *me = static_cast<QMouseEvent *>(e);
+ QGuiApplicationPrivate::modifier_buttons = me->modifiers();
+ QGuiApplicationPrivate::mouse_buttons |= me->button();
+ break;
+ }
+ case QEvent::MouseButtonRelease: {
+ QMouseEvent *me = static_cast<QMouseEvent *>(e);
+ QGuiApplicationPrivate::modifier_buttons = me->modifiers();
+ QGuiApplicationPrivate::mouse_buttons &= ~me->button();
+ break;
+ }
+ case QEvent::KeyPress:
+ case QEvent::KeyRelease:
+ case QEvent::MouseMove:
+#if QT_CONFIG(wheelevent)
+ case QEvent::Wheel:
+#endif
+ case QEvent::TouchBegin:
+ case QEvent::TouchUpdate:
+ case QEvent::TouchEnd:
+#if QT_CONFIG(tabletevent)
+ case QEvent::TabletMove:
+ case QEvent::TabletPress:
+ case QEvent::TabletRelease:
+#endif
+ {
+ QInputEvent *ie = static_cast<QInputEvent *>(e);
+ QGuiApplicationPrivate::modifier_buttons = ie->modifiers();
+ break;
+ }
+ default:
+ break;
+ }
+ }
+}
+
/*! \reimp
*/
bool QGuiApplication::notify(QObject *object, QEvent *event)
@@ -1854,6 +1989,8 @@ bool QGuiApplication::notify(QObject *object, QEvent *event)
return true; // Platform plugin ate the event
}
+ QGuiApplicationPrivate::captureGlobalModifierState(event);
+
return QCoreApplication::notify(object, event);
}
@@ -1861,9 +1998,24 @@ bool QGuiApplication::notify(QObject *object, QEvent *event)
*/
bool QGuiApplication::event(QEvent *e)
{
- if(e->type() == QEvent::LanguageChange) {
- setLayoutDirection(qt_detectRTLLanguage()?Qt::RightToLeft:Qt::LeftToRight);
- } else if (e->type() == QEvent::Quit) {
+ switch (e->type()) {
+ case QEvent::LanguageChange:
+ // if the layout direction was set explicitly, then don't override it here
+ if (layout_direction == Qt::LayoutDirectionAuto)
+ setLayoutDirection(layout_direction);
+ for (auto *topLevelWindow : QGuiApplication::topLevelWindows()) {
+ if (topLevelWindow->flags() != Qt::Desktop)
+ postEvent(topLevelWindow, new QEvent(QEvent::LanguageChange));
+ }
+ break;
+ case QEvent::ApplicationFontChange:
+ case QEvent::ApplicationPaletteChange:
+ for (auto *topLevelWindow : QGuiApplication::topLevelWindows()) {
+ if (topLevelWindow->flags() != Qt::Desktop)
+ postEvent(topLevelWindow, new QEvent(e->type()));
+ }
+ break;
+ case QEvent::Quit:
// Close open windows. This is done in order to deliver de-expose
// events while the event loop is still running.
for (QWindow *topLevelWindow : QGuiApplication::topLevelWindows()) {
@@ -1875,8 +2027,10 @@ bool QGuiApplication::event(QEvent *e)
return true;
}
}
+ break;
+ default:
+ break;
}
-
return QCoreApplication::event(e);
}
@@ -1902,17 +2056,14 @@ bool QGuiApplicationPrivate::sendQWindowEventToQPlatformWindow(QWindow *window,
return platformWindow->windowEvent(event);
}
-#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
bool QGuiApplicationPrivate::processNativeEvent(QWindow *window, const QByteArray &eventType, void *message, qintptr *result)
-#else
-bool QGuiApplicationPrivate::processNativeEvent(QWindow *window, const QByteArray &eventType, void *message, long *result)
-#endif
{
return window->nativeEvent(eventType, message, result);
}
-void QGuiApplicationPrivate::processWindowSystemEvent(QWindowSystemInterfacePrivate::WindowSystemEvent *e)
+void Q_TRACE_INSTRUMENT(qtgui) QGuiApplicationPrivate::processWindowSystemEvent(QWindowSystemInterfacePrivate::WindowSystemEvent *e)
{
+ Q_TRACE_PARAM_REPLACE(QWindowSystemInterfacePrivate::WindowSystemEvent *, int);
Q_TRACE_SCOPE(QGuiApplicationPrivate_processWindowSystemEvent, e->type);
switch(e->type) {
@@ -1937,8 +2088,8 @@ void QGuiApplicationPrivate::processWindowSystemEvent(QWindowSystemInterfacePriv
case QWindowSystemInterfacePrivate::Leave:
QGuiApplicationPrivate::processLeaveEvent(static_cast<QWindowSystemInterfacePrivate::LeaveEvent *>(e));
break;
- case QWindowSystemInterfacePrivate::ActivatedWindow:
- QGuiApplicationPrivate::processActivatedEvent(static_cast<QWindowSystemInterfacePrivate::ActivatedWindowEvent *>(e));
+ case QWindowSystemInterfacePrivate::FocusWindow:
+ QGuiApplicationPrivate::processFocusWindowEvent(static_cast<QWindowSystemInterfacePrivate::FocusWindowEvent *>(e));
break;
case QWindowSystemInterfacePrivate::WindowStateChanged:
QGuiApplicationPrivate::processWindowStateChangedEvent(static_cast<QWindowSystemInterfacePrivate::WindowStateChangedEvent *>(e));
@@ -1946,6 +2097,9 @@ void QGuiApplicationPrivate::processWindowSystemEvent(QWindowSystemInterfacePriv
case QWindowSystemInterfacePrivate::WindowScreenChanged:
QGuiApplicationPrivate::processWindowScreenChangedEvent(static_cast<QWindowSystemInterfacePrivate::WindowScreenChangedEvent *>(e));
break;
+ case QWindowSystemInterfacePrivate::WindowDevicePixelRatioChanged:
+ QGuiApplicationPrivate::processWindowDevicePixelRatioChangedEvent(static_cast<QWindowSystemInterfacePrivate::WindowDevicePixelRatioChangedEvent *>(e));
+ break;
case QWindowSystemInterfacePrivate::SafeAreaMarginsChanged:
QGuiApplicationPrivate::processSafeAreaMarginsChangedEvent(static_cast<QWindowSystemInterfacePrivate::SafeAreaMarginsChangedEvent *>(e));
break;
@@ -1987,6 +2141,9 @@ void QGuiApplicationPrivate::processWindowSystemEvent(QWindowSystemInterfacePriv
case QWindowSystemInterfacePrivate::Expose:
QGuiApplicationPrivate::processExposeEvent(static_cast<QWindowSystemInterfacePrivate::ExposeEvent *>(e));
break;
+ case QWindowSystemInterfacePrivate::Paint:
+ QGuiApplicationPrivate::processPaintEvent(static_cast<QWindowSystemInterfacePrivate::PaintEvent *>(e));
+ break;
case QWindowSystemInterfacePrivate::Tablet:
QGuiApplicationPrivate::processTabletEvent(
static_cast<QWindowSystemInterfacePrivate::TabletEvent *>(e));
@@ -2045,94 +2202,69 @@ void QGuiApplicationPrivate::processMouseEvent(QWindowSystemInterfacePrivate::Mo
QEvent::Type type = QEvent::None;
Qt::MouseButton button = Qt::NoButton;
QWindow *window = e->window.data();
+ const QPointingDevice *device = static_cast<const QPointingDevice *>(e->device);
+ Q_ASSERT(device);
+ QPointingDevicePrivate *devPriv = QPointingDevicePrivate::get(const_cast<QPointingDevice*>(device));
bool positionChanged = QGuiApplicationPrivate::lastCursorPosition != e->globalPos;
bool mouseMove = false;
bool mousePress = false;
+ const QPointF lastGlobalPosition = QGuiApplicationPrivate::lastCursorPosition;
+ QPointF globalPoint = e->globalPos;
- if (e->enhancedMouseEvent()) {
- type = e->buttonType;
- button = e->button;
-
- if (type == QEvent::NonClientAreaMouseMove || type == QEvent::MouseMove)
- mouseMove = true;
- else if (type == QEvent::NonClientAreaMouseButtonPress || type == QEvent::MouseButtonPress)
- mousePress = true;
-
- if (!mouseMove && positionChanged) {
- QWindowSystemInterfacePrivate::MouseEvent moveEvent(window, e->timestamp,
- e->localPos, e->globalPos, e->buttons ^ button, e->modifiers, Qt::NoButton,
- e->nonClientArea ? QEvent::NonClientAreaMouseMove : QEvent::MouseMove,
- e->source, e->nonClientArea);
- if (e->synthetic())
- moveEvent.flags |= QWindowSystemInterfacePrivate::WindowSystemEvent::Synthetic;
- processMouseEvent(&moveEvent); // mouse move excluding state change
- processMouseEvent(e); // the original mouse event
- return;
- }
- } else {
- Qt::MouseButtons stateChange = e->buttons ^ mouse_buttons;
- if (positionChanged && (stateChange != Qt::NoButton)) {
- QWindowSystemInterfacePrivate::MouseEvent moveEvent(window, e->timestamp, e->localPos,
- e->globalPos, mouse_buttons, e->modifiers, Qt::NoButton, QEvent::None, e->source,
- e->nonClientArea);
- if (e->synthetic())
- moveEvent.flags |= QWindowSystemInterfacePrivate::WindowSystemEvent::Synthetic;
- processMouseEvent(&moveEvent); // mouse move excluding state change
- processMouseEvent(e); // the original mouse event
- return;
- }
+ if (qIsNaN(e->globalPos.x()) || qIsNaN(e->globalPos.y())) {
+ qWarning("QGuiApplicationPrivate::processMouseEvent: Got NaN in mouse position");
+ return;
+ }
- // In the compatibility path we deduce event type and button that caused the event
- if (positionChanged) {
- mouseMove = true;
- type = e->nonClientArea ? QEvent::NonClientAreaMouseMove : QEvent::MouseMove;
- } else {
- // Check to see if a new button has been pressed/released.
- for (uint mask = Qt::LeftButton; mask <= Qt::MaxMouseButton; mask <<= 1) {
- if (stateChange & mask) {
- button = Qt::MouseButton(mask);
- break;
- }
- }
- if (button == Qt::NoButton) {
- // Ignore mouse events that don't change the current state. This shouldn't
- // really happen, getting here can only mean that the stored button state
- // is out of sync with the actual physical button state.
- return;
- }
- if (button & e->buttons) {
- mousePress = true;
- type = e->nonClientArea ? QEvent::NonClientAreaMouseButtonPress
- : QEvent::MouseButtonPress;
- } else {
- type = e->nonClientArea ? QEvent::NonClientAreaMouseButtonRelease
- : QEvent::MouseButtonRelease;
- }
- }
+ type = e->buttonType;
+ button = e->button;
+
+ if (type == QEvent::NonClientAreaMouseMove || type == QEvent::MouseMove)
+ mouseMove = true;
+ else if (type == QEvent::NonClientAreaMouseButtonPress || type == QEvent::MouseButtonPress)
+ mousePress = true;
+
+ if (!mouseMove && positionChanged) {
+ QWindowSystemInterfacePrivate::MouseEvent moveEvent(window, e->timestamp,
+ e->localPos, e->globalPos, e->buttons ^ button, e->modifiers, Qt::NoButton,
+ e->nonClientArea ? QEvent::NonClientAreaMouseMove : QEvent::MouseMove,
+ e->source, e->nonClientArea);
+ if (e->synthetic())
+ moveEvent.flags |= QWindowSystemInterfacePrivate::WindowSystemEvent::Synthetic;
+ processMouseEvent(&moveEvent); // mouse move excluding state change
+ processMouseEvent(e); // the original mouse event
+ return;
+ }
+ if (type == QEvent::MouseMove && !positionChanged) {
+ // On Windows, and possibly other platforms, a touchpad can send a mouse move
+ // that does not change position, between a press and a release. This may
+ // confuse applications, so we always filter out these mouse events for
+ // consistent behavior among platforms.
+ return;
}
modifier_buttons = e->modifiers;
QPointF localPoint = e->localPos;
- QPointF globalPoint = e->globalPos;
bool doubleClick = false;
+ auto persistentEPD = devPriv->pointById(0);
if (mouseMove) {
QGuiApplicationPrivate::lastCursorPosition = globalPoint;
- const auto doubleClickDistance = e->source == Qt::MouseEventNotSynthesized ?
- mouseDoubleClickDistance : touchDoubleTapDistance;
- if (qAbs(globalPoint.x() - mousePressX) > doubleClickDistance ||
- qAbs(globalPoint.y() - mousePressY) > doubleClickDistance)
+ const auto doubleClickDistance = (e->device && e->device->type() == QInputDevice::DeviceType::Mouse ?
+ mouseDoubleClickDistance : touchDoubleTapDistance);
+ const auto pressPos = persistentEPD->eventPoint.globalPressPosition();
+ if (qAbs(globalPoint.x() - pressPos.x()) > doubleClickDistance ||
+ qAbs(globalPoint.y() - pressPos.y()) > doubleClickDistance)
mousePressButton = Qt::NoButton;
} else {
+ static unsigned long lastPressTimestamp = 0;
mouse_buttons = e->buttons;
if (mousePress) {
ulong doubleClickInterval = static_cast<ulong>(QGuiApplication::styleHints()->mouseDoubleClickInterval());
- doubleClick = e->timestamp - mousePressTime < doubleClickInterval && button == mousePressButton;
- mousePressTime = e->timestamp;
+ doubleClick = e->timestamp - lastPressTimestamp
+ < doubleClickInterval && button == mousePressButton;
mousePressButton = button;
- const QPoint point = QGuiApplicationPrivate::lastCursorPosition.toPoint();
- mousePressX = point.x();
- mousePressY = point.y();
+ lastPressTimestamp = e ->timestamp;
}
}
@@ -2150,8 +2282,7 @@ void QGuiApplicationPrivate::processMouseEvent(QWindowSystemInterfacePrivate::Mo
window = currentMousePressWindow;
currentMousePressWindow = nullptr;
}
- QPointF delta = globalPoint - globalPoint.toPoint();
- localPoint = window->mapFromGlobal(globalPoint.toPoint()) + delta;
+ localPoint = window->mapFromGlobal(globalPoint);
}
}
@@ -2165,16 +2296,24 @@ void QGuiApplicationPrivate::processMouseEvent(QWindowSystemInterfacePrivate::Mo
const QPointF nativeLocalPoint = QHighDpi::toNativePixels(localPoint, screen);
const QPointF nativeGlobalPoint = QHighDpi::toNativePixels(globalPoint, screen);
QMouseEvent ev(type, nativeLocalPoint, nativeLocalPoint, nativeGlobalPoint,
- button, e->buttons, e->modifiers, e->source);
- ev.setTimestamp(e->timestamp);
+ button, e->buttons, e->modifiers, e->source, device);
+ // avoid incorrect velocity calculation: ev is in the native coordinate system,
+ // but we need to consistently use the logical coordinate system for velocity
+ // whenever QEventPoint::setTimestamp() is called
+ ev.QInputEvent::setTimestamp(e->timestamp);
cursor->pointerEvent(ev);
}
}
#endif
- QMouseEvent ev(type, localPoint, localPoint, globalPoint, button, e->buttons, e->modifiers, e->source);
+ QMouseEvent ev(type, localPoint, localPoint, globalPoint, button, e->buttons, e->modifiers, e->source, device);
+ Q_ASSERT(devPriv->pointById(0) == persistentEPD); // we don't expect reallocation in QPlatformCursor::pointerEvenmt()
+ // restore globalLastPosition to avoid invalidating the velocity calculations,
+ // because the QPlatformCursor mouse event above was in native coordinates
+ QMutableEventPoint::setGlobalLastPosition(persistentEPD->eventPoint, lastGlobalPosition);
+ persistentEPD = nullptr; // incoming and synth events can cause reallocation during delivery, so don't use this again
+ // ev now contains a detached copy of the QEventPoint from QPointingDevicePrivate::activePoints
ev.setTimestamp(e->timestamp);
-
if (window->d_func()->blockedByModalWindow && !qApp->d_func()->popupActive()) {
// a modal window is blocking this window, don't allow mouse events through
return;
@@ -2182,7 +2321,7 @@ void QGuiApplicationPrivate::processMouseEvent(QWindowSystemInterfacePrivate::Mo
if (doubleClick && (ev.type() == QEvent::MouseButtonPress)) {
// QtBUG-25831, used to suppress delivery in qwidgetwindow.cpp
- setMouseEventFlags(&ev, ev.flags() | Qt::MouseEventCreatedDoubleClick);
+ QMutableSinglePointEvent::from(ev).setDoubleClick();
}
QGuiApplication::sendSpontaneousEvent(window, &ev);
@@ -2190,24 +2329,20 @@ void QGuiApplicationPrivate::processMouseEvent(QWindowSystemInterfacePrivate::Mo
if (!e->synthetic() && !ev.isAccepted()
&& !e->nonClientArea
&& qApp->testAttribute(Qt::AA_SynthesizeTouchForUnhandledMouseEvents)) {
- if (!m_fakeTouchDevice) {
- m_fakeTouchDevice = new QTouchDevice;
- QWindowSystemInterface::registerTouchDevice(m_fakeTouchDevice);
- }
QList<QWindowSystemInterface::TouchPoint> points;
QWindowSystemInterface::TouchPoint point;
point.id = 1;
- point.area = QRectF(globalPoint.x() - 2, globalPoint.y() - 2, 4, 4);
+ point.area = QHighDpi::toNativePixels(QRectF(globalPoint.x() - 2, globalPoint.y() - 2, 4, 4), window);
// only translate left button related events to
// avoid strange touch event sequences when several
// buttons are pressed
if (type == QEvent::MouseButtonPress && button == Qt::LeftButton) {
- point.state = Qt::TouchPointPressed;
+ point.state = QEventPoint::State::Pressed;
} else if (type == QEvent::MouseButtonRelease && button == Qt::LeftButton) {
- point.state = Qt::TouchPointReleased;
+ point.state = QEventPoint::State::Released;
} else if (type == QEvent::MouseMove && (e->buttons & Qt::LeftButton)) {
- point.state = Qt::TouchPointMoved;
+ point.state = QEventPoint::State::Updated;
} else {
return;
}
@@ -2215,10 +2350,10 @@ void QGuiApplicationPrivate::processMouseEvent(QWindowSystemInterfacePrivate::Mo
points << point;
QEvent::Type type;
- QList<QTouchEvent::TouchPoint> touchPoints =
- QWindowSystemInterfacePrivate::fromNativeTouchPoints(points, window, QTouchDevicePrivate::get(m_fakeTouchDevice)->id, &type);
+ const QList<QEventPoint> &touchPoints =
+ QWindowSystemInterfacePrivate::fromNativeTouchPoints(points, window, &type);
- QWindowSystemInterfacePrivate::TouchEvent fake(window, e->timestamp, type, m_fakeTouchDevice, touchPoints, e->modifiers);
+ QWindowSystemInterfacePrivate::TouchEvent fake(window, e->timestamp, type, device, touchPoints, e->modifiers);
fake.flags |= QWindowSystemInterfacePrivate::WindowSystemEvent::Synthetic;
processTouchEvent(&fake);
}
@@ -2227,11 +2362,17 @@ void QGuiApplicationPrivate::processMouseEvent(QWindowSystemInterfacePrivate::Mo
if (!e->window.isNull() || e->nullWindow()) { // QTBUG-36364, check if window closed in response to press
const QEvent::Type doubleClickType = e->nonClientArea ? QEvent::NonClientAreaMouseButtonDblClick : QEvent::MouseButtonDblClick;
QMouseEvent dblClickEvent(doubleClickType, localPoint, localPoint, globalPoint,
- button, e->buttons, e->modifiers, e->source);
+ button, e->buttons, e->modifiers, e->source, device);
dblClickEvent.setTimestamp(e->timestamp);
QGuiApplication::sendSpontaneousEvent(window, &dblClickEvent);
}
}
+ if (type == QEvent::MouseButtonRelease && e->buttons == Qt::NoButton) {
+ if (auto *persistentEPD = devPriv->queryPointById(0)) {
+ ev.setExclusiveGrabber(persistentEPD->eventPoint, nullptr);
+ ev.clearPassiveGrabbers(persistentEPD->eventPoint);
+ }
+ }
}
void QGuiApplicationPrivate::processWheelEvent(QWindowSystemInterfacePrivate::WheelEvent *e)
@@ -2243,10 +2384,8 @@ void QGuiApplicationPrivate::processWheelEvent(QWindowSystemInterfacePrivate::Wh
if (e->nullWindow()) {
window = QGuiApplication::topLevelAt(globalPoint.toPoint());
- if (window) {
- QPointF delta = globalPoint - globalPoint.toPoint();
- localPoint = window->mapFromGlobal(globalPoint.toPoint()) + delta;
- }
+ if (window)
+ localPoint = window->mapFromGlobal(globalPoint);
}
if (!window)
@@ -2260,18 +2399,12 @@ void QGuiApplicationPrivate::processWheelEvent(QWindowSystemInterfacePrivate::Wh
return;
}
-#if QT_DEPRECATED_SINCE(5, 14)
-QT_WARNING_PUSH
-QT_WARNING_DISABLE_DEPRECATED
- QWheelEvent ev(localPoint, globalPoint, e->pixelDelta, e->angleDelta, e->qt4Delta, e->qt4Orientation,
- mouse_buttons, e->modifiers, e->phase, e->source, e->inverted);
-QT_WARNING_POP
-#else
+ const QPointingDevice *device = static_cast<const QPointingDevice *>(e->device);
QWheelEvent ev(localPoint, globalPoint, e->pixelDelta, e->angleDelta,
- mouse_buttons, e->modifiers, e->phase, e->inverted, e->source);
-#endif
- ev.setTimestamp(e->timestamp);
- QGuiApplication::sendSpontaneousEvent(window, &ev);
+ mouse_buttons, e->modifiers, e->phase, e->inverted, e->source, device);
+ ev.setTimestamp(e->timestamp);
+ QGuiApplication::sendSpontaneousEvent(window, &ev);
+ e->eventAccepted = ev.isAccepted();
#else
Q_UNUSED(e);
#endif // QT_CONFIG(wheelevent)
@@ -2282,7 +2415,7 @@ void QGuiApplicationPrivate::processKeyEvent(QWindowSystemInterfacePrivate::KeyE
QWindow *window = e->window.data();
modifier_buttons = e->modifiers;
if (e->nullWindow()
-#if defined(Q_OS_ANDROID) && !defined(Q_OS_ANDROID_EMBEDDED)
+#ifdef Q_OS_ANDROID
|| e->key == Qt::Key_Back || e->key == Qt::Key_Menu
#endif
) {
@@ -2294,7 +2427,7 @@ void QGuiApplicationPrivate::processKeyEvent(QWindowSystemInterfacePrivate::KeyE
static bool menuKeyPressAccepted = false;
#endif
-#if !defined(Q_OS_OSX)
+#if !defined(Q_OS_MACOS)
// FIXME: Include OS X in this code path by passing the key event through
// QPlatformInputContext::filterEvent().
if (e->keyType == QEvent::KeyPress && window) {
@@ -2318,7 +2451,7 @@ void QGuiApplicationPrivate::processKeyEvent(QWindowSystemInterfacePrivate::KeyE
if (window && !window->d_func()->blockedByModalWindow)
QGuiApplication::sendSpontaneousEvent(window, &ev);
-#if defined(Q_OS_ANDROID) && !defined(Q_OS_ANDROID_EMBEDDED)
+#ifdef Q_OS_ANDROID
else
ev.setAccepted(false);
@@ -2348,7 +2481,19 @@ void QGuiApplicationPrivate::processEnterEvent(QWindowSystemInterfacePrivate::En
currentMouseWindow = e->enter;
+ // TODO later: EnterEvent must report _which_ mouse entered the window; for now we assume primaryPointingDevice()
QEnterEvent event(e->localPos, e->localPos, e->globalPos);
+
+ // Since we don't always track mouse moves that occur outside a window, any residual velocity
+ // stored in the persistent QEventPoint may be inaccurate (especially in fast-moving autotests).
+ // Reset the Kalman filter so that the velocity of the first mouse event after entering the window
+ // will be based on a zero residual velocity (but the result can still be non-zero if the mouse
+ // moves to a different position from where this enter event occurred; tests often do that).
+ const QPointingDevicePrivate *devPriv = QPointingDevicePrivate::get(event.pointingDevice());
+ auto epd = devPriv->queryPointById(event.points().first().id());
+ Q_ASSERT(epd);
+ QMutableEventPoint::setVelocity(epd->eventPoint, {});
+
QCoreApplication::sendSpontaneousEvent(e->enter.data(), &event);
}
@@ -2367,10 +2512,10 @@ void QGuiApplicationPrivate::processLeaveEvent(QWindowSystemInterfacePrivate::Le
QCoreApplication::sendSpontaneousEvent(e->leave.data(), &event);
}
-void QGuiApplicationPrivate::processActivatedEvent(QWindowSystemInterfacePrivate::ActivatedWindowEvent *e)
+void QGuiApplicationPrivate::processFocusWindowEvent(QWindowSystemInterfacePrivate::FocusWindowEvent *e)
{
QWindow *previous = QGuiApplicationPrivate::focus_window;
- QWindow *newFocus = e->activated.data();
+ QWindow *newFocus = e->focused.data();
if (previous == newFocus)
return;
@@ -2420,8 +2565,15 @@ void QGuiApplicationPrivate::processActivatedEvent(QWindowSystemInterfacePrivate
if (self) {
self->notifyActiveWindowChange(previous);
- if (previousFocusObject != qApp->focusObject())
+ if (previousFocusObject != qApp->focusObject() ||
+ // We are getting an activation change but there is no new focusObject, and we also
+ // don't have a previousFocusObject in the previously active window anymore. This can
+ // happen when window gets destroyed (see QWidgetWindow::focusObject returning nullptr
+ // when already in the QWidget destructor), so update the focusObject to avoid dangling
+ // pointers. See also QWidget::clearFocus(), which tries to cover for this as well.
+ (previous && previousFocusObject == nullptr && qApp->focusObject() == nullptr)) {
self->_q_updateFocusObject(qApp->focusObject());
+ }
}
emit qApp->focusWindowChanged(newFocus);
@@ -2433,32 +2585,46 @@ void QGuiApplicationPrivate::processActivatedEvent(QWindowSystemInterfacePrivate
void QGuiApplicationPrivate::processWindowStateChangedEvent(QWindowSystemInterfacePrivate::WindowStateChangedEvent *wse)
{
- if (QWindow *window = wse->window.data()) {
+ if (QWindow *window = wse->window.data()) {
+ QWindowPrivate *windowPrivate = qt_window_private(window);
+ const auto originalEffectiveState = QWindowPrivate::effectiveState(windowPrivate->windowState);
+
+ windowPrivate->windowState = wse->newState;
+ const auto newEffectiveState = QWindowPrivate::effectiveState(windowPrivate->windowState);
+ if (newEffectiveState != originalEffectiveState)
+ emit window->windowStateChanged(newEffectiveState);
+
+ windowPrivate->updateVisibility();
+
QWindowStateChangeEvent e(wse->oldState);
- window->d_func()->windowState = wse->newState;
QGuiApplication::sendSpontaneousEvent(window, &e);
}
}
void QGuiApplicationPrivate::processWindowScreenChangedEvent(QWindowSystemInterfacePrivate::WindowScreenChangedEvent *wse)
{
- if (QWindow *window = wse->window.data()) {
- if (window->screen() == wse->screen.data())
- return;
- if (QWindow *topLevelWindow = window->d_func()->topLevelWindow(QWindow::ExcludeTransients)) {
- if (QScreen *screen = wse->screen.data())
- topLevelWindow->d_func()->setTopLevelScreen(screen, false /* recreate */);
- else // Fall back to default behavior, and try to find some appropriate screen
- topLevelWindow->setScreen(nullptr);
- }
- // we may have changed scaling, so trigger resize event if needed
- if (window->handle()) {
- QWindowSystemInterfacePrivate::GeometryChangeEvent gce(window, QHighDpi::fromNativePixels(window->handle()->geometry(), window));
- processGeometryChangeEvent(&gce);
- }
+ QWindow *window = wse->window.data();
+ if (!window)
+ return;
+
+ if (window->screen() == wse->screen.data())
+ return;
+
+ if (QWindow *topLevelWindow = window->d_func()->topLevelWindow(QWindow::ExcludeTransients)) {
+ if (QScreen *screen = wse->screen.data())
+ topLevelWindow->d_func()->setTopLevelScreen(screen, false /* recreate */);
+ else // Fall back to default behavior, and try to find some appropriate screen
+ topLevelWindow->setScreen(nullptr);
}
}
+void QGuiApplicationPrivate::processWindowDevicePixelRatioChangedEvent(QWindowSystemInterfacePrivate::WindowDevicePixelRatioChangedEvent *wde)
+{
+ if (wde->window.isNull())
+ return;
+ QWindowPrivate::get(wde->window)->updateDevicePixelRatio();
+}
+
void QGuiApplicationPrivate::processSafeAreaMarginsChangedEvent(QWindowSystemInterfacePrivate::SafeAreaMarginsChangedEvent *wse)
{
if (wse->window.isNull())
@@ -2473,11 +2639,33 @@ void QGuiApplicationPrivate::processSafeAreaMarginsChangedEvent(QWindowSystemInt
void QGuiApplicationPrivate::processThemeChanged(QWindowSystemInterfacePrivate::ThemeChangeEvent *tce)
{
if (self)
- self->notifyThemeChanged();
- if (QWindow *window = tce->window.data()) {
- QEvent e(QEvent::ThemeChange);
- QGuiApplication::sendSpontaneousEvent(window, &e);
+ self->handleThemeChanged();
+
+ QIconPrivate::clearIconCache();
+
+ QEvent themeChangeEvent(QEvent::ThemeChange);
+ const QWindowList windows = tce->window ? QWindowList{tce->window} : window_list;
+ for (auto *window : windows)
+ QGuiApplication::sendSpontaneousEvent(window, &themeChangeEvent);
+}
+
+void QGuiApplicationPrivate::handleThemeChanged()
+{
+ const auto newColorScheme = platformTheme() ? platformTheme()->colorScheme()
+ : Qt::ColorScheme::Unknown;
+ QStyleHintsPrivate::get(QGuiApplication::styleHints())->updateColorScheme(newColorScheme);
+
+ updatePalette();
+
+ QIconLoader::instance()->updateSystemTheme();
+ QAbstractFileIconProviderPrivate::clearIconTypeCache();
+
+ if (!(applicationResourceFlags & ApplicationFontExplicitlySet)) {
+ const auto locker = qt_scoped_lock(applicationFontMutex);
+ clearFontUnlocked();
+ initFontUnlocked();
}
+ initThemeHints();
}
void QGuiApplicationPrivate::processGeometryChangeEvent(QWindowSystemInterfacePrivate::GeometryChangeEvent *e)
@@ -2536,8 +2724,10 @@ void QGuiApplicationPrivate::processCloseEvent(QWindowSystemInterfacePrivate::Cl
{
if (e->window.isNull())
return;
- if (e->window.data()->d_func()->blockedByModalWindow) {
- // a modal window is blocking this window, don't allow close events through
+ if (e->window.data()->d_func()->blockedByModalWindow && !e->window.data()->d_func()->inClose) {
+ // a modal window is blocking this window, don't allow close events through, unless they
+ // originate from a call to QWindow::close.
+ e->eventAccepted = false;
return;
}
@@ -2571,7 +2761,8 @@ QGuiApplicationPrivate::TabletPointData &QGuiApplicationPrivate::tabletDevicePoi
void QGuiApplicationPrivate::processTabletEvent(QWindowSystemInterfacePrivate::TabletEvent *e)
{
#if QT_CONFIG(tabletevent)
- TabletPointData &pointData = tabletDevicePoint(e->uid);
+ const auto device = static_cast<const QPointingDevice *>(e->device);
+ TabletPointData &pointData = tabletDevicePoint(device->uniqueId().numericId());
QEvent::Type type = QEvent::TabletMove;
if (e->buttons != pointData.state)
@@ -2607,6 +2798,8 @@ void QGuiApplicationPrivate::processTabletEvent(QWindowSystemInterfacePrivate::T
QPointF delta = e->global - e->global.toPoint();
local = window->mapFromGlobal(e->global.toPoint()) + delta;
}
+
+ // TODO stop deducing the button state change here: rather require it from the platform plugin, as with mouse events
Qt::MouseButtons stateChange = e->buttons ^ pointData.state;
Qt::MouseButton button = Qt::NoButton;
for (int check = Qt::LeftButton; check <= int(Qt::MaxMouseButton); check = check << 1) {
@@ -2615,10 +2808,11 @@ void QGuiApplicationPrivate::processTabletEvent(QWindowSystemInterfacePrivate::T
break;
}
}
- QTabletEvent tabletEvent(type, local, e->global,
- e->device, e->pointerType, e->pressure, e->xTilt, e->yTilt,
+
+ QTabletEvent tabletEvent(type, device, local, e->global,
+ e->pressure, e->xTilt, e->yTilt,
e->tangentialPressure, e->rotation, e->z,
- e->modifiers, e->uid, button, e->buttons);
+ e->modifiers, button, e->buttons);
tabletEvent.setAccepted(false);
tabletEvent.setTimestamp(e->timestamp);
QGuiApplication::sendSpontaneousEvent(window, &tabletEvent);
@@ -2636,40 +2830,42 @@ void QGuiApplicationPrivate::processTabletEvent(QWindowSystemInterfacePrivate::T
}
}();
QWindowSystemInterfacePrivate::MouseEvent mouseEvent(window, e->timestamp, e->local,
- e->global, e->buttons, e->modifiers, button, mouseType, Qt::MouseEventSynthesizedByQt);
+ e->global, e->buttons, e->modifiers, button, mouseType, Qt::MouseEventNotSynthesized, false, device);
mouseEvent.flags |= QWindowSystemInterfacePrivate::WindowSystemEvent::Synthetic;
+ qCDebug(lcPtrDispatch) << "synthesizing mouse from tablet event" << mouseType
+ << e->local << button << e->buttons << e->modifiers;
processMouseEvent(&mouseEvent);
}
#else
- Q_UNUSED(e)
+ Q_UNUSED(e);
#endif
}
void QGuiApplicationPrivate::processTabletEnterProximityEvent(QWindowSystemInterfacePrivate::TabletEnterProximityEvent *e)
{
#if QT_CONFIG(tabletevent)
- QTabletEvent ev(QEvent::TabletEnterProximity, QPointF(), QPointF(),
- e->device, e->pointerType, 0, 0, 0,
- 0, 0, 0,
- Qt::NoModifier, e->uid, Qt::NoButton, tabletDevicePoint(e->uid).state);
+ const QPointingDevice *dev = static_cast<const QPointingDevice *>(e->device);
+ QTabletEvent ev(QEvent::TabletEnterProximity, dev, QPointF(), QPointF(),
+ 0, 0, 0, 0, 0, 0, e->modifiers, Qt::NoButton,
+ tabletDevicePoint(dev->uniqueId().numericId()).state);
ev.setTimestamp(e->timestamp);
QGuiApplication::sendSpontaneousEvent(qGuiApp, &ev);
#else
- Q_UNUSED(e)
+ Q_UNUSED(e);
#endif
}
void QGuiApplicationPrivate::processTabletLeaveProximityEvent(QWindowSystemInterfacePrivate::TabletLeaveProximityEvent *e)
{
#if QT_CONFIG(tabletevent)
- QTabletEvent ev(QEvent::TabletLeaveProximity, QPointF(), QPointF(),
- e->device, e->pointerType, 0, 0, 0,
- 0, 0, 0,
- Qt::NoModifier, e->uid, Qt::NoButton, tabletDevicePoint(e->uid).state);
+ const QPointingDevice *dev = static_cast<const QPointingDevice *>(e->device);
+ QTabletEvent ev(QEvent::TabletLeaveProximity, dev, QPointF(), QPointF(),
+ 0, 0, 0, 0, 0, 0, e->modifiers, Qt::NoButton,
+ tabletDevicePoint(dev->uniqueId().numericId()).state);
ev.setTimestamp(e->timestamp);
QGuiApplication::sendSpontaneousEvent(qGuiApp, &ev);
#else
- Q_UNUSED(e)
+ Q_UNUSED(e);
#endif
}
@@ -2679,7 +2875,9 @@ void QGuiApplicationPrivate::processGestureEvent(QWindowSystemInterfacePrivate::
if (e->window.isNull())
return;
- QNativeGestureEvent ev(e->type, e->device, e->pos, e->pos, e->globalPos, e->realValue, e->sequenceId, e->intValue);
+ const QPointingDevice *device = static_cast<const QPointingDevice *>(e->device);
+ QNativeGestureEvent ev(e->type, device, e->fingerCount, e->pos, e->pos, e->globalPos, (e->intValue ? e->intValue : e->realValue),
+ e->delta, e->sequenceId);
ev.setTimestamp(e->timestamp);
QGuiApplication::sendSpontaneousEvent(e->window, &ev);
}
@@ -2712,42 +2910,31 @@ void QGuiApplicationPrivate::processContextMenuEvent(QWindowSystemInterfacePriva
}
#endif
-Q_GUI_EXPORT uint qHash(const QGuiApplicationPrivate::ActiveTouchPointsKey &k)
-{
- return qHash(k.device) + k.touchPointId;
-}
-
-Q_GUI_EXPORT bool operator==(const QGuiApplicationPrivate::ActiveTouchPointsKey &a,
- const QGuiApplicationPrivate::ActiveTouchPointsKey &b)
-{
- return a.device == b.device
- && a.touchPointId == b.touchPointId;
-}
-
void QGuiApplicationPrivate::processTouchEvent(QWindowSystemInterfacePrivate::TouchEvent *e)
{
- QGuiApplicationPrivate *d = self;
+ if (!QInputDevicePrivate::isRegistered(e->device))
+ return;
+
modifier_buttons = e->modifiers;
+ QPointingDevice *device = const_cast<QPointingDevice *>(static_cast<const QPointingDevice *>(e->device));
+ QPointingDevicePrivate *devPriv = QPointingDevicePrivate::get(device);
if (e->touchType == QEvent::TouchCancel) {
// The touch sequence has been canceled (e.g. by the compositor).
// Send the TouchCancel to all windows with active touches and clean up.
- QTouchEvent touchEvent(QEvent::TouchCancel, e->device, e->modifiers);
+ QTouchEvent touchEvent(QEvent::TouchCancel, device, e->modifiers);
touchEvent.setTimestamp(e->timestamp);
- QHash<ActiveTouchPointsKey, ActiveTouchPointsValue>::const_iterator it
- = self->activeTouchPoints.constBegin(), ite = self->activeTouchPoints.constEnd();
- QSet<QWindow *> windowsNeedingCancel;
- while (it != ite) {
- QWindow *w = it->window.data();
- if (w)
+ constexpr qsizetype Prealloc = decltype(devPriv->activePoints)::mapped_container_type::PreallocatedSize;
+ QMinimalVarLengthFlatSet<QWindow *, Prealloc> windowsNeedingCancel;
+
+ for (auto &epd : devPriv->activePoints.values()) {
+ if (QWindow *w = QMutableEventPoint::window(epd.eventPoint))
windowsNeedingCancel.insert(w);
- ++it;
- }
- for (QSet<QWindow *>::const_iterator winIt = windowsNeedingCancel.constBegin(),
- winItEnd = windowsNeedingCancel.constEnd(); winIt != winItEnd; ++winIt) {
- touchEvent.setWindow(*winIt);
- QGuiApplication::sendSpontaneousEvent(*winIt, &touchEvent);
}
+
+ for (QWindow *w : windowsNeedingCancel)
+ QGuiApplication::sendSpontaneousEvent(w, &touchEvent);
+
if (!self->synthesizedMousePoints.isEmpty() && !e->synthetic()) {
for (QHash<QWindow *, SynthesizedMouseData>::const_iterator synthIt = self->synthesizedMousePoints.constBegin(),
synthItEnd = self->synthesizedMousePoints.constEnd(); synthIt != synthItEnd; ++synthIt) {
@@ -2761,13 +2948,14 @@ void QGuiApplicationPrivate::processTouchEvent(QWindowSystemInterfacePrivate::To
e->modifiers,
Qt::LeftButton,
QEvent::MouseButtonRelease,
- Qt::MouseEventSynthesizedByQt);
+ Qt::MouseEventNotSynthesized,
+ false,
+ device);
fake.flags |= QWindowSystemInterfacePrivate::WindowSystemEvent::Synthetic;
processMouseEvent(&fake);
}
self->synthesizedMousePoints.clear();
}
- self->activeTouchPoints.clear();
self->lastTouchType = e->touchType;
return;
}
@@ -2778,244 +2966,177 @@ void QGuiApplicationPrivate::processTouchEvent(QWindowSystemInterfacePrivate::To
self->lastTouchType = e->touchType;
- QWindow *window = e->window.data();
- typedef QPair<Qt::TouchPointStates, QList<QTouchEvent::TouchPoint> > StatesAndTouchPoints;
- QHash<QWindow *, StatesAndTouchPoints> windowsNeedingEvents;
- bool stationaryTouchPointChangedProperty = false;
-
- for (int i = 0; i < e->points.count(); ++i) {
- QTouchEvent::TouchPoint touchPoint = e->points.at(i);
- // explicitly detach from the original touch point that we got, so even
- // if the touchpoint structs are reused, we will make a copy that we'll
- // deliver to the user (which might want to store the struct for later use).
- touchPoint.d = touchPoint.d->detach();
+ QPointer<QWindow> window = e->window; // the platform hopefully tells us which window received the event
+ QVarLengthArray<QMutableTouchEvent, 2> touchEvents;
+ // For each temporary QEventPoint from the QPA TouchEvent:
+ // - update the persistent QEventPoint in QPointingDevicePrivate::activePoints with current values
+ // - determine which window to deliver it to
+ // - add it to the QTouchEvent instance for that window (QMutableTouchEvent::target() will be QWindow*, for now)
+ for (auto &tempPt : e->points) {
// update state
- QPointer<QWindow> w;
- QTouchEvent::TouchPoint previousTouchPoint;
- ActiveTouchPointsKey touchInfoKey(e->device, touchPoint.id());
- ActiveTouchPointsValue &touchInfo = d->activeTouchPoints[touchInfoKey];
- switch (touchPoint.state()) {
- case Qt::TouchPointPressed:
- if (e->device->type() == QTouchDevice::TouchPad) {
- // on touch-pads, send all touch points to the same widget
- w = d->activeTouchPoints.isEmpty()
- ? QPointer<QWindow>()
- : d->activeTouchPoints.constBegin().value().window;
- }
-
- if (!w) {
- // determine which window this event will go to
- if (!window)
- window = QGuiApplication::topLevelAt(touchPoint.screenPos().toPoint());
- if (!window)
- continue;
- w = window;
- }
+ auto epd = devPriv->pointById(tempPt.id());
+ auto &ep = epd->eventPoint;
+ epd->eventPoint.setAccepted(false);
+ switch (tempPt.state()) {
+ case QEventPoint::State::Pressed:
+ // On touchpads, send all touch points to the same window.
+ if (!window && e->device && e->device->type() == QInputDevice::DeviceType::TouchPad)
+ window = devPriv->firstActiveWindow();
+ // If the QPA event didn't tell us which window, find the one under the touchpoint position.
+ if (!window)
+ window = QGuiApplication::topLevelAt(tempPt.globalPosition().toPoint());
+ QMutableEventPoint::setWindow(ep, window);
+ break;
- touchInfo.window = w;
- touchPoint.d->startScreenPos = touchPoint.screenPos();
- touchPoint.d->lastScreenPos = touchPoint.screenPos();
- touchPoint.d->startNormalizedPos = touchPoint.normalizedPos();
- touchPoint.d->lastNormalizedPos = touchPoint.normalizedPos();
- if (touchPoint.pressure() < qreal(0.))
- touchPoint.d->pressure = qreal(1.);
+ case QEventPoint::State::Released:
+ if (Q_UNLIKELY(!window.isNull() && window != QMutableEventPoint::window(ep)))
+ qCDebug(lcPtrDispatch) << "delivering touch release to same window"
+ << QMutableEventPoint::window(ep) << "not" << window.data();
+ window = QMutableEventPoint::window(ep);
+ break;
- touchInfo.touchPoint = touchPoint;
+ default: // update or stationary
+ if (Q_UNLIKELY(!window.isNull() && window != QMutableEventPoint::window(ep)))
+ qCDebug(lcPtrDispatch) << "delivering touch update to same window"
+ << QMutableEventPoint::window(ep) << "not" << window.data();
+ window = QMutableEventPoint::window(ep);
break;
+ }
+ // If we somehow still don't have a window, we can't deliver this touchpoint. (should never happen)
+ if (Q_UNLIKELY(!window)) {
+ qCWarning(lcPtrDispatch) << "skipping" << &tempPt << ": no target window";
+ continue;
+ }
+ QMutableEventPoint::update(tempPt, ep);
- case Qt::TouchPointReleased:
- w = touchInfo.window;
- if (!w)
- continue;
+ Q_ASSERT(window.data() != nullptr);
- previousTouchPoint = touchInfo.touchPoint;
- touchPoint.d->startScreenPos = previousTouchPoint.startScreenPos();
- touchPoint.d->lastScreenPos = previousTouchPoint.screenPos();
- touchPoint.d->startPos = previousTouchPoint.startPos();
- touchPoint.d->lastPos = previousTouchPoint.pos();
- touchPoint.d->startNormalizedPos = previousTouchPoint.startNormalizedPos();
- touchPoint.d->lastNormalizedPos = previousTouchPoint.normalizedPos();
- if (touchPoint.pressure() < qreal(0.))
- touchPoint.d->pressure = qreal(0.);
+ // make the *scene* position the same as the *global* position
+ QMutableEventPoint::setScenePosition(ep, tempPt.globalPosition());
- break;
+ // store the scene position as local position, for now
+ QMutableEventPoint::setPosition(ep, window->mapFromGlobal(tempPt.globalPosition()));
- default:
- w = touchInfo.window;
- if (!w)
- continue;
+ // setTimeStamp has side effects, so we do it last
+ QMutableEventPoint::setTimestamp(ep, e->timestamp);
- previousTouchPoint = touchInfo.touchPoint;
- touchPoint.d->startScreenPos = previousTouchPoint.startScreenPos();
- touchPoint.d->lastScreenPos = previousTouchPoint.screenPos();
- touchPoint.d->startPos = previousTouchPoint.startPos();
- touchPoint.d->lastPos = previousTouchPoint.pos();
- touchPoint.d->startNormalizedPos = previousTouchPoint.startNormalizedPos();
- touchPoint.d->lastNormalizedPos = previousTouchPoint.normalizedPos();
- if (touchPoint.pressure() < qreal(0.))
- touchPoint.d->pressure = qreal(1.);
-
- // Stationary points might not be delivered down to the receiving item
- // and get their position transformed, keep the old values instead.
- if (touchPoint.state() == Qt::TouchPointStationary) {
- if (touchInfo.touchPoint.velocity() != touchPoint.velocity()) {
- touchInfo.touchPoint.setVelocity(touchPoint.velocity());
- touchPoint.d->stationaryWithModifiedProperty = true;
- stationaryTouchPointChangedProperty = true;
- }
- if (!qFuzzyCompare(touchInfo.touchPoint.pressure(), touchPoint.pressure())) {
- touchInfo.touchPoint.setPressure(touchPoint.pressure());
- touchPoint.d->stationaryWithModifiedProperty = true;
- stationaryTouchPointChangedProperty = true;
- }
- } else {
- touchInfo.touchPoint = touchPoint;
+ // add the touchpoint to the event that will be delivered to the window
+ bool added = false;
+ for (QMutableTouchEvent &ev : touchEvents) {
+ if (ev.target() == window.data()) {
+ ev.addPoint(ep);
+ added = true;
+ break;
}
- break;
}
-
- Q_ASSERT(w.data() != nullptr);
-
- // make the *scene* functions return the same as the *screen* functions
- // Note: touchPoint is a reference to the one from activeTouchPoints,
- // so we can modify it as long as we're careful NOT to call setters and
- // otherwise NOT to cause the d-pointer to be detached.
- touchPoint.d->scenePos = touchPoint.screenPos();
- touchPoint.d->startScenePos = touchPoint.startScreenPos();
- touchPoint.d->lastScenePos = touchPoint.lastScreenPos();
-
- StatesAndTouchPoints &maskAndPoints = windowsNeedingEvents[w.data()];
- maskAndPoints.first |= touchPoint.state();
- maskAndPoints.second.append(touchPoint);
+ if (!added) {
+ QMutableTouchEvent mte(e->touchType, device, e->modifiers, {ep});
+ mte.setTimestamp(e->timestamp);
+ mte.setTarget(window.data());
+ touchEvents.append(mte);
+ }
}
- if (windowsNeedingEvents.isEmpty())
+ if (touchEvents.isEmpty())
return;
- QHash<QWindow *, StatesAndTouchPoints>::ConstIterator it = windowsNeedingEvents.constBegin();
- const QHash<QWindow *, StatesAndTouchPoints>::ConstIterator end = windowsNeedingEvents.constEnd();
- for (; it != end; ++it) {
- QWindow *w = it.key();
+ for (QMutableTouchEvent &touchEvent : touchEvents) {
+ QWindow *window = static_cast<QWindow *>(touchEvent.target());
QEvent::Type eventType;
- switch (it.value().first) {
- case Qt::TouchPointPressed:
+ switch (touchEvent.touchPointStates()) {
+ case QEventPoint::State::Pressed:
eventType = QEvent::TouchBegin;
break;
- case Qt::TouchPointReleased:
+ case QEventPoint::State::Released:
eventType = QEvent::TouchEnd;
break;
- case Qt::TouchPointStationary:
- // don't send the event if nothing changed
- if (!stationaryTouchPointChangedProperty)
- continue;
- Q_FALLTHROUGH();
default:
eventType = QEvent::TouchUpdate;
break;
}
- if (w->d_func()->blockedByModalWindow && !qApp->d_func()->popupActive()) {
+ if (window->d_func()->blockedByModalWindow && !qApp->d_func()->popupActive()) {
// a modal window is blocking this window, don't allow touch events through
- // QTBUG-37371 temporary fix; TODO: revisit in 5.4 when we have a forwarding solution
- if (eventType == QEvent::TouchEnd) {
+ // QTBUG-37371 temporary fix; TODO: revisit when we have a forwarding solution
+ if (touchEvent.type() == QEvent::TouchEnd) {
// but don't leave dangling state: e.g.
// QQuickWindowPrivate::itemForTouchPointId needs to be cleared.
- QTouchEvent touchEvent(QEvent::TouchCancel,
- e->device,
- e->modifiers);
+ QTouchEvent touchEvent(QEvent::TouchCancel, device, e->modifiers);
touchEvent.setTimestamp(e->timestamp);
- touchEvent.setWindow(w);
- QGuiApplication::sendSpontaneousEvent(w, &touchEvent);
+ QGuiApplication::sendSpontaneousEvent(window, &touchEvent);
}
continue;
}
- QTouchEvent touchEvent(eventType,
- e->device,
- e->modifiers,
- it.value().first, // state flags
- it.value().second); // list of touchpoints
- touchEvent.setTimestamp(e->timestamp);
- touchEvent.setWindow(w);
-
- const int pointCount = touchEvent.touchPoints().count();
- for (int i = 0; i < pointCount; ++i) {
- QTouchEvent::TouchPoint &touchPoint = touchEvent._touchPoints[i];
-
- // preserve the sub-pixel resolution
- const QPointF screenPos = touchPoint.screenPos();
- const QPointF delta = screenPos - screenPos.toPoint();
-
- touchPoint.d->pos = w->mapFromGlobal(screenPos.toPoint()) + delta;
- if (touchPoint.state() == Qt::TouchPointPressed) {
- // touchPoint is actually a reference to one that is stored in activeTouchPoints,
- // and we are now going to store the startPos and lastPos there, for the benefit
- // of future moves and releases. It's important that the d-pointer is NOT detached.
- touchPoint.d->startPos = w->mapFromGlobal(touchPoint.startScreenPos().toPoint()) + delta;
- touchPoint.d->lastPos = w->mapFromGlobal(touchPoint.lastScreenPos().toPoint()) + delta;
- }
- }
+ // Note: after the call to sendSpontaneousEvent, touchEvent.position() will have
+ // changed to reflect the local position inside the last (random) widget it tried
+ // to deliver the touch event to, and will therefore be invalid afterwards.
+ QGuiApplication::sendSpontaneousEvent(window, &touchEvent);
- QGuiApplication::sendSpontaneousEvent(w, &touchEvent);
if (!e->synthetic() && !touchEvent.isAccepted() && qApp->testAttribute(Qt::AA_SynthesizeMouseForUnhandledTouchEvents)) {
// exclude devices which generate their own mouse events
- if (!(touchEvent.device()->capabilities() & QTouchDevice::MouseEmulation)) {
-
- if (eventType == QEvent::TouchEnd)
- self->synthesizedMousePoints.clear();
-
- const QList<QTouchEvent::TouchPoint> &touchPoints = touchEvent.touchPoints();
- if (eventType == QEvent::TouchBegin)
- m_fakeMouseSourcePointId = touchPoints.first().id();
-
- const QEvent::Type mouseType = [&]() {
- switch (eventType) {
- case QEvent::TouchBegin: return QEvent::MouseButtonPress;
- case QEvent::TouchUpdate: return QEvent::MouseMove;
- case QEvent::TouchEnd: return QEvent::MouseButtonRelease;
- default: Q_UNREACHABLE();
- }
- }();
-
- Qt::MouseButton button = mouseType == QEvent::MouseMove ? Qt::NoButton : Qt::LeftButton;
- Qt::MouseButtons buttons = mouseType == QEvent::MouseButtonRelease ? Qt::NoButton : Qt::LeftButton;
-
- for (int i = 0; i < touchPoints.count(); ++i) {
- const QTouchEvent::TouchPoint &touchPoint = touchPoints.at(i);
- if (touchPoint.id() == m_fakeMouseSourcePointId) {
- if (eventType != QEvent::TouchEnd)
- self->synthesizedMousePoints.insert(w, SynthesizedMouseData(
- touchPoint.pos(), touchPoint.screenPos(), w));
+ if (!(touchEvent.device()->capabilities().testFlag(QInputDevice::Capability::MouseEmulation))) {
+
+ QEvent::Type mouseEventType = QEvent::MouseMove;
+ Qt::MouseButton button = Qt::NoButton;
+ Qt::MouseButtons buttons = Qt::LeftButton;
+ if (eventType == QEvent::TouchBegin || m_fakeMouseSourcePointId < 0) {
+ m_fakeMouseSourcePointId = touchEvent.point(0).id();
+ qCDebug(lcPtrDispatch) << "synthesizing mouse events from touchpoint" << m_fakeMouseSourcePointId;
+ }
+ if (m_fakeMouseSourcePointId >= 0) {
+ const auto *touchPoint = touchEvent.pointById(m_fakeMouseSourcePointId);
+ if (touchPoint) {
+ switch (touchPoint->state()) {
+ case QEventPoint::State::Pressed:
+ mouseEventType = QEvent::MouseButtonPress;
+ button = Qt::LeftButton;
+ break;
+ case QEventPoint::State::Released:
+ mouseEventType = QEvent::MouseButtonRelease;
+ button = Qt::LeftButton;
+ buttons = Qt::NoButton;
+ Q_ASSERT(m_fakeMouseSourcePointId == touchPoint->id());
+ m_fakeMouseSourcePointId = -1;
+ break;
+ default:
+ break;
+ }
+ if (touchPoint->state() != QEventPoint::State::Released) {
+ self->synthesizedMousePoints.insert(window, SynthesizedMouseData(
+ touchPoint->position(), touchPoint->globalPosition(), window));
+ }
// All touch events that are not accepted by the application will be translated to
// left mouse button events instead (see AA_SynthesizeMouseForUnhandledTouchEvents docs).
- QWindowSystemInterfacePrivate::MouseEvent fake(w, e->timestamp,
- touchPoint.pos(),
- touchPoint.screenPos(),
+ // TODO why go through QPA? Why not just send a QMouseEvent right from here?
+ QWindowSystemInterfacePrivate::MouseEvent fake(window, e->timestamp,
+ window->mapFromGlobal(touchPoint->globalPosition().toPoint()),
+ touchPoint->globalPosition(),
buttons,
e->modifiers,
button,
- mouseType,
- Qt::MouseEventSynthesizedByQt);
+ mouseEventType,
+ Qt::MouseEventSynthesizedByQt,
+ false,
+ device);
fake.flags |= QWindowSystemInterfacePrivate::WindowSystemEvent::Synthetic;
processMouseEvent(&fake);
- break;
}
}
+ if (eventType == QEvent::TouchEnd)
+ self->synthesizedMousePoints.clear();
}
}
}
- // Remove released points from the hash table only after the event is
- // delivered. When the receiver is a widget, QApplication will access
- // activeTouchPoints during delivery and therefore nothing can be removed
- // before sending the event.
- for (int i = 0; i < e->points.count(); ++i) {
- QTouchEvent::TouchPoint touchPoint = e->points.at(i);
- if (touchPoint.state() == Qt::TouchPointReleased)
- d->activeTouchPoints.remove(ActiveTouchPointsKey(e->device, touchPoint.id()));
+ // Remove released points from QPointingDevicePrivate::activePoints only after the event is
+ // delivered. Widgets and Qt Quick are allowed to access them at any time before this.
+ for (const QEventPoint &touchPoint : e->points) {
+ if (touchPoint.state() == QEventPoint::State::Released)
+ devPriv->removePointById(touchPoint.id());
}
}
@@ -3031,25 +3152,6 @@ void QGuiApplicationPrivate::processScreenOrientationChange(QWindowSystemInterfa
QScreen *s = e->screen.data();
s->d_func()->orientation = e->orientation;
- updateFilteredScreenOrientation(s);
-}
-
-void QGuiApplicationPrivate::updateFilteredScreenOrientation(QScreen *s)
-{
- Qt::ScreenOrientation o = s->d_func()->orientation;
- if (o == Qt::PrimaryOrientation)
- o = s->primaryOrientation();
- o = Qt::ScreenOrientation(o & s->orientationUpdateMask());
- if (o == Qt::PrimaryOrientation)
- return;
- if (o == s->d_func()->filteredOrientation)
- return;
- s->d_func()->filteredOrientation = o;
- reportScreenOrientationChange(s);
-}
-
-void QGuiApplicationPrivate::reportScreenOrientationChange(QScreen *s)
-{
emit s->orientationChanged(s->orientation());
QScreenOrientationChangeEvent event(s, s->orientation());
@@ -3065,37 +3167,16 @@ void QGuiApplicationPrivate::processScreenGeometryChange(QWindowSystemInterfaceP
if (!e->screen)
return;
- QScreen *s = e->screen.data();
-
- bool geometryChanged = e->geometry != s->d_func()->geometry;
- s->d_func()->geometry = e->geometry;
+ {
+ QScreen *s = e->screen.data();
+ QScreenPrivate::UpdateEmitter updateEmitter(s);
- bool availableGeometryChanged = e->availableGeometry != s->d_func()->availableGeometry;
- s->d_func()->availableGeometry = e->availableGeometry;
+ // Note: The incoming geometries have already been scaled by QHighDpi
+ // in the QWSI layer, so we don't need to call updateGeometry() here.
+ s->d_func()->geometry = e->geometry;
+ s->d_func()->availableGeometry = e->availableGeometry;
- if (geometryChanged) {
- Qt::ScreenOrientation primaryOrientation = s->primaryOrientation();
s->d_func()->updatePrimaryOrientation();
-
- emit s->geometryChanged(s->geometry());
- emit s->physicalSizeChanged(s->physicalSize());
- emit s->physicalDotsPerInchChanged(s->physicalDotsPerInch());
- emit s->logicalDotsPerInchChanged(s->logicalDotsPerInch());
-
- if (s->primaryOrientation() != primaryOrientation)
- emit s->primaryOrientationChanged(s->primaryOrientation());
-
- if (s->d_func()->orientation == Qt::PrimaryOrientation)
- updateFilteredScreenOrientation(s);
- }
-
- if (availableGeometryChanged)
- emit s->availableGeometryChanged(s->availableGeometry());
-
- if (geometryChanged || availableGeometryChanged) {
- const auto siblings = s->virtualSiblings();
- for (QScreen* sibling : siblings)
- emit sibling->virtualGeometryChanged(sibling->virtualGeometry());
}
resetCachedDevicePixelRatio();
@@ -3107,13 +3188,21 @@ void QGuiApplicationPrivate::processScreenLogicalDotsPerInchChange(QWindowSystem
if (QCoreApplication::startingUp())
return;
+ QHighDpiScaling::updateHighDpiScaling();
+
if (!e->screen)
return;
- QScreen *s = e->screen.data();
- s->d_func()->logicalDpi = QDpi(e->dpiX, e->dpiY);
+ {
+ QScreen *s = e->screen.data();
+ QScreenPrivate::UpdateEmitter updateEmitter(s);
+ s->d_func()->logicalDpi = QDpi(e->dpiX, e->dpiY);
+ s->d_func()->updateGeometry();
+ }
- emit s->logicalDotsPerInchChanged(s->logicalDotsPerInch());
+ for (QWindow *window : QGuiApplication::allWindows())
+ if (window->screen() == e->screen)
+ QWindowPrivate::get(window)->updateDevicePixelRatio();
resetCachedDevicePixelRatio();
}
@@ -3158,13 +3247,72 @@ void QGuiApplicationPrivate::processExposeEvent(QWindowSystemInterfacePrivate::E
p->resizeEventPending = false;
}
+ // FIXME: It would logically make sense to set this _after_ we've sent the
+ // expose event to the window, to mark that it now has received an expose.
+ // But some parts of Qt (mis)use this private member to check whether the
+ // window has been mapped yet, which they do in code that is triggered
+ // by the very same expose event we send below. To keep the code working
+ // we need to set the variable up front, until the code has been fixed.
p->receivedExpose = true;
}
+ // If the platform does not send paint events we need to synthesize them from expose events
+ const bool shouldSynthesizePaintEvents = !platformIntegration()->hasCapability(QPlatformIntegration::PaintEvents);
+
+ const bool wasExposed = p->exposed;
p->exposed = e->isExposed && window->screen();
+ // We expect that the platform plugins send DevicePixelRatioChange events.
+ // As a fail-safe make a final check here to make sure the cached DPR value is
+ // always up to date before sending the expose event.
+ if (e->isExposed && !e->region.isEmpty()) {
+ const bool dprWasChanged = QWindowPrivate::get(window)->updateDevicePixelRatio();
+ if (dprWasChanged)
+ qWarning() << "The cached device pixel ratio value was stale on window expose. "
+ << "Please file a QTBUG which explains how to reproduce.";
+ }
+
+ // We treat expose events for an already exposed window as paint events
+ if (wasExposed && p->exposed && shouldSynthesizePaintEvents) {
+ QPaintEvent paintEvent(e->region);
+ QCoreApplication::sendSpontaneousEvent(window, &paintEvent);
+ if (paintEvent.isAccepted())
+ return; // No need to send expose
+
+ // The paint event was not accepted, so we fall through and send an expose
+ // event instead, to maintain compatibility for clients that haven't adopted
+ // paint events yet.
+ }
+
QExposeEvent exposeEvent(e->region);
QCoreApplication::sendSpontaneousEvent(window, &exposeEvent);
+ e->eventAccepted = exposeEvent.isAccepted();
+
+ // If the window was just exposed we also need to send a paint event,
+ // so that clients that implement paint events will draw something.
+ // Note that we we can not skip this based on the expose event being
+ // accepted, as clients may implement exposeEvent to track the state
+ // change, but without drawing anything.
+ if (!wasExposed && p->exposed && shouldSynthesizePaintEvents) {
+ QPaintEvent paintEvent(e->region);
+ QCoreApplication::sendSpontaneousEvent(window, &paintEvent);
+ }
+}
+
+void QGuiApplicationPrivate::processPaintEvent(QWindowSystemInterfacePrivate::PaintEvent *e)
+{
+ Q_ASSERT_X(platformIntegration()->hasCapability(QPlatformIntegration::PaintEvents), "QGuiApplication",
+ "The platform sent paint events without claiming support for it in QPlatformIntegration::capabilities()");
+
+ if (!e->window)
+ return;
+
+ QPaintEvent paintEvent(e->region);
+ QCoreApplication::sendSpontaneousEvent(e->window, &paintEvent);
+
+ // We report back the accepted state to the platform, so that it can
+ // decide when the best time to send the fallback expose event is.
+ e->eventAccepted = paintEvent.isAccepted();
}
#if QT_CONFIG(draganddrop)
@@ -3265,43 +3413,112 @@ QClipboard * QGuiApplication::clipboard()
/*!
\since 5.4
\fn void QGuiApplication::paletteChanged(const QPalette &palette)
+ \deprecated [6.0] Handle QEvent::ApplicationPaletteChange instead.
- This signal is emitted when the \a palette of the application changes.
+ This signal is emitted when the \a palette of the application changes. Use
+ QEvent::ApplicationPaletteChanged instead.
\sa palette()
*/
/*!
- Returns the default application palette.
+ Returns the current application palette.
+
+ Roles that have not been explicitly set will reflect the system's platform theme.
\sa setPalette()
*/
QPalette QGuiApplication::palette()
{
- initPalette();
+ if (!QGuiApplicationPrivate::app_pal)
+ QGuiApplicationPrivate::updatePalette();
+
return *QGuiApplicationPrivate::app_pal;
}
+void QGuiApplicationPrivate::updatePalette()
+{
+ if (app_pal) {
+ if (setPalette(*app_pal) && qGuiApp)
+ qGuiApp->d_func()->handlePaletteChanged();
+ } else {
+ setPalette(QPalette());
+ }
+}
+
+void QGuiApplicationPrivate::clearPalette()
+{
+ delete app_pal;
+ app_pal = nullptr;
+}
+
/*!
- Changes the default application palette to \a pal.
+ Changes the application palette to \a pal.
+
+ The color roles from this palette are combined with the system's platform
+ theme to form the application's final palette.
\sa palette()
*/
void QGuiApplication::setPalette(const QPalette &pal)
{
- if (QGuiApplicationPrivate::app_pal && pal.isCopyOf(*QGuiApplicationPrivate::app_pal))
- return;
- if (!QGuiApplicationPrivate::app_pal)
- QGuiApplicationPrivate::app_pal = new QPalette(pal);
+ if (QGuiApplicationPrivate::setPalette(pal) && qGuiApp)
+ qGuiApp->d_func()->handlePaletteChanged();
+}
+
+bool QGuiApplicationPrivate::setPalette(const QPalette &palette)
+{
+ // Resolve the palette against the theme palette, filling in
+ // any missing roles, while keeping the original resolve mask.
+ QPalette basePalette = qGuiApp ? qGuiApp->d_func()->basePalette() : Qt::gray;
+ basePalette.setResolveMask(0); // The base palette only contributes missing colors roles
+ QPalette resolvedPalette = palette.resolve(basePalette);
+
+ if (app_pal && resolvedPalette == *app_pal && resolvedPalette.resolveMask() == app_pal->resolveMask())
+ return false;
+
+ if (!app_pal)
+ app_pal = new QPalette(resolvedPalette);
else
- *QGuiApplicationPrivate::app_pal = pal;
+ *app_pal = resolvedPalette;
+
+ QCoreApplication::setAttribute(Qt::AA_SetPalette, app_pal->resolveMask() != 0);
+
+ return true;
+}
+
+/*
+ Returns the base palette used to fill in missing roles in
+ the current application palette.
- applicationResourceFlags |= ApplicationPaletteExplicitlySet;
- QCoreApplication::setAttribute(Qt::AA_SetPalette);
+ Normally this is the theme palette, but QApplication
+ overrides this for compatibility reasons.
+*/
+QPalette QGuiApplicationPrivate::basePalette() const
+{
+ const auto pf = platformTheme();
+ return pf && pf->palette() ? *pf->palette() : Qt::gray;
+}
- if (qGuiApp)
+void QGuiApplicationPrivate::handlePaletteChanged(const char *className)
+{
+#if QT_DEPRECATED_SINCE(6, 0)
+ if (!className) {
+ Q_ASSERT(app_pal);
+QT_WARNING_PUSH
+QT_WARNING_DISABLE_DEPRECATED
emit qGuiApp->paletteChanged(*QGuiApplicationPrivate::app_pal);
+QT_WARNING_POP
+ }
+#else
+ Q_UNUSED(className);
+#endif // QT_DEPRECATED_SINCE(6, 0)
+
+ if (is_app_running && !is_app_closing) {
+ QEvent event(QEvent::ApplicationPaletteChange);
+ QGuiApplication::sendEvent(qGuiApp, &event);
+ }
}
void QGuiApplicationPrivate::applyWindowGeometrySpecificationTo(QWindow *window)
@@ -3312,8 +3529,10 @@ void QGuiApplicationPrivate::applyWindowGeometrySpecificationTo(QWindow *window)
/*!
\since 5.11
\fn void QGuiApplication::fontChanged(const QFont &font)
+ \deprecated [6.0] Handle QEvent::ApplicationFontChange instead.
- This signal is emitted when the \a font of the application changes.
+ This signal is emitted when the \a font of the application changes. Use
+ QEvent::ApplicationFontChanged instead.
\sa font()
*/
@@ -3325,8 +3544,11 @@ void QGuiApplicationPrivate::applyWindowGeometrySpecificationTo(QWindow *window)
*/
QFont QGuiApplication::font()
{
- Q_ASSERT_X(QGuiApplicationPrivate::self, "QGuiApplication::font()", "no QGuiApplication instance");
const auto locker = qt_scoped_lock(applicationFontMutex);
+ if (!QGuiApplicationPrivate::self && !QGuiApplicationPrivate::app_font) {
+ qWarning("QGuiApplication::font(): no QGuiApplication instance and no application font set.");
+ return QFont(); // in effect: QFont((QFontPrivate*)nullptr), so no recursion
+ }
initFontUnlocked();
return *QGuiApplicationPrivate::app_font;
}
@@ -3350,7 +3572,16 @@ void QGuiApplication::setFont(const QFont &font)
if (emitChange && qGuiApp) {
auto font = *QGuiApplicationPrivate::app_font;
locker.unlock();
+#if QT_DEPRECATED_SINCE(6, 0)
+QT_WARNING_PUSH
+QT_WARNING_DISABLE_DEPRECATED
emit qGuiApp->fontChanged(font);
+QT_WARNING_POP
+#else
+ Q_UNUSED(font);
+#endif // QT_DEPRECATED_SINCE(6, 0)
+ QEvent event(QEvent::ApplicationFontChange);
+ QGuiApplication::sendEvent(qGuiApp, &event);
}
}
@@ -3381,8 +3612,16 @@ void QGuiApplicationPrivate::notifyLayoutDirectionChange()
}
}
-void QGuiApplicationPrivate::notifyActiveWindowChange(QWindow *)
+void QGuiApplicationPrivate::notifyActiveWindowChange(QWindow *prev)
{
+ if (prev) {
+ QEvent de(QEvent::WindowDeactivate);
+ QCoreApplication::sendEvent(prev, &de);
+ }
+ if (self->focus_window) {
+ QEvent ae(QEvent::WindowActivate);
+ QCoreApplication::sendEvent(focus_window, &ae);
+ }
}
/*!
@@ -3426,83 +3665,86 @@ void QGuiApplicationPrivate::notifyWindowIconChanged()
The default is \c true.
- If this property is \c true, the applications quits when the last visible
- primary window (i.e. window with no parent) is closed.
+ If this property is \c true, the application will attempt to
+ quit when the last visible \l{Primary and Secondary Windows}{primary window}
+ (i.e. top level window with no transient parent) is closed.
+
+ Note that attempting a quit may not necessarily result in the
+ application quitting, for example if there still are active
+ QEventLoopLocker instances, or the QEvent::Quit event is ignored.
\sa quit(), QWindow::close()
*/
void QGuiApplication::setQuitOnLastWindowClosed(bool quit)
{
- QCoreApplication::setQuitLockEnabled(quit);
+ QGuiApplicationPrivate::quitOnLastWindowClosed = quit;
}
-
-
bool QGuiApplication::quitOnLastWindowClosed()
{
- return QCoreApplication::isQuitLockEnabled();
+ return QGuiApplicationPrivate::quitOnLastWindowClosed;
}
+void QGuiApplicationPrivate::maybeLastWindowClosed()
+{
+ if (!lastWindowClosed())
+ return;
+
+ if (in_exec)
+ emit q_func()->lastWindowClosed();
+
+ if (quitOnLastWindowClosed && canQuitAutomatically())
+ quitAutomatically();
+}
/*!
\fn void QGuiApplication::lastWindowClosed()
This signal is emitted from exec() when the last visible
- primary window (i.e. window with no parent) is closed.
+ \l{Primary and Secondary Windows}{primary window} (i.e.
+ top level window with no transient parent) is closed.
By default, QGuiApplication quits after this signal is emitted. This feature
can be turned off by setting \l quitOnLastWindowClosed to \c false.
- \sa QWindow::close(), QWindow::isTopLevel()
+ \sa QWindow::close(), QWindow::isTopLevel(), QWindow::transientParent()
*/
-void QGuiApplicationPrivate::emitLastWindowClosed()
-{
- if (qGuiApp && qGuiApp->d_func()->in_exec) {
- emit qGuiApp->lastWindowClosed();
- }
-}
-
-bool QGuiApplicationPrivate::shouldQuit()
+bool QGuiApplicationPrivate::lastWindowClosed() const
{
- const QWindowList processedWindows;
- return shouldQuitInternal(processedWindows);
-}
-
-bool QGuiApplicationPrivate::shouldQuitInternal(const QWindowList &processedWindows)
-{
- /* if there is no visible top-level window left, we allow the quit */
- QWindowList list = QGuiApplication::topLevelWindows();
- for (int i = 0; i < list.size(); ++i) {
- QWindow *w = list.at(i);
- if (processedWindows.contains(w))
+ for (auto *window : QGuiApplication::topLevelWindows()) {
+ auto *windowPrivate = qt_window_private(window);
+ if (!windowPrivate->participatesInLastWindowClosed())
continue;
- if (w->isVisible() && !w->transientParent())
+
+ if (windowPrivate->treatAsVisible())
return false;
- }
- return true;
+ }
+
+ return true;
}
-bool QGuiApplicationPrivate::tryCloseAllWindows()
+bool QGuiApplicationPrivate::canQuitAutomatically()
{
- return tryCloseRemainingWindows(QWindowList());
+ // The automatic quit functionality is triggered by
+ // both QEventLoopLocker and maybeLastWindowClosed.
+ // Although the former is a QCoreApplication feature
+ // we don't want to quit the application when there
+ // are open windows, regardless of whether the app
+ // also quits automatically on maybeLastWindowClosed.
+ if (!lastWindowClosed())
+ return false;
+
+ return QCoreApplicationPrivate::canQuitAutomatically();
}
-bool QGuiApplicationPrivate::tryCloseRemainingWindows(QWindowList processedWindows)
+void QGuiApplicationPrivate::quit()
{
- QWindowList list = QGuiApplication::topLevelWindows();
- for (int i = 0; i < list.size(); ++i) {
- QWindow *w = list.at(i);
- if (w->isVisible() && !processedWindows.contains(w)) {
- if (!w->close())
- return false;
- processedWindows.append(w);
- list = QGuiApplication::topLevelWindows();
- i = -1;
- }
- }
- return true;
+ if (auto *platformIntegration = QGuiApplicationPrivate::platformIntegration())
+ platformIntegration->quit();
+ else
+ QCoreApplicationPrivate::quit();
}
void QGuiApplicationPrivate::processApplicationTermination(QWindowSystemInterfacePrivate::WindowSystemEvent *windowSystemEvent)
@@ -3534,7 +3776,7 @@ Qt::ApplicationState QGuiApplication::applicationState()
Sets the high-DPI scale factor rounding policy for the application. The
\a policy decides how non-integer scale factors (such as Windows 150%) are
- handled, for applications that have AA_EnableHighDpiScaling enabled.
+ handled.
The two principal options are whether fractional scale factors should
be rounded to an integer or not. Keeping the scale factor as-is will
@@ -3547,15 +3789,16 @@ Qt::ApplicationState QGuiApplication::applicationState()
("small UI") or as 2x ("large UI"). See the Qt::HighDpiScaleFactorRoundingPolicy
enum for a complete list of all options.
- This function must be called before creating the application object,
- and can be overridden by setting the QT_SCALE_FACTOR_ROUNDING_POLICY
- environment variable. The QGuiApplication::highDpiScaleFactorRoundingPolicy()
+ This function must be called before creating the application object.
+ The QGuiApplication::highDpiScaleFactorRoundingPolicy()
accessor will reflect the environment, if set.
- The default value is Qt::HighDpiScaleFactorRoundingPolicy::RoundPreferFloor.
+ The default value is Qt::HighDpiScaleFactorRoundingPolicy::PassThrough.
*/
void QGuiApplication::setHighDpiScaleFactorRoundingPolicy(Qt::HighDpiScaleFactorRoundingPolicy policy)
{
+ if (qApp)
+ qWarning("setHighDpiScaleFactorRoundingPolicy must be called before creating the QGuiApplication instance");
QGuiApplicationPrivate::highDpiScaleFactorRoundingPolicy = policy;
}
@@ -3604,57 +3847,6 @@ void QGuiApplicationPrivate::setApplicationState(Qt::ApplicationState state, boo
emit qApp->applicationStateChanged(applicationState);
}
-#ifndef QT_NO_SESSIONMANAGER
-// ### Qt6: consider removing the feature or making it less intrusive
-/*!
- \since 5.6
-
- Returns whether QGuiApplication will use fallback session management.
-
- The default is \c true.
-
- If this is \c true and the session manager allows user interaction,
- QGuiApplication will try to close toplevel windows after
- commitDataRequest() has been emitted. If a window cannot be closed, session
- shutdown will be canceled and the application will keep running.
-
- Fallback session management only benefits applications that have an
- "are you sure you want to close this window?" feature or other logic that
- prevents closing a toplevel window depending on certain conditions, and
- that do nothing to explicitly implement session management. In applications
- that \e do implement session management using the proper session management
- API, fallback session management interferes and may break session
- management logic.
-
- \warning If all windows \e are closed due to fallback session management
- and quitOnLastWindowClosed() is \c true, the application will quit before
- it is explicitly instructed to quit through the platform's session
- management protocol. That violation of protocol may prevent the platform
- session manager from saving application state.
-
- \sa setFallbackSessionManagementEnabled(),
- QSessionManager::allowsInteraction(), saveStateRequest(),
- commitDataRequest(), {Session Management}
-*/
-bool QGuiApplication::isFallbackSessionManagementEnabled()
-{
- return QGuiApplicationPrivate::is_fallback_session_management_enabled;
-}
-
-/*!
- \since 5.6
-
- Sets whether QGuiApplication will use fallback session management to
- \a enabled.
-
- \sa isFallbackSessionManagementEnabled()
-*/
-void QGuiApplication::setFallbackSessionManagementEnabled(bool enabled)
-{
- QGuiApplicationPrivate::is_fallback_session_management_enabled = enabled;
-}
-#endif // QT_NO_SESSIONMANAGER
-
/*!
\since 4.2
\fn void QGuiApplication::commitDataRequest(QSessionManager &manager)
@@ -3679,8 +3871,7 @@ void QGuiApplication::setFallbackSessionManagementEnabled(bool enabled)
\note You should use Qt::DirectConnection when connecting to this signal.
- \sa setFallbackSessionManagementEnabled(), isSessionRestored(),
- sessionId(), saveStateRequest(), {Session Management}
+ \sa isSessionRestored(), sessionId(), saveStateRequest(), {Session Management}
*/
/*!
@@ -3788,13 +3979,7 @@ void QGuiApplicationPrivate::commitData()
{
Q_Q(QGuiApplication);
is_saving_session = true;
-
emit q->commitDataRequest(*session_manager);
- if (is_fallback_session_management_enabled && session_manager->allowsInteraction()
- && !tryCloseAllWindows()) {
- session_manager->cancel();
- }
-
is_saving_session = false;
}
@@ -3834,7 +4019,8 @@ void QGuiApplication::sync()
\property QGuiApplication::layoutDirection
\brief the default layout direction for this application
- On system start-up, the default layout direction depends on the
+ On system start-up, or when the direction is explicitly set to
+ Qt::LayoutDirectionAuto, the default layout direction depends on the
application's language.
The notifier signal was introduced in Qt 5.4.
@@ -3844,11 +4030,15 @@ void QGuiApplication::sync()
void QGuiApplication::setLayoutDirection(Qt::LayoutDirection direction)
{
- if (layout_direction == direction || direction == Qt::LayoutDirectionAuto)
- return;
-
layout_direction = direction;
+ if (direction == Qt::LayoutDirectionAuto)
+ direction = qt_detectRTLLanguage() ? Qt::RightToLeft : Qt::LeftToRight;
+ // no change to the explicitly set or auto-detected layout direction
+ if (direction == effective_layout_direction)
+ return;
+
+ effective_layout_direction = direction;
if (qGuiApp) {
emit qGuiApp->layoutDirectionChanged(direction);
QGuiApplicationPrivate::self->notifyLayoutDirectionChange();
@@ -3857,10 +4047,15 @@ void QGuiApplication::setLayoutDirection(Qt::LayoutDirection direction)
Qt::LayoutDirection QGuiApplication::layoutDirection()
{
- // layout_direction is only ever Qt::LayoutDirectionAuto if setLayoutDirection
- // was never called, or called with Qt::LayoutDirectionAuto (which is a no-op).
- // In that case we return the default LeftToRight.
- return layout_direction == Qt::LayoutDirectionAuto ? Qt::LeftToRight : layout_direction;
+ /*
+ effective_layout_direction defaults to Qt::LeftToRight, and is updated with what is
+ auto-detected by a call to setLayoutDirection(Qt::LayoutDirectionAuto). This happens in
+ QGuiApplicationPrivate::init and when the language changes (or before if the application
+ calls the static function, but then no translators are installed so the auto-detection
+ always yields Qt::LeftToRight).
+ So we can be certain that it's always the right value.
+ */
+ return effective_layout_direction;
}
/*!
@@ -3967,7 +4162,7 @@ static inline void applyWindowCursor(const QList<QWindow *> &l)
Application cursors are stored on an internal stack. setOverrideCursor()
pushes the cursor onto the stack, and restoreOverrideCursor() pops the
- active cursor off the stack. changeOverrideCursor() changes the curently
+ active cursor off the stack. changeOverrideCursor() changes the currently
active application override cursor.
Every setOverrideCursor() must eventually be followed by a corresponding
@@ -4084,7 +4279,10 @@ QInputMethod *QGuiApplication::inputMethod()
/*!
\fn void QGuiApplication::fontDatabaseChanged()
- This signal is emitted when application fonts are loaded or removed.
+ This signal is emitted when the available fonts have changed.
+
+ This can happen when application fonts are added or removed, or when the
+ system fonts change.
\sa QFontDatabase::addApplicationFont(),
QFontDatabase::addApplicationFontFromData(),
@@ -4098,37 +4296,18 @@ QPixmap QGuiApplicationPrivate::getPixmapCursor(Qt::CursorShape cshape)
return QPixmap();
}
-void QGuiApplicationPrivate::notifyThemeChanged()
+QPoint QGuiApplicationPrivate::QLastCursorPosition::toPoint() const noexcept
{
- if (!(applicationResourceFlags & ApplicationPaletteExplicitlySet) &&
- !QCoreApplication::testAttribute(Qt::AA_SetPalette)) {
- clearPalette();
- initPalette();
- emit qGuiApp->paletteChanged(*app_pal);
- if (is_app_running && !is_app_closing)
- sendApplicationPaletteChange();
- }
- if (!(applicationResourceFlags & ApplicationFontExplicitlySet)) {
- const auto locker = qt_scoped_lock(applicationFontMutex);
- clearFontUnlocked();
- initFontUnlocked();
- }
- initThemeHints();
-}
-
-void QGuiApplicationPrivate::sendApplicationPaletteChange(bool toAllWidgets, const char *className)
-{
- Q_UNUSED(toAllWidgets)
- Q_UNUSED(className)
-
- QEvent event(QEvent::ApplicationPaletteChange);
- QGuiApplication::sendEvent(QGuiApplication::instance(), &event);
+ // Guard against the default initialization of qInf() (avoid UB or SIGFPE in conversion).
+ if (Q_UNLIKELY(qIsInf(thePoint.x())))
+ return QPoint(std::numeric_limits<int>::max(), std::numeric_limits<int>::max());
+ return thePoint.toPoint();
}
#if QT_CONFIG(draganddrop)
void QGuiApplicationPrivate::notifyDragStarted(const QDrag *drag)
{
- Q_UNUSED(drag)
+ Q_UNUSED(drag);
}
#endif
@@ -4136,10 +4315,8 @@ void QGuiApplicationPrivate::notifyDragStarted(const QDrag *drag)
const QColorTrcLut *QGuiApplicationPrivate::colorProfileForA8Text()
{
#ifdef Q_OS_WIN
- if (!m_a8ColorProfile){
- QColorTrcLut *cs = QColorTrcLut::fromGamma(2.31); // This is a hard-coded thing for Windows text rendering
- m_a8ColorProfile.reset(cs);
- }
+ if (!m_a8ColorProfile)
+ m_a8ColorProfile = QColorTrcLut::fromGamma(2.31); // This is a hard-coded thing for Windows text rendering
return m_a8ColorProfile.get();
#else
return colorProfileForA32Text();
@@ -4148,10 +4325,8 @@ const QColorTrcLut *QGuiApplicationPrivate::colorProfileForA8Text()
const QColorTrcLut *QGuiApplicationPrivate::colorProfileForA32Text()
{
- if (!m_a32ColorProfile) {
- QColorTrcLut *cs = QColorTrcLut::fromGamma(fontSmoothingGamma);
- m_a32ColorProfile.reset(cs);
- }
+ if (!m_a32ColorProfile)
+ m_a32ColorProfile = QColorTrcLut::fromGamma(fontSmoothingGamma);
return m_a32ColorProfile.get();
}
@@ -4177,63 +4352,50 @@ enum MouseMasks {
MouseFlagsShift = 16
};
-int QGuiApplicationPrivate::mouseEventCaps(QMouseEvent *event)
+QInputDeviceManager *QGuiApplicationPrivate::inputDeviceManager()
{
- return event->caps & MouseCapsMask;
-}
+ Q_ASSERT(QGuiApplication::instance());
-QVector2D QGuiApplicationPrivate::mouseEventVelocity(QMouseEvent *event)
-{
- return event->velocity;
-}
+ if (!m_inputDeviceManager)
+ m_inputDeviceManager = new QInputDeviceManager(QGuiApplication::instance());
-void QGuiApplicationPrivate::setMouseEventCapsAndVelocity(QMouseEvent *event, int caps, const QVector2D &velocity)
-{
- Q_ASSERT(caps <= MouseCapsMask);
- event->caps &= ~MouseCapsMask;
- event->caps |= caps & MouseCapsMask;
- event->velocity = velocity;
+ return m_inputDeviceManager;
}
-Qt::MouseEventSource QGuiApplicationPrivate::mouseEventSource(const QMouseEvent *event)
-{
- return Qt::MouseEventSource((event->caps & MouseSourceMaskDst) >> MouseSourceShift);
-}
+/*!
+ \fn template <typename QNativeInterface> QNativeInterface *QGuiApplication::nativeInterface() const
-void QGuiApplicationPrivate::setMouseEventSource(QMouseEvent *event, Qt::MouseEventSource source)
-{
- // Mouse event synthesization status is encoded in the caps field because
- // QTouchDevice::CapabilityFlag uses only 6 bits from it.
- int value = source;
- Q_ASSERT(value <= MouseSourceMaskSrc);
- event->caps &= ~MouseSourceMaskDst;
- event->caps |= (value & MouseSourceMaskSrc) << MouseSourceShift;
-}
+ Returns a native interface of the given type for the application.
-Qt::MouseEventFlags QGuiApplicationPrivate::mouseEventFlags(const QMouseEvent *event)
-{
- return Qt::MouseEventFlags((event->caps & MouseFlagsCapsMask) >> MouseFlagsShift);
-}
+ This function provides access to platform specific functionality
+ of QGuiApplication, as defined in the QNativeInterface namespace:
-void QGuiApplicationPrivate::setMouseEventFlags(QMouseEvent *event, Qt::MouseEventFlags flags)
-{
- // use the 0x00FF0000 byte from caps (containing up to 7 mouse event flags)
- unsigned int value = flags;
- Q_ASSERT(value <= Qt::MouseEventFlagMask);
- event->caps &= ~MouseFlagsCapsMask;
- event->caps |= (value & Qt::MouseEventFlagMask) << MouseFlagsShift;
-}
+ \annotatedlist native-interfaces-qguiapplication
-QInputDeviceManager *QGuiApplicationPrivate::inputDeviceManager()
+ If the requested interface is not available a \nullptr is returned.
+ */
+
+void *QGuiApplication::resolveInterface(const char *name, int revision) const
{
- Q_ASSERT(QGuiApplication::instance());
+ using namespace QNativeInterface;
+ using namespace QNativeInterface::Private;
- if (!m_inputDeviceManager)
- m_inputDeviceManager = new QInputDeviceManager(QGuiApplication::instance());
+ auto *platformIntegration = QGuiApplicationPrivate::platformIntegration();
+ Q_UNUSED(platformIntegration);
- return m_inputDeviceManager;
-}
+#if defined(Q_OS_WIN)
+ QT_NATIVE_INTERFACE_RETURN_IF(QWindowsApplication, platformIntegration);
+#endif
+#if QT_CONFIG(xcb)
+ QT_NATIVE_INTERFACE_RETURN_IF(QX11Application, platformNativeInterface());
+#endif
+#if QT_CONFIG(wayland)
+ QT_NATIVE_INTERFACE_RETURN_IF(QWaylandApplication, platformNativeInterface());
+#endif
-#include "moc_qguiapplication.cpp"
+ return QCoreApplication::resolveInterface(name, revision);
+}
QT_END_NAMESPACE
+
+#include "moc_qguiapplication.cpp"
diff --git a/src/gui/kernel/qguiapplication.h b/src/gui/kernel/qguiapplication.h
index fc74c5299a..23d7fb3d65 100644
--- a/src/gui/kernel/qguiapplication.h
+++ b/src/gui/kernel/qguiapplication.h
@@ -1,41 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the QtGui module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#ifndef QGUIAPPLICATION_H
#define QGUIAPPLICATION_H
@@ -73,11 +37,14 @@ class Q_GUI_EXPORT QGuiApplication : public QCoreApplication
{
Q_OBJECT
Q_PROPERTY(QIcon windowIcon READ windowIcon WRITE setWindowIcon)
- Q_PROPERTY(QString applicationDisplayName READ applicationDisplayName WRITE setApplicationDisplayName NOTIFY applicationDisplayNameChanged)
+ Q_PROPERTY(QString applicationDisplayName READ applicationDisplayName
+ WRITE setApplicationDisplayName NOTIFY applicationDisplayNameChanged)
Q_PROPERTY(QString desktopFileName READ desktopFileName WRITE setDesktopFileName)
- Q_PROPERTY(Qt::LayoutDirection layoutDirection READ layoutDirection WRITE setLayoutDirection NOTIFY layoutDirectionChanged)
- Q_PROPERTY(QString platformName READ platformName STORED false)
- Q_PROPERTY(bool quitOnLastWindowClosed READ quitOnLastWindowClosed WRITE setQuitOnLastWindowClosed)
+ Q_PROPERTY(Qt::LayoutDirection layoutDirection READ layoutDirection WRITE setLayoutDirection
+ NOTIFY layoutDirectionChanged)
+ Q_PROPERTY(QString platformName READ platformName STORED false CONSTANT)
+ Q_PROPERTY(bool quitOnLastWindowClosed READ quitOnLastWindowClosed
+ WRITE setQuitOnLastWindowClosed)
Q_PROPERTY(QScreen *primaryScreen READ primaryScreen NOTIFY primaryScreenChanged STORED false)
public:
@@ -91,6 +58,8 @@ public:
static void setApplicationDisplayName(const QString &name);
static QString applicationDisplayName();
+ Q_SLOT void setBadgeNumber(qint64 number);
+
static void setDesktopFileName(const QString &name);
static QString desktopFileName();
@@ -168,11 +137,10 @@ public:
QString sessionId() const;
QString sessionKey() const;
bool isSavingSession() const;
-
- static bool isFallbackSessionManagementEnabled();
- static void setFallbackSessionManagementEnabled(bool);
#endif
+ QT_DECLARE_NATIVE_INTERFACE_ACCESSOR(QGuiApplication)
+
static void sync();
Q_SIGNALS:
void fontDatabaseChanged();
@@ -188,10 +156,11 @@ Q_SIGNALS:
void commitDataRequest(QSessionManager &sessionManager);
void saveStateRequest(QSessionManager &sessionManager);
#endif
- void paletteChanged(const QPalette &pal);
void applicationDisplayNameChanged();
- void fontChanged(const QFont &font);
-
+#if QT_DEPRECATED_SINCE(6, 0)
+ QT_DEPRECATED_VERSION_X_6_0("Handle QEvent::ApplicationPaletteChange instead") void paletteChanged(const QPalette &pal);
+ QT_DEPRECATED_VERSION_X_6_0("Handle QEvent::ApplicationFontChange instead") void fontChanged(const QFont &font);
+#endif
protected:
bool event(QEvent *) override;
bool compressEvent(QEvent *, QObject *receiver, QPostEventList *) override;
@@ -216,4 +185,6 @@ private:
QT_END_NAMESPACE
+#include <QtGui/qguiapplication_platform.h>
+
#endif // QGUIAPPLICATION_H
diff --git a/src/gui/kernel/qguiapplication_p.h b/src/gui/kernel/qguiapplication_p.h
index 9f3fa7212a..cca79534fc 100644
--- a/src/gui/kernel/qguiapplication_p.h
+++ b/src/gui/kernel/qguiapplication_p.h
@@ -1,41 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the QtGui module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#ifndef QGUIAPPLICATION_P_H
#define QGUIAPPLICATION_P_H
@@ -53,11 +17,15 @@
#include <QtGui/private/qtguiglobal_p.h>
#include <QtGui/qguiapplication.h>
+#include <QtGui/qicon.h>
+#include <QtCore/QHash>
#include <QtCore/QPointF>
-#include <QtCore/QSharedPointer>
#include <QtCore/private/qcoreapplication_p.h>
+#include <QtCore/qnativeinterface.h>
+#include <QtCore/private/qnativeinterface_p.h>
+#include <QtCore/private/qnumeric_p.h>
#include <QtCore/private/qthread_p.h>
#include <qpa/qwindowsysteminterface.h>
@@ -66,7 +34,9 @@
# include "private/qshortcutmap_p.h"
#endif
-#include <qicon.h>
+#include <QtCore/qpointer.h>
+
+#include <memory>
QT_BEGIN_NAMESPACE
@@ -78,12 +48,18 @@ class QPlatformDragQtResponse;
class QDrag;
#endif // QT_CONFIG(draganddrop)
class QInputDeviceManager;
+#ifndef QT_NO_ACTION
+class QActionPrivate;
+#endif
+#if QT_CONFIG(shortcut)
+class QShortcutPrivate;
+#endif
class Q_GUI_EXPORT QGuiApplicationPrivate : public QCoreApplicationPrivate
{
Q_DECLARE_PUBLIC(QGuiApplication)
public:
- QGuiApplicationPrivate(int &argc, char **argv, int flags);
+ QGuiApplicationPrivate(int &argc, char **argv);
~QGuiApplicationPrivate();
void init();
@@ -98,11 +74,14 @@ public:
#if QT_CONFIG(commandlineparser)
void addQtOptions(QList<QCommandLineOption> *options) override;
#endif
- virtual bool shouldQuit() override;
+ bool canQuitAutomatically() override;
+ void quit() override;
- bool shouldQuitInternal(const QWindowList &processedWindows);
- virtual bool tryCloseAllWindows();
+ void maybeLastWindowClosed();
+ bool lastWindowClosed() const;
+ static bool quitOnLastWindowClosed;
+ static void captureGlobalModifierState(QEvent *e);
static Qt::KeyboardModifiers modifier_buttons;
static Qt::MouseButtons mouse_buttons;
@@ -136,9 +115,11 @@ public:
static void processEnterEvent(QWindowSystemInterfacePrivate::EnterEvent *e);
static void processLeaveEvent(QWindowSystemInterfacePrivate::LeaveEvent *e);
- static void processActivatedEvent(QWindowSystemInterfacePrivate::ActivatedWindowEvent *e);
+ static void processFocusWindowEvent(QWindowSystemInterfacePrivate::FocusWindowEvent *e);
+
static void processWindowStateChangedEvent(QWindowSystemInterfacePrivate::WindowStateChangedEvent *e);
static void processWindowScreenChangedEvent(QWindowSystemInterfacePrivate::WindowScreenChangedEvent *e);
+ static void processWindowDevicePixelRatioChangedEvent(QWindowSystemInterfacePrivate::WindowDevicePixelRatioChangedEvent *e);
static void processSafeAreaMarginsChangedEvent(QWindowSystemInterfacePrivate::SafeAreaMarginsChangedEvent *e);
@@ -147,7 +128,6 @@ public:
static void processApplicationTermination(QWindowSystemInterfacePrivate::WindowSystemEvent *e);
static void updateFilteredScreenOrientation(QScreen *screen);
- static void reportScreenOrientationChange(QScreen *screen);
static void processScreenOrientationChange(QWindowSystemInterfacePrivate::ScreenOrientationEvent *e);
static void processScreenGeometryChange(QWindowSystemInterfacePrivate::ScreenGeometryEvent *e);
static void processScreenLogicalDotsPerInchChange(QWindowSystemInterfacePrivate::ScreenLogicalDotsPerInchEvent *e);
@@ -155,6 +135,7 @@ public:
static void processThemeChanged(QWindowSystemInterfacePrivate::ThemeChangeEvent *tce);
static void processExposeEvent(QWindowSystemInterfacePrivate::ExposeEvent *e);
+ static void processPaintEvent(QWindowSystemInterfacePrivate::PaintEvent *e);
static void processFileOpenEvent(QWindowSystemInterfacePrivate::FileOpenEvent *e);
@@ -180,11 +161,7 @@ public:
Qt::MouseButtons buttons, Qt::KeyboardModifiers modifiers);
#endif
-#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
static bool processNativeEvent(QWindow *window, const QByteArray &eventType, void *message, qintptr *result);
-#else
- static bool processNativeEvent(QWindow *window, const QByteArray &eventType, void *message, long *result);
-#endif
static bool sendQWindowEventToQPlatformWindow(QWindow *window, QEvent *event);
@@ -200,8 +177,6 @@ public:
return alignment;
}
- static void emitLastWindowClosed();
-
QPixmap getPixmapCursor(Qt::CursorShape cshape);
void _q_updateFocusObject(QObject *object);
@@ -217,28 +192,63 @@ public:
static void showModalWindow(QWindow *window);
static void hideModalWindow(QWindow *window);
static void updateBlockedStatus(QWindow *window);
- virtual bool isWindowBlocked(QWindow *window, QWindow **blockingWindow = nullptr) const;
+
+ virtual Qt::WindowModality defaultModality() const;
+ virtual bool windowNeverBlocked(QWindow *window) const;
+ bool isWindowBlocked(QWindow *window, QWindow **blockingWindow = nullptr) const;
virtual bool popupActive() { return false; }
+ virtual bool closeAllPopups() { return false; }
- static ulong mousePressTime;
static Qt::MouseButton mousePressButton;
- static int mousePressX;
- static int mousePressY;
- static QPointF lastCursorPosition;
+ static struct QLastCursorPosition {
+ constexpr inline QLastCursorPosition() noexcept : thePoint(qt_inf(), qt_inf()) {}
+ constexpr inline Q_IMPLICIT QLastCursorPosition(QPointF p) noexcept : thePoint(p) {}
+ constexpr inline Q_IMPLICIT operator QPointF() const noexcept { return thePoint; }
+ constexpr inline qreal x() const noexcept{ return thePoint.x(); }
+ constexpr inline qreal y() const noexcept{ return thePoint.y(); }
+ Q_GUI_EXPORT QPoint toPoint() const noexcept;
+
+ constexpr void reset() noexcept { *this = QLastCursorPosition{}; }
+
+ // QGuiApplicationPrivate::lastCursorPosition is used for mouse-move detection
+ // but even QPointF's qFuzzCompare on doubles is too precise, and causes move-noise
+ // e.g. on macOS (see QTBUG-111170). So we specialize the equality operators here
+ // to use single-point precision.
+ friend constexpr bool operator==(const QLastCursorPosition &p1, const QPointF &p2) noexcept
+ {
+ return qFuzzyCompare(float(p1.x()), float(p2.x()))
+ && qFuzzyCompare(float(p1.y()), float(p2.y()));
+ }
+ friend constexpr bool operator!=(const QLastCursorPosition &p1, const QPointF &p2) noexcept
+ {
+ return !(p1 == p2);
+ }
+ friend constexpr bool operator==(const QPointF &p1, const QLastCursorPosition &p2) noexcept
+ {
+ return p2 == p1;
+ }
+ friend constexpr bool operator!=(const QPointF &p1, const QLastCursorPosition &p2) noexcept
+ {
+ return !(p2 == p1);
+ }
+
+ private:
+ QPointF thePoint;
+ } lastCursorPosition;
static QWindow *currentMouseWindow;
static QWindow *currentMousePressWindow;
static Qt::ApplicationState applicationState;
static Qt::HighDpiScaleFactorRoundingPolicy highDpiScaleFactorRoundingPolicy;
- static bool highDpiScalingUpdated;
static QPointer<QWindow> currentDragWindow;
+ // TODO remove this: QPointingDevice can store what we need directly
struct TabletPointData {
TabletPointData(qint64 devId = 0) : deviceId(devId), state(Qt::NoButton), target(nullptr) {}
qint64 deviceId;
Qt::MouseButtons state;
QWindow *target;
};
- static QVector<TabletPointData> tabletDevicePoints;
+ static QList<TabletPointData> tabletDevicePoints;
static TabletPointData &tabletDevicePoint(qint64 deviceId);
#ifndef QT_NO_CLIPBOARD
@@ -271,7 +281,6 @@ public:
#endif
#ifndef QT_NO_SESSIONMANAGER
- static bool is_fallback_session_management_enabled;
QSessionManager *session_manager;
bool is_session_restored;
bool is_saving_session;
@@ -279,17 +288,6 @@ public:
void saveState();
#endif
- struct ActiveTouchPointsKey {
- ActiveTouchPointsKey(QTouchDevice *dev, int id) : device(dev), touchPointId(id) { }
- QTouchDevice *device;
- int touchPointId;
- };
- struct ActiveTouchPointsValue {
- QPointer<QWindow> window;
- QPointer<QObject> target;
- QTouchEvent::TouchPoint touchPoint;
- };
- QHash<ActiveTouchPointsKey, ActiveTouchPointsValue> activeTouchPoints;
QEvent::Type lastTouchType;
struct SynthesizedMouseData {
SynthesizedMouseData(const QPointF &p, const QPointF &sp, QWindow *w)
@@ -300,16 +298,6 @@ public:
};
QHash<QWindow *, SynthesizedMouseData> synthesizedMousePoints;
- static int mouseEventCaps(QMouseEvent *event);
- static QVector2D mouseEventVelocity(QMouseEvent *event);
- static void setMouseEventCapsAndVelocity(QMouseEvent *event, int caps, const QVector2D &velocity);
-
- static Qt::MouseEventSource mouseEventSource(const QMouseEvent *event);
- static void setMouseEventSource(QMouseEvent *event, Qt::MouseEventSource source);
-
- static Qt::MouseEventFlags mouseEventFlags(const QMouseEvent *event);
- static void setMouseEventFlags(QMouseEvent *event, Qt::MouseEventFlags flags);
-
static QInputDeviceManager *inputDeviceManager();
const QColorTrcLut *colorProfileForA8Text();
@@ -326,22 +314,37 @@ public:
static void resetCachedDevicePixelRatio();
+#ifndef QT_NO_ACTION
+ virtual QActionPrivate *createActionPrivate() const;
+#endif
+#ifndef QT_NO_SHORTCUT
+ virtual QShortcutPrivate *createShortcutPrivate() const;
+#endif
+
+ static void updatePalette();
+
protected:
- virtual void notifyThemeChanged();
- virtual void sendApplicationPaletteChange(bool toAllWidgets = false, const char *className = nullptr);
- bool tryCloseRemainingWindows(QWindowList processedWindows);
+ virtual void handleThemeChanged();
+
+ static bool setPalette(const QPalette &palette);
+ virtual QPalette basePalette() const;
+ virtual void handlePaletteChanged(const char *className = nullptr);
+
#if QT_CONFIG(draganddrop)
virtual void notifyDragStarted(const QDrag *);
#endif // QT_CONFIG(draganddrop)
private:
+ static void clearPalette();
+
friend class QDragManager;
static QGuiApplicationPrivate *self;
- static QTouchDevice *m_fakeTouchDevice;
static int m_fakeMouseSourcePointId;
- QSharedPointer<QColorTrcLut> m_a8ColorProfile;
- QSharedPointer<QColorTrcLut> m_a32ColorProfile;
+#ifdef Q_OS_WIN
+ std::shared_ptr<QColorTrcLut> m_a8ColorProfile;
+#endif
+ std::shared_ptr<QColorTrcLut> m_a32ColorProfile;
bool ownGlobalShareContext;
@@ -352,10 +355,80 @@ private:
static qreal m_maxDevicePixelRatio;
};
-Q_GUI_EXPORT uint qHash(const QGuiApplicationPrivate::ActiveTouchPointsKey &k);
+// ----------------- QNativeInterface -----------------
+
+class QWindowsMimeConverter;
+
+namespace QNativeInterface::Private {
+
+#if defined(Q_OS_WIN) || defined(Q_QDOC)
+
+
+struct Q_GUI_EXPORT QWindowsApplication
+{
+ QT_DECLARE_NATIVE_INTERFACE(QWindowsApplication, 1, QGuiApplication)
+
+ enum WindowActivationBehavior {
+ DefaultActivateWindow,
+ AlwaysActivateWindow
+ };
+
+ enum TouchWindowTouchType {
+ NormalTouch = 0x00000000,
+ FineTouch = 0x00000001,
+ WantPalmTouch = 0x00000002
+ };
+
+ Q_DECLARE_FLAGS(TouchWindowTouchTypes, TouchWindowTouchType)
+
+ enum DarkModeHandlingFlag {
+ DarkModeWindowFrames = 0x1,
+ DarkModeStyle = 0x2
+ };
+
+ Q_DECLARE_FLAGS(DarkModeHandling, DarkModeHandlingFlag)
+
+ virtual void setTouchWindowTouchType(TouchWindowTouchTypes type) = 0;
+ virtual TouchWindowTouchTypes touchWindowTouchType() const = 0;
+
+ virtual WindowActivationBehavior windowActivationBehavior() const = 0;
+ virtual void setWindowActivationBehavior(WindowActivationBehavior behavior) = 0;
+
+ virtual void setHasBorderInFullScreenDefault(bool border) = 0;
+
+ virtual bool isTabletMode() const = 0;
+
+ virtual bool isWinTabEnabled() const = 0;
+ virtual bool setWinTabEnabled(bool enabled) = 0;
+
+ virtual DarkModeHandling darkModeHandling() const = 0;
+ virtual void setDarkModeHandling(DarkModeHandling handling) = 0;
+
+ virtual void registerMime(QWindowsMimeConverter *mime) = 0;
+ virtual void unregisterMime(QWindowsMimeConverter *mime) = 0;
+
+ virtual int registerMimeType(const QString &mime) = 0;
+
+ virtual HWND createMessageWindow(const QString &classNameTemplate,
+ const QString &windowName,
+ QFunctionPointer eventProc = nullptr) const = 0;
+
+ virtual bool asyncExpose() const = 0; // internal, used by Active Qt
+ virtual void setAsyncExpose(bool value) = 0;
+
+ virtual QVariant gpu() const = 0; // internal, used by qtdiag
+ virtual QVariant gpuList() const = 0;
+
+ virtual void populateLightSystemPalette(QPalette &pal) const = 0;
+};
+#endif // Q_OS_WIN
+
+} // QNativeInterface::Private
-Q_GUI_EXPORT bool operator==(const QGuiApplicationPrivate::ActiveTouchPointsKey &a,
- const QGuiApplicationPrivate::ActiveTouchPointsKey &b);
+#if defined(Q_OS_WIN)
+Q_DECLARE_OPERATORS_FOR_FLAGS(QNativeInterface::Private::QWindowsApplication::TouchWindowTouchTypes)
+Q_DECLARE_OPERATORS_FOR_FLAGS(QNativeInterface::Private::QWindowsApplication::DarkModeHandling)
+#endif
QT_END_NAMESPACE
diff --git a/src/gui/kernel/qguiapplication_platform.h b/src/gui/kernel/qguiapplication_platform.h
new file mode 100644
index 0000000000..545bf75c84
--- /dev/null
+++ b/src/gui/kernel/qguiapplication_platform.h
@@ -0,0 +1,68 @@
+// Copyright (C) 2021 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
+
+#ifndef QGUIAPPLICATION_PLATFORM_H
+#define QGUIAPPLICATION_PLATFORM_H
+
+//
+// W A R N I N G
+// -------------
+//
+// This file is part of the native interface APIs. Usage of
+// this API may make your code source and binary incompatible
+// with future versions of Qt.
+//
+
+#include <QtGui/qtguiglobal.h>
+
+#include <QtCore/qnativeinterface.h>
+#include <QtGui/qguiapplication.h>
+
+#if QT_CONFIG(xcb)
+typedef struct _XDisplay Display;
+struct xcb_connection_t;
+#endif
+
+#if QT_CONFIG(wayland)
+struct wl_display;
+struct wl_compositor;
+struct wl_seat;
+struct wl_keyboard;
+struct wl_pointer;
+struct wl_touch;
+#endif
+
+QT_BEGIN_NAMESPACE
+
+namespace QNativeInterface
+{
+
+#if QT_CONFIG(xcb) || defined(Q_QDOC)
+struct Q_GUI_EXPORT QX11Application
+{
+ QT_DECLARE_NATIVE_INTERFACE(QX11Application, 1, QGuiApplication)
+ virtual Display *display() const = 0;
+ virtual xcb_connection_t *connection() const = 0;
+};
+#endif
+
+#if QT_CONFIG(wayland) || defined(Q_QDOC)
+struct Q_GUI_EXPORT QWaylandApplication
+{
+ QT_DECLARE_NATIVE_INTERFACE(QWaylandApplication, 1, QGuiApplication)
+ virtual wl_display *display() const = 0;
+ virtual wl_compositor *compositor() const = 0;
+ virtual wl_seat *seat() const = 0;
+ virtual wl_keyboard *keyboard() const = 0;
+ virtual wl_pointer *pointer() const = 0;
+ virtual wl_touch *touch() const = 0;
+ virtual uint lastInputSerial() const = 0;
+ virtual wl_seat *lastInputSeat() const = 0;
+};
+#endif
+
+} // QNativeInterface
+
+QT_END_NAMESPACE
+
+#endif // QGUIAPPLICATION_PLATFORM_H
diff --git a/src/gui/kernel/qguishortcut.cpp b/src/gui/kernel/qguishortcut.cpp
deleted file mode 100644
index add1dce12e..0000000000
--- a/src/gui/kernel/qguishortcut.cpp
+++ /dev/null
@@ -1,354 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2019 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the QtGui module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "qguishortcut.h"
-#include "qguishortcut_p.h"
-
-#include <qevent.h>
-#include <qguiapplication.h>
-#include <qwindow.h>
-#include <private/qguiapplication_p.h>
-#include <qpa/qplatformmenu.h>
-
-QT_BEGIN_NAMESPACE
-
-#define QAPP_CHECK(functionName) \
- if (Q_UNLIKELY(!qApp)) { \
- qWarning("QGuiShortcut: Initialize QGuiApplication before calling '" functionName "'."); \
- return; \
- }
-
-/*!
- \class QGuiShortcut
- \brief The QGuiShortcut class is a base class for handling keyboard shortcuts.
-
- \ingroup events
- \inmodule QtGui
- \since 6.0
-
- The QGuiShortcut class is a base class for classes providing a way of
- connecting keyboard shortcuts to Qt's \l{signals and slots} mechanism,
- so that objects can be informed when a shortcut is executed. The shortcut
- can be set up to contain all the key presses necessary to
- describe a keyboard shortcut, including the states of modifier
- keys such as \uicontrol Shift, \uicontrol Ctrl, and \uicontrol Alt.
-
- \target mnemonic
-
- \sa QShortcutEvent, QKeySequence, QAction
-*/
-
-/*!
- \fn void QGuiShortcut::activated()
-
- This signal is emitted when the user types the shortcut's key
- sequence.
-
- \sa activatedAmbiguously()
-*/
-
-/*!
- \fn void QGuiShortcut::activatedAmbiguously()
-
- When a key sequence is being typed at the keyboard, it is said to
- be ambiguous as long as it matches the start of more than one
- shortcut.
-
- When a shortcut's key sequence is completed,
- activatedAmbiguously() is emitted if the key sequence is still
- ambiguous (i.e., it is the start of one or more other shortcuts).
- The activated() signal is not emitted in this case.
-
- \sa activated()
-*/
-
-static bool simpleContextMatcher(QObject *object, Qt::ShortcutContext context)
-{
- auto guiShortcut = qobject_cast<QGuiShortcut *>(object);
- if (QGuiApplication::applicationState() != Qt::ApplicationActive || guiShortcut == nullptr)
- return false;
- if (context == Qt::ApplicationShortcut)
- return true;
- auto focusWindow = QGuiApplication::focusWindow();
- if (!focusWindow)
- return false;
- auto window = qobject_cast<const QWindow *>(guiShortcut->parent());
- if (!window)
- return false;
- if (focusWindow == window && focusWindow->isTopLevel())
- return context == Qt::WindowShortcut || context == Qt::WidgetWithChildrenShortcut;
- return focusWindow->isAncestorOf(window, QWindow::ExcludeTransients);
-}
-
-QShortcutMap::ContextMatcher QGuiShortcutPrivate::contextMatcher() const
-{
- return simpleContextMatcher;
-}
-
-void QGuiShortcutPrivate::redoGrab(QShortcutMap &map)
-{
- Q_Q(QGuiShortcut);
- if (Q_UNLIKELY(!parent)) {
- qWarning("QGuiShortcut: No window parent defined");
- return;
- }
-
- if (sc_id)
- map.removeShortcut(sc_id, q);
- if (sc_sequence.isEmpty())
- return;
- sc_id = map.addShortcut(q, sc_sequence, sc_context, contextMatcher());
- if (!sc_enabled)
- map.setShortcutEnabled(false, sc_id, q);
- if (!sc_autorepeat)
- map.setShortcutAutoRepeat(false, sc_id, q);
-}
-
-/*!
- Constructs a QGuiShortcut object for the \a parent window. Since no
- shortcut key sequence is specified, the shortcut will not emit any
- signals.
-
- \sa setKey()
-*/
-QGuiShortcut::QGuiShortcut(QWindow *parent)
- : QGuiShortcut(*new QGuiShortcutPrivate, parent)
-{
-}
-
-/*!
- Constructs a QGuiShortcut object for the \a parent window. The shortcut
- operates on its parent, listening for \l{QShortcutEvent}s that
- match the \a key sequence. Depending on the ambiguity of the
- event, the shortcut will call the \a member function, or the \a
- ambiguousMember function, if the key press was in the shortcut's
- \a context.
-*/
-QGuiShortcut::QGuiShortcut(const QKeySequence &key, QWindow *parent,
- const char *member, const char *ambiguousMember,
- Qt::ShortcutContext context)
- : QGuiShortcut(*new QGuiShortcutPrivate, key, parent, member, ambiguousMember, context)
-{
-}
-
-/*!
- \internal
-*/
-QGuiShortcut::QGuiShortcut(QGuiShortcutPrivate &dd, QObject *parent)
- : QObject(dd, parent)
-{
- Q_ASSERT(parent != nullptr);
-}
-
-/*!
- \internal
-*/
-QGuiShortcut::QGuiShortcut(QGuiShortcutPrivate &dd,
- const QKeySequence &key, QObject *parent,
- const char *member, const char *ambiguousMember,
- Qt::ShortcutContext context)
- : QGuiShortcut(dd, parent)
-{
- QAPP_CHECK("QGuiShortcut");
-
- Q_D(QGuiShortcut);
- d->sc_context = context;
- d->sc_sequence = key;
- d->redoGrab(QGuiApplicationPrivate::instance()->shortcutMap);
- if (member)
- connect(this, SIGNAL(activated()), parent, member);
- if (ambiguousMember)
- connect(this, SIGNAL(activatedAmbiguously()), parent, ambiguousMember);
-}
-
-/*!
- Destroys the shortcut.
-*/
-QGuiShortcut::~QGuiShortcut()
-{
- Q_D(QGuiShortcut);
- if (qApp)
- QGuiApplicationPrivate::instance()->shortcutMap.removeShortcut(d->sc_id, this);
-}
-
-/*!
- \property QGuiShortcut::key
- \brief the shortcut's key sequence
-
- This is a key sequence with an optional combination of Shift, Ctrl,
- and Alt. The key sequence may be supplied in a number of ways:
-
- \snippet code/src_gui_kernel_qshortcut.cpp 1
-
- By default, this property contains an empty key sequence.
-*/
-void QGuiShortcut::setKey(const QKeySequence &key)
-{
- Q_D(QGuiShortcut);
- if (d->sc_sequence == key)
- return;
- QAPP_CHECK("setKey");
- d->sc_sequence = key;
- d->redoGrab(QGuiApplicationPrivate::instance()->shortcutMap);
-}
-
-QKeySequence QGuiShortcut::key() const
-{
- Q_D(const QGuiShortcut);
- return d->sc_sequence;
-}
-
-/*!
- \property QGuiShortcut::enabled
- \brief whether the shortcut is enabled
-
- An enabled shortcut emits the activated() or activatedAmbiguously()
- signal when a QShortcutEvent occurs that matches the shortcut's
- key() sequence.
-
- If the application is in \c WhatsThis mode the shortcut will not emit
- the signals, but will show the "What's This?" text instead.
-
- By default, this property is \c true.
-
- \sa whatsThis
-*/
-void QGuiShortcut::setEnabled(bool enable)
-{
- Q_D(QGuiShortcut);
- if (d->sc_enabled == enable)
- return;
- QAPP_CHECK("setEnabled");
- d->sc_enabled = enable;
- QGuiApplicationPrivate::instance()->shortcutMap.setShortcutEnabled(enable, d->sc_id, this);
-}
-
-bool QGuiShortcut::isEnabled() const
-{
- Q_D(const QGuiShortcut);
- return d->sc_enabled;
-}
-
-/*!
- \property QGuiShortcut::context
- \brief the context in which the shortcut is valid
-
- A shortcut's context decides in which circumstances a shortcut is
- allowed to be triggered. The normal context is Qt::WindowShortcut,
- which allows the shortcut to trigger if the parent (the widget
- containing the shortcut) is a subwidget of the active top-level
- window.
-
- By default, this property is set to Qt::WindowShortcut.
-*/
-void QGuiShortcut::setContext(Qt::ShortcutContext context)
-{
- Q_D(QGuiShortcut);
- if (d->sc_context == context)
- return;
- QAPP_CHECK("setContext");
- d->sc_context = context;
- d->redoGrab(QGuiApplicationPrivate::instance()->shortcutMap);
-}
-
-Qt::ShortcutContext QGuiShortcut::context() const
-{
- Q_D(const QGuiShortcut);
- return d->sc_context;
-}
-
-/*!
- \property QGuiShortcut::autoRepeat
- \brief whether the shortcut can auto repeat
-
- If true, the shortcut will auto repeat when the keyboard shortcut
- combination is held down, provided that keyboard auto repeat is
- enabled on the system.
- The default value is true.
-*/
-void QGuiShortcut::setAutoRepeat(bool on)
-{
- Q_D(QGuiShortcut);
- if (d->sc_autorepeat == on)
- return;
- QAPP_CHECK("setAutoRepeat");
- d->sc_autorepeat = on;
- QGuiApplicationPrivate::instance()->shortcutMap.setShortcutAutoRepeat(on, d->sc_id, this);
-}
-
-bool QGuiShortcut::autoRepeat() const
-{
- Q_D(const QGuiShortcut);
- return d->sc_autorepeat;
-}
-
-/*!
- Returns the shortcut's ID.
-
- \sa QShortcutEvent::shortcutId()
-*/
-int QGuiShortcut::id() const
-{
- Q_D(const QGuiShortcut);
- return d->sc_id;
-}
-
-/*!
- \internal
-*/
-bool QGuiShortcut::event(QEvent *e)
-{
- Q_D(QGuiShortcut);
- if (d->sc_enabled && e->type() == QEvent::Shortcut) {
- auto se = static_cast<QShortcutEvent *>(e);
- if (se->shortcutId() == d->sc_id && se->key() == d->sc_sequence
- && !d->handleWhatsThis()) {
- if (se->isAmbiguous())
- emit activatedAmbiguously();
- else
- emit activated();
- return true;
- }
- }
- return QObject::event(e);
-}
-
-QT_END_NAMESPACE
-
-#include "moc_qguishortcut.cpp"
diff --git a/src/gui/kernel/qguishortcut.h b/src/gui/kernel/qguishortcut.h
deleted file mode 100644
index fb64f10c84..0000000000
--- a/src/gui/kernel/qguishortcut.h
+++ /dev/null
@@ -1,98 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2019 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the QtGui module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef QGUISHORTCUT_H
-#define QGUISHORTCUT_H
-
-#include <QtGui/qtguiglobal.h>
-#include <QtGui/qkeysequence.h>
-#include <QtCore/qobject.h>
-
-QT_REQUIRE_CONFIG(shortcut);
-
-QT_BEGIN_NAMESPACE
-
-class QGuiShortcutPrivate;
-class QWindow;
-
-class Q_GUI_EXPORT QGuiShortcut : public QObject
-{
- Q_OBJECT
- Q_DECLARE_PRIVATE(QGuiShortcut)
- Q_PROPERTY(QKeySequence key READ key WRITE setKey)
- Q_PROPERTY(bool enabled READ isEnabled WRITE setEnabled)
- Q_PROPERTY(bool autoRepeat READ autoRepeat WRITE setAutoRepeat)
- Q_PROPERTY(Qt::ShortcutContext context READ context WRITE setContext)
-public:
- explicit QGuiShortcut(QWindow *parent);
- explicit QGuiShortcut(const QKeySequence& key, QWindow *parent,
- const char *member = nullptr, const char *ambiguousMember = nullptr,
- Qt::ShortcutContext context = Qt::WindowShortcut);
- ~QGuiShortcut();
-
- void setKey(const QKeySequence& key);
- QKeySequence key() const;
-
- void setEnabled(bool enable);
- bool isEnabled() const;
-
- void setContext(Qt::ShortcutContext context);
- Qt::ShortcutContext context() const;
-
- void setAutoRepeat(bool on);
- bool autoRepeat() const;
-
- int id() const;
-
-Q_SIGNALS:
- void activated();
- void activatedAmbiguously();
-
-protected:
- QGuiShortcut(QGuiShortcutPrivate &dd, QObject *parent);
- QGuiShortcut(QGuiShortcutPrivate &dd, const QKeySequence& key, QObject *parent,
- const char *member, const char *ambiguousMember,
- Qt::ShortcutContext context);
-
- bool event(QEvent *e) override;
-};
-
-QT_END_NAMESPACE
-
-#endif // QGUISHORTCUT_H
diff --git a/src/gui/kernel/qguishortcut_p.h b/src/gui/kernel/qguishortcut_p.h
deleted file mode 100644
index 420b02ef1a..0000000000
--- a/src/gui/kernel/qguishortcut_p.h
+++ /dev/null
@@ -1,92 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2019 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the QtGui module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef QGUISHORTCUT_P_H
-#define QGUISHORTCUT_P_H
-
-//
-// W A R N I N G
-// -------------
-//
-// This file is not part of the Qt API. It exists purely as an
-// implementation detail. This header file may change from version to
-// version without notice, or even be removed.
-//
-// We mean it.
-//
-
-#include <QtGui/private/qtguiglobal_p.h>
-#include "qguishortcut.h"
-#include <QtGui/qkeysequence.h>
-
-#include <QtCore/qstring.h>
-#include <QtCore/private/qobject_p.h>
-
-#include <private/qshortcutmap_p.h>
-
-
-
-QT_BEGIN_NAMESPACE
-
-class QShortcutMap;
-
-/*
- \internal
- Private data accessed through d-pointer.
-*/
-class Q_GUI_EXPORT QGuiShortcutPrivate : public QObjectPrivate
-{
- Q_DECLARE_PUBLIC(QGuiShortcut)
-public:
- QGuiShortcutPrivate() = default;
-
- virtual QShortcutMap::ContextMatcher contextMatcher() const;
- virtual bool handleWhatsThis() { return false; }
-
- QKeySequence sc_sequence;
- Qt::ShortcutContext sc_context = Qt::WindowShortcut;
- bool sc_enabled = true;
- bool sc_autorepeat = true;
- int sc_id = 0;
- void redoGrab(QShortcutMap &map);
-};
-
-QT_END_NAMESPACE
-
-#endif // QGUISHORTCUT_P_H
diff --git a/src/gui/kernel/qguivariant.cpp b/src/gui/kernel/qguivariant.cpp
index 0f29633222..78a1660355 100644
--- a/src/gui/kernel/qguivariant.cpp
+++ b/src/gui/kernel/qguivariant.cpp
@@ -1,46 +1,11 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the QtGui module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2020 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
// Gui types
#include "qbitmap.h"
#include "qbrush.h"
#include "qcolor.h"
+#include "qcolorspace.h"
#include "qcursor.h"
#include "qfont.h"
#include "qimage.h"
@@ -48,7 +13,6 @@
# include "qkeysequence.h"
#endif
#include "qtransform.h"
-#include "qmatrix.h"
#include "qpalette.h"
#include "qpen.h"
#include "qpixmap.h"
@@ -86,271 +50,98 @@
#include <float.h>
-#include "private/qvariant_p.h"
#include <private/qmetatype_p.h>
QT_BEGIN_NAMESPACE
-Q_CORE_EXPORT const QVariant::Handler *qcoreVariantHandler();
-
namespace {
-struct GuiTypesFilter {
- template<typename T>
- struct Acceptor {
- static const bool IsAccepted = QModulesPrivate::QTypeModuleInfo<T>::IsGui && QtMetaTypePrivate::TypeDefinition<T>::IsAvailable;
- };
-};
-
-static void construct(QVariant::Private *x, const void *copy)
-{
- const int type = x->type;
- QVariantConstructor<GuiTypesFilter> constructor(x, copy);
- QMetaTypeSwitcher::switcher<void>(constructor, type, nullptr);
-}
-
-static void clear(QVariant::Private *d)
-{
- QVariantDestructor<GuiTypesFilter> destructor(d);
- QMetaTypeSwitcher::switcher<void>(destructor, d->type, nullptr);
-}
-// This class is a hack that customizes access to QPolygon and QPolygonF
-template<class Filter>
-class QGuiVariantIsNull : public QVariantIsNull<Filter> {
- typedef QVariantIsNull<Filter> Base;
-public:
- QGuiVariantIsNull(const QVariant::Private *d)
- : QVariantIsNull<Filter>(d)
- {}
- template<typename T>
- bool delegate(const T *p) { return Base::delegate(p); }
- bool delegate(const QPolygon*) { return v_cast<QPolygon>(Base::m_d)->isEmpty(); }
- bool delegate(const QPolygonF*) { return v_cast<QPolygonF>(Base::m_d)->isEmpty(); }
- bool delegate(const void *p) { return Base::delegate(p); }
-};
-static bool isNull(const QVariant::Private *d)
+// NOLINTNEXTLINE(cppcoreguidelines-virtual-class-destructor): this is not a base class
+static constexpr struct : QMetaTypeModuleHelper
{
- QGuiVariantIsNull<GuiTypesFilter> isNull(d);
- return QMetaTypeSwitcher::switcher<bool>(isNull, d->type, nullptr);
-}
+#define QT_IMPL_METATYPEINTERFACE_GUI_TYPES(MetaTypeName, MetaTypeId, RealName) \
+ QT_METATYPE_INTERFACE_INIT(RealName),
-// This class is a hack that customizes access to QPixmap, QBitmap, QCursor and QIcon
-template<class Filter>
-class QGuiVariantComparator : public QVariantComparator<Filter> {
- typedef QVariantComparator<Filter> Base;
-public:
- QGuiVariantComparator(const QVariant::Private *a, const QVariant::Private *b)
- : QVariantComparator<Filter>(a, b)
- {}
- template<typename T>
- bool delegate(const T *p)
- {
- return Base::delegate(p);
- }
- bool delegate(const QPixmap*)
- {
- return v_cast<QPixmap>(Base::m_a)->cacheKey() == v_cast<QPixmap>(Base::m_b)->cacheKey();
- }
- bool delegate(const QBitmap*)
- {
- return v_cast<QBitmap>(Base::m_a)->cacheKey() == v_cast<QBitmap>(Base::m_b)->cacheKey();
- }
-#ifndef QT_NO_CURSOR
- bool delegate(const QCursor*)
- {
- return v_cast<QCursor>(Base::m_a)->shape() == v_cast<QCursor>(Base::m_b)->shape();
+ const QtPrivate::QMetaTypeInterface *interfaceForType(int type) const override {
+ switch (type) {
+ QT_FOR_EACH_STATIC_GUI_CLASS(QT_METATYPE_CONVERT_ID_TO_TYPE)
+ default: return nullptr;
+ }
}
-#endif
-#ifndef QT_NO_ICON
- bool delegate(const QIcon *)
+#undef QT_IMPL_METATYPEINTERFACE_GUI_TYPES
+
+ bool convert(const void *from, int fromTypeId, void *to, int toTypeId) const override
{
- return v_cast<QIcon>(Base::m_a)->cacheKey() == v_cast<QIcon>(Base::m_b)->cacheKey();
- }
-#endif
- bool delegate(const void *p) { return Base::delegate(p); }
-};
+ Q_ASSERT(fromTypeId != toTypeId);
-static bool compare(const QVariant::Private *a, const QVariant::Private *b)
-{
- QGuiVariantComparator<GuiTypesFilter> comparator(a, b);
- return QMetaTypeSwitcher::switcher<bool>(comparator, a->type, nullptr);
-}
+ bool onlyCheck = (from == nullptr && to == nullptr);
+ // either two nullptrs from canConvert, or two valid pointers
+ Q_ASSERT(onlyCheck || (bool(from) && bool(to)));
-static bool convert(const QVariant::Private *d, int t,
- void *result, bool *ok)
-{
- switch (t) {
- case QVariant::ByteArray:
- if (d->type == QVariant::Color) {
- const QColor *c = v_cast<QColor>(d);
- *static_cast<QByteArray *>(result) = c->name(c->alpha() != 255 ? QColor::HexArgb : QColor::HexRgb).toLatin1();
- return true;
- }
- break;
- case QVariant::String: {
- QString *str = static_cast<QString *>(result);
- switch (d->type) {
#if QT_CONFIG(shortcut)
- case QVariant::KeySequence:
- *str = (*v_cast<QKeySequence>(d)).toString(QKeySequence::NativeText);
- return true;
+ using Int = int;
#endif
- case QVariant::Font:
- *str = v_cast<QFont>(d)->toString();
- return true;
- case QVariant::Color: {
- const QColor *c = v_cast<QColor>(d);
- *str = c->name(c->alpha() != 255 ? QColor::HexArgb : QColor::HexRgb);
- return true;
- }
- default:
- break;
- }
- break;
- }
- case QVariant::Pixmap:
- if (d->type == QVariant::Image) {
- *static_cast<QPixmap *>(result) = QPixmap::fromImage(*v_cast<QImage>(d));
- return true;
- } else if (d->type == QVariant::Bitmap) {
- *static_cast<QPixmap *>(result) = *v_cast<QBitmap>(d);
- return true;
- } else if (d->type == QVariant::Brush) {
- if (v_cast<QBrush>(d)->style() == Qt::TexturePattern) {
- *static_cast<QPixmap *>(result) = v_cast<QBrush>(d)->texture();
- return true;
- }
- }
- break;
- case QVariant::Image:
- if (d->type == QVariant::Pixmap) {
- *static_cast<QImage *>(result) = v_cast<QPixmap>(d)->toImage();
- return true;
- } else if (d->type == QVariant::Bitmap) {
- *static_cast<QImage *>(result) = v_cast<QBitmap>(d)->toImage();
- return true;
- }
- break;
- case QVariant::Bitmap:
- if (d->type == QVariant::Pixmap) {
- *static_cast<QBitmap *>(result) = *v_cast<QPixmap>(d);
- return true;
- } else if (d->type == QVariant::Image) {
- *static_cast<QBitmap *>(result) = QBitmap::fromImage(*v_cast<QImage>(d));
- return true;
- }
- break;
+ switch (makePair(toTypeId, fromTypeId)) {
+ QMETATYPE_CONVERTER(QByteArray, QColor,
+ result = source.name(source.alpha() != 255 ?
+ QColor::HexArgb : QColor::HexRgb).toLatin1();
+ return true;
+ );
+ QMETATYPE_CONVERTER(QColor, QByteArray,
+ result = QColor::fromString(QLatin1StringView(source));
+ return result.isValid();
+ );
+ QMETATYPE_CONVERTER(QString, QColor,
+ result = source.name(source.alpha() != 255 ?
+ QColor::HexArgb : QColor::HexRgb);
+ return true;
+ );
+ QMETATYPE_CONVERTER(QColor, QString,
+ result = QColor::fromString(source);
+ return result.isValid();
+ );
#if QT_CONFIG(shortcut)
- case QVariant::Int:
- if (d->type == QVariant::KeySequence) {
- const QKeySequence &seq = *v_cast<QKeySequence>(d);
- *static_cast<int *>(result) = seq.isEmpty() ? 0 : seq[0];
+ QMETATYPE_CONVERTER(QString, QKeySequence,
+ result = source.toString(QKeySequence::NativeText);
return true;
- }
- break;
-#endif
- case QVariant::Font:
- if (d->type == QVariant::String) {
- QFont *f = static_cast<QFont *>(result);
- f->fromString(*v_cast<QString>(d));
+ );
+ QMETATYPE_CONVERTER(QKeySequence, QString, result = source; return true;);
+ QMETATYPE_CONVERTER(Int, QKeySequence,
+ result = source.isEmpty() ? 0 : source[0].toCombined();
return true;
- }
- break;
- case QVariant::Color:
- if (d->type == QVariant::String) {
- static_cast<QColor *>(result)->setNamedColor(*v_cast<QString>(d));
- return static_cast<QColor *>(result)->isValid();
- } else if (d->type == QVariant::ByteArray) {
- static_cast<QColor *>(result)->setNamedColor(QLatin1String(*v_cast<QByteArray>(d)));
- return true;
- } else if (d->type == QVariant::Brush) {
- if (v_cast<QBrush>(d)->style() == Qt::SolidPattern) {
- *static_cast<QColor *>(result) = v_cast<QBrush>(d)->color();
+ );
+ QMETATYPE_CONVERTER(QKeySequence, Int, result = source; return true;);
+#endif
+ QMETATYPE_CONVERTER(QString, QFont, result = source.toString(); return true;);
+ QMETATYPE_CONVERTER(QFont, QString, return result.fromString(source););
+ QMETATYPE_CONVERTER(QPixmap, QImage, result = QPixmap::fromImage(source); return true;);
+ QMETATYPE_CONVERTER(QImage, QPixmap, result = source.toImage(); return true;);
+ QMETATYPE_CONVERTER(QPixmap, QBitmap, result = source; return true;);
+ QMETATYPE_CONVERTER(QBitmap, QPixmap, result = QBitmap::fromPixmap(source); return true;);
+ QMETATYPE_CONVERTER(QImage, QBitmap, result = source.toImage(); return true;);
+ QMETATYPE_CONVERTER(QBitmap, QImage, result = QBitmap::fromImage(source); return true;);
+ QMETATYPE_CONVERTER(QPixmap, QBrush, result = source.texture(); return true;);
+ QMETATYPE_CONVERTER(QBrush, QPixmap, result = source; return true;);
+ QMETATYPE_CONVERTER(QColor, QBrush,
+ if (source.style() == Qt::SolidPattern) {
+ result = source.color();
return true;
}
- }
- break;
- case QVariant::Brush:
- if (d->type == QVariant::Color) {
- *static_cast<QBrush *>(result) = QBrush(*v_cast<QColor>(d));
- return true;
- } else if (d->type == QVariant::Pixmap) {
- *static_cast<QBrush *>(result) = QBrush(*v_cast<QPixmap>(d));
- return true;
- }
- break;
-#if QT_CONFIG(shortcut)
- case QVariant::KeySequence: {
- QKeySequence *seq = static_cast<QKeySequence *>(result);
- switch (d->type) {
- case QVariant::String:
- *seq = QKeySequence(*v_cast<QString>(d));
- return true;
- case QVariant::Int:
- *seq = QKeySequence(d->data.i);
- return true;
+ return false;
+ );
+ QMETATYPE_CONVERTER(QBrush, QColor, result = source; return true;);
default:
break;
}
- break;
- }
-#endif
-#ifndef QT_NO_ICON
- case QVariant::Icon: {
- if (ok)
- *ok = false;
return false;
}
-#endif
- default:
- break;
- }
- return qcoreVariantHandler()->convert(d, t, result, ok);
-}
-
-#if !defined(QT_NO_DEBUG_STREAM)
-static void streamDebug(QDebug dbg, const QVariant &v)
-{
- QVariant::Private *d = const_cast<QVariant::Private *>(&v.data_ptr());
- QVariantDebugStream<GuiTypesFilter> stream(dbg, d);
- QMetaTypeSwitcher::switcher<void>(stream, d->type, nullptr);
-}
-#endif
+} qVariantGuiHelper;
-const QVariant::Handler qt_gui_variant_handler = {
- construct,
- clear,
- isNull,
-#ifndef QT_NO_DATASTREAM
- nullptr,
- nullptr,
-#endif
- compare,
- convert,
- nullptr,
-#if !defined(QT_NO_DEBUG_STREAM)
- streamDebug
-#else
- 0
-#endif
-};
-
-#define QT_IMPL_METATYPEINTERFACE_GUI_TYPES(MetaTypeName, MetaTypeId, RealName) \
- QT_METATYPE_INTERFACE_INIT(RealName),
-
-static const QMetaTypeInterface qVariantGuiHelper[] = {
- QT_FOR_EACH_STATIC_GUI_CLASS(QT_IMPL_METATYPEINTERFACE_GUI_TYPES)
-};
-
-#undef QT_IMPL_METATYPEINTERFACE_GUI_TYPES
} // namespace used to hide QVariant handler
-extern Q_CORE_EXPORT const QMetaTypeInterface *qMetaTypeGuiHelper;
-
void qRegisterGuiVariant()
{
- QVariantPrivate::registerHandler(QModulesPrivate::Gui, &qt_gui_variant_handler);
- qMetaTypeGuiHelper = qVariantGuiHelper;
+ qMetaTypeGuiHelper = &qVariantGuiHelper;
}
Q_CONSTRUCTOR_FUNCTION(qRegisterGuiVariant)
diff --git a/src/gui/kernel/qhighdpiscaling.cpp b/src/gui/kernel/qhighdpiscaling.cpp
index fde6bb0180..a0e1b48dcb 100644
--- a/src/gui/kernel/qhighdpiscaling.cpp
+++ b/src/gui/kernel/qhighdpiscaling.cpp
@@ -1,41 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the QtGui module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#include "qhighdpiscaling_p.h"
#include "qguiapplication.h"
@@ -49,17 +13,13 @@
#include <QtCore/qmetaobject.h>
#include <algorithm>
+#include <optional>
QT_BEGIN_NAMESPACE
-Q_LOGGING_CATEGORY(lcScaling, "qt.scaling");
+Q_LOGGING_CATEGORY(lcHighDpi, "qt.highdpi");
#ifndef QT_NO_HIGHDPISCALING
-static const char legacyDevicePixelEnvVar[] = "QT_DEVICE_PIXEL_RATIO";
-
-// Note: QT_AUTO_SCREEN_SCALE_FACTOR is Done on X11, and should be kept
-// working as-is. It's Deprecated on all other platforms.
-static const char legacyAutoScreenEnvVar[] = "QT_AUTO_SCREEN_SCALE_FACTOR";
static const char enableHighDpiScalingEnvVar[] = "QT_ENABLE_HIGHDPI_SCALING";
static const char scaleFactorEnvVar[] = "QT_SCALE_FACTOR";
@@ -68,47 +28,38 @@ static const char scaleFactorRoundingPolicyEnvVar[] = "QT_SCALE_FACTOR_ROUNDING_
static const char dpiAdjustmentPolicyEnvVar[] = "QT_DPI_ADJUSTMENT_POLICY";
static const char usePhysicalDpiEnvVar[] = "QT_USE_PHYSICAL_DPI";
-// Per-screen scale factors for named screens set with QT_SCREEN_SCALE_FACTORS
-// are stored here. Use a global hash to keep the factor across screen
-// disconnect/connect cycles where the screen object may be deleted.
-typedef QHash<QString, qreal> QScreenScaleFactorHash;
-Q_GLOBAL_STATIC(QScreenScaleFactorHash, qNamedScreenScaleFactors);
+static std::optional<QString> qEnvironmentVariableOptionalString(const char *name)
+{
+ if (!qEnvironmentVariableIsSet(name))
+ return std::nullopt;
+
+ return std::optional(qEnvironmentVariable(name));
+}
+
+static std::optional<QByteArray> qEnvironmentVariableOptionalByteArray(const char *name)
+{
+ if (!qEnvironmentVariableIsSet(name))
+ return std::nullopt;
+
+ return std::optional(qgetenv(name));
+}
-// Reads and interprets the given environment variable as a bool,
-// returns the default value if not set.
-static bool qEnvironmentVariableAsBool(const char *name, bool defaultValue)
+static std::optional<int> qEnvironmentVariableOptionalInt(const char *name)
{
bool ok = false;
- int value = qEnvironmentVariableIntValue(name, &ok);
- return ok ? value > 0 : defaultValue;
+ const int value = qEnvironmentVariableIntValue(name, &ok);
+ auto opt = ok ? std::optional(value) : std::nullopt;
+ return opt;
}
-static inline qreal initialGlobalScaleFactor()
+static std::optional<qreal> qEnvironmentVariableOptionalReal(const char *name)
{
+ if (!qEnvironmentVariableIsSet(name))
+ return std::nullopt;
- qreal result = 1;
- if (qEnvironmentVariableIsSet(scaleFactorEnvVar)) {
- bool ok;
- const qreal f = qEnvironmentVariable(scaleFactorEnvVar).toDouble(&ok);
- if (ok && f > 0) {
- qCDebug(lcScaling) << "Apply " << scaleFactorEnvVar << f;
- result = f;
- }
- } else {
- // Check for deprecated environment variables.
- if (qEnvironmentVariableIsSet(legacyDevicePixelEnvVar)) {
- qWarning("Warning: %s is deprecated. Instead use:\n"
- " %s to enable platform plugin controlled per-screen factors.\n"
- " %s to set per-screen DPI.\n"
- " %s to set the application global scale factor.",
- legacyDevicePixelEnvVar, legacyAutoScreenEnvVar, screenFactorsEnvVar, scaleFactorEnvVar);
-
- int dpr = qEnvironmentVariableIntValue(legacyDevicePixelEnvVar);
- if (dpr > 0)
- result = dpr;
- }
- }
- return result;
+ bool ok = false;
+ const qreal value = qEnvironmentVariable(name).toDouble(&ok);
+ return ok ? std::optional(value) : std::nullopt;
}
/*!
@@ -121,8 +72,9 @@ static inline qreal initialGlobalScaleFactor()
\brief Collection of utility functions for UI scaling.
QHighDpiScaling implements utility functions for high-dpi scaling for use
- on operating systems that provide limited support for native scaling. In
- addition this functionality can be used for simulation and testing purposes.
+ on operating systems that provide limited support for native scaling, such
+ as Windows, X11, and Android. In addition this functionality can be used
+ for simulation and testing purposes.
The functions support scaling between the device independent coordinate
system used by Qt applications and the native coordinate system used by
@@ -152,14 +104,13 @@ static inline qreal initialGlobalScaleFactor()
pixels.
The devicePixelRatio seen by applications is the product of the Qt scale
- factor and the OS scale factor. The value of the scale factors may be 1,
- in which case two or more of the coordinate systems are equivalent. Platforms
- that (may) have an OS scale factor include \macos, iOS and Wayland.
+ factor and the OS scale factor (see QWindow::devicePixelRatio()). The value
+ of the scale factors may be 1, in which case two or more of the coordinate
+ systems are equivalent. Platforms that (may) have an OS scale factor include
+ macOS, iOS, Wayland, and Web(Assembly).
- Note that the functions in this file do not work with the OS scale factor
- directly and are limited to converting between device independent and native
- pixels. The OS scale factor is accounted for by QWindow::devicePixelRatio()
- and similar functions.
+ Note that the API implemented in this file do use the OS scale factor, and
+ is used for converting between device independent and native pixels only.
Configuration Examples:
@@ -172,7 +123,7 @@ static inline qreal initialGlobalScaleFactor()
| Display 100 x 100 |
-----------------------------------------------------
- 'Retina Device': Device Independent Pixels = Native Pixels
+ '2x Apple Device': Device Independent Pixels = Native Pixels
--------------------------------------------------- devicePixelRatio: 2
| Application / Qt Gui 100 x 100 |
| | Qt Scale Factor: 1
@@ -181,7 +132,7 @@ static inline qreal initialGlobalScaleFactor()
| Display 200 x 200 |
-----------------------------------------------------
- '2x Qt Scaling': Native Pixels = Device Pixels
+ 'Windows at 200%': Native Pixels = Device Pixels
--------------------------------------------------- devicePixelRatio: 2
| Application / Qt Gui 100 x 100 |
|---------------------------------------------------| Qt Scale Factor: 2
@@ -190,112 +141,123 @@ static inline qreal initialGlobalScaleFactor()
| Display 200 x 200 |
-----------------------------------------------------
- The Qt Scale Factor is the product of two sub-scale factors, which
- are independently either set or determined by the platform plugin.
- Several APIs are offered for this, targeting both developers and
- end users. All scale factors are of type qreal.
-
- 1) A global scale factor
- The QT_SCALE_FACTOR environment variable can be used to set
- a global scale factor for all windows in the process. This
- is useful for testing and debugging (you can simulate any
- devicePixelRatio without needing access to special hardware),
- and perhaps also for targeting a specific application to
- a specific display type (embedded use cases).
-
- 2) Per-screen scale factors
- Some platform plugins support providing a per-screen scale
- factor based on display density information. These platforms
- include X11, Windows, and Android.
-
- There are two APIs for enabling or disabling this behavior:
- - The QT_AUTO_SCREEN_SCALE_FACTOR environment variable.
- - The AA_EnableHighDpiScaling and AA_DisableHighDpiScaling
- application attributes
-
- Enabling either will make QHighDpiScaling call QPlatformScreen::pixelDensity()
- and use the value provided as the scale factor for the screen in
- question. Disabling is done on a 'veto' basis where either the
- environment or the application can disable the scaling. The intended use
- cases are 'My system is not providing correct display density
- information' and 'My application needs to work in display pixels',
- respectively.
-
- The QT_SCREEN_SCALE_FACTORS environment variable can be used to set the screen
- scale factors manually. Set this to a semicolon-separated
- list of scale factors (matching the order of QGuiApplications::screens()),
- or to a list of name=value pairs (where name matches QScreen::name()).
-
- Coordinate conversion functions must be used when writing code that passes
- geometry across the Qt Gui / Platform plugin boundary. The main conversion
- functions are:
- T toNativePixels(T, QWindow *)
- T fromNativePixels(T, QWindow*)
-
- The following classes in QtGui use native pixels, for the convenience of the
- platform plugins:
- QPlatformWindow
- QPlatformScreen
- QWindowSystemInterface (API only - Events are in device independent pixels)
-
- As a special consideration platform plugin code should be careful about
- calling QtGui geometry accessor functions:
- QRect r = window->geometry();
- Here the returned geometry is in device independent pixels. Add a conversion call:
- QRect r = QHighDpi::toNativePixels(window->geometry());
- (Avoiding calling QWindow and instead using the QPlatformWindow geometry
- might be a better course of action in this case.)
+ * Configuration
+
+ - Enabling: In Qt 6, high-dpi scaling (the functionality implemented in this file)
+ is always enabled. The Qt scale factor value is typically determined by the
+ QPlatformScreen implementation - see below.
+
+ There is one environment variable based opt-out option: set QT_ENABLE_HIGHDPI_SCALING=0.
+ Keep in mind that this does not affect the OS scale factor, which is controlled by
+ the operating system.
+
+ - Qt scale factor value: The Qt scale factor is the product of the screen scale
+ factor and the global scale factor, which are independently either set or determined
+ by the platform plugin. Several APIs are offered for this, targeting both developers
+ and end users. All scale factors are of type qreal.
+
+ 1) Per-screen scale factors
+
+ Per-screen scale factors are computed based on logical DPI provided by
+ by the platform plugin.
+
+ The platform plugin implements DPI accessor functions:
+ QDpi QPlatformScreen::logicalDpi()
+ QDpi QPlatformScreen::logicalBaseDpi()
+
+ QHighDpiScaling then computes the per-screen scale factor as follows:
+
+ factor = logicalDpi / logicalBaseDpi
+
+ Alternatively, QT_SCREEN_SCALE_FACTORS can be used to set the screen
+ scale factors.
+
+ 2) The global scale factor
+
+ The QT_SCALE_FACTOR environment variable can be used to set a global scale
+ factor which applies to all application windows. This allows developing and
+ testing at any DPR, independently of available hardware and without changing
+ global desktop settings.
+
+ - Rounding
+
+ Qt 6 does not round scale factors by default. Qt 5 rounds the screen scale factor
+ to the nearest integer (except for Qt on Android which does not round).
+
+ The rounding policy can be set by the application, or on the environment:
+
+ Application (C++): QGuiApplication::setHighDpiScaleFactorRoundingPolicy()
+ User (environment): QT_SCALE_FACTOR_ROUNDING_POLICY
+
+ Note that the OS scale factor, and global scale factors set with QT_SCALE_FACTOR
+ are never rounded by Qt.
+
+ * C++ API Overview
+
+ - Coordinate Conversion ("scaling")
+
+ The QHighDpi namespace provides several functions for converting geometry
+ between the device independent and native coordinate systems. These should
+ be used when calling "QPlatform*" API from QtGui. Callers are responsible
+ for selecting a function variant based on geometry type:
+
+ Type From Native To Native
+ local : QHighDpi::fromNativeLocalPosition() QHighDpi::toNativeLocalPosition()
+ global (screen) : QHighDpi::fromNativeGlobalPosition() QHighDpi::toNativeGlobalPosition()
+ QWindow::geometry() : QHighDpi::fromNativeWindowGeometry() QHighDpi::toNativeWindowGeometry()
+ sizes, margins, etc : QHighDpi::fromNativePixels() QHighDpi::toNativePixels()
+
+ The conversion functions take two arguments; the geometry and a context:
+
+ QSize nativeSize = toNativePixels(deviceIndependentSize, window);
+
+ The context is usually a QWindow instance, but can also be a QScreen instance,
+ or the corresponding QPlatform classes.
+
+ - Activation
+
+ QHighDpiScaling::isActive() returns true iff
+ Qt high-dpi scaling is enabled (e.g. with AA_EnableHighDpiScaling) AND
+ there is a Qt scale factor != 1
+
+ (the value of the OS scale factor does not affect this API)
+
+ - Calling QtGui from the platform plugins
+
+ Platform plugin code should be careful about calling QtGui geometry accessor
+ functions like geometry():
+
+ QRect r = window->geometry();
+
+ In this case the returned geometry is in the wrong coordinate system (device independent
+ instead of native pixels). Fix this by adding a conversion call:
+
+ QRect r = QHighDpi::toNativeWindowGeometry(window->geometry());
+
+ (Also consider if the call to QtGui is really needed - prefer calling QPlatform* API.)
*/
qreal QHighDpiScaling::m_factor = 1.0;
bool QHighDpiScaling::m_active = false; //"overall active" - is there any scale factor set.
-bool QHighDpiScaling::m_usePixelDensity = false; // use scale factor from platform plugin
-bool QHighDpiScaling::m_pixelDensityScalingActive = false; // pixel density scale factor > 1
+bool QHighDpiScaling::m_usePlatformPluginDpi = false; // use scale factor based on platform plugin DPI
+bool QHighDpiScaling::m_platformPluginDpiScalingActive = false; // platform plugin DPI gives a scale factor > 1
bool QHighDpiScaling::m_globalScalingActive = false; // global scale factor is active
bool QHighDpiScaling::m_screenFactorSet = false; // QHighDpiScaling::setScreenFactor has been used
-
-/*
- Initializes the QHighDpiScaling global variables. Called before the
- platform plugin is created.
-*/
-
-static inline bool usePixelDensity()
-{
- // Determine if we should set a scale factor based on the pixel density
- // reported by the platform plugin. There are several enablers and several
- // disablers. A single disable may veto all other enablers.
-
- // First, check of there is an explicit disable.
- if (QCoreApplication::testAttribute(Qt::AA_DisableHighDpiScaling))
- return false;
- bool screenEnvValueOk;
- const int screenEnvValue = qEnvironmentVariableIntValue(legacyAutoScreenEnvVar, &screenEnvValueOk);
- if (screenEnvValueOk && screenEnvValue < 1)
- return false;
- bool enableEnvValueOk;
- const int enableEnvValue = qEnvironmentVariableIntValue(enableHighDpiScalingEnvVar, &enableEnvValueOk);
- if (enableEnvValueOk && enableEnvValue < 1)
- return false;
-
- // Then return if there was an enable.
- return QCoreApplication::testAttribute(Qt::AA_EnableHighDpiScaling)
- || (screenEnvValueOk && screenEnvValue > 0)
- || (enableEnvValueOk && enableEnvValue > 0)
- || (qEnvironmentVariableIsSet(legacyDevicePixelEnvVar)
- && qEnvironmentVariable(legacyDevicePixelEnvVar).compare(QLatin1String("auto"), Qt::CaseInsensitive) == 0);
-}
+bool QHighDpiScaling::m_usePhysicalDpi = false;
+QVector<QHighDpiScaling::ScreenFactor> QHighDpiScaling::m_screenFactors;
+QHighDpiScaling::DpiAdjustmentPolicy QHighDpiScaling::m_dpiAdjustmentPolicy = QHighDpiScaling::DpiAdjustmentPolicy::Unset;
+QHash<QString, qreal> QHighDpiScaling::m_namedScreenScaleFactors; // Per-screen scale factors (screen name -> factor)
qreal QHighDpiScaling::rawScaleFactor(const QPlatformScreen *screen)
{
- // Determine if physical DPI should be used
- static const bool usePhysicalDpi = qEnvironmentVariableAsBool(usePhysicalDpiEnvVar, false);
-
// Calculate scale factor beased on platform screen DPI values
qreal factor;
QDpi platformBaseDpi = screen->logicalBaseDpi();
- if (usePhysicalDpi) {
- qreal platformPhysicalDpi = screen->screen()->physicalDotsPerInch();
- factor = qreal(platformPhysicalDpi) / qreal(platformBaseDpi.first);
+ if (QHighDpiScaling::m_usePhysicalDpi) {
+ QSize sz = screen->geometry().size();
+ QSizeF psz = screen->physicalSize();
+ qreal platformPhysicalDpi = ((sz.height() / psz.height()) + (sz.width() / psz.width())) * qreal(25.4 * 0.5);
+ factor = qRound(platformPhysicalDpi) / qreal(platformBaseDpi.first);
} else {
const QDpi platformLogicalDpi = QPlatformScreen::overrideDpi(screen->logicalDpi());
factor = qreal(platformLogicalDpi.first) / qreal(platformBaseDpi.first);
@@ -375,32 +337,9 @@ qreal QHighDpiScaling::roundScaleFactor(qreal rawFactor)
// sizes that are smaller than the ideal size, and opposite for rounding up.
// Rounding down is then preferable since "small UI" is a more acceptable
// high-DPI experience than "large UI".
- static auto scaleFactorRoundingPolicy = Qt::HighDpiScaleFactorRoundingPolicy::Unset;
-
- // Determine rounding policy
- if (scaleFactorRoundingPolicy == Qt::HighDpiScaleFactorRoundingPolicy::Unset) {
- // Check environment
- if (qEnvironmentVariableIsSet(scaleFactorRoundingPolicyEnvVar)) {
- QByteArray policyText = qgetenv(scaleFactorRoundingPolicyEnvVar);
- auto policyEnumValue = lookupScaleFactorRoundingPolicy(policyText);
- if (policyEnumValue != Qt::HighDpiScaleFactorRoundingPolicy::Unset) {
- scaleFactorRoundingPolicy = policyEnumValue;
- } else {
- auto values = joinEnumValues(std::begin(scaleFactorRoundingPolicyLookup),
- std::end(scaleFactorRoundingPolicyLookup));
- qWarning("Unknown scale factor rounding policy: %s. Supported values are: %s.",
- policyText.constData(), values.constData());
- }
- }
- // Check application object if no environment value was set.
- if (scaleFactorRoundingPolicy == Qt::HighDpiScaleFactorRoundingPolicy::Unset) {
- scaleFactorRoundingPolicy = QGuiApplication::highDpiScaleFactorRoundingPolicy();
- } else {
- // Make application setting reflect environment
- QGuiApplication::setHighDpiScaleFactorRoundingPolicy(scaleFactorRoundingPolicy);
- }
- }
+ Qt::HighDpiScaleFactorRoundingPolicy scaleFactorRoundingPolicy =
+ QGuiApplication::highDpiScaleFactorRoundingPolicy();
// Apply rounding policy.
qreal roundedFactor = rawFactor;
@@ -424,11 +363,9 @@ qreal QHighDpiScaling::roundScaleFactor(qreal rawFactor)
break;
}
- // Don't round down to to zero; clamp the minimum (rounded) factor to 1.
- // This is not a common case but can happen if a display reports a very
- // low DPI.
- if (scaleFactorRoundingPolicy != Qt::HighDpiScaleFactorRoundingPolicy::PassThrough)
- roundedFactor = qMax(roundedFactor, qreal(1));
+ // Clamp the minimum factor to 1. Qt does not currently render
+ // correctly with factors less than 1.
+ roundedFactor = qMax(roundedFactor, qreal(1));
return roundedFactor;
}
@@ -442,100 +379,154 @@ QDpi QHighDpiScaling::effectiveLogicalDpi(const QPlatformScreen *screen, qreal r
// with the rest of the UI. The amount of out-of-synch-ness depends on how
// well user code handles a non-standard DPI values, but since the
// adjustment is small (typically +/- 48 max) this might be OK.
- static auto dpiAdjustmentPolicy = DpiAdjustmentPolicy::Unset;
-
- // Determine adjustment policy.
- if (dpiAdjustmentPolicy == DpiAdjustmentPolicy::Unset) {
- if (qEnvironmentVariableIsSet(dpiAdjustmentPolicyEnvVar)) {
- QByteArray policyText = qgetenv(dpiAdjustmentPolicyEnvVar);
- auto policyEnumValue = lookupDpiAdjustmentPolicy(policyText);
- if (policyEnumValue != DpiAdjustmentPolicy::Unset) {
- dpiAdjustmentPolicy = policyEnumValue;
- } else {
- auto values = joinEnumValues(std::begin(dpiAdjustmentPolicyLookup),
- std::end(dpiAdjustmentPolicyLookup));
- qWarning("Unknown DPI adjustment policy: %s. Supported values are: %s.",
- policyText.constData(), values.constData());
- }
- }
- if (dpiAdjustmentPolicy == DpiAdjustmentPolicy::Unset)
- dpiAdjustmentPolicy = DpiAdjustmentPolicy::UpOnly;
- }
// Apply adjustment policy.
const QDpi baseDpi = screen->logicalBaseDpi();
const qreal dpiAdjustmentFactor = rawFactor / roundedFactor;
// Return the base DPI for cases where there is no adjustment
- if (dpiAdjustmentPolicy == DpiAdjustmentPolicy::Disabled)
+ if (QHighDpiScaling::m_dpiAdjustmentPolicy == DpiAdjustmentPolicy::Disabled)
return baseDpi;
- if (dpiAdjustmentPolicy == DpiAdjustmentPolicy::UpOnly && dpiAdjustmentFactor < 1)
+ if (QHighDpiScaling::m_dpiAdjustmentPolicy == DpiAdjustmentPolicy::UpOnly && dpiAdjustmentFactor < 1)
return baseDpi;
return QDpi(baseDpi.first * dpiAdjustmentFactor, baseDpi.second * dpiAdjustmentFactor);
}
+/*
+ Determine and apply global/initial configuration which do not depend on
+ having access to QScreen objects - this function is called before they
+ have been created. Screen-dependent configuration happens later in
+ updateHighDpiScaling().
+*/
void QHighDpiScaling::initHighDpiScaling()
{
- // Determine if there is a global scale factor set.
- m_factor = initialGlobalScaleFactor();
+ qCDebug(lcHighDpi) << "Initializing high-DPI scaling";
+
+ // Read environment variables
+ static const char* envDebugStr = "environment variable set:";
+ std::optional<int> envEnableHighDpiScaling = qEnvironmentVariableOptionalInt(enableHighDpiScalingEnvVar);
+ if (envEnableHighDpiScaling.has_value())
+ qCDebug(lcHighDpi) << envDebugStr << enableHighDpiScalingEnvVar << envEnableHighDpiScaling.value();
+
+ std::optional<qreal> envScaleFactor = qEnvironmentVariableOptionalReal(scaleFactorEnvVar);
+ if (envScaleFactor.has_value())
+ qCDebug(lcHighDpi) << envDebugStr << scaleFactorEnvVar << envScaleFactor.value();
+
+ std::optional<QString> envScreenFactors = qEnvironmentVariableOptionalString(screenFactorsEnvVar);
+ if (envScreenFactors.has_value())
+ qCDebug(lcHighDpi) << envDebugStr << screenFactorsEnvVar << envScreenFactors.value();
+
+ std::optional<int> envUsePhysicalDpi = qEnvironmentVariableOptionalInt(usePhysicalDpiEnvVar);
+ if (envUsePhysicalDpi.has_value())
+ qCDebug(lcHighDpi) << envDebugStr << usePhysicalDpiEnvVar << envUsePhysicalDpi.value();
+
+ std::optional<QByteArray> envScaleFactorRoundingPolicy = qEnvironmentVariableOptionalByteArray(scaleFactorRoundingPolicyEnvVar);
+ if (envScaleFactorRoundingPolicy.has_value())
+ qCDebug(lcHighDpi) << envDebugStr << scaleFactorRoundingPolicyEnvVar << envScaleFactorRoundingPolicy.value();
+
+ std::optional<QByteArray> envDpiAdjustmentPolicy = qEnvironmentVariableOptionalByteArray(dpiAdjustmentPolicyEnvVar);
+ if (envDpiAdjustmentPolicy.has_value())
+ qCDebug(lcHighDpi) << envDebugStr << dpiAdjustmentPolicyEnvVar << envDpiAdjustmentPolicy.value();
+
+ // High-dpi scaling is enabled by default; check for global disable.
+ m_usePlatformPluginDpi = envEnableHighDpiScaling.value_or(1) > 0;
+ m_platformPluginDpiScalingActive = false; // see updateHighDpiScaling()
+
+ // Check for glabal scale factor (different from 1)
+ m_factor = envScaleFactor.value_or(qreal(1));
m_globalScalingActive = !qFuzzyCompare(m_factor, qreal(1));
- m_usePixelDensity = usePixelDensity();
+ // Store the envScreenFactors string for later use. The string format
+ // supports using screen names, which means that screen DPI cannot
+ // be resolved at this point.
+ QString screenFactorsSpec = envScreenFactors.value_or(QString());
+ m_screenFactors = parseScreenScaleFactorsSpec(QStringView{screenFactorsSpec});
+ m_namedScreenScaleFactors.clear();
+
+ m_usePhysicalDpi = envUsePhysicalDpi.value_or(0) > 0;
+
+ // Resolve HighDpiScaleFactorRoundingPolicy to QGuiApplication::highDpiScaleFactorRoundingPolicy
+ if (envScaleFactorRoundingPolicy.has_value()) {
+ QByteArray policyText = envScaleFactorRoundingPolicy.value();
+ auto policyEnumValue = lookupScaleFactorRoundingPolicy(policyText);
+ if (policyEnumValue != Qt::HighDpiScaleFactorRoundingPolicy::Unset) {
+ QGuiApplication::setHighDpiScaleFactorRoundingPolicy(policyEnumValue);
+ } else {
+ auto values = joinEnumValues(std::begin(scaleFactorRoundingPolicyLookup),
+ std::end(scaleFactorRoundingPolicyLookup));
+ qWarning("Unknown scale factor rounding policy: %s. Supported values are: %s.",
+ policyText.constData(), values.constData());
+ }
+ }
+
+ // Resolve DpiAdjustmentPolicy to m_dpiAdjustmentPolicy
+ if (envDpiAdjustmentPolicy.has_value()) {
+ QByteArray policyText = envDpiAdjustmentPolicy.value();
+ auto policyEnumValue = lookupDpiAdjustmentPolicy(policyText);
+ if (policyEnumValue != DpiAdjustmentPolicy::Unset) {
+ QHighDpiScaling::m_dpiAdjustmentPolicy = policyEnumValue;
+ } else {
+ auto values = joinEnumValues(std::begin(dpiAdjustmentPolicyLookup),
+ std::end(dpiAdjustmentPolicyLookup));
+ qWarning("Unknown DPI adjustment policy: %s. Supported values are: %s.",
+ policyText.constData(), values.constData());
+ }
+ }
- m_pixelDensityScalingActive = false; //set in updateHighDpiScaling below
+ // Set initial active state
+ m_active = m_globalScalingActive || m_usePlatformPluginDpi;
- m_active = m_globalScalingActive || m_usePixelDensity;
+ qCDebug(lcHighDpi) << "Initialization done, high-DPI scaling is"
+ << (m_active ? "active" : "inactive");
}
+/*
+ Update configuration based on available screens and screen properties.
+ This function may be called whenever the screen configuration changed.
+*/
void QHighDpiScaling::updateHighDpiScaling()
{
- if (QCoreApplication::testAttribute(Qt::AA_DisableHighDpiScaling))
- return;
+ qCDebug(lcHighDpi) << "Updating high-DPI scaling";
- if (m_usePixelDensity && !m_pixelDensityScalingActive) {
+ // Apply screen factors from environment
+ if (m_screenFactors.size() > 0) {
+ qCDebug(lcHighDpi) << "Applying screen factors" << m_screenFactors;
+ int i = -1;
const auto screens = QGuiApplication::screens();
- for (QScreen *screen : screens) {
- if (!qFuzzyCompare(screenSubfactor(screen->handle()), qreal(1))) {
- m_pixelDensityScalingActive = true;
- break;
+ for (const auto &[name, rawFactor]: m_screenFactors) {
+ const qreal factor = roundScaleFactor(rawFactor);
+ ++i;
+ if (name.isNull()) {
+ if (i < screens.size())
+ setScreenFactor(screens.at(i), factor);
+ } else {
+ for (QScreen *screen : screens) {
+ if (screen->name() == name) {
+ setScreenFactor(screen, factor);
+ break;
+ }
+ }
}
}
}
- if (qEnvironmentVariableIsSet(screenFactorsEnvVar)) {
- int i = 0;
- const QString spec = qEnvironmentVariable(screenFactorsEnvVar);
- const auto specs = spec.splitRef(QLatin1Char(';'));
- for (const QStringRef &spec : specs) {
- int equalsPos = spec.lastIndexOf(QLatin1Char('='));
- qreal factor = 0;
- if (equalsPos > 0) {
- // support "name=factor"
- bool ok;
- const auto name = spec.left(equalsPos);
- factor = spec.mid(equalsPos + 1).toDouble(&ok);
- if (ok && factor > 0 ) {
- const auto screens = QGuiApplication::screens();
- for (QScreen *s : screens) {
- if (s->name() == name) {
- setScreenFactor(s, factor);
- break;
- }
- }
- }
- } else {
- // listing screens in order
- bool ok;
- factor = spec.toDouble(&ok);
- if (ok && factor > 0 && i < QGuiApplication::screens().count()) {
- QScreen *screen = QGuiApplication::screens().at(i);
- setScreenFactor(screen, factor);
- }
+
+ // Check if any screens (now) has a scale factor != 1 and set
+ // m_platformPluginDpiScalingActive if so.
+ if (m_usePlatformPluginDpi && !m_platformPluginDpiScalingActive ) {
+ const auto screens = QGuiApplication::screens();
+ for (QScreen *screen : screens) {
+ if (!qFuzzyCompare(screenSubfactor(screen->handle()), qreal(1))) {
+ m_platformPluginDpiScalingActive = true;
+ break;
}
- ++i;
}
}
- m_active = m_globalScalingActive || m_screenFactorSet || m_usePixelDensity;
+
+ m_active = m_globalScalingActive || m_screenFactorSet || m_platformPluginDpiScalingActive;
+
+ qCDebug(lcHighDpi) << "Update done, high-DPI scaling is"
+ << (m_active ? "active" : "inactive");
}
/*
@@ -543,17 +534,24 @@ void QHighDpiScaling::updateHighDpiScaling()
*/
void QHighDpiScaling::setGlobalFactor(qreal factor)
{
+ qCDebug(lcHighDpi) << "Setting global scale factor to" << factor;
+
if (qFuzzyCompare(factor, m_factor))
return;
if (!QGuiApplication::allWindows().isEmpty())
qWarning("QHighDpiScaling::setFactor: Should only be called when no windows exist.");
+ const auto screens = QGuiApplication::screens();
+
+ std::vector<QScreenPrivate::UpdateEmitter> updateEmitters;
+ for (QScreen *screen : screens)
+ updateEmitters.emplace_back(screen);
+
m_globalScalingActive = !qFuzzyCompare(factor, qreal(1));
m_factor = m_globalScalingActive ? factor : qreal(1);
- m_active = m_globalScalingActive || m_screenFactorSet || m_pixelDensityScalingActive;
- const auto screens = QGuiApplication::screens();
+ m_active = m_globalScalingActive || m_screenFactorSet || m_platformPluginDpiScalingActive ;
for (QScreen *screen : screens)
- screen->d_func()->updateHighDpi();
+ screen->d_func()->updateGeometry();
}
static const char scaleFactorProperty[] = "_q_scaleFactor";
@@ -563,22 +561,24 @@ static const char scaleFactorProperty[] = "_q_scaleFactor";
*/
void QHighDpiScaling::setScreenFactor(QScreen *screen, qreal factor)
{
+ qCDebug(lcHighDpi) << "Setting screen scale factor for" << screen << "to" << factor;
+
if (!qFuzzyCompare(factor, qreal(1))) {
m_screenFactorSet = true;
m_active = true;
}
+ QScreenPrivate::UpdateEmitter updateEmitter(screen);
+
// Prefer associating the factor with screen name over the object
// since the screen object may be deleted on screen disconnects.
const QString name = screen->name();
if (name.isEmpty())
screen->setProperty(scaleFactorProperty, QVariant(factor));
else
- qNamedScreenScaleFactors()->insert(name, factor);
+ QHighDpiScaling::m_namedScreenScaleFactors.insert(name, factor);
- // hack to force re-evaluation of screen geometry
- if (screen->handle())
- screen->d_func()->setPlatformScreen(screen->handle()); // updates geometries based on scale factor
+ screen->d_func()->updateGeometry();
}
QPoint QHighDpiScaling::mapPositionToNative(const QPoint &pos, const QPlatformScreen *platformScreen)
@@ -599,46 +599,6 @@ QPoint QHighDpiScaling::mapPositionFromNative(const QPoint &pos, const QPlatform
return (pos - topLeft) / scaleFactor + topLeft;
}
-QPoint QHighDpiScaling::mapPositionToGlobal(const QPoint &pos, const QPoint &windowGlobalPosition, const QWindow *window)
-{
- QPoint globalPosCandidate = pos + windowGlobalPosition;
- if (QGuiApplicationPrivate::screen_list.size() <= 1)
- return globalPosCandidate;
-
- // The global position may be outside device independent screen geometry
- // in cases where a window spans screens. Detect this case and map via
- // native coordinates to the correct screen.
- auto currentScreen = window->screen();
- if (currentScreen && !currentScreen->geometry().contains(globalPosCandidate)) {
- auto nativeGlobalPos = QHighDpi::toNativePixels(globalPosCandidate, currentScreen);
- if (auto actualPlatformScreen = currentScreen->handle()->screenForPosition(nativeGlobalPos))
- return QHighDpi::fromNativePixels(nativeGlobalPos, actualPlatformScreen->screen());
- }
-
- return globalPosCandidate;
-}
-
-QPoint QHighDpiScaling::mapPositionFromGlobal(const QPoint &pos, const QPoint &windowGlobalPosition, const QWindow *window)
-{
- QPoint windowPosCandidate = pos - windowGlobalPosition;
- if (QGuiApplicationPrivate::screen_list.size() <= 1 || window->handle() == nullptr)
- return windowPosCandidate;
-
- // Device independent global (screen) space may discontiguous when high-dpi scaling
- // is active. This means that the normal subtracting of the window global position from the
- // position-to-be-mapped may not work in cases where a window spans multiple screens.
- // Map both positions to native global space (using the correct screens), subtract there,
- // and then map the difference back using the scale factor for the window.
- QScreen *posScreen = QGuiApplication::screenAt(pos);
- if (posScreen && posScreen != window->screen()) {
- QPoint nativePos = QHighDpi::toNativePixels(pos, posScreen);
- QPoint windowNativePos = window->handle()->geometry().topLeft();
- return QHighDpi::fromNativeLocalPosition(nativePos - windowNativePos, window);
- }
-
- return windowPosCandidate;
-}
-
qreal QHighDpiScaling::screenSubfactor(const QPlatformScreen *screen)
{
auto factor = qreal(1.0);
@@ -661,13 +621,13 @@ qreal QHighDpiScaling::screenSubfactor(const QPlatformScreen *screen)
}
if (!screenPropertyUsed) {
- auto byNameIt = qNamedScreenScaleFactors()->constFind(screen->name());
- if ((screenPropertyUsed = byNameIt != qNamedScreenScaleFactors()->cend()))
+ auto byNameIt = QHighDpiScaling::m_namedScreenScaleFactors.constFind(screen->name());
+ if ((screenPropertyUsed = byNameIt != QHighDpiScaling::m_namedScreenScaleFactors.cend()))
factor = *byNameIt;
}
}
- if (!screenPropertyUsed && m_usePixelDensity)
+ if (!screenPropertyUsed && m_usePlatformPluginDpi)
factor = roundScaleFactor(rawScaleFactor(screen));
return factor;
@@ -679,7 +639,7 @@ QDpi QHighDpiScaling::logicalDpi(const QScreen *screen)
if (!screen || !screen->handle())
return QDpi(96, 96);
- if (!m_usePixelDensity) {
+ if (!m_usePlatformPluginDpi) {
const qreal screenScaleFactor = screenSubfactor(screen->handle());
const QDpi dpi = QPlatformScreen::overrideDpi(screen->handle()->logicalDpi());
return QDpi{ dpi.first / screenScaleFactor, dpi.second / screenScaleFactor };
@@ -690,35 +650,140 @@ QDpi QHighDpiScaling::logicalDpi(const QScreen *screen)
return effectiveLogicalDpi(screen->handle(), scaleFactor, roundedScaleFactor);
}
-QHighDpiScaling::ScaleAndOrigin QHighDpiScaling::scaleAndOrigin(const QPlatformScreen *platformScreen, QPoint *nativePosition)
+// Returns the screen containing \a position, using \a guess as a starting point
+// for the search. \a guess might be nullptr. Returns nullptr if \a position is outside
+// of all screens.
+QScreen *QHighDpiScaling::screenForPosition(QHighDpiScaling::Point position, QScreen *guess)
{
+ if (position.kind == QHighDpiScaling::Point::Invalid)
+ return nullptr;
+
+ auto getPlatformScreenGuess = [](QScreen *maybeScreen) -> QPlatformScreen * {
+ if (maybeScreen)
+ return maybeScreen->handle();
+ if (QScreen *primary = QGuiApplication::primaryScreen())
+ return primary->handle();
+ return nullptr;
+ };
+
+ QPlatformScreen *platformGuess = getPlatformScreenGuess(guess);
+ if (!platformGuess)
+ return nullptr;
+
+ auto onScreen = [](QHighDpiScaling::Point position, const QPlatformScreen *platformScreen) -> bool {
+ return position.kind == Point::Native
+ ? platformScreen->geometry().contains(position.point)
+ : platformScreen->screen()->geometry().contains(position.point);
+ };
+
+ // is the guessed screen correct?
+ if (onScreen(position, platformGuess))
+ return platformGuess->screen();
+
+ // search sibling screens
+ const auto screens = platformGuess->virtualSiblings();
+ for (const QPlatformScreen *screen : screens) {
+ if (onScreen(position, screen))
+ return screen->screen();
+ }
+
+ return nullptr;
+}
+
+QVector<QHighDpiScaling::ScreenFactor> QHighDpiScaling::parseScreenScaleFactorsSpec(const QStringView &screenScaleFactors)
+{
+ QVector<QHighDpiScaling::ScreenFactor> screenFactors;
+
+ // The spec is _either_
+ // - a semicolon-separated ordered factor list: "1.5;2;3"
+ // - a semicolon-separated name=factor list: "foo=1.5;bar=2;baz=3"
+ const auto specs = screenScaleFactors.split(u';');
+ for (const auto &spec : specs) {
+ const qsizetype equalsPos = spec.lastIndexOf(u'=');
+ if (equalsPos == -1) {
+ // screens in order
+ bool ok;
+ const qreal factor = spec.toDouble(&ok);
+ if (ok && factor > 0) {
+ screenFactors.append(QHighDpiScaling::ScreenFactor(QString(), factor));
+ }
+ } else {
+ // "name=factor"
+ bool ok;
+ const qreal factor = spec.mid(equalsPos + 1).toDouble(&ok);
+ if (ok && factor > 0) {
+ screenFactors.append(QHighDpiScaling::ScreenFactor(spec.left(equalsPos).toString(), factor));
+ }
+ }
+ } // for (specs)
+
+ return screenFactors;
+}
+
+QHighDpiScaling::ScaleAndOrigin QHighDpiScaling::scaleAndOrigin(const QPlatformScreen *platformScreen, QHighDpiScaling::Point position)
+{
+ Q_UNUSED(position)
if (!m_active)
return { qreal(1), QPoint() };
if (!platformScreen)
return { m_factor, QPoint() }; // the global factor
- const QPlatformScreen *actualScreen = nativePosition ?
- platformScreen->screenForPosition(*nativePosition) : platformScreen;
- return { m_factor * screenSubfactor(actualScreen), actualScreen->geometry().topLeft() };
+ return { m_factor * screenSubfactor(platformScreen), platformScreen->geometry().topLeft() };
}
-QHighDpiScaling::ScaleAndOrigin QHighDpiScaling::scaleAndOrigin(const QScreen *screen, QPoint *nativePosition)
+QHighDpiScaling::ScaleAndOrigin QHighDpiScaling::scaleAndOrigin(const QScreen *screen, QHighDpiScaling::Point position)
{
+ Q_UNUSED(position)
if (!m_active)
return { qreal(1), QPoint() };
if (!screen)
return { m_factor, QPoint() }; // the global factor
- return scaleAndOrigin(screen->handle(), nativePosition);
+ return scaleAndOrigin(screen->handle(), position);
}
-QHighDpiScaling::ScaleAndOrigin QHighDpiScaling::scaleAndOrigin(const QWindow *window, QPoint *nativePosition)
+QHighDpiScaling::ScaleAndOrigin QHighDpiScaling::scaleAndOrigin(const QWindow *window, QHighDpiScaling::Point position)
{
if (!m_active)
return { qreal(1), QPoint() };
+ // Determine correct screen; use the screen which contains the given
+ // position if a valid position is passed.
QScreen *screen = window ? window->screen() : QGuiApplication::primaryScreen();
- const bool searchScreen = !window || window->isTopLevel();
- return scaleAndOrigin(screen, searchScreen ? nativePosition : nullptr);
+ QScreen *overrideScreen = QHighDpiScaling::screenForPosition(position, screen);
+ QScreen *targetScreen = overrideScreen ? overrideScreen : screen;
+ return scaleAndOrigin(targetScreen, position);
+}
+
+#ifndef QT_NO_DEBUG_STREAM
+QDebug operator<<(QDebug debug, const QHighDpiScaling::ScreenFactor &factor)
+{
+ const QDebugStateSaver saver(debug);
+ debug.nospace();
+ if (!factor.name.isEmpty())
+ debug << factor.name << "=";
+ debug << factor.factor;
+ return debug;
+}
+#endif
+
+#else // QT_NO_HIGHDPISCALING
+
+QHighDpiScaling::ScaleAndOrigin QHighDpiScaling::scaleAndOrigin(const QPlatformScreen *, QPoint *)
+{
+ return { qreal(1), QPoint() };
}
-#endif //QT_NO_HIGHDPISCALING
+QHighDpiScaling::ScaleAndOrigin QHighDpiScaling::scaleAndOrigin(const QScreen *, QPoint *)
+{
+ return { qreal(1), QPoint() };
+}
+
+QHighDpiScaling::ScaleAndOrigin QHighDpiScaling::scaleAndOrigin(const QWindow *, QPoint *)
+{
+ return { qreal(1), QPoint() };
+}
+
+#endif // QT_NO_HIGHDPISCALING
+
QT_END_NAMESPACE
+
+#include "moc_qhighdpiscaling_p.cpp"
diff --git a/src/gui/kernel/qhighdpiscaling_p.h b/src/gui/kernel/qhighdpiscaling_p.h
index 3c85481495..189f31fd0a 100644
--- a/src/gui/kernel/qhighdpiscaling_p.h
+++ b/src/gui/kernel/qhighdpiscaling_p.h
@@ -1,41 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the QtGui module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#ifndef QHIGHDPISCALING_P_H
#define QHIGHDPISCALING_P_H
@@ -52,11 +16,11 @@
//
#include <QtGui/private/qtguiglobal_p.h>
+#include <QtCore/qlist.h>
+#include <QtCore/qloggingcategory.h>
#include <QtCore/qmargins.h>
#include <QtCore/qmath.h>
#include <QtCore/qrect.h>
-#include <QtCore/qvector.h>
-#include <QtCore/qloggingcategory.h>
#include <QtGui/qregion.h>
#include <QtGui/qscreen.h>
#include <QtGui/qvector2d.h>
@@ -64,7 +28,7 @@
QT_BEGIN_NAMESPACE
-Q_DECLARE_LOGGING_CATEGORY(lcScaling);
+Q_DECLARE_LOGGING_CATEGORY(lcHighDpi);
class QScreen;
class QPlatformScreen;
@@ -96,45 +60,66 @@ public:
static bool isActive() { return m_active; }
+ struct Point {
+ enum Kind {
+ Invalid,
+ DeviceIndependent,
+ Native
+ };
+ Kind kind;
+ QPoint point;
+ };
+
struct ScaleAndOrigin
{
qreal factor;
QPoint origin;
};
- static ScaleAndOrigin scaleAndOrigin(const QPlatformScreen *platformScreen, QPoint *nativePosition = nullptr);
- static ScaleAndOrigin scaleAndOrigin(const QScreen *screen, QPoint *nativePosition = nullptr);
- static ScaleAndOrigin scaleAndOrigin(const QWindow *platformScreen, QPoint *nativePosition = nullptr);
+
+ static ScaleAndOrigin scaleAndOrigin(const QPlatformScreen *platformScreen, Point position = Point{ Point::Invalid, QPoint() });
+ static ScaleAndOrigin scaleAndOrigin(const QScreen *screen, Point position = Point{ Point::Invalid, QPoint() });
+ static ScaleAndOrigin scaleAndOrigin(const QWindow *platformScreen, Point position = Point{ Point::Invalid, QPoint() });
template<typename C>
- static qreal factor(C *context, QPoint *nativePosition = nullptr) {
- return scaleAndOrigin(context, nativePosition).factor;
+ static qreal factor(C *context) {
+ return scaleAndOrigin(context).factor;
}
static QPoint mapPositionFromNative(const QPoint &pos, const QPlatformScreen *platformScreen);
static QPoint mapPositionToNative(const QPoint &pos, const QPlatformScreen *platformScreen);
- static QPoint mapPositionToGlobal(const QPoint &pos, const QPoint &windowGlobalPosition, const QWindow *window);
- static QPoint mapPositionFromGlobal(const QPoint &pos, const QPoint &windowGlobalPosition, const QWindow *window);
static QDpi logicalDpi(const QScreen *screen);
+ static qreal roundScaleFactor(qreal rawFactor);
private:
+ struct ScreenFactor {
+ ScreenFactor(QString name, qreal factor)
+ :name(name), factor(factor) { }
+ QString name;
+ qreal factor;
+ };
+
static qreal rawScaleFactor(const QPlatformScreen *screen);
- static qreal roundScaleFactor(qreal rawFactor);
static QDpi effectiveLogicalDpi(const QPlatformScreen *screen, qreal rawFactor, qreal roundedFactor);
static qreal screenSubfactor(const QPlatformScreen *screen);
+ static QScreen *screenForPosition(Point position, QScreen *guess);
+ static QVector<QHighDpiScaling::ScreenFactor> parseScreenScaleFactorsSpec(const QStringView &screenScaleFactors);
static qreal m_factor;
static bool m_active;
- static bool m_usePixelDensity;
+ static bool m_usePlatformPluginDpi;
+ static bool m_platformPluginDpiScalingActive;
static bool m_globalScalingActive;
- static bool m_pixelDensityScalingActive;
static bool m_screenFactorSet;
- static QDpi m_logicalDpi;
+ static bool m_usePhysicalDpi;
+ static QVector<ScreenFactor> m_screenFactors;
+ static DpiAdjustmentPolicy m_dpiAdjustmentPolicy;
+ static QHash<QString, qreal> m_namedScreenScaleFactors;
+
+#ifndef QT_NO_DEBUG_STREAM
+ friend Q_GUI_EXPORT QDebug operator<<(QDebug, const ScreenFactor &);
+#endif
};
-// Coordinate system conversion functions:
-// QHighDpi::fromNativePixels : from physical(screen/backing) to logical pixels
-// QHighDpi::toNativePixels : from logical to physical pixels
-
namespace QHighDpi {
inline qreal scale(qreal value, qreal scaleFactor, QPointF /* origin */ = QPointF(0, 0))
@@ -179,20 +164,20 @@ inline QRectF scale(const QRectF &rect, qreal scaleFactor, QPoint origin = QPoin
inline QMargins scale(const QMargins &margins, qreal scaleFactor, QPoint origin = QPoint(0, 0))
{
- Q_UNUSED(origin)
+ Q_UNUSED(origin);
return QMargins(qRound(qreal(margins.left()) * scaleFactor), qRound(qreal(margins.top()) * scaleFactor),
qRound(qreal(margins.right()) * scaleFactor), qRound(qreal(margins.bottom()) * scaleFactor));
}
-template <typename T>
-QVector<T> scale(const QVector<T> &vector, qreal scaleFactor, QPoint origin = QPoint(0, 0))
+template<typename T>
+QList<T> scale(const QList<T> &list, qreal scaleFactor, QPoint origin = QPoint(0, 0))
{
if (!QHighDpiScaling::isActive())
- return vector;
+ return list;
- QVector<T> scaled;
- scaled.reserve(vector.size());
- for (const T &item : vector)
+ QList<T> scaled;
+ scaled.reserve(list.size());
+ for (const T &item : list)
scaled.append(scale(item, scaleFactor, origin));
return scaled;
}
@@ -202,24 +187,32 @@ inline QRegion scale(const QRegion &region, qreal scaleFactor, QPoint origin = Q
if (!QHighDpiScaling::isActive())
return region;
- QRegion scaled;
- for (const QRect &rect : region)
- scaled += scale(rect, scaleFactor, origin);
- return scaled;
+ QRegion scaled = region.translated(-origin);
+ scaled = QTransform::fromScale(scaleFactor, scaleFactor).map(scaled);
+ return scaled.translated(origin);
}
template <typename T>
-inline QPoint position(T) { return QPoint(); }
-inline QPoint position(QPoint point) { return point; }
-inline QPoint position(QPointF point) { return point.toPoint(); }
-inline QPoint position(QRect rect) { return rect.center(); }
-inline QPoint position(QRectF rect) { return rect.center().toPoint(); }
+inline QHighDpiScaling::Point position(T, QHighDpiScaling::Point::Kind) {
+ return QHighDpiScaling::Point{ QHighDpiScaling::Point::Invalid, QPoint() };
+}
+inline QHighDpiScaling::Point position(QPoint point, QHighDpiScaling::Point::Kind kind) {
+ return QHighDpiScaling::Point{ kind, point };
+}
+inline QHighDpiScaling::Point position(QPointF point, QHighDpiScaling::Point::Kind kind) {
+ return QHighDpiScaling::Point{ kind, point.toPoint() };
+}
+inline QHighDpiScaling::Point position(QRect rect, QHighDpiScaling::Point::Kind kind) {
+ return QHighDpiScaling::Point{ kind, rect.topLeft() };
+}
+inline QHighDpiScaling::Point position(QRectF rect, QHighDpiScaling::Point::Kind kind) {
+ return QHighDpiScaling::Point{ kind, rect.topLeft().toPoint() };
+}
template <typename T, typename C>
T fromNativePixels(const T &value, const C *context)
{
- QPoint nativePosition = position(value);
- QHighDpiScaling::ScaleAndOrigin so = QHighDpiScaling::scaleAndOrigin(context, &nativePosition);
+ QHighDpiScaling::ScaleAndOrigin so = QHighDpiScaling::scaleAndOrigin(context);
return scale(value, qreal(1) / so.factor, so.origin);
}
@@ -242,6 +235,38 @@ T toNativeLocalPosition(const T &value, const C *context)
return scale(value, QHighDpiScaling::factor(context));
}
+template <typename T, typename C>
+T fromNativeGlobalPosition(const T &value, const C *context)
+{
+ QHighDpiScaling::ScaleAndOrigin so =
+ QHighDpiScaling::scaleAndOrigin(context, position(value, QHighDpiScaling::Point::Native));
+ return scale(value, qreal(1) / so.factor, so.origin);
+}
+
+template <typename T, typename C>
+T toNativeGlobalPosition(const T &value, const C *context)
+{
+ QHighDpiScaling::ScaleAndOrigin so =
+ QHighDpiScaling::scaleAndOrigin(context, position(value, QHighDpiScaling::Point::DeviceIndependent));
+ return scale(value, so.factor, so.origin);
+}
+
+template <typename T, typename C>
+T fromNativeWindowGeometry(const T &value, const C *context)
+{
+ QHighDpiScaling::ScaleAndOrigin so = QHighDpiScaling::scaleAndOrigin(context);
+ QPoint effectiveOrigin = (context && context->isTopLevel()) ? so.origin : QPoint(0,0);
+ return scale(value, qreal(1) / so.factor, effectiveOrigin);
+}
+
+template <typename T, typename C>
+T toNativeWindowGeometry(const T &value, const C *context)
+{
+ QHighDpiScaling::ScaleAndOrigin so = QHighDpiScaling::scaleAndOrigin(context);
+ QPoint effectiveOrigin = (context && context->isTopLevel()) ? so.origin : QPoint(0,0);
+ return scale(value, so.factor, effectiveOrigin);
+}
+
template <typename T>
inline T fromNative(const T &value, qreal scaleFactor, QPoint origin = QPoint(0, 0))
{
@@ -279,13 +304,9 @@ inline QRegion fromNativeLocalExposedRegion(const QRegion &pixelRegion, const QW
const qreal scaleFactor = QHighDpiScaling::factor(window);
QRegion pointRegion;
- for (const QRectF &rect : pixelRegion) {
- const QPointF topLeftP = rect.topLeft() / scaleFactor;
- const QSizeF sizeP = rect.size() / scaleFactor;
- pointRegion += QRect(QPoint(qFloor(topLeftP.x()), qFloor(topLeftP.y())),
- QPoint(qCeil(topLeftP.x() + sizeP.width() - 1.0),
- qCeil(topLeftP.y() + sizeP.height() - 1.0)));
- }
+ for (const QRectF rect: pixelRegion)
+ pointRegion += QRectF(rect.topLeft() / scaleFactor, rect.size() / scaleFactor).toAlignedRect();
+
return pointRegion;
}
@@ -303,6 +324,15 @@ public:
static inline void setGlobalFactor(qreal) {}
static inline void setScreenFactor(QScreen *, qreal) {}
+ struct ScaleAndOrigin
+ {
+ qreal factor;
+ QPoint origin;
+ };
+ static ScaleAndOrigin scaleAndOrigin(const QPlatformScreen *platformScreen, QPoint *nativePosition = nullptr);
+ static ScaleAndOrigin scaleAndOrigin(const QScreen *screen, QPoint *nativePosition = nullptr);
+ static ScaleAndOrigin scaleAndOrigin(const QWindow *platformScreen, QPoint *nativePosition = nullptr);
+
static inline bool isActive() { return false; }
static inline qreal factor(const QWindow *) { return 1.0; }
static inline qreal factor(const QScreen *) { return 1.0; }
@@ -311,13 +341,16 @@ public:
static inline QPoint origin(const QPlatformScreen *) { return QPoint(); }
static inline QPoint mapPositionFromNative(const QPoint &pos, const QPlatformScreen *) { return pos; }
static inline QPoint mapPositionToNative(const QPoint &pos, const QPlatformScreen *) { return pos; }
- static inline QPoint mapPositionToGlobal(const QPoint &pos, const QPoint &windowGlobalPosition, const QWindow *window) { return pos; }
- static inline QPoint mapPositionFromGlobal(const QPoint &pos, const QPoint &windowGlobalPosition, const QWindow *window) { return pos; }
- static inline QDpi logicalDpi(const QScreen *screen) { return QDpi(-1,-1); }
+ static inline QPointF mapPositionToGlobal(const QPointF &pos, const QPoint &, const QWindow *) { return pos; }
+ static inline QPointF mapPositionFromGlobal(const QPointF &pos, const QPoint &, const QWindow *) { return pos; }
+ static inline QDpi logicalDpi(const QScreen *) { return QDpi(-1,-1); }
};
namespace QHighDpi {
template <typename T> inline
+ T scale(const T &value, ...) { return value; }
+
+ template <typename T> inline
T toNative(const T &value, ...) { return value; }
template <typename T> inline
T fromNative(const T &value, ...) { return value; }
@@ -326,6 +359,14 @@ namespace QHighDpi {
T fromNativeLocalPosition(const T &value, ...) { return value; }
template <typename T> inline
T toNativeLocalPosition(const T &value, ...) { return value; }
+ template <typename T, typename C> inline
+ T fromNativeGlobalPosition(const T &value, const C *) { return value; }
+ template <typename T, typename C> inline
+ T toNativeGlobalPosition(const T &value, const C *) { return value; }
+ template <typename T, typename C> inline
+ T fromNativeWindowGeometry(const T &value, const C *) { return value; }
+ template <typename T, typename C> inline
+ T toNativeWindowGeometry(const T &value, const C *) { return value; }
template <typename T> inline
T fromNativeLocalRegion(const T &value, ...) { return value; }
diff --git a/src/gui/kernel/qinputdevice.cpp b/src/gui/kernel/qinputdevice.cpp
new file mode 100644
index 0000000000..f7b216dcf0
--- /dev/null
+++ b/src/gui/kernel/qinputdevice.cpp
@@ -0,0 +1,395 @@
+// Copyright (C) 2020 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
+
+#include "qinputdevice.h"
+#include "qinputdevice_p.h"
+#include "qpointingdevice.h"
+#include "qwindowsysteminterface_p.h"
+#include <QCoreApplication>
+#include <QDebug>
+#include <QMutex>
+#include <QScreen>
+
+QT_BEGIN_NAMESPACE
+
+using namespace Qt::StringLiterals;
+
+/*!
+ \class QInputDevice
+ \brief The QInputDevice class describes a device from which a QInputEvent originates.
+ \since 6.0
+ \inmodule QtGui
+
+ Each QInputEvent contains a QInputDevice pointer to allow accessing
+ device-specific properties like type, capabilities and seat. It is the
+ responsibility of the platform or generic plug-ins to discover, create and
+ register an instance of this class corresponding to each available input
+ device, via QWindowSystemInterface::registerInputDevice(), before
+ generating any input event referring to that device.
+
+ Applications do not need to instantiate this class, but can read the
+ instances pointed to by QInputEvent::device() and QInputDevice::devices().
+*/
+
+/*!
+ \enum QInputDevice::Capability
+
+ Indicates what kind of information the input device or its driver can
+ provide.
+
+ \value None
+ No information about input device capabilities available.
+
+ \value Position
+ Indicates that position information is available, meaning that the
+ position() family of functions in the touch points return valid points.
+
+ \value Area
+ Indicates that touch area information is available, meaning that
+ QEventPoint::ellipseDiameters() in the touch points return valid
+ values.
+
+ \value Pressure
+ Indicates that pressure information is available, meaning that
+ QEventPoint::pressure() returns a valid value.
+
+ \value Velocity
+ Indicates that velocity information is available, meaning that
+ QEventPoint::velocity() returns a valid vector.
+
+ \value NormalizedPosition
+ Indicates that the normalized position is available, meaning that
+ QEventPoint::globalPosition() returns a valid value.
+
+ \value MouseEmulation
+ Indicates that the device synthesizes mouse events.
+
+ \value Scroll
+ Indicates that the device has a scroll capability.
+
+ \value [since 6.2] PixelScroll
+ Indicates that the device (usually a
+ \l {QInputDevice::DeviceType::TouchPad}{touchpad})
+ scrolls with \l {QWheelEvent::pixelDelta()}{pixel precision}.
+
+ \value Hover
+ Indicates that the device has a hover capability.
+
+ \value Rotation
+ Indicates that \l {QEventPoint::}{rotation} information is available.
+
+ \value XTilt
+ Indicates that \l {QTabletEvent::xTilt()}{tilt} information is
+ available for the X-axis.
+
+ \value YTilt
+ Indicates that \l {QTabletEvent::yTilt()}{tilt} information is
+ available for the Y-axis.
+
+ \value TangentialPressure
+ Indicates that \l {QTabletEvent::tangentialPressure()}
+ {tangential pressure} information is available.
+
+ \value ZPosition
+ Indicates that position information for the \l {QTabletEvent::z()}
+ {Z-axis} is available.
+
+ \value All
+*/
+
+/*!
+ Creates a new invalid input device instance as a child of \a parent.
+*/
+QInputDevice::QInputDevice(QObject *parent)
+ : QObject(*(new QInputDevicePrivate(QString(), -1, QInputDevice::DeviceType::Unknown)), parent)
+{
+}
+
+QInputDevice::~QInputDevice()
+{
+ QInputDevicePrivate::unregisterDevice(this);
+}
+
+/*!
+ Creates a new input device instance. The given \a name is normally a
+ manufacturer-assigned model name if available, or something else
+ identifiable; \a id is a platform-specific number that will be unique per
+ device (for example the xinput ID on X11); \a type identifies what kind of
+ device. On window systems that are capable of handling input from multiple
+ users or sets of input devices at the same time (such as Wayland or X11),
+ \a seatName identifies the name of the set of devices that will be used
+ together. If the device is a child or slave device (for example one of
+ several mice that can take turns moving the "core pointer"), the master
+ device should be given as the \a parent.
+
+ The platform plugin creates, registers and continues to own each device
+ instance; usually \a parent should be given for memory management purposes
+ even if there is no master for a particular device.
+
+ By default, capabilities() are \c None.
+*/
+QInputDevice::QInputDevice(const QString &name, qint64 id, QInputDevice::DeviceType type,
+ const QString &seatName, QObject *parent)
+ : QObject(*new QInputDevicePrivate(name, id, type, QInputDevice::Capability::None, seatName), parent)
+{
+}
+
+/*!
+ \internal
+*/
+QInputDevice::QInputDevice(QInputDevicePrivate &d, QObject *parent)
+ : QObject(d, parent)
+{
+}
+
+/*!
+ Returns the region within the \l{QScreen::availableVirtualGeometry}{virtual desktop}
+ that this device can access.
+
+ For example a \l {QInputDevice::DeviceType}{TouchScreen} input
+ device is fixed in place upon a single physical screen, and usually
+ calibrated so that this area is the same as QScreen::geometry(); whereas a
+ \l {QInputDevice::DeviceType}{Mouse} can probably access all screens
+ on the virtual desktop. A Wacom graphics tablet may be configured in a way
+ that it's mapped to all screens, or only to the screen where the user
+ prefers to create drawings, or to the window in which drawing occurs.
+ A \l {QInputDevice::DeviceType}{Stylus} device that is integrated
+ with a touchscreen may be physically limited to that screen.
+
+ If the returned rectangle is \l {QRect::isNull()}{null}, it means this device
+ can access the entire virtual desktop.
+*/
+QRect QInputDevice::availableVirtualGeometry() const
+{
+ Q_D(const QInputDevice);
+ return d->availableVirtualGeometry;
+}
+
+/*!
+ Returns the device name.
+
+ This string may be empty. It is however useful on systems that have
+ multiple input devices: it can be used to differentiate from which device a
+ QPointerEvent originates.
+*/
+QString QInputDevice::name() const
+{
+ Q_D(const QInputDevice);
+ return d->name;
+}
+
+/*!
+ Returns the device type.
+*/
+QInputDevice::DeviceType QInputDevice::type() const
+{
+ Q_D(const QInputDevice);
+ return d->deviceType;
+}
+
+/*!
+ Returns the device capabilities.
+*/
+QInputDevice::Capabilities QInputDevice::capabilities() const
+{
+ Q_D(const QInputDevice);
+ return QInputDevice::Capabilities(d->capabilities);
+}
+
+/*!
+ Returns whether the device capabilities include the given \a capability.
+*/
+bool QInputDevice::hasCapability(QInputDevice::Capability capability) const
+{
+ return capabilities().testFlag(capability);
+}
+
+/*!
+ Returns the platform specific system ID (for example xinput ID on the X11 platform).
+
+ All platforms are expected to provide a unique system ID for each device.
+*/
+qint64 QInputDevice::systemId() const
+{
+ Q_D(const QInputDevice);
+ return d->systemId;
+}
+
+/*!
+ Returns the seat with which the device is associated, if known; otherwise empty.
+
+ Devices that are intended to be used together by one user may be configured
+ to have the same seat name. That is only possible on Wayland and X11
+ platforms so far.
+*/
+QString QInputDevice::seatName() const
+{
+ Q_D(const QInputDevice);
+ return d->seatName;
+}
+
+using InputDevicesList = QList<const QInputDevice *>;
+Q_GLOBAL_STATIC(InputDevicesList, deviceList)
+Q_CONSTINIT static QBasicMutex devicesMutex;
+
+/*!
+ Returns a list of all registered input devices (keyboards and pointing devices).
+
+ \note The list of devices is not always complete on all platforms. So far,
+ the most-complete information is available on the \l {Qt for Linux/X11}{X11}
+ platform, at startup and in response to hot-plugging. Most other platforms
+ are only able to provide generic devices of various types, only after receiving
+ events from them; and most platforms do not tell Qt when a device is plugged in,
+ or when it is unplugged at runtime.
+
+ \note The returned list cannot be used to add new devices. To add a simulated
+ touch screen for an autotest, QTest::createTouchDevice() can be used.
+ Platform plugins should call QWindowSystemInterface::registerInputDevice()
+ to add devices as they are discovered.
+*/
+QList<const QInputDevice *> QInputDevice::devices()
+{
+ QMutexLocker lock(&devicesMutex);
+ return *deviceList();
+}
+
+/*!
+ \since 6.3
+
+ Returns a list of seat names for all registered input devices (keyboards and pointing devices).
+*/
+QStringList QInputDevice::seatNames()
+{
+ QMutexLocker locker(&devicesMutex);
+ const InputDevicesList devices = *deviceList();
+ locker.unlock();
+ QStringList result;
+ for (const QInputDevice *d : devices) {
+ if (!result.contains(d->seatName()))
+ result.append(d->seatName());
+ }
+
+ return result;
+}
+
+/*!
+ Returns the core or master keyboard on the given seat \a seatName.
+*/
+const QInputDevice *QInputDevice::primaryKeyboard(const QString& seatName)
+{
+ QMutexLocker locker(&devicesMutex);
+ const InputDevicesList devices = *deviceList();
+ locker.unlock();
+ const QInputDevice *ret = nullptr;
+ for (const QInputDevice *d : devices) {
+ if (d->type() != DeviceType::Keyboard)
+ continue;
+ if (seatName.isNull() || d->seatName() == seatName) {
+ // the master keyboard's parent is not another input device
+ if (!d->parent() || !qobject_cast<const QInputDevice *>(d->parent()))
+ return d;
+ if (!ret)
+ ret = d;
+ }
+ }
+ if (!ret) {
+ qCDebug(lcQpaInputDevices) << "no keyboards registered for seat" << seatName
+ << "The platform plugin should have provided one via "
+ "QWindowSystemInterface::registerInputDevice(). Creating a default one for now.";
+ ret = new QInputDevice("core keyboard"_L1, 0, DeviceType::Keyboard, seatName, QCoreApplication::instance());
+ QInputDevicePrivate::registerDevice(ret);
+ return ret;
+ }
+ qWarning() << "core keyboard ambiguous for seat" << seatName;
+ return ret;
+}
+
+QInputDevicePrivate::~QInputDevicePrivate()
+ = default;
+
+/*!
+ \internal
+ Checks whether a matching device is already registered
+ (via operator==, not pointer equality).
+*/
+bool QInputDevicePrivate::isRegistered(const QInputDevice *dev)
+{
+ if (!dev)
+ return false;
+ QMutexLocker locker(&devicesMutex);
+ InputDevicesList v = *deviceList();
+ for (const QInputDevice *d : v)
+ if (d && *d == *dev)
+ return true;
+ return false;
+}
+
+/*!
+ \internal
+ Find the device with the given \a systemId (for example the xinput
+ device ID on X11), which is expected to be unique if nonzero.
+
+ If the \a systemId is not unique, this function returns the first one found.
+
+ \note Use QInputDevicePrivate::queryTabletDevice() if the device is a
+ tablet or a tablet stylus; in that case, \a id is not unique.
+*/
+const QInputDevice *QInputDevicePrivate::fromId(qint64 systemId)
+{
+ QMutexLocker locker(&devicesMutex);
+ for (const QInputDevice *dev : *deviceList()) {
+ if (dev->systemId() == systemId)
+ return dev;
+ }
+ return nullptr;
+}
+
+void QInputDevicePrivate::registerDevice(const QInputDevice *dev)
+{
+ QMutexLocker lock(&devicesMutex);
+ deviceList()->append(dev);
+}
+
+/*!
+ \internal
+*/
+void QInputDevicePrivate::unregisterDevice(const QInputDevice *dev)
+{
+ QMutexLocker lock(&devicesMutex);
+ deviceList()->removeOne(dev);
+}
+
+bool QInputDevice::operator==(const QInputDevice &other) const
+{
+ return systemId() == other.systemId();
+}
+
+#ifndef QT_NO_DEBUG_STREAM
+QDebug operator<<(QDebug debug, const QInputDevice *device)
+{
+ QDebugStateSaver saver(debug);
+ debug.nospace();
+ debug.noquote();
+
+ debug << "QInputDevice(";
+ if (!device) {
+ debug << "0)";
+ return debug;
+ }
+
+ const QInputDevicePrivate *d = QInputDevicePrivate::get(device);
+
+ if (d->pointingDeviceType)
+ return operator<<(debug, static_cast<const QPointingDevice *>(device));
+
+ debug << "QInputDevice(";
+ debug << '"' << device->name() << "\", type=" << device->type()
+ << ", ID=" << device->systemId() << ", seat='" << device->seatName() << "'";
+ debug << ')';
+ return debug;
+}
+#endif // !QT_NO_DEBUG_STREAM
+
+QT_END_NAMESPACE
+
+#include "moc_qinputdevice.cpp"
diff --git a/src/gui/kernel/qinputdevice.h b/src/gui/kernel/qinputdevice.h
new file mode 100644
index 0000000000..2b7ce32d86
--- /dev/null
+++ b/src/gui/kernel/qinputdevice.h
@@ -0,0 +1,101 @@
+// Copyright (C) 2020 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
+
+#ifndef QINPUTDEVICE_H
+#define QINPUTDEVICE_H
+
+#include <QtGui/qtguiglobal.h>
+#include <QtCore/qobject.h>
+#include <QtGui/qscreen.h>
+
+QT_BEGIN_NAMESPACE
+
+class QDebug;
+class QInputDevicePrivate;
+
+class Q_GUI_EXPORT QInputDevice : public QObject
+{
+ Q_OBJECT
+ Q_DECLARE_PRIVATE(QInputDevice)
+ Q_PROPERTY(QString name READ name CONSTANT)
+ Q_PROPERTY(DeviceType type READ type CONSTANT)
+ Q_PROPERTY(Capabilities capabilities READ capabilities CONSTANT)
+ Q_PROPERTY(qint64 systemId READ systemId CONSTANT)
+ Q_PROPERTY(QString seatName READ seatName CONSTANT)
+ Q_PROPERTY(QRect availableVirtualGeometry READ availableVirtualGeometry
+ NOTIFY availableVirtualGeometryChanged)
+
+public:
+ enum class DeviceType {
+ Unknown = 0x0000,
+ Mouse = 0x0001,
+ TouchScreen = 0x0002,
+ TouchPad = 0x0004,
+ Puck = 0x0008,
+ Stylus = 0x0010,
+ Airbrush = 0x0020,
+ Keyboard = 0x1000,
+ AllDevices = 0x7FFFFFFF
+ };
+ Q_DECLARE_FLAGS(DeviceTypes, DeviceType)
+ Q_FLAG(DeviceTypes)
+
+ enum class Capability {
+ None = 0,
+ Position = 0x0001,
+ Area = 0x0002,
+ Pressure = 0x0004,
+ Velocity = 0x0008,
+ NormalizedPosition = 0x0020,
+ MouseEmulation = 0x0040,
+ PixelScroll = 0x0080,
+ Scroll = 0x0100,
+ Hover = 0x0200,
+ Rotation = 0x0400,
+ XTilt = 0x0800,
+ YTilt = 0x1000,
+ TangentialPressure = 0x2000,
+ ZPosition = 0x4000,
+ All = 0x7FFFFFFF
+ };
+ Q_DECLARE_FLAGS(Capabilities, Capability)
+ Q_FLAG(Capabilities)
+
+ QInputDevice(QObject *parent = nullptr);
+ ~QInputDevice();
+ QInputDevice(const QString &name, qint64 systemId, DeviceType type,
+ const QString &seatName = QString(), QObject *parent = nullptr);
+
+ QString name() const;
+ DeviceType type() const;
+ Capabilities capabilities() const;
+ bool hasCapability(Capability cap) const;
+ qint64 systemId() const;
+ QString seatName() const;
+ QRect availableVirtualGeometry() const;
+
+ static QStringList seatNames();
+ static QList<const QInputDevice *> devices();
+ static const QInputDevice *primaryKeyboard(const QString& seatName = QString());
+
+ bool operator==(const QInputDevice &other) const;
+
+Q_SIGNALS:
+ void availableVirtualGeometryChanged(QRect area);
+
+protected:
+ QInputDevice(QInputDevicePrivate &d, QObject *parent);
+
+ Q_DISABLE_COPY_MOVE(QInputDevice)
+};
+
+Q_DECLARE_OPERATORS_FOR_FLAGS(QInputDevice::DeviceTypes)
+Q_DECLARE_OPERATORS_FOR_FLAGS(QInputDevice::Capabilities)
+
+#ifndef QT_NO_DEBUG_STREAM
+Q_GUI_EXPORT QDebug operator<<(QDebug, const QInputDevice *);
+#endif
+
+QT_END_NAMESPACE
+
+#endif // QINPUTDEVICE_H
diff --git a/src/gui/kernel/qinputdevice_p.h b/src/gui/kernel/qinputdevice_p.h
new file mode 100644
index 0000000000..7f6ee258be
--- /dev/null
+++ b/src/gui/kernel/qinputdevice_p.h
@@ -0,0 +1,81 @@
+// Copyright (C) 2020 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
+
+#ifndef QINPUTDEVICE_P_H
+#define QINPUTDEVICE_P_H
+
+//
+// W A R N I N G
+// -------------
+//
+// This file is not part of the Qt API. It exists purely as an
+// implementation detail. This header file may change from version to
+// version without notice, or even be removed.
+//
+// We mean it.
+//
+
+#include <QtGui/private/qtguiglobal_p.h>
+#include <QtGui/qinputdevice.h>
+#include "private/qobject_p.h"
+
+QT_BEGIN_NAMESPACE
+
+class Q_GUI_EXPORT QInputDevicePrivate : public QObjectPrivate
+{
+ Q_DECLARE_PUBLIC(QInputDevice)
+public:
+ QInputDevicePrivate(const QString &name, qint64 winSysId, QInputDevice::DeviceType type,
+ QInputDevice::Capabilities caps = QInputDevice::Capability::None,
+ const QString &seatName = QString())
+ : name(name), seatName(seatName), systemId(winSysId), capabilities(caps),
+ deviceType(type)
+ {
+ // if the platform doesn't provide device IDs, make one up,
+ // but try to avoid clashing with OS-provided 32-bit IDs
+ static qint64 nextId = qint64(1) << 33;
+ if (!systemId)
+ systemId = nextId++;
+ }
+ ~QInputDevicePrivate() override;
+
+ QString name;
+ QString seatName;
+ QString busId;
+ QRect availableVirtualGeometry;
+ void *qqExtra = nullptr; // Qt Quick can store arbitrary device-specific data here
+ qint64 systemId = 0;
+ QInputDevice::Capabilities capabilities = QInputDevice::Capability::None;
+ QInputDevice::DeviceType deviceType = QInputDevice::DeviceType::Unknown;
+ bool pointingDeviceType = false;
+
+ static void registerDevice(const QInputDevice *dev);
+ static void unregisterDevice(const QInputDevice *dev);
+ static bool isRegistered(const QInputDevice *dev);
+ static const QInputDevice *fromId(qint64 systemId);
+
+ void setAvailableVirtualGeometry(QRect a)
+ {
+ if (a == availableVirtualGeometry)
+ return;
+
+ availableVirtualGeometry = a;
+ capabilities |= QInputDevice::Capability::NormalizedPosition;
+ Q_Q(QInputDevice);
+ Q_EMIT q->availableVirtualGeometryChanged(availableVirtualGeometry);
+ }
+
+ inline static QInputDevicePrivate *get(QInputDevice *q)
+ {
+ return static_cast<QInputDevicePrivate *>(QObjectPrivate::get(q));
+ }
+
+ inline static const QInputDevicePrivate *get(const QInputDevice *q)
+ {
+ return static_cast<const QInputDevicePrivate *>(QObjectPrivate::get(q));
+ }
+};
+
+QT_END_NAMESPACE
+
+#endif // QINPUTDEVICE_P_H
diff --git a/src/gui/kernel/qinputdevicemanager.cpp b/src/gui/kernel/qinputdevicemanager.cpp
index 11442407e1..72af92cf17 100644
--- a/src/gui/kernel/qinputdevicemanager.cpp
+++ b/src/gui/kernel/qinputdevicemanager.cpp
@@ -1,47 +1,13 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the QtGui module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#include "qinputdevicemanager_p.h"
#include "qinputdevicemanager_p_p.h"
QT_BEGIN_NAMESPACE
+QT_IMPL_METATYPE_EXTERN_TAGGED(QInputDeviceManager::DeviceType, QInputDeviceManager__DeviceType)
+
/*!
\class QInputDeviceManager
\internal
@@ -67,6 +33,8 @@ QInputDeviceManager::QInputDeviceManager(QObject *parent)
qRegisterMetaType<DeviceType>();
}
+QInputDeviceManager::~QInputDeviceManager() = default;
+
int QInputDeviceManager::deviceCount(DeviceType type) const
{
Q_D(const QInputDeviceManager);
@@ -116,3 +84,5 @@ void QInputDeviceManager::setKeyboardModifiers(Qt::KeyboardModifiers mods)
}
QT_END_NAMESPACE
+
+#include "moc_qinputdevicemanager_p.cpp"
diff --git a/src/gui/kernel/qinputdevicemanager_p.h b/src/gui/kernel/qinputdevicemanager_p.h
index 1d20b102e3..9c34ece555 100644
--- a/src/gui/kernel/qinputdevicemanager_p.h
+++ b/src/gui/kernel/qinputdevicemanager_p.h
@@ -1,41 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the QtGui module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#ifndef QINPUTDEVICEMANAGER_P_H
#define QINPUTDEVICEMANAGER_P_H
@@ -74,7 +38,8 @@ public:
NumDeviceTypes
};
- QInputDeviceManager(QObject *parent = nullptr);
+ explicit QInputDeviceManager(QObject *parent = nullptr);
+ ~QInputDeviceManager() override;
int deviceCount(DeviceType type) const;
@@ -83,13 +48,14 @@ public:
Qt::KeyboardModifiers keyboardModifiers() const;
void setKeyboardModifiers(Qt::KeyboardModifiers mods);
-signals:
+Q_SIGNALS:
void deviceListChanged(QInputDeviceManager::DeviceType type);
void cursorPositionChangeRequested(const QPoint &pos);
};
QT_END_NAMESPACE
-Q_DECLARE_METATYPE(QInputDeviceManager::DeviceType)
+QT_DECL_METATYPE_EXTERN_TAGGED(QInputDeviceManager::DeviceType,
+ QInputDeviceManager__DeviceType, Q_GUI_EXPORT)
#endif // QINPUTDEVICEMANAGER_P_H
diff --git a/src/gui/kernel/qinputdevicemanager_p_p.h b/src/gui/kernel/qinputdevicemanager_p_p.h
index 871f9315c3..b43904aa67 100644
--- a/src/gui/kernel/qinputdevicemanager_p_p.h
+++ b/src/gui/kernel/qinputdevicemanager_p_p.h
@@ -1,41 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the QtGui module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#ifndef QINPUTDEVICEMANAGER_P_P_H
#define QINPUTDEVICEMANAGER_P_P_H
@@ -69,7 +33,7 @@ public:
int deviceCount(QInputDeviceManager::DeviceType type) const;
void setDeviceCount(QInputDeviceManager::DeviceType type, int count);
- std::array<int, QInputDeviceManager::NumDeviceTypes> m_deviceCount;
+ std::array<int, QInputDeviceManager::NumDeviceTypes> m_deviceCount = {};
Qt::KeyboardModifiers keyboardModifiers;
};
diff --git a/src/gui/kernel/qinputmethod.cpp b/src/gui/kernel/qinputmethod.cpp
index a319529442..e37e85e246 100644
--- a/src/gui/kernel/qinputmethod.cpp
+++ b/src/gui/kernel/qinputmethod.cpp
@@ -1,41 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the QtGui module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#include <qinputmethod.h>
#include <private/qinputmethod_p.h>
@@ -419,20 +383,28 @@ bool QInputMethodPrivate::objectAcceptsInputMethod(QObject *object)
/*!
Send \a query to the current focus object with parameters \a argument and return the result.
*/
-QVariant QInputMethod::queryFocusObject(Qt::InputMethodQuery query, QVariant argument)
+QVariant QInputMethod::queryFocusObject(Qt::InputMethodQuery query, const QVariant &argument)
{
QVariant retval;
QObject *focusObject = qGuiApp->focusObject();
if (!focusObject)
return retval;
- bool newMethodWorks = QMetaObject::invokeMethod(focusObject, "inputMethodQuery",
- Qt::DirectConnection,
- Q_RETURN_ARG(QVariant, retval),
- Q_ARG(Qt::InputMethodQuery, query),
- Q_ARG(QVariant, argument));
- if (newMethodWorks)
- return retval;
+ static const char *signature = "inputMethodQuery(Qt::InputMethodQuery,QVariant)";
+ const bool newMethodSupported = focusObject->metaObject()->indexOfMethod(signature) != -1;
+ if (newMethodSupported) {
+ const bool ok = QMetaObject::invokeMethod(focusObject, "inputMethodQuery",
+ Qt::DirectConnection,
+ Q_RETURN_ARG(QVariant, retval),
+ Q_ARG(Qt::InputMethodQuery, query),
+ Q_ARG(QVariant, argument));
+ Q_ASSERT(ok);
+ if (retval.isValid())
+ return retval;
+
+ // If the new API didn't have an answer to the query, we fall
+ // back to use the old event-based API.
+ }
QInputMethodQueryEvent queryEvent(query);
QCoreApplication::sendEvent(focusObject, &queryEvent);
diff --git a/src/gui/kernel/qinputmethod.h b/src/gui/kernel/qinputmethod.h
index efdefb6e5a..dfddc9b7c7 100644
--- a/src/gui/kernel/qinputmethod.h
+++ b/src/gui/kernel/qinputmethod.h
@@ -1,41 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the QtGui module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#ifndef QINPUTMETHOD_H
#define QINPUTMETHOD_H
@@ -58,7 +22,8 @@ class Q_GUI_EXPORT QInputMethod : public QObject
Q_PROPERTY(QRectF cursorRectangle READ cursorRectangle NOTIFY cursorRectangleChanged)
Q_PROPERTY(QRectF anchorRectangle READ anchorRectangle NOTIFY anchorRectangleChanged)
Q_PROPERTY(QRectF keyboardRectangle READ keyboardRectangle NOTIFY keyboardRectangleChanged)
- Q_PROPERTY(QRectF inputItemClipRectangle READ inputItemClipRectangle NOTIFY inputItemClipRectangleChanged)
+ Q_PROPERTY(QRectF inputItemClipRectangle READ inputItemClipRectangle
+ NOTIFY inputItemClipRectangleChanged)
Q_PROPERTY(bool visible READ isVisible NOTIFY visibleChanged)
Q_PROPERTY(bool animating READ isAnimating NOTIFY animatingChanged)
Q_PROPERTY(QLocale locale READ locale NOTIFY localeChanged)
@@ -94,7 +59,7 @@ public:
QLocale locale() const;
Qt::LayoutDirection inputDirection() const;
- static QVariant queryFocusObject(Qt::InputMethodQuery query, QVariant argument); // ### Qt 6: QVariant by const-ref
+ static QVariant queryFocusObject(Qt::InputMethodQuery query, const QVariant &argument);
public Q_SLOTS:
void show();
diff --git a/src/gui/kernel/qinputmethod_p.h b/src/gui/kernel/qinputmethod_p.h
index 5657edeb4e..9191813b44 100644
--- a/src/gui/kernel/qinputmethod_p.h
+++ b/src/gui/kernel/qinputmethod_p.h
@@ -1,41 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the QtGui module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#ifndef QINPUTMETHOD_P_H
#define QINPUTMETHOD_P_H
diff --git a/src/gui/kernel/qinternalmimedata.cpp b/src/gui/kernel/qinternalmimedata.cpp
index 8f4da1afb5..d33402703e 100644
--- a/src/gui/kernel/qinternalmimedata.cpp
+++ b/src/gui/kernel/qinternalmimedata.cpp
@@ -1,41 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2018 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the QtGui module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2018 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#include "qinternalmimedata_p.h"
@@ -46,15 +10,17 @@
QT_BEGIN_NAMESPACE
+using namespace Qt::StringLiterals;
+
static QStringList imageMimeFormats(const QList<QByteArray> &imageFormats)
{
QStringList formats;
formats.reserve(imageFormats.size());
for (const auto &format : imageFormats)
- formats.append(QLatin1String("image/") + QLatin1String(format.toLower()));
+ formats.append("image/"_L1 + QLatin1StringView(format.toLower()));
//put png at the front because it is best
- int pngIndex = formats.indexOf(QLatin1String("image/png"));
+ const qsizetype pngIndex = formats.indexOf("image/png"_L1);
if (pngIndex != -1 && pngIndex != 0)
formats.move(pngIndex, 0);
@@ -83,7 +49,7 @@ QInternalMimeData::~QInternalMimeData()
bool QInternalMimeData::hasFormat(const QString &mimeType) const
{
bool foundFormat = hasFormat_sys(mimeType);
- if (!foundFormat && mimeType == QLatin1String("application/x-qt-image")) {
+ if (!foundFormat && mimeType == "application/x-qt-image"_L1) {
QStringList imageFormats = imageReadMimeFormats();
for (int i = 0; i < imageFormats.size(); ++i) {
if ((foundFormat = hasFormat_sys(imageFormats.at(i))))
@@ -96,11 +62,11 @@ bool QInternalMimeData::hasFormat(const QString &mimeType) const
QStringList QInternalMimeData::formats() const
{
QStringList realFormats = formats_sys();
- if (!realFormats.contains(QLatin1String("application/x-qt-image"))) {
+ if (!realFormats.contains("application/x-qt-image"_L1)) {
QStringList imageFormats = imageReadMimeFormats();
for (int i = 0; i < imageFormats.size(); ++i) {
if (realFormats.contains(imageFormats.at(i))) {
- realFormats += QLatin1String("application/x-qt-image");
+ realFormats += "application/x-qt-image"_L1;
break;
}
}
@@ -108,26 +74,27 @@ QStringList QInternalMimeData::formats() const
return realFormats;
}
-QVariant QInternalMimeData::retrieveData(const QString &mimeType, QVariant::Type type) const
+QVariant QInternalMimeData::retrieveData(const QString &mimeType, QMetaType type) const
{
QVariant data = retrieveData_sys(mimeType, type);
- if (mimeType == QLatin1String("application/x-qt-image")) {
- if (data.isNull() || (data.type() == QVariant::ByteArray && data.toByteArray().isEmpty())) {
+ if (mimeType == "application/x-qt-image"_L1) {
+ if (data.isNull() || (data.metaType().id() == QMetaType::QByteArray && data.toByteArray().isEmpty())) {
// try to find an image
QStringList imageFormats = imageReadMimeFormats();
for (int i = 0; i < imageFormats.size(); ++i) {
data = retrieveData_sys(imageFormats.at(i), type);
- if (data.isNull() || (data.type() == QVariant::ByteArray && data.toByteArray().isEmpty()))
+ if (data.isNull() || (data.metaType().id() == QMetaType::QByteArray && data.toByteArray().isEmpty()))
continue;
break;
}
}
+ int typeId = type.id();
// we wanted some image type, but all we got was a byte array. Convert it to an image.
- if (data.type() == QVariant::ByteArray
- && (type == QVariant::Image || type == QVariant::Pixmap || type == QVariant::Bitmap))
+ if (data.metaType().id() == QMetaType::QByteArray
+ && (typeId == QMetaType::QImage || typeId == QMetaType::QPixmap || typeId == QMetaType::QBitmap))
data = QImage::fromData(data.toByteArray());
- } else if (mimeType == QLatin1String("application/x-color") && data.type() == QVariant::ByteArray) {
+ } else if (mimeType == "application/x-color"_L1 && data.metaType().id() == QMetaType::QByteArray) {
QColor c;
QByteArray ba = data.toByteArray();
if (ba.size() == 8) {
@@ -140,7 +107,7 @@ QVariant QInternalMimeData::retrieveData(const QString &mimeType, QVariant::Type
} else {
qWarning("Qt: Invalid color format");
}
- } else if (data.type() != type && data.type() == QVariant::ByteArray) {
+ } else if (data.metaType() != type && data.metaType().id() == QMetaType::QByteArray) {
// try to use mime data's internal conversion stuf.
QInternalMimeData *that = const_cast<QInternalMimeData *>(this);
that->setData(mimeType, data.toByteArray());
@@ -159,7 +126,7 @@ bool QInternalMimeData::canReadData(const QString &mimeType)
QStringList QInternalMimeData::formatsHelper(const QMimeData *data)
{
QStringList realFormats = data->formats();
- if (realFormats.contains(QLatin1String("application/x-qt-image"))) {
+ if (realFormats.contains("application/x-qt-image"_L1)) {
// add all supported image formats
QStringList imageFormats = imageWriteMimeFormats();
for (int i = 0; i < imageFormats.size(); ++i) {
@@ -175,14 +142,14 @@ bool QInternalMimeData::hasFormatHelper(const QString &mimeType, const QMimeData
bool foundFormat = data->hasFormat(mimeType);
if (!foundFormat) {
- if (mimeType == QLatin1String("application/x-qt-image")) {
+ if (mimeType == "application/x-qt-image"_L1) {
// check all supported image formats
QStringList imageFormats = imageWriteMimeFormats();
for (int i = 0; i < imageFormats.size(); ++i) {
if ((foundFormat = data->hasFormat(imageFormats.at(i))))
break;
}
- } else if (mimeType.startsWith(QLatin1String("image/"))) {
+ } else if (mimeType.startsWith("image/"_L1)) {
return data->hasImage() && imageWriteMimeFormats().contains(mimeType);
}
}
@@ -192,7 +159,7 @@ bool QInternalMimeData::hasFormatHelper(const QString &mimeType, const QMimeData
QByteArray QInternalMimeData::renderDataHelper(const QString &mimeType, const QMimeData *data)
{
QByteArray ba;
- if (mimeType == QLatin1String("application/x-color")) {
+ if (mimeType == "application/x-color"_L1) {
/* QMimeData can only provide colors as QColor or the name
of a color as a QByteArray or a QString. So we need to do
the conversion to application/x-color here.
@@ -214,17 +181,17 @@ QByteArray QInternalMimeData::renderDataHelper(const QString &mimeType, const QM
} else {
ba = data->data(mimeType);
if (ba.isEmpty()) {
- if (mimeType == QLatin1String("application/x-qt-image") && data->hasImage()) {
+ if (mimeType == "application/x-qt-image"_L1 && data->hasImage()) {
QImage image = qvariant_cast<QImage>(data->imageData());
QBuffer buf(&ba);
buf.open(QBuffer::WriteOnly);
// would there not be PNG ??
image.save(&buf, "PNG");
- } else if (mimeType.startsWith(QLatin1String("image/")) && data->hasImage()) {
+ } else if (mimeType.startsWith("image/"_L1) && data->hasImage()) {
QImage image = qvariant_cast<QImage>(data->imageData());
QBuffer buf(&ba);
buf.open(QBuffer::WriteOnly);
- image.save(&buf, mimeType.mid(mimeType.indexOf(QLatin1Char('/')) + 1).toLatin1().toUpper());
+ image.save(&buf, mimeType.mid(mimeType.indexOf(u'/') + 1).toLatin1().toUpper());
}
}
}
@@ -232,3 +199,5 @@ QByteArray QInternalMimeData::renderDataHelper(const QString &mimeType, const QM
}
QT_END_NAMESPACE
+
+#include "moc_qinternalmimedata_p.cpp"
diff --git a/src/gui/kernel/qinternalmimedata_p.h b/src/gui/kernel/qinternalmimedata_p.h
index aa5e896323..ce4cfaa72d 100644
--- a/src/gui/kernel/qinternalmimedata_p.h
+++ b/src/gui/kernel/qinternalmimedata_p.h
@@ -1,41 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2018 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the QtGui module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2018 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#ifndef QINTERNALMIMEDATA_P_H
#define QINTERNALMIMEDATA_P_H
@@ -81,11 +45,11 @@ public:
static QByteArray renderDataHelper(const QString &mimeType, const QMimeData *data);
protected:
- QVariant retrieveData(const QString &mimeType, QVariant::Type type) const override;
+ QVariant retrieveData(const QString &mimeType, QMetaType type) const override;
virtual bool hasFormat_sys(const QString &mimeType) const = 0;
virtual QStringList formats_sys() const = 0;
- virtual QVariant retrieveData_sys(const QString &mimeType, QVariant::Type type) const = 0;
+ virtual QVariant retrieveData_sys(const QString &mimeType, QMetaType type) const = 0;
};
QT_END_NAMESPACE
diff --git a/src/gui/kernel/qkeymapper.cpp b/src/gui/kernel/qkeymapper.cpp
index 274574f561..4ceb508465 100644
--- a/src/gui/kernel/qkeymapper.cpp
+++ b/src/gui/kernel/qkeymapper.cpp
@@ -1,41 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the QtGui module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#include "qguiapplication.h"
@@ -45,6 +9,7 @@
#include <private/qguiapplication_p.h>
#include <qpa/qplatformintegration.h>
+#include <qpa/qplatformkeymapper.h>
QT_BEGIN_NAMESPACE
@@ -59,8 +24,7 @@ QT_BEGIN_NAMESPACE
/*!
Constructs a new key mapper.
*/
-QKeyMapper::QKeyMapper()
- : QObject(*new QKeyMapperPrivate, nullptr)
+QKeyMapper::QKeyMapper() : QObject()
{
}
@@ -71,36 +35,34 @@ QKeyMapper::~QKeyMapper()
{
}
-QList<int> QKeyMapper::possibleKeys(QKeyEvent *e)
+QList<QKeyCombination> QKeyMapper::possibleKeys(const QKeyEvent *e)
{
- QList<int> result;
+ qCDebug(lcQpaKeyMapper).verbosity(3) << "Computing possible key combinations for" << e;
- if (!e->nativeScanCode()) {
+ const auto *platformIntegration = QGuiApplicationPrivate::platformIntegration();
+ const auto *platformKeyMapper = platformIntegration->keyMapper();
+ QList<QKeyCombination> result = platformKeyMapper->possibleKeyCombinations(e);
+
+ if (result.isEmpty()) {
if (e->key() && (e->key() != Qt::Key_unknown))
- result << int(e->key() + e->modifiers());
+ result << e->keyCombination();
else if (!e->text().isEmpty())
- result << int(e->text().at(0).unicode() + e->modifiers());
- return result;
+ result << (Qt::Key(e->text().at(0).unicode()) | e->modifiers());
}
- return instance()->d_func()->possibleKeys(e);
-}
-
-extern bool qt_sendSpontaneousEvent(QObject *receiver, QEvent *event); // in qapplication_*.cpp
-void QKeyMapper::changeKeyboard()
-{
- instance()->d_func()->clearMappings();
-
- // ## TODO: Support KeyboardLayoutChange on QPA
-#if 0
- // inform all toplevel widgets of the change
- QEvent e(QEvent::KeyboardLayoutChange);
- QWidgetList list = QApplication::topLevelWidgets();
- for (int i = 0; i < list.size(); ++i) {
- QWidget *w = list.at(i);
- qt_sendSpontaneousEvent(w, &e);
+#if QT_CONFIG(shortcut)
+ if (lcQpaKeyMapper().isDebugEnabled()) {
+ qCDebug(lcQpaKeyMapper) << "Resulting possible key combinations:";
+ for (auto keyCombination : result) {
+ auto keySequence = QKeySequence(keyCombination);
+ qCDebug(lcQpaKeyMapper).verbosity(0) << "\t-"
+ << keyCombination << "/" << keySequence << "/"
+ << qUtf8Printable(keySequence.toString(QKeySequence::NativeText));
+ }
}
#endif
+
+ return result;
}
Q_GLOBAL_STATIC(QKeyMapper, keymapper)
@@ -113,37 +75,18 @@ QKeyMapper *QKeyMapper::instance()
return keymapper();
}
-QKeyMapperPrivate *qt_keymapper_private()
+void *QKeyMapper::resolveInterface(const char *name, int revision) const
{
- return QKeyMapper::instance()->d_func();
-}
-
-QKeyMapperPrivate::QKeyMapperPrivate()
-{
- keyboardInputLocale = QLocale::system();
- keyboardInputDirection = keyboardInputLocale.textDirection();
-}
+ Q_UNUSED(name); Q_UNUSED(revision);
+ using namespace QNativeInterface::Private;
-QKeyMapperPrivate::~QKeyMapperPrivate()
-{
- // clearMappings();
-}
-
-void QKeyMapperPrivate::clearMappings()
-{
-}
+#if QT_CONFIG(evdev)
+ QT_NATIVE_INTERFACE_RETURN_IF(QEvdevKeyMapper, QGuiApplicationPrivate::platformIntegration());
+#endif
-QList<int> QKeyMapperPrivate::possibleKeys(QKeyEvent *e)
-{
- QList<int> result = QGuiApplicationPrivate::platformIntegration()->possibleKeys(e);
- if (!result.isEmpty())
- return result;
-
- if (e->key() && (e->key() != Qt::Key_unknown))
- result << int(e->key() + e->modifiers());
- else if (!e->text().isEmpty())
- result << int(e->text().at(0).unicode() + e->modifiers());
- return result;
+ return nullptr;
}
QT_END_NAMESPACE
+
+#include "moc_qkeymapper_p.cpp"
diff --git a/src/gui/kernel/qkeymapper_p.h b/src/gui/kernel/qkeymapper_p.h
index fd53747fdd..1a6a9a608f 100644
--- a/src/gui/kernel/qkeymapper_p.h
+++ b/src/gui/kernel/qkeymapper_p.h
@@ -1,41 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the QtGui module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#ifndef QKEYMAPPER_P_H
#define QKEYMAPPER_P_H
@@ -57,10 +21,10 @@
#include <qlocale.h>
#include <qevent.h>
+#include <QtCore/qnativeinterface.h>
QT_BEGIN_NAMESPACE
-class QKeyMapperPrivate;
class Q_GUI_EXPORT QKeyMapper : public QObject
{
Q_OBJECT
@@ -69,33 +33,29 @@ public:
~QKeyMapper();
static QKeyMapper *instance();
- static void changeKeyboard();
- static QList<int> possibleKeys(QKeyEvent *e);
+ static QList<QKeyCombination> possibleKeys(const QKeyEvent *e);
+
+ QT_DECLARE_NATIVE_INTERFACE_ACCESSOR(QKeyMapper)
private:
- friend QKeyMapperPrivate *qt_keymapper_private();
- Q_DECLARE_PRIVATE(QKeyMapper)
Q_DISABLE_COPY_MOVE(QKeyMapper)
};
-struct KeyboardLayoutItem;
-class QKeyEvent;
-
-class QKeyMapperPrivate : public QObjectPrivate
-{
- Q_DECLARE_PUBLIC(QKeyMapper)
-public:
- QKeyMapperPrivate();
- ~QKeyMapperPrivate();
+// ----------------- QNativeInterface -----------------
- void clearMappings();
- QList<int> possibleKeys(QKeyEvent *e);
+namespace QNativeInterface::Private {
- QLocale keyboardInputLocale;
- Qt::LayoutDirection keyboardInputDirection;
+#if QT_CONFIG(evdev) || defined(Q_QDOC)
+struct Q_GUI_EXPORT QEvdevKeyMapper
+{
+ QT_DECLARE_NATIVE_INTERFACE(QEvdevKeyMapper, 1, QKeyMapper)
+ virtual void loadKeymap(const QString &filename) = 0;
+ virtual void switchLang() = 0;
};
+#endif
+
+} // QNativeInterface::Private
-QKeyMapperPrivate *qt_keymapper_private(); // from qkeymapper.cpp
QT_END_NAMESPACE
diff --git a/src/gui/kernel/qkeysequence.cpp b/src/gui/kernel/qkeysequence.cpp
index d5bdf1f15b..0529d940d2 100644
--- a/src/gui/kernel/qkeysequence.cpp
+++ b/src/gui/kernel/qkeysequence.cpp
@@ -1,41 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the QtGui module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#include "qkeysequence.h"
#include "qkeysequence_p.h"
@@ -49,30 +13,32 @@
#endif
#include "qvariant.h"
-#if defined(Q_OS_MACX)
+#if defined(Q_OS_APPLE)
#include <QtCore/private/qcore_mac_p.h>
#endif
#include <algorithm>
+#include <q20algorithm.h>
QT_BEGIN_NAMESPACE
-#if defined(Q_OS_MACOS) || defined(Q_CLANG_QDOC)
-static bool qt_sequence_no_mnemonics = true;
-struct MacSpecialKey {
+using namespace Qt::StringLiterals;
+
+#if defined(Q_OS_APPLE) || defined(Q_QDOC)
+Q_CONSTINIT static bool qt_sequence_no_mnemonics = true;
+struct AppleSpecialKey {
int key;
- ushort macSymbol;
+ ushort appleSymbol;
};
// Unicode code points for the glyphs associated with these keys
// Defined by Carbon headers but not anywhere in Cocoa
-static const int kShiftUnicode = 0x21E7;
-static const int kControlUnicode = 0x2303;
-static const int kOptionUnicode = 0x2325;
-static const int kCommandUnicode = 0x2318;
+static constexpr int kShiftUnicode = 0x21E7;
+static constexpr int kControlUnicode = 0x2303;
+static constexpr int kOptionUnicode = 0x2325;
+static constexpr int kCommandUnicode = 0x2318;
-static const int NumEntries = 21;
-static const MacSpecialKey entries[NumEntries] = {
+static constexpr AppleSpecialKey entries[] = {
{ Qt::Key_Escape, 0x238B },
{ Qt::Key_Tab, 0x21E5 },
{ Qt::Key_Backtab, 0x21E4 },
@@ -80,6 +46,7 @@ static const MacSpecialKey entries[NumEntries] = {
{ Qt::Key_Return, 0x21B5 },
{ Qt::Key_Enter, 0x2324 },
{ Qt::Key_Delete, 0x2326 },
+ { Qt::Key_Clear, 0x2327 },
{ Qt::Key_Home, 0x2196 },
{ Qt::Key_End, 0x2198 },
{ Qt::Key_Left, 0x2190 },
@@ -93,43 +60,48 @@ static const MacSpecialKey entries[NumEntries] = {
{ Qt::Key_Meta, kControlUnicode },
{ Qt::Key_Alt, kOptionUnicode },
{ Qt::Key_CapsLock, 0x21EA },
+ { Qt::Key_Eject, 0x23CF },
};
-static bool operator<(const MacSpecialKey &entry, int key)
+static constexpr bool operator<(const AppleSpecialKey &lhs, const AppleSpecialKey &rhs)
{
- return entry.key < key;
+ return lhs.key < rhs.key;
}
-static bool operator<(int key, const MacSpecialKey &entry)
+static constexpr bool operator<(const AppleSpecialKey &lhs, int rhs)
{
- return key < entry.key;
+ return lhs.key < rhs;
}
-static const MacSpecialKey * const MacSpecialKeyEntriesEnd = entries + NumEntries;
+static constexpr bool operator<(int lhs, const AppleSpecialKey &rhs)
+{
+ return lhs < rhs.key;
+}
-QChar qt_macSymbolForQtKey(int key)
+static_assert(q20::is_sorted(std::begin(entries), std::end(entries)));
+
+static QChar appleSymbolForQtKey(int key)
{
- const MacSpecialKey *i = std::lower_bound(entries, MacSpecialKeyEntriesEnd, key);
- if ((i == MacSpecialKeyEntriesEnd) || (key < *i))
+ const auto i = std::lower_bound(std::begin(entries), std::end(entries), key);
+ if (i == std::end(entries) || key < *i)
return QChar();
- ushort macSymbol = i->macSymbol;
+ ushort appleSymbol = i->appleSymbol;
if (qApp->testAttribute(Qt::AA_MacDontSwapCtrlAndMeta)
- && (macSymbol == kControlUnicode || macSymbol == kCommandUnicode)) {
- if (macSymbol == kControlUnicode)
- macSymbol = kCommandUnicode;
+ && (appleSymbol == kControlUnicode || appleSymbol == kCommandUnicode)) {
+ if (appleSymbol == kControlUnicode)
+ appleSymbol = kCommandUnicode;
else
- macSymbol = kControlUnicode;
+ appleSymbol = kControlUnicode;
}
- return QChar(macSymbol);
+ return QChar(appleSymbol);
}
-static int qtkeyForMacSymbol(const QChar ch)
+static int qtkeyForAppleSymbol(const QChar ch)
{
const ushort unicode = ch.unicode();
- for (int i = 0; i < NumEntries; ++i) {
- const MacSpecialKey &entry = entries[i];
- if (entry.macSymbol == unicode) {
+ for (const AppleSpecialKey &entry : entries) {
+ if (entry.appleSymbol == unicode) {
int key = entry.key;
if (qApp->testAttribute(Qt::AA_MacDontSwapCtrlAndMeta)
&& (unicode == kControlUnicode || unicode == kCommandUnicode)) {
@@ -145,7 +117,7 @@ static int qtkeyForMacSymbol(const QChar ch)
}
#else
-static bool qt_sequence_no_mnemonics = false;
+Q_CONSTINIT static bool qt_sequence_no_mnemonics = false;
#endif
/*!
@@ -192,9 +164,10 @@ void Q_GUI_EXPORT qt_set_sequence_auto_mnemonic(bool b) { qt_sequence_no_mnemoni
for users of different languages. Translations are made in the
"QShortcut" context.
\li For hard-coded shortcuts, integer key codes can be specified with
- a combination of values defined by the Qt::Key and Qt::Modifier enum
- values. Each key code consists of a single Qt::Key value and zero or
- more modifiers, such as Qt::SHIFT, Qt::CTRL, Qt::ALT and Qt::META.
+ a combination of values defined by the Qt::Key and Qt::KeyboardModifier
+ enum values. Each key code consists of a single Qt::Key value and zero
+ or more modifiers, such as Qt::ShiftModifier, Qt::ControlModifier,
+ Qt::AltModifier and Qt::MetaModifier.
\endlist
For example, \uicontrol{Ctrl P} might be a sequence used as a shortcut for
@@ -218,7 +191,7 @@ void Q_GUI_EXPORT qt_set_sequence_auto_mnemonic(bool b) { qt_sequence_no_mnemoni
QKeySequence objects can be cast to a QString to obtain a human-readable
translated version of the sequence. Similarly, the toString() function
- produces human-readable strings for use in menus. On \macos, the
+ produces human-readable strings for use in menus. On Apple platforms, the
appropriate symbols are used to describe keyboard shortcuts using special
keys on the Macintosh keyboard.
@@ -226,12 +199,12 @@ void Q_GUI_EXPORT qt_set_sequence_auto_mnemonic(bool b) { qt_sequence_no_mnemoni
code point of the character; for example, 'A' gives the same key sequence
as Qt::Key_A.
- \note On \macos, references to "Ctrl", Qt::CTRL, Qt::Key_Control
+ \note On Apple platforms, references to "Ctrl", Qt::CTRL, Qt::Key_Control
and Qt::ControlModifier correspond to the \uicontrol Command keys on the
Macintosh keyboard, and references to "Meta", Qt::META, Qt::Key_Meta and
- Qt::MetaModifier correspond to the \uicontrol Control keys. Developers on
- \macos can use the same shortcut descriptions across all platforms,
- and their applications will automatically work as expected on \macos.
+ Qt::MetaModifier correspond to the \uicontrol Control keys. In effect,
+ developers can use the same shortcut descriptions across all platforms,
+ and their applications will automatically work as expected on Apple platforms.
\section1 Standard Shortcuts
@@ -240,21 +213,21 @@ void Q_GUI_EXPORT qt_set_sequence_auto_mnemonic(bool b) { qt_sequence_no_mnemoni
setting up actions in a typical application. The table below shows
some common key sequences that are often used for these standard
shortcuts by applications on four widely-used platforms. Note
- that on \macos, the \uicontrol Ctrl value corresponds to the \uicontrol
+ that on Apple platforms, the \uicontrol Ctrl value corresponds to the \uicontrol
Command keys on the Macintosh keyboard, and the \uicontrol Meta value
corresponds to the \uicontrol Control keys.
\table
- \header \li StandardKey \li Windows \li \macos \li KDE Plasma \li GNOME
+ \header \li StandardKey \li Windows \li Apple platforms \li KDE Plasma \li GNOME
\row \li HelpContents \li F1 \li Ctrl+? \li F1 \li F1
\row \li WhatsThis \li Shift+F1 \li Shift+F1 \li Shift+F1 \li Shift+F1
\row \li Open \li Ctrl+O \li Ctrl+O \li Ctrl+O \li Ctrl+O
\row \li Close \li Ctrl+F4, Ctrl+W \li Ctrl+W, Ctrl+F4 \li Ctrl+W \li Ctrl+W
\row \li Save \li Ctrl+S \li Ctrl+S \li Ctrl+S \li Ctrl+S
\row \li Quit \li \li Ctrl+Q \li Ctrl+Q \li Ctrl+Q
- \row \li SaveAs \li \li Ctrl+Shift+S \li \li Ctrl+Shift+S
+ \row \li SaveAs \li Ctrl+Shift+S \li Ctrl+Shift+S \li Ctrl+Shift+S \li Ctrl+Shift+S
\row \li New \li Ctrl+N \li Ctrl+N \li Ctrl+N \li Ctrl+N
- \row \li Delete \li Del \li Del, Meta+D \li Del, Ctrl+D \li Del, Ctrl+D
+ \row \li Delete \li Del \li Forward Delete, Meta+D \li Del, Ctrl+D \li Del, Ctrl+D
\row \li Cut \li Ctrl+X, Shift+Del \li Ctrl+X, Meta+K \li Ctrl+X, F20, Shift+Del \li Ctrl+X, F20, Shift+Del
\row \li Copy \li Ctrl+C, Ctrl+Ins \li Ctrl+C \li Ctrl+C, F16, Ctrl+Ins \li Ctrl+C, F16, Ctrl+Ins
\row \li Paste \li Ctrl+V, Shift+Ins \li Ctrl+V, Meta+Y \li Ctrl+V, F18, Shift+Ins \li Ctrl+V, F18, Shift+Ins
@@ -314,7 +287,7 @@ void Q_GUI_EXPORT qt_set_sequence_auto_mnemonic(bool b) { qt_sequence_no_mnemoni
\row \li DeleteCompleteLine \li (none) \li (none) \li Ctrl+U \li Ctrl+U
\row \li InsertParagraphSeparator \li Enter \li Enter \li Enter \li Enter
\row \li InsertLineSeparator \li Shift+Enter \li Meta+Enter, Meta+O \li Shift+Enter \li Shift+Enter
- \row \li Backspace \li (none) \li Meta+H \li (none) \li (none)
+ \row \li Backspace \li (none) \li Delete, Meta+H \li (none) \li (none)
\row \li Cancel \li Escape \li Escape, Ctrl+. \li Escape \li Escape
\endtable
@@ -401,7 +374,7 @@ void Q_GUI_EXPORT qt_set_sequence_auto_mnemonic(bool b) { qt_sequence_no_mnemoni
\enum QKeySequence::SequenceFormat
\value NativeText The key sequence as a platform specific string.
- This means that it will be shown translated and on the Mac it will
+ This means that it will be shown translated and on Apple platforms it will
resemble a key sequence from the menu bar. This enum is best used when you
want to display the string to the user.
@@ -410,7 +383,7 @@ void Q_GUI_EXPORT qt_set_sequence_auto_mnemonic(bool b) { qt_sequence_no_mnemoni
similar to the native text on Windows and X11.
*/
-static const struct {
+static constexpr struct {
int key;
const char name[25];
} keyname[] = {
@@ -699,9 +672,13 @@ static const struct {
{ Qt::Key_TouchpadToggle, QT_TRANSLATE_NOOP("QShortcut", "Touchpad Toggle") },
{ Qt::Key_TouchpadOn, QT_TRANSLATE_NOOP("QShortcut", "Touchpad On") },
{ Qt::Key_TouchpadOff, QT_TRANSLATE_NOOP("QShortcut", "Touchpad Off") },
+ { Qt::Key_Shift, QT_TRANSLATE_NOOP("QShortcut", "Shift") },
+ { Qt::Key_Control, QT_TRANSLATE_NOOP("QShortcut", "Control") },
+ { Qt::Key_Alt, QT_TRANSLATE_NOOP("QShortcut", "Alt") },
+ { Qt::Key_Meta, QT_TRANSLATE_NOOP("QShortcut", "Meta") },
};
-static Q_CONSTEXPR int numKeyNames = sizeof keyname / sizeof *keyname;
+static constexpr int numKeyNames = sizeof keyname / sizeof *keyname;
/*!
\enum QKeySequence::StandardKey
@@ -733,7 +710,7 @@ static Q_CONSTEXPR int numKeyNames = sizeof keyname / sizeof *keyname;
\value InsertLineSeparator Insert a new line.
\value InsertParagraphSeparator Insert a new paragraph.
\value Italic Italic text.
- \value MoveToEndOfBlock Move cursor to end of block. This shortcut is only used on the \macos.
+ \value MoveToEndOfBlock Move cursor to end of block. This shortcut is only used on Apple platforms.
\value MoveToEndOfDocument Move cursor to end of document.
\value MoveToEndOfLine Move cursor to end of line.
\value MoveToNextChar Move cursor to next character.
@@ -744,7 +721,7 @@ static Q_CONSTEXPR int numKeyNames = sizeof keyname / sizeof *keyname;
\value MoveToPreviousLine Move cursor to previous line.
\value MoveToPreviousPage Move cursor to previous page.
\value MoveToPreviousWord Move cursor to previous word.
- \value MoveToStartOfBlock Move cursor to start of a block. This shortcut is only used on \macos.
+ \value MoveToStartOfBlock Move cursor to start of a block. This shortcut is only used on Apple platforms.
\value MoveToStartOfDocument Move cursor to start of document.
\value MoveToStartOfLine Move cursor to start of line.
\value New Create new document.
@@ -762,7 +739,7 @@ static Q_CONSTEXPR int numKeyNames = sizeof keyname / sizeof *keyname;
\value Save Save document.
\value SelectAll Select all text.
\value Deselect Deselect text. Since 5.1
- \value SelectEndOfBlock Extend selection to the end of a text block. This shortcut is only used on \macos.
+ \value SelectEndOfBlock Extend selection to the end of a text block. This shortcut is only used on Apple platforms.
\value SelectEndOfDocument Extend selection to end of document.
\value SelectEndOfLine Extend selection to end of line.
\value SelectNextChar Extend selection to next character.
@@ -773,7 +750,7 @@ static Q_CONSTEXPR int numKeyNames = sizeof keyname / sizeof *keyname;
\value SelectPreviousLine Extend selection to previous line.
\value SelectPreviousPage Extend selection to previous page.
\value SelectPreviousWord Extend selection to previous word.
- \value SelectStartOfBlock Extend selection to the start of a text block. This shortcut is only used on \macos.
+ \value SelectStartOfBlock Extend selection to the start of a text block. This shortcut is only used on Apple platforms.
\value SelectStartOfDocument Extend selection to start of document.
\value SelectStartOfLine Extend selection to start of line.
\value Underline Underline text.
@@ -807,8 +784,8 @@ QKeySequence::QKeySequence(StandardKey key)
{
const QList <QKeySequence> bindings = keyBindings(key);
//pick only the first/primary shortcut from current bindings
- if (bindings.size() > 0) {
- d = bindings.first().d;
+ if (!bindings.isEmpty()) {
+ d = bindings.constFirst().d;
d->ref.ref();
}
else
@@ -821,7 +798,7 @@ QKeySequence::QKeySequence(StandardKey key)
*/
QKeySequence::QKeySequence()
{
- static QKeySequencePrivate shared_empty;
+ Q_CONSTINIT static QKeySequencePrivate shared_empty;
d = &shared_empty;
d->ref.ref();
}
@@ -851,14 +828,14 @@ QKeySequence::QKeySequence(const QString &key, QKeySequence::SequenceFormat form
assign(key, format);
}
-Q_STATIC_ASSERT_X(QKeySequencePrivate::MaxKeyCount == 4, "Change docs and ctor impl below");
+static_assert(QKeySequencePrivate::MaxKeyCount == 4, "Change docs and ctor impl below");
/*!
Constructs a key sequence with up to 4 keys \a k1, \a k2,
\a k3 and \a k4.
The key codes are listed in Qt::Key and can be combined with
- modifiers (see Qt::Modifier) such as Qt::SHIFT, Qt::CTRL,
- Qt::ALT, or Qt::META.
+ modifiers (see Qt::KeyboardModifier) such as Qt::ShiftModifier,
+ Qt::ControlModifier, Qt::AltModifier, or Qt::MetaModifier.
*/
QKeySequence::QKeySequence(int k1, int k2, int k3, int k4)
{
@@ -870,6 +847,17 @@ QKeySequence::QKeySequence(int k1, int k2, int k3, int k4)
}
/*!
+ Constructs a key sequence with up to 4 keys \a k1, \a k2,
+ \a k3 and \a k4.
+
+ \sa QKeyCombination
+*/
+QKeySequence::QKeySequence(QKeyCombination k1, QKeyCombination k2, QKeyCombination k3, QKeyCombination k4)
+ : QKeySequence(k1.toCombined(), k2.toCombined(), k3.toCombined(), k4.toCombined())
+{
+}
+
+/*!
Copy constructor. Makes a copy of \a keysequence.
*/
QKeySequence::QKeySequence(const QKeySequence& keysequence)
@@ -908,14 +896,14 @@ QKeySequence::~QKeySequence()
delivery.
*/
-void QKeySequence::setKey(int key, int index)
+void QKeySequence::setKey(QKeyCombination key, int index)
{
Q_ASSERT_X(index >= 0 && index < QKeySequencePrivate::MaxKeyCount, "QKeySequence::setKey", "index out of range");
qAtomicDetach(d);
- d->key[index] = key;
+ d->key[index] = key.toCombined();
}
-Q_STATIC_ASSERT_X(QKeySequencePrivate::MaxKeyCount == 4, "Change docs below");
+static_assert(QKeySequencePrivate::MaxKeyCount == 4, "Change docs below");
/*!
Returns the number of keys in the key sequence.
The maximum is 4.
@@ -943,31 +931,26 @@ bool QKeySequence::isEmpty() const
For example, mnemonic("E&xit") returns \c{Qt::ALT+Qt::Key_X},
mnemonic("&Quit") returns \c{ALT+Key_Q}, and mnemonic("Quit")
returns an empty QKeySequence.
-
- We provide a \l{accelerators.html}{list of common mnemonics}
- in English. At the time of writing, Microsoft and Open Group do
- not appear to have issued equivalent recommendations for other
- languages.
*/
QKeySequence QKeySequence::mnemonic(const QString &text)
{
QKeySequence ret;
- if(qt_sequence_no_mnemonics)
+ if (qt_sequence_no_mnemonics)
return ret;
bool found = false;
- int p = 0;
+ qsizetype p = 0;
while (p >= 0) {
- p = text.indexOf(QLatin1Char('&'), p) + 1;
- if (p <= 0 || p >= (int)text.length())
+ p = text.indexOf(u'&', p) + 1;
+ if (p <= 0 || p >= (int)text.size())
break;
- if (text.at(p) != QLatin1Char('&')) {
+ if (text.at(p) != u'&') {
QChar c = text.at(p);
if (c.isPrint()) {
if (!found) {
c = c.toUpper();
- ret = QKeySequence(c.unicode() + Qt::ALT);
+ ret = QKeySequence(QKeyCombination(Qt::ALT, Qt::Key(c.unicode())));
#ifdef QT_NO_DEBUG
return ret;
#else
@@ -1010,22 +993,22 @@ int QKeySequence::assign(const QString &ks, QKeySequence::SequenceFormat format)
{
QString keyseq = ks;
int n = 0;
- int p = 0, diff = 0;
+ qsizetype p = 0, diff = 0;
// Run through the whole string, but stop
// if we have MaxKeyCount keys before the end.
- while (keyseq.length() && n < QKeySequencePrivate::MaxKeyCount) {
+ while (keyseq.size() && n < QKeySequencePrivate::MaxKeyCount) {
// We MUST use something to separate each sequence, and space
// does not cut it, since some of the key names have space
// in them.. (Let's hope no one translate with a comma in it:)
- p = keyseq.indexOf(QLatin1Char(','));
+ p = keyseq.indexOf(u',');
if (-1 != p) {
- if (p == keyseq.count() - 1) { // Last comma 'Ctrl+,'
+ if (p == keyseq.size() - 1) { // Last comma 'Ctrl+,'
p = -1;
} else {
- if (QLatin1Char(',') == keyseq.at(p+1)) // e.g. 'Ctrl+,, Shift+,,'
+ if (u',' == keyseq.at(p+1)) // e.g. 'Ctrl+,, Shift+,,'
p++;
- if (QLatin1Char(' ') == keyseq.at(p+1)) { // Space after comma
+ if (u' ' == keyseq.at(p+1)) { // Space after comma
diff = 1;
p++;
} else {
@@ -1033,9 +1016,9 @@ int QKeySequence::assign(const QString &ks, QKeySequence::SequenceFormat format)
}
}
}
- QString part = keyseq.left(-1 == p ? keyseq.length() : p - diff);
- keyseq = keyseq.right(-1 == p ? 0 : keyseq.length() - (p + 1));
- d->key[n] = QKeySequencePrivate::decodeString(std::move(part), format);
+ QString part = keyseq.left(-1 == p ? keyseq.size() : p - diff);
+ keyseq = keyseq.right(-1 == p ? 0 : keyseq.size() - (p + 1));
+ d->key[n] = QKeySequencePrivate::decodeString(std::move(part), format).toCombined();
++n;
}
return n;
@@ -1048,20 +1031,12 @@ struct QModifKeyName {
int qt_key;
QString name;
};
-Q_DECLARE_TYPEINFO(QModifKeyName, Q_MOVABLE_TYPE);
+Q_DECLARE_TYPEINFO(QModifKeyName, Q_RELOCATABLE_TYPE);
-Q_GLOBAL_STATIC(QVector<QModifKeyName>, globalModifs)
-Q_GLOBAL_STATIC(QVector<QModifKeyName>, globalPortableModifs)
+Q_GLOBAL_STATIC(QList<QModifKeyName>, globalModifs)
+Q_GLOBAL_STATIC(QList<QModifKeyName>, globalPortableModifs)
-/*!
- Constructs a single key from the string \a str.
-*/
-int QKeySequence::decodeString(const QString &str)
-{
- return QKeySequencePrivate::decodeString(str, NativeText);
-}
-
-int QKeySequencePrivate::decodeString(QString accel, QKeySequence::SequenceFormat format)
+QKeyCombination QKeySequencePrivate::decodeString(QString accel, QKeySequence::SequenceFormat format)
{
Q_ASSERT(!accel.isEmpty());
@@ -1069,11 +1044,11 @@ int QKeySequencePrivate::decodeString(QString accel, QKeySequence::SequenceForma
accel = std::move(accel).toLower();
bool nativeText = (format == QKeySequence::NativeText);
- QVector<QModifKeyName> *gmodifs;
+ QList<QModifKeyName> *gmodifs;
if (nativeText) {
gmodifs = globalModifs();
if (gmodifs->isEmpty()) {
-#if defined(Q_OS_MACX)
+#if defined(Q_OS_APPLE)
const bool dontSwap = qApp->testAttribute(Qt::AA_MacDontSwapCtrlAndMeta);
if (dontSwap)
*gmodifs << QModifKeyName(Qt::META, QChar(kCommandUnicode));
@@ -1086,36 +1061,36 @@ int QKeySequencePrivate::decodeString(QString accel, QKeySequence::SequenceForma
*gmodifs << QModifKeyName(Qt::META, QChar(kControlUnicode));
*gmodifs << QModifKeyName(Qt::SHIFT, QChar(kShiftUnicode));
#endif
- *gmodifs << QModifKeyName(Qt::CTRL, QLatin1String("ctrl+"))
- << QModifKeyName(Qt::SHIFT, QLatin1String("shift+"))
- << QModifKeyName(Qt::ALT, QLatin1String("alt+"))
- << QModifKeyName(Qt::META, QLatin1String("meta+"))
- << QModifKeyName(Qt::KeypadModifier, QLatin1String("num+"));
+ *gmodifs << QModifKeyName(Qt::CTRL, u"ctrl+"_s)
+ << QModifKeyName(Qt::SHIFT, u"shift+"_s)
+ << QModifKeyName(Qt::ALT, u"alt+"_s)
+ << QModifKeyName(Qt::META, u"meta+"_s)
+ << QModifKeyName(Qt::KeypadModifier, u"num+"_s);
}
} else {
gmodifs = globalPortableModifs();
if (gmodifs->isEmpty()) {
- *gmodifs << QModifKeyName(Qt::CTRL, QLatin1String("ctrl+"))
- << QModifKeyName(Qt::SHIFT, QLatin1String("shift+"))
- << QModifKeyName(Qt::ALT, QLatin1String("alt+"))
- << QModifKeyName(Qt::META, QLatin1String("meta+"))
- << QModifKeyName(Qt::KeypadModifier, QLatin1String("num+"));
+ *gmodifs << QModifKeyName(Qt::CTRL, u"ctrl+"_s)
+ << QModifKeyName(Qt::SHIFT, u"shift+"_s)
+ << QModifKeyName(Qt::ALT, u"alt+"_s)
+ << QModifKeyName(Qt::META, u"meta+"_s)
+ << QModifKeyName(Qt::KeypadModifier, u"num+"_s);
}
}
- QVector<QModifKeyName> modifs;
+ QList<QModifKeyName> modifs;
if (nativeText) {
- modifs << QModifKeyName(Qt::CTRL, QCoreApplication::translate("QShortcut", "Ctrl").toLower().append(QLatin1Char('+')))
- << QModifKeyName(Qt::SHIFT, QCoreApplication::translate("QShortcut", "Shift").toLower().append(QLatin1Char('+')))
- << QModifKeyName(Qt::ALT, QCoreApplication::translate("QShortcut", "Alt").toLower().append(QLatin1Char('+')))
- << QModifKeyName(Qt::META, QCoreApplication::translate("QShortcut", "Meta").toLower().append(QLatin1Char('+')))
- << QModifKeyName(Qt::KeypadModifier, QCoreApplication::translate("QShortcut", "Num").toLower().append(QLatin1Char('+')));
+ modifs << QModifKeyName(Qt::CTRL, QCoreApplication::translate("QShortcut", "Ctrl").toLower().append(u'+'))
+ << QModifKeyName(Qt::SHIFT, QCoreApplication::translate("QShortcut", "Shift").toLower().append(u'+'))
+ << QModifKeyName(Qt::ALT, QCoreApplication::translate("QShortcut", "Alt").toLower().append(u'+'))
+ << QModifKeyName(Qt::META, QCoreApplication::translate("QShortcut", "Meta").toLower().append(u'+'))
+ << QModifKeyName(Qt::KeypadModifier, QCoreApplication::translate("QShortcut", "Num").toLower().append(u'+'));
}
modifs += *gmodifs; // Test non-translated ones last
QString sl = accel;
-#if defined(Q_OS_MACX)
+#if defined(Q_OS_APPLE)
for (int i = 0; i < modifs.size(); ++i) {
const QModifKeyName &mkf = modifs.at(i);
if (sl.contains(mkf.name)) {
@@ -1128,10 +1103,10 @@ int QKeySequencePrivate::decodeString(QString accel, QKeySequence::SequenceForma
return Qt::Key_unknown;
#endif
- int i = 0;
- int lastI = 0;
- while ((i = sl.indexOf(QLatin1Char('+'), i + 1)) != -1) {
- const QStringRef sub = sl.midRef(lastI, i - lastI + 1);
+ qsizetype i = 0;
+ qsizetype lastI = 0;
+ while ((i = sl.indexOf(u'+', i + 1)) != -1) {
+ const QStringView sub = QStringView{sl}.mid(lastI, i - lastI + 1);
// If we get here the shortcuts contains at least one '+'. We break up
// along the following strategy:
// Meta+Ctrl++ ( "Meta+", "Ctrl+", "+" )
@@ -1141,9 +1116,9 @@ int QKeySequencePrivate::decodeString(QString accel, QKeySequence::SequenceForma
// except for a single '+' at the end of the string.
// Only '+' can have length 1.
- if (sub.length() == 1) {
+ if (sub.size() == 1) {
// Make sure we only encounter a single '+' at the end of the accel
- if (accel.lastIndexOf(QLatin1Char('+')) != accel.length()-1)
+ if (accel.lastIndexOf(u'+') != accel.size()-1)
return Qt::Key_unknown;
} else {
// Identify the modifier
@@ -1163,15 +1138,15 @@ int QKeySequencePrivate::decodeString(QString accel, QKeySequence::SequenceForma
lastI = i + 1;
}
- int p = accel.lastIndexOf(QLatin1Char('+'), accel.length() - 2); // -2 so that Ctrl++ works
- QStringRef accelRef(&accel);
- if(p > 0)
+ qsizetype p = accel.lastIndexOf(u'+', accel.size() - 2); // -2 so that Ctrl++ works
+ QStringView accelRef(accel);
+ if (p > 0)
accelRef = accelRef.mid(p + 1);
int fnum = 0;
- if (accelRef.length() == 1) {
-#if defined(Q_OS_MACX)
- int qtKey = qtkeyForMacSymbol(accelRef.at(0));
+ if (accelRef.size() == 1) {
+#if defined(Q_OS_APPLE)
+ int qtKey = qtkeyForAppleSymbol(accelRef.at(0));
if (qtKey != -1) {
ret |= qtKey;
} else
@@ -1179,10 +1154,10 @@ int QKeySequencePrivate::decodeString(QString accel, QKeySequence::SequenceForma
{
ret |= accelRef.at(0).toUpper().unicode();
}
- } else if (accelRef.at(0) == QLatin1Char('f') && (fnum = accelRef.mid(1).toInt()) >= 1 && fnum <= 35) {
+ } else if (accelRef.at(0) == u'f' && (fnum = accelRef.mid(1).toInt()) >= 1 && fnum <= 35) {
ret |= Qt::Key_F1 + fnum - 1;
} else {
- // For NativeText, check the traslation table first,
+ // For NativeText, check the translation table first,
// if we don't find anything then try it out with just the untranlated stuff.
// PortableText will only try the untranlated table.
bool found = false;
@@ -1206,17 +1181,7 @@ int QKeySequencePrivate::decodeString(QString accel, QKeySequence::SequenceForma
if (!found)
return Qt::Key_unknown;
}
- return ret;
-}
-
-/*!
- Creates a shortcut string for \a key. For example,
- Qt::CTRL+Qt::Key_O gives "Ctrl+O". The strings, "Ctrl", "Shift", etc. are
- translated (using QObject::tr()) in the "QShortcut" context.
- */
-QString QKeySequence::encodeString(int key)
-{
- return QKeySequencePrivate::encodeString(key, NativeText);
+ return QKeyCombination::fromCombined(ret);
}
static inline void addKey(QString &str, const QString &theKey, QKeySequence::SequenceFormat format)
@@ -1226,34 +1191,38 @@ static inline void addKey(QString &str, const QString &theKey, QKeySequence::Seq
//: Key separator in shortcut string
str += QCoreApplication::translate("QShortcut", "+");
} else {
- str += QLatin1Char('+');
+ str += u'+';
}
}
str += theKey;
}
-QString QKeySequencePrivate::encodeString(int key, QKeySequence::SequenceFormat format)
+QString QKeySequencePrivate::encodeString(QKeyCombination keyCombination, QKeySequence::SequenceFormat format)
{
bool nativeText = (format == QKeySequence::NativeText);
QString s;
+ const auto key = keyCombination.key();
+
// Handle -1 (Invalid Key) and Qt::Key_unknown gracefully
- if (key == -1 || key == Qt::Key_unknown)
+ if (keyCombination.toCombined() == -1 || key == Qt::Key_unknown)
return s;
-#if defined(Q_OS_MACX)
+ const auto modifiers = keyCombination.keyboardModifiers();
+
+#if defined(Q_OS_APPLE)
if (nativeText) {
- // On OS X the order (by default) is Meta, Alt, Shift, Control.
+ // On Apple platforms the order (by default) is Meta, Alt, Shift, Control.
// If the AA_MacDontSwapCtrlAndMeta is enabled, then the order
- // is Ctrl, Alt, Shift, Meta. The macSymbolForQtKey does this swap
+ // is Ctrl, Alt, Shift, Meta. The appleSymbolForQtKey helper does this swap
// for us, which means that we have to adjust our order here.
// The upshot is a lot more infrastructure to keep the number of
// if tests down and the code relatively clean.
- static const int ModifierOrder[] = { Qt::META, Qt::ALT, Qt::SHIFT, Qt::CTRL, 0 };
- static const int QtKeyOrder[] = { Qt::Key_Meta, Qt::Key_Alt, Qt::Key_Shift, Qt::Key_Control, 0 };
- static const int DontSwapModifierOrder[] = { Qt::CTRL, Qt::ALT, Qt::SHIFT, Qt::META, 0 };
- static const int DontSwapQtKeyOrder[] = { Qt::Key_Control, Qt::Key_Alt, Qt::Key_Shift, Qt::Key_Meta, 0 };
+ static constexpr int ModifierOrder[] = { Qt::META, Qt::ALT, Qt::SHIFT, Qt::CTRL, 0 };
+ static constexpr int QtKeyOrder[] = { Qt::Key_Meta, Qt::Key_Alt, Qt::Key_Shift, Qt::Key_Control, 0 };
+ static constexpr int DontSwapModifierOrder[] = { Qt::CTRL, Qt::ALT, Qt::SHIFT, Qt::META, 0 };
+ static constexpr int DontSwapQtKeyOrder[] = { Qt::Key_Control, Qt::Key_Alt, Qt::Key_Shift, Qt::Key_Meta, 0 };
const int *modifierOrder;
const int *qtkeyOrder;
if (qApp->testAttribute(Qt::AA_MacDontSwapCtrlAndMeta)) {
@@ -1265,33 +1234,33 @@ QString QKeySequencePrivate::encodeString(int key, QKeySequence::SequenceFormat
}
for (int i = 0; modifierOrder[i] != 0; ++i) {
- if (key & modifierOrder[i])
- s += qt_macSymbolForQtKey(qtkeyOrder[i]);
+ if (modifiers & modifierOrder[i])
+ s += appleSymbolForQtKey(qtkeyOrder[i]);
}
} else
#endif
{
// On other systems the order is Meta, Control, Alt, Shift
- if ((key & Qt::META) == Qt::META)
+ if (modifiers & Qt::MetaModifier)
s = nativeText ? QCoreApplication::translate("QShortcut", "Meta") : QString::fromLatin1("Meta");
- if ((key & Qt::CTRL) == Qt::CTRL)
+ if (modifiers & Qt::ControlModifier)
addKey(s, nativeText ? QCoreApplication::translate("QShortcut", "Ctrl") : QString::fromLatin1("Ctrl"), format);
- if ((key & Qt::ALT) == Qt::ALT)
+ if (modifiers & Qt::AltModifier)
addKey(s, nativeText ? QCoreApplication::translate("QShortcut", "Alt") : QString::fromLatin1("Alt"), format);
- if ((key & Qt::SHIFT) == Qt::SHIFT)
+ if (modifiers & Qt::ShiftModifier)
addKey(s, nativeText ? QCoreApplication::translate("QShortcut", "Shift") : QString::fromLatin1("Shift"), format);
}
- if ((key & Qt::KeypadModifier) == Qt::KeypadModifier)
+ if (modifiers & Qt::KeypadModifier)
addKey(s, nativeText ? QCoreApplication::translate("QShortcut", "Num") : QString::fromLatin1("Num"), format);
- QString p = keyName(key, format);
+ QString keyName = QKeySequencePrivate::keyName(key, format);
-#if defined(Q_OS_OSX)
+#if defined(Q_OS_APPLE)
if (nativeText)
- s += p;
+ s += keyName;
else
#endif
- addKey(s, p, format);
+ addKey(s, keyName, format);
return s;
}
@@ -1303,15 +1272,14 @@ QString QKeySequencePrivate::encodeString(int key, QKeySequence::SequenceFormat
This static method is used by encodeString() and by the D-Bus menu exporter.
*/
-QString QKeySequencePrivate::keyName(int key, QKeySequence::SequenceFormat format)
+QString QKeySequencePrivate::keyName(Qt::Key key, QKeySequence::SequenceFormat format)
{
bool nativeText = (format == QKeySequence::NativeText);
- key &= ~(Qt::ShiftModifier | Qt::ControlModifier | Qt::AltModifier | Qt::MetaModifier | Qt::KeypadModifier);
QString p;
if (key && key < Qt::Key_Escape && key != Qt::Key_Space) {
if (!QChar::requiresSurrogates(key)) {
- p = QChar(ushort(key)).toUpper();
+ p = QChar::fromUcs2(key).toUpper();
} else {
p += QChar(QChar::highSurrogate(key));
p += QChar(QChar::lowSurrogate(key));
@@ -1321,9 +1289,9 @@ QString QKeySequencePrivate::keyName(int key, QKeySequence::SequenceFormat forma
: QString::fromLatin1("F%1").arg(key - Qt::Key_F1 + 1);
} else if (key) {
int i=0;
-#if defined(Q_OS_MACX)
+#if defined(Q_OS_APPLE)
if (nativeText) {
- QChar ch = qt_macSymbolForQtKey(key);
+ QChar ch = appleSymbolForQtKey(key);
if (!ch.isNull())
p = ch;
else
@@ -1331,7 +1299,7 @@ QString QKeySequencePrivate::keyName(int key, QKeySequence::SequenceFormat forma
} else
#endif
{
-#if defined(Q_OS_MACX)
+#if defined(Q_OS_APPLE)
NonSymbol:
#endif
while (i < numKeyNames) {
@@ -1348,7 +1316,7 @@ NonSymbol:
// (Really depends on you locale)
if (i >= numKeyNames) {
if (!QChar::requiresSurrogates(key)) {
- p = QChar(ushort(key)).toUpper();
+ p = QChar::fromUcs2(key).toUpper();
} else {
p += QChar(QChar::highSurrogate(key));
p += QChar(QChar::lowSurrogate(key));
@@ -1377,49 +1345,30 @@ QKeySequence::SequenceMatch QKeySequence::matches(const QKeySequence &seq) const
SequenceMatch match = (userN == seqN ? ExactMatch : PartialMatch);
for (uint i = 0; i < userN; ++i) {
- int userKey = (*this)[i],
- sequenceKey = seq[i];
+ QKeyCombination userKey = (*this)[i],
+ sequenceKey = seq[i];
if (userKey != sequenceKey)
return NoMatch;
}
return match;
}
-
-/*! \fn QKeySequence::operator QString() const
-
- \obsolete
-
- Use toString() instead.
-
- Returns the key sequence as a QString. This is equivalent to
- calling toString(QKeySequence::NativeText). Note that the
- result is not platform independent.
-*/
-
/*!
Returns the key sequence as a QVariant
*/
QKeySequence::operator QVariant() const
{
- return QVariant(QVariant::KeySequence, this);
+ return QVariant::fromValue(*this);
}
-/*! \fn QKeySequence::operator int () const
-
- \obsolete
- For backward compatibility: returns the first keycode
- as integer. If the key sequence is empty, 0 is returned.
- */
-
/*!
Returns a reference to the element at position \a index in the key
sequence. This can only be used to read an element.
*/
-int QKeySequence::operator[](uint index) const
+QKeyCombination QKeySequence::operator[](uint index) const
{
Q_ASSERT_X(index < QKeySequencePrivate::MaxKeyCount, "QKeySequence::operator[]", "index out of range");
- return d->key[index];
+ return QKeyCombination::fromCombined(d->key[index]);
}
@@ -1463,11 +1412,12 @@ bool QKeySequence::operator==(const QKeySequence &other) const
/*!
\since 5.6
+ \relates QKeySequence
Calculates the hash value of \a key, using
\a seed to seed the calculation.
*/
-uint qHash(const QKeySequence &key, uint seed) noexcept
+size_t qHash(const QKeySequence &key, size_t seed) noexcept
{
return qHashRange(key.d->key, key.d->key + QKeySequencePrivate::MaxKeyCount, seed);
}
@@ -1539,7 +1489,7 @@ bool QKeySequence::isDetached() const
If the key sequence has no keys, an empty string is returned.
- On \macos, the string returned resembles the sequence that is
+ On Apple platforms, the string returned resembles the sequence that is
shown in the menu bar if \a format is
QKeySequence::NativeText; otherwise, the string uses the
"portable" format, suitable for writing to a file.
@@ -1553,10 +1503,10 @@ QString QKeySequence::toString(SequenceFormat format) const
// look like our latin case on Windows and X11
int end = count();
for (int i = 0; i < end; ++i) {
- finalString += d->encodeString(d->key[i], format);
- finalString += QLatin1String(", ");
+ finalString += d->encodeString(QKeyCombination::fromCombined(d->key[i]), format);
+ finalString += ", "_L1;
}
- finalString.truncate(finalString.length() - 2);
+ finalString.truncate(finalString.size() - 2);
return finalString;
}
@@ -1584,8 +1534,8 @@ QList<QKeySequence> QKeySequence::listFromString(const QString &str, SequenceFor
{
QList<QKeySequence> result;
- const QStringList strings = str.split(QLatin1String("; "));
- result.reserve(strings.count());
+ const QStringList strings = str.split("; "_L1);
+ result.reserve(strings.size());
for (const QString &string : strings) {
result << fromString(string, format);
}
@@ -1607,9 +1557,9 @@ QString QKeySequence::listToString(const QList<QKeySequence> &list, SequenceForm
for (const QKeySequence &sequence : list) {
result += sequence.toString(format);
- result += QLatin1String("; ");
+ result += "; "_L1;
}
- result.truncate(result.length() - 2);
+ result.truncate(result.size() - 2);
return result;
}
@@ -1628,7 +1578,7 @@ QString QKeySequence::listToString(const QList<QKeySequence> &list, SequenceForm
*/
QDataStream &operator<<(QDataStream &s, const QKeySequence &keysequence)
{
- Q_STATIC_ASSERT_X(QKeySequencePrivate::MaxKeyCount == 4, "Forgot to adapt QDataStream &operator<<(QDataStream &s, const QKeySequence &keysequence) to new QKeySequence::MaxKeyCount");
+ static_assert(QKeySequencePrivate::MaxKeyCount == 4, "Forgot to adapt QDataStream &operator<<(QDataStream &s, const QKeySequence &keysequence) to new QKeySequence::MaxKeyCount");
const bool extended = s.version() >= 5 && keysequence.count() > 1;
s << quint32(extended ? 4 : 1) << quint32(keysequence.d->key[0]);
if (extended) {
@@ -1688,3 +1638,5 @@ QDebug operator<<(QDebug dbg, const QKeySequence &p)
*/
QT_END_NAMESPACE
+
+#include "moc_qkeysequence.cpp"
diff --git a/src/gui/kernel/qkeysequence.h b/src/gui/kernel/qkeysequence.h
index 68f256c37a..4dae26a755 100644
--- a/src/gui/kernel/qkeysequence.h
+++ b/src/gui/kernel/qkeysequence.h
@@ -1,41 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the QtGui module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#ifndef QKEYSEQUENCE_H
#define QKEYSEQUENCE_H
@@ -53,19 +17,19 @@ class QKeySequence;
/*****************************************************************************
QKeySequence stream functions
*****************************************************************************/
-#if !defined(QT_NO_DATASTREAM) || defined(Q_CLANG_QDOC)
+#if !defined(QT_NO_DATASTREAM) || defined(Q_QDOC)
Q_GUI_EXPORT QDataStream &operator<<(QDataStream &in, const QKeySequence &ks);
Q_GUI_EXPORT QDataStream &operator>>(QDataStream &out, QKeySequence &ks);
#endif
-#if defined(Q_CLANG_QDOC)
+#if defined(Q_QDOC)
void qt_set_sequence_auto_mnemonic(bool b);
#endif
class QVariant;
class QKeySequencePrivate;
-Q_GUI_EXPORT Q_DECL_PURE_FUNCTION uint qHash(const QKeySequence &key, uint seed = 0) noexcept;
+Q_GUI_EXPORT Q_DECL_PURE_FUNCTION size_t qHash(const QKeySequence &key, size_t seed = 0) noexcept;
class Q_GUI_EXPORT QKeySequence
{
@@ -151,10 +115,15 @@ public:
NativeText,
PortableText
};
+ Q_ENUM(SequenceFormat)
QKeySequence();
QKeySequence(const QString &key, SequenceFormat format = NativeText);
QKeySequence(int k1, int k2 = 0, int k3 = 0, int k4 = 0);
+ QKeySequence(QKeyCombination k1,
+ QKeyCombination k2 = QKeyCombination::fromCombined(0),
+ QKeyCombination k3 = QKeyCombination::fromCombined(0),
+ QKeyCombination k4 = QKeyCombination::fromCombined(0));
QKeySequence(const QKeySequence &ks);
QKeySequence(StandardKey key);
~QKeySequence();
@@ -167,6 +136,7 @@ public:
PartialMatch,
ExactMatch
};
+ Q_ENUM(SequenceMatch);
QString toString(SequenceFormat format = PortableText) const;
static QKeySequence fromString(const QString &str, SequenceFormat format = PortableText);
@@ -178,15 +148,11 @@ public:
static QKeySequence mnemonic(const QString &text);
static QList<QKeySequence> keyBindings(StandardKey key);
-#if QT_DEPRECATED_SINCE(5, 0)
- QT_DEPRECATED operator QString() const { return toString(QKeySequence::NativeText); }
- QT_DEPRECATED operator int() const { if (1 <= count()) return operator [](0); return 0; }
-#endif
operator QVariant() const;
- int operator[](uint i) const;
+ QKeyCombination operator[](uint i) const;
QKeySequence &operator=(const QKeySequence &other);
- QKeySequence &operator=(QKeySequence &&other) noexcept { swap(other); return *this; }
- void swap(QKeySequence &other) noexcept { qSwap(d, other.d); }
+ QT_MOVE_ASSIGNMENT_OPERATOR_IMPL_VIA_PURE_SWAP(QKeySequence)
+ void swap(QKeySequence &other) noexcept { qt_ptr_swap(d, other.d); }
bool operator==(const QKeySequence &other) const;
inline bool operator!= (const QKeySequence &other) const
@@ -201,17 +167,15 @@ public:
bool isDetached() const;
private:
- static int decodeString(const QString &ks);
- static QString encodeString(int key);
int assign(const QString &str);
int assign(const QString &str, SequenceFormat format);
- void setKey(int key, int index);
+ void setKey(QKeyCombination key, int index);
QKeySequencePrivate *d;
friend Q_GUI_EXPORT QDataStream &operator<<(QDataStream &in, const QKeySequence &ks);
friend Q_GUI_EXPORT QDataStream &operator>>(QDataStream &in, QKeySequence &ks);
- friend Q_GUI_EXPORT uint qHash(const QKeySequence &key, uint seed) noexcept;
+ friend Q_GUI_EXPORT size_t qHash(const QKeySequence &key, size_t seed) noexcept;
friend class QShortcutMap;
friend class QShortcut;
@@ -222,7 +186,7 @@ public:
Q_DECLARE_SHARED(QKeySequence)
-#if !defined(QT_NO_DEBUG_STREAM) || defined(Q_CLANG_QDOC)
+#if !defined(QT_NO_DEBUG_STREAM) || defined(Q_QDOC)
Q_GUI_EXPORT QDebug operator<<(QDebug, const QKeySequence &);
#endif
diff --git a/src/gui/kernel/qkeysequence_p.h b/src/gui/kernel/qkeysequence_p.h
index 8c59505561..8b98e3778a 100644
--- a/src/gui/kernel/qkeysequence_p.h
+++ b/src/gui/kernel/qkeysequence_p.h
@@ -1,41 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the QtGui module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#ifndef QKEYSEQUENCE_P_H
#define QKEYSEQUENCE_P_H
@@ -64,18 +28,15 @@ struct QKeyBinding
{
QKeySequence::StandardKey standardKey;
uchar priority;
- uint shortcut;
+ QKeyCombination shortcut;
uint platform;
};
class QKeySequencePrivate
{
public:
- enum { MaxKeyCount = 4 }; // also used in QKeySequenceEdit
- inline QKeySequencePrivate() : ref(1)
- {
- std::fill_n(key, uint(MaxKeyCount), 0);
- }
+ static constexpr int MaxKeyCount = 4 ; // also used in QKeySequenceEdit
+ constexpr QKeySequencePrivate() : ref(1), key{} {}
inline QKeySequencePrivate(const QKeySequencePrivate &copy) : ref(1)
{
std::copy(copy.key, copy.key + MaxKeyCount,
@@ -83,10 +44,10 @@ public:
}
QAtomicInt ref;
int key[MaxKeyCount];
- static QString encodeString(int key, QKeySequence::SequenceFormat format);
+ static QString encodeString(QKeyCombination keyCombination, QKeySequence::SequenceFormat format);
// used in dbusmenu
- Q_GUI_EXPORT static QString keyName(int key, QKeySequence::SequenceFormat format);
- static int decodeString(QString accel, QKeySequence::SequenceFormat format);
+ Q_GUI_EXPORT static QString keyName(Qt::Key key, QKeySequence::SequenceFormat format);
+ static QKeyCombination decodeString(QString accel, QKeySequence::SequenceFormat format);
};
QT_END_NAMESPACE
diff --git a/src/gui/kernel/qoffscreensurface.cpp b/src/gui/kernel/qoffscreensurface.cpp
index c74fe0b3a1..02e606658a 100644
--- a/src/gui/kernel/qoffscreensurface.cpp
+++ b/src/gui/kernel/qoffscreensurface.cpp
@@ -1,48 +1,12 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the QtGui module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2020 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#include "qoffscreensurface.h"
#include "qguiapplication_p.h"
#include "qscreen.h"
#include "qplatformintegration.h"
-#include "qplatformoffscreensurface.h"
+#include "qoffscreensurface_p.h"
#include "qwindow.h"
#include "qplatformwindow.h"
@@ -50,6 +14,8 @@
QT_BEGIN_NAMESPACE
+using namespace Qt::StringLiterals;
+
/*!
\class QOffscreenSurface
\inmodule QtGui
@@ -91,36 +57,6 @@ QT_BEGIN_NAMESPACE
native surface. For the use cases of QOffscreenSurface (rendering to FBOs, texture
upload) this is not a problem.
*/
-class Q_GUI_EXPORT QOffscreenSurfacePrivate : public QObjectPrivate
-{
- Q_DECLARE_PUBLIC(QOffscreenSurface)
-
-public:
- QOffscreenSurfacePrivate()
- : QObjectPrivate()
- , surfaceType(QSurface::OpenGLSurface)
- , platformOffscreenSurface(nullptr)
- , offscreenWindow(nullptr)
- , requestedFormat(QSurfaceFormat::defaultFormat())
- , screen(nullptr)
- , size(1, 1)
- , nativeHandle(nullptr)
- {
- }
-
- ~QOffscreenSurfacePrivate()
- {
- }
-
- QSurface::SurfaceType surfaceType;
- QPlatformOffscreenSurface *platformOffscreenSurface;
- QWindow *offscreenWindow;
- QSurfaceFormat requestedFormat;
- QScreen *screen;
- QSize size;
- void *nativeHandle;
-};
-
/*!
\since 5.10
@@ -148,19 +84,6 @@ QOffscreenSurface::QOffscreenSurface(QScreen *targetScreen, QObject *parent)
}
/*!
- Creates an offscreen surface for the \a targetScreen.
-
- The underlying platform surface is not created until create() is called.
-
- \sa setScreen(), create()
-*/
-QOffscreenSurface::QOffscreenSurface(QScreen *targetScreen)
- : QOffscreenSurface(targetScreen, nullptr)
-{
-}
-
-
-/*!
Destroys the offscreen surface.
*/
QOffscreenSurface::~QOffscreenSurface()
@@ -205,7 +128,7 @@ void QOffscreenSurface::create()
// violate the minimum title bar width on the platform.
d->offscreenWindow->setFlags(d->offscreenWindow->flags()
| Qt::CustomizeWindowHint | Qt::FramelessWindowHint);
- d->offscreenWindow->setObjectName(QLatin1String("QOffscreenSurface"));
+ d->offscreenWindow->setObjectName("QOffscreenSurface"_L1);
// Remove this window from the global list since we do not want it to be destroyed when closing the app.
// The QOffscreenSurface has to be usable even after exiting the event loop.
QGuiApplicationPrivate::window_list.removeOne(d->offscreenWindow);
@@ -241,14 +164,12 @@ void QOffscreenSurface::destroy()
delete d->offscreenWindow;
d->offscreenWindow = nullptr;
}
-
- d->nativeHandle = nullptr;
}
/*!
Returns \c true if this offscreen surface is valid; otherwise returns \c false.
- The offscreen surface is valid if the platform resources have been successfuly allocated.
+ The offscreen surface is valid if the platform resources have been successfully allocated.
\sa create()
*/
@@ -357,26 +278,6 @@ void QOffscreenSurface::setScreen(QScreen *newScreen)
}
/*!
- Sets the native handle to which the offscreen surface is connected to \a handle.
-
- The native handle will be resolved in the create() function. Calling
- this function after create() will not re-create a native surface.
-
- \note The interpretation of the native handle is platform specific. Only
- some platforms will support adopting native handles of offscreen surfaces
- and platforms that do not implement this support will ignore the handle.
-
- \since 5.9
- \sa nativeHandle()
-*/
-
-void QOffscreenSurface::setNativeHandle(void *handle)
-{
- Q_D(QOffscreenSurface);
- d->nativeHandle = handle;
-}
-
-/*!
Called when the offscreen surface's screen is destroyed.
\internal
@@ -408,17 +309,17 @@ QPlatformOffscreenSurface *QOffscreenSurface::handle() const
}
/*!
- Returns an optional native handle to which the offscreen surface is connected.
+ \fn template <typename QNativeInterface> QNativeInterface *QOffscreenSurface::nativeInterface() const
- \since 5.9
- \sa setNativeHandle()
-*/
+ Returns a native interface of the given type for the surface.
-void *QOffscreenSurface::nativeHandle() const
-{
- Q_D(const QOffscreenSurface);
- return d->nativeHandle;
-}
+ This function provides access to platform specific functionality
+ of QOffScreenSurface, as defined in the QNativeInterface namespace:
+
+ \annotatedlist native-interfaces-qoffscreensurface
+
+ If the requested interface is not available a \nullptr is returned.
+*/
/*!
Returns the platform surface corresponding to the offscreen surface.
@@ -434,4 +335,22 @@ QPlatformSurface *QOffscreenSurface::surfaceHandle() const
return d->platformOffscreenSurface;
}
+using namespace QNativeInterface;
+
+void *QOffscreenSurface::resolveInterface(const char *name, int revision) const
+{
+ Q_UNUSED(name); Q_UNUSED(revision);
+
+ Q_D(const QOffscreenSurface);
+ Q_UNUSED(d);
+
+#if defined(Q_OS_ANDROID)
+ QT_NATIVE_INTERFACE_RETURN_IF(QAndroidOffscreenSurface, d->platformOffscreenSurface);
+#endif
+
+ return nullptr;
+}
+
QT_END_NAMESPACE
+
+#include "moc_qoffscreensurface.cpp"
diff --git a/src/gui/kernel/qoffscreensurface.h b/src/gui/kernel/qoffscreensurface.h
index 1b9e7c00ca..410b6d2b61 100644
--- a/src/gui/kernel/qoffscreensurface.h
+++ b/src/gui/kernel/qoffscreensurface.h
@@ -1,48 +1,14 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the QtGui module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2020 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#ifndef QOFFSCREENSURFACE_H
#define QOFFSCREENSURFACE_H
#include <QtGui/qtguiglobal.h>
#include <QtCore/QObject>
+#include <QtCore/qnativeinterface.h>
#include <QtGui/qsurface.h>
+Q_MOC_INCLUDE(<QtGui/qscreen.h>)
QT_BEGIN_NAMESPACE
@@ -57,9 +23,7 @@ class Q_GUI_EXPORT QOffscreenSurface : public QObject, public QSurface
Q_DECLARE_PRIVATE(QOffscreenSurface)
public:
- // ### Qt 6: merge overloads
- explicit QOffscreenSurface(QScreen *screen, QObject *parent);
- explicit QOffscreenSurface(QScreen *screen = nullptr);
+ explicit QOffscreenSurface(QScreen *screen = nullptr, QObject *parent = nullptr);
~QOffscreenSurface();
SurfaceType surfaceType() const override;
@@ -80,8 +44,7 @@ public:
QPlatformOffscreenSurface *handle() const;
- void *nativeHandle() const;
- void setNativeHandle(void *handle);
+ QT_DECLARE_NATIVE_INTERFACE_ACCESSOR(QOffscreenSurface)
Q_SIGNALS:
void screenChanged(QScreen *screen);
@@ -98,4 +61,6 @@ private:
QT_END_NAMESPACE
+#include <QtGui/qoffscreensurface_platform.h>
+
#endif // QOFFSCREENSURFACE_H
diff --git a/src/gui/kernel/qoffscreensurface_p.h b/src/gui/kernel/qoffscreensurface_p.h
new file mode 100644
index 0000000000..3de4b5e17a
--- /dev/null
+++ b/src/gui/kernel/qoffscreensurface_p.h
@@ -0,0 +1,59 @@
+// Copyright (C) 2020 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
+
+#ifndef QOFFSCREENSURFACE_P_H
+#define QOFFSCREENSURFACE_P_H
+
+//
+// W A R N I N G
+// -------------
+//
+// This file is not part of the Qt API. It exists purely as an
+// implementation detail. This header file may change from version to
+// version without notice, or even be removed.
+//
+// We mean it.
+//
+
+#include "qplatformoffscreensurface.h"
+
+#include <private/qwindow_p.h>
+
+QT_BEGIN_NAMESPACE
+
+class Q_GUI_EXPORT QOffscreenSurfacePrivate : public QObjectPrivate
+{
+ Q_DECLARE_PUBLIC(QOffscreenSurface)
+
+public:
+ QOffscreenSurfacePrivate()
+ : QObjectPrivate()
+ , surfaceType(QSurface::OpenGLSurface)
+ , platformOffscreenSurface(nullptr)
+ , offscreenWindow(nullptr)
+ , requestedFormat(QSurfaceFormat::defaultFormat())
+ , screen(nullptr)
+ , size(1, 1)
+ {
+ }
+
+ ~QOffscreenSurfacePrivate()
+ {
+ }
+
+ static QOffscreenSurfacePrivate *get(QOffscreenSurface *surface)
+ {
+ return surface ? surface->d_func() : nullptr;
+ }
+
+ QSurface::SurfaceType surfaceType;
+ QPlatformOffscreenSurface *platformOffscreenSurface;
+ QWindow *offscreenWindow;
+ QSurfaceFormat requestedFormat;
+ QScreen *screen;
+ QSize size;
+};
+
+QT_END_NAMESPACE
+
+#endif // QOFFSCREENSURFACE_P_H
diff --git a/src/gui/kernel/qoffscreensurface_platform.h b/src/gui/kernel/qoffscreensurface_platform.h
new file mode 100644
index 0000000000..33e72c7e17
--- /dev/null
+++ b/src/gui/kernel/qoffscreensurface_platform.h
@@ -0,0 +1,41 @@
+// Copyright (C) 2020 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
+
+#ifndef QOFFSCREENSURFACE_PLATFORM_H
+#define QOFFSCREENSURFACE_PLATFORM_H
+
+//
+// W A R N I N G
+// -------------
+//
+// This file is part of the native interface APIs. Usage of
+// this API may make your code source and binary incompatible
+// with future versions of Qt.
+//
+
+#include <QtGui/qtguiglobal.h>
+#include <QtGui/qoffscreensurface.h>
+#include <QtCore/qnativeinterface.h>
+
+#if defined(Q_OS_ANDROID)
+struct ANativeWindow;
+#endif
+
+QT_BEGIN_NAMESPACE
+
+namespace QNativeInterface {
+
+#if defined(Q_OS_ANDROID) || defined(Q_QDOC)
+struct Q_GUI_EXPORT QAndroidOffscreenSurface
+{
+ QT_DECLARE_NATIVE_INTERFACE(QAndroidOffscreenSurface, 1, QOffscreenSurface)
+ static QOffscreenSurface *fromNative(ANativeWindow *nativeSurface);
+ virtual ANativeWindow *nativeSurface() const = 0;
+};
+#endif
+
+} // QNativeInterface
+
+QT_END_NAMESPACE
+
+#endif // QOFFSCREENSURFACE_PLATFORM_H
diff --git a/src/gui/kernel/qopenglcontext.cpp b/src/gui/kernel/qopenglcontext.cpp
index 124b39f2a9..dd41318f72 100644
--- a/src/gui/kernel/qopenglcontext.cpp
+++ b/src/gui/kernel/qopenglcontext.cpp
@@ -1,41 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the QtGui module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#include <qpa/qplatformopenglcontext.h>
#include <qpa/qplatformintegration.h>
@@ -54,171 +18,11 @@
#include <qpa/qplatformnativeinterface.h>
#include <private/qopenglextensions_p.h>
-#include <private/qopenglversionfunctionsfactory_p.h>
-
-#include <private/qopengltexturehelper_p.h>
#include <QDebug>
-#ifndef QT_OPENGL_ES_2
-#include <QOpenGLFunctions_1_0>
-#include <QOpenGLFunctions_3_2_Core>
-#endif
-
QT_BEGIN_NAMESPACE
-class QOpenGLVersionProfilePrivate
-{
-public:
- QOpenGLVersionProfilePrivate()
- : majorVersion(0),
- minorVersion(0),
- profile(QSurfaceFormat::NoProfile)
- {}
-
- int majorVersion;
- int minorVersion;
- QSurfaceFormat::OpenGLContextProfile profile;
-};
-
-
-/*!
- \class QOpenGLVersionProfile
- \inmodule QtGui
- \since 5.1
- \brief The QOpenGLVersionProfile class represents the version and if applicable
- the profile of an OpenGL context.
-
- An object of this class can be passed to QOpenGLContext::versionFunctions() to
- request a functions object for a specific version and profile of OpenGL.
-
- It also contains some helper functions to check if a version supports profiles
- or is a legacy version.
-*/
-
-/*!
- Creates a default invalid QOpenGLVersionProfile object.
-*/
-QOpenGLVersionProfile::QOpenGLVersionProfile()
- : d(new QOpenGLVersionProfilePrivate)
-{
-}
-
-/*!
- Creates a QOpenGLVersionProfile object initialised with the version and profile
- from \a format.
-*/
-QOpenGLVersionProfile::QOpenGLVersionProfile(const QSurfaceFormat &format)
- : d(new QOpenGLVersionProfilePrivate)
-{
- d->majorVersion = format.majorVersion();
- d->minorVersion = format.minorVersion();
- d->profile = format.profile();
-}
-
-/*!
- Constructs a copy of \a other.
-*/
-QOpenGLVersionProfile::QOpenGLVersionProfile(const QOpenGLVersionProfile &other)
- : d(new QOpenGLVersionProfilePrivate)
-{
- *d = *(other.d);
-}
-
-/*!
- Destroys the QOpenGLVersionProfile object.
-*/
-QOpenGLVersionProfile::~QOpenGLVersionProfile()
-{
- delete d;
-}
-
-/*!
- Assigns the version and profile of \a rhs to this QOpenGLVersionProfile object.
-*/
-QOpenGLVersionProfile &QOpenGLVersionProfile::operator=(const QOpenGLVersionProfile &rhs)
-{
- if (this == &rhs)
- return *this;
- *d = *(rhs.d);
- return *this;
-}
-
-/*!
- Returns a QPair<int,int> where the components represent the major and minor OpenGL
- version numbers respectively.
-
- \sa setVersion()
-*/
-QPair<int, int> QOpenGLVersionProfile::version() const
-{
- return qMakePair( d->majorVersion, d->minorVersion);
-}
-
-/*!
- Sets the major and minor version numbers to \a majorVersion and \a minorVersion respectively.
-
- \sa version()
-*/
-void QOpenGLVersionProfile::setVersion(int majorVersion, int minorVersion)
-{
- d->majorVersion = majorVersion;
- d->minorVersion = minorVersion;
-}
-
-/*!
- Returns the OpenGL profile. Only makes sense if profiles are supported by this version.
-
- \sa setProfile()
-*/
-QSurfaceFormat::OpenGLContextProfile QOpenGLVersionProfile::profile() const
-{
- return d->profile;
-}
-
-/*!
- Sets the OpenGL profile \a profile. Only makes sense if profiles are supported by
- this version.
-
- \sa profile()
-*/
-void QOpenGLVersionProfile::setProfile(QSurfaceFormat::OpenGLContextProfile profile)
-{
- d->profile = profile;
-}
-
-/*!
- Returns \c true if profiles are supported by the OpenGL version returned by version(). Only
- OpenGL versions >= 3.2 support profiles.
-
- \sa profile(), version()
-*/
-bool QOpenGLVersionProfile::hasProfiles() const
-{
- return ( d->majorVersion > 3
- || (d->majorVersion == 3 && d->minorVersion > 1));
-}
-
-/*!
- Returns \c true is the OpenGL version returned by version() contains deprecated functions
- and does not support profiles i.e. if the OpenGL version is <= 3.1.
-*/
-bool QOpenGLVersionProfile::isLegacyVersion() const
-{
- return (d->majorVersion < 3 || (d->majorVersion == 3 && d->minorVersion == 0));
-}
-
-/*!
- Returns \c true if the version number is valid. Note that for a default constructed
- QOpenGLVersionProfile object this function will return \c false.
-
- \sa setVersion(), version()
-*/
-bool QOpenGLVersionProfile::isValid() const
-{
- return d->majorVersion > 0 && d->minorVersion >= 0;
-}
-
class QGuiGLThreadContext
{
public:
@@ -238,7 +42,7 @@ static QOpenGLContext *global_share_context = nullptr;
#ifndef QT_NO_DEBUG
QHash<QOpenGLContext *, bool> QOpenGLContextPrivate::makeCurrentTracker;
-QMutex QOpenGLContextPrivate::makeCurrentTrackerMutex;
+Q_CONSTINIT QMutex QOpenGLContextPrivate::makeCurrentTrackerMutex;
#endif
/*!
@@ -265,6 +69,7 @@ QOpenGLContext *qt_gl_global_share_context()
/*!
\class QOpenGLContext
+ \ingroup painting-3D
\inmodule QtGui
\since 5.0
\brief The QOpenGLContext class represents a native OpenGL context, enabling
@@ -333,6 +138,22 @@ QOpenGLContext *qt_gl_global_share_context()
application is portable between different platforms. However, if you use
QOpenGLFunctions::glBindFramebuffer(), this is done automatically for you.
+ \warning WebAssembly
+
+ We recommend that only one QOpenGLContext is made current with a QSurface,
+ for the entire lifetime of the QSurface. Should more than once context be used,
+ it is important to understand that multiple QOpenGLContext instances may be
+ backed by the same native context underneath with the WebAssembly platform.
+ Therefore, calling makeCurrent() with the same QSurface on two QOpenGLContext
+ objects may not switch to a different native context in the second call. As
+ a result, any OpenGL state changes done after the second makeCurrent() may
+ alter the state of the first QOpenGLContext as well, as they are all backed
+ by the same native context.
+
+ \note This means that when targeting WebAssembly with existing OpenGL-based
+ Qt code, some porting may be required to cater to these limitations.
+
+
\sa QOpenGLFunctions, QOpenGLBuffer, QOpenGLShaderProgram, QOpenGLFramebufferObject
*/
@@ -349,6 +170,9 @@ QOpenGLContext *QOpenGLContextPrivate::setCurrentContext(QOpenGLContext *context
qWarning("No QTLS available. currentContext won't work");
return nullptr;
}
+ if (!context)
+ return nullptr;
+
threadContext = new QGuiGLThreadContext;
qwindow_context_storage()->setLocalData(threadContext);
}
@@ -366,7 +190,7 @@ int QOpenGLContextPrivate::maxTextureSize()
QOpenGLFunctions *funcs = q->functions();
funcs->glGetIntegerv(GL_MAX_TEXTURE_SIZE, &max_texture_size);
-#ifndef QT_OPENGL_ES
+#if !QT_CONFIG(opengles2)
if (!q->isOpenGLES()) {
GLenum proxy = GL_PROXY_TEXTURE_2D;
@@ -374,20 +198,8 @@ int QOpenGLContextPrivate::maxTextureSize()
GLint next = 64;
funcs->glTexImage2D(proxy, 0, GL_RGBA, next, next, 0, GL_RGBA, GL_UNSIGNED_BYTE, nullptr);
- QOpenGLFunctions_1_0 *gl1funcs = nullptr;
- QOpenGLFunctions_3_2_Core *gl3funcs = nullptr;
-
- if (q->format().profile() == QSurfaceFormat::CoreProfile)
- gl3funcs = q->versionFunctions<QOpenGLFunctions_3_2_Core>();
- else
- gl1funcs = q->versionFunctions<QOpenGLFunctions_1_0>();
-
- Q_ASSERT(gl1funcs || gl3funcs);
-
- if (gl1funcs)
- gl1funcs->glGetTexLevelParameteriv(proxy, 0, GL_TEXTURE_WIDTH, &size);
- else
- gl3funcs->glGetTexLevelParameteriv(proxy, 0, GL_TEXTURE_WIDTH, &size);
+ QOpenGLExtraFunctions *extraFuncs = q->extraFunctions();
+ extraFuncs->glGetTexLevelParameteriv(proxy, 0, GL_TEXTURE_WIDTH, &size);
if (size == 0) {
return max_texture_size;
@@ -399,16 +211,12 @@ int QOpenGLContextPrivate::maxTextureSize()
if (next > max_texture_size)
break;
funcs->glTexImage2D(proxy, 0, GL_RGBA, next, next, 0, GL_RGBA, GL_UNSIGNED_BYTE, nullptr);
- if (gl1funcs)
- gl1funcs->glGetTexLevelParameteriv(proxy, 0, GL_TEXTURE_WIDTH, &next);
- else
- gl3funcs->glGetTexLevelParameteriv(proxy, 0, GL_TEXTURE_WIDTH, &next);
-
+ extraFuncs->glGetTexLevelParameteriv(proxy, 0, GL_TEXTURE_WIDTH, &next);
} while (next > size);
max_texture_size = size;
}
-#endif // QT_OPENGL_ES
+#endif // QT_CONFIG(opengles2)
return max_texture_size;
}
@@ -523,63 +331,17 @@ void QOpenGLContextPrivate::_q_screenDestroyed(QObject *object)
}
/*!
- Set the native handles for this context. When create() is called and a
- native handle is set, configuration settings, like format(), are ignored
- since this QOpenGLContext will wrap an already created native context
- instead of creating a new one from scratch.
-
- On some platforms the native context handle is not sufficient and other
- related handles (for example, for a window or display) have to be provided
- in addition. Therefore \a handle is variant containing a platform-specific
- value type. These classes can be found in the QtPlatformHeaders module.
-
- When create() is called with native handles set, QOpenGLContext does not
- take ownership of the handles, so destroying the QOpenGLContext does not
- destroy the native context.
-
- \note Some frameworks track the current context and surfaces internally.
- Making the adopted QOpenGLContext current via Qt will have no effect on such
- other frameworks' internal state. Therefore a subsequent makeCurrent done
- via the other framework may have no effect. It is therefore advisable to
- make explicit calls to make no context and surface current to reset the
- other frameworks' internal state after performing OpenGL operations via Qt.
-
- \note Using foreign contexts with Qt windows and Qt contexts with windows
- and surfaces created by other frameworks may give unexpected results,
- depending on the platform, due to potential mismatches in context and window
- pixel formats. To make sure this does not happen, avoid making contexts and
- surfaces from different frameworks current together. Instead, prefer
- approaches based on context sharing where OpenGL resources like textures are
- accessible both from Qt's and the foreign framework's contexts.
-
- \since 5.4
- \sa nativeHandle()
-*/
-void QOpenGLContext::setNativeHandle(const QVariant &handle)
-{
- Q_D(QOpenGLContext);
- d->nativeHandle = handle;
-}
+ \fn template <typename QNativeInterface> QNativeInterface *QOpenGLContext::nativeInterface() const
-/*!
- Returns the native handle for the context.
+ Returns a native interface of the given type for the context.
- This function provides access to the QOpenGLContext's underlying native
- context. The returned variant contains a platform-specific value type. These
- classes can be found in the module QtPlatformHeaders.
+ This function provides access to platform specific functionality
+ of QOpenGLContext, as defined in the QNativeInterface namespace:
- On platforms where retrieving the native handle is not supported, or if
- neither create() nor setNativeHandle() was called, a null variant is
- returned.
+ \annotatedlist native-interfaces-qopenglcontext
- \since 5.4
- \sa setNativeHandle()
+ If the requested interface is not available a \nullptr is returned.
*/
-QVariant QOpenGLContext::nativeHandle() const
-{
- Q_D(const QOpenGLContext);
- return d->nativeHandle;
-}
/*!
Attempts to create the OpenGL context with the current configuration.
@@ -609,18 +371,33 @@ bool QOpenGLContext::create()
if (d->platformGLContext)
destroy();
- d->platformGLContext = QGuiApplicationPrivate::platformIntegration()->createPlatformOpenGLContext(this);
- if (!d->platformGLContext)
+ auto *platformContext = QGuiApplicationPrivate::platformIntegration()->createPlatformOpenGLContext(this);
+ if (!platformContext)
return false;
- d->platformGLContext->setContext(this);
- d->platformGLContext->initialize();
- if (!d->platformGLContext->isSharing())
- d->shareContext = nullptr;
- d->shareGroup = d->shareContext ? d->shareContext->shareGroup() : new QOpenGLContextGroup;
- d->shareGroup->d_func()->addContext(this);
+
+ d->adopt(platformContext);
+
return isValid();
}
+QOpenGLContextPrivate::~QOpenGLContextPrivate()
+{
+}
+
+void QOpenGLContextPrivate::adopt(QPlatformOpenGLContext *context)
+{
+ Q_Q(QOpenGLContext);
+
+ platformGLContext = context;
+ platformGLContext->setContext(q);
+ platformGLContext->initialize();
+
+ if (!platformGLContext->isSharing())
+ shareContext = nullptr;
+ shareGroup = shareContext ? shareContext->shareGroup() : new QOpenGLContextGroup;
+ shareGroup->d_func()->addContext(q);
+}
+
/*!
\internal
@@ -641,33 +418,48 @@ bool QOpenGLContext::create()
*/
void QOpenGLContext::destroy()
{
- deleteQGLContext();
Q_D(QOpenGLContext);
+
+ // Notify that the native context and the QPlatformOpenGLContext are going
+ // to go away.
if (d->platformGLContext)
emit aboutToBeDestroyed();
+
+ // Invoke callbacks for helpers and invalidate.
+ if (d->textureFunctionsDestroyCallback) {
+ d->textureFunctionsDestroyCallback();
+ d->textureFunctionsDestroyCallback = nullptr;
+ }
+ d->textureFunctions = nullptr;
+
+ delete d->versionFunctions;
+ d->versionFunctions = nullptr;
+
+ if (d->vaoHelperDestroyCallback) {
+ Q_ASSERT(d->vaoHelper);
+ d->vaoHelperDestroyCallback(d->vaoHelper);
+ d->vaoHelperDestroyCallback = nullptr;
+ }
+ d->vaoHelper = nullptr;
+
+ // Tear down function wrappers.
+ delete d->versionFunctions;
+ d->versionFunctions = nullptr;
+
+ delete d->functions;
+ d->functions = nullptr;
+
+ // Clean up and destroy the native context machinery.
if (QOpenGLContext::currentContext() == this)
doneCurrent();
+
if (d->shareGroup)
d->shareGroup->d_func()->removeContext(this);
+
d->shareGroup = nullptr;
+
delete d->platformGLContext;
d->platformGLContext = nullptr;
- delete d->functions;
- d->functions = nullptr;
-
- for (QAbstractOpenGLFunctions *func : qAsConst(d->externalVersionFunctions)) {
- QAbstractOpenGLFunctionsPrivate *func_d = QAbstractOpenGLFunctionsPrivate::get(func);
- func_d->owningContext = nullptr;
- func_d->initialized = false;
- }
- d->externalVersionFunctions.clear();
- qDeleteAll(d->versionFunctions);
- d->versionFunctions.clear();
-
- delete d->textureFunctions;
- d->textureFunctions = nullptr;
-
- d->nativeHandle = QVariant();
}
/*!
@@ -679,6 +471,11 @@ void QOpenGLContext::destroy()
If you wish to make the context current in order to do clean-up, make sure
to only connect to the signal using a direct connection.
+
+ \note In Qt for Python, this signal will not be received when emitted
+ from the destructor of QOpenGLWidget or QOpenGLWindow due to the Python
+ instance already being destroyed. We recommend doing cleanups
+ in QWidget::hideEvent() instead.
*/
/*!
@@ -707,6 +504,14 @@ QOpenGLContext::~QOpenGLContext()
OpenGL context by calling create(), call makeCurrent() again and then
reinitialize all OpenGL resources.
+ On some platforms context loss situations is not something that can
+ avoided. On others however, they may need to be opted-in to. This can be
+ done by enabling \l{QSurfaceFormat::ResetNotification}{ResetNotification} in
+ the QSurfaceFormat. This will lead to setting
+ \c{RESET_NOTIFICATION_STRATEGY_EXT} to \c{LOSE_CONTEXT_ON_RESET_EXT} in the
+ underlying native OpenGL context. QOpenGLContext will then monitor the
+ status via \c{glGetGraphicsResetStatusEXT()} in every makeCurrent().
+
\sa create()
*/
bool QOpenGLContext::isValid() const
@@ -757,115 +562,6 @@ QOpenGLExtraFunctions *QOpenGLContext::extraFunctions() const
}
/*!
- \fn T *QOpenGLContext::versionFunctions() const
-
- \overload versionFunctions()
-
- Returns a pointer to an object that provides access to all functions for
- the version and profile of this context. There is no need to call
- QAbstractOpenGLFunctions::initializeOpenGLFunctions() as long as this context
- is current. It is also possible to call this function when the context is not
- current, but in that case it is the caller's responsibility to ensure proper
- initialization by calling QAbstractOpenGLFunctions::initializeOpenGLFunctions()
- afterwards.
-
- Usually one would use the template version of this function to automatically
- have the result cast to the correct type.
-
- \code
- QOpenGLFunctions_3_3_Core* funcs = 0;
- funcs = context->versionFunctions<QOpenGLFunctions_3_3_Core>();
- if (!funcs) {
- qWarning() << "Could not obtain required OpenGL context version";
- exit(1);
- }
- \endcode
-
- It is possible to request a functions object for a different version and profile
- than that for which the context was created. To do this either use the template
- version of this function specifying the desired functions object type as the
- template parameter or by passing in a QOpenGLVersionProfile object as an argument
- to the non-template function.
-
- Note that requests for function objects of other versions or profiles can fail and
- in doing so will return \nullptr. Situations in which creation of the functions
- object can fail are if the request cannot be satisfied due to asking for functions
- that are not in the version or profile of this context. For example:
-
- \list
- \li Requesting a 3.3 core profile functions object would succeed.
- \li Requesting a 3.3 compatibility profile functions object would fail. We would fail
- to resolve the deprecated functions.
- \li Requesting a 4.3 core profile functions object would fail. We would fail to resolve
- the new core functions introduced in versions 4.0-4.3.
- \li Requesting a 3.1 functions object would succeed. There is nothing in 3.1 that is not
- also in 3.3 core.
- \endlist
-
- Note that if creating a functions object via this method that the QOpenGLContext
- retains ownership of the object. This is to allow the object to be cached and shared.
-*/
-
-/*!
- Returns a pointer to an object that provides access to all functions for the
- \a versionProfile of this context. There is no need to call
- QAbstractOpenGLFunctions::initializeOpenGLFunctions() as long as this context
- is current. It is also possible to call this function when the context is not
- current, but in that case it is the caller's responsibility to ensure proper
- initialization by calling QAbstractOpenGLFunctions::initializeOpenGLFunctions()
- afterwards.
-
- Usually one would use the template version of this function to automatically
- have the result cast to the correct type.
-*/
-QAbstractOpenGLFunctions *QOpenGLContext::versionFunctions(const QOpenGLVersionProfile &versionProfile) const
-{
-#ifndef QT_OPENGL_ES_2
- if (isOpenGLES()) {
- qWarning("versionFunctions: Not supported on OpenGL ES");
- return nullptr;
- }
-#endif // QT_OPENGL_ES_2
-
- Q_D(const QOpenGLContext);
- const QSurfaceFormat f = format();
-
- // Ensure we have a valid version and profile. Default to context's if none specified
- QOpenGLVersionProfile vp = versionProfile;
- if (!vp.isValid())
- vp = QOpenGLVersionProfile(f);
-
- // Check that context is compatible with requested version
- const QPair<int, int> v = qMakePair(f.majorVersion(), f.minorVersion());
- if (v < vp.version())
- return nullptr;
-
- // If this context only offers core profile functions then we can't create
- // function objects for legacy or compatibility profile requests
- if (((vp.hasProfiles() && vp.profile() != QSurfaceFormat::CoreProfile) || vp.isLegacyVersion())
- && f.profile() == QSurfaceFormat::CoreProfile)
- return nullptr;
-
- // Create object if suitable one not cached
- QAbstractOpenGLFunctions* funcs = nullptr;
- auto it = d->versionFunctions.constFind(vp);
- if (it == d->versionFunctions.constEnd()) {
- funcs = QOpenGLVersionFunctionsFactory::create(vp);
- if (funcs) {
- funcs->setOwningContext(this);
- d->versionFunctions.insert(vp, funcs);
- }
- } else {
- funcs = it.value();
- }
-
- if (funcs && QOpenGLContext::currentContext() == this)
- funcs->initializeOpenGLFunctions();
-
- return funcs;
-}
-
-/*!
Returns the set of OpenGL extensions supported by this context.
The context or a sharing context must be current.
@@ -941,7 +637,7 @@ GLuint QOpenGLContext::defaultFramebufferObject() const
The latter may happen if the surface is not exposed, or the graphics
hardware is not available due to e.g. the application being suspended.
- If \a surface is 0 this is equivalent to calling doneCurrent().
+ If \a surface is \nullptr this is equivalent to calling doneCurrent().
Avoid calling this function from a different thread than the one the
QOpenGLContext instance lives in. If you wish to use QOpenGLContext from a
@@ -1023,7 +719,8 @@ bool QOpenGLContext::makeCurrent(QSurface *surface)
|| qstrcmp(rendererString, "GC800 core") == 0
|| qstrcmp(rendererString, "GC1000 core") == 0
|| strstr(rendererString, "GC2000") != nullptr
- || qstrcmp(rendererString, "Immersion.16") == 0;
+ || qstrcmp(rendererString, "Immersion.16") == 0
+ || qstrncmp(rendererString, "Apple Mx", 7) == 0;
}
needsWorkaroundSet = true;
}
@@ -1093,12 +790,6 @@ void QOpenGLContext::swapBuffers(QSurface *surface)
return;
}
- if (surface->surfaceClass() == QSurface::Window
- && !qt_window_private(static_cast<QWindow *>(surface))->receivedExpose)
- {
- qWarning("QOpenGLContext::swapBuffers() called with non-exposed window, behavior is undefined");
- }
-
QPlatformSurface *surfaceHandle = surface->surfaceHandle();
if (!surfaceHandle)
return;
@@ -1192,71 +883,6 @@ QScreen *QOpenGLContext::screen() const
}
/*!
- internal: Needs to have a pointer to qGLContext. But since this is in Qt GUI we can't
- have any type information.
-
- \internal
-*/
-void *QOpenGLContext::qGLContextHandle() const
-{
- Q_D(const QOpenGLContext);
- return d->qGLContextHandle;
-}
-
-/*!
- internal: If the delete function is specified QOpenGLContext "owns"
- the passed context handle and will use the delete function to destroy it.
-
- \internal
-*/
-void QOpenGLContext::setQGLContextHandle(void *handle,void (*qGLContextDeleteFunction)(void *))
-{
- Q_D(QOpenGLContext);
- d->qGLContextHandle = handle;
- d->qGLContextDeleteFunction = qGLContextDeleteFunction;
-}
-
-/*!
- \internal
-*/
-void QOpenGLContext::deleteQGLContext()
-{
- Q_D(QOpenGLContext);
- if (d->qGLContextDeleteFunction && d->qGLContextHandle) {
- d->qGLContextDeleteFunction(d->qGLContextHandle);
- d->qGLContextDeleteFunction = nullptr;
- d->qGLContextHandle = nullptr;
- }
-}
-
-/*!
- Returns the platform-specific handle for the OpenGL implementation that
- is currently in use. (for example, a HMODULE on Windows)
-
- On platforms that do not use dynamic GL switching, the return value
- is \nullptr.
-
- The library might be GL-only, meaning that windowing system interface
- functions (for example EGL) may live in another, separate library.
-
- \note This function requires that the QGuiApplication instance is already created.
-
- \sa openGLModuleType()
-
- \since 5.3
- */
-void *QOpenGLContext::openGLModuleHandle()
-{
-#ifdef QT_OPENGL_DYNAMIC
- QPlatformNativeInterface *ni = QGuiApplication::platformNativeInterface();
- Q_ASSERT(ni);
- return ni->nativeResourceForIntegration(QByteArrayLiteral("glhandle"));
-#else
- return nullptr;
-#endif
-}
-
-/*!
\enum QOpenGLContext::OpenGLModuleType
This enum defines the type of the underlying OpenGL implementation.
@@ -1287,7 +913,7 @@ QOpenGLContext::OpenGLModuleType QOpenGLContext::openGLModuleType()
#if defined(QT_OPENGL_DYNAMIC)
Q_ASSERT(qGuiApp);
return QGuiApplicationPrivate::instance()->platformIntegration()->openGLModuleType();
-#elif defined(QT_OPENGL_ES_2)
+#elif QT_CONFIG(opengles2)
return LibGLES;
#else
return LibGL;
@@ -1352,33 +978,6 @@ QOpenGLContext *QOpenGLContext::globalShareContext()
/*!
\internal
*/
-QOpenGLVersionFunctionsStorage *QOpenGLContext::functionsBackendStorage() const
-{
- Q_D(const QOpenGLContext);
- return &d->versionFunctionsStorage;
-}
-
-/*!
- \internal
- */
-void QOpenGLContext::insertExternalFunctions(QAbstractOpenGLFunctions *f)
-{
- Q_D(QOpenGLContext);
- d->externalVersionFunctions.insert(f);
-}
-
-/*!
- \internal
- */
-void QOpenGLContext::removeExternalFunctions(QAbstractOpenGLFunctions *f)
-{
- Q_D(QOpenGLContext);
- d->externalVersionFunctions.remove(f);
-}
-
-/*!
- \internal
-*/
QOpenGLTextureHelper* QOpenGLContext::textureFunctions() const
{
Q_D(const QOpenGLContext);
@@ -1388,10 +987,11 @@ QOpenGLTextureHelper* QOpenGLContext::textureFunctions() const
/*!
\internal
*/
-void QOpenGLContext::setTextureFunctions(QOpenGLTextureHelper* textureFuncs)
+void QOpenGLContext::setTextureFunctions(QOpenGLTextureHelper* textureFuncs, std::function<void()> destroyCallback)
{
Q_D(QOpenGLContext);
d->textureFunctions = textureFuncs;
+ d->textureFunctionsDestroyCallback = destroyCallback;
}
/*!
@@ -1441,6 +1041,9 @@ QOpenGLContextGroup *QOpenGLContextGroup::currentContextGroup()
return current ? current->shareGroup() : nullptr;
}
+QOpenGLContextGroupPrivate::~QOpenGLContextGroupPrivate()
+ = default;
+
void QOpenGLContextGroupPrivate::addContext(QOpenGLContext *ctx)
{
const auto locker = qt_scoped_lock(m_mutex);
@@ -1582,6 +1185,10 @@ void QOpenGLSharedResource::free()
\inmodule QtGui
*/
+
+QOpenGLSharedResourceGuard::~QOpenGLSharedResourceGuard()
+ = default;
+
void QOpenGLSharedResourceGuard::freeResource(QOpenGLContext *context)
{
if (m_id) {
@@ -1654,14 +1261,14 @@ void QOpenGLMultiGroupSharedResource::insert(QOpenGLContext *context, QOpenGLSha
QOpenGLSharedResource *QOpenGLMultiGroupSharedResource::value(QOpenGLContext *context)
{
QOpenGLContextGroup *group = context->shareGroup();
- return group->d_func()->m_resources.value(this, 0);
+ return group->d_func()->m_resources.value(this, nullptr);
}
QList<QOpenGLSharedResource *> QOpenGLMultiGroupSharedResource::resources() const
{
QList<QOpenGLSharedResource *> result;
for (QList<QOpenGLContextGroup *>::const_iterator it = m_groups.constBegin(); it != m_groups.constEnd(); ++it) {
- QOpenGLSharedResource *resource = (*it)->d_func()->m_resources.value(const_cast<QOpenGLMultiGroupSharedResource *>(this), 0);
+ QOpenGLSharedResource *resource = (*it)->d_func()->m_resources.value(const_cast<QOpenGLMultiGroupSharedResource *>(this), nullptr);
if (resource)
result << resource;
}
@@ -1681,22 +1288,10 @@ void QOpenGLMultiGroupSharedResource::cleanup(QOpenGLContextGroup *group, QOpenG
m_groups.removeOne(group);
}
-#ifndef QT_NO_DEBUG_STREAM
-QDebug operator<<(QDebug debug, const QOpenGLVersionProfile &vp)
-{
- QDebugStateSaver saver(debug);
- debug.nospace();
- debug << "QOpenGLVersionProfile(";
- if (vp.isValid()) {
- debug << vp.version().first << '.' << vp.version().second
- << ", profile=" << vp.profile();
- } else {
- debug << "invalid";
- }
- debug << ')';
- return debug;
-}
+QOpenGLContextVersionFunctionHelper::~QOpenGLContextVersionFunctionHelper()
+ = default;
+#ifndef QT_NO_DEBUG_STREAM
QDebug operator<<(QDebug debug, const QOpenGLContext *ctx)
{
QDebugStateSaver saver(debug);
@@ -1706,8 +1301,7 @@ QDebug operator<<(QDebug debug, const QOpenGLContext *ctx)
if (ctx) {
debug << static_cast<const void *>(ctx);
if (ctx->isValid()) {
- debug << ", nativeHandle=" << ctx->nativeHandle()
- << ", format=" << ctx->format();
+ debug << ", format=" << ctx->format();
if (const QSurface *sf = ctx->surface())
debug << ", surface=" << sf;
if (const QScreen *s = ctx->screen())
@@ -1736,6 +1330,31 @@ QDebug operator<<(QDebug debug, const QOpenGLContextGroup *cg)
}
#endif // QT_NO_DEBUG_STREAM
-#include "moc_qopenglcontext.cpp"
+using namespace QNativeInterface;
+
+void *QOpenGLContext::resolveInterface(const char *name, int revision) const
+{
+ Q_UNUSED(name); Q_UNUSED(revision);
+
+ auto *platformContext = handle();
+ Q_UNUSED(platformContext);
+
+#if defined(Q_OS_MACOS)
+ QT_NATIVE_INTERFACE_RETURN_IF(QCocoaGLContext, platformContext);
+#endif
+#if defined(Q_OS_WIN)
+ QT_NATIVE_INTERFACE_RETURN_IF(QWGLContext, platformContext);
+#endif
+#if QT_CONFIG(xcb_glx_plugin)
+ QT_NATIVE_INTERFACE_RETURN_IF(QGLXContext, platformContext);
+#endif
+#if QT_CONFIG(egl)
+ QT_NATIVE_INTERFACE_RETURN_IF(QEGLContext, platformContext);
+#endif
+
+ return nullptr;
+}
QT_END_NAMESPACE
+
+#include "moc_qopenglcontext.cpp"
diff --git a/src/gui/kernel/qopenglcontext.h b/src/gui/kernel/qopenglcontext.h
index 9cfaa52f17..ca2d4a8903 100644
--- a/src/gui/kernel/qopenglcontext.h
+++ b/src/gui/kernel/qopenglcontext.h
@@ -1,41 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the QtGui module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#ifndef QOPENGLCONTEXT_H
#define QOPENGLCONTEXT_H
@@ -45,8 +9,10 @@
#ifndef QT_NO_OPENGL
#include <QtCore/qnamespace.h>
-#include <QtCore/QObject>
-#include <QtCore/QScopedPointer>
+#include <QtCore/qobject.h>
+#include <QtCore/qscopedpointer.h>
+#include <QtCore/qset.h>
+#include <QtCore/qnativeinterface.h>
#include <QtGui/QSurfaceFormat>
@@ -58,13 +24,7 @@
#endif
#include <QtGui/qopengl.h>
-#include <QtGui/qopenglversionfunctions.h>
-#if QT_DEPRECATED_SINCE(5, 6)
-#include <QtCore/qhash.h>
-#endif
-#include <QtCore/qhashfunctions.h>
-#include <QtCore/qpair.h>
#include <QtCore/qvariant.h>
QT_BEGIN_NAMESPACE
@@ -79,50 +39,6 @@ class QPlatformOpenGLContext;
class QScreen;
class QSurface;
-class QOpenGLVersionProfilePrivate;
-
-class Q_GUI_EXPORT QOpenGLVersionProfile
-{
-public:
- QOpenGLVersionProfile();
- explicit QOpenGLVersionProfile(const QSurfaceFormat &format);
- QOpenGLVersionProfile(const QOpenGLVersionProfile &other);
- ~QOpenGLVersionProfile();
-
- QOpenGLVersionProfile &operator=(const QOpenGLVersionProfile &rhs);
-
- QPair<int, int> version() const;
- void setVersion(int majorVersion, int minorVersion);
-
- QSurfaceFormat::OpenGLContextProfile profile() const;
- void setProfile(QSurfaceFormat::OpenGLContextProfile profile);
-
- bool hasProfiles() const;
- bool isLegacyVersion() const;
- bool isValid() const;
-
-private:
- QOpenGLVersionProfilePrivate* d;
-};
-
-inline uint qHash(const QOpenGLVersionProfile &v, uint seed = 0)
-{
- return qHash(static_cast<int>(v.profile() * 1000)
- + v.version().first * 100 + v.version().second * 10, seed);
-}
-
-inline bool operator==(const QOpenGLVersionProfile &lhs, const QOpenGLVersionProfile &rhs)
-{
- if (lhs.profile() != rhs.profile())
- return false;
- return lhs.version() == rhs.version();
-}
-
-inline bool operator!=(const QOpenGLVersionProfile &lhs, const QOpenGLVersionProfile &rhs)
-{
- return !operator==(lhs, rhs);
-}
-
class Q_GUI_EXPORT QOpenGLContextGroup : public QObject
{
Q_OBJECT
@@ -138,6 +54,7 @@ private:
QOpenGLContextGroup();
friend class QOpenGLContext;
+ friend class QOpenGLContextPrivate;
friend class QOpenGLContextGroupResourceBase;
friend class QOpenGLSharedResource;
friend class QOpenGLMultiGroupSharedResource;
@@ -157,7 +74,6 @@ public:
void setFormat(const QSurfaceFormat &format);
void setShareContext(QOpenGLContext *shareContext);
void setScreen(QScreen *screen);
- void setNativeHandle(const QVariant &handle);
bool create();
bool isValid() const;
@@ -166,7 +82,6 @@ public:
QOpenGLContext *shareContext() const;
QOpenGLContextGroup *shareGroup() const;
QScreen *screen() const;
- QVariant nativeHandle() const;
GLuint defaultFramebufferObject() const;
@@ -188,20 +103,9 @@ public:
QOpenGLFunctions *functions() const;
QOpenGLExtraFunctions *extraFunctions() const;
- QAbstractOpenGLFunctions *versionFunctions(const QOpenGLVersionProfile &versionProfile = QOpenGLVersionProfile()) const;
-
- template<class TYPE>
- TYPE *versionFunctions() const
- {
- QOpenGLVersionProfile v = TYPE::versionProfile();
- return static_cast<TYPE*>(versionFunctions(v));
- }
-
QSet<QByteArray> extensions() const;
bool hasExtension(const QByteArray &extension) const;
- static void *openGLModuleHandle();
-
enum OpenGLModuleType {
LibGL,
LibGLES
@@ -214,12 +118,12 @@ public:
static bool supportsThreadedOpenGL();
static QOpenGLContext *globalShareContext();
+ QT_DECLARE_NATIVE_INTERFACE_ACCESSOR(QOpenGLContext)
+
Q_SIGNALS:
void aboutToBeDestroyed();
private:
- friend class QGLContext;
- friend class QGLPixelBuffer;
friend class QOpenGLContextResourceBase;
friend class QOpenGLPaintDevice;
friend class QOpenGLGlyphTexture;
@@ -234,16 +138,8 @@ private:
friend class QAbstractOpenGLFunctionsPrivate;
friend class QOpenGLTexturePrivate;
- void *qGLContextHandle() const;
- void setQGLContextHandle(void *handle,void (*qGLContextDeleteFunction)(void *));
- void deleteQGLContext();
-
- QOpenGLVersionFunctionsStorage* functionsBackendStorage() const;
- void insertExternalFunctions(QAbstractOpenGLFunctions *f);
- void removeExternalFunctions(QAbstractOpenGLFunctions *f);
-
QOpenGLTextureHelper* textureFunctions() const;
- void setTextureFunctions(QOpenGLTextureHelper* textureFuncs);
+ void setTextureFunctions(QOpenGLTextureHelper* textureFuncs, std::function<void()> destroyCallback);
void destroy();
@@ -251,13 +147,14 @@ private:
};
#ifndef QT_NO_DEBUG_STREAM
-Q_GUI_EXPORT QDebug operator<<(QDebug debug, const QOpenGLVersionProfile &vp);
Q_GUI_EXPORT QDebug operator<<(QDebug debug, const QOpenGLContext *ctx);
Q_GUI_EXPORT QDebug operator<<(QDebug debug, const QOpenGLContextGroup *cg);
#endif // !QT_NO_DEBUG_STREAM
QT_END_NAMESPACE
+#include <QtGui/qopenglcontext_platform.h>
+
#endif // QT_NO_OPENGL
#endif // QOPENGLCONTEXT_H
diff --git a/src/gui/kernel/qopenglcontext_p.h b/src/gui/kernel/qopenglcontext_p.h
index 833cfb20c3..a0e8eda679 100644
--- a/src/gui/kernel/qopenglcontext_p.h
+++ b/src/gui/kernel/qopenglcontext_p.h
@@ -1,41 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the QtGui module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#ifndef QOPENGLCONTEXT_P_H
#define QOPENGLCONTEXT_P_H
@@ -110,6 +74,7 @@ public:
, m_func(func)
{
}
+ ~QOpenGLSharedResourceGuard() override;
GLuint id() const { return m_id; }
@@ -135,6 +100,7 @@ public:
, m_refs(0)
{
}
+ ~QOpenGLContextGroupPrivate() override;
void addContext(QOpenGLContext *ctx);
void removeContext(QOpenGLContext *ctx);
@@ -174,7 +140,7 @@ public:
// Have to use our own mutex here, not the group's, since
// m_groups has to be protected too against any concurrent access.
QMutexLocker locker(&m_mutex);
- T *resource = static_cast<T *>(group->d_func()->m_resources.value(this, 0));
+ T *resource = static_cast<T *>(group->d_func()->m_resources.value(this, nullptr));
if (!resource) {
resource = new T(context);
insert(context, resource);
@@ -191,21 +157,29 @@ private:
class QPaintEngineEx;
class QOpenGLFunctions;
class QOpenGLTextureHelper;
+class QOpenGLVertexArrayObjectHelper;
+
+class Q_GUI_EXPORT QOpenGLContextVersionFunctionHelper
+{
+public:
+ virtual ~QOpenGLContextVersionFunctionHelper();
+};
class Q_GUI_EXPORT QOpenGLContextPrivate : public QObjectPrivate
{
Q_DECLARE_PUBLIC(QOpenGLContext)
public:
QOpenGLContextPrivate()
- : qGLContextHandle(nullptr)
- , qGLContextDeleteFunction(nullptr)
- , platformGLContext(nullptr)
+ : platformGLContext(nullptr)
, shareContext(nullptr)
, shareGroup(nullptr)
, screen(nullptr)
, surface(nullptr)
, functions(nullptr)
, textureFunctions(nullptr)
+ , versionFunctions(nullptr)
+ , vaoHelper(nullptr)
+ , vaoHelperDestroyCallback(nullptr)
, max_texture_size(-1)
, workaround_brokenFBOReadBack(false)
, workaround_brokenTexSubImage(false)
@@ -218,18 +192,9 @@ public:
requestedFormat = QSurfaceFormat::defaultFormat();
}
- ~QOpenGLContextPrivate()
- {
- //do not delete the QOpenGLContext handle here as it is deleted in
- //QWidgetPrivate::deleteTLSysExtra()
- }
-
- mutable QHash<QOpenGLVersionProfile, QAbstractOpenGLFunctions *> versionFunctions;
- mutable QOpenGLVersionFunctionsStorage versionFunctionsStorage;
- mutable QSet<QAbstractOpenGLFunctions *> externalVersionFunctions;
+ ~QOpenGLContextPrivate() override;
- void *qGLContextHandle;
- void (*qGLContextDeleteFunction)(void *handle);
+ void adopt(QPlatformOpenGLContext *);
QSurfaceFormat requestedFormat;
QPlatformOpenGLContext *platformGLContext;
@@ -240,6 +205,11 @@ public:
QOpenGLFunctions *functions;
mutable QSet<QByteArray> extensionNames;
QOpenGLTextureHelper* textureFunctions;
+ std::function<void()> textureFunctionsDestroyCallback;
+ QOpenGLContextVersionFunctionHelper *versionFunctions;
+ QOpenGLVertexArrayObjectHelper *vaoHelper;
+ using QOpenGLVertexArrayObjectHelperDestroyCallback_t = void (*)(QOpenGLVertexArrayObjectHelper *);
+ QOpenGLVertexArrayObjectHelperDestroyCallback_t vaoHelperDestroyCallback;
GLint max_texture_size;
@@ -256,7 +226,6 @@ public:
// Saves us from querying the driver for the current FBO in most paths.
QOpenGLFramebufferObject *qgl_current_fbo;
- QVariant nativeHandle;
GLuint defaultFboRedirect;
static QOpenGLContext *setCurrentContext(QOpenGLContext *context);
diff --git a/src/gui/kernel/qopenglcontext_platform.h b/src/gui/kernel/qopenglcontext_platform.h
new file mode 100644
index 0000000000..1f84cf6ce3
--- /dev/null
+++ b/src/gui/kernel/qopenglcontext_platform.h
@@ -0,0 +1,93 @@
+// Copyright (C) 2020 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
+
+#ifndef QOPENGLCONTEXT_PLATFORM_H
+#define QOPENGLCONTEXT_PLATFORM_H
+
+//
+// W A R N I N G
+// -------------
+//
+// This file is part of the native interface APIs. Usage of
+// this API may make your code source and binary incompatible
+// with future versions of Qt.
+//
+
+#ifndef QT_NO_OPENGL
+
+#include <QtGui/qtguiglobal.h>
+#include <QtGui/qopenglcontext.h>
+#include <QtGui/qwindowdefs.h>
+
+#include <QtCore/qnativeinterface.h>
+
+#if defined(Q_OS_MACOS)
+Q_FORWARD_DECLARE_OBJC_CLASS(NSOpenGLContext);
+#endif
+
+#if QT_CONFIG(xcb_glx_plugin)
+struct __GLXcontextRec; typedef struct __GLXcontextRec *GLXContext;
+#endif
+#if QT_CONFIG(egl)
+typedef void *EGLContext;
+typedef void *EGLDisplay;
+typedef void *EGLConfig;
+#endif
+
+#if !defined(Q_OS_MACOS) && defined(Q_QDOC)
+typedef void *NSOpenGLContext;
+#endif
+
+QT_BEGIN_NAMESPACE
+
+namespace QNativeInterface {
+
+#if defined(Q_OS_MACOS) || defined(Q_QDOC)
+struct Q_GUI_EXPORT QCocoaGLContext
+{
+ QT_DECLARE_NATIVE_INTERFACE(QCocoaGLContext, 1, QOpenGLContext)
+ static QOpenGLContext *fromNative(QT_IGNORE_DEPRECATIONS(NSOpenGLContext) *context, QOpenGLContext *shareContext = nullptr);
+ virtual QT_IGNORE_DEPRECATIONS(NSOpenGLContext) *nativeContext() const = 0;
+};
+#endif
+
+#if defined(Q_OS_WIN) || defined(Q_QDOC)
+struct Q_GUI_EXPORT QWGLContext
+{
+ QT_DECLARE_NATIVE_INTERFACE(QWGLContext, 1, QOpenGLContext)
+ static HMODULE openGLModuleHandle();
+ static QOpenGLContext *fromNative(HGLRC context, HWND window, QOpenGLContext *shareContext = nullptr);
+ virtual HGLRC nativeContext() const = 0;
+};
+#endif
+
+#if QT_CONFIG(xcb_glx_plugin) || defined(Q_QDOC)
+struct Q_GUI_EXPORT QGLXContext
+{
+ QT_DECLARE_NATIVE_INTERFACE(QGLXContext, 1, QOpenGLContext)
+ static QOpenGLContext *fromNative(GLXContext configBasedContext, QOpenGLContext *shareContext = nullptr);
+ static QOpenGLContext *fromNative(GLXContext visualBasedContext, void *visualInfo, QOpenGLContext *shareContext = nullptr);
+ virtual GLXContext nativeContext() const = 0;
+};
+#endif
+
+#if QT_CONFIG(egl) || defined(Q_QDOC)
+struct Q_GUI_EXPORT QEGLContext
+{
+ QT_DECLARE_NATIVE_INTERFACE(QEGLContext, 1, QOpenGLContext)
+ static QOpenGLContext *fromNative(EGLContext context, EGLDisplay display, QOpenGLContext *shareContext = nullptr);
+ virtual EGLContext nativeContext() const = 0;
+ virtual EGLConfig config() const = 0;
+ virtual EGLDisplay display() const = 0;
+
+ virtual void invalidateContext() = 0;
+};
+#endif
+
+} // QNativeInterface
+
+QT_END_NAMESPACE
+
+#endif // QT_NO_OPENGL
+
+#endif // QOPENGLCONTEXT_PLATFORM_H
diff --git a/src/gui/kernel/qopenglwindow.cpp b/src/gui/kernel/qopenglwindow.cpp
deleted file mode 100644
index 2ea8f43711..0000000000
--- a/src/gui/kernel/qopenglwindow.cpp
+++ /dev/null
@@ -1,698 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the QtGui module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "qopenglwindow.h"
-#include "qpaintdevicewindow_p.h"
-#include <QtGui/QOpenGLFramebufferObject>
-#include <QtGui/QOpenGLPaintDevice>
-#include <QtGui/QOpenGLFunctions>
-#include <QtGui/QOpenGLTextureBlitter>
-#include <QtGui/private/qopenglextensions_p.h>
-#include <QtGui/private/qopenglcontext_p.h>
-#include <QtGui/QMatrix4x4>
-#include <QtGui/QOffscreenSurface>
-
-QT_BEGIN_NAMESPACE
-
-/*!
- \class QOpenGLWindow
- \inmodule QtGui
- \since 5.4
- \brief The QOpenGLWindow class is a convenience subclass of QWindow to perform OpenGL painting.
-
- QOpenGLWindow is an enhanced QWindow that allows easily creating windows that
- perform OpenGL rendering using an API that is compatible with QOpenGLWidget
- and is similar to the legacy QGLWidget. Unlike QOpenGLWidget, QOpenGLWindow
- has no dependency on the widgets module and offers better performance.
-
- A typical application will subclass QOpenGLWindow and reimplement the following
- virtual functions:
-
- \list
-
- \li initializeGL() to perform OpenGL resource initialization
-
- \li resizeGL() to set up the transformation matrices and other window size dependent resources
-
- \li paintGL() to issue OpenGL commands or draw using QPainter
-
- \endlist
-
- To schedule a repaint, call the update() function. Note that this will not
- immediately result in a call to paintGL(). Calling update() multiple times in
- a row will not change the behavior in any way.
-
- This is a slot so it can be connected to a \l QTimer::timeout() signal to
- perform animation. Note however that in the modern OpenGL world it is a much
- better choice to rely on synchronization to the vertical refresh rate of the
- display. See \l{QSurfaceFormat::setSwapInterval()}{setSwapInterval()} on a
- description of the swap interval. With a swap interval of \c 1, which is the
- case on most systems by default, the
- \l{QOpenGLContext::swapBuffers()}{swapBuffers()} call, that is executed
- internally by QOpenGLWindow after each repaint, will block and wait for
- vsync. This means that whenever the swap is done, an update can be scheduled
- again by calling update(), without relying on timers.
-
- To request a specific configuration for the context, use setFormat()
- like for any other QWindow. This allows, among others, requesting a
- given OpenGL version and profile, or enabling depth and stencil
- buffers.
-
- Unlike QWindow, QOpenGLWindow allows opening a painter on itself and perform
- QPainter-based drawing.
-
- QOpenGLWindow supports multiple update behaviors. The default,
- \c NoPartialUpdate is equivalent to a regular, OpenGL-based QWindow or the
- legacy QGLWidget. In contrast, \c PartialUpdateBlit and \c PartialUpdateBlend are
- more in line with QOpenGLWidget's way of working, where there is always an
- extra, dedicated framebuffer object present. These modes allow, by
- sacrificing some performance, redrawing only a smaller area on each paint and
- having the rest of the content preserved from of the previous frame. This is
- useful for applications than render incrementally using QPainter, because
- this way they do not have to redraw the entire window content on each
- paintGL() call.
-
- Similarly to QOpenGLWidget, QOpenGLWindow supports the Qt::AA_ShareOpenGLContexts
- attribute. When enabled, the OpenGL contexts of all QOpenGLWindow instances will share
- with each other. This allows accessing each other's shareable OpenGL resources.
-
- For more information on graphics in Qt, see \l {Graphics}.
- */
-
-/*!
- \enum QOpenGLWindow::UpdateBehavior
-
- This enum describes the update strategy of the QOpenGLWindow.
-
- \value NoPartialUpdate Indicates that the entire window surface will
- redrawn on each update and so no additional framebuffers are needed.
- This is the setting used in most cases and is equivalent to how drawing
- directly via QWindow would function.
-
- \value PartialUpdateBlit Indicates that the drawing performed in paintGL()
- does not cover the entire window. In this case an extra framebuffer object
- is created under the hood, and rendering performed in paintGL() will target
- this framebuffer. This framebuffer is then blitted onto the window surface's
- default framebuffer after each paint. This allows having QPainter-based drawing
- code in paintGL() which only repaints a smaller area at a time, because, unlike
- NoPartialUpdate, the previous content is preserved.
-
- \value PartialUpdateBlend Similar to PartialUpdateBlit, but instead of using
- framebuffer blits, the contents of the extra framebuffer is rendered by
- drawing a textured quad with blending enabled. This, unlike PartialUpdateBlit,
- allows alpha blended content and works even when the glBlitFramebuffer is
- not available. Performance-wise this setting is likely to be somewhat slower
- than PartialUpdateBlit.
- */
-
-/*!
- \fn void QOpenGLWindow::frameSwapped()
-
- This signal is emitted after the potentially blocking
- \l{QOpenGLContext::swapBuffers()}{buffer swap} has been done. Applications
- that wish to continuously repaint synchronized to the vertical refresh,
- should issue an update() upon this signal. This allows for a much smoother
- experience compared to the traditional usage of timers.
-*/
-
-// GLES2 builds won't have these constants with the suffixless names
-#ifndef GL_READ_FRAMEBUFFER
-#define GL_READ_FRAMEBUFFER 0x8CA8
-#endif
-#ifndef GL_DRAW_FRAMEBUFFER
-#define GL_DRAW_FRAMEBUFFER 0x8CA9
-#endif
-
-class QOpenGLWindowPaintDevice : public QOpenGLPaintDevice
-{
-public:
- QOpenGLWindowPaintDevice(QOpenGLWindow *window) : m_window(window) { }
- void ensureActiveTarget() override;
-
- QOpenGLWindow *m_window;
-};
-
-class QOpenGLWindowPrivate : public QPaintDeviceWindowPrivate
-{
- Q_DECLARE_PUBLIC(QOpenGLWindow)
-public:
- QOpenGLWindowPrivate(QOpenGLContext *shareContext, QOpenGLWindow::UpdateBehavior updateBehavior)
- : updateBehavior(updateBehavior)
- , hasFboBlit(false)
- , shareContext(shareContext)
- {
- if (!shareContext)
- this->shareContext = qt_gl_global_share_context();
- }
-
- ~QOpenGLWindowPrivate();
-
- static QOpenGLWindowPrivate *get(QOpenGLWindow *w) { return w->d_func(); }
-
- void bindFBO();
- void initialize();
-
- void beginPaint(const QRegion &region) override;
- void endPaint() override;
- void flush(const QRegion &region) override;
-
- QOpenGLWindow::UpdateBehavior updateBehavior;
- bool hasFboBlit;
- QScopedPointer<QOpenGLContext> context;
- QOpenGLContext *shareContext;
- QScopedPointer<QOpenGLFramebufferObject> fbo;
- QScopedPointer<QOpenGLWindowPaintDevice> paintDevice;
- QOpenGLTextureBlitter blitter;
- QColor backgroundColor;
- QScopedPointer<QOffscreenSurface> offscreenSurface;
-};
-
-QOpenGLWindowPrivate::~QOpenGLWindowPrivate()
-{
- Q_Q(QOpenGLWindow);
- if (q->isValid()) {
- q->makeCurrent(); // this works even when the platformwindow is destroyed
- paintDevice.reset(nullptr);
- fbo.reset(nullptr);
- blitter.destroy();
- q->doneCurrent();
- }
-}
-
-void QOpenGLWindowPrivate::initialize()
-{
- Q_Q(QOpenGLWindow);
-
- if (context)
- return;
-
- if (!q->handle())
- qWarning("Attempted to initialize QOpenGLWindow without a platform window");
-
- context.reset(new QOpenGLContext);
- context->setShareContext(shareContext);
- context->setFormat(q->requestedFormat());
- if (!context->create())
- qWarning("QOpenGLWindow::beginPaint: Failed to create context");
- if (!context->makeCurrent(q))
- qWarning("QOpenGLWindow::beginPaint: Failed to make context current");
-
- paintDevice.reset(new QOpenGLWindowPaintDevice(q));
- if (updateBehavior == QOpenGLWindow::PartialUpdateBlit)
- hasFboBlit = QOpenGLFramebufferObject::hasOpenGLFramebufferBlit();
-
- q->initializeGL();
-}
-
-void QOpenGLWindowPrivate::beginPaint(const QRegion &region)
-{
- Q_UNUSED(region);
- Q_Q(QOpenGLWindow);
-
- initialize();
- context->makeCurrent(q);
-
- const int deviceWidth = q->width() * q->devicePixelRatio();
- const int deviceHeight = q->height() * q->devicePixelRatio();
- const QSize deviceSize(deviceWidth, deviceHeight);
- if (updateBehavior > QOpenGLWindow::NoPartialUpdate) {
- if (!fbo || fbo->size() != deviceSize) {
- QOpenGLFramebufferObjectFormat fboFormat;
- fboFormat.setAttachment(QOpenGLFramebufferObject::CombinedDepthStencil);
- const int samples = q->requestedFormat().samples();
- if (samples > 0) {
- if (updateBehavior != QOpenGLWindow::PartialUpdateBlend)
- fboFormat.setSamples(samples);
- else
- qWarning("QOpenGLWindow: PartialUpdateBlend does not support multisampling");
- }
- fbo.reset(new QOpenGLFramebufferObject(deviceSize, fboFormat));
- markWindowAsDirty();
- }
- } else {
- markWindowAsDirty();
- }
-
- paintDevice->setSize(QSize(deviceWidth, deviceHeight));
- paintDevice->setDevicePixelRatio(q->devicePixelRatio());
- context->functions()->glViewport(0, 0, deviceWidth, deviceHeight);
-
- context->functions()->glBindFramebuffer(GL_FRAMEBUFFER, context->defaultFramebufferObject());
-
- q->paintUnderGL();
-
- if (updateBehavior > QOpenGLWindow::NoPartialUpdate)
- fbo->bind();
-}
-
-void QOpenGLWindowPrivate::endPaint()
-{
- Q_Q(QOpenGLWindow);
-
- if (updateBehavior > QOpenGLWindow::NoPartialUpdate)
- fbo->release();
-
- context->functions()->glBindFramebuffer(GL_FRAMEBUFFER, context->defaultFramebufferObject());
-
- if (updateBehavior == QOpenGLWindow::PartialUpdateBlit && hasFboBlit) {
- const int deviceWidth = q->width() * q->devicePixelRatio();
- const int deviceHeight = q->height() * q->devicePixelRatio();
- QOpenGLExtensions extensions(context.data());
- extensions.glBindFramebuffer(GL_READ_FRAMEBUFFER, fbo->handle());
- extensions.glBindFramebuffer(GL_DRAW_FRAMEBUFFER, context->defaultFramebufferObject());
- extensions.glBlitFramebuffer(0, 0, deviceWidth, deviceHeight,
- 0, 0, deviceWidth, deviceHeight,
- GL_COLOR_BUFFER_BIT, GL_NEAREST);
- } else if (updateBehavior > QOpenGLWindow::NoPartialUpdate) {
- if (updateBehavior == QOpenGLWindow::PartialUpdateBlend) {
- context->functions()->glEnable(GL_BLEND);
- context->functions()->glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
- }
- if (!blitter.isCreated())
- blitter.create();
-
- QRect windowRect(QPoint(0, 0), fbo->size());
- QMatrix4x4 target = QOpenGLTextureBlitter::targetTransform(windowRect, windowRect);
- blitter.bind();
- blitter.blit(fbo->texture(), target, QOpenGLTextureBlitter::OriginBottomLeft);
- blitter.release();
-
- if (updateBehavior == QOpenGLWindow::PartialUpdateBlend)
- context->functions()->glDisable(GL_BLEND);
- }
-
- q->paintOverGL();
-}
-
-void QOpenGLWindowPrivate::bindFBO()
-{
- if (updateBehavior > QOpenGLWindow::NoPartialUpdate)
- fbo->bind();
- else
- QOpenGLFramebufferObject::bindDefault();
-}
-
-void QOpenGLWindowPrivate::flush(const QRegion &region)
-{
- Q_UNUSED(region);
- Q_Q(QOpenGLWindow);
- context->swapBuffers(q);
- emit q->frameSwapped();
-}
-
-void QOpenGLWindowPaintDevice::ensureActiveTarget()
-{
- QOpenGLWindowPrivate::get(m_window)->bindFBO();
-}
-
-/*!
- Constructs a new QOpenGLWindow with the given \a parent and \a updateBehavior.
-
- \sa QOpenGLWindow::UpdateBehavior
- */
-QOpenGLWindow::QOpenGLWindow(QOpenGLWindow::UpdateBehavior updateBehavior, QWindow *parent)
- : QPaintDeviceWindow(*(new QOpenGLWindowPrivate(nullptr, updateBehavior)), parent)
-{
- setSurfaceType(QSurface::OpenGLSurface);
-}
-
-/*!
- Constructs a new QOpenGLWindow with the given \a parent and \a updateBehavior. The QOpenGLWindow's context will share with \a shareContext.
-
- \sa QOpenGLWindow::UpdateBehavior shareContext
-*/
-QOpenGLWindow::QOpenGLWindow(QOpenGLContext *shareContext, UpdateBehavior updateBehavior, QWindow *parent)
- : QPaintDeviceWindow(*(new QOpenGLWindowPrivate(shareContext, updateBehavior)), parent)
-{
- setSurfaceType(QSurface::OpenGLSurface);
-}
-
-/*!
- Destroys the QOpenGLWindow instance, freeing its resources.
-
- The OpenGLWindow's context is made current in the destructor, allowing for
- safe destruction of any child object that may need to release OpenGL
- resources belonging to the context provided by this window.
-
- \warning if you have objects wrapping OpenGL resources (such as
- QOpenGLBuffer, QOpenGLShaderProgram, etc.) as members of a QOpenGLWindow
- subclass, you may need to add a call to makeCurrent() in that subclass'
- destructor as well. Due to the rules of C++ object destruction, those objects
- will be destroyed \e{before} calling this function (but after that the
- destructor of the subclass has run), therefore making the OpenGL context
- current in this function happens too late for their safe disposal.
-
- \sa makeCurrent
-
- \since 5.5
-*/
-QOpenGLWindow::~QOpenGLWindow()
-{
- makeCurrent();
-}
-
-/*!
- \return the update behavior for this QOpenGLWindow.
-*/
-QOpenGLWindow::UpdateBehavior QOpenGLWindow::updateBehavior() const
-{
- Q_D(const QOpenGLWindow);
- return d->updateBehavior;
-}
-
-/*!
- \return \c true if the window's OpenGL resources, like the context, have
- been successfully initialized. Note that the return value is always \c false
- until the window becomes exposed (shown).
-*/
-bool QOpenGLWindow::isValid() const
-{
- Q_D(const QOpenGLWindow);
- return d->context && d->context->isValid();
-}
-
-/*!
- Prepares for rendering OpenGL content for this window by making the
- corresponding context current and binding the framebuffer object, if there is
- one, in that context context.
-
- It is not necessary to call this function in most cases, because it is called
- automatically before invoking paintGL(). It is provided nonetheless to support
- advanced, multi-threaded scenarios where a thread different than the GUI or main
- thread may want to update the surface or framebuffer contents. See QOpenGLContext
- for more information on threading related issues.
-
- This function is suitable for calling also when the underlying platform window
- is already destroyed. This means that it is safe to call this function from
- a QOpenGLWindow subclass' destructor. If there is no native window anymore,
- an offscreen surface is used instead. This ensures that OpenGL resource
- cleanup operations in the destructor will always work, as long as
- this function is called first.
-
- \sa QOpenGLContext, context(), paintGL(), doneCurrent()
- */
-void QOpenGLWindow::makeCurrent()
-{
- Q_D(QOpenGLWindow);
-
- if (!isValid())
- return;
-
- // The platform window may be destroyed at this stage and therefore
- // makeCurrent() may not safely be called with 'this'.
- if (handle()) {
- d->context->makeCurrent(this);
- } else {
- if (!d->offscreenSurface) {
- d->offscreenSurface.reset(new QOffscreenSurface(screen()));
- d->offscreenSurface->setFormat(d->context->format());
- d->offscreenSurface->create();
- }
- d->context->makeCurrent(d->offscreenSurface.data());
- }
-
- d->bindFBO();
-}
-
-/*!
- Releases the context.
-
- It is not necessary to call this function in most cases, since the widget
- will make sure the context is bound and released properly when invoking
- paintGL().
-
- \sa makeCurrent()
- */
-void QOpenGLWindow::doneCurrent()
-{
- Q_D(QOpenGLWindow);
-
- if (!isValid())
- return;
-
- d->context->doneCurrent();
-}
-
-/*!
- \return The QOpenGLContext used by this window or \c 0 if not yet initialized.
- */
-QOpenGLContext *QOpenGLWindow::context() const
-{
- Q_D(const QOpenGLWindow);
- return d->context.data();
-}
-
-/*!
- \return The QOpenGLContext requested to be shared with this window's QOpenGLContext.
-*/
-QOpenGLContext *QOpenGLWindow::shareContext() const
-{
- Q_D(const QOpenGLWindow);
- return d->shareContext;
-}
-
-/*!
- The framebuffer object handle used by this window.
-
- When the update behavior is set to \c NoPartialUpdate, there is no separate
- framebuffer object. In this case the returned value is the ID of the
- default framebuffer.
-
- Otherwise the value of the ID of the framebuffer object or \c 0 if not
- yet initialized.
- */
-GLuint QOpenGLWindow::defaultFramebufferObject() const
-{
- Q_D(const QOpenGLWindow);
- if (d->updateBehavior > NoPartialUpdate && d->fbo)
- return d->fbo->handle();
- else if (QOpenGLContext *ctx = QOpenGLContext::currentContext())
- return ctx->defaultFramebufferObject();
- else
- return 0;
-}
-
-extern Q_GUI_EXPORT QImage qt_gl_read_framebuffer(const QSize &size, bool alpha_format, bool include_alpha);
-
-/*!
- Returns a copy of the framebuffer.
-
- \note This is a potentially expensive operation because it relies on
- glReadPixels() to read back the pixels. This may be slow and can stall the
- GPU pipeline.
-
- \note When used together with update behavior \c NoPartialUpdate, the returned
- image may not contain the desired content when called after the front and back
- buffers have been swapped (unless preserved swap is enabled in the underlying
- windowing system interface). In this mode the function reads from the back
- buffer and the contents of that may not match the content on the screen (the
- front buffer). In this case the only place where this function can safely be
- used is paintGL() or paintOverGL().
- */
-QImage QOpenGLWindow::grabFramebuffer()
-{
- if (!isValid())
- return QImage();
-
- makeCurrent();
-
- const bool hasAlpha = format().hasAlpha();
- QImage img = qt_gl_read_framebuffer(size() * devicePixelRatio(), hasAlpha, hasAlpha);
- img.setDevicePixelRatio(devicePixelRatio());
- return img;
-}
-
-/*!
- This virtual function is called once before the first call to paintGL() or
- resizeGL(). Reimplement it in a subclass.
-
- This function should set up any required OpenGL resources and state.
-
- There is no need to call makeCurrent() because this has already been done
- when this function is called. Note however that the framebuffer, in case
- partial update mode is used, is not yet available at this stage, so avoid
- issuing draw calls from here. Defer such calls to paintGL() instead.
-
- \sa paintGL(), resizeGL()
- */
-void QOpenGLWindow::initializeGL()
-{
-}
-
-/*!
- This virtual function is called whenever the widget has been resized.
- Reimplement it in a subclass. The new size is passed in \a w and \a h.
-
- \note This is merely a convenience function in order to provide an API that is
- compatible with QOpenGLWidget. Unlike with QOpenGLWidget, derived classes are
- free to choose to override resizeEvent() instead of this function.
-
- \note Avoid issuing OpenGL commands from this function as there may not be a
- context current when it is invoked. If it cannot be avoided, call makeCurrent().
-
- \note Scheduling updates from here is not necessary. The windowing systems
- will send expose events that trigger an update automatically.
-
- \sa initializeGL(), paintGL()
- */
-void QOpenGLWindow::resizeGL(int w, int h)
-{
- Q_UNUSED(w);
- Q_UNUSED(h);
-}
-
-/*!
- This virtual function is called whenever the window contents needs to be
- painted. Reimplement it in a subclass.
-
- There is no need to call makeCurrent() because this has already
- been done when this function is called.
-
- Before invoking this function, the context and the framebuffer, if there is
- one, are bound, and the viewport is set up by a call to glViewport(). No
- other state is set and no clearing or drawing is performed by the framework.
-
- \note When using a partial update behavior, like \c PartialUpdateBlend, the
- output of the previous paintGL() call is preserved and, after the additional
- drawing perfomed in the current invocation of the function, the content is
- blitted or blended over the content drawn directly to the window in
- paintUnderGL().
-
- \sa initializeGL(), resizeGL(), paintUnderGL(), paintOverGL(), UpdateBehavior
- */
-void QOpenGLWindow::paintGL()
-{
-}
-
-/*!
- The virtual function is called before each invocation of paintGL().
-
- When the update mode is set to \c NoPartialUpdate, there is no difference
- between this function and paintGL(), performing rendering in either of them
- leads to the same result.
-
- The difference becomes significant when using \c PartialUpdateBlend, where an
- extra framebuffer object is used. There, paintGL() targets this additional
- framebuffer object, which preserves its contents, while paintUnderGL() and
- paintOverGL() target the default framebuffer, i.e. directly the window
- surface, the contents of which is lost after each displayed frame.
-
- \note Avoid relying on this function when the update behavior is
- \c PartialUpdateBlit. This mode involves blitting the extra framebuffer used by
- paintGL() onto the default framebuffer after each invocation of paintGL(),
- thus overwriting all drawing generated in this function.
-
- \sa paintGL(), paintOverGL(), UpdateBehavior
- */
-void QOpenGLWindow::paintUnderGL()
-{
-}
-
-/*!
- This virtual function is called after each invocation of paintGL().
-
- When the update mode is set to NoPartialUpdate, there is no difference
- between this function and paintGL(), performing rendering in either of them
- leads to the same result.
-
- Like paintUnderGL(), rendering in this function targets the default
- framebuffer of the window, regardless of the update behavior. It gets called
- after paintGL() has returned and the blit (PartialUpdateBlit) or quad drawing
- (PartialUpdateBlend) has been done.
-
- \sa paintGL(), paintUnderGL(), UpdateBehavior
- */
-void QOpenGLWindow::paintOverGL()
-{
-}
-
-/*!
- Paint \a event handler. Calls paintGL().
-
- \sa paintGL()
- */
-void QOpenGLWindow::paintEvent(QPaintEvent *event)
-{
- Q_UNUSED(event);
- paintGL();
-}
-
-/*!
- Resize \a event handler. Calls resizeGL().
-
- \sa resizeGL()
- */
-void QOpenGLWindow::resizeEvent(QResizeEvent *event)
-{
- Q_UNUSED(event);
- Q_D(QOpenGLWindow);
- d->initialize();
- resizeGL(width(), height());
-}
-
-/*!
- \internal
- */
-int QOpenGLWindow::metric(PaintDeviceMetric metric) const
-{
- Q_D(const QOpenGLWindow);
-
- switch (metric) {
- case PdmDepth:
- if (d->paintDevice)
- return d->paintDevice->depth();
- break;
- default:
- break;
- }
- return QPaintDeviceWindow::metric(metric);
-}
-
-/*!
- \internal
- */
-QPaintDevice *QOpenGLWindow::redirected(QPoint *) const
-{
- Q_D(const QOpenGLWindow);
- if (QOpenGLContext::currentContext() == d->context.data())
- return d->paintDevice.data();
- return nullptr;
-}
-
-QT_END_NAMESPACE
diff --git a/src/gui/kernel/qopenglwindow.h b/src/gui/kernel/qopenglwindow.h
deleted file mode 100644
index 7b3bf004a3..0000000000
--- a/src/gui/kernel/qopenglwindow.h
+++ /dev/null
@@ -1,107 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the QtGui module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef QOPENGLWINDOW_H
-#define QOPENGLWINDOW_H
-
-#include <QtGui/qtguiglobal.h>
-
-#ifndef QT_NO_OPENGL
-
-#include <QtGui/QPaintDeviceWindow>
-#include <QtGui/QOpenGLContext>
-#include <QtGui/QImage>
-
-QT_BEGIN_NAMESPACE
-
-class QOpenGLWindowPrivate;
-
-class Q_GUI_EXPORT QOpenGLWindow : public QPaintDeviceWindow
-{
- Q_OBJECT
- Q_DECLARE_PRIVATE(QOpenGLWindow)
-
-public:
- enum UpdateBehavior {
- NoPartialUpdate,
- PartialUpdateBlit,
- PartialUpdateBlend
- };
-
- explicit QOpenGLWindow(UpdateBehavior updateBehavior = NoPartialUpdate, QWindow *parent = nullptr);
- explicit QOpenGLWindow(QOpenGLContext *shareContext, UpdateBehavior updateBehavior = NoPartialUpdate, QWindow *parent = nullptr);
- ~QOpenGLWindow();
-
- UpdateBehavior updateBehavior() const;
- bool isValid() const;
-
- void makeCurrent();
- void doneCurrent();
-
- QOpenGLContext *context() const;
- QOpenGLContext *shareContext() const;
-
- GLuint defaultFramebufferObject() const;
-
- QImage grabFramebuffer();
-
-Q_SIGNALS:
- void frameSwapped();
-
-protected:
- virtual void initializeGL();
- virtual void resizeGL(int w, int h);
- virtual void paintGL();
- virtual void paintUnderGL();
- virtual void paintOverGL();
-
- void paintEvent(QPaintEvent *event) override;
- void resizeEvent(QResizeEvent *event) override;
- int metric(PaintDeviceMetric metric) const override;
- QPaintDevice *redirected(QPoint *) const override;
-
-private:
- Q_DISABLE_COPY(QOpenGLWindow)
-};
-
-QT_END_NAMESPACE
-
-#endif // QT_NO_OPENGL
-
-#endif
diff --git a/src/gui/kernel/qpaintdevicewindow.cpp b/src/gui/kernel/qpaintdevicewindow.cpp
index 4f45fc5fde..9e8c6ae5a8 100644
--- a/src/gui/kernel/qpaintdevicewindow.cpp
+++ b/src/gui/kernel/qpaintdevicewindow.cpp
@@ -1,41 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the QtGui module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#include "qpaintdevicewindow_p.h"
@@ -44,6 +8,12 @@
QT_BEGIN_NAMESPACE
+QPaintDeviceWindowPrivate::QPaintDeviceWindowPrivate()
+ = default;
+
+QPaintDeviceWindowPrivate::~QPaintDeviceWindowPrivate()
+ = default;
+
/*!
\class QPaintDeviceWindow
\inmodule QtGui
@@ -178,16 +148,7 @@ int QPaintDeviceWindow::metric(PaintDeviceMetric metric) const
*/
void QPaintDeviceWindow::exposeEvent(QExposeEvent *exposeEvent)
{
- Q_UNUSED(exposeEvent);
- Q_D(QPaintDeviceWindow);
- if (isExposed()) {
- d->markWindowAsDirty();
- // Do not rely on exposeEvent->region() as it has some issues for the
- // time being, namely that it is sometimes in local coordinates,
- // sometimes relative to the parent, depending on the platform plugin.
- // We require local coords here.
- d->doFlush(QRect(QPoint(0, 0), size()));
- }
+ QWindow::exposeEvent(exposeEvent);
}
/*!
@@ -201,6 +162,17 @@ bool QPaintDeviceWindow::event(QEvent *event)
if (handle()) // platform window may be gone when the window is closed during app exit
d->handleUpdateEvent();
return true;
+ } else if (event->type() == QEvent::Paint) {
+ d->markWindowAsDirty();
+ // Do not rely on exposeEvent->region() as it has some issues for the
+ // time being, namely that it is sometimes in local coordinates,
+ // sometimes relative to the parent, depending on the platform plugin.
+ // We require local coords here.
+ auto region = QRect(QPoint(0, 0), size());
+ d->doFlush(region); // Will end up calling paintEvent
+ return true;
+ } else if (event->type() == QEvent::Resize) {
+ d->handleResizeEvent();
}
return QWindow::event(event);
@@ -223,3 +195,5 @@ QPaintEngine *QPaintDeviceWindow::paintEngine() const
}
QT_END_NAMESPACE
+
+#include "moc_qpaintdevicewindow.cpp"
diff --git a/src/gui/kernel/qpaintdevicewindow.h b/src/gui/kernel/qpaintdevicewindow.h
index 3be078132f..d6b70298a6 100644
--- a/src/gui/kernel/qpaintdevicewindow.h
+++ b/src/gui/kernel/qpaintdevicewindow.h
@@ -1,41 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the QtGui module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#ifndef QPAINTDEVICEWINDOW_H
#define QPAINTDEVICEWINDOW_H
@@ -66,10 +30,10 @@ public Q_SLOTS:
void update();
protected:
- virtual void paintEvent(QPaintEvent *event);
+ void exposeEvent(QExposeEvent *) override;
+ void paintEvent(QPaintEvent *event) override;
int metric(PaintDeviceMetric metric) const override;
- void exposeEvent(QExposeEvent *) override;
bool event(QEvent *event) override;
QPaintDeviceWindow(QPaintDeviceWindowPrivate &dd, QWindow *parent);
diff --git a/src/gui/kernel/qpaintdevicewindow_p.h b/src/gui/kernel/qpaintdevicewindow_p.h
index a16b83689e..85c11cbf91 100644
--- a/src/gui/kernel/qpaintdevicewindow_p.h
+++ b/src/gui/kernel/qpaintdevicewindow_p.h
@@ -1,41 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the QtGui module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#ifndef QPAINTDEVICEWINDOW_P_H
#define QPAINTDEVICEWINDOW_P_H
@@ -64,6 +28,11 @@ class Q_GUI_EXPORT QPaintDeviceWindowPrivate : public QWindowPrivate
Q_DECLARE_PUBLIC(QPaintDeviceWindow)
public:
+ QPaintDeviceWindowPrivate();
+ ~QPaintDeviceWindowPrivate() override;
+
+ virtual void handleResizeEvent() {}
+
virtual void beginPaint(const QRegion &region)
{
Q_UNUSED(region);
@@ -115,7 +84,7 @@ public:
void markWindowAsDirty()
{
Q_Q(QPaintDeviceWindow);
- dirtyRegion += QRect(QPoint(0, 0), q->size());
+ dirtyRegion = QRect(QPoint(0, 0), q->size());
}
private:
diff --git a/src/gui/kernel/qpalette.cpp b/src/gui/kernel/qpalette.cpp
index fc063bc72c..256ea52f01 100644
--- a/src/gui/kernel/qpalette.cpp
+++ b/src/gui/kernel/qpalette.cpp
@@ -1,61 +1,20 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the QtGui module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "qpalette.h"
-#include "qguiapplication.h"
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
+
+#include "qpalette_p.h"
#include "qguiapplication_p.h"
#include "qdatastream.h"
#include "qvariant.h"
#include "qdebug.h"
-QT_BEGIN_NAMESPACE
+#include <QtCore/qmetaobject.h>
-static int qt_palette_count = 1;
+QT_BEGIN_NAMESPACE
-class QPalettePrivate {
-public:
- QPalettePrivate() : ref(1), ser_no(qt_palette_count++), detach_no(0) { }
- QAtomicInt ref;
- QBrush br[QPalette::NColorGroups][QPalette::NColorRoles];
- int ser_no;
- int detach_no;
-};
+static_assert(QPalettePrivate::bitPosition(QPalette::ColorGroup(QPalette::NColorGroups - 1),
+ QPalette::ColorRole(QPalette::NColorRoles - 1))
+ < sizeof(QPalette::ResolveMask) * CHAR_BIT,
+ "The resolve mask type is not wide enough to fit the entire bit mask.");
static QColor qt_mix_colors(QColor a, QColor b)
{
@@ -63,6 +22,52 @@ static QColor qt_mix_colors(QColor a, QColor b)
(a.blue() + b.blue()) / 2, (a.alpha() + b.alpha()) / 2);
}
+/*!
+ \internal
+
+ Derive undefined \l PlaceholderText colors from \l Text colors.
+ Unless already set, PlaceholderText colors will be derived from their Text pendents.
+ Colors of existing PlaceHolderText brushes will not be replaced.
+
+ \a alpha represents the dim factor as a percentage. By default, a PlaceHolderText color
+ becomes a 50% more transparent version of the corresponding Text color.
+*/
+static void qt_placeholder_from_text(QPalette &pal, int alpha = 50)
+{
+ if (alpha < 0 or alpha > 100)
+ return;
+
+ for (int cg = 0; cg < int(QPalette::NColorGroups); ++cg) {
+ const QPalette::ColorGroup group = QPalette::ColorGroup(cg);
+
+ // skip if the brush has been set already
+ if (!pal.isBrushSet(group, QPalette::PlaceholderText)) {
+ QColor c = pal.color(group, QPalette::Text);
+ const int a = (c.alpha() * alpha) / 100;
+ c.setAlpha(a);
+ pal.setColor(group, QPalette::PlaceholderText, c);
+ }
+ }
+}
+
+static void qt_ensure_default_accent_color(QPalette &pal)
+{
+ // have a lighter/darker factor handy, depending on dark/light heuristics
+ const int lighter = pal.base().color().lightness() > pal.text().color().lightness() ? 130 : 70;
+
+ // Act only for color groups where no accent color is set
+ for (int i = 0; i < QPalette::NColorGroups; ++i) {
+ const QPalette::ColorGroup group = static_cast<QPalette::ColorGroup>(i);
+ if (!pal.isBrushSet(group, QPalette::Accent)) {
+ // Default to highlight if available, otherwise use a shade of base
+ const QBrush accentBrush = pal.isBrushSet(group, QPalette::Highlight)
+ ? pal.brush(group, QPalette::Highlight)
+ : pal.brush(group, QPalette::Base).color().lighter(lighter);
+ pal.setBrush(group, QPalette::Accent, accentBrush);
+ }
+ }
+}
+
static void qt_palette_from_color(QPalette &pal, const QColor &button)
{
int h, s, v;
@@ -85,6 +90,9 @@ static void qt_palette_from_color(QPalette &pal, const QColor &button)
pal.setColorGroup(QPalette::Disabled, buttonBrushDark, buttonBrush, buttonBrushLight150,
buttonBrushDark, buttonBrushDark150, buttonBrushDark,
whiteBrush, buttonBrush, buttonBrush);
+
+ qt_placeholder_from_text(pal);
+ qt_ensure_default_accent_color(pal);
}
/*!
@@ -138,13 +146,6 @@ static void qt_palette_from_color(QPalette &pal, const QColor &button)
*/
/*!
- \fn const QBrush & QPalette::foreground() const
- \obsolete
-
- Use windowText() instead.
-*/
-
-/*!
\fn const QBrush & QPalette::windowText() const
Returns the window text (general foreground) brush of the
@@ -260,13 +261,6 @@ static void qt_palette_from_color(QPalette &pal, const QColor &button)
*/
/*!
- \fn const QBrush & QPalette::background() const
- \obsolete
-
- Use window() instead.
-*/
-
-/*!
\fn const QBrush & QPalette::window() const
Returns the window (general background) brush of the current
@@ -300,6 +294,15 @@ static void qt_palette_from_color(QPalette &pal, const QColor &button)
*/
/*!
+ \fn const QBrush & QPalette::accent() const
+ \since 6.6
+
+ Returns the accent brush of the current color group.
+
+ \sa ColorRole, brush()
+*/
+
+/*!
\fn const QBrush & QPalette::link() const
Returns the unvisited link text brush of the current color group.
@@ -321,11 +324,8 @@ static void qt_palette_from_color(QPalette &pal, const QColor &button)
Returns the placeholder text brush of the current color group.
- \note Before Qt 5.12, the placeholder text color was hard-coded in the code as
- QPalette::text().color() where an alpha of 128 was applied.
- We continue to support this behavior by default, unless you set your own brush.
- One can get back the original placeholder color setting the special QBrush default
- constructor as placeholder brush.
+ \note Before Qt 5.12, the placeholder text color was hard-coded as QPalette::text().color()
+ with an alpha of 128 applied. In Qt 6, it is an independent color.
\sa ColorRole, brush()
*/
@@ -434,12 +434,8 @@ static void qt_palette_from_color(QPalette &pal, const QColor &button)
\value Window A general background color.
- \value Background This value is obsolete. Use Window instead.
-
\value WindowText A general foreground color.
- \value Foreground This value is obsolete. Use WindowText instead.
-
\value Base Used mostly as the background color for text entry widgets,
but can also be used for other painting - such as the
background of combobox drop down lists and toolbar handles.
@@ -506,6 +502,13 @@ static void qt_palette_from_color(QPalette &pal, const QColor &button)
item. By default, the highlight color is
Qt::darkBlue.
+ \value [since 6.6] Accent
+ A color that typically contrasts or complements
+ Base, Window and Button colors. It usually represents
+ the users' choice of desktop personalisation.
+ Styling of interactive components is a typical use case.
+ Unless explicitly set, it defaults to Highlight.
+
\value HighlightedText A text color that contrasts with \c Highlight.
By default, the highlighted text color is Qt::white.
@@ -531,25 +534,27 @@ static void qt_palette_from_color(QPalette &pal, const QColor &button)
*/
/*!
- Constructs a palette object that uses the application's default palette.
+ Constructs an empty palette object with no color roles set.
+
+ When used as the palette of a QWidget the colors are resolved
+ as described by QWidget::setPalette().
\sa QApplication::setPalette(), QApplication::palette()
*/
QPalette::QPalette()
: d(nullptr)
{
- data.current_group = Active;
- data.resolve_mask = 0;
// Initialize to application palette if present, else default to black.
// This makes it possible to instantiate QPalette outside QGuiApplication,
// for example in the platform plugins.
if (QGuiApplicationPrivate::app_pal) {
d = QGuiApplicationPrivate::app_pal->d;
d->ref.ref();
+ setResolveMask(0);
} else {
init();
qt_palette_from_color(*this, Qt::black);
- data.resolve_mask = 0;
+ d->resolveMask = 0;
}
}
@@ -591,10 +596,14 @@ QPalette::QPalette(const QBrush &windowText, const QBrush &button,
init();
setColorGroup(All, windowText, button, light, dark, mid, text, bright_text,
base, window);
+
+ qt_placeholder_from_text(*this);
+ qt_ensure_default_accent_color(*this);
}
-/*!\obsolete
+/*!
+ \deprecated
Constructs a palette with the specified \a windowText, \a
window, \a light, \a dark, \a mid, \a text, and \a base colors.
@@ -645,6 +654,9 @@ QPalette::QPalette(const QColor &button, const QColor &window)
setColorGroup(Disabled, disabledForeground, buttonBrush, buttonBrushLight150,
buttonBrushDark, buttonBrushDark150, disabledForeground,
whiteBrush, baseBrush, windowBrush);
+
+ qt_placeholder_from_text(*this);
+ qt_ensure_default_accent_color(*this);
}
/*!
@@ -653,7 +665,7 @@ QPalette::QPalette(const QColor &button, const QColor &window)
This constructor is fast thanks to \l{implicit sharing}.
*/
QPalette::QPalette(const QPalette &p)
- : d(p.d), data(p.data)
+ : d(p.d), currentGroup(p.currentGroup)
{
d->ref.ref();
}
@@ -679,10 +691,9 @@ QPalette::~QPalette()
}
/*!\internal*/
-void QPalette::init() {
+void QPalette::init()
+{
d = new QPalettePrivate;
- data.resolve_mask = 0;
- data.current_group = Active; //as a default..
}
/*!
@@ -694,7 +705,7 @@ void QPalette::init() {
QPalette &QPalette::operator=(const QPalette &p)
{
p.d->ref.ref();
- data = p.data;
+ currentGroup = p.currentGroup;
if (d && !d->ref.deref())
delete d;
d = p.d;
@@ -714,7 +725,7 @@ QPalette &QPalette::operator=(const QPalette &p)
*/
QPalette::operator QVariant() const
{
- return QVariant(QVariant::Palette, this);
+ return QVariant::fromValue(*this);
}
/*!
@@ -737,15 +748,15 @@ QPalette::operator QVariant() const
const QBrush &QPalette::brush(ColorGroup gr, ColorRole cr) const
{
Q_ASSERT(cr < NColorRoles);
- if(gr >= (int)NColorGroups) {
- if(gr == Current) {
- gr = (ColorGroup)data.current_group;
+ if (gr >= (int)NColorGroups) {
+ if (gr == Current) {
+ gr = currentGroup;
} else {
qWarning("QPalette::brush: Unknown ColorGroup: %d", (int)gr);
gr = Active;
}
}
- return d->br[gr][cr];
+ return d->data->br[gr][cr];
}
/*!
@@ -777,38 +788,24 @@ void QPalette::setBrush(ColorGroup cg, ColorRole cr, const QBrush &b)
}
if (cg == Current) {
- cg = ColorGroup(data.current_group);
+ cg = currentGroup;
} else if (cg >= NColorGroups) {
qWarning("QPalette::setBrush: Unknown ColorGroup: %d", cg);
cg = Active;
}
- // For placeholder we want to continue to respect the original behavior, which is
- // derivating the text color, but only if user has not yet set his own brush.
- // We then use Qt::NoBrush as an inernal way to know if the brush is customized or not.
+ const auto newResolveMask = d->resolveMask | ResolveMask(1) << QPalettePrivate::bitPosition(cg, cr);
+ const auto valueChanged = d->data->br[cg][cr] != b;
- // ### Qt 6 - remove this special case
- // Part 1 - Restore initial color to the given color group
- if (cr == PlaceholderText && b == QBrush()) {
- QColor col = brush(Text).color();
- col.setAlpha(128);
- setBrush(cg, PlaceholderText, QBrush(col, Qt::NoBrush));
- return;
- }
-
- if (d->br[cg][cr] != b) {
+ if (valueChanged) {
+ detach();
+ d->data.detach();
+ d->data->br[cg][cr] = b;
+ } else if (d->resolveMask != newResolveMask) {
detach();
- d->br[cg][cr] = b;
- }
- data.resolve_mask |= (1<<cr);
-
- // ### Qt 6 - remove this special case
- // Part 2 - Update initial color to the given color group
- if (cr == Text && d->br[cg][PlaceholderText].style() == Qt::NoBrush) {
- QColor col = brush(Text).color();
- col.setAlpha(128);
- setBrush(cg, PlaceholderText, QBrush(col, Qt::NoBrush));
}
+
+ d->resolveMask = newResolveMask;
}
/*!
@@ -817,12 +814,34 @@ void QPalette::setBrush(ColorGroup cg, ColorRole cr, const QBrush &b)
Returns \c true if the ColorGroup \a cg and ColorRole \a cr has been
set previously on this palette; otherwise returns \c false.
- \sa setBrush()
+ The ColorGroup \a cg should be less than QPalette::NColorGroups,
+ but you can use QPalette::Current. In this case, the previously
+ set current color group will be used.
+
+ The ColorRole \a cr should be less than QPalette::NColorRoles.
+
+ \sa setBrush(), currentColorGroup()
*/
bool QPalette::isBrushSet(ColorGroup cg, ColorRole cr) const
{
- Q_UNUSED(cg);
- return (data.resolve_mask & (1<<cr));
+ // NoRole has no resolve mask and should never be set anyway
+ if (cr == NoRole)
+ return false;
+
+ if (cg == Current)
+ cg = currentGroup;
+
+ if (cg >= NColorGroups) {
+ qWarning() << "Wrong color group:" << cg;
+ return false;
+ }
+
+ if (cr >= NColorRoles) {
+ qWarning() << "Wrong color role:" << cr;
+ return false;
+ }
+
+ return d->resolveMask & (ResolveMask(1) << QPalettePrivate::bitPosition(cg, cr));
}
/*!
@@ -831,16 +850,14 @@ bool QPalette::isBrushSet(ColorGroup cg, ColorRole cr) const
void QPalette::detach()
{
if (d->ref.loadRelaxed() != 1) {
- QPalettePrivate *x = new QPalettePrivate;
- for(int grp = 0; grp < (int)NColorGroups; grp++) {
- for(int role = 0; role < (int)NColorRoles; role++)
- x->br[grp][role] = d->br[grp][role];
- }
- if(!d->ref.deref())
+ QPalettePrivate *x = new QPalettePrivate(d->data);
+ x->resolveMask = d->resolveMask;
+ if (!d->ref.deref())
delete d;
d = x;
+ } else {
+ d->detach_no = ++QPalettePrivate::qt_palette_private_count;
}
- ++d->detach_no;
}
/*!
@@ -859,18 +876,24 @@ void QPalette::detach()
Returns \c true (usually quickly) if this palette is equal to \a p;
otherwise returns \c false (slowly).
- \note The current ColorGroup is not taken into account when
- comparing palettes
+ \note The following is not taken into account when comparing palettes:
+ \list
+ \li the \c current ColorGroup
+ \li ColorRole NoRole \since 6.6
+ \endlist
\sa operator!=()
*/
bool QPalette::operator==(const QPalette &p) const
{
- if (isCopyOf(p))
+ if (isCopyOf(p) || d->data == p.d->data)
return true;
for(int grp = 0; grp < (int)NColorGroups; grp++) {
for(int role = 0; role < (int)NColorRoles; role++) {
- if(d->br[grp][role] != p.d->br[grp][role])
+ // Dont't verify NoRole, because it has no resolve bit
+ if (role == NoRole)
+ continue;
+ if (d->data->br[grp][role] != p.d->data->br[grp][role])
return false;
}
}
@@ -885,49 +908,31 @@ bool QPalette::operator==(const QPalette &p) const
*/
bool QPalette::isEqual(QPalette::ColorGroup group1, QPalette::ColorGroup group2) const
{
- if(group1 >= (int)NColorGroups) {
- if(group1 == Current) {
- group1 = (ColorGroup)data.current_group;
+ if (group1 >= (int)NColorGroups) {
+ if (group1 == Current) {
+ group1 = currentGroup;
} else {
qWarning("QPalette::brush: Unknown ColorGroup(1): %d", (int)group1);
group1 = Active;
}
}
- if(group2 >= (int)NColorGroups) {
- if(group2 == Current) {
- group2 = (ColorGroup)data.current_group;
+ if (group2 >= (int)NColorGroups) {
+ if (group2 == Current) {
+ group2 = currentGroup;
} else {
qWarning("QPalette::brush: Unknown ColorGroup(2): %d", (int)group2);
group2 = Active;
}
}
- if(group1 == group2)
+ if (group1 == group2)
return true;
for(int role = 0; role < (int)NColorRoles; role++) {
- if(d->br[group1][role] != d->br[group2][role])
+ if (d->data->br[group1][role] != d->data->br[group2][role])
return false;
}
return true;
}
-/*! \fn int QPalette::serialNumber() const
- \obsolete
-
- Returns a number that identifies the contents of this QPalette
- object. Distinct QPalette objects can only have the same serial
- number if they refer to the same contents (but they don't have
- to). Also, the serial number of a QPalette may change during the
- lifetime of the object.
-
- Use cacheKey() instead.
-
- \warning The serial number doesn't necessarily change when the
- palette is altered. This means that it may be dangerous to use it
- as a cache key.
-
- \sa operator==()
-*/
-
/*!
Returns a number that identifies the contents of this QPalette
object. Distinct QPalette objects can have the same key if
@@ -937,7 +942,18 @@ bool QPalette::isEqual(QPalette::ColorGroup group1, QPalette::ColorGroup group2)
*/
qint64 QPalette::cacheKey() const
{
- return (((qint64) d->ser_no) << 32) | ((qint64) (d->detach_no));
+ return (((qint64) d->data->ser_no) << 32) | ((qint64) (d->detach_no));
+}
+
+static constexpr QPalette::ResolveMask allResolveMask()
+{
+ QPalette::ResolveMask mask = {0};
+ for (int role = 0; role < int(QPalette::NColorRoles); ++role) {
+ for (int grp = 0; grp < int(QPalette::NColorGroups); ++grp) {
+ mask |= (QPalette::ResolveMask(1) << QPalettePrivate::bitPosition(QPalette::ColorGroup(grp), QPalette::ColorRole(role)));
+ }
+ }
+ return mask;
}
/*!
@@ -946,35 +962,64 @@ qint64 QPalette::cacheKey() const
*/
QPalette QPalette::resolve(const QPalette &other) const
{
- if ((*this == other && data.resolve_mask == other.data.resolve_mask)
- || data.resolve_mask == 0) {
+ if ((*this == other && d->resolveMask == other.d->resolveMask)
+ || d->resolveMask == 0) {
QPalette o = other;
- o.data.resolve_mask = data.resolve_mask;
+ o.setResolveMask(d->resolveMask);
return o;
}
+ if (d->resolveMask == allResolveMask())
+ return *this;
+
QPalette palette(*this);
palette.detach();
- for(int role = 0; role < (int)NColorRoles; role++)
- if (!(data.resolve_mask & (1<<role)))
- for(int grp = 0; grp < (int)NColorGroups; grp++)
- palette.d->br[grp][role] = other.d->br[grp][role];
- palette.data.resolve_mask |= other.data.resolve_mask;
+ for (int role = 0; role < int(NColorRoles); ++role) {
+ // Don't resolve NoRole, its bits are needed for Accent (see bitPosition)
+ if (role == NoRole)
+ continue;
+
+ for (int grp = 0; grp < int(NColorGroups); ++grp) {
+ if (!(d->resolveMask & (ResolveMask(1) << QPalettePrivate::bitPosition(ColorGroup(grp), ColorRole(role))))) {
+ palette.d->data.detach();
+ palette.d->data->br[grp][role] = other.d->data->br[grp][role];
+ }
+ }
+ }
+
+ palette.d->resolveMask |= other.d->resolveMask;
return palette;
}
/*!
- \fn uint QPalette::resolve() const
\internal
*/
+QPalette::ResolveMask QPalette::resolveMask() const
+{
+ return d->resolveMask;
+}
/*!
- \fn void QPalette::resolve(uint mask)
\internal
*/
+void QPalette::setResolveMask(QPalette::ResolveMask mask)
+{
+ if (mask == d->resolveMask)
+ return;
+ detach();
+ d->resolveMask = mask;
+}
+
+/*!
+ \typedef ResolveMask
+ \internal
+
+ A bit mask that stores which colors the palette instance explicitly defines,
+ and which ones are inherited from a parent.
+*/
/*****************************************************************************
QPalette stream functions
@@ -1001,7 +1046,7 @@ QDataStream &operator<<(QDataStream &s, const QPalette &p)
if (s.version() == 1) {
// Qt 1.x
for (int i = 0; i < NumOldRoles; ++i)
- s << p.d->br[grp][oldRoles[i]].color();
+ s << p.d->data->br[grp][oldRoles[i]].color();
} else {
int max = (int)QPalette::NColorRoles;
if (s.version() <= QDataStream::Qt_2_1)
@@ -1010,8 +1055,11 @@ QDataStream &operator<<(QDataStream &s, const QPalette &p)
max = QPalette::AlternateBase + 1;
else if (s.version() <= QDataStream::Qt_5_11)
max = QPalette::ToolTipText + 1;
+ else if (s.version() <= QDataStream::Qt_6_5)
+ max = QPalette::PlaceholderText + 1;
+
for (int r = 0; r < max; r++)
- s << p.d->br[grp][r];
+ s << p.d->data->br[grp][r];
}
}
return s;
@@ -1037,7 +1085,7 @@ static void readV1ColorGroup(QDataStream &s, QPalette &pal, QPalette::ColorGroup
QDataStream &operator>>(QDataStream &s, QPalette &p)
{
- if(s.version() == 1) {
+ if (s.version() == 1) {
p = QPalette();
readV1ColorGroup(s, p, QPalette::Active);
readV1ColorGroup(s, p, QPalette::Disabled);
@@ -1053,15 +1101,25 @@ QDataStream &operator>>(QDataStream &s, QPalette &p)
} else if (s.version() <= QDataStream::Qt_5_11) {
p = QPalette();
max = QPalette::ToolTipText + 1;
+ } else if (s.version() <= QDataStream::Qt_6_5) {
+ p = QPalette();
+ max = QPalette::PlaceholderText + 1;
}
+
QBrush tmp;
for(int grp = 0; grp < (int)QPalette::NColorGroups; ++grp) {
+ const QPalette::ColorGroup group = static_cast<QPalette::ColorGroup>(grp);
for(int role = 0; role < max; ++role) {
s >> tmp;
- p.setBrush((QPalette::ColorGroup)grp, (QPalette::ColorRole)role, tmp);
+ p.setBrush(group, (QPalette::ColorRole)role, tmp);
}
+
+ // Accent defaults to Highlight for stream versions that don't have it.
+ if (s.version() < QDataStream::Qt_6_6)
+ p.setBrush(group, QPalette::Accent, p.brush(group, QPalette::Highlight));
}
+
}
return s;
}
@@ -1105,10 +1163,15 @@ void QPalette::setColorGroup(ColorGroup cg, const QBrush &windowText, const QBru
QBrush(Qt::blue), QBrush(Qt::magenta), QBrush(toolTipBase),
QBrush(toolTipText));
- data.resolve_mask &= ~(1 << Highlight);
- data.resolve_mask &= ~(1 << HighlightedText);
- data.resolve_mask &= ~(1 << LinkVisited);
- data.resolve_mask &= ~(1 << Link);
+ for (int cr = Highlight; cr <= LinkVisited; ++cr) {
+ if (cg == All) {
+ for (int group = Active; group < NColorGroups; ++group) {
+ d->resolveMask &= ~(ResolveMask(1) << QPalettePrivate::bitPosition(ColorGroup(group), ColorRole(cr)));
+ }
+ } else {
+ d->resolveMask &= ~(ResolveMask(1) << QPalettePrivate::bitPosition(ColorGroup(cg), ColorRole(cr)));
+ }
+ }
}
@@ -1161,73 +1224,61 @@ void QPalette::setColorGroup(ColorGroup cg, const QBrush &foreground, const QBru
setBrush(cg, ToolTipText, toolTipText);
}
-Q_GUI_EXPORT QPalette qt_fusionPalette()
+#ifndef QT_NO_DEBUG_STREAM
+static QString groupsToString(const QPalette &p, QPalette::ColorRole cr)
{
- QColor backGround(239, 239, 239);
- QColor light = backGround.lighter(150);
- QColor mid(backGround.darker(130));
- QColor midLight = mid.lighter(110);
- QColor base = Qt::white;
- QColor disabledBase(backGround);
- QColor dark = backGround.darker(150);
- QColor darkDisabled = QColor(209, 209, 209).darker(110);
- QColor text = Qt::black;
- QColor hightlightedText = Qt::white;
- QColor disabledText = QColor(190, 190, 190);
- QColor button = backGround;
- QColor shadow = dark.darker(135);
- QColor disabledShadow = shadow.lighter(150);
-
- QPalette fusionPalette(Qt::black,backGround,light,dark,mid,text,base);
- fusionPalette.setBrush(QPalette::Midlight, midLight);
- fusionPalette.setBrush(QPalette::Button, button);
- fusionPalette.setBrush(QPalette::Shadow, shadow);
- fusionPalette.setBrush(QPalette::HighlightedText, hightlightedText);
-
- fusionPalette.setBrush(QPalette::Disabled, QPalette::Text, disabledText);
- fusionPalette.setBrush(QPalette::Disabled, QPalette::WindowText, disabledText);
- fusionPalette.setBrush(QPalette::Disabled, QPalette::ButtonText, disabledText);
- fusionPalette.setBrush(QPalette::Disabled, QPalette::Base, disabledBase);
- fusionPalette.setBrush(QPalette::Disabled, QPalette::Dark, darkDisabled);
- fusionPalette.setBrush(QPalette::Disabled, QPalette::Shadow, disabledShadow);
-
- fusionPalette.setBrush(QPalette::Active, QPalette::Highlight, QColor(48, 140, 198));
- fusionPalette.setBrush(QPalette::Inactive, QPalette::Highlight, QColor(48, 140, 198));
- fusionPalette.setBrush(QPalette::Disabled, QPalette::Highlight, QColor(145, 145, 145));
- return fusionPalette;
+ const auto groupEnum = QMetaEnum::fromType<QPalette::ColorGroup>();
+
+ QString groupString;
+ for (int group = 0; group < QPalette::NColorGroups; ++group) {
+ const auto cg = QPalette::ColorGroup(group);
+
+ if (p.isBrushSet(cg, cr)) {
+ const auto &color = p.color(cg, cr);
+ groupString += QString::fromUtf8(groupEnum.valueToKey(cg)) + u':' +
+ color.name(QColor::HexArgb) + u',';
+ }
+ }
+ groupString.chop(1);
+
+ return groupString;
+}
+
+static QString rolesToString(const QPalette &p)
+{
+ const auto roleEnum = QMetaEnum::fromType<QPalette::ColorRole>();
+
+ QString roleString;
+ for (int role = 0; role < QPalette::NColorRoles; ++role) {
+ const auto cr = QPalette::ColorRole(role);
+
+ auto groupString = groupsToString(p, cr);
+ if (!groupString.isEmpty())
+ roleString += QString::fromUtf8(roleEnum.valueToKey(cr)) + QStringLiteral(":[") +
+ groupString + QStringLiteral("],");
+ }
+ roleString.chop(1);
+
+ return roleString;
}
-#ifndef QT_NO_DEBUG_STREAM
QDebug operator<<(QDebug dbg, const QPalette &p)
{
- const char *colorGroupNames[] = {"Active", "Disabled", "Inactive"};
- const char *colorRoleNames[] =
- {"WindowText", "Button", "Light", "Midlight", "Dark", "Mid", "Text",
- "BrightText", "ButtonText", "Base", "Window", "Shadow", "Highlight",
- "HighlightedText", "Link", "LinkVisited", "AlternateBase", "NoRole",
- "ToolTipBase","ToolTipText", "PlaceholderText" };
QDebugStateSaver saver(dbg);
- QDebug nospace = dbg.nospace();
- const uint mask = p.resolve();
- nospace << "QPalette(resolve=" << Qt::hex << Qt::showbase << mask << ',';
- for (int role = 0; role < (int)QPalette::NColorRoles; ++role) {
- if (mask & (1<<role)) {
- if (role)
- nospace << ',';
- nospace << colorRoleNames[role] << ":[";
- for (int group = 0; group < (int)QPalette::NColorGroups; ++group) {
- if (group)
- nospace << ',';
- const QRgb color = p.color(static_cast<QPalette::ColorGroup>(group),
- static_cast<QPalette::ColorRole>(role)).rgba();
- nospace << colorGroupNames[group] << ':' << color;
- }
- nospace << ']';
- }
- }
- nospace << ')' << Qt::noshowbase << Qt::dec;
+ dbg.nospace();
+
+ dbg << "QPalette(resolve=" << Qt::hex << Qt::showbase << p.resolveMask();
+
+ auto roleString = rolesToString(p);
+ if (!roleString.isEmpty())
+ dbg << ',' << roleString;
+
+ dbg << ')';
+
return dbg;
-}
+ }
#endif
QT_END_NAMESPACE
+
+#include "moc_qpalette.cpp"
diff --git a/src/gui/kernel/qpalette.h b/src/gui/kernel/qpalette.h
index d3a840d9ad..a6162e1090 100644
--- a/src/gui/kernel/qpalette.h
+++ b/src/gui/kernel/qpalette.h
@@ -1,41 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the QtGui module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#ifndef QPALETTE_H
#define QPALETTE_H
@@ -68,23 +32,20 @@ public:
~QPalette();
QPalette &operator=(const QPalette &palette);
QPalette(QPalette &&other) noexcept
- : d(other.d), data(other.data)
- { other.d = nullptr; }
- inline QPalette &operator=(QPalette &&other) noexcept
- {
- for_faster_swapping_dont_use = other.for_faster_swapping_dont_use;
- qSwap(d, other.d); return *this;
- }
+ : d(std::exchange(other.d, nullptr)), currentGroup(other.currentGroup)
+ {}
+ QT_MOVE_ASSIGNMENT_OPERATOR_IMPL_VIA_PURE_SWAP(QPalette)
void swap(QPalette &other) noexcept
{
- qSwap(d, other.d);
- qSwap(for_faster_swapping_dont_use, other.for_faster_swapping_dont_use);
+ std::swap(currentGroup, other.currentGroup);
+ qt_ptr_swap(d, other.d);
}
operator QVariant() const;
// Do not change the order, the serialization format depends on it
+ // Ensure these values are kept in sync with QQuickColorGroup's properties.
enum ColorGroup { Active, Disabled, Inactive, NColorGroups, Current, All, Normal = Active };
Q_ENUM(ColorGroup)
enum ColorRole { WindowText, Button, Light, Midlight, Dark, Mid,
@@ -95,16 +56,13 @@ public:
NoRole,
ToolTipBase, ToolTipText,
PlaceholderText,
- NColorRoles = PlaceholderText + 1,
-#if QT_DEPRECATED_SINCE(5, 13)
- Foreground Q_DECL_ENUMERATOR_DEPRECATED_X("Use QPalette::WindowText instead") = WindowText,
- Background Q_DECL_ENUMERATOR_DEPRECATED_X("Use QPalette::Window instead") = Window
-#endif
+ Accent,
+ NColorRoles = Accent + 1,
};
Q_ENUM(ColorRole)
- inline ColorGroup currentColorGroup() const { return static_cast<ColorGroup>(data.current_group); }
- inline void setCurrentColorGroup(ColorGroup cg) { data.current_group = cg; }
+ inline ColorGroup currentColorGroup() const { return currentGroup; }
+ inline void setCurrentColorGroup(ColorGroup cg) { currentGroup = cg; }
inline const QColor &color(ColorGroup cg, ColorRole cr) const
{ return brush(cg, cr).color(); }
@@ -142,25 +100,19 @@ public:
inline const QBrush &link() const { return brush(Link); }
inline const QBrush &linkVisited() const { return brush(LinkVisited); }
inline const QBrush &placeholderText() const { return brush(PlaceholderText); }
-#if QT_DEPRECATED_SINCE(5, 13)
- QT_DEPRECATED_X("Use QPalette::windowText() instead")
- inline const QBrush &foreground() const { return windowText(); }
- QT_DEPRECATED_X("Use QPalette::window() instead")
- inline const QBrush &background() const { return window(); }
-#endif
+ inline const QBrush &accent() const { return brush(Accent); }
bool operator==(const QPalette &p) const;
inline bool operator!=(const QPalette &p) const { return !(operator==(p)); }
bool isCopyOf(const QPalette &p) const;
-#if QT_DEPRECATED_SINCE(5, 0)
- QT_DEPRECATED inline int serialNumber() const { return cacheKey() >> 32; }
-#endif
qint64 cacheKey() const;
- QPalette resolve(const QPalette &) const;
- inline uint resolve() const { return data.resolve_mask; }
- inline void resolve(uint mask) { data.resolve_mask = mask; }
+ QPalette resolve(const QPalette &other) const;
+
+ using ResolveMask = quint64;
+ ResolveMask resolveMask() const;
+ void setResolveMask(ResolveMask mask);
private:
void setColorGroup(ColorGroup cr, const QBrush &windowText, const QBrush &button,
@@ -184,14 +136,8 @@ private:
void detach();
QPalettePrivate *d;
- struct Data {
- uint current_group : 4;
- uint resolve_mask : 28;
- };
- union {
- Data data;
- quint32 for_faster_swapping_dont_use;
- };
+ ColorGroup currentGroup{Active};
+
friend Q_GUI_EXPORT QDataStream &operator<<(QDataStream &s, const QPalette &p);
};
diff --git a/src/gui/kernel/qpalette_p.h b/src/gui/kernel/qpalette_p.h
new file mode 100644
index 0000000000..ce7c30d66d
--- /dev/null
+++ b/src/gui/kernel/qpalette_p.h
@@ -0,0 +1,77 @@
+// Copyright (C) 2023 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
+
+#ifndef QPALETTE_P_H
+#define QPALETTE_P_H
+
+//
+// W A R N I N G
+// -------------
+//
+// This file is not part of the Qt API. It exists purely as an
+// implementation detail. This header file may change from version to
+// version without notice, or even be removed.
+//
+// We mean it.
+//
+
+#include "qpalette.h"
+
+QT_BEGIN_NAMESPACE
+
+class Q_GUI_EXPORT QPalettePrivate
+{
+public:
+ class Data : public QSharedData {
+ public:
+ // Every instance of Data has to have a unique serial number, even
+ // if it gets created by copying another - we wouldn't create a copy
+ // in the first place if the serial number should be the same!
+ Data(const Data &other)
+ : QSharedData(other)
+ {
+ for (int grp = 0; grp < int(QPalette::NColorGroups); grp++) {
+ for (int role = 0; role < int(QPalette::NColorRoles); role++)
+ br[grp][role] = other.br[grp][role];
+ }
+ }
+ Data() = default;
+
+ QBrush br[QPalette::NColorGroups][QPalette::NColorRoles];
+ const int ser_no = qt_palette_count++;
+ };
+
+ QPalettePrivate(const QExplicitlySharedDataPointer<Data> &data)
+ : ref(1), data(data)
+ { }
+ QPalettePrivate()
+ : QPalettePrivate(QExplicitlySharedDataPointer<Data>(new Data))
+ { }
+
+ static constexpr QPalette::ResolveMask colorRoleOffset(QPalette::ColorGroup colorGroup)
+ {
+ // Exclude NoRole; that bit is used for Accent
+ return (qToUnderlying(QPalette::NColorRoles) - 1) * qToUnderlying(colorGroup);
+ }
+
+ static constexpr QPalette::ResolveMask bitPosition(QPalette::ColorGroup colorGroup,
+ QPalette::ColorRole colorRole)
+ {
+ // Map Accent into NoRole for resolving purposes
+ if (colorRole == QPalette::Accent)
+ colorRole = QPalette::NoRole;
+
+ return colorRole + colorRoleOffset(colorGroup);
+ }
+
+ QAtomicInt ref;
+ QPalette::ResolveMask resolveMask = {0};
+ static inline int qt_palette_count = 0;
+ static inline int qt_palette_private_count = 0;
+ int detach_no = ++qt_palette_private_count;
+ QExplicitlySharedDataPointer<Data> data;
+};
+
+QT_END_NAMESPACE
+
+#endif // QPALETTE_P_H
diff --git a/src/gui/kernel/qpixelformat.cpp b/src/gui/kernel/qpixelformat.cpp
index c28fe7ac63..e05192f0b2 100644
--- a/src/gui/kernel/qpixelformat.cpp
+++ b/src/gui/kernel/qpixelformat.cpp
@@ -1,41 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the QtGui module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#include "qpixelformat.h"
@@ -186,7 +150,7 @@ QT_BEGIN_NAMESPACE
\enum QPixelFormat::YUVLayout
YUV is not represented by describing the size of the color channels. This is
- because YUV often use macro pixels, making the concept of sperate color channels
+ because YUV often use macro pixels, making the concept of separate color channels
invalid. Instead the different YUV layouts are described with this enum.
\value YUV444
@@ -485,7 +449,7 @@ QT_BEGIN_NAMESPACE
/*!
\fn ByteOrder QPixelFormat::byteOrder() const
- The byte order is almost always set the the byte order of the current
+ The byte order is almost always set the byte order of the current
system. However, it can be useful to describe some YUV formats. This
function should never return QPixelFormat::CurrentSystemEndian as this
value is translated to a endian value in the constructor.
@@ -521,7 +485,7 @@ QT_BEGIN_NAMESPACE
\internal
*/
-Q_STATIC_ASSERT(sizeof(QPixelFormat) == sizeof(quint64));
+static_assert(sizeof(QPixelFormat) == sizeof(quint64));
namespace QtPrivate {
diff --git a/src/gui/kernel/qpixelformat.h b/src/gui/kernel/qpixelformat.h
index a041a39fc1..4954a6cd94 100644
--- a/src/gui/kernel/qpixelformat.h
+++ b/src/gui/kernel/qpixelformat.h
@@ -1,41 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the QtGui module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#ifndef QPIXELFORMAT_H
#define QPIXELFORMAT_H
@@ -76,28 +40,28 @@ class QPixelFormat
// work around bug in old clang versions: when building webkit
// with XCode 4.6 and older this fails compilation, thus cast to int
FirstField = ModelField + int(ModelFieldWidth),
- SecondField = FirstField + FirstFieldWidth,
- ThirdField = SecondField + SecondFieldWidth,
- FourthField = ThirdField + ThirdFieldWidth,
- FifthField = FourthField + FourthFieldWidth,
- AlphaField = FifthField + FifthFieldWidth,
- AlphaUsageField = AlphaField + AlphaFieldWidth,
- AlphaPositionField = AlphaUsageField + AlphaUsageFieldWidth,
- PremulField = AlphaPositionField + AlphaPositionFieldWidth,
- TypeInterpretationField = PremulField + PremulFieldWidth,
- ByteOrderField = TypeInterpretationField + TypeInterpretationFieldWidth,
- SubEnumField = ByteOrderField + ByteOrderFieldWidth,
- UnusedField = SubEnumField + SubEnumFieldWidth,
-
- TotalFieldWidthByOffsets = UnusedField + UnusedFieldWidth
+ SecondField = FirstField + int(FirstFieldWidth),
+ ThirdField = SecondField + int(SecondFieldWidth),
+ FourthField = ThirdField + int(ThirdFieldWidth),
+ FifthField = FourthField + int(FourthFieldWidth),
+ AlphaField = FifthField + int(FifthFieldWidth),
+ AlphaUsageField = AlphaField + int(AlphaFieldWidth),
+ AlphaPositionField = AlphaUsageField + int(AlphaUsageFieldWidth),
+ PremulField = AlphaPositionField + int(AlphaPositionFieldWidth),
+ TypeInterpretationField = PremulField + int(PremulFieldWidth),
+ ByteOrderField = TypeInterpretationField + int(TypeInterpretationFieldWidth),
+ SubEnumField = ByteOrderField + int(ByteOrderFieldWidth),
+ UnusedField = SubEnumField + int(SubEnumFieldWidth),
+
+ TotalFieldWidthByOffsets = UnusedField + int(UnusedFieldWidth)
};
- Q_STATIC_ASSERT(uint(TotalFieldWidthByWidths) == uint(TotalFieldWidthByOffsets));
- Q_STATIC_ASSERT(uint(TotalFieldWidthByWidths) == 8 * sizeof(quint64));
+ static_assert(uint(TotalFieldWidthByWidths) == uint(TotalFieldWidthByOffsets));
+ static_assert(uint(TotalFieldWidthByWidths) == 8 * sizeof(quint64));
- Q_DECL_CONSTEXPR inline uchar get(Field offset, FieldWidth width) const noexcept
+ constexpr inline uchar get(Field offset, FieldWidth width) const noexcept
{ return uchar((data >> uint(offset)) & ((Q_UINT64_C(1) << uint(width)) - Q_UINT64_C(1))); }
- Q_DECL_CONSTEXPR static inline quint64 set(Field offset, FieldWidth width, uchar value)
+ constexpr static inline quint64 set(Field offset, FieldWidth width, uchar value)
{ return (quint64(value) & ((Q_UINT64_C(1) << uint(width)) - Q_UINT64_C(1))) << uint(offset); }
public:
@@ -160,8 +124,8 @@ public:
CurrentSystemEndian
};
- Q_DECL_CONSTEXPR inline QPixelFormat() noexcept : data(0) {}
- Q_DECL_CONSTEXPR inline QPixelFormat(ColorModel colorModel,
+ constexpr inline QPixelFormat() noexcept : data(0) {}
+ constexpr inline QPixelFormat(ColorModel colorModel,
uchar firstSize,
uchar secondSize,
uchar thirdSize,
@@ -175,60 +139,60 @@ public:
ByteOrder byteOrder = CurrentSystemEndian,
uchar subEnum = 0) noexcept;
- Q_DECL_CONSTEXPR inline ColorModel colorModel() const noexcept { return ColorModel(get(ModelField, ModelFieldWidth)); }
- Q_DECL_CONSTEXPR inline uchar channelCount() const noexcept { return (get(FirstField, FirstFieldWidth) > 0) +
+ constexpr inline ColorModel colorModel() const noexcept { return ColorModel(get(ModelField, ModelFieldWidth)); }
+ constexpr inline uchar channelCount() const noexcept { return (get(FirstField, FirstFieldWidth) > 0) +
(get(SecondField, SecondFieldWidth) > 0) +
(get(ThirdField, ThirdFieldWidth) > 0) +
(get(FourthField, FourthFieldWidth) > 0) +
(get(FifthField, FifthFieldWidth) > 0) +
(get(AlphaField, AlphaFieldWidth) > 0); }
- Q_DECL_CONSTEXPR inline uchar redSize() const noexcept { return get(FirstField, FirstFieldWidth); }
- Q_DECL_CONSTEXPR inline uchar greenSize() const noexcept { return get(SecondField, SecondFieldWidth); }
- Q_DECL_CONSTEXPR inline uchar blueSize() const noexcept { return get(ThirdField, ThirdFieldWidth); }
+ constexpr inline uchar redSize() const noexcept { return get(FirstField, FirstFieldWidth); }
+ constexpr inline uchar greenSize() const noexcept { return get(SecondField, SecondFieldWidth); }
+ constexpr inline uchar blueSize() const noexcept { return get(ThirdField, ThirdFieldWidth); }
- Q_DECL_CONSTEXPR inline uchar cyanSize() const noexcept { return get(FirstField, FirstFieldWidth); }
- Q_DECL_CONSTEXPR inline uchar magentaSize() const noexcept { return get(SecondField, SecondFieldWidth); }
- Q_DECL_CONSTEXPR inline uchar yellowSize() const noexcept { return get(ThirdField, ThirdFieldWidth); }
- Q_DECL_CONSTEXPR inline uchar blackSize() const noexcept { return get(FourthField, FourthFieldWidth); }
+ constexpr inline uchar cyanSize() const noexcept { return get(FirstField, FirstFieldWidth); }
+ constexpr inline uchar magentaSize() const noexcept { return get(SecondField, SecondFieldWidth); }
+ constexpr inline uchar yellowSize() const noexcept { return get(ThirdField, ThirdFieldWidth); }
+ constexpr inline uchar blackSize() const noexcept { return get(FourthField, FourthFieldWidth); }
- Q_DECL_CONSTEXPR inline uchar hueSize() const noexcept { return get(FirstField, FirstFieldWidth); }
- Q_DECL_CONSTEXPR inline uchar saturationSize() const noexcept { return get(SecondField, SecondFieldWidth); }
- Q_DECL_CONSTEXPR inline uchar lightnessSize() const noexcept { return get(ThirdField, ThirdFieldWidth); }
- Q_DECL_CONSTEXPR inline uchar brightnessSize() const noexcept { return get(ThirdField, ThirdFieldWidth); }
+ constexpr inline uchar hueSize() const noexcept { return get(FirstField, FirstFieldWidth); }
+ constexpr inline uchar saturationSize() const noexcept { return get(SecondField, SecondFieldWidth); }
+ constexpr inline uchar lightnessSize() const noexcept { return get(ThirdField, ThirdFieldWidth); }
+ constexpr inline uchar brightnessSize() const noexcept { return get(ThirdField, ThirdFieldWidth); }
- Q_DECL_CONSTEXPR inline uchar alphaSize() const noexcept { return get(AlphaField, AlphaFieldWidth); }
+ constexpr inline uchar alphaSize() const noexcept { return get(AlphaField, AlphaFieldWidth); }
- Q_DECL_CONSTEXPR inline uchar bitsPerPixel() const noexcept { return get(FirstField, FirstFieldWidth) +
+ constexpr inline uchar bitsPerPixel() const noexcept { return get(FirstField, FirstFieldWidth) +
get(SecondField, SecondFieldWidth) +
get(ThirdField, ThirdFieldWidth) +
get(FourthField, FourthFieldWidth) +
get(FifthField, FifthFieldWidth) +
get(AlphaField, AlphaFieldWidth); }
- Q_DECL_CONSTEXPR inline AlphaUsage alphaUsage() const noexcept { return AlphaUsage(get(AlphaUsageField, AlphaUsageFieldWidth)); }
- Q_DECL_CONSTEXPR inline AlphaPosition alphaPosition() const noexcept { return AlphaPosition(get(AlphaPositionField, AlphaPositionFieldWidth)); }
- Q_DECL_CONSTEXPR inline AlphaPremultiplied premultiplied() const noexcept { return AlphaPremultiplied(get(PremulField, PremulFieldWidth)); }
- Q_DECL_CONSTEXPR inline TypeInterpretation typeInterpretation() const noexcept { return TypeInterpretation(get(TypeInterpretationField, TypeInterpretationFieldWidth)); }
- Q_DECL_CONSTEXPR inline ByteOrder byteOrder() const noexcept { return ByteOrder(get(ByteOrderField, ByteOrderFieldWidth)); }
+ constexpr inline AlphaUsage alphaUsage() const noexcept { return AlphaUsage(get(AlphaUsageField, AlphaUsageFieldWidth)); }
+ constexpr inline AlphaPosition alphaPosition() const noexcept { return AlphaPosition(get(AlphaPositionField, AlphaPositionFieldWidth)); }
+ constexpr inline AlphaPremultiplied premultiplied() const noexcept { return AlphaPremultiplied(get(PremulField, PremulFieldWidth)); }
+ constexpr inline TypeInterpretation typeInterpretation() const noexcept { return TypeInterpretation(get(TypeInterpretationField, TypeInterpretationFieldWidth)); }
+ constexpr inline ByteOrder byteOrder() const noexcept { return ByteOrder(get(ByteOrderField, ByteOrderFieldWidth)); }
- Q_DECL_CONSTEXPR inline YUVLayout yuvLayout() const noexcept { return YUVLayout(get(SubEnumField, SubEnumFieldWidth)); }
- Q_DECL_CONSTEXPR inline uchar subEnum() const noexcept { return get(SubEnumField, SubEnumFieldWidth); }
+ constexpr inline YUVLayout yuvLayout() const noexcept { return YUVLayout(get(SubEnumField, SubEnumFieldWidth)); }
+ constexpr inline uchar subEnum() const noexcept { return get(SubEnumField, SubEnumFieldWidth); }
private:
- Q_DECL_CONSTEXPR static inline ByteOrder resolveByteOrder(ByteOrder bo)
+ constexpr static inline ByteOrder resolveByteOrder(ByteOrder bo)
{ return bo == CurrentSystemEndian ? Q_BYTE_ORDER == Q_LITTLE_ENDIAN ? LittleEndian : BigEndian : bo ; }
private:
quint64 data;
- friend Q_DECL_CONST_FUNCTION Q_DECL_CONSTEXPR inline bool operator==(QPixelFormat fmt1, QPixelFormat fmt2)
+ friend Q_DECL_CONST_FUNCTION constexpr inline bool operator==(QPixelFormat fmt1, QPixelFormat fmt2)
{ return fmt1.data == fmt2.data; }
- friend Q_DECL_CONST_FUNCTION Q_DECL_CONSTEXPR inline bool operator!=(QPixelFormat fmt1, QPixelFormat fmt2)
+ friend Q_DECL_CONST_FUNCTION constexpr inline bool operator!=(QPixelFormat fmt1, QPixelFormat fmt2)
{ return !(fmt1 == fmt2); }
};
-Q_STATIC_ASSERT(sizeof(QPixelFormat) == sizeof(quint64));
+static_assert(sizeof(QPixelFormat) == sizeof(quint64));
Q_DECLARE_TYPEINFO(QPixelFormat, Q_PRIMITIVE_TYPE);
@@ -242,20 +206,19 @@ namespace QtPrivate {
QPixelFormat::ByteOrder byteOrder);
}
-Q_DECL_CONSTEXPR
-QPixelFormat::QPixelFormat(ColorModel mdl,
- uchar firstSize,
- uchar secondSize,
- uchar thirdSize,
- uchar fourthSize,
- uchar fifthSize,
- uchar alfa,
- AlphaUsage usage,
- AlphaPosition position,
- AlphaPremultiplied premult,
- TypeInterpretation typeInterp,
- ByteOrder b_order,
- uchar s_enum) noexcept
+constexpr QPixelFormat::QPixelFormat(ColorModel mdl,
+ uchar firstSize,
+ uchar secondSize,
+ uchar thirdSize,
+ uchar fourthSize,
+ uchar fifthSize,
+ uchar alfa,
+ AlphaUsage usage,
+ AlphaPosition position,
+ AlphaPremultiplied premult,
+ TypeInterpretation typeInterp,
+ ByteOrder b_order,
+ uchar s_enum) noexcept
: data(set(ModelField, ModelFieldWidth, uchar(mdl)) |
set(FirstField, FirstFieldWidth, firstSize) |
set(SecondField, SecondFieldWidth, secondSize) |
@@ -273,14 +236,14 @@ QPixelFormat::QPixelFormat(ColorModel mdl,
{
}
-Q_DECL_CONSTEXPR inline QPixelFormat qPixelFormatRgba(uchar red,
- uchar green,
- uchar blue,
- uchar alfa,
- QPixelFormat::AlphaUsage usage,
- QPixelFormat::AlphaPosition position,
- QPixelFormat::AlphaPremultiplied pmul=QPixelFormat::NotPremultiplied,
- QPixelFormat::TypeInterpretation typeInt=QPixelFormat::UnsignedInteger) noexcept
+constexpr inline QPixelFormat qPixelFormatRgba(uchar red,
+ uchar green,
+ uchar blue,
+ uchar alfa,
+ QPixelFormat::AlphaUsage usage,
+ QPixelFormat::AlphaPosition position,
+ QPixelFormat::AlphaPremultiplied pmul=QPixelFormat::NotPremultiplied,
+ QPixelFormat::TypeInterpretation typeInt=QPixelFormat::UnsignedInteger) noexcept
{
return QPixelFormat(QPixelFormat::RGB,
red,
@@ -295,8 +258,8 @@ Q_DECL_CONSTEXPR inline QPixelFormat qPixelFormatRgba(uchar red,
typeInt);
}
-Q_DECL_CONSTEXPR inline QPixelFormat qPixelFormatGrayscale(uchar channelSize,
- QPixelFormat::TypeInterpretation typeInt=QPixelFormat::UnsignedInteger) noexcept
+constexpr inline QPixelFormat qPixelFormatGrayscale(uchar channelSize,
+ QPixelFormat::TypeInterpretation typeInt=QPixelFormat::UnsignedInteger) noexcept
{
return QPixelFormat(QPixelFormat::Grayscale,
channelSize,
@@ -311,8 +274,8 @@ Q_DECL_CONSTEXPR inline QPixelFormat qPixelFormatGrayscale(uchar channelSize,
typeInt);
}
-Q_DECL_CONSTEXPR inline QPixelFormat qPixelFormatAlpha(uchar channelSize,
- QPixelFormat::TypeInterpretation typeInt=QPixelFormat::UnsignedInteger) noexcept
+constexpr inline QPixelFormat qPixelFormatAlpha(uchar channelSize,
+ QPixelFormat::TypeInterpretation typeInt=QPixelFormat::UnsignedInteger) noexcept
{
return QPixelFormat(QPixelFormat::Alpha,
0,
@@ -327,11 +290,11 @@ Q_DECL_CONSTEXPR inline QPixelFormat qPixelFormatAlpha(uchar channelSize,
typeInt);
}
-Q_DECL_CONSTEXPR inline QPixelFormat qPixelFormatCmyk(uchar channelSize,
- uchar alfa=0,
- QPixelFormat::AlphaUsage usage=QPixelFormat::IgnoresAlpha,
- QPixelFormat::AlphaPosition position=QPixelFormat::AtBeginning,
- QPixelFormat::TypeInterpretation typeInt=QPixelFormat::UnsignedInteger) noexcept
+constexpr inline QPixelFormat qPixelFormatCmyk(uchar channelSize,
+ uchar alfa=0,
+ QPixelFormat::AlphaUsage usage=QPixelFormat::IgnoresAlpha,
+ QPixelFormat::AlphaPosition position=QPixelFormat::AtBeginning,
+ QPixelFormat::TypeInterpretation typeInt=QPixelFormat::UnsignedInteger) noexcept
{
return QPixelFormat(QPixelFormat::CMYK,
channelSize,
@@ -346,11 +309,11 @@ Q_DECL_CONSTEXPR inline QPixelFormat qPixelFormatCmyk(uchar channelSize,
typeInt);
}
-Q_DECL_CONSTEXPR inline QPixelFormat qPixelFormatHsl(uchar channelSize,
- uchar alfa=0,
- QPixelFormat::AlphaUsage usage=QPixelFormat::IgnoresAlpha,
- QPixelFormat::AlphaPosition position=QPixelFormat::AtBeginning,
- QPixelFormat::TypeInterpretation typeInt=QPixelFormat::FloatingPoint) noexcept
+constexpr inline QPixelFormat qPixelFormatHsl(uchar channelSize,
+ uchar alfa=0,
+ QPixelFormat::AlphaUsage usage=QPixelFormat::IgnoresAlpha,
+ QPixelFormat::AlphaPosition position=QPixelFormat::AtBeginning,
+ QPixelFormat::TypeInterpretation typeInt=QPixelFormat::FloatingPoint) noexcept
{
return QPixelFormat(QPixelFormat::HSL,
channelSize,
@@ -365,11 +328,11 @@ Q_DECL_CONSTEXPR inline QPixelFormat qPixelFormatHsl(uchar channelSize,
typeInt);
}
-Q_DECL_CONSTEXPR inline QPixelFormat qPixelFormatHsv(uchar channelSize,
- uchar alfa=0,
- QPixelFormat::AlphaUsage usage=QPixelFormat::IgnoresAlpha,
- QPixelFormat::AlphaPosition position=QPixelFormat::AtBeginning,
- QPixelFormat::TypeInterpretation typeInt=QPixelFormat::FloatingPoint) noexcept
+constexpr inline QPixelFormat qPixelFormatHsv(uchar channelSize,
+ uchar alfa=0,
+ QPixelFormat::AlphaUsage usage=QPixelFormat::IgnoresAlpha,
+ QPixelFormat::AlphaPosition position=QPixelFormat::AtBeginning,
+ QPixelFormat::TypeInterpretation typeInt=QPixelFormat::FloatingPoint) noexcept
{
return QPixelFormat(QPixelFormat::HSV,
channelSize,
diff --git a/src/gui/kernel/qplatformclipboard.cpp b/src/gui/kernel/qplatformclipboard.cpp
index 34c94dca3b..7321b5065d 100644
--- a/src/gui/kernel/qplatformclipboard.cpp
+++ b/src/gui/kernel/qplatformclipboard.cpp
@@ -1,41 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the QtGui module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#include "qplatformclipboard.h"
#ifndef QT_NO_CLIPBOARD
diff --git a/src/gui/kernel/qplatformclipboard.h b/src/gui/kernel/qplatformclipboard.h
index 3220201720..51b7c51abd 100644
--- a/src/gui/kernel/qplatformclipboard.h
+++ b/src/gui/kernel/qplatformclipboard.h
@@ -1,41 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the QtGui module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#ifndef QPLATFORMCLIPBOARD_H
#define QPLATFORMCLIPBOARD_H
diff --git a/src/gui/kernel/qplatformcursor.cpp b/src/gui/kernel/qplatformcursor.cpp
index 5a438a54a2..0e2fb9eba1 100644
--- a/src/gui/kernel/qplatformcursor.cpp
+++ b/src/gui/kernel/qplatformcursor.cpp
@@ -1,41 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the QtGui module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#include "qplatformcursor.h"
#include <QPainter>
@@ -619,10 +583,10 @@ void QPlatformCursorImage::set(const uchar *data, const uchar *mask,
int p = 0;
int d, m;
- int x = -1, w = 0;
+ int x = -1;
uchar *cursor_data = cursorImage.bits();
- int bpl = cursorImage.bytesPerLine();
+ qsizetype bpl = cursorImage.bytesPerLine();
for (int i = 0; i < height; i++)
{
for (int j = 0; j < bytesPerLine; j++, data++, mask++)
@@ -641,15 +605,11 @@ void QPlatformCursorImage::set(const uchar *data, const uchar *mask,
x = j*8+b;
else if (x >= 0 && !m) {
x = -1;
- w = 0;
}
- if (m)
- w++;
}
}
if (x >= 0) {
x = -1;
- w = 0;
}
cursor_data += bpl;
}
diff --git a/src/gui/kernel/qplatformcursor.h b/src/gui/kernel/qplatformcursor.h
index f3871d8780..56216d475b 100644
--- a/src/gui/kernel/qplatformcursor.h
+++ b/src/gui/kernel/qplatformcursor.h
@@ -1,41 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the QtGui module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#ifndef QPLATFORMCURSOR_H
#define QPLATFORMCURSOR_H
diff --git a/src/gui/kernel/qplatformdialoghelper.cpp b/src/gui/kernel/qplatformdialoghelper.cpp
index 15ac4acf91..93de7933d4 100644
--- a/src/gui/kernel/qplatformdialoghelper.cpp
+++ b/src/gui/kernel/qplatformdialoghelper.cpp
@@ -1,61 +1,33 @@
-/****************************************************************************
-**
-** Copyright (C) 2018 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the QtGui module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2018 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#include "qplatformdialoghelper.h"
#include <QtCore/QCoreApplication>
-#include <QtCore/QVariant>
+#include <QtCore/QList>
#if QT_CONFIG(regularexpression)
#include <QtCore/QRegularExpression>
#endif
-#include <QtCore/QSharedData>
#if QT_CONFIG(settings)
#include <QtCore/QSettings>
#endif
+#include <QtCore/QSharedData>
#include <QtCore/QUrl>
-#include <QtCore/QVector>
+#include <QtCore/QVariant>
#include <QtGui/QColor>
+#include <QtGui/QPixmap>
#include <algorithm>
QT_BEGIN_NAMESPACE
+using namespace Qt::StringLiterals;
+
+QT_IMPL_METATYPE_EXTERN_TAGGED(QPlatformDialogHelper::StandardButton,
+ QPlatformDialogHelper__StandardButton)
+QT_IMPL_METATYPE_EXTERN_TAGGED(QPlatformDialogHelper::ButtonRole,
+ QPlatformDialogHelper__ButtonRole)
+
/*!
\class QPlatformDialogHelper
\since 5.0
@@ -107,11 +79,6 @@ static const int buttonRoleLayouts[2][6][14] =
QPlatformDialogHelper::AcceptRole | QPlatformDialogHelper::Reverse, QPlatformDialogHelper::NoRole | QPlatformDialogHelper::Reverse,
QPlatformDialogHelper::YesRole | QPlatformDialogHelper::Reverse, QPlatformDialogHelper::EOL },
- // MacModelessLayout
- { QPlatformDialogHelper::ResetRole, QPlatformDialogHelper::ApplyRole, QPlatformDialogHelper::ActionRole, QPlatformDialogHelper::Stretch,
- QPlatformDialogHelper::HelpRole, QPlatformDialogHelper::EOL, QPlatformDialogHelper::EOL, QPlatformDialogHelper::EOL, QPlatformDialogHelper::EOL,
- QPlatformDialogHelper::EOL, QPlatformDialogHelper::EOL, QPlatformDialogHelper::EOL, QPlatformDialogHelper::EOL, QPlatformDialogHelper::EOL },
-
// AndroidLayout (neutral, stretch, dismissive, affirmative)
// https://material.io/guidelines/components/dialogs.html#dialogs-specs
{ QPlatformDialogHelper::HelpRole, QPlatformDialogHelper::ResetRole, QPlatformDialogHelper::ApplyRole, QPlatformDialogHelper::ActionRole,
@@ -143,11 +110,6 @@ static const int buttonRoleLayouts[2][6][14] =
QPlatformDialogHelper::AlternateRole, QPlatformDialogHelper::DestructiveRole, QPlatformDialogHelper::ApplyRole, QPlatformDialogHelper::ActionRole, QPlatformDialogHelper::Stretch,
QPlatformDialogHelper::ResetRole, QPlatformDialogHelper::HelpRole, QPlatformDialogHelper::EOL, QPlatformDialogHelper::EOL, QPlatformDialogHelper::EOL },
- // MacModelessLayout
- { QPlatformDialogHelper::ActionRole, QPlatformDialogHelper::ApplyRole, QPlatformDialogHelper::ResetRole, QPlatformDialogHelper::Stretch,
- QPlatformDialogHelper::HelpRole, QPlatformDialogHelper::EOL, QPlatformDialogHelper::EOL, QPlatformDialogHelper::EOL, QPlatformDialogHelper::EOL,
- QPlatformDialogHelper::EOL, QPlatformDialogHelper::EOL, QPlatformDialogHelper::EOL, QPlatformDialogHelper::EOL, QPlatformDialogHelper::EOL },
-
// AndroidLayout
// (affirmative
// dismissive
@@ -304,7 +266,7 @@ void QColorDialogStaticData::readSettings()
#if QT_CONFIG(settings)
const QSettings settings(QSettings::UserScope, QStringLiteral("QtProject"));
for (int i = 0; i < int(CustomColorCount); ++i) {
- const QVariant v = settings.value(QLatin1String("Qt/customColors/") + QString::number(i));
+ const QVariant v = settings.value("Qt/customColors/"_L1 + QString::number(i));
if (v.isValid())
customRgb[i] = v.toUInt();
}
@@ -318,7 +280,7 @@ void QColorDialogStaticData::writeSettings() const
const_cast<QColorDialogStaticData*>(this)->customSet = false;
QSettings settings(QSettings::UserScope, QStringLiteral("QtProject"));
for (int i = 0; i < int(CustomColorCount); ++i)
- settings.setValue(QLatin1String("Qt/customColors/") + QString::number(i), customRgb[i]);
+ settings.setValue("Qt/customColors/"_L1 + QString::number(i), customRgb[i]);
}
#endif
}
@@ -653,7 +615,7 @@ QStringList QFileDialogOptions::mimeTypeFilters() const
void QFileDialogOptions::setDefaultSuffix(const QString &suffix)
{
d->defaultSuffix = suffix;
- if (d->defaultSuffix.size() > 1 && d->defaultSuffix.startsWith(QLatin1Char('.')))
+ if (d->defaultSuffix.size() > 1 && d->defaultSuffix.startsWith(u'.'))
d->defaultSuffix.remove(0, 1); // Silently change ".txt" -> "txt".
}
@@ -741,7 +703,7 @@ QStringList QFileDialogOptions::supportedSchemes() const
void QPlatformFileDialogHelper::selectMimeTypeFilter(const QString &filter)
{
- Q_UNUSED(filter)
+ Q_UNUSED(filter);
}
QString QPlatformFileDialogHelper::selectedMimeTypeFilter() const
@@ -781,15 +743,15 @@ const char QPlatformFileDialogHelper::filterRegExp[] =
QStringList QPlatformFileDialogHelper::cleanFilterList(const QString &filter)
{
#if QT_CONFIG(regularexpression)
- QRegularExpression regexp(QString::fromLatin1(filterRegExp));
+ static const QRegularExpression regexp(QString::fromLatin1(filterRegExp));
Q_ASSERT(regexp.isValid());
QString f = filter;
- QRegularExpressionMatch match;
- filter.indexOf(regexp, 0, &match);
+ QRegularExpressionMatch match = regexp.match(filter);
if (match.hasMatch())
f = match.captured(2);
- return f.split(QLatin1Char(' '), QString::SkipEmptyParts);
+ return f.split(u' ', Qt::SkipEmptyParts);
#else
+ Q_UNUSED(filter);
return QStringList();
#endif
}
@@ -806,13 +768,19 @@ public:
{}
QString windowTitle;
- QMessageDialogOptions::Icon icon;
+ QMessageDialogOptions::StandardIcon icon;
QString text;
QString informativeText;
QString detailedText;
QPlatformDialogHelper::StandardButtons buttons;
- QVector<QMessageDialogOptions::CustomButton> customButtons;
+ QList<QMessageDialogOptions::CustomButton> customButtons;
int nextCustomButtonId;
+ QPixmap iconPixmap;
+ QString checkBoxLabel;
+ Qt::CheckState checkBoxState = Qt::Unchecked;
+ int defaultButtonId = 0;
+ int escapeButtonId = 0;
+ QMessageDialogOptions::Options options;
};
QMessageDialogOptions::QMessageDialogOptions(QMessageDialogOptionsPrivate *dd)
@@ -854,16 +822,26 @@ void QMessageDialogOptions::setWindowTitle(const QString &title)
d->windowTitle = title;
}
-QMessageDialogOptions::Icon QMessageDialogOptions::icon() const
+QMessageDialogOptions::StandardIcon QMessageDialogOptions::standardIcon() const
{
return d->icon;
}
-void QMessageDialogOptions::setIcon(Icon icon)
+void QMessageDialogOptions::setStandardIcon(StandardIcon icon)
{
d->icon = icon;
}
+void QMessageDialogOptions::setIconPixmap(const QPixmap &pixmap)
+{
+ d->iconPixmap = pixmap;
+}
+
+QPixmap QMessageDialogOptions::iconPixmap() const
+{
+ return d->iconPixmap;
+}
+
QString QMessageDialogOptions::text() const
{
return d->text;
@@ -905,9 +883,9 @@ QPlatformDialogHelper::StandardButtons QMessageDialogOptions::standardButtons()
}
int QMessageDialogOptions::addButton(const QString &label, QPlatformDialogHelper::ButtonRole role,
- void *buttonImpl)
+ void *buttonImpl, int buttonId)
{
- const CustomButton b(d->nextCustomButtonId++, label, role, buttonImpl);
+ const CustomButton b(buttonId ? buttonId : d->nextCustomButtonId++, label, role, buttonImpl);
d->customButtons.append(b);
return b.id;
}
@@ -922,17 +900,81 @@ void QMessageDialogOptions::removeButton(int id)
d->customButtons.removeOne(CustomButton(id));
}
-const QVector<QMessageDialogOptions::CustomButton> &QMessageDialogOptions::customButtons()
+const QList<QMessageDialogOptions::CustomButton> &QMessageDialogOptions::customButtons()
{
return d->customButtons;
}
+void QMessageDialogOptions::clearCustomButtons()
+{
+ d->customButtons.clear();
+}
+
const QMessageDialogOptions::CustomButton *QMessageDialogOptions::customButton(int id)
{
- int i = d->customButtons.indexOf(CustomButton(id));
+ const int i = int(d->customButtons.indexOf(CustomButton(id)));
return (i < 0 ? nullptr : &d->customButtons.at(i));
}
+void QMessageDialogOptions::setCheckBox(const QString &label, Qt::CheckState state)
+{
+ d->checkBoxLabel = label;
+ d->checkBoxState = state;
+}
+
+QString QMessageDialogOptions::checkBoxLabel() const
+{
+ return d->checkBoxLabel;
+}
+
+Qt::CheckState QMessageDialogOptions::checkBoxState() const
+{
+ return d->checkBoxState;
+}
+
+void QMessageDialogOptions::setDefaultButton(int id)
+{
+ d->defaultButtonId = id;
+}
+
+int QMessageDialogOptions::defaultButton() const
+{
+ return d->defaultButtonId;
+}
+
+void QMessageDialogOptions::setEscapeButton(int id)
+{
+ d->escapeButtonId = id;
+}
+
+int QMessageDialogOptions::escapeButton() const
+{
+ return d->escapeButtonId;
+}
+
+void QMessageDialogOptions::setOption(QMessageDialogOptions::Option option, bool on)
+{
+ if (!(d->options & option) != !on)
+ setOptions(d->options ^ option);
+}
+
+bool QMessageDialogOptions::testOption(QMessageDialogOptions::Option option) const
+{
+ return d->options & option;
+}
+
+void QMessageDialogOptions::setOptions(QMessageDialogOptions::Options options)
+{
+ if (options != d->options)
+ d->options = options;
+}
+
+QMessageDialogOptions::Options QMessageDialogOptions::options() const
+{
+ return d->options;
+}
+
+
QPlatformDialogHelper::ButtonRole QPlatformDialogHelper::buttonRole(QPlatformDialogHelper::StandardButton button)
{
switch (button) {
@@ -979,7 +1021,7 @@ QPlatformDialogHelper::ButtonRole QPlatformDialogHelper::buttonRole(QPlatformDia
const int *QPlatformDialogHelper::buttonLayout(Qt::Orientation orientation, ButtonLayout policy)
{
if (policy == UnknownLayout) {
-#if defined (Q_OS_OSX)
+#if defined (Q_OS_MACOS)
policy = MacLayout;
#elif defined (Q_OS_LINUX) || defined (Q_OS_UNIX)
policy = KdeLayout;
@@ -1012,3 +1054,5 @@ void QPlatformMessageDialogHelper::setOptions(const QSharedPointer<QMessageDialo
}
QT_END_NAMESPACE
+
+#include "moc_qplatformdialoghelper.cpp"
diff --git a/src/gui/kernel/qplatformdialoghelper.h b/src/gui/kernel/qplatformdialoghelper.h
index ba800a696f..0569a7e2f9 100644
--- a/src/gui/kernel/qplatformdialoghelper.h
+++ b/src/gui/kernel/qplatformdialoghelper.h
@@ -1,41 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2018 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the QtGui module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2018 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#ifndef QPLATFORMDIALOGHELPER_H
#define QPLATFORMDIALOGHELPER_H
@@ -58,6 +22,8 @@
#include <QtCore/QDir>
#include <QtCore/QUrl>
#include <QtGui/QRgb>
+Q_MOC_INCLUDE(<QFont>)
+Q_MOC_INCLUDE(<QColor>)
QT_BEGIN_NAMESPACE
@@ -148,7 +114,6 @@ public:
MacLayout,
KdeLayout,
GnomeLayout,
- MacModelessLayout,
AndroidLayout
};
Q_ENUM(ButtonLayout)
@@ -175,8 +140,10 @@ Q_SIGNALS:
};
QT_END_NAMESPACE
-Q_DECLARE_METATYPE(QPlatformDialogHelper::StandardButton)
-Q_DECLARE_METATYPE(QPlatformDialogHelper::ButtonRole)
+QT_DECL_METATYPE_EXTERN_TAGGED(QPlatformDialogHelper::StandardButton,
+ QPlatformDialogHelper__StandardButton, Q_GUI_EXPORT)
+QT_DECL_METATYPE_EXTERN_TAGGED(QPlatformDialogHelper::ButtonRole,
+ QPlatformDialogHelper__ButtonRole, Q_GUI_EXPORT)
QT_BEGIN_NAMESPACE
class Q_GUI_EXPORT QColorDialogOptions
@@ -190,7 +157,8 @@ public:
enum ColorDialogOption {
ShowAlphaChannel = 0x00000001,
NoButtons = 0x00000002,
- DontUseNativeDialog = 0x00000004
+ DontUseNativeDialog = 0x00000004,
+ NoEyeDropperButton = 0x00000008
};
Q_DECLARE_FLAGS(ColorDialogOptions, ColorDialogOption)
@@ -313,18 +281,16 @@ public:
enum DialogLabel { LookIn, FileName, FileType, Accept, Reject, DialogLabelCount };
Q_ENUM(DialogLabel)
+ // keep this in sync with QFileDialog::Options
enum FileDialogOption
{
ShowDirsOnly = 0x00000001,
DontResolveSymlinks = 0x00000002,
DontConfirmOverwrite = 0x00000004,
-#if QT_DEPRECATED_SINCE(5, 14)
- DontUseSheet Q_DECL_ENUMERATOR_DEPRECATED = 0x00000008,
-#endif
- DontUseNativeDialog = 0x00000010,
- ReadOnly = 0x00000020,
- HideNameFilterDetails = 0x00000040,
- DontUseCustomDirectoryIcons = 0x00000080
+ DontUseNativeDialog = 0x00000008,
+ ReadOnly = 0x00000010,
+ HideNameFilterDetails = 0x00000020,
+ DontUseCustomDirectoryIcons = 0x00000040
};
Q_DECLARE_FLAGS(FileDialogOptions, FileDialogOption)
Q_FLAG(FileDialogOptions)
@@ -438,9 +404,16 @@ protected:
~QMessageDialogOptions();
public:
+ // Keep in sync with QMessageBox Option
+ enum class Option {
+ DontUseNativeDialog = 0x00000001,
+ };
+ Q_DECLARE_FLAGS(Options, Option);
+ Q_FLAG(Options);
+
// Keep in sync with QMessageBox::Icon
- enum Icon { NoIcon, Information, Warning, Critical, Question };
- Q_ENUM(Icon)
+ enum StandardIcon { NoIcon, Information, Warning, Critical, Question };
+ Q_ENUM(StandardIcon)
static QSharedPointer<QMessageDialogOptions> create();
QSharedPointer<QMessageDialogOptions> clone() const;
@@ -448,8 +421,11 @@ public:
QString windowTitle() const;
void setWindowTitle(const QString &);
- void setIcon(Icon icon);
- Icon icon() const;
+ void setStandardIcon(StandardIcon icon);
+ StandardIcon standardIcon() const;
+
+ void setIconPixmap(const QPixmap &pixmap);
+ QPixmap iconPixmap() const;
void setText(const QString &text);
QString text() const;
@@ -460,6 +436,11 @@ public:
void setDetailedText(const QString &text);
QString detailedText() const;
+ void setOption(Option option, bool on = true);
+ bool testOption(Option option) const;
+ void setOptions(Options options);
+ Options options() const;
+
void setStandardButtons(QPlatformDialogHelper::StandardButtons buttons);
QPlatformDialogHelper::StandardButtons standardButtons() const;
@@ -478,10 +459,21 @@ public:
};
int addButton(const QString &label, QPlatformDialogHelper::ButtonRole role,
- void *buttonImpl = nullptr);
+ void *buttonImpl = nullptr, int buttonId = 0);
void removeButton(int id);
- const QVector<CustomButton> &customButtons();
+ const QList<CustomButton> &customButtons();
const CustomButton *customButton(int id);
+ void clearCustomButtons();
+
+ void setCheckBox(const QString &label, Qt::CheckState state);
+ QString checkBoxLabel() const;
+ Qt::CheckState checkBoxState() const;
+
+ void setEscapeButton(int id);
+ int escapeButton() const;
+
+ void setDefaultButton(int id);
+ int defaultButton() const;
private:
QMessageDialogOptionsPrivate *d;
@@ -496,6 +488,7 @@ public:
Q_SIGNALS:
void clicked(QPlatformDialogHelper::StandardButton button, QPlatformDialogHelper::ButtonRole role);
+ void checkBoxStateChanged(Qt::CheckState state);
private:
QSharedPointer<QMessageDialogOptions> m_options;
diff --git a/src/gui/kernel/qplatformdrag.cpp b/src/gui/kernel/qplatformdrag.cpp
index b40ddcbfb8..cf50587996 100644
--- a/src/gui/kernel/qplatformdrag.cpp
+++ b/src/gui/kernel/qplatformdrag.cpp
@@ -1,41 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the QtGui module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#include "qplatformdrag.h"
diff --git a/src/gui/kernel/qplatformdrag.h b/src/gui/kernel/qplatformdrag.h
index 0c99539357..d9e4a553b8 100644
--- a/src/gui/kernel/qplatformdrag.h
+++ b/src/gui/kernel/qplatformdrag.h
@@ -1,41 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the QtGui module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#ifndef QPLATFORMDRAG_H
#define QPLATFORMDRAG_H
diff --git a/src/gui/kernel/qplatformgraphicsbuffer.cpp b/src/gui/kernel/qplatformgraphicsbuffer.cpp
index 73ec033e19..52fc2770b4 100644
--- a/src/gui/kernel/qplatformgraphicsbuffer.cpp
+++ b/src/gui/kernel/qplatformgraphicsbuffer.cpp
@@ -1,41 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the QtGui module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#include "qplatformgraphicsbuffer.h"
#include <QtGui/QOpenGLContext>
@@ -60,10 +24,6 @@ QT_BEGIN_NAMESPACE
There is no public constructor nor any public factory function.
- QPlatformGraphicsBuffer is intended to be created by using platform specific
- APIs available from QtPlatformHeaders, or there might be accessor functions
- similar to the accessor function that QPlatformBackingstore has.
-
\internal
*/
@@ -274,3 +234,5 @@ QPlatformGraphicsBuffer::Origin QPlatformGraphicsBuffer::origin() const
*/
QT_END_NAMESPACE
+
+#include "moc_qplatformgraphicsbuffer.cpp"
diff --git a/src/gui/kernel/qplatformgraphicsbuffer.h b/src/gui/kernel/qplatformgraphicsbuffer.h
index 9004116ea4..6723c63f0c 100644
--- a/src/gui/kernel/qplatformgraphicsbuffer.h
+++ b/src/gui/kernel/qplatformgraphicsbuffer.h
@@ -1,41 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the QtGui module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#ifndef QPLATFORMGRAPHICSBUFFER_H
#define QPLATFORMGRAPHICSBUFFER_H
diff --git a/src/gui/kernel/qplatformgraphicsbufferhelper.cpp b/src/gui/kernel/qplatformgraphicsbufferhelper.cpp
index c67e6d15cb..0ec2308453 100644
--- a/src/gui/kernel/qplatformgraphicsbufferhelper.cpp
+++ b/src/gui/kernel/qplatformgraphicsbufferhelper.cpp
@@ -1,41 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the QtGui module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#include <QtGui/qpa/qplatformgraphicsbuffer.h>
@@ -46,6 +10,10 @@
#include <QtGui/QOpenGLContext>
#include <QtGui/QOpenGLFunctions>
+#ifndef GL_UNPACK_ROW_LENGTH
+#define GL_UNPACK_ROW_LENGTH 0x0CF2
+#endif
+
#ifndef GL_RGB10_A2
#define GL_RGB10_A2 0x8059
#endif
@@ -161,66 +129,68 @@ bool QPlatformGraphicsBufferHelper::bindSWToTexture(const QPlatformGraphicsBuffe
bool premultiplied = false;
QImage::Format imageformat = QImage::toImageFormat(graphicsBuffer->format());
QImage image(graphicsBuffer->data(), size.width(), size.height(), graphicsBuffer->bytesPerLine(), imageformat);
- if (graphicsBuffer->bytesPerLine() != (size.width() * 4)) {
- needsConversion = true;
- } else {
- switch (imageformat) {
- case QImage::Format_ARGB32_Premultiplied:
+ switch (imageformat) {
+ case QImage::Format_ARGB32_Premultiplied:
+ premultiplied = true;
+ Q_FALLTHROUGH();
+ case QImage::Format_RGB32:
+ case QImage::Format_ARGB32:
+ swizzle = true;
+ break;
+ case QImage::Format_RGBA8888_Premultiplied:
+ premultiplied = true;
+ Q_FALLTHROUGH();
+ case QImage::Format_RGBX8888:
+ case QImage::Format_RGBA8888:
+ break;
+ case QImage::Format_BGR30:
+ case QImage::Format_A2BGR30_Premultiplied:
+ if (!ctx->isOpenGLES() || ctx->format().majorVersion() >= 3) {
+ pixelType = GL_UNSIGNED_INT_2_10_10_10_REV;
+ internalFormat = GL_RGB10_A2;
premultiplied = true;
- Q_FALLTHROUGH();
- case QImage::Format_RGB32:
- case QImage::Format_ARGB32:
- swizzle = true;
- break;
- case QImage::Format_RGBA8888_Premultiplied:
+ } else {
+ needsConversion = true;
+ }
+ break;
+ case QImage::Format_RGB30:
+ case QImage::Format_A2RGB30_Premultiplied:
+ if (!ctx->isOpenGLES() || ctx->format().majorVersion() >= 3) {
+ pixelType = GL_UNSIGNED_INT_2_10_10_10_REV;
+ internalFormat = GL_RGB10_A2;
premultiplied = true;
- Q_FALLTHROUGH();
- case QImage::Format_RGBX8888:
- case QImage::Format_RGBA8888:
- break;
- case QImage::Format_BGR30:
- case QImage::Format_A2BGR30_Premultiplied:
- if (!ctx->isOpenGLES() || ctx->format().majorVersion() >= 3) {
- pixelType = GL_UNSIGNED_INT_2_10_10_10_REV;
- internalFormat = GL_RGB10_A2;
- premultiplied = true;
- } else {
- needsConversion = true;
- }
- break;
- case QImage::Format_RGB30:
- case QImage::Format_A2RGB30_Premultiplied:
- if (!ctx->isOpenGLES() || ctx->format().majorVersion() >= 3) {
- pixelType = GL_UNSIGNED_INT_2_10_10_10_REV;
- internalFormat = GL_RGB10_A2;
- premultiplied = true;
- swizzle = true;
- } else {
- needsConversion = true;
- }
- break;
- default:
+ swizzle = true;
+ } else {
needsConversion = true;
- break;
}
+ break;
+ default:
+ needsConversion = true;
+ break;
}
+ if (!needsConversion && image.bytesPerLine() != (size.width() * 4) && ctx->isOpenGLES() && ctx->format().majorVersion() < 3)
+ needsConversion = true;
if (needsConversion)
- image = image.convertToFormat(QImage::Format_RGBA8888);
+ image.convertTo(QImage::Format_RGBA8888);
+ bool needsRowLength = (image.bytesPerLine() != image.width() * 4);
QOpenGLFunctions *funcs = ctx->functions();
QRect rect = subRect;
if (rect.isNull() || rect == QRect(QPoint(0,0),size)) {
+ if (needsRowLength)
+ funcs->glPixelStorei(GL_UNPACK_ROW_LENGTH, GLint(image.bytesPerLine() / 4));
funcs->glTexImage2D(GL_TEXTURE_2D, 0, internalFormat, size.width(), size.height(), 0, GL_RGBA, pixelType, image.constBits());
+ if (needsRowLength)
+ funcs->glPixelStorei(GL_UNPACK_ROW_LENGTH, 0);
} else {
-#ifndef QT_OPENGL_ES_2
- if (!ctx->isOpenGLES()) {
- funcs->glPixelStorei(GL_UNPACK_ROW_LENGTH, image.width());
+ if (!ctx->isOpenGLES() || ctx->format().majorVersion() >= 3) {
+ // OpenGL 2.1+ or OpenGL ES/3+
+ funcs->glPixelStorei(GL_UNPACK_ROW_LENGTH, GLint(image.bytesPerLine() / 4));
funcs->glTexSubImage2D(GL_TEXTURE_2D, 0, rect.x(), rect.y(), rect.width(), rect.height(), GL_RGBA, pixelType,
image.constScanLine(rect.y()) + rect.x() * 4);
funcs->glPixelStorei(GL_UNPACK_ROW_LENGTH, 0);
} else
-#endif
{
// if the rect is wide enough it's cheaper to just
// extend it instead of doing an image copy
@@ -232,7 +202,7 @@ bool QPlatformGraphicsBufferHelper::bindSWToTexture(const QPlatformGraphicsBuffe
// if the sub-rect is full-width we can pass the image data directly to
// OpenGL instead of copying, since there's no gap between scanlines
- if (rect.width() == size.width()) {
+ if (rect.width() == image.bytesPerLine() / 4) {
funcs->glTexSubImage2D(GL_TEXTURE_2D, 0, 0, rect.y(), rect.width(), rect.height(), GL_RGBA, pixelType,
image.constScanLine(rect.y()));
} else {
@@ -249,10 +219,10 @@ bool QPlatformGraphicsBufferHelper::bindSWToTexture(const QPlatformGraphicsBuffe
return true;
#else
- Q_UNUSED(graphicsBuffer)
- Q_UNUSED(swizzleRandB)
- Q_UNUSED(premultipliedB)
- Q_UNUSED(subRect)
+ Q_UNUSED(graphicsBuffer);
+ Q_UNUSED(swizzleRandB);
+ Q_UNUSED(premultipliedB);
+ Q_UNUSED(subRect);
return false;
#endif // QT_NO_OPENGL
}
diff --git a/src/gui/kernel/qplatformgraphicsbufferhelper.h b/src/gui/kernel/qplatformgraphicsbufferhelper.h
index bfe61713d4..e408e4a674 100644
--- a/src/gui/kernel/qplatformgraphicsbufferhelper.h
+++ b/src/gui/kernel/qplatformgraphicsbufferhelper.h
@@ -1,41 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the QtGui module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#ifndef QPLATFORMGRAPHICSBUFFERHELPER_H
#define QPLATFORMGRAPHICSBUFFERHELPER_H
@@ -46,7 +10,7 @@
QT_BEGIN_NAMESPACE
namespace QPlatformGraphicsBufferHelper {
- bool lockAndBindToTexture(QPlatformGraphicsBuffer *graphicsBuffer, bool *swizzleRandB, bool *premultipliedB, const QRect &rect = QRect());
+ Q_GUI_EXPORT bool lockAndBindToTexture(QPlatformGraphicsBuffer *graphicsBuffer, bool *swizzleRandB, bool *premultipliedB, const QRect &rect = QRect());
bool bindSWToTexture(const QPlatformGraphicsBuffer *graphicsBuffer, bool *swizzleRandB = nullptr, bool *premultipliedB = nullptr, const QRect &rect = QRect());
}
diff --git a/src/gui/kernel/qplatforminputcontext.cpp b/src/gui/kernel/qplatforminputcontext.cpp
index 9771e6ba11..9d3ee4acb6 100644
--- a/src/gui/kernel/qplatforminputcontext.cpp
+++ b/src/gui/kernel/qplatforminputcontext.cpp
@@ -1,46 +1,11 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the QtGui module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#include "qplatforminputcontext.h"
#include <qguiapplication.h>
#include <QRect>
#include "private/qkeymapper_p.h"
+#include "private/qhighdpiscaling_p.h"
#include <qpa/qplatforminputcontext_p.h>
#include <QtGui/qtransform.h>
@@ -82,6 +47,11 @@ QT_BEGIN_NAMESPACE
QPlatformInputContext::QPlatformInputContext()
: QObject(*(new QPlatformInputContextPrivate))
{
+ // Delay initialization of cached input direction
+ // until super class has finished constructing.
+ QMetaObject::invokeMethod(this, [this]{
+ m_inputDirection = inputDirection();
+ }, Qt::QueuedConnection);
}
/*!
@@ -106,7 +76,7 @@ bool QPlatformInputContext::isValid() const
*/
bool QPlatformInputContext::hasCapability(Capability capability) const
{
- Q_UNUSED(capability)
+ Q_UNUSED(capability);
return true;
}
@@ -130,13 +100,13 @@ void QPlatformInputContext::update(Qt::InputMethodQueries)
}
/*!
- Called when when the word currently being composed in input item is tapped by
+ Called when the word currently being composed in the input item is tapped by
the user. Input methods often use this information to offer more word
suggestions to the user.
*/
void QPlatformInputContext::invokeAction(QInputMethod::Action action, int cursorPosition)
{
- Q_UNUSED(cursorPosition)
+ Q_UNUSED(cursorPosition);
// Default behavior for simple ephemeral input contexts. Some
// complex input contexts should not be reset here.
if (action == QInputMethod::Click)
@@ -151,7 +121,7 @@ void QPlatformInputContext::invokeAction(QInputMethod::Action action, int cursor
*/
bool QPlatformInputContext::filterEvent(const QEvent *event)
{
- Q_UNUSED(event)
+ Q_UNUSED(event);
return false;
}
@@ -227,22 +197,29 @@ void QPlatformInputContext::emitInputPanelVisibleChanged()
QLocale QPlatformInputContext::locale() const
{
- return qt_keymapper_private()->keyboardInputLocale;
+ return QLocale::system();
}
void QPlatformInputContext::emitLocaleChanged()
{
emit QGuiApplication::inputMethod()->localeChanged();
+
+ // Changing the locale might have updated the input direction
+ emitInputDirectionChanged(inputDirection());
}
Qt::LayoutDirection QPlatformInputContext::inputDirection() const
{
- return qt_keymapper_private()->keyboardInputDirection;
+ return locale().textDirection();
}
void QPlatformInputContext::emitInputDirectionChanged(Qt::LayoutDirection newDirection)
{
+ if (newDirection == m_inputDirection)
+ return;
+
emit QGuiApplication::inputMethod()->inputDirectionChanged(newDirection);
+ m_inputDirection = newDirection;
}
/*!
@@ -251,7 +228,7 @@ void QPlatformInputContext::emitInputDirectionChanged(Qt::LayoutDirection newDir
*/
void QPlatformInputContext::setFocusObject(QObject *object)
{
- Q_UNUSED(object)
+ Q_UNUSED(object);
}
/*!
@@ -270,16 +247,20 @@ void QPlatformInputContextPrivate::setInputMethodAccepted(bool accepted)
}
/*!
- * \brief QPlatformInputContext::setSelectionOnFocusObject
- * \param anchorPos Beginning of selection in currently active window coordinates
- * \param cursorPos End of selection in currently active window coordinates
- */
-void QPlatformInputContext::setSelectionOnFocusObject(const QPointF &anchorPos, const QPointF &cursorPos)
+ \brief QPlatformInputContext::setSelectionOnFocusObject
+ \param anchorPos Beginning of selection in currently active window native coordinates
+ \param cursorPos End of selection in currently active window native coordinates
+*/
+void QPlatformInputContext::setSelectionOnFocusObject(const QPointF &nativeAnchorPos, const QPointF &nativeCursorPos)
{
QObject *focus = qApp->focusObject();
if (!focus)
return;
+ QWindow *window = qApp->focusWindow();
+ const QPointF &anchorPos = QHighDpi::fromNativePixels(nativeAnchorPos, window);
+ const QPointF &cursorPos = QHighDpi::fromNativePixels(nativeCursorPos, window);
+
QInputMethod *im = QGuiApplication::inputMethod();
const QTransform mapToLocal = im->inputItemTransform().inverted();
bool success;
@@ -297,4 +278,80 @@ void QPlatformInputContext::setSelectionOnFocusObject(const QPointF &anchorPos,
}
}
+/*!
+ \brief QPlatformInputContext::queryFocusObject
+
+ Queries the current foucus object with a window position in native pixels.
+*/
+QVariant QPlatformInputContext::queryFocusObject(Qt::InputMethodQuery query, QPointF nativePosition)
+{
+ const QPointF position = QHighDpi::fromNativePixels(nativePosition, QGuiApplication::focusWindow());
+ const QInputMethod *im = QGuiApplication::inputMethod();
+ const QTransform mapToLocal = im->inputItemTransform().inverted();
+ return im->queryFocusObject(query, mapToLocal.map(position));
+}
+
+/*!
+ \brief QPlatformInputContext::inputItemRectangle
+
+ Returns the input item rectangle for the currently active window
+ and input methiod in native window coordinates.
+*/
+QRectF QPlatformInputContext::inputItemRectangle()
+{
+ QInputMethod *im = QGuiApplication::inputMethod();
+ const QRectF deviceIndependentRectangle = im->inputItemTransform().mapRect(im->inputItemRectangle());
+ return QHighDpi::toNativePixels(deviceIndependentRectangle, QGuiApplication::focusWindow());
+}
+
+/*!
+ \brief QPlatformInputContext::inputItemClipRectangle
+
+ Returns the input item clip rectangle for the currently active window
+ and input methiod in native window coordinates.
+*/
+QRectF QPlatformInputContext::inputItemClipRectangle()
+{
+ return QHighDpi::toNativePixels(
+ QGuiApplication::inputMethod()->inputItemClipRectangle(), QGuiApplication::focusWindow());
+}
+
+/*!
+ \brief QPlatformInputContext::cursorRectangle
+
+ Returns the cursor rectangle for the currently active window
+ and input methiod in native window coordinates.
+*/
+QRectF QPlatformInputContext::cursorRectangle()
+{
+ return QHighDpi::toNativePixels(
+ QGuiApplication::inputMethod()->cursorRectangle(), QGuiApplication::focusWindow());
+}
+
+/*!
+ \brief QPlatformInputContext::anchorRectangle
+
+ Returns the anchor rectangle for the currently active window
+ and input methiod in native window coordinates.
+*/
+QRectF QPlatformInputContext::anchorRectangle()
+{
+ return QHighDpi::toNativePixels(
+ QGuiApplication::inputMethod()->anchorRectangle(), QGuiApplication::focusWindow());
+}
+
+/*!
+ \brief QPlatformInputContext::keyboardRectangle
+
+ Returns the keyboard rectangle for the currently active window
+ and input methiod in native window coordinates.
+*/
+QRectF QPlatformInputContext::keyboardRectangle()
+{
+ return QHighDpi::toNativePixels(
+ QGuiApplication::inputMethod()->keyboardRectangle(), QGuiApplication::focusWindow());
+}
+
QT_END_NAMESPACE
+
+#include "moc_qplatforminputcontext.cpp"
diff --git a/src/gui/kernel/qplatforminputcontext.h b/src/gui/kernel/qplatforminputcontext.h
index ad0e5bcf35..481f97a065 100644
--- a/src/gui/kernel/qplatforminputcontext.h
+++ b/src/gui/kernel/qplatforminputcontext.h
@@ -1,41 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the QtGui module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#ifndef QPLATFORMINPUTCONTEXT_H
#define QPLATFORMINPUTCONTEXT_H
@@ -97,11 +61,19 @@ public:
bool inputMethodAccepted() const;
static void setSelectionOnFocusObject(const QPointF &anchorPos, const QPointF &cursorPos);
+ static QVariant queryFocusObject(Qt::InputMethodQuery query, QPointF position);
+ static QRectF inputItemRectangle();
+ static QRectF inputItemClipRectangle();
+ static QRectF cursorRectangle();
+ static QRectF anchorRectangle();
+ static QRectF keyboardRectangle();
private:
friend class QGuiApplication;
friend class QGuiApplicationPrivate;
friend class QInputMethod;
+
+ Qt::LayoutDirection m_inputDirection;
};
QT_END_NAMESPACE
diff --git a/src/gui/kernel/qplatforminputcontext_p.h b/src/gui/kernel/qplatforminputcontext_p.h
index c4f4b97d03..d26bfe70af 100644
--- a/src/gui/kernel/qplatforminputcontext_p.h
+++ b/src/gui/kernel/qplatforminputcontext_p.h
@@ -1,41 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the QtGui module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#ifndef QPLATFORMINPUTCONTEXT_P_H
#define QPLATFORMINPUTCONTEXT_P_H
diff --git a/src/gui/kernel/qplatforminputcontextfactory.cpp b/src/gui/kernel/qplatforminputcontextfactory.cpp
index 749abaf27a..933d990f7c 100644
--- a/src/gui/kernel/qplatforminputcontextfactory.cpp
+++ b/src/gui/kernel/qplatforminputcontextfactory.cpp
@@ -1,41 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the QtGui module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#include <qpa/qplatforminputcontextfactory_p.h>
#include <qpa/qplatforminputcontextplugin_p.h>
@@ -48,35 +12,60 @@
QT_BEGIN_NAMESPACE
+using namespace Qt::StringLiterals;
+
#if QT_CONFIG(settings)
-Q_GLOBAL_STATIC_WITH_ARGS(QFactoryLoader, loader,
- (QPlatformInputContextFactoryInterface_iid, QLatin1String("/platforminputcontexts"), Qt::CaseInsensitive))
+Q_GLOBAL_STATIC_WITH_ARGS(QFactoryLoader, icLoader,
+ (QPlatformInputContextFactoryInterface_iid, "/platforminputcontexts"_L1, Qt::CaseInsensitive))
#endif
QStringList QPlatformInputContextFactory::keys()
{
#if QT_CONFIG(settings)
- return loader()->keyMap().values();
+ return icLoader()->keyMap().values();
#else
return QStringList();
#endif
}
-QString QPlatformInputContextFactory::requested()
+QStringList QPlatformInputContextFactory::requested()
{
- QByteArray env = qgetenv("QT_IM_MODULE");
- return env.isNull() ? QString() : QString::fromLocal8Bit(env);
+ QStringList imList;
+ QByteArray env = qgetenv("QT_IM_MODULES");
+
+ if (!env.isEmpty())
+ imList = QString::fromLocal8Bit(env).split(QChar::fromLatin1(';'), Qt::SkipEmptyParts);
+
+ if (!imList.isEmpty())
+ return imList;
+
+ env = qgetenv("QT_IM_MODULE");
+ if (!env.isEmpty())
+ imList = {QString::fromLocal8Bit(env)};
+
+ return imList;
+}
+
+QPlatformInputContext *QPlatformInputContextFactory::create(const QStringList& keys)
+{
+ for (const QString &key : keys) {
+ auto plugin = create(key);
+ if (plugin)
+ return plugin;
+ }
+
+ return nullptr;
}
QPlatformInputContext *QPlatformInputContextFactory::create(const QString& key)
{
#if QT_CONFIG(settings)
if (!key.isEmpty()) {
- QStringList paramList = key.split(QLatin1Char(':'));
+ QStringList paramList = key.split(u':');
const QString platform = paramList.takeFirst().toLower();
QPlatformInputContext *ic = qLoadPlugin<QPlatformInputContext, QPlatformInputContextPlugin>
- (loader(), platform, paramList);
+ (icLoader(), platform, paramList);
if (ic && ic->isValid())
return ic;
diff --git a/src/gui/kernel/qplatforminputcontextfactory_p.h b/src/gui/kernel/qplatforminputcontextfactory_p.h
index 881421ce49..5f5881c508 100644
--- a/src/gui/kernel/qplatforminputcontextfactory_p.h
+++ b/src/gui/kernel/qplatforminputcontextfactory_p.h
@@ -1,41 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the QtGui module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#ifndef QPLATFORMINPUTCONTEXTFACTORY_H
#define QPLATFORMINPUTCONTEXTFACTORY_H
@@ -63,7 +27,8 @@ class Q_GUI_EXPORT QPlatformInputContextFactory
{
public:
static QStringList keys();
- static QString requested();
+ static QStringList requested();
+ static QPlatformInputContext *create(const QStringList &keys);
static QPlatformInputContext *create(const QString &key);
static QPlatformInputContext *create();
};
diff --git a/src/gui/kernel/qplatforminputcontextplugin.cpp b/src/gui/kernel/qplatforminputcontextplugin.cpp
index 53d56dbb48..fdfc8483b5 100644
--- a/src/gui/kernel/qplatforminputcontextplugin.cpp
+++ b/src/gui/kernel/qplatforminputcontextplugin.cpp
@@ -1,41 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the QtGui module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#include "qplatforminputcontextplugin_p.h"
@@ -51,3 +15,5 @@ QPlatformInputContextPlugin::~QPlatformInputContextPlugin()
}
QT_END_NAMESPACE
+
+#include "moc_qplatforminputcontextplugin_p.cpp"
diff --git a/src/gui/kernel/qplatforminputcontextplugin_p.h b/src/gui/kernel/qplatforminputcontextplugin_p.h
index 2228d5c8d6..819955bef4 100644
--- a/src/gui/kernel/qplatforminputcontextplugin_p.h
+++ b/src/gui/kernel/qplatforminputcontextplugin_p.h
@@ -1,41 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the QtGui module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#ifndef QPLATFORMINPUTCONTEXTPLUGIN_H
#define QPLATFORMINPUTCONTEXTPLUGIN_H
diff --git a/src/gui/kernel/qplatformintegration.cpp b/src/gui/kernel/qplatformintegration.cpp
index 63f66e6bf7..130b479c64 100644
--- a/src/gui/kernel/qplatformintegration.cpp
+++ b/src/gui/kernel/qplatformintegration.cpp
@@ -1,47 +1,12 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the QtGui module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#include "qplatformintegration.h"
#include <qpa/qplatformfontdatabase.h>
#include <qpa/qplatformclipboard.h>
#include <qpa/qplatformaccessibility.h>
+#include <qpa/qplatformkeymapper.h>
#include <qpa/qplatformtheme.h>
#include <QtGui/private/qguiapplication_p.h>
#include <QtGui/private/qpixmap_raster_p.h>
@@ -187,7 +152,7 @@ QPlatformServices *QPlatformIntegration::services() const
/*!
\enum QPlatformIntegration::Capability
- Capabilities are used to determing specific features of a platform integration
+ Capabilities are used to determine specific features of a platform integration
\value ThreadedPixmaps The platform uses a pixmap implementation that is reentrant
and can be used from multiple threads, like the raster paint engine and QImage based
@@ -199,8 +164,8 @@ QPlatformServices *QPlatformIntegration::services() const
\value SharedGraphicsCache The platform supports a shared graphics cache
- \value BufferQueueingOpenGL The OpenGL implementation on the platform will queue
- up buffers when swapBuffers() is called and block only when its buffer pipeline
+ \value BufferQueueingOpenGL Deprecated. The OpenGL implementation on the platform will
+ queue up buffers when swapBuffers() is called and block only when its buffer pipeline
is full, rather than block immediately.
\value MultipleWindows The platform supports multiple QWindows, i.e. does some kind
@@ -247,6 +212,28 @@ QPlatformServices *QPlatformIntegration::services() const
\value OpenGLOnRasterSurface The platform supports making a QOpenGLContext current
in combination with a QWindow of type RasterSurface.
+
+ \value PaintEvents The platform sends paint events instead of expose events when
+ the window needs repainting. Expose events are only sent when a window is toggled
+ from a non-exposed to exposed state or back.
+
+ \value RhiBasedRendering The platform supports one or more of the 3D rendering APIs
+ that Qt Quick and other components can use via the Qt Rendering Hardware Interface. On
+ platforms where it is clear upfront that the platform cannot, or does not want to,
+ support rendering via 3D graphics APIs such as OpenGL, Vulkan, Direct 3D, or Metal,
+ this capability can be reported as \c false. That in effect means that in modules
+ where there is an alternative, such as Qt Quick with its \c software backend, an
+ automatic fallback to that alternative may occur, if applicable. The default
+ implementation of hasCapability() returns \c true.
+
+ \value ScreenWindowGrabbing The platform supports grabbing window on screen.
+ On Wayland, this capability can be reported as \c false. The default implementation
+ of hasCapability() returns \c true.
+
+ \value BackingStoreStaticContents The platform backingstore supports static contents.
+ On resize of the backingstore the static contents region is provided, and the backing
+ store is expected to propagate the static content to the resized backing store, without
+ clients needing to repaint the static content region.
*/
/*!
@@ -271,7 +258,8 @@ QPlatformServices *QPlatformIntegration::services() const
bool QPlatformIntegration::hasCapability(Capability cap) const
{
return cap == NonFullScreenWindows || cap == NativeWidgets || cap == WindowManagement
- || cap == TopStackedNativeChildWindows || cap == WindowActivation;
+ || cap == TopStackedNativeChildWindows || cap == WindowActivation
+ || cap == RhiBasedRendering || cap == ScreenWindowGrabbing;
}
QPlatformPixmap *QPlatformIntegration::createPlatformPixmap(QPlatformPixmap::PixelType type) const
@@ -324,7 +312,7 @@ QPlatformSharedGraphicsCache *QPlatformIntegration::createPlatformSharedGraphics
*/
QPaintEngine *QPlatformIntegration::createImagePaintEngine(QPaintDevice *paintDevice) const
{
- Q_UNUSED(paintDevice)
+ Q_UNUSED(paintDevice);
return nullptr;
}
@@ -360,7 +348,22 @@ QPlatformInputContext *QPlatformIntegration::inputContext() const
return nullptr;
}
-#ifndef QT_NO_ACCESSIBILITY
+/*!
+ Accessor for the platform integration's key mapper.
+
+ Default implementation returns a default QPlatformKeyMapper.
+
+ \sa QPlatformKeyMapper
+*/
+QPlatformKeyMapper *QPlatformIntegration::keyMapper() const
+{
+ static QPlatformKeyMapper *keyMapper = nullptr;
+ if (!keyMapper)
+ keyMapper = new QPlatformKeyMapper;
+ return keyMapper;
+}
+
+#if QT_CONFIG(accessibility)
/*!
Returns the platforms accessibility.
@@ -411,7 +414,7 @@ QVariant QPlatformIntegration::styleHint(StyleHint hint) const
case UseRtlExtensions:
return QVariant(false);
case SetFocusOnTouchRelease:
- return QVariant(false);
+ return QPlatformTheme::defaultThemeHint(QPlatformTheme::SetFocusOnTouchRelease);
case MousePressAndHoldInterval:
return QPlatformTheme::defaultThemeHint(QPlatformTheme::MousePressAndHoldInterval);
case TabFocusBehavior:
@@ -426,6 +429,16 @@ QVariant QPlatformIntegration::styleHint(StyleHint hint) const
return QPlatformTheme::defaultThemeHint(QPlatformTheme::WheelScrollLines);
case MouseQuickSelectionThreshold:
return QPlatformTheme::defaultThemeHint(QPlatformTheme::MouseQuickSelectionThreshold);
+ case MouseDoubleClickDistance:
+ return QPlatformTheme::defaultThemeHint(QPlatformTheme::MouseDoubleClickDistance);
+ case FlickStartDistance:
+ return QPlatformTheme::defaultThemeHint(QPlatformTheme::FlickStartDistance);
+ case FlickMaximumVelocity:
+ return QPlatformTheme::defaultThemeHint(QPlatformTheme::FlickMaximumVelocity);
+ case FlickDeceleration:
+ return QPlatformTheme::defaultThemeHint(QPlatformTheme::FlickDeceleration);
+ case UnderlineShortcut:
+ return true;
}
return 0;
@@ -437,6 +450,9 @@ Qt::WindowState QPlatformIntegration::defaultWindowState(Qt::WindowFlags flags)
if (flags & Qt::Popup & ~Qt::Window)
return Qt::WindowNoState;
+ if (flags & Qt::SubWindow)
+ return Qt::WindowNoState;
+
if (styleHint(QPlatformIntegration::ShowIsFullScreen).toBool())
return Qt::WindowFullScreen;
else if (styleHint(QPlatformIntegration::ShowIsMaximized).toBool())
@@ -472,7 +488,7 @@ QStringList QPlatformIntegration::themeNames() const
class QPlatformTheme *QPlatformIntegration::createPlatformTheme(const QString &name) const
{
- Q_UNUSED(name)
+ Q_UNUSED(name);
return new QPlatformTheme;
}
@@ -483,7 +499,7 @@ class QPlatformTheme *QPlatformIntegration::createPlatformTheme(const QString &n
*/
QPlatformOffscreenSurface *QPlatformIntegration::createPlatformOffscreenSurface(QOffscreenSurface *surface) const
{
- Q_UNUSED(surface)
+ Q_UNUSED(surface);
return nullptr;
}
@@ -525,6 +541,20 @@ void QPlatformIntegration::beep() const
{
}
+/*!
+ \since 6.0
+
+ Asks the platform to terminate the application.
+
+ Overrides should ensure there's a callback into the QWSI
+ function handleApplicationTermination so that the quit can
+ be propagated to QtGui and the application.
+*/
+void QPlatformIntegration::quit() const
+{
+ QWindowSystemInterface::handleApplicationTermination<QWindowSystemInterface::SynchronousDelivery>();
+}
+
#ifndef QT_NO_OPENGL
/*!
Platform integration function for querying the OpenGL implementation type.
@@ -562,7 +592,21 @@ void QPlatformIntegration::setApplicationIcon(const QIcon &icon) const
Q_UNUSED(icon);
}
-#if QT_CONFIG(vulkan) || defined(Q_CLANG_QDOC)
+/*!
+ \since 6.5
+
+ Should set the application's badge to \a number.
+
+ If the number is 0 the badge should be cleared.
+
+ \sa QGuiApplication::setBadge()
+*/
+void QPlatformIntegration::setApplicationBadge(qint64 number)
+{
+ Q_UNUSED(number);
+}
+
+#if QT_CONFIG(vulkan) || defined(Q_QDOC)
/*!
Factory function for QPlatformVulkanInstance. The \a instance parameter is a
diff --git a/src/gui/kernel/qplatformintegration.h b/src/gui/kernel/qplatformintegration.h
index 01406958e2..a18ae821c7 100644
--- a/src/gui/kernel/qplatformintegration.h
+++ b/src/gui/kernel/qplatformintegration.h
@@ -1,41 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the QtGui module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#ifndef QPLATFORMINTEGRATION_H
#define QPLATFORMINTEGRATION_H
@@ -69,6 +33,7 @@ class QPlatformOpenGLContext;
class QGuiGLFormat;
class QAbstractEventDispatcher;
class QPlatformInputContext;
+class QPlatformKeyMapper;
class QPlatformAccessibility;
class QPlatformTheme;
class QPlatformDialogHelper;
@@ -81,6 +46,30 @@ class QOffscreenSurface;
class QPlatformVulkanInstance;
class QVulkanInstance;
+namespace QNativeInterface::Private {
+
+template <typename R, typename I, auto func, typename... Args>
+struct QInterfaceProxyImp
+{
+ template <typename T>
+ static R apply(T *obj, Args... args)
+ {
+ if (auto *iface = dynamic_cast<I*>(obj))
+ return (iface->*func)(args...);
+ else
+ return R();
+ }
+};
+
+template <auto func>
+struct QInterfaceProxy;
+template <typename R, typename I, typename... Args, R(I::*func)(Args...)>
+struct QInterfaceProxy<func> : public QInterfaceProxyImp<R, I, func, Args...> {};
+template <typename R, typename I, typename... Args, R(I::*func)(Args...) const>
+struct QInterfaceProxy<func> : public QInterfaceProxyImp<R, I, func, Args...> {};
+
+} // QNativeInterface::Private
+
class Q_GUI_EXPORT QPlatformIntegration
{
public:
@@ -107,7 +96,11 @@ public:
SwitchableWidgetComposition,
TopStackedNativeChildWindows,
OpenGLOnRasterSurface,
- MaximizeUsingFullscreenGeometry
+ MaximizeUsingFullscreenGeometry,
+ PaintEvents,
+ RhiBasedRendering,
+ ScreenWindowGrabbing, // whether QScreen::grabWindow() is supported
+ BackingStoreStaticContents
};
virtual ~QPlatformIntegration() { }
@@ -138,7 +131,7 @@ public:
virtual QPlatformDrag *drag() const;
#endif
virtual QPlatformInputContext *inputContext() const;
-#ifndef QT_NO_ACCESSIBILITY
+#if QT_CONFIG(accessibility)
virtual QPlatformAccessibility *accessibility() const;
#endif
@@ -169,14 +162,23 @@ public:
UiEffects,
WheelScrollLines,
ShowShortcutsInContextMenus,
- MouseQuickSelectionThreshold
+ MouseQuickSelectionThreshold,
+ MouseDoubleClickDistance,
+ FlickStartDistance,
+ FlickMaximumVelocity,
+ FlickDeceleration,
+ UnderlineShortcut,
};
virtual QVariant styleHint(StyleHint hint) const;
virtual Qt::WindowState defaultWindowState(Qt::WindowFlags) const;
+protected:
virtual Qt::KeyboardModifiers queryKeyboardModifiers() const;
virtual QList<int> possibleKeys(const QKeyEvent *) const;
+ friend class QPlatformKeyMapper;
+public:
+ virtual QPlatformKeyMapper *keyMapper() const;
virtual QStringList themeNames() const;
virtual QPlatformTheme *createPlatformTheme(const QString &name) const;
@@ -193,13 +195,22 @@ public:
virtual QOpenGLContext::OpenGLModuleType openGLModuleType();
#endif
virtual void setApplicationIcon(const QIcon &icon) const;
+ virtual void setApplicationBadge(qint64 number);
virtual void beep() const;
+ virtual void quit() const;
-#if QT_CONFIG(vulkan) || defined(Q_CLANG_QDOC)
+#if QT_CONFIG(vulkan) || defined(Q_QDOC)
virtual QPlatformVulkanInstance *createPlatformVulkanInstance(QVulkanInstance *instance) const;
#endif
+ template <auto func, typename... Args>
+ auto call(Args... args)
+ {
+ using namespace QNativeInterface::Private;
+ return QInterfaceProxy<func>::apply(this, args...);
+ }
+
protected:
QPlatformIntegration() = default;
};
diff --git a/src/gui/kernel/qplatformintegrationfactory.cpp b/src/gui/kernel/qplatformintegrationfactory.cpp
index 3fcf9014a7..d0a5e8871f 100644
--- a/src/gui/kernel/qplatformintegrationfactory.cpp
+++ b/src/gui/kernel/qplatformintegrationfactory.cpp
@@ -1,41 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the QtGui module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#include <qpa/qplatformintegrationfactory_p.h>
#include <qpa/qplatformintegrationplugin.h>
@@ -48,27 +12,15 @@
QT_BEGIN_NAMESPACE
-Q_GLOBAL_STATIC_WITH_ARGS(QFactoryLoader, loader,
- (QPlatformIntegrationFactoryInterface_iid, QLatin1String("/platforms"), Qt::CaseInsensitive))
+using namespace Qt::StringLiterals;
-#if QT_CONFIG(library)
-Q_GLOBAL_STATIC_WITH_ARGS(QFactoryLoader, directLoader,
- (QPlatformIntegrationFactoryInterface_iid, QLatin1String(""), Qt::CaseInsensitive))
-#endif // QT_CONFIG(library)
+Q_GLOBAL_STATIC_WITH_ARGS(QFactoryLoader, piLoader,
+ (QPlatformIntegrationFactoryInterface_iid, "/platforms"_L1, Qt::CaseInsensitive))
QPlatformIntegration *QPlatformIntegrationFactory::create(const QString &platform, const QStringList &paramList, int &argc, char **argv, const QString &platformPluginPath)
{
-#if QT_CONFIG(library)
- // Try loading the plugin from platformPluginPath first:
- if (!platformPluginPath.isEmpty()) {
- QCoreApplication::addLibraryPath(platformPluginPath);
- if (QPlatformIntegration *ret = qLoadPlugin<QPlatformIntegration, QPlatformIntegrationPlugin>(directLoader(), platform, paramList, argc, argv))
- return ret;
- }
-#else
- Q_UNUSED(platformPluginPath);
-#endif
- return qLoadPlugin<QPlatformIntegration, QPlatformIntegrationPlugin>(loader(), platform, paramList, argc, argv);
+ piLoader->setExtraSearchPath(platformPluginPath);
+ return qLoadPlugin<QPlatformIntegration, QPlatformIntegrationPlugin>(piLoader(), platform, paramList, argc, argv);
}
/*!
@@ -80,25 +32,8 @@ QPlatformIntegration *QPlatformIntegrationFactory::create(const QString &platfor
QStringList QPlatformIntegrationFactory::keys(const QString &platformPluginPath)
{
- QStringList list;
-#if QT_CONFIG(library)
- if (!platformPluginPath.isEmpty()) {
- QCoreApplication::addLibraryPath(platformPluginPath);
- list = directLoader()->keyMap().values();
- if (!list.isEmpty()) {
- const QString postFix = QLatin1String(" (from ")
- + QDir::toNativeSeparators(platformPluginPath)
- + QLatin1Char(')');
- const QStringList::iterator end = list.end();
- for (QStringList::iterator it = list.begin(); it != end; ++it)
- (*it).append(postFix);
- }
- }
-#else
- Q_UNUSED(platformPluginPath);
-#endif
- list.append(loader()->keyMap().values());
- return list;
+ piLoader->setExtraSearchPath(platformPluginPath);
+ return piLoader->keyMap().values();
}
QT_END_NAMESPACE
diff --git a/src/gui/kernel/qplatformintegrationfactory_p.h b/src/gui/kernel/qplatformintegrationfactory_p.h
index 22c77ce8bd..0010815956 100644
--- a/src/gui/kernel/qplatformintegrationfactory_p.h
+++ b/src/gui/kernel/qplatformintegrationfactory_p.h
@@ -1,41 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the QtGui module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#ifndef QPLATFORMINTEGRATIONFACTORY_H
#define QPLATFORMINTEGRATIONFACTORY_H
diff --git a/src/gui/kernel/qplatformintegrationplugin.cpp b/src/gui/kernel/qplatformintegrationplugin.cpp
index b100eacbb5..faf32887c7 100644
--- a/src/gui/kernel/qplatformintegrationplugin.cpp
+++ b/src/gui/kernel/qplatformintegrationplugin.cpp
@@ -1,41 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the QtGui module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#include "qplatformintegrationplugin.h"
@@ -52,16 +16,18 @@ QPlatformIntegrationPlugin::~QPlatformIntegrationPlugin()
QPlatformIntegration *QPlatformIntegrationPlugin::create(const QString &key, const QStringList &paramList)
{
- Q_UNUSED(key)
+ Q_UNUSED(key);
Q_UNUSED(paramList);
return nullptr;
}
QPlatformIntegration *QPlatformIntegrationPlugin::create(const QString &key, const QStringList &paramList, int &argc, char **argv)
{
- Q_UNUSED(argc)
- Q_UNUSED(argv)
+ Q_UNUSED(argc);
+ Q_UNUSED(argv);
return create(key, paramList); // Fallback for platform plugins that do not implement the argc/argv version.
}
QT_END_NAMESPACE
+
+#include "moc_qplatformintegrationplugin.cpp"
diff --git a/src/gui/kernel/qplatformintegrationplugin.h b/src/gui/kernel/qplatformintegrationplugin.h
index 6a0b9dc9a7..cf4915ad83 100644
--- a/src/gui/kernel/qplatformintegrationplugin.h
+++ b/src/gui/kernel/qplatformintegrationplugin.h
@@ -1,41 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the QtGui module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#ifndef QPLATFORMINTEGRATIONPLUGIN_H
#define QPLATFORMINTEGRATIONPLUGIN_H
diff --git a/src/gui/kernel/qplatformkeymapper.cpp b/src/gui/kernel/qplatformkeymapper.cpp
new file mode 100644
index 0000000000..f54e4ff379
--- /dev/null
+++ b/src/gui/kernel/qplatformkeymapper.cpp
@@ -0,0 +1,38 @@
+// Copyright (C) 2023 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
+
+#include "qplatformkeymapper.h"
+
+#include <private/qguiapplication_p.h>
+#include <qpa/qplatformintegration.h>
+
+QT_BEGIN_NAMESPACE
+
+Q_LOGGING_CATEGORY(lcQpaKeyMapper, "qt.qpa.keymapper")
+
+QPlatformKeyMapper::~QPlatformKeyMapper()
+{
+}
+
+/*
+ Should return a list of possible key combinations for the given key event.
+
+ For example, given a US English keyboard layout, the key event Shift+5
+ can represent both a "Shift+5" key combination, as well as just "%".
+*/
+QList<QKeyCombination> QPlatformKeyMapper::possibleKeyCombinations(const QKeyEvent *event) const
+{
+ auto *platformIntegration = QGuiApplicationPrivate::platformIntegration();
+ QList<int> possibleKeys = platformIntegration->possibleKeys(event);
+ QList<QKeyCombination> combinations;
+ for (int key : possibleKeys)
+ combinations << QKeyCombination::fromCombined(key);
+ return combinations;
+}
+
+Qt::KeyboardModifiers QPlatformKeyMapper::queryKeyboardModifiers() const
+{
+ return QGuiApplicationPrivate::platformIntegration()->queryKeyboardModifiers();
+}
+
+QT_END_NAMESPACE
diff --git a/src/gui/kernel/qplatformkeymapper.h b/src/gui/kernel/qplatformkeymapper.h
new file mode 100644
index 0000000000..fb5b0cdb8b
--- /dev/null
+++ b/src/gui/kernel/qplatformkeymapper.h
@@ -0,0 +1,36 @@
+// Copyright (C) 2023 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
+
+#ifndef QPLATFORMKEYMAPPER_P
+#define QPLATFORMKEYMAPPER_P
+
+//
+// W A R N I N G
+// -------------
+//
+// This file is part of the QPA API and is not meant to be used
+// in applications. Usage of this API may make your code
+// source and binary incompatible with future versions of Qt.
+//
+
+#include <QtGui/qtguiglobal.h>
+#include <QtCore/qloggingcategory.h>
+
+QT_BEGIN_NAMESPACE
+
+Q_DECLARE_EXPORTED_LOGGING_CATEGORY(lcQpaKeyMapper, Q_GUI_EXPORT)
+
+class QKeyEvent;
+
+class Q_GUI_EXPORT QPlatformKeyMapper
+{
+public:
+ virtual ~QPlatformKeyMapper();
+
+ virtual QList<QKeyCombination> possibleKeyCombinations(const QKeyEvent *event) const;
+ virtual Qt::KeyboardModifiers queryKeyboardModifiers() const;
+};
+
+QT_END_NAMESPACE
+
+#endif // QPLATFORMKEYMAPPER_P
diff --git a/src/gui/kernel/qplatformmenu.cpp b/src/gui/kernel/qplatformmenu.cpp
index 0d76f2039d..d629c8b02d 100644
--- a/src/gui/kernel/qplatformmenu.cpp
+++ b/src/gui/kernel/qplatformmenu.cpp
@@ -1,42 +1,6 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Copyright (C) 2014 Martin Graesslin <mgraesslin@kde.org>
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the QtGui module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// Copyright (C) 2014 Martin Graesslin <mgraesslin@kde.org>
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#include "qplatformmenu.h"
@@ -92,3 +56,5 @@ QPlatformMenu *QPlatformMenuBar::createMenu() const
}
QT_END_NAMESPACE
+
+#include "moc_qplatformmenu.cpp"
diff --git a/src/gui/kernel/qplatformmenu.h b/src/gui/kernel/qplatformmenu.h
index 8e470aefd3..fbb54f2af1 100644
--- a/src/gui/kernel/qplatformmenu.h
+++ b/src/gui/kernel/qplatformmenu.h
@@ -1,42 +1,6 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Copyright (C) 2012 Klarälvdalens Datakonsult AB, a KDAB Group company, info@kdab.com, author James Turner <james.turner@kdab.com>
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the QtGui module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// Copyright (C) 2012 Klarälvdalens Datakonsult AB, a KDAB Group company, info@kdab.com, author James Turner <james.turner@kdab.com>
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#ifndef QPLATFORMMENU_H
#define QPLATFORMMENU_H
@@ -49,13 +13,14 @@
// source and binary incompatible with future versions of Qt.
//
+#include <QtCore/qobject.h>
#include <QtGui/qtguiglobal.h>
#include <QtCore/qpointer.h>
-#include <QtGui/QFont>
+#include <QtGui/qfont.h>
#if QT_CONFIG(shortcut)
-# include <QtGui/QKeySequence>
+# include <QtGui/qkeysequence.h>
#endif
-#include <QtGui/QIcon>
+#include <QtGui/qicon.h>
QT_BEGIN_NAMESPACE
diff --git a/src/gui/kernel/qplatformmenu_p.h b/src/gui/kernel/qplatformmenu_p.h
new file mode 100644
index 0000000000..00e3fa56da
--- /dev/null
+++ b/src/gui/kernel/qplatformmenu_p.h
@@ -0,0 +1,55 @@
+// Copyright (C) 2020 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
+
+#ifndef QPLATFORMMENU_P_H
+#define QPLATFORMMENU_P_H
+
+//
+// W A R N I N G
+// -------------
+//
+// This file is not part of the Qt API. It exists purely as an
+// implementation detail. This header file may change from version to
+// version without notice, or even be removed.
+//
+// We mean it.
+//
+
+#include <QtGui/private/qtguiglobal_p.h>
+
+#include <QtCore/qnativeinterface.h>
+
+QT_BEGIN_NAMESPACE
+
+// ----------------- QNativeInterface -----------------
+
+#if !defined(Q_OS_MACOS) && defined(Q_QDOC)
+typedef void NSMenu;
+#else
+QT_END_NAMESPACE
+Q_FORWARD_DECLARE_OBJC_CLASS(NSMenu);
+QT_BEGIN_NAMESPACE
+#endif
+
+namespace QNativeInterface::Private {
+
+#if defined(Q_OS_MACOS) || defined(Q_QDOC)
+struct Q_GUI_EXPORT QCocoaMenu
+{
+ QT_DECLARE_NATIVE_INTERFACE(QCocoaMenu)
+ virtual NSMenu *nsMenu() const = 0;
+ virtual void setAsDockMenu() const = 0;
+};
+
+struct Q_GUI_EXPORT QCocoaMenuBar
+{
+ QT_DECLARE_NATIVE_INTERFACE(QCocoaMenuBar)
+ virtual NSMenu *nsMenu() const = 0;
+};
+#endif
+
+} // QNativeInterface::Private
+
+QT_END_NAMESPACE
+
+#endif // QPLATFORMMENU_P_H
diff --git a/src/gui/kernel/qplatformnativeinterface.cpp b/src/gui/kernel/qplatformnativeinterface.cpp
index 8c9e73fbc2..d010f0b7c6 100644
--- a/src/gui/kernel/qplatformnativeinterface.cpp
+++ b/src/gui/kernel/qplatformnativeinterface.cpp
@@ -1,43 +1,9 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the QtGui module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#include "qplatformnativeinterface.h"
+#include <QtCore/qvariant.h>
+#include <QtCore/qmap.h>
#include <QtGui/qcursor.h>
QT_BEGIN_NAMESPACE
@@ -137,7 +103,7 @@ QFunctionPointer QPlatformNativeInterface::platformFunction(const QByteArray &fu
*/
QVariantMap QPlatformNativeInterface::windowProperties(QPlatformWindow *window) const
{
- Q_UNUSED(window)
+ Q_UNUSED(window);
return QVariantMap();
}
@@ -175,3 +141,5 @@ void QPlatformNativeInterface::setWindowProperty(QPlatformWindow *window, const
}
QT_END_NAMESPACE
+
+#include "moc_qplatformnativeinterface.cpp"
diff --git a/src/gui/kernel/qplatformnativeinterface.h b/src/gui/kernel/qplatformnativeinterface.h
index 95d6a03dbb..6e721ec71c 100644
--- a/src/gui/kernel/qplatformnativeinterface.h
+++ b/src/gui/kernel/qplatformnativeinterface.h
@@ -1,41 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the QtGui module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#ifndef QPLATFORMNATIVEINTERFACE_H
#define QPLATFORMNATIVEINTERFACE_H
@@ -66,6 +30,7 @@ class QBackingStore;
class Q_GUI_EXPORT QPlatformNativeInterface : public QObject
{
Q_OBJECT
+ Q_MOC_INCLUDE(<qpa/qplatformwindow.h>)
public:
virtual void *nativeResourceForIntegration(const QByteArray &resource);
virtual void *nativeResourceForContext(const QByteArray &resource, QOpenGLContext *context);
diff --git a/src/gui/kernel/qplatformoffscreensurface.cpp b/src/gui/kernel/qplatformoffscreensurface.cpp
index c2952e166c..653b0c762a 100644
--- a/src/gui/kernel/qplatformoffscreensurface.cpp
+++ b/src/gui/kernel/qplatformoffscreensurface.cpp
@@ -1,41 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2017 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the QtGui module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2017 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#include "qplatformoffscreensurface.h"
diff --git a/src/gui/kernel/qplatformoffscreensurface.h b/src/gui/kernel/qplatformoffscreensurface.h
index cef0fab7e1..227c04794a 100644
--- a/src/gui/kernel/qplatformoffscreensurface.h
+++ b/src/gui/kernel/qplatformoffscreensurface.h
@@ -1,41 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2017 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the QtGui module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2020 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#ifndef QPLATFORMOFFSCREENSURFACE_H
#define QPLATFORMOFFSCREENSURFACE_H
@@ -49,10 +13,13 @@
// source and binary incompatible with future versions of Qt.
//
-#include <QtGui/qtguiglobal.h>
#include "qplatformsurface.h"
+
+#include <QtGui/qoffscreensurface.h>
#include <QtCore/qscopedpointer.h>
+#include <QtCore/qnativeinterface.h>
+
QT_BEGIN_NAMESPACE
class QOffscreenSurface;
@@ -75,10 +42,24 @@ public:
protected:
QScopedPointer<QPlatformOffscreenSurfacePrivate> d_ptr;
+ friend class QOffscreenSurfacePrivate;
private:
Q_DISABLE_COPY(QPlatformOffscreenSurface)
};
+namespace QNativeInterface::Private {
+
+#if defined(Q_OS_ANDROID)
+struct Q_GUI_EXPORT QAndroidOffScreenIntegration
+{
+ QT_DECLARE_NATIVE_INTERFACE(QAndroidOffScreenIntegration)
+ virtual QOffscreenSurface *createOffscreenSurface(ANativeWindow *nativeSurface) const = 0;
+};
+#endif
+
+} // QNativeInterface::Private
+
+
QT_END_NAMESPACE
#endif // QPLATFORMOFFSCREENSURFACE_H
diff --git a/src/gui/kernel/qplatformopenglcontext.cpp b/src/gui/kernel/qplatformopenglcontext.cpp
index 839ec008aa..8391425caf 100644
--- a/src/gui/kernel/qplatformopenglcontext.cpp
+++ b/src/gui/kernel/qplatformopenglcontext.cpp
@@ -1,41 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the QtGui module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#include "qplatformopenglcontext.h"
@@ -165,4 +129,20 @@ bool QPlatformOpenGLContext::parseOpenGLVersion(const QByteArray &versionString,
return (majorOk && minorOk);
}
+/*!
+ Called when the RHI begins rendering a new frame in the context. Will always be paired with a
+ call to \l endFrame().
+*/
+void QPlatformOpenGLContext::beginFrame()
+{
+}
+
+/*!
+ Called when the RHI ends rendering a in the context. Is always preceded by a call to
+ \l beginFrame().
+*/
+void QPlatformOpenGLContext::endFrame()
+{
+}
+
QT_END_NAMESPACE
diff --git a/src/gui/kernel/qplatformopenglcontext.h b/src/gui/kernel/qplatformopenglcontext.h
index f307cc14f9..ac13c42655 100644
--- a/src/gui/kernel/qplatformopenglcontext.h
+++ b/src/gui/kernel/qplatformopenglcontext.h
@@ -1,41 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the QtGui module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#ifndef QPLATFORMOPENGLCONTEXT_H
#define QPLATFORMOPENGLCONTEXT_H
@@ -57,6 +21,9 @@
#include <QtGui/qsurfaceformat.h>
#include <QtGui/qwindow.h>
#include <QtGui/qopengl.h>
+#include <QtGui/qopenglcontext.h>
+
+#include <QtCore/qnativeinterface.h>
QT_BEGIN_NAMESPACE
@@ -81,6 +48,9 @@ public:
virtual bool makeCurrent(QPlatformSurface *surface) = 0;
virtual void doneCurrent() = 0;
+ virtual void beginFrame();
+ virtual void endFrame();
+
virtual bool isSharing() const { return false; }
virtual bool isValid() const { return true; }
@@ -92,6 +62,7 @@ public:
private:
friend class QOpenGLContext;
+ friend class QOpenGLContextPrivate;
QScopedPointer<QPlatformOpenGLContextPrivate> d_ptr;
@@ -100,6 +71,43 @@ private:
Q_DISABLE_COPY(QPlatformOpenGLContext)
};
+namespace QNativeInterface::Private {
+
+#if defined(Q_OS_MACOS)
+struct Q_GUI_EXPORT QCocoaGLIntegration
+{
+ QT_DECLARE_NATIVE_INTERFACE(QCocoaGLIntegration)
+ virtual QOpenGLContext *createOpenGLContext(NSOpenGLContext *, QOpenGLContext *shareContext) const = 0;
+};
+#endif
+
+#if defined(Q_OS_WIN)
+struct Q_GUI_EXPORT QWindowsGLIntegration
+{
+ QT_DECLARE_NATIVE_INTERFACE(QWindowsGLIntegration)
+ virtual HMODULE openGLModuleHandle() const = 0;
+ virtual QOpenGLContext *createOpenGLContext(HGLRC context, HWND window, QOpenGLContext *shareContext) const = 0;
+};
+#endif
+
+#if QT_CONFIG(xcb_glx_plugin)
+struct Q_GUI_EXPORT QGLXIntegration
+{
+ QT_DECLARE_NATIVE_INTERFACE(QGLXIntegration)
+ virtual QOpenGLContext *createOpenGLContext(GLXContext context, void *visualInfo, QOpenGLContext *shareContext) const = 0;
+};
+#endif
+
+#if QT_CONFIG(egl)
+struct Q_GUI_EXPORT QEGLIntegration
+{
+ QT_DECLARE_NATIVE_INTERFACE(QEGLIntegration)
+ virtual QOpenGLContext *createOpenGLContext(EGLContext context, EGLDisplay display, QOpenGLContext *shareContext) const = 0;
+};
+#endif
+
+} // QNativeInterface::Private
+
QT_END_NAMESPACE
#endif // QT_NO_OPENGL
diff --git a/src/gui/kernel/qplatformscreen.cpp b/src/gui/kernel/qplatformscreen.cpp
index 7c1e2158b1..0369a0b12a 100644
--- a/src/gui/kernel/qplatformscreen.cpp
+++ b/src/gui/kernel/qplatformscreen.cpp
@@ -1,41 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the QtGui module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#include "qplatformscreen.h"
#include <QtCore/qdebug.h>
@@ -47,6 +11,7 @@
#include <QtGui/qscreen.h>
#include <QtGui/qwindow.h>
#include <private/qhighdpiscaling_p.h>
+#include <private/qwindow_p.h>
QT_BEGIN_NAMESPACE
@@ -60,15 +25,11 @@ QPlatformScreen::QPlatformScreen()
QPlatformScreen::~QPlatformScreen()
{
Q_D(QPlatformScreen);
- if (d->screen) {
- qWarning("Manually deleting a QPlatformScreen. Call QWindowSystemInterface::handleScreenRemoved instead.");
- delete d->screen;
- }
+ Q_ASSERT_X(!d->screen, "QPlatformScreen",
+ "QPlatformScreens should be removed via QWindowSystemInterface::handleScreenRemoved()");
}
/*!
- \fn QPixmap QPlatformScreen::grabWindow(WId window, int x, int y, int width, int height) const
-
This function is called when Qt needs to be able to grab the content of a window.
Returns the content of the window specified with the WId handle within the boundaries of
@@ -93,8 +54,9 @@ QPixmap QPlatformScreen::grabWindow(WId window, int x, int y, int width, int hei
QWindow *QPlatformScreen::topLevelAt(const QPoint & pos) const
{
const QWindowList list = QGuiApplication::topLevelWindows();
- for (int i = list.size()-1; i >= 0; --i) {
- QWindow *w = list[i];
+ const auto crend = list.crend();
+ for (auto it = list.crbegin(); it != crend; ++it) {
+ QWindow *w = *it;
if (w->isVisible() && QHighDpi::toNativePixels(w->geometry(), w).contains(pos))
return w;
}
@@ -176,21 +138,16 @@ QSizeF QPlatformScreen::physicalSize() const
Reimplement this function in subclass to return the logical horizontal
and vertical dots per inch metrics of the screen.
- The logical dots per inch metrics are used by QFont to convert point sizes
- to pixel sizes.
+ The logical dots per inch metrics are used by Qt to scale the user interface.
- The default implementation uses the screen pixel size and physical size to
- compute the metrics.
+ The default implementation returns logicalBaseDpi(), which results in a
+ UI scale factor of 1.0.
\sa physicalSize
*/
QDpi QPlatformScreen::logicalDpi() const
{
- QSizeF ps = physicalSize();
- QSize s = geometry().size();
-
- return QDpi(25.4 * s.width() / ps.width(),
- 25.4 * s.height() / ps.height());
+ return logicalBaseDpi();
}
// Helper function for accessing the platform screen logical dpi
@@ -207,7 +164,7 @@ QPair<qreal, qreal> QPlatformScreen::overrideDpi(const QPair<qreal, qreal> &in)
default implementation returns 96.
QtGui will use this value (together with logicalDpi) to compute
- the scale factor when high-DPI scaling is enabled:
+ the scale factor when high-DPI scaling is enabled, as follows:
factor = logicalDPI / baseDPI
*/
QDpi QPlatformScreen::logicalBaseDpi() const
@@ -222,7 +179,6 @@ QDpi QPlatformScreen::logicalBaseDpi() const
implementation returns 1.0.
\sa QPlatformWindow::devicePixelRatio()
- \sa QPlatformScreen::pixelDensity()
*/
qreal QPlatformScreen::devicePixelRatio() const
{
@@ -230,24 +186,6 @@ qreal QPlatformScreen::devicePixelRatio() const
}
/*!
- Reimplement this function in subclass to return the pixel density of the
- screen. This is the scale factor needed to make a low-dpi application
- usable on this screen. The default implementation returns 1.0.
-
- Returning something else than 1.0 from this function causes Qt to
- apply the scale factor to the application's coordinate system.
- This is different from devicePixelRatio, which reports a scale
- factor already applied by the windowing system. A platform plugin
- typically implements one (or none) of these two functions.
-
- \sa QPlatformWindow::devicePixelRatio()
-*/
-qreal QPlatformScreen::pixelDensity() const
-{
- return 1.0;
-}
-
-/*!
Reimplement this function in subclass to return the vertical refresh rate
of the screen, in Hz.
@@ -282,29 +220,6 @@ Qt::ScreenOrientation QPlatformScreen::orientation() const
return Qt::PrimaryOrientation;
}
-/*
- Reimplement this function in subclass to filter out unneeded screen
- orientation updates.
-
- The orientations will anyway be filtered before QScreen::orientationChanged()
- is emitted, but the mask can be used by the platform plugin for example to
- prevent having to have an accelerometer sensor running all the time, or to
- improve the reported values. As an example of the latter, in case of only
- Landscape | InvertedLandscape being set in the mask, on a platform that gets
- its orientation readings from an accelerometer sensor embedded in a handheld
- device, the platform can report transitions between the two even when the
- device is held in an orientation that's closer to portrait.
-
- By default, the orientation update mask is empty, so unless this function
- has been called with a non-empty mask the platform does not need to report
- any orientation updates through
- QWindowSystemInterface::handleScreenOrientationChange().
-*/
-void QPlatformScreen::setOrientationUpdateMask(Qt::ScreenOrientations mask)
-{
- Q_UNUSED(mask);
-}
-
QPlatformScreen * QPlatformScreen::platformScreenForWindow(const QWindow *window)
{
// QTBUG 32681: It can happen during the transition between screens
@@ -367,8 +282,6 @@ QString QPlatformScreen::serialNumber() const
physicalSize() function, since this is the function it uses to calculate the dpi to use when
converting point sizes to pixels sizes. However, this is unfortunate on some systems, as the
native system fakes its dpi size.
-
- QPlatformScreen is also used by the public api QDesktopWidget for information about the desktop.
*/
/*! \fn QRect QPlatformScreen::geometry() const = 0
@@ -404,11 +317,12 @@ QPlatformCursor *QPlatformScreen::cursor() const
*/
void QPlatformScreen::resizeMaximizedWindows()
{
- // 'screen()' still has the old geometry info while 'this' has the new geometry info
+ // 'screen()' still has the old geometry (in device independent pixels),
+ // while 'this' has the new geometry (in native pixels)
const QRect oldGeometry = screen()->geometry();
const QRect oldAvailableGeometry = screen()->availableGeometry();
- const QRect newGeometry = deviceIndependentGeometry();
- const QRect newAvailableGeometry = QHighDpi::fromNative(availableGeometry(), QHighDpiScaling::factor(this), newGeometry.topLeft());
+ const QRect newNativeGeometry = this->geometry();
+ const QRect newNativeAvailableGeometry = this->availableGeometry();
const bool supportsMaximizeUsingFullscreen = QGuiApplicationPrivate::platformIntegration()->hasCapability(QPlatformIntegration::MaximizeUsingFullscreenGeometry);
@@ -417,14 +331,19 @@ void QPlatformScreen::resizeMaximizedWindows()
if (!w->handle())
continue;
+ // Set QPlatformWindow size in native pixels, and let the platform's geometry
+ // change signals update the QWindow geomeyry. This way we make sure that the
+ // platform window geometry covers the entire (available) platform screen geometry,
+ // also when fractional DPRs introduce rounding errors in the device independent
+ // QWindow and QScreen sizes.
if (supportsMaximizeUsingFullscreen
&& w->windowState() & Qt::WindowMaximized
&& w->flags() & Qt::MaximizeUsingFullscreenGeometryHint) {
- w->setGeometry(newGeometry);
+ w->handle()->setGeometry(newNativeGeometry);
} else if (w->windowState() & Qt::WindowMaximized || w->geometry() == oldAvailableGeometry) {
- w->setGeometry(newAvailableGeometry);
+ w->handle()->setGeometry(newNativeAvailableGeometry);
} else if (w->windowState() & Qt::WindowFullScreen || w->geometry() == oldGeometry) {
- w->setGeometry(newGeometry);
+ w->handle()->setGeometry(newNativeGeometry);
}
}
}
@@ -515,13 +434,6 @@ QRect QPlatformScreen::mapBetween(Qt::ScreenOrientation a, Qt::ScreenOrientation
return rect;
}
-QRect QPlatformScreen::deviceIndependentGeometry() const
-{
- qreal scaleFactor = QHighDpiScaling::factor(this);
- QRect nativeGeometry = geometry();
- return QRect(nativeGeometry.topLeft(), QHighDpi::fromNative(nativeGeometry.size(), scaleFactor));
-}
-
/*!
Returns a hint about this screen's subpixel layout structure.
@@ -579,9 +491,9 @@ void QPlatformScreen::setPowerState(PowerState state)
\since 5.9
*/
-QVector<QPlatformScreen::Mode> QPlatformScreen::modes() const
+QList<QPlatformScreen::Mode> QPlatformScreen::modes() const
{
- QVector<QPlatformScreen::Mode> list;
+ QList<QPlatformScreen::Mode> list;
list.append({geometry().size(), refreshRate()});
return list;
}
diff --git a/src/gui/kernel/qplatformscreen.h b/src/gui/kernel/qplatformscreen.h
index 0be7646032..a547a635e9 100644
--- a/src/gui/kernel/qplatformscreen.h
+++ b/src/gui/kernel/qplatformscreen.h
@@ -1,41 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the QtGui module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#ifndef QPLATFORMSCREEN_H
#define QPLATFORMSCREEN_H
@@ -57,6 +21,7 @@
#include <QtCore/qrect.h>
#include <QtCore/qobject.h>
+#include <QtGui/qcolorspace.h>
#include <QtGui/qcursor.h>
#include <QtGui/qimage.h>
#include <QtGui/qwindowdefs.h>
@@ -77,6 +42,7 @@ typedef QPair<qreal, qreal> QDpi;
class Q_GUI_EXPORT QPlatformScreen
{
+ Q_GADGET
Q_DECLARE_PRIVATE(QPlatformScreen)
public:
@@ -114,18 +80,17 @@ public:
virtual int depth() const = 0;
virtual QImage::Format format() const = 0;
+ virtual QColorSpace colorSpace() const { return QColorSpace::SRgb; }
virtual QSizeF physicalSize() const;
virtual QDpi logicalDpi() const;
virtual QDpi logicalBaseDpi() const;
virtual qreal devicePixelRatio() const;
- virtual qreal pixelDensity() const;
virtual qreal refreshRate() const;
virtual Qt::ScreenOrientation nativeOrientation() const;
virtual Qt::ScreenOrientation orientation() const;
- virtual void setOrientationUpdateMask(Qt::ScreenOrientations mask);
virtual QWindow *topLevelAt(const QPoint &point) const;
QWindowList windows() const;
@@ -151,7 +116,7 @@ public:
virtual PowerState powerState() const;
virtual void setPowerState(PowerState state);
- virtual QVector<Mode> modes() const;
+ virtual QList<Mode> modes() const;
virtual int currentMode() const;
virtual int preferredMode() const;
@@ -160,9 +125,6 @@ public:
static QTransform transformBetween(Qt::ScreenOrientation a, Qt::ScreenOrientation b, const QRect &target);
static QRect mapBetween(Qt::ScreenOrientation a, Qt::ScreenOrientation b, const QRect &rect);
- // The platform screen's geometry in device independent coordinates
- QRect deviceIndependentGeometry() const;
-
static QDpi overrideDpi(const QDpi &in);
protected:
@@ -171,7 +133,7 @@ protected:
QScopedPointer<QPlatformScreenPrivate> d_ptr;
private:
- friend class QScreenPrivate;
+ friend class QScreen;
};
// Qt doesn't currently support running with no platform screen
diff --git a/src/gui/kernel/qplatformscreen_p.h b/src/gui/kernel/qplatformscreen_p.h
index d5dc7b471a..345a90845c 100644
--- a/src/gui/kernel/qplatformscreen_p.h
+++ b/src/gui/kernel/qplatformscreen_p.h
@@ -1,41 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the QtGui module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#ifndef QPLATFORMSCREEN_P_H
#define QPLATFORMSCREEN_P_H
@@ -53,6 +17,9 @@
#include <QtGui/private/qtguiglobal_p.h>
+#include <QtCore/qpointer.h>
+#include <QtCore/qnativeinterface.h>
+
QT_BEGIN_NAMESPACE
class QScreen;
@@ -63,6 +30,45 @@ public:
QPointer<QScreen> screen;
};
+// ----------------- QNativeInterface -----------------
+
+namespace QNativeInterface::Private {
+
+#if QT_CONFIG(xcb) || defined(Q_QDOC)
+struct Q_GUI_EXPORT QXcbScreen
+{
+ QT_DECLARE_NATIVE_INTERFACE(QXcbScreen, 1, QScreen)
+ virtual int virtualDesktopNumber() const = 0;
+};
+#endif
+
+#if QT_CONFIG(vsp2) || defined(Q_QDOC)
+struct Q_GUI_EXPORT QVsp2Screen
+{
+ QT_DECLARE_NATIVE_INTERFACE(QVsp2Screen, 1, QScreen)
+ virtual int addLayer(int dmabufFd, const QSize &size, const QPoint &position, uint drmPixelFormat, uint bytesPerLine) = 0;
+ virtual void setLayerBuffer(int id, int dmabufFd) = 0;
+ virtual void setLayerPosition(int id, const QPoint &position) = 0;
+ virtual void setLayerAlpha(int id, qreal alpha) = 0;
+ virtual bool removeLayer(int id) = 0;
+ virtual void addBlendListener(void (*callback)()) = 0;
+};
+#endif
+
+#if defined(Q_OS_WEBOS) || defined(Q_QDOC)
+struct Q_GUI_EXPORT QWebOSScreen
+{
+ QT_DECLARE_NATIVE_INTERFACE(QWebOSScreen, 1, QScreen)
+ virtual int addLayer(void *gbm_bo, const QRectF &geometry) = 0;
+ virtual void setLayerBuffer(int id, void *gbm_bo) = 0;
+ virtual void setLayerGeometry(int id, const QRectF &geometry) = 0;
+ virtual void setLayerAlpha(int id, qreal alpha) = 0;
+ virtual bool removeLayer(int id) = 0;
+ virtual void addFlipListener(void (*callback)()) = 0;
+};
+#endif
+} // QNativeInterface::Private
+
QT_END_NAMESPACE
#endif // QPLATFORMSCREEN_P_H
diff --git a/src/gui/kernel/qplatformservices.cpp b/src/gui/kernel/qplatformservices.cpp
index fdc6a6c4aa..7ff2a6c2f8 100644
--- a/src/gui/kernel/qplatformservices.cpp
+++ b/src/gui/kernel/qplatformservices.cpp
@@ -1,41 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the QtGui module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#include "qplatformservices.h"
@@ -55,6 +19,19 @@ QT_BEGIN_NAMESPACE
\brief The QPlatformServices provides the backend for desktop-related functionality.
*/
+/*!
+ \enum QPlatformServices::Capability
+
+ Capabilities are used to determine a specific platform service's availability.
+
+ \value ColorPickingFromScreen The platform natively supports color picking from screen.
+ This capability indicates that the platform supports "opaque" color picking, where the
+ platform implements a complete user experience for color picking and outputs a color.
+ This is in contrast to the application implementing the color picking user experience
+ (taking care of showing a cross hair, instructing the platform integration to obtain
+ the color at a given pixel, etc.). The related service function is pickColor().
+ */
+
QPlatformServices::QPlatformServices()
{ }
@@ -85,5 +62,18 @@ QByteArray QPlatformServices::desktopEnvironment() const
return QByteArray("UNKNOWN");
}
+QPlatformServiceColorPicker *QPlatformServices::colorPicker(QWindow *parent)
+{
+ Q_UNUSED(parent);
+ return nullptr;
+}
+
+bool QPlatformServices::hasCapability(Capability capability) const
+{
+ Q_UNUSED(capability)
+ return false;
+}
QT_END_NAMESPACE
+
+#include "moc_qplatformservices.cpp"
diff --git a/src/gui/kernel/qplatformservices.h b/src/gui/kernel/qplatformservices.h
index 5de96cfa7d..063247af08 100644
--- a/src/gui/kernel/qplatformservices.h
+++ b/src/gui/kernel/qplatformservices.h
@@ -1,41 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the QtGui module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#ifndef QPLATFORMSERVICES_H
#define QPLATFORMSERVICES_H
@@ -50,16 +14,32 @@
//
#include <QtGui/qtguiglobal.h>
+#include <QtCore/qobject.h>
QT_BEGIN_NAMESPACE
class QUrl;
+class QWindow;
+
+class Q_GUI_EXPORT QPlatformServiceColorPicker : public QObject
+{
+ Q_OBJECT
+public:
+ using QObject::QObject;
+ virtual void pickColor() = 0;
+Q_SIGNALS:
+ void colorPicked(const QColor &color);
+};
class Q_GUI_EXPORT QPlatformServices
{
public:
Q_DISABLE_COPY_MOVE(QPlatformServices)
+ enum Capability {
+ ColorPicking,
+ };
+
QPlatformServices();
virtual ~QPlatformServices() { }
@@ -67,6 +47,10 @@ public:
virtual bool openDocument(const QUrl &url);
virtual QByteArray desktopEnvironment() const;
+
+ virtual bool hasCapability(Capability capability) const;
+
+ virtual QPlatformServiceColorPicker *colorPicker(QWindow *parent = nullptr);
};
QT_END_NAMESPACE
diff --git a/src/gui/kernel/qplatformsessionmanager.cpp b/src/gui/kernel/qplatformsessionmanager.cpp
index a66fc6d016..2a8e621294 100644
--- a/src/gui/kernel/qplatformsessionmanager.cpp
+++ b/src/gui/kernel/qplatformsessionmanager.cpp
@@ -1,43 +1,7 @@
-/****************************************************************************
-**
-** Copyright (C) 2013 Samuel Gaist <samuel.gaist@edeltech.ch>
-** Copyright (C) 2013 Teo Mrnjavac <teo@kde.org>
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the QtGui module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2013 Samuel Gaist <samuel.gaist@edeltech.ch>
+// Copyright (C) 2013 Teo Mrnjavac <teo@kde.org>
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#include "qplatformsessionmanager.h"
@@ -118,14 +82,14 @@ QStringList QPlatformSessionManager::discardCommand() const
void QPlatformSessionManager::setManagerProperty(const QString &name, const QString &value)
{
- Q_UNUSED(name)
- Q_UNUSED(value)
+ Q_UNUSED(name);
+ Q_UNUSED(value);
}
void QPlatformSessionManager::setManagerProperty(const QString &name, const QStringList &value)
{
- Q_UNUSED(name)
- Q_UNUSED(value)
+ Q_UNUSED(name);
+ Q_UNUSED(value);
}
bool QPlatformSessionManager::isPhase2() const
diff --git a/src/gui/kernel/qplatformsessionmanager.h b/src/gui/kernel/qplatformsessionmanager.h
index c6c3984816..213d8dc07e 100644
--- a/src/gui/kernel/qplatformsessionmanager.h
+++ b/src/gui/kernel/qplatformsessionmanager.h
@@ -1,43 +1,7 @@
-/****************************************************************************
-**
-** Copyright (C) 2013 Samuel Gaist <samuel.gaist@edeltech.ch>
-** Copyright (C) 2013 Teo Mrnjavac <teo@kde.org>
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the QtGui module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2013 Samuel Gaist <samuel.gaist@edeltech.ch>
+// Copyright (C) 2013 Teo Mrnjavac <teo@kde.org>
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#ifndef QPLATFORMSESSIONMANAGER_H
#define QPLATFORMSESSIONMANAGER_H
diff --git a/src/gui/kernel/qplatformsharedgraphicscache.cpp b/src/gui/kernel/qplatformsharedgraphicscache.cpp
index f6c4e3309e..c482a94426 100644
--- a/src/gui/kernel/qplatformsharedgraphicscache.cpp
+++ b/src/gui/kernel/qplatformsharedgraphicscache.cpp
@@ -1,41 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the QtGui module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#include "qplatformsharedgraphicscache.h"
@@ -100,7 +64,7 @@ QT_BEGIN_NAMESPACE
*/
/*!
- \fn void QPlatformSharedGraphicsCache::requestItems(const QByteArray &cacheId, const QVector<quint32> &itemIds)
+ \fn void QPlatformSharedGraphicsCache::requestItems(const QByteArray &cacheId, const QList<quint32> &itemIds)
Requests all the items in \a itemIds from the cache with the name \a cacheId.
@@ -116,7 +80,7 @@ QT_BEGIN_NAMESPACE
*/
/*!
- \fn void QPlatformSharedGraphicsCache::insertItems(const QByteArray &cacheId, const QVector<quint32> &itemIds, const QVector<QImage> &items)
+ \fn void QPlatformSharedGraphicsCache::insertItems(const QByteArray &cacheId, const QList<quint32> &itemIds, const QList<QImage> &items)
Inserts the items in \a itemIds into the cache named \a cacheId. The appearance of
each item is stored in \a items. The format of the QImage objects is expected to match the
@@ -132,7 +96,7 @@ QT_BEGIN_NAMESPACE
*/
/*!
- \fn void QPlatformSharedGraphicsCache::releaseItems(const QByteArray &cacheId, const QVector<quint32> &itemIds)
+ \fn void QPlatformSharedGraphicsCache::releaseItems(const QByteArray &cacheId, const QList<quint32> &itemIds)
Releases the reference to the items in \a itemIds from the cache named \a cacheId. This should
only be called when all references to the items have been released by the user, and they are no
@@ -140,20 +104,20 @@ QT_BEGIN_NAMESPACE
*/
/*!
- \fn void QPlatformSharedGraphicsCache::itemsMissing(const QByteArray &cacheId, const QVector<quint32> &itemIds)
+ \fn void QPlatformSharedGraphicsCache::itemsMissing(const QByteArray &cacheId, const QList<quint32> &itemIds)
This signal is emitted when requestItems() has been called for one or more items in the
cache named \a cacheId which are not yet available in the cache. The user is then expected to
call insertItems() to update the cache with the respective items, at which point they will
become available to all clients of the shared cache.
- The vector \a itemIds contains the IDs of the items that need to be inserted into the cache.
+ The \a itemIds list contains the IDs of the items that need to be inserted into the cache.
\sa itemsAvailable(), insertItems(), requestItems()
*/
/*!
- \fn void QPlatformSharedGraphicsCache::itemsAvailable(const QByteArray &cacheId, void *bufferId, const QVector<quint32> &itemIds, const QVector<QPoint> &positionsInBuffer)
+ \fn void QPlatformSharedGraphicsCache::itemsAvailable(const QByteArray &cacheId, void *bufferId, const QList<quint32> &itemIds, const QList<QPoint> &positionsInBuffer)
This signal can be emitted at any time when either requestItems() or insertItems() has been
called by the application for one or more items in the cache named \a cacheId, as long as
@@ -167,8 +131,8 @@ QT_BEGIN_NAMESPACE
initialization. If it is a OpenGLTexture, its texture ID can be requested using the
textureIdForBuffer() function. The dimensions of the buffer are given by \a bufferSize.
- The items provided by the cache are identified in the \a itemIds vector. The
- \a positionsInBuffer vector contains the locations inside the buffer of each item. Each entry in
+ The items provided by the cache are identified in the \a itemIds list. The
+ \a positionsInBuffer list contains the locations inside the buffer of each item. Each entry in
\a positionsInBuffer corresponds to an item in \a itemIds.
The buffer and the items' locations within the buffer can be considered valid until an
@@ -179,7 +143,7 @@ QT_BEGIN_NAMESPACE
*/
/*!
- \fn void QPlatformSharedGraphicsCache::itemsUpdated(const QByteArray &cacheId, void *bufferId, const QVector<quint32> &itemIds, const QVector<QPoint> &positionsInBuffer)
+ \fn void QPlatformSharedGraphicsCache::itemsUpdated(const QByteArray &cacheId, void *bufferId, const QList<quint32> &itemIds, const QList<QPoint> &positionsInBuffer)
This signal is similar in usage to the itemsAvailable() signal, but will be emitted when
the location of a previously requested or inserted item has been updated. The application
@@ -194,7 +158,7 @@ QT_BEGIN_NAMESPACE
*/
/*!
- \fn void QPlatformSharedGraphicsCache::itemsInvalidated(const QByteArray &cacheId, const QVector<quint32> &itemIds)
+ \fn void QPlatformSharedGraphicsCache::itemsInvalidated(const QByteArray &cacheId, const QList<quint32> &itemIds)
This signal is emitted when the items given by \a itemIds in the cache named \a cacheId have
been removed from the cache and the previously reported information about them is considered
@@ -292,3 +256,5 @@ QT_BEGIN_NAMESPACE
*/
QT_END_NAMESPACE
+
+#include "moc_qplatformsharedgraphicscache.cpp"
diff --git a/src/gui/kernel/qplatformsharedgraphicscache.h b/src/gui/kernel/qplatformsharedgraphicscache.h
index b3b5488139..4935a52bd6 100644
--- a/src/gui/kernel/qplatformsharedgraphicscache.h
+++ b/src/gui/kernel/qplatformsharedgraphicscache.h
@@ -1,41 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the QtGui module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#ifndef QPLATFORMSHAREDGRAPHICSCACHE_H
#define QPLATFORMSHAREDGRAPHICSCACHE_H
@@ -74,11 +38,10 @@ public:
virtual void beginRequestBatch() = 0;
virtual void ensureCacheInitialized(const QByteArray &cacheId, BufferType bufferType,
PixelFormat pixelFormat) = 0;
- virtual void requestItems(const QByteArray &cacheId, const QVector<quint32> &itemIds) = 0;
- virtual void insertItems(const QByteArray &cacheId,
- const QVector<quint32> &itemIds,
- const QVector<QImage> &items) = 0;
- virtual void releaseItems(const QByteArray &cacheId, const QVector<quint32> &itemIds) = 0;
+ virtual void requestItems(const QByteArray &cacheId, const QList<quint32> &itemIds) = 0;
+ virtual void insertItems(const QByteArray &cacheId, const QList<quint32> &itemIds,
+ const QList<QImage> &items) = 0;
+ virtual void releaseItems(const QByteArray &cacheId, const QList<quint32> &itemIds) = 0;
virtual void endRequestBatch() = 0;
virtual bool requestBatchStarted() const = 0;
@@ -90,12 +53,12 @@ public:
virtual void *eglImageForBuffer(void *bufferId) = 0;
Q_SIGNALS:
- void itemsMissing(const QByteArray &cacheId, const QVector<quint32> &itemIds);
- void itemsAvailable(const QByteArray &cacheId, void *bufferId,
- const QVector<quint32> &itemIds, const QVector<QPoint> &positionsInBuffer);
- void itemsInvalidated(const QByteArray &cacheId, const QVector<quint32> &itemIds);
- void itemsUpdated(const QByteArray &cacheId, void *bufferId,
- const QVector<quint32> &itemIds, const QVector<QPoint> &positionsInBuffer);
+ void itemsMissing(const QByteArray &cacheId, const QList<quint32> &itemIds);
+ void itemsAvailable(const QByteArray &cacheId, void *bufferId, const QList<quint32> &itemIds,
+ const QList<QPoint> &positionsInBuffer);
+ void itemsInvalidated(const QByteArray &cacheId, const QList<quint32> &itemIds);
+ void itemsUpdated(const QByteArray &cacheId, void *bufferId, const QList<quint32> &itemIds,
+ const QList<QPoint> &positionsInBuffer);
};
QT_END_NAMESPACE
diff --git a/src/gui/kernel/qplatformsurface.cpp b/src/gui/kernel/qplatformsurface.cpp
index fdb2cf567d..39a1869de6 100644
--- a/src/gui/kernel/qplatformsurface.cpp
+++ b/src/gui/kernel/qplatformsurface.cpp
@@ -1,41 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the QtGui module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#include "qplatformsurface.h"
#ifndef QT_NO_DEBUG_STREAM
@@ -68,6 +32,17 @@ QPlatformSurface::QPlatformSurface(QSurface *surface) : m_surface(surface)
{
}
+bool QPlatformSurface::isRasterSurface(QSurface *surface)
+{
+ switch (surface->surfaceType()) {
+ case QSurface::RasterSurface:
+ case QSurface::RasterGLSurface:
+ return true;
+ default:
+ return false;
+ };
+}
+
#ifndef QT_NO_DEBUG_STREAM
Q_GUI_EXPORT QDebug operator<<(QDebug debug, const QPlatformSurface *surface)
{
diff --git a/src/gui/kernel/qplatformsurface.h b/src/gui/kernel/qplatformsurface.h
index 475f3ef330..f867d3df1b 100644
--- a/src/gui/kernel/qplatformsurface.h
+++ b/src/gui/kernel/qplatformsurface.h
@@ -1,41 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2017 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the QtGui module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2017 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#ifndef QPLATFORMSURFACE_H
#define QPLATFORMSURFACE_H
@@ -73,6 +37,8 @@ public:
QSurface *surface() const;
virtual QPlatformScreen *screen() const = 0;
+ static bool isRasterSurface(QSurface *surface);
+
private:
explicit QPlatformSurface(QSurface *surface);
diff --git a/src/gui/kernel/qplatformsystemtrayicon.cpp b/src/gui/kernel/qplatformsystemtrayicon.cpp
index 296beda0f9..0b21fe39f7 100644
--- a/src/gui/kernel/qplatformsystemtrayicon.cpp
+++ b/src/gui/kernel/qplatformsystemtrayicon.cpp
@@ -1,42 +1,6 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Copyright (C) 2012 Klaralvdalens Datakonsult AB, a KDAB Group company, info@kdab.com, author Christoph Schleifenbaum <christoph.schleifenbaum@kdab.com>
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the QtGui module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// Copyright (C) 2012 Klaralvdalens Datakonsult AB, a KDAB Group company, info@kdab.com, author Christoph Schleifenbaum <christoph.schleifenbaum@kdab.com>
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#include "qplatformsystemtrayicon.h"
diff --git a/src/gui/kernel/qplatformsystemtrayicon.h b/src/gui/kernel/qplatformsystemtrayicon.h
index 948a6c099d..76a7ef03d9 100644
--- a/src/gui/kernel/qplatformsystemtrayicon.h
+++ b/src/gui/kernel/qplatformsystemtrayicon.h
@@ -1,47 +1,12 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Copyright (C) 2012 Klaralvdalens Datakonsult AB, a KDAB Group company, info@kdab.com, author Christoph Schleifenbaum <christoph.schleifenbaum@kdab.com>
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the QtGui module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// Copyright (C) 2012 Klaralvdalens Datakonsult AB, a KDAB Group company, info@kdab.com, author Christoph Schleifenbaum <christoph.schleifenbaum@kdab.com>
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#ifndef QPLATFORMSYSTEMTRAYICON_H
#define QPLATFORMSYSTEMTRAYICON_H
#include <QtGui/qtguiglobal.h>
+#include <qpa/qplatformscreen.h>
#include "QtCore/qobject.h"
#ifndef QT_NO_SYSTEMTRAYICON
@@ -49,7 +14,6 @@
QT_BEGIN_NAMESPACE
class QPlatformMenu;
-class QPlatformScreen;
class QIcon;
class QString;
class QRect;
diff --git a/src/gui/kernel/qplatformtheme.cpp b/src/gui/kernel/qplatformtheme.cpp
index 93fd59e53f..48978b849a 100644
--- a/src/gui/kernel/qplatformtheme.cpp
+++ b/src/gui/kernel/qplatformtheme.cpp
@@ -1,41 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the QtGui module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#include "qplatformtheme.h"
@@ -64,6 +28,8 @@ QT_BEGIN_NAMESPACE
\ingroup qpa
\brief The QPlatformTheme class allows customizing the UI based on themes.
+ See the init_platform function in qguiapplication.cpp for the complete
+ platform initialization process.
*/
/*!
@@ -163,6 +129,30 @@ QT_BEGIN_NAMESPACE
\value ShowShortcutsInContextMenus (bool) Whether to display shortcut key sequences in context menus.
+ \value InteractiveResizeAcrossScreens (bool) Whether using the whole virtual geometry of all the screens
+ as basis for the resize.
+ This enum value has been added in Qt 6.2.
+
+ \value ShowDirectoriesFirst (bool) Whether directories should be shown
+ first (before files) in file dialogs.
+ This enum value was added in Qt 6.3.
+
+ \value PreselectFirstFileInDirectory (bool) Whether the first file in a directory
+ should be automatically selected when a file dialog opens.
+ This enum value was added in Qt 6.3.
+
+ \value ButtonPressKeys (QList<Qt::Key>) A list of keys that can be used to press buttons via keyboard input.
+
+ \value SetFocusOnTouchRelease (bool) Whether focus objects (line edits etc) should receive
+ input focus after a touch/mouse release.
+ This enum value has been added in Qt 6.5.
+
+ \value MouseCursorTheme (QString) Name of the mouse cursor theme.
+ This enum value has been added in Qt 6.5.
+
+ \value MouseCursorSize (QSize) Size of the mouse cursor.
+ This enum value has been added in Qt 6.5.
+
\sa themeHint(), QStyle::pixelMetric()
*/
@@ -286,7 +276,7 @@ const QKeyBinding QPlatformThemePrivate::keyBindings[] = {
{QKeySequence::MoveToEndOfLine, 0, Qt::META | Qt::Key_Right, KB_Mac},
{QKeySequence::MoveToEndOfLine, 0, Qt::CTRL | Qt::Key_Right, KB_Mac },
{QKeySequence::MoveToEndOfLine, 0, Qt::Key_End, KB_Win | KB_X11},
- {QKeySequence::MoveToEndOfLine, 0, Qt::CTRL + Qt::Key_E, KB_X11},
+ {QKeySequence::MoveToEndOfLine, 0, Qt::CTRL | Qt::Key_E, KB_X11},
{QKeySequence::MoveToStartOfBlock, 0, Qt::META | Qt::Key_A, KB_Mac},
{QKeySequence::MoveToStartOfBlock, 1, Qt::ALT | Qt::Key_Up, KB_Mac}, //mac only
{QKeySequence::MoveToEndOfBlock, 0, Qt::META | Qt::Key_E, KB_Mac},
@@ -335,7 +325,7 @@ const QKeyBinding QPlatformThemePrivate::keyBindings[] = {
{QKeySequence::InsertLineSeparator, 0, Qt::SHIFT | Qt::Key_Enter, KB_All},
{QKeySequence::InsertLineSeparator, 0, Qt::SHIFT | Qt::Key_Return, KB_All},
{QKeySequence::InsertLineSeparator, 0, Qt::META | Qt::Key_O, KB_Mac},
- {QKeySequence::SaveAs, 0, Qt::CTRL | Qt::SHIFT | Qt::Key_S, KB_Gnome | KB_Mac},
+ {QKeySequence::SaveAs, 0, Qt::CTRL | Qt::SHIFT | Qt::Key_S, KB_All},
{QKeySequence::Preferences, 0, Qt::CTRL | Qt::Key_Comma, KB_Mac},
{QKeySequence::Quit, 0, Qt::CTRL | Qt::Key_Q, KB_X11 | KB_Gnome | KB_KDE | KB_Mac},
{QKeySequence::FullScreen, 1, Qt::META | Qt::CTRL | Qt::Key_F, KB_Mac},
@@ -345,6 +335,7 @@ const QKeyBinding QPlatformThemePrivate::keyBindings[] = {
{QKeySequence::FullScreen, 1, Qt::Key_F11, KB_Win | KB_KDE},
{QKeySequence::Deselect, 0, Qt::CTRL | Qt::SHIFT | Qt::Key_A, KB_X11},
{QKeySequence::DeleteCompleteLine, 0, Qt::CTRL | Qt::Key_U, KB_X11},
+ {QKeySequence::Backspace, 1, Qt::Key_Backspace, KB_Mac},
{QKeySequence::Backspace, 0, Qt::META | Qt::Key_H, KB_Mac},
{QKeySequence::Cancel, 0, Qt::Key_Escape, KB_All},
{QKeySequence::Cancel, 0, Qt::CTRL | Qt::Key_Period, KB_Mac}
@@ -362,7 +353,61 @@ QPlatformThemePrivate::~QPlatformThemePrivate()
delete systemPalette;
}
-Q_GUI_EXPORT QPalette qt_fusionPalette();
+Q_GUI_EXPORT QPalette qt_fusionPalette()
+{
+ auto theme = QGuiApplicationPrivate::platformTheme();
+ const bool darkAppearance = theme
+ ? theme->colorScheme() == Qt::ColorScheme::Dark
+ : false;
+ const QColor windowText = darkAppearance ? QColor(240, 240, 240) : Qt::black;
+ const QColor backGround = darkAppearance ? QColor(50, 50, 50) : QColor(239, 239, 239);
+ const QColor light = backGround.lighter(150);
+ const QColor mid = (backGround.darker(130));
+ const QColor midLight = mid.lighter(110);
+ const QColor base = darkAppearance ? backGround.darker(140) : Qt::white;
+ const QColor disabledBase(backGround);
+ const QColor dark = backGround.darker(150);
+ const QColor darkDisabled = QColor(209, 209, 209).darker(110);
+ const QColor text = darkAppearance ? windowText : Qt::black;
+ const QColor highlight = QColor(48, 140, 198);
+ const QColor hightlightedText = darkAppearance ? windowText : Qt::white;
+ const QColor disabledText = darkAppearance ? QColor(130, 130, 130) : QColor(190, 190, 190);
+ const QColor button = backGround;
+ const QColor shadow = dark.darker(135);
+ const QColor disabledShadow = shadow.lighter(150);
+ const QColor disabledHighlight(145, 145, 145);
+ QColor placeholder = text;
+ placeholder.setAlpha(128);
+
+ QPalette fusionPalette(windowText, backGround, light, dark, mid, text, base);
+ fusionPalette.setBrush(QPalette::Midlight, midLight);
+ fusionPalette.setBrush(QPalette::Button, button);
+ fusionPalette.setBrush(QPalette::Shadow, shadow);
+ fusionPalette.setBrush(QPalette::HighlightedText, hightlightedText);
+
+ fusionPalette.setBrush(QPalette::Disabled, QPalette::Text, disabledText);
+ fusionPalette.setBrush(QPalette::Disabled, QPalette::WindowText, disabledText);
+ fusionPalette.setBrush(QPalette::Disabled, QPalette::ButtonText, disabledText);
+ fusionPalette.setBrush(QPalette::Disabled, QPalette::Base, disabledBase);
+ fusionPalette.setBrush(QPalette::Disabled, QPalette::Dark, darkDisabled);
+ fusionPalette.setBrush(QPalette::Disabled, QPalette::Shadow, disabledShadow);
+
+ fusionPalette.setBrush(QPalette::Active, QPalette::Highlight, highlight);
+ fusionPalette.setBrush(QPalette::Inactive, QPalette::Highlight, highlight);
+ fusionPalette.setBrush(QPalette::Disabled, QPalette::Highlight, disabledHighlight);
+
+ fusionPalette.setBrush(QPalette::Active, QPalette::Accent, highlight);
+ fusionPalette.setBrush(QPalette::Inactive, QPalette::Accent, highlight);
+ fusionPalette.setBrush(QPalette::Disabled, QPalette::Accent, disabledHighlight);
+
+ fusionPalette.setBrush(QPalette::PlaceholderText, placeholder);
+
+ // Use a more legible light blue on dark backgrounds than the default Qt::blue.
+ if (darkAppearance)
+ fusionPalette.setBrush(QPalette::Link, highlight);
+
+ return fusionPalette;
+}
void QPlatformThemePrivate::initializeSystemPalette()
{
@@ -397,6 +442,11 @@ QPlatformDialogHelper *QPlatformTheme::createPlatformDialogHelper(DialogType typ
return nullptr;
}
+Qt::ColorScheme QPlatformTheme::colorScheme() const
+{
+ return Qt::ColorScheme::Unknown;
+}
+
const QPalette *QPlatformTheme::palette(Palette type) const
{
Q_D(const QPlatformTheme);
@@ -410,7 +460,7 @@ const QPalette *QPlatformTheme::palette(Palette type) const
const QFont *QPlatformTheme::font(Font type) const
{
- Q_UNUSED(type)
+ Q_UNUSED(type);
return nullptr;
}
@@ -473,6 +523,16 @@ QVariant QPlatformTheme::themeHint(ThemeHint hint) const
return QGuiApplicationPrivate::platformIntegration()->styleHint(QPlatformIntegration::UiEffects);
case QPlatformTheme::ShowShortcutsInContextMenus:
return QGuiApplicationPrivate::platformIntegration()->styleHint(QPlatformIntegration::ShowShortcutsInContextMenus);
+ case QPlatformTheme::SetFocusOnTouchRelease:
+ return QGuiApplicationPrivate::platformIntegration()->styleHint(QPlatformIntegration::SetFocusOnTouchRelease);
+ case QPlatformTheme::FlickStartDistance:
+ return QGuiApplicationPrivate::platformIntegration()->styleHint(QPlatformIntegration::FlickStartDistance);
+ case QPlatformTheme::FlickMaximumVelocity:
+ return QGuiApplicationPrivate::platformIntegration()->styleHint(QPlatformIntegration::FlickMaximumVelocity);
+ case QPlatformTheme::FlickDeceleration:
+ return QGuiApplicationPrivate::platformIntegration()->styleHint(QPlatformIntegration::FlickDeceleration);
+ case QPlatformTheme::UnderlineShortcut:
+ return QGuiApplicationPrivate::platformIntegration()->styleHint(QPlatformIntegration::UnderlineShortcut);
default:
return QPlatformTheme::defaultThemeHint(hint);
}
@@ -496,7 +556,7 @@ QVariant QPlatformTheme::defaultThemeHint(ThemeHint hint)
case QPlatformTheme::PasswordMaskDelay:
return QVariant(int(0));
case QPlatformTheme::PasswordMaskCharacter:
- return QVariant(QChar(0x25CF));
+ return QVariant(QChar(u'\x25CF'));
case QPlatformTheme::StartDragVelocity:
return QVariant(int(0)); // no limit
case QPlatformTheme::UseFullScreenForPopupMenu:
@@ -563,7 +623,32 @@ QVariant QPlatformTheme::defaultThemeHint(ThemeHint hint)
}
case MouseQuickSelectionThreshold:
return QVariant(10);
+ case InteractiveResizeAcrossScreens:
+ return true;
+ case ShowDirectoriesFirst:
+ return true;
+ case PreselectFirstFileInDirectory:
+ return false;
+ case ButtonPressKeys:
+ return QVariant::fromValue(QList<Qt::Key>({ Qt::Key_Space, Qt::Key_Select }));
+ case SetFocusOnTouchRelease:
+ return false;
+ case FlickStartDistance:
+ return QVariant(15);
+ case FlickMaximumVelocity:
+ return QVariant(2500);
+ case FlickDeceleration:
+ return QVariant(1500);
+ case MenuBarFocusOnAltPressRelease:
+ return false;
+ case MouseCursorTheme:
+ return QVariant(QString());
+ case MouseCursorSize:
+ return QVariant(QSize(16, 16));
+ case UnderlineShortcut:
+ return true;
}
+
return QVariant();
}
@@ -608,21 +693,6 @@ QIconEngine *QPlatformTheme::createIconEngine(const QString &iconName) const
return new QIconLoaderEngine(iconName);
}
-#if defined(Q_OS_MACX)
-static inline int maybeSwapShortcut(int shortcut)
-{
- if (qApp->testAttribute(Qt::AA_MacDontSwapCtrlAndMeta)) {
- uint oldshortcut = shortcut;
- shortcut &= ~(Qt::CTRL | Qt::META);
- if (oldshortcut & Qt::CTRL)
- shortcut |= Qt::META;
- if (oldshortcut & Qt::META)
- shortcut |= Qt::CTRL;
- }
- return shortcut;
-}
-#endif
-
#if QT_CONFIG(shortcut)
// mixed-mode predicate: all of these overloads are actually needed (but not all for every compiler)
struct ByStandardKey {
@@ -660,12 +730,8 @@ QList<QKeySequence> QPlatformTheme::keyBindings(QKeySequence::StandardKey key) c
if (!(it->platform & platform))
continue;
- uint shortcut =
-#if defined(Q_OS_MACX)
- maybeSwapShortcut(it->shortcut);
-#else
- it->shortcut;
-#endif
+ uint shortcut = it->shortcut.toCombined();
+
if (it->priority > 0)
list.prepend(QKeySequence(shortcut));
else
@@ -698,7 +764,7 @@ QString QPlatformTheme::standardButtonText(int button) const
QKeySequence QPlatformTheme::standardButtonShortcut(int button) const
{
- Q_UNUSED(button)
+ Q_UNUSED(button);
return QKeySequence();
}
#endif // QT_CONFIG(shortcut)
@@ -750,33 +816,38 @@ QString QPlatformTheme::defaultStandardButtonText(int button)
QString QPlatformTheme::removeMnemonics(const QString &original)
{
- QString returnText(original.size(), 0);
+ const auto mnemonicInParentheses = [](QStringView text) {
+ /* Format of mnemonics to remove is /\(&[^&]\)/ but accept full-width
+ forms of ( and ) as equivalent, for cross-platform compatibility with
+ MS (and consequent behavior of translators, see QTBUG-110829).
+ */
+ Q_ASSERT(text.size() == 4); // Caller's responsibility.
+ constexpr QChar wideOpen = u'\uff08', wideClose = u'\uff09';
+ if (!text.startsWith(u'(') && !text.startsWith(wideOpen))
+ return false;
+ if (text[1] != u'&' || text[2] == u'&')
+ return false;
+ return text.endsWith(u')') || text.endsWith(wideClose);
+ };
+ QString returnText(original.size(), u'\0');
int finalDest = 0;
- int currPos = 0;
- int l = original.length();
- while (l) {
- if (original.at(currPos) == QLatin1Char('&')) {
- ++currPos;
- --l;
- if (l == 0)
+ QStringView text(original);
+ while (!text.isEmpty()) {
+ if (text.startsWith(u'&')) {
+ text = text.sliced(1);
+ if (text.isEmpty())
break;
- } else if (original.at(currPos) == QLatin1Char('(') && l >= 4 &&
- original.at(currPos + 1) == QLatin1Char('&') &&
- original.at(currPos + 2) != QLatin1Char('&') &&
- original.at(currPos + 3) == QLatin1Char(')')) {
- /* remove mnemonics its format is "\s*(&X)" */
- int n = 0;
- while (finalDest > n && returnText.at(finalDest - n - 1).isSpace())
- ++n;
- finalDest -= n;
- currPos += 4;
- l -= 4;
+ } else if (text.size() >= 4 && mnemonicInParentheses(text.first(4))) {
+ // Advance over the matched mnemonic:
+ text = text.sliced(4);
+ // Also strip any leading space before it:
+ while (finalDest > 0 && returnText.at(finalDest - 1).isSpace())
+ --finalDest;
continue;
}
- returnText[finalDest] = original.at(currPos);
- ++currPos;
+ returnText[finalDest] = text.front();
+ text = text.sliced(1);
++finalDest;
- --l;
}
returnText.truncate(finalDest);
return returnText;
@@ -795,4 +866,11 @@ unsigned QPlatformThemePrivate::currentKeyPlatforms()
return result;
}
+QString QPlatformTheme::name() const
+{
+ return d_func()->name;
+}
+
QT_END_NAMESPACE
+
+#include "moc_qplatformtheme.cpp"
diff --git a/src/gui/kernel/qplatformtheme.h b/src/gui/kernel/qplatformtheme.h
index 6ed612b785..c0193947b9 100644
--- a/src/gui/kernel/qplatformtheme.h
+++ b/src/gui/kernel/qplatformtheme.h
@@ -1,41 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the QtGui module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#ifndef QPLATFORMTHEME_H
#define QPLATFORMTHEME_H
@@ -50,6 +14,7 @@
//
#include <QtGui/qtguiglobal.h>
+#include <QtCore/QObject>
#include <QtCore/QScopedPointer>
#if QT_CONFIG(shortcut)
# include <QtGui/QKeySequence>
@@ -76,7 +41,9 @@ class QFileInfo;
class Q_GUI_EXPORT QPlatformTheme
{
+ Q_GADGET
Q_DECLARE_PRIVATE(QPlatformTheme)
+
public:
Q_DISABLE_COPY_MOVE(QPlatformTheme)
@@ -106,12 +73,7 @@ public:
KeyboardScheme,
UiEffects,
SpellCheckUnderlineStyle,
-#if QT_VERSION >= QT_VERSION_CHECK(6,0,0)
TabFocusBehavior,
-#else
- TabAllWidgets,
- TabFocusBehavior = TabAllWidgets,
-#endif
IconPixmapSizes,
PasswordMaskCharacter,
DialogSnapToDefaultButton,
@@ -122,8 +84,21 @@ public:
TouchDoubleTapDistance,
ShowShortcutsInContextMenus,
IconFallbackSearchPaths,
- MouseQuickSelectionThreshold
+ MouseQuickSelectionThreshold,
+ InteractiveResizeAcrossScreens,
+ ShowDirectoriesFirst,
+ PreselectFirstFileInDirectory,
+ ButtonPressKeys,
+ SetFocusOnTouchRelease,
+ FlickStartDistance,
+ FlickMaximumVelocity,
+ FlickDeceleration,
+ MenuBarFocusOnAltPressRelease,
+ MouseCursorTheme,
+ MouseCursorSize,
+ UnderlineShortcut,
};
+ Q_ENUM(ThemeHint)
enum DialogType {
FileDialog,
@@ -131,6 +106,7 @@ public:
FontDialog,
MessageDialog
};
+ Q_ENUM(DialogType);
enum Palette {
SystemPalette,
@@ -153,6 +129,7 @@ public:
TextLineEditPalette,
NPalettes
};
+ Q_ENUM(Palette)
enum Font {
SystemFont,
@@ -184,6 +161,7 @@ public:
EditorFont,
NFonts
};
+ Q_ENUM(Font)
enum StandardPixmap { // Keep in sync with QStyle::StandardPixmap
TitleBarMenuButton,
@@ -257,9 +235,20 @@ public:
MediaVolume,
MediaVolumeMuted,
LineEditClearButton,
+ DialogYesToAllButton,
+ DialogNoToAllButton,
+ DialogSaveAllButton,
+ DialogAbortButton,
+ DialogRetryButton,
+ DialogIgnoreButton,
+ RestoreDefaultsButton,
+ TabCloseButton,
+ NStandardPixmap, // assertion value for sync with QStyle::StandardPixmap
+
// do not add any values below/greater than this
CustomBase = 0xf0000000
};
+ Q_ENUM(StandardPixmap)
enum KeyboardSchemes
{
@@ -270,6 +259,7 @@ public:
GnomeKeyboardScheme,
CdeKeyboardScheme
};
+ Q_ENUM(KeyboardSchemes)
enum UiEffect
{
@@ -282,6 +272,7 @@ public:
AnimateToolBoxUiEffect = 0x40,
HoverEffect = 0x80
};
+ Q_ENUM(UiEffect)
enum IconOption {
DontUseCustomDirectoryIcons = 0x01
@@ -303,6 +294,8 @@ public:
virtual QPlatformSystemTrayIcon *createPlatformSystemTrayIcon() const;
#endif
+ virtual Qt::ColorScheme colorScheme() const;
+
virtual const QPalette *palette(Palette type = SystemPalette) const;
virtual const QFont *font(Font type = SystemFont) const;
@@ -326,10 +319,14 @@ public:
static QVariant defaultThemeHint(ThemeHint hint);
static QString defaultStandardButtonText(int button);
static QString removeMnemonics(const QString &original);
+ QString name() const;
protected:
explicit QPlatformTheme(QPlatformThemePrivate *priv);
QScopedPointer<QPlatformThemePrivate> d_ptr;
+
+private:
+ friend class QPlatformThemeFactory;
};
QT_END_NAMESPACE
diff --git a/src/gui/kernel/qplatformtheme_p.h b/src/gui/kernel/qplatformtheme_p.h
index 2c16fec141..e847ead3be 100644
--- a/src/gui/kernel/qplatformtheme_p.h
+++ b/src/gui/kernel/qplatformtheme_p.h
@@ -1,41 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the QtGui module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#ifndef QPLATFORMTHEME_P_H
#define QPLATFORMTHEME_P_H
@@ -77,6 +41,8 @@ public:
static unsigned currentKeyPlatforms();
QPalette *systemPalette;
+
+ QString name;
};
QT_END_NAMESPACE
diff --git a/src/gui/kernel/qplatformthemefactory.cpp b/src/gui/kernel/qplatformthemefactory.cpp
index 447d385abe..beefa1c294 100644
--- a/src/gui/kernel/qplatformthemefactory.cpp
+++ b/src/gui/kernel/qplatformthemefactory.cpp
@@ -1,41 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the QtGui module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#include <qpa/qplatformthemefactory_p.h>
#include <qpa/qplatformthemeplugin.h>
@@ -44,33 +8,26 @@
#include "qmutex.h"
#include "qguiapplication.h"
+#include "qplatformtheme.h"
+#include "qplatformtheme_p.h"
#include "qdebug.h"
QT_BEGIN_NAMESPACE
-Q_GLOBAL_STATIC_WITH_ARGS(QFactoryLoader, loader,
- (QPlatformThemeFactoryInterface_iid, QLatin1String("/platformthemes"), Qt::CaseInsensitive))
+using namespace Qt::StringLiterals;
-#if QT_CONFIG(library)
-Q_GLOBAL_STATIC_WITH_ARGS(QFactoryLoader, directLoader,
- (QPlatformThemeFactoryInterface_iid, QLatin1String(""), Qt::CaseInsensitive))
-#endif
+Q_GLOBAL_STATIC_WITH_ARGS(QFactoryLoader, ptLoader,
+ (QPlatformThemeFactoryInterface_iid, "/platformthemes"_L1, Qt::CaseInsensitive))
QPlatformTheme *QPlatformThemeFactory::create(const QString& key, const QString &platformPluginPath)
{
- QStringList paramList = key.split(QLatin1Char(':'));
+ QStringList paramList = key.split(u':');
const QString platform = paramList.takeFirst().toLower();
-#if QT_CONFIG(library)
- // Try loading the plugin from platformPluginPath first:
- if (!platformPluginPath.isEmpty()) {
- QCoreApplication::addLibraryPath(platformPluginPath);
- if (QPlatformTheme *ret = qLoadPlugin<QPlatformTheme, QPlatformThemePlugin>(directLoader(), platform, paramList))
- return ret;
- }
-#else
- Q_UNUSED(platformPluginPath);
-#endif
- return qLoadPlugin<QPlatformTheme, QPlatformThemePlugin>(loader(), platform, paramList);
+ ptLoader->setExtraSearchPath(platformPluginPath);
+ QPlatformTheme *theme = qLoadPlugin<QPlatformTheme, QPlatformThemePlugin>(ptLoader(), platform, paramList);
+ if (theme)
+ theme->d_func()->name = key;
+ return theme;
}
/*!
@@ -81,26 +38,8 @@ QPlatformTheme *QPlatformThemeFactory::create(const QString& key, const QString
*/
QStringList QPlatformThemeFactory::keys(const QString &platformPluginPath)
{
- QStringList list;
-
-#if QT_CONFIG(library)
- if (!platformPluginPath.isEmpty()) {
- QCoreApplication::addLibraryPath(platformPluginPath);
- list += directLoader()->keyMap().values();
- if (!list.isEmpty()) {
- const QString postFix = QLatin1String(" (from ")
- + QDir::toNativeSeparators(platformPluginPath)
- + QLatin1Char(')');
- const QStringList::iterator end = list.end();
- for (QStringList::iterator it = list.begin(); it != end; ++it)
- (*it).append(postFix);
- }
- }
-#else
- Q_UNUSED(platformPluginPath);
-#endif
- list += loader()->keyMap().values();
- return list;
+ ptLoader->setExtraSearchPath(platformPluginPath);
+ return ptLoader->keyMap().values();
}
QT_END_NAMESPACE
diff --git a/src/gui/kernel/qplatformthemefactory_p.h b/src/gui/kernel/qplatformthemefactory_p.h
index c312eadf27..c466dcd461 100644
--- a/src/gui/kernel/qplatformthemefactory_p.h
+++ b/src/gui/kernel/qplatformthemefactory_p.h
@@ -1,41 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the QtGui module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#ifndef QPLATFORMTHEMEFACTORY_H
#define QPLATFORMTHEMEFACTORY_H
diff --git a/src/gui/kernel/qplatformthemeplugin.cpp b/src/gui/kernel/qplatformthemeplugin.cpp
index c09476bee5..8b22680c05 100644
--- a/src/gui/kernel/qplatformthemeplugin.cpp
+++ b/src/gui/kernel/qplatformthemeplugin.cpp
@@ -1,41 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the QtGui module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#include "qplatformthemeplugin.h"
@@ -60,3 +24,5 @@ QPlatformThemePlugin::~QPlatformThemePlugin()
}
QT_END_NAMESPACE
+
+#include "moc_qplatformthemeplugin.cpp"
diff --git a/src/gui/kernel/qplatformthemeplugin.h b/src/gui/kernel/qplatformthemeplugin.h
index 0f88806b0b..a983f4c5b7 100644
--- a/src/gui/kernel/qplatformthemeplugin.h
+++ b/src/gui/kernel/qplatformthemeplugin.h
@@ -1,41 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the QtGui module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#ifndef QPLATFORMTHEMEPLUGIN_H
#define QPLATFORMTHEMEPLUGIN_H
diff --git a/src/gui/kernel/qplatformwindow.cpp b/src/gui/kernel/qplatformwindow.cpp
index 65accc9f68..5c0ae2ee2a 100644
--- a/src/gui/kernel/qplatformwindow.cpp
+++ b/src/gui/kernel/qplatformwindow.cpp
@@ -1,41 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the QtGui module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#include "qplatformwindow.h"
#include "qplatformwindow_p.h"
@@ -229,7 +193,7 @@ bool QPlatformWindow::isActive() const
*/
bool QPlatformWindow::isAncestorOf(const QPlatformWindow *child) const
{
- for (const QPlatformWindow *parent = child->parent(); parent; parent = child->parent()) {
+ for (const QPlatformWindow *parent = child->parent(); parent; parent = parent->parent()) {
if (parent == this)
return true;
}
@@ -266,6 +230,20 @@ QPoint QPlatformWindow::mapToGlobal(const QPoint &pos) const
return result;
}
+QPointF QPlatformWindow::mapToGlobalF(const QPointF &pos) const
+{
+ const QPoint posPt = pos.toPoint();
+ const QPointF delta = pos - posPt;
+ return mapToGlobal(posPt) + delta;
+}
+
+QPointF QPlatformWindow::mapFromGlobalF(const QPointF &pos) const
+{
+ const QPoint posPt = pos.toPoint();
+ const QPointF delta = pos - posPt;
+ return mapFromGlobal(posPt) + delta;
+}
+
/*!
Translates the global screen coordinate \a pos to window
coordinates using native methods. This is required for embedded windows,
@@ -392,18 +370,18 @@ void QPlatformWindow::setMask(const QRegion &region)
Reimplement to let Qt be able to request activation/focus for a window
Some window systems will probably not have callbacks for this functionality,
- and then calling QWindowSystemInterface::handleWindowActivated(QWindow *w)
+ and then calling QWindowSystemInterface::handleFocusWindowChanged(QWindow *w)
would be sufficient.
If the window system has some event handling/callbacks then call
- QWindowSystemInterface::handleWindowActivated(QWindow *w) when the window system
+ QWindowSystemInterface::handleFocusWindowChanged(QWindow *w) when the window system
gives the notification.
- Default implementation calls QWindowSystem::handleWindowActivated(QWindow *w)
+ Default implementation calls QWindowSystem::handleFocusWindowChanged(QWindow *w)
*/
void QPlatformWindow::requestActivateWindow()
{
- QWindowSystemInterface::handleWindowActivated(window());
+ QWindowSystemInterface::handleFocusWindowChanged(window());
}
/*!
@@ -482,19 +460,17 @@ bool QPlatformWindow::windowEvent(QEvent *event)
}
/*!
- Reimplement this method to start a system size grip drag
- operation if the system supports it and return true to indicate
- success.
- It is called from the mouse press event handler of the size grip.
+ Reimplement this method to start a system resize operation if
+ the system supports it and return true to indicate success.
+
+ The default implementation is empty and does nothing with \a edges.
- The default implementation is empty and does nothing with \a pos
- and \a corner.
+ \since 5.15
*/
-bool QPlatformWindow::startSystemResize(const QPoint &pos, Qt::Corner corner)
+bool QPlatformWindow::startSystemResize(Qt::Edges edges)
{
- Q_UNUSED(pos)
- Q_UNUSED(corner)
+ Q_UNUSED(edges);
return false;
}
@@ -502,18 +478,13 @@ bool QPlatformWindow::startSystemResize(const QPoint &pos, Qt::Corner corner)
Reimplement this method to start a system move operation if
the system supports it and return true to indicate success.
- The \a pos is a position of MouseButtonPress event or TouchBegin
- event from a sequence of mouse events that triggered the movement.
- It must be specified in window coordinates.
+ The default implementation is empty and does nothing.
- The default implementation is empty and does nothing with \a pos.
-
- \since 5.11
+ \since 5.15
*/
-bool QPlatformWindow::startSystemMove(const QPoint &pos)
+bool QPlatformWindow::startSystemMove()
{
- Q_UNUSED(pos)
return false;
}
@@ -526,7 +497,7 @@ bool QPlatformWindow::startSystemMove(const QPoint &pos)
void QPlatformWindow::setFrameStrutEventsEnabled(bool enabled)
{
- Q_UNUSED(enabled) // Do not warn as widgets enable it by default causing warnings with XCB.
+ Q_UNUSED(enabled); // Do not warn as widgets enable it by default causing warnings with XCB.
}
/*!
@@ -614,7 +585,7 @@ QSize QPlatformWindow::constrainWindowSize(const QSize &size)
void QPlatformWindow::setAlertState(bool enable)
{
- Q_UNUSED(enable)
+ Q_UNUSED(enable);
}
/*!
@@ -671,16 +642,16 @@ void QPlatformWindow::invalidateSurface()
{
}
-static QSize fixInitialSize(QSize size, const QWindow *w,
- int defaultWidth, int defaultHeight)
+static QSize fixInitialSize(QSize size, const QWindow *w, int deviceIndependentDefaultWidth,
+ int deviceIndependentDefaultHeight)
{
if (size.width() == 0) {
const int minWidth = w->minimumWidth();
- size.setWidth(minWidth > 0 ? minWidth : defaultWidth);
+ size.setWidth(minWidth > 0 ? minWidth : deviceIndependentDefaultWidth);
}
if (size.height() == 0) {
const int minHeight = w->minimumHeight();
- size.setHeight(minHeight > 0 ? minHeight : defaultHeight);
+ size.setHeight(minHeight > 0 ? minHeight : deviceIndependentDefaultHeight);
}
return size;
}
@@ -693,6 +664,10 @@ static QSize fixInitialSize(QSize size, const QWindow *w,
layout new windows to optimize usage of the available desktop space.
However if the given window already has geometry which the application has
initialized, it takes priority.
+
+ \a initialGeometry has to be provided in native pixels.
+ \a defaultWidth has to be provided in device independent pixels
+ \a defaultHeight has to be provided in device independent pixels
*/
QRect QPlatformWindow::initialGeometry(const QWindow *w, const QRect &initialGeometry,
int defaultWidth, int defaultHeight,
@@ -702,9 +677,10 @@ QRect QPlatformWindow::initialGeometry(const QWindow *w, const QRect &initialGeo
*resultingScreenReturn = w->screen();
if (!w->isTopLevel()) {
const qreal factor = QHighDpiScaling::factor(w);
- const QSize size = fixInitialSize(QHighDpi::fromNative(initialGeometry.size(), factor),
- w, defaultWidth, defaultHeight);
- return QRect(initialGeometry.topLeft(), QHighDpi::toNative(size, factor));
+ const QSize deviceIndependentSize =
+ fixInitialSize(QHighDpi::fromNative(initialGeometry.size(), factor), w,
+ defaultWidth, defaultHeight);
+ return QRect(initialGeometry.topLeft(), QHighDpi::toNative(deviceIndependentSize, factor));
}
const auto *wp = qt_window_private(const_cast<QWindow*>(w));
const bool position = wp->positionAutomatic && w->type() != Qt::Popup;
@@ -718,26 +694,28 @@ QRect QPlatformWindow::initialGeometry(const QWindow *w, const QRect &initialGeo
if (resultingScreenReturn)
*resultingScreenReturn = screen;
// initialGeometry refers to window's screen
- QRect rect(QHighDpi::fromNativePixels(initialGeometry, w));
+ QRect deviceIndependentRect(QHighDpi::fromNativePixels(initialGeometry, w));
if (wp->resizeAutomatic)
- rect.setSize(fixInitialSize(rect.size(), w, defaultWidth, defaultHeight));
+ deviceIndependentRect.setSize(
+ fixInitialSize(deviceIndependentRect.size(), w, defaultWidth, defaultHeight));
if (position) {
- const QRect availableGeometry = screen->availableGeometry();
+ const QRect availableDeviceIndependentGeometry = screen->availableGeometry();
// Center unless the geometry ( + unknown window frame) is too large for the screen).
- if (rect.height() < (availableGeometry.height() * 8) / 9
- && rect.width() < (availableGeometry.width() * 8) / 9) {
+ if (deviceIndependentRect.height() < (availableDeviceIndependentGeometry.height() * 8) / 9
+ && deviceIndependentRect.width()
+ < (availableDeviceIndependentGeometry.width() * 8) / 9) {
const QWindow *tp = w->transientParent();
if (tp) {
// A transient window should be centered w.r.t. its transient parent.
- rect.moveCenter(tp->geometry().center());
+ deviceIndependentRect.moveCenter(tp->geometry().center());
} else {
// Center the window on the screen. (Only applicable on platforms
// which do not provide a better way.)
- rect.moveCenter(availableGeometry.center());
+ deviceIndependentRect.moveCenter(availableDeviceIndependentGeometry.center());
}
}
}
- return QHighDpi::toNativePixels(rect, screen);
+ return QHighDpi::toNativePixels(deviceIndependentRect, screen);
}
/*!
@@ -747,22 +725,31 @@ QRect QPlatformWindow::initialGeometry(const QWindow *w, const QRect &initialGeo
QPlatformWindow subclasses can re-implement this function to
provide display refresh synchronized updates. The event
should be delivered using QPlatformWindow::deliverUpdateRequest()
- to not get out of sync with the the internal state of QWindow.
+ to not get out of sync with the internal state of QWindow.
- The default implementation posts an UpdateRequest event to the
- window after 5 ms. The additional time is there to give the event
- loop a bit of idle time to gather system events.
+ The default implementation posts an UpdateRequest event to the window after
+ an interval that is at most 5 ms. If the window's associated screen reports
+ a \l{QPlatformScreen::refreshRate()}{refresh rate} higher than 60 Hz, the
+ interval is scaled down to a valid smaller than 5. The additional time is
+ there to give the event loop a bit of idle time to gather system events.
*/
void QPlatformWindow::requestUpdate()
{
Q_D(QPlatformWindow);
- static int updateInterval = []() {
- bool ok = false;
- int customUpdateInterval = qEnvironmentVariableIntValue("QT_QPA_UPDATE_IDLE_TIME", &ok);
- return ok ? customUpdateInterval : 5;
- }();
+ static bool customUpdateIntervalValid = false;
+ static int customUpdateInterval = qEnvironmentVariableIntValue("QT_QPA_UPDATE_IDLE_TIME",
+ &customUpdateIntervalValid);
+ int updateInterval = customUpdateInterval;
+ if (!customUpdateIntervalValid) {
+ updateInterval = 5;
+ if (QPlatformScreen *currentScreen = screen()) {
+ const qreal refreshRate = currentScreen->refreshRate();
+ if (refreshRate > 60.0)
+ updateInterval /= refreshRate / 60.0;
+ }
+ }
Q_ASSERT(!d->updateTimer.isActive());
d->updateTimer.start(updateInterval, Qt::PreciseTimer, window());
@@ -791,6 +778,15 @@ void QPlatformWindow::deliverUpdateRequest()
QWindow *w = window();
QWindowPrivate *wp = qt_window_private(w);
+
+ // We expect that the platform plugins send DevicePixelRatioChange events.
+ // As a fail-safe make a final check here to make sure the cached DPR value is
+ // always up to date before delivering the update request.
+ if (wp->updateDevicePixelRatio()) {
+ qWarning() << "The cached device pixel ratio value was stale on window update. "
+ << "Please file a QTBUG which explains how to reproduce.";
+ }
+
wp->updateRequestPending = false;
QEvent request(QEvent::UpdateRequest);
QCoreApplication::sendEvent(w, &request);
@@ -842,7 +838,7 @@ QSize QPlatformWindow::windowSizeIncrement() const
*/
QRect QPlatformWindow::windowGeometry() const
{
- return QHighDpi::toNativePixels(window()->geometry(), window());
+ return QHighDpi::toNativeWindowGeometry(window()->geometry(), window());
}
/*!
@@ -850,7 +846,7 @@ QRect QPlatformWindow::windowGeometry() const
*/
QRect QPlatformWindow::windowFrameGeometry() const
{
- return QHighDpi::toNativePixels(window()->frameGeometry(), window());
+ return QHighDpi::toNativeWindowGeometry(window()->frameGeometry(), window());
}
/*!
@@ -861,10 +857,10 @@ QRect QPlatformWindow::windowFrameGeometry() const
QRectF QPlatformWindow::closestAcceptableGeometry(const QWindow *qWindow, const QRectF &nativeRect)
{
- const QRectF rectF = QHighDpi::fromNativePixels(nativeRect, qWindow);
+ const QRectF rectF = QHighDpi::fromNativeWindowGeometry(nativeRect, qWindow);
const QRectF correctedGeometryF = qt_window_private(const_cast<QWindow *>(qWindow))->closestAcceptableGeometry(rectF);
return !correctedGeometryF.isEmpty() && rectF != correctedGeometryF
- ? QHighDpi::toNativePixels(correctedGeometryF, qWindow) : nativeRect;
+ ? QHighDpi::toNativeWindowGeometry(correctedGeometryF, qWindow) : nativeRect;
}
QRectF QPlatformWindow::windowClosestAcceptableGeometry(const QRectF &nativeRect) const
@@ -889,8 +885,8 @@ QRectF QPlatformWindow::windowClosestAcceptableGeometry(const QRectF &nativeRect
However, it is not concerned with how Qt renders into the window it represents.
Visible QWindows will always have a QPlatformWindow. However, it is not necessary for
- all windows to have a QBackingStore. This is the case for QOpenGLWidget. And could be the case for
- windows where some 3.party renders into it.
+ all windows to have a QBackingStore. This is the case for QOpenGLWindow. And could be the case for
+ windows where some third party renders into it.
The platform specific window handle can be retrieved by the winId function.
diff --git a/src/gui/kernel/qplatformwindow.h b/src/gui/kernel/qplatformwindow.h
index b6aeb3a86a..b6e96a457e 100644
--- a/src/gui/kernel/qplatformwindow.h
+++ b/src/gui/kernel/qplatformwindow.h
@@ -1,41 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2017 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the QtGui module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2017 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#ifndef QPLATFORMWINDOW_H
#define QPLATFORMWINDOW_H
@@ -60,6 +24,7 @@
QT_BEGIN_NAMESPACE
+#define QWINDOWSIZE_MAX ((1<<24)-1)
class QPlatformScreen;
class QPlatformWindowPrivate;
@@ -111,9 +76,11 @@ public:
virtual bool isActive() const;
virtual bool isAncestorOf(const QPlatformWindow *child) const;
virtual bool isEmbedded() const;
- virtual bool isForeignWindow() const { return false; };
+ virtual bool isForeignWindow() const { return false; }
virtual QPoint mapToGlobal(const QPoint &pos) const;
+ QPointF mapToGlobalF(const QPointF &pos) const;
virtual QPoint mapFromGlobal(const QPoint &pos) const;
+ QPointF mapFromGlobalF(const QPointF &pos) const;
virtual void propagateSizeHints();
@@ -132,8 +99,8 @@ public:
virtual bool windowEvent(QEvent *event);
- virtual bool startSystemResize(const QPoint &pos, Qt::Corner corner);
- virtual bool startSystemMove(const QPoint &pos);
+ virtual bool startSystemResize(Qt::Edges edges);
+ virtual bool startSystemMove();
virtual void setFrameStrutEventsEnabled(bool enabled);
virtual bool frameStrutEventsEnabled() const;
diff --git a/src/gui/kernel/qplatformwindow_p.h b/src/gui/kernel/qplatformwindow_p.h
index 00dae9334c..2bbdfd5bf9 100644
--- a/src/gui/kernel/qplatformwindow_p.h
+++ b/src/gui/kernel/qplatformwindow_p.h
@@ -1,41 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the QtGui module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#ifndef QPLATFORMWINDOW_P_H
#define QPLATFORMWINDOW_P_H
@@ -54,9 +18,20 @@
#include <QtGui/private/qtguiglobal_p.h>
#include <QtCore/qbasictimer.h>
#include <QtCore/qrect.h>
+#include <QtCore/qnativeinterface.h>
+#include <QtGui/qwindow.h>
+
+#if QT_CONFIG(wayland)
+#include <any>
+#include <QtCore/qobject.h>
+
+struct wl_surface;
+#endif
QT_BEGIN_NAMESPACE
+class QMargins;
+
class QPlatformWindowPrivate
{
public:
@@ -64,6 +39,104 @@ public:
QBasicTimer updateTimer;
};
+// ----------------- QNativeInterface -----------------
+
+namespace QNativeInterface::Private {
+
+#if defined(Q_OS_WASM) || defined(Q_QDOC)
+struct Q_GUI_EXPORT QWasmWindow
+{
+ QT_DECLARE_NATIVE_INTERFACE(QWasmWindow, 1, QWindow)
+ virtual emscripten::val document() const = 0;
+ virtual emscripten::val clientArea() const = 0;
+};
+#endif
+
+#if defined(Q_OS_MACOS) || defined(Q_QDOC)
+struct Q_GUI_EXPORT QCocoaWindow
+{
+ QT_DECLARE_NATIVE_INTERFACE(QCocoaWindow, 1, QWindow)
+ virtual void setContentBorderEnabled(bool enable) = 0;
+ virtual QPoint bottomLeftClippedByNSWindowOffset() const = 0;
+};
+#endif
+
+#if QT_CONFIG(xcb) || defined(Q_QDOC)
+struct Q_GUI_EXPORT QXcbWindow
+{
+ QT_DECLARE_NATIVE_INTERFACE(QXcbWindow, 1, QWindow)
+
+ enum WindowType {
+ None = 0x000000,
+ Normal = 0x000001,
+ Desktop = 0x000002,
+ Dock = 0x000004,
+ Toolbar = 0x000008,
+ Menu = 0x000010,
+ Utility = 0x000020,
+ Splash = 0x000040,
+ Dialog = 0x000080,
+ DropDownMenu = 0x000100,
+ PopupMenu = 0x000200,
+ Tooltip = 0x000400,
+ Notification = 0x000800,
+ Combo = 0x001000,
+ Dnd = 0x002000,
+ KdeOverride = 0x004000
+ };
+ Q_DECLARE_FLAGS(WindowTypes, WindowType)
+
+ virtual void setWindowType(WindowTypes type) = 0;
+ virtual void setWindowRole(const QString &role) = 0;
+ virtual void setWindowIconText(const QString &text) = 0;
+ virtual uint visualId() const = 0;
+};
+#endif // xcb
+
+#if defined(Q_OS_WIN) || defined(Q_QDOC)
+struct Q_GUI_EXPORT QWindowsWindow
+{
+ QT_DECLARE_NATIVE_INTERFACE(QWindowsWindow, 1, QWindow)
+
+ virtual void setHasBorderInFullScreen(bool border) = 0;
+ virtual bool hasBorderInFullScreen() const = 0;
+
+ virtual QMargins customMargins() const = 0;
+ virtual void setCustomMargins(const QMargins &margins) = 0;
+};
+#endif // Q_OS_WIN
+
+#if QT_CONFIG(wayland)
+struct Q_GUI_EXPORT QWaylandWindow : public QObject
+{
+ Q_OBJECT
+public:
+ QT_DECLARE_NATIVE_INTERFACE(QWaylandWindow, 1, QWindow)
+
+ virtual wl_surface *surface() const = 0;
+ virtual void setCustomMargins(const QMargins &margins) = 0;
+ virtual void requestXdgActivationToken(uint serial) = 0;
+ template<typename T>
+ T *surfaceRole() const
+ {
+ std::any anyRole = _surfaceRole();
+ auto role = std::any_cast<T *>(&anyRole);
+ return role ? *role : nullptr;
+ }
+Q_SIGNALS:
+ void surfaceCreated();
+ void surfaceDestroyed();
+ void surfaceRoleCreated();
+ void surfaceRoleDestroyed();
+ void xdgActivationTokenCreated(const QString &token);
+
+protected:
+ virtual std::any _surfaceRole() const = 0;
+};
+#endif
+
+} // QNativeInterface::Private
+
QT_END_NAMESPACE
#endif // QPLATFORMWINDOW_P_H
diff --git a/src/gui/kernel/qpointingdevice.cpp b/src/gui/kernel/qpointingdevice.cpp
new file mode 100644
index 0000000000..c4c1e5fd5c
--- /dev/null
+++ b/src/gui/kernel/qpointingdevice.cpp
@@ -0,0 +1,823 @@
+// Copyright (C) 2020 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
+
+#include "qpointingdevice.h"
+#include "qpointingdevice_p.h"
+#include "qwindowsysteminterface_p.h"
+#include "qeventpoint_p.h"
+
+#include <QList>
+#include <QLoggingCategory>
+#include <QMutex>
+#include <QCoreApplication>
+
+#include <private/qdebug_p.h>
+
+QT_BEGIN_NAMESPACE
+
+using namespace Qt::StringLiterals;
+
+Q_LOGGING_CATEGORY(lcPointerGrab, "qt.pointer.grab");
+
+/*!
+ \class QPointingDevice
+ \brief The QPointingDevice class describes a device from which mouse, touch or tablet events originate.
+ \since 6.0
+ \ingroup events
+ \inmodule QtGui
+
+ Each QPointerEvent contains a QPointingDevice pointer to allow accessing
+ device-specific properties like type and capabilities. It is the
+ responsibility of the platform or generic plug-ins to register the
+ available pointing devices via QWindowSystemInterface before generating any
+ pointer events. Applications do not need to instantiate this class, they
+ should just access the global instances pointed to by QPointerEvent::device().
+*/
+
+/*! \enum QInputDevice::DeviceType
+
+ This enum represents the type of device that generated a QPointerEvent.
+
+ \value Unknown
+ The device cannot be identified.
+
+ \value Mouse
+ A mouse.
+
+ \value TouchScreen
+ In this type of device, the touch surface and display are integrated.
+ This means the surface and display typically have the same size, such
+ that there is a direct relationship between the touch points' physical
+ positions and the coordinate reported by QEventPoint. As a
+ result, Qt allows the user to interact directly with multiple QWidgets,
+ QGraphicsItems, or Qt Quick Items at the same time.
+
+ \value TouchPad
+ In this type of device, the touch surface is separate from the display.
+ There is not a direct relationship between the physical touch location
+ and the on-screen coordinates. Instead, they are calculated relative to
+ the current mouse position, and the user must use the touch-pad to move
+ this reference point. Unlike touch-screens, Qt allows users to only
+ interact with a single QWidget or QGraphicsItem at a time.
+
+ \value Stylus
+ A pen-like device used on a graphics tablet such as a Wacom tablet,
+ or on a touchscreen that provides a separate stylus sensing capability.
+
+ \value Airbrush
+ A stylus with a thumbwheel to adjust
+ \l {QTabletEvent::tangentialPressure}{tangentialPressure}.
+
+ \value Puck
+ A device that is similar to a flat mouse with a transparent circle with
+ cross-hairs.
+
+ \value Keyboard
+ A keyboard.
+
+ \value AllDevices
+ Any of the above (used as a default filter value).
+*/
+
+/*! \enum QPointingDevice::PointerType
+
+ This enum represents what is interacting with the pointing device.
+
+ There is some redundancy between this property and \l {QInputDevice::DeviceType}.
+ For example, if a touchscreen is used, then the \c DeviceType is
+ \c TouchScreen and \c PointerType is \c Finger (always). But on a graphics
+ tablet, it's often possible for both ends of the stylus to be used, and
+ programs need to distinguish them. Therefore the concept is extended so
+ that every QPointerEvent has a PointerType, and it can simplify some event
+ handling code to ignore the DeviceType and react differently depending on
+ the PointerType alone.
+
+ Valid values are:
+
+ \value Unknown
+ The pointer type is unknown.
+ \value Generic
+ A mouse or something acting like a mouse (the core pointer on X11).
+ \value Finger
+ The user's finger.
+ \value Pen
+ The drawing end of a stylus.
+ \value Eraser
+ The other end of the stylus (if it has a virtual eraser on the other end).
+ \value Cursor
+ A transparent circle with cross-hairs as found on a
+ \l {QInputDevice::DeviceType}{Puck} device.
+ \value AllPointerTypes
+ Any of the above (used as a default filter value).
+*/
+
+/*! \enum QPointingDevice::GrabTransition
+
+ This enum represents a transition of exclusive or passive grab
+ from one object (possibly \c nullptr) to another (possibly \c nullptr).
+ It is emitted as an argument of the QPointingDevice::grabChanged() signal.
+
+ Valid values are:
+
+ \value GrabExclusive
+ Emitted after QPointerEvent::setExclusiveGrabber().
+ \value UngrabExclusive
+ Emitted after QPointerEvent::setExclusiveGrabber() when the grabber is
+ set to \c nullptr, to notify that the grab has terminated normally.
+ \value CancelGrabExclusive
+ Emitted after QPointerEvent::setExclusiveGrabber() when the grabber is set
+ to a different object, to notify that the old grabber's grab is "stolen".
+ \value GrabPassive
+ Emitted after QPointerEvent::addPassiveGrabber().
+ \value UngrabPassive
+ Emitted when a passive grab is terminated normally,
+ for example after QPointerEvent::removePassiveGrabber().
+ \value CancelGrabPassive
+ Emitted when a passive grab is terminated abnormally (a gesture is canceled).
+ \value OverrideGrabPassive
+ This value is not currently used.
+*/
+
+/*! \fn void QPointingDevice::grabChanged(QObject *grabber, QPointingDevice::GrabTransition transition, const QPointerEvent *event, const QEventPoint &point) const
+
+ This signal is emitted when the \a grabber object gains or loses an
+ exclusive or passive grab of \a point during delivery of \a event.
+ The \a transition tells what happened, from the perspective of the
+ \c grabber object.
+
+ \note A grab transition from one object to another results in two signals,
+ to notify that one object has lost its grab, and to notify that there is
+ another grabber. In other cases, when transitioning to or from a non-grabbing
+ state, only one signal is emitted: the \a grabber argument is never \c nullptr.
+
+ \sa QPointerEvent::setExclusiveGrabber(), QPointerEvent::addPassiveGrabber(), QPointerEvent::removePassiveGrabber()
+*/
+
+/*!
+ Creates a new invalid pointing device instance as a child of \a parent.
+*/
+QPointingDevice::QPointingDevice(QObject *parent)
+ : QInputDevice(*(new QPointingDevicePrivate("unknown"_L1, -1,
+ DeviceType::Unknown, PointerType::Unknown,
+ Capability::None, 0, 0)), parent)
+{
+}
+
+QPointingDevice::~QPointingDevice()
+{
+}
+
+/*!
+ Creates a new pointing device instance with the given
+ \a name, \a deviceType, \a pointerType, \a capabilities, \a maxPoints,
+ \a buttonCount, \a seatName, \a uniqueId and \a parent.
+*/
+QPointingDevice::QPointingDevice(const QString &name, qint64 id, QInputDevice::DeviceType deviceType,
+ QPointingDevice::PointerType pointerType, Capabilities capabilities, int maxPoints, int buttonCount,
+ const QString &seatName, QPointingDeviceUniqueId uniqueId, QObject *parent)
+ : QInputDevice(*(new QPointingDevicePrivate(name, id, deviceType, pointerType, capabilities, maxPoints, buttonCount, seatName, uniqueId)), parent)
+{
+}
+
+/*!
+ \internal
+*/
+QPointingDevice::QPointingDevice(QPointingDevicePrivate &d, QObject *parent)
+ : QInputDevice(d, parent)
+{
+}
+
+#if QT_DEPRECATED_SINCE(6, 0)
+/*!
+ \internal
+ \deprecated [6.0] Please use the constructor rather than setters.
+
+ Sets the device type \a devType and infers the pointer type.
+*/
+void QPointingDevice::setType(DeviceType devType)
+{
+ Q_D(QPointingDevice);
+ d->deviceType = devType;
+ if (d->pointerType == PointerType::Unknown)
+ switch (devType) {
+ case DeviceType::Mouse:
+ d->pointerType = PointerType::Generic;
+ break;
+ case DeviceType::TouchScreen:
+ case DeviceType::TouchPad:
+ d->pointerType = PointerType::Finger;
+ break;
+ case DeviceType::Puck:
+ d->pointerType = PointerType::Cursor;
+ break;
+ case DeviceType::Stylus:
+ case DeviceType::Airbrush:
+ d->pointerType = PointerType::Pen;
+ break;
+ default:
+ break;
+ }
+}
+
+/*!
+ \internal
+ \deprecated [6.0] Please use the constructor rather than setters.
+*/
+void QPointingDevice::setCapabilities(QInputDevice::Capabilities caps)
+{
+ Q_D(QPointingDevice);
+ d->capabilities = caps;
+}
+
+/*!
+ \internal
+ \deprecated [6.0] Please use the constructor rather than setters.
+*/
+void QPointingDevice::setMaximumTouchPoints(int c)
+{
+ Q_D(QPointingDevice);
+ d->maximumTouchPoints = c;
+}
+#endif // QT_DEPRECATED_SINCE(6, 0)
+
+/*!
+ Returns the pointer type.
+*/
+QPointingDevice::PointerType QPointingDevice::pointerType() const
+{
+ Q_D(const QPointingDevice);
+ return d->pointerType;
+}
+
+/*!
+ Returns the maximum number of simultaneous touch points (fingers) that
+ can be detected.
+*/
+int QPointingDevice::maximumPoints() const
+{
+ Q_D(const QPointingDevice);
+ return d->maximumTouchPoints;
+}
+
+/*!
+ Returns the maximum number of on-device buttons that can be detected.
+*/
+int QPointingDevice::buttonCount() const
+{
+ Q_D(const QPointingDevice);
+ return d->buttonCount;
+}
+
+/*!
+ Returns a unique ID (of dubious utility) for the device.
+
+ You probably should rather be concerned with QPointerEventPoint::uniqueId().
+*/
+QPointingDeviceUniqueId QPointingDevice::uniqueId() const
+{
+ Q_D(const QPointingDevice);
+ return d->uniqueId;
+}
+
+/*!
+ Returns the primary pointing device (the core pointer, traditionally
+ assumed to be a mouse) on the given seat \a seatName.
+
+ If multiple pointing devices are registered, this function prefers a mouse
+ or touchpad that matches the given \a seatName and that does not have
+ another device as its parent. Usually only one master or core device does
+ not have a parent device. But if such a device is not found, this function
+ creates a new virtual "core pointer" mouse. Thus Qt continues to work on
+ platforms that are not yet doing input device discovery and registration.
+*/
+const QPointingDevice *QPointingDevice::primaryPointingDevice(const QString& seatName)
+{
+ const auto v = devices();
+ const QPointingDevice *mouse = nullptr;
+ const QPointingDevice *touchpad = nullptr;
+ for (const QInputDevice *dev : v) {
+ if (!seatName.isNull() && dev->seatName() != seatName)
+ continue;
+ if (dev->type() == QInputDevice::DeviceType::Mouse) {
+ if (!mouse)
+ mouse = static_cast<const QPointingDevice *>(dev);
+ // the core pointer is likely a mouse, and its parent is not another input device
+ if (!mouse->parent() || !qobject_cast<const QInputDevice *>(mouse->parent()))
+ return mouse;
+ } else if (dev->type() == QInputDevice::DeviceType::TouchPad) {
+ if (!touchpad || !dev->parent() || dev->parent()->metaObject() != dev->metaObject())
+ touchpad = static_cast<const QPointingDevice *>(dev);
+ }
+ }
+ if (!mouse && !touchpad) {
+ qCDebug(lcQpaInputDevices) << "no mouse-like devices registered for seat" << seatName
+ << "The platform plugin should have provided one via "
+ "QWindowSystemInterface::registerInputDevice(). Creating a default mouse for now.";
+ mouse = new QPointingDevice("core pointer"_L1, 1, DeviceType::Mouse,
+ PointerType::Generic, Capability::Position, 1, 3, seatName,
+ QPointingDeviceUniqueId(), QCoreApplication::instance());
+ QInputDevicePrivate::registerDevice(mouse);
+ return mouse;
+ }
+ if (v.size() > 1)
+ qCDebug(lcQpaInputDevices) << "core pointer ambiguous for seat" << seatName;
+ if (mouse)
+ return mouse;
+ return touchpad;
+}
+
+QPointingDevicePrivate::~QPointingDevicePrivate()
+ = default;
+
+/*!
+ \internal
+ Finds the device instance belonging to the drawing or eraser end of a particular stylus,
+ identified by its \a deviceType, \a pointerType, \a uniqueId and \a systemId.
+ Returns the device found, or \c nullptr if none was found.
+
+ If \a systemId is \c 0, it's not significant for the search.
+
+ If an instance matching the given \a deviceType and \a pointerType but with
+ only a default-constructed \c uniqueId is found, it will be assumed to be
+ the one we're looking for, its \c uniqueId will be updated to match the
+ given \a uniqueId, and its \c capabilities will be updated to match the
+ given \a capabilities. This is for the benefit of any platform plugin that can
+ discover the tablet itself at startup, along with the supported stylus types,
+ but then discovers specific styli later on as they come into proximity.
+*/
+const QPointingDevice *QPointingDevicePrivate::queryTabletDevice(QInputDevice::DeviceType deviceType,
+ QPointingDevice::PointerType pointerType,
+ QPointingDeviceUniqueId uniqueId,
+ QPointingDevice::Capabilities capabilities,
+ qint64 systemId)
+{
+ const auto &devices = QInputDevice::devices();
+ for (const QInputDevice *dev : devices) {
+ if (dev->type() < QPointingDevice::DeviceType::Puck || dev->type() > QPointingDevice::DeviceType::Airbrush)
+ continue;
+ const QPointingDevice *pdev = static_cast<const QPointingDevice *>(dev);
+ const auto devPriv = QPointingDevicePrivate::get(pdev);
+ bool uniqueIdDiscovered = (devPriv->uniqueId.numericId() == 0 && uniqueId.numericId() != 0);
+ if (devPriv->deviceType == deviceType && devPriv->pointerType == pointerType &&
+ (!systemId || devPriv->systemId == systemId) &&
+ (devPriv->uniqueId == uniqueId || uniqueIdDiscovered)) {
+ if (uniqueIdDiscovered) {
+ const_cast<QPointingDevicePrivate *>(devPriv)->uniqueId = uniqueId;
+ if (capabilities)
+ const_cast<QPointingDevicePrivate *>(devPriv)->capabilities = capabilities;
+ qCDebug(lcQpaInputDevices) << "discovered unique ID and capabilities of tablet tool" << pdev;
+ }
+ return pdev;
+ }
+ }
+ return nullptr;
+}
+
+/*!
+ \internal
+ Finds the device instance identified by its \a systemId.
+ Returns the device found, or \c nullptr if none was found.
+*/
+const QPointingDevice *QPointingDevicePrivate::pointingDeviceById(qint64 systemId)
+{
+ const auto &devices = QInputDevice::devices();
+ for (const QInputDevice *dev : devices) {
+ if (dev->type() >= QPointingDevice::DeviceType::Keyboard)
+ continue;
+ const QPointingDevice *pdev = static_cast<const QPointingDevice *>(dev);
+ const auto devPriv = QPointingDevicePrivate::get(pdev);
+ if (devPriv->systemId == systemId)
+ return pdev;
+ }
+ return nullptr;
+}
+
+/*!
+ \internal
+ First, ensure that the \a cancelEvent's QTouchEvent::points() list contains
+ all points that have exclusive grabs. Then send the event to each object
+ that has an exclusive grab of any of the points.
+*/
+void QPointingDevicePrivate::sendTouchCancelEvent(QTouchEvent *cancelEvent)
+{
+ // An incoming TouchCancel event will typically not contain any points, but
+ // QQuickPointerHandler::onGrabChanged needs to be called for each point
+ // that has an exclusive grabber. Adding those points to the event makes it
+ // an easy iteration there.
+ if (cancelEvent->points().isEmpty()) {
+ for (auto &epd : activePoints.values()) {
+ if (epd.exclusiveGrabber)
+ QMutableTouchEvent::from(cancelEvent)->addPoint(epd.eventPoint);
+ }
+ }
+ for (auto &epd : activePoints.values()) {
+ if (epd.exclusiveGrabber)
+ QCoreApplication::sendEvent(epd.exclusiveGrabber, cancelEvent);
+ // The next touch event can only be a TouchBegin, so clean up.
+ cancelEvent->setExclusiveGrabber(epd.eventPoint, nullptr);
+ cancelEvent->clearPassiveGrabbers(epd.eventPoint);
+ }
+}
+
+/*! \internal
+ Returns the active EventPointData instance with the given \a id, if available,
+ or \c nullptr if not.
+*/
+QPointingDevicePrivate::EventPointData *QPointingDevicePrivate::queryPointById(int id) const
+{
+ auto it = activePoints.find(id);
+ if (it == activePoints.end())
+ return nullptr;
+ return &it.value();
+}
+
+/*! \internal
+ Returns the active EventPointData instance with the given \a id, if available;
+ if not, appends a new instance and returns it.
+*/
+QPointingDevicePrivate::EventPointData *QPointingDevicePrivate::pointById(int id) const
+{
+ const auto [it, inserted] = activePoints.try_emplace(id);
+ if (inserted) {
+ Q_Q(const QPointingDevice);
+ auto &epd = it.value();
+ QMutableEventPoint::setId(epd.eventPoint, id);
+ QMutableEventPoint::setDevice(epd.eventPoint, q);
+ }
+ return &it.value();
+}
+
+/*! \internal
+ Remove the active EventPointData instance with the given \a id.
+*/
+void QPointingDevicePrivate::removePointById(int id)
+{
+ activePoints.remove(id);
+}
+
+/*!
+ \internal
+ Find the first non-null target (widget) via QMutableEventPoint::target()
+ in the active points. This is the widget that will receive any event that
+ comes from a touchpad, even if some of the touchpoints fall spatially on
+ other windows.
+*/
+QObject *QPointingDevicePrivate::firstActiveTarget() const
+{
+ for (auto &pt : activePoints.values()) {
+ if (auto target = QMutableEventPoint::target(pt.eventPoint))
+ return target;
+ }
+ return nullptr;
+}
+
+/*! \internal
+ Find the first non-null QWindow instance via QMutableEventPoint::window()
+ in the active points. This is the window that will receive any event that
+ comes from a touchpad, even if some of the touchpoints fall spatially on
+ other windows.
+*/
+QWindow *QPointingDevicePrivate::firstActiveWindow() const
+{
+ for (auto &pt : activePoints.values()) {
+ if (auto window = QMutableEventPoint::window(pt.eventPoint))
+ return window;
+ }
+ return nullptr;
+}
+
+/*! \internal
+ Return the exclusive grabber of the first point in activePoints.
+ This is mainly for autotests that try to verify the "current" grabber
+ outside the context of event delivery, which is something that the rest
+ of the codebase should not be doing.
+*/
+QObject *QPointingDevicePrivate::firstPointExclusiveGrabber() const
+{
+ if (activePoints.isEmpty())
+ return nullptr;
+ return activePoints.values().first().exclusiveGrabber;
+}
+
+void QPointingDevicePrivate::setExclusiveGrabber(const QPointerEvent *event, const QEventPoint &point, QObject *exclusiveGrabber)
+{
+ Q_Q(QPointingDevice);
+ auto persistentPoint = queryPointById(point.id());
+ if (!persistentPoint) {
+ qWarning() << "point is not in activePoints" << point;
+ return;
+ }
+ Q_ASSERT(persistentPoint->eventPoint.id() == point.id());
+ if (persistentPoint->exclusiveGrabber == exclusiveGrabber)
+ return;
+ auto oldGrabber = persistentPoint->exclusiveGrabber;
+ persistentPoint->exclusiveGrabber = exclusiveGrabber;
+ if (oldGrabber)
+ emit q->grabChanged(oldGrabber, exclusiveGrabber ? QPointingDevice::CancelGrabExclusive : QPointingDevice::UngrabExclusive,
+ event, persistentPoint->eventPoint);
+ if (Q_UNLIKELY(lcPointerGrab().isDebugEnabled())) {
+ qCDebug(lcPointerGrab) << name << "point" << point.id() << point.state()
+ << "@" << point.scenePosition()
+ << ": grab" << oldGrabber << "->" << exclusiveGrabber;
+ }
+ QMutableEventPoint::setGlobalGrabPosition(persistentPoint->eventPoint, point.globalPosition());
+ if (exclusiveGrabber)
+ emit q->grabChanged(exclusiveGrabber, QPointingDevice::GrabExclusive, event, point);
+ else
+ persistentPoint->exclusiveGrabberContext.clear();
+}
+
+/*!
+ \internal
+ Call QEventPoint::setExclusiveGrabber(nullptr) on each active point that has a grabber.
+*/
+bool QPointingDevicePrivate::removeExclusiveGrabber(const QPointerEvent *event, const QObject *grabber)
+{
+ bool ret = false;
+ for (auto &pt : activePoints.values()) {
+ if (pt.exclusiveGrabber == grabber) {
+ setExclusiveGrabber(event, pt.eventPoint, nullptr);
+ ret = true;
+ }
+ }
+ return ret;
+}
+
+bool QPointingDevicePrivate::addPassiveGrabber(const QPointerEvent *event, const QEventPoint &point, QObject *grabber)
+{
+ Q_Q(QPointingDevice);
+ auto persistentPoint = queryPointById(point.id());
+ if (!persistentPoint) {
+ qWarning() << "point is not in activePoints" << point;
+ return false;
+ }
+ if (persistentPoint->passiveGrabbers.contains(grabber))
+ return false;
+ if (Q_UNLIKELY(lcPointerGrab().isDebugEnabled())) {
+ qCDebug(lcPointerGrab) << name << "point" << point.id() << point.state()
+ << ": grab (passive)" << grabber;
+ }
+ persistentPoint->passiveGrabbers << grabber;
+ emit q->grabChanged(grabber, QPointingDevice::GrabPassive, event, point);
+ return true;
+}
+
+bool QPointingDevicePrivate::setPassiveGrabberContext(QPointingDevicePrivate::EventPointData *epd, QObject *grabber, QObject *context)
+{
+ qsizetype i = epd->passiveGrabbers.indexOf(grabber);
+ if (i < 0)
+ return false;
+ if (epd->passiveGrabbersContext.size() <= i)
+ epd->passiveGrabbersContext.resize(i + 1);
+ epd->passiveGrabbersContext[i] = context;
+ return true;
+}
+
+bool QPointingDevicePrivate::removePassiveGrabber(const QPointerEvent *event, const QEventPoint &point, QObject *grabber)
+{
+ Q_Q(QPointingDevice);
+ auto persistentPoint = queryPointById(point.id());
+ if (!persistentPoint) {
+ qWarning() << "point is not in activePoints" << point;
+ return false;
+ }
+ qsizetype i = persistentPoint->passiveGrabbers.indexOf(grabber);
+ if (i >= 0) {
+ if (Q_UNLIKELY(lcPointerGrab().isDebugEnabled())) {
+ qCDebug(lcPointerGrab) << name << "point" << point.id() << point.state()
+ << ": removing passive grabber" << grabber;
+ }
+ emit q->grabChanged(grabber, QPointingDevice::UngrabPassive, event, point);
+ persistentPoint->passiveGrabbers.removeAt(i);
+ if (persistentPoint->passiveGrabbersContext.size()) {
+ Q_ASSERT(persistentPoint->passiveGrabbersContext.size() > i);
+ persistentPoint->passiveGrabbersContext.removeAt(i);
+ }
+ return true;
+ }
+ return false;
+}
+
+void QPointingDevicePrivate::clearPassiveGrabbers(const QPointerEvent *event, const QEventPoint &point)
+{
+ Q_Q(QPointingDevice);
+ auto persistentPoint = queryPointById(point.id());
+ if (!persistentPoint) {
+ qWarning() << "point is not in activePoints" << point;
+ return;
+ }
+ if (persistentPoint->passiveGrabbers.isEmpty())
+ return;
+ if (Q_UNLIKELY(lcPointerGrab().isDebugEnabled())) {
+ qCDebug(lcPointerGrab) << name << "point" << point.id() << point.state()
+ << ": clearing" << persistentPoint->passiveGrabbers;
+ }
+ for (auto g : persistentPoint->passiveGrabbers)
+ emit q->grabChanged(g, QPointingDevice::UngrabPassive, event, point);
+ persistentPoint->passiveGrabbers.clear();
+ persistentPoint->passiveGrabbersContext.clear();
+}
+
+/*!
+ \internal
+ Removes the given \a grabber as both passive and exclusive grabber from all
+ points in activePoints where it's currently found. If \a cancel is \c true,
+ the transition emitted from the grabChanged() signal will be
+ \c CancelGrabExclusive or \c CancelGrabPassive. Otherwise it will be
+ \c UngrabExclusive or \c UngrabPassive.
+
+ \note This function provides a way to work around the limitation that we
+ normally change grabbers only during event delivery; but it's also more expensive.
+*/
+void QPointingDevicePrivate::removeGrabber(QObject *grabber, bool cancel)
+{
+ Q_Q(QPointingDevice);
+ for (auto ap : activePoints) {
+ auto &epd = ap.second;
+ if (epd.exclusiveGrabber.data() == grabber) {
+ qCDebug(lcPointerGrab) << name << "point" << epd.eventPoint.id() << epd.eventPoint.state()
+ << "@" << epd.eventPoint.scenePosition()
+ << ": grab" << grabber << "-> nullptr";
+ epd.exclusiveGrabber.clear();
+ epd.exclusiveGrabberContext.clear();
+ emit q->grabChanged(grabber,
+ cancel ? QPointingDevice::CancelGrabExclusive : QPointingDevice::UngrabExclusive,
+ nullptr, epd.eventPoint);
+ }
+ qsizetype pi = epd.passiveGrabbers.indexOf(grabber);
+ if (pi >= 0) {
+ qCDebug(lcPointerGrab) << name << "point" << epd.eventPoint.id() << epd.eventPoint.state()
+ << ": removing passive grabber" << grabber;
+ epd.passiveGrabbers.removeAt(pi);
+ if (epd.passiveGrabbersContext.size()) {
+ Q_ASSERT(epd.passiveGrabbersContext.size() > pi);
+ epd.passiveGrabbersContext.removeAt(pi);
+ }
+ emit q->grabChanged(grabber,
+ cancel ? QPointingDevice::CancelGrabPassive : QPointingDevice::UngrabPassive,
+ nullptr, epd.eventPoint);
+ }
+ }
+}
+
+/*!
+ \internal
+ Finds the device instance belonging to the drawing or eraser end of a particular stylus,
+ identified by its \a deviceType, \a pointerType and \a uniqueId. If an existing device
+ is not found, a new one is created and registered, with a warning.
+
+ This function is called from QWindowSystemInterface. Platform plugins should use
+ \l queryTabletDeviceInstance() to check whether a tablet stylus coming into proximity
+ is previously known; if not known, the plugin should create and register the stylus.
+*/
+const QPointingDevice *QPointingDevicePrivate::tabletDevice(QInputDevice::DeviceType deviceType,
+ QPointingDevice::PointerType pointerType,
+ QPointingDeviceUniqueId uniqueId)
+{
+ const QPointingDevice *dev = queryTabletDevice(deviceType, pointerType, uniqueId);
+ if (!dev) {
+ qCDebug(lcQpaInputDevices) << "failed to find registered tablet device"
+ << deviceType << pointerType << Qt::hex << uniqueId.numericId()
+ << "The platform plugin should have provided one via "
+ "QWindowSystemInterface::registerInputDevice(). Creating a default one for now.";
+ dev = new QPointingDevice("fake tablet"_L1, 2, deviceType, pointerType,
+ QInputDevice::Capability::Position | QInputDevice::Capability::Pressure,
+ 1, 1, QString(), uniqueId, QCoreApplication::instance());
+ QInputDevicePrivate::registerDevice(dev);
+ }
+ return dev;
+}
+
+bool QPointingDevice::operator==(const QPointingDevice &other) const
+{
+ // Wacom tablets generate separate instances for each end of each stylus;
+ // QInputDevice::operator==() says they are all the same, but we use
+ // the stylus unique serial number and pointerType to distinguish them
+ return QInputDevice::operator==(other) &&
+ pointerType() == other.pointerType() &&
+ uniqueId() == other.uniqueId();
+}
+
+#ifndef QT_NO_DEBUG_STREAM
+QDebug operator<<(QDebug debug, const QPointingDevice *device)
+{
+ QDebugStateSaver saver(debug);
+ debug.nospace();
+ debug.noquote();
+ debug << "QPointingDevice(";
+ if (device) {
+ debug << '"' << device->name() << "\" ";
+ QtDebugUtils::formatQEnum(debug, device->type());
+ debug << " id=" << device->systemId();
+ if (!device->seatName().isEmpty())
+ debug << " seat=" << device->seatName();
+ if (device->pointerType() != QPointingDevice::PointerType::Generic) {
+ debug << " ptrType=";
+ QtDebugUtils::formatQEnum(debug, device->pointerType());
+ }
+ if (int(device->capabilities()) != int(QInputDevice::Capability::Position)) {
+ debug << " caps=";
+ QtDebugUtils::formatQFlags(debug, device->capabilities());
+ }
+ if (device->maximumPoints() > 1)
+ debug << " maxPts=" << device->maximumPoints();
+ if (device->uniqueId().isValid())
+ debug << " uniqueId=" << Qt::hex << device->uniqueId().numericId() << Qt::dec;
+ } else {
+ debug << '0';
+ }
+ debug << ')';
+ return debug;
+}
+#endif // !QT_NO_DEBUG_STREAM
+
+/*!
+ \class QPointingDeviceUniqueId
+ \since 5.8
+ \ingroup events
+ \inmodule QtGui
+
+ \brief QPointingDeviceUniqueId identifies a unique object, such as a tagged token
+ or stylus, which is used with a pointing device.
+
+ QPointingDeviceUniqueIds can be compared for equality, and can be used as keys in a QHash.
+ You get access to the numerical ID via numericId(), if the device supports such IDs.
+ For future extensions, though, you should not use that function, but compare objects
+ of this type using the equality operator.
+
+ This class is a thin wrapper around an integer ID. You pass it into and out of
+ functions by value.
+
+ \sa QEventPoint
+*/
+
+/*!
+ \fn QPointingDeviceUniqueId::QPointingDeviceUniqueId()
+ Constructs an invalid unique pointer ID.
+*/
+
+/*!
+ Constructs a unique pointer ID from numeric ID \a id.
+*/
+QPointingDeviceUniqueId QPointingDeviceUniqueId::fromNumericId(qint64 id)
+{
+ QPointingDeviceUniqueId result;
+ result.m_numericId = id;
+ return result;
+}
+
+/*!
+ \fn bool QPointingDeviceUniqueId::isValid() const
+
+ Returns whether this unique pointer ID is valid, that is, it represents an actual
+ pointer.
+*/
+
+/*!
+ \property QPointingDeviceUniqueId::numericId
+ \brief the numeric unique ID of the token represented by a touchpoint
+
+ If the device provides a numeric ID, isValid() returns true, and this
+ property provides the numeric ID;
+ otherwise it is -1.
+
+ You should not use the value of this property in portable code, but
+ instead rely on equality to identify pointers.
+
+ \sa isValid()
+*/
+qint64 QPointingDeviceUniqueId::numericId() const noexcept
+{
+ return m_numericId;
+}
+
+/*!
+ \fn bool QPointingDeviceUniqueId::operator==(QPointingDeviceUniqueId lhs, QPointingDeviceUniqueId rhs)
+ \since 5.8
+
+ Returns whether the two unique pointer IDs \a lhs and \a rhs identify the same pointer
+ (\c true) or not (\c false).
+*/
+
+/*!
+ \fn bool QPointingDeviceUniqueId::operator!=(QPointingDeviceUniqueId lhs, QPointingDeviceUniqueId rhs)
+ \since 5.8
+
+ Returns whether the two unique pointer IDs \a lhs and \a rhs identify different pointers
+ (\c true) or not (\c false).
+*/
+
+/*!
+ \relates QPointingDeviceUniqueId
+ \since 5.8
+
+ Returns the hash value for \a key, using \a seed to seed the calculation.
+*/
+size_t qHash(QPointingDeviceUniqueId key, size_t seed) noexcept
+{
+ return qHash(key.numericId(), seed);
+}
+
+QT_END_NAMESPACE
+
+#include "moc_qpointingdevice.cpp"
diff --git a/src/gui/kernel/qpointingdevice.h b/src/gui/kernel/qpointingdevice.h
new file mode 100644
index 0000000000..b8e6460af7
--- /dev/null
+++ b/src/gui/kernel/qpointingdevice.h
@@ -0,0 +1,134 @@
+// Copyright (C) 2020 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
+
+#ifndef QPOINTINGDEVICE_H
+#define QPOINTINGDEVICE_H
+
+#include <QtGui/qtguiglobal.h>
+#include <QtCore/qobject.h>
+#include <QtGui/qinputdevice.h>
+
+QT_BEGIN_NAMESPACE
+
+class QDebug;
+class QEventPoint;
+class QPointerEvent;
+class QPointingDevicePrivate;
+class QPointerEvent;
+class QScreen;
+
+class Q_GUI_EXPORT QPointingDeviceUniqueId
+{
+ Q_GADGET
+ Q_PROPERTY(qint64 numericId READ numericId CONSTANT)
+public:
+ Q_ALWAYS_INLINE
+ constexpr QPointingDeviceUniqueId() noexcept : m_numericId(-1) {}
+ // compiler-generated copy/move ctor/assignment operators are ok!
+ // compiler-generated dtor is ok!
+
+ static QPointingDeviceUniqueId fromNumericId(qint64 id);
+
+ Q_ALWAYS_INLINE constexpr bool isValid() const noexcept { return m_numericId != -1; }
+ qint64 numericId() const noexcept;
+
+private:
+ friend bool operator==(QPointingDeviceUniqueId lhs, QPointingDeviceUniqueId rhs) noexcept
+ { return lhs.numericId() == rhs.numericId(); }
+ friend bool operator!=(QPointingDeviceUniqueId lhs, QPointingDeviceUniqueId rhs) noexcept
+ { return lhs.numericId() != rhs.numericId(); }
+
+ // TODO: for TUIO 2, or any other type of complex token ID, an internal
+ // array (or hash) can be added to hold additional properties.
+ // In this case, m_numericId will then turn into an index into that array (or hash).
+ qint64 m_numericId;
+};
+Q_DECLARE_TYPEINFO(QPointingDeviceUniqueId, Q_RELOCATABLE_TYPE);
+
+Q_GUI_EXPORT size_t qHash(QPointingDeviceUniqueId key, size_t seed = 0) noexcept;
+
+class Q_GUI_EXPORT QPointingDevice : public QInputDevice
+{
+ Q_OBJECT
+ Q_DECLARE_PRIVATE(QPointingDevice)
+ Q_PROPERTY(PointerType pointerType READ pointerType CONSTANT)
+ Q_PROPERTY(int maximumPoints READ maximumPoints CONSTANT)
+ Q_PROPERTY(int buttonCount READ buttonCount CONSTANT)
+ Q_PROPERTY(QPointingDeviceUniqueId uniqueId READ uniqueId CONSTANT)
+
+public:
+ enum class PointerType {
+ Unknown = 0,
+ Generic = 0x0001, // mouse or similar
+ Finger = 0x0002, // touchscreen or pad
+ Pen = 0x0004, // stylus on a tablet
+ Eraser = 0x0008, // eraser end of a stylus
+ Cursor = 0x0010, // digitizer with crosshairs
+ AllPointerTypes = 0x7FFF
+ };
+ Q_DECLARE_FLAGS(PointerTypes, PointerType)
+ Q_FLAG(PointerTypes)
+
+ enum GrabTransition {
+ GrabPassive = 0x01,
+ UngrabPassive = 0x02,
+ CancelGrabPassive = 0x03,
+ OverrideGrabPassive = 0x04,
+ GrabExclusive = 0x10,
+ UngrabExclusive = 0x20,
+ CancelGrabExclusive = 0x30,
+ };
+ Q_ENUM(GrabTransition)
+
+ QPointingDevice(QObject *parent = nullptr);
+ ~QPointingDevice();
+ QPointingDevice(const QString &name, qint64 systemId, QInputDevice::DeviceType devType,
+ PointerType pType, Capabilities caps, int maxPoints, int buttonCount,
+ const QString &seatName = QString(),
+ QPointingDeviceUniqueId uniqueId = QPointingDeviceUniqueId(),
+ QObject *parent = nullptr);
+
+#if QT_DEPRECATED_SINCE(6, 0)
+ QT_DEPRECATED_VERSION_X_6_0("Use the constructor")
+ void setType(DeviceType devType);
+ QT_DEPRECATED_VERSION_X_6_0("Use the constructor")
+ void setCapabilities(QInputDevice::Capabilities caps);
+ QT_DEPRECATED_VERSION_X_6_0("Use the constructor")
+ void setMaximumTouchPoints(int c);
+#endif
+
+ PointerType pointerType() const;
+ int maximumPoints() const;
+ int buttonCount() const;
+ QPointingDeviceUniqueId uniqueId() const;
+
+ static const QPointingDevice *primaryPointingDevice(const QString& seatName = QString());
+
+ bool operator==(const QPointingDevice &other) const;
+
+Q_SIGNALS:
+#if QT_VERSION < QT_VERSION_CHECK(7, 0, 0)
+ void grabChanged(QObject *grabber, GrabTransition transition,
+ const QPointerEvent *event, const QEventPoint &point) const;
+#else
+ void grabChanged(QObject *grabber, QPointingDevice::GrabTransition transition,
+ const QPointerEvent *event, const QEventPoint &point);
+#endif
+
+protected:
+ QPointingDevice(QPointingDevicePrivate &d, QObject *parent);
+
+ Q_DISABLE_COPY_MOVE(QPointingDevice)
+};
+
+Q_DECLARE_OPERATORS_FOR_FLAGS(QPointingDevice::PointerTypes)
+
+#ifndef QT_NO_DEBUG_STREAM
+Q_GUI_EXPORT QDebug operator<<(QDebug, const QPointingDevice *);
+#endif
+
+//typedef QPointingDevice QTouchDevice; // Qt 5 source compatibility if we need it? or could be "using"
+
+QT_END_NAMESPACE
+
+#endif // QPOINTINGDEVICE_H
diff --git a/src/gui/kernel/qpointingdevice_p.h b/src/gui/kernel/qpointingdevice_p.h
new file mode 100644
index 0000000000..b2f0574e9b
--- /dev/null
+++ b/src/gui/kernel/qpointingdevice_p.h
@@ -0,0 +1,112 @@
+// Copyright (C) 2020 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
+
+#ifndef QPOINTINGDEVICE_P_H
+#define QPOINTINGDEVICE_P_H
+
+//
+// W A R N I N G
+// -------------
+//
+// This file is not part of the Qt API. It exists purely as an
+// implementation detail. This header file may change from version to
+// version without notice, or even be removed.
+//
+// We mean it.
+//
+
+#include <QtCore/qloggingcategory.h>
+#include <QtGui/private/qevent_p.h>
+#include <QtGui/qpointingdevice.h>
+#include <QtGui/private/qtguiglobal_p.h>
+#include <QtGui/private/qinputdevice_p.h>
+
+#include <QtCore/qpointer.h>
+#include <QtCore/private/qflatmap_p.h>
+
+QT_BEGIN_NAMESPACE
+
+Q_DECLARE_LOGGING_CATEGORY(lcPointerGrab);
+
+class Q_GUI_EXPORT QPointingDevicePrivate : public QInputDevicePrivate
+{
+ Q_DECLARE_PUBLIC(QPointingDevice)
+public:
+ QPointingDevicePrivate(const QString &name, qint64 id, QInputDevice::DeviceType type,
+ QPointingDevice::PointerType pType, QPointingDevice::Capabilities caps,
+ int maxPoints, int buttonCount,
+ const QString &seatName = QString(),
+ QPointingDeviceUniqueId uniqueId = QPointingDeviceUniqueId())
+ : QInputDevicePrivate(name, id, type, caps, seatName),
+ uniqueId(uniqueId),
+ maximumTouchPoints(qint8(maxPoints)), buttonCount(qint8(buttonCount)),
+ pointerType(pType)
+ {
+ pointingDeviceType = true;
+ activePoints.reserve(maxPoints);
+ }
+ ~QPointingDevicePrivate() override;
+
+ void sendTouchCancelEvent(QTouchEvent *cancelEvent);
+
+ /*! \internal
+ This struct (stored in activePoints) holds persistent state between event deliveries.
+ */
+ struct EventPointData {
+ QEventPoint eventPoint;
+ QPointer<QObject> exclusiveGrabber;
+ QPointer<QObject> exclusiveGrabberContext; // extra info about where the grab happened
+ QList<QPointer <QObject> > passiveGrabbers;
+ QList<QPointer <QObject> > passiveGrabbersContext; // parallel list: extra info about where the grabs happened
+ };
+ EventPointData *queryPointById(int id) const;
+ EventPointData *pointById(int id) const;
+ void removePointById(int id);
+ QObject *firstActiveTarget() const;
+ QWindow *firstActiveWindow() const;
+
+ QObject *firstPointExclusiveGrabber() const;
+ void setExclusiveGrabber(const QPointerEvent *event, const QEventPoint &point, QObject *exclusiveGrabber);
+ bool removeExclusiveGrabber(const QPointerEvent *event, const QObject *grabber);
+ bool addPassiveGrabber(const QPointerEvent *event, const QEventPoint &point, QObject *grabber);
+ static bool setPassiveGrabberContext(EventPointData *epd, QObject *grabber, QObject *context);
+ bool removePassiveGrabber(const QPointerEvent *event, const QEventPoint &point, QObject *grabber);
+ void clearPassiveGrabbers(const QPointerEvent *event, const QEventPoint &point);
+ void removeGrabber(QObject *grabber, bool cancel = false);
+
+ using EventPointMap = QVarLengthFlatMap<int, EventPointData, 20>;
+ mutable EventPointMap activePoints;
+
+ QPointingDeviceUniqueId uniqueId;
+ quint32 toolId = 0; // only for Wacom tablets
+ qint8 maximumTouchPoints = 0;
+ qint8 buttonCount = 0;
+ QPointingDevice::PointerType pointerType = QPointingDevice::PointerType::Unknown;
+ bool toolProximity = false; // only for Wacom tablets
+
+ inline static QPointingDevicePrivate *get(QPointingDevice *q)
+ {
+ return static_cast<QPointingDevicePrivate *>(QObjectPrivate::get(q));
+ }
+
+ inline static const QPointingDevicePrivate *get(const QPointingDevice *q)
+ {
+ return static_cast<const QPointingDevicePrivate *>(QObjectPrivate::get(q));
+ }
+
+ static const QPointingDevice *tabletDevice(QInputDevice::DeviceType deviceType,
+ QPointingDevice::PointerType pointerType,
+ QPointingDeviceUniqueId uniqueId);
+
+ static const QPointingDevice *queryTabletDevice(QInputDevice::DeviceType deviceType,
+ QPointingDevice::PointerType pointerType,
+ QPointingDeviceUniqueId uniqueId,
+ QInputDevice::Capabilities capabilities = QInputDevice::Capability::None,
+ qint64 systemId = 0);
+
+ static const QPointingDevice *pointingDeviceById(qint64 systemId);
+};
+
+QT_END_NAMESPACE
+
+#endif // QPOINTINGDEVICE_P_H
diff --git a/src/gui/kernel/qrasterwindow.cpp b/src/gui/kernel/qrasterwindow.cpp
index 70d87347c3..f292344ca1 100644
--- a/src/gui/kernel/qrasterwindow.cpp
+++ b/src/gui/kernel/qrasterwindow.cpp
@@ -1,41 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the QtGui module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#include "qrasterwindow.h"
@@ -70,14 +34,20 @@ class QRasterWindowPrivate : public QPaintDeviceWindowPrivate
{
Q_DECLARE_PUBLIC(QRasterWindow)
public:
+ void handleResizeEvent() override
+ {
+ Q_Q(QRasterWindow);
+ if (backingstore->size() != q->size())
+ markWindowAsDirty();
+ }
+
void beginPaint(const QRegion &region) override
{
Q_Q(QRasterWindow);
const QSize size = q->size();
- if (backingstore->size() != size) {
+ if (backingstore->size() != size)
backingstore->resize(size);
- markWindowAsDirty();
- }
+
backingstore->beginPaint(region);
}
@@ -138,4 +108,10 @@ QPaintDevice *QRasterWindow::redirected(QPoint *) const
return d->backingstore->paintDevice();
}
+void QRasterWindow::resizeEvent(QResizeEvent *)
+{
+}
+
QT_END_NAMESPACE
+
+#include "moc_qrasterwindow.cpp"
diff --git a/src/gui/kernel/qrasterwindow.h b/src/gui/kernel/qrasterwindow.h
index 9fe01c076b..986bf6b511 100644
--- a/src/gui/kernel/qrasterwindow.h
+++ b/src/gui/kernel/qrasterwindow.h
@@ -1,41 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the QtGui module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#ifndef QRASTERWINDOW_H
#define QRASTERWINDOW_H
@@ -59,6 +23,7 @@ public:
protected:
int metric(PaintDeviceMetric metric) const override;
QPaintDevice *redirected(QPoint *) const override;
+ void resizeEvent(QResizeEvent *event) override;
private:
Q_DISABLE_COPY(QRasterWindow)
diff --git a/src/gui/kernel/qscreen.cpp b/src/gui/kernel/qscreen.cpp
index 9de59f8c7e..83641e7676 100644
--- a/src/gui/kernel/qscreen.cpp
+++ b/src/gui/kernel/qscreen.cpp
@@ -1,41 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the QtGui module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#include "qscreen.h"
#include "qscreen_p.h"
@@ -67,88 +31,54 @@ QT_BEGIN_NAMESPACE
desktop environment's settings panel, to let the user globally control UI
and font sizes in different applications.
+ \note Both physical and logical DPI are expressed in device-independent dots.
+ Multiply by QScreen::devicePixelRatio() to get device-dependent density.
+
\inmodule QtGui
*/
-QScreen::QScreen(QPlatformScreen *screen)
+QScreen::QScreen(QPlatformScreen *platformScreen)
: QObject(*new QScreenPrivate(), nullptr)
{
Q_D(QScreen);
- d->setPlatformScreen(screen);
-}
-void QScreenPrivate::setPlatformScreen(QPlatformScreen *screen)
-{
- Q_Q(QScreen);
- platformScreen = screen;
- platformScreen->d_func()->screen = q;
- orientation = platformScreen->orientation();
- geometry = platformScreen->deviceIndependentGeometry();
- availableGeometry = QHighDpi::fromNative(platformScreen->availableGeometry(),
- QHighDpiScaling::factor(platformScreen), geometry.topLeft());
+ d->platformScreen = platformScreen;
+ platformScreen->d_func()->screen = this;
- logicalDpi = QPlatformScreen::overrideDpi(platformScreen->logicalDpi());
-
- refreshRate = platformScreen->refreshRate();
+ d->orientation = platformScreen->orientation();
+ d->logicalDpi = QPlatformScreen::overrideDpi(platformScreen->logicalDpi());
+ d->refreshRate = platformScreen->refreshRate();
// safeguard ourselves against buggy platform behavior...
- if (refreshRate < 1.0)
- refreshRate = 60.0;
-
- updatePrimaryOrientation();
+ if (d->refreshRate < 1.0)
+ d->refreshRate = 60.0;
- filteredOrientation = orientation;
- if (filteredOrientation == Qt::PrimaryOrientation)
- filteredOrientation = primaryOrientation;
-
- updateHighDpi();
+ d->updateGeometry();
+ d->updatePrimaryOrientation(); // derived from the geometry
}
+void QScreenPrivate::updateGeometry()
+{
+ qreal scaleFactor = QHighDpiScaling::factor(platformScreen);
+ QRect nativeGeometry = platformScreen->geometry();
+ geometry = QRect(nativeGeometry.topLeft(), QHighDpi::fromNative(nativeGeometry.size(), scaleFactor));
+ availableGeometry = QHighDpi::fromNative(platformScreen->availableGeometry(), scaleFactor, geometry.topLeft());
+}
/*!
Destroys the screen.
+
+ \internal
*/
QScreen::~QScreen()
{
- // Remove screen
- const bool wasPrimary = QGuiApplication::primaryScreen() == this;
- QGuiApplicationPrivate::screen_list.removeOne(this);
- QGuiApplicationPrivate::resetCachedDevicePixelRatio();
-
- if (!qGuiApp)
- return;
-
- QScreen *newPrimaryScreen = QGuiApplication::primaryScreen();
- if (wasPrimary && newPrimaryScreen)
- emit qGuiApp->primaryScreenChanged(newPrimaryScreen);
-
- // Allow clients to manage windows that are affected by the screen going
- // away, before we fall back to moving them to the primary screen.
- emit qApp->screenRemoved(this);
-
- if (QGuiApplication::closingDown())
- return;
-
- bool movingFromVirtualSibling = newPrimaryScreen
- && newPrimaryScreen->handle()->virtualSiblings().contains(handle());
-
- // Move any leftover windows to the primary screen
- const auto allWindows = QGuiApplication::allWindows();
- for (QWindow *window : allWindows) {
- if (!window->isTopLevel() || window->screen() != this)
- continue;
-
- const bool wasVisible = window->isVisible();
- window->setScreen(newPrimaryScreen);
-
- // Re-show window if moved from a virtual sibling screen. Otherwise
- // leave it up to the application developer to show the window.
- if (movingFromVirtualSibling)
- window->setVisible(wasVisible);
- }
+ Q_ASSERT_X(!QGuiApplicationPrivate::screen_list.contains(this), "QScreen",
+ "QScreens should be removed via QWindowSystemInterface::handleScreenRemoved()");
}
/*!
Get the platform screen handle.
+
+ \sa {Qt Platform Abstraction}{Qt Platform Abstraction (QPA)}
*/
QPlatformScreen *QScreen::handle() const
{
@@ -162,6 +92,10 @@ QPlatformScreen *QScreen::handle() const
For example, on X11 these correspond to the XRandr screen names,
typically "VGA1", "HDMI1", etc.
+
+ \note The user presentable string is not guaranteed to match the
+ result of any native APIs, and should not be used to uniquely identify
+ a screen.
*/
QString QScreen::name() const
{
@@ -233,6 +167,9 @@ QSize QScreen::size() const
Depending on what information the underlying system provides the value might not be
entirely accurate.
+ \note Physical DPI is expressed in device-independent dots. Multiply by QScreen::devicePixelRatio()
+ to get device-dependent density.
+
\sa physicalDotsPerInchY()
*/
qreal QScreen::physicalDotsPerInchX() const
@@ -248,6 +185,9 @@ qreal QScreen::physicalDotsPerInchX() const
Depending on what information the underlying system provides the value might not be
entirely accurate.
+ \note Physical DPI is expressed in device-independent dots. Multiply by QScreen::devicePixelRatio()
+ to get device-dependent density.
+
\sa physicalDotsPerInchX()
*/
qreal QScreen::physicalDotsPerInchY() const
@@ -266,6 +206,9 @@ qreal QScreen::physicalDotsPerInchY() const
This is a convenience property that's simply the average of the physicalDotsPerInchX
and physicalDotsPerInchY properties.
+ \note Physical DPI is expressed in device-independent dots. Multiply by QScreen::devicePixelRatio()
+ to get device-dependent density.
+
\sa physicalDotsPerInchX()
\sa physicalDotsPerInchY()
*/
@@ -416,9 +359,12 @@ QList<QScreen *> QScreen::virtualSiblings() const
Q_D(const QScreen);
const QList<QPlatformScreen *> platformScreens = d->platformScreen->virtualSiblings();
QList<QScreen *> screens;
- screens.reserve(platformScreens.count());
- for (QPlatformScreen *platformScreen : platformScreens)
- screens << platformScreen->screen();
+ screens.reserve(platformScreens.size());
+ for (QPlatformScreen *platformScreen : platformScreens) {
+ // Only consider platform screens that have been added
+ if (auto *knownScreen = platformScreen->screen())
+ screens << knownScreen;
+ }
return screens;
}
@@ -491,62 +437,34 @@ QRect QScreen::availableVirtualGeometry() const
}
/*!
- Sets the orientations that the application is interested in receiving
- updates for in conjunction with this screen.
-
- For example, to receive orientation() updates and thus have
- orientationChanged() signals being emitted for LandscapeOrientation and
- InvertedLandscapeOrientation, call setOrientationUpdateMask() with
- \a{mask} set to Qt::LandscapeOrientation | Qt::InvertedLandscapeOrientation.
-
- The default, 0, means no orientationChanged() signals are fired.
-*/
-void QScreen::setOrientationUpdateMask(Qt::ScreenOrientations mask)
-{
- Q_D(QScreen);
- d->orientationUpdateMask = mask;
- d->platformScreen->setOrientationUpdateMask(mask);
- QGuiApplicationPrivate::updateFilteredScreenOrientation(this);
-}
-
-/*!
- Returns the currently set orientation update mask.
-
- \sa setOrientationUpdateMask()
-*/
-Qt::ScreenOrientations QScreen::orientationUpdateMask() const
-{
- Q_D(const QScreen);
- return d->orientationUpdateMask;
-}
-
-/*!
\property QScreen::orientation
\brief the screen orientation
- The screen orientation represents the physical orientation
- of the display. For example, the screen orientation of a mobile device
- will change based on how it is being held. A change to the orientation
- might or might not trigger a change to the primary orientation of the screen.
+ The \c orientation property tells the orientation of the screen from the
+ window system perspective.
- Changes to this property will be filtered by orientationUpdateMask(),
- so in order to receive orientation updates the application must first
- call setOrientationUpdateMask() with a mask of the orientations it wants
- to receive.
+ Most mobile devices and tablet computers contain accelerometer sensors.
+ The Qt Sensors module provides the ability to read this sensor directly.
+ However, the windowing system may rotate the entire screen automatically
+ based on how it is being held; in that case, this \c orientation property
+ will change.
- Qt::PrimaryOrientation is never returned.
-
- \sa primaryOrientation()
+ \sa primaryOrientation(), QWindow::contentOrientation()
*/
Qt::ScreenOrientation QScreen::orientation() const
{
Q_D(const QScreen);
- return d->filteredOrientation;
+ return d->orientation;
}
/*!
\property QScreen::refreshRate
\brief the approximate vertical refresh rate of the screen in Hz
+
+ \warning Avoid using the screen's refresh rate to drive animations via a
+ timer such as QChronoTimer. Instead use QWindow::requestUpdate().
+
+ \sa QWindow::requestUpdate()
*/
qreal QScreen::refreshRate() const
{
@@ -708,7 +626,7 @@ void QScreenPrivate::updatePrimaryOrientation()
\since 5.15
*/
-QScreen *QScreen::virtualSiblingAt(const QPoint &point)
+QScreen *QScreen::virtualSiblingAt(QPoint point)
{
const auto &siblings = virtualSiblings();
for (QScreen *sibling : siblings) {
@@ -721,10 +639,11 @@ QScreen *QScreen::virtualSiblingAt(const QPoint &point)
/*!
Creates and returns a pixmap constructed by grabbing the contents
of the given \a window restricted by QRect(\a x, \a y, \a width,
- \a height).
+ \a height). If \a window is 0, then the entire screen will be
+ grabbed.
The arguments (\a{x}, \a{y}) specify the offset in the window,
- whereas (\a{width}, \a{height}) specify the area to be copied. If
+ whereas (\a{width}, \a{height}) specify the area to be copied. If
\a width is negative, the function copies everything to the right
border of the window. If \a height is negative, the function
copies everything to the bottom of the window.
@@ -785,14 +704,57 @@ QPixmap QScreen::grabWindow(WId window, int x, int y, int width, int height)
return result;
}
-#ifndef QT_NO_DEBUG_STREAM
+/*!
+ \fn template <typename QNativeInterface> QNativeInterface *QScreen::nativeInterface() const
+
+ Returns a native interface of the given type for the screen.
+
+ This function provides access to platform specific functionality
+ of QScreen, as defined in the QNativeInterface namespace:
-static inline void formatRect(QDebug &debug, const QRect r)
+ \annotatedlist native-interfaces-qscreen
+
+ If the requested interface is not available a \nullptr is returned.
+ */
+
+void *QScreen::resolveInterface(const char *name, int revision) const
{
- debug << r.width() << 'x' << r.height()
- << Qt::forcesign << r.x() << r.y() << Qt::noforcesign;
+ using namespace QNativeInterface;
+ using namespace QNativeInterface::Private;
+
+ auto *platformScreen = handle();
+ Q_UNUSED(platformScreen);
+ Q_UNUSED(name);
+ Q_UNUSED(revision);
+
+#if QT_CONFIG(xcb)
+ QT_NATIVE_INTERFACE_RETURN_IF(QXcbScreen, platformScreen);
+#endif
+
+#if QT_CONFIG(vsp2)
+ QT_NATIVE_INTERFACE_RETURN_IF(QVsp2Screen, platformScreen);
+#endif
+
+#if defined(Q_OS_WEBOS)
+ QT_NATIVE_INTERFACE_RETURN_IF(QWebOSScreen, platformScreen);
+#endif
+
+#if defined(Q_OS_WIN32)
+ QT_NATIVE_INTERFACE_RETURN_IF(QWindowsScreen, platformScreen);
+#endif
+
+#if defined(Q_OS_ANDROID)
+ QT_NATIVE_INTERFACE_RETURN_IF(QAndroidScreen, platformScreen);
+#endif
+
+#if QT_CONFIG(wayland)
+ QT_NATIVE_INTERFACE_RETURN_IF(QWaylandScreen, platformScreen);
+#endif
+
+ return nullptr;
}
+#ifndef QT_NO_DEBUG_STREAM
Q_GUI_EXPORT QDebug operator<<(QDebug debug, const QScreen *screen)
{
const QDebugStateSaver saver(debug);
@@ -803,10 +765,8 @@ Q_GUI_EXPORT QDebug operator<<(QDebug debug, const QScreen *screen)
if (debug.verbosity() > 2) {
if (screen == QGuiApplication::primaryScreen())
debug << ", primary";
- debug << ", geometry=";
- formatRect(debug, screen->geometry());
- debug << ", available=";
- formatRect(debug, screen->availableGeometry());
+ debug << ", geometry=" << screen->geometry();
+ debug << ", available=" << screen->availableGeometry();
debug << ", logical DPI=" << screen->logicalDotsPerInchX()
<< ',' << screen->logicalDotsPerInchY()
<< ", physical DPI=" << screen->physicalDotsPerInchX()
@@ -822,4 +782,60 @@ Q_GUI_EXPORT QDebug operator<<(QDebug debug, const QScreen *screen)
}
#endif // !QT_NO_DEBUG_STREAM
+QScreenPrivate::UpdateEmitter::UpdateEmitter(QScreen *screen)
+{
+ initialState.platformScreen = screen->handle();
+
+ // Use public APIs to read out current state, rather
+ // than accessing the QScreenPrivate members, so that
+ // we detect any changes to the high-DPI scale factors
+ // that may be applied in the getters.
+
+ initialState.logicalDpi = QDpi{
+ screen->logicalDotsPerInchX(),
+ screen->logicalDotsPerInchY()
+ };
+ initialState.geometry = screen->geometry();
+ initialState.availableGeometry = screen->availableGeometry();
+ initialState.primaryOrientation = screen->primaryOrientation();
+}
+
+QScreenPrivate::UpdateEmitter::~UpdateEmitter()
+{
+ QScreen *screen = initialState.platformScreen->screen();
+
+ const auto logicalDotsPerInch = QDpi{
+ screen->logicalDotsPerInchX(),
+ screen->logicalDotsPerInchY()
+ };
+ if (logicalDotsPerInch != initialState.logicalDpi)
+ emit screen->logicalDotsPerInchChanged(screen->logicalDotsPerInch());
+
+ const auto geometry = screen->geometry();
+ const auto geometryChanged = geometry != initialState.geometry;
+ if (geometryChanged)
+ emit screen->geometryChanged(geometry);
+
+ const auto availableGeometry = screen->availableGeometry();
+ const auto availableGeometryChanged = availableGeometry != initialState.availableGeometry;
+ if (availableGeometryChanged)
+ emit screen->availableGeometryChanged(availableGeometry);
+
+ if (geometryChanged || availableGeometryChanged) {
+ const auto siblings = screen->virtualSiblings();
+ for (QScreen* sibling : siblings)
+ emit sibling->virtualGeometryChanged(sibling->virtualGeometry());
+ }
+
+ if (geometryChanged) {
+ emit screen->physicalDotsPerInchChanged(screen->physicalDotsPerInch());
+
+ const auto primaryOrientation = screen->primaryOrientation();
+ if (primaryOrientation != initialState.primaryOrientation)
+ emit screen->primaryOrientationChanged(primaryOrientation);
+ }
+}
+
QT_END_NAMESPACE
+
+#include "moc_qscreen.cpp"
diff --git a/src/gui/kernel/qscreen.h b/src/gui/kernel/qscreen.h
index 88925ab731..9442e7525b 100644
--- a/src/gui/kernel/qscreen.h
+++ b/src/gui/kernel/qscreen.h
@@ -1,41 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the QtGui module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#ifndef QSCREEN_H
#define QSCREEN_H
@@ -50,6 +14,7 @@
#include <QtGui/QTransform>
#include <QtCore/qnamespace.h>
+#include <QtCore/qnativeinterface.h>
QT_BEGIN_NAMESPACE
@@ -80,16 +45,20 @@ class Q_GUI_EXPORT QScreen : public QObject
Q_PROPERTY(QRect geometry READ geometry NOTIFY geometryChanged)
Q_PROPERTY(QRect availableGeometry READ availableGeometry NOTIFY availableGeometryChanged)
Q_PROPERTY(QRect virtualGeometry READ virtualGeometry NOTIFY virtualGeometryChanged)
- Q_PROPERTY(QRect availableVirtualGeometry READ availableVirtualGeometry NOTIFY virtualGeometryChanged)
+ Q_PROPERTY(QRect availableVirtualGeometry READ availableVirtualGeometry
+ NOTIFY virtualGeometryChanged)
Q_PROPERTY(QSizeF physicalSize READ physicalSize NOTIFY physicalSizeChanged)
- Q_PROPERTY(qreal physicalDotsPerInchX READ physicalDotsPerInchX NOTIFY physicalDotsPerInchChanged)
- Q_PROPERTY(qreal physicalDotsPerInchY READ physicalDotsPerInchY NOTIFY physicalDotsPerInchChanged)
+ Q_PROPERTY(qreal physicalDotsPerInchX READ physicalDotsPerInchX
+ NOTIFY physicalDotsPerInchChanged)
+ Q_PROPERTY(qreal physicalDotsPerInchY READ physicalDotsPerInchY
+ NOTIFY physicalDotsPerInchChanged)
Q_PROPERTY(qreal physicalDotsPerInch READ physicalDotsPerInch NOTIFY physicalDotsPerInchChanged)
Q_PROPERTY(qreal logicalDotsPerInchX READ logicalDotsPerInchX NOTIFY logicalDotsPerInchChanged)
Q_PROPERTY(qreal logicalDotsPerInchY READ logicalDotsPerInchY NOTIFY logicalDotsPerInchChanged)
Q_PROPERTY(qreal logicalDotsPerInch READ logicalDotsPerInch NOTIFY logicalDotsPerInchChanged)
Q_PROPERTY(qreal devicePixelRatio READ devicePixelRatio NOTIFY physicalDotsPerInchChanged)
- Q_PROPERTY(Qt::ScreenOrientation primaryOrientation READ primaryOrientation NOTIFY primaryOrientationChanged)
+ Q_PROPERTY(Qt::ScreenOrientation primaryOrientation READ primaryOrientation
+ NOTIFY primaryOrientationChanged)
Q_PROPERTY(Qt::ScreenOrientation orientation READ orientation NOTIFY orientationChanged)
Q_PROPERTY(Qt::ScreenOrientation nativeOrientation READ nativeOrientation)
Q_PROPERTY(qreal refreshRate READ refreshRate NOTIFY refreshRateChanged)
@@ -125,7 +94,7 @@ public:
QRect availableGeometry() const;
QList<QScreen *> virtualSiblings() const;
- QScreen *virtualSiblingAt(const QPoint &point);
+ QScreen *virtualSiblingAt(QPoint point);
QSize virtualSize() const;
QRect virtualGeometry() const;
@@ -137,9 +106,6 @@ public:
Qt::ScreenOrientation orientation() const;
Qt::ScreenOrientation nativeOrientation() const;
- Qt::ScreenOrientations orientationUpdateMask() const;
- void setOrientationUpdateMask(Qt::ScreenOrientations mask);
-
int angleBetween(Qt::ScreenOrientation a, Qt::ScreenOrientation b) const;
QTransform transformBetween(Qt::ScreenOrientation a, Qt::ScreenOrientation b, const QRect &target) const;
QRect mapBetween(Qt::ScreenOrientation a, Qt::ScreenOrientation b, const QRect &rect) const;
@@ -147,10 +113,12 @@ public:
bool isPortrait(Qt::ScreenOrientation orientation) const;
bool isLandscape(Qt::ScreenOrientation orientation) const;
- QPixmap grabWindow(WId window, int x = 0, int y = 0, int w = -1, int h = -1);
+ QPixmap grabWindow(WId window = 0, int x = 0, int y = 0, int w = -1, int h = -1);
qreal refreshRate() const;
+ QT_DECLARE_NATIVE_INTERFACE_ACCESSOR(QScreen)
+
Q_SIGNALS:
void geometryChanged(const QRect &geometry);
void availableGeometryChanged(const QRect &geometry);
@@ -179,5 +147,7 @@ Q_GUI_EXPORT QDebug operator<<(QDebug, const QScreen *);
QT_END_NAMESPACE
+#include <QtGui/qscreen_platform.h>
+
#endif // QSCREEN_H
diff --git a/src/gui/kernel/qscreen_p.h b/src/gui/kernel/qscreen_p.h
index e5988ff829..964bc1cc58 100644
--- a/src/gui/kernel/qscreen_p.h
+++ b/src/gui/kernel/qscreen_p.h
@@ -1,41 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the QtGui module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#ifndef QSCREEN_P_H
#define QSCREEN_P_H
@@ -60,24 +24,11 @@
QT_BEGIN_NAMESPACE
-class QScreenPrivate : public QObjectPrivate
+struct QScreenData
{
- Q_DECLARE_PUBLIC(QScreen)
-public:
- void setPlatformScreen(QPlatformScreen *screen);
- void updateHighDpi()
- {
- geometry = platformScreen->deviceIndependentGeometry();
- availableGeometry = QHighDpi::fromNative(platformScreen->availableGeometry(), QHighDpiScaling::factor(platformScreen), geometry.topLeft());
- }
-
- void updatePrimaryOrientation();
-
QPlatformScreen *platformScreen = nullptr;
- Qt::ScreenOrientations orientationUpdateMask;
Qt::ScreenOrientation orientation = Qt::PrimaryOrientation;
- Qt::ScreenOrientation filteredOrientation = Qt::PrimaryOrientation;
Qt::ScreenOrientation primaryOrientation = Qt::LandscapeOrientation;
QRect geometry;
QRect availableGeometry;
@@ -85,6 +36,25 @@ public:
qreal refreshRate = 60;
};
+class QScreenPrivate : public QObjectPrivate, public QScreenData
+{
+ Q_DECLARE_PUBLIC(QScreen)
+public:
+ void updateGeometry();
+ void updatePrimaryOrientation();
+
+ class UpdateEmitter
+ {
+ public:
+ explicit UpdateEmitter(QScreen *screen);
+ ~UpdateEmitter();
+ UpdateEmitter(UpdateEmitter&&) noexcept = default;
+ private:
+ Q_DISABLE_COPY(UpdateEmitter)
+ QScreenData initialState;
+ };
+};
+
QT_END_NAMESPACE
#endif // QSCREEN_P_H
diff --git a/src/gui/kernel/qscreen_platform.h b/src/gui/kernel/qscreen_platform.h
new file mode 100644
index 0000000000..6f40e9273f
--- /dev/null
+++ b/src/gui/kernel/qscreen_platform.h
@@ -0,0 +1,61 @@
+// Copyright (C) 2021 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
+
+#ifndef QSCREEN_PLATFORM_H
+#define QSCREEN_PLATFORM_H
+
+//
+// W A R N I N G
+// -------------
+//
+// This file is part of the native interface APIs. Usage of
+// this API may make your code source and binary incompatible
+// with future versions of Qt.
+//
+
+#include <QtGui/qtguiglobal.h>
+
+#include <QtCore/qnativeinterface.h>
+#include <QtGui/qguiapplication.h>
+
+#if defined(Q_OS_WIN32)
+#include <QtGui/qwindowdefs_win.h>
+#endif
+
+#if QT_CONFIG(wayland)
+struct wl_output;
+#endif
+
+QT_BEGIN_NAMESPACE
+
+namespace QNativeInterface {
+
+#if defined(Q_OS_WIN32) || defined(Q_QDOC)
+struct Q_GUI_EXPORT QWindowsScreen
+{
+ QT_DECLARE_NATIVE_INTERFACE(QWindowsScreen, 1, QScreen)
+ virtual HMONITOR handle() const = 0;
+};
+#endif
+
+#if QT_CONFIG(wayland) || defined(Q_QDOC)
+struct Q_GUI_EXPORT QWaylandScreen
+{
+ QT_DECLARE_NATIVE_INTERFACE(QWaylandScreen, 1, QScreen)
+ virtual wl_output *output() const = 0;
+};
+#endif
+
+#if defined(Q_OS_ANDROID) || defined(Q_QDOC)
+struct Q_GUI_EXPORT QAndroidScreen
+{
+ QT_DECLARE_NATIVE_INTERFACE(QAndroidScreen, 1, QScreen)
+ virtual int displayId() const = 0;
+};
+#endif
+
+} // namespace QNativeInterface
+
+QT_END_NAMESPACE
+
+#endif
diff --git a/src/gui/kernel/qsessionmanager.cpp b/src/gui/kernel/qsessionmanager.cpp
index 8747e02719..0a1ff95656 100644
--- a/src/gui/kernel/qsessionmanager.cpp
+++ b/src/gui/kernel/qsessionmanager.cpp
@@ -1,41 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the QtGui module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#include <qsessionmanager.h>
#include <qguiapplication.h>
@@ -76,9 +40,6 @@ QT_BEGIN_NAMESPACE
QSessionManager object as argument. The session manager can only be
accessed in slots invoked by these signals.
- \warning If you use QSessionManager, you should disable fallback session
- management: QGuiApplication::setFallbackSessionManagementEnabled().
-
No user interaction is possible \e unless the application gets explicit
permission from the session manager. You ask for permission by calling
allowsInteraction() or, if it is really urgent, allowsErrorInteraction().
@@ -320,10 +281,6 @@ void QSessionManager::setRestartCommand(const QStringList &command)
/*!
Returns the currently set restart command.
- To iterate over the list, you can use the \l foreach pseudo-keyword:
-
- \snippet code/src_gui_kernel_qguiapplication.cpp 3
-
\sa setRestartCommand(), restartHint()
*/
QStringList QSessionManager::restartCommand() const
@@ -346,10 +303,6 @@ void QSessionManager::setDiscardCommand(const QStringList &command)
/*!
Returns the currently set discard command.
- To iterate over the list, you can use the \l foreach pseudo-keyword:
-
- \snippet code/src_gui_kernel_qguiapplication.cpp 4
-
\sa setDiscardCommand(), restartCommand(), setRestartCommand()
*/
QStringList QSessionManager::discardCommand() const
@@ -423,4 +376,6 @@ void QSessionManager::requestPhase2()
QT_END_NAMESPACE
+#include "moc_qsessionmanager.cpp"
+
#endif // QT_NO_SESSIONMANAGER
diff --git a/src/gui/kernel/qsessionmanager.h b/src/gui/kernel/qsessionmanager.h
index 21100b25d9..6015a0b378 100644
--- a/src/gui/kernel/qsessionmanager.h
+++ b/src/gui/kernel/qsessionmanager.h
@@ -1,41 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the QtGui module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#ifndef QSESSIONMANAGER_H
#define QSESSIONMANAGER_H
diff --git a/src/gui/kernel/qsessionmanager_p.h b/src/gui/kernel/qsessionmanager_p.h
index d07d9b5eb8..c98f7a5a1d 100644
--- a/src/gui/kernel/qsessionmanager_p.h
+++ b/src/gui/kernel/qsessionmanager_p.h
@@ -1,42 +1,6 @@
-/****************************************************************************
-**
-** Copyright (C) 2013 Samuel Gaist <samuel.gaist@edeltech.ch>
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the QtGui module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2013 Samuel Gaist <samuel.gaist@edeltech.ch>
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#ifndef QSESSIONMANAGER_P_H
#define QSESSIONMANAGER_P_H
@@ -63,7 +27,7 @@ QT_BEGIN_NAMESPACE
class QPlatformSessionManager;
-class QSessionManagerPrivate : public QObjectPrivate
+class Q_GUI_EXPORT QSessionManagerPrivate : public QObjectPrivate
{
public:
QSessionManagerPrivate(const QString &id,
diff --git a/src/gui/kernel/qshapedpixmapdndwindow.cpp b/src/gui/kernel/qshapedpixmapdndwindow.cpp
index 1a85a5e853..546a1a4937 100644
--- a/src/gui/kernel/qshapedpixmapdndwindow.cpp
+++ b/src/gui/kernel/qshapedpixmapdndwindow.cpp
@@ -1,41 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the QtGui module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#include "qshapedpixmapdndwindow_p.h"
@@ -56,7 +20,7 @@ QShapedPixmapWindow::QShapedPixmapWindow(QScreen *screen)
QSurfaceFormat format;
format.setAlphaBufferSize(8);
setFormat(format);
- setFlags(Qt::ToolTip | Qt::FramelessWindowHint | Qt::X11BypassWindowManagerHint
+ setFlags(Qt::FramelessWindowHint | Qt::BypassWindowManagerHint
| Qt::WindowTransparentForInput | Qt::WindowDoesNotAcceptFocus);
}
@@ -76,7 +40,7 @@ void QShapedPixmapWindow::setPixmap(const QPixmap &pixmap)
const auto pixmapDpr = m_pixmap.devicePixelRatio();
const auto winDpr = devicePixelRatio();
const auto maskSize = (QSizeF(m_pixmap.size()) * winDpr / pixmapDpr).toSize();
- platformWindow->setMask(QBitmap(mask.scaled(maskSize)));
+ platformWindow->setMask(QBitmap::fromPixmap(mask.scaled(maskSize)));
}
}
}
@@ -104,11 +68,11 @@ void QShapedPixmapWindow::updateGeometry(const QPoint &pos)
{
QSize size(1, 1);
if (!m_pixmap.isNull()) {
- size = qFuzzyCompare(m_pixmap.devicePixelRatio(), qreal(1.0))
- ? m_pixmap.size()
- : (QSizeF(m_pixmap.size()) / m_pixmap.devicePixelRatio()).toSize();
+ size = m_pixmap.deviceIndependentSize().toSize();
}
setGeometry(QRect(pos - m_hotSpot, size));
}
QT_END_NAMESPACE
+
+#include "moc_qshapedpixmapdndwindow_p.cpp"
diff --git a/src/gui/kernel/qshapedpixmapdndwindow_p.h b/src/gui/kernel/qshapedpixmapdndwindow_p.h
index 5089be7284..a2ce26a60e 100644
--- a/src/gui/kernel/qshapedpixmapdndwindow_p.h
+++ b/src/gui/kernel/qshapedpixmapdndwindow_p.h
@@ -1,41 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the QtGui module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#ifndef QSHAPEDPIXMAPDNDWINDOW_H
#define QSHAPEDPIXMAPDNDWINDOW_H
diff --git a/src/gui/kernel/qshortcut.cpp b/src/gui/kernel/qshortcut.cpp
new file mode 100644
index 0000000000..3f6822cb03
--- /dev/null
+++ b/src/gui/kernel/qshortcut.cpp
@@ -0,0 +1,580 @@
+// Copyright (C) 2019 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
+
+#include "qshortcut.h"
+#include "qshortcut_p.h"
+
+#include <qevent.h>
+#include <qguiapplication.h>
+#include <qwindow.h>
+#include <private/qguiapplication_p.h>
+#include <qpa/qplatformmenu.h>
+
+QT_BEGIN_NAMESPACE
+
+#define QAPP_CHECK(functionName) \
+ if (Q_UNLIKELY(!qApp)) { \
+ qWarning("QShortcut: Initialize QGuiApplication before calling '" functionName "'."); \
+ return; \
+ }
+
+/*!
+ \class QShortcut
+ \brief The QShortcut class is used to create keyboard shortcuts.
+
+ \ingroup events
+ \inmodule QtGui
+
+ The QShortcut class provides a way of connecting keyboard
+ shortcuts to Qt's \l{signals and slots} mechanism, so that
+ objects can be informed when a shortcut is executed. The shortcut
+ can be set up to contain all the key presses necessary to
+ describe a keyboard shortcut, including the states of modifier
+ keys such as \uicontrol Shift, \uicontrol Ctrl, and \uicontrol Alt.
+
+ \target mnemonic
+
+ In widget applications, certain widgets can use '&' in front of a character.
+ This will automatically create a mnemonic (a shortcut) for that character,
+ e.g. "E&xit" will create the shortcut \uicontrol Alt+X (use '&&'
+ to display an actual ampersand). The widget might consume and perform
+ an action on a given shortcut. On X11 the ampersand will not be
+ shown and the character will be underlined. On Windows, shortcuts
+ are normally not displayed until the user presses the \uicontrol Alt
+ key, but this is a setting the user can change. On Mac, shortcuts
+ are disabled by default. Call \l qt_set_sequence_auto_mnemonic() to
+ enable them. However, because mnemonic shortcuts do not fit in
+ with Aqua's guidelines, Qt will not show the shortcut character
+ underlined.
+
+ For applications that use menus, it may be more convenient to
+ use the convenience functions provided in the QMenu class to
+ assign keyboard shortcuts to menu items as they are created.
+ Alternatively, shortcuts may be associated with other types of
+ actions in the QAction class.
+
+ The simplest way to create a shortcut for a particular widget is
+ to construct the shortcut with a key sequence. For example:
+
+ \snippet code/src_gui_kernel_qshortcut.cpp 0
+
+ When the user types the \l{QKeySequence}{key sequence}
+ for a given shortcut, the shortcut's activated() signal is
+ emitted. (In the case of ambiguity, the activatedAmbiguously()
+ signal is emitted.) A shortcut is "listened for" by Qt's event
+ loop when the shortcut's parent widget is receiving events.
+
+ A shortcut's key sequence can be set with setKey() and retrieved
+ with key(). A shortcut can be enabled or disabled with
+ setEnabled(), and can have "What's This?" help text set with
+ setWhatsThis().
+
+ \sa QShortcutEvent, QKeySequence, QAction
+*/
+
+/*!
+ \fn void QShortcut::activated()
+
+ This signal is emitted when the user types the shortcut's key
+ sequence.
+
+ \sa activatedAmbiguously()
+*/
+
+/*!
+ \fn void QShortcut::activatedAmbiguously()
+
+ When a key sequence is being typed at the keyboard, it is said to
+ be ambiguous as long as it matches the start of more than one
+ shortcut.
+
+ When a shortcut's key sequence is completed,
+ activatedAmbiguously() is emitted if the key sequence is still
+ ambiguous (i.e., it is the start of one or more other shortcuts).
+ The activated() signal is not emitted in this case.
+
+ \sa activated()
+*/
+
+bool QShortcutPrivate::simpleContextMatcher(QObject *object, Qt::ShortcutContext context)
+{
+ auto guiShortcut = qobject_cast<QShortcut *>(object);
+ if (QGuiApplication::applicationState() != Qt::ApplicationActive || guiShortcut == nullptr)
+ return false;
+ if (context == Qt::ApplicationShortcut)
+ return true;
+ auto focusWindow = QGuiApplication::focusWindow();
+ if (!focusWindow)
+ return false;
+ auto window = qobject_cast<const QWindow *>(guiShortcut->parent());
+ if (!window)
+ return false;
+ if (focusWindow == window && focusWindow->isTopLevel())
+ return context == Qt::WindowShortcut || context == Qt::WidgetWithChildrenShortcut;
+ return focusWindow->isAncestorOf(window, QWindow::ExcludeTransients);
+}
+
+QShortcutMap::ContextMatcher QShortcutPrivate::contextMatcher() const
+{
+ return simpleContextMatcher;
+}
+
+void QShortcutPrivate::redoGrab(QShortcutMap &map)
+{
+ Q_Q(QShortcut);
+ if (Q_UNLIKELY(!parent)) {
+ qWarning("QShortcut: No window parent defined");
+ return;
+ }
+
+ for (int id : std::as_const(sc_ids))
+ map.removeShortcut(id, q);
+
+ sc_ids.clear();
+ if (sc_sequences.isEmpty())
+ return;
+ sc_ids.reserve(sc_sequences.size());
+ for (const auto &keySequence : std::as_const(sc_sequences)) {
+ if (keySequence.isEmpty())
+ continue;
+ int id = map.addShortcut(q, keySequence, sc_context, contextMatcher());
+ sc_ids.append(id);
+ if (!sc_enabled)
+ map.setShortcutEnabled(false, id, q);
+ if (!sc_autorepeat)
+ map.setShortcutAutoRepeat(false, id, q);
+ }
+}
+
+QShortcutPrivate *QGuiApplicationPrivate::createShortcutPrivate() const
+{
+ return new QShortcutPrivate;
+}
+
+/*!
+ Constructs a QShortcut object for the \a parent, which should be a
+ QWindow or a QWidget.
+
+ Since no shortcut key sequence is specified, the shortcut will not emit any
+ signals.
+
+ \sa setKey()
+*/
+QShortcut::QShortcut(QObject *parent)
+ : QObject(*QGuiApplicationPrivate::instance()->createShortcutPrivate(), parent)
+{
+ Q_ASSERT(parent != nullptr);
+}
+
+/*!
+ Constructs a QShortcut object for the \a parent, which should be a
+ QWindow or a QWidget.
+
+ The shortcut operates on its parent, listening for \l{QShortcutEvent}s that
+ match the \a key sequence. Depending on the ambiguity of the event, the
+ shortcut will call the \a member function, or the \a ambiguousMember function,
+ if the key press was in the shortcut's \a context.
+*/
+QShortcut::QShortcut(const QKeySequence &key, QObject *parent,
+ const char *member, const char *ambiguousMember,
+ Qt::ShortcutContext context)
+ : QShortcut(parent)
+{
+ Q_D(QShortcut);
+ d->sc_context = context;
+ if (!key.isEmpty()) {
+ d->sc_sequences = { key };
+ d->redoGrab(QGuiApplicationPrivate::instance()->shortcutMap);
+ }
+ if (member)
+ connect(this, SIGNAL(activated()), parent, member);
+ if (ambiguousMember)
+ connect(this, SIGNAL(activatedAmbiguously()), parent, ambiguousMember);
+}
+
+/*!
+ \since 6.0
+ Constructs a QShortcut object for the \a parent, which should be a
+ QWindow or a QWidget.
+
+ The shortcut operates on its parent, listening for \l{QShortcutEvent}s that
+ match the \a standardKey. Depending on the ambiguity of the event, the
+ shortcut will call the \a member function, or the \a ambiguousMember function,
+ if the key press was in the shortcut's \a context.
+*/
+QShortcut::QShortcut(QKeySequence::StandardKey standardKey, QObject *parent,
+ const char *member, const char *ambiguousMember,
+ Qt::ShortcutContext context)
+ : QShortcut(parent)
+{
+ Q_D(QShortcut);
+ d->sc_context = context;
+ d->sc_sequences = QKeySequence::keyBindings(standardKey);
+ d->redoGrab(QGuiApplicationPrivate::instance()->shortcutMap);
+ if (member)
+ connect(this, SIGNAL(activated()), parent, member);
+ if (ambiguousMember)
+ connect(this, SIGNAL(activatedAmbiguously()), parent, ambiguousMember);
+}
+
+
+/*!
+ \fn template<typename Functor> QShortcut::QShortcut(const QKeySequence &key, QObject *parent, Functor functor, Qt::ShortcutContext shortcutContext = Qt::WindowShortcut)
+ \since 5.15
+ \overload
+
+ This is a QShortcut convenience constructor which connects the shortcut's
+ \l{QShortcut::activated()}{activated()} signal to the \a functor.
+*/
+/*!
+ \fn template<typename Functor> QShortcut::QShortcut(const QKeySequence &key, QObject *parent, const QObject *context, Functor functor, Qt::ShortcutContext shortcutContext = Qt::WindowShortcut)
+ \since 5.15
+ \overload
+
+ This is a QShortcut convenience constructor which connects the shortcut's
+ \l{QShortcut::activated()}{activated()} signal to the \a functor.
+
+ The \a functor can be a pointer to a member function of the \a context object.
+
+ If the \a context object is destroyed, the \a functor will not be called.
+*/
+/*!
+ \fn template<typename Functor, typename FunctorAmbiguous> QShortcut::QShortcut(const QKeySequence &key, QObject *parent, const QObject *context, Functor functor, FunctorAmbiguous functorAmbiguous, Qt::ShortcutContext shortcutContext = Qt::WindowShortcut)
+ \since 5.15
+ \overload
+
+ This is a QShortcut convenience constructor which connects the shortcut's
+ \l{QShortcut::activated()}{activated()} signal to the \a functor and
+ \l{QShortcut::activatedAmbiguously()}{activatedAmbiguously()}
+ signal to the \a functorAmbiguous.
+
+ The \a functor and \a functorAmbiguous can be a pointer to a member
+ function of the \a context object.
+
+ If the \a context object is destroyed, the \a functor and
+ \a functorAmbiguous will not be called.
+*/
+/*!
+ \fn template<typename Functor, typename FunctorAmbiguous> QShortcut::QShortcut(const QKeySequence &key, QObject *parent, const QObject *context1, Functor functor, const QObject *context2, FunctorAmbiguous functorAmbiguous, Qt::ShortcutContext shortcutContext = Qt::WindowShortcut)
+ \since 5.15
+ \overload
+
+ This is a QShortcut convenience constructor which connects the shortcut's
+ \l{QShortcut::activated()}{activated()} signal to the \a functor and
+ \l{QShortcut::activatedAmbiguously()}{activatedAmbiguously()}
+ signal to the \a functorAmbiguous.
+
+ The \a functor can be a pointer to a member function of the
+ \a context1 object.
+ The \a functorAmbiguous can be a pointer to a member function of the
+ \a context2 object.
+
+ If the \a context1 object is destroyed, the \a functor will not be called.
+ If the \a context2 object is destroyed, the \a functorAmbiguous
+ will not be called.
+*/
+
+/*!
+ \fn template<typename Functor> QShortcut::QShortcut(QKeySequence::StandardKey key, QObject *parent, Functor functor, Qt::ShortcutContext shortcutContext = Qt::WindowShortcut)
+ \since 6.0
+ \overload
+
+ This is a QShortcut convenience constructor which connects the shortcut's
+ \l{QShortcut::activated()}{activated()} signal to the \a functor.
+*/
+/*!
+ \fn template<typename Functor> QShortcut::QShortcut(QKeySequence::StandardKey key, QObject *parent, const QObject *context, Functor functor, Qt::ShortcutContext shortcutContext = Qt::WindowShortcut)
+ \since 6.0
+ \overload
+
+ This is a QShortcut convenience constructor which connects the shortcut's
+ \l{QShortcut::activated()}{activated()} signal to the \a functor.
+
+ The \a functor can be a pointer to a member function of the \a context object.
+
+ If the \a context object is destroyed, the \a functor will not be called.
+*/
+/*!
+ \fn template<typename Functor, typename FunctorAmbiguous> QShortcut::QShortcut(QKeySequence::StandardKey key, QObject *parent, const QObject *context, Functor functor, FunctorAmbiguous functorAmbiguous, Qt::ShortcutContext shortcutContext = Qt::WindowShortcut)
+ \since 6.0
+ \overload
+
+ This is a QShortcut convenience constructor which connects the shortcut's
+ \l{QShortcut::activated()}{activated()} signal to the \a functor and
+ \l{QShortcut::activatedAmbiguously()}{activatedAmbiguously()}
+ signal to the \a functorAmbiguous.
+
+ The \a functor and \a functorAmbiguous can be a pointer to a member
+ function of the \a context object.
+
+ If the \a context object is destroyed, the \a functor and
+ \a functorAmbiguous will not be called.
+*/
+/*!
+ \fn template<typename Functor, typename FunctorAmbiguous> QShortcut::QShortcut(QKeySequence::StandardKey key, QObject *parent, const QObject *context1, Functor functor, const QObject *context2, FunctorAmbiguous functorAmbiguous, Qt::ShortcutContext shortcutContext = Qt::WindowShortcut)
+ \since 6.0
+ \overload
+
+ This is a QShortcut convenience constructor which connects the shortcut's
+ \l{QShortcut::activated()}{activated()} signal to the \a functor and
+ \l{QShortcut::activatedAmbiguously()}{activatedAmbiguously()}
+ signal to the \a functorAmbiguous.
+
+ The \a functor can be a pointer to a member function of the
+ \a context1 object.
+ The \a functorAmbiguous can be a pointer to a member function of the
+ \a context2 object.
+
+ If the \a context1 object is destroyed, the \a functor will not be called.
+ If the \a context2 object is destroyed, the \a functorAmbiguous
+ will not be called.
+*/
+
+/*!
+ Destroys the shortcut.
+*/
+QShortcut::~QShortcut()
+{
+ Q_D(QShortcut);
+ if (qApp) {
+ for (int id : std::as_const(d->sc_ids))
+ QGuiApplicationPrivate::instance()->shortcutMap.removeShortcut(id, this);
+ }
+}
+
+/*!
+ \property QShortcut::key
+ \brief the shortcut's primary key sequence
+
+ This is a key sequence with an optional combination of Shift, Ctrl,
+ and Alt. The key sequence may be supplied in a number of ways:
+
+ \snippet code/src_gui_kernel_qshortcut.cpp 1
+
+ By default, this property contains an empty key sequence.
+*/
+void QShortcut::setKey(const QKeySequence &key)
+{
+ if (key.isEmpty())
+ setKeys({});
+ else
+ setKeys({ key });
+}
+
+QKeySequence QShortcut::key() const
+{
+ Q_D(const QShortcut);
+ if (d->sc_sequences.isEmpty())
+ return QKeySequence();
+ return d->sc_sequences.first();
+}
+
+/*!
+ Sets \a keys as the list of key sequences that trigger the
+ shortcut.
+
+ \since 6.0
+
+ \sa key, keys()
+*/
+void QShortcut::setKeys(const QList<QKeySequence> &keys)
+{
+ Q_D(QShortcut);
+ if (d->sc_sequences == keys)
+ return;
+ QAPP_CHECK("setKeys");
+ d->sc_sequences = keys;
+ d->redoGrab(QGuiApplicationPrivate::instance()->shortcutMap);
+}
+
+/*!
+ Sets the triggers to those matching the standard key \a key.
+
+ \since 6.0
+
+ \sa key, keys()
+*/
+void QShortcut::setKeys(QKeySequence::StandardKey key)
+{
+ setKeys(QKeySequence::keyBindings(key));
+}
+
+/*!
+ Returns the list of key sequences which trigger this
+ shortcut.
+
+ \since 6.0
+ \sa key, setKeys()
+*/
+QList<QKeySequence> QShortcut::keys() const
+{
+ Q_D(const QShortcut);
+ return d->sc_sequences;
+}
+
+/*!
+ \property QShortcut::enabled
+ \brief whether the shortcut is enabled
+
+ An enabled shortcut emits the activated() or activatedAmbiguously()
+ signal when a QShortcutEvent occurs that matches the shortcut's
+ key() sequence.
+
+ If the application is in \c WhatsThis mode the shortcut will not emit
+ the signals, but will show the "What's This?" text instead.
+
+ By default, this property is \c true.
+
+ \sa whatsThis
+*/
+void QShortcut::setEnabled(bool enable)
+{
+ Q_D(QShortcut);
+ if (d->sc_enabled == enable)
+ return;
+ QAPP_CHECK("setEnabled");
+ d->sc_enabled = enable;
+ for (int id : d->sc_ids)
+ QGuiApplicationPrivate::instance()->shortcutMap.setShortcutEnabled(enable, id, this);
+}
+
+bool QShortcut::isEnabled() const
+{
+ Q_D(const QShortcut);
+ return d->sc_enabled;
+}
+
+/*!
+ \property QShortcut::context
+ \brief the context in which the shortcut is valid
+
+ A shortcut's context decides in which circumstances a shortcut is
+ allowed to be triggered. The normal context is Qt::WindowShortcut,
+ which allows the shortcut to trigger if the parent (the widget
+ containing the shortcut) is a subwidget of the active top-level
+ window.
+
+ By default, this property is set to Qt::WindowShortcut.
+*/
+void QShortcut::setContext(Qt::ShortcutContext context)
+{
+ Q_D(QShortcut);
+ if (d->sc_context == context)
+ return;
+ QAPP_CHECK("setContext");
+ d->sc_context = context;
+ d->redoGrab(QGuiApplicationPrivate::instance()->shortcutMap);
+}
+
+Qt::ShortcutContext QShortcut::context() const
+{
+ Q_D(const QShortcut);
+ return d->sc_context;
+}
+
+/*!
+ \property QShortcut::autoRepeat
+ \brief whether the shortcut can auto repeat
+
+ If true, the shortcut will auto repeat when the keyboard shortcut
+ combination is held down, provided that keyboard auto repeat is
+ enabled on the system.
+ The default value is true.
+*/
+void QShortcut::setAutoRepeat(bool on)
+{
+ Q_D(QShortcut);
+ if (d->sc_autorepeat == on)
+ return;
+ QAPP_CHECK("setAutoRepeat");
+ d->sc_autorepeat = on;
+ for (int id : d->sc_ids)
+ QGuiApplicationPrivate::instance()->shortcutMap.setShortcutAutoRepeat(on, id, this);
+}
+
+bool QShortcut::autoRepeat() const
+{
+ Q_D(const QShortcut);
+ return d->sc_autorepeat;
+}
+
+
+/*!
+ Sets the shortcut's "What's This?" help \a text.
+
+ The text will be shown when a widget application is in "What's
+ This?" mode and the user types the shortcut key() sequence.
+
+ To set "What's This?" help on a menu item (with or without a
+ shortcut key), set the help on the item's action.
+
+ By default, the help text is an empty string.
+
+ This function has no effect in applications that don't use
+ widgets.
+
+ \sa QWhatsThis::inWhatsThisMode(), QAction::setWhatsThis()
+*/
+void QShortcut::setWhatsThis(const QString &text)
+{
+ Q_D(QShortcut);
+ d->sc_whatsthis = text;
+}
+
+/*!
+ Returns the shortcut's "What's This?" help text.
+
+ \sa setWhatsThis()
+*/
+QString QShortcut::whatsThis() const
+{
+ Q_D(const QShortcut);
+ return d->sc_whatsthis;
+}
+
+#if QT_DEPRECATED_SINCE(6,0)
+/*!
+ Returns the primary key binding's ID.
+
+ \deprecated
+
+ \sa QShortcutEvent::shortcutId()
+*/
+int QShortcut::id() const
+{
+ Q_D(const QShortcut);
+ if (d->sc_ids.isEmpty())
+ return 0;
+ return d->sc_ids.first();
+}
+#endif
+
+/*!
+ \fn QWidget *QShortcut::parentWidget() const
+
+ Returns the shortcut's parent widget.
+*/
+
+/*!
+ \internal
+*/
+bool QShortcut::event(QEvent *e)
+{
+ Q_D(QShortcut);
+ if (d->sc_enabled && e->type() == QEvent::Shortcut) {
+ auto se = static_cast<QShortcutEvent *>(e);
+ if (!d->handleWhatsThis()) {
+ Q_ASSERT_X(d->sc_ids.contains(se->shortcutId()), "QShortcut::event", "Received shortcut event from wrong shortcut");
+ if (se->isAmbiguous())
+ emit activatedAmbiguously();
+ else
+ emit activated();
+ return true;
+ }
+ }
+ return QObject::event(e);
+}
+
+QT_END_NAMESPACE
+
+#include "moc_qshortcut.cpp"
diff --git a/src/gui/kernel/qshortcut.h b/src/gui/kernel/qshortcut.h
new file mode 100644
index 0000000000..00b9168bea
--- /dev/null
+++ b/src/gui/kernel/qshortcut.h
@@ -0,0 +1,200 @@
+// Copyright (C) 2019 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
+
+#ifndef QSHORTCUT_H
+#define QSHORTCUT_H
+
+#include <QtGui/qtguiglobal.h>
+#include <QtGui/qkeysequence.h>
+#include <QtCore/qobject.h>
+
+QT_REQUIRE_CONFIG(shortcut);
+
+QT_BEGIN_NAMESPACE
+
+class QShortcutPrivate;
+class QWindow;
+
+class Q_GUI_EXPORT QShortcut : public QObject
+{
+ Q_OBJECT
+ Q_DECLARE_PRIVATE(QShortcut)
+ Q_PROPERTY(QKeySequence key READ key WRITE setKey)
+ Q_PROPERTY(bool enabled READ isEnabled WRITE setEnabled)
+ Q_PROPERTY(bool autoRepeat READ autoRepeat WRITE setAutoRepeat)
+ Q_PROPERTY(Qt::ShortcutContext context READ context WRITE setContext)
+public:
+ explicit QShortcut(QObject *parent);
+ explicit QShortcut(const QKeySequence& key, QObject *parent,
+ const char *member = nullptr, const char *ambiguousMember = nullptr,
+ Qt::ShortcutContext context = Qt::WindowShortcut);
+ explicit QShortcut(QKeySequence::StandardKey key, QObject *parent,
+ const char *member = nullptr, const char *ambiguousMember = nullptr,
+ Qt::ShortcutContext context = Qt::WindowShortcut);
+
+#ifdef Q_QDOC
+ template<typename Functor>
+ QShortcut(const QKeySequence &key, QObject *parent,
+ Functor functor,
+ Qt::ShortcutContext shortcutContext = Qt::WindowShortcut);
+ template<typename Functor>
+ QShortcut(const QKeySequence &key, QObject *parent,
+ const QObject *context, Functor functor,
+ Qt::ShortcutContext shortcutContext = Qt::WindowShortcut);
+ template<typename Functor, typename FunctorAmbiguous>
+ QShortcut(const QKeySequence &key, QObject *parent,
+ const QObject *context1, Functor functor,
+ FunctorAmbiguous functorAmbiguous,
+ Qt::ShortcutContext shortcutContext = Qt::WindowShortcut);
+ template<typename Functor, typename FunctorAmbiguous>
+ QShortcut(const QKeySequence &key, QObject *parent,
+ const QObject *context1, Functor functor,
+ const QObject *context2, FunctorAmbiguous functorAmbiguous,
+ Qt::ShortcutContext shortcutContext = Qt::WindowShortcut);
+
+ template<typename Functor>
+ QShortcut(QKeySequence::StandardKey key, QObject *parent,
+ Functor functor,
+ Qt::ShortcutContext shortcutContext = Qt::WindowShortcut);
+ template<typename Functor>
+ QShortcut(QKeySequence::StandardKey key, QObject *parent,
+ const QObject *context, Functor functor,
+ Qt::ShortcutContext shortcutContext = Qt::WindowShortcut);
+ template<typename Functor, typename FunctorAmbiguous>
+ QShortcut(QKeySequence::StandardKey key, QObject *parent,
+ const QObject *context1, Functor functor,
+ FunctorAmbiguous functorAmbiguous,
+ Qt::ShortcutContext shortcutContext = Qt::WindowShortcut);
+ template<typename Functor, typename FunctorAmbiguous>
+ QShortcut(QKeySequence::StandardKey key, QObject *parent,
+ const QObject *context1, Functor functor,
+ const QObject *context2, FunctorAmbiguous functorAmbiguous,
+ Qt::ShortcutContext shortcutContext = Qt::WindowShortcut);
+#else
+ template<typename Func1>
+ QShortcut(const QKeySequence &key, QObject *parent,
+ Func1 slot1,
+ Qt::ShortcutContext context = Qt::WindowShortcut)
+ : QShortcut(key, parent, static_cast<const char*>(nullptr), static_cast<const char*>(nullptr), context)
+ {
+ connect(this, &QShortcut::activated, std::move(slot1));
+ }
+ template<class Obj1, typename Func1>
+ QShortcut(const QKeySequence &key, QObject *parent,
+ const Obj1 *object1, Func1 slot1,
+ Qt::ShortcutContext context = Qt::WindowShortcut,
+ typename std::enable_if<QtPrivate::IsPointerToTypeDerivedFromQObject<Obj1*>::Value>::type* = 0)
+ : QShortcut(key, parent, static_cast<const char*>(nullptr), static_cast<const char*>(nullptr), context)
+ {
+ connect(this, &QShortcut::activated, object1, std::move(slot1));
+ }
+ template<class Obj1, typename Func1, typename Func2>
+ QShortcut(const QKeySequence &key, QObject *parent,
+ const Obj1 *object1, Func1 slot1, Func2 slot2,
+ Qt::ShortcutContext context = Qt::WindowShortcut,
+ typename std::enable_if<QtPrivate::IsPointerToTypeDerivedFromQObject<Obj1*>::Value>::type* = 0)
+ : QShortcut(key, parent, static_cast<const char*>(nullptr), static_cast<const char*>(nullptr), context)
+ {
+ connect(this, &QShortcut::activated, object1, std::move(slot1));
+ connect(this, &QShortcut::activatedAmbiguously, object1, std::move(slot2));
+ }
+ template<class Obj1, typename Func1, class Obj2, typename Func2>
+ QShortcut(const QKeySequence &key, QObject *parent,
+ const Obj1 *object1, Func1 slot1,
+ const Obj2 *object2, Func2 slot2,
+ Qt::ShortcutContext context = Qt::WindowShortcut,
+ typename std::enable_if<QtPrivate::IsPointerToTypeDerivedFromQObject<Obj1*>::Value>::type* = 0,
+ typename std::enable_if<QtPrivate::IsPointerToTypeDerivedFromQObject<Obj2*>::Value>::type* = 0)
+ : QShortcut(key, parent, static_cast<const char*>(nullptr), static_cast<const char*>(nullptr), context)
+ {
+ connect(this, &QShortcut::activated, object1, std::move(slot1));
+ connect(this, &QShortcut::activatedAmbiguously, object2, std::move(slot2));
+ }
+
+ template<typename Func1>
+ QShortcut(QKeySequence::StandardKey key, QObject *parent,
+ Func1 slot1,
+ Qt::ShortcutContext context = Qt::WindowShortcut)
+ : QShortcut(key, parent, static_cast<const char*>(nullptr), static_cast<const char*>(nullptr), context)
+ {
+ connect(this, &QShortcut::activated, std::move(slot1));
+ }
+ template<class Obj1, typename Func1>
+ QShortcut(QKeySequence::StandardKey key, QObject *parent,
+ const Obj1 *object1, Func1 slot1,
+ Qt::ShortcutContext context = Qt::WindowShortcut,
+ typename std::enable_if<QtPrivate::IsPointerToTypeDerivedFromQObject<Obj1*>::Value>::type* = 0)
+ : QShortcut(key, parent, static_cast<const char*>(nullptr), static_cast<const char*>(nullptr), context)
+ {
+ connect(this, &QShortcut::activated, object1, std::move(slot1));
+ }
+ template<class Obj1, typename Func1, typename Func2>
+ QShortcut(QKeySequence::StandardKey key, QObject *parent,
+ const Obj1 *object1, Func1 slot1, Func2 slot2,
+ Qt::ShortcutContext context = Qt::WindowShortcut,
+ typename std::enable_if<QtPrivate::IsPointerToTypeDerivedFromQObject<Obj1*>::Value>::type* = 0)
+ : QShortcut(key, parent, static_cast<const char*>(nullptr), static_cast<const char*>(nullptr), context)
+ {
+ connect(this, &QShortcut::activated, object1, std::move(slot1));
+ connect(this, &QShortcut::activatedAmbiguously, object1, std::move(slot2));
+ }
+ template<class Obj1, typename Func1, class Obj2, typename Func2>
+ QShortcut(QKeySequence::StandardKey key, QObject *parent,
+ const Obj1 *object1, Func1 slot1,
+ const Obj2 *object2, Func2 slot2,
+ Qt::ShortcutContext context = Qt::WindowShortcut,
+ typename std::enable_if<QtPrivate::IsPointerToTypeDerivedFromQObject<Obj1*>::Value>::type* = 0,
+ typename std::enable_if<QtPrivate::IsPointerToTypeDerivedFromQObject<Obj2*>::Value>::type* = 0)
+ : QShortcut(key, parent, static_cast<const char*>(nullptr), static_cast<const char*>(nullptr), context)
+ {
+ connect(this, &QShortcut::activated, object1, std::move(slot1));
+ connect(this, &QShortcut::activatedAmbiguously, object2, std::move(slot2));
+ }
+#endif
+
+ ~QShortcut();
+
+ void setKey(const QKeySequence& key);
+ QKeySequence key() const;
+ void setKeys(QKeySequence::StandardKey key);
+ void setKeys(const QList<QKeySequence> &keys);
+ QList<QKeySequence> keys() const;
+
+ void setEnabled(bool enable);
+ bool isEnabled() const;
+
+ void setContext(Qt::ShortcutContext context);
+ Qt::ShortcutContext context() const;
+
+ void setAutoRepeat(bool on);
+ bool autoRepeat() const;
+
+#if QT_DEPRECATED_SINCE(6,0)
+ QT_DEPRECATED_VERSION_6_0 int id() const;
+#endif
+
+ void setWhatsThis(const QString &text);
+ QString whatsThis() const;
+
+#if QT_DEPRECATED_SINCE(6,0)
+#ifdef Q_QDOC
+ QWidget *parentWidget() const;
+#else
+ template<typename T = QWidget*>
+ QT_DEPRECATED_VERSION_X_6_0("Use parent() and qobject_cast instead")
+ inline T parentWidget() const
+ { return static_cast<T>(QObject::parent()); }
+#endif
+#endif
+
+Q_SIGNALS:
+ void activated();
+ void activatedAmbiguously();
+
+protected:
+ bool event(QEvent *e) override;
+};
+
+QT_END_NAMESPACE
+
+#endif // QSHORTCUT_H
diff --git a/src/gui/kernel/qshortcut_p.h b/src/gui/kernel/qshortcut_p.h
new file mode 100644
index 0000000000..8ff833d477
--- /dev/null
+++ b/src/gui/kernel/qshortcut_p.h
@@ -0,0 +1,59 @@
+// Copyright (C) 2020 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
+
+#ifndef QSHORTCUT_P_H
+#define QSHORTCUT_P_H
+
+//
+// W A R N I N G
+// -------------
+//
+// This file is not part of the Qt API. It exists purely as an
+// implementation detail. This header file may change from version to
+// version without notice, or even be removed.
+//
+// We mean it.
+//
+
+#include <QtGui/private/qtguiglobal_p.h>
+#include "qshortcut.h"
+#include <QtGui/qkeysequence.h>
+
+#include <QtCore/qlist.h>
+#include <QtCore/qstring.h>
+#include <QtCore/private/qobject_p.h>
+
+#include <private/qshortcutmap_p.h>
+
+
+QT_BEGIN_NAMESPACE
+
+class QShortcutMap;
+
+/*
+ \internal
+ Private data accessed through d-pointer.
+*/
+class Q_GUI_EXPORT QShortcutPrivate : public QObjectPrivate
+{
+ Q_DECLARE_PUBLIC(QShortcut)
+public:
+ QShortcutPrivate() = default;
+
+ virtual QShortcutMap::ContextMatcher contextMatcher() const;
+ virtual bool handleWhatsThis() { return false; }
+
+ static bool simpleContextMatcher(QObject *object, Qt::ShortcutContext context);
+
+ QList<QKeySequence> sc_sequences;
+ QString sc_whatsthis;
+ Qt::ShortcutContext sc_context = Qt::WindowShortcut;
+ bool sc_enabled = true;
+ bool sc_autorepeat = true;
+ QList<int> sc_ids;
+ void redoGrab(QShortcutMap &map);
+};
+
+QT_END_NAMESPACE
+
+#endif // QSHORTCUT_P_H
diff --git a/src/gui/kernel/qshortcutmap.cpp b/src/gui/kernel/qshortcutmap.cpp
index 6039101cf4..800e703ac2 100644
--- a/src/gui/kernel/qshortcutmap.cpp
+++ b/src/gui/kernel/qshortcutmap.cpp
@@ -1,51 +1,17 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the QtGui module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#include "qshortcutmap_p.h"
#include "private/qobject_p.h"
#include "qkeysequence.h"
#include "qdebug.h"
#include "qevent.h"
-#include "qvector.h"
-#include "qcoreapplication.h"
+#include "qlist.h"
+#include "qguiapplication.h"
+#include "qwindow.h"
#include <private/qkeymapper_p.h>
#include <QtCore/qloggingcategory.h>
+#include <QtCore/qscopeguard.h>
#include <algorithm>
@@ -63,23 +29,23 @@ Q_LOGGING_CATEGORY(lcShortcutMap, "qt.gui.shortcutmap")
struct QShortcutEntry
{
QShortcutEntry()
- : keyseq(0), context(Qt::WindowShortcut), enabled(false), autorepeat(1), id(0), owner(nullptr), contextMatcher(nullptr)
+ : keySequence(0), context(Qt::WindowShortcut), enabled(false), autorepeat(1), id(0), owner(nullptr), contextMatcher(nullptr)
{}
QShortcutEntry(const QKeySequence &k)
- : keyseq(k), context(Qt::WindowShortcut), enabled(false), autorepeat(1), id(0), owner(nullptr), contextMatcher(nullptr)
+ : keySequence(k), context(Qt::WindowShortcut), enabled(false), autorepeat(1), id(0), owner(nullptr), contextMatcher(nullptr)
{}
QShortcutEntry(QObject *o, const QKeySequence &k, Qt::ShortcutContext c, int i, bool a, QShortcutMap::ContextMatcher m)
- : keyseq(k), context(c), enabled(true), autorepeat(a), id(i), owner(o), contextMatcher(m)
+ : keySequence(k), context(c), enabled(true), autorepeat(a), id(i), owner(o), contextMatcher(m)
{}
bool correctContext() const { return contextMatcher(owner, context); }
bool operator<(const QShortcutEntry &f) const
- { return keyseq < f.keyseq; }
+ { return keySequence < f.keySequence; }
- QKeySequence keyseq;
+ QKeySequence keySequence;
Qt::ShortcutContext context;
bool enabled : 1;
bool autorepeat : 1;
@@ -87,7 +53,7 @@ struct QShortcutEntry
QObject *owner;
QShortcutMap::ContextMatcher contextMatcher;
};
-Q_DECLARE_TYPEINFO(QShortcutEntry, Q_MOVABLE_TYPE);
+Q_DECLARE_TYPEINFO(QShortcutEntry, Q_RELOCATABLE_TYPE);
#ifdef Dump_QShortcutMap
/*! \internal
@@ -122,15 +88,15 @@ public:
}
QShortcutMap *q_ptr; // Private's parent
- QVector<QShortcutEntry> sequences; // All sequences!
+ QList<QShortcutEntry> shortcuts; // All shortcuts!
int currentId; // Global shortcut ID number
int ambigCount; // Index of last enabled ambiguous dispatch
QKeySequence::SequenceMatch currentState;
- QVector<QKeySequence> currentSequences; // Sequence for the current state
- QVector<QKeySequence> newEntries;
+ QList<QKeySequence> currentSequences; // Sequence for the current state
+ QList<QKeySequence> newEntries;
QKeySequence prevSequence; // Sequence for the previous identical match
- QVector<const QShortcutEntry*> identicals; // Last identical matches
+ QList<const QShortcutEntry*> identicals; // Last identical matches
};
@@ -154,18 +120,18 @@ QShortcutMap::~QShortcutMap()
Adds a shortcut to the global map.
Returns the id of the newly added shortcut.
*/
-int QShortcutMap::addShortcut(QObject *owner, const QKeySequence &key, Qt::ShortcutContext context, ContextMatcher matcher)
+int QShortcutMap::addShortcut(QObject *owner, const QKeySequence &keySequence, Qt::ShortcutContext context, ContextMatcher matcher)
{
Q_ASSERT_X(owner, "QShortcutMap::addShortcut", "All shortcuts need an owner");
- Q_ASSERT_X(!key.isEmpty(), "QShortcutMap::addShortcut", "Cannot add keyless shortcuts to map");
+ Q_ASSERT_X(!keySequence.isEmpty(), "QShortcutMap::addShortcut", "Cannot add keyless shortcuts to map");
Q_D(QShortcutMap);
- QShortcutEntry newEntry(owner, key, context, --(d->currentId), true, matcher);
- const auto it = std::upper_bound(d->sequences.begin(), d->sequences.end(), newEntry);
- d->sequences.insert(it, newEntry); // Insert sorted
+ QShortcutEntry newEntry(owner, keySequence, context, --(d->currentId), true, matcher);
+ const auto it = std::upper_bound(d->shortcuts.begin(), d->shortcuts.end(), newEntry);
+ d->shortcuts.insert(it, newEntry); // Insert sorted
qCDebug(lcShortcutMap).nospace()
<< "QShortcutMap::addShortcut(" << owner << ", "
- << key << ", " << context << ") = " << d->currentId;
+ << keySequence << ", " << context << ") added shortcut with ID " << d->currentId;
return d->currentId;
}
@@ -178,39 +144,42 @@ int QShortcutMap::addShortcut(QObject *owner, const QKeySequence &key, Qt::Short
Returns the number of sequences removed from the map.
*/
-int QShortcutMap::removeShortcut(int id, QObject *owner, const QKeySequence &key)
+int QShortcutMap::removeShortcut(int id, QObject *owner, const QKeySequence &keySequence)
{
Q_D(QShortcutMap);
int itemsRemoved = 0;
bool allOwners = (owner == nullptr);
- bool allKeys = key.isEmpty();
+ bool allKeys = keySequence.isEmpty();
bool allIds = id == 0;
+ auto debug = qScopeGuard([&](){
+ qCDebug(lcShortcutMap).nospace()
+ << "QShortcutMap::removeShortcut(" << id << ", " << owner << ", "
+ << keySequence << ") removed " << itemsRemoved << " shortcuts(s)";
+ });
+
// Special case, remove everything
if (allOwners && allKeys && allIds) {
- itemsRemoved = d->sequences.size();
- d->sequences.clear();
+ itemsRemoved = d->shortcuts.size();
+ d->shortcuts.clear();
return itemsRemoved;
}
- int i = d->sequences.size()-1;
+ int i = d->shortcuts.size()-1;
while (i>=0)
{
- const QShortcutEntry &entry = d->sequences.at(i);
+ const QShortcutEntry &entry = d->shortcuts.at(i);
int entryId = entry.id;
if ((allOwners || entry.owner == owner)
&& (allIds || entry.id == id)
- && (allKeys || entry.keyseq == key)) {
- d->sequences.removeAt(i);
+ && (allKeys || entry.keySequence == keySequence)) {
+ d->shortcuts.removeAt(i);
++itemsRemoved;
}
if (id == entryId)
return itemsRemoved;
--i;
}
- qCDebug(lcShortcutMap).nospace()
- << "QShortcutMap::removeShortcut(" << id << ", " << owner << ", "
- << key << ") = " << itemsRemoved;
return itemsRemoved;
}
@@ -222,22 +191,22 @@ int QShortcutMap::removeShortcut(int id, QObject *owner, const QKeySequence &key
are changed.
Returns the number of sequences which are matched in the map.
*/
-int QShortcutMap::setShortcutEnabled(bool enable, int id, QObject *owner, const QKeySequence &key)
+int QShortcutMap::setShortcutEnabled(bool enable, int id, QObject *owner, const QKeySequence &keySequence)
{
Q_D(QShortcutMap);
int itemsChanged = 0;
bool allOwners = (owner == nullptr);
- bool allKeys = key.isEmpty();
+ bool allKeys = keySequence.isEmpty();
bool allIds = id == 0;
- int i = d->sequences.size()-1;
+ int i = d->shortcuts.size()-1;
while (i>=0)
{
- QShortcutEntry entry = d->sequences.at(i);
+ QShortcutEntry entry = d->shortcuts.at(i);
if ((allOwners || entry.owner == owner)
&& (allIds || entry.id == id)
- && (allKeys || entry.keyseq == key)) {
- d->sequences[i].enabled = enable;
+ && (allKeys || entry.keySequence == keySequence)) {
+ d->shortcuts[i].enabled = enable;
++itemsChanged;
}
if (id == entry.id)
@@ -246,7 +215,7 @@ int QShortcutMap::setShortcutEnabled(bool enable, int id, QObject *owner, const
}
qCDebug(lcShortcutMap).nospace()
<< "QShortcutMap::setShortcutEnabled(" << enable << ", " << id << ", "
- << owner << ", " << key << ") = " << itemsChanged;
+ << owner << ", " << keySequence << ") = " << itemsChanged;
return itemsChanged;
}
@@ -258,22 +227,22 @@ int QShortcutMap::setShortcutEnabled(bool enable, int id, QObject *owner, const
are changed.
Returns the number of sequences which are matched in the map.
*/
-int QShortcutMap::setShortcutAutoRepeat(bool on, int id, QObject *owner, const QKeySequence &key)
+int QShortcutMap::setShortcutAutoRepeat(bool on, int id, QObject *owner, const QKeySequence &keySequence)
{
Q_D(QShortcutMap);
int itemsChanged = 0;
bool allOwners = (owner == nullptr);
- bool allKeys = key.isEmpty();
+ bool allKeys = keySequence.isEmpty();
bool allIds = id == 0;
- int i = d->sequences.size()-1;
+ int i = d->shortcuts.size()-1;
while (i>=0)
{
- QShortcutEntry entry = d->sequences.at(i);
+ QShortcutEntry entry = d->shortcuts.at(i);
if ((allOwners || entry.owner == owner)
&& (allIds || entry.id == id)
- && (allKeys || entry.keyseq == key)) {
- d->sequences[i].autorepeat = on;
+ && (allKeys || entry.keySequence == keySequence)) {
+ d->shortcuts[i].autorepeat = on;
++itemsChanged;
}
if (id == entry.id)
@@ -282,7 +251,7 @@ int QShortcutMap::setShortcutAutoRepeat(bool on, int id, QObject *owner, const Q
}
qCDebug(lcShortcutMap).nospace()
<< "QShortcutMap::setShortcutAutoRepeat(" << on << ", " << id << ", "
- << owner << ", " << key << ") = " << itemsChanged;
+ << owner << ", " << keySequence << ") = " << itemsChanged;
return itemsChanged;
}
@@ -336,7 +305,7 @@ bool QShortcutMap::tryShortcut(QKeyEvent *e)
case QKeySequence::ExactMatch: {
// Save number of identical matches before dispatching
// to keep QShortcutMap and tryShortcut reentrant.
- const int identicalMatches = d->identicals.count();
+ const int identicalMatches = d->identicals.size();
resetState();
dispatchEvent(e);
// If there are no identicals we've only found disabled shortcuts, and
@@ -344,8 +313,7 @@ bool QShortcutMap::tryShortcut(QKeyEvent *e)
return identicalMatches > 0;
}
}
- Q_UNREACHABLE();
- return false;
+ Q_UNREACHABLE_RETURN(false);
}
/*! \internal
@@ -359,7 +327,7 @@ QKeySequence::SequenceMatch QShortcutMap::nextState(QKeyEvent *e)
Q_D(QShortcutMap);
// Modifiers can NOT be shortcuts...
if (e->key() >= Qt::Key_Shift &&
- e->key() <= Qt::Key_Alt)
+ e->key() <= Qt::Key_ScrollLock)
return d->currentState;
QKeySequence::SequenceMatch result = QKeySequence::NoMatch;
@@ -391,17 +359,18 @@ QKeySequence::SequenceMatch QShortcutMap::nextState(QKeyEvent *e)
/*! \internal
- Determines if an enabled shortcut has a matcing key sequence.
+ Determines if an enabled shortcut has a matching key sequence.
*/
bool QShortcutMap::hasShortcutForKeySequence(const QKeySequence &seq) const
{
Q_D(const QShortcutMap);
QShortcutEntry entry(seq); // needed for searching
- const auto itEnd = d->sequences.cend();
- auto it = std::lower_bound(d->sequences.cbegin(), itEnd, entry);
+ const auto itEnd = d->shortcuts.cend();
+ auto it = std::lower_bound(d->shortcuts.cbegin(), itEnd, entry);
for (;it != itEnd; ++it) {
- if (matches(entry.keyseq, (*it).keyseq) == QKeySequence::ExactMatch && (*it).correctContext() && (*it).enabled) {
+ if (entry.keySequence.matches(it->keySequence) == QKeySequence::ExactMatch
+ && (*it).correctContext() && (*it).enabled) {
return true;
}
}
@@ -413,22 +382,22 @@ bool QShortcutMap::hasShortcutForKeySequence(const QKeySequence &seq) const
/*! \internal
Returns the next state of the statemachine, based
on the new key event \a e.
- Matches are appended to the vector of identicals,
+ Matches are appended to the list of identicals,
which can be access through matches().
\sa matches
*/
QKeySequence::SequenceMatch QShortcutMap::find(QKeyEvent *e, int ignoredModifiers)
{
Q_D(QShortcutMap);
- if (!d->sequences.count())
+ if (!d->shortcuts.size())
return QKeySequence::NoMatch;
createNewSequences(e, d->newEntries, ignoredModifiers);
- qCDebug(lcShortcutMap) << "Possible shortcut key sequences:" << d->newEntries;
+ qCDebug(lcShortcutMap) << "Possible input sequences:" << d->newEntries;
// Should never happen
if (d->newEntries == d->currentSequences) {
- Q_ASSERT_X(e->key() != Qt::Key_unknown || e->text().length(),
+ Q_ASSERT_X(e->key() != Qt::Key_unknown || e->text().size(),
"QShortcutMap::find", "New sequence to find identical to previous");
return QKeySequence::NoMatch;
}
@@ -438,27 +407,34 @@ QKeySequence::SequenceMatch QShortcutMap::find(QKeyEvent *e, int ignoredModifier
bool partialFound = false;
bool identicalDisabledFound = false;
- QVector<QKeySequence> okEntries;
- int result = QKeySequence::NoMatch;
- for (int i = d->newEntries.count()-1; i >= 0 ; --i) {
+ QList<QKeySequence> okEntries;
+ QKeySequence::SequenceMatch result = QKeySequence::NoMatch;
+ for (int i = d->newEntries.size()-1; i >= 0 ; --i) {
QShortcutEntry entry(d->newEntries.at(i)); // needed for searching
- const auto itEnd = d->sequences.constEnd();
- auto it = std::lower_bound(d->sequences.constBegin(), itEnd, entry);
+ qCDebug(lcShortcutMap) << "Looking for shortcuts matching" << entry.keySequence;
- int oneKSResult = QKeySequence::NoMatch;
- int tempRes = QKeySequence::NoMatch;
- do {
- if (it == itEnd)
+ QKeySequence::SequenceMatch bestMatchForEntry = QKeySequence::NoMatch;
+
+ const auto itEnd = d->shortcuts.constEnd();
+ auto it = std::lower_bound(d->shortcuts.constBegin(), itEnd, entry);
+ for (; it != itEnd; ++it) {
+ QKeySequence::SequenceMatch match = entry.keySequence.matches(it->keySequence);
+ qCDebug(lcShortcutMap) << " -" << match << "for shortcut" << it->keySequence;
+
+ // If we got a valid match, there might still be more keys to check against,
+ // but if we get no match, we know that there are no more possible matches.
+ if (match == QKeySequence::NoMatch)
break;
- tempRes = matches(entry.keyseq, (*it).keyseq);
- oneKSResult = qMax(oneKSResult, tempRes);
- if (tempRes != QKeySequence::NoMatch && (*it).correctContext()) {
- if (tempRes == QKeySequence::ExactMatch) {
+
+ bestMatchForEntry = qMax(bestMatchForEntry, match);
+
+ if ((*it).correctContext()) {
+ if (match == QKeySequence::ExactMatch) {
if ((*it).enabled)
d->identicals.append(&*it);
else
identicalDisabledFound = true;
- } else if (tempRes == QKeySequence::PartialMatch) {
+ } else if (match == QKeySequence::PartialMatch) {
// We don't need partials, if we have identicals
if (d->identicals.size())
break;
@@ -466,20 +442,18 @@ QKeySequence::SequenceMatch QShortcutMap::find(QKeyEvent *e, int ignoredModifier
// key events when all partials are disabled!
partialFound |= (*it).enabled;
}
+ } else {
+ qCDebug(lcShortcutMap) << " - But context was not correct";
}
- ++it;
- // If we got a valid match on this run, there might still be more keys to check against,
- // so we'll loop once more. If we get NoMatch, there's guaranteed no more possible
- // matches in the shortcutmap.
- } while (tempRes != QKeySequence::NoMatch);
+ }
// If the type of match improves (ergo, NoMatch->Partial, or Partial->Exact), clear the
// previous list. If this match is equal or better than the last match, append to the list
- if (oneKSResult > result) {
+ if (bestMatchForEntry > result) {
okEntries.clear();
qCDebug(lcShortcutMap) << "Found better match (" << d->newEntries << "), clearing key sequence list";
}
- if (oneKSResult && oneKSResult >= result) {
+ if (bestMatchForEntry && bestMatchForEntry >= result) {
okEntries << d->newEntries.at(i);
qCDebug(lcShortcutMap) << "Added ok key sequence" << d->newEntries;
}
@@ -498,7 +472,7 @@ QKeySequence::SequenceMatch QShortcutMap::find(QKeyEvent *e, int ignoredModifier
if (result != QKeySequence::NoMatch)
d->currentSequences = okEntries;
qCDebug(lcShortcutMap) << "Returning shortcut match == " << result;
- return QKeySequence::SequenceMatch(result);
+ return result;
}
/*! \internal
@@ -506,7 +480,7 @@ QKeySequence::SequenceMatch QShortcutMap::find(QKeyEvent *e, int ignoredModifier
Same as doing (the slower)
\snippet code/src_gui_kernel_qshortcutmap.cpp 0
*/
-void QShortcutMap::clearSequence(QVector<QKeySequence> &ksl)
+void QShortcutMap::clearSequence(QList<QKeySequence> &ksl)
{
ksl.clear();
d_func()->newEntries.clear();
@@ -516,25 +490,17 @@ void QShortcutMap::clearSequence(QVector<QKeySequence> &ksl)
Alters \a seq to the new sequence state, based on the
current sequence state, and the new key event \a e.
*/
-void QShortcutMap::createNewSequences(QKeyEvent *e, QVector<QKeySequence> &ksl, int ignoredModifiers)
+void QShortcutMap::createNewSequences(QKeyEvent *e, QList<QKeySequence> &ksl, int ignoredModifiers)
{
Q_D(QShortcutMap);
- QList<int> possibleKeys = QKeyMapper::possibleKeys(e);
- if (lcShortcutMap().isDebugEnabled()) {
- qCDebug(lcShortcutMap).nospace() << __FUNCTION__ << '(' << e << ", ignoredModifiers="
- << Qt::KeyboardModifiers(ignoredModifiers) << "), possibleKeys=(";
- for (int i = 0, size = possibleKeys.size(); i < size; ++i) {
- if (i)
- qCDebug(lcShortcutMap).nospace() << ", ";
- qCDebug(lcShortcutMap).nospace() << QKeySequence(possibleKeys.at(i));
- }
- qCDebug(lcShortcutMap).nospace() << ')';
- }
- int pkTotal = possibleKeys.count();
+ QList<QKeyCombination> possibleKeys = QKeyMapper::possibleKeys(e);
+ qCDebug(lcShortcutMap) << "Creating new sequences for" << e
+ << "with ignoredModifiers=" << Qt::KeyboardModifiers(ignoredModifiers);
+ int pkTotal = possibleKeys.size();
if (!pkTotal)
return;
- int ssActual = d->currentSequences.count();
+ int ssActual = d->currentSequences.size();
int ssTotal = qMax(1, ssActual);
// Resize to possible permutations of the current sequence(s).
ksl.resize(pkTotal * ssTotal);
@@ -551,51 +517,18 @@ void QShortcutMap::createNewSequences(QKeyEvent *e, QVector<QKeySequence> &ksl,
curKsl.setKey(curSeq[2], 2);
curKsl.setKey(curSeq[3], 3);
} else {
- curKsl.setKey(0, 0);
- curKsl.setKey(0, 1);
- curKsl.setKey(0, 2);
- curKsl.setKey(0, 3);
+ curKsl.setKey(QKeyCombination::fromCombined(0), 0);
+ curKsl.setKey(QKeyCombination::fromCombined(0), 1);
+ curKsl.setKey(QKeyCombination::fromCombined(0), 2);
+ curKsl.setKey(QKeyCombination::fromCombined(0), 3);
}
- curKsl.setKey(possibleKeys.at(pkNum) & ~ignoredModifiers, index);
+ const int key = possibleKeys.at(pkNum).toCombined();
+ curKsl.setKey(QKeyCombination::fromCombined(key & ~ignoredModifiers), index);
}
}
}
/*! \internal
- Basically the same function as QKeySequence::matches(const QKeySequence &seq) const
- only that is specially handles Key_hyphen as Key_Minus, as people mix these up all the time and
- they conceptually the same.
-*/
-QKeySequence::SequenceMatch QShortcutMap::matches(const QKeySequence &seq1,
- const QKeySequence &seq2) const
-{
- uint userN = seq1.count(),
- seqN = seq2.count();
-
- if (userN > seqN)
- return QKeySequence::NoMatch;
-
- // If equal in length, we have a potential ExactMatch sequence,
- // else we already know it can only be partial.
- QKeySequence::SequenceMatch match = (userN == seqN
- ? QKeySequence::ExactMatch
- : QKeySequence::PartialMatch);
-
- for (uint i = 0; i < userN; ++i) {
- int userKey = seq1[i],
- sequenceKey = seq2[i];
- if ((userKey & Qt::Key_unknown) == Qt::Key_hyphen)
- userKey = (userKey & Qt::KeyboardModifierMask) | Qt::Key_Minus;
- if ((sequenceKey & Qt::Key_unknown) == Qt::Key_hyphen)
- sequenceKey = (sequenceKey & Qt::KeyboardModifierMask) | Qt::Key_Minus;
- if (userKey != sequenceKey)
- return QKeySequence::NoMatch;
- }
- return match;
-}
-
-
-/*! \internal
Converts keyboard button states into modifier states
*/
int QShortcutMap::translateModifiers(Qt::KeyboardModifiers modifiers)
@@ -613,9 +546,9 @@ int QShortcutMap::translateModifiers(Qt::KeyboardModifiers modifiers)
}
/*! \internal
- Returns the vector of QShortcutEntry's matching the last Identical state.
+ Returns the list of QShortcutEntry's matching the last Identical state.
*/
-QVector<const QShortcutEntry*> QShortcutMap::matches() const
+QList<const QShortcutEntry*> QShortcutMap::matches() const
{
Q_D(const QShortcutMap);
return d->identicals;
@@ -630,7 +563,7 @@ void QShortcutMap::dispatchEvent(QKeyEvent *e)
if (!d->identicals.size())
return;
- const QKeySequence &curKey = d->identicals.at(0)->keyseq;
+ const QKeySequence &curKey = d->identicals.at(0)->keySequence;
if (d->prevSequence != curKey) {
d->ambigCount = 0;
d->prevSequence = curKey;
@@ -638,7 +571,7 @@ void QShortcutMap::dispatchEvent(QKeyEvent *e)
// Find next
const QShortcutEntry *current = nullptr, *next = nullptr;
int i = 0, enabledShortcuts = 0;
- QVector<const QShortcutEntry*> ambiguousShortcuts;
+ QList<const QShortcutEntry*> ambiguousShortcuts;
while(i < d->identicals.size()) {
current = d->identicals.at(i);
if (current->enabled || !next){
@@ -660,19 +593,59 @@ void QShortcutMap::dispatchEvent(QKeyEvent *e)
if (lcShortcutMap().isDebugEnabled()) {
if (ambiguousShortcuts.size() > 1) {
qCDebug(lcShortcutMap) << "The following shortcuts are about to be activated ambiguously:";
- for (const QShortcutEntry *entry : qAsConst(ambiguousShortcuts))
- qCDebug(lcShortcutMap).nospace() << "- " << entry->keyseq << " (belonging to " << entry->owner << ")";
+ for (const QShortcutEntry *entry : std::as_const(ambiguousShortcuts))
+ qCDebug(lcShortcutMap).nospace() << "- " << entry->keySequence << " (belonging to " << entry->owner << ")";
}
qCDebug(lcShortcutMap).nospace()
<< "QShortcutMap::dispatchEvent(): Sending QShortcutEvent(\""
- << next->keyseq.toString() << "\", " << next->id << ", "
+ << next->keySequence.toString() << "\", " << next->id << ", "
<< static_cast<bool>(enabledShortcuts>1) << ") to object(" << next->owner << ')';
}
- QShortcutEvent se(next->keyseq, next->id, enabledShortcuts>1);
+ QShortcutEvent se(next->keySequence, next->id, enabledShortcuts > 1);
QCoreApplication::sendEvent(const_cast<QObject *>(next->owner), &se);
}
+QList<QKeySequence> QShortcutMap::keySequences(bool getAll) const
+{
+ Q_D(const QShortcutMap);
+ QList<QKeySequence> keys;
+ for (auto sequence : d->shortcuts) {
+ bool addSequence = false;
+ if (sequence.enabled) {
+ if (getAll || sequence.context == Qt::ApplicationShortcut ||
+ sequence.owner == QGuiApplication::focusObject()) {
+ addSequence = true;
+ } else {
+ QObject *possibleWindow = sequence.owner;
+ while (possibleWindow) {
+ if (qobject_cast<QWindow *>(possibleWindow))
+ break;
+ possibleWindow = possibleWindow->parent();
+ }
+ if (possibleWindow == QGuiApplication::focusWindow()) {
+ if (sequence.context == Qt::WindowShortcut) {
+ addSequence = true;
+ } else if (sequence.context == Qt::WidgetWithChildrenShortcut) {
+ QObject *possibleWidget = QGuiApplication::focusObject();
+ while (possibleWidget->parent()) {
+ possibleWidget = possibleWidget->parent();
+ if (possibleWidget == sequence.owner) {
+ addSequence = true;
+ break;
+ }
+ }
+ }
+ }
+ }
+ if (addSequence)
+ keys << sequence.keySequence;
+ }
+ }
+ return keys;
+
+}
+
/* \internal
QShortcutMap dump function, only available when DEBUG_QSHORTCUTMAP is
defined.
@@ -681,8 +654,8 @@ void QShortcutMap::dispatchEvent(QKeyEvent *e)
void QShortcutMap::dumpMap() const
{
Q_D(const QShortcutMap);
- for (int i = 0; i < d->sequences.size(); ++i)
- qDebug().nospace() << &(d->sequences.at(i));
+ for (int i = 0; i < d->shortcuts.size(); ++i)
+ qDebug().nospace() << &(d->shortcuts.at(i));
}
#endif
diff --git a/src/gui/kernel/qshortcutmap_p.h b/src/gui/kernel/qshortcutmap_p.h
index aa3dd969f0..26d2b5301c 100644
--- a/src/gui/kernel/qshortcutmap_p.h
+++ b/src/gui/kernel/qshortcutmap_p.h
@@ -1,41 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the QtGui module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#ifndef QSHORTCUTMAP_P_H
#define QSHORTCUTMAP_P_H
@@ -53,7 +17,7 @@
#include <QtGui/private/qtguiglobal_p.h>
#include "QtGui/qkeysequence.h"
-#include "QtCore/qvector.h"
+#include "QtCore/qlist.h"
#include "QtCore/qscopedpointer.h"
QT_REQUIRE_CONFIG(shortcut);
@@ -86,6 +50,7 @@ public:
bool tryShortcut(QKeyEvent *e);
bool hasShortcutForKeySequence(const QKeySequence &seq) const;
+ QList<QKeySequence> keySequences(bool getAll = false) const;
#ifdef Dump_QShortcutMap
void dumpMap() const;
@@ -97,10 +62,9 @@ private:
void dispatchEvent(QKeyEvent *e);
QKeySequence::SequenceMatch find(QKeyEvent *e, int ignoredModifiers = 0);
- QKeySequence::SequenceMatch matches(const QKeySequence &seq1, const QKeySequence &seq2) const;
- QVector<const QShortcutEntry *> matches() const;
- void createNewSequences(QKeyEvent *e, QVector<QKeySequence> &ksl, int ignoredModifiers);
- void clearSequence(QVector<QKeySequence> &ksl);
+ QList<const QShortcutEntry *> matches() const;
+ void createNewSequences(QKeyEvent *e, QList<QKeySequence> &ksl, int ignoredModifiers);
+ void clearSequence(QList<QKeySequence> &ksl);
int translateModifiers(Qt::KeyboardModifiers modifiers);
QScopedPointer<QShortcutMapPrivate> d_ptr;
diff --git a/src/gui/kernel/qsimpledrag.cpp b/src/gui/kernel/qsimpledrag.cpp
index dec3cc399d..a90e8dd33c 100644
--- a/src/gui/kernel/qsimpledrag.cpp
+++ b/src/gui/kernel/qsimpledrag.cpp
@@ -1,41 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the QtGui module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#include "qsimpledrag_p.h"
@@ -70,9 +34,10 @@ Q_LOGGING_CATEGORY(lcDnd, "qt.gui.dnd")
static QWindow* topLevelAt(const QPoint &pos)
{
- QWindowList list = QGuiApplication::topLevelWindows();
- for (int i = list.count()-1; i >= 0; --i) {
- QWindow *w = list.at(i);
+ const QWindowList list = QGuiApplication::topLevelWindows();
+ const auto crend = list.crend();
+ for (auto it = list.crbegin(); it != crend; ++it) {
+ QWindow *w = *it;
if (w->isVisible() && w->handle() && w->geometry().contains(pos) && !qobject_cast<QShapedPixmapWindow*>(w))
return w;
}
@@ -114,7 +79,7 @@ void QBasicDrag::disableEventFilter()
static inline QPoint getNativeMousePos(QEvent *e, QWindow *window)
{
- return QHighDpi::toNativePixels(static_cast<QMouseEvent *>(e)->globalPos(), window);
+ return QHighDpi::toNativePixels(static_cast<QMouseEvent *>(e)->globalPosition().toPoint(), window);
}
bool QBasicDrag::eventFilter(QObject *o, QEvent *e)
@@ -145,19 +110,22 @@ bool QBasicDrag::eventFilter(QObject *o, QEvent *e)
disableEventFilter();
exitDndEventLoop();
+ } else if (ke->modifiers() != QGuiApplication::keyboardModifiers()) {
+ move(m_lastPos, QGuiApplication::mouseButtons(), ke->modifiers());
}
return true; // Eat all key events
}
case QEvent::MouseMove:
{
- QPoint nativePosition = getNativeMousePos(e, m_drag_icon_window);
+ m_lastPos = getNativeMousePos(e, m_drag_icon_window);
auto mouseMove = static_cast<QMouseEvent *>(e);
- move(nativePosition, mouseMove->buttons(), mouseMove->modifiers());
+ move(m_lastPos, mouseMove->buttons(), mouseMove->modifiers());
return true; // Eat all mouse move events
}
case QEvent::MouseButtonRelease:
{
+ QPointer<QObject> objGuard(o);
disableEventFilter();
if (canDrop()) {
QPoint nativePosition = getNativeMousePos(e, m_drag_icon_window);
@@ -167,6 +135,8 @@ bool QBasicDrag::eventFilter(QObject *o, QEvent *e)
cancel();
}
exitDndEventLoop();
+ if (!objGuard)
+ return true;
// If a QShapedPixmapWindow (drag feedback) is being dragged along, the
// mouse event's localPos() will be relative to that, which is useless.
@@ -174,15 +144,15 @@ bool QBasicDrag::eventFilter(QObject *o, QEvent *e)
// If there is no such window (belonging to this Qt application),
// make the event relative to the window where the drag started. (QTBUG-66103)
const QMouseEvent *release = static_cast<QMouseEvent *>(e);
- const QWindow *releaseWindow = topLevelAt(release->globalPos());
- qCDebug(lcDnd) << "mouse released over" << releaseWindow << "after drag from" << m_sourceWindow << "globalPos" << release->globalPos();
+ const QWindow *releaseWindow = topLevelAt(release->globalPosition().toPoint());
+ qCDebug(lcDnd) << "mouse released over" << releaseWindow << "after drag from" << m_sourceWindow << "globalPos" << release->globalPosition().toPoint();
if (!releaseWindow)
releaseWindow = m_sourceWindow;
- QPoint releaseWindowPos = (releaseWindow ? releaseWindow->mapFromGlobal(release->globalPos()) : release->globalPos());
+ QPointF releaseWindowPos = (releaseWindow ? releaseWindow->mapFromGlobal(release->globalPosition()) : release->globalPosition());
QMouseEvent *newRelease = new QMouseEvent(release->type(),
- releaseWindowPos, releaseWindowPos, release->screenPos(),
+ releaseWindowPos, releaseWindowPos, release->globalPosition(),
release->button(), release->buttons(),
- release->modifiers(), release->source());
+ release->modifiers(), release->source(), release->pointingDevice());
QCoreApplication::postEvent(o, newRelease);
return true; // defer mouse release events until drag event loop has returned
}
@@ -230,6 +200,7 @@ void QBasicDrag::startDrag()
pos = QPoint();
}
#endif
+ m_lastPos = pos;
recreateShapedPixmapWindow(m_screen, pos);
enableEventFilter();
}
@@ -339,7 +310,7 @@ static inline QPoint fromNativeGlobalPixels(const QPoint &point)
#ifndef QT_NO_HIGHDPISCALING
QPoint res = point;
if (QHighDpiScaling::isActive()) {
- for (const QScreen *s : qAsConst(QGuiApplicationPrivate::screen_list)) {
+ for (const QScreen *s : std::as_const(QGuiApplicationPrivate::screen_list)) {
if (s->handle()->geometry().contains(point)) {
res = QHighDpi::fromNativePixels(point, s);
break;
diff --git a/src/gui/kernel/qsimpledrag_p.h b/src/gui/kernel/qsimpledrag_p.h
index 8638b05155..32ba1cef6f 100644
--- a/src/gui/kernel/qsimpledrag_p.h
+++ b/src/gui/kernel/qsimpledrag_p.h
@@ -1,41 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the QtGui module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#ifndef QSIMPLEDRAG_P_H
#define QSIMPLEDRAG_P_H
@@ -126,6 +90,7 @@ private:
QShapedPixmapWindow *m_drag_icon_window = nullptr;
bool m_useCompositing = true;
QScreen *m_screen = nullptr;
+ QPoint m_lastPos;
};
class Q_GUI_EXPORT QSimpleDrag : public QBasicDrag
diff --git a/src/gui/kernel/qstylehints.cpp b/src/gui/kernel/qstylehints.cpp
index 7b3c70c51b..5029701f24 100644
--- a/src/gui/kernel/qstylehints.cpp
+++ b/src/gui/kernel/qstylehints.cpp
@@ -1,43 +1,8 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the QtGui module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#include <qstylehints.h>
+#include "qstylehints_p.h"
#include <qpa/qplatformintegration.h>
#include <qpa/qplatformtheme.h>
#include <private/qguiapplication_p.h>
@@ -79,25 +44,6 @@ static inline QVariant themeableHint(QPlatformTheme::ThemeHint th)
return QPlatformTheme::defaultThemeHint(th);
}
-class QStyleHintsPrivate : public QObjectPrivate
-{
- Q_DECLARE_PUBLIC(QStyleHints)
-public:
- int m_mouseDoubleClickInterval = -1;
- int m_mousePressAndHoldInterval = -1;
- int m_startDragDistance = -1;
- int m_startDragTime = -1;
- int m_keyboardInputInterval = -1;
- int m_cursorFlashTime = -1;
- int m_tabFocusBehavior = -1;
- int m_uiEffects = -1;
- int m_showShortcutsInContextMenus = -1;
- int m_wheelScrollLines = -1;
- int m_mouseQuickSelectionThreshold = -1;
- int m_mouseDoubleClickDistance = -1;
- int m_touchDoubleTapDistance = -1;
-};
-
/*!
\class QStyleHints
\since 5.0
@@ -107,11 +53,10 @@ public:
An object of this class, obtained from QGuiApplication, provides access to certain global
user interface parameters of the current platform.
- Access is read only; typically the platform itself provides the user a way to tune these
- parameters.
-
- Access to these parameters are useful when implementing custom user interface components, in that
- they allow the components to exhibit the same behaviour and feel as other components.
+ Access to most settings is read only. The platform itself usually provides the user with
+ ways to tune these parameters. Authors of custom user interface components should read
+ relevant settings to allow the components to exhibit the same behavior and feel as other
+ components.
\sa QGuiApplication::styleHints()
*/
@@ -159,7 +104,7 @@ int QStyleHints::mouseDoubleClickDistance() const
Q_D(const QStyleHints);
return d->m_mouseDoubleClickDistance >= 0 ?
d->m_mouseDoubleClickDistance :
- themeableHint(QPlatformTheme::MouseDoubleClickDistance).toInt();
+ themeableHint(QPlatformTheme::MouseDoubleClickDistance, QPlatformIntegration::MouseDoubleClickDistance).toInt();
}
/*!
@@ -177,6 +122,18 @@ int QStyleHints::touchDoubleTapDistance() const
}
/*!
+ \property QStyleHints::colorScheme
+ \brief the color scheme of the platform theme.
+ \sa Qt::ColorScheme
+ \since 6.5
+*/
+Qt::ColorScheme QStyleHints::colorScheme() const
+{
+ Q_D(const QStyleHints);
+ return d->colorScheme();
+}
+
+/*!
Sets the \a mousePressAndHoldInterval.
\internal
\sa mousePressAndHoldInterval()
@@ -322,15 +279,29 @@ int QStyleHints::keyboardInputInterval() const
themeableHint(QPlatformTheme::KeyboardInputInterval, QPlatformIntegration::KeyboardInputInterval).toInt();
}
+#if QT_DEPRECATED_SINCE(6, 5)
/*!
\property QStyleHints::keyboardAutoRepeatRate
\brief the rate, in events per second, in which additional repeated key
presses will automatically be generated if a key is being held down.
+ \deprecated [6.5] Use keyboardAutoRepeatRateF() instead
*/
int QStyleHints::keyboardAutoRepeatRate() const
{
return themeableHint(QPlatformTheme::KeyboardAutoRepeatRate, QPlatformIntegration::KeyboardAutoRepeatRate).toInt();
}
+#endif
+
+/*!
+ \property QStyleHints::keyboardAutoRepeatRateF
+ \since 6.5
+ \brief the rate, in events per second, in which additional repeated key
+ presses will automatically be generated if a key is being held down.
+*/
+qreal QStyleHints::keyboardAutoRepeatRateF() const
+{
+ return themeableHint(QPlatformTheme::KeyboardAutoRepeatRate, QPlatformIntegration::KeyboardAutoRepeatRate).toReal();
+}
/*!
Sets the \a cursorFlashTime.
@@ -406,6 +377,8 @@ bool QStyleHints::showIsMaximized() const
Since Qt 5.13, the setShowShortcutsInContextMenus() function can be used to
override the platform default.
+
+ \sa Qt::AA_DontShowShortcutsInContextMenus
*/
bool QStyleHints::showShortcutsInContextMenus() const
{
@@ -476,7 +449,7 @@ bool QStyleHints::useRtlExtensions() const
*/
bool QStyleHints::setFocusOnTouchRelease() const
{
- return hint(QPlatformIntegration::SetFocusOnTouchRelease).toBool();
+ return themeableHint(QPlatformTheme::SetFocusOnTouchRelease, QPlatformIntegration::SetFocusOnTouchRelease).toBool();
}
/*!
@@ -620,4 +593,31 @@ int QStyleHints::mouseQuickSelectionThreshold() const
return themeableHint(QPlatformTheme::MouseQuickSelectionThreshold, QPlatformIntegration::MouseQuickSelectionThreshold).toInt();
}
+/*!
+ \internal
+ QStyleHintsPrivate::updateColorScheme - set a new color scheme.
+
+ This function is called by the QPA plugin when the system theme changes. This in
+ turn might be the result of an explicit request of a color scheme via setColorScheme.
+
+ Set \a colorScheme as the new color scheme of the QStyleHints.
+ The colorSchemeChanged signal will be emitted if present and new color scheme differ.
+ */
+void QStyleHintsPrivate::updateColorScheme(Qt::ColorScheme colorScheme)
+{
+ if (m_colorScheme == colorScheme)
+ return;
+ m_colorScheme = colorScheme;
+ Q_Q(QStyleHints);
+ emit q->colorSchemeChanged(colorScheme);
+}
+
+QStyleHintsPrivate *QStyleHintsPrivate::get(QStyleHints *q)
+{
+ Q_ASSERT(q);
+ return q->d_func();
+}
+
QT_END_NAMESPACE
+
+#include "moc_qstylehints.cpp"
diff --git a/src/gui/kernel/qstylehints.h b/src/gui/kernel/qstylehints.h
index 30d8fdc64d..969bec4b35 100644
--- a/src/gui/kernel/qstylehints.h
+++ b/src/gui/kernel/qstylehints.h
@@ -1,41 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the QtGui module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#ifndef QSTYLEHINTS_H
#define QSTYLEHINTS_H
@@ -55,27 +19,40 @@ class Q_GUI_EXPORT QStyleHints : public QObject
Q_DECLARE_PRIVATE(QStyleHints)
Q_PROPERTY(int cursorFlashTime READ cursorFlashTime NOTIFY cursorFlashTimeChanged FINAL)
Q_PROPERTY(qreal fontSmoothingGamma READ fontSmoothingGamma STORED false CONSTANT FINAL)
+#if QT_DEPRECATED_SINCE(6, 5)
Q_PROPERTY(int keyboardAutoRepeatRate READ keyboardAutoRepeatRate STORED false CONSTANT FINAL)
- Q_PROPERTY(int keyboardInputInterval READ keyboardInputInterval NOTIFY keyboardInputIntervalChanged FINAL)
- Q_PROPERTY(int mouseDoubleClickInterval READ mouseDoubleClickInterval NOTIFY mouseDoubleClickIntervalChanged FINAL)
- Q_PROPERTY(int mousePressAndHoldInterval READ mousePressAndHoldInterval NOTIFY mousePressAndHoldIntervalChanged FINAL)
+#endif
+ Q_PROPERTY(qreal keyboardAutoRepeatRateF READ keyboardAutoRepeatRateF STORED false CONSTANT FINAL)
+ Q_PROPERTY(int keyboardInputInterval READ keyboardInputInterval
+ NOTIFY keyboardInputIntervalChanged FINAL)
+ Q_PROPERTY(int mouseDoubleClickInterval READ mouseDoubleClickInterval
+ NOTIFY mouseDoubleClickIntervalChanged FINAL)
+ Q_PROPERTY(int mousePressAndHoldInterval READ mousePressAndHoldInterval
+ NOTIFY mousePressAndHoldIntervalChanged FINAL)
Q_PROPERTY(QChar passwordMaskCharacter READ passwordMaskCharacter STORED false CONSTANT FINAL)
Q_PROPERTY(int passwordMaskDelay READ passwordMaskDelay STORED false CONSTANT FINAL)
Q_PROPERTY(bool setFocusOnTouchRelease READ setFocusOnTouchRelease STORED false CONSTANT FINAL)
Q_PROPERTY(bool showIsFullScreen READ showIsFullScreen STORED false CONSTANT FINAL)
Q_PROPERTY(bool showIsMaximized READ showIsMaximized STORED false CONSTANT FINAL)
- Q_PROPERTY(bool showShortcutsInContextMenus READ showShortcutsInContextMenus WRITE setShowShortcutsInContextMenus NOTIFY showShortcutsInContextMenusChanged FINAL)
+ Q_PROPERTY(bool showShortcutsInContextMenus READ showShortcutsInContextMenus
+ WRITE setShowShortcutsInContextMenus NOTIFY showShortcutsInContextMenusChanged FINAL)
Q_PROPERTY(int startDragDistance READ startDragDistance NOTIFY startDragDistanceChanged FINAL)
Q_PROPERTY(int startDragTime READ startDragTime NOTIFY startDragTimeChanged FINAL)
Q_PROPERTY(int startDragVelocity READ startDragVelocity STORED false CONSTANT FINAL)
Q_PROPERTY(bool useRtlExtensions READ useRtlExtensions STORED false CONSTANT FINAL)
- Q_PROPERTY(Qt::TabFocusBehavior tabFocusBehavior READ tabFocusBehavior NOTIFY tabFocusBehaviorChanged FINAL)
+ Q_PROPERTY(Qt::TabFocusBehavior tabFocusBehavior READ tabFocusBehavior
+ NOTIFY tabFocusBehaviorChanged FINAL)
Q_PROPERTY(bool singleClickActivation READ singleClickActivation STORED false CONSTANT FINAL)
- Q_PROPERTY(bool useHoverEffects READ useHoverEffects WRITE setUseHoverEffects NOTIFY useHoverEffectsChanged FINAL)
+ Q_PROPERTY(bool useHoverEffects READ useHoverEffects WRITE setUseHoverEffects
+ NOTIFY useHoverEffectsChanged FINAL)
Q_PROPERTY(int wheelScrollLines READ wheelScrollLines NOTIFY wheelScrollLinesChanged FINAL)
- Q_PROPERTY(int mouseQuickSelectionThreshold READ mouseQuickSelectionThreshold WRITE setMouseQuickSelectionThreshold NOTIFY mouseQuickSelectionThresholdChanged FINAL)
- Q_PROPERTY(int mouseDoubleClickDistance READ mouseDoubleClickDistance STORED false CONSTANT FINAL)
+ Q_PROPERTY(int mouseQuickSelectionThreshold READ mouseQuickSelectionThreshold
+ WRITE setMouseQuickSelectionThreshold NOTIFY mouseQuickSelectionThresholdChanged
+ FINAL)
+ Q_PROPERTY(int mouseDoubleClickDistance READ mouseDoubleClickDistance STORED false CONSTANT
+ FINAL)
Q_PROPERTY(int touchDoubleTapDistance READ touchDoubleTapDistance STORED false CONSTANT FINAL)
+ Q_PROPERTY(Qt::ColorScheme colorScheme READ colorScheme NOTIFY colorSchemeChanged FINAL)
public:
void setMouseDoubleClickInterval(int mouseDoubleClickInterval);
@@ -91,7 +68,11 @@ public:
int startDragVelocity() const;
void setKeyboardInputInterval(int keyboardInputInterval);
int keyboardInputInterval() const;
+#if QT_DEPRECATED_SINCE(6, 5)
+ QT_DEPRECATED_VERSION_X_6_5("Use keyboardAutoRepeatRateF() instead")
int keyboardAutoRepeatRate() const;
+#endif
+ qreal keyboardAutoRepeatRateF() const;
void setCursorFlashTime(int cursorFlashTime);
int cursorFlashTime() const;
bool showIsFullScreen() const;
@@ -112,6 +93,7 @@ public:
void setWheelScrollLines(int scrollLines);
void setMouseQuickSelectionThreshold(int threshold);
int mouseQuickSelectionThreshold() const;
+ Qt::ColorScheme colorScheme() const;
Q_SIGNALS:
void cursorFlashTimeChanged(int cursorFlashTime);
@@ -125,6 +107,7 @@ Q_SIGNALS:
void showShortcutsInContextMenusChanged(bool);
void wheelScrollLinesChanged(int scrollLines);
void mouseQuickSelectionThresholdChanged(int threshold);
+ void colorSchemeChanged(Qt::ColorScheme colorScheme);
private:
friend class QGuiApplication;
diff --git a/src/gui/kernel/qstylehints_p.h b/src/gui/kernel/qstylehints_p.h
new file mode 100644
index 0000000000..2b3979512a
--- /dev/null
+++ b/src/gui/kernel/qstylehints_p.h
@@ -0,0 +1,54 @@
+// Copyright (C) 2022 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
+
+#ifndef QSTYLEHINTS_P_H
+#define QSTYLEHINTS_P_H
+
+//
+// W A R N I N G
+// -------------
+//
+// This file is not part of the Qt API. It exists purely as an
+// implementation detail. This header file may change from version to
+// version without notice, or even be removed.
+//
+// We mean it.
+//
+
+#include <qpa/qplatformintegration.h>
+#include <QPalette>
+#include <private/qguiapplication_p.h>
+#include "qstylehints.h"
+
+QT_BEGIN_NAMESPACE
+
+class QStyleHintsPrivate : public QObjectPrivate
+{
+ Q_DECLARE_PUBLIC(QStyleHints)
+public:
+ int m_mouseDoubleClickInterval = -1;
+ int m_mousePressAndHoldInterval = -1;
+ int m_startDragDistance = -1;
+ int m_startDragTime = -1;
+ int m_keyboardInputInterval = -1;
+ int m_cursorFlashTime = -1;
+ int m_tabFocusBehavior = -1;
+ int m_uiEffects = -1;
+ int m_showShortcutsInContextMenus = -1;
+ int m_wheelScrollLines = -1;
+ int m_mouseQuickSelectionThreshold = -1;
+ int m_mouseDoubleClickDistance = -1;
+ int m_touchDoubleTapDistance = -1;
+
+ Qt::ColorScheme colorScheme() const { return m_colorScheme; }
+ void updateColorScheme(Qt::ColorScheme colorScheme);
+
+ static QStyleHintsPrivate *get(QStyleHints *q);
+
+private:
+ Qt::ColorScheme m_colorScheme = Qt::ColorScheme::Unknown;
+};
+
+QT_END_NAMESPACE
+
+#endif
diff --git a/src/gui/kernel/qsurface.cpp b/src/gui/kernel/qsurface.cpp
index 85c576b21c..c00cf55a09 100644
--- a/src/gui/kernel/qsurface.cpp
+++ b/src/gui/kernel/qsurface.cpp
@@ -1,41 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the QtGui module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#include "qsurface.h"
#include "qopenglcontext.h"
@@ -44,6 +8,7 @@
QT_BEGIN_NAMESPACE
+QT_IMPL_METATYPE_EXTERN_TAGGED(QSurface*, QSurface_ptr)
/*!
\class QSurface
@@ -65,13 +30,12 @@ QT_BEGIN_NAMESPACE
\value Offscreen The surface is an instance of QOffscreenSurface.
*/
-
/*!
\enum QSurface::SurfaceType
The SurfaceType enum describes what type of surface this is.
- \value RasterSurface The surface is is composed of pixels and can be rendered to using
+ \value RasterSurface The surface is composed of pixels and can be rendered to using
a software rasterizer like Qt's raster paint engine.
\value OpenGLSurface The surface is an OpenGL compatible surface and can be used
in conjunction with QOpenGLContext.
@@ -83,12 +47,13 @@ QT_BEGIN_NAMESPACE
\value VulkanSurface The surface is a Vulkan compatible surface and can be used
in conjunction with the Vulkan graphics API.
\value MetalSurface The surface is a Metal compatible surface and can be used
- in conjunction with Apple's Metal graphics API. This surface type is supported
- on macOS only.
-
+ in conjunction with Apple's Metal graphics API. This surface type is only supported
+ on \macos and iOS.
+ \value Direct3DSurface The surface is a Direct 3D 11 and 12 compatible
+ surface and can be used in conjunction with the DXGI and Direct3D APIs. This
+ surface type is only supported on Windows.
*/
-
/*!
\fn QSurfaceFormat QSurface::format() const
@@ -160,3 +125,5 @@ QSurface::SurfaceClass QSurface::surfaceClass() const
QT_END_NAMESPACE
+#include "moc_qsurface.cpp"
+
diff --git a/src/gui/kernel/qsurface.h b/src/gui/kernel/qsurface.h
index 521593ea5c..ef70beab21 100644
--- a/src/gui/kernel/qsurface.h
+++ b/src/gui/kernel/qsurface.h
@@ -1,41 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the QtGui module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#ifndef QSURFACE_H
#define QSURFACE_H
@@ -69,7 +33,8 @@ public:
RasterGLSurface,
OpenVGSurface,
VulkanSurface,
- MetalSurface
+ MetalSurface,
+ Direct3DSurface
};
Q_ENUM(SurfaceType)
@@ -95,6 +60,6 @@ protected:
QT_END_NAMESPACE
-Q_DECLARE_METATYPE(QSurface*)
+QT_DECL_METATYPE_EXTERN_TAGGED(QSurface*, QSurface_ptr, Q_GUI_EXPORT)
#endif //QSURFACE_H
diff --git a/src/gui/kernel/qsurfaceformat.cpp b/src/gui/kernel/qsurfaceformat.cpp
index 571b820409..74add6e973 100644
--- a/src/gui/kernel/qsurfaceformat.cpp
+++ b/src/gui/kernel/qsurfaceformat.cpp
@@ -1,47 +1,12 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the QtGui module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#include "qsurfaceformat.h"
#include <QtCore/qatomic.h>
#include <QtCore/QDebug>
#include <QOpenGLContext>
+#include <QtGui/qcolorspace.h>
#include <QtGui/qguiapplication.h>
#ifdef major
@@ -73,7 +38,6 @@ public:
, major(2)
, minor(0)
, swapInterval(1) // default to vsync
- , colorSpace(QSurfaceFormat::DefaultColorSpace)
{
}
@@ -112,7 +76,7 @@ public:
int major;
int minor;
int swapInterval;
- QSurfaceFormat::ColorSpace colorSpace;
+ QColorSpace colorSpace;
};
/*!
@@ -148,7 +112,13 @@ public:
\value ResetNotification Enables notifications about resets of the OpenGL context. The status is then
queryable via the context's \l{QOpenGLContext::isValid()}{isValid()} function. Note that not setting
this flag does not guarantee that context state loss never occurs. Additionally, some implementations
- may choose to report context loss regardless of this flag.
+ may choose to report context loss regardless of this flag. Platforms that support dynamically enabling
+ the monitoring of the loss of context, such as, Windows with WGL, or Linux/X11 (xcb) with GLX, will
+ monitor the status in every call to \l{QOpenGLContext::makeCurrent()}{makeCurrent()}. See
+ \l{QOpenGLContext::isValid()}{isValid()} for more information on this.
+ \value ProtectedContent Enables access to protected content. This allows the GPU to operate on protected
+ resources (surfaces, buffers, textures), for example DRM-protected video content.
+ Currently only implemented for EGL.
*/
/*!
@@ -343,49 +313,14 @@ void QSurfaceFormat::setSamples(int numSamples)
}
}
-#if QT_DEPRECATED_SINCE(5, 2)
-/*!
- \obsolete
- \overload
-
- Use setOption(QSurfaceFormat::FormatOption, bool) or setOptions() instead.
-
- Sets the format options to the OR combination of \a opt and the
- current format options.
-
- \sa options(), testOption()
-*/
-void QSurfaceFormat::setOption(QSurfaceFormat::FormatOptions opt)
-{
- const QSurfaceFormat::FormatOptions newOptions = d->opts | opt;
- if (int(newOptions) != int(d->opts)) {
- detach();
- d->opts = newOptions;
- }
-}
-
-/*!
- \obsolete
- \overload
-
- Use testOption(QSurfaceFormat::FormatOption) instead.
-
- Returns \c true if any of the options in \a opt is currently set
- on this object; otherwise returns false.
-
- \sa setOption()
-*/
-bool QSurfaceFormat::testOption(QSurfaceFormat::FormatOptions opt) const
-{
- return d->opts & opt;
-}
-#endif // QT_DEPRECATED_SINCE(5, 2)
-
/*!
\since 5.3
Sets the format options to \a options.
+ To verify that an option was respected, compare the actual format to the
+ requested format after surface/context creation.
+
\sa options(), testOption()
*/
void QSurfaceFormat::setOptions(QSurfaceFormat::FormatOptions options)
@@ -401,6 +336,9 @@ void QSurfaceFormat::setOptions(QSurfaceFormat::FormatOptions options)
Sets the format option \a option if \a on is true; otherwise, clears the option.
+ To verify that an option was respected, compare the actual format to the
+ requested format after surface/context creation.
+
\sa setOptions(), options(), testOption()
*/
void QSurfaceFormat::setOption(QSurfaceFormat::FormatOption option, bool on)
@@ -767,11 +705,11 @@ int QSurfaceFormat::swapInterval() const
blending to be performed in the given color space instead of using the
standard linear operations.
- \since 5.10
+ \since 6.0
\sa colorSpace()
*/
-void QSurfaceFormat::setColorSpace(ColorSpace colorSpace)
+void QSurfaceFormat::setColorSpace(const QColorSpace &colorSpace)
{
if (d->colorSpace != colorSpace) {
detach();
@@ -779,6 +717,30 @@ void QSurfaceFormat::setColorSpace(ColorSpace colorSpace)
}
}
+#if QT_DEPRECATED_SINCE(6, 0)
+/*!
+ \overload
+ \deprecated [6.0] Use setColorSpace(QColorSpace) instead.
+
+ Sets the colorspace to one of the predefined values.
+
+ \since 5.10
+
+ \sa colorSpace()
+ */
+void QSurfaceFormat::setColorSpace(ColorSpace colorSpace)
+{
+ switch (colorSpace) {
+ case DefaultColorSpace:
+ setColorSpace(QColorSpace());
+ break;
+ case sRGBColorSpace:
+ setColorSpace(QColorSpace::SRgb);
+ break;
+ }
+}
+#endif // QT_DEPRECATED_SINCE(6, 0)
+
/*!
\return the color space.
@@ -786,7 +748,7 @@ void QSurfaceFormat::setColorSpace(ColorSpace colorSpace)
\sa setColorSpace()
*/
-QSurfaceFormat::ColorSpace QSurfaceFormat::colorSpace() const
+const QColorSpace &QSurfaceFormat::colorSpace() const
{
return d->colorSpace;
}
@@ -803,7 +765,7 @@ Q_GLOBAL_STATIC(QSurfaceFormat, qt_default_surface_format)
question's own setFormat() function. However, it is often more convenient to
set the format for all windows once at the start of the application. It also
guarantees proper behavior in cases where shared contexts are required,
- because settings the format via this function guarantees that all contexts
+ because setting the format via this function guarantees that all contexts
and surfaces, even the ones created internally by Qt, will use the same
format.
@@ -845,37 +807,37 @@ QSurfaceFormat QSurfaceFormat::defaultFormat()
}
/*!
- Returns \c true if all the options of the two QSurfaceFormat objects
- \a a and \a b are equal.
+ \fn bool QSurfaceFormat::operator==(const QSurfaceFormat& lhs, const QSurfaceFormat& rhs)
- \relates QSurfaceFormat
+ Returns \c true if all the options of the two QSurfaceFormat objects
+ \a lhs and \a rhs are equal.
*/
-bool operator==(const QSurfaceFormat& a, const QSurfaceFormat& b)
-{
- return (a.d == b.d) || ((int) a.d->opts == (int) b.d->opts
- && a.d->stencilSize == b.d->stencilSize
- && a.d->redBufferSize == b.d->redBufferSize
- && a.d->greenBufferSize == b.d->greenBufferSize
- && a.d->blueBufferSize == b.d->blueBufferSize
- && a.d->alphaBufferSize == b.d->alphaBufferSize
- && a.d->depthSize == b.d->depthSize
- && a.d->numSamples == b.d->numSamples
- && a.d->swapBehavior == b.d->swapBehavior
- && a.d->profile == b.d->profile
- && a.d->major == b.d->major
- && a.d->minor == b.d->minor
- && a.d->swapInterval == b.d->swapInterval);
-}
/*!
+ \fn bool QSurfaceFormat::operator!=(const QSurfaceFormat& lhs, const QSurfaceFormat& rhs)
+
Returns \c false if all the options of the two QSurfaceFormat objects
- \a a and \a b are equal; otherwise returns \c true.
+ \a lhs and \a rhs are equal; otherwise returns \c true.
+*/
- \relates QSurfaceFormat
+/*!
+ \internal
*/
-bool operator!=(const QSurfaceFormat& a, const QSurfaceFormat& b)
+bool QSurfaceFormat::equals(const QSurfaceFormat& other) const noexcept
{
- return !(a == b);
+ return (d == other.d) || ((int) d->opts == (int) other.d->opts
+ && d->stencilSize == other.d->stencilSize
+ && d->redBufferSize == other.d->redBufferSize
+ && d->greenBufferSize == other.d->greenBufferSize
+ && d->blueBufferSize == other.d->blueBufferSize
+ && d->alphaBufferSize == other.d->alphaBufferSize
+ && d->depthSize == other.d->depthSize
+ && d->numSamples == other.d->numSamples
+ && d->swapBehavior == other.d->swapBehavior
+ && d->profile == other.d->profile
+ && d->major == other.d->major
+ && d->minor == other.d->minor
+ && d->swapInterval == other.d->swapInterval);
}
#ifndef QT_NO_DEBUG_STREAM
@@ -905,3 +867,5 @@ QDebug operator<<(QDebug dbg, const QSurfaceFormat &f)
#endif
QT_END_NAMESPACE
+
+#include "moc_qsurfaceformat.cpp"
diff --git a/src/gui/kernel/qsurfaceformat.h b/src/gui/kernel/qsurfaceformat.h
index ed63eb8bbf..07ee1cc07d 100644
--- a/src/gui/kernel/qsurfaceformat.h
+++ b/src/gui/kernel/qsurfaceformat.h
@@ -1,41 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the QtGui module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#ifndef QSURFACEFORMAT_H
#define QSURFACEFORMAT_H
@@ -45,7 +9,7 @@
QT_BEGIN_NAMESPACE
-
+class QColorSpace;
class QOpenGLContext;
class QSurfaceFormatPrivate;
@@ -57,7 +21,8 @@ public:
StereoBuffers = 0x0001,
DebugContext = 0x0002,
DeprecatedFunctions = 0x0004,
- ResetNotification = 0x0008
+ ResetNotification = 0x0008,
+ ProtectedContent = 0x0010
};
Q_ENUM(FormatOption)
Q_DECLARE_FLAGS(FormatOptions, FormatOption)
@@ -85,14 +50,16 @@ public:
};
Q_ENUM(OpenGLContextProfile)
+#if QT_DEPRECATED_SINCE(6,0)
enum ColorSpace {
DefaultColorSpace,
sRGBColorSpace
};
Q_ENUM(ColorSpace)
+#endif
QSurfaceFormat();
- /*implicit*/ QSurfaceFormat(FormatOptions options);
+ Q_IMPLICIT QSurfaceFormat(FormatOptions options);
QSurfaceFormat(const QSurfaceFormat &other);
QSurfaceFormat &operator=(const QSurfaceFormat &other);
~QSurfaceFormat();
@@ -138,11 +105,6 @@ public:
bool stereo() const;
void setStereo(bool enable);
-#if QT_DEPRECATED_SINCE(5, 2)
- QT_DEPRECATED void setOption(QSurfaceFormat::FormatOptions opt);
- QT_DEPRECATED bool testOption(QSurfaceFormat::FormatOptions opt) const;
-#endif
-
void setOptions(QSurfaceFormat::FormatOptions options);
void setOption(FormatOption option, bool on = true);
bool testOption(FormatOption option) const;
@@ -151,8 +113,12 @@ public:
int swapInterval() const;
void setSwapInterval(int interval);
- ColorSpace colorSpace() const;
+ const QColorSpace &colorSpace() const;
+ void setColorSpace(const QColorSpace &colorSpace);
+#if QT_DEPRECATED_SINCE(6,0)
+ Q_DECL_DEPRECATED_X("Use setColorSpace(QColorSpace) instead.")
void setColorSpace(ColorSpace colorSpace);
+#endif
static void setDefaultFormat(const QSurfaceFormat &format);
static QSurfaceFormat defaultFormat();
@@ -161,17 +127,17 @@ private:
QSurfaceFormatPrivate *d;
void detach();
+ bool equals(const QSurfaceFormat &other) const noexcept;
- friend Q_GUI_EXPORT bool operator==(const QSurfaceFormat&, const QSurfaceFormat&);
- friend Q_GUI_EXPORT bool operator!=(const QSurfaceFormat&, const QSurfaceFormat&);
+ friend inline bool operator==(const QSurfaceFormat &lhs, const QSurfaceFormat &rhs) noexcept
+ { return lhs.equals(rhs); }
+ friend inline bool operator!=(const QSurfaceFormat &lhs, const QSurfaceFormat &rhs) noexcept
+ { return !lhs.equals(rhs); }
#ifndef QT_NO_DEBUG_STREAM
friend Q_GUI_EXPORT QDebug operator<<(QDebug, const QSurfaceFormat &);
#endif
};
-Q_GUI_EXPORT bool operator==(const QSurfaceFormat&, const QSurfaceFormat&);
-Q_GUI_EXPORT bool operator!=(const QSurfaceFormat&, const QSurfaceFormat&);
-
#ifndef QT_NO_DEBUG_STREAM
Q_GUI_EXPORT QDebug operator<<(QDebug, const QSurfaceFormat &);
#endif
diff --git a/src/gui/kernel/qt_gui_pch.h b/src/gui/kernel/qt_gui_pch.h
index 5e07fa45e7..fbde1cf9a2 100644
--- a/src/gui/kernel/qt_gui_pch.h
+++ b/src/gui/kernel/qt_gui_pch.h
@@ -1,41 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the QtGui module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
/*
* This is a precompiled header file for use in Xcode / Mac GCC /
@@ -48,6 +12,7 @@
#include "../../corelib/global/qt_pch.h"
#if defined __cplusplus
+#include <qtguiexports.h>
#include <qtguiglobal.h>
#include <qguiapplication.h>
#include <qbitmap.h>
diff --git a/src/gui/kernel/qtestsupport_gui.cpp b/src/gui/kernel/qtestsupport_gui.cpp
index 79da26f2ca..869eddce49 100644
--- a/src/gui/kernel/qtestsupport_gui.cpp
+++ b/src/gui/kernel/qtestsupport_gui.cpp
@@ -1,43 +1,8 @@
-/****************************************************************************
-**
-** Copyright (C) 2018 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the QtGui module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2018 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#include <private/qguiapplication_p.h>
+#include <private/qeventpoint_p.h>
#include <qpa/qplatformintegration.h>
@@ -45,6 +10,7 @@
#include "qwindow.h"
#include <QtCore/qtestsupport_core.h>
+#include <QtCore/qthread.h>
#include <QtCore/QDebug>
QT_BEGIN_NAMESPACE
@@ -52,11 +18,18 @@ QT_BEGIN_NAMESPACE
/*!
\since 5.0
- Waits for \a timeout milliseconds or until the \a window is active.
+ Returns \c true, if \a window is active within \a timeout milliseconds. Otherwise returns \c false.
- Returns \c true if \c window is active within \a timeout milliseconds, otherwise returns \c false.
+ The method is useful in tests that call QWindow::show() and rely on the window actually being
+ active (i.e. being visible and having focus) before proceeding.
- \sa qWaitForWindowExposed(), QWindow::isActive()
+ \note The method will time out and return \c false if another window prevents \a window from
+ becoming active.
+
+ \note Since focus is an exclusive property, \a window may loose its focus to another window at
+ any time - even after the method has returned \c true.
+
+ \sa qWaitForWindowExposed(), qWaitForWindowFocused(), QWindow::isActive()
*/
Q_GUI_EXPORT bool QTest::qWaitForWindowActive(QWindow *window, int timeout)
{
@@ -72,17 +45,37 @@ Q_GUI_EXPORT bool QTest::qWaitForWindowActive(QWindow *window, int timeout)
}
/*!
+ \since 6.7
+
+ Returns \c true, if \a window is the focus window within \a timeout. Otherwise returns \c false.
+
+ The method is useful in tests that call QWindow::show() and rely on the window
+ having focus (for receiving keyboard events e.g.) before proceeding.
+
+ \note The method will time out and return \c false if another window prevents \a window from
+ becoming focused.
+
+ \note Since focus is an exclusive property, \a window may loose its focus to another window at
+ any time - even after the method has returned \c true.
+
+ \sa qWaitForWindowExposed(), qWaitForWindowActive(), QGuiApplication::focusWindow()
+*/
+Q_GUI_EXPORT bool QTest::qWaitForWindowFocused(QWindow *window, QDeadlineTimer timeout)
+{
+ return QTest::qWaitFor([&]() { return qGuiApp->focusWindow() == window; }, timeout);
+}
+
+/*!
\since 5.0
- Waits for \a timeout milliseconds or until the \a window is exposed.
- Returns \c true if \c window is exposed within \a timeout milliseconds, otherwise returns \c false.
+ Returns \c true, if \a window is exposed within \a timeout milliseconds. Otherwise returns \c false.
- This is mainly useful for asynchronous systems like X11, where a window will be mapped to screen some
- time after being asked to show itself on the screen.
+ The method is useful in tests that call QWindow::show() and rely on the window actually being
+ being visible before proceeding.
- Note that a window that is mapped to screen may still not be considered exposed if the window client
- area is completely covered by other windows, or if the window is otherwise not visible. This function
- will then time out when waiting for such a window.
+ \note A window mapped to screen may still not be considered exposed, if the window client area is
+ not visible, e.g. because it is completely covered by other windows.
+ In such cases, the method will time out and return \c false.
\sa qWaitForWindowActive(), QWindow::isExposed()
*/
@@ -91,4 +84,86 @@ Q_GUI_EXPORT bool QTest::qWaitForWindowExposed(QWindow *window, int timeout)
return QTest::qWaitFor([&]() { return window->isExposed(); }, timeout);
}
+namespace QTest {
+
+QTouchEventSequence::~QTouchEventSequence()
+{
+ if (commitWhenDestroyed)
+ QTouchEventSequence::commit();
+}
+QTouchEventSequence& QTouchEventSequence::press(int touchId, const QPoint &pt, QWindow *window)
+{
+ auto &p = point(touchId);
+ QMutableEventPoint::setGlobalPosition(p, mapToScreen(window, pt));
+ QMutableEventPoint::setState(p, QEventPoint::State::Pressed);
+ return *this;
+}
+QTouchEventSequence& QTouchEventSequence::move(int touchId, const QPoint &pt, QWindow *window)
+{
+ auto &p = point(touchId);
+ QMutableEventPoint::setGlobalPosition(p, mapToScreen(window, pt));
+ QMutableEventPoint::setState(p, QEventPoint::State::Updated);
+ return *this;
+}
+QTouchEventSequence& QTouchEventSequence::release(int touchId, const QPoint &pt, QWindow *window)
+{
+ auto &p = point(touchId);
+ QMutableEventPoint::setGlobalPosition(p, mapToScreen(window, pt));
+ QMutableEventPoint::setState(p, QEventPoint::State::Released);
+ return *this;
+}
+QTouchEventSequence& QTouchEventSequence::stationary(int touchId)
+{
+ auto &p = pointOrPreviousPoint(touchId);
+ QMutableEventPoint::setState(p, QEventPoint::State::Stationary);
+ return *this;
+}
+
+bool QTouchEventSequence::commit(bool processEvents)
+{
+ if (points.isEmpty())
+ return false;
+ QThread::sleep(std::chrono::milliseconds{1});
+ bool ret = false;
+ if (targetWindow)
+ ret = qt_handleTouchEventv2(targetWindow, device, points.values());
+ if (processEvents)
+ QCoreApplication::processEvents();
+ previousPoints = points;
+ points.clear();
+ return ret;
+}
+
+QTouchEventSequence::QTouchEventSequence(QWindow *window, QPointingDevice *aDevice, bool autoCommit)
+ : targetWindow(window), device(aDevice), commitWhenDestroyed(autoCommit)
+{
+}
+
+QPoint QTouchEventSequence::mapToScreen(QWindow *window, const QPoint &pt)
+{
+ if (window)
+ return window->mapToGlobal(pt);
+ return targetWindow ? targetWindow->mapToGlobal(pt) : pt;
+}
+
+QEventPoint &QTouchEventSequence::point(int touchId)
+{
+ if (!points.contains(touchId))
+ points[touchId] = QEventPoint(touchId);
+ return points[touchId];
+}
+
+QEventPoint &QTouchEventSequence::pointOrPreviousPoint(int touchId)
+{
+ if (!points.contains(touchId)) {
+ if (previousPoints.contains(touchId))
+ points[touchId] = previousPoints.value(touchId);
+ else
+ points[touchId] = QEventPoint(touchId);
+ }
+ return points[touchId];
+}
+
+} // namespace QTest
+
QT_END_NAMESPACE
diff --git a/src/gui/kernel/qtestsupport_gui.h b/src/gui/kernel/qtestsupport_gui.h
index 1f0c4f0960..e5b2a88455 100644
--- a/src/gui/kernel/qtestsupport_gui.h
+++ b/src/gui/kernel/qtestsupport_gui.h
@@ -1,55 +1,63 @@
-/****************************************************************************
-**
-** Copyright (C) 2018 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the QtGui module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2018 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#ifndef QTESTSUPPORT_GUI_H
#define QTESTSUPPORT_GUI_H
#include <QtGui/qtguiglobal.h>
+#include <QtGui/qevent.h>
+#include <QtCore/qmap.h>
QT_BEGIN_NAMESPACE
class QWindow;
+Q_GUI_EXPORT void qt_handleTouchEvent(QWindow *w, const QPointingDevice *device,
+ const QList<QEventPoint> &points,
+ Qt::KeyboardModifiers mods = Qt::NoModifier);
+
+Q_GUI_EXPORT bool qt_handleTouchEventv2(QWindow *w, const QPointingDevice *device,
+ const QList<QEventPoint> &points,
+ Qt::KeyboardModifiers mods = Qt::NoModifier);
+
namespace QTest {
-Q_GUI_EXPORT Q_REQUIRED_RESULT bool qWaitForWindowActive(QWindow *window, int timeout = 5000);
-Q_GUI_EXPORT Q_REQUIRED_RESULT bool qWaitForWindowExposed(QWindow *window, int timeout = 5000);
-}
+
+[[nodiscard]] Q_GUI_EXPORT bool qWaitForWindowActive(QWindow *window, int timeout = 5000);
+[[nodiscard]] Q_GUI_EXPORT bool qWaitForWindowFocused(QWindow *widget, QDeadlineTimer timeout = std::chrono::seconds{5});
+[[nodiscard]] Q_GUI_EXPORT bool qWaitForWindowExposed(QWindow *window, int timeout = 5000);
+
+Q_GUI_EXPORT QPointingDevice * createTouchDevice(QInputDevice::DeviceType devType = QInputDevice::DeviceType::TouchScreen,
+ QInputDevice::Capabilities caps = QInputDevice::Capability::Position);
+
+class Q_GUI_EXPORT QTouchEventSequence
+{
+public:
+ virtual ~QTouchEventSequence();
+ QTouchEventSequence& press(int touchId, const QPoint &pt, QWindow *window = nullptr);
+ QTouchEventSequence& move(int touchId, const QPoint &pt, QWindow *window = nullptr);
+ QTouchEventSequence& release(int touchId, const QPoint &pt, QWindow *window = nullptr);
+ virtual QTouchEventSequence& stationary(int touchId);
+
+ virtual bool commit(bool processEvents = true);
+
+protected:
+ QTouchEventSequence(QWindow *window, QPointingDevice *aDevice, bool autoCommit);
+
+ QPoint mapToScreen(QWindow *window, const QPoint &pt);
+
+ QEventPoint &point(int touchId);
+
+ QEventPoint &pointOrPreviousPoint(int touchId);
+
+ QMap<int, QEventPoint> previousPoints;
+ QMap<int, QEventPoint> points;
+ QWindow *targetWindow;
+ QPointingDevice *device;
+ bool commitWhenDestroyed;
+ friend QTouchEventSequence touchEvent(QWindow *window, QPointingDevice *device, bool autoCommit);
+};
+
+} // namespace QTest
QT_END_NAMESPACE
diff --git a/src/gui/kernel/qtguiglobal.h b/src/gui/kernel/qtguiglobal.h
index 8a7409e3d9..cea6448755 100644
--- a/src/gui/kernel/qtguiglobal.h
+++ b/src/gui/kernel/qtguiglobal.h
@@ -1,60 +1,11 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the QtGui module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#ifndef QTGUIGLOBAL_H
#define QTGUIGLOBAL_H
#include <QtCore/qglobal.h>
#include <QtGui/qtgui-config.h>
-
-QT_BEGIN_NAMESPACE
-
-#ifndef QT_STATIC
-# if defined(QT_BUILD_GUI_LIB)
-# define Q_GUI_EXPORT Q_DECL_EXPORT
-# else
-# define Q_GUI_EXPORT Q_DECL_IMPORT
-# endif
-#else
-# define Q_GUI_EXPORT
-#endif
-
-QT_END_NAMESPACE
+#include <QtGui/qtguiexports.h>
#endif // QTGUIGLOBAL_H
diff --git a/src/gui/kernel/qtguiglobal_p.h b/src/gui/kernel/qtguiglobal_p.h
index d2c0b3c5d1..c9f341c172 100644
--- a/src/gui/kernel/qtguiglobal_p.h
+++ b/src/gui/kernel/qtguiglobal_p.h
@@ -1,41 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the QtGui module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#ifndef QTGUIGLOBAL_P_H
#define QTGUIGLOBAL_P_H
diff --git a/src/gui/kernel/qtouchdevice.cpp b/src/gui/kernel/qtouchdevice.cpp
deleted file mode 100644
index 8293fddc59..0000000000
--- a/src/gui/kernel/qtouchdevice.cpp
+++ /dev/null
@@ -1,292 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the QtGui module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "qtouchdevice.h"
-#include "qtouchdevice_p.h"
-#include <QList>
-#include <QMutex>
-#include <QCoreApplication>
-
-#include <private/qdebug_p.h>
-#include <private/qlocking_p.h>
-
-QT_BEGIN_NAMESPACE
-
-/*!
- \class QTouchDevice
- \brief The QTouchDevice class describes the device from which touch events originate.
- \since 5.0
- \ingroup touch
- \inmodule QtGui
-
- Each QTouchEvent contains a QTouchDevice pointer to allow accessing
- device-specific properties like type and capabilities. It is the
- responsibility of the platform or generic plug-ins to register the
- available touch devices via QWindowSystemInterface before generating any
- touch events. Applications do not need to instantiate this class, they
- should just access the global instances pointed to by QTouchEvent::device().
-*/
-
-/*! \enum QTouchDevice::DeviceType
-
- This enum represents the type of device that generated a QTouchEvent.
-
- \value TouchScreen In this type of device, the touch surface and display are integrated. This
- means the surface and display typically have the same size, such that there
- is a direct relationship between the touch points' physical positions and the
- coordinate reported by QTouchEvent::TouchPoint. As a result, Qt allows the
- user to interact directly with multiple QWidgets and QGraphicsItems at the
- same time.
-
- \value TouchPad In this type of device, the touch surface is separate from the display. There
- is not a direct relationship between the physical touch location and the
- on-screen coordinates. Instead, they are calculated relative to the current
- mouse position, and the user must use the touch-pad to move this reference
- point. Unlike touch-screens, Qt allows users to only interact with a single
- QWidget or QGraphicsItem at a time.
-*/
-
-/*! \enum QTouchDevice::CapabilityFlag
-
- This enum is used with QTouchDevice::capabilities() to indicate what kind of information the
- touch device or its driver can provide.
-
- \value Position Indicates that position information is available, meaning
- that the pos() family of functions in the touch points return valid points.
-
- \value Area Indicates that touch area information is available, meaning that the rect() family
- of functions in the touch points return valid rectangles.
-
- \value Pressure Indicates that pressure information is available, meaning that pressure()
- returns a valid value.
-
- \value Velocity Indicates that velocity information is available, meaning that velocity()
- returns a valid vector.
-
- \value RawPositions Indicates that the list returned by QTouchEvent::TouchPoint::rawScreenPositions()
- may contain one or more positions for each touch point. This is relevant when
- the touch input gets filtered or corrected on driver level.
-
- \value NormalizedPosition Indicates that the normalized position is available, meaning that normalizedPos()
- returns a valid value.
-
- \value MouseEmulation Indicates that the device synthesizes mouse events.
- This enum value has been introduced in Qt 5.5.
-*/
-
-/*!
- Creates a new touch device instance.
- By default the name is empty, the only capability is Position and type is TouchScreen.
- */
-QTouchDevice::QTouchDevice()
- : d(new QTouchDevicePrivate)
-{
-}
-
-/*!
- Destroys a touch device instance.
- */
-QTouchDevice::~QTouchDevice()
-{
- delete d;
-}
-
-/*!
- Returns the touch device type.
-*/
-QTouchDevice::DeviceType QTouchDevice::type() const
-{
- return d->type;
-}
-
-/*!
- Returns the touch device capabilities.
- */
-QTouchDevice::Capabilities QTouchDevice::capabilities() const
-{
- return d->caps;
-}
-
-/*!
- Returns the maximum number of simultaneous touch points (fingers) that
- can be detected.
- \since 5.2
- */
-int QTouchDevice::maximumTouchPoints() const
-{
- return d->maxTouchPoints;
-}
-
-/*!
- Returns the touch device name.
-
- This string may often be empty. It is however useful for systems that have
- more than one touch input device because there it can be used to
- differentiate between the devices (i.e. to tell from which device a
- QTouchEvent originates from).
-*/
-QString QTouchDevice::name() const
-{
- return d->name;
-}
-
-/*!
- Sets the device type \a devType.
- */
-void QTouchDevice::setType(DeviceType devType)
-{
- d->type = devType;
-}
-
-/*!
- Sets the capabilities \a caps supported by the device and its driver.
- */
-void QTouchDevice::setCapabilities(Capabilities caps)
-{
- d->caps = caps;
-}
-
-/*!
- Sets the maximum number of simultaneous touchpoints \a max
- supported by the device and its driver.
- */
-void QTouchDevice::setMaximumTouchPoints(int max)
-{
- d->maxTouchPoints = max;
-}
-
-/*!
- Sets the \a name (a unique identifier) for the device. In most systems it is
- enough to leave this unset and keep the default empty name. This identifier
- becomes important when having multiple touch devices and a need to
- differentiate between them.
- */
-void QTouchDevice::setName(const QString &name)
-{
- d->name = name;
-}
-
-static QBasicMutex devicesMutex;
-
-struct TouchDevices {
- TouchDevices();
- QList<const QTouchDevice *> list;
-};
-Q_GLOBAL_STATIC(TouchDevices, deviceList)
-
-TouchDevices::TouchDevices()
-{
- qAddPostRoutine([]{
- const auto locker = qt_scoped_lock(devicesMutex);
- qDeleteAll(qExchange(deviceList->list, {}));
- });
-}
-
-/*!
- Returns a list of all registered devices.
-
- \note The returned list cannot be used to add new devices. To add a simulated
- touch screen for an autotest, QTest::createTouchDevice() can be used.
- To add real touch screens to QPA plugins, the private
- \c QWindowSystemInterface::registerTouchDevice() function can be used.
- */
-QList<const QTouchDevice *> QTouchDevice::devices()
-{
- const auto locker = qt_scoped_lock(devicesMutex);
- return deviceList->list;
-}
-
-/*!
- \internal
- */
-bool QTouchDevicePrivate::isRegistered(const QTouchDevice *dev)
-{
- const auto locker = qt_scoped_lock(devicesMutex);
- return deviceList->list.contains(dev);
-}
-
-const QTouchDevice *QTouchDevicePrivate::deviceById(quint8 id)
-{
- const auto locker = qt_scoped_lock(devicesMutex);
- for (const QTouchDevice *dev : qAsConst(deviceList->list))
- if (QTouchDevicePrivate::get(const_cast<QTouchDevice *>(dev))->id == id)
- return dev;
- return nullptr;
-}
-
-/*!
- \internal
- */
-void QTouchDevicePrivate::registerDevice(const QTouchDevice *dev)
-{
- const auto locker = qt_scoped_lock(devicesMutex);
- deviceList->list.append(dev);
-}
-
-/*!
- \internal
- */
-void QTouchDevicePrivate::unregisterDevice(const QTouchDevice *dev)
-{
- const auto locker = qt_scoped_lock(devicesMutex);
- deviceList->list.removeOne(dev);
-}
-
-#ifndef QT_NO_DEBUG_STREAM
-QDebug operator<<(QDebug debug, const QTouchDevice *device)
-{
- QDebugStateSaver saver(debug);
- debug.nospace();
- debug.noquote();
- debug << "QTouchDevice(";
- if (device) {
- debug << '"' << device->name() << "\", type=";
- QtDebugUtils::formatQEnum(debug, device->type());
- debug << ", capabilities=";
- QtDebugUtils::formatQFlags(debug, device->capabilities());
- debug << ", maximumTouchPoints=" << device->maximumTouchPoints();
- } else {
- debug << '0';
- }
- debug << ')';
- return debug;
-}
-#endif // !QT_NO_DEBUG_STREAM
-
-QT_END_NAMESPACE
diff --git a/src/gui/kernel/qtouchdevice.h b/src/gui/kernel/qtouchdevice.h
deleted file mode 100644
index c98aa69236..0000000000
--- a/src/gui/kernel/qtouchdevice.h
+++ /dev/null
@@ -1,101 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the QtGui module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef QTOUCHDEVICE_H
-#define QTOUCHDEVICE_H
-
-#include <QtGui/qtguiglobal.h>
-#include <QtCore/qobject.h>
-
-QT_BEGIN_NAMESPACE
-
-class QDebug;
-class QTouchDevicePrivate;
-
-class Q_GUI_EXPORT QTouchDevice
-{
- Q_GADGET
-public:
- enum DeviceType {
- TouchScreen,
- TouchPad
- };
- Q_ENUM(DeviceType)
-
- enum CapabilityFlag {
- Position = 0x0001,
- Area = 0x0002,
- Pressure = 0x0004,
- Velocity = 0x0008,
- RawPositions = 0x0010,
- NormalizedPosition = 0x0020,
- MouseEmulation = 0x0040
- };
- Q_FLAG(CapabilityFlag)
- Q_DECLARE_FLAGS(Capabilities, CapabilityFlag)
-
- QTouchDevice();
- ~QTouchDevice();
-
- static QList<const QTouchDevice *> devices();
-
- QString name() const;
- DeviceType type() const;
- Capabilities capabilities() const;
- int maximumTouchPoints() const;
-
- void setName(const QString &name);
- void setType(DeviceType devType);
- void setCapabilities(Capabilities caps);
- void setMaximumTouchPoints(int max);
-
-private:
- QTouchDevicePrivate *d;
- friend class QTouchDevicePrivate;
-};
-
-Q_DECLARE_OPERATORS_FOR_FLAGS(QTouchDevice::Capabilities)
-
-#ifndef QT_NO_DEBUG_STREAM
-Q_GUI_EXPORT QDebug operator<<(QDebug, const QTouchDevice *);
-#endif
-
-QT_END_NAMESPACE
-
-#endif // QTOUCHDEVICE_H
diff --git a/src/gui/kernel/qtouchdevice_p.h b/src/gui/kernel/qtouchdevice_p.h
deleted file mode 100644
index fc45066c2d..0000000000
--- a/src/gui/kernel/qtouchdevice_p.h
+++ /dev/null
@@ -1,87 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the QtGui module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef QTOUCHDEVICE_P_H
-#define QTOUCHDEVICE_P_H
-
-//
-// W A R N I N G
-// -------------
-//
-// This file is not part of the Qt API. It exists purely as an
-// implementation detail. This header file may change from version to
-// version without notice, or even be removed.
-//
-// We mean it.
-//
-
-#include <QtGui/private/qtguiglobal_p.h>
-#include <QtGui/qtouchdevice.h>
-
-QT_BEGIN_NAMESPACE
-
-
-class QTouchDevicePrivate
-{
-public:
- QTouchDevicePrivate()
- : type(QTouchDevice::TouchScreen),
- caps(QTouchDevice::Position),
- maxTouchPoints(1)
- {
- static quint8 nextId = 2; // device 0 is not used, device 1 is for mouse device
- id = nextId++;
- }
-
- QTouchDevice::DeviceType type;
- QTouchDevice::Capabilities caps;
- QString name;
- int maxTouchPoints;
- quint8 id;
-
- static void registerDevice(const QTouchDevice *dev);
- static void unregisterDevice(const QTouchDevice *dev);
- static bool isRegistered(const QTouchDevice *dev);
- static const QTouchDevice *deviceById(quint8 id);
- static QTouchDevicePrivate *get(QTouchDevice *q) { return q->d; }
-};
-
-QT_END_NAMESPACE
-
-#endif // QTOUCHDEVICE_P_H
diff --git a/src/gui/kernel/qwindow.cpp b/src/gui/kernel/qwindow.cpp
index 74e0e6401e..b40fd7e8e8 100644
--- a/src/gui/kernel/qwindow.cpp
+++ b/src/gui/kernel/qwindow.cpp
@@ -1,46 +1,13 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the QtGui module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#include "qwindow.h"
#include <qpa/qplatformwindow.h>
#include <qpa/qplatformintegration.h>
+#ifndef QT_NO_CONTEXTMENU
+#include <qpa/qplatformtheme.h>
+#endif
#include "qsurfaceformat.h"
#ifndef QT_NO_OPENGL
#include <qpa/qplatformopenglcontext.h>
@@ -51,7 +18,7 @@
#include "qwindow_p.h"
#include "qguiapplication_p.h"
-#ifndef QT_NO_ACCESSIBILITY
+#if QT_CONFIG(accessibility)
# include "qaccessible.h"
#endif
#include "qhighdpiscaling_p.h"
@@ -66,6 +33,7 @@
#include <QStyleHints>
#include <qpa/qplatformcursor.h>
+#include <qpa/qplatformwindow_p.h>
QT_BEGIN_NAMESPACE
@@ -160,7 +128,7 @@ QWindow::QWindow(QScreen *targetScreen)
, QSurface(QSurface::Window)
{
Q_D(QWindow);
- d->init(targetScreen);
+ d->init(nullptr, targetScreen);
}
static QWindow *nonDesktopParent(QWindow *parent)
@@ -201,11 +169,11 @@ QWindow::QWindow(QWindow *parent)
\sa setParent()
*/
QWindow::QWindow(QWindowPrivate &dd, QWindow *parent)
- : QObject(dd, nonDesktopParent(parent))
+ : QObject(dd, nullptr)
, QSurface(QSurface::Window)
{
Q_D(QWindow);
- d->init();
+ d->init(nonDesktopParent(parent));
}
/*!
@@ -215,35 +183,74 @@ QWindow::~QWindow()
{
Q_D(QWindow);
d->destroy();
+ // Decouple from parent before window goes under
+ setParent(nullptr);
QGuiApplicationPrivate::window_list.removeAll(this);
if (!QGuiApplicationPrivate::is_app_closing)
QGuiApplicationPrivate::instance()->modalWindowList.removeOne(this);
- // focus_window is normally cleared in destroy(), but the window may in
- // some cases end up becoming the focus window again. Clear it again
- // here as a workaround. See QTBUG-75326.
+ // thse are normally cleared in destroy(), but the window may in
+ // some cases end up becoming the focus window again, or receive an enter
+ // event. Clear it again here as a workaround. See QTBUG-75326.
if (QGuiApplicationPrivate::focus_window == this)
QGuiApplicationPrivate::focus_window = nullptr;
+ if (QGuiApplicationPrivate::currentMouseWindow == this)
+ QGuiApplicationPrivate::currentMouseWindow = nullptr;
+ if (QGuiApplicationPrivate::currentMousePressWindow == this)
+ QGuiApplicationPrivate::currentMousePressWindow = nullptr;
+
+ d->isWindow = false;
}
-void QWindowPrivate::init(QScreen *targetScreen)
+QWindowPrivate::QWindowPrivate()
+ = default;
+
+QWindowPrivate::~QWindowPrivate()
+ = default;
+
+void QWindowPrivate::init(QWindow *parent, QScreen *targetScreen)
{
Q_Q(QWindow);
+ q->QObject::setParent(parent);
+
+ isWindow = true;
parentWindow = static_cast<QWindow *>(q->QObject::parent());
+ QScreen *connectScreen = targetScreen ? targetScreen : QGuiApplication::primaryScreen();
+
if (!parentWindow)
- connectToScreen(targetScreen ? targetScreen : QGuiApplication::primaryScreen());
+ connectToScreen(connectScreen);
// If your application aborts here, you are probably creating a QWindow
// before the screen list is populated.
if (Q_UNLIKELY(!parentWindow && !topLevelScreen)) {
qFatal("Cannot create window: no screens available");
- exit(1);
}
QGuiApplicationPrivate::window_list.prepend(q);
requestedFormat = QSurfaceFormat::defaultFormat();
+ devicePixelRatio = connectScreen->devicePixelRatio();
+
+ QObject::connect(q, &QWindow::screenChanged, q, [q, this](QScreen *){
+ // We may have changed scaling; trigger resize event if needed,
+ // except on Windows, where we send resize events during WM_DPICHANGED
+ // event handling. FIXME: unify DPI change handling across all platforms.
+#ifndef Q_OS_WIN
+ if (q->handle()) {
+ QWindowSystemInterfacePrivate::GeometryChangeEvent gce(q, QHighDpi::fromNativePixels(q->handle()->geometry(), q));
+ QGuiApplicationPrivate::processGeometryChangeEvent(&gce);
+ }
+#else
+ Q_UNUSED(q);
+#endif
+ updateDevicePixelRatio();
+ });
+
+ if (parentWindow) {
+ QChildWindowEvent childAddedEvent(QEvent::ChildWindowAdded, q);
+ QCoreApplication::sendEvent(parentWindow, &childAddedEvent);
+ }
}
/*!
@@ -324,7 +331,6 @@ void QWindow::setVisibility(Visibility v)
break;
default:
Q_ASSERT(false);
- break;
}
}
@@ -354,8 +360,14 @@ void QWindowPrivate::setVisible(bool visible)
return;
// We only need to create the window if it's being shown
- if (visible)
+ if (visible) {
+ // FIXME: At this point we've already updated the visible state of
+ // the QWindow, so if the platform layer reads the window state during
+ // creation, and reflects that in the native window, it will end up
+ // with a visible window. This may in turn result in resize or expose
+ // events from the platform before we have sent the show event below.
q->create();
+ }
}
if (visible) {
@@ -443,14 +455,14 @@ void QWindowPrivate::updateSiblingPosition(SiblingPosition position)
QObjectList &siblings = q->parent()->d_ptr->children;
- const int siblingCount = siblings.size() - 1;
+ const qsizetype siblingCount = siblings.size() - 1;
if (siblingCount == 0)
return;
- const int currentPosition = siblings.indexOf(q);
+ const qsizetype currentPosition = siblings.indexOf(q);
Q_ASSERT(currentPosition >= 0);
- const int targetPosition = position == PositionTop ? siblingCount : 0;
+ const qsizetype targetPosition = position == PositionTop ? siblingCount : 0;
if (currentPosition == targetPosition)
return;
@@ -458,7 +470,7 @@ void QWindowPrivate::updateSiblingPosition(SiblingPosition position)
siblings.move(currentPosition, targetPosition);
}
-inline bool QWindowPrivate::windowRecreationRequired(QScreen *newScreen) const
+bool QWindowPrivate::windowRecreationRequired(QScreen *newScreen) const
{
Q_Q(const QWindow);
const QScreen *oldScreen = q->screen();
@@ -466,7 +478,7 @@ inline bool QWindowPrivate::windowRecreationRequired(QScreen *newScreen) const
&& !(oldScreen && oldScreen->virtualSiblings().contains(newScreen));
}
-inline void QWindowPrivate::disconnectFromScreen()
+void QWindowPrivate::disconnectFromScreen()
{
if (topLevelScreen)
topLevelScreen = nullptr;
@@ -509,15 +521,38 @@ void QWindowPrivate::setTopLevelScreen(QScreen *newScreen, bool recreate)
}
}
-void QWindowPrivate::create(bool recursive, WId nativeHandle)
+static constexpr auto kForeignWindowId = "_q_foreignWinId";
+
+void QWindowPrivate::create(bool recursive)
{
Q_Q(QWindow);
if (platformWindow)
return;
+ // avoid losing update requests when re-creating
+ const bool needsUpdate = updateRequestPending;
+ // the platformWindow, if there was one, is now gone, so make this flag reflect reality now
+ updateRequestPending = false;
+
if (q->parent())
q->parent()->create();
+ if (platformWindow) {
+ // Creating the parent window will end up creating any child window
+ // that was already visible, via setVisible. If this applies to us,
+ // we will already have a platform window at this point.
+ return;
+ }
+
+ // QPlatformWindow will poll geometry() during construction below. Set the
+ // screen here so that high-dpi scaling will use the correct scale factor.
+ if (q->isTopLevel()) {
+ if (QScreen *screen = screenForGeometry(geometry))
+ setTopLevelScreen(screen, false);
+ }
+
+ const WId nativeHandle = q->property(kForeignWindowId).value<WId>();
+
QPlatformIntegration *platformIntegration = QGuiApplicationPrivate::platformIntegration();
platformWindow = nativeHandle ? platformIntegration->createForeignWindow(q, nativeHandle)
: platformIntegration->createPlatformWindow(q);
@@ -553,8 +588,10 @@ void QWindowPrivate::create(bool recursive, WId nativeHandle)
QPlatformSurfaceEvent e(QPlatformSurfaceEvent::SurfaceCreated);
QGuiApplication::sendEvent(q, &e);
- if (updateRequestPending)
- platformWindow->requestUpdate();
+ updateDevicePixelRatio();
+
+ if (needsUpdate)
+ q->requestUpdate();
}
void QWindowPrivate::clearFocusObject()
@@ -566,10 +603,41 @@ void QWindowPrivate::clearFocusObject()
// implement heightForWidth().
QRectF QWindowPrivate::closestAcceptableGeometry(const QRectF &rect) const
{
- Q_UNUSED(rect)
+ Q_UNUSED(rect);
return QRectF();
}
+void QWindowPrivate::setMinOrMaxSize(QSize *oldSizeMember, const QSize &size,
+ qxp::function_ref<void()> funcWidthChanged,
+ qxp::function_ref<void()> funcHeightChanged)
+{
+ Q_Q(QWindow);
+ Q_ASSERT(oldSizeMember);
+ const QSize adjustedSize =
+ size.expandedTo(QSize(0, 0)).boundedTo(QSize(QWINDOWSIZE_MAX, QWINDOWSIZE_MAX));
+ if (*oldSizeMember == adjustedSize)
+ return;
+ const bool widthChanged = adjustedSize.width() != oldSizeMember->width();
+ const bool heightChanged = adjustedSize.height() != oldSizeMember->height();
+ *oldSizeMember = adjustedSize;
+
+ if (platformWindow && q->isTopLevel())
+ platformWindow->propagateSizeHints();
+
+ if (widthChanged)
+ funcWidthChanged();
+ if (heightChanged)
+ funcHeightChanged();
+
+ // resize window if current size is outside of min and max limits
+ if (minimumSize.width() <= maximumSize.width()
+ || minimumSize.height() <= maximumSize.height()) {
+ const QSize currentSize = q->size();
+ const QSize boundedSize = currentSize.expandedTo(minimumSize).boundedTo(maximumSize);
+ q->resize(boundedSize);
+ }
+}
+
/*!
Sets the \a surfaceType of the window.
@@ -609,6 +677,13 @@ QWindow::SurfaceType QWindow::surfaceType() const
By default, the window is not visible, you must call setVisible(true), or
show() or similar to make it visible.
+ \note Hiding a window does not remove the window from the windowing system,
+ it only hides it. On windowing systems that give full screen applications a
+ dedicated desktop (such as macOS), hiding a full screen window will not remove
+ that desktop, but leave it blank. Another window from the same application
+ might be shown full screen, and will fill that desktop. Use QWindow::close to
+ completely remove a window from the windowing system.
+
\sa show()
*/
void QWindow::setVisible(bool visible)
@@ -632,7 +707,7 @@ bool QWindow::isVisible() const
into an actual native surface. However, the window remains hidden until setVisible() is called.
Note that it is not usually necessary to call this function directly, as it will be implicitly
- called by show(), setVisible(), and other functions that require access to the platform
+ called by show(), setVisible(), winId(), and other functions that require access to the platform
resources.
Call destroy() to free the platform resources if necessary.
@@ -648,6 +723,9 @@ void QWindow::create()
/*!
Returns the window's platform id.
+ \note This function will cause the platform window to be created if it is not already.
+ Returns 0, if the platform window creation failed.
+
For platforms where this id might be useful, the value returned
will uniquely represent the window inside the corresponding screen.
@@ -657,9 +735,12 @@ WId QWindow::winId() const
{
Q_D(const QWindow);
- if(!d->platformWindow)
+ if (!d->platformWindow)
const_cast<QWindow *>(this)->create();
+ if (!d->platformWindow)
+ return 0;
+
return d->platformWindow->winId();
}
@@ -680,17 +761,6 @@ QWindow *QWindow::parent(AncestorMode mode) const
}
/*!
- Returns the parent window, if any.
-
- A window without a parent is known as a top level window.
-*/
-QWindow *QWindow::parent() const
-{
- Q_D(const QWindow);
- return d->parentWindow;
-}
-
-/*!
Sets the \a parent Window. This will lead to the windowing system managing
the clip of the window, so it will be clipped to the \a parent window.
@@ -714,6 +784,10 @@ void QWindow::setParent(QWindow *parent)
return;
}
+ QEvent parentAboutToChangeEvent(QEvent::ParentWindowAboutToChange);
+ QCoreApplication::sendEvent(this, &parentAboutToChangeEvent);
+
+ const auto previousParent = d->parentWindow;
QObject::setParent(parent);
d->parentWindow = parent;
@@ -736,6 +810,19 @@ void QWindow::setParent(QWindow *parent)
}
QGuiApplicationPrivate::updateBlockedStatus(this);
+
+ if (previousParent) {
+ QChildWindowEvent childRemovedEvent(QEvent::ChildWindowRemoved, this);
+ QCoreApplication::sendEvent(previousParent, &childRemovedEvent);
+ }
+
+ if (parent) {
+ QChildWindowEvent childAddedEvent(QEvent::ChildWindowAdded, this);
+ QCoreApplication::sendEvent(parent, &childAddedEvent);
+ }
+
+ QEvent parentChangedEvent(QEvent::ParentWindowChange);
+ QCoreApplication::sendEvent(this, &parentChangedEvent);
}
/*!
@@ -1051,6 +1138,71 @@ void QWindow::lower()
}
/*!
+ \brief Start a system-specific resize operation
+ \since 5.15
+
+ Calling this will start an interactive resize operation on the window by platforms
+ that support it. The actual behavior may vary depending on the platform. Usually,
+ it will make the window resize so that its edge follows the mouse cursor.
+
+ On platforms that support it, this method of resizing windows is preferred over
+ \c setGeometry, because it allows a more native look and feel of resizing windows, e.g.
+ letting the window manager snap this window against other windows, or special resizing
+ behavior with animations when dragged to the edge of the screen.
+
+ \a edges should either be a single edge, or two adjacent edges (a corner). Other values
+ are not allowed.
+
+ Returns true if the operation was supported by the system.
+*/
+bool QWindow::startSystemResize(Qt::Edges edges)
+{
+ Q_D(QWindow);
+ if (Q_UNLIKELY(!isVisible() || !d->platformWindow || d->maximumSize == d->minimumSize))
+ return false;
+
+ const bool isSingleEdge = edges == Qt::TopEdge || edges == Qt::RightEdge || edges == Qt::BottomEdge || edges == Qt::LeftEdge;
+ const bool isCorner =
+ edges == (Qt::TopEdge | Qt::LeftEdge) ||
+ edges == (Qt::TopEdge | Qt::RightEdge) ||
+ edges == (Qt::BottomEdge | Qt::RightEdge) ||
+ edges == (Qt::BottomEdge | Qt::LeftEdge);
+
+ if (Q_UNLIKELY(!isSingleEdge && !isCorner)) {
+ qWarning() << "Invalid edges" << edges << "passed to QWindow::startSystemResize, ignoring.";
+ return false;
+ }
+
+ return d->platformWindow->startSystemResize(edges);
+}
+
+/*!
+ \brief Start a system-specific move operation
+ \since 5.15
+
+ Calling this will start an interactive move operation on the window by platforms
+ that support it. The actual behavior may vary depending on the platform. Usually,
+ it will make the window follow the mouse cursor until a mouse button is released.
+
+ On platforms that support it, this method of moving windows is preferred over
+ \c setPosition, because it allows a more native look-and-feel of moving windows, e.g.
+ letting the window manager snap this window against other windows, or special tiling
+ or resizing behavior with animations when dragged to the edge of the screen.
+ Furthermore, on some platforms such as Wayland, \c setPosition is not supported, so
+ this is the only way the application can influence its position.
+
+ Returns true if the operation was supported by the system.
+*/
+bool QWindow::startSystemMove()
+{
+ Q_D(QWindow);
+ if (Q_UNLIKELY(!isVisible() || !d->platformWindow))
+ return false;
+
+ return d->platformWindow->startSystemMove();
+}
+
+/*!
\property QWindow::opacity
\brief The opacity of the window in the windowing system.
\since 5.1
@@ -1115,7 +1267,7 @@ QRegion QWindow::mask() const
/*!
Requests the window to be activated, i.e. receive keyboard focus.
- \sa isActive(), QGuiApplication::focusWindow(), QWindowsWindowFunctions::setWindowActivationBehavior()
+ \sa isActive(), QGuiApplication::focusWindow()
*/
void QWindow::requestActivate()
{
@@ -1133,7 +1285,7 @@ void QWindow::requestActivate()
When the window is not exposed, it is shown by the application
but it is still not showing in the windowing system, so the application
- should minimize rendering and other graphical activities.
+ should minimize animations and other graphical activities.
An exposeEvent() is sent every time this value changes.
@@ -1154,12 +1306,16 @@ bool QWindow::isExposed() const
*/
/*!
- Returns \c true if the window should appear active from a style perspective.
+ Returns \c true if the window is active.
This is the case for the window that has input focus as well as windows
that are in the same parent / transient parent chain as the focus window.
+ Typically active windows should appear active from a style perspective.
+
To get the window that currently has focus, use QGuiApplication::focusWindow().
+
+ \sa requestActivate()
*/
bool QWindow::isActive() const
{
@@ -1233,14 +1389,31 @@ Qt::ScreenOrientation QWindow::contentOrientation() const
qreal QWindow::devicePixelRatio() const
{
Q_D(const QWindow);
+ return d->devicePixelRatio;
+}
+
+/*
+ Updates the cached devicePixelRatio value by polling for a new value.
+ Sends QEvent::DevicePixelRatioChange to the window if the DPR has changed.
+ Returns true if the DPR was changed.
+*/
+bool QWindowPrivate::updateDevicePixelRatio()
+{
+ Q_Q(QWindow);
// If there is no platform window use the associated screen's devicePixelRatio,
// which typically is the primary screen and will be correct for single-display
// systems (a very common case).
- if (!d->platformWindow)
- return screen()->devicePixelRatio();
+ const qreal newDevicePixelRatio = platformWindow ?
+ platformWindow->devicePixelRatio() * QHighDpiScaling::factor(q) : q->screen()->devicePixelRatio();
- return d->platformWindow->devicePixelRatio() * QHighDpiScaling::factor(this);
+ if (newDevicePixelRatio == devicePixelRatio)
+ return false;
+
+ devicePixelRatio = newDevicePixelRatio;
+ QEvent dprChangeEvent(QEvent::DevicePixelRatioChange);
+ QGuiApplication::sendEvent(q, &dprChangeEvent);
+ return true;
}
Qt::WindowState QWindowPrivate::effectiveState(Qt::WindowStates state)
@@ -1295,8 +1468,13 @@ void QWindow::setWindowStates(Qt::WindowStates state)
if (d->platformWindow)
d->platformWindow->setWindowState(state);
+
+ auto originalEffectiveState = QWindowPrivate::effectiveState(d->windowState);
d->windowState = state;
- emit windowStateChanged(QWindowPrivate::effectiveState(d->windowState));
+ auto newEffectiveState = QWindowPrivate::effectiveState(d->windowState);
+ if (newEffectiveState != originalEffectiveState)
+ emit windowStateChanged(newEffectiveState);
+
d->updateVisibility();
}
@@ -1344,7 +1522,7 @@ Qt::WindowStates QWindow::windowStates() const
This is a hint to the window manager that this window is a dialog or pop-up
on behalf of the transient parent.
- In order to cause the window to be centered above its transient parent by
+ In order to cause the window to be centered above its transient \a parent by
default, depending on the window manager, it may also be necessary to call
setFlags() with a suitable \l Qt::WindowType (such as \c Qt::Dialog).
@@ -1471,17 +1649,9 @@ QSize QWindow::sizeIncrement() const
void QWindow::setMinimumSize(const QSize &size)
{
Q_D(QWindow);
- QSize adjustedSize = QSize(qBound(0, size.width(), QWINDOWSIZE_MAX), qBound(0, size.height(), QWINDOWSIZE_MAX));
- if (d->minimumSize == adjustedSize)
- return;
- QSize oldSize = d->minimumSize;
- d->minimumSize = adjustedSize;
- if (d->platformWindow && isTopLevel())
- d->platformWindow->propagateSizeHints();
- if (d->minimumSize.width() != oldSize.width())
- emit minimumWidthChanged(d->minimumSize.width());
- if (d->minimumSize.height() != oldSize.height())
- emit minimumHeightChanged(d->minimumSize.height());
+ d->setMinOrMaxSize(
+ &d->minimumSize, size, [this, d]() { emit minimumWidthChanged(d->minimumSize.width()); },
+ [this, d]() { emit minimumHeightChanged(d->minimumSize.height()); });
}
/*!
@@ -1514,20 +1684,18 @@ void QWindow::setY(int arg)
\property QWindow::width
\brief the width of the window's geometry
*/
-void QWindow::setWidth(int arg)
+void QWindow::setWidth(int w)
{
- if (width() != arg)
- resize(arg, height());
+ resize(w, height());
}
/*!
\property QWindow::height
\brief the height of the window's geometry
*/
-void QWindow::setHeight(int arg)
+void QWindow::setHeight(int h)
{
- if (height() != arg)
- resize(width(), arg);
+ resize(width(), h);
}
/*!
@@ -1558,17 +1726,9 @@ void QWindow::setMinimumHeight(int h)
void QWindow::setMaximumSize(const QSize &size)
{
Q_D(QWindow);
- QSize adjustedSize = QSize(qBound(0, size.width(), QWINDOWSIZE_MAX), qBound(0, size.height(), QWINDOWSIZE_MAX));
- if (d->maximumSize == adjustedSize)
- return;
- QSize oldSize = d->maximumSize;
- d->maximumSize = adjustedSize;
- if (d->platformWindow && isTopLevel())
- d->platformWindow->propagateSizeHints();
- if (d->maximumSize.width() != oldSize.width())
- emit maximumWidthChanged(d->maximumSize.width());
- if (d->maximumSize.height() != oldSize.height())
- emit maximumHeightChanged(d->maximumSize.height());
+ d->setMinOrMaxSize(
+ &d->maximumSize, size, [this, d]() { emit maximumWidthChanged(d->maximumSize.width()); },
+ [this, d]() { emit maximumHeightChanged(d->maximumSize.height()); });
}
/*!
@@ -1661,13 +1821,10 @@ void QWindow::setGeometry(const QRect &rect)
d->positionPolicy = QWindowPrivate::WindowFrameExclusive;
if (d->platformWindow) {
- QRect nativeRect;
QScreen *newScreen = d->screenForGeometry(rect);
if (newScreen && isTopLevel())
- nativeRect = QHighDpi::toNativePixels(rect, newScreen);
- else
- nativeRect = QHighDpi::toNativePixels(rect, this);
- d->platformWindow->setGeometry(nativeRect);
+ d->setTopLevelScreen(newScreen, true);
+ d->platformWindow->setGeometry(QHighDpi::toNativeWindowGeometry(rect, this));
} else {
d->geometry = rect;
@@ -1717,8 +1874,10 @@ QScreen *QWindowPrivate::screenForGeometry(const QRect &newGeometry) const
QRect QWindow::geometry() const
{
Q_D(const QWindow);
- if (d->platformWindow)
- return QHighDpi::fromNativePixels(d->platformWindow->geometry(), this);
+ if (d->platformWindow) {
+ const auto nativeGeometry = d->platformWindow->geometry();
+ return QHighDpi::fromNativeWindowGeometry(nativeGeometry, this);
+ }
return d->geometry;
}
@@ -1747,7 +1906,7 @@ QRect QWindow::frameGeometry() const
Q_D(const QWindow);
if (d->platformWindow) {
QMargins m = frameMargins();
- return QHighDpi::fromNativePixels(d->platformWindow->geometry(), this).adjusted(-m.left(), -m.top(), m.right(), m.bottom());
+ return QHighDpi::fromNativeWindowGeometry(d->platformWindow->geometry(), this).adjusted(-m.left(), -m.top(), m.right(), m.bottom());
}
return d->geometry;
}
@@ -1764,7 +1923,7 @@ QPoint QWindow::framePosition() const
Q_D(const QWindow);
if (d->platformWindow) {
QMargins margins = frameMargins();
- return QHighDpi::fromNativePixels(d->platformWindow->geometry().topLeft(), this) - QPoint(margins.left(), margins.top());
+ return QHighDpi::fromNativeWindowGeometry(d->platformWindow->geometry().topLeft(), this) - QPoint(margins.left(), margins.top());
}
return d->geometry.topLeft();
}
@@ -1782,7 +1941,7 @@ void QWindow::setFramePosition(const QPoint &point)
d->positionPolicy = QWindowPrivate::WindowFrameInclusive;
d->positionAutomatic = false;
if (d->platformWindow) {
- d->platformWindow->setGeometry(QHighDpi::toNativePixels(QRect(point, size()), this));
+ d->platformWindow->setGeometry(QHighDpi::toNativeWindowGeometry(QRect(point, size()), this));
} else {
d->geometry.moveTopLeft(point);
}
@@ -1793,7 +1952,14 @@ void QWindow::setFramePosition(const QPoint &point)
The position is in relation to the virtualGeometry() of its screen.
- \sa position()
+ For interactively moving windows, see startSystemMove(). For interactively
+ resizing windows, see startSystemResize().
+
+ \note Not all windowing systems support setting or querying top level window positions.
+ On such a system, programmatically moving windows may not have any effect, and artificial
+ values may be returned for the current positions, such as \c QPoint(0, 0).
+
+ \sa position(), startSystemMove()
*/
void QWindow::setPosition(const QPoint &pt)
{
@@ -1816,6 +1982,10 @@ void QWindow::setPosition(int posx, int posy)
\fn QPoint QWindow::position() const
\brief Returns the position of the window on the desktop excluding any window frame
+ \note Not all windowing systems support setting or querying top level window positions.
+ On such a system, programmatically moving windows may not have any effect, and artificial
+ values may be returned for the current positions, such as \c QPoint(0, 0).
+
\sa setPosition()
*/
@@ -1830,6 +2000,8 @@ void QWindow::setPosition(int posx, int posy)
set the size of the window, excluding any window frame, to a QSize
constructed from width \a w and height \a h
+ For interactively resizing windows, see startSystemResize().
+
\sa size(), geometry()
*/
void QWindow::resize(int w, int h)
@@ -1845,11 +2017,16 @@ void QWindow::resize(int w, int h)
void QWindow::resize(const QSize &newSize)
{
Q_D(QWindow);
+
+ const QSize oldSize = size();
+ if (newSize == oldSize)
+ return;
+
d->positionPolicy = QWindowPrivate::WindowFrameExclusive;
if (d->platformWindow) {
- d->platformWindow->setGeometry(QHighDpi::toNativePixels(QRect(position(), newSize), this));
+ d->platformWindow->setGeometry(
+ QHighDpi::toNativeWindowGeometry(QRect(position(), newSize), this));
} else {
- const QSize oldSize = d->geometry.size();
d->geometry.setSize(newSize);
if (newSize.width() != oldSize.width())
emit widthChanged(newSize.width());
@@ -1886,21 +2063,20 @@ void QWindowPrivate::destroy()
QObject *object = childrenWindows.at(i);
if (object->isWindowType()) {
QWindow *w = static_cast<QWindow*>(object);
+ auto *childPlatformWindow = w->handle();
+ if (!childPlatformWindow)
+ continue;
+
+ // Decouple the foreign window from this window,
+ // so that destroying our native handle doesn't
+ // bring down the foreign window as well.
+ if (childPlatformWindow->isForeignWindow())
+ childPlatformWindow->setParent(nullptr);
+
qt_window_private(w)->destroy();
}
}
- if (QGuiApplicationPrivate::focus_window == q)
- QGuiApplicationPrivate::focus_window = q->parent();
- if (QGuiApplicationPrivate::currentMouseWindow == q)
- QGuiApplicationPrivate::currentMouseWindow = q->parent();
- if (QGuiApplicationPrivate::currentMousePressWindow == q)
- QGuiApplicationPrivate::currentMousePressWindow = q->parent();
-
- for (int i = 0; i < QGuiApplicationPrivate::tabletDevicePoints.size(); ++i)
- if (QGuiApplicationPrivate::tabletDevicePoints.at(i).target == q)
- QGuiApplicationPrivate::tabletDevicePoints[i].target = q->parent();
-
bool wasVisible = q->isVisible();
visibilityOnDestroy = wasVisible && platformWindow;
@@ -1909,7 +2085,7 @@ void QWindowPrivate::destroy()
// Let subclasses act, typically by doing graphics resource cleaup, when
// the window, to which graphics resource may be tied, is going away.
//
- // NB! This is disfunctional when destroy() is invoked from the dtor since
+ // NB! This is dysfunctional when destroy() is invoked from the dtor since
// a reimplemented event() will not get called in the subclasses at that
// stage. However, the typical QWindow cleanup involves either close() or
// going through QWindowContainer, both of which will do an explicit, early
@@ -1921,9 +2097,18 @@ void QWindowPrivate::destroy()
// Unset platformWindow before deleting, so that the destructor of the
// platform window does not recurse back into the platform window via
// this window during destruction (e.g. as a result of platform events).
- QPlatformWindow *pw = platformWindow;
- platformWindow = nullptr;
- delete pw;
+ delete std::exchange(platformWindow, nullptr);
+
+ if (QGuiApplicationPrivate::focus_window == q)
+ QGuiApplicationPrivate::focus_window = q->parent();
+ if (QGuiApplicationPrivate::currentMouseWindow == q)
+ QGuiApplicationPrivate::currentMouseWindow = q->parent();
+ if (QGuiApplicationPrivate::currentMousePressWindow == q)
+ QGuiApplicationPrivate::currentMousePressWindow = q->parent();
+
+ for (int i = 0; i < QGuiApplicationPrivate::tabletDevicePoints.size(); ++i)
+ if (QGuiApplicationPrivate::tabletDevicePoints.at(i).target == q)
+ QGuiApplicationPrivate::tabletDevicePoints[i].target = q->parent();
resizeEventPending = true;
receivedExpose = false;
@@ -2060,20 +2245,26 @@ QObject *QWindow::focusObject() const
/*!
Shows the window.
- This is equivalent to calling showFullScreen(), showMaximized(), or showNormal(),
+ For child windows, this is equivalent to calling showNormal().
+ Otherwise, it is equivalent to calling showFullScreen(), showMaximized(), or showNormal(),
depending on the platform's default behavior for the window type and flags.
\sa showFullScreen(), showMaximized(), showNormal(), hide(), QStyleHints::showIsFullScreen(), flags()
*/
void QWindow::show()
{
- Qt::WindowState defaultState = QGuiApplicationPrivate::platformIntegration()->defaultWindowState(d_func()->windowFlags);
- if (defaultState == Qt::WindowFullScreen)
- showFullScreen();
- else if (defaultState == Qt::WindowMaximized)
- showMaximized();
- else
+ if (parent()) {
showNormal();
+ } else {
+ const auto *platformIntegration = QGuiApplicationPrivate::platformIntegration();
+ Qt::WindowState defaultState = platformIntegration->defaultWindowState(d_func()->windowFlags);
+ if (defaultState == Qt::WindowFullScreen)
+ showFullScreen();
+ else if (defaultState == Qt::WindowMaximized)
+ showMaximized();
+ else
+ showNormal();
+ }
}
/*!
@@ -2122,6 +2313,9 @@ void QWindow::showMaximized()
Equivalent to calling setWindowStates(Qt::WindowFullScreen) and then
setVisible(true).
+ See the \l{QWidget::showFullScreen()} documentation for platform-specific
+ considerations and limitations.
+
\sa setWindowStates(), setVisible()
*/
void QWindow::showFullScreen()
@@ -2155,41 +2349,76 @@ void QWindow::showNormal()
quitting the application. Returns \c true on success, false if it has a parent
window (in which case the top level window should be closed instead).
- \sa destroy(), QGuiApplication::quitOnLastWindowClosed()
+ \sa destroy(), QGuiApplication::quitOnLastWindowClosed(), closeEvent()
*/
bool QWindow::close()
{
Q_D(QWindow);
+ if (d->inClose)
+ return true;
// Do not close non top level windows
- if (parent())
+ if (!isTopLevel())
return false;
if (!d->platformWindow)
return true;
- return d->platformWindow->close();
+ // The window might be deleted during close,
+ // as a result of delivering the close event.
+ QPointer guard(this);
+ d->inClose = true;
+ bool success = d->platformWindow->close();
+ if (guard)
+ d->inClose = false;
+
+ return success;
+}
+
+bool QWindowPrivate::participatesInLastWindowClosed() const
+{
+ Q_Q(const QWindow);
+
+ if (!q->isTopLevel())
+ return false;
+
+ // Tool-tip widgets do not normally have Qt::WA_QuitOnClose,
+ // but since we do not have a similar flag for non-widget
+ // windows we need an explicit exclusion here as well.
+ if (q->type() == Qt::ToolTip)
+ return false;
+
+ // A window with a transient parent is not a primary window,
+ // it's a secondary window.
+ if (q->transientParent())
+ return false;
+
+ return true;
+}
+
+bool QWindowPrivate::treatAsVisible() const
+{
+ Q_Q(const QWindow);
+ return q->isVisible();
}
/*!
- The expose event (\a ev) is sent by the window system whenever an area of
- the window is invalidated, for example due to the exposure in the windowing
- system changing.
+ The expose event (\a ev) is sent by the window system when a window moves
+ between the un-exposed and exposed states.
- The application can start rendering into the window with QBackingStore
- and QOpenGLContext as soon as it gets an exposeEvent() such that
- isExposed() is true.
+ An exposed window is potentially visible to the user. If the window is moved
+ off screen, is made totally obscured by another window, is minimized, or
+ similar, this function might be called and the value of isExposed() might
+ change to false. You may use this event to limit expensive operations such
+ as animations to only run when the window is exposed.
- If the window is moved off screen, is made totally obscured by another
- window, iconified or similar, this function might be called and the
- value of isExposed() might change to false. When this happens,
- an application should stop its rendering as it is no longer visible
- to the user.
+ This event should not be used to paint. To handle painting implement
+ paintEvent() instead.
A resize event will always be sent before the expose event the first time
a window is shown.
- \sa isExposed()
+ \sa paintEvent(), isExposed()
*/
void QWindow::exposeEvent(QExposeEvent *ev)
{
@@ -2197,6 +2426,25 @@ void QWindow::exposeEvent(QExposeEvent *ev)
}
/*!
+ The paint event (\a ev) is sent by the window system whenever an area of
+ the window needs a repaint, for example when initially showing the window,
+ or due to parts of the window being uncovered by moving another window.
+
+ The application is expected to render into the window in response to the
+ paint event, regardless of the exposed state of the window. For example,
+ a paint event may be sent before the window is exposed, to prepare it for
+ showing to the user.
+
+ \since 6.0
+
+ \sa exposeEvent()
+*/
+void QWindow::paintEvent(QPaintEvent *ev)
+{
+ ev->ignore();
+}
+
+/*!
Override this to handle window move events (\a ev).
*/
void QWindow::moveEvent(QMoveEvent *ev)
@@ -2241,6 +2489,19 @@ void QWindow::hideEvent(QHideEvent *ev)
}
/*!
+ Override this to handle close events (\a ev).
+
+ The function is called when the window is requested to close. Call \l{QEvent::ignore()}
+ on the event if you want to prevent the window from being closed.
+
+ \sa close()
+*/
+void QWindow::closeEvent(QCloseEvent *ev)
+{
+ Q_UNUSED(ev);
+}
+
+/*!
Override this to handle any event (\a ev) sent to the window.
Return \c true if the event was recognized and processed.
@@ -2291,7 +2552,7 @@ bool QWindow::event(QEvent *ev)
case QEvent::FocusIn: {
focusInEvent(static_cast<QFocusEvent *>(ev));
-#ifndef QT_NO_ACCESSIBILITY
+#if QT_CONFIG(accessibility)
QAccessible::State state;
state.active = true;
QAccessibleStateChangeEvent event(this, state);
@@ -2301,7 +2562,7 @@ bool QWindow::event(QEvent *ev)
case QEvent::FocusOut: {
focusOutEvent(static_cast<QFocusEvent *>(ev));
-#ifndef QT_NO_ACCESSIBILITY
+#if QT_CONFIG(accessibility)
QAccessible::State state;
state.active = true;
QAccessibleStateChangeEvent event(this, state);
@@ -2315,24 +2576,34 @@ bool QWindow::event(QEvent *ev)
break;
#endif
- case QEvent::Close:
+ case QEvent::Close: {
+
+ Q_D(QWindow);
+ const bool wasVisible = d->treatAsVisible();
+ const bool participatesInLastWindowClosed = d->participatesInLastWindowClosed();
+
+ // The window might be deleted in the close event handler
+ QPointer<QWindow> deletionGuard(this);
+ closeEvent(static_cast<QCloseEvent*>(ev));
+
if (ev->isAccepted()) {
- Q_D(QWindow);
- bool wasVisible = isVisible();
- destroy();
- if (wasVisible) {
- // FIXME: This check for visibility is a workaround for both QWidgetWindow
- // and QWindow having logic to emit lastWindowClosed, and possibly quit the
- // application. We should find a better way to handle this.
- d->maybeQuitOnLastWindowClosed();
- }
+ if (deletionGuard)
+ destroy();
+ if (wasVisible && participatesInLastWindowClosed)
+ QGuiApplicationPrivate::instance()->maybeLastWindowClosed();
}
+
break;
+ }
case QEvent::Expose:
exposeEvent(static_cast<QExposeEvent *>(ev));
break;
+ case QEvent::Paint:
+ paintEvent(static_cast<QPaintEvent *>(ev));
+ break;
+
case QEvent::Show:
showEvent(static_cast<QShowEvent *>(ev));
break;
@@ -2345,13 +2616,6 @@ bool QWindow::event(QEvent *ev)
setIcon(icon());
break;
- case QEvent::WindowStateChange: {
- Q_D(QWindow);
- emit windowStateChanged(QWindowPrivate::effectiveState(d->windowState));
- d->updateVisibility();
- break;
- }
-
#if QT_CONFIG(tabletevent)
case QEvent::TabletPress:
case QEvent::TabletMove:
@@ -2374,17 +2638,50 @@ bool QWindow::event(QEvent *ev)
default:
return QObject::event(ev);
}
+
+#ifndef QT_NO_CONTEXTMENU
+ /*
+ QGuiApplicationPrivate::processContextMenuEvent blocks mouse-triggered
+ context menu events that the QPA plugin might generate. In practice that
+ never happens, as even on Windows WM_CONTEXTMENU is never generated by
+ the OS (we never call the default window procedure that would do that in
+ response to unhandled WM_RBUTTONUP).
+
+ So, we always have to syntheize QContextMenuEvent for mouse events anyway.
+ QWidgetWindow synthesizes QContextMenuEvent similar to this code, and
+ never calls QWindow::event, so we have to do it here as well.
+
+ This logic could be simplified by always synthesizing events in
+ QGuiApplicationPrivate, or perhaps even in each QPA plugin. See QTBUG-93486.
+ */
+ static const QEvent::Type contextMenuTrigger =
+ QGuiApplicationPrivate::platformTheme()->themeHint(QPlatformTheme::ContextMenuOnMouseRelease).toBool() ?
+ QEvent::MouseButtonRelease : QEvent::MouseButtonPress;
+ auto asMouseEvent = [](QEvent *ev) {
+ const auto t = ev->type();
+ return t == QEvent::MouseButtonPress || t == QEvent::MouseButtonRelease
+ ? static_cast<QMouseEvent *>(ev) : nullptr ;
+ };
+ if (QMouseEvent *me = asMouseEvent(ev); me &&
+ ev->type() == contextMenuTrigger && me->button() == Qt::RightButton) {
+ QContextMenuEvent e(QContextMenuEvent::Mouse, me->position().toPoint(),
+ me->globalPosition().toPoint(), me->modifiers());
+ QGuiApplication::sendEvent(this, &e);
+ }
+#endif
return true;
}
/*!
Schedules a QEvent::UpdateRequest event to be delivered to this window.
- The event is delivered in sync with the display vsync on platforms
- where this is possible. Otherwise, the event is delivered after a
- delay of 5 ms. The additional time is there to give the event loop
- a bit of idle time to gather system events, and can be overridden
- using the QT_QPA_UPDATE_IDLE_TIME environment variable.
+ The event is delivered in sync with the display vsync on platforms where
+ this is possible. Otherwise, the event is delivered after a delay of at
+ most 5 ms. If the window's associated screen reports a
+ \l{QScreen::refreshRate()}{refresh rate} higher than 60 Hz, the interval is
+ scaled down to a value smaller than 5. The additional time is there to give
+ the event loop a bit of idle time to gather system events, and can be
+ overridden using the QT_QPA_UPDATE_IDLE_TIME environment variable.
When driving animations, this function should be called once after drawing
has completed. Calling this function multiple times will result in a single
@@ -2536,11 +2833,7 @@ void QWindow::tabletEvent(QTabletEvent *ev)
Should return true only if the event was handled.
*/
-#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
bool QWindow::nativeEvent(const QByteArray &eventType, void *message, qintptr *result)
-#else
-bool QWindow::nativeEvent(const QByteArray &eventType, void *message, long *result)
-#endif
{
Q_UNUSED(eventType);
Q_UNUSED(message);
@@ -2549,51 +2842,94 @@ bool QWindow::nativeEvent(const QByteArray &eventType, void *message, long *resu
}
/*!
- \fn QPoint QWindow::mapToGlobal(const QPoint &pos) const
+ \fn QPointF QWindow::mapToGlobal(const QPointF &pos) const
Translates the window coordinate \a pos to global screen
- coordinates. For example, \c{mapToGlobal(QPoint(0,0))} would give
+ coordinates. For example, \c{mapToGlobal(QPointF(0,0))} would give
the global coordinates of the top-left pixel of the window.
\sa mapFromGlobal()
+ \since 6.0
*/
-QPoint QWindow::mapToGlobal(const QPoint &pos) const
+QPointF QWindow::mapToGlobal(const QPointF &pos) const
{
Q_D(const QWindow);
// QTBUG-43252, prefer platform implementation for foreign windows.
if (d->platformWindow
&& (d->platformWindow->isForeignWindow() || d->platformWindow->isEmbedded())) {
- return QHighDpi::fromNativeLocalPosition(d->platformWindow->mapToGlobal(QHighDpi::toNativeLocalPosition(pos, this)), this);
+ return QHighDpi::fromNativeGlobalPosition(d->platformWindow->mapToGlobalF(QHighDpi::toNativeLocalPosition(pos, this)), this);
}
- if (QHighDpiScaling::isActive())
- return QHighDpiScaling::mapPositionToGlobal(pos, d->globalPosition(), this);
+ if (!QHighDpiScaling::isActive())
+ return pos + d->globalPosition();
- return pos + d->globalPosition();
+ // The normal pos + windowGlobalPos calculation may give a point which is outside
+ // screen geometry for windows which span multiple screens, due to the way QHighDpiScaling
+ // creates gaps between screens in the the device indendent cooordinate system.
+ //
+ // Map the position (and the window's global position) to native coordinates, perform
+ // the addition, and then map back to device independent coordinates.
+ QPointF nativeLocalPos = QHighDpi::toNativeLocalPosition(pos, this);
+ // Get the native window position directly from the platform window
+ // if available (it can be null if the window hasn't been shown yet),
+ // or fall back to scaling the QWindow position.
+ QPointF nativeWindowGlobalPos = d->platformWindow
+ ? d->platformWindow->mapToGlobal(QPoint(0,0)).toPointF()
+ : QHighDpi::toNativeGlobalPosition(QPointF(d->globalPosition()), this);
+ QPointF nativeGlobalPos = nativeLocalPos + nativeWindowGlobalPos;
+ QPointF deviceIndependentGlobalPos = QHighDpi::fromNativeGlobalPosition(nativeGlobalPos, this);
+ return deviceIndependentGlobalPos;
}
+/*!
+ \overload
+*/
+QPoint QWindow::mapToGlobal(const QPoint &pos) const
+{
+ return mapToGlobal(QPointF(pos)).toPoint();
+}
/*!
- \fn QPoint QWindow::mapFromGlobal(const QPoint &pos) const
+ \fn QPointF QWindow::mapFromGlobal(const QPointF &pos) const
Translates the global screen coordinate \a pos to window
coordinates.
\sa mapToGlobal()
+ \since 6.0
*/
-QPoint QWindow::mapFromGlobal(const QPoint &pos) const
+QPointF QWindow::mapFromGlobal(const QPointF &pos) const
{
Q_D(const QWindow);
// QTBUG-43252, prefer platform implementation for foreign windows.
if (d->platformWindow
&& (d->platformWindow->isForeignWindow() || d->platformWindow->isEmbedded())) {
- return QHighDpi::fromNativeLocalPosition(d->platformWindow->mapFromGlobal(QHighDpi::toNativeLocalPosition(pos, this)), this);
+ return QHighDpi::fromNativeLocalPosition(d->platformWindow->mapFromGlobalF(QHighDpi::toNativeGlobalPosition(pos, this)), this);
}
- if (QHighDpiScaling::isActive())
- return QHighDpiScaling::mapPositionFromGlobal(pos, d->globalPosition(), this);
+ if (!QHighDpiScaling::isActive())
+ return pos - d->globalPosition();
- return pos - d->globalPosition();
+ // Calculate local position in the native coordinate system. (See comment for the
+ // corresponding mapToGlobal() code above).
+ QPointF nativeGlobalPos = QHighDpi::toNativeGlobalPosition(pos, this);
+ // Get the native window position directly from the platform window
+ // if available (it can be null if the window hasn't been shown yet),
+ // or fall back to scaling the QWindow position.
+ QPointF nativeWindowGlobalPos = d->platformWindow
+ ? d->platformWindow->mapToGlobal(QPoint(0,0)).toPointF()
+ : QHighDpi::toNativeGlobalPosition(QPointF(d->globalPosition()), this);
+ QPointF nativeLocalPos = nativeGlobalPos - nativeWindowGlobalPos;
+ QPointF deviceIndependentLocalPos = QHighDpi::fromNativeLocalPosition(nativeLocalPos, this);
+ return deviceIndependentLocalPos;
+}
+
+/*!
+ \overload
+*/
+QPoint QWindow::mapFromGlobal(const QPoint &pos) const
+{
+ return QWindow::mapFromGlobal(QPointF(pos)).toPoint();
}
QPoint QWindowPrivate::globalPosition() const
@@ -2618,34 +2954,6 @@ Q_GUI_EXPORT QWindowPrivate *qt_window_private(QWindow *window)
return window->d_func();
}
-void QWindowPrivate::maybeQuitOnLastWindowClosed()
-{
- if (!QCoreApplication::instance())
- return;
-
- Q_Q(QWindow);
- if (!q->isTopLevel())
- return;
- // Attempt to close the application only if this has WA_QuitOnClose set and a non-visible parent
- bool quitOnClose = QGuiApplication::quitOnLastWindowClosed() && !q->parent();
- QWindowList list = QGuiApplication::topLevelWindows();
- bool lastWindowClosed = true;
- for (int i = 0; i < list.size(); ++i) {
- QWindow *w = list.at(i);
- if (!w->isVisible() || w->transientParent() || w->type() == Qt::ToolTip)
- continue;
- lastWindowClosed = false;
- break;
- }
- if (lastWindowClosed) {
- QGuiApplicationPrivate::emitLastWindowClosed();
- if (quitOnClose) {
- QCoreApplicationPrivate *applicationPrivate = static_cast<QCoreApplicationPrivate*>(QObjectPrivate::get(QCoreApplication::instance()));
- applicationPrivate->maybeQuit();
- }
- }
-}
-
QWindow *QWindowPrivate::topLevelWindow(QWindow::AncestorMode mode) const
{
Q_Q(const QWindow);
@@ -2663,13 +2971,6 @@ QWindow *QWindowPrivate::topLevelWindow(QWindow::AncestorMode mode) const
return window;
}
-#if QT_CONFIG(opengl)
-QOpenGLContext *QWindowPrivate::shareContext() const
-{
- return qt_gl_global_share_context();
-};
-#endif
-
/*!
Creates a local representation of a window created by another process or by
using native libraries below Qt.
@@ -2690,7 +2991,6 @@ QOpenGLContext *QWindowPrivate::shareContext() const
platform dependent and untested.
\sa setParent()
- \sa setTransientParent()
*/
QWindow *QWindow::fromWinId(WId id)
{
@@ -2700,7 +3000,11 @@ QWindow *QWindow::fromWinId(WId id)
}
QWindow *window = new QWindow;
- qt_window_private(window)->create(false, id);
+
+ // Persist the winId in a private property so that we
+ // can recreate the window after being destroyed.
+ window->setProperty(kForeignWindowId, id);
+ window->create();
if (!window->handle()) {
delete window;
@@ -2711,7 +3015,7 @@ QWindow *QWindow::fromWinId(WId id)
}
/*!
- Causes an alert to be shown for \a msec miliseconds. If \a msec is \c 0 (the
+ Causes an alert to be shown for \a msec milliseconds. If \a msec is \c 0 (the
default), then the alert is shown indefinitely until the window becomes
active again. This function has no effect on an active window.
@@ -2828,6 +3132,38 @@ bool QWindowPrivate::applyCursor()
}
#endif // QT_NO_CURSOR
+void *QWindow::resolveInterface(const char *name, int revision) const
+{
+ using namespace QNativeInterface::Private;
+
+ auto *platformWindow = handle();
+ Q_UNUSED(platformWindow);
+ Q_UNUSED(name);
+ Q_UNUSED(revision);
+
+#if defined(Q_OS_WIN)
+ QT_NATIVE_INTERFACE_RETURN_IF(QWindowsWindow, platformWindow);
+#endif
+
+#if QT_CONFIG(xcb)
+ QT_NATIVE_INTERFACE_RETURN_IF(QXcbWindow, platformWindow);
+#endif
+
+#if defined(Q_OS_MACOS)
+ QT_NATIVE_INTERFACE_RETURN_IF(QCocoaWindow, platformWindow);
+#endif
+
+#if QT_CONFIG(wayland)
+ QT_NATIVE_INTERFACE_RETURN_IF(QWaylandWindow, platformWindow);
+#endif
+
+#if defined(Q_OS_WASM)
+ QT_NATIVE_INTERFACE_RETURN_IF(QWasmWindow, platformWindow);
+#endif
+
+ return nullptr;
+}
+
#ifndef QT_NO_DEBUG_STREAM
QDebug operator<<(QDebug debug, const QWindow *window)
{
@@ -2867,7 +3203,7 @@ QDebug operator<<(QDebug debug, const QWindow *window)
}
#endif // !QT_NO_DEBUG_STREAM
-#if QT_CONFIG(vulkan) || defined(Q_CLANG_QDOC)
+#if QT_CONFIG(vulkan) || defined(Q_QDOC)
/*!
Associates this window with the specified Vulkan \a instance.
diff --git a/src/gui/kernel/qwindow.h b/src/gui/kernel/qwindow.h
index 5ee1d00f5b..a5ec47708a 100644
--- a/src/gui/kernel/qwindow.h
+++ b/src/gui/kernel/qwindow.h
@@ -1,41 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the QtGui module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#ifndef QWINDOW_H
#define QWINDOW_H
@@ -47,6 +11,7 @@
#include <QtCore/QRect>
#include <QtCore/qnamespace.h>
+#include <QtCore/qnativeinterface.h>
#include <QtGui/qsurface.h>
#include <QtGui/qsurfaceformat.h>
@@ -64,11 +29,13 @@ QT_BEGIN_NAMESPACE
class QWindowPrivate;
class QExposeEvent;
+class QPaintEvent;
class QFocusEvent;
class QMoveEvent;
class QResizeEvent;
class QShowEvent;
class QHideEvent;
+class QCloseEvent;
class QKeyEvent;
class QMouseEvent;
#if QT_CONFIG(wheelevent)
@@ -88,7 +55,7 @@ class QWindowContainer;
#ifndef QT_NO_DEBUG_STREAM
class QDebug;
#endif
-#if QT_CONFIG(vulkan) || defined(Q_CLANG_QDOC)
+#if QT_CONFIG(vulkan) || defined(Q_QDOC)
class QVulkanInstance;
#endif
@@ -105,7 +72,7 @@ class Q_GUI_EXPORT QWindow : public QObject, public QSurface
// Any new properties which you add here MUST be versioned and MUST be documented both as
// C++ properties in qwindow.cpp AND as QML properties in qquickwindow.cpp.
- // http://qt-project.org/doc/qt-5.0/qtqml/qtqml-cppintegration-definetypes.html#type-revisions-and-versions
+ // https://doc.qt.io/qt/qtqml-cppintegration-definetypes.html#type-revisions-and-versions
Q_PROPERTY(QString title READ title WRITE setTitle NOTIFY windowTitleChanged)
Q_PROPERTY(Qt::WindowModality modality READ modality WRITE setModality NOTIFY modalityChanged)
@@ -115,15 +82,24 @@ class Q_GUI_EXPORT QWindow : public QObject, public QSurface
Q_PROPERTY(int width READ width WRITE setWidth NOTIFY widthChanged)
Q_PROPERTY(int height READ height WRITE setHeight NOTIFY heightChanged)
Q_PROPERTY(int minimumWidth READ minimumWidth WRITE setMinimumWidth NOTIFY minimumWidthChanged)
- Q_PROPERTY(int minimumHeight READ minimumHeight WRITE setMinimumHeight NOTIFY minimumHeightChanged)
+ Q_PROPERTY(int minimumHeight READ minimumHeight WRITE setMinimumHeight
+ NOTIFY minimumHeightChanged)
Q_PROPERTY(int maximumWidth READ maximumWidth WRITE setMaximumWidth NOTIFY maximumWidthChanged)
- Q_PROPERTY(int maximumHeight READ maximumHeight WRITE setMaximumHeight NOTIFY maximumHeightChanged)
+ Q_PROPERTY(int maximumHeight READ maximumHeight WRITE setMaximumHeight
+ NOTIFY maximumHeightChanged)
Q_PROPERTY(bool visible READ isVisible WRITE setVisible NOTIFY visibleChanged)
- Q_PROPERTY(bool active READ isActive NOTIFY activeChanged REVISION 1)
- Q_PROPERTY(Visibility visibility READ visibility WRITE setVisibility NOTIFY visibilityChanged REVISION 1)
- Q_PROPERTY(Qt::ScreenOrientation contentOrientation READ contentOrientation WRITE reportContentOrientationChange NOTIFY contentOrientationChanged)
- Q_PROPERTY(qreal opacity READ opacity WRITE setOpacity NOTIFY opacityChanged REVISION 1)
- Q_PRIVATE_PROPERTY(QWindow::d_func(), QWindow* transientParent MEMBER transientParent WRITE setTransientParent NOTIFY transientParentChanged REVISION 13)
+ Q_PROPERTY(bool active READ isActive NOTIFY activeChanged REVISION(2, 1))
+ Q_PROPERTY(Visibility visibility READ visibility WRITE setVisibility NOTIFY visibilityChanged
+ REVISION(2, 1))
+ Q_PROPERTY(Qt::ScreenOrientation contentOrientation READ contentOrientation
+ WRITE reportContentOrientationChange NOTIFY contentOrientationChanged)
+ Q_PROPERTY(qreal opacity READ opacity WRITE setOpacity NOTIFY opacityChanged REVISION(2, 1))
+#ifdef Q_QDOC
+ Q_PROPERTY(QWindow* transientParent READ transientParent WRITE setTransientParent NOTIFY transientParentChanged)
+#else
+ Q_PRIVATE_PROPERTY(QWindow::d_func(), QWindow* transientParent MEMBER transientParent
+ WRITE setTransientParent NOTIFY transientParentChanged REVISION(2, 13))
+#endif
public:
enum Visibility {
@@ -158,8 +134,7 @@ public:
WId winId() const;
- QWindow *parent(AncestorMode mode) const;
- QWindow *parent() const; // ### Qt6: Merge with above
+ QWindow *parent(AncestorMode mode = ExcludeTransients) const;
void setParent(QWindow *parent);
bool isTopLevel() const;
@@ -260,6 +235,8 @@ public:
virtual QAccessibleInterface *accessibleRoot() const;
virtual QObject *focusObject() const;
+ QPointF mapToGlobal(const QPointF &pos) const;
+ QPointF mapFromGlobal(const QPointF &pos) const;
QPoint mapToGlobal(const QPoint &pos) const;
QPoint mapFromGlobal(const QPoint &pos) const;
@@ -271,13 +248,15 @@ public:
static QWindow *fromWinId(WId id);
-#if QT_CONFIG(vulkan) || defined(Q_CLANG_QDOC)
+#if QT_CONFIG(vulkan) || defined(Q_QDOC)
void setVulkanInstance(QVulkanInstance *instance);
QVulkanInstance *vulkanInstance() const;
#endif
+ QT_DECLARE_NATIVE_INTERFACE_ACCESSOR(QWindow)
+
public Q_SLOTS:
- Q_REVISION(1) void requestActivate();
+ Q_REVISION(2, 1) void requestActivate();
void setVisible(bool visible);
@@ -292,6 +271,8 @@ public Q_SLOTS:
bool close();
void raise();
void lower();
+ bool startSystemResize(Qt::Edges edges);
+ bool startSystemMove();
void setTitle(const QString &);
@@ -307,15 +288,15 @@ public Q_SLOTS:
void setMaximumWidth(int w);
void setMaximumHeight(int h);
- Q_REVISION(1) void alert(int msec);
+ Q_REVISION(2, 1) void alert(int msec);
- Q_REVISION(3) void requestUpdate();
+ Q_REVISION(2, 3) void requestUpdate();
Q_SIGNALS:
void screenChanged(QScreen *screen);
void modalityChanged(Qt::WindowModality modality);
void windowStateChanged(Qt::WindowState windowState);
- Q_REVISION(2) void windowTitleChanged(const QString &title);
+ Q_REVISION(2, 2) void windowTitleChanged(const QString &title);
void xChanged(int arg);
void yChanged(int arg);
@@ -329,26 +310,27 @@ Q_SIGNALS:
void maximumHeightChanged(int arg);
void visibleChanged(bool arg);
- Q_REVISION(1) void visibilityChanged(QWindow::Visibility visibility);
- Q_REVISION(1) void activeChanged();
+ Q_REVISION(2, 1) void visibilityChanged(QWindow::Visibility visibility);
+ Q_REVISION(2, 1) void activeChanged();
void contentOrientationChanged(Qt::ScreenOrientation orientation);
void focusObjectChanged(QObject *object);
- Q_REVISION(1) void opacityChanged(qreal opacity);
+ Q_REVISION(2, 1) void opacityChanged(qreal opacity);
- Q_REVISION(13) void transientParentChanged(QWindow *transientParent);
+ Q_REVISION(2, 13) void transientParentChanged(QWindow *transientParent);
protected:
virtual void exposeEvent(QExposeEvent *);
virtual void resizeEvent(QResizeEvent *);
+ virtual void paintEvent(QPaintEvent *);
virtual void moveEvent(QMoveEvent *);
virtual void focusInEvent(QFocusEvent *);
virtual void focusOutEvent(QFocusEvent *);
virtual void showEvent(QShowEvent *);
virtual void hideEvent(QHideEvent *);
- // TODO Qt 6 - add closeEvent virtual handler
+ virtual void closeEvent(QCloseEvent *);
virtual bool event(QEvent *) override;
virtual void keyPressEvent(QKeyEvent *);
@@ -364,11 +346,7 @@ protected:
#if QT_CONFIG(tabletevent)
virtual void tabletEvent(QTabletEvent *);
#endif
-#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
virtual bool nativeEvent(const QByteArray &eventType, void *message, qintptr *result);
-#else
- virtual bool nativeEvent(const QByteArray &eventType, void *message, long *result);
-#endif
QWindow(QWindowPrivate &dd, QWindow *parent);
diff --git a/src/gui/kernel/qwindow_p.h b/src/gui/kernel/qwindow_p.h
index 5a7ec518fd..40ab06af8b 100644
--- a/src/gui/kernel/qwindow_p.h
+++ b/src/gui/kernel/qwindow_p.h
@@ -1,41 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the QtGui module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#ifndef QWINDOW_P_H
#define QWINDOW_P_H
@@ -58,11 +22,13 @@
#include <QtCore/private/qobject_p.h>
#include <QtCore/qelapsedtimer.h>
-#include <QtGui/QIcon>
+#include <QtCore/qxpfunctional.h>
+#include <QtGui/qicon.h>
+#include <QtGui/qpalette.h>
-QT_BEGIN_NAMESPACE
+#include <QtCore/qpointer.h>
-#define QWINDOWSIZE_MAX ((1<<24)-1)
+QT_BEGIN_NAMESPACE
class Q_GUI_EXPORT QWindowPrivate : public QObjectPrivate
{
@@ -75,15 +41,11 @@ public:
WindowFrameExclusive
};
- QWindowPrivate()
- : QObjectPrivate()
- {
- isWindow = true;
- }
+ QWindowPrivate();
+ ~QWindowPrivate() override;
- void init(QScreen *targetScreen = nullptr);
+ void init(QWindow *parent, QScreen *targetScreen = nullptr);
- void maybeQuitOnLastWindowClosed();
#ifndef QT_NO_CURSOR
void setCursor(const QCursor *c = nullptr);
bool applyCursor();
@@ -93,11 +55,8 @@ public:
QWindow *topLevelWindow(QWindow::AncestorMode mode = QWindow::IncludeTransients) const;
-#if QT_CONFIG(opengl)
- virtual QOpenGLContext *shareContext() const;
-#endif
-
virtual QWindow *eventReceiver() { Q_Q(QWindow); return q; }
+ virtual QPalette windowPalette() const { return QPalette(); }
virtual void setVisible(bool visible);
void updateVisibility();
@@ -107,7 +66,7 @@ public:
void updateSiblingPosition(SiblingPosition);
bool windowRecreationRequired(QScreen *newScreen) const;
- void create(bool recursive, WId nativeHandle = 0);
+ void create(bool recursive);
void destroy();
void setTopLevelScreen(QScreen *newScreen, bool recreate);
void connectToScreen(QScreen *topLevelScreen);
@@ -117,21 +76,37 @@ public:
void setTransientParent(QWindow *parent);
virtual void clearFocusObject();
+
+ enum class FocusTarget {
+ First,
+ Last,
+ Current,
+ Next,
+ Prev
+ };
+ virtual void setFocusToTarget(FocusTarget, Qt::FocusReason) {}
+
virtual QRectF closestAcceptableGeometry(const QRectF &rect) const;
- virtual void processSafeAreaMarginsChanged() {};
+ void setMinOrMaxSize(QSize *oldSizeMember, const QSize &size,
+ qxp::function_ref<void()> funcWidthChanged,
+ qxp::function_ref<void()> funcHeightChanged);
+
+ virtual void processSafeAreaMarginsChanged() {}
+
+ virtual bool participatesInLastWindowClosed() const;
+ virtual bool treatAsVisible() const;
bool isPopup() const { return (windowFlags & Qt::WindowType_Mask) == Qt::Popup; }
void setAutomaticPositionAndResizeEnabled(bool a)
{ positionAutomatic = resizeAutomatic = a; }
+ bool updateDevicePixelRatio();
+
static QWindowPrivate *get(QWindow *window) { return window->d_func(); }
static Qt::WindowState effectiveState(Qt::WindowStates);
- // ### Qt6: unused
- virtual bool allowClickThrough(const QPoint &) const { return true; }
-
QWindow::SurfaceType surfaceType = QWindow::RasterSurface;
Qt::WindowFlags windowFlags = Qt::Window;
QWindow *parentWindow = nullptr;
@@ -139,11 +114,13 @@ public:
bool visible= false;
bool visibilityOnDestroy = false;
bool exposed = false;
+ bool inClose = false;
QSurfaceFormat requestedFormat;
QString windowTitle;
QString windowFilePath;
QIcon windowIcon;
QRect geometry;
+ qreal devicePixelRatio = 1.0;
Qt::WindowStates windowState = Qt::WindowNoState;
QWindow::Visibility visibility = QWindow::Hidden;
bool resizeEventPending = true;
@@ -178,7 +155,6 @@ public:
bool hasCursor = false;
#endif
- bool compositing = false;
QElapsedTimer lastComposeTime;
#if QT_CONFIG(vulkan)
diff --git a/src/gui/kernel/qwindowdefs.h b/src/gui/kernel/qwindowdefs.h
index cb0842da8c..27d02d4d58 100644
--- a/src/gui/kernel/qwindowdefs.h
+++ b/src/gui/kernel/qwindowdefs.h
@@ -1,41 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the QtGui module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#ifndef QWINDOWDEFS_H
#define QWINDOWDEFS_H
@@ -68,7 +32,6 @@ class QFontMetrics;
class QFontInfo;
class QPen;
class QBrush;
-class QMatrix;
class QPixmap;
class QBitmap;
class QMovie;
@@ -89,7 +52,7 @@ QT_END_NAMESPACE
// Window system dependent definitions
-#if defined(Q_OS_WIN)
+#if defined(Q_OS_WIN) || defined(Q_QDOC)
# include <QtGui/qwindowdefs_win.h>
#endif // Q_OS_WIN
@@ -102,10 +65,7 @@ typedef QT_PREPEND_NAMESPACE(quintptr) WId;
QT_BEGIN_NAMESPACE
-template<class K, class V> class QHash;
typedef QHash<WId, QWidget *> QWidgetMapper;
-
-template<class V> class QSet;
typedef QSet<QWidget *> QWidgetSet;
QT_END_NAMESPACE
diff --git a/src/gui/kernel/qwindowdefs_win.h b/src/gui/kernel/qwindowdefs_win.h
index b546fe305e..c2b968fe1f 100644
--- a/src/gui/kernel/qwindowdefs_win.h
+++ b/src/gui/kernel/qwindowdefs_win.h
@@ -1,41 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the QtGui module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#ifndef QWINDOWDEFS_WIN_H
#define QWINDOWDEFS_WIN_H
@@ -72,6 +36,9 @@ QT_END_NAMESPACE
#ifndef HINSTANCE
Q_DECLARE_HANDLE(HINSTANCE);
#endif
+#ifndef HMODULE
+typedef HINSTANCE HMODULE;
+#endif
#ifndef HDC
Q_DECLARE_HANDLE(HDC);
#endif
@@ -105,6 +72,9 @@ Q_DECLARE_HANDLE(HRGN);
#ifndef HMONITOR
Q_DECLARE_HANDLE(HMONITOR);
#endif
+#ifndef HGLRC
+Q_DECLARE_HANDLE(HGLRC);
+#endif
#ifndef _HRESULT_DEFINED
typedef long HRESULT;
#endif
diff --git a/src/gui/kernel/qwindowsysteminterface.cpp b/src/gui/kernel/qwindowsysteminterface.cpp
index 00712ceb5d..1875594300 100644
--- a/src/gui/kernel/qwindowsysteminterface.cpp
+++ b/src/gui/kernel/qwindowsysteminterface.cpp
@@ -1,52 +1,20 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the QtGui module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2020 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#include "qwindowsysteminterface.h"
#include <qpa/qplatformwindow.h>
#include "qwindowsysteminterface_p.h"
#include "private/qguiapplication_p.h"
#include "private/qevent_p.h"
-#include "private/qtouchdevice_p.h"
+#include "private/qeventpoint_p.h"
+#include "private/qpointingdevice_p.h"
+#include "private/qscreen_p.h"
#include <QAbstractEventDispatcher>
#include <qpa/qplatformintegration.h>
#include <qdebug.h>
#include "qhighdpiscaling_p.h"
+
#include <QtCore/qscopedvaluerollback.h>
+#include <QtCore/private/qlocking_p.h>
#if QT_CONFIG(draganddrop)
#include <qpa/qplatformdrag.h>
@@ -54,14 +22,16 @@
QT_BEGIN_NAMESPACE
+using namespace Qt::StringLiterals;
+
+Q_LOGGING_CATEGORY(lcQpaInputDevices, "qt.qpa.input.devices")
-QElapsedTimer QWindowSystemInterfacePrivate::eventTime;
+Q_CONSTINIT QElapsedTimer QWindowSystemInterfacePrivate::eventTime;
bool QWindowSystemInterfacePrivate::synchronousWindowSystemEvents = false;
-bool QWindowSystemInterfacePrivate::platformFiltersEvents = false;
bool QWindowSystemInterfacePrivate::TabletEvent::platformSynthesizesMouse = true;
QWaitCondition QWindowSystemInterfacePrivate::eventsFlushed;
-QMutex QWindowSystemInterfacePrivate::flushEventMutex;
-QAtomicInt QWindowSystemInterfacePrivate::eventAccepted;
+Q_CONSTINIT QMutex QWindowSystemInterfacePrivate::flushEventMutex;
+Q_CONSTINIT QAtomicInt QWindowSystemInterfacePrivate::eventAccepted;
QWindowSystemEventHandler *QWindowSystemInterfacePrivate::eventHandler;
QWindowSystemInterfacePrivate::WindowSystemEventList QWindowSystemInterfacePrivate::windowSystemEventQueue;
@@ -70,20 +40,45 @@ extern QPointer<QWindow> qt_last_mouse_receiver;
// ------------------- QWindowSystemInterfacePrivate -------------------
+/*!
+ \internal
+
+ The QWindowSystemHelper creates synchronously delivered events on the stack, unless
+ the calling thread is not the Gui thread.
+
+ Asynchronously delivered events, and events created outside the Gui thread are
+ allocated on the heap.
+*/
+
+template<typename Delivery>
+struct QWindowSystemHelper
+{
+ template<typename EventType, typename ...Args>
+ static bool handleEvent(Args ...);
+};
+
/*
- Handles a window system event asynchronously by posting the event to Qt Gui.
+ Handles a window system event.
- This function posts the event on the window system event queue and wakes the
- Gui event dispatcher. Qt Gui will then handle the event asynchonously at a
- later point.
+ By default this function posts the event on the window system event queue and
+ wakes the Gui event dispatcher. Qt Gui will then handle the event asynchronously
+ at a later point. The return value is not used in asynchronous mode and will
+ always be true.
+
+ In synchronous mode Qt Gui will process the event immediately. The return value
+ indicates if Qt accepted the event. If the event is delivered from another thread
+ than the Qt main thread the window system event queue is flushed, which may deliver
+ other events as well.
+
+ \sa flushWindowSystemEvents(), setSynchronousWindowSystemEvents()
*/
template<>
-bool QWindowSystemInterfacePrivate::handleWindowSystemEvent<QWindowSystemInterface::AsynchronousDelivery>(WindowSystemEvent *ev)
+template<typename EventType, typename ...Args>
+bool QWindowSystemHelper<QWindowSystemInterface::DefaultDelivery>::handleEvent(Args ...args)
{
- windowSystemEventQueue.append(ev);
- if (QAbstractEventDispatcher *dispatcher = QGuiApplicationPrivate::qt_qpa_core_dispatcher())
- dispatcher->wakeUp();
- return true;
+ return QWindowSystemInterfacePrivate::synchronousWindowSystemEvents
+ ? QWindowSystemHelper<QWindowSystemInterface::SynchronousDelivery>::handleEvent<EventType>(args...)
+ : QWindowSystemHelper<QWindowSystemInterface::AsynchronousDelivery>::handleEvent<EventType>(args...);
}
/*
@@ -97,50 +92,53 @@ bool QWindowSystemInterfacePrivate::handleWindowSystemEvent<QWindowSystemInterfa
well.
*/
template<>
-bool QWindowSystemInterfacePrivate::handleWindowSystemEvent<QWindowSystemInterface::SynchronousDelivery>(WindowSystemEvent *ev)
+template<typename EventType, typename ...Args>
+bool QWindowSystemHelper<QWindowSystemInterface::SynchronousDelivery>::handleEvent(Args ...args)
{
- bool accepted = true;
if (QThread::currentThread() == QGuiApplication::instance()->thread()) {
- // Process the event immediately on the current thread and return the accepted state.
- QGuiApplicationPrivate::processWindowSystemEvent(ev);
- accepted = ev->eventAccepted;
- delete ev;
+ EventType event(args...);
+ // Process the event immediately on the Gui thread and return the accepted state
+ if (QWindowSystemInterfacePrivate::eventHandler) {
+ if (!QWindowSystemInterfacePrivate::eventHandler->sendEvent(&event))
+ return false;
+ } else {
+ QGuiApplicationPrivate::processWindowSystemEvent(&event);
+ }
+ return event.eventAccepted;
} else {
// Post the event on the Qt main thread queue and flush the queue.
// This will wake up the Gui thread which will process the event.
// Return the accepted state for the last event on the queue,
// which is the event posted by this function.
- handleWindowSystemEvent<QWindowSystemInterface::AsynchronousDelivery>(ev);
- accepted = QWindowSystemInterface::flushWindowSystemEvents();
+ QWindowSystemHelper<QWindowSystemInterface::AsynchronousDelivery>::handleEvent<EventType>(args...);
+ return QWindowSystemInterface::flushWindowSystemEvents();
}
- return accepted;
}
/*
- Handles a window system event.
-
- By default this function posts the event on the window system event queue and
- wakes the Gui event dispatcher. Qt Gui will then handle the event asynchonously
- at a later point. The return value is not used in asynchronous mode and will
- always be true.
-
- In synchronous mode Qt Gui will process the event immediately. The return value
- indicates if Qt accepted the event. If the event is delivered from another thread
- than the Qt main thread the window system event queue is flushed, which may deliver
- other events as well.
+ Handles a window system event asynchronously by posting the event to Qt Gui.
- \sa flushWindowSystemEvents(), setSynchronousWindowSystemEvents()
+ This function posts the event on the window system event queue and wakes the
+ Gui event dispatcher. Qt Gui will then handle the event asynchronously at a
+ later point.
*/
template<>
-bool QWindowSystemInterfacePrivate::handleWindowSystemEvent<QWindowSystemInterface::DefaultDelivery>(QWindowSystemInterfacePrivate::WindowSystemEvent *ev)
+template<typename EventType, typename ...Args>
+bool QWindowSystemHelper<QWindowSystemInterface::AsynchronousDelivery>::handleEvent(Args ...args)
{
- if (synchronousWindowSystemEvents)
- return handleWindowSystemEvent<QWindowSystemInterface::SynchronousDelivery>(ev);
- else
- return handleWindowSystemEvent<QWindowSystemInterface::AsynchronousDelivery>(ev);
+ QWindowSystemInterfacePrivate::windowSystemEventQueue.append(new EventType(args...));
+ if (QAbstractEventDispatcher *dispatcher = QGuiApplicationPrivate::qt_qpa_core_dispatcher())
+ dispatcher->wakeUp();
+ return true;
}
-int QWindowSystemInterfacePrivate::windowSystemEventsQueued()
+template <typename EventType, typename Delivery = QWindowSystemInterface::DefaultDelivery, typename ...Args>
+static bool handleWindowSystemEvent(Args ...args)
+{
+ return QWindowSystemHelper<Delivery>::template handleEvent<EventType>(args...);
+}
+
+qsizetype QWindowSystemInterfacePrivate::windowSystemEventsQueued()
{
return windowSystemEventQueue.count();
}
@@ -219,16 +217,14 @@ bool QWindowSystemEventHandler::sendEvent(QWindowSystemInterfacePrivate::WindowS
QT_DEFINE_QPA_EVENT_HANDLER(void, handleEnterEvent, QWindow *window, const QPointF &local, const QPointF &global)
{
if (window) {
- QWindowSystemInterfacePrivate::EnterEvent *e
- = new QWindowSystemInterfacePrivate::EnterEvent(window, QHighDpi::fromNativeLocalPosition(local, window), QHighDpi::fromNativePixels(global, window));
- QWindowSystemInterfacePrivate::handleWindowSystemEvent<Delivery>(e);
+ handleWindowSystemEvent<QWindowSystemInterfacePrivate::EnterEvent, Delivery>(window,
+ QHighDpi::fromNativeLocalPosition(local, window), QHighDpi::fromNativeGlobalPosition(global, window));
}
}
QT_DEFINE_QPA_EVENT_HANDLER(void, handleLeaveEvent, QWindow *window)
{
- QWindowSystemInterfacePrivate::LeaveEvent *e = new QWindowSystemInterfacePrivate::LeaveEvent(window);
- QWindowSystemInterfacePrivate::handleWindowSystemEvent<Delivery>(e);
+ handleWindowSystemEvent<QWindowSystemInterfacePrivate::LeaveEvent, Delivery>(window);
}
/*!
@@ -244,11 +240,9 @@ void QWindowSystemInterface::handleEnterLeaveEvent(QWindow *enter, QWindow *leav
handleEnterEvent(enter, local, global);
}
-QT_DEFINE_QPA_EVENT_HANDLER(void, handleWindowActivated, QWindow *window, Qt::FocusReason r)
+QT_DEFINE_QPA_EVENT_HANDLER(void, handleFocusWindowChanged, QWindow *window, Qt::FocusReason r)
{
- QWindowSystemInterfacePrivate::ActivatedWindowEvent *e =
- new QWindowSystemInterfacePrivate::ActivatedWindowEvent(window, r);
- QWindowSystemInterfacePrivate::handleWindowSystemEvent<Delivery>(e);
+ handleWindowSystemEvent<QWindowSystemInterfacePrivate::FocusWindowEvent, Delivery>(window, r);
}
QT_DEFINE_QPA_EVENT_HANDLER(void, handleWindowStateChanged, QWindow *window, Qt::WindowStates newState, int oldState)
@@ -257,38 +251,35 @@ QT_DEFINE_QPA_EVENT_HANDLER(void, handleWindowStateChanged, QWindow *window, Qt:
if (oldState < Qt::WindowNoState)
oldState = window->windowStates();
- QWindowSystemInterfacePrivate::WindowStateChangedEvent *e =
- new QWindowSystemInterfacePrivate::WindowStateChangedEvent(window, newState, Qt::WindowStates(oldState));
- QWindowSystemInterfacePrivate::handleWindowSystemEvent<Delivery>(e);
+ handleWindowSystemEvent<QWindowSystemInterfacePrivate::WindowStateChangedEvent, Delivery>(window, newState, Qt::WindowStates(oldState));
}
QT_DEFINE_QPA_EVENT_HANDLER(void, handleWindowScreenChanged, QWindow *window, QScreen *screen)
{
+ handleWindowSystemEvent<QWindowSystemInterfacePrivate::WindowScreenChangedEvent, Delivery>(window, screen);
+}
- QWindowSystemInterfacePrivate::WindowScreenChangedEvent *e =
- new QWindowSystemInterfacePrivate::WindowScreenChangedEvent(window, screen);
- QWindowSystemInterfacePrivate::handleWindowSystemEvent<Delivery>(e);
+QT_DEFINE_QPA_EVENT_HANDLER(void, handleWindowDevicePixelRatioChanged, QWindow *window)
+{
+ handleWindowSystemEvent<QWindowSystemInterfacePrivate::WindowDevicePixelRatioChangedEvent, Delivery>(window);
}
+
QT_DEFINE_QPA_EVENT_HANDLER(void, handleSafeAreaMarginsChanged, QWindow *window)
{
- QWindowSystemInterfacePrivate::SafeAreaMarginsChangedEvent *e =
- new QWindowSystemInterfacePrivate::SafeAreaMarginsChangedEvent(window);
- QWindowSystemInterfacePrivate::handleWindowSystemEvent<Delivery>(e);
+ handleWindowSystemEvent<QWindowSystemInterfacePrivate::SafeAreaMarginsChangedEvent, Delivery>(window);
}
QT_DEFINE_QPA_EVENT_HANDLER(void, handleApplicationStateChanged, Qt::ApplicationState newState, bool forcePropagate)
{
Q_ASSERT(QGuiApplicationPrivate::platformIntegration()->hasCapability(QPlatformIntegration::ApplicationState));
- QWindowSystemInterfacePrivate::ApplicationStateChangedEvent *e =
- new QWindowSystemInterfacePrivate::ApplicationStateChangedEvent(newState, forcePropagate);
- QWindowSystemInterfacePrivate::handleWindowSystemEvent<Delivery>(e);
+ handleWindowSystemEvent<QWindowSystemInterfacePrivate::ApplicationStateChangedEvent, Delivery>(newState, forcePropagate);
}
QT_DEFINE_QPA_EVENT_HANDLER(bool, handleApplicationTermination)
{
- auto *e = new QWindowSystemInterfacePrivate::WindowSystemEvent(QWindowSystemInterfacePrivate::ApplicationTermination);
- return QWindowSystemInterfacePrivate::handleWindowSystemEvent<Delivery>(e);
+ return handleWindowSystemEvent<QWindowSystemInterfacePrivate::WindowSystemEvent, Delivery>(
+ QWindowSystemInterfacePrivate::ApplicationTermination);
}
QWindowSystemInterfacePrivate::GeometryChangeEvent::GeometryChangeEvent(QWindow *window, const QRect &newGeometry)
@@ -296,14 +287,16 @@ QWindowSystemInterfacePrivate::GeometryChangeEvent::GeometryChangeEvent(QWindow
, window(window)
, newGeometry(newGeometry)
{
- if (const QPlatformWindow *pw = window->handle())
- requestedGeometry = QHighDpi::fromNativePixels(pw->QPlatformWindow::geometry(), window);
+ if (const QPlatformWindow *pw = window->handle()) {
+ const auto nativeGeometry = pw->QPlatformWindow::geometry();
+ requestedGeometry = QHighDpi::fromNativeWindowGeometry(nativeGeometry, window);
+ }
}
QT_DEFINE_QPA_EVENT_HANDLER(void, handleGeometryChange, QWindow *window, const QRect &newRect)
{
Q_ASSERT(window);
- QWindowSystemInterfacePrivate::GeometryChangeEvent *e = new QWindowSystemInterfacePrivate::GeometryChangeEvent(window, QHighDpi::fromNativePixels(newRect, window));
+ const auto newRectDi = QHighDpi::fromNativeWindowGeometry(newRect, window);
if (window->handle()) {
// Persist the new geometry so that QWindow::geometry() can be queried in the resize event
window->handle()->QPlatformWindow::setGeometry(newRect);
@@ -311,7 +304,7 @@ QT_DEFINE_QPA_EVENT_HANDLER(void, handleGeometryChange, QWindow *window, const Q
// have its handle set up yet. Platforms that deliver events during window creation need
// to handle the persistence manually, e.g. by overriding geometry().
}
- QWindowSystemInterfacePrivate::handleWindowSystemEvent<Delivery>(e);
+ handleWindowSystemEvent<QWindowSystemInterfacePrivate::GeometryChangeEvent, Delivery>(window, newRectDi);
}
QWindowSystemInterfacePrivate::ExposeEvent::ExposeEvent(QWindow *window, const QRegion &region)
@@ -339,18 +332,23 @@ QWindowSystemInterfacePrivate::ExposeEvent::ExposeEvent(QWindow *window, const Q
This is required behavior on platforms where OpenGL swapbuffers stops
blocking for obscured windows (like macOS).
*/
-QT_DEFINE_QPA_EVENT_HANDLER(void, handleExposeEvent, QWindow *window, const QRegion &region)
+QT_DEFINE_QPA_EVENT_HANDLER(bool, handleExposeEvent, QWindow *window, const QRegion &region)
{
- QWindowSystemInterfacePrivate::ExposeEvent *e =
- new QWindowSystemInterfacePrivate::ExposeEvent(window, QHighDpi::fromNativeLocalExposedRegion(region, window));
- QWindowSystemInterfacePrivate::handleWindowSystemEvent<Delivery>(e);
+ return handleWindowSystemEvent<QWindowSystemInterfacePrivate::ExposeEvent, Delivery>(window,
+ QHighDpi::fromNativeLocalExposedRegion(region, window));
}
+QT_DEFINE_QPA_EVENT_HANDLER(bool, handlePaintEvent, QWindow *window, const QRegion &region)
+{
+ return handleWindowSystemEvent<QWindowSystemInterfacePrivate::PaintEvent, Delivery>(window,
+ QHighDpi::fromNativeLocalExposedRegion(region, window));
+}
+
+
QT_DEFINE_QPA_EVENT_HANDLER(bool, handleCloseEvent, QWindow *window)
{
Q_ASSERT(window);
- auto *event = new QWindowSystemInterfacePrivate::CloseEvent(window);
- return QWindowSystemInterfacePrivate::handleWindowSystemEvent<Delivery>(event);
+ return handleWindowSystemEvent<QWindowSystemInterfacePrivate::CloseEvent, Delivery>(window);
}
/*!
@@ -358,83 +356,67 @@ QT_DEFINE_QPA_EVENT_HANDLER(bool, handleCloseEvent, QWindow *window)
\a w == 0 means that the event is in global coords only, \a local will be ignored in this case
*/
-#if QT_DEPRECATED_SINCE(5, 11)
-QT_DEFINE_QPA_EVENT_HANDLER(void, handleMouseEvent, QWindow *window, const QPointF &local, const QPointF &global, Qt::MouseButtons b,
- Qt::KeyboardModifiers mods, Qt::MouseEventSource source)
-{
- handleMouseEvent<Delivery>(window, local, global, b, Qt::NoButton, QEvent::None, mods, source);
-}
-QT_DEFINE_QPA_EVENT_HANDLER(void, handleMouseEvent, QWindow *window, ulong timestamp, const QPointF &local, const QPointF &global, Qt::MouseButtons b,
- Qt::KeyboardModifiers mods, Qt::MouseEventSource source)
-{
- handleMouseEvent<Delivery>(window, timestamp, local, global, b, Qt::NoButton, QEvent::None, mods, source);
-}
-
-void QWindowSystemInterface::handleFrameStrutMouseEvent(QWindow *window, const QPointF &local, const QPointF &global, Qt::MouseButtons b,
- Qt::KeyboardModifiers mods, Qt::MouseEventSource source)
+QT_DEFINE_QPA_EVENT_HANDLER(bool, handleMouseEvent, QWindow *window,
+ const QPointF &local, const QPointF &global, Qt::MouseButtons state,
+ Qt::MouseButton button, QEvent::Type type, Qt::KeyboardModifiers mods,
+ Qt::MouseEventSource source)
{
- handleFrameStrutMouseEvent(window, local, global, b, Qt::NoButton, QEvent::None, mods, source);
+ unsigned long time = QWindowSystemInterfacePrivate::eventTime.elapsed();
+ return handleMouseEvent<Delivery>(window, time, local, global, state, button, type, mods, source);
}
-void QWindowSystemInterface::handleFrameStrutMouseEvent(QWindow *window, ulong timestamp, const QPointF &local, const QPointF &global, Qt::MouseButtons b,
- Qt::KeyboardModifiers mods, Qt::MouseEventSource source)
+QT_DEFINE_QPA_EVENT_HANDLER(bool, handleMouseEvent, QWindow *window, const QPointingDevice *device,
+ const QPointF &local, const QPointF &global, Qt::MouseButtons state,
+ Qt::MouseButton button, QEvent::Type type, Qt::KeyboardModifiers mods,
+ Qt::MouseEventSource source)
{
- handleFrameStrutMouseEvent(window, timestamp, local, global, b, Qt::NoButton, QEvent::None, mods, source);
+ unsigned long time = QWindowSystemInterfacePrivate::eventTime.elapsed();
+ return handleMouseEvent<Delivery>(window, time, device, local, global, state, button, type, mods, source);
}
-#endif // QT_DEPRECATED_SINCE(5, 11)
-QT_DEFINE_QPA_EVENT_HANDLER(void, handleMouseEvent, QWindow *window,
+QT_DEFINE_QPA_EVENT_HANDLER(bool, handleMouseEvent, QWindow *window, ulong timestamp,
const QPointF &local, const QPointF &global, Qt::MouseButtons state,
Qt::MouseButton button, QEvent::Type type, Qt::KeyboardModifiers mods,
Qt::MouseEventSource source)
{
- unsigned long time = QWindowSystemInterfacePrivate::eventTime.elapsed();
- handleMouseEvent<Delivery>(window, time, local, global, state, button, type, mods, source);
+ return handleMouseEvent<Delivery>(window, timestamp, QPointingDevice::primaryPointingDevice(),
+ local, global, state, button, type, mods, source);
}
-QT_DEFINE_QPA_EVENT_HANDLER(void, handleMouseEvent, QWindow *window, ulong timestamp,
+QT_DEFINE_QPA_EVENT_HANDLER(bool, handleMouseEvent, QWindow *window, ulong timestamp, const QPointingDevice *device,
const QPointF &local, const QPointF &global, Qt::MouseButtons state,
Qt::MouseButton button, QEvent::Type type, Qt::KeyboardModifiers mods,
Qt::MouseEventSource source)
{
- Q_ASSERT_X(type != QEvent::MouseButtonDblClick && type != QEvent::NonClientAreaMouseButtonDblClick,
- "QWindowSystemInterface::handleMouseEvent",
- "QTBUG-71263: Native double clicks are not implemented.");
- auto localPos = QHighDpi::fromNativeLocalPosition(local, window);
- auto globalPos = QHighDpi::fromNativePixels(global, window);
- QWindowSystemInterfacePrivate::MouseEvent *e =
- new QWindowSystemInterfacePrivate::MouseEvent(window, timestamp, localPos, globalPos,
- state, mods, button, type, source);
- QWindowSystemInterfacePrivate::handleWindowSystemEvent<Delivery>(e);
-}
+ bool isNonClientArea = {};
-void QWindowSystemInterface::handleFrameStrutMouseEvent(QWindow *window,
- const QPointF &local, const QPointF &global,
- Qt::MouseButtons state,
- Qt::MouseButton button, QEvent::Type type,
- Qt::KeyboardModifiers mods,
- Qt::MouseEventSource source)
-{
- const unsigned long time = QWindowSystemInterfacePrivate::eventTime.elapsed();
- handleFrameStrutMouseEvent(window, time, local, global, state, button, type, mods, source);
-}
+ switch (type) {
+ case QEvent::MouseButtonDblClick:
+ case QEvent::NonClientAreaMouseButtonDblClick:
+ Q_ASSERT_X(false, "QWindowSystemInterface::handleMouseEvent",
+ "QTBUG-71263: Native double clicks are not implemented.");
+ return false;
+ case QEvent::MouseMove:
+ case QEvent::MouseButtonPress:
+ case QEvent::MouseButtonRelease:
+ isNonClientArea = false;
+ break;
+ case QEvent::NonClientAreaMouseMove:
+ case QEvent::NonClientAreaMouseButtonPress:
+ case QEvent::NonClientAreaMouseButtonRelease:
+ isNonClientArea = true;
+ break;
+ default:
+ Q_UNREACHABLE();
+ }
-void QWindowSystemInterface::handleFrameStrutMouseEvent(QWindow *window, ulong timestamp,
- const QPointF &local, const QPointF &global,
- Qt::MouseButtons state,
- Qt::MouseButton button, QEvent::Type type,
- Qt::KeyboardModifiers mods,
- Qt::MouseEventSource source)
-{
auto localPos = QHighDpi::fromNativeLocalPosition(local, window);
- auto globalPos = QHighDpi::fromNativePixels(global, window);
+ auto globalPos = QHighDpi::fromNativeGlobalPosition(global, window);
- QWindowSystemInterfacePrivate::MouseEvent *e =
- new QWindowSystemInterfacePrivate::MouseEvent(window, timestamp, localPos, globalPos,
- state, mods, button, type, source, true);
- QWindowSystemInterfacePrivate::handleWindowSystemEvent(e);
+ return handleWindowSystemEvent<QWindowSystemInterfacePrivate::MouseEvent, Delivery>(window,
+ timestamp, localPos, globalPos, state, mods, button, type, source, isNonClientArea, device);
}
bool QWindowSystemInterface::handleShortcutEvent(QWindow *window, ulong timestamp, int keyCode, Qt::KeyboardModifiers modifiers, quint32 nativeScanCode,
@@ -451,13 +433,11 @@ bool QWindowSystemInterface::handleShortcutEvent(QWindow *window, ulong timestam
// key event, so that the target that accepted the shortcut override event can handle it. Note that we only
// do this if the shortcut map hasn't found a partial shortcut match yet. If it has, the shortcut can not be
// overridden.
- QWindowSystemInterfacePrivate::KeyEvent *shortcutOverrideEvent = new QWindowSystemInterfacePrivate::KeyEvent(window, timestamp,
- QEvent::ShortcutOverride, keyCode, modifiers, nativeScanCode, nativeVirtualKey, nativeModifiers, text, autorepeat, count);
-
- {
- if (QWindowSystemInterfacePrivate::handleWindowSystemEvent<SynchronousDelivery>(shortcutOverrideEvent))
- return false;
- }
+ bool overridden = handleWindowSystemEvent<QWindowSystemInterfacePrivate::KeyEvent, SynchronousDelivery>
+ (window,timestamp, QEvent::ShortcutOverride, keyCode, modifiers, nativeScanCode,
+ nativeVirtualKey, nativeModifiers, text, autorepeat, count);
+ if (overridden)
+ return false;
}
// The shortcut event is dispatched as a QShortcutEvent, not a QKeyEvent, but we use
@@ -468,16 +448,16 @@ bool QWindowSystemInterface::handleShortcutEvent(QWindow *window, ulong timestam
return shortcutMap.tryShortcut(&keyEvent);
#else
- Q_UNUSED(window)
- Q_UNUSED(timestamp)
- Q_UNUSED(keyCode)
- Q_UNUSED(modifiers)
- Q_UNUSED(nativeScanCode)
- Q_UNUSED(nativeVirtualKey)
- Q_UNUSED(nativeModifiers)
- Q_UNUSED(text)
- Q_UNUSED(autorepeat)
- Q_UNUSED(count)
+ Q_UNUSED(window);
+ Q_UNUSED(timestamp);
+ Q_UNUSED(keyCode);
+ Q_UNUSED(modifiers);
+ Q_UNUSED(nativeScanCode);
+ Q_UNUSED(nativeVirtualKey);
+ Q_UNUSED(nativeModifiers);
+ Q_UNUSED(text);
+ Q_UNUSED(autorepeat);
+ Q_UNUSED(count);
return false;
#endif
}
@@ -489,25 +469,19 @@ QT_DEFINE_QPA_EVENT_HANDLER(bool, handleKeyEvent, QWindow *window, QEvent::Type
QT_DEFINE_QPA_EVENT_HANDLER(bool, handleKeyEvent, QWindow *window, ulong timestamp, QEvent::Type t, int k, Qt::KeyboardModifiers mods, const QString & text, bool autorep, ushort count)
{
-#if defined(Q_OS_OSX)
- if (t == QEvent::KeyPress && QWindowSystemInterface::handleShortcutEvent(window, timestamp, k, mods, 0, 0, 0, text, autorep, count))
- return true;
-#endif
-
- QWindowSystemInterfacePrivate::KeyEvent * e =
- new QWindowSystemInterfacePrivate::KeyEvent(window, timestamp, t, k, mods, text, autorep, count);
- return QWindowSystemInterfacePrivate::handleWindowSystemEvent<Delivery>(e);
+ return handleWindowSystemEvent<QWindowSystemInterfacePrivate::KeyEvent, Delivery>(window,
+ timestamp, t, k, mods, text, autorep, count);
}
bool QWindowSystemInterface::handleExtendedKeyEvent(QWindow *window, QEvent::Type type, int key, Qt::KeyboardModifiers modifiers,
quint32 nativeScanCode, quint32 nativeVirtualKey,
quint32 nativeModifiers,
const QString& text, bool autorep,
- ushort count, bool tryShortcutOverride)
+ ushort count)
{
unsigned long time = QWindowSystemInterfacePrivate::eventTime.elapsed();
return handleExtendedKeyEvent(window, time, type, key, modifiers, nativeScanCode, nativeVirtualKey, nativeModifiers,
- text, autorep, count, tryShortcutOverride);
+ text, autorep, count);
}
bool QWindowSystemInterface::handleExtendedKeyEvent(QWindow *window, ulong timestamp, QEvent::Type type, int key,
@@ -515,53 +489,28 @@ bool QWindowSystemInterface::handleExtendedKeyEvent(QWindow *window, ulong times
quint32 nativeScanCode, quint32 nativeVirtualKey,
quint32 nativeModifiers,
const QString& text, bool autorep,
- ushort count, bool tryShortcutOverride)
+ ushort count)
{
-#if defined(Q_OS_OSX)
- if (tryShortcutOverride && type == QEvent::KeyPress && QWindowSystemInterface::handleShortcutEvent(window,
- timestamp, key, modifiers, nativeScanCode, nativeVirtualKey, nativeModifiers, text, autorep, count)) {
- return true;
- }
-#else
- Q_UNUSED(tryShortcutOverride)
-#endif
-
- QWindowSystemInterfacePrivate::KeyEvent * e =
- new QWindowSystemInterfacePrivate::KeyEvent(window, timestamp, type, key, modifiers,
- nativeScanCode, nativeVirtualKey, nativeModifiers, text, autorep, count);
- return QWindowSystemInterfacePrivate::handleWindowSystemEvent(e);
+ return handleWindowSystemEvent<QWindowSystemInterfacePrivate::KeyEvent>(window,
+ timestamp, type, key, modifiers, nativeScanCode, nativeVirtualKey, nativeModifiers, text, autorep, count);
}
-QWindowSystemInterfacePrivate::WheelEvent::WheelEvent(QWindow *window, ulong time, const QPointF &local, const QPointF &global, QPoint pixelD,
- QPoint angleD, int qt4D, Qt::Orientation qt4O, Qt::KeyboardModifiers mods, Qt::ScrollPhase phase, Qt::MouseEventSource src, bool inverted)
- : InputEvent(window, time, Wheel, mods), pixelDelta(pixelD), angleDelta(angleD), qt4Delta(qt4D),
- qt4Orientation(qt4O), localPos(local), globalPos(global), phase(phase), source(src), inverted(inverted)
+bool QWindowSystemInterface::handleWheelEvent(QWindow *window, const QPointF &local, const QPointF &global, QPoint pixelDelta, QPoint angleDelta, Qt::KeyboardModifiers mods, Qt::ScrollPhase phase, Qt::MouseEventSource source)
{
-}
-
-#if QT_DEPRECATED_SINCE(5, 10)
-void QWindowSystemInterface::handleWheelEvent(QWindow *window, const QPointF &local, const QPointF &global, int d, Qt::Orientation o, Qt::KeyboardModifiers mods) {
unsigned long time = QWindowSystemInterfacePrivate::eventTime.elapsed();
-QT_WARNING_PUSH
-QT_WARNING_DISABLE_DEPRECATED
- handleWheelEvent(window, time, local, global, d, o, mods);
-QT_WARNING_POP
-}
-
-void QWindowSystemInterface::handleWheelEvent(QWindow *window, ulong timestamp, const QPointF &local, const QPointF &global, int d, Qt::Orientation o, Qt::KeyboardModifiers mods)
-{
- QPoint point = (o == Qt::Vertical) ? QPoint(0, d) : QPoint(d, 0);
- handleWheelEvent(window, timestamp, local, global, QPoint(), point, mods);
+ return handleWheelEvent(window, time, local, global, pixelDelta, angleDelta, mods, phase, source);
}
-#endif // QT_DEPRECATED_SINCE(5, 10)
-void QWindowSystemInterface::handleWheelEvent(QWindow *window, const QPointF &local, const QPointF &global, QPoint pixelDelta, QPoint angleDelta, Qt::KeyboardModifiers mods, Qt::ScrollPhase phase, Qt::MouseEventSource source)
+bool QWindowSystemInterface::handleWheelEvent(QWindow *window, ulong timestamp, const QPointF &local, const QPointF &global, QPoint pixelDelta, QPoint angleDelta, Qt::KeyboardModifiers mods, Qt::ScrollPhase phase,
+ Qt::MouseEventSource source, bool invertedScrolling)
{
- unsigned long time = QWindowSystemInterfacePrivate::eventTime.elapsed();
- handleWheelEvent(window, time, local, global, pixelDelta, angleDelta, mods, phase, source);
+ return handleWheelEvent(window, timestamp, QPointingDevice::primaryPointingDevice(), local, global,
+ pixelDelta, angleDelta, mods, phase, source, invertedScrolling);
}
-void QWindowSystemInterface::handleWheelEvent(QWindow *window, ulong timestamp, const QPointF &local, const QPointF &global, QPoint pixelDelta, QPoint angleDelta, Qt::KeyboardModifiers mods, Qt::ScrollPhase phase,
+bool QWindowSystemInterface::handleWheelEvent(QWindow *window, ulong timestamp, const QPointingDevice *device,
+ const QPointF &local, const QPointF &global, QPoint pixelDelta, QPoint angleDelta,
+ Qt::KeyboardModifiers mods, Qt::ScrollPhase phase,
Qt::MouseEventSource source, bool invertedScrolling)
{
// Qt 4 sends two separate wheel events for horizontal and vertical
@@ -571,123 +520,117 @@ void QWindowSystemInterface::handleWheelEvent(QWindow *window, ulong timestamp,
// In addition high-resolution pixel-based deltas are also supported.
// Platforms that does not support these may pass a null point here.
// Angle deltas must always be sent in addition to pixel deltas.
- QWindowSystemInterfacePrivate::WheelEvent *e;
// Pass Qt::ScrollBegin and Qt::ScrollEnd through
// even if the wheel delta is null.
if (angleDelta.isNull() && phase == Qt::ScrollUpdate)
- return;
+ return false;
// Simple case: vertical deltas only:
if (angleDelta.y() != 0 && angleDelta.x() == 0) {
- e = new QWindowSystemInterfacePrivate::WheelEvent(window, timestamp, QHighDpi::fromNativeLocalPosition(local, window), QHighDpi::fromNativePixels(global, window), pixelDelta, angleDelta, angleDelta.y(), Qt::Vertical,
- mods, phase, source, invertedScrolling);
- QWindowSystemInterfacePrivate::handleWindowSystemEvent(e);
- return;
+ return handleWindowSystemEvent<QWindowSystemInterfacePrivate::WheelEvent>(window,
+ timestamp, QHighDpi::fromNativeLocalPosition(local, window), QHighDpi::fromNativeGlobalPosition(global, window),
+ pixelDelta, angleDelta, angleDelta.y(), Qt::Vertical, mods, phase, source, invertedScrolling, device);
}
// Simple case: horizontal deltas only:
if (angleDelta.y() == 0 && angleDelta.x() != 0) {
- e = new QWindowSystemInterfacePrivate::WheelEvent(window, timestamp, QHighDpi::fromNativeLocalPosition(local, window), QHighDpi::fromNativePixels(global, window), pixelDelta, angleDelta, angleDelta.x(), Qt::Horizontal, mods, phase, source, invertedScrolling);
- QWindowSystemInterfacePrivate::handleWindowSystemEvent(e);
- return;
+ return handleWindowSystemEvent<QWindowSystemInterfacePrivate::WheelEvent>(window,
+ timestamp, QHighDpi::fromNativeLocalPosition(local, window), QHighDpi::fromNativeGlobalPosition(global, window),
+ pixelDelta, angleDelta, angleDelta.x(), Qt::Horizontal, mods, phase, source, invertedScrolling, device);
}
+ bool acceptVert;
+ bool acceptHorz;
// Both horizontal and vertical deltas: Send two wheel events.
// The first event contains the Qt 5 pixel and angle delta as points,
// and in addition the Qt 4 compatibility vertical angle delta.
- e = new QWindowSystemInterfacePrivate::WheelEvent(window, timestamp, QHighDpi::fromNativeLocalPosition(local, window), QHighDpi::fromNativePixels(global, window), pixelDelta, angleDelta, angleDelta.y(), Qt::Vertical, mods, phase, source, invertedScrolling);
- QWindowSystemInterfacePrivate::handleWindowSystemEvent(e);
+ acceptVert = handleWindowSystemEvent<QWindowSystemInterfacePrivate::WheelEvent>(window,
+ timestamp, QHighDpi::fromNativeLocalPosition(local, window), QHighDpi::fromNativeGlobalPosition(global, window),
+ pixelDelta, angleDelta, angleDelta.y(), Qt::Vertical, mods, phase, source, invertedScrolling, device);
// The second event contains null pixel and angle points and the
// Qt 4 compatibility horizontal angle delta.
- e = new QWindowSystemInterfacePrivate::WheelEvent(window, timestamp, QHighDpi::fromNativeLocalPosition(local, window), QHighDpi::fromNativePixels(global, window), QPoint(), QPoint(), angleDelta.x(), Qt::Horizontal, mods, phase, source, invertedScrolling);
- QWindowSystemInterfacePrivate::handleWindowSystemEvent(e);
-}
-
-void QWindowSystemInterface::registerTouchDevice(const QTouchDevice *device)
-{
- QTouchDevicePrivate::registerDevice(device);
-}
+ acceptHorz = handleWindowSystemEvent<QWindowSystemInterfacePrivate::WheelEvent>(window,
+ timestamp, QHighDpi::fromNativeLocalPosition(local, window), QHighDpi::fromNativeGlobalPosition(global, window),
+ QPoint(), QPoint(), angleDelta.x(), Qt::Horizontal, mods, phase, source, invertedScrolling, device);
-void QWindowSystemInterface::unregisterTouchDevice(const QTouchDevice *device)
-{
- QTouchDevicePrivate::unregisterDevice(device);
+ return acceptVert || acceptHorz;
}
-bool QWindowSystemInterface::isTouchDeviceRegistered(const QTouchDevice *device)
-{
- return QTouchDevicePrivate::isRegistered(device);
-}
-
-static int g_nextPointId = 1;
-
-// map from device-independent point id (arbitrary) to "Qt point" ids
-QMutex QWindowSystemInterfacePrivate::pointIdMapMutex;
-typedef QMap<quint64, int> PointIdMap;
-Q_GLOBAL_STATIC(PointIdMap, g_pointIdMap)
-
/*!
\internal
- This function maps potentially arbitrary point ids \a pointId in the 32 bit
- value space to start from 1 and increase incrementally for each touch point
- held down. If all touch points are released it will reset the id back to 1
- for the following touch point.
-
- We can then assume that the touch points ids will never become too large,
- and it will then put the device identifier \a deviceId in the upper 8 bits.
- This leaves us with max 255 devices, and 16.7M taps without full release
- before we run out of value space.
+ Register a new input \a device.
+
+ It is expected that every platform plugin will discover available input
+ devices at startup, and whenever a new device is plugged in, if possible.
+ If that's not possible, then it at least must call this function before
+ sending an event whose QInputEvent::source() is this device.
+
+ When a device is unplugged, the platform plugin should destroy the
+ corresponding QInputDevice instance. There is no unregisterInputDevice()
+ function, because it's enough for the destructor to call
+ QInputDevicePrivate::unregisterDevice(); while other parts of Qt can
+ connect to the QObject::destroyed() signal to be notified when a device is
+ unplugged or otherwise destroyed.
*/
-static int acquireCombinedPointId(quint8 deviceId, int pointId)
+void QWindowSystemInterface::registerInputDevice(const QInputDevice *device)
{
- QMutexLocker locker(&QWindowSystemInterfacePrivate::pointIdMapMutex);
-
- quint64 combinedId64 = (quint64(deviceId) << 32) + pointId;
- auto it = g_pointIdMap->constFind(combinedId64);
- int uid;
- if (it == g_pointIdMap->constEnd()) {
- uid = g_nextPointId++;
- g_pointIdMap->insert(combinedId64, uid);
- } else {
- uid = *it;
- }
- return (deviceId << 24) + uid;
+ qCDebug(lcQpaInputDevices) << "register" << device;
+ QInputDevicePrivate::registerDevice(device);
}
-QList<QTouchEvent::TouchPoint>
+/*!
+ \internal
+ Convert a list of \l QWindowSystemInterface::TouchPoint \a points to a list
+ of \e temporary QEventPoint instances, scaled (but not localized)
+ for delivery to the given \a window.
+
+ This is called from QWindowSystemInterface::handleTouchEvent():
+ that is too early to update the QEventPoint instances in QPointingDevice,
+ because we want those to hold "current" state from the applcation's
+ point of view. The QWindowSystemInterfacePrivate::TouchEvent, to which
+ the returned touchpoints will "belong", might go through the queue before
+ being processed; the application doesn't see the equivalent QTouchEvent
+ until later on. Therefore the responsibility to update the QEventPoint
+ instances in QPointingDevice is in QGuiApplication, not here.
+
+ QGuiApplicationPrivate::processMouseEvent() also calls this function
+ when it synthesizes a touch event from a mouse event. But that's outside
+ the normal use case.
+
+ It might be better if we change all the platform plugins to create
+ temporary instances of QEventPoint directly, and remove
+ QWindowSystemInterface::TouchPoint completely. Then we will no longer need
+ this function either. But that's only possible as long as QEventPoint
+ remains a Q_GADGET, not a QObject, so that it continues to be small and
+ suitable for temporary stack allocation. QEventPoint is a little bigger
+ than QWindowSystemInterface::TouchPoint, though.
+*/
+QList<QEventPoint>
QWindowSystemInterfacePrivate::fromNativeTouchPoints(const QList<QWindowSystemInterface::TouchPoint> &points,
- const QWindow *window, quint8 deviceId,
- QEvent::Type *type)
+ const QWindow *window, QEvent::Type *type)
{
- QList<QTouchEvent::TouchPoint> touchPoints;
- Qt::TouchPointStates states;
- QTouchEvent::TouchPoint p;
+ QList<QEventPoint> touchPoints;
+ QEventPoint::States states;
- touchPoints.reserve(points.count());
+ touchPoints.reserve(points.size());
QList<QWindowSystemInterface::TouchPoint>::const_iterator point = points.constBegin();
QList<QWindowSystemInterface::TouchPoint>::const_iterator end = points.constEnd();
while (point != end) {
- p.setId(acquireCombinedPointId(deviceId, point->id));
- if (point->uniqueId >= 0)
- p.setUniqueId(point->uniqueId);
- p.setPressure(point->pressure);
- p.setRotation(point->rotation);
+ QPointF globalPos = QHighDpi::fromNativePixels(point->area.center(), window);
+ QEventPoint p(point->id, point->state, globalPos, globalPos);
states |= point->state;
- p.setState(point->state);
-
- const QPointF screenPos = point->area.center();
- p.setScreenPos(QHighDpi::fromNativePixels(screenPos, window));
- p.setScreenRect(QHighDpi::fromNativePixels(point->area, window));
+ if (point->uniqueId >= 0)
+ QMutableEventPoint::setUniqueId(p, QPointingDeviceUniqueId::fromNumericId(point->uniqueId));
+ QMutableEventPoint::setPressure(p, point->pressure);
+ QMutableEventPoint::setRotation(p, point->rotation);
+ QMutableEventPoint::setEllipseDiameters(p, QHighDpi::fromNativePixels(point->area.size(), window));
+ QMutableEventPoint::setVelocity(p, QHighDpi::fromNativePixels(point->velocity, window));
- // The local pos and rect are not set, they will be calculated
+ // The local pos is not set: it will be calculated
// when the event gets processed by QGuiApplication.
- p.setNormalizedPos(QHighDpi::fromNativePixels(point->normalPosition, window));
- p.setVelocity(QHighDpi::fromNativePixels(point->velocity, window));
- p.setFlags(point->flags);
- p.setRawScreenPositions(QHighDpi::fromNativePixels(point->rawPositions, window));
-
touchPoints.append(p);
++point;
}
@@ -695,99 +638,66 @@ QList<QTouchEvent::TouchPoint>
// Determine the event type based on the combined point states.
if (type) {
*type = QEvent::TouchUpdate;
- if (states == Qt::TouchPointPressed)
+ if (states == QEventPoint::State::Pressed)
*type = QEvent::TouchBegin;
- else if (states == Qt::TouchPointReleased)
+ else if (states == QEventPoint::State::Released)
*type = QEvent::TouchEnd;
}
- if (states == Qt::TouchPointReleased) {
- QMutexLocker locker(&QWindowSystemInterfacePrivate::pointIdMapMutex);
-
- // All points on deviceId have been released.
- // Remove all points associated with that device from g_pointIdMap.
- // (On other devices, some touchpoints might still be pressed.
- // But this function is only called with points from one device at a time.)
- for (auto it = g_pointIdMap->begin(); it != g_pointIdMap->end();) {
- if (it.key() >> 32 == quint64(deviceId))
- it = g_pointIdMap->erase(it);
- else
- ++it;
- }
- if (g_pointIdMap->isEmpty())
- g_nextPointId = 1;
- }
-
return touchPoints;
}
-void QWindowSystemInterfacePrivate::clearPointIdMap()
-{
- QMutexLocker locker(&QWindowSystemInterfacePrivate::pointIdMapMutex);
- g_pointIdMap->clear();
- g_nextPointId = 1;
-}
-
-QList<QWindowSystemInterface::TouchPoint>
- QWindowSystemInterfacePrivate::toNativeTouchPoints(const QList<QTouchEvent::TouchPoint>& pointList,
- const QWindow *window)
+QWindowSystemInterface::TouchPoint
+QWindowSystemInterfacePrivate::toNativeTouchPoint(const QEventPoint &pt, const QWindow *window)
{
- QList<QWindowSystemInterface::TouchPoint> newList;
- newList.reserve(pointList.size());
- for (const QTouchEvent::TouchPoint &pt : pointList) {
- QWindowSystemInterface::TouchPoint p;
- p.id = pt.id();
- p.flags = pt.flags();
- p.normalPosition = QHighDpi::toNativeLocalPosition(pt.normalizedPos(), window);
- p.area = QHighDpi::toNativePixels(pt.screenRect(), window);
- p.pressure = pt.pressure();
- p.state = pt.state();
- p.velocity = QHighDpi::toNativePixels(pt.velocity(), window);
- p.rawPositions = QHighDpi::toNativePixels(pt.rawScreenPositions(), window);
- newList.append(p);
- }
- return newList;
+ QWindowSystemInterface::TouchPoint p;
+ p.id = pt.id();
+ QRectF area(QPointF(), pt.ellipseDiameters());
+ area.moveCenter(pt.globalPosition());
+ // TODO store ellipseDiameters in QWindowSystemInterface::TouchPoint or just use QEventPoint
+ p.area = QHighDpi::toNativePixels(area, window);
+ p.pressure = pt.pressure();
+ p.state = pt.state();
+ p.velocity = QHighDpi::toNativePixels(pt.velocity(), window);
+ return p;
}
-QT_DEFINE_QPA_EVENT_HANDLER(void, handleTouchEvent, QWindow *window, QTouchDevice *device,
+QT_DEFINE_QPA_EVENT_HANDLER(bool, handleTouchEvent, QWindow *window, const QPointingDevice *device,
const QList<TouchPoint> &points, Qt::KeyboardModifiers mods)
{
unsigned long time = QWindowSystemInterfacePrivate::eventTime.elapsed();
- handleTouchEvent<Delivery>(window, time, device, points, mods);
+ return handleTouchEvent<Delivery>(window, time, device, points, mods);
}
-QT_DEFINE_QPA_EVENT_HANDLER(void, handleTouchEvent, QWindow *window, ulong timestamp, QTouchDevice *device,
+QT_DEFINE_QPA_EVENT_HANDLER(bool, handleTouchEvent, QWindow *window, ulong timestamp, const QPointingDevice *device,
const QList<TouchPoint> &points, Qt::KeyboardModifiers mods)
{
if (!points.size()) // Touch events must have at least one point
- return;
+ return false;
- if (!QTouchDevicePrivate::isRegistered(device)) // Disallow passing bogus, non-registered devices.
- return;
+ if (!QPointingDevicePrivate::isRegistered(device)) // Disallow passing bogus, non-registered devices.
+ return false;
QEvent::Type type;
- QList<QTouchEvent::TouchPoint> touchPoints =
- QWindowSystemInterfacePrivate::fromNativeTouchPoints(points, window, QTouchDevicePrivate::get(device)->id, &type);
+ QList<QEventPoint> touchPoints =
+ QWindowSystemInterfacePrivate::fromNativeTouchPoints(points, window, &type);
- QWindowSystemInterfacePrivate::TouchEvent *e =
- new QWindowSystemInterfacePrivate::TouchEvent(window, timestamp, type, device, touchPoints, mods);
- QWindowSystemInterfacePrivate::handleWindowSystemEvent<Delivery>(e);
+ return handleWindowSystemEvent<QWindowSystemInterfacePrivate::TouchEvent, Delivery>(window,
+ timestamp, type, device, touchPoints, mods);
}
-QT_DEFINE_QPA_EVENT_HANDLER(void, handleTouchCancelEvent, QWindow *window, QTouchDevice *device,
+QT_DEFINE_QPA_EVENT_HANDLER(bool, handleTouchCancelEvent, QWindow *window, const QPointingDevice *device,
Qt::KeyboardModifiers mods)
{
unsigned long time = QWindowSystemInterfacePrivate::eventTime.elapsed();
- handleTouchCancelEvent<Delivery>(window, time, device, mods);
+ return handleTouchCancelEvent<Delivery>(window, time, device, mods);
}
-QT_DEFINE_QPA_EVENT_HANDLER(void, handleTouchCancelEvent, QWindow *window, ulong timestamp, QTouchDevice *device,
+QT_DEFINE_QPA_EVENT_HANDLER(bool, handleTouchCancelEvent, QWindow *window, ulong timestamp, const QPointingDevice *device,
Qt::KeyboardModifiers mods)
{
- QWindowSystemInterfacePrivate::TouchEvent *e =
- new QWindowSystemInterfacePrivate::TouchEvent(window, timestamp, QEvent::TouchCancel, device,
- QList<QTouchEvent::TouchPoint>(), mods);
- QWindowSystemInterfacePrivate::handleWindowSystemEvent<Delivery>(e);
+ return handleWindowSystemEvent<QWindowSystemInterfacePrivate::TouchEvent, Delivery>(window,
+ timestamp, QEvent::TouchCancel, device, QList<QEventPoint>(), mods);
}
/*!
@@ -801,9 +711,9 @@ QT_DEFINE_QPA_EVENT_HANDLER(void, handleTouchCancelEvent, QWindow *window, ulong
The screen should be deleted by calling QWindowSystemInterface::handleScreenRemoved().
*/
-void QWindowSystemInterface::handleScreenAdded(QPlatformScreen *ps, bool isPrimary)
+void QWindowSystemInterface::handleScreenAdded(QPlatformScreen *platformScreen, bool isPrimary)
{
- QScreen *screen = new QScreen(ps);
+ QScreen *screen = new QScreen(platformScreen);
if (isPrimary)
QGuiApplicationPrivate::screen_list.prepend(screen);
@@ -811,6 +721,8 @@ void QWindowSystemInterface::handleScreenAdded(QPlatformScreen *ps, bool isPrima
QGuiApplicationPrivate::screen_list.append(screen);
QGuiApplicationPrivate::resetCachedDevicePixelRatio();
+ QHighDpiScaling::updateHighDpiScaling();
+ screen->d_func()->updateGeometry();
emit qGuiApp->screenAdded(screen);
@@ -828,9 +740,45 @@ void QWindowSystemInterface::handleScreenAdded(QPlatformScreen *ps, bool isPrima
*/
void QWindowSystemInterface::handleScreenRemoved(QPlatformScreen *platformScreen)
{
- // Important to keep this order since the QSceen doesn't own the platform screen.
- // The QScreen destructor will take care changing the primary screen, so no need here.
- delete platformScreen->screen();
+ QScreen *screen = platformScreen->screen();
+
+ // Remove screen
+ const bool wasPrimary = QGuiApplication::primaryScreen() == screen;
+ QGuiApplicationPrivate::screen_list.removeOne(screen);
+ QGuiApplicationPrivate::resetCachedDevicePixelRatio();
+
+ if (qGuiApp) {
+ QScreen *newPrimaryScreen = QGuiApplication::primaryScreen();
+ if (wasPrimary && newPrimaryScreen)
+ emit qGuiApp->primaryScreenChanged(newPrimaryScreen);
+
+ // Allow clients to manage windows that are affected by the screen going
+ // away, before we fall back to moving them to the primary screen.
+ emit qApp->screenRemoved(screen);
+
+ if (!QGuiApplication::closingDown()) {
+ bool movingFromVirtualSibling = newPrimaryScreen
+ && newPrimaryScreen->handle()->virtualSiblings().contains(platformScreen);
+
+ // Move any leftover windows to the primary screen
+ const auto allWindows = QGuiApplication::allWindows();
+ for (QWindow *window : allWindows) {
+ if (!window->isTopLevel() || window->screen() != screen)
+ continue;
+
+ const bool wasVisible = window->isVisible();
+ window->setScreen(newPrimaryScreen);
+
+ // Re-show window if moved from a virtual sibling screen. Otherwise
+ // leave it up to the application developer to show the window.
+ if (movingFromVirtualSibling)
+ window->setVisible(wasVisible);
+ }
+ }
+ }
+
+ // Important to keep this order since the QSceen doesn't own the platform screen
+ delete screen;
delete platformScreen;
}
@@ -843,7 +791,7 @@ void QWindowSystemInterface::handleScreenRemoved(QPlatformScreen *platformScreen
void QWindowSystemInterface::handlePrimaryScreenChanged(QPlatformScreen *newPrimary)
{
QScreen *newPrimaryScreen = newPrimary->screen();
- int indexOfScreen = QGuiApplicationPrivate::screen_list.indexOf(newPrimaryScreen);
+ qsizetype indexOfScreen = QGuiApplicationPrivate::screen_list.indexOf(newPrimaryScreen);
Q_ASSERT(indexOfScreen >= 0);
if (indexOfScreen == 0)
return;
@@ -854,56 +802,39 @@ void QWindowSystemInterface::handlePrimaryScreenChanged(QPlatformScreen *newPrim
void QWindowSystemInterface::handleScreenOrientationChange(QScreen *screen, Qt::ScreenOrientation orientation)
{
- QWindowSystemInterfacePrivate::ScreenOrientationEvent *e =
- new QWindowSystemInterfacePrivate::ScreenOrientationEvent(screen, orientation);
- QWindowSystemInterfacePrivate::handleWindowSystemEvent(e);
+ handleWindowSystemEvent<QWindowSystemInterfacePrivate::ScreenOrientationEvent>(screen, orientation);
}
void QWindowSystemInterface::handleScreenGeometryChange(QScreen *screen, const QRect &geometry, const QRect &availableGeometry)
{
- QWindowSystemInterfacePrivate::ScreenGeometryEvent *e =
- new QWindowSystemInterfacePrivate::ScreenGeometryEvent(screen, QHighDpi::fromNativeScreenGeometry(geometry, screen), QHighDpi::fromNative(availableGeometry, screen, geometry.topLeft()));
- QWindowSystemInterfacePrivate::handleWindowSystemEvent(e);
+ handleWindowSystemEvent<QWindowSystemInterfacePrivate::ScreenGeometryEvent>(screen,
+ QHighDpi::fromNativeScreenGeometry(geometry, screen), QHighDpi::fromNative(availableGeometry,
+ screen, geometry.topLeft()));
}
void QWindowSystemInterface::handleScreenLogicalDotsPerInchChange(QScreen *screen, qreal dpiX, qreal dpiY)
{
+ // Keep QHighDpiScaling::m_active in sync with platform screen state, in
+ // order to make scaling calls made during DPI change use the new state.
+ // FIXME: Remove when QHighDpiScaling::m_active has been removed.
+ QHighDpiScaling::updateHighDpiScaling();
+
const QDpi effectiveDpi = QPlatformScreen::overrideDpi(QDpi{dpiX, dpiY});
- auto e = new QWindowSystemInterfacePrivate::ScreenLogicalDotsPerInchEvent(screen, effectiveDpi.first, effectiveDpi.second);
- QWindowSystemInterfacePrivate::handleWindowSystemEvent(e);
+ handleWindowSystemEvent<QWindowSystemInterfacePrivate::ScreenLogicalDotsPerInchEvent>(screen,
+ effectiveDpi.first, effectiveDpi.second);
}
void QWindowSystemInterface::handleScreenRefreshRateChange(QScreen *screen, qreal newRefreshRate)
{
- QWindowSystemInterfacePrivate::ScreenRefreshRateEvent *e =
- new QWindowSystemInterfacePrivate::ScreenRefreshRateEvent(screen, newRefreshRate);
- QWindowSystemInterfacePrivate::handleWindowSystemEvent(e);
+ handleWindowSystemEvent<QWindowSystemInterfacePrivate::ScreenRefreshRateEvent>(screen, newRefreshRate);
}
-void QWindowSystemInterface::handleThemeChange(QWindow *window)
+QT_DEFINE_QPA_EVENT_HANDLER(void, handleThemeChange, QWindow *window)
{
- QWindowSystemInterfacePrivate::ThemeChangeEvent *e = new QWindowSystemInterfacePrivate::ThemeChangeEvent(window);
- QWindowSystemInterfacePrivate::handleWindowSystemEvent(e);
+ handleWindowSystemEvent<QWindowSystemInterfacePrivate::ThemeChangeEvent, Delivery>(window);
}
#if QT_CONFIG(draganddrop)
-#if QT_DEPRECATED_SINCE(5, 11)
-QPlatformDragQtResponse QWindowSystemInterface::handleDrag(QWindow *window, const QMimeData *dropData,
- const QPoint &p, Qt::DropActions supportedActions)
-{
- return QGuiApplicationPrivate::processDrag(window, dropData, p, supportedActions,
- QGuiApplication::mouseButtons(),
- QGuiApplication::keyboardModifiers());
-}
-
-QPlatformDropQtResponse QWindowSystemInterface::handleDrop(QWindow *window, const QMimeData *dropData,
- const QPoint &p, Qt::DropActions supportedActions)
-{
- return QGuiApplicationPrivate::processDrop(window, dropData, p, supportedActions,
- QGuiApplication::mouseButtons(),
- QGuiApplication::keyboardModifiers());
-}
-#endif // QT_DEPRECATED_SINCE(5, 11)
/*!
Drag and drop events are sent immediately.
@@ -935,11 +866,7 @@ QPlatformDropQtResponse QWindowSystemInterface::handleDrop(QWindow *window, cons
\note This function can only be called from the GUI thread.
*/
-#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
bool QWindowSystemInterface::handleNativeEvent(QWindow *window, const QByteArray &eventType, void *message, qintptr *result)
-#else
-bool QWindowSystemInterface::handleNativeEvent(QWindow *window, const QByteArray &eventType, void *message, long *result)
-#endif
{
return QGuiApplicationPrivate::processNativeEvent(window, eventType, message, result);
}
@@ -961,110 +888,143 @@ void QWindowSystemInterfacePrivate::TabletEvent::setPlatformSynthesizesMouse(boo
platformSynthesizesMouse = v;
}
-void QWindowSystemInterface::handleTabletEvent(QWindow *window, ulong timestamp, const QPointF &local, const QPointF &global,
+bool QWindowSystemInterface::handleTabletEvent(QWindow *window, ulong timestamp, const QPointingDevice *device,
+ const QPointF &local, const QPointF &global,
+ Qt::MouseButtons buttons, qreal pressure, int xTilt, int yTilt,
+ qreal tangentialPressure, qreal rotation, int z,
+ Qt::KeyboardModifiers modifiers)
+{
+ return handleWindowSystemEvent<QWindowSystemInterfacePrivate::TabletEvent>(window,
+ timestamp,
+ QHighDpi::fromNativeLocalPosition(local, window),
+ QHighDpi::fromNativeGlobalPosition(global, window),
+ device, buttons, pressure,
+ xTilt, yTilt, tangentialPressure, rotation, z, modifiers);
+}
+
+bool QWindowSystemInterface::handleTabletEvent(QWindow *window, const QPointingDevice *device,
+ const QPointF &local, const QPointF &global,
+ Qt::MouseButtons buttons, qreal pressure, int xTilt, int yTilt,
+ qreal tangentialPressure, qreal rotation, int z,
+ Qt::KeyboardModifiers modifiers)
+{
+ const ulong time = QWindowSystemInterfacePrivate::eventTime.elapsed();
+ return handleTabletEvent(window, time, device, local, global,
+ buttons, pressure, xTilt, yTilt, tangentialPressure,
+ rotation, z, modifiers);
+}
+
+bool QWindowSystemInterface::handleTabletEvent(QWindow *window, ulong timestamp, const QPointF &local, const QPointF &global,
int device, int pointerType, Qt::MouseButtons buttons, qreal pressure, int xTilt, int yTilt,
qreal tangentialPressure, qreal rotation, int z, qint64 uid,
Qt::KeyboardModifiers modifiers)
{
- QWindowSystemInterfacePrivate::TabletEvent *e =
- new QWindowSystemInterfacePrivate::TabletEvent(window, timestamp,
- QHighDpi::fromNativeLocalPosition(local, window),
- QHighDpi::fromNativePixels(global, window),
- device, pointerType, buttons, pressure,
- xTilt, yTilt, tangentialPressure, rotation, z, uid, modifiers);
- QWindowSystemInterfacePrivate::handleWindowSystemEvent(e);
+ const QPointingDevice *dev = QPointingDevicePrivate::tabletDevice(QInputDevice::DeviceType(device),QPointingDevice::PointerType(pointerType),
+ QPointingDeviceUniqueId::fromNumericId(uid));
+ return handleTabletEvent(window, timestamp, dev, local, global, buttons, pressure,
+ xTilt, yTilt, tangentialPressure, rotation, z, modifiers);
}
-void QWindowSystemInterface::handleTabletEvent(QWindow *window, const QPointF &local, const QPointF &global,
+bool QWindowSystemInterface::handleTabletEvent(QWindow *window, const QPointF &local, const QPointF &global,
int device, int pointerType, Qt::MouseButtons buttons, qreal pressure, int xTilt, int yTilt,
qreal tangentialPressure, qreal rotation, int z, qint64 uid,
Qt::KeyboardModifiers modifiers)
{
ulong time = QWindowSystemInterfacePrivate::eventTime.elapsed();
- handleTabletEvent(window, time, local, global, device, pointerType, buttons, pressure,
+ return handleTabletEvent(window, time, local, global, device, pointerType, buttons, pressure,
xTilt, yTilt, tangentialPressure, rotation, z, uid, modifiers);
}
-#if QT_DEPRECATED_SINCE(5, 10)
-void QWindowSystemInterface::handleTabletEvent(QWindow *window, ulong timestamp, bool down, const QPointF &local, const QPointF &global,
- int device, int pointerType, qreal pressure, int xTilt, int yTilt,
- qreal tangentialPressure, qreal rotation, int z, qint64 uid,
- Qt::KeyboardModifiers modifiers)
+bool QWindowSystemInterface::handleTabletEnterLeaveProximityEvent(QWindow *window, ulong timestamp, const QPointingDevice *device,
+ bool inProximity, const QPointF &local, const QPointF &global,
+ Qt::MouseButtons buttons, int xTilt, int yTilt,
+ qreal tangentialPressure, qreal rotation, int z,
+ Qt::KeyboardModifiers modifiers)
{
- handleTabletEvent(window, timestamp, local, global, device, pointerType, (down ? Qt::LeftButton : Qt::NoButton), pressure,
- xTilt, yTilt, tangentialPressure, rotation, z, uid, modifiers);
+ Q_UNUSED(window);
+ Q_UNUSED(local);
+ Q_UNUSED(global);
+ Q_UNUSED(buttons);
+ Q_UNUSED(xTilt);
+ Q_UNUSED(yTilt);
+ Q_UNUSED(tangentialPressure);
+ Q_UNUSED(rotation);
+ Q_UNUSED(z);
+ Q_UNUSED(modifiers);
+ return inProximity
+ ? handleWindowSystemEvent<QWindowSystemInterfacePrivate::TabletEnterProximityEvent>(timestamp, device)
+ : handleWindowSystemEvent<QWindowSystemInterfacePrivate::TabletLeaveProximityEvent>(timestamp, device);
}
-void QWindowSystemInterface::handleTabletEvent(QWindow *window, bool down, const QPointF &local, const QPointF &global,
- int device, int pointerType, qreal pressure, int xTilt, int yTilt,
- qreal tangentialPressure, qreal rotation, int z, qint64 uid,
- Qt::KeyboardModifiers modifiers)
+bool QWindowSystemInterface::handleTabletEnterLeaveProximityEvent(QWindow *window, const QPointingDevice *device,
+ bool inProximity, const QPointF &local, const QPointF &global,
+ Qt::MouseButtons buttons, int xTilt, int yTilt,
+ qreal tangentialPressure, qreal rotation, int z,
+ Qt::KeyboardModifiers modifiers)
{
- handleTabletEvent(window, local, global, device, pointerType, (down ? Qt::LeftButton : Qt::NoButton), pressure,
- xTilt, yTilt, tangentialPressure, rotation, z, uid, modifiers);
+ const ulong time = QWindowSystemInterfacePrivate::eventTime.elapsed();
+ return handleTabletEnterLeaveProximityEvent(window, time, device, inProximity,
+ local, global, buttons, xTilt, yTilt,
+ tangentialPressure, rotation, z, modifiers);
}
-#endif // QT_DEPRECATED_SINCE(5, 10)
-void QWindowSystemInterface::handleTabletEnterProximityEvent(ulong timestamp, int device, int pointerType, qint64 uid)
+
+bool QWindowSystemInterface::handleTabletEnterProximityEvent(ulong timestamp, int deviceType, int pointerType, qint64 uid)
{
- QWindowSystemInterfacePrivate::TabletEnterProximityEvent *e =
- new QWindowSystemInterfacePrivate::TabletEnterProximityEvent(timestamp, device, pointerType, uid);
- QWindowSystemInterfacePrivate::handleWindowSystemEvent(e);
+ const QPointingDevice *device = QPointingDevicePrivate::tabletDevice(QInputDevice::DeviceType(deviceType),
+ QPointingDevice::PointerType(pointerType),
+ QPointingDeviceUniqueId::fromNumericId(uid));
+ return handleWindowSystemEvent<QWindowSystemInterfacePrivate::TabletEnterProximityEvent>(timestamp, device);
}
-void QWindowSystemInterface::handleTabletEnterProximityEvent(int device, int pointerType, qint64 uid)
+void QWindowSystemInterface::handleTabletEnterProximityEvent(int deviceType, int pointerType, qint64 uid)
{
ulong time = QWindowSystemInterfacePrivate::eventTime.elapsed();
- handleTabletEnterProximityEvent(time, device, pointerType, uid);
+ handleTabletEnterProximityEvent(time, deviceType, pointerType, uid);
}
-void QWindowSystemInterface::handleTabletLeaveProximityEvent(ulong timestamp, int device, int pointerType, qint64 uid)
+bool QWindowSystemInterface::handleTabletLeaveProximityEvent(ulong timestamp, int deviceType, int pointerType, qint64 uid)
{
- QWindowSystemInterfacePrivate::TabletLeaveProximityEvent *e =
- new QWindowSystemInterfacePrivate::TabletLeaveProximityEvent(timestamp, device, pointerType, uid);
- QWindowSystemInterfacePrivate::handleWindowSystemEvent(e);
+ const QPointingDevice *device = QPointingDevicePrivate::tabletDevice(QInputDevice::DeviceType(deviceType),
+ QPointingDevice::PointerType(pointerType),
+ QPointingDeviceUniqueId::fromNumericId(uid));
+ return handleWindowSystemEvent<QWindowSystemInterfacePrivate::TabletLeaveProximityEvent>(timestamp, device);
}
-void QWindowSystemInterface::handleTabletLeaveProximityEvent(int device, int pointerType, qint64 uid)
+void QWindowSystemInterface::handleTabletLeaveProximityEvent(int deviceType, int pointerType, qint64 uid)
{
ulong time = QWindowSystemInterfacePrivate::eventTime.elapsed();
- handleTabletLeaveProximityEvent(time, device, pointerType, uid);
+ handleTabletLeaveProximityEvent(time, deviceType, pointerType, uid);
}
#ifndef QT_NO_GESTURES
-void QWindowSystemInterface::handleGestureEvent(QWindow *window, QTouchDevice *device, ulong timestamp, Qt::NativeGestureType type,
- QPointF &local, QPointF &global)
+bool QWindowSystemInterface::handleGestureEvent(QWindow *window, ulong timestamp, const QPointingDevice *device,
+ Qt::NativeGestureType type, const QPointF &local, const QPointF &global, int fingerCount)
{
- QWindowSystemInterfacePrivate::GestureEvent *e =
- new QWindowSystemInterfacePrivate::GestureEvent(window, timestamp, type, device, local, global);
- QWindowSystemInterfacePrivate::handleWindowSystemEvent(e);
+ return handleGestureEventWithValueAndDelta(window, timestamp, device, type, {}, {}, local, global, fingerCount);
}
-void QWindowSystemInterface::handleGestureEventWithRealValue(QWindow *window, QTouchDevice *device, ulong timestamp, Qt::NativeGestureType type,
- qreal value, QPointF &local, QPointF &global)
+bool QWindowSystemInterface::handleGestureEventWithRealValue(QWindow *window, ulong timestamp, const QPointingDevice *device,
+ Qt::NativeGestureType type, qreal value, const QPointF &local, const QPointF &global, int fingerCount)
{
- QWindowSystemInterfacePrivate::GestureEvent *e =
- new QWindowSystemInterfacePrivate::GestureEvent(window, timestamp, type, device, local, global);
- e->realValue = value;
- QWindowSystemInterfacePrivate::handleWindowSystemEvent(e);
+ return handleGestureEventWithValueAndDelta(window, timestamp, device, type, value, {}, local, global, fingerCount);
}
-void QWindowSystemInterface::handleGestureEventWithSequenceIdAndValue(QWindow *window, QTouchDevice *device, ulong timestamp, Qt::NativeGestureType type,
- ulong sequenceId, quint64 value, QPointF &local, QPointF &global)
+bool QWindowSystemInterface::handleGestureEventWithValueAndDelta(QWindow *window, ulong timestamp, const QPointingDevice *device,
+ Qt::NativeGestureType type, qreal value, const QPointF &delta,
+ const QPointF &local, const QPointF &global, int fingerCount)
{
- QWindowSystemInterfacePrivate::GestureEvent *e =
- new QWindowSystemInterfacePrivate::GestureEvent(window, timestamp, type, device, local, global);
- e->sequenceId = sequenceId;
- e->intValue = value;
- QWindowSystemInterfacePrivate::handleWindowSystemEvent(e);
+ auto localPos = QHighDpi::fromNativeLocalPosition(local, window);
+ auto globalPos = QHighDpi::fromNativeGlobalPosition(global, window);
+
+ return handleWindowSystemEvent<QWindowSystemInterfacePrivate::GestureEvent>(window,
+ timestamp, type, device, fingerCount, localPos, globalPos, value, delta);
}
#endif // QT_NO_GESTURES
void QWindowSystemInterface::handlePlatformPanelEvent(QWindow *w)
{
- QWindowSystemInterfacePrivate::PlatformPanelEvent *e =
- new QWindowSystemInterfacePrivate::PlatformPanelEvent(w);
- QWindowSystemInterfacePrivate::handleWindowSystemEvent(e);
+ handleWindowSystemEvent<QWindowSystemInterfacePrivate::PlatformPanelEvent>(w);
}
#ifndef QT_NO_CONTEXTMENU
@@ -1072,19 +1032,16 @@ void QWindowSystemInterface::handleContextMenuEvent(QWindow *window, bool mouseT
const QPoint &pos, const QPoint &globalPos,
Qt::KeyboardModifiers modifiers)
{
- QWindowSystemInterfacePrivate::ContextMenuEvent *e =
- new QWindowSystemInterfacePrivate::ContextMenuEvent(window, mouseTriggered, pos,
- globalPos, modifiers);
- QWindowSystemInterfacePrivate::handleWindowSystemEvent(e);
+ handleWindowSystemEvent<QWindowSystemInterfacePrivate::ContextMenuEvent>(window,
+ mouseTriggered, pos, globalPos, modifiers);
}
#endif
#if QT_CONFIG(whatsthis)
void QWindowSystemInterface::handleEnterWhatsThisEvent()
{
- QWindowSystemInterfacePrivate::WindowSystemEvent *e =
- new QWindowSystemInterfacePrivate::WindowSystemEvent(QWindowSystemInterfacePrivate::EnterWhatsThisMode);
- QWindowSystemInterfacePrivate::handleWindowSystemEvent(e);
+ handleWindowSystemEvent<QWindowSystemInterfacePrivate::WindowSystemEvent>(
+ QWindowSystemInterfacePrivate::EnterWhatsThisMode);
}
#endif
@@ -1106,7 +1063,7 @@ Q_GUI_EXPORT QDebug operator<<(QDebug dbg, const QWindowSystemInterface::TouchPo
*/
bool QWindowSystemInterface::flushWindowSystemEvents(QEventLoop::ProcessEventsFlags flags)
{
- const int count = QWindowSystemInterfacePrivate::windowSystemEventQueue.count();
+ const qsizetype count = QWindowSystemInterfacePrivate::windowSystemEventQueue.count();
if (!count)
return false;
if (!QGuiApplication::instance()) {
@@ -1120,8 +1077,7 @@ bool QWindowSystemInterface::flushWindowSystemEvents(QEventLoop::ProcessEventsFl
// Post a FlushEvents event which will trigger a call back to
// deferredFlushWindowSystemEvents from the Gui thread.
QMutexLocker locker(&QWindowSystemInterfacePrivate::flushEventMutex);
- QWindowSystemInterfacePrivate::FlushEventsEvent *e = new QWindowSystemInterfacePrivate::FlushEventsEvent(flags);
- QWindowSystemInterfacePrivate::handleWindowSystemEvent<AsynchronousDelivery>(e);
+ handleWindowSystemEvent<QWindowSystemInterfacePrivate::FlushEventsEvent, AsynchronousDelivery>(flags);
QWindowSystemInterfacePrivate::eventsFlushed.wait(&QWindowSystemInterfacePrivate::flushEventMutex);
} else {
sendWindowSystemEvents(flags);
@@ -1143,15 +1099,10 @@ bool QWindowSystemInterface::sendWindowSystemEvents(QEventLoop::ProcessEventsFla
int nevents = 0;
while (QWindowSystemInterfacePrivate::windowSystemEventsQueued()) {
- QWindowSystemInterfacePrivate::WindowSystemEvent *event = nullptr;
-
- if (QWindowSystemInterfacePrivate::platformFiltersEvents) {
- event = QWindowSystemInterfacePrivate::getWindowSystemEvent();
- } else {
- event = flags & QEventLoop::ExcludeUserInputEvents ?
+ QWindowSystemInterfacePrivate::WindowSystemEvent *event =
+ flags & QEventLoop::ExcludeUserInputEvents ?
QWindowSystemInterfacePrivate::getNonUserInputWindowSystemEvent() :
QWindowSystemInterfacePrivate::getWindowSystemEvent();
- }
if (!event)
break;
@@ -1190,21 +1141,6 @@ bool QWindowSystemInterface::nonUserInputEventsQueued()
return QWindowSystemInterfacePrivate::nonUserInputEventsQueued();
}
-/*!
- Platforms that implement UserInputEvent filtering at native event level must
- set this property to \c true. The default is \c false, which means that event
- filtering logic is handled by QWindowSystemInterface. Doing the filtering in
- platform plugins is necessary when supporting AbstractEventDispatcher::filterNativeEvent(),
- which should respect flags that were passed to event dispatcher's processEvents()
- call.
-
- \since 5.12
-*/
-void QWindowSystemInterface::setPlatformFiltersEvents(bool enable)
-{
- QWindowSystemInterfacePrivate::platformFiltersEvents = enable;
-}
-
// --------------------- QtTestLib support ---------------------
// The following functions are used by testlib, and need to be synchronous to avoid
@@ -1216,30 +1152,24 @@ Q_GUI_EXPORT void qt_handleMouseEvent(QWindow *window, const QPointF &local, con
Qt::MouseButtons state, Qt::MouseButton button,
QEvent::Type type, Qt::KeyboardModifiers mods, int timestamp)
{
- const qreal factor = QHighDpiScaling::factor(window);
- QWindowSystemInterface::handleMouseEvent<QWindowSystemInterface::SynchronousDelivery>(window,
- timestamp, local * factor, global * factor, state, button, type, mods);
-}
-
-// Wrapper for compatibility with Qt < 5.11
-// ### Qt6: Remove
-Q_GUI_EXPORT void qt_handleMouseEvent(QWindow *window, const QPointF &local, const QPointF &global,
- Qt::MouseButtons b, Qt::KeyboardModifiers mods, int timestamp)
-{
- const qreal factor = QHighDpiScaling::factor(window);
+ QPointF nativeLocal = QHighDpi::toNativeLocalPosition(local, window);
+ QPointF nativeGlobal = QHighDpi::toNativeGlobalPosition(global, window);
QWindowSystemInterface::handleMouseEvent<QWindowSystemInterface::SynchronousDelivery>(window,
- timestamp, local * factor, global * factor, b, Qt::NoButton, QEvent::None, mods);
-}
-
-// Wrapper for compatibility with Qt < 5.6
-// ### Qt6: Remove
-Q_GUI_EXPORT void qt_handleMouseEvent(QWindow *w, const QPointF &local, const QPointF &global, Qt::MouseButtons b, Qt::KeyboardModifiers mods = Qt::NoModifier)
-{
- qt_handleMouseEvent(w, local, global, b, mods, QWindowSystemInterfacePrivate::eventTime.elapsed());
+ timestamp, nativeLocal, nativeGlobal, state, button, type, mods);
}
+/*
+ Used by QTest::simulateEvent() to synthesize key events during testing
+*/
Q_GUI_EXPORT void qt_handleKeyEvent(QWindow *window, QEvent::Type t, int k, Qt::KeyboardModifiers mods, const QString & text = QString(), bool autorep = false, ushort count = 1)
{
+#if defined(Q_OS_MACOS)
+ // FIXME: Move into QTest::simulateEvent() and align with QGuiApplicationPrivate::processKeyEvent()
+ auto timestamp = QWindowSystemInterfacePrivate::eventTime.elapsed();
+ if (t == QEvent::KeyPress && QWindowSystemInterface::handleShortcutEvent(window, timestamp, k, mods, 0, 0, 0, text, autorep, count))
+ return;
+#endif
+
QWindowSystemInterface::handleKeyEvent<QWindowSystemInterface::SynchronousDelivery>(window, t, k, mods, text, autorep, count);
}
@@ -1269,35 +1199,51 @@ Q_GUI_EXPORT bool qt_sendShortcutOverrideEvent(QObject *o, ulong timestamp, int
// Then as QShortcutEvent
return shortcutMap.tryShortcut(&qevent);
#else
- Q_UNUSED(o)
- Q_UNUSED(timestamp)
- Q_UNUSED(k)
- Q_UNUSED(mods)
- Q_UNUSED(text)
- Q_UNUSED(autorep)
- Q_UNUSED(count)
+ Q_UNUSED(o);
+ Q_UNUSED(timestamp);
+ Q_UNUSED(k);
+ Q_UNUSED(mods);
+ Q_UNUSED(text);
+ Q_UNUSED(autorep);
+ Q_UNUSED(count);
return false;
#endif
}
+Q_GUI_EXPORT void qt_handleWheelEvent(QWindow *window, const QPointF &local, const QPointF &global,
+ QPoint pixelDelta, QPoint angleDelta, Qt::KeyboardModifiers mods,
+ Qt::ScrollPhase phase)
+{
+ QWindowSystemInterface::handleWheelEvent(window, local, global, pixelDelta, angleDelta, mods, phase);
+}
+
namespace QTest
{
- Q_GUI_EXPORT QTouchDevice * createTouchDevice(QTouchDevice::DeviceType devType = QTouchDevice::TouchScreen)
+ Q_GUI_EXPORT QPointingDevice * createTouchDevice(QInputDevice::DeviceType devType,
+ QInputDevice::Capabilities caps)
{
- QTouchDevice *ret = new QTouchDevice();
- ret->setType(devType);
- QWindowSystemInterface::registerTouchDevice(ret);
+ static qint64 nextId = 0x100000000;
+ QPointingDevice *ret = new QPointingDevice("test touch device"_L1, nextId++,
+ devType, QPointingDevice::PointerType::Finger,
+ caps, 8, 0);
+ QWindowSystemInterface::registerInputDevice(ret);
return ret;
}
}
-Q_GUI_EXPORT void qt_handleTouchEvent(QWindow *window, QTouchDevice *device,
- const QList<QTouchEvent::TouchPoint> &points,
- Qt::KeyboardModifiers mods = Qt::NoModifier)
+Q_GUI_EXPORT bool qt_handleTouchEventv2(QWindow *window, const QPointingDevice *device,
+ const QList<QEventPoint> &points,
+ Qt::KeyboardModifiers mods)
{
- QWindowSystemInterface::handleTouchEvent<QWindowSystemInterface::SynchronousDelivery>(window, device,
+ return QWindowSystemInterface::handleTouchEvent<QWindowSystemInterface::SynchronousDelivery>(window, device,
QWindowSystemInterfacePrivate::toNativeTouchPoints(points, window), mods);
}
+Q_GUI_EXPORT void qt_handleTouchEvent(QWindow *window, const QPointingDevice *device,
+ const QList<QEventPoint> &points,
+ Qt::KeyboardModifiers mods)
+{
+ qt_handleTouchEventv2(window, device, points, mods);
+}
QT_END_NAMESPACE
diff --git a/src/gui/kernel/qwindowsysteminterface.h b/src/gui/kernel/qwindowsysteminterface.h
index d5a4ad30d8..4fc61a475d 100644
--- a/src/gui/kernel/qwindowsysteminterface.h
+++ b/src/gui/kernel/qwindowsysteminterface.h
@@ -1,41 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the QtGui module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2020 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#ifndef QWINDOWSYSTEMINTERFACE_H
#define QWINDOWSYSTEMINTERFACE_H
@@ -64,7 +28,7 @@
QT_BEGIN_NAMESPACE
class QMimeData;
-class QTouchDevice;
+class QPointingDevice;
class QPlatformDragQtResponse;
class QPlatformDropQtResponse;
@@ -76,48 +40,30 @@ public:
struct AsynchronousDelivery {};
struct DefaultDelivery {};
-#if QT_DEPRECATED_SINCE(5, 11)
template<typename Delivery = QWindowSystemInterface::DefaultDelivery>
- QT_DEPRECATED static void handleMouseEvent(QWindow *window, const QPointF &local, const QPointF &global, Qt::MouseButtons b,
+ static bool handleMouseEvent(QWindow *window, const QPointF &local, const QPointF &global,
+ Qt::MouseButtons state, Qt::MouseButton button, QEvent::Type type,
Qt::KeyboardModifiers mods = Qt::NoModifier,
Qt::MouseEventSource source = Qt::MouseEventNotSynthesized);
template<typename Delivery = QWindowSystemInterface::DefaultDelivery>
- QT_DEPRECATED static void handleMouseEvent(QWindow *window, ulong timestamp, const QPointF &local, const QPointF &global, Qt::MouseButtons b,
+ static bool handleMouseEvent(QWindow *window, const QPointingDevice *device,
+ const QPointF &local, const QPointF &global,
+ Qt::MouseButtons state, Qt::MouseButton button, QEvent::Type type,
Qt::KeyboardModifiers mods = Qt::NoModifier,
Qt::MouseEventSource source = Qt::MouseEventNotSynthesized);
-
- QT_DEPRECATED static void handleFrameStrutMouseEvent(QWindow *window, const QPointF &local, const QPointF &global, Qt::MouseButtons b,
- Qt::KeyboardModifiers mods = Qt::NoModifier,
- Qt::MouseEventSource source = Qt::MouseEventNotSynthesized);
- QT_DEPRECATED static void handleFrameStrutMouseEvent(QWindow *window, ulong timestamp, const QPointF &local, const QPointF &global, Qt::MouseButtons b,
- Qt::KeyboardModifiers mods = Qt::NoModifier,
- Qt::MouseEventSource source = Qt::MouseEventNotSynthesized);
-#endif
template<typename Delivery = QWindowSystemInterface::DefaultDelivery>
- static void handleMouseEvent(QWindow *window, const QPointF &local, const QPointF &global,
- Qt::MouseButtons state, Qt::MouseButton button, QEvent::Type type,
+ static bool handleMouseEvent(QWindow *window, ulong timestamp, const QPointF &local,
+ const QPointF &global, Qt::MouseButtons state,
+ Qt::MouseButton button, QEvent::Type type,
Qt::KeyboardModifiers mods = Qt::NoModifier,
Qt::MouseEventSource source = Qt::MouseEventNotSynthesized);
template<typename Delivery = QWindowSystemInterface::DefaultDelivery>
- static void handleMouseEvent(QWindow *window, ulong timestamp, const QPointF &local,
- const QPointF &global, Qt::MouseButtons state,
+ static bool handleMouseEvent(QWindow *window, ulong timestamp, const QPointingDevice *device,
+ const QPointF &local, const QPointF &global, Qt::MouseButtons state,
Qt::MouseButton button, QEvent::Type type,
Qt::KeyboardModifiers mods = Qt::NoModifier,
Qt::MouseEventSource source = Qt::MouseEventNotSynthesized);
- static void handleFrameStrutMouseEvent(QWindow *window, const QPointF &local,
- const QPointF &global, Qt::MouseButtons state,
- Qt::MouseButton button, QEvent::Type type,
- Qt::KeyboardModifiers mods = Qt::NoModifier,
- Qt::MouseEventSource source =
- Qt::MouseEventNotSynthesized);
- static void handleFrameStrutMouseEvent(QWindow *window, ulong timestamp, const QPointF &local,
- const QPointF &global, Qt::MouseButtons state,
- Qt::MouseButton button, QEvent::Type type,
- Qt::KeyboardModifiers mods = Qt::NoModifier,
- Qt::MouseEventSource source =
- Qt::MouseEventNotSynthesized);
-
static bool handleShortcutEvent(QWindow *window, ulong timestamp, int k, Qt::KeyboardModifiers mods, quint32 nativeScanCode,
quint32 nativeVirtualKey, quint32 nativeModifiers, const QString & text = QString(), bool autorep = false, ushort count = 1);
@@ -130,31 +76,41 @@ public:
quint32 nativeScanCode, quint32 nativeVirtualKey,
quint32 nativeModifiers,
const QString& text = QString(), bool autorep = false,
- ushort count = 1, bool tryShortcutOverride = true);
+ ushort count = 1);
static bool handleExtendedKeyEvent(QWindow *window, ulong timestamp, QEvent::Type type, int key, Qt::KeyboardModifiers modifiers,
quint32 nativeScanCode, quint32 nativeVirtualKey,
quint32 nativeModifiers,
const QString& text = QString(), bool autorep = false,
- ushort count = 1, bool tryShortcutOverride = true);
- static void handleWheelEvent(QWindow *window, const QPointF &local, const QPointF &global,
+ ushort count = 1);
+ static bool handleExtendedKeyEvent(QWindow *window, ulong timestamp, const QInputDevice *device,
+ QEvent::Type type, int key, Qt::KeyboardModifiers modifiers,
+ quint32 nativeScanCode, quint32 nativeVirtualKey,
+ quint32 nativeModifiers,
+ const QString& text = QString(), bool autorep = false,
+ ushort count = 1);
+ static bool handleWheelEvent(QWindow *window, const QPointF &local, const QPointF &global,
QPoint pixelDelta, QPoint angleDelta,
Qt::KeyboardModifiers mods = Qt::NoModifier,
Qt::ScrollPhase phase = Qt::NoScrollPhase,
Qt::MouseEventSource source = Qt::MouseEventNotSynthesized);
- static void handleWheelEvent(QWindow *window, ulong timestamp, const QPointF &local, const QPointF &global,
+ static bool handleWheelEvent(QWindow *window, ulong timestamp, const QPointF &local, const QPointF &global,
+ QPoint pixelDelta, QPoint angleDelta,
+ Qt::KeyboardModifiers mods = Qt::NoModifier,
+ Qt::ScrollPhase phase = Qt::NoScrollPhase,
+ Qt::MouseEventSource source = Qt::MouseEventNotSynthesized,
+ bool inverted = false);
+ static bool handleWheelEvent(QWindow *window, ulong timestamp, const QPointingDevice *device,
+ const QPointF &local, const QPointF &global,
QPoint pixelDelta, QPoint angleDelta,
Qt::KeyboardModifiers mods = Qt::NoModifier,
Qt::ScrollPhase phase = Qt::NoScrollPhase,
Qt::MouseEventSource source = Qt::MouseEventNotSynthesized,
bool inverted = false);
-#if QT_DEPRECATED_SINCE(5, 10)
- QT_DEPRECATED static void handleWheelEvent(QWindow *window, const QPointF &local, const QPointF &global, int d, Qt::Orientation o, Qt::KeyboardModifiers mods = Qt::NoModifier);
- QT_DEPRECATED static void handleWheelEvent(QWindow *window, ulong timestamp, const QPointF &local, const QPointF &global, int d, Qt::Orientation o, Qt::KeyboardModifiers mods = Qt::NoModifier);
-#endif
-
+ // A very-temporary QPA touchpoint which gets converted to a QEventPoint as early as possible
+ // in QWindowSystemInterfacePrivate::fromNativeTouchPoints()
struct TouchPoint {
- TouchPoint() : id(0), uniqueId(-1), pressure(0), rotation(0), state(Qt::TouchPointStationary) { }
+ TouchPoint() : id(0), uniqueId(-1), pressure(0), rotation(0), state(QEventPoint::State::Stationary) { }
int id; // for application use
qint64 uniqueId; // for TUIO: object/token ID; otherwise empty
// TODO for TUIO 2.0: add registerPointerUniqueID(QPointingDeviceUniqueId)
@@ -164,26 +120,23 @@ public:
qreal pressure; // 0 to 1
qreal rotation; // rotation applied to the elliptical contact patch
// 0 means pointing straight up; 0 if unknown (like QTabletEvent::rotation)
- Qt::TouchPointState state; //Qt::TouchPoint{Pressed|Moved|Stationary|Released}
+ QEventPoint::State state; // Pressed|Updated|Stationary|Released
QVector2D velocity; // in screen coordinate system, pixels / seconds
- QTouchEvent::TouchPoint::InfoFlags flags;
- QVector<QPointF> rawPositions; // in screen coordinates
+ QList<QPointF> rawPositions; // in screen coordinates
};
- static void registerTouchDevice(const QTouchDevice *device);
- static void unregisterTouchDevice(const QTouchDevice *device);
- static bool isTouchDeviceRegistered(const QTouchDevice *device);
+ static void registerInputDevice(const QInputDevice *device);
template<typename Delivery = QWindowSystemInterface::DefaultDelivery>
- static void handleTouchEvent(QWindow *window, QTouchDevice *device,
+ static bool handleTouchEvent(QWindow *window, const QPointingDevice *device,
const QList<struct TouchPoint> &points, Qt::KeyboardModifiers mods = Qt::NoModifier);
template<typename Delivery = QWindowSystemInterface::DefaultDelivery>
- static void handleTouchEvent(QWindow *window, ulong timestamp, QTouchDevice *device,
+ static bool handleTouchEvent(QWindow *window, ulong timestamp, const QPointingDevice *device,
const QList<struct TouchPoint> &points, Qt::KeyboardModifiers mods = Qt::NoModifier);
template<typename Delivery = QWindowSystemInterface::DefaultDelivery>
- static void handleTouchCancelEvent(QWindow *window, QTouchDevice *device, Qt::KeyboardModifiers mods = Qt::NoModifier);
+ static bool handleTouchCancelEvent(QWindow *window, const QPointingDevice *device, Qt::KeyboardModifiers mods = Qt::NoModifier);
template<typename Delivery = QWindowSystemInterface::DefaultDelivery>
- static void handleTouchCancelEvent(QWindow *window, ulong timestamp, QTouchDevice *device, Qt::KeyboardModifiers mods = Qt::NoModifier);
+ static bool handleTouchCancelEvent(QWindow *window, ulong timestamp, const QPointingDevice *device, Qt::KeyboardModifiers mods = Qt::NoModifier);
// rect is relative to parent
template<typename Delivery = QWindowSystemInterface::DefaultDelivery>
@@ -191,7 +144,10 @@ public:
// region is in local coordinates, do not confuse with geometry which is parent-relative
template<typename Delivery = QWindowSystemInterface::DefaultDelivery>
- static void handleExposeEvent(QWindow *window, const QRegion &region);
+ static bool handleExposeEvent(QWindow *window, const QRegion &region);
+
+ template<typename Delivery = QWindowSystemInterface::DefaultDelivery>
+ static bool handlePaintEvent(QWindow *window, const QRegion &region);
template<typename Delivery = QWindowSystemInterface::DefaultDelivery>
static bool handleCloseEvent(QWindow *window);
@@ -201,8 +157,9 @@ public:
template<typename Delivery = QWindowSystemInterface::DefaultDelivery>
static void handleLeaveEvent(QWindow *window);
static void handleEnterLeaveEvent(QWindow *enter, QWindow *leave, const QPointF &local = QPointF(), const QPointF& global = QPointF());
+
template<typename Delivery = QWindowSystemInterface::DefaultDelivery>
- static void handleWindowActivated(QWindow *window, Qt::FocusReason r = Qt::OtherFocusReason);
+ static void handleFocusWindowChanged(QWindow *window, Qt::FocusReason r = Qt::OtherFocusReason);
template<typename Delivery = QWindowSystemInterface::DefaultDelivery>
static void handleWindowStateChanged(QWindow *window, Qt::WindowStates newState, int oldState = -1);
@@ -210,6 +167,9 @@ public:
static void handleWindowScreenChanged(QWindow *window, QScreen *newScreen);
template<typename Delivery = QWindowSystemInterface::DefaultDelivery>
+ static void handleWindowDevicePixelRatioChanged(QWindow *window);
+
+ template<typename Delivery = QWindowSystemInterface::DefaultDelivery>
static void handleSafeAreaMarginsChanged(QWindow *window);
template<typename Delivery = QWindowSystemInterface::DefaultDelivery>
@@ -219,12 +179,6 @@ public:
static bool handleApplicationTermination();
#if QT_CONFIG(draganddrop)
-#if QT_DEPRECATED_SINCE(5, 11)
- QT_DEPRECATED static QPlatformDragQtResponse handleDrag(QWindow *window, const QMimeData *dropData,
- const QPoint &p, Qt::DropActions supportedActions);
- QT_DEPRECATED static QPlatformDropQtResponse handleDrop(QWindow *window, const QMimeData *dropData,
- const QPoint &p, Qt::DropActions supportedActions);
-#endif // #if QT_DEPRECATED_SINCE(5, 11)
static QPlatformDragQtResponse handleDrag(QWindow *window, const QMimeData *dropData,
const QPoint &p, Qt::DropActions supportedActions,
Qt::MouseButtons buttons, Qt::KeyboardModifiers modifiers);
@@ -233,11 +187,7 @@ public:
Qt::MouseButtons buttons, Qt::KeyboardModifiers modifiers);
#endif // QT_CONFIG(draganddrop)
-#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
static bool handleNativeEvent(QWindow *window, const QByteArray &eventType, void *message, qintptr *result);
-#else
- static bool handleNativeEvent(QWindow *window, const QByteArray &eventType, void *message, long *result);
-#endif
// Changes to the screen
static void handleScreenAdded(QPlatformScreen *screen, bool isPrimary = false);
@@ -249,41 +199,52 @@ public:
static void handleScreenLogicalDotsPerInchChange(QScreen *screen, qreal newDpiX, qreal newDpiY);
static void handleScreenRefreshRateChange(QScreen *screen, qreal newRefreshRate);
- static void handleThemeChange(QWindow *window);
+ template<typename Delivery = QWindowSystemInterface::DefaultDelivery>
+ static void handleThemeChange(QWindow *window = nullptr);
static void handleFileOpenEvent(const QString& fileName);
static void handleFileOpenEvent(const QUrl &url);
- static void handleTabletEvent(QWindow *window, ulong timestamp, const QPointF &local, const QPointF &global,
+ static bool handleTabletEvent(QWindow *window, ulong timestamp, const QPointingDevice *device,
+ const QPointF &local, const QPointF &global,
+ Qt::MouseButtons buttons, qreal pressure, int xTilt, int yTilt,
+ qreal tangentialPressure, qreal rotation, int z, Qt::KeyboardModifiers modifiers = Qt::NoModifier);
+ static bool handleTabletEvent(QWindow *window, const QPointingDevice *device,
+ const QPointF &local, const QPointF &global,
+ Qt::MouseButtons buttons, qreal pressure, int xTilt, int yTilt,
+ qreal tangentialPressure, qreal rotation, int z, Qt::KeyboardModifiers modifiers = Qt::NoModifier);
+ static bool handleTabletEvent(QWindow *window, ulong timestamp, const QPointF &local, const QPointF &global,
int device, int pointerType, Qt::MouseButtons buttons, qreal pressure, int xTilt, int yTilt,
qreal tangentialPressure, qreal rotation, int z, qint64 uid,
Qt::KeyboardModifiers modifiers = Qt::NoModifier);
- static void handleTabletEvent(QWindow *window, const QPointF &local, const QPointF &global,
+ static bool handleTabletEvent(QWindow *window, const QPointF &local, const QPointF &global,
int device, int pointerType, Qt::MouseButtons buttons, qreal pressure, int xTilt, int yTilt,
qreal tangentialPressure, qreal rotation, int z, qint64 uid,
Qt::KeyboardModifiers modifiers = Qt::NoModifier);
-#if QT_DEPRECATED_SINCE(5, 10)
- QT_DEPRECATED static void handleTabletEvent(QWindow *window, ulong timestamp, bool down, const QPointF &local, const QPointF &global,
- int device, int pointerType, qreal pressure, int xTilt, int yTilt,
- qreal tangentialPressure, qreal rotation, int z, qint64 uid,
- Qt::KeyboardModifiers modifiers = Qt::NoModifier);
- QT_DEPRECATED static void handleTabletEvent(QWindow *window, bool down, const QPointF &local, const QPointF &global,
- int device, int pointerType, qreal pressure, int xTilt, int yTilt,
- qreal tangentialPressure, qreal rotation, int z, qint64 uid,
- Qt::KeyboardModifiers modifiers = Qt::NoModifier);
-#endif
- static void handleTabletEnterProximityEvent(ulong timestamp, int device, int pointerType, qint64 uid);
- static void handleTabletEnterProximityEvent(int device, int pointerType, qint64 uid);
- static void handleTabletLeaveProximityEvent(ulong timestamp, int device, int pointerType, qint64 uid);
- static void handleTabletLeaveProximityEvent(int device, int pointerType, qint64 uid);
+ static bool handleTabletEnterLeaveProximityEvent(QWindow *window, ulong timestamp, const QPointingDevice *device,
+ bool inProximity, const QPointF &local = QPointF(), const QPointF &global = QPointF(),
+ Qt::MouseButtons buttons = {}, int xTilt = 0, int yTilt = 0,
+ qreal tangentialPressure = 0, qreal rotation = 0, int z = 0,
+ Qt::KeyboardModifiers modifiers = Qt::NoModifier);
+ static bool handleTabletEnterLeaveProximityEvent(QWindow *window, const QPointingDevice *device,
+ bool inProximity, const QPointF &local = QPointF(), const QPointF &global = QPointF(),
+ Qt::MouseButtons buttons = {}, int xTilt = 0, int yTilt = 0,
+ qreal tangentialPressure = 0, qreal rotation = 0, int z = 0,
+ Qt::KeyboardModifiers modifiers = Qt::NoModifier);
+
+ // The following 4 functions are deprecated (QTBUG-114560)
+ static bool handleTabletEnterProximityEvent(ulong timestamp, int deviceType, int pointerType, qint64 uid);
+ static void handleTabletEnterProximityEvent(int deviceType, int pointerType, qint64 uid);
+ static bool handleTabletLeaveProximityEvent(ulong timestamp, int deviceType, int pointerType, qint64 uid);
+ static void handleTabletLeaveProximityEvent(int deviceType, int pointerType, qint64 uid);
#ifndef QT_NO_GESTURES
- static void handleGestureEvent(QWindow *window, QTouchDevice *device, ulong timestamp, Qt::NativeGestureType type,
- QPointF &local, QPointF &global);
- static void handleGestureEventWithRealValue(QWindow *window, QTouchDevice *device, ulong timestamp, Qt::NativeGestureType type,
- qreal value, QPointF &local, QPointF &global);
- static void handleGestureEventWithSequenceIdAndValue(QWindow *window, QTouchDevice *device, ulong timestamp,Qt::NativeGestureType type,
- ulong sequenceId, quint64 value, QPointF &local, QPointF &global);
+ static bool handleGestureEvent(QWindow *window, ulong timestamp, const QPointingDevice *device, Qt::NativeGestureType type,
+ const QPointF &local, const QPointF &global, int fingerCount = 0);
+ static bool handleGestureEventWithRealValue(QWindow *window, ulong timestamp, const QPointingDevice *device, Qt::NativeGestureType type,
+ qreal value, const QPointF &local, const QPointF &global, int fingerCount = 2);
+ static bool handleGestureEventWithValueAndDelta(QWindow *window, ulong timestamp, const QPointingDevice *device, Qt::NativeGestureType type, qreal value,
+ const QPointF &delta, const QPointF &local, const QPointF &global, int fingerCount = 2);
#endif // QT_NO_GESTURES
static void handlePlatformPanelEvent(QWindow *window);
@@ -303,7 +264,6 @@ public:
static void deferredFlushWindowSystemEvents(QEventLoop::ProcessEventsFlags flags);
static int windowSystemEventsQueued();
static bool nonUserInputEventsQueued();
- static void setPlatformFiltersEvents(bool enable);
};
#ifndef QT_NO_DEBUG_STREAM
diff --git a/src/gui/kernel/qwindowsysteminterface_p.h b/src/gui/kernel/qwindowsysteminterface_p.h
index 6e4bce607e..51ab58fc99 100644
--- a/src/gui/kernel/qwindowsysteminterface_p.h
+++ b/src/gui/kernel/qwindowsysteminterface_p.h
@@ -1,41 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the QtGui module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#ifndef QWINDOWSYSTEMINTERFACE_P_H
#define QWINDOWSYSTEMINTERFACE_P_H
@@ -50,6 +14,7 @@
// We mean it.
//
+#include <QtGui/private/qevent_p.h>
#include <QtGui/private/qtguiglobal_p.h>
#include "qwindowsysteminterface.h"
@@ -59,9 +24,12 @@
#include <QList>
#include <QWaitCondition>
#include <QAtomicInt>
+#include <QLoggingCategory>
QT_BEGIN_NAMESPACE
+Q_DECLARE_LOGGING_CATEGORY(lcQpaInputDevices);
+
class QWindowSystemEventHandler;
class Q_GUI_EXPORT QWindowSystemInterfacePrivate {
@@ -72,10 +40,9 @@ public:
GeometryChange = 0x02,
Enter = UserInputEvent | 0x03,
Leave = UserInputEvent | 0x04,
- ActivatedWindow = 0x05,
+ FocusWindow = 0x05,
WindowStateChanged = 0x06,
Mouse = UserInputEvent | 0x07,
- FrameStrutMouse = UserInputEvent | 0x08, // ### Qt6 remove
Wheel = UserInputEvent | 0x09,
Key = UserInputEvent | 0x0a,
Touch = UserInputEvent | 0x0b,
@@ -100,7 +67,9 @@ public:
FlushEvents = 0x20,
WindowScreenChanged = 0x21,
SafeAreaMarginsChanged = 0x22,
- ApplicationTermination = 0x23
+ ApplicationTermination = 0x23,
+ Paint = 0x24,
+ WindowDevicePixelRatioChanged = 0x25,
};
class WindowSystemEvent {
@@ -156,12 +125,12 @@ public:
QPointer<QWindow> leave;
};
- class ActivatedWindowEvent : public WindowSystemEvent {
+ class FocusWindowEvent : public WindowSystemEvent {
public:
- explicit ActivatedWindowEvent(QWindow *activatedWindow, Qt::FocusReason r)
- : WindowSystemEvent(ActivatedWindow), activated(activatedWindow), reason(r)
+ explicit FocusWindowEvent(QWindow *focusedWindow, Qt::FocusReason r)
+ : WindowSystemEvent(FocusWindow), focused(focusedWindow), reason(r)
{ }
- QPointer<QWindow> activated;
+ QPointer<QWindow> focused;
Qt::FocusReason reason;
};
@@ -186,6 +155,15 @@ public:
QPointer<QScreen> screen;
};
+ class WindowDevicePixelRatioChangedEvent : public WindowSystemEvent {
+ public:
+ WindowDevicePixelRatioChangedEvent(QWindow *w)
+ : WindowSystemEvent(WindowDevicePixelRatioChanged), window(w)
+ { }
+
+ QPointer<QWindow> window;
+ };
+
class SafeAreaMarginsChangedEvent : public WindowSystemEvent {
public:
SafeAreaMarginsChangedEvent(QWindow *w)
@@ -228,26 +206,27 @@ public:
class InputEvent: public UserEvent {
public:
- InputEvent(QWindow * w, ulong time, EventType t, Qt::KeyboardModifiers mods)
- : UserEvent(w, time, t), modifiers(mods) {}
+ InputEvent(QWindow *w, ulong time, EventType t, Qt::KeyboardModifiers mods, const QInputDevice *dev)
+ : UserEvent(w, time, t), modifiers(mods), device(dev) {}
Qt::KeyboardModifiers modifiers;
+ const QInputDevice *device;
+ };
+
+ class PointerEvent : public InputEvent {
+ public:
+ PointerEvent(QWindow * w, ulong time, EventType t, Qt::KeyboardModifiers mods, const QPointingDevice *device)
+ : InputEvent(w, time, t, mods, device) {}
};
- class MouseEvent : public InputEvent {
+ class MouseEvent : public PointerEvent {
public:
MouseEvent(QWindow *w, ulong time, const QPointF &local, const QPointF &global,
Qt::MouseButtons state, Qt::KeyboardModifiers mods,
Qt::MouseButton b, QEvent::Type type,
- Qt::MouseEventSource src = Qt::MouseEventNotSynthesized, bool frame = false)
- : InputEvent(w, time, Mouse, mods), localPos(local), globalPos(global), buttons(state),
- source(src), nonClientArea(frame), button(b), buttonType(type) { }
-
- // ### In Qt6 this method can be removed as there won't be need for compatibility code path
- bool enhancedMouseEvent() const
- {
- static const bool disableEnhanced = qEnvironmentVariableIsSet("QT_QPA_DISABLE_ENHANCED_MOUSE");
- return !disableEnhanced && buttonType != QEvent::None;
- }
+ Qt::MouseEventSource src = Qt::MouseEventNotSynthesized, bool frame = false,
+ const QPointingDevice *device = QPointingDevice::primaryPointingDevice())
+ : PointerEvent(w, time, Mouse, mods, device), localPos(local), globalPos(global),
+ buttons(state), source(src), nonClientArea(frame), button(b), buttonType(type) { }
QPointF localPos;
QPointF globalPos;
@@ -258,10 +237,13 @@ public:
QEvent::Type buttonType;
};
- class WheelEvent : public InputEvent {
+ class WheelEvent : public PointerEvent {
public:
WheelEvent(QWindow *w, ulong time, const QPointF &local, const QPointF &global, QPoint pixelD, QPoint angleD, int qt4D, Qt::Orientation qt4O,
- Qt::KeyboardModifiers mods, Qt::ScrollPhase phase = Qt::NoScrollPhase, Qt::MouseEventSource src = Qt::MouseEventNotSynthesized, bool inverted = false);
+ Qt::KeyboardModifiers mods, Qt::ScrollPhase phase = Qt::NoScrollPhase, Qt::MouseEventSource src = Qt::MouseEventNotSynthesized,
+ bool inverted = false, const QPointingDevice *device = QPointingDevice::primaryPointingDevice())
+ : PointerEvent(w, time, Wheel, mods, device), pixelDelta(pixelD), angleDelta(angleD), qt4Delta(qt4D),
+ qt4Orientation(qt4O), localPos(local), globalPos(global), phase(phase), source(src), inverted(inverted) { }
QPoint pixelDelta;
QPoint angleDelta;
int qt4Delta;
@@ -275,16 +257,20 @@ public:
class KeyEvent : public InputEvent {
public:
- KeyEvent(QWindow *w, ulong time, QEvent::Type t, int k, Qt::KeyboardModifiers mods, const QString & text = QString(), bool autorep = false, ushort count = 1)
- :InputEvent(w, time, Key, mods), key(k), unicode(text), repeat(autorep),
- repeatCount(count), keyType(t),
+ KeyEvent(QWindow *w, ulong time, QEvent::Type t, int k, Qt::KeyboardModifiers mods,
+ const QString & text = QString(), bool autorep = false, ushort count = 1,
+ const QInputDevice *device = QInputDevice::primaryKeyboard())
+ : InputEvent(w, time, Key, mods, device), source(nullptr), key(k), unicode(text),
+ repeat(autorep), repeatCount(count), keyType(t),
nativeScanCode(0), nativeVirtualKey(0), nativeModifiers(0) { }
KeyEvent(QWindow *w, ulong time, QEvent::Type t, int k, Qt::KeyboardModifiers mods,
quint32 nativeSC, quint32 nativeVK, quint32 nativeMods,
- const QString & text = QString(), bool autorep = false, ushort count = 1)
- :InputEvent(w, time, Key, mods), key(k), unicode(text), repeat(autorep),
- repeatCount(count), keyType(t),
+ const QString & text = QString(), bool autorep = false, ushort count = 1,
+ const QInputDevice *device = QInputDevice::primaryKeyboard())
+ : InputEvent(w, time, Key, mods, device), source(nullptr), key(k), unicode(text),
+ repeat(autorep), repeatCount(count), keyType(t),
nativeScanCode(nativeSC), nativeVirtualKey(nativeVK), nativeModifiers(nativeMods) { }
+ const QInputDevice *source;
int key;
QString unicode;
bool repeat;
@@ -295,13 +281,12 @@ public:
quint32 nativeModifiers;
};
- class TouchEvent : public InputEvent {
+ class TouchEvent : public PointerEvent {
public:
- TouchEvent(QWindow *w, ulong time, QEvent::Type t, QTouchDevice *dev,
- const QList<QTouchEvent::TouchPoint> &p, Qt::KeyboardModifiers mods)
- :InputEvent(w, time, Touch, mods), device(dev), points(p), touchType(t) { }
- QTouchDevice *device;
- QList<QTouchEvent::TouchPoint> points;
+ TouchEvent(QWindow *w, ulong time, QEvent::Type t, const QPointingDevice *device,
+ const QList<QEventPoint> &p, Qt::KeyboardModifiers mods)
+ : PointerEvent(w, time, Touch, mods, device), points(p), touchType(t) { }
+ QList<QEventPoint> points;
QEvent::Type touchType;
};
@@ -354,6 +339,14 @@ public:
QRegion region;
};
+ class PaintEvent : public WindowSystemEvent {
+ public:
+ PaintEvent(QWindow *window, const QRegion &region)
+ : WindowSystemEvent(Paint), window(window), region(region) {}
+ QPointer<QWindow> window;
+ QRegion region;
+ };
+
class FileOpenEvent : public WindowSystemEvent {
public:
FileOpenEvent(const QString& fileName)
@@ -365,8 +358,9 @@ public:
QUrl url;
};
- class Q_GUI_EXPORT TabletEvent : public InputEvent {
+ class Q_GUI_EXPORT TabletEvent : public PointerEvent {
public:
+ // TODO take QPointingDevice* instead of types and IDs
static void handleTabletEvent(QWindow *w, const QPointF &local, const QPointF &global,
int device, int pointerType, Qt::MouseButtons buttons, qreal pressure, int xTilt, int yTilt,
qreal tangentialPressure, qreal rotation, int z, qint64 uid,
@@ -374,45 +368,36 @@ public:
static void setPlatformSynthesizesMouse(bool v);
TabletEvent(QWindow *w, ulong time, const QPointF &local, const QPointF &global,
- int device, int pointerType, Qt::MouseButtons b, qreal pressure, int xTilt, int yTilt, qreal tpressure,
- qreal rotation, int z, qint64 uid, Qt::KeyboardModifiers mods)
- : InputEvent(w, time, Tablet, mods),
- buttons(b), local(local), global(global), device(device), pointerType(pointerType),
+ const QPointingDevice *device, Qt::MouseButtons b, qreal pressure, int xTilt, int yTilt, qreal tpressure,
+ qreal rotation, int z, Qt::KeyboardModifiers mods)
+ : PointerEvent(w, time, Tablet, mods, device),
+ buttons(b), local(local), global(global),
pressure(pressure), xTilt(xTilt), yTilt(yTilt), tangentialPressure(tpressure),
- rotation(rotation), z(z), uid(uid) { }
+ rotation(rotation), z(z) { }
Qt::MouseButtons buttons;
QPointF local;
QPointF global;
- int device;
- int pointerType;
qreal pressure;
int xTilt;
int yTilt;
qreal tangentialPressure;
qreal rotation;
int z;
- qint64 uid;
static bool platformSynthesizesMouse;
};
- class TabletEnterProximityEvent : public InputEvent {
+ class TabletEnterProximityEvent : public PointerEvent {
public:
- TabletEnterProximityEvent(ulong time, int device, int pointerType, qint64 uid)
- : InputEvent(nullptr, time, TabletEnterProximity, Qt::NoModifier),
- device(device), pointerType(pointerType), uid(uid) { }
- int device;
- int pointerType;
- qint64 uid;
+ // TODO store more info: position and whatever else we can get on most platforms
+ TabletEnterProximityEvent(ulong time, const QPointingDevice *device)
+ : PointerEvent(nullptr, time, TabletEnterProximity, Qt::NoModifier, device) { }
};
- class TabletLeaveProximityEvent : public InputEvent {
+ class TabletLeaveProximityEvent : public PointerEvent {
public:
- TabletLeaveProximityEvent(ulong time, int device, int pointerType, qint64 uid)
- : InputEvent(nullptr, time, TabletLeaveProximity, Qt::NoModifier),
- device(device), pointerType(pointerType), uid(uid) { }
- int device;
- int pointerType;
- qint64 uid;
+ // TODO store more info: position and whatever else we can get on most platforms
+ TabletLeaveProximityEvent(ulong time, const QPointingDevice *device)
+ : PointerEvent(nullptr, time, TabletLeaveProximity, Qt::NoModifier, device) { }
};
class PlatformPanelEvent : public WindowSystemEvent {
@@ -438,20 +423,22 @@ public:
#endif
#ifndef QT_NO_GESTURES
- class GestureEvent : public InputEvent {
+ class GestureEvent : public PointerEvent {
public:
- GestureEvent(QWindow *window, ulong time, Qt::NativeGestureType type, QTouchDevice *dev, QPointF pos, QPointF globalPos)
- : InputEvent(window, time, Gesture, Qt::NoModifier), type(type), pos(pos), globalPos(globalPos),
- realValue(0), sequenceId(0), intValue(0), device(dev) { }
+ GestureEvent(QWindow *window, ulong time, Qt::NativeGestureType type, const QPointingDevice *dev,
+ int fingerCount, QPointF pos, QPointF globalPos, qreal realValue, QPointF delta)
+ : PointerEvent(window, time, Gesture, Qt::NoModifier, dev), type(type), pos(pos), globalPos(globalPos),
+ delta(delta), fingerCount(fingerCount), realValue(realValue), sequenceId(0), intValue(0) { }
Qt::NativeGestureType type;
QPointF pos;
QPointF globalPos;
+ QPointF delta;
+ int fingerCount;
// Mac
qreal realValue;
// Windows
ulong sequenceId;
quint64 intValue;
- QTouchDevice *device;
};
#endif
@@ -467,7 +454,7 @@ public:
void prepend(WindowSystemEvent *e)
{ const QMutexLocker locker(&mutex); impl.prepend(e); }
WindowSystemEvent *takeFirstOrReturnNull()
- { const QMutexLocker locker(&mutex); return impl.empty() ? 0 : impl.takeFirst(); }
+ { const QMutexLocker locker(&mutex); return impl.empty() ? nullptr : impl.takeFirst(); }
WindowSystemEvent *takeFirstNonUserInputOrReturnNull()
{
const QMutexLocker locker(&mutex);
@@ -486,8 +473,8 @@ public:
}
void append(WindowSystemEvent *e)
{ const QMutexLocker locker(&mutex); impl.append(e); }
- int count() const
- { const QMutexLocker locker(&mutex); return impl.count(); }
+ qsizetype count() const
+ { const QMutexLocker locker(&mutex); return impl.size(); }
WindowSystemEvent *peekAtFirstOfType(EventType t) const
{
const QMutexLocker locker(&mutex);
@@ -513,14 +500,12 @@ public:
static WindowSystemEventList windowSystemEventQueue;
- static int windowSystemEventsQueued();
+ static qsizetype windowSystemEventsQueued();
static bool nonUserInputEventsQueued();
static WindowSystemEvent *getWindowSystemEvent();
static WindowSystemEvent *getNonUserInputWindowSystemEvent();
static WindowSystemEvent *peekWindowSystemEvent(EventType t);
static void removeWindowSystemEvent(WindowSystemEvent *event);
- template<typename Delivery = QWindowSystemInterface::DefaultDelivery>
- static bool handleWindowSystemEvent(WindowSystemEvent *ev);
public:
static QElapsedTimer eventTime;
@@ -529,16 +514,24 @@ public:
static QWaitCondition eventsFlushed;
static QMutex flushEventMutex;
- static QMutex pointIdMapMutex;
static QAtomicInt eventAccepted;
- static QList<QTouchEvent::TouchPoint>
+ static QList<QEventPoint>
fromNativeTouchPoints(const QList<QWindowSystemInterface::TouchPoint> &points,
- const QWindow *window, quint8 deviceId, QEvent::Type *type = nullptr);
+ const QWindow *window, QEvent::Type *type = nullptr);
+ template<class EventPointList>
static QList<QWindowSystemInterface::TouchPoint>
- toNativeTouchPoints(const QList<QTouchEvent::TouchPoint>& pointList,
- const QWindow *window);
- static void clearPointIdMap();
+ toNativeTouchPoints(const EventPointList &pointList, const QWindow *window)
+ {
+ QList<QWindowSystemInterface::TouchPoint> newList;
+ newList.reserve(pointList.size());
+ for (const auto &point : pointList) {
+ newList.append(toNativeTouchPoint(point, window));
+ }
+ return newList;
+ }
+ static QWindowSystemInterface::TouchPoint
+ toNativeTouchPoint(const QEventPoint &point, const QWindow *window);
static void installWindowSystemEventHandler(QWindowSystemEventHandler *handler);
static void removeWindowSystemEventhandler(QWindowSystemEventHandler *handler);
diff --git a/src/gui/math3d/math3d.pri b/src/gui/math3d/math3d.pri
deleted file mode 100644
index e4dd53a68e..0000000000
--- a/src/gui/math3d/math3d.pri
+++ /dev/null
@@ -1,15 +0,0 @@
-HEADERS += \
- math3d/qgenericmatrix.h \
- math3d/qmatrix4x4.h \
- math3d/qquaternion.h \
- math3d/qvector2d.h \
- math3d/qvector3d.h \
- math3d/qvector4d.h
-
-SOURCES += \
- math3d/qgenericmatrix.cpp \
- math3d/qmatrix4x4.cpp \
- math3d/qquaternion.cpp \
- math3d/qvector2d.cpp \
- math3d/qvector3d.cpp \
- math3d/qvector4d.cpp
diff --git a/src/gui/math3d/qgenericmatrix.cpp b/src/gui/math3d/qgenericmatrix.cpp
index b144d132d0..7ffb53a88b 100644
--- a/src/gui/math3d/qgenericmatrix.cpp
+++ b/src/gui/math3d/qgenericmatrix.cpp
@@ -1,46 +1,19 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the QtGui module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#include "qgenericmatrix.h"
QT_BEGIN_NAMESPACE
+QT_IMPL_METATYPE_EXTERN(QMatrix2x2)
+QT_IMPL_METATYPE_EXTERN(QMatrix2x3)
+QT_IMPL_METATYPE_EXTERN(QMatrix2x4)
+QT_IMPL_METATYPE_EXTERN(QMatrix3x2)
+QT_IMPL_METATYPE_EXTERN(QMatrix3x3)
+QT_IMPL_METATYPE_EXTERN(QMatrix3x4)
+QT_IMPL_METATYPE_EXTERN(QMatrix4x2)
+QT_IMPL_METATYPE_EXTERN(QMatrix4x3)
+
/*!
\class QGenericMatrix
\brief The QGenericMatrix class is a template class that represents a NxM transformation matrix with N columns and M rows.
@@ -177,8 +150,7 @@ QT_BEGIN_NAMESPACE
*/
/*!
- \fn template<int NN, int M1, int M2, typename TT> QGenericMatrix<M1, M2, TT> operator*(const QGenericMatrix<NN, M2, TT>& m1, const QGenericMatrix<M1, NN, TT>& m2)
- \relates QGenericMatrix
+ \fn template <int N, int M, typename T> template<int NN, int M1, int M2, typename TT> QGenericMatrix<M1, M2, TT> QGenericMatrix<N, M, T>::operator*(const QGenericMatrix<NN, M2, TT>& m1, const QGenericMatrix<M1, NN, TT>& m2)
Returns the product of the NNxM2 matrix \a m1 and the M1xNN matrix \a m2
to produce a M1xM2 matrix result.
diff --git a/src/gui/math3d/qgenericmatrix.h b/src/gui/math3d/qgenericmatrix.h
index 692c29c996..1e20df5a6b 100644
--- a/src/gui/math3d/qgenericmatrix.h
+++ b/src/gui/math3d/qgenericmatrix.h
@@ -1,41 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the QtGui module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#ifndef QGENERICMATRIX_H
#define QGENERICMATRIX_H
@@ -64,7 +28,7 @@ public:
void fill(T value);
- Q_REQUIRED_RESULT QGenericMatrix<M, N, T> transposed() const;
+ [[nodiscard]] QGenericMatrix<M, N, T> transposed() const;
QGenericMatrix<N, M, T>& operator+=(const QGenericMatrix<N, M, T>& other);
QGenericMatrix<N, M, T>& operator-=(const QGenericMatrix<N, M, T>& other);
@@ -79,7 +43,6 @@ public:
const T *data() const { return *m; }
const T *constData() const { return *m; }
-#if !defined(Q_NO_TEMPLATE_FRIENDS)
template<int NN, int MM, typename TT>
friend QGenericMatrix<NN, MM, TT> operator+(const QGenericMatrix<NN, MM, TT>& m1, const QGenericMatrix<NN, MM, TT>& m2);
template<int NN, int MM, typename TT>
@@ -96,24 +59,15 @@ public:
friend QGenericMatrix<NN, MM, TT> operator/(const QGenericMatrix<NN, MM, TT>& matrix, TT divisor);
private:
-#endif
T m[N][M]; // Column-major order to match OpenGL.
-#if !defined(Q_NO_TEMPLATE_FRIENDS)
template <int NN, int MM, typename TT>
friend class QGenericMatrix;
-#endif
};
template <int N, int M, typename T>
class QTypeInfo<QGenericMatrix<N, M, T> >
: public QTypeInfoMerger<QGenericMatrix<N, M, T>, T>
{
-#if QT_VERSION < QT_VERSION_CHECK(6,0,0)
-public:
- enum {
- isStatic = true,
- }; // at least Q_RELOCATABLE_TYPE, for BC during Qt 5
-#endif
};
template <int N, int M, typename T>
@@ -219,6 +173,9 @@ Q_OUTOFLINE_TEMPLATE QGenericMatrix<N, M, T>& QGenericMatrix<N, M, T>::operator*
return *this;
}
+QT_WARNING_PUSH
+QT_WARNING_DISABLE_FLOAT_COMPARE
+
template <int N, int M, typename T>
Q_OUTOFLINE_TEMPLATE bool QGenericMatrix<N, M, T>::operator==(const QGenericMatrix<N, M, T>& other) const
{
@@ -233,14 +190,11 @@ Q_OUTOFLINE_TEMPLATE bool QGenericMatrix<N, M, T>::operator==(const QGenericMatr
template <int N, int M, typename T>
Q_OUTOFLINE_TEMPLATE bool QGenericMatrix<N, M, T>::operator!=(const QGenericMatrix<N, M, T>& other) const
{
- for (int row = 0; row < M; ++row)
- for (int col = 0; col < N; ++col) {
- if (m[col][row] != other.m[col][row])
- return true;
- }
- return false;
+ return !(*this == other);
}
+QT_WARNING_POP
+
template <int N, int M, typename T>
Q_OUTOFLINE_TEMPLATE QGenericMatrix<N, M, T>& QGenericMatrix<N, M, T>::operator/=(T divisor)
{
@@ -350,7 +304,7 @@ QDebug operator<<(QDebug dbg, const QGenericMatrix<N, M, T> &m)
{
QDebugStateSaver saver(dbg);
dbg.nospace() << "QGenericMatrix<" << N << ", " << M
- << ", " << QTypeInfo<T>::name()
+ << ", " << QMetaType::fromType<T>().name()
<< ">(" << Qt::endl << qSetFieldWidth(10);
for (int row = 0; row < M; ++row) {
for (int col = 0; col < N; ++col)
@@ -391,13 +345,13 @@ QDataStream &operator>>(QDataStream &stream, QGenericMatrix<N, M, T> &matrix)
QT_END_NAMESPACE
-Q_DECLARE_METATYPE(QMatrix2x2)
-Q_DECLARE_METATYPE(QMatrix2x3)
-Q_DECLARE_METATYPE(QMatrix2x4)
-Q_DECLARE_METATYPE(QMatrix3x2)
-Q_DECLARE_METATYPE(QMatrix3x3)
-Q_DECLARE_METATYPE(QMatrix3x4)
-Q_DECLARE_METATYPE(QMatrix4x2)
-Q_DECLARE_METATYPE(QMatrix4x3)
+QT_DECL_METATYPE_EXTERN(QMatrix2x2, Q_GUI_EXPORT)
+QT_DECL_METATYPE_EXTERN(QMatrix2x3, Q_GUI_EXPORT)
+QT_DECL_METATYPE_EXTERN(QMatrix2x4, Q_GUI_EXPORT)
+QT_DECL_METATYPE_EXTERN(QMatrix3x2, Q_GUI_EXPORT)
+QT_DECL_METATYPE_EXTERN(QMatrix3x3, Q_GUI_EXPORT)
+QT_DECL_METATYPE_EXTERN(QMatrix3x4, Q_GUI_EXPORT)
+QT_DECL_METATYPE_EXTERN(QMatrix4x2, Q_GUI_EXPORT)
+QT_DECL_METATYPE_EXTERN(QMatrix4x3, Q_GUI_EXPORT)
#endif
diff --git a/src/gui/math3d/qmatrix4x4.cpp b/src/gui/math3d/qmatrix4x4.cpp
index ad4cdfdbf4..d04a502519 100644
--- a/src/gui/math3d/qmatrix4x4.cpp
+++ b/src/gui/math3d/qmatrix4x4.cpp
@@ -1,46 +1,9 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the QtGui module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#include "qmatrix4x4.h"
#include <QtCore/qmath.h>
#include <QtCore/qvariant.h>
-#include <QtGui/qmatrix.h>
#include <QtGui/qtransform.h>
#include <cmath>
@@ -137,7 +100,7 @@ QMatrix4x4::QMatrix4x4(const float *values)
*/
/*!
- \fn QGenericMatrix<N, M, float> QMatrix4x4::toGenericMatrix() const
+ \fn template <int N, int M> QGenericMatrix<N, M, float> QMatrix4x4::toGenericMatrix() const
Constructs a NxM generic matrix from the left-most N columns and
top-most M rows of this 4x4 matrix. If N or M is greater than 4,
@@ -146,30 +109,6 @@ QMatrix4x4::QMatrix4x4(const float *values)
*/
/*!
- \fn template <int N, int M> QMatrix4x4 qGenericMatrixToMatrix4x4(const QGenericMatrix<N, M, float>& matrix)
- \relates QMatrix4x4
- \obsolete
-
- Returns a 4x4 matrix constructed from the left-most 4 columns and
- top-most 4 rows of \a matrix. If \a matrix has less than 4 columns
- or rows, the remaining elements are filled with elements from the
- identity matrix.
-*/
-
-/*!
- \fn QGenericMatrix<N, M, float> qGenericMatrixFromMatrix4x4(const QMatrix4x4& matrix)
- \relates QMatrix4x4
- \obsolete
-
- Returns a NxM generic matrix constructed from the left-most N columns
- and top-most M rows of \a matrix. If N or M is greater than 4,
- then the remaining elements are filled with elements from the
- identity matrix.
-
- \sa QMatrix4x4::toGenericMatrix()
-*/
-
-/*!
\internal
*/
QMatrix4x4::QMatrix4x4(const float *values, int cols, int rows)
@@ -188,38 +127,6 @@ QMatrix4x4::QMatrix4x4(const float *values, int cols, int rows)
}
/*!
- Constructs a 4x4 matrix from a conventional Qt 2D affine
- transformation \a matrix.
-
- If \a matrix has a special type (identity, translate, scale, etc),
- the programmer should follow this constructor with a call to
- optimize() if they wish QMatrix4x4 to optimize further
- calls to translate(), scale(), etc.
-
- \sa toAffine(), optimize()
-*/
-QMatrix4x4::QMatrix4x4(const QMatrix& matrix)
-{
- m[0][0] = matrix.m11();
- m[0][1] = matrix.m12();
- m[0][2] = 0.0f;
- m[0][3] = 0.0f;
- m[1][0] = matrix.m21();
- m[1][1] = matrix.m22();
- m[1][2] = 0.0f;
- m[1][3] = 0.0f;
- m[2][0] = 0.0f;
- m[2][1] = 0.0f;
- m[2][2] = 1.0f;
- m[2][3] = 0.0f;
- m[3][0] = matrix.dx();
- m[3][1] = matrix.dy();
- m[3][2] = 0.0f;
- m[3][3] = 1.0f;
- flagBits = Translation | Scale | Rotation2D;
-}
-
-/*!
Constructs a 4x4 matrix from the conventional Qt 2D
transformation matrix \a transform.
@@ -446,7 +353,7 @@ QMatrix4x4 QMatrix4x4::inverted(bool *invertible) const
*invertible = true;
return orthonormalInverse();
} else if (flagBits < Perspective) {
- QMatrix4x4 inv(1); // The "1" says to not load the identity.
+ QMatrix4x4 inv(Qt::Uninitialized);
double mm[4][4];
copyToDoubles(m, mm);
@@ -482,7 +389,7 @@ QMatrix4x4 QMatrix4x4::inverted(bool *invertible) const
return inv;
}
- QMatrix4x4 inv(1); // The "1" says to not load the identity.
+ QMatrix4x4 inv(Qt::Uninitialized);
double mm[4][4];
copyToDoubles(m, mm);
@@ -584,7 +491,7 @@ QMatrix3x3 QMatrix4x4::normalMatrix() const
*/
QMatrix4x4 QMatrix4x4::transposed() const
{
- QMatrix4x4 result(1); // The "1" says to not load the identity.
+ QMatrix4x4 result(Qt::Uninitialized);
for (int row = 0; row < 4; ++row) {
for (int col = 0; col < 4; ++col) {
result.m[col][row] = m[row][col];
@@ -684,24 +591,33 @@ QMatrix4x4& QMatrix4x4::operator/=(float divisor)
#ifndef QT_NO_VECTOR3D
+#if QT_DEPRECATED_SINCE(6, 1)
+
/*!
\fn QVector3D operator*(const QVector3D& vector, const QMatrix4x4& matrix)
\relates QMatrix4x4
+ \deprecated [6.1] Convert the QVector3D to a QVector4D with 1.0 as the w coordinate, then multiply.
+
Returns the result of transforming \a vector according to \a matrix,
- with the matrix applied post-vector.
+ with the matrix applied post-vector. The vector is transformed as a point.
*/
/*!
\fn QVector3D operator*(const QMatrix4x4& matrix, const QVector3D& vector)
\relates QMatrix4x4
+ \deprecated [6.1] Use QMatrix4x4::map() instead.
+
Returns the result of transforming \a vector according to \a matrix,
- with the matrix applied pre-vector.
+ with the matrix applied pre-vector. The vector is transformed as a
+ projective point.
*/
#endif
+#endif
+
#ifndef QT_NO_VECTOR4D
/*!
@@ -738,10 +654,14 @@ QMatrix4x4& QMatrix4x4::operator/=(float divisor)
with the matrix applied post-point.
*/
+#if QT_DEPRECATED_SINCE(6, 1)
+
/*!
\fn QPoint operator*(const QMatrix4x4& matrix, const QPoint& point)
\relates QMatrix4x4
+ \deprecated [6.1] Use QMatrix4x4::map() instead.
+
Returns the result of transforming \a point according to \a matrix,
with the matrix applied pre-point.
*/
@@ -750,10 +670,14 @@ QMatrix4x4& QMatrix4x4::operator/=(float divisor)
\fn QPointF operator*(const QMatrix4x4& matrix, const QPointF& point)
\relates QMatrix4x4
+ \deprecated [6.1] Use QMatrix4x4::map() instead.
+
Returns the result of transforming \a point according to \a matrix,
with the matrix applied pre-point.
*/
+#endif
+
/*!
\fn QMatrix4x4 operator-(const QMatrix4x4& matrix)
\overload
@@ -783,7 +707,7 @@ QMatrix4x4& QMatrix4x4::operator/=(float divisor)
*/
QMatrix4x4 operator/(const QMatrix4x4& matrix, float divisor)
{
- QMatrix4x4 m(1); // The "1" says to not load the identity.
+ QMatrix4x4 m(Qt::Uninitialized);
m.m[0][0] = matrix.m[0][0] / divisor;
m.m[0][1] = matrix.m[0][1] / divisor;
m.m[0][2] = matrix.m[0][2] / divisor;
@@ -811,6 +735,26 @@ QMatrix4x4 operator/(const QMatrix4x4& matrix, float divisor)
Returns \c true if \a m1 and \a m2 are equal, allowing for a small
fuzziness factor for floating-point comparisons; false otherwise.
*/
+bool qFuzzyCompare(const QMatrix4x4& m1, const QMatrix4x4& m2)
+{
+ return qFuzzyCompare(m1.m[0][0], m2.m[0][0]) &&
+ qFuzzyCompare(m1.m[0][1], m2.m[0][1]) &&
+ qFuzzyCompare(m1.m[0][2], m2.m[0][2]) &&
+ qFuzzyCompare(m1.m[0][3], m2.m[0][3]) &&
+ qFuzzyCompare(m1.m[1][0], m2.m[1][0]) &&
+ qFuzzyCompare(m1.m[1][1], m2.m[1][1]) &&
+ qFuzzyCompare(m1.m[1][2], m2.m[1][2]) &&
+ qFuzzyCompare(m1.m[1][3], m2.m[1][3]) &&
+ qFuzzyCompare(m1.m[2][0], m2.m[2][0]) &&
+ qFuzzyCompare(m1.m[2][1], m2.m[2][1]) &&
+ qFuzzyCompare(m1.m[2][2], m2.m[2][2]) &&
+ qFuzzyCompare(m1.m[2][3], m2.m[2][3]) &&
+ qFuzzyCompare(m1.m[3][0], m2.m[3][0]) &&
+ qFuzzyCompare(m1.m[3][1], m2.m[3][1]) &&
+ qFuzzyCompare(m1.m[3][2], m2.m[3][2]) &&
+ qFuzzyCompare(m1.m[3][3], m2.m[3][3]);
+}
+
#ifndef QT_NO_VECTOR3D
@@ -1196,7 +1140,7 @@ void QMatrix4x4::rotate(float angle, float x, float y, float z)
z = float(double(z) / len);
}
float ic = 1.0f - c;
- QMatrix4x4 rot(1); // The "1" says to not load the identity.
+ QMatrix4x4 rot(Qt::Uninitialized);
rot.m[0][0] = x * x * ic + c;
rot.m[1][0] = x * y * ic - z * s;
rot.m[2][0] = x * z * ic + y * s;
@@ -1220,12 +1164,15 @@ void QMatrix4x4::rotate(float angle, float x, float y, float z)
/*!
\internal
*/
-void QMatrix4x4::projectedRotate(float angle, float x, float y, float z)
+void QMatrix4x4::projectedRotate(float angle, float x, float y, float z, float distanceToPlane)
{
// Used by QGraphicsRotation::applyTo() to perform a rotation
// and projection back to 2D in a single step.
+ if (qIsNull(distanceToPlane))
+ return rotate(angle, x, y, z);
if (angle == 0.0f)
return;
+
float c, s;
if (angle == 90.0f || angle == -270.0f) {
s = 1.0f;
@@ -1241,6 +1188,8 @@ void QMatrix4x4::projectedRotate(float angle, float x, float y, float z)
c = std::cos(a);
s = std::sin(a);
}
+
+ const qreal d = 1.0 / distanceToPlane;
if (x == 0.0f) {
if (y == 0.0f) {
if (z != 0.0f) {
@@ -1264,10 +1213,11 @@ void QMatrix4x4::projectedRotate(float angle, float x, float y, float z)
// Rotate around the Y axis.
if (y < 0)
s = -s;
- m[0][0] = m[0][0] * c + m[3][0] * s * inv_dist_to_plane;
- m[0][1] = m[0][1] * c + m[3][1] * s * inv_dist_to_plane;
- m[0][2] = m[0][2] * c + m[3][2] * s * inv_dist_to_plane;
- m[0][3] = m[0][3] * c + m[3][3] * s * inv_dist_to_plane;
+ s *= d;
+ m[0][0] = m[0][0] * c + m[3][0] * s;
+ m[0][1] = m[0][1] * c + m[3][1] * s;
+ m[0][2] = m[0][2] * c + m[3][2] * s;
+ m[0][3] = m[0][3] * c + m[3][3] * s;
flagBits = General;
return;
}
@@ -1275,10 +1225,11 @@ void QMatrix4x4::projectedRotate(float angle, float x, float y, float z)
// Rotate around the X axis.
if (x < 0)
s = -s;
- m[1][0] = m[1][0] * c - m[3][0] * s * inv_dist_to_plane;
- m[1][1] = m[1][1] * c - m[3][1] * s * inv_dist_to_plane;
- m[1][2] = m[1][2] * c - m[3][2] * s * inv_dist_to_plane;
- m[1][3] = m[1][3] * c - m[3][3] * s * inv_dist_to_plane;
+ s *= d;
+ m[1][0] = m[1][0] * c - m[3][0] * s;
+ m[1][1] = m[1][1] * c - m[3][1] * s;
+ m[1][2] = m[1][2] * c - m[3][2] * s;
+ m[1][3] = m[1][3] * c - m[3][3] * s;
flagBits = General;
return;
}
@@ -1291,8 +1242,8 @@ void QMatrix4x4::projectedRotate(float angle, float x, float y, float z)
y = float(double(y) / len);
z = float(double(z) / len);
}
- float ic = 1.0f - c;
- QMatrix4x4 rot(1); // The "1" says to not load the identity.
+ const float ic = 1.0f - c;
+ QMatrix4x4 rot(Qt::Uninitialized);
rot.m[0][0] = x * x * ic + c;
rot.m[1][0] = x * y * ic - z * s;
rot.m[2][0] = 0.0f;
@@ -1305,14 +1256,41 @@ void QMatrix4x4::projectedRotate(float angle, float x, float y, float z)
rot.m[1][2] = 0.0f;
rot.m[2][2] = 1.0f;
rot.m[3][2] = 0.0f;
- rot.m[0][3] = (x * z * ic - y * s) * -inv_dist_to_plane;
- rot.m[1][3] = (y * z * ic + x * s) * -inv_dist_to_plane;
+ rot.m[0][3] = (x * z * ic - y * s) * -d;
+ rot.m[1][3] = (y * z * ic + x * s) * -d;
rot.m[2][3] = 0.0f;
rot.m[3][3] = 1.0f;
rot.flagBits = General;
*this *= rot;
}
+#if QT_VERSION < QT_VERSION_CHECK(7, 0, 0)
+/*!
+ \internal
+*/
+void QMatrix4x4::projectedRotate(float angle, float x, float y, float z)
+{
+ projectedRotate(angle, x, y, z, 1024.0);
+}
+#endif
+
+/*!
+ \fn int QMatrix4x4::flags() const
+ \internal
+*/
+
+/*!
+ \enum QMatrix4x4::Flags
+ \internal
+ \omitvalue Identity
+ \omitvalue Translation
+ \omitvalue Scale
+ \omitvalue Rotation2D
+ \omitvalue Rotation
+ \omitvalue Perspective
+ \omitvalue General
+*/
+
#ifndef QT_NO_QUATERNION
/*!
@@ -1411,10 +1389,10 @@ void QMatrix4x4::ortho(float left, float right, float bottom, float top, float n
return;
// Construct the projection.
- float width = right - left;
- float invheight = top - bottom;
- float clip = farPlane - nearPlane;
- QMatrix4x4 m(1);
+ const float width = right - left;
+ const float invheight = top - bottom;
+ const float clip = farPlane - nearPlane;
+ QMatrix4x4 m(Qt::Uninitialized);
m.m[0][0] = 2.0f / width;
m.m[1][0] = 0.0f;
m.m[2][0] = 0.0f;
@@ -1452,10 +1430,10 @@ void QMatrix4x4::frustum(float left, float right, float bottom, float top, float
return;
// Construct the projection.
- QMatrix4x4 m(1);
- float width = right - left;
- float invheight = top - bottom;
- float clip = farPlane - nearPlane;
+ QMatrix4x4 m(Qt::Uninitialized);
+ const float width = right - left;
+ const float invheight = top - bottom;
+ const float clip = farPlane - nearPlane;
m.m[0][0] = 2.0f * nearPlane / width;
m.m[1][0] = 0.0f;
m.m[2][0] = (left + right) / width;
@@ -1495,9 +1473,9 @@ void QMatrix4x4::perspective(float verticalAngle, float aspectRatio, float nearP
return;
// Construct the projection.
- QMatrix4x4 m(1);
- float radians = qDegreesToRadians(verticalAngle / 2.0f);
- float sine = std::sin(radians);
+ QMatrix4x4 m(Qt::Uninitialized);
+ const float radians = qDegreesToRadians(verticalAngle / 2.0f);
+ const float sine = std::sin(radians);
if (sine == 0.0f)
return;
float cotan = std::cos(radians) / sine;
@@ -1545,7 +1523,7 @@ void QMatrix4x4::lookAt(const QVector3D& eye, const QVector3D& center, const QVe
QVector3D side = QVector3D::crossProduct(forward, up).normalized();
QVector3D upVector = QVector3D::crossProduct(side, forward);
- QMatrix4x4 m(1);
+ QMatrix4x4 m(Qt::Uninitialized);
m.m[0][0] = side.x();
m.m[1][0] = side.y();
m.m[2][0] = side.z();
@@ -1594,7 +1572,7 @@ void QMatrix4x4::viewport(float left, float bottom, float width, float height, f
const float w2 = width / 2.0f;
const float h2 = height / 2.0f;
- QMatrix4x4 m(1);
+ QMatrix4x4 m(Qt::Uninitialized);
m.m[0][0] = w2;
m.m[1][0] = 0.0f;
m.m[2][0] = 0.0f;
@@ -1620,7 +1598,7 @@ void QMatrix4x4::viewport(float left, float bottom, float width, float height, f
\deprecated
Flips between right-handed and left-handed coordinate systems
- by multiplying the y and z co-ordinates by -1. This is normally
+ by multiplying the y and z coordinates by -1. This is normally
used to create a left-handed orthographic view without scaling
the viewport as ortho() does.
@@ -1660,29 +1638,13 @@ void QMatrix4x4::copyDataTo(float *values) const
}
/*!
- Returns the conventional Qt 2D affine transformation matrix that
- corresponds to this matrix. It is assumed that this matrix
- only contains 2D affine transformation elements.
-
- \sa toTransform()
-*/
-QMatrix QMatrix4x4::toAffine() const
-{
- return QMatrix(m[0][0], m[0][1],
- m[1][0], m[1][1],
- m[3][0], m[3][1]);
-}
-
-/*!
Returns the conventional Qt 2D transformation matrix that
corresponds to this matrix.
The returned QTransform is formed by simply dropping the
third row and third column of the QMatrix4x4. This is suitable
- for implementing orthographic projections where the z co-ordinate
+ for implementing orthographic projections where the z coordinate
should be dropped rather than projected.
-
- \sa toAffine()
*/
QTransform QMatrix4x4::toTransform() const
{
@@ -1696,17 +1658,15 @@ QTransform QMatrix4x4::toTransform() const
corresponds to this matrix.
If \a distanceToPlane is non-zero, it indicates a projection
- factor to use to adjust for the z co-ordinate. The value of
+ factor to use to adjust for the z coordinate. The value of
1024 corresponds to the projection factor used
by QTransform::rotate() for the x and y axes.
If \a distanceToPlane is zero, then the returned QTransform
is formed by simply dropping the third row and third column
of the QMatrix4x4. This is suitable for implementing
- orthographic projections where the z co-ordinate should
+ orthographic projections where the z coordinate should
be dropped rather than projected.
-
- \sa toAffine()
*/
QTransform QMatrix4x4::toTransform(float distanceToPlane) const
{
@@ -1739,6 +1699,7 @@ QTransform QMatrix4x4::toTransform(float distanceToPlane) const
\fn QPoint QMatrix4x4::map(const QPoint& point) const
Maps \a point by multiplying this matrix by \a point.
+ The matrix is applied pre-point.
\sa mapRect()
*/
@@ -1746,7 +1707,8 @@ QTransform QMatrix4x4::toTransform(float distanceToPlane) const
/*!
\fn QPointF QMatrix4x4::map(const QPointF& point) const
- Maps \a point by multiplying this matrix by \a point.
+ Maps \a point by post-multiplying this matrix by \a point.
+ The matrix is applied pre-point.
\sa mapRect()
*/
@@ -1756,7 +1718,12 @@ QTransform QMatrix4x4::toTransform(float distanceToPlane) const
/*!
\fn QVector3D QMatrix4x4::map(const QVector3D& point) const
- Maps \a point by multiplying this matrix by \a point.
+ Maps \a point by multiplying this matrix by \a point extended to a 4D
+ vector by assuming 1.0 for the w coordinate. The matrix is applied
+ pre-point.
+
+ \note This function is not the same as mapVector(). For points, always use
+ map(). mapVector() is suitable for vectors (directions) only.
\sa mapRect(), mapVector()
*/
@@ -1766,7 +1733,7 @@ QTransform QMatrix4x4::toTransform(float distanceToPlane) const
Maps \a vector by multiplying the top 3x3 portion of this matrix
by \a vector. The translation and projection components of
- this matrix are ignored.
+ this matrix are ignored. The matrix is applied pre-vector.
\sa map()
*/
@@ -1779,6 +1746,7 @@ QTransform QMatrix4x4::toTransform(float distanceToPlane) const
\fn QVector4D QMatrix4x4::map(const QVector4D& point) const;
Maps \a point by multiplying this matrix by \a point.
+ The matrix is applied pre-point.
\sa mapRect()
*/
@@ -1902,7 +1870,7 @@ QRectF QMatrix4x4::mapRect(const QRectF& rect) const
// of just rotations and translations.
QMatrix4x4 QMatrix4x4::orthonormalInverse() const
{
- QMatrix4x4 result(1); // The '1' says not to load identity
+ QMatrix4x4 result(Qt::Uninitialized);
result.m[0][0] = m[0][0];
result.m[1][0] = m[0][1];
@@ -1940,15 +1908,15 @@ QMatrix4x4 QMatrix4x4::orthonormalInverse() const
Normally the QMatrix4x4 class keeps track of this special type internally
as operations are performed. However, if the matrix is modified
- directly with {QLoggingCategory::operator()}{operator()()} or data(), then QMatrix4x4 will lose track of
- the special type and will revert to the safest but least efficient
- operations thereafter.
+ directly with operator()(int, int) or data(), then QMatrix4x4 will
+ lose track of the special type and will revert to the safest but least
+ efficient operations thereafter.
By calling optimize() after directly modifying the matrix,
the programmer can force QMatrix4x4 to recover the special type if
the elements appear to conform to one of the known optimized types.
- \sa {QLoggingCategory::operator()}{operator()()}, data(), translate()
+ \sa operator()(int, int), data(), translate()
*/
void QMatrix4x4::optimize()
{
@@ -2007,7 +1975,7 @@ void QMatrix4x4::optimize()
*/
QMatrix4x4::operator QVariant() const
{
- return QVariant(QVariant::Matrix4x4, this);
+ return QVariant::fromValue(*this);
}
#ifndef QT_NO_DEBUG_STREAM
@@ -2032,8 +2000,7 @@ QDebug operator<<(QDebug dbg, const QMatrix4x4 &m)
bits += "Rotation,";
if ((m.flagBits & QMatrix4x4::Perspective) != 0)
bits += "Perspective,";
- if (bits.size() > 0)
- bits = bits.left(bits.size() - 1);
+ bits.chop(1);
}
// Output in row-major order because it is more human-readable.
diff --git a/src/gui/math3d/qmatrix4x4.h b/src/gui/math3d/qmatrix4x4.h
index 1439bfac59..f8e5bc4314 100644
--- a/src/gui/math3d/qmatrix4x4.h
+++ b/src/gui/math3d/qmatrix4x4.h
@@ -1,41 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the QtGui module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#ifndef QMATRIX4X4_H
#define QMATRIX4X4_H
@@ -47,12 +11,13 @@
#include <QtGui/qgenericmatrix.h>
#include <QtCore/qrect.h>
+class tst_QMatrixNxN;
+
QT_BEGIN_NAMESPACE
#ifndef QT_NO_MATRIX4X4
-class QMatrix;
class QTransform;
class QVariant;
@@ -72,7 +37,6 @@ public:
QMatrix4x4(const float *values, int cols, int rows);
QMatrix4x4(const QTransform& transform);
- QMatrix4x4(const QMatrix& matrix);
inline const float& operator()(int row, int column) const;
inline float& operator()(int row, int column);
@@ -109,9 +73,11 @@ public:
friend QMatrix4x4 operator-(const QMatrix4x4& m1, const QMatrix4x4& m2);
friend QMatrix4x4 operator*(const QMatrix4x4& m1, const QMatrix4x4& m2);
#ifndef QT_NO_VECTOR3D
+#if QT_DEPRECATED_SINCE(6, 1)
friend QVector3D operator*(const QMatrix4x4& matrix, const QVector3D& vector);
friend QVector3D operator*(const QVector3D& vector, const QMatrix4x4& matrix);
#endif
+#endif
#ifndef QT_NO_VECTOR4D
friend QVector4D operator*(const QVector4D& vector, const QMatrix4x4& matrix);
friend QVector4D operator*(const QMatrix4x4& matrix, const QVector4D& vector);
@@ -119,13 +85,15 @@ public:
friend QPoint operator*(const QPoint& point, const QMatrix4x4& matrix);
friend QPointF operator*(const QPointF& point, const QMatrix4x4& matrix);
friend QMatrix4x4 operator-(const QMatrix4x4& matrix);
+#if QT_DEPRECATED_SINCE(6, 1)
friend QPoint operator*(const QMatrix4x4& matrix, const QPoint& point);
friend QPointF operator*(const QMatrix4x4& matrix, const QPointF& point);
+#endif
friend QMatrix4x4 operator*(float factor, const QMatrix4x4& matrix);
friend QMatrix4x4 operator*(const QMatrix4x4& matrix, float factor);
friend Q_GUI_EXPORT QMatrix4x4 operator/(const QMatrix4x4& matrix, float divisor);
- friend inline bool qFuzzyCompare(const QMatrix4x4& m1, const QMatrix4x4& m2);
+ friend Q_GUI_EXPORT bool qFuzzyCompare(const QMatrix4x4& m1, const QMatrix4x4& m2);
#ifndef QT_NO_VECTOR3D
void scale(const QVector3D& vector);
@@ -156,18 +124,17 @@ public:
void copyDataTo(float *values) const;
- QMatrix toAffine() const;
QTransform toTransform() const;
QTransform toTransform(float distanceToPlane) const;
- QPoint map(const QPoint& point) const;
- QPointF map(const QPointF& point) const;
+ inline QPoint map(const QPoint& point) const;
+ inline QPointF map(const QPointF& point) const;
#ifndef QT_NO_VECTOR3D
- QVector3D map(const QVector3D& point) const;
- QVector3D mapVector(const QVector3D& vector) const;
+ inline QVector3D map(const QVector3D& point) const;
+ inline QVector3D mapVector(const QVector3D& vector) const;
#endif
#ifndef QT_NO_VECTOR4D
- QVector4D map(const QVector4D& point) const;
+ inline QVector4D map(const QVector4D& point) const;
#endif
QRect mapRect(const QRect& rect) const;
QRectF mapRect(const QRectF& rect) const;
@@ -187,12 +154,17 @@ public:
friend Q_GUI_EXPORT QDebug operator<<(QDebug dbg, const QMatrix4x4 &m);
#endif
-private:
- float m[4][4]; // Column-major order to match OpenGL.
- int flagBits; // Flag bits from the enum below.
+#if QT_VERSION < QT_VERSION_CHECK(7, 0, 0)
+ void projectedRotate(float angle, float x, float y, float z, float distanceToPlane);
+ // ### Qt7: Remove
+ void projectedRotate(float angle, float x, float y, float z);
+#else
+ void projectedRotate(float angle, float x, float y, float z, float distanceToPlane = 1024.0);
+#endif
// When matrices are multiplied, the flag bits are or-ed together.
- enum {
+ // Note that the ordering of the bit values matters. (ident < t < s < r2d < r < p)
+ enum Flag {
Identity = 0x0000, // Identity matrix
Translation = 0x0001, // Contains a translation
Scale = 0x0002, // Contains a scale
@@ -201,22 +173,25 @@ private:
Perspective = 0x0010, // Last row is different from (0, 0, 0, 1)
General = 0x001f // General matrix, unknown contents
};
+ Q_DECLARE_FLAGS(Flags, Flag)
- // Construct without initializing identity matrix.
- explicit QMatrix4x4(int) { }
+ Flags flags() const { return flagBits; }
- QMatrix4x4 orthonormalInverse() const;
+private:
+ float m[4][4]; // Column-major order to match OpenGL.
+ Flags flagBits;
- void projectedRotate(float angle, float x, float y, float z);
+ QMatrix4x4 orthonormalInverse() const;
- friend class QGraphicsRotation;
+ friend class ::tst_QMatrixNxN; // for access to flagBits
};
+Q_DECLARE_OPERATORS_FOR_FLAGS(QMatrix4x4::Flags)
+
QT_WARNING_PUSH
-QT_WARNING_DISABLE_CLANG("-Wfloat-equal")
-QT_WARNING_DISABLE_GCC("-Wfloat-equal")
-QT_WARNING_DISABLE_INTEL(1572)
-Q_DECLARE_TYPEINFO(QMatrix4x4, Q_MOVABLE_TYPE);
+QT_WARNING_DISABLE_FLOAT_COMPARE
+
+Q_DECLARE_TYPEINFO(QMatrix4x4, Q_PRIMITIVE_TYPE);
inline QMatrix4x4::QMatrix4x4
(float m11, float m12, float m13, float m14,
@@ -429,7 +404,7 @@ inline QMatrix4x4& QMatrix4x4::operator*=(const QMatrix4x4& o)
const QMatrix4x4 other = o; // prevent aliasing when &o == this ### Qt 6: take o by value
flagBits |= other.flagBits;
- if (flagBits < Rotation2D) {
+ if (flagBits.toInt() < Rotation2D) {
m[3][0] += m[0][0] * other.m[3][0];
m[3][1] += m[1][1] * other.m[3][1];
m[3][2] += m[2][2] * other.m[3][2];
@@ -587,7 +562,7 @@ inline bool QMatrix4x4::operator!=(const QMatrix4x4& other) const
inline QMatrix4x4 operator+(const QMatrix4x4& m1, const QMatrix4x4& m2)
{
- QMatrix4x4 m(1);
+ QMatrix4x4 m(Qt::Uninitialized);
m.m[0][0] = m1.m[0][0] + m2.m[0][0];
m.m[0][1] = m1.m[0][1] + m2.m[0][1];
m.m[0][2] = m1.m[0][2] + m2.m[0][2];
@@ -604,13 +579,12 @@ inline QMatrix4x4 operator+(const QMatrix4x4& m1, const QMatrix4x4& m2)
m.m[3][1] = m1.m[3][1] + m2.m[3][1];
m.m[3][2] = m1.m[3][2] + m2.m[3][2];
m.m[3][3] = m1.m[3][3] + m2.m[3][3];
- m.flagBits = QMatrix4x4::General;
return m;
}
inline QMatrix4x4 operator-(const QMatrix4x4& m1, const QMatrix4x4& m2)
{
- QMatrix4x4 m(1);
+ QMatrix4x4 m(Qt::Uninitialized);
m.m[0][0] = m1.m[0][0] - m2.m[0][0];
m.m[0][1] = m1.m[0][1] - m2.m[0][1];
m.m[0][2] = m1.m[0][2] - m2.m[0][2];
@@ -627,14 +601,13 @@ inline QMatrix4x4 operator-(const QMatrix4x4& m1, const QMatrix4x4& m2)
m.m[3][1] = m1.m[3][1] - m2.m[3][1];
m.m[3][2] = m1.m[3][2] - m2.m[3][2];
m.m[3][3] = m1.m[3][3] - m2.m[3][3];
- m.flagBits = QMatrix4x4::General;
return m;
}
inline QMatrix4x4 operator*(const QMatrix4x4& m1, const QMatrix4x4& m2)
{
- int flagBits = m1.flagBits | m2.flagBits;
- if (flagBits < QMatrix4x4::Rotation2D) {
+ QMatrix4x4::Flags flagBits = m1.flagBits | m2.flagBits;
+ if (flagBits.toInt() < QMatrix4x4::Rotation2D) {
QMatrix4x4 m = m1;
m.m[3][0] += m.m[0][0] * m2.m[3][0];
m.m[3][1] += m.m[1][1] * m2.m[3][1];
@@ -647,7 +620,7 @@ inline QMatrix4x4 operator*(const QMatrix4x4& m1, const QMatrix4x4& m2)
return m;
}
- QMatrix4x4 m(1);
+ QMatrix4x4 m(Qt::Uninitialized);
m.m[0][0] = m1.m[0][0] * m2.m[0][0]
+ m1.m[1][0] * m2.m[0][1]
+ m1.m[2][0] * m2.m[0][2]
@@ -721,6 +694,9 @@ inline QMatrix4x4 operator*(const QMatrix4x4& m1, const QMatrix4x4& m2)
#ifndef QT_NO_VECTOR3D
+#if QT_DEPRECATED_SINCE(6, 1)
+
+QT_DEPRECATED_VERSION_X_6_1("Extend the QVector3D to a QVector4D with 1.0 as the w coordinate before multiplying")
inline QVector3D operator*(const QVector3D& vector, const QMatrix4x4& matrix)
{
float x, y, z, w;
@@ -746,47 +722,16 @@ inline QVector3D operator*(const QVector3D& vector, const QMatrix4x4& matrix)
return QVector3D(x / w, y / w, z / w);
}
+QT_DEPRECATED_VERSION_X_6_1("Use matrix.map(vector) instead")
inline QVector3D operator*(const QMatrix4x4& matrix, const QVector3D& vector)
{
- float x, y, z, w;
- if (matrix.flagBits == QMatrix4x4::Identity) {
- return vector;
- } else if (matrix.flagBits < QMatrix4x4::Rotation2D) {
- // Translation | Scale
- return QVector3D(vector.x() * matrix.m[0][0] + matrix.m[3][0],
- vector.y() * matrix.m[1][1] + matrix.m[3][1],
- vector.z() * matrix.m[2][2] + matrix.m[3][2]);
- } else if (matrix.flagBits < QMatrix4x4::Rotation) {
- // Translation | Scale | Rotation2D
- return QVector3D(vector.x() * matrix.m[0][0] + vector.y() * matrix.m[1][0] + matrix.m[3][0],
- vector.x() * matrix.m[0][1] + vector.y() * matrix.m[1][1] + matrix.m[3][1],
- vector.z() * matrix.m[2][2] + matrix.m[3][2]);
- } else {
- x = vector.x() * matrix.m[0][0] +
- vector.y() * matrix.m[1][0] +
- vector.z() * matrix.m[2][0] +
- matrix.m[3][0];
- y = vector.x() * matrix.m[0][1] +
- vector.y() * matrix.m[1][1] +
- vector.z() * matrix.m[2][1] +
- matrix.m[3][1];
- z = vector.x() * matrix.m[0][2] +
- vector.y() * matrix.m[1][2] +
- vector.z() * matrix.m[2][2] +
- matrix.m[3][2];
- w = vector.x() * matrix.m[0][3] +
- vector.y() * matrix.m[1][3] +
- vector.z() * matrix.m[2][3] +
- matrix.m[3][3];
- if (w == 1.0f)
- return QVector3D(x, y, z);
- else
- return QVector3D(x / w, y / w, z / w);
- }
+ return matrix.map(vector);
}
#endif
+#endif
+
#ifndef QT_NO_VECTOR4D
inline QVector4D operator*(const QVector4D& vector, const QMatrix4x4& matrix)
@@ -878,76 +823,25 @@ inline QPointF operator*(const QPointF& point, const QMatrix4x4& matrix)
}
}
+#if QT_DEPRECATED_SINCE(6, 1)
+
+QT_DEPRECATED_VERSION_X_6_1("Use matrix.map(point) instead")
inline QPoint operator*(const QMatrix4x4& matrix, const QPoint& point)
{
- float xin, yin;
- float x, y, w;
- xin = point.x();
- yin = point.y();
- if (matrix.flagBits == QMatrix4x4::Identity) {
- return point;
- } else if (matrix.flagBits < QMatrix4x4::Rotation2D) {
- // Translation | Scale
- return QPoint(qRound(xin * matrix.m[0][0] + matrix.m[3][0]),
- qRound(yin * matrix.m[1][1] + matrix.m[3][1]));
- } else if (matrix.flagBits < QMatrix4x4::Perspective) {
- return QPoint(qRound(xin * matrix.m[0][0] + yin * matrix.m[1][0] + matrix.m[3][0]),
- qRound(xin * matrix.m[0][1] + yin * matrix.m[1][1] + matrix.m[3][1]));
- } else {
- x = xin * matrix.m[0][0] +
- yin * matrix.m[1][0] +
- matrix.m[3][0];
- y = xin * matrix.m[0][1] +
- yin * matrix.m[1][1] +
- matrix.m[3][1];
- w = xin * matrix.m[0][3] +
- yin * matrix.m[1][3] +
- matrix.m[3][3];
- if (w == 1.0f)
- return QPoint(qRound(x), qRound(y));
- else
- return QPoint(qRound(x / w), qRound(y / w));
- }
+ return matrix.map(point);
}
+QT_DEPRECATED_VERSION_X_6_1("Use matrix.map(point) instead")
inline QPointF operator*(const QMatrix4x4& matrix, const QPointF& point)
{
- qreal xin, yin;
- qreal x, y, w;
- xin = point.x();
- yin = point.y();
- if (matrix.flagBits == QMatrix4x4::Identity) {
- return point;
- } else if (matrix.flagBits < QMatrix4x4::Rotation2D) {
- // Translation | Scale
- return QPointF(xin * qreal(matrix.m[0][0]) + qreal(matrix.m[3][0]),
- yin * qreal(matrix.m[1][1]) + qreal(matrix.m[3][1]));
- } else if (matrix.flagBits < QMatrix4x4::Perspective) {
- return QPointF(xin * qreal(matrix.m[0][0]) + yin * qreal(matrix.m[1][0]) +
- qreal(matrix.m[3][0]),
- xin * qreal(matrix.m[0][1]) + yin * qreal(matrix.m[1][1]) +
- qreal(matrix.m[3][1]));
- } else {
- x = xin * qreal(matrix.m[0][0]) +
- yin * qreal(matrix.m[1][0]) +
- qreal(matrix.m[3][0]);
- y = xin * qreal(matrix.m[0][1]) +
- yin * qreal(matrix.m[1][1]) +
- qreal(matrix.m[3][1]);
- w = xin * qreal(matrix.m[0][3]) +
- yin * qreal(matrix.m[1][3]) +
- qreal(matrix.m[3][3]);
- if (w == 1.0) {
- return QPointF(qreal(x), qreal(y));
- } else {
- return QPointF(qreal(x / w), qreal(y / w));
- }
- }
+ return matrix.map(point);
}
+#endif
+
inline QMatrix4x4 operator-(const QMatrix4x4& matrix)
{
- QMatrix4x4 m(1);
+ QMatrix4x4 m(Qt::Uninitialized);
m.m[0][0] = -matrix.m[0][0];
m.m[0][1] = -matrix.m[0][1];
m.m[0][2] = -matrix.m[0][2];
@@ -964,13 +858,12 @@ inline QMatrix4x4 operator-(const QMatrix4x4& matrix)
m.m[3][1] = -matrix.m[3][1];
m.m[3][2] = -matrix.m[3][2];
m.m[3][3] = -matrix.m[3][3];
- m.flagBits = QMatrix4x4::General;
return m;
}
inline QMatrix4x4 operator*(float factor, const QMatrix4x4& matrix)
{
- QMatrix4x4 m(1);
+ QMatrix4x4 m(Qt::Uninitialized);
m.m[0][0] = matrix.m[0][0] * factor;
m.m[0][1] = matrix.m[0][1] * factor;
m.m[0][2] = matrix.m[0][2] * factor;
@@ -987,13 +880,12 @@ inline QMatrix4x4 operator*(float factor, const QMatrix4x4& matrix)
m.m[3][1] = matrix.m[3][1] * factor;
m.m[3][2] = matrix.m[3][2] * factor;
m.m[3][3] = matrix.m[3][3] * factor;
- m.flagBits = QMatrix4x4::General;
return m;
}
inline QMatrix4x4 operator*(const QMatrix4x4& matrix, float factor)
{
- QMatrix4x4 m(1);
+ QMatrix4x4 m(Qt::Uninitialized);
m.m[0][0] = matrix.m[0][0] * factor;
m.m[0][1] = matrix.m[0][1] * factor;
m.m[0][2] = matrix.m[0][2] * factor;
@@ -1010,53 +902,123 @@ inline QMatrix4x4 operator*(const QMatrix4x4& matrix, float factor)
m.m[3][1] = matrix.m[3][1] * factor;
m.m[3][2] = matrix.m[3][2] * factor;
m.m[3][3] = matrix.m[3][3] * factor;
- m.flagBits = QMatrix4x4::General;
return m;
}
-inline bool qFuzzyCompare(const QMatrix4x4& m1, const QMatrix4x4& m2)
-{
- return qFuzzyCompare(m1.m[0][0], m2.m[0][0]) &&
- qFuzzyCompare(m1.m[0][1], m2.m[0][1]) &&
- qFuzzyCompare(m1.m[0][2], m2.m[0][2]) &&
- qFuzzyCompare(m1.m[0][3], m2.m[0][3]) &&
- qFuzzyCompare(m1.m[1][0], m2.m[1][0]) &&
- qFuzzyCompare(m1.m[1][1], m2.m[1][1]) &&
- qFuzzyCompare(m1.m[1][2], m2.m[1][2]) &&
- qFuzzyCompare(m1.m[1][3], m2.m[1][3]) &&
- qFuzzyCompare(m1.m[2][0], m2.m[2][0]) &&
- qFuzzyCompare(m1.m[2][1], m2.m[2][1]) &&
- qFuzzyCompare(m1.m[2][2], m2.m[2][2]) &&
- qFuzzyCompare(m1.m[2][3], m2.m[2][3]) &&
- qFuzzyCompare(m1.m[3][0], m2.m[3][0]) &&
- qFuzzyCompare(m1.m[3][1], m2.m[3][1]) &&
- qFuzzyCompare(m1.m[3][2], m2.m[3][2]) &&
- qFuzzyCompare(m1.m[3][3], m2.m[3][3]);
-}
-
inline QPoint QMatrix4x4::map(const QPoint& point) const
{
- return *this * point;
+ float xin, yin;
+ float x, y, w;
+ xin = point.x();
+ yin = point.y();
+ if (flagBits == QMatrix4x4::Identity) {
+ return point;
+ } else if (flagBits.toInt() < QMatrix4x4::Rotation2D) {
+ // Translation | Scale
+ return QPoint(qRound(xin * m[0][0] + m[3][0]),
+ qRound(yin * m[1][1] + m[3][1]));
+ } else if (flagBits.toInt() < QMatrix4x4::Perspective) {
+ return QPoint(qRound(xin * m[0][0] + yin * m[1][0] + m[3][0]),
+ qRound(xin * m[0][1] + yin * m[1][1] + m[3][1]));
+ } else {
+ x = xin * m[0][0] +
+ yin * m[1][0] +
+ m[3][0];
+ y = xin * m[0][1] +
+ yin * m[1][1] +
+ m[3][1];
+ w = xin * m[0][3] +
+ yin * m[1][3] +
+ m[3][3];
+ if (w == 1.0f)
+ return QPoint(qRound(x), qRound(y));
+ else
+ return QPoint(qRound(x / w), qRound(y / w));
+ }
}
inline QPointF QMatrix4x4::map(const QPointF& point) const
{
- return *this * point;
+ qreal xin, yin;
+ qreal x, y, w;
+ xin = point.x();
+ yin = point.y();
+ if (flagBits == QMatrix4x4::Identity) {
+ return point;
+ } else if (flagBits.toInt() < QMatrix4x4::Rotation2D) {
+ // Translation | Scale
+ return QPointF(xin * qreal(m[0][0]) + qreal(m[3][0]),
+ yin * qreal(m[1][1]) + qreal(m[3][1]));
+ } else if (flagBits.toInt() < QMatrix4x4::Perspective) {
+ return QPointF(xin * qreal(m[0][0]) + yin * qreal(m[1][0]) +
+ qreal(m[3][0]),
+ xin * qreal(m[0][1]) + yin * qreal(m[1][1]) +
+ qreal(m[3][1]));
+ } else {
+ x = xin * qreal(m[0][0]) +
+ yin * qreal(m[1][0]) +
+ qreal(m[3][0]);
+ y = xin * qreal(m[0][1]) +
+ yin * qreal(m[1][1]) +
+ qreal(m[3][1]);
+ w = xin * qreal(m[0][3]) +
+ yin * qreal(m[1][3]) +
+ qreal(m[3][3]);
+ if (w == 1.0) {
+ return QPointF(qreal(x), qreal(y));
+ } else {
+ return QPointF(qreal(x / w), qreal(y / w));
+ }
+ }
}
#ifndef QT_NO_VECTOR3D
inline QVector3D QMatrix4x4::map(const QVector3D& point) const
{
- return *this * point;
+ float x, y, z, w;
+ if (flagBits == QMatrix4x4::Identity) {
+ return point;
+ } else if (flagBits.toInt() < QMatrix4x4::Rotation2D) {
+ // Translation | Scale
+ return QVector3D(point.x() * m[0][0] + m[3][0],
+ point.y() * m[1][1] + m[3][1],
+ point.z() * m[2][2] + m[3][2]);
+ } else if (flagBits.toInt() < QMatrix4x4::Rotation) {
+ // Translation | Scale | Rotation2D
+ return QVector3D(point.x() * m[0][0] + point.y() * m[1][0] + m[3][0],
+ point.x() * m[0][1] + point.y() * m[1][1] + m[3][1],
+ point.z() * m[2][2] + m[3][2]);
+ } else {
+ x = point.x() * m[0][0] +
+ point.y() * m[1][0] +
+ point.z() * m[2][0] +
+ m[3][0];
+ y = point.x() * m[0][1] +
+ point.y() * m[1][1] +
+ point.z() * m[2][1] +
+ m[3][1];
+ z = point.x() * m[0][2] +
+ point.y() * m[1][2] +
+ point.z() * m[2][2] +
+ m[3][2];
+ w = point.x() * m[0][3] +
+ point.y() * m[1][3] +
+ point.z() * m[2][3] +
+ m[3][3];
+ if (w == 1.0f)
+ return QVector3D(x, y, z);
+ else
+ return QVector3D(x / w, y / w, z / w);
+ }
}
inline QVector3D QMatrix4x4::mapVector(const QVector3D& vector) const
{
- if (flagBits < Scale) {
+ if (flagBits.toInt() < Scale) {
// Translation
return vector;
- } else if (flagBits < Rotation2D) {
+ } else if (flagBits.toInt() < Rotation2D) {
// Translation | Scale
return QVector3D(vector.x() * m[0][0],
vector.y() * m[1][1],
@@ -1109,33 +1071,6 @@ Q_GUI_EXPORT QDataStream &operator<<(QDataStream &, const QMatrix4x4 &);
Q_GUI_EXPORT QDataStream &operator>>(QDataStream &, QMatrix4x4 &);
#endif
-#if QT_DEPRECATED_SINCE(5, 0)
-template <int N, int M>
-QT_DEPRECATED QMatrix4x4 qGenericMatrixToMatrix4x4(const QGenericMatrix<N, M, float>& matrix)
-{
- return QMatrix4x4(matrix.constData(), N, M);
-}
-
-template <int N, int M>
-QT_DEPRECATED QGenericMatrix<N, M, float> qGenericMatrixFromMatrix4x4(const QMatrix4x4& matrix)
-{
- QGenericMatrix<N, M, float> result;
- const float *m = matrix.constData();
- float *values = result.data();
- for (int col = 0; col < N; ++col) {
- for (int row = 0; row < M; ++row) {
- if (col < 4 && row < 4)
- values[col * M + row] = m[col * 4 + row];
- else if (col == row)
- values[col * M + row] = 1.0f;
- else
- values[col * M + row] = 0.0f;
- }
- }
- return result;
-}
-#endif
-
#endif
QT_END_NAMESPACE
diff --git a/src/gui/math3d/qquaternion.cpp b/src/gui/math3d/qquaternion.cpp
index 899ec12eb3..e7c5945208 100644
--- a/src/gui/math3d/qquaternion.cpp
+++ b/src/gui/math3d/qquaternion.cpp
@@ -1,41 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the QtGui module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2020 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#include "qquaternion.h"
#include <QtCore/qdatastream.h>
@@ -62,14 +26,14 @@ QT_BEGIN_NAMESPACE
*/
/*!
- \fn QQuaternion::QQuaternion()
+ \fn QQuaternion::QQuaternion() noexcept
Constructs an identity quaternion (1, 0, 0, 0), i.e. with the vector (0, 0, 0)
and scalar 1.
*/
/*!
- \fn QQuaternion::QQuaternion(Qt::Initialization)
+ \fn QQuaternion::QQuaternion(Qt::Initialization) noexcept
\since 5.5
\internal
@@ -77,7 +41,7 @@ QT_BEGIN_NAMESPACE
*/
/*!
- \fn QQuaternion::QQuaternion(float scalar, float xpos, float ypos, float zpos)
+ \fn QQuaternion::QQuaternion(float scalar, float xpos, float ypos, float zpos) noexcept
Constructs a quaternion with the vector (\a xpos, \a ypos, \a zpos)
and \a scalar.
@@ -86,7 +50,7 @@ QT_BEGIN_NAMESPACE
#ifndef QT_NO_VECTOR3D
/*!
- \fn QQuaternion::QQuaternion(float scalar, const QVector3D& vector)
+ \fn QQuaternion::QQuaternion(float scalar, const QVector3D &vector) noexcept
Constructs a quaternion vector from the specified \a vector and
\a scalar.
@@ -95,7 +59,7 @@ QT_BEGIN_NAMESPACE
*/
/*!
- \fn QVector3D QQuaternion::vector() const
+ \fn QVector3D QQuaternion::vector() const noexcept
Returns the vector component of this quaternion.
@@ -103,7 +67,7 @@ QT_BEGIN_NAMESPACE
*/
/*!
- \fn void QQuaternion::setVector(const QVector3D& vector)
+ \fn void QQuaternion::setVector(const QVector3D &vector) noexcept
Sets the vector component of this quaternion to \a vector.
@@ -113,7 +77,7 @@ QT_BEGIN_NAMESPACE
#endif
/*!
- \fn void QQuaternion::setVector(float x, float y, float z)
+ \fn void QQuaternion::setVector(float x, float y, float z) noexcept
Sets the vector component of this quaternion to (\a x, \a y, \a z).
@@ -123,13 +87,13 @@ QT_BEGIN_NAMESPACE
#ifndef QT_NO_VECTOR4D
/*!
- \fn QQuaternion::QQuaternion(const QVector4D& vector)
+ \fn QQuaternion::QQuaternion(const QVector4D &vector) noexcept
Constructs a quaternion from the components of \a vector.
*/
/*!
- \fn QVector4D QQuaternion::toVector4D() const
+ \fn QVector4D QQuaternion::toVector4D() const noexcept
Returns this quaternion as a 4D vector.
*/
@@ -137,14 +101,14 @@ QT_BEGIN_NAMESPACE
#endif
/*!
- \fn bool QQuaternion::isNull() const
+ \fn bool QQuaternion::isNull() const noexcept
Returns \c true if the x, y, z, and scalar components of this
quaternion are set to 0.0; otherwise returns \c false.
*/
/*!
- \fn bool QQuaternion::isIdentity() const
+ \fn bool QQuaternion::isIdentity() const noexcept
Returns \c true if the x, y, and z components of this
quaternion are set to 0.0, and the scalar component is set
@@ -152,7 +116,7 @@ QT_BEGIN_NAMESPACE
*/
/*!
- \fn float QQuaternion::x() const
+ \fn float QQuaternion::x() const noexcept
Returns the x coordinate of this quaternion's vector.
@@ -160,7 +124,7 @@ QT_BEGIN_NAMESPACE
*/
/*!
- \fn float QQuaternion::y() const
+ \fn float QQuaternion::y() const noexcept
Returns the y coordinate of this quaternion's vector.
@@ -168,7 +132,7 @@ QT_BEGIN_NAMESPACE
*/
/*!
- \fn float QQuaternion::z() const
+ \fn float QQuaternion::z() const noexcept
Returns the z coordinate of this quaternion's vector.
@@ -176,7 +140,7 @@ QT_BEGIN_NAMESPACE
*/
/*!
- \fn float QQuaternion::scalar() const
+ \fn float QQuaternion::scalar() const noexcept
Returns the scalar component of this quaternion.
@@ -184,7 +148,7 @@ QT_BEGIN_NAMESPACE
*/
/*!
- \fn void QQuaternion::setX(float x)
+ \fn void QQuaternion::setX(float x) noexcept
Sets the x coordinate of this quaternion's vector to the given
\a x coordinate.
@@ -193,7 +157,7 @@ QT_BEGIN_NAMESPACE
*/
/*!
- \fn void QQuaternion::setY(float y)
+ \fn void QQuaternion::setY(float y) noexcept
Sets the y coordinate of this quaternion's vector to the given
\a y coordinate.
@@ -202,7 +166,7 @@ QT_BEGIN_NAMESPACE
*/
/*!
- \fn void QQuaternion::setZ(float z)
+ \fn void QQuaternion::setZ(float z) noexcept
Sets the z coordinate of this quaternion's vector to the given
\a z coordinate.
@@ -211,7 +175,7 @@ QT_BEGIN_NAMESPACE
*/
/*!
- \fn void QQuaternion::setScalar(float scalar)
+ \fn void QQuaternion::setScalar(float scalar) noexcept
Sets the scalar component of this quaternion to \a scalar.
@@ -219,7 +183,7 @@ QT_BEGIN_NAMESPACE
*/
/*!
- \fn float QQuaternion::dotProduct(const QQuaternion &q1, const QQuaternion &q2)
+ \fn float QQuaternion::dotProduct(const QQuaternion &q1, const QQuaternion &q2) noexcept
\since 5.5
Returns the dot product of \a q1 and \a q2.
@@ -234,12 +198,15 @@ QT_BEGIN_NAMESPACE
*/
float QQuaternion::length() const
{
- return std::sqrt(xp * xp + yp * yp + zp * zp + wp * wp);
+ return qHypot(xp, yp, zp, wp);
}
/*!
Returns the squared length of the quaternion.
+ \note Though cheap to compute, this is susceptible to overflow and underflow
+ that length() avoids in many cases.
+
\sa length(), dotProduct()
*/
float QQuaternion::lengthSquared() const
@@ -259,17 +226,10 @@ float QQuaternion::lengthSquared() const
*/
QQuaternion QQuaternion::normalized() const
{
- // Need some extra precision if the length is very small.
- double len = double(xp) * double(xp) +
- double(yp) * double(yp) +
- double(zp) * double(zp) +
- double(wp) * double(wp);
- if (qFuzzyIsNull(len - 1.0f))
- return *this;
- else if (!qFuzzyIsNull(len))
- return *this / std::sqrt(len);
- else
+ const float scale = length();
+ if (qFuzzyIsNull(scale))
return QQuaternion(0.0f, 0.0f, 0.0f, 0.0f);
+ return *this / scale;
}
/*!
@@ -280,16 +240,10 @@ QQuaternion QQuaternion::normalized() const
*/
void QQuaternion::normalize()
{
- // Need some extra precision if the length is very small.
- double len = double(xp) * double(xp) +
- double(yp) * double(yp) +
- double(zp) * double(zp) +
- double(wp) * double(wp);
- if (qFuzzyIsNull(len - 1.0f) || qFuzzyIsNull(len))
+ const float len = length();
+ if (qFuzzyIsNull(len))
return;
- len = std::sqrt(len);
-
xp /= len;
yp /= len;
zp /= len;
@@ -297,7 +251,7 @@ void QQuaternion::normalize()
}
/*!
- \fn QQuaternion QQuaternion::inverted() const
+ \fn QQuaternion QQuaternion::inverted() const noexcept
\since 5.5
Returns the inverse of this quaternion.
@@ -307,7 +261,7 @@ void QQuaternion::normalize()
*/
/*!
- \fn QQuaternion QQuaternion::conjugated() const
+ \fn QQuaternion QQuaternion::conjugated() const noexcept
\since 5.5
Returns the conjugate of this quaternion, which is
@@ -315,13 +269,6 @@ void QQuaternion::normalize()
*/
/*!
- \fn QQuaternion QQuaternion::conjugate() const
- \obsolete
-
- Use conjugated() instead.
-*/
-
-/*!
Rotates \a vector with this quaternion to produce a new vector
in 3D space. The following code:
@@ -331,13 +278,13 @@ void QQuaternion::normalize()
\snippet code/src_gui_math3d_qquaternion.cpp 1
*/
-QVector3D QQuaternion::rotatedVector(const QVector3D& vector) const
+QVector3D QQuaternion::rotatedVector(const QVector3D &vector) const
{
return (*this * QQuaternion(0, vector) * conjugated()).vector();
}
/*!
- \fn QQuaternion &QQuaternion::operator+=(const QQuaternion &quaternion)
+ \fn QQuaternion &QQuaternion::operator+=(const QQuaternion &quaternion) noexcept
Adds the given \a quaternion to this quaternion and returns a reference to
this quaternion.
@@ -346,7 +293,7 @@ QVector3D QQuaternion::rotatedVector(const QVector3D& vector) const
*/
/*!
- \fn QQuaternion &QQuaternion::operator-=(const QQuaternion &quaternion)
+ \fn QQuaternion &QQuaternion::operator-=(const QQuaternion &quaternion) noexcept
Subtracts the given \a quaternion from this quaternion and returns a
reference to this quaternion.
@@ -355,7 +302,7 @@ QVector3D QQuaternion::rotatedVector(const QVector3D& vector) const
*/
/*!
- \fn QQuaternion &QQuaternion::operator*=(float factor)
+ \fn QQuaternion &QQuaternion::operator*=(float factor) noexcept
Multiplies this quaternion's components by the given \a factor, and
returns a reference to this quaternion.
@@ -364,7 +311,7 @@ QVector3D QQuaternion::rotatedVector(const QVector3D& vector) const
*/
/*!
- \fn QQuaternion &QQuaternion::operator*=(const QQuaternion &quaternion)
+ \fn QQuaternion &QQuaternion::operator*=(const QQuaternion &quaternion) noexcept
Multiplies this quaternion by \a quaternion and returns a reference
to this quaternion.
@@ -382,7 +329,7 @@ QVector3D QQuaternion::rotatedVector(const QVector3D& vector) const
#ifndef QT_NO_VECTOR3D
/*!
- \fn void QQuaternion::getAxisAndAngle(QVector3D *axis, float *angle) const
+ \fn void QQuaternion::getAxisAndAngle(QVector3D *axis, float *angle) const noexcept
\since 5.5
\overload
@@ -398,7 +345,7 @@ QVector3D QQuaternion::rotatedVector(const QVector3D& vector) const
\sa getAxisAndAngle()
*/
-QQuaternion QQuaternion::fromAxisAndAngle(const QVector3D& axis, float angle)
+QQuaternion QQuaternion::fromAxisAndAngle(const QVector3D &axis, float angle)
{
// Algorithm from:
// http://www.j3d.org/matrix_faq/matrfaq_latest.html#Q56
@@ -428,24 +375,22 @@ void QQuaternion::getAxisAndAngle(float *x, float *y, float *z, float *angle) co
// The quaternion representing the rotation is
// q = cos(A/2)+sin(A/2)*(x*i+y*j+z*k)
- float length = xp * xp + yp * yp + zp * zp;
+ const float length = qHypot(xp, yp, zp);
if (!qFuzzyIsNull(length)) {
- *x = xp;
- *y = yp;
- *z = zp;
- if (!qFuzzyIsNull(length - 1.0f)) {
- length = std::sqrt(length);
- *x /= length;
- *y /= length;
- *z /= length;
+ if (qFuzzyCompare(length, 1.0f)) {
+ *x = xp;
+ *y = yp;
+ *z = zp;
+ } else {
+ *x = xp / length;
+ *y = yp / length;
+ *z = zp / length;
}
- *angle = 2.0f * std::acos(wp);
+ *angle = qRadiansToDegrees(2.0f * std::atan2(length, wp));
} else {
// angle is 0 (mod 2*pi), so any axis will fit
*x = *y = *z = *angle = 0.0f;
}
-
- *angle = qRadiansToDegrees(*angle);
}
/*!
@@ -457,8 +402,8 @@ void QQuaternion::getAxisAndAngle(float *x, float *y, float *z, float *angle) co
QQuaternion QQuaternion::fromAxisAndAngle
(float x, float y, float z, float angle)
{
- float length = std::sqrt(x * x + y * y + z * z);
- if (!qFuzzyIsNull(length - 1.0f) && !qFuzzyIsNull(length)) {
+ float length = qHypot(x, y, z);
+ if (!qFuzzyCompare(length, 1.0f) && !qFuzzyIsNull(length)) {
x /= length;
y /= length;
z /= length;
@@ -508,46 +453,47 @@ void QQuaternion::getEulerAngles(float *pitch, float *yaw, float *roll) const
{
Q_ASSERT(pitch && yaw && roll);
- // Algorithm from:
- // http://www.j3d.org/matrix_faq/matrfaq_latest.html#Q37
-
- float xx = xp * xp;
- float xy = xp * yp;
- float xz = xp * zp;
- float xw = xp * wp;
- float yy = yp * yp;
- float yz = yp * zp;
- float yw = yp * wp;
- float zz = zp * zp;
- float zw = zp * wp;
-
- const float lengthSquared = xx + yy + zz + wp * wp;
- if (!qFuzzyIsNull(lengthSquared - 1.0f) && !qFuzzyIsNull(lengthSquared)) {
- xx /= lengthSquared;
- xy /= lengthSquared; // same as (xp / length) * (yp / length)
- xz /= lengthSquared;
- xw /= lengthSquared;
- yy /= lengthSquared;
- yz /= lengthSquared;
- yw /= lengthSquared;
- zz /= lengthSquared;
- zw /= lengthSquared;
- }
-
- *pitch = std::asin(-2.0f * (yz - xw));
- if (*pitch < M_PI_2) {
- if (*pitch > -M_PI_2) {
- *yaw = std::atan2(2.0f * (xz + yw), 1.0f - 2.0f * (xx + yy));
- *roll = std::atan2(2.0f * (xy + zw), 1.0f - 2.0f * (xx + zz));
- } else {
- // not a unique solution
- *roll = 0.0f;
- *yaw = -std::atan2(-2.0f * (xy - zw), 1.0f - 2.0f * (yy + zz));
- }
+ // Algorithm adapted from:
+ // https://ingmec.ual.es/~jlblanco/papers/jlblanco2010geometry3D_techrep.pdf
+ // "A tutorial on SE(3) transformation parameterizations and on-manifold optimization".
+
+ // We can only detect Gimbal lock when we normalize, which we can't do when
+ // length is nearly zero. Do so before multiplying coordinates, to avoid
+ // underflow.
+ const float len = length();
+ const bool rescale = !qFuzzyIsNull(len);
+ const float xps = rescale ? xp / len : xp;
+ const float yps = rescale ? yp / len : yp;
+ const float zps = rescale ? zp / len : zp;
+ const float wps = rescale ? wp / len : wp;
+
+ const float xx = xps * xps;
+ const float xy = xps * yps;
+ const float xz = xps * zps;
+ const float xw = xps * wps;
+ const float yy = yps * yps;
+ const float yz = yps * zps;
+ const float yw = yps * wps;
+ const float zz = zps * zps;
+ const float zw = zps * wps;
+
+ // For the common case, we have a hidden division by cos(pitch) to calculate
+ // yaw and roll: atan2(a / cos(pitch), b / cos(pitch)) = atan2(a, b). This equation
+ // wouldn't work if cos(pitch) is close to zero (i.e. abs(sin(pitch)) =~ 1.0).
+ // This threshold is copied from qFuzzyIsNull() to avoid the hidden division by zero.
+ constexpr float epsilon = 0.00001f;
+
+ const float sinp = -2.0f * (yz - xw);
+ if (std::abs(sinp) < 1.0f - epsilon) {
+ *pitch = std::asin(sinp);
+ *yaw = std::atan2(2.0f * (xz + yw), 1.0f - 2.0f * (xx + yy));
+ *roll = std::atan2(2.0f * (xy + zw), 1.0f - 2.0f * (xx + zz));
} else {
- // not a unique solution
+ // Gimbal lock case, which doesn't have a unique solution. We just use
+ // XY rotation.
+ *pitch = std::copysign(static_cast<float>(M_PI_2), sinp);
+ *yaw = 2.0f * std::atan2(yps, wps);
*roll = 0.0f;
- *yaw = std::atan2(-2.0f * (xy - zw), 1.0f - 2.0f * (yy + zz));
}
*pitch = qRadiansToDegrees(*pitch);
@@ -792,23 +738,21 @@ QQuaternion QQuaternion::rotationTo(const QVector3D &from, const QVector3D &to)
#endif // QT_NO_VECTOR3D
/*!
- \fn bool operator==(const QQuaternion &q1, const QQuaternion &q2)
- \relates QQuaternion
+ \fn bool QQuaternion::operator==(const QQuaternion &q1, const QQuaternion &q2) noexcept
Returns \c true if \a q1 is equal to \a q2; otherwise returns \c false.
This operator uses an exact floating-point comparison.
*/
/*!
- \fn bool operator!=(const QQuaternion &q1, const QQuaternion &q2)
- \relates QQuaternion
+ \fn bool QQuaternion::operator!=(const QQuaternion &q1, const QQuaternion &q2) noexcept
Returns \c true if \a q1 is not equal to \a q2; otherwise returns \c false.
This operator uses an exact floating-point comparison.
*/
/*!
- \fn const QQuaternion operator+(const QQuaternion &q1, const QQuaternion &q2)
+ \fn const QQuaternion operator+(const QQuaternion &q1, const QQuaternion &q2) noexcept
\relates QQuaternion
Returns a QQuaternion object that is the sum of the given quaternions,
@@ -818,7 +762,7 @@ QQuaternion QQuaternion::rotationTo(const QVector3D &from, const QVector3D &to)
*/
/*!
- \fn const QQuaternion operator-(const QQuaternion &q1, const QQuaternion &q2)
+ \fn const QQuaternion operator-(const QQuaternion &q1, const QQuaternion &q2) noexcept
\relates QQuaternion
Returns a QQuaternion object that is formed by subtracting
@@ -828,7 +772,7 @@ QQuaternion QQuaternion::rotationTo(const QVector3D &from, const QVector3D &to)
*/
/*!
- \fn const QQuaternion operator*(float factor, const QQuaternion &quaternion)
+ \fn const QQuaternion operator*(float factor, const QQuaternion &quaternion) noexcept
\relates QQuaternion
Returns a copy of the given \a quaternion, multiplied by the
@@ -838,7 +782,7 @@ QQuaternion QQuaternion::rotationTo(const QVector3D &from, const QVector3D &to)
*/
/*!
- \fn const QQuaternion operator*(const QQuaternion &quaternion, float factor)
+ \fn const QQuaternion operator*(const QQuaternion &quaternion, float factor) noexcept
\relates QQuaternion
Returns a copy of the given \a quaternion, multiplied by the
@@ -848,7 +792,7 @@ QQuaternion QQuaternion::rotationTo(const QVector3D &from, const QVector3D &to)
*/
/*!
- \fn const QQuaternion operator*(const QQuaternion &q1, const QQuaternion& q2)
+ \fn const QQuaternion operator*(const QQuaternion &q1, const QQuaternion &q2) noexcept
\relates QQuaternion
Multiplies \a q1 and \a q2 using quaternion multiplication.
@@ -859,7 +803,7 @@ QQuaternion QQuaternion::rotationTo(const QVector3D &from, const QVector3D &to)
*/
/*!
- \fn const QQuaternion operator-(const QQuaternion &quaternion)
+ \fn const QQuaternion operator-(const QQuaternion &quaternion) noexcept
\relates QQuaternion
\overload
@@ -882,7 +826,7 @@ QQuaternion QQuaternion::rotationTo(const QVector3D &from, const QVector3D &to)
#ifndef QT_NO_VECTOR3D
/*!
- \fn QVector3D operator*(const QQuaternion &quaternion, const QVector3D &vec)
+ \fn QVector3D operator*(const QQuaternion &quaternion, const QVector3D &vec) noexcept
\since 5.5
\relates QQuaternion
@@ -892,7 +836,7 @@ QQuaternion QQuaternion::rotationTo(const QVector3D &from, const QVector3D &to)
#endif
/*!
- \fn bool qFuzzyCompare(const QQuaternion& q1, const QQuaternion& q2)
+ \fn bool qFuzzyCompare(const QQuaternion &q1, const QQuaternion &q2) noexcept
\relates QQuaternion
Returns \c true if \a q1 and \a q2 are equal, allowing for a small
@@ -911,7 +855,7 @@ QQuaternion QQuaternion::rotationTo(const QVector3D &from, const QVector3D &to)
\sa nlerp()
*/
QQuaternion QQuaternion::slerp
- (const QQuaternion& q1, const QQuaternion& q2, float t)
+ (const QQuaternion &q1, const QQuaternion &q2, float t)
{
// Handle the easy cases first.
if (t <= 0.0f)
@@ -960,7 +904,7 @@ QQuaternion QQuaternion::slerp
\sa slerp()
*/
QQuaternion QQuaternion::nlerp
- (const QQuaternion& q1, const QQuaternion& q2, float t)
+ (const QQuaternion &q1, const QQuaternion &q2, float t)
{
// Handle the easy cases first.
if (t <= 0.0f)
@@ -983,7 +927,7 @@ QQuaternion QQuaternion::nlerp
*/
QQuaternion::operator QVariant() const
{
- return QVariant(QVariant::Quaternion, this);
+ return QVariant::fromValue(*this);
}
#ifndef QT_NO_DEBUG_STREAM
diff --git a/src/gui/math3d/qquaternion.h b/src/gui/math3d/qquaternion.h
index f01fab679e..7cfbd9b818 100644
--- a/src/gui/math3d/qquaternion.h
+++ b/src/gui/math3d/qquaternion.h
@@ -1,41 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the QtGui module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#ifndef QQUATERNION_H
#define QQUATERNION_H
@@ -53,157 +17,165 @@ QT_BEGIN_NAMESPACE
class QMatrix4x4;
class QVariant;
-class Q_GUI_EXPORT QQuaternion
+class QT6_ONLY(Q_GUI_EXPORT) QQuaternion
{
public:
- QQuaternion();
- explicit QQuaternion(Qt::Initialization) {}
- QQuaternion(float scalar, float xpos, float ypos, float zpos);
+ constexpr QQuaternion() noexcept;
+ explicit QQuaternion(Qt::Initialization) noexcept {}
+ constexpr QQuaternion(float scalar, float xpos, float ypos, float zpos) noexcept;
#ifndef QT_NO_VECTOR3D
- QQuaternion(float scalar, const QVector3D& vector);
+ constexpr QQuaternion(float scalar, const QVector3D &vector) noexcept;
#endif
#ifndef QT_NO_VECTOR4D
- explicit QQuaternion(const QVector4D& vector);
+ constexpr explicit QQuaternion(const QVector4D &vector) noexcept;
#endif
- bool isNull() const;
- bool isIdentity() const;
+ constexpr bool isNull() const noexcept;
+ constexpr bool isIdentity() const noexcept;
#ifndef QT_NO_VECTOR3D
- QVector3D vector() const;
- void setVector(const QVector3D& vector);
+ constexpr QVector3D vector() const noexcept;
+ constexpr void setVector(const QVector3D &vector) noexcept;
#endif
- void setVector(float x, float y, float z);
+ constexpr void setVector(float x, float y, float z) noexcept;
- float x() const;
- float y() const;
- float z() const;
- float scalar() const;
+ constexpr float x() const noexcept;
+ constexpr float y() const noexcept;
+ constexpr float z() const noexcept;
+ constexpr float scalar() const noexcept;
- void setX(float x);
- void setY(float y);
- void setZ(float z);
- void setScalar(float scalar);
+ constexpr void setX(float x) noexcept;
+ constexpr void setY(float y) noexcept;
+ constexpr void setZ(float z) noexcept;
+ constexpr void setScalar(float scalar) noexcept;
- Q_DECL_CONSTEXPR static inline float dotProduct(const QQuaternion &q1, const QQuaternion &q2);
+ constexpr static float dotProduct(const QQuaternion &q1, const QQuaternion &q2) noexcept;
- float length() const;
- float lengthSquared() const;
+ // ### Qt 7: make the next four constexpr
+ // (perhaps using std::hypot, constexpr in C++26, or constexpr qHypot)
+ QT7_ONLY(Q_GUI_EXPORT) float length() const;
+ QT7_ONLY(Q_GUI_EXPORT) float lengthSquared() const;
- Q_REQUIRED_RESULT QQuaternion normalized() const;
- void normalize();
+ [[nodiscard]] QT7_ONLY(Q_GUI_EXPORT) QQuaternion normalized() const;
+ QT7_ONLY(Q_GUI_EXPORT) void normalize();
- inline QQuaternion inverted() const;
+ constexpr QQuaternion inverted() const noexcept;
- Q_REQUIRED_RESULT QQuaternion conjugated() const;
-#if QT_DEPRECATED_SINCE(5, 5)
- Q_REQUIRED_RESULT QT_DEPRECATED QQuaternion conjugate() const;
-#endif
+ [[nodiscard]] constexpr QQuaternion conjugated() const noexcept;
+
+ QT7_ONLY(Q_GUI_EXPORT) QVector3D rotatedVector(const QVector3D &vector) const;
- QVector3D rotatedVector(const QVector3D& vector) const;
+ constexpr QQuaternion &operator+=(const QQuaternion &quaternion) noexcept;
+ constexpr QQuaternion &operator-=(const QQuaternion &quaternion) noexcept;
+ constexpr QQuaternion &operator*=(float factor) noexcept;
+ constexpr QQuaternion &operator*=(const QQuaternion &quaternion) noexcept;
+ constexpr QQuaternion &operator/=(float divisor);
- QQuaternion &operator+=(const QQuaternion &quaternion);
- QQuaternion &operator-=(const QQuaternion &quaternion);
- QQuaternion &operator*=(float factor);
- QQuaternion &operator*=(const QQuaternion &quaternion);
- QQuaternion &operator/=(float divisor);
+QT_WARNING_PUSH
+QT_WARNING_DISABLE_FLOAT_COMPARE
+ friend constexpr bool operator==(const QQuaternion &q1, const QQuaternion &q2) noexcept
+ {
+ return q1.wp == q2.wp && q1.xp == q2.xp && q1.yp == q2.yp && q1.zp == q2.zp;
+ }
+ friend constexpr bool operator!=(const QQuaternion &q1, const QQuaternion &q2) noexcept
+ {
+ return !(q1 == q2);
+ }
+QT_WARNING_POP
- friend inline bool operator==(const QQuaternion &q1, const QQuaternion &q2);
- friend inline bool operator!=(const QQuaternion &q1, const QQuaternion &q2);
- friend inline const QQuaternion operator+(const QQuaternion &q1, const QQuaternion &q2);
- friend inline const QQuaternion operator-(const QQuaternion &q1, const QQuaternion &q2);
- friend inline const QQuaternion operator*(float factor, const QQuaternion &quaternion);
- friend inline const QQuaternion operator*(const QQuaternion &quaternion, float factor);
- friend inline const QQuaternion operator*(const QQuaternion &q1, const QQuaternion& q2);
- friend inline const QQuaternion operator-(const QQuaternion &quaternion);
- friend inline const QQuaternion operator/(const QQuaternion &quaternion, float divisor);
+ friend constexpr QQuaternion operator+(const QQuaternion &q1, const QQuaternion &q2) noexcept;
+ friend constexpr QQuaternion operator-(const QQuaternion &q1, const QQuaternion &q2) noexcept;
+ friend constexpr QQuaternion operator*(float factor, const QQuaternion &quaternion) noexcept;
+ friend constexpr QQuaternion operator*(const QQuaternion &quaternion, float factor) noexcept;
+ friend constexpr QQuaternion operator*(const QQuaternion &q1, const QQuaternion &q2) noexcept;
+ friend constexpr QQuaternion operator-(const QQuaternion &quaternion) noexcept;
+ friend constexpr QQuaternion operator/(const QQuaternion &quaternion, float divisor);
- friend inline bool qFuzzyCompare(const QQuaternion& q1, const QQuaternion& q2);
+ friend constexpr bool qFuzzyCompare(const QQuaternion &q1, const QQuaternion &q2) noexcept;
#ifndef QT_NO_VECTOR4D
- QVector4D toVector4D() const;
+ constexpr QVector4D toVector4D() const noexcept;
#endif
- operator QVariant() const;
+ QT7_ONLY(Q_GUI_EXPORT) operator QVariant() const;
#ifndef QT_NO_VECTOR3D
inline void getAxisAndAngle(QVector3D *axis, float *angle) const;
- static QQuaternion fromAxisAndAngle(const QVector3D& axis, float angle);
+ QT7_ONLY(Q_GUI_EXPORT) static QQuaternion fromAxisAndAngle(const QVector3D &axis, float angle);
#endif
- void getAxisAndAngle(float *x, float *y, float *z, float *angle) const;
- static QQuaternion fromAxisAndAngle
- (float x, float y, float z, float angle);
+ QT7_ONLY(Q_GUI_EXPORT) void getAxisAndAngle(float *x, float *y, float *z, float *angle) const;
+ QT7_ONLY(Q_GUI_EXPORT) static QQuaternion fromAxisAndAngle(float x, float y, float z,
+ float angle);
#ifndef QT_NO_VECTOR3D
inline QVector3D toEulerAngles() const;
- static inline QQuaternion fromEulerAngles(const QVector3D &eulerAngles);
+ QT7_ONLY(Q_GUI_EXPORT) static inline QQuaternion fromEulerAngles(const QVector3D &eulerAngles);
#endif
- void getEulerAngles(float *pitch, float *yaw, float *roll) const;
- static QQuaternion fromEulerAngles(float pitch, float yaw, float roll);
+ QT7_ONLY(Q_GUI_EXPORT) void getEulerAngles(float *pitch, float *yaw, float *roll) const;
+ QT7_ONLY(Q_GUI_EXPORT) static QQuaternion fromEulerAngles(float pitch, float yaw, float roll);
- QMatrix3x3 toRotationMatrix() const;
- static QQuaternion fromRotationMatrix(const QMatrix3x3 &rot3x3);
+ QT7_ONLY(Q_GUI_EXPORT) QMatrix3x3 toRotationMatrix() const;
+ QT7_ONLY(Q_GUI_EXPORT) static QQuaternion fromRotationMatrix(const QMatrix3x3 &rot3x3);
#ifndef QT_NO_VECTOR3D
- void getAxes(QVector3D *xAxis, QVector3D *yAxis, QVector3D *zAxis) const;
- static QQuaternion fromAxes(const QVector3D &xAxis, const QVector3D &yAxis, const QVector3D &zAxis);
+ QT7_ONLY(Q_GUI_EXPORT) void getAxes(QVector3D *xAxis, QVector3D *yAxis, QVector3D *zAxis) const;
+ QT7_ONLY(Q_GUI_EXPORT) static QQuaternion fromAxes(const QVector3D &xAxis,
+ const QVector3D &yAxis,
+ const QVector3D &zAxis);
- static QQuaternion fromDirection(const QVector3D &direction, const QVector3D &up);
+ QT7_ONLY(Q_GUI_EXPORT) static QQuaternion fromDirection(const QVector3D &direction,
+ const QVector3D &up);
- static QQuaternion rotationTo(const QVector3D &from, const QVector3D &to);
+ QT7_ONLY(Q_GUI_EXPORT) static QQuaternion rotationTo(const QVector3D &from,
+ const QVector3D &to);
#endif
- static QQuaternion slerp
- (const QQuaternion& q1, const QQuaternion& q2, float t);
- static QQuaternion nlerp
- (const QQuaternion& q1, const QQuaternion& q2, float t);
+ QT7_ONLY(Q_GUI_EXPORT) static QQuaternion slerp(const QQuaternion &q1, const QQuaternion &q2,
+ float t);
+ QT7_ONLY(Q_GUI_EXPORT) static QQuaternion nlerp(const QQuaternion &q1, const QQuaternion &q2,
+ float t);
private:
float wp, xp, yp, zp;
};
-Q_DECLARE_TYPEINFO(QQuaternion, Q_MOVABLE_TYPE);
+Q_DECLARE_TYPEINFO(QQuaternion, Q_PRIMITIVE_TYPE);
-inline QQuaternion::QQuaternion() : wp(1.0f), xp(0.0f), yp(0.0f), zp(0.0f) {}
+constexpr QQuaternion::QQuaternion() noexcept : wp(1.0f), xp(0.0f), yp(0.0f), zp(0.0f) {}
-inline QQuaternion::QQuaternion(float aScalar, float xpos, float ypos, float zpos) : wp(aScalar), xp(xpos), yp(ypos), zp(zpos) {}
+constexpr QQuaternion::QQuaternion(float aScalar, float xpos, float ypos, float zpos) noexcept
+ : wp(aScalar), xp(xpos), yp(ypos), zp(zpos) {}
QT_WARNING_PUSH
-QT_WARNING_DISABLE_CLANG("-Wfloat-equal")
-QT_WARNING_DISABLE_GCC("-Wfloat-equal")
-QT_WARNING_DISABLE_INTEL(1572)
-inline bool QQuaternion::isNull() const
+QT_WARNING_DISABLE_FLOAT_COMPARE
+
+constexpr bool QQuaternion::isNull() const noexcept
{
return wp == 0.0f && xp == 0.0f && yp == 0.0f && zp == 0.0f;
}
-inline bool QQuaternion::isIdentity() const
+constexpr bool QQuaternion::isIdentity() const noexcept
{
return wp == 1.0f && xp == 0.0f && yp == 0.0f && zp == 0.0f;
}
-
-inline bool operator==(const QQuaternion &q1, const QQuaternion &q2)
-{
- return q1.wp == q2.wp && q1.xp == q2.xp && q1.yp == q2.yp && q1.zp == q2.zp;
-}
QT_WARNING_POP
-inline float QQuaternion::x() const { return xp; }
-inline float QQuaternion::y() const { return yp; }
-inline float QQuaternion::z() const { return zp; }
-inline float QQuaternion::scalar() const { return wp; }
+constexpr float QQuaternion::x() const noexcept { return xp; }
+constexpr float QQuaternion::y() const noexcept { return yp; }
+constexpr float QQuaternion::z() const noexcept { return zp; }
+constexpr float QQuaternion::scalar() const noexcept { return wp; }
-inline void QQuaternion::setX(float aX) { xp = aX; }
-inline void QQuaternion::setY(float aY) { yp = aY; }
-inline void QQuaternion::setZ(float aZ) { zp = aZ; }
-inline void QQuaternion::setScalar(float aScalar) { wp = aScalar; }
+constexpr void QQuaternion::setX(float aX) noexcept { xp = aX; }
+constexpr void QQuaternion::setY(float aY) noexcept { yp = aY; }
+constexpr void QQuaternion::setZ(float aZ) noexcept { zp = aZ; }
+constexpr void QQuaternion::setScalar(float aScalar) noexcept { wp = aScalar; }
-Q_DECL_CONSTEXPR inline float QQuaternion::dotProduct(const QQuaternion &q1, const QQuaternion &q2)
+constexpr float QQuaternion::dotProduct(const QQuaternion &q1, const QQuaternion &q2) noexcept
{
return q1.wp * q2.wp + q1.xp * q2.xp + q1.yp * q2.yp + q1.zp * q2.zp;
}
-inline QQuaternion QQuaternion::inverted() const
+constexpr QQuaternion QQuaternion::inverted() const noexcept
{
// Need some extra precision if the length is very small.
double len = double(wp) * double(wp) +
@@ -216,19 +188,12 @@ inline QQuaternion QQuaternion::inverted() const
return QQuaternion(0.0f, 0.0f, 0.0f, 0.0f);
}
-inline QQuaternion QQuaternion::conjugated() const
+constexpr QQuaternion QQuaternion::conjugated() const noexcept
{
return QQuaternion(wp, -xp, -yp, -zp);
}
-#if QT_DEPRECATED_SINCE(5, 5)
-inline QQuaternion QQuaternion::conjugate() const
-{
- return conjugated();
-}
-#endif
-
-inline QQuaternion &QQuaternion::operator+=(const QQuaternion &quaternion)
+constexpr QQuaternion &QQuaternion::operator+=(const QQuaternion &quaternion) noexcept
{
wp += quaternion.wp;
xp += quaternion.xp;
@@ -237,7 +202,7 @@ inline QQuaternion &QQuaternion::operator+=(const QQuaternion &quaternion)
return *this;
}
-inline QQuaternion &QQuaternion::operator-=(const QQuaternion &quaternion)
+constexpr QQuaternion &QQuaternion::operator-=(const QQuaternion &quaternion) noexcept
{
wp -= quaternion.wp;
xp -= quaternion.xp;
@@ -246,7 +211,7 @@ inline QQuaternion &QQuaternion::operator-=(const QQuaternion &quaternion)
return *this;
}
-inline QQuaternion &QQuaternion::operator*=(float factor)
+constexpr QQuaternion &QQuaternion::operator*=(float factor) noexcept
{
wp *= factor;
xp *= factor;
@@ -255,7 +220,7 @@ inline QQuaternion &QQuaternion::operator*=(float factor)
return *this;
}
-inline const QQuaternion operator*(const QQuaternion &q1, const QQuaternion& q2)
+constexpr QQuaternion operator*(const QQuaternion &q1, const QQuaternion &q2) noexcept
{
float yy = (q1.wp - q1.yp) * (q2.wp + q2.zp);
float zz = (q1.wp + q1.yp) * (q2.wp - q2.zp);
@@ -271,13 +236,13 @@ inline const QQuaternion operator*(const QQuaternion &q1, const QQuaternion& q2)
return QQuaternion(w, x, y, z);
}
-inline QQuaternion &QQuaternion::operator*=(const QQuaternion &quaternion)
+constexpr QQuaternion &QQuaternion::operator*=(const QQuaternion &quaternion) noexcept
{
*this = *this * quaternion;
return *this;
}
-inline QQuaternion &QQuaternion::operator/=(float divisor)
+constexpr QQuaternion &QQuaternion::operator/=(float divisor)
{
wp /= divisor;
xp /= divisor;
@@ -286,42 +251,37 @@ inline QQuaternion &QQuaternion::operator/=(float divisor)
return *this;
}
-inline bool operator!=(const QQuaternion &q1, const QQuaternion &q2)
-{
- return !operator==(q1, q2);
-}
-
-inline const QQuaternion operator+(const QQuaternion &q1, const QQuaternion &q2)
+constexpr QQuaternion operator+(const QQuaternion &q1, const QQuaternion &q2) noexcept
{
return QQuaternion(q1.wp + q2.wp, q1.xp + q2.xp, q1.yp + q2.yp, q1.zp + q2.zp);
}
-inline const QQuaternion operator-(const QQuaternion &q1, const QQuaternion &q2)
+constexpr QQuaternion operator-(const QQuaternion &q1, const QQuaternion &q2) noexcept
{
return QQuaternion(q1.wp - q2.wp, q1.xp - q2.xp, q1.yp - q2.yp, q1.zp - q2.zp);
}
-inline const QQuaternion operator*(float factor, const QQuaternion &quaternion)
+constexpr QQuaternion operator*(float factor, const QQuaternion &quaternion) noexcept
{
return QQuaternion(quaternion.wp * factor, quaternion.xp * factor, quaternion.yp * factor, quaternion.zp * factor);
}
-inline const QQuaternion operator*(const QQuaternion &quaternion, float factor)
+constexpr QQuaternion operator*(const QQuaternion &quaternion, float factor) noexcept
{
return QQuaternion(quaternion.wp * factor, quaternion.xp * factor, quaternion.yp * factor, quaternion.zp * factor);
}
-inline const QQuaternion operator-(const QQuaternion &quaternion)
+constexpr QQuaternion operator-(const QQuaternion &quaternion) noexcept
{
return QQuaternion(-quaternion.wp, -quaternion.xp, -quaternion.yp, -quaternion.zp);
}
-inline const QQuaternion operator/(const QQuaternion &quaternion, float divisor)
+constexpr QQuaternion operator/(const QQuaternion &quaternion, float divisor)
{
return QQuaternion(quaternion.wp / divisor, quaternion.xp / divisor, quaternion.yp / divisor, quaternion.zp / divisor);
}
-inline bool qFuzzyCompare(const QQuaternion& q1, const QQuaternion& q2)
+constexpr bool qFuzzyCompare(const QQuaternion &q1, const QQuaternion &q2) noexcept
{
return qFuzzyCompare(q1.wp, q2.wp) &&
qFuzzyCompare(q1.xp, q2.xp) &&
@@ -331,17 +291,17 @@ inline bool qFuzzyCompare(const QQuaternion& q1, const QQuaternion& q2)
#ifndef QT_NO_VECTOR3D
-inline QQuaternion::QQuaternion(float aScalar, const QVector3D& aVector)
+constexpr QQuaternion::QQuaternion(float aScalar, const QVector3D &aVector) noexcept
: wp(aScalar), xp(aVector.x()), yp(aVector.y()), zp(aVector.z()) {}
-inline void QQuaternion::setVector(const QVector3D& aVector)
+constexpr void QQuaternion::setVector(const QVector3D &aVector) noexcept
{
xp = aVector.x();
yp = aVector.y();
zp = aVector.z();
}
-inline QVector3D QQuaternion::vector() const
+constexpr QVector3D QQuaternion::vector() const noexcept
{
return QVector3D(xp, yp, zp);
}
@@ -372,7 +332,7 @@ inline QQuaternion QQuaternion::fromEulerAngles(const QVector3D &eulerAngles)
#endif
-inline void QQuaternion::setVector(float aX, float aY, float aZ)
+constexpr void QQuaternion::setVector(float aX, float aY, float aZ) noexcept
{
xp = aX;
yp = aY;
@@ -381,10 +341,10 @@ inline void QQuaternion::setVector(float aX, float aY, float aZ)
#ifndef QT_NO_VECTOR4D
-inline QQuaternion::QQuaternion(const QVector4D& aVector)
+constexpr QQuaternion::QQuaternion(const QVector4D &aVector) noexcept
: wp(aVector.w()), xp(aVector.x()), yp(aVector.y()), zp(aVector.z()) {}
-inline QVector4D QQuaternion::toVector4D() const
+constexpr QVector4D QQuaternion::toVector4D() const noexcept
{
return QVector4D(xp, yp, zp, wp);
}
diff --git a/src/gui/math3d/qvector2d.cpp b/src/gui/math3d/qvector2d.cpp
deleted file mode 100644
index c04f8b1cbf..0000000000
--- a/src/gui/math3d/qvector2d.cpp
+++ /dev/null
@@ -1,590 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the QtGui module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "qvector2d.h"
-#include "qvector3d.h"
-#include "qvector4d.h"
-#include <QtCore/qdatastream.h>
-#include <QtCore/qdebug.h>
-#include <QtCore/qvariant.h>
-#include <QtCore/qmath.h>
-
-QT_BEGIN_NAMESPACE
-
-#ifndef QT_NO_VECTOR2D
-
-Q_STATIC_ASSERT_X(std::is_standard_layout<QVector2D>::value, "QVector2D is supposed to be standard layout");
-Q_STATIC_ASSERT_X(sizeof(QVector2D) == sizeof(float) * 2, "QVector2D is not supposed to have padding at the end");
-
-// QVector2D used to be defined as class QVector2D { float x, y; };,
-// now instead it is defined as classs QVector2D { float v[2]; };.
-// Check that binary compatibility is preserved.
-// ### Qt 6: remove all of these checks.
-
-namespace {
-
-struct QVector2DOld
-{
- float x, y;
-};
-
-struct QVector2DNew
-{
- float v[2];
-};
-
-Q_STATIC_ASSERT_X(std::is_standard_layout<QVector2DOld>::value, "Binary compatibility break in QVector2D");
-Q_STATIC_ASSERT_X(std::is_standard_layout<QVector2DNew>::value, "Binary compatibility break in QVector2D");
-
-Q_STATIC_ASSERT_X(sizeof(QVector2DOld) == sizeof(QVector2DNew), "Binary compatibility break in QVector2D");
-
-// requires a constexpr offsetof
-#if !defined(Q_CC_MSVC) || (_MSC_VER >= 1910)
-Q_STATIC_ASSERT_X(offsetof(QVector2DOld, x) == offsetof(QVector2DNew, v) + sizeof(QVector2DNew::v[0]) * 0, "Binary compatibility break in QVector2D");
-Q_STATIC_ASSERT_X(offsetof(QVector2DOld, y) == offsetof(QVector2DNew, v) + sizeof(QVector2DNew::v[0]) * 1, "Binary compatibility break in QVector2D");
-#endif
-
-} // anonymous namespace
-
-/*!
- \class QVector2D
- \brief The QVector2D class represents a vector or vertex in 2D space.
- \since 4.6
- \ingroup painting
- \ingroup painting-3D
- \inmodule QtGui
-
- The QVector2D class can also be used to represent vertices in 2D space.
- We therefore do not need to provide a separate vertex class.
-
- \sa QVector3D, QVector4D, QQuaternion
-*/
-
-/*!
- \fn QVector2D::QVector2D()
-
- Constructs a null vector, i.e. with coordinates (0, 0).
-*/
-
-/*!
- \fn QVector2D::QVector2D(Qt::Initialization)
- \since 5.5
- \internal
-
- Constructs a vector without initializing the contents.
-*/
-
-/*!
- \fn QVector2D::QVector2D(float xpos, float ypos)
-
- Constructs a vector with coordinates (\a xpos, \a ypos).
-*/
-
-/*!
- \fn QVector2D::QVector2D(const QPoint& point)
-
- Constructs a vector with x and y coordinates from a 2D \a point.
-*/
-
-/*!
- \fn QVector2D::QVector2D(const QPointF& point)
-
- Constructs a vector with x and y coordinates from a 2D \a point.
-*/
-
-#ifndef QT_NO_VECTOR3D
-
-/*!
- Constructs a vector with x and y coordinates from a 3D \a vector.
- The z coordinate of \a vector is dropped.
-
- \sa toVector3D()
-*/
-QVector2D::QVector2D(const QVector3D& vector)
-{
- v[0] = vector.v[0];
- v[1] = vector.v[1];
-}
-
-#endif
-
-#ifndef QT_NO_VECTOR4D
-
-/*!
- Constructs a vector with x and y coordinates from a 3D \a vector.
- The z and w coordinates of \a vector are dropped.
-
- \sa toVector4D()
-*/
-QVector2D::QVector2D(const QVector4D& vector)
-{
- v[0] = vector.v[0];
- v[1] = vector.v[1];
-}
-
-#endif
-
-/*!
- \fn bool QVector2D::isNull() const
-
- Returns \c true if the x and y coordinates are set to 0.0,
- otherwise returns \c false.
-*/
-
-/*!
- \fn float QVector2D::x() const
-
- Returns the x coordinate of this point.
-
- \sa setX(), y()
-*/
-
-/*!
- \fn float QVector2D::y() const
-
- Returns the y coordinate of this point.
-
- \sa setY(), x()
-*/
-
-/*!
- \fn void QVector2D::setX(float x)
-
- Sets the x coordinate of this point to the given \a x coordinate.
-
- \sa x(), setY()
-*/
-
-/*!
- \fn void QVector2D::setY(float y)
-
- Sets the y coordinate of this point to the given \a y coordinate.
-
- \sa y(), setX()
-*/
-
-/*! \fn float &QVector2D::operator[](int i)
- \since 5.2
-
- Returns the component of the vector at index position \a i
- as a modifiable reference.
-
- \a i must be a valid index position in the vector (i.e., 0 <= \a i
- < 2).
-*/
-
-/*! \fn float QVector2D::operator[](int i) const
- \since 5.2
-
- Returns the component of the vector at index position \a i.
-
- \a i must be a valid index position in the vector (i.e., 0 <= \a i
- < 2).
-*/
-
-/*!
- Returns the length of the vector from the origin.
-
- \sa lengthSquared(), normalized()
-*/
-float QVector2D::length() const
-{
- // Need some extra precision if the length is very small.
- double len = double(v[0]) * double(v[0]) +
- double(v[1]) * double(v[1]);
- return float(std::sqrt(len));
-}
-
-/*!
- Returns the squared length of the vector from the origin.
- This is equivalent to the dot product of the vector with itself.
-
- \sa length(), dotProduct()
-*/
-float QVector2D::lengthSquared() const
-{
- return v[0] * v[0] + v[1] * v[1];
-}
-
-/*!
- Returns the normalized unit vector form of this vector.
-
- If this vector is null, then a null vector is returned. If the length
- of the vector is very close to 1, then the vector will be returned as-is.
- Otherwise the normalized form of the vector of length 1 will be returned.
-
- \sa length(), normalize()
-*/
-QVector2D QVector2D::normalized() const
-{
- // Need some extra precision if the length is very small.
- double len = double(v[0]) * double(v[0]) +
- double(v[1]) * double(v[1]);
- if (qFuzzyIsNull(len - 1.0f)) {
- return *this;
- } else if (!qFuzzyIsNull(len)) {
- double sqrtLen = std::sqrt(len);
- return QVector2D(float(double(v[0]) / sqrtLen), float(double(v[1]) / sqrtLen));
- } else {
- return QVector2D();
- }
-}
-
-/*!
- Normalizes the currect vector in place. Nothing happens if this
- vector is a null vector or the length of the vector is very close to 1.
-
- \sa length(), normalized()
-*/
-void QVector2D::normalize()
-{
- // Need some extra precision if the length is very small.
- double len = double(v[0]) * double(v[0]) +
- double(v[1]) * double(v[1]);
- if (qFuzzyIsNull(len - 1.0f) || qFuzzyIsNull(len))
- return;
-
- len = std::sqrt(len);
-
- v[0] = float(double(v[0]) / len);
- v[1] = float(double(v[1]) / len);
-}
-
-/*!
- \since 5.1
-
- Returns the distance from this vertex to a point defined by
- the vertex \a point.
-
- \sa distanceToLine()
-*/
-float QVector2D::distanceToPoint(const QVector2D& point) const
-{
- return (*this - point).length();
-}
-
-/*!
- \since 5.1
-
- Returns the distance that this vertex is from a line defined
- by \a point and the unit vector \a direction.
-
- If \a direction is a null vector, then it does not define a line.
- In that case, the distance from \a point to this vertex is returned.
-
- \sa distanceToPoint()
-*/
-float QVector2D::distanceToLine
- (const QVector2D& point, const QVector2D& direction) const
-{
- if (direction.isNull())
- return (*this - point).length();
- QVector2D p = point + dotProduct(*this - point, direction) * direction;
- return (*this - p).length();
-}
-
-/*!
- \fn QVector2D &QVector2D::operator+=(const QVector2D &vector)
-
- Adds the given \a vector to this vector and returns a reference to
- this vector.
-
- \sa operator-=()
-*/
-
-/*!
- \fn QVector2D &QVector2D::operator-=(const QVector2D &vector)
-
- Subtracts the given \a vector from this vector and returns a reference to
- this vector.
-
- \sa operator+=()
-*/
-
-/*!
- \fn QVector2D &QVector2D::operator*=(float factor)
-
- Multiplies this vector's coordinates by the given \a factor, and
- returns a reference to this vector.
-
- \sa operator/=()
-*/
-
-/*!
- \fn QVector2D &QVector2D::operator*=(const QVector2D &vector)
-
- Multiplies the components of this vector by the corresponding
- components in \a vector.
-*/
-
-/*!
- \fn QVector2D &QVector2D::operator/=(float divisor)
-
- Divides this vector's coordinates by the given \a divisor, and
- returns a reference to this vector.
-
- \sa operator*=()
-*/
-
-/*!
- \fn QVector2D &QVector2D::operator/=(const QVector2D &vector)
- \since 5.5
-
- Divides the components of this vector by the corresponding
- components in \a vector.
-
- \sa operator*=()
-*/
-
-/*!
- Returns the dot product of \a v1 and \a v2.
-*/
-float QVector2D::dotProduct(const QVector2D& v1, const QVector2D& v2)
-{
- return v1.v[0] * v2.v[0] + v1.v[1] * v2.v[1];
-}
-
-/*!
- \fn bool operator==(const QVector2D &v1, const QVector2D &v2)
- \relates QVector2D
-
- Returns \c true if \a v1 is equal to \a v2; otherwise returns \c false.
- This operator uses an exact floating-point comparison.
-*/
-
-/*!
- \fn bool operator!=(const QVector2D &v1, const QVector2D &v2)
- \relates QVector2D
-
- Returns \c true if \a v1 is not equal to \a v2; otherwise returns \c false.
- This operator uses an exact floating-point comparison.
-*/
-
-/*!
- \fn const QVector2D operator+(const QVector2D &v1, const QVector2D &v2)
- \relates QVector2D
-
- Returns a QVector2D object that is the sum of the given vectors, \a v1
- and \a v2; each component is added separately.
-
- \sa QVector2D::operator+=()
-*/
-
-/*!
- \fn const QVector2D operator-(const QVector2D &v1, const QVector2D &v2)
- \relates QVector2D
-
- Returns a QVector2D object that is formed by subtracting \a v2 from \a v1;
- each component is subtracted separately.
-
- \sa QVector2D::operator-=()
-*/
-
-/*!
- \fn const QVector2D operator*(float factor, const QVector2D &vector)
- \relates QVector2D
-
- Returns a copy of the given \a vector, multiplied by the given \a factor.
-
- \sa QVector2D::operator*=()
-*/
-
-/*!
- \fn const QVector2D operator*(const QVector2D &vector, float factor)
- \relates QVector2D
-
- Returns a copy of the given \a vector, multiplied by the given \a factor.
-
- \sa QVector2D::operator*=()
-*/
-
-/*!
- \fn const QVector2D operator*(const QVector2D &v1, const QVector2D &v2)
- \relates QVector2D
-
- Multiplies the components of \a v1 by the corresponding
- components in \a v2.
-*/
-
-/*!
- \fn const QVector2D operator-(const QVector2D &vector)
- \relates QVector2D
- \overload
-
- Returns a QVector2D object that is formed by changing the sign of
- the components of the given \a vector.
-
- Equivalent to \c {QVector2D(0,0) - vector}.
-*/
-
-/*!
- \fn const QVector2D operator/(const QVector2D &vector, float divisor)
- \relates QVector2D
-
- Returns the QVector2D object formed by dividing all three components of
- the given \a vector by the given \a divisor.
-
- \sa QVector2D::operator/=()
-*/
-
-/*!
- \fn const QVector2D operator/(const QVector2D &vector, const QVector2D &divisor)
- \relates QVector2D
- \since 5.5
-
- Returns the QVector2D object formed by dividing components of the given
- \a vector by a respective components of the given \a divisor.
-
- \sa QVector2D::operator/=()
-*/
-
-/*!
- \fn bool qFuzzyCompare(const QVector2D& v1, const QVector2D& v2)
- \relates QVector2D
-
- Returns \c true if \a v1 and \a v2 are equal, allowing for a small
- fuzziness factor for floating-point comparisons; false otherwise.
-*/
-
-#ifndef QT_NO_VECTOR3D
-
-/*!
- Returns the 3D form of this 2D vector, with the z coordinate set to zero.
-
- \sa toVector4D(), toPoint()
-*/
-QVector3D QVector2D::toVector3D() const
-{
- return QVector3D(v[0], v[1], 0.0f);
-}
-
-#endif
-
-#ifndef QT_NO_VECTOR4D
-
-/*!
- Returns the 4D form of this 2D vector, with the z and w coordinates set to zero.
-
- \sa toVector3D(), toPoint()
-*/
-QVector4D QVector2D::toVector4D() const
-{
- return QVector4D(v[0], v[1], 0.0f, 0.0f);
-}
-
-#endif
-
-/*!
- \fn QPoint QVector2D::toPoint() const
-
- Returns the QPoint form of this 2D vector.
-
- \sa toPointF(), toVector3D()
-*/
-
-/*!
- \fn QPointF QVector2D::toPointF() const
-
- Returns the QPointF form of this 2D vector.
-
- \sa toPoint(), toVector3D()
-*/
-
-/*!
- Returns the 2D vector as a QVariant.
-*/
-QVector2D::operator QVariant() const
-{
- return QVariant(QVariant::Vector2D, this);
-}
-
-#ifndef QT_NO_DEBUG_STREAM
-
-QDebug operator<<(QDebug dbg, const QVector2D &vector)
-{
- QDebugStateSaver saver(dbg);
- dbg.nospace() << "QVector2D(" << vector.x() << ", " << vector.y() << ')';
- return dbg;
-}
-
-#endif
-
-#ifndef QT_NO_DATASTREAM
-
-/*!
- \fn QDataStream &operator<<(QDataStream &stream, const QVector2D &vector)
- \relates QVector2D
-
- Writes the given \a vector to the given \a stream and returns a
- reference to the stream.
-
- \sa {Serializing Qt Data Types}
-*/
-
-QDataStream &operator<<(QDataStream &stream, const QVector2D &vector)
-{
- stream << vector.x() << vector.y();
- return stream;
-}
-
-/*!
- \fn QDataStream &operator>>(QDataStream &stream, QVector2D &vector)
- \relates QVector2D
-
- Reads a 2D vector from the given \a stream into the given \a vector
- and returns a reference to the stream.
-
- \sa {Serializing Qt Data Types}
-*/
-
-QDataStream &operator>>(QDataStream &stream, QVector2D &vector)
-{
- float x, y;
- stream >> x;
- stream >> y;
- vector.setX(x);
- vector.setY(y);
- return stream;
-}
-
-#endif // QT_NO_DATASTREAM
-
-#endif // QT_NO_VECTOR2D
-
-QT_END_NAMESPACE
diff --git a/src/gui/math3d/qvector2d.h b/src/gui/math3d/qvector2d.h
index cbce94c199..a9e55a8ef8 100644
--- a/src/gui/math3d/qvector2d.h
+++ b/src/gui/math3d/qvector2d.h
@@ -1,290 +1,9 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the QtGui module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// Copyright (C) 2020 Klarälvdalens Datakonsult AB, a KDAB Group company, info@kdab.com, author Giuseppe D'Angelo <giuseppe.dangelo@kdab.com>
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
-#ifndef QVECTOR2D_H
-#define QVECTOR2D_H
-
-#include <QtGui/qtguiglobal.h>
-#include <QtCore/qpoint.h>
-#include <QtCore/qmetatype.h>
-
-QT_BEGIN_NAMESPACE
-
-
-class QVector3D;
-class QVector4D;
-class QVariant;
-
-#ifndef QT_NO_VECTOR2D
-
-class Q_GUI_EXPORT QVector2D
-{
-public:
- Q_DECL_CONSTEXPR QVector2D();
- explicit QVector2D(Qt::Initialization) {}
- Q_DECL_CONSTEXPR QVector2D(float xpos, float ypos);
- Q_DECL_CONSTEXPR explicit QVector2D(const QPoint& point);
- Q_DECL_CONSTEXPR explicit QVector2D(const QPointF& point);
-#ifndef QT_NO_VECTOR3D
- explicit QVector2D(const QVector3D& vector);
-#endif
-#ifndef QT_NO_VECTOR4D
- explicit QVector2D(const QVector4D& vector);
-#endif
-
- bool isNull() const;
-
- Q_DECL_CONSTEXPR float x() const;
- Q_DECL_CONSTEXPR float y() const;
-
- void setX(float x);
- void setY(float y);
-
- float &operator[](int i);
- float operator[](int i) const;
-
- float length() const;
- float lengthSquared() const; //In Qt 6 convert to inline and constexpr
-
- Q_REQUIRED_RESULT QVector2D normalized() const;
- void normalize();
-
- float distanceToPoint(const QVector2D &point) const;
- float distanceToLine(const QVector2D& point, const QVector2D& direction) const;
-
- QVector2D &operator+=(const QVector2D &vector);
- QVector2D &operator-=(const QVector2D &vector);
- QVector2D &operator*=(float factor);
- QVector2D &operator*=(const QVector2D &vector);
- QVector2D &operator/=(float divisor);
- inline QVector2D &operator/=(const QVector2D &vector);
-
- static float dotProduct(const QVector2D& v1, const QVector2D& v2); //In Qt 6 convert to inline and constexpr
-
- Q_DECL_CONSTEXPR friend inline bool operator==(const QVector2D &v1, const QVector2D &v2);
- Q_DECL_CONSTEXPR friend inline bool operator!=(const QVector2D &v1, const QVector2D &v2);
- Q_DECL_CONSTEXPR friend inline const QVector2D operator+(const QVector2D &v1, const QVector2D &v2);
- Q_DECL_CONSTEXPR friend inline const QVector2D operator-(const QVector2D &v1, const QVector2D &v2);
- Q_DECL_CONSTEXPR friend inline const QVector2D operator*(float factor, const QVector2D &vector);
- Q_DECL_CONSTEXPR friend inline const QVector2D operator*(const QVector2D &vector, float factor);
- Q_DECL_CONSTEXPR friend inline const QVector2D operator*(const QVector2D &v1, const QVector2D &v2);
- Q_DECL_CONSTEXPR friend inline const QVector2D operator-(const QVector2D &vector);
- Q_DECL_CONSTEXPR friend inline const QVector2D operator/(const QVector2D &vector, float divisor);
- Q_DECL_CONSTEXPR friend inline const QVector2D operator/(const QVector2D &vector, const QVector2D &divisor);
-
- Q_DECL_CONSTEXPR friend inline bool qFuzzyCompare(const QVector2D& v1, const QVector2D& v2);
-
-#ifndef QT_NO_VECTOR3D
- QVector3D toVector3D() const;
-#endif
-#ifndef QT_NO_VECTOR4D
- QVector4D toVector4D() const;
-#endif
-
- Q_DECL_CONSTEXPR QPoint toPoint() const;
- Q_DECL_CONSTEXPR QPointF toPointF() const;
-
- operator QVariant() const;
-
-private:
- float v[2];
-
- friend class QVector3D;
- friend class QVector4D;
-};
-
-Q_DECLARE_TYPEINFO(QVector2D, Q_PRIMITIVE_TYPE);
-
-Q_DECL_CONSTEXPR inline QVector2D::QVector2D() : v{0.0f, 0.0f} {}
-
-Q_DECL_CONSTEXPR inline QVector2D::QVector2D(float xpos, float ypos) : v{xpos, ypos} {}
-
-Q_DECL_CONSTEXPR inline QVector2D::QVector2D(const QPoint& point) : v{float(point.x()), float(point.y())} {}
-
-Q_DECL_CONSTEXPR inline QVector2D::QVector2D(const QPointF& point) : v{float(point.x()), float(point.y())} {}
-
-inline bool QVector2D::isNull() const
-{
- return qIsNull(v[0]) && qIsNull(v[1]);
-}
-
-Q_DECL_CONSTEXPR inline float QVector2D::x() const { return v[0]; }
-Q_DECL_CONSTEXPR inline float QVector2D::y() const { return v[1]; }
-
-inline void QVector2D::setX(float aX) { v[0] = aX; }
-inline void QVector2D::setY(float aY) { v[1] = aY; }
-
-inline float &QVector2D::operator[](int i)
-{
- Q_ASSERT(uint(i) < 2u);
- return v[i];
-}
-
-inline float QVector2D::operator[](int i) const
-{
- Q_ASSERT(uint(i) < 2u);
- return v[i];
-}
-
-inline QVector2D &QVector2D::operator+=(const QVector2D &vector)
-{
- v[0] += vector.v[0];
- v[1] += vector.v[1];
- return *this;
-}
-
-inline QVector2D &QVector2D::operator-=(const QVector2D &vector)
-{
- v[0] -= vector.v[0];
- v[1] -= vector.v[1];
- return *this;
-}
-
-inline QVector2D &QVector2D::operator*=(float factor)
-{
- v[0] *= factor;
- v[1] *= factor;
- return *this;
-}
-
-inline QVector2D &QVector2D::operator*=(const QVector2D &vector)
-{
- v[0] *= vector.v[0];
- v[1] *= vector.v[1];
- return *this;
-}
-
-inline QVector2D &QVector2D::operator/=(float divisor)
-{
- v[0] /= divisor;
- v[1] /= divisor;
- return *this;
-}
-
-inline QVector2D &QVector2D::operator/=(const QVector2D &vector)
-{
- v[0] /= vector.v[0];
- v[1] /= vector.v[1];
- return *this;
-}
-
-QT_WARNING_PUSH
-QT_WARNING_DISABLE_CLANG("-Wfloat-equal")
-QT_WARNING_DISABLE_GCC("-Wfloat-equal")
-QT_WARNING_DISABLE_INTEL(1572)
-Q_DECL_CONSTEXPR inline bool operator==(const QVector2D &v1, const QVector2D &v2)
-{
- return v1.v[0] == v2.v[0] && v1.v[1] == v2.v[1];
-}
-
-Q_DECL_CONSTEXPR inline bool operator!=(const QVector2D &v1, const QVector2D &v2)
-{
- return v1.v[0] != v2.v[0] || v1.v[1] != v2.v[1];
-}
-QT_WARNING_POP
-
-Q_DECL_CONSTEXPR inline const QVector2D operator+(const QVector2D &v1, const QVector2D &v2)
-{
- return QVector2D(v1.v[0] + v2.v[0], v1.v[1] + v2.v[1]);
-}
-
-Q_DECL_CONSTEXPR inline const QVector2D operator-(const QVector2D &v1, const QVector2D &v2)
-{
- return QVector2D(v1.v[0] - v2.v[0], v1.v[1] - v2.v[1]);
-}
-
-Q_DECL_CONSTEXPR inline const QVector2D operator*(float factor, const QVector2D &vector)
-{
- return QVector2D(vector.v[0] * factor, vector.v[1] * factor);
-}
-
-Q_DECL_CONSTEXPR inline const QVector2D operator*(const QVector2D &vector, float factor)
-{
- return QVector2D(vector.v[0] * factor, vector.v[1] * factor);
-}
-
-Q_DECL_CONSTEXPR inline const QVector2D operator*(const QVector2D &v1, const QVector2D &v2)
-{
- return QVector2D(v1.v[0] * v2.v[0], v1.v[1] * v2.v[1]);
-}
-
-Q_DECL_CONSTEXPR inline const QVector2D operator-(const QVector2D &vector)
-{
- return QVector2D(-vector.v[0], -vector.v[1]);
-}
-
-Q_DECL_CONSTEXPR inline const QVector2D operator/(const QVector2D &vector, float divisor)
-{
- return QVector2D(vector.v[0] / divisor, vector.v[1] / divisor);
-}
-
-Q_DECL_CONSTEXPR inline const QVector2D operator/(const QVector2D &vector, const QVector2D &divisor)
-{
- return QVector2D(vector.v[0] / divisor.v[0], vector.v[1] / divisor.v[1]);
-}
-
-Q_DECL_CONSTEXPR inline bool qFuzzyCompare(const QVector2D& v1, const QVector2D& v2)
-{
- return qFuzzyCompare(v1.v[0], v2.v[0]) && qFuzzyCompare(v1.v[1], v2.v[1]);
-}
-
-Q_DECL_CONSTEXPR inline QPoint QVector2D::toPoint() const
-{
- return QPoint(qRound(v[0]), qRound(v[1]));
-}
-
-Q_DECL_CONSTEXPR inline QPointF QVector2D::toPointF() const
-{
- return QPointF(qreal(v[0]), qreal(v[1]));
-}
-
-#ifndef QT_NO_DEBUG_STREAM
-Q_GUI_EXPORT QDebug operator<<(QDebug dbg, const QVector2D &vector);
-#endif
-
-#ifndef QT_NO_DATASTREAM
-Q_GUI_EXPORT QDataStream &operator<<(QDataStream &, const QVector2D &);
-Q_GUI_EXPORT QDataStream &operator>>(QDataStream &, QVector2D &);
-#endif
-
-#endif
-
-QT_END_NAMESPACE
+#include <QtGui/qvectornd.h>
+#if 0
+#pragma qt_sync_stop_processing
#endif
diff --git a/src/gui/math3d/qvector3d.cpp b/src/gui/math3d/qvector3d.cpp
deleted file mode 100644
index 4f72c1da66..0000000000
--- a/src/gui/math3d/qvector3d.cpp
+++ /dev/null
@@ -1,793 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the QtGui module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "qvector3d.h"
-#include "qvector2d.h"
-#include "qvector4d.h"
-#include "qmatrix4x4.h"
-#include <QtCore/qdatastream.h>
-#include <QtCore/qmath.h>
-#include <QtCore/qvariant.h>
-#include <QtCore/qdebug.h>
-#include <QtCore/qrect.h>
-
-QT_BEGIN_NAMESPACE
-
-#ifndef QT_NO_VECTOR3D
-
-Q_STATIC_ASSERT_X(std::is_standard_layout<QVector3D>::value, "QVector3D is supposed to be standard layout");
-Q_STATIC_ASSERT_X(sizeof(QVector3D) == sizeof(float) * 3, "QVector3D is not supposed to have padding at the end");
-
-// QVector3D used to be defined as class QVector3D { float x, y, z; };,
-// now instead it is defined as classs QVector3D { float v[3]; };.
-// Check that binary compatibility is preserved.
-// ### Qt 6: remove all of these checks.
-
-namespace {
-
-struct QVector3DOld
-{
- float x, y, z;
-};
-
-struct QVector3DNew
-{
- float v[3];
-};
-
-Q_STATIC_ASSERT_X(std::is_standard_layout<QVector3DOld>::value, "Binary compatibility break in QVector3D");
-Q_STATIC_ASSERT_X(std::is_standard_layout<QVector3DNew>::value, "Binary compatibility break in QVector3D");
-
-Q_STATIC_ASSERT_X(sizeof(QVector3DOld) == sizeof(QVector3DNew), "Binary compatibility break in QVector3D");
-
-// requires a constexpr offsetof
-#if !defined(Q_CC_MSVC) || (_MSC_VER >= 1910)
-Q_STATIC_ASSERT_X(offsetof(QVector3DOld, x) == offsetof(QVector3DNew, v) + sizeof(QVector3DNew::v[0]) * 0, "Binary compatibility break in QVector3D");
-Q_STATIC_ASSERT_X(offsetof(QVector3DOld, y) == offsetof(QVector3DNew, v) + sizeof(QVector3DNew::v[0]) * 1, "Binary compatibility break in QVector3D");
-Q_STATIC_ASSERT_X(offsetof(QVector3DOld, z) == offsetof(QVector3DNew, v) + sizeof(QVector3DNew::v[0]) * 2, "Binary compatibility break in QVector3D");
-#endif
-
-
-} // anonymous namespace
-
-/*!
- \class QVector3D
- \brief The QVector3D class represents a vector or vertex in 3D space.
- \since 4.6
- \ingroup painting-3D
- \inmodule QtGui
-
- Vectors are one of the main building blocks of 3D representation and
- drawing. They consist of three coordinates, traditionally called
- x, y, and z.
-
- The QVector3D class can also be used to represent vertices in 3D space.
- We therefore do not need to provide a separate vertex class.
-
- \sa QVector2D, QVector4D, QQuaternion
-*/
-
-/*!
- \fn QVector3D::QVector3D()
-
- Constructs a null vector, i.e. with coordinates (0, 0, 0).
-*/
-
-/*!
- \fn QVector3D::QVector3D(Qt::Initialization)
- \since 5.5
- \internal
-
- Constructs a vector without initializing the contents.
-*/
-
-/*!
- \fn QVector3D::QVector3D(float xpos, float ypos, float zpos)
-
- Constructs a vector with coordinates (\a xpos, \a ypos, \a zpos).
-*/
-
-/*!
- \fn QVector3D::QVector3D(const QPoint& point)
-
- Constructs a vector with x and y coordinates from a 2D \a point, and a
- z coordinate of 0.
-*/
-
-/*!
- \fn QVector3D::QVector3D(const QPointF& point)
-
- Constructs a vector with x and y coordinates from a 2D \a point, and a
- z coordinate of 0.
-*/
-
-#ifndef QT_NO_VECTOR2D
-
-/*!
- Constructs a 3D vector from the specified 2D \a vector. The z
- coordinate is set to zero.
-
- \sa toVector2D()
-*/
-QVector3D::QVector3D(const QVector2D& vector)
-{
- v[0] = vector.v[0];
- v[1] = vector.v[1];
- v[2] = 0.0f;
-}
-
-/*!
- Constructs a 3D vector from the specified 2D \a vector. The z
- coordinate is set to \a zpos.
-
- \sa toVector2D()
-*/
-QVector3D::QVector3D(const QVector2D& vector, float zpos)
-{
- v[0] = vector.v[0];
- v[1] = vector.v[1];
- v[2] = zpos;
-}
-
-#endif
-
-#ifndef QT_NO_VECTOR4D
-
-/*!
- Constructs a 3D vector from the specified 4D \a vector. The w
- coordinate is dropped.
-
- \sa toVector4D()
-*/
-QVector3D::QVector3D(const QVector4D& vector)
-{
- v[0] = vector.v[0];
- v[1] = vector.v[1];
- v[2] = vector.v[2];
-}
-
-#endif
-
-/*!
- \fn bool QVector3D::isNull() const
-
- Returns \c true if the x, y, and z coordinates are set to 0.0,
- otherwise returns \c false.
-*/
-
-/*!
- \fn float QVector3D::x() const
-
- Returns the x coordinate of this point.
-
- \sa setX(), y(), z()
-*/
-
-/*!
- \fn float QVector3D::y() const
-
- Returns the y coordinate of this point.
-
- \sa setY(), x(), z()
-*/
-
-/*!
- \fn float QVector3D::z() const
-
- Returns the z coordinate of this point.
-
- \sa setZ(), x(), y()
-*/
-
-/*!
- \fn void QVector3D::setX(float x)
-
- Sets the x coordinate of this point to the given \a x coordinate.
-
- \sa x(), setY(), setZ()
-*/
-
-/*!
- \fn void QVector3D::setY(float y)
-
- Sets the y coordinate of this point to the given \a y coordinate.
-
- \sa y(), setX(), setZ()
-*/
-
-/*!
- \fn void QVector3D::setZ(float z)
-
- Sets the z coordinate of this point to the given \a z coordinate.
-
- \sa z(), setX(), setY()
-*/
-
-/*! \fn float &QVector3D::operator[](int i)
- \since 5.2
-
- Returns the component of the vector at index position \a i
- as a modifiable reference.
-
- \a i must be a valid index position in the vector (i.e., 0 <= \a i
- < 3).
-*/
-
-/*! \fn float QVector3D::operator[](int i) const
- \since 5.2
-
- Returns the component of the vector at index position \a i.
-
- \a i must be a valid index position in the vector (i.e., 0 <= \a i
- < 3).
-*/
-
-/*!
- Returns the normalized unit vector form of this vector.
-
- If this vector is null, then a null vector is returned. If the length
- of the vector is very close to 1, then the vector will be returned as-is.
- Otherwise the normalized form of the vector of length 1 will be returned.
-
- \sa length(), normalize()
-*/
-QVector3D QVector3D::normalized() const
-{
- // Need some extra precision if the length is very small.
- double len = double(v[0]) * double(v[0]) +
- double(v[1]) * double(v[1]) +
- double(v[2]) * double(v[2]);
- if (qFuzzyIsNull(len - 1.0f)) {
- return *this;
- } else if (!qFuzzyIsNull(len)) {
- double sqrtLen = std::sqrt(len);
- return QVector3D(float(double(v[0]) / sqrtLen),
- float(double(v[1]) / sqrtLen),
- float(double(v[2]) / sqrtLen));
- } else {
- return QVector3D();
- }
-}
-
-/*!
- Normalizes the currect vector in place. Nothing happens if this
- vector is a null vector or the length of the vector is very close to 1.
-
- \sa length(), normalized()
-*/
-void QVector3D::normalize()
-{
- // Need some extra precision if the length is very small.
- double len = double(v[0]) * double(v[0]) +
- double(v[1]) * double(v[1]) +
- double(v[2]) * double(v[2]);
- if (qFuzzyIsNull(len - 1.0f) || qFuzzyIsNull(len))
- return;
-
- len = std::sqrt(len);
-
- v[0] = float(double(v[0]) / len);
- v[1] = float(double(v[1]) / len);
- v[2] = float(double(v[2]) / len);
-}
-
-/*!
- \fn QVector3D &QVector3D::operator+=(const QVector3D &vector)
-
- Adds the given \a vector to this vector and returns a reference to
- this vector.
-
- \sa operator-=()
-*/
-
-/*!
- \fn QVector3D &QVector3D::operator-=(const QVector3D &vector)
-
- Subtracts the given \a vector from this vector and returns a reference to
- this vector.
-
- \sa operator+=()
-*/
-
-/*!
- \fn QVector3D &QVector3D::operator*=(float factor)
-
- Multiplies this vector's coordinates by the given \a factor, and
- returns a reference to this vector.
-
- \sa operator/=()
-*/
-
-/*!
- \fn QVector3D &QVector3D::operator*=(const QVector3D& vector)
- \overload
-
- Multiplies the components of this vector by the corresponding
- components in \a vector.
-
- Note: this is not the same as the crossProduct() of this
- vector and \a vector.
-
- \sa crossProduct()
-*/
-
-/*!
- \fn QVector3D &QVector3D::operator/=(float divisor)
-
- Divides this vector's coordinates by the given \a divisor, and
- returns a reference to this vector.
-
- \sa operator*=()
-*/
-
-/*!
- \fn QVector3D &QVector3D::operator/=(const QVector3D &vector)
- \since 5.5
-
- Divides the components of this vector by the corresponding
- components in \a vector.
-
- \sa operator*=()
-*/
-
-/*!
- Returns the dot product of \a v1 and \a v2.
-*/
-float QVector3D::dotProduct(const QVector3D& v1, const QVector3D& v2)
-{
- return v1.v[0] * v2.v[0] + v1.v[1] * v2.v[1] + v1.v[2] * v2.v[2];
-}
-
-/*!
- Returns the cross-product of vectors \a v1 and \a v2, which corresponds
- to the normal vector of a plane defined by \a v1 and \a v2.
-
- \sa normal()
-*/
-QVector3D QVector3D::crossProduct(const QVector3D& v1, const QVector3D& v2)
-{
- return QVector3D(v1.v[1] * v2.v[2] - v1.v[2] * v2.v[1],
- v1.v[2] * v2.v[0] - v1.v[0] * v2.v[2],
- v1.v[0] * v2.v[1] - v1.v[1] * v2.v[0]);
-}
-
-/*!
- Returns the normal vector of a plane defined by vectors \a v1 and \a v2,
- normalized to be a unit vector.
-
- Use crossProduct() to compute the cross-product of \a v1 and \a v2 if you
- do not need the result to be normalized to a unit vector.
-
- \sa crossProduct(), distanceToPlane()
-*/
-QVector3D QVector3D::normal(const QVector3D& v1, const QVector3D& v2)
-{
- return crossProduct(v1, v2).normalized();
-}
-
-/*!
- \overload
-
- Returns the normal vector of a plane defined by vectors
- \a v2 - \a v1 and \a v3 - \a v1, normalized to be a unit vector.
-
- Use crossProduct() to compute the cross-product of \a v2 - \a v1 and
- \a v3 - \a v1 if you do not need the result to be normalized to a
- unit vector.
-
- \sa crossProduct(), distanceToPlane()
-*/
-QVector3D QVector3D::normal
- (const QVector3D& v1, const QVector3D& v2, const QVector3D& v3)
-{
- return crossProduct((v2 - v1), (v3 - v1)).normalized();
-}
-
-/*!
- \since 5.5
-
- Returns the window coordinates of this vector initially in object/model
- coordinates using the model view matrix \a modelView, the projection matrix
- \a projection and the viewport dimensions \a viewport.
-
- When transforming from clip to normalized space, a division by the w
- component on the vector components takes place. To prevent dividing by 0 if
- w equals to 0, it is set to 1.
-
- \note the returned y coordinates are in OpenGL orientation. OpenGL expects
- the bottom to be 0 whereas for Qt top is 0.
-
- \sa unproject()
- */
-QVector3D QVector3D::project(const QMatrix4x4 &modelView, const QMatrix4x4 &projection, const QRect &viewport) const
-{
- QVector4D tmp(*this, 1.0f);
- tmp = projection * modelView * tmp;
- if (qFuzzyIsNull(tmp.w()))
- tmp.setW(1.0f);
- tmp /= tmp.w();
-
- tmp = tmp * 0.5f + QVector4D(0.5f, 0.5f, 0.5f, 0.5f);
- tmp.setX(tmp.x() * viewport.width() + viewport.x());
- tmp.setY(tmp.y() * viewport.height() + viewport.y());
-
- return tmp.toVector3D();
-}
-
-/*!
- \since 5.5
-
- Returns the object/model coordinates of this vector initially in window
- coordinates using the model view matrix \a modelView, the projection matrix
- \a projection and the viewport dimensions \a viewport.
-
- When transforming from clip to normalized space, a division by the w
- component of the vector components takes place. To prevent dividing by 0 if
- w equals to 0, it is set to 1.
-
- \note y coordinates in \a viewport should use OpenGL orientation. OpenGL
- expects the bottom to be 0 whereas for Qt top is 0.
-
- \sa project()
- */
-QVector3D QVector3D::unproject(const QMatrix4x4 &modelView, const QMatrix4x4 &projection, const QRect &viewport) const
-{
- QMatrix4x4 inverse = QMatrix4x4( projection * modelView ).inverted();
-
- QVector4D tmp(*this, 1.0f);
- tmp.setX((tmp.x() - float(viewport.x())) / float(viewport.width()));
- tmp.setY((tmp.y() - float(viewport.y())) / float(viewport.height()));
- tmp = tmp * 2.0f - QVector4D(1.0f, 1.0f, 1.0f, 1.0f);
-
- QVector4D obj = inverse * tmp;
- if (qFuzzyIsNull(obj.w()))
- obj.setW(1.0f);
- obj /= obj.w();
- return obj.toVector3D();
-}
-
-/*!
- \since 5.1
-
- Returns the distance from this vertex to a point defined by
- the vertex \a point.
-
- \sa distanceToPlane(), distanceToLine()
-*/
-float QVector3D::distanceToPoint(const QVector3D& point) const
-{
- return (*this - point).length();
-}
-
-/*!
- Returns the distance from this vertex to a plane defined by
- the vertex \a plane and a \a normal unit vector. The \a normal
- parameter is assumed to have been normalized to a unit vector.
-
- The return value will be negative if the vertex is below the plane,
- or zero if it is on the plane.
-
- \sa normal(), distanceToLine()
-*/
-float QVector3D::distanceToPlane
- (const QVector3D& plane, const QVector3D& normal) const
-{
- return dotProduct(*this - plane, normal);
-}
-
-/*!
- \overload
-
- Returns the distance from this vertex to a plane defined by
- the vertices \a plane1, \a plane2 and \a plane3.
-
- The return value will be negative if the vertex is below the plane,
- or zero if it is on the plane.
-
- The two vectors that define the plane are \a plane2 - \a plane1
- and \a plane3 - \a plane1.
-
- \sa normal(), distanceToLine()
-*/
-float QVector3D::distanceToPlane
- (const QVector3D& plane1, const QVector3D& plane2, const QVector3D& plane3) const
-{
- QVector3D n = normal(plane2 - plane1, plane3 - plane1);
- return dotProduct(*this - plane1, n);
-}
-
-/*!
- Returns the distance that this vertex is from a line defined
- by \a point and the unit vector \a direction.
-
- If \a direction is a null vector, then it does not define a line.
- In that case, the distance from \a point to this vertex is returned.
-
- \sa distanceToPlane()
-*/
-float QVector3D::distanceToLine
- (const QVector3D& point, const QVector3D& direction) const
-{
- if (direction.isNull())
- return (*this - point).length();
- QVector3D p = point + dotProduct(*this - point, direction) * direction;
- return (*this - p).length();
-}
-
-/*!
- \fn bool operator==(const QVector3D &v1, const QVector3D &v2)
- \relates QVector3D
-
- Returns \c true if \a v1 is equal to \a v2; otherwise returns \c false.
- This operator uses an exact floating-point comparison.
-*/
-
-/*!
- \fn bool operator!=(const QVector3D &v1, const QVector3D &v2)
- \relates QVector3D
-
- Returns \c true if \a v1 is not equal to \a v2; otherwise returns \c false.
- This operator uses an exact floating-point comparison.
-*/
-
-/*!
- \fn const QVector3D operator+(const QVector3D &v1, const QVector3D &v2)
- \relates QVector3D
-
- Returns a QVector3D object that is the sum of the given vectors, \a v1
- and \a v2; each component is added separately.
-
- \sa QVector3D::operator+=()
-*/
-
-/*!
- \fn const QVector3D operator-(const QVector3D &v1, const QVector3D &v2)
- \relates QVector3D
-
- Returns a QVector3D object that is formed by subtracting \a v2 from \a v1;
- each component is subtracted separately.
-
- \sa QVector3D::operator-=()
-*/
-
-/*!
- \fn const QVector3D operator*(float factor, const QVector3D &vector)
- \relates QVector3D
-
- Returns a copy of the given \a vector, multiplied by the given \a factor.
-
- \sa QVector3D::operator*=()
-*/
-
-/*!
- \fn const QVector3D operator*(const QVector3D &vector, float factor)
- \relates QVector3D
-
- Returns a copy of the given \a vector, multiplied by the given \a factor.
-
- \sa QVector3D::operator*=()
-*/
-
-/*!
- \fn const QVector3D operator*(const QVector3D &v1, const QVector3D& v2)
- \relates QVector3D
-
- Multiplies the components of \a v1 by the corresponding components in \a v2.
-
- Note: this is not the same as the crossProduct() of \a v1 and \a v2.
-
- \sa QVector3D::crossProduct()
-*/
-
-/*!
- \fn const QVector3D operator-(const QVector3D &vector)
- \relates QVector3D
- \overload
-
- Returns a QVector3D object that is formed by changing the sign of
- all three components of the given \a vector.
-
- Equivalent to \c {QVector3D(0,0,0) - vector}.
-*/
-
-/*!
- \fn const QVector3D operator/(const QVector3D &vector, float divisor)
- \relates QVector3D
-
- Returns the QVector3D object formed by dividing all three components of
- the given \a vector by the given \a divisor.
-
- \sa QVector3D::operator/=()
-*/
-
-/*!
- \fn const QVector3D operator/(const QVector3D &vector, const QVector3D &divisor)
- \relates QVector3D
- \since 5.5
-
- Returns the QVector3D object formed by dividing components of the given
- \a vector by a respective components of the given \a divisor.
-
- \sa QVector3D::operator/=()
-*/
-
-/*!
- \fn bool qFuzzyCompare(const QVector3D& v1, const QVector3D& v2)
- \relates QVector3D
-
- Returns \c true if \a v1 and \a v2 are equal, allowing for a small
- fuzziness factor for floating-point comparisons; false otherwise.
-*/
-
-#ifndef QT_NO_VECTOR2D
-
-/*!
- Returns the 2D vector form of this 3D vector, dropping the z coordinate.
-
- \sa toVector4D(), toPoint()
-*/
-QVector2D QVector3D::toVector2D() const
-{
- return QVector2D(v[0], v[1]);
-}
-
-#endif
-
-#ifndef QT_NO_VECTOR4D
-
-/*!
- Returns the 4D form of this 3D vector, with the w coordinate set to zero.
-
- \sa toVector2D(), toPoint()
-*/
-QVector4D QVector3D::toVector4D() const
-{
- return QVector4D(v[0], v[1], v[2], 0.0f);
-}
-
-#endif
-
-/*!
- \fn QPoint QVector3D::toPoint() const
-
- Returns the QPoint form of this 3D vector. The z coordinate
- is dropped.
-
- \sa toPointF(), toVector2D()
-*/
-
-/*!
- \fn QPointF QVector3D::toPointF() const
-
- Returns the QPointF form of this 3D vector. The z coordinate
- is dropped.
-
- \sa toPoint(), toVector2D()
-*/
-
-/*!
- Returns the 3D vector as a QVariant.
-*/
-QVector3D::operator QVariant() const
-{
- return QVariant(QVariant::Vector3D, this);
-}
-
-/*!
- Returns the length of the vector from the origin.
-
- \sa lengthSquared(), normalized()
-*/
-float QVector3D::length() const
-{
- // Need some extra precision if the length is very small.
- double len = double(v[0]) * double(v[0]) +
- double(v[1]) * double(v[1]) +
- double(v[2]) * double(v[2]);
- return float(std::sqrt(len));
-}
-
-/*!
- Returns the squared length of the vector from the origin.
- This is equivalent to the dot product of the vector with itself.
-
- \sa length(), dotProduct()
-*/
-float QVector3D::lengthSquared() const
-{
- return v[0] * v[0] + v[1] * v[1] + v[2] * v[2];
-}
-
-#ifndef QT_NO_DEBUG_STREAM
-
-QDebug operator<<(QDebug dbg, const QVector3D &vector)
-{
- QDebugStateSaver saver(dbg);
- dbg.nospace() << "QVector3D("
- << vector.x() << ", " << vector.y() << ", " << vector.z() << ')';
- return dbg;
-}
-
-#endif
-
-#ifndef QT_NO_DATASTREAM
-
-/*!
- \fn QDataStream &operator<<(QDataStream &stream, const QVector3D &vector)
- \relates QVector3D
-
- Writes the given \a vector to the given \a stream and returns a
- reference to the stream.
-
- \sa {Serializing Qt Data Types}
-*/
-
-QDataStream &operator<<(QDataStream &stream, const QVector3D &vector)
-{
- stream << vector.x() << vector.y() << vector.z();
- return stream;
-}
-
-/*!
- \fn QDataStream &operator>>(QDataStream &stream, QVector3D &vector)
- \relates QVector3D
-
- Reads a 3D vector from the given \a stream into the given \a vector
- and returns a reference to the stream.
-
- \sa {Serializing Qt Data Types}
-*/
-
-QDataStream &operator>>(QDataStream &stream, QVector3D &vector)
-{
- float x, y, z;
- stream >> x;
- stream >> y;
- stream >> z;
- vector.setX(x);
- vector.setY(y);
- vector.setZ(z);
- return stream;
-}
-
-#endif // QT_NO_DATASTREAM
-
-#endif // QT_NO_VECTOR3D
-
-QT_END_NAMESPACE
diff --git a/src/gui/math3d/qvector3d.h b/src/gui/math3d/qvector3d.h
index d7ffb0bcc4..a9e55a8ef8 100644
--- a/src/gui/math3d/qvector3d.h
+++ b/src/gui/math3d/qvector3d.h
@@ -1,317 +1,9 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the QtGui module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// Copyright (C) 2020 Klarälvdalens Datakonsult AB, a KDAB Group company, info@kdab.com, author Giuseppe D'Angelo <giuseppe.dangelo@kdab.com>
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
-#ifndef QVECTOR3D_H
-#define QVECTOR3D_H
-
-#include <QtGui/qtguiglobal.h>
-#include <QtCore/qpoint.h>
-#include <QtCore/qmetatype.h>
-
-QT_BEGIN_NAMESPACE
-
-
-class QMatrix4x4;
-class QVector2D;
-class QVector4D;
-class QRect;
-
-#ifndef QT_NO_VECTOR3D
-
-class Q_GUI_EXPORT QVector3D
-{
-public:
- Q_DECL_CONSTEXPR QVector3D();
- explicit QVector3D(Qt::Initialization) {}
- Q_DECL_CONSTEXPR QVector3D(float xpos, float ypos, float zpos) : v{xpos, ypos, zpos} {}
-
- Q_DECL_CONSTEXPR explicit QVector3D(const QPoint& point);
- Q_DECL_CONSTEXPR explicit QVector3D(const QPointF& point);
-#ifndef QT_NO_VECTOR2D
- QVector3D(const QVector2D& vector);
- QVector3D(const QVector2D& vector, float zpos);
-#endif
-#ifndef QT_NO_VECTOR4D
- explicit QVector3D(const QVector4D& vector);
-#endif
-
- bool isNull() const;
-
- Q_DECL_CONSTEXPR float x() const;
- Q_DECL_CONSTEXPR float y() const;
- Q_DECL_CONSTEXPR float z() const;
-
- void setX(float x);
- void setY(float y);
- void setZ(float z);
-
- float &operator[](int i);
- float operator[](int i) const;
-
- float length() const;
- float lengthSquared() const;
-
- QVector3D normalized() const;
- void normalize();
-
- QVector3D &operator+=(const QVector3D &vector);
- QVector3D &operator-=(const QVector3D &vector);
- QVector3D &operator*=(float factor);
- QVector3D &operator*=(const QVector3D& vector);
- QVector3D &operator/=(float divisor);
- inline QVector3D &operator/=(const QVector3D &vector);
-
- static float dotProduct(const QVector3D& v1, const QVector3D& v2); //In Qt 6 convert to inline and constexpr
- static QVector3D crossProduct(const QVector3D& v1, const QVector3D& v2); //in Qt 6 convert to inline and constexpr
-
- static QVector3D normal(const QVector3D& v1, const QVector3D& v2);
- static QVector3D normal
- (const QVector3D& v1, const QVector3D& v2, const QVector3D& v3);
-
- QVector3D project(const QMatrix4x4 &modelView, const QMatrix4x4 &projection, const QRect &viewport) const;
- QVector3D unproject(const QMatrix4x4 &modelView, const QMatrix4x4 &projection, const QRect &viewport) const;
-
- float distanceToPoint(const QVector3D& point) const;
- float distanceToPlane(const QVector3D& plane, const QVector3D& normal) const;
- float distanceToPlane(const QVector3D& plane1, const QVector3D& plane2, const QVector3D& plane3) const;
- float distanceToLine(const QVector3D& point, const QVector3D& direction) const;
-
- Q_DECL_CONSTEXPR friend inline bool operator==(const QVector3D &v1, const QVector3D &v2);
- Q_DECL_CONSTEXPR friend inline bool operator!=(const QVector3D &v1, const QVector3D &v2);
- Q_DECL_CONSTEXPR friend inline const QVector3D operator+(const QVector3D &v1, const QVector3D &v2);
- Q_DECL_CONSTEXPR friend inline const QVector3D operator-(const QVector3D &v1, const QVector3D &v2);
- Q_DECL_CONSTEXPR friend inline const QVector3D operator*(float factor, const QVector3D &vector);
- Q_DECL_CONSTEXPR friend inline const QVector3D operator*(const QVector3D &vector, float factor);
- Q_DECL_CONSTEXPR friend const QVector3D operator*(const QVector3D &v1, const QVector3D& v2);
- Q_DECL_CONSTEXPR friend inline const QVector3D operator-(const QVector3D &vector);
- Q_DECL_CONSTEXPR friend inline const QVector3D operator/(const QVector3D &vector, float divisor);
- Q_DECL_CONSTEXPR friend inline const QVector3D operator/(const QVector3D &vector, const QVector3D &divisor);
-
- Q_DECL_CONSTEXPR friend inline bool qFuzzyCompare(const QVector3D& v1, const QVector3D& v2);
-
-#ifndef QT_NO_VECTOR2D
- QVector2D toVector2D() const;
-#endif
-#ifndef QT_NO_VECTOR4D
- QVector4D toVector4D() const;
-#endif
-
- Q_DECL_CONSTEXPR QPoint toPoint() const;
- Q_DECL_CONSTEXPR QPointF toPointF() const;
-
- operator QVariant() const;
-
-private:
- float v[3];
-
- friend class QVector2D;
- friend class QVector4D;
-#ifndef QT_NO_MATRIX4X4
- friend QVector3D operator*(const QVector3D& vector, const QMatrix4x4& matrix);
- friend QVector3D operator*(const QMatrix4x4& matrix, const QVector3D& vector);
-#endif
-};
-
-Q_DECLARE_TYPEINFO(QVector3D, Q_PRIMITIVE_TYPE);
-
-Q_DECL_CONSTEXPR inline QVector3D::QVector3D() : v{0.0f, 0.0f, 0.0f} {}
-
-Q_DECL_CONSTEXPR inline QVector3D::QVector3D(const QPoint& point) : v{float(point.x()), float(point.y()), float(0.0f)} {}
-
-Q_DECL_CONSTEXPR inline QVector3D::QVector3D(const QPointF& point) : v{float(point.x()), float(point.y()), 0.0f} {}
-
-inline bool QVector3D::isNull() const
-{
- return qIsNull(v[0]) && qIsNull(v[1]) && qIsNull(v[2]);
-}
-
-Q_DECL_CONSTEXPR inline float QVector3D::x() const { return v[0]; }
-Q_DECL_CONSTEXPR inline float QVector3D::y() const { return v[1]; }
-Q_DECL_CONSTEXPR inline float QVector3D::z() const { return v[2]; }
-
-inline void QVector3D::setX(float aX) { v[0] = aX; }
-inline void QVector3D::setY(float aY) { v[1] = aY; }
-inline void QVector3D::setZ(float aZ) { v[2] = aZ; }
-
-inline float &QVector3D::operator[](int i)
-{
- Q_ASSERT(uint(i) < 3u);
- return v[i];
-}
-
-inline float QVector3D::operator[](int i) const
-{
- Q_ASSERT(uint(i) < 3u);
- return v[i];
-}
-
-inline QVector3D &QVector3D::operator+=(const QVector3D &vector)
-{
- v[0] += vector.v[0];
- v[1] += vector.v[1];
- v[2] += vector.v[2];
- return *this;
-}
-
-inline QVector3D &QVector3D::operator-=(const QVector3D &vector)
-{
- v[0] -= vector.v[0];
- v[1] -= vector.v[1];
- v[2] -= vector.v[2];
- return *this;
-}
-
-inline QVector3D &QVector3D::operator*=(float factor)
-{
- v[0] *= factor;
- v[1] *= factor;
- v[2] *= factor;
- return *this;
-}
-
-inline QVector3D &QVector3D::operator*=(const QVector3D& vector)
-{
- v[0] *= vector.v[0];
- v[1] *= vector.v[1];
- v[2] *= vector.v[2];
- return *this;
-}
-
-inline QVector3D &QVector3D::operator/=(float divisor)
-{
- v[0] /= divisor;
- v[1] /= divisor;
- v[2] /= divisor;
- return *this;
-}
-
-inline QVector3D &QVector3D::operator/=(const QVector3D &vector)
-{
- v[0] /= vector.v[0];
- v[1] /= vector.v[1];
- v[2] /= vector.v[2];
- return *this;
-}
-
-QT_WARNING_PUSH
-QT_WARNING_DISABLE_CLANG("-Wfloat-equal")
-QT_WARNING_DISABLE_GCC("-Wfloat-equal")
-QT_WARNING_DISABLE_INTEL(1572)
-Q_DECL_CONSTEXPR inline bool operator==(const QVector3D &v1, const QVector3D &v2)
-{
- return v1.v[0] == v2.v[0] && v1.v[1] == v2.v[1] && v1.v[2] == v2.v[2];
-}
-
-Q_DECL_CONSTEXPR inline bool operator!=(const QVector3D &v1, const QVector3D &v2)
-{
- return v1.v[0] != v2.v[0] || v1.v[1] != v2.v[1] || v1.v[2] != v2.v[2];
-}
-QT_WARNING_POP
-
-Q_DECL_CONSTEXPR inline const QVector3D operator+(const QVector3D &v1, const QVector3D &v2)
-{
- return QVector3D(v1.v[0] + v2.v[0], v1.v[1] + v2.v[1], v1.v[2] + v2.v[2]);
-}
-
-Q_DECL_CONSTEXPR inline const QVector3D operator-(const QVector3D &v1, const QVector3D &v2)
-{
- return QVector3D(v1.v[0] - v2.v[0], v1.v[1] - v2.v[1], v1.v[2] - v2.v[2]);
-}
-
-Q_DECL_CONSTEXPR inline const QVector3D operator*(float factor, const QVector3D &vector)
-{
- return QVector3D(vector.v[0] * factor, vector.v[1] * factor, vector.v[2] * factor);
-}
-
-Q_DECL_CONSTEXPR inline const QVector3D operator*(const QVector3D &vector, float factor)
-{
- return QVector3D(vector.v[0] * factor, vector.v[1] * factor, vector.v[2] * factor);
-}
-
-Q_DECL_CONSTEXPR inline const QVector3D operator*(const QVector3D &v1, const QVector3D& v2)
-{
- return QVector3D(v1.v[0] * v2.v[0], v1.v[1] * v2.v[1], v1.v[2] * v2.v[2]);
-}
-
-Q_DECL_CONSTEXPR inline const QVector3D operator-(const QVector3D &vector)
-{
- return QVector3D(-vector.v[0], -vector.v[1], -vector.v[2]);
-}
-
-Q_DECL_CONSTEXPR inline const QVector3D operator/(const QVector3D &vector, float divisor)
-{
- return QVector3D(vector.v[0] / divisor, vector.v[1] / divisor, vector.v[2] / divisor);
-}
-
-Q_DECL_CONSTEXPR inline const QVector3D operator/(const QVector3D &vector, const QVector3D &divisor)
-{
- return QVector3D(vector.v[0] / divisor.v[0], vector.v[1] / divisor.v[1], vector.v[2] / divisor.v[2]);
-}
-
-Q_DECL_CONSTEXPR inline bool qFuzzyCompare(const QVector3D& v1, const QVector3D& v2)
-{
- return qFuzzyCompare(v1.v[0], v2.v[0]) &&
- qFuzzyCompare(v1.v[1], v2.v[1]) &&
- qFuzzyCompare(v1.v[2], v2.v[2]);
-}
-
-Q_DECL_CONSTEXPR inline QPoint QVector3D::toPoint() const
-{
- return QPoint(qRound(v[0]), qRound(v[1]));
-}
-
-Q_DECL_CONSTEXPR inline QPointF QVector3D::toPointF() const
-{
- return QPointF(qreal(v[0]), qreal(v[1]));
-}
-
-#ifndef QT_NO_DEBUG_STREAM
-Q_GUI_EXPORT QDebug operator<<(QDebug dbg, const QVector3D &vector);
-#endif
-
-#ifndef QT_NO_DATASTREAM
-Q_GUI_EXPORT QDataStream &operator<<(QDataStream &, const QVector3D &);
-Q_GUI_EXPORT QDataStream &operator>>(QDataStream &, QVector3D &);
-#endif
-
-#endif
-
-QT_END_NAMESPACE
+#include <QtGui/qvectornd.h>
+#if 0
+#pragma qt_sync_stop_processing
#endif
diff --git a/src/gui/math3d/qvector4d.cpp b/src/gui/math3d/qvector4d.cpp
deleted file mode 100644
index 3a68bd6cb7..0000000000
--- a/src/gui/math3d/qvector4d.cpp
+++ /dev/null
@@ -1,674 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the QtGui module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "qvector4d.h"
-#include "qvector3d.h"
-#include "qvector2d.h"
-#include <QtCore/qdatastream.h>
-#include <QtCore/qdebug.h>
-#include <QtCore/qvariant.h>
-#include <QtCore/qmath.h>
-
-QT_BEGIN_NAMESPACE
-
-#ifndef QT_NO_VECTOR4D
-
-Q_STATIC_ASSERT_X(std::is_standard_layout<QVector4D>::value, "QVector4D is supposed to be standard layout");
-Q_STATIC_ASSERT_X(sizeof(QVector4D) == sizeof(float) * 4, "QVector4D is not supposed to have padding at the end");
-
-// QVector4D used to be defined as class QVector4D { float x, y, z, w; };,
-// now instead it is defined as classs QVector4D { float v[4]; };.
-// Check that binary compatibility is preserved.
-// ### Qt 6: remove all of these checks.
-
-namespace {
-
-struct QVector4DOld
-{
- float x, y, z, w;
-};
-
-struct QVector4DNew
-{
- float v[4];
-};
-
-Q_STATIC_ASSERT_X(std::is_standard_layout<QVector4DOld>::value, "Binary compatibility break in QVector4D");
-Q_STATIC_ASSERT_X(std::is_standard_layout<QVector4DNew>::value, "Binary compatibility break in QVector4D");
-
-Q_STATIC_ASSERT_X(sizeof(QVector4DOld) == sizeof(QVector4DNew), "Binary compatibility break in QVector4D");
-
-// requires a constexpr offsetof
-#if !defined(Q_CC_MSVC) || (_MSC_VER >= 1910)
-Q_STATIC_ASSERT_X(offsetof(QVector4DOld, x) == offsetof(QVector4DNew, v) + sizeof(QVector4DNew::v[0]) * 0, "Binary compatibility break in QVector4D");
-Q_STATIC_ASSERT_X(offsetof(QVector4DOld, y) == offsetof(QVector4DNew, v) + sizeof(QVector4DNew::v[0]) * 1, "Binary compatibility break in QVector4D");
-Q_STATIC_ASSERT_X(offsetof(QVector4DOld, z) == offsetof(QVector4DNew, v) + sizeof(QVector4DNew::v[0]) * 2, "Binary compatibility break in QVector4D");
-Q_STATIC_ASSERT_X(offsetof(QVector4DOld, w) == offsetof(QVector4DNew, v) + sizeof(QVector4DNew::v[0]) * 3, "Binary compatibility break in QVector4D");
-#endif
-
-
-} // anonymous namespace
-
-/*!
- \class QVector4D
- \brief The QVector4D class represents a vector or vertex in 4D space.
- \since 4.6
- \ingroup painting-3D
- \inmodule QtGui
-
- The QVector4D class can also be used to represent vertices in 4D space.
- We therefore do not need to provide a separate vertex class.
-
- \sa QQuaternion, QVector2D, QVector3D
-*/
-
-/*!
- \fn QVector4D::QVector4D()
-
- Constructs a null vector, i.e. with coordinates (0, 0, 0, 0).
-*/
-
-/*!
- \fn QVector4D::QVector4D(Qt::Initialization)
- \since 5.5
- \internal
-
- Constructs a vector without initializing the contents.
-*/
-
-/*!
- \fn QVector4D::QVector4D(float xpos, float ypos, float zpos, float wpos)
-
- Constructs a vector with coordinates (\a xpos, \a ypos, \a zpos, \a wpos).
-*/
-
-/*!
- \fn QVector4D::QVector4D(const QPoint& point)
-
- Constructs a vector with x and y coordinates from a 2D \a point, and
- z and w coordinates of 0.
-*/
-
-/*!
- \fn QVector4D::QVector4D(const QPointF& point)
-
- Constructs a vector with x and y coordinates from a 2D \a point, and
- z and w coordinates of 0.
-*/
-
-#ifndef QT_NO_VECTOR2D
-
-/*!
- Constructs a 4D vector from the specified 2D \a vector. The z
- and w coordinates are set to zero.
-
- \sa toVector2D()
-*/
-QVector4D::QVector4D(const QVector2D& vector)
-{
- v[0] = vector.v[0];
- v[1] = vector.v[1];
- v[2] = 0.0f;
- v[3] = 0.0f;
-}
-
-/*!
- Constructs a 4D vector from the specified 2D \a vector. The z
- and w coordinates are set to \a zpos and \a wpos respectively.
-
- \sa toVector2D()
-*/
-QVector4D::QVector4D(const QVector2D& vector, float zpos, float wpos)
-{
- v[0] = vector.v[0];
- v[1] = vector.v[1];
- v[2] = zpos;
- v[3] = wpos;
-}
-
-#endif
-
-#ifndef QT_NO_VECTOR3D
-
-/*!
- Constructs a 4D vector from the specified 3D \a vector. The w
- coordinate is set to zero.
-
- \sa toVector3D()
-*/
-QVector4D::QVector4D(const QVector3D& vector)
-{
- v[0] = vector.v[0];
- v[1] = vector.v[1];
- v[2] = vector.v[2];
- v[3] = 0.0f;
-}
-
-/*!
- Constructs a 4D vector from the specified 3D \a vector. The w
- coordinate is set to \a wpos.
-
- \sa toVector3D()
-*/
-QVector4D::QVector4D(const QVector3D& vector, float wpos)
-{
- v[0] = vector.v[0];
- v[1] = vector.v[1];
- v[2] = vector.v[2];
- v[3] = wpos;
-}
-
-#endif
-
-/*!
- \fn bool QVector4D::isNull() const
-
- Returns \c true if the x, y, z, and w coordinates are set to 0.0,
- otherwise returns \c false.
-*/
-
-/*!
- \fn float QVector4D::x() const
-
- Returns the x coordinate of this point.
-
- \sa setX(), y(), z(), w()
-*/
-
-/*!
- \fn float QVector4D::y() const
-
- Returns the y coordinate of this point.
-
- \sa setY(), x(), z(), w()
-*/
-
-/*!
- \fn float QVector4D::z() const
-
- Returns the z coordinate of this point.
-
- \sa setZ(), x(), y(), w()
-*/
-
-/*!
- \fn float QVector4D::w() const
-
- Returns the w coordinate of this point.
-
- \sa setW(), x(), y(), z()
-*/
-
-/*!
- \fn void QVector4D::setX(float x)
-
- Sets the x coordinate of this point to the given \a x coordinate.
-
- \sa x(), setY(), setZ(), setW()
-*/
-
-/*!
- \fn void QVector4D::setY(float y)
-
- Sets the y coordinate of this point to the given \a y coordinate.
-
- \sa y(), setX(), setZ(), setW()
-*/
-
-/*!
- \fn void QVector4D::setZ(float z)
-
- Sets the z coordinate of this point to the given \a z coordinate.
-
- \sa z(), setX(), setY(), setW()
-*/
-
-/*!
- \fn void QVector4D::setW(float w)
-
- Sets the w coordinate of this point to the given \a w coordinate.
-
- \sa w(), setX(), setY(), setZ()
-*/
-
-/*! \fn float &QVector4D::operator[](int i)
- \since 5.2
-
- Returns the component of the vector at index position \a i
- as a modifiable reference.
-
- \a i must be a valid index position in the vector (i.e., 0 <= \a i
- < 4).
-*/
-
-/*! \fn float QVector4D::operator[](int i) const
- \since 5.2
-
- Returns the component of the vector at index position \a i.
-
- \a i must be a valid index position in the vector (i.e., 0 <= \a i
- < 4).
-*/
-
-/*!
- Returns the length of the vector from the origin.
-
- \sa lengthSquared(), normalized()
-*/
-float QVector4D::length() const
-{
- // Need some extra precision if the length is very small.
- double len = double(v[0]) * double(v[0]) +
- double(v[1]) * double(v[1]) +
- double(v[2]) * double(v[2]) +
- double(v[3]) * double(v[3]);
- return float(std::sqrt(len));
-}
-
-/*!
- Returns the squared length of the vector from the origin.
- This is equivalent to the dot product of the vector with itself.
-
- \sa length(), dotProduct()
-*/
-float QVector4D::lengthSquared() const
-{
- return v[0] * v[0] + v[1] * v[1] + v[2] * v[2] + v[3] * v[3];
-}
-
-/*!
- Returns the normalized unit vector form of this vector.
-
- If this vector is null, then a null vector is returned. If the length
- of the vector is very close to 1, then the vector will be returned as-is.
- Otherwise the normalized form of the vector of length 1 will be returned.
-
- \sa length(), normalize()
-*/
-QVector4D QVector4D::normalized() const
-{
- // Need some extra precision if the length is very small.
- double len = double(v[0]) * double(v[0]) +
- double(v[1]) * double(v[1]) +
- double(v[2]) * double(v[2]) +
- double(v[3]) * double(v[3]);
- if (qFuzzyIsNull(len - 1.0f)) {
- return *this;
- } else if (!qFuzzyIsNull(len)) {
- double sqrtLen = std::sqrt(len);
- return QVector4D(float(double(v[0]) / sqrtLen),
- float(double(v[1]) / sqrtLen),
- float(double(v[2]) / sqrtLen),
- float(double(v[3]) / sqrtLen));
- } else {
- return QVector4D();
- }
-}
-
-/*!
- Normalizes the currect vector in place. Nothing happens if this
- vector is a null vector or the length of the vector is very close to 1.
-
- \sa length(), normalized()
-*/
-void QVector4D::normalize()
-{
- // Need some extra precision if the length is very small.
- double len = double(v[0]) * double(v[0]) +
- double(v[1]) * double(v[1]) +
- double(v[2]) * double(v[2]) +
- double(v[3]) * double(v[3]);
- if (qFuzzyIsNull(len - 1.0f) || qFuzzyIsNull(len))
- return;
-
- len = std::sqrt(len);
-
- v[0] = float(double(v[0]) / len);
- v[1] = float(double(v[1]) / len);
- v[2] = float(double(v[2]) / len);
- v[3] = float(double(v[3]) / len);
-}
-
-/*!
- \fn QVector4D &QVector4D::operator+=(const QVector4D &vector)
-
- Adds the given \a vector to this vector and returns a reference to
- this vector.
-
- \sa operator-=()
-*/
-
-/*!
- \fn QVector4D &QVector4D::operator-=(const QVector4D &vector)
-
- Subtracts the given \a vector from this vector and returns a reference to
- this vector.
-
- \sa operator+=()
-*/
-
-/*!
- \fn QVector4D &QVector4D::operator*=(float factor)
-
- Multiplies this vector's coordinates by the given \a factor, and
- returns a reference to this vector.
-
- \sa operator/=()
-*/
-
-/*!
- \fn QVector4D &QVector4D::operator*=(const QVector4D &vector)
-
- Multiplies the components of this vector by the corresponding
- components in \a vector.
-*/
-
-/*!
- \fn QVector4D &QVector4D::operator/=(float divisor)
-
- Divides this vector's coordinates by the given \a divisor, and
- returns a reference to this vector.
-
- \sa operator*=()
-*/
-
-/*!
- \fn QVector4D &QVector4D::operator/=(const QVector4D &vector)
- \since 5.5
-
- Divides the components of this vector by the corresponding
- components in \a vector.
-
- \sa operator*=()
-*/
-
-/*!
- Returns the dot product of \a v1 and \a v2.
-*/
-float QVector4D::dotProduct(const QVector4D& v1, const QVector4D& v2)
-{
- return v1.v[0] * v2.v[0] + v1.v[1] * v2.v[1] + v1.v[2] * v2.v[2] + v1.v[3] * v2.v[3];
-}
-
-/*!
- \fn bool operator==(const QVector4D &v1, const QVector4D &v2)
- \relates QVector4D
-
- Returns \c true if \a v1 is equal to \a v2; otherwise returns \c false.
- This operator uses an exact floating-point comparison.
-*/
-
-/*!
- \fn bool operator!=(const QVector4D &v1, const QVector4D &v2)
- \relates QVector4D
-
- Returns \c true if \a v1 is not equal to \a v2; otherwise returns \c false.
- This operator uses an exact floating-point comparison.
-*/
-
-/*!
- \fn const QVector4D operator+(const QVector4D &v1, const QVector4D &v2)
- \relates QVector4D
-
- Returns a QVector4D object that is the sum of the given vectors, \a v1
- and \a v2; each component is added separately.
-
- \sa QVector4D::operator+=()
-*/
-
-/*!
- \fn const QVector4D operator-(const QVector4D &v1, const QVector4D &v2)
- \relates QVector4D
-
- Returns a QVector4D object that is formed by subtracting \a v2 from \a v1;
- each component is subtracted separately.
-
- \sa QVector4D::operator-=()
-*/
-
-/*!
- \fn const QVector4D operator*(float factor, const QVector4D &vector)
- \relates QVector4D
-
- Returns a copy of the given \a vector, multiplied by the given \a factor.
-
- \sa QVector4D::operator*=()
-*/
-
-/*!
- \fn const QVector4D operator*(const QVector4D &vector, float factor)
- \relates QVector4D
-
- Returns a copy of the given \a vector, multiplied by the given \a factor.
-
- \sa QVector4D::operator*=()
-*/
-
-/*!
- \fn const QVector4D operator*(const QVector4D &v1, const QVector4D& v2)
- \relates QVector4D
-
- Returns the vector consisting of the multiplication of the
- components from \a v1 and \a v2.
-
- \sa QVector4D::operator*=()
-*/
-
-/*!
- \fn const QVector4D operator-(const QVector4D &vector)
- \relates QVector4D
- \overload
-
- Returns a QVector4D object that is formed by changing the sign of
- all three components of the given \a vector.
-
- Equivalent to \c {QVector4D(0,0,0,0) - vector}.
-*/
-
-/*!
- \fn const QVector4D operator/(const QVector4D &vector, float divisor)
- \relates QVector4D
-
- Returns the QVector4D object formed by dividing all four components of
- the given \a vector by the given \a divisor.
-
- \sa QVector4D::operator/=()
-*/
-
-/*!
- \fn const QVector4D operator/(const QVector4D &vector, const QVector4D &divisor)
- \relates QVector4D
- \since 5.5
-
- Returns the QVector4D object formed by dividing components of the given
- \a vector by a respective components of the given \a divisor.
-
- \sa QVector4D::operator/=()
-*/
-
-/*!
- \fn bool qFuzzyCompare(const QVector4D& v1, const QVector4D& v2)
- \relates QVector4D
-
- Returns \c true if \a v1 and \a v2 are equal, allowing for a small
- fuzziness factor for floating-point comparisons; false otherwise.
-*/
-
-#ifndef QT_NO_VECTOR2D
-
-/*!
- Returns the 2D vector form of this 4D vector, dropping the z and w coordinates.
-
- \sa toVector2DAffine(), toVector3D(), toPoint()
-*/
-QVector2D QVector4D::toVector2D() const
-{
- return QVector2D(v[0], v[1]);
-}
-
-/*!
- Returns the 2D vector form of this 4D vector, dividing the x and y
- coordinates by the w coordinate and dropping the z coordinate.
- Returns a null vector if w is zero.
-
- \sa toVector2D(), toVector3DAffine(), toPoint()
-*/
-QVector2D QVector4D::toVector2DAffine() const
-{
- if (qIsNull(v[3]))
- return QVector2D();
- return QVector2D(v[0] / v[3], v[1] / v[3]);
-}
-
-#endif
-
-#ifndef QT_NO_VECTOR3D
-
-/*!
- Returns the 3D vector form of this 4D vector, dropping the w coordinate.
-
- \sa toVector3DAffine(), toVector2D(), toPoint()
-*/
-QVector3D QVector4D::toVector3D() const
-{
- return QVector3D(v[0], v[1], v[2]);
-}
-
-/*!
- Returns the 3D vector form of this 4D vector, dividing the x, y, and
- z coordinates by the w coordinate. Returns a null vector if w is zero.
-
- \sa toVector3D(), toVector2DAffine(), toPoint()
-*/
-QVector3D QVector4D::toVector3DAffine() const
-{
- if (qIsNull(v[3]))
- return QVector3D();
- return QVector3D(v[0] / v[3], v[1] / v[3], v[2] / v[3]);
-}
-
-#endif
-
-/*!
- \fn QPoint QVector4D::toPoint() const
-
- Returns the QPoint form of this 4D vector. The z and w coordinates
- are dropped.
-
- \sa toPointF(), toVector2D()
-*/
-
-/*!
- \fn QPointF QVector4D::toPointF() const
-
- Returns the QPointF form of this 4D vector. The z and w coordinates
- are dropped.
-
- \sa toPoint(), toVector2D()
-*/
-
-/*!
- Returns the 4D vector as a QVariant.
-*/
-QVector4D::operator QVariant() const
-{
- return QVariant(QVariant::Vector4D, this);
-}
-
-#ifndef QT_NO_DEBUG_STREAM
-
-QDebug operator<<(QDebug dbg, const QVector4D &vector)
-{
- QDebugStateSaver saver(dbg);
- dbg.nospace() << "QVector4D("
- << vector.x() << ", " << vector.y() << ", "
- << vector.z() << ", " << vector.w() << ')';
- return dbg;
-}
-
-#endif
-
-#ifndef QT_NO_DATASTREAM
-
-/*!
- \fn QDataStream &operator<<(QDataStream &stream, const QVector4D &vector)
- \relates QVector4D
-
- Writes the given \a vector to the given \a stream and returns a
- reference to the stream.
-
- \sa {Serializing Qt Data Types}
-*/
-
-QDataStream &operator<<(QDataStream &stream, const QVector4D &vector)
-{
- stream << vector.x() << vector.y()
- << vector.z() << vector.w();
- return stream;
-}
-
-/*!
- \fn QDataStream &operator>>(QDataStream &stream, QVector4D &vector)
- \relates QVector4D
-
- Reads a 4D vector from the given \a stream into the given \a vector
- and returns a reference to the stream.
-
- \sa {Serializing Qt Data Types}
-*/
-
-QDataStream &operator>>(QDataStream &stream, QVector4D &vector)
-{
- float x, y, z, w;
- stream >> x;
- stream >> y;
- stream >> z;
- stream >> w;
- vector.setX(x);
- vector.setY(y);
- vector.setZ(z);
- vector.setW(w);
- return stream;
-}
-
-#endif // QT_NO_DATASTREAM
-
-#endif // QT_NO_VECTOR4D
-
-QT_END_NAMESPACE
diff --git a/src/gui/math3d/qvector4d.h b/src/gui/math3d/qvector4d.h
index afcc71fa88..a9e55a8ef8 100644
--- a/src/gui/math3d/qvector4d.h
+++ b/src/gui/math3d/qvector4d.h
@@ -1,318 +1,9 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the QtGui module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// Copyright (C) 2020 Klarälvdalens Datakonsult AB, a KDAB Group company, info@kdab.com, author Giuseppe D'Angelo <giuseppe.dangelo@kdab.com>
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
-#ifndef QVECTOR4D_H
-#define QVECTOR4D_H
-
-#include <QtGui/qtguiglobal.h>
-#include <QtCore/qpoint.h>
-#include <QtCore/qmetatype.h>
-
-QT_BEGIN_NAMESPACE
-
-
-class QMatrix4x4;
-class QVector2D;
-class QVector3D;
-
-#ifndef QT_NO_VECTOR4D
-
-class Q_GUI_EXPORT QVector4D
-{
-public:
- Q_DECL_CONSTEXPR QVector4D();
- explicit QVector4D(Qt::Initialization) {}
- Q_DECL_CONSTEXPR QVector4D(float xpos, float ypos, float zpos, float wpos);
- Q_DECL_CONSTEXPR explicit QVector4D(const QPoint& point);
- Q_DECL_CONSTEXPR explicit QVector4D(const QPointF& point);
-#ifndef QT_NO_VECTOR2D
- QVector4D(const QVector2D& vector);
- QVector4D(const QVector2D& vector, float zpos, float wpos);
-#endif
-#ifndef QT_NO_VECTOR3D
- QVector4D(const QVector3D& vector);
- QVector4D(const QVector3D& vector, float wpos);
-#endif
-
- bool isNull() const;
-
- Q_DECL_CONSTEXPR float x() const;
- Q_DECL_CONSTEXPR float y() const;
- Q_DECL_CONSTEXPR float z() const;
- Q_DECL_CONSTEXPR float w() const;
-
- void setX(float x);
- void setY(float y);
- void setZ(float z);
- void setW(float w);
-
- float &operator[](int i);
- float operator[](int i) const;
-
- float length() const;
- float lengthSquared() const; //In Qt 6 convert to inline and constexpr
-
- Q_REQUIRED_RESULT QVector4D normalized() const;
- void normalize();
-
- QVector4D &operator+=(const QVector4D &vector);
- QVector4D &operator-=(const QVector4D &vector);
- QVector4D &operator*=(float factor);
- QVector4D &operator*=(const QVector4D &vector);
- QVector4D &operator/=(float divisor);
- inline QVector4D &operator/=(const QVector4D &vector);
-
- static float dotProduct(const QVector4D& v1, const QVector4D& v2); //In Qt 6 convert to inline and constexpr
-
- Q_DECL_CONSTEXPR friend inline bool operator==(const QVector4D &v1, const QVector4D &v2);
- Q_DECL_CONSTEXPR friend inline bool operator!=(const QVector4D &v1, const QVector4D &v2);
- Q_DECL_CONSTEXPR friend inline const QVector4D operator+(const QVector4D &v1, const QVector4D &v2);
- Q_DECL_CONSTEXPR friend inline const QVector4D operator-(const QVector4D &v1, const QVector4D &v2);
- Q_DECL_CONSTEXPR friend inline const QVector4D operator*(float factor, const QVector4D &vector);
- Q_DECL_CONSTEXPR friend inline const QVector4D operator*(const QVector4D &vector, float factor);
- Q_DECL_CONSTEXPR friend inline const QVector4D operator*(const QVector4D &v1, const QVector4D& v2);
- Q_DECL_CONSTEXPR friend inline const QVector4D operator-(const QVector4D &vector);
- Q_DECL_CONSTEXPR friend inline const QVector4D operator/(const QVector4D &vector, float divisor);
- Q_DECL_CONSTEXPR friend inline const QVector4D operator/(const QVector4D &vector, const QVector4D &divisor);
-
- Q_DECL_CONSTEXPR friend inline bool qFuzzyCompare(const QVector4D& v1, const QVector4D& v2);
-
-#ifndef QT_NO_VECTOR2D
- QVector2D toVector2D() const;
- QVector2D toVector2DAffine() const;
-#endif
-#ifndef QT_NO_VECTOR3D
- QVector3D toVector3D() const;
- QVector3D toVector3DAffine() const;
-#endif
-
- Q_DECL_CONSTEXPR QPoint toPoint() const;
- Q_DECL_CONSTEXPR QPointF toPointF() const;
-
- operator QVariant() const;
-
-private:
- float v[4];
-
- friend class QVector2D;
- friend class QVector3D;
-#ifndef QT_NO_MATRIX4X4
- friend QVector4D operator*(const QVector4D& vector, const QMatrix4x4& matrix);
- friend QVector4D operator*(const QMatrix4x4& matrix, const QVector4D& vector);
-#endif
-};
-
-Q_DECLARE_TYPEINFO(QVector4D, Q_PRIMITIVE_TYPE);
-
-Q_DECL_CONSTEXPR inline QVector4D::QVector4D() : v{0.0f, 0.0f, 0.0f, 0.0f} {}
-
-Q_DECL_CONSTEXPR inline QVector4D::QVector4D(float xpos, float ypos, float zpos, float wpos) : v{xpos, ypos, zpos, wpos} {}
-
-Q_DECL_CONSTEXPR inline QVector4D::QVector4D(const QPoint& point) : v{float(point.x()), float(point.y()), 0.0f, 0.0f} {}
-
-Q_DECL_CONSTEXPR inline QVector4D::QVector4D(const QPointF& point) : v{float(point.x()), float(point.y()), 0.0f, 0.0f} {}
-
-inline bool QVector4D::isNull() const
-{
- return qIsNull(v[0]) && qIsNull(v[1]) && qIsNull(v[2]) && qIsNull(v[3]);
-}
-
-Q_DECL_CONSTEXPR inline float QVector4D::x() const { return v[0]; }
-Q_DECL_CONSTEXPR inline float QVector4D::y() const { return v[1]; }
-Q_DECL_CONSTEXPR inline float QVector4D::z() const { return v[2]; }
-Q_DECL_CONSTEXPR inline float QVector4D::w() const { return v[3]; }
-
-inline void QVector4D::setX(float aX) { v[0] = aX; }
-inline void QVector4D::setY(float aY) { v[1] = aY; }
-inline void QVector4D::setZ(float aZ) { v[2] = aZ; }
-inline void QVector4D::setW(float aW) { v[3] = aW; }
-
-inline float &QVector4D::operator[](int i)
-{
- Q_ASSERT(uint(i) < 4u);
- return v[i];
-}
-
-inline float QVector4D::operator[](int i) const
-{
- Q_ASSERT(uint(i) < 4u);
- return v[i];
-}
-
-inline QVector4D &QVector4D::operator+=(const QVector4D &vector)
-{
- v[0] += vector.v[0];
- v[1] += vector.v[1];
- v[2] += vector.v[2];
- v[3] += vector.v[3];
- return *this;
-}
-
-inline QVector4D &QVector4D::operator-=(const QVector4D &vector)
-{
- v[0] -= vector.v[0];
- v[1] -= vector.v[1];
- v[2] -= vector.v[2];
- v[3] -= vector.v[3];
- return *this;
-}
-
-inline QVector4D &QVector4D::operator*=(float factor)
-{
- v[0] *= factor;
- v[1] *= factor;
- v[2] *= factor;
- v[3] *= factor;
- return *this;
-}
-
-inline QVector4D &QVector4D::operator*=(const QVector4D &vector)
-{
- v[0] *= vector.v[0];
- v[1] *= vector.v[1];
- v[2] *= vector.v[2];
- v[3] *= vector.v[3];
- return *this;
-}
-
-inline QVector4D &QVector4D::operator/=(float divisor)
-{
- v[0] /= divisor;
- v[1] /= divisor;
- v[2] /= divisor;
- v[3] /= divisor;
- return *this;
-}
-
-inline QVector4D &QVector4D::operator/=(const QVector4D &vector)
-{
- v[0] /= vector.v[0];
- v[1] /= vector.v[1];
- v[2] /= vector.v[2];
- v[3] /= vector.v[3];
- return *this;
-}
-
-QT_WARNING_PUSH
-QT_WARNING_DISABLE_CLANG("-Wfloat-equal")
-QT_WARNING_DISABLE_GCC("-Wfloat-equal")
-QT_WARNING_DISABLE_INTEL(1572)
-Q_DECL_CONSTEXPR inline bool operator==(const QVector4D &v1, const QVector4D &v2)
-{
- return v1.v[0] == v2.v[0] && v1.v[1] == v2.v[1] && v1.v[2] == v2.v[2] && v1.v[3] == v2.v[3];
-}
-
-Q_DECL_CONSTEXPR inline bool operator!=(const QVector4D &v1, const QVector4D &v2)
-{
- return v1.v[0] != v2.v[0] || v1.v[1] != v2.v[1] || v1.v[2] != v2.v[2] || v1.v[3] != v2.v[3];
-}
-QT_WARNING_POP
-
-Q_DECL_CONSTEXPR inline const QVector4D operator+(const QVector4D &v1, const QVector4D &v2)
-{
- return QVector4D(v1.v[0] + v2.v[0], v1.v[1] + v2.v[1], v1.v[2] + v2.v[2], v1.v[3] + v2.v[3]);
-}
-
-Q_DECL_CONSTEXPR inline const QVector4D operator-(const QVector4D &v1, const QVector4D &v2)
-{
- return QVector4D(v1.v[0] - v2.v[0], v1.v[1] - v2.v[1], v1.v[2] - v2.v[2], v1.v[3] - v2.v[3]);
-}
-
-Q_DECL_CONSTEXPR inline const QVector4D operator*(float factor, const QVector4D &vector)
-{
- return QVector4D(vector.v[0] * factor, vector.v[1] * factor, vector.v[2] * factor, vector.v[3] * factor);
-}
-
-Q_DECL_CONSTEXPR inline const QVector4D operator*(const QVector4D &vector, float factor)
-{
- return QVector4D(vector.v[0] * factor, vector.v[1] * factor, vector.v[2] * factor, vector.v[3] * factor);
-}
-
-Q_DECL_CONSTEXPR inline const QVector4D operator*(const QVector4D &v1, const QVector4D& v2)
-{
- return QVector4D(v1.v[0] * v2.v[0], v1.v[1] * v2.v[1], v1.v[2] * v2.v[2], v1.v[3] * v2.v[3]);
-}
-
-Q_DECL_CONSTEXPR inline const QVector4D operator-(const QVector4D &vector)
-{
- return QVector4D(-vector.v[0], -vector.v[1], -vector.v[2], -vector.v[3]);
-}
-
-Q_DECL_CONSTEXPR inline const QVector4D operator/(const QVector4D &vector, float divisor)
-{
- return QVector4D(vector.v[0] / divisor, vector.v[1] / divisor, vector.v[2] / divisor, vector.v[3] / divisor);
-}
-
-Q_DECL_CONSTEXPR inline const QVector4D operator/(const QVector4D &vector, const QVector4D &divisor)
-{
- return QVector4D(vector.v[0] / divisor.v[0], vector.v[1] / divisor.v[1], vector.v[2] / divisor.v[2], vector.v[3] / divisor.v[3]);
-}
-
-Q_DECL_CONSTEXPR inline bool qFuzzyCompare(const QVector4D& v1, const QVector4D& v2)
-{
- return qFuzzyCompare(v1.v[0], v2.v[0]) &&
- qFuzzyCompare(v1.v[1], v2.v[1]) &&
- qFuzzyCompare(v1.v[2], v2.v[2]) &&
- qFuzzyCompare(v1.v[3], v2.v[3]);
-}
-
-Q_DECL_CONSTEXPR inline QPoint QVector4D::toPoint() const
-{
- return QPoint(qRound(v[0]), qRound(v[1]));
-}
-
-Q_DECL_CONSTEXPR inline QPointF QVector4D::toPointF() const
-{
- return QPointF(qreal(v[0]), qreal(v[1]));
-}
-
-#ifndef QT_NO_DEBUG_STREAM
-Q_GUI_EXPORT QDebug operator<<(QDebug dbg, const QVector4D &vector);
-#endif
-
-#ifndef QT_NO_DATASTREAM
-Q_GUI_EXPORT QDataStream &operator<<(QDataStream &, const QVector4D &);
-Q_GUI_EXPORT QDataStream &operator>>(QDataStream &, QVector4D &);
-#endif
-
-#endif
-
-QT_END_NAMESPACE
+#include <QtGui/qvectornd.h>
+#if 0
+#pragma qt_sync_stop_processing
#endif
diff --git a/src/gui/math3d/qvectornd.cpp b/src/gui/math3d/qvectornd.cpp
new file mode 100644
index 0000000000..dcd7bdbcf8
--- /dev/null
+++ b/src/gui/math3d/qvectornd.cpp
@@ -0,0 +1,1642 @@
+// Copyright (C) 2016 The Qt Company Ltd.
+// Copyright (C) 2020 Klarälvdalens Datakonsult AB, a KDAB Group company, info@kdab.com, author Giuseppe D'Angelo <giuseppe.dangelo@kdab.com>
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
+
+#include "qvectornd.h"
+#include <QtCore/qdatastream.h>
+#include <QtCore/qdebug.h>
+#include <QtCore/qvariant.h>
+#include <QtGui/qmatrix4x4.h>
+
+QT_BEGIN_NAMESPACE
+
+#ifndef QT_NO_VECTOR2D
+
+/*!
+ \class QVector2D
+ \brief The QVector2D class represents a vector or vertex in 2D space.
+ \since 4.6
+ \ingroup painting
+ \ingroup painting-3D
+ \inmodule QtGui
+
+ Vectors are one of the main building blocks of 2D representation and
+ drawing. They consist of two finite floating-point coordinates,
+ traditionally called x and y.
+
+ The QVector2D class can also be used to represent vertices in 2D space.
+ We therefore do not need to provide a separate vertex class.
+
+ \sa QVector3D, QVector4D, QQuaternion
+*/
+
+/*!
+ \fn QVector2D::QVector2D()
+
+ Constructs a null vector, i.e. with coordinates (0, 0).
+*/
+
+/*!
+ \fn QVector2D::QVector2D(Qt::Initialization)
+ \since 5.5
+ \internal
+
+ Constructs a vector without initializing the contents.
+*/
+
+/*!
+ \fn QVector2D::QVector2D(float xpos, float ypos)
+
+ Constructs a vector with coordinates (\a xpos, \a ypos).
+ Both coordinates must be finite.
+*/
+
+/*!
+ \fn QVector2D::QVector2D(QPoint point)
+
+ Constructs a vector with x and y coordinates from a 2D \a point.
+*/
+
+/*!
+ \fn QVector2D::QVector2D(QPointF point)
+
+ Constructs a vector with x and y coordinates from a 2D \a point.
+*/
+
+#ifndef QT_NO_VECTOR3D
+
+/*!
+ \fn QVector2D::QVector2D(QVector3D vector)
+
+ Constructs a vector with x and y coordinates from a 3D \a vector.
+ The z coordinate of \a vector is dropped.
+
+ \sa toVector3D()
+*/
+
+#endif
+
+#ifndef QT_NO_VECTOR4D
+
+/*!
+ \fn QVector2D::QVector2D(QVector4D vector)
+
+ Constructs a vector with x and y coordinates from a 3D \a vector.
+ The z and w coordinates of \a vector are dropped.
+
+ \sa toVector4D()
+*/
+
+#endif
+
+/*!
+ \fn bool QVector2D::isNull() const
+
+ Returns \c true if the x and y coordinates are set to 0.0,
+ otherwise returns \c false.
+*/
+
+/*!
+ \fn float QVector2D::x() const
+
+ Returns the x coordinate of this point.
+
+ \sa setX(), y()
+*/
+
+/*!
+ \fn float QVector2D::y() const
+
+ Returns the y coordinate of this point.
+
+ \sa setY(), x()
+*/
+
+/*!
+ \fn void QVector2D::setX(float x)
+
+ Sets the x coordinate of this point to the given finite \a x coordinate.
+
+ \sa x(), setY()
+*/
+
+/*!
+ \fn void QVector2D::setY(float y)
+
+ Sets the y coordinate of this point to the given finite \a y coordinate.
+
+ \sa y(), setX()
+*/
+
+/*! \fn float &QVector2D::operator[](int i)
+ \since 5.2
+
+ Returns the component of the vector at index position \a i
+ as a modifiable reference.
+
+ \a i must be a valid index position in the vector (i.e., 0 <= \a i
+ < 2).
+*/
+
+/*! \fn float QVector2D::operator[](int i) const
+ \since 5.2
+
+ Returns the component of the vector at index position \a i.
+
+ \a i must be a valid index position in the vector (i.e., 0 <= \a i
+ < 2).
+*/
+
+/*!
+ \fn float QVector2D::length() const
+
+ Returns the length of the vector from the origin.
+
+ \sa lengthSquared(), normalized()
+*/
+
+/*!
+ \fn float QVector2D::lengthSquared() const
+
+ Returns the squared length of the vector from the origin.
+ This is equivalent to the dot product of the vector with itself.
+
+ \sa length(), dotProduct()
+*/
+
+/*!
+ \fn QVector2D QVector2D::normalized() const
+
+ Returns the normalized unit vector form of this vector.
+
+ If this vector is null, then a null vector is returned. If the length
+ of the vector is very close to 1, then the vector will be returned as-is.
+ Otherwise the normalized form of the vector of length 1 will be returned.
+
+ \sa length(), normalize()
+*/
+
+/*!
+ \fn void QVector2D::normalize()
+
+ Normalizes the current vector in place. Nothing happens if this
+ vector is a null vector or the length of the vector is very close to 1.
+
+ \sa length(), normalized()
+*/
+
+/*!
+ \fn float QVector2D::distanceToPoint(QVector2D point) const
+ \since 5.1
+
+ Returns the distance from this vertex to a point defined by
+ the vertex \a point.
+
+ \sa distanceToLine()
+*/
+
+/*!
+ \fn float QVector2D::distanceToLine(QVector2D point, QVector2D direction) const
+ \since 5.1
+
+ Returns the distance that this vertex is from a line defined
+ by \a point and the unit vector \a direction.
+
+ If \a direction is a null vector, then it does not define a line.
+ In that case, the distance from \a point to this vertex is returned.
+
+ \sa distanceToPoint()
+*/
+
+/*!
+ \fn QVector2D &QVector2D::operator+=(QVector2D vector)
+
+ Adds the given \a vector to this vector and returns a reference to
+ this vector.
+
+ \sa operator-=()
+*/
+
+/*!
+ \fn QVector2D &QVector2D::operator-=(QVector2D vector)
+
+ Subtracts the given \a vector from this vector and returns a reference to
+ this vector.
+
+ \sa operator+=()
+*/
+
+/*!
+ \fn QVector2D &QVector2D::operator*=(float factor)
+
+ Multiplies this vector's coordinates by the given finite \a factor and
+ returns a reference to this vector.
+
+ \sa operator/=(), operator*()
+*/
+
+/*!
+ \fn QVector2D &QVector2D::operator*=(QVector2D vector)
+
+ Multiplies each component of this vector by the corresponding component of
+ \a vector and returns a reference to this vector.
+
+ \note This is not a cross product of this vector with \a vector. (Its
+ components add up to the dot product of this vector and \a vector.)
+
+ \sa operator/=(), operator*()
+*/
+
+/*!
+ \fn QVector2D &QVector2D::operator/=(float divisor)
+
+ Divides this vector's coordinates by the given \a divisor and returns a
+ reference to this vector. The \a divisor must not be either zero or NaN.
+
+ \sa operator*=()
+*/
+
+/*!
+ \fn QVector2D &QVector2D::operator/=(QVector2D vector)
+ \since 5.5
+
+ Divides each component of this vector by the corresponding component of \a
+ vector and returns a reference to this vector.
+
+ The \a vector must have no component that is either zero or NaN.
+
+ \sa operator*=(), operator/()
+*/
+
+/*!
+ \fn float QVector2D::dotProduct(QVector2D v1, QVector2D v2)
+
+ Returns the dot product of \a v1 and \a v2.
+*/
+
+/*!
+ \fn bool QVector2D::operator==(QVector2D v1, QVector2D v2)
+
+ Returns \c true if \a v1 is equal to \a v2; otherwise returns \c false.
+ This operator uses an exact floating-point comparison.
+*/
+
+/*!
+ \fn bool QVector2D::operator!=(QVector2D v1, QVector2D v2)
+
+ Returns \c true if \a v1 is not equal to \a v2; otherwise returns \c false.
+ This operator uses an exact floating-point comparison.
+*/
+
+/*! //! friend
+ \fn const QVector2D QVector2D::operator+(QVector2D v1, QVector2D v2)
+
+ Returns a QVector2D object that is the sum of the given vectors, \a v1
+ and \a v2; each component is added separately.
+
+ \sa QVector2D::operator+=()
+*/
+
+/*! //! friend
+ \fn const QVector2D QVector2D::operator-(QVector2D v1, QVector2D v2)
+
+ Returns a QVector2D object that is formed by subtracting \a v2 from \a v1;
+ each component is subtracted separately.
+
+ \sa QVector2D::operator-=()
+*/
+
+/*! //! friend
+ \fn const QVector2D QVector2D::operator*(float factor, QVector2D vector)
+
+ Returns a copy of the given \a vector, multiplied by the given finite \a factor.
+
+ \sa QVector2D::operator*=()
+*/
+
+/*! //! friend
+ \fn const QVector2D QVector2D::operator*(QVector2D vector, float factor)
+
+ Returns a copy of the given \a vector, multiplied by the given finite \a factor.
+
+ \sa QVector2D::operator*=()
+*/
+
+/*! //! friend
+ \fn const QVector2D QVector2D::operator*(QVector2D v1, QVector2D v2)
+
+ Returns the QVector2D object formed by multiplying each component of \a v1
+ by the corresponding component of \a v2.
+
+ \note This is not a cross product of \a v1 and \a v2 in any sense.
+ (Its components add up to the dot product of \a v1 and \a v2.)
+
+ \sa QVector2D::operator*=()
+*/
+
+/*! //! friend
+ \fn const QVector2D QVector2D::operator-(QVector2D vector)
+ \overload
+
+ Returns a QVector2D object that is formed by changing the sign of each
+ component of the given \a vector.
+
+ Equivalent to \c {QVector2D(0,0) - vector}.
+*/
+
+/*! //! friend
+ \fn const QVector2D QVector2D::operator/(QVector2D vector, float divisor)
+
+ Returns the QVector2D object formed by dividing each component of the given
+ \a vector by the given \a divisor.
+
+ The \a divisor must not be either zero or NaN.
+
+ \sa QVector2D::operator/=()
+*/
+
+/*! //! friend
+ \fn const QVector2D QVector2D::operator/(QVector2D vector, QVector2D divisor)
+ \since 5.5
+
+ Returns the QVector2D object formed by dividing each component of the given
+ \a vector by the corresponding component of the given \a divisor.
+
+ The \a divisor must have no component that is either zero or NaN.
+
+ \sa QVector2D::operator/=()
+*/
+
+/*! //! friend
+ \fn bool QVector2D::qFuzzyCompare(QVector2D v1, QVector2D v2)
+
+ Returns \c true if \a v1 and \a v2 are equal, allowing for a small
+ fuzziness factor for floating-point comparisons; false otherwise.
+*/
+bool qFuzzyCompare(QVector2D v1, QVector2D v2) noexcept
+{
+ return qFuzzyCompare(v1.v[0], v2.v[0]) && qFuzzyCompare(v1.v[1], v2.v[1]);
+}
+
+#ifndef QT_NO_VECTOR3D
+/*!
+ \fn QVector3D QVector2D::toVector3D() const
+
+ Returns the 3D form of this 2D vector, with the z coordinate set to zero.
+
+ \sa toVector4D(), toPoint()
+*/
+#endif
+
+#ifndef QT_NO_VECTOR4D
+/*!
+ \fn QVector4D QVector2D::toVector4D() const
+
+ Returns the 4D form of this 2D vector, with the z and w coordinates set to zero.
+
+ \sa toVector3D(), toPoint()
+*/
+#endif
+
+/*!
+ \fn QPoint QVector2D::toPoint() const
+
+ Returns the QPoint form of this 2D vector.
+ Each coordinate is rounded to the nearest integer.
+
+ \sa toPointF(), toVector3D()
+*/
+
+/*!
+ \fn QPointF QVector2D::toPointF() const
+
+ Returns the QPointF form of this 2D vector.
+
+ \sa toPoint(), toVector3D()
+*/
+
+/*!
+ Returns the 2D vector as a QVariant.
+*/
+QVector2D::operator QVariant() const
+{
+ return QVariant::fromValue(*this);
+}
+
+#ifndef QT_NO_DEBUG_STREAM
+
+QDebug operator<<(QDebug dbg, QVector2D vector)
+{
+ QDebugStateSaver saver(dbg);
+ dbg.nospace() << "QVector2D(" << vector.x() << ", " << vector.y() << ')';
+ return dbg;
+}
+
+#endif
+
+#ifndef QT_NO_DATASTREAM
+
+/*!
+ \fn QDataStream &operator<<(QDataStream &stream, QVector2D vector)
+ \relates QVector2D
+
+ Writes the given \a vector to the given \a stream and returns a
+ reference to the stream.
+
+ \sa {Serializing Qt Data Types}
+*/
+
+QDataStream &operator<<(QDataStream &stream, QVector2D vector)
+{
+ stream << vector.x() << vector.y();
+ return stream;
+}
+
+/*!
+ \fn QDataStream &operator>>(QDataStream &stream, QVector2D &vector)
+ \relates QVector2D
+
+ Reads a 2D vector from the given \a stream into the given \a vector
+ and returns a reference to the stream.
+
+ \sa {Serializing Qt Data Types}
+*/
+
+QDataStream &operator>>(QDataStream &stream, QVector2D &vector)
+{
+ float x, y;
+ stream >> x;
+ stream >> y;
+ Q_ASSERT(qIsFinite(x) && qIsFinite(y));
+ vector.setX(x);
+ vector.setY(y);
+ return stream;
+}
+
+#endif // QT_NO_DATASTREAM
+
+#endif // QT_NO_VECTOR2D
+
+
+
+#ifndef QT_NO_VECTOR3D
+
+/*!
+ \class QVector3D
+ \brief The QVector3D class represents a vector or vertex in 3D space.
+ \since 4.6
+ \ingroup painting-3D
+ \inmodule QtGui
+
+ Vectors are one of the main building blocks of 3D representation and
+ drawing. They consist of three finite floating-point coordinates,
+ traditionally called x, y, and z.
+
+ The QVector3D class can also be used to represent vertices in 3D space.
+ We therefore do not need to provide a separate vertex class.
+
+ \sa QVector2D, QVector4D, QQuaternion
+*/
+
+/*!
+ \fn QVector3D::QVector3D()
+
+ Constructs a null vector, i.e. with coordinates (0, 0, 0).
+*/
+
+/*!
+ \fn QVector3D::QVector3D(Qt::Initialization)
+ \since 5.5
+ \internal
+
+ Constructs a vector without initializing the contents.
+*/
+
+/*!
+ \fn QVector3D::QVector3D(float xpos, float ypos, float zpos)
+
+ Constructs a vector with coordinates (\a xpos, \a ypos, \a zpos).
+ All parameters must be finite.
+*/
+
+/*!
+ \fn QVector3D::QVector3D(QPoint point)
+
+ Constructs a vector with x and y coordinates from a 2D \a point, and a
+ z coordinate of 0.
+*/
+
+/*!
+ \fn QVector3D::QVector3D(QPointF point)
+
+ Constructs a vector with x and y coordinates from a 2D \a point, and a
+ z coordinate of 0.
+*/
+
+#ifndef QT_NO_VECTOR2D
+
+/*!
+ \fn QVector3D::QVector3D(QVector2D vector)
+
+ Constructs a 3D vector from the specified 2D \a vector. The z
+ coordinate is set to zero.
+
+ \sa toVector2D()
+*/
+
+/*!
+ \fn QVector3D::QVector3D(QVector2D vector, float zpos)
+
+ Constructs a 3D vector from the specified 2D \a vector. The z
+ coordinate is set to \a zpos, which must be finite.
+
+ \sa toVector2D()
+*/
+#endif
+
+#ifndef QT_NO_VECTOR4D
+
+/*!
+ \fn QVector3D::QVector3D(QVector4D vector)
+
+ Constructs a 3D vector from the specified 4D \a vector. The w
+ coordinate is dropped.
+
+ \sa toVector4D()
+*/
+
+#endif
+
+/*!
+ \fn bool QVector3D::isNull() const
+
+ Returns \c true if the x, y, and z coordinates are set to 0.0,
+ otherwise returns \c false.
+*/
+
+/*!
+ \fn float QVector3D::x() const
+
+ Returns the x coordinate of this point.
+
+ \sa setX(), y(), z()
+*/
+
+/*!
+ \fn float QVector3D::y() const
+
+ Returns the y coordinate of this point.
+
+ \sa setY(), x(), z()
+*/
+
+/*!
+ \fn float QVector3D::z() const
+
+ Returns the z coordinate of this point.
+
+ \sa setZ(), x(), y()
+*/
+
+/*!
+ \fn void QVector3D::setX(float x)
+
+ Sets the x coordinate of this point to the given finite \a x coordinate.
+
+ \sa x(), setY(), setZ()
+*/
+
+/*!
+ \fn void QVector3D::setY(float y)
+
+ Sets the y coordinate of this point to the given finite \a y coordinate.
+
+ \sa y(), setX(), setZ()
+*/
+
+/*!
+ \fn void QVector3D::setZ(float z)
+
+ Sets the z coordinate of this point to the given finite \a z coordinate.
+
+ \sa z(), setX(), setY()
+*/
+
+/*! \fn float &QVector3D::operator[](int i)
+ \since 5.2
+
+ Returns the component of the vector at index position \a i
+ as a modifiable reference.
+
+ \a i must be a valid index position in the vector (i.e., 0 <= \a i
+ < 3).
+*/
+
+/*! \fn float QVector3D::operator[](int i) const
+ \since 5.2
+
+ Returns the component of the vector at index position \a i.
+
+ \a i must be a valid index position in the vector (i.e., 0 <= \a i
+ < 3).
+*/
+
+/*!
+ \fn QVector3D QVector3D::normalized() const
+
+ Returns the normalized unit vector form of this vector.
+
+ If this vector is null, then a null vector is returned. If the length
+ of the vector is very close to 1, then the vector will be returned as-is.
+ Otherwise the normalized form of the vector of length 1 will be returned.
+
+ \sa length(), normalize()
+*/
+
+/*!
+ \fn void QVector3D::normalize()
+
+ Normalizes the current vector in place. Nothing happens if this
+ vector is a null vector or the length of the vector is very close to 1.
+
+ \sa length(), normalized()
+*/
+
+/*!
+ \fn QVector3D &QVector3D::operator+=(QVector3D vector)
+
+ Adds the given \a vector to this vector and returns a reference to
+ this vector.
+
+ \sa operator-=()
+*/
+
+/*!
+ \fn QVector3D &QVector3D::operator-=(QVector3D vector)
+
+ Subtracts the given \a vector from this vector and returns a reference to
+ this vector.
+
+ \sa operator+=()
+*/
+
+/*!
+ \fn QVector3D &QVector3D::operator*=(float factor)
+
+ Multiplies this vector's coordinates by the given finite \a factor and
+ returns a reference to this vector.
+
+ \sa operator/=(), operator*()
+*/
+
+/*!
+ \fn QVector3D &QVector3D::operator*=(QVector3D vector)
+ \overload
+
+ Multiplies each component of this vector by the corresponding component in
+ \a vector and returns a reference to this vector.
+
+ Note: this is not the same as the crossProduct() of this vector and
+ \a vector. (Its components add up to the dot product of this vector and
+ \a vector.)
+
+ \sa crossProduct(), operator/=(), operator*()
+*/
+
+/*!
+ \fn QVector3D &QVector3D::operator/=(float divisor)
+
+ Divides this vector's coordinates by the given \a divisor, and returns a
+ reference to this vector. The \a divisor must not be either zero or NaN.
+
+ \sa operator*=(), operator/()
+*/
+
+/*!
+ \fn QVector3D &QVector3D::operator/=(QVector3D vector)
+ \since 5.5
+
+ Divides each component of this vector by the corresponding component in \a
+ vector and returns a reference to this vector.
+
+ The \a vector must have no component that is either zero or NaN.
+
+ \sa operator*=(), operator/()
+*/
+
+/*!
+ \fn float QVector3D::dotProduct(QVector3D v1, QVector3D v2)
+
+ Returns the dot product of \a v1 and \a v2.
+*/
+
+/*!
+ \fn QVector3D QVector3D::crossProduct(QVector3D v1, QVector3D v2)
+
+ Returns the cross-product of vectors \a v1 and \a v2, which is normal to the
+ plane spanned by \a v1 and \a v2. It will be zero if the two vectors are
+ parallel.
+
+ \sa normal()
+*/
+
+/*!
+ \fn QVector3D QVector3D::normal(QVector3D v1, QVector3D v2)
+
+ Returns the unit normal vector of a plane spanned by vectors \a v1 and \a
+ v2, which must not be parallel to one another.
+
+ Use crossProduct() to compute the cross-product of \a v1 and \a v2 if you
+ do not need the result to be normalized to a unit vector.
+
+ \sa crossProduct(), distanceToPlane()
+*/
+
+/*!
+ \fn QVector3D QVector3D::normal(QVector3D v1, QVector3D v2, QVector3D v3)
+
+ Returns the unit normal vector of a plane spanned by vectors \a v2 - \a v1
+ and \a v3 - \a v1, which must not be parallel to one another.
+
+ Use crossProduct() to compute the cross-product of \a v2 - \a v1 and
+ \a v3 - \a v1 if you do not need the result to be normalized to a
+ unit vector.
+
+ \sa crossProduct(), distanceToPlane()
+*/
+
+/*!
+ \since 5.5
+
+ Returns the window coordinates of this vector initially in object/model
+ coordinates using the model view matrix \a modelView, the projection matrix
+ \a projection and the viewport dimensions \a viewport.
+
+ When transforming from clip to normalized space, a division by the w
+ component on the vector components takes place. To prevent dividing by 0 if
+ w equals to 0, it is set to 1.
+
+ \note the returned y coordinates are in OpenGL orientation. OpenGL expects
+ the bottom to be 0 whereas for Qt top is 0.
+
+ \sa unproject()
+ */
+QVector3D QVector3D::project(const QMatrix4x4 &modelView, const QMatrix4x4 &projection, const QRect &viewport) const
+{
+ QVector4D tmp(*this, 1.0f);
+ tmp = projection * modelView * tmp;
+ if (qFuzzyIsNull(tmp.w()))
+ tmp.setW(1.0f);
+ tmp /= tmp.w();
+
+ tmp = tmp * 0.5f + QVector4D(0.5f, 0.5f, 0.5f, 0.5f);
+ tmp.setX(tmp.x() * viewport.width() + viewport.x());
+ tmp.setY(tmp.y() * viewport.height() + viewport.y());
+
+ return tmp.toVector3D();
+}
+
+/*!
+ \since 5.5
+
+ Returns the object/model coordinates of this vector initially in window
+ coordinates using the model view matrix \a modelView, the projection matrix
+ \a projection and the viewport dimensions \a viewport.
+
+ When transforming from clip to normalized space, a division by the w
+ component of the vector components takes place. To prevent dividing by 0 if
+ w equals to 0, it is set to 1.
+
+ \note y coordinates in \a viewport should use OpenGL orientation. OpenGL
+ expects the bottom to be 0 whereas for Qt top is 0.
+
+ \sa project()
+ */
+QVector3D QVector3D::unproject(const QMatrix4x4 &modelView, const QMatrix4x4 &projection, const QRect &viewport) const
+{
+ QMatrix4x4 inverse = QMatrix4x4( projection * modelView ).inverted();
+
+ QVector4D tmp(*this, 1.0f);
+ tmp.setX((tmp.x() - float(viewport.x())) / float(viewport.width()));
+ tmp.setY((tmp.y() - float(viewport.y())) / float(viewport.height()));
+ tmp = tmp * 2.0f - QVector4D(1.0f, 1.0f, 1.0f, 1.0f);
+
+ QVector4D obj = inverse * tmp;
+ if (qFuzzyIsNull(obj.w()))
+ obj.setW(1.0f);
+ obj /= obj.w();
+ return obj.toVector3D();
+}
+
+/*!
+ \fn float QVector3D::distanceToPoint(QVector3D point) const
+
+ \since 5.1
+
+ Returns the distance from this vertex to a point defined by
+ the vertex \a point.
+
+ \sa distanceToPlane(), distanceToLine()
+*/
+
+/*!
+ \fn float QVector3D::distanceToPlane(QVector3D plane, QVector3D normal) const
+
+ Returns the distance from this vertex to a plane defined by
+ the vertex \a plane and a \a normal unit vector. The \a normal
+ parameter is assumed to have been normalized to a unit vector.
+
+ The return value will be negative if the vertex is below the plane,
+ or zero if it is on the plane.
+
+ \sa normal(), distanceToLine()
+*/
+
+/*!
+ \fn float QVector3D::distanceToPlane(QVector3D plane1, QVector3D plane2, QVector3D plane3) const
+
+ Returns the distance from this vertex to a plane defined by
+ the vertices \a plane1, \a plane2 and \a plane3.
+
+ The return value will be negative if the vertex is below the plane,
+ or zero if it is on the plane.
+
+ The two vectors that define the plane are \a plane2 - \a plane1
+ and \a plane3 - \a plane1.
+
+ \sa normal(), distanceToLine()
+*/
+
+/*!
+ \fn float QVector3D::distanceToLine(QVector3D point, QVector3D direction) const
+
+ Returns the distance that this vertex is from a line defined
+ by \a point and the unit vector \a direction.
+
+ If \a direction is a null vector, then it does not define a line.
+ In that case, the distance from \a point to this vertex is returned.
+
+ \sa distanceToPlane()
+*/
+
+/*!
+ \fn bool QVector3D::operator==(QVector3D v1, QVector3D v2)
+
+ Returns \c true if \a v1 is equal to \a v2; otherwise returns \c false.
+ This operator uses an exact floating-point comparison.
+*/
+
+/*!
+ \fn bool QVector3D::operator!=(QVector3D v1, QVector3D v2)
+
+ Returns \c true if \a v1 is not equal to \a v2; otherwise returns \c false.
+ This operator uses an exact floating-point comparison.
+*/
+
+/*! //! friend
+ \fn const QVector3D QVector3D::operator+(QVector3D v1, QVector3D v2)
+
+ Returns a QVector3D object that is the sum of the given vectors, \a v1
+ and \a v2; each component is added separately.
+
+ \sa QVector3D::operator+=()
+*/
+
+/*! //! friend
+ \fn const QVector3D QVector3D::operator-(QVector3D v1, QVector3D v2)
+
+ Returns a QVector3D object that is formed by subtracting \a v2 from \a v1;
+ each component is subtracted separately.
+
+ \sa QVector3D::operator-=()
+*/
+
+/*! //! friend
+ \fn const QVector3D QVector3D::operator*(float factor, QVector3D vector)
+
+ Returns a copy of the given \a vector, multiplied by the given finite \a factor.
+
+ \sa QVector3D::operator*=()
+*/
+
+/*! //! friend
+ \fn const QVector3D QVector3D::operator*(QVector3D vector, float factor)
+
+ Returns a copy of the given \a vector, multiplied by the given finite \a factor.
+
+ \sa QVector3D::operator*=()
+*/
+
+/*! //! friend
+ \fn const QVector3D QVector3D::operator*(QVector3D v1, QVector3D v2)
+
+ Returns the QVector3D object formed by multiplying each component of \a v1
+ by the corresponding component of \a v2.
+
+ \note This is not the same as the crossProduct() of \a v1 and \a v2.
+ (Its components add up to the dot product of \a v1 and \a v2.)
+
+ \sa QVector3D::crossProduct()
+*/
+
+/*! //! friend
+ \fn const QVector3D QVector3D::operator-(QVector3D vector)
+ \overload
+
+ Returns a QVector3D object that is formed by changing the sign of each
+ component of the given \a vector.
+
+ Equivalent to \c {QVector3D(0,0,0) - vector}.
+*/
+
+/*! //! friend
+ \fn const QVector3D QVector3D::operator/(QVector3D vector, float divisor)
+
+ Returns the QVector3D object formed by dividing each component of the given
+ \a vector by the given \a divisor.
+
+ The \a divisor must not be either zero or NaN.
+
+ \sa QVector3D::operator/=()
+*/
+
+/*! //! friend
+ \fn const QVector3D QVector3D::operator/(QVector3D vector, QVector3D divisor)
+ \since 5.5
+
+ Returns the QVector3D object formed by dividing each component of the given
+ \a vector by the corresponding component of the given \a divisor.
+
+ The \a divisor must have no component that is either zero or NaN.
+
+ \sa QVector3D::operator/=()
+*/
+
+/*! //! friend
+ \fn bool QVector3D::qFuzzyCompare(QVector3D v1, QVector3D v2)
+
+ Returns \c true if \a v1 and \a v2 are equal, allowing for a small
+ fuzziness factor for floating-point comparisons; false otherwise.
+*/
+bool qFuzzyCompare(QVector3D v1, QVector3D v2) noexcept
+{
+ return qFuzzyCompare(v1.v[0], v2.v[0]) &&
+ qFuzzyCompare(v1.v[1], v2.v[1]) &&
+ qFuzzyCompare(v1.v[2], v2.v[2]);
+}
+
+#ifndef QT_NO_VECTOR2D
+
+/*!
+ \fn QVector2D QVector3D::toVector2D() const
+
+ Returns the 2D vector form of this 3D vector, dropping the z coordinate.
+
+ \sa toVector4D(), toPoint()
+*/
+
+#endif
+
+#ifndef QT_NO_VECTOR4D
+
+/*!
+ \fn QVector4D QVector3D::toVector4D() const
+
+ Returns the 4D form of this 3D vector, with the w coordinate set to zero.
+
+ \sa toVector2D(), toPoint()
+*/
+
+#endif
+
+/*!
+ \fn QPoint QVector3D::toPoint() const
+
+ Returns the QPoint form of this 3D vector. The z coordinate is dropped. The
+ x and y coordinates are rounded to nearest integers.
+
+ \sa toPointF(), toVector2D()
+*/
+
+/*!
+ \fn QPointF QVector3D::toPointF() const
+
+ Returns the QPointF form of this 3D vector. The z coordinate
+ is dropped.
+
+ \sa toPoint(), toVector2D()
+*/
+
+/*!
+ Returns the 3D vector as a QVariant.
+*/
+QVector3D::operator QVariant() const
+{
+ return QVariant::fromValue(*this);
+}
+
+/*!
+ \fn float QVector3D::length() const
+
+ Returns the length of the vector from the origin.
+
+ \sa lengthSquared(), normalized()
+*/
+
+/*!
+ \fn float QVector3D::lengthSquared() const
+
+ Returns the squared length of the vector from the origin.
+ This is equivalent to the dot product of the vector with itself.
+
+ \sa length(), dotProduct()
+*/
+
+#ifndef QT_NO_DEBUG_STREAM
+
+QDebug operator<<(QDebug dbg, QVector3D vector)
+{
+ QDebugStateSaver saver(dbg);
+ dbg.nospace() << "QVector3D("
+ << vector.x() << ", " << vector.y() << ", " << vector.z() << ')';
+ return dbg;
+}
+
+#endif
+
+#ifndef QT_NO_DATASTREAM
+
+/*!
+ \fn QDataStream &operator<<(QDataStream &stream, QVector3D vector)
+ \relates QVector3D
+
+ Writes the given \a vector to the given \a stream and returns a
+ reference to the stream.
+
+ \sa {Serializing Qt Data Types}
+*/
+
+QDataStream &operator<<(QDataStream &stream, QVector3D vector)
+{
+ stream << vector.x() << vector.y() << vector.z();
+ return stream;
+}
+
+/*!
+ \fn QDataStream &operator>>(QDataStream &stream, QVector3D &vector)
+ \relates QVector3D
+
+ Reads a 3D vector from the given \a stream into the given \a vector
+ and returns a reference to the stream.
+
+ \sa {Serializing Qt Data Types}
+*/
+
+QDataStream &operator>>(QDataStream &stream, QVector3D &vector)
+{
+ float x, y, z;
+ stream >> x;
+ stream >> y;
+ stream >> z;
+ Q_ASSERT(qIsFinite(x) && qIsFinite(y) && qIsFinite(z));
+ vector.setX(x);
+ vector.setY(y);
+ vector.setZ(z);
+ return stream;
+}
+
+#endif // QT_NO_DATASTREAM
+
+#endif // QT_NO_VECTOR3D
+
+
+
+#ifndef QT_NO_VECTOR4D
+
+/*!
+ \class QVector4D
+ \brief The QVector4D class represents a vector or vertex in 4D space.
+ \since 4.6
+ \ingroup painting-3D
+ \inmodule QtGui
+
+ Vectors are one of the main building blocks of 4D affine representations of
+ 3D space. They consist of four finite floating-point coordinates,
+ traditionally called x, y, z and w.
+
+ The QVector4D class can also be used to represent vertices in 4D space.
+ We therefore do not need to provide a separate vertex class.
+
+ \sa QQuaternion, QVector2D, QVector3D
+*/
+
+/*!
+ \fn QVector4D::QVector4D()
+
+ Constructs a null vector, i.e. with coordinates (0, 0, 0, 0).
+*/
+
+/*!
+ \fn QVector4D::QVector4D(Qt::Initialization)
+ \since 5.5
+ \internal
+
+ Constructs a vector without initializing the contents.
+*/
+
+/*!
+ \fn QVector4D::QVector4D(float xpos, float ypos, float zpos, float wpos)
+
+ Constructs a vector with coordinates (\a xpos, \a ypos, \a zpos, \a wpos).
+ All parameters must be finite.
+*/
+
+/*!
+ \fn QVector4D::QVector4D(QPoint point)
+
+ Constructs a vector with x and y coordinates from a 2D \a point, and
+ z and w coordinates of 0.
+*/
+
+/*!
+ \fn QVector4D::QVector4D(QPointF point)
+
+ Constructs a vector with x and y coordinates from a 2D \a point, and
+ z and w coordinates of 0.
+*/
+
+#ifndef QT_NO_VECTOR2D
+
+/*!
+ \fn QVector4D::QVector4D(QVector2D vector)
+
+ Constructs a 4D vector from the specified 2D \a vector. The z
+ and w coordinates are set to zero.
+
+ \sa toVector2D()
+*/
+
+/*!
+ \fn QVector4D::QVector4D(QVector2D vector, float zpos, float wpos)
+
+ Constructs a 4D vector from the specified 2D \a vector. The z
+ and w coordinates are set to \a zpos and \a wpos respectively,
+ each of which must be finite.
+
+ \sa toVector2D()
+*/
+
+#endif
+
+#ifndef QT_NO_VECTOR3D
+
+/*!
+ \fn QVector4D::QVector4D(QVector3D vector)
+
+ Constructs a 4D vector from the specified 3D \a vector. The w
+ coordinate is set to zero.
+
+ \sa toVector3D()
+*/
+
+/*!
+ \fn QVector4D::QVector4D(QVector3D vector, float wpos)
+
+ Constructs a 4D vector from the specified 3D \a vector. The w
+ coordinate is set to \a wpos, which must be finite.
+
+ \sa toVector3D()
+*/
+
+#endif
+
+/*!
+ \fn bool QVector4D::isNull() const
+
+ Returns \c true if the x, y, z, and w coordinates are set to 0.0,
+ otherwise returns \c false.
+*/
+
+/*!
+ \fn float QVector4D::x() const
+
+ Returns the x coordinate of this point.
+
+ \sa setX(), y(), z(), w()
+*/
+
+/*!
+ \fn float QVector4D::y() const
+
+ Returns the y coordinate of this point.
+
+ \sa setY(), x(), z(), w()
+*/
+
+/*!
+ \fn float QVector4D::z() const
+
+ Returns the z coordinate of this point.
+
+ \sa setZ(), x(), y(), w()
+*/
+
+/*!
+ \fn float QVector4D::w() const
+
+ Returns the w coordinate of this point.
+
+ \sa setW(), x(), y(), z()
+*/
+
+/*!
+ \fn void QVector4D::setX(float x)
+
+ Sets the x coordinate of this point to the given finite \a x coordinate.
+
+ \sa x(), setY(), setZ(), setW()
+*/
+
+/*!
+ \fn void QVector4D::setY(float y)
+
+ Sets the y coordinate of this point to the given finite \a y coordinate.
+
+ \sa y(), setX(), setZ(), setW()
+*/
+
+/*!
+ \fn void QVector4D::setZ(float z)
+
+ Sets the z coordinate of this point to the given finite \a z coordinate.
+
+ \sa z(), setX(), setY(), setW()
+*/
+
+/*!
+ \fn void QVector4D::setW(float w)
+
+ Sets the w coordinate of this point to the given finite \a w coordinate.
+
+ \sa w(), setX(), setY(), setZ()
+*/
+
+/*! \fn float &QVector4D::operator[](int i)
+ \since 5.2
+
+ Returns the component of the vector at index position \a i
+ as a modifiable reference.
+
+ \a i must be a valid index position in the vector (i.e., 0 <= \a i
+ < 4).
+*/
+
+/*! \fn float QVector4D::operator[](int i) const
+ \since 5.2
+
+ Returns the component of the vector at index position \a i.
+
+ \a i must be a valid index position in the vector (i.e., 0 <= \a i
+ < 4).
+*/
+
+/*!
+ \fn float QVector4D::length() const
+
+ Returns the length of the vector from the origin.
+
+ \sa lengthSquared(), normalized()
+*/
+
+/*!
+ \fn float QVector4D::lengthSquared() const
+
+ Returns the squared length of the vector from the origin.
+ This is equivalent to the dot product of the vector with itself.
+
+ \sa length(), dotProduct()
+*/
+
+/*!
+ \fn QVector4D QVector4D::normalized() const
+
+ Returns the normalized unit vector form of this vector.
+
+ If this vector is null, then a null vector is returned. If the length
+ of the vector is very close to 1, then the vector will be returned as-is.
+ Otherwise the normalized form of the vector of length 1 will be returned.
+
+ \sa length(), normalize()
+*/
+
+/*!
+ \fn void QVector4D::normalize()
+
+ Normalizes the current vector in place. Nothing happens if this
+ vector is a null vector or the length of the vector is very close to 1.
+
+ \sa length(), normalized()
+*/
+
+
+/*!
+ \fn QVector4D &QVector4D::operator+=(QVector4D vector)
+
+ Adds the given \a vector to this vector and returns a reference to
+ this vector.
+
+ \sa operator-=()
+*/
+
+/*!
+ \fn QVector4D &QVector4D::operator-=(QVector4D vector)
+
+ Subtracts the given \a vector from this vector and returns a reference to
+ this vector.
+
+ \sa operator+=()
+*/
+
+/*!
+ \fn QVector4D &QVector4D::operator*=(float factor)
+
+ Multiplies this vector's coordinates by the given finite \a factor, and
+ returns a reference to this vector.
+
+ \sa operator/=(), operator*()
+*/
+
+/*!
+ \fn QVector4D &QVector4D::operator*=(QVector4D vector)
+
+ Multiplies each component of this vector by the corresponding component of
+ \a vector and returns a reference to this vector.
+
+ \sa operator/=(), operator*()
+*/
+
+/*!
+ \fn QVector4D &QVector4D::operator/=(float divisor)
+
+ Divides this vector's coordinates by the given \a divisor, and returns a
+ reference to this vector. The \a divisor must not be either zero or NaN.
+
+ \sa operator*=()
+*/
+
+/*!
+ \fn QVector4D &QVector4D::operator/=(QVector4D vector)
+ \since 5.5
+
+ Divides each component of this vector by the corresponding component of \a
+ vector and returns a reference to this vector.
+
+ The \a vector must have no component that is either zero or NaN.
+
+ \sa operator*=(), operator/()
+*/
+
+/*!
+ \fn float QVector4D::dotProduct(QVector4D v1, QVector4D v2)
+
+ Returns the dot product of \a v1 and \a v2.
+*/
+
+/*!
+ \fn bool QVector4D::operator==(QVector4D v1, QVector4D v2)
+
+ Returns \c true if \a v1 is equal to \a v2; otherwise returns \c false.
+ This operator uses an exact floating-point comparison.
+*/
+
+/*!
+ \fn bool QVector4D::operator!=(QVector4D v1, QVector4D v2)
+
+ Returns \c true if \a v1 is not equal to \a v2; otherwise returns \c false.
+ This operator uses an exact floating-point comparison.
+*/
+
+/*! //! friend
+ \fn const QVector4D QVector4D::operator+(QVector4D v1, QVector4D v2)
+
+ Returns a QVector4D object that is the sum of the given vectors, \a v1
+ and \a v2; each component is added separately.
+
+ \sa QVector4D::operator+=()
+*/
+
+/*! //! friend
+ \fn const QVector4D QVector4D::operator-(QVector4D v1, QVector4D v2)
+
+ Returns a QVector4D object that is formed by subtracting \a v2 from \a v1;
+ each component is subtracted separately.
+
+ \sa QVector4D::operator-=()
+*/
+
+/*! //! friend
+ \fn const QVector4D QVector4D::operator*(float factor, QVector4D vector)
+
+ Returns a copy of the given \a vector, multiplied by the given \a factor.
+
+ \sa QVector4D::operator*=()
+*/
+
+/*! //! friend
+ \fn const QVector4D QVector4D::operator*(QVector4D vector, float factor)
+
+ Returns a copy of the given \a vector, multiplied by the given \a factor.
+
+ \sa QVector4D::operator*=()
+*/
+
+/*! //! friend
+ \fn const QVector4D QVector4D::operator*(QVector4D v1, QVector4D v2)
+
+ Returns the QVector4D object formed by multiplying each component of \a v1
+ by the corresponding component of \a v2.
+
+ \note This is not a cross product of \a v1 and \a v2 in any sense.
+ (Its components add up to the dot product of \a v1 and \a v2.)
+
+ \sa QVector4D::operator*=()
+*/
+
+/*! //! friend
+ \fn const QVector4D QVector4D::operator-(QVector4D vector)
+ \overload
+
+ Returns a QVector4D object that is formed by changing the sign of
+ all three components of the given \a vector.
+
+ Equivalent to \c {QVector4D(0,0,0,0) - vector}.
+*/
+
+/*! //! friend
+ \fn const QVector4D QVector4D::operator/(QVector4D vector, float divisor)
+
+ Returns the QVector4D object formed by dividing each component of the given
+ \a vector by the given \a divisor.
+
+ The \a divisor must not be either zero or NaN.
+
+ \sa QVector4D::operator/=()
+*/
+
+/*! //! friend
+ \fn const QVector4D QVector4D::operator/(QVector4D vector, QVector4D divisor)
+ \since 5.5
+
+ Returns the QVector4D object formed by dividing each component of the given
+ \a vector by the corresponding component of the given \a divisor.
+
+ The \a divisor must have no component that is either zero or NaN.
+
+ \sa QVector4D::operator/=()
+*/
+
+/*! //! friend
+ \fn bool QVector4D::qFuzzyCompare(QVector4D v1, QVector4D v2)
+
+ Returns \c true if \a v1 and \a v2 are equal, allowing for a small
+ fuzziness factor for floating-point comparisons; false otherwise.
+*/
+bool qFuzzyCompare(QVector4D v1, QVector4D v2) noexcept
+{
+ return qFuzzyCompare(v1.v[0], v2.v[0]) &&
+ qFuzzyCompare(v1.v[1], v2.v[1]) &&
+ qFuzzyCompare(v1.v[2], v2.v[2]) &&
+ qFuzzyCompare(v1.v[3], v2.v[3]);
+}
+
+#ifndef QT_NO_VECTOR2D
+
+/*!
+ \fn QVector2D QVector4D::toVector2D() const
+
+ Returns the 2D vector form of this 4D vector, dropping the z and w coordinates.
+
+ \sa toVector2DAffine(), toVector3D(), toPoint()
+*/
+
+/*!
+ \fn QVector2D QVector4D::toVector2DAffine() const
+
+ Returns the 2D vector form of this 4D vector, dividing the x and y
+ coordinates by the w coordinate and dropping the z coordinate.
+ Returns a null vector if w is zero.
+
+ \sa toVector2D(), toVector3DAffine(), toPoint()
+*/
+
+#endif
+
+#ifndef QT_NO_VECTOR3D
+
+/*!
+ \fn QVector3D QVector4D::toVector3D() const
+
+ Returns the 3D vector form of this 4D vector, dropping the w coordinate.
+
+ \sa toVector3DAffine(), toVector2D(), toPoint()
+*/
+
+/*!
+ \fn QVector3D QVector4D::toVector3DAffine() const
+
+ Returns the 3D vector form of this 4D vector, dividing the x, y, and
+ z coordinates by the w coordinate. Returns a null vector if w is zero.
+
+ \sa toVector3D(), toVector2DAffine(), toPoint()
+*/
+
+#endif
+
+/*!
+ \fn QPoint QVector4D::toPoint() const
+
+ Returns the QPoint form of this 4D vector. The z and w coordinates are
+ dropped. The x and y coordinates are rounded to nearest integers.
+
+ \sa toPointF(), toVector2D()
+*/
+
+/*!
+ \fn QPointF QVector4D::toPointF() const
+
+ Returns the QPointF form of this 4D vector. The z and w coordinates
+ are dropped.
+
+ \sa toPoint(), toVector2D()
+*/
+
+/*!
+ Returns the 4D vector as a QVariant.
+*/
+QVector4D::operator QVariant() const
+{
+ return QVariant::fromValue(*this);
+}
+
+#ifndef QT_NO_DEBUG_STREAM
+
+QDebug operator<<(QDebug dbg, QVector4D vector)
+{
+ QDebugStateSaver saver(dbg);
+ dbg.nospace() << "QVector4D("
+ << vector.x() << ", " << vector.y() << ", "
+ << vector.z() << ", " << vector.w() << ')';
+ return dbg;
+}
+
+#endif
+
+#ifndef QT_NO_DATASTREAM
+
+/*!
+ \fn QDataStream &operator<<(QDataStream &stream, QVector4D vector)
+ \relates QVector4D
+
+ Writes the given \a vector to the given \a stream and returns a
+ reference to the stream.
+
+ \sa {Serializing Qt Data Types}
+*/
+
+QDataStream &operator<<(QDataStream &stream, QVector4D vector)
+{
+ stream << vector.x() << vector.y()
+ << vector.z() << vector.w();
+ return stream;
+}
+
+/*!
+ \fn QDataStream &operator>>(QDataStream &stream, QVector4D &vector)
+ \relates QVector4D
+
+ Reads a 4D vector from the given \a stream into the given \a vector
+ and returns a reference to the stream.
+
+ \sa {Serializing Qt Data Types}
+*/
+
+QDataStream &operator>>(QDataStream &stream, QVector4D &vector)
+{
+ float x, y, z, w;
+ stream >> x;
+ stream >> y;
+ stream >> z;
+ stream >> w;
+ Q_ASSERT(qIsFinite(x) && qIsFinite(y) && qIsFinite(z) && qIsFinite(w));
+ vector.setX(x);
+ vector.setY(y);
+ vector.setZ(z);
+ vector.setW(w);
+ return stream;
+}
+
+#endif // QT_NO_DATASTREAM
+
+#endif // QT_NO_VECTOR4D
+
+QT_END_NAMESPACE
diff --git a/src/gui/math3d/qvectornd.h b/src/gui/math3d/qvectornd.h
new file mode 100644
index 0000000000..a8adf12801
--- /dev/null
+++ b/src/gui/math3d/qvectornd.h
@@ -0,0 +1,1086 @@
+// Copyright (C) 2020 The Qt Company Ltd.
+// Copyright (C) 2020 Klarälvdalens Datakonsult AB, a KDAB Group company, info@kdab.com, author Giuseppe D'Angelo <giuseppe.dangelo@kdab.com>
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
+
+#ifndef QVECTORND_H
+#define QVECTORND_H
+
+#include <QtGui/qtguiglobal.h>
+#include <QtCore/qpoint.h>
+#include <QtCore/qrect.h>
+#include <QtCore/qmath.h>
+
+#include <QtCore/q20type_traits.h>
+#include <QtCore/q23utility.h>
+
+QT_BEGIN_NAMESPACE
+
+// QT_ENABLE_P0846_SEMANTICS_FOR(get) // from qpoint.h
+
+class QVector2D;
+class QVector3D;
+class QVector4D;
+class QMatrix4x4;
+class QVariant;
+
+/***************************** QVector2D *****************************/
+
+#ifndef QT_NO_VECTOR2D
+
+class QVector2D
+{
+public:
+ constexpr QVector2D() noexcept;
+ explicit QVector2D(Qt::Initialization) noexcept {}
+ constexpr QVector2D(float xpos, float ypos) noexcept;
+ constexpr explicit QVector2D(QPoint point) noexcept;
+ constexpr explicit QVector2D(QPointF point) noexcept;
+#ifndef QT_NO_VECTOR3D
+ constexpr explicit QVector2D(QVector3D vector) noexcept;
+#endif
+#ifndef QT_NO_VECTOR4D
+ constexpr explicit QVector2D(QVector4D vector) noexcept;
+#endif
+
+ constexpr bool isNull() const noexcept;
+
+ constexpr float x() const noexcept;
+ constexpr float y() const noexcept;
+
+ constexpr void setX(float x) noexcept;
+ constexpr void setY(float y) noexcept;
+
+ constexpr float &operator[](int i);
+ constexpr float operator[](int i) const;
+
+ [[nodiscard]] float length() const noexcept;
+ [[nodiscard]] constexpr float lengthSquared() const noexcept;
+
+ [[nodiscard]] QVector2D normalized() const noexcept;
+ void normalize() noexcept;
+
+ [[nodiscard]] float distanceToPoint(QVector2D point) const noexcept;
+ [[nodiscard]] float distanceToLine(QVector2D point, QVector2D direction) const noexcept;
+
+ constexpr QVector2D &operator+=(QVector2D vector) noexcept;
+ constexpr QVector2D &operator-=(QVector2D vector) noexcept;
+ constexpr QVector2D &operator*=(float factor) noexcept;
+ constexpr QVector2D &operator*=(QVector2D vector) noexcept;
+ constexpr QVector2D &operator/=(float divisor);
+ constexpr QVector2D &operator/=(QVector2D vector);
+
+ [[nodiscard]] static constexpr float dotProduct(QVector2D v1, QVector2D v2) noexcept;
+
+QT_WARNING_PUSH
+QT_WARNING_DISABLE_FLOAT_COMPARE
+ constexpr friend inline bool operator==(QVector2D v1, QVector2D v2) noexcept
+ {
+ return v1.v[0] == v2.v[0] && v1.v[1] == v2.v[1];
+ }
+
+ constexpr friend inline bool operator!=(QVector2D v1, QVector2D v2) noexcept
+ {
+ return v1.v[0] != v2.v[0] || v1.v[1] != v2.v[1];
+ }
+QT_WARNING_POP
+
+ constexpr friend inline QVector2D operator+(QVector2D v1, QVector2D v2) noexcept
+ {
+ return QVector2D(v1.v[0] + v2.v[0], v1.v[1] + v2.v[1]);
+ }
+
+ constexpr friend inline QVector2D operator-(QVector2D v1, QVector2D v2) noexcept
+ {
+ return QVector2D(v1.v[0] - v2.v[0], v1.v[1] - v2.v[1]);
+ }
+
+ constexpr friend inline QVector2D operator*(float factor, QVector2D vector) noexcept
+ {
+ return QVector2D(vector.v[0] * factor, vector.v[1] * factor);
+ }
+
+ constexpr friend inline QVector2D operator*(QVector2D vector, float factor) noexcept
+ {
+ return QVector2D(vector.v[0] * factor, vector.v[1] * factor);
+ }
+
+ constexpr friend inline QVector2D operator*(QVector2D v1, QVector2D v2) noexcept
+ {
+ return QVector2D(v1.v[0] * v2.v[0], v1.v[1] * v2.v[1]);
+ }
+
+ constexpr friend inline QVector2D operator-(QVector2D vector) noexcept
+ {
+ return QVector2D(-vector.v[0], -vector.v[1]);
+ }
+
+ constexpr friend inline QVector2D operator/(QVector2D vector, float divisor)
+ {
+ Q_ASSERT(divisor < 0 || divisor > 0);
+ return QVector2D(vector.v[0] / divisor, vector.v[1] / divisor);
+ }
+
+ constexpr friend inline QVector2D operator/(QVector2D vector, QVector2D divisor)
+ {
+ Q_ASSERT(divisor.v[0] < 0 || divisor.v[0] > 0);
+ Q_ASSERT(divisor.v[1] < 0 || divisor.v[1] > 0);
+ return QVector2D(vector.v[0] / divisor.v[0], vector.v[1] / divisor.v[1]);
+ }
+
+ friend Q_GUI_EXPORT bool qFuzzyCompare(QVector2D v1, QVector2D v2) noexcept;
+
+#ifndef QT_NO_VECTOR3D
+ constexpr QVector3D toVector3D() const noexcept;
+#endif
+#ifndef QT_NO_VECTOR4D
+ constexpr QVector4D toVector4D() const noexcept;
+#endif
+
+ constexpr QPoint toPoint() const noexcept;
+ constexpr QPointF toPointF() const noexcept;
+
+ Q_GUI_EXPORT operator QVariant() const;
+
+private:
+ float v[2];
+
+ friend class QVector3D;
+ friend class QVector4D;
+
+ template <std::size_t I,
+ typename V,
+ std::enable_if_t<(I < 2), bool> = true,
+ std::enable_if_t<std::is_same_v<q20::remove_cvref_t<V>, QVector2D>, bool> = true>
+ friend constexpr decltype(auto) get(V &&vec) noexcept
+ {
+ return q23::forward_like<V>(vec.v[I]);
+ }
+};
+
+Q_DECLARE_TYPEINFO(QVector2D, Q_PRIMITIVE_TYPE);
+
+#endif // QT_NO_VECTOR2D
+
+
+
+/***************************** QVector3D *****************************/
+
+#ifndef QT_NO_VECTOR3D
+
+class QVector3D
+{
+public:
+ constexpr QVector3D() noexcept;
+ explicit QVector3D(Qt::Initialization) noexcept {}
+ constexpr QVector3D(float xpos, float ypos, float zpos) noexcept : v{xpos, ypos, zpos} {}
+
+ constexpr explicit QVector3D(QPoint point) noexcept;
+ constexpr explicit QVector3D(QPointF point) noexcept;
+#ifndef QT_NO_VECTOR2D
+ constexpr explicit QVector3D(QVector2D vector) noexcept;
+ constexpr QVector3D(QVector2D vector, float zpos) noexcept;
+#endif
+#ifndef QT_NO_VECTOR4D
+ constexpr explicit QVector3D(QVector4D vector) noexcept;
+#endif
+
+ constexpr bool isNull() const noexcept;
+
+ constexpr float x() const noexcept;
+ constexpr float y() const noexcept;
+ constexpr float z() const noexcept;
+
+ constexpr void setX(float x) noexcept;
+ constexpr void setY(float y) noexcept;
+ constexpr void setZ(float z) noexcept;
+
+ constexpr float &operator[](int i);
+ constexpr float operator[](int i) const;
+
+ [[nodiscard]] float length() const noexcept;
+ [[nodiscard]] constexpr float lengthSquared() const noexcept;
+
+ [[nodiscard]] QVector3D normalized() const noexcept;
+ void normalize() noexcept;
+
+ constexpr QVector3D &operator+=(QVector3D vector) noexcept;
+ constexpr QVector3D &operator-=(QVector3D vector) noexcept;
+ constexpr QVector3D &operator*=(float factor) noexcept;
+ constexpr QVector3D &operator*=(QVector3D vector) noexcept;
+ constexpr QVector3D &operator/=(float divisor);
+ constexpr QVector3D &operator/=(QVector3D vector);
+
+ [[nodiscard]] static constexpr float dotProduct(QVector3D v1, QVector3D v2) noexcept;
+ [[nodiscard]] static constexpr QVector3D crossProduct(QVector3D v1, QVector3D v2) noexcept;
+
+ [[nodiscard]] static QVector3D normal(QVector3D v1, QVector3D v2) noexcept;
+ [[nodiscard]] static QVector3D normal(QVector3D v1, QVector3D v2, QVector3D v3) noexcept;
+
+ Q_GUI_EXPORT QVector3D project(const QMatrix4x4 &modelView, const QMatrix4x4 &projection, const QRect &viewport) const;
+ Q_GUI_EXPORT QVector3D unproject(const QMatrix4x4 &modelView, const QMatrix4x4 &projection, const QRect &viewport) const;
+
+QT_WARNING_PUSH
+QT_WARNING_DISABLE_FLOAT_COMPARE
+ constexpr friend inline bool operator==(QVector3D v1, QVector3D v2) noexcept
+ {
+ return v1.v[0] == v2.v[0] && v1.v[1] == v2.v[1] && v1.v[2] == v2.v[2];
+ }
+
+ constexpr friend inline bool operator!=(QVector3D v1, QVector3D v2) noexcept
+ {
+ return v1.v[0] != v2.v[0] || v1.v[1] != v2.v[1] || v1.v[2] != v2.v[2];
+ }
+QT_WARNING_POP
+ float distanceToPoint(QVector3D point) const noexcept;
+ constexpr float distanceToPlane(QVector3D plane, QVector3D normal) const noexcept;
+ float distanceToPlane(QVector3D plane1, QVector3D plane2, QVector3D plane3) const noexcept;
+ float distanceToLine(QVector3D point, QVector3D direction) const noexcept;
+
+
+ constexpr friend inline QVector3D operator+(QVector3D v1, QVector3D v2) noexcept
+ {
+ return QVector3D(v1.v[0] + v2.v[0], v1.v[1] + v2.v[1], v1.v[2] + v2.v[2]);
+ }
+
+ constexpr friend inline QVector3D operator-(QVector3D v1, QVector3D v2) noexcept
+ {
+ return QVector3D(v1.v[0] - v2.v[0], v1.v[1] - v2.v[1], v1.v[2] - v2.v[2]);
+ }
+
+ constexpr friend inline QVector3D operator*(float factor, QVector3D vector) noexcept
+ {
+ return QVector3D(vector.v[0] * factor, vector.v[1] * factor, vector.v[2] * factor);
+ }
+
+ constexpr friend inline QVector3D operator*(QVector3D vector, float factor) noexcept
+ {
+ return QVector3D(vector.v[0] * factor, vector.v[1] * factor, vector.v[2] * factor);
+ }
+
+ constexpr friend inline QVector3D operator*(QVector3D v1, QVector3D v2) noexcept
+ {
+ return QVector3D(v1.v[0] * v2.v[0], v1.v[1] * v2.v[1], v1.v[2] * v2.v[2]);
+ }
+
+ constexpr friend inline QVector3D operator-(QVector3D vector) noexcept
+ {
+ return QVector3D(-vector.v[0], -vector.v[1], -vector.v[2]);
+ }
+
+ constexpr friend inline QVector3D operator/(QVector3D vector, float divisor)
+ {
+ Q_ASSERT(divisor < 0 || divisor > 0);
+ return QVector3D(vector.v[0] / divisor, vector.v[1] / divisor, vector.v[2] / divisor);
+ }
+
+ constexpr friend inline QVector3D operator/(QVector3D vector, QVector3D divisor)
+ {
+ Q_ASSERT(divisor.v[0] > 0 || divisor.v[0] < 0);
+ Q_ASSERT(divisor.v[1] > 0 || divisor.v[1] < 0);
+ Q_ASSERT(divisor.v[2] > 0 || divisor.v[2] < 0);
+ return QVector3D(vector.v[0] / divisor.v[0], vector.v[1] / divisor.v[1],
+ vector.v[2] / divisor.v[2]);
+ }
+
+ friend Q_GUI_EXPORT bool qFuzzyCompare(QVector3D v1, QVector3D v2) noexcept;
+
+#ifndef QT_NO_VECTOR2D
+ constexpr QVector2D toVector2D() const noexcept;
+#endif
+#ifndef QT_NO_VECTOR4D
+ constexpr QVector4D toVector4D() const noexcept;
+#endif
+
+ constexpr QPoint toPoint() const noexcept;
+ constexpr QPointF toPointF() const noexcept;
+
+ Q_GUI_EXPORT operator QVariant() const;
+
+private:
+ float v[3];
+
+ friend class QVector2D;
+ friend class QVector4D;
+#ifndef QT_NO_MATRIX4X4
+ friend QVector3D operator*(const QVector3D& vector, const QMatrix4x4& matrix);
+ friend QVector3D operator*(const QMatrix4x4& matrix, const QVector3D& vector);
+#endif
+
+ template <std::size_t I,
+ typename V,
+ std::enable_if_t<(I < 3), bool> = true,
+ std::enable_if_t<std::is_same_v<q20::remove_cvref_t<V>, QVector3D>, bool> = true>
+ friend constexpr decltype(auto) get(V &&vec) noexcept
+ {
+ return q23::forward_like<V>(vec.v[I]);
+ }
+};
+
+Q_DECLARE_TYPEINFO(QVector3D, Q_PRIMITIVE_TYPE);
+
+#endif // QT_NO_VECTOR3D
+
+
+
+/***************************** QVector4D *****************************/
+
+#ifndef QT_NO_VECTOR4D
+
+class QVector4D
+{
+public:
+ constexpr QVector4D() noexcept;
+ explicit QVector4D(Qt::Initialization) noexcept {}
+ constexpr QVector4D(float xpos, float ypos, float zpos, float wpos) noexcept;
+ constexpr explicit QVector4D(QPoint point) noexcept;
+ constexpr explicit QVector4D(QPointF point) noexcept;
+#ifndef QT_NO_VECTOR2D
+ constexpr explicit QVector4D(QVector2D vector) noexcept;
+ constexpr QVector4D(QVector2D vector, float zpos, float wpos) noexcept;
+#endif
+#ifndef QT_NO_VECTOR3D
+ constexpr explicit QVector4D(QVector3D vector) noexcept;
+ constexpr QVector4D(QVector3D vector, float wpos) noexcept;
+#endif
+
+ constexpr bool isNull() const noexcept;
+
+ constexpr float x() const noexcept;
+ constexpr float y() const noexcept;
+ constexpr float z() const noexcept;
+ constexpr float w() const noexcept;
+
+ constexpr void setX(float x) noexcept;
+ constexpr void setY(float y) noexcept;
+ constexpr void setZ(float z) noexcept;
+ constexpr void setW(float w) noexcept;
+
+ constexpr float &operator[](int i);
+ constexpr float operator[](int i) const;
+
+ [[nodiscard]] float length() const noexcept;
+ [[nodiscard]] constexpr float lengthSquared() const noexcept;
+
+ [[nodiscard]] QVector4D normalized() const noexcept;
+ void normalize() noexcept;
+
+ constexpr QVector4D &operator+=(QVector4D vector) noexcept;
+ constexpr QVector4D &operator-=(QVector4D vector) noexcept;
+ constexpr QVector4D &operator*=(float factor) noexcept;
+ constexpr QVector4D &operator*=(QVector4D vector) noexcept;
+ constexpr QVector4D &operator/=(float divisor);
+ constexpr inline QVector4D &operator/=(QVector4D vector);
+
+ [[nodiscard]] static constexpr float dotProduct(QVector4D v1, QVector4D v2) noexcept;
+
+QT_WARNING_PUSH
+QT_WARNING_DISABLE_FLOAT_COMPARE
+ constexpr friend inline bool operator==(QVector4D v1, QVector4D v2) noexcept
+ {
+ return v1.v[0] == v2.v[0] && v1.v[1] == v2.v[1] && v1.v[2] == v2.v[2] && v1.v[3] == v2.v[3];
+ }
+
+ constexpr friend inline bool operator!=(QVector4D v1, QVector4D v2) noexcept
+ {
+ return v1.v[0] != v2.v[0] || v1.v[1] != v2.v[1] || v1.v[2] != v2.v[2] || v1.v[3] != v2.v[3];
+ }
+QT_WARNING_POP
+ constexpr friend inline QVector4D operator+(QVector4D v1, QVector4D v2) noexcept
+ {
+ return QVector4D(v1.v[0] + v2.v[0], v1.v[1] + v2.v[1], v1.v[2] + v2.v[2], v1.v[3] + v2.v[3]);
+ }
+
+ constexpr friend inline QVector4D operator-(QVector4D v1, QVector4D v2) noexcept
+ {
+ return QVector4D(v1.v[0] - v2.v[0], v1.v[1] - v2.v[1], v1.v[2] - v2.v[2], v1.v[3] - v2.v[3]);
+ }
+
+ constexpr friend inline QVector4D operator*(float factor, QVector4D vector) noexcept
+ {
+ return QVector4D(vector.v[0] * factor, vector.v[1] * factor, vector.v[2] * factor, vector.v[3] * factor);
+ }
+
+ constexpr friend inline QVector4D operator*(QVector4D vector, float factor) noexcept
+ {
+ return QVector4D(vector.v[0] * factor, vector.v[1] * factor, vector.v[2] * factor, vector.v[3] * factor);
+ }
+
+ constexpr friend inline QVector4D operator*(QVector4D v1, QVector4D v2) noexcept
+ {
+ return QVector4D(v1.v[0] * v2.v[0], v1.v[1] * v2.v[1], v1.v[2] * v2.v[2], v1.v[3] * v2.v[3]);
+ }
+
+ constexpr friend inline QVector4D operator-(QVector4D vector) noexcept
+ {
+ return QVector4D(-vector.v[0], -vector.v[1], -vector.v[2], -vector.v[3]);
+ }
+
+ constexpr friend inline QVector4D operator/(QVector4D vector, float divisor)
+ {
+ Q_ASSERT(divisor < 0 || divisor > 0);
+ return QVector4D(vector.v[0] / divisor, vector.v[1] / divisor, vector.v[2] / divisor, vector.v[3] / divisor);
+ }
+
+ constexpr friend inline QVector4D operator/(QVector4D vector, QVector4D divisor)
+ {
+ Q_ASSERT(divisor.v[0] > 0 || divisor.v[0] < 0);
+ Q_ASSERT(divisor.v[1] > 0 || divisor.v[1] < 0);
+ Q_ASSERT(divisor.v[2] > 0 || divisor.v[2] < 0);
+ Q_ASSERT(divisor.v[3] > 0 || divisor.v[3] < 0);
+ return QVector4D(vector.v[0] / divisor.v[0], vector.v[1] / divisor.v[1],
+ vector.v[2] / divisor.v[2], vector.v[3] / divisor.v[3]);
+ }
+
+ friend Q_GUI_EXPORT bool qFuzzyCompare(QVector4D v1, QVector4D v2) noexcept;
+
+#ifndef QT_NO_VECTOR2D
+ constexpr QVector2D toVector2D() const noexcept;
+ constexpr QVector2D toVector2DAffine() const noexcept;
+#endif
+#ifndef QT_NO_VECTOR3D
+ constexpr QVector3D toVector3D() const noexcept;
+ constexpr QVector3D toVector3DAffine() const noexcept;
+#endif
+
+ constexpr QPoint toPoint() const noexcept;
+ constexpr QPointF toPointF() const noexcept;
+
+ Q_GUI_EXPORT operator QVariant() const;
+
+private:
+ float v[4];
+
+ friend class QVector2D;
+ friend class QVector3D;
+ friend class QMatrix4x4;
+#ifndef QT_NO_MATRIX4X4
+ friend QVector4D operator*(const QVector4D& vector, const QMatrix4x4& matrix);
+ friend QVector4D operator*(const QMatrix4x4& matrix, const QVector4D& vector);
+#endif
+
+ template <std::size_t I,
+ typename V,
+ std::enable_if_t<(I < 4), bool> = true,
+ std::enable_if_t<std::is_same_v<q20::remove_cvref_t<V>, QVector4D>, bool> = true>
+ friend constexpr decltype(auto) get(V &&vec) noexcept
+ {
+ return q23::forward_like<V>(vec.v[I]);
+ }
+};
+
+Q_DECLARE_TYPEINFO(QVector4D, Q_PRIMITIVE_TYPE);
+
+#endif // QT_NO_VECTOR4D
+
+
+
+/***************************** QVector2D *****************************/
+
+#ifndef QT_NO_VECTOR2D
+
+constexpr inline QVector2D::QVector2D() noexcept : v{0.0f, 0.0f} {}
+
+constexpr inline QVector2D::QVector2D(float xpos, float ypos) noexcept : v{xpos, ypos} {}
+
+constexpr inline QVector2D::QVector2D(QPoint point) noexcept : v{float(point.x()), float(point.y())} {}
+
+constexpr inline QVector2D::QVector2D(QPointF point) noexcept : v{float(point.x()), float(point.y())} {}
+
+#ifndef QT_NO_VECTOR3D
+constexpr inline QVector2D::QVector2D(QVector3D vector) noexcept : v{vector[0], vector[1]} {}
+#endif
+#ifndef QT_NO_VECTOR4D
+constexpr inline QVector2D::QVector2D(QVector4D vector) noexcept : v{vector[0], vector[1]} {}
+#endif
+
+constexpr inline bool QVector2D::isNull() const noexcept
+{
+ return qIsNull(v[0]) && qIsNull(v[1]);
+}
+
+constexpr inline float QVector2D::x() const noexcept { return v[0]; }
+constexpr inline float QVector2D::y() const noexcept { return v[1]; }
+
+constexpr inline void QVector2D::setX(float aX) noexcept { v[0] = aX; }
+constexpr inline void QVector2D::setY(float aY) noexcept { v[1] = aY; }
+
+constexpr inline float &QVector2D::operator[](int i)
+{
+ Q_ASSERT(uint(i) < 2u);
+ return v[i];
+}
+
+constexpr inline float QVector2D::operator[](int i) const
+{
+ Q_ASSERT(uint(i) < 2u);
+ return v[i];
+}
+
+inline float QVector2D::length() const noexcept
+{
+ return qHypot(v[0], v[1]);
+}
+
+constexpr inline float QVector2D::lengthSquared() const noexcept
+{
+ return v[0] * v[0] + v[1] * v[1];
+}
+
+inline QVector2D QVector2D::normalized() const noexcept
+{
+ const float len = length();
+ return qFuzzyIsNull(len - 1.0f) ? *this : qFuzzyIsNull(len) ? QVector2D()
+ : QVector2D(v[0] / len, v[1] / len);
+}
+
+inline void QVector2D::normalize() noexcept
+{
+ const float len = length();
+ if (qFuzzyIsNull(len - 1.0f) || qFuzzyIsNull(len))
+ return;
+
+ v[0] /= len;
+ v[1] /= len;
+}
+
+inline float QVector2D::distanceToPoint(QVector2D point) const noexcept
+{
+ return (*this - point).length();
+}
+
+inline float QVector2D::distanceToLine(QVector2D point, QVector2D direction) const noexcept
+{
+ if (direction.isNull())
+ return (*this - point).length();
+ QVector2D p = point + dotProduct(*this - point, direction) * direction;
+ return (*this - p).length();
+}
+
+constexpr inline QVector2D &QVector2D::operator+=(QVector2D vector) noexcept
+{
+ v[0] += vector.v[0];
+ v[1] += vector.v[1];
+ return *this;
+}
+
+constexpr inline QVector2D &QVector2D::operator-=(QVector2D vector) noexcept
+{
+ v[0] -= vector.v[0];
+ v[1] -= vector.v[1];
+ return *this;
+}
+
+constexpr inline QVector2D &QVector2D::operator*=(float factor) noexcept
+{
+ v[0] *= factor;
+ v[1] *= factor;
+ return *this;
+}
+
+constexpr inline QVector2D &QVector2D::operator*=(QVector2D vector) noexcept
+{
+ v[0] *= vector.v[0];
+ v[1] *= vector.v[1];
+ return *this;
+}
+
+constexpr inline QVector2D &QVector2D::operator/=(float divisor)
+{
+ Q_ASSERT(divisor < 0 || divisor > 0);
+ v[0] /= divisor;
+ v[1] /= divisor;
+ return *this;
+}
+
+constexpr inline QVector2D &QVector2D::operator/=(QVector2D vector)
+{
+ Q_ASSERT(vector.v[0] > 0 || vector.v[0] < 0);
+ Q_ASSERT(vector.v[1] > 0 || vector.v[1] < 0);
+ v[0] /= vector.v[0];
+ v[1] /= vector.v[1];
+ return *this;
+}
+
+constexpr inline float QVector2D::dotProduct(QVector2D v1, QVector2D v2) noexcept
+{
+ return v1.v[0] * v2.v[0] + v1.v[1] * v2.v[1];
+}
+
+#ifndef QT_NO_VECTOR3D
+constexpr inline QVector3D QVector2D::toVector3D() const noexcept
+{
+ return QVector3D(v[0], v[1], 0.0f);
+}
+#endif
+#ifndef QT_NO_VECTOR4D
+constexpr inline QVector4D QVector2D::toVector4D() const noexcept
+{
+ return QVector4D(v[0], v[1], 0.0f, 0.0f);
+}
+#endif
+
+
+constexpr inline QPoint QVector2D::toPoint() const noexcept
+{
+ return QPoint(qRound(v[0]), qRound(v[1]));
+}
+
+constexpr inline QPointF QVector2D::toPointF() const noexcept
+{
+ return QPointF(qreal(v[0]), qreal(v[1]));
+}
+
+#ifndef QT_NO_DEBUG_STREAM
+Q_GUI_EXPORT QDebug operator<<(QDebug dbg, QVector2D vector);
+#endif
+
+#ifndef QT_NO_DATASTREAM
+Q_GUI_EXPORT QDataStream &operator<<(QDataStream &, QVector2D );
+Q_GUI_EXPORT QDataStream &operator>>(QDataStream &, QVector2D &);
+#endif
+
+#endif // QT_NO_VECTOR2D
+
+
+
+/***************************** QVector3D *****************************/
+
+#ifndef QT_NO_VECTOR3D
+
+constexpr inline QVector3D::QVector3D() noexcept : v{0.0f, 0.0f, 0.0f} {}
+
+constexpr inline QVector3D::QVector3D(QPoint point) noexcept : v{float(point.x()), float(point.y()), 0.0f} {}
+
+constexpr inline QVector3D::QVector3D(QPointF point) noexcept : v{float(point.x()), float(point.y()), 0.0f} {}
+
+#ifndef QT_NO_VECTOR2D
+constexpr inline QVector3D::QVector3D(QVector2D vector) noexcept : v{vector[0], vector[1], 0.0f} {}
+constexpr inline QVector3D::QVector3D(QVector2D vector, float zpos) noexcept : v{vector[0], vector[1], zpos} {}
+#endif
+
+#ifndef QT_NO_VECTOR4D
+constexpr inline QVector3D::QVector3D(QVector4D vector) noexcept : v{vector[0], vector[1], vector[2]} {}
+#endif
+
+constexpr inline bool QVector3D::isNull() const noexcept
+{
+ return qIsNull(v[0]) && qIsNull(v[1]) && qIsNull(v[2]);
+}
+
+constexpr inline float QVector3D::x() const noexcept { return v[0]; }
+constexpr inline float QVector3D::y() const noexcept { return v[1]; }
+constexpr inline float QVector3D::z() const noexcept { return v[2]; }
+
+constexpr inline void QVector3D::setX(float aX) noexcept { v[0] = aX; }
+constexpr inline void QVector3D::setY(float aY) noexcept { v[1] = aY; }
+constexpr inline void QVector3D::setZ(float aZ) noexcept { v[2] = aZ; }
+
+constexpr inline float &QVector3D::operator[](int i)
+{
+ Q_ASSERT(uint(i) < 3u);
+ return v[i];
+}
+
+constexpr inline float QVector3D::operator[](int i) const
+{
+ Q_ASSERT(uint(i) < 3u);
+ return v[i];
+}
+
+inline float QVector3D::length() const noexcept
+{
+ return qHypot(v[0], v[1], v[2]);
+}
+
+inline QVector3D QVector3D::normalized() const noexcept
+{
+ const float len = length();
+ return qFuzzyIsNull(len - 1.0f) ? *this : qFuzzyIsNull(len) ? QVector3D()
+ : QVector3D(v[0] / len, v[1] / len, v[2] / len);
+}
+
+inline void QVector3D::normalize() noexcept
+{
+ const float len = length();
+ if (qFuzzyIsNull(len - 1.0f) || qFuzzyIsNull(len))
+ return;
+
+ v[0] /= len;
+ v[1] /= len;
+ v[2] /= len;
+}
+
+constexpr inline float QVector3D::lengthSquared() const noexcept
+{
+ return v[0] * v[0] + v[1] * v[1] + v[2] * v[2];
+}
+
+constexpr inline QVector3D &QVector3D::operator+=(QVector3D vector) noexcept
+{
+ v[0] += vector.v[0];
+ v[1] += vector.v[1];
+ v[2] += vector.v[2];
+ return *this;
+}
+
+constexpr inline QVector3D &QVector3D::operator-=(QVector3D vector) noexcept
+{
+ v[0] -= vector.v[0];
+ v[1] -= vector.v[1];
+ v[2] -= vector.v[2];
+ return *this;
+}
+
+constexpr inline QVector3D &QVector3D::operator*=(float factor) noexcept
+{
+ v[0] *= factor;
+ v[1] *= factor;
+ v[2] *= factor;
+ return *this;
+}
+
+constexpr inline QVector3D &QVector3D::operator*=(QVector3D vector) noexcept
+{
+ v[0] *= vector.v[0];
+ v[1] *= vector.v[1];
+ v[2] *= vector.v[2];
+ return *this;
+}
+
+constexpr inline QVector3D &QVector3D::operator/=(float divisor)
+{
+ Q_ASSERT(divisor < 0 || divisor > 0);
+ v[0] /= divisor;
+ v[1] /= divisor;
+ v[2] /= divisor;
+ return *this;
+}
+
+constexpr inline QVector3D &QVector3D::operator/=(QVector3D vector)
+{
+ Q_ASSERT(vector.v[0] > 0 || vector.v[0] < 0);
+ Q_ASSERT(vector.v[1] > 0 || vector.v[1] < 0);
+ Q_ASSERT(vector.v[2] > 0 || vector.v[2] < 0);
+ v[0] /= vector.v[0];
+ v[1] /= vector.v[1];
+ v[2] /= vector.v[2];
+ return *this;
+}
+
+constexpr inline float QVector3D::dotProduct(QVector3D v1, QVector3D v2) noexcept
+{
+ return v1.v[0] * v2.v[0] + v1.v[1] * v2.v[1] + v1.v[2] * v2.v[2];
+}
+
+constexpr inline QVector3D QVector3D::crossProduct(QVector3D v1, QVector3D v2) noexcept
+{
+ return QVector3D(v1.v[1] * v2.v[2] - v1.v[2] * v2.v[1],
+ v1.v[2] * v2.v[0] - v1.v[0] * v2.v[2],
+ v1.v[0] * v2.v[1] - v1.v[1] * v2.v[0]);
+}
+
+inline QVector3D QVector3D::normal(QVector3D v1, QVector3D v2) noexcept
+{
+ return crossProduct(v1, v2).normalized();
+}
+
+inline QVector3D QVector3D::normal(QVector3D v1, QVector3D v2, QVector3D v3) noexcept
+{
+ return crossProduct((v2 - v1), (v3 - v1)).normalized();
+}
+
+inline float QVector3D::distanceToPoint(QVector3D point) const noexcept
+{
+ return (*this - point).length();
+}
+
+constexpr inline float QVector3D::distanceToPlane(QVector3D plane, QVector3D normal) const noexcept
+{
+ return dotProduct(*this - plane, normal);
+}
+
+inline float QVector3D::distanceToPlane(QVector3D plane1, QVector3D plane2, QVector3D plane3) const noexcept
+{
+ QVector3D n = normal(plane2 - plane1, plane3 - plane1);
+ return dotProduct(*this - plane1, n);
+}
+
+inline float QVector3D::distanceToLine(QVector3D point, QVector3D direction) const noexcept
+{
+ if (direction.isNull())
+ return (*this - point).length();
+ QVector3D p = point + dotProduct(*this - point, direction) * direction;
+ return (*this - p).length();
+}
+
+#ifndef QT_NO_VECTOR2D
+constexpr inline QVector2D QVector3D::toVector2D() const noexcept
+{
+ return QVector2D(v[0], v[1]);
+}
+#endif
+#ifndef QT_NO_VECTOR4D
+constexpr inline QVector4D QVector3D::toVector4D() const noexcept
+{
+ return QVector4D(v[0], v[1], v[2], 0.0f);
+}
+#endif
+
+constexpr inline QPoint QVector3D::toPoint() const noexcept
+{
+ return QPoint(qRound(v[0]), qRound(v[1]));
+}
+
+constexpr inline QPointF QVector3D::toPointF() const noexcept
+{
+ return QPointF(qreal(v[0]), qreal(v[1]));
+}
+
+#ifndef QT_NO_DEBUG_STREAM
+Q_GUI_EXPORT QDebug operator<<(QDebug dbg, QVector3D vector);
+#endif
+
+#ifndef QT_NO_DATASTREAM
+Q_GUI_EXPORT QDataStream &operator<<(QDataStream &, QVector3D );
+Q_GUI_EXPORT QDataStream &operator>>(QDataStream &, QVector3D &);
+#endif
+
+#endif // QT_NO_VECTOR3D
+
+
+
+/***************************** QVector4D *****************************/
+
+#ifndef QT_NO_VECTOR4D
+
+constexpr inline QVector4D::QVector4D() noexcept : v{0.0f, 0.0f, 0.0f, 0.0f} {}
+
+constexpr inline QVector4D::QVector4D(float xpos, float ypos, float zpos, float wpos) noexcept : v{xpos, ypos, zpos, wpos} {}
+
+constexpr inline QVector4D::QVector4D(QPoint point) noexcept : v{float(point.x()), float(point.y()), 0.0f, 0.0f} {}
+
+constexpr inline QVector4D::QVector4D(QPointF point) noexcept : v{float(point.x()), float(point.y()), 0.0f, 0.0f} {}
+
+#ifndef QT_NO_VECTOR2D
+constexpr QVector4D::QVector4D(QVector2D vector) noexcept : v{vector[0], vector[1], 0.0f, 0.0f} {}
+constexpr QVector4D::QVector4D(QVector2D vector, float zpos, float wpos) noexcept : v{vector[0], vector[1], zpos, wpos} {}
+#endif
+#ifndef QT_NO_VECTOR3D
+constexpr QVector4D::QVector4D(QVector3D vector) noexcept : v{vector[0], vector[1], vector[2], 0.0f} {}
+constexpr QVector4D::QVector4D(QVector3D vector, float wpos) noexcept : v{vector[0], vector[1], vector[2], wpos} {}
+#endif
+
+constexpr inline bool QVector4D::isNull() const noexcept
+{
+ return qIsNull(v[0]) && qIsNull(v[1]) && qIsNull(v[2]) && qIsNull(v[3]);
+}
+
+constexpr inline float QVector4D::x() const noexcept { return v[0]; }
+constexpr inline float QVector4D::y() const noexcept { return v[1]; }
+constexpr inline float QVector4D::z() const noexcept { return v[2]; }
+constexpr inline float QVector4D::w() const noexcept { return v[3]; }
+
+constexpr inline void QVector4D::setX(float aX) noexcept { v[0] = aX; }
+constexpr inline void QVector4D::setY(float aY) noexcept { v[1] = aY; }
+constexpr inline void QVector4D::setZ(float aZ) noexcept { v[2] = aZ; }
+constexpr inline void QVector4D::setW(float aW) noexcept { v[3] = aW; }
+
+constexpr inline float &QVector4D::operator[](int i)
+{
+ Q_ASSERT(uint(i) < 4u);
+ return v[i];
+}
+
+constexpr inline float QVector4D::operator[](int i) const
+{
+ Q_ASSERT(uint(i) < 4u);
+ return v[i];
+}
+
+inline float QVector4D::length() const noexcept
+{
+ return qHypot(v[0], v[1], v[2], v[3]);
+}
+
+constexpr inline float QVector4D::lengthSquared() const noexcept
+{
+ return v[0] * v[0] + v[1] * v[1] + v[2] * v[2] + v[3] * v[3];
+}
+
+inline QVector4D QVector4D::normalized() const noexcept
+{
+ const float len = length();
+ return qFuzzyIsNull(len - 1.0f) ? *this : qFuzzyIsNull(len) ? QVector4D()
+ : QVector4D(v[0] / len, v[1] / len, v[2] / len, v[3] / len);
+}
+
+inline void QVector4D::normalize() noexcept
+{
+ const float len = length();
+ if (qFuzzyIsNull(len - 1.0f) || qFuzzyIsNull(len))
+ return;
+
+ v[0] /= len;
+ v[1] /= len;
+ v[2] /= len;
+ v[3] /= len;
+}
+
+constexpr inline QVector4D &QVector4D::operator+=(QVector4D vector) noexcept
+{
+ v[0] += vector.v[0];
+ v[1] += vector.v[1];
+ v[2] += vector.v[2];
+ v[3] += vector.v[3];
+ return *this;
+}
+
+constexpr inline QVector4D &QVector4D::operator-=(QVector4D vector) noexcept
+{
+ v[0] -= vector.v[0];
+ v[1] -= vector.v[1];
+ v[2] -= vector.v[2];
+ v[3] -= vector.v[3];
+ return *this;
+}
+
+constexpr inline QVector4D &QVector4D::operator*=(float factor) noexcept
+{
+ v[0] *= factor;
+ v[1] *= factor;
+ v[2] *= factor;
+ v[3] *= factor;
+ return *this;
+}
+
+constexpr inline QVector4D &QVector4D::operator*=(QVector4D vector) noexcept
+{
+ v[0] *= vector.v[0];
+ v[1] *= vector.v[1];
+ v[2] *= vector.v[2];
+ v[3] *= vector.v[3];
+ return *this;
+}
+
+constexpr inline QVector4D &QVector4D::operator/=(float divisor)
+{
+ Q_ASSERT(divisor < 0 || divisor > 0);
+ v[0] /= divisor;
+ v[1] /= divisor;
+ v[2] /= divisor;
+ v[3] /= divisor;
+ return *this;
+}
+
+constexpr inline QVector4D &QVector4D::operator/=(QVector4D vector)
+{
+ Q_ASSERT(vector.v[0] > 0 || vector.v[0] < 0);
+ Q_ASSERT(vector.v[1] > 0 || vector.v[1] < 0);
+ Q_ASSERT(vector.v[2] > 0 || vector.v[2] < 0);
+ Q_ASSERT(vector.v[3] > 0 || vector.v[3] < 0);
+ v[0] /= vector.v[0];
+ v[1] /= vector.v[1];
+ v[2] /= vector.v[2];
+ v[3] /= vector.v[3];
+ return *this;
+}
+
+constexpr float QVector4D::dotProduct(QVector4D v1, QVector4D v2) noexcept
+{
+ return v1.v[0] * v2.v[0] + v1.v[1] * v2.v[1] + v1.v[2] * v2.v[2] + v1.v[3] * v2.v[3];
+}
+
+#ifndef QT_NO_VECTOR2D
+
+constexpr inline QVector2D QVector4D::toVector2D() const noexcept
+{
+ return QVector2D(v[0], v[1]);
+}
+
+constexpr inline QVector2D QVector4D::toVector2DAffine() const noexcept
+{
+ if (qIsNull(v[3]))
+ return QVector2D();
+ return QVector2D(v[0] / v[3], v[1] / v[3]);
+}
+
+#endif // QT_NO_VECTOR2D
+
+#ifndef QT_NO_VECTOR3D
+
+constexpr inline QVector3D QVector4D::toVector3D() const noexcept
+{
+ return QVector3D(v[0], v[1], v[2]);
+}
+
+constexpr QVector3D QVector4D::toVector3DAffine() const noexcept
+{
+ if (qIsNull(v[3]))
+ return QVector3D();
+ return QVector3D(v[0] / v[3], v[1] / v[3], v[2] / v[3]);
+}
+
+#endif // QT_NO_VECTOR3D
+
+constexpr inline QPoint QVector4D::toPoint() const noexcept
+{
+ return QPoint(qRound(v[0]), qRound(v[1]));
+}
+
+constexpr inline QPointF QVector4D::toPointF() const noexcept
+{
+ return QPointF(qreal(v[0]), qreal(v[1]));
+}
+
+#ifndef QT_NO_DEBUG_STREAM
+Q_GUI_EXPORT QDebug operator<<(QDebug dbg, QVector4D vector);
+#endif
+
+#ifndef QT_NO_DATASTREAM
+Q_GUI_EXPORT QDataStream &operator<<(QDataStream &, QVector4D );
+Q_GUI_EXPORT QDataStream &operator>>(QDataStream &, QVector4D &);
+#endif
+
+#endif // QT_NO_VECTOR4D
+
+
+QT_END_NAMESPACE
+
+/***************************** Tuple protocol *****************************/
+
+namespace std {
+#ifndef QT_NO_VECTOR2D
+ template <>
+ class tuple_size<QT_PREPEND_NAMESPACE(QVector2D)> : public integral_constant<size_t, 2> {};
+ template <>
+ class tuple_element<0, QT_PREPEND_NAMESPACE(QVector2D)> { public: using type = float; };
+ template <>
+ class tuple_element<1, QT_PREPEND_NAMESPACE(QVector2D)> { public: using type = float; };
+#endif // QT_NO_VECTOR2D
+
+#ifndef QT_NO_VECTOR3D
+ template <>
+ class tuple_size<QT_PREPEND_NAMESPACE(QVector3D)> : public integral_constant<size_t, 3> {};
+ template <>
+ class tuple_element<0, QT_PREPEND_NAMESPACE(QVector3D)> { public: using type = float; };
+ template <>
+ class tuple_element<1, QT_PREPEND_NAMESPACE(QVector3D)> { public: using type = float; };
+ template <>
+ class tuple_element<2, QT_PREPEND_NAMESPACE(QVector3D)> { public: using type = float; };
+#endif // QT_NO_VECTOR3D
+
+#ifndef QT_NO_VECTOR4D
+ template <>
+ class tuple_size<QT_PREPEND_NAMESPACE(QVector4D)> : public integral_constant<size_t, 4> {};
+ template <>
+ class tuple_element<0, QT_PREPEND_NAMESPACE(QVector4D)> { public: using type = float; };
+ template <>
+ class tuple_element<1, QT_PREPEND_NAMESPACE(QVector4D)> { public: using type = float; };
+ template <>
+ class tuple_element<2, QT_PREPEND_NAMESPACE(QVector4D)> { public: using type = float; };
+ template <>
+ class tuple_element<3, QT_PREPEND_NAMESPACE(QVector4D)> { public: using type = float; };
+#endif // QT_NO_VECTOR4D
+}
+
+#endif // QVECTORND_H
diff --git a/src/gui/opengl/opengl.pri b/src/gui/opengl/opengl.pri
deleted file mode 100644
index 26060ea5df..0000000000
--- a/src/gui/opengl/opengl.pri
+++ /dev/null
@@ -1,123 +0,0 @@
-# Qt gui library, opengl module
-
-qtConfig(opengl): CONFIG += opengl
-qtConfig(opengles2): CONFIG += opengles2
-
-qtConfig(opengl) {
-
- HEADERS += opengl/qopengl.h \
- opengl/qopengl_p.h \
- opengl/qopenglfunctions.h \
- opengl/qopenglframebufferobject.h \
- opengl/qopenglframebufferobject_p.h \
- opengl/qopenglpaintdevice.h \
- opengl/qopenglpaintdevice_p.h \
- opengl/qopenglbuffer.h \
- opengl/qopenglshaderprogram.h \
- opengl/qopenglextensions_p.h \
- opengl/qopenglgradientcache_p.h \
- opengl/qopengltexturecache_p.h \
- opengl/qopenglengineshadermanager_p.h \
- opengl/qopengl2pexvertexarray_p.h \
- opengl/qopenglpaintengine_p.h \
- opengl/qopenglengineshadersource_p.h \
- opengl/qopenglcustomshaderstage_p.h \
- opengl/qopengltextureglyphcache_p.h \
- opengl/qopenglshadercache_p.h \
- opengl/qopenglversionfunctions.h \
- opengl/qopenglversionfunctionsfactory_p.h \
- opengl/qopenglvertexarrayobject.h \
- opengl/qopengltextureblitter.h \
- opengl/qopengltexture.h \
- opengl/qopengltexture_p.h \
- opengl/qopengltexturehelper_p.h \
- opengl/qopengltextureuploader_p.h \
- opengl/qopenglpixeltransferoptions.h \
- opengl/qopenglextrafunctions.h \
- opengl/qopenglprogrambinarycache_p.h
-
- SOURCES += opengl/qopengl.cpp \
- opengl/qopenglfunctions.cpp \
- opengl/qopenglframebufferobject.cpp \
- opengl/qopenglpaintdevice.cpp \
- opengl/qopenglbuffer.cpp \
- opengl/qopenglshaderprogram.cpp \
- opengl/qopenglgradientcache.cpp \
- opengl/qopengltexturecache.cpp \
- opengl/qopenglengineshadermanager.cpp \
- opengl/qopengl2pexvertexarray.cpp \
- opengl/qopenglpaintengine.cpp \
- opengl/qopenglcustomshaderstage.cpp \
- opengl/qopengltextureglyphcache.cpp \
- opengl/qopenglversionfunctions.cpp \
- opengl/qopenglversionfunctionsfactory.cpp \
- opengl/qopenglvertexarrayobject.cpp \
- opengl/qopengltextureblitter.cpp \
- opengl/qopengltexture.cpp \
- opengl/qopengltexturehelper.cpp \
- opengl/qopengltextureuploader.cpp \
- opengl/qopenglpixeltransferoptions.cpp \
- opengl/qopenglprogrambinarycache.cpp
-
- !qtConfig(opengles2) {
- HEADERS += opengl/qopenglfunctions_1_0.h \
- opengl/qopenglfunctions_1_1.h \
- opengl/qopenglfunctions_1_2.h \
- opengl/qopenglfunctions_1_3.h \
- opengl/qopenglfunctions_1_4.h \
- opengl/qopenglfunctions_1_5.h \
- opengl/qopenglfunctions_2_0.h \
- opengl/qopenglfunctions_2_1.h \
- opengl/qopenglfunctions_3_0.h \
- opengl/qopenglfunctions_3_1.h \
- opengl/qopenglfunctions_3_2_core.h \
- opengl/qopenglfunctions_3_3_core.h \
- opengl/qopenglfunctions_4_0_core.h \
- opengl/qopenglfunctions_4_1_core.h \
- opengl/qopenglfunctions_4_2_core.h \
- opengl/qopenglfunctions_4_3_core.h \
- opengl/qopenglfunctions_4_4_core.h \
- opengl/qopenglfunctions_4_5_core.h \
- opengl/qopenglfunctions_3_2_compatibility.h \
- opengl/qopenglfunctions_3_3_compatibility.h \
- opengl/qopenglfunctions_4_0_compatibility.h \
- opengl/qopenglfunctions_4_1_compatibility.h \
- opengl/qopenglfunctions_4_2_compatibility.h \
- opengl/qopenglfunctions_4_3_compatibility.h \
- opengl/qopenglfunctions_4_4_compatibility.h \
- opengl/qopenglfunctions_4_5_compatibility.h
-
- SOURCES += opengl/qopenglfunctions_1_0.cpp \
- opengl/qopenglfunctions_1_1.cpp \
- opengl/qopenglfunctions_1_2.cpp \
- opengl/qopenglfunctions_1_3.cpp \
- opengl/qopenglfunctions_1_4.cpp \
- opengl/qopenglfunctions_1_5.cpp \
- opengl/qopenglfunctions_2_0.cpp \
- opengl/qopenglfunctions_2_1.cpp \
- opengl/qopenglfunctions_3_0.cpp \
- opengl/qopenglfunctions_3_1.cpp \
- opengl/qopenglfunctions_3_2_core.cpp \
- opengl/qopenglfunctions_3_3_core.cpp \
- opengl/qopenglfunctions_4_0_core.cpp \
- opengl/qopenglfunctions_4_1_core.cpp \
- opengl/qopenglfunctions_4_2_core.cpp \
- opengl/qopenglfunctions_4_3_core.cpp \
- opengl/qopenglfunctions_4_4_core.cpp \
- opengl/qopenglfunctions_4_5_core.cpp \
- opengl/qopenglfunctions_3_2_compatibility.cpp \
- opengl/qopenglfunctions_3_3_compatibility.cpp \
- opengl/qopenglfunctions_4_0_compatibility.cpp \
- opengl/qopenglfunctions_4_1_compatibility.cpp \
- opengl/qopenglfunctions_4_2_compatibility.cpp \
- opengl/qopenglfunctions_4_3_compatibility.cpp \
- opengl/qopenglfunctions_4_4_compatibility.cpp \
- opengl/qopenglfunctions_4_5_compatibility.cpp
- }
-
- qtConfig(opengles2) {
- HEADERS += opengl/qopenglfunctions_es2.h
-
- SOURCES += opengl/qopenglfunctions_es2.cpp
- }
-}
diff --git a/src/gui/opengl/platform/egl/qeglconvenience.cpp b/src/gui/opengl/platform/egl/qeglconvenience.cpp
new file mode 100644
index 0000000000..4af50d72f2
--- /dev/null
+++ b/src/gui/opengl/platform/egl/qeglconvenience.cpp
@@ -0,0 +1,596 @@
+// Copyright (C) 2020 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
+
+
+#include <QtCore/qbytearray.h>
+#include <QtGui/qopenglcontext.h>
+
+#ifdef Q_OS_LINUX
+#include <sys/ioctl.h>
+#include <linux/fb.h>
+#endif
+#include <QtGui/private/qmath_p.h>
+
+#include "qeglconvenience_p.h"
+
+#ifndef EGL_OPENGL_ES3_BIT_KHR
+#define EGL_OPENGL_ES3_BIT_KHR 0x0040
+#endif
+
+QT_BEGIN_NAMESPACE
+
+QList<EGLint> q_createConfigAttributesFromFormat(const QSurfaceFormat &format)
+{
+ int redSize = format.redBufferSize();
+ int greenSize = format.greenBufferSize();
+ int blueSize = format.blueBufferSize();
+ int alphaSize = format.alphaBufferSize();
+ int depthSize = format.depthBufferSize();
+ int stencilSize = format.stencilBufferSize();
+ int sampleCount = format.samples();
+
+ QList<EGLint> configAttributes;
+
+ // Map default, unspecified values (-1) to 0. This is important due to sorting rule #3
+ // in section 3.4.1 of the spec and allows picking a potentially faster 16-bit config
+ // over 32-bit ones when there is no explicit request for the color channel sizes:
+ //
+ // The red/green/blue sizes have a sort priority of 3, so they are sorted by
+ // first. (unless a caveat like SLOW or NON_CONFORMANT is present) The sort order is
+ // Special and described as "by larger _total_ number of color bits.". So EGL will put
+ // 32-bit configs in the list before the 16-bit configs. However, the spec also goes
+ // on to say "If the requested number of bits in attrib_list for a particular
+ // component is 0, then the number of bits for that component is not considered". This
+ // part of the spec also seems to imply that setting the red/green/blue bits to zero
+ // means none of the components are considered and EGL disregards the entire sorting
+ // rule. It then looks to the next highest priority rule, which is
+ // EGL_BUFFER_SIZE. Despite the selection criteria being "AtLeast" for
+ // EGL_BUFFER_SIZE, it's sort order is "smaller" meaning 16-bit configs are put in the
+ // list before 32-bit configs.
+ //
+ // This also means that explicitly specifying a size like 565 will still result in
+ // having larger (888) configs first in the returned list. We need to handle this
+ // ourselves later by manually filtering the list, instead of just blindly taking the
+ // first config from it.
+
+ configAttributes.append(EGL_RED_SIZE);
+ configAttributes.append(redSize > 0 ? redSize : 0);
+
+ configAttributes.append(EGL_GREEN_SIZE);
+ configAttributes.append(greenSize > 0 ? greenSize : 0);
+
+ configAttributes.append(EGL_BLUE_SIZE);
+ configAttributes.append(blueSize > 0 ? blueSize : 0);
+
+ configAttributes.append(EGL_ALPHA_SIZE);
+ configAttributes.append(alphaSize > 0 ? alphaSize : 0);
+
+ configAttributes.append(EGL_SAMPLES);
+ configAttributes.append(sampleCount > 0 ? sampleCount : 0);
+
+ configAttributes.append(EGL_SAMPLE_BUFFERS);
+ configAttributes.append(sampleCount > 0);
+
+ if (format.renderableType() != QSurfaceFormat::OpenVG) {
+ configAttributes.append(EGL_DEPTH_SIZE);
+ configAttributes.append(depthSize > 0 ? depthSize : 0);
+
+ configAttributes.append(EGL_STENCIL_SIZE);
+ configAttributes.append(stencilSize > 0 ? stencilSize : 0);
+ } else {
+ // OpenVG needs alpha mask for clipping
+ configAttributes.append(EGL_ALPHA_MASK_SIZE);
+ configAttributes.append(8);
+ }
+
+ return configAttributes;
+}
+
+bool q_reduceConfigAttributes(QList<EGLint> *configAttributes)
+{
+ // Reduce the complexity of a configuration request to ask for less
+ // because the previous request did not result in success. Returns
+ // true if the complexity was reduced, or false if no further
+ // reductions in complexity are possible.
+
+ qsizetype i = configAttributes->indexOf(EGL_SWAP_BEHAVIOR);
+ if (i >= 0) {
+ configAttributes->remove(i,2);
+ }
+
+#ifdef EGL_VG_ALPHA_FORMAT_PRE_BIT
+ // For OpenVG, we sometimes try to create a surface using a pre-multiplied format. If we can't
+ // find a config which supports pre-multiplied formats, remove the flag on the surface type:
+
+ i = configAttributes->indexOf(EGL_SURFACE_TYPE);
+ if (i >= 0) {
+ EGLint surfaceType = configAttributes->at(i +1);
+ if (surfaceType & EGL_VG_ALPHA_FORMAT_PRE_BIT) {
+ surfaceType ^= EGL_VG_ALPHA_FORMAT_PRE_BIT;
+ configAttributes->replace(i+1,surfaceType);
+ return true;
+ }
+ }
+#endif
+
+ // EGL chooses configs with the highest color depth over
+ // those with smaller (but faster) lower color depths. One
+ // way around this is to set EGL_BUFFER_SIZE to 16, which
+ // trumps the others. Of course, there may not be a 16-bit
+ // config available, so it's the first restraint we remove.
+ i = configAttributes->indexOf(EGL_BUFFER_SIZE);
+ if (i >= 0) {
+ if (configAttributes->at(i+1) == 16) {
+ configAttributes->remove(i,2);
+ return true;
+ }
+ }
+
+ i = configAttributes->indexOf(EGL_SAMPLES);
+ if (i >= 0) {
+ EGLint value = configAttributes->value(i+1, 0);
+ if (value > 1)
+ configAttributes->replace(i+1, qMin(EGLint(16), value / 2));
+ else
+ configAttributes->remove(i, 2);
+ return true;
+ }
+
+ i = configAttributes->indexOf(EGL_SAMPLE_BUFFERS);
+ if (i >= 0) {
+ configAttributes->remove(i,2);
+ return true;
+ }
+
+ i = configAttributes->indexOf(EGL_DEPTH_SIZE);
+ if (i >= 0) {
+ if (configAttributes->at(i + 1) >= 32)
+ configAttributes->replace(i + 1, 24);
+ else if (configAttributes->at(i + 1) > 1)
+ configAttributes->replace(i + 1, 1);
+ else
+ configAttributes->remove(i, 2);
+ return true;
+ }
+
+ i = configAttributes->indexOf(EGL_ALPHA_SIZE);
+ if (i >= 0) {
+ configAttributes->remove(i,2);
+#if defined(EGL_BIND_TO_TEXTURE_RGBA) && defined(EGL_BIND_TO_TEXTURE_RGB)
+ i = configAttributes->indexOf(EGL_BIND_TO_TEXTURE_RGBA);
+ if (i >= 0) {
+ configAttributes->replace(i,EGL_BIND_TO_TEXTURE_RGB);
+ configAttributes->replace(i+1,true);
+
+ }
+#endif
+ return true;
+ }
+
+ i = configAttributes->indexOf(EGL_STENCIL_SIZE);
+ if (i >= 0) {
+ if (configAttributes->at(i + 1) > 1)
+ configAttributes->replace(i + 1, 1);
+ else
+ configAttributes->remove(i, 2);
+ return true;
+ }
+
+#ifdef EGL_BIND_TO_TEXTURE_RGB
+ i = configAttributes->indexOf(EGL_BIND_TO_TEXTURE_RGB);
+ if (i >= 0) {
+ configAttributes->remove(i,2);
+ return true;
+ }
+#endif
+
+ return false;
+}
+
+QEglConfigChooser::QEglConfigChooser(EGLDisplay display)
+ : m_display(display)
+ , m_surfaceType(EGL_WINDOW_BIT)
+ , m_ignore(false)
+ , m_confAttrRed(0)
+ , m_confAttrGreen(0)
+ , m_confAttrBlue(0)
+ , m_confAttrAlpha(0)
+{
+}
+
+QEglConfigChooser::~QEglConfigChooser()
+{
+}
+
+EGLConfig QEglConfigChooser::chooseConfig()
+{
+ QList<EGLint> configureAttributes = q_createConfigAttributesFromFormat(m_format);
+ configureAttributes.append(EGL_SURFACE_TYPE);
+ configureAttributes.append(surfaceType());
+
+ configureAttributes.append(EGL_RENDERABLE_TYPE);
+ bool needsES2Plus = false;
+ switch (m_format.renderableType()) {
+ case QSurfaceFormat::OpenVG:
+ configureAttributes.append(EGL_OPENVG_BIT);
+ break;
+#ifdef EGL_VERSION_1_4
+ case QSurfaceFormat::DefaultRenderableType: {
+#ifndef QT_NO_OPENGL
+ // NVIDIA EGL only provides desktop GL for development purposes, and recommends against using it.
+ const char *vendor = eglQueryString(display(), EGL_VENDOR);
+ if (QOpenGLContext::openGLModuleType() == QOpenGLContext::LibGL && (!vendor || !strstr(vendor, "NVIDIA")))
+ configureAttributes.append(EGL_OPENGL_BIT);
+ else
+#endif // QT_NO_OPENGL
+ needsES2Plus = true;
+ break;
+ }
+ case QSurfaceFormat::OpenGL:
+ configureAttributes.append(EGL_OPENGL_BIT);
+ break;
+#endif
+ case QSurfaceFormat::OpenGLES:
+ if (m_format.majorVersion() == 1) {
+ configureAttributes.append(EGL_OPENGL_ES_BIT);
+ break;
+ }
+ Q_FALLTHROUGH();
+ default:
+ needsES2Plus = true;
+ break;
+ }
+ if (needsES2Plus) {
+ if (m_format.majorVersion() >= 3 && q_hasEglExtension(display(), "EGL_KHR_create_context"))
+ configureAttributes.append(EGL_OPENGL_ES3_BIT_KHR);
+ else
+ configureAttributes.append(EGL_OPENGL_ES2_BIT);
+ }
+ configureAttributes.append(EGL_NONE);
+
+ EGLConfig cfg = nullptr;
+ do {
+ // Get the number of matching configurations for this set of properties.
+ EGLint matching = 0;
+ if (!eglChooseConfig(display(), configureAttributes.constData(), nullptr, 0, &matching) || !matching)
+ continue;
+
+ // Fetch all of the matching configurations and find the
+ // first that matches the pixel format we wanted.
+ qsizetype i = configureAttributes.indexOf(EGL_RED_SIZE);
+ m_confAttrRed = configureAttributes.at(i+1);
+ i = configureAttributes.indexOf(EGL_GREEN_SIZE);
+ m_confAttrGreen = configureAttributes.at(i+1);
+ i = configureAttributes.indexOf(EGL_BLUE_SIZE);
+ m_confAttrBlue = configureAttributes.at(i+1);
+ i = configureAttributes.indexOf(EGL_ALPHA_SIZE);
+ m_confAttrAlpha = i == -1 ? 0 : configureAttributes.at(i+1);
+
+ QList<EGLConfig> configs(matching);
+ eglChooseConfig(display(), configureAttributes.constData(), configs.data(),
+ EGLint(configs.size()), &matching);
+ if (!cfg && matching > 0)
+ cfg = configs.first();
+
+ // Filter the list. Due to the EGL sorting rules configs with higher depth are
+ // placed first when the minimum color channel sizes have been specified (i.e. the
+ // QSurfaceFormat contains color sizes > 0). To prevent returning a 888 config
+ // when the QSurfaceFormat explicitly asked for 565, go through the returned
+ // configs and look for one that exactly matches the requested sizes. When no
+ // sizes have been given, take the first, which will be a config with the smaller
+ // (e.g. 16-bit) depth.
+ for (int i = 0; i < configs.size(); ++i) {
+ if (filterConfig(configs[i]))
+ return configs.at(i);
+ }
+ } while (q_reduceConfigAttributes(&configureAttributes));
+
+ if (!cfg)
+ qWarning("Cannot find EGLConfig, returning null config");
+ return cfg;
+}
+
+bool QEglConfigChooser::filterConfig(EGLConfig config) const
+{
+ // If we are fine with the highest depth (e.g. RGB888 configs) even when something
+ // smaller (565) was explicitly requested, do nothing.
+ if (m_ignore)
+ return true;
+
+ EGLint red = 0;
+ EGLint green = 0;
+ EGLint blue = 0;
+ EGLint alpha = 0;
+
+ // Compare only if a size was given. Otherwise just accept.
+ if (m_confAttrRed)
+ eglGetConfigAttrib(display(), config, EGL_RED_SIZE, &red);
+ if (m_confAttrGreen)
+ eglGetConfigAttrib(display(), config, EGL_GREEN_SIZE, &green);
+ if (m_confAttrBlue)
+ eglGetConfigAttrib(display(), config, EGL_BLUE_SIZE, &blue);
+ if (m_confAttrAlpha)
+ eglGetConfigAttrib(display(), config, EGL_ALPHA_SIZE, &alpha);
+
+ return red == m_confAttrRed && green == m_confAttrGreen
+ && blue == m_confAttrBlue && alpha == m_confAttrAlpha;
+}
+
+EGLConfig q_configFromGLFormat(EGLDisplay display, const QSurfaceFormat &format, bool highestPixelFormat, int surfaceType)
+{
+ QEglConfigChooser chooser(display);
+ chooser.setSurfaceFormat(format);
+ chooser.setSurfaceType(surfaceType);
+ chooser.setIgnoreColorChannels(highestPixelFormat);
+
+ return chooser.chooseConfig();
+}
+
+QSurfaceFormat q_glFormatFromConfig(EGLDisplay display, const EGLConfig config, const QSurfaceFormat &referenceFormat)
+{
+ QSurfaceFormat format;
+ EGLint redSize = 0;
+ EGLint greenSize = 0;
+ EGLint blueSize = 0;
+ EGLint alphaSize = 0;
+ EGLint depthSize = 0;
+ EGLint stencilSize = 0;
+ EGLint sampleCount = 0;
+ EGLint renderableType = 0;
+
+ eglGetConfigAttrib(display, config, EGL_RED_SIZE, &redSize);
+ eglGetConfigAttrib(display, config, EGL_GREEN_SIZE, &greenSize);
+ eglGetConfigAttrib(display, config, EGL_BLUE_SIZE, &blueSize);
+ eglGetConfigAttrib(display, config, EGL_ALPHA_SIZE, &alphaSize);
+ eglGetConfigAttrib(display, config, EGL_DEPTH_SIZE, &depthSize);
+ eglGetConfigAttrib(display, config, EGL_STENCIL_SIZE, &stencilSize);
+ eglGetConfigAttrib(display, config, EGL_SAMPLES, &sampleCount);
+ eglGetConfigAttrib(display, config, EGL_RENDERABLE_TYPE, &renderableType);
+
+ if (referenceFormat.renderableType() == QSurfaceFormat::OpenVG && (renderableType & EGL_OPENVG_BIT))
+ format.setRenderableType(QSurfaceFormat::OpenVG);
+#ifdef EGL_VERSION_1_4
+ else if (referenceFormat.renderableType() == QSurfaceFormat::OpenGL
+ && (renderableType & EGL_OPENGL_BIT))
+ format.setRenderableType(QSurfaceFormat::OpenGL);
+ else if (referenceFormat.renderableType() == QSurfaceFormat::DefaultRenderableType
+#ifndef QT_NO_OPENGL
+ && QOpenGLContext::openGLModuleType() == QOpenGLContext::LibGL
+ && !strstr(eglQueryString(display, EGL_VENDOR), "NVIDIA")
+#endif
+ && (renderableType & EGL_OPENGL_BIT))
+ format.setRenderableType(QSurfaceFormat::OpenGL);
+#endif
+ else
+ format.setRenderableType(QSurfaceFormat::OpenGLES);
+
+ format.setRedBufferSize(redSize);
+ format.setGreenBufferSize(greenSize);
+ format.setBlueBufferSize(blueSize);
+ format.setAlphaBufferSize(alphaSize);
+ format.setDepthBufferSize(depthSize);
+ format.setStencilBufferSize(stencilSize);
+ format.setSamples(sampleCount);
+ format.setStereo(false); // EGL doesn't support stereo buffers
+ format.setSwapInterval(referenceFormat.swapInterval());
+
+ // Clear the EGL error state because some of the above may
+ // have errored out because the attribute is not applicable
+ // to the surface type. Such errors don't matter.
+ eglGetError();
+
+ return format;
+}
+
+bool q_hasEglExtension(EGLDisplay display, const char* extensionName)
+{
+ QList<QByteArray> extensions =
+ QByteArray(reinterpret_cast<const char *>
+ (eglQueryString(display, EGL_EXTENSIONS))).split(' ');
+ return extensions.contains(extensionName);
+}
+
+struct AttrInfo { EGLint attr; const char *name; };
+static struct AttrInfo attrs[] = {
+ {EGL_BUFFER_SIZE, "EGL_BUFFER_SIZE"},
+ {EGL_ALPHA_SIZE, "EGL_ALPHA_SIZE"},
+ {EGL_BLUE_SIZE, "EGL_BLUE_SIZE"},
+ {EGL_GREEN_SIZE, "EGL_GREEN_SIZE"},
+ {EGL_RED_SIZE, "EGL_RED_SIZE"},
+ {EGL_DEPTH_SIZE, "EGL_DEPTH_SIZE"},
+ {EGL_STENCIL_SIZE, "EGL_STENCIL_SIZE"},
+ {EGL_CONFIG_CAVEAT, "EGL_CONFIG_CAVEAT"},
+ {EGL_CONFIG_ID, "EGL_CONFIG_ID"},
+ {EGL_LEVEL, "EGL_LEVEL"},
+ {EGL_MAX_PBUFFER_HEIGHT, "EGL_MAX_PBUFFER_HEIGHT"},
+ {EGL_MAX_PBUFFER_PIXELS, "EGL_MAX_PBUFFER_PIXELS"},
+ {EGL_MAX_PBUFFER_WIDTH, "EGL_MAX_PBUFFER_WIDTH"},
+ {EGL_NATIVE_RENDERABLE, "EGL_NATIVE_RENDERABLE"},
+ {EGL_NATIVE_VISUAL_ID, "EGL_NATIVE_VISUAL_ID"},
+ {EGL_NATIVE_VISUAL_TYPE, "EGL_NATIVE_VISUAL_TYPE"},
+ {EGL_SAMPLES, "EGL_SAMPLES"},
+ {EGL_SAMPLE_BUFFERS, "EGL_SAMPLE_BUFFERS"},
+ {EGL_SURFACE_TYPE, "EGL_SURFACE_TYPE"},
+ {EGL_TRANSPARENT_TYPE, "EGL_TRANSPARENT_TYPE"},
+ {EGL_TRANSPARENT_BLUE_VALUE, "EGL_TRANSPARENT_BLUE_VALUE"},
+ {EGL_TRANSPARENT_GREEN_VALUE, "EGL_TRANSPARENT_GREEN_VALUE"},
+ {EGL_TRANSPARENT_RED_VALUE, "EGL_TRANSPARENT_RED_VALUE"},
+ {EGL_BIND_TO_TEXTURE_RGB, "EGL_BIND_TO_TEXTURE_RGB"},
+ {EGL_BIND_TO_TEXTURE_RGBA, "EGL_BIND_TO_TEXTURE_RGBA"},
+ {EGL_MIN_SWAP_INTERVAL, "EGL_MIN_SWAP_INTERVAL"},
+ {EGL_MAX_SWAP_INTERVAL, "EGL_MAX_SWAP_INTERVAL"},
+ {-1, nullptr}};
+
+void q_printEglConfig(EGLDisplay display, EGLConfig config)
+{
+ EGLint index;
+ for (index = 0; attrs[index].attr != -1; ++index) {
+ EGLint value;
+ if (eglGetConfigAttrib(display, config, attrs[index].attr, &value)) {
+ qDebug("\t%s: %d", attrs[index].name, (int)value);
+ }
+ }
+}
+
+#ifdef Q_OS_UNIX
+
+QSizeF q_physicalScreenSizeFromFb(int framebufferDevice, const QSize &screenSize)
+{
+#ifndef Q_OS_LINUX
+ Q_UNUSED(framebufferDevice);
+#endif
+ const int defaultPhysicalDpi = 100;
+ static QSizeF size;
+
+ if (size.isEmpty()) {
+ // Note: in millimeters
+ int width = qEnvironmentVariableIntValue("QT_QPA_EGLFS_PHYSICAL_WIDTH");
+ int height = qEnvironmentVariableIntValue("QT_QPA_EGLFS_PHYSICAL_HEIGHT");
+
+ if (width && height) {
+ size.setWidth(width);
+ size.setHeight(height);
+ return size;
+ }
+
+ int w = -1;
+ int h = -1;
+ QSize screenResolution;
+#ifdef Q_OS_LINUX
+ struct fb_var_screeninfo vinfo;
+
+ if (framebufferDevice != -1) {
+ if (ioctl(framebufferDevice, FBIOGET_VSCREENINFO, &vinfo) == -1) {
+ qWarning("eglconvenience: Could not query screen info");
+ } else {
+ w = vinfo.width;
+ h = vinfo.height;
+ screenResolution = QSize(vinfo.xres, vinfo.yres);
+ }
+ } else
+#endif
+ {
+ // Use the provided screen size, when available, since some platforms may have their own
+ // specific way to query it. Otherwise try querying it from the framebuffer.
+ screenResolution = screenSize.isEmpty() ? q_screenSizeFromFb(framebufferDevice) : screenSize;
+ }
+
+ size.setWidth(w <= 0 ? screenResolution.width() * Q_MM_PER_INCH / defaultPhysicalDpi : qreal(w));
+ size.setHeight(h <= 0 ? screenResolution.height() * Q_MM_PER_INCH / defaultPhysicalDpi : qreal(h));
+
+ if (w <= 0 || h <= 0)
+ qWarning("Unable to query physical screen size, defaulting to %d dpi.\n"
+ "To override, set QT_QPA_EGLFS_PHYSICAL_WIDTH "
+ "and QT_QPA_EGLFS_PHYSICAL_HEIGHT (in millimeters).", defaultPhysicalDpi);
+ }
+
+ return size;
+}
+
+QSize q_screenSizeFromFb(int framebufferDevice)
+{
+#ifndef Q_OS_LINUX
+ Q_UNUSED(framebufferDevice);
+#endif
+ const int defaultWidth = 800;
+ const int defaultHeight = 600;
+ static QSize size;
+
+ if (size.isEmpty()) {
+ int width = qEnvironmentVariableIntValue("QT_QPA_EGLFS_WIDTH");
+ int height = qEnvironmentVariableIntValue("QT_QPA_EGLFS_HEIGHT");
+
+ if (width && height) {
+ size.setWidth(width);
+ size.setHeight(height);
+ return size;
+ }
+
+#ifdef Q_OS_LINUX
+ struct fb_var_screeninfo vinfo;
+ int xres = -1;
+ int yres = -1;
+
+ if (framebufferDevice != -1) {
+ if (ioctl(framebufferDevice, FBIOGET_VSCREENINFO, &vinfo) == -1) {
+ qWarning("eglconvenience: Could not read screen info");
+ } else {
+ xres = vinfo.xres;
+ yres = vinfo.yres;
+ }
+ }
+
+ size.setWidth(xres <= 0 ? defaultWidth : xres);
+ size.setHeight(yres <= 0 ? defaultHeight : yres);
+#else
+ size.setWidth(defaultWidth);
+ size.setHeight(defaultHeight);
+#endif
+ }
+
+ return size;
+}
+
+int q_screenDepthFromFb(int framebufferDevice)
+{
+#ifndef Q_OS_LINUX
+ Q_UNUSED(framebufferDevice);
+#endif
+ const int defaultDepth = 32;
+ static int depth = qEnvironmentVariableIntValue("QT_QPA_EGLFS_DEPTH");
+
+ if (depth == 0) {
+#ifdef Q_OS_LINUX
+ struct fb_var_screeninfo vinfo;
+
+ if (framebufferDevice != -1) {
+ if (ioctl(framebufferDevice, FBIOGET_VSCREENINFO, &vinfo) == -1)
+ qWarning("eglconvenience: Could not query screen info");
+ else
+ depth = vinfo.bits_per_pixel;
+ }
+
+ if (depth <= 0)
+ depth = defaultDepth;
+#else
+ depth = defaultDepth;
+#endif
+ }
+
+ return depth;
+}
+
+qreal q_refreshRateFromFb(int framebufferDevice)
+{
+#ifndef Q_OS_LINUX
+ Q_UNUSED(framebufferDevice);
+#endif
+
+ static qreal rate = 0;
+
+#ifdef Q_OS_LINUX
+ if (rate == 0) {
+ if (framebufferDevice != -1) {
+ struct fb_var_screeninfo vinfo;
+ if (ioctl(framebufferDevice, FBIOGET_VSCREENINFO, &vinfo) != -1) {
+ const quint64 quot = quint64(vinfo.left_margin + vinfo.right_margin + vinfo.xres + vinfo.hsync_len)
+ * quint64(vinfo.upper_margin + vinfo.lower_margin + vinfo.yres + vinfo.vsync_len)
+ * vinfo.pixclock;
+ if (quot)
+ rate = 1000000000000LLU / quot;
+ } else {
+ qWarning("eglconvenience: Could not query screen info");
+ }
+ }
+ }
+#endif
+
+ if (rate == 0)
+ rate = 60;
+
+ return rate;
+}
+
+#endif // Q_OS_UNIX
+
+QT_END_NAMESPACE
diff --git a/src/gui/opengl/platform/egl/qeglconvenience_p.h b/src/gui/opengl/platform/egl/qeglconvenience_p.h
new file mode 100644
index 0000000000..d4a250c90f
--- /dev/null
+++ b/src/gui/opengl/platform/egl/qeglconvenience_p.h
@@ -0,0 +1,91 @@
+// Copyright (C) 2020 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
+
+#ifndef QEGLCONVENIENCE_H
+#define QEGLCONVENIENCE_H
+
+//
+// W A R N I N G
+// -------------
+//
+// This file is not part of the Qt API. It exists purely as an
+// implementation detail. This header file may change from version to
+// version without notice, or even be removed.
+//
+// We mean it.
+//
+
+#include <QtGui/qsurfaceformat.h>
+#include <QtCore/qlist.h>
+#include <QtCore/qsize.h>
+
+#include <QtGui/private/qt_egl_p.h>
+
+
+QT_BEGIN_NAMESPACE
+
+Q_GUI_EXPORT QList<EGLint> q_createConfigAttributesFromFormat(const QSurfaceFormat &format);
+
+Q_GUI_EXPORT bool q_reduceConfigAttributes(QList<EGLint> *configAttributes);
+
+Q_GUI_EXPORT EGLConfig q_configFromGLFormat(EGLDisplay display,
+ const QSurfaceFormat &format,
+ bool highestPixelFormat = false,
+ int surfaceType = EGL_WINDOW_BIT);
+
+Q_GUI_EXPORT QSurfaceFormat q_glFormatFromConfig(EGLDisplay display, const EGLConfig config,
+ const QSurfaceFormat &referenceFormat = {});
+
+Q_GUI_EXPORT bool q_hasEglExtension(EGLDisplay display,const char* extensionName);
+
+Q_GUI_EXPORT void q_printEglConfig(EGLDisplay display, EGLConfig config);
+
+#ifdef Q_OS_UNIX
+Q_GUI_EXPORT QSizeF q_physicalScreenSizeFromFb(int framebufferDevice,
+ const QSize &screenSize = {});
+
+Q_GUI_EXPORT QSize q_screenSizeFromFb(int framebufferDevice);
+
+Q_GUI_EXPORT int q_screenDepthFromFb(int framebufferDevice);
+
+Q_GUI_EXPORT qreal q_refreshRateFromFb(int framebufferDevice);
+
+#endif
+
+class Q_GUI_EXPORT QEglConfigChooser
+{
+public:
+ QEglConfigChooser(EGLDisplay display);
+ virtual ~QEglConfigChooser();
+
+ EGLDisplay display() const { return m_display; }
+
+ void setSurfaceType(EGLint surfaceType) { m_surfaceType = surfaceType; }
+ EGLint surfaceType() const { return m_surfaceType; }
+
+ void setSurfaceFormat(const QSurfaceFormat &format) { m_format = format; }
+ QSurfaceFormat surfaceFormat() const { return m_format; }
+
+ void setIgnoreColorChannels(bool ignore) { m_ignore = ignore; }
+ bool ignoreColorChannels() const { return m_ignore; }
+
+ EGLConfig chooseConfig();
+
+protected:
+ virtual bool filterConfig(EGLConfig config) const;
+
+ QSurfaceFormat m_format;
+ EGLDisplay m_display;
+ EGLint m_surfaceType;
+ bool m_ignore;
+
+ int m_confAttrRed;
+ int m_confAttrGreen;
+ int m_confAttrBlue;
+ int m_confAttrAlpha;
+};
+
+
+QT_END_NAMESPACE
+
+#endif //QEGLCONVENIENCE_H
diff --git a/src/gui/opengl/platform/egl/qeglpbuffer.cpp b/src/gui/opengl/platform/egl/qeglpbuffer.cpp
new file mode 100644
index 0000000000..6a79d88f8c
--- /dev/null
+++ b/src/gui/opengl/platform/egl/qeglpbuffer.cpp
@@ -0,0 +1,63 @@
+// Copyright (C) 2020 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
+
+#include <QtGui/qoffscreensurface.h>
+#include "qeglpbuffer_p.h"
+#include "qeglconvenience_p.h"
+
+QT_BEGIN_NAMESPACE
+
+/*!
+ \class QEGLPbuffer
+ \brief A pbuffer-based implementation of QPlatformOffscreenSurface for EGL.
+ \since 5.2
+ \internal
+ \ingroup qpa
+
+ To use this implementation in the platform plugin simply
+ reimplement QPlatformIntegration::createPlatformOffscreenSurface()
+ and return a new instance of this class.
+*/
+
+QEGLPbuffer::QEGLPbuffer(EGLDisplay display, const QSurfaceFormat &format, QOffscreenSurface *offscreenSurface,
+ QEGLPlatformContext::Flags flags)
+ : QPlatformOffscreenSurface(offscreenSurface)
+ , m_format(format)
+ , m_display(display)
+ , m_pbuffer(EGL_NO_SURFACE)
+{
+ m_hasSurfaceless = !flags.testFlag(QEGLPlatformContext::NoSurfaceless)
+ && q_hasEglExtension(display, "EGL_KHR_surfaceless_context");
+
+ if (m_hasSurfaceless)
+ return;
+
+ EGLConfig config = q_configFromGLFormat(m_display, m_format, false, EGL_PBUFFER_BIT);
+
+ if (config) {
+ const EGLint attributes[] = {
+ EGL_WIDTH, offscreenSurface->size().width(),
+ EGL_HEIGHT, offscreenSurface->size().height(),
+ EGL_LARGEST_PBUFFER, EGL_FALSE,
+ EGL_NONE
+ };
+
+ m_pbuffer = eglCreatePbufferSurface(m_display, config, attributes);
+
+ if (m_pbuffer != EGL_NO_SURFACE)
+ m_format = q_glFormatFromConfig(m_display, config);
+ }
+}
+
+QEGLPbuffer::~QEGLPbuffer()
+{
+ if (m_pbuffer != EGL_NO_SURFACE)
+ eglDestroySurface(m_display, m_pbuffer);
+}
+
+bool QEGLPbuffer::isValid() const
+{
+ return m_pbuffer != EGL_NO_SURFACE || m_hasSurfaceless;
+}
+
+QT_END_NAMESPACE
diff --git a/src/gui/opengl/platform/egl/qeglpbuffer_p.h b/src/gui/opengl/platform/egl/qeglpbuffer_p.h
new file mode 100644
index 0000000000..e6b6db1f38
--- /dev/null
+++ b/src/gui/opengl/platform/egl/qeglpbuffer_p.h
@@ -0,0 +1,44 @@
+// Copyright (C) 2020 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
+
+#ifndef QEGLPBUFFER_H
+#define QEGLPBUFFER_H
+
+//
+// W A R N I N G
+// -------------
+//
+// This file is not part of the Qt API. It exists purely as an
+// implementation detail. This header file may change from version to
+// version without notice, or even be removed.
+//
+// We mean it.
+//
+
+#include <qpa/qplatformoffscreensurface.h>
+#include <QtGui/private/qeglplatformcontext_p.h>
+
+QT_BEGIN_NAMESPACE
+
+class Q_GUI_EXPORT QEGLPbuffer : public QPlatformOffscreenSurface
+{
+public:
+ QEGLPbuffer(EGLDisplay display, const QSurfaceFormat &format, QOffscreenSurface *offscreenSurface,
+ QEGLPlatformContext::Flags flags = { });
+ ~QEGLPbuffer();
+
+ QSurfaceFormat format() const override { return m_format; }
+ bool isValid() const override;
+
+ EGLSurface pbuffer() const { return m_pbuffer; }
+
+private:
+ QSurfaceFormat m_format;
+ EGLDisplay m_display;
+ EGLSurface m_pbuffer;
+ bool m_hasSurfaceless;
+};
+
+QT_END_NAMESPACE
+
+#endif // QEGLPBUFFER_H
diff --git a/src/gui/opengl/platform/egl/qeglplatformcontext.cpp b/src/gui/opengl/platform/egl/qeglplatformcontext.cpp
new file mode 100644
index 0000000000..0a6e83e875
--- /dev/null
+++ b/src/gui/opengl/platform/egl/qeglplatformcontext.cpp
@@ -0,0 +1,838 @@
+// Copyright (C) 2021 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
+
+#include "qeglplatformcontext_p.h"
+#include "qeglconvenience_p.h"
+#include "qeglpbuffer_p.h"
+#include <qpa/qplatformwindow.h>
+#include <QtGui/qopenglcontext.h>
+#include <QtCore/qdebug.h>
+
+#ifdef Q_OS_ANDROID
+#include <QtCore/private/qjnihelpers_p.h>
+#endif
+#ifndef Q_OS_WIN
+#include <dlfcn.h>
+#endif
+
+QT_BEGIN_NAMESPACE
+
+/*!
+ \class QEGLPlatformContext
+ \brief An EGL context implementation.
+ \since 5.2
+ \internal
+ \ingroup qpa
+
+ Implement QPlatformOpenGLContext using EGL. To use it in platform
+ plugins a subclass must be created since
+ eglSurfaceForPlatformSurface() has to be reimplemented. This
+ function is used for mapping platform surfaces (windows) to EGL
+ surfaces and is necessary since different platform plugins may
+ have different ways of handling native windows (for example, a
+ plugin may choose not to back every platform window by a real EGL
+ surface). Other than that, no further customization is necessary.
+ */
+
+// Constants from EGL_KHR_create_context
+#ifndef EGL_CONTEXT_MINOR_VERSION_KHR
+#define EGL_CONTEXT_MINOR_VERSION_KHR 0x30FB
+#endif
+#ifndef EGL_CONTEXT_FLAGS_KHR
+#define EGL_CONTEXT_FLAGS_KHR 0x30FC
+#endif
+#ifndef EGL_CONTEXT_OPENGL_PROFILE_MASK_KHR
+#define EGL_CONTEXT_OPENGL_PROFILE_MASK_KHR 0x30FD
+#endif
+#ifndef EGL_CONTEXT_OPENGL_DEBUG_BIT_KHR
+#define EGL_CONTEXT_OPENGL_DEBUG_BIT_KHR 0x00000001
+#endif
+#ifndef EGL_CONTEXT_OPENGL_FORWARD_COMPATIBLE_BIT_KHR
+#define EGL_CONTEXT_OPENGL_FORWARD_COMPATIBLE_BIT_KHR 0x00000002
+#endif
+#ifndef EGL_CONTEXT_OPENGL_CORE_PROFILE_BIT_KHR
+#define EGL_CONTEXT_OPENGL_CORE_PROFILE_BIT_KHR 0x00000001
+#endif
+#ifndef EGL_CONTEXT_OPENGL_COMPATIBILITY_PROFILE_BIT_KHR
+#define EGL_CONTEXT_OPENGL_COMPATIBILITY_PROFILE_BIT_KHR 0x00000002
+#endif
+
+// Constants for OpenGL which are not available in the ES headers.
+#ifndef GL_CONTEXT_FLAGS
+#define GL_CONTEXT_FLAGS 0x821E
+#endif
+#ifndef GL_CONTEXT_FLAG_FORWARD_COMPATIBLE_BIT
+#define GL_CONTEXT_FLAG_FORWARD_COMPATIBLE_BIT 0x0001
+#endif
+#ifndef GL_CONTEXT_FLAG_DEBUG_BIT
+#define GL_CONTEXT_FLAG_DEBUG_BIT 0x00000002
+#endif
+#ifndef GL_CONTEXT_PROFILE_MASK
+#define GL_CONTEXT_PROFILE_MASK 0x9126
+#endif
+#ifndef GL_CONTEXT_CORE_PROFILE_BIT
+#define GL_CONTEXT_CORE_PROFILE_BIT 0x00000001
+#endif
+#ifndef GL_CONTEXT_COMPATIBILITY_PROFILE_BIT
+#define GL_CONTEXT_COMPATIBILITY_PROFILE_BIT 0x00000002
+#endif
+
+QEGLPlatformContext::QEGLPlatformContext(const QSurfaceFormat &format, QPlatformOpenGLContext *share, EGLDisplay display,
+ EGLConfig *config, Flags flags)
+ : m_eglDisplay(display)
+ , m_flags(flags)
+ , m_ownsContext(true)
+{
+ m_eglConfig = config ? *config : q_configFromGLFormat(display, format);
+
+ m_format = q_glFormatFromConfig(m_eglDisplay, m_eglConfig, format);
+ // m_format now has the renderableType() resolved (it cannot be Default anymore)
+ // but does not yet contain version, profile, options.
+ m_shareContext = share ? static_cast<QEGLPlatformContext *>(share)->m_eglContext : nullptr;
+
+ QList<EGLint> contextAttrs;
+ contextAttrs.append(EGL_CONTEXT_CLIENT_VERSION);
+ contextAttrs.append(format.majorVersion());
+ const bool hasKHRCreateContext = q_hasEglExtension(m_eglDisplay, "EGL_KHR_create_context");
+ if (hasKHRCreateContext) {
+ contextAttrs.append(EGL_CONTEXT_MINOR_VERSION_KHR);
+ contextAttrs.append(format.minorVersion());
+ int flags = 0;
+ // The debug bit is supported both for OpenGL and OpenGL ES.
+ if (format.testOption(QSurfaceFormat::DebugContext))
+ flags |= EGL_CONTEXT_OPENGL_DEBUG_BIT_KHR;
+ // The fwdcompat bit is only for OpenGL 3.0+.
+ if (m_format.renderableType() == QSurfaceFormat::OpenGL
+ && format.majorVersion() >= 3
+ && !format.testOption(QSurfaceFormat::DeprecatedFunctions))
+ flags |= EGL_CONTEXT_OPENGL_FORWARD_COMPATIBLE_BIT_KHR;
+ if (flags) {
+ contextAttrs.append(EGL_CONTEXT_FLAGS_KHR);
+ contextAttrs.append(flags);
+ }
+ // Profiles are OpenGL only and mandatory in 3.2+. The value is silently ignored for < 3.2.
+ if (m_format.renderableType() == QSurfaceFormat::OpenGL) {
+ contextAttrs.append(EGL_CONTEXT_OPENGL_PROFILE_MASK_KHR);
+ contextAttrs.append(format.profile() == QSurfaceFormat::CoreProfile
+ ? EGL_CONTEXT_OPENGL_CORE_PROFILE_BIT_KHR
+ : EGL_CONTEXT_OPENGL_COMPATIBILITY_PROFILE_BIT_KHR);
+ }
+ }
+
+#ifdef EGL_EXT_protected_content
+ if (format.testOption(QSurfaceFormat::ProtectedContent)) {
+ if (q_hasEglExtension(m_eglDisplay, "EGL_EXT_protected_content")) {
+ contextAttrs.append(EGL_PROTECTED_CONTENT_EXT);
+ contextAttrs.append(EGL_TRUE);
+ } else {
+ m_format.setOption(QSurfaceFormat::ProtectedContent, false);
+ }
+ }
+#endif
+
+ // Special Options for OpenVG surfaces
+ if (m_format.renderableType() == QSurfaceFormat::OpenVG) {
+ contextAttrs.append(EGL_ALPHA_MASK_SIZE);
+ contextAttrs.append(8);
+ }
+
+ contextAttrs.append(EGL_NONE);
+ m_contextAttrs = contextAttrs;
+
+ switch (m_format.renderableType()) {
+ case QSurfaceFormat::OpenVG:
+ m_api = EGL_OPENVG_API;
+ break;
+#ifdef EGL_VERSION_1_4
+ case QSurfaceFormat::OpenGL:
+ m_api = EGL_OPENGL_API;
+ break;
+#endif // EGL_VERSION_1_4
+ default:
+ m_api = EGL_OPENGL_ES_API;
+ break;
+ }
+
+ eglBindAPI(m_api);
+ m_eglContext = eglCreateContext(m_eglDisplay, m_eglConfig, m_shareContext, contextAttrs.constData());
+ if (m_eglContext == EGL_NO_CONTEXT && m_shareContext != EGL_NO_CONTEXT) {
+ m_shareContext = nullptr;
+ m_eglContext = eglCreateContext(m_eglDisplay, m_eglConfig, nullptr, contextAttrs.constData());
+ }
+
+ if (m_eglContext == EGL_NO_CONTEXT) {
+ qWarning("QEGLPlatformContext: Failed to create context: %x", eglGetError());
+ return;
+ }
+
+ static const bool printConfig = qEnvironmentVariableIntValue("QT_QPA_EGLFS_DEBUG");
+ if (printConfig) {
+ qDebug() << "Created context for format" << format << "with config:";
+ q_printEglConfig(m_eglDisplay, m_eglConfig);
+
+ static const bool printAllConfigs = qEnvironmentVariableIntValue("QT_QPA_EGLFS_DEBUG") > 1;
+ if (printAllConfigs) {
+ EGLint numConfigs = 0;
+ eglGetConfigs(m_eglDisplay, nullptr, 0, &numConfigs);
+ QVector<EGLConfig> configs;
+ configs.resize(numConfigs);
+ eglGetConfigs(m_eglDisplay, configs.data(), numConfigs, &numConfigs);
+ qDebug("\nAll EGLConfigs: count=%d", numConfigs);
+ for (EGLint i = 0; i < numConfigs; ++i) {
+ qDebug("EGLConfig #%d", i);
+ q_printEglConfig(m_eglDisplay, configs[i]);
+ }
+ qDebug("\n");
+ }
+ }
+
+ // Cannot just call updateFormatFromGL() since it relies on virtuals. Defer it to initialize().
+}
+
+void QEGLPlatformContext::adopt(EGLContext context, EGLDisplay display, QPlatformOpenGLContext *share)
+{
+ Q_ASSERT(!m_ownsContext);
+
+ m_eglDisplay = display;
+
+ // Figure out the EGLConfig.
+ EGLint value = 0;
+ eglQueryContext(m_eglDisplay, context, EGL_CONFIG_ID, &value);
+ EGLint n = 0;
+ EGLConfig cfg;
+ const EGLint attribs[] = { EGL_CONFIG_ID, value, EGL_NONE };
+ if (eglChooseConfig(m_eglDisplay, attribs, &cfg, 1, &n) && n == 1) {
+ m_eglConfig = cfg;
+ m_format = q_glFormatFromConfig(m_eglDisplay, m_eglConfig);
+ } else {
+ qWarning("QEGLPlatformContext: Failed to get framebuffer configuration for context");
+ }
+
+ // Fetch client API type.
+ value = 0;
+ eglQueryContext(m_eglDisplay, context, EGL_CONTEXT_CLIENT_TYPE, &value);
+ if (value == EGL_OPENGL_API || value == EGL_OPENGL_ES_API) {
+ // if EGL config supports both OpenGL and OpenGL ES render type,
+ // q_glFormatFromConfig() with the default "referenceFormat" parameter
+ // will always figure it out as OpenGL render type.
+ // We can override it to match user's real render type.
+ if (value == EGL_OPENGL_ES_API)
+ m_format.setRenderableType(QSurfaceFormat::OpenGLES);
+ m_api = value;
+ eglBindAPI(m_api);
+ } else {
+ qWarning("QEGLPlatformContext: Failed to get client API type");
+ m_api = EGL_OPENGL_ES_API;
+ }
+
+ m_eglContext = context;
+ m_shareContext = share ? static_cast<QEGLPlatformContext *>(share)->m_eglContext : nullptr;
+ updateFormatFromGL();
+}
+
+void QEGLPlatformContext::initialize()
+{
+ if (m_eglContext != EGL_NO_CONTEXT)
+ updateFormatFromGL();
+}
+
+// Base implementation for pbuffers. Subclasses will handle the specialized cases for
+// platforms without pbuffers.
+EGLSurface QEGLPlatformContext::createTemporaryOffscreenSurface()
+{
+ // Make the context current to ensure the GL version query works. This needs a surface too.
+ const EGLint pbufferAttributes[] = {
+ EGL_WIDTH, 1,
+ EGL_HEIGHT, 1,
+ EGL_LARGEST_PBUFFER, EGL_FALSE,
+ EGL_NONE
+ };
+
+ // Cannot just pass m_eglConfig because it may not be suitable for pbuffers. Instead,
+ // do what QEGLPbuffer would do: request a config with the same attributes but with
+ // PBUFFER_BIT set.
+ EGLConfig config = q_configFromGLFormat(m_eglDisplay, m_format, false, EGL_PBUFFER_BIT);
+
+ return eglCreatePbufferSurface(m_eglDisplay, config, pbufferAttributes);
+}
+
+void QEGLPlatformContext::destroyTemporaryOffscreenSurface(EGLSurface surface)
+{
+ eglDestroySurface(m_eglDisplay, surface);
+}
+
+void QEGLPlatformContext::runGLChecks()
+{
+ // Nothing to do here, subclasses may override in order to perform OpenGL
+ // queries needing a context.
+}
+
+void QEGLPlatformContext::updateFormatFromGL()
+{
+#ifndef QT_NO_OPENGL
+ // Have to save & restore to prevent QOpenGLContext::currentContext() from becoming
+ // inconsistent after QOpenGLContext::create().
+ EGLDisplay prevDisplay = eglGetCurrentDisplay();
+ if (prevDisplay == EGL_NO_DISPLAY) // when no context is current
+ prevDisplay = m_eglDisplay;
+ EGLContext prevContext = eglGetCurrentContext();
+ EGLSurface prevSurfaceDraw = eglGetCurrentSurface(EGL_DRAW);
+ EGLSurface prevSurfaceRead = eglGetCurrentSurface(EGL_READ);
+
+ // Rely on the surfaceless extension, if available. This is beneficial since we can
+ // avoid creating an extra pbuffer surface which is apparently troublesome with some
+ // drivers (Mesa) when certain attributes are present (multisampling).
+ EGLSurface tempSurface = EGL_NO_SURFACE;
+ EGLContext tempContext = EGL_NO_CONTEXT;
+ if (m_flags.testFlag(NoSurfaceless) || !q_hasEglExtension(m_eglDisplay, "EGL_KHR_surfaceless_context"))
+ tempSurface = createTemporaryOffscreenSurface();
+
+ EGLBoolean ok = eglMakeCurrent(m_eglDisplay, tempSurface, tempSurface, m_eglContext);
+ if (!ok) {
+ EGLConfig config = q_configFromGLFormat(m_eglDisplay, m_format, false, EGL_PBUFFER_BIT);
+ tempContext = eglCreateContext(m_eglDisplay, config, nullptr, m_contextAttrs.constData());
+ if (tempContext != EGL_NO_CONTEXT)
+ ok = eglMakeCurrent(m_eglDisplay, tempSurface, tempSurface, tempContext);
+ }
+ if (ok) {
+ if (m_format.renderableType() == QSurfaceFormat::OpenGL
+ || m_format.renderableType() == QSurfaceFormat::OpenGLES) {
+ const GLubyte *s = glGetString(GL_VERSION);
+ if (s) {
+ QByteArray version = QByteArray(reinterpret_cast<const char *>(s));
+ int major, minor;
+ if (QPlatformOpenGLContext::parseOpenGLVersion(version, major, minor)) {
+ m_format.setMajorVersion(major);
+ m_format.setMinorVersion(minor);
+ }
+ }
+ m_format.setProfile(QSurfaceFormat::NoProfile);
+ m_format.setOptions(QSurfaceFormat::FormatOptions());
+ if (m_format.renderableType() == QSurfaceFormat::OpenGL) {
+ // Check profile and options.
+ if (m_format.majorVersion() < 3) {
+ m_format.setOption(QSurfaceFormat::DeprecatedFunctions);
+ } else {
+ GLint value = 0;
+ glGetIntegerv(GL_CONTEXT_FLAGS, &value);
+ if (!(value & GL_CONTEXT_FLAG_FORWARD_COMPATIBLE_BIT))
+ m_format.setOption(QSurfaceFormat::DeprecatedFunctions);
+ if (value & GL_CONTEXT_FLAG_DEBUG_BIT)
+ m_format.setOption(QSurfaceFormat::DebugContext);
+ if (m_format.version() >= qMakePair(3, 2)) {
+ value = 0;
+ glGetIntegerv(GL_CONTEXT_PROFILE_MASK, &value);
+ if (value & GL_CONTEXT_CORE_PROFILE_BIT)
+ m_format.setProfile(QSurfaceFormat::CoreProfile);
+ else if (value & GL_CONTEXT_COMPATIBILITY_PROFILE_BIT)
+ m_format.setProfile(QSurfaceFormat::CompatibilityProfile);
+ }
+ }
+ }
+ }
+ runGLChecks();
+ eglMakeCurrent(prevDisplay, prevSurfaceDraw, prevSurfaceRead, prevContext);
+ } else {
+ qWarning("QEGLPlatformContext: Failed to make temporary surface current, format not updated (%x)", eglGetError());
+ }
+ if (tempSurface != EGL_NO_SURFACE)
+ destroyTemporaryOffscreenSurface(tempSurface);
+ if (tempContext != EGL_NO_CONTEXT)
+ eglDestroyContext(m_eglDisplay, tempContext);
+#endif // QT_NO_OPENGL
+}
+
+bool QEGLPlatformContext::makeCurrent(QPlatformSurface *surface)
+{
+ Q_ASSERT(surface->surface()->supportsOpenGL());
+
+ eglBindAPI(m_api);
+
+ EGLSurface eglSurface = eglSurfaceForPlatformSurface(surface);
+
+ // shortcut: on some GPUs, eglMakeCurrent is not a cheap operation
+ if (eglGetCurrentContext() == m_eglContext &&
+ eglGetCurrentDisplay() == m_eglDisplay &&
+ eglGetCurrentSurface(EGL_READ) == eglSurface &&
+ eglGetCurrentSurface(EGL_DRAW) == eglSurface) {
+ return true;
+ }
+
+ const bool ok = eglMakeCurrent(m_eglDisplay, eglSurface, eglSurface, m_eglContext);
+ if (ok) {
+ if (!m_swapIntervalEnvChecked) {
+ m_swapIntervalEnvChecked = true;
+ if (qEnvironmentVariableIsSet("QT_QPA_EGLFS_SWAPINTERVAL")) {
+ QByteArray swapIntervalString = qgetenv("QT_QPA_EGLFS_SWAPINTERVAL");
+ bool intervalOk;
+ const int swapInterval = swapIntervalString.toInt(&intervalOk);
+ if (intervalOk)
+ m_swapIntervalFromEnv = swapInterval;
+ }
+ }
+ const int requestedSwapInterval = m_swapIntervalFromEnv >= 0
+ ? m_swapIntervalFromEnv
+ : surface->format().swapInterval();
+ if (requestedSwapInterval >= 0 && m_swapInterval != requestedSwapInterval) {
+ m_swapInterval = requestedSwapInterval;
+ if (eglSurface != EGL_NO_SURFACE) // skip if using surfaceless context
+ eglSwapInterval(eglDisplay(), m_swapInterval);
+ }
+ } else {
+ qWarning("QEGLPlatformContext: eglMakeCurrent failed: %x", eglGetError());
+ }
+
+ return ok;
+}
+
+QEGLPlatformContext::~QEGLPlatformContext()
+{
+ if (m_ownsContext && m_eglContext != EGL_NO_CONTEXT)
+ eglDestroyContext(m_eglDisplay, m_eglContext);
+
+ m_eglContext = EGL_NO_CONTEXT;
+}
+
+void QEGLPlatformContext::doneCurrent()
+{
+ eglBindAPI(m_api);
+ bool ok = eglMakeCurrent(m_eglDisplay, EGL_NO_SURFACE, EGL_NO_SURFACE, EGL_NO_CONTEXT);
+ if (!ok)
+ qWarning("QEGLPlatformContext: eglMakeCurrent failed: %x", eglGetError());
+}
+
+void QEGLPlatformContext::swapBuffers(QPlatformSurface *surface)
+{
+ eglBindAPI(m_api);
+ EGLSurface eglSurface = eglSurfaceForPlatformSurface(surface);
+ if (eglSurface != EGL_NO_SURFACE) { // skip if using surfaceless context
+ bool ok = eglSwapBuffers(m_eglDisplay, eglSurface);
+ if (!ok)
+ qWarning("QEGLPlatformContext: eglSwapBuffers failed: %x", eglGetError());
+ }
+}
+
+QFunctionPointer QEGLPlatformContext::getProcAddress(const char *procName)
+{
+ eglBindAPI(m_api);
+ QFunctionPointer proc = (QFunctionPointer) eglGetProcAddress(procName);
+#if !defined(Q_OS_WIN) && !defined(Q_OS_INTEGRITY)
+ if (!proc)
+ proc = (QFunctionPointer) dlsym(RTLD_DEFAULT, procName);
+#elif !defined(QT_OPENGL_DYNAMIC)
+ // On systems without KHR_get_all_proc_addresses and without
+ // dynamic linking there still has to be a way to access the
+ // standard GLES functions. QOpenGL(Extra)Functions never makes
+ // direct GL API calls since Qt 5.7, so all such workarounds are
+ // expected to be handled in the platform plugin.
+ if (!proc) {
+ static struct StdFunc {
+ const char *name;
+ QFunctionPointer func;
+ } standardFuncs[] = {
+#if QT_CONFIG(opengles2)
+ { "glBindTexture", (QFunctionPointer) ::glBindTexture },
+ { "glBlendFunc", (QFunctionPointer) ::glBlendFunc },
+ { "glClear", (QFunctionPointer) ::glClear },
+ { "glClearColor", (QFunctionPointer) ::glClearColor },
+ { "glClearStencil", (QFunctionPointer) ::glClearStencil },
+ { "glColorMask", (QFunctionPointer) ::glColorMask },
+ { "glCopyTexImage2D", (QFunctionPointer) ::glCopyTexImage2D },
+ { "glCopyTexSubImage2D", (QFunctionPointer) ::glCopyTexSubImage2D },
+ { "glCullFace", (QFunctionPointer) ::glCullFace },
+ { "glDeleteTextures", (QFunctionPointer) ::glDeleteTextures },
+ { "glDepthFunc", (QFunctionPointer) ::glDepthFunc },
+ { "glDepthMask", (QFunctionPointer) ::glDepthMask },
+ { "glDisable", (QFunctionPointer) ::glDisable },
+ { "glDrawArrays", (QFunctionPointer) ::glDrawArrays },
+ { "glDrawElements", (QFunctionPointer) ::glDrawElements },
+ { "glEnable", (QFunctionPointer) ::glEnable },
+ { "glFinish", (QFunctionPointer) ::glFinish },
+ { "glFlush", (QFunctionPointer) ::glFlush },
+ { "glFrontFace", (QFunctionPointer) ::glFrontFace },
+ { "glGenTextures", (QFunctionPointer) ::glGenTextures },
+ { "glGetBooleanv", (QFunctionPointer) ::glGetBooleanv },
+ { "glGetError", (QFunctionPointer) ::glGetError },
+ { "glGetFloatv", (QFunctionPointer) ::glGetFloatv },
+ { "glGetIntegerv", (QFunctionPointer) ::glGetIntegerv },
+ { "glGetString", (QFunctionPointer) ::glGetString },
+ { "glGetTexParameterfv", (QFunctionPointer) ::glGetTexParameterfv },
+ { "glGetTexParameteriv", (QFunctionPointer) ::glGetTexParameteriv },
+ { "glHint", (QFunctionPointer) ::glHint },
+ { "glIsEnabled", (QFunctionPointer) ::glIsEnabled },
+ { "glIsTexture", (QFunctionPointer) ::glIsTexture },
+ { "glLineWidth", (QFunctionPointer) ::glLineWidth },
+ { "glPixelStorei", (QFunctionPointer) ::glPixelStorei },
+ { "glPolygonOffset", (QFunctionPointer) ::glPolygonOffset },
+ { "glReadPixels", (QFunctionPointer) ::glReadPixels },
+ { "glScissor", (QFunctionPointer) ::glScissor },
+ { "glStencilFunc", (QFunctionPointer) ::glStencilFunc },
+ { "glStencilMask", (QFunctionPointer) ::glStencilMask },
+ { "glStencilOp", (QFunctionPointer) ::glStencilOp },
+ { "glTexImage2D", (QFunctionPointer) ::glTexImage2D },
+ { "glTexParameterf", (QFunctionPointer) ::glTexParameterf },
+ { "glTexParameterfv", (QFunctionPointer) ::glTexParameterfv },
+ { "glTexParameteri", (QFunctionPointer) ::glTexParameteri },
+ { "glTexParameteriv", (QFunctionPointer) ::glTexParameteriv },
+ { "glTexSubImage2D", (QFunctionPointer) ::glTexSubImage2D },
+ { "glViewport", (QFunctionPointer) ::glViewport },
+
+ { "glActiveTexture", (QFunctionPointer) ::glActiveTexture },
+ { "glAttachShader", (QFunctionPointer) ::glAttachShader },
+ { "glBindAttribLocation", (QFunctionPointer) ::glBindAttribLocation },
+ { "glBindBuffer", (QFunctionPointer) ::glBindBuffer },
+ { "glBindFramebuffer", (QFunctionPointer) ::glBindFramebuffer },
+ { "glBindRenderbuffer", (QFunctionPointer) ::glBindRenderbuffer },
+ { "glBlendColor", (QFunctionPointer) ::glBlendColor },
+ { "glBlendEquation", (QFunctionPointer) ::glBlendEquation },
+ { "glBlendEquationSeparate", (QFunctionPointer) ::glBlendEquationSeparate },
+ { "glBlendFuncSeparate", (QFunctionPointer) ::glBlendFuncSeparate },
+ { "glBufferData", (QFunctionPointer) ::glBufferData },
+ { "glBufferSubData", (QFunctionPointer) ::glBufferSubData },
+ { "glCheckFramebufferStatus", (QFunctionPointer) ::glCheckFramebufferStatus },
+ { "glCompileShader", (QFunctionPointer) ::glCompileShader },
+ { "glCompressedTexImage2D", (QFunctionPointer) ::glCompressedTexImage2D },
+ { "glCompressedTexSubImage2D", (QFunctionPointer) ::glCompressedTexSubImage2D },
+ { "glCreateProgram", (QFunctionPointer) ::glCreateProgram },
+ { "glCreateShader", (QFunctionPointer) ::glCreateShader },
+ { "glDeleteBuffers", (QFunctionPointer) ::glDeleteBuffers },
+ { "glDeleteFramebuffers", (QFunctionPointer) ::glDeleteFramebuffers },
+ { "glDeleteProgram", (QFunctionPointer) ::glDeleteProgram },
+ { "glDeleteRenderbuffers", (QFunctionPointer) ::glDeleteRenderbuffers },
+ { "glDeleteShader", (QFunctionPointer) ::glDeleteShader },
+ { "glDetachShader", (QFunctionPointer) ::glDetachShader },
+ { "glDisableVertexAttribArray", (QFunctionPointer) ::glDisableVertexAttribArray },
+ { "glEnableVertexAttribArray", (QFunctionPointer) ::glEnableVertexAttribArray },
+ { "glFramebufferRenderbuffer", (QFunctionPointer) ::glFramebufferRenderbuffer },
+ { "glFramebufferTexture2D", (QFunctionPointer) ::glFramebufferTexture2D },
+ { "glGenBuffers", (QFunctionPointer) ::glGenBuffers },
+ { "glGenerateMipmap", (QFunctionPointer) ::glGenerateMipmap },
+ { "glGenFramebuffers", (QFunctionPointer) ::glGenFramebuffers },
+ { "glGenRenderbuffers", (QFunctionPointer) ::glGenRenderbuffers },
+ { "glGetActiveAttrib", (QFunctionPointer) ::glGetActiveAttrib },
+ { "glGetActiveUniform", (QFunctionPointer) ::glGetActiveUniform },
+ { "glGetAttachedShaders", (QFunctionPointer) ::glGetAttachedShaders },
+ { "glGetAttribLocation", (QFunctionPointer) ::glGetAttribLocation },
+ { "glGetBufferParameteriv", (QFunctionPointer) ::glGetBufferParameteriv },
+ { "glGetFramebufferAttachmentParameteriv", (QFunctionPointer) ::glGetFramebufferAttachmentParameteriv },
+ { "glGetProgramiv", (QFunctionPointer) ::glGetProgramiv },
+ { "glGetProgramInfoLog", (QFunctionPointer) ::glGetProgramInfoLog },
+ { "glGetRenderbufferParameteriv", (QFunctionPointer) ::glGetRenderbufferParameteriv },
+ { "glGetShaderiv", (QFunctionPointer) ::glGetShaderiv },
+ { "glGetShaderInfoLog", (QFunctionPointer) ::glGetShaderInfoLog },
+ { "glGetShaderPrecisionFormat", (QFunctionPointer) ::glGetShaderPrecisionFormat },
+ { "glGetShaderSource", (QFunctionPointer) ::glGetShaderSource },
+ { "glGetUniformfv", (QFunctionPointer) ::glGetUniformfv },
+ { "glGetUniformiv", (QFunctionPointer) ::glGetUniformiv },
+ { "glGetUniformLocation", (QFunctionPointer) ::glGetUniformLocation },
+ { "glGetVertexAttribfv", (QFunctionPointer) ::glGetVertexAttribfv },
+ { "glGetVertexAttribiv", (QFunctionPointer) ::glGetVertexAttribiv },
+ { "glGetVertexAttribPointerv", (QFunctionPointer) ::glGetVertexAttribPointerv },
+ { "glIsBuffer", (QFunctionPointer) ::glIsBuffer },
+ { "glIsFramebuffer", (QFunctionPointer) ::glIsFramebuffer },
+ { "glIsProgram", (QFunctionPointer) ::glIsProgram },
+ { "glIsRenderbuffer", (QFunctionPointer) ::glIsRenderbuffer },
+ { "glIsShader", (QFunctionPointer) ::glIsShader },
+ { "glLinkProgram", (QFunctionPointer) ::glLinkProgram },
+ { "glReleaseShaderCompiler", (QFunctionPointer) ::glReleaseShaderCompiler },
+ { "glRenderbufferStorage", (QFunctionPointer) ::glRenderbufferStorage },
+ { "glSampleCoverage", (QFunctionPointer) ::glSampleCoverage },
+ { "glShaderBinary", (QFunctionPointer) ::glShaderBinary },
+ { "glShaderSource", (QFunctionPointer) ::glShaderSource },
+ { "glStencilFuncSeparate", (QFunctionPointer) ::glStencilFuncSeparate },
+ { "glStencilMaskSeparate", (QFunctionPointer) ::glStencilMaskSeparate },
+ { "glStencilOpSeparate", (QFunctionPointer) ::glStencilOpSeparate },
+ { "glUniform1f", (QFunctionPointer) ::glUniform1f },
+ { "glUniform1fv", (QFunctionPointer) ::glUniform1fv },
+ { "glUniform1i", (QFunctionPointer) ::glUniform1i },
+ { "glUniform1iv", (QFunctionPointer) ::glUniform1iv },
+ { "glUniform2f", (QFunctionPointer) ::glUniform2f },
+ { "glUniform2fv", (QFunctionPointer) ::glUniform2fv },
+ { "glUniform2i", (QFunctionPointer) ::glUniform2i },
+ { "glUniform2iv", (QFunctionPointer) ::glUniform2iv },
+ { "glUniform3f", (QFunctionPointer) ::glUniform3f },
+ { "glUniform3fv", (QFunctionPointer) ::glUniform3fv },
+ { "glUniform3i", (QFunctionPointer) ::glUniform3i },
+ { "glUniform3iv", (QFunctionPointer) ::glUniform3iv },
+ { "glUniform4f", (QFunctionPointer) ::glUniform4f },
+ { "glUniform4fv", (QFunctionPointer) ::glUniform4fv },
+ { "glUniform4i", (QFunctionPointer) ::glUniform4i },
+ { "glUniform4iv", (QFunctionPointer) ::glUniform4iv },
+ { "glUniformMatrix2fv", (QFunctionPointer) ::glUniformMatrix2fv },
+ { "glUniformMatrix3fv", (QFunctionPointer) ::glUniformMatrix3fv },
+ { "glUniformMatrix4fv", (QFunctionPointer) ::glUniformMatrix4fv },
+ { "glUseProgram", (QFunctionPointer) ::glUseProgram },
+ { "glValidateProgram", (QFunctionPointer) ::glValidateProgram },
+ { "glVertexAttrib1f", (QFunctionPointer) ::glVertexAttrib1f },
+ { "glVertexAttrib1fv", (QFunctionPointer) ::glVertexAttrib1fv },
+ { "glVertexAttrib2f", (QFunctionPointer) ::glVertexAttrib2f },
+ { "glVertexAttrib2fv", (QFunctionPointer) ::glVertexAttrib2fv },
+ { "glVertexAttrib3f", (QFunctionPointer) ::glVertexAttrib3f },
+ { "glVertexAttrib3fv", (QFunctionPointer) ::glVertexAttrib3fv },
+ { "glVertexAttrib4f", (QFunctionPointer) ::glVertexAttrib4f },
+ { "glVertexAttrib4fv", (QFunctionPointer) ::glVertexAttrib4fv },
+ { "glVertexAttribPointer", (QFunctionPointer) ::glVertexAttribPointer },
+
+ { "glClearDepthf", (QFunctionPointer) ::glClearDepthf },
+ { "glDepthRangef", (QFunctionPointer) ::glDepthRangef },
+#endif // QT_CONFIG(opengles2)
+
+#if QT_CONFIG(opengles3)
+ { "glBeginQuery", (QFunctionPointer) ::glBeginQuery },
+ { "glBeginTransformFeedback", (QFunctionPointer) ::glBeginTransformFeedback },
+ { "glBindBufferBase", (QFunctionPointer) ::glBindBufferBase },
+ { "glBindBufferRange", (QFunctionPointer) ::glBindBufferRange },
+ { "glBindSampler", (QFunctionPointer) ::glBindSampler },
+ { "glBindTransformFeedback", (QFunctionPointer) ::glBindTransformFeedback },
+ { "glBindVertexArray", (QFunctionPointer) ::glBindVertexArray },
+ { "glBlitFramebuffer", (QFunctionPointer) ::glBlitFramebuffer },
+ { "glClearBufferfi", (QFunctionPointer) ::glClearBufferfi },
+ { "glClearBufferfv", (QFunctionPointer) ::glClearBufferfv },
+ { "glClearBufferiv", (QFunctionPointer) ::glClearBufferiv },
+ { "glClearBufferuiv", (QFunctionPointer) ::glClearBufferuiv },
+ { "glClientWaitSync", (QFunctionPointer) ::glClientWaitSync },
+ { "glCompressedTexImage3D", (QFunctionPointer) ::glCompressedTexImage3D },
+ { "glCompressedTexSubImage3D", (QFunctionPointer) ::glCompressedTexSubImage3D },
+ { "glCopyBufferSubData", (QFunctionPointer) ::glCopyBufferSubData },
+ { "glCopyTexSubImage3D", (QFunctionPointer) ::glCopyTexSubImage3D },
+ { "glDeleteQueries", (QFunctionPointer) ::glDeleteQueries },
+ { "glDeleteSamplers", (QFunctionPointer) ::glDeleteSamplers },
+ { "glDeleteSync", (QFunctionPointer) ::glDeleteSync },
+ { "glDeleteTransformFeedbacks", (QFunctionPointer) ::glDeleteTransformFeedbacks },
+ { "glDeleteVertexArrays", (QFunctionPointer) ::glDeleteVertexArrays },
+ { "glDrawArraysInstanced", (QFunctionPointer) ::glDrawArraysInstanced },
+ { "glDrawBuffers", (QFunctionPointer) ::glDrawBuffers },
+ { "glDrawElementsInstanced", (QFunctionPointer) ::glDrawElementsInstanced },
+ { "glDrawRangeElements", (QFunctionPointer) ::glDrawRangeElements },
+ { "glEndQuery", (QFunctionPointer) ::glEndQuery },
+ { "glEndTransformFeedback", (QFunctionPointer) ::glEndTransformFeedback },
+ { "glFenceSync", (QFunctionPointer) ::glFenceSync },
+ { "glFlushMappedBufferRange", (QFunctionPointer) ::glFlushMappedBufferRange },
+ { "glFramebufferTextureLayer", (QFunctionPointer) ::glFramebufferTextureLayer },
+ { "glGenQueries", (QFunctionPointer) ::glGenQueries },
+ { "glGenSamplers", (QFunctionPointer) ::glGenSamplers },
+ { "glGenTransformFeedbacks", (QFunctionPointer) ::glGenTransformFeedbacks },
+ { "glGenVertexArrays", (QFunctionPointer) ::glGenVertexArrays },
+ { "glGetActiveUniformBlockName", (QFunctionPointer) ::glGetActiveUniformBlockName },
+ { "glGetActiveUniformBlockiv", (QFunctionPointer) ::glGetActiveUniformBlockiv },
+ { "glGetActiveUniformsiv", (QFunctionPointer) ::glGetActiveUniformsiv },
+ { "glGetBufferParameteri64v", (QFunctionPointer) ::glGetBufferParameteri64v },
+ { "glGetBufferPointerv", (QFunctionPointer) ::glGetBufferPointerv },
+ { "glGetFragDataLocation", (QFunctionPointer) ::glGetFragDataLocation },
+ { "glGetInteger64i_v", (QFunctionPointer) ::glGetInteger64i_v },
+ { "glGetInteger64v", (QFunctionPointer) ::glGetInteger64v },
+ { "glGetIntegeri_v", (QFunctionPointer) ::glGetIntegeri_v },
+ { "glGetInternalformativ", (QFunctionPointer) ::glGetInternalformativ },
+ { "glGetProgramBinary", (QFunctionPointer) ::glGetProgramBinary },
+ { "glGetQueryObjectuiv", (QFunctionPointer) ::glGetQueryObjectuiv },
+ { "glGetQueryiv", (QFunctionPointer) ::glGetQueryiv },
+ { "glGetSamplerParameterfv", (QFunctionPointer) ::glGetSamplerParameterfv },
+ { "glGetSamplerParameteriv", (QFunctionPointer) ::glGetSamplerParameteriv },
+ { "glGetStringi", (QFunctionPointer) ::glGetStringi },
+ { "glGetSynciv", (QFunctionPointer) ::glGetSynciv },
+ { "glGetTransformFeedbackVarying", (QFunctionPointer) ::glGetTransformFeedbackVarying },
+ { "glGetUniformBlockIndex", (QFunctionPointer) ::glGetUniformBlockIndex },
+ { "glGetUniformIndices", (QFunctionPointer) ::glGetUniformIndices },
+ { "glGetUniformuiv", (QFunctionPointer) ::glGetUniformuiv },
+ { "glGetVertexAttribIiv", (QFunctionPointer) ::glGetVertexAttribIiv },
+ { "glGetVertexAttribIuiv", (QFunctionPointer) ::glGetVertexAttribIuiv },
+ { "glInvalidateFramebuffer", (QFunctionPointer) ::glInvalidateFramebuffer },
+ { "glInvalidateSubFramebuffer", (QFunctionPointer) ::glInvalidateSubFramebuffer },
+ { "glIsQuery", (QFunctionPointer) ::glIsQuery },
+ { "glIsSampler", (QFunctionPointer) ::glIsSampler },
+ { "glIsSync", (QFunctionPointer) ::glIsSync },
+ { "glIsTransformFeedback", (QFunctionPointer) ::glIsTransformFeedback },
+ { "glIsVertexArray", (QFunctionPointer) ::glIsVertexArray },
+ { "glMapBufferRange", (QFunctionPointer) ::glMapBufferRange },
+ { "glPauseTransformFeedback", (QFunctionPointer) ::glPauseTransformFeedback },
+ { "glProgramBinary", (QFunctionPointer) ::glProgramBinary },
+ { "glProgramParameteri", (QFunctionPointer) ::glProgramParameteri },
+ { "glReadBuffer", (QFunctionPointer) ::glReadBuffer },
+ { "glRenderbufferStorageMultisample", (QFunctionPointer) ::glRenderbufferStorageMultisample },
+ { "glResumeTransformFeedback", (QFunctionPointer) ::glResumeTransformFeedback },
+ { "glSamplerParameterf", (QFunctionPointer) ::glSamplerParameterf },
+ { "glSamplerParameterfv", (QFunctionPointer) ::glSamplerParameterfv },
+ { "glSamplerParameteri", (QFunctionPointer) ::glSamplerParameteri },
+ { "glSamplerParameteriv", (QFunctionPointer) ::glSamplerParameteriv },
+ { "glTexImage3D", (QFunctionPointer) ::glTexImage3D },
+ { "glTexStorage2D", (QFunctionPointer) ::glTexStorage2D },
+ { "glTexStorage3D", (QFunctionPointer) ::glTexStorage3D },
+ { "glTexSubImage3D", (QFunctionPointer) ::glTexSubImage3D },
+ { "glTransformFeedbackVaryings", (QFunctionPointer) ::glTransformFeedbackVaryings },
+ { "glUniform1ui", (QFunctionPointer) ::glUniform1ui },
+ { "glUniform1uiv", (QFunctionPointer) ::glUniform1uiv },
+ { "glUniform2ui", (QFunctionPointer) ::glUniform2ui },
+ { "glUniform2uiv", (QFunctionPointer) ::glUniform2uiv },
+ { "glUniform3ui", (QFunctionPointer) ::glUniform3ui },
+ { "glUniform3uiv", (QFunctionPointer) ::glUniform3uiv },
+ { "glUniform4ui", (QFunctionPointer) ::glUniform4ui },
+ { "glUniform4uiv", (QFunctionPointer) ::glUniform4uiv },
+ { "glUniformBlockBinding", (QFunctionPointer) ::glUniformBlockBinding },
+ { "glUniformMatrix2x3fv", (QFunctionPointer) ::glUniformMatrix2x3fv },
+ { "glUniformMatrix2x4fv", (QFunctionPointer) ::glUniformMatrix2x4fv },
+ { "glUniformMatrix3x2fv", (QFunctionPointer) ::glUniformMatrix3x2fv },
+ { "glUniformMatrix3x4fv", (QFunctionPointer) ::glUniformMatrix3x4fv },
+ { "glUniformMatrix4x2fv", (QFunctionPointer) ::glUniformMatrix4x2fv },
+ { "glUniformMatrix4x3fv", (QFunctionPointer) ::glUniformMatrix4x3fv },
+ { "glUnmapBuffer", (QFunctionPointer) ::glUnmapBuffer },
+ { "glVertexAttribDivisor", (QFunctionPointer) ::glVertexAttribDivisor },
+ { "glVertexAttribI4i", (QFunctionPointer) ::glVertexAttribI4i },
+ { "glVertexAttribI4iv", (QFunctionPointer) ::glVertexAttribI4iv },
+ { "glVertexAttribI4ui", (QFunctionPointer) ::glVertexAttribI4ui },
+ { "glVertexAttribI4uiv", (QFunctionPointer) ::glVertexAttribI4uiv },
+ { "glVertexAttribIPointer", (QFunctionPointer) ::glVertexAttribIPointer },
+ { "glWaitSync", (QFunctionPointer) ::glWaitSync },
+#endif // QT_CONFIG(opengles3)
+
+#if QT_CONFIG(opengles31)
+ { "glActiveShaderProgram", (QFunctionPointer) ::glActiveShaderProgram },
+ { "glBindImageTexture", (QFunctionPointer) ::glBindImageTexture },
+ { "glBindProgramPipeline", (QFunctionPointer) ::glBindProgramPipeline },
+ { "glBindVertexBuffer", (QFunctionPointer) ::glBindVertexBuffer },
+ { "glCreateShaderProgramv", (QFunctionPointer) ::glCreateShaderProgramv },
+ { "glDeleteProgramPipelines", (QFunctionPointer) ::glDeleteProgramPipelines },
+ { "glDispatchCompute", (QFunctionPointer) ::glDispatchCompute },
+ { "glDispatchComputeIndirect", (QFunctionPointer) ::glDispatchComputeIndirect },
+ { "glDrawArraysIndirect", (QFunctionPointer) ::glDrawArraysIndirect },
+ { "glDrawElementsIndirect", (QFunctionPointer) ::glDrawElementsIndirect },
+ { "glFramebufferParameteri", (QFunctionPointer) ::glFramebufferParameteri },
+ { "glGenProgramPipelines", (QFunctionPointer) ::glGenProgramPipelines },
+ { "glGetBooleani_v", (QFunctionPointer) ::glGetBooleani_v },
+ { "glGetFramebufferParameteriv", (QFunctionPointer) ::glGetFramebufferParameteriv },
+ { "glGetMultisamplefv", (QFunctionPointer) ::glGetMultisamplefv },
+ { "glGetProgramInterfaceiv", (QFunctionPointer) ::glGetProgramInterfaceiv },
+ { "glGetProgramPipelineInfoLog", (QFunctionPointer) ::glGetProgramPipelineInfoLog },
+ { "glGetProgramPipelineiv", (QFunctionPointer) ::glGetProgramPipelineiv },
+ { "glGetProgramResourceIndex", (QFunctionPointer) ::glGetProgramResourceIndex },
+ { "glGetProgramResourceLocation", (QFunctionPointer) ::glGetProgramResourceLocation },
+ { "glGetProgramResourceName", (QFunctionPointer) ::glGetProgramResourceName },
+ { "glGetProgramResourceiv", (QFunctionPointer) ::glGetProgramResourceiv },
+ { "glGetTexLevelParameterfv", (QFunctionPointer) ::glGetTexLevelParameterfv },
+ { "glGetTexLevelParameteriv", (QFunctionPointer) ::glGetTexLevelParameteriv },
+ { "glIsProgramPipeline", (QFunctionPointer) ::glIsProgramPipeline },
+ { "glMemoryBarrier", (QFunctionPointer) ::glMemoryBarrier },
+ { "glMemoryBarrierByRegion", (QFunctionPointer) ::glMemoryBarrierByRegion },
+ { "glProgramUniform1f", (QFunctionPointer) ::glProgramUniform1f },
+ { "glProgramUniform1fv", (QFunctionPointer) ::glProgramUniform1fv },
+ { "glProgramUniform1i", (QFunctionPointer) ::glProgramUniform1i },
+ { "glProgramUniform1iv", (QFunctionPointer) ::glProgramUniform1iv },
+ { "glProgramUniform1ui", (QFunctionPointer) ::glProgramUniform1ui },
+ { "glProgramUniform1uiv", (QFunctionPointer) ::glProgramUniform1uiv },
+ { "glProgramUniform2f", (QFunctionPointer) ::glProgramUniform2f },
+ { "glProgramUniform2fv", (QFunctionPointer) ::glProgramUniform2fv },
+ { "glProgramUniform2i", (QFunctionPointer) ::glProgramUniform2i },
+ { "glProgramUniform2iv", (QFunctionPointer) ::glProgramUniform2iv },
+ { "glProgramUniform2ui", (QFunctionPointer) ::glProgramUniform2ui },
+ { "glProgramUniform2uiv", (QFunctionPointer) ::glProgramUniform2uiv },
+ { "glProgramUniform3f", (QFunctionPointer) ::glProgramUniform3f },
+ { "glProgramUniform3fv", (QFunctionPointer) ::glProgramUniform3fv },
+ { "glProgramUniform3i", (QFunctionPointer) ::glProgramUniform3i },
+ { "glProgramUniform3iv", (QFunctionPointer) ::glProgramUniform3iv },
+ { "glProgramUniform3ui", (QFunctionPointer) ::glProgramUniform3ui },
+ { "glProgramUniform3uiv", (QFunctionPointer) ::glProgramUniform3uiv },
+ { "glProgramUniform4f", (QFunctionPointer) ::glProgramUniform4f },
+ { "glProgramUniform4fv", (QFunctionPointer) ::glProgramUniform4fv },
+ { "glProgramUniform4i", (QFunctionPointer) ::glProgramUniform4i },
+ { "glProgramUniform4iv", (QFunctionPointer) ::glProgramUniform4iv },
+ { "glProgramUniform4ui", (QFunctionPointer) ::glProgramUniform4ui },
+ { "glProgramUniform4uiv", (QFunctionPointer) ::glProgramUniform4uiv },
+ { "glProgramUniformMatrix2fv", (QFunctionPointer) ::glProgramUniformMatrix2fv },
+ { "glProgramUniformMatrix2x3fv", (QFunctionPointer) ::glProgramUniformMatrix2x3fv },
+ { "glProgramUniformMatrix2x4fv", (QFunctionPointer) ::glProgramUniformMatrix2x4fv },
+ { "glProgramUniformMatrix3fv", (QFunctionPointer) ::glProgramUniformMatrix3fv },
+ { "glProgramUniformMatrix3x2fv", (QFunctionPointer) ::glProgramUniformMatrix3x2fv },
+ { "glProgramUniformMatrix3x4fv", (QFunctionPointer) ::glProgramUniformMatrix3x4fv },
+ { "glProgramUniformMatrix4fv", (QFunctionPointer) ::glProgramUniformMatrix4fv },
+ { "glProgramUniformMatrix4x2fv", (QFunctionPointer) ::glProgramUniformMatrix4x2fv },
+ { "glProgramUniformMatrix4x3fv", (QFunctionPointer) ::glProgramUniformMatrix4x3fv },
+ { "glSampleMaski", (QFunctionPointer) ::glSampleMaski },
+ { "glTexStorage2DMultisample", (QFunctionPointer) ::glTexStorage2DMultisample },
+ { "glUseProgramStages", (QFunctionPointer) ::glUseProgramStages },
+ { "glValidateProgramPipeline", (QFunctionPointer) ::glValidateProgramPipeline },
+ { "glVertexAttribBinding", (QFunctionPointer) ::glVertexAttribBinding },
+ { "glVertexAttribFormat", (QFunctionPointer) ::glVertexAttribFormat },
+ { "glVertexAttribIFormat", (QFunctionPointer) ::glVertexAttribIFormat },
+ { "glVertexBindingDivisor", (QFunctionPointer) ::glVertexBindingDivisor },
+#endif // QT_CONFIG(opengles31)
+
+#if QT_CONFIG(opengles32)
+ { "glBlendBarrier", (QFunctionPointer) ::glBlendBarrier },
+ { "glCopyImageSubData", (QFunctionPointer) ::glCopyImageSubData },
+ { "glDebugMessageControl", (QFunctionPointer) ::glDebugMessageControl },
+ { "glDebugMessageInsert", (QFunctionPointer) ::glDebugMessageInsert },
+ { "glDebugMessageCallback", (QFunctionPointer) ::glDebugMessageCallback },
+ { "glGetDebugMessageLog", (QFunctionPointer) ::glGetDebugMessageLog },
+ { "glPushDebugGroup", (QFunctionPointer) ::glPushDebugGroup },
+ { "glPopDebugGroup", (QFunctionPointer) ::glPopDebugGroup },
+ { "glObjectLabel", (QFunctionPointer) ::glObjectLabel },
+ { "glGetObjectLabel", (QFunctionPointer) ::glGetObjectLabel },
+ { "glObjectPtrLabel", (QFunctionPointer) ::glObjectPtrLabel },
+ { "glGetObjectPtrLabel", (QFunctionPointer) ::glGetObjectPtrLabel },
+ { "glGetPointerv", (QFunctionPointer) ::glGetPointerv },
+ { "glEnablei", (QFunctionPointer) ::glEnablei },
+ { "glDisablei", (QFunctionPointer) ::glDisablei },
+ { "glBlendEquationi", (QFunctionPointer) ::glBlendEquationi },
+ { "glBlendEquationSeparatei", (QFunctionPointer) ::glBlendEquationSeparatei },
+ { "glBlendFunci", (QFunctionPointer) ::glBlendFunci },
+ { "glBlendFuncSeparatei", (QFunctionPointer) ::glBlendFuncSeparatei },
+ { "glColorMaski", (QFunctionPointer) ::glColorMaski },
+ { "glIsEnabledi", (QFunctionPointer) ::glIsEnabledi },
+ { "glDrawElementsBaseVertex", (QFunctionPointer) ::glDrawElementsBaseVertex },
+ { "glDrawRangeElementsBaseVertex", (QFunctionPointer) ::glDrawRangeElementsBaseVertex },
+ { "glDrawElementsInstancedBaseVertex", (QFunctionPointer) ::glDrawElementsInstancedBaseVertex },
+ { "glFramebufferTexture", (QFunctionPointer) ::glFramebufferTexture },
+ { "glPrimitiveBoundingBox", (QFunctionPointer) ::glPrimitiveBoundingBox },
+ { "glGetGraphicsResetStatus", (QFunctionPointer) ::glGetGraphicsResetStatus },
+ { "glReadnPixels", (QFunctionPointer) ::glReadnPixels },
+ { "glGetnUniformfv", (QFunctionPointer) ::glGetnUniformfv },
+ { "glGetnUniformiv", (QFunctionPointer) ::glGetnUniformiv },
+ { "glGetnUniformuiv", (QFunctionPointer) ::glGetnUniformuiv },
+ { "glMinSampleShading", (QFunctionPointer) ::glMinSampleShading },
+ { "glPatchParameteri", (QFunctionPointer) ::glPatchParameteri },
+ { "glTexParameterIiv", (QFunctionPointer) ::glTexParameterIiv },
+ { "glTexParameterIuiv", (QFunctionPointer) ::glTexParameterIuiv },
+ { "glGetTexParameterIiv", (QFunctionPointer) ::glGetTexParameterIiv },
+ { "glGetTexParameterIuiv", (QFunctionPointer) ::glGetTexParameterIuiv },
+ { "glSamplerParameterIiv", (QFunctionPointer) ::glSamplerParameterIiv },
+ { "glSamplerParameterIuiv", (QFunctionPointer) ::glSamplerParameterIuiv },
+ { "glGetSamplerParameterIiv", (QFunctionPointer) ::glGetSamplerParameterIiv },
+ { "glGetSamplerParameterIuiv", (QFunctionPointer) ::glGetSamplerParameterIuiv },
+ { "glTexBuffer", (QFunctionPointer) ::glTexBuffer },
+ { "glTexBufferRange", (QFunctionPointer) ::glTexBufferRange },
+ { "glTexStorage3DMultisample", (QFunctionPointer) ::glTexStorage3DMultisample },
+#endif // QT_CONFIG(opengles32)
+ };
+
+ for (size_t i = 0; i < sizeof(standardFuncs) / sizeof(StdFunc); ++i) {
+ if (!qstrcmp(procName, standardFuncs[i].name)) {
+ proc = standardFuncs[i].func;
+ break;
+ }
+ }
+ }
+#endif
+
+ return proc;
+}
+
+QSurfaceFormat QEGLPlatformContext::format() const
+{
+ return m_format;
+}
+
+EGLContext QEGLPlatformContext::eglContext() const
+{
+ return m_eglContext;
+}
+
+EGLDisplay QEGLPlatformContext::eglDisplay() const
+{
+ return m_eglDisplay;
+}
+
+EGLConfig QEGLPlatformContext::eglConfig() const
+{
+ return m_eglConfig;
+}
+
+QT_END_NAMESPACE
diff --git a/src/gui/opengl/platform/egl/qeglplatformcontext_p.h b/src/gui/opengl/platform/egl/qeglplatformcontext_p.h
new file mode 100644
index 0000000000..b1e9c4b4c2
--- /dev/null
+++ b/src/gui/opengl/platform/egl/qeglplatformcontext_p.h
@@ -0,0 +1,115 @@
+// Copyright (C) 2020 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
+
+#ifndef QEGLPLATFORMCONTEXT_H
+#define QEGLPLATFORMCONTEXT_H
+
+//
+// W A R N I N G
+// -------------
+//
+// This file is not part of the Qt API. It exists purely as an
+// implementation detail. This header file may change from version to
+// version without notice, or even be removed.
+//
+// We mean it.
+//
+
+#include <QtCore/qtextstream.h>
+#include <qpa/qplatformwindow.h>
+#include <qpa/qplatformopenglcontext.h>
+#include <QtCore/qvariant.h>
+#include <QtGui/private/qt_egl_p.h>
+#include <QtGui/private/qopenglcontext_p.h>
+
+QT_BEGIN_NAMESPACE
+
+class Q_GUI_EXPORT QEGLPlatformContext : public QPlatformOpenGLContext,
+ public QNativeInterface::QEGLContext
+{
+public:
+ enum Flag {
+ NoSurfaceless = 0x01
+ };
+ Q_DECLARE_FLAGS(Flags, Flag)
+
+ QEGLPlatformContext(const QSurfaceFormat &format, QPlatformOpenGLContext *share, EGLDisplay display,
+ EGLConfig *config = nullptr, Flags flags = { });
+
+ template <typename T>
+ static QOpenGLContext *createFrom(EGLContext context, EGLDisplay contextDisplay,
+ EGLDisplay platformDisplay, QOpenGLContext *shareContext)
+ {
+ if (!context)
+ return nullptr;
+
+ // A context belonging to a given EGLDisplay cannot be used with another one
+ if (contextDisplay != platformDisplay) {
+ qWarning("QEGLPlatformContext: Cannot adopt context from different display");
+ return nullptr;
+ }
+
+ QPlatformOpenGLContext *shareHandle = shareContext ? shareContext->handle() : nullptr;
+
+ auto *resultingContext = new QOpenGLContext;
+ auto *contextPrivate = QOpenGLContextPrivate::get(resultingContext);
+ auto *platformContext = new T;
+ platformContext->adopt(context, contextDisplay, shareHandle);
+ contextPrivate->adopt(platformContext);
+ return resultingContext;
+ }
+
+ ~QEGLPlatformContext();
+
+ void initialize() override;
+ bool makeCurrent(QPlatformSurface *surface) override;
+ void doneCurrent() override;
+ void swapBuffers(QPlatformSurface *surface) override;
+ QFunctionPointer getProcAddress(const char *procName) override;
+
+ QSurfaceFormat format() const override;
+ bool isSharing() const override { return m_shareContext != EGL_NO_CONTEXT; }
+ bool isValid() const override { return m_eglContext != EGL_NO_CONTEXT && !m_markedInvalid; }
+
+ EGLContext nativeContext() const override { return eglContext(); }
+ EGLConfig config() const override { return eglConfig(); }
+ EGLDisplay display() const override { return eglDisplay(); }
+
+ virtual void invalidateContext() override { m_markedInvalid = true; }
+
+ EGLContext eglContext() const;
+ EGLDisplay eglDisplay() const;
+ EGLConfig eglConfig() const;
+
+protected:
+ QEGLPlatformContext() {} // For adoption
+ virtual EGLSurface eglSurfaceForPlatformSurface(QPlatformSurface *surface) = 0;
+ virtual EGLSurface createTemporaryOffscreenSurface();
+ virtual void destroyTemporaryOffscreenSurface(EGLSurface surface);
+ virtual void runGLChecks();
+
+private:
+ void adopt(EGLContext context, EGLDisplay display, QPlatformOpenGLContext *shareContext);
+ void updateFormatFromGL();
+
+ EGLContext m_eglContext;
+ EGLContext m_shareContext;
+ EGLDisplay m_eglDisplay;
+ EGLConfig m_eglConfig;
+ QSurfaceFormat m_format;
+ EGLenum m_api;
+ int m_swapInterval = -1;
+ bool m_swapIntervalEnvChecked = false;
+ int m_swapIntervalFromEnv = -1;
+ Flags m_flags;
+ bool m_ownsContext = false;
+ QList<EGLint> m_contextAttrs;
+
+ bool m_markedInvalid = false;
+};
+
+Q_DECLARE_OPERATORS_FOR_FLAGS(QEGLPlatformContext::Flags)
+
+QT_END_NAMESPACE
+
+#endif //QEGLPLATFORMCONTEXT_H
diff --git a/src/gui/opengl/platform/egl/qeglstreamconvenience.cpp b/src/gui/opengl/platform/egl/qeglstreamconvenience.cpp
new file mode 100644
index 0000000000..869e763bb8
--- /dev/null
+++ b/src/gui/opengl/platform/egl/qeglstreamconvenience.cpp
@@ -0,0 +1,87 @@
+// Copyright (C) 2020 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
+
+#include "qeglstreamconvenience_p.h"
+#include <string.h>
+
+QT_BEGIN_NAMESPACE
+
+QEGLStreamConvenience::QEGLStreamConvenience()
+ : initialized(false),
+ has_egl_platform_device(false),
+ has_egl_device_base(false),
+ has_egl_stream(false),
+ has_egl_stream_producer_eglsurface(false),
+ has_egl_stream_consumer_egloutput(false),
+ has_egl_output_drm(false),
+ has_egl_output_base(false),
+ has_egl_stream_cross_process_fd(false),
+ has_egl_stream_consumer_gltexture(false)
+{
+ const char *extensions = eglQueryString(EGL_NO_DISPLAY, EGL_EXTENSIONS);
+ if (!extensions) {
+ qWarning("Failed to query EGL extensions");
+ return;
+ }
+
+ query_devices = reinterpret_cast<PFNEGLQUERYDEVICESEXTPROC>(eglGetProcAddress("eglQueryDevicesEXT"));
+ query_device_string = reinterpret_cast<PFNEGLQUERYDEVICESTRINGEXTPROC>(eglGetProcAddress("eglQueryDeviceStringEXT"));
+ get_platform_display = reinterpret_cast<PFNEGLGETPLATFORMDISPLAYEXTPROC>(eglGetProcAddress("eglGetPlatformDisplayEXT"));
+
+ has_egl_device_base = strstr(extensions, "EGL_EXT_device_base");
+ has_egl_platform_device = strstr(extensions, "EGL_EXT_platform_device");
+}
+
+void QEGLStreamConvenience::initialize(EGLDisplay dpy)
+{
+ if (initialized)
+ return;
+
+ if (!eglBindAPI(EGL_OPENGL_ES_API)) {
+ qWarning("Failed to bind OpenGL ES API");
+ return;
+ }
+
+ const char *extensions = eglQueryString(dpy, EGL_EXTENSIONS);
+ if (!extensions) {
+ qWarning("Failed to query EGL extensions");
+ return;
+ }
+
+ create_stream = reinterpret_cast<PFNEGLCREATESTREAMKHRPROC>(eglGetProcAddress("eglCreateStreamKHR"));
+ destroy_stream = reinterpret_cast<PFNEGLDESTROYSTREAMKHRPROC>(eglGetProcAddress("eglDestroyStreamKHR"));
+ stream_attrib = reinterpret_cast<PFNEGLSTREAMATTRIBKHRPROC>(eglGetProcAddress("eglStreamAttribKHR"));
+ query_stream = reinterpret_cast<PFNEGLQUERYSTREAMKHRPROC>(eglGetProcAddress("eglQueryStreamKHR"));
+ query_stream_u64 = reinterpret_cast<PFNEGLQUERYSTREAMU64KHRPROC>(eglGetProcAddress("eglQueryStreamu64KHR"));
+ create_stream_producer_surface = reinterpret_cast<PFNEGLCREATESTREAMPRODUCERSURFACEKHRPROC>(eglGetProcAddress("eglCreateStreamProducerSurfaceKHR"));
+ stream_consumer_output = reinterpret_cast<PFNEGLSTREAMCONSUMEROUTPUTEXTPROC>(eglGetProcAddress("eglStreamConsumerOutputEXT"));
+ get_output_layers = reinterpret_cast<PFNEGLGETOUTPUTLAYERSEXTPROC>(eglGetProcAddress("eglGetOutputLayersEXT"));
+ get_output_ports = reinterpret_cast<PFNEGLGETOUTPUTPORTSEXTPROC>(eglGetProcAddress("eglGetOutputPortsEXT"));
+ output_layer_attrib = reinterpret_cast<PFNEGLOUTPUTLAYERATTRIBEXTPROC>(eglGetProcAddress("eglOutputLayerAttribEXT"));
+ query_output_layer_attrib = reinterpret_cast<PFNEGLQUERYOUTPUTLAYERATTRIBEXTPROC>(eglGetProcAddress("eglQueryOutputLayerAttribEXT"));
+ query_output_layer_string = reinterpret_cast<PFNEGLQUERYOUTPUTLAYERSTRINGEXTPROC>(eglGetProcAddress("eglQueryOutputLayerStringEXT"));
+ query_output_port_attrib = reinterpret_cast<PFNEGLQUERYOUTPUTPORTATTRIBEXTPROC>(eglGetProcAddress("eglQueryOutputPortAttribEXT"));
+ query_output_port_string = reinterpret_cast<PFNEGLQUERYOUTPUTPORTSTRINGEXTPROC>(eglGetProcAddress("eglQueryOutputPortStringEXT"));
+ get_stream_file_descriptor = reinterpret_cast<PFNEGLGETSTREAMFILEDESCRIPTORKHRPROC>(eglGetProcAddress("eglGetStreamFileDescriptorKHR"));
+ create_stream_from_file_descriptor = reinterpret_cast<PFNEGLCREATESTREAMFROMFILEDESCRIPTORKHRPROC>(eglGetProcAddress("eglCreateStreamFromFileDescriptorKHR"));
+ stream_consumer_gltexture = reinterpret_cast<PFNEGLSTREAMCONSUMERGLTEXTUREEXTERNALKHRPROC>(eglGetProcAddress("eglStreamConsumerGLTextureExternalKHR"));
+ stream_consumer_acquire = reinterpret_cast<PFNEGLSTREAMCONSUMERACQUIREKHRPROC>(eglGetProcAddress("eglStreamConsumerAcquireKHR"));
+ stream_consumer_release = reinterpret_cast<PFNEGLSTREAMCONSUMERRELEASEKHRPROC>(eglGetProcAddress("eglStreamConsumerReleaseKHR"));
+ create_stream_attrib_nv = reinterpret_cast<PFNEGLCREATESTREAMATTRIBNVPROC>(eglGetProcAddress("eglCreateStreamAttribNV"));
+ set_stream_attrib_nv = reinterpret_cast<PFNEGLSETSTREAMATTRIBNVPROC>(eglGetProcAddress("eglSetStreamAttribNV"));
+ query_stream_attrib_nv = reinterpret_cast<PFNEGLQUERYSTREAMATTRIBNVPROC>(eglGetProcAddress("eglQueryStreamAttribNV"));
+ acquire_stream_attrib_nv = reinterpret_cast<PFNEGLSTREAMCONSUMERACQUIREATTRIBNVPROC>(eglGetProcAddress("eglStreamConsumerAcquireAttribNV"));
+ release_stream_attrib_nv = reinterpret_cast<PFNEGLSTREAMCONSUMERRELEASEATTRIBNVPROC>(eglGetProcAddress("eglStreamConsumerReleaseAttribNV"));
+
+ has_egl_stream = strstr(extensions, "EGL_KHR_stream");
+ has_egl_stream_producer_eglsurface = strstr(extensions, "EGL_KHR_stream_producer_eglsurface");
+ has_egl_stream_consumer_egloutput = strstr(extensions, "EGL_EXT_stream_consumer_egloutput");
+ has_egl_output_drm = strstr(extensions, "EGL_EXT_output_drm");
+ has_egl_output_base = strstr(extensions, "EGL_EXT_output_base");
+ has_egl_stream_cross_process_fd = strstr(extensions, "EGL_KHR_stream_cross_process_fd");
+ has_egl_stream_consumer_gltexture = strstr(extensions, "EGL_KHR_stream_consumer_gltexture");
+
+ initialized = true;
+}
+
+QT_END_NAMESPACE
diff --git a/src/gui/opengl/platform/egl/qeglstreamconvenience_p.h b/src/gui/opengl/platform/egl/qeglstreamconvenience_p.h
new file mode 100644
index 0000000000..edf73fe981
--- /dev/null
+++ b/src/gui/opengl/platform/egl/qeglstreamconvenience_p.h
@@ -0,0 +1,179 @@
+// Copyright (C) 2020 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
+
+#ifndef QEGLSTREAMCONVENIENCE_H
+#define QEGLSTREAMCONVENIENCE_H
+
+//
+// W A R N I N G
+// -------------
+//
+// This file is not part of the Qt API. It exists purely as an
+// implementation detail. This header file may change from version to
+// version without notice, or even be removed.
+//
+// We mean it.
+//
+
+#include <QtGui/qtguiglobal.h>
+
+#include <QtGui/private/qt_egl_p.h>
+
+// This provides runtime EGLDevice/Output/Stream support even when eglext.h in
+// the sysroot is not up-to-date.
+
+#ifndef EGL_VERSION_1_5
+typedef intptr_t EGLAttrib;
+#endif
+
+#ifndef EGL_EXT_platform_base
+typedef EGLDisplay (EGLAPIENTRYP PFNEGLGETPLATFORMDISPLAYEXTPROC) (EGLenum platform, void *native_display, const EGLint *attrib_list);
+#endif
+
+#ifndef EGL_EXT_device_base
+typedef void *EGLDeviceEXT;
+#define EGL_NO_DEVICE_EXT ((EGLDeviceEXT)(0))
+typedef EGLBoolean (EGLAPIENTRYP PFNEGLQUERYDEVICESEXTPROC) (EGLint max_devices, EGLDeviceEXT *devices, EGLint *num_devices);
+typedef const char *(EGLAPIENTRYP PFNEGLQUERYDEVICESTRINGEXTPROC) (EGLDeviceEXT device, EGLint name);
+#endif
+
+#ifndef EGL_EXT_output_base
+typedef void *EGLOutputLayerEXT;
+typedef void *EGLOutputPortEXT;
+#define EGL_NO_OUTPUT_LAYER_EXT ((EGLOutputLayerEXT)0)
+typedef EGLBoolean (EGLAPIENTRYP PFNEGLGETOUTPUTLAYERSEXTPROC) (EGLDisplay dpy, const EGLAttrib *attrib_list, EGLOutputLayerEXT *layers, EGLint max_layers, EGLint *num_layers);
+typedef EGLBoolean (EGLAPIENTRYP PFNEGLGETOUTPUTPORTSEXTPROC) (EGLDisplay dpy, const EGLAttrib *attrib_list, EGLOutputPortEXT *ports, EGLint max_ports, EGLint *num_ports);
+typedef EGLBoolean (EGLAPIENTRYP PFNEGLOUTPUTLAYERATTRIBEXTPROC) (EGLDisplay dpy, EGLOutputLayerEXT layer, EGLint attribute, EGLAttrib value);
+typedef EGLBoolean (EGLAPIENTRYP PFNEGLQUERYOUTPUTLAYERATTRIBEXTPROC) (EGLDisplay dpy, EGLOutputLayerEXT layer, EGLint attribute, EGLAttrib *value);
+typedef const char *(EGLAPIENTRYP PFNEGLQUERYOUTPUTLAYERSTRINGEXTPROC) (EGLDisplay dpy, EGLOutputLayerEXT layer, EGLint name);
+typedef EGLBoolean (EGLAPIENTRYP PFNEGLQUERYOUTPUTPORTATTRIBEXTPROC) (EGLDisplay dpy, EGLOutputPortEXT port, EGLint attribute, EGLAttrib *value);
+typedef const char *(EGLAPIENTRYP PFNEGLQUERYOUTPUTPORTSTRINGEXTPROC) (EGLDisplay dpy, EGLOutputPortEXT port, EGLint name);
+#endif
+
+#ifndef EGL_KHR_stream
+typedef void *EGLStreamKHR;
+typedef quint64 EGLuint64KHR;
+#define EGL_NO_STREAM_KHR ((EGLStreamKHR)0)
+#define EGL_STREAM_STATE_KHR 0x3214
+#define EGL_STREAM_STATE_CREATED_KHR 0x3215
+#define EGL_STREAM_STATE_CONNECTING_KHR 0x3216
+#define EGL_STREAM_STATE_EMPTY_KHR 0x3217
+#define EGL_STREAM_STATE_NEW_FRAME_AVAILABLE_KHR 0x3218
+#define EGL_STREAM_STATE_OLD_FRAME_AVAILABLE_KHR 0x3219
+#define EGL_STREAM_STATE_DISCONNECTED_KHR 0x321A
+#define EGL_BAD_STREAM_KHR 0x321B
+#define EGL_BAD_STATE_KHR 0x321C
+typedef EGLStreamKHR (EGLAPIENTRYP PFNEGLCREATESTREAMKHRPROC) (EGLDisplay dpy, const EGLint *attrib_list);
+typedef EGLBoolean (EGLAPIENTRYP PFNEGLDESTROYSTREAMKHRPROC) (EGLDisplay dpy, EGLStreamKHR stream);
+typedef EGLBoolean (EGLAPIENTRYP PFNEGLSTREAMATTRIBKHRPROC) (EGLDisplay dpy, EGLStreamKHR stream, EGLenum attribute, EGLint value);
+typedef EGLBoolean (EGLAPIENTRYP PFNEGLQUERYSTREAMKHRPROC) (EGLDisplay dpy, EGLStreamKHR stream, EGLenum attribute, EGLint *value);
+typedef EGLBoolean (EGLAPIENTRYP PFNEGLQUERYSTREAMU64KHRPROC) (EGLDisplay dpy, EGLStreamKHR stream, EGLenum attribute, EGLuint64KHR *value);
+#endif
+
+#ifndef EGL_KHR_stream_fifo
+#define EGL_STREAM_FIFO_LENGTH_KHR 0x31FC
+#endif
+
+#ifndef EGL_KHR_stream_producer_eglsurface
+#define EGL_STREAM_BIT_KHR 0x0800
+typedef EGLSurface (EGLAPIENTRYP PFNEGLCREATESTREAMPRODUCERSURFACEKHRPROC) (EGLDisplay dpy, EGLConfig config, EGLStreamKHR stream, const EGLint *attrib_list);
+#endif
+
+#ifndef EGL_KHR_stream_cross_process_fd
+typedef int EGLNativeFileDescriptorKHR;
+#define EGL_NO_FILE_DESCRIPTOR_KHR ((EGLNativeFileDescriptorKHR)(-1))
+typedef EGLNativeFileDescriptorKHR (EGLAPIENTRYP PFNEGLGETSTREAMFILEDESCRIPTORKHRPROC) (EGLDisplay dpy, EGLStreamKHR stream);
+typedef EGLStreamKHR (EGLAPIENTRYP PFNEGLCREATESTREAMFROMFILEDESCRIPTORKHRPROC) (EGLDisplay dpy, EGLNativeFileDescriptorKHR file_descriptor);
+#endif
+
+#ifndef EGL_KHR_stream_consumer_gltexture
+typedef EGLBoolean (EGLAPIENTRYP PFNEGLSTREAMCONSUMERGLTEXTUREEXTERNALKHRPROC) (EGLDisplay dpy, EGLStreamKHR stream);
+typedef EGLBoolean (EGLAPIENTRYP PFNEGLSTREAMCONSUMERACQUIREKHRPROC) (EGLDisplay dpy, EGLStreamKHR stream);
+typedef EGLBoolean (EGLAPIENTRYP PFNEGLSTREAMCONSUMERRELEASEKHRPROC) (EGLDisplay dpy, EGLStreamKHR stream);
+#endif
+
+#ifndef EGL_EXT_stream_consumer_egloutput
+typedef EGLBoolean (EGLAPIENTRYP PFNEGLSTREAMCONSUMEROUTPUTEXTPROC) (EGLDisplay dpy, EGLStreamKHR stream, EGLOutputLayerEXT layer);
+#endif
+
+#ifndef EGL_EXT_platform_device
+#define EGL_PLATFORM_DEVICE_EXT 0x313F
+#endif
+
+#ifndef EGL_EXT_device_drm
+#define EGL_DRM_DEVICE_FILE_EXT 0x3233
+#endif
+
+#ifndef EGL_EXT_output_drm
+#define EGL_DRM_CRTC_EXT 0x3234
+#define EGL_DRM_PLANE_EXT 0x3235
+#endif
+
+#ifndef EGL_PLATFORM_X11_KHR
+#define EGL_PLATFORM_X11_KHR 0x31D5
+#endif
+
+#ifndef EGL_PLATFORM_XCB_KHR
+#define EGL_PLATFORM_XCB_KHR 0x31DC
+#endif
+
+#ifndef EGL_NV_stream_attrib
+typedef EGLStreamKHR (EGLAPIENTRYP PFNEGLCREATESTREAMATTRIBNVPROC) (EGLDisplay dpy, const EGLAttrib *attrib_list);
+typedef EGLBoolean (EGLAPIENTRYP PFNEGLSETSTREAMATTRIBNVPROC) (EGLDisplay dpy, EGLStreamKHR stream, EGLenum attribute, EGLAttrib value);
+typedef EGLBoolean (EGLAPIENTRYP PFNEGLQUERYSTREAMATTRIBNVPROC) (EGLDisplay dpy, EGLStreamKHR stream, EGLenum attribute, EGLAttrib *value);
+typedef EGLBoolean (EGLAPIENTRYP PFNEGLSTREAMCONSUMERACQUIREATTRIBNVPROC) (EGLDisplay dpy, EGLStreamKHR stream, const EGLAttrib *attrib_list);
+typedef EGLBoolean (EGLAPIENTRYP PFNEGLSTREAMCONSUMERRELEASEATTRIBNVPROC) (EGLDisplay dpy, EGLStreamKHR stream, const EGLAttrib *attrib_list);
+#endif
+
+QT_BEGIN_NAMESPACE
+
+class Q_GUI_EXPORT QEGLStreamConvenience
+{
+public:
+ QEGLStreamConvenience();
+ void initialize(EGLDisplay dpy);
+
+ PFNEGLGETPLATFORMDISPLAYEXTPROC get_platform_display;
+ PFNEGLQUERYDEVICESEXTPROC query_devices;
+ PFNEGLQUERYDEVICESTRINGEXTPROC query_device_string;
+ PFNEGLCREATESTREAMKHRPROC create_stream;
+ PFNEGLCREATESTREAMATTRIBNVPROC create_stream_attrib_nv;
+ PFNEGLSETSTREAMATTRIBNVPROC set_stream_attrib_nv;
+ PFNEGLQUERYSTREAMATTRIBNVPROC query_stream_attrib_nv;
+ PFNEGLSTREAMCONSUMERACQUIREATTRIBNVPROC acquire_stream_attrib_nv;
+ PFNEGLSTREAMCONSUMERRELEASEATTRIBNVPROC release_stream_attrib_nv;
+ PFNEGLDESTROYSTREAMKHRPROC destroy_stream;
+ PFNEGLSTREAMATTRIBKHRPROC stream_attrib;
+ PFNEGLQUERYSTREAMKHRPROC query_stream;
+ PFNEGLQUERYSTREAMU64KHRPROC query_stream_u64;
+ PFNEGLCREATESTREAMPRODUCERSURFACEKHRPROC create_stream_producer_surface;
+ PFNEGLSTREAMCONSUMEROUTPUTEXTPROC stream_consumer_output;
+ PFNEGLGETOUTPUTLAYERSEXTPROC get_output_layers;
+ PFNEGLGETOUTPUTPORTSEXTPROC get_output_ports;
+ PFNEGLOUTPUTLAYERATTRIBEXTPROC output_layer_attrib;
+ PFNEGLQUERYOUTPUTLAYERATTRIBEXTPROC query_output_layer_attrib;
+ PFNEGLQUERYOUTPUTLAYERSTRINGEXTPROC query_output_layer_string;
+ PFNEGLQUERYOUTPUTPORTATTRIBEXTPROC query_output_port_attrib;
+ PFNEGLQUERYOUTPUTPORTSTRINGEXTPROC query_output_port_string;
+ PFNEGLGETSTREAMFILEDESCRIPTORKHRPROC get_stream_file_descriptor;
+ PFNEGLCREATESTREAMFROMFILEDESCRIPTORKHRPROC create_stream_from_file_descriptor;
+ PFNEGLSTREAMCONSUMERGLTEXTUREEXTERNALKHRPROC stream_consumer_gltexture;
+ PFNEGLSTREAMCONSUMERACQUIREKHRPROC stream_consumer_acquire;
+ PFNEGLSTREAMCONSUMERRELEASEKHRPROC stream_consumer_release;
+
+ bool initialized;
+
+ bool has_egl_platform_device;
+ bool has_egl_device_base;
+ bool has_egl_stream;
+ bool has_egl_stream_producer_eglsurface;
+ bool has_egl_stream_consumer_egloutput;
+ bool has_egl_output_drm;
+ bool has_egl_output_base;
+ bool has_egl_stream_cross_process_fd;
+ bool has_egl_stream_consumer_gltexture;
+};
+
+QT_END_NAMESPACE
+
+#endif
diff --git a/src/gui/opengl/platform/egl/qt_egl_p.h b/src/gui/opengl/platform/egl/qt_egl_p.h
new file mode 100644
index 0000000000..1f538e22af
--- /dev/null
+++ b/src/gui/opengl/platform/egl/qt_egl_p.h
@@ -0,0 +1,97 @@
+// Copyright (C) 2020 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
+
+#ifndef QT_EGL_P_H
+#define QT_EGL_P_H
+
+//
+// W A R N I N G
+// -------------
+//
+// This file is not part of the Qt API. It exists purely as an
+// implementation detail. This header file may change from version to
+// version without notice, or even be removed.
+//
+// We mean it.
+//
+
+// q(data/text)stream.h must be included before any header file that defines Status
+#include <QtCore/qdatastream.h>
+#include <QtCore/qtextstream.h>
+#include <QtCore/private/qglobal_p.h>
+
+#ifdef QT_EGL_NO_X11
+# ifndef EGL_NO_X11
+# define EGL_NO_X11
+# endif
+# ifndef MESA_EGL_NO_X11_HEADERS
+# define MESA_EGL_NO_X11_HEADERS // MESA
+# endif
+# if !defined(Q_OS_INTEGRITY)
+# define WIN_INTERFACE_CUSTOM // NV
+# endif // Q_OS_INTEGRITY
+#else // QT_EGL_NO_X11
+// If one has an eglplatform.h with https://github.com/KhronosGroup/EGL-Registry/pull/130
+// that needs USE_X11 to be defined.
+# define USE_X11
+#endif
+
+#ifdef QT_EGL_WAYLAND
+# define WAYLAND // NV
+#endif // QT_EGL_WAYLAND
+
+#include <EGL/egl.h>
+#include <EGL/eglext.h>
+
+#include <stdint.h>
+
+QT_BEGIN_NAMESPACE
+
+namespace QtInternal {
+
+template <class FromType, class ToType>
+struct QtEglConverter
+{
+ static inline ToType convert(FromType v)
+ { return v; }
+};
+
+template <>
+struct QtEglConverter<uint32_t, uintptr_t>
+{
+ static inline uintptr_t convert(uint32_t v)
+ { return v; }
+};
+
+#if QT_POINTER_SIZE > 4
+template <>
+struct QtEglConverter<uintptr_t, uint32_t>
+{
+ static inline uint32_t convert(uintptr_t v)
+ { return uint32_t(v); }
+};
+#endif
+
+template <>
+struct QtEglConverter<uint32_t, void *>
+{
+ static inline void *convert(uint32_t v)
+ { return reinterpret_cast<void *>(uintptr_t(v)); }
+};
+
+template <>
+struct QtEglConverter<void *, uint32_t>
+{
+ static inline uint32_t convert(void *v)
+ { return uintptr_t(v); }
+};
+
+} // QtInternal
+
+template <class ToType, class FromType>
+static inline ToType qt_egl_cast(FromType from)
+{ return QtInternal::QtEglConverter<FromType, ToType>::convert(from); }
+
+QT_END_NAMESPACE
+
+#endif // QT_EGL_P_H
diff --git a/src/gui/opengl/platform/unix/qglxconvenience.cpp b/src/gui/opengl/platform/unix/qglxconvenience.cpp
new file mode 100644
index 0000000000..ce70818042
--- /dev/null
+++ b/src/gui/opengl/platform/unix/qglxconvenience.cpp
@@ -0,0 +1,437 @@
+// Copyright (C) 2020 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
+
+// We have to include this before the X11 headers dragged in by
+// qglxconvenience_p.h.
+#include <QtCore/qbytearray.h>
+#include <QtCore/qmetatype.h>
+#include <QtCore/qscopedpointer.h>
+#include <QtCore/qtextstream.h>
+#include <QtGui/qcolorspace.h>
+#include "qglxconvenience_p.h"
+
+#include <QtCore/qloggingcategory.h>
+#include <QtCore/qvarlengtharray.h>
+
+
+#include <GL/glxext.h>
+
+enum {
+ XFocusOut = FocusOut,
+ XFocusIn = FocusIn,
+ XKeyPress = KeyPress,
+ XKeyRelease = KeyRelease,
+ XNone = None,
+ XRevertToParent = RevertToParent,
+ XGrayScale = GrayScale,
+ XCursorShape = CursorShape
+};
+#undef FocusOut
+#undef FocusIn
+#undef KeyPress
+#undef KeyRelease
+#undef None
+#undef RevertToParent
+#undef GrayScale
+#undef CursorShape
+
+#ifdef FontChange
+#undef FontChange
+#endif
+
+#ifndef GLX_FRAMEBUFFER_SRGB_CAPABLE_ARB
+#define GLX_FRAMEBUFFER_SRGB_CAPABLE_ARB 0x20B2
+#endif
+
+QT_BEGIN_NAMESPACE
+
+Q_LOGGING_CATEGORY(lcGlx, "qt.glx")
+
+QList<int> qglx_buildSpec(const QSurfaceFormat &format, int drawableBit, int flags)
+{
+ QList<int> spec;
+
+ spec << GLX_LEVEL
+ << 0
+
+ << GLX_RENDER_TYPE
+ << GLX_RGBA_BIT
+
+ << GLX_RED_SIZE
+ << qMax(1, format.redBufferSize())
+
+ << GLX_GREEN_SIZE
+ << qMax(1, format.greenBufferSize())
+
+ << GLX_BLUE_SIZE
+ << qMax(1, format.blueBufferSize())
+
+ << GLX_ALPHA_SIZE
+ << qMax(0, format.alphaBufferSize());
+
+ if (format.swapBehavior() != QSurfaceFormat::SingleBuffer)
+ spec << GLX_DOUBLEBUFFER
+ << True;
+
+ if (format.stereo())
+ spec << GLX_STEREO
+ << True;
+
+ if (format.depthBufferSize() != -1)
+ spec << GLX_DEPTH_SIZE
+ << format.depthBufferSize();
+
+ if (format.stencilBufferSize() != -1)
+ spec << GLX_STENCIL_SIZE
+ << format.stencilBufferSize();
+
+ if (format.samples() > 1)
+ spec << GLX_SAMPLE_BUFFERS_ARB
+ << 1
+ << GLX_SAMPLES_ARB
+ << format.samples();
+
+ if ((flags & QGLX_SUPPORTS_SRGB) && format.colorSpace() == QColorSpace::SRgb)
+ spec << GLX_FRAMEBUFFER_SRGB_CAPABLE_ARB
+ << True;
+
+ spec << GLX_DRAWABLE_TYPE
+ << drawableBit
+
+ << XNone;
+
+ return spec;
+}
+
+namespace {
+struct QXcbSoftwareOpenGLEnforcer {
+ QXcbSoftwareOpenGLEnforcer() {
+ // Allow forcing LIBGL_ALWAYS_SOFTWARE for Qt 5 applications only.
+ // This is most useful with drivers that only support OpenGL 1.
+ // We need OpenGL 2, but the user probably doesn't want
+ // LIBGL_ALWAYS_SOFTWARE in OpenGL 1 apps.
+
+ if (!checkedForceSoftwareOpenGL) {
+ // If LIBGL_ALWAYS_SOFTWARE is already set, don't mess with it.
+ // We want to unset LIBGL_ALWAYS_SOFTWARE at the end so it does not
+ // get inherited by other processes, of course only if it wasn't
+ // already set before.
+ if (!qEnvironmentVariableIsEmpty("QT_XCB_FORCE_SOFTWARE_OPENGL")
+ && !qEnvironmentVariableIsSet("LIBGL_ALWAYS_SOFTWARE"))
+ forceSoftwareOpenGL = true;
+
+ checkedForceSoftwareOpenGL = true;
+ }
+
+ if (forceSoftwareOpenGL)
+ qputenv("LIBGL_ALWAYS_SOFTWARE", "1");
+ }
+
+ ~QXcbSoftwareOpenGLEnforcer() {
+ // unset LIBGL_ALWAYS_SOFTWARE now so other processes don't inherit it
+ if (forceSoftwareOpenGL)
+ qunsetenv("LIBGL_ALWAYS_SOFTWARE");
+ }
+
+ static bool checkedForceSoftwareOpenGL;
+ static bool forceSoftwareOpenGL;
+};
+
+bool QXcbSoftwareOpenGLEnforcer::checkedForceSoftwareOpenGL = false;
+bool QXcbSoftwareOpenGLEnforcer::forceSoftwareOpenGL = false;
+
+template <class T>
+struct QXlibScopedPointerDeleter {
+ static inline void cleanup(T *pointer) {
+ if (pointer)
+ XFree(pointer);
+ }
+};
+
+template <class T>
+using QXlibPointer = QScopedPointer<T, QXlibScopedPointerDeleter<T>>;
+
+template <class T>
+using QXlibArrayPointer = QScopedArrayPointer<T, QXlibScopedPointerDeleter<T>>;
+}
+
+GLXFBConfig qglx_findConfig(Display *display, int screen , QSurfaceFormat format, bool highestPixelFormat, int drawableBit, int flags)
+{
+ QXcbSoftwareOpenGLEnforcer softwareOpenGLEnforcer;
+
+ GLXFBConfig config = nullptr;
+
+ do {
+ const QList<int> spec = qglx_buildSpec(format, drawableBit, flags);
+
+ int confcount = 0;
+ QXlibArrayPointer<GLXFBConfig> configs(glXChooseFBConfig(display, screen, spec.constData(), &confcount));
+
+ if (!config && confcount > 0) {
+ config = configs[0];
+ if (highestPixelFormat && !format.hasAlpha())
+ break;
+ }
+
+ const int requestedRed = qMax(0, format.redBufferSize());
+ const int requestedGreen = qMax(0, format.greenBufferSize());
+ const int requestedBlue = qMax(0, format.blueBufferSize());
+ const int requestedAlpha = qMax(0, format.alphaBufferSize());
+
+ GLXFBConfig compatibleCandidate = nullptr;
+ for (int i = 0; i < confcount; i++) {
+ GLXFBConfig candidate = configs[i];
+
+ if ((flags & QGLX_SUPPORTS_SRGB) && format.colorSpace() == QColorSpace::SRgb) {
+ int srgbCapable = 0;
+ glXGetFBConfigAttrib(display, candidate, GLX_FRAMEBUFFER_SRGB_CAPABLE_ARB, &srgbCapable);
+ if (!srgbCapable)
+ continue;
+ }
+
+ QXlibPointer<XVisualInfo> visual(glXGetVisualFromFBConfig(display, candidate));
+ if (!visual)
+ continue;
+ int actualRed;
+ int actualGreen;
+ int actualBlue;
+ int actualAlpha;
+ glXGetFBConfigAttrib(display, candidate, GLX_RED_SIZE, &actualRed);
+ glXGetFBConfigAttrib(display, candidate, GLX_GREEN_SIZE, &actualGreen);
+ glXGetFBConfigAttrib(display, candidate, GLX_BLUE_SIZE, &actualBlue);
+ glXGetFBConfigAttrib(display, candidate, GLX_ALPHA_SIZE, &actualAlpha);
+ // Sometimes the visuals don't have a depth that includes the alpha channel.
+ actualAlpha = qMin(actualAlpha, visual->depth - actualRed - actualGreen - actualBlue);
+
+ if (requestedRed && actualRed < requestedRed)
+ continue;
+ if (requestedGreen && actualGreen < requestedGreen)
+ continue;
+ if (requestedBlue && actualBlue < requestedBlue)
+ continue;
+ if (requestedAlpha && actualAlpha < requestedAlpha)
+ continue;
+ if (!compatibleCandidate) // Only pick up the first compatible one offered by the server
+ compatibleCandidate = candidate;
+
+ if (requestedRed && actualRed != requestedRed)
+ continue;
+ if (requestedGreen && actualGreen != requestedGreen)
+ continue;
+ if (requestedBlue && actualBlue != requestedBlue)
+ continue;
+ if (requestedAlpha && actualAlpha != requestedAlpha)
+ continue;
+
+ return candidate;
+ }
+ if (compatibleCandidate) {
+ qCDebug(lcGlx) << "qglx_findConfig: Found non-matching but compatible FBConfig";
+ return compatibleCandidate;
+ }
+ } while (qglx_reduceFormat(&format));
+
+ if (!config)
+ qCWarning(lcGlx) << "qglx_findConfig: Failed to finding matching FBConfig for" << format;
+
+ return config;
+}
+
+XVisualInfo *qglx_findVisualInfo(Display *display, int screen, QSurfaceFormat *format, int drawableBit, int flags)
+{
+ Q_ASSERT(format);
+
+ XVisualInfo *visualInfo = nullptr;
+
+ GLXFBConfig config = qglx_findConfig(display, screen, *format, false, drawableBit, flags);
+ if (config)
+ visualInfo = glXGetVisualFromFBConfig(display, config);
+
+ if (visualInfo) {
+ qglx_surfaceFormatFromGLXFBConfig(format, display, config, flags);
+ return visualInfo;
+ }
+
+ // attempt to fall back to glXChooseVisual
+ do {
+ QList<int> attribs = qglx_buildSpec(*format, drawableBit, flags);
+ visualInfo = glXChooseVisual(display, screen, attribs.data());
+
+ if (visualInfo) {
+ qglx_surfaceFormatFromVisualInfo(format, display, visualInfo, flags);
+ return visualInfo;
+ }
+ } while (qglx_reduceFormat(format));
+
+ return visualInfo;
+}
+
+void qglx_surfaceFormatFromGLXFBConfig(QSurfaceFormat *format, Display *display, GLXFBConfig config, int flags)
+{
+ int redSize = 0;
+ int greenSize = 0;
+ int blueSize = 0;
+ int alphaSize = 0;
+ int depthSize = 0;
+ int stencilSize = 0;
+ int sampleBuffers = 0;
+ int sampleCount = 0;
+ int stereo = 0;
+ int srgbCapable = 0;
+
+ glXGetFBConfigAttrib(display, config, GLX_RED_SIZE, &redSize);
+ glXGetFBConfigAttrib(display, config, GLX_GREEN_SIZE, &greenSize);
+ glXGetFBConfigAttrib(display, config, GLX_BLUE_SIZE, &blueSize);
+ glXGetFBConfigAttrib(display, config, GLX_ALPHA_SIZE, &alphaSize);
+ glXGetFBConfigAttrib(display, config, GLX_DEPTH_SIZE, &depthSize);
+ glXGetFBConfigAttrib(display, config, GLX_STENCIL_SIZE, &stencilSize);
+ glXGetFBConfigAttrib(display, config, GLX_SAMPLE_BUFFERS_ARB, &sampleBuffers);
+ glXGetFBConfigAttrib(display, config, GLX_STEREO, &stereo);
+ if (flags & QGLX_SUPPORTS_SRGB)
+ glXGetFBConfigAttrib(display, config, GLX_FRAMEBUFFER_SRGB_CAPABLE_ARB, &srgbCapable);
+
+ format->setRedBufferSize(redSize);
+ format->setGreenBufferSize(greenSize);
+ format->setBlueBufferSize(blueSize);
+ format->setAlphaBufferSize(alphaSize);
+ format->setDepthBufferSize(depthSize);
+ format->setStencilBufferSize(stencilSize);
+ if (sampleBuffers) {
+ glXGetFBConfigAttrib(display, config, GLX_SAMPLES_ARB, &sampleCount);
+ format->setSamples(sampleCount);
+ }
+ if (srgbCapable)
+ format->setColorSpace(QColorSpace::SRgb);
+ else
+ format->setColorSpace(QColorSpace());
+
+ format->setStereo(stereo);
+}
+
+void qglx_surfaceFormatFromVisualInfo(QSurfaceFormat *format, Display *display, XVisualInfo *visualInfo, int flags)
+{
+ int redSize = 0;
+ int greenSize = 0;
+ int blueSize = 0;
+ int alphaSize = 0;
+ int depthSize = 0;
+ int stencilSize = 0;
+ int sampleBuffers = 0;
+ int sampleCount = 0;
+ int stereo = 0;
+ int srgbCapable = 0;
+
+ glXGetConfig(display, visualInfo, GLX_RED_SIZE, &redSize);
+ glXGetConfig(display, visualInfo, GLX_GREEN_SIZE, &greenSize);
+ glXGetConfig(display, visualInfo, GLX_BLUE_SIZE, &blueSize);
+ glXGetConfig(display, visualInfo, GLX_ALPHA_SIZE, &alphaSize);
+ glXGetConfig(display, visualInfo, GLX_DEPTH_SIZE, &depthSize);
+ glXGetConfig(display, visualInfo, GLX_STENCIL_SIZE, &stencilSize);
+ glXGetConfig(display, visualInfo, GLX_SAMPLE_BUFFERS_ARB, &sampleBuffers);
+ glXGetConfig(display, visualInfo, GLX_STEREO, &stereo);
+ if (flags & QGLX_SUPPORTS_SRGB)
+ glXGetConfig(display, visualInfo, GLX_FRAMEBUFFER_SRGB_CAPABLE_ARB, &srgbCapable);
+
+ format->setRedBufferSize(redSize);
+ format->setGreenBufferSize(greenSize);
+ format->setBlueBufferSize(blueSize);
+ format->setAlphaBufferSize(alphaSize);
+ format->setDepthBufferSize(depthSize);
+ format->setStencilBufferSize(stencilSize);
+ if (sampleBuffers) {
+ glXGetConfig(display, visualInfo, GLX_SAMPLES_ARB, &sampleCount);
+ format->setSamples(sampleCount);
+ }
+ if (srgbCapable)
+ format->setColorSpace(QColorSpace::SRgb);
+ else
+ format->setColorSpace(QColorSpace());
+
+ format->setStereo(stereo);
+}
+
+bool qglx_reduceFormat(QSurfaceFormat *format)
+{
+ Q_ASSERT(format);
+ if (std::max(std::max(format->redBufferSize(), format->greenBufferSize()), format->blueBufferSize()) > 8) {
+ if (format->alphaBufferSize() > 2) {
+ // First try to match 10 10 10 2
+ format->setAlphaBufferSize(2);
+ return true;
+ }
+
+ format->setRedBufferSize(std::min(format->redBufferSize(), 8));
+ format->setGreenBufferSize(std::min(format->greenBufferSize(), 8));
+ format->setBlueBufferSize(std::min(format->blueBufferSize(), 8));
+ return true;
+ }
+
+ if (format->redBufferSize() > 1) {
+ format->setRedBufferSize(1);
+ return true;
+ }
+
+ if (format->greenBufferSize() > 1) {
+ format->setGreenBufferSize(1);
+ return true;
+ }
+
+ if (format->blueBufferSize() > 1) {
+ format->setBlueBufferSize(1);
+ return true;
+ }
+
+ if (format->swapBehavior() != QSurfaceFormat::SingleBuffer){
+ format->setSwapBehavior(QSurfaceFormat::SingleBuffer);
+ return true;
+ }
+
+ if (format->samples() > 1) {
+ format->setSamples(qMin(16, format->samples() / 2));
+ return true;
+ }
+
+ if (format->depthBufferSize() >= 32) {
+ format->setDepthBufferSize(24);
+ return true;
+ }
+
+ if (format->depthBufferSize() > 1) {
+ format->setDepthBufferSize(1);
+ return true;
+ }
+
+ if (format->depthBufferSize() > 0) {
+ format->setDepthBufferSize(0);
+ return true;
+ }
+
+ if (format->hasAlpha()) {
+ format->setAlphaBufferSize(0);
+ return true;
+ }
+
+ if (format->stencilBufferSize() > 1) {
+ format->setStencilBufferSize(1);
+ return true;
+ }
+
+ if (format->stencilBufferSize() > 0) {
+ format->setStencilBufferSize(0);
+ return true;
+ }
+
+ if (format->stereo()) {
+ format->setStereo(false);
+ return true;
+ }
+
+ if (format->colorSpace() == QColorSpace::SRgb) {
+ format->setColorSpace(QColorSpace());
+ return true;
+ }
+
+ return false;
+}
+
+QT_END_NAMESPACE
diff --git a/src/gui/opengl/platform/unix/qglxconvenience_p.h b/src/gui/opengl/platform/unix/qglxconvenience_p.h
new file mode 100644
index 0000000000..c755356c50
--- /dev/null
+++ b/src/gui/opengl/platform/unix/qglxconvenience_p.h
@@ -0,0 +1,57 @@
+// Copyright (C) 2020 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
+
+#ifndef QGLXCONVENIENCE_H
+#define QGLXCONVENIENCE_H
+
+//
+// W A R N I N G
+// -------------
+//
+// This file is not part of the Qt API. It exists purely as an
+// implementation detail. This header file may change from version to
+// version without notice, or even be removed.
+//
+// We mean it.
+//
+
+#include <QtCore/qlist.h>
+#include <QtGui/qsurfaceformat.h>
+#include <QtCore/private/qglobal_p.h>
+
+#include <X11/Xlib.h>
+#include <GL/glx.h>
+
+QT_BEGIN_NAMESPACE
+
+enum QGlxFlags
+{
+ QGLX_SUPPORTS_SRGB = 0x01
+};
+
+Q_GUI_EXPORT QList<int> qglx_buildSpec(const QSurfaceFormat &format,
+ int drawableBit = GLX_WINDOW_BIT,
+ int flags = 0);
+
+Q_GUI_EXPORT XVisualInfo *qglx_findVisualInfo(Display *display, int screen,
+ QSurfaceFormat *format,
+ int drawableBit = GLX_WINDOW_BIT,
+ int flags = 0);
+
+Q_GUI_EXPORT GLXFBConfig qglx_findConfig(Display *display, int screen,
+ QSurfaceFormat format,
+ bool highestPixelFormat = false,
+ int drawableBit = GLX_WINDOW_BIT,
+ int flags = 0);
+
+Q_GUI_EXPORT void qglx_surfaceFormatFromGLXFBConfig(QSurfaceFormat *format, Display *display,
+ GLXFBConfig config, int flags = 0);
+
+Q_GUI_EXPORT void qglx_surfaceFormatFromVisualInfo(QSurfaceFormat *format, Display *display,
+ XVisualInfo *visualInfo, int flags = 0);
+
+Q_GUI_EXPORT bool qglx_reduceFormat(QSurfaceFormat *format);
+
+QT_END_NAMESPACE
+
+#endif // QGLXCONVENIENCE_H
diff --git a/src/gui/opengl/qopengl.cpp b/src/gui/opengl/qopengl.cpp
index adca536797..587975085a 100644
--- a/src/gui/opengl/qopengl.cpp
+++ b/src/gui/opengl/qopengl.cpp
@@ -1,41 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the QtGui module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#include "qopengl.h"
#include "qopengl_p.h"
@@ -56,6 +20,8 @@
QT_BEGIN_NAMESPACE
+using namespace Qt::StringLiterals;
+
#if defined(QT_OPENGL_3)
typedef const GLubyte * (QOPENGLF_APIENTRYP qt_glGetStringi)(GLenum, GLuint);
#endif
@@ -210,10 +176,10 @@ VersionTerm VersionTerm::fromJson(const QJsonValue &v)
if (!v.isObject())
return result;
const QJsonObject o = v.toObject();
- result.number = QVersionNumber::fromString(o.value(QLatin1String("value")).toString());
- const QString opS = o.value(QLatin1String("op")).toString();
+ result.number = QVersionNumber::fromString(o.value("value"_L1).toString());
+ const QString opS = o.value("op"_L1).toString();
for (size_t i = 0; i < sizeof(operators) / sizeof(operators[0]); ++i) {
- if (opS == QLatin1String(operators[i])) {
+ if (opS == QLatin1StringView(operators[i])) {
result.op = static_cast<Operator>(i);
break;
}
@@ -229,29 +195,13 @@ struct OsTypeTerm
static QString hostOs();
static QVersionNumber hostKernelVersion() { return QVersionNumber::fromString(QSysInfo::kernelVersion()); }
static QString hostOsRelease() {
- QString ver;
#ifdef Q_OS_WIN
- const auto osver = QOperatingSystemVersion::current();
-#define Q_WINVER(major, minor) (major << 8 | minor)
- switch (Q_WINVER(osver.majorVersion(), osver.minorVersion())) {
- case Q_WINVER(6, 1):
- ver = QStringLiteral("7");
- break;
- case Q_WINVER(6, 2):
- ver = QStringLiteral("8");
- break;
- case Q_WINVER(6, 3):
- ver = QStringLiteral("8.1");
- break;
- case Q_WINVER(10, 0):
- ver = QStringLiteral("10");
- break;
- default:
- break;
- }
-#undef Q_WINVER
+ if (QOperatingSystemVersion::current() >= QOperatingSystemVersion::Windows11)
+ return u"11"_s;
+ return u"10"_s;
+#else
+ return {};
#endif
- return ver;
}
bool isNull() const { return type.isEmpty(); }
@@ -282,9 +232,9 @@ OsTypeTerm OsTypeTerm::fromJson(const QJsonValue &v)
if (!v.isObject())
return result;
const QJsonObject o = v.toObject();
- result.type = o.value(QLatin1String("type")).toString();
- result.versionTerm = VersionTerm::fromJson(o.value(QLatin1String("version")));
- result.release = o.value(QLatin1String("release")).toArray();
+ result.type = o.value("type"_L1).toString();
+ result.versionTerm = VersionTerm::fromJson(o.value("version"_L1));
+ result.release = o.value("release"_L1).toArray();
return result;
}
@@ -295,7 +245,7 @@ QString OsTypeTerm::hostOs()
return QStringLiteral("win");
#elif defined(Q_OS_LINUX)
return QStringLiteral("linux");
-#elif defined(Q_OS_OSX)
+#elif defined(Q_OS_MACOS)
return QStringLiteral("macosx");
#elif defined(Q_OS_ANDROID)
return QStringLiteral("android");
@@ -308,8 +258,8 @@ QString OsTypeTerm::hostOs()
static QString msgSyntaxWarning(const QJsonObject &object, const QString &what)
{
QString result;
- QTextStream(&result) << "Id " << object.value(QLatin1String("id")).toInt()
- << " (\"" << object.value(QLatin1String("description")).toString()
+ QTextStream(&result) << "Id " << object.value("id"_L1).toInt()
+ << " (\"" << object.value("description"_L1).toString()
<< "\"): " << what;
return result;
}
@@ -323,11 +273,11 @@ static bool matches(const QJsonObject &object,
const QString &osRelease,
const QOpenGLConfig::Gpu &gpu)
{
- const OsTypeTerm os = OsTypeTerm::fromJson(object.value(QLatin1String("os")));
+ const OsTypeTerm os = OsTypeTerm::fromJson(object.value("os"_L1));
if (!os.isNull() && !os.matches(osName, kernelVersion, osRelease))
return false;
- const QJsonValue exceptionsV = object.value(QLatin1String("exceptions"));
+ const QJsonValue exceptionsV = object.value("exceptions"_L1);
if (exceptionsV.isArray()) {
const QJsonArray exceptionsA = exceptionsV.toArray();
for (JsonArrayConstIt it = exceptionsA.constBegin(), cend = exceptionsA.constEnd(); it != cend; ++it) {
@@ -336,20 +286,20 @@ static bool matches(const QJsonObject &object,
}
}
- const QJsonValue vendorV = object.value(QLatin1String("vendor_id"));
+ const QJsonValue vendorV = object.value("vendor_id"_L1);
if (vendorV.isString()) {
if (gpu.vendorId != vendorV.toString().toUInt(nullptr, /* base */ 0))
return false;
} else {
- if (object.contains(QLatin1String("gl_vendor"))) {
- const QByteArray glVendorV = object.value(QLatin1String("gl_vendor")).toString().toUtf8();
+ if (object.contains("gl_vendor"_L1)) {
+ const QByteArray glVendorV = object.value("gl_vendor"_L1).toString().toUtf8();
if (!gpu.glVendor.contains(glVendorV))
return false;
}
}
if (gpu.deviceId) {
- const QJsonValue deviceIdV = object.value(QLatin1String("device_id"));
+ const QJsonValue deviceIdV = object.value("device_id"_L1);
switch (deviceIdV.type()) {
case QJsonValue::Array:
if (!contains(deviceIdV.toArray(), gpu.deviceId))
@@ -360,12 +310,11 @@ static bool matches(const QJsonObject &object,
break;
default:
qWarning().noquote()
- << msgSyntaxWarning(object,
- QLatin1String("Device ID must be of type array."));
+ << msgSyntaxWarning(object, "Device ID must be of type array."_L1);
}
}
if (!gpu.driverVersion.isNull()) {
- const QJsonValue driverVersionV = object.value(QLatin1String("driver_version"));
+ const QJsonValue driverVersionV = object.value("driver_version"_L1);
switch (driverVersionV.type()) {
case QJsonValue::Object:
if (!VersionTerm::fromJson(driverVersionV).matches(gpu.driverVersion))
@@ -376,13 +325,12 @@ static bool matches(const QJsonObject &object,
break;
default:
qWarning().noquote()
- << msgSyntaxWarning(object,
- QLatin1String("Driver version must be of type object."));
+ << msgSyntaxWarning(object, "Driver version must be of type object."_L1);
}
}
if (!gpu.driverDescription.isEmpty()) {
- const QJsonValue driverDescriptionV = object.value(QLatin1String("driver_description"));
+ const QJsonValue driverDescriptionV = object.value("driver_description"_L1);
if (driverDescriptionV.isString()) {
if (!gpu.driverDescription.contains(driverDescriptionV.toString().toUtf8()))
return false;
@@ -402,9 +350,9 @@ static bool readGpuFeatures(const QOpenGLConfig::Gpu &gpu,
{
result->clear();
errorMessage->clear();
- const QJsonValue entriesV = doc.object().value(QLatin1String("entries"));
+ const QJsonValue entriesV = doc.object().value("entries"_L1);
if (!entriesV.isArray()) {
- *errorMessage = QLatin1String("No entries read.");
+ *errorMessage = "No entries read."_L1;
return false;
}
@@ -413,7 +361,7 @@ static bool readGpuFeatures(const QOpenGLConfig::Gpu &gpu,
if (eit->isObject()) {
const QJsonObject object = eit->toObject();
if (matches(object, osName, kernelVersion, osRelease, gpu)) {
- const QJsonValue featuresListV = object.value(QLatin1String("features"));
+ const QJsonValue featuresListV = object.value("features"_L1);
if (featuresListV.isArray()) {
const QJsonArray featuresListA = featuresListV.toArray();
for (JsonArrayConstIt fit = featuresListA.constBegin(), fcend = featuresListA.constEnd(); fit != fcend; ++fit)
@@ -437,7 +385,8 @@ static bool readGpuFeatures(const QOpenGLConfig::Gpu &gpu,
QJsonParseError error;
const QJsonDocument document = QJsonDocument::fromJson(jsonAsciiData, &error);
if (document.isNull()) {
- const int lineNumber = 1 + jsonAsciiData.left(error.offset).count('\n');
+ const qsizetype lineNumber =
+ QByteArrayView(jsonAsciiData).left(error.offset).count('\n') + 1;
QTextStream str(errorMessage);
str << "Failed to parse data: \"" << error.errorString()
<< "\" at line " << lineNumber << " (offset: "
@@ -465,9 +414,9 @@ static bool readGpuFeatures(const QOpenGLConfig::Gpu &gpu,
}
const bool success = readGpuFeatures(gpu, osName, kernelVersion, osRelease, file.readAll(), result, errorMessage);
if (!success) {
- errorMessage->prepend(QLatin1String("Error reading \"")
+ errorMessage->prepend("Error reading \""_L1
+ QDir::toNativeSeparators(fileName)
- + QLatin1String("\": "));
+ + "\": "_L1);
}
return success;
}
diff --git a/src/gui/opengl/qopengl.h b/src/gui/opengl/qopengl.h
index 3a2393ea58..e9a11080ce 100644
--- a/src/gui/opengl/qopengl.h
+++ b/src/gui/opengl/qopengl.h
@@ -1,41 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the QtGui module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#ifndef QOPENGL_H
#define QOPENGL_H
@@ -44,9 +8,19 @@
#ifndef QT_NO_OPENGL
-// Windows always needs this to ensure that APIENTRY gets defined
+// On Windows we need to ensure that APIENTRY and WINGDIAPI are defined before
+// we can include gl.h. But we do not want to include <windows.h> in this public
+// Qt header, as it pollutes the global namespace with macros.
#if defined(Q_OS_WIN)
-# include <QtCore/qt_windows.h>
+# ifndef APIENTRY
+# define APIENTRY __stdcall
+# define Q_UNDEF_APIENTRY
+# endif // APIENTRY
+# ifndef WINGDIAPI
+# define WINGDIAPI __declspec(dllimport)
+# define Q_UNDEF_WINGDIAPI
+# endif // WINGDIAPI
+# define QT_APIENTRY __stdcall
#endif
// Note: Apple is a "controlled platform" for OpenGL ABI so we
@@ -63,9 +37,9 @@
// access to additional functionality the drivers may expose but
// which the system headers do not.
-#if defined(QT_OPENGL_ES_2)
+#if QT_CONFIG(opengles2)
# if defined(Q_OS_IOS) || defined(Q_OS_TVOS)
-# if defined(QT_OPENGL_ES_3)
+# if QT_CONFIG(opengles3)
# include <OpenGLES/ES3/gl.h>
# include <OpenGLES/ES3/glext.h>
# else
@@ -83,7 +57,7 @@ typedef void* GLeglImageOES;
# elif !defined(Q_OS_DARWIN) // "uncontrolled" ES2 platforms
-// In "es2" builds (QT_OPENGL_ES_2) additional defines indicate GLES 3.0 or
+// In "es2" builds (QT_CONFIG(opengles2)) additional defines indicate GLES 3.0 or
// higher is available *at build time*. In this case include the corresponding
// header. These are backwards compatible and it should be safe to include
// headers on top of each other, meaning that applications can include gl2.h
@@ -101,20 +75,20 @@ typedef void* GLeglImageOES;
# define QGL_TEMP_GLEXT_PROTO
# endif
-# if defined(QT_OPENGL_ES_3_2)
+# if QT_CONFIG(opengles32)
# include <GLES3/gl32.h>
-# elif defined(QT_OPENGL_ES_3_1)
+# elif QT_CONFIG(opengles31)
# include <GLES3/gl31.h>
-# elif defined(QT_OPENGL_ES_3)
+# elif QT_CONFIG(opengles3)
# include <GLES3/gl3.h>
# else
# include <GLES2/gl2.h>
-#endif
+# endif
# ifdef QGL_TEMP_GLEXT_PROTO
# undef GL_GLEXT_PROTOTYPES
# undef QGL_TEMP_GLEXT_PROTO
-# endif
+# endif
/*
Some GLES2 implementations (like the one on Harmattan) are missing the
@@ -125,9 +99,9 @@ typedef void* GLeglImageOES;
typedef char GLchar;
# include <QtGui/qopengles2ext.h>
-# endif // Q_OS_MAC
+# endif
#else // non-ES2 platforms
-# if defined(Q_OS_MAC)
+# if defined(Q_OS_MACOS)
# include <OpenGL/gl.h>
# define GL_DO_NOT_WARN_IF_MULTI_GL_VERSION_HEADERS_INCLUDED
# include <OpenGL/gl3.h>
@@ -144,11 +118,11 @@ typedef char GLchar;
# include <GL/gl.h>
# endif
# include <QtGui/qopenglext.h>
-# endif // Q_OS_MAC
-#endif // QT_OPENGL_ES_2
+# endif
+#endif // !QT_CONFIG(opengles2)
// Desktops can support OpenGL 4.
-#if !defined(QT_OPENGL_ES_2)
+#if !QT_CONFIG(opengles2)
#define QT_OPENGL_3
#define QT_OPENGL_3_2
#define QT_OPENGL_4
@@ -157,20 +131,18 @@ typedef char GLchar;
# endif
#endif
-QT_BEGIN_NAMESPACE
-
// When all else fails we provide sensible fallbacks - this is needed to
// allow compilation on OS X 10.6
-#if !defined(QT_OPENGL_ES_2)
+#if !QT_CONFIG(opengles2)
// OS X 10.6 doesn't define these which are needed below
-// OS X 10.7 and later defien them in gl3.h
-#ifndef APIENTRY
-#define APIENTRY
+// OS X 10.7 and later define them in gl3.h
+#ifndef QT_APIENTRY
+#define QT_APIENTRY
#endif
-#ifndef APIENTRYP
-#define APIENTRYP APIENTRY *
+#ifndef QT_APIENTRYP
+#define QT_APIENTRYP QT_APIENTRY *
#endif
#ifndef GLAPI
#define GLAPI extern
@@ -269,15 +241,15 @@ struct _cl_event;
#endif
#ifndef GL_ARB_debug_output
-typedef void (APIENTRY *GLDEBUGPROCARB)(GLenum source,GLenum type,GLuint id,GLenum severity,GLsizei length,const GLchar *message,const GLvoid *userParam);
+typedef void (QT_APIENTRY *GLDEBUGPROCARB)(GLenum source,GLenum type,GLuint id,GLenum severity,GLsizei length,const GLchar *message,const GLvoid *userParam);
#endif
#ifndef GL_AMD_debug_output
-typedef void (APIENTRY *GLDEBUGPROCAMD)(GLuint id,GLenum category,GLenum severity,GLsizei length,const GLchar *message,GLvoid *userParam);
+typedef void (QT_APIENTRY *GLDEBUGPROCAMD)(GLuint id,GLenum category,GLenum severity,GLsizei length,const GLchar *message,GLvoid *userParam);
#endif
#ifndef GL_KHR_debug
-typedef void (APIENTRY *GLDEBUGPROC)(GLenum source,GLenum type,GLuint id,GLenum severity,GLsizei length,const GLchar *message,const GLvoid *userParam);
+typedef void (QT_APIENTRY *GLDEBUGPROC)(GLenum source,GLenum type,GLuint id,GLenum severity,GLsizei length,const GLchar *message,const GLvoid *userParam);
#endif
#ifndef GL_NV_vdpau_interop
@@ -287,14 +259,15 @@ typedef GLintptr GLvdpauSurfaceNV;
// End of block copied from glext.h
#endif
+QT_BEGIN_NAMESPACE
// Types that aren't defined in all system's gl.h files.
typedef ptrdiff_t qopengl_GLintptr;
typedef ptrdiff_t qopengl_GLsizeiptr;
-#if defined(APIENTRY) && !defined(QOPENGLF_APIENTRY)
-# define QOPENGLF_APIENTRY APIENTRY
+#if defined(QT_APIENTRY) && !defined(QOPENGLF_APIENTRY)
+# define QOPENGLF_APIENTRY QT_APIENTRY
#endif
# ifndef QOPENGLF_APIENTRYP
@@ -308,6 +281,15 @@ typedef ptrdiff_t qopengl_GLsizeiptr;
QT_END_NAMESPACE
+#ifdef Q_UNDEF_WINGDIAPI
+# undef WINGDIAPI
+# undef Q_UNDEF_WINGDIAPI
+#endif
+#ifdef Q_UNDEF_APIENTRY
+# undef APIENTRY
+# undef Q_UNDEF_APIENTRY
+#endif
+
#endif // QT_NO_OPENGL
#endif // QOPENGL_H
diff --git a/src/gui/opengl/qopengl2pexvertexarray.cpp b/src/gui/opengl/qopengl2pexvertexarray.cpp
deleted file mode 100644
index 04781f63c7..0000000000
--- a/src/gui/opengl/qopengl2pexvertexarray.cpp
+++ /dev/null
@@ -1,173 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the QtGui module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "qopengl2pexvertexarray_p.h"
-
-#include <private/qbezier_p.h>
-
-QT_BEGIN_NAMESPACE
-
-void QOpenGL2PEXVertexArray::clear()
-{
- vertexArray.reset();
- vertexArrayStops.reset();
- boundingRectDirty = true;
-}
-
-
-QOpenGLRect QOpenGL2PEXVertexArray::boundingRect() const
-{
- if (boundingRectDirty)
- return QOpenGLRect(0.0, 0.0, 0.0, 0.0);
- else
- return QOpenGLRect(minX, minY, maxX, maxY);
-}
-
-void QOpenGL2PEXVertexArray::addClosingLine(int index)
-{
- QPointF point(vertexArray.at(index));
- if (point != QPointF(vertexArray.last()))
- vertexArray.add(point);
-}
-
-void QOpenGL2PEXVertexArray::addCentroid(const QVectorPath &path, int subPathIndex)
-{
- const QPointF *const points = reinterpret_cast<const QPointF *>(path.points());
- const QPainterPath::ElementType *const elements = path.elements();
-
- QPointF sum = points[subPathIndex];
- int count = 1;
-
- for (int i = subPathIndex + 1; i < path.elementCount() && (!elements || elements[i] != QPainterPath::MoveToElement); ++i) {
- sum += points[i];
- ++count;
- }
-
- const QPointF centroid = sum / qreal(count);
- vertexArray.add(centroid);
-}
-
-void QOpenGL2PEXVertexArray::addPath(const QVectorPath &path, GLfloat curveInverseScale, bool outline)
-{
- const QPointF* const points = reinterpret_cast<const QPointF*>(path.points());
- const QPainterPath::ElementType* const elements = path.elements();
-
- if (boundingRectDirty) {
- minX = maxX = points[0].x();
- minY = maxY = points[0].y();
- boundingRectDirty = false;
- }
-
- if (!outline && !path.isConvex())
- addCentroid(path, 0);
-
- int lastMoveTo = vertexArray.size();
- vertexArray.add(points[0]); // The first element is always a moveTo
-
- do {
- if (!elements) {
-// qDebug("QVectorPath has no elements");
- // If the path has a null elements pointer, the elements implicitly
- // start with a moveTo (already added) and continue with lineTos:
- for (int i=1; i<path.elementCount(); ++i)
- lineToArray(points[i].x(), points[i].y());
-
- break;
- }
-// qDebug("QVectorPath has element types");
-
- for (int i=1; i<path.elementCount(); ++i) {
- switch (elements[i]) {
- case QPainterPath::MoveToElement:
- if (!outline)
- addClosingLine(lastMoveTo);
-// qDebug("element[%d] is a MoveToElement", i);
- vertexArrayStops.add(vertexArray.size());
- if (!outline) {
- if (!path.isConvex()) addCentroid(path, i);
- lastMoveTo = vertexArray.size();
- }
- lineToArray(points[i].x(), points[i].y()); // Add the moveTo as a new vertex
- break;
- case QPainterPath::LineToElement:
-// qDebug("element[%d] is a LineToElement", i);
- lineToArray(points[i].x(), points[i].y());
- break;
- case QPainterPath::CurveToElement: {
- QBezier b = QBezier::fromPoints(*(((const QPointF *) points) + i - 1),
- points[i],
- points[i+1],
- points[i+2]);
- QRectF bounds = b.bounds();
- // threshold based on same algorithm as in qtriangulatingstroker.cpp
- int threshold = qMin<float>(64, qMax(bounds.width(), bounds.height()) * 3.14f / (curveInverseScale * 6));
- if (threshold < 3) threshold = 3;
- qreal one_over_threshold_minus_1 = qreal(1) / (threshold - 1);
- for (int t=0; t<threshold; ++t) {
- QPointF pt = b.pointAt(t * one_over_threshold_minus_1);
- lineToArray(pt.x(), pt.y());
- }
- i += 2;
- break; }
- default:
- break;
- }
- }
- } while (0);
-
- if (!outline)
- addClosingLine(lastMoveTo);
- vertexArrayStops.add(vertexArray.size());
-}
-
-void QOpenGL2PEXVertexArray::lineToArray(const GLfloat x, const GLfloat y)
-{
- vertexArray.add(QOpenGLPoint(x, y));
-
- if (x > maxX)
- maxX = x;
- else if (x < minX)
- minX = x;
- if (y > maxY)
- maxY = y;
- else if (y < minY)
- minY = y;
-}
-
-QT_END_NAMESPACE
diff --git a/src/gui/opengl/qopengl2pexvertexarray_p.h b/src/gui/opengl/qopengl2pexvertexarray_p.h
deleted file mode 100644
index 5dc060ff3d..0000000000
--- a/src/gui/opengl/qopengl2pexvertexarray_p.h
+++ /dev/null
@@ -1,168 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the QtGui module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-//
-// W A R N I N G
-// -------------
-//
-// This file is not part of the Qt API. It exists purely as an
-// implementation detail. This header file may change from version to
-// version without notice, or even be removed.
-//
-// We mean it.
-//
-
-#ifndef QOPENGL2PEXVERTEXARRAY_P_H
-#define QOPENGL2PEXVERTEXARRAY_P_H
-
-#include <QtGui/private/qtguiglobal_p.h>
-#include <QRectF>
-
-#include <private/qdatabuffer_p.h>
-#include <private/qvectorpath_p.h>
-#include <private/qopenglcontext_p.h>
-
-QT_BEGIN_NAMESPACE
-
-class QOpenGLPoint
-{
-public:
- QOpenGLPoint(GLfloat new_x, GLfloat new_y) :
- x(new_x), y(new_y) {};
-
- QOpenGLPoint(const QPointF &p) :
- x(p.x()), y(p.y()) {};
-
- QOpenGLPoint(const QPointF* p) :
- x(p->x()), y(p->y()) {};
-
- GLfloat x;
- GLfloat y;
-
- operator QPointF() {return QPointF(x,y);}
- operator QPointF() const {return QPointF(x,y);}
-};
-
-struct QOpenGLRect
-{
- QOpenGLRect(const QRectF &r)
- : left(r.left()), top(r.top()), right(r.right()), bottom(r.bottom()) {}
-
- QOpenGLRect(GLfloat l, GLfloat t, GLfloat r, GLfloat b)
- : left(l), top(t), right(r), bottom(b) {}
-
- GLfloat left;
- GLfloat top;
- GLfloat right;
- GLfloat bottom;
-
- operator QRectF() const {return QRectF(left, top, right-left, bottom-top);}
-};
-
-class QOpenGL2PEXVertexArray
-{
-public:
- QOpenGL2PEXVertexArray() :
- vertexArray(0), vertexArrayStops(0),
- maxX(-2e10), maxY(-2e10), minX(2e10), minY(2e10),
- boundingRectDirty(true)
- { }
-
- inline void addRect(const QRectF &rect)
- {
- qreal top = rect.top();
- qreal left = rect.left();
- qreal bottom = rect.bottom();
- qreal right = rect.right();
-
- vertexArray << QOpenGLPoint(left, top)
- << QOpenGLPoint(right, top)
- << QOpenGLPoint(right, bottom)
- << QOpenGLPoint(right, bottom)
- << QOpenGLPoint(left, bottom)
- << QOpenGLPoint(left, top);
- }
-
- inline void addQuad(const QRectF &rect)
- {
- qreal top = rect.top();
- qreal left = rect.left();
- qreal bottom = rect.bottom();
- qreal right = rect.right();
-
- vertexArray << QOpenGLPoint(left, top)
- << QOpenGLPoint(right, top)
- << QOpenGLPoint(left, bottom)
- << QOpenGLPoint(right, bottom);
-
- }
-
- inline void addVertex(const GLfloat x, const GLfloat y)
- {
- vertexArray.add(QOpenGLPoint(x, y));
- }
-
- void addPath(const QVectorPath &path, GLfloat curveInverseScale, bool outline = true);
- void clear();
-
- QOpenGLPoint* data() {return vertexArray.data();}
- int *stops() const { return vertexArrayStops.data(); }
- int stopCount() const { return vertexArrayStops.size(); }
- QOpenGLRect boundingRect() const;
-
- int vertexCount() const { return vertexArray.size(); }
-
- void lineToArray(const GLfloat x, const GLfloat y);
-
-private:
- QDataBuffer<QOpenGLPoint> vertexArray;
- QDataBuffer<int> vertexArrayStops;
-
- GLfloat maxX;
- GLfloat maxY;
- GLfloat minX;
- GLfloat minY;
- bool boundingRectDirty;
- void addClosingLine(int index);
- void addCentroid(const QVectorPath &path, int subPathIndex);
-};
-
-QT_END_NAMESPACE
-
-#endif
diff --git a/src/gui/opengl/qopengl_p.h b/src/gui/opengl/qopengl_p.h
index cda062eacf..a3b2be7b49 100644
--- a/src/gui/opengl/qopengl_p.h
+++ b/src/gui/opengl/qopengl_p.h
@@ -1,41 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the QtGui module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#ifndef QOPENGL_P_H
#define QOPENGL_P_H
@@ -133,9 +97,9 @@ inline bool operator!=(const QOpenGLConfig::Gpu &a, const QOpenGLConfig::Gpu &b)
return !a.equals(b);
}
-inline uint qHash(const QOpenGLConfig::Gpu &gpu)
+inline size_t qHash(const QOpenGLConfig::Gpu &gpu, size_t seed = 0)
{
- return qHash(gpu.vendorId) + qHash(gpu.deviceId) + qHash(gpu.driverVersion);
+ return (qHash(gpu.vendorId) + qHash(gpu.deviceId) + qHash(gpu.driverVersion)) ^ seed;
}
QT_END_NAMESPACE
diff --git a/src/gui/opengl/qopenglbuffer.cpp b/src/gui/opengl/qopenglbuffer.cpp
deleted file mode 100644
index 5387cc06e3..0000000000
--- a/src/gui/opengl/qopenglbuffer.cpp
+++ /dev/null
@@ -1,618 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the QtGui module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include <QtGui/qopengl.h>
-#include <QtGui/private/qopenglcontext_p.h>
-#include <QtCore/qatomic.h>
-#include "qopenglbuffer.h"
-#include <private/qopenglextensions_p.h>
-
-#ifndef GL_CONTEXT_LOST
-#define GL_CONTEXT_LOST 0x0507
-#endif
-
-QT_BEGIN_NAMESPACE
-
-/*!
- \class QOpenGLBuffer
- \brief The QOpenGLBuffer class provides functions for creating and managing OpenGL buffer objects.
- \since 5.0
- \ingroup painting-3D
- \inmodule QtGui
-
- Buffer objects are created in the OpenGL server so that the
- client application can avoid uploading vertices, indices,
- texture image data, etc every time they are needed.
-
- QOpenGLBuffer objects can be copied around as a reference to the
- underlying OpenGL buffer object:
-
- \snippet code/src_gui_opengl_qopenglbuffer.cpp 0
-
- QOpenGLBuffer performs a shallow copy when objects are copied in this
- manner, but does not implement copy-on-write semantics. The original
- object will be affected whenever the copy is modified.
-*/
-
-/*!
- \enum QOpenGLBuffer::Type
- This enum defines the type of OpenGL buffer object to create with QOpenGLBuffer.
-
- \value VertexBuffer Vertex buffer object for use when specifying
- vertex arrays.
- \value IndexBuffer Index buffer object for use with \c{glDrawElements()}.
- \value PixelPackBuffer Pixel pack buffer object for reading pixel
- data from the OpenGL server (for example, with \c{glReadPixels()}).
- Not supported under OpenGL/ES.
- \value PixelUnpackBuffer Pixel unpack buffer object for writing pixel
- data to the OpenGL server (for example, with \c{glTexImage2D()}).
- Not supported under OpenGL/ES.
-*/
-
-/*!
- \enum QOpenGLBuffer::UsagePattern
- This enum defines the usage pattern of a QOpenGLBuffer object.
-
- \value StreamDraw The data will be set once and used a few times
- for drawing operations. Under OpenGL/ES 1.1 this is identical
- to StaticDraw.
- \value StreamRead The data will be set once and used a few times
- for reading data back from the OpenGL server. Not supported
- under OpenGL/ES.
- \value StreamCopy The data will be set once and used a few times
- for reading data back from the OpenGL server for use in further
- drawing operations. Not supported under OpenGL/ES.
- \value StaticDraw The data will be set once and used many times
- for drawing operations.
- \value StaticRead The data will be set once and used many times
- for reading data back from the OpenGL server. Not supported
- under OpenGL/ES.
- \value StaticCopy The data will be set once and used many times
- for reading data back from the OpenGL server for use in further
- drawing operations. Not supported under OpenGL/ES.
- \value DynamicDraw The data will be modified repeatedly and used
- many times for drawing operations.
- \value DynamicRead The data will be modified repeatedly and used
- many times for reading data back from the OpenGL server.
- Not supported under OpenGL/ES.
- \value DynamicCopy The data will be modified repeatedly and used
- many times for reading data back from the OpenGL server for
- use in further drawing operations. Not supported under OpenGL/ES.
-*/
-
-/*!
- \enum QOpenGLBuffer::Access
- This enum defines the access mode for QOpenGLBuffer::map().
-
- \value ReadOnly The buffer will be mapped for reading only.
- \value WriteOnly The buffer will be mapped for writing only.
- \value ReadWrite The buffer will be mapped for reading and writing.
-*/
-
-/*!
- \enum QOpenGLBuffer::RangeAccessFlag
- This enum defines the access mode bits for QOpenGLBuffer::mapRange().
-
- \value RangeRead The buffer will be mapped for reading.
- \value RangeWrite The buffer will be mapped for writing.
- \value RangeInvalidate Discard the previous contents of the specified range.
- \value RangeInvalidateBuffer Discard the previous contents of the entire buffer.
- \value RangeFlushExplicit Indicates that modifications are to be flushed explicitly via \c glFlushMappedBufferRange.
- \value RangeUnsynchronized Indicates that pending operations should not be synchronized before returning from mapRange().
-*/
-
-class QOpenGLBufferPrivate
-{
-public:
- QOpenGLBufferPrivate(QOpenGLBuffer::Type t)
- : ref(1),
- type(t),
- guard(nullptr),
- usagePattern(QOpenGLBuffer::StaticDraw),
- actualUsagePattern(QOpenGLBuffer::StaticDraw),
- funcs(nullptr)
- {
- }
-
- QAtomicInt ref;
- QOpenGLBuffer::Type type;
- QOpenGLSharedResourceGuard *guard;
- QOpenGLBuffer::UsagePattern usagePattern;
- QOpenGLBuffer::UsagePattern actualUsagePattern;
- QOpenGLExtensions *funcs;
-};
-
-/*!
- Constructs a new buffer object of type QOpenGLBuffer::VertexBuffer.
-
- Note: this constructor just creates the QOpenGLBuffer instance. The actual
- buffer object in the OpenGL server is not created until create() is called.
-
- \sa create()
-*/
-QOpenGLBuffer::QOpenGLBuffer()
- : d_ptr(new QOpenGLBufferPrivate(QOpenGLBuffer::VertexBuffer))
-{
-}
-
-/*!
- Constructs a new buffer object of \a type.
-
- Note: this constructor just creates the QOpenGLBuffer instance. The actual
- buffer object in the OpenGL server is not created until create() is called.
-
- \sa create()
-*/
-QOpenGLBuffer::QOpenGLBuffer(QOpenGLBuffer::Type type)
- : d_ptr(new QOpenGLBufferPrivate(type))
-{
-}
-
-/*!
- Constructs a shallow copy of \a other.
-
- Note: QOpenGLBuffer does not implement copy-on-write semantics,
- so \a other will be affected whenever the copy is modified.
-*/
-QOpenGLBuffer::QOpenGLBuffer(const QOpenGLBuffer &other)
- : d_ptr(other.d_ptr)
-{
- d_ptr->ref.ref();
-}
-
-/*!
- Destroys this buffer object, including the storage being
- used in the OpenGL server.
-*/
-QOpenGLBuffer::~QOpenGLBuffer()
-{
- if (!d_ptr->ref.deref()) {
- destroy();
- delete d_ptr;
- }
-}
-
-/*!
- Assigns a shallow copy of \a other to this object.
-
- Note: QOpenGLBuffer does not implement copy-on-write semantics,
- so \a other will be affected whenever the copy is modified.
-*/
-QOpenGLBuffer &QOpenGLBuffer::operator=(const QOpenGLBuffer &other)
-{
- if (d_ptr != other.d_ptr) {
- other.d_ptr->ref.ref();
- if (!d_ptr->ref.deref()) {
- destroy();
- delete d_ptr;
- }
- d_ptr = other.d_ptr;
- }
- return *this;
-}
-
-/*!
- Returns the type of buffer represented by this object.
-*/
-QOpenGLBuffer::Type QOpenGLBuffer::type() const
-{
- Q_D(const QOpenGLBuffer);
- return d->type;
-}
-
-/*!
- Returns the usage pattern for this buffer object.
- The default value is StaticDraw.
-
- \sa setUsagePattern()
-*/
-QOpenGLBuffer::UsagePattern QOpenGLBuffer::usagePattern() const
-{
- Q_D(const QOpenGLBuffer);
- return d->usagePattern;
-}
-
-/*!
- Sets the usage pattern for this buffer object to \a value.
- This function must be called before allocate() or write().
-
- \sa usagePattern(), allocate(), write()
-*/
-void QOpenGLBuffer::setUsagePattern(QOpenGLBuffer::UsagePattern value)
-{
- Q_D(QOpenGLBuffer);
- d->usagePattern = d->actualUsagePattern = value;
-}
-
-namespace {
- void freeBufferFunc(QOpenGLFunctions *funcs, GLuint id)
- {
- funcs->glDeleteBuffers(1, &id);
- }
-}
-
-/*!
- Creates the buffer object in the OpenGL server. Returns \c true if
- the object was created; false otherwise.
-
- This function must be called with a current QOpenGLContext.
- The buffer will be bound to and can only be used in
- that context (or any other context that is shared with it).
-
- This function will return false if the OpenGL implementation
- does not support buffers, or there is no current QOpenGLContext.
-
- \sa isCreated(), allocate(), write(), destroy()
-*/
-bool QOpenGLBuffer::create()
-{
- Q_D(QOpenGLBuffer);
- if (d->guard && d->guard->id())
- return true;
- QOpenGLContext *ctx = QOpenGLContext::currentContext();
- if (ctx) {
- delete d->funcs;
- d->funcs = new QOpenGLExtensions(ctx);
- GLuint bufferId = 0;
- d->funcs->glGenBuffers(1, &bufferId);
- if (bufferId) {
- if (d->guard)
- d->guard->free();
-
- d->guard = new QOpenGLSharedResourceGuard(ctx, bufferId, freeBufferFunc);
- return true;
- }
- }
- return false;
-}
-
-/*!
- Returns \c true if this buffer has been created; false otherwise.
-
- \sa create(), destroy()
-*/
-bool QOpenGLBuffer::isCreated() const
-{
- Q_D(const QOpenGLBuffer);
- return d->guard && d->guard->id();
-}
-
-/*!
- Destroys this buffer object, including the storage being
- used in the OpenGL server. All references to the buffer will
- become invalid.
-*/
-void QOpenGLBuffer::destroy()
-{
- Q_D(QOpenGLBuffer);
- if (d->guard) {
- d->guard->free();
- d->guard = nullptr;
- }
- delete d->funcs;
- d->funcs = nullptr;
-}
-
-/*!
- Reads the \a count bytes in this buffer starting at \a offset
- into \a data. Returns \c true on success; false if reading from
- the buffer is not supported. Buffer reading is not supported
- under OpenGL/ES.
-
- It is assumed that this buffer has been bound to the current context.
-
- \sa write(), bind()
-*/
-bool QOpenGLBuffer::read(int offset, void *data, int count)
-{
-#if !defined(QT_OPENGL_ES)
- Q_D(QOpenGLBuffer);
- if (!d->funcs->hasOpenGLFeature(QOpenGLFunctions::Buffers) || !d->guard->id())
- return false;
-
- while (true) { // Clear error state.
- GLenum error = d->funcs->glGetError();
- if (error == GL_NO_ERROR)
- break;
- if (error == GL_CONTEXT_LOST)
- return false;
- };
- d->funcs->glGetBufferSubData(d->type, offset, count, data);
- return d->funcs->glGetError() == GL_NO_ERROR;
-#else
- Q_UNUSED(offset);
- Q_UNUSED(data);
- Q_UNUSED(count);
- return false;
-#endif
-}
-
-/*!
- Replaces the \a count bytes of this buffer starting at \a offset
- with the contents of \a data. Any other bytes in the buffer
- will be left unmodified.
-
- It is assumed that create() has been called on this buffer and that
- it has been bound to the current context.
-
- \sa create(), read(), allocate()
-*/
-void QOpenGLBuffer::write(int offset, const void *data, int count)
-{
-#ifndef QT_NO_DEBUG
- if (!isCreated())
- qWarning("QOpenGLBuffer::write(): buffer not created");
-#endif
- Q_D(QOpenGLBuffer);
- if (d->guard && d->guard->id())
- d->funcs->glBufferSubData(d->type, offset, count, data);
-}
-
-/*!
- Allocates \a count bytes of space to the buffer, initialized to
- the contents of \a data. Any previous contents will be removed.
-
- It is assumed that create() has been called on this buffer and that
- it has been bound to the current context.
-
- \sa create(), read(), write()
-*/
-void QOpenGLBuffer::allocate(const void *data, int count)
-{
-#ifndef QT_NO_DEBUG
- if (!isCreated())
- qWarning("QOpenGLBuffer::allocate(): buffer not created");
-#endif
- Q_D(QOpenGLBuffer);
- if (d->guard && d->guard->id())
- d->funcs->glBufferData(d->type, count, data, d->actualUsagePattern);
-}
-
-/*!
- \fn void QOpenGLBuffer::allocate(int count)
- \overload
-
- Allocates \a count bytes of space to the buffer. Any previous
- contents will be removed.
-
- It is assumed that create() has been called on this buffer and that
- it has been bound to the current context.
-
- \sa create(), write()
-*/
-
-/*!
- Binds the buffer associated with this object to the current
- OpenGL context. Returns \c false if binding was not possible, usually because
- type() is not supported on this OpenGL implementation.
-
- The buffer must be bound to the same QOpenGLContext current when create()
- was called, or to another QOpenGLContext that is sharing with it.
- Otherwise, false will be returned from this function.
-
- \sa release(), create()
-*/
-bool QOpenGLBuffer::bind()
-{
-#ifndef QT_NO_DEBUG
- if (!isCreated())
- qWarning("QOpenGLBuffer::bind(): buffer not created");
-#endif
- Q_D(const QOpenGLBuffer);
- GLuint bufferId = d->guard ? d->guard->id() : 0;
- if (bufferId) {
- if (d->guard->group() != QOpenGLContextGroup::currentContextGroup()) {
-#ifndef QT_NO_DEBUG
- qWarning("QOpenGLBuffer::bind: buffer is not valid in the current context");
-#endif
- return false;
- }
- d->funcs->glBindBuffer(d->type, bufferId);
- return true;
- } else {
- return false;
- }
-}
-
-/*!
- Releases the buffer associated with this object from the
- current OpenGL context.
-
- This function must be called with the same QOpenGLContext current
- as when bind() was called on the buffer.
-
- \sa bind()
-*/
-void QOpenGLBuffer::release()
-{
-#ifndef QT_NO_DEBUG
- if (!isCreated())
- qWarning("QOpenGLBuffer::release(): buffer not created");
-#endif
- Q_D(const QOpenGLBuffer);
- if (d->guard && d->guard->id())
- d->funcs->glBindBuffer(d->type, 0);
-}
-
-/*!
- Releases the buffer associated with \a type in the current
- QOpenGLContext.
-
- This function is a direct call to \c{glBindBuffer(type, 0)}
- for use when the caller does not know which QOpenGLBuffer has
- been bound to the context but wants to make sure that it
- is released.
-
- \snippet code/src_gui_opengl_qopenglbuffer.cpp 1
-*/
-void QOpenGLBuffer::release(QOpenGLBuffer::Type type)
-{
- QOpenGLContext *ctx = QOpenGLContext::currentContext();
- if (ctx)
- ctx->functions()->glBindBuffer(GLenum(type), 0);
-}
-
-/*!
- Returns the OpenGL identifier associated with this buffer; zero if
- the buffer has not been created.
-
- \sa isCreated()
-*/
-GLuint QOpenGLBuffer::bufferId() const
-{
- Q_D(const QOpenGLBuffer);
- return d->guard ? d->guard->id() : 0;
-}
-
-/*!
- Returns the size of the data in this buffer, for reading operations.
- Returns -1 if fetching the buffer size is not supported, or the
- buffer has not been created.
-
- It is assumed that this buffer has been bound to the current context.
-
- \sa isCreated(), bind()
-*/
-int QOpenGLBuffer::size() const
-{
- Q_D(const QOpenGLBuffer);
- if (!d->guard || !d->guard->id())
- return -1;
- GLint value = -1;
- d->funcs->glGetBufferParameteriv(d->type, GL_BUFFER_SIZE, &value);
- return value;
-}
-
-/*!
- Maps the contents of this buffer into the application's memory
- space and returns a pointer to it. Returns null if memory
- mapping is not possible. The \a access parameter indicates the
- type of access to be performed.
-
- It is assumed that create() has been called on this buffer and that
- it has been bound to the current context.
-
- \note This function is only supported under OpenGL ES 2.0 or
- earlier if the \c GL_OES_mapbuffer extension is present.
-
- \note On OpenGL ES 3.0 and newer, or, in case if desktop OpenGL,
- if \c GL_ARB_map_buffer_range is supported, this function uses
- \c glMapBufferRange instead of \c glMapBuffer.
-
- \sa unmap(), create(), bind(), mapRange()
-*/
-void *QOpenGLBuffer::map(QOpenGLBuffer::Access access)
-{
- Q_D(QOpenGLBuffer);
-#ifndef QT_NO_DEBUG
- if (!isCreated())
- qWarning("QOpenGLBuffer::map(): buffer not created");
-#endif
- if (!d->guard || !d->guard->id())
- return nullptr;
- if (d->funcs->hasOpenGLExtension(QOpenGLExtensions::MapBufferRange)) {
- QOpenGLBuffer::RangeAccessFlags rangeAccess;
- switch (access) {
- case QOpenGLBuffer::ReadOnly:
- rangeAccess = QOpenGLBuffer::RangeRead;
- break;
- case QOpenGLBuffer::WriteOnly:
- rangeAccess = QOpenGLBuffer::RangeWrite;
- break;
- case QOpenGLBuffer::ReadWrite:
- rangeAccess = QOpenGLBuffer::RangeRead | QOpenGLBuffer::RangeWrite;
- break;
- }
- return d->funcs->glMapBufferRange(d->type, 0, size(), rangeAccess);
- } else {
- return d->funcs->glMapBuffer(d->type, access);
- }
-}
-
-/*!
- Maps the range specified by \a offset and \a count of the contents
- of this buffer into the application's memory space and returns a
- pointer to it. Returns null if memory mapping is not possible.
- The \a access parameter specifies a combination of access flags.
-
- It is assumed that create() has been called on this buffer and that
- it has been bound to the current context.
-
- \note This function is not available on OpenGL ES 2.0 and earlier.
-
- \sa unmap(), create(), bind()
- */
-void *QOpenGLBuffer::mapRange(int offset, int count, QOpenGLBuffer::RangeAccessFlags access)
-{
- Q_D(QOpenGLBuffer);
-#ifndef QT_NO_DEBUG
- if (!isCreated())
- qWarning("QOpenGLBuffer::mapRange(): buffer not created");
-#endif
- if (!d->guard || !d->guard->id())
- return nullptr;
- return d->funcs->glMapBufferRange(d->type, offset, count, access);
-}
-
-/*!
- Unmaps the buffer after it was mapped into the application's
- memory space with a previous call to map(). Returns \c true if
- the unmap succeeded; false otherwise.
-
- It is assumed that this buffer has been bound to the current context,
- and that it was previously mapped with map().
-
- \note This function is only supported under OpenGL ES 2.0 and
- earlier if the \c{GL_OES_mapbuffer} extension is present.
-
- \sa map()
-*/
-bool QOpenGLBuffer::unmap()
-{
- Q_D(QOpenGLBuffer);
-#ifndef QT_NO_DEBUG
- if (!isCreated())
- qWarning("QOpenGLBuffer::unmap(): buffer not created");
-#endif
- if (!d->guard || !d->guard->id())
- return false;
- return d->funcs->glUnmapBuffer(d->type) == GL_TRUE;
-}
-
-QT_END_NAMESPACE
diff --git a/src/gui/opengl/qopenglbuffer.h b/src/gui/opengl/qopenglbuffer.h
deleted file mode 100644
index a810783731..0000000000
--- a/src/gui/opengl/qopenglbuffer.h
+++ /dev/null
@@ -1,145 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the QtGui module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef QOPENGLBUFFER_H
-#define QOPENGLBUFFER_H
-
-#include <QtGui/qtguiglobal.h>
-
-#ifndef QT_NO_OPENGL
-
-#include <QtCore/qscopedpointer.h>
-#include <QtGui/qopengl.h>
-
-QT_BEGIN_NAMESPACE
-
-
-class QOpenGLBufferPrivate;
-
-class Q_GUI_EXPORT QOpenGLBuffer
-{
-public:
- enum Type
- {
- VertexBuffer = 0x8892, // GL_ARRAY_BUFFER
- IndexBuffer = 0x8893, // GL_ELEMENT_ARRAY_BUFFER
- PixelPackBuffer = 0x88EB, // GL_PIXEL_PACK_BUFFER
- PixelUnpackBuffer = 0x88EC // GL_PIXEL_UNPACK_BUFFER
- };
-
- QOpenGLBuffer();
- explicit QOpenGLBuffer(QOpenGLBuffer::Type type);
- QOpenGLBuffer(const QOpenGLBuffer &other);
- ~QOpenGLBuffer();
-
- QOpenGLBuffer &operator=(const QOpenGLBuffer &other);
-
- enum UsagePattern
- {
- StreamDraw = 0x88E0, // GL_STREAM_DRAW
- StreamRead = 0x88E1, // GL_STREAM_READ
- StreamCopy = 0x88E2, // GL_STREAM_COPY
- StaticDraw = 0x88E4, // GL_STATIC_DRAW
- StaticRead = 0x88E5, // GL_STATIC_READ
- StaticCopy = 0x88E6, // GL_STATIC_COPY
- DynamicDraw = 0x88E8, // GL_DYNAMIC_DRAW
- DynamicRead = 0x88E9, // GL_DYNAMIC_READ
- DynamicCopy = 0x88EA // GL_DYNAMIC_COPY
- };
-
- enum Access
- {
- ReadOnly = 0x88B8, // GL_READ_ONLY
- WriteOnly = 0x88B9, // GL_WRITE_ONLY
- ReadWrite = 0x88BA // GL_READ_WRITE
- };
-
- enum RangeAccessFlag
- {
- RangeRead = 0x0001, // GL_MAP_READ_BIT
- RangeWrite = 0x0002, // GL_MAP_WRITE_BIT
- RangeInvalidate = 0x0004, // GL_MAP_INVALIDATE_RANGE_BIT
- RangeInvalidateBuffer = 0x0008, // GL_MAP_INVALIDATE_BUFFER_BIT
- RangeFlushExplicit = 0x0010, // GL_MAP_FLUSH_EXPLICIT_BIT
- RangeUnsynchronized = 0x0020 // GL_MAP_UNSYNCHRONIZED_BIT
- };
- Q_DECLARE_FLAGS(RangeAccessFlags, RangeAccessFlag)
-
- QOpenGLBuffer::Type type() const;
-
- QOpenGLBuffer::UsagePattern usagePattern() const;
- void setUsagePattern(QOpenGLBuffer::UsagePattern value);
-
- bool create();
- bool isCreated() const;
-
- void destroy();
-
- bool bind();
- void release();
-
- static void release(QOpenGLBuffer::Type type);
-
- GLuint bufferId() const;
-
- int size() const;
-
- bool read(int offset, void *data, int count);
- void write(int offset, const void *data, int count);
-
- void allocate(const void *data, int count);
- inline void allocate(int count) { allocate(nullptr, count); }
-
- void *map(QOpenGLBuffer::Access access);
- void *mapRange(int offset, int count, QOpenGLBuffer::RangeAccessFlags access);
- bool unmap();
-
-private:
- QOpenGLBufferPrivate *d_ptr;
-
- Q_DECLARE_PRIVATE(QOpenGLBuffer)
-};
-
-Q_DECLARE_OPERATORS_FOR_FLAGS(QOpenGLBuffer::RangeAccessFlags)
-
-QT_END_NAMESPACE
-
-#endif // QT_NO_OPENGL
-
-#endif
diff --git a/src/gui/opengl/qopenglcustomshaderstage.cpp b/src/gui/opengl/qopenglcustomshaderstage.cpp
deleted file mode 100644
index a95a0a5767..0000000000
--- a/src/gui/opengl/qopenglcustomshaderstage.cpp
+++ /dev/null
@@ -1,137 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the QtGui module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "qopenglcustomshaderstage_p.h"
-#include "qopenglengineshadermanager_p.h"
-#include "qopenglpaintengine_p.h"
-#include <private/qpainter_p.h>
-
-QT_BEGIN_NAMESPACE
-
-class QOpenGLCustomShaderStagePrivate
-{
-public:
- QOpenGLCustomShaderStagePrivate() :
- m_manager(nullptr) {}
-
- QPointer<QOpenGLEngineShaderManager> m_manager;
- QByteArray m_source;
-};
-
-
-
-
-QOpenGLCustomShaderStage::QOpenGLCustomShaderStage()
- : d_ptr(new QOpenGLCustomShaderStagePrivate)
-{
-}
-
-QOpenGLCustomShaderStage::~QOpenGLCustomShaderStage()
-{
- Q_D(QOpenGLCustomShaderStage);
- if (d->m_manager) {
- d->m_manager->removeCustomStage();
- d->m_manager->sharedShaders->cleanupCustomStage(this);
- }
- delete d_ptr;
-}
-
-void QOpenGLCustomShaderStage::setUniformsDirty()
-{
- Q_D(QOpenGLCustomShaderStage);
- if (d->m_manager)
- d->m_manager->setDirty(); // ### Probably a bit overkill!
-}
-
-bool QOpenGLCustomShaderStage::setOnPainter(QPainter* p)
-{
- Q_D(QOpenGLCustomShaderStage);
- if (p->paintEngine()->type() != QPaintEngine::OpenGL2) {
- qWarning("QOpenGLCustomShaderStage::setOnPainter() - paint engine not OpenGL2");
- return false;
- }
- if (d->m_manager)
- qWarning("Custom shader is already set on a painter");
-
- QOpenGL2PaintEngineEx *engine = static_cast<QOpenGL2PaintEngineEx*>(p->paintEngine());
- d->m_manager = QOpenGL2PaintEngineExPrivate::shaderManagerForEngine(engine);
- Q_ASSERT(d->m_manager);
-
- d->m_manager->setCustomStage(this);
- return true;
-}
-
-void QOpenGLCustomShaderStage::removeFromPainter(QPainter* p)
-{
- Q_D(QOpenGLCustomShaderStage);
- if (p->paintEngine()->type() != QPaintEngine::OpenGL2)
- return;
-
- QOpenGL2PaintEngineEx *engine = static_cast<QOpenGL2PaintEngineEx*>(p->paintEngine());
- d->m_manager = QOpenGL2PaintEngineExPrivate::shaderManagerForEngine(engine);
- Q_ASSERT(d->m_manager);
-
- // Just set the stage to null, don't call removeCustomStage().
- // This should leave the program in a compiled/linked state
- // if the next custom shader stage is this one again.
- d->m_manager->setCustomStage(nullptr);
- d->m_manager = nullptr;
-}
-
-QByteArray QOpenGLCustomShaderStage::source() const
-{
- Q_D(const QOpenGLCustomShaderStage);
- return d->m_source;
-}
-
-// Called by the shader manager if another custom shader is attached or
-// the manager is deleted
-void QOpenGLCustomShaderStage::setInactive()
-{
- Q_D(QOpenGLCustomShaderStage);
- d->m_manager = nullptr;
-}
-
-void QOpenGLCustomShaderStage::setSource(const QByteArray& s)
-{
- Q_D(QOpenGLCustomShaderStage);
- d->m_source = s;
-}
-
-QT_END_NAMESPACE
diff --git a/src/gui/opengl/qopenglcustomshaderstage_p.h b/src/gui/opengl/qopenglcustomshaderstage_p.h
deleted file mode 100644
index ce3e9efd23..0000000000
--- a/src/gui/opengl/qopenglcustomshaderstage_p.h
+++ /dev/null
@@ -1,90 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the QtGui module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef QOPENGL_CUSTOM_SHADER_STAGE_H
-#define QOPENGL_CUSTOM_SHADER_STAGE_H
-
-//
-// W A R N I N G
-// -------------
-//
-// This file is not part of the Qt API. It exists purely as an
-// implementation detail. This header file may change from version to
-// version without notice, or even be removed.
-//
-// We mean it.
-//
-
-#include <QtGui/private/qtguiglobal_p.h>
-#include <QOpenGLShaderProgram>
-
-QT_BEGIN_NAMESPACE
-
-
-class QPainter;
-class QOpenGLCustomShaderStagePrivate;
-class Q_GUI_EXPORT QOpenGLCustomShaderStage
-{
- Q_DECLARE_PRIVATE(QOpenGLCustomShaderStage)
-public:
- QOpenGLCustomShaderStage();
- virtual ~QOpenGLCustomShaderStage();
- virtual void setUniforms(QOpenGLShaderProgram*) {}
-
- void setUniformsDirty();
-
- bool setOnPainter(QPainter*);
- void removeFromPainter(QPainter*);
- QByteArray source() const;
-
- void setInactive();
-protected:
- void setSource(const QByteArray&);
-
-private:
- QOpenGLCustomShaderStagePrivate* d_ptr;
-
- Q_DISABLE_COPY_MOVE(QOpenGLCustomShaderStage)
-};
-
-
-QT_END_NAMESPACE
-
-
-#endif
diff --git a/src/gui/opengl/qopenglengineshadermanager.cpp b/src/gui/opengl/qopenglengineshadermanager.cpp
deleted file mode 100644
index a569975486..0000000000
--- a/src/gui/opengl/qopenglengineshadermanager.cpp
+++ /dev/null
@@ -1,898 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the QtGui module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "qopenglengineshadermanager_p.h"
-#include "qopenglengineshadersource_p.h"
-#include "qopenglpaintengine_p.h"
-#include "qopenglshadercache_p.h"
-
-#include <QtGui/private/qopenglcontext_p.h>
-#include <QtCore/qthreadstorage.h>
-
-#include <algorithm>
-
-#if defined(QT_DEBUG)
-#include <QMetaEnum>
-#endif
-
-// #define QT_GL_SHARED_SHADER_DEBUG
-
-QT_BEGIN_NAMESPACE
-
-class QOpenGLEngineSharedShadersResource : public QOpenGLSharedResource
-{
-public:
- QOpenGLEngineSharedShadersResource(QOpenGLContext *ctx)
- : QOpenGLSharedResource(ctx->shareGroup())
- , m_shaders(new QOpenGLEngineSharedShaders(ctx))
- {
- }
-
- ~QOpenGLEngineSharedShadersResource()
- {
- delete m_shaders;
- }
-
- void invalidateResource() override
- {
- delete m_shaders;
- m_shaders = nullptr;
- }
-
- void freeResource(QOpenGLContext *) override
- {
- }
-
- QOpenGLEngineSharedShaders *shaders() const { return m_shaders; }
-
-private:
- QOpenGLEngineSharedShaders *m_shaders;
-};
-
-class QOpenGLShaderStorage
-{
-public:
- QOpenGLEngineSharedShaders *shadersForThread(QOpenGLContext *context) {
- QOpenGLMultiGroupSharedResource *&shaders = m_storage.localData();
- if (!shaders)
- shaders = new QOpenGLMultiGroupSharedResource;
- QOpenGLEngineSharedShadersResource *resource =
- shaders->value<QOpenGLEngineSharedShadersResource>(context);
- return resource ? resource->shaders() : nullptr;
- }
-
-private:
- QThreadStorage<QOpenGLMultiGroupSharedResource *> m_storage;
-};
-
-Q_GLOBAL_STATIC(QOpenGLShaderStorage, qt_shader_storage);
-
-QOpenGLEngineSharedShaders *QOpenGLEngineSharedShaders::shadersForContext(QOpenGLContext *context)
-{
- return qt_shader_storage()->shadersForThread(context);
-}
-
-const char* QOpenGLEngineSharedShaders::qShaderSnippets[] = {
- 0,0,0,0,0,0,0,0,0,0,
- 0,0,0,0,0,0,0,0,0,0,
- 0,0,0,0,0,0,0,0,0,0,
- 0,0,0,0,0
-};
-
-QOpenGLEngineSharedShaders::QOpenGLEngineSharedShaders(QOpenGLContext* context)
- : blitShaderProg(nullptr)
- , simpleShaderProg(nullptr)
-{
-
-/*
- Rather than having the shader source array statically initialised, it is initialised
- here instead. This is to allow new shader names to be inserted or existing names moved
- around without having to change the order of the glsl strings. It is hoped this will
- make future hard-to-find runtime bugs more obvious and generally give more solid code.
-*/
-
- // Check if the user has requested an OpenGL 3.2 Core Profile or higher
- // and if so use GLSL 1.50 core shaders instead of legacy ones.
- const QSurfaceFormat &fmt = context->format();
- const bool isCoreProfile = fmt.profile() == QSurfaceFormat::CoreProfile && fmt.version() >= qMakePair(3,2);
-
- const char** code = qShaderSnippets; // shortcut
-
- if (isCoreProfile) {
- code[MainVertexShader] = qopenglslMainVertexShader_core;
- code[MainWithTexCoordsVertexShader] = qopenglslMainWithTexCoordsVertexShader_core;
- code[MainWithTexCoordsAndOpacityVertexShader] = qopenglslMainWithTexCoordsAndOpacityVertexShader_core;
-
- code[UntransformedPositionVertexShader] = qopenglslUntransformedPositionVertexShader_core;
- code[PositionOnlyVertexShader] = qopenglslPositionOnlyVertexShader_core;
- code[ComplexGeometryPositionOnlyVertexShader] = qopenglslComplexGeometryPositionOnlyVertexShader_core;
- code[PositionWithPatternBrushVertexShader] = qopenglslPositionWithPatternBrushVertexShader_core;
- code[PositionWithLinearGradientBrushVertexShader] = qopenglslPositionWithLinearGradientBrushVertexShader_core;
- code[PositionWithConicalGradientBrushVertexShader] = qopenglslPositionWithConicalGradientBrushVertexShader_core;
- code[PositionWithRadialGradientBrushVertexShader] = qopenglslPositionWithRadialGradientBrushVertexShader_core;
- code[PositionWithTextureBrushVertexShader] = qopenglslPositionWithTextureBrushVertexShader_core;
- code[AffinePositionWithPatternBrushVertexShader] = qopenglslAffinePositionWithPatternBrushVertexShader_core;
- code[AffinePositionWithLinearGradientBrushVertexShader] = qopenglslAffinePositionWithLinearGradientBrushVertexShader_core;
- code[AffinePositionWithConicalGradientBrushVertexShader] = qopenglslAffinePositionWithConicalGradientBrushVertexShader_core;
- code[AffinePositionWithRadialGradientBrushVertexShader] = qopenglslAffinePositionWithRadialGradientBrushVertexShader_core;
- code[AffinePositionWithTextureBrushVertexShader] = qopenglslAffinePositionWithTextureBrushVertexShader_core;
-
- code[MainFragmentShader_MO] = qopenglslMainFragmentShader_MO_core;
- code[MainFragmentShader_M] = qopenglslMainFragmentShader_M_core;
- code[MainFragmentShader_O] = qopenglslMainFragmentShader_O_core;
- code[MainFragmentShader] = qopenglslMainFragmentShader_core;
- code[MainFragmentShader_ImageArrays] = qopenglslMainFragmentShader_ImageArrays_core;
-
- code[ImageSrcFragmentShader] = qopenglslImageSrcFragmentShader_core;
- code[ImageSrcWithPatternFragmentShader] = qopenglslImageSrcWithPatternFragmentShader_core;
- code[NonPremultipliedImageSrcFragmentShader] = qopenglslNonPremultipliedImageSrcFragmentShader_core;
- code[GrayscaleImageSrcFragmentShader] = qopenglslGrayscaleImageSrcFragmentShader_core;
- code[AlphaImageSrcFragmentShader] = qopenglslAlphaImageSrcFragmentShader_core;
- code[CustomImageSrcFragmentShader] = qopenglslCustomSrcFragmentShader_core; // Calls "customShader", which must be appended
- code[SolidBrushSrcFragmentShader] = qopenglslSolidBrushSrcFragmentShader_core;
-
- code[TextureBrushSrcFragmentShader] = qopenglslTextureBrushSrcFragmentShader_core;
- code[TextureBrushSrcWithPatternFragmentShader] = qopenglslTextureBrushSrcWithPatternFragmentShader_core;
- code[PatternBrushSrcFragmentShader] = qopenglslPatternBrushSrcFragmentShader_core;
- code[LinearGradientBrushSrcFragmentShader] = qopenglslLinearGradientBrushSrcFragmentShader_core;
- code[RadialGradientBrushSrcFragmentShader] = qopenglslRadialGradientBrushSrcFragmentShader_core;
- code[ConicalGradientBrushSrcFragmentShader] = qopenglslConicalGradientBrushSrcFragmentShader_core;
- code[ShockingPinkSrcFragmentShader] = qopenglslShockingPinkSrcFragmentShader_core;
-
- code[NoMaskFragmentShader] = "";
- code[MaskFragmentShader] = qopenglslMaskFragmentShader_core;
- code[RgbMaskFragmentShaderPass1] = qopenglslRgbMaskFragmentShaderPass1_core;
- code[RgbMaskFragmentShaderPass2] = qopenglslRgbMaskFragmentShaderPass2_core;
- code[RgbMaskWithGammaFragmentShader] = ""; //###
- } else {
- code[MainVertexShader] = qopenglslMainVertexShader;
- code[MainWithTexCoordsVertexShader] = qopenglslMainWithTexCoordsVertexShader;
- code[MainWithTexCoordsAndOpacityVertexShader] = qopenglslMainWithTexCoordsAndOpacityVertexShader;
-
- code[UntransformedPositionVertexShader] = qopenglslUntransformedPositionVertexShader;
- code[PositionOnlyVertexShader] = qopenglslPositionOnlyVertexShader;
- code[ComplexGeometryPositionOnlyVertexShader] = qopenglslComplexGeometryPositionOnlyVertexShader;
- code[PositionWithPatternBrushVertexShader] = qopenglslPositionWithPatternBrushVertexShader;
- code[PositionWithLinearGradientBrushVertexShader] = qopenglslPositionWithLinearGradientBrushVertexShader;
- code[PositionWithConicalGradientBrushVertexShader] = qopenglslPositionWithConicalGradientBrushVertexShader;
- code[PositionWithRadialGradientBrushVertexShader] = qopenglslPositionWithRadialGradientBrushVertexShader;
- code[PositionWithTextureBrushVertexShader] = qopenglslPositionWithTextureBrushVertexShader;
- code[AffinePositionWithPatternBrushVertexShader] = qopenglslAffinePositionWithPatternBrushVertexShader;
- code[AffinePositionWithLinearGradientBrushVertexShader] = qopenglslAffinePositionWithLinearGradientBrushVertexShader;
- code[AffinePositionWithConicalGradientBrushVertexShader] = qopenglslAffinePositionWithConicalGradientBrushVertexShader;
- code[AffinePositionWithRadialGradientBrushVertexShader] = qopenglslAffinePositionWithRadialGradientBrushVertexShader;
- code[AffinePositionWithTextureBrushVertexShader] = qopenglslAffinePositionWithTextureBrushVertexShader;
-
- code[MainFragmentShader_MO] = qopenglslMainFragmentShader_MO;
- code[MainFragmentShader_M] = qopenglslMainFragmentShader_M;
- code[MainFragmentShader_O] = qopenglslMainFragmentShader_O;
- code[MainFragmentShader] = qopenglslMainFragmentShader;
- code[MainFragmentShader_ImageArrays] = qopenglslMainFragmentShader_ImageArrays;
-
- code[ImageSrcFragmentShader] = qopenglslImageSrcFragmentShader;
- code[ImageSrcWithPatternFragmentShader] = qopenglslImageSrcWithPatternFragmentShader;
- code[NonPremultipliedImageSrcFragmentShader] = qopenglslNonPremultipliedImageSrcFragmentShader;
- code[GrayscaleImageSrcFragmentShader] = qopenglslGrayscaleImageSrcFragmentShader;
- code[AlphaImageSrcFragmentShader] = qopenglslAlphaImageSrcFragmentShader;
- code[CustomImageSrcFragmentShader] = qopenglslCustomSrcFragmentShader; // Calls "customShader", which must be appended
- code[SolidBrushSrcFragmentShader] = qopenglslSolidBrushSrcFragmentShader;
- code[TextureBrushSrcFragmentShader] = qopenglslTextureBrushSrcFragmentShader;
- code[TextureBrushSrcWithPatternFragmentShader] = qopenglslTextureBrushSrcWithPatternFragmentShader;
- code[PatternBrushSrcFragmentShader] = qopenglslPatternBrushSrcFragmentShader;
- code[LinearGradientBrushSrcFragmentShader] = qopenglslLinearGradientBrushSrcFragmentShader;
- code[RadialGradientBrushSrcFragmentShader] = qopenglslRadialGradientBrushSrcFragmentShader;
- code[ConicalGradientBrushSrcFragmentShader] = qopenglslConicalGradientBrushSrcFragmentShader;
- code[ShockingPinkSrcFragmentShader] = qopenglslShockingPinkSrcFragmentShader;
-
- code[NoMaskFragmentShader] = "";
- code[MaskFragmentShader] = qopenglslMaskFragmentShader;
- code[RgbMaskFragmentShaderPass1] = qopenglslRgbMaskFragmentShaderPass1;
- code[RgbMaskFragmentShaderPass2] = qopenglslRgbMaskFragmentShaderPass2;
- code[RgbMaskWithGammaFragmentShader] = ""; //###
- }
-
- // The composition shaders are just layout qualifiers and the same
- // for all profiles that support them.
- code[NoCompositionModeFragmentShader] = "";
- code[MultiplyCompositionModeFragmentShader] = qopenglslMultiplyCompositionModeFragmentShader;
- code[ScreenCompositionModeFragmentShader] = qopenglslScreenCompositionModeFragmentShader;
- code[OverlayCompositionModeFragmentShader] = qopenglslOverlayCompositionModeFragmentShader;
- code[DarkenCompositionModeFragmentShader] = qopenglslDarkenCompositionModeFragmentShader;
- code[LightenCompositionModeFragmentShader] = qopenglslLightenCompositionModeFragmentShader;
- code[ColorDodgeCompositionModeFragmentShader] = qopenglslColorDodgeCompositionModeFragmentShader;
- code[ColorBurnCompositionModeFragmentShader] = qopenglslColorBurnCompositionModeFragmentShader;
- code[HardLightCompositionModeFragmentShader] = qopenglslHardLightCompositionModeFragmentShader;
- code[SoftLightCompositionModeFragmentShader] = qopenglslSoftLightCompositionModeFragmentShader;
- code[DifferenceCompositionModeFragmentShader] = qopenglslDifferenceCompositionModeFragmentShader;
- code[ExclusionCompositionModeFragmentShader] = qopenglslExclusionCompositionModeFragmentShader;
-
-#if defined(QT_DEBUG)
- // Check that all the elements have been filled:
- for (int i = 0; i < TotalSnippetCount; ++i) {
- if (Q_UNLIKELY(!qShaderSnippets[i])) {
- qFatal("Shader snippet for %s (#%d) is missing!",
- snippetNameStr(SnippetName(i)).constData(), i);
- }
- }
-#endif
-
- QByteArray vertexSource;
- QByteArray fragSource;
-
- // Compile up the simple shader:
-#ifdef Q_OS_WASM
- vertexSource.append(qShaderSnippets[PositionOnlyVertexShader]);
- vertexSource.append(qShaderSnippets[MainVertexShader]);
-#else
- vertexSource.append(qShaderSnippets[MainVertexShader]);
- vertexSource.append(qShaderSnippets[PositionOnlyVertexShader]);
-#endif
- fragSource.append(qShaderSnippets[MainFragmentShader]);
- fragSource.append(qShaderSnippets[ShockingPinkSrcFragmentShader]);
-
- simpleShaderProg = new QOpenGLShaderProgram;
-
- CachedShader simpleShaderCache(fragSource, vertexSource);
-
- bool inCache = simpleShaderCache.load(simpleShaderProg, context);
-
- if (!inCache) {
- if (!simpleShaderProg->addCacheableShaderFromSourceCode(QOpenGLShader::Vertex, vertexSource))
- qWarning("Vertex shader for simpleShaderProg (MainVertexShader & PositionOnlyVertexShader) failed to compile");
- if (!simpleShaderProg->addCacheableShaderFromSourceCode(QOpenGLShader::Fragment, fragSource))
- qWarning("Fragment shader for simpleShaderProg (MainFragmentShader & ShockingPinkSrcFragmentShader) failed to compile");
-
- simpleShaderProg->bindAttributeLocation("vertexCoordsArray", QT_VERTEX_COORDS_ATTR);
- simpleShaderProg->bindAttributeLocation("pmvMatrix1", QT_PMV_MATRIX_1_ATTR);
- simpleShaderProg->bindAttributeLocation("pmvMatrix2", QT_PMV_MATRIX_2_ATTR);
- simpleShaderProg->bindAttributeLocation("pmvMatrix3", QT_PMV_MATRIX_3_ATTR);
- }
-
- simpleShaderProg->link();
-
- if (Q_UNLIKELY(!simpleShaderProg->isLinked())) {
- qCritical("Errors linking simple shader: %s", qPrintable(simpleShaderProg->log()));
- } else {
- if (!inCache)
- simpleShaderCache.store(simpleShaderProg, context);
- }
-
- // Compile the blit shader:
- vertexSource.clear();
- vertexSource.append(qShaderSnippets[MainWithTexCoordsVertexShader]);
- vertexSource.append(qShaderSnippets[UntransformedPositionVertexShader]);
-
- fragSource.clear();
- fragSource.append(qShaderSnippets[MainFragmentShader]);
- fragSource.append(qShaderSnippets[ImageSrcFragmentShader]);
-
- blitShaderProg = new QOpenGLShaderProgram;
-
- CachedShader blitShaderCache(fragSource, vertexSource);
-
- inCache = blitShaderCache.load(blitShaderProg, context);
-
- if (!inCache) {
- if (!blitShaderProg->addCacheableShaderFromSourceCode(QOpenGLShader::Vertex, vertexSource))
- qWarning("Vertex shader for blitShaderProg (MainWithTexCoordsVertexShader & UntransformedPositionVertexShader) failed to compile");
- if (!blitShaderProg->addCacheableShaderFromSourceCode(QOpenGLShader::Fragment, fragSource))
- qWarning("Fragment shader for blitShaderProg (MainFragmentShader & ImageSrcFragmentShader) failed to compile");
-
- blitShaderProg->bindAttributeLocation("textureCoordArray", QT_TEXTURE_COORDS_ATTR);
- blitShaderProg->bindAttributeLocation("vertexCoordsArray", QT_VERTEX_COORDS_ATTR);
- }
-
- blitShaderProg->link();
- if (Q_UNLIKELY(!blitShaderProg->isLinked())) {
- qCritical("Errors linking blit shader: %s", qPrintable(blitShaderProg->log()));
- } else {
- if (!inCache)
- blitShaderCache.store(blitShaderProg, context);
- }
-
-#ifdef QT_GL_SHARED_SHADER_DEBUG
- qDebug(" -> QOpenGLEngineSharedShaders() %p for thread %p.", this, QThread::currentThread());
-#endif
-}
-
-QOpenGLEngineSharedShaders::~QOpenGLEngineSharedShaders()
-{
-#ifdef QT_GL_SHARED_SHADER_DEBUG
- qDebug(" -> ~QOpenGLEngineSharedShaders() %p for thread %p.", this, QThread::currentThread());
-#endif
- qDeleteAll(cachedPrograms);
- cachedPrograms.clear();
-
- if (blitShaderProg) {
- delete blitShaderProg;
- blitShaderProg = nullptr;
- }
-
- if (simpleShaderProg) {
- delete simpleShaderProg;
- simpleShaderProg = nullptr;
- }
-}
-
-#if defined (QT_DEBUG)
-QByteArray QOpenGLEngineSharedShaders::snippetNameStr(SnippetName name)
-{
- QMetaEnum m = staticMetaObject.enumerator(staticMetaObject.indexOfEnumerator("SnippetName"));
- return QByteArray(m.valueToKey(name));
-}
-#endif
-
-// The address returned here will only be valid until next time this function is called.
-// The program is return bound.
-QOpenGLEngineShaderProg *QOpenGLEngineSharedShaders::findProgramInCache(const QOpenGLEngineShaderProg &prog)
-{
- for (int i = 0; i < cachedPrograms.size(); ++i) {
- QOpenGLEngineShaderProg *cachedProg = cachedPrograms[i];
- if (*cachedProg == prog) {
- // Move the program to the top of the list as a poor-man's cache algo
- cachedPrograms.move(i, 0);
- cachedProg->program->bind();
- return cachedProg;
- }
- }
-
- QScopedPointer<QOpenGLEngineShaderProg> newProg;
-
- do {
- QByteArray fragSource;
- // Insert the custom stage before the srcPixel shader to work around an ATI driver bug
- // where you cannot forward declare a function that takes a sampler as argument.
- if (prog.srcPixelFragShader == CustomImageSrcFragmentShader)
- fragSource.append(prog.customStageSource);
- fragSource.append(qShaderSnippets[prog.mainFragShader]);
- fragSource.append(qShaderSnippets[prog.srcPixelFragShader]);
- if (prog.compositionFragShader)
- fragSource.append(qShaderSnippets[prog.compositionFragShader]);
- if (prog.maskFragShader)
- fragSource.append(qShaderSnippets[prog.maskFragShader]);
-
- QByteArray vertexSource;
-#ifdef Q_OS_WASM
- vertexSource.append(qShaderSnippets[prog.positionVertexShader]);
- vertexSource.append(qShaderSnippets[prog.mainVertexShader]);
-#else
- vertexSource.append(qShaderSnippets[prog.mainVertexShader]);
- vertexSource.append(qShaderSnippets[prog.positionVertexShader]);
-#endif
- QScopedPointer<QOpenGLShaderProgram> shaderProgram(new QOpenGLShaderProgram);
-
- CachedShader shaderCache(fragSource, vertexSource);
- bool inCache = shaderCache.load(shaderProgram.data(), QOpenGLContext::currentContext());
-
- if (!inCache) {
- if (!shaderProgram->addCacheableShaderFromSourceCode(QOpenGLShader::Vertex, vertexSource)) {
- QByteArray description;
-#if defined(QT_DEBUG)
- description.append("Vertex shader: main=");
- description.append(snippetNameStr(prog.mainVertexShader));
- description.append(", position=");
- description.append(snippetNameStr(prog.positionVertexShader));
-#endif
- qWarning("Warning: \"%s\" failed to compile!", description.constData());
- break;
- }
- if (!shaderProgram->addCacheableShaderFromSourceCode(QOpenGLShader::Fragment, fragSource)) {
- QByteArray description;
-#if defined(QT_DEBUG)
- description.append("Fragment shader: main=");
- description.append(snippetNameStr(prog.mainFragShader));
- description.append(", srcPixel=");
- description.append(snippetNameStr(prog.srcPixelFragShader));
- if (prog.compositionFragShader) {
- description.append(", composition=");
- description.append(snippetNameStr(prog.compositionFragShader));
- }
- if (prog.maskFragShader) {
- description.append(", mask=");
- description.append(snippetNameStr(prog.maskFragShader));
- }
-#endif
- qWarning("Warning: \"%s\" failed to compile!", description.constData());
- break;
- }
-
- // We have to bind the vertex attribute names before the program is linked:
- shaderProgram->bindAttributeLocation("vertexCoordsArray", QT_VERTEX_COORDS_ATTR);
- if (prog.useTextureCoords)
- shaderProgram->bindAttributeLocation("textureCoordArray", QT_TEXTURE_COORDS_ATTR);
- if (prog.useOpacityAttribute)
- shaderProgram->bindAttributeLocation("opacityArray", QT_OPACITY_ATTR);
- if (prog.usePmvMatrixAttribute) {
- shaderProgram->bindAttributeLocation("pmvMatrix1", QT_PMV_MATRIX_1_ATTR);
- shaderProgram->bindAttributeLocation("pmvMatrix2", QT_PMV_MATRIX_2_ATTR);
- shaderProgram->bindAttributeLocation("pmvMatrix3", QT_PMV_MATRIX_3_ATTR);
- }
- }
-
- newProg.reset(new QOpenGLEngineShaderProg(prog));
- newProg->program = shaderProgram.take();
-
- newProg->program->link();
- if (newProg->program->isLinked()) {
- if (!inCache)
- shaderCache.store(newProg->program, QOpenGLContext::currentContext());
- } else {
- QString error;
- error = QLatin1String("Shader program failed to link")
- + QLatin1String(" Error Log:\n")
- + QLatin1String(" ") + newProg->program->log();
- qWarning() << error;
- break;
- }
-
- newProg->program->bind();
-
- if (newProg->maskFragShader != QOpenGLEngineSharedShaders::NoMaskFragmentShader) {
- GLuint location = newProg->program->uniformLocation("maskTexture");
- newProg->program->setUniformValue(location, QT_MASK_TEXTURE_UNIT);
- }
-
- if (cachedPrograms.count() > 30) {
- // The cache is full, so delete the last 5 programs in the list.
- // These programs will be least used, as a program us bumped to
- // the top of the list when it's used.
- for (int i = 0; i < 5; ++i) {
- delete cachedPrograms.last();
- cachedPrograms.removeLast();
- }
- }
-
- cachedPrograms.insert(0, newProg.data());
- } while (false);
-
- return newProg.take();
-}
-
-void QOpenGLEngineSharedShaders::cleanupCustomStage(QOpenGLCustomShaderStage* stage)
-{
- auto hasStageAsCustomShaderSouce = [stage](QOpenGLEngineShaderProg *cachedProg) -> bool {
- if (cachedProg->customStageSource == stage->source()) {
- delete cachedProg;
- return true;
- }
- return false;
- };
- cachedPrograms.erase(std::remove_if(cachedPrograms.begin(), cachedPrograms.end(),
- hasStageAsCustomShaderSouce),
- cachedPrograms.end());
-}
-
-
-QOpenGLEngineShaderManager::QOpenGLEngineShaderManager(QOpenGLContext* context)
- : ctx(context),
- shaderProgNeedsChanging(true),
- complexGeometry(false),
- srcPixelType(Qt::NoBrush),
- opacityMode(NoOpacity),
- maskType(NoMask),
- compositionMode(QPainter::CompositionMode_SourceOver),
- customSrcStage(nullptr),
- currentShaderProg(nullptr)
-{
- sharedShaders = QOpenGLEngineSharedShaders::shadersForContext(context);
-}
-
-QOpenGLEngineShaderManager::~QOpenGLEngineShaderManager()
-{
- //###
- removeCustomStage();
-}
-
-GLuint QOpenGLEngineShaderManager::getUniformLocation(Uniform id)
-{
- if (!currentShaderProg)
- return 0;
-
- QVector<uint> &uniformLocations = currentShaderProg->uniformLocations;
- if (uniformLocations.isEmpty())
- uniformLocations.fill(GLuint(-1), NumUniforms);
-
- const char uniformNames[][26] = {
- "imageTexture",
- "patternColor",
- "globalOpacity",
- "depth",
- "maskTexture",
- "fragmentColor",
- "linearData",
- "angle",
- "halfViewportSize",
- "fmp",
- "fmp2_m_radius2",
- "inverse_2_fmp2_m_radius2",
- "sqrfr",
- "bradius",
- "invertedTextureSize",
- "brushTransform",
- "brushTexture",
- "matrix"
- };
-
- if (uniformLocations.at(id) == GLuint(-1))
- uniformLocations[id] = currentShaderProg->program->uniformLocation(uniformNames[id]);
-
- return uniformLocations.at(id);
-}
-
-
-void QOpenGLEngineShaderManager::optimiseForBrushTransform(QTransform::TransformationType transformType)
-{
- Q_UNUSED(transformType); // Currently ignored
-}
-
-void QOpenGLEngineShaderManager::setDirty()
-{
- shaderProgNeedsChanging = true;
-}
-
-void QOpenGLEngineShaderManager::setSrcPixelType(Qt::BrushStyle style)
-{
- Q_ASSERT(style != Qt::NoBrush);
- if (srcPixelType == PixelSrcType(style))
- return;
-
- srcPixelType = style;
- shaderProgNeedsChanging = true; //###
-}
-
-void QOpenGLEngineShaderManager::setSrcPixelType(PixelSrcType type)
-{
- if (srcPixelType == type)
- return;
-
- srcPixelType = type;
- shaderProgNeedsChanging = true; //###
-}
-
-void QOpenGLEngineShaderManager::setOpacityMode(OpacityMode mode)
-{
- if (opacityMode == mode)
- return;
-
- opacityMode = mode;
- shaderProgNeedsChanging = true; //###
-}
-
-void QOpenGLEngineShaderManager::setMaskType(MaskType type)
-{
- if (maskType == type)
- return;
-
- maskType = type;
- shaderProgNeedsChanging = true; //###
-}
-
-void QOpenGLEngineShaderManager::setCompositionMode(QPainter::CompositionMode mode)
-{
- if (compositionMode == mode)
- return;
-
- bool wasAdvanced = compositionMode > QPainter::CompositionMode_Plus;
- bool isAdvanced = mode > QPainter::CompositionMode_Plus;
-
- compositionMode = mode;
- shaderProgNeedsChanging = shaderProgNeedsChanging || wasAdvanced || isAdvanced;
-}
-
-void QOpenGLEngineShaderManager::setCustomStage(QOpenGLCustomShaderStage* stage)
-{
- if (customSrcStage)
- removeCustomStage();
- customSrcStage = stage;
- shaderProgNeedsChanging = true;
-}
-
-void QOpenGLEngineShaderManager::removeCustomStage()
-{
- if (customSrcStage)
- customSrcStage->setInactive();
- customSrcStage = nullptr;
- shaderProgNeedsChanging = true;
-}
-
-QOpenGLShaderProgram* QOpenGLEngineShaderManager::currentProgram()
-{
- if (currentShaderProg)
- return currentShaderProg->program;
- else
- return sharedShaders->simpleProgram();
-}
-
-void QOpenGLEngineShaderManager::useSimpleProgram()
-{
- sharedShaders->simpleProgram()->bind();
- QOpenGLContextPrivate* ctx_d = ctx->d_func();
- Q_UNUSED(ctx_d);
-
- QOpenGL2PaintEngineEx *active_engine = static_cast<QOpenGL2PaintEngineEx *>(ctx_d->active_engine);
-
- active_engine->d_func()->setVertexAttribArrayEnabled(QT_VERTEX_COORDS_ATTR, true);
- active_engine->d_func()->setVertexAttribArrayEnabled(QT_TEXTURE_COORDS_ATTR, false);
- active_engine->d_func()->setVertexAttribArrayEnabled(QT_OPACITY_ATTR, false);
-
- shaderProgNeedsChanging = true;
-}
-
-void QOpenGLEngineShaderManager::useBlitProgram()
-{
- sharedShaders->blitProgram()->bind();
- QOpenGLContextPrivate* ctx_d = ctx->d_func();
- QOpenGL2PaintEngineEx *active_engine = static_cast<QOpenGL2PaintEngineEx *>(ctx_d->active_engine);
- active_engine->d_func()->setVertexAttribArrayEnabled(QT_VERTEX_COORDS_ATTR, true);
- active_engine->d_func()->setVertexAttribArrayEnabled(QT_TEXTURE_COORDS_ATTR, true);
- active_engine->d_func()->setVertexAttribArrayEnabled(QT_OPACITY_ATTR, false);
- shaderProgNeedsChanging = true;
-}
-
-QOpenGLShaderProgram* QOpenGLEngineShaderManager::simpleProgram()
-{
- return sharedShaders->simpleProgram();
-}
-
-QOpenGLShaderProgram* QOpenGLEngineShaderManager::blitProgram()
-{
- return sharedShaders->blitProgram();
-}
-
-
-
-// Select & use the correct shader program using the current state.
-// Returns \c true if program needed changing.
-bool QOpenGLEngineShaderManager::useCorrectShaderProg()
-{
- if (!shaderProgNeedsChanging)
- return false;
-
- bool useCustomSrc = customSrcStage != nullptr;
- if (useCustomSrc && srcPixelType != QOpenGLEngineShaderManager::ImageSrc && srcPixelType != Qt::TexturePattern) {
- useCustomSrc = false;
- qWarning("QOpenGLEngineShaderManager - Ignoring custom shader stage for non image src");
- }
-
- QOpenGLEngineShaderProg requiredProgram;
-
- bool texCoords = false;
-
- // Choose vertex shader shader position function (which typically also sets
- // varyings) and the source pixel (srcPixel) fragment shader function:
- requiredProgram.positionVertexShader = QOpenGLEngineSharedShaders::InvalidSnippetName;
- requiredProgram.srcPixelFragShader = QOpenGLEngineSharedShaders::InvalidSnippetName;
- bool isAffine = brushTransform.isAffine();
- if ( (srcPixelType >= Qt::Dense1Pattern) && (srcPixelType <= Qt::DiagCrossPattern) ) {
- if (isAffine)
- requiredProgram.positionVertexShader = QOpenGLEngineSharedShaders::AffinePositionWithPatternBrushVertexShader;
- else
- requiredProgram.positionVertexShader = QOpenGLEngineSharedShaders::PositionWithPatternBrushVertexShader;
-
- requiredProgram.srcPixelFragShader = QOpenGLEngineSharedShaders::PatternBrushSrcFragmentShader;
- }
- else switch (srcPixelType) {
- default:
- case Qt::NoBrush:
- qFatal("QOpenGLEngineShaderManager::useCorrectShaderProg() - Qt::NoBrush style is set");
- break;
- case QOpenGLEngineShaderManager::ImageSrc:
- requiredProgram.srcPixelFragShader = QOpenGLEngineSharedShaders::ImageSrcFragmentShader;
- requiredProgram.positionVertexShader = QOpenGLEngineSharedShaders::PositionOnlyVertexShader;
- texCoords = true;
- break;
- case QOpenGLEngineShaderManager::NonPremultipliedImageSrc:
- requiredProgram.srcPixelFragShader = QOpenGLEngineSharedShaders::NonPremultipliedImageSrcFragmentShader;
- requiredProgram.positionVertexShader = QOpenGLEngineSharedShaders::PositionOnlyVertexShader;
- texCoords = true;
- break;
- case QOpenGLEngineShaderManager::GrayscaleImageSrc:
- requiredProgram.srcPixelFragShader = QOpenGLEngineSharedShaders::GrayscaleImageSrcFragmentShader;
- requiredProgram.positionVertexShader = QOpenGLEngineSharedShaders::PositionOnlyVertexShader;
- texCoords = true;
- break;
- case QOpenGLEngineShaderManager::AlphaImageSrc:
- requiredProgram.srcPixelFragShader = QOpenGLEngineSharedShaders::AlphaImageSrcFragmentShader;
- requiredProgram.positionVertexShader = QOpenGLEngineSharedShaders::PositionOnlyVertexShader;
- texCoords = true;
- break;
- case QOpenGLEngineShaderManager::PatternSrc:
- requiredProgram.srcPixelFragShader = QOpenGLEngineSharedShaders::ImageSrcWithPatternFragmentShader;
- requiredProgram.positionVertexShader = QOpenGLEngineSharedShaders::PositionOnlyVertexShader;
- texCoords = true;
- break;
- case QOpenGLEngineShaderManager::TextureSrcWithPattern:
- requiredProgram.srcPixelFragShader = QOpenGLEngineSharedShaders::TextureBrushSrcWithPatternFragmentShader;
- requiredProgram.positionVertexShader = isAffine ? QOpenGLEngineSharedShaders::AffinePositionWithTextureBrushVertexShader
- : QOpenGLEngineSharedShaders::PositionWithTextureBrushVertexShader;
- break;
- case Qt::SolidPattern:
- requiredProgram.srcPixelFragShader = QOpenGLEngineSharedShaders::SolidBrushSrcFragmentShader;
- requiredProgram.positionVertexShader = QOpenGLEngineSharedShaders::PositionOnlyVertexShader;
- break;
- case Qt::LinearGradientPattern:
- requiredProgram.srcPixelFragShader = QOpenGLEngineSharedShaders::LinearGradientBrushSrcFragmentShader;
- requiredProgram.positionVertexShader = isAffine ? QOpenGLEngineSharedShaders::AffinePositionWithLinearGradientBrushVertexShader
- : QOpenGLEngineSharedShaders::PositionWithLinearGradientBrushVertexShader;
- break;
- case Qt::ConicalGradientPattern:
- requiredProgram.srcPixelFragShader = QOpenGLEngineSharedShaders::ConicalGradientBrushSrcFragmentShader;
- requiredProgram.positionVertexShader = isAffine ? QOpenGLEngineSharedShaders::AffinePositionWithConicalGradientBrushVertexShader
- : QOpenGLEngineSharedShaders::PositionWithConicalGradientBrushVertexShader;
- break;
- case Qt::RadialGradientPattern:
- requiredProgram.srcPixelFragShader = QOpenGLEngineSharedShaders::RadialGradientBrushSrcFragmentShader;
- requiredProgram.positionVertexShader = isAffine ? QOpenGLEngineSharedShaders::AffinePositionWithRadialGradientBrushVertexShader
- : QOpenGLEngineSharedShaders::PositionWithRadialGradientBrushVertexShader;
- break;
- case Qt::TexturePattern:
- requiredProgram.srcPixelFragShader = QOpenGLEngineSharedShaders::TextureBrushSrcFragmentShader;
- requiredProgram.positionVertexShader = isAffine ? QOpenGLEngineSharedShaders::AffinePositionWithTextureBrushVertexShader
- : QOpenGLEngineSharedShaders::PositionWithTextureBrushVertexShader;
- break;
- };
-
- if (useCustomSrc) {
- requiredProgram.srcPixelFragShader = QOpenGLEngineSharedShaders::CustomImageSrcFragmentShader;
- requiredProgram.customStageSource = customSrcStage->source();
- }
-
- const bool hasCompose = compositionMode > QPainter::CompositionMode_Plus;
- const bool hasMask = maskType != QOpenGLEngineShaderManager::NoMask;
-
- // Choose fragment shader main function:
- if (opacityMode == AttributeOpacity) {
- Q_ASSERT(!hasCompose && !hasMask);
- requiredProgram.mainFragShader = QOpenGLEngineSharedShaders::MainFragmentShader_ImageArrays;
- } else {
- bool useGlobalOpacity = (opacityMode == UniformOpacity);
- if (hasMask && useGlobalOpacity)
- requiredProgram.mainFragShader = QOpenGLEngineSharedShaders::MainFragmentShader_MO;
- if (hasMask && !useGlobalOpacity)
- requiredProgram.mainFragShader = QOpenGLEngineSharedShaders::MainFragmentShader_M;
- if (!hasMask && useGlobalOpacity)
- requiredProgram.mainFragShader = QOpenGLEngineSharedShaders::MainFragmentShader_O;
- if (!hasMask && !useGlobalOpacity)
- requiredProgram.mainFragShader = QOpenGLEngineSharedShaders::MainFragmentShader;
- }
-
- if (hasMask) {
- if (maskType == PixelMask) {
- requiredProgram.maskFragShader = QOpenGLEngineSharedShaders::MaskFragmentShader;
- texCoords = true;
- } else if (maskType == SubPixelMaskPass1) {
- requiredProgram.maskFragShader = QOpenGLEngineSharedShaders::RgbMaskFragmentShaderPass1;
- texCoords = true;
- } else if (maskType == SubPixelMaskPass2) {
- requiredProgram.maskFragShader = QOpenGLEngineSharedShaders::RgbMaskFragmentShaderPass2;
- texCoords = true;
- } else if (maskType == SubPixelWithGammaMask) {
- requiredProgram.maskFragShader = QOpenGLEngineSharedShaders::RgbMaskWithGammaFragmentShader;
- texCoords = true;
- } else {
- qCritical("QOpenGLEngineShaderManager::useCorrectShaderProg() - Unknown mask type");
- }
- } else {
- requiredProgram.maskFragShader = QOpenGLEngineSharedShaders::NoMaskFragmentShader;
- }
-
- if (hasCompose) {
- switch (compositionMode) {
- case QPainter::CompositionMode_Multiply:
- requiredProgram.compositionFragShader = QOpenGLEngineSharedShaders::MultiplyCompositionModeFragmentShader;
- break;
- case QPainter::CompositionMode_Screen:
- requiredProgram.compositionFragShader = QOpenGLEngineSharedShaders::ScreenCompositionModeFragmentShader;
- break;
- case QPainter::CompositionMode_Overlay:
- requiredProgram.compositionFragShader = QOpenGLEngineSharedShaders::OverlayCompositionModeFragmentShader;
- break;
- case QPainter::CompositionMode_Darken:
- requiredProgram.compositionFragShader = QOpenGLEngineSharedShaders::DarkenCompositionModeFragmentShader;
- break;
- case QPainter::CompositionMode_Lighten:
- requiredProgram.compositionFragShader = QOpenGLEngineSharedShaders::LightenCompositionModeFragmentShader;
- break;
- case QPainter::CompositionMode_ColorDodge:
- requiredProgram.compositionFragShader = QOpenGLEngineSharedShaders::ColorDodgeCompositionModeFragmentShader;
- break;
- case QPainter::CompositionMode_ColorBurn:
- requiredProgram.compositionFragShader = QOpenGLEngineSharedShaders::ColorBurnCompositionModeFragmentShader;
- break;
- case QPainter::CompositionMode_HardLight:
- requiredProgram.compositionFragShader = QOpenGLEngineSharedShaders::HardLightCompositionModeFragmentShader;
- break;
- case QPainter::CompositionMode_SoftLight:
- requiredProgram.compositionFragShader = QOpenGLEngineSharedShaders::SoftLightCompositionModeFragmentShader;
- break;
- case QPainter::CompositionMode_Difference:
- requiredProgram.compositionFragShader = QOpenGLEngineSharedShaders::DifferenceCompositionModeFragmentShader;
- break;
- case QPainter::CompositionMode_Exclusion:
- requiredProgram.compositionFragShader = QOpenGLEngineSharedShaders::ExclusionCompositionModeFragmentShader;
- break;
- default:
- qWarning("QOpenGLEngineShaderManager::useCorrectShaderProg() - Unsupported composition mode");
- }
- } else {
- requiredProgram.compositionFragShader = QOpenGLEngineSharedShaders::NoCompositionModeFragmentShader;
- }
-
- // Choose vertex shader main function
- if (opacityMode == AttributeOpacity) {
- Q_ASSERT(texCoords);
- requiredProgram.mainVertexShader = QOpenGLEngineSharedShaders::MainWithTexCoordsAndOpacityVertexShader;
- } else if (texCoords) {
- requiredProgram.mainVertexShader = QOpenGLEngineSharedShaders::MainWithTexCoordsVertexShader;
- } else {
- requiredProgram.mainVertexShader = QOpenGLEngineSharedShaders::MainVertexShader;
- }
- requiredProgram.useTextureCoords = texCoords;
- requiredProgram.useOpacityAttribute = (opacityMode == AttributeOpacity);
- if (complexGeometry && srcPixelType == Qt::SolidPattern) {
- requiredProgram.positionVertexShader = QOpenGLEngineSharedShaders::ComplexGeometryPositionOnlyVertexShader;
- requiredProgram.usePmvMatrixAttribute = false;
- } else {
- requiredProgram.usePmvMatrixAttribute = true;
-
- // Force complexGeometry off, since we currently don't support that mode for
- // non-solid brushes
- complexGeometry = false;
- }
-
- // At this point, requiredProgram is fully populated so try to find the program in the cache
- currentShaderProg = sharedShaders->findProgramInCache(requiredProgram);
-
- if (currentShaderProg && useCustomSrc) {
- customSrcStage->setUniforms(currentShaderProg->program);
- }
-
- // Make sure all the vertex attribute arrays the program uses are enabled (and the ones it
- // doesn't use are disabled)
- QOpenGLContextPrivate* ctx_d = ctx->d_func();
- QOpenGL2PaintEngineEx *active_engine = static_cast<QOpenGL2PaintEngineEx *>(ctx_d->active_engine);
- active_engine->d_func()->setVertexAttribArrayEnabled(QT_VERTEX_COORDS_ATTR, true);
- active_engine->d_func()->setVertexAttribArrayEnabled(QT_TEXTURE_COORDS_ATTR, currentShaderProg && currentShaderProg->useTextureCoords);
- active_engine->d_func()->setVertexAttribArrayEnabled(QT_OPACITY_ATTR, currentShaderProg && currentShaderProg->useOpacityAttribute);
-
- shaderProgNeedsChanging = false;
- return true;
-}
-
-QT_END_NAMESPACE
diff --git a/src/gui/opengl/qopenglengineshadermanager_p.h b/src/gui/opengl/qopenglengineshadermanager_p.h
deleted file mode 100644
index 14c79f5de3..0000000000
--- a/src/gui/opengl/qopenglengineshadermanager_p.h
+++ /dev/null
@@ -1,507 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the QtGui module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-//
-// W A R N I N G
-// -------------
-//
-// This file is not part of the Qt API. It exists purely as an
-// implementation detail. This header file may change from version to
-// version without notice, or even be removed.
-//
-// We mean it.
-//
-
-/*
- VERTEX SHADERS
- ==============
-
- Vertex shaders are specified as multiple (partial) shaders. On desktop,
- this works fine. On ES, QOpenGLShader & QOpenGLShaderProgram will make partial
- shaders work by concatenating the source in each QOpenGLShader and compiling
- it as a single shader. This is abstracted nicely by QOpenGLShaderProgram and
- the GL2 engine doesn't need to worry about it.
-
- Generally, there's two vertex shader objects. The position shaders are
- the ones which set gl_Position. There's also two "main" vertex shaders,
- one which just calls the position shader and another which also passes
- through some texture coordinates from a vertex attribute array to a
- varying. These texture coordinates are used for mask position in text
- rendering and for the source coordinates in drawImage/drawPixmap. There's
- also a "Simple" vertex shader for rendering a solid colour (used to render
- into the stencil buffer where the actual colour value is discarded).
-
- The position shaders for brushes look scary. This is because many of the
- calculations which logically belong in the fragment shader have been moved
- into the vertex shader to improve performance. This is why the position
- calculation is in a separate shader. Not only does it calculate the
- position, but it also calculates some data to be passed to the fragment
- shader as a varying. It is optimal to move as much of the calculation as
- possible into the vertex shader as this is executed less often.
-
- The varyings passed to the fragment shaders are interpolated (which is
- cheap). Unfortunately, GL will apply perspective correction to the
- interpolation calusing errors. To get around this, the vertex shader must
- apply perspective correction itself and set the w-value of gl_Position to
- zero. That way, GL will be tricked into thinking it doesn't need to apply a
- perspective correction and use linear interpolation instead (which is what
- we want). Of course, if the brush transform is affeine, no perspective
- correction is needed and a simpler vertex shader can be used instead.
-
- So there are the following "main" vertex shaders:
- qopenglslMainVertexShader
- qopenglslMainWithTexCoordsVertexShader
-
- And the following position vertex shaders:
- qopenglslPositionOnlyVertexShader
- qopenglslPositionWithTextureBrushVertexShader
- qopenglslPositionWithPatternBrushVertexShader
- qopenglslPositionWithLinearGradientBrushVertexShader
- qopenglslPositionWithRadialGradientBrushVertexShader
- qopenglslPositionWithConicalGradientBrushVertexShader
- qopenglslAffinePositionWithTextureBrushVertexShader
- qopenglslAffinePositionWithPatternBrushVertexShader
- qopenglslAffinePositionWithLinearGradientBrushVertexShader
- qopenglslAffinePositionWithRadialGradientBrushVertexShader
- qopenglslAffinePositionWithConicalGradientBrushVertexShader
-
- Leading to 23 possible vertex shaders
-
-
- FRAGMENT SHADERS
- ================
-
- Fragment shaders are also specified as multiple (partial) shaders. The
- different fragment shaders represent the different stages in Qt's fragment
- pipeline. There are 1-3 stages in this pipeline: First stage is to get the
- fragment's colour value. The next stage is to get the fragment's mask value
- (coverage value for anti-aliasing) and the final stage is to blend the
- incoming fragment with the background (for composition modes not supported
- by GL).
-
- Of these, the first stage will always be present. If Qt doesn't need to
- apply anti-aliasing (because it's off or handled by multisampling) then
- the coverage value doesn't need to be applied. (Note: There are two types
- of mask, one for regular anti-aliasing and one for sub-pixel anti-
- aliasing.) If the composition mode is one which GL supports natively then
- the blending stage doesn't need to be applied.
-
- As eash stage can have multiple implementations, they are abstracted as
- GLSL function calls with the following signatures:
-
- Brushes & image drawing are implementations of "qcolorp vec4 srcPixel()":
- qopenglslImageSrcFragShader
- qopenglslImageSrcWithPatternFragShader
- qopenglslNonPremultipliedImageSrcFragShader
- qopenglslSolidBrushSrcFragShader
- qopenglslTextureBrushSrcFragShader
- qopenglslTextureBrushWithPatternFragShader
- qopenglslPatternBrushSrcFragShader
- qopenglslLinearGradientBrushSrcFragShader
- qopenglslRadialGradientBrushSrcFragShader
- qopenglslConicalGradientBrushSrcFragShader
- NOTE: It is assumed the colour returned by srcPixel() is pre-multiplied
-
- Masks are implementations of "qcolorp vec4 applyMask(qcolorp vec4 src)":
- qopenglslMaskFragmentShader
- qopenglslRgbMaskFragmentShaderPass1
- qopenglslRgbMaskFragmentShaderPass2
- qopenglslRgbMaskWithGammaFragmentShader
-
- Composition modes are "qcolorp vec4 compose(qcolorp vec4 src)":
- qopenglslColorBurnCompositionModeFragmentShader
- qopenglslColorDodgeCompositionModeFragmentShader
- qopenglslDarkenCompositionModeFragmentShader
- qopenglslDifferenceCompositionModeFragmentShader
- qopenglslExclusionCompositionModeFragmentShader
- qopenglslHardLightCompositionModeFragmentShader
- qopenglslLightenCompositionModeFragmentShader
- qopenglslMultiplyCompositionModeFragmentShader
- qopenglslOverlayCompositionModeFragmentShader
- qopenglslScreenCompositionModeFragmentShader
- qopenglslSoftLightCompositionModeFragmentShader
-
-
- Note: In the future, some GLSL compilers will support an extension allowing
- a new 'color' precision specifier. To support this, qcolorp is used for
- all color components so it can be defined to colorp or lowp depending upon
- the implementation.
-
- So there are differnt frament shader main functions, depending on the
- number & type of pipelines the fragment needs to go through.
-
- The choice of which main() fragment shader string to use depends on:
- - Use of global opacity
- - Brush style (some brushes apply opacity themselves)
- - Use & type of mask (TODO: Need to support high quality anti-aliasing & text)
- - Use of non-GL Composition mode
-
- Leading to the following fragment shader main functions:
- gl_FragColor = compose(applyMask(srcPixel()*globalOpacity));
- gl_FragColor = compose(applyMask(srcPixel()));
- gl_FragColor = applyMask(srcPixel()*globalOpacity);
- gl_FragColor = applyMask(srcPixel());
- gl_FragColor = compose(srcPixel()*globalOpacity);
- gl_FragColor = compose(srcPixel());
- gl_FragColor = srcPixel()*globalOpacity;
- gl_FragColor = srcPixel();
-
- Called:
- qopenglslMainFragmentShader_CMO
- qopenglslMainFragmentShader_CM
- qopenglslMainFragmentShader_MO
- qopenglslMainFragmentShader_M
- qopenglslMainFragmentShader_CO
- qopenglslMainFragmentShader_C
- qopenglslMainFragmentShader_O
- qopenglslMainFragmentShader
-
- Where:
- M = Mask
- C = Composition
- O = Global Opacity
-
-
- CUSTOM SHADER CODE
- ==================
-
- The use of custom shader code is supported by the engine for drawImage and
- drawPixmap calls. This is implemented via hooks in the fragment pipeline.
-
- The custom shader is passed to the engine as a partial fragment shader
- (QOpenGLCustomShaderStage). The shader will implement a pre-defined method name
- which Qt's fragment pipeline will call:
-
- lowp vec4 customShader(lowp sampler2d imageTexture, highp vec2 textureCoords)
-
- The provided src and srcCoords parameters can be used to sample from the
- source image.
-
- Transformations, clipping, opacity, and composition modes set using QPainter
- will be respected when using the custom shader hook.
-*/
-
-#ifndef QOPENGLENGINE_SHADER_MANAGER_H
-#define QOPENGLENGINE_SHADER_MANAGER_H
-
-#include <QtGui/private/qtguiglobal_p.h>
-#include <QOpenGLShader>
-#include <QOpenGLShaderProgram>
-#include <QPainter>
-#include <private/qopenglcontext_p.h>
-#include <private/qopenglcustomshaderstage_p.h>
-
-QT_BEGIN_NAMESPACE
-
-
-
-/*
-struct QOpenGLEngineCachedShaderProg
-{
- QOpenGLEngineCachedShaderProg(QOpenGLEngineShaderManager::ShaderName vertexMain,
- QOpenGLEngineShaderManager::ShaderName vertexPosition,
- QOpenGLEngineShaderManager::ShaderName fragMain,
- QOpenGLEngineShaderManager::ShaderName pixelSrc,
- QOpenGLEngineShaderManager::ShaderName mask,
- QOpenGLEngineShaderManager::ShaderName composition);
-
- int cacheKey;
- QOpenGLShaderProgram* program;
-}
-*/
-
-static const GLuint QT_VERTEX_COORDS_ATTR = 0;
-static const GLuint QT_TEXTURE_COORDS_ATTR = 1;
-static const GLuint QT_OPACITY_ATTR = 2;
-static const GLuint QT_PMV_MATRIX_1_ATTR = 3;
-static const GLuint QT_PMV_MATRIX_2_ATTR = 4;
-static const GLuint QT_PMV_MATRIX_3_ATTR = 5;
-
-class QOpenGLEngineShaderProg;
-
-class Q_GUI_EXPORT QOpenGLEngineSharedShaders
-{
- Q_GADGET
-public:
-
- enum SnippetName {
- MainVertexShader,
- MainWithTexCoordsVertexShader,
- MainWithTexCoordsAndOpacityVertexShader,
-
- // UntransformedPositionVertexShader must be first in the list:
- UntransformedPositionVertexShader,
- PositionOnlyVertexShader,
- ComplexGeometryPositionOnlyVertexShader,
- PositionWithPatternBrushVertexShader,
- PositionWithLinearGradientBrushVertexShader,
- PositionWithConicalGradientBrushVertexShader,
- PositionWithRadialGradientBrushVertexShader,
- PositionWithTextureBrushVertexShader,
- AffinePositionWithPatternBrushVertexShader,
- AffinePositionWithLinearGradientBrushVertexShader,
- AffinePositionWithConicalGradientBrushVertexShader,
- AffinePositionWithRadialGradientBrushVertexShader,
- AffinePositionWithTextureBrushVertexShader,
-
- // MainFragmentShader_CMO must be first in the list:
- MainFragmentShader_MO,
- MainFragmentShader_M,
- MainFragmentShader_O,
- MainFragmentShader,
- MainFragmentShader_ImageArrays,
-
- // ImageSrcFragmentShader must be first in the list::
- ImageSrcFragmentShader,
- ImageSrcWithPatternFragmentShader,
- NonPremultipliedImageSrcFragmentShader,
- GrayscaleImageSrcFragmentShader,
- AlphaImageSrcFragmentShader,
- CustomImageSrcFragmentShader,
- SolidBrushSrcFragmentShader,
- TextureBrushSrcFragmentShader,
- TextureBrushSrcWithPatternFragmentShader,
- PatternBrushSrcFragmentShader,
- LinearGradientBrushSrcFragmentShader,
- RadialGradientBrushSrcFragmentShader,
- ConicalGradientBrushSrcFragmentShader,
- ShockingPinkSrcFragmentShader,
-
- // NoMaskFragmentShader must be first in the list:
- NoMaskFragmentShader,
- MaskFragmentShader,
- RgbMaskFragmentShaderPass1,
- RgbMaskFragmentShaderPass2,
- RgbMaskWithGammaFragmentShader,
-
- // NoCompositionModeFragmentShader must be first in the list:
- NoCompositionModeFragmentShader,
- MultiplyCompositionModeFragmentShader,
- ScreenCompositionModeFragmentShader,
- OverlayCompositionModeFragmentShader,
- DarkenCompositionModeFragmentShader,
- LightenCompositionModeFragmentShader,
- ColorDodgeCompositionModeFragmentShader,
- ColorBurnCompositionModeFragmentShader,
- HardLightCompositionModeFragmentShader,
- SoftLightCompositionModeFragmentShader,
- DifferenceCompositionModeFragmentShader,
- ExclusionCompositionModeFragmentShader,
-
- TotalSnippetCount, InvalidSnippetName
- };
-#if defined (QT_DEBUG)
- Q_ENUM(SnippetName)
- static QByteArray snippetNameStr(SnippetName snippetName);
-#endif
-
-/*
- // These allow the ShaderName enum to be used as a cache key
- const int mainVertexOffset = 0;
- const int positionVertexOffset = (1<<2) - PositionOnlyVertexShader;
- const int mainFragOffset = (1<<6) - MainFragmentShader_CMO;
- const int srcPixelOffset = (1<<10) - ImageSrcFragmentShader;
- const int maskOffset = (1<<14) - NoMaskShader;
- const int compositionOffset = (1 << 16) - MultiplyCompositionModeFragmentShader;
-*/
-
- QOpenGLEngineSharedShaders(QOpenGLContext *context);
- ~QOpenGLEngineSharedShaders();
-
- QOpenGLShaderProgram *simpleProgram() { return simpleShaderProg; }
- QOpenGLShaderProgram *blitProgram() { return blitShaderProg; }
- // Compile the program if it's not already in the cache, return the item in the cache.
- QOpenGLEngineShaderProg *findProgramInCache(const QOpenGLEngineShaderProg &prog);
- // Compile the custom shader if it's not already in the cache, return the item in the cache.
-
- static QOpenGLEngineSharedShaders *shadersForContext(QOpenGLContext *context);
-
- // Ideally, this would be static and cleanup all programs in all contexts which
- // contain the custom code. Currently it is just a hint and we rely on deleted
- // custom shaders being cleaned up by being kicked out of the cache when it's
- // full.
- void cleanupCustomStage(QOpenGLCustomShaderStage* stage);
-
-private:
- QOpenGLShaderProgram *blitShaderProg;
- QOpenGLShaderProgram *simpleShaderProg;
- QList<QOpenGLEngineShaderProg*> cachedPrograms;
-
- static const char* qShaderSnippets[TotalSnippetCount];
-};
-
-
-class QOpenGLEngineShaderProg
-{
-public:
- QOpenGLEngineShaderProg() : program(nullptr) {}
-
- ~QOpenGLEngineShaderProg() {
- if (program)
- delete program;
- }
-
- QOpenGLEngineSharedShaders::SnippetName mainVertexShader;
- QOpenGLEngineSharedShaders::SnippetName positionVertexShader;
- QOpenGLEngineSharedShaders::SnippetName mainFragShader;
- QOpenGLEngineSharedShaders::SnippetName srcPixelFragShader;
- QOpenGLEngineSharedShaders::SnippetName maskFragShader;
- QOpenGLEngineSharedShaders::SnippetName compositionFragShader;
-
- QByteArray customStageSource; //TODO: Decent cache key for custom stages
- QOpenGLShaderProgram* program;
-
- QVector<uint> uniformLocations;
-
- bool useTextureCoords;
- bool useOpacityAttribute;
- bool usePmvMatrixAttribute;
-
- bool operator==(const QOpenGLEngineShaderProg& other) const {
- // We don't care about the program
- return ( mainVertexShader == other.mainVertexShader &&
- positionVertexShader == other.positionVertexShader &&
- mainFragShader == other.mainFragShader &&
- srcPixelFragShader == other.srcPixelFragShader &&
- maskFragShader == other.maskFragShader &&
- compositionFragShader == other.compositionFragShader &&
- customStageSource == other.customStageSource
- );
- }
-};
-
-class Q_GUI_EXPORT QOpenGLEngineShaderManager : public QObject
-{
- Q_OBJECT
-public:
- QOpenGLEngineShaderManager(QOpenGLContext* context);
- ~QOpenGLEngineShaderManager();
-
- enum MaskType {NoMask, PixelMask, SubPixelMaskPass1, SubPixelMaskPass2, SubPixelWithGammaMask};
- enum PixelSrcType {
- ImageSrc = Qt::TexturePattern+1,
- NonPremultipliedImageSrc = Qt::TexturePattern+2,
- PatternSrc = Qt::TexturePattern+3,
- TextureSrcWithPattern = Qt::TexturePattern+4,
- GrayscaleImageSrc = Qt::TexturePattern+5,
- AlphaImageSrc = Qt::TexturePattern+6,
- };
-
- enum Uniform {
- ImageTexture,
- PatternColor,
- GlobalOpacity,
- Depth,
- MaskTexture,
- FragmentColor,
- LinearData,
- Angle,
- HalfViewportSize,
- Fmp,
- Fmp2MRadius2,
- Inverse2Fmp2MRadius2,
- SqrFr,
- BRadius,
- InvertedTextureSize,
- BrushTransform,
- BrushTexture,
- Matrix,
- NumUniforms
- };
-
- enum OpacityMode {
- NoOpacity,
- UniformOpacity,
- AttributeOpacity
- };
-
- // There are optimizations we can do, depending on the brush transform:
- // 1) May not have to apply perspective-correction
- // 2) Can use lower precision for matrix
- void optimiseForBrushTransform(QTransform::TransformationType transformType);
- void setSrcPixelType(Qt::BrushStyle);
- void setSrcPixelType(PixelSrcType); // For non-brush sources, like pixmaps & images
- void setOpacityMode(OpacityMode);
- void setMaskType(MaskType);
- void setCompositionMode(QPainter::CompositionMode);
- void setCustomStage(QOpenGLCustomShaderStage* stage);
- void removeCustomStage();
-
- GLuint getUniformLocation(Uniform id);
-
- void setDirty(); // someone has manually changed the current shader program
- bool useCorrectShaderProg(); // returns true if the shader program needed to be changed
-
- void useSimpleProgram();
- void useBlitProgram();
- void setHasComplexGeometry(bool hasComplexGeometry)
- {
- complexGeometry = hasComplexGeometry;
- shaderProgNeedsChanging = true;
- }
- bool hasComplexGeometry() const
- {
- return complexGeometry;
- }
-
- QOpenGLShaderProgram* currentProgram(); // Returns pointer to the shader the manager has chosen
- QOpenGLShaderProgram* simpleProgram(); // Used to draw into e.g. stencil buffers
- QOpenGLShaderProgram* blitProgram(); // Used to blit a texture into the framebuffer
-
- QOpenGLEngineSharedShaders* sharedShaders;
-
-private:
- QOpenGLContext* ctx;
- bool shaderProgNeedsChanging;
- bool complexGeometry;
-
- // Current state variables which influence the choice of shader:
- QTransform brushTransform;
- int srcPixelType;
- OpacityMode opacityMode;
- MaskType maskType;
- QPainter::CompositionMode compositionMode;
- QOpenGLCustomShaderStage* customSrcStage;
-
- QOpenGLEngineShaderProg* currentShaderProg;
-};
-
-QT_END_NAMESPACE
-
-#endif //QOPENGLENGINE_SHADER_MANAGER_H
diff --git a/src/gui/opengl/qopenglengineshadersource_p.h b/src/gui/opengl/qopenglengineshadersource_p.h
deleted file mode 100644
index 3ac599b6c2..0000000000
--- a/src/gui/opengl/qopenglengineshadersource_p.h
+++ /dev/null
@@ -1,970 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the QtGui module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-//
-// W A R N I N G
-// -------------
-//
-// This file is not part of the Qt API. It exists purely as an
-// implementation detail. This header file may change from version to
-// version without notice, or even be removed.
-//
-// We mean it.
-//
-
-
-#ifndef QOPENGL_ENGINE_SHADER_SOURCE_H
-#define QOPENGL_ENGINE_SHADER_SOURCE_H
-
-#include <QtGui/private/qtguiglobal_p.h>
-#include "qopenglengineshadermanager_p.h"
-
-QT_BEGIN_NAMESPACE
-
-
-static const char* const qopenglslMainVertexShader = "\n\
- void setPosition(); \n\
- void main(void) \n\
- { \n\
- setPosition(); \n\
- }\n";
-
-static const char* const qopenglslMainWithTexCoordsVertexShader = "\n\
- attribute highp vec2 textureCoordArray; \n\
- varying highp vec2 textureCoords; \n\
- void setPosition(); \n\
- void main(void) \n\
- { \n\
- setPosition(); \n\
- textureCoords = textureCoordArray; \n\
- }\n";
-
-static const char* const qopenglslMainWithTexCoordsAndOpacityVertexShader = "\n\
- attribute highp vec2 textureCoordArray; \n\
- attribute lowp float opacityArray; \n\
- varying highp vec2 textureCoords; \n\
- varying lowp float opacity; \n\
- void setPosition(); \n\
- void main(void) \n\
- { \n\
- setPosition(); \n\
- textureCoords = textureCoordArray; \n\
- opacity = opacityArray; \n\
- }\n";
-
-// NOTE: We let GL do the perspective correction so texture lookups in the fragment
-// shader are also perspective corrected.
-static const char* const qopenglslPositionOnlyVertexShader = "\n\
- attribute highp vec2 vertexCoordsArray; \n\
- attribute highp vec3 pmvMatrix1; \n\
- attribute highp vec3 pmvMatrix2; \n\
- attribute highp vec3 pmvMatrix3; \n\
- void setPosition(void) \n\
- { \n\
- highp mat3 pmvMatrix = mat3(pmvMatrix1, pmvMatrix2, pmvMatrix3); \n\
- vec3 transformedPos = pmvMatrix * vec3(vertexCoordsArray.xy, 1.0); \n\
- gl_Position = vec4(transformedPos.xy, 0.0, transformedPos.z); \n\
- }\n";
-
-static const char* const qopenglslComplexGeometryPositionOnlyVertexShader = "\n\
- uniform highp mat3 matrix; \n\
- attribute highp vec2 vertexCoordsArray; \n\
- void setPosition(void) \n\
- { \n\
- gl_Position = vec4(matrix * vec3(vertexCoordsArray, 1), 1);\n\
- } \n";
-
-static const char* const qopenglslUntransformedPositionVertexShader = "\n\
- attribute highp vec4 vertexCoordsArray; \n\
- void setPosition(void) \n\
- { \n\
- gl_Position = vertexCoordsArray; \n\
- }\n";
-
-// Pattern Brush - This assumes the texture size is 8x8 and thus, the inverted size is 0.125
-static const char* const qopenglslPositionWithPatternBrushVertexShader = "\n\
- attribute highp vec2 vertexCoordsArray; \n\
- attribute highp vec3 pmvMatrix1; \n\
- attribute highp vec3 pmvMatrix2; \n\
- attribute highp vec3 pmvMatrix3; \n\
- uniform mediump vec2 halfViewportSize; \n\
- uniform highp vec2 invertedTextureSize; \n\
- uniform highp mat3 brushTransform; \n\
- varying highp vec2 patternTexCoords; \n\
- void setPosition(void) \n\
- { \n\
- highp mat3 pmvMatrix = mat3(pmvMatrix1, pmvMatrix2, pmvMatrix3); \n\
- vec3 transformedPos = pmvMatrix * vec3(vertexCoordsArray.xy, 1.0); \n\
- gl_Position.xy = transformedPos.xy / transformedPos.z; \n\
- mediump vec2 viewportCoords = (gl_Position.xy + 1.0) * halfViewportSize; \n\
- mediump vec3 hTexCoords = brushTransform * vec3(viewportCoords, 1.0); \n\
- mediump float invertedHTexCoordsZ = 1.0 / hTexCoords.z; \n\
- gl_Position = vec4(gl_Position.xy * invertedHTexCoordsZ, 0.0, invertedHTexCoordsZ); \n\
- patternTexCoords.xy = (hTexCoords.xy * 0.125) * invertedHTexCoordsZ; \n\
- }\n";
-
-static const char* const qopenglslAffinePositionWithPatternBrushVertexShader
- = qopenglslPositionWithPatternBrushVertexShader;
-
-static const char* const qopenglslPatternBrushSrcFragmentShader = "\n\
- uniform sampler2D brushTexture; \n\
- uniform lowp vec4 patternColor; \n\
- varying highp vec2 patternTexCoords;\n\
- lowp vec4 srcPixel() \n\
- { \n\
- return patternColor * (1.0 - texture2D(brushTexture, patternTexCoords).r); \n\
- }\n";
-
-
-// Linear Gradient Brush
-static const char* const qopenglslPositionWithLinearGradientBrushVertexShader = "\n\
- attribute highp vec2 vertexCoordsArray; \n\
- attribute highp vec3 pmvMatrix1; \n\
- attribute highp vec3 pmvMatrix2; \n\
- attribute highp vec3 pmvMatrix3; \n\
- uniform mediump vec2 halfViewportSize; \n\
- uniform highp vec3 linearData; \n\
- uniform highp mat3 brushTransform; \n\
- varying mediump float index; \n\
- void setPosition() \n\
- { \n\
- highp mat3 pmvMatrix = mat3(pmvMatrix1, pmvMatrix2, pmvMatrix3); \n\
- vec3 transformedPos = pmvMatrix * vec3(vertexCoordsArray.xy, 1.0); \n\
- gl_Position.xy = transformedPos.xy / transformedPos.z; \n\
- mediump vec2 viewportCoords = (gl_Position.xy + 1.0) * halfViewportSize; \n\
- mediump vec3 hTexCoords = brushTransform * vec3(viewportCoords, 1); \n\
- mediump float invertedHTexCoordsZ = 1.0 / hTexCoords.z; \n\
- gl_Position = vec4(gl_Position.xy * invertedHTexCoordsZ, 0.0, invertedHTexCoordsZ); \n\
- index = (dot(linearData.xy, hTexCoords.xy) * linearData.z) * invertedHTexCoordsZ; \n\
- }\n";
-
-static const char* const qopenglslAffinePositionWithLinearGradientBrushVertexShader
- = qopenglslPositionWithLinearGradientBrushVertexShader;
-
-static const char* const qopenglslLinearGradientBrushSrcFragmentShader = "\n\
- uniform sampler2D brushTexture; \n\
- varying mediump float index; \n\
- lowp vec4 srcPixel() \n\
- { \n\
- mediump vec2 val = vec2(index, 0.5); \n\
- return texture2D(brushTexture, val); \n\
- }\n";
-
-
-// Conical Gradient Brush
-static const char* const qopenglslPositionWithConicalGradientBrushVertexShader = "\n\
- attribute highp vec2 vertexCoordsArray; \n\
- attribute highp vec3 pmvMatrix1; \n\
- attribute highp vec3 pmvMatrix2; \n\
- attribute highp vec3 pmvMatrix3; \n\
- uniform mediump vec2 halfViewportSize; \n\
- uniform highp mat3 brushTransform; \n\
- varying highp vec2 A; \n\
- void setPosition(void) \n\
- { \n\
- highp mat3 pmvMatrix = mat3(pmvMatrix1, pmvMatrix2, pmvMatrix3); \n\
- vec3 transformedPos = pmvMatrix * vec3(vertexCoordsArray.xy, 1.0); \n\
- gl_Position.xy = transformedPos.xy / transformedPos.z; \n\
- mediump vec2 viewportCoords = (gl_Position.xy + 1.0) * halfViewportSize; \n\
- mediump vec3 hTexCoords = brushTransform * vec3(viewportCoords, 1); \n\
- mediump float invertedHTexCoordsZ = 1.0 / hTexCoords.z; \n\
- gl_Position = vec4(gl_Position.xy * invertedHTexCoordsZ, 0.0, invertedHTexCoordsZ); \n\
- A = hTexCoords.xy * invertedHTexCoordsZ; \n\
- }\n";
-
-static const char* const qopenglslAffinePositionWithConicalGradientBrushVertexShader
- = qopenglslPositionWithConicalGradientBrushVertexShader;
-
-static const char* const qopenglslConicalGradientBrushSrcFragmentShader = "\n\
- #define INVERSE_2PI 0.1591549430918953358 \n\
- uniform sampler2D brushTexture; \n\
- uniform mediump float angle; \n\
- varying highp vec2 A; \n\
- lowp vec4 srcPixel() \n\
- { \n\
- highp float t; \n\
- if (abs(A.y) == abs(A.x)) \n\
- t = (atan(-A.y + 0.002, A.x) + angle) * INVERSE_2PI; \n\
- else \n\
- t = (atan(-A.y, A.x) + angle) * INVERSE_2PI; \n\
- return texture2D(brushTexture, vec2(t - floor(t), 0.5)); \n\
- }\n";
-
-
-// Radial Gradient Brush
-static const char* const qopenglslPositionWithRadialGradientBrushVertexShader = "\n\
- attribute highp vec2 vertexCoordsArray;\n\
- attribute highp vec3 pmvMatrix1; \n\
- attribute highp vec3 pmvMatrix2; \n\
- attribute highp vec3 pmvMatrix3; \n\
- uniform mediump vec2 halfViewportSize; \n\
- uniform highp mat3 brushTransform; \n\
- uniform highp vec2 fmp; \n\
- uniform mediump vec3 bradius; \n\
- varying highp float b; \n\
- varying highp vec2 A; \n\
- void setPosition(void) \n\
- {\n\
- highp mat3 pmvMatrix = mat3(pmvMatrix1, pmvMatrix2, pmvMatrix3); \n\
- vec3 transformedPos = pmvMatrix * vec3(vertexCoordsArray.xy, 1.0); \n\
- gl_Position.xy = transformedPos.xy / transformedPos.z; \n\
- mediump vec2 viewportCoords = (gl_Position.xy + 1.0) * halfViewportSize; \n\
- mediump vec3 hTexCoords = brushTransform * vec3(viewportCoords, 1); \n\
- mediump float invertedHTexCoordsZ = 1.0 / hTexCoords.z; \n\
- gl_Position = vec4(gl_Position.xy * invertedHTexCoordsZ, 0.0, invertedHTexCoordsZ); \n\
- A = hTexCoords.xy * invertedHTexCoordsZ; \n\
- b = bradius.x + 2.0 * dot(A, fmp); \n\
- }\n";
-
-static const char* const qopenglslAffinePositionWithRadialGradientBrushVertexShader
- = qopenglslPositionWithRadialGradientBrushVertexShader;
-
-static const char* const qopenglslRadialGradientBrushSrcFragmentShader = "\n\
- uniform sampler2D brushTexture; \n\
- uniform highp float fmp2_m_radius2; \n\
- uniform highp float inverse_2_fmp2_m_radius2; \n\
- uniform highp float sqrfr; \n\
- varying highp float b; \n\
- varying highp vec2 A; \n\
- uniform mediump vec3 bradius; \n\
- lowp vec4 srcPixel() \n\
- { \n\
- highp float c = sqrfr-dot(A, A); \n\
- highp float det = b*b - 4.0*fmp2_m_radius2*c; \n\
- lowp vec4 result = vec4(0.0); \n\
- if (det >= 0.0) { \n\
- highp float detSqrt = sqrt(det); \n\
- highp float w = max((-b - detSqrt) * inverse_2_fmp2_m_radius2, (-b + detSqrt) * inverse_2_fmp2_m_radius2); \n\
- if (bradius.y + w * bradius.z >= 0.0) \n\
- result = texture2D(brushTexture, vec2(w, 0.5)); \n\
- } \n\
- return result; \n\
- }\n";
-
-
-// Texture Brush
-static const char* const qopenglslPositionWithTextureBrushVertexShader = "\n\
- attribute highp vec2 vertexCoordsArray; \n\
- attribute highp vec3 pmvMatrix1; \n\
- attribute highp vec3 pmvMatrix2; \n\
- attribute highp vec3 pmvMatrix3; \n\
- uniform mediump vec2 halfViewportSize; \n\
- uniform highp vec2 invertedTextureSize; \n\
- uniform highp mat3 brushTransform; \n\
- varying highp vec2 brushTextureCoords; \n\
- void setPosition(void) \n\
- { \n\
- highp mat3 pmvMatrix = mat3(pmvMatrix1, pmvMatrix2, pmvMatrix3); \n\
- vec3 transformedPos = pmvMatrix * vec3(vertexCoordsArray.xy, 1.0); \n\
- gl_Position.xy = transformedPos.xy / transformedPos.z; \n\
- mediump vec2 viewportCoords = (gl_Position.xy + 1.0) * halfViewportSize; \n\
- mediump vec3 hTexCoords = brushTransform * vec3(viewportCoords, 1); \n\
- mediump float invertedHTexCoordsZ = 1.0 / hTexCoords.z; \n\
- gl_Position = vec4(gl_Position.xy * invertedHTexCoordsZ, 0.0, invertedHTexCoordsZ); \n\
- brushTextureCoords.xy = (hTexCoords.xy * invertedTextureSize) * gl_Position.w; \n\
- }\n";
-
-static const char* const qopenglslAffinePositionWithTextureBrushVertexShader
- = qopenglslPositionWithTextureBrushVertexShader;
-
-static const char* const qopenglslTextureBrushSrcFragmentShader = "\n\
- varying highp vec2 brushTextureCoords; \n\
- uniform sampler2D brushTexture; \n\
- lowp vec4 srcPixel() \n\
- { \n\
- return texture2D(brushTexture, brushTextureCoords); \n\
- }\n";
-
-static const char* const qopenglslTextureBrushSrcWithPatternFragmentShader = "\n\
- varying highp vec2 brushTextureCoords; \n\
- uniform lowp vec4 patternColor; \n\
- uniform sampler2D brushTexture; \n\
- lowp vec4 srcPixel() \n\
- { \n\
- return patternColor * (1.0 - texture2D(brushTexture, brushTextureCoords).r); \n\
- }\n";
-
-// Solid Fill Brush
-static const char* const qopenglslSolidBrushSrcFragmentShader = "\n\
- uniform lowp vec4 fragmentColor; \n\
- lowp vec4 srcPixel() \n\
- { \n\
- return fragmentColor; \n\
- }\n";
-
-static const char* const qopenglslImageSrcFragmentShader = "\n\
- varying highp vec2 textureCoords; \n\
- uniform sampler2D imageTexture; \n\
- lowp vec4 srcPixel() \n\
- { \n"
- "return texture2D(imageTexture, textureCoords); \n"
- "}\n";
-
-static const char* const qopenglslCustomSrcFragmentShader = "\n\
- varying highp vec2 textureCoords; \n\
- uniform sampler2D imageTexture; \n\
- lowp vec4 srcPixel() \n\
- { \n\
- return customShader(imageTexture, textureCoords); \n\
- }\n";
-
-static const char* const qopenglslImageSrcWithPatternFragmentShader = "\n\
- varying highp vec2 textureCoords; \n\
- uniform lowp vec4 patternColor; \n\
- uniform sampler2D imageTexture; \n\
- lowp vec4 srcPixel() \n\
- { \n\
- return patternColor * (1.0 - texture2D(imageTexture, textureCoords).r); \n\
- }\n";
-
-static const char* const qopenglslNonPremultipliedImageSrcFragmentShader = "\n\
- varying highp vec2 textureCoords; \n\
- uniform sampler2D imageTexture; \n\
- lowp vec4 srcPixel() \n\
- { \n\
- lowp vec4 sample = texture2D(imageTexture, textureCoords); \n\
- sample.rgb = sample.rgb * sample.a; \n\
- return sample; \n\
- }\n";
-
-static const char* const qopenglslGrayscaleImageSrcFragmentShader = "\n\
- varying highp vec2 textureCoords; \n\
- uniform sampler2D imageTexture; \n\
- lowp vec4 srcPixel() \n\
- { \n\
- return texture2D(imageTexture, textureCoords).rrra; \n\
- }\n";
-
-static const char* const qopenglslAlphaImageSrcFragmentShader = "\n\
- varying highp vec2 textureCoords; \n\
- uniform sampler2D imageTexture; \n\
- lowp vec4 srcPixel() \n\
- { \n\
- return vec4(0, 0, 0, texture2D(imageTexture, textureCoords).r); \n\
- }\n";
-
-static const char* const qopenglslShockingPinkSrcFragmentShader = "\n\
- lowp vec4 srcPixel() \n\
- { \n\
- return vec4(0.98, 0.06, 0.75, 1.0); \n\
- }\n";
-
-static const char* const qopenglslMainFragmentShader_ImageArrays = "\n\
- varying lowp float opacity; \n\
- lowp vec4 srcPixel(); \n\
- void main() \n\
- { \n\
- gl_FragColor = srcPixel() * opacity; \n\
- }\n";
-
-static const char* const qopenglslMainFragmentShader_MO = "\n\
- uniform lowp float globalOpacity; \n\
- lowp vec4 srcPixel(); \n\
- lowp vec4 applyMask(lowp vec4); \n\
- void main() \n\
- { \n\
- gl_FragColor = applyMask(srcPixel()*globalOpacity); \n\
- }\n";
-
-static const char* const qopenglslMainFragmentShader_M = "\n\
- lowp vec4 srcPixel(); \n\
- lowp vec4 applyMask(lowp vec4); \n\
- void main() \n\
- { \n\
- gl_FragColor = applyMask(srcPixel()); \n\
- }\n";
-
-static const char* const qopenglslMainFragmentShader_O = "\n\
- uniform lowp float globalOpacity; \n\
- lowp vec4 srcPixel(); \n\
- void main() \n\
- { \n\
- gl_FragColor = srcPixel()*globalOpacity; \n\
- }\n";
-
-static const char* const qopenglslMainFragmentShader = "\n\
- lowp vec4 srcPixel(); \n\
- void main() \n\
- { \n\
- gl_FragColor = srcPixel(); \n\
- }\n";
-
-static const char* const qopenglslMaskFragmentShader = "\n\
- varying highp vec2 textureCoords;\n\
- uniform sampler2D maskTexture;\n\
- lowp vec4 applyMask(lowp vec4 src) \n\
- {\n\
- lowp vec4 mask = texture2D(maskTexture, textureCoords); \n\
- return src * mask.a; \n\
- }\n";
-
-// For source over with subpixel antialiasing, the final color is calculated per component as follows
-// (.a is alpha component, .c is red, green or blue component):
-// alpha = src.a * mask.c * opacity
-// dest.c = dest.c * (1 - alpha) + src.c * alpha
-//
-// In the first pass, calculate: dest.c = dest.c * (1 - alpha) with blend funcs: zero, 1 - source color
-// In the second pass, calculate: dest.c = dest.c + src.c * alpha with blend funcs: one, one
-//
-// If source is a solid color (src is constant), only the first pass is needed, with blend funcs: constant, 1 - source color
-
-// For source composition with subpixel antialiasing, the final color is calculated per component as follows:
-// alpha = src.a * mask.c * opacity
-// dest.c = dest.c * (1 - mask.c) + src.c * alpha
-//
-
-static const char* const qopenglslRgbMaskFragmentShaderPass1 = "\n\
- varying highp vec2 textureCoords;\n\
- uniform sampler2D maskTexture;\n\
- lowp vec4 applyMask(lowp vec4 src) \n\
- { \n\
- lowp vec4 mask = texture2D(maskTexture, textureCoords); \n\
- return src.a * mask; \n\
- }\n";
-
-static const char* const qopenglslRgbMaskFragmentShaderPass2 = "\n\
- varying highp vec2 textureCoords;\n\
- uniform sampler2D maskTexture;\n\
- lowp vec4 applyMask(lowp vec4 src) \n\
- { \n\
- lowp vec4 mask = texture2D(maskTexture, textureCoords); \n\
- return src * mask; \n\
- }\n";
-
-static const char* const qopenglslMultiplyCompositionModeFragmentShader = "\n\
- #ifdef GL_KHR_blend_equation_advanced\n\
- layout(blend_support_multiply) out;\n\
- #endif\n";
-
-static const char* const qopenglslScreenCompositionModeFragmentShader = "\n\
- #ifdef GL_KHR_blend_equation_advanced\n\
- layout(blend_support_screen) out;\n\
- #endif\n";
-
-static const char* const qopenglslOverlayCompositionModeFragmentShader = "\n\
- #ifdef GL_KHR_blend_equation_advanced\n\
- layout(blend_support_overlay) out;\n\
- #endif\n";
-
-static const char* const qopenglslDarkenCompositionModeFragmentShader = "\n\
- #ifdef GL_KHR_blend_equation_advanced\n\
- layout(blend_support_darken) out;\n\
- #endif\n";
-
-static const char* const qopenglslLightenCompositionModeFragmentShader = "\n\
- #ifdef GL_KHR_blend_equation_advanced\n\
- layout(blend_support_lighten) out;\n\
- #endif\n";
-
-static const char* const qopenglslColorDodgeCompositionModeFragmentShader = "\n\
- #ifdef GL_KHR_blend_equation_advanced\n\
- layout(blend_support_colordodge) out;\n\
- #endif\n";
-
-static const char* const qopenglslColorBurnCompositionModeFragmentShader = "\n\
- #ifdef GL_KHR_blend_equation_advanced\n\
- layout(blend_support_colorburn) out;\n\
- #endif\n";
-
-static const char* const qopenglslHardLightCompositionModeFragmentShader = "\n\
- #ifdef GL_KHR_blend_equation_advanced\n\
- layout(blend_support_hardlight) out;\n\
- #endif\n";
-
-static const char* const qopenglslSoftLightCompositionModeFragmentShader = "\n\
- #ifdef GL_KHR_blend_equation_advanced\n\
- layout(blend_support_softlight) out;\n\
- #endif\n";
-
-static const char* const qopenglslDifferenceCompositionModeFragmentShader = "\n\
- #ifdef GL_KHR_blend_equation_advanced\n\
- layout(blend_support_difference) out;\n\
- #endif\n";
-
-static const char* const qopenglslExclusionCompositionModeFragmentShader = "\n\
- #ifdef GL_KHR_blend_equation_advanced\n\
- layout(blend_support_exclusion) out;\n\
- #endif\n";
-
-/*
- Left to implement:
- RgbMaskFragmentShader,
- RgbMaskWithGammaFragmentShader,
-*/
-
-/*
- OpenGL 3.2+ Core Profile shaders
- The following shader snippets are copies of the snippets above
- but use the modern GLSL 1.5 keywords. New shaders should make
- a snippet for both profiles and add them appropriately in the
- shader manager.
-*/
-static const char* const qopenglslMainVertexShader_core =
- "#version 150 core\n\
- void setPosition(); \n\
- void main(void) \n\
- { \n\
- setPosition(); \n\
- }\n";
-
-static const char* const qopenglslMainWithTexCoordsVertexShader_core =
- "#version 150 core\n\
- in vec2 textureCoordArray; \n\
- out vec2 textureCoords; \n\
- void setPosition(); \n\
- void main(void) \n\
- { \n\
- setPosition(); \n\
- textureCoords = textureCoordArray; \n\
- }\n";
-
-static const char* const qopenglslMainWithTexCoordsAndOpacityVertexShader_core =
- "#version 150 core\n\
- in vec2 textureCoordArray; \n\
- in float opacityArray; \n\
- out vec2 textureCoords; \n\
- out float opacity; \n\
- void setPosition(); \n\
- void main(void) \n\
- { \n\
- setPosition(); \n\
- textureCoords = textureCoordArray; \n\
- opacity = opacityArray; \n\
- }\n";
-
-// NOTE: We let GL do the perspective correction so texture lookups in the fragment
-// shader are also perspective corrected.
-static const char* const qopenglslPositionOnlyVertexShader_core = "\n\
- in vec2 vertexCoordsArray; \n\
- in vec3 pmvMatrix1; \n\
- in vec3 pmvMatrix2; \n\
- in vec3 pmvMatrix3; \n\
- void setPosition(void) \n\
- { \n\
- mat3 pmvMatrix = mat3(pmvMatrix1, pmvMatrix2, pmvMatrix3); \n\
- vec3 transformedPos = pmvMatrix * vec3(vertexCoordsArray.xy, 1.0); \n\
- gl_Position = vec4(transformedPos.xy, 0.0, transformedPos.z); \n\
- }\n";
-
-static const char* const qopenglslComplexGeometryPositionOnlyVertexShader_core = "\n\
- in vec2 vertexCoordsArray; \n\
- uniform mat3 matrix; \n\
- void setPosition(void) \n\
- { \n\
- gl_Position = vec4(matrix * vec3(vertexCoordsArray, 1), 1);\n\
- } \n";
-
-static const char* const qopenglslUntransformedPositionVertexShader_core = "\n\
- in vec4 vertexCoordsArray; \n\
- void setPosition(void) \n\
- { \n\
- gl_Position = vertexCoordsArray; \n\
- }\n";
-
-// Pattern Brush - This assumes the texture size is 8x8 and thus, the inverted size is 0.125
-static const char* const qopenglslPositionWithPatternBrushVertexShader_core = "\n\
- in vec2 vertexCoordsArray; \n\
- in vec3 pmvMatrix1; \n\
- in vec3 pmvMatrix2; \n\
- in vec3 pmvMatrix3; \n\
- out vec2 patternTexCoords; \n\
- uniform vec2 halfViewportSize; \n\
- uniform vec2 invertedTextureSize; \n\
- uniform mat3 brushTransform; \n\
- void setPosition(void) \n\
- { \n\
- mat3 pmvMatrix = mat3(pmvMatrix1, pmvMatrix2, pmvMatrix3); \n\
- vec3 transformedPos = pmvMatrix * vec3(vertexCoordsArray.xy, 1.0); \n\
- gl_Position.xy = transformedPos.xy / transformedPos.z; \n\
- vec2 viewportCoords = (gl_Position.xy + 1.0) * halfViewportSize; \n\
- vec3 hTexCoords = brushTransform * vec3(viewportCoords, 1.0); \n\
- float invertedHTexCoordsZ = 1.0 / hTexCoords.z; \n\
- gl_Position = vec4(gl_Position.xy * invertedHTexCoordsZ, 0.0, invertedHTexCoordsZ); \n\
- patternTexCoords.xy = (hTexCoords.xy * 0.125) * invertedHTexCoordsZ; \n\
- }\n";
-
-static const char* const qopenglslAffinePositionWithPatternBrushVertexShader_core
- = qopenglslPositionWithPatternBrushVertexShader_core;
-
-static const char* const qopenglslPatternBrushSrcFragmentShader_core = "\n\
- in vec2 patternTexCoords;\n\
- uniform sampler2D brushTexture; \n\
- uniform vec4 patternColor; \n\
- vec4 srcPixel() \n\
- { \n\
- return patternColor * (1.0 - texture(brushTexture, patternTexCoords).r); \n\
- }\n";
-
-
-// Linear Gradient Brush
-static const char* const qopenglslPositionWithLinearGradientBrushVertexShader_core = "\n\
- in vec2 vertexCoordsArray; \n\
- in vec3 pmvMatrix1; \n\
- in vec3 pmvMatrix2; \n\
- in vec3 pmvMatrix3; \n\
- out float index; \n\
- uniform vec2 halfViewportSize; \n\
- uniform vec3 linearData; \n\
- uniform mat3 brushTransform; \n\
- void setPosition() \n\
- { \n\
- mat3 pmvMatrix = mat3(pmvMatrix1, pmvMatrix2, pmvMatrix3); \n\
- vec3 transformedPos = pmvMatrix * vec3(vertexCoordsArray.xy, 1.0); \n\
- gl_Position.xy = transformedPos.xy / transformedPos.z; \n\
- vec2 viewportCoords = (gl_Position.xy + 1.0) * halfViewportSize; \n\
- vec3 hTexCoords = brushTransform * vec3(viewportCoords, 1); \n\
- float invertedHTexCoordsZ = 1.0 / hTexCoords.z; \n\
- gl_Position = vec4(gl_Position.xy * invertedHTexCoordsZ, 0.0, invertedHTexCoordsZ); \n\
- index = (dot(linearData.xy, hTexCoords.xy) * linearData.z) * invertedHTexCoordsZ; \n\
- }\n";
-
-static const char* const qopenglslAffinePositionWithLinearGradientBrushVertexShader_core
- = qopenglslPositionWithLinearGradientBrushVertexShader_core;
-
-static const char* const qopenglslLinearGradientBrushSrcFragmentShader_core = "\n\
- uniform sampler2D brushTexture; \n\
- in float index; \n\
- vec4 srcPixel() \n\
- { \n\
- vec2 val = vec2(index, 0.5); \n\
- return texture(brushTexture, val); \n\
- }\n";
-
-
-// Conical Gradient Brush
-static const char* const qopenglslPositionWithConicalGradientBrushVertexShader_core = "\n\
- in vec2 vertexCoordsArray; \n\
- in vec3 pmvMatrix1; \n\
- in vec3 pmvMatrix2; \n\
- in vec3 pmvMatrix3; \n\
- out vec2 A; \n\
- uniform vec2 halfViewportSize; \n\
- uniform mat3 brushTransform; \n\
- void setPosition(void) \n\
- { \n\
- mat3 pmvMatrix = mat3(pmvMatrix1, pmvMatrix2, pmvMatrix3); \n\
- vec3 transformedPos = pmvMatrix * vec3(vertexCoordsArray.xy, 1.0); \n\
- gl_Position.xy = transformedPos.xy / transformedPos.z; \n\
- vec2 viewportCoords = (gl_Position.xy + 1.0) * halfViewportSize; \n\
- vec3 hTexCoords = brushTransform * vec3(viewportCoords, 1); \n\
- float invertedHTexCoordsZ = 1.0 / hTexCoords.z; \n\
- gl_Position = vec4(gl_Position.xy * invertedHTexCoordsZ, 0.0, invertedHTexCoordsZ); \n\
- A = hTexCoords.xy * invertedHTexCoordsZ; \n\
- }\n";
-
-static const char* const qopenglslAffinePositionWithConicalGradientBrushVertexShader_core
- = qopenglslPositionWithConicalGradientBrushVertexShader_core;
-
-static const char* const qopenglslConicalGradientBrushSrcFragmentShader_core = "\n\
- #define INVERSE_2PI 0.1591549430918953358 \n\
- in vec2 A; \n\
- uniform sampler2D brushTexture; \n\
- uniform float angle; \n\
- vec4 srcPixel() \n\
- { \n\
- float t; \n\
- if (abs(A.y) == abs(A.x)) \n\
- t = (atan(-A.y + 0.002, A.x) + angle) * INVERSE_2PI; \n\
- else \n\
- t = (atan(-A.y, A.x) + angle) * INVERSE_2PI; \n\
- return texture(brushTexture, vec2(t - floor(t), 0.5)); \n\
- }\n";
-
-
-// Radial Gradient Brush
-static const char* const qopenglslPositionWithRadialGradientBrushVertexShader_core = "\n\
- in vec2 vertexCoordsArray;\n\
- in vec3 pmvMatrix1; \n\
- in vec3 pmvMatrix2; \n\
- in vec3 pmvMatrix3; \n\
- out float b; \n\
- out vec2 A; \n\
- uniform vec2 halfViewportSize; \n\
- uniform mat3 brushTransform; \n\
- uniform vec2 fmp; \n\
- uniform vec3 bradius; \n\
- void setPosition(void) \n\
- {\n\
- mat3 pmvMatrix = mat3(pmvMatrix1, pmvMatrix2, pmvMatrix3); \n\
- vec3 transformedPos = pmvMatrix * vec3(vertexCoordsArray.xy, 1.0); \n\
- gl_Position.xy = transformedPos.xy / transformedPos.z; \n\
- vec2 viewportCoords = (gl_Position.xy + 1.0) * halfViewportSize; \n\
- vec3 hTexCoords = brushTransform * vec3(viewportCoords, 1); \n\
- float invertedHTexCoordsZ = 1.0 / hTexCoords.z; \n\
- gl_Position = vec4(gl_Position.xy * invertedHTexCoordsZ, 0.0, invertedHTexCoordsZ); \n\
- A = hTexCoords.xy * invertedHTexCoordsZ; \n\
- b = bradius.x + 2.0 * dot(A, fmp); \n\
- }\n";
-
-static const char* const qopenglslAffinePositionWithRadialGradientBrushVertexShader_core
- = qopenglslPositionWithRadialGradientBrushVertexShader_core;
-
-static const char* const qopenglslRadialGradientBrushSrcFragmentShader_core = "\n\
- in float b; \n\
- in vec2 A; \n\
- uniform sampler2D brushTexture; \n\
- uniform float fmp2_m_radius2; \n\
- uniform float inverse_2_fmp2_m_radius2; \n\
- uniform float sqrfr; \n\
- uniform vec3 bradius; \n\
- \n\
- vec4 srcPixel() \n\
- { \n\
- float c = sqrfr-dot(A, A); \n\
- float det = b*b - 4.0*fmp2_m_radius2*c; \n\
- vec4 result = vec4(0.0); \n\
- if (det >= 0.0) { \n\
- float detSqrt = sqrt(det); \n\
- float w = max((-b - detSqrt) * inverse_2_fmp2_m_radius2, (-b + detSqrt) * inverse_2_fmp2_m_radius2); \n\
- if (bradius.y + w * bradius.z >= 0.0) \n\
- result = texture(brushTexture, vec2(w, 0.5)); \n\
- } \n\
- return result; \n\
- }\n";
-
-
-// Texture Brush
-static const char* const qopenglslPositionWithTextureBrushVertexShader_core = "\n\
- in vec2 vertexCoordsArray; \n\
- in vec3 pmvMatrix1; \n\
- in vec3 pmvMatrix2; \n\
- in vec3 pmvMatrix3; \n\
- out vec2 brushTextureCoords; \n\
- uniform vec2 halfViewportSize; \n\
- uniform vec2 invertedTextureSize; \n\
- uniform mat3 brushTransform; \n\
- \n\
- void setPosition(void) \n\
- { \n\
- mat3 pmvMatrix = mat3(pmvMatrix1, pmvMatrix2, pmvMatrix3); \n\
- vec3 transformedPos = pmvMatrix * vec3(vertexCoordsArray.xy, 1.0); \n\
- gl_Position.xy = transformedPos.xy / transformedPos.z; \n\
- vec2 viewportCoords = (gl_Position.xy + 1.0) * halfViewportSize; \n\
- vec3 hTexCoords = brushTransform * vec3(viewportCoords, 1); \n\
- float invertedHTexCoordsZ = 1.0 / hTexCoords.z; \n\
- gl_Position = vec4(gl_Position.xy * invertedHTexCoordsZ, 0.0, invertedHTexCoordsZ); \n\
- brushTextureCoords.xy = (hTexCoords.xy * invertedTextureSize) * gl_Position.w; \n\
- }\n";
-
-static const char* const qopenglslAffinePositionWithTextureBrushVertexShader_core
- = qopenglslPositionWithTextureBrushVertexShader_core;
-
-static const char* const qopenglslTextureBrushSrcFragmentShader_core = "\n\
- in vec2 brushTextureCoords; \n\
- uniform sampler2D brushTexture; \n\
- vec4 srcPixel() \n\
- { \n\
- return texture(brushTexture, brushTextureCoords); \n\
- }\n";
-
-static const char* const qopenglslTextureBrushSrcWithPatternFragmentShader_core = "\n\
- in vec2 brushTextureCoords; \n\
- uniform vec4 patternColor; \n\
- uniform sampler2D brushTexture; \n\
- vec4 srcPixel() \n\
- { \n\
- return patternColor * (1.0 - texture(brushTexture, brushTextureCoords).r); \n\
- }\n";
-
-// Solid Fill Brush
-static const char* const qopenglslSolidBrushSrcFragmentShader_core = "\n\
- uniform vec4 fragmentColor; \n\
- vec4 srcPixel() \n\
- { \n\
- return fragmentColor; \n\
- }\n";
-
-static const char* const qopenglslImageSrcFragmentShader_core = "\n\
- in vec2 textureCoords; \n\
- uniform sampler2D imageTexture; \n\
- vec4 srcPixel() \n\
- { \n\
- return texture(imageTexture, textureCoords); \n\
- }\n";
-
-static const char* const qopenglslCustomSrcFragmentShader_core = "\n\
- in vec2 textureCoords; \n\
- uniform sampler2D imageTexture; \n\
- vec4 srcPixel() \n\
- { \n\
- return customShader(imageTexture, textureCoords); \n\
- }\n";
-
-static const char* const qopenglslImageSrcWithPatternFragmentShader_core = "\n\
- in vec2 textureCoords; \n\
- uniform vec4 patternColor; \n\
- uniform sampler2D imageTexture; \n\
- vec4 srcPixel() \n\
- { \n\
- return patternColor * (1.0 - texture(imageTexture, textureCoords).r); \n\
- }\n";
-
-static const char* const qopenglslNonPremultipliedImageSrcFragmentShader_core = "\n\
- in vec2 textureCoords; \n\
- uniform sampler2D imageTexture; \n\
- vec4 srcPixel() \n\
- { \n\
- vec4 sample = texture(imageTexture, textureCoords); \n\
- sample.rgb = sample.rgb * sample.a; \n\
- return sample; \n\
- }\n";
-
-static const char* const qopenglslGrayscaleImageSrcFragmentShader_core = "\n\
- in vec2 textureCoords; \n\
- uniform sampler2D imageTexture; \n\
- vec4 srcPixel() \n\
- { \n\
- return texture(imageTexture, textureCoords).rrra; \n\
- }\n";
-
-static const char* const qopenglslAlphaImageSrcFragmentShader_core = "\n\
- in vec2 textureCoords; \n\
- uniform sampler2D imageTexture; \n\
- vec4 srcPixel() \n\
- { \n\
- return vec4(0, 0, 0, texture(imageTexture, textureCoords).r); \n\
- }\n";
-
-static const char* const qopenglslShockingPinkSrcFragmentShader_core = "\n\
- vec4 srcPixel() \n\
- { \n\
- return vec4(0.98, 0.06, 0.75, 1.0); \n\
- }\n";
-
-static const char* const qopenglslMainFragmentShader_ImageArrays_core =
- "#version 150 core\n\
- in float opacity; \n\
- out vec4 fragColor; \n\
- vec4 srcPixel(); \n\
- void main() \n\
- { \n\
- fragColor = srcPixel() * opacity; \n\
- }\n";
-
-static const char* const qopenglslMainFragmentShader_MO_core =
- "#version 150 core\n\
- out vec4 fragColor; \n\
- uniform float globalOpacity; \n\
- vec4 srcPixel(); \n\
- vec4 applyMask(vec4); \n\
- void main() \n\
- { \n\
- fragColor = applyMask(srcPixel()*globalOpacity); \n\
- }\n";
-
-static const char* const qopenglslMainFragmentShader_M_core =
- "#version 150 core\n\
- out vec4 fragColor; \n\
- vec4 srcPixel(); \n\
- vec4 applyMask(vec4); \n\
- void main() \n\
- { \n\
- fragColor = applyMask(srcPixel()); \n\
- }\n";
-
-static const char* const qopenglslMainFragmentShader_O_core =
- "#version 150 core\n\
- out vec4 fragColor; \n\
- uniform float globalOpacity; \n\
- vec4 srcPixel(); \n\
- void main() \n\
- { \n\
- fragColor = srcPixel()*globalOpacity; \n\
- }\n";
-
-static const char* const qopenglslMainFragmentShader_core =
- "#version 150 core\n\
- out vec4 fragColor; \n\
- vec4 srcPixel(); \n\
- void main() \n\
- { \n\
- fragColor = srcPixel(); \n\
- }\n";
-
-static const char* const qopenglslMaskFragmentShader_core = "\n\
- in vec2 textureCoords;\n\
- uniform sampler2D maskTexture;\n\
- vec4 applyMask(vec4 src) \n\
- {\n\
- vec4 mask = texture(maskTexture, textureCoords); \n\
- return src * mask.r; \n\
- }\n";
-
-// For source over with subpixel antialiasing, the final color is calculated per component as follows
-// (.a is alpha component, .c is red, green or blue component):
-// alpha = src.a * mask.c * opacity
-// dest.c = dest.c * (1 - alpha) + src.c * alpha
-//
-// In the first pass, calculate: dest.c = dest.c * (1 - alpha) with blend funcs: zero, 1 - source color
-// In the second pass, calculate: dest.c = dest.c + src.c * alpha with blend funcs: one, one
-//
-// If source is a solid color (src is constant), only the first pass is needed, with blend funcs: constant, 1 - source color
-
-// For source composition with subpixel antialiasing, the final color is calculated per component as follows:
-// alpha = src.a * mask.c * opacity
-// dest.c = dest.c * (1 - mask.c) + src.c * alpha
-//
-
-static const char* const qopenglslRgbMaskFragmentShaderPass1_core = "\n\
- in vec2 textureCoords;\n\
- uniform sampler2D maskTexture;\n\
- vec4 applyMask(vec4 src) \n\
- { \n\
- vec4 mask = texture(maskTexture, textureCoords); \n\
- return src.a * mask; \n\
- }\n";
-
-static const char* const qopenglslRgbMaskFragmentShaderPass2_core = "\n\
- in vec2 textureCoords;\n\
- uniform sampler2D maskTexture;\n\
- vec4 applyMask(vec4 src) \n\
- { \n\
- vec4 mask = texture(maskTexture, textureCoords); \n\
- return src * mask; \n\
- }\n";
-
-/*
- Left to implement:
- RgbMaskFragmentShader_core,
- RgbMaskWithGammaFragmentShader_core,
-*/
-
-QT_END_NAMESPACE
-
-#endif // GLGC_SHADER_SOURCE_H
diff --git a/src/gui/opengl/qopenglext.h b/src/gui/opengl/qopenglext.h
index e3f9205619..8264f9d357 100644
--- a/src/gui/opengl/qopenglext.h
+++ b/src/gui/opengl/qopenglext.h
@@ -44,7 +44,7 @@ extern "C" {
#ifndef WIN32_LEAN_AND_MEAN
#define WIN32_LEAN_AND_MEAN 1
#endif
-#include <windows.h>
+#include <qt_windows.h>
#endif
#ifndef APIENTRY
diff --git a/src/gui/opengl/qopenglextensions_p.h b/src/gui/opengl/qopenglextensions_p.h
index 137f1e831f..a6c4a68c6c 100644
--- a/src/gui/opengl/qopenglextensions_p.h
+++ b/src/gui/opengl/qopenglextensions_p.h
@@ -1,41 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the QtGui module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#ifndef QOPENGL_EXTENSIONS_P_H
#define QOPENGL_EXTENSIONS_P_H
@@ -92,6 +56,12 @@ public:
DiscardFramebuffer = 0x00400000,
Sized16Formats = 0x00800000,
TextureSwizzle = 0x01000000,
+ StandardDerivatives = 0x02000000,
+ ASTCTextureCompression = 0x04000000,
+ ETC2TextureCompression = 0x08000000,
+ HalfFloatVertex = 0x10000000,
+ MultiView = 0x20000000,
+ MultiViewExtended = 0x40000000
};
Q_DECLARE_FLAGS(OpenGLExtensions, OpenGLExtension)
@@ -100,9 +70,9 @@ public:
GLvoid *glMapBuffer(GLenum target, GLenum access);
void glGetBufferSubData(GLenum target, qopengl_GLintptr offset, qopengl_GLsizeiptr size, GLvoid *data);
- void glDiscardFramebufferEXT (GLenum target, GLsizei numAttachments, const GLenum *attachments);
void flushShared();
+ void discardFramebuffer(GLenum target, GLsizei numAttachments, const GLenum *attachments);
QOpenGLExtensionsPrivate *d() const;
@@ -147,14 +117,6 @@ inline void QOpenGLExtensions::glGetBufferSubData(GLenum target, qopengl_GLintpt
Q_OPENGL_FUNCTIONS_DEBUG
}
-
-inline void QOpenGLExtensions::glDiscardFramebufferEXT (GLenum target, GLsizei numAttachments, const GLenum *attachments)
-{
- Q_D(QOpenGLExtensions);
- Q_ASSERT(QOpenGLExtensions::isInitialized(d));
- d->DiscardFramebuffer(target,numAttachments, attachments);
- Q_OPENGL_FUNCTIONS_DEBUG
-}
QT_END_NAMESPACE
#endif // QOPENGL_EXTENSIONS_P_H
diff --git a/src/gui/opengl/qopenglextrafunctions.h b/src/gui/opengl/qopenglextrafunctions.h
index a68e269065..e2608e9946 100644
--- a/src/gui/opengl/qopenglextrafunctions.h
+++ b/src/gui/opengl/qopenglextrafunctions.h
@@ -1,41 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the QtGui module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#ifndef QOPENGLEXTRAFUNCTIONS_H
#define QOPENGLEXTRAFUNCTIONS_H
@@ -53,8 +17,8 @@
#endif
// GLES build without having included gl32.h -> GLDEBUGPROC is still need for the protos, define it here
-#if defined(QT_OPENGL_ES_2) && !defined(QT_OPENGL_ES_3_2)
-typedef void (QOPENGLF_APIENTRYP *GLDEBUGPROC)(GLenum source,GLenum type,GLuint id,GLenum severity,GLsizei length,const GLchar *message,const void *userParam);
+#if QT_CONFIG(opengles2) && !QT_CONFIG(opengles32)
+typedef void (QOPENGLF_APIENTRY *GLDEBUGPROC)(GLenum source,GLenum type,GLuint id,GLenum severity,GLsizei length,const GLchar *message,const void *userParam);
#endif
QT_BEGIN_NAMESPACE
diff --git a/src/gui/opengl/qopenglframebufferobject.cpp b/src/gui/opengl/qopenglframebufferobject.cpp
deleted file mode 100644
index d7a6d32218..0000000000
--- a/src/gui/opengl/qopenglframebufferobject.cpp
+++ /dev/null
@@ -1,1857 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the QtGui module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "qopenglframebufferobject.h"
-#include "qopenglframebufferobject_p.h"
-
-#include <qdebug.h>
-#include <private/qopengl_p.h>
-#include <private/qopenglcontext_p.h>
-#include <private/qopenglextensions_p.h>
-#include <private/qfont_p.h>
-
-#include <qwindow.h>
-#include <qimage.h>
-#include <QtCore/qbytearray.h>
-
-QT_BEGIN_NAMESPACE
-
-#ifndef QT_NO_DEBUG
-#define QT_RESET_GLERROR() \
-{ \
- while (true) {\
- GLenum error = QOpenGLContext::currentContext()->functions()->glGetError(); \
- if (error == GL_NO_ERROR || error == GL_CONTEXT_LOST) \
- break; \
- } \
-}
-#define QT_CHECK_GLERROR() \
-{ \
- GLenum err = QOpenGLContext::currentContext()->functions()->glGetError(); \
- if (err != GL_NO_ERROR && err != GL_CONTEXT_LOST) { \
- qDebug("[%s line %d] OpenGL Error: %d", \
- __FILE__, __LINE__, (int)err); \
- } \
-}
-#else
-#define QT_RESET_GLERROR() {}
-#define QT_CHECK_GLERROR() {}
-#endif
-
-#ifndef GL_MAX_SAMPLES
-#define GL_MAX_SAMPLES 0x8D57
-#endif
-
-#ifndef GL_RENDERBUFFER_SAMPLES
-#define GL_RENDERBUFFER_SAMPLES 0x8CAB
-#endif
-
-#ifndef GL_DEPTH24_STENCIL8
-#define GL_DEPTH24_STENCIL8 0x88F0
-#endif
-
-#ifndef GL_DEPTH_COMPONENT24
-#define GL_DEPTH_COMPONENT24 0x81A6
-#endif
-
-#ifndef GL_DEPTH_COMPONENT24_OES
-#define GL_DEPTH_COMPONENT24_OES 0x81A6
-#endif
-
-#ifndef GL_READ_FRAMEBUFFER
-#define GL_READ_FRAMEBUFFER 0x8CA8
-#endif
-
-#ifndef GL_DRAW_FRAMEBUFFER
-#define GL_DRAW_FRAMEBUFFER 0x8CA9
-#endif
-
-#ifndef GL_RGB8
-#define GL_RGB8 0x8051
-#endif
-
-#ifndef GL_RGB10
-#define GL_RGB10 0x8052
-#endif
-
-#ifndef GL_RGB16
-#define GL_RGB16 0x8054
-#endif
-
-#ifndef GL_RGBA8
-#define GL_RGBA8 0x8058
-#endif
-
-#ifndef GL_RGB10_A2
-#define GL_RGB10_A2 0x8059
-#endif
-
-#ifndef GL_RGBA16
-#define GL_RGBA16 0x805B
-#endif
-
-#ifndef GL_BGRA
-#define GL_BGRA 0x80E1
-#endif
-
-#ifndef GL_UNSIGNED_INT_8_8_8_8_REV
-#define GL_UNSIGNED_INT_8_8_8_8_REV 0x8367
-#endif
-
-#ifndef GL_UNSIGNED_INT_2_10_10_10_REV
-#define GL_UNSIGNED_INT_2_10_10_10_REV 0x8368
-#endif
-
-#ifndef GL_CONTEXT_LOST
-#define GL_CONTEXT_LOST 0x0507
-#endif
-
-#ifndef GL_DEPTH_STENCIL_ATTACHMENT
-#define GL_DEPTH_STENCIL_ATTACHMENT 0x821A
-#endif
-
-#ifndef GL_DEPTH_STENCIL
-#define GL_DEPTH_STENCIL 0x84F9
-#endif
-
-
-
-/*!
- \class QOpenGLFramebufferObjectFormat
- \brief The QOpenGLFramebufferObjectFormat class specifies the format of an OpenGL
- framebuffer object.
- \inmodule QtGui
-
- \since 5.0
-
- \ingroup painting-3D
-
- A framebuffer object has several characteristics:
- \list
- \li \l{setSamples()}{Number of samples per pixels.}
- \li \l{setAttachment()}{Depth and/or stencil attachments.}
- \li \l{setTextureTarget()}{Texture target.}
- \li \l{setInternalTextureFormat()}{Internal texture format.}
- \endlist
-
- Note that the desired attachments or number of samples per pixels might not
- be supported by the hardware driver. Call QOpenGLFramebufferObject::format()
- after creating a QOpenGLFramebufferObject to find the exact format that was
- used to create the frame buffer object.
-
- \sa QOpenGLFramebufferObject
-*/
-
-/*!
- \internal
-*/
-void QOpenGLFramebufferObjectFormat::detach()
-{
- if (d->ref.loadRelaxed() != 1) {
- QOpenGLFramebufferObjectFormatPrivate *newd
- = new QOpenGLFramebufferObjectFormatPrivate(d);
- if (!d->ref.deref())
- delete d;
- d = newd;
- }
-}
-
-/*!
- Creates a QOpenGLFramebufferObjectFormat object for specifying
- the format of an OpenGL framebuffer object.
-
- By default the format specifies a non-multisample framebuffer object with no
- depth/stencil attachments, texture target \c GL_TEXTURE_2D, and internal format \c GL_RGBA8.
- On OpenGL/ES systems, the default internal format is \c GL_RGBA.
-
- \sa samples(), attachment(), internalTextureFormat()
-*/
-
-QOpenGLFramebufferObjectFormat::QOpenGLFramebufferObjectFormat()
-{
- d = new QOpenGLFramebufferObjectFormatPrivate;
-}
-
-/*!
- Constructs a copy of \a other.
-*/
-
-QOpenGLFramebufferObjectFormat::QOpenGLFramebufferObjectFormat(const QOpenGLFramebufferObjectFormat &other)
-{
- d = other.d;
- d->ref.ref();
-}
-
-/*!
- Assigns \a other to this object.
-*/
-
-QOpenGLFramebufferObjectFormat &QOpenGLFramebufferObjectFormat::operator=(const QOpenGLFramebufferObjectFormat &other)
-{
- if (d != other.d) {
- other.d->ref.ref();
- if (!d->ref.deref())
- delete d;
- d = other.d;
- }
- return *this;
-}
-
-/*!
- Destroys the QOpenGLFramebufferObjectFormat.
-*/
-QOpenGLFramebufferObjectFormat::~QOpenGLFramebufferObjectFormat()
-{
- if (!d->ref.deref())
- delete d;
-}
-
-/*!
- Sets the number of samples per pixel for a multisample framebuffer object
- to \a samples. The default sample count of 0 represents a regular
- non-multisample framebuffer object.
-
- If the desired amount of samples per pixel is not supported by the hardware
- then the maximum number of samples per pixel will be used. Note that
- multisample framebuffer objects cannot be bound as textures. Also, the
- \c{GL_EXT_framebuffer_multisample} extension is required to create a
- framebuffer with more than one sample per pixel.
-
- \sa samples()
-*/
-void QOpenGLFramebufferObjectFormat::setSamples(int samples)
-{
- detach();
- d->samples = samples;
-}
-
-/*!
- Returns the number of samples per pixel if a framebuffer object
- is a multisample framebuffer object. Otherwise, returns 0.
- The default value is 0.
-
- \sa setSamples()
-*/
-int QOpenGLFramebufferObjectFormat::samples() const
-{
- return d->samples;
-}
-
-/*!
- Enables mipmapping if \a enabled is true; otherwise disables it.
-
- Mipmapping is disabled by default.
-
- If mipmapping is enabled, additional memory will be allocated for
- the mipmap levels. The mipmap levels can be updated by binding the
- texture and calling glGenerateMipmap(). Mipmapping cannot be enabled
- for multisampled framebuffer objects.
-
- \sa mipmap(), QOpenGLFramebufferObject::texture()
-*/
-void QOpenGLFramebufferObjectFormat::setMipmap(bool enabled)
-{
- detach();
- d->mipmap = enabled;
-}
-
-/*!
- Returns \c true if mipmapping is enabled.
-
- \sa setMipmap()
-*/
-bool QOpenGLFramebufferObjectFormat::mipmap() const
-{
- return d->mipmap;
-}
-
-/*!
- Sets the attachment configuration of a framebuffer object to \a attachment.
-
- \sa attachment()
-*/
-void QOpenGLFramebufferObjectFormat::setAttachment(QOpenGLFramebufferObject::Attachment attachment)
-{
- detach();
- d->attachment = attachment;
-}
-
-/*!
- Returns the configuration of the depth and stencil buffers attached to
- a framebuffer object. The default is QOpenGLFramebufferObject::NoAttachment.
-
- \sa setAttachment()
-*/
-QOpenGLFramebufferObject::Attachment QOpenGLFramebufferObjectFormat::attachment() const
-{
- return d->attachment;
-}
-
-/*!
- Sets the texture target of the texture attached to a framebuffer object to
- \a target. Ignored for multisample framebuffer objects.
-
- \sa textureTarget(), samples()
-*/
-void QOpenGLFramebufferObjectFormat::setTextureTarget(GLenum target)
-{
- detach();
- d->target = target;
-}
-
-/*!
- Returns the texture target of the texture attached to a framebuffer object.
- Ignored for multisample framebuffer objects. The default is
- \c GL_TEXTURE_2D.
-
- \sa setTextureTarget(), samples()
-*/
-GLenum QOpenGLFramebufferObjectFormat::textureTarget() const
-{
- return d->target;
-}
-
-/*!
- Sets the internal format of a framebuffer object's texture or
- multisample framebuffer object's color buffer to
- \a internalTextureFormat.
-
- \sa internalTextureFormat()
-*/
-void QOpenGLFramebufferObjectFormat::setInternalTextureFormat(GLenum internalTextureFormat)
-{
- detach();
- d->internal_format = internalTextureFormat;
-}
-
-/*!
- Returns the internal format of a framebuffer object's texture or
- multisample framebuffer object's color buffer. The default is
- \c GL_RGBA8 on desktop OpenGL systems, and \c GL_RGBA on
- OpenGL/ES systems.
-
- \sa setInternalTextureFormat()
-*/
-GLenum QOpenGLFramebufferObjectFormat::internalTextureFormat() const
-{
- return d->internal_format;
-}
-
-/*!
- Returns \c true if all the options of this framebuffer object format
- are the same as \a other; otherwise returns \c false.
-*/
-bool QOpenGLFramebufferObjectFormat::operator==(const QOpenGLFramebufferObjectFormat& other) const
-{
- if (d == other.d)
- return true;
- else
- return d->equals(other.d);
-}
-
-/*!
- Returns \c false if all the options of this framebuffer object format
- are the same as \a other; otherwise returns \c true.
-*/
-bool QOpenGLFramebufferObjectFormat::operator!=(const QOpenGLFramebufferObjectFormat& other) const
-{
- return !(*this == other);
-}
-
-bool QOpenGLFramebufferObjectPrivate::checkFramebufferStatus(QOpenGLContext *ctx) const
-{
- if (!ctx)
- return false; // Context no longer exists.
- GLenum status = ctx->functions()->glCheckFramebufferStatus(GL_FRAMEBUFFER);
- switch(status) {
- case GL_NO_ERROR:
- case GL_FRAMEBUFFER_COMPLETE:
- return true;
- case GL_FRAMEBUFFER_UNSUPPORTED:
- qDebug("QOpenGLFramebufferObject: Unsupported framebuffer format.");
- break;
- case GL_FRAMEBUFFER_INCOMPLETE_ATTACHMENT:
- qDebug("QOpenGLFramebufferObject: Framebuffer incomplete attachment.");
- break;
- case GL_FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT:
- qDebug("QOpenGLFramebufferObject: Framebuffer incomplete, missing attachment.");
- break;
-#ifdef GL_FRAMEBUFFER_INCOMPLETE_DUPLICATE_ATTACHMENT
- case GL_FRAMEBUFFER_INCOMPLETE_DUPLICATE_ATTACHMENT:
- qDebug("QOpenGLFramebufferObject: Framebuffer incomplete, duplicate attachment.");
- break;
-#endif
-#ifdef GL_FRAMEBUFFER_INCOMPLETE_DIMENSIONS
- case GL_FRAMEBUFFER_INCOMPLETE_DIMENSIONS:
- qDebug("QOpenGLFramebufferObject: Framebuffer incomplete, attached images must have same dimensions.");
- break;
-#endif
-#ifdef GL_FRAMEBUFFER_INCOMPLETE_FORMATS
- case GL_FRAMEBUFFER_INCOMPLETE_FORMATS:
- qDebug("QOpenGLFramebufferObject: Framebuffer incomplete, attached images must have same format.");
- break;
-#endif
-#ifdef GL_FRAMEBUFFER_INCOMPLETE_DRAW_BUFFER
- case GL_FRAMEBUFFER_INCOMPLETE_DRAW_BUFFER:
- qDebug("QOpenGLFramebufferObject: Framebuffer incomplete, missing draw buffer.");
- break;
-#endif
-#ifdef GL_FRAMEBUFFER_INCOMPLETE_READ_BUFFER
- case GL_FRAMEBUFFER_INCOMPLETE_READ_BUFFER:
- qDebug("QOpenGLFramebufferObject: Framebuffer incomplete, missing read buffer.");
- break;
-#endif
-#ifdef GL_FRAMEBUFFER_INCOMPLETE_MULTISAMPLE
- case GL_FRAMEBUFFER_INCOMPLETE_MULTISAMPLE:
- qDebug("QOpenGLFramebufferObject: Framebuffer incomplete, attachments must have same number of samples per pixel.");
- break;
-#endif
- default:
- qDebug() <<"QOpenGLFramebufferObject: An undefined error has occurred: "<< status;
- break;
- }
- return false;
-}
-
-namespace
-{
- void freeFramebufferFunc(QOpenGLFunctions *funcs, GLuint id)
- {
- funcs->glDeleteFramebuffers(1, &id);
- }
-
- void freeRenderbufferFunc(QOpenGLFunctions *funcs, GLuint id)
- {
- funcs->glDeleteRenderbuffers(1, &id);
- }
-
- void freeTextureFunc(QOpenGLFunctions *funcs, GLuint id)
- {
- funcs->glDeleteTextures(1, &id);
- }
-}
-
-void QOpenGLFramebufferObjectPrivate::init(QOpenGLFramebufferObject *, const QSize &size,
- QOpenGLFramebufferObject::Attachment attachment,
- GLenum texture_target, GLenum internal_format,
- GLint samples, bool mipmap)
-{
- QOpenGLContext *ctx = QOpenGLContext::currentContext();
-
- funcs.initializeOpenGLFunctions();
-
- if (!funcs.hasOpenGLFeature(QOpenGLFunctions::Framebuffers))
- return;
-
- // Fall back to using a normal non-msaa FBO if we don't have support for MSAA
- if (!funcs.hasOpenGLExtension(QOpenGLExtensions::FramebufferMultisample)
- || !funcs.hasOpenGLExtension(QOpenGLExtensions::FramebufferBlit)) {
- samples = 0;
- } else if (!ctx->isOpenGLES() || ctx->format().majorVersion() >= 3) {
- GLint maxSamples;
- funcs.glGetIntegerv(GL_MAX_SAMPLES, &maxSamples);
- samples = qBound(0, int(samples), int(maxSamples));
- }
-
- colorAttachments.append(ColorAttachment(size, internal_format));
-
- dsSize = size;
-
- samples = qMax(0, samples);
- requestedSamples = samples;
-
- target = texture_target;
-
- QT_RESET_GLERROR(); // reset error state
- GLuint fbo = 0;
-
- funcs.glGenFramebuffers(1, &fbo);
- funcs.glBindFramebuffer(GL_FRAMEBUFFER, fbo);
-
- QOpenGLContextPrivate::get(ctx)->qgl_current_fbo_invalid = true;
-
- QT_CHECK_GLERROR();
-
- format.setTextureTarget(target);
- format.setInternalTextureFormat(internal_format);
- format.setMipmap(mipmap);
-
- if (samples == 0)
- initTexture(0);
- else
- initColorBuffer(0, &samples);
-
- format.setSamples(int(samples));
-
- initDepthStencilAttachments(ctx, attachment);
-
- if (valid)
- fbo_guard = new QOpenGLSharedResourceGuard(ctx, fbo, freeFramebufferFunc);
- else
- funcs.glDeleteFramebuffers(1, &fbo);
-
- QT_CHECK_GLERROR();
-}
-
-void QOpenGLFramebufferObjectPrivate::initTexture(int idx)
-{
- QOpenGLContext *ctx = QOpenGLContext::currentContext();
- GLuint texture = 0;
-
- funcs.glGenTextures(1, &texture);
- funcs.glBindTexture(target, texture);
-
- funcs.glTexParameteri(target, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
- funcs.glTexParameteri(target, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
- funcs.glTexParameteri(target, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);
- funcs.glTexParameteri(target, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);
-
- ColorAttachment &color(colorAttachments[idx]);
-
- GLuint pixelType = GL_UNSIGNED_BYTE;
- if (color.internalFormat == GL_RGB10_A2 || color.internalFormat == GL_RGB10)
- pixelType = GL_UNSIGNED_INT_2_10_10_10_REV;
- else if (color.internalFormat == GL_RGB16 || color.internalFormat == GL_RGBA16)
- pixelType = GL_UNSIGNED_SHORT;
-
- funcs.glTexImage2D(target, 0, color.internalFormat, color.size.width(), color.size.height(), 0,
- GL_RGBA, pixelType, nullptr);
- if (format.mipmap()) {
- int width = color.size.width();
- int height = color.size.height();
- int level = 0;
- while (width > 1 || height > 1) {
- width = qMax(1, width >> 1);
- height = qMax(1, height >> 1);
- ++level;
- funcs.glTexImage2D(target, level, color.internalFormat, width, height, 0,
- GL_RGBA, pixelType, nullptr);
- }
- }
- funcs.glFramebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0 + idx,
- target, texture, 0);
-
- QT_CHECK_GLERROR();
- funcs.glBindTexture(target, 0);
- valid = checkFramebufferStatus(ctx);
- if (valid) {
- color.guard = new QOpenGLSharedResourceGuard(ctx, texture, freeTextureFunc);
- } else {
- funcs.glDeleteTextures(1, &texture);
- }
-}
-
-void QOpenGLFramebufferObjectPrivate::initColorBuffer(int idx, GLint *samples)
-{
- QOpenGLContext *ctx = QOpenGLContext::currentContext();
- GLuint color_buffer = 0;
-
- ColorAttachment &color(colorAttachments[idx]);
-
- GLenum storageFormat = color.internalFormat;
- // ES requires a sized format. The older desktop extension does not. Correct the format on ES.
- if (ctx->isOpenGLES()) {
- if (color.internalFormat == GL_RGBA) {
- if (funcs.hasOpenGLExtension(QOpenGLExtensions::Sized8Formats))
- storageFormat = GL_RGBA8;
- else
- storageFormat = GL_RGBA4;
- } else if (color.internalFormat == GL_RGB10) {
- // GL_RGB10 is not allowed in ES for glRenderbufferStorage.
- storageFormat = GL_RGB10_A2;
- }
- }
-
- funcs.glGenRenderbuffers(1, &color_buffer);
- funcs.glBindRenderbuffer(GL_RENDERBUFFER, color_buffer);
- funcs.glRenderbufferStorageMultisample(GL_RENDERBUFFER, *samples, storageFormat, color.size.width(), color.size.height());
- funcs.glFramebufferRenderbuffer(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0 + idx,
- GL_RENDERBUFFER, color_buffer);
-
- QT_CHECK_GLERROR();
- valid = checkFramebufferStatus(ctx);
- if (valid) {
- // Query the actual number of samples. This can be greater than the requested
- // value since the typically supported values are 0, 4, 8, ..., and the
- // requests are mapped to the next supported value.
- funcs.glGetRenderbufferParameteriv(GL_RENDERBUFFER, GL_RENDERBUFFER_SAMPLES, samples);
- color.guard = new QOpenGLSharedResourceGuard(ctx, color_buffer, freeRenderbufferFunc);
- } else {
- funcs.glDeleteRenderbuffers(1, &color_buffer);
- }
-}
-
-void QOpenGLFramebufferObjectPrivate::initDepthStencilAttachments(QOpenGLContext *ctx,
- QOpenGLFramebufferObject::Attachment attachment)
-{
- // Use the same sample count for all attachments. format.samples() already contains
- // the actual number of samples for the color attachment and is not suitable. Use
- // requestedSamples instead.
- const int samples = requestedSamples;
-
- // free existing attachments
- if (depth_buffer_guard) {
-#ifdef Q_OS_WASM
- funcs.glFramebufferRenderbuffer(GL_FRAMEBUFFER, GL_DEPTH_STENCIL_ATTACHMENT, GL_RENDERBUFFER, 0);
-#else
- funcs.glFramebufferRenderbuffer(GL_FRAMEBUFFER, GL_DEPTH_ATTACHMENT, GL_RENDERBUFFER, 0);
-#endif
- depth_buffer_guard->free();
- }
- if (stencil_buffer_guard) {
- funcs.glFramebufferRenderbuffer(GL_FRAMEBUFFER, GL_STENCIL_ATTACHMENT, GL_RENDERBUFFER, 0);
- if (stencil_buffer_guard != depth_buffer_guard)
- stencil_buffer_guard->free();
- }
-
- depth_buffer_guard = nullptr;
- stencil_buffer_guard = nullptr;
-
- GLuint depth_buffer = 0;
- GLuint stencil_buffer = 0;
-
- // In practice, a combined depth-stencil buffer is supported by all desktop platforms, while a
- // separate stencil buffer is not. On embedded devices however, a combined depth-stencil buffer
- // might not be supported while separate buffers are, according to QTBUG-12861.
-#ifdef Q_OS_WASM
- // WebGL doesn't allow separately attach buffers to
- // STENCIL_ATTACHMENT and DEPTH_ATTACHMENT
- // QTBUG-69913
- if (attachment == QOpenGLFramebufferObject::CombinedDepthStencil) {
- funcs.glGenRenderbuffers(1, &depth_buffer);
- funcs.glBindRenderbuffer(GL_RENDERBUFFER, depth_buffer);
- Q_ASSERT(funcs.glIsRenderbuffer(depth_buffer));
-
- if (samples != 0 ) {
- funcs.glRenderbufferStorageMultisample(GL_RENDERBUFFER, samples,
- GL_DEPTH24_STENCIL8, dsSize.width(), dsSize.height());
- } else {
- funcs.glRenderbufferStorage(GL_RENDERBUFFER, GL_DEPTH_STENCIL,
- dsSize.width(), dsSize.height());
- }
-
- funcs.glFramebufferRenderbuffer(GL_FRAMEBUFFER, GL_DEPTH_STENCIL_ATTACHMENT,
- GL_RENDERBUFFER, depth_buffer);
-
- valid = checkFramebufferStatus(ctx);
- if (!valid) {
- funcs.glDeleteRenderbuffers(1, &depth_buffer);
- depth_buffer = 0;
- }
- }
-#else
- if (attachment == QOpenGLFramebufferObject::CombinedDepthStencil
- && funcs.hasOpenGLExtension(QOpenGLExtensions::PackedDepthStencil))
- {
- // depth and stencil buffer needs another extension
- funcs.glGenRenderbuffers(1, &depth_buffer);
- funcs.glBindRenderbuffer(GL_RENDERBUFFER, depth_buffer);
- Q_ASSERT(funcs.glIsRenderbuffer(depth_buffer));
- if (samples != 0 && funcs.hasOpenGLExtension(QOpenGLExtensions::FramebufferMultisample))
- funcs.glRenderbufferStorageMultisample(GL_RENDERBUFFER, samples,
- GL_DEPTH24_STENCIL8, dsSize.width(), dsSize.height());
- else
- funcs.glRenderbufferStorage(GL_RENDERBUFFER,
- GL_DEPTH24_STENCIL8, dsSize.width(), dsSize.height());
-
- stencil_buffer = depth_buffer;
- funcs.glFramebufferRenderbuffer(GL_FRAMEBUFFER, GL_DEPTH_ATTACHMENT,
- GL_RENDERBUFFER, depth_buffer);
- funcs.glFramebufferRenderbuffer(GL_FRAMEBUFFER, GL_STENCIL_ATTACHMENT,
- GL_RENDERBUFFER, stencil_buffer);
-
- valid = checkFramebufferStatus(ctx);
- if (!valid) {
- funcs.glDeleteRenderbuffers(1, &depth_buffer);
- stencil_buffer = depth_buffer = 0;
- }
- }
-
- if (depth_buffer == 0 && (attachment == QOpenGLFramebufferObject::CombinedDepthStencil
- || (attachment == QOpenGLFramebufferObject::Depth)))
- {
- funcs.glGenRenderbuffers(1, &depth_buffer);
- funcs.glBindRenderbuffer(GL_RENDERBUFFER, depth_buffer);
- Q_ASSERT(funcs.glIsRenderbuffer(depth_buffer));
- if (samples != 0 && funcs.hasOpenGLExtension(QOpenGLExtensions::FramebufferMultisample)) {
- if (ctx->isOpenGLES()) {
- if (funcs.hasOpenGLExtension(QOpenGLExtensions::Depth24))
- funcs.glRenderbufferStorageMultisample(GL_RENDERBUFFER, samples,
- GL_DEPTH_COMPONENT24, dsSize.width(), dsSize.height());
- else
- funcs.glRenderbufferStorageMultisample(GL_RENDERBUFFER, samples,
- GL_DEPTH_COMPONENT16, dsSize.width(), dsSize.height());
- } else {
- funcs.glRenderbufferStorageMultisample(GL_RENDERBUFFER, samples,
- GL_DEPTH_COMPONENT, dsSize.width(), dsSize.height());
- }
- } else {
- if (ctx->isOpenGLES()) {
- if (funcs.hasOpenGLExtension(QOpenGLExtensions::Depth24)) {
- funcs.glRenderbufferStorage(GL_RENDERBUFFER, GL_DEPTH_COMPONENT24,
- dsSize.width(), dsSize.height());
- } else {
- funcs.glRenderbufferStorage(GL_RENDERBUFFER, GL_DEPTH_COMPONENT16,
- dsSize.width(), dsSize.height());
- }
- } else {
- funcs.glRenderbufferStorage(GL_RENDERBUFFER, GL_DEPTH_COMPONENT, dsSize.width(), dsSize.height());
- }
- }
- funcs.glFramebufferRenderbuffer(GL_FRAMEBUFFER, GL_DEPTH_ATTACHMENT,
- GL_RENDERBUFFER, depth_buffer);
- valid = checkFramebufferStatus(ctx);
- if (!valid) {
- funcs.glDeleteRenderbuffers(1, &depth_buffer);
- depth_buffer = 0;
- }
- }
-
- if (stencil_buffer == 0 && (attachment == QOpenGLFramebufferObject::CombinedDepthStencil)) {
- funcs.glGenRenderbuffers(1, &stencil_buffer);
- funcs.glBindRenderbuffer(GL_RENDERBUFFER, stencil_buffer);
- Q_ASSERT(funcs.glIsRenderbuffer(stencil_buffer));
-
-#ifdef QT_OPENGL_ES
- GLenum storage = GL_STENCIL_INDEX8;
-#else
- GLenum storage = ctx->isOpenGLES() ? GL_STENCIL_INDEX8 : GL_STENCIL_INDEX;
-#endif
-
- if (samples != 0 && funcs.hasOpenGLExtension(QOpenGLExtensions::FramebufferMultisample))
- funcs.glRenderbufferStorageMultisample(GL_RENDERBUFFER, samples, storage, dsSize.width(), dsSize.height());
- else
- funcs.glRenderbufferStorage(GL_RENDERBUFFER, storage, dsSize.width(), dsSize.height());
-
- funcs.glFramebufferRenderbuffer(GL_FRAMEBUFFER, GL_STENCIL_ATTACHMENT,
- GL_RENDERBUFFER, stencil_buffer);
- valid = checkFramebufferStatus(ctx);
- if (!valid) {
- funcs.glDeleteRenderbuffers(1, &stencil_buffer);
- stencil_buffer = 0;
- }
- }
-#endif //Q_OS_WASM
-
- // The FBO might have become valid after removing the depth or stencil buffer.
- valid = checkFramebufferStatus(ctx);
-
-#ifdef Q_OS_WASM
- if (depth_buffer) {
-#else
- if (depth_buffer && stencil_buffer) {
-#endif
- fbo_attachment = QOpenGLFramebufferObject::CombinedDepthStencil;
- } else if (depth_buffer) {
- fbo_attachment = QOpenGLFramebufferObject::Depth;
- } else {
- fbo_attachment = QOpenGLFramebufferObject::NoAttachment;
- }
-
- if (valid) {
- if (depth_buffer)
- depth_buffer_guard = new QOpenGLSharedResourceGuard(ctx, depth_buffer, freeRenderbufferFunc);
- if (stencil_buffer) {
- if (stencil_buffer == depth_buffer)
- stencil_buffer_guard = depth_buffer_guard;
- else
- stencil_buffer_guard = new QOpenGLSharedResourceGuard(ctx, stencil_buffer, freeRenderbufferFunc);
- }
- } else {
- if (depth_buffer)
- funcs.glDeleteRenderbuffers(1, &depth_buffer);
- if (stencil_buffer && depth_buffer != stencil_buffer)
- funcs.glDeleteRenderbuffers(1, &stencil_buffer);
- }
- QT_CHECK_GLERROR();
-
- format.setAttachment(fbo_attachment);
-}
-
-/*!
- \class QOpenGLFramebufferObject
- \brief The QOpenGLFramebufferObject class encapsulates an OpenGL framebuffer object.
- \since 5.0
- \inmodule QtGui
-
- \ingroup painting-3D
-
- The QOpenGLFramebufferObject class encapsulates an OpenGL framebuffer
- object, defined by the \c{GL_EXT_framebuffer_object} extension. It provides
- a rendering surface that can be painted on with a QPainter with the help of
- QOpenGLPaintDevice, or rendered to using native OpenGL calls. This surface
- can be bound and used as a regular texture in your own OpenGL drawing code.
- By default, the QOpenGLFramebufferObject class generates a 2D OpenGL
- texture (using the \c{GL_TEXTURE_2D} target), which is used as the internal
- rendering target.
-
- \b{It is important to have a current OpenGL context when creating a
- QOpenGLFramebufferObject, otherwise initialization will fail.}
-
- Create the QOpenGLFrameBufferObject instance with the CombinedDepthStencil
- attachment if you want QPainter to render correctly. Note that you need to
- create a QOpenGLFramebufferObject with more than one sample per pixel for
- primitives to be antialiased when drawing using a QPainter. To create a
- multisample framebuffer object you should use one of the constructors that
- take a QOpenGLFramebufferObjectFormat parameter, and set the
- QOpenGLFramebufferObjectFormat::samples() property to a non-zero value.
-
- For multisample framebuffer objects a color render buffer is created,
- otherwise a texture with the specified texture target is created.
- The color render buffer or texture will have the specified internal
- format, and will be bound to the \c GL_COLOR_ATTACHMENT0
- attachment in the framebuffer object.
-
- Multiple render targets are also supported, in case the OpenGL
- implementation supports this. Here there will be multiple textures (or, in
- case of multisampling, renderbuffers) present and each of them will get
- attached to \c GL_COLOR_ATTACHMENT0, \c 1, \c 2, ...
-
- If you want to use a framebuffer object with multisampling enabled
- as a texture, you first need to copy from it to a regular framebuffer
- object using QOpenGLContext::blitFramebuffer().
-
- It is possible to draw into a QOpenGLFramebufferObject using QPainter and
- QOpenGLPaintDevice in a separate thread.
-*/
-
-
-/*!
- \enum QOpenGLFramebufferObject::Attachment
-
- This enum type is used to configure the depth and stencil buffers
- attached to the framebuffer object when it is created.
-
- \value NoAttachment No attachment is added to the framebuffer object. Note that the
- OpenGL depth and stencil tests won't work when rendering to a
- framebuffer object without any depth or stencil buffers.
- This is the default value.
-
- \value CombinedDepthStencil If the \c GL_EXT_packed_depth_stencil extension is present,
- a combined depth and stencil buffer is attached.
- If the extension is not present, only a depth buffer is attached.
-
- \value Depth A depth buffer is attached to the framebuffer object.
-
- \sa attachment()
-*/
-
-static inline GLenum effectiveInternalFormat(GLenum internalFormat)
-{
- if (!internalFormat)
-#ifdef QT_OPENGL_ES_2
- internalFormat = GL_RGBA;
-#else
- internalFormat = QOpenGLContext::currentContext()->isOpenGLES() ? GL_RGBA : GL_RGBA8;
-#endif
- return internalFormat;
-}
-
-/*!
-
- Constructs an OpenGL framebuffer object and binds a 2D OpenGL texture
- to the buffer of the size \a size. The texture is bound to the
- \c GL_COLOR_ATTACHMENT0 target in the framebuffer object.
-
- The \a target parameter is used to specify the OpenGL texture
- target. The default target is \c GL_TEXTURE_2D. Keep in mind that
- \c GL_TEXTURE_2D textures must have a power of 2 width and height
- (e.g. 256x512), unless you are using OpenGL 2.0 or higher.
-
- By default, no depth and stencil buffers are attached. This behavior
- can be toggled using one of the overloaded constructors.
-
- The default internal texture format is \c GL_RGBA8 for desktop
- OpenGL, and \c GL_RGBA for OpenGL/ES.
-
- It is important that you have a current OpenGL context set when
- creating the QOpenGLFramebufferObject, otherwise the initialization
- will fail.
-
- \sa size(), texture(), attachment()
-*/
-
-QOpenGLFramebufferObject::QOpenGLFramebufferObject(const QSize &size, GLenum target)
- : d_ptr(new QOpenGLFramebufferObjectPrivate)
-{
- Q_D(QOpenGLFramebufferObject);
- d->init(this, size, NoAttachment, target, effectiveInternalFormat(0));
-}
-
-/*!
-
- Constructs an OpenGL framebuffer object and binds a 2D OpenGL texture
- to the buffer of the given \a width and \a height.
-
- \sa size(), texture()
-*/
-QOpenGLFramebufferObject::QOpenGLFramebufferObject(int width, int height, GLenum target)
- : QOpenGLFramebufferObject(QSize(width, height), target)
-{
-}
-
-/*!
-
- Constructs an OpenGL framebuffer object of the given \a size based on the
- supplied \a format.
-*/
-
-QOpenGLFramebufferObject::QOpenGLFramebufferObject(const QSize &size, const QOpenGLFramebufferObjectFormat &format)
- : d_ptr(new QOpenGLFramebufferObjectPrivate)
-{
- Q_D(QOpenGLFramebufferObject);
- d->init(this, size, format.attachment(), format.textureTarget(), format.internalTextureFormat(),
- format.samples(), format.mipmap());
-}
-
-/*!
-
- Constructs an OpenGL framebuffer object of the given \a width and \a height
- based on the supplied \a format.
-*/
-
-QOpenGLFramebufferObject::QOpenGLFramebufferObject(int width, int height, const QOpenGLFramebufferObjectFormat &format)
- : QOpenGLFramebufferObject(QSize(width, height), format)
-{
-}
-
-/*!
-
- Constructs an OpenGL framebuffer object and binds a texture to the
- buffer of the given \a width and \a height.
-
- The \a attachment parameter describes the depth/stencil buffer
- configuration, \a target the texture target and \a internalFormat
- the internal texture format. The default texture target is \c
- GL_TEXTURE_2D, while the default internal format is \c GL_RGBA8
- for desktop OpenGL and \c GL_RGBA for OpenGL/ES.
-
- \sa size(), texture(), attachment()
-*/
-QOpenGLFramebufferObject::QOpenGLFramebufferObject(int width, int height, Attachment attachment,
- GLenum target, GLenum internalFormat)
- : d_ptr(new QOpenGLFramebufferObjectPrivate)
-{
- Q_D(QOpenGLFramebufferObject);
- d->init(this, QSize(width, height), attachment, target, effectiveInternalFormat(internalFormat));
-}
-
-/*!
-
- Constructs an OpenGL framebuffer object and binds a texture to the
- buffer of the given \a size.
-
- The \a attachment parameter describes the depth/stencil buffer
- configuration, \a target the texture target and \a internalFormat
- the internal texture format. The default texture target is \c
- GL_TEXTURE_2D, while the default internal format is \c GL_RGBA8
- for desktop OpenGL and \c GL_RGBA for OpenGL/ES.
-
- \sa size(), texture(), attachment()
-*/
-QOpenGLFramebufferObject::QOpenGLFramebufferObject(const QSize &size, Attachment attachment,
- GLenum target, GLenum internalFormat)
- : d_ptr(new QOpenGLFramebufferObjectPrivate)
-{
- Q_D(QOpenGLFramebufferObject);
- d->init(this, size, attachment, target, effectiveInternalFormat(internalFormat));
-}
-
-/*!
-
- Destroys the framebuffer object and frees any allocated resources.
-*/
-QOpenGLFramebufferObject::~QOpenGLFramebufferObject()
-{
- Q_D(QOpenGLFramebufferObject);
- if (isBound())
- release();
-
- for (const auto &color : qAsConst(d->colorAttachments)) {
- if (color.guard)
- color.guard->free();
- }
- d->colorAttachments.clear();
-
- if (d->depth_buffer_guard)
- d->depth_buffer_guard->free();
- if (d->stencil_buffer_guard && d->stencil_buffer_guard != d->depth_buffer_guard)
- d->stencil_buffer_guard->free();
- if (d->fbo_guard)
- d->fbo_guard->free();
-
- QOpenGLContextPrivate *contextPrv = QOpenGLContextPrivate::get(QOpenGLContext::currentContext());
- if (contextPrv && contextPrv->qgl_current_fbo == this) {
- contextPrv->qgl_current_fbo_invalid = true;
- contextPrv->qgl_current_fbo = nullptr;
- }
-}
-
-/*!
- Creates and attaches an additional texture or renderbuffer of \a size width
- and height.
-
- There is always an attachment at GL_COLOR_ATTACHMENT0. Call this function
- to set up additional attachments at GL_COLOR_ATTACHMENT1,
- GL_COLOR_ATTACHMENT2, ...
-
- When \a internalFormat is not \c 0, it specifies the internal format of the
- texture or renderbuffer. Otherwise a default of GL_RGBA or GL_RGBA8 is
- used.
-
- \note This is only functional when multiple render targets are supported by
- the OpenGL implementation. When that is not the case, the function will not
- add any additional color attachments. Call
- QOpenGLFunctions::hasOpenGLFeature() with
- QOpenGLFunctions::MultipleRenderTargets at runtime to check if MRT is
- supported.
-
- \note The internal format of the color attachments may differ but there may
- be limitations on the supported combinations, depending on the drivers.
-
- \note The size of the color attachments may differ but rendering is limited
- to the area that fits all the attachments, according to the OpenGL
- specification. Some drivers may not be fully conformant in this respect,
- however.
-
- \since 5.6
- */
-void QOpenGLFramebufferObject::addColorAttachment(const QSize &size, GLenum internalFormat)
-{
- Q_D(QOpenGLFramebufferObject);
-
- if (!QOpenGLContext::currentContext()->functions()->hasOpenGLFeature(QOpenGLFunctions::MultipleRenderTargets)) {
- qWarning("Multiple render targets not supported, ignoring extra color attachment request");
- return;
- }
-
- QOpenGLFramebufferObjectPrivate::ColorAttachment color(size, effectiveInternalFormat(internalFormat));
- d->colorAttachments.append(color);
- const int idx = d->colorAttachments.count() - 1;
-
- if (d->requestedSamples == 0) {
- d->initTexture(idx);
- } else {
- GLint samples = d->requestedSamples;
- d->initColorBuffer(idx, &samples);
- }
-}
-
-/*! \overload
-
- Creates and attaches an additional texture or renderbuffer of size \a width and \a height.
-
- When \a internalFormat is not \c 0, it specifies the internal format of the texture or
- renderbuffer. Otherwise a default of GL_RGBA or GL_RGBA8 is used.
-
- \since 5.6
- */
-void QOpenGLFramebufferObject::addColorAttachment(int width, int height, GLenum internalFormat)
-{
- addColorAttachment(QSize(width, height), internalFormat);
-}
-
-/*!
- \fn bool QOpenGLFramebufferObject::isValid() const
-
- Returns \c true if the framebuffer object is valid.
-
- The framebuffer can become invalid if the initialization process
- fails, the user attaches an invalid buffer to the framebuffer
- object, or a non-power of two width/height is specified as the
- texture size if the texture target is \c{GL_TEXTURE_2D}.
- The non-power of two limitation does not apply if the OpenGL version
- is 2.0 or higher, or if the GL_ARB_texture_non_power_of_two extension
- is present.
-
- The framebuffer can also become invalid if the QOpenGLContext that
- the framebuffer was created within is destroyed and there are
- no other shared contexts that can take over ownership of the
- framebuffer.
-*/
-bool QOpenGLFramebufferObject::isValid() const
-{
- Q_D(const QOpenGLFramebufferObject);
- return d->valid && d->fbo_guard && d->fbo_guard->id();
-}
-
-/*!
- \fn bool QOpenGLFramebufferObject::bind()
-
- Switches rendering from the default, windowing system provided
- framebuffer to this framebuffer object.
- Returns \c true upon success, false otherwise.
-
- \note If takeTexture() was called, a new texture is created and associated
- with the framebuffer object. This is potentially expensive and changes the
- context state (the currently bound texture).
-
- \sa release()
-*/
-bool QOpenGLFramebufferObject::bind()
-{
- if (!isValid())
- return false;
- Q_D(QOpenGLFramebufferObject);
- QOpenGLContext *current = QOpenGLContext::currentContext();
- if (!current)
- return false;
-#ifdef QT_DEBUG
- if (current->shareGroup() != d->fbo_guard->group())
- qWarning("QOpenGLFramebufferObject::bind() called from incompatible context");
-#endif
-
- d->funcs.glBindFramebuffer(GL_FRAMEBUFFER, d->fbo());
-
- QOpenGLContextPrivate::get(current)->qgl_current_fbo_invalid = true;
- QOpenGLContextPrivate::get(current)->qgl_current_fbo = this;
-
- if (d->format.samples() == 0) {
- // Create new textures to replace the ones stolen via takeTexture().
- for (int i = 0; i < d->colorAttachments.count(); ++i) {
- if (!d->colorAttachments.at(i).guard)
- d->initTexture(i);
- }
- }
-
- return d->valid;
-}
-
-/*!
- \fn bool QOpenGLFramebufferObject::release()
-
- Switches rendering back to the default, windowing system provided
- framebuffer.
- Returns \c true upon success, false otherwise.
-
- \sa bind()
-*/
-bool QOpenGLFramebufferObject::release()
-{
- if (!isValid())
- return false;
-
- QOpenGLContext *current = QOpenGLContext::currentContext();
- if (!current)
- return false;
-
- Q_D(QOpenGLFramebufferObject);
-#ifdef QT_DEBUG
- if (current->shareGroup() != d->fbo_guard->group())
- qWarning("QOpenGLFramebufferObject::release() called from incompatible context");
-#endif
-
- if (current) {
- d->funcs.glBindFramebuffer(GL_FRAMEBUFFER, current->defaultFramebufferObject());
-
- QOpenGLContextPrivate *contextPrv = QOpenGLContextPrivate::get(current);
- contextPrv->qgl_current_fbo_invalid = true;
- contextPrv->qgl_current_fbo = nullptr;
- }
-
- return true;
-}
-
-/*!
- \fn GLuint QOpenGLFramebufferObject::texture() const
-
- Returns the texture id for the texture attached as the default
- rendering target in this framebuffer object. This texture id can
- be bound as a normal texture in your own OpenGL code.
-
- If a multisample framebuffer object is used then the value returned
- from this function will be invalid.
-
- When multiple textures are attached, the return value is the ID of
- the first one.
-
- \sa takeTexture(), textures()
-*/
-GLuint QOpenGLFramebufferObject::texture() const
-{
- Q_D(const QOpenGLFramebufferObject);
- return d->colorAttachments[0].guard ? d->colorAttachments[0].guard->id() : 0;
-}
-
-/*!
- Returns the texture id for all attached textures.
-
- If a multisample framebuffer object is used, then an empty vector is returned.
-
- \since 5.6
-
- \sa takeTexture(), texture()
-*/
-QVector<GLuint> QOpenGLFramebufferObject::textures() const
-{
- Q_D(const QOpenGLFramebufferObject);
- QVector<GLuint> ids;
- if (d->format.samples() != 0)
- return ids;
- ids.reserve(d->colorAttachments.count());
- for (const auto &color : d->colorAttachments)
- ids.append(color.guard ? color.guard->id() : 0);
- return ids;
-}
-
-/*!
- \fn GLuint QOpenGLFramebufferObject::takeTexture()
-
- Returns the texture id for the texture attached to this framebuffer
- object. The ownership of the texture is transferred to the caller.
-
- If the framebuffer object is currently bound, an implicit release()
- will be done. During the next call to bind() a new texture will be
- created.
-
- If a multisample framebuffer object is used, then there is no
- texture and the return value from this function will be invalid.
- Similarly, incomplete framebuffer objects will also return 0.
-
- \since 5.3
-
- \sa texture(), bind(), release()
- */
-GLuint QOpenGLFramebufferObject::takeTexture()
-{
- return takeTexture(0);
-}
-
-/*! \overload
-
- Returns the texture id for the texture attached to the color attachment of
- index \a colorAttachmentIndex of this framebuffer object. The ownership of
- the texture is transferred to the caller.
-
- When \a colorAttachmentIndex is \c 0, the behavior is identical to the
- parameter-less variant of this function.
-
- If the framebuffer object is currently bound, an implicit release()
- will be done. During the next call to bind() a new texture will be
- created.
-
- If a multisample framebuffer object is used, then there is no
- texture and the return value from this function will be invalid.
- Similarly, incomplete framebuffer objects will also return 0.
-
- \since 5.6
- */
-GLuint QOpenGLFramebufferObject::takeTexture(int colorAttachmentIndex)
-{
- Q_D(QOpenGLFramebufferObject);
- GLuint id = 0;
- if (isValid() && d->format.samples() == 0 && d->colorAttachments.count() > colorAttachmentIndex) {
- QOpenGLContext *current = QOpenGLContext::currentContext();
- if (current && current->shareGroup() == d->fbo_guard->group() && isBound())
- release();
- auto &guard = d->colorAttachments[colorAttachmentIndex].guard;
- id = guard ? guard->id() : 0;
- // Do not call free() on texture_guard, just null it out.
- // This way the texture will not be deleted when the guard is destroyed.
- guard = nullptr;
- }
- return id;
-}
-
-/*!
- \return the size of the color and depth/stencil attachments attached to
- this framebuffer object.
-*/
-QSize QOpenGLFramebufferObject::size() const
-{
- Q_D(const QOpenGLFramebufferObject);
- return d->dsSize;
-}
-
-/*!
- \return the sizes of all color attachments attached to this framebuffer
- object.
-
- \since 5.6
-*/
-QVector<QSize> QOpenGLFramebufferObject::sizes() const
-{
- Q_D(const QOpenGLFramebufferObject);
- QVector<QSize> sz;
- sz.reserve(d->colorAttachments.size());
- for (const auto &color : d->colorAttachments)
- sz.append(color.size);
- return sz;
-}
-
-/*!
- \fn int QOpenGLFramebufferObject::width() const
-
- Returns the width of the framebuffer object attachments.
-*/
-
-/*!
- \fn int QOpenGLFramebufferObject::height() const
-
- Returns the height of the framebuffer object attachments.
-*/
-
-/*!
- Returns the format of this framebuffer object.
-*/
-QOpenGLFramebufferObjectFormat QOpenGLFramebufferObject::format() const
-{
- Q_D(const QOpenGLFramebufferObject);
- return d->format;
-}
-
-static inline QImage qt_gl_read_framebuffer_rgba8(const QSize &size, bool include_alpha, QOpenGLContext *context)
-{
- QOpenGLFunctions *funcs = context->functions();
- const int w = size.width();
- const int h = size.height();
- bool isOpenGL12orBetter = !context->isOpenGLES() && (context->format().majorVersion() >= 2 || context->format().minorVersion() >= 2);
- if (isOpenGL12orBetter) {
- QImage img(size, include_alpha ? QImage::Format_ARGB32_Premultiplied : QImage::Format_RGB32);
- funcs->glReadPixels(0, 0, w, h, GL_BGRA, GL_UNSIGNED_INT_8_8_8_8_REV, img.bits());
- return img;
- }
-
- // For OpenGL ES stick with the byte ordered format / RGBA readback format
- // since that is the only spec mandated way. (also, skip the
- // GL_IMPLEMENTATION_COLOR_READ_FORMAT mess since there is nothing saying a
- // BGRA capable impl would return BGRA from there)
-
- QImage rgbaImage(size, include_alpha ? QImage::Format_RGBA8888_Premultiplied : QImage::Format_RGBX8888);
- funcs->glReadPixels(0, 0, w, h, GL_RGBA, GL_UNSIGNED_BYTE, rgbaImage.bits());
- return rgbaImage;
-}
-
-static inline QImage qt_gl_read_framebuffer_rgb10a2(const QSize &size, bool include_alpha, QOpenGLContext *context)
-{
- // We assume OpenGL 1.2+ or ES 3.0+ here.
- QImage img(size, include_alpha ? QImage::Format_A2BGR30_Premultiplied : QImage::Format_BGR30);
- context->functions()->glReadPixels(0, 0, size.width(), size.height(), GL_RGBA, GL_UNSIGNED_INT_2_10_10_10_REV, img.bits());
- return img;
-}
-
-static inline QImage qt_gl_read_framebuffer_rgba16(const QSize &size, bool include_alpha, QOpenGLContext *context)
-{
- // We assume OpenGL 1.2+ or ES 3.0+ here.
- QImage img(size, include_alpha ? QImage::Format_RGBA64_Premultiplied : QImage::Format_RGBX64);
- context->functions()->glReadPixels(0, 0, size.width(), size.height(), GL_RGBA, GL_UNSIGNED_SHORT, img.bits());
- return img;
-}
-
-static QImage qt_gl_read_framebuffer(const QSize &size, GLenum internal_format, bool include_alpha, bool flip)
-{
- QOpenGLContext *ctx = QOpenGLContext::currentContext();
- QOpenGLFunctions *funcs = ctx->functions();
- while (true) {
- GLenum error = funcs->glGetError();
- if (error == GL_NO_ERROR || error == GL_CONTEXT_LOST)
- break;
- }
- switch (internal_format) {
- case GL_RGB:
- case GL_RGB8:
- return qt_gl_read_framebuffer_rgba8(size, false, ctx).mirrored(false, flip);
- case GL_RGB10:
- return qt_gl_read_framebuffer_rgb10a2(size, false, ctx).mirrored(false, flip);
- case GL_RGB10_A2:
- return qt_gl_read_framebuffer_rgb10a2(size, include_alpha, ctx).mirrored(false, flip);
- case GL_RGB16:
- return qt_gl_read_framebuffer_rgba16(size, false, ctx).mirrored(false, flip);
- case GL_RGBA16:
- return qt_gl_read_framebuffer_rgba16(size, include_alpha, ctx).mirrored(false, flip);
- case GL_RGBA:
- case GL_RGBA8:
- default:
- return qt_gl_read_framebuffer_rgba8(size, include_alpha, ctx).mirrored(false, flip);
- }
-
- Q_UNREACHABLE();
- return QImage();
-}
-
-Q_GUI_EXPORT QImage qt_gl_read_framebuffer(const QSize &size, bool alpha_format, bool include_alpha)
-{
- return qt_gl_read_framebuffer(size, alpha_format ? GL_RGBA : GL_RGB, include_alpha, true);
-}
-
-/*!
- \fn QImage QOpenGLFramebufferObject::toImage(bool flipped) const
-
- Returns the contents of this framebuffer object as a QImage.
-
- If \a flipped is true the image is flipped from OpenGL coordinates to raster coordinates.
- If used together with QOpenGLPaintDevice, \a flipped should be the opposite of the value
- of QOpenGLPaintDevice::paintFlipped().
-
- The returned image has a format of premultiplied ARGB32 or RGB32. The latter
- is used only when internalTextureFormat() is set to \c GL_RGB. Since Qt 5.2
- the function will fall back to premultiplied RGBA8888 or RGBx8888 when
- reading to (A)RGB32 is not supported, and this includes OpenGL ES. Since Qt
- 5.4 an A2BGR30 image is returned if the internal format is RGB10_A2, and since
- Qt 5.12 a RGBA64 image is return if the internal format is RGBA16.
-
- If the rendering in the framebuffer was not done with premultiplied alpha in mind,
- create a wrapper QImage with a non-premultiplied format. This is necessary before
- performing operations like QImage::save() because otherwise the image data would get
- unpremultiplied, even though it was not premultiplied in the first place. To create
- such a wrapper without performing a copy of the pixel data, do the following:
-
- \code
- QImage fboImage(fbo.toImage());
- QImage image(fboImage.constBits(), fboImage.width(), fboImage.height(), QImage::Format_ARGB32);
- \endcode
-
- For multisampled framebuffer objects the samples are resolved using the
- \c{GL_EXT_framebuffer_blit} extension. If the extension is not available, the contents
- of the returned image is undefined.
-
- For singlesampled framebuffers the contents is retrieved via \c glReadPixels. This is
- a potentially expensive and inefficient operation. Therefore it is recommended that
- this function is used as seldom as possible.
-
- \sa QOpenGLPaintDevice::paintFlipped()
-*/
-
-QImage QOpenGLFramebufferObject::toImage(bool flipped) const
-{
- return toImage(flipped, 0);
-}
-
-/*!
- \fn QImage QOpenGLFramebufferObject::toImage() const
- \overload
-
- Returns the contents of this framebuffer object as a QImage. This method flips
- the image from OpenGL coordinates to raster coordinates.
-*/
-// ### Qt 6: Remove this method and make it a default argument instead.
-QImage QOpenGLFramebufferObject::toImage() const
-{
- return toImage(true, 0);
-}
-
-/*! \overload
-
- Returns the contents of the color attachment of index \a
- colorAttachmentIndex of this framebuffer object as a QImage. This method
- flips the image from OpenGL coordinates to raster coordinates when \a
- flipped is set to \c true.
-
- \note This overload is only fully functional when multiple render targets are
- supported by the OpenGL implementation. When that is not the case, only one
- color attachment will be set up.
-
- \since 5.6
-*/
-QImage QOpenGLFramebufferObject::toImage(bool flipped, int colorAttachmentIndex) const
-{
- Q_D(const QOpenGLFramebufferObject);
- if (!d->valid)
- return QImage();
-
- QOpenGLContext *ctx = QOpenGLContext::currentContext();
- if (!ctx) {
- qWarning("QOpenGLFramebufferObject::toImage() called without a current context");
- return QImage();
- }
-
- if (d->colorAttachments.count() <= colorAttachmentIndex) {
- qWarning("QOpenGLFramebufferObject::toImage() called for missing color attachment");
- return QImage();
- }
-
- GLuint prevFbo = 0;
- ctx->functions()->glGetIntegerv(GL_FRAMEBUFFER_BINDING, (GLint *) &prevFbo);
-
- if (prevFbo != d->fbo())
- const_cast<QOpenGLFramebufferObject *>(this)->bind();
-
- QImage image;
- QOpenGLExtraFunctions *extraFuncs = ctx->extraFunctions();
- // qt_gl_read_framebuffer doesn't work on a multisample FBO
- if (format().samples() != 0) {
- QRect rect(QPoint(0, 0), size());
- QOpenGLFramebufferObjectFormat fmt;
- if (extraFuncs->hasOpenGLFeature(QOpenGLFunctions::MultipleRenderTargets)) {
- fmt.setInternalTextureFormat(d->colorAttachments[colorAttachmentIndex].internalFormat);
- QOpenGLFramebufferObject temp(d->colorAttachments[colorAttachmentIndex].size, fmt);
- blitFramebuffer(&temp, rect, const_cast<QOpenGLFramebufferObject *>(this), rect,
- GL_COLOR_BUFFER_BIT, GL_NEAREST,
- colorAttachmentIndex, 0);
- image = temp.toImage(flipped);
- } else {
- fmt.setInternalTextureFormat(d->colorAttachments[0].internalFormat);
- QOpenGLFramebufferObject temp(size(), fmt);
- blitFramebuffer(&temp, rect, const_cast<QOpenGLFramebufferObject *>(this), rect);
- image = temp.toImage(flipped);
- }
- } else {
- if (extraFuncs->hasOpenGLFeature(QOpenGLFunctions::MultipleRenderTargets)) {
- extraFuncs->glReadBuffer(GL_COLOR_ATTACHMENT0 + colorAttachmentIndex);
- image = qt_gl_read_framebuffer(d->colorAttachments[colorAttachmentIndex].size,
- d->colorAttachments[colorAttachmentIndex].internalFormat,
- true, flipped);
- extraFuncs->glReadBuffer(GL_COLOR_ATTACHMENT0);
- } else {
- image = qt_gl_read_framebuffer(d->colorAttachments[0].size,
- d->colorAttachments[0].internalFormat,
- true, flipped);
- }
- }
-
- if (prevFbo != d->fbo())
- ctx->functions()->glBindFramebuffer(GL_FRAMEBUFFER, prevFbo);
-
- return image;
-}
-
-/*!
- \fn bool QOpenGLFramebufferObject::bindDefault()
-
- Switches rendering back to the default, windowing system provided
- framebuffer.
- Returns \c true upon success, false otherwise.
-
- \sa bind(), release()
-*/
-bool QOpenGLFramebufferObject::bindDefault()
-{
- QOpenGLContext *ctx = const_cast<QOpenGLContext *>(QOpenGLContext::currentContext());
-
- if (ctx) {
- ctx->functions()->glBindFramebuffer(GL_FRAMEBUFFER, ctx->defaultFramebufferObject());
- QOpenGLContextPrivate::get(ctx)->qgl_current_fbo_invalid = true;
- QOpenGLContextPrivate::get(ctx)->qgl_current_fbo = nullptr;
- }
-#ifdef QT_DEBUG
- else
- qWarning("QOpenGLFramebufferObject::bindDefault() called without current context.");
-#endif
-
- return ctx != nullptr;
-}
-
-/*!
- \fn bool QOpenGLFramebufferObject::hasOpenGLFramebufferObjects()
-
- Returns \c true if the OpenGL \c{GL_EXT_framebuffer_object} extension
- is present on this system; otherwise returns \c false.
-*/
-bool QOpenGLFramebufferObject::hasOpenGLFramebufferObjects()
-{
- return QOpenGLContext::currentContext()->functions()->hasOpenGLFeature(QOpenGLFunctions::Framebuffers);
-}
-
-/*!
- \fn GLuint QOpenGLFramebufferObject::handle() const
-
- Returns the OpenGL framebuffer object handle for this framebuffer
- object (returned by the \c{glGenFrameBuffersEXT()} function). This
- handle can be used to attach new images or buffers to the
- framebuffer. The user is responsible for cleaning up and
- destroying these objects.
-*/
-GLuint QOpenGLFramebufferObject::handle() const
-{
- Q_D(const QOpenGLFramebufferObject);
- return d->fbo();
-}
-
-/*!
- Returns the status of the depth and stencil buffers attached to
- this framebuffer object.
-*/
-
-QOpenGLFramebufferObject::Attachment QOpenGLFramebufferObject::attachment() const
-{
- Q_D(const QOpenGLFramebufferObject);
- if (d->valid)
- return d->fbo_attachment;
- return NoAttachment;
-}
-
-/*!
- Sets the attachments of the framebuffer object to \a attachment.
-
- This can be used to free or reattach the depth and stencil buffer
- attachments as needed.
-
- \note This function alters the current framebuffer binding.
- */
-void QOpenGLFramebufferObject::setAttachment(QOpenGLFramebufferObject::Attachment attachment)
-{
- Q_D(QOpenGLFramebufferObject);
- if (attachment == d->fbo_attachment || !isValid())
- return;
- QOpenGLContext *current = QOpenGLContext::currentContext();
- if (!current)
- return;
-#ifdef QT_DEBUG
- if (current->shareGroup() != d->fbo_guard->group())
- qWarning("QOpenGLFramebufferObject::setAttachment() called from incompatible context");
-#endif
- d->funcs.glBindFramebuffer(GL_FRAMEBUFFER, d->fbo());
- QOpenGLContextPrivate::get(current)->qgl_current_fbo_invalid = true;
- d->initDepthStencilAttachments(current, attachment);
-}
-
-/*!
- Returns \c true if the framebuffer object is currently bound to the current context,
- otherwise false is returned.
-*/
-bool QOpenGLFramebufferObject::isBound() const
-{
- Q_D(const QOpenGLFramebufferObject);
- QOpenGLContext *ctx = QOpenGLContext::currentContext();
- if (!ctx)
- return false;
- GLint fbo = 0;
- ctx->functions()->glGetIntegerv(GL_FRAMEBUFFER_BINDING, &fbo);
- return GLuint(fbo) == d->fbo();
-}
-
-/*!
- \fn bool QOpenGLFramebufferObject::hasOpenGLFramebufferBlit()
-
- Returns \c true if the OpenGL \c{GL_EXT_framebuffer_blit} extension
- is present on this system; otherwise returns \c false.
-
- \sa blitFramebuffer()
-*/
-bool QOpenGLFramebufferObject::hasOpenGLFramebufferBlit()
-{
- return QOpenGLExtensions(QOpenGLContext::currentContext()).hasOpenGLExtension(QOpenGLExtensions::FramebufferBlit);
-}
-
-
-/*!
- \overload
-
- Convenience overload to blit between two framebuffer objects.
-*/
-void QOpenGLFramebufferObject::blitFramebuffer(QOpenGLFramebufferObject *target,
- QOpenGLFramebufferObject *source,
- GLbitfield buffers, GLenum filter)
-{
- if (!target && !source)
- return;
-
- QSize targetSize;
- QSize sourceSize;
-
- if (target)
- targetSize = target->size();
- if (source)
- sourceSize = source->size();
-
- if (targetSize.isEmpty())
- targetSize = sourceSize;
- else if (sourceSize.isEmpty())
- sourceSize = targetSize;
-
- blitFramebuffer(target, QRect(QPoint(0, 0), targetSize),
- source, QRect(QPoint(0, 0), sourceSize),
- buffers, filter);
-}
-
-/*! \overload
- *
- Convenience overload to blit between two framebuffer objects.
-*/
-void QOpenGLFramebufferObject::blitFramebuffer(QOpenGLFramebufferObject *target, const QRect &targetRect,
- QOpenGLFramebufferObject *source, const QRect &sourceRect,
- GLbitfield buffers,
- GLenum filter)
-{
- blitFramebuffer(target, targetRect, source, sourceRect, buffers, filter, 0, 0);
-}
-
-/*!
- \enum QOpenGLFramebufferObject::FramebufferRestorePolicy
- \since 5.7
-
- This enum type is used to configure the behavior related to restoring
- framebuffer bindings when calling blitFramebuffer().
-
- \value DontRestoreFramebufferBinding Do not restore the previous framebuffer binding.
- The caller is responsible for tracking and setting
- the framebuffer binding as needed.
-
- \value RestoreFramebufferBindingToDefault After the blit operation, bind the default
- framebuffer.
-
- \value RestoreFrameBufferBinding Restore the previously bound framebuffer. This is
- potentially expensive because of the need to
- query the currently bound framebuffer.
-
- \sa blitFramebuffer()
-*/
-
-/*!
- \since 5.7
-
- Blits from the \a sourceRect rectangle in the \a source framebuffer
- object to the \a targetRect rectangle in the \a target framebuffer object.
-
- If \a source or \a target is 0, the default framebuffer will be used
- instead of a framebuffer object as source or target respectively.
-
- This function will have no effect unless hasOpenGLFramebufferBlit() returns
- true.
-
- The \a buffers parameter should be a mask consisting of any combination of
- \c GL_COLOR_BUFFER_BIT, \c GL_DEPTH_BUFFER_BIT, and
- \c GL_STENCIL_BUFFER_BIT. Any buffer type that is not present both
- in the source and target buffers is ignored.
-
- The \a sourceRect and \a targetRect rectangles may have different sizes;
- in this case \a buffers should not contain \c GL_DEPTH_BUFFER_BIT or
- \c GL_STENCIL_BUFFER_BIT. The \a filter parameter should be set to
- \c GL_LINEAR or \c GL_NEAREST, and specifies whether linear or nearest
- interpolation should be used when scaling is performed.
-
- If \a source equals \a target a copy is performed within the same buffer.
- Results are undefined if the source and target rectangles overlap and
- have different sizes. The sizes must also be the same if any of the
- framebuffer objects are multisample framebuffers.
-
- \note The scissor test will restrict the blit area if enabled.
-
- When multiple render targets are in use, \a readColorAttachmentIndex and \a
- drawColorAttachmentIndex specify the index of the color attachments in the
- source and destination framebuffers.
-
- The \a restorePolicy determines if the framebuffer that was bound prior to
- calling this function should be restored, or if the default framebuffer
- should be bound before returning, of if the caller is responsible for
- tracking and setting the bound framebuffer. Restoring the previous
- framebuffer can be relatively expensive due to the call to \c{glGetIntegerv}
- which on some OpenGL drivers may imply a pipeline stall.
-
- \sa hasOpenGLFramebufferBlit()
-*/
-void QOpenGLFramebufferObject::blitFramebuffer(QOpenGLFramebufferObject *target, const QRect &targetRect,
- QOpenGLFramebufferObject *source, const QRect &sourceRect,
- GLbitfield buffers,
- GLenum filter,
- int readColorAttachmentIndex,
- int drawColorAttachmentIndex,
- QOpenGLFramebufferObject::FramebufferRestorePolicy restorePolicy)
-{
- QOpenGLContext *ctx = QOpenGLContext::currentContext();
- if (!ctx)
- return;
-
- QOpenGLExtensions extensions(ctx);
- if (!extensions.hasOpenGLExtension(QOpenGLExtensions::FramebufferBlit))
- return;
-
- GLuint prevFbo = 0;
- if (restorePolicy == RestoreFrameBufferBinding)
- ctx->functions()->glGetIntegerv(GL_FRAMEBUFFER_BINDING, (GLint *) &prevFbo);
-
- const int sx0 = sourceRect.left();
- const int sx1 = sourceRect.left() + sourceRect.width();
- const int sy0 = sourceRect.top();
- const int sy1 = sourceRect.top() + sourceRect.height();
-
- const int tx0 = targetRect.left();
- const int tx1 = targetRect.left() + targetRect.width();
- const int ty0 = targetRect.top();
- const int ty1 = targetRect.top() + targetRect.height();
-
- const GLuint defaultFboId = ctx->defaultFramebufferObject();
-
- extensions.glBindFramebuffer(GL_READ_FRAMEBUFFER, source ? source->handle() : defaultFboId);
- extensions.glBindFramebuffer(GL_DRAW_FRAMEBUFFER, target ? target->handle() : defaultFboId);
-
- const bool supportsMRT = extensions.hasOpenGLFeature(QOpenGLFunctions::MultipleRenderTargets);
- if (supportsMRT) {
- extensions.glReadBuffer(GL_COLOR_ATTACHMENT0 + readColorAttachmentIndex);
- if (target) {
- GLenum drawBuf = GL_COLOR_ATTACHMENT0 + drawColorAttachmentIndex;
- extensions.glDrawBuffers(1, &drawBuf);
- }
- }
-
- extensions.glBlitFramebuffer(sx0, sy0, sx1, sy1,
- tx0, ty0, tx1, ty1,
- buffers, filter);
-
- if (supportsMRT)
- extensions.glReadBuffer(GL_COLOR_ATTACHMENT0);
-
- switch (restorePolicy) {
- case RestoreFrameBufferBinding:
- ctx->functions()->glBindFramebuffer(GL_FRAMEBUFFER, prevFbo); // sets both READ and DRAW
- break;
-
- case RestoreFramebufferBindingToDefault:
- ctx->functions()->glBindFramebuffer(GL_FRAMEBUFFER, ctx->defaultFramebufferObject()); // sets both READ and DRAW
- break;
-
- case DontRestoreFramebufferBinding:
- break;
- }
-}
-
-/*!
- \overload
-
- Convenience overload to blit between two framebuffer objects and
- to restore the previous framebuffer binding. Equivalent to calling
- blitFramebuffer(target, targetRect, source, sourceRect, buffers, filter,
- readColorAttachmentIndex, drawColorAttachmentIndex,
- RestoreFrameBufferBinding).
-*/
-void QOpenGLFramebufferObject::blitFramebuffer(QOpenGLFramebufferObject *target, const QRect &targetRect,
- QOpenGLFramebufferObject *source, const QRect &sourceRect,
- GLbitfield buffers,
- GLenum filter,
- int readColorAttachmentIndex,
- int drawColorAttachmentIndex)
-{
- blitFramebuffer(target, targetRect, source, sourceRect,
- buffers, filter,
- readColorAttachmentIndex,
- drawColorAttachmentIndex,
- RestoreFrameBufferBinding);
-}
-
-QT_END_NAMESPACE
diff --git a/src/gui/opengl/qopenglframebufferobject.h b/src/gui/opengl/qopenglframebufferobject.h
deleted file mode 100644
index 161054d1bf..0000000000
--- a/src/gui/opengl/qopenglframebufferobject.h
+++ /dev/null
@@ -1,200 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the QtGui module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef QOPENGLFRAMEBUFFEROBJECT_H
-#define QOPENGLFRAMEBUFFEROBJECT_H
-
-#include <QtGui/qtguiglobal.h>
-
-#ifndef QT_NO_OPENGL
-
-#include <QtGui/qopengl.h>
-#include <QtGui/qpaintdevice.h>
-
-#include <QtCore/qscopedpointer.h>
-
-#if defined(Q_CLANG_QDOC)
-#undef GLuint
-typedef unsigned int GLuint;
-#undef GLenum
-typedef unsigned int GLenum;
-#undef GL_TEXTURE_2D
-#define GL_TEXTURE_2D 0x0DE1
-#undef GLbitfield
-typedef unsigned int GLbitfield;
-#endif
-
-QT_BEGIN_NAMESPACE
-
-class QOpenGLFramebufferObjectPrivate;
-class QOpenGLFramebufferObjectFormat;
-
-class Q_GUI_EXPORT QOpenGLFramebufferObject
-{
- Q_DECLARE_PRIVATE(QOpenGLFramebufferObject)
-public:
- enum Attachment {
- NoAttachment,
- CombinedDepthStencil,
- Depth
- };
-
- explicit QOpenGLFramebufferObject(const QSize &size, GLenum target = GL_TEXTURE_2D);
- QOpenGLFramebufferObject(int width, int height, GLenum target = GL_TEXTURE_2D);
-
- QOpenGLFramebufferObject(const QSize &size, Attachment attachment,
- GLenum target = GL_TEXTURE_2D, GLenum internalFormat = 0);
- QOpenGLFramebufferObject(int width, int height, Attachment attachment,
- GLenum target = GL_TEXTURE_2D, GLenum internalFormat = 0);
-
- QOpenGLFramebufferObject(const QSize &size, const QOpenGLFramebufferObjectFormat &format);
- QOpenGLFramebufferObject(int width, int height, const QOpenGLFramebufferObjectFormat &format);
-
- virtual ~QOpenGLFramebufferObject();
-
- void addColorAttachment(const QSize &size, GLenum internalFormat = 0);
- void addColorAttachment(int width, int height, GLenum internalFormat = 0);
-
- QOpenGLFramebufferObjectFormat format() const;
-
- bool isValid() const;
- bool isBound() const;
- bool bind();
- bool release();
-
- int width() const { return size().width(); }
- int height() const { return size().height(); }
-
- GLuint texture() const;
- QVector<GLuint> textures() const;
-
- GLuint takeTexture();
- GLuint takeTexture(int colorAttachmentIndex);
-
- QSize size() const;
- QVector<QSize> sizes() const;
-
- QImage toImage() const;
- QImage toImage(bool flipped) const;
- QImage toImage(bool flipped, int colorAttachmentIndex) const;
-
- Attachment attachment() const;
- void setAttachment(Attachment attachment);
-
- GLuint handle() const;
-
- static bool bindDefault();
-
- static bool hasOpenGLFramebufferObjects();
-
- static bool hasOpenGLFramebufferBlit();
-
- enum FramebufferRestorePolicy {
- DontRestoreFramebufferBinding,
- RestoreFramebufferBindingToDefault,
- RestoreFrameBufferBinding
- };
-
- static void blitFramebuffer(QOpenGLFramebufferObject *target, const QRect &targetRect,
- QOpenGLFramebufferObject *source, const QRect &sourceRect,
- GLbitfield buffers,
- GLenum filter,
- int readColorAttachmentIndex,
- int drawColorAttachmentIndex,
- FramebufferRestorePolicy restorePolicy);
- static void blitFramebuffer(QOpenGLFramebufferObject *target, const QRect &targetRect,
- QOpenGLFramebufferObject *source, const QRect &sourceRect,
- GLbitfield buffers,
- GLenum filter,
- int readColorAttachmentIndex,
- int drawColorAttachmentIndex);
- static void blitFramebuffer(QOpenGLFramebufferObject *target, const QRect &targetRect,
- QOpenGLFramebufferObject *source, const QRect &sourceRect,
- GLbitfield buffers = GL_COLOR_BUFFER_BIT,
- GLenum filter = GL_NEAREST);
- static void blitFramebuffer(QOpenGLFramebufferObject *target,
- QOpenGLFramebufferObject *source,
- GLbitfield buffers = GL_COLOR_BUFFER_BIT,
- GLenum filter = GL_NEAREST);
-
-private:
- Q_DISABLE_COPY(QOpenGLFramebufferObject)
- QScopedPointer<QOpenGLFramebufferObjectPrivate> d_ptr;
- friend class QOpenGLPaintDevice;
- friend class QOpenGLFBOGLPaintDevice;
-};
-
-class QOpenGLFramebufferObjectFormatPrivate;
-class Q_GUI_EXPORT QOpenGLFramebufferObjectFormat
-{
-public:
- QOpenGLFramebufferObjectFormat();
- QOpenGLFramebufferObjectFormat(const QOpenGLFramebufferObjectFormat &other);
- QOpenGLFramebufferObjectFormat &operator=(const QOpenGLFramebufferObjectFormat &other);
- ~QOpenGLFramebufferObjectFormat();
-
- void setSamples(int samples);
- int samples() const;
-
- void setMipmap(bool enabled);
- bool mipmap() const;
-
- void setAttachment(QOpenGLFramebufferObject::Attachment attachment);
- QOpenGLFramebufferObject::Attachment attachment() const;
-
- void setTextureTarget(GLenum target);
- GLenum textureTarget() const;
-
- void setInternalTextureFormat(GLenum internalTextureFormat);
- GLenum internalTextureFormat() const;
-
- bool operator==(const QOpenGLFramebufferObjectFormat& other) const;
- bool operator!=(const QOpenGLFramebufferObjectFormat& other) const;
-
-private:
- QOpenGLFramebufferObjectFormatPrivate *d;
-
- void detach();
-};
-
-QT_END_NAMESPACE
-
-#endif // QT_NO_OPENGL
-
-#endif // QOPENGLFRAMEBUFFEROBJECT_H
diff --git a/src/gui/opengl/qopenglframebufferobject_p.h b/src/gui/opengl/qopenglframebufferobject_p.h
deleted file mode 100644
index 644bb6c59b..0000000000
--- a/src/gui/opengl/qopenglframebufferobject_p.h
+++ /dev/null
@@ -1,153 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the QtGui module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef QOPENGLFRAMEBUFFEROBJECT_P_H
-#define QOPENGLFRAMEBUFFEROBJECT_P_H
-
-//
-// W A R N I N G
-// -------------
-//
-// This file is not part of the Qt API. It exists purely as an
-// implementation detail. This header file may change from version to
-// version without notice, or even be removed.
-//
-// We mean it.
-//
-
-#include <QtGui/private/qtguiglobal_p.h>
-#include <qopenglframebufferobject.h>
-#include <private/qopenglcontext_p.h>
-#include <private/qopenglextensions_p.h>
-
-QT_BEGIN_NAMESPACE
-
-class QOpenGLFramebufferObjectFormatPrivate
-{
-public:
- QOpenGLFramebufferObjectFormatPrivate()
- : ref(1),
- samples(0),
- attachment(QOpenGLFramebufferObject::NoAttachment),
- target(GL_TEXTURE_2D),
- mipmap(false)
- {
-#ifndef QT_OPENGL_ES_2
- // There is nothing that says QOpenGLFramebufferObjectFormat needs a current
- // context, so we need a fallback just to be safe, even though in pratice there
- // will usually be a context current.
- QOpenGLContext *ctx = QOpenGLContext::currentContext();
- const bool isES = ctx ? ctx->isOpenGLES() : QOpenGLContext::openGLModuleType() != QOpenGLContext::LibGL;
- internal_format = isES ? GL_RGBA : GL_RGBA8;
-#else
- internal_format = GL_RGBA;
-#endif
- }
- QOpenGLFramebufferObjectFormatPrivate
- (const QOpenGLFramebufferObjectFormatPrivate *other)
- : ref(1),
- samples(other->samples),
- attachment(other->attachment),
- target(other->target),
- internal_format(other->internal_format),
- mipmap(other->mipmap)
- {
- }
- bool equals(const QOpenGLFramebufferObjectFormatPrivate *other)
- {
- return samples == other->samples &&
- attachment == other->attachment &&
- target == other->target &&
- internal_format == other->internal_format &&
- mipmap == other->mipmap;
- }
-
- QAtomicInt ref;
- int samples;
- QOpenGLFramebufferObject::Attachment attachment;
- GLenum target;
- GLenum internal_format;
- uint mipmap : 1;
-};
-
-class QOpenGLFramebufferObjectPrivate
-{
-public:
- QOpenGLFramebufferObjectPrivate() : fbo_guard(nullptr), depth_buffer_guard(nullptr)
- , stencil_buffer_guard(nullptr)
- , valid(false) {}
- ~QOpenGLFramebufferObjectPrivate() {}
-
- void init(QOpenGLFramebufferObject *q, const QSize &size,
- QOpenGLFramebufferObject::Attachment attachment,
- GLenum texture_target, GLenum internal_format,
- GLint samples = 0, bool mipmap = false);
- void initTexture(int idx);
- void initColorBuffer(int idx, GLint *samples);
- void initDepthStencilAttachments(QOpenGLContext *ctx, QOpenGLFramebufferObject::Attachment attachment);
-
- bool checkFramebufferStatus(QOpenGLContext *ctx) const;
- QOpenGLSharedResourceGuard *fbo_guard;
- QOpenGLSharedResourceGuard *depth_buffer_guard;
- QOpenGLSharedResourceGuard *stencil_buffer_guard;
- GLenum target;
- QSize dsSize;
- QOpenGLFramebufferObjectFormat format;
- int requestedSamples;
- uint valid : 1;
- QOpenGLFramebufferObject::Attachment fbo_attachment;
- QOpenGLExtensions funcs;
-
- struct ColorAttachment {
- ColorAttachment() : internalFormat(0), guard(nullptr) { }
- ColorAttachment(const QSize &size, GLenum internalFormat)
- : size(size), internalFormat(internalFormat), guard(nullptr) { }
- QSize size;
- GLenum internalFormat;
- QOpenGLSharedResourceGuard *guard;
- };
- QVector<ColorAttachment> colorAttachments;
-
- inline GLuint fbo() const { return fbo_guard ? fbo_guard->id() : 0; }
-};
-
-
-QT_END_NAMESPACE
-
-#endif // QOPENGLFRAMEBUFFEROBJECT_P_H
diff --git a/src/gui/opengl/qopenglfunctions.cpp b/src/gui/opengl/qopenglfunctions.cpp
index 11ca802ee6..c9352fbc31 100644
--- a/src/gui/opengl/qopenglfunctions.cpp
+++ b/src/gui/opengl/qopenglfunctions.cpp
@@ -1,41 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the QtGui module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2021 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#include "qopenglfunctions.h"
#include "qopenglextrafunctions.h"
@@ -57,6 +21,8 @@
QT_BEGIN_NAMESPACE
+using namespace Qt::StringLiterals;
+
#define QT_OPENGL_COUNT_FUNCTIONS(ret, name, args) +1
#define QT_OPENGL_FUNCTION_NAMES(ret, name, args) \
"gl"#name"\0"
@@ -364,6 +330,8 @@ static int qt_gl_resolve_extensions()
extensions |= QOpenGLExtensions::ETC1TextureCompression;
if (extensionMatcher.match("GL_IMG_texture_compression_pvrtc"))
extensions |= QOpenGLExtensions::PVRTCTextureCompression;
+ if (extensionMatcher.match("GL_KHR_texture_compression_astc_ldr"))
+ extensions |= QOpenGLExtensions::ASTCTextureCompression;
if (extensionMatcher.match("GL_ARB_texture_mirrored_repeat"))
extensions |= QOpenGLExtensions::MirroredRepeat;
if (extensionMatcher.match("GL_EXT_stencil_two_side"))
@@ -376,6 +344,14 @@ static int qt_gl_resolve_extensions()
extensions |= QOpenGLExtensions::PixelBufferObject;
if (extensionMatcher.match("GL_ARB_texture_swizzle") || extensionMatcher.match("GL_EXT_texture_swizzle"))
extensions |= QOpenGLExtensions::TextureSwizzle;
+ if (extensionMatcher.match("GL_OES_standard_derivatives"))
+ extensions |= QOpenGLExtensions::StandardDerivatives;
+ if (extensionMatcher.match("GL_ARB_half_float_vertex"))
+ extensions |= QOpenGLExtensions::HalfFloatVertex;
+ if (extensionMatcher.match("GL_OVR_multiview"))
+ extensions |= QOpenGLExtensions::MultiView;
+ if (extensionMatcher.match("GL_OVR_multiview2"))
+ extensions |= QOpenGLExtensions::MultiViewExtended;
if (ctx->isOpenGLES()) {
if (format.majorVersion() >= 2)
@@ -388,7 +364,11 @@ static int qt_gl_resolve_extensions()
| QOpenGLExtensions::MapBufferRange
| QOpenGLExtensions::FramebufferBlit
| QOpenGLExtensions::FramebufferMultisample
- | QOpenGLExtensions::Sized8Formats;
+ | QOpenGLExtensions::Sized8Formats
+ | QOpenGLExtensions::DiscardFramebuffer
+ | QOpenGLExtensions::StandardDerivatives
+ | QOpenGLExtensions::ETC2TextureCompression
+ | QOpenGLExtensions::HalfFloatVertex;
#ifndef Q_OS_WASM
// WebGL 2.0 specification explicitly does not support texture swizzles
// https://www.khronos.org/registry/webgl/specs/latest/2.0/#5.19
@@ -410,6 +390,8 @@ static int qt_gl_resolve_extensions()
extensions |= QOpenGLExtensions::FramebufferMultisample;
if (extensionMatcher.match("GL_OES_rgb8_rgba8"))
extensions |= QOpenGLExtensions::Sized8Formats;
+ if (extensionMatcher.match("GL_OES_compressed_ETC2_RGB8_texture"))
+ extensions |= QOpenGLExtensions::ETC2TextureCompression;
}
if (extensionMatcher.match("GL_OES_mapbuffer"))
@@ -419,13 +401,13 @@ static int qt_gl_resolve_extensions()
// We don't match GL_APPLE_texture_format_BGRA8888 here because it has different semantics.
if (extensionMatcher.match("GL_IMG_texture_format_BGRA8888") || extensionMatcher.match("GL_EXT_texture_format_BGRA8888"))
extensions |= QOpenGLExtensions::BGRATextureFormat;
-#if defined(Q_OS_ANDROID) && !defined(Q_OS_ANDROID_EMBEDDED)
+#ifdef Q_OS_ANDROID
QString *deviceName =
static_cast<QString *>(QGuiApplication::platformNativeInterface()->nativeResourceForIntegration("AndroidDeviceName"));
static bool wrongfullyReportsBgra8888Support = deviceName != 0
- && (deviceName->compare(QLatin1String("samsung SM-T211"), Qt::CaseInsensitive) == 0
- || deviceName->compare(QLatin1String("samsung SM-T210"), Qt::CaseInsensitive) == 0
- || deviceName->compare(QLatin1String("samsung SM-T215"), Qt::CaseInsensitive) == 0);
+ && (deviceName->compare("samsung SM-T211"_L1, Qt::CaseInsensitive) == 0
+ || deviceName->compare("samsung SM-T210"_L1, Qt::CaseInsensitive) == 0
+ || deviceName->compare("samsung SM-T215"_L1, Qt::CaseInsensitive) == 0);
if (wrongfullyReportsBgra8888Support)
extensions &= ~QOpenGLExtensions::BGRATextureFormat;
#endif
@@ -445,6 +427,9 @@ static int qt_gl_resolve_extensions()
if (format.version() >= qMakePair(1, 4) || extensionMatcher.match("GL_SGIS_generate_mipmap"))
extensions |= QOpenGLExtensions::GenerateMipmap;
+ if (format.majorVersion() >= 2)
+ extensions |= QOpenGLExtensions::StandardDerivatives;
+
if (format.majorVersion() >= 3 || extensionMatcher.match("GL_ARB_framebuffer_object")) {
extensions |= QOpenGLExtensions::FramebufferMultisample
| QOpenGLExtensions::FramebufferBlit
@@ -466,6 +451,9 @@ static int qt_gl_resolve_extensions()
if (format.version() >= qMakePair(3, 3))
extensions |= QOpenGLExtensions::TextureSwizzle;
+ if (format.version() >= qMakePair(4, 3) || extensionMatcher.match("GL_ARB_invalidate_subdata"))
+ extensions |= QOpenGLExtensions::DiscardFramebuffer;
+
if (extensionMatcher.match("GL_ARB_map_buffer_range"))
extensions |= QOpenGLExtensions::MapBufferRange;
@@ -475,6 +463,9 @@ static int qt_gl_resolve_extensions()
if (srgbCapableFramebuffers)
extensions |= QOpenGLExtensions::SRGBFrameBuffer;
}
+
+ if (extensionMatcher.match("GL_ARB_ES3_compatibility"))
+ extensions |= QOpenGLExtensions::ETC2TextureCompression;
}
return extensions;
@@ -557,13 +548,6 @@ bool QOpenGLExtensions::hasOpenGLExtension(QOpenGLExtensions::OpenGLExtension ex
}
/*!
- \fn void QOpenGLFunctions::initializeGLFunctions()
- \obsolete
-
- Use initializeOpenGLFunctions() instead.
-*/
-
-/*!
Initializes OpenGL function resolution for the current context.
After calling this function, the QOpenGLFunctions object can only be
@@ -581,7 +565,7 @@ void QOpenGLFunctions::initializeOpenGLFunctions()
Convenience function that calls glBindTexture(\a target, \a texture).
- For more information, see the OpenGL ES 2.0 documentation for
+ For more information, see the OpenGL ES 3.X documentation for
\l{https://www.khronos.org/registry/OpenGL-Refpages/es3/html/glBindTexture.xhtml}{glBindTexture()}.
\since 5.3
@@ -592,7 +576,7 @@ void QOpenGLFunctions::initializeOpenGLFunctions()
Convenience function that calls glBlendFunc(\a sfactor, \a dfactor).
- For more information, see the OpenGL ES 2.0 documentation for
+ For more information, see the OpenGL ES 3.X documentation for
\l{https://www.khronos.org/registry/OpenGL-Refpages/es3/html/glBlendFunc.xhtml}{glBlendFunc()}.
\since 5.3
@@ -603,7 +587,7 @@ void QOpenGLFunctions::initializeOpenGLFunctions()
Convenience function that calls glClear(\a mask).
- For more information, see the OpenGL ES 2.0 documentation for
+ For more information, see the OpenGL ES 3.X documentation for
\l{https://www.khronos.org/registry/OpenGL-Refpages/es3/html/glClear.xhtml}{glClear()}.
\since 5.3
@@ -614,7 +598,7 @@ void QOpenGLFunctions::initializeOpenGLFunctions()
Convenience function that calls glClearColor(\a red, \a green, \a blue, \a alpha).
- For more information, see the OpenGL ES 2.0 documentation for
+ For more information, see the OpenGL ES 3.X documentation for
\l{https://www.khronos.org/registry/OpenGL-Refpages/es3/html/glClearColor.xhtml}{glClearColor()}.
\since 5.3
@@ -625,7 +609,7 @@ void QOpenGLFunctions::initializeOpenGLFunctions()
Convenience function that calls glClearStencil(\a s).
- For more information, see the OpenGL ES 2.0 documentation for
+ For more information, see the OpenGL ES 3.X documentation for
\l{https://www.khronos.org/registry/OpenGL-Refpages/es3/html/glClearStencil.xhtml}{glClearStencil()}.
\since 5.3
@@ -636,7 +620,7 @@ void QOpenGLFunctions::initializeOpenGLFunctions()
Convenience function that calls glColorMask(\a red, \a green, \a blue, \a alpha).
- For more information, see the OpenGL ES 2.0 documentation for
+ For more information, see the OpenGL ES 3.X documentation for
\l{https://www.khronos.org/registry/OpenGL-Refpages/es3/html/glColorMask.xhtml}{glColorMask()}.
\since 5.3
@@ -647,7 +631,7 @@ void QOpenGLFunctions::initializeOpenGLFunctions()
Convenience function that calls glCopyTexImage2D(\a target, \a level, \a internalformat, \a x, \a y, \a width, \a height, \a border).
- For more information, see the OpenGL ES 2.0 documentation for
+ For more information, see the OpenGL ES 3.X documentation for
\l{https://www.khronos.org/registry/OpenGL-Refpages/es3/html/glCopyTexImage2D.xhtml}{glCopyTexImage2D()}.
\since 5.3
@@ -658,7 +642,7 @@ void QOpenGLFunctions::initializeOpenGLFunctions()
Convenience function that calls glCopyTexSubImage2D(\a target, \a level, \a xoffset, \a yoffset, \a x, \a y, \a width, \a height).
- For more information, see the OpenGL ES 2.0 documentation for
+ For more information, see the OpenGL ES 3.X documentation for
\l{https://www.khronos.org/registry/OpenGL-Refpages/es3/html/glCopyTexSubImage2D.xhtml}{glCopyTexSubImage2D()}.
\since 5.3
@@ -669,7 +653,7 @@ void QOpenGLFunctions::initializeOpenGLFunctions()
Convenience function that calls glCullFace(\a mode).
- For more information, see the OpenGL ES 2.0 documentation for
+ For more information, see the OpenGL ES 3.X documentation for
\l{https://www.khronos.org/registry/OpenGL-Refpages/es3/html/glCullFace.xhtml}{glCullFace()}.
\since 5.3
@@ -680,7 +664,7 @@ void QOpenGLFunctions::initializeOpenGLFunctions()
Convenience function that calls glDeleteTextures(\a n, \a textures).
- For more information, see the OpenGL ES 2.0 documentation for
+ For more information, see the OpenGL ES 3.X documentation for
\l{https://www.khronos.org/registry/OpenGL-Refpages/es3/html/glDeleteTextures.xhtml}{glDeleteTextures()}.
\since 5.3
@@ -691,7 +675,7 @@ void QOpenGLFunctions::initializeOpenGLFunctions()
Convenience function that calls glDepthFunc(\a func).
- For more information, see the OpenGL ES 2.0 documentation for
+ For more information, see the OpenGL ES 3.X documentation for
\l{https://www.khronos.org/registry/OpenGL-Refpages/es3/html/glDepthFunc.xhtml}{glDepthFunc()}.
\since 5.3
@@ -702,7 +686,7 @@ void QOpenGLFunctions::initializeOpenGLFunctions()
Convenience function that calls glDepthMask(\a flag).
- For more information, see the OpenGL ES 2.0 documentation for
+ For more information, see the OpenGL ES 3.X documentation for
\l{https://www.khronos.org/registry/OpenGL-Refpages/es3/html/glDepthMask.xhtml}{glDepthMask()}.
\since 5.3
@@ -713,8 +697,8 @@ void QOpenGLFunctions::initializeOpenGLFunctions()
Convenience function that calls glDisable(\a cap).
- For more information, see the OpenGL ES 2.0 documentation for
- \l{https://www.khronos.org/registry/OpenGL-Refpages/es3/html/glDisable.xhtml}{glDisable()}.
+ For more information, see the OpenGL ES 3.X documentation for
+ \l{https://www.khronos.org/registry/OpenGL-Refpages/es3/html/glEnable.xhtml}{glDisable()}.
\since 5.3
*/
@@ -724,7 +708,7 @@ void QOpenGLFunctions::initializeOpenGLFunctions()
Convenience function that calls glDrawArrays(\a mode, \a first, \a count).
- For more information, see the OpenGL ES 2.0 documentation for
+ For more information, see the OpenGL ES 3.X documentation for
\l{https://www.khronos.org/registry/OpenGL-Refpages/es3/html/glDrawArrays.xhtml}{glDrawArrays()}.
\since 5.3
@@ -735,7 +719,7 @@ void QOpenGLFunctions::initializeOpenGLFunctions()
Convenience function that calls glDrawElements(\a mode, \a count, \a type, \a indices).
- For more information, see the OpenGL ES 2.0 documentation for
+ For more information, see the OpenGL ES 3.X documentation for
\l{https://www.khronos.org/registry/OpenGL-Refpages/es3/html/glDrawElements.xhtml}{glDrawElements()}.
\since 5.3
@@ -746,7 +730,7 @@ void QOpenGLFunctions::initializeOpenGLFunctions()
Convenience function that calls glEnable(\a cap).
- For more information, see the OpenGL ES 2.0 documentation for
+ For more information, see the OpenGL ES 3.X documentation for
\l{https://www.khronos.org/registry/OpenGL-Refpages/es3/html/glEnable.xhtml}{glEnable()}.
\since 5.3
@@ -757,7 +741,7 @@ void QOpenGLFunctions::initializeOpenGLFunctions()
Convenience function that calls glFinish().
- For more information, see the OpenGL ES 2.0 documentation for
+ For more information, see the OpenGL ES 3.X documentation for
\l{https://www.khronos.org/registry/OpenGL-Refpages/es3/html/glFinish.xhtml}{glFinish()}.
\since 5.3
@@ -768,7 +752,7 @@ void QOpenGLFunctions::initializeOpenGLFunctions()
Convenience function that calls glFlush().
- For more information, see the OpenGL ES 2.0 documentation for
+ For more information, see the OpenGL ES 3.X documentation for
\l{https://www.khronos.org/registry/OpenGL-Refpages/es3/html/glFlush.xhtml}{glFlush()}.
\since 5.3
@@ -779,7 +763,7 @@ void QOpenGLFunctions::initializeOpenGLFunctions()
Convenience function that calls glFrontFace(\a mode).
- For more information, see the OpenGL ES 2.0 documentation for
+ For more information, see the OpenGL ES 3.X documentation for
\l{https://www.khronos.org/registry/OpenGL-Refpages/es3/html/glFrontFace.xhtml}{glFrontFace()}.
\since 5.3
@@ -790,7 +774,7 @@ void QOpenGLFunctions::initializeOpenGLFunctions()
Convenience function that calls glGenTextures(\a n, \a textures).
- For more information, see the OpenGL ES 2.0 documentation for
+ For more information, see the OpenGL ES 3.X documentation for
\l{https://www.khronos.org/registry/OpenGL-Refpages/es3/html/glGenTextures.xhtml}{glGenTextures()}.
\since 5.3
@@ -801,7 +785,7 @@ void QOpenGLFunctions::initializeOpenGLFunctions()
Convenience function that calls glGetBooleanv(\a pname, \a params).
- For more information, see the OpenGL ES 2.0 documentation for
+ For more information, see the OpenGL ES 3.X documentation for
\l{https://www.khronos.org/registry/OpenGL-Refpages/es3/html/glGet.xhtml}{glGetBooleanv()}.
\since 5.3
@@ -812,7 +796,7 @@ void QOpenGLFunctions::initializeOpenGLFunctions()
Convenience function that calls glGetError().
- For more information, see the OpenGL ES 2.0 documentation for
+ For more information, see the OpenGL ES 3.X documentation for
\l{https://www.khronos.org/registry/OpenGL-Refpages/es3/html/glGetError.xhtml}{glGetError()}.
\since 5.3
@@ -823,7 +807,7 @@ void QOpenGLFunctions::initializeOpenGLFunctions()
Convenience function that calls glGetFloatv(\a pname, \a params).
- For more information, see the OpenGL ES 2.0 documentation for
+ For more information, see the OpenGL ES 3.X documentation for
\l{https://www.khronos.org/registry/OpenGL-Refpages/es3/html/glGet.xhtml}{glGetFloatv()}.
\since 5.3
@@ -834,7 +818,7 @@ void QOpenGLFunctions::initializeOpenGLFunctions()
Convenience function that calls glGetIntegerv(\a pname, \a params).
- For more information, see the OpenGL ES 2.0 documentation for
+ For more information, see the OpenGL ES 3.X documentation for
\l{https://www.khronos.org/registry/OpenGL-Refpages/es3/html/glGet.xhtml}{glGetIntegerv()}.
\since 5.3
@@ -845,7 +829,7 @@ void QOpenGLFunctions::initializeOpenGLFunctions()
Convenience function that calls glGetString(\a name).
- For more information, see the OpenGL ES 2.0 documentation for
+ For more information, see the OpenGL ES 3.X documentation for
\l{https://www.khronos.org/registry/OpenGL-Refpages/es3/html/glGetString.xhtml}{glGetString()}.
\since 5.3
@@ -856,7 +840,7 @@ void QOpenGLFunctions::initializeOpenGLFunctions()
Convenience function that calls glGetTexParameterfv(\a target, \a pname, \a params).
- For more information, see the OpenGL ES 2.0 documentation for
+ For more information, see the OpenGL ES 3.X documentation for
\l{https://www.khronos.org/registry/OpenGL-Refpages/es3/html/glGetTexParameter.xhtml}{glGetTexParameterfv()}.
\since 5.3
@@ -867,7 +851,7 @@ void QOpenGLFunctions::initializeOpenGLFunctions()
Convenience function that calls glGetTexParameteriv(\a target, \a pname, \a params).
- For more information, see the OpenGL ES 2.0 documentation for
+ For more information, see the OpenGL ES 3.X documentation for
\l{https://www.khronos.org/registry/OpenGL-Refpages/es3/html/glGetTexParameter.xhtml}{glGetTexParameteriv()}.
\since 5.3
@@ -878,7 +862,7 @@ void QOpenGLFunctions::initializeOpenGLFunctions()
Convenience function that calls glHint(\a target, \a mode).
- For more information, see the OpenGL ES 2.0 documentation for
+ For more information, see the OpenGL ES 3.X documentation for
\l{https://www.khronos.org/registry/OpenGL-Refpages/es3/html/glHint.xhtml}{glHint()}.
\since 5.3
@@ -889,7 +873,7 @@ void QOpenGLFunctions::initializeOpenGLFunctions()
Convenience function that calls glIsEnabled(\a cap).
- For more information, see the OpenGL ES 2.0 documentation for
+ For more information, see the OpenGL ES 3.X documentation for
\l{https://www.khronos.org/registry/OpenGL-Refpages/es3/html/glIsEnabled.xhtml}{glIsEnabled()}.
\since 5.3
@@ -900,7 +884,7 @@ void QOpenGLFunctions::initializeOpenGLFunctions()
Convenience function that calls glIsTexture(\a texture).
- For more information, see the OpenGL ES 2.0 documentation for
+ For more information, see the OpenGL ES 3.X documentation for
\l{https://www.khronos.org/registry/OpenGL-Refpages/es3/html/glIsTexture.xhtml}{glIsTexture()}.
\since 5.3
@@ -911,7 +895,7 @@ void QOpenGLFunctions::initializeOpenGLFunctions()
Convenience function that calls glLineWidth(\a width).
- For more information, see the OpenGL ES 2.0 documentation for
+ For more information, see the OpenGL ES 3.X documentation for
\l{https://www.khronos.org/registry/OpenGL-Refpages/es3/html/glLineWidth.xhtml}{glLineWidth()}.
\since 5.3
@@ -922,7 +906,7 @@ void QOpenGLFunctions::initializeOpenGLFunctions()
Convenience function that calls glPixelStorei(\a pname, \a param).
- For more information, see the OpenGL ES 2.0 documentation for
+ For more information, see the OpenGL ES 3.X documentation for
\l{https://www.khronos.org/registry/OpenGL-Refpages/es3/html/glPixelStorei.xhtml}{glPixelStorei()}.
\since 5.3
@@ -933,7 +917,7 @@ void QOpenGLFunctions::initializeOpenGLFunctions()
Convenience function that calls glPolygonOffset(\a factor, \a units).
- For more information, see the OpenGL ES 2.0 documentation for
+ For more information, see the OpenGL ES 3.X documentation for
\l{https://www.khronos.org/registry/OpenGL-Refpages/es3/html/glPolygonOffset.xhtml}{glPolygonOffset()}.
\since 5.3
@@ -944,7 +928,7 @@ void QOpenGLFunctions::initializeOpenGLFunctions()
Convenience function that calls glReadPixels(\a x, \a y, \a width, \a height, \a format, \a type, \a pixels).
- For more information, see the OpenGL ES 2.0 documentation for
+ For more information, see the OpenGL ES 3.X documentation for
\l{https://www.khronos.org/registry/OpenGL-Refpages/es3/html/glReadPixels.xhtml}{glReadPixels()}.
\since 5.3
@@ -955,7 +939,7 @@ void QOpenGLFunctions::initializeOpenGLFunctions()
Convenience function that calls glScissor(\a x, \a y, \a width, \a height).
- For more information, see the OpenGL ES 2.0 documentation for
+ For more information, see the OpenGL ES 3.X documentation for
\l{https://www.khronos.org/registry/OpenGL-Refpages/es3/html/glScissor.xhtml}{glScissor()}.
\since 5.3
@@ -966,7 +950,7 @@ void QOpenGLFunctions::initializeOpenGLFunctions()
Convenience function that calls glStencilFunc(\a func, \a ref, \a mask).
- For more information, see the OpenGL ES 2.0 documentation for
+ For more information, see the OpenGL ES 3.X documentation for
\l{https://www.khronos.org/registry/OpenGL-Refpages/es3/html/glStencilFunc.xhtml}{glStencilFunc()}.
\since 5.3
@@ -977,7 +961,7 @@ void QOpenGLFunctions::initializeOpenGLFunctions()
Convenience function that calls glStencilMask(\a mask).
- For more information, see the OpenGL ES 2.0 documentation for
+ For more information, see the OpenGL ES 3.X documentation for
\l{https://www.khronos.org/registry/OpenGL-Refpages/es3/html/glStencilMask.xhtml}{glStencilMask()}.
\since 5.3
@@ -988,7 +972,7 @@ void QOpenGLFunctions::initializeOpenGLFunctions()
Convenience function that calls glStencilOp(\a fail, \a zfail, \a zpass).
- For more information, see the OpenGL ES 2.0 documentation for
+ For more information, see the OpenGL ES 3.X documentation for
\l{https://www.khronos.org/registry/OpenGL-Refpages/es3/html/glStencilOp.xhtml}{glStencilOp()}.
\since 5.3
@@ -999,7 +983,7 @@ void QOpenGLFunctions::initializeOpenGLFunctions()
Convenience function that calls glTexImage2D(\a target, \a level, \a internalformat, \a width, \a height, \a border, \a format, \a type, \a pixels).
- For more information, see the OpenGL ES 2.0 documentation for
+ For more information, see the OpenGL ES 3.X documentation for
\l{https://www.khronos.org/registry/OpenGL-Refpages/es3/html/glTexImage2D.xhtml}{glTexImage2D()}.
\since 5.3
@@ -1010,7 +994,7 @@ void QOpenGLFunctions::initializeOpenGLFunctions()
Convenience function that calls glTexParameterf(\a target, \a pname, \a param).
- For more information, see the OpenGL ES 2.0 documentation for
+ For more information, see the OpenGL ES 3.X documentation for
\l{https://www.khronos.org/registry/OpenGL-Refpages/es3/html/glTexParameter.xhtml}{glTexParameterf()}.
\since 5.3
@@ -1021,7 +1005,7 @@ void QOpenGLFunctions::initializeOpenGLFunctions()
Convenience function that calls glTexParameterfv(\a target, \a pname, \a params).
- For more information, see the OpenGL ES 2.0 documentation for
+ For more information, see the OpenGL ES 3.X documentation for
\l{https://www.khronos.org/registry/OpenGL-Refpages/es3/html/glTexParameter.xhtml}{glTexParameterfv()}.
\since 5.3
@@ -1032,7 +1016,7 @@ void QOpenGLFunctions::initializeOpenGLFunctions()
Convenience function that calls glTexParameteri(\a target, \a pname, \a param).
- For more information, see the OpenGL ES 2.0 documentation for
+ For more information, see the OpenGL ES 3.X documentation for
\l{https://www.khronos.org/registry/OpenGL-Refpages/es3/html/glTexParameter.xhtml}{glTexParameteri()}.
\since 5.3
@@ -1043,7 +1027,7 @@ void QOpenGLFunctions::initializeOpenGLFunctions()
Convenience function that calls glTexParameteriv(\a target, \a pname, \a params).
- For more information, see the OpenGL ES 2.0 documentation for
+ For more information, see the OpenGL ES 3.X documentation for
\l{https://www.khronos.org/registry/OpenGL-Refpages/es3/html/glTexParameter.xhtml}{glTexParameteriv()}.
\since 5.3
@@ -1054,7 +1038,7 @@ void QOpenGLFunctions::initializeOpenGLFunctions()
Convenience function that calls glTexSubImage2D(\a target, \a level, \a xoffset, \a yoffset, \a width, \a height, \a format, \a type, \a pixels).
- For more information, see the OpenGL ES 2.0 documentation for
+ For more information, see the OpenGL ES 3.X documentation for
\l{https://www.khronos.org/registry/OpenGL-Refpages/es3/html/glTexSubImage2D.xhtml}{glTexSubImage2D()}.
\since 5.3
@@ -1065,7 +1049,7 @@ void QOpenGLFunctions::initializeOpenGLFunctions()
Convenience function that calls glViewport(\a x, \a y, \a width, \a height).
- For more information, see the OpenGL ES 2.0 documentation for
+ For more information, see the OpenGL ES 3.X documentation for
\l{https://www.khronos.org/registry/OpenGL-Refpages/es3/html/glViewport.xhtml}{glViewport()}.
\since 5.3
@@ -1076,7 +1060,7 @@ void QOpenGLFunctions::initializeOpenGLFunctions()
Convenience function that calls glActiveTexture(\a texture).
- For more information, see the OpenGL ES 2.0 documentation for
+ For more information, see the OpenGL ES 3.X documentation for
\l{https://www.khronos.org/registry/OpenGL-Refpages/es3/html/glActiveTexture.xhtml}{glActiveTexture()}.
*/
@@ -1085,7 +1069,7 @@ void QOpenGLFunctions::initializeOpenGLFunctions()
Convenience function that calls glAttachShader(\a program, \a shader).
- For more information, see the OpenGL ES 2.0 documentation for
+ For more information, see the OpenGL ES 3.X documentation for
\l{https://www.khronos.org/registry/OpenGL-Refpages/es3/html/glAttachShader.xhtml}{glAttachShader()}.
This convenience function will do nothing on OpenGL ES 1.x systems.
@@ -1096,7 +1080,7 @@ void QOpenGLFunctions::initializeOpenGLFunctions()
Convenience function that calls glBindAttribLocation(\a program, \a index, \a name).
- For more information, see the OpenGL ES 2.0 documentation for
+ For more information, see the OpenGL ES 3.X documentation for
\l{https://www.khronos.org/registry/OpenGL-Refpages/es3/html/glBindAttribLocation.xhtml}{glBindAttribLocation()}.
This convenience function will do nothing on OpenGL ES 1.x systems.
@@ -1107,7 +1091,7 @@ void QOpenGLFunctions::initializeOpenGLFunctions()
Convenience function that calls glBindBuffer(\a target, \a buffer).
- For more information, see the OpenGL ES 2.0 documentation for
+ For more information, see the OpenGL ES 3.X documentation for
\l{https://www.khronos.org/registry/OpenGL-Refpages/es3/html/glBindBuffer.xhtml}{glBindBuffer()}.
*/
@@ -1119,7 +1103,7 @@ void QOpenGLFunctions::initializeOpenGLFunctions()
Note that Qt will translate a \a framebuffer argument of 0 to the currently
bound QOpenGLContext's defaultFramebufferObject().
- For more information, see the OpenGL ES 2.0 documentation for
+ For more information, see the OpenGL ES 3.X documentation for
\l{https://www.khronos.org/registry/OpenGL-Refpages/es3/html/glBindFramebuffer.xhtml}{glBindFramebuffer()}.
*/
@@ -1128,7 +1112,7 @@ void QOpenGLFunctions::initializeOpenGLFunctions()
Convenience function that calls glBindRenderbuffer(\a target, \a renderbuffer).
- For more information, see the OpenGL ES 2.0 documentation for
+ For more information, see the OpenGL ES 3.X documentation for
\l{https://www.khronos.org/registry/OpenGL-Refpages/es3/html/glBindRenderbuffer.xhtml}{glBindRenderbuffer()}.
*/
@@ -1137,7 +1121,7 @@ void QOpenGLFunctions::initializeOpenGLFunctions()
Convenience function that calls glBlendColor(\a red, \a green, \a blue, \a alpha).
- For more information, see the OpenGL ES 2.0 documentation for
+ For more information, see the OpenGL ES 3.X documentation for
\l{https://www.khronos.org/registry/OpenGL-Refpages/es3/html/glBlendColor.xhtml}{glBlendColor()}.
*/
@@ -1146,7 +1130,7 @@ void QOpenGLFunctions::initializeOpenGLFunctions()
Convenience function that calls glBlendEquation(\a mode).
- For more information, see the OpenGL ES 2.0 documentation for
+ For more information, see the OpenGL ES 3.X documentation for
\l{https://www.khronos.org/registry/OpenGL-Refpages/es3/html/glBlendEquation.xhtml}{glBlendEquation()}.
*/
@@ -1155,7 +1139,7 @@ void QOpenGLFunctions::initializeOpenGLFunctions()
Convenience function that calls glBlendEquationSeparate(\a modeRGB, \a modeAlpha).
- For more information, see the OpenGL ES 2.0 documentation for
+ For more information, see the OpenGL ES 3.X documentation for
\l{https://www.khronos.org/registry/OpenGL-Refpages/es3/html/glBlendEquationSeparate.xhtml}{glBlendEquationSeparate()}.
*/
@@ -1164,7 +1148,7 @@ void QOpenGLFunctions::initializeOpenGLFunctions()
Convenience function that calls glBlendFuncSeparate(\a srcRGB, \a dstRGB, \a srcAlpha, \a dstAlpha).
- For more information, see the OpenGL ES 2.0 documentation for
+ For more information, see the OpenGL ES 3.X documentation for
\l{https://www.khronos.org/registry/OpenGL-Refpages/es3/html/glBlendFuncSeparate.xhtml}{glBlendFuncSeparate()}.
*/
@@ -1173,7 +1157,7 @@ void QOpenGLFunctions::initializeOpenGLFunctions()
Convenience function that calls glBufferData(\a target, \a size, \a data, \a usage).
- For more information, see the OpenGL ES 2.0 documentation for
+ For more information, see the OpenGL ES 3.X documentation for
\l{https://www.khronos.org/registry/OpenGL-Refpages/es3/html/glBufferData.xhtml}{glBufferData()}.
*/
@@ -1182,7 +1166,7 @@ void QOpenGLFunctions::initializeOpenGLFunctions()
Convenience function that calls glBufferSubData(\a target, \a offset, \a size, \a data).
- For more information, see the OpenGL ES 2.0 documentation for
+ For more information, see the OpenGL ES 3.X documentation for
\l{https://www.khronos.org/registry/OpenGL-Refpages/es3/html/glBufferSubData.xhtml}{glBufferSubData()}.
*/
@@ -1191,7 +1175,7 @@ void QOpenGLFunctions::initializeOpenGLFunctions()
Convenience function that calls glCheckFramebufferStatus(\a target).
- For more information, see the OpenGL ES 2.0 documentation for
+ For more information, see the OpenGL ES 3.X documentation for
\l{https://www.khronos.org/registry/OpenGL-Refpages/es3/html/glCheckFramebufferStatus.xhtml}{glCheckFramebufferStatus()}.
*/
@@ -1202,7 +1186,7 @@ void QOpenGLFunctions::initializeOpenGLFunctions()
desktop OpenGL systems and glClearDepthf(\a depth) on
embedded OpenGL ES systems.
- For more information, see the OpenGL ES 2.0 documentation for
+ For more information, see the OpenGL ES 3.X documentation for
\l{https://www.khronos.org/registry/OpenGL-Refpages/es3/html/glClearDepthf.xhtml}{glClearDepthf()}.
*/
@@ -1211,7 +1195,7 @@ void QOpenGLFunctions::initializeOpenGLFunctions()
Convenience function that calls glCompileShader(\a shader).
- For more information, see the OpenGL ES 2.0 documentation for
+ For more information, see the OpenGL ES 3.X documentation for
\l{https://www.khronos.org/registry/OpenGL-Refpages/es3/html/glCompileShader.xhtml}{glCompileShader()}.
This convenience function will do nothing on OpenGL ES 1.x systems.
@@ -1222,7 +1206,7 @@ void QOpenGLFunctions::initializeOpenGLFunctions()
Convenience function that calls glCompressedTexImage2D(\a target, \a level, \a internalformat, \a width, \a height, \a border, \a imageSize, \a data).
- For more information, see the OpenGL ES 2.0 documentation for
+ For more information, see the OpenGL ES 3.X documentation for
\l{https://www.khronos.org/registry/OpenGL-Refpages/es3/html/glCompressedTexImage2D.xhtml}{glCompressedTexImage2D()}.
*/
@@ -1231,7 +1215,7 @@ void QOpenGLFunctions::initializeOpenGLFunctions()
Convenience function that calls glCompressedTexSubImage2D(\a target, \a level, \a xoffset, \a yoffset, \a width, \a height, \a format, \a imageSize, \a data).
- For more information, see the OpenGL ES 2.0 documentation for
+ For more information, see the OpenGL ES 3.X documentation for
\l{https://www.khronos.org/registry/OpenGL-Refpages/es3/html/glCompressedTexSubImage2D.xhtml}{glCompressedTexSubImage2D()}.
*/
@@ -1240,7 +1224,7 @@ void QOpenGLFunctions::initializeOpenGLFunctions()
Convenience function that calls glCreateProgram().
- For more information, see the OpenGL ES 2.0 documentation for
+ For more information, see the OpenGL ES 3.X documentation for
\l{https://www.khronos.org/registry/OpenGL-Refpages/es3/html/glCreateProgram.xhtml}{glCreateProgram()}.
This convenience function will do nothing on OpenGL ES 1.x systems.
@@ -1251,7 +1235,7 @@ void QOpenGLFunctions::initializeOpenGLFunctions()
Convenience function that calls glCreateShader(\a type).
- For more information, see the OpenGL ES 2.0 documentation for
+ For more information, see the OpenGL ES 3.X documentation for
\l{https://www.khronos.org/registry/OpenGL-Refpages/es3/html/glCreateShader.xhtml}{glCreateShader()}.
This convenience function will do nothing on OpenGL ES 1.x systems.
@@ -1262,7 +1246,7 @@ void QOpenGLFunctions::initializeOpenGLFunctions()
Convenience function that calls glDeleteBuffers(\a n, \a buffers).
- For more information, see the OpenGL ES 2.0 documentation for
+ For more information, see the OpenGL ES 3.X documentation for
\l{https://www.khronos.org/registry/OpenGL-Refpages/es3/html/glDeleteBuffers.xhtml}{glDeleteBuffers()}.
*/
@@ -1271,7 +1255,7 @@ void QOpenGLFunctions::initializeOpenGLFunctions()
Convenience function that calls glDeleteFramebuffers(\a n, \a framebuffers).
- For more information, see the OpenGL ES 2.0 documentation for
+ For more information, see the OpenGL ES 3.X documentation for
\l{https://www.khronos.org/registry/OpenGL-Refpages/es3/html/glDeleteFramebuffers.xhtml}{glDeleteFramebuffers()}.
*/
@@ -1280,7 +1264,7 @@ void QOpenGLFunctions::initializeOpenGLFunctions()
Convenience function that calls glDeleteProgram(\a program).
- For more information, see the OpenGL ES 2.0 documentation for
+ For more information, see the OpenGL ES 3.X documentation for
\l{https://www.khronos.org/registry/OpenGL-Refpages/es3/html/glDeleteProgram.xhtml}{glDeleteProgram()}.
This convenience function will do nothing on OpenGL ES 1.x systems.
@@ -1291,7 +1275,7 @@ void QOpenGLFunctions::initializeOpenGLFunctions()
Convenience function that calls glDeleteRenderbuffers(\a n, \a renderbuffers).
- For more information, see the OpenGL ES 2.0 documentation for
+ For more information, see the OpenGL ES 3.X documentation for
\l{https://www.khronos.org/registry/OpenGL-Refpages/es3/html/glDeleteRenderbuffers.xhtml}{glDeleteRenderbuffers()}.
*/
@@ -1300,7 +1284,7 @@ void QOpenGLFunctions::initializeOpenGLFunctions()
Convenience function that calls glDeleteShader(\a shader).
- For more information, see the OpenGL ES 2.0 documentation for
+ For more information, see the OpenGL ES 3.X documentation for
\l{https://www.khronos.org/registry/OpenGL-Refpages/es3/html/glDeleteShader.xhtml}{glDeleteShader()}.
This convenience function will do nothing on OpenGL ES 1.x systems.
@@ -1313,7 +1297,7 @@ void QOpenGLFunctions::initializeOpenGLFunctions()
desktop OpenGL systems and glDepthRangef(\a zNear, \a zFar) on
embedded OpenGL ES systems.
- For more information, see the OpenGL ES 2.0 documentation for
+ For more information, see the OpenGL ES 3.X documentation for
\l{https://www.khronos.org/registry/OpenGL-Refpages/es3/html/glDepthRangef.xhtml}{glDepthRangef()}.
*/
@@ -1322,7 +1306,7 @@ void QOpenGLFunctions::initializeOpenGLFunctions()
Convenience function that calls glDetachShader(\a program, \a shader).
- For more information, see the OpenGL ES 2.0 documentation for
+ For more information, see the OpenGL ES 3.X documentation for
\l{https://www.khronos.org/registry/OpenGL-Refpages/es3/html/glDetachShader.xhtml}{glDetachShader()}.
This convenience function will do nothing on OpenGL ES 1.x systems.
@@ -1333,8 +1317,8 @@ void QOpenGLFunctions::initializeOpenGLFunctions()
Convenience function that calls glDisableVertexAttribArray(\a index).
- For more information, see the OpenGL ES 2.0 documentation for
- \l{https://www.khronos.org/registry/OpenGL-Refpages/es2.0/html/glDisableVertexAttribArray.xhtml}{glDisableVertexAttribArray()}.
+ For more information, see the OpenGL ES 3.X documentation for
+ \l{https://www.khronos.org/registry/OpenGL-Refpages/es3/html/glEnableVertexAttribArray.xhtml}{glDisableVertexAttribArray()}.
This convenience function will do nothing on OpenGL ES 1.x systems.
*/
@@ -1344,7 +1328,7 @@ void QOpenGLFunctions::initializeOpenGLFunctions()
Convenience function that calls glEnableVertexAttribArray(\a index).
- For more information, see the OpenGL ES 2.0 documentation for
+ For more information, see the OpenGL ES 3.X documentation for
\l{https://www.khronos.org/registry/OpenGL-Refpages/es3/html/glEnableVertexAttribArray.xhtml}{glEnableVertexAttribArray()}.
This convenience function will do nothing on OpenGL ES 1.x systems.
@@ -1355,7 +1339,7 @@ void QOpenGLFunctions::initializeOpenGLFunctions()
Convenience function that calls glFramebufferRenderbuffer(\a target, \a attachment, \a renderbuffertarget, \a renderbuffer).
- For more information, see the OpenGL ES 2.0 documentation for
+ For more information, see the OpenGL ES 3.X documentation for
\l{https://www.khronos.org/registry/OpenGL-Refpages/es3/html/glFramebufferRenderbuffer.xhtml}{glFramebufferRenderbuffer()}.
*/
@@ -1364,7 +1348,7 @@ void QOpenGLFunctions::initializeOpenGLFunctions()
Convenience function that calls glFramebufferTexture2D(\a target, \a attachment, \a textarget, \a texture, \a level).
- For more information, see the OpenGL ES 2.0 documentation for
+ For more information, see the OpenGL ES 3.X documentation for
\l{https://www.khronos.org/registry/OpenGL-Refpages/es3/html/glFramebufferTexture2D.xhtml}{glFramebufferTexture2D()}.
*/
@@ -1373,7 +1357,7 @@ void QOpenGLFunctions::initializeOpenGLFunctions()
Convenience function that calls glGenBuffers(\a n, \a buffers).
- For more information, see the OpenGL ES 2.0 documentation for
+ For more information, see the OpenGL ES 3.X documentation for
\l{https://www.khronos.org/registry/OpenGL-Refpages/es3/html/glGenBuffers.xhtml}{glGenBuffers()}.
*/
@@ -1382,7 +1366,7 @@ void QOpenGLFunctions::initializeOpenGLFunctions()
Convenience function that calls glGenerateMipmap(\a target).
- For more information, see the OpenGL ES 2.0 documentation for
+ For more information, see the OpenGL ES 3.X documentation for
\l{https://www.khronos.org/registry/OpenGL-Refpages/es3/html/glGenerateMipmap.xhtml}{glGenerateMipmap()}.
*/
@@ -1391,7 +1375,7 @@ void QOpenGLFunctions::initializeOpenGLFunctions()
Convenience function that calls glGenFramebuffers(\a n, \a framebuffers).
- For more information, see the OpenGL ES 2.0 documentation for
+ For more information, see the OpenGL ES 3.X documentation for
\l{https://www.khronos.org/registry/OpenGL-Refpages/es3/html/glGenFramebuffers.xhtml}{glGenFramebuffers()}.
*/
@@ -1400,7 +1384,7 @@ void QOpenGLFunctions::initializeOpenGLFunctions()
Convenience function that calls glGenRenderbuffers(\a n, \a renderbuffers).
- For more information, see the OpenGL ES 2.0 documentation for
+ For more information, see the OpenGL ES 3.X documentation for
\l{https://www.khronos.org/registry/OpenGL-Refpages/es3/html/glGenRenderbuffers.xhtml}{glGenRenderbuffers()}.
*/
@@ -1409,7 +1393,7 @@ void QOpenGLFunctions::initializeOpenGLFunctions()
Convenience function that calls glGetActiveAttrib(\a program, \a index, \a bufsize, \a length, \a size, \a type, \a name).
- For more information, see the OpenGL ES 2.0 documentation for
+ For more information, see the OpenGL ES 3.X documentation for
\l{https://www.khronos.org/registry/OpenGL-Refpages/es3/html/glGetActiveAttrib.xhtml}{glGetActiveAttrib()}.
This convenience function will do nothing on OpenGL ES 1.x systems.
@@ -1420,7 +1404,7 @@ void QOpenGLFunctions::initializeOpenGLFunctions()
Convenience function that calls glGetActiveUniform(\a program, \a index, \a bufsize, \a length, \a size, \a type, \a name).
- For more information, see the OpenGL ES 2.0 documentation for
+ For more information, see the OpenGL ES 3.X documentation for
\l{https://www.khronos.org/registry/OpenGL-Refpages/es3/html/glGetActiveUniform.xhtml}{glGetActiveUniform()}.
This convenience function will do nothing on OpenGL ES 1.x systems.
@@ -1431,7 +1415,7 @@ void QOpenGLFunctions::initializeOpenGLFunctions()
Convenience function that calls glGetAttachedShaders(\a program, \a maxcount, \a count, \a shaders).
- For more information, see the OpenGL ES 2.0 documentation for
+ For more information, see the OpenGL ES 3.X documentation for
\l{https://www.khronos.org/registry/OpenGL-Refpages/es3/html/glGetAttachedShaders.xhtml}{glGetAttachedShaders()}.
This convenience function will do nothing on OpenGL ES 1.x systems.
@@ -1442,7 +1426,7 @@ void QOpenGLFunctions::initializeOpenGLFunctions()
Convenience function that calls glGetAttribLocation(\a program, \a name).
- For more information, see the OpenGL ES 2.0 documentation for
+ For more information, see the OpenGL ES 3.X documentation for
\l{https://www.khronos.org/registry/OpenGL-Refpages/es3/html/glGetAttribLocation.xhtml}{glGetAttribLocation()}.
This convenience function will do nothing on OpenGL ES 1.x systems.
@@ -1453,8 +1437,8 @@ void QOpenGLFunctions::initializeOpenGLFunctions()
Convenience function that calls glGetBufferParameteriv(\a target, \a pname, \a params).
- For more information, see the OpenGL ES 2.0 documentation for
- \l{https://www.khronos.org/registry/OpenGL-Refpages/es3/html/glGetBufferParameteriv.xhtml}{glGetBufferParameteriv()}.
+ For more information, see the OpenGL ES 3.X documentation for
+ \l{https://www.khronos.org/registry/OpenGL-Refpages/es3/html/glGetBufferParameter.xhtml}{glGetBufferParameteriv()}.
*/
/*!
@@ -1462,7 +1446,7 @@ void QOpenGLFunctions::initializeOpenGLFunctions()
Convenience function that calls glGetFramebufferAttachmentParameteriv(\a target, \a attachment, \a pname, \a params).
- For more information, see the OpenGL ES 2.0 documentation for
+ For more information, see the OpenGL ES 3.X documentation for
\l{https://www.khronos.org/registry/OpenGL-Refpages/es3/html/glGetFramebufferAttachmentParameteriv.xhtml}{glGetFramebufferAttachmentParameteriv()}.
*/
@@ -1471,7 +1455,7 @@ void QOpenGLFunctions::initializeOpenGLFunctions()
Convenience function that calls glGetProgramiv(\a program, \a pname, \a params).
- For more information, see the OpenGL ES 2.0 documentation for
+ For more information, see the OpenGL ES 3.X documentation for
\l{https://www.khronos.org/registry/OpenGL-Refpages/es3/html/glGetProgramiv.xhtml}{glGetProgramiv()}.
This convenience function will do nothing on OpenGL ES 1.x systems.
@@ -1482,7 +1466,7 @@ void QOpenGLFunctions::initializeOpenGLFunctions()
Convenience function that calls glGetProgramInfoLog(\a program, \a bufsize, \a length, \a infolog).
- For more information, see the OpenGL ES 2.0 documentation for
+ For more information, see the OpenGL ES 3.X documentation for
\l{https://www.khronos.org/registry/OpenGL-Refpages/es3/html/glGetProgramInfoLog.xhtml}{glGetProgramInfoLog()}.
This convenience function will do nothing on OpenGL ES 1.x systems.
@@ -1493,7 +1477,7 @@ void QOpenGLFunctions::initializeOpenGLFunctions()
Convenience function that calls glGetRenderbufferParameteriv(\a target, \a pname, \a params).
- For more information, see the OpenGL ES 2.0 documentation for
+ For more information, see the OpenGL ES 3.X documentation for
\l{https://www.khronos.org/registry/OpenGL-Refpages/es3/html/glGetRenderbufferParameteriv.xhtml}{glGetRenderbufferParameteriv()}.
*/
@@ -1502,7 +1486,7 @@ void QOpenGLFunctions::initializeOpenGLFunctions()
Convenience function that calls glGetShaderiv(\a shader, \a pname, \a params).
- For more information, see the OpenGL ES 2.0 documentation for
+ For more information, see the OpenGL ES 3.X documentation for
\l{https://www.khronos.org/registry/OpenGL-Refpages/es3/html/glGetShaderiv.xhtml}{glGetShaderiv()}.
This convenience function will do nothing on OpenGL ES 1.x systems.
@@ -1513,7 +1497,7 @@ void QOpenGLFunctions::initializeOpenGLFunctions()
Convenience function that calls glGetShaderInfoLog(\a shader, \a bufsize, \a length, \a infolog).
- For more information, see the OpenGL ES 2.0 documentation for
+ For more information, see the OpenGL ES 3.X documentation for
\l{https://www.khronos.org/registry/OpenGL-Refpages/es3/html/glGetShaderInfoLog.xhtml}{glGetShaderInfoLog()}.
This convenience function will do nothing on OpenGL ES 1.x systems.
@@ -1524,7 +1508,7 @@ void QOpenGLFunctions::initializeOpenGLFunctions()
Convenience function that calls glGetShaderPrecisionFormat(\a shadertype, \a precisiontype, \a range, \a precision).
- For more information, see the OpenGL ES 2.0 documentation for
+ For more information, see the OpenGL ES 3.X documentation for
\l{https://www.khronos.org/registry/OpenGL-Refpages/es3/html/glGetShaderPrecisionFormat.xhtml}{glGetShaderPrecisionFormat()}.
This convenience function will do nothing on OpenGL ES 1.x systems.
@@ -1535,7 +1519,7 @@ void QOpenGLFunctions::initializeOpenGLFunctions()
Convenience function that calls glGetShaderSource(\a shader, \a bufsize, \a length, \a source).
- For more information, see the OpenGL ES 2.0 documentation for
+ For more information, see the OpenGL ES 3.X documentation for
\l{https://www.khronos.org/registry/OpenGL-Refpages/es3/html/glGetShaderSource.xhtml}{glGetShaderSource()}.
This convenience function will do nothing on OpenGL ES 1.x systems.
@@ -1546,7 +1530,7 @@ void QOpenGLFunctions::initializeOpenGLFunctions()
Convenience function that calls glGetUniformfv(\a program, \a location, \a params).
- For more information, see the OpenGL ES 2.0 documentation for
+ For more information, see the OpenGL ES 3.X documentation for
\l{https://www.khronos.org/registry/OpenGL-Refpages/es3/html/glGetUniform.xhtml}{glGetUniformfv()}.
This convenience function will do nothing on OpenGL ES 1.x systems.
@@ -1557,7 +1541,7 @@ void QOpenGLFunctions::initializeOpenGLFunctions()
Convenience function that calls glGetUniformiv(\a program, \a location, \a params).
- For more information, see the OpenGL ES 2.0 documentation for
+ For more information, see the OpenGL ES 3.X documentation for
\l{https://www.khronos.org/registry/OpenGL-Refpages/es3/html/glGetUniform.xhtml}{glGetUniformiv()}.
This convenience function will do nothing on OpenGL ES 1.x systems.
@@ -1568,7 +1552,7 @@ void QOpenGLFunctions::initializeOpenGLFunctions()
Convenience function that calls glGetUniformLocation(\a program, \a name).
- For more information, see the OpenGL ES 2.0 documentation for
+ For more information, see the OpenGL ES 3.X documentation for
\l{https://www.khronos.org/registry/OpenGL-Refpages/es3/html/glGetUniformLocation.xhtml}{glGetUniformLocation()}.
This convenience function will do nothing on OpenGL ES 1.x systems.
@@ -1579,8 +1563,8 @@ void QOpenGLFunctions::initializeOpenGLFunctions()
Convenience function that calls glGetVertexAttribfv(\a index, \a pname, \a params).
- For more information, see the OpenGL ES 2.0 documentation for
- \l{https://www.khronos.org/registry/OpenGL-Refpages/es3/html/glGetVertexAttribfv.xhtml}{glGetVertexAttribfv()}.
+ For more information, see the OpenGL ES 3.X documentation for
+ \l{https://www.khronos.org/registry/OpenGL-Refpages/es3/html/glGetVertexAttrib.xhtml}{glGetVertexAttribfv()}.
This convenience function will do nothing on OpenGL ES 1.x systems.
*/
@@ -1590,8 +1574,8 @@ void QOpenGLFunctions::initializeOpenGLFunctions()
Convenience function that calls glGetVertexAttribiv(\a index, \a pname, \a params).
- For more information, see the OpenGL ES 2.0 documentation for
- \l{https://www.khronos.org/registry/OpenGL-Refpages/es3/html/glGetVertexAttribiv.xhtml}{glGetVertexAttribiv()}.
+ For more information, see the OpenGL ES 3.X documentation for
+ \l{https://www.khronos.org/registry/OpenGL-Refpages/es3/html/glGetVertexAttrib.xhtml}{glGetVertexAttribiv()}.
This convenience function will do nothing on OpenGL ES 1.x systems.
*/
@@ -1601,7 +1585,7 @@ void QOpenGLFunctions::initializeOpenGLFunctions()
Convenience function that calls glGetVertexAttribPointerv(\a index, \a pname, \a pointer).
- For more information, see the OpenGL ES 2.0 documentation for
+ For more information, see the OpenGL ES 3.X documentation for
\l{https://www.khronos.org/registry/OpenGL-Refpages/es3/html/glGetVertexAttribPointerv.xhtml}{glGetVertexAttribPointerv()}.
This convenience function will do nothing on OpenGL ES 1.x systems.
@@ -1612,7 +1596,7 @@ void QOpenGLFunctions::initializeOpenGLFunctions()
Convenience function that calls glIsBuffer(\a buffer).
- For more information, see the OpenGL ES 2.0 documentation for
+ For more information, see the OpenGL ES 3.X documentation for
\l{https://www.khronos.org/registry/OpenGL-Refpages/es3/html/glIsBuffer.xhtml}{glIsBuffer()}.
*/
@@ -1621,7 +1605,7 @@ void QOpenGLFunctions::initializeOpenGLFunctions()
Convenience function that calls glIsFramebuffer(\a framebuffer).
- For more information, see the OpenGL ES 2.0 documentation for
+ For more information, see the OpenGL ES 3.X documentation for
\l{https://www.khronos.org/registry/OpenGL-Refpages/es3/html/glIsFramebuffer.xhtml}{glIsFramebuffer()}.
*/
@@ -1630,7 +1614,7 @@ void QOpenGLFunctions::initializeOpenGLFunctions()
Convenience function that calls glIsProgram(\a program).
- For more information, see the OpenGL ES 2.0 documentation for
+ For more information, see the OpenGL ES 3.X documentation for
\l{https://www.khronos.org/registry/OpenGL-Refpages/es3/html/glIsProgram.xhtml}{glIsProgram()}.
This convenience function will do nothing on OpenGL ES 1.x systems.
@@ -1641,7 +1625,7 @@ void QOpenGLFunctions::initializeOpenGLFunctions()
Convenience function that calls glIsRenderbuffer(\a renderbuffer).
- For more information, see the OpenGL ES 2.0 documentation for
+ For more information, see the OpenGL ES 3.X documentation for
\l{https://www.khronos.org/registry/OpenGL-Refpages/es3/html/glIsRenderbuffer.xhtml}{glIsRenderbuffer()}.
*/
@@ -1650,7 +1634,7 @@ void QOpenGLFunctions::initializeOpenGLFunctions()
Convenience function that calls glIsShader(\a shader).
- For more information, see the OpenGL ES 2.0 documentation for
+ For more information, see the OpenGL ES 3.X documentation for
\l{https://www.khronos.org/registry/OpenGL-Refpages/es3/html/glIsShader.xhtml}{glIsShader()}.
This convenience function will do nothing on OpenGL ES 1.x systems.
@@ -1661,7 +1645,7 @@ void QOpenGLFunctions::initializeOpenGLFunctions()
Convenience function that calls glLinkProgram(\a program).
- For more information, see the OpenGL ES 2.0 documentation for
+ For more information, see the OpenGL ES 3.X documentation for
\l{https://www.khronos.org/registry/OpenGL-Refpages/es3/html/glLinkProgram.xhtml}{glLinkProgram()}.
This convenience function will do nothing on OpenGL ES 1.x systems.
@@ -1672,7 +1656,7 @@ void QOpenGLFunctions::initializeOpenGLFunctions()
Convenience function that calls glReleaseShaderCompiler().
- For more information, see the OpenGL ES 2.0 documentation for
+ For more information, see the OpenGL ES 3.X documentation for
\l{https://www.khronos.org/registry/OpenGL-Refpages/es3/html/glReleaseShaderCompiler.xhtml}{glReleaseShaderCompiler()}.
This convenience function will do nothing on OpenGL ES 1.x systems.
@@ -1683,7 +1667,7 @@ void QOpenGLFunctions::initializeOpenGLFunctions()
Convenience function that calls glRenderbufferStorage(\a target, \a internalformat, \a width, \a height).
- For more information, see the OpenGL ES 2.0 documentation for
+ For more information, see the OpenGL ES 3.X documentation for
\l{https://www.khronos.org/registry/OpenGL-Refpages/es3/html/glRenderbufferStorage.xhtml}{glRenderbufferStorage()}.
*/
@@ -1692,7 +1676,7 @@ void QOpenGLFunctions::initializeOpenGLFunctions()
Convenience function that calls glSampleCoverage(\a value, \a invert).
- For more information, see the OpenGL ES 2.0 documentation for
+ For more information, see the OpenGL ES 3.X documentation for
\l{https://www.khronos.org/registry/OpenGL-Refpages/es3/html/glSampleCoverage.xhtml}{glSampleCoverage()}.
*/
@@ -1701,7 +1685,7 @@ void QOpenGLFunctions::initializeOpenGLFunctions()
Convenience function that calls glShaderBinary(\a n, \a shaders, \a binaryformat, \a binary, \a length).
- For more information, see the OpenGL ES 2.0 documentation for
+ For more information, see the OpenGL ES 3.X documentation for
\l{https://www.khronos.org/registry/OpenGL-Refpages/es3/html/glShaderBinary.xhtml}{glShaderBinary()}.
This convenience function will do nothing on OpenGL ES 1.x systems.
@@ -1712,7 +1696,7 @@ void QOpenGLFunctions::initializeOpenGLFunctions()
Convenience function that calls glShaderSource(\a shader, \a count, \a string, \a length).
- For more information, see the OpenGL ES 2.0 documentation for
+ For more information, see the OpenGL ES 3.X documentation for
\l{https://www.khronos.org/registry/OpenGL-Refpages/es3/html/glShaderSource.xhtml}{glShaderSource()}.
This convenience function will do nothing on OpenGL ES 1.x systems.
@@ -1723,7 +1707,7 @@ void QOpenGLFunctions::initializeOpenGLFunctions()
Convenience function that calls glStencilFuncSeparate(\a face, \a func, \a ref, \a mask).
- For more information, see the OpenGL ES 2.0 documentation for
+ For more information, see the OpenGL ES 3.X documentation for
\l{https://www.khronos.org/registry/OpenGL-Refpages/es3/html/glStencilFuncSeparate.xhtml}{glStencilFuncSeparate()}.
*/
@@ -1732,7 +1716,7 @@ void QOpenGLFunctions::initializeOpenGLFunctions()
Convenience function that calls glStencilMaskSeparate(\a face, \a mask).
- For more information, see the OpenGL ES 2.0 documentation for
+ For more information, see the OpenGL ES 3.X documentation for
\l{https://www.khronos.org/registry/OpenGL-Refpages/es3/html/glStencilMaskSeparate.xhtml}{glStencilMaskSeparate()}.
*/
@@ -1741,7 +1725,7 @@ void QOpenGLFunctions::initializeOpenGLFunctions()
Convenience function that calls glStencilOpSeparate(\a face, \a fail, \a zfail, \a zpass).
- For more information, see the OpenGL ES 2.0 documentation for
+ For more information, see the OpenGL ES 3.X documentation for
\l{https://www.khronos.org/registry/OpenGL-Refpages/es3/html/glStencilOpSeparate.xhtml}{glStencilOpSeparate()}.
*/
@@ -1750,7 +1734,7 @@ void QOpenGLFunctions::initializeOpenGLFunctions()
Convenience function that calls glUniform1f(\a location, \a x).
- For more information, see the OpenGL ES 2.0 documentation for
+ For more information, see the OpenGL ES 3.X documentation for
\l{https://www.khronos.org/registry/OpenGL-Refpages/es3/html/glUniform.xhtml}{glUniform1f()}.
This convenience function will do nothing on OpenGL ES 1.x systems.
@@ -1761,7 +1745,7 @@ void QOpenGLFunctions::initializeOpenGLFunctions()
Convenience function that calls glUniform1fv(\a location, \a count, \a v).
- For more information, see the OpenGL ES 2.0 documentation for
+ For more information, see the OpenGL ES 3.X documentation for
\l{https://www.khronos.org/registry/OpenGL-Refpages/es3/html/glUniform.xhtml}{glUniform1fv()}.
This convenience function will do nothing on OpenGL ES 1.x systems.
@@ -1772,7 +1756,7 @@ void QOpenGLFunctions::initializeOpenGLFunctions()
Convenience function that calls glUniform1i(\a location, \a x).
- For more information, see the OpenGL ES 2.0 documentation for
+ For more information, see the OpenGL ES 3.X documentation for
\l{https://www.khronos.org/registry/OpenGL-Refpages/es3/html/glUniform.xhtml}{glUniform1i()}.
This convenience function will do nothing on OpenGL ES 1.x systems.
@@ -1783,7 +1767,7 @@ void QOpenGLFunctions::initializeOpenGLFunctions()
Convenience function that calls glUniform1iv(\a location, \a count, \a v).
- For more information, see the OpenGL ES 2.0 documentation for
+ For more information, see the OpenGL ES 3.X documentation for
\l{https://www.khronos.org/registry/OpenGL-Refpages/es3/html/glUniform.xhtml}{glUniform1iv()}.
This convenience function will do nothing on OpenGL ES 1.x systems.
@@ -1794,7 +1778,7 @@ void QOpenGLFunctions::initializeOpenGLFunctions()
Convenience function that calls glUniform2f(\a location, \a x, \a y).
- For more information, see the OpenGL ES 2.0 documentation for
+ For more information, see the OpenGL ES 3.X documentation for
\l{https://www.khronos.org/registry/OpenGL-Refpages/es3/html/glUniform.xhtml}{glUniform2f()}.
This convenience function will do nothing on OpenGL ES 1.x systems.
@@ -1805,7 +1789,7 @@ void QOpenGLFunctions::initializeOpenGLFunctions()
Convenience function that calls glUniform2fv(\a location, \a count, \a v).
- For more information, see the OpenGL ES 2.0 documentation for
+ For more information, see the OpenGL ES 3.X documentation for
\l{https://www.khronos.org/registry/OpenGL-Refpages/es3/html/glUniform.xhtml}{glUniform2fv()}.
This convenience function will do nothing on OpenGL ES 1.x systems.
@@ -1816,7 +1800,7 @@ void QOpenGLFunctions::initializeOpenGLFunctions()
Convenience function that calls glUniform2i(\a location, \a x, \a y).
- For more information, see the OpenGL ES 2.0 documentation for
+ For more information, see the OpenGL ES 3.X documentation for
\l{https://www.khronos.org/registry/OpenGL-Refpages/es3/html/glUniform.xhtml}{glUniform2i()}.
This convenience function will do nothing on OpenGL ES 1.x systems.
@@ -1827,7 +1811,7 @@ void QOpenGLFunctions::initializeOpenGLFunctions()
Convenience function that calls glUniform2iv(\a location, \a count, \a v).
- For more information, see the OpenGL ES 2.0 documentation for
+ For more information, see the OpenGL ES 3.X documentation for
\l{https://www.khronos.org/registry/OpenGL-Refpages/es3/html/glUniform.xhtml}{glUniform2iv()}.
This convenience function will do nothing on OpenGL ES 1.x systems.
@@ -1838,7 +1822,7 @@ void QOpenGLFunctions::initializeOpenGLFunctions()
Convenience function that calls glUniform3f(\a location, \a x, \a y, \a z).
- For more information, see the OpenGL ES 2.0 documentation for
+ For more information, see the OpenGL ES 3.X documentation for
\l{https://www.khronos.org/registry/OpenGL-Refpages/es3/html/glUniform.xhtml}{glUniform3f()}.
This convenience function will do nothing on OpenGL ES 1.x systems.
@@ -1849,7 +1833,7 @@ void QOpenGLFunctions::initializeOpenGLFunctions()
Convenience function that calls glUniform3fv(\a location, \a count, \a v).
- For more information, see the OpenGL ES 2.0 documentation for
+ For more information, see the OpenGL ES 3.X documentation for
\l{https://www.khronos.org/registry/OpenGL-Refpages/es3/html/glUniform.xhtml}{glUniform3fv()}.
This convenience function will do nothing on OpenGL ES 1.x systems.
@@ -1860,7 +1844,7 @@ void QOpenGLFunctions::initializeOpenGLFunctions()
Convenience function that calls glUniform3i(\a location, \a x, \a y, \a z).
- For more information, see the OpenGL ES 2.0 documentation for
+ For more information, see the OpenGL ES 3.X documentation for
\l{https://www.khronos.org/registry/OpenGL-Refpages/es3/html/glUniform.xhtml}{glUniform3i()}.
This convenience function will do nothing on OpenGL ES 1.x systems.
@@ -1871,7 +1855,7 @@ void QOpenGLFunctions::initializeOpenGLFunctions()
Convenience function that calls glUniform3iv(\a location, \a count, \a v).
- For more information, see the OpenGL ES 2.0 documentation for
+ For more information, see the OpenGL ES 3.X documentation for
\l{https://www.khronos.org/registry/OpenGL-Refpages/es3/html/glUniform.xhtml}{glUniform3iv()}.
This convenience function will do nothing on OpenGL ES 1.x systems.
@@ -1882,7 +1866,7 @@ void QOpenGLFunctions::initializeOpenGLFunctions()
Convenience function that calls glUniform4f(\a location, \a x, \a y, \a z, \a w).
- For more information, see the OpenGL ES 2.0 documentation for
+ For more information, see the OpenGL ES 3.X documentation for
\l{https://www.khronos.org/registry/OpenGL-Refpages/es3/html/glUniform.xhtml}{glUniform4f()}.
This convenience function will do nothing on OpenGL ES 1.x systems.
@@ -1893,7 +1877,7 @@ void QOpenGLFunctions::initializeOpenGLFunctions()
Convenience function that calls glUniform4fv(\a location, \a count, \a v).
- For more information, see the OpenGL ES 2.0 documentation for
+ For more information, see the OpenGL ES 3.X documentation for
\l{https://www.khronos.org/registry/OpenGL-Refpages/es3/html/glUniform.xhtml}{glUniform4fv()}.
This convenience function will do nothing on OpenGL ES 1.x systems.
@@ -1904,7 +1888,7 @@ void QOpenGLFunctions::initializeOpenGLFunctions()
Convenience function that calls glUniform4i(\a location, \a x, \a y, \a z, \a w).
- For more information, see the OpenGL ES 2.0 documentation for
+ For more information, see the OpenGL ES 3.X documentation for
\l{https://www.khronos.org/registry/OpenGL-Refpages/es3/html/glUniform.xhtml}{glUniform4i()}.
This convenience function will do nothing on OpenGL ES 1.x systems.
@@ -1915,7 +1899,7 @@ void QOpenGLFunctions::initializeOpenGLFunctions()
Convenience function that calls glUniform4iv(\a location, \a count, \a v).
- For more information, see the OpenGL ES 2.0 documentation for
+ For more information, see the OpenGL ES 3.X documentation for
\l{https://www.khronos.org/registry/OpenGL-Refpages/es3/html/glUniform.xhtml}{glUniform4iv()}.
This convenience function will do nothing on OpenGL ES 1.x systems.
@@ -1926,7 +1910,7 @@ void QOpenGLFunctions::initializeOpenGLFunctions()
Convenience function that calls glUniformMatrix2fv(\a location, \a count, \a transpose, \a value).
- For more information, see the OpenGL ES 2.0 documentation for
+ For more information, see the OpenGL ES 3.X documentation for
\l{https://www.khronos.org/registry/OpenGL-Refpages/es3/html/glUniform.xhtml}{glUniformMatrix2fv()}.
This convenience function will do nothing on OpenGL ES 1.x systems.
@@ -1937,7 +1921,7 @@ void QOpenGLFunctions::initializeOpenGLFunctions()
Convenience function that calls glUniformMatrix3fv(\a location, \a count, \a transpose, \a value).
- For more information, see the OpenGL ES 2.0 documentation for
+ For more information, see the OpenGL ES 3.X documentation for
\l{https://www.khronos.org/registry/OpenGL-Refpages/es3/html/glUniform.xhtml}{glUniformMatrix3fv()}.
This convenience function will do nothing on OpenGL ES 1.x systems.
@@ -1948,7 +1932,7 @@ void QOpenGLFunctions::initializeOpenGLFunctions()
Convenience function that calls glUniformMatrix4fv(\a location, \a count, \a transpose, \a value).
- For more information, see the OpenGL ES 2.0 documentation for
+ For more information, see the OpenGL ES 3.X documentation for
\l{https://www.khronos.org/registry/OpenGL-Refpages/es3/html/glUniform.xhtml}{glUniformMatrix4fv()}.
This convenience function will do nothing on OpenGL ES 1.x systems.
@@ -1959,7 +1943,7 @@ void QOpenGLFunctions::initializeOpenGLFunctions()
Convenience function that calls glUseProgram(\a program).
- For more information, see the OpenGL ES 2.0 documentation for
+ For more information, see the OpenGL ES 3.X documentation for
\l{https://www.khronos.org/registry/OpenGL-Refpages/es3/html/glUseProgram.xhtml}{glUseProgram()}.
This convenience function will do nothing on OpenGL ES 1.x systems.
@@ -1970,7 +1954,7 @@ void QOpenGLFunctions::initializeOpenGLFunctions()
Convenience function that calls glValidateProgram(\a program).
- For more information, see the OpenGL ES 2.0 documentation for
+ For more information, see the OpenGL ES 3.X documentation for
\l{https://www.khronos.org/registry/OpenGL-Refpages/es3/html/glValidateProgram.xhtml}{glValidateProgram()}.
This convenience function will do nothing on OpenGL ES 1.x systems.
@@ -1981,7 +1965,7 @@ void QOpenGLFunctions::initializeOpenGLFunctions()
Convenience function that calls glVertexAttrib1f(\a indx, \a x).
- For more information, see the OpenGL ES 2.0 documentation for
+ For more information, see the OpenGL ES 3.X documentation for
\l{https://www.khronos.org/registry/OpenGL-Refpages/es3/html/glVertexAttrib.xhtml}{glVertexAttrib1f()}.
This convenience function will do nothing on OpenGL ES 1.x systems.
@@ -1992,7 +1976,7 @@ void QOpenGLFunctions::initializeOpenGLFunctions()
Convenience function that calls glVertexAttrib1fv(\a indx, \a values).
- For more information, see the OpenGL ES 2.0 documentation for
+ For more information, see the OpenGL ES 3.X documentation for
\l{https://www.khronos.org/registry/OpenGL-Refpages/es3/html/glVertexAttrib.xhtml}{glVertexAttrib1fv()}.
This convenience function will do nothing on OpenGL ES 1.x systems.
@@ -2003,7 +1987,7 @@ void QOpenGLFunctions::initializeOpenGLFunctions()
Convenience function that calls glVertexAttrib2f(\a indx, \a x, \a y).
- For more information, see the OpenGL ES 2.0 documentation for
+ For more information, see the OpenGL ES 3.X documentation for
\l{https://www.khronos.org/registry/OpenGL-Refpages/es3/html/glVertexAttrib.xhtml}{glVertexAttrib2f()}.
This convenience function will do nothing on OpenGL ES 1.x systems.
@@ -2014,7 +1998,7 @@ void QOpenGLFunctions::initializeOpenGLFunctions()
Convenience function that calls glVertexAttrib2fv(\a indx, \a values).
- For more information, see the OpenGL ES 2.0 documentation for
+ For more information, see the OpenGL ES 3.X documentation for
\l{https://www.khronos.org/registry/OpenGL-Refpages/es3/html/glVertexAttrib.xhtml}{glVertexAttrib2fv()}.
This convenience function will do nothing on OpenGL ES 1.x systems.
@@ -2025,7 +2009,7 @@ void QOpenGLFunctions::initializeOpenGLFunctions()
Convenience function that calls glVertexAttrib3f(\a indx, \a x, \a y, \a z).
- For more information, see the OpenGL ES 2.0 documentation for
+ For more information, see the OpenGL ES 3.X documentation for
\l{https://www.khronos.org/registry/OpenGL-Refpages/es3/html/glVertexAttrib.xhtml}{glVertexAttrib3f()}.
This convenience function will do nothing on OpenGL ES 1.x systems.
@@ -2036,7 +2020,7 @@ void QOpenGLFunctions::initializeOpenGLFunctions()
Convenience function that calls glVertexAttrib3fv(\a indx, \a values).
- For more information, see the OpenGL ES 2.0 documentation for
+ For more information, see the OpenGL ES 3.X documentation for
\l{https://www.khronos.org/registry/OpenGL-Refpages/es3/html/glVertexAttrib.xhtml}{glVertexAttrib3fv()}.
This convenience function will do nothing on OpenGL ES 1.x systems.
@@ -2047,7 +2031,7 @@ void QOpenGLFunctions::initializeOpenGLFunctions()
Convenience function that calls glVertexAttrib4f(\a indx, \a x, \a y, \a z, \a w).
- For more information, see the OpenGL ES 2.0 documentation for
+ For more information, see the OpenGL ES 3.X documentation for
\l{https://www.khronos.org/registry/OpenGL-Refpages/es3/html/glVertexAttrib.xhtml}{glVertexAttrib4f()}.
This convenience function will do nothing on OpenGL ES 1.x systems.
@@ -2058,7 +2042,7 @@ void QOpenGLFunctions::initializeOpenGLFunctions()
Convenience function that calls glVertexAttrib4fv(\a indx, \a values).
- For more information, see the OpenGL ES 2.0 documentation for
+ For more information, see the OpenGL ES 3.X documentation for
\l{https://www.khronos.org/registry/OpenGL-Refpages/es3/html/glVertexAttrib.xhtml}{glVertexAttrib4fv()}.
This convenience function will do nothing on OpenGL ES 1.x systems.
@@ -2069,7 +2053,7 @@ void QOpenGLFunctions::initializeOpenGLFunctions()
Convenience function that calls glVertexAttribPointer(\a indx, \a size, \a type, \a normalized, \a stride, \a ptr).
- For more information, see the OpenGL ES 2.0 documentation for
+ For more information, see the OpenGL ES 3.X documentation for
\l{https://www.khronos.org/registry/OpenGL-Refpages/es3/html/glVertexAttribPointer.xhtml}{glVertexAttribPointer()}.
This convenience function will do nothing on OpenGL ES 1.x systems.
@@ -2129,7 +2113,7 @@ Func resolve(QOpenGLContext *context, const char *name, Func)
#define RESOLVE(name) \
resolve(context, "gl"#name, name)
-#ifndef QT_OPENGL_ES_2
+#if !QT_CONFIG(opengles2)
// some fallback functions
static void QOPENGLF_APIENTRY qopenglfSpecialClearDepthf(GLclampf depth)
@@ -2167,14 +2151,14 @@ static void QOPENGLF_APIENTRY qopenglfSpecialReleaseShaderCompiler()
{
}
-#endif // !QT_OPENGL_ES_2
+#endif // !QT_CONFIG(opengles2)
QOpenGLFunctionsPrivate::QOpenGLFunctionsPrivate(QOpenGLContext *c)
{
init(c);
-#ifndef QT_OPENGL_ES_2
+#if !QT_CONFIG(opengles2)
// setup fallbacks in case some methods couldn't get resolved
bool es = QOpenGLContext::currentContext()->isOpenGLES();
if (!f.ClearDepthf || !es)
@@ -2564,7 +2548,7 @@ QT_OPENGL_IMPLEMENT(QOpenGLFunctionsPrivate, QT_OPENGL_FUNCTIONS)
function either in core or as an extension.
For more information, see the OpenGL ES 3.x documentation for
- \l{https://www.khronos.org/registry/OpenGL-Refpages/es3/html/glEndQuery.xhtml}{glEndQuery()}.
+ \l{https://www.khronos.org/registry/OpenGL-Refpages/es3/html/glBeginQuery.xhtml}{glEndQuery()}.
*/
/*!
@@ -2577,7 +2561,7 @@ QT_OPENGL_IMPLEMENT(QOpenGLFunctionsPrivate, QT_OPENGL_FUNCTIONS)
function either in core or as an extension.
For more information, see the OpenGL ES 3.x documentation for
- \l{https://www.khronos.org/registry/OpenGL-Refpages/es3/html/glEndTransformFeedback.xhtml}{glEndTransformFeedback()}.
+ \l{https://www.khronos.org/registry/OpenGL-Refpages/es3/html/glBeginTransformFeedback.xhtml}{glEndTransformFeedback()}.
*/
/*!
@@ -3474,7 +3458,7 @@ QT_OPENGL_IMPLEMENT(QOpenGLFunctionsPrivate, QT_OPENGL_FUNCTIONS)
function either in core or as an extension.
For more information, see the OpenGL ES 3.x documentation for
- \l{https://www.khronos.org/registry/OpenGL-Refpages/es3/html/glUnmapBuffer.xhtml}{glUnmapBuffer()}.
+ \l{https://www.khronos.org/registry/OpenGL-Refpages/es3/html/glMapBufferRange.xhtml}{glUnmapBuffer()}.
*/
/*!
@@ -3630,7 +3614,7 @@ QT_OPENGL_IMPLEMENT(QOpenGLFunctionsPrivate, QT_OPENGL_FUNCTIONS)
function either in core or as an extension.
For more information, see the OpenGL ES 3.x documentation for
- \l{https://www.khronos.org/registry/OpenGL-Refpages/es3/html/glCreateShaderProgramv.xhtml}{glCreateShaderProgramv()}.
+ \l{https://www.khronos.org/registry/OpenGL-Refpages/es3/html/glCreateShaderProgram.xhtml}{glCreateShaderProgramv()}.
*/
/*!
@@ -4436,7 +4420,7 @@ QT_OPENGL_IMPLEMENT(QOpenGLFunctionsPrivate, QT_OPENGL_FUNCTIONS)
function either in core or as an extension.
For more information, see the OpenGL ES 3.x documentation for
- \l{https://www.khronos.org/registry/OpenGL-Refpages/es3/html/glVertexAttribIFormat.xhtml}{glVertexAttribIFormat()}.
+ \l{https://www.khronos.org/registry/OpenGL-Refpages/es3/html/glVertexAttribFormat.xhtml}{glVertexAttribIFormat()}.
*/
/*!
@@ -4461,7 +4445,7 @@ QT_OPENGL_IMPLEMENT(QOpenGLFunctionsPrivate, QT_OPENGL_FUNCTIONS)
with plain OpenGL, the function is only usable when the given profile and version contains the
function either in core or as an extension.
- For more information, see the OpenGL ES 3.2 documentation for
+ For more information, see the OpenGL ES 3.X documentation for
\l{https://www.khronos.org/registry/OpenGL-Refpages/es3/html/glBlendBarrier.xhtml}{glBlendBarrier()}.
*/
@@ -4474,7 +4458,7 @@ QT_OPENGL_IMPLEMENT(QOpenGLFunctionsPrivate, QT_OPENGL_FUNCTIONS)
with plain OpenGL, the function is only usable when the given profile and version contains the
function either in core or as an extension.
- For more information, see the OpenGL ES 3.2 documentation for
+ For more information, see the OpenGL ES 3.X documentation for
\l{https://www.khronos.org/registry/OpenGL-Refpages/es3/html/glBlendEquationSeparate.xhtml}{glBlendEquationSeparatei()}.
*/
@@ -4487,8 +4471,8 @@ QT_OPENGL_IMPLEMENT(QOpenGLFunctionsPrivate, QT_OPENGL_FUNCTIONS)
with plain OpenGL, the function is only usable when the given profile and version contains the
function either in core or as an extension.
- For more information, see the OpenGL ES 3.2 documentation for
- \l{https://www.khronos.org/registry/OpenGL-Refpages/es3/html/glBlendEquationi.xhtml}{glBlendEquationi()}.
+ For more information, see the OpenGL ES 3.X documentation for
+ \l{https://www.khronos.org/registry/OpenGL-Refpages/es3/html/glBlendEquation.xhtml}{glBlendEquationi()}.
*/
/*!
@@ -4500,7 +4484,7 @@ QT_OPENGL_IMPLEMENT(QOpenGLFunctionsPrivate, QT_OPENGL_FUNCTIONS)
with plain OpenGL, the function is only usable when the given profile and version contains the
function either in core or as an extension.
- For more information, see the OpenGL ES 3.2 documentation for
+ For more information, see the OpenGL ES 3.X documentation for
\l{https://www.khronos.org/registry/OpenGL-Refpages/es3/html/glBlendFuncSeparate.xhtml}{glBlendFuncSeparatei()}.
*/
@@ -4513,8 +4497,8 @@ QT_OPENGL_IMPLEMENT(QOpenGLFunctionsPrivate, QT_OPENGL_FUNCTIONS)
with plain OpenGL, the function is only usable when the given profile and version contains the
function either in core or as an extension.
- For more information, see the OpenGL ES 3.2 documentation for
- \l{https://www.khronos.org/registry/OpenGL-Refpages/es3/html/glBlendFunci.xhtml}{glBlendFunci()}.
+ For more information, see the OpenGL ES 3.X documentation for
+ \l{https://www.khronos.org/registry/OpenGL-Refpages/es3/html/glBlendFunc.xhtml}{glBlendFunci()}.
*/
/*!
@@ -4526,7 +4510,7 @@ QT_OPENGL_IMPLEMENT(QOpenGLFunctionsPrivate, QT_OPENGL_FUNCTIONS)
with plain OpenGL, the function is only usable when the given profile and version contains the
function either in core or as an extension.
- For more information, see the OpenGL ES 3.2 documentation for
+ For more information, see the OpenGL ES 3.X documentation for
\l{https://www.khronos.org/registry/OpenGL-Refpages/es3/html/glColorMask.xhtml}{glColorMaski()}.
*/
@@ -4539,7 +4523,7 @@ QT_OPENGL_IMPLEMENT(QOpenGLFunctionsPrivate, QT_OPENGL_FUNCTIONS)
with plain OpenGL, the function is only usable when the given profile and version contains the
function either in core or as an extension.
- For more information, see the OpenGL ES 3.2 documentation for
+ For more information, see the OpenGL ES 3.X documentation for
\l{https://www.khronos.org/registry/OpenGL-Refpages/es3/html/glCopyImageSubData.xhtml}{glCopyImageSubData()}.
*/
@@ -4552,7 +4536,7 @@ QT_OPENGL_IMPLEMENT(QOpenGLFunctionsPrivate, QT_OPENGL_FUNCTIONS)
with plain OpenGL, the function is only usable when the given profile and version contains the
function either in core or as an extension.
- For more information, see the OpenGL ES 3.2 documentation for
+ For more information, see the OpenGL ES 3.X documentation for
\l{https://www.khronos.org/registry/OpenGL-Refpages/es3/html/glDebugMessageCallback.xhtml}{glDebugMessageCallback()}.
*/
@@ -4565,7 +4549,7 @@ QT_OPENGL_IMPLEMENT(QOpenGLFunctionsPrivate, QT_OPENGL_FUNCTIONS)
with plain OpenGL, the function is only usable when the given profile and version contains the
function either in core or as an extension.
- For more information, see the OpenGL ES 3.2 documentation for
+ For more information, see the OpenGL ES 3.X documentation for
\l{https://www.khronos.org/registry/OpenGL-Refpages/es3/html/glDebugMessageControl.xhtml}{glDebugMessageContro()}.
*/
@@ -4578,7 +4562,7 @@ QT_OPENGL_IMPLEMENT(QOpenGLFunctionsPrivate, QT_OPENGL_FUNCTIONS)
with plain OpenGL, the function is only usable when the given profile and version contains the
function either in core or as an extension.
- For more information, see the OpenGL ES 3.2 documentation for
+ For more information, see the OpenGL ES 3.X documentation for
\l{https://www.khronos.org/registry/OpenGL-Refpages/es3/html/glDebugMessageInsert.xhtml}{glDebugMessageInsert()}.
*/
@@ -4591,7 +4575,7 @@ QT_OPENGL_IMPLEMENT(QOpenGLFunctionsPrivate, QT_OPENGL_FUNCTIONS)
with plain OpenGL, the function is only usable when the given profile and version contains the
function either in core or as an extension.
- For more information, see the OpenGL ES 3.2 documentation for
+ For more information, see the OpenGL ES 3.X documentation for
\l{https://www.khronos.org/registry/OpenGL-Refpages/gl4/html/glEnable.xhtml}{glDisablei()}.
*/
@@ -4604,7 +4588,7 @@ QT_OPENGL_IMPLEMENT(QOpenGLFunctionsPrivate, QT_OPENGL_FUNCTIONS)
with plain OpenGL, the function is only usable when the given profile and version contains the
function either in core or as an extension.
- For more information, see the OpenGL ES 3.2 documentation for
+ For more information, see the OpenGL ES 3.X documentation for
\l{https://www.khronos.org/registry/OpenGL-Refpages/es3/html/glDrawElementsBaseVertex.xhtml}{glDrawElementsBaseVerte()}.
*/
@@ -4617,7 +4601,7 @@ QT_OPENGL_IMPLEMENT(QOpenGLFunctionsPrivate, QT_OPENGL_FUNCTIONS)
with plain OpenGL, the function is only usable when the given profile and version contains the
function either in core or as an extension.
- For more information, see the OpenGL ES 3.2 documentation for
+ For more information, see the OpenGL ES 3.X documentation for
\l{https://www.khronos.org/registry/OpenGL-Refpages/es3/html/glDrawElementsInstancedBaseVertex.xhtml}{glDrawElementsInstancedBaseVerte()}.
*/
@@ -4630,7 +4614,7 @@ QT_OPENGL_IMPLEMENT(QOpenGLFunctionsPrivate, QT_OPENGL_FUNCTIONS)
with plain OpenGL, the function is only usable when the given profile and version contains the
function either in core or as an extension.
- For more information, see the OpenGL ES 3.2 documentation for
+ For more information, see the OpenGL ES 3.X documentation for
\l{https://www.khronos.org/registry/OpenGL-Refpages/es3/html/glDrawRangeElementsBaseVertex.xhtml}{glDrawRangeElementsBaseVerte()}.
*/
@@ -4643,8 +4627,8 @@ QT_OPENGL_IMPLEMENT(QOpenGLFunctionsPrivate, QT_OPENGL_FUNCTIONS)
with plain OpenGL, the function is only usable when the given profile and version contains the
function either in core or as an extension.
- For more information, see the OpenGL ES 3.2 documentation for
- \l{https://www.khronos.org/registry/OpenGL-Refpages/es3/html/glEnablei.xhtml}{glEnablei()}.
+ For more information, see the OpenGL ES 3.X documentation for
+ \l{https://www.khronos.org/registry/OpenGL-Refpages/es3/html/glEnable.xhtml}{glEnablei()}.
*/
/*!
@@ -4656,7 +4640,7 @@ QT_OPENGL_IMPLEMENT(QOpenGLFunctionsPrivate, QT_OPENGL_FUNCTIONS)
with plain OpenGL, the function is only usable when the given profile and version contains the
function either in core or as an extension.
- For more information, see the OpenGL ES 3.2 documentation for
+ For more information, see the OpenGL ES 3.X documentation for
\l{https://www.khronos.org/registry/OpenGL-Refpages/es3/html/glFramebufferTexture.xhtml}{glFramebufferTexture()}.
*/
@@ -4669,7 +4653,7 @@ QT_OPENGL_IMPLEMENT(QOpenGLFunctionsPrivate, QT_OPENGL_FUNCTIONS)
with plain OpenGL, the function is only usable when the given profile and version contains the
function either in core or as an extension.
- For more information, see the OpenGL ES 3.2 documentation for
+ For more information, see the OpenGL ES 3.X documentation for
\l{https://www.khronos.org/registry/OpenGL-Refpages/es3/html/glGetDebugMessageLog.xhtml}{glGetDebugMessageLog()}.
*/
@@ -4682,7 +4666,7 @@ QT_OPENGL_IMPLEMENT(QOpenGLFunctionsPrivate, QT_OPENGL_FUNCTIONS)
with plain OpenGL, the function is only usable when the given profile and version contains the
function either in core or as an extension.
- For more information, see the OpenGL ES 3.2 documentation for
+ For more information, see the OpenGL ES 3.X documentation for
\l{https://www.khronos.org/registry/OpenGL-Refpages/es3/html/glGetGraphicsResetStatus.xhtml}{glGetGraphicsResetStatus()}.
*/
@@ -4695,7 +4679,7 @@ QT_OPENGL_IMPLEMENT(QOpenGLFunctionsPrivate, QT_OPENGL_FUNCTIONS)
with plain OpenGL, the function is only usable when the given profile and version contains the
function either in core or as an extension.
- For more information, see the OpenGL ES 3.2 documentation for
+ For more information, see the OpenGL ES 3.X documentation for
\l{https://www.khronos.org/registry/OpenGL-Refpages/es3/html/glGetObjectLabel.xhtml}{glGetObjectLabe()}.
*/
@@ -4708,7 +4692,7 @@ QT_OPENGL_IMPLEMENT(QOpenGLFunctionsPrivate, QT_OPENGL_FUNCTIONS)
with plain OpenGL, the function is only usable when the given profile and version contains the
function either in core or as an extension.
- For more information, see the OpenGL ES 3.2 documentation for
+ For more information, see the OpenGL ES 3.X documentation for
\l{https://www.khronos.org/registry/OpenGL-Refpages/es3/html/glGetObjectPtrLabel.xhtml}{glGetObjectPtrLabe()}.
*/
@@ -4721,7 +4705,7 @@ QT_OPENGL_IMPLEMENT(QOpenGLFunctionsPrivate, QT_OPENGL_FUNCTIONS)
with plain OpenGL, the function is only usable when the given profile and version contains the
function either in core or as an extension.
- For more information, see the OpenGL ES 3.2 documentation for
+ For more information, see the OpenGL ES 3.X documentation for
\l{https://www.khronos.org/registry/OpenGL-Refpages/es3/html/glGetPointerv.xhtml}{glGetPointerv()}.
*/
@@ -4734,7 +4718,7 @@ QT_OPENGL_IMPLEMENT(QOpenGLFunctionsPrivate, QT_OPENGL_FUNCTIONS)
with plain OpenGL, the function is only usable when the given profile and version contains the
function either in core or as an extension.
- For more information, see the OpenGL ES 3.2 documentation for
+ For more information, see the OpenGL ES 3.X documentation for
\l{https://www.khronos.org/registry/OpenGL-Refpages/es3/html/glGetSamplerParameter.xhtml}{glGetSamplerParameterIiv()}.
*/
@@ -4747,7 +4731,7 @@ QT_OPENGL_IMPLEMENT(QOpenGLFunctionsPrivate, QT_OPENGL_FUNCTIONS)
with plain OpenGL, the function is only usable when the given profile and version contains the
function either in core or as an extension.
- For more information, see the OpenGL ES 3.2 documentation for
+ For more information, see the OpenGL ES 3.X documentation for
\l{https://www.khronos.org/registry/OpenGL-Refpages/es3/html/glGetSamplerParameter.xhtml}{glGetSamplerParameterIuiv()}.
*/
@@ -4760,7 +4744,7 @@ QT_OPENGL_IMPLEMENT(QOpenGLFunctionsPrivate, QT_OPENGL_FUNCTIONS)
with plain OpenGL, the function is only usable when the given profile and version contains the
function either in core or as an extension.
- For more information, see the OpenGL ES 3.2 documentation for
+ For more information, see the OpenGL ES 3.X documentation for
\l{https://www.khronos.org/registry/OpenGL-Refpages/es3/html/glGetTexParameter.xhtml}{glGetTexParameterIiv()}.
*/
@@ -4773,7 +4757,7 @@ QT_OPENGL_IMPLEMENT(QOpenGLFunctionsPrivate, QT_OPENGL_FUNCTIONS)
with plain OpenGL, the function is only usable when the given profile and version contains the
function either in core or as an extension.
- For more information, see the OpenGL ES 3.2 documentation for
+ For more information, see the OpenGL ES 3.X documentation for
\l{https://www.khronos.org/registry/OpenGL-Refpages/es3/html/glGetTexParameter.xhtml}{glGetTexParameterIuiv()}.
*/
@@ -4786,7 +4770,7 @@ QT_OPENGL_IMPLEMENT(QOpenGLFunctionsPrivate, QT_OPENGL_FUNCTIONS)
with plain OpenGL, the function is only usable when the given profile and version contains the
function either in core or as an extension.
- For more information, see the OpenGL ES 3.2 documentation for
+ For more information, see the OpenGL ES 3.X documentation for
\l{https://www.khronos.org/registry/OpenGL-Refpages/es3/html/glGetUniform.xhtml}{glGetnUniformfv()}.
*/
@@ -4799,7 +4783,7 @@ QT_OPENGL_IMPLEMENT(QOpenGLFunctionsPrivate, QT_OPENGL_FUNCTIONS)
with plain OpenGL, the function is only usable when the given profile and version contains the
function either in core or as an extension.
- For more information, see the OpenGL ES 3.2 documentation for
+ For more information, see the OpenGL ES 3.X documentation for
\l{https://www.khronos.org/registry/OpenGL-Refpages/es3/html/glGetUniform.xhtml}{glGetnUniformiv()}.
*/
@@ -4812,7 +4796,7 @@ QT_OPENGL_IMPLEMENT(QOpenGLFunctionsPrivate, QT_OPENGL_FUNCTIONS)
with plain OpenGL, the function is only usable when the given profile and version contains the
function either in core or as an extension.
- For more information, see the OpenGL ES 3.2 documentation for
+ For more information, see the OpenGL ES 3.X documentation for
\l{https://www.khronos.org/registry/OpenGL-Refpages/es3/html/glGetUniform.xhtml}{glGetnUniformuiv()}.
*/
@@ -4825,7 +4809,7 @@ QT_OPENGL_IMPLEMENT(QOpenGLFunctionsPrivate, QT_OPENGL_FUNCTIONS)
with plain OpenGL, the function is only usable when the given profile and version contains the
function either in core or as an extension.
- For more information, see the OpenGL ES 3.2 documentation for
+ For more information, see the OpenGL ES 3.X documentation for
\l{https://www.khronos.org/registry/OpenGL-Refpages/es3/html/glIsEnabled.xhtml}{glIsEnabledi()}.
*/
@@ -4838,7 +4822,7 @@ QT_OPENGL_IMPLEMENT(QOpenGLFunctionsPrivate, QT_OPENGL_FUNCTIONS)
with plain OpenGL, the function is only usable when the given profile and version contains the
function either in core or as an extension.
- For more information, see the OpenGL ES 3.2 documentation for
+ For more information, see the OpenGL ES 3.X documentation for
\l{https://www.khronos.org/registry/OpenGL-Refpages/es3/html/glMinSampleShading.xhtml}{glMinSampleShading()}.
*/
@@ -4851,7 +4835,7 @@ QT_OPENGL_IMPLEMENT(QOpenGLFunctionsPrivate, QT_OPENGL_FUNCTIONS)
with plain OpenGL, the function is only usable when the given profile and version contains the
function either in core or as an extension.
- For more information, see the OpenGL ES 3.2 documentation for
+ For more information, see the OpenGL ES 3.X documentation for
\l{https://www.khronos.org/registry/OpenGL-Refpages/es3/html/glObjectLabel.xhtml}{glObjectLabe()}.
*/
@@ -4864,7 +4848,7 @@ QT_OPENGL_IMPLEMENT(QOpenGLFunctionsPrivate, QT_OPENGL_FUNCTIONS)
with plain OpenGL, the function is only usable when the given profile and version contains the
function either in core or as an extension.
- For more information, see the OpenGL ES 3.2 documentation for
+ For more information, see the OpenGL ES 3.X documentation for
\l{https://www.khronos.org/registry/OpenGL-Refpages/es3/html/glObjectPtrLabel.xhtml}{glObjectPtrLabe()}.
*/
@@ -4877,7 +4861,7 @@ QT_OPENGL_IMPLEMENT(QOpenGLFunctionsPrivate, QT_OPENGL_FUNCTIONS)
with plain OpenGL, the function is only usable when the given profile and version contains the
function either in core or as an extension.
- For more information, see the OpenGL ES 3.2 documentation for
+ For more information, see the OpenGL ES 3.X documentation for
\l{https://www.khronos.org/registry/OpenGL-Refpages/es3/html/glPatchParameteri.xhtml}{glPatchParameteri()}.
*/
@@ -4890,7 +4874,7 @@ QT_OPENGL_IMPLEMENT(QOpenGLFunctionsPrivate, QT_OPENGL_FUNCTIONS)
with plain OpenGL, the function is only usable when the given profile and version contains the
function either in core or as an extension.
- For more information, see the OpenGL ES 3.2 documentation for
+ For more information, see the OpenGL ES 3.X documentation for
\l{https://www.khronos.org/registry/OpenGL-Refpages/es3/html/glPopDebugGroup.xhtml}{glPopDebugGroup()}.
*/
@@ -4903,7 +4887,7 @@ QT_OPENGL_IMPLEMENT(QOpenGLFunctionsPrivate, QT_OPENGL_FUNCTIONS)
with plain OpenGL, the function is only usable when the given profile and version contains the
function either in core or as an extension.
- For more information, see the OpenGL ES 3.2 documentation for
+ For more information, see the OpenGL ES 3.X documentation for
\l{https://www.khronos.org/registry/OpenGL-Refpages/es3/html/glPrimitiveBoundingBox.xhtml}{glPrimitiveBoundingBo()}.
*/
@@ -4916,7 +4900,7 @@ QT_OPENGL_IMPLEMENT(QOpenGLFunctionsPrivate, QT_OPENGL_FUNCTIONS)
with plain OpenGL, the function is only usable when the given profile and version contains the
function either in core or as an extension.
- For more information, see the OpenGL ES 3.2 documentation for
+ For more information, see the OpenGL ES 3.X documentation for
\l{https://www.khronos.org/registry/OpenGL-Refpages/es3/html/glPushDebugGroup.xhtml}{glPushDebugGroup()}.
*/
@@ -4929,7 +4913,7 @@ QT_OPENGL_IMPLEMENT(QOpenGLFunctionsPrivate, QT_OPENGL_FUNCTIONS)
with plain OpenGL, the function is only usable when the given profile and version contains the
function either in core or as an extension.
- For more information, see the OpenGL ES 3.2 documentation for
+ For more information, see the OpenGL ES 3.X documentation for
\l{https://www.khronos.org/registry/OpenGL-Refpages/gl4/html/glReadPixels.xhtml}{glReadnPixels()}.
*/
@@ -4942,7 +4926,7 @@ QT_OPENGL_IMPLEMENT(QOpenGLFunctionsPrivate, QT_OPENGL_FUNCTIONS)
with plain OpenGL, the function is only usable when the given profile and version contains the
function either in core or as an extension.
- For more information, see the OpenGL ES 3.2 documentation for
+ For more information, see the OpenGL ES 3.X documentation for
\l{https://www.khronos.org/registry/OpenGL-Refpages/es3/html/glSamplerParameter.xhtml}{glSamplerParameterIiv()}.
*/
@@ -4955,7 +4939,7 @@ QT_OPENGL_IMPLEMENT(QOpenGLFunctionsPrivate, QT_OPENGL_FUNCTIONS)
with plain OpenGL, the function is only usable when the given profile and version contains the
function either in core or as an extension.
- For more information, see the OpenGL ES 3.2 documentation for
+ For more information, see the OpenGL ES 3.X documentation for
\l{https://www.khronos.org/registry/OpenGL-Refpages/es3/html/glSamplerParameter.xhtml}{glSamplerParameterIuiv()}.
*/
@@ -4968,7 +4952,7 @@ QT_OPENGL_IMPLEMENT(QOpenGLFunctionsPrivate, QT_OPENGL_FUNCTIONS)
with plain OpenGL, the function is only usable when the given profile and version contains the
function either in core or as an extension.
- For more information, see the OpenGL ES 3.2 documentation for
+ For more information, see the OpenGL ES 3.X documentation for
\l{https://www.khronos.org/registry/OpenGL-Refpages/es3/html/glTexBuffer.xhtml}{glTexBuffer()}.
*/
@@ -4981,7 +4965,7 @@ QT_OPENGL_IMPLEMENT(QOpenGLFunctionsPrivate, QT_OPENGL_FUNCTIONS)
with plain OpenGL, the function is only usable when the given profile and version contains the
function either in core or as an extension.
- For more information, see the OpenGL ES 3.2 documentation for
+ For more information, see the OpenGL ES 3.X documentation for
\l{https://www.khronos.org/registry/OpenGL-Refpages/es3/html/glTexBufferRange.xhtml}{glTexBufferRange()}.
*/
@@ -4994,7 +4978,7 @@ QT_OPENGL_IMPLEMENT(QOpenGLFunctionsPrivate, QT_OPENGL_FUNCTIONS)
with plain OpenGL, the function is only usable when the given profile and version contains the
function either in core or as an extension.
- For more information, see the OpenGL ES 3.2 documentation for
+ For more information, see the OpenGL ES 3.X documentation for
\l{https://www.khronos.org/registry/OpenGL-Refpages/es3/html/glTexParameter.xhtml}{glTexParameterIiv()}.
*/
@@ -5007,7 +4991,7 @@ QT_OPENGL_IMPLEMENT(QOpenGLFunctionsPrivate, QT_OPENGL_FUNCTIONS)
with plain OpenGL, the function is only usable when the given profile and version contains the
function either in core or as an extension.
- For more information, see the OpenGL ES 3.2 documentation for
+ For more information, see the OpenGL ES 3.X documentation for
\l{https://www.khronos.org/registry/OpenGL-Refpages/es3/html/glTexParameter.xhtml}{glTexParameterIuiv()}.
*/
@@ -5020,7 +5004,7 @@ QT_OPENGL_IMPLEMENT(QOpenGLFunctionsPrivate, QT_OPENGL_FUNCTIONS)
with plain OpenGL, the function is only usable when the given profile and version contains the
function either in core or as an extension.
- For more information, see the OpenGL ES 3.2 documentation for
+ For more information, see the OpenGL ES 3.X documentation for
\l{https://www.khronos.org/registry/OpenGL-Refpages/es3/html/glTexStorage3DMultisample.xhtml}{glTexStorage3DMultisample()}.
*/
@@ -5071,7 +5055,23 @@ QOpenGLExtensionsPrivate::QOpenGLExtensionsPrivate(QOpenGLContext *ctx)
MapBuffer = RESOLVE(MapBuffer);
GetBufferSubData = RESOLVE(GetBufferSubData);
DiscardFramebuffer = RESOLVE(DiscardFramebuffer);
- }
+}
+
+void QOpenGLExtensions::discardFramebuffer(GLenum target, GLsizei numAttachments, const GLenum *attachments)
+{
+ Q_D(QOpenGLExtensions);
+ Q_ASSERT(QOpenGLExtensions::isInitialized(d));
+ Q_ASSERT(d->f.InvalidateFramebuffer || d->DiscardFramebuffer);
+
+ // On GLES >= 3 we prefer glInvalidateFramebuffer, even if the
+ // discard extension is present
+ if (d->f.InvalidateFramebuffer)
+ d->f.InvalidateFramebuffer(target, numAttachments, attachments);
+ else
+ d->DiscardFramebuffer(target, numAttachments, attachments);
+
+ Q_OPENGL_FUNCTIONS_DEBUG
+}
void QOpenGLExtensions::flushShared()
{
diff --git a/src/gui/opengl/qopenglfunctions.h b/src/gui/opengl/qopenglfunctions.h
index 4554291bbd..05435903fb 100644
--- a/src/gui/opengl/qopenglfunctions.h
+++ b/src/gui/opengl/qopenglfunctions.h
@@ -1,41 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the QtGui module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#ifndef QOPENGLFUNCTIONS_H
#define QOPENGLFUNCTIONS_H
@@ -56,7 +20,7 @@
//#define Q_ENABLE_OPENGL_FUNCTIONS_DEBUG
-#ifdef QT_OPENGL_ES
+#if QT_CONFIG(opengles2)
typedef double GLdouble;
#endif
@@ -68,7 +32,7 @@ typedef double GLdouble;
unsigned clamped = qMin(unsigned(error - GL_INVALID_ENUM), 4U); \
const char *errors[] = { "GL_INVALID_ENUM", "GL_INVALID_VALUE", "GL_INVALID_OPERATION", "Unknown" }; \
printf("GL error at %s:%d: %s\n", __FILE__, __LINE__, errors[clamped]); \
- int *value = 0; \
+ int *value = nullptr; \
*value = 0; \
}
#else
@@ -227,7 +191,7 @@ struct QOpenGLFunctionsPrivate;
#undef glTexLevelParameteriv
-#if defined(Q_CLANG_QDOC)
+#if defined(Q_QDOC)
#undef GLbitfield
typedef unsigned int GLbitfield;
#undef GLchar
@@ -269,10 +233,6 @@ public:
void initializeOpenGLFunctions();
-#if QT_DEPRECATED_SINCE(5, 0)
- QT_DEPRECATED void initializeGLFunctions() { initializeOpenGLFunctions(); }
-#endif
-
// GLES2 + OpenGL1 common subset
void glBindTexture(GLenum target, GLuint texture);
void glBlendFunc(GLenum sfactor, GLenum dfactor);
@@ -599,7 +559,7 @@ struct QOpenGLFunctionsPrivate
inline void QOpenGLFunctions::glBindTexture(GLenum target, GLuint texture)
{
-#if defined(QT_OPENGL_ES_2) && defined(Q_OS_ANDROID)
+#if QT_CONFIG(opengles2) && defined(Q_OS_ANDROID)
::glBindTexture(target, texture);
#else
Q_ASSERT(QOpenGLFunctions::isInitialized(d_ptr));
@@ -610,7 +570,7 @@ inline void QOpenGLFunctions::glBindTexture(GLenum target, GLuint texture)
inline void QOpenGLFunctions::glBlendFunc(GLenum sfactor, GLenum dfactor)
{
-#if defined(QT_OPENGL_ES_2) && defined(Q_OS_ANDROID)
+#if QT_CONFIG(opengles2) && defined(Q_OS_ANDROID)
::glBlendFunc(sfactor, dfactor);
#else
Q_ASSERT(QOpenGLFunctions::isInitialized(d_ptr));
@@ -621,7 +581,7 @@ inline void QOpenGLFunctions::glBlendFunc(GLenum sfactor, GLenum dfactor)
inline void QOpenGLFunctions::glClear(GLbitfield mask)
{
-#if defined(QT_OPENGL_ES_2) && defined(Q_OS_ANDROID)
+#if QT_CONFIG(opengles2) && defined(Q_OS_ANDROID)
::glClear(mask);
#else
Q_ASSERT(QOpenGLFunctions::isInitialized(d_ptr));
@@ -632,7 +592,7 @@ inline void QOpenGLFunctions::glClear(GLbitfield mask)
inline void QOpenGLFunctions::glClearColor(GLclampf red, GLclampf green, GLclampf blue, GLclampf alpha)
{
-#if defined(QT_OPENGL_ES_2) && defined(Q_OS_ANDROID)
+#if QT_CONFIG(opengles2) && defined(Q_OS_ANDROID)
::glClearColor(red, green, blue, alpha);
#else
Q_ASSERT(QOpenGLFunctions::isInitialized(d_ptr));
@@ -643,7 +603,7 @@ inline void QOpenGLFunctions::glClearColor(GLclampf red, GLclampf green, GLclamp
inline void QOpenGLFunctions::glClearStencil(GLint s)
{
-#if defined(QT_OPENGL_ES_2) && defined(Q_OS_ANDROID)
+#if QT_CONFIG(opengles2) && defined(Q_OS_ANDROID)
::glClearStencil(s);
#else
Q_ASSERT(QOpenGLFunctions::isInitialized(d_ptr));
@@ -654,7 +614,7 @@ inline void QOpenGLFunctions::glClearStencil(GLint s)
inline void QOpenGLFunctions::glColorMask(GLboolean red, GLboolean green, GLboolean blue, GLboolean alpha)
{
-#if defined(QT_OPENGL_ES_2) && defined(Q_OS_ANDROID)
+#if QT_CONFIG(opengles2) && defined(Q_OS_ANDROID)
::glColorMask(red, green, blue, alpha);
#else
Q_ASSERT(QOpenGLFunctions::isInitialized(d_ptr));
@@ -665,7 +625,7 @@ inline void QOpenGLFunctions::glColorMask(GLboolean red, GLboolean green, GLbool
inline void QOpenGLFunctions::glCopyTexImage2D(GLenum target, GLint level, GLenum internalformat, GLint x, GLint y, GLsizei width, GLsizei height, GLint border)
{
-#if defined(QT_OPENGL_ES_2) && defined(Q_OS_ANDROID)
+#if QT_CONFIG(opengles2) && defined(Q_OS_ANDROID)
::glCopyTexImage2D(target, level, internalformat, x, y, width,height, border);
#else
Q_ASSERT(QOpenGLFunctions::isInitialized(d_ptr));
@@ -676,7 +636,7 @@ inline void QOpenGLFunctions::glCopyTexImage2D(GLenum target, GLint level, GLenu
inline void QOpenGLFunctions::glCopyTexSubImage2D(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint x, GLint y, GLsizei width, GLsizei height)
{
-#if defined(QT_OPENGL_ES_2) && defined(Q_OS_ANDROID)
+#if QT_CONFIG(opengles2) && defined(Q_OS_ANDROID)
::glCopyTexSubImage2D(target, level, xoffset, yoffset, x, y, width, height);
#else
Q_ASSERT(QOpenGLFunctions::isInitialized(d_ptr));
@@ -687,7 +647,7 @@ inline void QOpenGLFunctions::glCopyTexSubImage2D(GLenum target, GLint level, GL
inline void QOpenGLFunctions::glCullFace(GLenum mode)
{
-#if defined(QT_OPENGL_ES_2) && defined(Q_OS_ANDROID)
+#if QT_CONFIG(opengles2) && defined(Q_OS_ANDROID)
::glCullFace(mode);
#else
Q_ASSERT(QOpenGLFunctions::isInitialized(d_ptr));
@@ -698,7 +658,7 @@ inline void QOpenGLFunctions::glCullFace(GLenum mode)
inline void QOpenGLFunctions::glDeleteTextures(GLsizei n, const GLuint* textures)
{
-#if defined(QT_OPENGL_ES_2) && defined(Q_OS_ANDROID)
+#if QT_CONFIG(opengles2) && defined(Q_OS_ANDROID)
::glDeleteTextures(n, textures);
#else
Q_ASSERT(QOpenGLFunctions::isInitialized(d_ptr));
@@ -709,7 +669,7 @@ inline void QOpenGLFunctions::glDeleteTextures(GLsizei n, const GLuint* textures
inline void QOpenGLFunctions::glDepthFunc(GLenum func)
{
-#if defined(QT_OPENGL_ES_2) && defined(Q_OS_ANDROID)
+#if QT_CONFIG(opengles2) && defined(Q_OS_ANDROID)
::glDepthFunc(func);
#else
Q_ASSERT(QOpenGLFunctions::isInitialized(d_ptr));
@@ -720,7 +680,7 @@ inline void QOpenGLFunctions::glDepthFunc(GLenum func)
inline void QOpenGLFunctions::glDepthMask(GLboolean flag)
{
-#if defined(QT_OPENGL_ES_2) && defined(Q_OS_ANDROID)
+#if QT_CONFIG(opengles2) && defined(Q_OS_ANDROID)
::glDepthMask(flag);
#else
Q_ASSERT(QOpenGLFunctions::isInitialized(d_ptr));
@@ -731,7 +691,7 @@ inline void QOpenGLFunctions::glDepthMask(GLboolean flag)
inline void QOpenGLFunctions::glDisable(GLenum cap)
{
-#if defined(QT_OPENGL_ES_2) && defined(Q_OS_ANDROID)
+#if QT_CONFIG(opengles2) && defined(Q_OS_ANDROID)
::glDisable(cap);
#else
Q_ASSERT(QOpenGLFunctions::isInitialized(d_ptr));
@@ -742,7 +702,7 @@ inline void QOpenGLFunctions::glDisable(GLenum cap)
inline void QOpenGLFunctions::glDrawArrays(GLenum mode, GLint first, GLsizei count)
{
-#if defined(QT_OPENGL_ES_2) && defined(Q_OS_ANDROID)
+#if QT_CONFIG(opengles2) && defined(Q_OS_ANDROID)
::glDrawArrays(mode, first, count);
#else
Q_ASSERT(QOpenGLFunctions::isInitialized(d_ptr));
@@ -753,7 +713,7 @@ inline void QOpenGLFunctions::glDrawArrays(GLenum mode, GLint first, GLsizei cou
inline void QOpenGLFunctions::glDrawElements(GLenum mode, GLsizei count, GLenum type, const GLvoid* indices)
{
-#if defined(QT_OPENGL_ES_2) && defined(Q_OS_ANDROID)
+#if QT_CONFIG(opengles2) && defined(Q_OS_ANDROID)
::glDrawElements(mode, count, type, indices);
#else
Q_ASSERT(QOpenGLFunctions::isInitialized(d_ptr));
@@ -764,7 +724,7 @@ inline void QOpenGLFunctions::glDrawElements(GLenum mode, GLsizei count, GLenum
inline void QOpenGLFunctions::glEnable(GLenum cap)
{
-#if defined(QT_OPENGL_ES_2) && defined(Q_OS_ANDROID)
+#if QT_CONFIG(opengles2) && defined(Q_OS_ANDROID)
::glEnable(cap);
#else
Q_ASSERT(QOpenGLFunctions::isInitialized(d_ptr));
@@ -775,7 +735,7 @@ inline void QOpenGLFunctions::glEnable(GLenum cap)
inline void QOpenGLFunctions::glFinish()
{
-#if defined(QT_OPENGL_ES_2) && defined(Q_OS_ANDROID)
+#if QT_CONFIG(opengles2) && defined(Q_OS_ANDROID)
::glFinish();
#else
Q_ASSERT(QOpenGLFunctions::isInitialized(d_ptr));
@@ -786,7 +746,7 @@ inline void QOpenGLFunctions::glFinish()
inline void QOpenGLFunctions::glFlush()
{
-#if defined(QT_OPENGL_ES_2) && defined(Q_OS_ANDROID)
+#if QT_CONFIG(opengles2) && defined(Q_OS_ANDROID)
::glFlush();
#else
Q_ASSERT(QOpenGLFunctions::isInitialized(d_ptr));
@@ -797,7 +757,7 @@ inline void QOpenGLFunctions::glFlush()
inline void QOpenGLFunctions::glFrontFace(GLenum mode)
{
-#if defined(QT_OPENGL_ES_2) && defined(Q_OS_ANDROID)
+#if QT_CONFIG(opengles2) && defined(Q_OS_ANDROID)
::glFrontFace(mode);
#else
Q_ASSERT(QOpenGLFunctions::isInitialized(d_ptr));
@@ -808,7 +768,7 @@ inline void QOpenGLFunctions::glFrontFace(GLenum mode)
inline void QOpenGLFunctions::glGenTextures(GLsizei n, GLuint* textures)
{
-#if defined(QT_OPENGL_ES_2) && defined(Q_OS_ANDROID)
+#if QT_CONFIG(opengles2) && defined(Q_OS_ANDROID)
::glGenTextures(n, textures);
#else
Q_ASSERT(QOpenGLFunctions::isInitialized(d_ptr));
@@ -819,7 +779,7 @@ inline void QOpenGLFunctions::glGenTextures(GLsizei n, GLuint* textures)
inline void QOpenGLFunctions::glGetBooleanv(GLenum pname, GLboolean* params)
{
-#if defined(QT_OPENGL_ES_2) && defined(Q_OS_ANDROID)
+#if QT_CONFIG(opengles2) && defined(Q_OS_ANDROID)
::glGetBooleanv(pname, params);
#else
Q_ASSERT(QOpenGLFunctions::isInitialized(d_ptr));
@@ -830,7 +790,7 @@ inline void QOpenGLFunctions::glGetBooleanv(GLenum pname, GLboolean* params)
inline GLenum QOpenGLFunctions::glGetError()
{
-#if defined(QT_OPENGL_ES_2) && defined(Q_OS_ANDROID)
+#if QT_CONFIG(opengles2) && defined(Q_OS_ANDROID)
GLenum result = ::glGetError();
#else
Q_ASSERT(QOpenGLFunctions::isInitialized(d_ptr));
@@ -841,7 +801,7 @@ inline GLenum QOpenGLFunctions::glGetError()
inline void QOpenGLFunctions::glGetFloatv(GLenum pname, GLfloat* params)
{
-#if defined(QT_OPENGL_ES_2) && defined(Q_OS_ANDROID)
+#if QT_CONFIG(opengles2) && defined(Q_OS_ANDROID)
::glGetFloatv(pname, params);
#else
Q_ASSERT(QOpenGLFunctions::isInitialized(d_ptr));
@@ -852,7 +812,7 @@ inline void QOpenGLFunctions::glGetFloatv(GLenum pname, GLfloat* params)
inline void QOpenGLFunctions::glGetIntegerv(GLenum pname, GLint* params)
{
-#if defined(QT_OPENGL_ES_2) && defined(Q_OS_ANDROID)
+#if QT_CONFIG(opengles2) && defined(Q_OS_ANDROID)
::glGetIntegerv(pname, params);
#else
Q_ASSERT(QOpenGLFunctions::isInitialized(d_ptr));
@@ -863,7 +823,7 @@ inline void QOpenGLFunctions::glGetIntegerv(GLenum pname, GLint* params)
inline const GLubyte *QOpenGLFunctions::glGetString(GLenum name)
{
-#if defined(QT_OPENGL_ES_2) && defined(Q_OS_ANDROID)
+#if QT_CONFIG(opengles2) && defined(Q_OS_ANDROID)
const GLubyte *result = ::glGetString(name);
#else
Q_ASSERT(QOpenGLFunctions::isInitialized(d_ptr));
@@ -875,7 +835,7 @@ inline const GLubyte *QOpenGLFunctions::glGetString(GLenum name)
inline void QOpenGLFunctions::glGetTexParameterfv(GLenum target, GLenum pname, GLfloat* params)
{
-#if defined(QT_OPENGL_ES_2) && defined(Q_OS_ANDROID)
+#if QT_CONFIG(opengles2) && defined(Q_OS_ANDROID)
::glGetTexParameterfv(target, pname, params);
#else
Q_ASSERT(QOpenGLFunctions::isInitialized(d_ptr));
@@ -886,7 +846,7 @@ inline void QOpenGLFunctions::glGetTexParameterfv(GLenum target, GLenum pname, G
inline void QOpenGLFunctions::glGetTexParameteriv(GLenum target, GLenum pname, GLint* params)
{
-#if defined(QT_OPENGL_ES_2) && defined(Q_OS_ANDROID)
+#if QT_CONFIG(opengles2) && defined(Q_OS_ANDROID)
::glGetTexParameteriv(target, pname, params);
#else
Q_ASSERT(QOpenGLFunctions::isInitialized(d_ptr));
@@ -897,7 +857,7 @@ inline void QOpenGLFunctions::glGetTexParameteriv(GLenum target, GLenum pname, G
inline void QOpenGLFunctions::glHint(GLenum target, GLenum mode)
{
-#if defined(QT_OPENGL_ES_2) && defined(Q_OS_ANDROID)
+#if QT_CONFIG(opengles2) && defined(Q_OS_ANDROID)
::glHint(target, mode);
#else
Q_ASSERT(QOpenGLFunctions::isInitialized(d_ptr));
@@ -908,7 +868,7 @@ inline void QOpenGLFunctions::glHint(GLenum target, GLenum mode)
inline GLboolean QOpenGLFunctions::glIsEnabled(GLenum cap)
{
-#if defined(QT_OPENGL_ES_2) && defined(Q_OS_ANDROID)
+#if QT_CONFIG(opengles2) && defined(Q_OS_ANDROID)
GLboolean result = ::glIsEnabled(cap);
#else
Q_ASSERT(QOpenGLFunctions::isInitialized(d_ptr));
@@ -920,7 +880,7 @@ inline GLboolean QOpenGLFunctions::glIsEnabled(GLenum cap)
inline GLboolean QOpenGLFunctions::glIsTexture(GLuint texture)
{
-#if defined(QT_OPENGL_ES_2) && defined(Q_OS_ANDROID)
+#if QT_CONFIG(opengles2) && defined(Q_OS_ANDROID)
GLboolean result = ::glIsTexture(texture);
#else
Q_ASSERT(QOpenGLFunctions::isInitialized(d_ptr));
@@ -932,7 +892,7 @@ inline GLboolean QOpenGLFunctions::glIsTexture(GLuint texture)
inline void QOpenGLFunctions::glLineWidth(GLfloat width)
{
-#if defined(QT_OPENGL_ES_2) && defined(Q_OS_ANDROID)
+#if QT_CONFIG(opengles2) && defined(Q_OS_ANDROID)
::glLineWidth(width);
#else
Q_ASSERT(QOpenGLFunctions::isInitialized(d_ptr));
@@ -943,7 +903,7 @@ inline void QOpenGLFunctions::glLineWidth(GLfloat width)
inline void QOpenGLFunctions::glPixelStorei(GLenum pname, GLint param)
{
-#if defined(QT_OPENGL_ES_2) && defined(Q_OS_ANDROID)
+#if QT_CONFIG(opengles2) && defined(Q_OS_ANDROID)
::glPixelStorei(pname, param);
#else
Q_ASSERT(QOpenGLFunctions::isInitialized(d_ptr));
@@ -954,7 +914,7 @@ inline void QOpenGLFunctions::glPixelStorei(GLenum pname, GLint param)
inline void QOpenGLFunctions::glPolygonOffset(GLfloat factor, GLfloat units)
{
-#if defined(QT_OPENGL_ES_2) && defined(Q_OS_ANDROID)
+#if QT_CONFIG(opengles2) && defined(Q_OS_ANDROID)
::glPolygonOffset(factor, units);
#else
Q_ASSERT(QOpenGLFunctions::isInitialized(d_ptr));
@@ -965,7 +925,7 @@ inline void QOpenGLFunctions::glPolygonOffset(GLfloat factor, GLfloat units)
inline void QOpenGLFunctions::glReadPixels(GLint x, GLint y, GLsizei width, GLsizei height, GLenum format, GLenum type, GLvoid* pixels)
{
-#if defined(QT_OPENGL_ES_2) && defined(Q_OS_ANDROID)
+#if QT_CONFIG(opengles2) && defined(Q_OS_ANDROID)
::glReadPixels(x, y, width, height, format, type, pixels);
#else
Q_ASSERT(QOpenGLFunctions::isInitialized(d_ptr));
@@ -976,7 +936,7 @@ inline void QOpenGLFunctions::glReadPixels(GLint x, GLint y, GLsizei width, GLsi
inline void QOpenGLFunctions::glScissor(GLint x, GLint y, GLsizei width, GLsizei height)
{
-#if defined(QT_OPENGL_ES_2) && defined(Q_OS_ANDROID)
+#if QT_CONFIG(opengles2) && defined(Q_OS_ANDROID)
::glScissor(x, y, width, height);
#else
Q_ASSERT(QOpenGLFunctions::isInitialized(d_ptr));
@@ -987,7 +947,7 @@ inline void QOpenGLFunctions::glScissor(GLint x, GLint y, GLsizei width, GLsizei
inline void QOpenGLFunctions::glStencilFunc(GLenum func, GLint ref, GLuint mask)
{
-#if defined(QT_OPENGL_ES_2) && defined(Q_OS_ANDROID)
+#if QT_CONFIG(opengles2) && defined(Q_OS_ANDROID)
::glStencilFunc(func, ref, mask);
#else
Q_ASSERT(QOpenGLFunctions::isInitialized(d_ptr));
@@ -998,7 +958,7 @@ inline void QOpenGLFunctions::glStencilFunc(GLenum func, GLint ref, GLuint mask)
inline void QOpenGLFunctions::glStencilMask(GLuint mask)
{
-#if defined(QT_OPENGL_ES_2) && defined(Q_OS_ANDROID)
+#if QT_CONFIG(opengles2) && defined(Q_OS_ANDROID)
::glStencilMask(mask);
#else
Q_ASSERT(QOpenGLFunctions::isInitialized(d_ptr));
@@ -1009,7 +969,7 @@ inline void QOpenGLFunctions::glStencilMask(GLuint mask)
inline void QOpenGLFunctions::glStencilOp(GLenum fail, GLenum zfail, GLenum zpass)
{
-#if defined(QT_OPENGL_ES_2) && defined(Q_OS_ANDROID)
+#if QT_CONFIG(opengles2) && defined(Q_OS_ANDROID)
::glStencilOp(fail, zfail, zpass);
#else
Q_ASSERT(QOpenGLFunctions::isInitialized(d_ptr));
@@ -1020,7 +980,7 @@ inline void QOpenGLFunctions::glStencilOp(GLenum fail, GLenum zfail, GLenum zpas
inline void QOpenGLFunctions::glTexImage2D(GLenum target, GLint level, GLint internalformat, GLsizei width, GLsizei height, GLint border, GLenum format, GLenum type, const GLvoid* pixels)
{
-#if defined(QT_OPENGL_ES_2) && defined(Q_OS_ANDROID)
+#if QT_CONFIG(opengles2) && defined(Q_OS_ANDROID)
::glTexImage2D(target, level, internalformat, width,height, border, format, type, pixels);
#else
Q_ASSERT(QOpenGLFunctions::isInitialized(d_ptr));
@@ -1031,7 +991,7 @@ inline void QOpenGLFunctions::glTexImage2D(GLenum target, GLint level, GLint int
inline void QOpenGLFunctions::glTexParameterf(GLenum target, GLenum pname, GLfloat param)
{
-#if defined(QT_OPENGL_ES_2) && defined(Q_OS_ANDROID)
+#if QT_CONFIG(opengles2) && defined(Q_OS_ANDROID)
::glTexParameterf(target, pname, param);
#else
Q_ASSERT(QOpenGLFunctions::isInitialized(d_ptr));
@@ -1042,7 +1002,7 @@ inline void QOpenGLFunctions::glTexParameterf(GLenum target, GLenum pname, GLflo
inline void QOpenGLFunctions::glTexParameterfv(GLenum target, GLenum pname, const GLfloat* params)
{
-#if defined(QT_OPENGL_ES_2) && defined(Q_OS_ANDROID)
+#if QT_CONFIG(opengles2) && defined(Q_OS_ANDROID)
::glTexParameterfv(target, pname, params);
#else
Q_ASSERT(QOpenGLFunctions::isInitialized(d_ptr));
@@ -1053,7 +1013,7 @@ inline void QOpenGLFunctions::glTexParameterfv(GLenum target, GLenum pname, cons
inline void QOpenGLFunctions::glTexParameteri(GLenum target, GLenum pname, GLint param)
{
-#if defined(QT_OPENGL_ES_2) && defined(Q_OS_ANDROID)
+#if QT_CONFIG(opengles2) && defined(Q_OS_ANDROID)
::glTexParameteri(target, pname, param);
#else
Q_ASSERT(QOpenGLFunctions::isInitialized(d_ptr));
@@ -1064,7 +1024,7 @@ inline void QOpenGLFunctions::glTexParameteri(GLenum target, GLenum pname, GLint
inline void QOpenGLFunctions::glTexParameteriv(GLenum target, GLenum pname, const GLint* params)
{
-#if defined(QT_OPENGL_ES_2) && defined(Q_OS_ANDROID)
+#if QT_CONFIG(opengles2) && defined(Q_OS_ANDROID)
::glTexParameteriv(target, pname, params);
#else
Q_ASSERT(QOpenGLFunctions::isInitialized(d_ptr));
@@ -1075,7 +1035,7 @@ inline void QOpenGLFunctions::glTexParameteriv(GLenum target, GLenum pname, cons
inline void QOpenGLFunctions::glTexSubImage2D(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLenum type, const GLvoid* pixels)
{
-#if defined(QT_OPENGL_ES_2) && defined(Q_OS_ANDROID)
+#if QT_CONFIG(opengles2) && defined(Q_OS_ANDROID)
::glTexSubImage2D(target, level, xoffset, yoffset, width, height, format, type, pixels);
#else
Q_ASSERT(QOpenGLFunctions::isInitialized(d_ptr));
@@ -1086,7 +1046,7 @@ inline void QOpenGLFunctions::glTexSubImage2D(GLenum target, GLint level, GLint
inline void QOpenGLFunctions::glViewport(GLint x, GLint y, GLsizei width, GLsizei height)
{
-#if defined(QT_OPENGL_ES_2) && defined(Q_OS_ANDROID)
+#if QT_CONFIG(opengles2) && defined(Q_OS_ANDROID)
::glViewport(x, y, width, height);
#else
Q_ASSERT(QOpenGLFunctions::isInitialized(d_ptr));
@@ -1099,7 +1059,7 @@ inline void QOpenGLFunctions::glViewport(GLint x, GLint y, GLsizei width, GLsize
inline void QOpenGLFunctions::glActiveTexture(GLenum texture)
{
-#if defined(QT_OPENGL_ES_2) && defined(Q_OS_ANDROID)
+#if QT_CONFIG(opengles2) && defined(Q_OS_ANDROID)
::glActiveTexture(texture);
#else
Q_ASSERT(QOpenGLFunctions::isInitialized(d_ptr));
@@ -1110,7 +1070,7 @@ inline void QOpenGLFunctions::glActiveTexture(GLenum texture)
inline void QOpenGLFunctions::glAttachShader(GLuint program, GLuint shader)
{
-#if defined(QT_OPENGL_ES_2) && defined(Q_OS_ANDROID)
+#if QT_CONFIG(opengles2) && defined(Q_OS_ANDROID)
::glAttachShader(program, shader);
#else
Q_ASSERT(QOpenGLFunctions::isInitialized(d_ptr));
@@ -1121,7 +1081,7 @@ inline void QOpenGLFunctions::glAttachShader(GLuint program, GLuint shader)
inline void QOpenGLFunctions::glBindAttribLocation(GLuint program, GLuint index, const char* name)
{
-#if defined(QT_OPENGL_ES_2) && defined(Q_OS_ANDROID)
+#if QT_CONFIG(opengles2) && defined(Q_OS_ANDROID)
::glBindAttribLocation(program, index, name);
#else
Q_ASSERT(QOpenGLFunctions::isInitialized(d_ptr));
@@ -1132,7 +1092,7 @@ inline void QOpenGLFunctions::glBindAttribLocation(GLuint program, GLuint index,
inline void QOpenGLFunctions::glBindBuffer(GLenum target, GLuint buffer)
{
-#if defined(QT_OPENGL_ES_2) && defined(Q_OS_ANDROID)
+#if QT_CONFIG(opengles2) && defined(Q_OS_ANDROID)
::glBindBuffer(target, buffer);
#else
Q_ASSERT(QOpenGLFunctions::isInitialized(d_ptr));
@@ -1145,7 +1105,7 @@ inline void QOpenGLFunctions::glBindFramebuffer(GLenum target, GLuint framebuffe
{
if (framebuffer == 0)
framebuffer = QOpenGLContext::currentContext()->defaultFramebufferObject();
-#if defined(QT_OPENGL_ES_2) && defined(Q_OS_ANDROID)
+#if QT_CONFIG(opengles2) && defined(Q_OS_ANDROID)
::glBindFramebuffer(target, framebuffer);
#else
Q_ASSERT(QOpenGLFunctions::isInitialized(d_ptr));
@@ -1156,7 +1116,7 @@ inline void QOpenGLFunctions::glBindFramebuffer(GLenum target, GLuint framebuffe
inline void QOpenGLFunctions::glBindRenderbuffer(GLenum target, GLuint renderbuffer)
{
-#if defined(QT_OPENGL_ES_2) && defined(Q_OS_ANDROID)
+#if QT_CONFIG(opengles2) && defined(Q_OS_ANDROID)
::glBindRenderbuffer(target, renderbuffer);
#else
Q_ASSERT(QOpenGLFunctions::isInitialized(d_ptr));
@@ -1167,7 +1127,7 @@ inline void QOpenGLFunctions::glBindRenderbuffer(GLenum target, GLuint renderbuf
inline void QOpenGLFunctions::glBlendColor(GLclampf red, GLclampf green, GLclampf blue, GLclampf alpha)
{
-#if defined(QT_OPENGL_ES_2) && defined(Q_OS_ANDROID)
+#if QT_CONFIG(opengles2) && defined(Q_OS_ANDROID)
::glBlendColor(red, green, blue, alpha);
#else
Q_ASSERT(QOpenGLFunctions::isInitialized(d_ptr));
@@ -1178,7 +1138,7 @@ inline void QOpenGLFunctions::glBlendColor(GLclampf red, GLclampf green, GLclamp
inline void QOpenGLFunctions::glBlendEquation(GLenum mode)
{
-#if defined(QT_OPENGL_ES_2) && defined(Q_OS_ANDROID)
+#if QT_CONFIG(opengles2) && defined(Q_OS_ANDROID)
::glBlendEquation(mode);
#else
Q_ASSERT(QOpenGLFunctions::isInitialized(d_ptr));
@@ -1189,7 +1149,7 @@ inline void QOpenGLFunctions::glBlendEquation(GLenum mode)
inline void QOpenGLFunctions::glBlendEquationSeparate(GLenum modeRGB, GLenum modeAlpha)
{
-#if defined(QT_OPENGL_ES_2) && defined(Q_OS_ANDROID)
+#if QT_CONFIG(opengles2) && defined(Q_OS_ANDROID)
::glBlendEquationSeparate(modeRGB, modeAlpha);
#else
Q_ASSERT(QOpenGLFunctions::isInitialized(d_ptr));
@@ -1200,7 +1160,7 @@ inline void QOpenGLFunctions::glBlendEquationSeparate(GLenum modeRGB, GLenum mod
inline void QOpenGLFunctions::glBlendFuncSeparate(GLenum srcRGB, GLenum dstRGB, GLenum srcAlpha, GLenum dstAlpha)
{
-#if defined(QT_OPENGL_ES_2) && defined(Q_OS_ANDROID)
+#if QT_CONFIG(opengles2) && defined(Q_OS_ANDROID)
::glBlendFuncSeparate(srcRGB, dstRGB, srcAlpha, dstAlpha);
#else
Q_ASSERT(QOpenGLFunctions::isInitialized(d_ptr));
@@ -1211,7 +1171,7 @@ inline void QOpenGLFunctions::glBlendFuncSeparate(GLenum srcRGB, GLenum dstRGB,
inline void QOpenGLFunctions::glBufferData(GLenum target, qopengl_GLsizeiptr size, const void* data, GLenum usage)
{
-#if defined(QT_OPENGL_ES_2) && defined(Q_OS_ANDROID)
+#if QT_CONFIG(opengles2) && defined(Q_OS_ANDROID)
::glBufferData(target, size, data, usage);
#else
Q_ASSERT(QOpenGLFunctions::isInitialized(d_ptr));
@@ -1222,7 +1182,7 @@ inline void QOpenGLFunctions::glBufferData(GLenum target, qopengl_GLsizeiptr siz
inline void QOpenGLFunctions::glBufferSubData(GLenum target, qopengl_GLintptr offset, qopengl_GLsizeiptr size, const void* data)
{
-#if defined(QT_OPENGL_ES_2) && defined(Q_OS_ANDROID)
+#if QT_CONFIG(opengles2) && defined(Q_OS_ANDROID)
::glBufferSubData(target, offset, size, data);
#else
Q_ASSERT(QOpenGLFunctions::isInitialized(d_ptr));
@@ -1233,7 +1193,7 @@ inline void QOpenGLFunctions::glBufferSubData(GLenum target, qopengl_GLintptr of
inline GLenum QOpenGLFunctions::glCheckFramebufferStatus(GLenum target)
{
-#if defined(QT_OPENGL_ES_2) && defined(Q_OS_ANDROID)
+#if QT_CONFIG(opengles2) && defined(Q_OS_ANDROID)
GLenum result = ::glCheckFramebufferStatus(target);
#else
Q_ASSERT(QOpenGLFunctions::isInitialized(d_ptr));
@@ -1245,7 +1205,7 @@ inline GLenum QOpenGLFunctions::glCheckFramebufferStatus(GLenum target)
inline void QOpenGLFunctions::glClearDepthf(GLclampf depth)
{
-#if defined(QT_OPENGL_ES) && defined(Q_OS_ANDROID)
+#if QT_CONFIG(opengles2) && defined(Q_OS_ANDROID)
::glClearDepthf(depth);
#else
Q_ASSERT(QOpenGLFunctions::isInitialized(d_ptr));
@@ -1256,7 +1216,7 @@ inline void QOpenGLFunctions::glClearDepthf(GLclampf depth)
inline void QOpenGLFunctions::glCompileShader(GLuint shader)
{
-#if defined(QT_OPENGL_ES_2) && defined(Q_OS_ANDROID)
+#if QT_CONFIG(opengles2) && defined(Q_OS_ANDROID)
::glCompileShader(shader);
#else
Q_ASSERT(QOpenGLFunctions::isInitialized(d_ptr));
@@ -1267,7 +1227,7 @@ inline void QOpenGLFunctions::glCompileShader(GLuint shader)
inline void QOpenGLFunctions::glCompressedTexImage2D(GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLint border, GLsizei imageSize, const void* data)
{
-#if defined(QT_OPENGL_ES_2) && defined(Q_OS_ANDROID)
+#if QT_CONFIG(opengles2) && defined(Q_OS_ANDROID)
::glCompressedTexImage2D(target, level, internalformat, width, height, border, imageSize, data);
#else
Q_ASSERT(QOpenGLFunctions::isInitialized(d_ptr));
@@ -1278,7 +1238,7 @@ inline void QOpenGLFunctions::glCompressedTexImage2D(GLenum target, GLint level,
inline void QOpenGLFunctions::glCompressedTexSubImage2D(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLsizei imageSize, const void* data)
{
-#if defined(QT_OPENGL_ES_2) && defined(Q_OS_ANDROID)
+#if QT_CONFIG(opengles2) && defined(Q_OS_ANDROID)
::glCompressedTexSubImage2D(target, level, xoffset, yoffset, width, height, format, imageSize, data);
#else
Q_ASSERT(QOpenGLFunctions::isInitialized(d_ptr));
@@ -1289,7 +1249,7 @@ inline void QOpenGLFunctions::glCompressedTexSubImage2D(GLenum target, GLint lev
inline GLuint QOpenGLFunctions::glCreateProgram()
{
-#if defined(QT_OPENGL_ES_2) && defined(Q_OS_ANDROID)
+#if QT_CONFIG(opengles2) && defined(Q_OS_ANDROID)
GLuint result = ::glCreateProgram();
#else
Q_ASSERT(QOpenGLFunctions::isInitialized(d_ptr));
@@ -1301,7 +1261,7 @@ inline GLuint QOpenGLFunctions::glCreateProgram()
inline GLuint QOpenGLFunctions::glCreateShader(GLenum type)
{
-#if defined(QT_OPENGL_ES_2) && defined(Q_OS_ANDROID)
+#if QT_CONFIG(opengles2) && defined(Q_OS_ANDROID)
GLuint result = ::glCreateShader(type);
#else
Q_ASSERT(QOpenGLFunctions::isInitialized(d_ptr));
@@ -1313,7 +1273,7 @@ inline GLuint QOpenGLFunctions::glCreateShader(GLenum type)
inline void QOpenGLFunctions::glDeleteBuffers(GLsizei n, const GLuint* buffers)
{
-#if defined(QT_OPENGL_ES_2) && defined(Q_OS_ANDROID)
+#if QT_CONFIG(opengles2) && defined(Q_OS_ANDROID)
::glDeleteBuffers(n, buffers);
#else
Q_ASSERT(QOpenGLFunctions::isInitialized(d_ptr));
@@ -1324,7 +1284,7 @@ inline void QOpenGLFunctions::glDeleteBuffers(GLsizei n, const GLuint* buffers)
inline void QOpenGLFunctions::glDeleteFramebuffers(GLsizei n, const GLuint* framebuffers)
{
-#if defined(QT_OPENGL_ES_2) && defined(Q_OS_ANDROID)
+#if QT_CONFIG(opengles2) && defined(Q_OS_ANDROID)
::glDeleteFramebuffers(n, framebuffers);
#else
Q_ASSERT(QOpenGLFunctions::isInitialized(d_ptr));
@@ -1335,7 +1295,7 @@ inline void QOpenGLFunctions::glDeleteFramebuffers(GLsizei n, const GLuint* fram
inline void QOpenGLFunctions::glDeleteProgram(GLuint program)
{
-#if defined(QT_OPENGL_ES_2) && defined(Q_OS_ANDROID)
+#if QT_CONFIG(opengles2) && defined(Q_OS_ANDROID)
::glDeleteProgram(program);
#else
Q_ASSERT(QOpenGLFunctions::isInitialized(d_ptr));
@@ -1346,7 +1306,7 @@ inline void QOpenGLFunctions::glDeleteProgram(GLuint program)
inline void QOpenGLFunctions::glDeleteRenderbuffers(GLsizei n, const GLuint* renderbuffers)
{
-#if defined(QT_OPENGL_ES_2) && defined(Q_OS_ANDROID)
+#if QT_CONFIG(opengles2) && defined(Q_OS_ANDROID)
::glDeleteRenderbuffers(n, renderbuffers);
#else
Q_ASSERT(QOpenGLFunctions::isInitialized(d_ptr));
@@ -1357,7 +1317,7 @@ inline void QOpenGLFunctions::glDeleteRenderbuffers(GLsizei n, const GLuint* ren
inline void QOpenGLFunctions::glDeleteShader(GLuint shader)
{
-#if defined(QT_OPENGL_ES_2) && defined(Q_OS_ANDROID)
+#if QT_CONFIG(opengles2) && defined(Q_OS_ANDROID)
::glDeleteShader(shader);
#else
Q_ASSERT(QOpenGLFunctions::isInitialized(d_ptr));
@@ -1368,7 +1328,7 @@ inline void QOpenGLFunctions::glDeleteShader(GLuint shader)
inline void QOpenGLFunctions::glDepthRangef(GLclampf zNear, GLclampf zFar)
{
-#if defined(QT_OPENGL_ES) && defined(Q_OS_ANDROID)
+#if QT_CONFIG(opengles2) && defined(Q_OS_ANDROID)
::glDepthRangef(zNear, zFar);
#else
Q_ASSERT(QOpenGLFunctions::isInitialized(d_ptr));
@@ -1379,7 +1339,7 @@ inline void QOpenGLFunctions::glDepthRangef(GLclampf zNear, GLclampf zFar)
inline void QOpenGLFunctions::glDetachShader(GLuint program, GLuint shader)
{
-#if defined(QT_OPENGL_ES_2) && defined(Q_OS_ANDROID)
+#if QT_CONFIG(opengles2) && defined(Q_OS_ANDROID)
::glDetachShader(program, shader);
#else
Q_ASSERT(QOpenGLFunctions::isInitialized(d_ptr));
@@ -1390,7 +1350,7 @@ inline void QOpenGLFunctions::glDetachShader(GLuint program, GLuint shader)
inline void QOpenGLFunctions::glDisableVertexAttribArray(GLuint index)
{
-#if defined(QT_OPENGL_ES_2) && defined(Q_OS_ANDROID)
+#if QT_CONFIG(opengles2) && defined(Q_OS_ANDROID)
::glDisableVertexAttribArray(index);
#else
Q_ASSERT(QOpenGLFunctions::isInitialized(d_ptr));
@@ -1401,7 +1361,7 @@ inline void QOpenGLFunctions::glDisableVertexAttribArray(GLuint index)
inline void QOpenGLFunctions::glEnableVertexAttribArray(GLuint index)
{
-#if defined(QT_OPENGL_ES_2) && defined(Q_OS_ANDROID)
+#if QT_CONFIG(opengles2) && defined(Q_OS_ANDROID)
::glEnableVertexAttribArray(index);
#else
Q_ASSERT(QOpenGLFunctions::isInitialized(d_ptr));
@@ -1412,7 +1372,7 @@ inline void QOpenGLFunctions::glEnableVertexAttribArray(GLuint index)
inline void QOpenGLFunctions::glFramebufferRenderbuffer(GLenum target, GLenum attachment, GLenum renderbuffertarget, GLuint renderbuffer)
{
-#if defined(QT_OPENGL_ES_2) && defined(Q_OS_ANDROID)
+#if QT_CONFIG(opengles2) && defined(Q_OS_ANDROID)
::glFramebufferRenderbuffer(target, attachment, renderbuffertarget, renderbuffer);
#else
Q_ASSERT(QOpenGLFunctions::isInitialized(d_ptr));
@@ -1423,7 +1383,7 @@ inline void QOpenGLFunctions::glFramebufferRenderbuffer(GLenum target, GLenum at
inline void QOpenGLFunctions::glFramebufferTexture2D(GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level)
{
-#if defined(QT_OPENGL_ES_2) && defined(Q_OS_ANDROID)
+#if QT_CONFIG(opengles2) && defined(Q_OS_ANDROID)
::glFramebufferTexture2D(target, attachment, textarget, texture, level);
#else
Q_ASSERT(QOpenGLFunctions::isInitialized(d_ptr));
@@ -1434,7 +1394,7 @@ inline void QOpenGLFunctions::glFramebufferTexture2D(GLenum target, GLenum attac
inline void QOpenGLFunctions::glGenBuffers(GLsizei n, GLuint* buffers)
{
-#if defined(QT_OPENGL_ES_2) && defined(Q_OS_ANDROID)
+#if QT_CONFIG(opengles2) && defined(Q_OS_ANDROID)
::glGenBuffers(n, buffers);
#else
Q_ASSERT(QOpenGLFunctions::isInitialized(d_ptr));
@@ -1445,7 +1405,7 @@ inline void QOpenGLFunctions::glGenBuffers(GLsizei n, GLuint* buffers)
inline void QOpenGLFunctions::glGenerateMipmap(GLenum target)
{
-#if defined(QT_OPENGL_ES_2) && defined(Q_OS_ANDROID)
+#if QT_CONFIG(opengles2) && defined(Q_OS_ANDROID)
::glGenerateMipmap(target);
#else
Q_ASSERT(QOpenGLFunctions::isInitialized(d_ptr));
@@ -1456,7 +1416,7 @@ inline void QOpenGLFunctions::glGenerateMipmap(GLenum target)
inline void QOpenGLFunctions::glGenFramebuffers(GLsizei n, GLuint* framebuffers)
{
-#if defined(QT_OPENGL_ES_2) && defined(Q_OS_ANDROID)
+#if QT_CONFIG(opengles2) && defined(Q_OS_ANDROID)
::glGenFramebuffers(n, framebuffers);
#else
Q_ASSERT(QOpenGLFunctions::isInitialized(d_ptr));
@@ -1467,7 +1427,7 @@ inline void QOpenGLFunctions::glGenFramebuffers(GLsizei n, GLuint* framebuffers)
inline void QOpenGLFunctions::glGenRenderbuffers(GLsizei n, GLuint* renderbuffers)
{
-#if defined(QT_OPENGL_ES_2) && defined(Q_OS_ANDROID)
+#if QT_CONFIG(opengles2) && defined(Q_OS_ANDROID)
::glGenRenderbuffers(n, renderbuffers);
#else
Q_ASSERT(QOpenGLFunctions::isInitialized(d_ptr));
@@ -1478,7 +1438,7 @@ inline void QOpenGLFunctions::glGenRenderbuffers(GLsizei n, GLuint* renderbuffer
inline void QOpenGLFunctions::glGetActiveAttrib(GLuint program, GLuint index, GLsizei bufsize, GLsizei* length, GLint* size, GLenum* type, char* name)
{
-#if defined(QT_OPENGL_ES_2) && defined(Q_OS_ANDROID)
+#if QT_CONFIG(opengles2) && defined(Q_OS_ANDROID)
::glGetActiveAttrib(program, index, bufsize, length, size, type, name);
#else
Q_ASSERT(QOpenGLFunctions::isInitialized(d_ptr));
@@ -1489,7 +1449,7 @@ inline void QOpenGLFunctions::glGetActiveAttrib(GLuint program, GLuint index, GL
inline void QOpenGLFunctions::glGetActiveUniform(GLuint program, GLuint index, GLsizei bufsize, GLsizei* length, GLint* size, GLenum* type, char* name)
{
-#if defined(QT_OPENGL_ES_2) && defined(Q_OS_ANDROID)
+#if QT_CONFIG(opengles2) && defined(Q_OS_ANDROID)
::glGetActiveUniform(program, index, bufsize, length, size, type, name);
#else
Q_ASSERT(QOpenGLFunctions::isInitialized(d_ptr));
@@ -1500,7 +1460,7 @@ inline void QOpenGLFunctions::glGetActiveUniform(GLuint program, GLuint index, G
inline void QOpenGLFunctions::glGetAttachedShaders(GLuint program, GLsizei maxcount, GLsizei* count, GLuint* shaders)
{
-#if defined(QT_OPENGL_ES_2) && defined(Q_OS_ANDROID)
+#if QT_CONFIG(opengles2) && defined(Q_OS_ANDROID)
::glGetAttachedShaders(program, maxcount, count, shaders);
#else
Q_ASSERT(QOpenGLFunctions::isInitialized(d_ptr));
@@ -1511,7 +1471,7 @@ inline void QOpenGLFunctions::glGetAttachedShaders(GLuint program, GLsizei maxco
inline GLint QOpenGLFunctions::glGetAttribLocation(GLuint program, const char* name)
{
-#if defined(QT_OPENGL_ES_2) && defined(Q_OS_ANDROID)
+#if QT_CONFIG(opengles2) && defined(Q_OS_ANDROID)
GLint result = ::glGetAttribLocation(program, name);
#else
Q_ASSERT(QOpenGLFunctions::isInitialized(d_ptr));
@@ -1523,7 +1483,7 @@ inline GLint QOpenGLFunctions::glGetAttribLocation(GLuint program, const char* n
inline void QOpenGLFunctions::glGetBufferParameteriv(GLenum target, GLenum pname, GLint* params)
{
-#if defined(QT_OPENGL_ES_2) && defined(Q_OS_ANDROID)
+#if QT_CONFIG(opengles2) && defined(Q_OS_ANDROID)
::glGetBufferParameteriv(target, pname, params);
#else
Q_ASSERT(QOpenGLFunctions::isInitialized(d_ptr));
@@ -1534,7 +1494,7 @@ inline void QOpenGLFunctions::glGetBufferParameteriv(GLenum target, GLenum pname
inline void QOpenGLFunctions::glGetFramebufferAttachmentParameteriv(GLenum target, GLenum attachment, GLenum pname, GLint* params)
{
-#if defined(QT_OPENGL_ES_2) && defined(Q_OS_ANDROID)
+#if QT_CONFIG(opengles2) && defined(Q_OS_ANDROID)
::glGetFramebufferAttachmentParameteriv(target, attachment, pname, params);
#else
Q_ASSERT(QOpenGLFunctions::isInitialized(d_ptr));
@@ -1545,7 +1505,7 @@ inline void QOpenGLFunctions::glGetFramebufferAttachmentParameteriv(GLenum targe
inline void QOpenGLFunctions::glGetProgramiv(GLuint program, GLenum pname, GLint* params)
{
-#if defined(QT_OPENGL_ES_2) && defined(Q_OS_ANDROID)
+#if QT_CONFIG(opengles2) && defined(Q_OS_ANDROID)
::glGetProgramiv(program, pname, params);
#else
Q_ASSERT(QOpenGLFunctions::isInitialized(d_ptr));
@@ -1556,7 +1516,7 @@ inline void QOpenGLFunctions::glGetProgramiv(GLuint program, GLenum pname, GLint
inline void QOpenGLFunctions::glGetProgramInfoLog(GLuint program, GLsizei bufsize, GLsizei* length, char* infolog)
{
-#if defined(QT_OPENGL_ES_2) && defined(Q_OS_ANDROID)
+#if QT_CONFIG(opengles2) && defined(Q_OS_ANDROID)
::glGetProgramInfoLog(program, bufsize, length, infolog);
#else
Q_ASSERT(QOpenGLFunctions::isInitialized(d_ptr));
@@ -1567,7 +1527,7 @@ inline void QOpenGLFunctions::glGetProgramInfoLog(GLuint program, GLsizei bufsiz
inline void QOpenGLFunctions::glGetRenderbufferParameteriv(GLenum target, GLenum pname, GLint* params)
{
-#if defined(QT_OPENGL_ES_2) && defined(Q_OS_ANDROID)
+#if QT_CONFIG(opengles2) && defined(Q_OS_ANDROID)
::glGetRenderbufferParameteriv(target, pname, params);
#else
Q_ASSERT(QOpenGLFunctions::isInitialized(d_ptr));
@@ -1578,7 +1538,7 @@ inline void QOpenGLFunctions::glGetRenderbufferParameteriv(GLenum target, GLenum
inline void QOpenGLFunctions::glGetShaderiv(GLuint shader, GLenum pname, GLint* params)
{
-#if defined(QT_OPENGL_ES_2) && defined(Q_OS_ANDROID)
+#if QT_CONFIG(opengles2) && defined(Q_OS_ANDROID)
::glGetShaderiv(shader, pname, params);
#else
Q_ASSERT(QOpenGLFunctions::isInitialized(d_ptr));
@@ -1589,7 +1549,7 @@ inline void QOpenGLFunctions::glGetShaderiv(GLuint shader, GLenum pname, GLint*
inline void QOpenGLFunctions::glGetShaderInfoLog(GLuint shader, GLsizei bufsize, GLsizei* length, char* infolog)
{
-#if defined(QT_OPENGL_ES_2) && defined(Q_OS_ANDROID)
+#if QT_CONFIG(opengles2) && defined(Q_OS_ANDROID)
::glGetShaderInfoLog(shader, bufsize, length, infolog);
#else
Q_ASSERT(QOpenGLFunctions::isInitialized(d_ptr));
@@ -1600,7 +1560,7 @@ inline void QOpenGLFunctions::glGetShaderInfoLog(GLuint shader, GLsizei bufsize,
inline void QOpenGLFunctions::glGetShaderPrecisionFormat(GLenum shadertype, GLenum precisiontype, GLint* range, GLint* precision)
{
-#if defined(QT_OPENGL_ES_2) && defined(Q_OS_ANDROID)
+#if QT_CONFIG(opengles2) && defined(Q_OS_ANDROID)
::glGetShaderPrecisionFormat(shadertype, precisiontype, range, precision);
#else
Q_ASSERT(QOpenGLFunctions::isInitialized(d_ptr));
@@ -1611,7 +1571,7 @@ inline void QOpenGLFunctions::glGetShaderPrecisionFormat(GLenum shadertype, GLen
inline void QOpenGLFunctions::glGetShaderSource(GLuint shader, GLsizei bufsize, GLsizei* length, char* source)
{
-#if defined(QT_OPENGL_ES_2) && defined(Q_OS_ANDROID)
+#if QT_CONFIG(opengles2) && defined(Q_OS_ANDROID)
::glGetShaderSource(shader, bufsize, length, source);
#else
Q_ASSERT(QOpenGLFunctions::isInitialized(d_ptr));
@@ -1622,7 +1582,7 @@ inline void QOpenGLFunctions::glGetShaderSource(GLuint shader, GLsizei bufsize,
inline void QOpenGLFunctions::glGetUniformfv(GLuint program, GLint location, GLfloat* params)
{
-#if defined(QT_OPENGL_ES_2) && defined(Q_OS_ANDROID)
+#if QT_CONFIG(opengles2) && defined(Q_OS_ANDROID)
::glGetUniformfv(program, location, params);
#else
Q_ASSERT(QOpenGLFunctions::isInitialized(d_ptr));
@@ -1633,7 +1593,7 @@ inline void QOpenGLFunctions::glGetUniformfv(GLuint program, GLint location, GLf
inline void QOpenGLFunctions::glGetUniformiv(GLuint program, GLint location, GLint* params)
{
-#if defined(QT_OPENGL_ES_2) && defined(Q_OS_ANDROID)
+#if QT_CONFIG(opengles2) && defined(Q_OS_ANDROID)
::glGetUniformiv(program, location, params);
#else
Q_ASSERT(QOpenGLFunctions::isInitialized(d_ptr));
@@ -1644,7 +1604,7 @@ inline void QOpenGLFunctions::glGetUniformiv(GLuint program, GLint location, GLi
inline GLint QOpenGLFunctions::glGetUniformLocation(GLuint program, const char* name)
{
-#if defined(QT_OPENGL_ES_2) && defined(Q_OS_ANDROID)
+#if QT_CONFIG(opengles2) && defined(Q_OS_ANDROID)
GLint result = ::glGetUniformLocation(program, name);
#else
Q_ASSERT(QOpenGLFunctions::isInitialized(d_ptr));
@@ -1656,7 +1616,7 @@ inline GLint QOpenGLFunctions::glGetUniformLocation(GLuint program, const char*
inline void QOpenGLFunctions::glGetVertexAttribfv(GLuint index, GLenum pname, GLfloat* params)
{
-#if defined(QT_OPENGL_ES_2) && defined(Q_OS_ANDROID)
+#if QT_CONFIG(opengles2) && defined(Q_OS_ANDROID)
::glGetVertexAttribfv(index, pname, params);
#else
Q_ASSERT(QOpenGLFunctions::isInitialized(d_ptr));
@@ -1667,7 +1627,7 @@ inline void QOpenGLFunctions::glGetVertexAttribfv(GLuint index, GLenum pname, GL
inline void QOpenGLFunctions::glGetVertexAttribiv(GLuint index, GLenum pname, GLint* params)
{
-#if defined(QT_OPENGL_ES_2) && defined(Q_OS_ANDROID)
+#if QT_CONFIG(opengles2) && defined(Q_OS_ANDROID)
::glGetVertexAttribiv(index, pname, params);
#else
Q_ASSERT(QOpenGLFunctions::isInitialized(d_ptr));
@@ -1678,7 +1638,7 @@ inline void QOpenGLFunctions::glGetVertexAttribiv(GLuint index, GLenum pname, GL
inline void QOpenGLFunctions::glGetVertexAttribPointerv(GLuint index, GLenum pname, void** pointer)
{
-#if defined(QT_OPENGL_ES_2) && defined(Q_OS_ANDROID)
+#if QT_CONFIG(opengles2) && defined(Q_OS_ANDROID)
::glGetVertexAttribPointerv(index, pname, pointer);
#else
Q_ASSERT(QOpenGLFunctions::isInitialized(d_ptr));
@@ -1689,7 +1649,7 @@ inline void QOpenGLFunctions::glGetVertexAttribPointerv(GLuint index, GLenum pna
inline GLboolean QOpenGLFunctions::glIsBuffer(GLuint buffer)
{
-#if defined(QT_OPENGL_ES_2) && defined(Q_OS_ANDROID)
+#if QT_CONFIG(opengles2) && defined(Q_OS_ANDROID)
GLboolean result = ::glIsBuffer(buffer);
#else
Q_ASSERT(QOpenGLFunctions::isInitialized(d_ptr));
@@ -1701,7 +1661,7 @@ inline GLboolean QOpenGLFunctions::glIsBuffer(GLuint buffer)
inline GLboolean QOpenGLFunctions::glIsFramebuffer(GLuint framebuffer)
{
-#if defined(QT_OPENGL_ES_2) && defined(Q_OS_ANDROID)
+#if QT_CONFIG(opengles2) && defined(Q_OS_ANDROID)
GLboolean result = ::glIsFramebuffer(framebuffer);
#else
Q_ASSERT(QOpenGLFunctions::isInitialized(d_ptr));
@@ -1713,7 +1673,7 @@ inline GLboolean QOpenGLFunctions::glIsFramebuffer(GLuint framebuffer)
inline GLboolean QOpenGLFunctions::glIsProgram(GLuint program)
{
-#if defined(QT_OPENGL_ES_2) && defined(Q_OS_ANDROID)
+#if QT_CONFIG(opengles2) && defined(Q_OS_ANDROID)
GLboolean result = ::glIsProgram(program);
#else
Q_ASSERT(QOpenGLFunctions::isInitialized(d_ptr));
@@ -1725,7 +1685,7 @@ inline GLboolean QOpenGLFunctions::glIsProgram(GLuint program)
inline GLboolean QOpenGLFunctions::glIsRenderbuffer(GLuint renderbuffer)
{
-#if defined(QT_OPENGL_ES_2) && defined(Q_OS_ANDROID)
+#if QT_CONFIG(opengles2) && defined(Q_OS_ANDROID)
GLboolean result = ::glIsRenderbuffer(renderbuffer);
#else
Q_ASSERT(QOpenGLFunctions::isInitialized(d_ptr));
@@ -1737,7 +1697,7 @@ inline GLboolean QOpenGLFunctions::glIsRenderbuffer(GLuint renderbuffer)
inline GLboolean QOpenGLFunctions::glIsShader(GLuint shader)
{
-#if defined(QT_OPENGL_ES_2) && defined(Q_OS_ANDROID)
+#if QT_CONFIG(opengles2) && defined(Q_OS_ANDROID)
GLboolean result = ::glIsShader(shader);
#else
Q_ASSERT(QOpenGLFunctions::isInitialized(d_ptr));
@@ -1749,7 +1709,7 @@ inline GLboolean QOpenGLFunctions::glIsShader(GLuint shader)
inline void QOpenGLFunctions::glLinkProgram(GLuint program)
{
-#if defined(QT_OPENGL_ES_2) && defined(Q_OS_ANDROID)
+#if QT_CONFIG(opengles2) && defined(Q_OS_ANDROID)
::glLinkProgram(program);
#else
Q_ASSERT(QOpenGLFunctions::isInitialized(d_ptr));
@@ -1760,7 +1720,7 @@ inline void QOpenGLFunctions::glLinkProgram(GLuint program)
inline void QOpenGLFunctions::glReleaseShaderCompiler()
{
-#if defined(QT_OPENGL_ES_2) && defined(Q_OS_ANDROID)
+#if QT_CONFIG(opengles2) && defined(Q_OS_ANDROID)
::glReleaseShaderCompiler();
#else
Q_ASSERT(QOpenGLFunctions::isInitialized(d_ptr));
@@ -1771,7 +1731,7 @@ inline void QOpenGLFunctions::glReleaseShaderCompiler()
inline void QOpenGLFunctions::glRenderbufferStorage(GLenum target, GLenum internalformat, GLsizei width, GLsizei height)
{
-#if defined(QT_OPENGL_ES_2) && defined(Q_OS_ANDROID)
+#if QT_CONFIG(opengles2) && defined(Q_OS_ANDROID)
::glRenderbufferStorage(target, internalformat, width, height);
#else
Q_ASSERT(QOpenGLFunctions::isInitialized(d_ptr));
@@ -1782,7 +1742,7 @@ inline void QOpenGLFunctions::glRenderbufferStorage(GLenum target, GLenum intern
inline void QOpenGLFunctions::glSampleCoverage(GLclampf value, GLboolean invert)
{
-#if defined(QT_OPENGL_ES_2) && defined(Q_OS_ANDROID)
+#if QT_CONFIG(opengles2) && defined(Q_OS_ANDROID)
::glSampleCoverage(value, invert);
#else
Q_ASSERT(QOpenGLFunctions::isInitialized(d_ptr));
@@ -1793,7 +1753,7 @@ inline void QOpenGLFunctions::glSampleCoverage(GLclampf value, GLboolean invert)
inline void QOpenGLFunctions::glShaderBinary(GLint n, const GLuint* shaders, GLenum binaryformat, const void* binary, GLint length)
{
-#if defined(QT_OPENGL_ES_2) && defined(Q_OS_ANDROID)
+#if QT_CONFIG(opengles2) && defined(Q_OS_ANDROID)
::glShaderBinary(n, shaders, binaryformat, binary, length);
#else
Q_ASSERT(QOpenGLFunctions::isInitialized(d_ptr));
@@ -1804,7 +1764,7 @@ inline void QOpenGLFunctions::glShaderBinary(GLint n, const GLuint* shaders, GLe
inline void QOpenGLFunctions::glShaderSource(GLuint shader, GLsizei count, const char** string, const GLint* length)
{
-#if defined(QT_OPENGL_ES_2) && defined(Q_OS_ANDROID)
+#if QT_CONFIG(opengles2) && defined(Q_OS_ANDROID)
::glShaderSource(shader, count, string, length);
#else
Q_ASSERT(QOpenGLFunctions::isInitialized(d_ptr));
@@ -1815,7 +1775,7 @@ inline void QOpenGLFunctions::glShaderSource(GLuint shader, GLsizei count, const
inline void QOpenGLFunctions::glStencilFuncSeparate(GLenum face, GLenum func, GLint ref, GLuint mask)
{
-#if defined(QT_OPENGL_ES_2) && defined(Q_OS_ANDROID)
+#if QT_CONFIG(opengles2) && defined(Q_OS_ANDROID)
::glStencilFuncSeparate(face, func, ref, mask);
#else
Q_ASSERT(QOpenGLFunctions::isInitialized(d_ptr));
@@ -1826,7 +1786,7 @@ inline void QOpenGLFunctions::glStencilFuncSeparate(GLenum face, GLenum func, GL
inline void QOpenGLFunctions::glStencilMaskSeparate(GLenum face, GLuint mask)
{
-#if defined(QT_OPENGL_ES_2) && defined(Q_OS_ANDROID)
+#if QT_CONFIG(opengles2) && defined(Q_OS_ANDROID)
::glStencilMaskSeparate(face, mask);
#else
Q_ASSERT(QOpenGLFunctions::isInitialized(d_ptr));
@@ -1837,7 +1797,7 @@ inline void QOpenGLFunctions::glStencilMaskSeparate(GLenum face, GLuint mask)
inline void QOpenGLFunctions::glStencilOpSeparate(GLenum face, GLenum fail, GLenum zfail, GLenum zpass)
{
-#if defined(QT_OPENGL_ES_2) && defined(Q_OS_ANDROID)
+#if QT_CONFIG(opengles2) && defined(Q_OS_ANDROID)
::glStencilOpSeparate(face, fail, zfail, zpass);
#else
Q_ASSERT(QOpenGLFunctions::isInitialized(d_ptr));
@@ -1848,7 +1808,7 @@ inline void QOpenGLFunctions::glStencilOpSeparate(GLenum face, GLenum fail, GLen
inline void QOpenGLFunctions::glUniform1f(GLint location, GLfloat x)
{
-#if defined(QT_OPENGL_ES_2) && defined(Q_OS_ANDROID)
+#if QT_CONFIG(opengles2) && defined(Q_OS_ANDROID)
::glUniform1f(location, x);
#else
Q_ASSERT(QOpenGLFunctions::isInitialized(d_ptr));
@@ -1859,7 +1819,7 @@ inline void QOpenGLFunctions::glUniform1f(GLint location, GLfloat x)
inline void QOpenGLFunctions::glUniform1fv(GLint location, GLsizei count, const GLfloat* v)
{
-#if defined(QT_OPENGL_ES_2) && defined(Q_OS_ANDROID)
+#if QT_CONFIG(opengles2) && defined(Q_OS_ANDROID)
::glUniform1fv(location, count, v);
#else
Q_ASSERT(QOpenGLFunctions::isInitialized(d_ptr));
@@ -1870,7 +1830,7 @@ inline void QOpenGLFunctions::glUniform1fv(GLint location, GLsizei count, const
inline void QOpenGLFunctions::glUniform1i(GLint location, GLint x)
{
-#if defined(QT_OPENGL_ES_2) && defined(Q_OS_ANDROID)
+#if QT_CONFIG(opengles2) && defined(Q_OS_ANDROID)
::glUniform1i(location, x);
#else
Q_ASSERT(QOpenGLFunctions::isInitialized(d_ptr));
@@ -1881,7 +1841,7 @@ inline void QOpenGLFunctions::glUniform1i(GLint location, GLint x)
inline void QOpenGLFunctions::glUniform1iv(GLint location, GLsizei count, const GLint* v)
{
-#if defined(QT_OPENGL_ES_2) && defined(Q_OS_ANDROID)
+#if QT_CONFIG(opengles2) && defined(Q_OS_ANDROID)
::glUniform1iv(location, count, v);
#else
Q_ASSERT(QOpenGLFunctions::isInitialized(d_ptr));
@@ -1892,7 +1852,7 @@ inline void QOpenGLFunctions::glUniform1iv(GLint location, GLsizei count, const
inline void QOpenGLFunctions::glUniform2f(GLint location, GLfloat x, GLfloat y)
{
-#if defined(QT_OPENGL_ES_2) && defined(Q_OS_ANDROID)
+#if QT_CONFIG(opengles2) && defined(Q_OS_ANDROID)
::glUniform2f(location, x, y);
#else
Q_ASSERT(QOpenGLFunctions::isInitialized(d_ptr));
@@ -1903,7 +1863,7 @@ inline void QOpenGLFunctions::glUniform2f(GLint location, GLfloat x, GLfloat y)
inline void QOpenGLFunctions::glUniform2fv(GLint location, GLsizei count, const GLfloat* v)
{
-#if defined(QT_OPENGL_ES_2) && defined(Q_OS_ANDROID)
+#if QT_CONFIG(opengles2) && defined(Q_OS_ANDROID)
::glUniform2fv(location, count, v);
#else
Q_ASSERT(QOpenGLFunctions::isInitialized(d_ptr));
@@ -1914,7 +1874,7 @@ inline void QOpenGLFunctions::glUniform2fv(GLint location, GLsizei count, const
inline void QOpenGLFunctions::glUniform2i(GLint location, GLint x, GLint y)
{
-#if defined(QT_OPENGL_ES_2) && defined(Q_OS_ANDROID)
+#if QT_CONFIG(opengles2) && defined(Q_OS_ANDROID)
::glUniform2i(location, x, y);
#else
Q_ASSERT(QOpenGLFunctions::isInitialized(d_ptr));
@@ -1925,7 +1885,7 @@ inline void QOpenGLFunctions::glUniform2i(GLint location, GLint x, GLint y)
inline void QOpenGLFunctions::glUniform2iv(GLint location, GLsizei count, const GLint* v)
{
-#if defined(QT_OPENGL_ES_2) && defined(Q_OS_ANDROID)
+#if QT_CONFIG(opengles2) && defined(Q_OS_ANDROID)
::glUniform2iv(location, count, v);
#else
Q_ASSERT(QOpenGLFunctions::isInitialized(d_ptr));
@@ -1936,7 +1896,7 @@ inline void QOpenGLFunctions::glUniform2iv(GLint location, GLsizei count, const
inline void QOpenGLFunctions::glUniform3f(GLint location, GLfloat x, GLfloat y, GLfloat z)
{
-#if defined(QT_OPENGL_ES_2) && defined(Q_OS_ANDROID)
+#if QT_CONFIG(opengles2) && defined(Q_OS_ANDROID)
::glUniform3f(location, x, y, z);
#else
Q_ASSERT(QOpenGLFunctions::isInitialized(d_ptr));
@@ -1947,7 +1907,7 @@ inline void QOpenGLFunctions::glUniform3f(GLint location, GLfloat x, GLfloat y,
inline void QOpenGLFunctions::glUniform3fv(GLint location, GLsizei count, const GLfloat* v)
{
-#if defined(QT_OPENGL_ES_2) && defined(Q_OS_ANDROID)
+#if QT_CONFIG(opengles2) && defined(Q_OS_ANDROID)
::glUniform3fv(location, count, v);
#else
Q_ASSERT(QOpenGLFunctions::isInitialized(d_ptr));
@@ -1958,7 +1918,7 @@ inline void QOpenGLFunctions::glUniform3fv(GLint location, GLsizei count, const
inline void QOpenGLFunctions::glUniform3i(GLint location, GLint x, GLint y, GLint z)
{
-#if defined(QT_OPENGL_ES_2) && defined(Q_OS_ANDROID)
+#if QT_CONFIG(opengles2) && defined(Q_OS_ANDROID)
::glUniform3i(location, x, y, z);
#else
Q_ASSERT(QOpenGLFunctions::isInitialized(d_ptr));
@@ -1969,7 +1929,7 @@ inline void QOpenGLFunctions::glUniform3i(GLint location, GLint x, GLint y, GLin
inline void QOpenGLFunctions::glUniform3iv(GLint location, GLsizei count, const GLint* v)
{
-#if defined(QT_OPENGL_ES_2) && defined(Q_OS_ANDROID)
+#if QT_CONFIG(opengles2) && defined(Q_OS_ANDROID)
::glUniform3iv(location, count, v);
#else
Q_ASSERT(QOpenGLFunctions::isInitialized(d_ptr));
@@ -1980,7 +1940,7 @@ inline void QOpenGLFunctions::glUniform3iv(GLint location, GLsizei count, const
inline void QOpenGLFunctions::glUniform4f(GLint location, GLfloat x, GLfloat y, GLfloat z, GLfloat w)
{
-#if defined(QT_OPENGL_ES_2) && defined(Q_OS_ANDROID)
+#if QT_CONFIG(opengles2) && defined(Q_OS_ANDROID)
::glUniform4f(location, x, y, z, w);
#else
Q_ASSERT(QOpenGLFunctions::isInitialized(d_ptr));
@@ -1991,7 +1951,7 @@ inline void QOpenGLFunctions::glUniform4f(GLint location, GLfloat x, GLfloat y,
inline void QOpenGLFunctions::glUniform4fv(GLint location, GLsizei count, const GLfloat* v)
{
-#if defined(QT_OPENGL_ES_2) && defined(Q_OS_ANDROID)
+#if QT_CONFIG(opengles2) && defined(Q_OS_ANDROID)
::glUniform4fv(location, count, v);
#else
Q_ASSERT(QOpenGLFunctions::isInitialized(d_ptr));
@@ -2002,7 +1962,7 @@ inline void QOpenGLFunctions::glUniform4fv(GLint location, GLsizei count, const
inline void QOpenGLFunctions::glUniform4i(GLint location, GLint x, GLint y, GLint z, GLint w)
{
-#if defined(QT_OPENGL_ES_2) && defined(Q_OS_ANDROID)
+#if QT_CONFIG(opengles2) && defined(Q_OS_ANDROID)
::glUniform4i(location, x, y, z, w);
#else
Q_ASSERT(QOpenGLFunctions::isInitialized(d_ptr));
@@ -2013,7 +1973,7 @@ inline void QOpenGLFunctions::glUniform4i(GLint location, GLint x, GLint y, GLin
inline void QOpenGLFunctions::glUniform4iv(GLint location, GLsizei count, const GLint* v)
{
-#if defined(QT_OPENGL_ES_2) && defined(Q_OS_ANDROID)
+#if QT_CONFIG(opengles2) && defined(Q_OS_ANDROID)
::glUniform4iv(location, count, v);
#else
Q_ASSERT(QOpenGLFunctions::isInitialized(d_ptr));
@@ -2024,7 +1984,7 @@ inline void QOpenGLFunctions::glUniform4iv(GLint location, GLsizei count, const
inline void QOpenGLFunctions::glUniformMatrix2fv(GLint location, GLsizei count, GLboolean transpose, const GLfloat* value)
{
-#if defined(QT_OPENGL_ES_2) && defined(Q_OS_ANDROID)
+#if QT_CONFIG(opengles2) && defined(Q_OS_ANDROID)
::glUniformMatrix2fv(location, count, transpose, value);
#else
Q_ASSERT(QOpenGLFunctions::isInitialized(d_ptr));
@@ -2035,7 +1995,7 @@ inline void QOpenGLFunctions::glUniformMatrix2fv(GLint location, GLsizei count,
inline void QOpenGLFunctions::glUniformMatrix3fv(GLint location, GLsizei count, GLboolean transpose, const GLfloat* value)
{
-#if defined(QT_OPENGL_ES_2) && defined(Q_OS_ANDROID)
+#if QT_CONFIG(opengles2) && defined(Q_OS_ANDROID)
::glUniformMatrix3fv(location, count, transpose, value);
#else
Q_ASSERT(QOpenGLFunctions::isInitialized(d_ptr));
@@ -2046,7 +2006,7 @@ inline void QOpenGLFunctions::glUniformMatrix3fv(GLint location, GLsizei count,
inline void QOpenGLFunctions::glUniformMatrix4fv(GLint location, GLsizei count, GLboolean transpose, const GLfloat* value)
{
-#if defined(QT_OPENGL_ES_2) && defined(Q_OS_ANDROID)
+#if QT_CONFIG(opengles2) && defined(Q_OS_ANDROID)
::glUniformMatrix4fv(location, count, transpose, value);
#else
Q_ASSERT(QOpenGLFunctions::isInitialized(d_ptr));
@@ -2057,7 +2017,7 @@ inline void QOpenGLFunctions::glUniformMatrix4fv(GLint location, GLsizei count,
inline void QOpenGLFunctions::glUseProgram(GLuint program)
{
-#if defined(QT_OPENGL_ES_2) && defined(Q_OS_ANDROID)
+#if QT_CONFIG(opengles2) && defined(Q_OS_ANDROID)
::glUseProgram(program);
#else
Q_ASSERT(QOpenGLFunctions::isInitialized(d_ptr));
@@ -2068,7 +2028,7 @@ inline void QOpenGLFunctions::glUseProgram(GLuint program)
inline void QOpenGLFunctions::glValidateProgram(GLuint program)
{
-#if defined(QT_OPENGL_ES_2) && defined(Q_OS_ANDROID)
+#if QT_CONFIG(opengles2) && defined(Q_OS_ANDROID)
::glValidateProgram(program);
#else
Q_ASSERT(QOpenGLFunctions::isInitialized(d_ptr));
@@ -2079,7 +2039,7 @@ inline void QOpenGLFunctions::glValidateProgram(GLuint program)
inline void QOpenGLFunctions::glVertexAttrib1f(GLuint indx, GLfloat x)
{
-#if defined(QT_OPENGL_ES_2) && defined(Q_OS_ANDROID)
+#if QT_CONFIG(opengles2) && defined(Q_OS_ANDROID)
::glVertexAttrib1f(indx, x);
#else
Q_ASSERT(QOpenGLFunctions::isInitialized(d_ptr));
@@ -2090,7 +2050,7 @@ inline void QOpenGLFunctions::glVertexAttrib1f(GLuint indx, GLfloat x)
inline void QOpenGLFunctions::glVertexAttrib1fv(GLuint indx, const GLfloat* values)
{
-#if defined(QT_OPENGL_ES_2) && defined(Q_OS_ANDROID)
+#if QT_CONFIG(opengles2) && defined(Q_OS_ANDROID)
::glVertexAttrib1fv(indx, values);
#else
Q_ASSERT(QOpenGLFunctions::isInitialized(d_ptr));
@@ -2101,7 +2061,7 @@ inline void QOpenGLFunctions::glVertexAttrib1fv(GLuint indx, const GLfloat* valu
inline void QOpenGLFunctions::glVertexAttrib2f(GLuint indx, GLfloat x, GLfloat y)
{
-#if defined(QT_OPENGL_ES_2) && defined(Q_OS_ANDROID)
+#if QT_CONFIG(opengles2) && defined(Q_OS_ANDROID)
::glVertexAttrib2f(indx, x, y);
#else
Q_ASSERT(QOpenGLFunctions::isInitialized(d_ptr));
@@ -2112,7 +2072,7 @@ inline void QOpenGLFunctions::glVertexAttrib2f(GLuint indx, GLfloat x, GLfloat y
inline void QOpenGLFunctions::glVertexAttrib2fv(GLuint indx, const GLfloat* values)
{
-#if defined(QT_OPENGL_ES_2) && defined(Q_OS_ANDROID)
+#if QT_CONFIG(opengles2) && defined(Q_OS_ANDROID)
::glVertexAttrib2fv(indx, values);
#else
Q_ASSERT(QOpenGLFunctions::isInitialized(d_ptr));
@@ -2123,7 +2083,7 @@ inline void QOpenGLFunctions::glVertexAttrib2fv(GLuint indx, const GLfloat* valu
inline void QOpenGLFunctions::glVertexAttrib3f(GLuint indx, GLfloat x, GLfloat y, GLfloat z)
{
-#if defined(QT_OPENGL_ES_2) && defined(Q_OS_ANDROID)
+#if QT_CONFIG(opengles2) && defined(Q_OS_ANDROID)
::glVertexAttrib3f(indx, x, y, z);
#else
Q_ASSERT(QOpenGLFunctions::isInitialized(d_ptr));
@@ -2134,7 +2094,7 @@ inline void QOpenGLFunctions::glVertexAttrib3f(GLuint indx, GLfloat x, GLfloat y
inline void QOpenGLFunctions::glVertexAttrib3fv(GLuint indx, const GLfloat* values)
{
-#if defined(QT_OPENGL_ES_2) && defined(Q_OS_ANDROID)
+#if QT_CONFIG(opengles2) && defined(Q_OS_ANDROID)
::glVertexAttrib3fv(indx, values);
#else
Q_ASSERT(QOpenGLFunctions::isInitialized(d_ptr));
@@ -2145,7 +2105,7 @@ inline void QOpenGLFunctions::glVertexAttrib3fv(GLuint indx, const GLfloat* valu
inline void QOpenGLFunctions::glVertexAttrib4f(GLuint indx, GLfloat x, GLfloat y, GLfloat z, GLfloat w)
{
-#if defined(QT_OPENGL_ES_2) && defined(Q_OS_ANDROID)
+#if QT_CONFIG(opengles2) && defined(Q_OS_ANDROID)
::glVertexAttrib4f(indx, x, y, z, w);
#else
Q_ASSERT(QOpenGLFunctions::isInitialized(d_ptr));
@@ -2156,7 +2116,7 @@ inline void QOpenGLFunctions::glVertexAttrib4f(GLuint indx, GLfloat x, GLfloat y
inline void QOpenGLFunctions::glVertexAttrib4fv(GLuint indx, const GLfloat* values)
{
-#if defined(QT_OPENGL_ES_2) && defined(Q_OS_ANDROID)
+#if QT_CONFIG(opengles2) && defined(Q_OS_ANDROID)
::glVertexAttrib4fv(indx, values);
#else
Q_ASSERT(QOpenGLFunctions::isInitialized(d_ptr));
@@ -2167,7 +2127,7 @@ inline void QOpenGLFunctions::glVertexAttrib4fv(GLuint indx, const GLfloat* valu
inline void QOpenGLFunctions::glVertexAttribPointer(GLuint indx, GLint size, GLenum type, GLboolean normalized, GLsizei stride, const void* ptr)
{
-#if defined(QT_OPENGL_ES_2) && defined(Q_OS_ANDROID)
+#if QT_CONFIG(opengles2) && defined(Q_OS_ANDROID)
::glVertexAttribPointer(indx, size, type, normalized, stride, ptr);
#else
Q_ASSERT(QOpenGLFunctions::isInitialized(d_ptr));
diff --git a/src/gui/opengl/qopenglfunctions_1_0.cpp b/src/gui/opengl/qopenglfunctions_1_0.cpp
deleted file mode 100644
index f9d93ce210..0000000000
--- a/src/gui/opengl/qopenglfunctions_1_0.cpp
+++ /dev/null
@@ -1,136 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2013 Klaralvdalens Datakonsult AB (KDAB)
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the QtGui module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-**
-** This file was generated by glgen version 0.1
-** Command line was: glgen
-**
-** glgen is Copyright (C) 2013 Klaralvdalens Datakonsult AB (KDAB)
-**
-** This is an auto-generated file.
-** Do not edit! All changes made to it will be lost.
-**
-****************************************************************************/
-
-#include "qopenglfunctions_1_0.h"
-#include "qopenglcontext.h"
-
-QT_BEGIN_NAMESPACE
-
-/*!
- \class QOpenGLFunctions_1_0
- \inmodule QtGui
- \since 5.1
- \wrapper
- \brief The QOpenGLFunctions_1_0 class provides all functions for OpenGL 1.0 specification.
-
- This class is a wrapper for functions from OpenGL 1.0 specification.
- See reference pages on \l {http://www.opengl.org/sdk/docs/}{opengl.org}
- for function documentation.
-
- \sa QAbstractOpenGLFunctions
-*/
-
-QOpenGLFunctions_1_0::QOpenGLFunctions_1_0()
- : QAbstractOpenGLFunctions()
- , d_1_0_Core(nullptr)
- , d_1_0_Deprecated(nullptr)
-{
-}
-
-QOpenGLFunctions_1_0::~QOpenGLFunctions_1_0()
-{
- if (d_1_0_Core) {
- d_1_0_Core->refs.deref();
- Q_ASSERT(d_1_0_Core->refs.loadRelaxed());
- }
- if (d_1_0_Deprecated) {
- d_1_0_Deprecated->refs.deref();
- Q_ASSERT(d_1_0_Deprecated->refs.loadRelaxed());
- }
-}
-
-bool QOpenGLFunctions_1_0::initializeOpenGLFunctions()
-{
- if ( isInitialized() )
- return true;
-
- QOpenGLContext* context = QOpenGLContext::currentContext();
-
- // If owned by a context object make sure it is current.
- // Also check that current context is capable of resolving all needed functions
- if (((owningContext() && owningContext() == context) || !owningContext())
- && QOpenGLFunctions_1_0::isContextCompatible(context))
- {
- // Associate with private implementation, creating if necessary
- // Function pointers in the backends are resolved at creation time
- QOpenGLVersionFunctionsBackend* d = nullptr;
- d = QAbstractOpenGLFunctionsPrivate::functionsBackend(context, QOpenGLFunctions_1_0_CoreBackend::versionStatus());
- d_1_0_Core = static_cast<QOpenGLFunctions_1_0_CoreBackend*>(d);
- d->refs.ref();
-
- d = QAbstractOpenGLFunctionsPrivate::functionsBackend(context, QOpenGLFunctions_1_0_DeprecatedBackend::versionStatus());
- d_1_0_Deprecated = static_cast<QOpenGLFunctions_1_0_DeprecatedBackend*>(d);
- d->refs.ref();
-
- QAbstractOpenGLFunctions::initializeOpenGLFunctions();
- }
- return isInitialized();
-}
-
-bool QOpenGLFunctions_1_0::isContextCompatible(QOpenGLContext *context)
-{
- Q_ASSERT(context);
- QSurfaceFormat f = context->format();
- const QPair<int, int> v = qMakePair(f.majorVersion(), f.minorVersion());
- if (v < qMakePair(1, 0))
- return false;
-
- if (f.profile() == QSurfaceFormat::CoreProfile)
- return false;
-
- return true;
-}
-
-QOpenGLVersionProfile QOpenGLFunctions_1_0::versionProfile()
-{
- QOpenGLVersionProfile v;
- v.setVersion(1, 0);
- return v;
-}
-
-QT_END_NAMESPACE
diff --git a/src/gui/opengl/qopenglfunctions_1_0.h b/src/gui/opengl/qopenglfunctions_1_0.h
deleted file mode 100644
index cddb7251ed..0000000000
--- a/src/gui/opengl/qopenglfunctions_1_0.h
+++ /dev/null
@@ -1,1929 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2013 Klaralvdalens Datakonsult AB (KDAB)
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the QtGui module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-**
-** This file was generated by glgen version 0.1
-** Command line was: glgen
-**
-** glgen is Copyright (C) 2013 Klaralvdalens Datakonsult AB (KDAB)
-**
-** This is an auto-generated file.
-** Do not edit! All changes made to it will be lost.
-**
-****************************************************************************/
-
-#ifndef QOPENGLVERSIONFUNCTIONS_1_0_H
-#define QOPENGLVERSIONFUNCTIONS_1_0_H
-
-#include <QtGui/qtguiglobal.h>
-
-#if !defined(QT_NO_OPENGL) && !defined(QT_OPENGL_ES_2)
-
-#include <QtGui/QOpenGLVersionFunctions>
-#include <QtGui/qopenglcontext.h>
-
-QT_BEGIN_NAMESPACE
-
-class Q_GUI_EXPORT QOpenGLFunctions_1_0 : public QAbstractOpenGLFunctions
-{
-public:
- QOpenGLFunctions_1_0();
- ~QOpenGLFunctions_1_0();
-
- bool initializeOpenGLFunctions() override;
-
- // OpenGL 1.0 core functions
- void glViewport(GLint x, GLint y, GLsizei width, GLsizei height);
- void glDepthRange(GLdouble nearVal, GLdouble farVal);
- GLboolean glIsEnabled(GLenum cap);
- void glGetTexLevelParameteriv(GLenum target, GLint level, GLenum pname, GLint *params);
- void glGetTexLevelParameterfv(GLenum target, GLint level, GLenum pname, GLfloat *params);
- void glGetTexParameteriv(GLenum target, GLenum pname, GLint *params);
- void glGetTexParameterfv(GLenum target, GLenum pname, GLfloat *params);
- void glGetTexImage(GLenum target, GLint level, GLenum format, GLenum type, GLvoid *pixels);
- const GLubyte * glGetString(GLenum name);
- void glGetIntegerv(GLenum pname, GLint *params);
- void glGetFloatv(GLenum pname, GLfloat *params);
- GLenum glGetError();
- void glGetDoublev(GLenum pname, GLdouble *params);
- void glGetBooleanv(GLenum pname, GLboolean *params);
- void glReadPixels(GLint x, GLint y, GLsizei width, GLsizei height, GLenum format, GLenum type, GLvoid *pixels);
- void glReadBuffer(GLenum mode);
- void glPixelStorei(GLenum pname, GLint param);
- void glPixelStoref(GLenum pname, GLfloat param);
- void glDepthFunc(GLenum func);
- void glStencilOp(GLenum fail, GLenum zfail, GLenum zpass);
- void glStencilFunc(GLenum func, GLint ref, GLuint mask);
- void glLogicOp(GLenum opcode);
- void glBlendFunc(GLenum sfactor, GLenum dfactor);
- void glFlush();
- void glFinish();
- void glEnable(GLenum cap);
- void glDisable(GLenum cap);
- void glDepthMask(GLboolean flag);
- void glColorMask(GLboolean red, GLboolean green, GLboolean blue, GLboolean alpha);
- void glStencilMask(GLuint mask);
- void glClearDepth(GLdouble depth);
- void glClearStencil(GLint s);
- void glClearColor(GLfloat red, GLfloat green, GLfloat blue, GLfloat alpha);
- void glClear(GLbitfield mask);
- void glDrawBuffer(GLenum mode);
- void glTexImage2D(GLenum target, GLint level, GLint internalformat, GLsizei width, GLsizei height, GLint border, GLenum format, GLenum type, const GLvoid *pixels);
- void glTexImage1D(GLenum target, GLint level, GLint internalformat, GLsizei width, GLint border, GLenum format, GLenum type, const GLvoid *pixels);
- void glTexParameteriv(GLenum target, GLenum pname, const GLint *params);
- void glTexParameteri(GLenum target, GLenum pname, GLint param);
- void glTexParameterfv(GLenum target, GLenum pname, const GLfloat *params);
- void glTexParameterf(GLenum target, GLenum pname, GLfloat param);
- void glScissor(GLint x, GLint y, GLsizei width, GLsizei height);
- void glPolygonMode(GLenum face, GLenum mode);
- void glPointSize(GLfloat size);
- void glLineWidth(GLfloat width);
- void glHint(GLenum target, GLenum mode);
- void glFrontFace(GLenum mode);
- void glCullFace(GLenum mode);
-
- // OpenGL 1.0 deprecated functions
- void glTranslatef(GLfloat x, GLfloat y, GLfloat z);
- void glTranslated(GLdouble x, GLdouble y, GLdouble z);
- void glScalef(GLfloat x, GLfloat y, GLfloat z);
- void glScaled(GLdouble x, GLdouble y, GLdouble z);
- void glRotatef(GLfloat angle, GLfloat x, GLfloat y, GLfloat z);
- void glRotated(GLdouble angle, GLdouble x, GLdouble y, GLdouble z);
- void glPushMatrix();
- void glPopMatrix();
- void glOrtho(GLdouble left, GLdouble right, GLdouble bottom, GLdouble top, GLdouble zNear, GLdouble zFar);
- void glMultMatrixd(const GLdouble *m);
- void glMultMatrixf(const GLfloat *m);
- void glMatrixMode(GLenum mode);
- void glLoadMatrixd(const GLdouble *m);
- void glLoadMatrixf(const GLfloat *m);
- void glLoadIdentity();
- void glFrustum(GLdouble left, GLdouble right, GLdouble bottom, GLdouble top, GLdouble zNear, GLdouble zFar);
- GLboolean glIsList(GLuint list);
- void glGetTexGeniv(GLenum coord, GLenum pname, GLint *params);
- void glGetTexGenfv(GLenum coord, GLenum pname, GLfloat *params);
- void glGetTexGendv(GLenum coord, GLenum pname, GLdouble *params);
- void glGetTexEnviv(GLenum target, GLenum pname, GLint *params);
- void glGetTexEnvfv(GLenum target, GLenum pname, GLfloat *params);
- void glGetPolygonStipple(GLubyte *mask);
- void glGetPixelMapusv(GLenum map, GLushort *values);
- void glGetPixelMapuiv(GLenum map, GLuint *values);
- void glGetPixelMapfv(GLenum map, GLfloat *values);
- void glGetMaterialiv(GLenum face, GLenum pname, GLint *params);
- void glGetMaterialfv(GLenum face, GLenum pname, GLfloat *params);
- void glGetMapiv(GLenum target, GLenum query, GLint *v);
- void glGetMapfv(GLenum target, GLenum query, GLfloat *v);
- void glGetMapdv(GLenum target, GLenum query, GLdouble *v);
- void glGetLightiv(GLenum light, GLenum pname, GLint *params);
- void glGetLightfv(GLenum light, GLenum pname, GLfloat *params);
- void glGetClipPlane(GLenum plane, GLdouble *equation);
- void glDrawPixels(GLsizei width, GLsizei height, GLenum format, GLenum type, const GLvoid *pixels);
- void glCopyPixels(GLint x, GLint y, GLsizei width, GLsizei height, GLenum type);
- void glPixelMapusv(GLenum map, GLint mapsize, const GLushort *values);
- void glPixelMapuiv(GLenum map, GLint mapsize, const GLuint *values);
- void glPixelMapfv(GLenum map, GLint mapsize, const GLfloat *values);
- void glPixelTransferi(GLenum pname, GLint param);
- void glPixelTransferf(GLenum pname, GLfloat param);
- void glPixelZoom(GLfloat xfactor, GLfloat yfactor);
- void glAlphaFunc(GLenum func, GLfloat ref);
- void glEvalPoint2(GLint i, GLint j);
- void glEvalMesh2(GLenum mode, GLint i1, GLint i2, GLint j1, GLint j2);
- void glEvalPoint1(GLint i);
- void glEvalMesh1(GLenum mode, GLint i1, GLint i2);
- void glEvalCoord2fv(const GLfloat *u);
- void glEvalCoord2f(GLfloat u, GLfloat v);
- void glEvalCoord2dv(const GLdouble *u);
- void glEvalCoord2d(GLdouble u, GLdouble v);
- void glEvalCoord1fv(const GLfloat *u);
- void glEvalCoord1f(GLfloat u);
- void glEvalCoord1dv(const GLdouble *u);
- void glEvalCoord1d(GLdouble u);
- void glMapGrid2f(GLint un, GLfloat u1, GLfloat u2, GLint vn, GLfloat v1, GLfloat v2);
- void glMapGrid2d(GLint un, GLdouble u1, GLdouble u2, GLint vn, GLdouble v1, GLdouble v2);
- void glMapGrid1f(GLint un, GLfloat u1, GLfloat u2);
- void glMapGrid1d(GLint un, GLdouble u1, GLdouble u2);
- void glMap2f(GLenum target, GLfloat u1, GLfloat u2, GLint ustride, GLint uorder, GLfloat v1, GLfloat v2, GLint vstride, GLint vorder, const GLfloat *points);
- void glMap2d(GLenum target, GLdouble u1, GLdouble u2, GLint ustride, GLint uorder, GLdouble v1, GLdouble v2, GLint vstride, GLint vorder, const GLdouble *points);
- void glMap1f(GLenum target, GLfloat u1, GLfloat u2, GLint stride, GLint order, const GLfloat *points);
- void glMap1d(GLenum target, GLdouble u1, GLdouble u2, GLint stride, GLint order, const GLdouble *points);
- void glPushAttrib(GLbitfield mask);
- void glPopAttrib();
- void glAccum(GLenum op, GLfloat value);
- void glIndexMask(GLuint mask);
- void glClearIndex(GLfloat c);
- void glClearAccum(GLfloat red, GLfloat green, GLfloat blue, GLfloat alpha);
- void glPushName(GLuint name);
- void glPopName();
- void glPassThrough(GLfloat token);
- void glLoadName(GLuint name);
- void glInitNames();
- GLint glRenderMode(GLenum mode);
- void glSelectBuffer(GLsizei size, GLuint *buffer);
- void glFeedbackBuffer(GLsizei size, GLenum type, GLfloat *buffer);
- void glTexGeniv(GLenum coord, GLenum pname, const GLint *params);
- void glTexGeni(GLenum coord, GLenum pname, GLint param);
- void glTexGenfv(GLenum coord, GLenum pname, const GLfloat *params);
- void glTexGenf(GLenum coord, GLenum pname, GLfloat param);
- void glTexGendv(GLenum coord, GLenum pname, const GLdouble *params);
- void glTexGend(GLenum coord, GLenum pname, GLdouble param);
- void glTexEnviv(GLenum target, GLenum pname, const GLint *params);
- void glTexEnvi(GLenum target, GLenum pname, GLint param);
- void glTexEnvfv(GLenum target, GLenum pname, const GLfloat *params);
- void glTexEnvf(GLenum target, GLenum pname, GLfloat param);
- void glShadeModel(GLenum mode);
- void glPolygonStipple(const GLubyte *mask);
- void glMaterialiv(GLenum face, GLenum pname, const GLint *params);
- void glMateriali(GLenum face, GLenum pname, GLint param);
- void glMaterialfv(GLenum face, GLenum pname, const GLfloat *params);
- void glMaterialf(GLenum face, GLenum pname, GLfloat param);
- void glLineStipple(GLint factor, GLushort pattern);
- void glLightModeliv(GLenum pname, const GLint *params);
- void glLightModeli(GLenum pname, GLint param);
- void glLightModelfv(GLenum pname, const GLfloat *params);
- void glLightModelf(GLenum pname, GLfloat param);
- void glLightiv(GLenum light, GLenum pname, const GLint *params);
- void glLighti(GLenum light, GLenum pname, GLint param);
- void glLightfv(GLenum light, GLenum pname, const GLfloat *params);
- void glLightf(GLenum light, GLenum pname, GLfloat param);
- void glFogiv(GLenum pname, const GLint *params);
- void glFogi(GLenum pname, GLint param);
- void glFogfv(GLenum pname, const GLfloat *params);
- void glFogf(GLenum pname, GLfloat param);
- void glColorMaterial(GLenum face, GLenum mode);
- void glClipPlane(GLenum plane, const GLdouble *equation);
- void glVertex4sv(const GLshort *v);
- void glVertex4s(GLshort x, GLshort y, GLshort z, GLshort w);
- void glVertex4iv(const GLint *v);
- void glVertex4i(GLint x, GLint y, GLint z, GLint w);
- void glVertex4fv(const GLfloat *v);
- void glVertex4f(GLfloat x, GLfloat y, GLfloat z, GLfloat w);
- void glVertex4dv(const GLdouble *v);
- void glVertex4d(GLdouble x, GLdouble y, GLdouble z, GLdouble w);
- void glVertex3sv(const GLshort *v);
- void glVertex3s(GLshort x, GLshort y, GLshort z);
- void glVertex3iv(const GLint *v);
- void glVertex3i(GLint x, GLint y, GLint z);
- void glVertex3fv(const GLfloat *v);
- void glVertex3f(GLfloat x, GLfloat y, GLfloat z);
- void glVertex3dv(const GLdouble *v);
- void glVertex3d(GLdouble x, GLdouble y, GLdouble z);
- void glVertex2sv(const GLshort *v);
- void glVertex2s(GLshort x, GLshort y);
- void glVertex2iv(const GLint *v);
- void glVertex2i(GLint x, GLint y);
- void glVertex2fv(const GLfloat *v);
- void glVertex2f(GLfloat x, GLfloat y);
- void glVertex2dv(const GLdouble *v);
- void glVertex2d(GLdouble x, GLdouble y);
- void glTexCoord4sv(const GLshort *v);
- void glTexCoord4s(GLshort s, GLshort t, GLshort r, GLshort q);
- void glTexCoord4iv(const GLint *v);
- void glTexCoord4i(GLint s, GLint t, GLint r, GLint q);
- void glTexCoord4fv(const GLfloat *v);
- void glTexCoord4f(GLfloat s, GLfloat t, GLfloat r, GLfloat q);
- void glTexCoord4dv(const GLdouble *v);
- void glTexCoord4d(GLdouble s, GLdouble t, GLdouble r, GLdouble q);
- void glTexCoord3sv(const GLshort *v);
- void glTexCoord3s(GLshort s, GLshort t, GLshort r);
- void glTexCoord3iv(const GLint *v);
- void glTexCoord3i(GLint s, GLint t, GLint r);
- void glTexCoord3fv(const GLfloat *v);
- void glTexCoord3f(GLfloat s, GLfloat t, GLfloat r);
- void glTexCoord3dv(const GLdouble *v);
- void glTexCoord3d(GLdouble s, GLdouble t, GLdouble r);
- void glTexCoord2sv(const GLshort *v);
- void glTexCoord2s(GLshort s, GLshort t);
- void glTexCoord2iv(const GLint *v);
- void glTexCoord2i(GLint s, GLint t);
- void glTexCoord2fv(const GLfloat *v);
- void glTexCoord2f(GLfloat s, GLfloat t);
- void glTexCoord2dv(const GLdouble *v);
- void glTexCoord2d(GLdouble s, GLdouble t);
- void glTexCoord1sv(const GLshort *v);
- void glTexCoord1s(GLshort s);
- void glTexCoord1iv(const GLint *v);
- void glTexCoord1i(GLint s);
- void glTexCoord1fv(const GLfloat *v);
- void glTexCoord1f(GLfloat s);
- void glTexCoord1dv(const GLdouble *v);
- void glTexCoord1d(GLdouble s);
- void glRectsv(const GLshort *v1, const GLshort *v2);
- void glRects(GLshort x1, GLshort y1, GLshort x2, GLshort y2);
- void glRectiv(const GLint *v1, const GLint *v2);
- void glRecti(GLint x1, GLint y1, GLint x2, GLint y2);
- void glRectfv(const GLfloat *v1, const GLfloat *v2);
- void glRectf(GLfloat x1, GLfloat y1, GLfloat x2, GLfloat y2);
- void glRectdv(const GLdouble *v1, const GLdouble *v2);
- void glRectd(GLdouble x1, GLdouble y1, GLdouble x2, GLdouble y2);
- void glRasterPos4sv(const GLshort *v);
- void glRasterPos4s(GLshort x, GLshort y, GLshort z, GLshort w);
- void glRasterPos4iv(const GLint *v);
- void glRasterPos4i(GLint x, GLint y, GLint z, GLint w);
- void glRasterPos4fv(const GLfloat *v);
- void glRasterPos4f(GLfloat x, GLfloat y, GLfloat z, GLfloat w);
- void glRasterPos4dv(const GLdouble *v);
- void glRasterPos4d(GLdouble x, GLdouble y, GLdouble z, GLdouble w);
- void glRasterPos3sv(const GLshort *v);
- void glRasterPos3s(GLshort x, GLshort y, GLshort z);
- void glRasterPos3iv(const GLint *v);
- void glRasterPos3i(GLint x, GLint y, GLint z);
- void glRasterPos3fv(const GLfloat *v);
- void glRasterPos3f(GLfloat x, GLfloat y, GLfloat z);
- void glRasterPos3dv(const GLdouble *v);
- void glRasterPos3d(GLdouble x, GLdouble y, GLdouble z);
- void glRasterPos2sv(const GLshort *v);
- void glRasterPos2s(GLshort x, GLshort y);
- void glRasterPos2iv(const GLint *v);
- void glRasterPos2i(GLint x, GLint y);
- void glRasterPos2fv(const GLfloat *v);
- void glRasterPos2f(GLfloat x, GLfloat y);
- void glRasterPos2dv(const GLdouble *v);
- void glRasterPos2d(GLdouble x, GLdouble y);
- void glNormal3sv(const GLshort *v);
- void glNormal3s(GLshort nx, GLshort ny, GLshort nz);
- void glNormal3iv(const GLint *v);
- void glNormal3i(GLint nx, GLint ny, GLint nz);
- void glNormal3fv(const GLfloat *v);
- void glNormal3f(GLfloat nx, GLfloat ny, GLfloat nz);
- void glNormal3dv(const GLdouble *v);
- void glNormal3d(GLdouble nx, GLdouble ny, GLdouble nz);
- void glNormal3bv(const GLbyte *v);
- void glNormal3b(GLbyte nx, GLbyte ny, GLbyte nz);
- void glIndexsv(const GLshort *c);
- void glIndexs(GLshort c);
- void glIndexiv(const GLint *c);
- void glIndexi(GLint c);
- void glIndexfv(const GLfloat *c);
- void glIndexf(GLfloat c);
- void glIndexdv(const GLdouble *c);
- void glIndexd(GLdouble c);
- void glEnd();
- void glEdgeFlagv(const GLboolean *flag);
- void glEdgeFlag(GLboolean flag);
- void glColor4usv(const GLushort *v);
- void glColor4us(GLushort red, GLushort green, GLushort blue, GLushort alpha);
- void glColor4uiv(const GLuint *v);
- void glColor4ui(GLuint red, GLuint green, GLuint blue, GLuint alpha);
- void glColor4ubv(const GLubyte *v);
- void glColor4ub(GLubyte red, GLubyte green, GLubyte blue, GLubyte alpha);
- void glColor4sv(const GLshort *v);
- void glColor4s(GLshort red, GLshort green, GLshort blue, GLshort alpha);
- void glColor4iv(const GLint *v);
- void glColor4i(GLint red, GLint green, GLint blue, GLint alpha);
- void glColor4fv(const GLfloat *v);
- void glColor4f(GLfloat red, GLfloat green, GLfloat blue, GLfloat alpha);
- void glColor4dv(const GLdouble *v);
- void glColor4d(GLdouble red, GLdouble green, GLdouble blue, GLdouble alpha);
- void glColor4bv(const GLbyte *v);
- void glColor4b(GLbyte red, GLbyte green, GLbyte blue, GLbyte alpha);
- void glColor3usv(const GLushort *v);
- void glColor3us(GLushort red, GLushort green, GLushort blue);
- void glColor3uiv(const GLuint *v);
- void glColor3ui(GLuint red, GLuint green, GLuint blue);
- void glColor3ubv(const GLubyte *v);
- void glColor3ub(GLubyte red, GLubyte green, GLubyte blue);
- void glColor3sv(const GLshort *v);
- void glColor3s(GLshort red, GLshort green, GLshort blue);
- void glColor3iv(const GLint *v);
- void glColor3i(GLint red, GLint green, GLint blue);
- void glColor3fv(const GLfloat *v);
- void glColor3f(GLfloat red, GLfloat green, GLfloat blue);
- void glColor3dv(const GLdouble *v);
- void glColor3d(GLdouble red, GLdouble green, GLdouble blue);
- void glColor3bv(const GLbyte *v);
- void glColor3b(GLbyte red, GLbyte green, GLbyte blue);
- void glBitmap(GLsizei width, GLsizei height, GLfloat xorig, GLfloat yorig, GLfloat xmove, GLfloat ymove, const GLubyte *bitmap);
- void glBegin(GLenum mode);
- void glListBase(GLuint base);
- GLuint glGenLists(GLsizei range);
- void glDeleteLists(GLuint list, GLsizei range);
- void glCallLists(GLsizei n, GLenum type, const GLvoid *lists);
- void glCallList(GLuint list);
- void glEndList();
- void glNewList(GLuint list, GLenum mode);
-
-private:
- friend class QOpenGLContext;
-
- static bool isContextCompatible(QOpenGLContext *context);
- static QOpenGLVersionProfile versionProfile();
-
- QOpenGLFunctions_1_0_CoreBackend* d_1_0_Core;
- QOpenGLFunctions_1_0_DeprecatedBackend* d_1_0_Deprecated;
-};
-
-// OpenGL 1.0 core functions
-inline void QOpenGLFunctions_1_0::glViewport(GLint x, GLint y, GLsizei width, GLsizei height)
-{
- d_1_0_Core->f.Viewport(x, y, width, height);
-}
-
-inline void QOpenGLFunctions_1_0::glDepthRange(GLdouble nearVal, GLdouble farVal)
-{
- d_1_0_Core->f.DepthRange(nearVal, farVal);
-}
-
-inline GLboolean QOpenGLFunctions_1_0::glIsEnabled(GLenum cap)
-{
- return d_1_0_Core->f.IsEnabled(cap);
-}
-
-inline void QOpenGLFunctions_1_0::glGetTexLevelParameteriv(GLenum target, GLint level, GLenum pname, GLint *params)
-{
- d_1_0_Core->f.GetTexLevelParameteriv(target, level, pname, params);
-}
-
-inline void QOpenGLFunctions_1_0::glGetTexLevelParameterfv(GLenum target, GLint level, GLenum pname, GLfloat *params)
-{
- d_1_0_Core->f.GetTexLevelParameterfv(target, level, pname, params);
-}
-
-inline void QOpenGLFunctions_1_0::glGetTexParameteriv(GLenum target, GLenum pname, GLint *params)
-{
- d_1_0_Core->f.GetTexParameteriv(target, pname, params);
-}
-
-inline void QOpenGLFunctions_1_0::glGetTexParameterfv(GLenum target, GLenum pname, GLfloat *params)
-{
- d_1_0_Core->f.GetTexParameterfv(target, pname, params);
-}
-
-inline void QOpenGLFunctions_1_0::glGetTexImage(GLenum target, GLint level, GLenum format, GLenum type, GLvoid *pixels)
-{
- d_1_0_Core->f.GetTexImage(target, level, format, type, pixels);
-}
-
-inline const GLubyte * QOpenGLFunctions_1_0::glGetString(GLenum name)
-{
- return d_1_0_Core->f.GetString(name);
-}
-
-inline void QOpenGLFunctions_1_0::glGetIntegerv(GLenum pname, GLint *params)
-{
- d_1_0_Core->f.GetIntegerv(pname, params);
-}
-
-inline void QOpenGLFunctions_1_0::glGetFloatv(GLenum pname, GLfloat *params)
-{
- d_1_0_Core->f.GetFloatv(pname, params);
-}
-
-inline GLenum QOpenGLFunctions_1_0::glGetError()
-{
- return d_1_0_Core->f.GetError();
-}
-
-inline void QOpenGLFunctions_1_0::glGetDoublev(GLenum pname, GLdouble *params)
-{
- d_1_0_Core->f.GetDoublev(pname, params);
-}
-
-inline void QOpenGLFunctions_1_0::glGetBooleanv(GLenum pname, GLboolean *params)
-{
- d_1_0_Core->f.GetBooleanv(pname, params);
-}
-
-inline void QOpenGLFunctions_1_0::glReadPixels(GLint x, GLint y, GLsizei width, GLsizei height, GLenum format, GLenum type, GLvoid *pixels)
-{
- d_1_0_Core->f.ReadPixels(x, y, width, height, format, type, pixels);
-}
-
-inline void QOpenGLFunctions_1_0::glReadBuffer(GLenum mode)
-{
- d_1_0_Core->f.ReadBuffer(mode);
-}
-
-inline void QOpenGLFunctions_1_0::glPixelStorei(GLenum pname, GLint param)
-{
- d_1_0_Core->f.PixelStorei(pname, param);
-}
-
-inline void QOpenGLFunctions_1_0::glPixelStoref(GLenum pname, GLfloat param)
-{
- d_1_0_Core->f.PixelStoref(pname, param);
-}
-
-inline void QOpenGLFunctions_1_0::glDepthFunc(GLenum func)
-{
- d_1_0_Core->f.DepthFunc(func);
-}
-
-inline void QOpenGLFunctions_1_0::glStencilOp(GLenum fail, GLenum zfail, GLenum zpass)
-{
- d_1_0_Core->f.StencilOp(fail, zfail, zpass);
-}
-
-inline void QOpenGLFunctions_1_0::glStencilFunc(GLenum func, GLint ref, GLuint mask)
-{
- d_1_0_Core->f.StencilFunc(func, ref, mask);
-}
-
-inline void QOpenGLFunctions_1_0::glLogicOp(GLenum opcode)
-{
- d_1_0_Core->f.LogicOp(opcode);
-}
-
-inline void QOpenGLFunctions_1_0::glBlendFunc(GLenum sfactor, GLenum dfactor)
-{
- d_1_0_Core->f.BlendFunc(sfactor, dfactor);
-}
-
-inline void QOpenGLFunctions_1_0::glFlush()
-{
- d_1_0_Core->f.Flush();
-}
-
-inline void QOpenGLFunctions_1_0::glFinish()
-{
- d_1_0_Core->f.Finish();
-}
-
-inline void QOpenGLFunctions_1_0::glEnable(GLenum cap)
-{
- d_1_0_Core->f.Enable(cap);
-}
-
-inline void QOpenGLFunctions_1_0::glDisable(GLenum cap)
-{
- d_1_0_Core->f.Disable(cap);
-}
-
-inline void QOpenGLFunctions_1_0::glDepthMask(GLboolean flag)
-{
- d_1_0_Core->f.DepthMask(flag);
-}
-
-inline void QOpenGLFunctions_1_0::glColorMask(GLboolean red, GLboolean green, GLboolean blue, GLboolean alpha)
-{
- d_1_0_Core->f.ColorMask(red, green, blue, alpha);
-}
-
-inline void QOpenGLFunctions_1_0::glStencilMask(GLuint mask)
-{
- d_1_0_Core->f.StencilMask(mask);
-}
-
-inline void QOpenGLFunctions_1_0::glClearDepth(GLdouble depth)
-{
- d_1_0_Core->f.ClearDepth(depth);
-}
-
-inline void QOpenGLFunctions_1_0::glClearStencil(GLint s)
-{
- d_1_0_Core->f.ClearStencil(s);
-}
-
-inline void QOpenGLFunctions_1_0::glClearColor(GLfloat red, GLfloat green, GLfloat blue, GLfloat alpha)
-{
- d_1_0_Core->f.ClearColor(red, green, blue, alpha);
-}
-
-inline void QOpenGLFunctions_1_0::glClear(GLbitfield mask)
-{
- d_1_0_Core->f.Clear(mask);
-}
-
-inline void QOpenGLFunctions_1_0::glDrawBuffer(GLenum mode)
-{
- d_1_0_Core->f.DrawBuffer(mode);
-}
-
-inline void QOpenGLFunctions_1_0::glTexImage2D(GLenum target, GLint level, GLint internalformat, GLsizei width, GLsizei height, GLint border, GLenum format, GLenum type, const GLvoid *pixels)
-{
- d_1_0_Core->f.TexImage2D(target, level, internalformat, width, height, border, format, type, pixels);
-}
-
-inline void QOpenGLFunctions_1_0::glTexImage1D(GLenum target, GLint level, GLint internalformat, GLsizei width, GLint border, GLenum format, GLenum type, const GLvoid *pixels)
-{
- d_1_0_Core->f.TexImage1D(target, level, internalformat, width, border, format, type, pixels);
-}
-
-inline void QOpenGLFunctions_1_0::glTexParameteriv(GLenum target, GLenum pname, const GLint *params)
-{
- d_1_0_Core->f.TexParameteriv(target, pname, params);
-}
-
-inline void QOpenGLFunctions_1_0::glTexParameteri(GLenum target, GLenum pname, GLint param)
-{
- d_1_0_Core->f.TexParameteri(target, pname, param);
-}
-
-inline void QOpenGLFunctions_1_0::glTexParameterfv(GLenum target, GLenum pname, const GLfloat *params)
-{
- d_1_0_Core->f.TexParameterfv(target, pname, params);
-}
-
-inline void QOpenGLFunctions_1_0::glTexParameterf(GLenum target, GLenum pname, GLfloat param)
-{
- d_1_0_Core->f.TexParameterf(target, pname, param);
-}
-
-inline void QOpenGLFunctions_1_0::glScissor(GLint x, GLint y, GLsizei width, GLsizei height)
-{
- d_1_0_Core->f.Scissor(x, y, width, height);
-}
-
-inline void QOpenGLFunctions_1_0::glPolygonMode(GLenum face, GLenum mode)
-{
- d_1_0_Core->f.PolygonMode(face, mode);
-}
-
-inline void QOpenGLFunctions_1_0::glPointSize(GLfloat size)
-{
- d_1_0_Core->f.PointSize(size);
-}
-
-inline void QOpenGLFunctions_1_0::glLineWidth(GLfloat width)
-{
- d_1_0_Core->f.LineWidth(width);
-}
-
-inline void QOpenGLFunctions_1_0::glHint(GLenum target, GLenum mode)
-{
- d_1_0_Core->f.Hint(target, mode);
-}
-
-inline void QOpenGLFunctions_1_0::glFrontFace(GLenum mode)
-{
- d_1_0_Core->f.FrontFace(mode);
-}
-
-inline void QOpenGLFunctions_1_0::glCullFace(GLenum mode)
-{
- d_1_0_Core->f.CullFace(mode);
-}
-
-
-// OpenGL 1.0 deprecated functions
-inline void QOpenGLFunctions_1_0::glTranslatef(GLfloat x, GLfloat y, GLfloat z)
-{
- d_1_0_Deprecated->f.Translatef(x, y, z);
-}
-
-inline void QOpenGLFunctions_1_0::glTranslated(GLdouble x, GLdouble y, GLdouble z)
-{
- d_1_0_Deprecated->f.Translated(x, y, z);
-}
-
-inline void QOpenGLFunctions_1_0::glScalef(GLfloat x, GLfloat y, GLfloat z)
-{
- d_1_0_Deprecated->f.Scalef(x, y, z);
-}
-
-inline void QOpenGLFunctions_1_0::glScaled(GLdouble x, GLdouble y, GLdouble z)
-{
- d_1_0_Deprecated->f.Scaled(x, y, z);
-}
-
-inline void QOpenGLFunctions_1_0::glRotatef(GLfloat angle, GLfloat x, GLfloat y, GLfloat z)
-{
- d_1_0_Deprecated->f.Rotatef(angle, x, y, z);
-}
-
-inline void QOpenGLFunctions_1_0::glRotated(GLdouble angle, GLdouble x, GLdouble y, GLdouble z)
-{
- d_1_0_Deprecated->f.Rotated(angle, x, y, z);
-}
-
-inline void QOpenGLFunctions_1_0::glPushMatrix()
-{
- d_1_0_Deprecated->f.PushMatrix();
-}
-
-inline void QOpenGLFunctions_1_0::glPopMatrix()
-{
- d_1_0_Deprecated->f.PopMatrix();
-}
-
-inline void QOpenGLFunctions_1_0::glOrtho(GLdouble left, GLdouble right, GLdouble bottom, GLdouble top, GLdouble zNear, GLdouble zFar)
-{
- d_1_0_Deprecated->f.Ortho(left, right, bottom, top, zNear, zFar);
-}
-
-inline void QOpenGLFunctions_1_0::glMultMatrixd(const GLdouble *m)
-{
- d_1_0_Deprecated->f.MultMatrixd(m);
-}
-
-inline void QOpenGLFunctions_1_0::glMultMatrixf(const GLfloat *m)
-{
- d_1_0_Deprecated->f.MultMatrixf(m);
-}
-
-inline void QOpenGLFunctions_1_0::glMatrixMode(GLenum mode)
-{
- d_1_0_Deprecated->f.MatrixMode(mode);
-}
-
-inline void QOpenGLFunctions_1_0::glLoadMatrixd(const GLdouble *m)
-{
- d_1_0_Deprecated->f.LoadMatrixd(m);
-}
-
-inline void QOpenGLFunctions_1_0::glLoadMatrixf(const GLfloat *m)
-{
- d_1_0_Deprecated->f.LoadMatrixf(m);
-}
-
-inline void QOpenGLFunctions_1_0::glLoadIdentity()
-{
- d_1_0_Deprecated->f.LoadIdentity();
-}
-
-inline void QOpenGLFunctions_1_0::glFrustum(GLdouble left, GLdouble right, GLdouble bottom, GLdouble top, GLdouble zNear, GLdouble zFar)
-{
- d_1_0_Deprecated->f.Frustum(left, right, bottom, top, zNear, zFar);
-}
-
-inline GLboolean QOpenGLFunctions_1_0::glIsList(GLuint list)
-{
- return d_1_0_Deprecated->f.IsList(list);
-}
-
-inline void QOpenGLFunctions_1_0::glGetTexGeniv(GLenum coord, GLenum pname, GLint *params)
-{
- d_1_0_Deprecated->f.GetTexGeniv(coord, pname, params);
-}
-
-inline void QOpenGLFunctions_1_0::glGetTexGenfv(GLenum coord, GLenum pname, GLfloat *params)
-{
- d_1_0_Deprecated->f.GetTexGenfv(coord, pname, params);
-}
-
-inline void QOpenGLFunctions_1_0::glGetTexGendv(GLenum coord, GLenum pname, GLdouble *params)
-{
- d_1_0_Deprecated->f.GetTexGendv(coord, pname, params);
-}
-
-inline void QOpenGLFunctions_1_0::glGetTexEnviv(GLenum target, GLenum pname, GLint *params)
-{
- d_1_0_Deprecated->f.GetTexEnviv(target, pname, params);
-}
-
-inline void QOpenGLFunctions_1_0::glGetTexEnvfv(GLenum target, GLenum pname, GLfloat *params)
-{
- d_1_0_Deprecated->f.GetTexEnvfv(target, pname, params);
-}
-
-inline void QOpenGLFunctions_1_0::glGetPolygonStipple(GLubyte *mask)
-{
- d_1_0_Deprecated->f.GetPolygonStipple(mask);
-}
-
-inline void QOpenGLFunctions_1_0::glGetPixelMapusv(GLenum map, GLushort *values)
-{
- d_1_0_Deprecated->f.GetPixelMapusv(map, values);
-}
-
-inline void QOpenGLFunctions_1_0::glGetPixelMapuiv(GLenum map, GLuint *values)
-{
- d_1_0_Deprecated->f.GetPixelMapuiv(map, values);
-}
-
-inline void QOpenGLFunctions_1_0::glGetPixelMapfv(GLenum map, GLfloat *values)
-{
- d_1_0_Deprecated->f.GetPixelMapfv(map, values);
-}
-
-inline void QOpenGLFunctions_1_0::glGetMaterialiv(GLenum face, GLenum pname, GLint *params)
-{
- d_1_0_Deprecated->f.GetMaterialiv(face, pname, params);
-}
-
-inline void QOpenGLFunctions_1_0::glGetMaterialfv(GLenum face, GLenum pname, GLfloat *params)
-{
- d_1_0_Deprecated->f.GetMaterialfv(face, pname, params);
-}
-
-inline void QOpenGLFunctions_1_0::glGetMapiv(GLenum target, GLenum query, GLint *v)
-{
- d_1_0_Deprecated->f.GetMapiv(target, query, v);
-}
-
-inline void QOpenGLFunctions_1_0::glGetMapfv(GLenum target, GLenum query, GLfloat *v)
-{
- d_1_0_Deprecated->f.GetMapfv(target, query, v);
-}
-
-inline void QOpenGLFunctions_1_0::glGetMapdv(GLenum target, GLenum query, GLdouble *v)
-{
- d_1_0_Deprecated->f.GetMapdv(target, query, v);
-}
-
-inline void QOpenGLFunctions_1_0::glGetLightiv(GLenum light, GLenum pname, GLint *params)
-{
- d_1_0_Deprecated->f.GetLightiv(light, pname, params);
-}
-
-inline void QOpenGLFunctions_1_0::glGetLightfv(GLenum light, GLenum pname, GLfloat *params)
-{
- d_1_0_Deprecated->f.GetLightfv(light, pname, params);
-}
-
-inline void QOpenGLFunctions_1_0::glGetClipPlane(GLenum plane, GLdouble *equation)
-{
- d_1_0_Deprecated->f.GetClipPlane(plane, equation);
-}
-
-inline void QOpenGLFunctions_1_0::glDrawPixels(GLsizei width, GLsizei height, GLenum format, GLenum type, const GLvoid *pixels)
-{
- d_1_0_Deprecated->f.DrawPixels(width, height, format, type, pixels);
-}
-
-inline void QOpenGLFunctions_1_0::glCopyPixels(GLint x, GLint y, GLsizei width, GLsizei height, GLenum type)
-{
- d_1_0_Deprecated->f.CopyPixels(x, y, width, height, type);
-}
-
-inline void QOpenGLFunctions_1_0::glPixelMapusv(GLenum map, GLint mapsize, const GLushort *values)
-{
- d_1_0_Deprecated->f.PixelMapusv(map, mapsize, values);
-}
-
-inline void QOpenGLFunctions_1_0::glPixelMapuiv(GLenum map, GLint mapsize, const GLuint *values)
-{
- d_1_0_Deprecated->f.PixelMapuiv(map, mapsize, values);
-}
-
-inline void QOpenGLFunctions_1_0::glPixelMapfv(GLenum map, GLint mapsize, const GLfloat *values)
-{
- d_1_0_Deprecated->f.PixelMapfv(map, mapsize, values);
-}
-
-inline void QOpenGLFunctions_1_0::glPixelTransferi(GLenum pname, GLint param)
-{
- d_1_0_Deprecated->f.PixelTransferi(pname, param);
-}
-
-inline void QOpenGLFunctions_1_0::glPixelTransferf(GLenum pname, GLfloat param)
-{
- d_1_0_Deprecated->f.PixelTransferf(pname, param);
-}
-
-inline void QOpenGLFunctions_1_0::glPixelZoom(GLfloat xfactor, GLfloat yfactor)
-{
- d_1_0_Deprecated->f.PixelZoom(xfactor, yfactor);
-}
-
-inline void QOpenGLFunctions_1_0::glAlphaFunc(GLenum func, GLfloat ref)
-{
- d_1_0_Deprecated->f.AlphaFunc(func, ref);
-}
-
-inline void QOpenGLFunctions_1_0::glEvalPoint2(GLint i, GLint j)
-{
- d_1_0_Deprecated->f.EvalPoint2(i, j);
-}
-
-inline void QOpenGLFunctions_1_0::glEvalMesh2(GLenum mode, GLint i1, GLint i2, GLint j1, GLint j2)
-{
- d_1_0_Deprecated->f.EvalMesh2(mode, i1, i2, j1, j2);
-}
-
-inline void QOpenGLFunctions_1_0::glEvalPoint1(GLint i)
-{
- d_1_0_Deprecated->f.EvalPoint1(i);
-}
-
-inline void QOpenGLFunctions_1_0::glEvalMesh1(GLenum mode, GLint i1, GLint i2)
-{
- d_1_0_Deprecated->f.EvalMesh1(mode, i1, i2);
-}
-
-inline void QOpenGLFunctions_1_0::glEvalCoord2fv(const GLfloat *u)
-{
- d_1_0_Deprecated->f.EvalCoord2fv(u);
-}
-
-inline void QOpenGLFunctions_1_0::glEvalCoord2f(GLfloat u, GLfloat v)
-{
- d_1_0_Deprecated->f.EvalCoord2f(u, v);
-}
-
-inline void QOpenGLFunctions_1_0::glEvalCoord2dv(const GLdouble *u)
-{
- d_1_0_Deprecated->f.EvalCoord2dv(u);
-}
-
-inline void QOpenGLFunctions_1_0::glEvalCoord2d(GLdouble u, GLdouble v)
-{
- d_1_0_Deprecated->f.EvalCoord2d(u, v);
-}
-
-inline void QOpenGLFunctions_1_0::glEvalCoord1fv(const GLfloat *u)
-{
- d_1_0_Deprecated->f.EvalCoord1fv(u);
-}
-
-inline void QOpenGLFunctions_1_0::glEvalCoord1f(GLfloat u)
-{
- d_1_0_Deprecated->f.EvalCoord1f(u);
-}
-
-inline void QOpenGLFunctions_1_0::glEvalCoord1dv(const GLdouble *u)
-{
- d_1_0_Deprecated->f.EvalCoord1dv(u);
-}
-
-inline void QOpenGLFunctions_1_0::glEvalCoord1d(GLdouble u)
-{
- d_1_0_Deprecated->f.EvalCoord1d(u);
-}
-
-inline void QOpenGLFunctions_1_0::glMapGrid2f(GLint un, GLfloat u1, GLfloat u2, GLint vn, GLfloat v1, GLfloat v2)
-{
- d_1_0_Deprecated->f.MapGrid2f(un, u1, u2, vn, v1, v2);
-}
-
-inline void QOpenGLFunctions_1_0::glMapGrid2d(GLint un, GLdouble u1, GLdouble u2, GLint vn, GLdouble v1, GLdouble v2)
-{
- d_1_0_Deprecated->f.MapGrid2d(un, u1, u2, vn, v1, v2);
-}
-
-inline void QOpenGLFunctions_1_0::glMapGrid1f(GLint un, GLfloat u1, GLfloat u2)
-{
- d_1_0_Deprecated->f.MapGrid1f(un, u1, u2);
-}
-
-inline void QOpenGLFunctions_1_0::glMapGrid1d(GLint un, GLdouble u1, GLdouble u2)
-{
- d_1_0_Deprecated->f.MapGrid1d(un, u1, u2);
-}
-
-inline void QOpenGLFunctions_1_0::glMap2f(GLenum target, GLfloat u1, GLfloat u2, GLint ustride, GLint uorder, GLfloat v1, GLfloat v2, GLint vstride, GLint vorder, const GLfloat *points)
-{
- d_1_0_Deprecated->f.Map2f(target, u1, u2, ustride, uorder, v1, v2, vstride, vorder, points);
-}
-
-inline void QOpenGLFunctions_1_0::glMap2d(GLenum target, GLdouble u1, GLdouble u2, GLint ustride, GLint uorder, GLdouble v1, GLdouble v2, GLint vstride, GLint vorder, const GLdouble *points)
-{
- d_1_0_Deprecated->f.Map2d(target, u1, u2, ustride, uorder, v1, v2, vstride, vorder, points);
-}
-
-inline void QOpenGLFunctions_1_0::glMap1f(GLenum target, GLfloat u1, GLfloat u2, GLint stride, GLint order, const GLfloat *points)
-{
- d_1_0_Deprecated->f.Map1f(target, u1, u2, stride, order, points);
-}
-
-inline void QOpenGLFunctions_1_0::glMap1d(GLenum target, GLdouble u1, GLdouble u2, GLint stride, GLint order, const GLdouble *points)
-{
- d_1_0_Deprecated->f.Map1d(target, u1, u2, stride, order, points);
-}
-
-inline void QOpenGLFunctions_1_0::glPushAttrib(GLbitfield mask)
-{
- d_1_0_Deprecated->f.PushAttrib(mask);
-}
-
-inline void QOpenGLFunctions_1_0::glPopAttrib()
-{
- d_1_0_Deprecated->f.PopAttrib();
-}
-
-inline void QOpenGLFunctions_1_0::glAccum(GLenum op, GLfloat value)
-{
- d_1_0_Deprecated->f.Accum(op, value);
-}
-
-inline void QOpenGLFunctions_1_0::glIndexMask(GLuint mask)
-{
- d_1_0_Deprecated->f.IndexMask(mask);
-}
-
-inline void QOpenGLFunctions_1_0::glClearIndex(GLfloat c)
-{
- d_1_0_Deprecated->f.ClearIndex(c);
-}
-
-inline void QOpenGLFunctions_1_0::glClearAccum(GLfloat red, GLfloat green, GLfloat blue, GLfloat alpha)
-{
- d_1_0_Deprecated->f.ClearAccum(red, green, blue, alpha);
-}
-
-inline void QOpenGLFunctions_1_0::glPushName(GLuint name)
-{
- d_1_0_Deprecated->f.PushName(name);
-}
-
-inline void QOpenGLFunctions_1_0::glPopName()
-{
- d_1_0_Deprecated->f.PopName();
-}
-
-inline void QOpenGLFunctions_1_0::glPassThrough(GLfloat token)
-{
- d_1_0_Deprecated->f.PassThrough(token);
-}
-
-inline void QOpenGLFunctions_1_0::glLoadName(GLuint name)
-{
- d_1_0_Deprecated->f.LoadName(name);
-}
-
-inline void QOpenGLFunctions_1_0::glInitNames()
-{
- d_1_0_Deprecated->f.InitNames();
-}
-
-inline GLint QOpenGLFunctions_1_0::glRenderMode(GLenum mode)
-{
- return d_1_0_Deprecated->f.RenderMode(mode);
-}
-
-inline void QOpenGLFunctions_1_0::glSelectBuffer(GLsizei size, GLuint *buffer)
-{
- d_1_0_Deprecated->f.SelectBuffer(size, buffer);
-}
-
-inline void QOpenGLFunctions_1_0::glFeedbackBuffer(GLsizei size, GLenum type, GLfloat *buffer)
-{
- d_1_0_Deprecated->f.FeedbackBuffer(size, type, buffer);
-}
-
-inline void QOpenGLFunctions_1_0::glTexGeniv(GLenum coord, GLenum pname, const GLint *params)
-{
- d_1_0_Deprecated->f.TexGeniv(coord, pname, params);
-}
-
-inline void QOpenGLFunctions_1_0::glTexGeni(GLenum coord, GLenum pname, GLint param)
-{
- d_1_0_Deprecated->f.TexGeni(coord, pname, param);
-}
-
-inline void QOpenGLFunctions_1_0::glTexGenfv(GLenum coord, GLenum pname, const GLfloat *params)
-{
- d_1_0_Deprecated->f.TexGenfv(coord, pname, params);
-}
-
-inline void QOpenGLFunctions_1_0::glTexGenf(GLenum coord, GLenum pname, GLfloat param)
-{
- d_1_0_Deprecated->f.TexGenf(coord, pname, param);
-}
-
-inline void QOpenGLFunctions_1_0::glTexGendv(GLenum coord, GLenum pname, const GLdouble *params)
-{
- d_1_0_Deprecated->f.TexGendv(coord, pname, params);
-}
-
-inline void QOpenGLFunctions_1_0::glTexGend(GLenum coord, GLenum pname, GLdouble param)
-{
- d_1_0_Deprecated->f.TexGend(coord, pname, param);
-}
-
-inline void QOpenGLFunctions_1_0::glTexEnviv(GLenum target, GLenum pname, const GLint *params)
-{
- d_1_0_Deprecated->f.TexEnviv(target, pname, params);
-}
-
-inline void QOpenGLFunctions_1_0::glTexEnvi(GLenum target, GLenum pname, GLint param)
-{
- d_1_0_Deprecated->f.TexEnvi(target, pname, param);
-}
-
-inline void QOpenGLFunctions_1_0::glTexEnvfv(GLenum target, GLenum pname, const GLfloat *params)
-{
- d_1_0_Deprecated->f.TexEnvfv(target, pname, params);
-}
-
-inline void QOpenGLFunctions_1_0::glTexEnvf(GLenum target, GLenum pname, GLfloat param)
-{
- d_1_0_Deprecated->f.TexEnvf(target, pname, param);
-}
-
-inline void QOpenGLFunctions_1_0::glShadeModel(GLenum mode)
-{
- d_1_0_Deprecated->f.ShadeModel(mode);
-}
-
-inline void QOpenGLFunctions_1_0::glPolygonStipple(const GLubyte *mask)
-{
- d_1_0_Deprecated->f.PolygonStipple(mask);
-}
-
-inline void QOpenGLFunctions_1_0::glMaterialiv(GLenum face, GLenum pname, const GLint *params)
-{
- d_1_0_Deprecated->f.Materialiv(face, pname, params);
-}
-
-inline void QOpenGLFunctions_1_0::glMateriali(GLenum face, GLenum pname, GLint param)
-{
- d_1_0_Deprecated->f.Materiali(face, pname, param);
-}
-
-inline void QOpenGLFunctions_1_0::glMaterialfv(GLenum face, GLenum pname, const GLfloat *params)
-{
- d_1_0_Deprecated->f.Materialfv(face, pname, params);
-}
-
-inline void QOpenGLFunctions_1_0::glMaterialf(GLenum face, GLenum pname, GLfloat param)
-{
- d_1_0_Deprecated->f.Materialf(face, pname, param);
-}
-
-inline void QOpenGLFunctions_1_0::glLineStipple(GLint factor, GLushort pattern)
-{
- d_1_0_Deprecated->f.LineStipple(factor, pattern);
-}
-
-inline void QOpenGLFunctions_1_0::glLightModeliv(GLenum pname, const GLint *params)
-{
- d_1_0_Deprecated->f.LightModeliv(pname, params);
-}
-
-inline void QOpenGLFunctions_1_0::glLightModeli(GLenum pname, GLint param)
-{
- d_1_0_Deprecated->f.LightModeli(pname, param);
-}
-
-inline void QOpenGLFunctions_1_0::glLightModelfv(GLenum pname, const GLfloat *params)
-{
- d_1_0_Deprecated->f.LightModelfv(pname, params);
-}
-
-inline void QOpenGLFunctions_1_0::glLightModelf(GLenum pname, GLfloat param)
-{
- d_1_0_Deprecated->f.LightModelf(pname, param);
-}
-
-inline void QOpenGLFunctions_1_0::glLightiv(GLenum light, GLenum pname, const GLint *params)
-{
- d_1_0_Deprecated->f.Lightiv(light, pname, params);
-}
-
-inline void QOpenGLFunctions_1_0::glLighti(GLenum light, GLenum pname, GLint param)
-{
- d_1_0_Deprecated->f.Lighti(light, pname, param);
-}
-
-inline void QOpenGLFunctions_1_0::glLightfv(GLenum light, GLenum pname, const GLfloat *params)
-{
- d_1_0_Deprecated->f.Lightfv(light, pname, params);
-}
-
-inline void QOpenGLFunctions_1_0::glLightf(GLenum light, GLenum pname, GLfloat param)
-{
- d_1_0_Deprecated->f.Lightf(light, pname, param);
-}
-
-inline void QOpenGLFunctions_1_0::glFogiv(GLenum pname, const GLint *params)
-{
- d_1_0_Deprecated->f.Fogiv(pname, params);
-}
-
-inline void QOpenGLFunctions_1_0::glFogi(GLenum pname, GLint param)
-{
- d_1_0_Deprecated->f.Fogi(pname, param);
-}
-
-inline void QOpenGLFunctions_1_0::glFogfv(GLenum pname, const GLfloat *params)
-{
- d_1_0_Deprecated->f.Fogfv(pname, params);
-}
-
-inline void QOpenGLFunctions_1_0::glFogf(GLenum pname, GLfloat param)
-{
- d_1_0_Deprecated->f.Fogf(pname, param);
-}
-
-inline void QOpenGLFunctions_1_0::glColorMaterial(GLenum face, GLenum mode)
-{
- d_1_0_Deprecated->f.ColorMaterial(face, mode);
-}
-
-inline void QOpenGLFunctions_1_0::glClipPlane(GLenum plane, const GLdouble *equation)
-{
- d_1_0_Deprecated->f.ClipPlane(plane, equation);
-}
-
-inline void QOpenGLFunctions_1_0::glVertex4sv(const GLshort *v)
-{
- d_1_0_Deprecated->f.Vertex4sv(v);
-}
-
-inline void QOpenGLFunctions_1_0::glVertex4s(GLshort x, GLshort y, GLshort z, GLshort w)
-{
- d_1_0_Deprecated->f.Vertex4s(x, y, z, w);
-}
-
-inline void QOpenGLFunctions_1_0::glVertex4iv(const GLint *v)
-{
- d_1_0_Deprecated->f.Vertex4iv(v);
-}
-
-inline void QOpenGLFunctions_1_0::glVertex4i(GLint x, GLint y, GLint z, GLint w)
-{
- d_1_0_Deprecated->f.Vertex4i(x, y, z, w);
-}
-
-inline void QOpenGLFunctions_1_0::glVertex4fv(const GLfloat *v)
-{
- d_1_0_Deprecated->f.Vertex4fv(v);
-}
-
-inline void QOpenGLFunctions_1_0::glVertex4f(GLfloat x, GLfloat y, GLfloat z, GLfloat w)
-{
- d_1_0_Deprecated->f.Vertex4f(x, y, z, w);
-}
-
-inline void QOpenGLFunctions_1_0::glVertex4dv(const GLdouble *v)
-{
- d_1_0_Deprecated->f.Vertex4dv(v);
-}
-
-inline void QOpenGLFunctions_1_0::glVertex4d(GLdouble x, GLdouble y, GLdouble z, GLdouble w)
-{
- d_1_0_Deprecated->f.Vertex4d(x, y, z, w);
-}
-
-inline void QOpenGLFunctions_1_0::glVertex3sv(const GLshort *v)
-{
- d_1_0_Deprecated->f.Vertex3sv(v);
-}
-
-inline void QOpenGLFunctions_1_0::glVertex3s(GLshort x, GLshort y, GLshort z)
-{
- d_1_0_Deprecated->f.Vertex3s(x, y, z);
-}
-
-inline void QOpenGLFunctions_1_0::glVertex3iv(const GLint *v)
-{
- d_1_0_Deprecated->f.Vertex3iv(v);
-}
-
-inline void QOpenGLFunctions_1_0::glVertex3i(GLint x, GLint y, GLint z)
-{
- d_1_0_Deprecated->f.Vertex3i(x, y, z);
-}
-
-inline void QOpenGLFunctions_1_0::glVertex3fv(const GLfloat *v)
-{
- d_1_0_Deprecated->f.Vertex3fv(v);
-}
-
-inline void QOpenGLFunctions_1_0::glVertex3f(GLfloat x, GLfloat y, GLfloat z)
-{
- d_1_0_Deprecated->f.Vertex3f(x, y, z);
-}
-
-inline void QOpenGLFunctions_1_0::glVertex3dv(const GLdouble *v)
-{
- d_1_0_Deprecated->f.Vertex3dv(v);
-}
-
-inline void QOpenGLFunctions_1_0::glVertex3d(GLdouble x, GLdouble y, GLdouble z)
-{
- d_1_0_Deprecated->f.Vertex3d(x, y, z);
-}
-
-inline void QOpenGLFunctions_1_0::glVertex2sv(const GLshort *v)
-{
- d_1_0_Deprecated->f.Vertex2sv(v);
-}
-
-inline void QOpenGLFunctions_1_0::glVertex2s(GLshort x, GLshort y)
-{
- d_1_0_Deprecated->f.Vertex2s(x, y);
-}
-
-inline void QOpenGLFunctions_1_0::glVertex2iv(const GLint *v)
-{
- d_1_0_Deprecated->f.Vertex2iv(v);
-}
-
-inline void QOpenGLFunctions_1_0::glVertex2i(GLint x, GLint y)
-{
- d_1_0_Deprecated->f.Vertex2i(x, y);
-}
-
-inline void QOpenGLFunctions_1_0::glVertex2fv(const GLfloat *v)
-{
- d_1_0_Deprecated->f.Vertex2fv(v);
-}
-
-inline void QOpenGLFunctions_1_0::glVertex2f(GLfloat x, GLfloat y)
-{
- d_1_0_Deprecated->f.Vertex2f(x, y);
-}
-
-inline void QOpenGLFunctions_1_0::glVertex2dv(const GLdouble *v)
-{
- d_1_0_Deprecated->f.Vertex2dv(v);
-}
-
-inline void QOpenGLFunctions_1_0::glVertex2d(GLdouble x, GLdouble y)
-{
- d_1_0_Deprecated->f.Vertex2d(x, y);
-}
-
-inline void QOpenGLFunctions_1_0::glTexCoord4sv(const GLshort *v)
-{
- d_1_0_Deprecated->f.TexCoord4sv(v);
-}
-
-inline void QOpenGLFunctions_1_0::glTexCoord4s(GLshort s, GLshort t, GLshort r, GLshort q)
-{
- d_1_0_Deprecated->f.TexCoord4s(s, t, r, q);
-}
-
-inline void QOpenGLFunctions_1_0::glTexCoord4iv(const GLint *v)
-{
- d_1_0_Deprecated->f.TexCoord4iv(v);
-}
-
-inline void QOpenGLFunctions_1_0::glTexCoord4i(GLint s, GLint t, GLint r, GLint q)
-{
- d_1_0_Deprecated->f.TexCoord4i(s, t, r, q);
-}
-
-inline void QOpenGLFunctions_1_0::glTexCoord4fv(const GLfloat *v)
-{
- d_1_0_Deprecated->f.TexCoord4fv(v);
-}
-
-inline void QOpenGLFunctions_1_0::glTexCoord4f(GLfloat s, GLfloat t, GLfloat r, GLfloat q)
-{
- d_1_0_Deprecated->f.TexCoord4f(s, t, r, q);
-}
-
-inline void QOpenGLFunctions_1_0::glTexCoord4dv(const GLdouble *v)
-{
- d_1_0_Deprecated->f.TexCoord4dv(v);
-}
-
-inline void QOpenGLFunctions_1_0::glTexCoord4d(GLdouble s, GLdouble t, GLdouble r, GLdouble q)
-{
- d_1_0_Deprecated->f.TexCoord4d(s, t, r, q);
-}
-
-inline void QOpenGLFunctions_1_0::glTexCoord3sv(const GLshort *v)
-{
- d_1_0_Deprecated->f.TexCoord3sv(v);
-}
-
-inline void QOpenGLFunctions_1_0::glTexCoord3s(GLshort s, GLshort t, GLshort r)
-{
- d_1_0_Deprecated->f.TexCoord3s(s, t, r);
-}
-
-inline void QOpenGLFunctions_1_0::glTexCoord3iv(const GLint *v)
-{
- d_1_0_Deprecated->f.TexCoord3iv(v);
-}
-
-inline void QOpenGLFunctions_1_0::glTexCoord3i(GLint s, GLint t, GLint r)
-{
- d_1_0_Deprecated->f.TexCoord3i(s, t, r);
-}
-
-inline void QOpenGLFunctions_1_0::glTexCoord3fv(const GLfloat *v)
-{
- d_1_0_Deprecated->f.TexCoord3fv(v);
-}
-
-inline void QOpenGLFunctions_1_0::glTexCoord3f(GLfloat s, GLfloat t, GLfloat r)
-{
- d_1_0_Deprecated->f.TexCoord3f(s, t, r);
-}
-
-inline void QOpenGLFunctions_1_0::glTexCoord3dv(const GLdouble *v)
-{
- d_1_0_Deprecated->f.TexCoord3dv(v);
-}
-
-inline void QOpenGLFunctions_1_0::glTexCoord3d(GLdouble s, GLdouble t, GLdouble r)
-{
- d_1_0_Deprecated->f.TexCoord3d(s, t, r);
-}
-
-inline void QOpenGLFunctions_1_0::glTexCoord2sv(const GLshort *v)
-{
- d_1_0_Deprecated->f.TexCoord2sv(v);
-}
-
-inline void QOpenGLFunctions_1_0::glTexCoord2s(GLshort s, GLshort t)
-{
- d_1_0_Deprecated->f.TexCoord2s(s, t);
-}
-
-inline void QOpenGLFunctions_1_0::glTexCoord2iv(const GLint *v)
-{
- d_1_0_Deprecated->f.TexCoord2iv(v);
-}
-
-inline void QOpenGLFunctions_1_0::glTexCoord2i(GLint s, GLint t)
-{
- d_1_0_Deprecated->f.TexCoord2i(s, t);
-}
-
-inline void QOpenGLFunctions_1_0::glTexCoord2fv(const GLfloat *v)
-{
- d_1_0_Deprecated->f.TexCoord2fv(v);
-}
-
-inline void QOpenGLFunctions_1_0::glTexCoord2f(GLfloat s, GLfloat t)
-{
- d_1_0_Deprecated->f.TexCoord2f(s, t);
-}
-
-inline void QOpenGLFunctions_1_0::glTexCoord2dv(const GLdouble *v)
-{
- d_1_0_Deprecated->f.TexCoord2dv(v);
-}
-
-inline void QOpenGLFunctions_1_0::glTexCoord2d(GLdouble s, GLdouble t)
-{
- d_1_0_Deprecated->f.TexCoord2d(s, t);
-}
-
-inline void QOpenGLFunctions_1_0::glTexCoord1sv(const GLshort *v)
-{
- d_1_0_Deprecated->f.TexCoord1sv(v);
-}
-
-inline void QOpenGLFunctions_1_0::glTexCoord1s(GLshort s)
-{
- d_1_0_Deprecated->f.TexCoord1s(s);
-}
-
-inline void QOpenGLFunctions_1_0::glTexCoord1iv(const GLint *v)
-{
- d_1_0_Deprecated->f.TexCoord1iv(v);
-}
-
-inline void QOpenGLFunctions_1_0::glTexCoord1i(GLint s)
-{
- d_1_0_Deprecated->f.TexCoord1i(s);
-}
-
-inline void QOpenGLFunctions_1_0::glTexCoord1fv(const GLfloat *v)
-{
- d_1_0_Deprecated->f.TexCoord1fv(v);
-}
-
-inline void QOpenGLFunctions_1_0::glTexCoord1f(GLfloat s)
-{
- d_1_0_Deprecated->f.TexCoord1f(s);
-}
-
-inline void QOpenGLFunctions_1_0::glTexCoord1dv(const GLdouble *v)
-{
- d_1_0_Deprecated->f.TexCoord1dv(v);
-}
-
-inline void QOpenGLFunctions_1_0::glTexCoord1d(GLdouble s)
-{
- d_1_0_Deprecated->f.TexCoord1d(s);
-}
-
-inline void QOpenGLFunctions_1_0::glRectsv(const GLshort *v1, const GLshort *v2)
-{
- d_1_0_Deprecated->f.Rectsv(v1, v2);
-}
-
-inline void QOpenGLFunctions_1_0::glRects(GLshort x1, GLshort y1, GLshort x2, GLshort y2)
-{
- d_1_0_Deprecated->f.Rects(x1, y1, x2, y2);
-}
-
-inline void QOpenGLFunctions_1_0::glRectiv(const GLint *v1, const GLint *v2)
-{
- d_1_0_Deprecated->f.Rectiv(v1, v2);
-}
-
-inline void QOpenGLFunctions_1_0::glRecti(GLint x1, GLint y1, GLint x2, GLint y2)
-{
- d_1_0_Deprecated->f.Recti(x1, y1, x2, y2);
-}
-
-inline void QOpenGLFunctions_1_0::glRectfv(const GLfloat *v1, const GLfloat *v2)
-{
- d_1_0_Deprecated->f.Rectfv(v1, v2);
-}
-
-inline void QOpenGLFunctions_1_0::glRectf(GLfloat x1, GLfloat y1, GLfloat x2, GLfloat y2)
-{
- d_1_0_Deprecated->f.Rectf(x1, y1, x2, y2);
-}
-
-inline void QOpenGLFunctions_1_0::glRectdv(const GLdouble *v1, const GLdouble *v2)
-{
- d_1_0_Deprecated->f.Rectdv(v1, v2);
-}
-
-inline void QOpenGLFunctions_1_0::glRectd(GLdouble x1, GLdouble y1, GLdouble x2, GLdouble y2)
-{
- d_1_0_Deprecated->f.Rectd(x1, y1, x2, y2);
-}
-
-inline void QOpenGLFunctions_1_0::glRasterPos4sv(const GLshort *v)
-{
- d_1_0_Deprecated->f.RasterPos4sv(v);
-}
-
-inline void QOpenGLFunctions_1_0::glRasterPos4s(GLshort x, GLshort y, GLshort z, GLshort w)
-{
- d_1_0_Deprecated->f.RasterPos4s(x, y, z, w);
-}
-
-inline void QOpenGLFunctions_1_0::glRasterPos4iv(const GLint *v)
-{
- d_1_0_Deprecated->f.RasterPos4iv(v);
-}
-
-inline void QOpenGLFunctions_1_0::glRasterPos4i(GLint x, GLint y, GLint z, GLint w)
-{
- d_1_0_Deprecated->f.RasterPos4i(x, y, z, w);
-}
-
-inline void QOpenGLFunctions_1_0::glRasterPos4fv(const GLfloat *v)
-{
- d_1_0_Deprecated->f.RasterPos4fv(v);
-}
-
-inline void QOpenGLFunctions_1_0::glRasterPos4f(GLfloat x, GLfloat y, GLfloat z, GLfloat w)
-{
- d_1_0_Deprecated->f.RasterPos4f(x, y, z, w);
-}
-
-inline void QOpenGLFunctions_1_0::glRasterPos4dv(const GLdouble *v)
-{
- d_1_0_Deprecated->f.RasterPos4dv(v);
-}
-
-inline void QOpenGLFunctions_1_0::glRasterPos4d(GLdouble x, GLdouble y, GLdouble z, GLdouble w)
-{
- d_1_0_Deprecated->f.RasterPos4d(x, y, z, w);
-}
-
-inline void QOpenGLFunctions_1_0::glRasterPos3sv(const GLshort *v)
-{
- d_1_0_Deprecated->f.RasterPos3sv(v);
-}
-
-inline void QOpenGLFunctions_1_0::glRasterPos3s(GLshort x, GLshort y, GLshort z)
-{
- d_1_0_Deprecated->f.RasterPos3s(x, y, z);
-}
-
-inline void QOpenGLFunctions_1_0::glRasterPos3iv(const GLint *v)
-{
- d_1_0_Deprecated->f.RasterPos3iv(v);
-}
-
-inline void QOpenGLFunctions_1_0::glRasterPos3i(GLint x, GLint y, GLint z)
-{
- d_1_0_Deprecated->f.RasterPos3i(x, y, z);
-}
-
-inline void QOpenGLFunctions_1_0::glRasterPos3fv(const GLfloat *v)
-{
- d_1_0_Deprecated->f.RasterPos3fv(v);
-}
-
-inline void QOpenGLFunctions_1_0::glRasterPos3f(GLfloat x, GLfloat y, GLfloat z)
-{
- d_1_0_Deprecated->f.RasterPos3f(x, y, z);
-}
-
-inline void QOpenGLFunctions_1_0::glRasterPos3dv(const GLdouble *v)
-{
- d_1_0_Deprecated->f.RasterPos3dv(v);
-}
-
-inline void QOpenGLFunctions_1_0::glRasterPos3d(GLdouble x, GLdouble y, GLdouble z)
-{
- d_1_0_Deprecated->f.RasterPos3d(x, y, z);
-}
-
-inline void QOpenGLFunctions_1_0::glRasterPos2sv(const GLshort *v)
-{
- d_1_0_Deprecated->f.RasterPos2sv(v);
-}
-
-inline void QOpenGLFunctions_1_0::glRasterPos2s(GLshort x, GLshort y)
-{
- d_1_0_Deprecated->f.RasterPos2s(x, y);
-}
-
-inline void QOpenGLFunctions_1_0::glRasterPos2iv(const GLint *v)
-{
- d_1_0_Deprecated->f.RasterPos2iv(v);
-}
-
-inline void QOpenGLFunctions_1_0::glRasterPos2i(GLint x, GLint y)
-{
- d_1_0_Deprecated->f.RasterPos2i(x, y);
-}
-
-inline void QOpenGLFunctions_1_0::glRasterPos2fv(const GLfloat *v)
-{
- d_1_0_Deprecated->f.RasterPos2fv(v);
-}
-
-inline void QOpenGLFunctions_1_0::glRasterPos2f(GLfloat x, GLfloat y)
-{
- d_1_0_Deprecated->f.RasterPos2f(x, y);
-}
-
-inline void QOpenGLFunctions_1_0::glRasterPos2dv(const GLdouble *v)
-{
- d_1_0_Deprecated->f.RasterPos2dv(v);
-}
-
-inline void QOpenGLFunctions_1_0::glRasterPos2d(GLdouble x, GLdouble y)
-{
- d_1_0_Deprecated->f.RasterPos2d(x, y);
-}
-
-inline void QOpenGLFunctions_1_0::glNormal3sv(const GLshort *v)
-{
- d_1_0_Deprecated->f.Normal3sv(v);
-}
-
-inline void QOpenGLFunctions_1_0::glNormal3s(GLshort nx, GLshort ny, GLshort nz)
-{
- d_1_0_Deprecated->f.Normal3s(nx, ny, nz);
-}
-
-inline void QOpenGLFunctions_1_0::glNormal3iv(const GLint *v)
-{
- d_1_0_Deprecated->f.Normal3iv(v);
-}
-
-inline void QOpenGLFunctions_1_0::glNormal3i(GLint nx, GLint ny, GLint nz)
-{
- d_1_0_Deprecated->f.Normal3i(nx, ny, nz);
-}
-
-inline void QOpenGLFunctions_1_0::glNormal3fv(const GLfloat *v)
-{
- d_1_0_Deprecated->f.Normal3fv(v);
-}
-
-inline void QOpenGLFunctions_1_0::glNormal3f(GLfloat nx, GLfloat ny, GLfloat nz)
-{
- d_1_0_Deprecated->f.Normal3f(nx, ny, nz);
-}
-
-inline void QOpenGLFunctions_1_0::glNormal3dv(const GLdouble *v)
-{
- d_1_0_Deprecated->f.Normal3dv(v);
-}
-
-inline void QOpenGLFunctions_1_0::glNormal3d(GLdouble nx, GLdouble ny, GLdouble nz)
-{
- d_1_0_Deprecated->f.Normal3d(nx, ny, nz);
-}
-
-inline void QOpenGLFunctions_1_0::glNormal3bv(const GLbyte *v)
-{
- d_1_0_Deprecated->f.Normal3bv(v);
-}
-
-inline void QOpenGLFunctions_1_0::glNormal3b(GLbyte nx, GLbyte ny, GLbyte nz)
-{
- d_1_0_Deprecated->f.Normal3b(nx, ny, nz);
-}
-
-inline void QOpenGLFunctions_1_0::glIndexsv(const GLshort *c)
-{
- d_1_0_Deprecated->f.Indexsv(c);
-}
-
-inline void QOpenGLFunctions_1_0::glIndexs(GLshort c)
-{
- d_1_0_Deprecated->f.Indexs(c);
-}
-
-inline void QOpenGLFunctions_1_0::glIndexiv(const GLint *c)
-{
- d_1_0_Deprecated->f.Indexiv(c);
-}
-
-inline void QOpenGLFunctions_1_0::glIndexi(GLint c)
-{
- d_1_0_Deprecated->f.Indexi(c);
-}
-
-inline void QOpenGLFunctions_1_0::glIndexfv(const GLfloat *c)
-{
- d_1_0_Deprecated->f.Indexfv(c);
-}
-
-inline void QOpenGLFunctions_1_0::glIndexf(GLfloat c)
-{
- d_1_0_Deprecated->f.Indexf(c);
-}
-
-inline void QOpenGLFunctions_1_0::glIndexdv(const GLdouble *c)
-{
- d_1_0_Deprecated->f.Indexdv(c);
-}
-
-inline void QOpenGLFunctions_1_0::glIndexd(GLdouble c)
-{
- d_1_0_Deprecated->f.Indexd(c);
-}
-
-inline void QOpenGLFunctions_1_0::glEnd()
-{
- d_1_0_Deprecated->f.End();
-}
-
-inline void QOpenGLFunctions_1_0::glEdgeFlagv(const GLboolean *flag)
-{
- d_1_0_Deprecated->f.EdgeFlagv(flag);
-}
-
-inline void QOpenGLFunctions_1_0::glEdgeFlag(GLboolean flag)
-{
- d_1_0_Deprecated->f.EdgeFlag(flag);
-}
-
-inline void QOpenGLFunctions_1_0::glColor4usv(const GLushort *v)
-{
- d_1_0_Deprecated->f.Color4usv(v);
-}
-
-inline void QOpenGLFunctions_1_0::glColor4us(GLushort red, GLushort green, GLushort blue, GLushort alpha)
-{
- d_1_0_Deprecated->f.Color4us(red, green, blue, alpha);
-}
-
-inline void QOpenGLFunctions_1_0::glColor4uiv(const GLuint *v)
-{
- d_1_0_Deprecated->f.Color4uiv(v);
-}
-
-inline void QOpenGLFunctions_1_0::glColor4ui(GLuint red, GLuint green, GLuint blue, GLuint alpha)
-{
- d_1_0_Deprecated->f.Color4ui(red, green, blue, alpha);
-}
-
-inline void QOpenGLFunctions_1_0::glColor4ubv(const GLubyte *v)
-{
- d_1_0_Deprecated->f.Color4ubv(v);
-}
-
-inline void QOpenGLFunctions_1_0::glColor4ub(GLubyte red, GLubyte green, GLubyte blue, GLubyte alpha)
-{
- d_1_0_Deprecated->f.Color4ub(red, green, blue, alpha);
-}
-
-inline void QOpenGLFunctions_1_0::glColor4sv(const GLshort *v)
-{
- d_1_0_Deprecated->f.Color4sv(v);
-}
-
-inline void QOpenGLFunctions_1_0::glColor4s(GLshort red, GLshort green, GLshort blue, GLshort alpha)
-{
- d_1_0_Deprecated->f.Color4s(red, green, blue, alpha);
-}
-
-inline void QOpenGLFunctions_1_0::glColor4iv(const GLint *v)
-{
- d_1_0_Deprecated->f.Color4iv(v);
-}
-
-inline void QOpenGLFunctions_1_0::glColor4i(GLint red, GLint green, GLint blue, GLint alpha)
-{
- d_1_0_Deprecated->f.Color4i(red, green, blue, alpha);
-}
-
-inline void QOpenGLFunctions_1_0::glColor4fv(const GLfloat *v)
-{
- d_1_0_Deprecated->f.Color4fv(v);
-}
-
-inline void QOpenGLFunctions_1_0::glColor4f(GLfloat red, GLfloat green, GLfloat blue, GLfloat alpha)
-{
- d_1_0_Deprecated->f.Color4f(red, green, blue, alpha);
-}
-
-inline void QOpenGLFunctions_1_0::glColor4dv(const GLdouble *v)
-{
- d_1_0_Deprecated->f.Color4dv(v);
-}
-
-inline void QOpenGLFunctions_1_0::glColor4d(GLdouble red, GLdouble green, GLdouble blue, GLdouble alpha)
-{
- d_1_0_Deprecated->f.Color4d(red, green, blue, alpha);
-}
-
-inline void QOpenGLFunctions_1_0::glColor4bv(const GLbyte *v)
-{
- d_1_0_Deprecated->f.Color4bv(v);
-}
-
-inline void QOpenGLFunctions_1_0::glColor4b(GLbyte red, GLbyte green, GLbyte blue, GLbyte alpha)
-{
- d_1_0_Deprecated->f.Color4b(red, green, blue, alpha);
-}
-
-inline void QOpenGLFunctions_1_0::glColor3usv(const GLushort *v)
-{
- d_1_0_Deprecated->f.Color3usv(v);
-}
-
-inline void QOpenGLFunctions_1_0::glColor3us(GLushort red, GLushort green, GLushort blue)
-{
- d_1_0_Deprecated->f.Color3us(red, green, blue);
-}
-
-inline void QOpenGLFunctions_1_0::glColor3uiv(const GLuint *v)
-{
- d_1_0_Deprecated->f.Color3uiv(v);
-}
-
-inline void QOpenGLFunctions_1_0::glColor3ui(GLuint red, GLuint green, GLuint blue)
-{
- d_1_0_Deprecated->f.Color3ui(red, green, blue);
-}
-
-inline void QOpenGLFunctions_1_0::glColor3ubv(const GLubyte *v)
-{
- d_1_0_Deprecated->f.Color3ubv(v);
-}
-
-inline void QOpenGLFunctions_1_0::glColor3ub(GLubyte red, GLubyte green, GLubyte blue)
-{
- d_1_0_Deprecated->f.Color3ub(red, green, blue);
-}
-
-inline void QOpenGLFunctions_1_0::glColor3sv(const GLshort *v)
-{
- d_1_0_Deprecated->f.Color3sv(v);
-}
-
-inline void QOpenGLFunctions_1_0::glColor3s(GLshort red, GLshort green, GLshort blue)
-{
- d_1_0_Deprecated->f.Color3s(red, green, blue);
-}
-
-inline void QOpenGLFunctions_1_0::glColor3iv(const GLint *v)
-{
- d_1_0_Deprecated->f.Color3iv(v);
-}
-
-inline void QOpenGLFunctions_1_0::glColor3i(GLint red, GLint green, GLint blue)
-{
- d_1_0_Deprecated->f.Color3i(red, green, blue);
-}
-
-inline void QOpenGLFunctions_1_0::glColor3fv(const GLfloat *v)
-{
- d_1_0_Deprecated->f.Color3fv(v);
-}
-
-inline void QOpenGLFunctions_1_0::glColor3f(GLfloat red, GLfloat green, GLfloat blue)
-{
- d_1_0_Deprecated->f.Color3f(red, green, blue);
-}
-
-inline void QOpenGLFunctions_1_0::glColor3dv(const GLdouble *v)
-{
- d_1_0_Deprecated->f.Color3dv(v);
-}
-
-inline void QOpenGLFunctions_1_0::glColor3d(GLdouble red, GLdouble green, GLdouble blue)
-{
- d_1_0_Deprecated->f.Color3d(red, green, blue);
-}
-
-inline void QOpenGLFunctions_1_0::glColor3bv(const GLbyte *v)
-{
- d_1_0_Deprecated->f.Color3bv(v);
-}
-
-inline void QOpenGLFunctions_1_0::glColor3b(GLbyte red, GLbyte green, GLbyte blue)
-{
- d_1_0_Deprecated->f.Color3b(red, green, blue);
-}
-
-inline void QOpenGLFunctions_1_0::glBitmap(GLsizei width, GLsizei height, GLfloat xorig, GLfloat yorig, GLfloat xmove, GLfloat ymove, const GLubyte *bitmap)
-{
- d_1_0_Deprecated->f.Bitmap(width, height, xorig, yorig, xmove, ymove, bitmap);
-}
-
-inline void QOpenGLFunctions_1_0::glBegin(GLenum mode)
-{
- d_1_0_Deprecated->f.Begin(mode);
-}
-
-inline void QOpenGLFunctions_1_0::glListBase(GLuint base)
-{
- d_1_0_Deprecated->f.ListBase(base);
-}
-
-inline GLuint QOpenGLFunctions_1_0::glGenLists(GLsizei range)
-{
- return d_1_0_Deprecated->f.GenLists(range);
-}
-
-inline void QOpenGLFunctions_1_0::glDeleteLists(GLuint list, GLsizei range)
-{
- d_1_0_Deprecated->f.DeleteLists(list, range);
-}
-
-inline void QOpenGLFunctions_1_0::glCallLists(GLsizei n, GLenum type, const GLvoid *lists)
-{
- d_1_0_Deprecated->f.CallLists(n, type, lists);
-}
-
-inline void QOpenGLFunctions_1_0::glCallList(GLuint list)
-{
- d_1_0_Deprecated->f.CallList(list);
-}
-
-inline void QOpenGLFunctions_1_0::glEndList()
-{
- d_1_0_Deprecated->f.EndList();
-}
-
-inline void QOpenGLFunctions_1_0::glNewList(GLuint list, GLenum mode)
-{
- d_1_0_Deprecated->f.NewList(list, mode);
-}
-
-
-
-QT_END_NAMESPACE
-
-#endif // QT_NO_OPENGL && !QT_OPENGL_ES_2
-
-#endif
diff --git a/src/gui/opengl/qopenglfunctions_1_1.cpp b/src/gui/opengl/qopenglfunctions_1_1.cpp
deleted file mode 100644
index b0f7538d48..0000000000
--- a/src/gui/opengl/qopenglfunctions_1_1.cpp
+++ /dev/null
@@ -1,154 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2013 Klaralvdalens Datakonsult AB (KDAB)
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the QtGui module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-**
-** This file was generated by glgen version 0.1
-** Command line was: glgen
-**
-** glgen is Copyright (C) 2013 Klaralvdalens Datakonsult AB (KDAB)
-**
-** This is an auto-generated file.
-** Do not edit! All changes made to it will be lost.
-**
-****************************************************************************/
-
-#include "qopenglfunctions_1_1.h"
-#include "qopenglcontext.h"
-
-QT_BEGIN_NAMESPACE
-
-/*!
- \class QOpenGLFunctions_1_1
- \inmodule QtGui
- \since 5.1
- \wrapper
- \brief The QOpenGLFunctions_1_1 class provides all functions for OpenGL 1.1 specification.
-
- This class is a wrapper for functions from OpenGL 1.1 specification.
- See reference pages on \l {http://www.opengl.org/sdk/docs/}{opengl.org}
- for function documentation.
-
- \sa QAbstractOpenGLFunctions
-*/
-
-QOpenGLFunctions_1_1::QOpenGLFunctions_1_1()
- : QAbstractOpenGLFunctions()
- , d_1_0_Core(nullptr)
- , d_1_1_Core(nullptr)
- , d_1_0_Deprecated(nullptr)
- , d_1_1_Deprecated(nullptr)
-{
-}
-
-QOpenGLFunctions_1_1::~QOpenGLFunctions_1_1()
-{
- if (d_1_0_Core) {
- d_1_0_Core->refs.deref();
- Q_ASSERT(d_1_0_Core->refs.loadRelaxed());
- }
- if (d_1_1_Core) {
- d_1_1_Core->refs.deref();
- Q_ASSERT(d_1_1_Core->refs.loadRelaxed());
- }
- if (d_1_0_Deprecated) {
- d_1_0_Deprecated->refs.deref();
- Q_ASSERT(d_1_0_Deprecated->refs.loadRelaxed());
- }
- if (d_1_1_Deprecated) {
- d_1_1_Deprecated->refs.deref();
- Q_ASSERT(d_1_1_Deprecated->refs.loadRelaxed());
- }
-}
-
-bool QOpenGLFunctions_1_1::initializeOpenGLFunctions()
-{
- if ( isInitialized() )
- return true;
-
- QOpenGLContext* context = QOpenGLContext::currentContext();
-
- // If owned by a context object make sure it is current.
- // Also check that current context is capable of resolving all needed functions
- if (((owningContext() && owningContext() == context) || !owningContext())
- && QOpenGLFunctions_1_1::isContextCompatible(context))
- {
- // Associate with private implementation, creating if necessary
- // Function pointers in the backends are resolved at creation time
- QOpenGLVersionFunctionsBackend* d = nullptr;
- d = QAbstractOpenGLFunctionsPrivate::functionsBackend(context, QOpenGLFunctions_1_0_CoreBackend::versionStatus());
- d_1_0_Core = static_cast<QOpenGLFunctions_1_0_CoreBackend*>(d);
- d->refs.ref();
-
- d = QAbstractOpenGLFunctionsPrivate::functionsBackend(context, QOpenGLFunctions_1_1_CoreBackend::versionStatus());
- d_1_1_Core = static_cast<QOpenGLFunctions_1_1_CoreBackend*>(d);
- d->refs.ref();
-
- d = QAbstractOpenGLFunctionsPrivate::functionsBackend(context, QOpenGLFunctions_1_0_DeprecatedBackend::versionStatus());
- d_1_0_Deprecated = static_cast<QOpenGLFunctions_1_0_DeprecatedBackend*>(d);
- d->refs.ref();
-
- d = QAbstractOpenGLFunctionsPrivate::functionsBackend(context, QOpenGLFunctions_1_1_DeprecatedBackend::versionStatus());
- d_1_1_Deprecated = static_cast<QOpenGLFunctions_1_1_DeprecatedBackend*>(d);
- d->refs.ref();
-
- QAbstractOpenGLFunctions::initializeOpenGLFunctions();
- }
- return isInitialized();
-}
-
-bool QOpenGLFunctions_1_1::isContextCompatible(QOpenGLContext *context)
-{
- Q_ASSERT(context);
- QSurfaceFormat f = context->format();
- const QPair<int, int> v = qMakePair(f.majorVersion(), f.minorVersion());
- if (v < qMakePair(1, 1))
- return false;
-
- if (f.profile() == QSurfaceFormat::CoreProfile)
- return false;
-
- return true;
-}
-
-QOpenGLVersionProfile QOpenGLFunctions_1_1::versionProfile()
-{
- QOpenGLVersionProfile v;
- v.setVersion(1, 1);
- return v;
-}
-
-QT_END_NAMESPACE
diff --git a/src/gui/opengl/qopenglfunctions_1_1.h b/src/gui/opengl/qopenglfunctions_1_1.h
deleted file mode 100644
index 8a9f16ec4c..0000000000
--- a/src/gui/opengl/qopenglfunctions_1_1.h
+++ /dev/null
@@ -1,2119 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2013 Klaralvdalens Datakonsult AB (KDAB)
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the QtGui module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-**
-** This file was generated by glgen version 0.1
-** Command line was: glgen
-**
-** glgen is Copyright (C) 2013 Klaralvdalens Datakonsult AB (KDAB)
-**
-** This is an auto-generated file.
-** Do not edit! All changes made to it will be lost.
-**
-****************************************************************************/
-
-#ifndef QOPENGLVERSIONFUNCTIONS_1_1_H
-#define QOPENGLVERSIONFUNCTIONS_1_1_H
-
-#include <QtGui/qtguiglobal.h>
-
-#if !defined(QT_NO_OPENGL) && !defined(QT_OPENGL_ES_2)
-
-#include <QtGui/QOpenGLVersionFunctions>
-#include <QtGui/qopenglcontext.h>
-
-QT_BEGIN_NAMESPACE
-
-class Q_GUI_EXPORT QOpenGLFunctions_1_1 : public QAbstractOpenGLFunctions
-{
-public:
- QOpenGLFunctions_1_1();
- ~QOpenGLFunctions_1_1();
-
- bool initializeOpenGLFunctions() override;
-
- // OpenGL 1.0 core functions
- void glViewport(GLint x, GLint y, GLsizei width, GLsizei height);
- void glDepthRange(GLdouble nearVal, GLdouble farVal);
- GLboolean glIsEnabled(GLenum cap);
- void glGetTexLevelParameteriv(GLenum target, GLint level, GLenum pname, GLint *params);
- void glGetTexLevelParameterfv(GLenum target, GLint level, GLenum pname, GLfloat *params);
- void glGetTexParameteriv(GLenum target, GLenum pname, GLint *params);
- void glGetTexParameterfv(GLenum target, GLenum pname, GLfloat *params);
- void glGetTexImage(GLenum target, GLint level, GLenum format, GLenum type, GLvoid *pixels);
- const GLubyte * glGetString(GLenum name);
- void glGetIntegerv(GLenum pname, GLint *params);
- void glGetFloatv(GLenum pname, GLfloat *params);
- GLenum glGetError();
- void glGetDoublev(GLenum pname, GLdouble *params);
- void glGetBooleanv(GLenum pname, GLboolean *params);
- void glReadPixels(GLint x, GLint y, GLsizei width, GLsizei height, GLenum format, GLenum type, GLvoid *pixels);
- void glReadBuffer(GLenum mode);
- void glPixelStorei(GLenum pname, GLint param);
- void glPixelStoref(GLenum pname, GLfloat param);
- void glDepthFunc(GLenum func);
- void glStencilOp(GLenum fail, GLenum zfail, GLenum zpass);
- void glStencilFunc(GLenum func, GLint ref, GLuint mask);
- void glLogicOp(GLenum opcode);
- void glBlendFunc(GLenum sfactor, GLenum dfactor);
- void glFlush();
- void glFinish();
- void glEnable(GLenum cap);
- void glDisable(GLenum cap);
- void glDepthMask(GLboolean flag);
- void glColorMask(GLboolean red, GLboolean green, GLboolean blue, GLboolean alpha);
- void glStencilMask(GLuint mask);
- void glClearDepth(GLdouble depth);
- void glClearStencil(GLint s);
- void glClearColor(GLfloat red, GLfloat green, GLfloat blue, GLfloat alpha);
- void glClear(GLbitfield mask);
- void glDrawBuffer(GLenum mode);
- void glTexImage2D(GLenum target, GLint level, GLint internalformat, GLsizei width, GLsizei height, GLint border, GLenum format, GLenum type, const GLvoid *pixels);
- void glTexImage1D(GLenum target, GLint level, GLint internalformat, GLsizei width, GLint border, GLenum format, GLenum type, const GLvoid *pixels);
- void glTexParameteriv(GLenum target, GLenum pname, const GLint *params);
- void glTexParameteri(GLenum target, GLenum pname, GLint param);
- void glTexParameterfv(GLenum target, GLenum pname, const GLfloat *params);
- void glTexParameterf(GLenum target, GLenum pname, GLfloat param);
- void glScissor(GLint x, GLint y, GLsizei width, GLsizei height);
- void glPolygonMode(GLenum face, GLenum mode);
- void glPointSize(GLfloat size);
- void glLineWidth(GLfloat width);
- void glHint(GLenum target, GLenum mode);
- void glFrontFace(GLenum mode);
- void glCullFace(GLenum mode);
-
- // OpenGL 1.1 core functions
- void glIndexubv(const GLubyte *c);
- void glIndexub(GLubyte c);
- GLboolean glIsTexture(GLuint texture);
- void glGenTextures(GLsizei n, GLuint *textures);
- void glDeleteTextures(GLsizei n, const GLuint *textures);
- void glBindTexture(GLenum target, GLuint texture);
- void glTexSubImage2D(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLenum type, const GLvoid *pixels);
- void glTexSubImage1D(GLenum target, GLint level, GLint xoffset, GLsizei width, GLenum format, GLenum type, const GLvoid *pixels);
- void glCopyTexSubImage2D(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint x, GLint y, GLsizei width, GLsizei height);
- void glCopyTexSubImage1D(GLenum target, GLint level, GLint xoffset, GLint x, GLint y, GLsizei width);
- void glCopyTexImage2D(GLenum target, GLint level, GLenum internalformat, GLint x, GLint y, GLsizei width, GLsizei height, GLint border);
- void glCopyTexImage1D(GLenum target, GLint level, GLenum internalformat, GLint x, GLint y, GLsizei width, GLint border);
- void glPolygonOffset(GLfloat factor, GLfloat units);
- void glGetPointerv(GLenum pname, GLvoid* *params);
- void glDrawElements(GLenum mode, GLsizei count, GLenum type, const GLvoid *indices);
- void glDrawArrays(GLenum mode, GLint first, GLsizei count);
-
- // OpenGL 1.0 deprecated functions
- void glTranslatef(GLfloat x, GLfloat y, GLfloat z);
- void glTranslated(GLdouble x, GLdouble y, GLdouble z);
- void glScalef(GLfloat x, GLfloat y, GLfloat z);
- void glScaled(GLdouble x, GLdouble y, GLdouble z);
- void glRotatef(GLfloat angle, GLfloat x, GLfloat y, GLfloat z);
- void glRotated(GLdouble angle, GLdouble x, GLdouble y, GLdouble z);
- void glPushMatrix();
- void glPopMatrix();
- void glOrtho(GLdouble left, GLdouble right, GLdouble bottom, GLdouble top, GLdouble zNear, GLdouble zFar);
- void glMultMatrixd(const GLdouble *m);
- void glMultMatrixf(const GLfloat *m);
- void glMatrixMode(GLenum mode);
- void glLoadMatrixd(const GLdouble *m);
- void glLoadMatrixf(const GLfloat *m);
- void glLoadIdentity();
- void glFrustum(GLdouble left, GLdouble right, GLdouble bottom, GLdouble top, GLdouble zNear, GLdouble zFar);
- GLboolean glIsList(GLuint list);
- void glGetTexGeniv(GLenum coord, GLenum pname, GLint *params);
- void glGetTexGenfv(GLenum coord, GLenum pname, GLfloat *params);
- void glGetTexGendv(GLenum coord, GLenum pname, GLdouble *params);
- void glGetTexEnviv(GLenum target, GLenum pname, GLint *params);
- void glGetTexEnvfv(GLenum target, GLenum pname, GLfloat *params);
- void glGetPolygonStipple(GLubyte *mask);
- void glGetPixelMapusv(GLenum map, GLushort *values);
- void glGetPixelMapuiv(GLenum map, GLuint *values);
- void glGetPixelMapfv(GLenum map, GLfloat *values);
- void glGetMaterialiv(GLenum face, GLenum pname, GLint *params);
- void glGetMaterialfv(GLenum face, GLenum pname, GLfloat *params);
- void glGetMapiv(GLenum target, GLenum query, GLint *v);
- void glGetMapfv(GLenum target, GLenum query, GLfloat *v);
- void glGetMapdv(GLenum target, GLenum query, GLdouble *v);
- void glGetLightiv(GLenum light, GLenum pname, GLint *params);
- void glGetLightfv(GLenum light, GLenum pname, GLfloat *params);
- void glGetClipPlane(GLenum plane, GLdouble *equation);
- void glDrawPixels(GLsizei width, GLsizei height, GLenum format, GLenum type, const GLvoid *pixels);
- void glCopyPixels(GLint x, GLint y, GLsizei width, GLsizei height, GLenum type);
- void glPixelMapusv(GLenum map, GLint mapsize, const GLushort *values);
- void glPixelMapuiv(GLenum map, GLint mapsize, const GLuint *values);
- void glPixelMapfv(GLenum map, GLint mapsize, const GLfloat *values);
- void glPixelTransferi(GLenum pname, GLint param);
- void glPixelTransferf(GLenum pname, GLfloat param);
- void glPixelZoom(GLfloat xfactor, GLfloat yfactor);
- void glAlphaFunc(GLenum func, GLfloat ref);
- void glEvalPoint2(GLint i, GLint j);
- void glEvalMesh2(GLenum mode, GLint i1, GLint i2, GLint j1, GLint j2);
- void glEvalPoint1(GLint i);
- void glEvalMesh1(GLenum mode, GLint i1, GLint i2);
- void glEvalCoord2fv(const GLfloat *u);
- void glEvalCoord2f(GLfloat u, GLfloat v);
- void glEvalCoord2dv(const GLdouble *u);
- void glEvalCoord2d(GLdouble u, GLdouble v);
- void glEvalCoord1fv(const GLfloat *u);
- void glEvalCoord1f(GLfloat u);
- void glEvalCoord1dv(const GLdouble *u);
- void glEvalCoord1d(GLdouble u);
- void glMapGrid2f(GLint un, GLfloat u1, GLfloat u2, GLint vn, GLfloat v1, GLfloat v2);
- void glMapGrid2d(GLint un, GLdouble u1, GLdouble u2, GLint vn, GLdouble v1, GLdouble v2);
- void glMapGrid1f(GLint un, GLfloat u1, GLfloat u2);
- void glMapGrid1d(GLint un, GLdouble u1, GLdouble u2);
- void glMap2f(GLenum target, GLfloat u1, GLfloat u2, GLint ustride, GLint uorder, GLfloat v1, GLfloat v2, GLint vstride, GLint vorder, const GLfloat *points);
- void glMap2d(GLenum target, GLdouble u1, GLdouble u2, GLint ustride, GLint uorder, GLdouble v1, GLdouble v2, GLint vstride, GLint vorder, const GLdouble *points);
- void glMap1f(GLenum target, GLfloat u1, GLfloat u2, GLint stride, GLint order, const GLfloat *points);
- void glMap1d(GLenum target, GLdouble u1, GLdouble u2, GLint stride, GLint order, const GLdouble *points);
- void glPushAttrib(GLbitfield mask);
- void glPopAttrib();
- void glAccum(GLenum op, GLfloat value);
- void glIndexMask(GLuint mask);
- void glClearIndex(GLfloat c);
- void glClearAccum(GLfloat red, GLfloat green, GLfloat blue, GLfloat alpha);
- void glPushName(GLuint name);
- void glPopName();
- void glPassThrough(GLfloat token);
- void glLoadName(GLuint name);
- void glInitNames();
- GLint glRenderMode(GLenum mode);
- void glSelectBuffer(GLsizei size, GLuint *buffer);
- void glFeedbackBuffer(GLsizei size, GLenum type, GLfloat *buffer);
- void glTexGeniv(GLenum coord, GLenum pname, const GLint *params);
- void glTexGeni(GLenum coord, GLenum pname, GLint param);
- void glTexGenfv(GLenum coord, GLenum pname, const GLfloat *params);
- void glTexGenf(GLenum coord, GLenum pname, GLfloat param);
- void glTexGendv(GLenum coord, GLenum pname, const GLdouble *params);
- void glTexGend(GLenum coord, GLenum pname, GLdouble param);
- void glTexEnviv(GLenum target, GLenum pname, const GLint *params);
- void glTexEnvi(GLenum target, GLenum pname, GLint param);
- void glTexEnvfv(GLenum target, GLenum pname, const GLfloat *params);
- void glTexEnvf(GLenum target, GLenum pname, GLfloat param);
- void glShadeModel(GLenum mode);
- void glPolygonStipple(const GLubyte *mask);
- void glMaterialiv(GLenum face, GLenum pname, const GLint *params);
- void glMateriali(GLenum face, GLenum pname, GLint param);
- void glMaterialfv(GLenum face, GLenum pname, const GLfloat *params);
- void glMaterialf(GLenum face, GLenum pname, GLfloat param);
- void glLineStipple(GLint factor, GLushort pattern);
- void glLightModeliv(GLenum pname, const GLint *params);
- void glLightModeli(GLenum pname, GLint param);
- void glLightModelfv(GLenum pname, const GLfloat *params);
- void glLightModelf(GLenum pname, GLfloat param);
- void glLightiv(GLenum light, GLenum pname, const GLint *params);
- void glLighti(GLenum light, GLenum pname, GLint param);
- void glLightfv(GLenum light, GLenum pname, const GLfloat *params);
- void glLightf(GLenum light, GLenum pname, GLfloat param);
- void glFogiv(GLenum pname, const GLint *params);
- void glFogi(GLenum pname, GLint param);
- void glFogfv(GLenum pname, const GLfloat *params);
- void glFogf(GLenum pname, GLfloat param);
- void glColorMaterial(GLenum face, GLenum mode);
- void glClipPlane(GLenum plane, const GLdouble *equation);
- void glVertex4sv(const GLshort *v);
- void glVertex4s(GLshort x, GLshort y, GLshort z, GLshort w);
- void glVertex4iv(const GLint *v);
- void glVertex4i(GLint x, GLint y, GLint z, GLint w);
- void glVertex4fv(const GLfloat *v);
- void glVertex4f(GLfloat x, GLfloat y, GLfloat z, GLfloat w);
- void glVertex4dv(const GLdouble *v);
- void glVertex4d(GLdouble x, GLdouble y, GLdouble z, GLdouble w);
- void glVertex3sv(const GLshort *v);
- void glVertex3s(GLshort x, GLshort y, GLshort z);
- void glVertex3iv(const GLint *v);
- void glVertex3i(GLint x, GLint y, GLint z);
- void glVertex3fv(const GLfloat *v);
- void glVertex3f(GLfloat x, GLfloat y, GLfloat z);
- void glVertex3dv(const GLdouble *v);
- void glVertex3d(GLdouble x, GLdouble y, GLdouble z);
- void glVertex2sv(const GLshort *v);
- void glVertex2s(GLshort x, GLshort y);
- void glVertex2iv(const GLint *v);
- void glVertex2i(GLint x, GLint y);
- void glVertex2fv(const GLfloat *v);
- void glVertex2f(GLfloat x, GLfloat y);
- void glVertex2dv(const GLdouble *v);
- void glVertex2d(GLdouble x, GLdouble y);
- void glTexCoord4sv(const GLshort *v);
- void glTexCoord4s(GLshort s, GLshort t, GLshort r, GLshort q);
- void glTexCoord4iv(const GLint *v);
- void glTexCoord4i(GLint s, GLint t, GLint r, GLint q);
- void glTexCoord4fv(const GLfloat *v);
- void glTexCoord4f(GLfloat s, GLfloat t, GLfloat r, GLfloat q);
- void glTexCoord4dv(const GLdouble *v);
- void glTexCoord4d(GLdouble s, GLdouble t, GLdouble r, GLdouble q);
- void glTexCoord3sv(const GLshort *v);
- void glTexCoord3s(GLshort s, GLshort t, GLshort r);
- void glTexCoord3iv(const GLint *v);
- void glTexCoord3i(GLint s, GLint t, GLint r);
- void glTexCoord3fv(const GLfloat *v);
- void glTexCoord3f(GLfloat s, GLfloat t, GLfloat r);
- void glTexCoord3dv(const GLdouble *v);
- void glTexCoord3d(GLdouble s, GLdouble t, GLdouble r);
- void glTexCoord2sv(const GLshort *v);
- void glTexCoord2s(GLshort s, GLshort t);
- void glTexCoord2iv(const GLint *v);
- void glTexCoord2i(GLint s, GLint t);
- void glTexCoord2fv(const GLfloat *v);
- void glTexCoord2f(GLfloat s, GLfloat t);
- void glTexCoord2dv(const GLdouble *v);
- void glTexCoord2d(GLdouble s, GLdouble t);
- void glTexCoord1sv(const GLshort *v);
- void glTexCoord1s(GLshort s);
- void glTexCoord1iv(const GLint *v);
- void glTexCoord1i(GLint s);
- void glTexCoord1fv(const GLfloat *v);
- void glTexCoord1f(GLfloat s);
- void glTexCoord1dv(const GLdouble *v);
- void glTexCoord1d(GLdouble s);
- void glRectsv(const GLshort *v1, const GLshort *v2);
- void glRects(GLshort x1, GLshort y1, GLshort x2, GLshort y2);
- void glRectiv(const GLint *v1, const GLint *v2);
- void glRecti(GLint x1, GLint y1, GLint x2, GLint y2);
- void glRectfv(const GLfloat *v1, const GLfloat *v2);
- void glRectf(GLfloat x1, GLfloat y1, GLfloat x2, GLfloat y2);
- void glRectdv(const GLdouble *v1, const GLdouble *v2);
- void glRectd(GLdouble x1, GLdouble y1, GLdouble x2, GLdouble y2);
- void glRasterPos4sv(const GLshort *v);
- void glRasterPos4s(GLshort x, GLshort y, GLshort z, GLshort w);
- void glRasterPos4iv(const GLint *v);
- void glRasterPos4i(GLint x, GLint y, GLint z, GLint w);
- void glRasterPos4fv(const GLfloat *v);
- void glRasterPos4f(GLfloat x, GLfloat y, GLfloat z, GLfloat w);
- void glRasterPos4dv(const GLdouble *v);
- void glRasterPos4d(GLdouble x, GLdouble y, GLdouble z, GLdouble w);
- void glRasterPos3sv(const GLshort *v);
- void glRasterPos3s(GLshort x, GLshort y, GLshort z);
- void glRasterPos3iv(const GLint *v);
- void glRasterPos3i(GLint x, GLint y, GLint z);
- void glRasterPos3fv(const GLfloat *v);
- void glRasterPos3f(GLfloat x, GLfloat y, GLfloat z);
- void glRasterPos3dv(const GLdouble *v);
- void glRasterPos3d(GLdouble x, GLdouble y, GLdouble z);
- void glRasterPos2sv(const GLshort *v);
- void glRasterPos2s(GLshort x, GLshort y);
- void glRasterPos2iv(const GLint *v);
- void glRasterPos2i(GLint x, GLint y);
- void glRasterPos2fv(const GLfloat *v);
- void glRasterPos2f(GLfloat x, GLfloat y);
- void glRasterPos2dv(const GLdouble *v);
- void glRasterPos2d(GLdouble x, GLdouble y);
- void glNormal3sv(const GLshort *v);
- void glNormal3s(GLshort nx, GLshort ny, GLshort nz);
- void glNormal3iv(const GLint *v);
- void glNormal3i(GLint nx, GLint ny, GLint nz);
- void glNormal3fv(const GLfloat *v);
- void glNormal3f(GLfloat nx, GLfloat ny, GLfloat nz);
- void glNormal3dv(const GLdouble *v);
- void glNormal3d(GLdouble nx, GLdouble ny, GLdouble nz);
- void glNormal3bv(const GLbyte *v);
- void glNormal3b(GLbyte nx, GLbyte ny, GLbyte nz);
- void glIndexsv(const GLshort *c);
- void glIndexs(GLshort c);
- void glIndexiv(const GLint *c);
- void glIndexi(GLint c);
- void glIndexfv(const GLfloat *c);
- void glIndexf(GLfloat c);
- void glIndexdv(const GLdouble *c);
- void glIndexd(GLdouble c);
- void glEnd();
- void glEdgeFlagv(const GLboolean *flag);
- void glEdgeFlag(GLboolean flag);
- void glColor4usv(const GLushort *v);
- void glColor4us(GLushort red, GLushort green, GLushort blue, GLushort alpha);
- void glColor4uiv(const GLuint *v);
- void glColor4ui(GLuint red, GLuint green, GLuint blue, GLuint alpha);
- void glColor4ubv(const GLubyte *v);
- void glColor4ub(GLubyte red, GLubyte green, GLubyte blue, GLubyte alpha);
- void glColor4sv(const GLshort *v);
- void glColor4s(GLshort red, GLshort green, GLshort blue, GLshort alpha);
- void glColor4iv(const GLint *v);
- void glColor4i(GLint red, GLint green, GLint blue, GLint alpha);
- void glColor4fv(const GLfloat *v);
- void glColor4f(GLfloat red, GLfloat green, GLfloat blue, GLfloat alpha);
- void glColor4dv(const GLdouble *v);
- void glColor4d(GLdouble red, GLdouble green, GLdouble blue, GLdouble alpha);
- void glColor4bv(const GLbyte *v);
- void glColor4b(GLbyte red, GLbyte green, GLbyte blue, GLbyte alpha);
- void glColor3usv(const GLushort *v);
- void glColor3us(GLushort red, GLushort green, GLushort blue);
- void glColor3uiv(const GLuint *v);
- void glColor3ui(GLuint red, GLuint green, GLuint blue);
- void glColor3ubv(const GLubyte *v);
- void glColor3ub(GLubyte red, GLubyte green, GLubyte blue);
- void glColor3sv(const GLshort *v);
- void glColor3s(GLshort red, GLshort green, GLshort blue);
- void glColor3iv(const GLint *v);
- void glColor3i(GLint red, GLint green, GLint blue);
- void glColor3fv(const GLfloat *v);
- void glColor3f(GLfloat red, GLfloat green, GLfloat blue);
- void glColor3dv(const GLdouble *v);
- void glColor3d(GLdouble red, GLdouble green, GLdouble blue);
- void glColor3bv(const GLbyte *v);
- void glColor3b(GLbyte red, GLbyte green, GLbyte blue);
- void glBitmap(GLsizei width, GLsizei height, GLfloat xorig, GLfloat yorig, GLfloat xmove, GLfloat ymove, const GLubyte *bitmap);
- void glBegin(GLenum mode);
- void glListBase(GLuint base);
- GLuint glGenLists(GLsizei range);
- void glDeleteLists(GLuint list, GLsizei range);
- void glCallLists(GLsizei n, GLenum type, const GLvoid *lists);
- void glCallList(GLuint list);
- void glEndList();
- void glNewList(GLuint list, GLenum mode);
-
- // OpenGL 1.1 deprecated functions
- void glPushClientAttrib(GLbitfield mask);
- void glPopClientAttrib();
- void glPrioritizeTextures(GLsizei n, const GLuint *textures, const GLfloat *priorities);
- GLboolean glAreTexturesResident(GLsizei n, const GLuint *textures, GLboolean *residences);
- void glVertexPointer(GLint size, GLenum type, GLsizei stride, const GLvoid *pointer);
- void glTexCoordPointer(GLint size, GLenum type, GLsizei stride, const GLvoid *pointer);
- void glNormalPointer(GLenum type, GLsizei stride, const GLvoid *pointer);
- void glInterleavedArrays(GLenum format, GLsizei stride, const GLvoid *pointer);
- void glIndexPointer(GLenum type, GLsizei stride, const GLvoid *pointer);
- void glEnableClientState(GLenum array);
- void glEdgeFlagPointer(GLsizei stride, const GLvoid *pointer);
- void glDisableClientState(GLenum array);
- void glColorPointer(GLint size, GLenum type, GLsizei stride, const GLvoid *pointer);
- void glArrayElement(GLint i);
-
-private:
- friend class QOpenGLContext;
-
- static bool isContextCompatible(QOpenGLContext *context);
- static QOpenGLVersionProfile versionProfile();
-
- QOpenGLFunctions_1_0_CoreBackend* d_1_0_Core;
- QOpenGLFunctions_1_1_CoreBackend* d_1_1_Core;
- QOpenGLFunctions_1_0_DeprecatedBackend* d_1_0_Deprecated;
- QOpenGLFunctions_1_1_DeprecatedBackend* d_1_1_Deprecated;
-};
-
-// OpenGL 1.0 core functions
-inline void QOpenGLFunctions_1_1::glViewport(GLint x, GLint y, GLsizei width, GLsizei height)
-{
- d_1_0_Core->f.Viewport(x, y, width, height);
-}
-
-inline void QOpenGLFunctions_1_1::glDepthRange(GLdouble nearVal, GLdouble farVal)
-{
- d_1_0_Core->f.DepthRange(nearVal, farVal);
-}
-
-inline GLboolean QOpenGLFunctions_1_1::glIsEnabled(GLenum cap)
-{
- return d_1_0_Core->f.IsEnabled(cap);
-}
-
-inline void QOpenGLFunctions_1_1::glGetTexLevelParameteriv(GLenum target, GLint level, GLenum pname, GLint *params)
-{
- d_1_0_Core->f.GetTexLevelParameteriv(target, level, pname, params);
-}
-
-inline void QOpenGLFunctions_1_1::glGetTexLevelParameterfv(GLenum target, GLint level, GLenum pname, GLfloat *params)
-{
- d_1_0_Core->f.GetTexLevelParameterfv(target, level, pname, params);
-}
-
-inline void QOpenGLFunctions_1_1::glGetTexParameteriv(GLenum target, GLenum pname, GLint *params)
-{
- d_1_0_Core->f.GetTexParameteriv(target, pname, params);
-}
-
-inline void QOpenGLFunctions_1_1::glGetTexParameterfv(GLenum target, GLenum pname, GLfloat *params)
-{
- d_1_0_Core->f.GetTexParameterfv(target, pname, params);
-}
-
-inline void QOpenGLFunctions_1_1::glGetTexImage(GLenum target, GLint level, GLenum format, GLenum type, GLvoid *pixels)
-{
- d_1_0_Core->f.GetTexImage(target, level, format, type, pixels);
-}
-
-inline const GLubyte * QOpenGLFunctions_1_1::glGetString(GLenum name)
-{
- return d_1_0_Core->f.GetString(name);
-}
-
-inline void QOpenGLFunctions_1_1::glGetIntegerv(GLenum pname, GLint *params)
-{
- d_1_0_Core->f.GetIntegerv(pname, params);
-}
-
-inline void QOpenGLFunctions_1_1::glGetFloatv(GLenum pname, GLfloat *params)
-{
- d_1_0_Core->f.GetFloatv(pname, params);
-}
-
-inline GLenum QOpenGLFunctions_1_1::glGetError()
-{
- return d_1_0_Core->f.GetError();
-}
-
-inline void QOpenGLFunctions_1_1::glGetDoublev(GLenum pname, GLdouble *params)
-{
- d_1_0_Core->f.GetDoublev(pname, params);
-}
-
-inline void QOpenGLFunctions_1_1::glGetBooleanv(GLenum pname, GLboolean *params)
-{
- d_1_0_Core->f.GetBooleanv(pname, params);
-}
-
-inline void QOpenGLFunctions_1_1::glReadPixels(GLint x, GLint y, GLsizei width, GLsizei height, GLenum format, GLenum type, GLvoid *pixels)
-{
- d_1_0_Core->f.ReadPixels(x, y, width, height, format, type, pixels);
-}
-
-inline void QOpenGLFunctions_1_1::glReadBuffer(GLenum mode)
-{
- d_1_0_Core->f.ReadBuffer(mode);
-}
-
-inline void QOpenGLFunctions_1_1::glPixelStorei(GLenum pname, GLint param)
-{
- d_1_0_Core->f.PixelStorei(pname, param);
-}
-
-inline void QOpenGLFunctions_1_1::glPixelStoref(GLenum pname, GLfloat param)
-{
- d_1_0_Core->f.PixelStoref(pname, param);
-}
-
-inline void QOpenGLFunctions_1_1::glDepthFunc(GLenum func)
-{
- d_1_0_Core->f.DepthFunc(func);
-}
-
-inline void QOpenGLFunctions_1_1::glStencilOp(GLenum fail, GLenum zfail, GLenum zpass)
-{
- d_1_0_Core->f.StencilOp(fail, zfail, zpass);
-}
-
-inline void QOpenGLFunctions_1_1::glStencilFunc(GLenum func, GLint ref, GLuint mask)
-{
- d_1_0_Core->f.StencilFunc(func, ref, mask);
-}
-
-inline void QOpenGLFunctions_1_1::glLogicOp(GLenum opcode)
-{
- d_1_0_Core->f.LogicOp(opcode);
-}
-
-inline void QOpenGLFunctions_1_1::glBlendFunc(GLenum sfactor, GLenum dfactor)
-{
- d_1_0_Core->f.BlendFunc(sfactor, dfactor);
-}
-
-inline void QOpenGLFunctions_1_1::glFlush()
-{
- d_1_0_Core->f.Flush();
-}
-
-inline void QOpenGLFunctions_1_1::glFinish()
-{
- d_1_0_Core->f.Finish();
-}
-
-inline void QOpenGLFunctions_1_1::glEnable(GLenum cap)
-{
- d_1_0_Core->f.Enable(cap);
-}
-
-inline void QOpenGLFunctions_1_1::glDisable(GLenum cap)
-{
- d_1_0_Core->f.Disable(cap);
-}
-
-inline void QOpenGLFunctions_1_1::glDepthMask(GLboolean flag)
-{
- d_1_0_Core->f.DepthMask(flag);
-}
-
-inline void QOpenGLFunctions_1_1::glColorMask(GLboolean red, GLboolean green, GLboolean blue, GLboolean alpha)
-{
- d_1_0_Core->f.ColorMask(red, green, blue, alpha);
-}
-
-inline void QOpenGLFunctions_1_1::glStencilMask(GLuint mask)
-{
- d_1_0_Core->f.StencilMask(mask);
-}
-
-inline void QOpenGLFunctions_1_1::glClearDepth(GLdouble depth)
-{
- d_1_0_Core->f.ClearDepth(depth);
-}
-
-inline void QOpenGLFunctions_1_1::glClearStencil(GLint s)
-{
- d_1_0_Core->f.ClearStencil(s);
-}
-
-inline void QOpenGLFunctions_1_1::glClearColor(GLfloat red, GLfloat green, GLfloat blue, GLfloat alpha)
-{
- d_1_0_Core->f.ClearColor(red, green, blue, alpha);
-}
-
-inline void QOpenGLFunctions_1_1::glClear(GLbitfield mask)
-{
- d_1_0_Core->f.Clear(mask);
-}
-
-inline void QOpenGLFunctions_1_1::glDrawBuffer(GLenum mode)
-{
- d_1_0_Core->f.DrawBuffer(mode);
-}
-
-inline void QOpenGLFunctions_1_1::glTexImage2D(GLenum target, GLint level, GLint internalformat, GLsizei width, GLsizei height, GLint border, GLenum format, GLenum type, const GLvoid *pixels)
-{
- d_1_0_Core->f.TexImage2D(target, level, internalformat, width, height, border, format, type, pixels);
-}
-
-inline void QOpenGLFunctions_1_1::glTexImage1D(GLenum target, GLint level, GLint internalformat, GLsizei width, GLint border, GLenum format, GLenum type, const GLvoid *pixels)
-{
- d_1_0_Core->f.TexImage1D(target, level, internalformat, width, border, format, type, pixels);
-}
-
-inline void QOpenGLFunctions_1_1::glTexParameteriv(GLenum target, GLenum pname, const GLint *params)
-{
- d_1_0_Core->f.TexParameteriv(target, pname, params);
-}
-
-inline void QOpenGLFunctions_1_1::glTexParameteri(GLenum target, GLenum pname, GLint param)
-{
- d_1_0_Core->f.TexParameteri(target, pname, param);
-}
-
-inline void QOpenGLFunctions_1_1::glTexParameterfv(GLenum target, GLenum pname, const GLfloat *params)
-{
- d_1_0_Core->f.TexParameterfv(target, pname, params);
-}
-
-inline void QOpenGLFunctions_1_1::glTexParameterf(GLenum target, GLenum pname, GLfloat param)
-{
- d_1_0_Core->f.TexParameterf(target, pname, param);
-}
-
-inline void QOpenGLFunctions_1_1::glScissor(GLint x, GLint y, GLsizei width, GLsizei height)
-{
- d_1_0_Core->f.Scissor(x, y, width, height);
-}
-
-inline void QOpenGLFunctions_1_1::glPolygonMode(GLenum face, GLenum mode)
-{
- d_1_0_Core->f.PolygonMode(face, mode);
-}
-
-inline void QOpenGLFunctions_1_1::glPointSize(GLfloat size)
-{
- d_1_0_Core->f.PointSize(size);
-}
-
-inline void QOpenGLFunctions_1_1::glLineWidth(GLfloat width)
-{
- d_1_0_Core->f.LineWidth(width);
-}
-
-inline void QOpenGLFunctions_1_1::glHint(GLenum target, GLenum mode)
-{
- d_1_0_Core->f.Hint(target, mode);
-}
-
-inline void QOpenGLFunctions_1_1::glFrontFace(GLenum mode)
-{
- d_1_0_Core->f.FrontFace(mode);
-}
-
-inline void QOpenGLFunctions_1_1::glCullFace(GLenum mode)
-{
- d_1_0_Core->f.CullFace(mode);
-}
-
-
-// OpenGL 1.1 core functions
-inline void QOpenGLFunctions_1_1::glIndexubv(const GLubyte *c)
-{
- d_1_1_Deprecated->f.Indexubv(c);
-}
-
-inline void QOpenGLFunctions_1_1::glIndexub(GLubyte c)
-{
- d_1_1_Deprecated->f.Indexub(c);
-}
-
-inline GLboolean QOpenGLFunctions_1_1::glIsTexture(GLuint texture)
-{
- return d_1_1_Core->f.IsTexture(texture);
-}
-
-inline void QOpenGLFunctions_1_1::glGenTextures(GLsizei n, GLuint *textures)
-{
- d_1_1_Core->f.GenTextures(n, textures);
-}
-
-inline void QOpenGLFunctions_1_1::glDeleteTextures(GLsizei n, const GLuint *textures)
-{
- d_1_1_Core->f.DeleteTextures(n, textures);
-}
-
-inline void QOpenGLFunctions_1_1::glBindTexture(GLenum target, GLuint texture)
-{
- d_1_1_Core->f.BindTexture(target, texture);
-}
-
-inline void QOpenGLFunctions_1_1::glTexSubImage2D(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLenum type, const GLvoid *pixels)
-{
- d_1_1_Core->f.TexSubImage2D(target, level, xoffset, yoffset, width, height, format, type, pixels);
-}
-
-inline void QOpenGLFunctions_1_1::glTexSubImage1D(GLenum target, GLint level, GLint xoffset, GLsizei width, GLenum format, GLenum type, const GLvoid *pixels)
-{
- d_1_1_Core->f.TexSubImage1D(target, level, xoffset, width, format, type, pixels);
-}
-
-inline void QOpenGLFunctions_1_1::glCopyTexSubImage2D(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint x, GLint y, GLsizei width, GLsizei height)
-{
- d_1_1_Core->f.CopyTexSubImage2D(target, level, xoffset, yoffset, x, y, width, height);
-}
-
-inline void QOpenGLFunctions_1_1::glCopyTexSubImage1D(GLenum target, GLint level, GLint xoffset, GLint x, GLint y, GLsizei width)
-{
- d_1_1_Core->f.CopyTexSubImage1D(target, level, xoffset, x, y, width);
-}
-
-inline void QOpenGLFunctions_1_1::glCopyTexImage2D(GLenum target, GLint level, GLenum internalformat, GLint x, GLint y, GLsizei width, GLsizei height, GLint border)
-{
- d_1_1_Core->f.CopyTexImage2D(target, level, internalformat, x, y, width, height, border);
-}
-
-inline void QOpenGLFunctions_1_1::glCopyTexImage1D(GLenum target, GLint level, GLenum internalformat, GLint x, GLint y, GLsizei width, GLint border)
-{
- d_1_1_Core->f.CopyTexImage1D(target, level, internalformat, x, y, width, border);
-}
-
-inline void QOpenGLFunctions_1_1::glPolygonOffset(GLfloat factor, GLfloat units)
-{
- d_1_1_Core->f.PolygonOffset(factor, units);
-}
-
-inline void QOpenGLFunctions_1_1::glGetPointerv(GLenum pname, GLvoid* *params)
-{
- d_1_1_Deprecated->f.GetPointerv(pname, params);
-}
-
-inline void QOpenGLFunctions_1_1::glDrawElements(GLenum mode, GLsizei count, GLenum type, const GLvoid *indices)
-{
- d_1_1_Core->f.DrawElements(mode, count, type, indices);
-}
-
-inline void QOpenGLFunctions_1_1::glDrawArrays(GLenum mode, GLint first, GLsizei count)
-{
- d_1_1_Core->f.DrawArrays(mode, first, count);
-}
-
-
-// OpenGL 1.0 deprecated functions
-inline void QOpenGLFunctions_1_1::glTranslatef(GLfloat x, GLfloat y, GLfloat z)
-{
- d_1_0_Deprecated->f.Translatef(x, y, z);
-}
-
-inline void QOpenGLFunctions_1_1::glTranslated(GLdouble x, GLdouble y, GLdouble z)
-{
- d_1_0_Deprecated->f.Translated(x, y, z);
-}
-
-inline void QOpenGLFunctions_1_1::glScalef(GLfloat x, GLfloat y, GLfloat z)
-{
- d_1_0_Deprecated->f.Scalef(x, y, z);
-}
-
-inline void QOpenGLFunctions_1_1::glScaled(GLdouble x, GLdouble y, GLdouble z)
-{
- d_1_0_Deprecated->f.Scaled(x, y, z);
-}
-
-inline void QOpenGLFunctions_1_1::glRotatef(GLfloat angle, GLfloat x, GLfloat y, GLfloat z)
-{
- d_1_0_Deprecated->f.Rotatef(angle, x, y, z);
-}
-
-inline void QOpenGLFunctions_1_1::glRotated(GLdouble angle, GLdouble x, GLdouble y, GLdouble z)
-{
- d_1_0_Deprecated->f.Rotated(angle, x, y, z);
-}
-
-inline void QOpenGLFunctions_1_1::glPushMatrix()
-{
- d_1_0_Deprecated->f.PushMatrix();
-}
-
-inline void QOpenGLFunctions_1_1::glPopMatrix()
-{
- d_1_0_Deprecated->f.PopMatrix();
-}
-
-inline void QOpenGLFunctions_1_1::glOrtho(GLdouble left, GLdouble right, GLdouble bottom, GLdouble top, GLdouble zNear, GLdouble zFar)
-{
- d_1_0_Deprecated->f.Ortho(left, right, bottom, top, zNear, zFar);
-}
-
-inline void QOpenGLFunctions_1_1::glMultMatrixd(const GLdouble *m)
-{
- d_1_0_Deprecated->f.MultMatrixd(m);
-}
-
-inline void QOpenGLFunctions_1_1::glMultMatrixf(const GLfloat *m)
-{
- d_1_0_Deprecated->f.MultMatrixf(m);
-}
-
-inline void QOpenGLFunctions_1_1::glMatrixMode(GLenum mode)
-{
- d_1_0_Deprecated->f.MatrixMode(mode);
-}
-
-inline void QOpenGLFunctions_1_1::glLoadMatrixd(const GLdouble *m)
-{
- d_1_0_Deprecated->f.LoadMatrixd(m);
-}
-
-inline void QOpenGLFunctions_1_1::glLoadMatrixf(const GLfloat *m)
-{
- d_1_0_Deprecated->f.LoadMatrixf(m);
-}
-
-inline void QOpenGLFunctions_1_1::glLoadIdentity()
-{
- d_1_0_Deprecated->f.LoadIdentity();
-}
-
-inline void QOpenGLFunctions_1_1::glFrustum(GLdouble left, GLdouble right, GLdouble bottom, GLdouble top, GLdouble zNear, GLdouble zFar)
-{
- d_1_0_Deprecated->f.Frustum(left, right, bottom, top, zNear, zFar);
-}
-
-inline GLboolean QOpenGLFunctions_1_1::glIsList(GLuint list)
-{
- return d_1_0_Deprecated->f.IsList(list);
-}
-
-inline void QOpenGLFunctions_1_1::glGetTexGeniv(GLenum coord, GLenum pname, GLint *params)
-{
- d_1_0_Deprecated->f.GetTexGeniv(coord, pname, params);
-}
-
-inline void QOpenGLFunctions_1_1::glGetTexGenfv(GLenum coord, GLenum pname, GLfloat *params)
-{
- d_1_0_Deprecated->f.GetTexGenfv(coord, pname, params);
-}
-
-inline void QOpenGLFunctions_1_1::glGetTexGendv(GLenum coord, GLenum pname, GLdouble *params)
-{
- d_1_0_Deprecated->f.GetTexGendv(coord, pname, params);
-}
-
-inline void QOpenGLFunctions_1_1::glGetTexEnviv(GLenum target, GLenum pname, GLint *params)
-{
- d_1_0_Deprecated->f.GetTexEnviv(target, pname, params);
-}
-
-inline void QOpenGLFunctions_1_1::glGetTexEnvfv(GLenum target, GLenum pname, GLfloat *params)
-{
- d_1_0_Deprecated->f.GetTexEnvfv(target, pname, params);
-}
-
-inline void QOpenGLFunctions_1_1::glGetPolygonStipple(GLubyte *mask)
-{
- d_1_0_Deprecated->f.GetPolygonStipple(mask);
-}
-
-inline void QOpenGLFunctions_1_1::glGetPixelMapusv(GLenum map, GLushort *values)
-{
- d_1_0_Deprecated->f.GetPixelMapusv(map, values);
-}
-
-inline void QOpenGLFunctions_1_1::glGetPixelMapuiv(GLenum map, GLuint *values)
-{
- d_1_0_Deprecated->f.GetPixelMapuiv(map, values);
-}
-
-inline void QOpenGLFunctions_1_1::glGetPixelMapfv(GLenum map, GLfloat *values)
-{
- d_1_0_Deprecated->f.GetPixelMapfv(map, values);
-}
-
-inline void QOpenGLFunctions_1_1::glGetMaterialiv(GLenum face, GLenum pname, GLint *params)
-{
- d_1_0_Deprecated->f.GetMaterialiv(face, pname, params);
-}
-
-inline void QOpenGLFunctions_1_1::glGetMaterialfv(GLenum face, GLenum pname, GLfloat *params)
-{
- d_1_0_Deprecated->f.GetMaterialfv(face, pname, params);
-}
-
-inline void QOpenGLFunctions_1_1::glGetMapiv(GLenum target, GLenum query, GLint *v)
-{
- d_1_0_Deprecated->f.GetMapiv(target, query, v);
-}
-
-inline void QOpenGLFunctions_1_1::glGetMapfv(GLenum target, GLenum query, GLfloat *v)
-{
- d_1_0_Deprecated->f.GetMapfv(target, query, v);
-}
-
-inline void QOpenGLFunctions_1_1::glGetMapdv(GLenum target, GLenum query, GLdouble *v)
-{
- d_1_0_Deprecated->f.GetMapdv(target, query, v);
-}
-
-inline void QOpenGLFunctions_1_1::glGetLightiv(GLenum light, GLenum pname, GLint *params)
-{
- d_1_0_Deprecated->f.GetLightiv(light, pname, params);
-}
-
-inline void QOpenGLFunctions_1_1::glGetLightfv(GLenum light, GLenum pname, GLfloat *params)
-{
- d_1_0_Deprecated->f.GetLightfv(light, pname, params);
-}
-
-inline void QOpenGLFunctions_1_1::glGetClipPlane(GLenum plane, GLdouble *equation)
-{
- d_1_0_Deprecated->f.GetClipPlane(plane, equation);
-}
-
-inline void QOpenGLFunctions_1_1::glDrawPixels(GLsizei width, GLsizei height, GLenum format, GLenum type, const GLvoid *pixels)
-{
- d_1_0_Deprecated->f.DrawPixels(width, height, format, type, pixels);
-}
-
-inline void QOpenGLFunctions_1_1::glCopyPixels(GLint x, GLint y, GLsizei width, GLsizei height, GLenum type)
-{
- d_1_0_Deprecated->f.CopyPixels(x, y, width, height, type);
-}
-
-inline void QOpenGLFunctions_1_1::glPixelMapusv(GLenum map, GLint mapsize, const GLushort *values)
-{
- d_1_0_Deprecated->f.PixelMapusv(map, mapsize, values);
-}
-
-inline void QOpenGLFunctions_1_1::glPixelMapuiv(GLenum map, GLint mapsize, const GLuint *values)
-{
- d_1_0_Deprecated->f.PixelMapuiv(map, mapsize, values);
-}
-
-inline void QOpenGLFunctions_1_1::glPixelMapfv(GLenum map, GLint mapsize, const GLfloat *values)
-{
- d_1_0_Deprecated->f.PixelMapfv(map, mapsize, values);
-}
-
-inline void QOpenGLFunctions_1_1::glPixelTransferi(GLenum pname, GLint param)
-{
- d_1_0_Deprecated->f.PixelTransferi(pname, param);
-}
-
-inline void QOpenGLFunctions_1_1::glPixelTransferf(GLenum pname, GLfloat param)
-{
- d_1_0_Deprecated->f.PixelTransferf(pname, param);
-}
-
-inline void QOpenGLFunctions_1_1::glPixelZoom(GLfloat xfactor, GLfloat yfactor)
-{
- d_1_0_Deprecated->f.PixelZoom(xfactor, yfactor);
-}
-
-inline void QOpenGLFunctions_1_1::glAlphaFunc(GLenum func, GLfloat ref)
-{
- d_1_0_Deprecated->f.AlphaFunc(func, ref);
-}
-
-inline void QOpenGLFunctions_1_1::glEvalPoint2(GLint i, GLint j)
-{
- d_1_0_Deprecated->f.EvalPoint2(i, j);
-}
-
-inline void QOpenGLFunctions_1_1::glEvalMesh2(GLenum mode, GLint i1, GLint i2, GLint j1, GLint j2)
-{
- d_1_0_Deprecated->f.EvalMesh2(mode, i1, i2, j1, j2);
-}
-
-inline void QOpenGLFunctions_1_1::glEvalPoint1(GLint i)
-{
- d_1_0_Deprecated->f.EvalPoint1(i);
-}
-
-inline void QOpenGLFunctions_1_1::glEvalMesh1(GLenum mode, GLint i1, GLint i2)
-{
- d_1_0_Deprecated->f.EvalMesh1(mode, i1, i2);
-}
-
-inline void QOpenGLFunctions_1_1::glEvalCoord2fv(const GLfloat *u)
-{
- d_1_0_Deprecated->f.EvalCoord2fv(u);
-}
-
-inline void QOpenGLFunctions_1_1::glEvalCoord2f(GLfloat u, GLfloat v)
-{
- d_1_0_Deprecated->f.EvalCoord2f(u, v);
-}
-
-inline void QOpenGLFunctions_1_1::glEvalCoord2dv(const GLdouble *u)
-{
- d_1_0_Deprecated->f.EvalCoord2dv(u);
-}
-
-inline void QOpenGLFunctions_1_1::glEvalCoord2d(GLdouble u, GLdouble v)
-{
- d_1_0_Deprecated->f.EvalCoord2d(u, v);
-}
-
-inline void QOpenGLFunctions_1_1::glEvalCoord1fv(const GLfloat *u)
-{
- d_1_0_Deprecated->f.EvalCoord1fv(u);
-}
-
-inline void QOpenGLFunctions_1_1::glEvalCoord1f(GLfloat u)
-{
- d_1_0_Deprecated->f.EvalCoord1f(u);
-}
-
-inline void QOpenGLFunctions_1_1::glEvalCoord1dv(const GLdouble *u)
-{
- d_1_0_Deprecated->f.EvalCoord1dv(u);
-}
-
-inline void QOpenGLFunctions_1_1::glEvalCoord1d(GLdouble u)
-{
- d_1_0_Deprecated->f.EvalCoord1d(u);
-}
-
-inline void QOpenGLFunctions_1_1::glMapGrid2f(GLint un, GLfloat u1, GLfloat u2, GLint vn, GLfloat v1, GLfloat v2)
-{
- d_1_0_Deprecated->f.MapGrid2f(un, u1, u2, vn, v1, v2);
-}
-
-inline void QOpenGLFunctions_1_1::glMapGrid2d(GLint un, GLdouble u1, GLdouble u2, GLint vn, GLdouble v1, GLdouble v2)
-{
- d_1_0_Deprecated->f.MapGrid2d(un, u1, u2, vn, v1, v2);
-}
-
-inline void QOpenGLFunctions_1_1::glMapGrid1f(GLint un, GLfloat u1, GLfloat u2)
-{
- d_1_0_Deprecated->f.MapGrid1f(un, u1, u2);
-}
-
-inline void QOpenGLFunctions_1_1::glMapGrid1d(GLint un, GLdouble u1, GLdouble u2)
-{
- d_1_0_Deprecated->f.MapGrid1d(un, u1, u2);
-}
-
-inline void QOpenGLFunctions_1_1::glMap2f(GLenum target, GLfloat u1, GLfloat u2, GLint ustride, GLint uorder, GLfloat v1, GLfloat v2, GLint vstride, GLint vorder, const GLfloat *points)
-{
- d_1_0_Deprecated->f.Map2f(target, u1, u2, ustride, uorder, v1, v2, vstride, vorder, points);
-}
-
-inline void QOpenGLFunctions_1_1::glMap2d(GLenum target, GLdouble u1, GLdouble u2, GLint ustride, GLint uorder, GLdouble v1, GLdouble v2, GLint vstride, GLint vorder, const GLdouble *points)
-{
- d_1_0_Deprecated->f.Map2d(target, u1, u2, ustride, uorder, v1, v2, vstride, vorder, points);
-}
-
-inline void QOpenGLFunctions_1_1::glMap1f(GLenum target, GLfloat u1, GLfloat u2, GLint stride, GLint order, const GLfloat *points)
-{
- d_1_0_Deprecated->f.Map1f(target, u1, u2, stride, order, points);
-}
-
-inline void QOpenGLFunctions_1_1::glMap1d(GLenum target, GLdouble u1, GLdouble u2, GLint stride, GLint order, const GLdouble *points)
-{
- d_1_0_Deprecated->f.Map1d(target, u1, u2, stride, order, points);
-}
-
-inline void QOpenGLFunctions_1_1::glPushAttrib(GLbitfield mask)
-{
- d_1_0_Deprecated->f.PushAttrib(mask);
-}
-
-inline void QOpenGLFunctions_1_1::glPopAttrib()
-{
- d_1_0_Deprecated->f.PopAttrib();
-}
-
-inline void QOpenGLFunctions_1_1::glAccum(GLenum op, GLfloat value)
-{
- d_1_0_Deprecated->f.Accum(op, value);
-}
-
-inline void QOpenGLFunctions_1_1::glIndexMask(GLuint mask)
-{
- d_1_0_Deprecated->f.IndexMask(mask);
-}
-
-inline void QOpenGLFunctions_1_1::glClearIndex(GLfloat c)
-{
- d_1_0_Deprecated->f.ClearIndex(c);
-}
-
-inline void QOpenGLFunctions_1_1::glClearAccum(GLfloat red, GLfloat green, GLfloat blue, GLfloat alpha)
-{
- d_1_0_Deprecated->f.ClearAccum(red, green, blue, alpha);
-}
-
-inline void QOpenGLFunctions_1_1::glPushName(GLuint name)
-{
- d_1_0_Deprecated->f.PushName(name);
-}
-
-inline void QOpenGLFunctions_1_1::glPopName()
-{
- d_1_0_Deprecated->f.PopName();
-}
-
-inline void QOpenGLFunctions_1_1::glPassThrough(GLfloat token)
-{
- d_1_0_Deprecated->f.PassThrough(token);
-}
-
-inline void QOpenGLFunctions_1_1::glLoadName(GLuint name)
-{
- d_1_0_Deprecated->f.LoadName(name);
-}
-
-inline void QOpenGLFunctions_1_1::glInitNames()
-{
- d_1_0_Deprecated->f.InitNames();
-}
-
-inline GLint QOpenGLFunctions_1_1::glRenderMode(GLenum mode)
-{
- return d_1_0_Deprecated->f.RenderMode(mode);
-}
-
-inline void QOpenGLFunctions_1_1::glSelectBuffer(GLsizei size, GLuint *buffer)
-{
- d_1_0_Deprecated->f.SelectBuffer(size, buffer);
-}
-
-inline void QOpenGLFunctions_1_1::glFeedbackBuffer(GLsizei size, GLenum type, GLfloat *buffer)
-{
- d_1_0_Deprecated->f.FeedbackBuffer(size, type, buffer);
-}
-
-inline void QOpenGLFunctions_1_1::glTexGeniv(GLenum coord, GLenum pname, const GLint *params)
-{
- d_1_0_Deprecated->f.TexGeniv(coord, pname, params);
-}
-
-inline void QOpenGLFunctions_1_1::glTexGeni(GLenum coord, GLenum pname, GLint param)
-{
- d_1_0_Deprecated->f.TexGeni(coord, pname, param);
-}
-
-inline void QOpenGLFunctions_1_1::glTexGenfv(GLenum coord, GLenum pname, const GLfloat *params)
-{
- d_1_0_Deprecated->f.TexGenfv(coord, pname, params);
-}
-
-inline void QOpenGLFunctions_1_1::glTexGenf(GLenum coord, GLenum pname, GLfloat param)
-{
- d_1_0_Deprecated->f.TexGenf(coord, pname, param);
-}
-
-inline void QOpenGLFunctions_1_1::glTexGendv(GLenum coord, GLenum pname, const GLdouble *params)
-{
- d_1_0_Deprecated->f.TexGendv(coord, pname, params);
-}
-
-inline void QOpenGLFunctions_1_1::glTexGend(GLenum coord, GLenum pname, GLdouble param)
-{
- d_1_0_Deprecated->f.TexGend(coord, pname, param);
-}
-
-inline void QOpenGLFunctions_1_1::glTexEnviv(GLenum target, GLenum pname, const GLint *params)
-{
- d_1_0_Deprecated->f.TexEnviv(target, pname, params);
-}
-
-inline void QOpenGLFunctions_1_1::glTexEnvi(GLenum target, GLenum pname, GLint param)
-{
- d_1_0_Deprecated->f.TexEnvi(target, pname, param);
-}
-
-inline void QOpenGLFunctions_1_1::glTexEnvfv(GLenum target, GLenum pname, const GLfloat *params)
-{
- d_1_0_Deprecated->f.TexEnvfv(target, pname, params);
-}
-
-inline void QOpenGLFunctions_1_1::glTexEnvf(GLenum target, GLenum pname, GLfloat param)
-{
- d_1_0_Deprecated->f.TexEnvf(target, pname, param);
-}
-
-inline void QOpenGLFunctions_1_1::glShadeModel(GLenum mode)
-{
- d_1_0_Deprecated->f.ShadeModel(mode);
-}
-
-inline void QOpenGLFunctions_1_1::glPolygonStipple(const GLubyte *mask)
-{
- d_1_0_Deprecated->f.PolygonStipple(mask);
-}
-
-inline void QOpenGLFunctions_1_1::glMaterialiv(GLenum face, GLenum pname, const GLint *params)
-{
- d_1_0_Deprecated->f.Materialiv(face, pname, params);
-}
-
-inline void QOpenGLFunctions_1_1::glMateriali(GLenum face, GLenum pname, GLint param)
-{
- d_1_0_Deprecated->f.Materiali(face, pname, param);
-}
-
-inline void QOpenGLFunctions_1_1::glMaterialfv(GLenum face, GLenum pname, const GLfloat *params)
-{
- d_1_0_Deprecated->f.Materialfv(face, pname, params);
-}
-
-inline void QOpenGLFunctions_1_1::glMaterialf(GLenum face, GLenum pname, GLfloat param)
-{
- d_1_0_Deprecated->f.Materialf(face, pname, param);
-}
-
-inline void QOpenGLFunctions_1_1::glLineStipple(GLint factor, GLushort pattern)
-{
- d_1_0_Deprecated->f.LineStipple(factor, pattern);
-}
-
-inline void QOpenGLFunctions_1_1::glLightModeliv(GLenum pname, const GLint *params)
-{
- d_1_0_Deprecated->f.LightModeliv(pname, params);
-}
-
-inline void QOpenGLFunctions_1_1::glLightModeli(GLenum pname, GLint param)
-{
- d_1_0_Deprecated->f.LightModeli(pname, param);
-}
-
-inline void QOpenGLFunctions_1_1::glLightModelfv(GLenum pname, const GLfloat *params)
-{
- d_1_0_Deprecated->f.LightModelfv(pname, params);
-}
-
-inline void QOpenGLFunctions_1_1::glLightModelf(GLenum pname, GLfloat param)
-{
- d_1_0_Deprecated->f.LightModelf(pname, param);
-}
-
-inline void QOpenGLFunctions_1_1::glLightiv(GLenum light, GLenum pname, const GLint *params)
-{
- d_1_0_Deprecated->f.Lightiv(light, pname, params);
-}
-
-inline void QOpenGLFunctions_1_1::glLighti(GLenum light, GLenum pname, GLint param)
-{
- d_1_0_Deprecated->f.Lighti(light, pname, param);
-}
-
-inline void QOpenGLFunctions_1_1::glLightfv(GLenum light, GLenum pname, const GLfloat *params)
-{
- d_1_0_Deprecated->f.Lightfv(light, pname, params);
-}
-
-inline void QOpenGLFunctions_1_1::glLightf(GLenum light, GLenum pname, GLfloat param)
-{
- d_1_0_Deprecated->f.Lightf(light, pname, param);
-}
-
-inline void QOpenGLFunctions_1_1::glFogiv(GLenum pname, const GLint *params)
-{
- d_1_0_Deprecated->f.Fogiv(pname, params);
-}
-
-inline void QOpenGLFunctions_1_1::glFogi(GLenum pname, GLint param)
-{
- d_1_0_Deprecated->f.Fogi(pname, param);
-}
-
-inline void QOpenGLFunctions_1_1::glFogfv(GLenum pname, const GLfloat *params)
-{
- d_1_0_Deprecated->f.Fogfv(pname, params);
-}
-
-inline void QOpenGLFunctions_1_1::glFogf(GLenum pname, GLfloat param)
-{
- d_1_0_Deprecated->f.Fogf(pname, param);
-}
-
-inline void QOpenGLFunctions_1_1::glColorMaterial(GLenum face, GLenum mode)
-{
- d_1_0_Deprecated->f.ColorMaterial(face, mode);
-}
-
-inline void QOpenGLFunctions_1_1::glClipPlane(GLenum plane, const GLdouble *equation)
-{
- d_1_0_Deprecated->f.ClipPlane(plane, equation);
-}
-
-inline void QOpenGLFunctions_1_1::glVertex4sv(const GLshort *v)
-{
- d_1_0_Deprecated->f.Vertex4sv(v);
-}
-
-inline void QOpenGLFunctions_1_1::glVertex4s(GLshort x, GLshort y, GLshort z, GLshort w)
-{
- d_1_0_Deprecated->f.Vertex4s(x, y, z, w);
-}
-
-inline void QOpenGLFunctions_1_1::glVertex4iv(const GLint *v)
-{
- d_1_0_Deprecated->f.Vertex4iv(v);
-}
-
-inline void QOpenGLFunctions_1_1::glVertex4i(GLint x, GLint y, GLint z, GLint w)
-{
- d_1_0_Deprecated->f.Vertex4i(x, y, z, w);
-}
-
-inline void QOpenGLFunctions_1_1::glVertex4fv(const GLfloat *v)
-{
- d_1_0_Deprecated->f.Vertex4fv(v);
-}
-
-inline void QOpenGLFunctions_1_1::glVertex4f(GLfloat x, GLfloat y, GLfloat z, GLfloat w)
-{
- d_1_0_Deprecated->f.Vertex4f(x, y, z, w);
-}
-
-inline void QOpenGLFunctions_1_1::glVertex4dv(const GLdouble *v)
-{
- d_1_0_Deprecated->f.Vertex4dv(v);
-}
-
-inline void QOpenGLFunctions_1_1::glVertex4d(GLdouble x, GLdouble y, GLdouble z, GLdouble w)
-{
- d_1_0_Deprecated->f.Vertex4d(x, y, z, w);
-}
-
-inline void QOpenGLFunctions_1_1::glVertex3sv(const GLshort *v)
-{
- d_1_0_Deprecated->f.Vertex3sv(v);
-}
-
-inline void QOpenGLFunctions_1_1::glVertex3s(GLshort x, GLshort y, GLshort z)
-{
- d_1_0_Deprecated->f.Vertex3s(x, y, z);
-}
-
-inline void QOpenGLFunctions_1_1::glVertex3iv(const GLint *v)
-{
- d_1_0_Deprecated->f.Vertex3iv(v);
-}
-
-inline void QOpenGLFunctions_1_1::glVertex3i(GLint x, GLint y, GLint z)
-{
- d_1_0_Deprecated->f.Vertex3i(x, y, z);
-}
-
-inline void QOpenGLFunctions_1_1::glVertex3fv(const GLfloat *v)
-{
- d_1_0_Deprecated->f.Vertex3fv(v);
-}
-
-inline void QOpenGLFunctions_1_1::glVertex3f(GLfloat x, GLfloat y, GLfloat z)
-{
- d_1_0_Deprecated->f.Vertex3f(x, y, z);
-}
-
-inline void QOpenGLFunctions_1_1::glVertex3dv(const GLdouble *v)
-{
- d_1_0_Deprecated->f.Vertex3dv(v);
-}
-
-inline void QOpenGLFunctions_1_1::glVertex3d(GLdouble x, GLdouble y, GLdouble z)
-{
- d_1_0_Deprecated->f.Vertex3d(x, y, z);
-}
-
-inline void QOpenGLFunctions_1_1::glVertex2sv(const GLshort *v)
-{
- d_1_0_Deprecated->f.Vertex2sv(v);
-}
-
-inline void QOpenGLFunctions_1_1::glVertex2s(GLshort x, GLshort y)
-{
- d_1_0_Deprecated->f.Vertex2s(x, y);
-}
-
-inline void QOpenGLFunctions_1_1::glVertex2iv(const GLint *v)
-{
- d_1_0_Deprecated->f.Vertex2iv(v);
-}
-
-inline void QOpenGLFunctions_1_1::glVertex2i(GLint x, GLint y)
-{
- d_1_0_Deprecated->f.Vertex2i(x, y);
-}
-
-inline void QOpenGLFunctions_1_1::glVertex2fv(const GLfloat *v)
-{
- d_1_0_Deprecated->f.Vertex2fv(v);
-}
-
-inline void QOpenGLFunctions_1_1::glVertex2f(GLfloat x, GLfloat y)
-{
- d_1_0_Deprecated->f.Vertex2f(x, y);
-}
-
-inline void QOpenGLFunctions_1_1::glVertex2dv(const GLdouble *v)
-{
- d_1_0_Deprecated->f.Vertex2dv(v);
-}
-
-inline void QOpenGLFunctions_1_1::glVertex2d(GLdouble x, GLdouble y)
-{
- d_1_0_Deprecated->f.Vertex2d(x, y);
-}
-
-inline void QOpenGLFunctions_1_1::glTexCoord4sv(const GLshort *v)
-{
- d_1_0_Deprecated->f.TexCoord4sv(v);
-}
-
-inline void QOpenGLFunctions_1_1::glTexCoord4s(GLshort s, GLshort t, GLshort r, GLshort q)
-{
- d_1_0_Deprecated->f.TexCoord4s(s, t, r, q);
-}
-
-inline void QOpenGLFunctions_1_1::glTexCoord4iv(const GLint *v)
-{
- d_1_0_Deprecated->f.TexCoord4iv(v);
-}
-
-inline void QOpenGLFunctions_1_1::glTexCoord4i(GLint s, GLint t, GLint r, GLint q)
-{
- d_1_0_Deprecated->f.TexCoord4i(s, t, r, q);
-}
-
-inline void QOpenGLFunctions_1_1::glTexCoord4fv(const GLfloat *v)
-{
- d_1_0_Deprecated->f.TexCoord4fv(v);
-}
-
-inline void QOpenGLFunctions_1_1::glTexCoord4f(GLfloat s, GLfloat t, GLfloat r, GLfloat q)
-{
- d_1_0_Deprecated->f.TexCoord4f(s, t, r, q);
-}
-
-inline void QOpenGLFunctions_1_1::glTexCoord4dv(const GLdouble *v)
-{
- d_1_0_Deprecated->f.TexCoord4dv(v);
-}
-
-inline void QOpenGLFunctions_1_1::glTexCoord4d(GLdouble s, GLdouble t, GLdouble r, GLdouble q)
-{
- d_1_0_Deprecated->f.TexCoord4d(s, t, r, q);
-}
-
-inline void QOpenGLFunctions_1_1::glTexCoord3sv(const GLshort *v)
-{
- d_1_0_Deprecated->f.TexCoord3sv(v);
-}
-
-inline void QOpenGLFunctions_1_1::glTexCoord3s(GLshort s, GLshort t, GLshort r)
-{
- d_1_0_Deprecated->f.TexCoord3s(s, t, r);
-}
-
-inline void QOpenGLFunctions_1_1::glTexCoord3iv(const GLint *v)
-{
- d_1_0_Deprecated->f.TexCoord3iv(v);
-}
-
-inline void QOpenGLFunctions_1_1::glTexCoord3i(GLint s, GLint t, GLint r)
-{
- d_1_0_Deprecated->f.TexCoord3i(s, t, r);
-}
-
-inline void QOpenGLFunctions_1_1::glTexCoord3fv(const GLfloat *v)
-{
- d_1_0_Deprecated->f.TexCoord3fv(v);
-}
-
-inline void QOpenGLFunctions_1_1::glTexCoord3f(GLfloat s, GLfloat t, GLfloat r)
-{
- d_1_0_Deprecated->f.TexCoord3f(s, t, r);
-}
-
-inline void QOpenGLFunctions_1_1::glTexCoord3dv(const GLdouble *v)
-{
- d_1_0_Deprecated->f.TexCoord3dv(v);
-}
-
-inline void QOpenGLFunctions_1_1::glTexCoord3d(GLdouble s, GLdouble t, GLdouble r)
-{
- d_1_0_Deprecated->f.TexCoord3d(s, t, r);
-}
-
-inline void QOpenGLFunctions_1_1::glTexCoord2sv(const GLshort *v)
-{
- d_1_0_Deprecated->f.TexCoord2sv(v);
-}
-
-inline void QOpenGLFunctions_1_1::glTexCoord2s(GLshort s, GLshort t)
-{
- d_1_0_Deprecated->f.TexCoord2s(s, t);
-}
-
-inline void QOpenGLFunctions_1_1::glTexCoord2iv(const GLint *v)
-{
- d_1_0_Deprecated->f.TexCoord2iv(v);
-}
-
-inline void QOpenGLFunctions_1_1::glTexCoord2i(GLint s, GLint t)
-{
- d_1_0_Deprecated->f.TexCoord2i(s, t);
-}
-
-inline void QOpenGLFunctions_1_1::glTexCoord2fv(const GLfloat *v)
-{
- d_1_0_Deprecated->f.TexCoord2fv(v);
-}
-
-inline void QOpenGLFunctions_1_1::glTexCoord2f(GLfloat s, GLfloat t)
-{
- d_1_0_Deprecated->f.TexCoord2f(s, t);
-}
-
-inline void QOpenGLFunctions_1_1::glTexCoord2dv(const GLdouble *v)
-{
- d_1_0_Deprecated->f.TexCoord2dv(v);
-}
-
-inline void QOpenGLFunctions_1_1::glTexCoord2d(GLdouble s, GLdouble t)
-{
- d_1_0_Deprecated->f.TexCoord2d(s, t);
-}
-
-inline void QOpenGLFunctions_1_1::glTexCoord1sv(const GLshort *v)
-{
- d_1_0_Deprecated->f.TexCoord1sv(v);
-}
-
-inline void QOpenGLFunctions_1_1::glTexCoord1s(GLshort s)
-{
- d_1_0_Deprecated->f.TexCoord1s(s);
-}
-
-inline void QOpenGLFunctions_1_1::glTexCoord1iv(const GLint *v)
-{
- d_1_0_Deprecated->f.TexCoord1iv(v);
-}
-
-inline void QOpenGLFunctions_1_1::glTexCoord1i(GLint s)
-{
- d_1_0_Deprecated->f.TexCoord1i(s);
-}
-
-inline void QOpenGLFunctions_1_1::glTexCoord1fv(const GLfloat *v)
-{
- d_1_0_Deprecated->f.TexCoord1fv(v);
-}
-
-inline void QOpenGLFunctions_1_1::glTexCoord1f(GLfloat s)
-{
- d_1_0_Deprecated->f.TexCoord1f(s);
-}
-
-inline void QOpenGLFunctions_1_1::glTexCoord1dv(const GLdouble *v)
-{
- d_1_0_Deprecated->f.TexCoord1dv(v);
-}
-
-inline void QOpenGLFunctions_1_1::glTexCoord1d(GLdouble s)
-{
- d_1_0_Deprecated->f.TexCoord1d(s);
-}
-
-inline void QOpenGLFunctions_1_1::glRectsv(const GLshort *v1, const GLshort *v2)
-{
- d_1_0_Deprecated->f.Rectsv(v1, v2);
-}
-
-inline void QOpenGLFunctions_1_1::glRects(GLshort x1, GLshort y1, GLshort x2, GLshort y2)
-{
- d_1_0_Deprecated->f.Rects(x1, y1, x2, y2);
-}
-
-inline void QOpenGLFunctions_1_1::glRectiv(const GLint *v1, const GLint *v2)
-{
- d_1_0_Deprecated->f.Rectiv(v1, v2);
-}
-
-inline void QOpenGLFunctions_1_1::glRecti(GLint x1, GLint y1, GLint x2, GLint y2)
-{
- d_1_0_Deprecated->f.Recti(x1, y1, x2, y2);
-}
-
-inline void QOpenGLFunctions_1_1::glRectfv(const GLfloat *v1, const GLfloat *v2)
-{
- d_1_0_Deprecated->f.Rectfv(v1, v2);
-}
-
-inline void QOpenGLFunctions_1_1::glRectf(GLfloat x1, GLfloat y1, GLfloat x2, GLfloat y2)
-{
- d_1_0_Deprecated->f.Rectf(x1, y1, x2, y2);
-}
-
-inline void QOpenGLFunctions_1_1::glRectdv(const GLdouble *v1, const GLdouble *v2)
-{
- d_1_0_Deprecated->f.Rectdv(v1, v2);
-}
-
-inline void QOpenGLFunctions_1_1::glRectd(GLdouble x1, GLdouble y1, GLdouble x2, GLdouble y2)
-{
- d_1_0_Deprecated->f.Rectd(x1, y1, x2, y2);
-}
-
-inline void QOpenGLFunctions_1_1::glRasterPos4sv(const GLshort *v)
-{
- d_1_0_Deprecated->f.RasterPos4sv(v);
-}
-
-inline void QOpenGLFunctions_1_1::glRasterPos4s(GLshort x, GLshort y, GLshort z, GLshort w)
-{
- d_1_0_Deprecated->f.RasterPos4s(x, y, z, w);
-}
-
-inline void QOpenGLFunctions_1_1::glRasterPos4iv(const GLint *v)
-{
- d_1_0_Deprecated->f.RasterPos4iv(v);
-}
-
-inline void QOpenGLFunctions_1_1::glRasterPos4i(GLint x, GLint y, GLint z, GLint w)
-{
- d_1_0_Deprecated->f.RasterPos4i(x, y, z, w);
-}
-
-inline void QOpenGLFunctions_1_1::glRasterPos4fv(const GLfloat *v)
-{
- d_1_0_Deprecated->f.RasterPos4fv(v);
-}
-
-inline void QOpenGLFunctions_1_1::glRasterPos4f(GLfloat x, GLfloat y, GLfloat z, GLfloat w)
-{
- d_1_0_Deprecated->f.RasterPos4f(x, y, z, w);
-}
-
-inline void QOpenGLFunctions_1_1::glRasterPos4dv(const GLdouble *v)
-{
- d_1_0_Deprecated->f.RasterPos4dv(v);
-}
-
-inline void QOpenGLFunctions_1_1::glRasterPos4d(GLdouble x, GLdouble y, GLdouble z, GLdouble w)
-{
- d_1_0_Deprecated->f.RasterPos4d(x, y, z, w);
-}
-
-inline void QOpenGLFunctions_1_1::glRasterPos3sv(const GLshort *v)
-{
- d_1_0_Deprecated->f.RasterPos3sv(v);
-}
-
-inline void QOpenGLFunctions_1_1::glRasterPos3s(GLshort x, GLshort y, GLshort z)
-{
- d_1_0_Deprecated->f.RasterPos3s(x, y, z);
-}
-
-inline void QOpenGLFunctions_1_1::glRasterPos3iv(const GLint *v)
-{
- d_1_0_Deprecated->f.RasterPos3iv(v);
-}
-
-inline void QOpenGLFunctions_1_1::glRasterPos3i(GLint x, GLint y, GLint z)
-{
- d_1_0_Deprecated->f.RasterPos3i(x, y, z);
-}
-
-inline void QOpenGLFunctions_1_1::glRasterPos3fv(const GLfloat *v)
-{
- d_1_0_Deprecated->f.RasterPos3fv(v);
-}
-
-inline void QOpenGLFunctions_1_1::glRasterPos3f(GLfloat x, GLfloat y, GLfloat z)
-{
- d_1_0_Deprecated->f.RasterPos3f(x, y, z);
-}
-
-inline void QOpenGLFunctions_1_1::glRasterPos3dv(const GLdouble *v)
-{
- d_1_0_Deprecated->f.RasterPos3dv(v);
-}
-
-inline void QOpenGLFunctions_1_1::glRasterPos3d(GLdouble x, GLdouble y, GLdouble z)
-{
- d_1_0_Deprecated->f.RasterPos3d(x, y, z);
-}
-
-inline void QOpenGLFunctions_1_1::glRasterPos2sv(const GLshort *v)
-{
- d_1_0_Deprecated->f.RasterPos2sv(v);
-}
-
-inline void QOpenGLFunctions_1_1::glRasterPos2s(GLshort x, GLshort y)
-{
- d_1_0_Deprecated->f.RasterPos2s(x, y);
-}
-
-inline void QOpenGLFunctions_1_1::glRasterPos2iv(const GLint *v)
-{
- d_1_0_Deprecated->f.RasterPos2iv(v);
-}
-
-inline void QOpenGLFunctions_1_1::glRasterPos2i(GLint x, GLint y)
-{
- d_1_0_Deprecated->f.RasterPos2i(x, y);
-}
-
-inline void QOpenGLFunctions_1_1::glRasterPos2fv(const GLfloat *v)
-{
- d_1_0_Deprecated->f.RasterPos2fv(v);
-}
-
-inline void QOpenGLFunctions_1_1::glRasterPos2f(GLfloat x, GLfloat y)
-{
- d_1_0_Deprecated->f.RasterPos2f(x, y);
-}
-
-inline void QOpenGLFunctions_1_1::glRasterPos2dv(const GLdouble *v)
-{
- d_1_0_Deprecated->f.RasterPos2dv(v);
-}
-
-inline void QOpenGLFunctions_1_1::glRasterPos2d(GLdouble x, GLdouble y)
-{
- d_1_0_Deprecated->f.RasterPos2d(x, y);
-}
-
-inline void QOpenGLFunctions_1_1::glNormal3sv(const GLshort *v)
-{
- d_1_0_Deprecated->f.Normal3sv(v);
-}
-
-inline void QOpenGLFunctions_1_1::glNormal3s(GLshort nx, GLshort ny, GLshort nz)
-{
- d_1_0_Deprecated->f.Normal3s(nx, ny, nz);
-}
-
-inline void QOpenGLFunctions_1_1::glNormal3iv(const GLint *v)
-{
- d_1_0_Deprecated->f.Normal3iv(v);
-}
-
-inline void QOpenGLFunctions_1_1::glNormal3i(GLint nx, GLint ny, GLint nz)
-{
- d_1_0_Deprecated->f.Normal3i(nx, ny, nz);
-}
-
-inline void QOpenGLFunctions_1_1::glNormal3fv(const GLfloat *v)
-{
- d_1_0_Deprecated->f.Normal3fv(v);
-}
-
-inline void QOpenGLFunctions_1_1::glNormal3f(GLfloat nx, GLfloat ny, GLfloat nz)
-{
- d_1_0_Deprecated->f.Normal3f(nx, ny, nz);
-}
-
-inline void QOpenGLFunctions_1_1::glNormal3dv(const GLdouble *v)
-{
- d_1_0_Deprecated->f.Normal3dv(v);
-}
-
-inline void QOpenGLFunctions_1_1::glNormal3d(GLdouble nx, GLdouble ny, GLdouble nz)
-{
- d_1_0_Deprecated->f.Normal3d(nx, ny, nz);
-}
-
-inline void QOpenGLFunctions_1_1::glNormal3bv(const GLbyte *v)
-{
- d_1_0_Deprecated->f.Normal3bv(v);
-}
-
-inline void QOpenGLFunctions_1_1::glNormal3b(GLbyte nx, GLbyte ny, GLbyte nz)
-{
- d_1_0_Deprecated->f.Normal3b(nx, ny, nz);
-}
-
-inline void QOpenGLFunctions_1_1::glIndexsv(const GLshort *c)
-{
- d_1_0_Deprecated->f.Indexsv(c);
-}
-
-inline void QOpenGLFunctions_1_1::glIndexs(GLshort c)
-{
- d_1_0_Deprecated->f.Indexs(c);
-}
-
-inline void QOpenGLFunctions_1_1::glIndexiv(const GLint *c)
-{
- d_1_0_Deprecated->f.Indexiv(c);
-}
-
-inline void QOpenGLFunctions_1_1::glIndexi(GLint c)
-{
- d_1_0_Deprecated->f.Indexi(c);
-}
-
-inline void QOpenGLFunctions_1_1::glIndexfv(const GLfloat *c)
-{
- d_1_0_Deprecated->f.Indexfv(c);
-}
-
-inline void QOpenGLFunctions_1_1::glIndexf(GLfloat c)
-{
- d_1_0_Deprecated->f.Indexf(c);
-}
-
-inline void QOpenGLFunctions_1_1::glIndexdv(const GLdouble *c)
-{
- d_1_0_Deprecated->f.Indexdv(c);
-}
-
-inline void QOpenGLFunctions_1_1::glIndexd(GLdouble c)
-{
- d_1_0_Deprecated->f.Indexd(c);
-}
-
-inline void QOpenGLFunctions_1_1::glEnd()
-{
- d_1_0_Deprecated->f.End();
-}
-
-inline void QOpenGLFunctions_1_1::glEdgeFlagv(const GLboolean *flag)
-{
- d_1_0_Deprecated->f.EdgeFlagv(flag);
-}
-
-inline void QOpenGLFunctions_1_1::glEdgeFlag(GLboolean flag)
-{
- d_1_0_Deprecated->f.EdgeFlag(flag);
-}
-
-inline void QOpenGLFunctions_1_1::glColor4usv(const GLushort *v)
-{
- d_1_0_Deprecated->f.Color4usv(v);
-}
-
-inline void QOpenGLFunctions_1_1::glColor4us(GLushort red, GLushort green, GLushort blue, GLushort alpha)
-{
- d_1_0_Deprecated->f.Color4us(red, green, blue, alpha);
-}
-
-inline void QOpenGLFunctions_1_1::glColor4uiv(const GLuint *v)
-{
- d_1_0_Deprecated->f.Color4uiv(v);
-}
-
-inline void QOpenGLFunctions_1_1::glColor4ui(GLuint red, GLuint green, GLuint blue, GLuint alpha)
-{
- d_1_0_Deprecated->f.Color4ui(red, green, blue, alpha);
-}
-
-inline void QOpenGLFunctions_1_1::glColor4ubv(const GLubyte *v)
-{
- d_1_0_Deprecated->f.Color4ubv(v);
-}
-
-inline void QOpenGLFunctions_1_1::glColor4ub(GLubyte red, GLubyte green, GLubyte blue, GLubyte alpha)
-{
- d_1_0_Deprecated->f.Color4ub(red, green, blue, alpha);
-}
-
-inline void QOpenGLFunctions_1_1::glColor4sv(const GLshort *v)
-{
- d_1_0_Deprecated->f.Color4sv(v);
-}
-
-inline void QOpenGLFunctions_1_1::glColor4s(GLshort red, GLshort green, GLshort blue, GLshort alpha)
-{
- d_1_0_Deprecated->f.Color4s(red, green, blue, alpha);
-}
-
-inline void QOpenGLFunctions_1_1::glColor4iv(const GLint *v)
-{
- d_1_0_Deprecated->f.Color4iv(v);
-}
-
-inline void QOpenGLFunctions_1_1::glColor4i(GLint red, GLint green, GLint blue, GLint alpha)
-{
- d_1_0_Deprecated->f.Color4i(red, green, blue, alpha);
-}
-
-inline void QOpenGLFunctions_1_1::glColor4fv(const GLfloat *v)
-{
- d_1_0_Deprecated->f.Color4fv(v);
-}
-
-inline void QOpenGLFunctions_1_1::glColor4f(GLfloat red, GLfloat green, GLfloat blue, GLfloat alpha)
-{
- d_1_0_Deprecated->f.Color4f(red, green, blue, alpha);
-}
-
-inline void QOpenGLFunctions_1_1::glColor4dv(const GLdouble *v)
-{
- d_1_0_Deprecated->f.Color4dv(v);
-}
-
-inline void QOpenGLFunctions_1_1::glColor4d(GLdouble red, GLdouble green, GLdouble blue, GLdouble alpha)
-{
- d_1_0_Deprecated->f.Color4d(red, green, blue, alpha);
-}
-
-inline void QOpenGLFunctions_1_1::glColor4bv(const GLbyte *v)
-{
- d_1_0_Deprecated->f.Color4bv(v);
-}
-
-inline void QOpenGLFunctions_1_1::glColor4b(GLbyte red, GLbyte green, GLbyte blue, GLbyte alpha)
-{
- d_1_0_Deprecated->f.Color4b(red, green, blue, alpha);
-}
-
-inline void QOpenGLFunctions_1_1::glColor3usv(const GLushort *v)
-{
- d_1_0_Deprecated->f.Color3usv(v);
-}
-
-inline void QOpenGLFunctions_1_1::glColor3us(GLushort red, GLushort green, GLushort blue)
-{
- d_1_0_Deprecated->f.Color3us(red, green, blue);
-}
-
-inline void QOpenGLFunctions_1_1::glColor3uiv(const GLuint *v)
-{
- d_1_0_Deprecated->f.Color3uiv(v);
-}
-
-inline void QOpenGLFunctions_1_1::glColor3ui(GLuint red, GLuint green, GLuint blue)
-{
- d_1_0_Deprecated->f.Color3ui(red, green, blue);
-}
-
-inline void QOpenGLFunctions_1_1::glColor3ubv(const GLubyte *v)
-{
- d_1_0_Deprecated->f.Color3ubv(v);
-}
-
-inline void QOpenGLFunctions_1_1::glColor3ub(GLubyte red, GLubyte green, GLubyte blue)
-{
- d_1_0_Deprecated->f.Color3ub(red, green, blue);
-}
-
-inline void QOpenGLFunctions_1_1::glColor3sv(const GLshort *v)
-{
- d_1_0_Deprecated->f.Color3sv(v);
-}
-
-inline void QOpenGLFunctions_1_1::glColor3s(GLshort red, GLshort green, GLshort blue)
-{
- d_1_0_Deprecated->f.Color3s(red, green, blue);
-}
-
-inline void QOpenGLFunctions_1_1::glColor3iv(const GLint *v)
-{
- d_1_0_Deprecated->f.Color3iv(v);
-}
-
-inline void QOpenGLFunctions_1_1::glColor3i(GLint red, GLint green, GLint blue)
-{
- d_1_0_Deprecated->f.Color3i(red, green, blue);
-}
-
-inline void QOpenGLFunctions_1_1::glColor3fv(const GLfloat *v)
-{
- d_1_0_Deprecated->f.Color3fv(v);
-}
-
-inline void QOpenGLFunctions_1_1::glColor3f(GLfloat red, GLfloat green, GLfloat blue)
-{
- d_1_0_Deprecated->f.Color3f(red, green, blue);
-}
-
-inline void QOpenGLFunctions_1_1::glColor3dv(const GLdouble *v)
-{
- d_1_0_Deprecated->f.Color3dv(v);
-}
-
-inline void QOpenGLFunctions_1_1::glColor3d(GLdouble red, GLdouble green, GLdouble blue)
-{
- d_1_0_Deprecated->f.Color3d(red, green, blue);
-}
-
-inline void QOpenGLFunctions_1_1::glColor3bv(const GLbyte *v)
-{
- d_1_0_Deprecated->f.Color3bv(v);
-}
-
-inline void QOpenGLFunctions_1_1::glColor3b(GLbyte red, GLbyte green, GLbyte blue)
-{
- d_1_0_Deprecated->f.Color3b(red, green, blue);
-}
-
-inline void QOpenGLFunctions_1_1::glBitmap(GLsizei width, GLsizei height, GLfloat xorig, GLfloat yorig, GLfloat xmove, GLfloat ymove, const GLubyte *bitmap)
-{
- d_1_0_Deprecated->f.Bitmap(width, height, xorig, yorig, xmove, ymove, bitmap);
-}
-
-inline void QOpenGLFunctions_1_1::glBegin(GLenum mode)
-{
- d_1_0_Deprecated->f.Begin(mode);
-}
-
-inline void QOpenGLFunctions_1_1::glListBase(GLuint base)
-{
- d_1_0_Deprecated->f.ListBase(base);
-}
-
-inline GLuint QOpenGLFunctions_1_1::glGenLists(GLsizei range)
-{
- return d_1_0_Deprecated->f.GenLists(range);
-}
-
-inline void QOpenGLFunctions_1_1::glDeleteLists(GLuint list, GLsizei range)
-{
- d_1_0_Deprecated->f.DeleteLists(list, range);
-}
-
-inline void QOpenGLFunctions_1_1::glCallLists(GLsizei n, GLenum type, const GLvoid *lists)
-{
- d_1_0_Deprecated->f.CallLists(n, type, lists);
-}
-
-inline void QOpenGLFunctions_1_1::glCallList(GLuint list)
-{
- d_1_0_Deprecated->f.CallList(list);
-}
-
-inline void QOpenGLFunctions_1_1::glEndList()
-{
- d_1_0_Deprecated->f.EndList();
-}
-
-inline void QOpenGLFunctions_1_1::glNewList(GLuint list, GLenum mode)
-{
- d_1_0_Deprecated->f.NewList(list, mode);
-}
-
-
-// OpenGL 1.1 deprecated functions
-inline void QOpenGLFunctions_1_1::glPushClientAttrib(GLbitfield mask)
-{
- d_1_1_Deprecated->f.PushClientAttrib(mask);
-}
-
-inline void QOpenGLFunctions_1_1::glPopClientAttrib()
-{
- d_1_1_Deprecated->f.PopClientAttrib();
-}
-
-inline void QOpenGLFunctions_1_1::glPrioritizeTextures(GLsizei n, const GLuint *textures, const GLfloat *priorities)
-{
- d_1_1_Deprecated->f.PrioritizeTextures(n, textures, priorities);
-}
-
-inline GLboolean QOpenGLFunctions_1_1::glAreTexturesResident(GLsizei n, const GLuint *textures, GLboolean *residences)
-{
- return d_1_1_Deprecated->f.AreTexturesResident(n, textures, residences);
-}
-
-inline void QOpenGLFunctions_1_1::glVertexPointer(GLint size, GLenum type, GLsizei stride, const GLvoid *pointer)
-{
- d_1_1_Deprecated->f.VertexPointer(size, type, stride, pointer);
-}
-
-inline void QOpenGLFunctions_1_1::glTexCoordPointer(GLint size, GLenum type, GLsizei stride, const GLvoid *pointer)
-{
- d_1_1_Deprecated->f.TexCoordPointer(size, type, stride, pointer);
-}
-
-inline void QOpenGLFunctions_1_1::glNormalPointer(GLenum type, GLsizei stride, const GLvoid *pointer)
-{
- d_1_1_Deprecated->f.NormalPointer(type, stride, pointer);
-}
-
-inline void QOpenGLFunctions_1_1::glInterleavedArrays(GLenum format, GLsizei stride, const GLvoid *pointer)
-{
- d_1_1_Deprecated->f.InterleavedArrays(format, stride, pointer);
-}
-
-inline void QOpenGLFunctions_1_1::glIndexPointer(GLenum type, GLsizei stride, const GLvoid *pointer)
-{
- d_1_1_Deprecated->f.IndexPointer(type, stride, pointer);
-}
-
-inline void QOpenGLFunctions_1_1::glEnableClientState(GLenum array)
-{
- d_1_1_Deprecated->f.EnableClientState(array);
-}
-
-inline void QOpenGLFunctions_1_1::glEdgeFlagPointer(GLsizei stride, const GLvoid *pointer)
-{
- d_1_1_Deprecated->f.EdgeFlagPointer(stride, pointer);
-}
-
-inline void QOpenGLFunctions_1_1::glDisableClientState(GLenum array)
-{
- d_1_1_Deprecated->f.DisableClientState(array);
-}
-
-inline void QOpenGLFunctions_1_1::glColorPointer(GLint size, GLenum type, GLsizei stride, const GLvoid *pointer)
-{
- d_1_1_Deprecated->f.ColorPointer(size, type, stride, pointer);
-}
-
-inline void QOpenGLFunctions_1_1::glArrayElement(GLint i)
-{
- d_1_1_Deprecated->f.ArrayElement(i);
-}
-
-
-
-QT_END_NAMESPACE
-
-#endif // QT_NO_OPENGL && !QT_OPENGL_ES_2
-
-#endif
diff --git a/src/gui/opengl/qopenglfunctions_1_2.cpp b/src/gui/opengl/qopenglfunctions_1_2.cpp
deleted file mode 100644
index 5f137b0237..0000000000
--- a/src/gui/opengl/qopenglfunctions_1_2.cpp
+++ /dev/null
@@ -1,172 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2013 Klaralvdalens Datakonsult AB (KDAB)
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the QtGui module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-**
-** This file was generated by glgen version 0.1
-** Command line was: glgen
-**
-** glgen is Copyright (C) 2013 Klaralvdalens Datakonsult AB (KDAB)
-**
-** This is an auto-generated file.
-** Do not edit! All changes made to it will be lost.
-**
-****************************************************************************/
-
-#include "qopenglfunctions_1_2.h"
-#include "qopenglcontext.h"
-
-QT_BEGIN_NAMESPACE
-
-/*!
- \class QOpenGLFunctions_1_2
- \inmodule QtGui
- \since 5.1
- \wrapper
- \brief The QOpenGLFunctions_1_2 class provides all functions for OpenGL 1.2 specification.
-
- This class is a wrapper for functions from OpenGL 1.2 specification.
- See reference pages on \l {http://www.opengl.org/sdk/docs/}{opengl.org}
- for function documentation.
-
- \sa QAbstractOpenGLFunctions
-*/
-
-QOpenGLFunctions_1_2::QOpenGLFunctions_1_2()
- : QAbstractOpenGLFunctions()
- , d_1_0_Core(nullptr)
- , d_1_1_Core(nullptr)
- , d_1_2_Core(nullptr)
- , d_1_0_Deprecated(nullptr)
- , d_1_1_Deprecated(nullptr)
- , d_1_2_Deprecated(nullptr)
-{
-}
-
-QOpenGLFunctions_1_2::~QOpenGLFunctions_1_2()
-{
- if (d_1_0_Core) {
- d_1_0_Core->refs.deref();
- Q_ASSERT(d_1_0_Core->refs.loadRelaxed());
- }
- if (d_1_1_Core) {
- d_1_1_Core->refs.deref();
- Q_ASSERT(d_1_1_Core->refs.loadRelaxed());
- }
- if (d_1_2_Core) {
- d_1_2_Core->refs.deref();
- Q_ASSERT(d_1_2_Core->refs.loadRelaxed());
- }
- if (d_1_0_Deprecated) {
- d_1_0_Deprecated->refs.deref();
- Q_ASSERT(d_1_0_Deprecated->refs.loadRelaxed());
- }
- if (d_1_1_Deprecated) {
- d_1_1_Deprecated->refs.deref();
- Q_ASSERT(d_1_1_Deprecated->refs.loadRelaxed());
- }
- if (d_1_2_Deprecated) {
- d_1_2_Deprecated->refs.deref();
- Q_ASSERT(d_1_2_Deprecated->refs.loadRelaxed());
- }
-}
-
-bool QOpenGLFunctions_1_2::initializeOpenGLFunctions()
-{
- if ( isInitialized() )
- return true;
-
- QOpenGLContext* context = QOpenGLContext::currentContext();
-
- // If owned by a context object make sure it is current.
- // Also check that current context is capable of resolving all needed functions
- if (((owningContext() && owningContext() == context) || !owningContext())
- && QOpenGLFunctions_1_2::isContextCompatible(context))
- {
- // Associate with private implementation, creating if necessary
- // Function pointers in the backends are resolved at creation time
- QOpenGLVersionFunctionsBackend* d = nullptr;
- d = QAbstractOpenGLFunctionsPrivate::functionsBackend(context, QOpenGLFunctions_1_0_CoreBackend::versionStatus());
- d_1_0_Core = static_cast<QOpenGLFunctions_1_0_CoreBackend*>(d);
- d->refs.ref();
-
- d = QAbstractOpenGLFunctionsPrivate::functionsBackend(context, QOpenGLFunctions_1_1_CoreBackend::versionStatus());
- d_1_1_Core = static_cast<QOpenGLFunctions_1_1_CoreBackend*>(d);
- d->refs.ref();
-
- d = QAbstractOpenGLFunctionsPrivate::functionsBackend(context, QOpenGLFunctions_1_2_CoreBackend::versionStatus());
- d_1_2_Core = static_cast<QOpenGLFunctions_1_2_CoreBackend*>(d);
- d->refs.ref();
-
- d = QAbstractOpenGLFunctionsPrivate::functionsBackend(context, QOpenGLFunctions_1_0_DeprecatedBackend::versionStatus());
- d_1_0_Deprecated = static_cast<QOpenGLFunctions_1_0_DeprecatedBackend*>(d);
- d->refs.ref();
-
- d = QAbstractOpenGLFunctionsPrivate::functionsBackend(context, QOpenGLFunctions_1_1_DeprecatedBackend::versionStatus());
- d_1_1_Deprecated = static_cast<QOpenGLFunctions_1_1_DeprecatedBackend*>(d);
- d->refs.ref();
-
- d = QAbstractOpenGLFunctionsPrivate::functionsBackend(context, QOpenGLFunctions_1_2_DeprecatedBackend::versionStatus());
- d_1_2_Deprecated = static_cast<QOpenGLFunctions_1_2_DeprecatedBackend*>(d);
- d->refs.ref();
-
- QAbstractOpenGLFunctions::initializeOpenGLFunctions();
- }
- return isInitialized();
-}
-
-bool QOpenGLFunctions_1_2::isContextCompatible(QOpenGLContext *context)
-{
- Q_ASSERT(context);
- QSurfaceFormat f = context->format();
- const QPair<int, int> v = qMakePair(f.majorVersion(), f.minorVersion());
- if (v < qMakePair(1, 2))
- return false;
-
- if (f.profile() == QSurfaceFormat::CoreProfile)
- return false;
-
- return true;
-}
-
-QOpenGLVersionProfile QOpenGLFunctions_1_2::versionProfile()
-{
- QOpenGLVersionProfile v;
- v.setVersion(1, 2);
- return v;
-}
-
-QT_END_NAMESPACE
diff --git a/src/gui/opengl/qopenglfunctions_1_2.h b/src/gui/opengl/qopenglfunctions_1_2.h
deleted file mode 100644
index 7daca0923d..0000000000
--- a/src/gui/opengl/qopenglfunctions_1_2.h
+++ /dev/null
@@ -1,2357 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2013 Klaralvdalens Datakonsult AB (KDAB)
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the QtGui module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-**
-** This file was generated by glgen version 0.1
-** Command line was: glgen
-**
-** glgen is Copyright (C) 2013 Klaralvdalens Datakonsult AB (KDAB)
-**
-** This is an auto-generated file.
-** Do not edit! All changes made to it will be lost.
-**
-****************************************************************************/
-
-#ifndef QOPENGLVERSIONFUNCTIONS_1_2_H
-#define QOPENGLVERSIONFUNCTIONS_1_2_H
-
-#include <QtGui/qtguiglobal.h>
-
-#if !defined(QT_NO_OPENGL) && !defined(QT_OPENGL_ES_2)
-
-#include <QtGui/QOpenGLVersionFunctions>
-#include <QtGui/qopenglcontext.h>
-
-QT_BEGIN_NAMESPACE
-
-class Q_GUI_EXPORT QOpenGLFunctions_1_2 : public QAbstractOpenGLFunctions
-{
-public:
- QOpenGLFunctions_1_2();
- ~QOpenGLFunctions_1_2();
-
- bool initializeOpenGLFunctions() override;
-
- // OpenGL 1.0 core functions
- void glViewport(GLint x, GLint y, GLsizei width, GLsizei height);
- void glDepthRange(GLdouble nearVal, GLdouble farVal);
- GLboolean glIsEnabled(GLenum cap);
- void glGetTexLevelParameteriv(GLenum target, GLint level, GLenum pname, GLint *params);
- void glGetTexLevelParameterfv(GLenum target, GLint level, GLenum pname, GLfloat *params);
- void glGetTexParameteriv(GLenum target, GLenum pname, GLint *params);
- void glGetTexParameterfv(GLenum target, GLenum pname, GLfloat *params);
- void glGetTexImage(GLenum target, GLint level, GLenum format, GLenum type, GLvoid *pixels);
- const GLubyte * glGetString(GLenum name);
- void glGetIntegerv(GLenum pname, GLint *params);
- void glGetFloatv(GLenum pname, GLfloat *params);
- GLenum glGetError();
- void glGetDoublev(GLenum pname, GLdouble *params);
- void glGetBooleanv(GLenum pname, GLboolean *params);
- void glReadPixels(GLint x, GLint y, GLsizei width, GLsizei height, GLenum format, GLenum type, GLvoid *pixels);
- void glReadBuffer(GLenum mode);
- void glPixelStorei(GLenum pname, GLint param);
- void glPixelStoref(GLenum pname, GLfloat param);
- void glDepthFunc(GLenum func);
- void glStencilOp(GLenum fail, GLenum zfail, GLenum zpass);
- void glStencilFunc(GLenum func, GLint ref, GLuint mask);
- void glLogicOp(GLenum opcode);
- void glBlendFunc(GLenum sfactor, GLenum dfactor);
- void glFlush();
- void glFinish();
- void glEnable(GLenum cap);
- void glDisable(GLenum cap);
- void glDepthMask(GLboolean flag);
- void glColorMask(GLboolean red, GLboolean green, GLboolean blue, GLboolean alpha);
- void glStencilMask(GLuint mask);
- void glClearDepth(GLdouble depth);
- void glClearStencil(GLint s);
- void glClearColor(GLfloat red, GLfloat green, GLfloat blue, GLfloat alpha);
- void glClear(GLbitfield mask);
- void glDrawBuffer(GLenum mode);
- void glTexImage2D(GLenum target, GLint level, GLint internalformat, GLsizei width, GLsizei height, GLint border, GLenum format, GLenum type, const GLvoid *pixels);
- void glTexImage1D(GLenum target, GLint level, GLint internalformat, GLsizei width, GLint border, GLenum format, GLenum type, const GLvoid *pixels);
- void glTexParameteriv(GLenum target, GLenum pname, const GLint *params);
- void glTexParameteri(GLenum target, GLenum pname, GLint param);
- void glTexParameterfv(GLenum target, GLenum pname, const GLfloat *params);
- void glTexParameterf(GLenum target, GLenum pname, GLfloat param);
- void glScissor(GLint x, GLint y, GLsizei width, GLsizei height);
- void glPolygonMode(GLenum face, GLenum mode);
- void glPointSize(GLfloat size);
- void glLineWidth(GLfloat width);
- void glHint(GLenum target, GLenum mode);
- void glFrontFace(GLenum mode);
- void glCullFace(GLenum mode);
-
- // OpenGL 1.1 core functions
- void glIndexubv(const GLubyte *c);
- void glIndexub(GLubyte c);
- GLboolean glIsTexture(GLuint texture);
- void glGenTextures(GLsizei n, GLuint *textures);
- void glDeleteTextures(GLsizei n, const GLuint *textures);
- void glBindTexture(GLenum target, GLuint texture);
- void glTexSubImage2D(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLenum type, const GLvoid *pixels);
- void glTexSubImage1D(GLenum target, GLint level, GLint xoffset, GLsizei width, GLenum format, GLenum type, const GLvoid *pixels);
- void glCopyTexSubImage2D(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint x, GLint y, GLsizei width, GLsizei height);
- void glCopyTexSubImage1D(GLenum target, GLint level, GLint xoffset, GLint x, GLint y, GLsizei width);
- void glCopyTexImage2D(GLenum target, GLint level, GLenum internalformat, GLint x, GLint y, GLsizei width, GLsizei height, GLint border);
- void glCopyTexImage1D(GLenum target, GLint level, GLenum internalformat, GLint x, GLint y, GLsizei width, GLint border);
- void glPolygonOffset(GLfloat factor, GLfloat units);
- void glGetPointerv(GLenum pname, GLvoid* *params);
- void glDrawElements(GLenum mode, GLsizei count, GLenum type, const GLvoid *indices);
- void glDrawArrays(GLenum mode, GLint first, GLsizei count);
-
- // OpenGL 1.2 core functions
- void glCopyTexSubImage3D(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLint x, GLint y, GLsizei width, GLsizei height);
- void glTexSubImage3D(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLenum type, const GLvoid *pixels);
- void glTexImage3D(GLenum target, GLint level, GLint internalformat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLenum format, GLenum type, const GLvoid *pixels);
- void glDrawRangeElements(GLenum mode, GLuint start, GLuint end, GLsizei count, GLenum type, const GLvoid *indices);
- void glBlendEquation(GLenum mode);
- void glBlendColor(GLfloat red, GLfloat green, GLfloat blue, GLfloat alpha);
-
- // OpenGL 1.0 deprecated functions
- void glTranslatef(GLfloat x, GLfloat y, GLfloat z);
- void glTranslated(GLdouble x, GLdouble y, GLdouble z);
- void glScalef(GLfloat x, GLfloat y, GLfloat z);
- void glScaled(GLdouble x, GLdouble y, GLdouble z);
- void glRotatef(GLfloat angle, GLfloat x, GLfloat y, GLfloat z);
- void glRotated(GLdouble angle, GLdouble x, GLdouble y, GLdouble z);
- void glPushMatrix();
- void glPopMatrix();
- void glOrtho(GLdouble left, GLdouble right, GLdouble bottom, GLdouble top, GLdouble zNear, GLdouble zFar);
- void glMultMatrixd(const GLdouble *m);
- void glMultMatrixf(const GLfloat *m);
- void glMatrixMode(GLenum mode);
- void glLoadMatrixd(const GLdouble *m);
- void glLoadMatrixf(const GLfloat *m);
- void glLoadIdentity();
- void glFrustum(GLdouble left, GLdouble right, GLdouble bottom, GLdouble top, GLdouble zNear, GLdouble zFar);
- GLboolean glIsList(GLuint list);
- void glGetTexGeniv(GLenum coord, GLenum pname, GLint *params);
- void glGetTexGenfv(GLenum coord, GLenum pname, GLfloat *params);
- void glGetTexGendv(GLenum coord, GLenum pname, GLdouble *params);
- void glGetTexEnviv(GLenum target, GLenum pname, GLint *params);
- void glGetTexEnvfv(GLenum target, GLenum pname, GLfloat *params);
- void glGetPolygonStipple(GLubyte *mask);
- void glGetPixelMapusv(GLenum map, GLushort *values);
- void glGetPixelMapuiv(GLenum map, GLuint *values);
- void glGetPixelMapfv(GLenum map, GLfloat *values);
- void glGetMaterialiv(GLenum face, GLenum pname, GLint *params);
- void glGetMaterialfv(GLenum face, GLenum pname, GLfloat *params);
- void glGetMapiv(GLenum target, GLenum query, GLint *v);
- void glGetMapfv(GLenum target, GLenum query, GLfloat *v);
- void glGetMapdv(GLenum target, GLenum query, GLdouble *v);
- void glGetLightiv(GLenum light, GLenum pname, GLint *params);
- void glGetLightfv(GLenum light, GLenum pname, GLfloat *params);
- void glGetClipPlane(GLenum plane, GLdouble *equation);
- void glDrawPixels(GLsizei width, GLsizei height, GLenum format, GLenum type, const GLvoid *pixels);
- void glCopyPixels(GLint x, GLint y, GLsizei width, GLsizei height, GLenum type);
- void glPixelMapusv(GLenum map, GLint mapsize, const GLushort *values);
- void glPixelMapuiv(GLenum map, GLint mapsize, const GLuint *values);
- void glPixelMapfv(GLenum map, GLint mapsize, const GLfloat *values);
- void glPixelTransferi(GLenum pname, GLint param);
- void glPixelTransferf(GLenum pname, GLfloat param);
- void glPixelZoom(GLfloat xfactor, GLfloat yfactor);
- void glAlphaFunc(GLenum func, GLfloat ref);
- void glEvalPoint2(GLint i, GLint j);
- void glEvalMesh2(GLenum mode, GLint i1, GLint i2, GLint j1, GLint j2);
- void glEvalPoint1(GLint i);
- void glEvalMesh1(GLenum mode, GLint i1, GLint i2);
- void glEvalCoord2fv(const GLfloat *u);
- void glEvalCoord2f(GLfloat u, GLfloat v);
- void glEvalCoord2dv(const GLdouble *u);
- void glEvalCoord2d(GLdouble u, GLdouble v);
- void glEvalCoord1fv(const GLfloat *u);
- void glEvalCoord1f(GLfloat u);
- void glEvalCoord1dv(const GLdouble *u);
- void glEvalCoord1d(GLdouble u);
- void glMapGrid2f(GLint un, GLfloat u1, GLfloat u2, GLint vn, GLfloat v1, GLfloat v2);
- void glMapGrid2d(GLint un, GLdouble u1, GLdouble u2, GLint vn, GLdouble v1, GLdouble v2);
- void glMapGrid1f(GLint un, GLfloat u1, GLfloat u2);
- void glMapGrid1d(GLint un, GLdouble u1, GLdouble u2);
- void glMap2f(GLenum target, GLfloat u1, GLfloat u2, GLint ustride, GLint uorder, GLfloat v1, GLfloat v2, GLint vstride, GLint vorder, const GLfloat *points);
- void glMap2d(GLenum target, GLdouble u1, GLdouble u2, GLint ustride, GLint uorder, GLdouble v1, GLdouble v2, GLint vstride, GLint vorder, const GLdouble *points);
- void glMap1f(GLenum target, GLfloat u1, GLfloat u2, GLint stride, GLint order, const GLfloat *points);
- void glMap1d(GLenum target, GLdouble u1, GLdouble u2, GLint stride, GLint order, const GLdouble *points);
- void glPushAttrib(GLbitfield mask);
- void glPopAttrib();
- void glAccum(GLenum op, GLfloat value);
- void glIndexMask(GLuint mask);
- void glClearIndex(GLfloat c);
- void glClearAccum(GLfloat red, GLfloat green, GLfloat blue, GLfloat alpha);
- void glPushName(GLuint name);
- void glPopName();
- void glPassThrough(GLfloat token);
- void glLoadName(GLuint name);
- void glInitNames();
- GLint glRenderMode(GLenum mode);
- void glSelectBuffer(GLsizei size, GLuint *buffer);
- void glFeedbackBuffer(GLsizei size, GLenum type, GLfloat *buffer);
- void glTexGeniv(GLenum coord, GLenum pname, const GLint *params);
- void glTexGeni(GLenum coord, GLenum pname, GLint param);
- void glTexGenfv(GLenum coord, GLenum pname, const GLfloat *params);
- void glTexGenf(GLenum coord, GLenum pname, GLfloat param);
- void glTexGendv(GLenum coord, GLenum pname, const GLdouble *params);
- void glTexGend(GLenum coord, GLenum pname, GLdouble param);
- void glTexEnviv(GLenum target, GLenum pname, const GLint *params);
- void glTexEnvi(GLenum target, GLenum pname, GLint param);
- void glTexEnvfv(GLenum target, GLenum pname, const GLfloat *params);
- void glTexEnvf(GLenum target, GLenum pname, GLfloat param);
- void glShadeModel(GLenum mode);
- void glPolygonStipple(const GLubyte *mask);
- void glMaterialiv(GLenum face, GLenum pname, const GLint *params);
- void glMateriali(GLenum face, GLenum pname, GLint param);
- void glMaterialfv(GLenum face, GLenum pname, const GLfloat *params);
- void glMaterialf(GLenum face, GLenum pname, GLfloat param);
- void glLineStipple(GLint factor, GLushort pattern);
- void glLightModeliv(GLenum pname, const GLint *params);
- void glLightModeli(GLenum pname, GLint param);
- void glLightModelfv(GLenum pname, const GLfloat *params);
- void glLightModelf(GLenum pname, GLfloat param);
- void glLightiv(GLenum light, GLenum pname, const GLint *params);
- void glLighti(GLenum light, GLenum pname, GLint param);
- void glLightfv(GLenum light, GLenum pname, const GLfloat *params);
- void glLightf(GLenum light, GLenum pname, GLfloat param);
- void glFogiv(GLenum pname, const GLint *params);
- void glFogi(GLenum pname, GLint param);
- void glFogfv(GLenum pname, const GLfloat *params);
- void glFogf(GLenum pname, GLfloat param);
- void glColorMaterial(GLenum face, GLenum mode);
- void glClipPlane(GLenum plane, const GLdouble *equation);
- void glVertex4sv(const GLshort *v);
- void glVertex4s(GLshort x, GLshort y, GLshort z, GLshort w);
- void glVertex4iv(const GLint *v);
- void glVertex4i(GLint x, GLint y, GLint z, GLint w);
- void glVertex4fv(const GLfloat *v);
- void glVertex4f(GLfloat x, GLfloat y, GLfloat z, GLfloat w);
- void glVertex4dv(const GLdouble *v);
- void glVertex4d(GLdouble x, GLdouble y, GLdouble z, GLdouble w);
- void glVertex3sv(const GLshort *v);
- void glVertex3s(GLshort x, GLshort y, GLshort z);
- void glVertex3iv(const GLint *v);
- void glVertex3i(GLint x, GLint y, GLint z);
- void glVertex3fv(const GLfloat *v);
- void glVertex3f(GLfloat x, GLfloat y, GLfloat z);
- void glVertex3dv(const GLdouble *v);
- void glVertex3d(GLdouble x, GLdouble y, GLdouble z);
- void glVertex2sv(const GLshort *v);
- void glVertex2s(GLshort x, GLshort y);
- void glVertex2iv(const GLint *v);
- void glVertex2i(GLint x, GLint y);
- void glVertex2fv(const GLfloat *v);
- void glVertex2f(GLfloat x, GLfloat y);
- void glVertex2dv(const GLdouble *v);
- void glVertex2d(GLdouble x, GLdouble y);
- void glTexCoord4sv(const GLshort *v);
- void glTexCoord4s(GLshort s, GLshort t, GLshort r, GLshort q);
- void glTexCoord4iv(const GLint *v);
- void glTexCoord4i(GLint s, GLint t, GLint r, GLint q);
- void glTexCoord4fv(const GLfloat *v);
- void glTexCoord4f(GLfloat s, GLfloat t, GLfloat r, GLfloat q);
- void glTexCoord4dv(const GLdouble *v);
- void glTexCoord4d(GLdouble s, GLdouble t, GLdouble r, GLdouble q);
- void glTexCoord3sv(const GLshort *v);
- void glTexCoord3s(GLshort s, GLshort t, GLshort r);
- void glTexCoord3iv(const GLint *v);
- void glTexCoord3i(GLint s, GLint t, GLint r);
- void glTexCoord3fv(const GLfloat *v);
- void glTexCoord3f(GLfloat s, GLfloat t, GLfloat r);
- void glTexCoord3dv(const GLdouble *v);
- void glTexCoord3d(GLdouble s, GLdouble t, GLdouble r);
- void glTexCoord2sv(const GLshort *v);
- void glTexCoord2s(GLshort s, GLshort t);
- void glTexCoord2iv(const GLint *v);
- void glTexCoord2i(GLint s, GLint t);
- void glTexCoord2fv(const GLfloat *v);
- void glTexCoord2f(GLfloat s, GLfloat t);
- void glTexCoord2dv(const GLdouble *v);
- void glTexCoord2d(GLdouble s, GLdouble t);
- void glTexCoord1sv(const GLshort *v);
- void glTexCoord1s(GLshort s);
- void glTexCoord1iv(const GLint *v);
- void glTexCoord1i(GLint s);
- void glTexCoord1fv(const GLfloat *v);
- void glTexCoord1f(GLfloat s);
- void glTexCoord1dv(const GLdouble *v);
- void glTexCoord1d(GLdouble s);
- void glRectsv(const GLshort *v1, const GLshort *v2);
- void glRects(GLshort x1, GLshort y1, GLshort x2, GLshort y2);
- void glRectiv(const GLint *v1, const GLint *v2);
- void glRecti(GLint x1, GLint y1, GLint x2, GLint y2);
- void glRectfv(const GLfloat *v1, const GLfloat *v2);
- void glRectf(GLfloat x1, GLfloat y1, GLfloat x2, GLfloat y2);
- void glRectdv(const GLdouble *v1, const GLdouble *v2);
- void glRectd(GLdouble x1, GLdouble y1, GLdouble x2, GLdouble y2);
- void glRasterPos4sv(const GLshort *v);
- void glRasterPos4s(GLshort x, GLshort y, GLshort z, GLshort w);
- void glRasterPos4iv(const GLint *v);
- void glRasterPos4i(GLint x, GLint y, GLint z, GLint w);
- void glRasterPos4fv(const GLfloat *v);
- void glRasterPos4f(GLfloat x, GLfloat y, GLfloat z, GLfloat w);
- void glRasterPos4dv(const GLdouble *v);
- void glRasterPos4d(GLdouble x, GLdouble y, GLdouble z, GLdouble w);
- void glRasterPos3sv(const GLshort *v);
- void glRasterPos3s(GLshort x, GLshort y, GLshort z);
- void glRasterPos3iv(const GLint *v);
- void glRasterPos3i(GLint x, GLint y, GLint z);
- void glRasterPos3fv(const GLfloat *v);
- void glRasterPos3f(GLfloat x, GLfloat y, GLfloat z);
- void glRasterPos3dv(const GLdouble *v);
- void glRasterPos3d(GLdouble x, GLdouble y, GLdouble z);
- void glRasterPos2sv(const GLshort *v);
- void glRasterPos2s(GLshort x, GLshort y);
- void glRasterPos2iv(const GLint *v);
- void glRasterPos2i(GLint x, GLint y);
- void glRasterPos2fv(const GLfloat *v);
- void glRasterPos2f(GLfloat x, GLfloat y);
- void glRasterPos2dv(const GLdouble *v);
- void glRasterPos2d(GLdouble x, GLdouble y);
- void glNormal3sv(const GLshort *v);
- void glNormal3s(GLshort nx, GLshort ny, GLshort nz);
- void glNormal3iv(const GLint *v);
- void glNormal3i(GLint nx, GLint ny, GLint nz);
- void glNormal3fv(const GLfloat *v);
- void glNormal3f(GLfloat nx, GLfloat ny, GLfloat nz);
- void glNormal3dv(const GLdouble *v);
- void glNormal3d(GLdouble nx, GLdouble ny, GLdouble nz);
- void glNormal3bv(const GLbyte *v);
- void glNormal3b(GLbyte nx, GLbyte ny, GLbyte nz);
- void glIndexsv(const GLshort *c);
- void glIndexs(GLshort c);
- void glIndexiv(const GLint *c);
- void glIndexi(GLint c);
- void glIndexfv(const GLfloat *c);
- void glIndexf(GLfloat c);
- void glIndexdv(const GLdouble *c);
- void glIndexd(GLdouble c);
- void glEnd();
- void glEdgeFlagv(const GLboolean *flag);
- void glEdgeFlag(GLboolean flag);
- void glColor4usv(const GLushort *v);
- void glColor4us(GLushort red, GLushort green, GLushort blue, GLushort alpha);
- void glColor4uiv(const GLuint *v);
- void glColor4ui(GLuint red, GLuint green, GLuint blue, GLuint alpha);
- void glColor4ubv(const GLubyte *v);
- void glColor4ub(GLubyte red, GLubyte green, GLubyte blue, GLubyte alpha);
- void glColor4sv(const GLshort *v);
- void glColor4s(GLshort red, GLshort green, GLshort blue, GLshort alpha);
- void glColor4iv(const GLint *v);
- void glColor4i(GLint red, GLint green, GLint blue, GLint alpha);
- void glColor4fv(const GLfloat *v);
- void glColor4f(GLfloat red, GLfloat green, GLfloat blue, GLfloat alpha);
- void glColor4dv(const GLdouble *v);
- void glColor4d(GLdouble red, GLdouble green, GLdouble blue, GLdouble alpha);
- void glColor4bv(const GLbyte *v);
- void glColor4b(GLbyte red, GLbyte green, GLbyte blue, GLbyte alpha);
- void glColor3usv(const GLushort *v);
- void glColor3us(GLushort red, GLushort green, GLushort blue);
- void glColor3uiv(const GLuint *v);
- void glColor3ui(GLuint red, GLuint green, GLuint blue);
- void glColor3ubv(const GLubyte *v);
- void glColor3ub(GLubyte red, GLubyte green, GLubyte blue);
- void glColor3sv(const GLshort *v);
- void glColor3s(GLshort red, GLshort green, GLshort blue);
- void glColor3iv(const GLint *v);
- void glColor3i(GLint red, GLint green, GLint blue);
- void glColor3fv(const GLfloat *v);
- void glColor3f(GLfloat red, GLfloat green, GLfloat blue);
- void glColor3dv(const GLdouble *v);
- void glColor3d(GLdouble red, GLdouble green, GLdouble blue);
- void glColor3bv(const GLbyte *v);
- void glColor3b(GLbyte red, GLbyte green, GLbyte blue);
- void glBitmap(GLsizei width, GLsizei height, GLfloat xorig, GLfloat yorig, GLfloat xmove, GLfloat ymove, const GLubyte *bitmap);
- void glBegin(GLenum mode);
- void glListBase(GLuint base);
- GLuint glGenLists(GLsizei range);
- void glDeleteLists(GLuint list, GLsizei range);
- void glCallLists(GLsizei n, GLenum type, const GLvoid *lists);
- void glCallList(GLuint list);
- void glEndList();
- void glNewList(GLuint list, GLenum mode);
-
- // OpenGL 1.1 deprecated functions
- void glPushClientAttrib(GLbitfield mask);
- void glPopClientAttrib();
- void glPrioritizeTextures(GLsizei n, const GLuint *textures, const GLfloat *priorities);
- GLboolean glAreTexturesResident(GLsizei n, const GLuint *textures, GLboolean *residences);
- void glVertexPointer(GLint size, GLenum type, GLsizei stride, const GLvoid *pointer);
- void glTexCoordPointer(GLint size, GLenum type, GLsizei stride, const GLvoid *pointer);
- void glNormalPointer(GLenum type, GLsizei stride, const GLvoid *pointer);
- void glInterleavedArrays(GLenum format, GLsizei stride, const GLvoid *pointer);
- void glIndexPointer(GLenum type, GLsizei stride, const GLvoid *pointer);
- void glEnableClientState(GLenum array);
- void glEdgeFlagPointer(GLsizei stride, const GLvoid *pointer);
- void glDisableClientState(GLenum array);
- void glColorPointer(GLint size, GLenum type, GLsizei stride, const GLvoid *pointer);
- void glArrayElement(GLint i);
-
- // OpenGL 1.2 deprecated functions
- void glResetMinmax(GLenum target);
- void glResetHistogram(GLenum target);
- void glMinmax(GLenum target, GLenum internalformat, GLboolean sink);
- void glHistogram(GLenum target, GLsizei width, GLenum internalformat, GLboolean sink);
- void glGetMinmaxParameteriv(GLenum target, GLenum pname, GLint *params);
- void glGetMinmaxParameterfv(GLenum target, GLenum pname, GLfloat *params);
- void glGetMinmax(GLenum target, GLboolean reset, GLenum format, GLenum type, GLvoid *values);
- void glGetHistogramParameteriv(GLenum target, GLenum pname, GLint *params);
- void glGetHistogramParameterfv(GLenum target, GLenum pname, GLfloat *params);
- void glGetHistogram(GLenum target, GLboolean reset, GLenum format, GLenum type, GLvoid *values);
- void glSeparableFilter2D(GLenum target, GLenum internalformat, GLsizei width, GLsizei height, GLenum format, GLenum type, const GLvoid *row, const GLvoid *column);
- void glGetSeparableFilter(GLenum target, GLenum format, GLenum type, GLvoid *row, GLvoid *column, GLvoid *span);
- void glGetConvolutionParameteriv(GLenum target, GLenum pname, GLint *params);
- void glGetConvolutionParameterfv(GLenum target, GLenum pname, GLfloat *params);
- void glGetConvolutionFilter(GLenum target, GLenum format, GLenum type, GLvoid *image);
- void glCopyConvolutionFilter2D(GLenum target, GLenum internalformat, GLint x, GLint y, GLsizei width, GLsizei height);
- void glCopyConvolutionFilter1D(GLenum target, GLenum internalformat, GLint x, GLint y, GLsizei width);
- void glConvolutionParameteriv(GLenum target, GLenum pname, const GLint *params);
- void glConvolutionParameteri(GLenum target, GLenum pname, GLint params);
- void glConvolutionParameterfv(GLenum target, GLenum pname, const GLfloat *params);
- void glConvolutionParameterf(GLenum target, GLenum pname, GLfloat params);
- void glConvolutionFilter2D(GLenum target, GLenum internalformat, GLsizei width, GLsizei height, GLenum format, GLenum type, const GLvoid *image);
- void glConvolutionFilter1D(GLenum target, GLenum internalformat, GLsizei width, GLenum format, GLenum type, const GLvoid *image);
- void glCopyColorSubTable(GLenum target, GLsizei start, GLint x, GLint y, GLsizei width);
- void glColorSubTable(GLenum target, GLsizei start, GLsizei count, GLenum format, GLenum type, const GLvoid *data);
- void glGetColorTableParameteriv(GLenum target, GLenum pname, GLint *params);
- void glGetColorTableParameterfv(GLenum target, GLenum pname, GLfloat *params);
- void glGetColorTable(GLenum target, GLenum format, GLenum type, GLvoid *table);
- void glCopyColorTable(GLenum target, GLenum internalformat, GLint x, GLint y, GLsizei width);
- void glColorTableParameteriv(GLenum target, GLenum pname, const GLint *params);
- void glColorTableParameterfv(GLenum target, GLenum pname, const GLfloat *params);
- void glColorTable(GLenum target, GLenum internalformat, GLsizei width, GLenum format, GLenum type, const GLvoid *table);
-
-private:
- friend class QOpenGLContext;
-
- static bool isContextCompatible(QOpenGLContext *context);
- static QOpenGLVersionProfile versionProfile();
-
- QOpenGLFunctions_1_0_CoreBackend* d_1_0_Core;
- QOpenGLFunctions_1_1_CoreBackend* d_1_1_Core;
- QOpenGLFunctions_1_2_CoreBackend* d_1_2_Core;
- QOpenGLFunctions_1_0_DeprecatedBackend* d_1_0_Deprecated;
- QOpenGLFunctions_1_1_DeprecatedBackend* d_1_1_Deprecated;
- QOpenGLFunctions_1_2_DeprecatedBackend* d_1_2_Deprecated;
-};
-
-// OpenGL 1.0 core functions
-inline void QOpenGLFunctions_1_2::glViewport(GLint x, GLint y, GLsizei width, GLsizei height)
-{
- d_1_0_Core->f.Viewport(x, y, width, height);
-}
-
-inline void QOpenGLFunctions_1_2::glDepthRange(GLdouble nearVal, GLdouble farVal)
-{
- d_1_0_Core->f.DepthRange(nearVal, farVal);
-}
-
-inline GLboolean QOpenGLFunctions_1_2::glIsEnabled(GLenum cap)
-{
- return d_1_0_Core->f.IsEnabled(cap);
-}
-
-inline void QOpenGLFunctions_1_2::glGetTexLevelParameteriv(GLenum target, GLint level, GLenum pname, GLint *params)
-{
- d_1_0_Core->f.GetTexLevelParameteriv(target, level, pname, params);
-}
-
-inline void QOpenGLFunctions_1_2::glGetTexLevelParameterfv(GLenum target, GLint level, GLenum pname, GLfloat *params)
-{
- d_1_0_Core->f.GetTexLevelParameterfv(target, level, pname, params);
-}
-
-inline void QOpenGLFunctions_1_2::glGetTexParameteriv(GLenum target, GLenum pname, GLint *params)
-{
- d_1_0_Core->f.GetTexParameteriv(target, pname, params);
-}
-
-inline void QOpenGLFunctions_1_2::glGetTexParameterfv(GLenum target, GLenum pname, GLfloat *params)
-{
- d_1_0_Core->f.GetTexParameterfv(target, pname, params);
-}
-
-inline void QOpenGLFunctions_1_2::glGetTexImage(GLenum target, GLint level, GLenum format, GLenum type, GLvoid *pixels)
-{
- d_1_0_Core->f.GetTexImage(target, level, format, type, pixels);
-}
-
-inline const GLubyte * QOpenGLFunctions_1_2::glGetString(GLenum name)
-{
- return d_1_0_Core->f.GetString(name);
-}
-
-inline void QOpenGLFunctions_1_2::glGetIntegerv(GLenum pname, GLint *params)
-{
- d_1_0_Core->f.GetIntegerv(pname, params);
-}
-
-inline void QOpenGLFunctions_1_2::glGetFloatv(GLenum pname, GLfloat *params)
-{
- d_1_0_Core->f.GetFloatv(pname, params);
-}
-
-inline GLenum QOpenGLFunctions_1_2::glGetError()
-{
- return d_1_0_Core->f.GetError();
-}
-
-inline void QOpenGLFunctions_1_2::glGetDoublev(GLenum pname, GLdouble *params)
-{
- d_1_0_Core->f.GetDoublev(pname, params);
-}
-
-inline void QOpenGLFunctions_1_2::glGetBooleanv(GLenum pname, GLboolean *params)
-{
- d_1_0_Core->f.GetBooleanv(pname, params);
-}
-
-inline void QOpenGLFunctions_1_2::glReadPixels(GLint x, GLint y, GLsizei width, GLsizei height, GLenum format, GLenum type, GLvoid *pixels)
-{
- d_1_0_Core->f.ReadPixels(x, y, width, height, format, type, pixels);
-}
-
-inline void QOpenGLFunctions_1_2::glReadBuffer(GLenum mode)
-{
- d_1_0_Core->f.ReadBuffer(mode);
-}
-
-inline void QOpenGLFunctions_1_2::glPixelStorei(GLenum pname, GLint param)
-{
- d_1_0_Core->f.PixelStorei(pname, param);
-}
-
-inline void QOpenGLFunctions_1_2::glPixelStoref(GLenum pname, GLfloat param)
-{
- d_1_0_Core->f.PixelStoref(pname, param);
-}
-
-inline void QOpenGLFunctions_1_2::glDepthFunc(GLenum func)
-{
- d_1_0_Core->f.DepthFunc(func);
-}
-
-inline void QOpenGLFunctions_1_2::glStencilOp(GLenum fail, GLenum zfail, GLenum zpass)
-{
- d_1_0_Core->f.StencilOp(fail, zfail, zpass);
-}
-
-inline void QOpenGLFunctions_1_2::glStencilFunc(GLenum func, GLint ref, GLuint mask)
-{
- d_1_0_Core->f.StencilFunc(func, ref, mask);
-}
-
-inline void QOpenGLFunctions_1_2::glLogicOp(GLenum opcode)
-{
- d_1_0_Core->f.LogicOp(opcode);
-}
-
-inline void QOpenGLFunctions_1_2::glBlendFunc(GLenum sfactor, GLenum dfactor)
-{
- d_1_0_Core->f.BlendFunc(sfactor, dfactor);
-}
-
-inline void QOpenGLFunctions_1_2::glFlush()
-{
- d_1_0_Core->f.Flush();
-}
-
-inline void QOpenGLFunctions_1_2::glFinish()
-{
- d_1_0_Core->f.Finish();
-}
-
-inline void QOpenGLFunctions_1_2::glEnable(GLenum cap)
-{
- d_1_0_Core->f.Enable(cap);
-}
-
-inline void QOpenGLFunctions_1_2::glDisable(GLenum cap)
-{
- d_1_0_Core->f.Disable(cap);
-}
-
-inline void QOpenGLFunctions_1_2::glDepthMask(GLboolean flag)
-{
- d_1_0_Core->f.DepthMask(flag);
-}
-
-inline void QOpenGLFunctions_1_2::glColorMask(GLboolean red, GLboolean green, GLboolean blue, GLboolean alpha)
-{
- d_1_0_Core->f.ColorMask(red, green, blue, alpha);
-}
-
-inline void QOpenGLFunctions_1_2::glStencilMask(GLuint mask)
-{
- d_1_0_Core->f.StencilMask(mask);
-}
-
-inline void QOpenGLFunctions_1_2::glClearDepth(GLdouble depth)
-{
- d_1_0_Core->f.ClearDepth(depth);
-}
-
-inline void QOpenGLFunctions_1_2::glClearStencil(GLint s)
-{
- d_1_0_Core->f.ClearStencil(s);
-}
-
-inline void QOpenGLFunctions_1_2::glClearColor(GLfloat red, GLfloat green, GLfloat blue, GLfloat alpha)
-{
- d_1_0_Core->f.ClearColor(red, green, blue, alpha);
-}
-
-inline void QOpenGLFunctions_1_2::glClear(GLbitfield mask)
-{
- d_1_0_Core->f.Clear(mask);
-}
-
-inline void QOpenGLFunctions_1_2::glDrawBuffer(GLenum mode)
-{
- d_1_0_Core->f.DrawBuffer(mode);
-}
-
-inline void QOpenGLFunctions_1_2::glTexImage2D(GLenum target, GLint level, GLint internalformat, GLsizei width, GLsizei height, GLint border, GLenum format, GLenum type, const GLvoid *pixels)
-{
- d_1_0_Core->f.TexImage2D(target, level, internalformat, width, height, border, format, type, pixels);
-}
-
-inline void QOpenGLFunctions_1_2::glTexImage1D(GLenum target, GLint level, GLint internalformat, GLsizei width, GLint border, GLenum format, GLenum type, const GLvoid *pixels)
-{
- d_1_0_Core->f.TexImage1D(target, level, internalformat, width, border, format, type, pixels);
-}
-
-inline void QOpenGLFunctions_1_2::glTexParameteriv(GLenum target, GLenum pname, const GLint *params)
-{
- d_1_0_Core->f.TexParameteriv(target, pname, params);
-}
-
-inline void QOpenGLFunctions_1_2::glTexParameteri(GLenum target, GLenum pname, GLint param)
-{
- d_1_0_Core->f.TexParameteri(target, pname, param);
-}
-
-inline void QOpenGLFunctions_1_2::glTexParameterfv(GLenum target, GLenum pname, const GLfloat *params)
-{
- d_1_0_Core->f.TexParameterfv(target, pname, params);
-}
-
-inline void QOpenGLFunctions_1_2::glTexParameterf(GLenum target, GLenum pname, GLfloat param)
-{
- d_1_0_Core->f.TexParameterf(target, pname, param);
-}
-
-inline void QOpenGLFunctions_1_2::glScissor(GLint x, GLint y, GLsizei width, GLsizei height)
-{
- d_1_0_Core->f.Scissor(x, y, width, height);
-}
-
-inline void QOpenGLFunctions_1_2::glPolygonMode(GLenum face, GLenum mode)
-{
- d_1_0_Core->f.PolygonMode(face, mode);
-}
-
-inline void QOpenGLFunctions_1_2::glPointSize(GLfloat size)
-{
- d_1_0_Core->f.PointSize(size);
-}
-
-inline void QOpenGLFunctions_1_2::glLineWidth(GLfloat width)
-{
- d_1_0_Core->f.LineWidth(width);
-}
-
-inline void QOpenGLFunctions_1_2::glHint(GLenum target, GLenum mode)
-{
- d_1_0_Core->f.Hint(target, mode);
-}
-
-inline void QOpenGLFunctions_1_2::glFrontFace(GLenum mode)
-{
- d_1_0_Core->f.FrontFace(mode);
-}
-
-inline void QOpenGLFunctions_1_2::glCullFace(GLenum mode)
-{
- d_1_0_Core->f.CullFace(mode);
-}
-
-
-// OpenGL 1.1 core functions
-inline void QOpenGLFunctions_1_2::glIndexubv(const GLubyte *c)
-{
- d_1_1_Deprecated->f.Indexubv(c);
-}
-
-inline void QOpenGLFunctions_1_2::glIndexub(GLubyte c)
-{
- d_1_1_Deprecated->f.Indexub(c);
-}
-
-inline GLboolean QOpenGLFunctions_1_2::glIsTexture(GLuint texture)
-{
- return d_1_1_Core->f.IsTexture(texture);
-}
-
-inline void QOpenGLFunctions_1_2::glGenTextures(GLsizei n, GLuint *textures)
-{
- d_1_1_Core->f.GenTextures(n, textures);
-}
-
-inline void QOpenGLFunctions_1_2::glDeleteTextures(GLsizei n, const GLuint *textures)
-{
- d_1_1_Core->f.DeleteTextures(n, textures);
-}
-
-inline void QOpenGLFunctions_1_2::glBindTexture(GLenum target, GLuint texture)
-{
- d_1_1_Core->f.BindTexture(target, texture);
-}
-
-inline void QOpenGLFunctions_1_2::glTexSubImage2D(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLenum type, const GLvoid *pixels)
-{
- d_1_1_Core->f.TexSubImage2D(target, level, xoffset, yoffset, width, height, format, type, pixels);
-}
-
-inline void QOpenGLFunctions_1_2::glTexSubImage1D(GLenum target, GLint level, GLint xoffset, GLsizei width, GLenum format, GLenum type, const GLvoid *pixels)
-{
- d_1_1_Core->f.TexSubImage1D(target, level, xoffset, width, format, type, pixels);
-}
-
-inline void QOpenGLFunctions_1_2::glCopyTexSubImage2D(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint x, GLint y, GLsizei width, GLsizei height)
-{
- d_1_1_Core->f.CopyTexSubImage2D(target, level, xoffset, yoffset, x, y, width, height);
-}
-
-inline void QOpenGLFunctions_1_2::glCopyTexSubImage1D(GLenum target, GLint level, GLint xoffset, GLint x, GLint y, GLsizei width)
-{
- d_1_1_Core->f.CopyTexSubImage1D(target, level, xoffset, x, y, width);
-}
-
-inline void QOpenGLFunctions_1_2::glCopyTexImage2D(GLenum target, GLint level, GLenum internalformat, GLint x, GLint y, GLsizei width, GLsizei height, GLint border)
-{
- d_1_1_Core->f.CopyTexImage2D(target, level, internalformat, x, y, width, height, border);
-}
-
-inline void QOpenGLFunctions_1_2::glCopyTexImage1D(GLenum target, GLint level, GLenum internalformat, GLint x, GLint y, GLsizei width, GLint border)
-{
- d_1_1_Core->f.CopyTexImage1D(target, level, internalformat, x, y, width, border);
-}
-
-inline void QOpenGLFunctions_1_2::glPolygonOffset(GLfloat factor, GLfloat units)
-{
- d_1_1_Core->f.PolygonOffset(factor, units);
-}
-
-inline void QOpenGLFunctions_1_2::glGetPointerv(GLenum pname, GLvoid* *params)
-{
- d_1_1_Deprecated->f.GetPointerv(pname, params);
-}
-
-inline void QOpenGLFunctions_1_2::glDrawElements(GLenum mode, GLsizei count, GLenum type, const GLvoid *indices)
-{
- d_1_1_Core->f.DrawElements(mode, count, type, indices);
-}
-
-inline void QOpenGLFunctions_1_2::glDrawArrays(GLenum mode, GLint first, GLsizei count)
-{
- d_1_1_Core->f.DrawArrays(mode, first, count);
-}
-
-
-// OpenGL 1.2 core functions
-inline void QOpenGLFunctions_1_2::glCopyTexSubImage3D(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLint x, GLint y, GLsizei width, GLsizei height)
-{
- d_1_2_Core->f.CopyTexSubImage3D(target, level, xoffset, yoffset, zoffset, x, y, width, height);
-}
-
-inline void QOpenGLFunctions_1_2::glTexSubImage3D(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLenum type, const GLvoid *pixels)
-{
- d_1_2_Core->f.TexSubImage3D(target, level, xoffset, yoffset, zoffset, width, height, depth, format, type, pixels);
-}
-
-inline void QOpenGLFunctions_1_2::glTexImage3D(GLenum target, GLint level, GLint internalformat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLenum format, GLenum type, const GLvoid *pixels)
-{
- d_1_2_Core->f.TexImage3D(target, level, internalformat, width, height, depth, border, format, type, pixels);
-}
-
-inline void QOpenGLFunctions_1_2::glDrawRangeElements(GLenum mode, GLuint start, GLuint end, GLsizei count, GLenum type, const GLvoid *indices)
-{
- d_1_2_Core->f.DrawRangeElements(mode, start, end, count, type, indices);
-}
-
-inline void QOpenGLFunctions_1_2::glBlendEquation(GLenum mode)
-{
- d_1_2_Core->f.BlendEquation(mode);
-}
-
-inline void QOpenGLFunctions_1_2::glBlendColor(GLfloat red, GLfloat green, GLfloat blue, GLfloat alpha)
-{
- d_1_2_Core->f.BlendColor(red, green, blue, alpha);
-}
-
-
-// OpenGL 1.0 deprecated functions
-inline void QOpenGLFunctions_1_2::glTranslatef(GLfloat x, GLfloat y, GLfloat z)
-{
- d_1_0_Deprecated->f.Translatef(x, y, z);
-}
-
-inline void QOpenGLFunctions_1_2::glTranslated(GLdouble x, GLdouble y, GLdouble z)
-{
- d_1_0_Deprecated->f.Translated(x, y, z);
-}
-
-inline void QOpenGLFunctions_1_2::glScalef(GLfloat x, GLfloat y, GLfloat z)
-{
- d_1_0_Deprecated->f.Scalef(x, y, z);
-}
-
-inline void QOpenGLFunctions_1_2::glScaled(GLdouble x, GLdouble y, GLdouble z)
-{
- d_1_0_Deprecated->f.Scaled(x, y, z);
-}
-
-inline void QOpenGLFunctions_1_2::glRotatef(GLfloat angle, GLfloat x, GLfloat y, GLfloat z)
-{
- d_1_0_Deprecated->f.Rotatef(angle, x, y, z);
-}
-
-inline void QOpenGLFunctions_1_2::glRotated(GLdouble angle, GLdouble x, GLdouble y, GLdouble z)
-{
- d_1_0_Deprecated->f.Rotated(angle, x, y, z);
-}
-
-inline void QOpenGLFunctions_1_2::glPushMatrix()
-{
- d_1_0_Deprecated->f.PushMatrix();
-}
-
-inline void QOpenGLFunctions_1_2::glPopMatrix()
-{
- d_1_0_Deprecated->f.PopMatrix();
-}
-
-inline void QOpenGLFunctions_1_2::glOrtho(GLdouble left, GLdouble right, GLdouble bottom, GLdouble top, GLdouble zNear, GLdouble zFar)
-{
- d_1_0_Deprecated->f.Ortho(left, right, bottom, top, zNear, zFar);
-}
-
-inline void QOpenGLFunctions_1_2::glMultMatrixd(const GLdouble *m)
-{
- d_1_0_Deprecated->f.MultMatrixd(m);
-}
-
-inline void QOpenGLFunctions_1_2::glMultMatrixf(const GLfloat *m)
-{
- d_1_0_Deprecated->f.MultMatrixf(m);
-}
-
-inline void QOpenGLFunctions_1_2::glMatrixMode(GLenum mode)
-{
- d_1_0_Deprecated->f.MatrixMode(mode);
-}
-
-inline void QOpenGLFunctions_1_2::glLoadMatrixd(const GLdouble *m)
-{
- d_1_0_Deprecated->f.LoadMatrixd(m);
-}
-
-inline void QOpenGLFunctions_1_2::glLoadMatrixf(const GLfloat *m)
-{
- d_1_0_Deprecated->f.LoadMatrixf(m);
-}
-
-inline void QOpenGLFunctions_1_2::glLoadIdentity()
-{
- d_1_0_Deprecated->f.LoadIdentity();
-}
-
-inline void QOpenGLFunctions_1_2::glFrustum(GLdouble left, GLdouble right, GLdouble bottom, GLdouble top, GLdouble zNear, GLdouble zFar)
-{
- d_1_0_Deprecated->f.Frustum(left, right, bottom, top, zNear, zFar);
-}
-
-inline GLboolean QOpenGLFunctions_1_2::glIsList(GLuint list)
-{
- return d_1_0_Deprecated->f.IsList(list);
-}
-
-inline void QOpenGLFunctions_1_2::glGetTexGeniv(GLenum coord, GLenum pname, GLint *params)
-{
- d_1_0_Deprecated->f.GetTexGeniv(coord, pname, params);
-}
-
-inline void QOpenGLFunctions_1_2::glGetTexGenfv(GLenum coord, GLenum pname, GLfloat *params)
-{
- d_1_0_Deprecated->f.GetTexGenfv(coord, pname, params);
-}
-
-inline void QOpenGLFunctions_1_2::glGetTexGendv(GLenum coord, GLenum pname, GLdouble *params)
-{
- d_1_0_Deprecated->f.GetTexGendv(coord, pname, params);
-}
-
-inline void QOpenGLFunctions_1_2::glGetTexEnviv(GLenum target, GLenum pname, GLint *params)
-{
- d_1_0_Deprecated->f.GetTexEnviv(target, pname, params);
-}
-
-inline void QOpenGLFunctions_1_2::glGetTexEnvfv(GLenum target, GLenum pname, GLfloat *params)
-{
- d_1_0_Deprecated->f.GetTexEnvfv(target, pname, params);
-}
-
-inline void QOpenGLFunctions_1_2::glGetPolygonStipple(GLubyte *mask)
-{
- d_1_0_Deprecated->f.GetPolygonStipple(mask);
-}
-
-inline void QOpenGLFunctions_1_2::glGetPixelMapusv(GLenum map, GLushort *values)
-{
- d_1_0_Deprecated->f.GetPixelMapusv(map, values);
-}
-
-inline void QOpenGLFunctions_1_2::glGetPixelMapuiv(GLenum map, GLuint *values)
-{
- d_1_0_Deprecated->f.GetPixelMapuiv(map, values);
-}
-
-inline void QOpenGLFunctions_1_2::glGetPixelMapfv(GLenum map, GLfloat *values)
-{
- d_1_0_Deprecated->f.GetPixelMapfv(map, values);
-}
-
-inline void QOpenGLFunctions_1_2::glGetMaterialiv(GLenum face, GLenum pname, GLint *params)
-{
- d_1_0_Deprecated->f.GetMaterialiv(face, pname, params);
-}
-
-inline void QOpenGLFunctions_1_2::glGetMaterialfv(GLenum face, GLenum pname, GLfloat *params)
-{
- d_1_0_Deprecated->f.GetMaterialfv(face, pname, params);
-}
-
-inline void QOpenGLFunctions_1_2::glGetMapiv(GLenum target, GLenum query, GLint *v)
-{
- d_1_0_Deprecated->f.GetMapiv(target, query, v);
-}
-
-inline void QOpenGLFunctions_1_2::glGetMapfv(GLenum target, GLenum query, GLfloat *v)
-{
- d_1_0_Deprecated->f.GetMapfv(target, query, v);
-}
-
-inline void QOpenGLFunctions_1_2::glGetMapdv(GLenum target, GLenum query, GLdouble *v)
-{
- d_1_0_Deprecated->f.GetMapdv(target, query, v);
-}
-
-inline void QOpenGLFunctions_1_2::glGetLightiv(GLenum light, GLenum pname, GLint *params)
-{
- d_1_0_Deprecated->f.GetLightiv(light, pname, params);
-}
-
-inline void QOpenGLFunctions_1_2::glGetLightfv(GLenum light, GLenum pname, GLfloat *params)
-{
- d_1_0_Deprecated->f.GetLightfv(light, pname, params);
-}
-
-inline void QOpenGLFunctions_1_2::glGetClipPlane(GLenum plane, GLdouble *equation)
-{
- d_1_0_Deprecated->f.GetClipPlane(plane, equation);
-}
-
-inline void QOpenGLFunctions_1_2::glDrawPixels(GLsizei width, GLsizei height, GLenum format, GLenum type, const GLvoid *pixels)
-{
- d_1_0_Deprecated->f.DrawPixels(width, height, format, type, pixels);
-}
-
-inline void QOpenGLFunctions_1_2::glCopyPixels(GLint x, GLint y, GLsizei width, GLsizei height, GLenum type)
-{
- d_1_0_Deprecated->f.CopyPixels(x, y, width, height, type);
-}
-
-inline void QOpenGLFunctions_1_2::glPixelMapusv(GLenum map, GLint mapsize, const GLushort *values)
-{
- d_1_0_Deprecated->f.PixelMapusv(map, mapsize, values);
-}
-
-inline void QOpenGLFunctions_1_2::glPixelMapuiv(GLenum map, GLint mapsize, const GLuint *values)
-{
- d_1_0_Deprecated->f.PixelMapuiv(map, mapsize, values);
-}
-
-inline void QOpenGLFunctions_1_2::glPixelMapfv(GLenum map, GLint mapsize, const GLfloat *values)
-{
- d_1_0_Deprecated->f.PixelMapfv(map, mapsize, values);
-}
-
-inline void QOpenGLFunctions_1_2::glPixelTransferi(GLenum pname, GLint param)
-{
- d_1_0_Deprecated->f.PixelTransferi(pname, param);
-}
-
-inline void QOpenGLFunctions_1_2::glPixelTransferf(GLenum pname, GLfloat param)
-{
- d_1_0_Deprecated->f.PixelTransferf(pname, param);
-}
-
-inline void QOpenGLFunctions_1_2::glPixelZoom(GLfloat xfactor, GLfloat yfactor)
-{
- d_1_0_Deprecated->f.PixelZoom(xfactor, yfactor);
-}
-
-inline void QOpenGLFunctions_1_2::glAlphaFunc(GLenum func, GLfloat ref)
-{
- d_1_0_Deprecated->f.AlphaFunc(func, ref);
-}
-
-inline void QOpenGLFunctions_1_2::glEvalPoint2(GLint i, GLint j)
-{
- d_1_0_Deprecated->f.EvalPoint2(i, j);
-}
-
-inline void QOpenGLFunctions_1_2::glEvalMesh2(GLenum mode, GLint i1, GLint i2, GLint j1, GLint j2)
-{
- d_1_0_Deprecated->f.EvalMesh2(mode, i1, i2, j1, j2);
-}
-
-inline void QOpenGLFunctions_1_2::glEvalPoint1(GLint i)
-{
- d_1_0_Deprecated->f.EvalPoint1(i);
-}
-
-inline void QOpenGLFunctions_1_2::glEvalMesh1(GLenum mode, GLint i1, GLint i2)
-{
- d_1_0_Deprecated->f.EvalMesh1(mode, i1, i2);
-}
-
-inline void QOpenGLFunctions_1_2::glEvalCoord2fv(const GLfloat *u)
-{
- d_1_0_Deprecated->f.EvalCoord2fv(u);
-}
-
-inline void QOpenGLFunctions_1_2::glEvalCoord2f(GLfloat u, GLfloat v)
-{
- d_1_0_Deprecated->f.EvalCoord2f(u, v);
-}
-
-inline void QOpenGLFunctions_1_2::glEvalCoord2dv(const GLdouble *u)
-{
- d_1_0_Deprecated->f.EvalCoord2dv(u);
-}
-
-inline void QOpenGLFunctions_1_2::glEvalCoord2d(GLdouble u, GLdouble v)
-{
- d_1_0_Deprecated->f.EvalCoord2d(u, v);
-}
-
-inline void QOpenGLFunctions_1_2::glEvalCoord1fv(const GLfloat *u)
-{
- d_1_0_Deprecated->f.EvalCoord1fv(u);
-}
-
-inline void QOpenGLFunctions_1_2::glEvalCoord1f(GLfloat u)
-{
- d_1_0_Deprecated->f.EvalCoord1f(u);
-}
-
-inline void QOpenGLFunctions_1_2::glEvalCoord1dv(const GLdouble *u)
-{
- d_1_0_Deprecated->f.EvalCoord1dv(u);
-}
-
-inline void QOpenGLFunctions_1_2::glEvalCoord1d(GLdouble u)
-{
- d_1_0_Deprecated->f.EvalCoord1d(u);
-}
-
-inline void QOpenGLFunctions_1_2::glMapGrid2f(GLint un, GLfloat u1, GLfloat u2, GLint vn, GLfloat v1, GLfloat v2)
-{
- d_1_0_Deprecated->f.MapGrid2f(un, u1, u2, vn, v1, v2);
-}
-
-inline void QOpenGLFunctions_1_2::glMapGrid2d(GLint un, GLdouble u1, GLdouble u2, GLint vn, GLdouble v1, GLdouble v2)
-{
- d_1_0_Deprecated->f.MapGrid2d(un, u1, u2, vn, v1, v2);
-}
-
-inline void QOpenGLFunctions_1_2::glMapGrid1f(GLint un, GLfloat u1, GLfloat u2)
-{
- d_1_0_Deprecated->f.MapGrid1f(un, u1, u2);
-}
-
-inline void QOpenGLFunctions_1_2::glMapGrid1d(GLint un, GLdouble u1, GLdouble u2)
-{
- d_1_0_Deprecated->f.MapGrid1d(un, u1, u2);
-}
-
-inline void QOpenGLFunctions_1_2::glMap2f(GLenum target, GLfloat u1, GLfloat u2, GLint ustride, GLint uorder, GLfloat v1, GLfloat v2, GLint vstride, GLint vorder, const GLfloat *points)
-{
- d_1_0_Deprecated->f.Map2f(target, u1, u2, ustride, uorder, v1, v2, vstride, vorder, points);
-}
-
-inline void QOpenGLFunctions_1_2::glMap2d(GLenum target, GLdouble u1, GLdouble u2, GLint ustride, GLint uorder, GLdouble v1, GLdouble v2, GLint vstride, GLint vorder, const GLdouble *points)
-{
- d_1_0_Deprecated->f.Map2d(target, u1, u2, ustride, uorder, v1, v2, vstride, vorder, points);
-}
-
-inline void QOpenGLFunctions_1_2::glMap1f(GLenum target, GLfloat u1, GLfloat u2, GLint stride, GLint order, const GLfloat *points)
-{
- d_1_0_Deprecated->f.Map1f(target, u1, u2, stride, order, points);
-}
-
-inline void QOpenGLFunctions_1_2::glMap1d(GLenum target, GLdouble u1, GLdouble u2, GLint stride, GLint order, const GLdouble *points)
-{
- d_1_0_Deprecated->f.Map1d(target, u1, u2, stride, order, points);
-}
-
-inline void QOpenGLFunctions_1_2::glPushAttrib(GLbitfield mask)
-{
- d_1_0_Deprecated->f.PushAttrib(mask);
-}
-
-inline void QOpenGLFunctions_1_2::glPopAttrib()
-{
- d_1_0_Deprecated->f.PopAttrib();
-}
-
-inline void QOpenGLFunctions_1_2::glAccum(GLenum op, GLfloat value)
-{
- d_1_0_Deprecated->f.Accum(op, value);
-}
-
-inline void QOpenGLFunctions_1_2::glIndexMask(GLuint mask)
-{
- d_1_0_Deprecated->f.IndexMask(mask);
-}
-
-inline void QOpenGLFunctions_1_2::glClearIndex(GLfloat c)
-{
- d_1_0_Deprecated->f.ClearIndex(c);
-}
-
-inline void QOpenGLFunctions_1_2::glClearAccum(GLfloat red, GLfloat green, GLfloat blue, GLfloat alpha)
-{
- d_1_0_Deprecated->f.ClearAccum(red, green, blue, alpha);
-}
-
-inline void QOpenGLFunctions_1_2::glPushName(GLuint name)
-{
- d_1_0_Deprecated->f.PushName(name);
-}
-
-inline void QOpenGLFunctions_1_2::glPopName()
-{
- d_1_0_Deprecated->f.PopName();
-}
-
-inline void QOpenGLFunctions_1_2::glPassThrough(GLfloat token)
-{
- d_1_0_Deprecated->f.PassThrough(token);
-}
-
-inline void QOpenGLFunctions_1_2::glLoadName(GLuint name)
-{
- d_1_0_Deprecated->f.LoadName(name);
-}
-
-inline void QOpenGLFunctions_1_2::glInitNames()
-{
- d_1_0_Deprecated->f.InitNames();
-}
-
-inline GLint QOpenGLFunctions_1_2::glRenderMode(GLenum mode)
-{
- return d_1_0_Deprecated->f.RenderMode(mode);
-}
-
-inline void QOpenGLFunctions_1_2::glSelectBuffer(GLsizei size, GLuint *buffer)
-{
- d_1_0_Deprecated->f.SelectBuffer(size, buffer);
-}
-
-inline void QOpenGLFunctions_1_2::glFeedbackBuffer(GLsizei size, GLenum type, GLfloat *buffer)
-{
- d_1_0_Deprecated->f.FeedbackBuffer(size, type, buffer);
-}
-
-inline void QOpenGLFunctions_1_2::glTexGeniv(GLenum coord, GLenum pname, const GLint *params)
-{
- d_1_0_Deprecated->f.TexGeniv(coord, pname, params);
-}
-
-inline void QOpenGLFunctions_1_2::glTexGeni(GLenum coord, GLenum pname, GLint param)
-{
- d_1_0_Deprecated->f.TexGeni(coord, pname, param);
-}
-
-inline void QOpenGLFunctions_1_2::glTexGenfv(GLenum coord, GLenum pname, const GLfloat *params)
-{
- d_1_0_Deprecated->f.TexGenfv(coord, pname, params);
-}
-
-inline void QOpenGLFunctions_1_2::glTexGenf(GLenum coord, GLenum pname, GLfloat param)
-{
- d_1_0_Deprecated->f.TexGenf(coord, pname, param);
-}
-
-inline void QOpenGLFunctions_1_2::glTexGendv(GLenum coord, GLenum pname, const GLdouble *params)
-{
- d_1_0_Deprecated->f.TexGendv(coord, pname, params);
-}
-
-inline void QOpenGLFunctions_1_2::glTexGend(GLenum coord, GLenum pname, GLdouble param)
-{
- d_1_0_Deprecated->f.TexGend(coord, pname, param);
-}
-
-inline void QOpenGLFunctions_1_2::glTexEnviv(GLenum target, GLenum pname, const GLint *params)
-{
- d_1_0_Deprecated->f.TexEnviv(target, pname, params);
-}
-
-inline void QOpenGLFunctions_1_2::glTexEnvi(GLenum target, GLenum pname, GLint param)
-{
- d_1_0_Deprecated->f.TexEnvi(target, pname, param);
-}
-
-inline void QOpenGLFunctions_1_2::glTexEnvfv(GLenum target, GLenum pname, const GLfloat *params)
-{
- d_1_0_Deprecated->f.TexEnvfv(target, pname, params);
-}
-
-inline void QOpenGLFunctions_1_2::glTexEnvf(GLenum target, GLenum pname, GLfloat param)
-{
- d_1_0_Deprecated->f.TexEnvf(target, pname, param);
-}
-
-inline void QOpenGLFunctions_1_2::glShadeModel(GLenum mode)
-{
- d_1_0_Deprecated->f.ShadeModel(mode);
-}
-
-inline void QOpenGLFunctions_1_2::glPolygonStipple(const GLubyte *mask)
-{
- d_1_0_Deprecated->f.PolygonStipple(mask);
-}
-
-inline void QOpenGLFunctions_1_2::glMaterialiv(GLenum face, GLenum pname, const GLint *params)
-{
- d_1_0_Deprecated->f.Materialiv(face, pname, params);
-}
-
-inline void QOpenGLFunctions_1_2::glMateriali(GLenum face, GLenum pname, GLint param)
-{
- d_1_0_Deprecated->f.Materiali(face, pname, param);
-}
-
-inline void QOpenGLFunctions_1_2::glMaterialfv(GLenum face, GLenum pname, const GLfloat *params)
-{
- d_1_0_Deprecated->f.Materialfv(face, pname, params);
-}
-
-inline void QOpenGLFunctions_1_2::glMaterialf(GLenum face, GLenum pname, GLfloat param)
-{
- d_1_0_Deprecated->f.Materialf(face, pname, param);
-}
-
-inline void QOpenGLFunctions_1_2::glLineStipple(GLint factor, GLushort pattern)
-{
- d_1_0_Deprecated->f.LineStipple(factor, pattern);
-}
-
-inline void QOpenGLFunctions_1_2::glLightModeliv(GLenum pname, const GLint *params)
-{
- d_1_0_Deprecated->f.LightModeliv(pname, params);
-}
-
-inline void QOpenGLFunctions_1_2::glLightModeli(GLenum pname, GLint param)
-{
- d_1_0_Deprecated->f.LightModeli(pname, param);
-}
-
-inline void QOpenGLFunctions_1_2::glLightModelfv(GLenum pname, const GLfloat *params)
-{
- d_1_0_Deprecated->f.LightModelfv(pname, params);
-}
-
-inline void QOpenGLFunctions_1_2::glLightModelf(GLenum pname, GLfloat param)
-{
- d_1_0_Deprecated->f.LightModelf(pname, param);
-}
-
-inline void QOpenGLFunctions_1_2::glLightiv(GLenum light, GLenum pname, const GLint *params)
-{
- d_1_0_Deprecated->f.Lightiv(light, pname, params);
-}
-
-inline void QOpenGLFunctions_1_2::glLighti(GLenum light, GLenum pname, GLint param)
-{
- d_1_0_Deprecated->f.Lighti(light, pname, param);
-}
-
-inline void QOpenGLFunctions_1_2::glLightfv(GLenum light, GLenum pname, const GLfloat *params)
-{
- d_1_0_Deprecated->f.Lightfv(light, pname, params);
-}
-
-inline void QOpenGLFunctions_1_2::glLightf(GLenum light, GLenum pname, GLfloat param)
-{
- d_1_0_Deprecated->f.Lightf(light, pname, param);
-}
-
-inline void QOpenGLFunctions_1_2::glFogiv(GLenum pname, const GLint *params)
-{
- d_1_0_Deprecated->f.Fogiv(pname, params);
-}
-
-inline void QOpenGLFunctions_1_2::glFogi(GLenum pname, GLint param)
-{
- d_1_0_Deprecated->f.Fogi(pname, param);
-}
-
-inline void QOpenGLFunctions_1_2::glFogfv(GLenum pname, const GLfloat *params)
-{
- d_1_0_Deprecated->f.Fogfv(pname, params);
-}
-
-inline void QOpenGLFunctions_1_2::glFogf(GLenum pname, GLfloat param)
-{
- d_1_0_Deprecated->f.Fogf(pname, param);
-}
-
-inline void QOpenGLFunctions_1_2::glColorMaterial(GLenum face, GLenum mode)
-{
- d_1_0_Deprecated->f.ColorMaterial(face, mode);
-}
-
-inline void QOpenGLFunctions_1_2::glClipPlane(GLenum plane, const GLdouble *equation)
-{
- d_1_0_Deprecated->f.ClipPlane(plane, equation);
-}
-
-inline void QOpenGLFunctions_1_2::glVertex4sv(const GLshort *v)
-{
- d_1_0_Deprecated->f.Vertex4sv(v);
-}
-
-inline void QOpenGLFunctions_1_2::glVertex4s(GLshort x, GLshort y, GLshort z, GLshort w)
-{
- d_1_0_Deprecated->f.Vertex4s(x, y, z, w);
-}
-
-inline void QOpenGLFunctions_1_2::glVertex4iv(const GLint *v)
-{
- d_1_0_Deprecated->f.Vertex4iv(v);
-}
-
-inline void QOpenGLFunctions_1_2::glVertex4i(GLint x, GLint y, GLint z, GLint w)
-{
- d_1_0_Deprecated->f.Vertex4i(x, y, z, w);
-}
-
-inline void QOpenGLFunctions_1_2::glVertex4fv(const GLfloat *v)
-{
- d_1_0_Deprecated->f.Vertex4fv(v);
-}
-
-inline void QOpenGLFunctions_1_2::glVertex4f(GLfloat x, GLfloat y, GLfloat z, GLfloat w)
-{
- d_1_0_Deprecated->f.Vertex4f(x, y, z, w);
-}
-
-inline void QOpenGLFunctions_1_2::glVertex4dv(const GLdouble *v)
-{
- d_1_0_Deprecated->f.Vertex4dv(v);
-}
-
-inline void QOpenGLFunctions_1_2::glVertex4d(GLdouble x, GLdouble y, GLdouble z, GLdouble w)
-{
- d_1_0_Deprecated->f.Vertex4d(x, y, z, w);
-}
-
-inline void QOpenGLFunctions_1_2::glVertex3sv(const GLshort *v)
-{
- d_1_0_Deprecated->f.Vertex3sv(v);
-}
-
-inline void QOpenGLFunctions_1_2::glVertex3s(GLshort x, GLshort y, GLshort z)
-{
- d_1_0_Deprecated->f.Vertex3s(x, y, z);
-}
-
-inline void QOpenGLFunctions_1_2::glVertex3iv(const GLint *v)
-{
- d_1_0_Deprecated->f.Vertex3iv(v);
-}
-
-inline void QOpenGLFunctions_1_2::glVertex3i(GLint x, GLint y, GLint z)
-{
- d_1_0_Deprecated->f.Vertex3i(x, y, z);
-}
-
-inline void QOpenGLFunctions_1_2::glVertex3fv(const GLfloat *v)
-{
- d_1_0_Deprecated->f.Vertex3fv(v);
-}
-
-inline void QOpenGLFunctions_1_2::glVertex3f(GLfloat x, GLfloat y, GLfloat z)
-{
- d_1_0_Deprecated->f.Vertex3f(x, y, z);
-}
-
-inline void QOpenGLFunctions_1_2::glVertex3dv(const GLdouble *v)
-{
- d_1_0_Deprecated->f.Vertex3dv(v);
-}
-
-inline void QOpenGLFunctions_1_2::glVertex3d(GLdouble x, GLdouble y, GLdouble z)
-{
- d_1_0_Deprecated->f.Vertex3d(x, y, z);
-}
-
-inline void QOpenGLFunctions_1_2::glVertex2sv(const GLshort *v)
-{
- d_1_0_Deprecated->f.Vertex2sv(v);
-}
-
-inline void QOpenGLFunctions_1_2::glVertex2s(GLshort x, GLshort y)
-{
- d_1_0_Deprecated->f.Vertex2s(x, y);
-}
-
-inline void QOpenGLFunctions_1_2::glVertex2iv(const GLint *v)
-{
- d_1_0_Deprecated->f.Vertex2iv(v);
-}
-
-inline void QOpenGLFunctions_1_2::glVertex2i(GLint x, GLint y)
-{
- d_1_0_Deprecated->f.Vertex2i(x, y);
-}
-
-inline void QOpenGLFunctions_1_2::glVertex2fv(const GLfloat *v)
-{
- d_1_0_Deprecated->f.Vertex2fv(v);
-}
-
-inline void QOpenGLFunctions_1_2::glVertex2f(GLfloat x, GLfloat y)
-{
- d_1_0_Deprecated->f.Vertex2f(x, y);
-}
-
-inline void QOpenGLFunctions_1_2::glVertex2dv(const GLdouble *v)
-{
- d_1_0_Deprecated->f.Vertex2dv(v);
-}
-
-inline void QOpenGLFunctions_1_2::glVertex2d(GLdouble x, GLdouble y)
-{
- d_1_0_Deprecated->f.Vertex2d(x, y);
-}
-
-inline void QOpenGLFunctions_1_2::glTexCoord4sv(const GLshort *v)
-{
- d_1_0_Deprecated->f.TexCoord4sv(v);
-}
-
-inline void QOpenGLFunctions_1_2::glTexCoord4s(GLshort s, GLshort t, GLshort r, GLshort q)
-{
- d_1_0_Deprecated->f.TexCoord4s(s, t, r, q);
-}
-
-inline void QOpenGLFunctions_1_2::glTexCoord4iv(const GLint *v)
-{
- d_1_0_Deprecated->f.TexCoord4iv(v);
-}
-
-inline void QOpenGLFunctions_1_2::glTexCoord4i(GLint s, GLint t, GLint r, GLint q)
-{
- d_1_0_Deprecated->f.TexCoord4i(s, t, r, q);
-}
-
-inline void QOpenGLFunctions_1_2::glTexCoord4fv(const GLfloat *v)
-{
- d_1_0_Deprecated->f.TexCoord4fv(v);
-}
-
-inline void QOpenGLFunctions_1_2::glTexCoord4f(GLfloat s, GLfloat t, GLfloat r, GLfloat q)
-{
- d_1_0_Deprecated->f.TexCoord4f(s, t, r, q);
-}
-
-inline void QOpenGLFunctions_1_2::glTexCoord4dv(const GLdouble *v)
-{
- d_1_0_Deprecated->f.TexCoord4dv(v);
-}
-
-inline void QOpenGLFunctions_1_2::glTexCoord4d(GLdouble s, GLdouble t, GLdouble r, GLdouble q)
-{
- d_1_0_Deprecated->f.TexCoord4d(s, t, r, q);
-}
-
-inline void QOpenGLFunctions_1_2::glTexCoord3sv(const GLshort *v)
-{
- d_1_0_Deprecated->f.TexCoord3sv(v);
-}
-
-inline void QOpenGLFunctions_1_2::glTexCoord3s(GLshort s, GLshort t, GLshort r)
-{
- d_1_0_Deprecated->f.TexCoord3s(s, t, r);
-}
-
-inline void QOpenGLFunctions_1_2::glTexCoord3iv(const GLint *v)
-{
- d_1_0_Deprecated->f.TexCoord3iv(v);
-}
-
-inline void QOpenGLFunctions_1_2::glTexCoord3i(GLint s, GLint t, GLint r)
-{
- d_1_0_Deprecated->f.TexCoord3i(s, t, r);
-}
-
-inline void QOpenGLFunctions_1_2::glTexCoord3fv(const GLfloat *v)
-{
- d_1_0_Deprecated->f.TexCoord3fv(v);
-}
-
-inline void QOpenGLFunctions_1_2::glTexCoord3f(GLfloat s, GLfloat t, GLfloat r)
-{
- d_1_0_Deprecated->f.TexCoord3f(s, t, r);
-}
-
-inline void QOpenGLFunctions_1_2::glTexCoord3dv(const GLdouble *v)
-{
- d_1_0_Deprecated->f.TexCoord3dv(v);
-}
-
-inline void QOpenGLFunctions_1_2::glTexCoord3d(GLdouble s, GLdouble t, GLdouble r)
-{
- d_1_0_Deprecated->f.TexCoord3d(s, t, r);
-}
-
-inline void QOpenGLFunctions_1_2::glTexCoord2sv(const GLshort *v)
-{
- d_1_0_Deprecated->f.TexCoord2sv(v);
-}
-
-inline void QOpenGLFunctions_1_2::glTexCoord2s(GLshort s, GLshort t)
-{
- d_1_0_Deprecated->f.TexCoord2s(s, t);
-}
-
-inline void QOpenGLFunctions_1_2::glTexCoord2iv(const GLint *v)
-{
- d_1_0_Deprecated->f.TexCoord2iv(v);
-}
-
-inline void QOpenGLFunctions_1_2::glTexCoord2i(GLint s, GLint t)
-{
- d_1_0_Deprecated->f.TexCoord2i(s, t);
-}
-
-inline void QOpenGLFunctions_1_2::glTexCoord2fv(const GLfloat *v)
-{
- d_1_0_Deprecated->f.TexCoord2fv(v);
-}
-
-inline void QOpenGLFunctions_1_2::glTexCoord2f(GLfloat s, GLfloat t)
-{
- d_1_0_Deprecated->f.TexCoord2f(s, t);
-}
-
-inline void QOpenGLFunctions_1_2::glTexCoord2dv(const GLdouble *v)
-{
- d_1_0_Deprecated->f.TexCoord2dv(v);
-}
-
-inline void QOpenGLFunctions_1_2::glTexCoord2d(GLdouble s, GLdouble t)
-{
- d_1_0_Deprecated->f.TexCoord2d(s, t);
-}
-
-inline void QOpenGLFunctions_1_2::glTexCoord1sv(const GLshort *v)
-{
- d_1_0_Deprecated->f.TexCoord1sv(v);
-}
-
-inline void QOpenGLFunctions_1_2::glTexCoord1s(GLshort s)
-{
- d_1_0_Deprecated->f.TexCoord1s(s);
-}
-
-inline void QOpenGLFunctions_1_2::glTexCoord1iv(const GLint *v)
-{
- d_1_0_Deprecated->f.TexCoord1iv(v);
-}
-
-inline void QOpenGLFunctions_1_2::glTexCoord1i(GLint s)
-{
- d_1_0_Deprecated->f.TexCoord1i(s);
-}
-
-inline void QOpenGLFunctions_1_2::glTexCoord1fv(const GLfloat *v)
-{
- d_1_0_Deprecated->f.TexCoord1fv(v);
-}
-
-inline void QOpenGLFunctions_1_2::glTexCoord1f(GLfloat s)
-{
- d_1_0_Deprecated->f.TexCoord1f(s);
-}
-
-inline void QOpenGLFunctions_1_2::glTexCoord1dv(const GLdouble *v)
-{
- d_1_0_Deprecated->f.TexCoord1dv(v);
-}
-
-inline void QOpenGLFunctions_1_2::glTexCoord1d(GLdouble s)
-{
- d_1_0_Deprecated->f.TexCoord1d(s);
-}
-
-inline void QOpenGLFunctions_1_2::glRectsv(const GLshort *v1, const GLshort *v2)
-{
- d_1_0_Deprecated->f.Rectsv(v1, v2);
-}
-
-inline void QOpenGLFunctions_1_2::glRects(GLshort x1, GLshort y1, GLshort x2, GLshort y2)
-{
- d_1_0_Deprecated->f.Rects(x1, y1, x2, y2);
-}
-
-inline void QOpenGLFunctions_1_2::glRectiv(const GLint *v1, const GLint *v2)
-{
- d_1_0_Deprecated->f.Rectiv(v1, v2);
-}
-
-inline void QOpenGLFunctions_1_2::glRecti(GLint x1, GLint y1, GLint x2, GLint y2)
-{
- d_1_0_Deprecated->f.Recti(x1, y1, x2, y2);
-}
-
-inline void QOpenGLFunctions_1_2::glRectfv(const GLfloat *v1, const GLfloat *v2)
-{
- d_1_0_Deprecated->f.Rectfv(v1, v2);
-}
-
-inline void QOpenGLFunctions_1_2::glRectf(GLfloat x1, GLfloat y1, GLfloat x2, GLfloat y2)
-{
- d_1_0_Deprecated->f.Rectf(x1, y1, x2, y2);
-}
-
-inline void QOpenGLFunctions_1_2::glRectdv(const GLdouble *v1, const GLdouble *v2)
-{
- d_1_0_Deprecated->f.Rectdv(v1, v2);
-}
-
-inline void QOpenGLFunctions_1_2::glRectd(GLdouble x1, GLdouble y1, GLdouble x2, GLdouble y2)
-{
- d_1_0_Deprecated->f.Rectd(x1, y1, x2, y2);
-}
-
-inline void QOpenGLFunctions_1_2::glRasterPos4sv(const GLshort *v)
-{
- d_1_0_Deprecated->f.RasterPos4sv(v);
-}
-
-inline void QOpenGLFunctions_1_2::glRasterPos4s(GLshort x, GLshort y, GLshort z, GLshort w)
-{
- d_1_0_Deprecated->f.RasterPos4s(x, y, z, w);
-}
-
-inline void QOpenGLFunctions_1_2::glRasterPos4iv(const GLint *v)
-{
- d_1_0_Deprecated->f.RasterPos4iv(v);
-}
-
-inline void QOpenGLFunctions_1_2::glRasterPos4i(GLint x, GLint y, GLint z, GLint w)
-{
- d_1_0_Deprecated->f.RasterPos4i(x, y, z, w);
-}
-
-inline void QOpenGLFunctions_1_2::glRasterPos4fv(const GLfloat *v)
-{
- d_1_0_Deprecated->f.RasterPos4fv(v);
-}
-
-inline void QOpenGLFunctions_1_2::glRasterPos4f(GLfloat x, GLfloat y, GLfloat z, GLfloat w)
-{
- d_1_0_Deprecated->f.RasterPos4f(x, y, z, w);
-}
-
-inline void QOpenGLFunctions_1_2::glRasterPos4dv(const GLdouble *v)
-{
- d_1_0_Deprecated->f.RasterPos4dv(v);
-}
-
-inline void QOpenGLFunctions_1_2::glRasterPos4d(GLdouble x, GLdouble y, GLdouble z, GLdouble w)
-{
- d_1_0_Deprecated->f.RasterPos4d(x, y, z, w);
-}
-
-inline void QOpenGLFunctions_1_2::glRasterPos3sv(const GLshort *v)
-{
- d_1_0_Deprecated->f.RasterPos3sv(v);
-}
-
-inline void QOpenGLFunctions_1_2::glRasterPos3s(GLshort x, GLshort y, GLshort z)
-{
- d_1_0_Deprecated->f.RasterPos3s(x, y, z);
-}
-
-inline void QOpenGLFunctions_1_2::glRasterPos3iv(const GLint *v)
-{
- d_1_0_Deprecated->f.RasterPos3iv(v);
-}
-
-inline void QOpenGLFunctions_1_2::glRasterPos3i(GLint x, GLint y, GLint z)
-{
- d_1_0_Deprecated->f.RasterPos3i(x, y, z);
-}
-
-inline void QOpenGLFunctions_1_2::glRasterPos3fv(const GLfloat *v)
-{
- d_1_0_Deprecated->f.RasterPos3fv(v);
-}
-
-inline void QOpenGLFunctions_1_2::glRasterPos3f(GLfloat x, GLfloat y, GLfloat z)
-{
- d_1_0_Deprecated->f.RasterPos3f(x, y, z);
-}
-
-inline void QOpenGLFunctions_1_2::glRasterPos3dv(const GLdouble *v)
-{
- d_1_0_Deprecated->f.RasterPos3dv(v);
-}
-
-inline void QOpenGLFunctions_1_2::glRasterPos3d(GLdouble x, GLdouble y, GLdouble z)
-{
- d_1_0_Deprecated->f.RasterPos3d(x, y, z);
-}
-
-inline void QOpenGLFunctions_1_2::glRasterPos2sv(const GLshort *v)
-{
- d_1_0_Deprecated->f.RasterPos2sv(v);
-}
-
-inline void QOpenGLFunctions_1_2::glRasterPos2s(GLshort x, GLshort y)
-{
- d_1_0_Deprecated->f.RasterPos2s(x, y);
-}
-
-inline void QOpenGLFunctions_1_2::glRasterPos2iv(const GLint *v)
-{
- d_1_0_Deprecated->f.RasterPos2iv(v);
-}
-
-inline void QOpenGLFunctions_1_2::glRasterPos2i(GLint x, GLint y)
-{
- d_1_0_Deprecated->f.RasterPos2i(x, y);
-}
-
-inline void QOpenGLFunctions_1_2::glRasterPos2fv(const GLfloat *v)
-{
- d_1_0_Deprecated->f.RasterPos2fv(v);
-}
-
-inline void QOpenGLFunctions_1_2::glRasterPos2f(GLfloat x, GLfloat y)
-{
- d_1_0_Deprecated->f.RasterPos2f(x, y);
-}
-
-inline void QOpenGLFunctions_1_2::glRasterPos2dv(const GLdouble *v)
-{
- d_1_0_Deprecated->f.RasterPos2dv(v);
-}
-
-inline void QOpenGLFunctions_1_2::glRasterPos2d(GLdouble x, GLdouble y)
-{
- d_1_0_Deprecated->f.RasterPos2d(x, y);
-}
-
-inline void QOpenGLFunctions_1_2::glNormal3sv(const GLshort *v)
-{
- d_1_0_Deprecated->f.Normal3sv(v);
-}
-
-inline void QOpenGLFunctions_1_2::glNormal3s(GLshort nx, GLshort ny, GLshort nz)
-{
- d_1_0_Deprecated->f.Normal3s(nx, ny, nz);
-}
-
-inline void QOpenGLFunctions_1_2::glNormal3iv(const GLint *v)
-{
- d_1_0_Deprecated->f.Normal3iv(v);
-}
-
-inline void QOpenGLFunctions_1_2::glNormal3i(GLint nx, GLint ny, GLint nz)
-{
- d_1_0_Deprecated->f.Normal3i(nx, ny, nz);
-}
-
-inline void QOpenGLFunctions_1_2::glNormal3fv(const GLfloat *v)
-{
- d_1_0_Deprecated->f.Normal3fv(v);
-}
-
-inline void QOpenGLFunctions_1_2::glNormal3f(GLfloat nx, GLfloat ny, GLfloat nz)
-{
- d_1_0_Deprecated->f.Normal3f(nx, ny, nz);
-}
-
-inline void QOpenGLFunctions_1_2::glNormal3dv(const GLdouble *v)
-{
- d_1_0_Deprecated->f.Normal3dv(v);
-}
-
-inline void QOpenGLFunctions_1_2::glNormal3d(GLdouble nx, GLdouble ny, GLdouble nz)
-{
- d_1_0_Deprecated->f.Normal3d(nx, ny, nz);
-}
-
-inline void QOpenGLFunctions_1_2::glNormal3bv(const GLbyte *v)
-{
- d_1_0_Deprecated->f.Normal3bv(v);
-}
-
-inline void QOpenGLFunctions_1_2::glNormal3b(GLbyte nx, GLbyte ny, GLbyte nz)
-{
- d_1_0_Deprecated->f.Normal3b(nx, ny, nz);
-}
-
-inline void QOpenGLFunctions_1_2::glIndexsv(const GLshort *c)
-{
- d_1_0_Deprecated->f.Indexsv(c);
-}
-
-inline void QOpenGLFunctions_1_2::glIndexs(GLshort c)
-{
- d_1_0_Deprecated->f.Indexs(c);
-}
-
-inline void QOpenGLFunctions_1_2::glIndexiv(const GLint *c)
-{
- d_1_0_Deprecated->f.Indexiv(c);
-}
-
-inline void QOpenGLFunctions_1_2::glIndexi(GLint c)
-{
- d_1_0_Deprecated->f.Indexi(c);
-}
-
-inline void QOpenGLFunctions_1_2::glIndexfv(const GLfloat *c)
-{
- d_1_0_Deprecated->f.Indexfv(c);
-}
-
-inline void QOpenGLFunctions_1_2::glIndexf(GLfloat c)
-{
- d_1_0_Deprecated->f.Indexf(c);
-}
-
-inline void QOpenGLFunctions_1_2::glIndexdv(const GLdouble *c)
-{
- d_1_0_Deprecated->f.Indexdv(c);
-}
-
-inline void QOpenGLFunctions_1_2::glIndexd(GLdouble c)
-{
- d_1_0_Deprecated->f.Indexd(c);
-}
-
-inline void QOpenGLFunctions_1_2::glEnd()
-{
- d_1_0_Deprecated->f.End();
-}
-
-inline void QOpenGLFunctions_1_2::glEdgeFlagv(const GLboolean *flag)
-{
- d_1_0_Deprecated->f.EdgeFlagv(flag);
-}
-
-inline void QOpenGLFunctions_1_2::glEdgeFlag(GLboolean flag)
-{
- d_1_0_Deprecated->f.EdgeFlag(flag);
-}
-
-inline void QOpenGLFunctions_1_2::glColor4usv(const GLushort *v)
-{
- d_1_0_Deprecated->f.Color4usv(v);
-}
-
-inline void QOpenGLFunctions_1_2::glColor4us(GLushort red, GLushort green, GLushort blue, GLushort alpha)
-{
- d_1_0_Deprecated->f.Color4us(red, green, blue, alpha);
-}
-
-inline void QOpenGLFunctions_1_2::glColor4uiv(const GLuint *v)
-{
- d_1_0_Deprecated->f.Color4uiv(v);
-}
-
-inline void QOpenGLFunctions_1_2::glColor4ui(GLuint red, GLuint green, GLuint blue, GLuint alpha)
-{
- d_1_0_Deprecated->f.Color4ui(red, green, blue, alpha);
-}
-
-inline void QOpenGLFunctions_1_2::glColor4ubv(const GLubyte *v)
-{
- d_1_0_Deprecated->f.Color4ubv(v);
-}
-
-inline void QOpenGLFunctions_1_2::glColor4ub(GLubyte red, GLubyte green, GLubyte blue, GLubyte alpha)
-{
- d_1_0_Deprecated->f.Color4ub(red, green, blue, alpha);
-}
-
-inline void QOpenGLFunctions_1_2::glColor4sv(const GLshort *v)
-{
- d_1_0_Deprecated->f.Color4sv(v);
-}
-
-inline void QOpenGLFunctions_1_2::glColor4s(GLshort red, GLshort green, GLshort blue, GLshort alpha)
-{
- d_1_0_Deprecated->f.Color4s(red, green, blue, alpha);
-}
-
-inline void QOpenGLFunctions_1_2::glColor4iv(const GLint *v)
-{
- d_1_0_Deprecated->f.Color4iv(v);
-}
-
-inline void QOpenGLFunctions_1_2::glColor4i(GLint red, GLint green, GLint blue, GLint alpha)
-{
- d_1_0_Deprecated->f.Color4i(red, green, blue, alpha);
-}
-
-inline void QOpenGLFunctions_1_2::glColor4fv(const GLfloat *v)
-{
- d_1_0_Deprecated->f.Color4fv(v);
-}
-
-inline void QOpenGLFunctions_1_2::glColor4f(GLfloat red, GLfloat green, GLfloat blue, GLfloat alpha)
-{
- d_1_0_Deprecated->f.Color4f(red, green, blue, alpha);
-}
-
-inline void QOpenGLFunctions_1_2::glColor4dv(const GLdouble *v)
-{
- d_1_0_Deprecated->f.Color4dv(v);
-}
-
-inline void QOpenGLFunctions_1_2::glColor4d(GLdouble red, GLdouble green, GLdouble blue, GLdouble alpha)
-{
- d_1_0_Deprecated->f.Color4d(red, green, blue, alpha);
-}
-
-inline void QOpenGLFunctions_1_2::glColor4bv(const GLbyte *v)
-{
- d_1_0_Deprecated->f.Color4bv(v);
-}
-
-inline void QOpenGLFunctions_1_2::glColor4b(GLbyte red, GLbyte green, GLbyte blue, GLbyte alpha)
-{
- d_1_0_Deprecated->f.Color4b(red, green, blue, alpha);
-}
-
-inline void QOpenGLFunctions_1_2::glColor3usv(const GLushort *v)
-{
- d_1_0_Deprecated->f.Color3usv(v);
-}
-
-inline void QOpenGLFunctions_1_2::glColor3us(GLushort red, GLushort green, GLushort blue)
-{
- d_1_0_Deprecated->f.Color3us(red, green, blue);
-}
-
-inline void QOpenGLFunctions_1_2::glColor3uiv(const GLuint *v)
-{
- d_1_0_Deprecated->f.Color3uiv(v);
-}
-
-inline void QOpenGLFunctions_1_2::glColor3ui(GLuint red, GLuint green, GLuint blue)
-{
- d_1_0_Deprecated->f.Color3ui(red, green, blue);
-}
-
-inline void QOpenGLFunctions_1_2::glColor3ubv(const GLubyte *v)
-{
- d_1_0_Deprecated->f.Color3ubv(v);
-}
-
-inline void QOpenGLFunctions_1_2::glColor3ub(GLubyte red, GLubyte green, GLubyte blue)
-{
- d_1_0_Deprecated->f.Color3ub(red, green, blue);
-}
-
-inline void QOpenGLFunctions_1_2::glColor3sv(const GLshort *v)
-{
- d_1_0_Deprecated->f.Color3sv(v);
-}
-
-inline void QOpenGLFunctions_1_2::glColor3s(GLshort red, GLshort green, GLshort blue)
-{
- d_1_0_Deprecated->f.Color3s(red, green, blue);
-}
-
-inline void QOpenGLFunctions_1_2::glColor3iv(const GLint *v)
-{
- d_1_0_Deprecated->f.Color3iv(v);
-}
-
-inline void QOpenGLFunctions_1_2::glColor3i(GLint red, GLint green, GLint blue)
-{
- d_1_0_Deprecated->f.Color3i(red, green, blue);
-}
-
-inline void QOpenGLFunctions_1_2::glColor3fv(const GLfloat *v)
-{
- d_1_0_Deprecated->f.Color3fv(v);
-}
-
-inline void QOpenGLFunctions_1_2::glColor3f(GLfloat red, GLfloat green, GLfloat blue)
-{
- d_1_0_Deprecated->f.Color3f(red, green, blue);
-}
-
-inline void QOpenGLFunctions_1_2::glColor3dv(const GLdouble *v)
-{
- d_1_0_Deprecated->f.Color3dv(v);
-}
-
-inline void QOpenGLFunctions_1_2::glColor3d(GLdouble red, GLdouble green, GLdouble blue)
-{
- d_1_0_Deprecated->f.Color3d(red, green, blue);
-}
-
-inline void QOpenGLFunctions_1_2::glColor3bv(const GLbyte *v)
-{
- d_1_0_Deprecated->f.Color3bv(v);
-}
-
-inline void QOpenGLFunctions_1_2::glColor3b(GLbyte red, GLbyte green, GLbyte blue)
-{
- d_1_0_Deprecated->f.Color3b(red, green, blue);
-}
-
-inline void QOpenGLFunctions_1_2::glBitmap(GLsizei width, GLsizei height, GLfloat xorig, GLfloat yorig, GLfloat xmove, GLfloat ymove, const GLubyte *bitmap)
-{
- d_1_0_Deprecated->f.Bitmap(width, height, xorig, yorig, xmove, ymove, bitmap);
-}
-
-inline void QOpenGLFunctions_1_2::glBegin(GLenum mode)
-{
- d_1_0_Deprecated->f.Begin(mode);
-}
-
-inline void QOpenGLFunctions_1_2::glListBase(GLuint base)
-{
- d_1_0_Deprecated->f.ListBase(base);
-}
-
-inline GLuint QOpenGLFunctions_1_2::glGenLists(GLsizei range)
-{
- return d_1_0_Deprecated->f.GenLists(range);
-}
-
-inline void QOpenGLFunctions_1_2::glDeleteLists(GLuint list, GLsizei range)
-{
- d_1_0_Deprecated->f.DeleteLists(list, range);
-}
-
-inline void QOpenGLFunctions_1_2::glCallLists(GLsizei n, GLenum type, const GLvoid *lists)
-{
- d_1_0_Deprecated->f.CallLists(n, type, lists);
-}
-
-inline void QOpenGLFunctions_1_2::glCallList(GLuint list)
-{
- d_1_0_Deprecated->f.CallList(list);
-}
-
-inline void QOpenGLFunctions_1_2::glEndList()
-{
- d_1_0_Deprecated->f.EndList();
-}
-
-inline void QOpenGLFunctions_1_2::glNewList(GLuint list, GLenum mode)
-{
- d_1_0_Deprecated->f.NewList(list, mode);
-}
-
-
-// OpenGL 1.1 deprecated functions
-inline void QOpenGLFunctions_1_2::glPushClientAttrib(GLbitfield mask)
-{
- d_1_1_Deprecated->f.PushClientAttrib(mask);
-}
-
-inline void QOpenGLFunctions_1_2::glPopClientAttrib()
-{
- d_1_1_Deprecated->f.PopClientAttrib();
-}
-
-inline void QOpenGLFunctions_1_2::glPrioritizeTextures(GLsizei n, const GLuint *textures, const GLfloat *priorities)
-{
- d_1_1_Deprecated->f.PrioritizeTextures(n, textures, priorities);
-}
-
-inline GLboolean QOpenGLFunctions_1_2::glAreTexturesResident(GLsizei n, const GLuint *textures, GLboolean *residences)
-{
- return d_1_1_Deprecated->f.AreTexturesResident(n, textures, residences);
-}
-
-inline void QOpenGLFunctions_1_2::glVertexPointer(GLint size, GLenum type, GLsizei stride, const GLvoid *pointer)
-{
- d_1_1_Deprecated->f.VertexPointer(size, type, stride, pointer);
-}
-
-inline void QOpenGLFunctions_1_2::glTexCoordPointer(GLint size, GLenum type, GLsizei stride, const GLvoid *pointer)
-{
- d_1_1_Deprecated->f.TexCoordPointer(size, type, stride, pointer);
-}
-
-inline void QOpenGLFunctions_1_2::glNormalPointer(GLenum type, GLsizei stride, const GLvoid *pointer)
-{
- d_1_1_Deprecated->f.NormalPointer(type, stride, pointer);
-}
-
-inline void QOpenGLFunctions_1_2::glInterleavedArrays(GLenum format, GLsizei stride, const GLvoid *pointer)
-{
- d_1_1_Deprecated->f.InterleavedArrays(format, stride, pointer);
-}
-
-inline void QOpenGLFunctions_1_2::glIndexPointer(GLenum type, GLsizei stride, const GLvoid *pointer)
-{
- d_1_1_Deprecated->f.IndexPointer(type, stride, pointer);
-}
-
-inline void QOpenGLFunctions_1_2::glEnableClientState(GLenum array)
-{
- d_1_1_Deprecated->f.EnableClientState(array);
-}
-
-inline void QOpenGLFunctions_1_2::glEdgeFlagPointer(GLsizei stride, const GLvoid *pointer)
-{
- d_1_1_Deprecated->f.EdgeFlagPointer(stride, pointer);
-}
-
-inline void QOpenGLFunctions_1_2::glDisableClientState(GLenum array)
-{
- d_1_1_Deprecated->f.DisableClientState(array);
-}
-
-inline void QOpenGLFunctions_1_2::glColorPointer(GLint size, GLenum type, GLsizei stride, const GLvoid *pointer)
-{
- d_1_1_Deprecated->f.ColorPointer(size, type, stride, pointer);
-}
-
-inline void QOpenGLFunctions_1_2::glArrayElement(GLint i)
-{
- d_1_1_Deprecated->f.ArrayElement(i);
-}
-
-
-// OpenGL 1.2 deprecated functions
-inline void QOpenGLFunctions_1_2::glResetMinmax(GLenum target)
-{
- d_1_2_Deprecated->f.ResetMinmax(target);
-}
-
-inline void QOpenGLFunctions_1_2::glResetHistogram(GLenum target)
-{
- d_1_2_Deprecated->f.ResetHistogram(target);
-}
-
-inline void QOpenGLFunctions_1_2::glMinmax(GLenum target, GLenum internalformat, GLboolean sink)
-{
- d_1_2_Deprecated->f.Minmax(target, internalformat, sink);
-}
-
-inline void QOpenGLFunctions_1_2::glHistogram(GLenum target, GLsizei width, GLenum internalformat, GLboolean sink)
-{
- d_1_2_Deprecated->f.Histogram(target, width, internalformat, sink);
-}
-
-inline void QOpenGLFunctions_1_2::glGetMinmaxParameteriv(GLenum target, GLenum pname, GLint *params)
-{
- d_1_2_Deprecated->f.GetMinmaxParameteriv(target, pname, params);
-}
-
-inline void QOpenGLFunctions_1_2::glGetMinmaxParameterfv(GLenum target, GLenum pname, GLfloat *params)
-{
- d_1_2_Deprecated->f.GetMinmaxParameterfv(target, pname, params);
-}
-
-inline void QOpenGLFunctions_1_2::glGetMinmax(GLenum target, GLboolean reset, GLenum format, GLenum type, GLvoid *values)
-{
- d_1_2_Deprecated->f.GetMinmax(target, reset, format, type, values);
-}
-
-inline void QOpenGLFunctions_1_2::glGetHistogramParameteriv(GLenum target, GLenum pname, GLint *params)
-{
- d_1_2_Deprecated->f.GetHistogramParameteriv(target, pname, params);
-}
-
-inline void QOpenGLFunctions_1_2::glGetHistogramParameterfv(GLenum target, GLenum pname, GLfloat *params)
-{
- d_1_2_Deprecated->f.GetHistogramParameterfv(target, pname, params);
-}
-
-inline void QOpenGLFunctions_1_2::glGetHistogram(GLenum target, GLboolean reset, GLenum format, GLenum type, GLvoid *values)
-{
- d_1_2_Deprecated->f.GetHistogram(target, reset, format, type, values);
-}
-
-inline void QOpenGLFunctions_1_2::glSeparableFilter2D(GLenum target, GLenum internalformat, GLsizei width, GLsizei height, GLenum format, GLenum type, const GLvoid *row, const GLvoid *column)
-{
- d_1_2_Deprecated->f.SeparableFilter2D(target, internalformat, width, height, format, type, row, column);
-}
-
-inline void QOpenGLFunctions_1_2::glGetSeparableFilter(GLenum target, GLenum format, GLenum type, GLvoid *row, GLvoid *column, GLvoid *span)
-{
- d_1_2_Deprecated->f.GetSeparableFilter(target, format, type, row, column, span);
-}
-
-inline void QOpenGLFunctions_1_2::glGetConvolutionParameteriv(GLenum target, GLenum pname, GLint *params)
-{
- d_1_2_Deprecated->f.GetConvolutionParameteriv(target, pname, params);
-}
-
-inline void QOpenGLFunctions_1_2::glGetConvolutionParameterfv(GLenum target, GLenum pname, GLfloat *params)
-{
- d_1_2_Deprecated->f.GetConvolutionParameterfv(target, pname, params);
-}
-
-inline void QOpenGLFunctions_1_2::glGetConvolutionFilter(GLenum target, GLenum format, GLenum type, GLvoid *image)
-{
- d_1_2_Deprecated->f.GetConvolutionFilter(target, format, type, image);
-}
-
-inline void QOpenGLFunctions_1_2::glCopyConvolutionFilter2D(GLenum target, GLenum internalformat, GLint x, GLint y, GLsizei width, GLsizei height)
-{
- d_1_2_Deprecated->f.CopyConvolutionFilter2D(target, internalformat, x, y, width, height);
-}
-
-inline void QOpenGLFunctions_1_2::glCopyConvolutionFilter1D(GLenum target, GLenum internalformat, GLint x, GLint y, GLsizei width)
-{
- d_1_2_Deprecated->f.CopyConvolutionFilter1D(target, internalformat, x, y, width);
-}
-
-inline void QOpenGLFunctions_1_2::glConvolutionParameteriv(GLenum target, GLenum pname, const GLint *params)
-{
- d_1_2_Deprecated->f.ConvolutionParameteriv(target, pname, params);
-}
-
-inline void QOpenGLFunctions_1_2::glConvolutionParameteri(GLenum target, GLenum pname, GLint params)
-{
- d_1_2_Deprecated->f.ConvolutionParameteri(target, pname, params);
-}
-
-inline void QOpenGLFunctions_1_2::glConvolutionParameterfv(GLenum target, GLenum pname, const GLfloat *params)
-{
- d_1_2_Deprecated->f.ConvolutionParameterfv(target, pname, params);
-}
-
-inline void QOpenGLFunctions_1_2::glConvolutionParameterf(GLenum target, GLenum pname, GLfloat params)
-{
- d_1_2_Deprecated->f.ConvolutionParameterf(target, pname, params);
-}
-
-inline void QOpenGLFunctions_1_2::glConvolutionFilter2D(GLenum target, GLenum internalformat, GLsizei width, GLsizei height, GLenum format, GLenum type, const GLvoid *image)
-{
- d_1_2_Deprecated->f.ConvolutionFilter2D(target, internalformat, width, height, format, type, image);
-}
-
-inline void QOpenGLFunctions_1_2::glConvolutionFilter1D(GLenum target, GLenum internalformat, GLsizei width, GLenum format, GLenum type, const GLvoid *image)
-{
- d_1_2_Deprecated->f.ConvolutionFilter1D(target, internalformat, width, format, type, image);
-}
-
-inline void QOpenGLFunctions_1_2::glCopyColorSubTable(GLenum target, GLsizei start, GLint x, GLint y, GLsizei width)
-{
- d_1_2_Deprecated->f.CopyColorSubTable(target, start, x, y, width);
-}
-
-inline void QOpenGLFunctions_1_2::glColorSubTable(GLenum target, GLsizei start, GLsizei count, GLenum format, GLenum type, const GLvoid *data)
-{
- d_1_2_Deprecated->f.ColorSubTable(target, start, count, format, type, data);
-}
-
-inline void QOpenGLFunctions_1_2::glGetColorTableParameteriv(GLenum target, GLenum pname, GLint *params)
-{
- d_1_2_Deprecated->f.GetColorTableParameteriv(target, pname, params);
-}
-
-inline void QOpenGLFunctions_1_2::glGetColorTableParameterfv(GLenum target, GLenum pname, GLfloat *params)
-{
- d_1_2_Deprecated->f.GetColorTableParameterfv(target, pname, params);
-}
-
-inline void QOpenGLFunctions_1_2::glGetColorTable(GLenum target, GLenum format, GLenum type, GLvoid *table)
-{
- d_1_2_Deprecated->f.GetColorTable(target, format, type, table);
-}
-
-inline void QOpenGLFunctions_1_2::glCopyColorTable(GLenum target, GLenum internalformat, GLint x, GLint y, GLsizei width)
-{
- d_1_2_Deprecated->f.CopyColorTable(target, internalformat, x, y, width);
-}
-
-inline void QOpenGLFunctions_1_2::glColorTableParameteriv(GLenum target, GLenum pname, const GLint *params)
-{
- d_1_2_Deprecated->f.ColorTableParameteriv(target, pname, params);
-}
-
-inline void QOpenGLFunctions_1_2::glColorTableParameterfv(GLenum target, GLenum pname, const GLfloat *params)
-{
- d_1_2_Deprecated->f.ColorTableParameterfv(target, pname, params);
-}
-
-inline void QOpenGLFunctions_1_2::glColorTable(GLenum target, GLenum internalformat, GLsizei width, GLenum format, GLenum type, const GLvoid *table)
-{
- d_1_2_Deprecated->f.ColorTable(target, internalformat, width, format, type, table);
-}
-
-
-
-QT_END_NAMESPACE
-
-#endif // QT_NO_OPENGL && !QT_OPENGL_ES_2
-
-#endif
diff --git a/src/gui/opengl/qopenglfunctions_1_3.cpp b/src/gui/opengl/qopenglfunctions_1_3.cpp
deleted file mode 100644
index 0b5ff2fee5..0000000000
--- a/src/gui/opengl/qopenglfunctions_1_3.cpp
+++ /dev/null
@@ -1,190 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2013 Klaralvdalens Datakonsult AB (KDAB)
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the QtGui module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-**
-** This file was generated by glgen version 0.1
-** Command line was: glgen
-**
-** glgen is Copyright (C) 2013 Klaralvdalens Datakonsult AB (KDAB)
-**
-** This is an auto-generated file.
-** Do not edit! All changes made to it will be lost.
-**
-****************************************************************************/
-
-#include "qopenglfunctions_1_3.h"
-#include "qopenglcontext.h"
-
-QT_BEGIN_NAMESPACE
-
-/*!
- \class QOpenGLFunctions_1_3
- \inmodule QtGui
- \since 5.1
- \wrapper
- \brief The QOpenGLFunctions_1_3 class provides all functions for OpenGL 1.3 specification.
-
- This class is a wrapper for functions from OpenGL 1.3 specification.
- See reference pages on \l {http://www.opengl.org/sdk/docs/}{opengl.org}
- for function documentation.
-
- \sa QAbstractOpenGLFunctions
-*/
-
-QOpenGLFunctions_1_3::QOpenGLFunctions_1_3()
- : QAbstractOpenGLFunctions()
- , d_1_0_Core(nullptr)
- , d_1_1_Core(nullptr)
- , d_1_2_Core(nullptr)
- , d_1_3_Core(nullptr)
- , d_1_0_Deprecated(nullptr)
- , d_1_1_Deprecated(nullptr)
- , d_1_2_Deprecated(nullptr)
- , d_1_3_Deprecated(nullptr)
-{
-}
-
-QOpenGLFunctions_1_3::~QOpenGLFunctions_1_3()
-{
- if (d_1_0_Core) {
- d_1_0_Core->refs.deref();
- Q_ASSERT(d_1_0_Core->refs.loadRelaxed());
- }
- if (d_1_1_Core) {
- d_1_1_Core->refs.deref();
- Q_ASSERT(d_1_1_Core->refs.loadRelaxed());
- }
- if (d_1_2_Core) {
- d_1_2_Core->refs.deref();
- Q_ASSERT(d_1_2_Core->refs.loadRelaxed());
- }
- if (d_1_3_Core) {
- d_1_3_Core->refs.deref();
- Q_ASSERT(d_1_3_Core->refs.loadRelaxed());
- }
- if (d_1_0_Deprecated) {
- d_1_0_Deprecated->refs.deref();
- Q_ASSERT(d_1_0_Deprecated->refs.loadRelaxed());
- }
- if (d_1_1_Deprecated) {
- d_1_1_Deprecated->refs.deref();
- Q_ASSERT(d_1_1_Deprecated->refs.loadRelaxed());
- }
- if (d_1_2_Deprecated) {
- d_1_2_Deprecated->refs.deref();
- Q_ASSERT(d_1_2_Deprecated->refs.loadRelaxed());
- }
- if (d_1_3_Deprecated) {
- d_1_3_Deprecated->refs.deref();
- Q_ASSERT(d_1_3_Deprecated->refs.loadRelaxed());
- }
-}
-
-bool QOpenGLFunctions_1_3::initializeOpenGLFunctions()
-{
- if ( isInitialized() )
- return true;
-
- QOpenGLContext* context = QOpenGLContext::currentContext();
-
- // If owned by a context object make sure it is current.
- // Also check that current context is capable of resolving all needed functions
- if (((owningContext() && owningContext() == context) || !owningContext())
- && QOpenGLFunctions_1_3::isContextCompatible(context))
- {
- // Associate with private implementation, creating if necessary
- // Function pointers in the backends are resolved at creation time
- QOpenGLVersionFunctionsBackend* d = nullptr;
- d = QAbstractOpenGLFunctionsPrivate::functionsBackend(context, QOpenGLFunctions_1_0_CoreBackend::versionStatus());
- d_1_0_Core = static_cast<QOpenGLFunctions_1_0_CoreBackend*>(d);
- d->refs.ref();
-
- d = QAbstractOpenGLFunctionsPrivate::functionsBackend(context, QOpenGLFunctions_1_1_CoreBackend::versionStatus());
- d_1_1_Core = static_cast<QOpenGLFunctions_1_1_CoreBackend*>(d);
- d->refs.ref();
-
- d = QAbstractOpenGLFunctionsPrivate::functionsBackend(context, QOpenGLFunctions_1_2_CoreBackend::versionStatus());
- d_1_2_Core = static_cast<QOpenGLFunctions_1_2_CoreBackend*>(d);
- d->refs.ref();
-
- d = QAbstractOpenGLFunctionsPrivate::functionsBackend(context, QOpenGLFunctions_1_3_CoreBackend::versionStatus());
- d_1_3_Core = static_cast<QOpenGLFunctions_1_3_CoreBackend*>(d);
- d->refs.ref();
-
- d = QAbstractOpenGLFunctionsPrivate::functionsBackend(context, QOpenGLFunctions_1_0_DeprecatedBackend::versionStatus());
- d_1_0_Deprecated = static_cast<QOpenGLFunctions_1_0_DeprecatedBackend*>(d);
- d->refs.ref();
-
- d = QAbstractOpenGLFunctionsPrivate::functionsBackend(context, QOpenGLFunctions_1_1_DeprecatedBackend::versionStatus());
- d_1_1_Deprecated = static_cast<QOpenGLFunctions_1_1_DeprecatedBackend*>(d);
- d->refs.ref();
-
- d = QAbstractOpenGLFunctionsPrivate::functionsBackend(context, QOpenGLFunctions_1_2_DeprecatedBackend::versionStatus());
- d_1_2_Deprecated = static_cast<QOpenGLFunctions_1_2_DeprecatedBackend*>(d);
- d->refs.ref();
-
- d = QAbstractOpenGLFunctionsPrivate::functionsBackend(context, QOpenGLFunctions_1_3_DeprecatedBackend::versionStatus());
- d_1_3_Deprecated = static_cast<QOpenGLFunctions_1_3_DeprecatedBackend*>(d);
- d->refs.ref();
-
- QAbstractOpenGLFunctions::initializeOpenGLFunctions();
- }
- return isInitialized();
-}
-
-bool QOpenGLFunctions_1_3::isContextCompatible(QOpenGLContext *context)
-{
- Q_ASSERT(context);
- QSurfaceFormat f = context->format();
- const QPair<int, int> v = qMakePair(f.majorVersion(), f.minorVersion());
- if (v < qMakePair(1, 3))
- return false;
-
- if (f.profile() == QSurfaceFormat::CoreProfile)
- return false;
-
- return true;
-}
-
-QOpenGLVersionProfile QOpenGLFunctions_1_3::versionProfile()
-{
- QOpenGLVersionProfile v;
- v.setVersion(1, 3);
- return v;
-}
-
-QT_END_NAMESPACE
diff --git a/src/gui/opengl/qopenglfunctions_1_3.h b/src/gui/opengl/qopenglfunctions_1_3.h
deleted file mode 100644
index b527b57946..0000000000
--- a/src/gui/opengl/qopenglfunctions_1_3.h
+++ /dev/null
@@ -1,2643 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2013 Klaralvdalens Datakonsult AB (KDAB)
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the QtGui module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-**
-** This file was generated by glgen version 0.1
-** Command line was: glgen
-**
-** glgen is Copyright (C) 2013 Klaralvdalens Datakonsult AB (KDAB)
-**
-** This is an auto-generated file.
-** Do not edit! All changes made to it will be lost.
-**
-****************************************************************************/
-
-#ifndef QOPENGLVERSIONFUNCTIONS_1_3_H
-#define QOPENGLVERSIONFUNCTIONS_1_3_H
-
-#include <QtGui/qtguiglobal.h>
-
-#if !defined(QT_NO_OPENGL) && !defined(QT_OPENGL_ES_2)
-
-#include <QtGui/QOpenGLVersionFunctions>
-#include <QtGui/qopenglcontext.h>
-
-QT_BEGIN_NAMESPACE
-
-class Q_GUI_EXPORT QOpenGLFunctions_1_3 : public QAbstractOpenGLFunctions
-{
-public:
- QOpenGLFunctions_1_3();
- ~QOpenGLFunctions_1_3();
-
- bool initializeOpenGLFunctions() override;
-
- // OpenGL 1.0 core functions
- void glViewport(GLint x, GLint y, GLsizei width, GLsizei height);
- void glDepthRange(GLdouble nearVal, GLdouble farVal);
- GLboolean glIsEnabled(GLenum cap);
- void glGetTexLevelParameteriv(GLenum target, GLint level, GLenum pname, GLint *params);
- void glGetTexLevelParameterfv(GLenum target, GLint level, GLenum pname, GLfloat *params);
- void glGetTexParameteriv(GLenum target, GLenum pname, GLint *params);
- void glGetTexParameterfv(GLenum target, GLenum pname, GLfloat *params);
- void glGetTexImage(GLenum target, GLint level, GLenum format, GLenum type, GLvoid *pixels);
- const GLubyte * glGetString(GLenum name);
- void glGetIntegerv(GLenum pname, GLint *params);
- void glGetFloatv(GLenum pname, GLfloat *params);
- GLenum glGetError();
- void glGetDoublev(GLenum pname, GLdouble *params);
- void glGetBooleanv(GLenum pname, GLboolean *params);
- void glReadPixels(GLint x, GLint y, GLsizei width, GLsizei height, GLenum format, GLenum type, GLvoid *pixels);
- void glReadBuffer(GLenum mode);
- void glPixelStorei(GLenum pname, GLint param);
- void glPixelStoref(GLenum pname, GLfloat param);
- void glDepthFunc(GLenum func);
- void glStencilOp(GLenum fail, GLenum zfail, GLenum zpass);
- void glStencilFunc(GLenum func, GLint ref, GLuint mask);
- void glLogicOp(GLenum opcode);
- void glBlendFunc(GLenum sfactor, GLenum dfactor);
- void glFlush();
- void glFinish();
- void glEnable(GLenum cap);
- void glDisable(GLenum cap);
- void glDepthMask(GLboolean flag);
- void glColorMask(GLboolean red, GLboolean green, GLboolean blue, GLboolean alpha);
- void glStencilMask(GLuint mask);
- void glClearDepth(GLdouble depth);
- void glClearStencil(GLint s);
- void glClearColor(GLfloat red, GLfloat green, GLfloat blue, GLfloat alpha);
- void glClear(GLbitfield mask);
- void glDrawBuffer(GLenum mode);
- void glTexImage2D(GLenum target, GLint level, GLint internalformat, GLsizei width, GLsizei height, GLint border, GLenum format, GLenum type, const GLvoid *pixels);
- void glTexImage1D(GLenum target, GLint level, GLint internalformat, GLsizei width, GLint border, GLenum format, GLenum type, const GLvoid *pixels);
- void glTexParameteriv(GLenum target, GLenum pname, const GLint *params);
- void glTexParameteri(GLenum target, GLenum pname, GLint param);
- void glTexParameterfv(GLenum target, GLenum pname, const GLfloat *params);
- void glTexParameterf(GLenum target, GLenum pname, GLfloat param);
- void glScissor(GLint x, GLint y, GLsizei width, GLsizei height);
- void glPolygonMode(GLenum face, GLenum mode);
- void glPointSize(GLfloat size);
- void glLineWidth(GLfloat width);
- void glHint(GLenum target, GLenum mode);
- void glFrontFace(GLenum mode);
- void glCullFace(GLenum mode);
-
- // OpenGL 1.1 core functions
- void glIndexubv(const GLubyte *c);
- void glIndexub(GLubyte c);
- GLboolean glIsTexture(GLuint texture);
- void glGenTextures(GLsizei n, GLuint *textures);
- void glDeleteTextures(GLsizei n, const GLuint *textures);
- void glBindTexture(GLenum target, GLuint texture);
- void glTexSubImage2D(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLenum type, const GLvoid *pixels);
- void glTexSubImage1D(GLenum target, GLint level, GLint xoffset, GLsizei width, GLenum format, GLenum type, const GLvoid *pixels);
- void glCopyTexSubImage2D(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint x, GLint y, GLsizei width, GLsizei height);
- void glCopyTexSubImage1D(GLenum target, GLint level, GLint xoffset, GLint x, GLint y, GLsizei width);
- void glCopyTexImage2D(GLenum target, GLint level, GLenum internalformat, GLint x, GLint y, GLsizei width, GLsizei height, GLint border);
- void glCopyTexImage1D(GLenum target, GLint level, GLenum internalformat, GLint x, GLint y, GLsizei width, GLint border);
- void glPolygonOffset(GLfloat factor, GLfloat units);
- void glGetPointerv(GLenum pname, GLvoid* *params);
- void glDrawElements(GLenum mode, GLsizei count, GLenum type, const GLvoid *indices);
- void glDrawArrays(GLenum mode, GLint first, GLsizei count);
-
- // OpenGL 1.2 core functions
- void glCopyTexSubImage3D(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLint x, GLint y, GLsizei width, GLsizei height);
- void glTexSubImage3D(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLenum type, const GLvoid *pixels);
- void glTexImage3D(GLenum target, GLint level, GLint internalformat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLenum format, GLenum type, const GLvoid *pixels);
- void glDrawRangeElements(GLenum mode, GLuint start, GLuint end, GLsizei count, GLenum type, const GLvoid *indices);
- void glBlendEquation(GLenum mode);
- void glBlendColor(GLfloat red, GLfloat green, GLfloat blue, GLfloat alpha);
-
- // OpenGL 1.3 core functions
- void glGetCompressedTexImage(GLenum target, GLint level, GLvoid *img);
- void glCompressedTexSubImage1D(GLenum target, GLint level, GLint xoffset, GLsizei width, GLenum format, GLsizei imageSize, const GLvoid *data);
- void glCompressedTexSubImage2D(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLsizei imageSize, const GLvoid *data);
- void glCompressedTexSubImage3D(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLsizei imageSize, const GLvoid *data);
- void glCompressedTexImage1D(GLenum target, GLint level, GLenum internalformat, GLsizei width, GLint border, GLsizei imageSize, const GLvoid *data);
- void glCompressedTexImage2D(GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLint border, GLsizei imageSize, const GLvoid *data);
- void glCompressedTexImage3D(GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLsizei imageSize, const GLvoid *data);
- void glSampleCoverage(GLfloat value, GLboolean invert);
- void glActiveTexture(GLenum texture);
-
- // OpenGL 1.0 deprecated functions
- void glTranslatef(GLfloat x, GLfloat y, GLfloat z);
- void glTranslated(GLdouble x, GLdouble y, GLdouble z);
- void glScalef(GLfloat x, GLfloat y, GLfloat z);
- void glScaled(GLdouble x, GLdouble y, GLdouble z);
- void glRotatef(GLfloat angle, GLfloat x, GLfloat y, GLfloat z);
- void glRotated(GLdouble angle, GLdouble x, GLdouble y, GLdouble z);
- void glPushMatrix();
- void glPopMatrix();
- void glOrtho(GLdouble left, GLdouble right, GLdouble bottom, GLdouble top, GLdouble zNear, GLdouble zFar);
- void glMultMatrixd(const GLdouble *m);
- void glMultMatrixf(const GLfloat *m);
- void glMatrixMode(GLenum mode);
- void glLoadMatrixd(const GLdouble *m);
- void glLoadMatrixf(const GLfloat *m);
- void glLoadIdentity();
- void glFrustum(GLdouble left, GLdouble right, GLdouble bottom, GLdouble top, GLdouble zNear, GLdouble zFar);
- GLboolean glIsList(GLuint list);
- void glGetTexGeniv(GLenum coord, GLenum pname, GLint *params);
- void glGetTexGenfv(GLenum coord, GLenum pname, GLfloat *params);
- void glGetTexGendv(GLenum coord, GLenum pname, GLdouble *params);
- void glGetTexEnviv(GLenum target, GLenum pname, GLint *params);
- void glGetTexEnvfv(GLenum target, GLenum pname, GLfloat *params);
- void glGetPolygonStipple(GLubyte *mask);
- void glGetPixelMapusv(GLenum map, GLushort *values);
- void glGetPixelMapuiv(GLenum map, GLuint *values);
- void glGetPixelMapfv(GLenum map, GLfloat *values);
- void glGetMaterialiv(GLenum face, GLenum pname, GLint *params);
- void glGetMaterialfv(GLenum face, GLenum pname, GLfloat *params);
- void glGetMapiv(GLenum target, GLenum query, GLint *v);
- void glGetMapfv(GLenum target, GLenum query, GLfloat *v);
- void glGetMapdv(GLenum target, GLenum query, GLdouble *v);
- void glGetLightiv(GLenum light, GLenum pname, GLint *params);
- void glGetLightfv(GLenum light, GLenum pname, GLfloat *params);
- void glGetClipPlane(GLenum plane, GLdouble *equation);
- void glDrawPixels(GLsizei width, GLsizei height, GLenum format, GLenum type, const GLvoid *pixels);
- void glCopyPixels(GLint x, GLint y, GLsizei width, GLsizei height, GLenum type);
- void glPixelMapusv(GLenum map, GLint mapsize, const GLushort *values);
- void glPixelMapuiv(GLenum map, GLint mapsize, const GLuint *values);
- void glPixelMapfv(GLenum map, GLint mapsize, const GLfloat *values);
- void glPixelTransferi(GLenum pname, GLint param);
- void glPixelTransferf(GLenum pname, GLfloat param);
- void glPixelZoom(GLfloat xfactor, GLfloat yfactor);
- void glAlphaFunc(GLenum func, GLfloat ref);
- void glEvalPoint2(GLint i, GLint j);
- void glEvalMesh2(GLenum mode, GLint i1, GLint i2, GLint j1, GLint j2);
- void glEvalPoint1(GLint i);
- void glEvalMesh1(GLenum mode, GLint i1, GLint i2);
- void glEvalCoord2fv(const GLfloat *u);
- void glEvalCoord2f(GLfloat u, GLfloat v);
- void glEvalCoord2dv(const GLdouble *u);
- void glEvalCoord2d(GLdouble u, GLdouble v);
- void glEvalCoord1fv(const GLfloat *u);
- void glEvalCoord1f(GLfloat u);
- void glEvalCoord1dv(const GLdouble *u);
- void glEvalCoord1d(GLdouble u);
- void glMapGrid2f(GLint un, GLfloat u1, GLfloat u2, GLint vn, GLfloat v1, GLfloat v2);
- void glMapGrid2d(GLint un, GLdouble u1, GLdouble u2, GLint vn, GLdouble v1, GLdouble v2);
- void glMapGrid1f(GLint un, GLfloat u1, GLfloat u2);
- void glMapGrid1d(GLint un, GLdouble u1, GLdouble u2);
- void glMap2f(GLenum target, GLfloat u1, GLfloat u2, GLint ustride, GLint uorder, GLfloat v1, GLfloat v2, GLint vstride, GLint vorder, const GLfloat *points);
- void glMap2d(GLenum target, GLdouble u1, GLdouble u2, GLint ustride, GLint uorder, GLdouble v1, GLdouble v2, GLint vstride, GLint vorder, const GLdouble *points);
- void glMap1f(GLenum target, GLfloat u1, GLfloat u2, GLint stride, GLint order, const GLfloat *points);
- void glMap1d(GLenum target, GLdouble u1, GLdouble u2, GLint stride, GLint order, const GLdouble *points);
- void glPushAttrib(GLbitfield mask);
- void glPopAttrib();
- void glAccum(GLenum op, GLfloat value);
- void glIndexMask(GLuint mask);
- void glClearIndex(GLfloat c);
- void glClearAccum(GLfloat red, GLfloat green, GLfloat blue, GLfloat alpha);
- void glPushName(GLuint name);
- void glPopName();
- void glPassThrough(GLfloat token);
- void glLoadName(GLuint name);
- void glInitNames();
- GLint glRenderMode(GLenum mode);
- void glSelectBuffer(GLsizei size, GLuint *buffer);
- void glFeedbackBuffer(GLsizei size, GLenum type, GLfloat *buffer);
- void glTexGeniv(GLenum coord, GLenum pname, const GLint *params);
- void glTexGeni(GLenum coord, GLenum pname, GLint param);
- void glTexGenfv(GLenum coord, GLenum pname, const GLfloat *params);
- void glTexGenf(GLenum coord, GLenum pname, GLfloat param);
- void glTexGendv(GLenum coord, GLenum pname, const GLdouble *params);
- void glTexGend(GLenum coord, GLenum pname, GLdouble param);
- void glTexEnviv(GLenum target, GLenum pname, const GLint *params);
- void glTexEnvi(GLenum target, GLenum pname, GLint param);
- void glTexEnvfv(GLenum target, GLenum pname, const GLfloat *params);
- void glTexEnvf(GLenum target, GLenum pname, GLfloat param);
- void glShadeModel(GLenum mode);
- void glPolygonStipple(const GLubyte *mask);
- void glMaterialiv(GLenum face, GLenum pname, const GLint *params);
- void glMateriali(GLenum face, GLenum pname, GLint param);
- void glMaterialfv(GLenum face, GLenum pname, const GLfloat *params);
- void glMaterialf(GLenum face, GLenum pname, GLfloat param);
- void glLineStipple(GLint factor, GLushort pattern);
- void glLightModeliv(GLenum pname, const GLint *params);
- void glLightModeli(GLenum pname, GLint param);
- void glLightModelfv(GLenum pname, const GLfloat *params);
- void glLightModelf(GLenum pname, GLfloat param);
- void glLightiv(GLenum light, GLenum pname, const GLint *params);
- void glLighti(GLenum light, GLenum pname, GLint param);
- void glLightfv(GLenum light, GLenum pname, const GLfloat *params);
- void glLightf(GLenum light, GLenum pname, GLfloat param);
- void glFogiv(GLenum pname, const GLint *params);
- void glFogi(GLenum pname, GLint param);
- void glFogfv(GLenum pname, const GLfloat *params);
- void glFogf(GLenum pname, GLfloat param);
- void glColorMaterial(GLenum face, GLenum mode);
- void glClipPlane(GLenum plane, const GLdouble *equation);
- void glVertex4sv(const GLshort *v);
- void glVertex4s(GLshort x, GLshort y, GLshort z, GLshort w);
- void glVertex4iv(const GLint *v);
- void glVertex4i(GLint x, GLint y, GLint z, GLint w);
- void glVertex4fv(const GLfloat *v);
- void glVertex4f(GLfloat x, GLfloat y, GLfloat z, GLfloat w);
- void glVertex4dv(const GLdouble *v);
- void glVertex4d(GLdouble x, GLdouble y, GLdouble z, GLdouble w);
- void glVertex3sv(const GLshort *v);
- void glVertex3s(GLshort x, GLshort y, GLshort z);
- void glVertex3iv(const GLint *v);
- void glVertex3i(GLint x, GLint y, GLint z);
- void glVertex3fv(const GLfloat *v);
- void glVertex3f(GLfloat x, GLfloat y, GLfloat z);
- void glVertex3dv(const GLdouble *v);
- void glVertex3d(GLdouble x, GLdouble y, GLdouble z);
- void glVertex2sv(const GLshort *v);
- void glVertex2s(GLshort x, GLshort y);
- void glVertex2iv(const GLint *v);
- void glVertex2i(GLint x, GLint y);
- void glVertex2fv(const GLfloat *v);
- void glVertex2f(GLfloat x, GLfloat y);
- void glVertex2dv(const GLdouble *v);
- void glVertex2d(GLdouble x, GLdouble y);
- void glTexCoord4sv(const GLshort *v);
- void glTexCoord4s(GLshort s, GLshort t, GLshort r, GLshort q);
- void glTexCoord4iv(const GLint *v);
- void glTexCoord4i(GLint s, GLint t, GLint r, GLint q);
- void glTexCoord4fv(const GLfloat *v);
- void glTexCoord4f(GLfloat s, GLfloat t, GLfloat r, GLfloat q);
- void glTexCoord4dv(const GLdouble *v);
- void glTexCoord4d(GLdouble s, GLdouble t, GLdouble r, GLdouble q);
- void glTexCoord3sv(const GLshort *v);
- void glTexCoord3s(GLshort s, GLshort t, GLshort r);
- void glTexCoord3iv(const GLint *v);
- void glTexCoord3i(GLint s, GLint t, GLint r);
- void glTexCoord3fv(const GLfloat *v);
- void glTexCoord3f(GLfloat s, GLfloat t, GLfloat r);
- void glTexCoord3dv(const GLdouble *v);
- void glTexCoord3d(GLdouble s, GLdouble t, GLdouble r);
- void glTexCoord2sv(const GLshort *v);
- void glTexCoord2s(GLshort s, GLshort t);
- void glTexCoord2iv(const GLint *v);
- void glTexCoord2i(GLint s, GLint t);
- void glTexCoord2fv(const GLfloat *v);
- void glTexCoord2f(GLfloat s, GLfloat t);
- void glTexCoord2dv(const GLdouble *v);
- void glTexCoord2d(GLdouble s, GLdouble t);
- void glTexCoord1sv(const GLshort *v);
- void glTexCoord1s(GLshort s);
- void glTexCoord1iv(const GLint *v);
- void glTexCoord1i(GLint s);
- void glTexCoord1fv(const GLfloat *v);
- void glTexCoord1f(GLfloat s);
- void glTexCoord1dv(const GLdouble *v);
- void glTexCoord1d(GLdouble s);
- void glRectsv(const GLshort *v1, const GLshort *v2);
- void glRects(GLshort x1, GLshort y1, GLshort x2, GLshort y2);
- void glRectiv(const GLint *v1, const GLint *v2);
- void glRecti(GLint x1, GLint y1, GLint x2, GLint y2);
- void glRectfv(const GLfloat *v1, const GLfloat *v2);
- void glRectf(GLfloat x1, GLfloat y1, GLfloat x2, GLfloat y2);
- void glRectdv(const GLdouble *v1, const GLdouble *v2);
- void glRectd(GLdouble x1, GLdouble y1, GLdouble x2, GLdouble y2);
- void glRasterPos4sv(const GLshort *v);
- void glRasterPos4s(GLshort x, GLshort y, GLshort z, GLshort w);
- void glRasterPos4iv(const GLint *v);
- void glRasterPos4i(GLint x, GLint y, GLint z, GLint w);
- void glRasterPos4fv(const GLfloat *v);
- void glRasterPos4f(GLfloat x, GLfloat y, GLfloat z, GLfloat w);
- void glRasterPos4dv(const GLdouble *v);
- void glRasterPos4d(GLdouble x, GLdouble y, GLdouble z, GLdouble w);
- void glRasterPos3sv(const GLshort *v);
- void glRasterPos3s(GLshort x, GLshort y, GLshort z);
- void glRasterPos3iv(const GLint *v);
- void glRasterPos3i(GLint x, GLint y, GLint z);
- void glRasterPos3fv(const GLfloat *v);
- void glRasterPos3f(GLfloat x, GLfloat y, GLfloat z);
- void glRasterPos3dv(const GLdouble *v);
- void glRasterPos3d(GLdouble x, GLdouble y, GLdouble z);
- void glRasterPos2sv(const GLshort *v);
- void glRasterPos2s(GLshort x, GLshort y);
- void glRasterPos2iv(const GLint *v);
- void glRasterPos2i(GLint x, GLint y);
- void glRasterPos2fv(const GLfloat *v);
- void glRasterPos2f(GLfloat x, GLfloat y);
- void glRasterPos2dv(const GLdouble *v);
- void glRasterPos2d(GLdouble x, GLdouble y);
- void glNormal3sv(const GLshort *v);
- void glNormal3s(GLshort nx, GLshort ny, GLshort nz);
- void glNormal3iv(const GLint *v);
- void glNormal3i(GLint nx, GLint ny, GLint nz);
- void glNormal3fv(const GLfloat *v);
- void glNormal3f(GLfloat nx, GLfloat ny, GLfloat nz);
- void glNormal3dv(const GLdouble *v);
- void glNormal3d(GLdouble nx, GLdouble ny, GLdouble nz);
- void glNormal3bv(const GLbyte *v);
- void glNormal3b(GLbyte nx, GLbyte ny, GLbyte nz);
- void glIndexsv(const GLshort *c);
- void glIndexs(GLshort c);
- void glIndexiv(const GLint *c);
- void glIndexi(GLint c);
- void glIndexfv(const GLfloat *c);
- void glIndexf(GLfloat c);
- void glIndexdv(const GLdouble *c);
- void glIndexd(GLdouble c);
- void glEnd();
- void glEdgeFlagv(const GLboolean *flag);
- void glEdgeFlag(GLboolean flag);
- void glColor4usv(const GLushort *v);
- void glColor4us(GLushort red, GLushort green, GLushort blue, GLushort alpha);
- void glColor4uiv(const GLuint *v);
- void glColor4ui(GLuint red, GLuint green, GLuint blue, GLuint alpha);
- void glColor4ubv(const GLubyte *v);
- void glColor4ub(GLubyte red, GLubyte green, GLubyte blue, GLubyte alpha);
- void glColor4sv(const GLshort *v);
- void glColor4s(GLshort red, GLshort green, GLshort blue, GLshort alpha);
- void glColor4iv(const GLint *v);
- void glColor4i(GLint red, GLint green, GLint blue, GLint alpha);
- void glColor4fv(const GLfloat *v);
- void glColor4f(GLfloat red, GLfloat green, GLfloat blue, GLfloat alpha);
- void glColor4dv(const GLdouble *v);
- void glColor4d(GLdouble red, GLdouble green, GLdouble blue, GLdouble alpha);
- void glColor4bv(const GLbyte *v);
- void glColor4b(GLbyte red, GLbyte green, GLbyte blue, GLbyte alpha);
- void glColor3usv(const GLushort *v);
- void glColor3us(GLushort red, GLushort green, GLushort blue);
- void glColor3uiv(const GLuint *v);
- void glColor3ui(GLuint red, GLuint green, GLuint blue);
- void glColor3ubv(const GLubyte *v);
- void glColor3ub(GLubyte red, GLubyte green, GLubyte blue);
- void glColor3sv(const GLshort *v);
- void glColor3s(GLshort red, GLshort green, GLshort blue);
- void glColor3iv(const GLint *v);
- void glColor3i(GLint red, GLint green, GLint blue);
- void glColor3fv(const GLfloat *v);
- void glColor3f(GLfloat red, GLfloat green, GLfloat blue);
- void glColor3dv(const GLdouble *v);
- void glColor3d(GLdouble red, GLdouble green, GLdouble blue);
- void glColor3bv(const GLbyte *v);
- void glColor3b(GLbyte red, GLbyte green, GLbyte blue);
- void glBitmap(GLsizei width, GLsizei height, GLfloat xorig, GLfloat yorig, GLfloat xmove, GLfloat ymove, const GLubyte *bitmap);
- void glBegin(GLenum mode);
- void glListBase(GLuint base);
- GLuint glGenLists(GLsizei range);
- void glDeleteLists(GLuint list, GLsizei range);
- void glCallLists(GLsizei n, GLenum type, const GLvoid *lists);
- void glCallList(GLuint list);
- void glEndList();
- void glNewList(GLuint list, GLenum mode);
-
- // OpenGL 1.1 deprecated functions
- void glPushClientAttrib(GLbitfield mask);
- void glPopClientAttrib();
- void glPrioritizeTextures(GLsizei n, const GLuint *textures, const GLfloat *priorities);
- GLboolean glAreTexturesResident(GLsizei n, const GLuint *textures, GLboolean *residences);
- void glVertexPointer(GLint size, GLenum type, GLsizei stride, const GLvoid *pointer);
- void glTexCoordPointer(GLint size, GLenum type, GLsizei stride, const GLvoid *pointer);
- void glNormalPointer(GLenum type, GLsizei stride, const GLvoid *pointer);
- void glInterleavedArrays(GLenum format, GLsizei stride, const GLvoid *pointer);
- void glIndexPointer(GLenum type, GLsizei stride, const GLvoid *pointer);
- void glEnableClientState(GLenum array);
- void glEdgeFlagPointer(GLsizei stride, const GLvoid *pointer);
- void glDisableClientState(GLenum array);
- void glColorPointer(GLint size, GLenum type, GLsizei stride, const GLvoid *pointer);
- void glArrayElement(GLint i);
-
- // OpenGL 1.2 deprecated functions
- void glResetMinmax(GLenum target);
- void glResetHistogram(GLenum target);
- void glMinmax(GLenum target, GLenum internalformat, GLboolean sink);
- void glHistogram(GLenum target, GLsizei width, GLenum internalformat, GLboolean sink);
- void glGetMinmaxParameteriv(GLenum target, GLenum pname, GLint *params);
- void glGetMinmaxParameterfv(GLenum target, GLenum pname, GLfloat *params);
- void glGetMinmax(GLenum target, GLboolean reset, GLenum format, GLenum type, GLvoid *values);
- void glGetHistogramParameteriv(GLenum target, GLenum pname, GLint *params);
- void glGetHistogramParameterfv(GLenum target, GLenum pname, GLfloat *params);
- void glGetHistogram(GLenum target, GLboolean reset, GLenum format, GLenum type, GLvoid *values);
- void glSeparableFilter2D(GLenum target, GLenum internalformat, GLsizei width, GLsizei height, GLenum format, GLenum type, const GLvoid *row, const GLvoid *column);
- void glGetSeparableFilter(GLenum target, GLenum format, GLenum type, GLvoid *row, GLvoid *column, GLvoid *span);
- void glGetConvolutionParameteriv(GLenum target, GLenum pname, GLint *params);
- void glGetConvolutionParameterfv(GLenum target, GLenum pname, GLfloat *params);
- void glGetConvolutionFilter(GLenum target, GLenum format, GLenum type, GLvoid *image);
- void glCopyConvolutionFilter2D(GLenum target, GLenum internalformat, GLint x, GLint y, GLsizei width, GLsizei height);
- void glCopyConvolutionFilter1D(GLenum target, GLenum internalformat, GLint x, GLint y, GLsizei width);
- void glConvolutionParameteriv(GLenum target, GLenum pname, const GLint *params);
- void glConvolutionParameteri(GLenum target, GLenum pname, GLint params);
- void glConvolutionParameterfv(GLenum target, GLenum pname, const GLfloat *params);
- void glConvolutionParameterf(GLenum target, GLenum pname, GLfloat params);
- void glConvolutionFilter2D(GLenum target, GLenum internalformat, GLsizei width, GLsizei height, GLenum format, GLenum type, const GLvoid *image);
- void glConvolutionFilter1D(GLenum target, GLenum internalformat, GLsizei width, GLenum format, GLenum type, const GLvoid *image);
- void glCopyColorSubTable(GLenum target, GLsizei start, GLint x, GLint y, GLsizei width);
- void glColorSubTable(GLenum target, GLsizei start, GLsizei count, GLenum format, GLenum type, const GLvoid *data);
- void glGetColorTableParameteriv(GLenum target, GLenum pname, GLint *params);
- void glGetColorTableParameterfv(GLenum target, GLenum pname, GLfloat *params);
- void glGetColorTable(GLenum target, GLenum format, GLenum type, GLvoid *table);
- void glCopyColorTable(GLenum target, GLenum internalformat, GLint x, GLint y, GLsizei width);
- void glColorTableParameteriv(GLenum target, GLenum pname, const GLint *params);
- void glColorTableParameterfv(GLenum target, GLenum pname, const GLfloat *params);
- void glColorTable(GLenum target, GLenum internalformat, GLsizei width, GLenum format, GLenum type, const GLvoid *table);
-
- // OpenGL 1.3 deprecated functions
- void glMultTransposeMatrixd(const GLdouble *m);
- void glMultTransposeMatrixf(const GLfloat *m);
- void glLoadTransposeMatrixd(const GLdouble *m);
- void glLoadTransposeMatrixf(const GLfloat *m);
- void glMultiTexCoord4sv(GLenum target, const GLshort *v);
- void glMultiTexCoord4s(GLenum target, GLshort s, GLshort t, GLshort r, GLshort q);
- void glMultiTexCoord4iv(GLenum target, const GLint *v);
- void glMultiTexCoord4i(GLenum target, GLint s, GLint t, GLint r, GLint q);
- void glMultiTexCoord4fv(GLenum target, const GLfloat *v);
- void glMultiTexCoord4f(GLenum target, GLfloat s, GLfloat t, GLfloat r, GLfloat q);
- void glMultiTexCoord4dv(GLenum target, const GLdouble *v);
- void glMultiTexCoord4d(GLenum target, GLdouble s, GLdouble t, GLdouble r, GLdouble q);
- void glMultiTexCoord3sv(GLenum target, const GLshort *v);
- void glMultiTexCoord3s(GLenum target, GLshort s, GLshort t, GLshort r);
- void glMultiTexCoord3iv(GLenum target, const GLint *v);
- void glMultiTexCoord3i(GLenum target, GLint s, GLint t, GLint r);
- void glMultiTexCoord3fv(GLenum target, const GLfloat *v);
- void glMultiTexCoord3f(GLenum target, GLfloat s, GLfloat t, GLfloat r);
- void glMultiTexCoord3dv(GLenum target, const GLdouble *v);
- void glMultiTexCoord3d(GLenum target, GLdouble s, GLdouble t, GLdouble r);
- void glMultiTexCoord2sv(GLenum target, const GLshort *v);
- void glMultiTexCoord2s(GLenum target, GLshort s, GLshort t);
- void glMultiTexCoord2iv(GLenum target, const GLint *v);
- void glMultiTexCoord2i(GLenum target, GLint s, GLint t);
- void glMultiTexCoord2fv(GLenum target, const GLfloat *v);
- void glMultiTexCoord2f(GLenum target, GLfloat s, GLfloat t);
- void glMultiTexCoord2dv(GLenum target, const GLdouble *v);
- void glMultiTexCoord2d(GLenum target, GLdouble s, GLdouble t);
- void glMultiTexCoord1sv(GLenum target, const GLshort *v);
- void glMultiTexCoord1s(GLenum target, GLshort s);
- void glMultiTexCoord1iv(GLenum target, const GLint *v);
- void glMultiTexCoord1i(GLenum target, GLint s);
- void glMultiTexCoord1fv(GLenum target, const GLfloat *v);
- void glMultiTexCoord1f(GLenum target, GLfloat s);
- void glMultiTexCoord1dv(GLenum target, const GLdouble *v);
- void glMultiTexCoord1d(GLenum target, GLdouble s);
- void glClientActiveTexture(GLenum texture);
-
-private:
- friend class QOpenGLContext;
-
- static bool isContextCompatible(QOpenGLContext *context);
- static QOpenGLVersionProfile versionProfile();
-
- QOpenGLFunctions_1_0_CoreBackend* d_1_0_Core;
- QOpenGLFunctions_1_1_CoreBackend* d_1_1_Core;
- QOpenGLFunctions_1_2_CoreBackend* d_1_2_Core;
- QOpenGLFunctions_1_3_CoreBackend* d_1_3_Core;
- QOpenGLFunctions_1_0_DeprecatedBackend* d_1_0_Deprecated;
- QOpenGLFunctions_1_1_DeprecatedBackend* d_1_1_Deprecated;
- QOpenGLFunctions_1_2_DeprecatedBackend* d_1_2_Deprecated;
- QOpenGLFunctions_1_3_DeprecatedBackend* d_1_3_Deprecated;
-};
-
-// OpenGL 1.0 core functions
-inline void QOpenGLFunctions_1_3::glViewport(GLint x, GLint y, GLsizei width, GLsizei height)
-{
- d_1_0_Core->f.Viewport(x, y, width, height);
-}
-
-inline void QOpenGLFunctions_1_3::glDepthRange(GLdouble nearVal, GLdouble farVal)
-{
- d_1_0_Core->f.DepthRange(nearVal, farVal);
-}
-
-inline GLboolean QOpenGLFunctions_1_3::glIsEnabled(GLenum cap)
-{
- return d_1_0_Core->f.IsEnabled(cap);
-}
-
-inline void QOpenGLFunctions_1_3::glGetTexLevelParameteriv(GLenum target, GLint level, GLenum pname, GLint *params)
-{
- d_1_0_Core->f.GetTexLevelParameteriv(target, level, pname, params);
-}
-
-inline void QOpenGLFunctions_1_3::glGetTexLevelParameterfv(GLenum target, GLint level, GLenum pname, GLfloat *params)
-{
- d_1_0_Core->f.GetTexLevelParameterfv(target, level, pname, params);
-}
-
-inline void QOpenGLFunctions_1_3::glGetTexParameteriv(GLenum target, GLenum pname, GLint *params)
-{
- d_1_0_Core->f.GetTexParameteriv(target, pname, params);
-}
-
-inline void QOpenGLFunctions_1_3::glGetTexParameterfv(GLenum target, GLenum pname, GLfloat *params)
-{
- d_1_0_Core->f.GetTexParameterfv(target, pname, params);
-}
-
-inline void QOpenGLFunctions_1_3::glGetTexImage(GLenum target, GLint level, GLenum format, GLenum type, GLvoid *pixels)
-{
- d_1_0_Core->f.GetTexImage(target, level, format, type, pixels);
-}
-
-inline const GLubyte * QOpenGLFunctions_1_3::glGetString(GLenum name)
-{
- return d_1_0_Core->f.GetString(name);
-}
-
-inline void QOpenGLFunctions_1_3::glGetIntegerv(GLenum pname, GLint *params)
-{
- d_1_0_Core->f.GetIntegerv(pname, params);
-}
-
-inline void QOpenGLFunctions_1_3::glGetFloatv(GLenum pname, GLfloat *params)
-{
- d_1_0_Core->f.GetFloatv(pname, params);
-}
-
-inline GLenum QOpenGLFunctions_1_3::glGetError()
-{
- return d_1_0_Core->f.GetError();
-}
-
-inline void QOpenGLFunctions_1_3::glGetDoublev(GLenum pname, GLdouble *params)
-{
- d_1_0_Core->f.GetDoublev(pname, params);
-}
-
-inline void QOpenGLFunctions_1_3::glGetBooleanv(GLenum pname, GLboolean *params)
-{
- d_1_0_Core->f.GetBooleanv(pname, params);
-}
-
-inline void QOpenGLFunctions_1_3::glReadPixels(GLint x, GLint y, GLsizei width, GLsizei height, GLenum format, GLenum type, GLvoid *pixels)
-{
- d_1_0_Core->f.ReadPixels(x, y, width, height, format, type, pixels);
-}
-
-inline void QOpenGLFunctions_1_3::glReadBuffer(GLenum mode)
-{
- d_1_0_Core->f.ReadBuffer(mode);
-}
-
-inline void QOpenGLFunctions_1_3::glPixelStorei(GLenum pname, GLint param)
-{
- d_1_0_Core->f.PixelStorei(pname, param);
-}
-
-inline void QOpenGLFunctions_1_3::glPixelStoref(GLenum pname, GLfloat param)
-{
- d_1_0_Core->f.PixelStoref(pname, param);
-}
-
-inline void QOpenGLFunctions_1_3::glDepthFunc(GLenum func)
-{
- d_1_0_Core->f.DepthFunc(func);
-}
-
-inline void QOpenGLFunctions_1_3::glStencilOp(GLenum fail, GLenum zfail, GLenum zpass)
-{
- d_1_0_Core->f.StencilOp(fail, zfail, zpass);
-}
-
-inline void QOpenGLFunctions_1_3::glStencilFunc(GLenum func, GLint ref, GLuint mask)
-{
- d_1_0_Core->f.StencilFunc(func, ref, mask);
-}
-
-inline void QOpenGLFunctions_1_3::glLogicOp(GLenum opcode)
-{
- d_1_0_Core->f.LogicOp(opcode);
-}
-
-inline void QOpenGLFunctions_1_3::glBlendFunc(GLenum sfactor, GLenum dfactor)
-{
- d_1_0_Core->f.BlendFunc(sfactor, dfactor);
-}
-
-inline void QOpenGLFunctions_1_3::glFlush()
-{
- d_1_0_Core->f.Flush();
-}
-
-inline void QOpenGLFunctions_1_3::glFinish()
-{
- d_1_0_Core->f.Finish();
-}
-
-inline void QOpenGLFunctions_1_3::glEnable(GLenum cap)
-{
- d_1_0_Core->f.Enable(cap);
-}
-
-inline void QOpenGLFunctions_1_3::glDisable(GLenum cap)
-{
- d_1_0_Core->f.Disable(cap);
-}
-
-inline void QOpenGLFunctions_1_3::glDepthMask(GLboolean flag)
-{
- d_1_0_Core->f.DepthMask(flag);
-}
-
-inline void QOpenGLFunctions_1_3::glColorMask(GLboolean red, GLboolean green, GLboolean blue, GLboolean alpha)
-{
- d_1_0_Core->f.ColorMask(red, green, blue, alpha);
-}
-
-inline void QOpenGLFunctions_1_3::glStencilMask(GLuint mask)
-{
- d_1_0_Core->f.StencilMask(mask);
-}
-
-inline void QOpenGLFunctions_1_3::glClearDepth(GLdouble depth)
-{
- d_1_0_Core->f.ClearDepth(depth);
-}
-
-inline void QOpenGLFunctions_1_3::glClearStencil(GLint s)
-{
- d_1_0_Core->f.ClearStencil(s);
-}
-
-inline void QOpenGLFunctions_1_3::glClearColor(GLfloat red, GLfloat green, GLfloat blue, GLfloat alpha)
-{
- d_1_0_Core->f.ClearColor(red, green, blue, alpha);
-}
-
-inline void QOpenGLFunctions_1_3::glClear(GLbitfield mask)
-{
- d_1_0_Core->f.Clear(mask);
-}
-
-inline void QOpenGLFunctions_1_3::glDrawBuffer(GLenum mode)
-{
- d_1_0_Core->f.DrawBuffer(mode);
-}
-
-inline void QOpenGLFunctions_1_3::glTexImage2D(GLenum target, GLint level, GLint internalformat, GLsizei width, GLsizei height, GLint border, GLenum format, GLenum type, const GLvoid *pixels)
-{
- d_1_0_Core->f.TexImage2D(target, level, internalformat, width, height, border, format, type, pixels);
-}
-
-inline void QOpenGLFunctions_1_3::glTexImage1D(GLenum target, GLint level, GLint internalformat, GLsizei width, GLint border, GLenum format, GLenum type, const GLvoid *pixels)
-{
- d_1_0_Core->f.TexImage1D(target, level, internalformat, width, border, format, type, pixels);
-}
-
-inline void QOpenGLFunctions_1_3::glTexParameteriv(GLenum target, GLenum pname, const GLint *params)
-{
- d_1_0_Core->f.TexParameteriv(target, pname, params);
-}
-
-inline void QOpenGLFunctions_1_3::glTexParameteri(GLenum target, GLenum pname, GLint param)
-{
- d_1_0_Core->f.TexParameteri(target, pname, param);
-}
-
-inline void QOpenGLFunctions_1_3::glTexParameterfv(GLenum target, GLenum pname, const GLfloat *params)
-{
- d_1_0_Core->f.TexParameterfv(target, pname, params);
-}
-
-inline void QOpenGLFunctions_1_3::glTexParameterf(GLenum target, GLenum pname, GLfloat param)
-{
- d_1_0_Core->f.TexParameterf(target, pname, param);
-}
-
-inline void QOpenGLFunctions_1_3::glScissor(GLint x, GLint y, GLsizei width, GLsizei height)
-{
- d_1_0_Core->f.Scissor(x, y, width, height);
-}
-
-inline void QOpenGLFunctions_1_3::glPolygonMode(GLenum face, GLenum mode)
-{
- d_1_0_Core->f.PolygonMode(face, mode);
-}
-
-inline void QOpenGLFunctions_1_3::glPointSize(GLfloat size)
-{
- d_1_0_Core->f.PointSize(size);
-}
-
-inline void QOpenGLFunctions_1_3::glLineWidth(GLfloat width)
-{
- d_1_0_Core->f.LineWidth(width);
-}
-
-inline void QOpenGLFunctions_1_3::glHint(GLenum target, GLenum mode)
-{
- d_1_0_Core->f.Hint(target, mode);
-}
-
-inline void QOpenGLFunctions_1_3::glFrontFace(GLenum mode)
-{
- d_1_0_Core->f.FrontFace(mode);
-}
-
-inline void QOpenGLFunctions_1_3::glCullFace(GLenum mode)
-{
- d_1_0_Core->f.CullFace(mode);
-}
-
-
-// OpenGL 1.1 core functions
-inline void QOpenGLFunctions_1_3::glIndexubv(const GLubyte *c)
-{
- d_1_1_Deprecated->f.Indexubv(c);
-}
-
-inline void QOpenGLFunctions_1_3::glIndexub(GLubyte c)
-{
- d_1_1_Deprecated->f.Indexub(c);
-}
-
-inline GLboolean QOpenGLFunctions_1_3::glIsTexture(GLuint texture)
-{
- return d_1_1_Core->f.IsTexture(texture);
-}
-
-inline void QOpenGLFunctions_1_3::glGenTextures(GLsizei n, GLuint *textures)
-{
- d_1_1_Core->f.GenTextures(n, textures);
-}
-
-inline void QOpenGLFunctions_1_3::glDeleteTextures(GLsizei n, const GLuint *textures)
-{
- d_1_1_Core->f.DeleteTextures(n, textures);
-}
-
-inline void QOpenGLFunctions_1_3::glBindTexture(GLenum target, GLuint texture)
-{
- d_1_1_Core->f.BindTexture(target, texture);
-}
-
-inline void QOpenGLFunctions_1_3::glTexSubImage2D(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLenum type, const GLvoid *pixels)
-{
- d_1_1_Core->f.TexSubImage2D(target, level, xoffset, yoffset, width, height, format, type, pixels);
-}
-
-inline void QOpenGLFunctions_1_3::glTexSubImage1D(GLenum target, GLint level, GLint xoffset, GLsizei width, GLenum format, GLenum type, const GLvoid *pixels)
-{
- d_1_1_Core->f.TexSubImage1D(target, level, xoffset, width, format, type, pixels);
-}
-
-inline void QOpenGLFunctions_1_3::glCopyTexSubImage2D(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint x, GLint y, GLsizei width, GLsizei height)
-{
- d_1_1_Core->f.CopyTexSubImage2D(target, level, xoffset, yoffset, x, y, width, height);
-}
-
-inline void QOpenGLFunctions_1_3::glCopyTexSubImage1D(GLenum target, GLint level, GLint xoffset, GLint x, GLint y, GLsizei width)
-{
- d_1_1_Core->f.CopyTexSubImage1D(target, level, xoffset, x, y, width);
-}
-
-inline void QOpenGLFunctions_1_3::glCopyTexImage2D(GLenum target, GLint level, GLenum internalformat, GLint x, GLint y, GLsizei width, GLsizei height, GLint border)
-{
- d_1_1_Core->f.CopyTexImage2D(target, level, internalformat, x, y, width, height, border);
-}
-
-inline void QOpenGLFunctions_1_3::glCopyTexImage1D(GLenum target, GLint level, GLenum internalformat, GLint x, GLint y, GLsizei width, GLint border)
-{
- d_1_1_Core->f.CopyTexImage1D(target, level, internalformat, x, y, width, border);
-}
-
-inline void QOpenGLFunctions_1_3::glPolygonOffset(GLfloat factor, GLfloat units)
-{
- d_1_1_Core->f.PolygonOffset(factor, units);
-}
-
-inline void QOpenGLFunctions_1_3::glGetPointerv(GLenum pname, GLvoid* *params)
-{
- d_1_1_Deprecated->f.GetPointerv(pname, params);
-}
-
-inline void QOpenGLFunctions_1_3::glDrawElements(GLenum mode, GLsizei count, GLenum type, const GLvoid *indices)
-{
- d_1_1_Core->f.DrawElements(mode, count, type, indices);
-}
-
-inline void QOpenGLFunctions_1_3::glDrawArrays(GLenum mode, GLint first, GLsizei count)
-{
- d_1_1_Core->f.DrawArrays(mode, first, count);
-}
-
-
-// OpenGL 1.2 core functions
-inline void QOpenGLFunctions_1_3::glCopyTexSubImage3D(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLint x, GLint y, GLsizei width, GLsizei height)
-{
- d_1_2_Core->f.CopyTexSubImage3D(target, level, xoffset, yoffset, zoffset, x, y, width, height);
-}
-
-inline void QOpenGLFunctions_1_3::glTexSubImage3D(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLenum type, const GLvoid *pixels)
-{
- d_1_2_Core->f.TexSubImage3D(target, level, xoffset, yoffset, zoffset, width, height, depth, format, type, pixels);
-}
-
-inline void QOpenGLFunctions_1_3::glTexImage3D(GLenum target, GLint level, GLint internalformat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLenum format, GLenum type, const GLvoid *pixels)
-{
- d_1_2_Core->f.TexImage3D(target, level, internalformat, width, height, depth, border, format, type, pixels);
-}
-
-inline void QOpenGLFunctions_1_3::glDrawRangeElements(GLenum mode, GLuint start, GLuint end, GLsizei count, GLenum type, const GLvoid *indices)
-{
- d_1_2_Core->f.DrawRangeElements(mode, start, end, count, type, indices);
-}
-
-inline void QOpenGLFunctions_1_3::glBlendEquation(GLenum mode)
-{
- d_1_2_Core->f.BlendEquation(mode);
-}
-
-inline void QOpenGLFunctions_1_3::glBlendColor(GLfloat red, GLfloat green, GLfloat blue, GLfloat alpha)
-{
- d_1_2_Core->f.BlendColor(red, green, blue, alpha);
-}
-
-
-// OpenGL 1.3 core functions
-inline void QOpenGLFunctions_1_3::glGetCompressedTexImage(GLenum target, GLint level, GLvoid *img)
-{
- d_1_3_Core->f.GetCompressedTexImage(target, level, img);
-}
-
-inline void QOpenGLFunctions_1_3::glCompressedTexSubImage1D(GLenum target, GLint level, GLint xoffset, GLsizei width, GLenum format, GLsizei imageSize, const GLvoid *data)
-{
- d_1_3_Core->f.CompressedTexSubImage1D(target, level, xoffset, width, format, imageSize, data);
-}
-
-inline void QOpenGLFunctions_1_3::glCompressedTexSubImage2D(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLsizei imageSize, const GLvoid *data)
-{
- d_1_3_Core->f.CompressedTexSubImage2D(target, level, xoffset, yoffset, width, height, format, imageSize, data);
-}
-
-inline void QOpenGLFunctions_1_3::glCompressedTexSubImage3D(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLsizei imageSize, const GLvoid *data)
-{
- d_1_3_Core->f.CompressedTexSubImage3D(target, level, xoffset, yoffset, zoffset, width, height, depth, format, imageSize, data);
-}
-
-inline void QOpenGLFunctions_1_3::glCompressedTexImage1D(GLenum target, GLint level, GLenum internalformat, GLsizei width, GLint border, GLsizei imageSize, const GLvoid *data)
-{
- d_1_3_Core->f.CompressedTexImage1D(target, level, internalformat, width, border, imageSize, data);
-}
-
-inline void QOpenGLFunctions_1_3::glCompressedTexImage2D(GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLint border, GLsizei imageSize, const GLvoid *data)
-{
- d_1_3_Core->f.CompressedTexImage2D(target, level, internalformat, width, height, border, imageSize, data);
-}
-
-inline void QOpenGLFunctions_1_3::glCompressedTexImage3D(GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLsizei imageSize, const GLvoid *data)
-{
- d_1_3_Core->f.CompressedTexImage3D(target, level, internalformat, width, height, depth, border, imageSize, data);
-}
-
-inline void QOpenGLFunctions_1_3::glSampleCoverage(GLfloat value, GLboolean invert)
-{
- d_1_3_Core->f.SampleCoverage(value, invert);
-}
-
-inline void QOpenGLFunctions_1_3::glActiveTexture(GLenum texture)
-{
- d_1_3_Core->f.ActiveTexture(texture);
-}
-
-
-// OpenGL 1.0 deprecated functions
-inline void QOpenGLFunctions_1_3::glTranslatef(GLfloat x, GLfloat y, GLfloat z)
-{
- d_1_0_Deprecated->f.Translatef(x, y, z);
-}
-
-inline void QOpenGLFunctions_1_3::glTranslated(GLdouble x, GLdouble y, GLdouble z)
-{
- d_1_0_Deprecated->f.Translated(x, y, z);
-}
-
-inline void QOpenGLFunctions_1_3::glScalef(GLfloat x, GLfloat y, GLfloat z)
-{
- d_1_0_Deprecated->f.Scalef(x, y, z);
-}
-
-inline void QOpenGLFunctions_1_3::glScaled(GLdouble x, GLdouble y, GLdouble z)
-{
- d_1_0_Deprecated->f.Scaled(x, y, z);
-}
-
-inline void QOpenGLFunctions_1_3::glRotatef(GLfloat angle, GLfloat x, GLfloat y, GLfloat z)
-{
- d_1_0_Deprecated->f.Rotatef(angle, x, y, z);
-}
-
-inline void QOpenGLFunctions_1_3::glRotated(GLdouble angle, GLdouble x, GLdouble y, GLdouble z)
-{
- d_1_0_Deprecated->f.Rotated(angle, x, y, z);
-}
-
-inline void QOpenGLFunctions_1_3::glPushMatrix()
-{
- d_1_0_Deprecated->f.PushMatrix();
-}
-
-inline void QOpenGLFunctions_1_3::glPopMatrix()
-{
- d_1_0_Deprecated->f.PopMatrix();
-}
-
-inline void QOpenGLFunctions_1_3::glOrtho(GLdouble left, GLdouble right, GLdouble bottom, GLdouble top, GLdouble zNear, GLdouble zFar)
-{
- d_1_0_Deprecated->f.Ortho(left, right, bottom, top, zNear, zFar);
-}
-
-inline void QOpenGLFunctions_1_3::glMultMatrixd(const GLdouble *m)
-{
- d_1_0_Deprecated->f.MultMatrixd(m);
-}
-
-inline void QOpenGLFunctions_1_3::glMultMatrixf(const GLfloat *m)
-{
- d_1_0_Deprecated->f.MultMatrixf(m);
-}
-
-inline void QOpenGLFunctions_1_3::glMatrixMode(GLenum mode)
-{
- d_1_0_Deprecated->f.MatrixMode(mode);
-}
-
-inline void QOpenGLFunctions_1_3::glLoadMatrixd(const GLdouble *m)
-{
- d_1_0_Deprecated->f.LoadMatrixd(m);
-}
-
-inline void QOpenGLFunctions_1_3::glLoadMatrixf(const GLfloat *m)
-{
- d_1_0_Deprecated->f.LoadMatrixf(m);
-}
-
-inline void QOpenGLFunctions_1_3::glLoadIdentity()
-{
- d_1_0_Deprecated->f.LoadIdentity();
-}
-
-inline void QOpenGLFunctions_1_3::glFrustum(GLdouble left, GLdouble right, GLdouble bottom, GLdouble top, GLdouble zNear, GLdouble zFar)
-{
- d_1_0_Deprecated->f.Frustum(left, right, bottom, top, zNear, zFar);
-}
-
-inline GLboolean QOpenGLFunctions_1_3::glIsList(GLuint list)
-{
- return d_1_0_Deprecated->f.IsList(list);
-}
-
-inline void QOpenGLFunctions_1_3::glGetTexGeniv(GLenum coord, GLenum pname, GLint *params)
-{
- d_1_0_Deprecated->f.GetTexGeniv(coord, pname, params);
-}
-
-inline void QOpenGLFunctions_1_3::glGetTexGenfv(GLenum coord, GLenum pname, GLfloat *params)
-{
- d_1_0_Deprecated->f.GetTexGenfv(coord, pname, params);
-}
-
-inline void QOpenGLFunctions_1_3::glGetTexGendv(GLenum coord, GLenum pname, GLdouble *params)
-{
- d_1_0_Deprecated->f.GetTexGendv(coord, pname, params);
-}
-
-inline void QOpenGLFunctions_1_3::glGetTexEnviv(GLenum target, GLenum pname, GLint *params)
-{
- d_1_0_Deprecated->f.GetTexEnviv(target, pname, params);
-}
-
-inline void QOpenGLFunctions_1_3::glGetTexEnvfv(GLenum target, GLenum pname, GLfloat *params)
-{
- d_1_0_Deprecated->f.GetTexEnvfv(target, pname, params);
-}
-
-inline void QOpenGLFunctions_1_3::glGetPolygonStipple(GLubyte *mask)
-{
- d_1_0_Deprecated->f.GetPolygonStipple(mask);
-}
-
-inline void QOpenGLFunctions_1_3::glGetPixelMapusv(GLenum map, GLushort *values)
-{
- d_1_0_Deprecated->f.GetPixelMapusv(map, values);
-}
-
-inline void QOpenGLFunctions_1_3::glGetPixelMapuiv(GLenum map, GLuint *values)
-{
- d_1_0_Deprecated->f.GetPixelMapuiv(map, values);
-}
-
-inline void QOpenGLFunctions_1_3::glGetPixelMapfv(GLenum map, GLfloat *values)
-{
- d_1_0_Deprecated->f.GetPixelMapfv(map, values);
-}
-
-inline void QOpenGLFunctions_1_3::glGetMaterialiv(GLenum face, GLenum pname, GLint *params)
-{
- d_1_0_Deprecated->f.GetMaterialiv(face, pname, params);
-}
-
-inline void QOpenGLFunctions_1_3::glGetMaterialfv(GLenum face, GLenum pname, GLfloat *params)
-{
- d_1_0_Deprecated->f.GetMaterialfv(face, pname, params);
-}
-
-inline void QOpenGLFunctions_1_3::glGetMapiv(GLenum target, GLenum query, GLint *v)
-{
- d_1_0_Deprecated->f.GetMapiv(target, query, v);
-}
-
-inline void QOpenGLFunctions_1_3::glGetMapfv(GLenum target, GLenum query, GLfloat *v)
-{
- d_1_0_Deprecated->f.GetMapfv(target, query, v);
-}
-
-inline void QOpenGLFunctions_1_3::glGetMapdv(GLenum target, GLenum query, GLdouble *v)
-{
- d_1_0_Deprecated->f.GetMapdv(target, query, v);
-}
-
-inline void QOpenGLFunctions_1_3::glGetLightiv(GLenum light, GLenum pname, GLint *params)
-{
- d_1_0_Deprecated->f.GetLightiv(light, pname, params);
-}
-
-inline void QOpenGLFunctions_1_3::glGetLightfv(GLenum light, GLenum pname, GLfloat *params)
-{
- d_1_0_Deprecated->f.GetLightfv(light, pname, params);
-}
-
-inline void QOpenGLFunctions_1_3::glGetClipPlane(GLenum plane, GLdouble *equation)
-{
- d_1_0_Deprecated->f.GetClipPlane(plane, equation);
-}
-
-inline void QOpenGLFunctions_1_3::glDrawPixels(GLsizei width, GLsizei height, GLenum format, GLenum type, const GLvoid *pixels)
-{
- d_1_0_Deprecated->f.DrawPixels(width, height, format, type, pixels);
-}
-
-inline void QOpenGLFunctions_1_3::glCopyPixels(GLint x, GLint y, GLsizei width, GLsizei height, GLenum type)
-{
- d_1_0_Deprecated->f.CopyPixels(x, y, width, height, type);
-}
-
-inline void QOpenGLFunctions_1_3::glPixelMapusv(GLenum map, GLint mapsize, const GLushort *values)
-{
- d_1_0_Deprecated->f.PixelMapusv(map, mapsize, values);
-}
-
-inline void QOpenGLFunctions_1_3::glPixelMapuiv(GLenum map, GLint mapsize, const GLuint *values)
-{
- d_1_0_Deprecated->f.PixelMapuiv(map, mapsize, values);
-}
-
-inline void QOpenGLFunctions_1_3::glPixelMapfv(GLenum map, GLint mapsize, const GLfloat *values)
-{
- d_1_0_Deprecated->f.PixelMapfv(map, mapsize, values);
-}
-
-inline void QOpenGLFunctions_1_3::glPixelTransferi(GLenum pname, GLint param)
-{
- d_1_0_Deprecated->f.PixelTransferi(pname, param);
-}
-
-inline void QOpenGLFunctions_1_3::glPixelTransferf(GLenum pname, GLfloat param)
-{
- d_1_0_Deprecated->f.PixelTransferf(pname, param);
-}
-
-inline void QOpenGLFunctions_1_3::glPixelZoom(GLfloat xfactor, GLfloat yfactor)
-{
- d_1_0_Deprecated->f.PixelZoom(xfactor, yfactor);
-}
-
-inline void QOpenGLFunctions_1_3::glAlphaFunc(GLenum func, GLfloat ref)
-{
- d_1_0_Deprecated->f.AlphaFunc(func, ref);
-}
-
-inline void QOpenGLFunctions_1_3::glEvalPoint2(GLint i, GLint j)
-{
- d_1_0_Deprecated->f.EvalPoint2(i, j);
-}
-
-inline void QOpenGLFunctions_1_3::glEvalMesh2(GLenum mode, GLint i1, GLint i2, GLint j1, GLint j2)
-{
- d_1_0_Deprecated->f.EvalMesh2(mode, i1, i2, j1, j2);
-}
-
-inline void QOpenGLFunctions_1_3::glEvalPoint1(GLint i)
-{
- d_1_0_Deprecated->f.EvalPoint1(i);
-}
-
-inline void QOpenGLFunctions_1_3::glEvalMesh1(GLenum mode, GLint i1, GLint i2)
-{
- d_1_0_Deprecated->f.EvalMesh1(mode, i1, i2);
-}
-
-inline void QOpenGLFunctions_1_3::glEvalCoord2fv(const GLfloat *u)
-{
- d_1_0_Deprecated->f.EvalCoord2fv(u);
-}
-
-inline void QOpenGLFunctions_1_3::glEvalCoord2f(GLfloat u, GLfloat v)
-{
- d_1_0_Deprecated->f.EvalCoord2f(u, v);
-}
-
-inline void QOpenGLFunctions_1_3::glEvalCoord2dv(const GLdouble *u)
-{
- d_1_0_Deprecated->f.EvalCoord2dv(u);
-}
-
-inline void QOpenGLFunctions_1_3::glEvalCoord2d(GLdouble u, GLdouble v)
-{
- d_1_0_Deprecated->f.EvalCoord2d(u, v);
-}
-
-inline void QOpenGLFunctions_1_3::glEvalCoord1fv(const GLfloat *u)
-{
- d_1_0_Deprecated->f.EvalCoord1fv(u);
-}
-
-inline void QOpenGLFunctions_1_3::glEvalCoord1f(GLfloat u)
-{
- d_1_0_Deprecated->f.EvalCoord1f(u);
-}
-
-inline void QOpenGLFunctions_1_3::glEvalCoord1dv(const GLdouble *u)
-{
- d_1_0_Deprecated->f.EvalCoord1dv(u);
-}
-
-inline void QOpenGLFunctions_1_3::glEvalCoord1d(GLdouble u)
-{
- d_1_0_Deprecated->f.EvalCoord1d(u);
-}
-
-inline void QOpenGLFunctions_1_3::glMapGrid2f(GLint un, GLfloat u1, GLfloat u2, GLint vn, GLfloat v1, GLfloat v2)
-{
- d_1_0_Deprecated->f.MapGrid2f(un, u1, u2, vn, v1, v2);
-}
-
-inline void QOpenGLFunctions_1_3::glMapGrid2d(GLint un, GLdouble u1, GLdouble u2, GLint vn, GLdouble v1, GLdouble v2)
-{
- d_1_0_Deprecated->f.MapGrid2d(un, u1, u2, vn, v1, v2);
-}
-
-inline void QOpenGLFunctions_1_3::glMapGrid1f(GLint un, GLfloat u1, GLfloat u2)
-{
- d_1_0_Deprecated->f.MapGrid1f(un, u1, u2);
-}
-
-inline void QOpenGLFunctions_1_3::glMapGrid1d(GLint un, GLdouble u1, GLdouble u2)
-{
- d_1_0_Deprecated->f.MapGrid1d(un, u1, u2);
-}
-
-inline void QOpenGLFunctions_1_3::glMap2f(GLenum target, GLfloat u1, GLfloat u2, GLint ustride, GLint uorder, GLfloat v1, GLfloat v2, GLint vstride, GLint vorder, const GLfloat *points)
-{
- d_1_0_Deprecated->f.Map2f(target, u1, u2, ustride, uorder, v1, v2, vstride, vorder, points);
-}
-
-inline void QOpenGLFunctions_1_3::glMap2d(GLenum target, GLdouble u1, GLdouble u2, GLint ustride, GLint uorder, GLdouble v1, GLdouble v2, GLint vstride, GLint vorder, const GLdouble *points)
-{
- d_1_0_Deprecated->f.Map2d(target, u1, u2, ustride, uorder, v1, v2, vstride, vorder, points);
-}
-
-inline void QOpenGLFunctions_1_3::glMap1f(GLenum target, GLfloat u1, GLfloat u2, GLint stride, GLint order, const GLfloat *points)
-{
- d_1_0_Deprecated->f.Map1f(target, u1, u2, stride, order, points);
-}
-
-inline void QOpenGLFunctions_1_3::glMap1d(GLenum target, GLdouble u1, GLdouble u2, GLint stride, GLint order, const GLdouble *points)
-{
- d_1_0_Deprecated->f.Map1d(target, u1, u2, stride, order, points);
-}
-
-inline void QOpenGLFunctions_1_3::glPushAttrib(GLbitfield mask)
-{
- d_1_0_Deprecated->f.PushAttrib(mask);
-}
-
-inline void QOpenGLFunctions_1_3::glPopAttrib()
-{
- d_1_0_Deprecated->f.PopAttrib();
-}
-
-inline void QOpenGLFunctions_1_3::glAccum(GLenum op, GLfloat value)
-{
- d_1_0_Deprecated->f.Accum(op, value);
-}
-
-inline void QOpenGLFunctions_1_3::glIndexMask(GLuint mask)
-{
- d_1_0_Deprecated->f.IndexMask(mask);
-}
-
-inline void QOpenGLFunctions_1_3::glClearIndex(GLfloat c)
-{
- d_1_0_Deprecated->f.ClearIndex(c);
-}
-
-inline void QOpenGLFunctions_1_3::glClearAccum(GLfloat red, GLfloat green, GLfloat blue, GLfloat alpha)
-{
- d_1_0_Deprecated->f.ClearAccum(red, green, blue, alpha);
-}
-
-inline void QOpenGLFunctions_1_3::glPushName(GLuint name)
-{
- d_1_0_Deprecated->f.PushName(name);
-}
-
-inline void QOpenGLFunctions_1_3::glPopName()
-{
- d_1_0_Deprecated->f.PopName();
-}
-
-inline void QOpenGLFunctions_1_3::glPassThrough(GLfloat token)
-{
- d_1_0_Deprecated->f.PassThrough(token);
-}
-
-inline void QOpenGLFunctions_1_3::glLoadName(GLuint name)
-{
- d_1_0_Deprecated->f.LoadName(name);
-}
-
-inline void QOpenGLFunctions_1_3::glInitNames()
-{
- d_1_0_Deprecated->f.InitNames();
-}
-
-inline GLint QOpenGLFunctions_1_3::glRenderMode(GLenum mode)
-{
- return d_1_0_Deprecated->f.RenderMode(mode);
-}
-
-inline void QOpenGLFunctions_1_3::glSelectBuffer(GLsizei size, GLuint *buffer)
-{
- d_1_0_Deprecated->f.SelectBuffer(size, buffer);
-}
-
-inline void QOpenGLFunctions_1_3::glFeedbackBuffer(GLsizei size, GLenum type, GLfloat *buffer)
-{
- d_1_0_Deprecated->f.FeedbackBuffer(size, type, buffer);
-}
-
-inline void QOpenGLFunctions_1_3::glTexGeniv(GLenum coord, GLenum pname, const GLint *params)
-{
- d_1_0_Deprecated->f.TexGeniv(coord, pname, params);
-}
-
-inline void QOpenGLFunctions_1_3::glTexGeni(GLenum coord, GLenum pname, GLint param)
-{
- d_1_0_Deprecated->f.TexGeni(coord, pname, param);
-}
-
-inline void QOpenGLFunctions_1_3::glTexGenfv(GLenum coord, GLenum pname, const GLfloat *params)
-{
- d_1_0_Deprecated->f.TexGenfv(coord, pname, params);
-}
-
-inline void QOpenGLFunctions_1_3::glTexGenf(GLenum coord, GLenum pname, GLfloat param)
-{
- d_1_0_Deprecated->f.TexGenf(coord, pname, param);
-}
-
-inline void QOpenGLFunctions_1_3::glTexGendv(GLenum coord, GLenum pname, const GLdouble *params)
-{
- d_1_0_Deprecated->f.TexGendv(coord, pname, params);
-}
-
-inline void QOpenGLFunctions_1_3::glTexGend(GLenum coord, GLenum pname, GLdouble param)
-{
- d_1_0_Deprecated->f.TexGend(coord, pname, param);
-}
-
-inline void QOpenGLFunctions_1_3::glTexEnviv(GLenum target, GLenum pname, const GLint *params)
-{
- d_1_0_Deprecated->f.TexEnviv(target, pname, params);
-}
-
-inline void QOpenGLFunctions_1_3::glTexEnvi(GLenum target, GLenum pname, GLint param)
-{
- d_1_0_Deprecated->f.TexEnvi(target, pname, param);
-}
-
-inline void QOpenGLFunctions_1_3::glTexEnvfv(GLenum target, GLenum pname, const GLfloat *params)
-{
- d_1_0_Deprecated->f.TexEnvfv(target, pname, params);
-}
-
-inline void QOpenGLFunctions_1_3::glTexEnvf(GLenum target, GLenum pname, GLfloat param)
-{
- d_1_0_Deprecated->f.TexEnvf(target, pname, param);
-}
-
-inline void QOpenGLFunctions_1_3::glShadeModel(GLenum mode)
-{
- d_1_0_Deprecated->f.ShadeModel(mode);
-}
-
-inline void QOpenGLFunctions_1_3::glPolygonStipple(const GLubyte *mask)
-{
- d_1_0_Deprecated->f.PolygonStipple(mask);
-}
-
-inline void QOpenGLFunctions_1_3::glMaterialiv(GLenum face, GLenum pname, const GLint *params)
-{
- d_1_0_Deprecated->f.Materialiv(face, pname, params);
-}
-
-inline void QOpenGLFunctions_1_3::glMateriali(GLenum face, GLenum pname, GLint param)
-{
- d_1_0_Deprecated->f.Materiali(face, pname, param);
-}
-
-inline void QOpenGLFunctions_1_3::glMaterialfv(GLenum face, GLenum pname, const GLfloat *params)
-{
- d_1_0_Deprecated->f.Materialfv(face, pname, params);
-}
-
-inline void QOpenGLFunctions_1_3::glMaterialf(GLenum face, GLenum pname, GLfloat param)
-{
- d_1_0_Deprecated->f.Materialf(face, pname, param);
-}
-
-inline void QOpenGLFunctions_1_3::glLineStipple(GLint factor, GLushort pattern)
-{
- d_1_0_Deprecated->f.LineStipple(factor, pattern);
-}
-
-inline void QOpenGLFunctions_1_3::glLightModeliv(GLenum pname, const GLint *params)
-{
- d_1_0_Deprecated->f.LightModeliv(pname, params);
-}
-
-inline void QOpenGLFunctions_1_3::glLightModeli(GLenum pname, GLint param)
-{
- d_1_0_Deprecated->f.LightModeli(pname, param);
-}
-
-inline void QOpenGLFunctions_1_3::glLightModelfv(GLenum pname, const GLfloat *params)
-{
- d_1_0_Deprecated->f.LightModelfv(pname, params);
-}
-
-inline void QOpenGLFunctions_1_3::glLightModelf(GLenum pname, GLfloat param)
-{
- d_1_0_Deprecated->f.LightModelf(pname, param);
-}
-
-inline void QOpenGLFunctions_1_3::glLightiv(GLenum light, GLenum pname, const GLint *params)
-{
- d_1_0_Deprecated->f.Lightiv(light, pname, params);
-}
-
-inline void QOpenGLFunctions_1_3::glLighti(GLenum light, GLenum pname, GLint param)
-{
- d_1_0_Deprecated->f.Lighti(light, pname, param);
-}
-
-inline void QOpenGLFunctions_1_3::glLightfv(GLenum light, GLenum pname, const GLfloat *params)
-{
- d_1_0_Deprecated->f.Lightfv(light, pname, params);
-}
-
-inline void QOpenGLFunctions_1_3::glLightf(GLenum light, GLenum pname, GLfloat param)
-{
- d_1_0_Deprecated->f.Lightf(light, pname, param);
-}
-
-inline void QOpenGLFunctions_1_3::glFogiv(GLenum pname, const GLint *params)
-{
- d_1_0_Deprecated->f.Fogiv(pname, params);
-}
-
-inline void QOpenGLFunctions_1_3::glFogi(GLenum pname, GLint param)
-{
- d_1_0_Deprecated->f.Fogi(pname, param);
-}
-
-inline void QOpenGLFunctions_1_3::glFogfv(GLenum pname, const GLfloat *params)
-{
- d_1_0_Deprecated->f.Fogfv(pname, params);
-}
-
-inline void QOpenGLFunctions_1_3::glFogf(GLenum pname, GLfloat param)
-{
- d_1_0_Deprecated->f.Fogf(pname, param);
-}
-
-inline void QOpenGLFunctions_1_3::glColorMaterial(GLenum face, GLenum mode)
-{
- d_1_0_Deprecated->f.ColorMaterial(face, mode);
-}
-
-inline void QOpenGLFunctions_1_3::glClipPlane(GLenum plane, const GLdouble *equation)
-{
- d_1_0_Deprecated->f.ClipPlane(plane, equation);
-}
-
-inline void QOpenGLFunctions_1_3::glVertex4sv(const GLshort *v)
-{
- d_1_0_Deprecated->f.Vertex4sv(v);
-}
-
-inline void QOpenGLFunctions_1_3::glVertex4s(GLshort x, GLshort y, GLshort z, GLshort w)
-{
- d_1_0_Deprecated->f.Vertex4s(x, y, z, w);
-}
-
-inline void QOpenGLFunctions_1_3::glVertex4iv(const GLint *v)
-{
- d_1_0_Deprecated->f.Vertex4iv(v);
-}
-
-inline void QOpenGLFunctions_1_3::glVertex4i(GLint x, GLint y, GLint z, GLint w)
-{
- d_1_0_Deprecated->f.Vertex4i(x, y, z, w);
-}
-
-inline void QOpenGLFunctions_1_3::glVertex4fv(const GLfloat *v)
-{
- d_1_0_Deprecated->f.Vertex4fv(v);
-}
-
-inline void QOpenGLFunctions_1_3::glVertex4f(GLfloat x, GLfloat y, GLfloat z, GLfloat w)
-{
- d_1_0_Deprecated->f.Vertex4f(x, y, z, w);
-}
-
-inline void QOpenGLFunctions_1_3::glVertex4dv(const GLdouble *v)
-{
- d_1_0_Deprecated->f.Vertex4dv(v);
-}
-
-inline void QOpenGLFunctions_1_3::glVertex4d(GLdouble x, GLdouble y, GLdouble z, GLdouble w)
-{
- d_1_0_Deprecated->f.Vertex4d(x, y, z, w);
-}
-
-inline void QOpenGLFunctions_1_3::glVertex3sv(const GLshort *v)
-{
- d_1_0_Deprecated->f.Vertex3sv(v);
-}
-
-inline void QOpenGLFunctions_1_3::glVertex3s(GLshort x, GLshort y, GLshort z)
-{
- d_1_0_Deprecated->f.Vertex3s(x, y, z);
-}
-
-inline void QOpenGLFunctions_1_3::glVertex3iv(const GLint *v)
-{
- d_1_0_Deprecated->f.Vertex3iv(v);
-}
-
-inline void QOpenGLFunctions_1_3::glVertex3i(GLint x, GLint y, GLint z)
-{
- d_1_0_Deprecated->f.Vertex3i(x, y, z);
-}
-
-inline void QOpenGLFunctions_1_3::glVertex3fv(const GLfloat *v)
-{
- d_1_0_Deprecated->f.Vertex3fv(v);
-}
-
-inline void QOpenGLFunctions_1_3::glVertex3f(GLfloat x, GLfloat y, GLfloat z)
-{
- d_1_0_Deprecated->f.Vertex3f(x, y, z);
-}
-
-inline void QOpenGLFunctions_1_3::glVertex3dv(const GLdouble *v)
-{
- d_1_0_Deprecated->f.Vertex3dv(v);
-}
-
-inline void QOpenGLFunctions_1_3::glVertex3d(GLdouble x, GLdouble y, GLdouble z)
-{
- d_1_0_Deprecated->f.Vertex3d(x, y, z);
-}
-
-inline void QOpenGLFunctions_1_3::glVertex2sv(const GLshort *v)
-{
- d_1_0_Deprecated->f.Vertex2sv(v);
-}
-
-inline void QOpenGLFunctions_1_3::glVertex2s(GLshort x, GLshort y)
-{
- d_1_0_Deprecated->f.Vertex2s(x, y);
-}
-
-inline void QOpenGLFunctions_1_3::glVertex2iv(const GLint *v)
-{
- d_1_0_Deprecated->f.Vertex2iv(v);
-}
-
-inline void QOpenGLFunctions_1_3::glVertex2i(GLint x, GLint y)
-{
- d_1_0_Deprecated->f.Vertex2i(x, y);
-}
-
-inline void QOpenGLFunctions_1_3::glVertex2fv(const GLfloat *v)
-{
- d_1_0_Deprecated->f.Vertex2fv(v);
-}
-
-inline void QOpenGLFunctions_1_3::glVertex2f(GLfloat x, GLfloat y)
-{
- d_1_0_Deprecated->f.Vertex2f(x, y);
-}
-
-inline void QOpenGLFunctions_1_3::glVertex2dv(const GLdouble *v)
-{
- d_1_0_Deprecated->f.Vertex2dv(v);
-}
-
-inline void QOpenGLFunctions_1_3::glVertex2d(GLdouble x, GLdouble y)
-{
- d_1_0_Deprecated->f.Vertex2d(x, y);
-}
-
-inline void QOpenGLFunctions_1_3::glTexCoord4sv(const GLshort *v)
-{
- d_1_0_Deprecated->f.TexCoord4sv(v);
-}
-
-inline void QOpenGLFunctions_1_3::glTexCoord4s(GLshort s, GLshort t, GLshort r, GLshort q)
-{
- d_1_0_Deprecated->f.TexCoord4s(s, t, r, q);
-}
-
-inline void QOpenGLFunctions_1_3::glTexCoord4iv(const GLint *v)
-{
- d_1_0_Deprecated->f.TexCoord4iv(v);
-}
-
-inline void QOpenGLFunctions_1_3::glTexCoord4i(GLint s, GLint t, GLint r, GLint q)
-{
- d_1_0_Deprecated->f.TexCoord4i(s, t, r, q);
-}
-
-inline void QOpenGLFunctions_1_3::glTexCoord4fv(const GLfloat *v)
-{
- d_1_0_Deprecated->f.TexCoord4fv(v);
-}
-
-inline void QOpenGLFunctions_1_3::glTexCoord4f(GLfloat s, GLfloat t, GLfloat r, GLfloat q)
-{
- d_1_0_Deprecated->f.TexCoord4f(s, t, r, q);
-}
-
-inline void QOpenGLFunctions_1_3::glTexCoord4dv(const GLdouble *v)
-{
- d_1_0_Deprecated->f.TexCoord4dv(v);
-}
-
-inline void QOpenGLFunctions_1_3::glTexCoord4d(GLdouble s, GLdouble t, GLdouble r, GLdouble q)
-{
- d_1_0_Deprecated->f.TexCoord4d(s, t, r, q);
-}
-
-inline void QOpenGLFunctions_1_3::glTexCoord3sv(const GLshort *v)
-{
- d_1_0_Deprecated->f.TexCoord3sv(v);
-}
-
-inline void QOpenGLFunctions_1_3::glTexCoord3s(GLshort s, GLshort t, GLshort r)
-{
- d_1_0_Deprecated->f.TexCoord3s(s, t, r);
-}
-
-inline void QOpenGLFunctions_1_3::glTexCoord3iv(const GLint *v)
-{
- d_1_0_Deprecated->f.TexCoord3iv(v);
-}
-
-inline void QOpenGLFunctions_1_3::glTexCoord3i(GLint s, GLint t, GLint r)
-{
- d_1_0_Deprecated->f.TexCoord3i(s, t, r);
-}
-
-inline void QOpenGLFunctions_1_3::glTexCoord3fv(const GLfloat *v)
-{
- d_1_0_Deprecated->f.TexCoord3fv(v);
-}
-
-inline void QOpenGLFunctions_1_3::glTexCoord3f(GLfloat s, GLfloat t, GLfloat r)
-{
- d_1_0_Deprecated->f.TexCoord3f(s, t, r);
-}
-
-inline void QOpenGLFunctions_1_3::glTexCoord3dv(const GLdouble *v)
-{
- d_1_0_Deprecated->f.TexCoord3dv(v);
-}
-
-inline void QOpenGLFunctions_1_3::glTexCoord3d(GLdouble s, GLdouble t, GLdouble r)
-{
- d_1_0_Deprecated->f.TexCoord3d(s, t, r);
-}
-
-inline void QOpenGLFunctions_1_3::glTexCoord2sv(const GLshort *v)
-{
- d_1_0_Deprecated->f.TexCoord2sv(v);
-}
-
-inline void QOpenGLFunctions_1_3::glTexCoord2s(GLshort s, GLshort t)
-{
- d_1_0_Deprecated->f.TexCoord2s(s, t);
-}
-
-inline void QOpenGLFunctions_1_3::glTexCoord2iv(const GLint *v)
-{
- d_1_0_Deprecated->f.TexCoord2iv(v);
-}
-
-inline void QOpenGLFunctions_1_3::glTexCoord2i(GLint s, GLint t)
-{
- d_1_0_Deprecated->f.TexCoord2i(s, t);
-}
-
-inline void QOpenGLFunctions_1_3::glTexCoord2fv(const GLfloat *v)
-{
- d_1_0_Deprecated->f.TexCoord2fv(v);
-}
-
-inline void QOpenGLFunctions_1_3::glTexCoord2f(GLfloat s, GLfloat t)
-{
- d_1_0_Deprecated->f.TexCoord2f(s, t);
-}
-
-inline void QOpenGLFunctions_1_3::glTexCoord2dv(const GLdouble *v)
-{
- d_1_0_Deprecated->f.TexCoord2dv(v);
-}
-
-inline void QOpenGLFunctions_1_3::glTexCoord2d(GLdouble s, GLdouble t)
-{
- d_1_0_Deprecated->f.TexCoord2d(s, t);
-}
-
-inline void QOpenGLFunctions_1_3::glTexCoord1sv(const GLshort *v)
-{
- d_1_0_Deprecated->f.TexCoord1sv(v);
-}
-
-inline void QOpenGLFunctions_1_3::glTexCoord1s(GLshort s)
-{
- d_1_0_Deprecated->f.TexCoord1s(s);
-}
-
-inline void QOpenGLFunctions_1_3::glTexCoord1iv(const GLint *v)
-{
- d_1_0_Deprecated->f.TexCoord1iv(v);
-}
-
-inline void QOpenGLFunctions_1_3::glTexCoord1i(GLint s)
-{
- d_1_0_Deprecated->f.TexCoord1i(s);
-}
-
-inline void QOpenGLFunctions_1_3::glTexCoord1fv(const GLfloat *v)
-{
- d_1_0_Deprecated->f.TexCoord1fv(v);
-}
-
-inline void QOpenGLFunctions_1_3::glTexCoord1f(GLfloat s)
-{
- d_1_0_Deprecated->f.TexCoord1f(s);
-}
-
-inline void QOpenGLFunctions_1_3::glTexCoord1dv(const GLdouble *v)
-{
- d_1_0_Deprecated->f.TexCoord1dv(v);
-}
-
-inline void QOpenGLFunctions_1_3::glTexCoord1d(GLdouble s)
-{
- d_1_0_Deprecated->f.TexCoord1d(s);
-}
-
-inline void QOpenGLFunctions_1_3::glRectsv(const GLshort *v1, const GLshort *v2)
-{
- d_1_0_Deprecated->f.Rectsv(v1, v2);
-}
-
-inline void QOpenGLFunctions_1_3::glRects(GLshort x1, GLshort y1, GLshort x2, GLshort y2)
-{
- d_1_0_Deprecated->f.Rects(x1, y1, x2, y2);
-}
-
-inline void QOpenGLFunctions_1_3::glRectiv(const GLint *v1, const GLint *v2)
-{
- d_1_0_Deprecated->f.Rectiv(v1, v2);
-}
-
-inline void QOpenGLFunctions_1_3::glRecti(GLint x1, GLint y1, GLint x2, GLint y2)
-{
- d_1_0_Deprecated->f.Recti(x1, y1, x2, y2);
-}
-
-inline void QOpenGLFunctions_1_3::glRectfv(const GLfloat *v1, const GLfloat *v2)
-{
- d_1_0_Deprecated->f.Rectfv(v1, v2);
-}
-
-inline void QOpenGLFunctions_1_3::glRectf(GLfloat x1, GLfloat y1, GLfloat x2, GLfloat y2)
-{
- d_1_0_Deprecated->f.Rectf(x1, y1, x2, y2);
-}
-
-inline void QOpenGLFunctions_1_3::glRectdv(const GLdouble *v1, const GLdouble *v2)
-{
- d_1_0_Deprecated->f.Rectdv(v1, v2);
-}
-
-inline void QOpenGLFunctions_1_3::glRectd(GLdouble x1, GLdouble y1, GLdouble x2, GLdouble y2)
-{
- d_1_0_Deprecated->f.Rectd(x1, y1, x2, y2);
-}
-
-inline void QOpenGLFunctions_1_3::glRasterPos4sv(const GLshort *v)
-{
- d_1_0_Deprecated->f.RasterPos4sv(v);
-}
-
-inline void QOpenGLFunctions_1_3::glRasterPos4s(GLshort x, GLshort y, GLshort z, GLshort w)
-{
- d_1_0_Deprecated->f.RasterPos4s(x, y, z, w);
-}
-
-inline void QOpenGLFunctions_1_3::glRasterPos4iv(const GLint *v)
-{
- d_1_0_Deprecated->f.RasterPos4iv(v);
-}
-
-inline void QOpenGLFunctions_1_3::glRasterPos4i(GLint x, GLint y, GLint z, GLint w)
-{
- d_1_0_Deprecated->f.RasterPos4i(x, y, z, w);
-}
-
-inline void QOpenGLFunctions_1_3::glRasterPos4fv(const GLfloat *v)
-{
- d_1_0_Deprecated->f.RasterPos4fv(v);
-}
-
-inline void QOpenGLFunctions_1_3::glRasterPos4f(GLfloat x, GLfloat y, GLfloat z, GLfloat w)
-{
- d_1_0_Deprecated->f.RasterPos4f(x, y, z, w);
-}
-
-inline void QOpenGLFunctions_1_3::glRasterPos4dv(const GLdouble *v)
-{
- d_1_0_Deprecated->f.RasterPos4dv(v);
-}
-
-inline void QOpenGLFunctions_1_3::glRasterPos4d(GLdouble x, GLdouble y, GLdouble z, GLdouble w)
-{
- d_1_0_Deprecated->f.RasterPos4d(x, y, z, w);
-}
-
-inline void QOpenGLFunctions_1_3::glRasterPos3sv(const GLshort *v)
-{
- d_1_0_Deprecated->f.RasterPos3sv(v);
-}
-
-inline void QOpenGLFunctions_1_3::glRasterPos3s(GLshort x, GLshort y, GLshort z)
-{
- d_1_0_Deprecated->f.RasterPos3s(x, y, z);
-}
-
-inline void QOpenGLFunctions_1_3::glRasterPos3iv(const GLint *v)
-{
- d_1_0_Deprecated->f.RasterPos3iv(v);
-}
-
-inline void QOpenGLFunctions_1_3::glRasterPos3i(GLint x, GLint y, GLint z)
-{
- d_1_0_Deprecated->f.RasterPos3i(x, y, z);
-}
-
-inline void QOpenGLFunctions_1_3::glRasterPos3fv(const GLfloat *v)
-{
- d_1_0_Deprecated->f.RasterPos3fv(v);
-}
-
-inline void QOpenGLFunctions_1_3::glRasterPos3f(GLfloat x, GLfloat y, GLfloat z)
-{
- d_1_0_Deprecated->f.RasterPos3f(x, y, z);
-}
-
-inline void QOpenGLFunctions_1_3::glRasterPos3dv(const GLdouble *v)
-{
- d_1_0_Deprecated->f.RasterPos3dv(v);
-}
-
-inline void QOpenGLFunctions_1_3::glRasterPos3d(GLdouble x, GLdouble y, GLdouble z)
-{
- d_1_0_Deprecated->f.RasterPos3d(x, y, z);
-}
-
-inline void QOpenGLFunctions_1_3::glRasterPos2sv(const GLshort *v)
-{
- d_1_0_Deprecated->f.RasterPos2sv(v);
-}
-
-inline void QOpenGLFunctions_1_3::glRasterPos2s(GLshort x, GLshort y)
-{
- d_1_0_Deprecated->f.RasterPos2s(x, y);
-}
-
-inline void QOpenGLFunctions_1_3::glRasterPos2iv(const GLint *v)
-{
- d_1_0_Deprecated->f.RasterPos2iv(v);
-}
-
-inline void QOpenGLFunctions_1_3::glRasterPos2i(GLint x, GLint y)
-{
- d_1_0_Deprecated->f.RasterPos2i(x, y);
-}
-
-inline void QOpenGLFunctions_1_3::glRasterPos2fv(const GLfloat *v)
-{
- d_1_0_Deprecated->f.RasterPos2fv(v);
-}
-
-inline void QOpenGLFunctions_1_3::glRasterPos2f(GLfloat x, GLfloat y)
-{
- d_1_0_Deprecated->f.RasterPos2f(x, y);
-}
-
-inline void QOpenGLFunctions_1_3::glRasterPos2dv(const GLdouble *v)
-{
- d_1_0_Deprecated->f.RasterPos2dv(v);
-}
-
-inline void QOpenGLFunctions_1_3::glRasterPos2d(GLdouble x, GLdouble y)
-{
- d_1_0_Deprecated->f.RasterPos2d(x, y);
-}
-
-inline void QOpenGLFunctions_1_3::glNormal3sv(const GLshort *v)
-{
- d_1_0_Deprecated->f.Normal3sv(v);
-}
-
-inline void QOpenGLFunctions_1_3::glNormal3s(GLshort nx, GLshort ny, GLshort nz)
-{
- d_1_0_Deprecated->f.Normal3s(nx, ny, nz);
-}
-
-inline void QOpenGLFunctions_1_3::glNormal3iv(const GLint *v)
-{
- d_1_0_Deprecated->f.Normal3iv(v);
-}
-
-inline void QOpenGLFunctions_1_3::glNormal3i(GLint nx, GLint ny, GLint nz)
-{
- d_1_0_Deprecated->f.Normal3i(nx, ny, nz);
-}
-
-inline void QOpenGLFunctions_1_3::glNormal3fv(const GLfloat *v)
-{
- d_1_0_Deprecated->f.Normal3fv(v);
-}
-
-inline void QOpenGLFunctions_1_3::glNormal3f(GLfloat nx, GLfloat ny, GLfloat nz)
-{
- d_1_0_Deprecated->f.Normal3f(nx, ny, nz);
-}
-
-inline void QOpenGLFunctions_1_3::glNormal3dv(const GLdouble *v)
-{
- d_1_0_Deprecated->f.Normal3dv(v);
-}
-
-inline void QOpenGLFunctions_1_3::glNormal3d(GLdouble nx, GLdouble ny, GLdouble nz)
-{
- d_1_0_Deprecated->f.Normal3d(nx, ny, nz);
-}
-
-inline void QOpenGLFunctions_1_3::glNormal3bv(const GLbyte *v)
-{
- d_1_0_Deprecated->f.Normal3bv(v);
-}
-
-inline void QOpenGLFunctions_1_3::glNormal3b(GLbyte nx, GLbyte ny, GLbyte nz)
-{
- d_1_0_Deprecated->f.Normal3b(nx, ny, nz);
-}
-
-inline void QOpenGLFunctions_1_3::glIndexsv(const GLshort *c)
-{
- d_1_0_Deprecated->f.Indexsv(c);
-}
-
-inline void QOpenGLFunctions_1_3::glIndexs(GLshort c)
-{
- d_1_0_Deprecated->f.Indexs(c);
-}
-
-inline void QOpenGLFunctions_1_3::glIndexiv(const GLint *c)
-{
- d_1_0_Deprecated->f.Indexiv(c);
-}
-
-inline void QOpenGLFunctions_1_3::glIndexi(GLint c)
-{
- d_1_0_Deprecated->f.Indexi(c);
-}
-
-inline void QOpenGLFunctions_1_3::glIndexfv(const GLfloat *c)
-{
- d_1_0_Deprecated->f.Indexfv(c);
-}
-
-inline void QOpenGLFunctions_1_3::glIndexf(GLfloat c)
-{
- d_1_0_Deprecated->f.Indexf(c);
-}
-
-inline void QOpenGLFunctions_1_3::glIndexdv(const GLdouble *c)
-{
- d_1_0_Deprecated->f.Indexdv(c);
-}
-
-inline void QOpenGLFunctions_1_3::glIndexd(GLdouble c)
-{
- d_1_0_Deprecated->f.Indexd(c);
-}
-
-inline void QOpenGLFunctions_1_3::glEnd()
-{
- d_1_0_Deprecated->f.End();
-}
-
-inline void QOpenGLFunctions_1_3::glEdgeFlagv(const GLboolean *flag)
-{
- d_1_0_Deprecated->f.EdgeFlagv(flag);
-}
-
-inline void QOpenGLFunctions_1_3::glEdgeFlag(GLboolean flag)
-{
- d_1_0_Deprecated->f.EdgeFlag(flag);
-}
-
-inline void QOpenGLFunctions_1_3::glColor4usv(const GLushort *v)
-{
- d_1_0_Deprecated->f.Color4usv(v);
-}
-
-inline void QOpenGLFunctions_1_3::glColor4us(GLushort red, GLushort green, GLushort blue, GLushort alpha)
-{
- d_1_0_Deprecated->f.Color4us(red, green, blue, alpha);
-}
-
-inline void QOpenGLFunctions_1_3::glColor4uiv(const GLuint *v)
-{
- d_1_0_Deprecated->f.Color4uiv(v);
-}
-
-inline void QOpenGLFunctions_1_3::glColor4ui(GLuint red, GLuint green, GLuint blue, GLuint alpha)
-{
- d_1_0_Deprecated->f.Color4ui(red, green, blue, alpha);
-}
-
-inline void QOpenGLFunctions_1_3::glColor4ubv(const GLubyte *v)
-{
- d_1_0_Deprecated->f.Color4ubv(v);
-}
-
-inline void QOpenGLFunctions_1_3::glColor4ub(GLubyte red, GLubyte green, GLubyte blue, GLubyte alpha)
-{
- d_1_0_Deprecated->f.Color4ub(red, green, blue, alpha);
-}
-
-inline void QOpenGLFunctions_1_3::glColor4sv(const GLshort *v)
-{
- d_1_0_Deprecated->f.Color4sv(v);
-}
-
-inline void QOpenGLFunctions_1_3::glColor4s(GLshort red, GLshort green, GLshort blue, GLshort alpha)
-{
- d_1_0_Deprecated->f.Color4s(red, green, blue, alpha);
-}
-
-inline void QOpenGLFunctions_1_3::glColor4iv(const GLint *v)
-{
- d_1_0_Deprecated->f.Color4iv(v);
-}
-
-inline void QOpenGLFunctions_1_3::glColor4i(GLint red, GLint green, GLint blue, GLint alpha)
-{
- d_1_0_Deprecated->f.Color4i(red, green, blue, alpha);
-}
-
-inline void QOpenGLFunctions_1_3::glColor4fv(const GLfloat *v)
-{
- d_1_0_Deprecated->f.Color4fv(v);
-}
-
-inline void QOpenGLFunctions_1_3::glColor4f(GLfloat red, GLfloat green, GLfloat blue, GLfloat alpha)
-{
- d_1_0_Deprecated->f.Color4f(red, green, blue, alpha);
-}
-
-inline void QOpenGLFunctions_1_3::glColor4dv(const GLdouble *v)
-{
- d_1_0_Deprecated->f.Color4dv(v);
-}
-
-inline void QOpenGLFunctions_1_3::glColor4d(GLdouble red, GLdouble green, GLdouble blue, GLdouble alpha)
-{
- d_1_0_Deprecated->f.Color4d(red, green, blue, alpha);
-}
-
-inline void QOpenGLFunctions_1_3::glColor4bv(const GLbyte *v)
-{
- d_1_0_Deprecated->f.Color4bv(v);
-}
-
-inline void QOpenGLFunctions_1_3::glColor4b(GLbyte red, GLbyte green, GLbyte blue, GLbyte alpha)
-{
- d_1_0_Deprecated->f.Color4b(red, green, blue, alpha);
-}
-
-inline void QOpenGLFunctions_1_3::glColor3usv(const GLushort *v)
-{
- d_1_0_Deprecated->f.Color3usv(v);
-}
-
-inline void QOpenGLFunctions_1_3::glColor3us(GLushort red, GLushort green, GLushort blue)
-{
- d_1_0_Deprecated->f.Color3us(red, green, blue);
-}
-
-inline void QOpenGLFunctions_1_3::glColor3uiv(const GLuint *v)
-{
- d_1_0_Deprecated->f.Color3uiv(v);
-}
-
-inline void QOpenGLFunctions_1_3::glColor3ui(GLuint red, GLuint green, GLuint blue)
-{
- d_1_0_Deprecated->f.Color3ui(red, green, blue);
-}
-
-inline void QOpenGLFunctions_1_3::glColor3ubv(const GLubyte *v)
-{
- d_1_0_Deprecated->f.Color3ubv(v);
-}
-
-inline void QOpenGLFunctions_1_3::glColor3ub(GLubyte red, GLubyte green, GLubyte blue)
-{
- d_1_0_Deprecated->f.Color3ub(red, green, blue);
-}
-
-inline void QOpenGLFunctions_1_3::glColor3sv(const GLshort *v)
-{
- d_1_0_Deprecated->f.Color3sv(v);
-}
-
-inline void QOpenGLFunctions_1_3::glColor3s(GLshort red, GLshort green, GLshort blue)
-{
- d_1_0_Deprecated->f.Color3s(red, green, blue);
-}
-
-inline void QOpenGLFunctions_1_3::glColor3iv(const GLint *v)
-{
- d_1_0_Deprecated->f.Color3iv(v);
-}
-
-inline void QOpenGLFunctions_1_3::glColor3i(GLint red, GLint green, GLint blue)
-{
- d_1_0_Deprecated->f.Color3i(red, green, blue);
-}
-
-inline void QOpenGLFunctions_1_3::glColor3fv(const GLfloat *v)
-{
- d_1_0_Deprecated->f.Color3fv(v);
-}
-
-inline void QOpenGLFunctions_1_3::glColor3f(GLfloat red, GLfloat green, GLfloat blue)
-{
- d_1_0_Deprecated->f.Color3f(red, green, blue);
-}
-
-inline void QOpenGLFunctions_1_3::glColor3dv(const GLdouble *v)
-{
- d_1_0_Deprecated->f.Color3dv(v);
-}
-
-inline void QOpenGLFunctions_1_3::glColor3d(GLdouble red, GLdouble green, GLdouble blue)
-{
- d_1_0_Deprecated->f.Color3d(red, green, blue);
-}
-
-inline void QOpenGLFunctions_1_3::glColor3bv(const GLbyte *v)
-{
- d_1_0_Deprecated->f.Color3bv(v);
-}
-
-inline void QOpenGLFunctions_1_3::glColor3b(GLbyte red, GLbyte green, GLbyte blue)
-{
- d_1_0_Deprecated->f.Color3b(red, green, blue);
-}
-
-inline void QOpenGLFunctions_1_3::glBitmap(GLsizei width, GLsizei height, GLfloat xorig, GLfloat yorig, GLfloat xmove, GLfloat ymove, const GLubyte *bitmap)
-{
- d_1_0_Deprecated->f.Bitmap(width, height, xorig, yorig, xmove, ymove, bitmap);
-}
-
-inline void QOpenGLFunctions_1_3::glBegin(GLenum mode)
-{
- d_1_0_Deprecated->f.Begin(mode);
-}
-
-inline void QOpenGLFunctions_1_3::glListBase(GLuint base)
-{
- d_1_0_Deprecated->f.ListBase(base);
-}
-
-inline GLuint QOpenGLFunctions_1_3::glGenLists(GLsizei range)
-{
- return d_1_0_Deprecated->f.GenLists(range);
-}
-
-inline void QOpenGLFunctions_1_3::glDeleteLists(GLuint list, GLsizei range)
-{
- d_1_0_Deprecated->f.DeleteLists(list, range);
-}
-
-inline void QOpenGLFunctions_1_3::glCallLists(GLsizei n, GLenum type, const GLvoid *lists)
-{
- d_1_0_Deprecated->f.CallLists(n, type, lists);
-}
-
-inline void QOpenGLFunctions_1_3::glCallList(GLuint list)
-{
- d_1_0_Deprecated->f.CallList(list);
-}
-
-inline void QOpenGLFunctions_1_3::glEndList()
-{
- d_1_0_Deprecated->f.EndList();
-}
-
-inline void QOpenGLFunctions_1_3::glNewList(GLuint list, GLenum mode)
-{
- d_1_0_Deprecated->f.NewList(list, mode);
-}
-
-
-// OpenGL 1.1 deprecated functions
-inline void QOpenGLFunctions_1_3::glPushClientAttrib(GLbitfield mask)
-{
- d_1_1_Deprecated->f.PushClientAttrib(mask);
-}
-
-inline void QOpenGLFunctions_1_3::glPopClientAttrib()
-{
- d_1_1_Deprecated->f.PopClientAttrib();
-}
-
-inline void QOpenGLFunctions_1_3::glPrioritizeTextures(GLsizei n, const GLuint *textures, const GLfloat *priorities)
-{
- d_1_1_Deprecated->f.PrioritizeTextures(n, textures, priorities);
-}
-
-inline GLboolean QOpenGLFunctions_1_3::glAreTexturesResident(GLsizei n, const GLuint *textures, GLboolean *residences)
-{
- return d_1_1_Deprecated->f.AreTexturesResident(n, textures, residences);
-}
-
-inline void QOpenGLFunctions_1_3::glVertexPointer(GLint size, GLenum type, GLsizei stride, const GLvoid *pointer)
-{
- d_1_1_Deprecated->f.VertexPointer(size, type, stride, pointer);
-}
-
-inline void QOpenGLFunctions_1_3::glTexCoordPointer(GLint size, GLenum type, GLsizei stride, const GLvoid *pointer)
-{
- d_1_1_Deprecated->f.TexCoordPointer(size, type, stride, pointer);
-}
-
-inline void QOpenGLFunctions_1_3::glNormalPointer(GLenum type, GLsizei stride, const GLvoid *pointer)
-{
- d_1_1_Deprecated->f.NormalPointer(type, stride, pointer);
-}
-
-inline void QOpenGLFunctions_1_3::glInterleavedArrays(GLenum format, GLsizei stride, const GLvoid *pointer)
-{
- d_1_1_Deprecated->f.InterleavedArrays(format, stride, pointer);
-}
-
-inline void QOpenGLFunctions_1_3::glIndexPointer(GLenum type, GLsizei stride, const GLvoid *pointer)
-{
- d_1_1_Deprecated->f.IndexPointer(type, stride, pointer);
-}
-
-inline void QOpenGLFunctions_1_3::glEnableClientState(GLenum array)
-{
- d_1_1_Deprecated->f.EnableClientState(array);
-}
-
-inline void QOpenGLFunctions_1_3::glEdgeFlagPointer(GLsizei stride, const GLvoid *pointer)
-{
- d_1_1_Deprecated->f.EdgeFlagPointer(stride, pointer);
-}
-
-inline void QOpenGLFunctions_1_3::glDisableClientState(GLenum array)
-{
- d_1_1_Deprecated->f.DisableClientState(array);
-}
-
-inline void QOpenGLFunctions_1_3::glColorPointer(GLint size, GLenum type, GLsizei stride, const GLvoid *pointer)
-{
- d_1_1_Deprecated->f.ColorPointer(size, type, stride, pointer);
-}
-
-inline void QOpenGLFunctions_1_3::glArrayElement(GLint i)
-{
- d_1_1_Deprecated->f.ArrayElement(i);
-}
-
-
-// OpenGL 1.2 deprecated functions
-inline void QOpenGLFunctions_1_3::glResetMinmax(GLenum target)
-{
- d_1_2_Deprecated->f.ResetMinmax(target);
-}
-
-inline void QOpenGLFunctions_1_3::glResetHistogram(GLenum target)
-{
- d_1_2_Deprecated->f.ResetHistogram(target);
-}
-
-inline void QOpenGLFunctions_1_3::glMinmax(GLenum target, GLenum internalformat, GLboolean sink)
-{
- d_1_2_Deprecated->f.Minmax(target, internalformat, sink);
-}
-
-inline void QOpenGLFunctions_1_3::glHistogram(GLenum target, GLsizei width, GLenum internalformat, GLboolean sink)
-{
- d_1_2_Deprecated->f.Histogram(target, width, internalformat, sink);
-}
-
-inline void QOpenGLFunctions_1_3::glGetMinmaxParameteriv(GLenum target, GLenum pname, GLint *params)
-{
- d_1_2_Deprecated->f.GetMinmaxParameteriv(target, pname, params);
-}
-
-inline void QOpenGLFunctions_1_3::glGetMinmaxParameterfv(GLenum target, GLenum pname, GLfloat *params)
-{
- d_1_2_Deprecated->f.GetMinmaxParameterfv(target, pname, params);
-}
-
-inline void QOpenGLFunctions_1_3::glGetMinmax(GLenum target, GLboolean reset, GLenum format, GLenum type, GLvoid *values)
-{
- d_1_2_Deprecated->f.GetMinmax(target, reset, format, type, values);
-}
-
-inline void QOpenGLFunctions_1_3::glGetHistogramParameteriv(GLenum target, GLenum pname, GLint *params)
-{
- d_1_2_Deprecated->f.GetHistogramParameteriv(target, pname, params);
-}
-
-inline void QOpenGLFunctions_1_3::glGetHistogramParameterfv(GLenum target, GLenum pname, GLfloat *params)
-{
- d_1_2_Deprecated->f.GetHistogramParameterfv(target, pname, params);
-}
-
-inline void QOpenGLFunctions_1_3::glGetHistogram(GLenum target, GLboolean reset, GLenum format, GLenum type, GLvoid *values)
-{
- d_1_2_Deprecated->f.GetHistogram(target, reset, format, type, values);
-}
-
-inline void QOpenGLFunctions_1_3::glSeparableFilter2D(GLenum target, GLenum internalformat, GLsizei width, GLsizei height, GLenum format, GLenum type, const GLvoid *row, const GLvoid *column)
-{
- d_1_2_Deprecated->f.SeparableFilter2D(target, internalformat, width, height, format, type, row, column);
-}
-
-inline void QOpenGLFunctions_1_3::glGetSeparableFilter(GLenum target, GLenum format, GLenum type, GLvoid *row, GLvoid *column, GLvoid *span)
-{
- d_1_2_Deprecated->f.GetSeparableFilter(target, format, type, row, column, span);
-}
-
-inline void QOpenGLFunctions_1_3::glGetConvolutionParameteriv(GLenum target, GLenum pname, GLint *params)
-{
- d_1_2_Deprecated->f.GetConvolutionParameteriv(target, pname, params);
-}
-
-inline void QOpenGLFunctions_1_3::glGetConvolutionParameterfv(GLenum target, GLenum pname, GLfloat *params)
-{
- d_1_2_Deprecated->f.GetConvolutionParameterfv(target, pname, params);
-}
-
-inline void QOpenGLFunctions_1_3::glGetConvolutionFilter(GLenum target, GLenum format, GLenum type, GLvoid *image)
-{
- d_1_2_Deprecated->f.GetConvolutionFilter(target, format, type, image);
-}
-
-inline void QOpenGLFunctions_1_3::glCopyConvolutionFilter2D(GLenum target, GLenum internalformat, GLint x, GLint y, GLsizei width, GLsizei height)
-{
- d_1_2_Deprecated->f.CopyConvolutionFilter2D(target, internalformat, x, y, width, height);
-}
-
-inline void QOpenGLFunctions_1_3::glCopyConvolutionFilter1D(GLenum target, GLenum internalformat, GLint x, GLint y, GLsizei width)
-{
- d_1_2_Deprecated->f.CopyConvolutionFilter1D(target, internalformat, x, y, width);
-}
-
-inline void QOpenGLFunctions_1_3::glConvolutionParameteriv(GLenum target, GLenum pname, const GLint *params)
-{
- d_1_2_Deprecated->f.ConvolutionParameteriv(target, pname, params);
-}
-
-inline void QOpenGLFunctions_1_3::glConvolutionParameteri(GLenum target, GLenum pname, GLint params)
-{
- d_1_2_Deprecated->f.ConvolutionParameteri(target, pname, params);
-}
-
-inline void QOpenGLFunctions_1_3::glConvolutionParameterfv(GLenum target, GLenum pname, const GLfloat *params)
-{
- d_1_2_Deprecated->f.ConvolutionParameterfv(target, pname, params);
-}
-
-inline void QOpenGLFunctions_1_3::glConvolutionParameterf(GLenum target, GLenum pname, GLfloat params)
-{
- d_1_2_Deprecated->f.ConvolutionParameterf(target, pname, params);
-}
-
-inline void QOpenGLFunctions_1_3::glConvolutionFilter2D(GLenum target, GLenum internalformat, GLsizei width, GLsizei height, GLenum format, GLenum type, const GLvoid *image)
-{
- d_1_2_Deprecated->f.ConvolutionFilter2D(target, internalformat, width, height, format, type, image);
-}
-
-inline void QOpenGLFunctions_1_3::glConvolutionFilter1D(GLenum target, GLenum internalformat, GLsizei width, GLenum format, GLenum type, const GLvoid *image)
-{
- d_1_2_Deprecated->f.ConvolutionFilter1D(target, internalformat, width, format, type, image);
-}
-
-inline void QOpenGLFunctions_1_3::glCopyColorSubTable(GLenum target, GLsizei start, GLint x, GLint y, GLsizei width)
-{
- d_1_2_Deprecated->f.CopyColorSubTable(target, start, x, y, width);
-}
-
-inline void QOpenGLFunctions_1_3::glColorSubTable(GLenum target, GLsizei start, GLsizei count, GLenum format, GLenum type, const GLvoid *data)
-{
- d_1_2_Deprecated->f.ColorSubTable(target, start, count, format, type, data);
-}
-
-inline void QOpenGLFunctions_1_3::glGetColorTableParameteriv(GLenum target, GLenum pname, GLint *params)
-{
- d_1_2_Deprecated->f.GetColorTableParameteriv(target, pname, params);
-}
-
-inline void QOpenGLFunctions_1_3::glGetColorTableParameterfv(GLenum target, GLenum pname, GLfloat *params)
-{
- d_1_2_Deprecated->f.GetColorTableParameterfv(target, pname, params);
-}
-
-inline void QOpenGLFunctions_1_3::glGetColorTable(GLenum target, GLenum format, GLenum type, GLvoid *table)
-{
- d_1_2_Deprecated->f.GetColorTable(target, format, type, table);
-}
-
-inline void QOpenGLFunctions_1_3::glCopyColorTable(GLenum target, GLenum internalformat, GLint x, GLint y, GLsizei width)
-{
- d_1_2_Deprecated->f.CopyColorTable(target, internalformat, x, y, width);
-}
-
-inline void QOpenGLFunctions_1_3::glColorTableParameteriv(GLenum target, GLenum pname, const GLint *params)
-{
- d_1_2_Deprecated->f.ColorTableParameteriv(target, pname, params);
-}
-
-inline void QOpenGLFunctions_1_3::glColorTableParameterfv(GLenum target, GLenum pname, const GLfloat *params)
-{
- d_1_2_Deprecated->f.ColorTableParameterfv(target, pname, params);
-}
-
-inline void QOpenGLFunctions_1_3::glColorTable(GLenum target, GLenum internalformat, GLsizei width, GLenum format, GLenum type, const GLvoid *table)
-{
- d_1_2_Deprecated->f.ColorTable(target, internalformat, width, format, type, table);
-}
-
-
-// OpenGL 1.3 deprecated functions
-inline void QOpenGLFunctions_1_3::glMultTransposeMatrixd(const GLdouble *m)
-{
- d_1_3_Deprecated->f.MultTransposeMatrixd(m);
-}
-
-inline void QOpenGLFunctions_1_3::glMultTransposeMatrixf(const GLfloat *m)
-{
- d_1_3_Deprecated->f.MultTransposeMatrixf(m);
-}
-
-inline void QOpenGLFunctions_1_3::glLoadTransposeMatrixd(const GLdouble *m)
-{
- d_1_3_Deprecated->f.LoadTransposeMatrixd(m);
-}
-
-inline void QOpenGLFunctions_1_3::glLoadTransposeMatrixf(const GLfloat *m)
-{
- d_1_3_Deprecated->f.LoadTransposeMatrixf(m);
-}
-
-inline void QOpenGLFunctions_1_3::glMultiTexCoord4sv(GLenum target, const GLshort *v)
-{
- d_1_3_Deprecated->f.MultiTexCoord4sv(target, v);
-}
-
-inline void QOpenGLFunctions_1_3::glMultiTexCoord4s(GLenum target, GLshort s, GLshort t, GLshort r, GLshort q)
-{
- d_1_3_Deprecated->f.MultiTexCoord4s(target, s, t, r, q);
-}
-
-inline void QOpenGLFunctions_1_3::glMultiTexCoord4iv(GLenum target, const GLint *v)
-{
- d_1_3_Deprecated->f.MultiTexCoord4iv(target, v);
-}
-
-inline void QOpenGLFunctions_1_3::glMultiTexCoord4i(GLenum target, GLint s, GLint t, GLint r, GLint q)
-{
- d_1_3_Deprecated->f.MultiTexCoord4i(target, s, t, r, q);
-}
-
-inline void QOpenGLFunctions_1_3::glMultiTexCoord4fv(GLenum target, const GLfloat *v)
-{
- d_1_3_Deprecated->f.MultiTexCoord4fv(target, v);
-}
-
-inline void QOpenGLFunctions_1_3::glMultiTexCoord4f(GLenum target, GLfloat s, GLfloat t, GLfloat r, GLfloat q)
-{
- d_1_3_Deprecated->f.MultiTexCoord4f(target, s, t, r, q);
-}
-
-inline void QOpenGLFunctions_1_3::glMultiTexCoord4dv(GLenum target, const GLdouble *v)
-{
- d_1_3_Deprecated->f.MultiTexCoord4dv(target, v);
-}
-
-inline void QOpenGLFunctions_1_3::glMultiTexCoord4d(GLenum target, GLdouble s, GLdouble t, GLdouble r, GLdouble q)
-{
- d_1_3_Deprecated->f.MultiTexCoord4d(target, s, t, r, q);
-}
-
-inline void QOpenGLFunctions_1_3::glMultiTexCoord3sv(GLenum target, const GLshort *v)
-{
- d_1_3_Deprecated->f.MultiTexCoord3sv(target, v);
-}
-
-inline void QOpenGLFunctions_1_3::glMultiTexCoord3s(GLenum target, GLshort s, GLshort t, GLshort r)
-{
- d_1_3_Deprecated->f.MultiTexCoord3s(target, s, t, r);
-}
-
-inline void QOpenGLFunctions_1_3::glMultiTexCoord3iv(GLenum target, const GLint *v)
-{
- d_1_3_Deprecated->f.MultiTexCoord3iv(target, v);
-}
-
-inline void QOpenGLFunctions_1_3::glMultiTexCoord3i(GLenum target, GLint s, GLint t, GLint r)
-{
- d_1_3_Deprecated->f.MultiTexCoord3i(target, s, t, r);
-}
-
-inline void QOpenGLFunctions_1_3::glMultiTexCoord3fv(GLenum target, const GLfloat *v)
-{
- d_1_3_Deprecated->f.MultiTexCoord3fv(target, v);
-}
-
-inline void QOpenGLFunctions_1_3::glMultiTexCoord3f(GLenum target, GLfloat s, GLfloat t, GLfloat r)
-{
- d_1_3_Deprecated->f.MultiTexCoord3f(target, s, t, r);
-}
-
-inline void QOpenGLFunctions_1_3::glMultiTexCoord3dv(GLenum target, const GLdouble *v)
-{
- d_1_3_Deprecated->f.MultiTexCoord3dv(target, v);
-}
-
-inline void QOpenGLFunctions_1_3::glMultiTexCoord3d(GLenum target, GLdouble s, GLdouble t, GLdouble r)
-{
- d_1_3_Deprecated->f.MultiTexCoord3d(target, s, t, r);
-}
-
-inline void QOpenGLFunctions_1_3::glMultiTexCoord2sv(GLenum target, const GLshort *v)
-{
- d_1_3_Deprecated->f.MultiTexCoord2sv(target, v);
-}
-
-inline void QOpenGLFunctions_1_3::glMultiTexCoord2s(GLenum target, GLshort s, GLshort t)
-{
- d_1_3_Deprecated->f.MultiTexCoord2s(target, s, t);
-}
-
-inline void QOpenGLFunctions_1_3::glMultiTexCoord2iv(GLenum target, const GLint *v)
-{
- d_1_3_Deprecated->f.MultiTexCoord2iv(target, v);
-}
-
-inline void QOpenGLFunctions_1_3::glMultiTexCoord2i(GLenum target, GLint s, GLint t)
-{
- d_1_3_Deprecated->f.MultiTexCoord2i(target, s, t);
-}
-
-inline void QOpenGLFunctions_1_3::glMultiTexCoord2fv(GLenum target, const GLfloat *v)
-{
- d_1_3_Deprecated->f.MultiTexCoord2fv(target, v);
-}
-
-inline void QOpenGLFunctions_1_3::glMultiTexCoord2f(GLenum target, GLfloat s, GLfloat t)
-{
- d_1_3_Deprecated->f.MultiTexCoord2f(target, s, t);
-}
-
-inline void QOpenGLFunctions_1_3::glMultiTexCoord2dv(GLenum target, const GLdouble *v)
-{
- d_1_3_Deprecated->f.MultiTexCoord2dv(target, v);
-}
-
-inline void QOpenGLFunctions_1_3::glMultiTexCoord2d(GLenum target, GLdouble s, GLdouble t)
-{
- d_1_3_Deprecated->f.MultiTexCoord2d(target, s, t);
-}
-
-inline void QOpenGLFunctions_1_3::glMultiTexCoord1sv(GLenum target, const GLshort *v)
-{
- d_1_3_Deprecated->f.MultiTexCoord1sv(target, v);
-}
-
-inline void QOpenGLFunctions_1_3::glMultiTexCoord1s(GLenum target, GLshort s)
-{
- d_1_3_Deprecated->f.MultiTexCoord1s(target, s);
-}
-
-inline void QOpenGLFunctions_1_3::glMultiTexCoord1iv(GLenum target, const GLint *v)
-{
- d_1_3_Deprecated->f.MultiTexCoord1iv(target, v);
-}
-
-inline void QOpenGLFunctions_1_3::glMultiTexCoord1i(GLenum target, GLint s)
-{
- d_1_3_Deprecated->f.MultiTexCoord1i(target, s);
-}
-
-inline void QOpenGLFunctions_1_3::glMultiTexCoord1fv(GLenum target, const GLfloat *v)
-{
- d_1_3_Deprecated->f.MultiTexCoord1fv(target, v);
-}
-
-inline void QOpenGLFunctions_1_3::glMultiTexCoord1f(GLenum target, GLfloat s)
-{
- d_1_3_Deprecated->f.MultiTexCoord1f(target, s);
-}
-
-inline void QOpenGLFunctions_1_3::glMultiTexCoord1dv(GLenum target, const GLdouble *v)
-{
- d_1_3_Deprecated->f.MultiTexCoord1dv(target, v);
-}
-
-inline void QOpenGLFunctions_1_3::glMultiTexCoord1d(GLenum target, GLdouble s)
-{
- d_1_3_Deprecated->f.MultiTexCoord1d(target, s);
-}
-
-inline void QOpenGLFunctions_1_3::glClientActiveTexture(GLenum texture)
-{
- d_1_3_Deprecated->f.ClientActiveTexture(texture);
-}
-
-
-
-QT_END_NAMESPACE
-
-#endif // QT_NO_OPENGL && !QT_OPENGL_ES_2
-
-#endif
diff --git a/src/gui/opengl/qopenglfunctions_1_4.cpp b/src/gui/opengl/qopenglfunctions_1_4.cpp
deleted file mode 100644
index 9419c1aa85..0000000000
--- a/src/gui/opengl/qopenglfunctions_1_4.cpp
+++ /dev/null
@@ -1,208 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2013 Klaralvdalens Datakonsult AB (KDAB)
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the QtGui module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-**
-** This file was generated by glgen version 0.1
-** Command line was: glgen
-**
-** glgen is Copyright (C) 2013 Klaralvdalens Datakonsult AB (KDAB)
-**
-** This is an auto-generated file.
-** Do not edit! All changes made to it will be lost.
-**
-****************************************************************************/
-
-#include "qopenglfunctions_1_4.h"
-#include "qopenglcontext.h"
-
-QT_BEGIN_NAMESPACE
-
-/*!
- \class QOpenGLFunctions_1_4
- \inmodule QtGui
- \since 5.1
- \wrapper
- \brief The QOpenGLFunctions_1_4 class provides all functions for OpenGL 1.4 specification.
-
- This class is a wrapper for functions from OpenGL 1.4 specification.
- See reference pages on \l {http://www.opengl.org/sdk/docs/}{opengl.org}
- for function documentation.
-
- \sa QAbstractOpenGLFunctions
-*/
-
-QOpenGLFunctions_1_4::QOpenGLFunctions_1_4()
- : QAbstractOpenGLFunctions()
- , d_1_0_Core(nullptr)
- , d_1_1_Core(nullptr)
- , d_1_2_Core(nullptr)
- , d_1_3_Core(nullptr)
- , d_1_4_Core(nullptr)
- , d_1_0_Deprecated(nullptr)
- , d_1_1_Deprecated(nullptr)
- , d_1_2_Deprecated(nullptr)
- , d_1_3_Deprecated(nullptr)
- , d_1_4_Deprecated(nullptr)
-{
-}
-
-QOpenGLFunctions_1_4::~QOpenGLFunctions_1_4()
-{
- if (d_1_0_Core) {
- d_1_0_Core->refs.deref();
- Q_ASSERT(d_1_0_Core->refs.loadRelaxed());
- }
- if (d_1_1_Core) {
- d_1_1_Core->refs.deref();
- Q_ASSERT(d_1_1_Core->refs.loadRelaxed());
- }
- if (d_1_2_Core) {
- d_1_2_Core->refs.deref();
- Q_ASSERT(d_1_2_Core->refs.loadRelaxed());
- }
- if (d_1_3_Core) {
- d_1_3_Core->refs.deref();
- Q_ASSERT(d_1_3_Core->refs.loadRelaxed());
- }
- if (d_1_4_Core) {
- d_1_4_Core->refs.deref();
- Q_ASSERT(d_1_4_Core->refs.loadRelaxed());
- }
- if (d_1_0_Deprecated) {
- d_1_0_Deprecated->refs.deref();
- Q_ASSERT(d_1_0_Deprecated->refs.loadRelaxed());
- }
- if (d_1_1_Deprecated) {
- d_1_1_Deprecated->refs.deref();
- Q_ASSERT(d_1_1_Deprecated->refs.loadRelaxed());
- }
- if (d_1_2_Deprecated) {
- d_1_2_Deprecated->refs.deref();
- Q_ASSERT(d_1_2_Deprecated->refs.loadRelaxed());
- }
- if (d_1_3_Deprecated) {
- d_1_3_Deprecated->refs.deref();
- Q_ASSERT(d_1_3_Deprecated->refs.loadRelaxed());
- }
- if (d_1_4_Deprecated) {
- d_1_4_Deprecated->refs.deref();
- Q_ASSERT(d_1_4_Deprecated->refs.loadRelaxed());
- }
-}
-
-bool QOpenGLFunctions_1_4::initializeOpenGLFunctions()
-{
- if ( isInitialized() )
- return true;
-
- QOpenGLContext* context = QOpenGLContext::currentContext();
-
- // If owned by a context object make sure it is current.
- // Also check that current context is capable of resolving all needed functions
- if (((owningContext() && owningContext() == context) || !owningContext())
- && QOpenGLFunctions_1_4::isContextCompatible(context))
- {
- // Associate with private implementation, creating if necessary
- // Function pointers in the backends are resolved at creation time
- QOpenGLVersionFunctionsBackend* d = nullptr;
- d = QAbstractOpenGLFunctionsPrivate::functionsBackend(context, QOpenGLFunctions_1_0_CoreBackend::versionStatus());
- d_1_0_Core = static_cast<QOpenGLFunctions_1_0_CoreBackend*>(d);
- d->refs.ref();
-
- d = QAbstractOpenGLFunctionsPrivate::functionsBackend(context, QOpenGLFunctions_1_1_CoreBackend::versionStatus());
- d_1_1_Core = static_cast<QOpenGLFunctions_1_1_CoreBackend*>(d);
- d->refs.ref();
-
- d = QAbstractOpenGLFunctionsPrivate::functionsBackend(context, QOpenGLFunctions_1_2_CoreBackend::versionStatus());
- d_1_2_Core = static_cast<QOpenGLFunctions_1_2_CoreBackend*>(d);
- d->refs.ref();
-
- d = QAbstractOpenGLFunctionsPrivate::functionsBackend(context, QOpenGLFunctions_1_3_CoreBackend::versionStatus());
- d_1_3_Core = static_cast<QOpenGLFunctions_1_3_CoreBackend*>(d);
- d->refs.ref();
-
- d = QAbstractOpenGLFunctionsPrivate::functionsBackend(context, QOpenGLFunctions_1_4_CoreBackend::versionStatus());
- d_1_4_Core = static_cast<QOpenGLFunctions_1_4_CoreBackend*>(d);
- d->refs.ref();
-
- d = QAbstractOpenGLFunctionsPrivate::functionsBackend(context, QOpenGLFunctions_1_0_DeprecatedBackend::versionStatus());
- d_1_0_Deprecated = static_cast<QOpenGLFunctions_1_0_DeprecatedBackend*>(d);
- d->refs.ref();
-
- d = QAbstractOpenGLFunctionsPrivate::functionsBackend(context, QOpenGLFunctions_1_1_DeprecatedBackend::versionStatus());
- d_1_1_Deprecated = static_cast<QOpenGLFunctions_1_1_DeprecatedBackend*>(d);
- d->refs.ref();
-
- d = QAbstractOpenGLFunctionsPrivate::functionsBackend(context, QOpenGLFunctions_1_2_DeprecatedBackend::versionStatus());
- d_1_2_Deprecated = static_cast<QOpenGLFunctions_1_2_DeprecatedBackend*>(d);
- d->refs.ref();
-
- d = QAbstractOpenGLFunctionsPrivate::functionsBackend(context, QOpenGLFunctions_1_3_DeprecatedBackend::versionStatus());
- d_1_3_Deprecated = static_cast<QOpenGLFunctions_1_3_DeprecatedBackend*>(d);
- d->refs.ref();
-
- d = QAbstractOpenGLFunctionsPrivate::functionsBackend(context, QOpenGLFunctions_1_4_DeprecatedBackend::versionStatus());
- d_1_4_Deprecated = static_cast<QOpenGLFunctions_1_4_DeprecatedBackend*>(d);
- d->refs.ref();
-
- QAbstractOpenGLFunctions::initializeOpenGLFunctions();
- }
- return isInitialized();
-}
-
-bool QOpenGLFunctions_1_4::isContextCompatible(QOpenGLContext *context)
-{
- Q_ASSERT(context);
- QSurfaceFormat f = context->format();
- const QPair<int, int> v = qMakePair(f.majorVersion(), f.minorVersion());
- if (v < qMakePair(1, 4))
- return false;
-
- if (f.profile() == QSurfaceFormat::CoreProfile)
- return false;
-
- return true;
-}
-
-QOpenGLVersionProfile QOpenGLFunctions_1_4::versionProfile()
-{
- QOpenGLVersionProfile v;
- v.setVersion(1, 4);
- return v;
-}
-
-QT_END_NAMESPACE
diff --git a/src/gui/opengl/qopenglfunctions_1_4.h b/src/gui/opengl/qopenglfunctions_1_4.h
deleted file mode 100644
index 1f3f5a9c0a..0000000000
--- a/src/gui/opengl/qopenglfunctions_1_4.h
+++ /dev/null
@@ -1,2923 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2013 Klaralvdalens Datakonsult AB (KDAB)
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the QtGui module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-**
-** This file was generated by glgen version 0.1
-** Command line was: glgen
-**
-** glgen is Copyright (C) 2013 Klaralvdalens Datakonsult AB (KDAB)
-**
-** This is an auto-generated file.
-** Do not edit! All changes made to it will be lost.
-**
-****************************************************************************/
-
-#ifndef QOPENGLVERSIONFUNCTIONS_1_4_H
-#define QOPENGLVERSIONFUNCTIONS_1_4_H
-
-#include <QtGui/qtguiglobal.h>
-
-#if !defined(QT_NO_OPENGL) && !defined(QT_OPENGL_ES_2)
-
-#include <QtGui/QOpenGLVersionFunctions>
-#include <QtGui/qopenglcontext.h>
-
-QT_BEGIN_NAMESPACE
-
-class Q_GUI_EXPORT QOpenGLFunctions_1_4 : public QAbstractOpenGLFunctions
-{
-public:
- QOpenGLFunctions_1_4();
- ~QOpenGLFunctions_1_4();
-
- bool initializeOpenGLFunctions() override;
-
- // OpenGL 1.0 core functions
- void glViewport(GLint x, GLint y, GLsizei width, GLsizei height);
- void glDepthRange(GLdouble nearVal, GLdouble farVal);
- GLboolean glIsEnabled(GLenum cap);
- void glGetTexLevelParameteriv(GLenum target, GLint level, GLenum pname, GLint *params);
- void glGetTexLevelParameterfv(GLenum target, GLint level, GLenum pname, GLfloat *params);
- void glGetTexParameteriv(GLenum target, GLenum pname, GLint *params);
- void glGetTexParameterfv(GLenum target, GLenum pname, GLfloat *params);
- void glGetTexImage(GLenum target, GLint level, GLenum format, GLenum type, GLvoid *pixels);
- const GLubyte * glGetString(GLenum name);
- void glGetIntegerv(GLenum pname, GLint *params);
- void glGetFloatv(GLenum pname, GLfloat *params);
- GLenum glGetError();
- void glGetDoublev(GLenum pname, GLdouble *params);
- void glGetBooleanv(GLenum pname, GLboolean *params);
- void glReadPixels(GLint x, GLint y, GLsizei width, GLsizei height, GLenum format, GLenum type, GLvoid *pixels);
- void glReadBuffer(GLenum mode);
- void glPixelStorei(GLenum pname, GLint param);
- void glPixelStoref(GLenum pname, GLfloat param);
- void glDepthFunc(GLenum func);
- void glStencilOp(GLenum fail, GLenum zfail, GLenum zpass);
- void glStencilFunc(GLenum func, GLint ref, GLuint mask);
- void glLogicOp(GLenum opcode);
- void glBlendFunc(GLenum sfactor, GLenum dfactor);
- void glFlush();
- void glFinish();
- void glEnable(GLenum cap);
- void glDisable(GLenum cap);
- void glDepthMask(GLboolean flag);
- void glColorMask(GLboolean red, GLboolean green, GLboolean blue, GLboolean alpha);
- void glStencilMask(GLuint mask);
- void glClearDepth(GLdouble depth);
- void glClearStencil(GLint s);
- void glClearColor(GLfloat red, GLfloat green, GLfloat blue, GLfloat alpha);
- void glClear(GLbitfield mask);
- void glDrawBuffer(GLenum mode);
- void glTexImage2D(GLenum target, GLint level, GLint internalformat, GLsizei width, GLsizei height, GLint border, GLenum format, GLenum type, const GLvoid *pixels);
- void glTexImage1D(GLenum target, GLint level, GLint internalformat, GLsizei width, GLint border, GLenum format, GLenum type, const GLvoid *pixels);
- void glTexParameteriv(GLenum target, GLenum pname, const GLint *params);
- void glTexParameteri(GLenum target, GLenum pname, GLint param);
- void glTexParameterfv(GLenum target, GLenum pname, const GLfloat *params);
- void glTexParameterf(GLenum target, GLenum pname, GLfloat param);
- void glScissor(GLint x, GLint y, GLsizei width, GLsizei height);
- void glPolygonMode(GLenum face, GLenum mode);
- void glPointSize(GLfloat size);
- void glLineWidth(GLfloat width);
- void glHint(GLenum target, GLenum mode);
- void glFrontFace(GLenum mode);
- void glCullFace(GLenum mode);
-
- // OpenGL 1.1 core functions
- void glIndexubv(const GLubyte *c);
- void glIndexub(GLubyte c);
- GLboolean glIsTexture(GLuint texture);
- void glGenTextures(GLsizei n, GLuint *textures);
- void glDeleteTextures(GLsizei n, const GLuint *textures);
- void glBindTexture(GLenum target, GLuint texture);
- void glTexSubImage2D(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLenum type, const GLvoid *pixels);
- void glTexSubImage1D(GLenum target, GLint level, GLint xoffset, GLsizei width, GLenum format, GLenum type, const GLvoid *pixels);
- void glCopyTexSubImage2D(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint x, GLint y, GLsizei width, GLsizei height);
- void glCopyTexSubImage1D(GLenum target, GLint level, GLint xoffset, GLint x, GLint y, GLsizei width);
- void glCopyTexImage2D(GLenum target, GLint level, GLenum internalformat, GLint x, GLint y, GLsizei width, GLsizei height, GLint border);
- void glCopyTexImage1D(GLenum target, GLint level, GLenum internalformat, GLint x, GLint y, GLsizei width, GLint border);
- void glPolygonOffset(GLfloat factor, GLfloat units);
- void glGetPointerv(GLenum pname, GLvoid* *params);
- void glDrawElements(GLenum mode, GLsizei count, GLenum type, const GLvoid *indices);
- void glDrawArrays(GLenum mode, GLint first, GLsizei count);
-
- // OpenGL 1.2 core functions
- void glCopyTexSubImage3D(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLint x, GLint y, GLsizei width, GLsizei height);
- void glTexSubImage3D(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLenum type, const GLvoid *pixels);
- void glTexImage3D(GLenum target, GLint level, GLint internalformat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLenum format, GLenum type, const GLvoid *pixels);
- void glDrawRangeElements(GLenum mode, GLuint start, GLuint end, GLsizei count, GLenum type, const GLvoid *indices);
- void glBlendEquation(GLenum mode);
- void glBlendColor(GLfloat red, GLfloat green, GLfloat blue, GLfloat alpha);
-
- // OpenGL 1.3 core functions
- void glGetCompressedTexImage(GLenum target, GLint level, GLvoid *img);
- void glCompressedTexSubImage1D(GLenum target, GLint level, GLint xoffset, GLsizei width, GLenum format, GLsizei imageSize, const GLvoid *data);
- void glCompressedTexSubImage2D(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLsizei imageSize, const GLvoid *data);
- void glCompressedTexSubImage3D(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLsizei imageSize, const GLvoid *data);
- void glCompressedTexImage1D(GLenum target, GLint level, GLenum internalformat, GLsizei width, GLint border, GLsizei imageSize, const GLvoid *data);
- void glCompressedTexImage2D(GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLint border, GLsizei imageSize, const GLvoid *data);
- void glCompressedTexImage3D(GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLsizei imageSize, const GLvoid *data);
- void glSampleCoverage(GLfloat value, GLboolean invert);
- void glActiveTexture(GLenum texture);
-
- // OpenGL 1.4 core functions
- void glPointParameteriv(GLenum pname, const GLint *params);
- void glPointParameteri(GLenum pname, GLint param);
- void glPointParameterfv(GLenum pname, const GLfloat *params);
- void glPointParameterf(GLenum pname, GLfloat param);
- void glMultiDrawElements(GLenum mode, const GLsizei *count, GLenum type, const GLvoid* const *indices, GLsizei drawcount);
- void glMultiDrawArrays(GLenum mode, const GLint *first, const GLsizei *count, GLsizei drawcount);
- void glBlendFuncSeparate(GLenum sfactorRGB, GLenum dfactorRGB, GLenum sfactorAlpha, GLenum dfactorAlpha);
-
- // OpenGL 1.0 deprecated functions
- void glTranslatef(GLfloat x, GLfloat y, GLfloat z);
- void glTranslated(GLdouble x, GLdouble y, GLdouble z);
- void glScalef(GLfloat x, GLfloat y, GLfloat z);
- void glScaled(GLdouble x, GLdouble y, GLdouble z);
- void glRotatef(GLfloat angle, GLfloat x, GLfloat y, GLfloat z);
- void glRotated(GLdouble angle, GLdouble x, GLdouble y, GLdouble z);
- void glPushMatrix();
- void glPopMatrix();
- void glOrtho(GLdouble left, GLdouble right, GLdouble bottom, GLdouble top, GLdouble zNear, GLdouble zFar);
- void glMultMatrixd(const GLdouble *m);
- void glMultMatrixf(const GLfloat *m);
- void glMatrixMode(GLenum mode);
- void glLoadMatrixd(const GLdouble *m);
- void glLoadMatrixf(const GLfloat *m);
- void glLoadIdentity();
- void glFrustum(GLdouble left, GLdouble right, GLdouble bottom, GLdouble top, GLdouble zNear, GLdouble zFar);
- GLboolean glIsList(GLuint list);
- void glGetTexGeniv(GLenum coord, GLenum pname, GLint *params);
- void glGetTexGenfv(GLenum coord, GLenum pname, GLfloat *params);
- void glGetTexGendv(GLenum coord, GLenum pname, GLdouble *params);
- void glGetTexEnviv(GLenum target, GLenum pname, GLint *params);
- void glGetTexEnvfv(GLenum target, GLenum pname, GLfloat *params);
- void glGetPolygonStipple(GLubyte *mask);
- void glGetPixelMapusv(GLenum map, GLushort *values);
- void glGetPixelMapuiv(GLenum map, GLuint *values);
- void glGetPixelMapfv(GLenum map, GLfloat *values);
- void glGetMaterialiv(GLenum face, GLenum pname, GLint *params);
- void glGetMaterialfv(GLenum face, GLenum pname, GLfloat *params);
- void glGetMapiv(GLenum target, GLenum query, GLint *v);
- void glGetMapfv(GLenum target, GLenum query, GLfloat *v);
- void glGetMapdv(GLenum target, GLenum query, GLdouble *v);
- void glGetLightiv(GLenum light, GLenum pname, GLint *params);
- void glGetLightfv(GLenum light, GLenum pname, GLfloat *params);
- void glGetClipPlane(GLenum plane, GLdouble *equation);
- void glDrawPixels(GLsizei width, GLsizei height, GLenum format, GLenum type, const GLvoid *pixels);
- void glCopyPixels(GLint x, GLint y, GLsizei width, GLsizei height, GLenum type);
- void glPixelMapusv(GLenum map, GLint mapsize, const GLushort *values);
- void glPixelMapuiv(GLenum map, GLint mapsize, const GLuint *values);
- void glPixelMapfv(GLenum map, GLint mapsize, const GLfloat *values);
- void glPixelTransferi(GLenum pname, GLint param);
- void glPixelTransferf(GLenum pname, GLfloat param);
- void glPixelZoom(GLfloat xfactor, GLfloat yfactor);
- void glAlphaFunc(GLenum func, GLfloat ref);
- void glEvalPoint2(GLint i, GLint j);
- void glEvalMesh2(GLenum mode, GLint i1, GLint i2, GLint j1, GLint j2);
- void glEvalPoint1(GLint i);
- void glEvalMesh1(GLenum mode, GLint i1, GLint i2);
- void glEvalCoord2fv(const GLfloat *u);
- void glEvalCoord2f(GLfloat u, GLfloat v);
- void glEvalCoord2dv(const GLdouble *u);
- void glEvalCoord2d(GLdouble u, GLdouble v);
- void glEvalCoord1fv(const GLfloat *u);
- void glEvalCoord1f(GLfloat u);
- void glEvalCoord1dv(const GLdouble *u);
- void glEvalCoord1d(GLdouble u);
- void glMapGrid2f(GLint un, GLfloat u1, GLfloat u2, GLint vn, GLfloat v1, GLfloat v2);
- void glMapGrid2d(GLint un, GLdouble u1, GLdouble u2, GLint vn, GLdouble v1, GLdouble v2);
- void glMapGrid1f(GLint un, GLfloat u1, GLfloat u2);
- void glMapGrid1d(GLint un, GLdouble u1, GLdouble u2);
- void glMap2f(GLenum target, GLfloat u1, GLfloat u2, GLint ustride, GLint uorder, GLfloat v1, GLfloat v2, GLint vstride, GLint vorder, const GLfloat *points);
- void glMap2d(GLenum target, GLdouble u1, GLdouble u2, GLint ustride, GLint uorder, GLdouble v1, GLdouble v2, GLint vstride, GLint vorder, const GLdouble *points);
- void glMap1f(GLenum target, GLfloat u1, GLfloat u2, GLint stride, GLint order, const GLfloat *points);
- void glMap1d(GLenum target, GLdouble u1, GLdouble u2, GLint stride, GLint order, const GLdouble *points);
- void glPushAttrib(GLbitfield mask);
- void glPopAttrib();
- void glAccum(GLenum op, GLfloat value);
- void glIndexMask(GLuint mask);
- void glClearIndex(GLfloat c);
- void glClearAccum(GLfloat red, GLfloat green, GLfloat blue, GLfloat alpha);
- void glPushName(GLuint name);
- void glPopName();
- void glPassThrough(GLfloat token);
- void glLoadName(GLuint name);
- void glInitNames();
- GLint glRenderMode(GLenum mode);
- void glSelectBuffer(GLsizei size, GLuint *buffer);
- void glFeedbackBuffer(GLsizei size, GLenum type, GLfloat *buffer);
- void glTexGeniv(GLenum coord, GLenum pname, const GLint *params);
- void glTexGeni(GLenum coord, GLenum pname, GLint param);
- void glTexGenfv(GLenum coord, GLenum pname, const GLfloat *params);
- void glTexGenf(GLenum coord, GLenum pname, GLfloat param);
- void glTexGendv(GLenum coord, GLenum pname, const GLdouble *params);
- void glTexGend(GLenum coord, GLenum pname, GLdouble param);
- void glTexEnviv(GLenum target, GLenum pname, const GLint *params);
- void glTexEnvi(GLenum target, GLenum pname, GLint param);
- void glTexEnvfv(GLenum target, GLenum pname, const GLfloat *params);
- void glTexEnvf(GLenum target, GLenum pname, GLfloat param);
- void glShadeModel(GLenum mode);
- void glPolygonStipple(const GLubyte *mask);
- void glMaterialiv(GLenum face, GLenum pname, const GLint *params);
- void glMateriali(GLenum face, GLenum pname, GLint param);
- void glMaterialfv(GLenum face, GLenum pname, const GLfloat *params);
- void glMaterialf(GLenum face, GLenum pname, GLfloat param);
- void glLineStipple(GLint factor, GLushort pattern);
- void glLightModeliv(GLenum pname, const GLint *params);
- void glLightModeli(GLenum pname, GLint param);
- void glLightModelfv(GLenum pname, const GLfloat *params);
- void glLightModelf(GLenum pname, GLfloat param);
- void glLightiv(GLenum light, GLenum pname, const GLint *params);
- void glLighti(GLenum light, GLenum pname, GLint param);
- void glLightfv(GLenum light, GLenum pname, const GLfloat *params);
- void glLightf(GLenum light, GLenum pname, GLfloat param);
- void glFogiv(GLenum pname, const GLint *params);
- void glFogi(GLenum pname, GLint param);
- void glFogfv(GLenum pname, const GLfloat *params);
- void glFogf(GLenum pname, GLfloat param);
- void glColorMaterial(GLenum face, GLenum mode);
- void glClipPlane(GLenum plane, const GLdouble *equation);
- void glVertex4sv(const GLshort *v);
- void glVertex4s(GLshort x, GLshort y, GLshort z, GLshort w);
- void glVertex4iv(const GLint *v);
- void glVertex4i(GLint x, GLint y, GLint z, GLint w);
- void glVertex4fv(const GLfloat *v);
- void glVertex4f(GLfloat x, GLfloat y, GLfloat z, GLfloat w);
- void glVertex4dv(const GLdouble *v);
- void glVertex4d(GLdouble x, GLdouble y, GLdouble z, GLdouble w);
- void glVertex3sv(const GLshort *v);
- void glVertex3s(GLshort x, GLshort y, GLshort z);
- void glVertex3iv(const GLint *v);
- void glVertex3i(GLint x, GLint y, GLint z);
- void glVertex3fv(const GLfloat *v);
- void glVertex3f(GLfloat x, GLfloat y, GLfloat z);
- void glVertex3dv(const GLdouble *v);
- void glVertex3d(GLdouble x, GLdouble y, GLdouble z);
- void glVertex2sv(const GLshort *v);
- void glVertex2s(GLshort x, GLshort y);
- void glVertex2iv(const GLint *v);
- void glVertex2i(GLint x, GLint y);
- void glVertex2fv(const GLfloat *v);
- void glVertex2f(GLfloat x, GLfloat y);
- void glVertex2dv(const GLdouble *v);
- void glVertex2d(GLdouble x, GLdouble y);
- void glTexCoord4sv(const GLshort *v);
- void glTexCoord4s(GLshort s, GLshort t, GLshort r, GLshort q);
- void glTexCoord4iv(const GLint *v);
- void glTexCoord4i(GLint s, GLint t, GLint r, GLint q);
- void glTexCoord4fv(const GLfloat *v);
- void glTexCoord4f(GLfloat s, GLfloat t, GLfloat r, GLfloat q);
- void glTexCoord4dv(const GLdouble *v);
- void glTexCoord4d(GLdouble s, GLdouble t, GLdouble r, GLdouble q);
- void glTexCoord3sv(const GLshort *v);
- void glTexCoord3s(GLshort s, GLshort t, GLshort r);
- void glTexCoord3iv(const GLint *v);
- void glTexCoord3i(GLint s, GLint t, GLint r);
- void glTexCoord3fv(const GLfloat *v);
- void glTexCoord3f(GLfloat s, GLfloat t, GLfloat r);
- void glTexCoord3dv(const GLdouble *v);
- void glTexCoord3d(GLdouble s, GLdouble t, GLdouble r);
- void glTexCoord2sv(const GLshort *v);
- void glTexCoord2s(GLshort s, GLshort t);
- void glTexCoord2iv(const GLint *v);
- void glTexCoord2i(GLint s, GLint t);
- void glTexCoord2fv(const GLfloat *v);
- void glTexCoord2f(GLfloat s, GLfloat t);
- void glTexCoord2dv(const GLdouble *v);
- void glTexCoord2d(GLdouble s, GLdouble t);
- void glTexCoord1sv(const GLshort *v);
- void glTexCoord1s(GLshort s);
- void glTexCoord1iv(const GLint *v);
- void glTexCoord1i(GLint s);
- void glTexCoord1fv(const GLfloat *v);
- void glTexCoord1f(GLfloat s);
- void glTexCoord1dv(const GLdouble *v);
- void glTexCoord1d(GLdouble s);
- void glRectsv(const GLshort *v1, const GLshort *v2);
- void glRects(GLshort x1, GLshort y1, GLshort x2, GLshort y2);
- void glRectiv(const GLint *v1, const GLint *v2);
- void glRecti(GLint x1, GLint y1, GLint x2, GLint y2);
- void glRectfv(const GLfloat *v1, const GLfloat *v2);
- void glRectf(GLfloat x1, GLfloat y1, GLfloat x2, GLfloat y2);
- void glRectdv(const GLdouble *v1, const GLdouble *v2);
- void glRectd(GLdouble x1, GLdouble y1, GLdouble x2, GLdouble y2);
- void glRasterPos4sv(const GLshort *v);
- void glRasterPos4s(GLshort x, GLshort y, GLshort z, GLshort w);
- void glRasterPos4iv(const GLint *v);
- void glRasterPos4i(GLint x, GLint y, GLint z, GLint w);
- void glRasterPos4fv(const GLfloat *v);
- void glRasterPos4f(GLfloat x, GLfloat y, GLfloat z, GLfloat w);
- void glRasterPos4dv(const GLdouble *v);
- void glRasterPos4d(GLdouble x, GLdouble y, GLdouble z, GLdouble w);
- void glRasterPos3sv(const GLshort *v);
- void glRasterPos3s(GLshort x, GLshort y, GLshort z);
- void glRasterPos3iv(const GLint *v);
- void glRasterPos3i(GLint x, GLint y, GLint z);
- void glRasterPos3fv(const GLfloat *v);
- void glRasterPos3f(GLfloat x, GLfloat y, GLfloat z);
- void glRasterPos3dv(const GLdouble *v);
- void glRasterPos3d(GLdouble x, GLdouble y, GLdouble z);
- void glRasterPos2sv(const GLshort *v);
- void glRasterPos2s(GLshort x, GLshort y);
- void glRasterPos2iv(const GLint *v);
- void glRasterPos2i(GLint x, GLint y);
- void glRasterPos2fv(const GLfloat *v);
- void glRasterPos2f(GLfloat x, GLfloat y);
- void glRasterPos2dv(const GLdouble *v);
- void glRasterPos2d(GLdouble x, GLdouble y);
- void glNormal3sv(const GLshort *v);
- void glNormal3s(GLshort nx, GLshort ny, GLshort nz);
- void glNormal3iv(const GLint *v);
- void glNormal3i(GLint nx, GLint ny, GLint nz);
- void glNormal3fv(const GLfloat *v);
- void glNormal3f(GLfloat nx, GLfloat ny, GLfloat nz);
- void glNormal3dv(const GLdouble *v);
- void glNormal3d(GLdouble nx, GLdouble ny, GLdouble nz);
- void glNormal3bv(const GLbyte *v);
- void glNormal3b(GLbyte nx, GLbyte ny, GLbyte nz);
- void glIndexsv(const GLshort *c);
- void glIndexs(GLshort c);
- void glIndexiv(const GLint *c);
- void glIndexi(GLint c);
- void glIndexfv(const GLfloat *c);
- void glIndexf(GLfloat c);
- void glIndexdv(const GLdouble *c);
- void glIndexd(GLdouble c);
- void glEnd();
- void glEdgeFlagv(const GLboolean *flag);
- void glEdgeFlag(GLboolean flag);
- void glColor4usv(const GLushort *v);
- void glColor4us(GLushort red, GLushort green, GLushort blue, GLushort alpha);
- void glColor4uiv(const GLuint *v);
- void glColor4ui(GLuint red, GLuint green, GLuint blue, GLuint alpha);
- void glColor4ubv(const GLubyte *v);
- void glColor4ub(GLubyte red, GLubyte green, GLubyte blue, GLubyte alpha);
- void glColor4sv(const GLshort *v);
- void glColor4s(GLshort red, GLshort green, GLshort blue, GLshort alpha);
- void glColor4iv(const GLint *v);
- void glColor4i(GLint red, GLint green, GLint blue, GLint alpha);
- void glColor4fv(const GLfloat *v);
- void glColor4f(GLfloat red, GLfloat green, GLfloat blue, GLfloat alpha);
- void glColor4dv(const GLdouble *v);
- void glColor4d(GLdouble red, GLdouble green, GLdouble blue, GLdouble alpha);
- void glColor4bv(const GLbyte *v);
- void glColor4b(GLbyte red, GLbyte green, GLbyte blue, GLbyte alpha);
- void glColor3usv(const GLushort *v);
- void glColor3us(GLushort red, GLushort green, GLushort blue);
- void glColor3uiv(const GLuint *v);
- void glColor3ui(GLuint red, GLuint green, GLuint blue);
- void glColor3ubv(const GLubyte *v);
- void glColor3ub(GLubyte red, GLubyte green, GLubyte blue);
- void glColor3sv(const GLshort *v);
- void glColor3s(GLshort red, GLshort green, GLshort blue);
- void glColor3iv(const GLint *v);
- void glColor3i(GLint red, GLint green, GLint blue);
- void glColor3fv(const GLfloat *v);
- void glColor3f(GLfloat red, GLfloat green, GLfloat blue);
- void glColor3dv(const GLdouble *v);
- void glColor3d(GLdouble red, GLdouble green, GLdouble blue);
- void glColor3bv(const GLbyte *v);
- void glColor3b(GLbyte red, GLbyte green, GLbyte blue);
- void glBitmap(GLsizei width, GLsizei height, GLfloat xorig, GLfloat yorig, GLfloat xmove, GLfloat ymove, const GLubyte *bitmap);
- void glBegin(GLenum mode);
- void glListBase(GLuint base);
- GLuint glGenLists(GLsizei range);
- void glDeleteLists(GLuint list, GLsizei range);
- void glCallLists(GLsizei n, GLenum type, const GLvoid *lists);
- void glCallList(GLuint list);
- void glEndList();
- void glNewList(GLuint list, GLenum mode);
-
- // OpenGL 1.1 deprecated functions
- void glPushClientAttrib(GLbitfield mask);
- void glPopClientAttrib();
- void glPrioritizeTextures(GLsizei n, const GLuint *textures, const GLfloat *priorities);
- GLboolean glAreTexturesResident(GLsizei n, const GLuint *textures, GLboolean *residences);
- void glVertexPointer(GLint size, GLenum type, GLsizei stride, const GLvoid *pointer);
- void glTexCoordPointer(GLint size, GLenum type, GLsizei stride, const GLvoid *pointer);
- void glNormalPointer(GLenum type, GLsizei stride, const GLvoid *pointer);
- void glInterleavedArrays(GLenum format, GLsizei stride, const GLvoid *pointer);
- void glIndexPointer(GLenum type, GLsizei stride, const GLvoid *pointer);
- void glEnableClientState(GLenum array);
- void glEdgeFlagPointer(GLsizei stride, const GLvoid *pointer);
- void glDisableClientState(GLenum array);
- void glColorPointer(GLint size, GLenum type, GLsizei stride, const GLvoid *pointer);
- void glArrayElement(GLint i);
-
- // OpenGL 1.2 deprecated functions
- void glResetMinmax(GLenum target);
- void glResetHistogram(GLenum target);
- void glMinmax(GLenum target, GLenum internalformat, GLboolean sink);
- void glHistogram(GLenum target, GLsizei width, GLenum internalformat, GLboolean sink);
- void glGetMinmaxParameteriv(GLenum target, GLenum pname, GLint *params);
- void glGetMinmaxParameterfv(GLenum target, GLenum pname, GLfloat *params);
- void glGetMinmax(GLenum target, GLboolean reset, GLenum format, GLenum type, GLvoid *values);
- void glGetHistogramParameteriv(GLenum target, GLenum pname, GLint *params);
- void glGetHistogramParameterfv(GLenum target, GLenum pname, GLfloat *params);
- void glGetHistogram(GLenum target, GLboolean reset, GLenum format, GLenum type, GLvoid *values);
- void glSeparableFilter2D(GLenum target, GLenum internalformat, GLsizei width, GLsizei height, GLenum format, GLenum type, const GLvoid *row, const GLvoid *column);
- void glGetSeparableFilter(GLenum target, GLenum format, GLenum type, GLvoid *row, GLvoid *column, GLvoid *span);
- void glGetConvolutionParameteriv(GLenum target, GLenum pname, GLint *params);
- void glGetConvolutionParameterfv(GLenum target, GLenum pname, GLfloat *params);
- void glGetConvolutionFilter(GLenum target, GLenum format, GLenum type, GLvoid *image);
- void glCopyConvolutionFilter2D(GLenum target, GLenum internalformat, GLint x, GLint y, GLsizei width, GLsizei height);
- void glCopyConvolutionFilter1D(GLenum target, GLenum internalformat, GLint x, GLint y, GLsizei width);
- void glConvolutionParameteriv(GLenum target, GLenum pname, const GLint *params);
- void glConvolutionParameteri(GLenum target, GLenum pname, GLint params);
- void glConvolutionParameterfv(GLenum target, GLenum pname, const GLfloat *params);
- void glConvolutionParameterf(GLenum target, GLenum pname, GLfloat params);
- void glConvolutionFilter2D(GLenum target, GLenum internalformat, GLsizei width, GLsizei height, GLenum format, GLenum type, const GLvoid *image);
- void glConvolutionFilter1D(GLenum target, GLenum internalformat, GLsizei width, GLenum format, GLenum type, const GLvoid *image);
- void glCopyColorSubTable(GLenum target, GLsizei start, GLint x, GLint y, GLsizei width);
- void glColorSubTable(GLenum target, GLsizei start, GLsizei count, GLenum format, GLenum type, const GLvoid *data);
- void glGetColorTableParameteriv(GLenum target, GLenum pname, GLint *params);
- void glGetColorTableParameterfv(GLenum target, GLenum pname, GLfloat *params);
- void glGetColorTable(GLenum target, GLenum format, GLenum type, GLvoid *table);
- void glCopyColorTable(GLenum target, GLenum internalformat, GLint x, GLint y, GLsizei width);
- void glColorTableParameteriv(GLenum target, GLenum pname, const GLint *params);
- void glColorTableParameterfv(GLenum target, GLenum pname, const GLfloat *params);
- void glColorTable(GLenum target, GLenum internalformat, GLsizei width, GLenum format, GLenum type, const GLvoid *table);
-
- // OpenGL 1.3 deprecated functions
- void glMultTransposeMatrixd(const GLdouble *m);
- void glMultTransposeMatrixf(const GLfloat *m);
- void glLoadTransposeMatrixd(const GLdouble *m);
- void glLoadTransposeMatrixf(const GLfloat *m);
- void glMultiTexCoord4sv(GLenum target, const GLshort *v);
- void glMultiTexCoord4s(GLenum target, GLshort s, GLshort t, GLshort r, GLshort q);
- void glMultiTexCoord4iv(GLenum target, const GLint *v);
- void glMultiTexCoord4i(GLenum target, GLint s, GLint t, GLint r, GLint q);
- void glMultiTexCoord4fv(GLenum target, const GLfloat *v);
- void glMultiTexCoord4f(GLenum target, GLfloat s, GLfloat t, GLfloat r, GLfloat q);
- void glMultiTexCoord4dv(GLenum target, const GLdouble *v);
- void glMultiTexCoord4d(GLenum target, GLdouble s, GLdouble t, GLdouble r, GLdouble q);
- void glMultiTexCoord3sv(GLenum target, const GLshort *v);
- void glMultiTexCoord3s(GLenum target, GLshort s, GLshort t, GLshort r);
- void glMultiTexCoord3iv(GLenum target, const GLint *v);
- void glMultiTexCoord3i(GLenum target, GLint s, GLint t, GLint r);
- void glMultiTexCoord3fv(GLenum target, const GLfloat *v);
- void glMultiTexCoord3f(GLenum target, GLfloat s, GLfloat t, GLfloat r);
- void glMultiTexCoord3dv(GLenum target, const GLdouble *v);
- void glMultiTexCoord3d(GLenum target, GLdouble s, GLdouble t, GLdouble r);
- void glMultiTexCoord2sv(GLenum target, const GLshort *v);
- void glMultiTexCoord2s(GLenum target, GLshort s, GLshort t);
- void glMultiTexCoord2iv(GLenum target, const GLint *v);
- void glMultiTexCoord2i(GLenum target, GLint s, GLint t);
- void glMultiTexCoord2fv(GLenum target, const GLfloat *v);
- void glMultiTexCoord2f(GLenum target, GLfloat s, GLfloat t);
- void glMultiTexCoord2dv(GLenum target, const GLdouble *v);
- void glMultiTexCoord2d(GLenum target, GLdouble s, GLdouble t);
- void glMultiTexCoord1sv(GLenum target, const GLshort *v);
- void glMultiTexCoord1s(GLenum target, GLshort s);
- void glMultiTexCoord1iv(GLenum target, const GLint *v);
- void glMultiTexCoord1i(GLenum target, GLint s);
- void glMultiTexCoord1fv(GLenum target, const GLfloat *v);
- void glMultiTexCoord1f(GLenum target, GLfloat s);
- void glMultiTexCoord1dv(GLenum target, const GLdouble *v);
- void glMultiTexCoord1d(GLenum target, GLdouble s);
- void glClientActiveTexture(GLenum texture);
-
- // OpenGL 1.4 deprecated functions
- void glWindowPos3sv(const GLshort *v);
- void glWindowPos3s(GLshort x, GLshort y, GLshort z);
- void glWindowPos3iv(const GLint *v);
- void glWindowPos3i(GLint x, GLint y, GLint z);
- void glWindowPos3fv(const GLfloat *v);
- void glWindowPos3f(GLfloat x, GLfloat y, GLfloat z);
- void glWindowPos3dv(const GLdouble *v);
- void glWindowPos3d(GLdouble x, GLdouble y, GLdouble z);
- void glWindowPos2sv(const GLshort *v);
- void glWindowPos2s(GLshort x, GLshort y);
- void glWindowPos2iv(const GLint *v);
- void glWindowPos2i(GLint x, GLint y);
- void glWindowPos2fv(const GLfloat *v);
- void glWindowPos2f(GLfloat x, GLfloat y);
- void glWindowPos2dv(const GLdouble *v);
- void glWindowPos2d(GLdouble x, GLdouble y);
- void glSecondaryColorPointer(GLint size, GLenum type, GLsizei stride, const GLvoid *pointer);
- void glSecondaryColor3usv(const GLushort *v);
- void glSecondaryColor3us(GLushort red, GLushort green, GLushort blue);
- void glSecondaryColor3uiv(const GLuint *v);
- void glSecondaryColor3ui(GLuint red, GLuint green, GLuint blue);
- void glSecondaryColor3ubv(const GLubyte *v);
- void glSecondaryColor3ub(GLubyte red, GLubyte green, GLubyte blue);
- void glSecondaryColor3sv(const GLshort *v);
- void glSecondaryColor3s(GLshort red, GLshort green, GLshort blue);
- void glSecondaryColor3iv(const GLint *v);
- void glSecondaryColor3i(GLint red, GLint green, GLint blue);
- void glSecondaryColor3fv(const GLfloat *v);
- void glSecondaryColor3f(GLfloat red, GLfloat green, GLfloat blue);
- void glSecondaryColor3dv(const GLdouble *v);
- void glSecondaryColor3d(GLdouble red, GLdouble green, GLdouble blue);
- void glSecondaryColor3bv(const GLbyte *v);
- void glSecondaryColor3b(GLbyte red, GLbyte green, GLbyte blue);
- void glFogCoordPointer(GLenum type, GLsizei stride, const GLvoid *pointer);
- void glFogCoorddv(const GLdouble *coord);
- void glFogCoordd(GLdouble coord);
- void glFogCoordfv(const GLfloat *coord);
- void glFogCoordf(GLfloat coord);
-
-private:
- friend class QOpenGLContext;
-
- static bool isContextCompatible(QOpenGLContext *context);
- static QOpenGLVersionProfile versionProfile();
-
- QOpenGLFunctions_1_0_CoreBackend* d_1_0_Core;
- QOpenGLFunctions_1_1_CoreBackend* d_1_1_Core;
- QOpenGLFunctions_1_2_CoreBackend* d_1_2_Core;
- QOpenGLFunctions_1_3_CoreBackend* d_1_3_Core;
- QOpenGLFunctions_1_4_CoreBackend* d_1_4_Core;
- QOpenGLFunctions_1_0_DeprecatedBackend* d_1_0_Deprecated;
- QOpenGLFunctions_1_1_DeprecatedBackend* d_1_1_Deprecated;
- QOpenGLFunctions_1_2_DeprecatedBackend* d_1_2_Deprecated;
- QOpenGLFunctions_1_3_DeprecatedBackend* d_1_3_Deprecated;
- QOpenGLFunctions_1_4_DeprecatedBackend* d_1_4_Deprecated;
-};
-
-// OpenGL 1.0 core functions
-inline void QOpenGLFunctions_1_4::glViewport(GLint x, GLint y, GLsizei width, GLsizei height)
-{
- d_1_0_Core->f.Viewport(x, y, width, height);
-}
-
-inline void QOpenGLFunctions_1_4::glDepthRange(GLdouble nearVal, GLdouble farVal)
-{
- d_1_0_Core->f.DepthRange(nearVal, farVal);
-}
-
-inline GLboolean QOpenGLFunctions_1_4::glIsEnabled(GLenum cap)
-{
- return d_1_0_Core->f.IsEnabled(cap);
-}
-
-inline void QOpenGLFunctions_1_4::glGetTexLevelParameteriv(GLenum target, GLint level, GLenum pname, GLint *params)
-{
- d_1_0_Core->f.GetTexLevelParameteriv(target, level, pname, params);
-}
-
-inline void QOpenGLFunctions_1_4::glGetTexLevelParameterfv(GLenum target, GLint level, GLenum pname, GLfloat *params)
-{
- d_1_0_Core->f.GetTexLevelParameterfv(target, level, pname, params);
-}
-
-inline void QOpenGLFunctions_1_4::glGetTexParameteriv(GLenum target, GLenum pname, GLint *params)
-{
- d_1_0_Core->f.GetTexParameteriv(target, pname, params);
-}
-
-inline void QOpenGLFunctions_1_4::glGetTexParameterfv(GLenum target, GLenum pname, GLfloat *params)
-{
- d_1_0_Core->f.GetTexParameterfv(target, pname, params);
-}
-
-inline void QOpenGLFunctions_1_4::glGetTexImage(GLenum target, GLint level, GLenum format, GLenum type, GLvoid *pixels)
-{
- d_1_0_Core->f.GetTexImage(target, level, format, type, pixels);
-}
-
-inline const GLubyte * QOpenGLFunctions_1_4::glGetString(GLenum name)
-{
- return d_1_0_Core->f.GetString(name);
-}
-
-inline void QOpenGLFunctions_1_4::glGetIntegerv(GLenum pname, GLint *params)
-{
- d_1_0_Core->f.GetIntegerv(pname, params);
-}
-
-inline void QOpenGLFunctions_1_4::glGetFloatv(GLenum pname, GLfloat *params)
-{
- d_1_0_Core->f.GetFloatv(pname, params);
-}
-
-inline GLenum QOpenGLFunctions_1_4::glGetError()
-{
- return d_1_0_Core->f.GetError();
-}
-
-inline void QOpenGLFunctions_1_4::glGetDoublev(GLenum pname, GLdouble *params)
-{
- d_1_0_Core->f.GetDoublev(pname, params);
-}
-
-inline void QOpenGLFunctions_1_4::glGetBooleanv(GLenum pname, GLboolean *params)
-{
- d_1_0_Core->f.GetBooleanv(pname, params);
-}
-
-inline void QOpenGLFunctions_1_4::glReadPixels(GLint x, GLint y, GLsizei width, GLsizei height, GLenum format, GLenum type, GLvoid *pixels)
-{
- d_1_0_Core->f.ReadPixels(x, y, width, height, format, type, pixels);
-}
-
-inline void QOpenGLFunctions_1_4::glReadBuffer(GLenum mode)
-{
- d_1_0_Core->f.ReadBuffer(mode);
-}
-
-inline void QOpenGLFunctions_1_4::glPixelStorei(GLenum pname, GLint param)
-{
- d_1_0_Core->f.PixelStorei(pname, param);
-}
-
-inline void QOpenGLFunctions_1_4::glPixelStoref(GLenum pname, GLfloat param)
-{
- d_1_0_Core->f.PixelStoref(pname, param);
-}
-
-inline void QOpenGLFunctions_1_4::glDepthFunc(GLenum func)
-{
- d_1_0_Core->f.DepthFunc(func);
-}
-
-inline void QOpenGLFunctions_1_4::glStencilOp(GLenum fail, GLenum zfail, GLenum zpass)
-{
- d_1_0_Core->f.StencilOp(fail, zfail, zpass);
-}
-
-inline void QOpenGLFunctions_1_4::glStencilFunc(GLenum func, GLint ref, GLuint mask)
-{
- d_1_0_Core->f.StencilFunc(func, ref, mask);
-}
-
-inline void QOpenGLFunctions_1_4::glLogicOp(GLenum opcode)
-{
- d_1_0_Core->f.LogicOp(opcode);
-}
-
-inline void QOpenGLFunctions_1_4::glBlendFunc(GLenum sfactor, GLenum dfactor)
-{
- d_1_0_Core->f.BlendFunc(sfactor, dfactor);
-}
-
-inline void QOpenGLFunctions_1_4::glFlush()
-{
- d_1_0_Core->f.Flush();
-}
-
-inline void QOpenGLFunctions_1_4::glFinish()
-{
- d_1_0_Core->f.Finish();
-}
-
-inline void QOpenGLFunctions_1_4::glEnable(GLenum cap)
-{
- d_1_0_Core->f.Enable(cap);
-}
-
-inline void QOpenGLFunctions_1_4::glDisable(GLenum cap)
-{
- d_1_0_Core->f.Disable(cap);
-}
-
-inline void QOpenGLFunctions_1_4::glDepthMask(GLboolean flag)
-{
- d_1_0_Core->f.DepthMask(flag);
-}
-
-inline void QOpenGLFunctions_1_4::glColorMask(GLboolean red, GLboolean green, GLboolean blue, GLboolean alpha)
-{
- d_1_0_Core->f.ColorMask(red, green, blue, alpha);
-}
-
-inline void QOpenGLFunctions_1_4::glStencilMask(GLuint mask)
-{
- d_1_0_Core->f.StencilMask(mask);
-}
-
-inline void QOpenGLFunctions_1_4::glClearDepth(GLdouble depth)
-{
- d_1_0_Core->f.ClearDepth(depth);
-}
-
-inline void QOpenGLFunctions_1_4::glClearStencil(GLint s)
-{
- d_1_0_Core->f.ClearStencil(s);
-}
-
-inline void QOpenGLFunctions_1_4::glClearColor(GLfloat red, GLfloat green, GLfloat blue, GLfloat alpha)
-{
- d_1_0_Core->f.ClearColor(red, green, blue, alpha);
-}
-
-inline void QOpenGLFunctions_1_4::glClear(GLbitfield mask)
-{
- d_1_0_Core->f.Clear(mask);
-}
-
-inline void QOpenGLFunctions_1_4::glDrawBuffer(GLenum mode)
-{
- d_1_0_Core->f.DrawBuffer(mode);
-}
-
-inline void QOpenGLFunctions_1_4::glTexImage2D(GLenum target, GLint level, GLint internalformat, GLsizei width, GLsizei height, GLint border, GLenum format, GLenum type, const GLvoid *pixels)
-{
- d_1_0_Core->f.TexImage2D(target, level, internalformat, width, height, border, format, type, pixels);
-}
-
-inline void QOpenGLFunctions_1_4::glTexImage1D(GLenum target, GLint level, GLint internalformat, GLsizei width, GLint border, GLenum format, GLenum type, const GLvoid *pixels)
-{
- d_1_0_Core->f.TexImage1D(target, level, internalformat, width, border, format, type, pixels);
-}
-
-inline void QOpenGLFunctions_1_4::glTexParameteriv(GLenum target, GLenum pname, const GLint *params)
-{
- d_1_0_Core->f.TexParameteriv(target, pname, params);
-}
-
-inline void QOpenGLFunctions_1_4::glTexParameteri(GLenum target, GLenum pname, GLint param)
-{
- d_1_0_Core->f.TexParameteri(target, pname, param);
-}
-
-inline void QOpenGLFunctions_1_4::glTexParameterfv(GLenum target, GLenum pname, const GLfloat *params)
-{
- d_1_0_Core->f.TexParameterfv(target, pname, params);
-}
-
-inline void QOpenGLFunctions_1_4::glTexParameterf(GLenum target, GLenum pname, GLfloat param)
-{
- d_1_0_Core->f.TexParameterf(target, pname, param);
-}
-
-inline void QOpenGLFunctions_1_4::glScissor(GLint x, GLint y, GLsizei width, GLsizei height)
-{
- d_1_0_Core->f.Scissor(x, y, width, height);
-}
-
-inline void QOpenGLFunctions_1_4::glPolygonMode(GLenum face, GLenum mode)
-{
- d_1_0_Core->f.PolygonMode(face, mode);
-}
-
-inline void QOpenGLFunctions_1_4::glPointSize(GLfloat size)
-{
- d_1_0_Core->f.PointSize(size);
-}
-
-inline void QOpenGLFunctions_1_4::glLineWidth(GLfloat width)
-{
- d_1_0_Core->f.LineWidth(width);
-}
-
-inline void QOpenGLFunctions_1_4::glHint(GLenum target, GLenum mode)
-{
- d_1_0_Core->f.Hint(target, mode);
-}
-
-inline void QOpenGLFunctions_1_4::glFrontFace(GLenum mode)
-{
- d_1_0_Core->f.FrontFace(mode);
-}
-
-inline void QOpenGLFunctions_1_4::glCullFace(GLenum mode)
-{
- d_1_0_Core->f.CullFace(mode);
-}
-
-
-// OpenGL 1.1 core functions
-inline void QOpenGLFunctions_1_4::glIndexubv(const GLubyte *c)
-{
- d_1_1_Deprecated->f.Indexubv(c);
-}
-
-inline void QOpenGLFunctions_1_4::glIndexub(GLubyte c)
-{
- d_1_1_Deprecated->f.Indexub(c);
-}
-
-inline GLboolean QOpenGLFunctions_1_4::glIsTexture(GLuint texture)
-{
- return d_1_1_Core->f.IsTexture(texture);
-}
-
-inline void QOpenGLFunctions_1_4::glGenTextures(GLsizei n, GLuint *textures)
-{
- d_1_1_Core->f.GenTextures(n, textures);
-}
-
-inline void QOpenGLFunctions_1_4::glDeleteTextures(GLsizei n, const GLuint *textures)
-{
- d_1_1_Core->f.DeleteTextures(n, textures);
-}
-
-inline void QOpenGLFunctions_1_4::glBindTexture(GLenum target, GLuint texture)
-{
- d_1_1_Core->f.BindTexture(target, texture);
-}
-
-inline void QOpenGLFunctions_1_4::glTexSubImage2D(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLenum type, const GLvoid *pixels)
-{
- d_1_1_Core->f.TexSubImage2D(target, level, xoffset, yoffset, width, height, format, type, pixels);
-}
-
-inline void QOpenGLFunctions_1_4::glTexSubImage1D(GLenum target, GLint level, GLint xoffset, GLsizei width, GLenum format, GLenum type, const GLvoid *pixels)
-{
- d_1_1_Core->f.TexSubImage1D(target, level, xoffset, width, format, type, pixels);
-}
-
-inline void QOpenGLFunctions_1_4::glCopyTexSubImage2D(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint x, GLint y, GLsizei width, GLsizei height)
-{
- d_1_1_Core->f.CopyTexSubImage2D(target, level, xoffset, yoffset, x, y, width, height);
-}
-
-inline void QOpenGLFunctions_1_4::glCopyTexSubImage1D(GLenum target, GLint level, GLint xoffset, GLint x, GLint y, GLsizei width)
-{
- d_1_1_Core->f.CopyTexSubImage1D(target, level, xoffset, x, y, width);
-}
-
-inline void QOpenGLFunctions_1_4::glCopyTexImage2D(GLenum target, GLint level, GLenum internalformat, GLint x, GLint y, GLsizei width, GLsizei height, GLint border)
-{
- d_1_1_Core->f.CopyTexImage2D(target, level, internalformat, x, y, width, height, border);
-}
-
-inline void QOpenGLFunctions_1_4::glCopyTexImage1D(GLenum target, GLint level, GLenum internalformat, GLint x, GLint y, GLsizei width, GLint border)
-{
- d_1_1_Core->f.CopyTexImage1D(target, level, internalformat, x, y, width, border);
-}
-
-inline void QOpenGLFunctions_1_4::glPolygonOffset(GLfloat factor, GLfloat units)
-{
- d_1_1_Core->f.PolygonOffset(factor, units);
-}
-
-inline void QOpenGLFunctions_1_4::glGetPointerv(GLenum pname, GLvoid* *params)
-{
- d_1_1_Deprecated->f.GetPointerv(pname, params);
-}
-
-inline void QOpenGLFunctions_1_4::glDrawElements(GLenum mode, GLsizei count, GLenum type, const GLvoid *indices)
-{
- d_1_1_Core->f.DrawElements(mode, count, type, indices);
-}
-
-inline void QOpenGLFunctions_1_4::glDrawArrays(GLenum mode, GLint first, GLsizei count)
-{
- d_1_1_Core->f.DrawArrays(mode, first, count);
-}
-
-
-// OpenGL 1.2 core functions
-inline void QOpenGLFunctions_1_4::glCopyTexSubImage3D(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLint x, GLint y, GLsizei width, GLsizei height)
-{
- d_1_2_Core->f.CopyTexSubImage3D(target, level, xoffset, yoffset, zoffset, x, y, width, height);
-}
-
-inline void QOpenGLFunctions_1_4::glTexSubImage3D(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLenum type, const GLvoid *pixels)
-{
- d_1_2_Core->f.TexSubImage3D(target, level, xoffset, yoffset, zoffset, width, height, depth, format, type, pixels);
-}
-
-inline void QOpenGLFunctions_1_4::glTexImage3D(GLenum target, GLint level, GLint internalformat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLenum format, GLenum type, const GLvoid *pixels)
-{
- d_1_2_Core->f.TexImage3D(target, level, internalformat, width, height, depth, border, format, type, pixels);
-}
-
-inline void QOpenGLFunctions_1_4::glDrawRangeElements(GLenum mode, GLuint start, GLuint end, GLsizei count, GLenum type, const GLvoid *indices)
-{
- d_1_2_Core->f.DrawRangeElements(mode, start, end, count, type, indices);
-}
-
-inline void QOpenGLFunctions_1_4::glBlendEquation(GLenum mode)
-{
- d_1_2_Core->f.BlendEquation(mode);
-}
-
-inline void QOpenGLFunctions_1_4::glBlendColor(GLfloat red, GLfloat green, GLfloat blue, GLfloat alpha)
-{
- d_1_2_Core->f.BlendColor(red, green, blue, alpha);
-}
-
-
-// OpenGL 1.3 core functions
-inline void QOpenGLFunctions_1_4::glGetCompressedTexImage(GLenum target, GLint level, GLvoid *img)
-{
- d_1_3_Core->f.GetCompressedTexImage(target, level, img);
-}
-
-inline void QOpenGLFunctions_1_4::glCompressedTexSubImage1D(GLenum target, GLint level, GLint xoffset, GLsizei width, GLenum format, GLsizei imageSize, const GLvoid *data)
-{
- d_1_3_Core->f.CompressedTexSubImage1D(target, level, xoffset, width, format, imageSize, data);
-}
-
-inline void QOpenGLFunctions_1_4::glCompressedTexSubImage2D(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLsizei imageSize, const GLvoid *data)
-{
- d_1_3_Core->f.CompressedTexSubImage2D(target, level, xoffset, yoffset, width, height, format, imageSize, data);
-}
-
-inline void QOpenGLFunctions_1_4::glCompressedTexSubImage3D(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLsizei imageSize, const GLvoid *data)
-{
- d_1_3_Core->f.CompressedTexSubImage3D(target, level, xoffset, yoffset, zoffset, width, height, depth, format, imageSize, data);
-}
-
-inline void QOpenGLFunctions_1_4::glCompressedTexImage1D(GLenum target, GLint level, GLenum internalformat, GLsizei width, GLint border, GLsizei imageSize, const GLvoid *data)
-{
- d_1_3_Core->f.CompressedTexImage1D(target, level, internalformat, width, border, imageSize, data);
-}
-
-inline void QOpenGLFunctions_1_4::glCompressedTexImage2D(GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLint border, GLsizei imageSize, const GLvoid *data)
-{
- d_1_3_Core->f.CompressedTexImage2D(target, level, internalformat, width, height, border, imageSize, data);
-}
-
-inline void QOpenGLFunctions_1_4::glCompressedTexImage3D(GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLsizei imageSize, const GLvoid *data)
-{
- d_1_3_Core->f.CompressedTexImage3D(target, level, internalformat, width, height, depth, border, imageSize, data);
-}
-
-inline void QOpenGLFunctions_1_4::glSampleCoverage(GLfloat value, GLboolean invert)
-{
- d_1_3_Core->f.SampleCoverage(value, invert);
-}
-
-inline void QOpenGLFunctions_1_4::glActiveTexture(GLenum texture)
-{
- d_1_3_Core->f.ActiveTexture(texture);
-}
-
-
-// OpenGL 1.4 core functions
-inline void QOpenGLFunctions_1_4::glPointParameteriv(GLenum pname, const GLint *params)
-{
- d_1_4_Core->f.PointParameteriv(pname, params);
-}
-
-inline void QOpenGLFunctions_1_4::glPointParameteri(GLenum pname, GLint param)
-{
- d_1_4_Core->f.PointParameteri(pname, param);
-}
-
-inline void QOpenGLFunctions_1_4::glPointParameterfv(GLenum pname, const GLfloat *params)
-{
- d_1_4_Core->f.PointParameterfv(pname, params);
-}
-
-inline void QOpenGLFunctions_1_4::glPointParameterf(GLenum pname, GLfloat param)
-{
- d_1_4_Core->f.PointParameterf(pname, param);
-}
-
-inline void QOpenGLFunctions_1_4::glMultiDrawElements(GLenum mode, const GLsizei *count, GLenum type, const GLvoid* const *indices, GLsizei drawcount)
-{
- d_1_4_Core->f.MultiDrawElements(mode, count, type, indices, drawcount);
-}
-
-inline void QOpenGLFunctions_1_4::glMultiDrawArrays(GLenum mode, const GLint *first, const GLsizei *count, GLsizei drawcount)
-{
- d_1_4_Core->f.MultiDrawArrays(mode, first, count, drawcount);
-}
-
-inline void QOpenGLFunctions_1_4::glBlendFuncSeparate(GLenum sfactorRGB, GLenum dfactorRGB, GLenum sfactorAlpha, GLenum dfactorAlpha)
-{
- d_1_4_Core->f.BlendFuncSeparate(sfactorRGB, dfactorRGB, sfactorAlpha, dfactorAlpha);
-}
-
-
-// OpenGL 1.0 deprecated functions
-inline void QOpenGLFunctions_1_4::glTranslatef(GLfloat x, GLfloat y, GLfloat z)
-{
- d_1_0_Deprecated->f.Translatef(x, y, z);
-}
-
-inline void QOpenGLFunctions_1_4::glTranslated(GLdouble x, GLdouble y, GLdouble z)
-{
- d_1_0_Deprecated->f.Translated(x, y, z);
-}
-
-inline void QOpenGLFunctions_1_4::glScalef(GLfloat x, GLfloat y, GLfloat z)
-{
- d_1_0_Deprecated->f.Scalef(x, y, z);
-}
-
-inline void QOpenGLFunctions_1_4::glScaled(GLdouble x, GLdouble y, GLdouble z)
-{
- d_1_0_Deprecated->f.Scaled(x, y, z);
-}
-
-inline void QOpenGLFunctions_1_4::glRotatef(GLfloat angle, GLfloat x, GLfloat y, GLfloat z)
-{
- d_1_0_Deprecated->f.Rotatef(angle, x, y, z);
-}
-
-inline void QOpenGLFunctions_1_4::glRotated(GLdouble angle, GLdouble x, GLdouble y, GLdouble z)
-{
- d_1_0_Deprecated->f.Rotated(angle, x, y, z);
-}
-
-inline void QOpenGLFunctions_1_4::glPushMatrix()
-{
- d_1_0_Deprecated->f.PushMatrix();
-}
-
-inline void QOpenGLFunctions_1_4::glPopMatrix()
-{
- d_1_0_Deprecated->f.PopMatrix();
-}
-
-inline void QOpenGLFunctions_1_4::glOrtho(GLdouble left, GLdouble right, GLdouble bottom, GLdouble top, GLdouble zNear, GLdouble zFar)
-{
- d_1_0_Deprecated->f.Ortho(left, right, bottom, top, zNear, zFar);
-}
-
-inline void QOpenGLFunctions_1_4::glMultMatrixd(const GLdouble *m)
-{
- d_1_0_Deprecated->f.MultMatrixd(m);
-}
-
-inline void QOpenGLFunctions_1_4::glMultMatrixf(const GLfloat *m)
-{
- d_1_0_Deprecated->f.MultMatrixf(m);
-}
-
-inline void QOpenGLFunctions_1_4::glMatrixMode(GLenum mode)
-{
- d_1_0_Deprecated->f.MatrixMode(mode);
-}
-
-inline void QOpenGLFunctions_1_4::glLoadMatrixd(const GLdouble *m)
-{
- d_1_0_Deprecated->f.LoadMatrixd(m);
-}
-
-inline void QOpenGLFunctions_1_4::glLoadMatrixf(const GLfloat *m)
-{
- d_1_0_Deprecated->f.LoadMatrixf(m);
-}
-
-inline void QOpenGLFunctions_1_4::glLoadIdentity()
-{
- d_1_0_Deprecated->f.LoadIdentity();
-}
-
-inline void QOpenGLFunctions_1_4::glFrustum(GLdouble left, GLdouble right, GLdouble bottom, GLdouble top, GLdouble zNear, GLdouble zFar)
-{
- d_1_0_Deprecated->f.Frustum(left, right, bottom, top, zNear, zFar);
-}
-
-inline GLboolean QOpenGLFunctions_1_4::glIsList(GLuint list)
-{
- return d_1_0_Deprecated->f.IsList(list);
-}
-
-inline void QOpenGLFunctions_1_4::glGetTexGeniv(GLenum coord, GLenum pname, GLint *params)
-{
- d_1_0_Deprecated->f.GetTexGeniv(coord, pname, params);
-}
-
-inline void QOpenGLFunctions_1_4::glGetTexGenfv(GLenum coord, GLenum pname, GLfloat *params)
-{
- d_1_0_Deprecated->f.GetTexGenfv(coord, pname, params);
-}
-
-inline void QOpenGLFunctions_1_4::glGetTexGendv(GLenum coord, GLenum pname, GLdouble *params)
-{
- d_1_0_Deprecated->f.GetTexGendv(coord, pname, params);
-}
-
-inline void QOpenGLFunctions_1_4::glGetTexEnviv(GLenum target, GLenum pname, GLint *params)
-{
- d_1_0_Deprecated->f.GetTexEnviv(target, pname, params);
-}
-
-inline void QOpenGLFunctions_1_4::glGetTexEnvfv(GLenum target, GLenum pname, GLfloat *params)
-{
- d_1_0_Deprecated->f.GetTexEnvfv(target, pname, params);
-}
-
-inline void QOpenGLFunctions_1_4::glGetPolygonStipple(GLubyte *mask)
-{
- d_1_0_Deprecated->f.GetPolygonStipple(mask);
-}
-
-inline void QOpenGLFunctions_1_4::glGetPixelMapusv(GLenum map, GLushort *values)
-{
- d_1_0_Deprecated->f.GetPixelMapusv(map, values);
-}
-
-inline void QOpenGLFunctions_1_4::glGetPixelMapuiv(GLenum map, GLuint *values)
-{
- d_1_0_Deprecated->f.GetPixelMapuiv(map, values);
-}
-
-inline void QOpenGLFunctions_1_4::glGetPixelMapfv(GLenum map, GLfloat *values)
-{
- d_1_0_Deprecated->f.GetPixelMapfv(map, values);
-}
-
-inline void QOpenGLFunctions_1_4::glGetMaterialiv(GLenum face, GLenum pname, GLint *params)
-{
- d_1_0_Deprecated->f.GetMaterialiv(face, pname, params);
-}
-
-inline void QOpenGLFunctions_1_4::glGetMaterialfv(GLenum face, GLenum pname, GLfloat *params)
-{
- d_1_0_Deprecated->f.GetMaterialfv(face, pname, params);
-}
-
-inline void QOpenGLFunctions_1_4::glGetMapiv(GLenum target, GLenum query, GLint *v)
-{
- d_1_0_Deprecated->f.GetMapiv(target, query, v);
-}
-
-inline void QOpenGLFunctions_1_4::glGetMapfv(GLenum target, GLenum query, GLfloat *v)
-{
- d_1_0_Deprecated->f.GetMapfv(target, query, v);
-}
-
-inline void QOpenGLFunctions_1_4::glGetMapdv(GLenum target, GLenum query, GLdouble *v)
-{
- d_1_0_Deprecated->f.GetMapdv(target, query, v);
-}
-
-inline void QOpenGLFunctions_1_4::glGetLightiv(GLenum light, GLenum pname, GLint *params)
-{
- d_1_0_Deprecated->f.GetLightiv(light, pname, params);
-}
-
-inline void QOpenGLFunctions_1_4::glGetLightfv(GLenum light, GLenum pname, GLfloat *params)
-{
- d_1_0_Deprecated->f.GetLightfv(light, pname, params);
-}
-
-inline void QOpenGLFunctions_1_4::glGetClipPlane(GLenum plane, GLdouble *equation)
-{
- d_1_0_Deprecated->f.GetClipPlane(plane, equation);
-}
-
-inline void QOpenGLFunctions_1_4::glDrawPixels(GLsizei width, GLsizei height, GLenum format, GLenum type, const GLvoid *pixels)
-{
- d_1_0_Deprecated->f.DrawPixels(width, height, format, type, pixels);
-}
-
-inline void QOpenGLFunctions_1_4::glCopyPixels(GLint x, GLint y, GLsizei width, GLsizei height, GLenum type)
-{
- d_1_0_Deprecated->f.CopyPixels(x, y, width, height, type);
-}
-
-inline void QOpenGLFunctions_1_4::glPixelMapusv(GLenum map, GLint mapsize, const GLushort *values)
-{
- d_1_0_Deprecated->f.PixelMapusv(map, mapsize, values);
-}
-
-inline void QOpenGLFunctions_1_4::glPixelMapuiv(GLenum map, GLint mapsize, const GLuint *values)
-{
- d_1_0_Deprecated->f.PixelMapuiv(map, mapsize, values);
-}
-
-inline void QOpenGLFunctions_1_4::glPixelMapfv(GLenum map, GLint mapsize, const GLfloat *values)
-{
- d_1_0_Deprecated->f.PixelMapfv(map, mapsize, values);
-}
-
-inline void QOpenGLFunctions_1_4::glPixelTransferi(GLenum pname, GLint param)
-{
- d_1_0_Deprecated->f.PixelTransferi(pname, param);
-}
-
-inline void QOpenGLFunctions_1_4::glPixelTransferf(GLenum pname, GLfloat param)
-{
- d_1_0_Deprecated->f.PixelTransferf(pname, param);
-}
-
-inline void QOpenGLFunctions_1_4::glPixelZoom(GLfloat xfactor, GLfloat yfactor)
-{
- d_1_0_Deprecated->f.PixelZoom(xfactor, yfactor);
-}
-
-inline void QOpenGLFunctions_1_4::glAlphaFunc(GLenum func, GLfloat ref)
-{
- d_1_0_Deprecated->f.AlphaFunc(func, ref);
-}
-
-inline void QOpenGLFunctions_1_4::glEvalPoint2(GLint i, GLint j)
-{
- d_1_0_Deprecated->f.EvalPoint2(i, j);
-}
-
-inline void QOpenGLFunctions_1_4::glEvalMesh2(GLenum mode, GLint i1, GLint i2, GLint j1, GLint j2)
-{
- d_1_0_Deprecated->f.EvalMesh2(mode, i1, i2, j1, j2);
-}
-
-inline void QOpenGLFunctions_1_4::glEvalPoint1(GLint i)
-{
- d_1_0_Deprecated->f.EvalPoint1(i);
-}
-
-inline void QOpenGLFunctions_1_4::glEvalMesh1(GLenum mode, GLint i1, GLint i2)
-{
- d_1_0_Deprecated->f.EvalMesh1(mode, i1, i2);
-}
-
-inline void QOpenGLFunctions_1_4::glEvalCoord2fv(const GLfloat *u)
-{
- d_1_0_Deprecated->f.EvalCoord2fv(u);
-}
-
-inline void QOpenGLFunctions_1_4::glEvalCoord2f(GLfloat u, GLfloat v)
-{
- d_1_0_Deprecated->f.EvalCoord2f(u, v);
-}
-
-inline void QOpenGLFunctions_1_4::glEvalCoord2dv(const GLdouble *u)
-{
- d_1_0_Deprecated->f.EvalCoord2dv(u);
-}
-
-inline void QOpenGLFunctions_1_4::glEvalCoord2d(GLdouble u, GLdouble v)
-{
- d_1_0_Deprecated->f.EvalCoord2d(u, v);
-}
-
-inline void QOpenGLFunctions_1_4::glEvalCoord1fv(const GLfloat *u)
-{
- d_1_0_Deprecated->f.EvalCoord1fv(u);
-}
-
-inline void QOpenGLFunctions_1_4::glEvalCoord1f(GLfloat u)
-{
- d_1_0_Deprecated->f.EvalCoord1f(u);
-}
-
-inline void QOpenGLFunctions_1_4::glEvalCoord1dv(const GLdouble *u)
-{
- d_1_0_Deprecated->f.EvalCoord1dv(u);
-}
-
-inline void QOpenGLFunctions_1_4::glEvalCoord1d(GLdouble u)
-{
- d_1_0_Deprecated->f.EvalCoord1d(u);
-}
-
-inline void QOpenGLFunctions_1_4::glMapGrid2f(GLint un, GLfloat u1, GLfloat u2, GLint vn, GLfloat v1, GLfloat v2)
-{
- d_1_0_Deprecated->f.MapGrid2f(un, u1, u2, vn, v1, v2);
-}
-
-inline void QOpenGLFunctions_1_4::glMapGrid2d(GLint un, GLdouble u1, GLdouble u2, GLint vn, GLdouble v1, GLdouble v2)
-{
- d_1_0_Deprecated->f.MapGrid2d(un, u1, u2, vn, v1, v2);
-}
-
-inline void QOpenGLFunctions_1_4::glMapGrid1f(GLint un, GLfloat u1, GLfloat u2)
-{
- d_1_0_Deprecated->f.MapGrid1f(un, u1, u2);
-}
-
-inline void QOpenGLFunctions_1_4::glMapGrid1d(GLint un, GLdouble u1, GLdouble u2)
-{
- d_1_0_Deprecated->f.MapGrid1d(un, u1, u2);
-}
-
-inline void QOpenGLFunctions_1_4::glMap2f(GLenum target, GLfloat u1, GLfloat u2, GLint ustride, GLint uorder, GLfloat v1, GLfloat v2, GLint vstride, GLint vorder, const GLfloat *points)
-{
- d_1_0_Deprecated->f.Map2f(target, u1, u2, ustride, uorder, v1, v2, vstride, vorder, points);
-}
-
-inline void QOpenGLFunctions_1_4::glMap2d(GLenum target, GLdouble u1, GLdouble u2, GLint ustride, GLint uorder, GLdouble v1, GLdouble v2, GLint vstride, GLint vorder, const GLdouble *points)
-{
- d_1_0_Deprecated->f.Map2d(target, u1, u2, ustride, uorder, v1, v2, vstride, vorder, points);
-}
-
-inline void QOpenGLFunctions_1_4::glMap1f(GLenum target, GLfloat u1, GLfloat u2, GLint stride, GLint order, const GLfloat *points)
-{
- d_1_0_Deprecated->f.Map1f(target, u1, u2, stride, order, points);
-}
-
-inline void QOpenGLFunctions_1_4::glMap1d(GLenum target, GLdouble u1, GLdouble u2, GLint stride, GLint order, const GLdouble *points)
-{
- d_1_0_Deprecated->f.Map1d(target, u1, u2, stride, order, points);
-}
-
-inline void QOpenGLFunctions_1_4::glPushAttrib(GLbitfield mask)
-{
- d_1_0_Deprecated->f.PushAttrib(mask);
-}
-
-inline void QOpenGLFunctions_1_4::glPopAttrib()
-{
- d_1_0_Deprecated->f.PopAttrib();
-}
-
-inline void QOpenGLFunctions_1_4::glAccum(GLenum op, GLfloat value)
-{
- d_1_0_Deprecated->f.Accum(op, value);
-}
-
-inline void QOpenGLFunctions_1_4::glIndexMask(GLuint mask)
-{
- d_1_0_Deprecated->f.IndexMask(mask);
-}
-
-inline void QOpenGLFunctions_1_4::glClearIndex(GLfloat c)
-{
- d_1_0_Deprecated->f.ClearIndex(c);
-}
-
-inline void QOpenGLFunctions_1_4::glClearAccum(GLfloat red, GLfloat green, GLfloat blue, GLfloat alpha)
-{
- d_1_0_Deprecated->f.ClearAccum(red, green, blue, alpha);
-}
-
-inline void QOpenGLFunctions_1_4::glPushName(GLuint name)
-{
- d_1_0_Deprecated->f.PushName(name);
-}
-
-inline void QOpenGLFunctions_1_4::glPopName()
-{
- d_1_0_Deprecated->f.PopName();
-}
-
-inline void QOpenGLFunctions_1_4::glPassThrough(GLfloat token)
-{
- d_1_0_Deprecated->f.PassThrough(token);
-}
-
-inline void QOpenGLFunctions_1_4::glLoadName(GLuint name)
-{
- d_1_0_Deprecated->f.LoadName(name);
-}
-
-inline void QOpenGLFunctions_1_4::glInitNames()
-{
- d_1_0_Deprecated->f.InitNames();
-}
-
-inline GLint QOpenGLFunctions_1_4::glRenderMode(GLenum mode)
-{
- return d_1_0_Deprecated->f.RenderMode(mode);
-}
-
-inline void QOpenGLFunctions_1_4::glSelectBuffer(GLsizei size, GLuint *buffer)
-{
- d_1_0_Deprecated->f.SelectBuffer(size, buffer);
-}
-
-inline void QOpenGLFunctions_1_4::glFeedbackBuffer(GLsizei size, GLenum type, GLfloat *buffer)
-{
- d_1_0_Deprecated->f.FeedbackBuffer(size, type, buffer);
-}
-
-inline void QOpenGLFunctions_1_4::glTexGeniv(GLenum coord, GLenum pname, const GLint *params)
-{
- d_1_0_Deprecated->f.TexGeniv(coord, pname, params);
-}
-
-inline void QOpenGLFunctions_1_4::glTexGeni(GLenum coord, GLenum pname, GLint param)
-{
- d_1_0_Deprecated->f.TexGeni(coord, pname, param);
-}
-
-inline void QOpenGLFunctions_1_4::glTexGenfv(GLenum coord, GLenum pname, const GLfloat *params)
-{
- d_1_0_Deprecated->f.TexGenfv(coord, pname, params);
-}
-
-inline void QOpenGLFunctions_1_4::glTexGenf(GLenum coord, GLenum pname, GLfloat param)
-{
- d_1_0_Deprecated->f.TexGenf(coord, pname, param);
-}
-
-inline void QOpenGLFunctions_1_4::glTexGendv(GLenum coord, GLenum pname, const GLdouble *params)
-{
- d_1_0_Deprecated->f.TexGendv(coord, pname, params);
-}
-
-inline void QOpenGLFunctions_1_4::glTexGend(GLenum coord, GLenum pname, GLdouble param)
-{
- d_1_0_Deprecated->f.TexGend(coord, pname, param);
-}
-
-inline void QOpenGLFunctions_1_4::glTexEnviv(GLenum target, GLenum pname, const GLint *params)
-{
- d_1_0_Deprecated->f.TexEnviv(target, pname, params);
-}
-
-inline void QOpenGLFunctions_1_4::glTexEnvi(GLenum target, GLenum pname, GLint param)
-{
- d_1_0_Deprecated->f.TexEnvi(target, pname, param);
-}
-
-inline void QOpenGLFunctions_1_4::glTexEnvfv(GLenum target, GLenum pname, const GLfloat *params)
-{
- d_1_0_Deprecated->f.TexEnvfv(target, pname, params);
-}
-
-inline void QOpenGLFunctions_1_4::glTexEnvf(GLenum target, GLenum pname, GLfloat param)
-{
- d_1_0_Deprecated->f.TexEnvf(target, pname, param);
-}
-
-inline void QOpenGLFunctions_1_4::glShadeModel(GLenum mode)
-{
- d_1_0_Deprecated->f.ShadeModel(mode);
-}
-
-inline void QOpenGLFunctions_1_4::glPolygonStipple(const GLubyte *mask)
-{
- d_1_0_Deprecated->f.PolygonStipple(mask);
-}
-
-inline void QOpenGLFunctions_1_4::glMaterialiv(GLenum face, GLenum pname, const GLint *params)
-{
- d_1_0_Deprecated->f.Materialiv(face, pname, params);
-}
-
-inline void QOpenGLFunctions_1_4::glMateriali(GLenum face, GLenum pname, GLint param)
-{
- d_1_0_Deprecated->f.Materiali(face, pname, param);
-}
-
-inline void QOpenGLFunctions_1_4::glMaterialfv(GLenum face, GLenum pname, const GLfloat *params)
-{
- d_1_0_Deprecated->f.Materialfv(face, pname, params);
-}
-
-inline void QOpenGLFunctions_1_4::glMaterialf(GLenum face, GLenum pname, GLfloat param)
-{
- d_1_0_Deprecated->f.Materialf(face, pname, param);
-}
-
-inline void QOpenGLFunctions_1_4::glLineStipple(GLint factor, GLushort pattern)
-{
- d_1_0_Deprecated->f.LineStipple(factor, pattern);
-}
-
-inline void QOpenGLFunctions_1_4::glLightModeliv(GLenum pname, const GLint *params)
-{
- d_1_0_Deprecated->f.LightModeliv(pname, params);
-}
-
-inline void QOpenGLFunctions_1_4::glLightModeli(GLenum pname, GLint param)
-{
- d_1_0_Deprecated->f.LightModeli(pname, param);
-}
-
-inline void QOpenGLFunctions_1_4::glLightModelfv(GLenum pname, const GLfloat *params)
-{
- d_1_0_Deprecated->f.LightModelfv(pname, params);
-}
-
-inline void QOpenGLFunctions_1_4::glLightModelf(GLenum pname, GLfloat param)
-{
- d_1_0_Deprecated->f.LightModelf(pname, param);
-}
-
-inline void QOpenGLFunctions_1_4::glLightiv(GLenum light, GLenum pname, const GLint *params)
-{
- d_1_0_Deprecated->f.Lightiv(light, pname, params);
-}
-
-inline void QOpenGLFunctions_1_4::glLighti(GLenum light, GLenum pname, GLint param)
-{
- d_1_0_Deprecated->f.Lighti(light, pname, param);
-}
-
-inline void QOpenGLFunctions_1_4::glLightfv(GLenum light, GLenum pname, const GLfloat *params)
-{
- d_1_0_Deprecated->f.Lightfv(light, pname, params);
-}
-
-inline void QOpenGLFunctions_1_4::glLightf(GLenum light, GLenum pname, GLfloat param)
-{
- d_1_0_Deprecated->f.Lightf(light, pname, param);
-}
-
-inline void QOpenGLFunctions_1_4::glFogiv(GLenum pname, const GLint *params)
-{
- d_1_0_Deprecated->f.Fogiv(pname, params);
-}
-
-inline void QOpenGLFunctions_1_4::glFogi(GLenum pname, GLint param)
-{
- d_1_0_Deprecated->f.Fogi(pname, param);
-}
-
-inline void QOpenGLFunctions_1_4::glFogfv(GLenum pname, const GLfloat *params)
-{
- d_1_0_Deprecated->f.Fogfv(pname, params);
-}
-
-inline void QOpenGLFunctions_1_4::glFogf(GLenum pname, GLfloat param)
-{
- d_1_0_Deprecated->f.Fogf(pname, param);
-}
-
-inline void QOpenGLFunctions_1_4::glColorMaterial(GLenum face, GLenum mode)
-{
- d_1_0_Deprecated->f.ColorMaterial(face, mode);
-}
-
-inline void QOpenGLFunctions_1_4::glClipPlane(GLenum plane, const GLdouble *equation)
-{
- d_1_0_Deprecated->f.ClipPlane(plane, equation);
-}
-
-inline void QOpenGLFunctions_1_4::glVertex4sv(const GLshort *v)
-{
- d_1_0_Deprecated->f.Vertex4sv(v);
-}
-
-inline void QOpenGLFunctions_1_4::glVertex4s(GLshort x, GLshort y, GLshort z, GLshort w)
-{
- d_1_0_Deprecated->f.Vertex4s(x, y, z, w);
-}
-
-inline void QOpenGLFunctions_1_4::glVertex4iv(const GLint *v)
-{
- d_1_0_Deprecated->f.Vertex4iv(v);
-}
-
-inline void QOpenGLFunctions_1_4::glVertex4i(GLint x, GLint y, GLint z, GLint w)
-{
- d_1_0_Deprecated->f.Vertex4i(x, y, z, w);
-}
-
-inline void QOpenGLFunctions_1_4::glVertex4fv(const GLfloat *v)
-{
- d_1_0_Deprecated->f.Vertex4fv(v);
-}
-
-inline void QOpenGLFunctions_1_4::glVertex4f(GLfloat x, GLfloat y, GLfloat z, GLfloat w)
-{
- d_1_0_Deprecated->f.Vertex4f(x, y, z, w);
-}
-
-inline void QOpenGLFunctions_1_4::glVertex4dv(const GLdouble *v)
-{
- d_1_0_Deprecated->f.Vertex4dv(v);
-}
-
-inline void QOpenGLFunctions_1_4::glVertex4d(GLdouble x, GLdouble y, GLdouble z, GLdouble w)
-{
- d_1_0_Deprecated->f.Vertex4d(x, y, z, w);
-}
-
-inline void QOpenGLFunctions_1_4::glVertex3sv(const GLshort *v)
-{
- d_1_0_Deprecated->f.Vertex3sv(v);
-}
-
-inline void QOpenGLFunctions_1_4::glVertex3s(GLshort x, GLshort y, GLshort z)
-{
- d_1_0_Deprecated->f.Vertex3s(x, y, z);
-}
-
-inline void QOpenGLFunctions_1_4::glVertex3iv(const GLint *v)
-{
- d_1_0_Deprecated->f.Vertex3iv(v);
-}
-
-inline void QOpenGLFunctions_1_4::glVertex3i(GLint x, GLint y, GLint z)
-{
- d_1_0_Deprecated->f.Vertex3i(x, y, z);
-}
-
-inline void QOpenGLFunctions_1_4::glVertex3fv(const GLfloat *v)
-{
- d_1_0_Deprecated->f.Vertex3fv(v);
-}
-
-inline void QOpenGLFunctions_1_4::glVertex3f(GLfloat x, GLfloat y, GLfloat z)
-{
- d_1_0_Deprecated->f.Vertex3f(x, y, z);
-}
-
-inline void QOpenGLFunctions_1_4::glVertex3dv(const GLdouble *v)
-{
- d_1_0_Deprecated->f.Vertex3dv(v);
-}
-
-inline void QOpenGLFunctions_1_4::glVertex3d(GLdouble x, GLdouble y, GLdouble z)
-{
- d_1_0_Deprecated->f.Vertex3d(x, y, z);
-}
-
-inline void QOpenGLFunctions_1_4::glVertex2sv(const GLshort *v)
-{
- d_1_0_Deprecated->f.Vertex2sv(v);
-}
-
-inline void QOpenGLFunctions_1_4::glVertex2s(GLshort x, GLshort y)
-{
- d_1_0_Deprecated->f.Vertex2s(x, y);
-}
-
-inline void QOpenGLFunctions_1_4::glVertex2iv(const GLint *v)
-{
- d_1_0_Deprecated->f.Vertex2iv(v);
-}
-
-inline void QOpenGLFunctions_1_4::glVertex2i(GLint x, GLint y)
-{
- d_1_0_Deprecated->f.Vertex2i(x, y);
-}
-
-inline void QOpenGLFunctions_1_4::glVertex2fv(const GLfloat *v)
-{
- d_1_0_Deprecated->f.Vertex2fv(v);
-}
-
-inline void QOpenGLFunctions_1_4::glVertex2f(GLfloat x, GLfloat y)
-{
- d_1_0_Deprecated->f.Vertex2f(x, y);
-}
-
-inline void QOpenGLFunctions_1_4::glVertex2dv(const GLdouble *v)
-{
- d_1_0_Deprecated->f.Vertex2dv(v);
-}
-
-inline void QOpenGLFunctions_1_4::glVertex2d(GLdouble x, GLdouble y)
-{
- d_1_0_Deprecated->f.Vertex2d(x, y);
-}
-
-inline void QOpenGLFunctions_1_4::glTexCoord4sv(const GLshort *v)
-{
- d_1_0_Deprecated->f.TexCoord4sv(v);
-}
-
-inline void QOpenGLFunctions_1_4::glTexCoord4s(GLshort s, GLshort t, GLshort r, GLshort q)
-{
- d_1_0_Deprecated->f.TexCoord4s(s, t, r, q);
-}
-
-inline void QOpenGLFunctions_1_4::glTexCoord4iv(const GLint *v)
-{
- d_1_0_Deprecated->f.TexCoord4iv(v);
-}
-
-inline void QOpenGLFunctions_1_4::glTexCoord4i(GLint s, GLint t, GLint r, GLint q)
-{
- d_1_0_Deprecated->f.TexCoord4i(s, t, r, q);
-}
-
-inline void QOpenGLFunctions_1_4::glTexCoord4fv(const GLfloat *v)
-{
- d_1_0_Deprecated->f.TexCoord4fv(v);
-}
-
-inline void QOpenGLFunctions_1_4::glTexCoord4f(GLfloat s, GLfloat t, GLfloat r, GLfloat q)
-{
- d_1_0_Deprecated->f.TexCoord4f(s, t, r, q);
-}
-
-inline void QOpenGLFunctions_1_4::glTexCoord4dv(const GLdouble *v)
-{
- d_1_0_Deprecated->f.TexCoord4dv(v);
-}
-
-inline void QOpenGLFunctions_1_4::glTexCoord4d(GLdouble s, GLdouble t, GLdouble r, GLdouble q)
-{
- d_1_0_Deprecated->f.TexCoord4d(s, t, r, q);
-}
-
-inline void QOpenGLFunctions_1_4::glTexCoord3sv(const GLshort *v)
-{
- d_1_0_Deprecated->f.TexCoord3sv(v);
-}
-
-inline void QOpenGLFunctions_1_4::glTexCoord3s(GLshort s, GLshort t, GLshort r)
-{
- d_1_0_Deprecated->f.TexCoord3s(s, t, r);
-}
-
-inline void QOpenGLFunctions_1_4::glTexCoord3iv(const GLint *v)
-{
- d_1_0_Deprecated->f.TexCoord3iv(v);
-}
-
-inline void QOpenGLFunctions_1_4::glTexCoord3i(GLint s, GLint t, GLint r)
-{
- d_1_0_Deprecated->f.TexCoord3i(s, t, r);
-}
-
-inline void QOpenGLFunctions_1_4::glTexCoord3fv(const GLfloat *v)
-{
- d_1_0_Deprecated->f.TexCoord3fv(v);
-}
-
-inline void QOpenGLFunctions_1_4::glTexCoord3f(GLfloat s, GLfloat t, GLfloat r)
-{
- d_1_0_Deprecated->f.TexCoord3f(s, t, r);
-}
-
-inline void QOpenGLFunctions_1_4::glTexCoord3dv(const GLdouble *v)
-{
- d_1_0_Deprecated->f.TexCoord3dv(v);
-}
-
-inline void QOpenGLFunctions_1_4::glTexCoord3d(GLdouble s, GLdouble t, GLdouble r)
-{
- d_1_0_Deprecated->f.TexCoord3d(s, t, r);
-}
-
-inline void QOpenGLFunctions_1_4::glTexCoord2sv(const GLshort *v)
-{
- d_1_0_Deprecated->f.TexCoord2sv(v);
-}
-
-inline void QOpenGLFunctions_1_4::glTexCoord2s(GLshort s, GLshort t)
-{
- d_1_0_Deprecated->f.TexCoord2s(s, t);
-}
-
-inline void QOpenGLFunctions_1_4::glTexCoord2iv(const GLint *v)
-{
- d_1_0_Deprecated->f.TexCoord2iv(v);
-}
-
-inline void QOpenGLFunctions_1_4::glTexCoord2i(GLint s, GLint t)
-{
- d_1_0_Deprecated->f.TexCoord2i(s, t);
-}
-
-inline void QOpenGLFunctions_1_4::glTexCoord2fv(const GLfloat *v)
-{
- d_1_0_Deprecated->f.TexCoord2fv(v);
-}
-
-inline void QOpenGLFunctions_1_4::glTexCoord2f(GLfloat s, GLfloat t)
-{
- d_1_0_Deprecated->f.TexCoord2f(s, t);
-}
-
-inline void QOpenGLFunctions_1_4::glTexCoord2dv(const GLdouble *v)
-{
- d_1_0_Deprecated->f.TexCoord2dv(v);
-}
-
-inline void QOpenGLFunctions_1_4::glTexCoord2d(GLdouble s, GLdouble t)
-{
- d_1_0_Deprecated->f.TexCoord2d(s, t);
-}
-
-inline void QOpenGLFunctions_1_4::glTexCoord1sv(const GLshort *v)
-{
- d_1_0_Deprecated->f.TexCoord1sv(v);
-}
-
-inline void QOpenGLFunctions_1_4::glTexCoord1s(GLshort s)
-{
- d_1_0_Deprecated->f.TexCoord1s(s);
-}
-
-inline void QOpenGLFunctions_1_4::glTexCoord1iv(const GLint *v)
-{
- d_1_0_Deprecated->f.TexCoord1iv(v);
-}
-
-inline void QOpenGLFunctions_1_4::glTexCoord1i(GLint s)
-{
- d_1_0_Deprecated->f.TexCoord1i(s);
-}
-
-inline void QOpenGLFunctions_1_4::glTexCoord1fv(const GLfloat *v)
-{
- d_1_0_Deprecated->f.TexCoord1fv(v);
-}
-
-inline void QOpenGLFunctions_1_4::glTexCoord1f(GLfloat s)
-{
- d_1_0_Deprecated->f.TexCoord1f(s);
-}
-
-inline void QOpenGLFunctions_1_4::glTexCoord1dv(const GLdouble *v)
-{
- d_1_0_Deprecated->f.TexCoord1dv(v);
-}
-
-inline void QOpenGLFunctions_1_4::glTexCoord1d(GLdouble s)
-{
- d_1_0_Deprecated->f.TexCoord1d(s);
-}
-
-inline void QOpenGLFunctions_1_4::glRectsv(const GLshort *v1, const GLshort *v2)
-{
- d_1_0_Deprecated->f.Rectsv(v1, v2);
-}
-
-inline void QOpenGLFunctions_1_4::glRects(GLshort x1, GLshort y1, GLshort x2, GLshort y2)
-{
- d_1_0_Deprecated->f.Rects(x1, y1, x2, y2);
-}
-
-inline void QOpenGLFunctions_1_4::glRectiv(const GLint *v1, const GLint *v2)
-{
- d_1_0_Deprecated->f.Rectiv(v1, v2);
-}
-
-inline void QOpenGLFunctions_1_4::glRecti(GLint x1, GLint y1, GLint x2, GLint y2)
-{
- d_1_0_Deprecated->f.Recti(x1, y1, x2, y2);
-}
-
-inline void QOpenGLFunctions_1_4::glRectfv(const GLfloat *v1, const GLfloat *v2)
-{
- d_1_0_Deprecated->f.Rectfv(v1, v2);
-}
-
-inline void QOpenGLFunctions_1_4::glRectf(GLfloat x1, GLfloat y1, GLfloat x2, GLfloat y2)
-{
- d_1_0_Deprecated->f.Rectf(x1, y1, x2, y2);
-}
-
-inline void QOpenGLFunctions_1_4::glRectdv(const GLdouble *v1, const GLdouble *v2)
-{
- d_1_0_Deprecated->f.Rectdv(v1, v2);
-}
-
-inline void QOpenGLFunctions_1_4::glRectd(GLdouble x1, GLdouble y1, GLdouble x2, GLdouble y2)
-{
- d_1_0_Deprecated->f.Rectd(x1, y1, x2, y2);
-}
-
-inline void QOpenGLFunctions_1_4::glRasterPos4sv(const GLshort *v)
-{
- d_1_0_Deprecated->f.RasterPos4sv(v);
-}
-
-inline void QOpenGLFunctions_1_4::glRasterPos4s(GLshort x, GLshort y, GLshort z, GLshort w)
-{
- d_1_0_Deprecated->f.RasterPos4s(x, y, z, w);
-}
-
-inline void QOpenGLFunctions_1_4::glRasterPos4iv(const GLint *v)
-{
- d_1_0_Deprecated->f.RasterPos4iv(v);
-}
-
-inline void QOpenGLFunctions_1_4::glRasterPos4i(GLint x, GLint y, GLint z, GLint w)
-{
- d_1_0_Deprecated->f.RasterPos4i(x, y, z, w);
-}
-
-inline void QOpenGLFunctions_1_4::glRasterPos4fv(const GLfloat *v)
-{
- d_1_0_Deprecated->f.RasterPos4fv(v);
-}
-
-inline void QOpenGLFunctions_1_4::glRasterPos4f(GLfloat x, GLfloat y, GLfloat z, GLfloat w)
-{
- d_1_0_Deprecated->f.RasterPos4f(x, y, z, w);
-}
-
-inline void QOpenGLFunctions_1_4::glRasterPos4dv(const GLdouble *v)
-{
- d_1_0_Deprecated->f.RasterPos4dv(v);
-}
-
-inline void QOpenGLFunctions_1_4::glRasterPos4d(GLdouble x, GLdouble y, GLdouble z, GLdouble w)
-{
- d_1_0_Deprecated->f.RasterPos4d(x, y, z, w);
-}
-
-inline void QOpenGLFunctions_1_4::glRasterPos3sv(const GLshort *v)
-{
- d_1_0_Deprecated->f.RasterPos3sv(v);
-}
-
-inline void QOpenGLFunctions_1_4::glRasterPos3s(GLshort x, GLshort y, GLshort z)
-{
- d_1_0_Deprecated->f.RasterPos3s(x, y, z);
-}
-
-inline void QOpenGLFunctions_1_4::glRasterPos3iv(const GLint *v)
-{
- d_1_0_Deprecated->f.RasterPos3iv(v);
-}
-
-inline void QOpenGLFunctions_1_4::glRasterPos3i(GLint x, GLint y, GLint z)
-{
- d_1_0_Deprecated->f.RasterPos3i(x, y, z);
-}
-
-inline void QOpenGLFunctions_1_4::glRasterPos3fv(const GLfloat *v)
-{
- d_1_0_Deprecated->f.RasterPos3fv(v);
-}
-
-inline void QOpenGLFunctions_1_4::glRasterPos3f(GLfloat x, GLfloat y, GLfloat z)
-{
- d_1_0_Deprecated->f.RasterPos3f(x, y, z);
-}
-
-inline void QOpenGLFunctions_1_4::glRasterPos3dv(const GLdouble *v)
-{
- d_1_0_Deprecated->f.RasterPos3dv(v);
-}
-
-inline void QOpenGLFunctions_1_4::glRasterPos3d(GLdouble x, GLdouble y, GLdouble z)
-{
- d_1_0_Deprecated->f.RasterPos3d(x, y, z);
-}
-
-inline void QOpenGLFunctions_1_4::glRasterPos2sv(const GLshort *v)
-{
- d_1_0_Deprecated->f.RasterPos2sv(v);
-}
-
-inline void QOpenGLFunctions_1_4::glRasterPos2s(GLshort x, GLshort y)
-{
- d_1_0_Deprecated->f.RasterPos2s(x, y);
-}
-
-inline void QOpenGLFunctions_1_4::glRasterPos2iv(const GLint *v)
-{
- d_1_0_Deprecated->f.RasterPos2iv(v);
-}
-
-inline void QOpenGLFunctions_1_4::glRasterPos2i(GLint x, GLint y)
-{
- d_1_0_Deprecated->f.RasterPos2i(x, y);
-}
-
-inline void QOpenGLFunctions_1_4::glRasterPos2fv(const GLfloat *v)
-{
- d_1_0_Deprecated->f.RasterPos2fv(v);
-}
-
-inline void QOpenGLFunctions_1_4::glRasterPos2f(GLfloat x, GLfloat y)
-{
- d_1_0_Deprecated->f.RasterPos2f(x, y);
-}
-
-inline void QOpenGLFunctions_1_4::glRasterPos2dv(const GLdouble *v)
-{
- d_1_0_Deprecated->f.RasterPos2dv(v);
-}
-
-inline void QOpenGLFunctions_1_4::glRasterPos2d(GLdouble x, GLdouble y)
-{
- d_1_0_Deprecated->f.RasterPos2d(x, y);
-}
-
-inline void QOpenGLFunctions_1_4::glNormal3sv(const GLshort *v)
-{
- d_1_0_Deprecated->f.Normal3sv(v);
-}
-
-inline void QOpenGLFunctions_1_4::glNormal3s(GLshort nx, GLshort ny, GLshort nz)
-{
- d_1_0_Deprecated->f.Normal3s(nx, ny, nz);
-}
-
-inline void QOpenGLFunctions_1_4::glNormal3iv(const GLint *v)
-{
- d_1_0_Deprecated->f.Normal3iv(v);
-}
-
-inline void QOpenGLFunctions_1_4::glNormal3i(GLint nx, GLint ny, GLint nz)
-{
- d_1_0_Deprecated->f.Normal3i(nx, ny, nz);
-}
-
-inline void QOpenGLFunctions_1_4::glNormal3fv(const GLfloat *v)
-{
- d_1_0_Deprecated->f.Normal3fv(v);
-}
-
-inline void QOpenGLFunctions_1_4::glNormal3f(GLfloat nx, GLfloat ny, GLfloat nz)
-{
- d_1_0_Deprecated->f.Normal3f(nx, ny, nz);
-}
-
-inline void QOpenGLFunctions_1_4::glNormal3dv(const GLdouble *v)
-{
- d_1_0_Deprecated->f.Normal3dv(v);
-}
-
-inline void QOpenGLFunctions_1_4::glNormal3d(GLdouble nx, GLdouble ny, GLdouble nz)
-{
- d_1_0_Deprecated->f.Normal3d(nx, ny, nz);
-}
-
-inline void QOpenGLFunctions_1_4::glNormal3bv(const GLbyte *v)
-{
- d_1_0_Deprecated->f.Normal3bv(v);
-}
-
-inline void QOpenGLFunctions_1_4::glNormal3b(GLbyte nx, GLbyte ny, GLbyte nz)
-{
- d_1_0_Deprecated->f.Normal3b(nx, ny, nz);
-}
-
-inline void QOpenGLFunctions_1_4::glIndexsv(const GLshort *c)
-{
- d_1_0_Deprecated->f.Indexsv(c);
-}
-
-inline void QOpenGLFunctions_1_4::glIndexs(GLshort c)
-{
- d_1_0_Deprecated->f.Indexs(c);
-}
-
-inline void QOpenGLFunctions_1_4::glIndexiv(const GLint *c)
-{
- d_1_0_Deprecated->f.Indexiv(c);
-}
-
-inline void QOpenGLFunctions_1_4::glIndexi(GLint c)
-{
- d_1_0_Deprecated->f.Indexi(c);
-}
-
-inline void QOpenGLFunctions_1_4::glIndexfv(const GLfloat *c)
-{
- d_1_0_Deprecated->f.Indexfv(c);
-}
-
-inline void QOpenGLFunctions_1_4::glIndexf(GLfloat c)
-{
- d_1_0_Deprecated->f.Indexf(c);
-}
-
-inline void QOpenGLFunctions_1_4::glIndexdv(const GLdouble *c)
-{
- d_1_0_Deprecated->f.Indexdv(c);
-}
-
-inline void QOpenGLFunctions_1_4::glIndexd(GLdouble c)
-{
- d_1_0_Deprecated->f.Indexd(c);
-}
-
-inline void QOpenGLFunctions_1_4::glEnd()
-{
- d_1_0_Deprecated->f.End();
-}
-
-inline void QOpenGLFunctions_1_4::glEdgeFlagv(const GLboolean *flag)
-{
- d_1_0_Deprecated->f.EdgeFlagv(flag);
-}
-
-inline void QOpenGLFunctions_1_4::glEdgeFlag(GLboolean flag)
-{
- d_1_0_Deprecated->f.EdgeFlag(flag);
-}
-
-inline void QOpenGLFunctions_1_4::glColor4usv(const GLushort *v)
-{
- d_1_0_Deprecated->f.Color4usv(v);
-}
-
-inline void QOpenGLFunctions_1_4::glColor4us(GLushort red, GLushort green, GLushort blue, GLushort alpha)
-{
- d_1_0_Deprecated->f.Color4us(red, green, blue, alpha);
-}
-
-inline void QOpenGLFunctions_1_4::glColor4uiv(const GLuint *v)
-{
- d_1_0_Deprecated->f.Color4uiv(v);
-}
-
-inline void QOpenGLFunctions_1_4::glColor4ui(GLuint red, GLuint green, GLuint blue, GLuint alpha)
-{
- d_1_0_Deprecated->f.Color4ui(red, green, blue, alpha);
-}
-
-inline void QOpenGLFunctions_1_4::glColor4ubv(const GLubyte *v)
-{
- d_1_0_Deprecated->f.Color4ubv(v);
-}
-
-inline void QOpenGLFunctions_1_4::glColor4ub(GLubyte red, GLubyte green, GLubyte blue, GLubyte alpha)
-{
- d_1_0_Deprecated->f.Color4ub(red, green, blue, alpha);
-}
-
-inline void QOpenGLFunctions_1_4::glColor4sv(const GLshort *v)
-{
- d_1_0_Deprecated->f.Color4sv(v);
-}
-
-inline void QOpenGLFunctions_1_4::glColor4s(GLshort red, GLshort green, GLshort blue, GLshort alpha)
-{
- d_1_0_Deprecated->f.Color4s(red, green, blue, alpha);
-}
-
-inline void QOpenGLFunctions_1_4::glColor4iv(const GLint *v)
-{
- d_1_0_Deprecated->f.Color4iv(v);
-}
-
-inline void QOpenGLFunctions_1_4::glColor4i(GLint red, GLint green, GLint blue, GLint alpha)
-{
- d_1_0_Deprecated->f.Color4i(red, green, blue, alpha);
-}
-
-inline void QOpenGLFunctions_1_4::glColor4fv(const GLfloat *v)
-{
- d_1_0_Deprecated->f.Color4fv(v);
-}
-
-inline void QOpenGLFunctions_1_4::glColor4f(GLfloat red, GLfloat green, GLfloat blue, GLfloat alpha)
-{
- d_1_0_Deprecated->f.Color4f(red, green, blue, alpha);
-}
-
-inline void QOpenGLFunctions_1_4::glColor4dv(const GLdouble *v)
-{
- d_1_0_Deprecated->f.Color4dv(v);
-}
-
-inline void QOpenGLFunctions_1_4::glColor4d(GLdouble red, GLdouble green, GLdouble blue, GLdouble alpha)
-{
- d_1_0_Deprecated->f.Color4d(red, green, blue, alpha);
-}
-
-inline void QOpenGLFunctions_1_4::glColor4bv(const GLbyte *v)
-{
- d_1_0_Deprecated->f.Color4bv(v);
-}
-
-inline void QOpenGLFunctions_1_4::glColor4b(GLbyte red, GLbyte green, GLbyte blue, GLbyte alpha)
-{
- d_1_0_Deprecated->f.Color4b(red, green, blue, alpha);
-}
-
-inline void QOpenGLFunctions_1_4::glColor3usv(const GLushort *v)
-{
- d_1_0_Deprecated->f.Color3usv(v);
-}
-
-inline void QOpenGLFunctions_1_4::glColor3us(GLushort red, GLushort green, GLushort blue)
-{
- d_1_0_Deprecated->f.Color3us(red, green, blue);
-}
-
-inline void QOpenGLFunctions_1_4::glColor3uiv(const GLuint *v)
-{
- d_1_0_Deprecated->f.Color3uiv(v);
-}
-
-inline void QOpenGLFunctions_1_4::glColor3ui(GLuint red, GLuint green, GLuint blue)
-{
- d_1_0_Deprecated->f.Color3ui(red, green, blue);
-}
-
-inline void QOpenGLFunctions_1_4::glColor3ubv(const GLubyte *v)
-{
- d_1_0_Deprecated->f.Color3ubv(v);
-}
-
-inline void QOpenGLFunctions_1_4::glColor3ub(GLubyte red, GLubyte green, GLubyte blue)
-{
- d_1_0_Deprecated->f.Color3ub(red, green, blue);
-}
-
-inline void QOpenGLFunctions_1_4::glColor3sv(const GLshort *v)
-{
- d_1_0_Deprecated->f.Color3sv(v);
-}
-
-inline void QOpenGLFunctions_1_4::glColor3s(GLshort red, GLshort green, GLshort blue)
-{
- d_1_0_Deprecated->f.Color3s(red, green, blue);
-}
-
-inline void QOpenGLFunctions_1_4::glColor3iv(const GLint *v)
-{
- d_1_0_Deprecated->f.Color3iv(v);
-}
-
-inline void QOpenGLFunctions_1_4::glColor3i(GLint red, GLint green, GLint blue)
-{
- d_1_0_Deprecated->f.Color3i(red, green, blue);
-}
-
-inline void QOpenGLFunctions_1_4::glColor3fv(const GLfloat *v)
-{
- d_1_0_Deprecated->f.Color3fv(v);
-}
-
-inline void QOpenGLFunctions_1_4::glColor3f(GLfloat red, GLfloat green, GLfloat blue)
-{
- d_1_0_Deprecated->f.Color3f(red, green, blue);
-}
-
-inline void QOpenGLFunctions_1_4::glColor3dv(const GLdouble *v)
-{
- d_1_0_Deprecated->f.Color3dv(v);
-}
-
-inline void QOpenGLFunctions_1_4::glColor3d(GLdouble red, GLdouble green, GLdouble blue)
-{
- d_1_0_Deprecated->f.Color3d(red, green, blue);
-}
-
-inline void QOpenGLFunctions_1_4::glColor3bv(const GLbyte *v)
-{
- d_1_0_Deprecated->f.Color3bv(v);
-}
-
-inline void QOpenGLFunctions_1_4::glColor3b(GLbyte red, GLbyte green, GLbyte blue)
-{
- d_1_0_Deprecated->f.Color3b(red, green, blue);
-}
-
-inline void QOpenGLFunctions_1_4::glBitmap(GLsizei width, GLsizei height, GLfloat xorig, GLfloat yorig, GLfloat xmove, GLfloat ymove, const GLubyte *bitmap)
-{
- d_1_0_Deprecated->f.Bitmap(width, height, xorig, yorig, xmove, ymove, bitmap);
-}
-
-inline void QOpenGLFunctions_1_4::glBegin(GLenum mode)
-{
- d_1_0_Deprecated->f.Begin(mode);
-}
-
-inline void QOpenGLFunctions_1_4::glListBase(GLuint base)
-{
- d_1_0_Deprecated->f.ListBase(base);
-}
-
-inline GLuint QOpenGLFunctions_1_4::glGenLists(GLsizei range)
-{
- return d_1_0_Deprecated->f.GenLists(range);
-}
-
-inline void QOpenGLFunctions_1_4::glDeleteLists(GLuint list, GLsizei range)
-{
- d_1_0_Deprecated->f.DeleteLists(list, range);
-}
-
-inline void QOpenGLFunctions_1_4::glCallLists(GLsizei n, GLenum type, const GLvoid *lists)
-{
- d_1_0_Deprecated->f.CallLists(n, type, lists);
-}
-
-inline void QOpenGLFunctions_1_4::glCallList(GLuint list)
-{
- d_1_0_Deprecated->f.CallList(list);
-}
-
-inline void QOpenGLFunctions_1_4::glEndList()
-{
- d_1_0_Deprecated->f.EndList();
-}
-
-inline void QOpenGLFunctions_1_4::glNewList(GLuint list, GLenum mode)
-{
- d_1_0_Deprecated->f.NewList(list, mode);
-}
-
-
-// OpenGL 1.1 deprecated functions
-inline void QOpenGLFunctions_1_4::glPushClientAttrib(GLbitfield mask)
-{
- d_1_1_Deprecated->f.PushClientAttrib(mask);
-}
-
-inline void QOpenGLFunctions_1_4::glPopClientAttrib()
-{
- d_1_1_Deprecated->f.PopClientAttrib();
-}
-
-inline void QOpenGLFunctions_1_4::glPrioritizeTextures(GLsizei n, const GLuint *textures, const GLfloat *priorities)
-{
- d_1_1_Deprecated->f.PrioritizeTextures(n, textures, priorities);
-}
-
-inline GLboolean QOpenGLFunctions_1_4::glAreTexturesResident(GLsizei n, const GLuint *textures, GLboolean *residences)
-{
- return d_1_1_Deprecated->f.AreTexturesResident(n, textures, residences);
-}
-
-inline void QOpenGLFunctions_1_4::glVertexPointer(GLint size, GLenum type, GLsizei stride, const GLvoid *pointer)
-{
- d_1_1_Deprecated->f.VertexPointer(size, type, stride, pointer);
-}
-
-inline void QOpenGLFunctions_1_4::glTexCoordPointer(GLint size, GLenum type, GLsizei stride, const GLvoid *pointer)
-{
- d_1_1_Deprecated->f.TexCoordPointer(size, type, stride, pointer);
-}
-
-inline void QOpenGLFunctions_1_4::glNormalPointer(GLenum type, GLsizei stride, const GLvoid *pointer)
-{
- d_1_1_Deprecated->f.NormalPointer(type, stride, pointer);
-}
-
-inline void QOpenGLFunctions_1_4::glInterleavedArrays(GLenum format, GLsizei stride, const GLvoid *pointer)
-{
- d_1_1_Deprecated->f.InterleavedArrays(format, stride, pointer);
-}
-
-inline void QOpenGLFunctions_1_4::glIndexPointer(GLenum type, GLsizei stride, const GLvoid *pointer)
-{
- d_1_1_Deprecated->f.IndexPointer(type, stride, pointer);
-}
-
-inline void QOpenGLFunctions_1_4::glEnableClientState(GLenum array)
-{
- d_1_1_Deprecated->f.EnableClientState(array);
-}
-
-inline void QOpenGLFunctions_1_4::glEdgeFlagPointer(GLsizei stride, const GLvoid *pointer)
-{
- d_1_1_Deprecated->f.EdgeFlagPointer(stride, pointer);
-}
-
-inline void QOpenGLFunctions_1_4::glDisableClientState(GLenum array)
-{
- d_1_1_Deprecated->f.DisableClientState(array);
-}
-
-inline void QOpenGLFunctions_1_4::glColorPointer(GLint size, GLenum type, GLsizei stride, const GLvoid *pointer)
-{
- d_1_1_Deprecated->f.ColorPointer(size, type, stride, pointer);
-}
-
-inline void QOpenGLFunctions_1_4::glArrayElement(GLint i)
-{
- d_1_1_Deprecated->f.ArrayElement(i);
-}
-
-
-// OpenGL 1.2 deprecated functions
-inline void QOpenGLFunctions_1_4::glResetMinmax(GLenum target)
-{
- d_1_2_Deprecated->f.ResetMinmax(target);
-}
-
-inline void QOpenGLFunctions_1_4::glResetHistogram(GLenum target)
-{
- d_1_2_Deprecated->f.ResetHistogram(target);
-}
-
-inline void QOpenGLFunctions_1_4::glMinmax(GLenum target, GLenum internalformat, GLboolean sink)
-{
- d_1_2_Deprecated->f.Minmax(target, internalformat, sink);
-}
-
-inline void QOpenGLFunctions_1_4::glHistogram(GLenum target, GLsizei width, GLenum internalformat, GLboolean sink)
-{
- d_1_2_Deprecated->f.Histogram(target, width, internalformat, sink);
-}
-
-inline void QOpenGLFunctions_1_4::glGetMinmaxParameteriv(GLenum target, GLenum pname, GLint *params)
-{
- d_1_2_Deprecated->f.GetMinmaxParameteriv(target, pname, params);
-}
-
-inline void QOpenGLFunctions_1_4::glGetMinmaxParameterfv(GLenum target, GLenum pname, GLfloat *params)
-{
- d_1_2_Deprecated->f.GetMinmaxParameterfv(target, pname, params);
-}
-
-inline void QOpenGLFunctions_1_4::glGetMinmax(GLenum target, GLboolean reset, GLenum format, GLenum type, GLvoid *values)
-{
- d_1_2_Deprecated->f.GetMinmax(target, reset, format, type, values);
-}
-
-inline void QOpenGLFunctions_1_4::glGetHistogramParameteriv(GLenum target, GLenum pname, GLint *params)
-{
- d_1_2_Deprecated->f.GetHistogramParameteriv(target, pname, params);
-}
-
-inline void QOpenGLFunctions_1_4::glGetHistogramParameterfv(GLenum target, GLenum pname, GLfloat *params)
-{
- d_1_2_Deprecated->f.GetHistogramParameterfv(target, pname, params);
-}
-
-inline void QOpenGLFunctions_1_4::glGetHistogram(GLenum target, GLboolean reset, GLenum format, GLenum type, GLvoid *values)
-{
- d_1_2_Deprecated->f.GetHistogram(target, reset, format, type, values);
-}
-
-inline void QOpenGLFunctions_1_4::glSeparableFilter2D(GLenum target, GLenum internalformat, GLsizei width, GLsizei height, GLenum format, GLenum type, const GLvoid *row, const GLvoid *column)
-{
- d_1_2_Deprecated->f.SeparableFilter2D(target, internalformat, width, height, format, type, row, column);
-}
-
-inline void QOpenGLFunctions_1_4::glGetSeparableFilter(GLenum target, GLenum format, GLenum type, GLvoid *row, GLvoid *column, GLvoid *span)
-{
- d_1_2_Deprecated->f.GetSeparableFilter(target, format, type, row, column, span);
-}
-
-inline void QOpenGLFunctions_1_4::glGetConvolutionParameteriv(GLenum target, GLenum pname, GLint *params)
-{
- d_1_2_Deprecated->f.GetConvolutionParameteriv(target, pname, params);
-}
-
-inline void QOpenGLFunctions_1_4::glGetConvolutionParameterfv(GLenum target, GLenum pname, GLfloat *params)
-{
- d_1_2_Deprecated->f.GetConvolutionParameterfv(target, pname, params);
-}
-
-inline void QOpenGLFunctions_1_4::glGetConvolutionFilter(GLenum target, GLenum format, GLenum type, GLvoid *image)
-{
- d_1_2_Deprecated->f.GetConvolutionFilter(target, format, type, image);
-}
-
-inline void QOpenGLFunctions_1_4::glCopyConvolutionFilter2D(GLenum target, GLenum internalformat, GLint x, GLint y, GLsizei width, GLsizei height)
-{
- d_1_2_Deprecated->f.CopyConvolutionFilter2D(target, internalformat, x, y, width, height);
-}
-
-inline void QOpenGLFunctions_1_4::glCopyConvolutionFilter1D(GLenum target, GLenum internalformat, GLint x, GLint y, GLsizei width)
-{
- d_1_2_Deprecated->f.CopyConvolutionFilter1D(target, internalformat, x, y, width);
-}
-
-inline void QOpenGLFunctions_1_4::glConvolutionParameteriv(GLenum target, GLenum pname, const GLint *params)
-{
- d_1_2_Deprecated->f.ConvolutionParameteriv(target, pname, params);
-}
-
-inline void QOpenGLFunctions_1_4::glConvolutionParameteri(GLenum target, GLenum pname, GLint params)
-{
- d_1_2_Deprecated->f.ConvolutionParameteri(target, pname, params);
-}
-
-inline void QOpenGLFunctions_1_4::glConvolutionParameterfv(GLenum target, GLenum pname, const GLfloat *params)
-{
- d_1_2_Deprecated->f.ConvolutionParameterfv(target, pname, params);
-}
-
-inline void QOpenGLFunctions_1_4::glConvolutionParameterf(GLenum target, GLenum pname, GLfloat params)
-{
- d_1_2_Deprecated->f.ConvolutionParameterf(target, pname, params);
-}
-
-inline void QOpenGLFunctions_1_4::glConvolutionFilter2D(GLenum target, GLenum internalformat, GLsizei width, GLsizei height, GLenum format, GLenum type, const GLvoid *image)
-{
- d_1_2_Deprecated->f.ConvolutionFilter2D(target, internalformat, width, height, format, type, image);
-}
-
-inline void QOpenGLFunctions_1_4::glConvolutionFilter1D(GLenum target, GLenum internalformat, GLsizei width, GLenum format, GLenum type, const GLvoid *image)
-{
- d_1_2_Deprecated->f.ConvolutionFilter1D(target, internalformat, width, format, type, image);
-}
-
-inline void QOpenGLFunctions_1_4::glCopyColorSubTable(GLenum target, GLsizei start, GLint x, GLint y, GLsizei width)
-{
- d_1_2_Deprecated->f.CopyColorSubTable(target, start, x, y, width);
-}
-
-inline void QOpenGLFunctions_1_4::glColorSubTable(GLenum target, GLsizei start, GLsizei count, GLenum format, GLenum type, const GLvoid *data)
-{
- d_1_2_Deprecated->f.ColorSubTable(target, start, count, format, type, data);
-}
-
-inline void QOpenGLFunctions_1_4::glGetColorTableParameteriv(GLenum target, GLenum pname, GLint *params)
-{
- d_1_2_Deprecated->f.GetColorTableParameteriv(target, pname, params);
-}
-
-inline void QOpenGLFunctions_1_4::glGetColorTableParameterfv(GLenum target, GLenum pname, GLfloat *params)
-{
- d_1_2_Deprecated->f.GetColorTableParameterfv(target, pname, params);
-}
-
-inline void QOpenGLFunctions_1_4::glGetColorTable(GLenum target, GLenum format, GLenum type, GLvoid *table)
-{
- d_1_2_Deprecated->f.GetColorTable(target, format, type, table);
-}
-
-inline void QOpenGLFunctions_1_4::glCopyColorTable(GLenum target, GLenum internalformat, GLint x, GLint y, GLsizei width)
-{
- d_1_2_Deprecated->f.CopyColorTable(target, internalformat, x, y, width);
-}
-
-inline void QOpenGLFunctions_1_4::glColorTableParameteriv(GLenum target, GLenum pname, const GLint *params)
-{
- d_1_2_Deprecated->f.ColorTableParameteriv(target, pname, params);
-}
-
-inline void QOpenGLFunctions_1_4::glColorTableParameterfv(GLenum target, GLenum pname, const GLfloat *params)
-{
- d_1_2_Deprecated->f.ColorTableParameterfv(target, pname, params);
-}
-
-inline void QOpenGLFunctions_1_4::glColorTable(GLenum target, GLenum internalformat, GLsizei width, GLenum format, GLenum type, const GLvoid *table)
-{
- d_1_2_Deprecated->f.ColorTable(target, internalformat, width, format, type, table);
-}
-
-
-// OpenGL 1.3 deprecated functions
-inline void QOpenGLFunctions_1_4::glMultTransposeMatrixd(const GLdouble *m)
-{
- d_1_3_Deprecated->f.MultTransposeMatrixd(m);
-}
-
-inline void QOpenGLFunctions_1_4::glMultTransposeMatrixf(const GLfloat *m)
-{
- d_1_3_Deprecated->f.MultTransposeMatrixf(m);
-}
-
-inline void QOpenGLFunctions_1_4::glLoadTransposeMatrixd(const GLdouble *m)
-{
- d_1_3_Deprecated->f.LoadTransposeMatrixd(m);
-}
-
-inline void QOpenGLFunctions_1_4::glLoadTransposeMatrixf(const GLfloat *m)
-{
- d_1_3_Deprecated->f.LoadTransposeMatrixf(m);
-}
-
-inline void QOpenGLFunctions_1_4::glMultiTexCoord4sv(GLenum target, const GLshort *v)
-{
- d_1_3_Deprecated->f.MultiTexCoord4sv(target, v);
-}
-
-inline void QOpenGLFunctions_1_4::glMultiTexCoord4s(GLenum target, GLshort s, GLshort t, GLshort r, GLshort q)
-{
- d_1_3_Deprecated->f.MultiTexCoord4s(target, s, t, r, q);
-}
-
-inline void QOpenGLFunctions_1_4::glMultiTexCoord4iv(GLenum target, const GLint *v)
-{
- d_1_3_Deprecated->f.MultiTexCoord4iv(target, v);
-}
-
-inline void QOpenGLFunctions_1_4::glMultiTexCoord4i(GLenum target, GLint s, GLint t, GLint r, GLint q)
-{
- d_1_3_Deprecated->f.MultiTexCoord4i(target, s, t, r, q);
-}
-
-inline void QOpenGLFunctions_1_4::glMultiTexCoord4fv(GLenum target, const GLfloat *v)
-{
- d_1_3_Deprecated->f.MultiTexCoord4fv(target, v);
-}
-
-inline void QOpenGLFunctions_1_4::glMultiTexCoord4f(GLenum target, GLfloat s, GLfloat t, GLfloat r, GLfloat q)
-{
- d_1_3_Deprecated->f.MultiTexCoord4f(target, s, t, r, q);
-}
-
-inline void QOpenGLFunctions_1_4::glMultiTexCoord4dv(GLenum target, const GLdouble *v)
-{
- d_1_3_Deprecated->f.MultiTexCoord4dv(target, v);
-}
-
-inline void QOpenGLFunctions_1_4::glMultiTexCoord4d(GLenum target, GLdouble s, GLdouble t, GLdouble r, GLdouble q)
-{
- d_1_3_Deprecated->f.MultiTexCoord4d(target, s, t, r, q);
-}
-
-inline void QOpenGLFunctions_1_4::glMultiTexCoord3sv(GLenum target, const GLshort *v)
-{
- d_1_3_Deprecated->f.MultiTexCoord3sv(target, v);
-}
-
-inline void QOpenGLFunctions_1_4::glMultiTexCoord3s(GLenum target, GLshort s, GLshort t, GLshort r)
-{
- d_1_3_Deprecated->f.MultiTexCoord3s(target, s, t, r);
-}
-
-inline void QOpenGLFunctions_1_4::glMultiTexCoord3iv(GLenum target, const GLint *v)
-{
- d_1_3_Deprecated->f.MultiTexCoord3iv(target, v);
-}
-
-inline void QOpenGLFunctions_1_4::glMultiTexCoord3i(GLenum target, GLint s, GLint t, GLint r)
-{
- d_1_3_Deprecated->f.MultiTexCoord3i(target, s, t, r);
-}
-
-inline void QOpenGLFunctions_1_4::glMultiTexCoord3fv(GLenum target, const GLfloat *v)
-{
- d_1_3_Deprecated->f.MultiTexCoord3fv(target, v);
-}
-
-inline void QOpenGLFunctions_1_4::glMultiTexCoord3f(GLenum target, GLfloat s, GLfloat t, GLfloat r)
-{
- d_1_3_Deprecated->f.MultiTexCoord3f(target, s, t, r);
-}
-
-inline void QOpenGLFunctions_1_4::glMultiTexCoord3dv(GLenum target, const GLdouble *v)
-{
- d_1_3_Deprecated->f.MultiTexCoord3dv(target, v);
-}
-
-inline void QOpenGLFunctions_1_4::glMultiTexCoord3d(GLenum target, GLdouble s, GLdouble t, GLdouble r)
-{
- d_1_3_Deprecated->f.MultiTexCoord3d(target, s, t, r);
-}
-
-inline void QOpenGLFunctions_1_4::glMultiTexCoord2sv(GLenum target, const GLshort *v)
-{
- d_1_3_Deprecated->f.MultiTexCoord2sv(target, v);
-}
-
-inline void QOpenGLFunctions_1_4::glMultiTexCoord2s(GLenum target, GLshort s, GLshort t)
-{
- d_1_3_Deprecated->f.MultiTexCoord2s(target, s, t);
-}
-
-inline void QOpenGLFunctions_1_4::glMultiTexCoord2iv(GLenum target, const GLint *v)
-{
- d_1_3_Deprecated->f.MultiTexCoord2iv(target, v);
-}
-
-inline void QOpenGLFunctions_1_4::glMultiTexCoord2i(GLenum target, GLint s, GLint t)
-{
- d_1_3_Deprecated->f.MultiTexCoord2i(target, s, t);
-}
-
-inline void QOpenGLFunctions_1_4::glMultiTexCoord2fv(GLenum target, const GLfloat *v)
-{
- d_1_3_Deprecated->f.MultiTexCoord2fv(target, v);
-}
-
-inline void QOpenGLFunctions_1_4::glMultiTexCoord2f(GLenum target, GLfloat s, GLfloat t)
-{
- d_1_3_Deprecated->f.MultiTexCoord2f(target, s, t);
-}
-
-inline void QOpenGLFunctions_1_4::glMultiTexCoord2dv(GLenum target, const GLdouble *v)
-{
- d_1_3_Deprecated->f.MultiTexCoord2dv(target, v);
-}
-
-inline void QOpenGLFunctions_1_4::glMultiTexCoord2d(GLenum target, GLdouble s, GLdouble t)
-{
- d_1_3_Deprecated->f.MultiTexCoord2d(target, s, t);
-}
-
-inline void QOpenGLFunctions_1_4::glMultiTexCoord1sv(GLenum target, const GLshort *v)
-{
- d_1_3_Deprecated->f.MultiTexCoord1sv(target, v);
-}
-
-inline void QOpenGLFunctions_1_4::glMultiTexCoord1s(GLenum target, GLshort s)
-{
- d_1_3_Deprecated->f.MultiTexCoord1s(target, s);
-}
-
-inline void QOpenGLFunctions_1_4::glMultiTexCoord1iv(GLenum target, const GLint *v)
-{
- d_1_3_Deprecated->f.MultiTexCoord1iv(target, v);
-}
-
-inline void QOpenGLFunctions_1_4::glMultiTexCoord1i(GLenum target, GLint s)
-{
- d_1_3_Deprecated->f.MultiTexCoord1i(target, s);
-}
-
-inline void QOpenGLFunctions_1_4::glMultiTexCoord1fv(GLenum target, const GLfloat *v)
-{
- d_1_3_Deprecated->f.MultiTexCoord1fv(target, v);
-}
-
-inline void QOpenGLFunctions_1_4::glMultiTexCoord1f(GLenum target, GLfloat s)
-{
- d_1_3_Deprecated->f.MultiTexCoord1f(target, s);
-}
-
-inline void QOpenGLFunctions_1_4::glMultiTexCoord1dv(GLenum target, const GLdouble *v)
-{
- d_1_3_Deprecated->f.MultiTexCoord1dv(target, v);
-}
-
-inline void QOpenGLFunctions_1_4::glMultiTexCoord1d(GLenum target, GLdouble s)
-{
- d_1_3_Deprecated->f.MultiTexCoord1d(target, s);
-}
-
-inline void QOpenGLFunctions_1_4::glClientActiveTexture(GLenum texture)
-{
- d_1_3_Deprecated->f.ClientActiveTexture(texture);
-}
-
-
-// OpenGL 1.4 deprecated functions
-inline void QOpenGLFunctions_1_4::glWindowPos3sv(const GLshort *v)
-{
- d_1_4_Deprecated->f.WindowPos3sv(v);
-}
-
-inline void QOpenGLFunctions_1_4::glWindowPos3s(GLshort x, GLshort y, GLshort z)
-{
- d_1_4_Deprecated->f.WindowPos3s(x, y, z);
-}
-
-inline void QOpenGLFunctions_1_4::glWindowPos3iv(const GLint *v)
-{
- d_1_4_Deprecated->f.WindowPos3iv(v);
-}
-
-inline void QOpenGLFunctions_1_4::glWindowPos3i(GLint x, GLint y, GLint z)
-{
- d_1_4_Deprecated->f.WindowPos3i(x, y, z);
-}
-
-inline void QOpenGLFunctions_1_4::glWindowPos3fv(const GLfloat *v)
-{
- d_1_4_Deprecated->f.WindowPos3fv(v);
-}
-
-inline void QOpenGLFunctions_1_4::glWindowPos3f(GLfloat x, GLfloat y, GLfloat z)
-{
- d_1_4_Deprecated->f.WindowPos3f(x, y, z);
-}
-
-inline void QOpenGLFunctions_1_4::glWindowPos3dv(const GLdouble *v)
-{
- d_1_4_Deprecated->f.WindowPos3dv(v);
-}
-
-inline void QOpenGLFunctions_1_4::glWindowPos3d(GLdouble x, GLdouble y, GLdouble z)
-{
- d_1_4_Deprecated->f.WindowPos3d(x, y, z);
-}
-
-inline void QOpenGLFunctions_1_4::glWindowPos2sv(const GLshort *v)
-{
- d_1_4_Deprecated->f.WindowPos2sv(v);
-}
-
-inline void QOpenGLFunctions_1_4::glWindowPos2s(GLshort x, GLshort y)
-{
- d_1_4_Deprecated->f.WindowPos2s(x, y);
-}
-
-inline void QOpenGLFunctions_1_4::glWindowPos2iv(const GLint *v)
-{
- d_1_4_Deprecated->f.WindowPos2iv(v);
-}
-
-inline void QOpenGLFunctions_1_4::glWindowPos2i(GLint x, GLint y)
-{
- d_1_4_Deprecated->f.WindowPos2i(x, y);
-}
-
-inline void QOpenGLFunctions_1_4::glWindowPos2fv(const GLfloat *v)
-{
- d_1_4_Deprecated->f.WindowPos2fv(v);
-}
-
-inline void QOpenGLFunctions_1_4::glWindowPos2f(GLfloat x, GLfloat y)
-{
- d_1_4_Deprecated->f.WindowPos2f(x, y);
-}
-
-inline void QOpenGLFunctions_1_4::glWindowPos2dv(const GLdouble *v)
-{
- d_1_4_Deprecated->f.WindowPos2dv(v);
-}
-
-inline void QOpenGLFunctions_1_4::glWindowPos2d(GLdouble x, GLdouble y)
-{
- d_1_4_Deprecated->f.WindowPos2d(x, y);
-}
-
-inline void QOpenGLFunctions_1_4::glSecondaryColorPointer(GLint size, GLenum type, GLsizei stride, const GLvoid *pointer)
-{
- d_1_4_Deprecated->f.SecondaryColorPointer(size, type, stride, pointer);
-}
-
-inline void QOpenGLFunctions_1_4::glSecondaryColor3usv(const GLushort *v)
-{
- d_1_4_Deprecated->f.SecondaryColor3usv(v);
-}
-
-inline void QOpenGLFunctions_1_4::glSecondaryColor3us(GLushort red, GLushort green, GLushort blue)
-{
- d_1_4_Deprecated->f.SecondaryColor3us(red, green, blue);
-}
-
-inline void QOpenGLFunctions_1_4::glSecondaryColor3uiv(const GLuint *v)
-{
- d_1_4_Deprecated->f.SecondaryColor3uiv(v);
-}
-
-inline void QOpenGLFunctions_1_4::glSecondaryColor3ui(GLuint red, GLuint green, GLuint blue)
-{
- d_1_4_Deprecated->f.SecondaryColor3ui(red, green, blue);
-}
-
-inline void QOpenGLFunctions_1_4::glSecondaryColor3ubv(const GLubyte *v)
-{
- d_1_4_Deprecated->f.SecondaryColor3ubv(v);
-}
-
-inline void QOpenGLFunctions_1_4::glSecondaryColor3ub(GLubyte red, GLubyte green, GLubyte blue)
-{
- d_1_4_Deprecated->f.SecondaryColor3ub(red, green, blue);
-}
-
-inline void QOpenGLFunctions_1_4::glSecondaryColor3sv(const GLshort *v)
-{
- d_1_4_Deprecated->f.SecondaryColor3sv(v);
-}
-
-inline void QOpenGLFunctions_1_4::glSecondaryColor3s(GLshort red, GLshort green, GLshort blue)
-{
- d_1_4_Deprecated->f.SecondaryColor3s(red, green, blue);
-}
-
-inline void QOpenGLFunctions_1_4::glSecondaryColor3iv(const GLint *v)
-{
- d_1_4_Deprecated->f.SecondaryColor3iv(v);
-}
-
-inline void QOpenGLFunctions_1_4::glSecondaryColor3i(GLint red, GLint green, GLint blue)
-{
- d_1_4_Deprecated->f.SecondaryColor3i(red, green, blue);
-}
-
-inline void QOpenGLFunctions_1_4::glSecondaryColor3fv(const GLfloat *v)
-{
- d_1_4_Deprecated->f.SecondaryColor3fv(v);
-}
-
-inline void QOpenGLFunctions_1_4::glSecondaryColor3f(GLfloat red, GLfloat green, GLfloat blue)
-{
- d_1_4_Deprecated->f.SecondaryColor3f(red, green, blue);
-}
-
-inline void QOpenGLFunctions_1_4::glSecondaryColor3dv(const GLdouble *v)
-{
- d_1_4_Deprecated->f.SecondaryColor3dv(v);
-}
-
-inline void QOpenGLFunctions_1_4::glSecondaryColor3d(GLdouble red, GLdouble green, GLdouble blue)
-{
- d_1_4_Deprecated->f.SecondaryColor3d(red, green, blue);
-}
-
-inline void QOpenGLFunctions_1_4::glSecondaryColor3bv(const GLbyte *v)
-{
- d_1_4_Deprecated->f.SecondaryColor3bv(v);
-}
-
-inline void QOpenGLFunctions_1_4::glSecondaryColor3b(GLbyte red, GLbyte green, GLbyte blue)
-{
- d_1_4_Deprecated->f.SecondaryColor3b(red, green, blue);
-}
-
-inline void QOpenGLFunctions_1_4::glFogCoordPointer(GLenum type, GLsizei stride, const GLvoid *pointer)
-{
- d_1_4_Deprecated->f.FogCoordPointer(type, stride, pointer);
-}
-
-inline void QOpenGLFunctions_1_4::glFogCoorddv(const GLdouble *coord)
-{
- d_1_4_Deprecated->f.FogCoorddv(coord);
-}
-
-inline void QOpenGLFunctions_1_4::glFogCoordd(GLdouble coord)
-{
- d_1_4_Deprecated->f.FogCoordd(coord);
-}
-
-inline void QOpenGLFunctions_1_4::glFogCoordfv(const GLfloat *coord)
-{
- d_1_4_Deprecated->f.FogCoordfv(coord);
-}
-
-inline void QOpenGLFunctions_1_4::glFogCoordf(GLfloat coord)
-{
- d_1_4_Deprecated->f.FogCoordf(coord);
-}
-
-
-
-QT_END_NAMESPACE
-
-#endif // QT_NO_OPENGL && !QT_OPENGL_ES_2
-
-#endif
diff --git a/src/gui/opengl/qopenglfunctions_1_5.cpp b/src/gui/opengl/qopenglfunctions_1_5.cpp
deleted file mode 100644
index 3fa7668a36..0000000000
--- a/src/gui/opengl/qopenglfunctions_1_5.cpp
+++ /dev/null
@@ -1,217 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2013 Klaralvdalens Datakonsult AB (KDAB)
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the QtGui module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-**
-** This file was generated by glgen version 0.1
-** Command line was: glgen
-**
-** glgen is Copyright (C) 2013 Klaralvdalens Datakonsult AB (KDAB)
-**
-** This is an auto-generated file.
-** Do not edit! All changes made to it will be lost.
-**
-****************************************************************************/
-
-#include "qopenglfunctions_1_5.h"
-#include "qopenglcontext.h"
-
-QT_BEGIN_NAMESPACE
-
-/*!
- \class QOpenGLFunctions_1_5
- \inmodule QtGui
- \since 5.1
- \wrapper
- \brief The QOpenGLFunctions_1_5 class provides all functions for OpenGL 1.5 specification.
-
- This class is a wrapper for functions from OpenGL 1.5 specification.
- See reference pages on \l {http://www.opengl.org/sdk/docs/}{opengl.org}
- for function documentation.
-
- \sa QAbstractOpenGLFunctions
-*/
-
-QOpenGLFunctions_1_5::QOpenGLFunctions_1_5()
- : QAbstractOpenGLFunctions()
- , d_1_0_Core(nullptr)
- , d_1_1_Core(nullptr)
- , d_1_2_Core(nullptr)
- , d_1_3_Core(nullptr)
- , d_1_4_Core(nullptr)
- , d_1_5_Core(nullptr)
- , d_1_0_Deprecated(nullptr)
- , d_1_1_Deprecated(nullptr)
- , d_1_2_Deprecated(nullptr)
- , d_1_3_Deprecated(nullptr)
- , d_1_4_Deprecated(nullptr)
-{
-}
-
-QOpenGLFunctions_1_5::~QOpenGLFunctions_1_5()
-{
- if (d_1_0_Core) {
- d_1_0_Core->refs.deref();
- Q_ASSERT(d_1_0_Core->refs.loadRelaxed());
- }
- if (d_1_1_Core) {
- d_1_1_Core->refs.deref();
- Q_ASSERT(d_1_1_Core->refs.loadRelaxed());
- }
- if (d_1_2_Core) {
- d_1_2_Core->refs.deref();
- Q_ASSERT(d_1_2_Core->refs.loadRelaxed());
- }
- if (d_1_3_Core) {
- d_1_3_Core->refs.deref();
- Q_ASSERT(d_1_3_Core->refs.loadRelaxed());
- }
- if (d_1_4_Core) {
- d_1_4_Core->refs.deref();
- Q_ASSERT(d_1_4_Core->refs.loadRelaxed());
- }
- if (d_1_5_Core) {
- d_1_5_Core->refs.deref();
- Q_ASSERT(d_1_5_Core->refs.loadRelaxed());
- }
- if (d_1_0_Deprecated) {
- d_1_0_Deprecated->refs.deref();
- Q_ASSERT(d_1_0_Deprecated->refs.loadRelaxed());
- }
- if (d_1_1_Deprecated) {
- d_1_1_Deprecated->refs.deref();
- Q_ASSERT(d_1_1_Deprecated->refs.loadRelaxed());
- }
- if (d_1_2_Deprecated) {
- d_1_2_Deprecated->refs.deref();
- Q_ASSERT(d_1_2_Deprecated->refs.loadRelaxed());
- }
- if (d_1_3_Deprecated) {
- d_1_3_Deprecated->refs.deref();
- Q_ASSERT(d_1_3_Deprecated->refs.loadRelaxed());
- }
- if (d_1_4_Deprecated) {
- d_1_4_Deprecated->refs.deref();
- Q_ASSERT(d_1_4_Deprecated->refs.loadRelaxed());
- }
-}
-
-bool QOpenGLFunctions_1_5::initializeOpenGLFunctions()
-{
- if ( isInitialized() )
- return true;
-
- QOpenGLContext* context = QOpenGLContext::currentContext();
-
- // If owned by a context object make sure it is current.
- // Also check that current context is capable of resolving all needed functions
- if (((owningContext() && owningContext() == context) || !owningContext())
- && QOpenGLFunctions_1_5::isContextCompatible(context))
- {
- // Associate with private implementation, creating if necessary
- // Function pointers in the backends are resolved at creation time
- QOpenGLVersionFunctionsBackend* d = nullptr;
- d = QAbstractOpenGLFunctionsPrivate::functionsBackend(context, QOpenGLFunctions_1_0_CoreBackend::versionStatus());
- d_1_0_Core = static_cast<QOpenGLFunctions_1_0_CoreBackend*>(d);
- d->refs.ref();
-
- d = QAbstractOpenGLFunctionsPrivate::functionsBackend(context, QOpenGLFunctions_1_1_CoreBackend::versionStatus());
- d_1_1_Core = static_cast<QOpenGLFunctions_1_1_CoreBackend*>(d);
- d->refs.ref();
-
- d = QAbstractOpenGLFunctionsPrivate::functionsBackend(context, QOpenGLFunctions_1_2_CoreBackend::versionStatus());
- d_1_2_Core = static_cast<QOpenGLFunctions_1_2_CoreBackend*>(d);
- d->refs.ref();
-
- d = QAbstractOpenGLFunctionsPrivate::functionsBackend(context, QOpenGLFunctions_1_3_CoreBackend::versionStatus());
- d_1_3_Core = static_cast<QOpenGLFunctions_1_3_CoreBackend*>(d);
- d->refs.ref();
-
- d = QAbstractOpenGLFunctionsPrivate::functionsBackend(context, QOpenGLFunctions_1_4_CoreBackend::versionStatus());
- d_1_4_Core = static_cast<QOpenGLFunctions_1_4_CoreBackend*>(d);
- d->refs.ref();
-
- d = QAbstractOpenGLFunctionsPrivate::functionsBackend(context, QOpenGLFunctions_1_5_CoreBackend::versionStatus());
- d_1_5_Core = static_cast<QOpenGLFunctions_1_5_CoreBackend*>(d);
- d->refs.ref();
-
- d = QAbstractOpenGLFunctionsPrivate::functionsBackend(context, QOpenGLFunctions_1_0_DeprecatedBackend::versionStatus());
- d_1_0_Deprecated = static_cast<QOpenGLFunctions_1_0_DeprecatedBackend*>(d);
- d->refs.ref();
-
- d = QAbstractOpenGLFunctionsPrivate::functionsBackend(context, QOpenGLFunctions_1_1_DeprecatedBackend::versionStatus());
- d_1_1_Deprecated = static_cast<QOpenGLFunctions_1_1_DeprecatedBackend*>(d);
- d->refs.ref();
-
- d = QAbstractOpenGLFunctionsPrivate::functionsBackend(context, QOpenGLFunctions_1_2_DeprecatedBackend::versionStatus());
- d_1_2_Deprecated = static_cast<QOpenGLFunctions_1_2_DeprecatedBackend*>(d);
- d->refs.ref();
-
- d = QAbstractOpenGLFunctionsPrivate::functionsBackend(context, QOpenGLFunctions_1_3_DeprecatedBackend::versionStatus());
- d_1_3_Deprecated = static_cast<QOpenGLFunctions_1_3_DeprecatedBackend*>(d);
- d->refs.ref();
-
- d = QAbstractOpenGLFunctionsPrivate::functionsBackend(context, QOpenGLFunctions_1_4_DeprecatedBackend::versionStatus());
- d_1_4_Deprecated = static_cast<QOpenGLFunctions_1_4_DeprecatedBackend*>(d);
- d->refs.ref();
-
- QAbstractOpenGLFunctions::initializeOpenGLFunctions();
- }
- return isInitialized();
-}
-
-bool QOpenGLFunctions_1_5::isContextCompatible(QOpenGLContext *context)
-{
- Q_ASSERT(context);
- QSurfaceFormat f = context->format();
- const QPair<int, int> v = qMakePair(f.majorVersion(), f.minorVersion());
- if (v < qMakePair(1, 5))
- return false;
-
- if (f.profile() == QSurfaceFormat::CoreProfile)
- return false;
-
- return true;
-}
-
-QOpenGLVersionProfile QOpenGLFunctions_1_5::versionProfile()
-{
- QOpenGLVersionProfile v;
- v.setVersion(1, 5);
- return v;
-}
-
-QT_END_NAMESPACE
diff --git a/src/gui/opengl/qopenglfunctions_1_5.h b/src/gui/opengl/qopenglfunctions_1_5.h
deleted file mode 100644
index d2f5311211..0000000000
--- a/src/gui/opengl/qopenglfunctions_1_5.h
+++ /dev/null
@@ -1,3046 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2013 Klaralvdalens Datakonsult AB (KDAB)
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the QtGui module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-**
-** This file was generated by glgen version 0.1
-** Command line was: glgen
-**
-** glgen is Copyright (C) 2013 Klaralvdalens Datakonsult AB (KDAB)
-**
-** This is an auto-generated file.
-** Do not edit! All changes made to it will be lost.
-**
-****************************************************************************/
-
-#ifndef QOPENGLVERSIONFUNCTIONS_1_5_H
-#define QOPENGLVERSIONFUNCTIONS_1_5_H
-
-#include <QtGui/qtguiglobal.h>
-
-#if !defined(QT_NO_OPENGL) && !defined(QT_OPENGL_ES_2)
-
-#include <QtGui/QOpenGLVersionFunctions>
-#include <QtGui/qopenglcontext.h>
-
-QT_BEGIN_NAMESPACE
-
-class Q_GUI_EXPORT QOpenGLFunctions_1_5 : public QAbstractOpenGLFunctions
-{
-public:
- QOpenGLFunctions_1_5();
- ~QOpenGLFunctions_1_5();
-
- bool initializeOpenGLFunctions() override;
-
- // OpenGL 1.0 core functions
- void glViewport(GLint x, GLint y, GLsizei width, GLsizei height);
- void glDepthRange(GLdouble nearVal, GLdouble farVal);
- GLboolean glIsEnabled(GLenum cap);
- void glGetTexLevelParameteriv(GLenum target, GLint level, GLenum pname, GLint *params);
- void glGetTexLevelParameterfv(GLenum target, GLint level, GLenum pname, GLfloat *params);
- void glGetTexParameteriv(GLenum target, GLenum pname, GLint *params);
- void glGetTexParameterfv(GLenum target, GLenum pname, GLfloat *params);
- void glGetTexImage(GLenum target, GLint level, GLenum format, GLenum type, GLvoid *pixels);
- const GLubyte * glGetString(GLenum name);
- void glGetIntegerv(GLenum pname, GLint *params);
- void glGetFloatv(GLenum pname, GLfloat *params);
- GLenum glGetError();
- void glGetDoublev(GLenum pname, GLdouble *params);
- void glGetBooleanv(GLenum pname, GLboolean *params);
- void glReadPixels(GLint x, GLint y, GLsizei width, GLsizei height, GLenum format, GLenum type, GLvoid *pixels);
- void glReadBuffer(GLenum mode);
- void glPixelStorei(GLenum pname, GLint param);
- void glPixelStoref(GLenum pname, GLfloat param);
- void glDepthFunc(GLenum func);
- void glStencilOp(GLenum fail, GLenum zfail, GLenum zpass);
- void glStencilFunc(GLenum func, GLint ref, GLuint mask);
- void glLogicOp(GLenum opcode);
- void glBlendFunc(GLenum sfactor, GLenum dfactor);
- void glFlush();
- void glFinish();
- void glEnable(GLenum cap);
- void glDisable(GLenum cap);
- void glDepthMask(GLboolean flag);
- void glColorMask(GLboolean red, GLboolean green, GLboolean blue, GLboolean alpha);
- void glStencilMask(GLuint mask);
- void glClearDepth(GLdouble depth);
- void glClearStencil(GLint s);
- void glClearColor(GLfloat red, GLfloat green, GLfloat blue, GLfloat alpha);
- void glClear(GLbitfield mask);
- void glDrawBuffer(GLenum mode);
- void glTexImage2D(GLenum target, GLint level, GLint internalformat, GLsizei width, GLsizei height, GLint border, GLenum format, GLenum type, const GLvoid *pixels);
- void glTexImage1D(GLenum target, GLint level, GLint internalformat, GLsizei width, GLint border, GLenum format, GLenum type, const GLvoid *pixels);
- void glTexParameteriv(GLenum target, GLenum pname, const GLint *params);
- void glTexParameteri(GLenum target, GLenum pname, GLint param);
- void glTexParameterfv(GLenum target, GLenum pname, const GLfloat *params);
- void glTexParameterf(GLenum target, GLenum pname, GLfloat param);
- void glScissor(GLint x, GLint y, GLsizei width, GLsizei height);
- void glPolygonMode(GLenum face, GLenum mode);
- void glPointSize(GLfloat size);
- void glLineWidth(GLfloat width);
- void glHint(GLenum target, GLenum mode);
- void glFrontFace(GLenum mode);
- void glCullFace(GLenum mode);
-
- // OpenGL 1.1 core functions
- void glIndexubv(const GLubyte *c);
- void glIndexub(GLubyte c);
- GLboolean glIsTexture(GLuint texture);
- void glGenTextures(GLsizei n, GLuint *textures);
- void glDeleteTextures(GLsizei n, const GLuint *textures);
- void glBindTexture(GLenum target, GLuint texture);
- void glTexSubImage2D(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLenum type, const GLvoid *pixels);
- void glTexSubImage1D(GLenum target, GLint level, GLint xoffset, GLsizei width, GLenum format, GLenum type, const GLvoid *pixels);
- void glCopyTexSubImage2D(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint x, GLint y, GLsizei width, GLsizei height);
- void glCopyTexSubImage1D(GLenum target, GLint level, GLint xoffset, GLint x, GLint y, GLsizei width);
- void glCopyTexImage2D(GLenum target, GLint level, GLenum internalformat, GLint x, GLint y, GLsizei width, GLsizei height, GLint border);
- void glCopyTexImage1D(GLenum target, GLint level, GLenum internalformat, GLint x, GLint y, GLsizei width, GLint border);
- void glPolygonOffset(GLfloat factor, GLfloat units);
- void glGetPointerv(GLenum pname, GLvoid* *params);
- void glDrawElements(GLenum mode, GLsizei count, GLenum type, const GLvoid *indices);
- void glDrawArrays(GLenum mode, GLint first, GLsizei count);
-
- // OpenGL 1.2 core functions
- void glCopyTexSubImage3D(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLint x, GLint y, GLsizei width, GLsizei height);
- void glTexSubImage3D(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLenum type, const GLvoid *pixels);
- void glTexImage3D(GLenum target, GLint level, GLint internalformat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLenum format, GLenum type, const GLvoid *pixels);
- void glDrawRangeElements(GLenum mode, GLuint start, GLuint end, GLsizei count, GLenum type, const GLvoid *indices);
- void glBlendEquation(GLenum mode);
- void glBlendColor(GLfloat red, GLfloat green, GLfloat blue, GLfloat alpha);
-
- // OpenGL 1.3 core functions
- void glGetCompressedTexImage(GLenum target, GLint level, GLvoid *img);
- void glCompressedTexSubImage1D(GLenum target, GLint level, GLint xoffset, GLsizei width, GLenum format, GLsizei imageSize, const GLvoid *data);
- void glCompressedTexSubImage2D(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLsizei imageSize, const GLvoid *data);
- void glCompressedTexSubImage3D(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLsizei imageSize, const GLvoid *data);
- void glCompressedTexImage1D(GLenum target, GLint level, GLenum internalformat, GLsizei width, GLint border, GLsizei imageSize, const GLvoid *data);
- void glCompressedTexImage2D(GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLint border, GLsizei imageSize, const GLvoid *data);
- void glCompressedTexImage3D(GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLsizei imageSize, const GLvoid *data);
- void glSampleCoverage(GLfloat value, GLboolean invert);
- void glActiveTexture(GLenum texture);
-
- // OpenGL 1.4 core functions
- void glPointParameteriv(GLenum pname, const GLint *params);
- void glPointParameteri(GLenum pname, GLint param);
- void glPointParameterfv(GLenum pname, const GLfloat *params);
- void glPointParameterf(GLenum pname, GLfloat param);
- void glMultiDrawElements(GLenum mode, const GLsizei *count, GLenum type, const GLvoid* const *indices, GLsizei drawcount);
- void glMultiDrawArrays(GLenum mode, const GLint *first, const GLsizei *count, GLsizei drawcount);
- void glBlendFuncSeparate(GLenum sfactorRGB, GLenum dfactorRGB, GLenum sfactorAlpha, GLenum dfactorAlpha);
-
- // OpenGL 1.5 core functions
- void glGetBufferPointerv(GLenum target, GLenum pname, GLvoid* *params);
- void glGetBufferParameteriv(GLenum target, GLenum pname, GLint *params);
- GLboolean glUnmapBuffer(GLenum target);
- GLvoid* glMapBuffer(GLenum target, GLenum access);
- void glGetBufferSubData(GLenum target, GLintptr offset, GLsizeiptr size, GLvoid *data);
- void glBufferSubData(GLenum target, GLintptr offset, GLsizeiptr size, const GLvoid *data);
- void glBufferData(GLenum target, GLsizeiptr size, const GLvoid *data, GLenum usage);
- GLboolean glIsBuffer(GLuint buffer);
- void glGenBuffers(GLsizei n, GLuint *buffers);
- void glDeleteBuffers(GLsizei n, const GLuint *buffers);
- void glBindBuffer(GLenum target, GLuint buffer);
- void glGetQueryObjectuiv(GLuint id, GLenum pname, GLuint *params);
- void glGetQueryObjectiv(GLuint id, GLenum pname, GLint *params);
- void glGetQueryiv(GLenum target, GLenum pname, GLint *params);
- void glEndQuery(GLenum target);
- void glBeginQuery(GLenum target, GLuint id);
- GLboolean glIsQuery(GLuint id);
- void glDeleteQueries(GLsizei n, const GLuint *ids);
- void glGenQueries(GLsizei n, GLuint *ids);
-
- // OpenGL 1.0 deprecated functions
- void glTranslatef(GLfloat x, GLfloat y, GLfloat z);
- void glTranslated(GLdouble x, GLdouble y, GLdouble z);
- void glScalef(GLfloat x, GLfloat y, GLfloat z);
- void glScaled(GLdouble x, GLdouble y, GLdouble z);
- void glRotatef(GLfloat angle, GLfloat x, GLfloat y, GLfloat z);
- void glRotated(GLdouble angle, GLdouble x, GLdouble y, GLdouble z);
- void glPushMatrix();
- void glPopMatrix();
- void glOrtho(GLdouble left, GLdouble right, GLdouble bottom, GLdouble top, GLdouble zNear, GLdouble zFar);
- void glMultMatrixd(const GLdouble *m);
- void glMultMatrixf(const GLfloat *m);
- void glMatrixMode(GLenum mode);
- void glLoadMatrixd(const GLdouble *m);
- void glLoadMatrixf(const GLfloat *m);
- void glLoadIdentity();
- void glFrustum(GLdouble left, GLdouble right, GLdouble bottom, GLdouble top, GLdouble zNear, GLdouble zFar);
- GLboolean glIsList(GLuint list);
- void glGetTexGeniv(GLenum coord, GLenum pname, GLint *params);
- void glGetTexGenfv(GLenum coord, GLenum pname, GLfloat *params);
- void glGetTexGendv(GLenum coord, GLenum pname, GLdouble *params);
- void glGetTexEnviv(GLenum target, GLenum pname, GLint *params);
- void glGetTexEnvfv(GLenum target, GLenum pname, GLfloat *params);
- void glGetPolygonStipple(GLubyte *mask);
- void glGetPixelMapusv(GLenum map, GLushort *values);
- void glGetPixelMapuiv(GLenum map, GLuint *values);
- void glGetPixelMapfv(GLenum map, GLfloat *values);
- void glGetMaterialiv(GLenum face, GLenum pname, GLint *params);
- void glGetMaterialfv(GLenum face, GLenum pname, GLfloat *params);
- void glGetMapiv(GLenum target, GLenum query, GLint *v);
- void glGetMapfv(GLenum target, GLenum query, GLfloat *v);
- void glGetMapdv(GLenum target, GLenum query, GLdouble *v);
- void glGetLightiv(GLenum light, GLenum pname, GLint *params);
- void glGetLightfv(GLenum light, GLenum pname, GLfloat *params);
- void glGetClipPlane(GLenum plane, GLdouble *equation);
- void glDrawPixels(GLsizei width, GLsizei height, GLenum format, GLenum type, const GLvoid *pixels);
- void glCopyPixels(GLint x, GLint y, GLsizei width, GLsizei height, GLenum type);
- void glPixelMapusv(GLenum map, GLint mapsize, const GLushort *values);
- void glPixelMapuiv(GLenum map, GLint mapsize, const GLuint *values);
- void glPixelMapfv(GLenum map, GLint mapsize, const GLfloat *values);
- void glPixelTransferi(GLenum pname, GLint param);
- void glPixelTransferf(GLenum pname, GLfloat param);
- void glPixelZoom(GLfloat xfactor, GLfloat yfactor);
- void glAlphaFunc(GLenum func, GLfloat ref);
- void glEvalPoint2(GLint i, GLint j);
- void glEvalMesh2(GLenum mode, GLint i1, GLint i2, GLint j1, GLint j2);
- void glEvalPoint1(GLint i);
- void glEvalMesh1(GLenum mode, GLint i1, GLint i2);
- void glEvalCoord2fv(const GLfloat *u);
- void glEvalCoord2f(GLfloat u, GLfloat v);
- void glEvalCoord2dv(const GLdouble *u);
- void glEvalCoord2d(GLdouble u, GLdouble v);
- void glEvalCoord1fv(const GLfloat *u);
- void glEvalCoord1f(GLfloat u);
- void glEvalCoord1dv(const GLdouble *u);
- void glEvalCoord1d(GLdouble u);
- void glMapGrid2f(GLint un, GLfloat u1, GLfloat u2, GLint vn, GLfloat v1, GLfloat v2);
- void glMapGrid2d(GLint un, GLdouble u1, GLdouble u2, GLint vn, GLdouble v1, GLdouble v2);
- void glMapGrid1f(GLint un, GLfloat u1, GLfloat u2);
- void glMapGrid1d(GLint un, GLdouble u1, GLdouble u2);
- void glMap2f(GLenum target, GLfloat u1, GLfloat u2, GLint ustride, GLint uorder, GLfloat v1, GLfloat v2, GLint vstride, GLint vorder, const GLfloat *points);
- void glMap2d(GLenum target, GLdouble u1, GLdouble u2, GLint ustride, GLint uorder, GLdouble v1, GLdouble v2, GLint vstride, GLint vorder, const GLdouble *points);
- void glMap1f(GLenum target, GLfloat u1, GLfloat u2, GLint stride, GLint order, const GLfloat *points);
- void glMap1d(GLenum target, GLdouble u1, GLdouble u2, GLint stride, GLint order, const GLdouble *points);
- void glPushAttrib(GLbitfield mask);
- void glPopAttrib();
- void glAccum(GLenum op, GLfloat value);
- void glIndexMask(GLuint mask);
- void glClearIndex(GLfloat c);
- void glClearAccum(GLfloat red, GLfloat green, GLfloat blue, GLfloat alpha);
- void glPushName(GLuint name);
- void glPopName();
- void glPassThrough(GLfloat token);
- void glLoadName(GLuint name);
- void glInitNames();
- GLint glRenderMode(GLenum mode);
- void glSelectBuffer(GLsizei size, GLuint *buffer);
- void glFeedbackBuffer(GLsizei size, GLenum type, GLfloat *buffer);
- void glTexGeniv(GLenum coord, GLenum pname, const GLint *params);
- void glTexGeni(GLenum coord, GLenum pname, GLint param);
- void glTexGenfv(GLenum coord, GLenum pname, const GLfloat *params);
- void glTexGenf(GLenum coord, GLenum pname, GLfloat param);
- void glTexGendv(GLenum coord, GLenum pname, const GLdouble *params);
- void glTexGend(GLenum coord, GLenum pname, GLdouble param);
- void glTexEnviv(GLenum target, GLenum pname, const GLint *params);
- void glTexEnvi(GLenum target, GLenum pname, GLint param);
- void glTexEnvfv(GLenum target, GLenum pname, const GLfloat *params);
- void glTexEnvf(GLenum target, GLenum pname, GLfloat param);
- void glShadeModel(GLenum mode);
- void glPolygonStipple(const GLubyte *mask);
- void glMaterialiv(GLenum face, GLenum pname, const GLint *params);
- void glMateriali(GLenum face, GLenum pname, GLint param);
- void glMaterialfv(GLenum face, GLenum pname, const GLfloat *params);
- void glMaterialf(GLenum face, GLenum pname, GLfloat param);
- void glLineStipple(GLint factor, GLushort pattern);
- void glLightModeliv(GLenum pname, const GLint *params);
- void glLightModeli(GLenum pname, GLint param);
- void glLightModelfv(GLenum pname, const GLfloat *params);
- void glLightModelf(GLenum pname, GLfloat param);
- void glLightiv(GLenum light, GLenum pname, const GLint *params);
- void glLighti(GLenum light, GLenum pname, GLint param);
- void glLightfv(GLenum light, GLenum pname, const GLfloat *params);
- void glLightf(GLenum light, GLenum pname, GLfloat param);
- void glFogiv(GLenum pname, const GLint *params);
- void glFogi(GLenum pname, GLint param);
- void glFogfv(GLenum pname, const GLfloat *params);
- void glFogf(GLenum pname, GLfloat param);
- void glColorMaterial(GLenum face, GLenum mode);
- void glClipPlane(GLenum plane, const GLdouble *equation);
- void glVertex4sv(const GLshort *v);
- void glVertex4s(GLshort x, GLshort y, GLshort z, GLshort w);
- void glVertex4iv(const GLint *v);
- void glVertex4i(GLint x, GLint y, GLint z, GLint w);
- void glVertex4fv(const GLfloat *v);
- void glVertex4f(GLfloat x, GLfloat y, GLfloat z, GLfloat w);
- void glVertex4dv(const GLdouble *v);
- void glVertex4d(GLdouble x, GLdouble y, GLdouble z, GLdouble w);
- void glVertex3sv(const GLshort *v);
- void glVertex3s(GLshort x, GLshort y, GLshort z);
- void glVertex3iv(const GLint *v);
- void glVertex3i(GLint x, GLint y, GLint z);
- void glVertex3fv(const GLfloat *v);
- void glVertex3f(GLfloat x, GLfloat y, GLfloat z);
- void glVertex3dv(const GLdouble *v);
- void glVertex3d(GLdouble x, GLdouble y, GLdouble z);
- void glVertex2sv(const GLshort *v);
- void glVertex2s(GLshort x, GLshort y);
- void glVertex2iv(const GLint *v);
- void glVertex2i(GLint x, GLint y);
- void glVertex2fv(const GLfloat *v);
- void glVertex2f(GLfloat x, GLfloat y);
- void glVertex2dv(const GLdouble *v);
- void glVertex2d(GLdouble x, GLdouble y);
- void glTexCoord4sv(const GLshort *v);
- void glTexCoord4s(GLshort s, GLshort t, GLshort r, GLshort q);
- void glTexCoord4iv(const GLint *v);
- void glTexCoord4i(GLint s, GLint t, GLint r, GLint q);
- void glTexCoord4fv(const GLfloat *v);
- void glTexCoord4f(GLfloat s, GLfloat t, GLfloat r, GLfloat q);
- void glTexCoord4dv(const GLdouble *v);
- void glTexCoord4d(GLdouble s, GLdouble t, GLdouble r, GLdouble q);
- void glTexCoord3sv(const GLshort *v);
- void glTexCoord3s(GLshort s, GLshort t, GLshort r);
- void glTexCoord3iv(const GLint *v);
- void glTexCoord3i(GLint s, GLint t, GLint r);
- void glTexCoord3fv(const GLfloat *v);
- void glTexCoord3f(GLfloat s, GLfloat t, GLfloat r);
- void glTexCoord3dv(const GLdouble *v);
- void glTexCoord3d(GLdouble s, GLdouble t, GLdouble r);
- void glTexCoord2sv(const GLshort *v);
- void glTexCoord2s(GLshort s, GLshort t);
- void glTexCoord2iv(const GLint *v);
- void glTexCoord2i(GLint s, GLint t);
- void glTexCoord2fv(const GLfloat *v);
- void glTexCoord2f(GLfloat s, GLfloat t);
- void glTexCoord2dv(const GLdouble *v);
- void glTexCoord2d(GLdouble s, GLdouble t);
- void glTexCoord1sv(const GLshort *v);
- void glTexCoord1s(GLshort s);
- void glTexCoord1iv(const GLint *v);
- void glTexCoord1i(GLint s);
- void glTexCoord1fv(const GLfloat *v);
- void glTexCoord1f(GLfloat s);
- void glTexCoord1dv(const GLdouble *v);
- void glTexCoord1d(GLdouble s);
- void glRectsv(const GLshort *v1, const GLshort *v2);
- void glRects(GLshort x1, GLshort y1, GLshort x2, GLshort y2);
- void glRectiv(const GLint *v1, const GLint *v2);
- void glRecti(GLint x1, GLint y1, GLint x2, GLint y2);
- void glRectfv(const GLfloat *v1, const GLfloat *v2);
- void glRectf(GLfloat x1, GLfloat y1, GLfloat x2, GLfloat y2);
- void glRectdv(const GLdouble *v1, const GLdouble *v2);
- void glRectd(GLdouble x1, GLdouble y1, GLdouble x2, GLdouble y2);
- void glRasterPos4sv(const GLshort *v);
- void glRasterPos4s(GLshort x, GLshort y, GLshort z, GLshort w);
- void glRasterPos4iv(const GLint *v);
- void glRasterPos4i(GLint x, GLint y, GLint z, GLint w);
- void glRasterPos4fv(const GLfloat *v);
- void glRasterPos4f(GLfloat x, GLfloat y, GLfloat z, GLfloat w);
- void glRasterPos4dv(const GLdouble *v);
- void glRasterPos4d(GLdouble x, GLdouble y, GLdouble z, GLdouble w);
- void glRasterPos3sv(const GLshort *v);
- void glRasterPos3s(GLshort x, GLshort y, GLshort z);
- void glRasterPos3iv(const GLint *v);
- void glRasterPos3i(GLint x, GLint y, GLint z);
- void glRasterPos3fv(const GLfloat *v);
- void glRasterPos3f(GLfloat x, GLfloat y, GLfloat z);
- void glRasterPos3dv(const GLdouble *v);
- void glRasterPos3d(GLdouble x, GLdouble y, GLdouble z);
- void glRasterPos2sv(const GLshort *v);
- void glRasterPos2s(GLshort x, GLshort y);
- void glRasterPos2iv(const GLint *v);
- void glRasterPos2i(GLint x, GLint y);
- void glRasterPos2fv(const GLfloat *v);
- void glRasterPos2f(GLfloat x, GLfloat y);
- void glRasterPos2dv(const GLdouble *v);
- void glRasterPos2d(GLdouble x, GLdouble y);
- void glNormal3sv(const GLshort *v);
- void glNormal3s(GLshort nx, GLshort ny, GLshort nz);
- void glNormal3iv(const GLint *v);
- void glNormal3i(GLint nx, GLint ny, GLint nz);
- void glNormal3fv(const GLfloat *v);
- void glNormal3f(GLfloat nx, GLfloat ny, GLfloat nz);
- void glNormal3dv(const GLdouble *v);
- void glNormal3d(GLdouble nx, GLdouble ny, GLdouble nz);
- void glNormal3bv(const GLbyte *v);
- void glNormal3b(GLbyte nx, GLbyte ny, GLbyte nz);
- void glIndexsv(const GLshort *c);
- void glIndexs(GLshort c);
- void glIndexiv(const GLint *c);
- void glIndexi(GLint c);
- void glIndexfv(const GLfloat *c);
- void glIndexf(GLfloat c);
- void glIndexdv(const GLdouble *c);
- void glIndexd(GLdouble c);
- void glEnd();
- void glEdgeFlagv(const GLboolean *flag);
- void glEdgeFlag(GLboolean flag);
- void glColor4usv(const GLushort *v);
- void glColor4us(GLushort red, GLushort green, GLushort blue, GLushort alpha);
- void glColor4uiv(const GLuint *v);
- void glColor4ui(GLuint red, GLuint green, GLuint blue, GLuint alpha);
- void glColor4ubv(const GLubyte *v);
- void glColor4ub(GLubyte red, GLubyte green, GLubyte blue, GLubyte alpha);
- void glColor4sv(const GLshort *v);
- void glColor4s(GLshort red, GLshort green, GLshort blue, GLshort alpha);
- void glColor4iv(const GLint *v);
- void glColor4i(GLint red, GLint green, GLint blue, GLint alpha);
- void glColor4fv(const GLfloat *v);
- void glColor4f(GLfloat red, GLfloat green, GLfloat blue, GLfloat alpha);
- void glColor4dv(const GLdouble *v);
- void glColor4d(GLdouble red, GLdouble green, GLdouble blue, GLdouble alpha);
- void glColor4bv(const GLbyte *v);
- void glColor4b(GLbyte red, GLbyte green, GLbyte blue, GLbyte alpha);
- void glColor3usv(const GLushort *v);
- void glColor3us(GLushort red, GLushort green, GLushort blue);
- void glColor3uiv(const GLuint *v);
- void glColor3ui(GLuint red, GLuint green, GLuint blue);
- void glColor3ubv(const GLubyte *v);
- void glColor3ub(GLubyte red, GLubyte green, GLubyte blue);
- void glColor3sv(const GLshort *v);
- void glColor3s(GLshort red, GLshort green, GLshort blue);
- void glColor3iv(const GLint *v);
- void glColor3i(GLint red, GLint green, GLint blue);
- void glColor3fv(const GLfloat *v);
- void glColor3f(GLfloat red, GLfloat green, GLfloat blue);
- void glColor3dv(const GLdouble *v);
- void glColor3d(GLdouble red, GLdouble green, GLdouble blue);
- void glColor3bv(const GLbyte *v);
- void glColor3b(GLbyte red, GLbyte green, GLbyte blue);
- void glBitmap(GLsizei width, GLsizei height, GLfloat xorig, GLfloat yorig, GLfloat xmove, GLfloat ymove, const GLubyte *bitmap);
- void glBegin(GLenum mode);
- void glListBase(GLuint base);
- GLuint glGenLists(GLsizei range);
- void glDeleteLists(GLuint list, GLsizei range);
- void glCallLists(GLsizei n, GLenum type, const GLvoid *lists);
- void glCallList(GLuint list);
- void glEndList();
- void glNewList(GLuint list, GLenum mode);
-
- // OpenGL 1.1 deprecated functions
- void glPushClientAttrib(GLbitfield mask);
- void glPopClientAttrib();
- void glPrioritizeTextures(GLsizei n, const GLuint *textures, const GLfloat *priorities);
- GLboolean glAreTexturesResident(GLsizei n, const GLuint *textures, GLboolean *residences);
- void glVertexPointer(GLint size, GLenum type, GLsizei stride, const GLvoid *pointer);
- void glTexCoordPointer(GLint size, GLenum type, GLsizei stride, const GLvoid *pointer);
- void glNormalPointer(GLenum type, GLsizei stride, const GLvoid *pointer);
- void glInterleavedArrays(GLenum format, GLsizei stride, const GLvoid *pointer);
- void glIndexPointer(GLenum type, GLsizei stride, const GLvoid *pointer);
- void glEnableClientState(GLenum array);
- void glEdgeFlagPointer(GLsizei stride, const GLvoid *pointer);
- void glDisableClientState(GLenum array);
- void glColorPointer(GLint size, GLenum type, GLsizei stride, const GLvoid *pointer);
- void glArrayElement(GLint i);
-
- // OpenGL 1.2 deprecated functions
- void glResetMinmax(GLenum target);
- void glResetHistogram(GLenum target);
- void glMinmax(GLenum target, GLenum internalformat, GLboolean sink);
- void glHistogram(GLenum target, GLsizei width, GLenum internalformat, GLboolean sink);
- void glGetMinmaxParameteriv(GLenum target, GLenum pname, GLint *params);
- void glGetMinmaxParameterfv(GLenum target, GLenum pname, GLfloat *params);
- void glGetMinmax(GLenum target, GLboolean reset, GLenum format, GLenum type, GLvoid *values);
- void glGetHistogramParameteriv(GLenum target, GLenum pname, GLint *params);
- void glGetHistogramParameterfv(GLenum target, GLenum pname, GLfloat *params);
- void glGetHistogram(GLenum target, GLboolean reset, GLenum format, GLenum type, GLvoid *values);
- void glSeparableFilter2D(GLenum target, GLenum internalformat, GLsizei width, GLsizei height, GLenum format, GLenum type, const GLvoid *row, const GLvoid *column);
- void glGetSeparableFilter(GLenum target, GLenum format, GLenum type, GLvoid *row, GLvoid *column, GLvoid *span);
- void glGetConvolutionParameteriv(GLenum target, GLenum pname, GLint *params);
- void glGetConvolutionParameterfv(GLenum target, GLenum pname, GLfloat *params);
- void glGetConvolutionFilter(GLenum target, GLenum format, GLenum type, GLvoid *image);
- void glCopyConvolutionFilter2D(GLenum target, GLenum internalformat, GLint x, GLint y, GLsizei width, GLsizei height);
- void glCopyConvolutionFilter1D(GLenum target, GLenum internalformat, GLint x, GLint y, GLsizei width);
- void glConvolutionParameteriv(GLenum target, GLenum pname, const GLint *params);
- void glConvolutionParameteri(GLenum target, GLenum pname, GLint params);
- void glConvolutionParameterfv(GLenum target, GLenum pname, const GLfloat *params);
- void glConvolutionParameterf(GLenum target, GLenum pname, GLfloat params);
- void glConvolutionFilter2D(GLenum target, GLenum internalformat, GLsizei width, GLsizei height, GLenum format, GLenum type, const GLvoid *image);
- void glConvolutionFilter1D(GLenum target, GLenum internalformat, GLsizei width, GLenum format, GLenum type, const GLvoid *image);
- void glCopyColorSubTable(GLenum target, GLsizei start, GLint x, GLint y, GLsizei width);
- void glColorSubTable(GLenum target, GLsizei start, GLsizei count, GLenum format, GLenum type, const GLvoid *data);
- void glGetColorTableParameteriv(GLenum target, GLenum pname, GLint *params);
- void glGetColorTableParameterfv(GLenum target, GLenum pname, GLfloat *params);
- void glGetColorTable(GLenum target, GLenum format, GLenum type, GLvoid *table);
- void glCopyColorTable(GLenum target, GLenum internalformat, GLint x, GLint y, GLsizei width);
- void glColorTableParameteriv(GLenum target, GLenum pname, const GLint *params);
- void glColorTableParameterfv(GLenum target, GLenum pname, const GLfloat *params);
- void glColorTable(GLenum target, GLenum internalformat, GLsizei width, GLenum format, GLenum type, const GLvoid *table);
-
- // OpenGL 1.3 deprecated functions
- void glMultTransposeMatrixd(const GLdouble *m);
- void glMultTransposeMatrixf(const GLfloat *m);
- void glLoadTransposeMatrixd(const GLdouble *m);
- void glLoadTransposeMatrixf(const GLfloat *m);
- void glMultiTexCoord4sv(GLenum target, const GLshort *v);
- void glMultiTexCoord4s(GLenum target, GLshort s, GLshort t, GLshort r, GLshort q);
- void glMultiTexCoord4iv(GLenum target, const GLint *v);
- void glMultiTexCoord4i(GLenum target, GLint s, GLint t, GLint r, GLint q);
- void glMultiTexCoord4fv(GLenum target, const GLfloat *v);
- void glMultiTexCoord4f(GLenum target, GLfloat s, GLfloat t, GLfloat r, GLfloat q);
- void glMultiTexCoord4dv(GLenum target, const GLdouble *v);
- void glMultiTexCoord4d(GLenum target, GLdouble s, GLdouble t, GLdouble r, GLdouble q);
- void glMultiTexCoord3sv(GLenum target, const GLshort *v);
- void glMultiTexCoord3s(GLenum target, GLshort s, GLshort t, GLshort r);
- void glMultiTexCoord3iv(GLenum target, const GLint *v);
- void glMultiTexCoord3i(GLenum target, GLint s, GLint t, GLint r);
- void glMultiTexCoord3fv(GLenum target, const GLfloat *v);
- void glMultiTexCoord3f(GLenum target, GLfloat s, GLfloat t, GLfloat r);
- void glMultiTexCoord3dv(GLenum target, const GLdouble *v);
- void glMultiTexCoord3d(GLenum target, GLdouble s, GLdouble t, GLdouble r);
- void glMultiTexCoord2sv(GLenum target, const GLshort *v);
- void glMultiTexCoord2s(GLenum target, GLshort s, GLshort t);
- void glMultiTexCoord2iv(GLenum target, const GLint *v);
- void glMultiTexCoord2i(GLenum target, GLint s, GLint t);
- void glMultiTexCoord2fv(GLenum target, const GLfloat *v);
- void glMultiTexCoord2f(GLenum target, GLfloat s, GLfloat t);
- void glMultiTexCoord2dv(GLenum target, const GLdouble *v);
- void glMultiTexCoord2d(GLenum target, GLdouble s, GLdouble t);
- void glMultiTexCoord1sv(GLenum target, const GLshort *v);
- void glMultiTexCoord1s(GLenum target, GLshort s);
- void glMultiTexCoord1iv(GLenum target, const GLint *v);
- void glMultiTexCoord1i(GLenum target, GLint s);
- void glMultiTexCoord1fv(GLenum target, const GLfloat *v);
- void glMultiTexCoord1f(GLenum target, GLfloat s);
- void glMultiTexCoord1dv(GLenum target, const GLdouble *v);
- void glMultiTexCoord1d(GLenum target, GLdouble s);
- void glClientActiveTexture(GLenum texture);
-
- // OpenGL 1.4 deprecated functions
- void glWindowPos3sv(const GLshort *v);
- void glWindowPos3s(GLshort x, GLshort y, GLshort z);
- void glWindowPos3iv(const GLint *v);
- void glWindowPos3i(GLint x, GLint y, GLint z);
- void glWindowPos3fv(const GLfloat *v);
- void glWindowPos3f(GLfloat x, GLfloat y, GLfloat z);
- void glWindowPos3dv(const GLdouble *v);
- void glWindowPos3d(GLdouble x, GLdouble y, GLdouble z);
- void glWindowPos2sv(const GLshort *v);
- void glWindowPos2s(GLshort x, GLshort y);
- void glWindowPos2iv(const GLint *v);
- void glWindowPos2i(GLint x, GLint y);
- void glWindowPos2fv(const GLfloat *v);
- void glWindowPos2f(GLfloat x, GLfloat y);
- void glWindowPos2dv(const GLdouble *v);
- void glWindowPos2d(GLdouble x, GLdouble y);
- void glSecondaryColorPointer(GLint size, GLenum type, GLsizei stride, const GLvoid *pointer);
- void glSecondaryColor3usv(const GLushort *v);
- void glSecondaryColor3us(GLushort red, GLushort green, GLushort blue);
- void glSecondaryColor3uiv(const GLuint *v);
- void glSecondaryColor3ui(GLuint red, GLuint green, GLuint blue);
- void glSecondaryColor3ubv(const GLubyte *v);
- void glSecondaryColor3ub(GLubyte red, GLubyte green, GLubyte blue);
- void glSecondaryColor3sv(const GLshort *v);
- void glSecondaryColor3s(GLshort red, GLshort green, GLshort blue);
- void glSecondaryColor3iv(const GLint *v);
- void glSecondaryColor3i(GLint red, GLint green, GLint blue);
- void glSecondaryColor3fv(const GLfloat *v);
- void glSecondaryColor3f(GLfloat red, GLfloat green, GLfloat blue);
- void glSecondaryColor3dv(const GLdouble *v);
- void glSecondaryColor3d(GLdouble red, GLdouble green, GLdouble blue);
- void glSecondaryColor3bv(const GLbyte *v);
- void glSecondaryColor3b(GLbyte red, GLbyte green, GLbyte blue);
- void glFogCoordPointer(GLenum type, GLsizei stride, const GLvoid *pointer);
- void glFogCoorddv(const GLdouble *coord);
- void glFogCoordd(GLdouble coord);
- void glFogCoordfv(const GLfloat *coord);
- void glFogCoordf(GLfloat coord);
-
- // OpenGL 1.5 deprecated functions
-
-private:
- friend class QOpenGLContext;
-
- static bool isContextCompatible(QOpenGLContext *context);
- static QOpenGLVersionProfile versionProfile();
-
- QOpenGLFunctions_1_0_CoreBackend* d_1_0_Core;
- QOpenGLFunctions_1_1_CoreBackend* d_1_1_Core;
- QOpenGLFunctions_1_2_CoreBackend* d_1_2_Core;
- QOpenGLFunctions_1_3_CoreBackend* d_1_3_Core;
- QOpenGLFunctions_1_4_CoreBackend* d_1_4_Core;
- QOpenGLFunctions_1_5_CoreBackend* d_1_5_Core;
- QOpenGLFunctions_1_0_DeprecatedBackend* d_1_0_Deprecated;
- QOpenGLFunctions_1_1_DeprecatedBackend* d_1_1_Deprecated;
- QOpenGLFunctions_1_2_DeprecatedBackend* d_1_2_Deprecated;
- QOpenGLFunctions_1_3_DeprecatedBackend* d_1_3_Deprecated;
- QOpenGLFunctions_1_4_DeprecatedBackend* d_1_4_Deprecated;
-};
-
-// OpenGL 1.0 core functions
-inline void QOpenGLFunctions_1_5::glViewport(GLint x, GLint y, GLsizei width, GLsizei height)
-{
- d_1_0_Core->f.Viewport(x, y, width, height);
-}
-
-inline void QOpenGLFunctions_1_5::glDepthRange(GLdouble nearVal, GLdouble farVal)
-{
- d_1_0_Core->f.DepthRange(nearVal, farVal);
-}
-
-inline GLboolean QOpenGLFunctions_1_5::glIsEnabled(GLenum cap)
-{
- return d_1_0_Core->f.IsEnabled(cap);
-}
-
-inline void QOpenGLFunctions_1_5::glGetTexLevelParameteriv(GLenum target, GLint level, GLenum pname, GLint *params)
-{
- d_1_0_Core->f.GetTexLevelParameteriv(target, level, pname, params);
-}
-
-inline void QOpenGLFunctions_1_5::glGetTexLevelParameterfv(GLenum target, GLint level, GLenum pname, GLfloat *params)
-{
- d_1_0_Core->f.GetTexLevelParameterfv(target, level, pname, params);
-}
-
-inline void QOpenGLFunctions_1_5::glGetTexParameteriv(GLenum target, GLenum pname, GLint *params)
-{
- d_1_0_Core->f.GetTexParameteriv(target, pname, params);
-}
-
-inline void QOpenGLFunctions_1_5::glGetTexParameterfv(GLenum target, GLenum pname, GLfloat *params)
-{
- d_1_0_Core->f.GetTexParameterfv(target, pname, params);
-}
-
-inline void QOpenGLFunctions_1_5::glGetTexImage(GLenum target, GLint level, GLenum format, GLenum type, GLvoid *pixels)
-{
- d_1_0_Core->f.GetTexImage(target, level, format, type, pixels);
-}
-
-inline const GLubyte * QOpenGLFunctions_1_5::glGetString(GLenum name)
-{
- return d_1_0_Core->f.GetString(name);
-}
-
-inline void QOpenGLFunctions_1_5::glGetIntegerv(GLenum pname, GLint *params)
-{
- d_1_0_Core->f.GetIntegerv(pname, params);
-}
-
-inline void QOpenGLFunctions_1_5::glGetFloatv(GLenum pname, GLfloat *params)
-{
- d_1_0_Core->f.GetFloatv(pname, params);
-}
-
-inline GLenum QOpenGLFunctions_1_5::glGetError()
-{
- return d_1_0_Core->f.GetError();
-}
-
-inline void QOpenGLFunctions_1_5::glGetDoublev(GLenum pname, GLdouble *params)
-{
- d_1_0_Core->f.GetDoublev(pname, params);
-}
-
-inline void QOpenGLFunctions_1_5::glGetBooleanv(GLenum pname, GLboolean *params)
-{
- d_1_0_Core->f.GetBooleanv(pname, params);
-}
-
-inline void QOpenGLFunctions_1_5::glReadPixels(GLint x, GLint y, GLsizei width, GLsizei height, GLenum format, GLenum type, GLvoid *pixels)
-{
- d_1_0_Core->f.ReadPixels(x, y, width, height, format, type, pixels);
-}
-
-inline void QOpenGLFunctions_1_5::glReadBuffer(GLenum mode)
-{
- d_1_0_Core->f.ReadBuffer(mode);
-}
-
-inline void QOpenGLFunctions_1_5::glPixelStorei(GLenum pname, GLint param)
-{
- d_1_0_Core->f.PixelStorei(pname, param);
-}
-
-inline void QOpenGLFunctions_1_5::glPixelStoref(GLenum pname, GLfloat param)
-{
- d_1_0_Core->f.PixelStoref(pname, param);
-}
-
-inline void QOpenGLFunctions_1_5::glDepthFunc(GLenum func)
-{
- d_1_0_Core->f.DepthFunc(func);
-}
-
-inline void QOpenGLFunctions_1_5::glStencilOp(GLenum fail, GLenum zfail, GLenum zpass)
-{
- d_1_0_Core->f.StencilOp(fail, zfail, zpass);
-}
-
-inline void QOpenGLFunctions_1_5::glStencilFunc(GLenum func, GLint ref, GLuint mask)
-{
- d_1_0_Core->f.StencilFunc(func, ref, mask);
-}
-
-inline void QOpenGLFunctions_1_5::glLogicOp(GLenum opcode)
-{
- d_1_0_Core->f.LogicOp(opcode);
-}
-
-inline void QOpenGLFunctions_1_5::glBlendFunc(GLenum sfactor, GLenum dfactor)
-{
- d_1_0_Core->f.BlendFunc(sfactor, dfactor);
-}
-
-inline void QOpenGLFunctions_1_5::glFlush()
-{
- d_1_0_Core->f.Flush();
-}
-
-inline void QOpenGLFunctions_1_5::glFinish()
-{
- d_1_0_Core->f.Finish();
-}
-
-inline void QOpenGLFunctions_1_5::glEnable(GLenum cap)
-{
- d_1_0_Core->f.Enable(cap);
-}
-
-inline void QOpenGLFunctions_1_5::glDisable(GLenum cap)
-{
- d_1_0_Core->f.Disable(cap);
-}
-
-inline void QOpenGLFunctions_1_5::glDepthMask(GLboolean flag)
-{
- d_1_0_Core->f.DepthMask(flag);
-}
-
-inline void QOpenGLFunctions_1_5::glColorMask(GLboolean red, GLboolean green, GLboolean blue, GLboolean alpha)
-{
- d_1_0_Core->f.ColorMask(red, green, blue, alpha);
-}
-
-inline void QOpenGLFunctions_1_5::glStencilMask(GLuint mask)
-{
- d_1_0_Core->f.StencilMask(mask);
-}
-
-inline void QOpenGLFunctions_1_5::glClearDepth(GLdouble depth)
-{
- d_1_0_Core->f.ClearDepth(depth);
-}
-
-inline void QOpenGLFunctions_1_5::glClearStencil(GLint s)
-{
- d_1_0_Core->f.ClearStencil(s);
-}
-
-inline void QOpenGLFunctions_1_5::glClearColor(GLfloat red, GLfloat green, GLfloat blue, GLfloat alpha)
-{
- d_1_0_Core->f.ClearColor(red, green, blue, alpha);
-}
-
-inline void QOpenGLFunctions_1_5::glClear(GLbitfield mask)
-{
- d_1_0_Core->f.Clear(mask);
-}
-
-inline void QOpenGLFunctions_1_5::glDrawBuffer(GLenum mode)
-{
- d_1_0_Core->f.DrawBuffer(mode);
-}
-
-inline void QOpenGLFunctions_1_5::glTexImage2D(GLenum target, GLint level, GLint internalformat, GLsizei width, GLsizei height, GLint border, GLenum format, GLenum type, const GLvoid *pixels)
-{
- d_1_0_Core->f.TexImage2D(target, level, internalformat, width, height, border, format, type, pixels);
-}
-
-inline void QOpenGLFunctions_1_5::glTexImage1D(GLenum target, GLint level, GLint internalformat, GLsizei width, GLint border, GLenum format, GLenum type, const GLvoid *pixels)
-{
- d_1_0_Core->f.TexImage1D(target, level, internalformat, width, border, format, type, pixels);
-}
-
-inline void QOpenGLFunctions_1_5::glTexParameteriv(GLenum target, GLenum pname, const GLint *params)
-{
- d_1_0_Core->f.TexParameteriv(target, pname, params);
-}
-
-inline void QOpenGLFunctions_1_5::glTexParameteri(GLenum target, GLenum pname, GLint param)
-{
- d_1_0_Core->f.TexParameteri(target, pname, param);
-}
-
-inline void QOpenGLFunctions_1_5::glTexParameterfv(GLenum target, GLenum pname, const GLfloat *params)
-{
- d_1_0_Core->f.TexParameterfv(target, pname, params);
-}
-
-inline void QOpenGLFunctions_1_5::glTexParameterf(GLenum target, GLenum pname, GLfloat param)
-{
- d_1_0_Core->f.TexParameterf(target, pname, param);
-}
-
-inline void QOpenGLFunctions_1_5::glScissor(GLint x, GLint y, GLsizei width, GLsizei height)
-{
- d_1_0_Core->f.Scissor(x, y, width, height);
-}
-
-inline void QOpenGLFunctions_1_5::glPolygonMode(GLenum face, GLenum mode)
-{
- d_1_0_Core->f.PolygonMode(face, mode);
-}
-
-inline void QOpenGLFunctions_1_5::glPointSize(GLfloat size)
-{
- d_1_0_Core->f.PointSize(size);
-}
-
-inline void QOpenGLFunctions_1_5::glLineWidth(GLfloat width)
-{
- d_1_0_Core->f.LineWidth(width);
-}
-
-inline void QOpenGLFunctions_1_5::glHint(GLenum target, GLenum mode)
-{
- d_1_0_Core->f.Hint(target, mode);
-}
-
-inline void QOpenGLFunctions_1_5::glFrontFace(GLenum mode)
-{
- d_1_0_Core->f.FrontFace(mode);
-}
-
-inline void QOpenGLFunctions_1_5::glCullFace(GLenum mode)
-{
- d_1_0_Core->f.CullFace(mode);
-}
-
-
-// OpenGL 1.1 core functions
-inline void QOpenGLFunctions_1_5::glIndexubv(const GLubyte *c)
-{
- d_1_1_Deprecated->f.Indexubv(c);
-}
-
-inline void QOpenGLFunctions_1_5::glIndexub(GLubyte c)
-{
- d_1_1_Deprecated->f.Indexub(c);
-}
-
-inline GLboolean QOpenGLFunctions_1_5::glIsTexture(GLuint texture)
-{
- return d_1_1_Core->f.IsTexture(texture);
-}
-
-inline void QOpenGLFunctions_1_5::glGenTextures(GLsizei n, GLuint *textures)
-{
- d_1_1_Core->f.GenTextures(n, textures);
-}
-
-inline void QOpenGLFunctions_1_5::glDeleteTextures(GLsizei n, const GLuint *textures)
-{
- d_1_1_Core->f.DeleteTextures(n, textures);
-}
-
-inline void QOpenGLFunctions_1_5::glBindTexture(GLenum target, GLuint texture)
-{
- d_1_1_Core->f.BindTexture(target, texture);
-}
-
-inline void QOpenGLFunctions_1_5::glTexSubImage2D(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLenum type, const GLvoid *pixels)
-{
- d_1_1_Core->f.TexSubImage2D(target, level, xoffset, yoffset, width, height, format, type, pixels);
-}
-
-inline void QOpenGLFunctions_1_5::glTexSubImage1D(GLenum target, GLint level, GLint xoffset, GLsizei width, GLenum format, GLenum type, const GLvoid *pixels)
-{
- d_1_1_Core->f.TexSubImage1D(target, level, xoffset, width, format, type, pixels);
-}
-
-inline void QOpenGLFunctions_1_5::glCopyTexSubImage2D(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint x, GLint y, GLsizei width, GLsizei height)
-{
- d_1_1_Core->f.CopyTexSubImage2D(target, level, xoffset, yoffset, x, y, width, height);
-}
-
-inline void QOpenGLFunctions_1_5::glCopyTexSubImage1D(GLenum target, GLint level, GLint xoffset, GLint x, GLint y, GLsizei width)
-{
- d_1_1_Core->f.CopyTexSubImage1D(target, level, xoffset, x, y, width);
-}
-
-inline void QOpenGLFunctions_1_5::glCopyTexImage2D(GLenum target, GLint level, GLenum internalformat, GLint x, GLint y, GLsizei width, GLsizei height, GLint border)
-{
- d_1_1_Core->f.CopyTexImage2D(target, level, internalformat, x, y, width, height, border);
-}
-
-inline void QOpenGLFunctions_1_5::glCopyTexImage1D(GLenum target, GLint level, GLenum internalformat, GLint x, GLint y, GLsizei width, GLint border)
-{
- d_1_1_Core->f.CopyTexImage1D(target, level, internalformat, x, y, width, border);
-}
-
-inline void QOpenGLFunctions_1_5::glPolygonOffset(GLfloat factor, GLfloat units)
-{
- d_1_1_Core->f.PolygonOffset(factor, units);
-}
-
-inline void QOpenGLFunctions_1_5::glGetPointerv(GLenum pname, GLvoid* *params)
-{
- d_1_1_Deprecated->f.GetPointerv(pname, params);
-}
-
-inline void QOpenGLFunctions_1_5::glDrawElements(GLenum mode, GLsizei count, GLenum type, const GLvoid *indices)
-{
- d_1_1_Core->f.DrawElements(mode, count, type, indices);
-}
-
-inline void QOpenGLFunctions_1_5::glDrawArrays(GLenum mode, GLint first, GLsizei count)
-{
- d_1_1_Core->f.DrawArrays(mode, first, count);
-}
-
-
-// OpenGL 1.2 core functions
-inline void QOpenGLFunctions_1_5::glCopyTexSubImage3D(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLint x, GLint y, GLsizei width, GLsizei height)
-{
- d_1_2_Core->f.CopyTexSubImage3D(target, level, xoffset, yoffset, zoffset, x, y, width, height);
-}
-
-inline void QOpenGLFunctions_1_5::glTexSubImage3D(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLenum type, const GLvoid *pixels)
-{
- d_1_2_Core->f.TexSubImage3D(target, level, xoffset, yoffset, zoffset, width, height, depth, format, type, pixels);
-}
-
-inline void QOpenGLFunctions_1_5::glTexImage3D(GLenum target, GLint level, GLint internalformat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLenum format, GLenum type, const GLvoid *pixels)
-{
- d_1_2_Core->f.TexImage3D(target, level, internalformat, width, height, depth, border, format, type, pixels);
-}
-
-inline void QOpenGLFunctions_1_5::glDrawRangeElements(GLenum mode, GLuint start, GLuint end, GLsizei count, GLenum type, const GLvoid *indices)
-{
- d_1_2_Core->f.DrawRangeElements(mode, start, end, count, type, indices);
-}
-
-inline void QOpenGLFunctions_1_5::glBlendEquation(GLenum mode)
-{
- d_1_2_Core->f.BlendEquation(mode);
-}
-
-inline void QOpenGLFunctions_1_5::glBlendColor(GLfloat red, GLfloat green, GLfloat blue, GLfloat alpha)
-{
- d_1_2_Core->f.BlendColor(red, green, blue, alpha);
-}
-
-
-// OpenGL 1.3 core functions
-inline void QOpenGLFunctions_1_5::glGetCompressedTexImage(GLenum target, GLint level, GLvoid *img)
-{
- d_1_3_Core->f.GetCompressedTexImage(target, level, img);
-}
-
-inline void QOpenGLFunctions_1_5::glCompressedTexSubImage1D(GLenum target, GLint level, GLint xoffset, GLsizei width, GLenum format, GLsizei imageSize, const GLvoid *data)
-{
- d_1_3_Core->f.CompressedTexSubImage1D(target, level, xoffset, width, format, imageSize, data);
-}
-
-inline void QOpenGLFunctions_1_5::glCompressedTexSubImage2D(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLsizei imageSize, const GLvoid *data)
-{
- d_1_3_Core->f.CompressedTexSubImage2D(target, level, xoffset, yoffset, width, height, format, imageSize, data);
-}
-
-inline void QOpenGLFunctions_1_5::glCompressedTexSubImage3D(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLsizei imageSize, const GLvoid *data)
-{
- d_1_3_Core->f.CompressedTexSubImage3D(target, level, xoffset, yoffset, zoffset, width, height, depth, format, imageSize, data);
-}
-
-inline void QOpenGLFunctions_1_5::glCompressedTexImage1D(GLenum target, GLint level, GLenum internalformat, GLsizei width, GLint border, GLsizei imageSize, const GLvoid *data)
-{
- d_1_3_Core->f.CompressedTexImage1D(target, level, internalformat, width, border, imageSize, data);
-}
-
-inline void QOpenGLFunctions_1_5::glCompressedTexImage2D(GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLint border, GLsizei imageSize, const GLvoid *data)
-{
- d_1_3_Core->f.CompressedTexImage2D(target, level, internalformat, width, height, border, imageSize, data);
-}
-
-inline void QOpenGLFunctions_1_5::glCompressedTexImage3D(GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLsizei imageSize, const GLvoid *data)
-{
- d_1_3_Core->f.CompressedTexImage3D(target, level, internalformat, width, height, depth, border, imageSize, data);
-}
-
-inline void QOpenGLFunctions_1_5::glSampleCoverage(GLfloat value, GLboolean invert)
-{
- d_1_3_Core->f.SampleCoverage(value, invert);
-}
-
-inline void QOpenGLFunctions_1_5::glActiveTexture(GLenum texture)
-{
- d_1_3_Core->f.ActiveTexture(texture);
-}
-
-
-// OpenGL 1.4 core functions
-inline void QOpenGLFunctions_1_5::glPointParameteriv(GLenum pname, const GLint *params)
-{
- d_1_4_Core->f.PointParameteriv(pname, params);
-}
-
-inline void QOpenGLFunctions_1_5::glPointParameteri(GLenum pname, GLint param)
-{
- d_1_4_Core->f.PointParameteri(pname, param);
-}
-
-inline void QOpenGLFunctions_1_5::glPointParameterfv(GLenum pname, const GLfloat *params)
-{
- d_1_4_Core->f.PointParameterfv(pname, params);
-}
-
-inline void QOpenGLFunctions_1_5::glPointParameterf(GLenum pname, GLfloat param)
-{
- d_1_4_Core->f.PointParameterf(pname, param);
-}
-
-inline void QOpenGLFunctions_1_5::glMultiDrawElements(GLenum mode, const GLsizei *count, GLenum type, const GLvoid* const *indices, GLsizei drawcount)
-{
- d_1_4_Core->f.MultiDrawElements(mode, count, type, indices, drawcount);
-}
-
-inline void QOpenGLFunctions_1_5::glMultiDrawArrays(GLenum mode, const GLint *first, const GLsizei *count, GLsizei drawcount)
-{
- d_1_4_Core->f.MultiDrawArrays(mode, first, count, drawcount);
-}
-
-inline void QOpenGLFunctions_1_5::glBlendFuncSeparate(GLenum sfactorRGB, GLenum dfactorRGB, GLenum sfactorAlpha, GLenum dfactorAlpha)
-{
- d_1_4_Core->f.BlendFuncSeparate(sfactorRGB, dfactorRGB, sfactorAlpha, dfactorAlpha);
-}
-
-
-// OpenGL 1.5 core functions
-inline void QOpenGLFunctions_1_5::glGetBufferPointerv(GLenum target, GLenum pname, GLvoid* *params)
-{
- d_1_5_Core->f.GetBufferPointerv(target, pname, params);
-}
-
-inline void QOpenGLFunctions_1_5::glGetBufferParameteriv(GLenum target, GLenum pname, GLint *params)
-{
- d_1_5_Core->f.GetBufferParameteriv(target, pname, params);
-}
-
-inline GLboolean QOpenGLFunctions_1_5::glUnmapBuffer(GLenum target)
-{
- return d_1_5_Core->f.UnmapBuffer(target);
-}
-
-inline GLvoid* QOpenGLFunctions_1_5::glMapBuffer(GLenum target, GLenum access)
-{
- return d_1_5_Core->f.MapBuffer(target, access);
-}
-
-inline void QOpenGLFunctions_1_5::glGetBufferSubData(GLenum target, GLintptr offset, GLsizeiptr size, GLvoid *data)
-{
- d_1_5_Core->f.GetBufferSubData(target, offset, size, data);
-}
-
-inline void QOpenGLFunctions_1_5::glBufferSubData(GLenum target, GLintptr offset, GLsizeiptr size, const GLvoid *data)
-{
- d_1_5_Core->f.BufferSubData(target, offset, size, data);
-}
-
-inline void QOpenGLFunctions_1_5::glBufferData(GLenum target, GLsizeiptr size, const GLvoid *data, GLenum usage)
-{
- d_1_5_Core->f.BufferData(target, size, data, usage);
-}
-
-inline GLboolean QOpenGLFunctions_1_5::glIsBuffer(GLuint buffer)
-{
- return d_1_5_Core->f.IsBuffer(buffer);
-}
-
-inline void QOpenGLFunctions_1_5::glGenBuffers(GLsizei n, GLuint *buffers)
-{
- d_1_5_Core->f.GenBuffers(n, buffers);
-}
-
-inline void QOpenGLFunctions_1_5::glDeleteBuffers(GLsizei n, const GLuint *buffers)
-{
- d_1_5_Core->f.DeleteBuffers(n, buffers);
-}
-
-inline void QOpenGLFunctions_1_5::glBindBuffer(GLenum target, GLuint buffer)
-{
- d_1_5_Core->f.BindBuffer(target, buffer);
-}
-
-inline void QOpenGLFunctions_1_5::glGetQueryObjectuiv(GLuint id, GLenum pname, GLuint *params)
-{
- d_1_5_Core->f.GetQueryObjectuiv(id, pname, params);
-}
-
-inline void QOpenGLFunctions_1_5::glGetQueryObjectiv(GLuint id, GLenum pname, GLint *params)
-{
- d_1_5_Core->f.GetQueryObjectiv(id, pname, params);
-}
-
-inline void QOpenGLFunctions_1_5::glGetQueryiv(GLenum target, GLenum pname, GLint *params)
-{
- d_1_5_Core->f.GetQueryiv(target, pname, params);
-}
-
-inline void QOpenGLFunctions_1_5::glEndQuery(GLenum target)
-{
- d_1_5_Core->f.EndQuery(target);
-}
-
-inline void QOpenGLFunctions_1_5::glBeginQuery(GLenum target, GLuint id)
-{
- d_1_5_Core->f.BeginQuery(target, id);
-}
-
-inline GLboolean QOpenGLFunctions_1_5::glIsQuery(GLuint id)
-{
- return d_1_5_Core->f.IsQuery(id);
-}
-
-inline void QOpenGLFunctions_1_5::glDeleteQueries(GLsizei n, const GLuint *ids)
-{
- d_1_5_Core->f.DeleteQueries(n, ids);
-}
-
-inline void QOpenGLFunctions_1_5::glGenQueries(GLsizei n, GLuint *ids)
-{
- d_1_5_Core->f.GenQueries(n, ids);
-}
-
-
-// OpenGL 1.0 deprecated functions
-inline void QOpenGLFunctions_1_5::glTranslatef(GLfloat x, GLfloat y, GLfloat z)
-{
- d_1_0_Deprecated->f.Translatef(x, y, z);
-}
-
-inline void QOpenGLFunctions_1_5::glTranslated(GLdouble x, GLdouble y, GLdouble z)
-{
- d_1_0_Deprecated->f.Translated(x, y, z);
-}
-
-inline void QOpenGLFunctions_1_5::glScalef(GLfloat x, GLfloat y, GLfloat z)
-{
- d_1_0_Deprecated->f.Scalef(x, y, z);
-}
-
-inline void QOpenGLFunctions_1_5::glScaled(GLdouble x, GLdouble y, GLdouble z)
-{
- d_1_0_Deprecated->f.Scaled(x, y, z);
-}
-
-inline void QOpenGLFunctions_1_5::glRotatef(GLfloat angle, GLfloat x, GLfloat y, GLfloat z)
-{
- d_1_0_Deprecated->f.Rotatef(angle, x, y, z);
-}
-
-inline void QOpenGLFunctions_1_5::glRotated(GLdouble angle, GLdouble x, GLdouble y, GLdouble z)
-{
- d_1_0_Deprecated->f.Rotated(angle, x, y, z);
-}
-
-inline void QOpenGLFunctions_1_5::glPushMatrix()
-{
- d_1_0_Deprecated->f.PushMatrix();
-}
-
-inline void QOpenGLFunctions_1_5::glPopMatrix()
-{
- d_1_0_Deprecated->f.PopMatrix();
-}
-
-inline void QOpenGLFunctions_1_5::glOrtho(GLdouble left, GLdouble right, GLdouble bottom, GLdouble top, GLdouble zNear, GLdouble zFar)
-{
- d_1_0_Deprecated->f.Ortho(left, right, bottom, top, zNear, zFar);
-}
-
-inline void QOpenGLFunctions_1_5::glMultMatrixd(const GLdouble *m)
-{
- d_1_0_Deprecated->f.MultMatrixd(m);
-}
-
-inline void QOpenGLFunctions_1_5::glMultMatrixf(const GLfloat *m)
-{
- d_1_0_Deprecated->f.MultMatrixf(m);
-}
-
-inline void QOpenGLFunctions_1_5::glMatrixMode(GLenum mode)
-{
- d_1_0_Deprecated->f.MatrixMode(mode);
-}
-
-inline void QOpenGLFunctions_1_5::glLoadMatrixd(const GLdouble *m)
-{
- d_1_0_Deprecated->f.LoadMatrixd(m);
-}
-
-inline void QOpenGLFunctions_1_5::glLoadMatrixf(const GLfloat *m)
-{
- d_1_0_Deprecated->f.LoadMatrixf(m);
-}
-
-inline void QOpenGLFunctions_1_5::glLoadIdentity()
-{
- d_1_0_Deprecated->f.LoadIdentity();
-}
-
-inline void QOpenGLFunctions_1_5::glFrustum(GLdouble left, GLdouble right, GLdouble bottom, GLdouble top, GLdouble zNear, GLdouble zFar)
-{
- d_1_0_Deprecated->f.Frustum(left, right, bottom, top, zNear, zFar);
-}
-
-inline GLboolean QOpenGLFunctions_1_5::glIsList(GLuint list)
-{
- return d_1_0_Deprecated->f.IsList(list);
-}
-
-inline void QOpenGLFunctions_1_5::glGetTexGeniv(GLenum coord, GLenum pname, GLint *params)
-{
- d_1_0_Deprecated->f.GetTexGeniv(coord, pname, params);
-}
-
-inline void QOpenGLFunctions_1_5::glGetTexGenfv(GLenum coord, GLenum pname, GLfloat *params)
-{
- d_1_0_Deprecated->f.GetTexGenfv(coord, pname, params);
-}
-
-inline void QOpenGLFunctions_1_5::glGetTexGendv(GLenum coord, GLenum pname, GLdouble *params)
-{
- d_1_0_Deprecated->f.GetTexGendv(coord, pname, params);
-}
-
-inline void QOpenGLFunctions_1_5::glGetTexEnviv(GLenum target, GLenum pname, GLint *params)
-{
- d_1_0_Deprecated->f.GetTexEnviv(target, pname, params);
-}
-
-inline void QOpenGLFunctions_1_5::glGetTexEnvfv(GLenum target, GLenum pname, GLfloat *params)
-{
- d_1_0_Deprecated->f.GetTexEnvfv(target, pname, params);
-}
-
-inline void QOpenGLFunctions_1_5::glGetPolygonStipple(GLubyte *mask)
-{
- d_1_0_Deprecated->f.GetPolygonStipple(mask);
-}
-
-inline void QOpenGLFunctions_1_5::glGetPixelMapusv(GLenum map, GLushort *values)
-{
- d_1_0_Deprecated->f.GetPixelMapusv(map, values);
-}
-
-inline void QOpenGLFunctions_1_5::glGetPixelMapuiv(GLenum map, GLuint *values)
-{
- d_1_0_Deprecated->f.GetPixelMapuiv(map, values);
-}
-
-inline void QOpenGLFunctions_1_5::glGetPixelMapfv(GLenum map, GLfloat *values)
-{
- d_1_0_Deprecated->f.GetPixelMapfv(map, values);
-}
-
-inline void QOpenGLFunctions_1_5::glGetMaterialiv(GLenum face, GLenum pname, GLint *params)
-{
- d_1_0_Deprecated->f.GetMaterialiv(face, pname, params);
-}
-
-inline void QOpenGLFunctions_1_5::glGetMaterialfv(GLenum face, GLenum pname, GLfloat *params)
-{
- d_1_0_Deprecated->f.GetMaterialfv(face, pname, params);
-}
-
-inline void QOpenGLFunctions_1_5::glGetMapiv(GLenum target, GLenum query, GLint *v)
-{
- d_1_0_Deprecated->f.GetMapiv(target, query, v);
-}
-
-inline void QOpenGLFunctions_1_5::glGetMapfv(GLenum target, GLenum query, GLfloat *v)
-{
- d_1_0_Deprecated->f.GetMapfv(target, query, v);
-}
-
-inline void QOpenGLFunctions_1_5::glGetMapdv(GLenum target, GLenum query, GLdouble *v)
-{
- d_1_0_Deprecated->f.GetMapdv(target, query, v);
-}
-
-inline void QOpenGLFunctions_1_5::glGetLightiv(GLenum light, GLenum pname, GLint *params)
-{
- d_1_0_Deprecated->f.GetLightiv(light, pname, params);
-}
-
-inline void QOpenGLFunctions_1_5::glGetLightfv(GLenum light, GLenum pname, GLfloat *params)
-{
- d_1_0_Deprecated->f.GetLightfv(light, pname, params);
-}
-
-inline void QOpenGLFunctions_1_5::glGetClipPlane(GLenum plane, GLdouble *equation)
-{
- d_1_0_Deprecated->f.GetClipPlane(plane, equation);
-}
-
-inline void QOpenGLFunctions_1_5::glDrawPixels(GLsizei width, GLsizei height, GLenum format, GLenum type, const GLvoid *pixels)
-{
- d_1_0_Deprecated->f.DrawPixels(width, height, format, type, pixels);
-}
-
-inline void QOpenGLFunctions_1_5::glCopyPixels(GLint x, GLint y, GLsizei width, GLsizei height, GLenum type)
-{
- d_1_0_Deprecated->f.CopyPixels(x, y, width, height, type);
-}
-
-inline void QOpenGLFunctions_1_5::glPixelMapusv(GLenum map, GLint mapsize, const GLushort *values)
-{
- d_1_0_Deprecated->f.PixelMapusv(map, mapsize, values);
-}
-
-inline void QOpenGLFunctions_1_5::glPixelMapuiv(GLenum map, GLint mapsize, const GLuint *values)
-{
- d_1_0_Deprecated->f.PixelMapuiv(map, mapsize, values);
-}
-
-inline void QOpenGLFunctions_1_5::glPixelMapfv(GLenum map, GLint mapsize, const GLfloat *values)
-{
- d_1_0_Deprecated->f.PixelMapfv(map, mapsize, values);
-}
-
-inline void QOpenGLFunctions_1_5::glPixelTransferi(GLenum pname, GLint param)
-{
- d_1_0_Deprecated->f.PixelTransferi(pname, param);
-}
-
-inline void QOpenGLFunctions_1_5::glPixelTransferf(GLenum pname, GLfloat param)
-{
- d_1_0_Deprecated->f.PixelTransferf(pname, param);
-}
-
-inline void QOpenGLFunctions_1_5::glPixelZoom(GLfloat xfactor, GLfloat yfactor)
-{
- d_1_0_Deprecated->f.PixelZoom(xfactor, yfactor);
-}
-
-inline void QOpenGLFunctions_1_5::glAlphaFunc(GLenum func, GLfloat ref)
-{
- d_1_0_Deprecated->f.AlphaFunc(func, ref);
-}
-
-inline void QOpenGLFunctions_1_5::glEvalPoint2(GLint i, GLint j)
-{
- d_1_0_Deprecated->f.EvalPoint2(i, j);
-}
-
-inline void QOpenGLFunctions_1_5::glEvalMesh2(GLenum mode, GLint i1, GLint i2, GLint j1, GLint j2)
-{
- d_1_0_Deprecated->f.EvalMesh2(mode, i1, i2, j1, j2);
-}
-
-inline void QOpenGLFunctions_1_5::glEvalPoint1(GLint i)
-{
- d_1_0_Deprecated->f.EvalPoint1(i);
-}
-
-inline void QOpenGLFunctions_1_5::glEvalMesh1(GLenum mode, GLint i1, GLint i2)
-{
- d_1_0_Deprecated->f.EvalMesh1(mode, i1, i2);
-}
-
-inline void QOpenGLFunctions_1_5::glEvalCoord2fv(const GLfloat *u)
-{
- d_1_0_Deprecated->f.EvalCoord2fv(u);
-}
-
-inline void QOpenGLFunctions_1_5::glEvalCoord2f(GLfloat u, GLfloat v)
-{
- d_1_0_Deprecated->f.EvalCoord2f(u, v);
-}
-
-inline void QOpenGLFunctions_1_5::glEvalCoord2dv(const GLdouble *u)
-{
- d_1_0_Deprecated->f.EvalCoord2dv(u);
-}
-
-inline void QOpenGLFunctions_1_5::glEvalCoord2d(GLdouble u, GLdouble v)
-{
- d_1_0_Deprecated->f.EvalCoord2d(u, v);
-}
-
-inline void QOpenGLFunctions_1_5::glEvalCoord1fv(const GLfloat *u)
-{
- d_1_0_Deprecated->f.EvalCoord1fv(u);
-}
-
-inline void QOpenGLFunctions_1_5::glEvalCoord1f(GLfloat u)
-{
- d_1_0_Deprecated->f.EvalCoord1f(u);
-}
-
-inline void QOpenGLFunctions_1_5::glEvalCoord1dv(const GLdouble *u)
-{
- d_1_0_Deprecated->f.EvalCoord1dv(u);
-}
-
-inline void QOpenGLFunctions_1_5::glEvalCoord1d(GLdouble u)
-{
- d_1_0_Deprecated->f.EvalCoord1d(u);
-}
-
-inline void QOpenGLFunctions_1_5::glMapGrid2f(GLint un, GLfloat u1, GLfloat u2, GLint vn, GLfloat v1, GLfloat v2)
-{
- d_1_0_Deprecated->f.MapGrid2f(un, u1, u2, vn, v1, v2);
-}
-
-inline void QOpenGLFunctions_1_5::glMapGrid2d(GLint un, GLdouble u1, GLdouble u2, GLint vn, GLdouble v1, GLdouble v2)
-{
- d_1_0_Deprecated->f.MapGrid2d(un, u1, u2, vn, v1, v2);
-}
-
-inline void QOpenGLFunctions_1_5::glMapGrid1f(GLint un, GLfloat u1, GLfloat u2)
-{
- d_1_0_Deprecated->f.MapGrid1f(un, u1, u2);
-}
-
-inline void QOpenGLFunctions_1_5::glMapGrid1d(GLint un, GLdouble u1, GLdouble u2)
-{
- d_1_0_Deprecated->f.MapGrid1d(un, u1, u2);
-}
-
-inline void QOpenGLFunctions_1_5::glMap2f(GLenum target, GLfloat u1, GLfloat u2, GLint ustride, GLint uorder, GLfloat v1, GLfloat v2, GLint vstride, GLint vorder, const GLfloat *points)
-{
- d_1_0_Deprecated->f.Map2f(target, u1, u2, ustride, uorder, v1, v2, vstride, vorder, points);
-}
-
-inline void QOpenGLFunctions_1_5::glMap2d(GLenum target, GLdouble u1, GLdouble u2, GLint ustride, GLint uorder, GLdouble v1, GLdouble v2, GLint vstride, GLint vorder, const GLdouble *points)
-{
- d_1_0_Deprecated->f.Map2d(target, u1, u2, ustride, uorder, v1, v2, vstride, vorder, points);
-}
-
-inline void QOpenGLFunctions_1_5::glMap1f(GLenum target, GLfloat u1, GLfloat u2, GLint stride, GLint order, const GLfloat *points)
-{
- d_1_0_Deprecated->f.Map1f(target, u1, u2, stride, order, points);
-}
-
-inline void QOpenGLFunctions_1_5::glMap1d(GLenum target, GLdouble u1, GLdouble u2, GLint stride, GLint order, const GLdouble *points)
-{
- d_1_0_Deprecated->f.Map1d(target, u1, u2, stride, order, points);
-}
-
-inline void QOpenGLFunctions_1_5::glPushAttrib(GLbitfield mask)
-{
- d_1_0_Deprecated->f.PushAttrib(mask);
-}
-
-inline void QOpenGLFunctions_1_5::glPopAttrib()
-{
- d_1_0_Deprecated->f.PopAttrib();
-}
-
-inline void QOpenGLFunctions_1_5::glAccum(GLenum op, GLfloat value)
-{
- d_1_0_Deprecated->f.Accum(op, value);
-}
-
-inline void QOpenGLFunctions_1_5::glIndexMask(GLuint mask)
-{
- d_1_0_Deprecated->f.IndexMask(mask);
-}
-
-inline void QOpenGLFunctions_1_5::glClearIndex(GLfloat c)
-{
- d_1_0_Deprecated->f.ClearIndex(c);
-}
-
-inline void QOpenGLFunctions_1_5::glClearAccum(GLfloat red, GLfloat green, GLfloat blue, GLfloat alpha)
-{
- d_1_0_Deprecated->f.ClearAccum(red, green, blue, alpha);
-}
-
-inline void QOpenGLFunctions_1_5::glPushName(GLuint name)
-{
- d_1_0_Deprecated->f.PushName(name);
-}
-
-inline void QOpenGLFunctions_1_5::glPopName()
-{
- d_1_0_Deprecated->f.PopName();
-}
-
-inline void QOpenGLFunctions_1_5::glPassThrough(GLfloat token)
-{
- d_1_0_Deprecated->f.PassThrough(token);
-}
-
-inline void QOpenGLFunctions_1_5::glLoadName(GLuint name)
-{
- d_1_0_Deprecated->f.LoadName(name);
-}
-
-inline void QOpenGLFunctions_1_5::glInitNames()
-{
- d_1_0_Deprecated->f.InitNames();
-}
-
-inline GLint QOpenGLFunctions_1_5::glRenderMode(GLenum mode)
-{
- return d_1_0_Deprecated->f.RenderMode(mode);
-}
-
-inline void QOpenGLFunctions_1_5::glSelectBuffer(GLsizei size, GLuint *buffer)
-{
- d_1_0_Deprecated->f.SelectBuffer(size, buffer);
-}
-
-inline void QOpenGLFunctions_1_5::glFeedbackBuffer(GLsizei size, GLenum type, GLfloat *buffer)
-{
- d_1_0_Deprecated->f.FeedbackBuffer(size, type, buffer);
-}
-
-inline void QOpenGLFunctions_1_5::glTexGeniv(GLenum coord, GLenum pname, const GLint *params)
-{
- d_1_0_Deprecated->f.TexGeniv(coord, pname, params);
-}
-
-inline void QOpenGLFunctions_1_5::glTexGeni(GLenum coord, GLenum pname, GLint param)
-{
- d_1_0_Deprecated->f.TexGeni(coord, pname, param);
-}
-
-inline void QOpenGLFunctions_1_5::glTexGenfv(GLenum coord, GLenum pname, const GLfloat *params)
-{
- d_1_0_Deprecated->f.TexGenfv(coord, pname, params);
-}
-
-inline void QOpenGLFunctions_1_5::glTexGenf(GLenum coord, GLenum pname, GLfloat param)
-{
- d_1_0_Deprecated->f.TexGenf(coord, pname, param);
-}
-
-inline void QOpenGLFunctions_1_5::glTexGendv(GLenum coord, GLenum pname, const GLdouble *params)
-{
- d_1_0_Deprecated->f.TexGendv(coord, pname, params);
-}
-
-inline void QOpenGLFunctions_1_5::glTexGend(GLenum coord, GLenum pname, GLdouble param)
-{
- d_1_0_Deprecated->f.TexGend(coord, pname, param);
-}
-
-inline void QOpenGLFunctions_1_5::glTexEnviv(GLenum target, GLenum pname, const GLint *params)
-{
- d_1_0_Deprecated->f.TexEnviv(target, pname, params);
-}
-
-inline void QOpenGLFunctions_1_5::glTexEnvi(GLenum target, GLenum pname, GLint param)
-{
- d_1_0_Deprecated->f.TexEnvi(target, pname, param);
-}
-
-inline void QOpenGLFunctions_1_5::glTexEnvfv(GLenum target, GLenum pname, const GLfloat *params)
-{
- d_1_0_Deprecated->f.TexEnvfv(target, pname, params);
-}
-
-inline void QOpenGLFunctions_1_5::glTexEnvf(GLenum target, GLenum pname, GLfloat param)
-{
- d_1_0_Deprecated->f.TexEnvf(target, pname, param);
-}
-
-inline void QOpenGLFunctions_1_5::glShadeModel(GLenum mode)
-{
- d_1_0_Deprecated->f.ShadeModel(mode);
-}
-
-inline void QOpenGLFunctions_1_5::glPolygonStipple(const GLubyte *mask)
-{
- d_1_0_Deprecated->f.PolygonStipple(mask);
-}
-
-inline void QOpenGLFunctions_1_5::glMaterialiv(GLenum face, GLenum pname, const GLint *params)
-{
- d_1_0_Deprecated->f.Materialiv(face, pname, params);
-}
-
-inline void QOpenGLFunctions_1_5::glMateriali(GLenum face, GLenum pname, GLint param)
-{
- d_1_0_Deprecated->f.Materiali(face, pname, param);
-}
-
-inline void QOpenGLFunctions_1_5::glMaterialfv(GLenum face, GLenum pname, const GLfloat *params)
-{
- d_1_0_Deprecated->f.Materialfv(face, pname, params);
-}
-
-inline void QOpenGLFunctions_1_5::glMaterialf(GLenum face, GLenum pname, GLfloat param)
-{
- d_1_0_Deprecated->f.Materialf(face, pname, param);
-}
-
-inline void QOpenGLFunctions_1_5::glLineStipple(GLint factor, GLushort pattern)
-{
- d_1_0_Deprecated->f.LineStipple(factor, pattern);
-}
-
-inline void QOpenGLFunctions_1_5::glLightModeliv(GLenum pname, const GLint *params)
-{
- d_1_0_Deprecated->f.LightModeliv(pname, params);
-}
-
-inline void QOpenGLFunctions_1_5::glLightModeli(GLenum pname, GLint param)
-{
- d_1_0_Deprecated->f.LightModeli(pname, param);
-}
-
-inline void QOpenGLFunctions_1_5::glLightModelfv(GLenum pname, const GLfloat *params)
-{
- d_1_0_Deprecated->f.LightModelfv(pname, params);
-}
-
-inline void QOpenGLFunctions_1_5::glLightModelf(GLenum pname, GLfloat param)
-{
- d_1_0_Deprecated->f.LightModelf(pname, param);
-}
-
-inline void QOpenGLFunctions_1_5::glLightiv(GLenum light, GLenum pname, const GLint *params)
-{
- d_1_0_Deprecated->f.Lightiv(light, pname, params);
-}
-
-inline void QOpenGLFunctions_1_5::glLighti(GLenum light, GLenum pname, GLint param)
-{
- d_1_0_Deprecated->f.Lighti(light, pname, param);
-}
-
-inline void QOpenGLFunctions_1_5::glLightfv(GLenum light, GLenum pname, const GLfloat *params)
-{
- d_1_0_Deprecated->f.Lightfv(light, pname, params);
-}
-
-inline void QOpenGLFunctions_1_5::glLightf(GLenum light, GLenum pname, GLfloat param)
-{
- d_1_0_Deprecated->f.Lightf(light, pname, param);
-}
-
-inline void QOpenGLFunctions_1_5::glFogiv(GLenum pname, const GLint *params)
-{
- d_1_0_Deprecated->f.Fogiv(pname, params);
-}
-
-inline void QOpenGLFunctions_1_5::glFogi(GLenum pname, GLint param)
-{
- d_1_0_Deprecated->f.Fogi(pname, param);
-}
-
-inline void QOpenGLFunctions_1_5::glFogfv(GLenum pname, const GLfloat *params)
-{
- d_1_0_Deprecated->f.Fogfv(pname, params);
-}
-
-inline void QOpenGLFunctions_1_5::glFogf(GLenum pname, GLfloat param)
-{
- d_1_0_Deprecated->f.Fogf(pname, param);
-}
-
-inline void QOpenGLFunctions_1_5::glColorMaterial(GLenum face, GLenum mode)
-{
- d_1_0_Deprecated->f.ColorMaterial(face, mode);
-}
-
-inline void QOpenGLFunctions_1_5::glClipPlane(GLenum plane, const GLdouble *equation)
-{
- d_1_0_Deprecated->f.ClipPlane(plane, equation);
-}
-
-inline void QOpenGLFunctions_1_5::glVertex4sv(const GLshort *v)
-{
- d_1_0_Deprecated->f.Vertex4sv(v);
-}
-
-inline void QOpenGLFunctions_1_5::glVertex4s(GLshort x, GLshort y, GLshort z, GLshort w)
-{
- d_1_0_Deprecated->f.Vertex4s(x, y, z, w);
-}
-
-inline void QOpenGLFunctions_1_5::glVertex4iv(const GLint *v)
-{
- d_1_0_Deprecated->f.Vertex4iv(v);
-}
-
-inline void QOpenGLFunctions_1_5::glVertex4i(GLint x, GLint y, GLint z, GLint w)
-{
- d_1_0_Deprecated->f.Vertex4i(x, y, z, w);
-}
-
-inline void QOpenGLFunctions_1_5::glVertex4fv(const GLfloat *v)
-{
- d_1_0_Deprecated->f.Vertex4fv(v);
-}
-
-inline void QOpenGLFunctions_1_5::glVertex4f(GLfloat x, GLfloat y, GLfloat z, GLfloat w)
-{
- d_1_0_Deprecated->f.Vertex4f(x, y, z, w);
-}
-
-inline void QOpenGLFunctions_1_5::glVertex4dv(const GLdouble *v)
-{
- d_1_0_Deprecated->f.Vertex4dv(v);
-}
-
-inline void QOpenGLFunctions_1_5::glVertex4d(GLdouble x, GLdouble y, GLdouble z, GLdouble w)
-{
- d_1_0_Deprecated->f.Vertex4d(x, y, z, w);
-}
-
-inline void QOpenGLFunctions_1_5::glVertex3sv(const GLshort *v)
-{
- d_1_0_Deprecated->f.Vertex3sv(v);
-}
-
-inline void QOpenGLFunctions_1_5::glVertex3s(GLshort x, GLshort y, GLshort z)
-{
- d_1_0_Deprecated->f.Vertex3s(x, y, z);
-}
-
-inline void QOpenGLFunctions_1_5::glVertex3iv(const GLint *v)
-{
- d_1_0_Deprecated->f.Vertex3iv(v);
-}
-
-inline void QOpenGLFunctions_1_5::glVertex3i(GLint x, GLint y, GLint z)
-{
- d_1_0_Deprecated->f.Vertex3i(x, y, z);
-}
-
-inline void QOpenGLFunctions_1_5::glVertex3fv(const GLfloat *v)
-{
- d_1_0_Deprecated->f.Vertex3fv(v);
-}
-
-inline void QOpenGLFunctions_1_5::glVertex3f(GLfloat x, GLfloat y, GLfloat z)
-{
- d_1_0_Deprecated->f.Vertex3f(x, y, z);
-}
-
-inline void QOpenGLFunctions_1_5::glVertex3dv(const GLdouble *v)
-{
- d_1_0_Deprecated->f.Vertex3dv(v);
-}
-
-inline void QOpenGLFunctions_1_5::glVertex3d(GLdouble x, GLdouble y, GLdouble z)
-{
- d_1_0_Deprecated->f.Vertex3d(x, y, z);
-}
-
-inline void QOpenGLFunctions_1_5::glVertex2sv(const GLshort *v)
-{
- d_1_0_Deprecated->f.Vertex2sv(v);
-}
-
-inline void QOpenGLFunctions_1_5::glVertex2s(GLshort x, GLshort y)
-{
- d_1_0_Deprecated->f.Vertex2s(x, y);
-}
-
-inline void QOpenGLFunctions_1_5::glVertex2iv(const GLint *v)
-{
- d_1_0_Deprecated->f.Vertex2iv(v);
-}
-
-inline void QOpenGLFunctions_1_5::glVertex2i(GLint x, GLint y)
-{
- d_1_0_Deprecated->f.Vertex2i(x, y);
-}
-
-inline void QOpenGLFunctions_1_5::glVertex2fv(const GLfloat *v)
-{
- d_1_0_Deprecated->f.Vertex2fv(v);
-}
-
-inline void QOpenGLFunctions_1_5::glVertex2f(GLfloat x, GLfloat y)
-{
- d_1_0_Deprecated->f.Vertex2f(x, y);
-}
-
-inline void QOpenGLFunctions_1_5::glVertex2dv(const GLdouble *v)
-{
- d_1_0_Deprecated->f.Vertex2dv(v);
-}
-
-inline void QOpenGLFunctions_1_5::glVertex2d(GLdouble x, GLdouble y)
-{
- d_1_0_Deprecated->f.Vertex2d(x, y);
-}
-
-inline void QOpenGLFunctions_1_5::glTexCoord4sv(const GLshort *v)
-{
- d_1_0_Deprecated->f.TexCoord4sv(v);
-}
-
-inline void QOpenGLFunctions_1_5::glTexCoord4s(GLshort s, GLshort t, GLshort r, GLshort q)
-{
- d_1_0_Deprecated->f.TexCoord4s(s, t, r, q);
-}
-
-inline void QOpenGLFunctions_1_5::glTexCoord4iv(const GLint *v)
-{
- d_1_0_Deprecated->f.TexCoord4iv(v);
-}
-
-inline void QOpenGLFunctions_1_5::glTexCoord4i(GLint s, GLint t, GLint r, GLint q)
-{
- d_1_0_Deprecated->f.TexCoord4i(s, t, r, q);
-}
-
-inline void QOpenGLFunctions_1_5::glTexCoord4fv(const GLfloat *v)
-{
- d_1_0_Deprecated->f.TexCoord4fv(v);
-}
-
-inline void QOpenGLFunctions_1_5::glTexCoord4f(GLfloat s, GLfloat t, GLfloat r, GLfloat q)
-{
- d_1_0_Deprecated->f.TexCoord4f(s, t, r, q);
-}
-
-inline void QOpenGLFunctions_1_5::glTexCoord4dv(const GLdouble *v)
-{
- d_1_0_Deprecated->f.TexCoord4dv(v);
-}
-
-inline void QOpenGLFunctions_1_5::glTexCoord4d(GLdouble s, GLdouble t, GLdouble r, GLdouble q)
-{
- d_1_0_Deprecated->f.TexCoord4d(s, t, r, q);
-}
-
-inline void QOpenGLFunctions_1_5::glTexCoord3sv(const GLshort *v)
-{
- d_1_0_Deprecated->f.TexCoord3sv(v);
-}
-
-inline void QOpenGLFunctions_1_5::glTexCoord3s(GLshort s, GLshort t, GLshort r)
-{
- d_1_0_Deprecated->f.TexCoord3s(s, t, r);
-}
-
-inline void QOpenGLFunctions_1_5::glTexCoord3iv(const GLint *v)
-{
- d_1_0_Deprecated->f.TexCoord3iv(v);
-}
-
-inline void QOpenGLFunctions_1_5::glTexCoord3i(GLint s, GLint t, GLint r)
-{
- d_1_0_Deprecated->f.TexCoord3i(s, t, r);
-}
-
-inline void QOpenGLFunctions_1_5::glTexCoord3fv(const GLfloat *v)
-{
- d_1_0_Deprecated->f.TexCoord3fv(v);
-}
-
-inline void QOpenGLFunctions_1_5::glTexCoord3f(GLfloat s, GLfloat t, GLfloat r)
-{
- d_1_0_Deprecated->f.TexCoord3f(s, t, r);
-}
-
-inline void QOpenGLFunctions_1_5::glTexCoord3dv(const GLdouble *v)
-{
- d_1_0_Deprecated->f.TexCoord3dv(v);
-}
-
-inline void QOpenGLFunctions_1_5::glTexCoord3d(GLdouble s, GLdouble t, GLdouble r)
-{
- d_1_0_Deprecated->f.TexCoord3d(s, t, r);
-}
-
-inline void QOpenGLFunctions_1_5::glTexCoord2sv(const GLshort *v)
-{
- d_1_0_Deprecated->f.TexCoord2sv(v);
-}
-
-inline void QOpenGLFunctions_1_5::glTexCoord2s(GLshort s, GLshort t)
-{
- d_1_0_Deprecated->f.TexCoord2s(s, t);
-}
-
-inline void QOpenGLFunctions_1_5::glTexCoord2iv(const GLint *v)
-{
- d_1_0_Deprecated->f.TexCoord2iv(v);
-}
-
-inline void QOpenGLFunctions_1_5::glTexCoord2i(GLint s, GLint t)
-{
- d_1_0_Deprecated->f.TexCoord2i(s, t);
-}
-
-inline void QOpenGLFunctions_1_5::glTexCoord2fv(const GLfloat *v)
-{
- d_1_0_Deprecated->f.TexCoord2fv(v);
-}
-
-inline void QOpenGLFunctions_1_5::glTexCoord2f(GLfloat s, GLfloat t)
-{
- d_1_0_Deprecated->f.TexCoord2f(s, t);
-}
-
-inline void QOpenGLFunctions_1_5::glTexCoord2dv(const GLdouble *v)
-{
- d_1_0_Deprecated->f.TexCoord2dv(v);
-}
-
-inline void QOpenGLFunctions_1_5::glTexCoord2d(GLdouble s, GLdouble t)
-{
- d_1_0_Deprecated->f.TexCoord2d(s, t);
-}
-
-inline void QOpenGLFunctions_1_5::glTexCoord1sv(const GLshort *v)
-{
- d_1_0_Deprecated->f.TexCoord1sv(v);
-}
-
-inline void QOpenGLFunctions_1_5::glTexCoord1s(GLshort s)
-{
- d_1_0_Deprecated->f.TexCoord1s(s);
-}
-
-inline void QOpenGLFunctions_1_5::glTexCoord1iv(const GLint *v)
-{
- d_1_0_Deprecated->f.TexCoord1iv(v);
-}
-
-inline void QOpenGLFunctions_1_5::glTexCoord1i(GLint s)
-{
- d_1_0_Deprecated->f.TexCoord1i(s);
-}
-
-inline void QOpenGLFunctions_1_5::glTexCoord1fv(const GLfloat *v)
-{
- d_1_0_Deprecated->f.TexCoord1fv(v);
-}
-
-inline void QOpenGLFunctions_1_5::glTexCoord1f(GLfloat s)
-{
- d_1_0_Deprecated->f.TexCoord1f(s);
-}
-
-inline void QOpenGLFunctions_1_5::glTexCoord1dv(const GLdouble *v)
-{
- d_1_0_Deprecated->f.TexCoord1dv(v);
-}
-
-inline void QOpenGLFunctions_1_5::glTexCoord1d(GLdouble s)
-{
- d_1_0_Deprecated->f.TexCoord1d(s);
-}
-
-inline void QOpenGLFunctions_1_5::glRectsv(const GLshort *v1, const GLshort *v2)
-{
- d_1_0_Deprecated->f.Rectsv(v1, v2);
-}
-
-inline void QOpenGLFunctions_1_5::glRects(GLshort x1, GLshort y1, GLshort x2, GLshort y2)
-{
- d_1_0_Deprecated->f.Rects(x1, y1, x2, y2);
-}
-
-inline void QOpenGLFunctions_1_5::glRectiv(const GLint *v1, const GLint *v2)
-{
- d_1_0_Deprecated->f.Rectiv(v1, v2);
-}
-
-inline void QOpenGLFunctions_1_5::glRecti(GLint x1, GLint y1, GLint x2, GLint y2)
-{
- d_1_0_Deprecated->f.Recti(x1, y1, x2, y2);
-}
-
-inline void QOpenGLFunctions_1_5::glRectfv(const GLfloat *v1, const GLfloat *v2)
-{
- d_1_0_Deprecated->f.Rectfv(v1, v2);
-}
-
-inline void QOpenGLFunctions_1_5::glRectf(GLfloat x1, GLfloat y1, GLfloat x2, GLfloat y2)
-{
- d_1_0_Deprecated->f.Rectf(x1, y1, x2, y2);
-}
-
-inline void QOpenGLFunctions_1_5::glRectdv(const GLdouble *v1, const GLdouble *v2)
-{
- d_1_0_Deprecated->f.Rectdv(v1, v2);
-}
-
-inline void QOpenGLFunctions_1_5::glRectd(GLdouble x1, GLdouble y1, GLdouble x2, GLdouble y2)
-{
- d_1_0_Deprecated->f.Rectd(x1, y1, x2, y2);
-}
-
-inline void QOpenGLFunctions_1_5::glRasterPos4sv(const GLshort *v)
-{
- d_1_0_Deprecated->f.RasterPos4sv(v);
-}
-
-inline void QOpenGLFunctions_1_5::glRasterPos4s(GLshort x, GLshort y, GLshort z, GLshort w)
-{
- d_1_0_Deprecated->f.RasterPos4s(x, y, z, w);
-}
-
-inline void QOpenGLFunctions_1_5::glRasterPos4iv(const GLint *v)
-{
- d_1_0_Deprecated->f.RasterPos4iv(v);
-}
-
-inline void QOpenGLFunctions_1_5::glRasterPos4i(GLint x, GLint y, GLint z, GLint w)
-{
- d_1_0_Deprecated->f.RasterPos4i(x, y, z, w);
-}
-
-inline void QOpenGLFunctions_1_5::glRasterPos4fv(const GLfloat *v)
-{
- d_1_0_Deprecated->f.RasterPos4fv(v);
-}
-
-inline void QOpenGLFunctions_1_5::glRasterPos4f(GLfloat x, GLfloat y, GLfloat z, GLfloat w)
-{
- d_1_0_Deprecated->f.RasterPos4f(x, y, z, w);
-}
-
-inline void QOpenGLFunctions_1_5::glRasterPos4dv(const GLdouble *v)
-{
- d_1_0_Deprecated->f.RasterPos4dv(v);
-}
-
-inline void QOpenGLFunctions_1_5::glRasterPos4d(GLdouble x, GLdouble y, GLdouble z, GLdouble w)
-{
- d_1_0_Deprecated->f.RasterPos4d(x, y, z, w);
-}
-
-inline void QOpenGLFunctions_1_5::glRasterPos3sv(const GLshort *v)
-{
- d_1_0_Deprecated->f.RasterPos3sv(v);
-}
-
-inline void QOpenGLFunctions_1_5::glRasterPos3s(GLshort x, GLshort y, GLshort z)
-{
- d_1_0_Deprecated->f.RasterPos3s(x, y, z);
-}
-
-inline void QOpenGLFunctions_1_5::glRasterPos3iv(const GLint *v)
-{
- d_1_0_Deprecated->f.RasterPos3iv(v);
-}
-
-inline void QOpenGLFunctions_1_5::glRasterPos3i(GLint x, GLint y, GLint z)
-{
- d_1_0_Deprecated->f.RasterPos3i(x, y, z);
-}
-
-inline void QOpenGLFunctions_1_5::glRasterPos3fv(const GLfloat *v)
-{
- d_1_0_Deprecated->f.RasterPos3fv(v);
-}
-
-inline void QOpenGLFunctions_1_5::glRasterPos3f(GLfloat x, GLfloat y, GLfloat z)
-{
- d_1_0_Deprecated->f.RasterPos3f(x, y, z);
-}
-
-inline void QOpenGLFunctions_1_5::glRasterPos3dv(const GLdouble *v)
-{
- d_1_0_Deprecated->f.RasterPos3dv(v);
-}
-
-inline void QOpenGLFunctions_1_5::glRasterPos3d(GLdouble x, GLdouble y, GLdouble z)
-{
- d_1_0_Deprecated->f.RasterPos3d(x, y, z);
-}
-
-inline void QOpenGLFunctions_1_5::glRasterPos2sv(const GLshort *v)
-{
- d_1_0_Deprecated->f.RasterPos2sv(v);
-}
-
-inline void QOpenGLFunctions_1_5::glRasterPos2s(GLshort x, GLshort y)
-{
- d_1_0_Deprecated->f.RasterPos2s(x, y);
-}
-
-inline void QOpenGLFunctions_1_5::glRasterPos2iv(const GLint *v)
-{
- d_1_0_Deprecated->f.RasterPos2iv(v);
-}
-
-inline void QOpenGLFunctions_1_5::glRasterPos2i(GLint x, GLint y)
-{
- d_1_0_Deprecated->f.RasterPos2i(x, y);
-}
-
-inline void QOpenGLFunctions_1_5::glRasterPos2fv(const GLfloat *v)
-{
- d_1_0_Deprecated->f.RasterPos2fv(v);
-}
-
-inline void QOpenGLFunctions_1_5::glRasterPos2f(GLfloat x, GLfloat y)
-{
- d_1_0_Deprecated->f.RasterPos2f(x, y);
-}
-
-inline void QOpenGLFunctions_1_5::glRasterPos2dv(const GLdouble *v)
-{
- d_1_0_Deprecated->f.RasterPos2dv(v);
-}
-
-inline void QOpenGLFunctions_1_5::glRasterPos2d(GLdouble x, GLdouble y)
-{
- d_1_0_Deprecated->f.RasterPos2d(x, y);
-}
-
-inline void QOpenGLFunctions_1_5::glNormal3sv(const GLshort *v)
-{
- d_1_0_Deprecated->f.Normal3sv(v);
-}
-
-inline void QOpenGLFunctions_1_5::glNormal3s(GLshort nx, GLshort ny, GLshort nz)
-{
- d_1_0_Deprecated->f.Normal3s(nx, ny, nz);
-}
-
-inline void QOpenGLFunctions_1_5::glNormal3iv(const GLint *v)
-{
- d_1_0_Deprecated->f.Normal3iv(v);
-}
-
-inline void QOpenGLFunctions_1_5::glNormal3i(GLint nx, GLint ny, GLint nz)
-{
- d_1_0_Deprecated->f.Normal3i(nx, ny, nz);
-}
-
-inline void QOpenGLFunctions_1_5::glNormal3fv(const GLfloat *v)
-{
- d_1_0_Deprecated->f.Normal3fv(v);
-}
-
-inline void QOpenGLFunctions_1_5::glNormal3f(GLfloat nx, GLfloat ny, GLfloat nz)
-{
- d_1_0_Deprecated->f.Normal3f(nx, ny, nz);
-}
-
-inline void QOpenGLFunctions_1_5::glNormal3dv(const GLdouble *v)
-{
- d_1_0_Deprecated->f.Normal3dv(v);
-}
-
-inline void QOpenGLFunctions_1_5::glNormal3d(GLdouble nx, GLdouble ny, GLdouble nz)
-{
- d_1_0_Deprecated->f.Normal3d(nx, ny, nz);
-}
-
-inline void QOpenGLFunctions_1_5::glNormal3bv(const GLbyte *v)
-{
- d_1_0_Deprecated->f.Normal3bv(v);
-}
-
-inline void QOpenGLFunctions_1_5::glNormal3b(GLbyte nx, GLbyte ny, GLbyte nz)
-{
- d_1_0_Deprecated->f.Normal3b(nx, ny, nz);
-}
-
-inline void QOpenGLFunctions_1_5::glIndexsv(const GLshort *c)
-{
- d_1_0_Deprecated->f.Indexsv(c);
-}
-
-inline void QOpenGLFunctions_1_5::glIndexs(GLshort c)
-{
- d_1_0_Deprecated->f.Indexs(c);
-}
-
-inline void QOpenGLFunctions_1_5::glIndexiv(const GLint *c)
-{
- d_1_0_Deprecated->f.Indexiv(c);
-}
-
-inline void QOpenGLFunctions_1_5::glIndexi(GLint c)
-{
- d_1_0_Deprecated->f.Indexi(c);
-}
-
-inline void QOpenGLFunctions_1_5::glIndexfv(const GLfloat *c)
-{
- d_1_0_Deprecated->f.Indexfv(c);
-}
-
-inline void QOpenGLFunctions_1_5::glIndexf(GLfloat c)
-{
- d_1_0_Deprecated->f.Indexf(c);
-}
-
-inline void QOpenGLFunctions_1_5::glIndexdv(const GLdouble *c)
-{
- d_1_0_Deprecated->f.Indexdv(c);
-}
-
-inline void QOpenGLFunctions_1_5::glIndexd(GLdouble c)
-{
- d_1_0_Deprecated->f.Indexd(c);
-}
-
-inline void QOpenGLFunctions_1_5::glEnd()
-{
- d_1_0_Deprecated->f.End();
-}
-
-inline void QOpenGLFunctions_1_5::glEdgeFlagv(const GLboolean *flag)
-{
- d_1_0_Deprecated->f.EdgeFlagv(flag);
-}
-
-inline void QOpenGLFunctions_1_5::glEdgeFlag(GLboolean flag)
-{
- d_1_0_Deprecated->f.EdgeFlag(flag);
-}
-
-inline void QOpenGLFunctions_1_5::glColor4usv(const GLushort *v)
-{
- d_1_0_Deprecated->f.Color4usv(v);
-}
-
-inline void QOpenGLFunctions_1_5::glColor4us(GLushort red, GLushort green, GLushort blue, GLushort alpha)
-{
- d_1_0_Deprecated->f.Color4us(red, green, blue, alpha);
-}
-
-inline void QOpenGLFunctions_1_5::glColor4uiv(const GLuint *v)
-{
- d_1_0_Deprecated->f.Color4uiv(v);
-}
-
-inline void QOpenGLFunctions_1_5::glColor4ui(GLuint red, GLuint green, GLuint blue, GLuint alpha)
-{
- d_1_0_Deprecated->f.Color4ui(red, green, blue, alpha);
-}
-
-inline void QOpenGLFunctions_1_5::glColor4ubv(const GLubyte *v)
-{
- d_1_0_Deprecated->f.Color4ubv(v);
-}
-
-inline void QOpenGLFunctions_1_5::glColor4ub(GLubyte red, GLubyte green, GLubyte blue, GLubyte alpha)
-{
- d_1_0_Deprecated->f.Color4ub(red, green, blue, alpha);
-}
-
-inline void QOpenGLFunctions_1_5::glColor4sv(const GLshort *v)
-{
- d_1_0_Deprecated->f.Color4sv(v);
-}
-
-inline void QOpenGLFunctions_1_5::glColor4s(GLshort red, GLshort green, GLshort blue, GLshort alpha)
-{
- d_1_0_Deprecated->f.Color4s(red, green, blue, alpha);
-}
-
-inline void QOpenGLFunctions_1_5::glColor4iv(const GLint *v)
-{
- d_1_0_Deprecated->f.Color4iv(v);
-}
-
-inline void QOpenGLFunctions_1_5::glColor4i(GLint red, GLint green, GLint blue, GLint alpha)
-{
- d_1_0_Deprecated->f.Color4i(red, green, blue, alpha);
-}
-
-inline void QOpenGLFunctions_1_5::glColor4fv(const GLfloat *v)
-{
- d_1_0_Deprecated->f.Color4fv(v);
-}
-
-inline void QOpenGLFunctions_1_5::glColor4f(GLfloat red, GLfloat green, GLfloat blue, GLfloat alpha)
-{
- d_1_0_Deprecated->f.Color4f(red, green, blue, alpha);
-}
-
-inline void QOpenGLFunctions_1_5::glColor4dv(const GLdouble *v)
-{
- d_1_0_Deprecated->f.Color4dv(v);
-}
-
-inline void QOpenGLFunctions_1_5::glColor4d(GLdouble red, GLdouble green, GLdouble blue, GLdouble alpha)
-{
- d_1_0_Deprecated->f.Color4d(red, green, blue, alpha);
-}
-
-inline void QOpenGLFunctions_1_5::glColor4bv(const GLbyte *v)
-{
- d_1_0_Deprecated->f.Color4bv(v);
-}
-
-inline void QOpenGLFunctions_1_5::glColor4b(GLbyte red, GLbyte green, GLbyte blue, GLbyte alpha)
-{
- d_1_0_Deprecated->f.Color4b(red, green, blue, alpha);
-}
-
-inline void QOpenGLFunctions_1_5::glColor3usv(const GLushort *v)
-{
- d_1_0_Deprecated->f.Color3usv(v);
-}
-
-inline void QOpenGLFunctions_1_5::glColor3us(GLushort red, GLushort green, GLushort blue)
-{
- d_1_0_Deprecated->f.Color3us(red, green, blue);
-}
-
-inline void QOpenGLFunctions_1_5::glColor3uiv(const GLuint *v)
-{
- d_1_0_Deprecated->f.Color3uiv(v);
-}
-
-inline void QOpenGLFunctions_1_5::glColor3ui(GLuint red, GLuint green, GLuint blue)
-{
- d_1_0_Deprecated->f.Color3ui(red, green, blue);
-}
-
-inline void QOpenGLFunctions_1_5::glColor3ubv(const GLubyte *v)
-{
- d_1_0_Deprecated->f.Color3ubv(v);
-}
-
-inline void QOpenGLFunctions_1_5::glColor3ub(GLubyte red, GLubyte green, GLubyte blue)
-{
- d_1_0_Deprecated->f.Color3ub(red, green, blue);
-}
-
-inline void QOpenGLFunctions_1_5::glColor3sv(const GLshort *v)
-{
- d_1_0_Deprecated->f.Color3sv(v);
-}
-
-inline void QOpenGLFunctions_1_5::glColor3s(GLshort red, GLshort green, GLshort blue)
-{
- d_1_0_Deprecated->f.Color3s(red, green, blue);
-}
-
-inline void QOpenGLFunctions_1_5::glColor3iv(const GLint *v)
-{
- d_1_0_Deprecated->f.Color3iv(v);
-}
-
-inline void QOpenGLFunctions_1_5::glColor3i(GLint red, GLint green, GLint blue)
-{
- d_1_0_Deprecated->f.Color3i(red, green, blue);
-}
-
-inline void QOpenGLFunctions_1_5::glColor3fv(const GLfloat *v)
-{
- d_1_0_Deprecated->f.Color3fv(v);
-}
-
-inline void QOpenGLFunctions_1_5::glColor3f(GLfloat red, GLfloat green, GLfloat blue)
-{
- d_1_0_Deprecated->f.Color3f(red, green, blue);
-}
-
-inline void QOpenGLFunctions_1_5::glColor3dv(const GLdouble *v)
-{
- d_1_0_Deprecated->f.Color3dv(v);
-}
-
-inline void QOpenGLFunctions_1_5::glColor3d(GLdouble red, GLdouble green, GLdouble blue)
-{
- d_1_0_Deprecated->f.Color3d(red, green, blue);
-}
-
-inline void QOpenGLFunctions_1_5::glColor3bv(const GLbyte *v)
-{
- d_1_0_Deprecated->f.Color3bv(v);
-}
-
-inline void QOpenGLFunctions_1_5::glColor3b(GLbyte red, GLbyte green, GLbyte blue)
-{
- d_1_0_Deprecated->f.Color3b(red, green, blue);
-}
-
-inline void QOpenGLFunctions_1_5::glBitmap(GLsizei width, GLsizei height, GLfloat xorig, GLfloat yorig, GLfloat xmove, GLfloat ymove, const GLubyte *bitmap)
-{
- d_1_0_Deprecated->f.Bitmap(width, height, xorig, yorig, xmove, ymove, bitmap);
-}
-
-inline void QOpenGLFunctions_1_5::glBegin(GLenum mode)
-{
- d_1_0_Deprecated->f.Begin(mode);
-}
-
-inline void QOpenGLFunctions_1_5::glListBase(GLuint base)
-{
- d_1_0_Deprecated->f.ListBase(base);
-}
-
-inline GLuint QOpenGLFunctions_1_5::glGenLists(GLsizei range)
-{
- return d_1_0_Deprecated->f.GenLists(range);
-}
-
-inline void QOpenGLFunctions_1_5::glDeleteLists(GLuint list, GLsizei range)
-{
- d_1_0_Deprecated->f.DeleteLists(list, range);
-}
-
-inline void QOpenGLFunctions_1_5::glCallLists(GLsizei n, GLenum type, const GLvoid *lists)
-{
- d_1_0_Deprecated->f.CallLists(n, type, lists);
-}
-
-inline void QOpenGLFunctions_1_5::glCallList(GLuint list)
-{
- d_1_0_Deprecated->f.CallList(list);
-}
-
-inline void QOpenGLFunctions_1_5::glEndList()
-{
- d_1_0_Deprecated->f.EndList();
-}
-
-inline void QOpenGLFunctions_1_5::glNewList(GLuint list, GLenum mode)
-{
- d_1_0_Deprecated->f.NewList(list, mode);
-}
-
-
-// OpenGL 1.1 deprecated functions
-inline void QOpenGLFunctions_1_5::glPushClientAttrib(GLbitfield mask)
-{
- d_1_1_Deprecated->f.PushClientAttrib(mask);
-}
-
-inline void QOpenGLFunctions_1_5::glPopClientAttrib()
-{
- d_1_1_Deprecated->f.PopClientAttrib();
-}
-
-inline void QOpenGLFunctions_1_5::glPrioritizeTextures(GLsizei n, const GLuint *textures, const GLfloat *priorities)
-{
- d_1_1_Deprecated->f.PrioritizeTextures(n, textures, priorities);
-}
-
-inline GLboolean QOpenGLFunctions_1_5::glAreTexturesResident(GLsizei n, const GLuint *textures, GLboolean *residences)
-{
- return d_1_1_Deprecated->f.AreTexturesResident(n, textures, residences);
-}
-
-inline void QOpenGLFunctions_1_5::glVertexPointer(GLint size, GLenum type, GLsizei stride, const GLvoid *pointer)
-{
- d_1_1_Deprecated->f.VertexPointer(size, type, stride, pointer);
-}
-
-inline void QOpenGLFunctions_1_5::glTexCoordPointer(GLint size, GLenum type, GLsizei stride, const GLvoid *pointer)
-{
- d_1_1_Deprecated->f.TexCoordPointer(size, type, stride, pointer);
-}
-
-inline void QOpenGLFunctions_1_5::glNormalPointer(GLenum type, GLsizei stride, const GLvoid *pointer)
-{
- d_1_1_Deprecated->f.NormalPointer(type, stride, pointer);
-}
-
-inline void QOpenGLFunctions_1_5::glInterleavedArrays(GLenum format, GLsizei stride, const GLvoid *pointer)
-{
- d_1_1_Deprecated->f.InterleavedArrays(format, stride, pointer);
-}
-
-inline void QOpenGLFunctions_1_5::glIndexPointer(GLenum type, GLsizei stride, const GLvoid *pointer)
-{
- d_1_1_Deprecated->f.IndexPointer(type, stride, pointer);
-}
-
-inline void QOpenGLFunctions_1_5::glEnableClientState(GLenum array)
-{
- d_1_1_Deprecated->f.EnableClientState(array);
-}
-
-inline void QOpenGLFunctions_1_5::glEdgeFlagPointer(GLsizei stride, const GLvoid *pointer)
-{
- d_1_1_Deprecated->f.EdgeFlagPointer(stride, pointer);
-}
-
-inline void QOpenGLFunctions_1_5::glDisableClientState(GLenum array)
-{
- d_1_1_Deprecated->f.DisableClientState(array);
-}
-
-inline void QOpenGLFunctions_1_5::glColorPointer(GLint size, GLenum type, GLsizei stride, const GLvoid *pointer)
-{
- d_1_1_Deprecated->f.ColorPointer(size, type, stride, pointer);
-}
-
-inline void QOpenGLFunctions_1_5::glArrayElement(GLint i)
-{
- d_1_1_Deprecated->f.ArrayElement(i);
-}
-
-
-// OpenGL 1.2 deprecated functions
-inline void QOpenGLFunctions_1_5::glResetMinmax(GLenum target)
-{
- d_1_2_Deprecated->f.ResetMinmax(target);
-}
-
-inline void QOpenGLFunctions_1_5::glResetHistogram(GLenum target)
-{
- d_1_2_Deprecated->f.ResetHistogram(target);
-}
-
-inline void QOpenGLFunctions_1_5::glMinmax(GLenum target, GLenum internalformat, GLboolean sink)
-{
- d_1_2_Deprecated->f.Minmax(target, internalformat, sink);
-}
-
-inline void QOpenGLFunctions_1_5::glHistogram(GLenum target, GLsizei width, GLenum internalformat, GLboolean sink)
-{
- d_1_2_Deprecated->f.Histogram(target, width, internalformat, sink);
-}
-
-inline void QOpenGLFunctions_1_5::glGetMinmaxParameteriv(GLenum target, GLenum pname, GLint *params)
-{
- d_1_2_Deprecated->f.GetMinmaxParameteriv(target, pname, params);
-}
-
-inline void QOpenGLFunctions_1_5::glGetMinmaxParameterfv(GLenum target, GLenum pname, GLfloat *params)
-{
- d_1_2_Deprecated->f.GetMinmaxParameterfv(target, pname, params);
-}
-
-inline void QOpenGLFunctions_1_5::glGetMinmax(GLenum target, GLboolean reset, GLenum format, GLenum type, GLvoid *values)
-{
- d_1_2_Deprecated->f.GetMinmax(target, reset, format, type, values);
-}
-
-inline void QOpenGLFunctions_1_5::glGetHistogramParameteriv(GLenum target, GLenum pname, GLint *params)
-{
- d_1_2_Deprecated->f.GetHistogramParameteriv(target, pname, params);
-}
-
-inline void QOpenGLFunctions_1_5::glGetHistogramParameterfv(GLenum target, GLenum pname, GLfloat *params)
-{
- d_1_2_Deprecated->f.GetHistogramParameterfv(target, pname, params);
-}
-
-inline void QOpenGLFunctions_1_5::glGetHistogram(GLenum target, GLboolean reset, GLenum format, GLenum type, GLvoid *values)
-{
- d_1_2_Deprecated->f.GetHistogram(target, reset, format, type, values);
-}
-
-inline void QOpenGLFunctions_1_5::glSeparableFilter2D(GLenum target, GLenum internalformat, GLsizei width, GLsizei height, GLenum format, GLenum type, const GLvoid *row, const GLvoid *column)
-{
- d_1_2_Deprecated->f.SeparableFilter2D(target, internalformat, width, height, format, type, row, column);
-}
-
-inline void QOpenGLFunctions_1_5::glGetSeparableFilter(GLenum target, GLenum format, GLenum type, GLvoid *row, GLvoid *column, GLvoid *span)
-{
- d_1_2_Deprecated->f.GetSeparableFilter(target, format, type, row, column, span);
-}
-
-inline void QOpenGLFunctions_1_5::glGetConvolutionParameteriv(GLenum target, GLenum pname, GLint *params)
-{
- d_1_2_Deprecated->f.GetConvolutionParameteriv(target, pname, params);
-}
-
-inline void QOpenGLFunctions_1_5::glGetConvolutionParameterfv(GLenum target, GLenum pname, GLfloat *params)
-{
- d_1_2_Deprecated->f.GetConvolutionParameterfv(target, pname, params);
-}
-
-inline void QOpenGLFunctions_1_5::glGetConvolutionFilter(GLenum target, GLenum format, GLenum type, GLvoid *image)
-{
- d_1_2_Deprecated->f.GetConvolutionFilter(target, format, type, image);
-}
-
-inline void QOpenGLFunctions_1_5::glCopyConvolutionFilter2D(GLenum target, GLenum internalformat, GLint x, GLint y, GLsizei width, GLsizei height)
-{
- d_1_2_Deprecated->f.CopyConvolutionFilter2D(target, internalformat, x, y, width, height);
-}
-
-inline void QOpenGLFunctions_1_5::glCopyConvolutionFilter1D(GLenum target, GLenum internalformat, GLint x, GLint y, GLsizei width)
-{
- d_1_2_Deprecated->f.CopyConvolutionFilter1D(target, internalformat, x, y, width);
-}
-
-inline void QOpenGLFunctions_1_5::glConvolutionParameteriv(GLenum target, GLenum pname, const GLint *params)
-{
- d_1_2_Deprecated->f.ConvolutionParameteriv(target, pname, params);
-}
-
-inline void QOpenGLFunctions_1_5::glConvolutionParameteri(GLenum target, GLenum pname, GLint params)
-{
- d_1_2_Deprecated->f.ConvolutionParameteri(target, pname, params);
-}
-
-inline void QOpenGLFunctions_1_5::glConvolutionParameterfv(GLenum target, GLenum pname, const GLfloat *params)
-{
- d_1_2_Deprecated->f.ConvolutionParameterfv(target, pname, params);
-}
-
-inline void QOpenGLFunctions_1_5::glConvolutionParameterf(GLenum target, GLenum pname, GLfloat params)
-{
- d_1_2_Deprecated->f.ConvolutionParameterf(target, pname, params);
-}
-
-inline void QOpenGLFunctions_1_5::glConvolutionFilter2D(GLenum target, GLenum internalformat, GLsizei width, GLsizei height, GLenum format, GLenum type, const GLvoid *image)
-{
- d_1_2_Deprecated->f.ConvolutionFilter2D(target, internalformat, width, height, format, type, image);
-}
-
-inline void QOpenGLFunctions_1_5::glConvolutionFilter1D(GLenum target, GLenum internalformat, GLsizei width, GLenum format, GLenum type, const GLvoid *image)
-{
- d_1_2_Deprecated->f.ConvolutionFilter1D(target, internalformat, width, format, type, image);
-}
-
-inline void QOpenGLFunctions_1_5::glCopyColorSubTable(GLenum target, GLsizei start, GLint x, GLint y, GLsizei width)
-{
- d_1_2_Deprecated->f.CopyColorSubTable(target, start, x, y, width);
-}
-
-inline void QOpenGLFunctions_1_5::glColorSubTable(GLenum target, GLsizei start, GLsizei count, GLenum format, GLenum type, const GLvoid *data)
-{
- d_1_2_Deprecated->f.ColorSubTable(target, start, count, format, type, data);
-}
-
-inline void QOpenGLFunctions_1_5::glGetColorTableParameteriv(GLenum target, GLenum pname, GLint *params)
-{
- d_1_2_Deprecated->f.GetColorTableParameteriv(target, pname, params);
-}
-
-inline void QOpenGLFunctions_1_5::glGetColorTableParameterfv(GLenum target, GLenum pname, GLfloat *params)
-{
- d_1_2_Deprecated->f.GetColorTableParameterfv(target, pname, params);
-}
-
-inline void QOpenGLFunctions_1_5::glGetColorTable(GLenum target, GLenum format, GLenum type, GLvoid *table)
-{
- d_1_2_Deprecated->f.GetColorTable(target, format, type, table);
-}
-
-inline void QOpenGLFunctions_1_5::glCopyColorTable(GLenum target, GLenum internalformat, GLint x, GLint y, GLsizei width)
-{
- d_1_2_Deprecated->f.CopyColorTable(target, internalformat, x, y, width);
-}
-
-inline void QOpenGLFunctions_1_5::glColorTableParameteriv(GLenum target, GLenum pname, const GLint *params)
-{
- d_1_2_Deprecated->f.ColorTableParameteriv(target, pname, params);
-}
-
-inline void QOpenGLFunctions_1_5::glColorTableParameterfv(GLenum target, GLenum pname, const GLfloat *params)
-{
- d_1_2_Deprecated->f.ColorTableParameterfv(target, pname, params);
-}
-
-inline void QOpenGLFunctions_1_5::glColorTable(GLenum target, GLenum internalformat, GLsizei width, GLenum format, GLenum type, const GLvoid *table)
-{
- d_1_2_Deprecated->f.ColorTable(target, internalformat, width, format, type, table);
-}
-
-
-// OpenGL 1.3 deprecated functions
-inline void QOpenGLFunctions_1_5::glMultTransposeMatrixd(const GLdouble *m)
-{
- d_1_3_Deprecated->f.MultTransposeMatrixd(m);
-}
-
-inline void QOpenGLFunctions_1_5::glMultTransposeMatrixf(const GLfloat *m)
-{
- d_1_3_Deprecated->f.MultTransposeMatrixf(m);
-}
-
-inline void QOpenGLFunctions_1_5::glLoadTransposeMatrixd(const GLdouble *m)
-{
- d_1_3_Deprecated->f.LoadTransposeMatrixd(m);
-}
-
-inline void QOpenGLFunctions_1_5::glLoadTransposeMatrixf(const GLfloat *m)
-{
- d_1_3_Deprecated->f.LoadTransposeMatrixf(m);
-}
-
-inline void QOpenGLFunctions_1_5::glMultiTexCoord4sv(GLenum target, const GLshort *v)
-{
- d_1_3_Deprecated->f.MultiTexCoord4sv(target, v);
-}
-
-inline void QOpenGLFunctions_1_5::glMultiTexCoord4s(GLenum target, GLshort s, GLshort t, GLshort r, GLshort q)
-{
- d_1_3_Deprecated->f.MultiTexCoord4s(target, s, t, r, q);
-}
-
-inline void QOpenGLFunctions_1_5::glMultiTexCoord4iv(GLenum target, const GLint *v)
-{
- d_1_3_Deprecated->f.MultiTexCoord4iv(target, v);
-}
-
-inline void QOpenGLFunctions_1_5::glMultiTexCoord4i(GLenum target, GLint s, GLint t, GLint r, GLint q)
-{
- d_1_3_Deprecated->f.MultiTexCoord4i(target, s, t, r, q);
-}
-
-inline void QOpenGLFunctions_1_5::glMultiTexCoord4fv(GLenum target, const GLfloat *v)
-{
- d_1_3_Deprecated->f.MultiTexCoord4fv(target, v);
-}
-
-inline void QOpenGLFunctions_1_5::glMultiTexCoord4f(GLenum target, GLfloat s, GLfloat t, GLfloat r, GLfloat q)
-{
- d_1_3_Deprecated->f.MultiTexCoord4f(target, s, t, r, q);
-}
-
-inline void QOpenGLFunctions_1_5::glMultiTexCoord4dv(GLenum target, const GLdouble *v)
-{
- d_1_3_Deprecated->f.MultiTexCoord4dv(target, v);
-}
-
-inline void QOpenGLFunctions_1_5::glMultiTexCoord4d(GLenum target, GLdouble s, GLdouble t, GLdouble r, GLdouble q)
-{
- d_1_3_Deprecated->f.MultiTexCoord4d(target, s, t, r, q);
-}
-
-inline void QOpenGLFunctions_1_5::glMultiTexCoord3sv(GLenum target, const GLshort *v)
-{
- d_1_3_Deprecated->f.MultiTexCoord3sv(target, v);
-}
-
-inline void QOpenGLFunctions_1_5::glMultiTexCoord3s(GLenum target, GLshort s, GLshort t, GLshort r)
-{
- d_1_3_Deprecated->f.MultiTexCoord3s(target, s, t, r);
-}
-
-inline void QOpenGLFunctions_1_5::glMultiTexCoord3iv(GLenum target, const GLint *v)
-{
- d_1_3_Deprecated->f.MultiTexCoord3iv(target, v);
-}
-
-inline void QOpenGLFunctions_1_5::glMultiTexCoord3i(GLenum target, GLint s, GLint t, GLint r)
-{
- d_1_3_Deprecated->f.MultiTexCoord3i(target, s, t, r);
-}
-
-inline void QOpenGLFunctions_1_5::glMultiTexCoord3fv(GLenum target, const GLfloat *v)
-{
- d_1_3_Deprecated->f.MultiTexCoord3fv(target, v);
-}
-
-inline void QOpenGLFunctions_1_5::glMultiTexCoord3f(GLenum target, GLfloat s, GLfloat t, GLfloat r)
-{
- d_1_3_Deprecated->f.MultiTexCoord3f(target, s, t, r);
-}
-
-inline void QOpenGLFunctions_1_5::glMultiTexCoord3dv(GLenum target, const GLdouble *v)
-{
- d_1_3_Deprecated->f.MultiTexCoord3dv(target, v);
-}
-
-inline void QOpenGLFunctions_1_5::glMultiTexCoord3d(GLenum target, GLdouble s, GLdouble t, GLdouble r)
-{
- d_1_3_Deprecated->f.MultiTexCoord3d(target, s, t, r);
-}
-
-inline void QOpenGLFunctions_1_5::glMultiTexCoord2sv(GLenum target, const GLshort *v)
-{
- d_1_3_Deprecated->f.MultiTexCoord2sv(target, v);
-}
-
-inline void QOpenGLFunctions_1_5::glMultiTexCoord2s(GLenum target, GLshort s, GLshort t)
-{
- d_1_3_Deprecated->f.MultiTexCoord2s(target, s, t);
-}
-
-inline void QOpenGLFunctions_1_5::glMultiTexCoord2iv(GLenum target, const GLint *v)
-{
- d_1_3_Deprecated->f.MultiTexCoord2iv(target, v);
-}
-
-inline void QOpenGLFunctions_1_5::glMultiTexCoord2i(GLenum target, GLint s, GLint t)
-{
- d_1_3_Deprecated->f.MultiTexCoord2i(target, s, t);
-}
-
-inline void QOpenGLFunctions_1_5::glMultiTexCoord2fv(GLenum target, const GLfloat *v)
-{
- d_1_3_Deprecated->f.MultiTexCoord2fv(target, v);
-}
-
-inline void QOpenGLFunctions_1_5::glMultiTexCoord2f(GLenum target, GLfloat s, GLfloat t)
-{
- d_1_3_Deprecated->f.MultiTexCoord2f(target, s, t);
-}
-
-inline void QOpenGLFunctions_1_5::glMultiTexCoord2dv(GLenum target, const GLdouble *v)
-{
- d_1_3_Deprecated->f.MultiTexCoord2dv(target, v);
-}
-
-inline void QOpenGLFunctions_1_5::glMultiTexCoord2d(GLenum target, GLdouble s, GLdouble t)
-{
- d_1_3_Deprecated->f.MultiTexCoord2d(target, s, t);
-}
-
-inline void QOpenGLFunctions_1_5::glMultiTexCoord1sv(GLenum target, const GLshort *v)
-{
- d_1_3_Deprecated->f.MultiTexCoord1sv(target, v);
-}
-
-inline void QOpenGLFunctions_1_5::glMultiTexCoord1s(GLenum target, GLshort s)
-{
- d_1_3_Deprecated->f.MultiTexCoord1s(target, s);
-}
-
-inline void QOpenGLFunctions_1_5::glMultiTexCoord1iv(GLenum target, const GLint *v)
-{
- d_1_3_Deprecated->f.MultiTexCoord1iv(target, v);
-}
-
-inline void QOpenGLFunctions_1_5::glMultiTexCoord1i(GLenum target, GLint s)
-{
- d_1_3_Deprecated->f.MultiTexCoord1i(target, s);
-}
-
-inline void QOpenGLFunctions_1_5::glMultiTexCoord1fv(GLenum target, const GLfloat *v)
-{
- d_1_3_Deprecated->f.MultiTexCoord1fv(target, v);
-}
-
-inline void QOpenGLFunctions_1_5::glMultiTexCoord1f(GLenum target, GLfloat s)
-{
- d_1_3_Deprecated->f.MultiTexCoord1f(target, s);
-}
-
-inline void QOpenGLFunctions_1_5::glMultiTexCoord1dv(GLenum target, const GLdouble *v)
-{
- d_1_3_Deprecated->f.MultiTexCoord1dv(target, v);
-}
-
-inline void QOpenGLFunctions_1_5::glMultiTexCoord1d(GLenum target, GLdouble s)
-{
- d_1_3_Deprecated->f.MultiTexCoord1d(target, s);
-}
-
-inline void QOpenGLFunctions_1_5::glClientActiveTexture(GLenum texture)
-{
- d_1_3_Deprecated->f.ClientActiveTexture(texture);
-}
-
-
-// OpenGL 1.4 deprecated functions
-inline void QOpenGLFunctions_1_5::glWindowPos3sv(const GLshort *v)
-{
- d_1_4_Deprecated->f.WindowPos3sv(v);
-}
-
-inline void QOpenGLFunctions_1_5::glWindowPos3s(GLshort x, GLshort y, GLshort z)
-{
- d_1_4_Deprecated->f.WindowPos3s(x, y, z);
-}
-
-inline void QOpenGLFunctions_1_5::glWindowPos3iv(const GLint *v)
-{
- d_1_4_Deprecated->f.WindowPos3iv(v);
-}
-
-inline void QOpenGLFunctions_1_5::glWindowPos3i(GLint x, GLint y, GLint z)
-{
- d_1_4_Deprecated->f.WindowPos3i(x, y, z);
-}
-
-inline void QOpenGLFunctions_1_5::glWindowPos3fv(const GLfloat *v)
-{
- d_1_4_Deprecated->f.WindowPos3fv(v);
-}
-
-inline void QOpenGLFunctions_1_5::glWindowPos3f(GLfloat x, GLfloat y, GLfloat z)
-{
- d_1_4_Deprecated->f.WindowPos3f(x, y, z);
-}
-
-inline void QOpenGLFunctions_1_5::glWindowPos3dv(const GLdouble *v)
-{
- d_1_4_Deprecated->f.WindowPos3dv(v);
-}
-
-inline void QOpenGLFunctions_1_5::glWindowPos3d(GLdouble x, GLdouble y, GLdouble z)
-{
- d_1_4_Deprecated->f.WindowPos3d(x, y, z);
-}
-
-inline void QOpenGLFunctions_1_5::glWindowPos2sv(const GLshort *v)
-{
- d_1_4_Deprecated->f.WindowPos2sv(v);
-}
-
-inline void QOpenGLFunctions_1_5::glWindowPos2s(GLshort x, GLshort y)
-{
- d_1_4_Deprecated->f.WindowPos2s(x, y);
-}
-
-inline void QOpenGLFunctions_1_5::glWindowPos2iv(const GLint *v)
-{
- d_1_4_Deprecated->f.WindowPos2iv(v);
-}
-
-inline void QOpenGLFunctions_1_5::glWindowPos2i(GLint x, GLint y)
-{
- d_1_4_Deprecated->f.WindowPos2i(x, y);
-}
-
-inline void QOpenGLFunctions_1_5::glWindowPos2fv(const GLfloat *v)
-{
- d_1_4_Deprecated->f.WindowPos2fv(v);
-}
-
-inline void QOpenGLFunctions_1_5::glWindowPos2f(GLfloat x, GLfloat y)
-{
- d_1_4_Deprecated->f.WindowPos2f(x, y);
-}
-
-inline void QOpenGLFunctions_1_5::glWindowPos2dv(const GLdouble *v)
-{
- d_1_4_Deprecated->f.WindowPos2dv(v);
-}
-
-inline void QOpenGLFunctions_1_5::glWindowPos2d(GLdouble x, GLdouble y)
-{
- d_1_4_Deprecated->f.WindowPos2d(x, y);
-}
-
-inline void QOpenGLFunctions_1_5::glSecondaryColorPointer(GLint size, GLenum type, GLsizei stride, const GLvoid *pointer)
-{
- d_1_4_Deprecated->f.SecondaryColorPointer(size, type, stride, pointer);
-}
-
-inline void QOpenGLFunctions_1_5::glSecondaryColor3usv(const GLushort *v)
-{
- d_1_4_Deprecated->f.SecondaryColor3usv(v);
-}
-
-inline void QOpenGLFunctions_1_5::glSecondaryColor3us(GLushort red, GLushort green, GLushort blue)
-{
- d_1_4_Deprecated->f.SecondaryColor3us(red, green, blue);
-}
-
-inline void QOpenGLFunctions_1_5::glSecondaryColor3uiv(const GLuint *v)
-{
- d_1_4_Deprecated->f.SecondaryColor3uiv(v);
-}
-
-inline void QOpenGLFunctions_1_5::glSecondaryColor3ui(GLuint red, GLuint green, GLuint blue)
-{
- d_1_4_Deprecated->f.SecondaryColor3ui(red, green, blue);
-}
-
-inline void QOpenGLFunctions_1_5::glSecondaryColor3ubv(const GLubyte *v)
-{
- d_1_4_Deprecated->f.SecondaryColor3ubv(v);
-}
-
-inline void QOpenGLFunctions_1_5::glSecondaryColor3ub(GLubyte red, GLubyte green, GLubyte blue)
-{
- d_1_4_Deprecated->f.SecondaryColor3ub(red, green, blue);
-}
-
-inline void QOpenGLFunctions_1_5::glSecondaryColor3sv(const GLshort *v)
-{
- d_1_4_Deprecated->f.SecondaryColor3sv(v);
-}
-
-inline void QOpenGLFunctions_1_5::glSecondaryColor3s(GLshort red, GLshort green, GLshort blue)
-{
- d_1_4_Deprecated->f.SecondaryColor3s(red, green, blue);
-}
-
-inline void QOpenGLFunctions_1_5::glSecondaryColor3iv(const GLint *v)
-{
- d_1_4_Deprecated->f.SecondaryColor3iv(v);
-}
-
-inline void QOpenGLFunctions_1_5::glSecondaryColor3i(GLint red, GLint green, GLint blue)
-{
- d_1_4_Deprecated->f.SecondaryColor3i(red, green, blue);
-}
-
-inline void QOpenGLFunctions_1_5::glSecondaryColor3fv(const GLfloat *v)
-{
- d_1_4_Deprecated->f.SecondaryColor3fv(v);
-}
-
-inline void QOpenGLFunctions_1_5::glSecondaryColor3f(GLfloat red, GLfloat green, GLfloat blue)
-{
- d_1_4_Deprecated->f.SecondaryColor3f(red, green, blue);
-}
-
-inline void QOpenGLFunctions_1_5::glSecondaryColor3dv(const GLdouble *v)
-{
- d_1_4_Deprecated->f.SecondaryColor3dv(v);
-}
-
-inline void QOpenGLFunctions_1_5::glSecondaryColor3d(GLdouble red, GLdouble green, GLdouble blue)
-{
- d_1_4_Deprecated->f.SecondaryColor3d(red, green, blue);
-}
-
-inline void QOpenGLFunctions_1_5::glSecondaryColor3bv(const GLbyte *v)
-{
- d_1_4_Deprecated->f.SecondaryColor3bv(v);
-}
-
-inline void QOpenGLFunctions_1_5::glSecondaryColor3b(GLbyte red, GLbyte green, GLbyte blue)
-{
- d_1_4_Deprecated->f.SecondaryColor3b(red, green, blue);
-}
-
-inline void QOpenGLFunctions_1_5::glFogCoordPointer(GLenum type, GLsizei stride, const GLvoid *pointer)
-{
- d_1_4_Deprecated->f.FogCoordPointer(type, stride, pointer);
-}
-
-inline void QOpenGLFunctions_1_5::glFogCoorddv(const GLdouble *coord)
-{
- d_1_4_Deprecated->f.FogCoorddv(coord);
-}
-
-inline void QOpenGLFunctions_1_5::glFogCoordd(GLdouble coord)
-{
- d_1_4_Deprecated->f.FogCoordd(coord);
-}
-
-inline void QOpenGLFunctions_1_5::glFogCoordfv(const GLfloat *coord)
-{
- d_1_4_Deprecated->f.FogCoordfv(coord);
-}
-
-inline void QOpenGLFunctions_1_5::glFogCoordf(GLfloat coord)
-{
- d_1_4_Deprecated->f.FogCoordf(coord);
-}
-
-
-// OpenGL 1.5 deprecated functions
-
-
-QT_END_NAMESPACE
-
-#endif // QT_NO_OPENGL && !QT_OPENGL_ES_2
-
-#endif
diff --git a/src/gui/opengl/qopenglfunctions_2_0.cpp b/src/gui/opengl/qopenglfunctions_2_0.cpp
deleted file mode 100644
index 29eb055a1d..0000000000
--- a/src/gui/opengl/qopenglfunctions_2_0.cpp
+++ /dev/null
@@ -1,227 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2013 Klaralvdalens Datakonsult AB (KDAB)
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the QtGui module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-**
-** This file was generated by glgen version 0.1
-** Command line was: glgen
-**
-** glgen is Copyright (C) 2013 Klaralvdalens Datakonsult AB (KDAB)
-**
-** This is an auto-generated file.
-** Do not edit! All changes made to it will be lost.
-**
-****************************************************************************/
-
-#include "qopenglfunctions_2_0.h"
-#include "qopenglcontext.h"
-
-QT_BEGIN_NAMESPACE
-
-/*!
- \class QOpenGLFunctions_2_0
- \inmodule QtGui
- \since 5.1
- \wrapper
- \brief The QOpenGLFunctions_2_0 class provides all functions for OpenGL 2.0 specification.
-
- This class is a wrapper for functions from OpenGL 2.0 specification.
- See reference pages on \l {http://www.opengl.org/sdk/docs/}{opengl.org}
- for function documentation.
-
- \sa QAbstractOpenGLFunctions
-*/
-
-QOpenGLFunctions_2_0::QOpenGLFunctions_2_0()
- : QAbstractOpenGLFunctions()
- , d_1_0_Core(nullptr)
- , d_1_1_Core(nullptr)
- , d_1_2_Core(nullptr)
- , d_1_3_Core(nullptr)
- , d_1_4_Core(nullptr)
- , d_1_5_Core(nullptr)
- , d_2_0_Core(nullptr)
- , d_1_0_Deprecated(nullptr)
- , d_1_1_Deprecated(nullptr)
- , d_1_2_Deprecated(nullptr)
- , d_1_3_Deprecated(nullptr)
- , d_1_4_Deprecated(nullptr)
- , m_reserved_2_0_Deprecated(nullptr)
-{
-}
-
-QOpenGLFunctions_2_0::~QOpenGLFunctions_2_0()
-{
- if (d_1_0_Core) {
- d_1_0_Core->refs.deref();
- Q_ASSERT(d_1_0_Core->refs.loadRelaxed());
- }
- if (d_1_1_Core) {
- d_1_1_Core->refs.deref();
- Q_ASSERT(d_1_1_Core->refs.loadRelaxed());
- }
- if (d_1_2_Core) {
- d_1_2_Core->refs.deref();
- Q_ASSERT(d_1_2_Core->refs.loadRelaxed());
- }
- if (d_1_3_Core) {
- d_1_3_Core->refs.deref();
- Q_ASSERT(d_1_3_Core->refs.loadRelaxed());
- }
- if (d_1_4_Core) {
- d_1_4_Core->refs.deref();
- Q_ASSERT(d_1_4_Core->refs.loadRelaxed());
- }
- if (d_1_5_Core) {
- d_1_5_Core->refs.deref();
- Q_ASSERT(d_1_5_Core->refs.loadRelaxed());
- }
- if (d_2_0_Core) {
- d_2_0_Core->refs.deref();
- Q_ASSERT(d_2_0_Core->refs.loadRelaxed());
- }
- if (d_1_0_Deprecated) {
- d_1_0_Deprecated->refs.deref();
- Q_ASSERT(d_1_0_Deprecated->refs.loadRelaxed());
- }
- if (d_1_1_Deprecated) {
- d_1_1_Deprecated->refs.deref();
- Q_ASSERT(d_1_1_Deprecated->refs.loadRelaxed());
- }
- if (d_1_2_Deprecated) {
- d_1_2_Deprecated->refs.deref();
- Q_ASSERT(d_1_2_Deprecated->refs.loadRelaxed());
- }
- if (d_1_3_Deprecated) {
- d_1_3_Deprecated->refs.deref();
- Q_ASSERT(d_1_3_Deprecated->refs.loadRelaxed());
- }
- if (d_1_4_Deprecated) {
- d_1_4_Deprecated->refs.deref();
- Q_ASSERT(d_1_4_Deprecated->refs.loadRelaxed());
- }
-}
-
-bool QOpenGLFunctions_2_0::initializeOpenGLFunctions()
-{
- if ( isInitialized() )
- return true;
-
- QOpenGLContext* context = QOpenGLContext::currentContext();
-
- // If owned by a context object make sure it is current.
- // Also check that current context is capable of resolving all needed functions
- if (((owningContext() && owningContext() == context) || !owningContext())
- && QOpenGLFunctions_2_0::isContextCompatible(context))
- {
- // Associate with private implementation, creating if necessary
- // Function pointers in the backends are resolved at creation time
- QOpenGLVersionFunctionsBackend* d = nullptr;
- d = QAbstractOpenGLFunctionsPrivate::functionsBackend(context, QOpenGLFunctions_1_0_CoreBackend::versionStatus());
- d_1_0_Core = static_cast<QOpenGLFunctions_1_0_CoreBackend*>(d);
- d->refs.ref();
-
- d = QAbstractOpenGLFunctionsPrivate::functionsBackend(context, QOpenGLFunctions_1_1_CoreBackend::versionStatus());
- d_1_1_Core = static_cast<QOpenGLFunctions_1_1_CoreBackend*>(d);
- d->refs.ref();
-
- d = QAbstractOpenGLFunctionsPrivate::functionsBackend(context, QOpenGLFunctions_1_2_CoreBackend::versionStatus());
- d_1_2_Core = static_cast<QOpenGLFunctions_1_2_CoreBackend*>(d);
- d->refs.ref();
-
- d = QAbstractOpenGLFunctionsPrivate::functionsBackend(context, QOpenGLFunctions_1_3_CoreBackend::versionStatus());
- d_1_3_Core = static_cast<QOpenGLFunctions_1_3_CoreBackend*>(d);
- d->refs.ref();
-
- d = QAbstractOpenGLFunctionsPrivate::functionsBackend(context, QOpenGLFunctions_1_4_CoreBackend::versionStatus());
- d_1_4_Core = static_cast<QOpenGLFunctions_1_4_CoreBackend*>(d);
- d->refs.ref();
-
- d = QAbstractOpenGLFunctionsPrivate::functionsBackend(context, QOpenGLFunctions_1_5_CoreBackend::versionStatus());
- d_1_5_Core = static_cast<QOpenGLFunctions_1_5_CoreBackend*>(d);
- d->refs.ref();
-
- d = QAbstractOpenGLFunctionsPrivate::functionsBackend(context, QOpenGLFunctions_2_0_CoreBackend::versionStatus());
- d_2_0_Core = static_cast<QOpenGLFunctions_2_0_CoreBackend*>(d);
- d->refs.ref();
-
- d = QAbstractOpenGLFunctionsPrivate::functionsBackend(context, QOpenGLFunctions_1_0_DeprecatedBackend::versionStatus());
- d_1_0_Deprecated = static_cast<QOpenGLFunctions_1_0_DeprecatedBackend*>(d);
- d->refs.ref();
-
- d = QAbstractOpenGLFunctionsPrivate::functionsBackend(context, QOpenGLFunctions_1_1_DeprecatedBackend::versionStatus());
- d_1_1_Deprecated = static_cast<QOpenGLFunctions_1_1_DeprecatedBackend*>(d);
- d->refs.ref();
-
- d = QAbstractOpenGLFunctionsPrivate::functionsBackend(context, QOpenGLFunctions_1_2_DeprecatedBackend::versionStatus());
- d_1_2_Deprecated = static_cast<QOpenGLFunctions_1_2_DeprecatedBackend*>(d);
- d->refs.ref();
-
- d = QAbstractOpenGLFunctionsPrivate::functionsBackend(context, QOpenGLFunctions_1_3_DeprecatedBackend::versionStatus());
- d_1_3_Deprecated = static_cast<QOpenGLFunctions_1_3_DeprecatedBackend*>(d);
- d->refs.ref();
-
- d = QAbstractOpenGLFunctionsPrivate::functionsBackend(context, QOpenGLFunctions_1_4_DeprecatedBackend::versionStatus());
- d_1_4_Deprecated = static_cast<QOpenGLFunctions_1_4_DeprecatedBackend*>(d);
- d->refs.ref();
-
- QAbstractOpenGLFunctions::initializeOpenGLFunctions();
- }
- return isInitialized();
-}
-
-bool QOpenGLFunctions_2_0::isContextCompatible(QOpenGLContext *context)
-{
- Q_ASSERT(context);
- QSurfaceFormat f = context->format();
- const QPair<int, int> v = qMakePair(f.majorVersion(), f.minorVersion());
- if (v < qMakePair(2, 0))
- return false;
-
- if (f.profile() == QSurfaceFormat::CoreProfile)
- return false;
-
- return true;
-}
-
-QOpenGLVersionProfile QOpenGLFunctions_2_0::versionProfile()
-{
- QOpenGLVersionProfile v;
- v.setVersion(2, 0);
- return v;
-}
-
-QT_END_NAMESPACE
diff --git a/src/gui/opengl/qopenglfunctions_2_0.h b/src/gui/opengl/qopenglfunctions_2_0.h
deleted file mode 100644
index 556597a9b3..0000000000
--- a/src/gui/opengl/qopenglfunctions_2_0.h
+++ /dev/null
@@ -1,3614 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2013 Klaralvdalens Datakonsult AB (KDAB)
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the QtGui module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-**
-** This file was generated by glgen version 0.1
-** Command line was: glgen
-**
-** glgen is Copyright (C) 2013 Klaralvdalens Datakonsult AB (KDAB)
-**
-** This is an auto-generated file.
-** Do not edit! All changes made to it will be lost.
-**
-****************************************************************************/
-
-#ifndef QOPENGLVERSIONFUNCTIONS_2_0_H
-#define QOPENGLVERSIONFUNCTIONS_2_0_H
-
-#include <QtGui/qtguiglobal.h>
-
-#if !defined(QT_NO_OPENGL) && !defined(QT_OPENGL_ES_2)
-
-#include <QtGui/QOpenGLVersionFunctions>
-#include <QtGui/qopenglcontext.h>
-
-QT_BEGIN_NAMESPACE
-
-class Q_GUI_EXPORT QOpenGLFunctions_2_0 : public QAbstractOpenGLFunctions
-{
-public:
- QOpenGLFunctions_2_0();
- ~QOpenGLFunctions_2_0();
-
- bool initializeOpenGLFunctions() override;
-
- // OpenGL 1.0 core functions
- void glViewport(GLint x, GLint y, GLsizei width, GLsizei height);
- void glDepthRange(GLdouble nearVal, GLdouble farVal);
- GLboolean glIsEnabled(GLenum cap);
- void glGetTexLevelParameteriv(GLenum target, GLint level, GLenum pname, GLint *params);
- void glGetTexLevelParameterfv(GLenum target, GLint level, GLenum pname, GLfloat *params);
- void glGetTexParameteriv(GLenum target, GLenum pname, GLint *params);
- void glGetTexParameterfv(GLenum target, GLenum pname, GLfloat *params);
- void glGetTexImage(GLenum target, GLint level, GLenum format, GLenum type, GLvoid *pixels);
- const GLubyte * glGetString(GLenum name);
- void glGetIntegerv(GLenum pname, GLint *params);
- void glGetFloatv(GLenum pname, GLfloat *params);
- GLenum glGetError();
- void glGetDoublev(GLenum pname, GLdouble *params);
- void glGetBooleanv(GLenum pname, GLboolean *params);
- void glReadPixels(GLint x, GLint y, GLsizei width, GLsizei height, GLenum format, GLenum type, GLvoid *pixels);
- void glReadBuffer(GLenum mode);
- void glPixelStorei(GLenum pname, GLint param);
- void glPixelStoref(GLenum pname, GLfloat param);
- void glDepthFunc(GLenum func);
- void glStencilOp(GLenum fail, GLenum zfail, GLenum zpass);
- void glStencilFunc(GLenum func, GLint ref, GLuint mask);
- void glLogicOp(GLenum opcode);
- void glBlendFunc(GLenum sfactor, GLenum dfactor);
- void glFlush();
- void glFinish();
- void glEnable(GLenum cap);
- void glDisable(GLenum cap);
- void glDepthMask(GLboolean flag);
- void glColorMask(GLboolean red, GLboolean green, GLboolean blue, GLboolean alpha);
- void glStencilMask(GLuint mask);
- void glClearDepth(GLdouble depth);
- void glClearStencil(GLint s);
- void glClearColor(GLfloat red, GLfloat green, GLfloat blue, GLfloat alpha);
- void glClear(GLbitfield mask);
- void glDrawBuffer(GLenum mode);
- void glTexImage2D(GLenum target, GLint level, GLint internalformat, GLsizei width, GLsizei height, GLint border, GLenum format, GLenum type, const GLvoid *pixels);
- void glTexImage1D(GLenum target, GLint level, GLint internalformat, GLsizei width, GLint border, GLenum format, GLenum type, const GLvoid *pixels);
- void glTexParameteriv(GLenum target, GLenum pname, const GLint *params);
- void glTexParameteri(GLenum target, GLenum pname, GLint param);
- void glTexParameterfv(GLenum target, GLenum pname, const GLfloat *params);
- void glTexParameterf(GLenum target, GLenum pname, GLfloat param);
- void glScissor(GLint x, GLint y, GLsizei width, GLsizei height);
- void glPolygonMode(GLenum face, GLenum mode);
- void glPointSize(GLfloat size);
- void glLineWidth(GLfloat width);
- void glHint(GLenum target, GLenum mode);
- void glFrontFace(GLenum mode);
- void glCullFace(GLenum mode);
-
- // OpenGL 1.1 core functions
- void glIndexubv(const GLubyte *c);
- void glIndexub(GLubyte c);
- GLboolean glIsTexture(GLuint texture);
- void glGenTextures(GLsizei n, GLuint *textures);
- void glDeleteTextures(GLsizei n, const GLuint *textures);
- void glBindTexture(GLenum target, GLuint texture);
- void glTexSubImage2D(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLenum type, const GLvoid *pixels);
- void glTexSubImage1D(GLenum target, GLint level, GLint xoffset, GLsizei width, GLenum format, GLenum type, const GLvoid *pixels);
- void glCopyTexSubImage2D(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint x, GLint y, GLsizei width, GLsizei height);
- void glCopyTexSubImage1D(GLenum target, GLint level, GLint xoffset, GLint x, GLint y, GLsizei width);
- void glCopyTexImage2D(GLenum target, GLint level, GLenum internalformat, GLint x, GLint y, GLsizei width, GLsizei height, GLint border);
- void glCopyTexImage1D(GLenum target, GLint level, GLenum internalformat, GLint x, GLint y, GLsizei width, GLint border);
- void glPolygonOffset(GLfloat factor, GLfloat units);
- void glGetPointerv(GLenum pname, GLvoid* *params);
- void glDrawElements(GLenum mode, GLsizei count, GLenum type, const GLvoid *indices);
- void glDrawArrays(GLenum mode, GLint first, GLsizei count);
-
- // OpenGL 1.2 core functions
- void glCopyTexSubImage3D(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLint x, GLint y, GLsizei width, GLsizei height);
- void glTexSubImage3D(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLenum type, const GLvoid *pixels);
- void glTexImage3D(GLenum target, GLint level, GLint internalformat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLenum format, GLenum type, const GLvoid *pixels);
- void glDrawRangeElements(GLenum mode, GLuint start, GLuint end, GLsizei count, GLenum type, const GLvoid *indices);
- void glBlendEquation(GLenum mode);
- void glBlendColor(GLfloat red, GLfloat green, GLfloat blue, GLfloat alpha);
-
- // OpenGL 1.3 core functions
- void glGetCompressedTexImage(GLenum target, GLint level, GLvoid *img);
- void glCompressedTexSubImage1D(GLenum target, GLint level, GLint xoffset, GLsizei width, GLenum format, GLsizei imageSize, const GLvoid *data);
- void glCompressedTexSubImage2D(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLsizei imageSize, const GLvoid *data);
- void glCompressedTexSubImage3D(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLsizei imageSize, const GLvoid *data);
- void glCompressedTexImage1D(GLenum target, GLint level, GLenum internalformat, GLsizei width, GLint border, GLsizei imageSize, const GLvoid *data);
- void glCompressedTexImage2D(GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLint border, GLsizei imageSize, const GLvoid *data);
- void glCompressedTexImage3D(GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLsizei imageSize, const GLvoid *data);
- void glSampleCoverage(GLfloat value, GLboolean invert);
- void glActiveTexture(GLenum texture);
-
- // OpenGL 1.4 core functions
- void glPointParameteriv(GLenum pname, const GLint *params);
- void glPointParameteri(GLenum pname, GLint param);
- void glPointParameterfv(GLenum pname, const GLfloat *params);
- void glPointParameterf(GLenum pname, GLfloat param);
- void glMultiDrawElements(GLenum mode, const GLsizei *count, GLenum type, const GLvoid* const *indices, GLsizei drawcount);
- void glMultiDrawArrays(GLenum mode, const GLint *first, const GLsizei *count, GLsizei drawcount);
- void glBlendFuncSeparate(GLenum sfactorRGB, GLenum dfactorRGB, GLenum sfactorAlpha, GLenum dfactorAlpha);
-
- // OpenGL 1.5 core functions
- void glGetBufferPointerv(GLenum target, GLenum pname, GLvoid* *params);
- void glGetBufferParameteriv(GLenum target, GLenum pname, GLint *params);
- GLboolean glUnmapBuffer(GLenum target);
- GLvoid* glMapBuffer(GLenum target, GLenum access);
- void glGetBufferSubData(GLenum target, GLintptr offset, GLsizeiptr size, GLvoid *data);
- void glBufferSubData(GLenum target, GLintptr offset, GLsizeiptr size, const GLvoid *data);
- void glBufferData(GLenum target, GLsizeiptr size, const GLvoid *data, GLenum usage);
- GLboolean glIsBuffer(GLuint buffer);
- void glGenBuffers(GLsizei n, GLuint *buffers);
- void glDeleteBuffers(GLsizei n, const GLuint *buffers);
- void glBindBuffer(GLenum target, GLuint buffer);
- void glGetQueryObjectuiv(GLuint id, GLenum pname, GLuint *params);
- void glGetQueryObjectiv(GLuint id, GLenum pname, GLint *params);
- void glGetQueryiv(GLenum target, GLenum pname, GLint *params);
- void glEndQuery(GLenum target);
- void glBeginQuery(GLenum target, GLuint id);
- GLboolean glIsQuery(GLuint id);
- void glDeleteQueries(GLsizei n, const GLuint *ids);
- void glGenQueries(GLsizei n, GLuint *ids);
-
- // OpenGL 2.0 core functions
- void glVertexAttribPointer(GLuint index, GLint size, GLenum type, GLboolean normalized, GLsizei stride, const GLvoid *pointer);
- void glValidateProgram(GLuint program);
- void glUniformMatrix4fv(GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
- void glUniformMatrix3fv(GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
- void glUniformMatrix2fv(GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
- void glUniform4iv(GLint location, GLsizei count, const GLint *value);
- void glUniform3iv(GLint location, GLsizei count, const GLint *value);
- void glUniform2iv(GLint location, GLsizei count, const GLint *value);
- void glUniform1iv(GLint location, GLsizei count, const GLint *value);
- void glUniform4fv(GLint location, GLsizei count, const GLfloat *value);
- void glUniform3fv(GLint location, GLsizei count, const GLfloat *value);
- void glUniform2fv(GLint location, GLsizei count, const GLfloat *value);
- void glUniform1fv(GLint location, GLsizei count, const GLfloat *value);
- void glUniform4i(GLint location, GLint v0, GLint v1, GLint v2, GLint v3);
- void glUniform3i(GLint location, GLint v0, GLint v1, GLint v2);
- void glUniform2i(GLint location, GLint v0, GLint v1);
- void glUniform1i(GLint location, GLint v0);
- void glUniform4f(GLint location, GLfloat v0, GLfloat v1, GLfloat v2, GLfloat v3);
- void glUniform3f(GLint location, GLfloat v0, GLfloat v1, GLfloat v2);
- void glUniform2f(GLint location, GLfloat v0, GLfloat v1);
- void glUniform1f(GLint location, GLfloat v0);
- void glUseProgram(GLuint program);
- void glShaderSource(GLuint shader, GLsizei count, const GLchar* const *string, const GLint *length);
- void glLinkProgram(GLuint program);
- GLboolean glIsShader(GLuint shader);
- GLboolean glIsProgram(GLuint program);
- void glGetVertexAttribPointerv(GLuint index, GLenum pname, GLvoid* *pointer);
- void glGetVertexAttribiv(GLuint index, GLenum pname, GLint *params);
- void glGetVertexAttribfv(GLuint index, GLenum pname, GLfloat *params);
- void glGetVertexAttribdv(GLuint index, GLenum pname, GLdouble *params);
- void glGetUniformiv(GLuint program, GLint location, GLint *params);
- void glGetUniformfv(GLuint program, GLint location, GLfloat *params);
- GLint glGetUniformLocation(GLuint program, const GLchar *name);
- void glGetShaderSource(GLuint shader, GLsizei bufSize, GLsizei *length, GLchar *source);
- void glGetShaderInfoLog(GLuint shader, GLsizei bufSize, GLsizei *length, GLchar *infoLog);
- void glGetShaderiv(GLuint shader, GLenum pname, GLint *params);
- void glGetProgramInfoLog(GLuint program, GLsizei bufSize, GLsizei *length, GLchar *infoLog);
- void glGetProgramiv(GLuint program, GLenum pname, GLint *params);
- GLint glGetAttribLocation(GLuint program, const GLchar *name);
- void glGetAttachedShaders(GLuint program, GLsizei maxCount, GLsizei *count, GLuint *obj);
- void glGetActiveUniform(GLuint program, GLuint index, GLsizei bufSize, GLsizei *length, GLint *size, GLenum *type, GLchar *name);
- void glGetActiveAttrib(GLuint program, GLuint index, GLsizei bufSize, GLsizei *length, GLint *size, GLenum *type, GLchar *name);
- void glEnableVertexAttribArray(GLuint index);
- void glDisableVertexAttribArray(GLuint index);
- void glDetachShader(GLuint program, GLuint shader);
- void glDeleteShader(GLuint shader);
- void glDeleteProgram(GLuint program);
- GLuint glCreateShader(GLenum type);
- GLuint glCreateProgram();
- void glCompileShader(GLuint shader);
- void glBindAttribLocation(GLuint program, GLuint index, const GLchar *name);
- void glAttachShader(GLuint program, GLuint shader);
- void glStencilMaskSeparate(GLenum face, GLuint mask);
- void glStencilFuncSeparate(GLenum face, GLenum func, GLint ref, GLuint mask);
- void glStencilOpSeparate(GLenum face, GLenum sfail, GLenum dpfail, GLenum dppass);
- void glDrawBuffers(GLsizei n, const GLenum *bufs);
- void glBlendEquationSeparate(GLenum modeRGB, GLenum modeAlpha);
-
- // OpenGL 1.0 deprecated functions
- void glTranslatef(GLfloat x, GLfloat y, GLfloat z);
- void glTranslated(GLdouble x, GLdouble y, GLdouble z);
- void glScalef(GLfloat x, GLfloat y, GLfloat z);
- void glScaled(GLdouble x, GLdouble y, GLdouble z);
- void glRotatef(GLfloat angle, GLfloat x, GLfloat y, GLfloat z);
- void glRotated(GLdouble angle, GLdouble x, GLdouble y, GLdouble z);
- void glPushMatrix();
- void glPopMatrix();
- void glOrtho(GLdouble left, GLdouble right, GLdouble bottom, GLdouble top, GLdouble zNear, GLdouble zFar);
- void glMultMatrixd(const GLdouble *m);
- void glMultMatrixf(const GLfloat *m);
- void glMatrixMode(GLenum mode);
- void glLoadMatrixd(const GLdouble *m);
- void glLoadMatrixf(const GLfloat *m);
- void glLoadIdentity();
- void glFrustum(GLdouble left, GLdouble right, GLdouble bottom, GLdouble top, GLdouble zNear, GLdouble zFar);
- GLboolean glIsList(GLuint list);
- void glGetTexGeniv(GLenum coord, GLenum pname, GLint *params);
- void glGetTexGenfv(GLenum coord, GLenum pname, GLfloat *params);
- void glGetTexGendv(GLenum coord, GLenum pname, GLdouble *params);
- void glGetTexEnviv(GLenum target, GLenum pname, GLint *params);
- void glGetTexEnvfv(GLenum target, GLenum pname, GLfloat *params);
- void glGetPolygonStipple(GLubyte *mask);
- void glGetPixelMapusv(GLenum map, GLushort *values);
- void glGetPixelMapuiv(GLenum map, GLuint *values);
- void glGetPixelMapfv(GLenum map, GLfloat *values);
- void glGetMaterialiv(GLenum face, GLenum pname, GLint *params);
- void glGetMaterialfv(GLenum face, GLenum pname, GLfloat *params);
- void glGetMapiv(GLenum target, GLenum query, GLint *v);
- void glGetMapfv(GLenum target, GLenum query, GLfloat *v);
- void glGetMapdv(GLenum target, GLenum query, GLdouble *v);
- void glGetLightiv(GLenum light, GLenum pname, GLint *params);
- void glGetLightfv(GLenum light, GLenum pname, GLfloat *params);
- void glGetClipPlane(GLenum plane, GLdouble *equation);
- void glDrawPixels(GLsizei width, GLsizei height, GLenum format, GLenum type, const GLvoid *pixels);
- void glCopyPixels(GLint x, GLint y, GLsizei width, GLsizei height, GLenum type);
- void glPixelMapusv(GLenum map, GLint mapsize, const GLushort *values);
- void glPixelMapuiv(GLenum map, GLint mapsize, const GLuint *values);
- void glPixelMapfv(GLenum map, GLint mapsize, const GLfloat *values);
- void glPixelTransferi(GLenum pname, GLint param);
- void glPixelTransferf(GLenum pname, GLfloat param);
- void glPixelZoom(GLfloat xfactor, GLfloat yfactor);
- void glAlphaFunc(GLenum func, GLfloat ref);
- void glEvalPoint2(GLint i, GLint j);
- void glEvalMesh2(GLenum mode, GLint i1, GLint i2, GLint j1, GLint j2);
- void glEvalPoint1(GLint i);
- void glEvalMesh1(GLenum mode, GLint i1, GLint i2);
- void glEvalCoord2fv(const GLfloat *u);
- void glEvalCoord2f(GLfloat u, GLfloat v);
- void glEvalCoord2dv(const GLdouble *u);
- void glEvalCoord2d(GLdouble u, GLdouble v);
- void glEvalCoord1fv(const GLfloat *u);
- void glEvalCoord1f(GLfloat u);
- void glEvalCoord1dv(const GLdouble *u);
- void glEvalCoord1d(GLdouble u);
- void glMapGrid2f(GLint un, GLfloat u1, GLfloat u2, GLint vn, GLfloat v1, GLfloat v2);
- void glMapGrid2d(GLint un, GLdouble u1, GLdouble u2, GLint vn, GLdouble v1, GLdouble v2);
- void glMapGrid1f(GLint un, GLfloat u1, GLfloat u2);
- void glMapGrid1d(GLint un, GLdouble u1, GLdouble u2);
- void glMap2f(GLenum target, GLfloat u1, GLfloat u2, GLint ustride, GLint uorder, GLfloat v1, GLfloat v2, GLint vstride, GLint vorder, const GLfloat *points);
- void glMap2d(GLenum target, GLdouble u1, GLdouble u2, GLint ustride, GLint uorder, GLdouble v1, GLdouble v2, GLint vstride, GLint vorder, const GLdouble *points);
- void glMap1f(GLenum target, GLfloat u1, GLfloat u2, GLint stride, GLint order, const GLfloat *points);
- void glMap1d(GLenum target, GLdouble u1, GLdouble u2, GLint stride, GLint order, const GLdouble *points);
- void glPushAttrib(GLbitfield mask);
- void glPopAttrib();
- void glAccum(GLenum op, GLfloat value);
- void glIndexMask(GLuint mask);
- void glClearIndex(GLfloat c);
- void glClearAccum(GLfloat red, GLfloat green, GLfloat blue, GLfloat alpha);
- void glPushName(GLuint name);
- void glPopName();
- void glPassThrough(GLfloat token);
- void glLoadName(GLuint name);
- void glInitNames();
- GLint glRenderMode(GLenum mode);
- void glSelectBuffer(GLsizei size, GLuint *buffer);
- void glFeedbackBuffer(GLsizei size, GLenum type, GLfloat *buffer);
- void glTexGeniv(GLenum coord, GLenum pname, const GLint *params);
- void glTexGeni(GLenum coord, GLenum pname, GLint param);
- void glTexGenfv(GLenum coord, GLenum pname, const GLfloat *params);
- void glTexGenf(GLenum coord, GLenum pname, GLfloat param);
- void glTexGendv(GLenum coord, GLenum pname, const GLdouble *params);
- void glTexGend(GLenum coord, GLenum pname, GLdouble param);
- void glTexEnviv(GLenum target, GLenum pname, const GLint *params);
- void glTexEnvi(GLenum target, GLenum pname, GLint param);
- void glTexEnvfv(GLenum target, GLenum pname, const GLfloat *params);
- void glTexEnvf(GLenum target, GLenum pname, GLfloat param);
- void glShadeModel(GLenum mode);
- void glPolygonStipple(const GLubyte *mask);
- void glMaterialiv(GLenum face, GLenum pname, const GLint *params);
- void glMateriali(GLenum face, GLenum pname, GLint param);
- void glMaterialfv(GLenum face, GLenum pname, const GLfloat *params);
- void glMaterialf(GLenum face, GLenum pname, GLfloat param);
- void glLineStipple(GLint factor, GLushort pattern);
- void glLightModeliv(GLenum pname, const GLint *params);
- void glLightModeli(GLenum pname, GLint param);
- void glLightModelfv(GLenum pname, const GLfloat *params);
- void glLightModelf(GLenum pname, GLfloat param);
- void glLightiv(GLenum light, GLenum pname, const GLint *params);
- void glLighti(GLenum light, GLenum pname, GLint param);
- void glLightfv(GLenum light, GLenum pname, const GLfloat *params);
- void glLightf(GLenum light, GLenum pname, GLfloat param);
- void glFogiv(GLenum pname, const GLint *params);
- void glFogi(GLenum pname, GLint param);
- void glFogfv(GLenum pname, const GLfloat *params);
- void glFogf(GLenum pname, GLfloat param);
- void glColorMaterial(GLenum face, GLenum mode);
- void glClipPlane(GLenum plane, const GLdouble *equation);
- void glVertex4sv(const GLshort *v);
- void glVertex4s(GLshort x, GLshort y, GLshort z, GLshort w);
- void glVertex4iv(const GLint *v);
- void glVertex4i(GLint x, GLint y, GLint z, GLint w);
- void glVertex4fv(const GLfloat *v);
- void glVertex4f(GLfloat x, GLfloat y, GLfloat z, GLfloat w);
- void glVertex4dv(const GLdouble *v);
- void glVertex4d(GLdouble x, GLdouble y, GLdouble z, GLdouble w);
- void glVertex3sv(const GLshort *v);
- void glVertex3s(GLshort x, GLshort y, GLshort z);
- void glVertex3iv(const GLint *v);
- void glVertex3i(GLint x, GLint y, GLint z);
- void glVertex3fv(const GLfloat *v);
- void glVertex3f(GLfloat x, GLfloat y, GLfloat z);
- void glVertex3dv(const GLdouble *v);
- void glVertex3d(GLdouble x, GLdouble y, GLdouble z);
- void glVertex2sv(const GLshort *v);
- void glVertex2s(GLshort x, GLshort y);
- void glVertex2iv(const GLint *v);
- void glVertex2i(GLint x, GLint y);
- void glVertex2fv(const GLfloat *v);
- void glVertex2f(GLfloat x, GLfloat y);
- void glVertex2dv(const GLdouble *v);
- void glVertex2d(GLdouble x, GLdouble y);
- void glTexCoord4sv(const GLshort *v);
- void glTexCoord4s(GLshort s, GLshort t, GLshort r, GLshort q);
- void glTexCoord4iv(const GLint *v);
- void glTexCoord4i(GLint s, GLint t, GLint r, GLint q);
- void glTexCoord4fv(const GLfloat *v);
- void glTexCoord4f(GLfloat s, GLfloat t, GLfloat r, GLfloat q);
- void glTexCoord4dv(const GLdouble *v);
- void glTexCoord4d(GLdouble s, GLdouble t, GLdouble r, GLdouble q);
- void glTexCoord3sv(const GLshort *v);
- void glTexCoord3s(GLshort s, GLshort t, GLshort r);
- void glTexCoord3iv(const GLint *v);
- void glTexCoord3i(GLint s, GLint t, GLint r);
- void glTexCoord3fv(const GLfloat *v);
- void glTexCoord3f(GLfloat s, GLfloat t, GLfloat r);
- void glTexCoord3dv(const GLdouble *v);
- void glTexCoord3d(GLdouble s, GLdouble t, GLdouble r);
- void glTexCoord2sv(const GLshort *v);
- void glTexCoord2s(GLshort s, GLshort t);
- void glTexCoord2iv(const GLint *v);
- void glTexCoord2i(GLint s, GLint t);
- void glTexCoord2fv(const GLfloat *v);
- void glTexCoord2f(GLfloat s, GLfloat t);
- void glTexCoord2dv(const GLdouble *v);
- void glTexCoord2d(GLdouble s, GLdouble t);
- void glTexCoord1sv(const GLshort *v);
- void glTexCoord1s(GLshort s);
- void glTexCoord1iv(const GLint *v);
- void glTexCoord1i(GLint s);
- void glTexCoord1fv(const GLfloat *v);
- void glTexCoord1f(GLfloat s);
- void glTexCoord1dv(const GLdouble *v);
- void glTexCoord1d(GLdouble s);
- void glRectsv(const GLshort *v1, const GLshort *v2);
- void glRects(GLshort x1, GLshort y1, GLshort x2, GLshort y2);
- void glRectiv(const GLint *v1, const GLint *v2);
- void glRecti(GLint x1, GLint y1, GLint x2, GLint y2);
- void glRectfv(const GLfloat *v1, const GLfloat *v2);
- void glRectf(GLfloat x1, GLfloat y1, GLfloat x2, GLfloat y2);
- void glRectdv(const GLdouble *v1, const GLdouble *v2);
- void glRectd(GLdouble x1, GLdouble y1, GLdouble x2, GLdouble y2);
- void glRasterPos4sv(const GLshort *v);
- void glRasterPos4s(GLshort x, GLshort y, GLshort z, GLshort w);
- void glRasterPos4iv(const GLint *v);
- void glRasterPos4i(GLint x, GLint y, GLint z, GLint w);
- void glRasterPos4fv(const GLfloat *v);
- void glRasterPos4f(GLfloat x, GLfloat y, GLfloat z, GLfloat w);
- void glRasterPos4dv(const GLdouble *v);
- void glRasterPos4d(GLdouble x, GLdouble y, GLdouble z, GLdouble w);
- void glRasterPos3sv(const GLshort *v);
- void glRasterPos3s(GLshort x, GLshort y, GLshort z);
- void glRasterPos3iv(const GLint *v);
- void glRasterPos3i(GLint x, GLint y, GLint z);
- void glRasterPos3fv(const GLfloat *v);
- void glRasterPos3f(GLfloat x, GLfloat y, GLfloat z);
- void glRasterPos3dv(const GLdouble *v);
- void glRasterPos3d(GLdouble x, GLdouble y, GLdouble z);
- void glRasterPos2sv(const GLshort *v);
- void glRasterPos2s(GLshort x, GLshort y);
- void glRasterPos2iv(const GLint *v);
- void glRasterPos2i(GLint x, GLint y);
- void glRasterPos2fv(const GLfloat *v);
- void glRasterPos2f(GLfloat x, GLfloat y);
- void glRasterPos2dv(const GLdouble *v);
- void glRasterPos2d(GLdouble x, GLdouble y);
- void glNormal3sv(const GLshort *v);
- void glNormal3s(GLshort nx, GLshort ny, GLshort nz);
- void glNormal3iv(const GLint *v);
- void glNormal3i(GLint nx, GLint ny, GLint nz);
- void glNormal3fv(const GLfloat *v);
- void glNormal3f(GLfloat nx, GLfloat ny, GLfloat nz);
- void glNormal3dv(const GLdouble *v);
- void glNormal3d(GLdouble nx, GLdouble ny, GLdouble nz);
- void glNormal3bv(const GLbyte *v);
- void glNormal3b(GLbyte nx, GLbyte ny, GLbyte nz);
- void glIndexsv(const GLshort *c);
- void glIndexs(GLshort c);
- void glIndexiv(const GLint *c);
- void glIndexi(GLint c);
- void glIndexfv(const GLfloat *c);
- void glIndexf(GLfloat c);
- void glIndexdv(const GLdouble *c);
- void glIndexd(GLdouble c);
- void glEnd();
- void glEdgeFlagv(const GLboolean *flag);
- void glEdgeFlag(GLboolean flag);
- void glColor4usv(const GLushort *v);
- void glColor4us(GLushort red, GLushort green, GLushort blue, GLushort alpha);
- void glColor4uiv(const GLuint *v);
- void glColor4ui(GLuint red, GLuint green, GLuint blue, GLuint alpha);
- void glColor4ubv(const GLubyte *v);
- void glColor4ub(GLubyte red, GLubyte green, GLubyte blue, GLubyte alpha);
- void glColor4sv(const GLshort *v);
- void glColor4s(GLshort red, GLshort green, GLshort blue, GLshort alpha);
- void glColor4iv(const GLint *v);
- void glColor4i(GLint red, GLint green, GLint blue, GLint alpha);
- void glColor4fv(const GLfloat *v);
- void glColor4f(GLfloat red, GLfloat green, GLfloat blue, GLfloat alpha);
- void glColor4dv(const GLdouble *v);
- void glColor4d(GLdouble red, GLdouble green, GLdouble blue, GLdouble alpha);
- void glColor4bv(const GLbyte *v);
- void glColor4b(GLbyte red, GLbyte green, GLbyte blue, GLbyte alpha);
- void glColor3usv(const GLushort *v);
- void glColor3us(GLushort red, GLushort green, GLushort blue);
- void glColor3uiv(const GLuint *v);
- void glColor3ui(GLuint red, GLuint green, GLuint blue);
- void glColor3ubv(const GLubyte *v);
- void glColor3ub(GLubyte red, GLubyte green, GLubyte blue);
- void glColor3sv(const GLshort *v);
- void glColor3s(GLshort red, GLshort green, GLshort blue);
- void glColor3iv(const GLint *v);
- void glColor3i(GLint red, GLint green, GLint blue);
- void glColor3fv(const GLfloat *v);
- void glColor3f(GLfloat red, GLfloat green, GLfloat blue);
- void glColor3dv(const GLdouble *v);
- void glColor3d(GLdouble red, GLdouble green, GLdouble blue);
- void glColor3bv(const GLbyte *v);
- void glColor3b(GLbyte red, GLbyte green, GLbyte blue);
- void glBitmap(GLsizei width, GLsizei height, GLfloat xorig, GLfloat yorig, GLfloat xmove, GLfloat ymove, const GLubyte *bitmap);
- void glBegin(GLenum mode);
- void glListBase(GLuint base);
- GLuint glGenLists(GLsizei range);
- void glDeleteLists(GLuint list, GLsizei range);
- void glCallLists(GLsizei n, GLenum type, const GLvoid *lists);
- void glCallList(GLuint list);
- void glEndList();
- void glNewList(GLuint list, GLenum mode);
-
- // OpenGL 1.1 deprecated functions
- void glPushClientAttrib(GLbitfield mask);
- void glPopClientAttrib();
- void glPrioritizeTextures(GLsizei n, const GLuint *textures, const GLfloat *priorities);
- GLboolean glAreTexturesResident(GLsizei n, const GLuint *textures, GLboolean *residences);
- void glVertexPointer(GLint size, GLenum type, GLsizei stride, const GLvoid *pointer);
- void glTexCoordPointer(GLint size, GLenum type, GLsizei stride, const GLvoid *pointer);
- void glNormalPointer(GLenum type, GLsizei stride, const GLvoid *pointer);
- void glInterleavedArrays(GLenum format, GLsizei stride, const GLvoid *pointer);
- void glIndexPointer(GLenum type, GLsizei stride, const GLvoid *pointer);
- void glEnableClientState(GLenum array);
- void glEdgeFlagPointer(GLsizei stride, const GLvoid *pointer);
- void glDisableClientState(GLenum array);
- void glColorPointer(GLint size, GLenum type, GLsizei stride, const GLvoid *pointer);
- void glArrayElement(GLint i);
-
- // OpenGL 1.2 deprecated functions
- void glResetMinmax(GLenum target);
- void glResetHistogram(GLenum target);
- void glMinmax(GLenum target, GLenum internalformat, GLboolean sink);
- void glHistogram(GLenum target, GLsizei width, GLenum internalformat, GLboolean sink);
- void glGetMinmaxParameteriv(GLenum target, GLenum pname, GLint *params);
- void glGetMinmaxParameterfv(GLenum target, GLenum pname, GLfloat *params);
- void glGetMinmax(GLenum target, GLboolean reset, GLenum format, GLenum type, GLvoid *values);
- void glGetHistogramParameteriv(GLenum target, GLenum pname, GLint *params);
- void glGetHistogramParameterfv(GLenum target, GLenum pname, GLfloat *params);
- void glGetHistogram(GLenum target, GLboolean reset, GLenum format, GLenum type, GLvoid *values);
- void glSeparableFilter2D(GLenum target, GLenum internalformat, GLsizei width, GLsizei height, GLenum format, GLenum type, const GLvoid *row, const GLvoid *column);
- void glGetSeparableFilter(GLenum target, GLenum format, GLenum type, GLvoid *row, GLvoid *column, GLvoid *span);
- void glGetConvolutionParameteriv(GLenum target, GLenum pname, GLint *params);
- void glGetConvolutionParameterfv(GLenum target, GLenum pname, GLfloat *params);
- void glGetConvolutionFilter(GLenum target, GLenum format, GLenum type, GLvoid *image);
- void glCopyConvolutionFilter2D(GLenum target, GLenum internalformat, GLint x, GLint y, GLsizei width, GLsizei height);
- void glCopyConvolutionFilter1D(GLenum target, GLenum internalformat, GLint x, GLint y, GLsizei width);
- void glConvolutionParameteriv(GLenum target, GLenum pname, const GLint *params);
- void glConvolutionParameteri(GLenum target, GLenum pname, GLint params);
- void glConvolutionParameterfv(GLenum target, GLenum pname, const GLfloat *params);
- void glConvolutionParameterf(GLenum target, GLenum pname, GLfloat params);
- void glConvolutionFilter2D(GLenum target, GLenum internalformat, GLsizei width, GLsizei height, GLenum format, GLenum type, const GLvoid *image);
- void glConvolutionFilter1D(GLenum target, GLenum internalformat, GLsizei width, GLenum format, GLenum type, const GLvoid *image);
- void glCopyColorSubTable(GLenum target, GLsizei start, GLint x, GLint y, GLsizei width);
- void glColorSubTable(GLenum target, GLsizei start, GLsizei count, GLenum format, GLenum type, const GLvoid *data);
- void glGetColorTableParameteriv(GLenum target, GLenum pname, GLint *params);
- void glGetColorTableParameterfv(GLenum target, GLenum pname, GLfloat *params);
- void glGetColorTable(GLenum target, GLenum format, GLenum type, GLvoid *table);
- void glCopyColorTable(GLenum target, GLenum internalformat, GLint x, GLint y, GLsizei width);
- void glColorTableParameteriv(GLenum target, GLenum pname, const GLint *params);
- void glColorTableParameterfv(GLenum target, GLenum pname, const GLfloat *params);
- void glColorTable(GLenum target, GLenum internalformat, GLsizei width, GLenum format, GLenum type, const GLvoid *table);
-
- // OpenGL 1.3 deprecated functions
- void glMultTransposeMatrixd(const GLdouble *m);
- void glMultTransposeMatrixf(const GLfloat *m);
- void glLoadTransposeMatrixd(const GLdouble *m);
- void glLoadTransposeMatrixf(const GLfloat *m);
- void glMultiTexCoord4sv(GLenum target, const GLshort *v);
- void glMultiTexCoord4s(GLenum target, GLshort s, GLshort t, GLshort r, GLshort q);
- void glMultiTexCoord4iv(GLenum target, const GLint *v);
- void glMultiTexCoord4i(GLenum target, GLint s, GLint t, GLint r, GLint q);
- void glMultiTexCoord4fv(GLenum target, const GLfloat *v);
- void glMultiTexCoord4f(GLenum target, GLfloat s, GLfloat t, GLfloat r, GLfloat q);
- void glMultiTexCoord4dv(GLenum target, const GLdouble *v);
- void glMultiTexCoord4d(GLenum target, GLdouble s, GLdouble t, GLdouble r, GLdouble q);
- void glMultiTexCoord3sv(GLenum target, const GLshort *v);
- void glMultiTexCoord3s(GLenum target, GLshort s, GLshort t, GLshort r);
- void glMultiTexCoord3iv(GLenum target, const GLint *v);
- void glMultiTexCoord3i(GLenum target, GLint s, GLint t, GLint r);
- void glMultiTexCoord3fv(GLenum target, const GLfloat *v);
- void glMultiTexCoord3f(GLenum target, GLfloat s, GLfloat t, GLfloat r);
- void glMultiTexCoord3dv(GLenum target, const GLdouble *v);
- void glMultiTexCoord3d(GLenum target, GLdouble s, GLdouble t, GLdouble r);
- void glMultiTexCoord2sv(GLenum target, const GLshort *v);
- void glMultiTexCoord2s(GLenum target, GLshort s, GLshort t);
- void glMultiTexCoord2iv(GLenum target, const GLint *v);
- void glMultiTexCoord2i(GLenum target, GLint s, GLint t);
- void glMultiTexCoord2fv(GLenum target, const GLfloat *v);
- void glMultiTexCoord2f(GLenum target, GLfloat s, GLfloat t);
- void glMultiTexCoord2dv(GLenum target, const GLdouble *v);
- void glMultiTexCoord2d(GLenum target, GLdouble s, GLdouble t);
- void glMultiTexCoord1sv(GLenum target, const GLshort *v);
- void glMultiTexCoord1s(GLenum target, GLshort s);
- void glMultiTexCoord1iv(GLenum target, const GLint *v);
- void glMultiTexCoord1i(GLenum target, GLint s);
- void glMultiTexCoord1fv(GLenum target, const GLfloat *v);
- void glMultiTexCoord1f(GLenum target, GLfloat s);
- void glMultiTexCoord1dv(GLenum target, const GLdouble *v);
- void glMultiTexCoord1d(GLenum target, GLdouble s);
- void glClientActiveTexture(GLenum texture);
-
- // OpenGL 1.4 deprecated functions
- void glWindowPos3sv(const GLshort *v);
- void glWindowPos3s(GLshort x, GLshort y, GLshort z);
- void glWindowPos3iv(const GLint *v);
- void glWindowPos3i(GLint x, GLint y, GLint z);
- void glWindowPos3fv(const GLfloat *v);
- void glWindowPos3f(GLfloat x, GLfloat y, GLfloat z);
- void glWindowPos3dv(const GLdouble *v);
- void glWindowPos3d(GLdouble x, GLdouble y, GLdouble z);
- void glWindowPos2sv(const GLshort *v);
- void glWindowPos2s(GLshort x, GLshort y);
- void glWindowPos2iv(const GLint *v);
- void glWindowPos2i(GLint x, GLint y);
- void glWindowPos2fv(const GLfloat *v);
- void glWindowPos2f(GLfloat x, GLfloat y);
- void glWindowPos2dv(const GLdouble *v);
- void glWindowPos2d(GLdouble x, GLdouble y);
- void glSecondaryColorPointer(GLint size, GLenum type, GLsizei stride, const GLvoid *pointer);
- void glSecondaryColor3usv(const GLushort *v);
- void glSecondaryColor3us(GLushort red, GLushort green, GLushort blue);
- void glSecondaryColor3uiv(const GLuint *v);
- void glSecondaryColor3ui(GLuint red, GLuint green, GLuint blue);
- void glSecondaryColor3ubv(const GLubyte *v);
- void glSecondaryColor3ub(GLubyte red, GLubyte green, GLubyte blue);
- void glSecondaryColor3sv(const GLshort *v);
- void glSecondaryColor3s(GLshort red, GLshort green, GLshort blue);
- void glSecondaryColor3iv(const GLint *v);
- void glSecondaryColor3i(GLint red, GLint green, GLint blue);
- void glSecondaryColor3fv(const GLfloat *v);
- void glSecondaryColor3f(GLfloat red, GLfloat green, GLfloat blue);
- void glSecondaryColor3dv(const GLdouble *v);
- void glSecondaryColor3d(GLdouble red, GLdouble green, GLdouble blue);
- void glSecondaryColor3bv(const GLbyte *v);
- void glSecondaryColor3b(GLbyte red, GLbyte green, GLbyte blue);
- void glFogCoordPointer(GLenum type, GLsizei stride, const GLvoid *pointer);
- void glFogCoorddv(const GLdouble *coord);
- void glFogCoordd(GLdouble coord);
- void glFogCoordfv(const GLfloat *coord);
- void glFogCoordf(GLfloat coord);
-
- // OpenGL 1.5 deprecated functions
-
- // OpenGL 2.0 deprecated functions
- void glVertexAttrib4usv(GLuint index, const GLushort *v);
- void glVertexAttrib4uiv(GLuint index, const GLuint *v);
- void glVertexAttrib4ubv(GLuint index, const GLubyte *v);
- void glVertexAttrib4sv(GLuint index, const GLshort *v);
- void glVertexAttrib4s(GLuint index, GLshort x, GLshort y, GLshort z, GLshort w);
- void glVertexAttrib4iv(GLuint index, const GLint *v);
- void glVertexAttrib4fv(GLuint index, const GLfloat *v);
- void glVertexAttrib4f(GLuint index, GLfloat x, GLfloat y, GLfloat z, GLfloat w);
- void glVertexAttrib4dv(GLuint index, const GLdouble *v);
- void glVertexAttrib4d(GLuint index, GLdouble x, GLdouble y, GLdouble z, GLdouble w);
- void glVertexAttrib4bv(GLuint index, const GLbyte *v);
- void glVertexAttrib4Nusv(GLuint index, const GLushort *v);
- void glVertexAttrib4Nuiv(GLuint index, const GLuint *v);
- void glVertexAttrib4Nubv(GLuint index, const GLubyte *v);
- void glVertexAttrib4Nub(GLuint index, GLubyte x, GLubyte y, GLubyte z, GLubyte w);
- void glVertexAttrib4Nsv(GLuint index, const GLshort *v);
- void glVertexAttrib4Niv(GLuint index, const GLint *v);
- void glVertexAttrib4Nbv(GLuint index, const GLbyte *v);
- void glVertexAttrib3sv(GLuint index, const GLshort *v);
- void glVertexAttrib3s(GLuint index, GLshort x, GLshort y, GLshort z);
- void glVertexAttrib3fv(GLuint index, const GLfloat *v);
- void glVertexAttrib3f(GLuint index, GLfloat x, GLfloat y, GLfloat z);
- void glVertexAttrib3dv(GLuint index, const GLdouble *v);
- void glVertexAttrib3d(GLuint index, GLdouble x, GLdouble y, GLdouble z);
- void glVertexAttrib2sv(GLuint index, const GLshort *v);
- void glVertexAttrib2s(GLuint index, GLshort x, GLshort y);
- void glVertexAttrib2fv(GLuint index, const GLfloat *v);
- void glVertexAttrib2f(GLuint index, GLfloat x, GLfloat y);
- void glVertexAttrib2dv(GLuint index, const GLdouble *v);
- void glVertexAttrib2d(GLuint index, GLdouble x, GLdouble y);
- void glVertexAttrib1sv(GLuint index, const GLshort *v);
- void glVertexAttrib1s(GLuint index, GLshort x);
- void glVertexAttrib1fv(GLuint index, const GLfloat *v);
- void glVertexAttrib1f(GLuint index, GLfloat x);
- void glVertexAttrib1dv(GLuint index, const GLdouble *v);
- void glVertexAttrib1d(GLuint index, GLdouble x);
-
-private:
- friend class QOpenGLContext;
-
- static bool isContextCompatible(QOpenGLContext *context);
- static QOpenGLVersionProfile versionProfile();
-
- QOpenGLFunctions_1_0_CoreBackend* d_1_0_Core;
- QOpenGLFunctions_1_1_CoreBackend* d_1_1_Core;
- QOpenGLFunctions_1_2_CoreBackend* d_1_2_Core;
- QOpenGLFunctions_1_3_CoreBackend* d_1_3_Core;
- QOpenGLFunctions_1_4_CoreBackend* d_1_4_Core;
- QOpenGLFunctions_1_5_CoreBackend* d_1_5_Core;
- QOpenGLFunctions_2_0_CoreBackend* d_2_0_Core;
- QOpenGLFunctions_1_0_DeprecatedBackend* d_1_0_Deprecated;
- QOpenGLFunctions_1_1_DeprecatedBackend* d_1_1_Deprecated;
- QOpenGLFunctions_1_2_DeprecatedBackend* d_1_2_Deprecated;
- QOpenGLFunctions_1_3_DeprecatedBackend* d_1_3_Deprecated;
- QOpenGLFunctions_1_4_DeprecatedBackend* d_1_4_Deprecated;
- void *m_reserved_2_0_Deprecated; // To maintain BC
-};
-
-// OpenGL 1.0 core functions
-inline void QOpenGLFunctions_2_0::glViewport(GLint x, GLint y, GLsizei width, GLsizei height)
-{
- d_1_0_Core->f.Viewport(x, y, width, height);
-}
-
-inline void QOpenGLFunctions_2_0::glDepthRange(GLdouble nearVal, GLdouble farVal)
-{
- d_1_0_Core->f.DepthRange(nearVal, farVal);
-}
-
-inline GLboolean QOpenGLFunctions_2_0::glIsEnabled(GLenum cap)
-{
- return d_1_0_Core->f.IsEnabled(cap);
-}
-
-inline void QOpenGLFunctions_2_0::glGetTexLevelParameteriv(GLenum target, GLint level, GLenum pname, GLint *params)
-{
- d_1_0_Core->f.GetTexLevelParameteriv(target, level, pname, params);
-}
-
-inline void QOpenGLFunctions_2_0::glGetTexLevelParameterfv(GLenum target, GLint level, GLenum pname, GLfloat *params)
-{
- d_1_0_Core->f.GetTexLevelParameterfv(target, level, pname, params);
-}
-
-inline void QOpenGLFunctions_2_0::glGetTexParameteriv(GLenum target, GLenum pname, GLint *params)
-{
- d_1_0_Core->f.GetTexParameteriv(target, pname, params);
-}
-
-inline void QOpenGLFunctions_2_0::glGetTexParameterfv(GLenum target, GLenum pname, GLfloat *params)
-{
- d_1_0_Core->f.GetTexParameterfv(target, pname, params);
-}
-
-inline void QOpenGLFunctions_2_0::glGetTexImage(GLenum target, GLint level, GLenum format, GLenum type, GLvoid *pixels)
-{
- d_1_0_Core->f.GetTexImage(target, level, format, type, pixels);
-}
-
-inline const GLubyte * QOpenGLFunctions_2_0::glGetString(GLenum name)
-{
- return d_1_0_Core->f.GetString(name);
-}
-
-inline void QOpenGLFunctions_2_0::glGetIntegerv(GLenum pname, GLint *params)
-{
- d_1_0_Core->f.GetIntegerv(pname, params);
-}
-
-inline void QOpenGLFunctions_2_0::glGetFloatv(GLenum pname, GLfloat *params)
-{
- d_1_0_Core->f.GetFloatv(pname, params);
-}
-
-inline GLenum QOpenGLFunctions_2_0::glGetError()
-{
- return d_1_0_Core->f.GetError();
-}
-
-inline void QOpenGLFunctions_2_0::glGetDoublev(GLenum pname, GLdouble *params)
-{
- d_1_0_Core->f.GetDoublev(pname, params);
-}
-
-inline void QOpenGLFunctions_2_0::glGetBooleanv(GLenum pname, GLboolean *params)
-{
- d_1_0_Core->f.GetBooleanv(pname, params);
-}
-
-inline void QOpenGLFunctions_2_0::glReadPixels(GLint x, GLint y, GLsizei width, GLsizei height, GLenum format, GLenum type, GLvoid *pixels)
-{
- d_1_0_Core->f.ReadPixels(x, y, width, height, format, type, pixels);
-}
-
-inline void QOpenGLFunctions_2_0::glReadBuffer(GLenum mode)
-{
- d_1_0_Core->f.ReadBuffer(mode);
-}
-
-inline void QOpenGLFunctions_2_0::glPixelStorei(GLenum pname, GLint param)
-{
- d_1_0_Core->f.PixelStorei(pname, param);
-}
-
-inline void QOpenGLFunctions_2_0::glPixelStoref(GLenum pname, GLfloat param)
-{
- d_1_0_Core->f.PixelStoref(pname, param);
-}
-
-inline void QOpenGLFunctions_2_0::glDepthFunc(GLenum func)
-{
- d_1_0_Core->f.DepthFunc(func);
-}
-
-inline void QOpenGLFunctions_2_0::glStencilOp(GLenum fail, GLenum zfail, GLenum zpass)
-{
- d_1_0_Core->f.StencilOp(fail, zfail, zpass);
-}
-
-inline void QOpenGLFunctions_2_0::glStencilFunc(GLenum func, GLint ref, GLuint mask)
-{
- d_1_0_Core->f.StencilFunc(func, ref, mask);
-}
-
-inline void QOpenGLFunctions_2_0::glLogicOp(GLenum opcode)
-{
- d_1_0_Core->f.LogicOp(opcode);
-}
-
-inline void QOpenGLFunctions_2_0::glBlendFunc(GLenum sfactor, GLenum dfactor)
-{
- d_1_0_Core->f.BlendFunc(sfactor, dfactor);
-}
-
-inline void QOpenGLFunctions_2_0::glFlush()
-{
- d_1_0_Core->f.Flush();
-}
-
-inline void QOpenGLFunctions_2_0::glFinish()
-{
- d_1_0_Core->f.Finish();
-}
-
-inline void QOpenGLFunctions_2_0::glEnable(GLenum cap)
-{
- d_1_0_Core->f.Enable(cap);
-}
-
-inline void QOpenGLFunctions_2_0::glDisable(GLenum cap)
-{
- d_1_0_Core->f.Disable(cap);
-}
-
-inline void QOpenGLFunctions_2_0::glDepthMask(GLboolean flag)
-{
- d_1_0_Core->f.DepthMask(flag);
-}
-
-inline void QOpenGLFunctions_2_0::glColorMask(GLboolean red, GLboolean green, GLboolean blue, GLboolean alpha)
-{
- d_1_0_Core->f.ColorMask(red, green, blue, alpha);
-}
-
-inline void QOpenGLFunctions_2_0::glStencilMask(GLuint mask)
-{
- d_1_0_Core->f.StencilMask(mask);
-}
-
-inline void QOpenGLFunctions_2_0::glClearDepth(GLdouble depth)
-{
- d_1_0_Core->f.ClearDepth(depth);
-}
-
-inline void QOpenGLFunctions_2_0::glClearStencil(GLint s)
-{
- d_1_0_Core->f.ClearStencil(s);
-}
-
-inline void QOpenGLFunctions_2_0::glClearColor(GLfloat red, GLfloat green, GLfloat blue, GLfloat alpha)
-{
- d_1_0_Core->f.ClearColor(red, green, blue, alpha);
-}
-
-inline void QOpenGLFunctions_2_0::glClear(GLbitfield mask)
-{
- d_1_0_Core->f.Clear(mask);
-}
-
-inline void QOpenGLFunctions_2_0::glDrawBuffer(GLenum mode)
-{
- d_1_0_Core->f.DrawBuffer(mode);
-}
-
-inline void QOpenGLFunctions_2_0::glTexImage2D(GLenum target, GLint level, GLint internalformat, GLsizei width, GLsizei height, GLint border, GLenum format, GLenum type, const GLvoid *pixels)
-{
- d_1_0_Core->f.TexImage2D(target, level, internalformat, width, height, border, format, type, pixels);
-}
-
-inline void QOpenGLFunctions_2_0::glTexImage1D(GLenum target, GLint level, GLint internalformat, GLsizei width, GLint border, GLenum format, GLenum type, const GLvoid *pixels)
-{
- d_1_0_Core->f.TexImage1D(target, level, internalformat, width, border, format, type, pixels);
-}
-
-inline void QOpenGLFunctions_2_0::glTexParameteriv(GLenum target, GLenum pname, const GLint *params)
-{
- d_1_0_Core->f.TexParameteriv(target, pname, params);
-}
-
-inline void QOpenGLFunctions_2_0::glTexParameteri(GLenum target, GLenum pname, GLint param)
-{
- d_1_0_Core->f.TexParameteri(target, pname, param);
-}
-
-inline void QOpenGLFunctions_2_0::glTexParameterfv(GLenum target, GLenum pname, const GLfloat *params)
-{
- d_1_0_Core->f.TexParameterfv(target, pname, params);
-}
-
-inline void QOpenGLFunctions_2_0::glTexParameterf(GLenum target, GLenum pname, GLfloat param)
-{
- d_1_0_Core->f.TexParameterf(target, pname, param);
-}
-
-inline void QOpenGLFunctions_2_0::glScissor(GLint x, GLint y, GLsizei width, GLsizei height)
-{
- d_1_0_Core->f.Scissor(x, y, width, height);
-}
-
-inline void QOpenGLFunctions_2_0::glPolygonMode(GLenum face, GLenum mode)
-{
- d_1_0_Core->f.PolygonMode(face, mode);
-}
-
-inline void QOpenGLFunctions_2_0::glPointSize(GLfloat size)
-{
- d_1_0_Core->f.PointSize(size);
-}
-
-inline void QOpenGLFunctions_2_0::glLineWidth(GLfloat width)
-{
- d_1_0_Core->f.LineWidth(width);
-}
-
-inline void QOpenGLFunctions_2_0::glHint(GLenum target, GLenum mode)
-{
- d_1_0_Core->f.Hint(target, mode);
-}
-
-inline void QOpenGLFunctions_2_0::glFrontFace(GLenum mode)
-{
- d_1_0_Core->f.FrontFace(mode);
-}
-
-inline void QOpenGLFunctions_2_0::glCullFace(GLenum mode)
-{
- d_1_0_Core->f.CullFace(mode);
-}
-
-
-// OpenGL 1.1 core functions
-inline void QOpenGLFunctions_2_0::glIndexubv(const GLubyte *c)
-{
- d_1_1_Deprecated->f.Indexubv(c);
-}
-
-inline void QOpenGLFunctions_2_0::glIndexub(GLubyte c)
-{
- d_1_1_Deprecated->f.Indexub(c);
-}
-
-inline GLboolean QOpenGLFunctions_2_0::glIsTexture(GLuint texture)
-{
- return d_1_1_Core->f.IsTexture(texture);
-}
-
-inline void QOpenGLFunctions_2_0::glGenTextures(GLsizei n, GLuint *textures)
-{
- d_1_1_Core->f.GenTextures(n, textures);
-}
-
-inline void QOpenGLFunctions_2_0::glDeleteTextures(GLsizei n, const GLuint *textures)
-{
- d_1_1_Core->f.DeleteTextures(n, textures);
-}
-
-inline void QOpenGLFunctions_2_0::glBindTexture(GLenum target, GLuint texture)
-{
- d_1_1_Core->f.BindTexture(target, texture);
-}
-
-inline void QOpenGLFunctions_2_0::glTexSubImage2D(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLenum type, const GLvoid *pixels)
-{
- d_1_1_Core->f.TexSubImage2D(target, level, xoffset, yoffset, width, height, format, type, pixels);
-}
-
-inline void QOpenGLFunctions_2_0::glTexSubImage1D(GLenum target, GLint level, GLint xoffset, GLsizei width, GLenum format, GLenum type, const GLvoid *pixels)
-{
- d_1_1_Core->f.TexSubImage1D(target, level, xoffset, width, format, type, pixels);
-}
-
-inline void QOpenGLFunctions_2_0::glCopyTexSubImage2D(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint x, GLint y, GLsizei width, GLsizei height)
-{
- d_1_1_Core->f.CopyTexSubImage2D(target, level, xoffset, yoffset, x, y, width, height);
-}
-
-inline void QOpenGLFunctions_2_0::glCopyTexSubImage1D(GLenum target, GLint level, GLint xoffset, GLint x, GLint y, GLsizei width)
-{
- d_1_1_Core->f.CopyTexSubImage1D(target, level, xoffset, x, y, width);
-}
-
-inline void QOpenGLFunctions_2_0::glCopyTexImage2D(GLenum target, GLint level, GLenum internalformat, GLint x, GLint y, GLsizei width, GLsizei height, GLint border)
-{
- d_1_1_Core->f.CopyTexImage2D(target, level, internalformat, x, y, width, height, border);
-}
-
-inline void QOpenGLFunctions_2_0::glCopyTexImage1D(GLenum target, GLint level, GLenum internalformat, GLint x, GLint y, GLsizei width, GLint border)
-{
- d_1_1_Core->f.CopyTexImage1D(target, level, internalformat, x, y, width, border);
-}
-
-inline void QOpenGLFunctions_2_0::glPolygonOffset(GLfloat factor, GLfloat units)
-{
- d_1_1_Core->f.PolygonOffset(factor, units);
-}
-
-inline void QOpenGLFunctions_2_0::glGetPointerv(GLenum pname, GLvoid* *params)
-{
- d_1_1_Deprecated->f.GetPointerv(pname, params);
-}
-
-inline void QOpenGLFunctions_2_0::glDrawElements(GLenum mode, GLsizei count, GLenum type, const GLvoid *indices)
-{
- d_1_1_Core->f.DrawElements(mode, count, type, indices);
-}
-
-inline void QOpenGLFunctions_2_0::glDrawArrays(GLenum mode, GLint first, GLsizei count)
-{
- d_1_1_Core->f.DrawArrays(mode, first, count);
-}
-
-
-// OpenGL 1.2 core functions
-inline void QOpenGLFunctions_2_0::glCopyTexSubImage3D(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLint x, GLint y, GLsizei width, GLsizei height)
-{
- d_1_2_Core->f.CopyTexSubImage3D(target, level, xoffset, yoffset, zoffset, x, y, width, height);
-}
-
-inline void QOpenGLFunctions_2_0::glTexSubImage3D(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLenum type, const GLvoid *pixels)
-{
- d_1_2_Core->f.TexSubImage3D(target, level, xoffset, yoffset, zoffset, width, height, depth, format, type, pixels);
-}
-
-inline void QOpenGLFunctions_2_0::glTexImage3D(GLenum target, GLint level, GLint internalformat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLenum format, GLenum type, const GLvoid *pixels)
-{
- d_1_2_Core->f.TexImage3D(target, level, internalformat, width, height, depth, border, format, type, pixels);
-}
-
-inline void QOpenGLFunctions_2_0::glDrawRangeElements(GLenum mode, GLuint start, GLuint end, GLsizei count, GLenum type, const GLvoid *indices)
-{
- d_1_2_Core->f.DrawRangeElements(mode, start, end, count, type, indices);
-}
-
-inline void QOpenGLFunctions_2_0::glBlendEquation(GLenum mode)
-{
- d_1_2_Core->f.BlendEquation(mode);
-}
-
-inline void QOpenGLFunctions_2_0::glBlendColor(GLfloat red, GLfloat green, GLfloat blue, GLfloat alpha)
-{
- d_1_2_Core->f.BlendColor(red, green, blue, alpha);
-}
-
-
-// OpenGL 1.3 core functions
-inline void QOpenGLFunctions_2_0::glGetCompressedTexImage(GLenum target, GLint level, GLvoid *img)
-{
- d_1_3_Core->f.GetCompressedTexImage(target, level, img);
-}
-
-inline void QOpenGLFunctions_2_0::glCompressedTexSubImage1D(GLenum target, GLint level, GLint xoffset, GLsizei width, GLenum format, GLsizei imageSize, const GLvoid *data)
-{
- d_1_3_Core->f.CompressedTexSubImage1D(target, level, xoffset, width, format, imageSize, data);
-}
-
-inline void QOpenGLFunctions_2_0::glCompressedTexSubImage2D(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLsizei imageSize, const GLvoid *data)
-{
- d_1_3_Core->f.CompressedTexSubImage2D(target, level, xoffset, yoffset, width, height, format, imageSize, data);
-}
-
-inline void QOpenGLFunctions_2_0::glCompressedTexSubImage3D(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLsizei imageSize, const GLvoid *data)
-{
- d_1_3_Core->f.CompressedTexSubImage3D(target, level, xoffset, yoffset, zoffset, width, height, depth, format, imageSize, data);
-}
-
-inline void QOpenGLFunctions_2_0::glCompressedTexImage1D(GLenum target, GLint level, GLenum internalformat, GLsizei width, GLint border, GLsizei imageSize, const GLvoid *data)
-{
- d_1_3_Core->f.CompressedTexImage1D(target, level, internalformat, width, border, imageSize, data);
-}
-
-inline void QOpenGLFunctions_2_0::glCompressedTexImage2D(GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLint border, GLsizei imageSize, const GLvoid *data)
-{
- d_1_3_Core->f.CompressedTexImage2D(target, level, internalformat, width, height, border, imageSize, data);
-}
-
-inline void QOpenGLFunctions_2_0::glCompressedTexImage3D(GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLsizei imageSize, const GLvoid *data)
-{
- d_1_3_Core->f.CompressedTexImage3D(target, level, internalformat, width, height, depth, border, imageSize, data);
-}
-
-inline void QOpenGLFunctions_2_0::glSampleCoverage(GLfloat value, GLboolean invert)
-{
- d_1_3_Core->f.SampleCoverage(value, invert);
-}
-
-inline void QOpenGLFunctions_2_0::glActiveTexture(GLenum texture)
-{
- d_1_3_Core->f.ActiveTexture(texture);
-}
-
-
-// OpenGL 1.4 core functions
-inline void QOpenGLFunctions_2_0::glPointParameteriv(GLenum pname, const GLint *params)
-{
- d_1_4_Core->f.PointParameteriv(pname, params);
-}
-
-inline void QOpenGLFunctions_2_0::glPointParameteri(GLenum pname, GLint param)
-{
- d_1_4_Core->f.PointParameteri(pname, param);
-}
-
-inline void QOpenGLFunctions_2_0::glPointParameterfv(GLenum pname, const GLfloat *params)
-{
- d_1_4_Core->f.PointParameterfv(pname, params);
-}
-
-inline void QOpenGLFunctions_2_0::glPointParameterf(GLenum pname, GLfloat param)
-{
- d_1_4_Core->f.PointParameterf(pname, param);
-}
-
-inline void QOpenGLFunctions_2_0::glMultiDrawElements(GLenum mode, const GLsizei *count, GLenum type, const GLvoid* const *indices, GLsizei drawcount)
-{
- d_1_4_Core->f.MultiDrawElements(mode, count, type, indices, drawcount);
-}
-
-inline void QOpenGLFunctions_2_0::glMultiDrawArrays(GLenum mode, const GLint *first, const GLsizei *count, GLsizei drawcount)
-{
- d_1_4_Core->f.MultiDrawArrays(mode, first, count, drawcount);
-}
-
-inline void QOpenGLFunctions_2_0::glBlendFuncSeparate(GLenum sfactorRGB, GLenum dfactorRGB, GLenum sfactorAlpha, GLenum dfactorAlpha)
-{
- d_1_4_Core->f.BlendFuncSeparate(sfactorRGB, dfactorRGB, sfactorAlpha, dfactorAlpha);
-}
-
-
-// OpenGL 1.5 core functions
-inline void QOpenGLFunctions_2_0::glGetBufferPointerv(GLenum target, GLenum pname, GLvoid* *params)
-{
- d_1_5_Core->f.GetBufferPointerv(target, pname, params);
-}
-
-inline void QOpenGLFunctions_2_0::glGetBufferParameteriv(GLenum target, GLenum pname, GLint *params)
-{
- d_1_5_Core->f.GetBufferParameteriv(target, pname, params);
-}
-
-inline GLboolean QOpenGLFunctions_2_0::glUnmapBuffer(GLenum target)
-{
- return d_1_5_Core->f.UnmapBuffer(target);
-}
-
-inline GLvoid* QOpenGLFunctions_2_0::glMapBuffer(GLenum target, GLenum access)
-{
- return d_1_5_Core->f.MapBuffer(target, access);
-}
-
-inline void QOpenGLFunctions_2_0::glGetBufferSubData(GLenum target, GLintptr offset, GLsizeiptr size, GLvoid *data)
-{
- d_1_5_Core->f.GetBufferSubData(target, offset, size, data);
-}
-
-inline void QOpenGLFunctions_2_0::glBufferSubData(GLenum target, GLintptr offset, GLsizeiptr size, const GLvoid *data)
-{
- d_1_5_Core->f.BufferSubData(target, offset, size, data);
-}
-
-inline void QOpenGLFunctions_2_0::glBufferData(GLenum target, GLsizeiptr size, const GLvoid *data, GLenum usage)
-{
- d_1_5_Core->f.BufferData(target, size, data, usage);
-}
-
-inline GLboolean QOpenGLFunctions_2_0::glIsBuffer(GLuint buffer)
-{
- return d_1_5_Core->f.IsBuffer(buffer);
-}
-
-inline void QOpenGLFunctions_2_0::glGenBuffers(GLsizei n, GLuint *buffers)
-{
- d_1_5_Core->f.GenBuffers(n, buffers);
-}
-
-inline void QOpenGLFunctions_2_0::glDeleteBuffers(GLsizei n, const GLuint *buffers)
-{
- d_1_5_Core->f.DeleteBuffers(n, buffers);
-}
-
-inline void QOpenGLFunctions_2_0::glBindBuffer(GLenum target, GLuint buffer)
-{
- d_1_5_Core->f.BindBuffer(target, buffer);
-}
-
-inline void QOpenGLFunctions_2_0::glGetQueryObjectuiv(GLuint id, GLenum pname, GLuint *params)
-{
- d_1_5_Core->f.GetQueryObjectuiv(id, pname, params);
-}
-
-inline void QOpenGLFunctions_2_0::glGetQueryObjectiv(GLuint id, GLenum pname, GLint *params)
-{
- d_1_5_Core->f.GetQueryObjectiv(id, pname, params);
-}
-
-inline void QOpenGLFunctions_2_0::glGetQueryiv(GLenum target, GLenum pname, GLint *params)
-{
- d_1_5_Core->f.GetQueryiv(target, pname, params);
-}
-
-inline void QOpenGLFunctions_2_0::glEndQuery(GLenum target)
-{
- d_1_5_Core->f.EndQuery(target);
-}
-
-inline void QOpenGLFunctions_2_0::glBeginQuery(GLenum target, GLuint id)
-{
- d_1_5_Core->f.BeginQuery(target, id);
-}
-
-inline GLboolean QOpenGLFunctions_2_0::glIsQuery(GLuint id)
-{
- return d_1_5_Core->f.IsQuery(id);
-}
-
-inline void QOpenGLFunctions_2_0::glDeleteQueries(GLsizei n, const GLuint *ids)
-{
- d_1_5_Core->f.DeleteQueries(n, ids);
-}
-
-inline void QOpenGLFunctions_2_0::glGenQueries(GLsizei n, GLuint *ids)
-{
- d_1_5_Core->f.GenQueries(n, ids);
-}
-
-
-// OpenGL 2.0 core functions
-inline void QOpenGLFunctions_2_0::glVertexAttribPointer(GLuint index, GLint size, GLenum type, GLboolean normalized, GLsizei stride, const GLvoid *pointer)
-{
- d_2_0_Core->f.VertexAttribPointer(index, size, type, normalized, stride, pointer);
-}
-
-inline void QOpenGLFunctions_2_0::glValidateProgram(GLuint program)
-{
- d_2_0_Core->f.ValidateProgram(program);
-}
-
-inline void QOpenGLFunctions_2_0::glUniformMatrix4fv(GLint location, GLsizei count, GLboolean transpose, const GLfloat *value)
-{
- d_2_0_Core->f.UniformMatrix4fv(location, count, transpose, value);
-}
-
-inline void QOpenGLFunctions_2_0::glUniformMatrix3fv(GLint location, GLsizei count, GLboolean transpose, const GLfloat *value)
-{
- d_2_0_Core->f.UniformMatrix3fv(location, count, transpose, value);
-}
-
-inline void QOpenGLFunctions_2_0::glUniformMatrix2fv(GLint location, GLsizei count, GLboolean transpose, const GLfloat *value)
-{
- d_2_0_Core->f.UniformMatrix2fv(location, count, transpose, value);
-}
-
-inline void QOpenGLFunctions_2_0::glUniform4iv(GLint location, GLsizei count, const GLint *value)
-{
- d_2_0_Core->f.Uniform4iv(location, count, value);
-}
-
-inline void QOpenGLFunctions_2_0::glUniform3iv(GLint location, GLsizei count, const GLint *value)
-{
- d_2_0_Core->f.Uniform3iv(location, count, value);
-}
-
-inline void QOpenGLFunctions_2_0::glUniform2iv(GLint location, GLsizei count, const GLint *value)
-{
- d_2_0_Core->f.Uniform2iv(location, count, value);
-}
-
-inline void QOpenGLFunctions_2_0::glUniform1iv(GLint location, GLsizei count, const GLint *value)
-{
- d_2_0_Core->f.Uniform1iv(location, count, value);
-}
-
-inline void QOpenGLFunctions_2_0::glUniform4fv(GLint location, GLsizei count, const GLfloat *value)
-{
- d_2_0_Core->f.Uniform4fv(location, count, value);
-}
-
-inline void QOpenGLFunctions_2_0::glUniform3fv(GLint location, GLsizei count, const GLfloat *value)
-{
- d_2_0_Core->f.Uniform3fv(location, count, value);
-}
-
-inline void QOpenGLFunctions_2_0::glUniform2fv(GLint location, GLsizei count, const GLfloat *value)
-{
- d_2_0_Core->f.Uniform2fv(location, count, value);
-}
-
-inline void QOpenGLFunctions_2_0::glUniform1fv(GLint location, GLsizei count, const GLfloat *value)
-{
- d_2_0_Core->f.Uniform1fv(location, count, value);
-}
-
-inline void QOpenGLFunctions_2_0::glUniform4i(GLint location, GLint v0, GLint v1, GLint v2, GLint v3)
-{
- d_2_0_Core->f.Uniform4i(location, v0, v1, v2, v3);
-}
-
-inline void QOpenGLFunctions_2_0::glUniform3i(GLint location, GLint v0, GLint v1, GLint v2)
-{
- d_2_0_Core->f.Uniform3i(location, v0, v1, v2);
-}
-
-inline void QOpenGLFunctions_2_0::glUniform2i(GLint location, GLint v0, GLint v1)
-{
- d_2_0_Core->f.Uniform2i(location, v0, v1);
-}
-
-inline void QOpenGLFunctions_2_0::glUniform1i(GLint location, GLint v0)
-{
- d_2_0_Core->f.Uniform1i(location, v0);
-}
-
-inline void QOpenGLFunctions_2_0::glUniform4f(GLint location, GLfloat v0, GLfloat v1, GLfloat v2, GLfloat v3)
-{
- d_2_0_Core->f.Uniform4f(location, v0, v1, v2, v3);
-}
-
-inline void QOpenGLFunctions_2_0::glUniform3f(GLint location, GLfloat v0, GLfloat v1, GLfloat v2)
-{
- d_2_0_Core->f.Uniform3f(location, v0, v1, v2);
-}
-
-inline void QOpenGLFunctions_2_0::glUniform2f(GLint location, GLfloat v0, GLfloat v1)
-{
- d_2_0_Core->f.Uniform2f(location, v0, v1);
-}
-
-inline void QOpenGLFunctions_2_0::glUniform1f(GLint location, GLfloat v0)
-{
- d_2_0_Core->f.Uniform1f(location, v0);
-}
-
-inline void QOpenGLFunctions_2_0::glUseProgram(GLuint program)
-{
- d_2_0_Core->f.UseProgram(program);
-}
-
-inline void QOpenGLFunctions_2_0::glShaderSource(GLuint shader, GLsizei count, const GLchar* const *string, const GLint *length)
-{
- d_2_0_Core->f.ShaderSource(shader, count, string, length);
-}
-
-inline void QOpenGLFunctions_2_0::glLinkProgram(GLuint program)
-{
- d_2_0_Core->f.LinkProgram(program);
-}
-
-inline GLboolean QOpenGLFunctions_2_0::glIsShader(GLuint shader)
-{
- return d_2_0_Core->f.IsShader(shader);
-}
-
-inline GLboolean QOpenGLFunctions_2_0::glIsProgram(GLuint program)
-{
- return d_2_0_Core->f.IsProgram(program);
-}
-
-inline void QOpenGLFunctions_2_0::glGetVertexAttribPointerv(GLuint index, GLenum pname, GLvoid* *pointer)
-{
- d_2_0_Core->f.GetVertexAttribPointerv(index, pname, pointer);
-}
-
-inline void QOpenGLFunctions_2_0::glGetVertexAttribiv(GLuint index, GLenum pname, GLint *params)
-{
- d_2_0_Core->f.GetVertexAttribiv(index, pname, params);
-}
-
-inline void QOpenGLFunctions_2_0::glGetVertexAttribfv(GLuint index, GLenum pname, GLfloat *params)
-{
- d_2_0_Core->f.GetVertexAttribfv(index, pname, params);
-}
-
-inline void QOpenGLFunctions_2_0::glGetVertexAttribdv(GLuint index, GLenum pname, GLdouble *params)
-{
- d_2_0_Core->f.GetVertexAttribdv(index, pname, params);
-}
-
-inline void QOpenGLFunctions_2_0::glGetUniformiv(GLuint program, GLint location, GLint *params)
-{
- d_2_0_Core->f.GetUniformiv(program, location, params);
-}
-
-inline void QOpenGLFunctions_2_0::glGetUniformfv(GLuint program, GLint location, GLfloat *params)
-{
- d_2_0_Core->f.GetUniformfv(program, location, params);
-}
-
-inline GLint QOpenGLFunctions_2_0::glGetUniformLocation(GLuint program, const GLchar *name)
-{
- return d_2_0_Core->f.GetUniformLocation(program, name);
-}
-
-inline void QOpenGLFunctions_2_0::glGetShaderSource(GLuint shader, GLsizei bufSize, GLsizei *length, GLchar *source)
-{
- d_2_0_Core->f.GetShaderSource(shader, bufSize, length, source);
-}
-
-inline void QOpenGLFunctions_2_0::glGetShaderInfoLog(GLuint shader, GLsizei bufSize, GLsizei *length, GLchar *infoLog)
-{
- d_2_0_Core->f.GetShaderInfoLog(shader, bufSize, length, infoLog);
-}
-
-inline void QOpenGLFunctions_2_0::glGetShaderiv(GLuint shader, GLenum pname, GLint *params)
-{
- d_2_0_Core->f.GetShaderiv(shader, pname, params);
-}
-
-inline void QOpenGLFunctions_2_0::glGetProgramInfoLog(GLuint program, GLsizei bufSize, GLsizei *length, GLchar *infoLog)
-{
- d_2_0_Core->f.GetProgramInfoLog(program, bufSize, length, infoLog);
-}
-
-inline void QOpenGLFunctions_2_0::glGetProgramiv(GLuint program, GLenum pname, GLint *params)
-{
- d_2_0_Core->f.GetProgramiv(program, pname, params);
-}
-
-inline GLint QOpenGLFunctions_2_0::glGetAttribLocation(GLuint program, const GLchar *name)
-{
- return d_2_0_Core->f.GetAttribLocation(program, name);
-}
-
-inline void QOpenGLFunctions_2_0::glGetAttachedShaders(GLuint program, GLsizei maxCount, GLsizei *count, GLuint *obj)
-{
- d_2_0_Core->f.GetAttachedShaders(program, maxCount, count, obj);
-}
-
-inline void QOpenGLFunctions_2_0::glGetActiveUniform(GLuint program, GLuint index, GLsizei bufSize, GLsizei *length, GLint *size, GLenum *type, GLchar *name)
-{
- d_2_0_Core->f.GetActiveUniform(program, index, bufSize, length, size, type, name);
-}
-
-inline void QOpenGLFunctions_2_0::glGetActiveAttrib(GLuint program, GLuint index, GLsizei bufSize, GLsizei *length, GLint *size, GLenum *type, GLchar *name)
-{
- d_2_0_Core->f.GetActiveAttrib(program, index, bufSize, length, size, type, name);
-}
-
-inline void QOpenGLFunctions_2_0::glEnableVertexAttribArray(GLuint index)
-{
- d_2_0_Core->f.EnableVertexAttribArray(index);
-}
-
-inline void QOpenGLFunctions_2_0::glDisableVertexAttribArray(GLuint index)
-{
- d_2_0_Core->f.DisableVertexAttribArray(index);
-}
-
-inline void QOpenGLFunctions_2_0::glDetachShader(GLuint program, GLuint shader)
-{
- d_2_0_Core->f.DetachShader(program, shader);
-}
-
-inline void QOpenGLFunctions_2_0::glDeleteShader(GLuint shader)
-{
- d_2_0_Core->f.DeleteShader(shader);
-}
-
-inline void QOpenGLFunctions_2_0::glDeleteProgram(GLuint program)
-{
- d_2_0_Core->f.DeleteProgram(program);
-}
-
-inline GLuint QOpenGLFunctions_2_0::glCreateShader(GLenum type)
-{
- return d_2_0_Core->f.CreateShader(type);
-}
-
-inline GLuint QOpenGLFunctions_2_0::glCreateProgram()
-{
- return d_2_0_Core->f.CreateProgram();
-}
-
-inline void QOpenGLFunctions_2_0::glCompileShader(GLuint shader)
-{
- d_2_0_Core->f.CompileShader(shader);
-}
-
-inline void QOpenGLFunctions_2_0::glBindAttribLocation(GLuint program, GLuint index, const GLchar *name)
-{
- d_2_0_Core->f.BindAttribLocation(program, index, name);
-}
-
-inline void QOpenGLFunctions_2_0::glAttachShader(GLuint program, GLuint shader)
-{
- d_2_0_Core->f.AttachShader(program, shader);
-}
-
-inline void QOpenGLFunctions_2_0::glStencilMaskSeparate(GLenum face, GLuint mask)
-{
- d_2_0_Core->f.StencilMaskSeparate(face, mask);
-}
-
-inline void QOpenGLFunctions_2_0::glStencilFuncSeparate(GLenum face, GLenum func, GLint ref, GLuint mask)
-{
- d_2_0_Core->f.StencilFuncSeparate(face, func, ref, mask);
-}
-
-inline void QOpenGLFunctions_2_0::glStencilOpSeparate(GLenum face, GLenum sfail, GLenum dpfail, GLenum dppass)
-{
- d_2_0_Core->f.StencilOpSeparate(face, sfail, dpfail, dppass);
-}
-
-inline void QOpenGLFunctions_2_0::glDrawBuffers(GLsizei n, const GLenum *bufs)
-{
- d_2_0_Core->f.DrawBuffers(n, bufs);
-}
-
-inline void QOpenGLFunctions_2_0::glBlendEquationSeparate(GLenum modeRGB, GLenum modeAlpha)
-{
- d_2_0_Core->f.BlendEquationSeparate(modeRGB, modeAlpha);
-}
-
-
-// OpenGL 1.0 deprecated functions
-inline void QOpenGLFunctions_2_0::glTranslatef(GLfloat x, GLfloat y, GLfloat z)
-{
- d_1_0_Deprecated->f.Translatef(x, y, z);
-}
-
-inline void QOpenGLFunctions_2_0::glTranslated(GLdouble x, GLdouble y, GLdouble z)
-{
- d_1_0_Deprecated->f.Translated(x, y, z);
-}
-
-inline void QOpenGLFunctions_2_0::glScalef(GLfloat x, GLfloat y, GLfloat z)
-{
- d_1_0_Deprecated->f.Scalef(x, y, z);
-}
-
-inline void QOpenGLFunctions_2_0::glScaled(GLdouble x, GLdouble y, GLdouble z)
-{
- d_1_0_Deprecated->f.Scaled(x, y, z);
-}
-
-inline void QOpenGLFunctions_2_0::glRotatef(GLfloat angle, GLfloat x, GLfloat y, GLfloat z)
-{
- d_1_0_Deprecated->f.Rotatef(angle, x, y, z);
-}
-
-inline void QOpenGLFunctions_2_0::glRotated(GLdouble angle, GLdouble x, GLdouble y, GLdouble z)
-{
- d_1_0_Deprecated->f.Rotated(angle, x, y, z);
-}
-
-inline void QOpenGLFunctions_2_0::glPushMatrix()
-{
- d_1_0_Deprecated->f.PushMatrix();
-}
-
-inline void QOpenGLFunctions_2_0::glPopMatrix()
-{
- d_1_0_Deprecated->f.PopMatrix();
-}
-
-inline void QOpenGLFunctions_2_0::glOrtho(GLdouble left, GLdouble right, GLdouble bottom, GLdouble top, GLdouble zNear, GLdouble zFar)
-{
- d_1_0_Deprecated->f.Ortho(left, right, bottom, top, zNear, zFar);
-}
-
-inline void QOpenGLFunctions_2_0::glMultMatrixd(const GLdouble *m)
-{
- d_1_0_Deprecated->f.MultMatrixd(m);
-}
-
-inline void QOpenGLFunctions_2_0::glMultMatrixf(const GLfloat *m)
-{
- d_1_0_Deprecated->f.MultMatrixf(m);
-}
-
-inline void QOpenGLFunctions_2_0::glMatrixMode(GLenum mode)
-{
- d_1_0_Deprecated->f.MatrixMode(mode);
-}
-
-inline void QOpenGLFunctions_2_0::glLoadMatrixd(const GLdouble *m)
-{
- d_1_0_Deprecated->f.LoadMatrixd(m);
-}
-
-inline void QOpenGLFunctions_2_0::glLoadMatrixf(const GLfloat *m)
-{
- d_1_0_Deprecated->f.LoadMatrixf(m);
-}
-
-inline void QOpenGLFunctions_2_0::glLoadIdentity()
-{
- d_1_0_Deprecated->f.LoadIdentity();
-}
-
-inline void QOpenGLFunctions_2_0::glFrustum(GLdouble left, GLdouble right, GLdouble bottom, GLdouble top, GLdouble zNear, GLdouble zFar)
-{
- d_1_0_Deprecated->f.Frustum(left, right, bottom, top, zNear, zFar);
-}
-
-inline GLboolean QOpenGLFunctions_2_0::glIsList(GLuint list)
-{
- return d_1_0_Deprecated->f.IsList(list);
-}
-
-inline void QOpenGLFunctions_2_0::glGetTexGeniv(GLenum coord, GLenum pname, GLint *params)
-{
- d_1_0_Deprecated->f.GetTexGeniv(coord, pname, params);
-}
-
-inline void QOpenGLFunctions_2_0::glGetTexGenfv(GLenum coord, GLenum pname, GLfloat *params)
-{
- d_1_0_Deprecated->f.GetTexGenfv(coord, pname, params);
-}
-
-inline void QOpenGLFunctions_2_0::glGetTexGendv(GLenum coord, GLenum pname, GLdouble *params)
-{
- d_1_0_Deprecated->f.GetTexGendv(coord, pname, params);
-}
-
-inline void QOpenGLFunctions_2_0::glGetTexEnviv(GLenum target, GLenum pname, GLint *params)
-{
- d_1_0_Deprecated->f.GetTexEnviv(target, pname, params);
-}
-
-inline void QOpenGLFunctions_2_0::glGetTexEnvfv(GLenum target, GLenum pname, GLfloat *params)
-{
- d_1_0_Deprecated->f.GetTexEnvfv(target, pname, params);
-}
-
-inline void QOpenGLFunctions_2_0::glGetPolygonStipple(GLubyte *mask)
-{
- d_1_0_Deprecated->f.GetPolygonStipple(mask);
-}
-
-inline void QOpenGLFunctions_2_0::glGetPixelMapusv(GLenum map, GLushort *values)
-{
- d_1_0_Deprecated->f.GetPixelMapusv(map, values);
-}
-
-inline void QOpenGLFunctions_2_0::glGetPixelMapuiv(GLenum map, GLuint *values)
-{
- d_1_0_Deprecated->f.GetPixelMapuiv(map, values);
-}
-
-inline void QOpenGLFunctions_2_0::glGetPixelMapfv(GLenum map, GLfloat *values)
-{
- d_1_0_Deprecated->f.GetPixelMapfv(map, values);
-}
-
-inline void QOpenGLFunctions_2_0::glGetMaterialiv(GLenum face, GLenum pname, GLint *params)
-{
- d_1_0_Deprecated->f.GetMaterialiv(face, pname, params);
-}
-
-inline void QOpenGLFunctions_2_0::glGetMaterialfv(GLenum face, GLenum pname, GLfloat *params)
-{
- d_1_0_Deprecated->f.GetMaterialfv(face, pname, params);
-}
-
-inline void QOpenGLFunctions_2_0::glGetMapiv(GLenum target, GLenum query, GLint *v)
-{
- d_1_0_Deprecated->f.GetMapiv(target, query, v);
-}
-
-inline void QOpenGLFunctions_2_0::glGetMapfv(GLenum target, GLenum query, GLfloat *v)
-{
- d_1_0_Deprecated->f.GetMapfv(target, query, v);
-}
-
-inline void QOpenGLFunctions_2_0::glGetMapdv(GLenum target, GLenum query, GLdouble *v)
-{
- d_1_0_Deprecated->f.GetMapdv(target, query, v);
-}
-
-inline void QOpenGLFunctions_2_0::glGetLightiv(GLenum light, GLenum pname, GLint *params)
-{
- d_1_0_Deprecated->f.GetLightiv(light, pname, params);
-}
-
-inline void QOpenGLFunctions_2_0::glGetLightfv(GLenum light, GLenum pname, GLfloat *params)
-{
- d_1_0_Deprecated->f.GetLightfv(light, pname, params);
-}
-
-inline void QOpenGLFunctions_2_0::glGetClipPlane(GLenum plane, GLdouble *equation)
-{
- d_1_0_Deprecated->f.GetClipPlane(plane, equation);
-}
-
-inline void QOpenGLFunctions_2_0::glDrawPixels(GLsizei width, GLsizei height, GLenum format, GLenum type, const GLvoid *pixels)
-{
- d_1_0_Deprecated->f.DrawPixels(width, height, format, type, pixels);
-}
-
-inline void QOpenGLFunctions_2_0::glCopyPixels(GLint x, GLint y, GLsizei width, GLsizei height, GLenum type)
-{
- d_1_0_Deprecated->f.CopyPixels(x, y, width, height, type);
-}
-
-inline void QOpenGLFunctions_2_0::glPixelMapusv(GLenum map, GLint mapsize, const GLushort *values)
-{
- d_1_0_Deprecated->f.PixelMapusv(map, mapsize, values);
-}
-
-inline void QOpenGLFunctions_2_0::glPixelMapuiv(GLenum map, GLint mapsize, const GLuint *values)
-{
- d_1_0_Deprecated->f.PixelMapuiv(map, mapsize, values);
-}
-
-inline void QOpenGLFunctions_2_0::glPixelMapfv(GLenum map, GLint mapsize, const GLfloat *values)
-{
- d_1_0_Deprecated->f.PixelMapfv(map, mapsize, values);
-}
-
-inline void QOpenGLFunctions_2_0::glPixelTransferi(GLenum pname, GLint param)
-{
- d_1_0_Deprecated->f.PixelTransferi(pname, param);
-}
-
-inline void QOpenGLFunctions_2_0::glPixelTransferf(GLenum pname, GLfloat param)
-{
- d_1_0_Deprecated->f.PixelTransferf(pname, param);
-}
-
-inline void QOpenGLFunctions_2_0::glPixelZoom(GLfloat xfactor, GLfloat yfactor)
-{
- d_1_0_Deprecated->f.PixelZoom(xfactor, yfactor);
-}
-
-inline void QOpenGLFunctions_2_0::glAlphaFunc(GLenum func, GLfloat ref)
-{
- d_1_0_Deprecated->f.AlphaFunc(func, ref);
-}
-
-inline void QOpenGLFunctions_2_0::glEvalPoint2(GLint i, GLint j)
-{
- d_1_0_Deprecated->f.EvalPoint2(i, j);
-}
-
-inline void QOpenGLFunctions_2_0::glEvalMesh2(GLenum mode, GLint i1, GLint i2, GLint j1, GLint j2)
-{
- d_1_0_Deprecated->f.EvalMesh2(mode, i1, i2, j1, j2);
-}
-
-inline void QOpenGLFunctions_2_0::glEvalPoint1(GLint i)
-{
- d_1_0_Deprecated->f.EvalPoint1(i);
-}
-
-inline void QOpenGLFunctions_2_0::glEvalMesh1(GLenum mode, GLint i1, GLint i2)
-{
- d_1_0_Deprecated->f.EvalMesh1(mode, i1, i2);
-}
-
-inline void QOpenGLFunctions_2_0::glEvalCoord2fv(const GLfloat *u)
-{
- d_1_0_Deprecated->f.EvalCoord2fv(u);
-}
-
-inline void QOpenGLFunctions_2_0::glEvalCoord2f(GLfloat u, GLfloat v)
-{
- d_1_0_Deprecated->f.EvalCoord2f(u, v);
-}
-
-inline void QOpenGLFunctions_2_0::glEvalCoord2dv(const GLdouble *u)
-{
- d_1_0_Deprecated->f.EvalCoord2dv(u);
-}
-
-inline void QOpenGLFunctions_2_0::glEvalCoord2d(GLdouble u, GLdouble v)
-{
- d_1_0_Deprecated->f.EvalCoord2d(u, v);
-}
-
-inline void QOpenGLFunctions_2_0::glEvalCoord1fv(const GLfloat *u)
-{
- d_1_0_Deprecated->f.EvalCoord1fv(u);
-}
-
-inline void QOpenGLFunctions_2_0::glEvalCoord1f(GLfloat u)
-{
- d_1_0_Deprecated->f.EvalCoord1f(u);
-}
-
-inline void QOpenGLFunctions_2_0::glEvalCoord1dv(const GLdouble *u)
-{
- d_1_0_Deprecated->f.EvalCoord1dv(u);
-}
-
-inline void QOpenGLFunctions_2_0::glEvalCoord1d(GLdouble u)
-{
- d_1_0_Deprecated->f.EvalCoord1d(u);
-}
-
-inline void QOpenGLFunctions_2_0::glMapGrid2f(GLint un, GLfloat u1, GLfloat u2, GLint vn, GLfloat v1, GLfloat v2)
-{
- d_1_0_Deprecated->f.MapGrid2f(un, u1, u2, vn, v1, v2);
-}
-
-inline void QOpenGLFunctions_2_0::glMapGrid2d(GLint un, GLdouble u1, GLdouble u2, GLint vn, GLdouble v1, GLdouble v2)
-{
- d_1_0_Deprecated->f.MapGrid2d(un, u1, u2, vn, v1, v2);
-}
-
-inline void QOpenGLFunctions_2_0::glMapGrid1f(GLint un, GLfloat u1, GLfloat u2)
-{
- d_1_0_Deprecated->f.MapGrid1f(un, u1, u2);
-}
-
-inline void QOpenGLFunctions_2_0::glMapGrid1d(GLint un, GLdouble u1, GLdouble u2)
-{
- d_1_0_Deprecated->f.MapGrid1d(un, u1, u2);
-}
-
-inline void QOpenGLFunctions_2_0::glMap2f(GLenum target, GLfloat u1, GLfloat u2, GLint ustride, GLint uorder, GLfloat v1, GLfloat v2, GLint vstride, GLint vorder, const GLfloat *points)
-{
- d_1_0_Deprecated->f.Map2f(target, u1, u2, ustride, uorder, v1, v2, vstride, vorder, points);
-}
-
-inline void QOpenGLFunctions_2_0::glMap2d(GLenum target, GLdouble u1, GLdouble u2, GLint ustride, GLint uorder, GLdouble v1, GLdouble v2, GLint vstride, GLint vorder, const GLdouble *points)
-{
- d_1_0_Deprecated->f.Map2d(target, u1, u2, ustride, uorder, v1, v2, vstride, vorder, points);
-}
-
-inline void QOpenGLFunctions_2_0::glMap1f(GLenum target, GLfloat u1, GLfloat u2, GLint stride, GLint order, const GLfloat *points)
-{
- d_1_0_Deprecated->f.Map1f(target, u1, u2, stride, order, points);
-}
-
-inline void QOpenGLFunctions_2_0::glMap1d(GLenum target, GLdouble u1, GLdouble u2, GLint stride, GLint order, const GLdouble *points)
-{
- d_1_0_Deprecated->f.Map1d(target, u1, u2, stride, order, points);
-}
-
-inline void QOpenGLFunctions_2_0::glPushAttrib(GLbitfield mask)
-{
- d_1_0_Deprecated->f.PushAttrib(mask);
-}
-
-inline void QOpenGLFunctions_2_0::glPopAttrib()
-{
- d_1_0_Deprecated->f.PopAttrib();
-}
-
-inline void QOpenGLFunctions_2_0::glAccum(GLenum op, GLfloat value)
-{
- d_1_0_Deprecated->f.Accum(op, value);
-}
-
-inline void QOpenGLFunctions_2_0::glIndexMask(GLuint mask)
-{
- d_1_0_Deprecated->f.IndexMask(mask);
-}
-
-inline void QOpenGLFunctions_2_0::glClearIndex(GLfloat c)
-{
- d_1_0_Deprecated->f.ClearIndex(c);
-}
-
-inline void QOpenGLFunctions_2_0::glClearAccum(GLfloat red, GLfloat green, GLfloat blue, GLfloat alpha)
-{
- d_1_0_Deprecated->f.ClearAccum(red, green, blue, alpha);
-}
-
-inline void QOpenGLFunctions_2_0::glPushName(GLuint name)
-{
- d_1_0_Deprecated->f.PushName(name);
-}
-
-inline void QOpenGLFunctions_2_0::glPopName()
-{
- d_1_0_Deprecated->f.PopName();
-}
-
-inline void QOpenGLFunctions_2_0::glPassThrough(GLfloat token)
-{
- d_1_0_Deprecated->f.PassThrough(token);
-}
-
-inline void QOpenGLFunctions_2_0::glLoadName(GLuint name)
-{
- d_1_0_Deprecated->f.LoadName(name);
-}
-
-inline void QOpenGLFunctions_2_0::glInitNames()
-{
- d_1_0_Deprecated->f.InitNames();
-}
-
-inline GLint QOpenGLFunctions_2_0::glRenderMode(GLenum mode)
-{
- return d_1_0_Deprecated->f.RenderMode(mode);
-}
-
-inline void QOpenGLFunctions_2_0::glSelectBuffer(GLsizei size, GLuint *buffer)
-{
- d_1_0_Deprecated->f.SelectBuffer(size, buffer);
-}
-
-inline void QOpenGLFunctions_2_0::glFeedbackBuffer(GLsizei size, GLenum type, GLfloat *buffer)
-{
- d_1_0_Deprecated->f.FeedbackBuffer(size, type, buffer);
-}
-
-inline void QOpenGLFunctions_2_0::glTexGeniv(GLenum coord, GLenum pname, const GLint *params)
-{
- d_1_0_Deprecated->f.TexGeniv(coord, pname, params);
-}
-
-inline void QOpenGLFunctions_2_0::glTexGeni(GLenum coord, GLenum pname, GLint param)
-{
- d_1_0_Deprecated->f.TexGeni(coord, pname, param);
-}
-
-inline void QOpenGLFunctions_2_0::glTexGenfv(GLenum coord, GLenum pname, const GLfloat *params)
-{
- d_1_0_Deprecated->f.TexGenfv(coord, pname, params);
-}
-
-inline void QOpenGLFunctions_2_0::glTexGenf(GLenum coord, GLenum pname, GLfloat param)
-{
- d_1_0_Deprecated->f.TexGenf(coord, pname, param);
-}
-
-inline void QOpenGLFunctions_2_0::glTexGendv(GLenum coord, GLenum pname, const GLdouble *params)
-{
- d_1_0_Deprecated->f.TexGendv(coord, pname, params);
-}
-
-inline void QOpenGLFunctions_2_0::glTexGend(GLenum coord, GLenum pname, GLdouble param)
-{
- d_1_0_Deprecated->f.TexGend(coord, pname, param);
-}
-
-inline void QOpenGLFunctions_2_0::glTexEnviv(GLenum target, GLenum pname, const GLint *params)
-{
- d_1_0_Deprecated->f.TexEnviv(target, pname, params);
-}
-
-inline void QOpenGLFunctions_2_0::glTexEnvi(GLenum target, GLenum pname, GLint param)
-{
- d_1_0_Deprecated->f.TexEnvi(target, pname, param);
-}
-
-inline void QOpenGLFunctions_2_0::glTexEnvfv(GLenum target, GLenum pname, const GLfloat *params)
-{
- d_1_0_Deprecated->f.TexEnvfv(target, pname, params);
-}
-
-inline void QOpenGLFunctions_2_0::glTexEnvf(GLenum target, GLenum pname, GLfloat param)
-{
- d_1_0_Deprecated->f.TexEnvf(target, pname, param);
-}
-
-inline void QOpenGLFunctions_2_0::glShadeModel(GLenum mode)
-{
- d_1_0_Deprecated->f.ShadeModel(mode);
-}
-
-inline void QOpenGLFunctions_2_0::glPolygonStipple(const GLubyte *mask)
-{
- d_1_0_Deprecated->f.PolygonStipple(mask);
-}
-
-inline void QOpenGLFunctions_2_0::glMaterialiv(GLenum face, GLenum pname, const GLint *params)
-{
- d_1_0_Deprecated->f.Materialiv(face, pname, params);
-}
-
-inline void QOpenGLFunctions_2_0::glMateriali(GLenum face, GLenum pname, GLint param)
-{
- d_1_0_Deprecated->f.Materiali(face, pname, param);
-}
-
-inline void QOpenGLFunctions_2_0::glMaterialfv(GLenum face, GLenum pname, const GLfloat *params)
-{
- d_1_0_Deprecated->f.Materialfv(face, pname, params);
-}
-
-inline void QOpenGLFunctions_2_0::glMaterialf(GLenum face, GLenum pname, GLfloat param)
-{
- d_1_0_Deprecated->f.Materialf(face, pname, param);
-}
-
-inline void QOpenGLFunctions_2_0::glLineStipple(GLint factor, GLushort pattern)
-{
- d_1_0_Deprecated->f.LineStipple(factor, pattern);
-}
-
-inline void QOpenGLFunctions_2_0::glLightModeliv(GLenum pname, const GLint *params)
-{
- d_1_0_Deprecated->f.LightModeliv(pname, params);
-}
-
-inline void QOpenGLFunctions_2_0::glLightModeli(GLenum pname, GLint param)
-{
- d_1_0_Deprecated->f.LightModeli(pname, param);
-}
-
-inline void QOpenGLFunctions_2_0::glLightModelfv(GLenum pname, const GLfloat *params)
-{
- d_1_0_Deprecated->f.LightModelfv(pname, params);
-}
-
-inline void QOpenGLFunctions_2_0::glLightModelf(GLenum pname, GLfloat param)
-{
- d_1_0_Deprecated->f.LightModelf(pname, param);
-}
-
-inline void QOpenGLFunctions_2_0::glLightiv(GLenum light, GLenum pname, const GLint *params)
-{
- d_1_0_Deprecated->f.Lightiv(light, pname, params);
-}
-
-inline void QOpenGLFunctions_2_0::glLighti(GLenum light, GLenum pname, GLint param)
-{
- d_1_0_Deprecated->f.Lighti(light, pname, param);
-}
-
-inline void QOpenGLFunctions_2_0::glLightfv(GLenum light, GLenum pname, const GLfloat *params)
-{
- d_1_0_Deprecated->f.Lightfv(light, pname, params);
-}
-
-inline void QOpenGLFunctions_2_0::glLightf(GLenum light, GLenum pname, GLfloat param)
-{
- d_1_0_Deprecated->f.Lightf(light, pname, param);
-}
-
-inline void QOpenGLFunctions_2_0::glFogiv(GLenum pname, const GLint *params)
-{
- d_1_0_Deprecated->f.Fogiv(pname, params);
-}
-
-inline void QOpenGLFunctions_2_0::glFogi(GLenum pname, GLint param)
-{
- d_1_0_Deprecated->f.Fogi(pname, param);
-}
-
-inline void QOpenGLFunctions_2_0::glFogfv(GLenum pname, const GLfloat *params)
-{
- d_1_0_Deprecated->f.Fogfv(pname, params);
-}
-
-inline void QOpenGLFunctions_2_0::glFogf(GLenum pname, GLfloat param)
-{
- d_1_0_Deprecated->f.Fogf(pname, param);
-}
-
-inline void QOpenGLFunctions_2_0::glColorMaterial(GLenum face, GLenum mode)
-{
- d_1_0_Deprecated->f.ColorMaterial(face, mode);
-}
-
-inline void QOpenGLFunctions_2_0::glClipPlane(GLenum plane, const GLdouble *equation)
-{
- d_1_0_Deprecated->f.ClipPlane(plane, equation);
-}
-
-inline void QOpenGLFunctions_2_0::glVertex4sv(const GLshort *v)
-{
- d_1_0_Deprecated->f.Vertex4sv(v);
-}
-
-inline void QOpenGLFunctions_2_0::glVertex4s(GLshort x, GLshort y, GLshort z, GLshort w)
-{
- d_1_0_Deprecated->f.Vertex4s(x, y, z, w);
-}
-
-inline void QOpenGLFunctions_2_0::glVertex4iv(const GLint *v)
-{
- d_1_0_Deprecated->f.Vertex4iv(v);
-}
-
-inline void QOpenGLFunctions_2_0::glVertex4i(GLint x, GLint y, GLint z, GLint w)
-{
- d_1_0_Deprecated->f.Vertex4i(x, y, z, w);
-}
-
-inline void QOpenGLFunctions_2_0::glVertex4fv(const GLfloat *v)
-{
- d_1_0_Deprecated->f.Vertex4fv(v);
-}
-
-inline void QOpenGLFunctions_2_0::glVertex4f(GLfloat x, GLfloat y, GLfloat z, GLfloat w)
-{
- d_1_0_Deprecated->f.Vertex4f(x, y, z, w);
-}
-
-inline void QOpenGLFunctions_2_0::glVertex4dv(const GLdouble *v)
-{
- d_1_0_Deprecated->f.Vertex4dv(v);
-}
-
-inline void QOpenGLFunctions_2_0::glVertex4d(GLdouble x, GLdouble y, GLdouble z, GLdouble w)
-{
- d_1_0_Deprecated->f.Vertex4d(x, y, z, w);
-}
-
-inline void QOpenGLFunctions_2_0::glVertex3sv(const GLshort *v)
-{
- d_1_0_Deprecated->f.Vertex3sv(v);
-}
-
-inline void QOpenGLFunctions_2_0::glVertex3s(GLshort x, GLshort y, GLshort z)
-{
- d_1_0_Deprecated->f.Vertex3s(x, y, z);
-}
-
-inline void QOpenGLFunctions_2_0::glVertex3iv(const GLint *v)
-{
- d_1_0_Deprecated->f.Vertex3iv(v);
-}
-
-inline void QOpenGLFunctions_2_0::glVertex3i(GLint x, GLint y, GLint z)
-{
- d_1_0_Deprecated->f.Vertex3i(x, y, z);
-}
-
-inline void QOpenGLFunctions_2_0::glVertex3fv(const GLfloat *v)
-{
- d_1_0_Deprecated->f.Vertex3fv(v);
-}
-
-inline void QOpenGLFunctions_2_0::glVertex3f(GLfloat x, GLfloat y, GLfloat z)
-{
- d_1_0_Deprecated->f.Vertex3f(x, y, z);
-}
-
-inline void QOpenGLFunctions_2_0::glVertex3dv(const GLdouble *v)
-{
- d_1_0_Deprecated->f.Vertex3dv(v);
-}
-
-inline void QOpenGLFunctions_2_0::glVertex3d(GLdouble x, GLdouble y, GLdouble z)
-{
- d_1_0_Deprecated->f.Vertex3d(x, y, z);
-}
-
-inline void QOpenGLFunctions_2_0::glVertex2sv(const GLshort *v)
-{
- d_1_0_Deprecated->f.Vertex2sv(v);
-}
-
-inline void QOpenGLFunctions_2_0::glVertex2s(GLshort x, GLshort y)
-{
- d_1_0_Deprecated->f.Vertex2s(x, y);
-}
-
-inline void QOpenGLFunctions_2_0::glVertex2iv(const GLint *v)
-{
- d_1_0_Deprecated->f.Vertex2iv(v);
-}
-
-inline void QOpenGLFunctions_2_0::glVertex2i(GLint x, GLint y)
-{
- d_1_0_Deprecated->f.Vertex2i(x, y);
-}
-
-inline void QOpenGLFunctions_2_0::glVertex2fv(const GLfloat *v)
-{
- d_1_0_Deprecated->f.Vertex2fv(v);
-}
-
-inline void QOpenGLFunctions_2_0::glVertex2f(GLfloat x, GLfloat y)
-{
- d_1_0_Deprecated->f.Vertex2f(x, y);
-}
-
-inline void QOpenGLFunctions_2_0::glVertex2dv(const GLdouble *v)
-{
- d_1_0_Deprecated->f.Vertex2dv(v);
-}
-
-inline void QOpenGLFunctions_2_0::glVertex2d(GLdouble x, GLdouble y)
-{
- d_1_0_Deprecated->f.Vertex2d(x, y);
-}
-
-inline void QOpenGLFunctions_2_0::glTexCoord4sv(const GLshort *v)
-{
- d_1_0_Deprecated->f.TexCoord4sv(v);
-}
-
-inline void QOpenGLFunctions_2_0::glTexCoord4s(GLshort s, GLshort t, GLshort r, GLshort q)
-{
- d_1_0_Deprecated->f.TexCoord4s(s, t, r, q);
-}
-
-inline void QOpenGLFunctions_2_0::glTexCoord4iv(const GLint *v)
-{
- d_1_0_Deprecated->f.TexCoord4iv(v);
-}
-
-inline void QOpenGLFunctions_2_0::glTexCoord4i(GLint s, GLint t, GLint r, GLint q)
-{
- d_1_0_Deprecated->f.TexCoord4i(s, t, r, q);
-}
-
-inline void QOpenGLFunctions_2_0::glTexCoord4fv(const GLfloat *v)
-{
- d_1_0_Deprecated->f.TexCoord4fv(v);
-}
-
-inline void QOpenGLFunctions_2_0::glTexCoord4f(GLfloat s, GLfloat t, GLfloat r, GLfloat q)
-{
- d_1_0_Deprecated->f.TexCoord4f(s, t, r, q);
-}
-
-inline void QOpenGLFunctions_2_0::glTexCoord4dv(const GLdouble *v)
-{
- d_1_0_Deprecated->f.TexCoord4dv(v);
-}
-
-inline void QOpenGLFunctions_2_0::glTexCoord4d(GLdouble s, GLdouble t, GLdouble r, GLdouble q)
-{
- d_1_0_Deprecated->f.TexCoord4d(s, t, r, q);
-}
-
-inline void QOpenGLFunctions_2_0::glTexCoord3sv(const GLshort *v)
-{
- d_1_0_Deprecated->f.TexCoord3sv(v);
-}
-
-inline void QOpenGLFunctions_2_0::glTexCoord3s(GLshort s, GLshort t, GLshort r)
-{
- d_1_0_Deprecated->f.TexCoord3s(s, t, r);
-}
-
-inline void QOpenGLFunctions_2_0::glTexCoord3iv(const GLint *v)
-{
- d_1_0_Deprecated->f.TexCoord3iv(v);
-}
-
-inline void QOpenGLFunctions_2_0::glTexCoord3i(GLint s, GLint t, GLint r)
-{
- d_1_0_Deprecated->f.TexCoord3i(s, t, r);
-}
-
-inline void QOpenGLFunctions_2_0::glTexCoord3fv(const GLfloat *v)
-{
- d_1_0_Deprecated->f.TexCoord3fv(v);
-}
-
-inline void QOpenGLFunctions_2_0::glTexCoord3f(GLfloat s, GLfloat t, GLfloat r)
-{
- d_1_0_Deprecated->f.TexCoord3f(s, t, r);
-}
-
-inline void QOpenGLFunctions_2_0::glTexCoord3dv(const GLdouble *v)
-{
- d_1_0_Deprecated->f.TexCoord3dv(v);
-}
-
-inline void QOpenGLFunctions_2_0::glTexCoord3d(GLdouble s, GLdouble t, GLdouble r)
-{
- d_1_0_Deprecated->f.TexCoord3d(s, t, r);
-}
-
-inline void QOpenGLFunctions_2_0::glTexCoord2sv(const GLshort *v)
-{
- d_1_0_Deprecated->f.TexCoord2sv(v);
-}
-
-inline void QOpenGLFunctions_2_0::glTexCoord2s(GLshort s, GLshort t)
-{
- d_1_0_Deprecated->f.TexCoord2s(s, t);
-}
-
-inline void QOpenGLFunctions_2_0::glTexCoord2iv(const GLint *v)
-{
- d_1_0_Deprecated->f.TexCoord2iv(v);
-}
-
-inline void QOpenGLFunctions_2_0::glTexCoord2i(GLint s, GLint t)
-{
- d_1_0_Deprecated->f.TexCoord2i(s, t);
-}
-
-inline void QOpenGLFunctions_2_0::glTexCoord2fv(const GLfloat *v)
-{
- d_1_0_Deprecated->f.TexCoord2fv(v);
-}
-
-inline void QOpenGLFunctions_2_0::glTexCoord2f(GLfloat s, GLfloat t)
-{
- d_1_0_Deprecated->f.TexCoord2f(s, t);
-}
-
-inline void QOpenGLFunctions_2_0::glTexCoord2dv(const GLdouble *v)
-{
- d_1_0_Deprecated->f.TexCoord2dv(v);
-}
-
-inline void QOpenGLFunctions_2_0::glTexCoord2d(GLdouble s, GLdouble t)
-{
- d_1_0_Deprecated->f.TexCoord2d(s, t);
-}
-
-inline void QOpenGLFunctions_2_0::glTexCoord1sv(const GLshort *v)
-{
- d_1_0_Deprecated->f.TexCoord1sv(v);
-}
-
-inline void QOpenGLFunctions_2_0::glTexCoord1s(GLshort s)
-{
- d_1_0_Deprecated->f.TexCoord1s(s);
-}
-
-inline void QOpenGLFunctions_2_0::glTexCoord1iv(const GLint *v)
-{
- d_1_0_Deprecated->f.TexCoord1iv(v);
-}
-
-inline void QOpenGLFunctions_2_0::glTexCoord1i(GLint s)
-{
- d_1_0_Deprecated->f.TexCoord1i(s);
-}
-
-inline void QOpenGLFunctions_2_0::glTexCoord1fv(const GLfloat *v)
-{
- d_1_0_Deprecated->f.TexCoord1fv(v);
-}
-
-inline void QOpenGLFunctions_2_0::glTexCoord1f(GLfloat s)
-{
- d_1_0_Deprecated->f.TexCoord1f(s);
-}
-
-inline void QOpenGLFunctions_2_0::glTexCoord1dv(const GLdouble *v)
-{
- d_1_0_Deprecated->f.TexCoord1dv(v);
-}
-
-inline void QOpenGLFunctions_2_0::glTexCoord1d(GLdouble s)
-{
- d_1_0_Deprecated->f.TexCoord1d(s);
-}
-
-inline void QOpenGLFunctions_2_0::glRectsv(const GLshort *v1, const GLshort *v2)
-{
- d_1_0_Deprecated->f.Rectsv(v1, v2);
-}
-
-inline void QOpenGLFunctions_2_0::glRects(GLshort x1, GLshort y1, GLshort x2, GLshort y2)
-{
- d_1_0_Deprecated->f.Rects(x1, y1, x2, y2);
-}
-
-inline void QOpenGLFunctions_2_0::glRectiv(const GLint *v1, const GLint *v2)
-{
- d_1_0_Deprecated->f.Rectiv(v1, v2);
-}
-
-inline void QOpenGLFunctions_2_0::glRecti(GLint x1, GLint y1, GLint x2, GLint y2)
-{
- d_1_0_Deprecated->f.Recti(x1, y1, x2, y2);
-}
-
-inline void QOpenGLFunctions_2_0::glRectfv(const GLfloat *v1, const GLfloat *v2)
-{
- d_1_0_Deprecated->f.Rectfv(v1, v2);
-}
-
-inline void QOpenGLFunctions_2_0::glRectf(GLfloat x1, GLfloat y1, GLfloat x2, GLfloat y2)
-{
- d_1_0_Deprecated->f.Rectf(x1, y1, x2, y2);
-}
-
-inline void QOpenGLFunctions_2_0::glRectdv(const GLdouble *v1, const GLdouble *v2)
-{
- d_1_0_Deprecated->f.Rectdv(v1, v2);
-}
-
-inline void QOpenGLFunctions_2_0::glRectd(GLdouble x1, GLdouble y1, GLdouble x2, GLdouble y2)
-{
- d_1_0_Deprecated->f.Rectd(x1, y1, x2, y2);
-}
-
-inline void QOpenGLFunctions_2_0::glRasterPos4sv(const GLshort *v)
-{
- d_1_0_Deprecated->f.RasterPos4sv(v);
-}
-
-inline void QOpenGLFunctions_2_0::glRasterPos4s(GLshort x, GLshort y, GLshort z, GLshort w)
-{
- d_1_0_Deprecated->f.RasterPos4s(x, y, z, w);
-}
-
-inline void QOpenGLFunctions_2_0::glRasterPos4iv(const GLint *v)
-{
- d_1_0_Deprecated->f.RasterPos4iv(v);
-}
-
-inline void QOpenGLFunctions_2_0::glRasterPos4i(GLint x, GLint y, GLint z, GLint w)
-{
- d_1_0_Deprecated->f.RasterPos4i(x, y, z, w);
-}
-
-inline void QOpenGLFunctions_2_0::glRasterPos4fv(const GLfloat *v)
-{
- d_1_0_Deprecated->f.RasterPos4fv(v);
-}
-
-inline void QOpenGLFunctions_2_0::glRasterPos4f(GLfloat x, GLfloat y, GLfloat z, GLfloat w)
-{
- d_1_0_Deprecated->f.RasterPos4f(x, y, z, w);
-}
-
-inline void QOpenGLFunctions_2_0::glRasterPos4dv(const GLdouble *v)
-{
- d_1_0_Deprecated->f.RasterPos4dv(v);
-}
-
-inline void QOpenGLFunctions_2_0::glRasterPos4d(GLdouble x, GLdouble y, GLdouble z, GLdouble w)
-{
- d_1_0_Deprecated->f.RasterPos4d(x, y, z, w);
-}
-
-inline void QOpenGLFunctions_2_0::glRasterPos3sv(const GLshort *v)
-{
- d_1_0_Deprecated->f.RasterPos3sv(v);
-}
-
-inline void QOpenGLFunctions_2_0::glRasterPos3s(GLshort x, GLshort y, GLshort z)
-{
- d_1_0_Deprecated->f.RasterPos3s(x, y, z);
-}
-
-inline void QOpenGLFunctions_2_0::glRasterPos3iv(const GLint *v)
-{
- d_1_0_Deprecated->f.RasterPos3iv(v);
-}
-
-inline void QOpenGLFunctions_2_0::glRasterPos3i(GLint x, GLint y, GLint z)
-{
- d_1_0_Deprecated->f.RasterPos3i(x, y, z);
-}
-
-inline void QOpenGLFunctions_2_0::glRasterPos3fv(const GLfloat *v)
-{
- d_1_0_Deprecated->f.RasterPos3fv(v);
-}
-
-inline void QOpenGLFunctions_2_0::glRasterPos3f(GLfloat x, GLfloat y, GLfloat z)
-{
- d_1_0_Deprecated->f.RasterPos3f(x, y, z);
-}
-
-inline void QOpenGLFunctions_2_0::glRasterPos3dv(const GLdouble *v)
-{
- d_1_0_Deprecated->f.RasterPos3dv(v);
-}
-
-inline void QOpenGLFunctions_2_0::glRasterPos3d(GLdouble x, GLdouble y, GLdouble z)
-{
- d_1_0_Deprecated->f.RasterPos3d(x, y, z);
-}
-
-inline void QOpenGLFunctions_2_0::glRasterPos2sv(const GLshort *v)
-{
- d_1_0_Deprecated->f.RasterPos2sv(v);
-}
-
-inline void QOpenGLFunctions_2_0::glRasterPos2s(GLshort x, GLshort y)
-{
- d_1_0_Deprecated->f.RasterPos2s(x, y);
-}
-
-inline void QOpenGLFunctions_2_0::glRasterPos2iv(const GLint *v)
-{
- d_1_0_Deprecated->f.RasterPos2iv(v);
-}
-
-inline void QOpenGLFunctions_2_0::glRasterPos2i(GLint x, GLint y)
-{
- d_1_0_Deprecated->f.RasterPos2i(x, y);
-}
-
-inline void QOpenGLFunctions_2_0::glRasterPos2fv(const GLfloat *v)
-{
- d_1_0_Deprecated->f.RasterPos2fv(v);
-}
-
-inline void QOpenGLFunctions_2_0::glRasterPos2f(GLfloat x, GLfloat y)
-{
- d_1_0_Deprecated->f.RasterPos2f(x, y);
-}
-
-inline void QOpenGLFunctions_2_0::glRasterPos2dv(const GLdouble *v)
-{
- d_1_0_Deprecated->f.RasterPos2dv(v);
-}
-
-inline void QOpenGLFunctions_2_0::glRasterPos2d(GLdouble x, GLdouble y)
-{
- d_1_0_Deprecated->f.RasterPos2d(x, y);
-}
-
-inline void QOpenGLFunctions_2_0::glNormal3sv(const GLshort *v)
-{
- d_1_0_Deprecated->f.Normal3sv(v);
-}
-
-inline void QOpenGLFunctions_2_0::glNormal3s(GLshort nx, GLshort ny, GLshort nz)
-{
- d_1_0_Deprecated->f.Normal3s(nx, ny, nz);
-}
-
-inline void QOpenGLFunctions_2_0::glNormal3iv(const GLint *v)
-{
- d_1_0_Deprecated->f.Normal3iv(v);
-}
-
-inline void QOpenGLFunctions_2_0::glNormal3i(GLint nx, GLint ny, GLint nz)
-{
- d_1_0_Deprecated->f.Normal3i(nx, ny, nz);
-}
-
-inline void QOpenGLFunctions_2_0::glNormal3fv(const GLfloat *v)
-{
- d_1_0_Deprecated->f.Normal3fv(v);
-}
-
-inline void QOpenGLFunctions_2_0::glNormal3f(GLfloat nx, GLfloat ny, GLfloat nz)
-{
- d_1_0_Deprecated->f.Normal3f(nx, ny, nz);
-}
-
-inline void QOpenGLFunctions_2_0::glNormal3dv(const GLdouble *v)
-{
- d_1_0_Deprecated->f.Normal3dv(v);
-}
-
-inline void QOpenGLFunctions_2_0::glNormal3d(GLdouble nx, GLdouble ny, GLdouble nz)
-{
- d_1_0_Deprecated->f.Normal3d(nx, ny, nz);
-}
-
-inline void QOpenGLFunctions_2_0::glNormal3bv(const GLbyte *v)
-{
- d_1_0_Deprecated->f.Normal3bv(v);
-}
-
-inline void QOpenGLFunctions_2_0::glNormal3b(GLbyte nx, GLbyte ny, GLbyte nz)
-{
- d_1_0_Deprecated->f.Normal3b(nx, ny, nz);
-}
-
-inline void QOpenGLFunctions_2_0::glIndexsv(const GLshort *c)
-{
- d_1_0_Deprecated->f.Indexsv(c);
-}
-
-inline void QOpenGLFunctions_2_0::glIndexs(GLshort c)
-{
- d_1_0_Deprecated->f.Indexs(c);
-}
-
-inline void QOpenGLFunctions_2_0::glIndexiv(const GLint *c)
-{
- d_1_0_Deprecated->f.Indexiv(c);
-}
-
-inline void QOpenGLFunctions_2_0::glIndexi(GLint c)
-{
- d_1_0_Deprecated->f.Indexi(c);
-}
-
-inline void QOpenGLFunctions_2_0::glIndexfv(const GLfloat *c)
-{
- d_1_0_Deprecated->f.Indexfv(c);
-}
-
-inline void QOpenGLFunctions_2_0::glIndexf(GLfloat c)
-{
- d_1_0_Deprecated->f.Indexf(c);
-}
-
-inline void QOpenGLFunctions_2_0::glIndexdv(const GLdouble *c)
-{
- d_1_0_Deprecated->f.Indexdv(c);
-}
-
-inline void QOpenGLFunctions_2_0::glIndexd(GLdouble c)
-{
- d_1_0_Deprecated->f.Indexd(c);
-}
-
-inline void QOpenGLFunctions_2_0::glEnd()
-{
- d_1_0_Deprecated->f.End();
-}
-
-inline void QOpenGLFunctions_2_0::glEdgeFlagv(const GLboolean *flag)
-{
- d_1_0_Deprecated->f.EdgeFlagv(flag);
-}
-
-inline void QOpenGLFunctions_2_0::glEdgeFlag(GLboolean flag)
-{
- d_1_0_Deprecated->f.EdgeFlag(flag);
-}
-
-inline void QOpenGLFunctions_2_0::glColor4usv(const GLushort *v)
-{
- d_1_0_Deprecated->f.Color4usv(v);
-}
-
-inline void QOpenGLFunctions_2_0::glColor4us(GLushort red, GLushort green, GLushort blue, GLushort alpha)
-{
- d_1_0_Deprecated->f.Color4us(red, green, blue, alpha);
-}
-
-inline void QOpenGLFunctions_2_0::glColor4uiv(const GLuint *v)
-{
- d_1_0_Deprecated->f.Color4uiv(v);
-}
-
-inline void QOpenGLFunctions_2_0::glColor4ui(GLuint red, GLuint green, GLuint blue, GLuint alpha)
-{
- d_1_0_Deprecated->f.Color4ui(red, green, blue, alpha);
-}
-
-inline void QOpenGLFunctions_2_0::glColor4ubv(const GLubyte *v)
-{
- d_1_0_Deprecated->f.Color4ubv(v);
-}
-
-inline void QOpenGLFunctions_2_0::glColor4ub(GLubyte red, GLubyte green, GLubyte blue, GLubyte alpha)
-{
- d_1_0_Deprecated->f.Color4ub(red, green, blue, alpha);
-}
-
-inline void QOpenGLFunctions_2_0::glColor4sv(const GLshort *v)
-{
- d_1_0_Deprecated->f.Color4sv(v);
-}
-
-inline void QOpenGLFunctions_2_0::glColor4s(GLshort red, GLshort green, GLshort blue, GLshort alpha)
-{
- d_1_0_Deprecated->f.Color4s(red, green, blue, alpha);
-}
-
-inline void QOpenGLFunctions_2_0::glColor4iv(const GLint *v)
-{
- d_1_0_Deprecated->f.Color4iv(v);
-}
-
-inline void QOpenGLFunctions_2_0::glColor4i(GLint red, GLint green, GLint blue, GLint alpha)
-{
- d_1_0_Deprecated->f.Color4i(red, green, blue, alpha);
-}
-
-inline void QOpenGLFunctions_2_0::glColor4fv(const GLfloat *v)
-{
- d_1_0_Deprecated->f.Color4fv(v);
-}
-
-inline void QOpenGLFunctions_2_0::glColor4f(GLfloat red, GLfloat green, GLfloat blue, GLfloat alpha)
-{
- d_1_0_Deprecated->f.Color4f(red, green, blue, alpha);
-}
-
-inline void QOpenGLFunctions_2_0::glColor4dv(const GLdouble *v)
-{
- d_1_0_Deprecated->f.Color4dv(v);
-}
-
-inline void QOpenGLFunctions_2_0::glColor4d(GLdouble red, GLdouble green, GLdouble blue, GLdouble alpha)
-{
- d_1_0_Deprecated->f.Color4d(red, green, blue, alpha);
-}
-
-inline void QOpenGLFunctions_2_0::glColor4bv(const GLbyte *v)
-{
- d_1_0_Deprecated->f.Color4bv(v);
-}
-
-inline void QOpenGLFunctions_2_0::glColor4b(GLbyte red, GLbyte green, GLbyte blue, GLbyte alpha)
-{
- d_1_0_Deprecated->f.Color4b(red, green, blue, alpha);
-}
-
-inline void QOpenGLFunctions_2_0::glColor3usv(const GLushort *v)
-{
- d_1_0_Deprecated->f.Color3usv(v);
-}
-
-inline void QOpenGLFunctions_2_0::glColor3us(GLushort red, GLushort green, GLushort blue)
-{
- d_1_0_Deprecated->f.Color3us(red, green, blue);
-}
-
-inline void QOpenGLFunctions_2_0::glColor3uiv(const GLuint *v)
-{
- d_1_0_Deprecated->f.Color3uiv(v);
-}
-
-inline void QOpenGLFunctions_2_0::glColor3ui(GLuint red, GLuint green, GLuint blue)
-{
- d_1_0_Deprecated->f.Color3ui(red, green, blue);
-}
-
-inline void QOpenGLFunctions_2_0::glColor3ubv(const GLubyte *v)
-{
- d_1_0_Deprecated->f.Color3ubv(v);
-}
-
-inline void QOpenGLFunctions_2_0::glColor3ub(GLubyte red, GLubyte green, GLubyte blue)
-{
- d_1_0_Deprecated->f.Color3ub(red, green, blue);
-}
-
-inline void QOpenGLFunctions_2_0::glColor3sv(const GLshort *v)
-{
- d_1_0_Deprecated->f.Color3sv(v);
-}
-
-inline void QOpenGLFunctions_2_0::glColor3s(GLshort red, GLshort green, GLshort blue)
-{
- d_1_0_Deprecated->f.Color3s(red, green, blue);
-}
-
-inline void QOpenGLFunctions_2_0::glColor3iv(const GLint *v)
-{
- d_1_0_Deprecated->f.Color3iv(v);
-}
-
-inline void QOpenGLFunctions_2_0::glColor3i(GLint red, GLint green, GLint blue)
-{
- d_1_0_Deprecated->f.Color3i(red, green, blue);
-}
-
-inline void QOpenGLFunctions_2_0::glColor3fv(const GLfloat *v)
-{
- d_1_0_Deprecated->f.Color3fv(v);
-}
-
-inline void QOpenGLFunctions_2_0::glColor3f(GLfloat red, GLfloat green, GLfloat blue)
-{
- d_1_0_Deprecated->f.Color3f(red, green, blue);
-}
-
-inline void QOpenGLFunctions_2_0::glColor3dv(const GLdouble *v)
-{
- d_1_0_Deprecated->f.Color3dv(v);
-}
-
-inline void QOpenGLFunctions_2_0::glColor3d(GLdouble red, GLdouble green, GLdouble blue)
-{
- d_1_0_Deprecated->f.Color3d(red, green, blue);
-}
-
-inline void QOpenGLFunctions_2_0::glColor3bv(const GLbyte *v)
-{
- d_1_0_Deprecated->f.Color3bv(v);
-}
-
-inline void QOpenGLFunctions_2_0::glColor3b(GLbyte red, GLbyte green, GLbyte blue)
-{
- d_1_0_Deprecated->f.Color3b(red, green, blue);
-}
-
-inline void QOpenGLFunctions_2_0::glBitmap(GLsizei width, GLsizei height, GLfloat xorig, GLfloat yorig, GLfloat xmove, GLfloat ymove, const GLubyte *bitmap)
-{
- d_1_0_Deprecated->f.Bitmap(width, height, xorig, yorig, xmove, ymove, bitmap);
-}
-
-inline void QOpenGLFunctions_2_0::glBegin(GLenum mode)
-{
- d_1_0_Deprecated->f.Begin(mode);
-}
-
-inline void QOpenGLFunctions_2_0::glListBase(GLuint base)
-{
- d_1_0_Deprecated->f.ListBase(base);
-}
-
-inline GLuint QOpenGLFunctions_2_0::glGenLists(GLsizei range)
-{
- return d_1_0_Deprecated->f.GenLists(range);
-}
-
-inline void QOpenGLFunctions_2_0::glDeleteLists(GLuint list, GLsizei range)
-{
- d_1_0_Deprecated->f.DeleteLists(list, range);
-}
-
-inline void QOpenGLFunctions_2_0::glCallLists(GLsizei n, GLenum type, const GLvoid *lists)
-{
- d_1_0_Deprecated->f.CallLists(n, type, lists);
-}
-
-inline void QOpenGLFunctions_2_0::glCallList(GLuint list)
-{
- d_1_0_Deprecated->f.CallList(list);
-}
-
-inline void QOpenGLFunctions_2_0::glEndList()
-{
- d_1_0_Deprecated->f.EndList();
-}
-
-inline void QOpenGLFunctions_2_0::glNewList(GLuint list, GLenum mode)
-{
- d_1_0_Deprecated->f.NewList(list, mode);
-}
-
-
-// OpenGL 1.1 deprecated functions
-inline void QOpenGLFunctions_2_0::glPushClientAttrib(GLbitfield mask)
-{
- d_1_1_Deprecated->f.PushClientAttrib(mask);
-}
-
-inline void QOpenGLFunctions_2_0::glPopClientAttrib()
-{
- d_1_1_Deprecated->f.PopClientAttrib();
-}
-
-inline void QOpenGLFunctions_2_0::glPrioritizeTextures(GLsizei n, const GLuint *textures, const GLfloat *priorities)
-{
- d_1_1_Deprecated->f.PrioritizeTextures(n, textures, priorities);
-}
-
-inline GLboolean QOpenGLFunctions_2_0::glAreTexturesResident(GLsizei n, const GLuint *textures, GLboolean *residences)
-{
- return d_1_1_Deprecated->f.AreTexturesResident(n, textures, residences);
-}
-
-inline void QOpenGLFunctions_2_0::glVertexPointer(GLint size, GLenum type, GLsizei stride, const GLvoid *pointer)
-{
- d_1_1_Deprecated->f.VertexPointer(size, type, stride, pointer);
-}
-
-inline void QOpenGLFunctions_2_0::glTexCoordPointer(GLint size, GLenum type, GLsizei stride, const GLvoid *pointer)
-{
- d_1_1_Deprecated->f.TexCoordPointer(size, type, stride, pointer);
-}
-
-inline void QOpenGLFunctions_2_0::glNormalPointer(GLenum type, GLsizei stride, const GLvoid *pointer)
-{
- d_1_1_Deprecated->f.NormalPointer(type, stride, pointer);
-}
-
-inline void QOpenGLFunctions_2_0::glInterleavedArrays(GLenum format, GLsizei stride, const GLvoid *pointer)
-{
- d_1_1_Deprecated->f.InterleavedArrays(format, stride, pointer);
-}
-
-inline void QOpenGLFunctions_2_0::glIndexPointer(GLenum type, GLsizei stride, const GLvoid *pointer)
-{
- d_1_1_Deprecated->f.IndexPointer(type, stride, pointer);
-}
-
-inline void QOpenGLFunctions_2_0::glEnableClientState(GLenum array)
-{
- d_1_1_Deprecated->f.EnableClientState(array);
-}
-
-inline void QOpenGLFunctions_2_0::glEdgeFlagPointer(GLsizei stride, const GLvoid *pointer)
-{
- d_1_1_Deprecated->f.EdgeFlagPointer(stride, pointer);
-}
-
-inline void QOpenGLFunctions_2_0::glDisableClientState(GLenum array)
-{
- d_1_1_Deprecated->f.DisableClientState(array);
-}
-
-inline void QOpenGLFunctions_2_0::glColorPointer(GLint size, GLenum type, GLsizei stride, const GLvoid *pointer)
-{
- d_1_1_Deprecated->f.ColorPointer(size, type, stride, pointer);
-}
-
-inline void QOpenGLFunctions_2_0::glArrayElement(GLint i)
-{
- d_1_1_Deprecated->f.ArrayElement(i);
-}
-
-
-// OpenGL 1.2 deprecated functions
-inline void QOpenGLFunctions_2_0::glResetMinmax(GLenum target)
-{
- d_1_2_Deprecated->f.ResetMinmax(target);
-}
-
-inline void QOpenGLFunctions_2_0::glResetHistogram(GLenum target)
-{
- d_1_2_Deprecated->f.ResetHistogram(target);
-}
-
-inline void QOpenGLFunctions_2_0::glMinmax(GLenum target, GLenum internalformat, GLboolean sink)
-{
- d_1_2_Deprecated->f.Minmax(target, internalformat, sink);
-}
-
-inline void QOpenGLFunctions_2_0::glHistogram(GLenum target, GLsizei width, GLenum internalformat, GLboolean sink)
-{
- d_1_2_Deprecated->f.Histogram(target, width, internalformat, sink);
-}
-
-inline void QOpenGLFunctions_2_0::glGetMinmaxParameteriv(GLenum target, GLenum pname, GLint *params)
-{
- d_1_2_Deprecated->f.GetMinmaxParameteriv(target, pname, params);
-}
-
-inline void QOpenGLFunctions_2_0::glGetMinmaxParameterfv(GLenum target, GLenum pname, GLfloat *params)
-{
- d_1_2_Deprecated->f.GetMinmaxParameterfv(target, pname, params);
-}
-
-inline void QOpenGLFunctions_2_0::glGetMinmax(GLenum target, GLboolean reset, GLenum format, GLenum type, GLvoid *values)
-{
- d_1_2_Deprecated->f.GetMinmax(target, reset, format, type, values);
-}
-
-inline void QOpenGLFunctions_2_0::glGetHistogramParameteriv(GLenum target, GLenum pname, GLint *params)
-{
- d_1_2_Deprecated->f.GetHistogramParameteriv(target, pname, params);
-}
-
-inline void QOpenGLFunctions_2_0::glGetHistogramParameterfv(GLenum target, GLenum pname, GLfloat *params)
-{
- d_1_2_Deprecated->f.GetHistogramParameterfv(target, pname, params);
-}
-
-inline void QOpenGLFunctions_2_0::glGetHistogram(GLenum target, GLboolean reset, GLenum format, GLenum type, GLvoid *values)
-{
- d_1_2_Deprecated->f.GetHistogram(target, reset, format, type, values);
-}
-
-inline void QOpenGLFunctions_2_0::glSeparableFilter2D(GLenum target, GLenum internalformat, GLsizei width, GLsizei height, GLenum format, GLenum type, const GLvoid *row, const GLvoid *column)
-{
- d_1_2_Deprecated->f.SeparableFilter2D(target, internalformat, width, height, format, type, row, column);
-}
-
-inline void QOpenGLFunctions_2_0::glGetSeparableFilter(GLenum target, GLenum format, GLenum type, GLvoid *row, GLvoid *column, GLvoid *span)
-{
- d_1_2_Deprecated->f.GetSeparableFilter(target, format, type, row, column, span);
-}
-
-inline void QOpenGLFunctions_2_0::glGetConvolutionParameteriv(GLenum target, GLenum pname, GLint *params)
-{
- d_1_2_Deprecated->f.GetConvolutionParameteriv(target, pname, params);
-}
-
-inline void QOpenGLFunctions_2_0::glGetConvolutionParameterfv(GLenum target, GLenum pname, GLfloat *params)
-{
- d_1_2_Deprecated->f.GetConvolutionParameterfv(target, pname, params);
-}
-
-inline void QOpenGLFunctions_2_0::glGetConvolutionFilter(GLenum target, GLenum format, GLenum type, GLvoid *image)
-{
- d_1_2_Deprecated->f.GetConvolutionFilter(target, format, type, image);
-}
-
-inline void QOpenGLFunctions_2_0::glCopyConvolutionFilter2D(GLenum target, GLenum internalformat, GLint x, GLint y, GLsizei width, GLsizei height)
-{
- d_1_2_Deprecated->f.CopyConvolutionFilter2D(target, internalformat, x, y, width, height);
-}
-
-inline void QOpenGLFunctions_2_0::glCopyConvolutionFilter1D(GLenum target, GLenum internalformat, GLint x, GLint y, GLsizei width)
-{
- d_1_2_Deprecated->f.CopyConvolutionFilter1D(target, internalformat, x, y, width);
-}
-
-inline void QOpenGLFunctions_2_0::glConvolutionParameteriv(GLenum target, GLenum pname, const GLint *params)
-{
- d_1_2_Deprecated->f.ConvolutionParameteriv(target, pname, params);
-}
-
-inline void QOpenGLFunctions_2_0::glConvolutionParameteri(GLenum target, GLenum pname, GLint params)
-{
- d_1_2_Deprecated->f.ConvolutionParameteri(target, pname, params);
-}
-
-inline void QOpenGLFunctions_2_0::glConvolutionParameterfv(GLenum target, GLenum pname, const GLfloat *params)
-{
- d_1_2_Deprecated->f.ConvolutionParameterfv(target, pname, params);
-}
-
-inline void QOpenGLFunctions_2_0::glConvolutionParameterf(GLenum target, GLenum pname, GLfloat params)
-{
- d_1_2_Deprecated->f.ConvolutionParameterf(target, pname, params);
-}
-
-inline void QOpenGLFunctions_2_0::glConvolutionFilter2D(GLenum target, GLenum internalformat, GLsizei width, GLsizei height, GLenum format, GLenum type, const GLvoid *image)
-{
- d_1_2_Deprecated->f.ConvolutionFilter2D(target, internalformat, width, height, format, type, image);
-}
-
-inline void QOpenGLFunctions_2_0::glConvolutionFilter1D(GLenum target, GLenum internalformat, GLsizei width, GLenum format, GLenum type, const GLvoid *image)
-{
- d_1_2_Deprecated->f.ConvolutionFilter1D(target, internalformat, width, format, type, image);
-}
-
-inline void QOpenGLFunctions_2_0::glCopyColorSubTable(GLenum target, GLsizei start, GLint x, GLint y, GLsizei width)
-{
- d_1_2_Deprecated->f.CopyColorSubTable(target, start, x, y, width);
-}
-
-inline void QOpenGLFunctions_2_0::glColorSubTable(GLenum target, GLsizei start, GLsizei count, GLenum format, GLenum type, const GLvoid *data)
-{
- d_1_2_Deprecated->f.ColorSubTable(target, start, count, format, type, data);
-}
-
-inline void QOpenGLFunctions_2_0::glGetColorTableParameteriv(GLenum target, GLenum pname, GLint *params)
-{
- d_1_2_Deprecated->f.GetColorTableParameteriv(target, pname, params);
-}
-
-inline void QOpenGLFunctions_2_0::glGetColorTableParameterfv(GLenum target, GLenum pname, GLfloat *params)
-{
- d_1_2_Deprecated->f.GetColorTableParameterfv(target, pname, params);
-}
-
-inline void QOpenGLFunctions_2_0::glGetColorTable(GLenum target, GLenum format, GLenum type, GLvoid *table)
-{
- d_1_2_Deprecated->f.GetColorTable(target, format, type, table);
-}
-
-inline void QOpenGLFunctions_2_0::glCopyColorTable(GLenum target, GLenum internalformat, GLint x, GLint y, GLsizei width)
-{
- d_1_2_Deprecated->f.CopyColorTable(target, internalformat, x, y, width);
-}
-
-inline void QOpenGLFunctions_2_0::glColorTableParameteriv(GLenum target, GLenum pname, const GLint *params)
-{
- d_1_2_Deprecated->f.ColorTableParameteriv(target, pname, params);
-}
-
-inline void QOpenGLFunctions_2_0::glColorTableParameterfv(GLenum target, GLenum pname, const GLfloat *params)
-{
- d_1_2_Deprecated->f.ColorTableParameterfv(target, pname, params);
-}
-
-inline void QOpenGLFunctions_2_0::glColorTable(GLenum target, GLenum internalformat, GLsizei width, GLenum format, GLenum type, const GLvoid *table)
-{
- d_1_2_Deprecated->f.ColorTable(target, internalformat, width, format, type, table);
-}
-
-
-// OpenGL 1.3 deprecated functions
-inline void QOpenGLFunctions_2_0::glMultTransposeMatrixd(const GLdouble *m)
-{
- d_1_3_Deprecated->f.MultTransposeMatrixd(m);
-}
-
-inline void QOpenGLFunctions_2_0::glMultTransposeMatrixf(const GLfloat *m)
-{
- d_1_3_Deprecated->f.MultTransposeMatrixf(m);
-}
-
-inline void QOpenGLFunctions_2_0::glLoadTransposeMatrixd(const GLdouble *m)
-{
- d_1_3_Deprecated->f.LoadTransposeMatrixd(m);
-}
-
-inline void QOpenGLFunctions_2_0::glLoadTransposeMatrixf(const GLfloat *m)
-{
- d_1_3_Deprecated->f.LoadTransposeMatrixf(m);
-}
-
-inline void QOpenGLFunctions_2_0::glMultiTexCoord4sv(GLenum target, const GLshort *v)
-{
- d_1_3_Deprecated->f.MultiTexCoord4sv(target, v);
-}
-
-inline void QOpenGLFunctions_2_0::glMultiTexCoord4s(GLenum target, GLshort s, GLshort t, GLshort r, GLshort q)
-{
- d_1_3_Deprecated->f.MultiTexCoord4s(target, s, t, r, q);
-}
-
-inline void QOpenGLFunctions_2_0::glMultiTexCoord4iv(GLenum target, const GLint *v)
-{
- d_1_3_Deprecated->f.MultiTexCoord4iv(target, v);
-}
-
-inline void QOpenGLFunctions_2_0::glMultiTexCoord4i(GLenum target, GLint s, GLint t, GLint r, GLint q)
-{
- d_1_3_Deprecated->f.MultiTexCoord4i(target, s, t, r, q);
-}
-
-inline void QOpenGLFunctions_2_0::glMultiTexCoord4fv(GLenum target, const GLfloat *v)
-{
- d_1_3_Deprecated->f.MultiTexCoord4fv(target, v);
-}
-
-inline void QOpenGLFunctions_2_0::glMultiTexCoord4f(GLenum target, GLfloat s, GLfloat t, GLfloat r, GLfloat q)
-{
- d_1_3_Deprecated->f.MultiTexCoord4f(target, s, t, r, q);
-}
-
-inline void QOpenGLFunctions_2_0::glMultiTexCoord4dv(GLenum target, const GLdouble *v)
-{
- d_1_3_Deprecated->f.MultiTexCoord4dv(target, v);
-}
-
-inline void QOpenGLFunctions_2_0::glMultiTexCoord4d(GLenum target, GLdouble s, GLdouble t, GLdouble r, GLdouble q)
-{
- d_1_3_Deprecated->f.MultiTexCoord4d(target, s, t, r, q);
-}
-
-inline void QOpenGLFunctions_2_0::glMultiTexCoord3sv(GLenum target, const GLshort *v)
-{
- d_1_3_Deprecated->f.MultiTexCoord3sv(target, v);
-}
-
-inline void QOpenGLFunctions_2_0::glMultiTexCoord3s(GLenum target, GLshort s, GLshort t, GLshort r)
-{
- d_1_3_Deprecated->f.MultiTexCoord3s(target, s, t, r);
-}
-
-inline void QOpenGLFunctions_2_0::glMultiTexCoord3iv(GLenum target, const GLint *v)
-{
- d_1_3_Deprecated->f.MultiTexCoord3iv(target, v);
-}
-
-inline void QOpenGLFunctions_2_0::glMultiTexCoord3i(GLenum target, GLint s, GLint t, GLint r)
-{
- d_1_3_Deprecated->f.MultiTexCoord3i(target, s, t, r);
-}
-
-inline void QOpenGLFunctions_2_0::glMultiTexCoord3fv(GLenum target, const GLfloat *v)
-{
- d_1_3_Deprecated->f.MultiTexCoord3fv(target, v);
-}
-
-inline void QOpenGLFunctions_2_0::glMultiTexCoord3f(GLenum target, GLfloat s, GLfloat t, GLfloat r)
-{
- d_1_3_Deprecated->f.MultiTexCoord3f(target, s, t, r);
-}
-
-inline void QOpenGLFunctions_2_0::glMultiTexCoord3dv(GLenum target, const GLdouble *v)
-{
- d_1_3_Deprecated->f.MultiTexCoord3dv(target, v);
-}
-
-inline void QOpenGLFunctions_2_0::glMultiTexCoord3d(GLenum target, GLdouble s, GLdouble t, GLdouble r)
-{
- d_1_3_Deprecated->f.MultiTexCoord3d(target, s, t, r);
-}
-
-inline void QOpenGLFunctions_2_0::glMultiTexCoord2sv(GLenum target, const GLshort *v)
-{
- d_1_3_Deprecated->f.MultiTexCoord2sv(target, v);
-}
-
-inline void QOpenGLFunctions_2_0::glMultiTexCoord2s(GLenum target, GLshort s, GLshort t)
-{
- d_1_3_Deprecated->f.MultiTexCoord2s(target, s, t);
-}
-
-inline void QOpenGLFunctions_2_0::glMultiTexCoord2iv(GLenum target, const GLint *v)
-{
- d_1_3_Deprecated->f.MultiTexCoord2iv(target, v);
-}
-
-inline void QOpenGLFunctions_2_0::glMultiTexCoord2i(GLenum target, GLint s, GLint t)
-{
- d_1_3_Deprecated->f.MultiTexCoord2i(target, s, t);
-}
-
-inline void QOpenGLFunctions_2_0::glMultiTexCoord2fv(GLenum target, const GLfloat *v)
-{
- d_1_3_Deprecated->f.MultiTexCoord2fv(target, v);
-}
-
-inline void QOpenGLFunctions_2_0::glMultiTexCoord2f(GLenum target, GLfloat s, GLfloat t)
-{
- d_1_3_Deprecated->f.MultiTexCoord2f(target, s, t);
-}
-
-inline void QOpenGLFunctions_2_0::glMultiTexCoord2dv(GLenum target, const GLdouble *v)
-{
- d_1_3_Deprecated->f.MultiTexCoord2dv(target, v);
-}
-
-inline void QOpenGLFunctions_2_0::glMultiTexCoord2d(GLenum target, GLdouble s, GLdouble t)
-{
- d_1_3_Deprecated->f.MultiTexCoord2d(target, s, t);
-}
-
-inline void QOpenGLFunctions_2_0::glMultiTexCoord1sv(GLenum target, const GLshort *v)
-{
- d_1_3_Deprecated->f.MultiTexCoord1sv(target, v);
-}
-
-inline void QOpenGLFunctions_2_0::glMultiTexCoord1s(GLenum target, GLshort s)
-{
- d_1_3_Deprecated->f.MultiTexCoord1s(target, s);
-}
-
-inline void QOpenGLFunctions_2_0::glMultiTexCoord1iv(GLenum target, const GLint *v)
-{
- d_1_3_Deprecated->f.MultiTexCoord1iv(target, v);
-}
-
-inline void QOpenGLFunctions_2_0::glMultiTexCoord1i(GLenum target, GLint s)
-{
- d_1_3_Deprecated->f.MultiTexCoord1i(target, s);
-}
-
-inline void QOpenGLFunctions_2_0::glMultiTexCoord1fv(GLenum target, const GLfloat *v)
-{
- d_1_3_Deprecated->f.MultiTexCoord1fv(target, v);
-}
-
-inline void QOpenGLFunctions_2_0::glMultiTexCoord1f(GLenum target, GLfloat s)
-{
- d_1_3_Deprecated->f.MultiTexCoord1f(target, s);
-}
-
-inline void QOpenGLFunctions_2_0::glMultiTexCoord1dv(GLenum target, const GLdouble *v)
-{
- d_1_3_Deprecated->f.MultiTexCoord1dv(target, v);
-}
-
-inline void QOpenGLFunctions_2_0::glMultiTexCoord1d(GLenum target, GLdouble s)
-{
- d_1_3_Deprecated->f.MultiTexCoord1d(target, s);
-}
-
-inline void QOpenGLFunctions_2_0::glClientActiveTexture(GLenum texture)
-{
- d_1_3_Deprecated->f.ClientActiveTexture(texture);
-}
-
-
-// OpenGL 1.4 deprecated functions
-inline void QOpenGLFunctions_2_0::glWindowPos3sv(const GLshort *v)
-{
- d_1_4_Deprecated->f.WindowPos3sv(v);
-}
-
-inline void QOpenGLFunctions_2_0::glWindowPos3s(GLshort x, GLshort y, GLshort z)
-{
- d_1_4_Deprecated->f.WindowPos3s(x, y, z);
-}
-
-inline void QOpenGLFunctions_2_0::glWindowPos3iv(const GLint *v)
-{
- d_1_4_Deprecated->f.WindowPos3iv(v);
-}
-
-inline void QOpenGLFunctions_2_0::glWindowPos3i(GLint x, GLint y, GLint z)
-{
- d_1_4_Deprecated->f.WindowPos3i(x, y, z);
-}
-
-inline void QOpenGLFunctions_2_0::glWindowPos3fv(const GLfloat *v)
-{
- d_1_4_Deprecated->f.WindowPos3fv(v);
-}
-
-inline void QOpenGLFunctions_2_0::glWindowPos3f(GLfloat x, GLfloat y, GLfloat z)
-{
- d_1_4_Deprecated->f.WindowPos3f(x, y, z);
-}
-
-inline void QOpenGLFunctions_2_0::glWindowPos3dv(const GLdouble *v)
-{
- d_1_4_Deprecated->f.WindowPos3dv(v);
-}
-
-inline void QOpenGLFunctions_2_0::glWindowPos3d(GLdouble x, GLdouble y, GLdouble z)
-{
- d_1_4_Deprecated->f.WindowPos3d(x, y, z);
-}
-
-inline void QOpenGLFunctions_2_0::glWindowPos2sv(const GLshort *v)
-{
- d_1_4_Deprecated->f.WindowPos2sv(v);
-}
-
-inline void QOpenGLFunctions_2_0::glWindowPos2s(GLshort x, GLshort y)
-{
- d_1_4_Deprecated->f.WindowPos2s(x, y);
-}
-
-inline void QOpenGLFunctions_2_0::glWindowPos2iv(const GLint *v)
-{
- d_1_4_Deprecated->f.WindowPos2iv(v);
-}
-
-inline void QOpenGLFunctions_2_0::glWindowPos2i(GLint x, GLint y)
-{
- d_1_4_Deprecated->f.WindowPos2i(x, y);
-}
-
-inline void QOpenGLFunctions_2_0::glWindowPos2fv(const GLfloat *v)
-{
- d_1_4_Deprecated->f.WindowPos2fv(v);
-}
-
-inline void QOpenGLFunctions_2_0::glWindowPos2f(GLfloat x, GLfloat y)
-{
- d_1_4_Deprecated->f.WindowPos2f(x, y);
-}
-
-inline void QOpenGLFunctions_2_0::glWindowPos2dv(const GLdouble *v)
-{
- d_1_4_Deprecated->f.WindowPos2dv(v);
-}
-
-inline void QOpenGLFunctions_2_0::glWindowPos2d(GLdouble x, GLdouble y)
-{
- d_1_4_Deprecated->f.WindowPos2d(x, y);
-}
-
-inline void QOpenGLFunctions_2_0::glSecondaryColorPointer(GLint size, GLenum type, GLsizei stride, const GLvoid *pointer)
-{
- d_1_4_Deprecated->f.SecondaryColorPointer(size, type, stride, pointer);
-}
-
-inline void QOpenGLFunctions_2_0::glSecondaryColor3usv(const GLushort *v)
-{
- d_1_4_Deprecated->f.SecondaryColor3usv(v);
-}
-
-inline void QOpenGLFunctions_2_0::glSecondaryColor3us(GLushort red, GLushort green, GLushort blue)
-{
- d_1_4_Deprecated->f.SecondaryColor3us(red, green, blue);
-}
-
-inline void QOpenGLFunctions_2_0::glSecondaryColor3uiv(const GLuint *v)
-{
- d_1_4_Deprecated->f.SecondaryColor3uiv(v);
-}
-
-inline void QOpenGLFunctions_2_0::glSecondaryColor3ui(GLuint red, GLuint green, GLuint blue)
-{
- d_1_4_Deprecated->f.SecondaryColor3ui(red, green, blue);
-}
-
-inline void QOpenGLFunctions_2_0::glSecondaryColor3ubv(const GLubyte *v)
-{
- d_1_4_Deprecated->f.SecondaryColor3ubv(v);
-}
-
-inline void QOpenGLFunctions_2_0::glSecondaryColor3ub(GLubyte red, GLubyte green, GLubyte blue)
-{
- d_1_4_Deprecated->f.SecondaryColor3ub(red, green, blue);
-}
-
-inline void QOpenGLFunctions_2_0::glSecondaryColor3sv(const GLshort *v)
-{
- d_1_4_Deprecated->f.SecondaryColor3sv(v);
-}
-
-inline void QOpenGLFunctions_2_0::glSecondaryColor3s(GLshort red, GLshort green, GLshort blue)
-{
- d_1_4_Deprecated->f.SecondaryColor3s(red, green, blue);
-}
-
-inline void QOpenGLFunctions_2_0::glSecondaryColor3iv(const GLint *v)
-{
- d_1_4_Deprecated->f.SecondaryColor3iv(v);
-}
-
-inline void QOpenGLFunctions_2_0::glSecondaryColor3i(GLint red, GLint green, GLint blue)
-{
- d_1_4_Deprecated->f.SecondaryColor3i(red, green, blue);
-}
-
-inline void QOpenGLFunctions_2_0::glSecondaryColor3fv(const GLfloat *v)
-{
- d_1_4_Deprecated->f.SecondaryColor3fv(v);
-}
-
-inline void QOpenGLFunctions_2_0::glSecondaryColor3f(GLfloat red, GLfloat green, GLfloat blue)
-{
- d_1_4_Deprecated->f.SecondaryColor3f(red, green, blue);
-}
-
-inline void QOpenGLFunctions_2_0::glSecondaryColor3dv(const GLdouble *v)
-{
- d_1_4_Deprecated->f.SecondaryColor3dv(v);
-}
-
-inline void QOpenGLFunctions_2_0::glSecondaryColor3d(GLdouble red, GLdouble green, GLdouble blue)
-{
- d_1_4_Deprecated->f.SecondaryColor3d(red, green, blue);
-}
-
-inline void QOpenGLFunctions_2_0::glSecondaryColor3bv(const GLbyte *v)
-{
- d_1_4_Deprecated->f.SecondaryColor3bv(v);
-}
-
-inline void QOpenGLFunctions_2_0::glSecondaryColor3b(GLbyte red, GLbyte green, GLbyte blue)
-{
- d_1_4_Deprecated->f.SecondaryColor3b(red, green, blue);
-}
-
-inline void QOpenGLFunctions_2_0::glFogCoordPointer(GLenum type, GLsizei stride, const GLvoid *pointer)
-{
- d_1_4_Deprecated->f.FogCoordPointer(type, stride, pointer);
-}
-
-inline void QOpenGLFunctions_2_0::glFogCoorddv(const GLdouble *coord)
-{
- d_1_4_Deprecated->f.FogCoorddv(coord);
-}
-
-inline void QOpenGLFunctions_2_0::glFogCoordd(GLdouble coord)
-{
- d_1_4_Deprecated->f.FogCoordd(coord);
-}
-
-inline void QOpenGLFunctions_2_0::glFogCoordfv(const GLfloat *coord)
-{
- d_1_4_Deprecated->f.FogCoordfv(coord);
-}
-
-inline void QOpenGLFunctions_2_0::glFogCoordf(GLfloat coord)
-{
- d_1_4_Deprecated->f.FogCoordf(coord);
-}
-
-
-// OpenGL 1.5 deprecated functions
-
-// OpenGL 2.0 deprecated functions
-inline void QOpenGLFunctions_2_0::glVertexAttrib4usv(GLuint index, const GLushort *v)
-{
- d_2_0_Core->f.VertexAttrib4usv(index, v);
-}
-
-inline void QOpenGLFunctions_2_0::glVertexAttrib4uiv(GLuint index, const GLuint *v)
-{
- d_2_0_Core->f.VertexAttrib4uiv(index, v);
-}
-
-inline void QOpenGLFunctions_2_0::glVertexAttrib4ubv(GLuint index, const GLubyte *v)
-{
- d_2_0_Core->f.VertexAttrib4ubv(index, v);
-}
-
-inline void QOpenGLFunctions_2_0::glVertexAttrib4sv(GLuint index, const GLshort *v)
-{
- d_2_0_Core->f.VertexAttrib4sv(index, v);
-}
-
-inline void QOpenGLFunctions_2_0::glVertexAttrib4s(GLuint index, GLshort x, GLshort y, GLshort z, GLshort w)
-{
- d_2_0_Core->f.VertexAttrib4s(index, x, y, z, w);
-}
-
-inline void QOpenGLFunctions_2_0::glVertexAttrib4iv(GLuint index, const GLint *v)
-{
- d_2_0_Core->f.VertexAttrib4iv(index, v);
-}
-
-inline void QOpenGLFunctions_2_0::glVertexAttrib4fv(GLuint index, const GLfloat *v)
-{
- d_2_0_Core->f.VertexAttrib4fv(index, v);
-}
-
-inline void QOpenGLFunctions_2_0::glVertexAttrib4f(GLuint index, GLfloat x, GLfloat y, GLfloat z, GLfloat w)
-{
- d_2_0_Core->f.VertexAttrib4f(index, x, y, z, w);
-}
-
-inline void QOpenGLFunctions_2_0::glVertexAttrib4dv(GLuint index, const GLdouble *v)
-{
- d_2_0_Core->f.VertexAttrib4dv(index, v);
-}
-
-inline void QOpenGLFunctions_2_0::glVertexAttrib4d(GLuint index, GLdouble x, GLdouble y, GLdouble z, GLdouble w)
-{
- d_2_0_Core->f.VertexAttrib4d(index, x, y, z, w);
-}
-
-inline void QOpenGLFunctions_2_0::glVertexAttrib4bv(GLuint index, const GLbyte *v)
-{
- d_2_0_Core->f.VertexAttrib4bv(index, v);
-}
-
-inline void QOpenGLFunctions_2_0::glVertexAttrib4Nusv(GLuint index, const GLushort *v)
-{
- d_2_0_Core->f.VertexAttrib4Nusv(index, v);
-}
-
-inline void QOpenGLFunctions_2_0::glVertexAttrib4Nuiv(GLuint index, const GLuint *v)
-{
- d_2_0_Core->f.VertexAttrib4Nuiv(index, v);
-}
-
-inline void QOpenGLFunctions_2_0::glVertexAttrib4Nubv(GLuint index, const GLubyte *v)
-{
- d_2_0_Core->f.VertexAttrib4Nubv(index, v);
-}
-
-inline void QOpenGLFunctions_2_0::glVertexAttrib4Nub(GLuint index, GLubyte x, GLubyte y, GLubyte z, GLubyte w)
-{
- d_2_0_Core->f.VertexAttrib4Nub(index, x, y, z, w);
-}
-
-inline void QOpenGLFunctions_2_0::glVertexAttrib4Nsv(GLuint index, const GLshort *v)
-{
- d_2_0_Core->f.VertexAttrib4Nsv(index, v);
-}
-
-inline void QOpenGLFunctions_2_0::glVertexAttrib4Niv(GLuint index, const GLint *v)
-{
- d_2_0_Core->f.VertexAttrib4Niv(index, v);
-}
-
-inline void QOpenGLFunctions_2_0::glVertexAttrib4Nbv(GLuint index, const GLbyte *v)
-{
- d_2_0_Core->f.VertexAttrib4Nbv(index, v);
-}
-
-inline void QOpenGLFunctions_2_0::glVertexAttrib3sv(GLuint index, const GLshort *v)
-{
- d_2_0_Core->f.VertexAttrib3sv(index, v);
-}
-
-inline void QOpenGLFunctions_2_0::glVertexAttrib3s(GLuint index, GLshort x, GLshort y, GLshort z)
-{
- d_2_0_Core->f.VertexAttrib3s(index, x, y, z);
-}
-
-inline void QOpenGLFunctions_2_0::glVertexAttrib3fv(GLuint index, const GLfloat *v)
-{
- d_2_0_Core->f.VertexAttrib3fv(index, v);
-}
-
-inline void QOpenGLFunctions_2_0::glVertexAttrib3f(GLuint index, GLfloat x, GLfloat y, GLfloat z)
-{
- d_2_0_Core->f.VertexAttrib3f(index, x, y, z);
-}
-
-inline void QOpenGLFunctions_2_0::glVertexAttrib3dv(GLuint index, const GLdouble *v)
-{
- d_2_0_Core->f.VertexAttrib3dv(index, v);
-}
-
-inline void QOpenGLFunctions_2_0::glVertexAttrib3d(GLuint index, GLdouble x, GLdouble y, GLdouble z)
-{
- d_2_0_Core->f.VertexAttrib3d(index, x, y, z);
-}
-
-inline void QOpenGLFunctions_2_0::glVertexAttrib2sv(GLuint index, const GLshort *v)
-{
- d_2_0_Core->f.VertexAttrib2sv(index, v);
-}
-
-inline void QOpenGLFunctions_2_0::glVertexAttrib2s(GLuint index, GLshort x, GLshort y)
-{
- d_2_0_Core->f.VertexAttrib2s(index, x, y);
-}
-
-inline void QOpenGLFunctions_2_0::glVertexAttrib2fv(GLuint index, const GLfloat *v)
-{
- d_2_0_Core->f.VertexAttrib2fv(index, v);
-}
-
-inline void QOpenGLFunctions_2_0::glVertexAttrib2f(GLuint index, GLfloat x, GLfloat y)
-{
- d_2_0_Core->f.VertexAttrib2f(index, x, y);
-}
-
-inline void QOpenGLFunctions_2_0::glVertexAttrib2dv(GLuint index, const GLdouble *v)
-{
- d_2_0_Core->f.VertexAttrib2dv(index, v);
-}
-
-inline void QOpenGLFunctions_2_0::glVertexAttrib2d(GLuint index, GLdouble x, GLdouble y)
-{
- d_2_0_Core->f.VertexAttrib2d(index, x, y);
-}
-
-inline void QOpenGLFunctions_2_0::glVertexAttrib1sv(GLuint index, const GLshort *v)
-{
- d_2_0_Core->f.VertexAttrib1sv(index, v);
-}
-
-inline void QOpenGLFunctions_2_0::glVertexAttrib1s(GLuint index, GLshort x)
-{
- d_2_0_Core->f.VertexAttrib1s(index, x);
-}
-
-inline void QOpenGLFunctions_2_0::glVertexAttrib1fv(GLuint index, const GLfloat *v)
-{
- d_2_0_Core->f.VertexAttrib1fv(index, v);
-}
-
-inline void QOpenGLFunctions_2_0::glVertexAttrib1f(GLuint index, GLfloat x)
-{
- d_2_0_Core->f.VertexAttrib1f(index, x);
-}
-
-inline void QOpenGLFunctions_2_0::glVertexAttrib1dv(GLuint index, const GLdouble *v)
-{
- d_2_0_Core->f.VertexAttrib1dv(index, v);
-}
-
-inline void QOpenGLFunctions_2_0::glVertexAttrib1d(GLuint index, GLdouble x)
-{
- d_2_0_Core->f.VertexAttrib1d(index, x);
-}
-
-
-
-QT_END_NAMESPACE
-
-#endif // QT_NO_OPENGL && !QT_OPENGL_ES_2
-
-#endif
diff --git a/src/gui/opengl/qopenglfunctions_2_1.cpp b/src/gui/opengl/qopenglfunctions_2_1.cpp
deleted file mode 100644
index 8a7170dd7d..0000000000
--- a/src/gui/opengl/qopenglfunctions_2_1.cpp
+++ /dev/null
@@ -1,236 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2013 Klaralvdalens Datakonsult AB (KDAB)
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the QtGui module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-**
-** This file was generated by glgen version 0.1
-** Command line was: glgen
-**
-** glgen is Copyright (C) 2013 Klaralvdalens Datakonsult AB (KDAB)
-**
-** This is an auto-generated file.
-** Do not edit! All changes made to it will be lost.
-**
-****************************************************************************/
-
-#include "qopenglfunctions_2_1.h"
-#include "qopenglcontext.h"
-
-QT_BEGIN_NAMESPACE
-
-/*!
- \class QOpenGLFunctions_2_1
- \inmodule QtGui
- \since 5.1
- \wrapper
- \brief The QOpenGLFunctions_2_1 class provides all functions for OpenGL 2.1 specification.
-
- This class is a wrapper for functions from OpenGL 2.1 specification.
- See reference pages on \l {http://www.opengl.org/sdk/docs/}{opengl.org}
- for function documentation.
-
- \sa QAbstractOpenGLFunctions
-*/
-
-QOpenGLFunctions_2_1::QOpenGLFunctions_2_1()
- : QAbstractOpenGLFunctions()
- , d_1_0_Core(nullptr)
- , d_1_1_Core(nullptr)
- , d_1_2_Core(nullptr)
- , d_1_3_Core(nullptr)
- , d_1_4_Core(nullptr)
- , d_1_5_Core(nullptr)
- , d_2_0_Core(nullptr)
- , d_2_1_Core(nullptr)
- , d_1_0_Deprecated(nullptr)
- , d_1_1_Deprecated(nullptr)
- , d_1_2_Deprecated(nullptr)
- , d_1_3_Deprecated(nullptr)
- , d_1_4_Deprecated(nullptr)
- , m_reserved_2_0_Deprecated(nullptr)
-{
-}
-
-QOpenGLFunctions_2_1::~QOpenGLFunctions_2_1()
-{
- if (d_1_0_Core) {
- d_1_0_Core->refs.deref();
- Q_ASSERT(d_1_0_Core->refs.loadRelaxed());
- }
- if (d_1_1_Core) {
- d_1_1_Core->refs.deref();
- Q_ASSERT(d_1_1_Core->refs.loadRelaxed());
- }
- if (d_1_2_Core) {
- d_1_2_Core->refs.deref();
- Q_ASSERT(d_1_2_Core->refs.loadRelaxed());
- }
- if (d_1_3_Core) {
- d_1_3_Core->refs.deref();
- Q_ASSERT(d_1_3_Core->refs.loadRelaxed());
- }
- if (d_1_4_Core) {
- d_1_4_Core->refs.deref();
- Q_ASSERT(d_1_4_Core->refs.loadRelaxed());
- }
- if (d_1_5_Core) {
- d_1_5_Core->refs.deref();
- Q_ASSERT(d_1_5_Core->refs.loadRelaxed());
- }
- if (d_2_0_Core) {
- d_2_0_Core->refs.deref();
- Q_ASSERT(d_2_0_Core->refs.loadRelaxed());
- }
- if (d_2_1_Core) {
- d_2_1_Core->refs.deref();
- Q_ASSERT(d_2_1_Core->refs.loadRelaxed());
- }
- if (d_1_0_Deprecated) {
- d_1_0_Deprecated->refs.deref();
- Q_ASSERT(d_1_0_Deprecated->refs.loadRelaxed());
- }
- if (d_1_1_Deprecated) {
- d_1_1_Deprecated->refs.deref();
- Q_ASSERT(d_1_1_Deprecated->refs.loadRelaxed());
- }
- if (d_1_2_Deprecated) {
- d_1_2_Deprecated->refs.deref();
- Q_ASSERT(d_1_2_Deprecated->refs.loadRelaxed());
- }
- if (d_1_3_Deprecated) {
- d_1_3_Deprecated->refs.deref();
- Q_ASSERT(d_1_3_Deprecated->refs.loadRelaxed());
- }
- if (d_1_4_Deprecated) {
- d_1_4_Deprecated->refs.deref();
- Q_ASSERT(d_1_4_Deprecated->refs.loadRelaxed());
- }
-}
-
-bool QOpenGLFunctions_2_1::initializeOpenGLFunctions()
-{
- if ( isInitialized() )
- return true;
-
- QOpenGLContext* context = QOpenGLContext::currentContext();
-
- // If owned by a context object make sure it is current.
- // Also check that current context is capable of resolving all needed functions
- if (((owningContext() && owningContext() == context) || !owningContext())
- && QOpenGLFunctions_2_1::isContextCompatible(context))
- {
- // Associate with private implementation, creating if necessary
- // Function pointers in the backends are resolved at creation time
- QOpenGLVersionFunctionsBackend* d = nullptr;
- d = QAbstractOpenGLFunctionsPrivate::functionsBackend(context, QOpenGLFunctions_1_0_CoreBackend::versionStatus());
- d_1_0_Core = static_cast<QOpenGLFunctions_1_0_CoreBackend*>(d);
- d->refs.ref();
-
- d = QAbstractOpenGLFunctionsPrivate::functionsBackend(context, QOpenGLFunctions_1_1_CoreBackend::versionStatus());
- d_1_1_Core = static_cast<QOpenGLFunctions_1_1_CoreBackend*>(d);
- d->refs.ref();
-
- d = QAbstractOpenGLFunctionsPrivate::functionsBackend(context, QOpenGLFunctions_1_2_CoreBackend::versionStatus());
- d_1_2_Core = static_cast<QOpenGLFunctions_1_2_CoreBackend*>(d);
- d->refs.ref();
-
- d = QAbstractOpenGLFunctionsPrivate::functionsBackend(context, QOpenGLFunctions_1_3_CoreBackend::versionStatus());
- d_1_3_Core = static_cast<QOpenGLFunctions_1_3_CoreBackend*>(d);
- d->refs.ref();
-
- d = QAbstractOpenGLFunctionsPrivate::functionsBackend(context, QOpenGLFunctions_1_4_CoreBackend::versionStatus());
- d_1_4_Core = static_cast<QOpenGLFunctions_1_4_CoreBackend*>(d);
- d->refs.ref();
-
- d = QAbstractOpenGLFunctionsPrivate::functionsBackend(context, QOpenGLFunctions_1_5_CoreBackend::versionStatus());
- d_1_5_Core = static_cast<QOpenGLFunctions_1_5_CoreBackend*>(d);
- d->refs.ref();
-
- d = QAbstractOpenGLFunctionsPrivate::functionsBackend(context, QOpenGLFunctions_2_0_CoreBackend::versionStatus());
- d_2_0_Core = static_cast<QOpenGLFunctions_2_0_CoreBackend*>(d);
- d->refs.ref();
-
- d = QAbstractOpenGLFunctionsPrivate::functionsBackend(context, QOpenGLFunctions_2_1_CoreBackend::versionStatus());
- d_2_1_Core = static_cast<QOpenGLFunctions_2_1_CoreBackend*>(d);
- d->refs.ref();
-
- d = QAbstractOpenGLFunctionsPrivate::functionsBackend(context, QOpenGLFunctions_1_0_DeprecatedBackend::versionStatus());
- d_1_0_Deprecated = static_cast<QOpenGLFunctions_1_0_DeprecatedBackend*>(d);
- d->refs.ref();
-
- d = QAbstractOpenGLFunctionsPrivate::functionsBackend(context, QOpenGLFunctions_1_1_DeprecatedBackend::versionStatus());
- d_1_1_Deprecated = static_cast<QOpenGLFunctions_1_1_DeprecatedBackend*>(d);
- d->refs.ref();
-
- d = QAbstractOpenGLFunctionsPrivate::functionsBackend(context, QOpenGLFunctions_1_2_DeprecatedBackend::versionStatus());
- d_1_2_Deprecated = static_cast<QOpenGLFunctions_1_2_DeprecatedBackend*>(d);
- d->refs.ref();
-
- d = QAbstractOpenGLFunctionsPrivate::functionsBackend(context, QOpenGLFunctions_1_3_DeprecatedBackend::versionStatus());
- d_1_3_Deprecated = static_cast<QOpenGLFunctions_1_3_DeprecatedBackend*>(d);
- d->refs.ref();
-
- d = QAbstractOpenGLFunctionsPrivate::functionsBackend(context, QOpenGLFunctions_1_4_DeprecatedBackend::versionStatus());
- d_1_4_Deprecated = static_cast<QOpenGLFunctions_1_4_DeprecatedBackend*>(d);
- d->refs.ref();
-
- QAbstractOpenGLFunctions::initializeOpenGLFunctions();
- }
- return isInitialized();
-}
-
-bool QOpenGLFunctions_2_1::isContextCompatible(QOpenGLContext *context)
-{
- Q_ASSERT(context);
- QSurfaceFormat f = context->format();
- const QPair<int, int> v = qMakePair(f.majorVersion(), f.minorVersion());
- if (v < qMakePair(2, 1))
- return false;
-
- if (f.profile() == QSurfaceFormat::CoreProfile)
- return false;
-
- return true;
-}
-
-QOpenGLVersionProfile QOpenGLFunctions_2_1::versionProfile()
-{
- QOpenGLVersionProfile v;
- v.setVersion(2, 1);
- return v;
-}
-
-QT_END_NAMESPACE
diff --git a/src/gui/opengl/qopenglfunctions_2_1.h b/src/gui/opengl/qopenglfunctions_2_1.h
deleted file mode 100644
index f053222c71..0000000000
--- a/src/gui/opengl/qopenglfunctions_2_1.h
+++ /dev/null
@@ -1,3659 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2013 Klaralvdalens Datakonsult AB (KDAB)
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the QtGui module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-**
-** This file was generated by glgen version 0.1
-** Command line was: glgen
-**
-** glgen is Copyright (C) 2013 Klaralvdalens Datakonsult AB (KDAB)
-**
-** This is an auto-generated file.
-** Do not edit! All changes made to it will be lost.
-**
-****************************************************************************/
-
-#ifndef QOPENGLVERSIONFUNCTIONS_2_1_H
-#define QOPENGLVERSIONFUNCTIONS_2_1_H
-
-#include <QtGui/qtguiglobal.h>
-
-#if !defined(QT_NO_OPENGL) && !defined(QT_OPENGL_ES_2)
-
-#include <QtGui/QOpenGLVersionFunctions>
-#include <QtGui/qopenglcontext.h>
-
-QT_BEGIN_NAMESPACE
-
-class Q_GUI_EXPORT QOpenGLFunctions_2_1 : public QAbstractOpenGLFunctions
-{
-public:
- QOpenGLFunctions_2_1();
- ~QOpenGLFunctions_2_1();
-
- bool initializeOpenGLFunctions() override;
-
- // OpenGL 1.0 core functions
- void glViewport(GLint x, GLint y, GLsizei width, GLsizei height);
- void glDepthRange(GLdouble nearVal, GLdouble farVal);
- GLboolean glIsEnabled(GLenum cap);
- void glGetTexLevelParameteriv(GLenum target, GLint level, GLenum pname, GLint *params);
- void glGetTexLevelParameterfv(GLenum target, GLint level, GLenum pname, GLfloat *params);
- void glGetTexParameteriv(GLenum target, GLenum pname, GLint *params);
- void glGetTexParameterfv(GLenum target, GLenum pname, GLfloat *params);
- void glGetTexImage(GLenum target, GLint level, GLenum format, GLenum type, GLvoid *pixels);
- const GLubyte * glGetString(GLenum name);
- void glGetIntegerv(GLenum pname, GLint *params);
- void glGetFloatv(GLenum pname, GLfloat *params);
- GLenum glGetError();
- void glGetDoublev(GLenum pname, GLdouble *params);
- void glGetBooleanv(GLenum pname, GLboolean *params);
- void glReadPixels(GLint x, GLint y, GLsizei width, GLsizei height, GLenum format, GLenum type, GLvoid *pixels);
- void glReadBuffer(GLenum mode);
- void glPixelStorei(GLenum pname, GLint param);
- void glPixelStoref(GLenum pname, GLfloat param);
- void glDepthFunc(GLenum func);
- void glStencilOp(GLenum fail, GLenum zfail, GLenum zpass);
- void glStencilFunc(GLenum func, GLint ref, GLuint mask);
- void glLogicOp(GLenum opcode);
- void glBlendFunc(GLenum sfactor, GLenum dfactor);
- void glFlush();
- void glFinish();
- void glEnable(GLenum cap);
- void glDisable(GLenum cap);
- void glDepthMask(GLboolean flag);
- void glColorMask(GLboolean red, GLboolean green, GLboolean blue, GLboolean alpha);
- void glStencilMask(GLuint mask);
- void glClearDepth(GLdouble depth);
- void glClearStencil(GLint s);
- void glClearColor(GLfloat red, GLfloat green, GLfloat blue, GLfloat alpha);
- void glClear(GLbitfield mask);
- void glDrawBuffer(GLenum mode);
- void glTexImage2D(GLenum target, GLint level, GLint internalformat, GLsizei width, GLsizei height, GLint border, GLenum format, GLenum type, const GLvoid *pixels);
- void glTexImage1D(GLenum target, GLint level, GLint internalformat, GLsizei width, GLint border, GLenum format, GLenum type, const GLvoid *pixels);
- void glTexParameteriv(GLenum target, GLenum pname, const GLint *params);
- void glTexParameteri(GLenum target, GLenum pname, GLint param);
- void glTexParameterfv(GLenum target, GLenum pname, const GLfloat *params);
- void glTexParameterf(GLenum target, GLenum pname, GLfloat param);
- void glScissor(GLint x, GLint y, GLsizei width, GLsizei height);
- void glPolygonMode(GLenum face, GLenum mode);
- void glPointSize(GLfloat size);
- void glLineWidth(GLfloat width);
- void glHint(GLenum target, GLenum mode);
- void glFrontFace(GLenum mode);
- void glCullFace(GLenum mode);
-
- // OpenGL 1.1 core functions
- void glIndexubv(const GLubyte *c);
- void glIndexub(GLubyte c);
- GLboolean glIsTexture(GLuint texture);
- void glGenTextures(GLsizei n, GLuint *textures);
- void glDeleteTextures(GLsizei n, const GLuint *textures);
- void glBindTexture(GLenum target, GLuint texture);
- void glTexSubImage2D(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLenum type, const GLvoid *pixels);
- void glTexSubImage1D(GLenum target, GLint level, GLint xoffset, GLsizei width, GLenum format, GLenum type, const GLvoid *pixels);
- void glCopyTexSubImage2D(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint x, GLint y, GLsizei width, GLsizei height);
- void glCopyTexSubImage1D(GLenum target, GLint level, GLint xoffset, GLint x, GLint y, GLsizei width);
- void glCopyTexImage2D(GLenum target, GLint level, GLenum internalformat, GLint x, GLint y, GLsizei width, GLsizei height, GLint border);
- void glCopyTexImage1D(GLenum target, GLint level, GLenum internalformat, GLint x, GLint y, GLsizei width, GLint border);
- void glPolygonOffset(GLfloat factor, GLfloat units);
- void glGetPointerv(GLenum pname, GLvoid* *params);
- void glDrawElements(GLenum mode, GLsizei count, GLenum type, const GLvoid *indices);
- void glDrawArrays(GLenum mode, GLint first, GLsizei count);
-
- // OpenGL 1.2 core functions
- void glCopyTexSubImage3D(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLint x, GLint y, GLsizei width, GLsizei height);
- void glTexSubImage3D(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLenum type, const GLvoid *pixels);
- void glTexImage3D(GLenum target, GLint level, GLint internalformat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLenum format, GLenum type, const GLvoid *pixels);
- void glDrawRangeElements(GLenum mode, GLuint start, GLuint end, GLsizei count, GLenum type, const GLvoid *indices);
- void glBlendEquation(GLenum mode);
- void glBlendColor(GLfloat red, GLfloat green, GLfloat blue, GLfloat alpha);
-
- // OpenGL 1.3 core functions
- void glGetCompressedTexImage(GLenum target, GLint level, GLvoid *img);
- void glCompressedTexSubImage1D(GLenum target, GLint level, GLint xoffset, GLsizei width, GLenum format, GLsizei imageSize, const GLvoid *data);
- void glCompressedTexSubImage2D(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLsizei imageSize, const GLvoid *data);
- void glCompressedTexSubImage3D(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLsizei imageSize, const GLvoid *data);
- void glCompressedTexImage1D(GLenum target, GLint level, GLenum internalformat, GLsizei width, GLint border, GLsizei imageSize, const GLvoid *data);
- void glCompressedTexImage2D(GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLint border, GLsizei imageSize, const GLvoid *data);
- void glCompressedTexImage3D(GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLsizei imageSize, const GLvoid *data);
- void glSampleCoverage(GLfloat value, GLboolean invert);
- void glActiveTexture(GLenum texture);
-
- // OpenGL 1.4 core functions
- void glPointParameteriv(GLenum pname, const GLint *params);
- void glPointParameteri(GLenum pname, GLint param);
- void glPointParameterfv(GLenum pname, const GLfloat *params);
- void glPointParameterf(GLenum pname, GLfloat param);
- void glMultiDrawElements(GLenum mode, const GLsizei *count, GLenum type, const GLvoid* const *indices, GLsizei drawcount);
- void glMultiDrawArrays(GLenum mode, const GLint *first, const GLsizei *count, GLsizei drawcount);
- void glBlendFuncSeparate(GLenum sfactorRGB, GLenum dfactorRGB, GLenum sfactorAlpha, GLenum dfactorAlpha);
-
- // OpenGL 1.5 core functions
- void glGetBufferPointerv(GLenum target, GLenum pname, GLvoid* *params);
- void glGetBufferParameteriv(GLenum target, GLenum pname, GLint *params);
- GLboolean glUnmapBuffer(GLenum target);
- GLvoid* glMapBuffer(GLenum target, GLenum access);
- void glGetBufferSubData(GLenum target, GLintptr offset, GLsizeiptr size, GLvoid *data);
- void glBufferSubData(GLenum target, GLintptr offset, GLsizeiptr size, const GLvoid *data);
- void glBufferData(GLenum target, GLsizeiptr size, const GLvoid *data, GLenum usage);
- GLboolean glIsBuffer(GLuint buffer);
- void glGenBuffers(GLsizei n, GLuint *buffers);
- void glDeleteBuffers(GLsizei n, const GLuint *buffers);
- void glBindBuffer(GLenum target, GLuint buffer);
- void glGetQueryObjectuiv(GLuint id, GLenum pname, GLuint *params);
- void glGetQueryObjectiv(GLuint id, GLenum pname, GLint *params);
- void glGetQueryiv(GLenum target, GLenum pname, GLint *params);
- void glEndQuery(GLenum target);
- void glBeginQuery(GLenum target, GLuint id);
- GLboolean glIsQuery(GLuint id);
- void glDeleteQueries(GLsizei n, const GLuint *ids);
- void glGenQueries(GLsizei n, GLuint *ids);
-
- // OpenGL 2.0 core functions
- void glVertexAttribPointer(GLuint index, GLint size, GLenum type, GLboolean normalized, GLsizei stride, const GLvoid *pointer);
- void glValidateProgram(GLuint program);
- void glUniformMatrix4fv(GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
- void glUniformMatrix3fv(GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
- void glUniformMatrix2fv(GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
- void glUniform4iv(GLint location, GLsizei count, const GLint *value);
- void glUniform3iv(GLint location, GLsizei count, const GLint *value);
- void glUniform2iv(GLint location, GLsizei count, const GLint *value);
- void glUniform1iv(GLint location, GLsizei count, const GLint *value);
- void glUniform4fv(GLint location, GLsizei count, const GLfloat *value);
- void glUniform3fv(GLint location, GLsizei count, const GLfloat *value);
- void glUniform2fv(GLint location, GLsizei count, const GLfloat *value);
- void glUniform1fv(GLint location, GLsizei count, const GLfloat *value);
- void glUniform4i(GLint location, GLint v0, GLint v1, GLint v2, GLint v3);
- void glUniform3i(GLint location, GLint v0, GLint v1, GLint v2);
- void glUniform2i(GLint location, GLint v0, GLint v1);
- void glUniform1i(GLint location, GLint v0);
- void glUniform4f(GLint location, GLfloat v0, GLfloat v1, GLfloat v2, GLfloat v3);
- void glUniform3f(GLint location, GLfloat v0, GLfloat v1, GLfloat v2);
- void glUniform2f(GLint location, GLfloat v0, GLfloat v1);
- void glUniform1f(GLint location, GLfloat v0);
- void glUseProgram(GLuint program);
- void glShaderSource(GLuint shader, GLsizei count, const GLchar* const *string, const GLint *length);
- void glLinkProgram(GLuint program);
- GLboolean glIsShader(GLuint shader);
- GLboolean glIsProgram(GLuint program);
- void glGetVertexAttribPointerv(GLuint index, GLenum pname, GLvoid* *pointer);
- void glGetVertexAttribiv(GLuint index, GLenum pname, GLint *params);
- void glGetVertexAttribfv(GLuint index, GLenum pname, GLfloat *params);
- void glGetVertexAttribdv(GLuint index, GLenum pname, GLdouble *params);
- void glGetUniformiv(GLuint program, GLint location, GLint *params);
- void glGetUniformfv(GLuint program, GLint location, GLfloat *params);
- GLint glGetUniformLocation(GLuint program, const GLchar *name);
- void glGetShaderSource(GLuint shader, GLsizei bufSize, GLsizei *length, GLchar *source);
- void glGetShaderInfoLog(GLuint shader, GLsizei bufSize, GLsizei *length, GLchar *infoLog);
- void glGetShaderiv(GLuint shader, GLenum pname, GLint *params);
- void glGetProgramInfoLog(GLuint program, GLsizei bufSize, GLsizei *length, GLchar *infoLog);
- void glGetProgramiv(GLuint program, GLenum pname, GLint *params);
- GLint glGetAttribLocation(GLuint program, const GLchar *name);
- void glGetAttachedShaders(GLuint program, GLsizei maxCount, GLsizei *count, GLuint *obj);
- void glGetActiveUniform(GLuint program, GLuint index, GLsizei bufSize, GLsizei *length, GLint *size, GLenum *type, GLchar *name);
- void glGetActiveAttrib(GLuint program, GLuint index, GLsizei bufSize, GLsizei *length, GLint *size, GLenum *type, GLchar *name);
- void glEnableVertexAttribArray(GLuint index);
- void glDisableVertexAttribArray(GLuint index);
- void glDetachShader(GLuint program, GLuint shader);
- void glDeleteShader(GLuint shader);
- void glDeleteProgram(GLuint program);
- GLuint glCreateShader(GLenum type);
- GLuint glCreateProgram();
- void glCompileShader(GLuint shader);
- void glBindAttribLocation(GLuint program, GLuint index, const GLchar *name);
- void glAttachShader(GLuint program, GLuint shader);
- void glStencilMaskSeparate(GLenum face, GLuint mask);
- void glStencilFuncSeparate(GLenum face, GLenum func, GLint ref, GLuint mask);
- void glStencilOpSeparate(GLenum face, GLenum sfail, GLenum dpfail, GLenum dppass);
- void glDrawBuffers(GLsizei n, const GLenum *bufs);
- void glBlendEquationSeparate(GLenum modeRGB, GLenum modeAlpha);
-
- // OpenGL 2.1 core functions
- void glUniformMatrix4x3fv(GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
- void glUniformMatrix3x4fv(GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
- void glUniformMatrix4x2fv(GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
- void glUniformMatrix2x4fv(GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
- void glUniformMatrix3x2fv(GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
- void glUniformMatrix2x3fv(GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
-
- // OpenGL 1.0 deprecated functions
- void glTranslatef(GLfloat x, GLfloat y, GLfloat z);
- void glTranslated(GLdouble x, GLdouble y, GLdouble z);
- void glScalef(GLfloat x, GLfloat y, GLfloat z);
- void glScaled(GLdouble x, GLdouble y, GLdouble z);
- void glRotatef(GLfloat angle, GLfloat x, GLfloat y, GLfloat z);
- void glRotated(GLdouble angle, GLdouble x, GLdouble y, GLdouble z);
- void glPushMatrix();
- void glPopMatrix();
- void glOrtho(GLdouble left, GLdouble right, GLdouble bottom, GLdouble top, GLdouble zNear, GLdouble zFar);
- void glMultMatrixd(const GLdouble *m);
- void glMultMatrixf(const GLfloat *m);
- void glMatrixMode(GLenum mode);
- void glLoadMatrixd(const GLdouble *m);
- void glLoadMatrixf(const GLfloat *m);
- void glLoadIdentity();
- void glFrustum(GLdouble left, GLdouble right, GLdouble bottom, GLdouble top, GLdouble zNear, GLdouble zFar);
- GLboolean glIsList(GLuint list);
- void glGetTexGeniv(GLenum coord, GLenum pname, GLint *params);
- void glGetTexGenfv(GLenum coord, GLenum pname, GLfloat *params);
- void glGetTexGendv(GLenum coord, GLenum pname, GLdouble *params);
- void glGetTexEnviv(GLenum target, GLenum pname, GLint *params);
- void glGetTexEnvfv(GLenum target, GLenum pname, GLfloat *params);
- void glGetPolygonStipple(GLubyte *mask);
- void glGetPixelMapusv(GLenum map, GLushort *values);
- void glGetPixelMapuiv(GLenum map, GLuint *values);
- void glGetPixelMapfv(GLenum map, GLfloat *values);
- void glGetMaterialiv(GLenum face, GLenum pname, GLint *params);
- void glGetMaterialfv(GLenum face, GLenum pname, GLfloat *params);
- void glGetMapiv(GLenum target, GLenum query, GLint *v);
- void glGetMapfv(GLenum target, GLenum query, GLfloat *v);
- void glGetMapdv(GLenum target, GLenum query, GLdouble *v);
- void glGetLightiv(GLenum light, GLenum pname, GLint *params);
- void glGetLightfv(GLenum light, GLenum pname, GLfloat *params);
- void glGetClipPlane(GLenum plane, GLdouble *equation);
- void glDrawPixels(GLsizei width, GLsizei height, GLenum format, GLenum type, const GLvoid *pixels);
- void glCopyPixels(GLint x, GLint y, GLsizei width, GLsizei height, GLenum type);
- void glPixelMapusv(GLenum map, GLint mapsize, const GLushort *values);
- void glPixelMapuiv(GLenum map, GLint mapsize, const GLuint *values);
- void glPixelMapfv(GLenum map, GLint mapsize, const GLfloat *values);
- void glPixelTransferi(GLenum pname, GLint param);
- void glPixelTransferf(GLenum pname, GLfloat param);
- void glPixelZoom(GLfloat xfactor, GLfloat yfactor);
- void glAlphaFunc(GLenum func, GLfloat ref);
- void glEvalPoint2(GLint i, GLint j);
- void glEvalMesh2(GLenum mode, GLint i1, GLint i2, GLint j1, GLint j2);
- void glEvalPoint1(GLint i);
- void glEvalMesh1(GLenum mode, GLint i1, GLint i2);
- void glEvalCoord2fv(const GLfloat *u);
- void glEvalCoord2f(GLfloat u, GLfloat v);
- void glEvalCoord2dv(const GLdouble *u);
- void glEvalCoord2d(GLdouble u, GLdouble v);
- void glEvalCoord1fv(const GLfloat *u);
- void glEvalCoord1f(GLfloat u);
- void glEvalCoord1dv(const GLdouble *u);
- void glEvalCoord1d(GLdouble u);
- void glMapGrid2f(GLint un, GLfloat u1, GLfloat u2, GLint vn, GLfloat v1, GLfloat v2);
- void glMapGrid2d(GLint un, GLdouble u1, GLdouble u2, GLint vn, GLdouble v1, GLdouble v2);
- void glMapGrid1f(GLint un, GLfloat u1, GLfloat u2);
- void glMapGrid1d(GLint un, GLdouble u1, GLdouble u2);
- void glMap2f(GLenum target, GLfloat u1, GLfloat u2, GLint ustride, GLint uorder, GLfloat v1, GLfloat v2, GLint vstride, GLint vorder, const GLfloat *points);
- void glMap2d(GLenum target, GLdouble u1, GLdouble u2, GLint ustride, GLint uorder, GLdouble v1, GLdouble v2, GLint vstride, GLint vorder, const GLdouble *points);
- void glMap1f(GLenum target, GLfloat u1, GLfloat u2, GLint stride, GLint order, const GLfloat *points);
- void glMap1d(GLenum target, GLdouble u1, GLdouble u2, GLint stride, GLint order, const GLdouble *points);
- void glPushAttrib(GLbitfield mask);
- void glPopAttrib();
- void glAccum(GLenum op, GLfloat value);
- void glIndexMask(GLuint mask);
- void glClearIndex(GLfloat c);
- void glClearAccum(GLfloat red, GLfloat green, GLfloat blue, GLfloat alpha);
- void glPushName(GLuint name);
- void glPopName();
- void glPassThrough(GLfloat token);
- void glLoadName(GLuint name);
- void glInitNames();
- GLint glRenderMode(GLenum mode);
- void glSelectBuffer(GLsizei size, GLuint *buffer);
- void glFeedbackBuffer(GLsizei size, GLenum type, GLfloat *buffer);
- void glTexGeniv(GLenum coord, GLenum pname, const GLint *params);
- void glTexGeni(GLenum coord, GLenum pname, GLint param);
- void glTexGenfv(GLenum coord, GLenum pname, const GLfloat *params);
- void glTexGenf(GLenum coord, GLenum pname, GLfloat param);
- void glTexGendv(GLenum coord, GLenum pname, const GLdouble *params);
- void glTexGend(GLenum coord, GLenum pname, GLdouble param);
- void glTexEnviv(GLenum target, GLenum pname, const GLint *params);
- void glTexEnvi(GLenum target, GLenum pname, GLint param);
- void glTexEnvfv(GLenum target, GLenum pname, const GLfloat *params);
- void glTexEnvf(GLenum target, GLenum pname, GLfloat param);
- void glShadeModel(GLenum mode);
- void glPolygonStipple(const GLubyte *mask);
- void glMaterialiv(GLenum face, GLenum pname, const GLint *params);
- void glMateriali(GLenum face, GLenum pname, GLint param);
- void glMaterialfv(GLenum face, GLenum pname, const GLfloat *params);
- void glMaterialf(GLenum face, GLenum pname, GLfloat param);
- void glLineStipple(GLint factor, GLushort pattern);
- void glLightModeliv(GLenum pname, const GLint *params);
- void glLightModeli(GLenum pname, GLint param);
- void glLightModelfv(GLenum pname, const GLfloat *params);
- void glLightModelf(GLenum pname, GLfloat param);
- void glLightiv(GLenum light, GLenum pname, const GLint *params);
- void glLighti(GLenum light, GLenum pname, GLint param);
- void glLightfv(GLenum light, GLenum pname, const GLfloat *params);
- void glLightf(GLenum light, GLenum pname, GLfloat param);
- void glFogiv(GLenum pname, const GLint *params);
- void glFogi(GLenum pname, GLint param);
- void glFogfv(GLenum pname, const GLfloat *params);
- void glFogf(GLenum pname, GLfloat param);
- void glColorMaterial(GLenum face, GLenum mode);
- void glClipPlane(GLenum plane, const GLdouble *equation);
- void glVertex4sv(const GLshort *v);
- void glVertex4s(GLshort x, GLshort y, GLshort z, GLshort w);
- void glVertex4iv(const GLint *v);
- void glVertex4i(GLint x, GLint y, GLint z, GLint w);
- void glVertex4fv(const GLfloat *v);
- void glVertex4f(GLfloat x, GLfloat y, GLfloat z, GLfloat w);
- void glVertex4dv(const GLdouble *v);
- void glVertex4d(GLdouble x, GLdouble y, GLdouble z, GLdouble w);
- void glVertex3sv(const GLshort *v);
- void glVertex3s(GLshort x, GLshort y, GLshort z);
- void glVertex3iv(const GLint *v);
- void glVertex3i(GLint x, GLint y, GLint z);
- void glVertex3fv(const GLfloat *v);
- void glVertex3f(GLfloat x, GLfloat y, GLfloat z);
- void glVertex3dv(const GLdouble *v);
- void glVertex3d(GLdouble x, GLdouble y, GLdouble z);
- void glVertex2sv(const GLshort *v);
- void glVertex2s(GLshort x, GLshort y);
- void glVertex2iv(const GLint *v);
- void glVertex2i(GLint x, GLint y);
- void glVertex2fv(const GLfloat *v);
- void glVertex2f(GLfloat x, GLfloat y);
- void glVertex2dv(const GLdouble *v);
- void glVertex2d(GLdouble x, GLdouble y);
- void glTexCoord4sv(const GLshort *v);
- void glTexCoord4s(GLshort s, GLshort t, GLshort r, GLshort q);
- void glTexCoord4iv(const GLint *v);
- void glTexCoord4i(GLint s, GLint t, GLint r, GLint q);
- void glTexCoord4fv(const GLfloat *v);
- void glTexCoord4f(GLfloat s, GLfloat t, GLfloat r, GLfloat q);
- void glTexCoord4dv(const GLdouble *v);
- void glTexCoord4d(GLdouble s, GLdouble t, GLdouble r, GLdouble q);
- void glTexCoord3sv(const GLshort *v);
- void glTexCoord3s(GLshort s, GLshort t, GLshort r);
- void glTexCoord3iv(const GLint *v);
- void glTexCoord3i(GLint s, GLint t, GLint r);
- void glTexCoord3fv(const GLfloat *v);
- void glTexCoord3f(GLfloat s, GLfloat t, GLfloat r);
- void glTexCoord3dv(const GLdouble *v);
- void glTexCoord3d(GLdouble s, GLdouble t, GLdouble r);
- void glTexCoord2sv(const GLshort *v);
- void glTexCoord2s(GLshort s, GLshort t);
- void glTexCoord2iv(const GLint *v);
- void glTexCoord2i(GLint s, GLint t);
- void glTexCoord2fv(const GLfloat *v);
- void glTexCoord2f(GLfloat s, GLfloat t);
- void glTexCoord2dv(const GLdouble *v);
- void glTexCoord2d(GLdouble s, GLdouble t);
- void glTexCoord1sv(const GLshort *v);
- void glTexCoord1s(GLshort s);
- void glTexCoord1iv(const GLint *v);
- void glTexCoord1i(GLint s);
- void glTexCoord1fv(const GLfloat *v);
- void glTexCoord1f(GLfloat s);
- void glTexCoord1dv(const GLdouble *v);
- void glTexCoord1d(GLdouble s);
- void glRectsv(const GLshort *v1, const GLshort *v2);
- void glRects(GLshort x1, GLshort y1, GLshort x2, GLshort y2);
- void glRectiv(const GLint *v1, const GLint *v2);
- void glRecti(GLint x1, GLint y1, GLint x2, GLint y2);
- void glRectfv(const GLfloat *v1, const GLfloat *v2);
- void glRectf(GLfloat x1, GLfloat y1, GLfloat x2, GLfloat y2);
- void glRectdv(const GLdouble *v1, const GLdouble *v2);
- void glRectd(GLdouble x1, GLdouble y1, GLdouble x2, GLdouble y2);
- void glRasterPos4sv(const GLshort *v);
- void glRasterPos4s(GLshort x, GLshort y, GLshort z, GLshort w);
- void glRasterPos4iv(const GLint *v);
- void glRasterPos4i(GLint x, GLint y, GLint z, GLint w);
- void glRasterPos4fv(const GLfloat *v);
- void glRasterPos4f(GLfloat x, GLfloat y, GLfloat z, GLfloat w);
- void glRasterPos4dv(const GLdouble *v);
- void glRasterPos4d(GLdouble x, GLdouble y, GLdouble z, GLdouble w);
- void glRasterPos3sv(const GLshort *v);
- void glRasterPos3s(GLshort x, GLshort y, GLshort z);
- void glRasterPos3iv(const GLint *v);
- void glRasterPos3i(GLint x, GLint y, GLint z);
- void glRasterPos3fv(const GLfloat *v);
- void glRasterPos3f(GLfloat x, GLfloat y, GLfloat z);
- void glRasterPos3dv(const GLdouble *v);
- void glRasterPos3d(GLdouble x, GLdouble y, GLdouble z);
- void glRasterPos2sv(const GLshort *v);
- void glRasterPos2s(GLshort x, GLshort y);
- void glRasterPos2iv(const GLint *v);
- void glRasterPos2i(GLint x, GLint y);
- void glRasterPos2fv(const GLfloat *v);
- void glRasterPos2f(GLfloat x, GLfloat y);
- void glRasterPos2dv(const GLdouble *v);
- void glRasterPos2d(GLdouble x, GLdouble y);
- void glNormal3sv(const GLshort *v);
- void glNormal3s(GLshort nx, GLshort ny, GLshort nz);
- void glNormal3iv(const GLint *v);
- void glNormal3i(GLint nx, GLint ny, GLint nz);
- void glNormal3fv(const GLfloat *v);
- void glNormal3f(GLfloat nx, GLfloat ny, GLfloat nz);
- void glNormal3dv(const GLdouble *v);
- void glNormal3d(GLdouble nx, GLdouble ny, GLdouble nz);
- void glNormal3bv(const GLbyte *v);
- void glNormal3b(GLbyte nx, GLbyte ny, GLbyte nz);
- void glIndexsv(const GLshort *c);
- void glIndexs(GLshort c);
- void glIndexiv(const GLint *c);
- void glIndexi(GLint c);
- void glIndexfv(const GLfloat *c);
- void glIndexf(GLfloat c);
- void glIndexdv(const GLdouble *c);
- void glIndexd(GLdouble c);
- void glEnd();
- void glEdgeFlagv(const GLboolean *flag);
- void glEdgeFlag(GLboolean flag);
- void glColor4usv(const GLushort *v);
- void glColor4us(GLushort red, GLushort green, GLushort blue, GLushort alpha);
- void glColor4uiv(const GLuint *v);
- void glColor4ui(GLuint red, GLuint green, GLuint blue, GLuint alpha);
- void glColor4ubv(const GLubyte *v);
- void glColor4ub(GLubyte red, GLubyte green, GLubyte blue, GLubyte alpha);
- void glColor4sv(const GLshort *v);
- void glColor4s(GLshort red, GLshort green, GLshort blue, GLshort alpha);
- void glColor4iv(const GLint *v);
- void glColor4i(GLint red, GLint green, GLint blue, GLint alpha);
- void glColor4fv(const GLfloat *v);
- void glColor4f(GLfloat red, GLfloat green, GLfloat blue, GLfloat alpha);
- void glColor4dv(const GLdouble *v);
- void glColor4d(GLdouble red, GLdouble green, GLdouble blue, GLdouble alpha);
- void glColor4bv(const GLbyte *v);
- void glColor4b(GLbyte red, GLbyte green, GLbyte blue, GLbyte alpha);
- void glColor3usv(const GLushort *v);
- void glColor3us(GLushort red, GLushort green, GLushort blue);
- void glColor3uiv(const GLuint *v);
- void glColor3ui(GLuint red, GLuint green, GLuint blue);
- void glColor3ubv(const GLubyte *v);
- void glColor3ub(GLubyte red, GLubyte green, GLubyte blue);
- void glColor3sv(const GLshort *v);
- void glColor3s(GLshort red, GLshort green, GLshort blue);
- void glColor3iv(const GLint *v);
- void glColor3i(GLint red, GLint green, GLint blue);
- void glColor3fv(const GLfloat *v);
- void glColor3f(GLfloat red, GLfloat green, GLfloat blue);
- void glColor3dv(const GLdouble *v);
- void glColor3d(GLdouble red, GLdouble green, GLdouble blue);
- void glColor3bv(const GLbyte *v);
- void glColor3b(GLbyte red, GLbyte green, GLbyte blue);
- void glBitmap(GLsizei width, GLsizei height, GLfloat xorig, GLfloat yorig, GLfloat xmove, GLfloat ymove, const GLubyte *bitmap);
- void glBegin(GLenum mode);
- void glListBase(GLuint base);
- GLuint glGenLists(GLsizei range);
- void glDeleteLists(GLuint list, GLsizei range);
- void glCallLists(GLsizei n, GLenum type, const GLvoid *lists);
- void glCallList(GLuint list);
- void glEndList();
- void glNewList(GLuint list, GLenum mode);
-
- // OpenGL 1.1 deprecated functions
- void glPushClientAttrib(GLbitfield mask);
- void glPopClientAttrib();
- void glPrioritizeTextures(GLsizei n, const GLuint *textures, const GLfloat *priorities);
- GLboolean glAreTexturesResident(GLsizei n, const GLuint *textures, GLboolean *residences);
- void glVertexPointer(GLint size, GLenum type, GLsizei stride, const GLvoid *pointer);
- void glTexCoordPointer(GLint size, GLenum type, GLsizei stride, const GLvoid *pointer);
- void glNormalPointer(GLenum type, GLsizei stride, const GLvoid *pointer);
- void glInterleavedArrays(GLenum format, GLsizei stride, const GLvoid *pointer);
- void glIndexPointer(GLenum type, GLsizei stride, const GLvoid *pointer);
- void glEnableClientState(GLenum array);
- void glEdgeFlagPointer(GLsizei stride, const GLvoid *pointer);
- void glDisableClientState(GLenum array);
- void glColorPointer(GLint size, GLenum type, GLsizei stride, const GLvoid *pointer);
- void glArrayElement(GLint i);
-
- // OpenGL 1.2 deprecated functions
- void glResetMinmax(GLenum target);
- void glResetHistogram(GLenum target);
- void glMinmax(GLenum target, GLenum internalformat, GLboolean sink);
- void glHistogram(GLenum target, GLsizei width, GLenum internalformat, GLboolean sink);
- void glGetMinmaxParameteriv(GLenum target, GLenum pname, GLint *params);
- void glGetMinmaxParameterfv(GLenum target, GLenum pname, GLfloat *params);
- void glGetMinmax(GLenum target, GLboolean reset, GLenum format, GLenum type, GLvoid *values);
- void glGetHistogramParameteriv(GLenum target, GLenum pname, GLint *params);
- void glGetHistogramParameterfv(GLenum target, GLenum pname, GLfloat *params);
- void glGetHistogram(GLenum target, GLboolean reset, GLenum format, GLenum type, GLvoid *values);
- void glSeparableFilter2D(GLenum target, GLenum internalformat, GLsizei width, GLsizei height, GLenum format, GLenum type, const GLvoid *row, const GLvoid *column);
- void glGetSeparableFilter(GLenum target, GLenum format, GLenum type, GLvoid *row, GLvoid *column, GLvoid *span);
- void glGetConvolutionParameteriv(GLenum target, GLenum pname, GLint *params);
- void glGetConvolutionParameterfv(GLenum target, GLenum pname, GLfloat *params);
- void glGetConvolutionFilter(GLenum target, GLenum format, GLenum type, GLvoid *image);
- void glCopyConvolutionFilter2D(GLenum target, GLenum internalformat, GLint x, GLint y, GLsizei width, GLsizei height);
- void glCopyConvolutionFilter1D(GLenum target, GLenum internalformat, GLint x, GLint y, GLsizei width);
- void glConvolutionParameteriv(GLenum target, GLenum pname, const GLint *params);
- void glConvolutionParameteri(GLenum target, GLenum pname, GLint params);
- void glConvolutionParameterfv(GLenum target, GLenum pname, const GLfloat *params);
- void glConvolutionParameterf(GLenum target, GLenum pname, GLfloat params);
- void glConvolutionFilter2D(GLenum target, GLenum internalformat, GLsizei width, GLsizei height, GLenum format, GLenum type, const GLvoid *image);
- void glConvolutionFilter1D(GLenum target, GLenum internalformat, GLsizei width, GLenum format, GLenum type, const GLvoid *image);
- void glCopyColorSubTable(GLenum target, GLsizei start, GLint x, GLint y, GLsizei width);
- void glColorSubTable(GLenum target, GLsizei start, GLsizei count, GLenum format, GLenum type, const GLvoid *data);
- void glGetColorTableParameteriv(GLenum target, GLenum pname, GLint *params);
- void glGetColorTableParameterfv(GLenum target, GLenum pname, GLfloat *params);
- void glGetColorTable(GLenum target, GLenum format, GLenum type, GLvoid *table);
- void glCopyColorTable(GLenum target, GLenum internalformat, GLint x, GLint y, GLsizei width);
- void glColorTableParameteriv(GLenum target, GLenum pname, const GLint *params);
- void glColorTableParameterfv(GLenum target, GLenum pname, const GLfloat *params);
- void glColorTable(GLenum target, GLenum internalformat, GLsizei width, GLenum format, GLenum type, const GLvoid *table);
-
- // OpenGL 1.3 deprecated functions
- void glMultTransposeMatrixd(const GLdouble *m);
- void glMultTransposeMatrixf(const GLfloat *m);
- void glLoadTransposeMatrixd(const GLdouble *m);
- void glLoadTransposeMatrixf(const GLfloat *m);
- void glMultiTexCoord4sv(GLenum target, const GLshort *v);
- void glMultiTexCoord4s(GLenum target, GLshort s, GLshort t, GLshort r, GLshort q);
- void glMultiTexCoord4iv(GLenum target, const GLint *v);
- void glMultiTexCoord4i(GLenum target, GLint s, GLint t, GLint r, GLint q);
- void glMultiTexCoord4fv(GLenum target, const GLfloat *v);
- void glMultiTexCoord4f(GLenum target, GLfloat s, GLfloat t, GLfloat r, GLfloat q);
- void glMultiTexCoord4dv(GLenum target, const GLdouble *v);
- void glMultiTexCoord4d(GLenum target, GLdouble s, GLdouble t, GLdouble r, GLdouble q);
- void glMultiTexCoord3sv(GLenum target, const GLshort *v);
- void glMultiTexCoord3s(GLenum target, GLshort s, GLshort t, GLshort r);
- void glMultiTexCoord3iv(GLenum target, const GLint *v);
- void glMultiTexCoord3i(GLenum target, GLint s, GLint t, GLint r);
- void glMultiTexCoord3fv(GLenum target, const GLfloat *v);
- void glMultiTexCoord3f(GLenum target, GLfloat s, GLfloat t, GLfloat r);
- void glMultiTexCoord3dv(GLenum target, const GLdouble *v);
- void glMultiTexCoord3d(GLenum target, GLdouble s, GLdouble t, GLdouble r);
- void glMultiTexCoord2sv(GLenum target, const GLshort *v);
- void glMultiTexCoord2s(GLenum target, GLshort s, GLshort t);
- void glMultiTexCoord2iv(GLenum target, const GLint *v);
- void glMultiTexCoord2i(GLenum target, GLint s, GLint t);
- void glMultiTexCoord2fv(GLenum target, const GLfloat *v);
- void glMultiTexCoord2f(GLenum target, GLfloat s, GLfloat t);
- void glMultiTexCoord2dv(GLenum target, const GLdouble *v);
- void glMultiTexCoord2d(GLenum target, GLdouble s, GLdouble t);
- void glMultiTexCoord1sv(GLenum target, const GLshort *v);
- void glMultiTexCoord1s(GLenum target, GLshort s);
- void glMultiTexCoord1iv(GLenum target, const GLint *v);
- void glMultiTexCoord1i(GLenum target, GLint s);
- void glMultiTexCoord1fv(GLenum target, const GLfloat *v);
- void glMultiTexCoord1f(GLenum target, GLfloat s);
- void glMultiTexCoord1dv(GLenum target, const GLdouble *v);
- void glMultiTexCoord1d(GLenum target, GLdouble s);
- void glClientActiveTexture(GLenum texture);
-
- // OpenGL 1.4 deprecated functions
- void glWindowPos3sv(const GLshort *v);
- void glWindowPos3s(GLshort x, GLshort y, GLshort z);
- void glWindowPos3iv(const GLint *v);
- void glWindowPos3i(GLint x, GLint y, GLint z);
- void glWindowPos3fv(const GLfloat *v);
- void glWindowPos3f(GLfloat x, GLfloat y, GLfloat z);
- void glWindowPos3dv(const GLdouble *v);
- void glWindowPos3d(GLdouble x, GLdouble y, GLdouble z);
- void glWindowPos2sv(const GLshort *v);
- void glWindowPos2s(GLshort x, GLshort y);
- void glWindowPos2iv(const GLint *v);
- void glWindowPos2i(GLint x, GLint y);
- void glWindowPos2fv(const GLfloat *v);
- void glWindowPos2f(GLfloat x, GLfloat y);
- void glWindowPos2dv(const GLdouble *v);
- void glWindowPos2d(GLdouble x, GLdouble y);
- void glSecondaryColorPointer(GLint size, GLenum type, GLsizei stride, const GLvoid *pointer);
- void glSecondaryColor3usv(const GLushort *v);
- void glSecondaryColor3us(GLushort red, GLushort green, GLushort blue);
- void glSecondaryColor3uiv(const GLuint *v);
- void glSecondaryColor3ui(GLuint red, GLuint green, GLuint blue);
- void glSecondaryColor3ubv(const GLubyte *v);
- void glSecondaryColor3ub(GLubyte red, GLubyte green, GLubyte blue);
- void glSecondaryColor3sv(const GLshort *v);
- void glSecondaryColor3s(GLshort red, GLshort green, GLshort blue);
- void glSecondaryColor3iv(const GLint *v);
- void glSecondaryColor3i(GLint red, GLint green, GLint blue);
- void glSecondaryColor3fv(const GLfloat *v);
- void glSecondaryColor3f(GLfloat red, GLfloat green, GLfloat blue);
- void glSecondaryColor3dv(const GLdouble *v);
- void glSecondaryColor3d(GLdouble red, GLdouble green, GLdouble blue);
- void glSecondaryColor3bv(const GLbyte *v);
- void glSecondaryColor3b(GLbyte red, GLbyte green, GLbyte blue);
- void glFogCoordPointer(GLenum type, GLsizei stride, const GLvoid *pointer);
- void glFogCoorddv(const GLdouble *coord);
- void glFogCoordd(GLdouble coord);
- void glFogCoordfv(const GLfloat *coord);
- void glFogCoordf(GLfloat coord);
-
- // OpenGL 1.5 deprecated functions
-
- // OpenGL 2.0 deprecated functions
- void glVertexAttrib4usv(GLuint index, const GLushort *v);
- void glVertexAttrib4uiv(GLuint index, const GLuint *v);
- void glVertexAttrib4ubv(GLuint index, const GLubyte *v);
- void glVertexAttrib4sv(GLuint index, const GLshort *v);
- void glVertexAttrib4s(GLuint index, GLshort x, GLshort y, GLshort z, GLshort w);
- void glVertexAttrib4iv(GLuint index, const GLint *v);
- void glVertexAttrib4fv(GLuint index, const GLfloat *v);
- void glVertexAttrib4f(GLuint index, GLfloat x, GLfloat y, GLfloat z, GLfloat w);
- void glVertexAttrib4dv(GLuint index, const GLdouble *v);
- void glVertexAttrib4d(GLuint index, GLdouble x, GLdouble y, GLdouble z, GLdouble w);
- void glVertexAttrib4bv(GLuint index, const GLbyte *v);
- void glVertexAttrib4Nusv(GLuint index, const GLushort *v);
- void glVertexAttrib4Nuiv(GLuint index, const GLuint *v);
- void glVertexAttrib4Nubv(GLuint index, const GLubyte *v);
- void glVertexAttrib4Nub(GLuint index, GLubyte x, GLubyte y, GLubyte z, GLubyte w);
- void glVertexAttrib4Nsv(GLuint index, const GLshort *v);
- void glVertexAttrib4Niv(GLuint index, const GLint *v);
- void glVertexAttrib4Nbv(GLuint index, const GLbyte *v);
- void glVertexAttrib3sv(GLuint index, const GLshort *v);
- void glVertexAttrib3s(GLuint index, GLshort x, GLshort y, GLshort z);
- void glVertexAttrib3fv(GLuint index, const GLfloat *v);
- void glVertexAttrib3f(GLuint index, GLfloat x, GLfloat y, GLfloat z);
- void glVertexAttrib3dv(GLuint index, const GLdouble *v);
- void glVertexAttrib3d(GLuint index, GLdouble x, GLdouble y, GLdouble z);
- void glVertexAttrib2sv(GLuint index, const GLshort *v);
- void glVertexAttrib2s(GLuint index, GLshort x, GLshort y);
- void glVertexAttrib2fv(GLuint index, const GLfloat *v);
- void glVertexAttrib2f(GLuint index, GLfloat x, GLfloat y);
- void glVertexAttrib2dv(GLuint index, const GLdouble *v);
- void glVertexAttrib2d(GLuint index, GLdouble x, GLdouble y);
- void glVertexAttrib1sv(GLuint index, const GLshort *v);
- void glVertexAttrib1s(GLuint index, GLshort x);
- void glVertexAttrib1fv(GLuint index, const GLfloat *v);
- void glVertexAttrib1f(GLuint index, GLfloat x);
- void glVertexAttrib1dv(GLuint index, const GLdouble *v);
- void glVertexAttrib1d(GLuint index, GLdouble x);
-
- // OpenGL 2.1 deprecated functions
-
-private:
- friend class QOpenGLContext;
-
- static bool isContextCompatible(QOpenGLContext *context);
- static QOpenGLVersionProfile versionProfile();
-
- QOpenGLFunctions_1_0_CoreBackend* d_1_0_Core;
- QOpenGLFunctions_1_1_CoreBackend* d_1_1_Core;
- QOpenGLFunctions_1_2_CoreBackend* d_1_2_Core;
- QOpenGLFunctions_1_3_CoreBackend* d_1_3_Core;
- QOpenGLFunctions_1_4_CoreBackend* d_1_4_Core;
- QOpenGLFunctions_1_5_CoreBackend* d_1_5_Core;
- QOpenGLFunctions_2_0_CoreBackend* d_2_0_Core;
- QOpenGLFunctions_2_1_CoreBackend* d_2_1_Core;
- QOpenGLFunctions_1_0_DeprecatedBackend* d_1_0_Deprecated;
- QOpenGLFunctions_1_1_DeprecatedBackend* d_1_1_Deprecated;
- QOpenGLFunctions_1_2_DeprecatedBackend* d_1_2_Deprecated;
- QOpenGLFunctions_1_3_DeprecatedBackend* d_1_3_Deprecated;
- QOpenGLFunctions_1_4_DeprecatedBackend* d_1_4_Deprecated;
- void *m_reserved_2_0_Deprecated; // To maintain BC
-};
-
-// OpenGL 1.0 core functions
-inline void QOpenGLFunctions_2_1::glViewport(GLint x, GLint y, GLsizei width, GLsizei height)
-{
- d_1_0_Core->f.Viewport(x, y, width, height);
-}
-
-inline void QOpenGLFunctions_2_1::glDepthRange(GLdouble nearVal, GLdouble farVal)
-{
- d_1_0_Core->f.DepthRange(nearVal, farVal);
-}
-
-inline GLboolean QOpenGLFunctions_2_1::glIsEnabled(GLenum cap)
-{
- return d_1_0_Core->f.IsEnabled(cap);
-}
-
-inline void QOpenGLFunctions_2_1::glGetTexLevelParameteriv(GLenum target, GLint level, GLenum pname, GLint *params)
-{
- d_1_0_Core->f.GetTexLevelParameteriv(target, level, pname, params);
-}
-
-inline void QOpenGLFunctions_2_1::glGetTexLevelParameterfv(GLenum target, GLint level, GLenum pname, GLfloat *params)
-{
- d_1_0_Core->f.GetTexLevelParameterfv(target, level, pname, params);
-}
-
-inline void QOpenGLFunctions_2_1::glGetTexParameteriv(GLenum target, GLenum pname, GLint *params)
-{
- d_1_0_Core->f.GetTexParameteriv(target, pname, params);
-}
-
-inline void QOpenGLFunctions_2_1::glGetTexParameterfv(GLenum target, GLenum pname, GLfloat *params)
-{
- d_1_0_Core->f.GetTexParameterfv(target, pname, params);
-}
-
-inline void QOpenGLFunctions_2_1::glGetTexImage(GLenum target, GLint level, GLenum format, GLenum type, GLvoid *pixels)
-{
- d_1_0_Core->f.GetTexImage(target, level, format, type, pixels);
-}
-
-inline const GLubyte * QOpenGLFunctions_2_1::glGetString(GLenum name)
-{
- return d_1_0_Core->f.GetString(name);
-}
-
-inline void QOpenGLFunctions_2_1::glGetIntegerv(GLenum pname, GLint *params)
-{
- d_1_0_Core->f.GetIntegerv(pname, params);
-}
-
-inline void QOpenGLFunctions_2_1::glGetFloatv(GLenum pname, GLfloat *params)
-{
- d_1_0_Core->f.GetFloatv(pname, params);
-}
-
-inline GLenum QOpenGLFunctions_2_1::glGetError()
-{
- return d_1_0_Core->f.GetError();
-}
-
-inline void QOpenGLFunctions_2_1::glGetDoublev(GLenum pname, GLdouble *params)
-{
- d_1_0_Core->f.GetDoublev(pname, params);
-}
-
-inline void QOpenGLFunctions_2_1::glGetBooleanv(GLenum pname, GLboolean *params)
-{
- d_1_0_Core->f.GetBooleanv(pname, params);
-}
-
-inline void QOpenGLFunctions_2_1::glReadPixels(GLint x, GLint y, GLsizei width, GLsizei height, GLenum format, GLenum type, GLvoid *pixels)
-{
- d_1_0_Core->f.ReadPixels(x, y, width, height, format, type, pixels);
-}
-
-inline void QOpenGLFunctions_2_1::glReadBuffer(GLenum mode)
-{
- d_1_0_Core->f.ReadBuffer(mode);
-}
-
-inline void QOpenGLFunctions_2_1::glPixelStorei(GLenum pname, GLint param)
-{
- d_1_0_Core->f.PixelStorei(pname, param);
-}
-
-inline void QOpenGLFunctions_2_1::glPixelStoref(GLenum pname, GLfloat param)
-{
- d_1_0_Core->f.PixelStoref(pname, param);
-}
-
-inline void QOpenGLFunctions_2_1::glDepthFunc(GLenum func)
-{
- d_1_0_Core->f.DepthFunc(func);
-}
-
-inline void QOpenGLFunctions_2_1::glStencilOp(GLenum fail, GLenum zfail, GLenum zpass)
-{
- d_1_0_Core->f.StencilOp(fail, zfail, zpass);
-}
-
-inline void QOpenGLFunctions_2_1::glStencilFunc(GLenum func, GLint ref, GLuint mask)
-{
- d_1_0_Core->f.StencilFunc(func, ref, mask);
-}
-
-inline void QOpenGLFunctions_2_1::glLogicOp(GLenum opcode)
-{
- d_1_0_Core->f.LogicOp(opcode);
-}
-
-inline void QOpenGLFunctions_2_1::glBlendFunc(GLenum sfactor, GLenum dfactor)
-{
- d_1_0_Core->f.BlendFunc(sfactor, dfactor);
-}
-
-inline void QOpenGLFunctions_2_1::glFlush()
-{
- d_1_0_Core->f.Flush();
-}
-
-inline void QOpenGLFunctions_2_1::glFinish()
-{
- d_1_0_Core->f.Finish();
-}
-
-inline void QOpenGLFunctions_2_1::glEnable(GLenum cap)
-{
- d_1_0_Core->f.Enable(cap);
-}
-
-inline void QOpenGLFunctions_2_1::glDisable(GLenum cap)
-{
- d_1_0_Core->f.Disable(cap);
-}
-
-inline void QOpenGLFunctions_2_1::glDepthMask(GLboolean flag)
-{
- d_1_0_Core->f.DepthMask(flag);
-}
-
-inline void QOpenGLFunctions_2_1::glColorMask(GLboolean red, GLboolean green, GLboolean blue, GLboolean alpha)
-{
- d_1_0_Core->f.ColorMask(red, green, blue, alpha);
-}
-
-inline void QOpenGLFunctions_2_1::glStencilMask(GLuint mask)
-{
- d_1_0_Core->f.StencilMask(mask);
-}
-
-inline void QOpenGLFunctions_2_1::glClearDepth(GLdouble depth)
-{
- d_1_0_Core->f.ClearDepth(depth);
-}
-
-inline void QOpenGLFunctions_2_1::glClearStencil(GLint s)
-{
- d_1_0_Core->f.ClearStencil(s);
-}
-
-inline void QOpenGLFunctions_2_1::glClearColor(GLfloat red, GLfloat green, GLfloat blue, GLfloat alpha)
-{
- d_1_0_Core->f.ClearColor(red, green, blue, alpha);
-}
-
-inline void QOpenGLFunctions_2_1::glClear(GLbitfield mask)
-{
- d_1_0_Core->f.Clear(mask);
-}
-
-inline void QOpenGLFunctions_2_1::glDrawBuffer(GLenum mode)
-{
- d_1_0_Core->f.DrawBuffer(mode);
-}
-
-inline void QOpenGLFunctions_2_1::glTexImage2D(GLenum target, GLint level, GLint internalformat, GLsizei width, GLsizei height, GLint border, GLenum format, GLenum type, const GLvoid *pixels)
-{
- d_1_0_Core->f.TexImage2D(target, level, internalformat, width, height, border, format, type, pixels);
-}
-
-inline void QOpenGLFunctions_2_1::glTexImage1D(GLenum target, GLint level, GLint internalformat, GLsizei width, GLint border, GLenum format, GLenum type, const GLvoid *pixels)
-{
- d_1_0_Core->f.TexImage1D(target, level, internalformat, width, border, format, type, pixels);
-}
-
-inline void QOpenGLFunctions_2_1::glTexParameteriv(GLenum target, GLenum pname, const GLint *params)
-{
- d_1_0_Core->f.TexParameteriv(target, pname, params);
-}
-
-inline void QOpenGLFunctions_2_1::glTexParameteri(GLenum target, GLenum pname, GLint param)
-{
- d_1_0_Core->f.TexParameteri(target, pname, param);
-}
-
-inline void QOpenGLFunctions_2_1::glTexParameterfv(GLenum target, GLenum pname, const GLfloat *params)
-{
- d_1_0_Core->f.TexParameterfv(target, pname, params);
-}
-
-inline void QOpenGLFunctions_2_1::glTexParameterf(GLenum target, GLenum pname, GLfloat param)
-{
- d_1_0_Core->f.TexParameterf(target, pname, param);
-}
-
-inline void QOpenGLFunctions_2_1::glScissor(GLint x, GLint y, GLsizei width, GLsizei height)
-{
- d_1_0_Core->f.Scissor(x, y, width, height);
-}
-
-inline void QOpenGLFunctions_2_1::glPolygonMode(GLenum face, GLenum mode)
-{
- d_1_0_Core->f.PolygonMode(face, mode);
-}
-
-inline void QOpenGLFunctions_2_1::glPointSize(GLfloat size)
-{
- d_1_0_Core->f.PointSize(size);
-}
-
-inline void QOpenGLFunctions_2_1::glLineWidth(GLfloat width)
-{
- d_1_0_Core->f.LineWidth(width);
-}
-
-inline void QOpenGLFunctions_2_1::glHint(GLenum target, GLenum mode)
-{
- d_1_0_Core->f.Hint(target, mode);
-}
-
-inline void QOpenGLFunctions_2_1::glFrontFace(GLenum mode)
-{
- d_1_0_Core->f.FrontFace(mode);
-}
-
-inline void QOpenGLFunctions_2_1::glCullFace(GLenum mode)
-{
- d_1_0_Core->f.CullFace(mode);
-}
-
-
-// OpenGL 1.1 core functions
-inline void QOpenGLFunctions_2_1::glIndexubv(const GLubyte *c)
-{
- d_1_1_Deprecated->f.Indexubv(c);
-}
-
-inline void QOpenGLFunctions_2_1::glIndexub(GLubyte c)
-{
- d_1_1_Deprecated->f.Indexub(c);
-}
-
-inline GLboolean QOpenGLFunctions_2_1::glIsTexture(GLuint texture)
-{
- return d_1_1_Core->f.IsTexture(texture);
-}
-
-inline void QOpenGLFunctions_2_1::glGenTextures(GLsizei n, GLuint *textures)
-{
- d_1_1_Core->f.GenTextures(n, textures);
-}
-
-inline void QOpenGLFunctions_2_1::glDeleteTextures(GLsizei n, const GLuint *textures)
-{
- d_1_1_Core->f.DeleteTextures(n, textures);
-}
-
-inline void QOpenGLFunctions_2_1::glBindTexture(GLenum target, GLuint texture)
-{
- d_1_1_Core->f.BindTexture(target, texture);
-}
-
-inline void QOpenGLFunctions_2_1::glTexSubImage2D(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLenum type, const GLvoid *pixels)
-{
- d_1_1_Core->f.TexSubImage2D(target, level, xoffset, yoffset, width, height, format, type, pixels);
-}
-
-inline void QOpenGLFunctions_2_1::glTexSubImage1D(GLenum target, GLint level, GLint xoffset, GLsizei width, GLenum format, GLenum type, const GLvoid *pixels)
-{
- d_1_1_Core->f.TexSubImage1D(target, level, xoffset, width, format, type, pixels);
-}
-
-inline void QOpenGLFunctions_2_1::glCopyTexSubImage2D(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint x, GLint y, GLsizei width, GLsizei height)
-{
- d_1_1_Core->f.CopyTexSubImage2D(target, level, xoffset, yoffset, x, y, width, height);
-}
-
-inline void QOpenGLFunctions_2_1::glCopyTexSubImage1D(GLenum target, GLint level, GLint xoffset, GLint x, GLint y, GLsizei width)
-{
- d_1_1_Core->f.CopyTexSubImage1D(target, level, xoffset, x, y, width);
-}
-
-inline void QOpenGLFunctions_2_1::glCopyTexImage2D(GLenum target, GLint level, GLenum internalformat, GLint x, GLint y, GLsizei width, GLsizei height, GLint border)
-{
- d_1_1_Core->f.CopyTexImage2D(target, level, internalformat, x, y, width, height, border);
-}
-
-inline void QOpenGLFunctions_2_1::glCopyTexImage1D(GLenum target, GLint level, GLenum internalformat, GLint x, GLint y, GLsizei width, GLint border)
-{
- d_1_1_Core->f.CopyTexImage1D(target, level, internalformat, x, y, width, border);
-}
-
-inline void QOpenGLFunctions_2_1::glPolygonOffset(GLfloat factor, GLfloat units)
-{
- d_1_1_Core->f.PolygonOffset(factor, units);
-}
-
-inline void QOpenGLFunctions_2_1::glGetPointerv(GLenum pname, GLvoid* *params)
-{
- d_1_1_Deprecated->f.GetPointerv(pname, params);
-}
-
-inline void QOpenGLFunctions_2_1::glDrawElements(GLenum mode, GLsizei count, GLenum type, const GLvoid *indices)
-{
- d_1_1_Core->f.DrawElements(mode, count, type, indices);
-}
-
-inline void QOpenGLFunctions_2_1::glDrawArrays(GLenum mode, GLint first, GLsizei count)
-{
- d_1_1_Core->f.DrawArrays(mode, first, count);
-}
-
-
-// OpenGL 1.2 core functions
-inline void QOpenGLFunctions_2_1::glCopyTexSubImage3D(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLint x, GLint y, GLsizei width, GLsizei height)
-{
- d_1_2_Core->f.CopyTexSubImage3D(target, level, xoffset, yoffset, zoffset, x, y, width, height);
-}
-
-inline void QOpenGLFunctions_2_1::glTexSubImage3D(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLenum type, const GLvoid *pixels)
-{
- d_1_2_Core->f.TexSubImage3D(target, level, xoffset, yoffset, zoffset, width, height, depth, format, type, pixels);
-}
-
-inline void QOpenGLFunctions_2_1::glTexImage3D(GLenum target, GLint level, GLint internalformat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLenum format, GLenum type, const GLvoid *pixels)
-{
- d_1_2_Core->f.TexImage3D(target, level, internalformat, width, height, depth, border, format, type, pixels);
-}
-
-inline void QOpenGLFunctions_2_1::glDrawRangeElements(GLenum mode, GLuint start, GLuint end, GLsizei count, GLenum type, const GLvoid *indices)
-{
- d_1_2_Core->f.DrawRangeElements(mode, start, end, count, type, indices);
-}
-
-inline void QOpenGLFunctions_2_1::glBlendEquation(GLenum mode)
-{
- d_1_2_Core->f.BlendEquation(mode);
-}
-
-inline void QOpenGLFunctions_2_1::glBlendColor(GLfloat red, GLfloat green, GLfloat blue, GLfloat alpha)
-{
- d_1_2_Core->f.BlendColor(red, green, blue, alpha);
-}
-
-
-// OpenGL 1.3 core functions
-inline void QOpenGLFunctions_2_1::glGetCompressedTexImage(GLenum target, GLint level, GLvoid *img)
-{
- d_1_3_Core->f.GetCompressedTexImage(target, level, img);
-}
-
-inline void QOpenGLFunctions_2_1::glCompressedTexSubImage1D(GLenum target, GLint level, GLint xoffset, GLsizei width, GLenum format, GLsizei imageSize, const GLvoid *data)
-{
- d_1_3_Core->f.CompressedTexSubImage1D(target, level, xoffset, width, format, imageSize, data);
-}
-
-inline void QOpenGLFunctions_2_1::glCompressedTexSubImage2D(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLsizei imageSize, const GLvoid *data)
-{
- d_1_3_Core->f.CompressedTexSubImage2D(target, level, xoffset, yoffset, width, height, format, imageSize, data);
-}
-
-inline void QOpenGLFunctions_2_1::glCompressedTexSubImage3D(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLsizei imageSize, const GLvoid *data)
-{
- d_1_3_Core->f.CompressedTexSubImage3D(target, level, xoffset, yoffset, zoffset, width, height, depth, format, imageSize, data);
-}
-
-inline void QOpenGLFunctions_2_1::glCompressedTexImage1D(GLenum target, GLint level, GLenum internalformat, GLsizei width, GLint border, GLsizei imageSize, const GLvoid *data)
-{
- d_1_3_Core->f.CompressedTexImage1D(target, level, internalformat, width, border, imageSize, data);
-}
-
-inline void QOpenGLFunctions_2_1::glCompressedTexImage2D(GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLint border, GLsizei imageSize, const GLvoid *data)
-{
- d_1_3_Core->f.CompressedTexImage2D(target, level, internalformat, width, height, border, imageSize, data);
-}
-
-inline void QOpenGLFunctions_2_1::glCompressedTexImage3D(GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLsizei imageSize, const GLvoid *data)
-{
- d_1_3_Core->f.CompressedTexImage3D(target, level, internalformat, width, height, depth, border, imageSize, data);
-}
-
-inline void QOpenGLFunctions_2_1::glSampleCoverage(GLfloat value, GLboolean invert)
-{
- d_1_3_Core->f.SampleCoverage(value, invert);
-}
-
-inline void QOpenGLFunctions_2_1::glActiveTexture(GLenum texture)
-{
- d_1_3_Core->f.ActiveTexture(texture);
-}
-
-
-// OpenGL 1.4 core functions
-inline void QOpenGLFunctions_2_1::glPointParameteriv(GLenum pname, const GLint *params)
-{
- d_1_4_Core->f.PointParameteriv(pname, params);
-}
-
-inline void QOpenGLFunctions_2_1::glPointParameteri(GLenum pname, GLint param)
-{
- d_1_4_Core->f.PointParameteri(pname, param);
-}
-
-inline void QOpenGLFunctions_2_1::glPointParameterfv(GLenum pname, const GLfloat *params)
-{
- d_1_4_Core->f.PointParameterfv(pname, params);
-}
-
-inline void QOpenGLFunctions_2_1::glPointParameterf(GLenum pname, GLfloat param)
-{
- d_1_4_Core->f.PointParameterf(pname, param);
-}
-
-inline void QOpenGLFunctions_2_1::glMultiDrawElements(GLenum mode, const GLsizei *count, GLenum type, const GLvoid* const *indices, GLsizei drawcount)
-{
- d_1_4_Core->f.MultiDrawElements(mode, count, type, indices, drawcount);
-}
-
-inline void QOpenGLFunctions_2_1::glMultiDrawArrays(GLenum mode, const GLint *first, const GLsizei *count, GLsizei drawcount)
-{
- d_1_4_Core->f.MultiDrawArrays(mode, first, count, drawcount);
-}
-
-inline void QOpenGLFunctions_2_1::glBlendFuncSeparate(GLenum sfactorRGB, GLenum dfactorRGB, GLenum sfactorAlpha, GLenum dfactorAlpha)
-{
- d_1_4_Core->f.BlendFuncSeparate(sfactorRGB, dfactorRGB, sfactorAlpha, dfactorAlpha);
-}
-
-
-// OpenGL 1.5 core functions
-inline void QOpenGLFunctions_2_1::glGetBufferPointerv(GLenum target, GLenum pname, GLvoid* *params)
-{
- d_1_5_Core->f.GetBufferPointerv(target, pname, params);
-}
-
-inline void QOpenGLFunctions_2_1::glGetBufferParameteriv(GLenum target, GLenum pname, GLint *params)
-{
- d_1_5_Core->f.GetBufferParameteriv(target, pname, params);
-}
-
-inline GLboolean QOpenGLFunctions_2_1::glUnmapBuffer(GLenum target)
-{
- return d_1_5_Core->f.UnmapBuffer(target);
-}
-
-inline GLvoid* QOpenGLFunctions_2_1::glMapBuffer(GLenum target, GLenum access)
-{
- return d_1_5_Core->f.MapBuffer(target, access);
-}
-
-inline void QOpenGLFunctions_2_1::glGetBufferSubData(GLenum target, GLintptr offset, GLsizeiptr size, GLvoid *data)
-{
- d_1_5_Core->f.GetBufferSubData(target, offset, size, data);
-}
-
-inline void QOpenGLFunctions_2_1::glBufferSubData(GLenum target, GLintptr offset, GLsizeiptr size, const GLvoid *data)
-{
- d_1_5_Core->f.BufferSubData(target, offset, size, data);
-}
-
-inline void QOpenGLFunctions_2_1::glBufferData(GLenum target, GLsizeiptr size, const GLvoid *data, GLenum usage)
-{
- d_1_5_Core->f.BufferData(target, size, data, usage);
-}
-
-inline GLboolean QOpenGLFunctions_2_1::glIsBuffer(GLuint buffer)
-{
- return d_1_5_Core->f.IsBuffer(buffer);
-}
-
-inline void QOpenGLFunctions_2_1::glGenBuffers(GLsizei n, GLuint *buffers)
-{
- d_1_5_Core->f.GenBuffers(n, buffers);
-}
-
-inline void QOpenGLFunctions_2_1::glDeleteBuffers(GLsizei n, const GLuint *buffers)
-{
- d_1_5_Core->f.DeleteBuffers(n, buffers);
-}
-
-inline void QOpenGLFunctions_2_1::glBindBuffer(GLenum target, GLuint buffer)
-{
- d_1_5_Core->f.BindBuffer(target, buffer);
-}
-
-inline void QOpenGLFunctions_2_1::glGetQueryObjectuiv(GLuint id, GLenum pname, GLuint *params)
-{
- d_1_5_Core->f.GetQueryObjectuiv(id, pname, params);
-}
-
-inline void QOpenGLFunctions_2_1::glGetQueryObjectiv(GLuint id, GLenum pname, GLint *params)
-{
- d_1_5_Core->f.GetQueryObjectiv(id, pname, params);
-}
-
-inline void QOpenGLFunctions_2_1::glGetQueryiv(GLenum target, GLenum pname, GLint *params)
-{
- d_1_5_Core->f.GetQueryiv(target, pname, params);
-}
-
-inline void QOpenGLFunctions_2_1::glEndQuery(GLenum target)
-{
- d_1_5_Core->f.EndQuery(target);
-}
-
-inline void QOpenGLFunctions_2_1::glBeginQuery(GLenum target, GLuint id)
-{
- d_1_5_Core->f.BeginQuery(target, id);
-}
-
-inline GLboolean QOpenGLFunctions_2_1::glIsQuery(GLuint id)
-{
- return d_1_5_Core->f.IsQuery(id);
-}
-
-inline void QOpenGLFunctions_2_1::glDeleteQueries(GLsizei n, const GLuint *ids)
-{
- d_1_5_Core->f.DeleteQueries(n, ids);
-}
-
-inline void QOpenGLFunctions_2_1::glGenQueries(GLsizei n, GLuint *ids)
-{
- d_1_5_Core->f.GenQueries(n, ids);
-}
-
-
-// OpenGL 2.0 core functions
-inline void QOpenGLFunctions_2_1::glVertexAttribPointer(GLuint index, GLint size, GLenum type, GLboolean normalized, GLsizei stride, const GLvoid *pointer)
-{
- d_2_0_Core->f.VertexAttribPointer(index, size, type, normalized, stride, pointer);
-}
-
-inline void QOpenGLFunctions_2_1::glValidateProgram(GLuint program)
-{
- d_2_0_Core->f.ValidateProgram(program);
-}
-
-inline void QOpenGLFunctions_2_1::glUniformMatrix4fv(GLint location, GLsizei count, GLboolean transpose, const GLfloat *value)
-{
- d_2_0_Core->f.UniformMatrix4fv(location, count, transpose, value);
-}
-
-inline void QOpenGLFunctions_2_1::glUniformMatrix3fv(GLint location, GLsizei count, GLboolean transpose, const GLfloat *value)
-{
- d_2_0_Core->f.UniformMatrix3fv(location, count, transpose, value);
-}
-
-inline void QOpenGLFunctions_2_1::glUniformMatrix2fv(GLint location, GLsizei count, GLboolean transpose, const GLfloat *value)
-{
- d_2_0_Core->f.UniformMatrix2fv(location, count, transpose, value);
-}
-
-inline void QOpenGLFunctions_2_1::glUniform4iv(GLint location, GLsizei count, const GLint *value)
-{
- d_2_0_Core->f.Uniform4iv(location, count, value);
-}
-
-inline void QOpenGLFunctions_2_1::glUniform3iv(GLint location, GLsizei count, const GLint *value)
-{
- d_2_0_Core->f.Uniform3iv(location, count, value);
-}
-
-inline void QOpenGLFunctions_2_1::glUniform2iv(GLint location, GLsizei count, const GLint *value)
-{
- d_2_0_Core->f.Uniform2iv(location, count, value);
-}
-
-inline void QOpenGLFunctions_2_1::glUniform1iv(GLint location, GLsizei count, const GLint *value)
-{
- d_2_0_Core->f.Uniform1iv(location, count, value);
-}
-
-inline void QOpenGLFunctions_2_1::glUniform4fv(GLint location, GLsizei count, const GLfloat *value)
-{
- d_2_0_Core->f.Uniform4fv(location, count, value);
-}
-
-inline void QOpenGLFunctions_2_1::glUniform3fv(GLint location, GLsizei count, const GLfloat *value)
-{
- d_2_0_Core->f.Uniform3fv(location, count, value);
-}
-
-inline void QOpenGLFunctions_2_1::glUniform2fv(GLint location, GLsizei count, const GLfloat *value)
-{
- d_2_0_Core->f.Uniform2fv(location, count, value);
-}
-
-inline void QOpenGLFunctions_2_1::glUniform1fv(GLint location, GLsizei count, const GLfloat *value)
-{
- d_2_0_Core->f.Uniform1fv(location, count, value);
-}
-
-inline void QOpenGLFunctions_2_1::glUniform4i(GLint location, GLint v0, GLint v1, GLint v2, GLint v3)
-{
- d_2_0_Core->f.Uniform4i(location, v0, v1, v2, v3);
-}
-
-inline void QOpenGLFunctions_2_1::glUniform3i(GLint location, GLint v0, GLint v1, GLint v2)
-{
- d_2_0_Core->f.Uniform3i(location, v0, v1, v2);
-}
-
-inline void QOpenGLFunctions_2_1::glUniform2i(GLint location, GLint v0, GLint v1)
-{
- d_2_0_Core->f.Uniform2i(location, v0, v1);
-}
-
-inline void QOpenGLFunctions_2_1::glUniform1i(GLint location, GLint v0)
-{
- d_2_0_Core->f.Uniform1i(location, v0);
-}
-
-inline void QOpenGLFunctions_2_1::glUniform4f(GLint location, GLfloat v0, GLfloat v1, GLfloat v2, GLfloat v3)
-{
- d_2_0_Core->f.Uniform4f(location, v0, v1, v2, v3);
-}
-
-inline void QOpenGLFunctions_2_1::glUniform3f(GLint location, GLfloat v0, GLfloat v1, GLfloat v2)
-{
- d_2_0_Core->f.Uniform3f(location, v0, v1, v2);
-}
-
-inline void QOpenGLFunctions_2_1::glUniform2f(GLint location, GLfloat v0, GLfloat v1)
-{
- d_2_0_Core->f.Uniform2f(location, v0, v1);
-}
-
-inline void QOpenGLFunctions_2_1::glUniform1f(GLint location, GLfloat v0)
-{
- d_2_0_Core->f.Uniform1f(location, v0);
-}
-
-inline void QOpenGLFunctions_2_1::glUseProgram(GLuint program)
-{
- d_2_0_Core->f.UseProgram(program);
-}
-
-inline void QOpenGLFunctions_2_1::glShaderSource(GLuint shader, GLsizei count, const GLchar* const *string, const GLint *length)
-{
- d_2_0_Core->f.ShaderSource(shader, count, string, length);
-}
-
-inline void QOpenGLFunctions_2_1::glLinkProgram(GLuint program)
-{
- d_2_0_Core->f.LinkProgram(program);
-}
-
-inline GLboolean QOpenGLFunctions_2_1::glIsShader(GLuint shader)
-{
- return d_2_0_Core->f.IsShader(shader);
-}
-
-inline GLboolean QOpenGLFunctions_2_1::glIsProgram(GLuint program)
-{
- return d_2_0_Core->f.IsProgram(program);
-}
-
-inline void QOpenGLFunctions_2_1::glGetVertexAttribPointerv(GLuint index, GLenum pname, GLvoid* *pointer)
-{
- d_2_0_Core->f.GetVertexAttribPointerv(index, pname, pointer);
-}
-
-inline void QOpenGLFunctions_2_1::glGetVertexAttribiv(GLuint index, GLenum pname, GLint *params)
-{
- d_2_0_Core->f.GetVertexAttribiv(index, pname, params);
-}
-
-inline void QOpenGLFunctions_2_1::glGetVertexAttribfv(GLuint index, GLenum pname, GLfloat *params)
-{
- d_2_0_Core->f.GetVertexAttribfv(index, pname, params);
-}
-
-inline void QOpenGLFunctions_2_1::glGetVertexAttribdv(GLuint index, GLenum pname, GLdouble *params)
-{
- d_2_0_Core->f.GetVertexAttribdv(index, pname, params);
-}
-
-inline void QOpenGLFunctions_2_1::glGetUniformiv(GLuint program, GLint location, GLint *params)
-{
- d_2_0_Core->f.GetUniformiv(program, location, params);
-}
-
-inline void QOpenGLFunctions_2_1::glGetUniformfv(GLuint program, GLint location, GLfloat *params)
-{
- d_2_0_Core->f.GetUniformfv(program, location, params);
-}
-
-inline GLint QOpenGLFunctions_2_1::glGetUniformLocation(GLuint program, const GLchar *name)
-{
- return d_2_0_Core->f.GetUniformLocation(program, name);
-}
-
-inline void QOpenGLFunctions_2_1::glGetShaderSource(GLuint shader, GLsizei bufSize, GLsizei *length, GLchar *source)
-{
- d_2_0_Core->f.GetShaderSource(shader, bufSize, length, source);
-}
-
-inline void QOpenGLFunctions_2_1::glGetShaderInfoLog(GLuint shader, GLsizei bufSize, GLsizei *length, GLchar *infoLog)
-{
- d_2_0_Core->f.GetShaderInfoLog(shader, bufSize, length, infoLog);
-}
-
-inline void QOpenGLFunctions_2_1::glGetShaderiv(GLuint shader, GLenum pname, GLint *params)
-{
- d_2_0_Core->f.GetShaderiv(shader, pname, params);
-}
-
-inline void QOpenGLFunctions_2_1::glGetProgramInfoLog(GLuint program, GLsizei bufSize, GLsizei *length, GLchar *infoLog)
-{
- d_2_0_Core->f.GetProgramInfoLog(program, bufSize, length, infoLog);
-}
-
-inline void QOpenGLFunctions_2_1::glGetProgramiv(GLuint program, GLenum pname, GLint *params)
-{
- d_2_0_Core->f.GetProgramiv(program, pname, params);
-}
-
-inline GLint QOpenGLFunctions_2_1::glGetAttribLocation(GLuint program, const GLchar *name)
-{
- return d_2_0_Core->f.GetAttribLocation(program, name);
-}
-
-inline void QOpenGLFunctions_2_1::glGetAttachedShaders(GLuint program, GLsizei maxCount, GLsizei *count, GLuint *obj)
-{
- d_2_0_Core->f.GetAttachedShaders(program, maxCount, count, obj);
-}
-
-inline void QOpenGLFunctions_2_1::glGetActiveUniform(GLuint program, GLuint index, GLsizei bufSize, GLsizei *length, GLint *size, GLenum *type, GLchar *name)
-{
- d_2_0_Core->f.GetActiveUniform(program, index, bufSize, length, size, type, name);
-}
-
-inline void QOpenGLFunctions_2_1::glGetActiveAttrib(GLuint program, GLuint index, GLsizei bufSize, GLsizei *length, GLint *size, GLenum *type, GLchar *name)
-{
- d_2_0_Core->f.GetActiveAttrib(program, index, bufSize, length, size, type, name);
-}
-
-inline void QOpenGLFunctions_2_1::glEnableVertexAttribArray(GLuint index)
-{
- d_2_0_Core->f.EnableVertexAttribArray(index);
-}
-
-inline void QOpenGLFunctions_2_1::glDisableVertexAttribArray(GLuint index)
-{
- d_2_0_Core->f.DisableVertexAttribArray(index);
-}
-
-inline void QOpenGLFunctions_2_1::glDetachShader(GLuint program, GLuint shader)
-{
- d_2_0_Core->f.DetachShader(program, shader);
-}
-
-inline void QOpenGLFunctions_2_1::glDeleteShader(GLuint shader)
-{
- d_2_0_Core->f.DeleteShader(shader);
-}
-
-inline void QOpenGLFunctions_2_1::glDeleteProgram(GLuint program)
-{
- d_2_0_Core->f.DeleteProgram(program);
-}
-
-inline GLuint QOpenGLFunctions_2_1::glCreateShader(GLenum type)
-{
- return d_2_0_Core->f.CreateShader(type);
-}
-
-inline GLuint QOpenGLFunctions_2_1::glCreateProgram()
-{
- return d_2_0_Core->f.CreateProgram();
-}
-
-inline void QOpenGLFunctions_2_1::glCompileShader(GLuint shader)
-{
- d_2_0_Core->f.CompileShader(shader);
-}
-
-inline void QOpenGLFunctions_2_1::glBindAttribLocation(GLuint program, GLuint index, const GLchar *name)
-{
- d_2_0_Core->f.BindAttribLocation(program, index, name);
-}
-
-inline void QOpenGLFunctions_2_1::glAttachShader(GLuint program, GLuint shader)
-{
- d_2_0_Core->f.AttachShader(program, shader);
-}
-
-inline void QOpenGLFunctions_2_1::glStencilMaskSeparate(GLenum face, GLuint mask)
-{
- d_2_0_Core->f.StencilMaskSeparate(face, mask);
-}
-
-inline void QOpenGLFunctions_2_1::glStencilFuncSeparate(GLenum face, GLenum func, GLint ref, GLuint mask)
-{
- d_2_0_Core->f.StencilFuncSeparate(face, func, ref, mask);
-}
-
-inline void QOpenGLFunctions_2_1::glStencilOpSeparate(GLenum face, GLenum sfail, GLenum dpfail, GLenum dppass)
-{
- d_2_0_Core->f.StencilOpSeparate(face, sfail, dpfail, dppass);
-}
-
-inline void QOpenGLFunctions_2_1::glDrawBuffers(GLsizei n, const GLenum *bufs)
-{
- d_2_0_Core->f.DrawBuffers(n, bufs);
-}
-
-inline void QOpenGLFunctions_2_1::glBlendEquationSeparate(GLenum modeRGB, GLenum modeAlpha)
-{
- d_2_0_Core->f.BlendEquationSeparate(modeRGB, modeAlpha);
-}
-
-
-// OpenGL 2.1 core functions
-inline void QOpenGLFunctions_2_1::glUniformMatrix4x3fv(GLint location, GLsizei count, GLboolean transpose, const GLfloat *value)
-{
- d_2_1_Core->f.UniformMatrix4x3fv(location, count, transpose, value);
-}
-
-inline void QOpenGLFunctions_2_1::glUniformMatrix3x4fv(GLint location, GLsizei count, GLboolean transpose, const GLfloat *value)
-{
- d_2_1_Core->f.UniformMatrix3x4fv(location, count, transpose, value);
-}
-
-inline void QOpenGLFunctions_2_1::glUniformMatrix4x2fv(GLint location, GLsizei count, GLboolean transpose, const GLfloat *value)
-{
- d_2_1_Core->f.UniformMatrix4x2fv(location, count, transpose, value);
-}
-
-inline void QOpenGLFunctions_2_1::glUniformMatrix2x4fv(GLint location, GLsizei count, GLboolean transpose, const GLfloat *value)
-{
- d_2_1_Core->f.UniformMatrix2x4fv(location, count, transpose, value);
-}
-
-inline void QOpenGLFunctions_2_1::glUniformMatrix3x2fv(GLint location, GLsizei count, GLboolean transpose, const GLfloat *value)
-{
- d_2_1_Core->f.UniformMatrix3x2fv(location, count, transpose, value);
-}
-
-inline void QOpenGLFunctions_2_1::glUniformMatrix2x3fv(GLint location, GLsizei count, GLboolean transpose, const GLfloat *value)
-{
- d_2_1_Core->f.UniformMatrix2x3fv(location, count, transpose, value);
-}
-
-
-// OpenGL 1.0 deprecated functions
-inline void QOpenGLFunctions_2_1::glTranslatef(GLfloat x, GLfloat y, GLfloat z)
-{
- d_1_0_Deprecated->f.Translatef(x, y, z);
-}
-
-inline void QOpenGLFunctions_2_1::glTranslated(GLdouble x, GLdouble y, GLdouble z)
-{
- d_1_0_Deprecated->f.Translated(x, y, z);
-}
-
-inline void QOpenGLFunctions_2_1::glScalef(GLfloat x, GLfloat y, GLfloat z)
-{
- d_1_0_Deprecated->f.Scalef(x, y, z);
-}
-
-inline void QOpenGLFunctions_2_1::glScaled(GLdouble x, GLdouble y, GLdouble z)
-{
- d_1_0_Deprecated->f.Scaled(x, y, z);
-}
-
-inline void QOpenGLFunctions_2_1::glRotatef(GLfloat angle, GLfloat x, GLfloat y, GLfloat z)
-{
- d_1_0_Deprecated->f.Rotatef(angle, x, y, z);
-}
-
-inline void QOpenGLFunctions_2_1::glRotated(GLdouble angle, GLdouble x, GLdouble y, GLdouble z)
-{
- d_1_0_Deprecated->f.Rotated(angle, x, y, z);
-}
-
-inline void QOpenGLFunctions_2_1::glPushMatrix()
-{
- d_1_0_Deprecated->f.PushMatrix();
-}
-
-inline void QOpenGLFunctions_2_1::glPopMatrix()
-{
- d_1_0_Deprecated->f.PopMatrix();
-}
-
-inline void QOpenGLFunctions_2_1::glOrtho(GLdouble left, GLdouble right, GLdouble bottom, GLdouble top, GLdouble zNear, GLdouble zFar)
-{
- d_1_0_Deprecated->f.Ortho(left, right, bottom, top, zNear, zFar);
-}
-
-inline void QOpenGLFunctions_2_1::glMultMatrixd(const GLdouble *m)
-{
- d_1_0_Deprecated->f.MultMatrixd(m);
-}
-
-inline void QOpenGLFunctions_2_1::glMultMatrixf(const GLfloat *m)
-{
- d_1_0_Deprecated->f.MultMatrixf(m);
-}
-
-inline void QOpenGLFunctions_2_1::glMatrixMode(GLenum mode)
-{
- d_1_0_Deprecated->f.MatrixMode(mode);
-}
-
-inline void QOpenGLFunctions_2_1::glLoadMatrixd(const GLdouble *m)
-{
- d_1_0_Deprecated->f.LoadMatrixd(m);
-}
-
-inline void QOpenGLFunctions_2_1::glLoadMatrixf(const GLfloat *m)
-{
- d_1_0_Deprecated->f.LoadMatrixf(m);
-}
-
-inline void QOpenGLFunctions_2_1::glLoadIdentity()
-{
- d_1_0_Deprecated->f.LoadIdentity();
-}
-
-inline void QOpenGLFunctions_2_1::glFrustum(GLdouble left, GLdouble right, GLdouble bottom, GLdouble top, GLdouble zNear, GLdouble zFar)
-{
- d_1_0_Deprecated->f.Frustum(left, right, bottom, top, zNear, zFar);
-}
-
-inline GLboolean QOpenGLFunctions_2_1::glIsList(GLuint list)
-{
- return d_1_0_Deprecated->f.IsList(list);
-}
-
-inline void QOpenGLFunctions_2_1::glGetTexGeniv(GLenum coord, GLenum pname, GLint *params)
-{
- d_1_0_Deprecated->f.GetTexGeniv(coord, pname, params);
-}
-
-inline void QOpenGLFunctions_2_1::glGetTexGenfv(GLenum coord, GLenum pname, GLfloat *params)
-{
- d_1_0_Deprecated->f.GetTexGenfv(coord, pname, params);
-}
-
-inline void QOpenGLFunctions_2_1::glGetTexGendv(GLenum coord, GLenum pname, GLdouble *params)
-{
- d_1_0_Deprecated->f.GetTexGendv(coord, pname, params);
-}
-
-inline void QOpenGLFunctions_2_1::glGetTexEnviv(GLenum target, GLenum pname, GLint *params)
-{
- d_1_0_Deprecated->f.GetTexEnviv(target, pname, params);
-}
-
-inline void QOpenGLFunctions_2_1::glGetTexEnvfv(GLenum target, GLenum pname, GLfloat *params)
-{
- d_1_0_Deprecated->f.GetTexEnvfv(target, pname, params);
-}
-
-inline void QOpenGLFunctions_2_1::glGetPolygonStipple(GLubyte *mask)
-{
- d_1_0_Deprecated->f.GetPolygonStipple(mask);
-}
-
-inline void QOpenGLFunctions_2_1::glGetPixelMapusv(GLenum map, GLushort *values)
-{
- d_1_0_Deprecated->f.GetPixelMapusv(map, values);
-}
-
-inline void QOpenGLFunctions_2_1::glGetPixelMapuiv(GLenum map, GLuint *values)
-{
- d_1_0_Deprecated->f.GetPixelMapuiv(map, values);
-}
-
-inline void QOpenGLFunctions_2_1::glGetPixelMapfv(GLenum map, GLfloat *values)
-{
- d_1_0_Deprecated->f.GetPixelMapfv(map, values);
-}
-
-inline void QOpenGLFunctions_2_1::glGetMaterialiv(GLenum face, GLenum pname, GLint *params)
-{
- d_1_0_Deprecated->f.GetMaterialiv(face, pname, params);
-}
-
-inline void QOpenGLFunctions_2_1::glGetMaterialfv(GLenum face, GLenum pname, GLfloat *params)
-{
- d_1_0_Deprecated->f.GetMaterialfv(face, pname, params);
-}
-
-inline void QOpenGLFunctions_2_1::glGetMapiv(GLenum target, GLenum query, GLint *v)
-{
- d_1_0_Deprecated->f.GetMapiv(target, query, v);
-}
-
-inline void QOpenGLFunctions_2_1::glGetMapfv(GLenum target, GLenum query, GLfloat *v)
-{
- d_1_0_Deprecated->f.GetMapfv(target, query, v);
-}
-
-inline void QOpenGLFunctions_2_1::glGetMapdv(GLenum target, GLenum query, GLdouble *v)
-{
- d_1_0_Deprecated->f.GetMapdv(target, query, v);
-}
-
-inline void QOpenGLFunctions_2_1::glGetLightiv(GLenum light, GLenum pname, GLint *params)
-{
- d_1_0_Deprecated->f.GetLightiv(light, pname, params);
-}
-
-inline void QOpenGLFunctions_2_1::glGetLightfv(GLenum light, GLenum pname, GLfloat *params)
-{
- d_1_0_Deprecated->f.GetLightfv(light, pname, params);
-}
-
-inline void QOpenGLFunctions_2_1::glGetClipPlane(GLenum plane, GLdouble *equation)
-{
- d_1_0_Deprecated->f.GetClipPlane(plane, equation);
-}
-
-inline void QOpenGLFunctions_2_1::glDrawPixels(GLsizei width, GLsizei height, GLenum format, GLenum type, const GLvoid *pixels)
-{
- d_1_0_Deprecated->f.DrawPixels(width, height, format, type, pixels);
-}
-
-inline void QOpenGLFunctions_2_1::glCopyPixels(GLint x, GLint y, GLsizei width, GLsizei height, GLenum type)
-{
- d_1_0_Deprecated->f.CopyPixels(x, y, width, height, type);
-}
-
-inline void QOpenGLFunctions_2_1::glPixelMapusv(GLenum map, GLint mapsize, const GLushort *values)
-{
- d_1_0_Deprecated->f.PixelMapusv(map, mapsize, values);
-}
-
-inline void QOpenGLFunctions_2_1::glPixelMapuiv(GLenum map, GLint mapsize, const GLuint *values)
-{
- d_1_0_Deprecated->f.PixelMapuiv(map, mapsize, values);
-}
-
-inline void QOpenGLFunctions_2_1::glPixelMapfv(GLenum map, GLint mapsize, const GLfloat *values)
-{
- d_1_0_Deprecated->f.PixelMapfv(map, mapsize, values);
-}
-
-inline void QOpenGLFunctions_2_1::glPixelTransferi(GLenum pname, GLint param)
-{
- d_1_0_Deprecated->f.PixelTransferi(pname, param);
-}
-
-inline void QOpenGLFunctions_2_1::glPixelTransferf(GLenum pname, GLfloat param)
-{
- d_1_0_Deprecated->f.PixelTransferf(pname, param);
-}
-
-inline void QOpenGLFunctions_2_1::glPixelZoom(GLfloat xfactor, GLfloat yfactor)
-{
- d_1_0_Deprecated->f.PixelZoom(xfactor, yfactor);
-}
-
-inline void QOpenGLFunctions_2_1::glAlphaFunc(GLenum func, GLfloat ref)
-{
- d_1_0_Deprecated->f.AlphaFunc(func, ref);
-}
-
-inline void QOpenGLFunctions_2_1::glEvalPoint2(GLint i, GLint j)
-{
- d_1_0_Deprecated->f.EvalPoint2(i, j);
-}
-
-inline void QOpenGLFunctions_2_1::glEvalMesh2(GLenum mode, GLint i1, GLint i2, GLint j1, GLint j2)
-{
- d_1_0_Deprecated->f.EvalMesh2(mode, i1, i2, j1, j2);
-}
-
-inline void QOpenGLFunctions_2_1::glEvalPoint1(GLint i)
-{
- d_1_0_Deprecated->f.EvalPoint1(i);
-}
-
-inline void QOpenGLFunctions_2_1::glEvalMesh1(GLenum mode, GLint i1, GLint i2)
-{
- d_1_0_Deprecated->f.EvalMesh1(mode, i1, i2);
-}
-
-inline void QOpenGLFunctions_2_1::glEvalCoord2fv(const GLfloat *u)
-{
- d_1_0_Deprecated->f.EvalCoord2fv(u);
-}
-
-inline void QOpenGLFunctions_2_1::glEvalCoord2f(GLfloat u, GLfloat v)
-{
- d_1_0_Deprecated->f.EvalCoord2f(u, v);
-}
-
-inline void QOpenGLFunctions_2_1::glEvalCoord2dv(const GLdouble *u)
-{
- d_1_0_Deprecated->f.EvalCoord2dv(u);
-}
-
-inline void QOpenGLFunctions_2_1::glEvalCoord2d(GLdouble u, GLdouble v)
-{
- d_1_0_Deprecated->f.EvalCoord2d(u, v);
-}
-
-inline void QOpenGLFunctions_2_1::glEvalCoord1fv(const GLfloat *u)
-{
- d_1_0_Deprecated->f.EvalCoord1fv(u);
-}
-
-inline void QOpenGLFunctions_2_1::glEvalCoord1f(GLfloat u)
-{
- d_1_0_Deprecated->f.EvalCoord1f(u);
-}
-
-inline void QOpenGLFunctions_2_1::glEvalCoord1dv(const GLdouble *u)
-{
- d_1_0_Deprecated->f.EvalCoord1dv(u);
-}
-
-inline void QOpenGLFunctions_2_1::glEvalCoord1d(GLdouble u)
-{
- d_1_0_Deprecated->f.EvalCoord1d(u);
-}
-
-inline void QOpenGLFunctions_2_1::glMapGrid2f(GLint un, GLfloat u1, GLfloat u2, GLint vn, GLfloat v1, GLfloat v2)
-{
- d_1_0_Deprecated->f.MapGrid2f(un, u1, u2, vn, v1, v2);
-}
-
-inline void QOpenGLFunctions_2_1::glMapGrid2d(GLint un, GLdouble u1, GLdouble u2, GLint vn, GLdouble v1, GLdouble v2)
-{
- d_1_0_Deprecated->f.MapGrid2d(un, u1, u2, vn, v1, v2);
-}
-
-inline void QOpenGLFunctions_2_1::glMapGrid1f(GLint un, GLfloat u1, GLfloat u2)
-{
- d_1_0_Deprecated->f.MapGrid1f(un, u1, u2);
-}
-
-inline void QOpenGLFunctions_2_1::glMapGrid1d(GLint un, GLdouble u1, GLdouble u2)
-{
- d_1_0_Deprecated->f.MapGrid1d(un, u1, u2);
-}
-
-inline void QOpenGLFunctions_2_1::glMap2f(GLenum target, GLfloat u1, GLfloat u2, GLint ustride, GLint uorder, GLfloat v1, GLfloat v2, GLint vstride, GLint vorder, const GLfloat *points)
-{
- d_1_0_Deprecated->f.Map2f(target, u1, u2, ustride, uorder, v1, v2, vstride, vorder, points);
-}
-
-inline void QOpenGLFunctions_2_1::glMap2d(GLenum target, GLdouble u1, GLdouble u2, GLint ustride, GLint uorder, GLdouble v1, GLdouble v2, GLint vstride, GLint vorder, const GLdouble *points)
-{
- d_1_0_Deprecated->f.Map2d(target, u1, u2, ustride, uorder, v1, v2, vstride, vorder, points);
-}
-
-inline void QOpenGLFunctions_2_1::glMap1f(GLenum target, GLfloat u1, GLfloat u2, GLint stride, GLint order, const GLfloat *points)
-{
- d_1_0_Deprecated->f.Map1f(target, u1, u2, stride, order, points);
-}
-
-inline void QOpenGLFunctions_2_1::glMap1d(GLenum target, GLdouble u1, GLdouble u2, GLint stride, GLint order, const GLdouble *points)
-{
- d_1_0_Deprecated->f.Map1d(target, u1, u2, stride, order, points);
-}
-
-inline void QOpenGLFunctions_2_1::glPushAttrib(GLbitfield mask)
-{
- d_1_0_Deprecated->f.PushAttrib(mask);
-}
-
-inline void QOpenGLFunctions_2_1::glPopAttrib()
-{
- d_1_0_Deprecated->f.PopAttrib();
-}
-
-inline void QOpenGLFunctions_2_1::glAccum(GLenum op, GLfloat value)
-{
- d_1_0_Deprecated->f.Accum(op, value);
-}
-
-inline void QOpenGLFunctions_2_1::glIndexMask(GLuint mask)
-{
- d_1_0_Deprecated->f.IndexMask(mask);
-}
-
-inline void QOpenGLFunctions_2_1::glClearIndex(GLfloat c)
-{
- d_1_0_Deprecated->f.ClearIndex(c);
-}
-
-inline void QOpenGLFunctions_2_1::glClearAccum(GLfloat red, GLfloat green, GLfloat blue, GLfloat alpha)
-{
- d_1_0_Deprecated->f.ClearAccum(red, green, blue, alpha);
-}
-
-inline void QOpenGLFunctions_2_1::glPushName(GLuint name)
-{
- d_1_0_Deprecated->f.PushName(name);
-}
-
-inline void QOpenGLFunctions_2_1::glPopName()
-{
- d_1_0_Deprecated->f.PopName();
-}
-
-inline void QOpenGLFunctions_2_1::glPassThrough(GLfloat token)
-{
- d_1_0_Deprecated->f.PassThrough(token);
-}
-
-inline void QOpenGLFunctions_2_1::glLoadName(GLuint name)
-{
- d_1_0_Deprecated->f.LoadName(name);
-}
-
-inline void QOpenGLFunctions_2_1::glInitNames()
-{
- d_1_0_Deprecated->f.InitNames();
-}
-
-inline GLint QOpenGLFunctions_2_1::glRenderMode(GLenum mode)
-{
- return d_1_0_Deprecated->f.RenderMode(mode);
-}
-
-inline void QOpenGLFunctions_2_1::glSelectBuffer(GLsizei size, GLuint *buffer)
-{
- d_1_0_Deprecated->f.SelectBuffer(size, buffer);
-}
-
-inline void QOpenGLFunctions_2_1::glFeedbackBuffer(GLsizei size, GLenum type, GLfloat *buffer)
-{
- d_1_0_Deprecated->f.FeedbackBuffer(size, type, buffer);
-}
-
-inline void QOpenGLFunctions_2_1::glTexGeniv(GLenum coord, GLenum pname, const GLint *params)
-{
- d_1_0_Deprecated->f.TexGeniv(coord, pname, params);
-}
-
-inline void QOpenGLFunctions_2_1::glTexGeni(GLenum coord, GLenum pname, GLint param)
-{
- d_1_0_Deprecated->f.TexGeni(coord, pname, param);
-}
-
-inline void QOpenGLFunctions_2_1::glTexGenfv(GLenum coord, GLenum pname, const GLfloat *params)
-{
- d_1_0_Deprecated->f.TexGenfv(coord, pname, params);
-}
-
-inline void QOpenGLFunctions_2_1::glTexGenf(GLenum coord, GLenum pname, GLfloat param)
-{
- d_1_0_Deprecated->f.TexGenf(coord, pname, param);
-}
-
-inline void QOpenGLFunctions_2_1::glTexGendv(GLenum coord, GLenum pname, const GLdouble *params)
-{
- d_1_0_Deprecated->f.TexGendv(coord, pname, params);
-}
-
-inline void QOpenGLFunctions_2_1::glTexGend(GLenum coord, GLenum pname, GLdouble param)
-{
- d_1_0_Deprecated->f.TexGend(coord, pname, param);
-}
-
-inline void QOpenGLFunctions_2_1::glTexEnviv(GLenum target, GLenum pname, const GLint *params)
-{
- d_1_0_Deprecated->f.TexEnviv(target, pname, params);
-}
-
-inline void QOpenGLFunctions_2_1::glTexEnvi(GLenum target, GLenum pname, GLint param)
-{
- d_1_0_Deprecated->f.TexEnvi(target, pname, param);
-}
-
-inline void QOpenGLFunctions_2_1::glTexEnvfv(GLenum target, GLenum pname, const GLfloat *params)
-{
- d_1_0_Deprecated->f.TexEnvfv(target, pname, params);
-}
-
-inline void QOpenGLFunctions_2_1::glTexEnvf(GLenum target, GLenum pname, GLfloat param)
-{
- d_1_0_Deprecated->f.TexEnvf(target, pname, param);
-}
-
-inline void QOpenGLFunctions_2_1::glShadeModel(GLenum mode)
-{
- d_1_0_Deprecated->f.ShadeModel(mode);
-}
-
-inline void QOpenGLFunctions_2_1::glPolygonStipple(const GLubyte *mask)
-{
- d_1_0_Deprecated->f.PolygonStipple(mask);
-}
-
-inline void QOpenGLFunctions_2_1::glMaterialiv(GLenum face, GLenum pname, const GLint *params)
-{
- d_1_0_Deprecated->f.Materialiv(face, pname, params);
-}
-
-inline void QOpenGLFunctions_2_1::glMateriali(GLenum face, GLenum pname, GLint param)
-{
- d_1_0_Deprecated->f.Materiali(face, pname, param);
-}
-
-inline void QOpenGLFunctions_2_1::glMaterialfv(GLenum face, GLenum pname, const GLfloat *params)
-{
- d_1_0_Deprecated->f.Materialfv(face, pname, params);
-}
-
-inline void QOpenGLFunctions_2_1::glMaterialf(GLenum face, GLenum pname, GLfloat param)
-{
- d_1_0_Deprecated->f.Materialf(face, pname, param);
-}
-
-inline void QOpenGLFunctions_2_1::glLineStipple(GLint factor, GLushort pattern)
-{
- d_1_0_Deprecated->f.LineStipple(factor, pattern);
-}
-
-inline void QOpenGLFunctions_2_1::glLightModeliv(GLenum pname, const GLint *params)
-{
- d_1_0_Deprecated->f.LightModeliv(pname, params);
-}
-
-inline void QOpenGLFunctions_2_1::glLightModeli(GLenum pname, GLint param)
-{
- d_1_0_Deprecated->f.LightModeli(pname, param);
-}
-
-inline void QOpenGLFunctions_2_1::glLightModelfv(GLenum pname, const GLfloat *params)
-{
- d_1_0_Deprecated->f.LightModelfv(pname, params);
-}
-
-inline void QOpenGLFunctions_2_1::glLightModelf(GLenum pname, GLfloat param)
-{
- d_1_0_Deprecated->f.LightModelf(pname, param);
-}
-
-inline void QOpenGLFunctions_2_1::glLightiv(GLenum light, GLenum pname, const GLint *params)
-{
- d_1_0_Deprecated->f.Lightiv(light, pname, params);
-}
-
-inline void QOpenGLFunctions_2_1::glLighti(GLenum light, GLenum pname, GLint param)
-{
- d_1_0_Deprecated->f.Lighti(light, pname, param);
-}
-
-inline void QOpenGLFunctions_2_1::glLightfv(GLenum light, GLenum pname, const GLfloat *params)
-{
- d_1_0_Deprecated->f.Lightfv(light, pname, params);
-}
-
-inline void QOpenGLFunctions_2_1::glLightf(GLenum light, GLenum pname, GLfloat param)
-{
- d_1_0_Deprecated->f.Lightf(light, pname, param);
-}
-
-inline void QOpenGLFunctions_2_1::glFogiv(GLenum pname, const GLint *params)
-{
- d_1_0_Deprecated->f.Fogiv(pname, params);
-}
-
-inline void QOpenGLFunctions_2_1::glFogi(GLenum pname, GLint param)
-{
- d_1_0_Deprecated->f.Fogi(pname, param);
-}
-
-inline void QOpenGLFunctions_2_1::glFogfv(GLenum pname, const GLfloat *params)
-{
- d_1_0_Deprecated->f.Fogfv(pname, params);
-}
-
-inline void QOpenGLFunctions_2_1::glFogf(GLenum pname, GLfloat param)
-{
- d_1_0_Deprecated->f.Fogf(pname, param);
-}
-
-inline void QOpenGLFunctions_2_1::glColorMaterial(GLenum face, GLenum mode)
-{
- d_1_0_Deprecated->f.ColorMaterial(face, mode);
-}
-
-inline void QOpenGLFunctions_2_1::glClipPlane(GLenum plane, const GLdouble *equation)
-{
- d_1_0_Deprecated->f.ClipPlane(plane, equation);
-}
-
-inline void QOpenGLFunctions_2_1::glVertex4sv(const GLshort *v)
-{
- d_1_0_Deprecated->f.Vertex4sv(v);
-}
-
-inline void QOpenGLFunctions_2_1::glVertex4s(GLshort x, GLshort y, GLshort z, GLshort w)
-{
- d_1_0_Deprecated->f.Vertex4s(x, y, z, w);
-}
-
-inline void QOpenGLFunctions_2_1::glVertex4iv(const GLint *v)
-{
- d_1_0_Deprecated->f.Vertex4iv(v);
-}
-
-inline void QOpenGLFunctions_2_1::glVertex4i(GLint x, GLint y, GLint z, GLint w)
-{
- d_1_0_Deprecated->f.Vertex4i(x, y, z, w);
-}
-
-inline void QOpenGLFunctions_2_1::glVertex4fv(const GLfloat *v)
-{
- d_1_0_Deprecated->f.Vertex4fv(v);
-}
-
-inline void QOpenGLFunctions_2_1::glVertex4f(GLfloat x, GLfloat y, GLfloat z, GLfloat w)
-{
- d_1_0_Deprecated->f.Vertex4f(x, y, z, w);
-}
-
-inline void QOpenGLFunctions_2_1::glVertex4dv(const GLdouble *v)
-{
- d_1_0_Deprecated->f.Vertex4dv(v);
-}
-
-inline void QOpenGLFunctions_2_1::glVertex4d(GLdouble x, GLdouble y, GLdouble z, GLdouble w)
-{
- d_1_0_Deprecated->f.Vertex4d(x, y, z, w);
-}
-
-inline void QOpenGLFunctions_2_1::glVertex3sv(const GLshort *v)
-{
- d_1_0_Deprecated->f.Vertex3sv(v);
-}
-
-inline void QOpenGLFunctions_2_1::glVertex3s(GLshort x, GLshort y, GLshort z)
-{
- d_1_0_Deprecated->f.Vertex3s(x, y, z);
-}
-
-inline void QOpenGLFunctions_2_1::glVertex3iv(const GLint *v)
-{
- d_1_0_Deprecated->f.Vertex3iv(v);
-}
-
-inline void QOpenGLFunctions_2_1::glVertex3i(GLint x, GLint y, GLint z)
-{
- d_1_0_Deprecated->f.Vertex3i(x, y, z);
-}
-
-inline void QOpenGLFunctions_2_1::glVertex3fv(const GLfloat *v)
-{
- d_1_0_Deprecated->f.Vertex3fv(v);
-}
-
-inline void QOpenGLFunctions_2_1::glVertex3f(GLfloat x, GLfloat y, GLfloat z)
-{
- d_1_0_Deprecated->f.Vertex3f(x, y, z);
-}
-
-inline void QOpenGLFunctions_2_1::glVertex3dv(const GLdouble *v)
-{
- d_1_0_Deprecated->f.Vertex3dv(v);
-}
-
-inline void QOpenGLFunctions_2_1::glVertex3d(GLdouble x, GLdouble y, GLdouble z)
-{
- d_1_0_Deprecated->f.Vertex3d(x, y, z);
-}
-
-inline void QOpenGLFunctions_2_1::glVertex2sv(const GLshort *v)
-{
- d_1_0_Deprecated->f.Vertex2sv(v);
-}
-
-inline void QOpenGLFunctions_2_1::glVertex2s(GLshort x, GLshort y)
-{
- d_1_0_Deprecated->f.Vertex2s(x, y);
-}
-
-inline void QOpenGLFunctions_2_1::glVertex2iv(const GLint *v)
-{
- d_1_0_Deprecated->f.Vertex2iv(v);
-}
-
-inline void QOpenGLFunctions_2_1::glVertex2i(GLint x, GLint y)
-{
- d_1_0_Deprecated->f.Vertex2i(x, y);
-}
-
-inline void QOpenGLFunctions_2_1::glVertex2fv(const GLfloat *v)
-{
- d_1_0_Deprecated->f.Vertex2fv(v);
-}
-
-inline void QOpenGLFunctions_2_1::glVertex2f(GLfloat x, GLfloat y)
-{
- d_1_0_Deprecated->f.Vertex2f(x, y);
-}
-
-inline void QOpenGLFunctions_2_1::glVertex2dv(const GLdouble *v)
-{
- d_1_0_Deprecated->f.Vertex2dv(v);
-}
-
-inline void QOpenGLFunctions_2_1::glVertex2d(GLdouble x, GLdouble y)
-{
- d_1_0_Deprecated->f.Vertex2d(x, y);
-}
-
-inline void QOpenGLFunctions_2_1::glTexCoord4sv(const GLshort *v)
-{
- d_1_0_Deprecated->f.TexCoord4sv(v);
-}
-
-inline void QOpenGLFunctions_2_1::glTexCoord4s(GLshort s, GLshort t, GLshort r, GLshort q)
-{
- d_1_0_Deprecated->f.TexCoord4s(s, t, r, q);
-}
-
-inline void QOpenGLFunctions_2_1::glTexCoord4iv(const GLint *v)
-{
- d_1_0_Deprecated->f.TexCoord4iv(v);
-}
-
-inline void QOpenGLFunctions_2_1::glTexCoord4i(GLint s, GLint t, GLint r, GLint q)
-{
- d_1_0_Deprecated->f.TexCoord4i(s, t, r, q);
-}
-
-inline void QOpenGLFunctions_2_1::glTexCoord4fv(const GLfloat *v)
-{
- d_1_0_Deprecated->f.TexCoord4fv(v);
-}
-
-inline void QOpenGLFunctions_2_1::glTexCoord4f(GLfloat s, GLfloat t, GLfloat r, GLfloat q)
-{
- d_1_0_Deprecated->f.TexCoord4f(s, t, r, q);
-}
-
-inline void QOpenGLFunctions_2_1::glTexCoord4dv(const GLdouble *v)
-{
- d_1_0_Deprecated->f.TexCoord4dv(v);
-}
-
-inline void QOpenGLFunctions_2_1::glTexCoord4d(GLdouble s, GLdouble t, GLdouble r, GLdouble q)
-{
- d_1_0_Deprecated->f.TexCoord4d(s, t, r, q);
-}
-
-inline void QOpenGLFunctions_2_1::glTexCoord3sv(const GLshort *v)
-{
- d_1_0_Deprecated->f.TexCoord3sv(v);
-}
-
-inline void QOpenGLFunctions_2_1::glTexCoord3s(GLshort s, GLshort t, GLshort r)
-{
- d_1_0_Deprecated->f.TexCoord3s(s, t, r);
-}
-
-inline void QOpenGLFunctions_2_1::glTexCoord3iv(const GLint *v)
-{
- d_1_0_Deprecated->f.TexCoord3iv(v);
-}
-
-inline void QOpenGLFunctions_2_1::glTexCoord3i(GLint s, GLint t, GLint r)
-{
- d_1_0_Deprecated->f.TexCoord3i(s, t, r);
-}
-
-inline void QOpenGLFunctions_2_1::glTexCoord3fv(const GLfloat *v)
-{
- d_1_0_Deprecated->f.TexCoord3fv(v);
-}
-
-inline void QOpenGLFunctions_2_1::glTexCoord3f(GLfloat s, GLfloat t, GLfloat r)
-{
- d_1_0_Deprecated->f.TexCoord3f(s, t, r);
-}
-
-inline void QOpenGLFunctions_2_1::glTexCoord3dv(const GLdouble *v)
-{
- d_1_0_Deprecated->f.TexCoord3dv(v);
-}
-
-inline void QOpenGLFunctions_2_1::glTexCoord3d(GLdouble s, GLdouble t, GLdouble r)
-{
- d_1_0_Deprecated->f.TexCoord3d(s, t, r);
-}
-
-inline void QOpenGLFunctions_2_1::glTexCoord2sv(const GLshort *v)
-{
- d_1_0_Deprecated->f.TexCoord2sv(v);
-}
-
-inline void QOpenGLFunctions_2_1::glTexCoord2s(GLshort s, GLshort t)
-{
- d_1_0_Deprecated->f.TexCoord2s(s, t);
-}
-
-inline void QOpenGLFunctions_2_1::glTexCoord2iv(const GLint *v)
-{
- d_1_0_Deprecated->f.TexCoord2iv(v);
-}
-
-inline void QOpenGLFunctions_2_1::glTexCoord2i(GLint s, GLint t)
-{
- d_1_0_Deprecated->f.TexCoord2i(s, t);
-}
-
-inline void QOpenGLFunctions_2_1::glTexCoord2fv(const GLfloat *v)
-{
- d_1_0_Deprecated->f.TexCoord2fv(v);
-}
-
-inline void QOpenGLFunctions_2_1::glTexCoord2f(GLfloat s, GLfloat t)
-{
- d_1_0_Deprecated->f.TexCoord2f(s, t);
-}
-
-inline void QOpenGLFunctions_2_1::glTexCoord2dv(const GLdouble *v)
-{
- d_1_0_Deprecated->f.TexCoord2dv(v);
-}
-
-inline void QOpenGLFunctions_2_1::glTexCoord2d(GLdouble s, GLdouble t)
-{
- d_1_0_Deprecated->f.TexCoord2d(s, t);
-}
-
-inline void QOpenGLFunctions_2_1::glTexCoord1sv(const GLshort *v)
-{
- d_1_0_Deprecated->f.TexCoord1sv(v);
-}
-
-inline void QOpenGLFunctions_2_1::glTexCoord1s(GLshort s)
-{
- d_1_0_Deprecated->f.TexCoord1s(s);
-}
-
-inline void QOpenGLFunctions_2_1::glTexCoord1iv(const GLint *v)
-{
- d_1_0_Deprecated->f.TexCoord1iv(v);
-}
-
-inline void QOpenGLFunctions_2_1::glTexCoord1i(GLint s)
-{
- d_1_0_Deprecated->f.TexCoord1i(s);
-}
-
-inline void QOpenGLFunctions_2_1::glTexCoord1fv(const GLfloat *v)
-{
- d_1_0_Deprecated->f.TexCoord1fv(v);
-}
-
-inline void QOpenGLFunctions_2_1::glTexCoord1f(GLfloat s)
-{
- d_1_0_Deprecated->f.TexCoord1f(s);
-}
-
-inline void QOpenGLFunctions_2_1::glTexCoord1dv(const GLdouble *v)
-{
- d_1_0_Deprecated->f.TexCoord1dv(v);
-}
-
-inline void QOpenGLFunctions_2_1::glTexCoord1d(GLdouble s)
-{
- d_1_0_Deprecated->f.TexCoord1d(s);
-}
-
-inline void QOpenGLFunctions_2_1::glRectsv(const GLshort *v1, const GLshort *v2)
-{
- d_1_0_Deprecated->f.Rectsv(v1, v2);
-}
-
-inline void QOpenGLFunctions_2_1::glRects(GLshort x1, GLshort y1, GLshort x2, GLshort y2)
-{
- d_1_0_Deprecated->f.Rects(x1, y1, x2, y2);
-}
-
-inline void QOpenGLFunctions_2_1::glRectiv(const GLint *v1, const GLint *v2)
-{
- d_1_0_Deprecated->f.Rectiv(v1, v2);
-}
-
-inline void QOpenGLFunctions_2_1::glRecti(GLint x1, GLint y1, GLint x2, GLint y2)
-{
- d_1_0_Deprecated->f.Recti(x1, y1, x2, y2);
-}
-
-inline void QOpenGLFunctions_2_1::glRectfv(const GLfloat *v1, const GLfloat *v2)
-{
- d_1_0_Deprecated->f.Rectfv(v1, v2);
-}
-
-inline void QOpenGLFunctions_2_1::glRectf(GLfloat x1, GLfloat y1, GLfloat x2, GLfloat y2)
-{
- d_1_0_Deprecated->f.Rectf(x1, y1, x2, y2);
-}
-
-inline void QOpenGLFunctions_2_1::glRectdv(const GLdouble *v1, const GLdouble *v2)
-{
- d_1_0_Deprecated->f.Rectdv(v1, v2);
-}
-
-inline void QOpenGLFunctions_2_1::glRectd(GLdouble x1, GLdouble y1, GLdouble x2, GLdouble y2)
-{
- d_1_0_Deprecated->f.Rectd(x1, y1, x2, y2);
-}
-
-inline void QOpenGLFunctions_2_1::glRasterPos4sv(const GLshort *v)
-{
- d_1_0_Deprecated->f.RasterPos4sv(v);
-}
-
-inline void QOpenGLFunctions_2_1::glRasterPos4s(GLshort x, GLshort y, GLshort z, GLshort w)
-{
- d_1_0_Deprecated->f.RasterPos4s(x, y, z, w);
-}
-
-inline void QOpenGLFunctions_2_1::glRasterPos4iv(const GLint *v)
-{
- d_1_0_Deprecated->f.RasterPos4iv(v);
-}
-
-inline void QOpenGLFunctions_2_1::glRasterPos4i(GLint x, GLint y, GLint z, GLint w)
-{
- d_1_0_Deprecated->f.RasterPos4i(x, y, z, w);
-}
-
-inline void QOpenGLFunctions_2_1::glRasterPos4fv(const GLfloat *v)
-{
- d_1_0_Deprecated->f.RasterPos4fv(v);
-}
-
-inline void QOpenGLFunctions_2_1::glRasterPos4f(GLfloat x, GLfloat y, GLfloat z, GLfloat w)
-{
- d_1_0_Deprecated->f.RasterPos4f(x, y, z, w);
-}
-
-inline void QOpenGLFunctions_2_1::glRasterPos4dv(const GLdouble *v)
-{
- d_1_0_Deprecated->f.RasterPos4dv(v);
-}
-
-inline void QOpenGLFunctions_2_1::glRasterPos4d(GLdouble x, GLdouble y, GLdouble z, GLdouble w)
-{
- d_1_0_Deprecated->f.RasterPos4d(x, y, z, w);
-}
-
-inline void QOpenGLFunctions_2_1::glRasterPos3sv(const GLshort *v)
-{
- d_1_0_Deprecated->f.RasterPos3sv(v);
-}
-
-inline void QOpenGLFunctions_2_1::glRasterPos3s(GLshort x, GLshort y, GLshort z)
-{
- d_1_0_Deprecated->f.RasterPos3s(x, y, z);
-}
-
-inline void QOpenGLFunctions_2_1::glRasterPos3iv(const GLint *v)
-{
- d_1_0_Deprecated->f.RasterPos3iv(v);
-}
-
-inline void QOpenGLFunctions_2_1::glRasterPos3i(GLint x, GLint y, GLint z)
-{
- d_1_0_Deprecated->f.RasterPos3i(x, y, z);
-}
-
-inline void QOpenGLFunctions_2_1::glRasterPos3fv(const GLfloat *v)
-{
- d_1_0_Deprecated->f.RasterPos3fv(v);
-}
-
-inline void QOpenGLFunctions_2_1::glRasterPos3f(GLfloat x, GLfloat y, GLfloat z)
-{
- d_1_0_Deprecated->f.RasterPos3f(x, y, z);
-}
-
-inline void QOpenGLFunctions_2_1::glRasterPos3dv(const GLdouble *v)
-{
- d_1_0_Deprecated->f.RasterPos3dv(v);
-}
-
-inline void QOpenGLFunctions_2_1::glRasterPos3d(GLdouble x, GLdouble y, GLdouble z)
-{
- d_1_0_Deprecated->f.RasterPos3d(x, y, z);
-}
-
-inline void QOpenGLFunctions_2_1::glRasterPos2sv(const GLshort *v)
-{
- d_1_0_Deprecated->f.RasterPos2sv(v);
-}
-
-inline void QOpenGLFunctions_2_1::glRasterPos2s(GLshort x, GLshort y)
-{
- d_1_0_Deprecated->f.RasterPos2s(x, y);
-}
-
-inline void QOpenGLFunctions_2_1::glRasterPos2iv(const GLint *v)
-{
- d_1_0_Deprecated->f.RasterPos2iv(v);
-}
-
-inline void QOpenGLFunctions_2_1::glRasterPos2i(GLint x, GLint y)
-{
- d_1_0_Deprecated->f.RasterPos2i(x, y);
-}
-
-inline void QOpenGLFunctions_2_1::glRasterPos2fv(const GLfloat *v)
-{
- d_1_0_Deprecated->f.RasterPos2fv(v);
-}
-
-inline void QOpenGLFunctions_2_1::glRasterPos2f(GLfloat x, GLfloat y)
-{
- d_1_0_Deprecated->f.RasterPos2f(x, y);
-}
-
-inline void QOpenGLFunctions_2_1::glRasterPos2dv(const GLdouble *v)
-{
- d_1_0_Deprecated->f.RasterPos2dv(v);
-}
-
-inline void QOpenGLFunctions_2_1::glRasterPos2d(GLdouble x, GLdouble y)
-{
- d_1_0_Deprecated->f.RasterPos2d(x, y);
-}
-
-inline void QOpenGLFunctions_2_1::glNormal3sv(const GLshort *v)
-{
- d_1_0_Deprecated->f.Normal3sv(v);
-}
-
-inline void QOpenGLFunctions_2_1::glNormal3s(GLshort nx, GLshort ny, GLshort nz)
-{
- d_1_0_Deprecated->f.Normal3s(nx, ny, nz);
-}
-
-inline void QOpenGLFunctions_2_1::glNormal3iv(const GLint *v)
-{
- d_1_0_Deprecated->f.Normal3iv(v);
-}
-
-inline void QOpenGLFunctions_2_1::glNormal3i(GLint nx, GLint ny, GLint nz)
-{
- d_1_0_Deprecated->f.Normal3i(nx, ny, nz);
-}
-
-inline void QOpenGLFunctions_2_1::glNormal3fv(const GLfloat *v)
-{
- d_1_0_Deprecated->f.Normal3fv(v);
-}
-
-inline void QOpenGLFunctions_2_1::glNormal3f(GLfloat nx, GLfloat ny, GLfloat nz)
-{
- d_1_0_Deprecated->f.Normal3f(nx, ny, nz);
-}
-
-inline void QOpenGLFunctions_2_1::glNormal3dv(const GLdouble *v)
-{
- d_1_0_Deprecated->f.Normal3dv(v);
-}
-
-inline void QOpenGLFunctions_2_1::glNormal3d(GLdouble nx, GLdouble ny, GLdouble nz)
-{
- d_1_0_Deprecated->f.Normal3d(nx, ny, nz);
-}
-
-inline void QOpenGLFunctions_2_1::glNormal3bv(const GLbyte *v)
-{
- d_1_0_Deprecated->f.Normal3bv(v);
-}
-
-inline void QOpenGLFunctions_2_1::glNormal3b(GLbyte nx, GLbyte ny, GLbyte nz)
-{
- d_1_0_Deprecated->f.Normal3b(nx, ny, nz);
-}
-
-inline void QOpenGLFunctions_2_1::glIndexsv(const GLshort *c)
-{
- d_1_0_Deprecated->f.Indexsv(c);
-}
-
-inline void QOpenGLFunctions_2_1::glIndexs(GLshort c)
-{
- d_1_0_Deprecated->f.Indexs(c);
-}
-
-inline void QOpenGLFunctions_2_1::glIndexiv(const GLint *c)
-{
- d_1_0_Deprecated->f.Indexiv(c);
-}
-
-inline void QOpenGLFunctions_2_1::glIndexi(GLint c)
-{
- d_1_0_Deprecated->f.Indexi(c);
-}
-
-inline void QOpenGLFunctions_2_1::glIndexfv(const GLfloat *c)
-{
- d_1_0_Deprecated->f.Indexfv(c);
-}
-
-inline void QOpenGLFunctions_2_1::glIndexf(GLfloat c)
-{
- d_1_0_Deprecated->f.Indexf(c);
-}
-
-inline void QOpenGLFunctions_2_1::glIndexdv(const GLdouble *c)
-{
- d_1_0_Deprecated->f.Indexdv(c);
-}
-
-inline void QOpenGLFunctions_2_1::glIndexd(GLdouble c)
-{
- d_1_0_Deprecated->f.Indexd(c);
-}
-
-inline void QOpenGLFunctions_2_1::glEnd()
-{
- d_1_0_Deprecated->f.End();
-}
-
-inline void QOpenGLFunctions_2_1::glEdgeFlagv(const GLboolean *flag)
-{
- d_1_0_Deprecated->f.EdgeFlagv(flag);
-}
-
-inline void QOpenGLFunctions_2_1::glEdgeFlag(GLboolean flag)
-{
- d_1_0_Deprecated->f.EdgeFlag(flag);
-}
-
-inline void QOpenGLFunctions_2_1::glColor4usv(const GLushort *v)
-{
- d_1_0_Deprecated->f.Color4usv(v);
-}
-
-inline void QOpenGLFunctions_2_1::glColor4us(GLushort red, GLushort green, GLushort blue, GLushort alpha)
-{
- d_1_0_Deprecated->f.Color4us(red, green, blue, alpha);
-}
-
-inline void QOpenGLFunctions_2_1::glColor4uiv(const GLuint *v)
-{
- d_1_0_Deprecated->f.Color4uiv(v);
-}
-
-inline void QOpenGLFunctions_2_1::glColor4ui(GLuint red, GLuint green, GLuint blue, GLuint alpha)
-{
- d_1_0_Deprecated->f.Color4ui(red, green, blue, alpha);
-}
-
-inline void QOpenGLFunctions_2_1::glColor4ubv(const GLubyte *v)
-{
- d_1_0_Deprecated->f.Color4ubv(v);
-}
-
-inline void QOpenGLFunctions_2_1::glColor4ub(GLubyte red, GLubyte green, GLubyte blue, GLubyte alpha)
-{
- d_1_0_Deprecated->f.Color4ub(red, green, blue, alpha);
-}
-
-inline void QOpenGLFunctions_2_1::glColor4sv(const GLshort *v)
-{
- d_1_0_Deprecated->f.Color4sv(v);
-}
-
-inline void QOpenGLFunctions_2_1::glColor4s(GLshort red, GLshort green, GLshort blue, GLshort alpha)
-{
- d_1_0_Deprecated->f.Color4s(red, green, blue, alpha);
-}
-
-inline void QOpenGLFunctions_2_1::glColor4iv(const GLint *v)
-{
- d_1_0_Deprecated->f.Color4iv(v);
-}
-
-inline void QOpenGLFunctions_2_1::glColor4i(GLint red, GLint green, GLint blue, GLint alpha)
-{
- d_1_0_Deprecated->f.Color4i(red, green, blue, alpha);
-}
-
-inline void QOpenGLFunctions_2_1::glColor4fv(const GLfloat *v)
-{
- d_1_0_Deprecated->f.Color4fv(v);
-}
-
-inline void QOpenGLFunctions_2_1::glColor4f(GLfloat red, GLfloat green, GLfloat blue, GLfloat alpha)
-{
- d_1_0_Deprecated->f.Color4f(red, green, blue, alpha);
-}
-
-inline void QOpenGLFunctions_2_1::glColor4dv(const GLdouble *v)
-{
- d_1_0_Deprecated->f.Color4dv(v);
-}
-
-inline void QOpenGLFunctions_2_1::glColor4d(GLdouble red, GLdouble green, GLdouble blue, GLdouble alpha)
-{
- d_1_0_Deprecated->f.Color4d(red, green, blue, alpha);
-}
-
-inline void QOpenGLFunctions_2_1::glColor4bv(const GLbyte *v)
-{
- d_1_0_Deprecated->f.Color4bv(v);
-}
-
-inline void QOpenGLFunctions_2_1::glColor4b(GLbyte red, GLbyte green, GLbyte blue, GLbyte alpha)
-{
- d_1_0_Deprecated->f.Color4b(red, green, blue, alpha);
-}
-
-inline void QOpenGLFunctions_2_1::glColor3usv(const GLushort *v)
-{
- d_1_0_Deprecated->f.Color3usv(v);
-}
-
-inline void QOpenGLFunctions_2_1::glColor3us(GLushort red, GLushort green, GLushort blue)
-{
- d_1_0_Deprecated->f.Color3us(red, green, blue);
-}
-
-inline void QOpenGLFunctions_2_1::glColor3uiv(const GLuint *v)
-{
- d_1_0_Deprecated->f.Color3uiv(v);
-}
-
-inline void QOpenGLFunctions_2_1::glColor3ui(GLuint red, GLuint green, GLuint blue)
-{
- d_1_0_Deprecated->f.Color3ui(red, green, blue);
-}
-
-inline void QOpenGLFunctions_2_1::glColor3ubv(const GLubyte *v)
-{
- d_1_0_Deprecated->f.Color3ubv(v);
-}
-
-inline void QOpenGLFunctions_2_1::glColor3ub(GLubyte red, GLubyte green, GLubyte blue)
-{
- d_1_0_Deprecated->f.Color3ub(red, green, blue);
-}
-
-inline void QOpenGLFunctions_2_1::glColor3sv(const GLshort *v)
-{
- d_1_0_Deprecated->f.Color3sv(v);
-}
-
-inline void QOpenGLFunctions_2_1::glColor3s(GLshort red, GLshort green, GLshort blue)
-{
- d_1_0_Deprecated->f.Color3s(red, green, blue);
-}
-
-inline void QOpenGLFunctions_2_1::glColor3iv(const GLint *v)
-{
- d_1_0_Deprecated->f.Color3iv(v);
-}
-
-inline void QOpenGLFunctions_2_1::glColor3i(GLint red, GLint green, GLint blue)
-{
- d_1_0_Deprecated->f.Color3i(red, green, blue);
-}
-
-inline void QOpenGLFunctions_2_1::glColor3fv(const GLfloat *v)
-{
- d_1_0_Deprecated->f.Color3fv(v);
-}
-
-inline void QOpenGLFunctions_2_1::glColor3f(GLfloat red, GLfloat green, GLfloat blue)
-{
- d_1_0_Deprecated->f.Color3f(red, green, blue);
-}
-
-inline void QOpenGLFunctions_2_1::glColor3dv(const GLdouble *v)
-{
- d_1_0_Deprecated->f.Color3dv(v);
-}
-
-inline void QOpenGLFunctions_2_1::glColor3d(GLdouble red, GLdouble green, GLdouble blue)
-{
- d_1_0_Deprecated->f.Color3d(red, green, blue);
-}
-
-inline void QOpenGLFunctions_2_1::glColor3bv(const GLbyte *v)
-{
- d_1_0_Deprecated->f.Color3bv(v);
-}
-
-inline void QOpenGLFunctions_2_1::glColor3b(GLbyte red, GLbyte green, GLbyte blue)
-{
- d_1_0_Deprecated->f.Color3b(red, green, blue);
-}
-
-inline void QOpenGLFunctions_2_1::glBitmap(GLsizei width, GLsizei height, GLfloat xorig, GLfloat yorig, GLfloat xmove, GLfloat ymove, const GLubyte *bitmap)
-{
- d_1_0_Deprecated->f.Bitmap(width, height, xorig, yorig, xmove, ymove, bitmap);
-}
-
-inline void QOpenGLFunctions_2_1::glBegin(GLenum mode)
-{
- d_1_0_Deprecated->f.Begin(mode);
-}
-
-inline void QOpenGLFunctions_2_1::glListBase(GLuint base)
-{
- d_1_0_Deprecated->f.ListBase(base);
-}
-
-inline GLuint QOpenGLFunctions_2_1::glGenLists(GLsizei range)
-{
- return d_1_0_Deprecated->f.GenLists(range);
-}
-
-inline void QOpenGLFunctions_2_1::glDeleteLists(GLuint list, GLsizei range)
-{
- d_1_0_Deprecated->f.DeleteLists(list, range);
-}
-
-inline void QOpenGLFunctions_2_1::glCallLists(GLsizei n, GLenum type, const GLvoid *lists)
-{
- d_1_0_Deprecated->f.CallLists(n, type, lists);
-}
-
-inline void QOpenGLFunctions_2_1::glCallList(GLuint list)
-{
- d_1_0_Deprecated->f.CallList(list);
-}
-
-inline void QOpenGLFunctions_2_1::glEndList()
-{
- d_1_0_Deprecated->f.EndList();
-}
-
-inline void QOpenGLFunctions_2_1::glNewList(GLuint list, GLenum mode)
-{
- d_1_0_Deprecated->f.NewList(list, mode);
-}
-
-
-// OpenGL 1.1 deprecated functions
-inline void QOpenGLFunctions_2_1::glPushClientAttrib(GLbitfield mask)
-{
- d_1_1_Deprecated->f.PushClientAttrib(mask);
-}
-
-inline void QOpenGLFunctions_2_1::glPopClientAttrib()
-{
- d_1_1_Deprecated->f.PopClientAttrib();
-}
-
-inline void QOpenGLFunctions_2_1::glPrioritizeTextures(GLsizei n, const GLuint *textures, const GLfloat *priorities)
-{
- d_1_1_Deprecated->f.PrioritizeTextures(n, textures, priorities);
-}
-
-inline GLboolean QOpenGLFunctions_2_1::glAreTexturesResident(GLsizei n, const GLuint *textures, GLboolean *residences)
-{
- return d_1_1_Deprecated->f.AreTexturesResident(n, textures, residences);
-}
-
-inline void QOpenGLFunctions_2_1::glVertexPointer(GLint size, GLenum type, GLsizei stride, const GLvoid *pointer)
-{
- d_1_1_Deprecated->f.VertexPointer(size, type, stride, pointer);
-}
-
-inline void QOpenGLFunctions_2_1::glTexCoordPointer(GLint size, GLenum type, GLsizei stride, const GLvoid *pointer)
-{
- d_1_1_Deprecated->f.TexCoordPointer(size, type, stride, pointer);
-}
-
-inline void QOpenGLFunctions_2_1::glNormalPointer(GLenum type, GLsizei stride, const GLvoid *pointer)
-{
- d_1_1_Deprecated->f.NormalPointer(type, stride, pointer);
-}
-
-inline void QOpenGLFunctions_2_1::glInterleavedArrays(GLenum format, GLsizei stride, const GLvoid *pointer)
-{
- d_1_1_Deprecated->f.InterleavedArrays(format, stride, pointer);
-}
-
-inline void QOpenGLFunctions_2_1::glIndexPointer(GLenum type, GLsizei stride, const GLvoid *pointer)
-{
- d_1_1_Deprecated->f.IndexPointer(type, stride, pointer);
-}
-
-inline void QOpenGLFunctions_2_1::glEnableClientState(GLenum array)
-{
- d_1_1_Deprecated->f.EnableClientState(array);
-}
-
-inline void QOpenGLFunctions_2_1::glEdgeFlagPointer(GLsizei stride, const GLvoid *pointer)
-{
- d_1_1_Deprecated->f.EdgeFlagPointer(stride, pointer);
-}
-
-inline void QOpenGLFunctions_2_1::glDisableClientState(GLenum array)
-{
- d_1_1_Deprecated->f.DisableClientState(array);
-}
-
-inline void QOpenGLFunctions_2_1::glColorPointer(GLint size, GLenum type, GLsizei stride, const GLvoid *pointer)
-{
- d_1_1_Deprecated->f.ColorPointer(size, type, stride, pointer);
-}
-
-inline void QOpenGLFunctions_2_1::glArrayElement(GLint i)
-{
- d_1_1_Deprecated->f.ArrayElement(i);
-}
-
-
-// OpenGL 1.2 deprecated functions
-inline void QOpenGLFunctions_2_1::glResetMinmax(GLenum target)
-{
- d_1_2_Deprecated->f.ResetMinmax(target);
-}
-
-inline void QOpenGLFunctions_2_1::glResetHistogram(GLenum target)
-{
- d_1_2_Deprecated->f.ResetHistogram(target);
-}
-
-inline void QOpenGLFunctions_2_1::glMinmax(GLenum target, GLenum internalformat, GLboolean sink)
-{
- d_1_2_Deprecated->f.Minmax(target, internalformat, sink);
-}
-
-inline void QOpenGLFunctions_2_1::glHistogram(GLenum target, GLsizei width, GLenum internalformat, GLboolean sink)
-{
- d_1_2_Deprecated->f.Histogram(target, width, internalformat, sink);
-}
-
-inline void QOpenGLFunctions_2_1::glGetMinmaxParameteriv(GLenum target, GLenum pname, GLint *params)
-{
- d_1_2_Deprecated->f.GetMinmaxParameteriv(target, pname, params);
-}
-
-inline void QOpenGLFunctions_2_1::glGetMinmaxParameterfv(GLenum target, GLenum pname, GLfloat *params)
-{
- d_1_2_Deprecated->f.GetMinmaxParameterfv(target, pname, params);
-}
-
-inline void QOpenGLFunctions_2_1::glGetMinmax(GLenum target, GLboolean reset, GLenum format, GLenum type, GLvoid *values)
-{
- d_1_2_Deprecated->f.GetMinmax(target, reset, format, type, values);
-}
-
-inline void QOpenGLFunctions_2_1::glGetHistogramParameteriv(GLenum target, GLenum pname, GLint *params)
-{
- d_1_2_Deprecated->f.GetHistogramParameteriv(target, pname, params);
-}
-
-inline void QOpenGLFunctions_2_1::glGetHistogramParameterfv(GLenum target, GLenum pname, GLfloat *params)
-{
- d_1_2_Deprecated->f.GetHistogramParameterfv(target, pname, params);
-}
-
-inline void QOpenGLFunctions_2_1::glGetHistogram(GLenum target, GLboolean reset, GLenum format, GLenum type, GLvoid *values)
-{
- d_1_2_Deprecated->f.GetHistogram(target, reset, format, type, values);
-}
-
-inline void QOpenGLFunctions_2_1::glSeparableFilter2D(GLenum target, GLenum internalformat, GLsizei width, GLsizei height, GLenum format, GLenum type, const GLvoid *row, const GLvoid *column)
-{
- d_1_2_Deprecated->f.SeparableFilter2D(target, internalformat, width, height, format, type, row, column);
-}
-
-inline void QOpenGLFunctions_2_1::glGetSeparableFilter(GLenum target, GLenum format, GLenum type, GLvoid *row, GLvoid *column, GLvoid *span)
-{
- d_1_2_Deprecated->f.GetSeparableFilter(target, format, type, row, column, span);
-}
-
-inline void QOpenGLFunctions_2_1::glGetConvolutionParameteriv(GLenum target, GLenum pname, GLint *params)
-{
- d_1_2_Deprecated->f.GetConvolutionParameteriv(target, pname, params);
-}
-
-inline void QOpenGLFunctions_2_1::glGetConvolutionParameterfv(GLenum target, GLenum pname, GLfloat *params)
-{
- d_1_2_Deprecated->f.GetConvolutionParameterfv(target, pname, params);
-}
-
-inline void QOpenGLFunctions_2_1::glGetConvolutionFilter(GLenum target, GLenum format, GLenum type, GLvoid *image)
-{
- d_1_2_Deprecated->f.GetConvolutionFilter(target, format, type, image);
-}
-
-inline void QOpenGLFunctions_2_1::glCopyConvolutionFilter2D(GLenum target, GLenum internalformat, GLint x, GLint y, GLsizei width, GLsizei height)
-{
- d_1_2_Deprecated->f.CopyConvolutionFilter2D(target, internalformat, x, y, width, height);
-}
-
-inline void QOpenGLFunctions_2_1::glCopyConvolutionFilter1D(GLenum target, GLenum internalformat, GLint x, GLint y, GLsizei width)
-{
- d_1_2_Deprecated->f.CopyConvolutionFilter1D(target, internalformat, x, y, width);
-}
-
-inline void QOpenGLFunctions_2_1::glConvolutionParameteriv(GLenum target, GLenum pname, const GLint *params)
-{
- d_1_2_Deprecated->f.ConvolutionParameteriv(target, pname, params);
-}
-
-inline void QOpenGLFunctions_2_1::glConvolutionParameteri(GLenum target, GLenum pname, GLint params)
-{
- d_1_2_Deprecated->f.ConvolutionParameteri(target, pname, params);
-}
-
-inline void QOpenGLFunctions_2_1::glConvolutionParameterfv(GLenum target, GLenum pname, const GLfloat *params)
-{
- d_1_2_Deprecated->f.ConvolutionParameterfv(target, pname, params);
-}
-
-inline void QOpenGLFunctions_2_1::glConvolutionParameterf(GLenum target, GLenum pname, GLfloat params)
-{
- d_1_2_Deprecated->f.ConvolutionParameterf(target, pname, params);
-}
-
-inline void QOpenGLFunctions_2_1::glConvolutionFilter2D(GLenum target, GLenum internalformat, GLsizei width, GLsizei height, GLenum format, GLenum type, const GLvoid *image)
-{
- d_1_2_Deprecated->f.ConvolutionFilter2D(target, internalformat, width, height, format, type, image);
-}
-
-inline void QOpenGLFunctions_2_1::glConvolutionFilter1D(GLenum target, GLenum internalformat, GLsizei width, GLenum format, GLenum type, const GLvoid *image)
-{
- d_1_2_Deprecated->f.ConvolutionFilter1D(target, internalformat, width, format, type, image);
-}
-
-inline void QOpenGLFunctions_2_1::glCopyColorSubTable(GLenum target, GLsizei start, GLint x, GLint y, GLsizei width)
-{
- d_1_2_Deprecated->f.CopyColorSubTable(target, start, x, y, width);
-}
-
-inline void QOpenGLFunctions_2_1::glColorSubTable(GLenum target, GLsizei start, GLsizei count, GLenum format, GLenum type, const GLvoid *data)
-{
- d_1_2_Deprecated->f.ColorSubTable(target, start, count, format, type, data);
-}
-
-inline void QOpenGLFunctions_2_1::glGetColorTableParameteriv(GLenum target, GLenum pname, GLint *params)
-{
- d_1_2_Deprecated->f.GetColorTableParameteriv(target, pname, params);
-}
-
-inline void QOpenGLFunctions_2_1::glGetColorTableParameterfv(GLenum target, GLenum pname, GLfloat *params)
-{
- d_1_2_Deprecated->f.GetColorTableParameterfv(target, pname, params);
-}
-
-inline void QOpenGLFunctions_2_1::glGetColorTable(GLenum target, GLenum format, GLenum type, GLvoid *table)
-{
- d_1_2_Deprecated->f.GetColorTable(target, format, type, table);
-}
-
-inline void QOpenGLFunctions_2_1::glCopyColorTable(GLenum target, GLenum internalformat, GLint x, GLint y, GLsizei width)
-{
- d_1_2_Deprecated->f.CopyColorTable(target, internalformat, x, y, width);
-}
-
-inline void QOpenGLFunctions_2_1::glColorTableParameteriv(GLenum target, GLenum pname, const GLint *params)
-{
- d_1_2_Deprecated->f.ColorTableParameteriv(target, pname, params);
-}
-
-inline void QOpenGLFunctions_2_1::glColorTableParameterfv(GLenum target, GLenum pname, const GLfloat *params)
-{
- d_1_2_Deprecated->f.ColorTableParameterfv(target, pname, params);
-}
-
-inline void QOpenGLFunctions_2_1::glColorTable(GLenum target, GLenum internalformat, GLsizei width, GLenum format, GLenum type, const GLvoid *table)
-{
- d_1_2_Deprecated->f.ColorTable(target, internalformat, width, format, type, table);
-}
-
-
-// OpenGL 1.3 deprecated functions
-inline void QOpenGLFunctions_2_1::glMultTransposeMatrixd(const GLdouble *m)
-{
- d_1_3_Deprecated->f.MultTransposeMatrixd(m);
-}
-
-inline void QOpenGLFunctions_2_1::glMultTransposeMatrixf(const GLfloat *m)
-{
- d_1_3_Deprecated->f.MultTransposeMatrixf(m);
-}
-
-inline void QOpenGLFunctions_2_1::glLoadTransposeMatrixd(const GLdouble *m)
-{
- d_1_3_Deprecated->f.LoadTransposeMatrixd(m);
-}
-
-inline void QOpenGLFunctions_2_1::glLoadTransposeMatrixf(const GLfloat *m)
-{
- d_1_3_Deprecated->f.LoadTransposeMatrixf(m);
-}
-
-inline void QOpenGLFunctions_2_1::glMultiTexCoord4sv(GLenum target, const GLshort *v)
-{
- d_1_3_Deprecated->f.MultiTexCoord4sv(target, v);
-}
-
-inline void QOpenGLFunctions_2_1::glMultiTexCoord4s(GLenum target, GLshort s, GLshort t, GLshort r, GLshort q)
-{
- d_1_3_Deprecated->f.MultiTexCoord4s(target, s, t, r, q);
-}
-
-inline void QOpenGLFunctions_2_1::glMultiTexCoord4iv(GLenum target, const GLint *v)
-{
- d_1_3_Deprecated->f.MultiTexCoord4iv(target, v);
-}
-
-inline void QOpenGLFunctions_2_1::glMultiTexCoord4i(GLenum target, GLint s, GLint t, GLint r, GLint q)
-{
- d_1_3_Deprecated->f.MultiTexCoord4i(target, s, t, r, q);
-}
-
-inline void QOpenGLFunctions_2_1::glMultiTexCoord4fv(GLenum target, const GLfloat *v)
-{
- d_1_3_Deprecated->f.MultiTexCoord4fv(target, v);
-}
-
-inline void QOpenGLFunctions_2_1::glMultiTexCoord4f(GLenum target, GLfloat s, GLfloat t, GLfloat r, GLfloat q)
-{
- d_1_3_Deprecated->f.MultiTexCoord4f(target, s, t, r, q);
-}
-
-inline void QOpenGLFunctions_2_1::glMultiTexCoord4dv(GLenum target, const GLdouble *v)
-{
- d_1_3_Deprecated->f.MultiTexCoord4dv(target, v);
-}
-
-inline void QOpenGLFunctions_2_1::glMultiTexCoord4d(GLenum target, GLdouble s, GLdouble t, GLdouble r, GLdouble q)
-{
- d_1_3_Deprecated->f.MultiTexCoord4d(target, s, t, r, q);
-}
-
-inline void QOpenGLFunctions_2_1::glMultiTexCoord3sv(GLenum target, const GLshort *v)
-{
- d_1_3_Deprecated->f.MultiTexCoord3sv(target, v);
-}
-
-inline void QOpenGLFunctions_2_1::glMultiTexCoord3s(GLenum target, GLshort s, GLshort t, GLshort r)
-{
- d_1_3_Deprecated->f.MultiTexCoord3s(target, s, t, r);
-}
-
-inline void QOpenGLFunctions_2_1::glMultiTexCoord3iv(GLenum target, const GLint *v)
-{
- d_1_3_Deprecated->f.MultiTexCoord3iv(target, v);
-}
-
-inline void QOpenGLFunctions_2_1::glMultiTexCoord3i(GLenum target, GLint s, GLint t, GLint r)
-{
- d_1_3_Deprecated->f.MultiTexCoord3i(target, s, t, r);
-}
-
-inline void QOpenGLFunctions_2_1::glMultiTexCoord3fv(GLenum target, const GLfloat *v)
-{
- d_1_3_Deprecated->f.MultiTexCoord3fv(target, v);
-}
-
-inline void QOpenGLFunctions_2_1::glMultiTexCoord3f(GLenum target, GLfloat s, GLfloat t, GLfloat r)
-{
- d_1_3_Deprecated->f.MultiTexCoord3f(target, s, t, r);
-}
-
-inline void QOpenGLFunctions_2_1::glMultiTexCoord3dv(GLenum target, const GLdouble *v)
-{
- d_1_3_Deprecated->f.MultiTexCoord3dv(target, v);
-}
-
-inline void QOpenGLFunctions_2_1::glMultiTexCoord3d(GLenum target, GLdouble s, GLdouble t, GLdouble r)
-{
- d_1_3_Deprecated->f.MultiTexCoord3d(target, s, t, r);
-}
-
-inline void QOpenGLFunctions_2_1::glMultiTexCoord2sv(GLenum target, const GLshort *v)
-{
- d_1_3_Deprecated->f.MultiTexCoord2sv(target, v);
-}
-
-inline void QOpenGLFunctions_2_1::glMultiTexCoord2s(GLenum target, GLshort s, GLshort t)
-{
- d_1_3_Deprecated->f.MultiTexCoord2s(target, s, t);
-}
-
-inline void QOpenGLFunctions_2_1::glMultiTexCoord2iv(GLenum target, const GLint *v)
-{
- d_1_3_Deprecated->f.MultiTexCoord2iv(target, v);
-}
-
-inline void QOpenGLFunctions_2_1::glMultiTexCoord2i(GLenum target, GLint s, GLint t)
-{
- d_1_3_Deprecated->f.MultiTexCoord2i(target, s, t);
-}
-
-inline void QOpenGLFunctions_2_1::glMultiTexCoord2fv(GLenum target, const GLfloat *v)
-{
- d_1_3_Deprecated->f.MultiTexCoord2fv(target, v);
-}
-
-inline void QOpenGLFunctions_2_1::glMultiTexCoord2f(GLenum target, GLfloat s, GLfloat t)
-{
- d_1_3_Deprecated->f.MultiTexCoord2f(target, s, t);
-}
-
-inline void QOpenGLFunctions_2_1::glMultiTexCoord2dv(GLenum target, const GLdouble *v)
-{
- d_1_3_Deprecated->f.MultiTexCoord2dv(target, v);
-}
-
-inline void QOpenGLFunctions_2_1::glMultiTexCoord2d(GLenum target, GLdouble s, GLdouble t)
-{
- d_1_3_Deprecated->f.MultiTexCoord2d(target, s, t);
-}
-
-inline void QOpenGLFunctions_2_1::glMultiTexCoord1sv(GLenum target, const GLshort *v)
-{
- d_1_3_Deprecated->f.MultiTexCoord1sv(target, v);
-}
-
-inline void QOpenGLFunctions_2_1::glMultiTexCoord1s(GLenum target, GLshort s)
-{
- d_1_3_Deprecated->f.MultiTexCoord1s(target, s);
-}
-
-inline void QOpenGLFunctions_2_1::glMultiTexCoord1iv(GLenum target, const GLint *v)
-{
- d_1_3_Deprecated->f.MultiTexCoord1iv(target, v);
-}
-
-inline void QOpenGLFunctions_2_1::glMultiTexCoord1i(GLenum target, GLint s)
-{
- d_1_3_Deprecated->f.MultiTexCoord1i(target, s);
-}
-
-inline void QOpenGLFunctions_2_1::glMultiTexCoord1fv(GLenum target, const GLfloat *v)
-{
- d_1_3_Deprecated->f.MultiTexCoord1fv(target, v);
-}
-
-inline void QOpenGLFunctions_2_1::glMultiTexCoord1f(GLenum target, GLfloat s)
-{
- d_1_3_Deprecated->f.MultiTexCoord1f(target, s);
-}
-
-inline void QOpenGLFunctions_2_1::glMultiTexCoord1dv(GLenum target, const GLdouble *v)
-{
- d_1_3_Deprecated->f.MultiTexCoord1dv(target, v);
-}
-
-inline void QOpenGLFunctions_2_1::glMultiTexCoord1d(GLenum target, GLdouble s)
-{
- d_1_3_Deprecated->f.MultiTexCoord1d(target, s);
-}
-
-inline void QOpenGLFunctions_2_1::glClientActiveTexture(GLenum texture)
-{
- d_1_3_Deprecated->f.ClientActiveTexture(texture);
-}
-
-
-// OpenGL 1.4 deprecated functions
-inline void QOpenGLFunctions_2_1::glWindowPos3sv(const GLshort *v)
-{
- d_1_4_Deprecated->f.WindowPos3sv(v);
-}
-
-inline void QOpenGLFunctions_2_1::glWindowPos3s(GLshort x, GLshort y, GLshort z)
-{
- d_1_4_Deprecated->f.WindowPos3s(x, y, z);
-}
-
-inline void QOpenGLFunctions_2_1::glWindowPos3iv(const GLint *v)
-{
- d_1_4_Deprecated->f.WindowPos3iv(v);
-}
-
-inline void QOpenGLFunctions_2_1::glWindowPos3i(GLint x, GLint y, GLint z)
-{
- d_1_4_Deprecated->f.WindowPos3i(x, y, z);
-}
-
-inline void QOpenGLFunctions_2_1::glWindowPos3fv(const GLfloat *v)
-{
- d_1_4_Deprecated->f.WindowPos3fv(v);
-}
-
-inline void QOpenGLFunctions_2_1::glWindowPos3f(GLfloat x, GLfloat y, GLfloat z)
-{
- d_1_4_Deprecated->f.WindowPos3f(x, y, z);
-}
-
-inline void QOpenGLFunctions_2_1::glWindowPos3dv(const GLdouble *v)
-{
- d_1_4_Deprecated->f.WindowPos3dv(v);
-}
-
-inline void QOpenGLFunctions_2_1::glWindowPos3d(GLdouble x, GLdouble y, GLdouble z)
-{
- d_1_4_Deprecated->f.WindowPos3d(x, y, z);
-}
-
-inline void QOpenGLFunctions_2_1::glWindowPos2sv(const GLshort *v)
-{
- d_1_4_Deprecated->f.WindowPos2sv(v);
-}
-
-inline void QOpenGLFunctions_2_1::glWindowPos2s(GLshort x, GLshort y)
-{
- d_1_4_Deprecated->f.WindowPos2s(x, y);
-}
-
-inline void QOpenGLFunctions_2_1::glWindowPos2iv(const GLint *v)
-{
- d_1_4_Deprecated->f.WindowPos2iv(v);
-}
-
-inline void QOpenGLFunctions_2_1::glWindowPos2i(GLint x, GLint y)
-{
- d_1_4_Deprecated->f.WindowPos2i(x, y);
-}
-
-inline void QOpenGLFunctions_2_1::glWindowPos2fv(const GLfloat *v)
-{
- d_1_4_Deprecated->f.WindowPos2fv(v);
-}
-
-inline void QOpenGLFunctions_2_1::glWindowPos2f(GLfloat x, GLfloat y)
-{
- d_1_4_Deprecated->f.WindowPos2f(x, y);
-}
-
-inline void QOpenGLFunctions_2_1::glWindowPos2dv(const GLdouble *v)
-{
- d_1_4_Deprecated->f.WindowPos2dv(v);
-}
-
-inline void QOpenGLFunctions_2_1::glWindowPos2d(GLdouble x, GLdouble y)
-{
- d_1_4_Deprecated->f.WindowPos2d(x, y);
-}
-
-inline void QOpenGLFunctions_2_1::glSecondaryColorPointer(GLint size, GLenum type, GLsizei stride, const GLvoid *pointer)
-{
- d_1_4_Deprecated->f.SecondaryColorPointer(size, type, stride, pointer);
-}
-
-inline void QOpenGLFunctions_2_1::glSecondaryColor3usv(const GLushort *v)
-{
- d_1_4_Deprecated->f.SecondaryColor3usv(v);
-}
-
-inline void QOpenGLFunctions_2_1::glSecondaryColor3us(GLushort red, GLushort green, GLushort blue)
-{
- d_1_4_Deprecated->f.SecondaryColor3us(red, green, blue);
-}
-
-inline void QOpenGLFunctions_2_1::glSecondaryColor3uiv(const GLuint *v)
-{
- d_1_4_Deprecated->f.SecondaryColor3uiv(v);
-}
-
-inline void QOpenGLFunctions_2_1::glSecondaryColor3ui(GLuint red, GLuint green, GLuint blue)
-{
- d_1_4_Deprecated->f.SecondaryColor3ui(red, green, blue);
-}
-
-inline void QOpenGLFunctions_2_1::glSecondaryColor3ubv(const GLubyte *v)
-{
- d_1_4_Deprecated->f.SecondaryColor3ubv(v);
-}
-
-inline void QOpenGLFunctions_2_1::glSecondaryColor3ub(GLubyte red, GLubyte green, GLubyte blue)
-{
- d_1_4_Deprecated->f.SecondaryColor3ub(red, green, blue);
-}
-
-inline void QOpenGLFunctions_2_1::glSecondaryColor3sv(const GLshort *v)
-{
- d_1_4_Deprecated->f.SecondaryColor3sv(v);
-}
-
-inline void QOpenGLFunctions_2_1::glSecondaryColor3s(GLshort red, GLshort green, GLshort blue)
-{
- d_1_4_Deprecated->f.SecondaryColor3s(red, green, blue);
-}
-
-inline void QOpenGLFunctions_2_1::glSecondaryColor3iv(const GLint *v)
-{
- d_1_4_Deprecated->f.SecondaryColor3iv(v);
-}
-
-inline void QOpenGLFunctions_2_1::glSecondaryColor3i(GLint red, GLint green, GLint blue)
-{
- d_1_4_Deprecated->f.SecondaryColor3i(red, green, blue);
-}
-
-inline void QOpenGLFunctions_2_1::glSecondaryColor3fv(const GLfloat *v)
-{
- d_1_4_Deprecated->f.SecondaryColor3fv(v);
-}
-
-inline void QOpenGLFunctions_2_1::glSecondaryColor3f(GLfloat red, GLfloat green, GLfloat blue)
-{
- d_1_4_Deprecated->f.SecondaryColor3f(red, green, blue);
-}
-
-inline void QOpenGLFunctions_2_1::glSecondaryColor3dv(const GLdouble *v)
-{
- d_1_4_Deprecated->f.SecondaryColor3dv(v);
-}
-
-inline void QOpenGLFunctions_2_1::glSecondaryColor3d(GLdouble red, GLdouble green, GLdouble blue)
-{
- d_1_4_Deprecated->f.SecondaryColor3d(red, green, blue);
-}
-
-inline void QOpenGLFunctions_2_1::glSecondaryColor3bv(const GLbyte *v)
-{
- d_1_4_Deprecated->f.SecondaryColor3bv(v);
-}
-
-inline void QOpenGLFunctions_2_1::glSecondaryColor3b(GLbyte red, GLbyte green, GLbyte blue)
-{
- d_1_4_Deprecated->f.SecondaryColor3b(red, green, blue);
-}
-
-inline void QOpenGLFunctions_2_1::glFogCoordPointer(GLenum type, GLsizei stride, const GLvoid *pointer)
-{
- d_1_4_Deprecated->f.FogCoordPointer(type, stride, pointer);
-}
-
-inline void QOpenGLFunctions_2_1::glFogCoorddv(const GLdouble *coord)
-{
- d_1_4_Deprecated->f.FogCoorddv(coord);
-}
-
-inline void QOpenGLFunctions_2_1::glFogCoordd(GLdouble coord)
-{
- d_1_4_Deprecated->f.FogCoordd(coord);
-}
-
-inline void QOpenGLFunctions_2_1::glFogCoordfv(const GLfloat *coord)
-{
- d_1_4_Deprecated->f.FogCoordfv(coord);
-}
-
-inline void QOpenGLFunctions_2_1::glFogCoordf(GLfloat coord)
-{
- d_1_4_Deprecated->f.FogCoordf(coord);
-}
-
-
-// OpenGL 1.5 deprecated functions
-
-// OpenGL 2.0 deprecated functions
-inline void QOpenGLFunctions_2_1::glVertexAttrib4usv(GLuint index, const GLushort *v)
-{
- d_2_0_Core->f.VertexAttrib4usv(index, v);
-}
-
-inline void QOpenGLFunctions_2_1::glVertexAttrib4uiv(GLuint index, const GLuint *v)
-{
- d_2_0_Core->f.VertexAttrib4uiv(index, v);
-}
-
-inline void QOpenGLFunctions_2_1::glVertexAttrib4ubv(GLuint index, const GLubyte *v)
-{
- d_2_0_Core->f.VertexAttrib4ubv(index, v);
-}
-
-inline void QOpenGLFunctions_2_1::glVertexAttrib4sv(GLuint index, const GLshort *v)
-{
- d_2_0_Core->f.VertexAttrib4sv(index, v);
-}
-
-inline void QOpenGLFunctions_2_1::glVertexAttrib4s(GLuint index, GLshort x, GLshort y, GLshort z, GLshort w)
-{
- d_2_0_Core->f.VertexAttrib4s(index, x, y, z, w);
-}
-
-inline void QOpenGLFunctions_2_1::glVertexAttrib4iv(GLuint index, const GLint *v)
-{
- d_2_0_Core->f.VertexAttrib4iv(index, v);
-}
-
-inline void QOpenGLFunctions_2_1::glVertexAttrib4fv(GLuint index, const GLfloat *v)
-{
- d_2_0_Core->f.VertexAttrib4fv(index, v);
-}
-
-inline void QOpenGLFunctions_2_1::glVertexAttrib4f(GLuint index, GLfloat x, GLfloat y, GLfloat z, GLfloat w)
-{
- d_2_0_Core->f.VertexAttrib4f(index, x, y, z, w);
-}
-
-inline void QOpenGLFunctions_2_1::glVertexAttrib4dv(GLuint index, const GLdouble *v)
-{
- d_2_0_Core->f.VertexAttrib4dv(index, v);
-}
-
-inline void QOpenGLFunctions_2_1::glVertexAttrib4d(GLuint index, GLdouble x, GLdouble y, GLdouble z, GLdouble w)
-{
- d_2_0_Core->f.VertexAttrib4d(index, x, y, z, w);
-}
-
-inline void QOpenGLFunctions_2_1::glVertexAttrib4bv(GLuint index, const GLbyte *v)
-{
- d_2_0_Core->f.VertexAttrib4bv(index, v);
-}
-
-inline void QOpenGLFunctions_2_1::glVertexAttrib4Nusv(GLuint index, const GLushort *v)
-{
- d_2_0_Core->f.VertexAttrib4Nusv(index, v);
-}
-
-inline void QOpenGLFunctions_2_1::glVertexAttrib4Nuiv(GLuint index, const GLuint *v)
-{
- d_2_0_Core->f.VertexAttrib4Nuiv(index, v);
-}
-
-inline void QOpenGLFunctions_2_1::glVertexAttrib4Nubv(GLuint index, const GLubyte *v)
-{
- d_2_0_Core->f.VertexAttrib4Nubv(index, v);
-}
-
-inline void QOpenGLFunctions_2_1::glVertexAttrib4Nub(GLuint index, GLubyte x, GLubyte y, GLubyte z, GLubyte w)
-{
- d_2_0_Core->f.VertexAttrib4Nub(index, x, y, z, w);
-}
-
-inline void QOpenGLFunctions_2_1::glVertexAttrib4Nsv(GLuint index, const GLshort *v)
-{
- d_2_0_Core->f.VertexAttrib4Nsv(index, v);
-}
-
-inline void QOpenGLFunctions_2_1::glVertexAttrib4Niv(GLuint index, const GLint *v)
-{
- d_2_0_Core->f.VertexAttrib4Niv(index, v);
-}
-
-inline void QOpenGLFunctions_2_1::glVertexAttrib4Nbv(GLuint index, const GLbyte *v)
-{
- d_2_0_Core->f.VertexAttrib4Nbv(index, v);
-}
-
-inline void QOpenGLFunctions_2_1::glVertexAttrib3sv(GLuint index, const GLshort *v)
-{
- d_2_0_Core->f.VertexAttrib3sv(index, v);
-}
-
-inline void QOpenGLFunctions_2_1::glVertexAttrib3s(GLuint index, GLshort x, GLshort y, GLshort z)
-{
- d_2_0_Core->f.VertexAttrib3s(index, x, y, z);
-}
-
-inline void QOpenGLFunctions_2_1::glVertexAttrib3fv(GLuint index, const GLfloat *v)
-{
- d_2_0_Core->f.VertexAttrib3fv(index, v);
-}
-
-inline void QOpenGLFunctions_2_1::glVertexAttrib3f(GLuint index, GLfloat x, GLfloat y, GLfloat z)
-{
- d_2_0_Core->f.VertexAttrib3f(index, x, y, z);
-}
-
-inline void QOpenGLFunctions_2_1::glVertexAttrib3dv(GLuint index, const GLdouble *v)
-{
- d_2_0_Core->f.VertexAttrib3dv(index, v);
-}
-
-inline void QOpenGLFunctions_2_1::glVertexAttrib3d(GLuint index, GLdouble x, GLdouble y, GLdouble z)
-{
- d_2_0_Core->f.VertexAttrib3d(index, x, y, z);
-}
-
-inline void QOpenGLFunctions_2_1::glVertexAttrib2sv(GLuint index, const GLshort *v)
-{
- d_2_0_Core->f.VertexAttrib2sv(index, v);
-}
-
-inline void QOpenGLFunctions_2_1::glVertexAttrib2s(GLuint index, GLshort x, GLshort y)
-{
- d_2_0_Core->f.VertexAttrib2s(index, x, y);
-}
-
-inline void QOpenGLFunctions_2_1::glVertexAttrib2fv(GLuint index, const GLfloat *v)
-{
- d_2_0_Core->f.VertexAttrib2fv(index, v);
-}
-
-inline void QOpenGLFunctions_2_1::glVertexAttrib2f(GLuint index, GLfloat x, GLfloat y)
-{
- d_2_0_Core->f.VertexAttrib2f(index, x, y);
-}
-
-inline void QOpenGLFunctions_2_1::glVertexAttrib2dv(GLuint index, const GLdouble *v)
-{
- d_2_0_Core->f.VertexAttrib2dv(index, v);
-}
-
-inline void QOpenGLFunctions_2_1::glVertexAttrib2d(GLuint index, GLdouble x, GLdouble y)
-{
- d_2_0_Core->f.VertexAttrib2d(index, x, y);
-}
-
-inline void QOpenGLFunctions_2_1::glVertexAttrib1sv(GLuint index, const GLshort *v)
-{
- d_2_0_Core->f.VertexAttrib1sv(index, v);
-}
-
-inline void QOpenGLFunctions_2_1::glVertexAttrib1s(GLuint index, GLshort x)
-{
- d_2_0_Core->f.VertexAttrib1s(index, x);
-}
-
-inline void QOpenGLFunctions_2_1::glVertexAttrib1fv(GLuint index, const GLfloat *v)
-{
- d_2_0_Core->f.VertexAttrib1fv(index, v);
-}
-
-inline void QOpenGLFunctions_2_1::glVertexAttrib1f(GLuint index, GLfloat x)
-{
- d_2_0_Core->f.VertexAttrib1f(index, x);
-}
-
-inline void QOpenGLFunctions_2_1::glVertexAttrib1dv(GLuint index, const GLdouble *v)
-{
- d_2_0_Core->f.VertexAttrib1dv(index, v);
-}
-
-inline void QOpenGLFunctions_2_1::glVertexAttrib1d(GLuint index, GLdouble x)
-{
- d_2_0_Core->f.VertexAttrib1d(index, x);
-}
-
-
-// OpenGL 2.1 deprecated functions
-
-
-QT_END_NAMESPACE
-
-#endif // QT_NO_OPENGL && !QT_OPENGL_ES_2
-
-#endif
diff --git a/src/gui/opengl/qopenglfunctions_3_0.cpp b/src/gui/opengl/qopenglfunctions_3_0.cpp
deleted file mode 100644
index 7d0e900659..0000000000
--- a/src/gui/opengl/qopenglfunctions_3_0.cpp
+++ /dev/null
@@ -1,246 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2013 Klaralvdalens Datakonsult AB (KDAB)
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the QtGui module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-**
-** This file was generated by glgen version 0.1
-** Command line was: glgen
-**
-** glgen is Copyright (C) 2013 Klaralvdalens Datakonsult AB (KDAB)
-**
-** This is an auto-generated file.
-** Do not edit! All changes made to it will be lost.
-**
-****************************************************************************/
-
-#include "qopenglfunctions_3_0.h"
-#include "qopenglcontext.h"
-
-QT_BEGIN_NAMESPACE
-
-/*!
- \class QOpenGLFunctions_3_0
- \inmodule QtGui
- \since 5.1
- \wrapper
- \brief The QOpenGLFunctions_3_0 class provides all functions for OpenGL 3.0 specification.
-
- This class is a wrapper for functions from OpenGL 3.0 specification.
- See reference pages on \l {http://www.opengl.org/sdk/docs/}{opengl.org}
- for function documentation.
-
- \sa QAbstractOpenGLFunctions
-*/
-
-QOpenGLFunctions_3_0::QOpenGLFunctions_3_0()
- : QAbstractOpenGLFunctions()
- , d_1_0_Core(nullptr)
- , d_1_1_Core(nullptr)
- , d_1_2_Core(nullptr)
- , d_1_3_Core(nullptr)
- , d_1_4_Core(nullptr)
- , d_1_5_Core(nullptr)
- , d_2_0_Core(nullptr)
- , d_2_1_Core(nullptr)
- , d_3_0_Core(nullptr)
- , d_1_0_Deprecated(nullptr)
- , d_1_1_Deprecated(nullptr)
- , d_1_2_Deprecated(nullptr)
- , d_1_3_Deprecated(nullptr)
- , d_1_4_Deprecated(nullptr)
- , m_reserved_2_0_Deprecated(nullptr)
- , m_reserved_3_0_Deprecated(nullptr)
-{
-}
-
-QOpenGLFunctions_3_0::~QOpenGLFunctions_3_0()
-{
- if (d_1_0_Core) {
- d_1_0_Core->refs.deref();
- Q_ASSERT(d_1_0_Core->refs.loadRelaxed());
- }
- if (d_1_1_Core) {
- d_1_1_Core->refs.deref();
- Q_ASSERT(d_1_1_Core->refs.loadRelaxed());
- }
- if (d_1_2_Core) {
- d_1_2_Core->refs.deref();
- Q_ASSERT(d_1_2_Core->refs.loadRelaxed());
- }
- if (d_1_3_Core) {
- d_1_3_Core->refs.deref();
- Q_ASSERT(d_1_3_Core->refs.loadRelaxed());
- }
- if (d_1_4_Core) {
- d_1_4_Core->refs.deref();
- Q_ASSERT(d_1_4_Core->refs.loadRelaxed());
- }
- if (d_1_5_Core) {
- d_1_5_Core->refs.deref();
- Q_ASSERT(d_1_5_Core->refs.loadRelaxed());
- }
- if (d_2_0_Core) {
- d_2_0_Core->refs.deref();
- Q_ASSERT(d_2_0_Core->refs.loadRelaxed());
- }
- if (d_2_1_Core) {
- d_2_1_Core->refs.deref();
- Q_ASSERT(d_2_1_Core->refs.loadRelaxed());
- }
- if (d_3_0_Core) {
- d_3_0_Core->refs.deref();
- Q_ASSERT(d_3_0_Core->refs.loadRelaxed());
- }
- if (d_1_0_Deprecated) {
- d_1_0_Deprecated->refs.deref();
- Q_ASSERT(d_1_0_Deprecated->refs.loadRelaxed());
- }
- if (d_1_1_Deprecated) {
- d_1_1_Deprecated->refs.deref();
- Q_ASSERT(d_1_1_Deprecated->refs.loadRelaxed());
- }
- if (d_1_2_Deprecated) {
- d_1_2_Deprecated->refs.deref();
- Q_ASSERT(d_1_2_Deprecated->refs.loadRelaxed());
- }
- if (d_1_3_Deprecated) {
- d_1_3_Deprecated->refs.deref();
- Q_ASSERT(d_1_3_Deprecated->refs.loadRelaxed());
- }
- if (d_1_4_Deprecated) {
- d_1_4_Deprecated->refs.deref();
- Q_ASSERT(d_1_4_Deprecated->refs.loadRelaxed());
- }
-}
-
-bool QOpenGLFunctions_3_0::initializeOpenGLFunctions()
-{
- if ( isInitialized() )
- return true;
-
- QOpenGLContext* context = QOpenGLContext::currentContext();
-
- // If owned by a context object make sure it is current.
- // Also check that current context is capable of resolving all needed functions
- if (((owningContext() && owningContext() == context) || !owningContext())
- && QOpenGLFunctions_3_0::isContextCompatible(context))
- {
- // Associate with private implementation, creating if necessary
- // Function pointers in the backends are resolved at creation time
- QOpenGLVersionFunctionsBackend* d = nullptr;
- d = QAbstractOpenGLFunctionsPrivate::functionsBackend(context, QOpenGLFunctions_1_0_CoreBackend::versionStatus());
- d_1_0_Core = static_cast<QOpenGLFunctions_1_0_CoreBackend*>(d);
- d->refs.ref();
-
- d = QAbstractOpenGLFunctionsPrivate::functionsBackend(context, QOpenGLFunctions_1_1_CoreBackend::versionStatus());
- d_1_1_Core = static_cast<QOpenGLFunctions_1_1_CoreBackend*>(d);
- d->refs.ref();
-
- d = QAbstractOpenGLFunctionsPrivate::functionsBackend(context, QOpenGLFunctions_1_2_CoreBackend::versionStatus());
- d_1_2_Core = static_cast<QOpenGLFunctions_1_2_CoreBackend*>(d);
- d->refs.ref();
-
- d = QAbstractOpenGLFunctionsPrivate::functionsBackend(context, QOpenGLFunctions_1_3_CoreBackend::versionStatus());
- d_1_3_Core = static_cast<QOpenGLFunctions_1_3_CoreBackend*>(d);
- d->refs.ref();
-
- d = QAbstractOpenGLFunctionsPrivate::functionsBackend(context, QOpenGLFunctions_1_4_CoreBackend::versionStatus());
- d_1_4_Core = static_cast<QOpenGLFunctions_1_4_CoreBackend*>(d);
- d->refs.ref();
-
- d = QAbstractOpenGLFunctionsPrivate::functionsBackend(context, QOpenGLFunctions_1_5_CoreBackend::versionStatus());
- d_1_5_Core = static_cast<QOpenGLFunctions_1_5_CoreBackend*>(d);
- d->refs.ref();
-
- d = QAbstractOpenGLFunctionsPrivate::functionsBackend(context, QOpenGLFunctions_2_0_CoreBackend::versionStatus());
- d_2_0_Core = static_cast<QOpenGLFunctions_2_0_CoreBackend*>(d);
- d->refs.ref();
-
- d = QAbstractOpenGLFunctionsPrivate::functionsBackend(context, QOpenGLFunctions_2_1_CoreBackend::versionStatus());
- d_2_1_Core = static_cast<QOpenGLFunctions_2_1_CoreBackend*>(d);
- d->refs.ref();
-
- d = QAbstractOpenGLFunctionsPrivate::functionsBackend(context, QOpenGLFunctions_3_0_CoreBackend::versionStatus());
- d_3_0_Core = static_cast<QOpenGLFunctions_3_0_CoreBackend*>(d);
- d->refs.ref();
-
- d = QAbstractOpenGLFunctionsPrivate::functionsBackend(context, QOpenGLFunctions_1_0_DeprecatedBackend::versionStatus());
- d_1_0_Deprecated = static_cast<QOpenGLFunctions_1_0_DeprecatedBackend*>(d);
- d->refs.ref();
-
- d = QAbstractOpenGLFunctionsPrivate::functionsBackend(context, QOpenGLFunctions_1_1_DeprecatedBackend::versionStatus());
- d_1_1_Deprecated = static_cast<QOpenGLFunctions_1_1_DeprecatedBackend*>(d);
- d->refs.ref();
-
- d = QAbstractOpenGLFunctionsPrivate::functionsBackend(context, QOpenGLFunctions_1_2_DeprecatedBackend::versionStatus());
- d_1_2_Deprecated = static_cast<QOpenGLFunctions_1_2_DeprecatedBackend*>(d);
- d->refs.ref();
-
- d = QAbstractOpenGLFunctionsPrivate::functionsBackend(context, QOpenGLFunctions_1_3_DeprecatedBackend::versionStatus());
- d_1_3_Deprecated = static_cast<QOpenGLFunctions_1_3_DeprecatedBackend*>(d);
- d->refs.ref();
-
- d = QAbstractOpenGLFunctionsPrivate::functionsBackend(context, QOpenGLFunctions_1_4_DeprecatedBackend::versionStatus());
- d_1_4_Deprecated = static_cast<QOpenGLFunctions_1_4_DeprecatedBackend*>(d);
- d->refs.ref();
-
- QAbstractOpenGLFunctions::initializeOpenGLFunctions();
- }
- return isInitialized();
-}
-
-bool QOpenGLFunctions_3_0::isContextCompatible(QOpenGLContext *context)
-{
- Q_ASSERT(context);
- QSurfaceFormat f = context->format();
- const QPair<int, int> v = qMakePair(f.majorVersion(), f.minorVersion());
- if (v < qMakePair(3, 0))
- return false;
-
- if (f.profile() == QSurfaceFormat::CoreProfile)
- return false;
-
- return true;
-}
-
-QOpenGLVersionProfile QOpenGLFunctions_3_0::versionProfile()
-{
- QOpenGLVersionProfile v;
- v.setVersion(3, 0);
- return v;
-}
-
-QT_END_NAMESPACE
diff --git a/src/gui/opengl/qopenglfunctions_3_0.h b/src/gui/opengl/qopenglfunctions_3_0.h
deleted file mode 100644
index c592050c24..0000000000
--- a/src/gui/opengl/qopenglfunctions_3_0.h
+++ /dev/null
@@ -1,4173 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2013 Klaralvdalens Datakonsult AB (KDAB)
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the QtGui module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-**
-** This file was generated by glgen version 0.1
-** Command line was: glgen
-**
-** glgen is Copyright (C) 2013 Klaralvdalens Datakonsult AB (KDAB)
-**
-** This is an auto-generated file.
-** Do not edit! All changes made to it will be lost.
-**
-****************************************************************************/
-
-#ifndef QOPENGLVERSIONFUNCTIONS_3_0_H
-#define QOPENGLVERSIONFUNCTIONS_3_0_H
-
-#include <QtGui/qtguiglobal.h>
-
-#if !defined(QT_NO_OPENGL) && !defined(QT_OPENGL_ES_2)
-
-#include <QtGui/QOpenGLVersionFunctions>
-#include <QtGui/qopenglcontext.h>
-
-QT_BEGIN_NAMESPACE
-
-class Q_GUI_EXPORT QOpenGLFunctions_3_0 : public QAbstractOpenGLFunctions
-{
-public:
- QOpenGLFunctions_3_0();
- ~QOpenGLFunctions_3_0();
-
- bool initializeOpenGLFunctions() override;
-
- // OpenGL 1.0 core functions
- void glViewport(GLint x, GLint y, GLsizei width, GLsizei height);
- void glDepthRange(GLdouble nearVal, GLdouble farVal);
- GLboolean glIsEnabled(GLenum cap);
- void glGetTexLevelParameteriv(GLenum target, GLint level, GLenum pname, GLint *params);
- void glGetTexLevelParameterfv(GLenum target, GLint level, GLenum pname, GLfloat *params);
- void glGetTexParameteriv(GLenum target, GLenum pname, GLint *params);
- void glGetTexParameterfv(GLenum target, GLenum pname, GLfloat *params);
- void glGetTexImage(GLenum target, GLint level, GLenum format, GLenum type, GLvoid *pixels);
- const GLubyte * glGetString(GLenum name);
- void glGetIntegerv(GLenum pname, GLint *params);
- void glGetFloatv(GLenum pname, GLfloat *params);
- GLenum glGetError();
- void glGetDoublev(GLenum pname, GLdouble *params);
- void glGetBooleanv(GLenum pname, GLboolean *params);
- void glReadPixels(GLint x, GLint y, GLsizei width, GLsizei height, GLenum format, GLenum type, GLvoid *pixels);
- void glReadBuffer(GLenum mode);
- void glPixelStorei(GLenum pname, GLint param);
- void glPixelStoref(GLenum pname, GLfloat param);
- void glDepthFunc(GLenum func);
- void glStencilOp(GLenum fail, GLenum zfail, GLenum zpass);
- void glStencilFunc(GLenum func, GLint ref, GLuint mask);
- void glLogicOp(GLenum opcode);
- void glBlendFunc(GLenum sfactor, GLenum dfactor);
- void glFlush();
- void glFinish();
- void glEnable(GLenum cap);
- void glDisable(GLenum cap);
- void glDepthMask(GLboolean flag);
- void glColorMask(GLboolean red, GLboolean green, GLboolean blue, GLboolean alpha);
- void glStencilMask(GLuint mask);
- void glClearDepth(GLdouble depth);
- void glClearStencil(GLint s);
- void glClearColor(GLfloat red, GLfloat green, GLfloat blue, GLfloat alpha);
- void glClear(GLbitfield mask);
- void glDrawBuffer(GLenum mode);
- void glTexImage2D(GLenum target, GLint level, GLint internalformat, GLsizei width, GLsizei height, GLint border, GLenum format, GLenum type, const GLvoid *pixels);
- void glTexImage1D(GLenum target, GLint level, GLint internalformat, GLsizei width, GLint border, GLenum format, GLenum type, const GLvoid *pixels);
- void glTexParameteriv(GLenum target, GLenum pname, const GLint *params);
- void glTexParameteri(GLenum target, GLenum pname, GLint param);
- void glTexParameterfv(GLenum target, GLenum pname, const GLfloat *params);
- void glTexParameterf(GLenum target, GLenum pname, GLfloat param);
- void glScissor(GLint x, GLint y, GLsizei width, GLsizei height);
- void glPolygonMode(GLenum face, GLenum mode);
- void glPointSize(GLfloat size);
- void glLineWidth(GLfloat width);
- void glHint(GLenum target, GLenum mode);
- void glFrontFace(GLenum mode);
- void glCullFace(GLenum mode);
-
- // OpenGL 1.1 core functions
- void glIndexubv(const GLubyte *c);
- void glIndexub(GLubyte c);
- GLboolean glIsTexture(GLuint texture);
- void glGenTextures(GLsizei n, GLuint *textures);
- void glDeleteTextures(GLsizei n, const GLuint *textures);
- void glBindTexture(GLenum target, GLuint texture);
- void glTexSubImage2D(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLenum type, const GLvoid *pixels);
- void glTexSubImage1D(GLenum target, GLint level, GLint xoffset, GLsizei width, GLenum format, GLenum type, const GLvoid *pixels);
- void glCopyTexSubImage2D(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint x, GLint y, GLsizei width, GLsizei height);
- void glCopyTexSubImage1D(GLenum target, GLint level, GLint xoffset, GLint x, GLint y, GLsizei width);
- void glCopyTexImage2D(GLenum target, GLint level, GLenum internalformat, GLint x, GLint y, GLsizei width, GLsizei height, GLint border);
- void glCopyTexImage1D(GLenum target, GLint level, GLenum internalformat, GLint x, GLint y, GLsizei width, GLint border);
- void glPolygonOffset(GLfloat factor, GLfloat units);
- void glGetPointerv(GLenum pname, GLvoid* *params);
- void glDrawElements(GLenum mode, GLsizei count, GLenum type, const GLvoid *indices);
- void glDrawArrays(GLenum mode, GLint first, GLsizei count);
-
- // OpenGL 1.2 core functions
- void glCopyTexSubImage3D(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLint x, GLint y, GLsizei width, GLsizei height);
- void glTexSubImage3D(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLenum type, const GLvoid *pixels);
- void glTexImage3D(GLenum target, GLint level, GLint internalformat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLenum format, GLenum type, const GLvoid *pixels);
- void glDrawRangeElements(GLenum mode, GLuint start, GLuint end, GLsizei count, GLenum type, const GLvoid *indices);
- void glBlendEquation(GLenum mode);
- void glBlendColor(GLfloat red, GLfloat green, GLfloat blue, GLfloat alpha);
-
- // OpenGL 1.3 core functions
- void glGetCompressedTexImage(GLenum target, GLint level, GLvoid *img);
- void glCompressedTexSubImage1D(GLenum target, GLint level, GLint xoffset, GLsizei width, GLenum format, GLsizei imageSize, const GLvoid *data);
- void glCompressedTexSubImage2D(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLsizei imageSize, const GLvoid *data);
- void glCompressedTexSubImage3D(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLsizei imageSize, const GLvoid *data);
- void glCompressedTexImage1D(GLenum target, GLint level, GLenum internalformat, GLsizei width, GLint border, GLsizei imageSize, const GLvoid *data);
- void glCompressedTexImage2D(GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLint border, GLsizei imageSize, const GLvoid *data);
- void glCompressedTexImage3D(GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLsizei imageSize, const GLvoid *data);
- void glSampleCoverage(GLfloat value, GLboolean invert);
- void glActiveTexture(GLenum texture);
-
- // OpenGL 1.4 core functions
- void glPointParameteriv(GLenum pname, const GLint *params);
- void glPointParameteri(GLenum pname, GLint param);
- void glPointParameterfv(GLenum pname, const GLfloat *params);
- void glPointParameterf(GLenum pname, GLfloat param);
- void glMultiDrawElements(GLenum mode, const GLsizei *count, GLenum type, const GLvoid* const *indices, GLsizei drawcount);
- void glMultiDrawArrays(GLenum mode, const GLint *first, const GLsizei *count, GLsizei drawcount);
- void glBlendFuncSeparate(GLenum sfactorRGB, GLenum dfactorRGB, GLenum sfactorAlpha, GLenum dfactorAlpha);
-
- // OpenGL 1.5 core functions
- void glGetBufferPointerv(GLenum target, GLenum pname, GLvoid* *params);
- void glGetBufferParameteriv(GLenum target, GLenum pname, GLint *params);
- GLboolean glUnmapBuffer(GLenum target);
- GLvoid* glMapBuffer(GLenum target, GLenum access);
- void glGetBufferSubData(GLenum target, GLintptr offset, GLsizeiptr size, GLvoid *data);
- void glBufferSubData(GLenum target, GLintptr offset, GLsizeiptr size, const GLvoid *data);
- void glBufferData(GLenum target, GLsizeiptr size, const GLvoid *data, GLenum usage);
- GLboolean glIsBuffer(GLuint buffer);
- void glGenBuffers(GLsizei n, GLuint *buffers);
- void glDeleteBuffers(GLsizei n, const GLuint *buffers);
- void glBindBuffer(GLenum target, GLuint buffer);
- void glGetQueryObjectuiv(GLuint id, GLenum pname, GLuint *params);
- void glGetQueryObjectiv(GLuint id, GLenum pname, GLint *params);
- void glGetQueryiv(GLenum target, GLenum pname, GLint *params);
- void glEndQuery(GLenum target);
- void glBeginQuery(GLenum target, GLuint id);
- GLboolean glIsQuery(GLuint id);
- void glDeleteQueries(GLsizei n, const GLuint *ids);
- void glGenQueries(GLsizei n, GLuint *ids);
-
- // OpenGL 2.0 core functions
- void glVertexAttribPointer(GLuint index, GLint size, GLenum type, GLboolean normalized, GLsizei stride, const GLvoid *pointer);
- void glValidateProgram(GLuint program);
- void glUniformMatrix4fv(GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
- void glUniformMatrix3fv(GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
- void glUniformMatrix2fv(GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
- void glUniform4iv(GLint location, GLsizei count, const GLint *value);
- void glUniform3iv(GLint location, GLsizei count, const GLint *value);
- void glUniform2iv(GLint location, GLsizei count, const GLint *value);
- void glUniform1iv(GLint location, GLsizei count, const GLint *value);
- void glUniform4fv(GLint location, GLsizei count, const GLfloat *value);
- void glUniform3fv(GLint location, GLsizei count, const GLfloat *value);
- void glUniform2fv(GLint location, GLsizei count, const GLfloat *value);
- void glUniform1fv(GLint location, GLsizei count, const GLfloat *value);
- void glUniform4i(GLint location, GLint v0, GLint v1, GLint v2, GLint v3);
- void glUniform3i(GLint location, GLint v0, GLint v1, GLint v2);
- void glUniform2i(GLint location, GLint v0, GLint v1);
- void glUniform1i(GLint location, GLint v0);
- void glUniform4f(GLint location, GLfloat v0, GLfloat v1, GLfloat v2, GLfloat v3);
- void glUniform3f(GLint location, GLfloat v0, GLfloat v1, GLfloat v2);
- void glUniform2f(GLint location, GLfloat v0, GLfloat v1);
- void glUniform1f(GLint location, GLfloat v0);
- void glUseProgram(GLuint program);
- void glShaderSource(GLuint shader, GLsizei count, const GLchar* const *string, const GLint *length);
- void glLinkProgram(GLuint program);
- GLboolean glIsShader(GLuint shader);
- GLboolean glIsProgram(GLuint program);
- void glGetVertexAttribPointerv(GLuint index, GLenum pname, GLvoid* *pointer);
- void glGetVertexAttribiv(GLuint index, GLenum pname, GLint *params);
- void glGetVertexAttribfv(GLuint index, GLenum pname, GLfloat *params);
- void glGetVertexAttribdv(GLuint index, GLenum pname, GLdouble *params);
- void glGetUniformiv(GLuint program, GLint location, GLint *params);
- void glGetUniformfv(GLuint program, GLint location, GLfloat *params);
- GLint glGetUniformLocation(GLuint program, const GLchar *name);
- void glGetShaderSource(GLuint shader, GLsizei bufSize, GLsizei *length, GLchar *source);
- void glGetShaderInfoLog(GLuint shader, GLsizei bufSize, GLsizei *length, GLchar *infoLog);
- void glGetShaderiv(GLuint shader, GLenum pname, GLint *params);
- void glGetProgramInfoLog(GLuint program, GLsizei bufSize, GLsizei *length, GLchar *infoLog);
- void glGetProgramiv(GLuint program, GLenum pname, GLint *params);
- GLint glGetAttribLocation(GLuint program, const GLchar *name);
- void glGetAttachedShaders(GLuint program, GLsizei maxCount, GLsizei *count, GLuint *obj);
- void glGetActiveUniform(GLuint program, GLuint index, GLsizei bufSize, GLsizei *length, GLint *size, GLenum *type, GLchar *name);
- void glGetActiveAttrib(GLuint program, GLuint index, GLsizei bufSize, GLsizei *length, GLint *size, GLenum *type, GLchar *name);
- void glEnableVertexAttribArray(GLuint index);
- void glDisableVertexAttribArray(GLuint index);
- void glDetachShader(GLuint program, GLuint shader);
- void glDeleteShader(GLuint shader);
- void glDeleteProgram(GLuint program);
- GLuint glCreateShader(GLenum type);
- GLuint glCreateProgram();
- void glCompileShader(GLuint shader);
- void glBindAttribLocation(GLuint program, GLuint index, const GLchar *name);
- void glAttachShader(GLuint program, GLuint shader);
- void glStencilMaskSeparate(GLenum face, GLuint mask);
- void glStencilFuncSeparate(GLenum face, GLenum func, GLint ref, GLuint mask);
- void glStencilOpSeparate(GLenum face, GLenum sfail, GLenum dpfail, GLenum dppass);
- void glDrawBuffers(GLsizei n, const GLenum *bufs);
- void glBlendEquationSeparate(GLenum modeRGB, GLenum modeAlpha);
-
- // OpenGL 2.1 core functions
- void glUniformMatrix4x3fv(GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
- void glUniformMatrix3x4fv(GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
- void glUniformMatrix4x2fv(GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
- void glUniformMatrix2x4fv(GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
- void glUniformMatrix3x2fv(GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
- void glUniformMatrix2x3fv(GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
-
- // OpenGL 3.0 core functions
- GLboolean glIsVertexArray(GLuint array);
- void glGenVertexArrays(GLsizei n, GLuint *arrays);
- void glDeleteVertexArrays(GLsizei n, const GLuint *arrays);
- void glBindVertexArray(GLuint array);
- void glFlushMappedBufferRange(GLenum target, GLintptr offset, GLsizeiptr length);
- GLvoid* glMapBufferRange(GLenum target, GLintptr offset, GLsizeiptr length, GLbitfield access);
- void glFramebufferTextureLayer(GLenum target, GLenum attachment, GLuint texture, GLint level, GLint layer);
- void glRenderbufferStorageMultisample(GLenum target, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height);
- void glBlitFramebuffer(GLint srcX0, GLint srcY0, GLint srcX1, GLint srcY1, GLint dstX0, GLint dstY0, GLint dstX1, GLint dstY1, GLbitfield mask, GLenum filter);
- void glGenerateMipmap(GLenum target);
- void glGetFramebufferAttachmentParameteriv(GLenum target, GLenum attachment, GLenum pname, GLint *params);
- void glFramebufferRenderbuffer(GLenum target, GLenum attachment, GLenum renderbuffertarget, GLuint renderbuffer);
- void glFramebufferTexture3D(GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level, GLint zoffset);
- void glFramebufferTexture2D(GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level);
- void glFramebufferTexture1D(GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level);
- GLenum glCheckFramebufferStatus(GLenum target);
- void glGenFramebuffers(GLsizei n, GLuint *framebuffers);
- void glDeleteFramebuffers(GLsizei n, const GLuint *framebuffers);
- void glBindFramebuffer(GLenum target, GLuint framebuffer);
- GLboolean glIsFramebuffer(GLuint framebuffer);
- void glGetRenderbufferParameteriv(GLenum target, GLenum pname, GLint *params);
- void glRenderbufferStorage(GLenum target, GLenum internalformat, GLsizei width, GLsizei height);
- void glGenRenderbuffers(GLsizei n, GLuint *renderbuffers);
- void glDeleteRenderbuffers(GLsizei n, const GLuint *renderbuffers);
- void glBindRenderbuffer(GLenum target, GLuint renderbuffer);
- GLboolean glIsRenderbuffer(GLuint renderbuffer);
- const GLubyte * glGetStringi(GLenum name, GLuint index);
- void glClearBufferfi(GLenum buffer, GLint drawbuffer, GLfloat depth, GLint stencil);
- void glClearBufferfv(GLenum buffer, GLint drawbuffer, const GLfloat *value);
- void glClearBufferuiv(GLenum buffer, GLint drawbuffer, const GLuint *value);
- void glClearBufferiv(GLenum buffer, GLint drawbuffer, const GLint *value);
- void glGetTexParameterIuiv(GLenum target, GLenum pname, GLuint *params);
- void glGetTexParameterIiv(GLenum target, GLenum pname, GLint *params);
- void glTexParameterIuiv(GLenum target, GLenum pname, const GLuint *params);
- void glTexParameterIiv(GLenum target, GLenum pname, const GLint *params);
- void glUniform4uiv(GLint location, GLsizei count, const GLuint *value);
- void glUniform3uiv(GLint location, GLsizei count, const GLuint *value);
- void glUniform2uiv(GLint location, GLsizei count, const GLuint *value);
- void glUniform1uiv(GLint location, GLsizei count, const GLuint *value);
- void glUniform4ui(GLint location, GLuint v0, GLuint v1, GLuint v2, GLuint v3);
- void glUniform3ui(GLint location, GLuint v0, GLuint v1, GLuint v2);
- void glUniform2ui(GLint location, GLuint v0, GLuint v1);
- void glUniform1ui(GLint location, GLuint v0);
- GLint glGetFragDataLocation(GLuint program, const GLchar *name);
- void glBindFragDataLocation(GLuint program, GLuint color, const GLchar *name);
- void glGetUniformuiv(GLuint program, GLint location, GLuint *params);
- void glGetVertexAttribIuiv(GLuint index, GLenum pname, GLuint *params);
- void glGetVertexAttribIiv(GLuint index, GLenum pname, GLint *params);
- void glVertexAttribIPointer(GLuint index, GLint size, GLenum type, GLsizei stride, const GLvoid *pointer);
- void glEndConditionalRender();
- void glBeginConditionalRender(GLuint id, GLenum mode);
- void glClampColor(GLenum target, GLenum clamp);
- void glGetTransformFeedbackVarying(GLuint program, GLuint index, GLsizei bufSize, GLsizei *length, GLsizei *size, GLenum *type, GLchar *name);
- void glTransformFeedbackVaryings(GLuint program, GLsizei count, const GLchar* const *varyings, GLenum bufferMode);
- void glBindBufferBase(GLenum target, GLuint index, GLuint buffer);
- void glBindBufferRange(GLenum target, GLuint index, GLuint buffer, GLintptr offset, GLsizeiptr size);
- void glEndTransformFeedback();
- void glBeginTransformFeedback(GLenum primitiveMode);
- GLboolean glIsEnabledi(GLenum target, GLuint index);
- void glDisablei(GLenum target, GLuint index);
- void glEnablei(GLenum target, GLuint index);
- void glGetIntegeri_v(GLenum target, GLuint index, GLint *data);
- void glGetBooleani_v(GLenum target, GLuint index, GLboolean *data);
- void glColorMaski(GLuint index, GLboolean r, GLboolean g, GLboolean b, GLboolean a);
-
- // OpenGL 1.0 deprecated functions
- void glTranslatef(GLfloat x, GLfloat y, GLfloat z);
- void glTranslated(GLdouble x, GLdouble y, GLdouble z);
- void glScalef(GLfloat x, GLfloat y, GLfloat z);
- void glScaled(GLdouble x, GLdouble y, GLdouble z);
- void glRotatef(GLfloat angle, GLfloat x, GLfloat y, GLfloat z);
- void glRotated(GLdouble angle, GLdouble x, GLdouble y, GLdouble z);
- void glPushMatrix();
- void glPopMatrix();
- void glOrtho(GLdouble left, GLdouble right, GLdouble bottom, GLdouble top, GLdouble zNear, GLdouble zFar);
- void glMultMatrixd(const GLdouble *m);
- void glMultMatrixf(const GLfloat *m);
- void glMatrixMode(GLenum mode);
- void glLoadMatrixd(const GLdouble *m);
- void glLoadMatrixf(const GLfloat *m);
- void glLoadIdentity();
- void glFrustum(GLdouble left, GLdouble right, GLdouble bottom, GLdouble top, GLdouble zNear, GLdouble zFar);
- GLboolean glIsList(GLuint list);
- void glGetTexGeniv(GLenum coord, GLenum pname, GLint *params);
- void glGetTexGenfv(GLenum coord, GLenum pname, GLfloat *params);
- void glGetTexGendv(GLenum coord, GLenum pname, GLdouble *params);
- void glGetTexEnviv(GLenum target, GLenum pname, GLint *params);
- void glGetTexEnvfv(GLenum target, GLenum pname, GLfloat *params);
- void glGetPolygonStipple(GLubyte *mask);
- void glGetPixelMapusv(GLenum map, GLushort *values);
- void glGetPixelMapuiv(GLenum map, GLuint *values);
- void glGetPixelMapfv(GLenum map, GLfloat *values);
- void glGetMaterialiv(GLenum face, GLenum pname, GLint *params);
- void glGetMaterialfv(GLenum face, GLenum pname, GLfloat *params);
- void glGetMapiv(GLenum target, GLenum query, GLint *v);
- void glGetMapfv(GLenum target, GLenum query, GLfloat *v);
- void glGetMapdv(GLenum target, GLenum query, GLdouble *v);
- void glGetLightiv(GLenum light, GLenum pname, GLint *params);
- void glGetLightfv(GLenum light, GLenum pname, GLfloat *params);
- void glGetClipPlane(GLenum plane, GLdouble *equation);
- void glDrawPixels(GLsizei width, GLsizei height, GLenum format, GLenum type, const GLvoid *pixels);
- void glCopyPixels(GLint x, GLint y, GLsizei width, GLsizei height, GLenum type);
- void glPixelMapusv(GLenum map, GLint mapsize, const GLushort *values);
- void glPixelMapuiv(GLenum map, GLint mapsize, const GLuint *values);
- void glPixelMapfv(GLenum map, GLint mapsize, const GLfloat *values);
- void glPixelTransferi(GLenum pname, GLint param);
- void glPixelTransferf(GLenum pname, GLfloat param);
- void glPixelZoom(GLfloat xfactor, GLfloat yfactor);
- void glAlphaFunc(GLenum func, GLfloat ref);
- void glEvalPoint2(GLint i, GLint j);
- void glEvalMesh2(GLenum mode, GLint i1, GLint i2, GLint j1, GLint j2);
- void glEvalPoint1(GLint i);
- void glEvalMesh1(GLenum mode, GLint i1, GLint i2);
- void glEvalCoord2fv(const GLfloat *u);
- void glEvalCoord2f(GLfloat u, GLfloat v);
- void glEvalCoord2dv(const GLdouble *u);
- void glEvalCoord2d(GLdouble u, GLdouble v);
- void glEvalCoord1fv(const GLfloat *u);
- void glEvalCoord1f(GLfloat u);
- void glEvalCoord1dv(const GLdouble *u);
- void glEvalCoord1d(GLdouble u);
- void glMapGrid2f(GLint un, GLfloat u1, GLfloat u2, GLint vn, GLfloat v1, GLfloat v2);
- void glMapGrid2d(GLint un, GLdouble u1, GLdouble u2, GLint vn, GLdouble v1, GLdouble v2);
- void glMapGrid1f(GLint un, GLfloat u1, GLfloat u2);
- void glMapGrid1d(GLint un, GLdouble u1, GLdouble u2);
- void glMap2f(GLenum target, GLfloat u1, GLfloat u2, GLint ustride, GLint uorder, GLfloat v1, GLfloat v2, GLint vstride, GLint vorder, const GLfloat *points);
- void glMap2d(GLenum target, GLdouble u1, GLdouble u2, GLint ustride, GLint uorder, GLdouble v1, GLdouble v2, GLint vstride, GLint vorder, const GLdouble *points);
- void glMap1f(GLenum target, GLfloat u1, GLfloat u2, GLint stride, GLint order, const GLfloat *points);
- void glMap1d(GLenum target, GLdouble u1, GLdouble u2, GLint stride, GLint order, const GLdouble *points);
- void glPushAttrib(GLbitfield mask);
- void glPopAttrib();
- void glAccum(GLenum op, GLfloat value);
- void glIndexMask(GLuint mask);
- void glClearIndex(GLfloat c);
- void glClearAccum(GLfloat red, GLfloat green, GLfloat blue, GLfloat alpha);
- void glPushName(GLuint name);
- void glPopName();
- void glPassThrough(GLfloat token);
- void glLoadName(GLuint name);
- void glInitNames();
- GLint glRenderMode(GLenum mode);
- void glSelectBuffer(GLsizei size, GLuint *buffer);
- void glFeedbackBuffer(GLsizei size, GLenum type, GLfloat *buffer);
- void glTexGeniv(GLenum coord, GLenum pname, const GLint *params);
- void glTexGeni(GLenum coord, GLenum pname, GLint param);
- void glTexGenfv(GLenum coord, GLenum pname, const GLfloat *params);
- void glTexGenf(GLenum coord, GLenum pname, GLfloat param);
- void glTexGendv(GLenum coord, GLenum pname, const GLdouble *params);
- void glTexGend(GLenum coord, GLenum pname, GLdouble param);
- void glTexEnviv(GLenum target, GLenum pname, const GLint *params);
- void glTexEnvi(GLenum target, GLenum pname, GLint param);
- void glTexEnvfv(GLenum target, GLenum pname, const GLfloat *params);
- void glTexEnvf(GLenum target, GLenum pname, GLfloat param);
- void glShadeModel(GLenum mode);
- void glPolygonStipple(const GLubyte *mask);
- void glMaterialiv(GLenum face, GLenum pname, const GLint *params);
- void glMateriali(GLenum face, GLenum pname, GLint param);
- void glMaterialfv(GLenum face, GLenum pname, const GLfloat *params);
- void glMaterialf(GLenum face, GLenum pname, GLfloat param);
- void glLineStipple(GLint factor, GLushort pattern);
- void glLightModeliv(GLenum pname, const GLint *params);
- void glLightModeli(GLenum pname, GLint param);
- void glLightModelfv(GLenum pname, const GLfloat *params);
- void glLightModelf(GLenum pname, GLfloat param);
- void glLightiv(GLenum light, GLenum pname, const GLint *params);
- void glLighti(GLenum light, GLenum pname, GLint param);
- void glLightfv(GLenum light, GLenum pname, const GLfloat *params);
- void glLightf(GLenum light, GLenum pname, GLfloat param);
- void glFogiv(GLenum pname, const GLint *params);
- void glFogi(GLenum pname, GLint param);
- void glFogfv(GLenum pname, const GLfloat *params);
- void glFogf(GLenum pname, GLfloat param);
- void glColorMaterial(GLenum face, GLenum mode);
- void glClipPlane(GLenum plane, const GLdouble *equation);
- void glVertex4sv(const GLshort *v);
- void glVertex4s(GLshort x, GLshort y, GLshort z, GLshort w);
- void glVertex4iv(const GLint *v);
- void glVertex4i(GLint x, GLint y, GLint z, GLint w);
- void glVertex4fv(const GLfloat *v);
- void glVertex4f(GLfloat x, GLfloat y, GLfloat z, GLfloat w);
- void glVertex4dv(const GLdouble *v);
- void glVertex4d(GLdouble x, GLdouble y, GLdouble z, GLdouble w);
- void glVertex3sv(const GLshort *v);
- void glVertex3s(GLshort x, GLshort y, GLshort z);
- void glVertex3iv(const GLint *v);
- void glVertex3i(GLint x, GLint y, GLint z);
- void glVertex3fv(const GLfloat *v);
- void glVertex3f(GLfloat x, GLfloat y, GLfloat z);
- void glVertex3dv(const GLdouble *v);
- void glVertex3d(GLdouble x, GLdouble y, GLdouble z);
- void glVertex2sv(const GLshort *v);
- void glVertex2s(GLshort x, GLshort y);
- void glVertex2iv(const GLint *v);
- void glVertex2i(GLint x, GLint y);
- void glVertex2fv(const GLfloat *v);
- void glVertex2f(GLfloat x, GLfloat y);
- void glVertex2dv(const GLdouble *v);
- void glVertex2d(GLdouble x, GLdouble y);
- void glTexCoord4sv(const GLshort *v);
- void glTexCoord4s(GLshort s, GLshort t, GLshort r, GLshort q);
- void glTexCoord4iv(const GLint *v);
- void glTexCoord4i(GLint s, GLint t, GLint r, GLint q);
- void glTexCoord4fv(const GLfloat *v);
- void glTexCoord4f(GLfloat s, GLfloat t, GLfloat r, GLfloat q);
- void glTexCoord4dv(const GLdouble *v);
- void glTexCoord4d(GLdouble s, GLdouble t, GLdouble r, GLdouble q);
- void glTexCoord3sv(const GLshort *v);
- void glTexCoord3s(GLshort s, GLshort t, GLshort r);
- void glTexCoord3iv(const GLint *v);
- void glTexCoord3i(GLint s, GLint t, GLint r);
- void glTexCoord3fv(const GLfloat *v);
- void glTexCoord3f(GLfloat s, GLfloat t, GLfloat r);
- void glTexCoord3dv(const GLdouble *v);
- void glTexCoord3d(GLdouble s, GLdouble t, GLdouble r);
- void glTexCoord2sv(const GLshort *v);
- void glTexCoord2s(GLshort s, GLshort t);
- void glTexCoord2iv(const GLint *v);
- void glTexCoord2i(GLint s, GLint t);
- void glTexCoord2fv(const GLfloat *v);
- void glTexCoord2f(GLfloat s, GLfloat t);
- void glTexCoord2dv(const GLdouble *v);
- void glTexCoord2d(GLdouble s, GLdouble t);
- void glTexCoord1sv(const GLshort *v);
- void glTexCoord1s(GLshort s);
- void glTexCoord1iv(const GLint *v);
- void glTexCoord1i(GLint s);
- void glTexCoord1fv(const GLfloat *v);
- void glTexCoord1f(GLfloat s);
- void glTexCoord1dv(const GLdouble *v);
- void glTexCoord1d(GLdouble s);
- void glRectsv(const GLshort *v1, const GLshort *v2);
- void glRects(GLshort x1, GLshort y1, GLshort x2, GLshort y2);
- void glRectiv(const GLint *v1, const GLint *v2);
- void glRecti(GLint x1, GLint y1, GLint x2, GLint y2);
- void glRectfv(const GLfloat *v1, const GLfloat *v2);
- void glRectf(GLfloat x1, GLfloat y1, GLfloat x2, GLfloat y2);
- void glRectdv(const GLdouble *v1, const GLdouble *v2);
- void glRectd(GLdouble x1, GLdouble y1, GLdouble x2, GLdouble y2);
- void glRasterPos4sv(const GLshort *v);
- void glRasterPos4s(GLshort x, GLshort y, GLshort z, GLshort w);
- void glRasterPos4iv(const GLint *v);
- void glRasterPos4i(GLint x, GLint y, GLint z, GLint w);
- void glRasterPos4fv(const GLfloat *v);
- void glRasterPos4f(GLfloat x, GLfloat y, GLfloat z, GLfloat w);
- void glRasterPos4dv(const GLdouble *v);
- void glRasterPos4d(GLdouble x, GLdouble y, GLdouble z, GLdouble w);
- void glRasterPos3sv(const GLshort *v);
- void glRasterPos3s(GLshort x, GLshort y, GLshort z);
- void glRasterPos3iv(const GLint *v);
- void glRasterPos3i(GLint x, GLint y, GLint z);
- void glRasterPos3fv(const GLfloat *v);
- void glRasterPos3f(GLfloat x, GLfloat y, GLfloat z);
- void glRasterPos3dv(const GLdouble *v);
- void glRasterPos3d(GLdouble x, GLdouble y, GLdouble z);
- void glRasterPos2sv(const GLshort *v);
- void glRasterPos2s(GLshort x, GLshort y);
- void glRasterPos2iv(const GLint *v);
- void glRasterPos2i(GLint x, GLint y);
- void glRasterPos2fv(const GLfloat *v);
- void glRasterPos2f(GLfloat x, GLfloat y);
- void glRasterPos2dv(const GLdouble *v);
- void glRasterPos2d(GLdouble x, GLdouble y);
- void glNormal3sv(const GLshort *v);
- void glNormal3s(GLshort nx, GLshort ny, GLshort nz);
- void glNormal3iv(const GLint *v);
- void glNormal3i(GLint nx, GLint ny, GLint nz);
- void glNormal3fv(const GLfloat *v);
- void glNormal3f(GLfloat nx, GLfloat ny, GLfloat nz);
- void glNormal3dv(const GLdouble *v);
- void glNormal3d(GLdouble nx, GLdouble ny, GLdouble nz);
- void glNormal3bv(const GLbyte *v);
- void glNormal3b(GLbyte nx, GLbyte ny, GLbyte nz);
- void glIndexsv(const GLshort *c);
- void glIndexs(GLshort c);
- void glIndexiv(const GLint *c);
- void glIndexi(GLint c);
- void glIndexfv(const GLfloat *c);
- void glIndexf(GLfloat c);
- void glIndexdv(const GLdouble *c);
- void glIndexd(GLdouble c);
- void glEnd();
- void glEdgeFlagv(const GLboolean *flag);
- void glEdgeFlag(GLboolean flag);
- void glColor4usv(const GLushort *v);
- void glColor4us(GLushort red, GLushort green, GLushort blue, GLushort alpha);
- void glColor4uiv(const GLuint *v);
- void glColor4ui(GLuint red, GLuint green, GLuint blue, GLuint alpha);
- void glColor4ubv(const GLubyte *v);
- void glColor4ub(GLubyte red, GLubyte green, GLubyte blue, GLubyte alpha);
- void glColor4sv(const GLshort *v);
- void glColor4s(GLshort red, GLshort green, GLshort blue, GLshort alpha);
- void glColor4iv(const GLint *v);
- void glColor4i(GLint red, GLint green, GLint blue, GLint alpha);
- void glColor4fv(const GLfloat *v);
- void glColor4f(GLfloat red, GLfloat green, GLfloat blue, GLfloat alpha);
- void glColor4dv(const GLdouble *v);
- void glColor4d(GLdouble red, GLdouble green, GLdouble blue, GLdouble alpha);
- void glColor4bv(const GLbyte *v);
- void glColor4b(GLbyte red, GLbyte green, GLbyte blue, GLbyte alpha);
- void glColor3usv(const GLushort *v);
- void glColor3us(GLushort red, GLushort green, GLushort blue);
- void glColor3uiv(const GLuint *v);
- void glColor3ui(GLuint red, GLuint green, GLuint blue);
- void glColor3ubv(const GLubyte *v);
- void glColor3ub(GLubyte red, GLubyte green, GLubyte blue);
- void glColor3sv(const GLshort *v);
- void glColor3s(GLshort red, GLshort green, GLshort blue);
- void glColor3iv(const GLint *v);
- void glColor3i(GLint red, GLint green, GLint blue);
- void glColor3fv(const GLfloat *v);
- void glColor3f(GLfloat red, GLfloat green, GLfloat blue);
- void glColor3dv(const GLdouble *v);
- void glColor3d(GLdouble red, GLdouble green, GLdouble blue);
- void glColor3bv(const GLbyte *v);
- void glColor3b(GLbyte red, GLbyte green, GLbyte blue);
- void glBitmap(GLsizei width, GLsizei height, GLfloat xorig, GLfloat yorig, GLfloat xmove, GLfloat ymove, const GLubyte *bitmap);
- void glBegin(GLenum mode);
- void glListBase(GLuint base);
- GLuint glGenLists(GLsizei range);
- void glDeleteLists(GLuint list, GLsizei range);
- void glCallLists(GLsizei n, GLenum type, const GLvoid *lists);
- void glCallList(GLuint list);
- void glEndList();
- void glNewList(GLuint list, GLenum mode);
-
- // OpenGL 1.1 deprecated functions
- void glPushClientAttrib(GLbitfield mask);
- void glPopClientAttrib();
- void glPrioritizeTextures(GLsizei n, const GLuint *textures, const GLfloat *priorities);
- GLboolean glAreTexturesResident(GLsizei n, const GLuint *textures, GLboolean *residences);
- void glVertexPointer(GLint size, GLenum type, GLsizei stride, const GLvoid *pointer);
- void glTexCoordPointer(GLint size, GLenum type, GLsizei stride, const GLvoid *pointer);
- void glNormalPointer(GLenum type, GLsizei stride, const GLvoid *pointer);
- void glInterleavedArrays(GLenum format, GLsizei stride, const GLvoid *pointer);
- void glIndexPointer(GLenum type, GLsizei stride, const GLvoid *pointer);
- void glEnableClientState(GLenum array);
- void glEdgeFlagPointer(GLsizei stride, const GLvoid *pointer);
- void glDisableClientState(GLenum array);
- void glColorPointer(GLint size, GLenum type, GLsizei stride, const GLvoid *pointer);
- void glArrayElement(GLint i);
-
- // OpenGL 1.2 deprecated functions
- void glResetMinmax(GLenum target);
- void glResetHistogram(GLenum target);
- void glMinmax(GLenum target, GLenum internalformat, GLboolean sink);
- void glHistogram(GLenum target, GLsizei width, GLenum internalformat, GLboolean sink);
- void glGetMinmaxParameteriv(GLenum target, GLenum pname, GLint *params);
- void glGetMinmaxParameterfv(GLenum target, GLenum pname, GLfloat *params);
- void glGetMinmax(GLenum target, GLboolean reset, GLenum format, GLenum type, GLvoid *values);
- void glGetHistogramParameteriv(GLenum target, GLenum pname, GLint *params);
- void glGetHistogramParameterfv(GLenum target, GLenum pname, GLfloat *params);
- void glGetHistogram(GLenum target, GLboolean reset, GLenum format, GLenum type, GLvoid *values);
- void glSeparableFilter2D(GLenum target, GLenum internalformat, GLsizei width, GLsizei height, GLenum format, GLenum type, const GLvoid *row, const GLvoid *column);
- void glGetSeparableFilter(GLenum target, GLenum format, GLenum type, GLvoid *row, GLvoid *column, GLvoid *span);
- void glGetConvolutionParameteriv(GLenum target, GLenum pname, GLint *params);
- void glGetConvolutionParameterfv(GLenum target, GLenum pname, GLfloat *params);
- void glGetConvolutionFilter(GLenum target, GLenum format, GLenum type, GLvoid *image);
- void glCopyConvolutionFilter2D(GLenum target, GLenum internalformat, GLint x, GLint y, GLsizei width, GLsizei height);
- void glCopyConvolutionFilter1D(GLenum target, GLenum internalformat, GLint x, GLint y, GLsizei width);
- void glConvolutionParameteriv(GLenum target, GLenum pname, const GLint *params);
- void glConvolutionParameteri(GLenum target, GLenum pname, GLint params);
- void glConvolutionParameterfv(GLenum target, GLenum pname, const GLfloat *params);
- void glConvolutionParameterf(GLenum target, GLenum pname, GLfloat params);
- void glConvolutionFilter2D(GLenum target, GLenum internalformat, GLsizei width, GLsizei height, GLenum format, GLenum type, const GLvoid *image);
- void glConvolutionFilter1D(GLenum target, GLenum internalformat, GLsizei width, GLenum format, GLenum type, const GLvoid *image);
- void glCopyColorSubTable(GLenum target, GLsizei start, GLint x, GLint y, GLsizei width);
- void glColorSubTable(GLenum target, GLsizei start, GLsizei count, GLenum format, GLenum type, const GLvoid *data);
- void glGetColorTableParameteriv(GLenum target, GLenum pname, GLint *params);
- void glGetColorTableParameterfv(GLenum target, GLenum pname, GLfloat *params);
- void glGetColorTable(GLenum target, GLenum format, GLenum type, GLvoid *table);
- void glCopyColorTable(GLenum target, GLenum internalformat, GLint x, GLint y, GLsizei width);
- void glColorTableParameteriv(GLenum target, GLenum pname, const GLint *params);
- void glColorTableParameterfv(GLenum target, GLenum pname, const GLfloat *params);
- void glColorTable(GLenum target, GLenum internalformat, GLsizei width, GLenum format, GLenum type, const GLvoid *table);
-
- // OpenGL 1.3 deprecated functions
- void glMultTransposeMatrixd(const GLdouble *m);
- void glMultTransposeMatrixf(const GLfloat *m);
- void glLoadTransposeMatrixd(const GLdouble *m);
- void glLoadTransposeMatrixf(const GLfloat *m);
- void glMultiTexCoord4sv(GLenum target, const GLshort *v);
- void glMultiTexCoord4s(GLenum target, GLshort s, GLshort t, GLshort r, GLshort q);
- void glMultiTexCoord4iv(GLenum target, const GLint *v);
- void glMultiTexCoord4i(GLenum target, GLint s, GLint t, GLint r, GLint q);
- void glMultiTexCoord4fv(GLenum target, const GLfloat *v);
- void glMultiTexCoord4f(GLenum target, GLfloat s, GLfloat t, GLfloat r, GLfloat q);
- void glMultiTexCoord4dv(GLenum target, const GLdouble *v);
- void glMultiTexCoord4d(GLenum target, GLdouble s, GLdouble t, GLdouble r, GLdouble q);
- void glMultiTexCoord3sv(GLenum target, const GLshort *v);
- void glMultiTexCoord3s(GLenum target, GLshort s, GLshort t, GLshort r);
- void glMultiTexCoord3iv(GLenum target, const GLint *v);
- void glMultiTexCoord3i(GLenum target, GLint s, GLint t, GLint r);
- void glMultiTexCoord3fv(GLenum target, const GLfloat *v);
- void glMultiTexCoord3f(GLenum target, GLfloat s, GLfloat t, GLfloat r);
- void glMultiTexCoord3dv(GLenum target, const GLdouble *v);
- void glMultiTexCoord3d(GLenum target, GLdouble s, GLdouble t, GLdouble r);
- void glMultiTexCoord2sv(GLenum target, const GLshort *v);
- void glMultiTexCoord2s(GLenum target, GLshort s, GLshort t);
- void glMultiTexCoord2iv(GLenum target, const GLint *v);
- void glMultiTexCoord2i(GLenum target, GLint s, GLint t);
- void glMultiTexCoord2fv(GLenum target, const GLfloat *v);
- void glMultiTexCoord2f(GLenum target, GLfloat s, GLfloat t);
- void glMultiTexCoord2dv(GLenum target, const GLdouble *v);
- void glMultiTexCoord2d(GLenum target, GLdouble s, GLdouble t);
- void glMultiTexCoord1sv(GLenum target, const GLshort *v);
- void glMultiTexCoord1s(GLenum target, GLshort s);
- void glMultiTexCoord1iv(GLenum target, const GLint *v);
- void glMultiTexCoord1i(GLenum target, GLint s);
- void glMultiTexCoord1fv(GLenum target, const GLfloat *v);
- void glMultiTexCoord1f(GLenum target, GLfloat s);
- void glMultiTexCoord1dv(GLenum target, const GLdouble *v);
- void glMultiTexCoord1d(GLenum target, GLdouble s);
- void glClientActiveTexture(GLenum texture);
-
- // OpenGL 1.4 deprecated functions
- void glWindowPos3sv(const GLshort *v);
- void glWindowPos3s(GLshort x, GLshort y, GLshort z);
- void glWindowPos3iv(const GLint *v);
- void glWindowPos3i(GLint x, GLint y, GLint z);
- void glWindowPos3fv(const GLfloat *v);
- void glWindowPos3f(GLfloat x, GLfloat y, GLfloat z);
- void glWindowPos3dv(const GLdouble *v);
- void glWindowPos3d(GLdouble x, GLdouble y, GLdouble z);
- void glWindowPos2sv(const GLshort *v);
- void glWindowPos2s(GLshort x, GLshort y);
- void glWindowPos2iv(const GLint *v);
- void glWindowPos2i(GLint x, GLint y);
- void glWindowPos2fv(const GLfloat *v);
- void glWindowPos2f(GLfloat x, GLfloat y);
- void glWindowPos2dv(const GLdouble *v);
- void glWindowPos2d(GLdouble x, GLdouble y);
- void glSecondaryColorPointer(GLint size, GLenum type, GLsizei stride, const GLvoid *pointer);
- void glSecondaryColor3usv(const GLushort *v);
- void glSecondaryColor3us(GLushort red, GLushort green, GLushort blue);
- void glSecondaryColor3uiv(const GLuint *v);
- void glSecondaryColor3ui(GLuint red, GLuint green, GLuint blue);
- void glSecondaryColor3ubv(const GLubyte *v);
- void glSecondaryColor3ub(GLubyte red, GLubyte green, GLubyte blue);
- void glSecondaryColor3sv(const GLshort *v);
- void glSecondaryColor3s(GLshort red, GLshort green, GLshort blue);
- void glSecondaryColor3iv(const GLint *v);
- void glSecondaryColor3i(GLint red, GLint green, GLint blue);
- void glSecondaryColor3fv(const GLfloat *v);
- void glSecondaryColor3f(GLfloat red, GLfloat green, GLfloat blue);
- void glSecondaryColor3dv(const GLdouble *v);
- void glSecondaryColor3d(GLdouble red, GLdouble green, GLdouble blue);
- void glSecondaryColor3bv(const GLbyte *v);
- void glSecondaryColor3b(GLbyte red, GLbyte green, GLbyte blue);
- void glFogCoordPointer(GLenum type, GLsizei stride, const GLvoid *pointer);
- void glFogCoorddv(const GLdouble *coord);
- void glFogCoordd(GLdouble coord);
- void glFogCoordfv(const GLfloat *coord);
- void glFogCoordf(GLfloat coord);
-
- // OpenGL 1.5 deprecated functions
-
- // OpenGL 2.0 deprecated functions
- void glVertexAttrib4usv(GLuint index, const GLushort *v);
- void glVertexAttrib4uiv(GLuint index, const GLuint *v);
- void glVertexAttrib4ubv(GLuint index, const GLubyte *v);
- void glVertexAttrib4sv(GLuint index, const GLshort *v);
- void glVertexAttrib4s(GLuint index, GLshort x, GLshort y, GLshort z, GLshort w);
- void glVertexAttrib4iv(GLuint index, const GLint *v);
- void glVertexAttrib4fv(GLuint index, const GLfloat *v);
- void glVertexAttrib4f(GLuint index, GLfloat x, GLfloat y, GLfloat z, GLfloat w);
- void glVertexAttrib4dv(GLuint index, const GLdouble *v);
- void glVertexAttrib4d(GLuint index, GLdouble x, GLdouble y, GLdouble z, GLdouble w);
- void glVertexAttrib4bv(GLuint index, const GLbyte *v);
- void glVertexAttrib4Nusv(GLuint index, const GLushort *v);
- void glVertexAttrib4Nuiv(GLuint index, const GLuint *v);
- void glVertexAttrib4Nubv(GLuint index, const GLubyte *v);
- void glVertexAttrib4Nub(GLuint index, GLubyte x, GLubyte y, GLubyte z, GLubyte w);
- void glVertexAttrib4Nsv(GLuint index, const GLshort *v);
- void glVertexAttrib4Niv(GLuint index, const GLint *v);
- void glVertexAttrib4Nbv(GLuint index, const GLbyte *v);
- void glVertexAttrib3sv(GLuint index, const GLshort *v);
- void glVertexAttrib3s(GLuint index, GLshort x, GLshort y, GLshort z);
- void glVertexAttrib3fv(GLuint index, const GLfloat *v);
- void glVertexAttrib3f(GLuint index, GLfloat x, GLfloat y, GLfloat z);
- void glVertexAttrib3dv(GLuint index, const GLdouble *v);
- void glVertexAttrib3d(GLuint index, GLdouble x, GLdouble y, GLdouble z);
- void glVertexAttrib2sv(GLuint index, const GLshort *v);
- void glVertexAttrib2s(GLuint index, GLshort x, GLshort y);
- void glVertexAttrib2fv(GLuint index, const GLfloat *v);
- void glVertexAttrib2f(GLuint index, GLfloat x, GLfloat y);
- void glVertexAttrib2dv(GLuint index, const GLdouble *v);
- void glVertexAttrib2d(GLuint index, GLdouble x, GLdouble y);
- void glVertexAttrib1sv(GLuint index, const GLshort *v);
- void glVertexAttrib1s(GLuint index, GLshort x);
- void glVertexAttrib1fv(GLuint index, const GLfloat *v);
- void glVertexAttrib1f(GLuint index, GLfloat x);
- void glVertexAttrib1dv(GLuint index, const GLdouble *v);
- void glVertexAttrib1d(GLuint index, GLdouble x);
-
- // OpenGL 2.1 deprecated functions
-
- // OpenGL 3.0 deprecated functions
- void glVertexAttribI4usv(GLuint index, const GLushort *v);
- void glVertexAttribI4ubv(GLuint index, const GLubyte *v);
- void glVertexAttribI4sv(GLuint index, const GLshort *v);
- void glVertexAttribI4bv(GLuint index, const GLbyte *v);
- void glVertexAttribI4uiv(GLuint index, const GLuint *v);
- void glVertexAttribI3uiv(GLuint index, const GLuint *v);
- void glVertexAttribI2uiv(GLuint index, const GLuint *v);
- void glVertexAttribI1uiv(GLuint index, const GLuint *v);
- void glVertexAttribI4iv(GLuint index, const GLint *v);
- void glVertexAttribI3iv(GLuint index, const GLint *v);
- void glVertexAttribI2iv(GLuint index, const GLint *v);
- void glVertexAttribI1iv(GLuint index, const GLint *v);
- void glVertexAttribI4ui(GLuint index, GLuint x, GLuint y, GLuint z, GLuint w);
- void glVertexAttribI3ui(GLuint index, GLuint x, GLuint y, GLuint z);
- void glVertexAttribI2ui(GLuint index, GLuint x, GLuint y);
- void glVertexAttribI1ui(GLuint index, GLuint x);
- void glVertexAttribI4i(GLuint index, GLint x, GLint y, GLint z, GLint w);
- void glVertexAttribI3i(GLuint index, GLint x, GLint y, GLint z);
- void glVertexAttribI2i(GLuint index, GLint x, GLint y);
- void glVertexAttribI1i(GLuint index, GLint x);
-
-private:
- friend class QOpenGLContext;
-
- static bool isContextCompatible(QOpenGLContext *context);
- static QOpenGLVersionProfile versionProfile();
-
- QOpenGLFunctions_1_0_CoreBackend* d_1_0_Core;
- QOpenGLFunctions_1_1_CoreBackend* d_1_1_Core;
- QOpenGLFunctions_1_2_CoreBackend* d_1_2_Core;
- QOpenGLFunctions_1_3_CoreBackend* d_1_3_Core;
- QOpenGLFunctions_1_4_CoreBackend* d_1_4_Core;
- QOpenGLFunctions_1_5_CoreBackend* d_1_5_Core;
- QOpenGLFunctions_2_0_CoreBackend* d_2_0_Core;
- QOpenGLFunctions_2_1_CoreBackend* d_2_1_Core;
- QOpenGLFunctions_3_0_CoreBackend* d_3_0_Core;
- QOpenGLFunctions_1_0_DeprecatedBackend* d_1_0_Deprecated;
- QOpenGLFunctions_1_1_DeprecatedBackend* d_1_1_Deprecated;
- QOpenGLFunctions_1_2_DeprecatedBackend* d_1_2_Deprecated;
- QOpenGLFunctions_1_3_DeprecatedBackend* d_1_3_Deprecated;
- QOpenGLFunctions_1_4_DeprecatedBackend* d_1_4_Deprecated;
- void *m_reserved_2_0_Deprecated; // To maintain BC
- void *m_reserved_3_0_Deprecated; // To maintain BC
-};
-
-// OpenGL 1.0 core functions
-inline void QOpenGLFunctions_3_0::glViewport(GLint x, GLint y, GLsizei width, GLsizei height)
-{
- d_1_0_Core->f.Viewport(x, y, width, height);
-}
-
-inline void QOpenGLFunctions_3_0::glDepthRange(GLdouble nearVal, GLdouble farVal)
-{
- d_1_0_Core->f.DepthRange(nearVal, farVal);
-}
-
-inline GLboolean QOpenGLFunctions_3_0::glIsEnabled(GLenum cap)
-{
- return d_1_0_Core->f.IsEnabled(cap);
-}
-
-inline void QOpenGLFunctions_3_0::glGetTexLevelParameteriv(GLenum target, GLint level, GLenum pname, GLint *params)
-{
- d_1_0_Core->f.GetTexLevelParameteriv(target, level, pname, params);
-}
-
-inline void QOpenGLFunctions_3_0::glGetTexLevelParameterfv(GLenum target, GLint level, GLenum pname, GLfloat *params)
-{
- d_1_0_Core->f.GetTexLevelParameterfv(target, level, pname, params);
-}
-
-inline void QOpenGLFunctions_3_0::glGetTexParameteriv(GLenum target, GLenum pname, GLint *params)
-{
- d_1_0_Core->f.GetTexParameteriv(target, pname, params);
-}
-
-inline void QOpenGLFunctions_3_0::glGetTexParameterfv(GLenum target, GLenum pname, GLfloat *params)
-{
- d_1_0_Core->f.GetTexParameterfv(target, pname, params);
-}
-
-inline void QOpenGLFunctions_3_0::glGetTexImage(GLenum target, GLint level, GLenum format, GLenum type, GLvoid *pixels)
-{
- d_1_0_Core->f.GetTexImage(target, level, format, type, pixels);
-}
-
-inline const GLubyte * QOpenGLFunctions_3_0::glGetString(GLenum name)
-{
- return d_1_0_Core->f.GetString(name);
-}
-
-inline void QOpenGLFunctions_3_0::glGetIntegerv(GLenum pname, GLint *params)
-{
- d_1_0_Core->f.GetIntegerv(pname, params);
-}
-
-inline void QOpenGLFunctions_3_0::glGetFloatv(GLenum pname, GLfloat *params)
-{
- d_1_0_Core->f.GetFloatv(pname, params);
-}
-
-inline GLenum QOpenGLFunctions_3_0::glGetError()
-{
- return d_1_0_Core->f.GetError();
-}
-
-inline void QOpenGLFunctions_3_0::glGetDoublev(GLenum pname, GLdouble *params)
-{
- d_1_0_Core->f.GetDoublev(pname, params);
-}
-
-inline void QOpenGLFunctions_3_0::glGetBooleanv(GLenum pname, GLboolean *params)
-{
- d_1_0_Core->f.GetBooleanv(pname, params);
-}
-
-inline void QOpenGLFunctions_3_0::glReadPixels(GLint x, GLint y, GLsizei width, GLsizei height, GLenum format, GLenum type, GLvoid *pixels)
-{
- d_1_0_Core->f.ReadPixels(x, y, width, height, format, type, pixels);
-}
-
-inline void QOpenGLFunctions_3_0::glReadBuffer(GLenum mode)
-{
- d_1_0_Core->f.ReadBuffer(mode);
-}
-
-inline void QOpenGLFunctions_3_0::glPixelStorei(GLenum pname, GLint param)
-{
- d_1_0_Core->f.PixelStorei(pname, param);
-}
-
-inline void QOpenGLFunctions_3_0::glPixelStoref(GLenum pname, GLfloat param)
-{
- d_1_0_Core->f.PixelStoref(pname, param);
-}
-
-inline void QOpenGLFunctions_3_0::glDepthFunc(GLenum func)
-{
- d_1_0_Core->f.DepthFunc(func);
-}
-
-inline void QOpenGLFunctions_3_0::glStencilOp(GLenum fail, GLenum zfail, GLenum zpass)
-{
- d_1_0_Core->f.StencilOp(fail, zfail, zpass);
-}
-
-inline void QOpenGLFunctions_3_0::glStencilFunc(GLenum func, GLint ref, GLuint mask)
-{
- d_1_0_Core->f.StencilFunc(func, ref, mask);
-}
-
-inline void QOpenGLFunctions_3_0::glLogicOp(GLenum opcode)
-{
- d_1_0_Core->f.LogicOp(opcode);
-}
-
-inline void QOpenGLFunctions_3_0::glBlendFunc(GLenum sfactor, GLenum dfactor)
-{
- d_1_0_Core->f.BlendFunc(sfactor, dfactor);
-}
-
-inline void QOpenGLFunctions_3_0::glFlush()
-{
- d_1_0_Core->f.Flush();
-}
-
-inline void QOpenGLFunctions_3_0::glFinish()
-{
- d_1_0_Core->f.Finish();
-}
-
-inline void QOpenGLFunctions_3_0::glEnable(GLenum cap)
-{
- d_1_0_Core->f.Enable(cap);
-}
-
-inline void QOpenGLFunctions_3_0::glDisable(GLenum cap)
-{
- d_1_0_Core->f.Disable(cap);
-}
-
-inline void QOpenGLFunctions_3_0::glDepthMask(GLboolean flag)
-{
- d_1_0_Core->f.DepthMask(flag);
-}
-
-inline void QOpenGLFunctions_3_0::glColorMask(GLboolean red, GLboolean green, GLboolean blue, GLboolean alpha)
-{
- d_1_0_Core->f.ColorMask(red, green, blue, alpha);
-}
-
-inline void QOpenGLFunctions_3_0::glStencilMask(GLuint mask)
-{
- d_1_0_Core->f.StencilMask(mask);
-}
-
-inline void QOpenGLFunctions_3_0::glClearDepth(GLdouble depth)
-{
- d_1_0_Core->f.ClearDepth(depth);
-}
-
-inline void QOpenGLFunctions_3_0::glClearStencil(GLint s)
-{
- d_1_0_Core->f.ClearStencil(s);
-}
-
-inline void QOpenGLFunctions_3_0::glClearColor(GLfloat red, GLfloat green, GLfloat blue, GLfloat alpha)
-{
- d_1_0_Core->f.ClearColor(red, green, blue, alpha);
-}
-
-inline void QOpenGLFunctions_3_0::glClear(GLbitfield mask)
-{
- d_1_0_Core->f.Clear(mask);
-}
-
-inline void QOpenGLFunctions_3_0::glDrawBuffer(GLenum mode)
-{
- d_1_0_Core->f.DrawBuffer(mode);
-}
-
-inline void QOpenGLFunctions_3_0::glTexImage2D(GLenum target, GLint level, GLint internalformat, GLsizei width, GLsizei height, GLint border, GLenum format, GLenum type, const GLvoid *pixels)
-{
- d_1_0_Core->f.TexImage2D(target, level, internalformat, width, height, border, format, type, pixels);
-}
-
-inline void QOpenGLFunctions_3_0::glTexImage1D(GLenum target, GLint level, GLint internalformat, GLsizei width, GLint border, GLenum format, GLenum type, const GLvoid *pixels)
-{
- d_1_0_Core->f.TexImage1D(target, level, internalformat, width, border, format, type, pixels);
-}
-
-inline void QOpenGLFunctions_3_0::glTexParameteriv(GLenum target, GLenum pname, const GLint *params)
-{
- d_1_0_Core->f.TexParameteriv(target, pname, params);
-}
-
-inline void QOpenGLFunctions_3_0::glTexParameteri(GLenum target, GLenum pname, GLint param)
-{
- d_1_0_Core->f.TexParameteri(target, pname, param);
-}
-
-inline void QOpenGLFunctions_3_0::glTexParameterfv(GLenum target, GLenum pname, const GLfloat *params)
-{
- d_1_0_Core->f.TexParameterfv(target, pname, params);
-}
-
-inline void QOpenGLFunctions_3_0::glTexParameterf(GLenum target, GLenum pname, GLfloat param)
-{
- d_1_0_Core->f.TexParameterf(target, pname, param);
-}
-
-inline void QOpenGLFunctions_3_0::glScissor(GLint x, GLint y, GLsizei width, GLsizei height)
-{
- d_1_0_Core->f.Scissor(x, y, width, height);
-}
-
-inline void QOpenGLFunctions_3_0::glPolygonMode(GLenum face, GLenum mode)
-{
- d_1_0_Core->f.PolygonMode(face, mode);
-}
-
-inline void QOpenGLFunctions_3_0::glPointSize(GLfloat size)
-{
- d_1_0_Core->f.PointSize(size);
-}
-
-inline void QOpenGLFunctions_3_0::glLineWidth(GLfloat width)
-{
- d_1_0_Core->f.LineWidth(width);
-}
-
-inline void QOpenGLFunctions_3_0::glHint(GLenum target, GLenum mode)
-{
- d_1_0_Core->f.Hint(target, mode);
-}
-
-inline void QOpenGLFunctions_3_0::glFrontFace(GLenum mode)
-{
- d_1_0_Core->f.FrontFace(mode);
-}
-
-inline void QOpenGLFunctions_3_0::glCullFace(GLenum mode)
-{
- d_1_0_Core->f.CullFace(mode);
-}
-
-
-// OpenGL 1.1 core functions
-inline void QOpenGLFunctions_3_0::glIndexubv(const GLubyte *c)
-{
- d_1_1_Deprecated->f.Indexubv(c);
-}
-
-inline void QOpenGLFunctions_3_0::glIndexub(GLubyte c)
-{
- d_1_1_Deprecated->f.Indexub(c);
-}
-
-inline GLboolean QOpenGLFunctions_3_0::glIsTexture(GLuint texture)
-{
- return d_1_1_Core->f.IsTexture(texture);
-}
-
-inline void QOpenGLFunctions_3_0::glGenTextures(GLsizei n, GLuint *textures)
-{
- d_1_1_Core->f.GenTextures(n, textures);
-}
-
-inline void QOpenGLFunctions_3_0::glDeleteTextures(GLsizei n, const GLuint *textures)
-{
- d_1_1_Core->f.DeleteTextures(n, textures);
-}
-
-inline void QOpenGLFunctions_3_0::glBindTexture(GLenum target, GLuint texture)
-{
- d_1_1_Core->f.BindTexture(target, texture);
-}
-
-inline void QOpenGLFunctions_3_0::glTexSubImage2D(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLenum type, const GLvoid *pixels)
-{
- d_1_1_Core->f.TexSubImage2D(target, level, xoffset, yoffset, width, height, format, type, pixels);
-}
-
-inline void QOpenGLFunctions_3_0::glTexSubImage1D(GLenum target, GLint level, GLint xoffset, GLsizei width, GLenum format, GLenum type, const GLvoid *pixels)
-{
- d_1_1_Core->f.TexSubImage1D(target, level, xoffset, width, format, type, pixels);
-}
-
-inline void QOpenGLFunctions_3_0::glCopyTexSubImage2D(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint x, GLint y, GLsizei width, GLsizei height)
-{
- d_1_1_Core->f.CopyTexSubImage2D(target, level, xoffset, yoffset, x, y, width, height);
-}
-
-inline void QOpenGLFunctions_3_0::glCopyTexSubImage1D(GLenum target, GLint level, GLint xoffset, GLint x, GLint y, GLsizei width)
-{
- d_1_1_Core->f.CopyTexSubImage1D(target, level, xoffset, x, y, width);
-}
-
-inline void QOpenGLFunctions_3_0::glCopyTexImage2D(GLenum target, GLint level, GLenum internalformat, GLint x, GLint y, GLsizei width, GLsizei height, GLint border)
-{
- d_1_1_Core->f.CopyTexImage2D(target, level, internalformat, x, y, width, height, border);
-}
-
-inline void QOpenGLFunctions_3_0::glCopyTexImage1D(GLenum target, GLint level, GLenum internalformat, GLint x, GLint y, GLsizei width, GLint border)
-{
- d_1_1_Core->f.CopyTexImage1D(target, level, internalformat, x, y, width, border);
-}
-
-inline void QOpenGLFunctions_3_0::glPolygonOffset(GLfloat factor, GLfloat units)
-{
- d_1_1_Core->f.PolygonOffset(factor, units);
-}
-
-inline void QOpenGLFunctions_3_0::glGetPointerv(GLenum pname, GLvoid* *params)
-{
- d_1_1_Deprecated->f.GetPointerv(pname, params);
-}
-
-inline void QOpenGLFunctions_3_0::glDrawElements(GLenum mode, GLsizei count, GLenum type, const GLvoid *indices)
-{
- d_1_1_Core->f.DrawElements(mode, count, type, indices);
-}
-
-inline void QOpenGLFunctions_3_0::glDrawArrays(GLenum mode, GLint first, GLsizei count)
-{
- d_1_1_Core->f.DrawArrays(mode, first, count);
-}
-
-
-// OpenGL 1.2 core functions
-inline void QOpenGLFunctions_3_0::glCopyTexSubImage3D(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLint x, GLint y, GLsizei width, GLsizei height)
-{
- d_1_2_Core->f.CopyTexSubImage3D(target, level, xoffset, yoffset, zoffset, x, y, width, height);
-}
-
-inline void QOpenGLFunctions_3_0::glTexSubImage3D(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLenum type, const GLvoid *pixels)
-{
- d_1_2_Core->f.TexSubImage3D(target, level, xoffset, yoffset, zoffset, width, height, depth, format, type, pixels);
-}
-
-inline void QOpenGLFunctions_3_0::glTexImage3D(GLenum target, GLint level, GLint internalformat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLenum format, GLenum type, const GLvoid *pixels)
-{
- d_1_2_Core->f.TexImage3D(target, level, internalformat, width, height, depth, border, format, type, pixels);
-}
-
-inline void QOpenGLFunctions_3_0::glDrawRangeElements(GLenum mode, GLuint start, GLuint end, GLsizei count, GLenum type, const GLvoid *indices)
-{
- d_1_2_Core->f.DrawRangeElements(mode, start, end, count, type, indices);
-}
-
-inline void QOpenGLFunctions_3_0::glBlendEquation(GLenum mode)
-{
- d_1_2_Core->f.BlendEquation(mode);
-}
-
-inline void QOpenGLFunctions_3_0::glBlendColor(GLfloat red, GLfloat green, GLfloat blue, GLfloat alpha)
-{
- d_1_2_Core->f.BlendColor(red, green, blue, alpha);
-}
-
-
-// OpenGL 1.3 core functions
-inline void QOpenGLFunctions_3_0::glGetCompressedTexImage(GLenum target, GLint level, GLvoid *img)
-{
- d_1_3_Core->f.GetCompressedTexImage(target, level, img);
-}
-
-inline void QOpenGLFunctions_3_0::glCompressedTexSubImage1D(GLenum target, GLint level, GLint xoffset, GLsizei width, GLenum format, GLsizei imageSize, const GLvoid *data)
-{
- d_1_3_Core->f.CompressedTexSubImage1D(target, level, xoffset, width, format, imageSize, data);
-}
-
-inline void QOpenGLFunctions_3_0::glCompressedTexSubImage2D(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLsizei imageSize, const GLvoid *data)
-{
- d_1_3_Core->f.CompressedTexSubImage2D(target, level, xoffset, yoffset, width, height, format, imageSize, data);
-}
-
-inline void QOpenGLFunctions_3_0::glCompressedTexSubImage3D(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLsizei imageSize, const GLvoid *data)
-{
- d_1_3_Core->f.CompressedTexSubImage3D(target, level, xoffset, yoffset, zoffset, width, height, depth, format, imageSize, data);
-}
-
-inline void QOpenGLFunctions_3_0::glCompressedTexImage1D(GLenum target, GLint level, GLenum internalformat, GLsizei width, GLint border, GLsizei imageSize, const GLvoid *data)
-{
- d_1_3_Core->f.CompressedTexImage1D(target, level, internalformat, width, border, imageSize, data);
-}
-
-inline void QOpenGLFunctions_3_0::glCompressedTexImage2D(GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLint border, GLsizei imageSize, const GLvoid *data)
-{
- d_1_3_Core->f.CompressedTexImage2D(target, level, internalformat, width, height, border, imageSize, data);
-}
-
-inline void QOpenGLFunctions_3_0::glCompressedTexImage3D(GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLsizei imageSize, const GLvoid *data)
-{
- d_1_3_Core->f.CompressedTexImage3D(target, level, internalformat, width, height, depth, border, imageSize, data);
-}
-
-inline void QOpenGLFunctions_3_0::glSampleCoverage(GLfloat value, GLboolean invert)
-{
- d_1_3_Core->f.SampleCoverage(value, invert);
-}
-
-inline void QOpenGLFunctions_3_0::glActiveTexture(GLenum texture)
-{
- d_1_3_Core->f.ActiveTexture(texture);
-}
-
-
-// OpenGL 1.4 core functions
-inline void QOpenGLFunctions_3_0::glPointParameteriv(GLenum pname, const GLint *params)
-{
- d_1_4_Core->f.PointParameteriv(pname, params);
-}
-
-inline void QOpenGLFunctions_3_0::glPointParameteri(GLenum pname, GLint param)
-{
- d_1_4_Core->f.PointParameteri(pname, param);
-}
-
-inline void QOpenGLFunctions_3_0::glPointParameterfv(GLenum pname, const GLfloat *params)
-{
- d_1_4_Core->f.PointParameterfv(pname, params);
-}
-
-inline void QOpenGLFunctions_3_0::glPointParameterf(GLenum pname, GLfloat param)
-{
- d_1_4_Core->f.PointParameterf(pname, param);
-}
-
-inline void QOpenGLFunctions_3_0::glMultiDrawElements(GLenum mode, const GLsizei *count, GLenum type, const GLvoid* const *indices, GLsizei drawcount)
-{
- d_1_4_Core->f.MultiDrawElements(mode, count, type, indices, drawcount);
-}
-
-inline void QOpenGLFunctions_3_0::glMultiDrawArrays(GLenum mode, const GLint *first, const GLsizei *count, GLsizei drawcount)
-{
- d_1_4_Core->f.MultiDrawArrays(mode, first, count, drawcount);
-}
-
-inline void QOpenGLFunctions_3_0::glBlendFuncSeparate(GLenum sfactorRGB, GLenum dfactorRGB, GLenum sfactorAlpha, GLenum dfactorAlpha)
-{
- d_1_4_Core->f.BlendFuncSeparate(sfactorRGB, dfactorRGB, sfactorAlpha, dfactorAlpha);
-}
-
-
-// OpenGL 1.5 core functions
-inline void QOpenGLFunctions_3_0::glGetBufferPointerv(GLenum target, GLenum pname, GLvoid* *params)
-{
- d_1_5_Core->f.GetBufferPointerv(target, pname, params);
-}
-
-inline void QOpenGLFunctions_3_0::glGetBufferParameteriv(GLenum target, GLenum pname, GLint *params)
-{
- d_1_5_Core->f.GetBufferParameteriv(target, pname, params);
-}
-
-inline GLboolean QOpenGLFunctions_3_0::glUnmapBuffer(GLenum target)
-{
- return d_1_5_Core->f.UnmapBuffer(target);
-}
-
-inline GLvoid* QOpenGLFunctions_3_0::glMapBuffer(GLenum target, GLenum access)
-{
- return d_1_5_Core->f.MapBuffer(target, access);
-}
-
-inline void QOpenGLFunctions_3_0::glGetBufferSubData(GLenum target, GLintptr offset, GLsizeiptr size, GLvoid *data)
-{
- d_1_5_Core->f.GetBufferSubData(target, offset, size, data);
-}
-
-inline void QOpenGLFunctions_3_0::glBufferSubData(GLenum target, GLintptr offset, GLsizeiptr size, const GLvoid *data)
-{
- d_1_5_Core->f.BufferSubData(target, offset, size, data);
-}
-
-inline void QOpenGLFunctions_3_0::glBufferData(GLenum target, GLsizeiptr size, const GLvoid *data, GLenum usage)
-{
- d_1_5_Core->f.BufferData(target, size, data, usage);
-}
-
-inline GLboolean QOpenGLFunctions_3_0::glIsBuffer(GLuint buffer)
-{
- return d_1_5_Core->f.IsBuffer(buffer);
-}
-
-inline void QOpenGLFunctions_3_0::glGenBuffers(GLsizei n, GLuint *buffers)
-{
- d_1_5_Core->f.GenBuffers(n, buffers);
-}
-
-inline void QOpenGLFunctions_3_0::glDeleteBuffers(GLsizei n, const GLuint *buffers)
-{
- d_1_5_Core->f.DeleteBuffers(n, buffers);
-}
-
-inline void QOpenGLFunctions_3_0::glBindBuffer(GLenum target, GLuint buffer)
-{
- d_1_5_Core->f.BindBuffer(target, buffer);
-}
-
-inline void QOpenGLFunctions_3_0::glGetQueryObjectuiv(GLuint id, GLenum pname, GLuint *params)
-{
- d_1_5_Core->f.GetQueryObjectuiv(id, pname, params);
-}
-
-inline void QOpenGLFunctions_3_0::glGetQueryObjectiv(GLuint id, GLenum pname, GLint *params)
-{
- d_1_5_Core->f.GetQueryObjectiv(id, pname, params);
-}
-
-inline void QOpenGLFunctions_3_0::glGetQueryiv(GLenum target, GLenum pname, GLint *params)
-{
- d_1_5_Core->f.GetQueryiv(target, pname, params);
-}
-
-inline void QOpenGLFunctions_3_0::glEndQuery(GLenum target)
-{
- d_1_5_Core->f.EndQuery(target);
-}
-
-inline void QOpenGLFunctions_3_0::glBeginQuery(GLenum target, GLuint id)
-{
- d_1_5_Core->f.BeginQuery(target, id);
-}
-
-inline GLboolean QOpenGLFunctions_3_0::glIsQuery(GLuint id)
-{
- return d_1_5_Core->f.IsQuery(id);
-}
-
-inline void QOpenGLFunctions_3_0::glDeleteQueries(GLsizei n, const GLuint *ids)
-{
- d_1_5_Core->f.DeleteQueries(n, ids);
-}
-
-inline void QOpenGLFunctions_3_0::glGenQueries(GLsizei n, GLuint *ids)
-{
- d_1_5_Core->f.GenQueries(n, ids);
-}
-
-
-// OpenGL 2.0 core functions
-inline void QOpenGLFunctions_3_0::glVertexAttribPointer(GLuint index, GLint size, GLenum type, GLboolean normalized, GLsizei stride, const GLvoid *pointer)
-{
- d_2_0_Core->f.VertexAttribPointer(index, size, type, normalized, stride, pointer);
-}
-
-inline void QOpenGLFunctions_3_0::glValidateProgram(GLuint program)
-{
- d_2_0_Core->f.ValidateProgram(program);
-}
-
-inline void QOpenGLFunctions_3_0::glUniformMatrix4fv(GLint location, GLsizei count, GLboolean transpose, const GLfloat *value)
-{
- d_2_0_Core->f.UniformMatrix4fv(location, count, transpose, value);
-}
-
-inline void QOpenGLFunctions_3_0::glUniformMatrix3fv(GLint location, GLsizei count, GLboolean transpose, const GLfloat *value)
-{
- d_2_0_Core->f.UniformMatrix3fv(location, count, transpose, value);
-}
-
-inline void QOpenGLFunctions_3_0::glUniformMatrix2fv(GLint location, GLsizei count, GLboolean transpose, const GLfloat *value)
-{
- d_2_0_Core->f.UniformMatrix2fv(location, count, transpose, value);
-}
-
-inline void QOpenGLFunctions_3_0::glUniform4iv(GLint location, GLsizei count, const GLint *value)
-{
- d_2_0_Core->f.Uniform4iv(location, count, value);
-}
-
-inline void QOpenGLFunctions_3_0::glUniform3iv(GLint location, GLsizei count, const GLint *value)
-{
- d_2_0_Core->f.Uniform3iv(location, count, value);
-}
-
-inline void QOpenGLFunctions_3_0::glUniform2iv(GLint location, GLsizei count, const GLint *value)
-{
- d_2_0_Core->f.Uniform2iv(location, count, value);
-}
-
-inline void QOpenGLFunctions_3_0::glUniform1iv(GLint location, GLsizei count, const GLint *value)
-{
- d_2_0_Core->f.Uniform1iv(location, count, value);
-}
-
-inline void QOpenGLFunctions_3_0::glUniform4fv(GLint location, GLsizei count, const GLfloat *value)
-{
- d_2_0_Core->f.Uniform4fv(location, count, value);
-}
-
-inline void QOpenGLFunctions_3_0::glUniform3fv(GLint location, GLsizei count, const GLfloat *value)
-{
- d_2_0_Core->f.Uniform3fv(location, count, value);
-}
-
-inline void QOpenGLFunctions_3_0::glUniform2fv(GLint location, GLsizei count, const GLfloat *value)
-{
- d_2_0_Core->f.Uniform2fv(location, count, value);
-}
-
-inline void QOpenGLFunctions_3_0::glUniform1fv(GLint location, GLsizei count, const GLfloat *value)
-{
- d_2_0_Core->f.Uniform1fv(location, count, value);
-}
-
-inline void QOpenGLFunctions_3_0::glUniform4i(GLint location, GLint v0, GLint v1, GLint v2, GLint v3)
-{
- d_2_0_Core->f.Uniform4i(location, v0, v1, v2, v3);
-}
-
-inline void QOpenGLFunctions_3_0::glUniform3i(GLint location, GLint v0, GLint v1, GLint v2)
-{
- d_2_0_Core->f.Uniform3i(location, v0, v1, v2);
-}
-
-inline void QOpenGLFunctions_3_0::glUniform2i(GLint location, GLint v0, GLint v1)
-{
- d_2_0_Core->f.Uniform2i(location, v0, v1);
-}
-
-inline void QOpenGLFunctions_3_0::glUniform1i(GLint location, GLint v0)
-{
- d_2_0_Core->f.Uniform1i(location, v0);
-}
-
-inline void QOpenGLFunctions_3_0::glUniform4f(GLint location, GLfloat v0, GLfloat v1, GLfloat v2, GLfloat v3)
-{
- d_2_0_Core->f.Uniform4f(location, v0, v1, v2, v3);
-}
-
-inline void QOpenGLFunctions_3_0::glUniform3f(GLint location, GLfloat v0, GLfloat v1, GLfloat v2)
-{
- d_2_0_Core->f.Uniform3f(location, v0, v1, v2);
-}
-
-inline void QOpenGLFunctions_3_0::glUniform2f(GLint location, GLfloat v0, GLfloat v1)
-{
- d_2_0_Core->f.Uniform2f(location, v0, v1);
-}
-
-inline void QOpenGLFunctions_3_0::glUniform1f(GLint location, GLfloat v0)
-{
- d_2_0_Core->f.Uniform1f(location, v0);
-}
-
-inline void QOpenGLFunctions_3_0::glUseProgram(GLuint program)
-{
- d_2_0_Core->f.UseProgram(program);
-}
-
-inline void QOpenGLFunctions_3_0::glShaderSource(GLuint shader, GLsizei count, const GLchar* const *string, const GLint *length)
-{
- d_2_0_Core->f.ShaderSource(shader, count, string, length);
-}
-
-inline void QOpenGLFunctions_3_0::glLinkProgram(GLuint program)
-{
- d_2_0_Core->f.LinkProgram(program);
-}
-
-inline GLboolean QOpenGLFunctions_3_0::glIsShader(GLuint shader)
-{
- return d_2_0_Core->f.IsShader(shader);
-}
-
-inline GLboolean QOpenGLFunctions_3_0::glIsProgram(GLuint program)
-{
- return d_2_0_Core->f.IsProgram(program);
-}
-
-inline void QOpenGLFunctions_3_0::glGetVertexAttribPointerv(GLuint index, GLenum pname, GLvoid* *pointer)
-{
- d_2_0_Core->f.GetVertexAttribPointerv(index, pname, pointer);
-}
-
-inline void QOpenGLFunctions_3_0::glGetVertexAttribiv(GLuint index, GLenum pname, GLint *params)
-{
- d_2_0_Core->f.GetVertexAttribiv(index, pname, params);
-}
-
-inline void QOpenGLFunctions_3_0::glGetVertexAttribfv(GLuint index, GLenum pname, GLfloat *params)
-{
- d_2_0_Core->f.GetVertexAttribfv(index, pname, params);
-}
-
-inline void QOpenGLFunctions_3_0::glGetVertexAttribdv(GLuint index, GLenum pname, GLdouble *params)
-{
- d_2_0_Core->f.GetVertexAttribdv(index, pname, params);
-}
-
-inline void QOpenGLFunctions_3_0::glGetUniformiv(GLuint program, GLint location, GLint *params)
-{
- d_2_0_Core->f.GetUniformiv(program, location, params);
-}
-
-inline void QOpenGLFunctions_3_0::glGetUniformfv(GLuint program, GLint location, GLfloat *params)
-{
- d_2_0_Core->f.GetUniformfv(program, location, params);
-}
-
-inline GLint QOpenGLFunctions_3_0::glGetUniformLocation(GLuint program, const GLchar *name)
-{
- return d_2_0_Core->f.GetUniformLocation(program, name);
-}
-
-inline void QOpenGLFunctions_3_0::glGetShaderSource(GLuint shader, GLsizei bufSize, GLsizei *length, GLchar *source)
-{
- d_2_0_Core->f.GetShaderSource(shader, bufSize, length, source);
-}
-
-inline void QOpenGLFunctions_3_0::glGetShaderInfoLog(GLuint shader, GLsizei bufSize, GLsizei *length, GLchar *infoLog)
-{
- d_2_0_Core->f.GetShaderInfoLog(shader, bufSize, length, infoLog);
-}
-
-inline void QOpenGLFunctions_3_0::glGetShaderiv(GLuint shader, GLenum pname, GLint *params)
-{
- d_2_0_Core->f.GetShaderiv(shader, pname, params);
-}
-
-inline void QOpenGLFunctions_3_0::glGetProgramInfoLog(GLuint program, GLsizei bufSize, GLsizei *length, GLchar *infoLog)
-{
- d_2_0_Core->f.GetProgramInfoLog(program, bufSize, length, infoLog);
-}
-
-inline void QOpenGLFunctions_3_0::glGetProgramiv(GLuint program, GLenum pname, GLint *params)
-{
- d_2_0_Core->f.GetProgramiv(program, pname, params);
-}
-
-inline GLint QOpenGLFunctions_3_0::glGetAttribLocation(GLuint program, const GLchar *name)
-{
- return d_2_0_Core->f.GetAttribLocation(program, name);
-}
-
-inline void QOpenGLFunctions_3_0::glGetAttachedShaders(GLuint program, GLsizei maxCount, GLsizei *count, GLuint *obj)
-{
- d_2_0_Core->f.GetAttachedShaders(program, maxCount, count, obj);
-}
-
-inline void QOpenGLFunctions_3_0::glGetActiveUniform(GLuint program, GLuint index, GLsizei bufSize, GLsizei *length, GLint *size, GLenum *type, GLchar *name)
-{
- d_2_0_Core->f.GetActiveUniform(program, index, bufSize, length, size, type, name);
-}
-
-inline void QOpenGLFunctions_3_0::glGetActiveAttrib(GLuint program, GLuint index, GLsizei bufSize, GLsizei *length, GLint *size, GLenum *type, GLchar *name)
-{
- d_2_0_Core->f.GetActiveAttrib(program, index, bufSize, length, size, type, name);
-}
-
-inline void QOpenGLFunctions_3_0::glEnableVertexAttribArray(GLuint index)
-{
- d_2_0_Core->f.EnableVertexAttribArray(index);
-}
-
-inline void QOpenGLFunctions_3_0::glDisableVertexAttribArray(GLuint index)
-{
- d_2_0_Core->f.DisableVertexAttribArray(index);
-}
-
-inline void QOpenGLFunctions_3_0::glDetachShader(GLuint program, GLuint shader)
-{
- d_2_0_Core->f.DetachShader(program, shader);
-}
-
-inline void QOpenGLFunctions_3_0::glDeleteShader(GLuint shader)
-{
- d_2_0_Core->f.DeleteShader(shader);
-}
-
-inline void QOpenGLFunctions_3_0::glDeleteProgram(GLuint program)
-{
- d_2_0_Core->f.DeleteProgram(program);
-}
-
-inline GLuint QOpenGLFunctions_3_0::glCreateShader(GLenum type)
-{
- return d_2_0_Core->f.CreateShader(type);
-}
-
-inline GLuint QOpenGLFunctions_3_0::glCreateProgram()
-{
- return d_2_0_Core->f.CreateProgram();
-}
-
-inline void QOpenGLFunctions_3_0::glCompileShader(GLuint shader)
-{
- d_2_0_Core->f.CompileShader(shader);
-}
-
-inline void QOpenGLFunctions_3_0::glBindAttribLocation(GLuint program, GLuint index, const GLchar *name)
-{
- d_2_0_Core->f.BindAttribLocation(program, index, name);
-}
-
-inline void QOpenGLFunctions_3_0::glAttachShader(GLuint program, GLuint shader)
-{
- d_2_0_Core->f.AttachShader(program, shader);
-}
-
-inline void QOpenGLFunctions_3_0::glStencilMaskSeparate(GLenum face, GLuint mask)
-{
- d_2_0_Core->f.StencilMaskSeparate(face, mask);
-}
-
-inline void QOpenGLFunctions_3_0::glStencilFuncSeparate(GLenum face, GLenum func, GLint ref, GLuint mask)
-{
- d_2_0_Core->f.StencilFuncSeparate(face, func, ref, mask);
-}
-
-inline void QOpenGLFunctions_3_0::glStencilOpSeparate(GLenum face, GLenum sfail, GLenum dpfail, GLenum dppass)
-{
- d_2_0_Core->f.StencilOpSeparate(face, sfail, dpfail, dppass);
-}
-
-inline void QOpenGLFunctions_3_0::glDrawBuffers(GLsizei n, const GLenum *bufs)
-{
- d_2_0_Core->f.DrawBuffers(n, bufs);
-}
-
-inline void QOpenGLFunctions_3_0::glBlendEquationSeparate(GLenum modeRGB, GLenum modeAlpha)
-{
- d_2_0_Core->f.BlendEquationSeparate(modeRGB, modeAlpha);
-}
-
-
-// OpenGL 2.1 core functions
-inline void QOpenGLFunctions_3_0::glUniformMatrix4x3fv(GLint location, GLsizei count, GLboolean transpose, const GLfloat *value)
-{
- d_2_1_Core->f.UniformMatrix4x3fv(location, count, transpose, value);
-}
-
-inline void QOpenGLFunctions_3_0::glUniformMatrix3x4fv(GLint location, GLsizei count, GLboolean transpose, const GLfloat *value)
-{
- d_2_1_Core->f.UniformMatrix3x4fv(location, count, transpose, value);
-}
-
-inline void QOpenGLFunctions_3_0::glUniformMatrix4x2fv(GLint location, GLsizei count, GLboolean transpose, const GLfloat *value)
-{
- d_2_1_Core->f.UniformMatrix4x2fv(location, count, transpose, value);
-}
-
-inline void QOpenGLFunctions_3_0::glUniformMatrix2x4fv(GLint location, GLsizei count, GLboolean transpose, const GLfloat *value)
-{
- d_2_1_Core->f.UniformMatrix2x4fv(location, count, transpose, value);
-}
-
-inline void QOpenGLFunctions_3_0::glUniformMatrix3x2fv(GLint location, GLsizei count, GLboolean transpose, const GLfloat *value)
-{
- d_2_1_Core->f.UniformMatrix3x2fv(location, count, transpose, value);
-}
-
-inline void QOpenGLFunctions_3_0::glUniformMatrix2x3fv(GLint location, GLsizei count, GLboolean transpose, const GLfloat *value)
-{
- d_2_1_Core->f.UniformMatrix2x3fv(location, count, transpose, value);
-}
-
-
-// OpenGL 3.0 core functions
-inline GLboolean QOpenGLFunctions_3_0::glIsVertexArray(GLuint array)
-{
- return d_3_0_Core->f.IsVertexArray(array);
-}
-
-inline void QOpenGLFunctions_3_0::glGenVertexArrays(GLsizei n, GLuint *arrays)
-{
- d_3_0_Core->f.GenVertexArrays(n, arrays);
-}
-
-inline void QOpenGLFunctions_3_0::glDeleteVertexArrays(GLsizei n, const GLuint *arrays)
-{
- d_3_0_Core->f.DeleteVertexArrays(n, arrays);
-}
-
-inline void QOpenGLFunctions_3_0::glBindVertexArray(GLuint array)
-{
- d_3_0_Core->f.BindVertexArray(array);
-}
-
-inline void QOpenGLFunctions_3_0::glFlushMappedBufferRange(GLenum target, GLintptr offset, GLsizeiptr length)
-{
- d_3_0_Core->f.FlushMappedBufferRange(target, offset, length);
-}
-
-inline GLvoid* QOpenGLFunctions_3_0::glMapBufferRange(GLenum target, GLintptr offset, GLsizeiptr length, GLbitfield access)
-{
- return d_3_0_Core->f.MapBufferRange(target, offset, length, access);
-}
-
-inline void QOpenGLFunctions_3_0::glFramebufferTextureLayer(GLenum target, GLenum attachment, GLuint texture, GLint level, GLint layer)
-{
- d_3_0_Core->f.FramebufferTextureLayer(target, attachment, texture, level, layer);
-}
-
-inline void QOpenGLFunctions_3_0::glRenderbufferStorageMultisample(GLenum target, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height)
-{
- d_3_0_Core->f.RenderbufferStorageMultisample(target, samples, internalformat, width, height);
-}
-
-inline void QOpenGLFunctions_3_0::glBlitFramebuffer(GLint srcX0, GLint srcY0, GLint srcX1, GLint srcY1, GLint dstX0, GLint dstY0, GLint dstX1, GLint dstY1, GLbitfield mask, GLenum filter)
-{
- d_3_0_Core->f.BlitFramebuffer(srcX0, srcY0, srcX1, srcY1, dstX0, dstY0, dstX1, dstY1, mask, filter);
-}
-
-inline void QOpenGLFunctions_3_0::glGenerateMipmap(GLenum target)
-{
- d_3_0_Core->f.GenerateMipmap(target);
-}
-
-inline void QOpenGLFunctions_3_0::glGetFramebufferAttachmentParameteriv(GLenum target, GLenum attachment, GLenum pname, GLint *params)
-{
- d_3_0_Core->f.GetFramebufferAttachmentParameteriv(target, attachment, pname, params);
-}
-
-inline void QOpenGLFunctions_3_0::glFramebufferRenderbuffer(GLenum target, GLenum attachment, GLenum renderbuffertarget, GLuint renderbuffer)
-{
- d_3_0_Core->f.FramebufferRenderbuffer(target, attachment, renderbuffertarget, renderbuffer);
-}
-
-inline void QOpenGLFunctions_3_0::glFramebufferTexture3D(GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level, GLint zoffset)
-{
- d_3_0_Core->f.FramebufferTexture3D(target, attachment, textarget, texture, level, zoffset);
-}
-
-inline void QOpenGLFunctions_3_0::glFramebufferTexture2D(GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level)
-{
- d_3_0_Core->f.FramebufferTexture2D(target, attachment, textarget, texture, level);
-}
-
-inline void QOpenGLFunctions_3_0::glFramebufferTexture1D(GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level)
-{
- d_3_0_Core->f.FramebufferTexture1D(target, attachment, textarget, texture, level);
-}
-
-inline GLenum QOpenGLFunctions_3_0::glCheckFramebufferStatus(GLenum target)
-{
- return d_3_0_Core->f.CheckFramebufferStatus(target);
-}
-
-inline void QOpenGLFunctions_3_0::glGenFramebuffers(GLsizei n, GLuint *framebuffers)
-{
- d_3_0_Core->f.GenFramebuffers(n, framebuffers);
-}
-
-inline void QOpenGLFunctions_3_0::glDeleteFramebuffers(GLsizei n, const GLuint *framebuffers)
-{
- d_3_0_Core->f.DeleteFramebuffers(n, framebuffers);
-}
-
-inline void QOpenGLFunctions_3_0::glBindFramebuffer(GLenum target, GLuint framebuffer)
-{
- d_3_0_Core->f.BindFramebuffer(target, framebuffer);
-}
-
-inline GLboolean QOpenGLFunctions_3_0::glIsFramebuffer(GLuint framebuffer)
-{
- return d_3_0_Core->f.IsFramebuffer(framebuffer);
-}
-
-inline void QOpenGLFunctions_3_0::glGetRenderbufferParameteriv(GLenum target, GLenum pname, GLint *params)
-{
- d_3_0_Core->f.GetRenderbufferParameteriv(target, pname, params);
-}
-
-inline void QOpenGLFunctions_3_0::glRenderbufferStorage(GLenum target, GLenum internalformat, GLsizei width, GLsizei height)
-{
- d_3_0_Core->f.RenderbufferStorage(target, internalformat, width, height);
-}
-
-inline void QOpenGLFunctions_3_0::glGenRenderbuffers(GLsizei n, GLuint *renderbuffers)
-{
- d_3_0_Core->f.GenRenderbuffers(n, renderbuffers);
-}
-
-inline void QOpenGLFunctions_3_0::glDeleteRenderbuffers(GLsizei n, const GLuint *renderbuffers)
-{
- d_3_0_Core->f.DeleteRenderbuffers(n, renderbuffers);
-}
-
-inline void QOpenGLFunctions_3_0::glBindRenderbuffer(GLenum target, GLuint renderbuffer)
-{
- d_3_0_Core->f.BindRenderbuffer(target, renderbuffer);
-}
-
-inline GLboolean QOpenGLFunctions_3_0::glIsRenderbuffer(GLuint renderbuffer)
-{
- return d_3_0_Core->f.IsRenderbuffer(renderbuffer);
-}
-
-inline const GLubyte * QOpenGLFunctions_3_0::glGetStringi(GLenum name, GLuint index)
-{
- return d_3_0_Core->f.GetStringi(name, index);
-}
-
-inline void QOpenGLFunctions_3_0::glClearBufferfi(GLenum buffer, GLint drawbuffer, GLfloat depth, GLint stencil)
-{
- d_3_0_Core->f.ClearBufferfi(buffer, drawbuffer, depth, stencil);
-}
-
-inline void QOpenGLFunctions_3_0::glClearBufferfv(GLenum buffer, GLint drawbuffer, const GLfloat *value)
-{
- d_3_0_Core->f.ClearBufferfv(buffer, drawbuffer, value);
-}
-
-inline void QOpenGLFunctions_3_0::glClearBufferuiv(GLenum buffer, GLint drawbuffer, const GLuint *value)
-{
- d_3_0_Core->f.ClearBufferuiv(buffer, drawbuffer, value);
-}
-
-inline void QOpenGLFunctions_3_0::glClearBufferiv(GLenum buffer, GLint drawbuffer, const GLint *value)
-{
- d_3_0_Core->f.ClearBufferiv(buffer, drawbuffer, value);
-}
-
-inline void QOpenGLFunctions_3_0::glGetTexParameterIuiv(GLenum target, GLenum pname, GLuint *params)
-{
- d_3_0_Core->f.GetTexParameterIuiv(target, pname, params);
-}
-
-inline void QOpenGLFunctions_3_0::glGetTexParameterIiv(GLenum target, GLenum pname, GLint *params)
-{
- d_3_0_Core->f.GetTexParameterIiv(target, pname, params);
-}
-
-inline void QOpenGLFunctions_3_0::glTexParameterIuiv(GLenum target, GLenum pname, const GLuint *params)
-{
- d_3_0_Core->f.TexParameterIuiv(target, pname, params);
-}
-
-inline void QOpenGLFunctions_3_0::glTexParameterIiv(GLenum target, GLenum pname, const GLint *params)
-{
- d_3_0_Core->f.TexParameterIiv(target, pname, params);
-}
-
-inline void QOpenGLFunctions_3_0::glUniform4uiv(GLint location, GLsizei count, const GLuint *value)
-{
- d_3_0_Core->f.Uniform4uiv(location, count, value);
-}
-
-inline void QOpenGLFunctions_3_0::glUniform3uiv(GLint location, GLsizei count, const GLuint *value)
-{
- d_3_0_Core->f.Uniform3uiv(location, count, value);
-}
-
-inline void QOpenGLFunctions_3_0::glUniform2uiv(GLint location, GLsizei count, const GLuint *value)
-{
- d_3_0_Core->f.Uniform2uiv(location, count, value);
-}
-
-inline void QOpenGLFunctions_3_0::glUniform1uiv(GLint location, GLsizei count, const GLuint *value)
-{
- d_3_0_Core->f.Uniform1uiv(location, count, value);
-}
-
-inline void QOpenGLFunctions_3_0::glUniform4ui(GLint location, GLuint v0, GLuint v1, GLuint v2, GLuint v3)
-{
- d_3_0_Core->f.Uniform4ui(location, v0, v1, v2, v3);
-}
-
-inline void QOpenGLFunctions_3_0::glUniform3ui(GLint location, GLuint v0, GLuint v1, GLuint v2)
-{
- d_3_0_Core->f.Uniform3ui(location, v0, v1, v2);
-}
-
-inline void QOpenGLFunctions_3_0::glUniform2ui(GLint location, GLuint v0, GLuint v1)
-{
- d_3_0_Core->f.Uniform2ui(location, v0, v1);
-}
-
-inline void QOpenGLFunctions_3_0::glUniform1ui(GLint location, GLuint v0)
-{
- d_3_0_Core->f.Uniform1ui(location, v0);
-}
-
-inline GLint QOpenGLFunctions_3_0::glGetFragDataLocation(GLuint program, const GLchar *name)
-{
- return d_3_0_Core->f.GetFragDataLocation(program, name);
-}
-
-inline void QOpenGLFunctions_3_0::glBindFragDataLocation(GLuint program, GLuint color, const GLchar *name)
-{
- d_3_0_Core->f.BindFragDataLocation(program, color, name);
-}
-
-inline void QOpenGLFunctions_3_0::glGetUniformuiv(GLuint program, GLint location, GLuint *params)
-{
- d_3_0_Core->f.GetUniformuiv(program, location, params);
-}
-
-inline void QOpenGLFunctions_3_0::glGetVertexAttribIuiv(GLuint index, GLenum pname, GLuint *params)
-{
- d_3_0_Core->f.GetVertexAttribIuiv(index, pname, params);
-}
-
-inline void QOpenGLFunctions_3_0::glGetVertexAttribIiv(GLuint index, GLenum pname, GLint *params)
-{
- d_3_0_Core->f.GetVertexAttribIiv(index, pname, params);
-}
-
-inline void QOpenGLFunctions_3_0::glVertexAttribIPointer(GLuint index, GLint size, GLenum type, GLsizei stride, const GLvoid *pointer)
-{
- d_3_0_Core->f.VertexAttribIPointer(index, size, type, stride, pointer);
-}
-
-inline void QOpenGLFunctions_3_0::glEndConditionalRender()
-{
- d_3_0_Core->f.EndConditionalRender();
-}
-
-inline void QOpenGLFunctions_3_0::glBeginConditionalRender(GLuint id, GLenum mode)
-{
- d_3_0_Core->f.BeginConditionalRender(id, mode);
-}
-
-inline void QOpenGLFunctions_3_0::glClampColor(GLenum target, GLenum clamp)
-{
- d_3_0_Core->f.ClampColor(target, clamp);
-}
-
-inline void QOpenGLFunctions_3_0::glGetTransformFeedbackVarying(GLuint program, GLuint index, GLsizei bufSize, GLsizei *length, GLsizei *size, GLenum *type, GLchar *name)
-{
- d_3_0_Core->f.GetTransformFeedbackVarying(program, index, bufSize, length, size, type, name);
-}
-
-inline void QOpenGLFunctions_3_0::glTransformFeedbackVaryings(GLuint program, GLsizei count, const GLchar* const *varyings, GLenum bufferMode)
-{
- d_3_0_Core->f.TransformFeedbackVaryings(program, count, varyings, bufferMode);
-}
-
-inline void QOpenGLFunctions_3_0::glBindBufferBase(GLenum target, GLuint index, GLuint buffer)
-{
- d_3_0_Core->f.BindBufferBase(target, index, buffer);
-}
-
-inline void QOpenGLFunctions_3_0::glBindBufferRange(GLenum target, GLuint index, GLuint buffer, GLintptr offset, GLsizeiptr size)
-{
- d_3_0_Core->f.BindBufferRange(target, index, buffer, offset, size);
-}
-
-inline void QOpenGLFunctions_3_0::glEndTransformFeedback()
-{
- d_3_0_Core->f.EndTransformFeedback();
-}
-
-inline void QOpenGLFunctions_3_0::glBeginTransformFeedback(GLenum primitiveMode)
-{
- d_3_0_Core->f.BeginTransformFeedback(primitiveMode);
-}
-
-inline GLboolean QOpenGLFunctions_3_0::glIsEnabledi(GLenum target, GLuint index)
-{
- return d_3_0_Core->f.IsEnabledi(target, index);
-}
-
-inline void QOpenGLFunctions_3_0::glDisablei(GLenum target, GLuint index)
-{
- d_3_0_Core->f.Disablei(target, index);
-}
-
-inline void QOpenGLFunctions_3_0::glEnablei(GLenum target, GLuint index)
-{
- d_3_0_Core->f.Enablei(target, index);
-}
-
-inline void QOpenGLFunctions_3_0::glGetIntegeri_v(GLenum target, GLuint index, GLint *data)
-{
- d_3_0_Core->f.GetIntegeri_v(target, index, data);
-}
-
-inline void QOpenGLFunctions_3_0::glGetBooleani_v(GLenum target, GLuint index, GLboolean *data)
-{
- d_3_0_Core->f.GetBooleani_v(target, index, data);
-}
-
-inline void QOpenGLFunctions_3_0::glColorMaski(GLuint index, GLboolean r, GLboolean g, GLboolean b, GLboolean a)
-{
- d_3_0_Core->f.ColorMaski(index, r, g, b, a);
-}
-
-
-// OpenGL 1.0 deprecated functions
-inline void QOpenGLFunctions_3_0::glTranslatef(GLfloat x, GLfloat y, GLfloat z)
-{
- d_1_0_Deprecated->f.Translatef(x, y, z);
-}
-
-inline void QOpenGLFunctions_3_0::glTranslated(GLdouble x, GLdouble y, GLdouble z)
-{
- d_1_0_Deprecated->f.Translated(x, y, z);
-}
-
-inline void QOpenGLFunctions_3_0::glScalef(GLfloat x, GLfloat y, GLfloat z)
-{
- d_1_0_Deprecated->f.Scalef(x, y, z);
-}
-
-inline void QOpenGLFunctions_3_0::glScaled(GLdouble x, GLdouble y, GLdouble z)
-{
- d_1_0_Deprecated->f.Scaled(x, y, z);
-}
-
-inline void QOpenGLFunctions_3_0::glRotatef(GLfloat angle, GLfloat x, GLfloat y, GLfloat z)
-{
- d_1_0_Deprecated->f.Rotatef(angle, x, y, z);
-}
-
-inline void QOpenGLFunctions_3_0::glRotated(GLdouble angle, GLdouble x, GLdouble y, GLdouble z)
-{
- d_1_0_Deprecated->f.Rotated(angle, x, y, z);
-}
-
-inline void QOpenGLFunctions_3_0::glPushMatrix()
-{
- d_1_0_Deprecated->f.PushMatrix();
-}
-
-inline void QOpenGLFunctions_3_0::glPopMatrix()
-{
- d_1_0_Deprecated->f.PopMatrix();
-}
-
-inline void QOpenGLFunctions_3_0::glOrtho(GLdouble left, GLdouble right, GLdouble bottom, GLdouble top, GLdouble zNear, GLdouble zFar)
-{
- d_1_0_Deprecated->f.Ortho(left, right, bottom, top, zNear, zFar);
-}
-
-inline void QOpenGLFunctions_3_0::glMultMatrixd(const GLdouble *m)
-{
- d_1_0_Deprecated->f.MultMatrixd(m);
-}
-
-inline void QOpenGLFunctions_3_0::glMultMatrixf(const GLfloat *m)
-{
- d_1_0_Deprecated->f.MultMatrixf(m);
-}
-
-inline void QOpenGLFunctions_3_0::glMatrixMode(GLenum mode)
-{
- d_1_0_Deprecated->f.MatrixMode(mode);
-}
-
-inline void QOpenGLFunctions_3_0::glLoadMatrixd(const GLdouble *m)
-{
- d_1_0_Deprecated->f.LoadMatrixd(m);
-}
-
-inline void QOpenGLFunctions_3_0::glLoadMatrixf(const GLfloat *m)
-{
- d_1_0_Deprecated->f.LoadMatrixf(m);
-}
-
-inline void QOpenGLFunctions_3_0::glLoadIdentity()
-{
- d_1_0_Deprecated->f.LoadIdentity();
-}
-
-inline void QOpenGLFunctions_3_0::glFrustum(GLdouble left, GLdouble right, GLdouble bottom, GLdouble top, GLdouble zNear, GLdouble zFar)
-{
- d_1_0_Deprecated->f.Frustum(left, right, bottom, top, zNear, zFar);
-}
-
-inline GLboolean QOpenGLFunctions_3_0::glIsList(GLuint list)
-{
- return d_1_0_Deprecated->f.IsList(list);
-}
-
-inline void QOpenGLFunctions_3_0::glGetTexGeniv(GLenum coord, GLenum pname, GLint *params)
-{
- d_1_0_Deprecated->f.GetTexGeniv(coord, pname, params);
-}
-
-inline void QOpenGLFunctions_3_0::glGetTexGenfv(GLenum coord, GLenum pname, GLfloat *params)
-{
- d_1_0_Deprecated->f.GetTexGenfv(coord, pname, params);
-}
-
-inline void QOpenGLFunctions_3_0::glGetTexGendv(GLenum coord, GLenum pname, GLdouble *params)
-{
- d_1_0_Deprecated->f.GetTexGendv(coord, pname, params);
-}
-
-inline void QOpenGLFunctions_3_0::glGetTexEnviv(GLenum target, GLenum pname, GLint *params)
-{
- d_1_0_Deprecated->f.GetTexEnviv(target, pname, params);
-}
-
-inline void QOpenGLFunctions_3_0::glGetTexEnvfv(GLenum target, GLenum pname, GLfloat *params)
-{
- d_1_0_Deprecated->f.GetTexEnvfv(target, pname, params);
-}
-
-inline void QOpenGLFunctions_3_0::glGetPolygonStipple(GLubyte *mask)
-{
- d_1_0_Deprecated->f.GetPolygonStipple(mask);
-}
-
-inline void QOpenGLFunctions_3_0::glGetPixelMapusv(GLenum map, GLushort *values)
-{
- d_1_0_Deprecated->f.GetPixelMapusv(map, values);
-}
-
-inline void QOpenGLFunctions_3_0::glGetPixelMapuiv(GLenum map, GLuint *values)
-{
- d_1_0_Deprecated->f.GetPixelMapuiv(map, values);
-}
-
-inline void QOpenGLFunctions_3_0::glGetPixelMapfv(GLenum map, GLfloat *values)
-{
- d_1_0_Deprecated->f.GetPixelMapfv(map, values);
-}
-
-inline void QOpenGLFunctions_3_0::glGetMaterialiv(GLenum face, GLenum pname, GLint *params)
-{
- d_1_0_Deprecated->f.GetMaterialiv(face, pname, params);
-}
-
-inline void QOpenGLFunctions_3_0::glGetMaterialfv(GLenum face, GLenum pname, GLfloat *params)
-{
- d_1_0_Deprecated->f.GetMaterialfv(face, pname, params);
-}
-
-inline void QOpenGLFunctions_3_0::glGetMapiv(GLenum target, GLenum query, GLint *v)
-{
- d_1_0_Deprecated->f.GetMapiv(target, query, v);
-}
-
-inline void QOpenGLFunctions_3_0::glGetMapfv(GLenum target, GLenum query, GLfloat *v)
-{
- d_1_0_Deprecated->f.GetMapfv(target, query, v);
-}
-
-inline void QOpenGLFunctions_3_0::glGetMapdv(GLenum target, GLenum query, GLdouble *v)
-{
- d_1_0_Deprecated->f.GetMapdv(target, query, v);
-}
-
-inline void QOpenGLFunctions_3_0::glGetLightiv(GLenum light, GLenum pname, GLint *params)
-{
- d_1_0_Deprecated->f.GetLightiv(light, pname, params);
-}
-
-inline void QOpenGLFunctions_3_0::glGetLightfv(GLenum light, GLenum pname, GLfloat *params)
-{
- d_1_0_Deprecated->f.GetLightfv(light, pname, params);
-}
-
-inline void QOpenGLFunctions_3_0::glGetClipPlane(GLenum plane, GLdouble *equation)
-{
- d_1_0_Deprecated->f.GetClipPlane(plane, equation);
-}
-
-inline void QOpenGLFunctions_3_0::glDrawPixels(GLsizei width, GLsizei height, GLenum format, GLenum type, const GLvoid *pixels)
-{
- d_1_0_Deprecated->f.DrawPixels(width, height, format, type, pixels);
-}
-
-inline void QOpenGLFunctions_3_0::glCopyPixels(GLint x, GLint y, GLsizei width, GLsizei height, GLenum type)
-{
- d_1_0_Deprecated->f.CopyPixels(x, y, width, height, type);
-}
-
-inline void QOpenGLFunctions_3_0::glPixelMapusv(GLenum map, GLint mapsize, const GLushort *values)
-{
- d_1_0_Deprecated->f.PixelMapusv(map, mapsize, values);
-}
-
-inline void QOpenGLFunctions_3_0::glPixelMapuiv(GLenum map, GLint mapsize, const GLuint *values)
-{
- d_1_0_Deprecated->f.PixelMapuiv(map, mapsize, values);
-}
-
-inline void QOpenGLFunctions_3_0::glPixelMapfv(GLenum map, GLint mapsize, const GLfloat *values)
-{
- d_1_0_Deprecated->f.PixelMapfv(map, mapsize, values);
-}
-
-inline void QOpenGLFunctions_3_0::glPixelTransferi(GLenum pname, GLint param)
-{
- d_1_0_Deprecated->f.PixelTransferi(pname, param);
-}
-
-inline void QOpenGLFunctions_3_0::glPixelTransferf(GLenum pname, GLfloat param)
-{
- d_1_0_Deprecated->f.PixelTransferf(pname, param);
-}
-
-inline void QOpenGLFunctions_3_0::glPixelZoom(GLfloat xfactor, GLfloat yfactor)
-{
- d_1_0_Deprecated->f.PixelZoom(xfactor, yfactor);
-}
-
-inline void QOpenGLFunctions_3_0::glAlphaFunc(GLenum func, GLfloat ref)
-{
- d_1_0_Deprecated->f.AlphaFunc(func, ref);
-}
-
-inline void QOpenGLFunctions_3_0::glEvalPoint2(GLint i, GLint j)
-{
- d_1_0_Deprecated->f.EvalPoint2(i, j);
-}
-
-inline void QOpenGLFunctions_3_0::glEvalMesh2(GLenum mode, GLint i1, GLint i2, GLint j1, GLint j2)
-{
- d_1_0_Deprecated->f.EvalMesh2(mode, i1, i2, j1, j2);
-}
-
-inline void QOpenGLFunctions_3_0::glEvalPoint1(GLint i)
-{
- d_1_0_Deprecated->f.EvalPoint1(i);
-}
-
-inline void QOpenGLFunctions_3_0::glEvalMesh1(GLenum mode, GLint i1, GLint i2)
-{
- d_1_0_Deprecated->f.EvalMesh1(mode, i1, i2);
-}
-
-inline void QOpenGLFunctions_3_0::glEvalCoord2fv(const GLfloat *u)
-{
- d_1_0_Deprecated->f.EvalCoord2fv(u);
-}
-
-inline void QOpenGLFunctions_3_0::glEvalCoord2f(GLfloat u, GLfloat v)
-{
- d_1_0_Deprecated->f.EvalCoord2f(u, v);
-}
-
-inline void QOpenGLFunctions_3_0::glEvalCoord2dv(const GLdouble *u)
-{
- d_1_0_Deprecated->f.EvalCoord2dv(u);
-}
-
-inline void QOpenGLFunctions_3_0::glEvalCoord2d(GLdouble u, GLdouble v)
-{
- d_1_0_Deprecated->f.EvalCoord2d(u, v);
-}
-
-inline void QOpenGLFunctions_3_0::glEvalCoord1fv(const GLfloat *u)
-{
- d_1_0_Deprecated->f.EvalCoord1fv(u);
-}
-
-inline void QOpenGLFunctions_3_0::glEvalCoord1f(GLfloat u)
-{
- d_1_0_Deprecated->f.EvalCoord1f(u);
-}
-
-inline void QOpenGLFunctions_3_0::glEvalCoord1dv(const GLdouble *u)
-{
- d_1_0_Deprecated->f.EvalCoord1dv(u);
-}
-
-inline void QOpenGLFunctions_3_0::glEvalCoord1d(GLdouble u)
-{
- d_1_0_Deprecated->f.EvalCoord1d(u);
-}
-
-inline void QOpenGLFunctions_3_0::glMapGrid2f(GLint un, GLfloat u1, GLfloat u2, GLint vn, GLfloat v1, GLfloat v2)
-{
- d_1_0_Deprecated->f.MapGrid2f(un, u1, u2, vn, v1, v2);
-}
-
-inline void QOpenGLFunctions_3_0::glMapGrid2d(GLint un, GLdouble u1, GLdouble u2, GLint vn, GLdouble v1, GLdouble v2)
-{
- d_1_0_Deprecated->f.MapGrid2d(un, u1, u2, vn, v1, v2);
-}
-
-inline void QOpenGLFunctions_3_0::glMapGrid1f(GLint un, GLfloat u1, GLfloat u2)
-{
- d_1_0_Deprecated->f.MapGrid1f(un, u1, u2);
-}
-
-inline void QOpenGLFunctions_3_0::glMapGrid1d(GLint un, GLdouble u1, GLdouble u2)
-{
- d_1_0_Deprecated->f.MapGrid1d(un, u1, u2);
-}
-
-inline void QOpenGLFunctions_3_0::glMap2f(GLenum target, GLfloat u1, GLfloat u2, GLint ustride, GLint uorder, GLfloat v1, GLfloat v2, GLint vstride, GLint vorder, const GLfloat *points)
-{
- d_1_0_Deprecated->f.Map2f(target, u1, u2, ustride, uorder, v1, v2, vstride, vorder, points);
-}
-
-inline void QOpenGLFunctions_3_0::glMap2d(GLenum target, GLdouble u1, GLdouble u2, GLint ustride, GLint uorder, GLdouble v1, GLdouble v2, GLint vstride, GLint vorder, const GLdouble *points)
-{
- d_1_0_Deprecated->f.Map2d(target, u1, u2, ustride, uorder, v1, v2, vstride, vorder, points);
-}
-
-inline void QOpenGLFunctions_3_0::glMap1f(GLenum target, GLfloat u1, GLfloat u2, GLint stride, GLint order, const GLfloat *points)
-{
- d_1_0_Deprecated->f.Map1f(target, u1, u2, stride, order, points);
-}
-
-inline void QOpenGLFunctions_3_0::glMap1d(GLenum target, GLdouble u1, GLdouble u2, GLint stride, GLint order, const GLdouble *points)
-{
- d_1_0_Deprecated->f.Map1d(target, u1, u2, stride, order, points);
-}
-
-inline void QOpenGLFunctions_3_0::glPushAttrib(GLbitfield mask)
-{
- d_1_0_Deprecated->f.PushAttrib(mask);
-}
-
-inline void QOpenGLFunctions_3_0::glPopAttrib()
-{
- d_1_0_Deprecated->f.PopAttrib();
-}
-
-inline void QOpenGLFunctions_3_0::glAccum(GLenum op, GLfloat value)
-{
- d_1_0_Deprecated->f.Accum(op, value);
-}
-
-inline void QOpenGLFunctions_3_0::glIndexMask(GLuint mask)
-{
- d_1_0_Deprecated->f.IndexMask(mask);
-}
-
-inline void QOpenGLFunctions_3_0::glClearIndex(GLfloat c)
-{
- d_1_0_Deprecated->f.ClearIndex(c);
-}
-
-inline void QOpenGLFunctions_3_0::glClearAccum(GLfloat red, GLfloat green, GLfloat blue, GLfloat alpha)
-{
- d_1_0_Deprecated->f.ClearAccum(red, green, blue, alpha);
-}
-
-inline void QOpenGLFunctions_3_0::glPushName(GLuint name)
-{
- d_1_0_Deprecated->f.PushName(name);
-}
-
-inline void QOpenGLFunctions_3_0::glPopName()
-{
- d_1_0_Deprecated->f.PopName();
-}
-
-inline void QOpenGLFunctions_3_0::glPassThrough(GLfloat token)
-{
- d_1_0_Deprecated->f.PassThrough(token);
-}
-
-inline void QOpenGLFunctions_3_0::glLoadName(GLuint name)
-{
- d_1_0_Deprecated->f.LoadName(name);
-}
-
-inline void QOpenGLFunctions_3_0::glInitNames()
-{
- d_1_0_Deprecated->f.InitNames();
-}
-
-inline GLint QOpenGLFunctions_3_0::glRenderMode(GLenum mode)
-{
- return d_1_0_Deprecated->f.RenderMode(mode);
-}
-
-inline void QOpenGLFunctions_3_0::glSelectBuffer(GLsizei size, GLuint *buffer)
-{
- d_1_0_Deprecated->f.SelectBuffer(size, buffer);
-}
-
-inline void QOpenGLFunctions_3_0::glFeedbackBuffer(GLsizei size, GLenum type, GLfloat *buffer)
-{
- d_1_0_Deprecated->f.FeedbackBuffer(size, type, buffer);
-}
-
-inline void QOpenGLFunctions_3_0::glTexGeniv(GLenum coord, GLenum pname, const GLint *params)
-{
- d_1_0_Deprecated->f.TexGeniv(coord, pname, params);
-}
-
-inline void QOpenGLFunctions_3_0::glTexGeni(GLenum coord, GLenum pname, GLint param)
-{
- d_1_0_Deprecated->f.TexGeni(coord, pname, param);
-}
-
-inline void QOpenGLFunctions_3_0::glTexGenfv(GLenum coord, GLenum pname, const GLfloat *params)
-{
- d_1_0_Deprecated->f.TexGenfv(coord, pname, params);
-}
-
-inline void QOpenGLFunctions_3_0::glTexGenf(GLenum coord, GLenum pname, GLfloat param)
-{
- d_1_0_Deprecated->f.TexGenf(coord, pname, param);
-}
-
-inline void QOpenGLFunctions_3_0::glTexGendv(GLenum coord, GLenum pname, const GLdouble *params)
-{
- d_1_0_Deprecated->f.TexGendv(coord, pname, params);
-}
-
-inline void QOpenGLFunctions_3_0::glTexGend(GLenum coord, GLenum pname, GLdouble param)
-{
- d_1_0_Deprecated->f.TexGend(coord, pname, param);
-}
-
-inline void QOpenGLFunctions_3_0::glTexEnviv(GLenum target, GLenum pname, const GLint *params)
-{
- d_1_0_Deprecated->f.TexEnviv(target, pname, params);
-}
-
-inline void QOpenGLFunctions_3_0::glTexEnvi(GLenum target, GLenum pname, GLint param)
-{
- d_1_0_Deprecated->f.TexEnvi(target, pname, param);
-}
-
-inline void QOpenGLFunctions_3_0::glTexEnvfv(GLenum target, GLenum pname, const GLfloat *params)
-{
- d_1_0_Deprecated->f.TexEnvfv(target, pname, params);
-}
-
-inline void QOpenGLFunctions_3_0::glTexEnvf(GLenum target, GLenum pname, GLfloat param)
-{
- d_1_0_Deprecated->f.TexEnvf(target, pname, param);
-}
-
-inline void QOpenGLFunctions_3_0::glShadeModel(GLenum mode)
-{
- d_1_0_Deprecated->f.ShadeModel(mode);
-}
-
-inline void QOpenGLFunctions_3_0::glPolygonStipple(const GLubyte *mask)
-{
- d_1_0_Deprecated->f.PolygonStipple(mask);
-}
-
-inline void QOpenGLFunctions_3_0::glMaterialiv(GLenum face, GLenum pname, const GLint *params)
-{
- d_1_0_Deprecated->f.Materialiv(face, pname, params);
-}
-
-inline void QOpenGLFunctions_3_0::glMateriali(GLenum face, GLenum pname, GLint param)
-{
- d_1_0_Deprecated->f.Materiali(face, pname, param);
-}
-
-inline void QOpenGLFunctions_3_0::glMaterialfv(GLenum face, GLenum pname, const GLfloat *params)
-{
- d_1_0_Deprecated->f.Materialfv(face, pname, params);
-}
-
-inline void QOpenGLFunctions_3_0::glMaterialf(GLenum face, GLenum pname, GLfloat param)
-{
- d_1_0_Deprecated->f.Materialf(face, pname, param);
-}
-
-inline void QOpenGLFunctions_3_0::glLineStipple(GLint factor, GLushort pattern)
-{
- d_1_0_Deprecated->f.LineStipple(factor, pattern);
-}
-
-inline void QOpenGLFunctions_3_0::glLightModeliv(GLenum pname, const GLint *params)
-{
- d_1_0_Deprecated->f.LightModeliv(pname, params);
-}
-
-inline void QOpenGLFunctions_3_0::glLightModeli(GLenum pname, GLint param)
-{
- d_1_0_Deprecated->f.LightModeli(pname, param);
-}
-
-inline void QOpenGLFunctions_3_0::glLightModelfv(GLenum pname, const GLfloat *params)
-{
- d_1_0_Deprecated->f.LightModelfv(pname, params);
-}
-
-inline void QOpenGLFunctions_3_0::glLightModelf(GLenum pname, GLfloat param)
-{
- d_1_0_Deprecated->f.LightModelf(pname, param);
-}
-
-inline void QOpenGLFunctions_3_0::glLightiv(GLenum light, GLenum pname, const GLint *params)
-{
- d_1_0_Deprecated->f.Lightiv(light, pname, params);
-}
-
-inline void QOpenGLFunctions_3_0::glLighti(GLenum light, GLenum pname, GLint param)
-{
- d_1_0_Deprecated->f.Lighti(light, pname, param);
-}
-
-inline void QOpenGLFunctions_3_0::glLightfv(GLenum light, GLenum pname, const GLfloat *params)
-{
- d_1_0_Deprecated->f.Lightfv(light, pname, params);
-}
-
-inline void QOpenGLFunctions_3_0::glLightf(GLenum light, GLenum pname, GLfloat param)
-{
- d_1_0_Deprecated->f.Lightf(light, pname, param);
-}
-
-inline void QOpenGLFunctions_3_0::glFogiv(GLenum pname, const GLint *params)
-{
- d_1_0_Deprecated->f.Fogiv(pname, params);
-}
-
-inline void QOpenGLFunctions_3_0::glFogi(GLenum pname, GLint param)
-{
- d_1_0_Deprecated->f.Fogi(pname, param);
-}
-
-inline void QOpenGLFunctions_3_0::glFogfv(GLenum pname, const GLfloat *params)
-{
- d_1_0_Deprecated->f.Fogfv(pname, params);
-}
-
-inline void QOpenGLFunctions_3_0::glFogf(GLenum pname, GLfloat param)
-{
- d_1_0_Deprecated->f.Fogf(pname, param);
-}
-
-inline void QOpenGLFunctions_3_0::glColorMaterial(GLenum face, GLenum mode)
-{
- d_1_0_Deprecated->f.ColorMaterial(face, mode);
-}
-
-inline void QOpenGLFunctions_3_0::glClipPlane(GLenum plane, const GLdouble *equation)
-{
- d_1_0_Deprecated->f.ClipPlane(plane, equation);
-}
-
-inline void QOpenGLFunctions_3_0::glVertex4sv(const GLshort *v)
-{
- d_1_0_Deprecated->f.Vertex4sv(v);
-}
-
-inline void QOpenGLFunctions_3_0::glVertex4s(GLshort x, GLshort y, GLshort z, GLshort w)
-{
- d_1_0_Deprecated->f.Vertex4s(x, y, z, w);
-}
-
-inline void QOpenGLFunctions_3_0::glVertex4iv(const GLint *v)
-{
- d_1_0_Deprecated->f.Vertex4iv(v);
-}
-
-inline void QOpenGLFunctions_3_0::glVertex4i(GLint x, GLint y, GLint z, GLint w)
-{
- d_1_0_Deprecated->f.Vertex4i(x, y, z, w);
-}
-
-inline void QOpenGLFunctions_3_0::glVertex4fv(const GLfloat *v)
-{
- d_1_0_Deprecated->f.Vertex4fv(v);
-}
-
-inline void QOpenGLFunctions_3_0::glVertex4f(GLfloat x, GLfloat y, GLfloat z, GLfloat w)
-{
- d_1_0_Deprecated->f.Vertex4f(x, y, z, w);
-}
-
-inline void QOpenGLFunctions_3_0::glVertex4dv(const GLdouble *v)
-{
- d_1_0_Deprecated->f.Vertex4dv(v);
-}
-
-inline void QOpenGLFunctions_3_0::glVertex4d(GLdouble x, GLdouble y, GLdouble z, GLdouble w)
-{
- d_1_0_Deprecated->f.Vertex4d(x, y, z, w);
-}
-
-inline void QOpenGLFunctions_3_0::glVertex3sv(const GLshort *v)
-{
- d_1_0_Deprecated->f.Vertex3sv(v);
-}
-
-inline void QOpenGLFunctions_3_0::glVertex3s(GLshort x, GLshort y, GLshort z)
-{
- d_1_0_Deprecated->f.Vertex3s(x, y, z);
-}
-
-inline void QOpenGLFunctions_3_0::glVertex3iv(const GLint *v)
-{
- d_1_0_Deprecated->f.Vertex3iv(v);
-}
-
-inline void QOpenGLFunctions_3_0::glVertex3i(GLint x, GLint y, GLint z)
-{
- d_1_0_Deprecated->f.Vertex3i(x, y, z);
-}
-
-inline void QOpenGLFunctions_3_0::glVertex3fv(const GLfloat *v)
-{
- d_1_0_Deprecated->f.Vertex3fv(v);
-}
-
-inline void QOpenGLFunctions_3_0::glVertex3f(GLfloat x, GLfloat y, GLfloat z)
-{
- d_1_0_Deprecated->f.Vertex3f(x, y, z);
-}
-
-inline void QOpenGLFunctions_3_0::glVertex3dv(const GLdouble *v)
-{
- d_1_0_Deprecated->f.Vertex3dv(v);
-}
-
-inline void QOpenGLFunctions_3_0::glVertex3d(GLdouble x, GLdouble y, GLdouble z)
-{
- d_1_0_Deprecated->f.Vertex3d(x, y, z);
-}
-
-inline void QOpenGLFunctions_3_0::glVertex2sv(const GLshort *v)
-{
- d_1_0_Deprecated->f.Vertex2sv(v);
-}
-
-inline void QOpenGLFunctions_3_0::glVertex2s(GLshort x, GLshort y)
-{
- d_1_0_Deprecated->f.Vertex2s(x, y);
-}
-
-inline void QOpenGLFunctions_3_0::glVertex2iv(const GLint *v)
-{
- d_1_0_Deprecated->f.Vertex2iv(v);
-}
-
-inline void QOpenGLFunctions_3_0::glVertex2i(GLint x, GLint y)
-{
- d_1_0_Deprecated->f.Vertex2i(x, y);
-}
-
-inline void QOpenGLFunctions_3_0::glVertex2fv(const GLfloat *v)
-{
- d_1_0_Deprecated->f.Vertex2fv(v);
-}
-
-inline void QOpenGLFunctions_3_0::glVertex2f(GLfloat x, GLfloat y)
-{
- d_1_0_Deprecated->f.Vertex2f(x, y);
-}
-
-inline void QOpenGLFunctions_3_0::glVertex2dv(const GLdouble *v)
-{
- d_1_0_Deprecated->f.Vertex2dv(v);
-}
-
-inline void QOpenGLFunctions_3_0::glVertex2d(GLdouble x, GLdouble y)
-{
- d_1_0_Deprecated->f.Vertex2d(x, y);
-}
-
-inline void QOpenGLFunctions_3_0::glTexCoord4sv(const GLshort *v)
-{
- d_1_0_Deprecated->f.TexCoord4sv(v);
-}
-
-inline void QOpenGLFunctions_3_0::glTexCoord4s(GLshort s, GLshort t, GLshort r, GLshort q)
-{
- d_1_0_Deprecated->f.TexCoord4s(s, t, r, q);
-}
-
-inline void QOpenGLFunctions_3_0::glTexCoord4iv(const GLint *v)
-{
- d_1_0_Deprecated->f.TexCoord4iv(v);
-}
-
-inline void QOpenGLFunctions_3_0::glTexCoord4i(GLint s, GLint t, GLint r, GLint q)
-{
- d_1_0_Deprecated->f.TexCoord4i(s, t, r, q);
-}
-
-inline void QOpenGLFunctions_3_0::glTexCoord4fv(const GLfloat *v)
-{
- d_1_0_Deprecated->f.TexCoord4fv(v);
-}
-
-inline void QOpenGLFunctions_3_0::glTexCoord4f(GLfloat s, GLfloat t, GLfloat r, GLfloat q)
-{
- d_1_0_Deprecated->f.TexCoord4f(s, t, r, q);
-}
-
-inline void QOpenGLFunctions_3_0::glTexCoord4dv(const GLdouble *v)
-{
- d_1_0_Deprecated->f.TexCoord4dv(v);
-}
-
-inline void QOpenGLFunctions_3_0::glTexCoord4d(GLdouble s, GLdouble t, GLdouble r, GLdouble q)
-{
- d_1_0_Deprecated->f.TexCoord4d(s, t, r, q);
-}
-
-inline void QOpenGLFunctions_3_0::glTexCoord3sv(const GLshort *v)
-{
- d_1_0_Deprecated->f.TexCoord3sv(v);
-}
-
-inline void QOpenGLFunctions_3_0::glTexCoord3s(GLshort s, GLshort t, GLshort r)
-{
- d_1_0_Deprecated->f.TexCoord3s(s, t, r);
-}
-
-inline void QOpenGLFunctions_3_0::glTexCoord3iv(const GLint *v)
-{
- d_1_0_Deprecated->f.TexCoord3iv(v);
-}
-
-inline void QOpenGLFunctions_3_0::glTexCoord3i(GLint s, GLint t, GLint r)
-{
- d_1_0_Deprecated->f.TexCoord3i(s, t, r);
-}
-
-inline void QOpenGLFunctions_3_0::glTexCoord3fv(const GLfloat *v)
-{
- d_1_0_Deprecated->f.TexCoord3fv(v);
-}
-
-inline void QOpenGLFunctions_3_0::glTexCoord3f(GLfloat s, GLfloat t, GLfloat r)
-{
- d_1_0_Deprecated->f.TexCoord3f(s, t, r);
-}
-
-inline void QOpenGLFunctions_3_0::glTexCoord3dv(const GLdouble *v)
-{
- d_1_0_Deprecated->f.TexCoord3dv(v);
-}
-
-inline void QOpenGLFunctions_3_0::glTexCoord3d(GLdouble s, GLdouble t, GLdouble r)
-{
- d_1_0_Deprecated->f.TexCoord3d(s, t, r);
-}
-
-inline void QOpenGLFunctions_3_0::glTexCoord2sv(const GLshort *v)
-{
- d_1_0_Deprecated->f.TexCoord2sv(v);
-}
-
-inline void QOpenGLFunctions_3_0::glTexCoord2s(GLshort s, GLshort t)
-{
- d_1_0_Deprecated->f.TexCoord2s(s, t);
-}
-
-inline void QOpenGLFunctions_3_0::glTexCoord2iv(const GLint *v)
-{
- d_1_0_Deprecated->f.TexCoord2iv(v);
-}
-
-inline void QOpenGLFunctions_3_0::glTexCoord2i(GLint s, GLint t)
-{
- d_1_0_Deprecated->f.TexCoord2i(s, t);
-}
-
-inline void QOpenGLFunctions_3_0::glTexCoord2fv(const GLfloat *v)
-{
- d_1_0_Deprecated->f.TexCoord2fv(v);
-}
-
-inline void QOpenGLFunctions_3_0::glTexCoord2f(GLfloat s, GLfloat t)
-{
- d_1_0_Deprecated->f.TexCoord2f(s, t);
-}
-
-inline void QOpenGLFunctions_3_0::glTexCoord2dv(const GLdouble *v)
-{
- d_1_0_Deprecated->f.TexCoord2dv(v);
-}
-
-inline void QOpenGLFunctions_3_0::glTexCoord2d(GLdouble s, GLdouble t)
-{
- d_1_0_Deprecated->f.TexCoord2d(s, t);
-}
-
-inline void QOpenGLFunctions_3_0::glTexCoord1sv(const GLshort *v)
-{
- d_1_0_Deprecated->f.TexCoord1sv(v);
-}
-
-inline void QOpenGLFunctions_3_0::glTexCoord1s(GLshort s)
-{
- d_1_0_Deprecated->f.TexCoord1s(s);
-}
-
-inline void QOpenGLFunctions_3_0::glTexCoord1iv(const GLint *v)
-{
- d_1_0_Deprecated->f.TexCoord1iv(v);
-}
-
-inline void QOpenGLFunctions_3_0::glTexCoord1i(GLint s)
-{
- d_1_0_Deprecated->f.TexCoord1i(s);
-}
-
-inline void QOpenGLFunctions_3_0::glTexCoord1fv(const GLfloat *v)
-{
- d_1_0_Deprecated->f.TexCoord1fv(v);
-}
-
-inline void QOpenGLFunctions_3_0::glTexCoord1f(GLfloat s)
-{
- d_1_0_Deprecated->f.TexCoord1f(s);
-}
-
-inline void QOpenGLFunctions_3_0::glTexCoord1dv(const GLdouble *v)
-{
- d_1_0_Deprecated->f.TexCoord1dv(v);
-}
-
-inline void QOpenGLFunctions_3_0::glTexCoord1d(GLdouble s)
-{
- d_1_0_Deprecated->f.TexCoord1d(s);
-}
-
-inline void QOpenGLFunctions_3_0::glRectsv(const GLshort *v1, const GLshort *v2)
-{
- d_1_0_Deprecated->f.Rectsv(v1, v2);
-}
-
-inline void QOpenGLFunctions_3_0::glRects(GLshort x1, GLshort y1, GLshort x2, GLshort y2)
-{
- d_1_0_Deprecated->f.Rects(x1, y1, x2, y2);
-}
-
-inline void QOpenGLFunctions_3_0::glRectiv(const GLint *v1, const GLint *v2)
-{
- d_1_0_Deprecated->f.Rectiv(v1, v2);
-}
-
-inline void QOpenGLFunctions_3_0::glRecti(GLint x1, GLint y1, GLint x2, GLint y2)
-{
- d_1_0_Deprecated->f.Recti(x1, y1, x2, y2);
-}
-
-inline void QOpenGLFunctions_3_0::glRectfv(const GLfloat *v1, const GLfloat *v2)
-{
- d_1_0_Deprecated->f.Rectfv(v1, v2);
-}
-
-inline void QOpenGLFunctions_3_0::glRectf(GLfloat x1, GLfloat y1, GLfloat x2, GLfloat y2)
-{
- d_1_0_Deprecated->f.Rectf(x1, y1, x2, y2);
-}
-
-inline void QOpenGLFunctions_3_0::glRectdv(const GLdouble *v1, const GLdouble *v2)
-{
- d_1_0_Deprecated->f.Rectdv(v1, v2);
-}
-
-inline void QOpenGLFunctions_3_0::glRectd(GLdouble x1, GLdouble y1, GLdouble x2, GLdouble y2)
-{
- d_1_0_Deprecated->f.Rectd(x1, y1, x2, y2);
-}
-
-inline void QOpenGLFunctions_3_0::glRasterPos4sv(const GLshort *v)
-{
- d_1_0_Deprecated->f.RasterPos4sv(v);
-}
-
-inline void QOpenGLFunctions_3_0::glRasterPos4s(GLshort x, GLshort y, GLshort z, GLshort w)
-{
- d_1_0_Deprecated->f.RasterPos4s(x, y, z, w);
-}
-
-inline void QOpenGLFunctions_3_0::glRasterPos4iv(const GLint *v)
-{
- d_1_0_Deprecated->f.RasterPos4iv(v);
-}
-
-inline void QOpenGLFunctions_3_0::glRasterPos4i(GLint x, GLint y, GLint z, GLint w)
-{
- d_1_0_Deprecated->f.RasterPos4i(x, y, z, w);
-}
-
-inline void QOpenGLFunctions_3_0::glRasterPos4fv(const GLfloat *v)
-{
- d_1_0_Deprecated->f.RasterPos4fv(v);
-}
-
-inline void QOpenGLFunctions_3_0::glRasterPos4f(GLfloat x, GLfloat y, GLfloat z, GLfloat w)
-{
- d_1_0_Deprecated->f.RasterPos4f(x, y, z, w);
-}
-
-inline void QOpenGLFunctions_3_0::glRasterPos4dv(const GLdouble *v)
-{
- d_1_0_Deprecated->f.RasterPos4dv(v);
-}
-
-inline void QOpenGLFunctions_3_0::glRasterPos4d(GLdouble x, GLdouble y, GLdouble z, GLdouble w)
-{
- d_1_0_Deprecated->f.RasterPos4d(x, y, z, w);
-}
-
-inline void QOpenGLFunctions_3_0::glRasterPos3sv(const GLshort *v)
-{
- d_1_0_Deprecated->f.RasterPos3sv(v);
-}
-
-inline void QOpenGLFunctions_3_0::glRasterPos3s(GLshort x, GLshort y, GLshort z)
-{
- d_1_0_Deprecated->f.RasterPos3s(x, y, z);
-}
-
-inline void QOpenGLFunctions_3_0::glRasterPos3iv(const GLint *v)
-{
- d_1_0_Deprecated->f.RasterPos3iv(v);
-}
-
-inline void QOpenGLFunctions_3_0::glRasterPos3i(GLint x, GLint y, GLint z)
-{
- d_1_0_Deprecated->f.RasterPos3i(x, y, z);
-}
-
-inline void QOpenGLFunctions_3_0::glRasterPos3fv(const GLfloat *v)
-{
- d_1_0_Deprecated->f.RasterPos3fv(v);
-}
-
-inline void QOpenGLFunctions_3_0::glRasterPos3f(GLfloat x, GLfloat y, GLfloat z)
-{
- d_1_0_Deprecated->f.RasterPos3f(x, y, z);
-}
-
-inline void QOpenGLFunctions_3_0::glRasterPos3dv(const GLdouble *v)
-{
- d_1_0_Deprecated->f.RasterPos3dv(v);
-}
-
-inline void QOpenGLFunctions_3_0::glRasterPos3d(GLdouble x, GLdouble y, GLdouble z)
-{
- d_1_0_Deprecated->f.RasterPos3d(x, y, z);
-}
-
-inline void QOpenGLFunctions_3_0::glRasterPos2sv(const GLshort *v)
-{
- d_1_0_Deprecated->f.RasterPos2sv(v);
-}
-
-inline void QOpenGLFunctions_3_0::glRasterPos2s(GLshort x, GLshort y)
-{
- d_1_0_Deprecated->f.RasterPos2s(x, y);
-}
-
-inline void QOpenGLFunctions_3_0::glRasterPos2iv(const GLint *v)
-{
- d_1_0_Deprecated->f.RasterPos2iv(v);
-}
-
-inline void QOpenGLFunctions_3_0::glRasterPos2i(GLint x, GLint y)
-{
- d_1_0_Deprecated->f.RasterPos2i(x, y);
-}
-
-inline void QOpenGLFunctions_3_0::glRasterPos2fv(const GLfloat *v)
-{
- d_1_0_Deprecated->f.RasterPos2fv(v);
-}
-
-inline void QOpenGLFunctions_3_0::glRasterPos2f(GLfloat x, GLfloat y)
-{
- d_1_0_Deprecated->f.RasterPos2f(x, y);
-}
-
-inline void QOpenGLFunctions_3_0::glRasterPos2dv(const GLdouble *v)
-{
- d_1_0_Deprecated->f.RasterPos2dv(v);
-}
-
-inline void QOpenGLFunctions_3_0::glRasterPos2d(GLdouble x, GLdouble y)
-{
- d_1_0_Deprecated->f.RasterPos2d(x, y);
-}
-
-inline void QOpenGLFunctions_3_0::glNormal3sv(const GLshort *v)
-{
- d_1_0_Deprecated->f.Normal3sv(v);
-}
-
-inline void QOpenGLFunctions_3_0::glNormal3s(GLshort nx, GLshort ny, GLshort nz)
-{
- d_1_0_Deprecated->f.Normal3s(nx, ny, nz);
-}
-
-inline void QOpenGLFunctions_3_0::glNormal3iv(const GLint *v)
-{
- d_1_0_Deprecated->f.Normal3iv(v);
-}
-
-inline void QOpenGLFunctions_3_0::glNormal3i(GLint nx, GLint ny, GLint nz)
-{
- d_1_0_Deprecated->f.Normal3i(nx, ny, nz);
-}
-
-inline void QOpenGLFunctions_3_0::glNormal3fv(const GLfloat *v)
-{
- d_1_0_Deprecated->f.Normal3fv(v);
-}
-
-inline void QOpenGLFunctions_3_0::glNormal3f(GLfloat nx, GLfloat ny, GLfloat nz)
-{
- d_1_0_Deprecated->f.Normal3f(nx, ny, nz);
-}
-
-inline void QOpenGLFunctions_3_0::glNormal3dv(const GLdouble *v)
-{
- d_1_0_Deprecated->f.Normal3dv(v);
-}
-
-inline void QOpenGLFunctions_3_0::glNormal3d(GLdouble nx, GLdouble ny, GLdouble nz)
-{
- d_1_0_Deprecated->f.Normal3d(nx, ny, nz);
-}
-
-inline void QOpenGLFunctions_3_0::glNormal3bv(const GLbyte *v)
-{
- d_1_0_Deprecated->f.Normal3bv(v);
-}
-
-inline void QOpenGLFunctions_3_0::glNormal3b(GLbyte nx, GLbyte ny, GLbyte nz)
-{
- d_1_0_Deprecated->f.Normal3b(nx, ny, nz);
-}
-
-inline void QOpenGLFunctions_3_0::glIndexsv(const GLshort *c)
-{
- d_1_0_Deprecated->f.Indexsv(c);
-}
-
-inline void QOpenGLFunctions_3_0::glIndexs(GLshort c)
-{
- d_1_0_Deprecated->f.Indexs(c);
-}
-
-inline void QOpenGLFunctions_3_0::glIndexiv(const GLint *c)
-{
- d_1_0_Deprecated->f.Indexiv(c);
-}
-
-inline void QOpenGLFunctions_3_0::glIndexi(GLint c)
-{
- d_1_0_Deprecated->f.Indexi(c);
-}
-
-inline void QOpenGLFunctions_3_0::glIndexfv(const GLfloat *c)
-{
- d_1_0_Deprecated->f.Indexfv(c);
-}
-
-inline void QOpenGLFunctions_3_0::glIndexf(GLfloat c)
-{
- d_1_0_Deprecated->f.Indexf(c);
-}
-
-inline void QOpenGLFunctions_3_0::glIndexdv(const GLdouble *c)
-{
- d_1_0_Deprecated->f.Indexdv(c);
-}
-
-inline void QOpenGLFunctions_3_0::glIndexd(GLdouble c)
-{
- d_1_0_Deprecated->f.Indexd(c);
-}
-
-inline void QOpenGLFunctions_3_0::glEnd()
-{
- d_1_0_Deprecated->f.End();
-}
-
-inline void QOpenGLFunctions_3_0::glEdgeFlagv(const GLboolean *flag)
-{
- d_1_0_Deprecated->f.EdgeFlagv(flag);
-}
-
-inline void QOpenGLFunctions_3_0::glEdgeFlag(GLboolean flag)
-{
- d_1_0_Deprecated->f.EdgeFlag(flag);
-}
-
-inline void QOpenGLFunctions_3_0::glColor4usv(const GLushort *v)
-{
- d_1_0_Deprecated->f.Color4usv(v);
-}
-
-inline void QOpenGLFunctions_3_0::glColor4us(GLushort red, GLushort green, GLushort blue, GLushort alpha)
-{
- d_1_0_Deprecated->f.Color4us(red, green, blue, alpha);
-}
-
-inline void QOpenGLFunctions_3_0::glColor4uiv(const GLuint *v)
-{
- d_1_0_Deprecated->f.Color4uiv(v);
-}
-
-inline void QOpenGLFunctions_3_0::glColor4ui(GLuint red, GLuint green, GLuint blue, GLuint alpha)
-{
- d_1_0_Deprecated->f.Color4ui(red, green, blue, alpha);
-}
-
-inline void QOpenGLFunctions_3_0::glColor4ubv(const GLubyte *v)
-{
- d_1_0_Deprecated->f.Color4ubv(v);
-}
-
-inline void QOpenGLFunctions_3_0::glColor4ub(GLubyte red, GLubyte green, GLubyte blue, GLubyte alpha)
-{
- d_1_0_Deprecated->f.Color4ub(red, green, blue, alpha);
-}
-
-inline void QOpenGLFunctions_3_0::glColor4sv(const GLshort *v)
-{
- d_1_0_Deprecated->f.Color4sv(v);
-}
-
-inline void QOpenGLFunctions_3_0::glColor4s(GLshort red, GLshort green, GLshort blue, GLshort alpha)
-{
- d_1_0_Deprecated->f.Color4s(red, green, blue, alpha);
-}
-
-inline void QOpenGLFunctions_3_0::glColor4iv(const GLint *v)
-{
- d_1_0_Deprecated->f.Color4iv(v);
-}
-
-inline void QOpenGLFunctions_3_0::glColor4i(GLint red, GLint green, GLint blue, GLint alpha)
-{
- d_1_0_Deprecated->f.Color4i(red, green, blue, alpha);
-}
-
-inline void QOpenGLFunctions_3_0::glColor4fv(const GLfloat *v)
-{
- d_1_0_Deprecated->f.Color4fv(v);
-}
-
-inline void QOpenGLFunctions_3_0::glColor4f(GLfloat red, GLfloat green, GLfloat blue, GLfloat alpha)
-{
- d_1_0_Deprecated->f.Color4f(red, green, blue, alpha);
-}
-
-inline void QOpenGLFunctions_3_0::glColor4dv(const GLdouble *v)
-{
- d_1_0_Deprecated->f.Color4dv(v);
-}
-
-inline void QOpenGLFunctions_3_0::glColor4d(GLdouble red, GLdouble green, GLdouble blue, GLdouble alpha)
-{
- d_1_0_Deprecated->f.Color4d(red, green, blue, alpha);
-}
-
-inline void QOpenGLFunctions_3_0::glColor4bv(const GLbyte *v)
-{
- d_1_0_Deprecated->f.Color4bv(v);
-}
-
-inline void QOpenGLFunctions_3_0::glColor4b(GLbyte red, GLbyte green, GLbyte blue, GLbyte alpha)
-{
- d_1_0_Deprecated->f.Color4b(red, green, blue, alpha);
-}
-
-inline void QOpenGLFunctions_3_0::glColor3usv(const GLushort *v)
-{
- d_1_0_Deprecated->f.Color3usv(v);
-}
-
-inline void QOpenGLFunctions_3_0::glColor3us(GLushort red, GLushort green, GLushort blue)
-{
- d_1_0_Deprecated->f.Color3us(red, green, blue);
-}
-
-inline void QOpenGLFunctions_3_0::glColor3uiv(const GLuint *v)
-{
- d_1_0_Deprecated->f.Color3uiv(v);
-}
-
-inline void QOpenGLFunctions_3_0::glColor3ui(GLuint red, GLuint green, GLuint blue)
-{
- d_1_0_Deprecated->f.Color3ui(red, green, blue);
-}
-
-inline void QOpenGLFunctions_3_0::glColor3ubv(const GLubyte *v)
-{
- d_1_0_Deprecated->f.Color3ubv(v);
-}
-
-inline void QOpenGLFunctions_3_0::glColor3ub(GLubyte red, GLubyte green, GLubyte blue)
-{
- d_1_0_Deprecated->f.Color3ub(red, green, blue);
-}
-
-inline void QOpenGLFunctions_3_0::glColor3sv(const GLshort *v)
-{
- d_1_0_Deprecated->f.Color3sv(v);
-}
-
-inline void QOpenGLFunctions_3_0::glColor3s(GLshort red, GLshort green, GLshort blue)
-{
- d_1_0_Deprecated->f.Color3s(red, green, blue);
-}
-
-inline void QOpenGLFunctions_3_0::glColor3iv(const GLint *v)
-{
- d_1_0_Deprecated->f.Color3iv(v);
-}
-
-inline void QOpenGLFunctions_3_0::glColor3i(GLint red, GLint green, GLint blue)
-{
- d_1_0_Deprecated->f.Color3i(red, green, blue);
-}
-
-inline void QOpenGLFunctions_3_0::glColor3fv(const GLfloat *v)
-{
- d_1_0_Deprecated->f.Color3fv(v);
-}
-
-inline void QOpenGLFunctions_3_0::glColor3f(GLfloat red, GLfloat green, GLfloat blue)
-{
- d_1_0_Deprecated->f.Color3f(red, green, blue);
-}
-
-inline void QOpenGLFunctions_3_0::glColor3dv(const GLdouble *v)
-{
- d_1_0_Deprecated->f.Color3dv(v);
-}
-
-inline void QOpenGLFunctions_3_0::glColor3d(GLdouble red, GLdouble green, GLdouble blue)
-{
- d_1_0_Deprecated->f.Color3d(red, green, blue);
-}
-
-inline void QOpenGLFunctions_3_0::glColor3bv(const GLbyte *v)
-{
- d_1_0_Deprecated->f.Color3bv(v);
-}
-
-inline void QOpenGLFunctions_3_0::glColor3b(GLbyte red, GLbyte green, GLbyte blue)
-{
- d_1_0_Deprecated->f.Color3b(red, green, blue);
-}
-
-inline void QOpenGLFunctions_3_0::glBitmap(GLsizei width, GLsizei height, GLfloat xorig, GLfloat yorig, GLfloat xmove, GLfloat ymove, const GLubyte *bitmap)
-{
- d_1_0_Deprecated->f.Bitmap(width, height, xorig, yorig, xmove, ymove, bitmap);
-}
-
-inline void QOpenGLFunctions_3_0::glBegin(GLenum mode)
-{
- d_1_0_Deprecated->f.Begin(mode);
-}
-
-inline void QOpenGLFunctions_3_0::glListBase(GLuint base)
-{
- d_1_0_Deprecated->f.ListBase(base);
-}
-
-inline GLuint QOpenGLFunctions_3_0::glGenLists(GLsizei range)
-{
- return d_1_0_Deprecated->f.GenLists(range);
-}
-
-inline void QOpenGLFunctions_3_0::glDeleteLists(GLuint list, GLsizei range)
-{
- d_1_0_Deprecated->f.DeleteLists(list, range);
-}
-
-inline void QOpenGLFunctions_3_0::glCallLists(GLsizei n, GLenum type, const GLvoid *lists)
-{
- d_1_0_Deprecated->f.CallLists(n, type, lists);
-}
-
-inline void QOpenGLFunctions_3_0::glCallList(GLuint list)
-{
- d_1_0_Deprecated->f.CallList(list);
-}
-
-inline void QOpenGLFunctions_3_0::glEndList()
-{
- d_1_0_Deprecated->f.EndList();
-}
-
-inline void QOpenGLFunctions_3_0::glNewList(GLuint list, GLenum mode)
-{
- d_1_0_Deprecated->f.NewList(list, mode);
-}
-
-
-// OpenGL 1.1 deprecated functions
-inline void QOpenGLFunctions_3_0::glPushClientAttrib(GLbitfield mask)
-{
- d_1_1_Deprecated->f.PushClientAttrib(mask);
-}
-
-inline void QOpenGLFunctions_3_0::glPopClientAttrib()
-{
- d_1_1_Deprecated->f.PopClientAttrib();
-}
-
-inline void QOpenGLFunctions_3_0::glPrioritizeTextures(GLsizei n, const GLuint *textures, const GLfloat *priorities)
-{
- d_1_1_Deprecated->f.PrioritizeTextures(n, textures, priorities);
-}
-
-inline GLboolean QOpenGLFunctions_3_0::glAreTexturesResident(GLsizei n, const GLuint *textures, GLboolean *residences)
-{
- return d_1_1_Deprecated->f.AreTexturesResident(n, textures, residences);
-}
-
-inline void QOpenGLFunctions_3_0::glVertexPointer(GLint size, GLenum type, GLsizei stride, const GLvoid *pointer)
-{
- d_1_1_Deprecated->f.VertexPointer(size, type, stride, pointer);
-}
-
-inline void QOpenGLFunctions_3_0::glTexCoordPointer(GLint size, GLenum type, GLsizei stride, const GLvoid *pointer)
-{
- d_1_1_Deprecated->f.TexCoordPointer(size, type, stride, pointer);
-}
-
-inline void QOpenGLFunctions_3_0::glNormalPointer(GLenum type, GLsizei stride, const GLvoid *pointer)
-{
- d_1_1_Deprecated->f.NormalPointer(type, stride, pointer);
-}
-
-inline void QOpenGLFunctions_3_0::glInterleavedArrays(GLenum format, GLsizei stride, const GLvoid *pointer)
-{
- d_1_1_Deprecated->f.InterleavedArrays(format, stride, pointer);
-}
-
-inline void QOpenGLFunctions_3_0::glIndexPointer(GLenum type, GLsizei stride, const GLvoid *pointer)
-{
- d_1_1_Deprecated->f.IndexPointer(type, stride, pointer);
-}
-
-inline void QOpenGLFunctions_3_0::glEnableClientState(GLenum array)
-{
- d_1_1_Deprecated->f.EnableClientState(array);
-}
-
-inline void QOpenGLFunctions_3_0::glEdgeFlagPointer(GLsizei stride, const GLvoid *pointer)
-{
- d_1_1_Deprecated->f.EdgeFlagPointer(stride, pointer);
-}
-
-inline void QOpenGLFunctions_3_0::glDisableClientState(GLenum array)
-{
- d_1_1_Deprecated->f.DisableClientState(array);
-}
-
-inline void QOpenGLFunctions_3_0::glColorPointer(GLint size, GLenum type, GLsizei stride, const GLvoid *pointer)
-{
- d_1_1_Deprecated->f.ColorPointer(size, type, stride, pointer);
-}
-
-inline void QOpenGLFunctions_3_0::glArrayElement(GLint i)
-{
- d_1_1_Deprecated->f.ArrayElement(i);
-}
-
-
-// OpenGL 1.2 deprecated functions
-inline void QOpenGLFunctions_3_0::glResetMinmax(GLenum target)
-{
- d_1_2_Deprecated->f.ResetMinmax(target);
-}
-
-inline void QOpenGLFunctions_3_0::glResetHistogram(GLenum target)
-{
- d_1_2_Deprecated->f.ResetHistogram(target);
-}
-
-inline void QOpenGLFunctions_3_0::glMinmax(GLenum target, GLenum internalformat, GLboolean sink)
-{
- d_1_2_Deprecated->f.Minmax(target, internalformat, sink);
-}
-
-inline void QOpenGLFunctions_3_0::glHistogram(GLenum target, GLsizei width, GLenum internalformat, GLboolean sink)
-{
- d_1_2_Deprecated->f.Histogram(target, width, internalformat, sink);
-}
-
-inline void QOpenGLFunctions_3_0::glGetMinmaxParameteriv(GLenum target, GLenum pname, GLint *params)
-{
- d_1_2_Deprecated->f.GetMinmaxParameteriv(target, pname, params);
-}
-
-inline void QOpenGLFunctions_3_0::glGetMinmaxParameterfv(GLenum target, GLenum pname, GLfloat *params)
-{
- d_1_2_Deprecated->f.GetMinmaxParameterfv(target, pname, params);
-}
-
-inline void QOpenGLFunctions_3_0::glGetMinmax(GLenum target, GLboolean reset, GLenum format, GLenum type, GLvoid *values)
-{
- d_1_2_Deprecated->f.GetMinmax(target, reset, format, type, values);
-}
-
-inline void QOpenGLFunctions_3_0::glGetHistogramParameteriv(GLenum target, GLenum pname, GLint *params)
-{
- d_1_2_Deprecated->f.GetHistogramParameteriv(target, pname, params);
-}
-
-inline void QOpenGLFunctions_3_0::glGetHistogramParameterfv(GLenum target, GLenum pname, GLfloat *params)
-{
- d_1_2_Deprecated->f.GetHistogramParameterfv(target, pname, params);
-}
-
-inline void QOpenGLFunctions_3_0::glGetHistogram(GLenum target, GLboolean reset, GLenum format, GLenum type, GLvoid *values)
-{
- d_1_2_Deprecated->f.GetHistogram(target, reset, format, type, values);
-}
-
-inline void QOpenGLFunctions_3_0::glSeparableFilter2D(GLenum target, GLenum internalformat, GLsizei width, GLsizei height, GLenum format, GLenum type, const GLvoid *row, const GLvoid *column)
-{
- d_1_2_Deprecated->f.SeparableFilter2D(target, internalformat, width, height, format, type, row, column);
-}
-
-inline void QOpenGLFunctions_3_0::glGetSeparableFilter(GLenum target, GLenum format, GLenum type, GLvoid *row, GLvoid *column, GLvoid *span)
-{
- d_1_2_Deprecated->f.GetSeparableFilter(target, format, type, row, column, span);
-}
-
-inline void QOpenGLFunctions_3_0::glGetConvolutionParameteriv(GLenum target, GLenum pname, GLint *params)
-{
- d_1_2_Deprecated->f.GetConvolutionParameteriv(target, pname, params);
-}
-
-inline void QOpenGLFunctions_3_0::glGetConvolutionParameterfv(GLenum target, GLenum pname, GLfloat *params)
-{
- d_1_2_Deprecated->f.GetConvolutionParameterfv(target, pname, params);
-}
-
-inline void QOpenGLFunctions_3_0::glGetConvolutionFilter(GLenum target, GLenum format, GLenum type, GLvoid *image)
-{
- d_1_2_Deprecated->f.GetConvolutionFilter(target, format, type, image);
-}
-
-inline void QOpenGLFunctions_3_0::glCopyConvolutionFilter2D(GLenum target, GLenum internalformat, GLint x, GLint y, GLsizei width, GLsizei height)
-{
- d_1_2_Deprecated->f.CopyConvolutionFilter2D(target, internalformat, x, y, width, height);
-}
-
-inline void QOpenGLFunctions_3_0::glCopyConvolutionFilter1D(GLenum target, GLenum internalformat, GLint x, GLint y, GLsizei width)
-{
- d_1_2_Deprecated->f.CopyConvolutionFilter1D(target, internalformat, x, y, width);
-}
-
-inline void QOpenGLFunctions_3_0::glConvolutionParameteriv(GLenum target, GLenum pname, const GLint *params)
-{
- d_1_2_Deprecated->f.ConvolutionParameteriv(target, pname, params);
-}
-
-inline void QOpenGLFunctions_3_0::glConvolutionParameteri(GLenum target, GLenum pname, GLint params)
-{
- d_1_2_Deprecated->f.ConvolutionParameteri(target, pname, params);
-}
-
-inline void QOpenGLFunctions_3_0::glConvolutionParameterfv(GLenum target, GLenum pname, const GLfloat *params)
-{
- d_1_2_Deprecated->f.ConvolutionParameterfv(target, pname, params);
-}
-
-inline void QOpenGLFunctions_3_0::glConvolutionParameterf(GLenum target, GLenum pname, GLfloat params)
-{
- d_1_2_Deprecated->f.ConvolutionParameterf(target, pname, params);
-}
-
-inline void QOpenGLFunctions_3_0::glConvolutionFilter2D(GLenum target, GLenum internalformat, GLsizei width, GLsizei height, GLenum format, GLenum type, const GLvoid *image)
-{
- d_1_2_Deprecated->f.ConvolutionFilter2D(target, internalformat, width, height, format, type, image);
-}
-
-inline void QOpenGLFunctions_3_0::glConvolutionFilter1D(GLenum target, GLenum internalformat, GLsizei width, GLenum format, GLenum type, const GLvoid *image)
-{
- d_1_2_Deprecated->f.ConvolutionFilter1D(target, internalformat, width, format, type, image);
-}
-
-inline void QOpenGLFunctions_3_0::glCopyColorSubTable(GLenum target, GLsizei start, GLint x, GLint y, GLsizei width)
-{
- d_1_2_Deprecated->f.CopyColorSubTable(target, start, x, y, width);
-}
-
-inline void QOpenGLFunctions_3_0::glColorSubTable(GLenum target, GLsizei start, GLsizei count, GLenum format, GLenum type, const GLvoid *data)
-{
- d_1_2_Deprecated->f.ColorSubTable(target, start, count, format, type, data);
-}
-
-inline void QOpenGLFunctions_3_0::glGetColorTableParameteriv(GLenum target, GLenum pname, GLint *params)
-{
- d_1_2_Deprecated->f.GetColorTableParameteriv(target, pname, params);
-}
-
-inline void QOpenGLFunctions_3_0::glGetColorTableParameterfv(GLenum target, GLenum pname, GLfloat *params)
-{
- d_1_2_Deprecated->f.GetColorTableParameterfv(target, pname, params);
-}
-
-inline void QOpenGLFunctions_3_0::glGetColorTable(GLenum target, GLenum format, GLenum type, GLvoid *table)
-{
- d_1_2_Deprecated->f.GetColorTable(target, format, type, table);
-}
-
-inline void QOpenGLFunctions_3_0::glCopyColorTable(GLenum target, GLenum internalformat, GLint x, GLint y, GLsizei width)
-{
- d_1_2_Deprecated->f.CopyColorTable(target, internalformat, x, y, width);
-}
-
-inline void QOpenGLFunctions_3_0::glColorTableParameteriv(GLenum target, GLenum pname, const GLint *params)
-{
- d_1_2_Deprecated->f.ColorTableParameteriv(target, pname, params);
-}
-
-inline void QOpenGLFunctions_3_0::glColorTableParameterfv(GLenum target, GLenum pname, const GLfloat *params)
-{
- d_1_2_Deprecated->f.ColorTableParameterfv(target, pname, params);
-}
-
-inline void QOpenGLFunctions_3_0::glColorTable(GLenum target, GLenum internalformat, GLsizei width, GLenum format, GLenum type, const GLvoid *table)
-{
- d_1_2_Deprecated->f.ColorTable(target, internalformat, width, format, type, table);
-}
-
-
-// OpenGL 1.3 deprecated functions
-inline void QOpenGLFunctions_3_0::glMultTransposeMatrixd(const GLdouble *m)
-{
- d_1_3_Deprecated->f.MultTransposeMatrixd(m);
-}
-
-inline void QOpenGLFunctions_3_0::glMultTransposeMatrixf(const GLfloat *m)
-{
- d_1_3_Deprecated->f.MultTransposeMatrixf(m);
-}
-
-inline void QOpenGLFunctions_3_0::glLoadTransposeMatrixd(const GLdouble *m)
-{
- d_1_3_Deprecated->f.LoadTransposeMatrixd(m);
-}
-
-inline void QOpenGLFunctions_3_0::glLoadTransposeMatrixf(const GLfloat *m)
-{
- d_1_3_Deprecated->f.LoadTransposeMatrixf(m);
-}
-
-inline void QOpenGLFunctions_3_0::glMultiTexCoord4sv(GLenum target, const GLshort *v)
-{
- d_1_3_Deprecated->f.MultiTexCoord4sv(target, v);
-}
-
-inline void QOpenGLFunctions_3_0::glMultiTexCoord4s(GLenum target, GLshort s, GLshort t, GLshort r, GLshort q)
-{
- d_1_3_Deprecated->f.MultiTexCoord4s(target, s, t, r, q);
-}
-
-inline void QOpenGLFunctions_3_0::glMultiTexCoord4iv(GLenum target, const GLint *v)
-{
- d_1_3_Deprecated->f.MultiTexCoord4iv(target, v);
-}
-
-inline void QOpenGLFunctions_3_0::glMultiTexCoord4i(GLenum target, GLint s, GLint t, GLint r, GLint q)
-{
- d_1_3_Deprecated->f.MultiTexCoord4i(target, s, t, r, q);
-}
-
-inline void QOpenGLFunctions_3_0::glMultiTexCoord4fv(GLenum target, const GLfloat *v)
-{
- d_1_3_Deprecated->f.MultiTexCoord4fv(target, v);
-}
-
-inline void QOpenGLFunctions_3_0::glMultiTexCoord4f(GLenum target, GLfloat s, GLfloat t, GLfloat r, GLfloat q)
-{
- d_1_3_Deprecated->f.MultiTexCoord4f(target, s, t, r, q);
-}
-
-inline void QOpenGLFunctions_3_0::glMultiTexCoord4dv(GLenum target, const GLdouble *v)
-{
- d_1_3_Deprecated->f.MultiTexCoord4dv(target, v);
-}
-
-inline void QOpenGLFunctions_3_0::glMultiTexCoord4d(GLenum target, GLdouble s, GLdouble t, GLdouble r, GLdouble q)
-{
- d_1_3_Deprecated->f.MultiTexCoord4d(target, s, t, r, q);
-}
-
-inline void QOpenGLFunctions_3_0::glMultiTexCoord3sv(GLenum target, const GLshort *v)
-{
- d_1_3_Deprecated->f.MultiTexCoord3sv(target, v);
-}
-
-inline void QOpenGLFunctions_3_0::glMultiTexCoord3s(GLenum target, GLshort s, GLshort t, GLshort r)
-{
- d_1_3_Deprecated->f.MultiTexCoord3s(target, s, t, r);
-}
-
-inline void QOpenGLFunctions_3_0::glMultiTexCoord3iv(GLenum target, const GLint *v)
-{
- d_1_3_Deprecated->f.MultiTexCoord3iv(target, v);
-}
-
-inline void QOpenGLFunctions_3_0::glMultiTexCoord3i(GLenum target, GLint s, GLint t, GLint r)
-{
- d_1_3_Deprecated->f.MultiTexCoord3i(target, s, t, r);
-}
-
-inline void QOpenGLFunctions_3_0::glMultiTexCoord3fv(GLenum target, const GLfloat *v)
-{
- d_1_3_Deprecated->f.MultiTexCoord3fv(target, v);
-}
-
-inline void QOpenGLFunctions_3_0::glMultiTexCoord3f(GLenum target, GLfloat s, GLfloat t, GLfloat r)
-{
- d_1_3_Deprecated->f.MultiTexCoord3f(target, s, t, r);
-}
-
-inline void QOpenGLFunctions_3_0::glMultiTexCoord3dv(GLenum target, const GLdouble *v)
-{
- d_1_3_Deprecated->f.MultiTexCoord3dv(target, v);
-}
-
-inline void QOpenGLFunctions_3_0::glMultiTexCoord3d(GLenum target, GLdouble s, GLdouble t, GLdouble r)
-{
- d_1_3_Deprecated->f.MultiTexCoord3d(target, s, t, r);
-}
-
-inline void QOpenGLFunctions_3_0::glMultiTexCoord2sv(GLenum target, const GLshort *v)
-{
- d_1_3_Deprecated->f.MultiTexCoord2sv(target, v);
-}
-
-inline void QOpenGLFunctions_3_0::glMultiTexCoord2s(GLenum target, GLshort s, GLshort t)
-{
- d_1_3_Deprecated->f.MultiTexCoord2s(target, s, t);
-}
-
-inline void QOpenGLFunctions_3_0::glMultiTexCoord2iv(GLenum target, const GLint *v)
-{
- d_1_3_Deprecated->f.MultiTexCoord2iv(target, v);
-}
-
-inline void QOpenGLFunctions_3_0::glMultiTexCoord2i(GLenum target, GLint s, GLint t)
-{
- d_1_3_Deprecated->f.MultiTexCoord2i(target, s, t);
-}
-
-inline void QOpenGLFunctions_3_0::glMultiTexCoord2fv(GLenum target, const GLfloat *v)
-{
- d_1_3_Deprecated->f.MultiTexCoord2fv(target, v);
-}
-
-inline void QOpenGLFunctions_3_0::glMultiTexCoord2f(GLenum target, GLfloat s, GLfloat t)
-{
- d_1_3_Deprecated->f.MultiTexCoord2f(target, s, t);
-}
-
-inline void QOpenGLFunctions_3_0::glMultiTexCoord2dv(GLenum target, const GLdouble *v)
-{
- d_1_3_Deprecated->f.MultiTexCoord2dv(target, v);
-}
-
-inline void QOpenGLFunctions_3_0::glMultiTexCoord2d(GLenum target, GLdouble s, GLdouble t)
-{
- d_1_3_Deprecated->f.MultiTexCoord2d(target, s, t);
-}
-
-inline void QOpenGLFunctions_3_0::glMultiTexCoord1sv(GLenum target, const GLshort *v)
-{
- d_1_3_Deprecated->f.MultiTexCoord1sv(target, v);
-}
-
-inline void QOpenGLFunctions_3_0::glMultiTexCoord1s(GLenum target, GLshort s)
-{
- d_1_3_Deprecated->f.MultiTexCoord1s(target, s);
-}
-
-inline void QOpenGLFunctions_3_0::glMultiTexCoord1iv(GLenum target, const GLint *v)
-{
- d_1_3_Deprecated->f.MultiTexCoord1iv(target, v);
-}
-
-inline void QOpenGLFunctions_3_0::glMultiTexCoord1i(GLenum target, GLint s)
-{
- d_1_3_Deprecated->f.MultiTexCoord1i(target, s);
-}
-
-inline void QOpenGLFunctions_3_0::glMultiTexCoord1fv(GLenum target, const GLfloat *v)
-{
- d_1_3_Deprecated->f.MultiTexCoord1fv(target, v);
-}
-
-inline void QOpenGLFunctions_3_0::glMultiTexCoord1f(GLenum target, GLfloat s)
-{
- d_1_3_Deprecated->f.MultiTexCoord1f(target, s);
-}
-
-inline void QOpenGLFunctions_3_0::glMultiTexCoord1dv(GLenum target, const GLdouble *v)
-{
- d_1_3_Deprecated->f.MultiTexCoord1dv(target, v);
-}
-
-inline void QOpenGLFunctions_3_0::glMultiTexCoord1d(GLenum target, GLdouble s)
-{
- d_1_3_Deprecated->f.MultiTexCoord1d(target, s);
-}
-
-inline void QOpenGLFunctions_3_0::glClientActiveTexture(GLenum texture)
-{
- d_1_3_Deprecated->f.ClientActiveTexture(texture);
-}
-
-
-// OpenGL 1.4 deprecated functions
-inline void QOpenGLFunctions_3_0::glWindowPos3sv(const GLshort *v)
-{
- d_1_4_Deprecated->f.WindowPos3sv(v);
-}
-
-inline void QOpenGLFunctions_3_0::glWindowPos3s(GLshort x, GLshort y, GLshort z)
-{
- d_1_4_Deprecated->f.WindowPos3s(x, y, z);
-}
-
-inline void QOpenGLFunctions_3_0::glWindowPos3iv(const GLint *v)
-{
- d_1_4_Deprecated->f.WindowPos3iv(v);
-}
-
-inline void QOpenGLFunctions_3_0::glWindowPos3i(GLint x, GLint y, GLint z)
-{
- d_1_4_Deprecated->f.WindowPos3i(x, y, z);
-}
-
-inline void QOpenGLFunctions_3_0::glWindowPos3fv(const GLfloat *v)
-{
- d_1_4_Deprecated->f.WindowPos3fv(v);
-}
-
-inline void QOpenGLFunctions_3_0::glWindowPos3f(GLfloat x, GLfloat y, GLfloat z)
-{
- d_1_4_Deprecated->f.WindowPos3f(x, y, z);
-}
-
-inline void QOpenGLFunctions_3_0::glWindowPos3dv(const GLdouble *v)
-{
- d_1_4_Deprecated->f.WindowPos3dv(v);
-}
-
-inline void QOpenGLFunctions_3_0::glWindowPos3d(GLdouble x, GLdouble y, GLdouble z)
-{
- d_1_4_Deprecated->f.WindowPos3d(x, y, z);
-}
-
-inline void QOpenGLFunctions_3_0::glWindowPos2sv(const GLshort *v)
-{
- d_1_4_Deprecated->f.WindowPos2sv(v);
-}
-
-inline void QOpenGLFunctions_3_0::glWindowPos2s(GLshort x, GLshort y)
-{
- d_1_4_Deprecated->f.WindowPos2s(x, y);
-}
-
-inline void QOpenGLFunctions_3_0::glWindowPos2iv(const GLint *v)
-{
- d_1_4_Deprecated->f.WindowPos2iv(v);
-}
-
-inline void QOpenGLFunctions_3_0::glWindowPos2i(GLint x, GLint y)
-{
- d_1_4_Deprecated->f.WindowPos2i(x, y);
-}
-
-inline void QOpenGLFunctions_3_0::glWindowPos2fv(const GLfloat *v)
-{
- d_1_4_Deprecated->f.WindowPos2fv(v);
-}
-
-inline void QOpenGLFunctions_3_0::glWindowPos2f(GLfloat x, GLfloat y)
-{
- d_1_4_Deprecated->f.WindowPos2f(x, y);
-}
-
-inline void QOpenGLFunctions_3_0::glWindowPos2dv(const GLdouble *v)
-{
- d_1_4_Deprecated->f.WindowPos2dv(v);
-}
-
-inline void QOpenGLFunctions_3_0::glWindowPos2d(GLdouble x, GLdouble y)
-{
- d_1_4_Deprecated->f.WindowPos2d(x, y);
-}
-
-inline void QOpenGLFunctions_3_0::glSecondaryColorPointer(GLint size, GLenum type, GLsizei stride, const GLvoid *pointer)
-{
- d_1_4_Deprecated->f.SecondaryColorPointer(size, type, stride, pointer);
-}
-
-inline void QOpenGLFunctions_3_0::glSecondaryColor3usv(const GLushort *v)
-{
- d_1_4_Deprecated->f.SecondaryColor3usv(v);
-}
-
-inline void QOpenGLFunctions_3_0::glSecondaryColor3us(GLushort red, GLushort green, GLushort blue)
-{
- d_1_4_Deprecated->f.SecondaryColor3us(red, green, blue);
-}
-
-inline void QOpenGLFunctions_3_0::glSecondaryColor3uiv(const GLuint *v)
-{
- d_1_4_Deprecated->f.SecondaryColor3uiv(v);
-}
-
-inline void QOpenGLFunctions_3_0::glSecondaryColor3ui(GLuint red, GLuint green, GLuint blue)
-{
- d_1_4_Deprecated->f.SecondaryColor3ui(red, green, blue);
-}
-
-inline void QOpenGLFunctions_3_0::glSecondaryColor3ubv(const GLubyte *v)
-{
- d_1_4_Deprecated->f.SecondaryColor3ubv(v);
-}
-
-inline void QOpenGLFunctions_3_0::glSecondaryColor3ub(GLubyte red, GLubyte green, GLubyte blue)
-{
- d_1_4_Deprecated->f.SecondaryColor3ub(red, green, blue);
-}
-
-inline void QOpenGLFunctions_3_0::glSecondaryColor3sv(const GLshort *v)
-{
- d_1_4_Deprecated->f.SecondaryColor3sv(v);
-}
-
-inline void QOpenGLFunctions_3_0::glSecondaryColor3s(GLshort red, GLshort green, GLshort blue)
-{
- d_1_4_Deprecated->f.SecondaryColor3s(red, green, blue);
-}
-
-inline void QOpenGLFunctions_3_0::glSecondaryColor3iv(const GLint *v)
-{
- d_1_4_Deprecated->f.SecondaryColor3iv(v);
-}
-
-inline void QOpenGLFunctions_3_0::glSecondaryColor3i(GLint red, GLint green, GLint blue)
-{
- d_1_4_Deprecated->f.SecondaryColor3i(red, green, blue);
-}
-
-inline void QOpenGLFunctions_3_0::glSecondaryColor3fv(const GLfloat *v)
-{
- d_1_4_Deprecated->f.SecondaryColor3fv(v);
-}
-
-inline void QOpenGLFunctions_3_0::glSecondaryColor3f(GLfloat red, GLfloat green, GLfloat blue)
-{
- d_1_4_Deprecated->f.SecondaryColor3f(red, green, blue);
-}
-
-inline void QOpenGLFunctions_3_0::glSecondaryColor3dv(const GLdouble *v)
-{
- d_1_4_Deprecated->f.SecondaryColor3dv(v);
-}
-
-inline void QOpenGLFunctions_3_0::glSecondaryColor3d(GLdouble red, GLdouble green, GLdouble blue)
-{
- d_1_4_Deprecated->f.SecondaryColor3d(red, green, blue);
-}
-
-inline void QOpenGLFunctions_3_0::glSecondaryColor3bv(const GLbyte *v)
-{
- d_1_4_Deprecated->f.SecondaryColor3bv(v);
-}
-
-inline void QOpenGLFunctions_3_0::glSecondaryColor3b(GLbyte red, GLbyte green, GLbyte blue)
-{
- d_1_4_Deprecated->f.SecondaryColor3b(red, green, blue);
-}
-
-inline void QOpenGLFunctions_3_0::glFogCoordPointer(GLenum type, GLsizei stride, const GLvoid *pointer)
-{
- d_1_4_Deprecated->f.FogCoordPointer(type, stride, pointer);
-}
-
-inline void QOpenGLFunctions_3_0::glFogCoorddv(const GLdouble *coord)
-{
- d_1_4_Deprecated->f.FogCoorddv(coord);
-}
-
-inline void QOpenGLFunctions_3_0::glFogCoordd(GLdouble coord)
-{
- d_1_4_Deprecated->f.FogCoordd(coord);
-}
-
-inline void QOpenGLFunctions_3_0::glFogCoordfv(const GLfloat *coord)
-{
- d_1_4_Deprecated->f.FogCoordfv(coord);
-}
-
-inline void QOpenGLFunctions_3_0::glFogCoordf(GLfloat coord)
-{
- d_1_4_Deprecated->f.FogCoordf(coord);
-}
-
-
-// OpenGL 1.5 deprecated functions
-
-// OpenGL 2.0 deprecated functions
-inline void QOpenGLFunctions_3_0::glVertexAttrib4usv(GLuint index, const GLushort *v)
-{
- d_2_0_Core->f.VertexAttrib4usv(index, v);
-}
-
-inline void QOpenGLFunctions_3_0::glVertexAttrib4uiv(GLuint index, const GLuint *v)
-{
- d_2_0_Core->f.VertexAttrib4uiv(index, v);
-}
-
-inline void QOpenGLFunctions_3_0::glVertexAttrib4ubv(GLuint index, const GLubyte *v)
-{
- d_2_0_Core->f.VertexAttrib4ubv(index, v);
-}
-
-inline void QOpenGLFunctions_3_0::glVertexAttrib4sv(GLuint index, const GLshort *v)
-{
- d_2_0_Core->f.VertexAttrib4sv(index, v);
-}
-
-inline void QOpenGLFunctions_3_0::glVertexAttrib4s(GLuint index, GLshort x, GLshort y, GLshort z, GLshort w)
-{
- d_2_0_Core->f.VertexAttrib4s(index, x, y, z, w);
-}
-
-inline void QOpenGLFunctions_3_0::glVertexAttrib4iv(GLuint index, const GLint *v)
-{
- d_2_0_Core->f.VertexAttrib4iv(index, v);
-}
-
-inline void QOpenGLFunctions_3_0::glVertexAttrib4fv(GLuint index, const GLfloat *v)
-{
- d_2_0_Core->f.VertexAttrib4fv(index, v);
-}
-
-inline void QOpenGLFunctions_3_0::glVertexAttrib4f(GLuint index, GLfloat x, GLfloat y, GLfloat z, GLfloat w)
-{
- d_2_0_Core->f.VertexAttrib4f(index, x, y, z, w);
-}
-
-inline void QOpenGLFunctions_3_0::glVertexAttrib4dv(GLuint index, const GLdouble *v)
-{
- d_2_0_Core->f.VertexAttrib4dv(index, v);
-}
-
-inline void QOpenGLFunctions_3_0::glVertexAttrib4d(GLuint index, GLdouble x, GLdouble y, GLdouble z, GLdouble w)
-{
- d_2_0_Core->f.VertexAttrib4d(index, x, y, z, w);
-}
-
-inline void QOpenGLFunctions_3_0::glVertexAttrib4bv(GLuint index, const GLbyte *v)
-{
- d_2_0_Core->f.VertexAttrib4bv(index, v);
-}
-
-inline void QOpenGLFunctions_3_0::glVertexAttrib4Nusv(GLuint index, const GLushort *v)
-{
- d_2_0_Core->f.VertexAttrib4Nusv(index, v);
-}
-
-inline void QOpenGLFunctions_3_0::glVertexAttrib4Nuiv(GLuint index, const GLuint *v)
-{
- d_2_0_Core->f.VertexAttrib4Nuiv(index, v);
-}
-
-inline void QOpenGLFunctions_3_0::glVertexAttrib4Nubv(GLuint index, const GLubyte *v)
-{
- d_2_0_Core->f.VertexAttrib4Nubv(index, v);
-}
-
-inline void QOpenGLFunctions_3_0::glVertexAttrib4Nub(GLuint index, GLubyte x, GLubyte y, GLubyte z, GLubyte w)
-{
- d_2_0_Core->f.VertexAttrib4Nub(index, x, y, z, w);
-}
-
-inline void QOpenGLFunctions_3_0::glVertexAttrib4Nsv(GLuint index, const GLshort *v)
-{
- d_2_0_Core->f.VertexAttrib4Nsv(index, v);
-}
-
-inline void QOpenGLFunctions_3_0::glVertexAttrib4Niv(GLuint index, const GLint *v)
-{
- d_2_0_Core->f.VertexAttrib4Niv(index, v);
-}
-
-inline void QOpenGLFunctions_3_0::glVertexAttrib4Nbv(GLuint index, const GLbyte *v)
-{
- d_2_0_Core->f.VertexAttrib4Nbv(index, v);
-}
-
-inline void QOpenGLFunctions_3_0::glVertexAttrib3sv(GLuint index, const GLshort *v)
-{
- d_2_0_Core->f.VertexAttrib3sv(index, v);
-}
-
-inline void QOpenGLFunctions_3_0::glVertexAttrib3s(GLuint index, GLshort x, GLshort y, GLshort z)
-{
- d_2_0_Core->f.VertexAttrib3s(index, x, y, z);
-}
-
-inline void QOpenGLFunctions_3_0::glVertexAttrib3fv(GLuint index, const GLfloat *v)
-{
- d_2_0_Core->f.VertexAttrib3fv(index, v);
-}
-
-inline void QOpenGLFunctions_3_0::glVertexAttrib3f(GLuint index, GLfloat x, GLfloat y, GLfloat z)
-{
- d_2_0_Core->f.VertexAttrib3f(index, x, y, z);
-}
-
-inline void QOpenGLFunctions_3_0::glVertexAttrib3dv(GLuint index, const GLdouble *v)
-{
- d_2_0_Core->f.VertexAttrib3dv(index, v);
-}
-
-inline void QOpenGLFunctions_3_0::glVertexAttrib3d(GLuint index, GLdouble x, GLdouble y, GLdouble z)
-{
- d_2_0_Core->f.VertexAttrib3d(index, x, y, z);
-}
-
-inline void QOpenGLFunctions_3_0::glVertexAttrib2sv(GLuint index, const GLshort *v)
-{
- d_2_0_Core->f.VertexAttrib2sv(index, v);
-}
-
-inline void QOpenGLFunctions_3_0::glVertexAttrib2s(GLuint index, GLshort x, GLshort y)
-{
- d_2_0_Core->f.VertexAttrib2s(index, x, y);
-}
-
-inline void QOpenGLFunctions_3_0::glVertexAttrib2fv(GLuint index, const GLfloat *v)
-{
- d_2_0_Core->f.VertexAttrib2fv(index, v);
-}
-
-inline void QOpenGLFunctions_3_0::glVertexAttrib2f(GLuint index, GLfloat x, GLfloat y)
-{
- d_2_0_Core->f.VertexAttrib2f(index, x, y);
-}
-
-inline void QOpenGLFunctions_3_0::glVertexAttrib2dv(GLuint index, const GLdouble *v)
-{
- d_2_0_Core->f.VertexAttrib2dv(index, v);
-}
-
-inline void QOpenGLFunctions_3_0::glVertexAttrib2d(GLuint index, GLdouble x, GLdouble y)
-{
- d_2_0_Core->f.VertexAttrib2d(index, x, y);
-}
-
-inline void QOpenGLFunctions_3_0::glVertexAttrib1sv(GLuint index, const GLshort *v)
-{
- d_2_0_Core->f.VertexAttrib1sv(index, v);
-}
-
-inline void QOpenGLFunctions_3_0::glVertexAttrib1s(GLuint index, GLshort x)
-{
- d_2_0_Core->f.VertexAttrib1s(index, x);
-}
-
-inline void QOpenGLFunctions_3_0::glVertexAttrib1fv(GLuint index, const GLfloat *v)
-{
- d_2_0_Core->f.VertexAttrib1fv(index, v);
-}
-
-inline void QOpenGLFunctions_3_0::glVertexAttrib1f(GLuint index, GLfloat x)
-{
- d_2_0_Core->f.VertexAttrib1f(index, x);
-}
-
-inline void QOpenGLFunctions_3_0::glVertexAttrib1dv(GLuint index, const GLdouble *v)
-{
- d_2_0_Core->f.VertexAttrib1dv(index, v);
-}
-
-inline void QOpenGLFunctions_3_0::glVertexAttrib1d(GLuint index, GLdouble x)
-{
- d_2_0_Core->f.VertexAttrib1d(index, x);
-}
-
-
-// OpenGL 2.1 deprecated functions
-
-// OpenGL 3.0 deprecated functions
-inline void QOpenGLFunctions_3_0::glVertexAttribI4usv(GLuint index, const GLushort *v)
-{
- d_3_0_Core->f.VertexAttribI4usv(index, v);
-}
-
-inline void QOpenGLFunctions_3_0::glVertexAttribI4ubv(GLuint index, const GLubyte *v)
-{
- d_3_0_Core->f.VertexAttribI4ubv(index, v);
-}
-
-inline void QOpenGLFunctions_3_0::glVertexAttribI4sv(GLuint index, const GLshort *v)
-{
- d_3_0_Core->f.VertexAttribI4sv(index, v);
-}
-
-inline void QOpenGLFunctions_3_0::glVertexAttribI4bv(GLuint index, const GLbyte *v)
-{
- d_3_0_Core->f.VertexAttribI4bv(index, v);
-}
-
-inline void QOpenGLFunctions_3_0::glVertexAttribI4uiv(GLuint index, const GLuint *v)
-{
- d_3_0_Core->f.VertexAttribI4uiv(index, v);
-}
-
-inline void QOpenGLFunctions_3_0::glVertexAttribI3uiv(GLuint index, const GLuint *v)
-{
- d_3_0_Core->f.VertexAttribI3uiv(index, v);
-}
-
-inline void QOpenGLFunctions_3_0::glVertexAttribI2uiv(GLuint index, const GLuint *v)
-{
- d_3_0_Core->f.VertexAttribI2uiv(index, v);
-}
-
-inline void QOpenGLFunctions_3_0::glVertexAttribI1uiv(GLuint index, const GLuint *v)
-{
- d_3_0_Core->f.VertexAttribI1uiv(index, v);
-}
-
-inline void QOpenGLFunctions_3_0::glVertexAttribI4iv(GLuint index, const GLint *v)
-{
- d_3_0_Core->f.VertexAttribI4iv(index, v);
-}
-
-inline void QOpenGLFunctions_3_0::glVertexAttribI3iv(GLuint index, const GLint *v)
-{
- d_3_0_Core->f.VertexAttribI3iv(index, v);
-}
-
-inline void QOpenGLFunctions_3_0::glVertexAttribI2iv(GLuint index, const GLint *v)
-{
- d_3_0_Core->f.VertexAttribI2iv(index, v);
-}
-
-inline void QOpenGLFunctions_3_0::glVertexAttribI1iv(GLuint index, const GLint *v)
-{
- d_3_0_Core->f.VertexAttribI1iv(index, v);
-}
-
-inline void QOpenGLFunctions_3_0::glVertexAttribI4ui(GLuint index, GLuint x, GLuint y, GLuint z, GLuint w)
-{
- d_3_0_Core->f.VertexAttribI4ui(index, x, y, z, w);
-}
-
-inline void QOpenGLFunctions_3_0::glVertexAttribI3ui(GLuint index, GLuint x, GLuint y, GLuint z)
-{
- d_3_0_Core->f.VertexAttribI3ui(index, x, y, z);
-}
-
-inline void QOpenGLFunctions_3_0::glVertexAttribI2ui(GLuint index, GLuint x, GLuint y)
-{
- d_3_0_Core->f.VertexAttribI2ui(index, x, y);
-}
-
-inline void QOpenGLFunctions_3_0::glVertexAttribI1ui(GLuint index, GLuint x)
-{
- d_3_0_Core->f.VertexAttribI1ui(index, x);
-}
-
-inline void QOpenGLFunctions_3_0::glVertexAttribI4i(GLuint index, GLint x, GLint y, GLint z, GLint w)
-{
- d_3_0_Core->f.VertexAttribI4i(index, x, y, z, w);
-}
-
-inline void QOpenGLFunctions_3_0::glVertexAttribI3i(GLuint index, GLint x, GLint y, GLint z)
-{
- d_3_0_Core->f.VertexAttribI3i(index, x, y, z);
-}
-
-inline void QOpenGLFunctions_3_0::glVertexAttribI2i(GLuint index, GLint x, GLint y)
-{
- d_3_0_Core->f.VertexAttribI2i(index, x, y);
-}
-
-inline void QOpenGLFunctions_3_0::glVertexAttribI1i(GLuint index, GLint x)
-{
- d_3_0_Core->f.VertexAttribI1i(index, x);
-}
-
-
-
-QT_END_NAMESPACE
-
-#endif // QT_NO_OPENGL && !QT_OPENGL_ES_2
-
-#endif
diff --git a/src/gui/opengl/qopenglfunctions_3_1.cpp b/src/gui/opengl/qopenglfunctions_3_1.cpp
deleted file mode 100644
index c25b124af8..0000000000
--- a/src/gui/opengl/qopenglfunctions_3_1.cpp
+++ /dev/null
@@ -1,205 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2013 Klaralvdalens Datakonsult AB (KDAB)
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the QtGui module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-**
-** This file was generated by glgen version 0.1
-** Command line was: glgen
-**
-** glgen is Copyright (C) 2013 Klaralvdalens Datakonsult AB (KDAB)
-**
-** This is an auto-generated file.
-** Do not edit! All changes made to it will be lost.
-**
-****************************************************************************/
-
-#include "qopenglfunctions_3_1.h"
-#include "qopenglcontext.h"
-
-QT_BEGIN_NAMESPACE
-
-/*!
- \class QOpenGLFunctions_3_1
- \inmodule QtGui
- \since 5.1
- \wrapper
- \brief The QOpenGLFunctions_3_1 class provides all functions for OpenGL 3.1 specification.
-
- This class is a wrapper for functions from OpenGL 3.1 specification.
- See reference pages on \l {http://www.opengl.org/sdk/docs/}{opengl.org}
- for function documentation.
-
- \sa QAbstractOpenGLFunctions
-*/
-
-QOpenGLFunctions_3_1::QOpenGLFunctions_3_1()
- : QAbstractOpenGLFunctions()
- , d_1_0_Core(nullptr)
- , d_1_1_Core(nullptr)
- , d_1_2_Core(nullptr)
- , d_1_3_Core(nullptr)
- , d_1_4_Core(nullptr)
- , d_1_5_Core(nullptr)
- , d_2_0_Core(nullptr)
- , d_2_1_Core(nullptr)
- , d_3_0_Core(nullptr)
- , d_3_1_Core(nullptr)
-{
-}
-
-QOpenGLFunctions_3_1::~QOpenGLFunctions_3_1()
-{
- if (d_1_0_Core) {
- d_1_0_Core->refs.deref();
- Q_ASSERT(d_1_0_Core->refs.loadRelaxed());
- }
- if (d_1_1_Core) {
- d_1_1_Core->refs.deref();
- Q_ASSERT(d_1_1_Core->refs.loadRelaxed());
- }
- if (d_1_2_Core) {
- d_1_2_Core->refs.deref();
- Q_ASSERT(d_1_2_Core->refs.loadRelaxed());
- }
- if (d_1_3_Core) {
- d_1_3_Core->refs.deref();
- Q_ASSERT(d_1_3_Core->refs.loadRelaxed());
- }
- if (d_1_4_Core) {
- d_1_4_Core->refs.deref();
- Q_ASSERT(d_1_4_Core->refs.loadRelaxed());
- }
- if (d_1_5_Core) {
- d_1_5_Core->refs.deref();
- Q_ASSERT(d_1_5_Core->refs.loadRelaxed());
- }
- if (d_2_0_Core) {
- d_2_0_Core->refs.deref();
- Q_ASSERT(d_2_0_Core->refs.loadRelaxed());
- }
- if (d_2_1_Core) {
- d_2_1_Core->refs.deref();
- Q_ASSERT(d_2_1_Core->refs.loadRelaxed());
- }
- if (d_3_0_Core) {
- d_3_0_Core->refs.deref();
- Q_ASSERT(d_3_0_Core->refs.loadRelaxed());
- }
- if (d_3_1_Core) {
- d_3_1_Core->refs.deref();
- Q_ASSERT(d_3_1_Core->refs.loadRelaxed());
- }
-}
-
-bool QOpenGLFunctions_3_1::initializeOpenGLFunctions()
-{
- if ( isInitialized() )
- return true;
-
- QOpenGLContext* context = QOpenGLContext::currentContext();
-
- // If owned by a context object make sure it is current.
- // Also check that current context is capable of resolving all needed functions
- if (((owningContext() && owningContext() == context) || !owningContext())
- && QOpenGLFunctions_3_1::isContextCompatible(context))
- {
- // Associate with private implementation, creating if necessary
- // Function pointers in the backends are resolved at creation time
- QOpenGLVersionFunctionsBackend* d = nullptr;
- d = QAbstractOpenGLFunctionsPrivate::functionsBackend(context, QOpenGLFunctions_1_0_CoreBackend::versionStatus());
- d_1_0_Core = static_cast<QOpenGLFunctions_1_0_CoreBackend*>(d);
- d->refs.ref();
-
- d = QAbstractOpenGLFunctionsPrivate::functionsBackend(context, QOpenGLFunctions_1_1_CoreBackend::versionStatus());
- d_1_1_Core = static_cast<QOpenGLFunctions_1_1_CoreBackend*>(d);
- d->refs.ref();
-
- d = QAbstractOpenGLFunctionsPrivate::functionsBackend(context, QOpenGLFunctions_1_2_CoreBackend::versionStatus());
- d_1_2_Core = static_cast<QOpenGLFunctions_1_2_CoreBackend*>(d);
- d->refs.ref();
-
- d = QAbstractOpenGLFunctionsPrivate::functionsBackend(context, QOpenGLFunctions_1_3_CoreBackend::versionStatus());
- d_1_3_Core = static_cast<QOpenGLFunctions_1_3_CoreBackend*>(d);
- d->refs.ref();
-
- d = QAbstractOpenGLFunctionsPrivate::functionsBackend(context, QOpenGLFunctions_1_4_CoreBackend::versionStatus());
- d_1_4_Core = static_cast<QOpenGLFunctions_1_4_CoreBackend*>(d);
- d->refs.ref();
-
- d = QAbstractOpenGLFunctionsPrivate::functionsBackend(context, QOpenGLFunctions_1_5_CoreBackend::versionStatus());
- d_1_5_Core = static_cast<QOpenGLFunctions_1_5_CoreBackend*>(d);
- d->refs.ref();
-
- d = QAbstractOpenGLFunctionsPrivate::functionsBackend(context, QOpenGLFunctions_2_0_CoreBackend::versionStatus());
- d_2_0_Core = static_cast<QOpenGLFunctions_2_0_CoreBackend*>(d);
- d->refs.ref();
-
- d = QAbstractOpenGLFunctionsPrivate::functionsBackend(context, QOpenGLFunctions_2_1_CoreBackend::versionStatus());
- d_2_1_Core = static_cast<QOpenGLFunctions_2_1_CoreBackend*>(d);
- d->refs.ref();
-
- d = QAbstractOpenGLFunctionsPrivate::functionsBackend(context, QOpenGLFunctions_3_0_CoreBackend::versionStatus());
- d_3_0_Core = static_cast<QOpenGLFunctions_3_0_CoreBackend*>(d);
- d->refs.ref();
-
- d = QAbstractOpenGLFunctionsPrivate::functionsBackend(context, QOpenGLFunctions_3_1_CoreBackend::versionStatus());
- d_3_1_Core = static_cast<QOpenGLFunctions_3_1_CoreBackend*>(d);
- d->refs.ref();
-
- QAbstractOpenGLFunctions::initializeOpenGLFunctions();
- }
- return isInitialized();
-}
-
-bool QOpenGLFunctions_3_1::isContextCompatible(QOpenGLContext *context)
-{
- Q_ASSERT(context);
- QSurfaceFormat f = context->format();
- const QPair<int, int> v = qMakePair(f.majorVersion(), f.minorVersion());
- if (v < qMakePair(3, 1))
- return false;
-
- return true;
-}
-
-QOpenGLVersionProfile QOpenGLFunctions_3_1::versionProfile()
-{
- QOpenGLVersionProfile v;
- v.setVersion(3, 1);
- return v;
-}
-
-QT_END_NAMESPACE
diff --git a/src/gui/opengl/qopenglfunctions_3_1.h b/src/gui/opengl/qopenglfunctions_3_1.h
deleted file mode 100644
index 3a8d3891f3..0000000000
--- a/src/gui/opengl/qopenglfunctions_3_1.h
+++ /dev/null
@@ -1,1601 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2013 Klaralvdalens Datakonsult AB (KDAB)
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the QtGui module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-**
-** This file was generated by glgen version 0.1
-** Command line was: glgen
-**
-** glgen is Copyright (C) 2013 Klaralvdalens Datakonsult AB (KDAB)
-**
-** This is an auto-generated file.
-** Do not edit! All changes made to it will be lost.
-**
-****************************************************************************/
-
-#ifndef QOPENGLVERSIONFUNCTIONS_3_1_H
-#define QOPENGLVERSIONFUNCTIONS_3_1_H
-
-#include <QtGui/qtguiglobal.h>
-
-#if !defined(QT_NO_OPENGL) && !defined(QT_OPENGL_ES_2)
-
-#include <QtGui/QOpenGLVersionFunctions>
-#include <QtGui/qopenglcontext.h>
-
-QT_BEGIN_NAMESPACE
-
-class Q_GUI_EXPORT QOpenGLFunctions_3_1 : public QAbstractOpenGLFunctions
-{
-public:
- QOpenGLFunctions_3_1();
- ~QOpenGLFunctions_3_1();
-
- bool initializeOpenGLFunctions() override;
-
- // OpenGL 1.0 core functions
- void glViewport(GLint x, GLint y, GLsizei width, GLsizei height);
- void glDepthRange(GLdouble nearVal, GLdouble farVal);
- GLboolean glIsEnabled(GLenum cap);
- void glGetTexLevelParameteriv(GLenum target, GLint level, GLenum pname, GLint *params);
- void glGetTexLevelParameterfv(GLenum target, GLint level, GLenum pname, GLfloat *params);
- void glGetTexParameteriv(GLenum target, GLenum pname, GLint *params);
- void glGetTexParameterfv(GLenum target, GLenum pname, GLfloat *params);
- void glGetTexImage(GLenum target, GLint level, GLenum format, GLenum type, GLvoid *pixels);
- const GLubyte * glGetString(GLenum name);
- void glGetIntegerv(GLenum pname, GLint *params);
- void glGetFloatv(GLenum pname, GLfloat *params);
- GLenum glGetError();
- void glGetDoublev(GLenum pname, GLdouble *params);
- void glGetBooleanv(GLenum pname, GLboolean *params);
- void glReadPixels(GLint x, GLint y, GLsizei width, GLsizei height, GLenum format, GLenum type, GLvoid *pixels);
- void glReadBuffer(GLenum mode);
- void glPixelStorei(GLenum pname, GLint param);
- void glPixelStoref(GLenum pname, GLfloat param);
- void glDepthFunc(GLenum func);
- void glStencilOp(GLenum fail, GLenum zfail, GLenum zpass);
- void glStencilFunc(GLenum func, GLint ref, GLuint mask);
- void glLogicOp(GLenum opcode);
- void glBlendFunc(GLenum sfactor, GLenum dfactor);
- void glFlush();
- void glFinish();
- void glEnable(GLenum cap);
- void glDisable(GLenum cap);
- void glDepthMask(GLboolean flag);
- void glColorMask(GLboolean red, GLboolean green, GLboolean blue, GLboolean alpha);
- void glStencilMask(GLuint mask);
- void glClearDepth(GLdouble depth);
- void glClearStencil(GLint s);
- void glClearColor(GLfloat red, GLfloat green, GLfloat blue, GLfloat alpha);
- void glClear(GLbitfield mask);
- void glDrawBuffer(GLenum mode);
- void glTexImage2D(GLenum target, GLint level, GLint internalformat, GLsizei width, GLsizei height, GLint border, GLenum format, GLenum type, const GLvoid *pixels);
- void glTexImage1D(GLenum target, GLint level, GLint internalformat, GLsizei width, GLint border, GLenum format, GLenum type, const GLvoid *pixels);
- void glTexParameteriv(GLenum target, GLenum pname, const GLint *params);
- void glTexParameteri(GLenum target, GLenum pname, GLint param);
- void glTexParameterfv(GLenum target, GLenum pname, const GLfloat *params);
- void glTexParameterf(GLenum target, GLenum pname, GLfloat param);
- void glScissor(GLint x, GLint y, GLsizei width, GLsizei height);
- void glPolygonMode(GLenum face, GLenum mode);
- void glPointSize(GLfloat size);
- void glLineWidth(GLfloat width);
- void glHint(GLenum target, GLenum mode);
- void glFrontFace(GLenum mode);
- void glCullFace(GLenum mode);
-
- // OpenGL 1.1 core functions
- void glIndexubv(const GLubyte *c);
- void glIndexub(GLubyte c);
- GLboolean glIsTexture(GLuint texture);
- void glGenTextures(GLsizei n, GLuint *textures);
- void glDeleteTextures(GLsizei n, const GLuint *textures);
- void glBindTexture(GLenum target, GLuint texture);
- void glTexSubImage2D(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLenum type, const GLvoid *pixels);
- void glTexSubImage1D(GLenum target, GLint level, GLint xoffset, GLsizei width, GLenum format, GLenum type, const GLvoid *pixels);
- void glCopyTexSubImage2D(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint x, GLint y, GLsizei width, GLsizei height);
- void glCopyTexSubImage1D(GLenum target, GLint level, GLint xoffset, GLint x, GLint y, GLsizei width);
- void glCopyTexImage2D(GLenum target, GLint level, GLenum internalformat, GLint x, GLint y, GLsizei width, GLsizei height, GLint border);
- void glCopyTexImage1D(GLenum target, GLint level, GLenum internalformat, GLint x, GLint y, GLsizei width, GLint border);
- void glPolygonOffset(GLfloat factor, GLfloat units);
- void glGetPointerv(GLenum pname, GLvoid* *params);
- void glDrawElements(GLenum mode, GLsizei count, GLenum type, const GLvoid *indices);
- void glDrawArrays(GLenum mode, GLint first, GLsizei count);
-
- // OpenGL 1.2 core functions
- void glCopyTexSubImage3D(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLint x, GLint y, GLsizei width, GLsizei height);
- void glTexSubImage3D(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLenum type, const GLvoid *pixels);
- void glTexImage3D(GLenum target, GLint level, GLint internalformat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLenum format, GLenum type, const GLvoid *pixels);
- void glDrawRangeElements(GLenum mode, GLuint start, GLuint end, GLsizei count, GLenum type, const GLvoid *indices);
- void glBlendEquation(GLenum mode);
- void glBlendColor(GLfloat red, GLfloat green, GLfloat blue, GLfloat alpha);
-
- // OpenGL 1.3 core functions
- void glGetCompressedTexImage(GLenum target, GLint level, GLvoid *img);
- void glCompressedTexSubImage1D(GLenum target, GLint level, GLint xoffset, GLsizei width, GLenum format, GLsizei imageSize, const GLvoid *data);
- void glCompressedTexSubImage2D(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLsizei imageSize, const GLvoid *data);
- void glCompressedTexSubImage3D(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLsizei imageSize, const GLvoid *data);
- void glCompressedTexImage1D(GLenum target, GLint level, GLenum internalformat, GLsizei width, GLint border, GLsizei imageSize, const GLvoid *data);
- void glCompressedTexImage2D(GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLint border, GLsizei imageSize, const GLvoid *data);
- void glCompressedTexImage3D(GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLsizei imageSize, const GLvoid *data);
- void glSampleCoverage(GLfloat value, GLboolean invert);
- void glActiveTexture(GLenum texture);
-
- // OpenGL 1.4 core functions
- void glPointParameteriv(GLenum pname, const GLint *params);
- void glPointParameteri(GLenum pname, GLint param);
- void glPointParameterfv(GLenum pname, const GLfloat *params);
- void glPointParameterf(GLenum pname, GLfloat param);
- void glMultiDrawElements(GLenum mode, const GLsizei *count, GLenum type, const GLvoid* const *indices, GLsizei drawcount);
- void glMultiDrawArrays(GLenum mode, const GLint *first, const GLsizei *count, GLsizei drawcount);
- void glBlendFuncSeparate(GLenum sfactorRGB, GLenum dfactorRGB, GLenum sfactorAlpha, GLenum dfactorAlpha);
-
- // OpenGL 1.5 core functions
- void glGetBufferPointerv(GLenum target, GLenum pname, GLvoid* *params);
- void glGetBufferParameteriv(GLenum target, GLenum pname, GLint *params);
- GLboolean glUnmapBuffer(GLenum target);
- GLvoid* glMapBuffer(GLenum target, GLenum access);
- void glGetBufferSubData(GLenum target, GLintptr offset, GLsizeiptr size, GLvoid *data);
- void glBufferSubData(GLenum target, GLintptr offset, GLsizeiptr size, const GLvoid *data);
- void glBufferData(GLenum target, GLsizeiptr size, const GLvoid *data, GLenum usage);
- GLboolean glIsBuffer(GLuint buffer);
- void glGenBuffers(GLsizei n, GLuint *buffers);
- void glDeleteBuffers(GLsizei n, const GLuint *buffers);
- void glBindBuffer(GLenum target, GLuint buffer);
- void glGetQueryObjectuiv(GLuint id, GLenum pname, GLuint *params);
- void glGetQueryObjectiv(GLuint id, GLenum pname, GLint *params);
- void glGetQueryiv(GLenum target, GLenum pname, GLint *params);
- void glEndQuery(GLenum target);
- void glBeginQuery(GLenum target, GLuint id);
- GLboolean glIsQuery(GLuint id);
- void glDeleteQueries(GLsizei n, const GLuint *ids);
- void glGenQueries(GLsizei n, GLuint *ids);
-
- // OpenGL 2.0 core functions
- void glVertexAttribPointer(GLuint index, GLint size, GLenum type, GLboolean normalized, GLsizei stride, const GLvoid *pointer);
- void glValidateProgram(GLuint program);
- void glUniformMatrix4fv(GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
- void glUniformMatrix3fv(GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
- void glUniformMatrix2fv(GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
- void glUniform4iv(GLint location, GLsizei count, const GLint *value);
- void glUniform3iv(GLint location, GLsizei count, const GLint *value);
- void glUniform2iv(GLint location, GLsizei count, const GLint *value);
- void glUniform1iv(GLint location, GLsizei count, const GLint *value);
- void glUniform4fv(GLint location, GLsizei count, const GLfloat *value);
- void glUniform3fv(GLint location, GLsizei count, const GLfloat *value);
- void glUniform2fv(GLint location, GLsizei count, const GLfloat *value);
- void glUniform1fv(GLint location, GLsizei count, const GLfloat *value);
- void glUniform4i(GLint location, GLint v0, GLint v1, GLint v2, GLint v3);
- void glUniform3i(GLint location, GLint v0, GLint v1, GLint v2);
- void glUniform2i(GLint location, GLint v0, GLint v1);
- void glUniform1i(GLint location, GLint v0);
- void glUniform4f(GLint location, GLfloat v0, GLfloat v1, GLfloat v2, GLfloat v3);
- void glUniform3f(GLint location, GLfloat v0, GLfloat v1, GLfloat v2);
- void glUniform2f(GLint location, GLfloat v0, GLfloat v1);
- void glUniform1f(GLint location, GLfloat v0);
- void glUseProgram(GLuint program);
- void glShaderSource(GLuint shader, GLsizei count, const GLchar* const *string, const GLint *length);
- void glLinkProgram(GLuint program);
- GLboolean glIsShader(GLuint shader);
- GLboolean glIsProgram(GLuint program);
- void glGetVertexAttribPointerv(GLuint index, GLenum pname, GLvoid* *pointer);
- void glGetVertexAttribiv(GLuint index, GLenum pname, GLint *params);
- void glGetVertexAttribfv(GLuint index, GLenum pname, GLfloat *params);
- void glGetVertexAttribdv(GLuint index, GLenum pname, GLdouble *params);
- void glGetUniformiv(GLuint program, GLint location, GLint *params);
- void glGetUniformfv(GLuint program, GLint location, GLfloat *params);
- GLint glGetUniformLocation(GLuint program, const GLchar *name);
- void glGetShaderSource(GLuint shader, GLsizei bufSize, GLsizei *length, GLchar *source);
- void glGetShaderInfoLog(GLuint shader, GLsizei bufSize, GLsizei *length, GLchar *infoLog);
- void glGetShaderiv(GLuint shader, GLenum pname, GLint *params);
- void glGetProgramInfoLog(GLuint program, GLsizei bufSize, GLsizei *length, GLchar *infoLog);
- void glGetProgramiv(GLuint program, GLenum pname, GLint *params);
- GLint glGetAttribLocation(GLuint program, const GLchar *name);
- void glGetAttachedShaders(GLuint program, GLsizei maxCount, GLsizei *count, GLuint *obj);
- void glGetActiveUniform(GLuint program, GLuint index, GLsizei bufSize, GLsizei *length, GLint *size, GLenum *type, GLchar *name);
- void glGetActiveAttrib(GLuint program, GLuint index, GLsizei bufSize, GLsizei *length, GLint *size, GLenum *type, GLchar *name);
- void glEnableVertexAttribArray(GLuint index);
- void glDisableVertexAttribArray(GLuint index);
- void glDetachShader(GLuint program, GLuint shader);
- void glDeleteShader(GLuint shader);
- void glDeleteProgram(GLuint program);
- GLuint glCreateShader(GLenum type);
- GLuint glCreateProgram();
- void glCompileShader(GLuint shader);
- void glBindAttribLocation(GLuint program, GLuint index, const GLchar *name);
- void glAttachShader(GLuint program, GLuint shader);
- void glStencilMaskSeparate(GLenum face, GLuint mask);
- void glStencilFuncSeparate(GLenum face, GLenum func, GLint ref, GLuint mask);
- void glStencilOpSeparate(GLenum face, GLenum sfail, GLenum dpfail, GLenum dppass);
- void glDrawBuffers(GLsizei n, const GLenum *bufs);
- void glBlendEquationSeparate(GLenum modeRGB, GLenum modeAlpha);
-
- // OpenGL 2.1 core functions
- void glUniformMatrix4x3fv(GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
- void glUniformMatrix3x4fv(GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
- void glUniformMatrix4x2fv(GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
- void glUniformMatrix2x4fv(GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
- void glUniformMatrix3x2fv(GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
- void glUniformMatrix2x3fv(GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
-
- // OpenGL 3.0 core functions
- GLboolean glIsVertexArray(GLuint array);
- void glGenVertexArrays(GLsizei n, GLuint *arrays);
- void glDeleteVertexArrays(GLsizei n, const GLuint *arrays);
- void glBindVertexArray(GLuint array);
- void glFlushMappedBufferRange(GLenum target, GLintptr offset, GLsizeiptr length);
- GLvoid* glMapBufferRange(GLenum target, GLintptr offset, GLsizeiptr length, GLbitfield access);
- void glFramebufferTextureLayer(GLenum target, GLenum attachment, GLuint texture, GLint level, GLint layer);
- void glRenderbufferStorageMultisample(GLenum target, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height);
- void glBlitFramebuffer(GLint srcX0, GLint srcY0, GLint srcX1, GLint srcY1, GLint dstX0, GLint dstY0, GLint dstX1, GLint dstY1, GLbitfield mask, GLenum filter);
- void glGenerateMipmap(GLenum target);
- void glGetFramebufferAttachmentParameteriv(GLenum target, GLenum attachment, GLenum pname, GLint *params);
- void glFramebufferRenderbuffer(GLenum target, GLenum attachment, GLenum renderbuffertarget, GLuint renderbuffer);
- void glFramebufferTexture3D(GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level, GLint zoffset);
- void glFramebufferTexture2D(GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level);
- void glFramebufferTexture1D(GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level);
- GLenum glCheckFramebufferStatus(GLenum target);
- void glGenFramebuffers(GLsizei n, GLuint *framebuffers);
- void glDeleteFramebuffers(GLsizei n, const GLuint *framebuffers);
- void glBindFramebuffer(GLenum target, GLuint framebuffer);
- GLboolean glIsFramebuffer(GLuint framebuffer);
- void glGetRenderbufferParameteriv(GLenum target, GLenum pname, GLint *params);
- void glRenderbufferStorage(GLenum target, GLenum internalformat, GLsizei width, GLsizei height);
- void glGenRenderbuffers(GLsizei n, GLuint *renderbuffers);
- void glDeleteRenderbuffers(GLsizei n, const GLuint *renderbuffers);
- void glBindRenderbuffer(GLenum target, GLuint renderbuffer);
- GLboolean glIsRenderbuffer(GLuint renderbuffer);
- const GLubyte * glGetStringi(GLenum name, GLuint index);
- void glClearBufferfi(GLenum buffer, GLint drawbuffer, GLfloat depth, GLint stencil);
- void glClearBufferfv(GLenum buffer, GLint drawbuffer, const GLfloat *value);
- void glClearBufferuiv(GLenum buffer, GLint drawbuffer, const GLuint *value);
- void glClearBufferiv(GLenum buffer, GLint drawbuffer, const GLint *value);
- void glGetTexParameterIuiv(GLenum target, GLenum pname, GLuint *params);
- void glGetTexParameterIiv(GLenum target, GLenum pname, GLint *params);
- void glTexParameterIuiv(GLenum target, GLenum pname, const GLuint *params);
- void glTexParameterIiv(GLenum target, GLenum pname, const GLint *params);
- void glUniform4uiv(GLint location, GLsizei count, const GLuint *value);
- void glUniform3uiv(GLint location, GLsizei count, const GLuint *value);
- void glUniform2uiv(GLint location, GLsizei count, const GLuint *value);
- void glUniform1uiv(GLint location, GLsizei count, const GLuint *value);
- void glUniform4ui(GLint location, GLuint v0, GLuint v1, GLuint v2, GLuint v3);
- void glUniform3ui(GLint location, GLuint v0, GLuint v1, GLuint v2);
- void glUniform2ui(GLint location, GLuint v0, GLuint v1);
- void glUniform1ui(GLint location, GLuint v0);
- GLint glGetFragDataLocation(GLuint program, const GLchar *name);
- void glBindFragDataLocation(GLuint program, GLuint color, const GLchar *name);
- void glGetUniformuiv(GLuint program, GLint location, GLuint *params);
- void glGetVertexAttribIuiv(GLuint index, GLenum pname, GLuint *params);
- void glGetVertexAttribIiv(GLuint index, GLenum pname, GLint *params);
- void glVertexAttribIPointer(GLuint index, GLint size, GLenum type, GLsizei stride, const GLvoid *pointer);
- void glEndConditionalRender();
- void glBeginConditionalRender(GLuint id, GLenum mode);
- void glClampColor(GLenum target, GLenum clamp);
- void glGetTransformFeedbackVarying(GLuint program, GLuint index, GLsizei bufSize, GLsizei *length, GLsizei *size, GLenum *type, GLchar *name);
- void glTransformFeedbackVaryings(GLuint program, GLsizei count, const GLchar* const *varyings, GLenum bufferMode);
- void glBindBufferBase(GLenum target, GLuint index, GLuint buffer);
- void glBindBufferRange(GLenum target, GLuint index, GLuint buffer, GLintptr offset, GLsizeiptr size);
- void glEndTransformFeedback();
- void glBeginTransformFeedback(GLenum primitiveMode);
- GLboolean glIsEnabledi(GLenum target, GLuint index);
- void glDisablei(GLenum target, GLuint index);
- void glEnablei(GLenum target, GLuint index);
- void glGetIntegeri_v(GLenum target, GLuint index, GLint *data);
- void glGetBooleani_v(GLenum target, GLuint index, GLboolean *data);
- void glColorMaski(GLuint index, GLboolean r, GLboolean g, GLboolean b, GLboolean a);
-
- // OpenGL 3.1 core functions
- void glCopyBufferSubData(GLenum readTarget, GLenum writeTarget, GLintptr readOffset, GLintptr writeOffset, GLsizeiptr size);
- void glUniformBlockBinding(GLuint program, GLuint uniformBlockIndex, GLuint uniformBlockBinding);
- void glGetActiveUniformBlockName(GLuint program, GLuint uniformBlockIndex, GLsizei bufSize, GLsizei *length, GLchar *uniformBlockName);
- void glGetActiveUniformBlockiv(GLuint program, GLuint uniformBlockIndex, GLenum pname, GLint *params);
- GLuint glGetUniformBlockIndex(GLuint program, const GLchar *uniformBlockName);
- void glGetActiveUniformName(GLuint program, GLuint uniformIndex, GLsizei bufSize, GLsizei *length, GLchar *uniformName);
- void glGetActiveUniformsiv(GLuint program, GLsizei uniformCount, const GLuint *uniformIndices, GLenum pname, GLint *params);
- void glGetUniformIndices(GLuint program, GLsizei uniformCount, const GLchar* const *uniformNames, GLuint *uniformIndices);
- void glPrimitiveRestartIndex(GLuint index);
- void glTexBuffer(GLenum target, GLenum internalformat, GLuint buffer);
- void glDrawElementsInstanced(GLenum mode, GLsizei count, GLenum type, const GLvoid *indices, GLsizei instancecount);
- void glDrawArraysInstanced(GLenum mode, GLint first, GLsizei count, GLsizei instancecount);
-
-private:
- friend class QOpenGLContext;
-
- static bool isContextCompatible(QOpenGLContext *context);
- static QOpenGLVersionProfile versionProfile();
-
- QOpenGLFunctions_1_0_CoreBackend* d_1_0_Core;
- QOpenGLFunctions_1_1_CoreBackend* d_1_1_Core;
- QOpenGLFunctions_1_2_CoreBackend* d_1_2_Core;
- QOpenGLFunctions_1_3_CoreBackend* d_1_3_Core;
- QOpenGLFunctions_1_4_CoreBackend* d_1_4_Core;
- QOpenGLFunctions_1_5_CoreBackend* d_1_5_Core;
- QOpenGLFunctions_2_0_CoreBackend* d_2_0_Core;
- QOpenGLFunctions_2_1_CoreBackend* d_2_1_Core;
- QOpenGLFunctions_3_0_CoreBackend* d_3_0_Core;
- QOpenGLFunctions_3_1_CoreBackend* d_3_1_Core;
-};
-
-// OpenGL 1.0 core functions
-inline void QOpenGLFunctions_3_1::glViewport(GLint x, GLint y, GLsizei width, GLsizei height)
-{
- d_1_0_Core->f.Viewport(x, y, width, height);
-}
-
-inline void QOpenGLFunctions_3_1::glDepthRange(GLdouble nearVal, GLdouble farVal)
-{
- d_1_0_Core->f.DepthRange(nearVal, farVal);
-}
-
-inline GLboolean QOpenGLFunctions_3_1::glIsEnabled(GLenum cap)
-{
- return d_1_0_Core->f.IsEnabled(cap);
-}
-
-inline void QOpenGLFunctions_3_1::glGetTexLevelParameteriv(GLenum target, GLint level, GLenum pname, GLint *params)
-{
- d_1_0_Core->f.GetTexLevelParameteriv(target, level, pname, params);
-}
-
-inline void QOpenGLFunctions_3_1::glGetTexLevelParameterfv(GLenum target, GLint level, GLenum pname, GLfloat *params)
-{
- d_1_0_Core->f.GetTexLevelParameterfv(target, level, pname, params);
-}
-
-inline void QOpenGLFunctions_3_1::glGetTexParameteriv(GLenum target, GLenum pname, GLint *params)
-{
- d_1_0_Core->f.GetTexParameteriv(target, pname, params);
-}
-
-inline void QOpenGLFunctions_3_1::glGetTexParameterfv(GLenum target, GLenum pname, GLfloat *params)
-{
- d_1_0_Core->f.GetTexParameterfv(target, pname, params);
-}
-
-inline void QOpenGLFunctions_3_1::glGetTexImage(GLenum target, GLint level, GLenum format, GLenum type, GLvoid *pixels)
-{
- d_1_0_Core->f.GetTexImage(target, level, format, type, pixels);
-}
-
-inline const GLubyte * QOpenGLFunctions_3_1::glGetString(GLenum name)
-{
- return d_1_0_Core->f.GetString(name);
-}
-
-inline void QOpenGLFunctions_3_1::glGetIntegerv(GLenum pname, GLint *params)
-{
- d_1_0_Core->f.GetIntegerv(pname, params);
-}
-
-inline void QOpenGLFunctions_3_1::glGetFloatv(GLenum pname, GLfloat *params)
-{
- d_1_0_Core->f.GetFloatv(pname, params);
-}
-
-inline GLenum QOpenGLFunctions_3_1::glGetError()
-{
- return d_1_0_Core->f.GetError();
-}
-
-inline void QOpenGLFunctions_3_1::glGetDoublev(GLenum pname, GLdouble *params)
-{
- d_1_0_Core->f.GetDoublev(pname, params);
-}
-
-inline void QOpenGLFunctions_3_1::glGetBooleanv(GLenum pname, GLboolean *params)
-{
- d_1_0_Core->f.GetBooleanv(pname, params);
-}
-
-inline void QOpenGLFunctions_3_1::glReadPixels(GLint x, GLint y, GLsizei width, GLsizei height, GLenum format, GLenum type, GLvoid *pixels)
-{
- d_1_0_Core->f.ReadPixels(x, y, width, height, format, type, pixels);
-}
-
-inline void QOpenGLFunctions_3_1::glReadBuffer(GLenum mode)
-{
- d_1_0_Core->f.ReadBuffer(mode);
-}
-
-inline void QOpenGLFunctions_3_1::glPixelStorei(GLenum pname, GLint param)
-{
- d_1_0_Core->f.PixelStorei(pname, param);
-}
-
-inline void QOpenGLFunctions_3_1::glPixelStoref(GLenum pname, GLfloat param)
-{
- d_1_0_Core->f.PixelStoref(pname, param);
-}
-
-inline void QOpenGLFunctions_3_1::glDepthFunc(GLenum func)
-{
- d_1_0_Core->f.DepthFunc(func);
-}
-
-inline void QOpenGLFunctions_3_1::glStencilOp(GLenum fail, GLenum zfail, GLenum zpass)
-{
- d_1_0_Core->f.StencilOp(fail, zfail, zpass);
-}
-
-inline void QOpenGLFunctions_3_1::glStencilFunc(GLenum func, GLint ref, GLuint mask)
-{
- d_1_0_Core->f.StencilFunc(func, ref, mask);
-}
-
-inline void QOpenGLFunctions_3_1::glLogicOp(GLenum opcode)
-{
- d_1_0_Core->f.LogicOp(opcode);
-}
-
-inline void QOpenGLFunctions_3_1::glBlendFunc(GLenum sfactor, GLenum dfactor)
-{
- d_1_0_Core->f.BlendFunc(sfactor, dfactor);
-}
-
-inline void QOpenGLFunctions_3_1::glFlush()
-{
- d_1_0_Core->f.Flush();
-}
-
-inline void QOpenGLFunctions_3_1::glFinish()
-{
- d_1_0_Core->f.Finish();
-}
-
-inline void QOpenGLFunctions_3_1::glEnable(GLenum cap)
-{
- d_1_0_Core->f.Enable(cap);
-}
-
-inline void QOpenGLFunctions_3_1::glDisable(GLenum cap)
-{
- d_1_0_Core->f.Disable(cap);
-}
-
-inline void QOpenGLFunctions_3_1::glDepthMask(GLboolean flag)
-{
- d_1_0_Core->f.DepthMask(flag);
-}
-
-inline void QOpenGLFunctions_3_1::glColorMask(GLboolean red, GLboolean green, GLboolean blue, GLboolean alpha)
-{
- d_1_0_Core->f.ColorMask(red, green, blue, alpha);
-}
-
-inline void QOpenGLFunctions_3_1::glStencilMask(GLuint mask)
-{
- d_1_0_Core->f.StencilMask(mask);
-}
-
-inline void QOpenGLFunctions_3_1::glClearDepth(GLdouble depth)
-{
- d_1_0_Core->f.ClearDepth(depth);
-}
-
-inline void QOpenGLFunctions_3_1::glClearStencil(GLint s)
-{
- d_1_0_Core->f.ClearStencil(s);
-}
-
-inline void QOpenGLFunctions_3_1::glClearColor(GLfloat red, GLfloat green, GLfloat blue, GLfloat alpha)
-{
- d_1_0_Core->f.ClearColor(red, green, blue, alpha);
-}
-
-inline void QOpenGLFunctions_3_1::glClear(GLbitfield mask)
-{
- d_1_0_Core->f.Clear(mask);
-}
-
-inline void QOpenGLFunctions_3_1::glDrawBuffer(GLenum mode)
-{
- d_1_0_Core->f.DrawBuffer(mode);
-}
-
-inline void QOpenGLFunctions_3_1::glTexImage2D(GLenum target, GLint level, GLint internalformat, GLsizei width, GLsizei height, GLint border, GLenum format, GLenum type, const GLvoid *pixels)
-{
- d_1_0_Core->f.TexImage2D(target, level, internalformat, width, height, border, format, type, pixels);
-}
-
-inline void QOpenGLFunctions_3_1::glTexImage1D(GLenum target, GLint level, GLint internalformat, GLsizei width, GLint border, GLenum format, GLenum type, const GLvoid *pixels)
-{
- d_1_0_Core->f.TexImage1D(target, level, internalformat, width, border, format, type, pixels);
-}
-
-inline void QOpenGLFunctions_3_1::glTexParameteriv(GLenum target, GLenum pname, const GLint *params)
-{
- d_1_0_Core->f.TexParameteriv(target, pname, params);
-}
-
-inline void QOpenGLFunctions_3_1::glTexParameteri(GLenum target, GLenum pname, GLint param)
-{
- d_1_0_Core->f.TexParameteri(target, pname, param);
-}
-
-inline void QOpenGLFunctions_3_1::glTexParameterfv(GLenum target, GLenum pname, const GLfloat *params)
-{
- d_1_0_Core->f.TexParameterfv(target, pname, params);
-}
-
-inline void QOpenGLFunctions_3_1::glTexParameterf(GLenum target, GLenum pname, GLfloat param)
-{
- d_1_0_Core->f.TexParameterf(target, pname, param);
-}
-
-inline void QOpenGLFunctions_3_1::glScissor(GLint x, GLint y, GLsizei width, GLsizei height)
-{
- d_1_0_Core->f.Scissor(x, y, width, height);
-}
-
-inline void QOpenGLFunctions_3_1::glPolygonMode(GLenum face, GLenum mode)
-{
- d_1_0_Core->f.PolygonMode(face, mode);
-}
-
-inline void QOpenGLFunctions_3_1::glPointSize(GLfloat size)
-{
- d_1_0_Core->f.PointSize(size);
-}
-
-inline void QOpenGLFunctions_3_1::glLineWidth(GLfloat width)
-{
- d_1_0_Core->f.LineWidth(width);
-}
-
-inline void QOpenGLFunctions_3_1::glHint(GLenum target, GLenum mode)
-{
- d_1_0_Core->f.Hint(target, mode);
-}
-
-inline void QOpenGLFunctions_3_1::glFrontFace(GLenum mode)
-{
- d_1_0_Core->f.FrontFace(mode);
-}
-
-inline void QOpenGLFunctions_3_1::glCullFace(GLenum mode)
-{
- d_1_0_Core->f.CullFace(mode);
-}
-
-
-// OpenGL 1.1 core functions
-inline void QOpenGLFunctions_3_1::glIndexubv(const GLubyte *c)
-{
- Q_UNUSED(c);
- QOPENGL_DEPRECATEDFUNCTION;
-}
-
-inline void QOpenGLFunctions_3_1::glIndexub(GLubyte c)
-{
- Q_UNUSED(c);
- QOPENGL_DEPRECATEDFUNCTION;
-}
-
-inline GLboolean QOpenGLFunctions_3_1::glIsTexture(GLuint texture)
-{
- return d_1_1_Core->f.IsTexture(texture);
-}
-
-inline void QOpenGLFunctions_3_1::glGenTextures(GLsizei n, GLuint *textures)
-{
- d_1_1_Core->f.GenTextures(n, textures);
-}
-
-inline void QOpenGLFunctions_3_1::glDeleteTextures(GLsizei n, const GLuint *textures)
-{
- d_1_1_Core->f.DeleteTextures(n, textures);
-}
-
-inline void QOpenGLFunctions_3_1::glBindTexture(GLenum target, GLuint texture)
-{
- d_1_1_Core->f.BindTexture(target, texture);
-}
-
-inline void QOpenGLFunctions_3_1::glTexSubImage2D(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLenum type, const GLvoid *pixels)
-{
- d_1_1_Core->f.TexSubImage2D(target, level, xoffset, yoffset, width, height, format, type, pixels);
-}
-
-inline void QOpenGLFunctions_3_1::glTexSubImage1D(GLenum target, GLint level, GLint xoffset, GLsizei width, GLenum format, GLenum type, const GLvoid *pixels)
-{
- d_1_1_Core->f.TexSubImage1D(target, level, xoffset, width, format, type, pixels);
-}
-
-inline void QOpenGLFunctions_3_1::glCopyTexSubImage2D(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint x, GLint y, GLsizei width, GLsizei height)
-{
- d_1_1_Core->f.CopyTexSubImage2D(target, level, xoffset, yoffset, x, y, width, height);
-}
-
-inline void QOpenGLFunctions_3_1::glCopyTexSubImage1D(GLenum target, GLint level, GLint xoffset, GLint x, GLint y, GLsizei width)
-{
- d_1_1_Core->f.CopyTexSubImage1D(target, level, xoffset, x, y, width);
-}
-
-inline void QOpenGLFunctions_3_1::glCopyTexImage2D(GLenum target, GLint level, GLenum internalformat, GLint x, GLint y, GLsizei width, GLsizei height, GLint border)
-{
- d_1_1_Core->f.CopyTexImage2D(target, level, internalformat, x, y, width, height, border);
-}
-
-inline void QOpenGLFunctions_3_1::glCopyTexImage1D(GLenum target, GLint level, GLenum internalformat, GLint x, GLint y, GLsizei width, GLint border)
-{
- d_1_1_Core->f.CopyTexImage1D(target, level, internalformat, x, y, width, border);
-}
-
-inline void QOpenGLFunctions_3_1::glPolygonOffset(GLfloat factor, GLfloat units)
-{
- d_1_1_Core->f.PolygonOffset(factor, units);
-}
-
-inline void QOpenGLFunctions_3_1::glGetPointerv(GLenum pname, GLvoid* *params)
-{
- Q_UNUSED(pname);
- Q_UNUSED(params);
- QOPENGL_DEPRECATEDFUNCTION;
-}
-
-inline void QOpenGLFunctions_3_1::glDrawElements(GLenum mode, GLsizei count, GLenum type, const GLvoid *indices)
-{
- d_1_1_Core->f.DrawElements(mode, count, type, indices);
-}
-
-inline void QOpenGLFunctions_3_1::glDrawArrays(GLenum mode, GLint first, GLsizei count)
-{
- d_1_1_Core->f.DrawArrays(mode, first, count);
-}
-
-
-// OpenGL 1.2 core functions
-inline void QOpenGLFunctions_3_1::glCopyTexSubImage3D(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLint x, GLint y, GLsizei width, GLsizei height)
-{
- d_1_2_Core->f.CopyTexSubImage3D(target, level, xoffset, yoffset, zoffset, x, y, width, height);
-}
-
-inline void QOpenGLFunctions_3_1::glTexSubImage3D(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLenum type, const GLvoid *pixels)
-{
- d_1_2_Core->f.TexSubImage3D(target, level, xoffset, yoffset, zoffset, width, height, depth, format, type, pixels);
-}
-
-inline void QOpenGLFunctions_3_1::glTexImage3D(GLenum target, GLint level, GLint internalformat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLenum format, GLenum type, const GLvoid *pixels)
-{
- d_1_2_Core->f.TexImage3D(target, level, internalformat, width, height, depth, border, format, type, pixels);
-}
-
-inline void QOpenGLFunctions_3_1::glDrawRangeElements(GLenum mode, GLuint start, GLuint end, GLsizei count, GLenum type, const GLvoid *indices)
-{
- d_1_2_Core->f.DrawRangeElements(mode, start, end, count, type, indices);
-}
-
-inline void QOpenGLFunctions_3_1::glBlendEquation(GLenum mode)
-{
- d_1_2_Core->f.BlendEquation(mode);
-}
-
-inline void QOpenGLFunctions_3_1::glBlendColor(GLfloat red, GLfloat green, GLfloat blue, GLfloat alpha)
-{
- d_1_2_Core->f.BlendColor(red, green, blue, alpha);
-}
-
-
-// OpenGL 1.3 core functions
-inline void QOpenGLFunctions_3_1::glGetCompressedTexImage(GLenum target, GLint level, GLvoid *img)
-{
- d_1_3_Core->f.GetCompressedTexImage(target, level, img);
-}
-
-inline void QOpenGLFunctions_3_1::glCompressedTexSubImage1D(GLenum target, GLint level, GLint xoffset, GLsizei width, GLenum format, GLsizei imageSize, const GLvoid *data)
-{
- d_1_3_Core->f.CompressedTexSubImage1D(target, level, xoffset, width, format, imageSize, data);
-}
-
-inline void QOpenGLFunctions_3_1::glCompressedTexSubImage2D(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLsizei imageSize, const GLvoid *data)
-{
- d_1_3_Core->f.CompressedTexSubImage2D(target, level, xoffset, yoffset, width, height, format, imageSize, data);
-}
-
-inline void QOpenGLFunctions_3_1::glCompressedTexSubImage3D(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLsizei imageSize, const GLvoid *data)
-{
- d_1_3_Core->f.CompressedTexSubImage3D(target, level, xoffset, yoffset, zoffset, width, height, depth, format, imageSize, data);
-}
-
-inline void QOpenGLFunctions_3_1::glCompressedTexImage1D(GLenum target, GLint level, GLenum internalformat, GLsizei width, GLint border, GLsizei imageSize, const GLvoid *data)
-{
- d_1_3_Core->f.CompressedTexImage1D(target, level, internalformat, width, border, imageSize, data);
-}
-
-inline void QOpenGLFunctions_3_1::glCompressedTexImage2D(GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLint border, GLsizei imageSize, const GLvoid *data)
-{
- d_1_3_Core->f.CompressedTexImage2D(target, level, internalformat, width, height, border, imageSize, data);
-}
-
-inline void QOpenGLFunctions_3_1::glCompressedTexImage3D(GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLsizei imageSize, const GLvoid *data)
-{
- d_1_3_Core->f.CompressedTexImage3D(target, level, internalformat, width, height, depth, border, imageSize, data);
-}
-
-inline void QOpenGLFunctions_3_1::glSampleCoverage(GLfloat value, GLboolean invert)
-{
- d_1_3_Core->f.SampleCoverage(value, invert);
-}
-
-inline void QOpenGLFunctions_3_1::glActiveTexture(GLenum texture)
-{
- d_1_3_Core->f.ActiveTexture(texture);
-}
-
-
-// OpenGL 1.4 core functions
-inline void QOpenGLFunctions_3_1::glPointParameteriv(GLenum pname, const GLint *params)
-{
- d_1_4_Core->f.PointParameteriv(pname, params);
-}
-
-inline void QOpenGLFunctions_3_1::glPointParameteri(GLenum pname, GLint param)
-{
- d_1_4_Core->f.PointParameteri(pname, param);
-}
-
-inline void QOpenGLFunctions_3_1::glPointParameterfv(GLenum pname, const GLfloat *params)
-{
- d_1_4_Core->f.PointParameterfv(pname, params);
-}
-
-inline void QOpenGLFunctions_3_1::glPointParameterf(GLenum pname, GLfloat param)
-{
- d_1_4_Core->f.PointParameterf(pname, param);
-}
-
-inline void QOpenGLFunctions_3_1::glMultiDrawElements(GLenum mode, const GLsizei *count, GLenum type, const GLvoid* const *indices, GLsizei drawcount)
-{
- d_1_4_Core->f.MultiDrawElements(mode, count, type, indices, drawcount);
-}
-
-inline void QOpenGLFunctions_3_1::glMultiDrawArrays(GLenum mode, const GLint *first, const GLsizei *count, GLsizei drawcount)
-{
- d_1_4_Core->f.MultiDrawArrays(mode, first, count, drawcount);
-}
-
-inline void QOpenGLFunctions_3_1::glBlendFuncSeparate(GLenum sfactorRGB, GLenum dfactorRGB, GLenum sfactorAlpha, GLenum dfactorAlpha)
-{
- d_1_4_Core->f.BlendFuncSeparate(sfactorRGB, dfactorRGB, sfactorAlpha, dfactorAlpha);
-}
-
-
-// OpenGL 1.5 core functions
-inline void QOpenGLFunctions_3_1::glGetBufferPointerv(GLenum target, GLenum pname, GLvoid* *params)
-{
- d_1_5_Core->f.GetBufferPointerv(target, pname, params);
-}
-
-inline void QOpenGLFunctions_3_1::glGetBufferParameteriv(GLenum target, GLenum pname, GLint *params)
-{
- d_1_5_Core->f.GetBufferParameteriv(target, pname, params);
-}
-
-inline GLboolean QOpenGLFunctions_3_1::glUnmapBuffer(GLenum target)
-{
- return d_1_5_Core->f.UnmapBuffer(target);
-}
-
-inline GLvoid* QOpenGLFunctions_3_1::glMapBuffer(GLenum target, GLenum access)
-{
- return d_1_5_Core->f.MapBuffer(target, access);
-}
-
-inline void QOpenGLFunctions_3_1::glGetBufferSubData(GLenum target, GLintptr offset, GLsizeiptr size, GLvoid *data)
-{
- d_1_5_Core->f.GetBufferSubData(target, offset, size, data);
-}
-
-inline void QOpenGLFunctions_3_1::glBufferSubData(GLenum target, GLintptr offset, GLsizeiptr size, const GLvoid *data)
-{
- d_1_5_Core->f.BufferSubData(target, offset, size, data);
-}
-
-inline void QOpenGLFunctions_3_1::glBufferData(GLenum target, GLsizeiptr size, const GLvoid *data, GLenum usage)
-{
- d_1_5_Core->f.BufferData(target, size, data, usage);
-}
-
-inline GLboolean QOpenGLFunctions_3_1::glIsBuffer(GLuint buffer)
-{
- return d_1_5_Core->f.IsBuffer(buffer);
-}
-
-inline void QOpenGLFunctions_3_1::glGenBuffers(GLsizei n, GLuint *buffers)
-{
- d_1_5_Core->f.GenBuffers(n, buffers);
-}
-
-inline void QOpenGLFunctions_3_1::glDeleteBuffers(GLsizei n, const GLuint *buffers)
-{
- d_1_5_Core->f.DeleteBuffers(n, buffers);
-}
-
-inline void QOpenGLFunctions_3_1::glBindBuffer(GLenum target, GLuint buffer)
-{
- d_1_5_Core->f.BindBuffer(target, buffer);
-}
-
-inline void QOpenGLFunctions_3_1::glGetQueryObjectuiv(GLuint id, GLenum pname, GLuint *params)
-{
- d_1_5_Core->f.GetQueryObjectuiv(id, pname, params);
-}
-
-inline void QOpenGLFunctions_3_1::glGetQueryObjectiv(GLuint id, GLenum pname, GLint *params)
-{
- d_1_5_Core->f.GetQueryObjectiv(id, pname, params);
-}
-
-inline void QOpenGLFunctions_3_1::glGetQueryiv(GLenum target, GLenum pname, GLint *params)
-{
- d_1_5_Core->f.GetQueryiv(target, pname, params);
-}
-
-inline void QOpenGLFunctions_3_1::glEndQuery(GLenum target)
-{
- d_1_5_Core->f.EndQuery(target);
-}
-
-inline void QOpenGLFunctions_3_1::glBeginQuery(GLenum target, GLuint id)
-{
- d_1_5_Core->f.BeginQuery(target, id);
-}
-
-inline GLboolean QOpenGLFunctions_3_1::glIsQuery(GLuint id)
-{
- return d_1_5_Core->f.IsQuery(id);
-}
-
-inline void QOpenGLFunctions_3_1::glDeleteQueries(GLsizei n, const GLuint *ids)
-{
- d_1_5_Core->f.DeleteQueries(n, ids);
-}
-
-inline void QOpenGLFunctions_3_1::glGenQueries(GLsizei n, GLuint *ids)
-{
- d_1_5_Core->f.GenQueries(n, ids);
-}
-
-
-// OpenGL 2.0 core functions
-inline void QOpenGLFunctions_3_1::glVertexAttribPointer(GLuint index, GLint size, GLenum type, GLboolean normalized, GLsizei stride, const GLvoid *pointer)
-{
- d_2_0_Core->f.VertexAttribPointer(index, size, type, normalized, stride, pointer);
-}
-
-inline void QOpenGLFunctions_3_1::glValidateProgram(GLuint program)
-{
- d_2_0_Core->f.ValidateProgram(program);
-}
-
-inline void QOpenGLFunctions_3_1::glUniformMatrix4fv(GLint location, GLsizei count, GLboolean transpose, const GLfloat *value)
-{
- d_2_0_Core->f.UniformMatrix4fv(location, count, transpose, value);
-}
-
-inline void QOpenGLFunctions_3_1::glUniformMatrix3fv(GLint location, GLsizei count, GLboolean transpose, const GLfloat *value)
-{
- d_2_0_Core->f.UniformMatrix3fv(location, count, transpose, value);
-}
-
-inline void QOpenGLFunctions_3_1::glUniformMatrix2fv(GLint location, GLsizei count, GLboolean transpose, const GLfloat *value)
-{
- d_2_0_Core->f.UniformMatrix2fv(location, count, transpose, value);
-}
-
-inline void QOpenGLFunctions_3_1::glUniform4iv(GLint location, GLsizei count, const GLint *value)
-{
- d_2_0_Core->f.Uniform4iv(location, count, value);
-}
-
-inline void QOpenGLFunctions_3_1::glUniform3iv(GLint location, GLsizei count, const GLint *value)
-{
- d_2_0_Core->f.Uniform3iv(location, count, value);
-}
-
-inline void QOpenGLFunctions_3_1::glUniform2iv(GLint location, GLsizei count, const GLint *value)
-{
- d_2_0_Core->f.Uniform2iv(location, count, value);
-}
-
-inline void QOpenGLFunctions_3_1::glUniform1iv(GLint location, GLsizei count, const GLint *value)
-{
- d_2_0_Core->f.Uniform1iv(location, count, value);
-}
-
-inline void QOpenGLFunctions_3_1::glUniform4fv(GLint location, GLsizei count, const GLfloat *value)
-{
- d_2_0_Core->f.Uniform4fv(location, count, value);
-}
-
-inline void QOpenGLFunctions_3_1::glUniform3fv(GLint location, GLsizei count, const GLfloat *value)
-{
- d_2_0_Core->f.Uniform3fv(location, count, value);
-}
-
-inline void QOpenGLFunctions_3_1::glUniform2fv(GLint location, GLsizei count, const GLfloat *value)
-{
- d_2_0_Core->f.Uniform2fv(location, count, value);
-}
-
-inline void QOpenGLFunctions_3_1::glUniform1fv(GLint location, GLsizei count, const GLfloat *value)
-{
- d_2_0_Core->f.Uniform1fv(location, count, value);
-}
-
-inline void QOpenGLFunctions_3_1::glUniform4i(GLint location, GLint v0, GLint v1, GLint v2, GLint v3)
-{
- d_2_0_Core->f.Uniform4i(location, v0, v1, v2, v3);
-}
-
-inline void QOpenGLFunctions_3_1::glUniform3i(GLint location, GLint v0, GLint v1, GLint v2)
-{
- d_2_0_Core->f.Uniform3i(location, v0, v1, v2);
-}
-
-inline void QOpenGLFunctions_3_1::glUniform2i(GLint location, GLint v0, GLint v1)
-{
- d_2_0_Core->f.Uniform2i(location, v0, v1);
-}
-
-inline void QOpenGLFunctions_3_1::glUniform1i(GLint location, GLint v0)
-{
- d_2_0_Core->f.Uniform1i(location, v0);
-}
-
-inline void QOpenGLFunctions_3_1::glUniform4f(GLint location, GLfloat v0, GLfloat v1, GLfloat v2, GLfloat v3)
-{
- d_2_0_Core->f.Uniform4f(location, v0, v1, v2, v3);
-}
-
-inline void QOpenGLFunctions_3_1::glUniform3f(GLint location, GLfloat v0, GLfloat v1, GLfloat v2)
-{
- d_2_0_Core->f.Uniform3f(location, v0, v1, v2);
-}
-
-inline void QOpenGLFunctions_3_1::glUniform2f(GLint location, GLfloat v0, GLfloat v1)
-{
- d_2_0_Core->f.Uniform2f(location, v0, v1);
-}
-
-inline void QOpenGLFunctions_3_1::glUniform1f(GLint location, GLfloat v0)
-{
- d_2_0_Core->f.Uniform1f(location, v0);
-}
-
-inline void QOpenGLFunctions_3_1::glUseProgram(GLuint program)
-{
- d_2_0_Core->f.UseProgram(program);
-}
-
-inline void QOpenGLFunctions_3_1::glShaderSource(GLuint shader, GLsizei count, const GLchar* const *string, const GLint *length)
-{
- d_2_0_Core->f.ShaderSource(shader, count, string, length);
-}
-
-inline void QOpenGLFunctions_3_1::glLinkProgram(GLuint program)
-{
- d_2_0_Core->f.LinkProgram(program);
-}
-
-inline GLboolean QOpenGLFunctions_3_1::glIsShader(GLuint shader)
-{
- return d_2_0_Core->f.IsShader(shader);
-}
-
-inline GLboolean QOpenGLFunctions_3_1::glIsProgram(GLuint program)
-{
- return d_2_0_Core->f.IsProgram(program);
-}
-
-inline void QOpenGLFunctions_3_1::glGetVertexAttribPointerv(GLuint index, GLenum pname, GLvoid* *pointer)
-{
- d_2_0_Core->f.GetVertexAttribPointerv(index, pname, pointer);
-}
-
-inline void QOpenGLFunctions_3_1::glGetVertexAttribiv(GLuint index, GLenum pname, GLint *params)
-{
- d_2_0_Core->f.GetVertexAttribiv(index, pname, params);
-}
-
-inline void QOpenGLFunctions_3_1::glGetVertexAttribfv(GLuint index, GLenum pname, GLfloat *params)
-{
- d_2_0_Core->f.GetVertexAttribfv(index, pname, params);
-}
-
-inline void QOpenGLFunctions_3_1::glGetVertexAttribdv(GLuint index, GLenum pname, GLdouble *params)
-{
- d_2_0_Core->f.GetVertexAttribdv(index, pname, params);
-}
-
-inline void QOpenGLFunctions_3_1::glGetUniformiv(GLuint program, GLint location, GLint *params)
-{
- d_2_0_Core->f.GetUniformiv(program, location, params);
-}
-
-inline void QOpenGLFunctions_3_1::glGetUniformfv(GLuint program, GLint location, GLfloat *params)
-{
- d_2_0_Core->f.GetUniformfv(program, location, params);
-}
-
-inline GLint QOpenGLFunctions_3_1::glGetUniformLocation(GLuint program, const GLchar *name)
-{
- return d_2_0_Core->f.GetUniformLocation(program, name);
-}
-
-inline void QOpenGLFunctions_3_1::glGetShaderSource(GLuint shader, GLsizei bufSize, GLsizei *length, GLchar *source)
-{
- d_2_0_Core->f.GetShaderSource(shader, bufSize, length, source);
-}
-
-inline void QOpenGLFunctions_3_1::glGetShaderInfoLog(GLuint shader, GLsizei bufSize, GLsizei *length, GLchar *infoLog)
-{
- d_2_0_Core->f.GetShaderInfoLog(shader, bufSize, length, infoLog);
-}
-
-inline void QOpenGLFunctions_3_1::glGetShaderiv(GLuint shader, GLenum pname, GLint *params)
-{
- d_2_0_Core->f.GetShaderiv(shader, pname, params);
-}
-
-inline void QOpenGLFunctions_3_1::glGetProgramInfoLog(GLuint program, GLsizei bufSize, GLsizei *length, GLchar *infoLog)
-{
- d_2_0_Core->f.GetProgramInfoLog(program, bufSize, length, infoLog);
-}
-
-inline void QOpenGLFunctions_3_1::glGetProgramiv(GLuint program, GLenum pname, GLint *params)
-{
- d_2_0_Core->f.GetProgramiv(program, pname, params);
-}
-
-inline GLint QOpenGLFunctions_3_1::glGetAttribLocation(GLuint program, const GLchar *name)
-{
- return d_2_0_Core->f.GetAttribLocation(program, name);
-}
-
-inline void QOpenGLFunctions_3_1::glGetAttachedShaders(GLuint program, GLsizei maxCount, GLsizei *count, GLuint *obj)
-{
- d_2_0_Core->f.GetAttachedShaders(program, maxCount, count, obj);
-}
-
-inline void QOpenGLFunctions_3_1::glGetActiveUniform(GLuint program, GLuint index, GLsizei bufSize, GLsizei *length, GLint *size, GLenum *type, GLchar *name)
-{
- d_2_0_Core->f.GetActiveUniform(program, index, bufSize, length, size, type, name);
-}
-
-inline void QOpenGLFunctions_3_1::glGetActiveAttrib(GLuint program, GLuint index, GLsizei bufSize, GLsizei *length, GLint *size, GLenum *type, GLchar *name)
-{
- d_2_0_Core->f.GetActiveAttrib(program, index, bufSize, length, size, type, name);
-}
-
-inline void QOpenGLFunctions_3_1::glEnableVertexAttribArray(GLuint index)
-{
- d_2_0_Core->f.EnableVertexAttribArray(index);
-}
-
-inline void QOpenGLFunctions_3_1::glDisableVertexAttribArray(GLuint index)
-{
- d_2_0_Core->f.DisableVertexAttribArray(index);
-}
-
-inline void QOpenGLFunctions_3_1::glDetachShader(GLuint program, GLuint shader)
-{
- d_2_0_Core->f.DetachShader(program, shader);
-}
-
-inline void QOpenGLFunctions_3_1::glDeleteShader(GLuint shader)
-{
- d_2_0_Core->f.DeleteShader(shader);
-}
-
-inline void QOpenGLFunctions_3_1::glDeleteProgram(GLuint program)
-{
- d_2_0_Core->f.DeleteProgram(program);
-}
-
-inline GLuint QOpenGLFunctions_3_1::glCreateShader(GLenum type)
-{
- return d_2_0_Core->f.CreateShader(type);
-}
-
-inline GLuint QOpenGLFunctions_3_1::glCreateProgram()
-{
- return d_2_0_Core->f.CreateProgram();
-}
-
-inline void QOpenGLFunctions_3_1::glCompileShader(GLuint shader)
-{
- d_2_0_Core->f.CompileShader(shader);
-}
-
-inline void QOpenGLFunctions_3_1::glBindAttribLocation(GLuint program, GLuint index, const GLchar *name)
-{
- d_2_0_Core->f.BindAttribLocation(program, index, name);
-}
-
-inline void QOpenGLFunctions_3_1::glAttachShader(GLuint program, GLuint shader)
-{
- d_2_0_Core->f.AttachShader(program, shader);
-}
-
-inline void QOpenGLFunctions_3_1::glStencilMaskSeparate(GLenum face, GLuint mask)
-{
- d_2_0_Core->f.StencilMaskSeparate(face, mask);
-}
-
-inline void QOpenGLFunctions_3_1::glStencilFuncSeparate(GLenum face, GLenum func, GLint ref, GLuint mask)
-{
- d_2_0_Core->f.StencilFuncSeparate(face, func, ref, mask);
-}
-
-inline void QOpenGLFunctions_3_1::glStencilOpSeparate(GLenum face, GLenum sfail, GLenum dpfail, GLenum dppass)
-{
- d_2_0_Core->f.StencilOpSeparate(face, sfail, dpfail, dppass);
-}
-
-inline void QOpenGLFunctions_3_1::glDrawBuffers(GLsizei n, const GLenum *bufs)
-{
- d_2_0_Core->f.DrawBuffers(n, bufs);
-}
-
-inline void QOpenGLFunctions_3_1::glBlendEquationSeparate(GLenum modeRGB, GLenum modeAlpha)
-{
- d_2_0_Core->f.BlendEquationSeparate(modeRGB, modeAlpha);
-}
-
-
-// OpenGL 2.1 core functions
-inline void QOpenGLFunctions_3_1::glUniformMatrix4x3fv(GLint location, GLsizei count, GLboolean transpose, const GLfloat *value)
-{
- d_2_1_Core->f.UniformMatrix4x3fv(location, count, transpose, value);
-}
-
-inline void QOpenGLFunctions_3_1::glUniformMatrix3x4fv(GLint location, GLsizei count, GLboolean transpose, const GLfloat *value)
-{
- d_2_1_Core->f.UniformMatrix3x4fv(location, count, transpose, value);
-}
-
-inline void QOpenGLFunctions_3_1::glUniformMatrix4x2fv(GLint location, GLsizei count, GLboolean transpose, const GLfloat *value)
-{
- d_2_1_Core->f.UniformMatrix4x2fv(location, count, transpose, value);
-}
-
-inline void QOpenGLFunctions_3_1::glUniformMatrix2x4fv(GLint location, GLsizei count, GLboolean transpose, const GLfloat *value)
-{
- d_2_1_Core->f.UniformMatrix2x4fv(location, count, transpose, value);
-}
-
-inline void QOpenGLFunctions_3_1::glUniformMatrix3x2fv(GLint location, GLsizei count, GLboolean transpose, const GLfloat *value)
-{
- d_2_1_Core->f.UniformMatrix3x2fv(location, count, transpose, value);
-}
-
-inline void QOpenGLFunctions_3_1::glUniformMatrix2x3fv(GLint location, GLsizei count, GLboolean transpose, const GLfloat *value)
-{
- d_2_1_Core->f.UniformMatrix2x3fv(location, count, transpose, value);
-}
-
-
-// OpenGL 3.0 core functions
-inline GLboolean QOpenGLFunctions_3_1::glIsVertexArray(GLuint array)
-{
- return d_3_0_Core->f.IsVertexArray(array);
-}
-
-inline void QOpenGLFunctions_3_1::glGenVertexArrays(GLsizei n, GLuint *arrays)
-{
- d_3_0_Core->f.GenVertexArrays(n, arrays);
-}
-
-inline void QOpenGLFunctions_3_1::glDeleteVertexArrays(GLsizei n, const GLuint *arrays)
-{
- d_3_0_Core->f.DeleteVertexArrays(n, arrays);
-}
-
-inline void QOpenGLFunctions_3_1::glBindVertexArray(GLuint array)
-{
- d_3_0_Core->f.BindVertexArray(array);
-}
-
-inline void QOpenGLFunctions_3_1::glFlushMappedBufferRange(GLenum target, GLintptr offset, GLsizeiptr length)
-{
- d_3_0_Core->f.FlushMappedBufferRange(target, offset, length);
-}
-
-inline GLvoid* QOpenGLFunctions_3_1::glMapBufferRange(GLenum target, GLintptr offset, GLsizeiptr length, GLbitfield access)
-{
- return d_3_0_Core->f.MapBufferRange(target, offset, length, access);
-}
-
-inline void QOpenGLFunctions_3_1::glFramebufferTextureLayer(GLenum target, GLenum attachment, GLuint texture, GLint level, GLint layer)
-{
- d_3_0_Core->f.FramebufferTextureLayer(target, attachment, texture, level, layer);
-}
-
-inline void QOpenGLFunctions_3_1::glRenderbufferStorageMultisample(GLenum target, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height)
-{
- d_3_0_Core->f.RenderbufferStorageMultisample(target, samples, internalformat, width, height);
-}
-
-inline void QOpenGLFunctions_3_1::glBlitFramebuffer(GLint srcX0, GLint srcY0, GLint srcX1, GLint srcY1, GLint dstX0, GLint dstY0, GLint dstX1, GLint dstY1, GLbitfield mask, GLenum filter)
-{
- d_3_0_Core->f.BlitFramebuffer(srcX0, srcY0, srcX1, srcY1, dstX0, dstY0, dstX1, dstY1, mask, filter);
-}
-
-inline void QOpenGLFunctions_3_1::glGenerateMipmap(GLenum target)
-{
- d_3_0_Core->f.GenerateMipmap(target);
-}
-
-inline void QOpenGLFunctions_3_1::glGetFramebufferAttachmentParameteriv(GLenum target, GLenum attachment, GLenum pname, GLint *params)
-{
- d_3_0_Core->f.GetFramebufferAttachmentParameteriv(target, attachment, pname, params);
-}
-
-inline void QOpenGLFunctions_3_1::glFramebufferRenderbuffer(GLenum target, GLenum attachment, GLenum renderbuffertarget, GLuint renderbuffer)
-{
- d_3_0_Core->f.FramebufferRenderbuffer(target, attachment, renderbuffertarget, renderbuffer);
-}
-
-inline void QOpenGLFunctions_3_1::glFramebufferTexture3D(GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level, GLint zoffset)
-{
- d_3_0_Core->f.FramebufferTexture3D(target, attachment, textarget, texture, level, zoffset);
-}
-
-inline void QOpenGLFunctions_3_1::glFramebufferTexture2D(GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level)
-{
- d_3_0_Core->f.FramebufferTexture2D(target, attachment, textarget, texture, level);
-}
-
-inline void QOpenGLFunctions_3_1::glFramebufferTexture1D(GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level)
-{
- d_3_0_Core->f.FramebufferTexture1D(target, attachment, textarget, texture, level);
-}
-
-inline GLenum QOpenGLFunctions_3_1::glCheckFramebufferStatus(GLenum target)
-{
- return d_3_0_Core->f.CheckFramebufferStatus(target);
-}
-
-inline void QOpenGLFunctions_3_1::glGenFramebuffers(GLsizei n, GLuint *framebuffers)
-{
- d_3_0_Core->f.GenFramebuffers(n, framebuffers);
-}
-
-inline void QOpenGLFunctions_3_1::glDeleteFramebuffers(GLsizei n, const GLuint *framebuffers)
-{
- d_3_0_Core->f.DeleteFramebuffers(n, framebuffers);
-}
-
-inline void QOpenGLFunctions_3_1::glBindFramebuffer(GLenum target, GLuint framebuffer)
-{
- d_3_0_Core->f.BindFramebuffer(target, framebuffer);
-}
-
-inline GLboolean QOpenGLFunctions_3_1::glIsFramebuffer(GLuint framebuffer)
-{
- return d_3_0_Core->f.IsFramebuffer(framebuffer);
-}
-
-inline void QOpenGLFunctions_3_1::glGetRenderbufferParameteriv(GLenum target, GLenum pname, GLint *params)
-{
- d_3_0_Core->f.GetRenderbufferParameteriv(target, pname, params);
-}
-
-inline void QOpenGLFunctions_3_1::glRenderbufferStorage(GLenum target, GLenum internalformat, GLsizei width, GLsizei height)
-{
- d_3_0_Core->f.RenderbufferStorage(target, internalformat, width, height);
-}
-
-inline void QOpenGLFunctions_3_1::glGenRenderbuffers(GLsizei n, GLuint *renderbuffers)
-{
- d_3_0_Core->f.GenRenderbuffers(n, renderbuffers);
-}
-
-inline void QOpenGLFunctions_3_1::glDeleteRenderbuffers(GLsizei n, const GLuint *renderbuffers)
-{
- d_3_0_Core->f.DeleteRenderbuffers(n, renderbuffers);
-}
-
-inline void QOpenGLFunctions_3_1::glBindRenderbuffer(GLenum target, GLuint renderbuffer)
-{
- d_3_0_Core->f.BindRenderbuffer(target, renderbuffer);
-}
-
-inline GLboolean QOpenGLFunctions_3_1::glIsRenderbuffer(GLuint renderbuffer)
-{
- return d_3_0_Core->f.IsRenderbuffer(renderbuffer);
-}
-
-inline const GLubyte * QOpenGLFunctions_3_1::glGetStringi(GLenum name, GLuint index)
-{
- return d_3_0_Core->f.GetStringi(name, index);
-}
-
-inline void QOpenGLFunctions_3_1::glClearBufferfi(GLenum buffer, GLint drawbuffer, GLfloat depth, GLint stencil)
-{
- d_3_0_Core->f.ClearBufferfi(buffer, drawbuffer, depth, stencil);
-}
-
-inline void QOpenGLFunctions_3_1::glClearBufferfv(GLenum buffer, GLint drawbuffer, const GLfloat *value)
-{
- d_3_0_Core->f.ClearBufferfv(buffer, drawbuffer, value);
-}
-
-inline void QOpenGLFunctions_3_1::glClearBufferuiv(GLenum buffer, GLint drawbuffer, const GLuint *value)
-{
- d_3_0_Core->f.ClearBufferuiv(buffer, drawbuffer, value);
-}
-
-inline void QOpenGLFunctions_3_1::glClearBufferiv(GLenum buffer, GLint drawbuffer, const GLint *value)
-{
- d_3_0_Core->f.ClearBufferiv(buffer, drawbuffer, value);
-}
-
-inline void QOpenGLFunctions_3_1::glGetTexParameterIuiv(GLenum target, GLenum pname, GLuint *params)
-{
- d_3_0_Core->f.GetTexParameterIuiv(target, pname, params);
-}
-
-inline void QOpenGLFunctions_3_1::glGetTexParameterIiv(GLenum target, GLenum pname, GLint *params)
-{
- d_3_0_Core->f.GetTexParameterIiv(target, pname, params);
-}
-
-inline void QOpenGLFunctions_3_1::glTexParameterIuiv(GLenum target, GLenum pname, const GLuint *params)
-{
- d_3_0_Core->f.TexParameterIuiv(target, pname, params);
-}
-
-inline void QOpenGLFunctions_3_1::glTexParameterIiv(GLenum target, GLenum pname, const GLint *params)
-{
- d_3_0_Core->f.TexParameterIiv(target, pname, params);
-}
-
-inline void QOpenGLFunctions_3_1::glUniform4uiv(GLint location, GLsizei count, const GLuint *value)
-{
- d_3_0_Core->f.Uniform4uiv(location, count, value);
-}
-
-inline void QOpenGLFunctions_3_1::glUniform3uiv(GLint location, GLsizei count, const GLuint *value)
-{
- d_3_0_Core->f.Uniform3uiv(location, count, value);
-}
-
-inline void QOpenGLFunctions_3_1::glUniform2uiv(GLint location, GLsizei count, const GLuint *value)
-{
- d_3_0_Core->f.Uniform2uiv(location, count, value);
-}
-
-inline void QOpenGLFunctions_3_1::glUniform1uiv(GLint location, GLsizei count, const GLuint *value)
-{
- d_3_0_Core->f.Uniform1uiv(location, count, value);
-}
-
-inline void QOpenGLFunctions_3_1::glUniform4ui(GLint location, GLuint v0, GLuint v1, GLuint v2, GLuint v3)
-{
- d_3_0_Core->f.Uniform4ui(location, v0, v1, v2, v3);
-}
-
-inline void QOpenGLFunctions_3_1::glUniform3ui(GLint location, GLuint v0, GLuint v1, GLuint v2)
-{
- d_3_0_Core->f.Uniform3ui(location, v0, v1, v2);
-}
-
-inline void QOpenGLFunctions_3_1::glUniform2ui(GLint location, GLuint v0, GLuint v1)
-{
- d_3_0_Core->f.Uniform2ui(location, v0, v1);
-}
-
-inline void QOpenGLFunctions_3_1::glUniform1ui(GLint location, GLuint v0)
-{
- d_3_0_Core->f.Uniform1ui(location, v0);
-}
-
-inline GLint QOpenGLFunctions_3_1::glGetFragDataLocation(GLuint program, const GLchar *name)
-{
- return d_3_0_Core->f.GetFragDataLocation(program, name);
-}
-
-inline void QOpenGLFunctions_3_1::glBindFragDataLocation(GLuint program, GLuint color, const GLchar *name)
-{
- d_3_0_Core->f.BindFragDataLocation(program, color, name);
-}
-
-inline void QOpenGLFunctions_3_1::glGetUniformuiv(GLuint program, GLint location, GLuint *params)
-{
- d_3_0_Core->f.GetUniformuiv(program, location, params);
-}
-
-inline void QOpenGLFunctions_3_1::glGetVertexAttribIuiv(GLuint index, GLenum pname, GLuint *params)
-{
- d_3_0_Core->f.GetVertexAttribIuiv(index, pname, params);
-}
-
-inline void QOpenGLFunctions_3_1::glGetVertexAttribIiv(GLuint index, GLenum pname, GLint *params)
-{
- d_3_0_Core->f.GetVertexAttribIiv(index, pname, params);
-}
-
-inline void QOpenGLFunctions_3_1::glVertexAttribIPointer(GLuint index, GLint size, GLenum type, GLsizei stride, const GLvoid *pointer)
-{
- d_3_0_Core->f.VertexAttribIPointer(index, size, type, stride, pointer);
-}
-
-inline void QOpenGLFunctions_3_1::glEndConditionalRender()
-{
- d_3_0_Core->f.EndConditionalRender();
-}
-
-inline void QOpenGLFunctions_3_1::glBeginConditionalRender(GLuint id, GLenum mode)
-{
- d_3_0_Core->f.BeginConditionalRender(id, mode);
-}
-
-inline void QOpenGLFunctions_3_1::glClampColor(GLenum target, GLenum clamp)
-{
- d_3_0_Core->f.ClampColor(target, clamp);
-}
-
-inline void QOpenGLFunctions_3_1::glGetTransformFeedbackVarying(GLuint program, GLuint index, GLsizei bufSize, GLsizei *length, GLsizei *size, GLenum *type, GLchar *name)
-{
- d_3_0_Core->f.GetTransformFeedbackVarying(program, index, bufSize, length, size, type, name);
-}
-
-inline void QOpenGLFunctions_3_1::glTransformFeedbackVaryings(GLuint program, GLsizei count, const GLchar* const *varyings, GLenum bufferMode)
-{
- d_3_0_Core->f.TransformFeedbackVaryings(program, count, varyings, bufferMode);
-}
-
-inline void QOpenGLFunctions_3_1::glBindBufferBase(GLenum target, GLuint index, GLuint buffer)
-{
- d_3_0_Core->f.BindBufferBase(target, index, buffer);
-}
-
-inline void QOpenGLFunctions_3_1::glBindBufferRange(GLenum target, GLuint index, GLuint buffer, GLintptr offset, GLsizeiptr size)
-{
- d_3_0_Core->f.BindBufferRange(target, index, buffer, offset, size);
-}
-
-inline void QOpenGLFunctions_3_1::glEndTransformFeedback()
-{
- d_3_0_Core->f.EndTransformFeedback();
-}
-
-inline void QOpenGLFunctions_3_1::glBeginTransformFeedback(GLenum primitiveMode)
-{
- d_3_0_Core->f.BeginTransformFeedback(primitiveMode);
-}
-
-inline GLboolean QOpenGLFunctions_3_1::glIsEnabledi(GLenum target, GLuint index)
-{
- return d_3_0_Core->f.IsEnabledi(target, index);
-}
-
-inline void QOpenGLFunctions_3_1::glDisablei(GLenum target, GLuint index)
-{
- d_3_0_Core->f.Disablei(target, index);
-}
-
-inline void QOpenGLFunctions_3_1::glEnablei(GLenum target, GLuint index)
-{
- d_3_0_Core->f.Enablei(target, index);
-}
-
-inline void QOpenGLFunctions_3_1::glGetIntegeri_v(GLenum target, GLuint index, GLint *data)
-{
- d_3_0_Core->f.GetIntegeri_v(target, index, data);
-}
-
-inline void QOpenGLFunctions_3_1::glGetBooleani_v(GLenum target, GLuint index, GLboolean *data)
-{
- d_3_0_Core->f.GetBooleani_v(target, index, data);
-}
-
-inline void QOpenGLFunctions_3_1::glColorMaski(GLuint index, GLboolean r, GLboolean g, GLboolean b, GLboolean a)
-{
- d_3_0_Core->f.ColorMaski(index, r, g, b, a);
-}
-
-
-// OpenGL 3.1 core functions
-inline void QOpenGLFunctions_3_1::glCopyBufferSubData(GLenum readTarget, GLenum writeTarget, GLintptr readOffset, GLintptr writeOffset, GLsizeiptr size)
-{
- d_3_1_Core->f.CopyBufferSubData(readTarget, writeTarget, readOffset, writeOffset, size);
-}
-
-inline void QOpenGLFunctions_3_1::glUniformBlockBinding(GLuint program, GLuint uniformBlockIndex, GLuint uniformBlockBinding)
-{
- d_3_1_Core->f.UniformBlockBinding(program, uniformBlockIndex, uniformBlockBinding);
-}
-
-inline void QOpenGLFunctions_3_1::glGetActiveUniformBlockName(GLuint program, GLuint uniformBlockIndex, GLsizei bufSize, GLsizei *length, GLchar *uniformBlockName)
-{
- d_3_1_Core->f.GetActiveUniformBlockName(program, uniformBlockIndex, bufSize, length, uniformBlockName);
-}
-
-inline void QOpenGLFunctions_3_1::glGetActiveUniformBlockiv(GLuint program, GLuint uniformBlockIndex, GLenum pname, GLint *params)
-{
- d_3_1_Core->f.GetActiveUniformBlockiv(program, uniformBlockIndex, pname, params);
-}
-
-inline GLuint QOpenGLFunctions_3_1::glGetUniformBlockIndex(GLuint program, const GLchar *uniformBlockName)
-{
- return d_3_1_Core->f.GetUniformBlockIndex(program, uniformBlockName);
-}
-
-inline void QOpenGLFunctions_3_1::glGetActiveUniformName(GLuint program, GLuint uniformIndex, GLsizei bufSize, GLsizei *length, GLchar *uniformName)
-{
- d_3_1_Core->f.GetActiveUniformName(program, uniformIndex, bufSize, length, uniformName);
-}
-
-inline void QOpenGLFunctions_3_1::glGetActiveUniformsiv(GLuint program, GLsizei uniformCount, const GLuint *uniformIndices, GLenum pname, GLint *params)
-{
- d_3_1_Core->f.GetActiveUniformsiv(program, uniformCount, uniformIndices, pname, params);
-}
-
-inline void QOpenGLFunctions_3_1::glGetUniformIndices(GLuint program, GLsizei uniformCount, const GLchar* const *uniformNames, GLuint *uniformIndices)
-{
- d_3_1_Core->f.GetUniformIndices(program, uniformCount, uniformNames, uniformIndices);
-}
-
-inline void QOpenGLFunctions_3_1::glPrimitiveRestartIndex(GLuint index)
-{
- d_3_1_Core->f.PrimitiveRestartIndex(index);
-}
-
-inline void QOpenGLFunctions_3_1::glTexBuffer(GLenum target, GLenum internalformat, GLuint buffer)
-{
- d_3_1_Core->f.TexBuffer(target, internalformat, buffer);
-}
-
-inline void QOpenGLFunctions_3_1::glDrawElementsInstanced(GLenum mode, GLsizei count, GLenum type, const GLvoid *indices, GLsizei instancecount)
-{
- d_3_1_Core->f.DrawElementsInstanced(mode, count, type, indices, instancecount);
-}
-
-inline void QOpenGLFunctions_3_1::glDrawArraysInstanced(GLenum mode, GLint first, GLsizei count, GLsizei instancecount)
-{
- d_3_1_Core->f.DrawArraysInstanced(mode, first, count, instancecount);
-}
-
-
-
-QT_END_NAMESPACE
-
-#endif // QT_NO_OPENGL && !QT_OPENGL_ES_2
-
-#endif
diff --git a/src/gui/opengl/qopenglfunctions_3_2_compatibility.cpp b/src/gui/opengl/qopenglfunctions_3_2_compatibility.cpp
deleted file mode 100644
index 3e4fd96dc2..0000000000
--- a/src/gui/opengl/qopenglfunctions_3_2_compatibility.cpp
+++ /dev/null
@@ -1,265 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2013 Klaralvdalens Datakonsult AB (KDAB)
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the QtGui module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-**
-** This file was generated by glgen version 0.1
-** Command line was: glgen
-**
-** glgen is Copyright (C) 2013 Klaralvdalens Datakonsult AB (KDAB)
-**
-** This is an auto-generated file.
-** Do not edit! All changes made to it will be lost.
-**
-****************************************************************************/
-
-#include "qopenglfunctions_3_2_compatibility.h"
-#include "qopenglcontext.h"
-
-QT_BEGIN_NAMESPACE
-
-/*!
- \class QOpenGLFunctions_3_2_Compatibility
- \inmodule QtGui
- \since 5.1
- \wrapper
- \brief The QOpenGLFunctions_3_2_Compatibility class provides all functions for OpenGL 3.2 compatibility profile.
-
- This class is a wrapper for functions from OpenGL 3.2 compatibility profile.
- See reference pages on \l {http://www.opengl.org/sdk/docs/}{opengl.org}
- for function documentation.
-
- \sa QAbstractOpenGLFunctions
-*/
-
-QOpenGLFunctions_3_2_Compatibility::QOpenGLFunctions_3_2_Compatibility()
- : QAbstractOpenGLFunctions()
- , d_1_0_Core(nullptr)
- , d_1_1_Core(nullptr)
- , d_1_2_Core(nullptr)
- , d_1_3_Core(nullptr)
- , d_1_4_Core(nullptr)
- , d_1_5_Core(nullptr)
- , d_2_0_Core(nullptr)
- , d_2_1_Core(nullptr)
- , d_3_0_Core(nullptr)
- , d_3_1_Core(nullptr)
- , d_3_2_Core(nullptr)
- , d_1_0_Deprecated(nullptr)
- , d_1_1_Deprecated(nullptr)
- , d_1_2_Deprecated(nullptr)
- , d_1_3_Deprecated(nullptr)
- , d_1_4_Deprecated(nullptr)
- , m_reserved_2_0_Deprecated(nullptr)
- , m_reserved_3_0_Deprecated(nullptr)
-{
-}
-
-QOpenGLFunctions_3_2_Compatibility::~QOpenGLFunctions_3_2_Compatibility()
-{
- if (d_1_0_Core) {
- d_1_0_Core->refs.deref();
- Q_ASSERT(d_1_0_Core->refs.loadRelaxed());
- }
- if (d_1_1_Core) {
- d_1_1_Core->refs.deref();
- Q_ASSERT(d_1_1_Core->refs.loadRelaxed());
- }
- if (d_1_2_Core) {
- d_1_2_Core->refs.deref();
- Q_ASSERT(d_1_2_Core->refs.loadRelaxed());
- }
- if (d_1_3_Core) {
- d_1_3_Core->refs.deref();
- Q_ASSERT(d_1_3_Core->refs.loadRelaxed());
- }
- if (d_1_4_Core) {
- d_1_4_Core->refs.deref();
- Q_ASSERT(d_1_4_Core->refs.loadRelaxed());
- }
- if (d_1_5_Core) {
- d_1_5_Core->refs.deref();
- Q_ASSERT(d_1_5_Core->refs.loadRelaxed());
- }
- if (d_2_0_Core) {
- d_2_0_Core->refs.deref();
- Q_ASSERT(d_2_0_Core->refs.loadRelaxed());
- }
- if (d_2_1_Core) {
- d_2_1_Core->refs.deref();
- Q_ASSERT(d_2_1_Core->refs.loadRelaxed());
- }
- if (d_3_0_Core) {
- d_3_0_Core->refs.deref();
- Q_ASSERT(d_3_0_Core->refs.loadRelaxed());
- }
- if (d_3_1_Core) {
- d_3_1_Core->refs.deref();
- Q_ASSERT(d_3_1_Core->refs.loadRelaxed());
- }
- if (d_3_2_Core) {
- d_3_2_Core->refs.deref();
- Q_ASSERT(d_3_2_Core->refs.loadRelaxed());
- }
- if (d_1_0_Deprecated) {
- d_1_0_Deprecated->refs.deref();
- Q_ASSERT(d_1_0_Deprecated->refs.loadRelaxed());
- }
- if (d_1_1_Deprecated) {
- d_1_1_Deprecated->refs.deref();
- Q_ASSERT(d_1_1_Deprecated->refs.loadRelaxed());
- }
- if (d_1_2_Deprecated) {
- d_1_2_Deprecated->refs.deref();
- Q_ASSERT(d_1_2_Deprecated->refs.loadRelaxed());
- }
- if (d_1_3_Deprecated) {
- d_1_3_Deprecated->refs.deref();
- Q_ASSERT(d_1_3_Deprecated->refs.loadRelaxed());
- }
- if (d_1_4_Deprecated) {
- d_1_4_Deprecated->refs.deref();
- Q_ASSERT(d_1_4_Deprecated->refs.loadRelaxed());
- }
-}
-
-bool QOpenGLFunctions_3_2_Compatibility::initializeOpenGLFunctions()
-{
- if ( isInitialized() )
- return true;
-
- QOpenGLContext* context = QOpenGLContext::currentContext();
-
- // If owned by a context object make sure it is current.
- // Also check that current context is capable of resolving all needed functions
- if (((owningContext() && owningContext() == context) || !owningContext())
- && QOpenGLFunctions_3_2_Compatibility::isContextCompatible(context))
- {
- // Associate with private implementation, creating if necessary
- // Function pointers in the backends are resolved at creation time
- QOpenGLVersionFunctionsBackend* d = nullptr;
- d = QAbstractOpenGLFunctionsPrivate::functionsBackend(context, QOpenGLFunctions_1_0_CoreBackend::versionStatus());
- d_1_0_Core = static_cast<QOpenGLFunctions_1_0_CoreBackend*>(d);
- d->refs.ref();
-
- d = QAbstractOpenGLFunctionsPrivate::functionsBackend(context, QOpenGLFunctions_1_1_CoreBackend::versionStatus());
- d_1_1_Core = static_cast<QOpenGLFunctions_1_1_CoreBackend*>(d);
- d->refs.ref();
-
- d = QAbstractOpenGLFunctionsPrivate::functionsBackend(context, QOpenGLFunctions_1_2_CoreBackend::versionStatus());
- d_1_2_Core = static_cast<QOpenGLFunctions_1_2_CoreBackend*>(d);
- d->refs.ref();
-
- d = QAbstractOpenGLFunctionsPrivate::functionsBackend(context, QOpenGLFunctions_1_3_CoreBackend::versionStatus());
- d_1_3_Core = static_cast<QOpenGLFunctions_1_3_CoreBackend*>(d);
- d->refs.ref();
-
- d = QAbstractOpenGLFunctionsPrivate::functionsBackend(context, QOpenGLFunctions_1_4_CoreBackend::versionStatus());
- d_1_4_Core = static_cast<QOpenGLFunctions_1_4_CoreBackend*>(d);
- d->refs.ref();
-
- d = QAbstractOpenGLFunctionsPrivate::functionsBackend(context, QOpenGLFunctions_1_5_CoreBackend::versionStatus());
- d_1_5_Core = static_cast<QOpenGLFunctions_1_5_CoreBackend*>(d);
- d->refs.ref();
-
- d = QAbstractOpenGLFunctionsPrivate::functionsBackend(context, QOpenGLFunctions_2_0_CoreBackend::versionStatus());
- d_2_0_Core = static_cast<QOpenGLFunctions_2_0_CoreBackend*>(d);
- d->refs.ref();
-
- d = QAbstractOpenGLFunctionsPrivate::functionsBackend(context, QOpenGLFunctions_2_1_CoreBackend::versionStatus());
- d_2_1_Core = static_cast<QOpenGLFunctions_2_1_CoreBackend*>(d);
- d->refs.ref();
-
- d = QAbstractOpenGLFunctionsPrivate::functionsBackend(context, QOpenGLFunctions_3_0_CoreBackend::versionStatus());
- d_3_0_Core = static_cast<QOpenGLFunctions_3_0_CoreBackend*>(d);
- d->refs.ref();
-
- d = QAbstractOpenGLFunctionsPrivate::functionsBackend(context, QOpenGLFunctions_3_1_CoreBackend::versionStatus());
- d_3_1_Core = static_cast<QOpenGLFunctions_3_1_CoreBackend*>(d);
- d->refs.ref();
-
- d = QAbstractOpenGLFunctionsPrivate::functionsBackend(context, QOpenGLFunctions_3_2_CoreBackend::versionStatus());
- d_3_2_Core = static_cast<QOpenGLFunctions_3_2_CoreBackend*>(d);
- d->refs.ref();
-
- d = QAbstractOpenGLFunctionsPrivate::functionsBackend(context, QOpenGLFunctions_1_0_DeprecatedBackend::versionStatus());
- d_1_0_Deprecated = static_cast<QOpenGLFunctions_1_0_DeprecatedBackend*>(d);
- d->refs.ref();
-
- d = QAbstractOpenGLFunctionsPrivate::functionsBackend(context, QOpenGLFunctions_1_1_DeprecatedBackend::versionStatus());
- d_1_1_Deprecated = static_cast<QOpenGLFunctions_1_1_DeprecatedBackend*>(d);
- d->refs.ref();
-
- d = QAbstractOpenGLFunctionsPrivate::functionsBackend(context, QOpenGLFunctions_1_2_DeprecatedBackend::versionStatus());
- d_1_2_Deprecated = static_cast<QOpenGLFunctions_1_2_DeprecatedBackend*>(d);
- d->refs.ref();
-
- d = QAbstractOpenGLFunctionsPrivate::functionsBackend(context, QOpenGLFunctions_1_3_DeprecatedBackend::versionStatus());
- d_1_3_Deprecated = static_cast<QOpenGLFunctions_1_3_DeprecatedBackend*>(d);
- d->refs.ref();
-
- d = QAbstractOpenGLFunctionsPrivate::functionsBackend(context, QOpenGLFunctions_1_4_DeprecatedBackend::versionStatus());
- d_1_4_Deprecated = static_cast<QOpenGLFunctions_1_4_DeprecatedBackend*>(d);
- d->refs.ref();
-
- QAbstractOpenGLFunctions::initializeOpenGLFunctions();
- }
- return isInitialized();
-}
-
-bool QOpenGLFunctions_3_2_Compatibility::isContextCompatible(QOpenGLContext *context)
-{
- Q_ASSERT(context);
- QSurfaceFormat f = context->format();
- const QPair<int, int> v = qMakePair(f.majorVersion(), f.minorVersion());
- if (v < qMakePair(3, 2))
- return false;
-
- if (f.profile() == QSurfaceFormat::CoreProfile)
- return false;
-
- return true;
-}
-
-QOpenGLVersionProfile QOpenGLFunctions_3_2_Compatibility::versionProfile()
-{
- QOpenGLVersionProfile v;
- v.setVersion(3, 2);
- v.setProfile(QSurfaceFormat::CompatibilityProfile);
- return v;
-}
-
-QT_END_NAMESPACE
diff --git a/src/gui/opengl/qopenglfunctions_3_2_compatibility.h b/src/gui/opengl/qopenglfunctions_3_2_compatibility.h
deleted file mode 100644
index 391e725953..0000000000
--- a/src/gui/opengl/qopenglfunctions_3_2_compatibility.h
+++ /dev/null
@@ -1,4377 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2013 Klaralvdalens Datakonsult AB (KDAB)
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the QtGui module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-**
-** This file was generated by glgen version 0.1
-** Command line was: glgen
-**
-** glgen is Copyright (C) 2013 Klaralvdalens Datakonsult AB (KDAB)
-**
-** This is an auto-generated file.
-** Do not edit! All changes made to it will be lost.
-**
-****************************************************************************/
-
-#ifndef QOPENGLVERSIONFUNCTIONS_3_2_COMPATIBILITY_H
-#define QOPENGLVERSIONFUNCTIONS_3_2_COMPATIBILITY_H
-
-#include <QtGui/qtguiglobal.h>
-
-#if !defined(QT_NO_OPENGL) && !defined(QT_OPENGL_ES_2)
-
-#include <QtGui/QOpenGLVersionFunctions>
-#include <QtGui/qopenglcontext.h>
-
-QT_BEGIN_NAMESPACE
-
-class Q_GUI_EXPORT QOpenGLFunctions_3_2_Compatibility : public QAbstractOpenGLFunctions
-{
-public:
- QOpenGLFunctions_3_2_Compatibility();
- ~QOpenGLFunctions_3_2_Compatibility();
-
- bool initializeOpenGLFunctions() override;
-
- // OpenGL 1.0 core functions
- void glViewport(GLint x, GLint y, GLsizei width, GLsizei height);
- void glDepthRange(GLdouble nearVal, GLdouble farVal);
- GLboolean glIsEnabled(GLenum cap);
- void glGetTexLevelParameteriv(GLenum target, GLint level, GLenum pname, GLint *params);
- void glGetTexLevelParameterfv(GLenum target, GLint level, GLenum pname, GLfloat *params);
- void glGetTexParameteriv(GLenum target, GLenum pname, GLint *params);
- void glGetTexParameterfv(GLenum target, GLenum pname, GLfloat *params);
- void glGetTexImage(GLenum target, GLint level, GLenum format, GLenum type, GLvoid *pixels);
- const GLubyte * glGetString(GLenum name);
- void glGetIntegerv(GLenum pname, GLint *params);
- void glGetFloatv(GLenum pname, GLfloat *params);
- GLenum glGetError();
- void glGetDoublev(GLenum pname, GLdouble *params);
- void glGetBooleanv(GLenum pname, GLboolean *params);
- void glReadPixels(GLint x, GLint y, GLsizei width, GLsizei height, GLenum format, GLenum type, GLvoid *pixels);
- void glReadBuffer(GLenum mode);
- void glPixelStorei(GLenum pname, GLint param);
- void glPixelStoref(GLenum pname, GLfloat param);
- void glDepthFunc(GLenum func);
- void glStencilOp(GLenum fail, GLenum zfail, GLenum zpass);
- void glStencilFunc(GLenum func, GLint ref, GLuint mask);
- void glLogicOp(GLenum opcode);
- void glBlendFunc(GLenum sfactor, GLenum dfactor);
- void glFlush();
- void glFinish();
- void glEnable(GLenum cap);
- void glDisable(GLenum cap);
- void glDepthMask(GLboolean flag);
- void glColorMask(GLboolean red, GLboolean green, GLboolean blue, GLboolean alpha);
- void glStencilMask(GLuint mask);
- void glClearDepth(GLdouble depth);
- void glClearStencil(GLint s);
- void glClearColor(GLfloat red, GLfloat green, GLfloat blue, GLfloat alpha);
- void glClear(GLbitfield mask);
- void glDrawBuffer(GLenum mode);
- void glTexImage2D(GLenum target, GLint level, GLint internalformat, GLsizei width, GLsizei height, GLint border, GLenum format, GLenum type, const GLvoid *pixels);
- void glTexImage1D(GLenum target, GLint level, GLint internalformat, GLsizei width, GLint border, GLenum format, GLenum type, const GLvoid *pixels);
- void glTexParameteriv(GLenum target, GLenum pname, const GLint *params);
- void glTexParameteri(GLenum target, GLenum pname, GLint param);
- void glTexParameterfv(GLenum target, GLenum pname, const GLfloat *params);
- void glTexParameterf(GLenum target, GLenum pname, GLfloat param);
- void glScissor(GLint x, GLint y, GLsizei width, GLsizei height);
- void glPolygonMode(GLenum face, GLenum mode);
- void glPointSize(GLfloat size);
- void glLineWidth(GLfloat width);
- void glHint(GLenum target, GLenum mode);
- void glFrontFace(GLenum mode);
- void glCullFace(GLenum mode);
-
- // OpenGL 1.1 core functions
- void glIndexubv(const GLubyte *c);
- void glIndexub(GLubyte c);
- GLboolean glIsTexture(GLuint texture);
- void glGenTextures(GLsizei n, GLuint *textures);
- void glDeleteTextures(GLsizei n, const GLuint *textures);
- void glBindTexture(GLenum target, GLuint texture);
- void glTexSubImage2D(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLenum type, const GLvoid *pixels);
- void glTexSubImage1D(GLenum target, GLint level, GLint xoffset, GLsizei width, GLenum format, GLenum type, const GLvoid *pixels);
- void glCopyTexSubImage2D(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint x, GLint y, GLsizei width, GLsizei height);
- void glCopyTexSubImage1D(GLenum target, GLint level, GLint xoffset, GLint x, GLint y, GLsizei width);
- void glCopyTexImage2D(GLenum target, GLint level, GLenum internalformat, GLint x, GLint y, GLsizei width, GLsizei height, GLint border);
- void glCopyTexImage1D(GLenum target, GLint level, GLenum internalformat, GLint x, GLint y, GLsizei width, GLint border);
- void glPolygonOffset(GLfloat factor, GLfloat units);
- void glGetPointerv(GLenum pname, GLvoid* *params);
- void glDrawElements(GLenum mode, GLsizei count, GLenum type, const GLvoid *indices);
- void glDrawArrays(GLenum mode, GLint first, GLsizei count);
-
- // OpenGL 1.2 core functions
- void glCopyTexSubImage3D(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLint x, GLint y, GLsizei width, GLsizei height);
- void glTexSubImage3D(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLenum type, const GLvoid *pixels);
- void glTexImage3D(GLenum target, GLint level, GLint internalformat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLenum format, GLenum type, const GLvoid *pixels);
- void glDrawRangeElements(GLenum mode, GLuint start, GLuint end, GLsizei count, GLenum type, const GLvoid *indices);
- void glBlendEquation(GLenum mode);
- void glBlendColor(GLfloat red, GLfloat green, GLfloat blue, GLfloat alpha);
-
- // OpenGL 1.3 core functions
- void glGetCompressedTexImage(GLenum target, GLint level, GLvoid *img);
- void glCompressedTexSubImage1D(GLenum target, GLint level, GLint xoffset, GLsizei width, GLenum format, GLsizei imageSize, const GLvoid *data);
- void glCompressedTexSubImage2D(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLsizei imageSize, const GLvoid *data);
- void glCompressedTexSubImage3D(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLsizei imageSize, const GLvoid *data);
- void glCompressedTexImage1D(GLenum target, GLint level, GLenum internalformat, GLsizei width, GLint border, GLsizei imageSize, const GLvoid *data);
- void glCompressedTexImage2D(GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLint border, GLsizei imageSize, const GLvoid *data);
- void glCompressedTexImage3D(GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLsizei imageSize, const GLvoid *data);
- void glSampleCoverage(GLfloat value, GLboolean invert);
- void glActiveTexture(GLenum texture);
-
- // OpenGL 1.4 core functions
- void glPointParameteriv(GLenum pname, const GLint *params);
- void glPointParameteri(GLenum pname, GLint param);
- void glPointParameterfv(GLenum pname, const GLfloat *params);
- void glPointParameterf(GLenum pname, GLfloat param);
- void glMultiDrawElements(GLenum mode, const GLsizei *count, GLenum type, const GLvoid* const *indices, GLsizei drawcount);
- void glMultiDrawArrays(GLenum mode, const GLint *first, const GLsizei *count, GLsizei drawcount);
- void glBlendFuncSeparate(GLenum sfactorRGB, GLenum dfactorRGB, GLenum sfactorAlpha, GLenum dfactorAlpha);
-
- // OpenGL 1.5 core functions
- void glGetBufferPointerv(GLenum target, GLenum pname, GLvoid* *params);
- void glGetBufferParameteriv(GLenum target, GLenum pname, GLint *params);
- GLboolean glUnmapBuffer(GLenum target);
- GLvoid* glMapBuffer(GLenum target, GLenum access);
- void glGetBufferSubData(GLenum target, GLintptr offset, GLsizeiptr size, GLvoid *data);
- void glBufferSubData(GLenum target, GLintptr offset, GLsizeiptr size, const GLvoid *data);
- void glBufferData(GLenum target, GLsizeiptr size, const GLvoid *data, GLenum usage);
- GLboolean glIsBuffer(GLuint buffer);
- void glGenBuffers(GLsizei n, GLuint *buffers);
- void glDeleteBuffers(GLsizei n, const GLuint *buffers);
- void glBindBuffer(GLenum target, GLuint buffer);
- void glGetQueryObjectuiv(GLuint id, GLenum pname, GLuint *params);
- void glGetQueryObjectiv(GLuint id, GLenum pname, GLint *params);
- void glGetQueryiv(GLenum target, GLenum pname, GLint *params);
- void glEndQuery(GLenum target);
- void glBeginQuery(GLenum target, GLuint id);
- GLboolean glIsQuery(GLuint id);
- void glDeleteQueries(GLsizei n, const GLuint *ids);
- void glGenQueries(GLsizei n, GLuint *ids);
-
- // OpenGL 2.0 core functions
- void glVertexAttribPointer(GLuint index, GLint size, GLenum type, GLboolean normalized, GLsizei stride, const GLvoid *pointer);
- void glValidateProgram(GLuint program);
- void glUniformMatrix4fv(GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
- void glUniformMatrix3fv(GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
- void glUniformMatrix2fv(GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
- void glUniform4iv(GLint location, GLsizei count, const GLint *value);
- void glUniform3iv(GLint location, GLsizei count, const GLint *value);
- void glUniform2iv(GLint location, GLsizei count, const GLint *value);
- void glUniform1iv(GLint location, GLsizei count, const GLint *value);
- void glUniform4fv(GLint location, GLsizei count, const GLfloat *value);
- void glUniform3fv(GLint location, GLsizei count, const GLfloat *value);
- void glUniform2fv(GLint location, GLsizei count, const GLfloat *value);
- void glUniform1fv(GLint location, GLsizei count, const GLfloat *value);
- void glUniform4i(GLint location, GLint v0, GLint v1, GLint v2, GLint v3);
- void glUniform3i(GLint location, GLint v0, GLint v1, GLint v2);
- void glUniform2i(GLint location, GLint v0, GLint v1);
- void glUniform1i(GLint location, GLint v0);
- void glUniform4f(GLint location, GLfloat v0, GLfloat v1, GLfloat v2, GLfloat v3);
- void glUniform3f(GLint location, GLfloat v0, GLfloat v1, GLfloat v2);
- void glUniform2f(GLint location, GLfloat v0, GLfloat v1);
- void glUniform1f(GLint location, GLfloat v0);
- void glUseProgram(GLuint program);
- void glShaderSource(GLuint shader, GLsizei count, const GLchar* const *string, const GLint *length);
- void glLinkProgram(GLuint program);
- GLboolean glIsShader(GLuint shader);
- GLboolean glIsProgram(GLuint program);
- void glGetVertexAttribPointerv(GLuint index, GLenum pname, GLvoid* *pointer);
- void glGetVertexAttribiv(GLuint index, GLenum pname, GLint *params);
- void glGetVertexAttribfv(GLuint index, GLenum pname, GLfloat *params);
- void glGetVertexAttribdv(GLuint index, GLenum pname, GLdouble *params);
- void glGetUniformiv(GLuint program, GLint location, GLint *params);
- void glGetUniformfv(GLuint program, GLint location, GLfloat *params);
- GLint glGetUniformLocation(GLuint program, const GLchar *name);
- void glGetShaderSource(GLuint shader, GLsizei bufSize, GLsizei *length, GLchar *source);
- void glGetShaderInfoLog(GLuint shader, GLsizei bufSize, GLsizei *length, GLchar *infoLog);
- void glGetShaderiv(GLuint shader, GLenum pname, GLint *params);
- void glGetProgramInfoLog(GLuint program, GLsizei bufSize, GLsizei *length, GLchar *infoLog);
- void glGetProgramiv(GLuint program, GLenum pname, GLint *params);
- GLint glGetAttribLocation(GLuint program, const GLchar *name);
- void glGetAttachedShaders(GLuint program, GLsizei maxCount, GLsizei *count, GLuint *obj);
- void glGetActiveUniform(GLuint program, GLuint index, GLsizei bufSize, GLsizei *length, GLint *size, GLenum *type, GLchar *name);
- void glGetActiveAttrib(GLuint program, GLuint index, GLsizei bufSize, GLsizei *length, GLint *size, GLenum *type, GLchar *name);
- void glEnableVertexAttribArray(GLuint index);
- void glDisableVertexAttribArray(GLuint index);
- void glDetachShader(GLuint program, GLuint shader);
- void glDeleteShader(GLuint shader);
- void glDeleteProgram(GLuint program);
- GLuint glCreateShader(GLenum type);
- GLuint glCreateProgram();
- void glCompileShader(GLuint shader);
- void glBindAttribLocation(GLuint program, GLuint index, const GLchar *name);
- void glAttachShader(GLuint program, GLuint shader);
- void glStencilMaskSeparate(GLenum face, GLuint mask);
- void glStencilFuncSeparate(GLenum face, GLenum func, GLint ref, GLuint mask);
- void glStencilOpSeparate(GLenum face, GLenum sfail, GLenum dpfail, GLenum dppass);
- void glDrawBuffers(GLsizei n, const GLenum *bufs);
- void glBlendEquationSeparate(GLenum modeRGB, GLenum modeAlpha);
-
- // OpenGL 2.1 core functions
- void glUniformMatrix4x3fv(GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
- void glUniformMatrix3x4fv(GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
- void glUniformMatrix4x2fv(GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
- void glUniformMatrix2x4fv(GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
- void glUniformMatrix3x2fv(GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
- void glUniformMatrix2x3fv(GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
-
- // OpenGL 3.0 core functions
- GLboolean glIsVertexArray(GLuint array);
- void glGenVertexArrays(GLsizei n, GLuint *arrays);
- void glDeleteVertexArrays(GLsizei n, const GLuint *arrays);
- void glBindVertexArray(GLuint array);
- void glFlushMappedBufferRange(GLenum target, GLintptr offset, GLsizeiptr length);
- GLvoid* glMapBufferRange(GLenum target, GLintptr offset, GLsizeiptr length, GLbitfield access);
- void glFramebufferTextureLayer(GLenum target, GLenum attachment, GLuint texture, GLint level, GLint layer);
- void glRenderbufferStorageMultisample(GLenum target, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height);
- void glBlitFramebuffer(GLint srcX0, GLint srcY0, GLint srcX1, GLint srcY1, GLint dstX0, GLint dstY0, GLint dstX1, GLint dstY1, GLbitfield mask, GLenum filter);
- void glGenerateMipmap(GLenum target);
- void glGetFramebufferAttachmentParameteriv(GLenum target, GLenum attachment, GLenum pname, GLint *params);
- void glFramebufferRenderbuffer(GLenum target, GLenum attachment, GLenum renderbuffertarget, GLuint renderbuffer);
- void glFramebufferTexture3D(GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level, GLint zoffset);
- void glFramebufferTexture2D(GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level);
- void glFramebufferTexture1D(GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level);
- GLenum glCheckFramebufferStatus(GLenum target);
- void glGenFramebuffers(GLsizei n, GLuint *framebuffers);
- void glDeleteFramebuffers(GLsizei n, const GLuint *framebuffers);
- void glBindFramebuffer(GLenum target, GLuint framebuffer);
- GLboolean glIsFramebuffer(GLuint framebuffer);
- void glGetRenderbufferParameteriv(GLenum target, GLenum pname, GLint *params);
- void glRenderbufferStorage(GLenum target, GLenum internalformat, GLsizei width, GLsizei height);
- void glGenRenderbuffers(GLsizei n, GLuint *renderbuffers);
- void glDeleteRenderbuffers(GLsizei n, const GLuint *renderbuffers);
- void glBindRenderbuffer(GLenum target, GLuint renderbuffer);
- GLboolean glIsRenderbuffer(GLuint renderbuffer);
- const GLubyte * glGetStringi(GLenum name, GLuint index);
- void glClearBufferfi(GLenum buffer, GLint drawbuffer, GLfloat depth, GLint stencil);
- void glClearBufferfv(GLenum buffer, GLint drawbuffer, const GLfloat *value);
- void glClearBufferuiv(GLenum buffer, GLint drawbuffer, const GLuint *value);
- void glClearBufferiv(GLenum buffer, GLint drawbuffer, const GLint *value);
- void glGetTexParameterIuiv(GLenum target, GLenum pname, GLuint *params);
- void glGetTexParameterIiv(GLenum target, GLenum pname, GLint *params);
- void glTexParameterIuiv(GLenum target, GLenum pname, const GLuint *params);
- void glTexParameterIiv(GLenum target, GLenum pname, const GLint *params);
- void glUniform4uiv(GLint location, GLsizei count, const GLuint *value);
- void glUniform3uiv(GLint location, GLsizei count, const GLuint *value);
- void glUniform2uiv(GLint location, GLsizei count, const GLuint *value);
- void glUniform1uiv(GLint location, GLsizei count, const GLuint *value);
- void glUniform4ui(GLint location, GLuint v0, GLuint v1, GLuint v2, GLuint v3);
- void glUniform3ui(GLint location, GLuint v0, GLuint v1, GLuint v2);
- void glUniform2ui(GLint location, GLuint v0, GLuint v1);
- void glUniform1ui(GLint location, GLuint v0);
- GLint glGetFragDataLocation(GLuint program, const GLchar *name);
- void glBindFragDataLocation(GLuint program, GLuint color, const GLchar *name);
- void glGetUniformuiv(GLuint program, GLint location, GLuint *params);
- void glGetVertexAttribIuiv(GLuint index, GLenum pname, GLuint *params);
- void glGetVertexAttribIiv(GLuint index, GLenum pname, GLint *params);
- void glVertexAttribIPointer(GLuint index, GLint size, GLenum type, GLsizei stride, const GLvoid *pointer);
- void glEndConditionalRender();
- void glBeginConditionalRender(GLuint id, GLenum mode);
- void glClampColor(GLenum target, GLenum clamp);
- void glGetTransformFeedbackVarying(GLuint program, GLuint index, GLsizei bufSize, GLsizei *length, GLsizei *size, GLenum *type, GLchar *name);
- void glTransformFeedbackVaryings(GLuint program, GLsizei count, const GLchar* const *varyings, GLenum bufferMode);
- void glBindBufferBase(GLenum target, GLuint index, GLuint buffer);
- void glBindBufferRange(GLenum target, GLuint index, GLuint buffer, GLintptr offset, GLsizeiptr size);
- void glEndTransformFeedback();
- void glBeginTransformFeedback(GLenum primitiveMode);
- GLboolean glIsEnabledi(GLenum target, GLuint index);
- void glDisablei(GLenum target, GLuint index);
- void glEnablei(GLenum target, GLuint index);
- void glGetIntegeri_v(GLenum target, GLuint index, GLint *data);
- void glGetBooleani_v(GLenum target, GLuint index, GLboolean *data);
- void glColorMaski(GLuint index, GLboolean r, GLboolean g, GLboolean b, GLboolean a);
-
- // OpenGL 3.1 core functions
- void glCopyBufferSubData(GLenum readTarget, GLenum writeTarget, GLintptr readOffset, GLintptr writeOffset, GLsizeiptr size);
- void glUniformBlockBinding(GLuint program, GLuint uniformBlockIndex, GLuint uniformBlockBinding);
- void glGetActiveUniformBlockName(GLuint program, GLuint uniformBlockIndex, GLsizei bufSize, GLsizei *length, GLchar *uniformBlockName);
- void glGetActiveUniformBlockiv(GLuint program, GLuint uniformBlockIndex, GLenum pname, GLint *params);
- GLuint glGetUniformBlockIndex(GLuint program, const GLchar *uniformBlockName);
- void glGetActiveUniformName(GLuint program, GLuint uniformIndex, GLsizei bufSize, GLsizei *length, GLchar *uniformName);
- void glGetActiveUniformsiv(GLuint program, GLsizei uniformCount, const GLuint *uniformIndices, GLenum pname, GLint *params);
- void glGetUniformIndices(GLuint program, GLsizei uniformCount, const GLchar* const *uniformNames, GLuint *uniformIndices);
- void glPrimitiveRestartIndex(GLuint index);
- void glTexBuffer(GLenum target, GLenum internalformat, GLuint buffer);
- void glDrawElementsInstanced(GLenum mode, GLsizei count, GLenum type, const GLvoid *indices, GLsizei instancecount);
- void glDrawArraysInstanced(GLenum mode, GLint first, GLsizei count, GLsizei instancecount);
-
- // OpenGL 3.2 core functions
- void glSampleMaski(GLuint index, GLbitfield mask);
- void glGetMultisamplefv(GLenum pname, GLuint index, GLfloat *val);
- void glTexImage3DMultisample(GLenum target, GLsizei samples, GLint internalformat, GLsizei width, GLsizei height, GLsizei depth, GLboolean fixedsamplelocations);
- void glTexImage2DMultisample(GLenum target, GLsizei samples, GLint internalformat, GLsizei width, GLsizei height, GLboolean fixedsamplelocations);
- void glGetSynciv(GLsync sync, GLenum pname, GLsizei bufSize, GLsizei *length, GLint *values);
- void glGetInteger64v(GLenum pname, GLint64 *params);
- void glWaitSync(GLsync sync, GLbitfield flags, GLuint64 timeout);
- GLenum glClientWaitSync(GLsync sync, GLbitfield flags, GLuint64 timeout);
- void glDeleteSync(GLsync sync);
- GLboolean glIsSync(GLsync sync);
- GLsync glFenceSync(GLenum condition, GLbitfield flags);
- void glProvokingVertex(GLenum mode);
- void glMultiDrawElementsBaseVertex(GLenum mode, const GLsizei *count, GLenum type, const GLvoid* const *indices, GLsizei drawcount, const GLint *basevertex);
- void glDrawElementsInstancedBaseVertex(GLenum mode, GLsizei count, GLenum type, const GLvoid *indices, GLsizei instancecount, GLint basevertex);
- void glDrawRangeElementsBaseVertex(GLenum mode, GLuint start, GLuint end, GLsizei count, GLenum type, const GLvoid *indices, GLint basevertex);
- void glDrawElementsBaseVertex(GLenum mode, GLsizei count, GLenum type, const GLvoid *indices, GLint basevertex);
- void glFramebufferTexture(GLenum target, GLenum attachment, GLuint texture, GLint level);
- void glGetBufferParameteri64v(GLenum target, GLenum pname, GLint64 *params);
- void glGetInteger64i_v(GLenum target, GLuint index, GLint64 *data);
-
- // OpenGL 1.0 deprecated functions
- void glTranslatef(GLfloat x, GLfloat y, GLfloat z);
- void glTranslated(GLdouble x, GLdouble y, GLdouble z);
- void glScalef(GLfloat x, GLfloat y, GLfloat z);
- void glScaled(GLdouble x, GLdouble y, GLdouble z);
- void glRotatef(GLfloat angle, GLfloat x, GLfloat y, GLfloat z);
- void glRotated(GLdouble angle, GLdouble x, GLdouble y, GLdouble z);
- void glPushMatrix();
- void glPopMatrix();
- void glOrtho(GLdouble left, GLdouble right, GLdouble bottom, GLdouble top, GLdouble zNear, GLdouble zFar);
- void glMultMatrixd(const GLdouble *m);
- void glMultMatrixf(const GLfloat *m);
- void glMatrixMode(GLenum mode);
- void glLoadMatrixd(const GLdouble *m);
- void glLoadMatrixf(const GLfloat *m);
- void glLoadIdentity();
- void glFrustum(GLdouble left, GLdouble right, GLdouble bottom, GLdouble top, GLdouble zNear, GLdouble zFar);
- GLboolean glIsList(GLuint list);
- void glGetTexGeniv(GLenum coord, GLenum pname, GLint *params);
- void glGetTexGenfv(GLenum coord, GLenum pname, GLfloat *params);
- void glGetTexGendv(GLenum coord, GLenum pname, GLdouble *params);
- void glGetTexEnviv(GLenum target, GLenum pname, GLint *params);
- void glGetTexEnvfv(GLenum target, GLenum pname, GLfloat *params);
- void glGetPolygonStipple(GLubyte *mask);
- void glGetPixelMapusv(GLenum map, GLushort *values);
- void glGetPixelMapuiv(GLenum map, GLuint *values);
- void glGetPixelMapfv(GLenum map, GLfloat *values);
- void glGetMaterialiv(GLenum face, GLenum pname, GLint *params);
- void glGetMaterialfv(GLenum face, GLenum pname, GLfloat *params);
- void glGetMapiv(GLenum target, GLenum query, GLint *v);
- void glGetMapfv(GLenum target, GLenum query, GLfloat *v);
- void glGetMapdv(GLenum target, GLenum query, GLdouble *v);
- void glGetLightiv(GLenum light, GLenum pname, GLint *params);
- void glGetLightfv(GLenum light, GLenum pname, GLfloat *params);
- void glGetClipPlane(GLenum plane, GLdouble *equation);
- void glDrawPixels(GLsizei width, GLsizei height, GLenum format, GLenum type, const GLvoid *pixels);
- void glCopyPixels(GLint x, GLint y, GLsizei width, GLsizei height, GLenum type);
- void glPixelMapusv(GLenum map, GLint mapsize, const GLushort *values);
- void glPixelMapuiv(GLenum map, GLint mapsize, const GLuint *values);
- void glPixelMapfv(GLenum map, GLint mapsize, const GLfloat *values);
- void glPixelTransferi(GLenum pname, GLint param);
- void glPixelTransferf(GLenum pname, GLfloat param);
- void glPixelZoom(GLfloat xfactor, GLfloat yfactor);
- void glAlphaFunc(GLenum func, GLfloat ref);
- void glEvalPoint2(GLint i, GLint j);
- void glEvalMesh2(GLenum mode, GLint i1, GLint i2, GLint j1, GLint j2);
- void glEvalPoint1(GLint i);
- void glEvalMesh1(GLenum mode, GLint i1, GLint i2);
- void glEvalCoord2fv(const GLfloat *u);
- void glEvalCoord2f(GLfloat u, GLfloat v);
- void glEvalCoord2dv(const GLdouble *u);
- void glEvalCoord2d(GLdouble u, GLdouble v);
- void glEvalCoord1fv(const GLfloat *u);
- void glEvalCoord1f(GLfloat u);
- void glEvalCoord1dv(const GLdouble *u);
- void glEvalCoord1d(GLdouble u);
- void glMapGrid2f(GLint un, GLfloat u1, GLfloat u2, GLint vn, GLfloat v1, GLfloat v2);
- void glMapGrid2d(GLint un, GLdouble u1, GLdouble u2, GLint vn, GLdouble v1, GLdouble v2);
- void glMapGrid1f(GLint un, GLfloat u1, GLfloat u2);
- void glMapGrid1d(GLint un, GLdouble u1, GLdouble u2);
- void glMap2f(GLenum target, GLfloat u1, GLfloat u2, GLint ustride, GLint uorder, GLfloat v1, GLfloat v2, GLint vstride, GLint vorder, const GLfloat *points);
- void glMap2d(GLenum target, GLdouble u1, GLdouble u2, GLint ustride, GLint uorder, GLdouble v1, GLdouble v2, GLint vstride, GLint vorder, const GLdouble *points);
- void glMap1f(GLenum target, GLfloat u1, GLfloat u2, GLint stride, GLint order, const GLfloat *points);
- void glMap1d(GLenum target, GLdouble u1, GLdouble u2, GLint stride, GLint order, const GLdouble *points);
- void glPushAttrib(GLbitfield mask);
- void glPopAttrib();
- void glAccum(GLenum op, GLfloat value);
- void glIndexMask(GLuint mask);
- void glClearIndex(GLfloat c);
- void glClearAccum(GLfloat red, GLfloat green, GLfloat blue, GLfloat alpha);
- void glPushName(GLuint name);
- void glPopName();
- void glPassThrough(GLfloat token);
- void glLoadName(GLuint name);
- void glInitNames();
- GLint glRenderMode(GLenum mode);
- void glSelectBuffer(GLsizei size, GLuint *buffer);
- void glFeedbackBuffer(GLsizei size, GLenum type, GLfloat *buffer);
- void glTexGeniv(GLenum coord, GLenum pname, const GLint *params);
- void glTexGeni(GLenum coord, GLenum pname, GLint param);
- void glTexGenfv(GLenum coord, GLenum pname, const GLfloat *params);
- void glTexGenf(GLenum coord, GLenum pname, GLfloat param);
- void glTexGendv(GLenum coord, GLenum pname, const GLdouble *params);
- void glTexGend(GLenum coord, GLenum pname, GLdouble param);
- void glTexEnviv(GLenum target, GLenum pname, const GLint *params);
- void glTexEnvi(GLenum target, GLenum pname, GLint param);
- void glTexEnvfv(GLenum target, GLenum pname, const GLfloat *params);
- void glTexEnvf(GLenum target, GLenum pname, GLfloat param);
- void glShadeModel(GLenum mode);
- void glPolygonStipple(const GLubyte *mask);
- void glMaterialiv(GLenum face, GLenum pname, const GLint *params);
- void glMateriali(GLenum face, GLenum pname, GLint param);
- void glMaterialfv(GLenum face, GLenum pname, const GLfloat *params);
- void glMaterialf(GLenum face, GLenum pname, GLfloat param);
- void glLineStipple(GLint factor, GLushort pattern);
- void glLightModeliv(GLenum pname, const GLint *params);
- void glLightModeli(GLenum pname, GLint param);
- void glLightModelfv(GLenum pname, const GLfloat *params);
- void glLightModelf(GLenum pname, GLfloat param);
- void glLightiv(GLenum light, GLenum pname, const GLint *params);
- void glLighti(GLenum light, GLenum pname, GLint param);
- void glLightfv(GLenum light, GLenum pname, const GLfloat *params);
- void glLightf(GLenum light, GLenum pname, GLfloat param);
- void glFogiv(GLenum pname, const GLint *params);
- void glFogi(GLenum pname, GLint param);
- void glFogfv(GLenum pname, const GLfloat *params);
- void glFogf(GLenum pname, GLfloat param);
- void glColorMaterial(GLenum face, GLenum mode);
- void glClipPlane(GLenum plane, const GLdouble *equation);
- void glVertex4sv(const GLshort *v);
- void glVertex4s(GLshort x, GLshort y, GLshort z, GLshort w);
- void glVertex4iv(const GLint *v);
- void glVertex4i(GLint x, GLint y, GLint z, GLint w);
- void glVertex4fv(const GLfloat *v);
- void glVertex4f(GLfloat x, GLfloat y, GLfloat z, GLfloat w);
- void glVertex4dv(const GLdouble *v);
- void glVertex4d(GLdouble x, GLdouble y, GLdouble z, GLdouble w);
- void glVertex3sv(const GLshort *v);
- void glVertex3s(GLshort x, GLshort y, GLshort z);
- void glVertex3iv(const GLint *v);
- void glVertex3i(GLint x, GLint y, GLint z);
- void glVertex3fv(const GLfloat *v);
- void glVertex3f(GLfloat x, GLfloat y, GLfloat z);
- void glVertex3dv(const GLdouble *v);
- void glVertex3d(GLdouble x, GLdouble y, GLdouble z);
- void glVertex2sv(const GLshort *v);
- void glVertex2s(GLshort x, GLshort y);
- void glVertex2iv(const GLint *v);
- void glVertex2i(GLint x, GLint y);
- void glVertex2fv(const GLfloat *v);
- void glVertex2f(GLfloat x, GLfloat y);
- void glVertex2dv(const GLdouble *v);
- void glVertex2d(GLdouble x, GLdouble y);
- void glTexCoord4sv(const GLshort *v);
- void glTexCoord4s(GLshort s, GLshort t, GLshort r, GLshort q);
- void glTexCoord4iv(const GLint *v);
- void glTexCoord4i(GLint s, GLint t, GLint r, GLint q);
- void glTexCoord4fv(const GLfloat *v);
- void glTexCoord4f(GLfloat s, GLfloat t, GLfloat r, GLfloat q);
- void glTexCoord4dv(const GLdouble *v);
- void glTexCoord4d(GLdouble s, GLdouble t, GLdouble r, GLdouble q);
- void glTexCoord3sv(const GLshort *v);
- void glTexCoord3s(GLshort s, GLshort t, GLshort r);
- void glTexCoord3iv(const GLint *v);
- void glTexCoord3i(GLint s, GLint t, GLint r);
- void glTexCoord3fv(const GLfloat *v);
- void glTexCoord3f(GLfloat s, GLfloat t, GLfloat r);
- void glTexCoord3dv(const GLdouble *v);
- void glTexCoord3d(GLdouble s, GLdouble t, GLdouble r);
- void glTexCoord2sv(const GLshort *v);
- void glTexCoord2s(GLshort s, GLshort t);
- void glTexCoord2iv(const GLint *v);
- void glTexCoord2i(GLint s, GLint t);
- void glTexCoord2fv(const GLfloat *v);
- void glTexCoord2f(GLfloat s, GLfloat t);
- void glTexCoord2dv(const GLdouble *v);
- void glTexCoord2d(GLdouble s, GLdouble t);
- void glTexCoord1sv(const GLshort *v);
- void glTexCoord1s(GLshort s);
- void glTexCoord1iv(const GLint *v);
- void glTexCoord1i(GLint s);
- void glTexCoord1fv(const GLfloat *v);
- void glTexCoord1f(GLfloat s);
- void glTexCoord1dv(const GLdouble *v);
- void glTexCoord1d(GLdouble s);
- void glRectsv(const GLshort *v1, const GLshort *v2);
- void glRects(GLshort x1, GLshort y1, GLshort x2, GLshort y2);
- void glRectiv(const GLint *v1, const GLint *v2);
- void glRecti(GLint x1, GLint y1, GLint x2, GLint y2);
- void glRectfv(const GLfloat *v1, const GLfloat *v2);
- void glRectf(GLfloat x1, GLfloat y1, GLfloat x2, GLfloat y2);
- void glRectdv(const GLdouble *v1, const GLdouble *v2);
- void glRectd(GLdouble x1, GLdouble y1, GLdouble x2, GLdouble y2);
- void glRasterPos4sv(const GLshort *v);
- void glRasterPos4s(GLshort x, GLshort y, GLshort z, GLshort w);
- void glRasterPos4iv(const GLint *v);
- void glRasterPos4i(GLint x, GLint y, GLint z, GLint w);
- void glRasterPos4fv(const GLfloat *v);
- void glRasterPos4f(GLfloat x, GLfloat y, GLfloat z, GLfloat w);
- void glRasterPos4dv(const GLdouble *v);
- void glRasterPos4d(GLdouble x, GLdouble y, GLdouble z, GLdouble w);
- void glRasterPos3sv(const GLshort *v);
- void glRasterPos3s(GLshort x, GLshort y, GLshort z);
- void glRasterPos3iv(const GLint *v);
- void glRasterPos3i(GLint x, GLint y, GLint z);
- void glRasterPos3fv(const GLfloat *v);
- void glRasterPos3f(GLfloat x, GLfloat y, GLfloat z);
- void glRasterPos3dv(const GLdouble *v);
- void glRasterPos3d(GLdouble x, GLdouble y, GLdouble z);
- void glRasterPos2sv(const GLshort *v);
- void glRasterPos2s(GLshort x, GLshort y);
- void glRasterPos2iv(const GLint *v);
- void glRasterPos2i(GLint x, GLint y);
- void glRasterPos2fv(const GLfloat *v);
- void glRasterPos2f(GLfloat x, GLfloat y);
- void glRasterPos2dv(const GLdouble *v);
- void glRasterPos2d(GLdouble x, GLdouble y);
- void glNormal3sv(const GLshort *v);
- void glNormal3s(GLshort nx, GLshort ny, GLshort nz);
- void glNormal3iv(const GLint *v);
- void glNormal3i(GLint nx, GLint ny, GLint nz);
- void glNormal3fv(const GLfloat *v);
- void glNormal3f(GLfloat nx, GLfloat ny, GLfloat nz);
- void glNormal3dv(const GLdouble *v);
- void glNormal3d(GLdouble nx, GLdouble ny, GLdouble nz);
- void glNormal3bv(const GLbyte *v);
- void glNormal3b(GLbyte nx, GLbyte ny, GLbyte nz);
- void glIndexsv(const GLshort *c);
- void glIndexs(GLshort c);
- void glIndexiv(const GLint *c);
- void glIndexi(GLint c);
- void glIndexfv(const GLfloat *c);
- void glIndexf(GLfloat c);
- void glIndexdv(const GLdouble *c);
- void glIndexd(GLdouble c);
- void glEnd();
- void glEdgeFlagv(const GLboolean *flag);
- void glEdgeFlag(GLboolean flag);
- void glColor4usv(const GLushort *v);
- void glColor4us(GLushort red, GLushort green, GLushort blue, GLushort alpha);
- void glColor4uiv(const GLuint *v);
- void glColor4ui(GLuint red, GLuint green, GLuint blue, GLuint alpha);
- void glColor4ubv(const GLubyte *v);
- void glColor4ub(GLubyte red, GLubyte green, GLubyte blue, GLubyte alpha);
- void glColor4sv(const GLshort *v);
- void glColor4s(GLshort red, GLshort green, GLshort blue, GLshort alpha);
- void glColor4iv(const GLint *v);
- void glColor4i(GLint red, GLint green, GLint blue, GLint alpha);
- void glColor4fv(const GLfloat *v);
- void glColor4f(GLfloat red, GLfloat green, GLfloat blue, GLfloat alpha);
- void glColor4dv(const GLdouble *v);
- void glColor4d(GLdouble red, GLdouble green, GLdouble blue, GLdouble alpha);
- void glColor4bv(const GLbyte *v);
- void glColor4b(GLbyte red, GLbyte green, GLbyte blue, GLbyte alpha);
- void glColor3usv(const GLushort *v);
- void glColor3us(GLushort red, GLushort green, GLushort blue);
- void glColor3uiv(const GLuint *v);
- void glColor3ui(GLuint red, GLuint green, GLuint blue);
- void glColor3ubv(const GLubyte *v);
- void glColor3ub(GLubyte red, GLubyte green, GLubyte blue);
- void glColor3sv(const GLshort *v);
- void glColor3s(GLshort red, GLshort green, GLshort blue);
- void glColor3iv(const GLint *v);
- void glColor3i(GLint red, GLint green, GLint blue);
- void glColor3fv(const GLfloat *v);
- void glColor3f(GLfloat red, GLfloat green, GLfloat blue);
- void glColor3dv(const GLdouble *v);
- void glColor3d(GLdouble red, GLdouble green, GLdouble blue);
- void glColor3bv(const GLbyte *v);
- void glColor3b(GLbyte red, GLbyte green, GLbyte blue);
- void glBitmap(GLsizei width, GLsizei height, GLfloat xorig, GLfloat yorig, GLfloat xmove, GLfloat ymove, const GLubyte *bitmap);
- void glBegin(GLenum mode);
- void glListBase(GLuint base);
- GLuint glGenLists(GLsizei range);
- void glDeleteLists(GLuint list, GLsizei range);
- void glCallLists(GLsizei n, GLenum type, const GLvoid *lists);
- void glCallList(GLuint list);
- void glEndList();
- void glNewList(GLuint list, GLenum mode);
-
- // OpenGL 1.1 deprecated functions
- void glPushClientAttrib(GLbitfield mask);
- void glPopClientAttrib();
- void glPrioritizeTextures(GLsizei n, const GLuint *textures, const GLfloat *priorities);
- GLboolean glAreTexturesResident(GLsizei n, const GLuint *textures, GLboolean *residences);
- void glVertexPointer(GLint size, GLenum type, GLsizei stride, const GLvoid *pointer);
- void glTexCoordPointer(GLint size, GLenum type, GLsizei stride, const GLvoid *pointer);
- void glNormalPointer(GLenum type, GLsizei stride, const GLvoid *pointer);
- void glInterleavedArrays(GLenum format, GLsizei stride, const GLvoid *pointer);
- void glIndexPointer(GLenum type, GLsizei stride, const GLvoid *pointer);
- void glEnableClientState(GLenum array);
- void glEdgeFlagPointer(GLsizei stride, const GLvoid *pointer);
- void glDisableClientState(GLenum array);
- void glColorPointer(GLint size, GLenum type, GLsizei stride, const GLvoid *pointer);
- void glArrayElement(GLint i);
-
- // OpenGL 1.2 deprecated functions
- void glResetMinmax(GLenum target);
- void glResetHistogram(GLenum target);
- void glMinmax(GLenum target, GLenum internalformat, GLboolean sink);
- void glHistogram(GLenum target, GLsizei width, GLenum internalformat, GLboolean sink);
- void glGetMinmaxParameteriv(GLenum target, GLenum pname, GLint *params);
- void glGetMinmaxParameterfv(GLenum target, GLenum pname, GLfloat *params);
- void glGetMinmax(GLenum target, GLboolean reset, GLenum format, GLenum type, GLvoid *values);
- void glGetHistogramParameteriv(GLenum target, GLenum pname, GLint *params);
- void glGetHistogramParameterfv(GLenum target, GLenum pname, GLfloat *params);
- void glGetHistogram(GLenum target, GLboolean reset, GLenum format, GLenum type, GLvoid *values);
- void glSeparableFilter2D(GLenum target, GLenum internalformat, GLsizei width, GLsizei height, GLenum format, GLenum type, const GLvoid *row, const GLvoid *column);
- void glGetSeparableFilter(GLenum target, GLenum format, GLenum type, GLvoid *row, GLvoid *column, GLvoid *span);
- void glGetConvolutionParameteriv(GLenum target, GLenum pname, GLint *params);
- void glGetConvolutionParameterfv(GLenum target, GLenum pname, GLfloat *params);
- void glGetConvolutionFilter(GLenum target, GLenum format, GLenum type, GLvoid *image);
- void glCopyConvolutionFilter2D(GLenum target, GLenum internalformat, GLint x, GLint y, GLsizei width, GLsizei height);
- void glCopyConvolutionFilter1D(GLenum target, GLenum internalformat, GLint x, GLint y, GLsizei width);
- void glConvolutionParameteriv(GLenum target, GLenum pname, const GLint *params);
- void glConvolutionParameteri(GLenum target, GLenum pname, GLint params);
- void glConvolutionParameterfv(GLenum target, GLenum pname, const GLfloat *params);
- void glConvolutionParameterf(GLenum target, GLenum pname, GLfloat params);
- void glConvolutionFilter2D(GLenum target, GLenum internalformat, GLsizei width, GLsizei height, GLenum format, GLenum type, const GLvoid *image);
- void glConvolutionFilter1D(GLenum target, GLenum internalformat, GLsizei width, GLenum format, GLenum type, const GLvoid *image);
- void glCopyColorSubTable(GLenum target, GLsizei start, GLint x, GLint y, GLsizei width);
- void glColorSubTable(GLenum target, GLsizei start, GLsizei count, GLenum format, GLenum type, const GLvoid *data);
- void glGetColorTableParameteriv(GLenum target, GLenum pname, GLint *params);
- void glGetColorTableParameterfv(GLenum target, GLenum pname, GLfloat *params);
- void glGetColorTable(GLenum target, GLenum format, GLenum type, GLvoid *table);
- void glCopyColorTable(GLenum target, GLenum internalformat, GLint x, GLint y, GLsizei width);
- void glColorTableParameteriv(GLenum target, GLenum pname, const GLint *params);
- void glColorTableParameterfv(GLenum target, GLenum pname, const GLfloat *params);
- void glColorTable(GLenum target, GLenum internalformat, GLsizei width, GLenum format, GLenum type, const GLvoid *table);
-
- // OpenGL 1.3 deprecated functions
- void glMultTransposeMatrixd(const GLdouble *m);
- void glMultTransposeMatrixf(const GLfloat *m);
- void glLoadTransposeMatrixd(const GLdouble *m);
- void glLoadTransposeMatrixf(const GLfloat *m);
- void glMultiTexCoord4sv(GLenum target, const GLshort *v);
- void glMultiTexCoord4s(GLenum target, GLshort s, GLshort t, GLshort r, GLshort q);
- void glMultiTexCoord4iv(GLenum target, const GLint *v);
- void glMultiTexCoord4i(GLenum target, GLint s, GLint t, GLint r, GLint q);
- void glMultiTexCoord4fv(GLenum target, const GLfloat *v);
- void glMultiTexCoord4f(GLenum target, GLfloat s, GLfloat t, GLfloat r, GLfloat q);
- void glMultiTexCoord4dv(GLenum target, const GLdouble *v);
- void glMultiTexCoord4d(GLenum target, GLdouble s, GLdouble t, GLdouble r, GLdouble q);
- void glMultiTexCoord3sv(GLenum target, const GLshort *v);
- void glMultiTexCoord3s(GLenum target, GLshort s, GLshort t, GLshort r);
- void glMultiTexCoord3iv(GLenum target, const GLint *v);
- void glMultiTexCoord3i(GLenum target, GLint s, GLint t, GLint r);
- void glMultiTexCoord3fv(GLenum target, const GLfloat *v);
- void glMultiTexCoord3f(GLenum target, GLfloat s, GLfloat t, GLfloat r);
- void glMultiTexCoord3dv(GLenum target, const GLdouble *v);
- void glMultiTexCoord3d(GLenum target, GLdouble s, GLdouble t, GLdouble r);
- void glMultiTexCoord2sv(GLenum target, const GLshort *v);
- void glMultiTexCoord2s(GLenum target, GLshort s, GLshort t);
- void glMultiTexCoord2iv(GLenum target, const GLint *v);
- void glMultiTexCoord2i(GLenum target, GLint s, GLint t);
- void glMultiTexCoord2fv(GLenum target, const GLfloat *v);
- void glMultiTexCoord2f(GLenum target, GLfloat s, GLfloat t);
- void glMultiTexCoord2dv(GLenum target, const GLdouble *v);
- void glMultiTexCoord2d(GLenum target, GLdouble s, GLdouble t);
- void glMultiTexCoord1sv(GLenum target, const GLshort *v);
- void glMultiTexCoord1s(GLenum target, GLshort s);
- void glMultiTexCoord1iv(GLenum target, const GLint *v);
- void glMultiTexCoord1i(GLenum target, GLint s);
- void glMultiTexCoord1fv(GLenum target, const GLfloat *v);
- void glMultiTexCoord1f(GLenum target, GLfloat s);
- void glMultiTexCoord1dv(GLenum target, const GLdouble *v);
- void glMultiTexCoord1d(GLenum target, GLdouble s);
- void glClientActiveTexture(GLenum texture);
-
- // OpenGL 1.4 deprecated functions
- void glWindowPos3sv(const GLshort *v);
- void glWindowPos3s(GLshort x, GLshort y, GLshort z);
- void glWindowPos3iv(const GLint *v);
- void glWindowPos3i(GLint x, GLint y, GLint z);
- void glWindowPos3fv(const GLfloat *v);
- void glWindowPos3f(GLfloat x, GLfloat y, GLfloat z);
- void glWindowPos3dv(const GLdouble *v);
- void glWindowPos3d(GLdouble x, GLdouble y, GLdouble z);
- void glWindowPos2sv(const GLshort *v);
- void glWindowPos2s(GLshort x, GLshort y);
- void glWindowPos2iv(const GLint *v);
- void glWindowPos2i(GLint x, GLint y);
- void glWindowPos2fv(const GLfloat *v);
- void glWindowPos2f(GLfloat x, GLfloat y);
- void glWindowPos2dv(const GLdouble *v);
- void glWindowPos2d(GLdouble x, GLdouble y);
- void glSecondaryColorPointer(GLint size, GLenum type, GLsizei stride, const GLvoid *pointer);
- void glSecondaryColor3usv(const GLushort *v);
- void glSecondaryColor3us(GLushort red, GLushort green, GLushort blue);
- void glSecondaryColor3uiv(const GLuint *v);
- void glSecondaryColor3ui(GLuint red, GLuint green, GLuint blue);
- void glSecondaryColor3ubv(const GLubyte *v);
- void glSecondaryColor3ub(GLubyte red, GLubyte green, GLubyte blue);
- void glSecondaryColor3sv(const GLshort *v);
- void glSecondaryColor3s(GLshort red, GLshort green, GLshort blue);
- void glSecondaryColor3iv(const GLint *v);
- void glSecondaryColor3i(GLint red, GLint green, GLint blue);
- void glSecondaryColor3fv(const GLfloat *v);
- void glSecondaryColor3f(GLfloat red, GLfloat green, GLfloat blue);
- void glSecondaryColor3dv(const GLdouble *v);
- void glSecondaryColor3d(GLdouble red, GLdouble green, GLdouble blue);
- void glSecondaryColor3bv(const GLbyte *v);
- void glSecondaryColor3b(GLbyte red, GLbyte green, GLbyte blue);
- void glFogCoordPointer(GLenum type, GLsizei stride, const GLvoid *pointer);
- void glFogCoorddv(const GLdouble *coord);
- void glFogCoordd(GLdouble coord);
- void glFogCoordfv(const GLfloat *coord);
- void glFogCoordf(GLfloat coord);
-
- // OpenGL 1.5 deprecated functions
-
- // OpenGL 2.0 deprecated functions
- void glVertexAttrib4usv(GLuint index, const GLushort *v);
- void glVertexAttrib4uiv(GLuint index, const GLuint *v);
- void glVertexAttrib4ubv(GLuint index, const GLubyte *v);
- void glVertexAttrib4sv(GLuint index, const GLshort *v);
- void glVertexAttrib4s(GLuint index, GLshort x, GLshort y, GLshort z, GLshort w);
- void glVertexAttrib4iv(GLuint index, const GLint *v);
- void glVertexAttrib4fv(GLuint index, const GLfloat *v);
- void glVertexAttrib4f(GLuint index, GLfloat x, GLfloat y, GLfloat z, GLfloat w);
- void glVertexAttrib4dv(GLuint index, const GLdouble *v);
- void glVertexAttrib4d(GLuint index, GLdouble x, GLdouble y, GLdouble z, GLdouble w);
- void glVertexAttrib4bv(GLuint index, const GLbyte *v);
- void glVertexAttrib4Nusv(GLuint index, const GLushort *v);
- void glVertexAttrib4Nuiv(GLuint index, const GLuint *v);
- void glVertexAttrib4Nubv(GLuint index, const GLubyte *v);
- void glVertexAttrib4Nub(GLuint index, GLubyte x, GLubyte y, GLubyte z, GLubyte w);
- void glVertexAttrib4Nsv(GLuint index, const GLshort *v);
- void glVertexAttrib4Niv(GLuint index, const GLint *v);
- void glVertexAttrib4Nbv(GLuint index, const GLbyte *v);
- void glVertexAttrib3sv(GLuint index, const GLshort *v);
- void glVertexAttrib3s(GLuint index, GLshort x, GLshort y, GLshort z);
- void glVertexAttrib3fv(GLuint index, const GLfloat *v);
- void glVertexAttrib3f(GLuint index, GLfloat x, GLfloat y, GLfloat z);
- void glVertexAttrib3dv(GLuint index, const GLdouble *v);
- void glVertexAttrib3d(GLuint index, GLdouble x, GLdouble y, GLdouble z);
- void glVertexAttrib2sv(GLuint index, const GLshort *v);
- void glVertexAttrib2s(GLuint index, GLshort x, GLshort y);
- void glVertexAttrib2fv(GLuint index, const GLfloat *v);
- void glVertexAttrib2f(GLuint index, GLfloat x, GLfloat y);
- void glVertexAttrib2dv(GLuint index, const GLdouble *v);
- void glVertexAttrib2d(GLuint index, GLdouble x, GLdouble y);
- void glVertexAttrib1sv(GLuint index, const GLshort *v);
- void glVertexAttrib1s(GLuint index, GLshort x);
- void glVertexAttrib1fv(GLuint index, const GLfloat *v);
- void glVertexAttrib1f(GLuint index, GLfloat x);
- void glVertexAttrib1dv(GLuint index, const GLdouble *v);
- void glVertexAttrib1d(GLuint index, GLdouble x);
-
- // OpenGL 2.1 deprecated functions
-
- // OpenGL 3.0 deprecated functions
- void glVertexAttribI4usv(GLuint index, const GLushort *v);
- void glVertexAttribI4ubv(GLuint index, const GLubyte *v);
- void glVertexAttribI4sv(GLuint index, const GLshort *v);
- void glVertexAttribI4bv(GLuint index, const GLbyte *v);
- void glVertexAttribI4uiv(GLuint index, const GLuint *v);
- void glVertexAttribI3uiv(GLuint index, const GLuint *v);
- void glVertexAttribI2uiv(GLuint index, const GLuint *v);
- void glVertexAttribI1uiv(GLuint index, const GLuint *v);
- void glVertexAttribI4iv(GLuint index, const GLint *v);
- void glVertexAttribI3iv(GLuint index, const GLint *v);
- void glVertexAttribI2iv(GLuint index, const GLint *v);
- void glVertexAttribI1iv(GLuint index, const GLint *v);
- void glVertexAttribI4ui(GLuint index, GLuint x, GLuint y, GLuint z, GLuint w);
- void glVertexAttribI3ui(GLuint index, GLuint x, GLuint y, GLuint z);
- void glVertexAttribI2ui(GLuint index, GLuint x, GLuint y);
- void glVertexAttribI1ui(GLuint index, GLuint x);
- void glVertexAttribI4i(GLuint index, GLint x, GLint y, GLint z, GLint w);
- void glVertexAttribI3i(GLuint index, GLint x, GLint y, GLint z);
- void glVertexAttribI2i(GLuint index, GLint x, GLint y);
- void glVertexAttribI1i(GLuint index, GLint x);
-
- // OpenGL 3.1 deprecated functions
-
- // OpenGL 3.2 deprecated functions
-
-private:
- friend class QOpenGLContext;
-
- static bool isContextCompatible(QOpenGLContext *context);
- static QOpenGLVersionProfile versionProfile();
-
- QOpenGLFunctions_1_0_CoreBackend* d_1_0_Core;
- QOpenGLFunctions_1_1_CoreBackend* d_1_1_Core;
- QOpenGLFunctions_1_2_CoreBackend* d_1_2_Core;
- QOpenGLFunctions_1_3_CoreBackend* d_1_3_Core;
- QOpenGLFunctions_1_4_CoreBackend* d_1_4_Core;
- QOpenGLFunctions_1_5_CoreBackend* d_1_5_Core;
- QOpenGLFunctions_2_0_CoreBackend* d_2_0_Core;
- QOpenGLFunctions_2_1_CoreBackend* d_2_1_Core;
- QOpenGLFunctions_3_0_CoreBackend* d_3_0_Core;
- QOpenGLFunctions_3_1_CoreBackend* d_3_1_Core;
- QOpenGLFunctions_3_2_CoreBackend* d_3_2_Core;
- QOpenGLFunctions_1_0_DeprecatedBackend* d_1_0_Deprecated;
- QOpenGLFunctions_1_1_DeprecatedBackend* d_1_1_Deprecated;
- QOpenGLFunctions_1_2_DeprecatedBackend* d_1_2_Deprecated;
- QOpenGLFunctions_1_3_DeprecatedBackend* d_1_3_Deprecated;
- QOpenGLFunctions_1_4_DeprecatedBackend* d_1_4_Deprecated;
- void *m_reserved_2_0_Deprecated; // To maintain BC
- void *m_reserved_3_0_Deprecated; // To maintain BC
-};
-
-// OpenGL 1.0 core functions
-inline void QOpenGLFunctions_3_2_Compatibility::glViewport(GLint x, GLint y, GLsizei width, GLsizei height)
-{
- d_1_0_Core->f.Viewport(x, y, width, height);
-}
-
-inline void QOpenGLFunctions_3_2_Compatibility::glDepthRange(GLdouble nearVal, GLdouble farVal)
-{
- d_1_0_Core->f.DepthRange(nearVal, farVal);
-}
-
-inline GLboolean QOpenGLFunctions_3_2_Compatibility::glIsEnabled(GLenum cap)
-{
- return d_1_0_Core->f.IsEnabled(cap);
-}
-
-inline void QOpenGLFunctions_3_2_Compatibility::glGetTexLevelParameteriv(GLenum target, GLint level, GLenum pname, GLint *params)
-{
- d_1_0_Core->f.GetTexLevelParameteriv(target, level, pname, params);
-}
-
-inline void QOpenGLFunctions_3_2_Compatibility::glGetTexLevelParameterfv(GLenum target, GLint level, GLenum pname, GLfloat *params)
-{
- d_1_0_Core->f.GetTexLevelParameterfv(target, level, pname, params);
-}
-
-inline void QOpenGLFunctions_3_2_Compatibility::glGetTexParameteriv(GLenum target, GLenum pname, GLint *params)
-{
- d_1_0_Core->f.GetTexParameteriv(target, pname, params);
-}
-
-inline void QOpenGLFunctions_3_2_Compatibility::glGetTexParameterfv(GLenum target, GLenum pname, GLfloat *params)
-{
- d_1_0_Core->f.GetTexParameterfv(target, pname, params);
-}
-
-inline void QOpenGLFunctions_3_2_Compatibility::glGetTexImage(GLenum target, GLint level, GLenum format, GLenum type, GLvoid *pixels)
-{
- d_1_0_Core->f.GetTexImage(target, level, format, type, pixels);
-}
-
-inline const GLubyte * QOpenGLFunctions_3_2_Compatibility::glGetString(GLenum name)
-{
- return d_1_0_Core->f.GetString(name);
-}
-
-inline void QOpenGLFunctions_3_2_Compatibility::glGetIntegerv(GLenum pname, GLint *params)
-{
- d_1_0_Core->f.GetIntegerv(pname, params);
-}
-
-inline void QOpenGLFunctions_3_2_Compatibility::glGetFloatv(GLenum pname, GLfloat *params)
-{
- d_1_0_Core->f.GetFloatv(pname, params);
-}
-
-inline GLenum QOpenGLFunctions_3_2_Compatibility::glGetError()
-{
- return d_1_0_Core->f.GetError();
-}
-
-inline void QOpenGLFunctions_3_2_Compatibility::glGetDoublev(GLenum pname, GLdouble *params)
-{
- d_1_0_Core->f.GetDoublev(pname, params);
-}
-
-inline void QOpenGLFunctions_3_2_Compatibility::glGetBooleanv(GLenum pname, GLboolean *params)
-{
- d_1_0_Core->f.GetBooleanv(pname, params);
-}
-
-inline void QOpenGLFunctions_3_2_Compatibility::glReadPixels(GLint x, GLint y, GLsizei width, GLsizei height, GLenum format, GLenum type, GLvoid *pixels)
-{
- d_1_0_Core->f.ReadPixels(x, y, width, height, format, type, pixels);
-}
-
-inline void QOpenGLFunctions_3_2_Compatibility::glReadBuffer(GLenum mode)
-{
- d_1_0_Core->f.ReadBuffer(mode);
-}
-
-inline void QOpenGLFunctions_3_2_Compatibility::glPixelStorei(GLenum pname, GLint param)
-{
- d_1_0_Core->f.PixelStorei(pname, param);
-}
-
-inline void QOpenGLFunctions_3_2_Compatibility::glPixelStoref(GLenum pname, GLfloat param)
-{
- d_1_0_Core->f.PixelStoref(pname, param);
-}
-
-inline void QOpenGLFunctions_3_2_Compatibility::glDepthFunc(GLenum func)
-{
- d_1_0_Core->f.DepthFunc(func);
-}
-
-inline void QOpenGLFunctions_3_2_Compatibility::glStencilOp(GLenum fail, GLenum zfail, GLenum zpass)
-{
- d_1_0_Core->f.StencilOp(fail, zfail, zpass);
-}
-
-inline void QOpenGLFunctions_3_2_Compatibility::glStencilFunc(GLenum func, GLint ref, GLuint mask)
-{
- d_1_0_Core->f.StencilFunc(func, ref, mask);
-}
-
-inline void QOpenGLFunctions_3_2_Compatibility::glLogicOp(GLenum opcode)
-{
- d_1_0_Core->f.LogicOp(opcode);
-}
-
-inline void QOpenGLFunctions_3_2_Compatibility::glBlendFunc(GLenum sfactor, GLenum dfactor)
-{
- d_1_0_Core->f.BlendFunc(sfactor, dfactor);
-}
-
-inline void QOpenGLFunctions_3_2_Compatibility::glFlush()
-{
- d_1_0_Core->f.Flush();
-}
-
-inline void QOpenGLFunctions_3_2_Compatibility::glFinish()
-{
- d_1_0_Core->f.Finish();
-}
-
-inline void QOpenGLFunctions_3_2_Compatibility::glEnable(GLenum cap)
-{
- d_1_0_Core->f.Enable(cap);
-}
-
-inline void QOpenGLFunctions_3_2_Compatibility::glDisable(GLenum cap)
-{
- d_1_0_Core->f.Disable(cap);
-}
-
-inline void QOpenGLFunctions_3_2_Compatibility::glDepthMask(GLboolean flag)
-{
- d_1_0_Core->f.DepthMask(flag);
-}
-
-inline void QOpenGLFunctions_3_2_Compatibility::glColorMask(GLboolean red, GLboolean green, GLboolean blue, GLboolean alpha)
-{
- d_1_0_Core->f.ColorMask(red, green, blue, alpha);
-}
-
-inline void QOpenGLFunctions_3_2_Compatibility::glStencilMask(GLuint mask)
-{
- d_1_0_Core->f.StencilMask(mask);
-}
-
-inline void QOpenGLFunctions_3_2_Compatibility::glClearDepth(GLdouble depth)
-{
- d_1_0_Core->f.ClearDepth(depth);
-}
-
-inline void QOpenGLFunctions_3_2_Compatibility::glClearStencil(GLint s)
-{
- d_1_0_Core->f.ClearStencil(s);
-}
-
-inline void QOpenGLFunctions_3_2_Compatibility::glClearColor(GLfloat red, GLfloat green, GLfloat blue, GLfloat alpha)
-{
- d_1_0_Core->f.ClearColor(red, green, blue, alpha);
-}
-
-inline void QOpenGLFunctions_3_2_Compatibility::glClear(GLbitfield mask)
-{
- d_1_0_Core->f.Clear(mask);
-}
-
-inline void QOpenGLFunctions_3_2_Compatibility::glDrawBuffer(GLenum mode)
-{
- d_1_0_Core->f.DrawBuffer(mode);
-}
-
-inline void QOpenGLFunctions_3_2_Compatibility::glTexImage2D(GLenum target, GLint level, GLint internalformat, GLsizei width, GLsizei height, GLint border, GLenum format, GLenum type, const GLvoid *pixels)
-{
- d_1_0_Core->f.TexImage2D(target, level, internalformat, width, height, border, format, type, pixels);
-}
-
-inline void QOpenGLFunctions_3_2_Compatibility::glTexImage1D(GLenum target, GLint level, GLint internalformat, GLsizei width, GLint border, GLenum format, GLenum type, const GLvoid *pixels)
-{
- d_1_0_Core->f.TexImage1D(target, level, internalformat, width, border, format, type, pixels);
-}
-
-inline void QOpenGLFunctions_3_2_Compatibility::glTexParameteriv(GLenum target, GLenum pname, const GLint *params)
-{
- d_1_0_Core->f.TexParameteriv(target, pname, params);
-}
-
-inline void QOpenGLFunctions_3_2_Compatibility::glTexParameteri(GLenum target, GLenum pname, GLint param)
-{
- d_1_0_Core->f.TexParameteri(target, pname, param);
-}
-
-inline void QOpenGLFunctions_3_2_Compatibility::glTexParameterfv(GLenum target, GLenum pname, const GLfloat *params)
-{
- d_1_0_Core->f.TexParameterfv(target, pname, params);
-}
-
-inline void QOpenGLFunctions_3_2_Compatibility::glTexParameterf(GLenum target, GLenum pname, GLfloat param)
-{
- d_1_0_Core->f.TexParameterf(target, pname, param);
-}
-
-inline void QOpenGLFunctions_3_2_Compatibility::glScissor(GLint x, GLint y, GLsizei width, GLsizei height)
-{
- d_1_0_Core->f.Scissor(x, y, width, height);
-}
-
-inline void QOpenGLFunctions_3_2_Compatibility::glPolygonMode(GLenum face, GLenum mode)
-{
- d_1_0_Core->f.PolygonMode(face, mode);
-}
-
-inline void QOpenGLFunctions_3_2_Compatibility::glPointSize(GLfloat size)
-{
- d_1_0_Core->f.PointSize(size);
-}
-
-inline void QOpenGLFunctions_3_2_Compatibility::glLineWidth(GLfloat width)
-{
- d_1_0_Core->f.LineWidth(width);
-}
-
-inline void QOpenGLFunctions_3_2_Compatibility::glHint(GLenum target, GLenum mode)
-{
- d_1_0_Core->f.Hint(target, mode);
-}
-
-inline void QOpenGLFunctions_3_2_Compatibility::glFrontFace(GLenum mode)
-{
- d_1_0_Core->f.FrontFace(mode);
-}
-
-inline void QOpenGLFunctions_3_2_Compatibility::glCullFace(GLenum mode)
-{
- d_1_0_Core->f.CullFace(mode);
-}
-
-
-// OpenGL 1.1 core functions
-inline void QOpenGLFunctions_3_2_Compatibility::glIndexubv(const GLubyte *c)
-{
- d_1_1_Deprecated->f.Indexubv(c);
-}
-
-inline void QOpenGLFunctions_3_2_Compatibility::glIndexub(GLubyte c)
-{
- d_1_1_Deprecated->f.Indexub(c);
-}
-
-inline GLboolean QOpenGLFunctions_3_2_Compatibility::glIsTexture(GLuint texture)
-{
- return d_1_1_Core->f.IsTexture(texture);
-}
-
-inline void QOpenGLFunctions_3_2_Compatibility::glGenTextures(GLsizei n, GLuint *textures)
-{
- d_1_1_Core->f.GenTextures(n, textures);
-}
-
-inline void QOpenGLFunctions_3_2_Compatibility::glDeleteTextures(GLsizei n, const GLuint *textures)
-{
- d_1_1_Core->f.DeleteTextures(n, textures);
-}
-
-inline void QOpenGLFunctions_3_2_Compatibility::glBindTexture(GLenum target, GLuint texture)
-{
- d_1_1_Core->f.BindTexture(target, texture);
-}
-
-inline void QOpenGLFunctions_3_2_Compatibility::glTexSubImage2D(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLenum type, const GLvoid *pixels)
-{
- d_1_1_Core->f.TexSubImage2D(target, level, xoffset, yoffset, width, height, format, type, pixels);
-}
-
-inline void QOpenGLFunctions_3_2_Compatibility::glTexSubImage1D(GLenum target, GLint level, GLint xoffset, GLsizei width, GLenum format, GLenum type, const GLvoid *pixels)
-{
- d_1_1_Core->f.TexSubImage1D(target, level, xoffset, width, format, type, pixels);
-}
-
-inline void QOpenGLFunctions_3_2_Compatibility::glCopyTexSubImage2D(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint x, GLint y, GLsizei width, GLsizei height)
-{
- d_1_1_Core->f.CopyTexSubImage2D(target, level, xoffset, yoffset, x, y, width, height);
-}
-
-inline void QOpenGLFunctions_3_2_Compatibility::glCopyTexSubImage1D(GLenum target, GLint level, GLint xoffset, GLint x, GLint y, GLsizei width)
-{
- d_1_1_Core->f.CopyTexSubImage1D(target, level, xoffset, x, y, width);
-}
-
-inline void QOpenGLFunctions_3_2_Compatibility::glCopyTexImage2D(GLenum target, GLint level, GLenum internalformat, GLint x, GLint y, GLsizei width, GLsizei height, GLint border)
-{
- d_1_1_Core->f.CopyTexImage2D(target, level, internalformat, x, y, width, height, border);
-}
-
-inline void QOpenGLFunctions_3_2_Compatibility::glCopyTexImage1D(GLenum target, GLint level, GLenum internalformat, GLint x, GLint y, GLsizei width, GLint border)
-{
- d_1_1_Core->f.CopyTexImage1D(target, level, internalformat, x, y, width, border);
-}
-
-inline void QOpenGLFunctions_3_2_Compatibility::glPolygonOffset(GLfloat factor, GLfloat units)
-{
- d_1_1_Core->f.PolygonOffset(factor, units);
-}
-
-inline void QOpenGLFunctions_3_2_Compatibility::glGetPointerv(GLenum pname, GLvoid* *params)
-{
- d_1_1_Deprecated->f.GetPointerv(pname, params);
-}
-
-inline void QOpenGLFunctions_3_2_Compatibility::glDrawElements(GLenum mode, GLsizei count, GLenum type, const GLvoid *indices)
-{
- d_1_1_Core->f.DrawElements(mode, count, type, indices);
-}
-
-inline void QOpenGLFunctions_3_2_Compatibility::glDrawArrays(GLenum mode, GLint first, GLsizei count)
-{
- d_1_1_Core->f.DrawArrays(mode, first, count);
-}
-
-
-// OpenGL 1.2 core functions
-inline void QOpenGLFunctions_3_2_Compatibility::glCopyTexSubImage3D(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLint x, GLint y, GLsizei width, GLsizei height)
-{
- d_1_2_Core->f.CopyTexSubImage3D(target, level, xoffset, yoffset, zoffset, x, y, width, height);
-}
-
-inline void QOpenGLFunctions_3_2_Compatibility::glTexSubImage3D(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLenum type, const GLvoid *pixels)
-{
- d_1_2_Core->f.TexSubImage3D(target, level, xoffset, yoffset, zoffset, width, height, depth, format, type, pixels);
-}
-
-inline void QOpenGLFunctions_3_2_Compatibility::glTexImage3D(GLenum target, GLint level, GLint internalformat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLenum format, GLenum type, const GLvoid *pixels)
-{
- d_1_2_Core->f.TexImage3D(target, level, internalformat, width, height, depth, border, format, type, pixels);
-}
-
-inline void QOpenGLFunctions_3_2_Compatibility::glDrawRangeElements(GLenum mode, GLuint start, GLuint end, GLsizei count, GLenum type, const GLvoid *indices)
-{
- d_1_2_Core->f.DrawRangeElements(mode, start, end, count, type, indices);
-}
-
-inline void QOpenGLFunctions_3_2_Compatibility::glBlendEquation(GLenum mode)
-{
- d_1_2_Core->f.BlendEquation(mode);
-}
-
-inline void QOpenGLFunctions_3_2_Compatibility::glBlendColor(GLfloat red, GLfloat green, GLfloat blue, GLfloat alpha)
-{
- d_1_2_Core->f.BlendColor(red, green, blue, alpha);
-}
-
-
-// OpenGL 1.3 core functions
-inline void QOpenGLFunctions_3_2_Compatibility::glGetCompressedTexImage(GLenum target, GLint level, GLvoid *img)
-{
- d_1_3_Core->f.GetCompressedTexImage(target, level, img);
-}
-
-inline void QOpenGLFunctions_3_2_Compatibility::glCompressedTexSubImage1D(GLenum target, GLint level, GLint xoffset, GLsizei width, GLenum format, GLsizei imageSize, const GLvoid *data)
-{
- d_1_3_Core->f.CompressedTexSubImage1D(target, level, xoffset, width, format, imageSize, data);
-}
-
-inline void QOpenGLFunctions_3_2_Compatibility::glCompressedTexSubImage2D(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLsizei imageSize, const GLvoid *data)
-{
- d_1_3_Core->f.CompressedTexSubImage2D(target, level, xoffset, yoffset, width, height, format, imageSize, data);
-}
-
-inline void QOpenGLFunctions_3_2_Compatibility::glCompressedTexSubImage3D(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLsizei imageSize, const GLvoid *data)
-{
- d_1_3_Core->f.CompressedTexSubImage3D(target, level, xoffset, yoffset, zoffset, width, height, depth, format, imageSize, data);
-}
-
-inline void QOpenGLFunctions_3_2_Compatibility::glCompressedTexImage1D(GLenum target, GLint level, GLenum internalformat, GLsizei width, GLint border, GLsizei imageSize, const GLvoid *data)
-{
- d_1_3_Core->f.CompressedTexImage1D(target, level, internalformat, width, border, imageSize, data);
-}
-
-inline void QOpenGLFunctions_3_2_Compatibility::glCompressedTexImage2D(GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLint border, GLsizei imageSize, const GLvoid *data)
-{
- d_1_3_Core->f.CompressedTexImage2D(target, level, internalformat, width, height, border, imageSize, data);
-}
-
-inline void QOpenGLFunctions_3_2_Compatibility::glCompressedTexImage3D(GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLsizei imageSize, const GLvoid *data)
-{
- d_1_3_Core->f.CompressedTexImage3D(target, level, internalformat, width, height, depth, border, imageSize, data);
-}
-
-inline void QOpenGLFunctions_3_2_Compatibility::glSampleCoverage(GLfloat value, GLboolean invert)
-{
- d_1_3_Core->f.SampleCoverage(value, invert);
-}
-
-inline void QOpenGLFunctions_3_2_Compatibility::glActiveTexture(GLenum texture)
-{
- d_1_3_Core->f.ActiveTexture(texture);
-}
-
-
-// OpenGL 1.4 core functions
-inline void QOpenGLFunctions_3_2_Compatibility::glPointParameteriv(GLenum pname, const GLint *params)
-{
- d_1_4_Core->f.PointParameteriv(pname, params);
-}
-
-inline void QOpenGLFunctions_3_2_Compatibility::glPointParameteri(GLenum pname, GLint param)
-{
- d_1_4_Core->f.PointParameteri(pname, param);
-}
-
-inline void QOpenGLFunctions_3_2_Compatibility::glPointParameterfv(GLenum pname, const GLfloat *params)
-{
- d_1_4_Core->f.PointParameterfv(pname, params);
-}
-
-inline void QOpenGLFunctions_3_2_Compatibility::glPointParameterf(GLenum pname, GLfloat param)
-{
- d_1_4_Core->f.PointParameterf(pname, param);
-}
-
-inline void QOpenGLFunctions_3_2_Compatibility::glMultiDrawElements(GLenum mode, const GLsizei *count, GLenum type, const GLvoid* const *indices, GLsizei drawcount)
-{
- d_1_4_Core->f.MultiDrawElements(mode, count, type, indices, drawcount);
-}
-
-inline void QOpenGLFunctions_3_2_Compatibility::glMultiDrawArrays(GLenum mode, const GLint *first, const GLsizei *count, GLsizei drawcount)
-{
- d_1_4_Core->f.MultiDrawArrays(mode, first, count, drawcount);
-}
-
-inline void QOpenGLFunctions_3_2_Compatibility::glBlendFuncSeparate(GLenum sfactorRGB, GLenum dfactorRGB, GLenum sfactorAlpha, GLenum dfactorAlpha)
-{
- d_1_4_Core->f.BlendFuncSeparate(sfactorRGB, dfactorRGB, sfactorAlpha, dfactorAlpha);
-}
-
-
-// OpenGL 1.5 core functions
-inline void QOpenGLFunctions_3_2_Compatibility::glGetBufferPointerv(GLenum target, GLenum pname, GLvoid* *params)
-{
- d_1_5_Core->f.GetBufferPointerv(target, pname, params);
-}
-
-inline void QOpenGLFunctions_3_2_Compatibility::glGetBufferParameteriv(GLenum target, GLenum pname, GLint *params)
-{
- d_1_5_Core->f.GetBufferParameteriv(target, pname, params);
-}
-
-inline GLboolean QOpenGLFunctions_3_2_Compatibility::glUnmapBuffer(GLenum target)
-{
- return d_1_5_Core->f.UnmapBuffer(target);
-}
-
-inline GLvoid* QOpenGLFunctions_3_2_Compatibility::glMapBuffer(GLenum target, GLenum access)
-{
- return d_1_5_Core->f.MapBuffer(target, access);
-}
-
-inline void QOpenGLFunctions_3_2_Compatibility::glGetBufferSubData(GLenum target, GLintptr offset, GLsizeiptr size, GLvoid *data)
-{
- d_1_5_Core->f.GetBufferSubData(target, offset, size, data);
-}
-
-inline void QOpenGLFunctions_3_2_Compatibility::glBufferSubData(GLenum target, GLintptr offset, GLsizeiptr size, const GLvoid *data)
-{
- d_1_5_Core->f.BufferSubData(target, offset, size, data);
-}
-
-inline void QOpenGLFunctions_3_2_Compatibility::glBufferData(GLenum target, GLsizeiptr size, const GLvoid *data, GLenum usage)
-{
- d_1_5_Core->f.BufferData(target, size, data, usage);
-}
-
-inline GLboolean QOpenGLFunctions_3_2_Compatibility::glIsBuffer(GLuint buffer)
-{
- return d_1_5_Core->f.IsBuffer(buffer);
-}
-
-inline void QOpenGLFunctions_3_2_Compatibility::glGenBuffers(GLsizei n, GLuint *buffers)
-{
- d_1_5_Core->f.GenBuffers(n, buffers);
-}
-
-inline void QOpenGLFunctions_3_2_Compatibility::glDeleteBuffers(GLsizei n, const GLuint *buffers)
-{
- d_1_5_Core->f.DeleteBuffers(n, buffers);
-}
-
-inline void QOpenGLFunctions_3_2_Compatibility::glBindBuffer(GLenum target, GLuint buffer)
-{
- d_1_5_Core->f.BindBuffer(target, buffer);
-}
-
-inline void QOpenGLFunctions_3_2_Compatibility::glGetQueryObjectuiv(GLuint id, GLenum pname, GLuint *params)
-{
- d_1_5_Core->f.GetQueryObjectuiv(id, pname, params);
-}
-
-inline void QOpenGLFunctions_3_2_Compatibility::glGetQueryObjectiv(GLuint id, GLenum pname, GLint *params)
-{
- d_1_5_Core->f.GetQueryObjectiv(id, pname, params);
-}
-
-inline void QOpenGLFunctions_3_2_Compatibility::glGetQueryiv(GLenum target, GLenum pname, GLint *params)
-{
- d_1_5_Core->f.GetQueryiv(target, pname, params);
-}
-
-inline void QOpenGLFunctions_3_2_Compatibility::glEndQuery(GLenum target)
-{
- d_1_5_Core->f.EndQuery(target);
-}
-
-inline void QOpenGLFunctions_3_2_Compatibility::glBeginQuery(GLenum target, GLuint id)
-{
- d_1_5_Core->f.BeginQuery(target, id);
-}
-
-inline GLboolean QOpenGLFunctions_3_2_Compatibility::glIsQuery(GLuint id)
-{
- return d_1_5_Core->f.IsQuery(id);
-}
-
-inline void QOpenGLFunctions_3_2_Compatibility::glDeleteQueries(GLsizei n, const GLuint *ids)
-{
- d_1_5_Core->f.DeleteQueries(n, ids);
-}
-
-inline void QOpenGLFunctions_3_2_Compatibility::glGenQueries(GLsizei n, GLuint *ids)
-{
- d_1_5_Core->f.GenQueries(n, ids);
-}
-
-
-// OpenGL 2.0 core functions
-inline void QOpenGLFunctions_3_2_Compatibility::glVertexAttribPointer(GLuint index, GLint size, GLenum type, GLboolean normalized, GLsizei stride, const GLvoid *pointer)
-{
- d_2_0_Core->f.VertexAttribPointer(index, size, type, normalized, stride, pointer);
-}
-
-inline void QOpenGLFunctions_3_2_Compatibility::glValidateProgram(GLuint program)
-{
- d_2_0_Core->f.ValidateProgram(program);
-}
-
-inline void QOpenGLFunctions_3_2_Compatibility::glUniformMatrix4fv(GLint location, GLsizei count, GLboolean transpose, const GLfloat *value)
-{
- d_2_0_Core->f.UniformMatrix4fv(location, count, transpose, value);
-}
-
-inline void QOpenGLFunctions_3_2_Compatibility::glUniformMatrix3fv(GLint location, GLsizei count, GLboolean transpose, const GLfloat *value)
-{
- d_2_0_Core->f.UniformMatrix3fv(location, count, transpose, value);
-}
-
-inline void QOpenGLFunctions_3_2_Compatibility::glUniformMatrix2fv(GLint location, GLsizei count, GLboolean transpose, const GLfloat *value)
-{
- d_2_0_Core->f.UniformMatrix2fv(location, count, transpose, value);
-}
-
-inline void QOpenGLFunctions_3_2_Compatibility::glUniform4iv(GLint location, GLsizei count, const GLint *value)
-{
- d_2_0_Core->f.Uniform4iv(location, count, value);
-}
-
-inline void QOpenGLFunctions_3_2_Compatibility::glUniform3iv(GLint location, GLsizei count, const GLint *value)
-{
- d_2_0_Core->f.Uniform3iv(location, count, value);
-}
-
-inline void QOpenGLFunctions_3_2_Compatibility::glUniform2iv(GLint location, GLsizei count, const GLint *value)
-{
- d_2_0_Core->f.Uniform2iv(location, count, value);
-}
-
-inline void QOpenGLFunctions_3_2_Compatibility::glUniform1iv(GLint location, GLsizei count, const GLint *value)
-{
- d_2_0_Core->f.Uniform1iv(location, count, value);
-}
-
-inline void QOpenGLFunctions_3_2_Compatibility::glUniform4fv(GLint location, GLsizei count, const GLfloat *value)
-{
- d_2_0_Core->f.Uniform4fv(location, count, value);
-}
-
-inline void QOpenGLFunctions_3_2_Compatibility::glUniform3fv(GLint location, GLsizei count, const GLfloat *value)
-{
- d_2_0_Core->f.Uniform3fv(location, count, value);
-}
-
-inline void QOpenGLFunctions_3_2_Compatibility::glUniform2fv(GLint location, GLsizei count, const GLfloat *value)
-{
- d_2_0_Core->f.Uniform2fv(location, count, value);
-}
-
-inline void QOpenGLFunctions_3_2_Compatibility::glUniform1fv(GLint location, GLsizei count, const GLfloat *value)
-{
- d_2_0_Core->f.Uniform1fv(location, count, value);
-}
-
-inline void QOpenGLFunctions_3_2_Compatibility::glUniform4i(GLint location, GLint v0, GLint v1, GLint v2, GLint v3)
-{
- d_2_0_Core->f.Uniform4i(location, v0, v1, v2, v3);
-}
-
-inline void QOpenGLFunctions_3_2_Compatibility::glUniform3i(GLint location, GLint v0, GLint v1, GLint v2)
-{
- d_2_0_Core->f.Uniform3i(location, v0, v1, v2);
-}
-
-inline void QOpenGLFunctions_3_2_Compatibility::glUniform2i(GLint location, GLint v0, GLint v1)
-{
- d_2_0_Core->f.Uniform2i(location, v0, v1);
-}
-
-inline void QOpenGLFunctions_3_2_Compatibility::glUniform1i(GLint location, GLint v0)
-{
- d_2_0_Core->f.Uniform1i(location, v0);
-}
-
-inline void QOpenGLFunctions_3_2_Compatibility::glUniform4f(GLint location, GLfloat v0, GLfloat v1, GLfloat v2, GLfloat v3)
-{
- d_2_0_Core->f.Uniform4f(location, v0, v1, v2, v3);
-}
-
-inline void QOpenGLFunctions_3_2_Compatibility::glUniform3f(GLint location, GLfloat v0, GLfloat v1, GLfloat v2)
-{
- d_2_0_Core->f.Uniform3f(location, v0, v1, v2);
-}
-
-inline void QOpenGLFunctions_3_2_Compatibility::glUniform2f(GLint location, GLfloat v0, GLfloat v1)
-{
- d_2_0_Core->f.Uniform2f(location, v0, v1);
-}
-
-inline void QOpenGLFunctions_3_2_Compatibility::glUniform1f(GLint location, GLfloat v0)
-{
- d_2_0_Core->f.Uniform1f(location, v0);
-}
-
-inline void QOpenGLFunctions_3_2_Compatibility::glUseProgram(GLuint program)
-{
- d_2_0_Core->f.UseProgram(program);
-}
-
-inline void QOpenGLFunctions_3_2_Compatibility::glShaderSource(GLuint shader, GLsizei count, const GLchar* const *string, const GLint *length)
-{
- d_2_0_Core->f.ShaderSource(shader, count, string, length);
-}
-
-inline void QOpenGLFunctions_3_2_Compatibility::glLinkProgram(GLuint program)
-{
- d_2_0_Core->f.LinkProgram(program);
-}
-
-inline GLboolean QOpenGLFunctions_3_2_Compatibility::glIsShader(GLuint shader)
-{
- return d_2_0_Core->f.IsShader(shader);
-}
-
-inline GLboolean QOpenGLFunctions_3_2_Compatibility::glIsProgram(GLuint program)
-{
- return d_2_0_Core->f.IsProgram(program);
-}
-
-inline void QOpenGLFunctions_3_2_Compatibility::glGetVertexAttribPointerv(GLuint index, GLenum pname, GLvoid* *pointer)
-{
- d_2_0_Core->f.GetVertexAttribPointerv(index, pname, pointer);
-}
-
-inline void QOpenGLFunctions_3_2_Compatibility::glGetVertexAttribiv(GLuint index, GLenum pname, GLint *params)
-{
- d_2_0_Core->f.GetVertexAttribiv(index, pname, params);
-}
-
-inline void QOpenGLFunctions_3_2_Compatibility::glGetVertexAttribfv(GLuint index, GLenum pname, GLfloat *params)
-{
- d_2_0_Core->f.GetVertexAttribfv(index, pname, params);
-}
-
-inline void QOpenGLFunctions_3_2_Compatibility::glGetVertexAttribdv(GLuint index, GLenum pname, GLdouble *params)
-{
- d_2_0_Core->f.GetVertexAttribdv(index, pname, params);
-}
-
-inline void QOpenGLFunctions_3_2_Compatibility::glGetUniformiv(GLuint program, GLint location, GLint *params)
-{
- d_2_0_Core->f.GetUniformiv(program, location, params);
-}
-
-inline void QOpenGLFunctions_3_2_Compatibility::glGetUniformfv(GLuint program, GLint location, GLfloat *params)
-{
- d_2_0_Core->f.GetUniformfv(program, location, params);
-}
-
-inline GLint QOpenGLFunctions_3_2_Compatibility::glGetUniformLocation(GLuint program, const GLchar *name)
-{
- return d_2_0_Core->f.GetUniformLocation(program, name);
-}
-
-inline void QOpenGLFunctions_3_2_Compatibility::glGetShaderSource(GLuint shader, GLsizei bufSize, GLsizei *length, GLchar *source)
-{
- d_2_0_Core->f.GetShaderSource(shader, bufSize, length, source);
-}
-
-inline void QOpenGLFunctions_3_2_Compatibility::glGetShaderInfoLog(GLuint shader, GLsizei bufSize, GLsizei *length, GLchar *infoLog)
-{
- d_2_0_Core->f.GetShaderInfoLog(shader, bufSize, length, infoLog);
-}
-
-inline void QOpenGLFunctions_3_2_Compatibility::glGetShaderiv(GLuint shader, GLenum pname, GLint *params)
-{
- d_2_0_Core->f.GetShaderiv(shader, pname, params);
-}
-
-inline void QOpenGLFunctions_3_2_Compatibility::glGetProgramInfoLog(GLuint program, GLsizei bufSize, GLsizei *length, GLchar *infoLog)
-{
- d_2_0_Core->f.GetProgramInfoLog(program, bufSize, length, infoLog);
-}
-
-inline void QOpenGLFunctions_3_2_Compatibility::glGetProgramiv(GLuint program, GLenum pname, GLint *params)
-{
- d_2_0_Core->f.GetProgramiv(program, pname, params);
-}
-
-inline GLint QOpenGLFunctions_3_2_Compatibility::glGetAttribLocation(GLuint program, const GLchar *name)
-{
- return d_2_0_Core->f.GetAttribLocation(program, name);
-}
-
-inline void QOpenGLFunctions_3_2_Compatibility::glGetAttachedShaders(GLuint program, GLsizei maxCount, GLsizei *count, GLuint *obj)
-{
- d_2_0_Core->f.GetAttachedShaders(program, maxCount, count, obj);
-}
-
-inline void QOpenGLFunctions_3_2_Compatibility::glGetActiveUniform(GLuint program, GLuint index, GLsizei bufSize, GLsizei *length, GLint *size, GLenum *type, GLchar *name)
-{
- d_2_0_Core->f.GetActiveUniform(program, index, bufSize, length, size, type, name);
-}
-
-inline void QOpenGLFunctions_3_2_Compatibility::glGetActiveAttrib(GLuint program, GLuint index, GLsizei bufSize, GLsizei *length, GLint *size, GLenum *type, GLchar *name)
-{
- d_2_0_Core->f.GetActiveAttrib(program, index, bufSize, length, size, type, name);
-}
-
-inline void QOpenGLFunctions_3_2_Compatibility::glEnableVertexAttribArray(GLuint index)
-{
- d_2_0_Core->f.EnableVertexAttribArray(index);
-}
-
-inline void QOpenGLFunctions_3_2_Compatibility::glDisableVertexAttribArray(GLuint index)
-{
- d_2_0_Core->f.DisableVertexAttribArray(index);
-}
-
-inline void QOpenGLFunctions_3_2_Compatibility::glDetachShader(GLuint program, GLuint shader)
-{
- d_2_0_Core->f.DetachShader(program, shader);
-}
-
-inline void QOpenGLFunctions_3_2_Compatibility::glDeleteShader(GLuint shader)
-{
- d_2_0_Core->f.DeleteShader(shader);
-}
-
-inline void QOpenGLFunctions_3_2_Compatibility::glDeleteProgram(GLuint program)
-{
- d_2_0_Core->f.DeleteProgram(program);
-}
-
-inline GLuint QOpenGLFunctions_3_2_Compatibility::glCreateShader(GLenum type)
-{
- return d_2_0_Core->f.CreateShader(type);
-}
-
-inline GLuint QOpenGLFunctions_3_2_Compatibility::glCreateProgram()
-{
- return d_2_0_Core->f.CreateProgram();
-}
-
-inline void QOpenGLFunctions_3_2_Compatibility::glCompileShader(GLuint shader)
-{
- d_2_0_Core->f.CompileShader(shader);
-}
-
-inline void QOpenGLFunctions_3_2_Compatibility::glBindAttribLocation(GLuint program, GLuint index, const GLchar *name)
-{
- d_2_0_Core->f.BindAttribLocation(program, index, name);
-}
-
-inline void QOpenGLFunctions_3_2_Compatibility::glAttachShader(GLuint program, GLuint shader)
-{
- d_2_0_Core->f.AttachShader(program, shader);
-}
-
-inline void QOpenGLFunctions_3_2_Compatibility::glStencilMaskSeparate(GLenum face, GLuint mask)
-{
- d_2_0_Core->f.StencilMaskSeparate(face, mask);
-}
-
-inline void QOpenGLFunctions_3_2_Compatibility::glStencilFuncSeparate(GLenum face, GLenum func, GLint ref, GLuint mask)
-{
- d_2_0_Core->f.StencilFuncSeparate(face, func, ref, mask);
-}
-
-inline void QOpenGLFunctions_3_2_Compatibility::glStencilOpSeparate(GLenum face, GLenum sfail, GLenum dpfail, GLenum dppass)
-{
- d_2_0_Core->f.StencilOpSeparate(face, sfail, dpfail, dppass);
-}
-
-inline void QOpenGLFunctions_3_2_Compatibility::glDrawBuffers(GLsizei n, const GLenum *bufs)
-{
- d_2_0_Core->f.DrawBuffers(n, bufs);
-}
-
-inline void QOpenGLFunctions_3_2_Compatibility::glBlendEquationSeparate(GLenum modeRGB, GLenum modeAlpha)
-{
- d_2_0_Core->f.BlendEquationSeparate(modeRGB, modeAlpha);
-}
-
-
-// OpenGL 2.1 core functions
-inline void QOpenGLFunctions_3_2_Compatibility::glUniformMatrix4x3fv(GLint location, GLsizei count, GLboolean transpose, const GLfloat *value)
-{
- d_2_1_Core->f.UniformMatrix4x3fv(location, count, transpose, value);
-}
-
-inline void QOpenGLFunctions_3_2_Compatibility::glUniformMatrix3x4fv(GLint location, GLsizei count, GLboolean transpose, const GLfloat *value)
-{
- d_2_1_Core->f.UniformMatrix3x4fv(location, count, transpose, value);
-}
-
-inline void QOpenGLFunctions_3_2_Compatibility::glUniformMatrix4x2fv(GLint location, GLsizei count, GLboolean transpose, const GLfloat *value)
-{
- d_2_1_Core->f.UniformMatrix4x2fv(location, count, transpose, value);
-}
-
-inline void QOpenGLFunctions_3_2_Compatibility::glUniformMatrix2x4fv(GLint location, GLsizei count, GLboolean transpose, const GLfloat *value)
-{
- d_2_1_Core->f.UniformMatrix2x4fv(location, count, transpose, value);
-}
-
-inline void QOpenGLFunctions_3_2_Compatibility::glUniformMatrix3x2fv(GLint location, GLsizei count, GLboolean transpose, const GLfloat *value)
-{
- d_2_1_Core->f.UniformMatrix3x2fv(location, count, transpose, value);
-}
-
-inline void QOpenGLFunctions_3_2_Compatibility::glUniformMatrix2x3fv(GLint location, GLsizei count, GLboolean transpose, const GLfloat *value)
-{
- d_2_1_Core->f.UniformMatrix2x3fv(location, count, transpose, value);
-}
-
-
-// OpenGL 3.0 core functions
-inline GLboolean QOpenGLFunctions_3_2_Compatibility::glIsVertexArray(GLuint array)
-{
- return d_3_0_Core->f.IsVertexArray(array);
-}
-
-inline void QOpenGLFunctions_3_2_Compatibility::glGenVertexArrays(GLsizei n, GLuint *arrays)
-{
- d_3_0_Core->f.GenVertexArrays(n, arrays);
-}
-
-inline void QOpenGLFunctions_3_2_Compatibility::glDeleteVertexArrays(GLsizei n, const GLuint *arrays)
-{
- d_3_0_Core->f.DeleteVertexArrays(n, arrays);
-}
-
-inline void QOpenGLFunctions_3_2_Compatibility::glBindVertexArray(GLuint array)
-{
- d_3_0_Core->f.BindVertexArray(array);
-}
-
-inline void QOpenGLFunctions_3_2_Compatibility::glFlushMappedBufferRange(GLenum target, GLintptr offset, GLsizeiptr length)
-{
- d_3_0_Core->f.FlushMappedBufferRange(target, offset, length);
-}
-
-inline GLvoid* QOpenGLFunctions_3_2_Compatibility::glMapBufferRange(GLenum target, GLintptr offset, GLsizeiptr length, GLbitfield access)
-{
- return d_3_0_Core->f.MapBufferRange(target, offset, length, access);
-}
-
-inline void QOpenGLFunctions_3_2_Compatibility::glFramebufferTextureLayer(GLenum target, GLenum attachment, GLuint texture, GLint level, GLint layer)
-{
- d_3_0_Core->f.FramebufferTextureLayer(target, attachment, texture, level, layer);
-}
-
-inline void QOpenGLFunctions_3_2_Compatibility::glRenderbufferStorageMultisample(GLenum target, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height)
-{
- d_3_0_Core->f.RenderbufferStorageMultisample(target, samples, internalformat, width, height);
-}
-
-inline void QOpenGLFunctions_3_2_Compatibility::glBlitFramebuffer(GLint srcX0, GLint srcY0, GLint srcX1, GLint srcY1, GLint dstX0, GLint dstY0, GLint dstX1, GLint dstY1, GLbitfield mask, GLenum filter)
-{
- d_3_0_Core->f.BlitFramebuffer(srcX0, srcY0, srcX1, srcY1, dstX0, dstY0, dstX1, dstY1, mask, filter);
-}
-
-inline void QOpenGLFunctions_3_2_Compatibility::glGenerateMipmap(GLenum target)
-{
- d_3_0_Core->f.GenerateMipmap(target);
-}
-
-inline void QOpenGLFunctions_3_2_Compatibility::glGetFramebufferAttachmentParameteriv(GLenum target, GLenum attachment, GLenum pname, GLint *params)
-{
- d_3_0_Core->f.GetFramebufferAttachmentParameteriv(target, attachment, pname, params);
-}
-
-inline void QOpenGLFunctions_3_2_Compatibility::glFramebufferRenderbuffer(GLenum target, GLenum attachment, GLenum renderbuffertarget, GLuint renderbuffer)
-{
- d_3_0_Core->f.FramebufferRenderbuffer(target, attachment, renderbuffertarget, renderbuffer);
-}
-
-inline void QOpenGLFunctions_3_2_Compatibility::glFramebufferTexture3D(GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level, GLint zoffset)
-{
- d_3_0_Core->f.FramebufferTexture3D(target, attachment, textarget, texture, level, zoffset);
-}
-
-inline void QOpenGLFunctions_3_2_Compatibility::glFramebufferTexture2D(GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level)
-{
- d_3_0_Core->f.FramebufferTexture2D(target, attachment, textarget, texture, level);
-}
-
-inline void QOpenGLFunctions_3_2_Compatibility::glFramebufferTexture1D(GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level)
-{
- d_3_0_Core->f.FramebufferTexture1D(target, attachment, textarget, texture, level);
-}
-
-inline GLenum QOpenGLFunctions_3_2_Compatibility::glCheckFramebufferStatus(GLenum target)
-{
- return d_3_0_Core->f.CheckFramebufferStatus(target);
-}
-
-inline void QOpenGLFunctions_3_2_Compatibility::glGenFramebuffers(GLsizei n, GLuint *framebuffers)
-{
- d_3_0_Core->f.GenFramebuffers(n, framebuffers);
-}
-
-inline void QOpenGLFunctions_3_2_Compatibility::glDeleteFramebuffers(GLsizei n, const GLuint *framebuffers)
-{
- d_3_0_Core->f.DeleteFramebuffers(n, framebuffers);
-}
-
-inline void QOpenGLFunctions_3_2_Compatibility::glBindFramebuffer(GLenum target, GLuint framebuffer)
-{
- d_3_0_Core->f.BindFramebuffer(target, framebuffer);
-}
-
-inline GLboolean QOpenGLFunctions_3_2_Compatibility::glIsFramebuffer(GLuint framebuffer)
-{
- return d_3_0_Core->f.IsFramebuffer(framebuffer);
-}
-
-inline void QOpenGLFunctions_3_2_Compatibility::glGetRenderbufferParameteriv(GLenum target, GLenum pname, GLint *params)
-{
- d_3_0_Core->f.GetRenderbufferParameteriv(target, pname, params);
-}
-
-inline void QOpenGLFunctions_3_2_Compatibility::glRenderbufferStorage(GLenum target, GLenum internalformat, GLsizei width, GLsizei height)
-{
- d_3_0_Core->f.RenderbufferStorage(target, internalformat, width, height);
-}
-
-inline void QOpenGLFunctions_3_2_Compatibility::glGenRenderbuffers(GLsizei n, GLuint *renderbuffers)
-{
- d_3_0_Core->f.GenRenderbuffers(n, renderbuffers);
-}
-
-inline void QOpenGLFunctions_3_2_Compatibility::glDeleteRenderbuffers(GLsizei n, const GLuint *renderbuffers)
-{
- d_3_0_Core->f.DeleteRenderbuffers(n, renderbuffers);
-}
-
-inline void QOpenGLFunctions_3_2_Compatibility::glBindRenderbuffer(GLenum target, GLuint renderbuffer)
-{
- d_3_0_Core->f.BindRenderbuffer(target, renderbuffer);
-}
-
-inline GLboolean QOpenGLFunctions_3_2_Compatibility::glIsRenderbuffer(GLuint renderbuffer)
-{
- return d_3_0_Core->f.IsRenderbuffer(renderbuffer);
-}
-
-inline const GLubyte * QOpenGLFunctions_3_2_Compatibility::glGetStringi(GLenum name, GLuint index)
-{
- return d_3_0_Core->f.GetStringi(name, index);
-}
-
-inline void QOpenGLFunctions_3_2_Compatibility::glClearBufferfi(GLenum buffer, GLint drawbuffer, GLfloat depth, GLint stencil)
-{
- d_3_0_Core->f.ClearBufferfi(buffer, drawbuffer, depth, stencil);
-}
-
-inline void QOpenGLFunctions_3_2_Compatibility::glClearBufferfv(GLenum buffer, GLint drawbuffer, const GLfloat *value)
-{
- d_3_0_Core->f.ClearBufferfv(buffer, drawbuffer, value);
-}
-
-inline void QOpenGLFunctions_3_2_Compatibility::glClearBufferuiv(GLenum buffer, GLint drawbuffer, const GLuint *value)
-{
- d_3_0_Core->f.ClearBufferuiv(buffer, drawbuffer, value);
-}
-
-inline void QOpenGLFunctions_3_2_Compatibility::glClearBufferiv(GLenum buffer, GLint drawbuffer, const GLint *value)
-{
- d_3_0_Core->f.ClearBufferiv(buffer, drawbuffer, value);
-}
-
-inline void QOpenGLFunctions_3_2_Compatibility::glGetTexParameterIuiv(GLenum target, GLenum pname, GLuint *params)
-{
- d_3_0_Core->f.GetTexParameterIuiv(target, pname, params);
-}
-
-inline void QOpenGLFunctions_3_2_Compatibility::glGetTexParameterIiv(GLenum target, GLenum pname, GLint *params)
-{
- d_3_0_Core->f.GetTexParameterIiv(target, pname, params);
-}
-
-inline void QOpenGLFunctions_3_2_Compatibility::glTexParameterIuiv(GLenum target, GLenum pname, const GLuint *params)
-{
- d_3_0_Core->f.TexParameterIuiv(target, pname, params);
-}
-
-inline void QOpenGLFunctions_3_2_Compatibility::glTexParameterIiv(GLenum target, GLenum pname, const GLint *params)
-{
- d_3_0_Core->f.TexParameterIiv(target, pname, params);
-}
-
-inline void QOpenGLFunctions_3_2_Compatibility::glUniform4uiv(GLint location, GLsizei count, const GLuint *value)
-{
- d_3_0_Core->f.Uniform4uiv(location, count, value);
-}
-
-inline void QOpenGLFunctions_3_2_Compatibility::glUniform3uiv(GLint location, GLsizei count, const GLuint *value)
-{
- d_3_0_Core->f.Uniform3uiv(location, count, value);
-}
-
-inline void QOpenGLFunctions_3_2_Compatibility::glUniform2uiv(GLint location, GLsizei count, const GLuint *value)
-{
- d_3_0_Core->f.Uniform2uiv(location, count, value);
-}
-
-inline void QOpenGLFunctions_3_2_Compatibility::glUniform1uiv(GLint location, GLsizei count, const GLuint *value)
-{
- d_3_0_Core->f.Uniform1uiv(location, count, value);
-}
-
-inline void QOpenGLFunctions_3_2_Compatibility::glUniform4ui(GLint location, GLuint v0, GLuint v1, GLuint v2, GLuint v3)
-{
- d_3_0_Core->f.Uniform4ui(location, v0, v1, v2, v3);
-}
-
-inline void QOpenGLFunctions_3_2_Compatibility::glUniform3ui(GLint location, GLuint v0, GLuint v1, GLuint v2)
-{
- d_3_0_Core->f.Uniform3ui(location, v0, v1, v2);
-}
-
-inline void QOpenGLFunctions_3_2_Compatibility::glUniform2ui(GLint location, GLuint v0, GLuint v1)
-{
- d_3_0_Core->f.Uniform2ui(location, v0, v1);
-}
-
-inline void QOpenGLFunctions_3_2_Compatibility::glUniform1ui(GLint location, GLuint v0)
-{
- d_3_0_Core->f.Uniform1ui(location, v0);
-}
-
-inline GLint QOpenGLFunctions_3_2_Compatibility::glGetFragDataLocation(GLuint program, const GLchar *name)
-{
- return d_3_0_Core->f.GetFragDataLocation(program, name);
-}
-
-inline void QOpenGLFunctions_3_2_Compatibility::glBindFragDataLocation(GLuint program, GLuint color, const GLchar *name)
-{
- d_3_0_Core->f.BindFragDataLocation(program, color, name);
-}
-
-inline void QOpenGLFunctions_3_2_Compatibility::glGetUniformuiv(GLuint program, GLint location, GLuint *params)
-{
- d_3_0_Core->f.GetUniformuiv(program, location, params);
-}
-
-inline void QOpenGLFunctions_3_2_Compatibility::glGetVertexAttribIuiv(GLuint index, GLenum pname, GLuint *params)
-{
- d_3_0_Core->f.GetVertexAttribIuiv(index, pname, params);
-}
-
-inline void QOpenGLFunctions_3_2_Compatibility::glGetVertexAttribIiv(GLuint index, GLenum pname, GLint *params)
-{
- d_3_0_Core->f.GetVertexAttribIiv(index, pname, params);
-}
-
-inline void QOpenGLFunctions_3_2_Compatibility::glVertexAttribIPointer(GLuint index, GLint size, GLenum type, GLsizei stride, const GLvoid *pointer)
-{
- d_3_0_Core->f.VertexAttribIPointer(index, size, type, stride, pointer);
-}
-
-inline void QOpenGLFunctions_3_2_Compatibility::glEndConditionalRender()
-{
- d_3_0_Core->f.EndConditionalRender();
-}
-
-inline void QOpenGLFunctions_3_2_Compatibility::glBeginConditionalRender(GLuint id, GLenum mode)
-{
- d_3_0_Core->f.BeginConditionalRender(id, mode);
-}
-
-inline void QOpenGLFunctions_3_2_Compatibility::glClampColor(GLenum target, GLenum clamp)
-{
- d_3_0_Core->f.ClampColor(target, clamp);
-}
-
-inline void QOpenGLFunctions_3_2_Compatibility::glGetTransformFeedbackVarying(GLuint program, GLuint index, GLsizei bufSize, GLsizei *length, GLsizei *size, GLenum *type, GLchar *name)
-{
- d_3_0_Core->f.GetTransformFeedbackVarying(program, index, bufSize, length, size, type, name);
-}
-
-inline void QOpenGLFunctions_3_2_Compatibility::glTransformFeedbackVaryings(GLuint program, GLsizei count, const GLchar* const *varyings, GLenum bufferMode)
-{
- d_3_0_Core->f.TransformFeedbackVaryings(program, count, varyings, bufferMode);
-}
-
-inline void QOpenGLFunctions_3_2_Compatibility::glBindBufferBase(GLenum target, GLuint index, GLuint buffer)
-{
- d_3_0_Core->f.BindBufferBase(target, index, buffer);
-}
-
-inline void QOpenGLFunctions_3_2_Compatibility::glBindBufferRange(GLenum target, GLuint index, GLuint buffer, GLintptr offset, GLsizeiptr size)
-{
- d_3_0_Core->f.BindBufferRange(target, index, buffer, offset, size);
-}
-
-inline void QOpenGLFunctions_3_2_Compatibility::glEndTransformFeedback()
-{
- d_3_0_Core->f.EndTransformFeedback();
-}
-
-inline void QOpenGLFunctions_3_2_Compatibility::glBeginTransformFeedback(GLenum primitiveMode)
-{
- d_3_0_Core->f.BeginTransformFeedback(primitiveMode);
-}
-
-inline GLboolean QOpenGLFunctions_3_2_Compatibility::glIsEnabledi(GLenum target, GLuint index)
-{
- return d_3_0_Core->f.IsEnabledi(target, index);
-}
-
-inline void QOpenGLFunctions_3_2_Compatibility::glDisablei(GLenum target, GLuint index)
-{
- d_3_0_Core->f.Disablei(target, index);
-}
-
-inline void QOpenGLFunctions_3_2_Compatibility::glEnablei(GLenum target, GLuint index)
-{
- d_3_0_Core->f.Enablei(target, index);
-}
-
-inline void QOpenGLFunctions_3_2_Compatibility::glGetIntegeri_v(GLenum target, GLuint index, GLint *data)
-{
- d_3_0_Core->f.GetIntegeri_v(target, index, data);
-}
-
-inline void QOpenGLFunctions_3_2_Compatibility::glGetBooleani_v(GLenum target, GLuint index, GLboolean *data)
-{
- d_3_0_Core->f.GetBooleani_v(target, index, data);
-}
-
-inline void QOpenGLFunctions_3_2_Compatibility::glColorMaski(GLuint index, GLboolean r, GLboolean g, GLboolean b, GLboolean a)
-{
- d_3_0_Core->f.ColorMaski(index, r, g, b, a);
-}
-
-
-// OpenGL 3.1 core functions
-inline void QOpenGLFunctions_3_2_Compatibility::glCopyBufferSubData(GLenum readTarget, GLenum writeTarget, GLintptr readOffset, GLintptr writeOffset, GLsizeiptr size)
-{
- d_3_1_Core->f.CopyBufferSubData(readTarget, writeTarget, readOffset, writeOffset, size);
-}
-
-inline void QOpenGLFunctions_3_2_Compatibility::glUniformBlockBinding(GLuint program, GLuint uniformBlockIndex, GLuint uniformBlockBinding)
-{
- d_3_1_Core->f.UniformBlockBinding(program, uniformBlockIndex, uniformBlockBinding);
-}
-
-inline void QOpenGLFunctions_3_2_Compatibility::glGetActiveUniformBlockName(GLuint program, GLuint uniformBlockIndex, GLsizei bufSize, GLsizei *length, GLchar *uniformBlockName)
-{
- d_3_1_Core->f.GetActiveUniformBlockName(program, uniformBlockIndex, bufSize, length, uniformBlockName);
-}
-
-inline void QOpenGLFunctions_3_2_Compatibility::glGetActiveUniformBlockiv(GLuint program, GLuint uniformBlockIndex, GLenum pname, GLint *params)
-{
- d_3_1_Core->f.GetActiveUniformBlockiv(program, uniformBlockIndex, pname, params);
-}
-
-inline GLuint QOpenGLFunctions_3_2_Compatibility::glGetUniformBlockIndex(GLuint program, const GLchar *uniformBlockName)
-{
- return d_3_1_Core->f.GetUniformBlockIndex(program, uniformBlockName);
-}
-
-inline void QOpenGLFunctions_3_2_Compatibility::glGetActiveUniformName(GLuint program, GLuint uniformIndex, GLsizei bufSize, GLsizei *length, GLchar *uniformName)
-{
- d_3_1_Core->f.GetActiveUniformName(program, uniformIndex, bufSize, length, uniformName);
-}
-
-inline void QOpenGLFunctions_3_2_Compatibility::glGetActiveUniformsiv(GLuint program, GLsizei uniformCount, const GLuint *uniformIndices, GLenum pname, GLint *params)
-{
- d_3_1_Core->f.GetActiveUniformsiv(program, uniformCount, uniformIndices, pname, params);
-}
-
-inline void QOpenGLFunctions_3_2_Compatibility::glGetUniformIndices(GLuint program, GLsizei uniformCount, const GLchar* const *uniformNames, GLuint *uniformIndices)
-{
- d_3_1_Core->f.GetUniformIndices(program, uniformCount, uniformNames, uniformIndices);
-}
-
-inline void QOpenGLFunctions_3_2_Compatibility::glPrimitiveRestartIndex(GLuint index)
-{
- d_3_1_Core->f.PrimitiveRestartIndex(index);
-}
-
-inline void QOpenGLFunctions_3_2_Compatibility::glTexBuffer(GLenum target, GLenum internalformat, GLuint buffer)
-{
- d_3_1_Core->f.TexBuffer(target, internalformat, buffer);
-}
-
-inline void QOpenGLFunctions_3_2_Compatibility::glDrawElementsInstanced(GLenum mode, GLsizei count, GLenum type, const GLvoid *indices, GLsizei instancecount)
-{
- d_3_1_Core->f.DrawElementsInstanced(mode, count, type, indices, instancecount);
-}
-
-inline void QOpenGLFunctions_3_2_Compatibility::glDrawArraysInstanced(GLenum mode, GLint first, GLsizei count, GLsizei instancecount)
-{
- d_3_1_Core->f.DrawArraysInstanced(mode, first, count, instancecount);
-}
-
-
-// OpenGL 3.2 core functions
-inline void QOpenGLFunctions_3_2_Compatibility::glSampleMaski(GLuint index, GLbitfield mask)
-{
- d_3_2_Core->f.SampleMaski(index, mask);
-}
-
-inline void QOpenGLFunctions_3_2_Compatibility::glGetMultisamplefv(GLenum pname, GLuint index, GLfloat *val)
-{
- d_3_2_Core->f.GetMultisamplefv(pname, index, val);
-}
-
-inline void QOpenGLFunctions_3_2_Compatibility::glTexImage3DMultisample(GLenum target, GLsizei samples, GLint internalformat, GLsizei width, GLsizei height, GLsizei depth, GLboolean fixedsamplelocations)
-{
- d_3_2_Core->f.TexImage3DMultisample(target, samples, internalformat, width, height, depth, fixedsamplelocations);
-}
-
-inline void QOpenGLFunctions_3_2_Compatibility::glTexImage2DMultisample(GLenum target, GLsizei samples, GLint internalformat, GLsizei width, GLsizei height, GLboolean fixedsamplelocations)
-{
- d_3_2_Core->f.TexImage2DMultisample(target, samples, internalformat, width, height, fixedsamplelocations);
-}
-
-inline void QOpenGLFunctions_3_2_Compatibility::glGetSynciv(GLsync sync, GLenum pname, GLsizei bufSize, GLsizei *length, GLint *values)
-{
- d_3_2_Core->f.GetSynciv(sync, pname, bufSize, length, values);
-}
-
-inline void QOpenGLFunctions_3_2_Compatibility::glGetInteger64v(GLenum pname, GLint64 *params)
-{
- d_3_2_Core->f.GetInteger64v(pname, params);
-}
-
-inline void QOpenGLFunctions_3_2_Compatibility::glWaitSync(GLsync sync, GLbitfield flags, GLuint64 timeout)
-{
- d_3_2_Core->f.WaitSync(sync, flags, timeout);
-}
-
-inline GLenum QOpenGLFunctions_3_2_Compatibility::glClientWaitSync(GLsync sync, GLbitfield flags, GLuint64 timeout)
-{
- return d_3_2_Core->f.ClientWaitSync(sync, flags, timeout);
-}
-
-inline void QOpenGLFunctions_3_2_Compatibility::glDeleteSync(GLsync sync)
-{
- d_3_2_Core->f.DeleteSync(sync);
-}
-
-inline GLboolean QOpenGLFunctions_3_2_Compatibility::glIsSync(GLsync sync)
-{
- return d_3_2_Core->f.IsSync(sync);
-}
-
-inline GLsync QOpenGLFunctions_3_2_Compatibility::glFenceSync(GLenum condition, GLbitfield flags)
-{
- return d_3_2_Core->f.FenceSync(condition, flags);
-}
-
-inline void QOpenGLFunctions_3_2_Compatibility::glProvokingVertex(GLenum mode)
-{
- d_3_2_Core->f.ProvokingVertex(mode);
-}
-
-inline void QOpenGLFunctions_3_2_Compatibility::glMultiDrawElementsBaseVertex(GLenum mode, const GLsizei *count, GLenum type, const GLvoid* const *indices, GLsizei drawcount, const GLint *basevertex)
-{
- d_3_2_Core->f.MultiDrawElementsBaseVertex(mode, count, type, indices, drawcount, basevertex);
-}
-
-inline void QOpenGLFunctions_3_2_Compatibility::glDrawElementsInstancedBaseVertex(GLenum mode, GLsizei count, GLenum type, const GLvoid *indices, GLsizei instancecount, GLint basevertex)
-{
- d_3_2_Core->f.DrawElementsInstancedBaseVertex(mode, count, type, indices, instancecount, basevertex);
-}
-
-inline void QOpenGLFunctions_3_2_Compatibility::glDrawRangeElementsBaseVertex(GLenum mode, GLuint start, GLuint end, GLsizei count, GLenum type, const GLvoid *indices, GLint basevertex)
-{
- d_3_2_Core->f.DrawRangeElementsBaseVertex(mode, start, end, count, type, indices, basevertex);
-}
-
-inline void QOpenGLFunctions_3_2_Compatibility::glDrawElementsBaseVertex(GLenum mode, GLsizei count, GLenum type, const GLvoid *indices, GLint basevertex)
-{
- d_3_2_Core->f.DrawElementsBaseVertex(mode, count, type, indices, basevertex);
-}
-
-inline void QOpenGLFunctions_3_2_Compatibility::glFramebufferTexture(GLenum target, GLenum attachment, GLuint texture, GLint level)
-{
- d_3_2_Core->f.FramebufferTexture(target, attachment, texture, level);
-}
-
-inline void QOpenGLFunctions_3_2_Compatibility::glGetBufferParameteri64v(GLenum target, GLenum pname, GLint64 *params)
-{
- d_3_2_Core->f.GetBufferParameteri64v(target, pname, params);
-}
-
-inline void QOpenGLFunctions_3_2_Compatibility::glGetInteger64i_v(GLenum target, GLuint index, GLint64 *data)
-{
- d_3_2_Core->f.GetInteger64i_v(target, index, data);
-}
-
-
-// OpenGL 1.0 deprecated functions
-inline void QOpenGLFunctions_3_2_Compatibility::glTranslatef(GLfloat x, GLfloat y, GLfloat z)
-{
- d_1_0_Deprecated->f.Translatef(x, y, z);
-}
-
-inline void QOpenGLFunctions_3_2_Compatibility::glTranslated(GLdouble x, GLdouble y, GLdouble z)
-{
- d_1_0_Deprecated->f.Translated(x, y, z);
-}
-
-inline void QOpenGLFunctions_3_2_Compatibility::glScalef(GLfloat x, GLfloat y, GLfloat z)
-{
- d_1_0_Deprecated->f.Scalef(x, y, z);
-}
-
-inline void QOpenGLFunctions_3_2_Compatibility::glScaled(GLdouble x, GLdouble y, GLdouble z)
-{
- d_1_0_Deprecated->f.Scaled(x, y, z);
-}
-
-inline void QOpenGLFunctions_3_2_Compatibility::glRotatef(GLfloat angle, GLfloat x, GLfloat y, GLfloat z)
-{
- d_1_0_Deprecated->f.Rotatef(angle, x, y, z);
-}
-
-inline void QOpenGLFunctions_3_2_Compatibility::glRotated(GLdouble angle, GLdouble x, GLdouble y, GLdouble z)
-{
- d_1_0_Deprecated->f.Rotated(angle, x, y, z);
-}
-
-inline void QOpenGLFunctions_3_2_Compatibility::glPushMatrix()
-{
- d_1_0_Deprecated->f.PushMatrix();
-}
-
-inline void QOpenGLFunctions_3_2_Compatibility::glPopMatrix()
-{
- d_1_0_Deprecated->f.PopMatrix();
-}
-
-inline void QOpenGLFunctions_3_2_Compatibility::glOrtho(GLdouble left, GLdouble right, GLdouble bottom, GLdouble top, GLdouble zNear, GLdouble zFar)
-{
- d_1_0_Deprecated->f.Ortho(left, right, bottom, top, zNear, zFar);
-}
-
-inline void QOpenGLFunctions_3_2_Compatibility::glMultMatrixd(const GLdouble *m)
-{
- d_1_0_Deprecated->f.MultMatrixd(m);
-}
-
-inline void QOpenGLFunctions_3_2_Compatibility::glMultMatrixf(const GLfloat *m)
-{
- d_1_0_Deprecated->f.MultMatrixf(m);
-}
-
-inline void QOpenGLFunctions_3_2_Compatibility::glMatrixMode(GLenum mode)
-{
- d_1_0_Deprecated->f.MatrixMode(mode);
-}
-
-inline void QOpenGLFunctions_3_2_Compatibility::glLoadMatrixd(const GLdouble *m)
-{
- d_1_0_Deprecated->f.LoadMatrixd(m);
-}
-
-inline void QOpenGLFunctions_3_2_Compatibility::glLoadMatrixf(const GLfloat *m)
-{
- d_1_0_Deprecated->f.LoadMatrixf(m);
-}
-
-inline void QOpenGLFunctions_3_2_Compatibility::glLoadIdentity()
-{
- d_1_0_Deprecated->f.LoadIdentity();
-}
-
-inline void QOpenGLFunctions_3_2_Compatibility::glFrustum(GLdouble left, GLdouble right, GLdouble bottom, GLdouble top, GLdouble zNear, GLdouble zFar)
-{
- d_1_0_Deprecated->f.Frustum(left, right, bottom, top, zNear, zFar);
-}
-
-inline GLboolean QOpenGLFunctions_3_2_Compatibility::glIsList(GLuint list)
-{
- return d_1_0_Deprecated->f.IsList(list);
-}
-
-inline void QOpenGLFunctions_3_2_Compatibility::glGetTexGeniv(GLenum coord, GLenum pname, GLint *params)
-{
- d_1_0_Deprecated->f.GetTexGeniv(coord, pname, params);
-}
-
-inline void QOpenGLFunctions_3_2_Compatibility::glGetTexGenfv(GLenum coord, GLenum pname, GLfloat *params)
-{
- d_1_0_Deprecated->f.GetTexGenfv(coord, pname, params);
-}
-
-inline void QOpenGLFunctions_3_2_Compatibility::glGetTexGendv(GLenum coord, GLenum pname, GLdouble *params)
-{
- d_1_0_Deprecated->f.GetTexGendv(coord, pname, params);
-}
-
-inline void QOpenGLFunctions_3_2_Compatibility::glGetTexEnviv(GLenum target, GLenum pname, GLint *params)
-{
- d_1_0_Deprecated->f.GetTexEnviv(target, pname, params);
-}
-
-inline void QOpenGLFunctions_3_2_Compatibility::glGetTexEnvfv(GLenum target, GLenum pname, GLfloat *params)
-{
- d_1_0_Deprecated->f.GetTexEnvfv(target, pname, params);
-}
-
-inline void QOpenGLFunctions_3_2_Compatibility::glGetPolygonStipple(GLubyte *mask)
-{
- d_1_0_Deprecated->f.GetPolygonStipple(mask);
-}
-
-inline void QOpenGLFunctions_3_2_Compatibility::glGetPixelMapusv(GLenum map, GLushort *values)
-{
- d_1_0_Deprecated->f.GetPixelMapusv(map, values);
-}
-
-inline void QOpenGLFunctions_3_2_Compatibility::glGetPixelMapuiv(GLenum map, GLuint *values)
-{
- d_1_0_Deprecated->f.GetPixelMapuiv(map, values);
-}
-
-inline void QOpenGLFunctions_3_2_Compatibility::glGetPixelMapfv(GLenum map, GLfloat *values)
-{
- d_1_0_Deprecated->f.GetPixelMapfv(map, values);
-}
-
-inline void QOpenGLFunctions_3_2_Compatibility::glGetMaterialiv(GLenum face, GLenum pname, GLint *params)
-{
- d_1_0_Deprecated->f.GetMaterialiv(face, pname, params);
-}
-
-inline void QOpenGLFunctions_3_2_Compatibility::glGetMaterialfv(GLenum face, GLenum pname, GLfloat *params)
-{
- d_1_0_Deprecated->f.GetMaterialfv(face, pname, params);
-}
-
-inline void QOpenGLFunctions_3_2_Compatibility::glGetMapiv(GLenum target, GLenum query, GLint *v)
-{
- d_1_0_Deprecated->f.GetMapiv(target, query, v);
-}
-
-inline void QOpenGLFunctions_3_2_Compatibility::glGetMapfv(GLenum target, GLenum query, GLfloat *v)
-{
- d_1_0_Deprecated->f.GetMapfv(target, query, v);
-}
-
-inline void QOpenGLFunctions_3_2_Compatibility::glGetMapdv(GLenum target, GLenum query, GLdouble *v)
-{
- d_1_0_Deprecated->f.GetMapdv(target, query, v);
-}
-
-inline void QOpenGLFunctions_3_2_Compatibility::glGetLightiv(GLenum light, GLenum pname, GLint *params)
-{
- d_1_0_Deprecated->f.GetLightiv(light, pname, params);
-}
-
-inline void QOpenGLFunctions_3_2_Compatibility::glGetLightfv(GLenum light, GLenum pname, GLfloat *params)
-{
- d_1_0_Deprecated->f.GetLightfv(light, pname, params);
-}
-
-inline void QOpenGLFunctions_3_2_Compatibility::glGetClipPlane(GLenum plane, GLdouble *equation)
-{
- d_1_0_Deprecated->f.GetClipPlane(plane, equation);
-}
-
-inline void QOpenGLFunctions_3_2_Compatibility::glDrawPixels(GLsizei width, GLsizei height, GLenum format, GLenum type, const GLvoid *pixels)
-{
- d_1_0_Deprecated->f.DrawPixels(width, height, format, type, pixels);
-}
-
-inline void QOpenGLFunctions_3_2_Compatibility::glCopyPixels(GLint x, GLint y, GLsizei width, GLsizei height, GLenum type)
-{
- d_1_0_Deprecated->f.CopyPixels(x, y, width, height, type);
-}
-
-inline void QOpenGLFunctions_3_2_Compatibility::glPixelMapusv(GLenum map, GLint mapsize, const GLushort *values)
-{
- d_1_0_Deprecated->f.PixelMapusv(map, mapsize, values);
-}
-
-inline void QOpenGLFunctions_3_2_Compatibility::glPixelMapuiv(GLenum map, GLint mapsize, const GLuint *values)
-{
- d_1_0_Deprecated->f.PixelMapuiv(map, mapsize, values);
-}
-
-inline void QOpenGLFunctions_3_2_Compatibility::glPixelMapfv(GLenum map, GLint mapsize, const GLfloat *values)
-{
- d_1_0_Deprecated->f.PixelMapfv(map, mapsize, values);
-}
-
-inline void QOpenGLFunctions_3_2_Compatibility::glPixelTransferi(GLenum pname, GLint param)
-{
- d_1_0_Deprecated->f.PixelTransferi(pname, param);
-}
-
-inline void QOpenGLFunctions_3_2_Compatibility::glPixelTransferf(GLenum pname, GLfloat param)
-{
- d_1_0_Deprecated->f.PixelTransferf(pname, param);
-}
-
-inline void QOpenGLFunctions_3_2_Compatibility::glPixelZoom(GLfloat xfactor, GLfloat yfactor)
-{
- d_1_0_Deprecated->f.PixelZoom(xfactor, yfactor);
-}
-
-inline void QOpenGLFunctions_3_2_Compatibility::glAlphaFunc(GLenum func, GLfloat ref)
-{
- d_1_0_Deprecated->f.AlphaFunc(func, ref);
-}
-
-inline void QOpenGLFunctions_3_2_Compatibility::glEvalPoint2(GLint i, GLint j)
-{
- d_1_0_Deprecated->f.EvalPoint2(i, j);
-}
-
-inline void QOpenGLFunctions_3_2_Compatibility::glEvalMesh2(GLenum mode, GLint i1, GLint i2, GLint j1, GLint j2)
-{
- d_1_0_Deprecated->f.EvalMesh2(mode, i1, i2, j1, j2);
-}
-
-inline void QOpenGLFunctions_3_2_Compatibility::glEvalPoint1(GLint i)
-{
- d_1_0_Deprecated->f.EvalPoint1(i);
-}
-
-inline void QOpenGLFunctions_3_2_Compatibility::glEvalMesh1(GLenum mode, GLint i1, GLint i2)
-{
- d_1_0_Deprecated->f.EvalMesh1(mode, i1, i2);
-}
-
-inline void QOpenGLFunctions_3_2_Compatibility::glEvalCoord2fv(const GLfloat *u)
-{
- d_1_0_Deprecated->f.EvalCoord2fv(u);
-}
-
-inline void QOpenGLFunctions_3_2_Compatibility::glEvalCoord2f(GLfloat u, GLfloat v)
-{
- d_1_0_Deprecated->f.EvalCoord2f(u, v);
-}
-
-inline void QOpenGLFunctions_3_2_Compatibility::glEvalCoord2dv(const GLdouble *u)
-{
- d_1_0_Deprecated->f.EvalCoord2dv(u);
-}
-
-inline void QOpenGLFunctions_3_2_Compatibility::glEvalCoord2d(GLdouble u, GLdouble v)
-{
- d_1_0_Deprecated->f.EvalCoord2d(u, v);
-}
-
-inline void QOpenGLFunctions_3_2_Compatibility::glEvalCoord1fv(const GLfloat *u)
-{
- d_1_0_Deprecated->f.EvalCoord1fv(u);
-}
-
-inline void QOpenGLFunctions_3_2_Compatibility::glEvalCoord1f(GLfloat u)
-{
- d_1_0_Deprecated->f.EvalCoord1f(u);
-}
-
-inline void QOpenGLFunctions_3_2_Compatibility::glEvalCoord1dv(const GLdouble *u)
-{
- d_1_0_Deprecated->f.EvalCoord1dv(u);
-}
-
-inline void QOpenGLFunctions_3_2_Compatibility::glEvalCoord1d(GLdouble u)
-{
- d_1_0_Deprecated->f.EvalCoord1d(u);
-}
-
-inline void QOpenGLFunctions_3_2_Compatibility::glMapGrid2f(GLint un, GLfloat u1, GLfloat u2, GLint vn, GLfloat v1, GLfloat v2)
-{
- d_1_0_Deprecated->f.MapGrid2f(un, u1, u2, vn, v1, v2);
-}
-
-inline void QOpenGLFunctions_3_2_Compatibility::glMapGrid2d(GLint un, GLdouble u1, GLdouble u2, GLint vn, GLdouble v1, GLdouble v2)
-{
- d_1_0_Deprecated->f.MapGrid2d(un, u1, u2, vn, v1, v2);
-}
-
-inline void QOpenGLFunctions_3_2_Compatibility::glMapGrid1f(GLint un, GLfloat u1, GLfloat u2)
-{
- d_1_0_Deprecated->f.MapGrid1f(un, u1, u2);
-}
-
-inline void QOpenGLFunctions_3_2_Compatibility::glMapGrid1d(GLint un, GLdouble u1, GLdouble u2)
-{
- d_1_0_Deprecated->f.MapGrid1d(un, u1, u2);
-}
-
-inline void QOpenGLFunctions_3_2_Compatibility::glMap2f(GLenum target, GLfloat u1, GLfloat u2, GLint ustride, GLint uorder, GLfloat v1, GLfloat v2, GLint vstride, GLint vorder, const GLfloat *points)
-{
- d_1_0_Deprecated->f.Map2f(target, u1, u2, ustride, uorder, v1, v2, vstride, vorder, points);
-}
-
-inline void QOpenGLFunctions_3_2_Compatibility::glMap2d(GLenum target, GLdouble u1, GLdouble u2, GLint ustride, GLint uorder, GLdouble v1, GLdouble v2, GLint vstride, GLint vorder, const GLdouble *points)
-{
- d_1_0_Deprecated->f.Map2d(target, u1, u2, ustride, uorder, v1, v2, vstride, vorder, points);
-}
-
-inline void QOpenGLFunctions_3_2_Compatibility::glMap1f(GLenum target, GLfloat u1, GLfloat u2, GLint stride, GLint order, const GLfloat *points)
-{
- d_1_0_Deprecated->f.Map1f(target, u1, u2, stride, order, points);
-}
-
-inline void QOpenGLFunctions_3_2_Compatibility::glMap1d(GLenum target, GLdouble u1, GLdouble u2, GLint stride, GLint order, const GLdouble *points)
-{
- d_1_0_Deprecated->f.Map1d(target, u1, u2, stride, order, points);
-}
-
-inline void QOpenGLFunctions_3_2_Compatibility::glPushAttrib(GLbitfield mask)
-{
- d_1_0_Deprecated->f.PushAttrib(mask);
-}
-
-inline void QOpenGLFunctions_3_2_Compatibility::glPopAttrib()
-{
- d_1_0_Deprecated->f.PopAttrib();
-}
-
-inline void QOpenGLFunctions_3_2_Compatibility::glAccum(GLenum op, GLfloat value)
-{
- d_1_0_Deprecated->f.Accum(op, value);
-}
-
-inline void QOpenGLFunctions_3_2_Compatibility::glIndexMask(GLuint mask)
-{
- d_1_0_Deprecated->f.IndexMask(mask);
-}
-
-inline void QOpenGLFunctions_3_2_Compatibility::glClearIndex(GLfloat c)
-{
- d_1_0_Deprecated->f.ClearIndex(c);
-}
-
-inline void QOpenGLFunctions_3_2_Compatibility::glClearAccum(GLfloat red, GLfloat green, GLfloat blue, GLfloat alpha)
-{
- d_1_0_Deprecated->f.ClearAccum(red, green, blue, alpha);
-}
-
-inline void QOpenGLFunctions_3_2_Compatibility::glPushName(GLuint name)
-{
- d_1_0_Deprecated->f.PushName(name);
-}
-
-inline void QOpenGLFunctions_3_2_Compatibility::glPopName()
-{
- d_1_0_Deprecated->f.PopName();
-}
-
-inline void QOpenGLFunctions_3_2_Compatibility::glPassThrough(GLfloat token)
-{
- d_1_0_Deprecated->f.PassThrough(token);
-}
-
-inline void QOpenGLFunctions_3_2_Compatibility::glLoadName(GLuint name)
-{
- d_1_0_Deprecated->f.LoadName(name);
-}
-
-inline void QOpenGLFunctions_3_2_Compatibility::glInitNames()
-{
- d_1_0_Deprecated->f.InitNames();
-}
-
-inline GLint QOpenGLFunctions_3_2_Compatibility::glRenderMode(GLenum mode)
-{
- return d_1_0_Deprecated->f.RenderMode(mode);
-}
-
-inline void QOpenGLFunctions_3_2_Compatibility::glSelectBuffer(GLsizei size, GLuint *buffer)
-{
- d_1_0_Deprecated->f.SelectBuffer(size, buffer);
-}
-
-inline void QOpenGLFunctions_3_2_Compatibility::glFeedbackBuffer(GLsizei size, GLenum type, GLfloat *buffer)
-{
- d_1_0_Deprecated->f.FeedbackBuffer(size, type, buffer);
-}
-
-inline void QOpenGLFunctions_3_2_Compatibility::glTexGeniv(GLenum coord, GLenum pname, const GLint *params)
-{
- d_1_0_Deprecated->f.TexGeniv(coord, pname, params);
-}
-
-inline void QOpenGLFunctions_3_2_Compatibility::glTexGeni(GLenum coord, GLenum pname, GLint param)
-{
- d_1_0_Deprecated->f.TexGeni(coord, pname, param);
-}
-
-inline void QOpenGLFunctions_3_2_Compatibility::glTexGenfv(GLenum coord, GLenum pname, const GLfloat *params)
-{
- d_1_0_Deprecated->f.TexGenfv(coord, pname, params);
-}
-
-inline void QOpenGLFunctions_3_2_Compatibility::glTexGenf(GLenum coord, GLenum pname, GLfloat param)
-{
- d_1_0_Deprecated->f.TexGenf(coord, pname, param);
-}
-
-inline void QOpenGLFunctions_3_2_Compatibility::glTexGendv(GLenum coord, GLenum pname, const GLdouble *params)
-{
- d_1_0_Deprecated->f.TexGendv(coord, pname, params);
-}
-
-inline void QOpenGLFunctions_3_2_Compatibility::glTexGend(GLenum coord, GLenum pname, GLdouble param)
-{
- d_1_0_Deprecated->f.TexGend(coord, pname, param);
-}
-
-inline void QOpenGLFunctions_3_2_Compatibility::glTexEnviv(GLenum target, GLenum pname, const GLint *params)
-{
- d_1_0_Deprecated->f.TexEnviv(target, pname, params);
-}
-
-inline void QOpenGLFunctions_3_2_Compatibility::glTexEnvi(GLenum target, GLenum pname, GLint param)
-{
- d_1_0_Deprecated->f.TexEnvi(target, pname, param);
-}
-
-inline void QOpenGLFunctions_3_2_Compatibility::glTexEnvfv(GLenum target, GLenum pname, const GLfloat *params)
-{
- d_1_0_Deprecated->f.TexEnvfv(target, pname, params);
-}
-
-inline void QOpenGLFunctions_3_2_Compatibility::glTexEnvf(GLenum target, GLenum pname, GLfloat param)
-{
- d_1_0_Deprecated->f.TexEnvf(target, pname, param);
-}
-
-inline void QOpenGLFunctions_3_2_Compatibility::glShadeModel(GLenum mode)
-{
- d_1_0_Deprecated->f.ShadeModel(mode);
-}
-
-inline void QOpenGLFunctions_3_2_Compatibility::glPolygonStipple(const GLubyte *mask)
-{
- d_1_0_Deprecated->f.PolygonStipple(mask);
-}
-
-inline void QOpenGLFunctions_3_2_Compatibility::glMaterialiv(GLenum face, GLenum pname, const GLint *params)
-{
- d_1_0_Deprecated->f.Materialiv(face, pname, params);
-}
-
-inline void QOpenGLFunctions_3_2_Compatibility::glMateriali(GLenum face, GLenum pname, GLint param)
-{
- d_1_0_Deprecated->f.Materiali(face, pname, param);
-}
-
-inline void QOpenGLFunctions_3_2_Compatibility::glMaterialfv(GLenum face, GLenum pname, const GLfloat *params)
-{
- d_1_0_Deprecated->f.Materialfv(face, pname, params);
-}
-
-inline void QOpenGLFunctions_3_2_Compatibility::glMaterialf(GLenum face, GLenum pname, GLfloat param)
-{
- d_1_0_Deprecated->f.Materialf(face, pname, param);
-}
-
-inline void QOpenGLFunctions_3_2_Compatibility::glLineStipple(GLint factor, GLushort pattern)
-{
- d_1_0_Deprecated->f.LineStipple(factor, pattern);
-}
-
-inline void QOpenGLFunctions_3_2_Compatibility::glLightModeliv(GLenum pname, const GLint *params)
-{
- d_1_0_Deprecated->f.LightModeliv(pname, params);
-}
-
-inline void QOpenGLFunctions_3_2_Compatibility::glLightModeli(GLenum pname, GLint param)
-{
- d_1_0_Deprecated->f.LightModeli(pname, param);
-}
-
-inline void QOpenGLFunctions_3_2_Compatibility::glLightModelfv(GLenum pname, const GLfloat *params)
-{
- d_1_0_Deprecated->f.LightModelfv(pname, params);
-}
-
-inline void QOpenGLFunctions_3_2_Compatibility::glLightModelf(GLenum pname, GLfloat param)
-{
- d_1_0_Deprecated->f.LightModelf(pname, param);
-}
-
-inline void QOpenGLFunctions_3_2_Compatibility::glLightiv(GLenum light, GLenum pname, const GLint *params)
-{
- d_1_0_Deprecated->f.Lightiv(light, pname, params);
-}
-
-inline void QOpenGLFunctions_3_2_Compatibility::glLighti(GLenum light, GLenum pname, GLint param)
-{
- d_1_0_Deprecated->f.Lighti(light, pname, param);
-}
-
-inline void QOpenGLFunctions_3_2_Compatibility::glLightfv(GLenum light, GLenum pname, const GLfloat *params)
-{
- d_1_0_Deprecated->f.Lightfv(light, pname, params);
-}
-
-inline void QOpenGLFunctions_3_2_Compatibility::glLightf(GLenum light, GLenum pname, GLfloat param)
-{
- d_1_0_Deprecated->f.Lightf(light, pname, param);
-}
-
-inline void QOpenGLFunctions_3_2_Compatibility::glFogiv(GLenum pname, const GLint *params)
-{
- d_1_0_Deprecated->f.Fogiv(pname, params);
-}
-
-inline void QOpenGLFunctions_3_2_Compatibility::glFogi(GLenum pname, GLint param)
-{
- d_1_0_Deprecated->f.Fogi(pname, param);
-}
-
-inline void QOpenGLFunctions_3_2_Compatibility::glFogfv(GLenum pname, const GLfloat *params)
-{
- d_1_0_Deprecated->f.Fogfv(pname, params);
-}
-
-inline void QOpenGLFunctions_3_2_Compatibility::glFogf(GLenum pname, GLfloat param)
-{
- d_1_0_Deprecated->f.Fogf(pname, param);
-}
-
-inline void QOpenGLFunctions_3_2_Compatibility::glColorMaterial(GLenum face, GLenum mode)
-{
- d_1_0_Deprecated->f.ColorMaterial(face, mode);
-}
-
-inline void QOpenGLFunctions_3_2_Compatibility::glClipPlane(GLenum plane, const GLdouble *equation)
-{
- d_1_0_Deprecated->f.ClipPlane(plane, equation);
-}
-
-inline void QOpenGLFunctions_3_2_Compatibility::glVertex4sv(const GLshort *v)
-{
- d_1_0_Deprecated->f.Vertex4sv(v);
-}
-
-inline void QOpenGLFunctions_3_2_Compatibility::glVertex4s(GLshort x, GLshort y, GLshort z, GLshort w)
-{
- d_1_0_Deprecated->f.Vertex4s(x, y, z, w);
-}
-
-inline void QOpenGLFunctions_3_2_Compatibility::glVertex4iv(const GLint *v)
-{
- d_1_0_Deprecated->f.Vertex4iv(v);
-}
-
-inline void QOpenGLFunctions_3_2_Compatibility::glVertex4i(GLint x, GLint y, GLint z, GLint w)
-{
- d_1_0_Deprecated->f.Vertex4i(x, y, z, w);
-}
-
-inline void QOpenGLFunctions_3_2_Compatibility::glVertex4fv(const GLfloat *v)
-{
- d_1_0_Deprecated->f.Vertex4fv(v);
-}
-
-inline void QOpenGLFunctions_3_2_Compatibility::glVertex4f(GLfloat x, GLfloat y, GLfloat z, GLfloat w)
-{
- d_1_0_Deprecated->f.Vertex4f(x, y, z, w);
-}
-
-inline void QOpenGLFunctions_3_2_Compatibility::glVertex4dv(const GLdouble *v)
-{
- d_1_0_Deprecated->f.Vertex4dv(v);
-}
-
-inline void QOpenGLFunctions_3_2_Compatibility::glVertex4d(GLdouble x, GLdouble y, GLdouble z, GLdouble w)
-{
- d_1_0_Deprecated->f.Vertex4d(x, y, z, w);
-}
-
-inline void QOpenGLFunctions_3_2_Compatibility::glVertex3sv(const GLshort *v)
-{
- d_1_0_Deprecated->f.Vertex3sv(v);
-}
-
-inline void QOpenGLFunctions_3_2_Compatibility::glVertex3s(GLshort x, GLshort y, GLshort z)
-{
- d_1_0_Deprecated->f.Vertex3s(x, y, z);
-}
-
-inline void QOpenGLFunctions_3_2_Compatibility::glVertex3iv(const GLint *v)
-{
- d_1_0_Deprecated->f.Vertex3iv(v);
-}
-
-inline void QOpenGLFunctions_3_2_Compatibility::glVertex3i(GLint x, GLint y, GLint z)
-{
- d_1_0_Deprecated->f.Vertex3i(x, y, z);
-}
-
-inline void QOpenGLFunctions_3_2_Compatibility::glVertex3fv(const GLfloat *v)
-{
- d_1_0_Deprecated->f.Vertex3fv(v);
-}
-
-inline void QOpenGLFunctions_3_2_Compatibility::glVertex3f(GLfloat x, GLfloat y, GLfloat z)
-{
- d_1_0_Deprecated->f.Vertex3f(x, y, z);
-}
-
-inline void QOpenGLFunctions_3_2_Compatibility::glVertex3dv(const GLdouble *v)
-{
- d_1_0_Deprecated->f.Vertex3dv(v);
-}
-
-inline void QOpenGLFunctions_3_2_Compatibility::glVertex3d(GLdouble x, GLdouble y, GLdouble z)
-{
- d_1_0_Deprecated->f.Vertex3d(x, y, z);
-}
-
-inline void QOpenGLFunctions_3_2_Compatibility::glVertex2sv(const GLshort *v)
-{
- d_1_0_Deprecated->f.Vertex2sv(v);
-}
-
-inline void QOpenGLFunctions_3_2_Compatibility::glVertex2s(GLshort x, GLshort y)
-{
- d_1_0_Deprecated->f.Vertex2s(x, y);
-}
-
-inline void QOpenGLFunctions_3_2_Compatibility::glVertex2iv(const GLint *v)
-{
- d_1_0_Deprecated->f.Vertex2iv(v);
-}
-
-inline void QOpenGLFunctions_3_2_Compatibility::glVertex2i(GLint x, GLint y)
-{
- d_1_0_Deprecated->f.Vertex2i(x, y);
-}
-
-inline void QOpenGLFunctions_3_2_Compatibility::glVertex2fv(const GLfloat *v)
-{
- d_1_0_Deprecated->f.Vertex2fv(v);
-}
-
-inline void QOpenGLFunctions_3_2_Compatibility::glVertex2f(GLfloat x, GLfloat y)
-{
- d_1_0_Deprecated->f.Vertex2f(x, y);
-}
-
-inline void QOpenGLFunctions_3_2_Compatibility::glVertex2dv(const GLdouble *v)
-{
- d_1_0_Deprecated->f.Vertex2dv(v);
-}
-
-inline void QOpenGLFunctions_3_2_Compatibility::glVertex2d(GLdouble x, GLdouble y)
-{
- d_1_0_Deprecated->f.Vertex2d(x, y);
-}
-
-inline void QOpenGLFunctions_3_2_Compatibility::glTexCoord4sv(const GLshort *v)
-{
- d_1_0_Deprecated->f.TexCoord4sv(v);
-}
-
-inline void QOpenGLFunctions_3_2_Compatibility::glTexCoord4s(GLshort s, GLshort t, GLshort r, GLshort q)
-{
- d_1_0_Deprecated->f.TexCoord4s(s, t, r, q);
-}
-
-inline void QOpenGLFunctions_3_2_Compatibility::glTexCoord4iv(const GLint *v)
-{
- d_1_0_Deprecated->f.TexCoord4iv(v);
-}
-
-inline void QOpenGLFunctions_3_2_Compatibility::glTexCoord4i(GLint s, GLint t, GLint r, GLint q)
-{
- d_1_0_Deprecated->f.TexCoord4i(s, t, r, q);
-}
-
-inline void QOpenGLFunctions_3_2_Compatibility::glTexCoord4fv(const GLfloat *v)
-{
- d_1_0_Deprecated->f.TexCoord4fv(v);
-}
-
-inline void QOpenGLFunctions_3_2_Compatibility::glTexCoord4f(GLfloat s, GLfloat t, GLfloat r, GLfloat q)
-{
- d_1_0_Deprecated->f.TexCoord4f(s, t, r, q);
-}
-
-inline void QOpenGLFunctions_3_2_Compatibility::glTexCoord4dv(const GLdouble *v)
-{
- d_1_0_Deprecated->f.TexCoord4dv(v);
-}
-
-inline void QOpenGLFunctions_3_2_Compatibility::glTexCoord4d(GLdouble s, GLdouble t, GLdouble r, GLdouble q)
-{
- d_1_0_Deprecated->f.TexCoord4d(s, t, r, q);
-}
-
-inline void QOpenGLFunctions_3_2_Compatibility::glTexCoord3sv(const GLshort *v)
-{
- d_1_0_Deprecated->f.TexCoord3sv(v);
-}
-
-inline void QOpenGLFunctions_3_2_Compatibility::glTexCoord3s(GLshort s, GLshort t, GLshort r)
-{
- d_1_0_Deprecated->f.TexCoord3s(s, t, r);
-}
-
-inline void QOpenGLFunctions_3_2_Compatibility::glTexCoord3iv(const GLint *v)
-{
- d_1_0_Deprecated->f.TexCoord3iv(v);
-}
-
-inline void QOpenGLFunctions_3_2_Compatibility::glTexCoord3i(GLint s, GLint t, GLint r)
-{
- d_1_0_Deprecated->f.TexCoord3i(s, t, r);
-}
-
-inline void QOpenGLFunctions_3_2_Compatibility::glTexCoord3fv(const GLfloat *v)
-{
- d_1_0_Deprecated->f.TexCoord3fv(v);
-}
-
-inline void QOpenGLFunctions_3_2_Compatibility::glTexCoord3f(GLfloat s, GLfloat t, GLfloat r)
-{
- d_1_0_Deprecated->f.TexCoord3f(s, t, r);
-}
-
-inline void QOpenGLFunctions_3_2_Compatibility::glTexCoord3dv(const GLdouble *v)
-{
- d_1_0_Deprecated->f.TexCoord3dv(v);
-}
-
-inline void QOpenGLFunctions_3_2_Compatibility::glTexCoord3d(GLdouble s, GLdouble t, GLdouble r)
-{
- d_1_0_Deprecated->f.TexCoord3d(s, t, r);
-}
-
-inline void QOpenGLFunctions_3_2_Compatibility::glTexCoord2sv(const GLshort *v)
-{
- d_1_0_Deprecated->f.TexCoord2sv(v);
-}
-
-inline void QOpenGLFunctions_3_2_Compatibility::glTexCoord2s(GLshort s, GLshort t)
-{
- d_1_0_Deprecated->f.TexCoord2s(s, t);
-}
-
-inline void QOpenGLFunctions_3_2_Compatibility::glTexCoord2iv(const GLint *v)
-{
- d_1_0_Deprecated->f.TexCoord2iv(v);
-}
-
-inline void QOpenGLFunctions_3_2_Compatibility::glTexCoord2i(GLint s, GLint t)
-{
- d_1_0_Deprecated->f.TexCoord2i(s, t);
-}
-
-inline void QOpenGLFunctions_3_2_Compatibility::glTexCoord2fv(const GLfloat *v)
-{
- d_1_0_Deprecated->f.TexCoord2fv(v);
-}
-
-inline void QOpenGLFunctions_3_2_Compatibility::glTexCoord2f(GLfloat s, GLfloat t)
-{
- d_1_0_Deprecated->f.TexCoord2f(s, t);
-}
-
-inline void QOpenGLFunctions_3_2_Compatibility::glTexCoord2dv(const GLdouble *v)
-{
- d_1_0_Deprecated->f.TexCoord2dv(v);
-}
-
-inline void QOpenGLFunctions_3_2_Compatibility::glTexCoord2d(GLdouble s, GLdouble t)
-{
- d_1_0_Deprecated->f.TexCoord2d(s, t);
-}
-
-inline void QOpenGLFunctions_3_2_Compatibility::glTexCoord1sv(const GLshort *v)
-{
- d_1_0_Deprecated->f.TexCoord1sv(v);
-}
-
-inline void QOpenGLFunctions_3_2_Compatibility::glTexCoord1s(GLshort s)
-{
- d_1_0_Deprecated->f.TexCoord1s(s);
-}
-
-inline void QOpenGLFunctions_3_2_Compatibility::glTexCoord1iv(const GLint *v)
-{
- d_1_0_Deprecated->f.TexCoord1iv(v);
-}
-
-inline void QOpenGLFunctions_3_2_Compatibility::glTexCoord1i(GLint s)
-{
- d_1_0_Deprecated->f.TexCoord1i(s);
-}
-
-inline void QOpenGLFunctions_3_2_Compatibility::glTexCoord1fv(const GLfloat *v)
-{
- d_1_0_Deprecated->f.TexCoord1fv(v);
-}
-
-inline void QOpenGLFunctions_3_2_Compatibility::glTexCoord1f(GLfloat s)
-{
- d_1_0_Deprecated->f.TexCoord1f(s);
-}
-
-inline void QOpenGLFunctions_3_2_Compatibility::glTexCoord1dv(const GLdouble *v)
-{
- d_1_0_Deprecated->f.TexCoord1dv(v);
-}
-
-inline void QOpenGLFunctions_3_2_Compatibility::glTexCoord1d(GLdouble s)
-{
- d_1_0_Deprecated->f.TexCoord1d(s);
-}
-
-inline void QOpenGLFunctions_3_2_Compatibility::glRectsv(const GLshort *v1, const GLshort *v2)
-{
- d_1_0_Deprecated->f.Rectsv(v1, v2);
-}
-
-inline void QOpenGLFunctions_3_2_Compatibility::glRects(GLshort x1, GLshort y1, GLshort x2, GLshort y2)
-{
- d_1_0_Deprecated->f.Rects(x1, y1, x2, y2);
-}
-
-inline void QOpenGLFunctions_3_2_Compatibility::glRectiv(const GLint *v1, const GLint *v2)
-{
- d_1_0_Deprecated->f.Rectiv(v1, v2);
-}
-
-inline void QOpenGLFunctions_3_2_Compatibility::glRecti(GLint x1, GLint y1, GLint x2, GLint y2)
-{
- d_1_0_Deprecated->f.Recti(x1, y1, x2, y2);
-}
-
-inline void QOpenGLFunctions_3_2_Compatibility::glRectfv(const GLfloat *v1, const GLfloat *v2)
-{
- d_1_0_Deprecated->f.Rectfv(v1, v2);
-}
-
-inline void QOpenGLFunctions_3_2_Compatibility::glRectf(GLfloat x1, GLfloat y1, GLfloat x2, GLfloat y2)
-{
- d_1_0_Deprecated->f.Rectf(x1, y1, x2, y2);
-}
-
-inline void QOpenGLFunctions_3_2_Compatibility::glRectdv(const GLdouble *v1, const GLdouble *v2)
-{
- d_1_0_Deprecated->f.Rectdv(v1, v2);
-}
-
-inline void QOpenGLFunctions_3_2_Compatibility::glRectd(GLdouble x1, GLdouble y1, GLdouble x2, GLdouble y2)
-{
- d_1_0_Deprecated->f.Rectd(x1, y1, x2, y2);
-}
-
-inline void QOpenGLFunctions_3_2_Compatibility::glRasterPos4sv(const GLshort *v)
-{
- d_1_0_Deprecated->f.RasterPos4sv(v);
-}
-
-inline void QOpenGLFunctions_3_2_Compatibility::glRasterPos4s(GLshort x, GLshort y, GLshort z, GLshort w)
-{
- d_1_0_Deprecated->f.RasterPos4s(x, y, z, w);
-}
-
-inline void QOpenGLFunctions_3_2_Compatibility::glRasterPos4iv(const GLint *v)
-{
- d_1_0_Deprecated->f.RasterPos4iv(v);
-}
-
-inline void QOpenGLFunctions_3_2_Compatibility::glRasterPos4i(GLint x, GLint y, GLint z, GLint w)
-{
- d_1_0_Deprecated->f.RasterPos4i(x, y, z, w);
-}
-
-inline void QOpenGLFunctions_3_2_Compatibility::glRasterPos4fv(const GLfloat *v)
-{
- d_1_0_Deprecated->f.RasterPos4fv(v);
-}
-
-inline void QOpenGLFunctions_3_2_Compatibility::glRasterPos4f(GLfloat x, GLfloat y, GLfloat z, GLfloat w)
-{
- d_1_0_Deprecated->f.RasterPos4f(x, y, z, w);
-}
-
-inline void QOpenGLFunctions_3_2_Compatibility::glRasterPos4dv(const GLdouble *v)
-{
- d_1_0_Deprecated->f.RasterPos4dv(v);
-}
-
-inline void QOpenGLFunctions_3_2_Compatibility::glRasterPos4d(GLdouble x, GLdouble y, GLdouble z, GLdouble w)
-{
- d_1_0_Deprecated->f.RasterPos4d(x, y, z, w);
-}
-
-inline void QOpenGLFunctions_3_2_Compatibility::glRasterPos3sv(const GLshort *v)
-{
- d_1_0_Deprecated->f.RasterPos3sv(v);
-}
-
-inline void QOpenGLFunctions_3_2_Compatibility::glRasterPos3s(GLshort x, GLshort y, GLshort z)
-{
- d_1_0_Deprecated->f.RasterPos3s(x, y, z);
-}
-
-inline void QOpenGLFunctions_3_2_Compatibility::glRasterPos3iv(const GLint *v)
-{
- d_1_0_Deprecated->f.RasterPos3iv(v);
-}
-
-inline void QOpenGLFunctions_3_2_Compatibility::glRasterPos3i(GLint x, GLint y, GLint z)
-{
- d_1_0_Deprecated->f.RasterPos3i(x, y, z);
-}
-
-inline void QOpenGLFunctions_3_2_Compatibility::glRasterPos3fv(const GLfloat *v)
-{
- d_1_0_Deprecated->f.RasterPos3fv(v);
-}
-
-inline void QOpenGLFunctions_3_2_Compatibility::glRasterPos3f(GLfloat x, GLfloat y, GLfloat z)
-{
- d_1_0_Deprecated->f.RasterPos3f(x, y, z);
-}
-
-inline void QOpenGLFunctions_3_2_Compatibility::glRasterPos3dv(const GLdouble *v)
-{
- d_1_0_Deprecated->f.RasterPos3dv(v);
-}
-
-inline void QOpenGLFunctions_3_2_Compatibility::glRasterPos3d(GLdouble x, GLdouble y, GLdouble z)
-{
- d_1_0_Deprecated->f.RasterPos3d(x, y, z);
-}
-
-inline void QOpenGLFunctions_3_2_Compatibility::glRasterPos2sv(const GLshort *v)
-{
- d_1_0_Deprecated->f.RasterPos2sv(v);
-}
-
-inline void QOpenGLFunctions_3_2_Compatibility::glRasterPos2s(GLshort x, GLshort y)
-{
- d_1_0_Deprecated->f.RasterPos2s(x, y);
-}
-
-inline void QOpenGLFunctions_3_2_Compatibility::glRasterPos2iv(const GLint *v)
-{
- d_1_0_Deprecated->f.RasterPos2iv(v);
-}
-
-inline void QOpenGLFunctions_3_2_Compatibility::glRasterPos2i(GLint x, GLint y)
-{
- d_1_0_Deprecated->f.RasterPos2i(x, y);
-}
-
-inline void QOpenGLFunctions_3_2_Compatibility::glRasterPos2fv(const GLfloat *v)
-{
- d_1_0_Deprecated->f.RasterPos2fv(v);
-}
-
-inline void QOpenGLFunctions_3_2_Compatibility::glRasterPos2f(GLfloat x, GLfloat y)
-{
- d_1_0_Deprecated->f.RasterPos2f(x, y);
-}
-
-inline void QOpenGLFunctions_3_2_Compatibility::glRasterPos2dv(const GLdouble *v)
-{
- d_1_0_Deprecated->f.RasterPos2dv(v);
-}
-
-inline void QOpenGLFunctions_3_2_Compatibility::glRasterPos2d(GLdouble x, GLdouble y)
-{
- d_1_0_Deprecated->f.RasterPos2d(x, y);
-}
-
-inline void QOpenGLFunctions_3_2_Compatibility::glNormal3sv(const GLshort *v)
-{
- d_1_0_Deprecated->f.Normal3sv(v);
-}
-
-inline void QOpenGLFunctions_3_2_Compatibility::glNormal3s(GLshort nx, GLshort ny, GLshort nz)
-{
- d_1_0_Deprecated->f.Normal3s(nx, ny, nz);
-}
-
-inline void QOpenGLFunctions_3_2_Compatibility::glNormal3iv(const GLint *v)
-{
- d_1_0_Deprecated->f.Normal3iv(v);
-}
-
-inline void QOpenGLFunctions_3_2_Compatibility::glNormal3i(GLint nx, GLint ny, GLint nz)
-{
- d_1_0_Deprecated->f.Normal3i(nx, ny, nz);
-}
-
-inline void QOpenGLFunctions_3_2_Compatibility::glNormal3fv(const GLfloat *v)
-{
- d_1_0_Deprecated->f.Normal3fv(v);
-}
-
-inline void QOpenGLFunctions_3_2_Compatibility::glNormal3f(GLfloat nx, GLfloat ny, GLfloat nz)
-{
- d_1_0_Deprecated->f.Normal3f(nx, ny, nz);
-}
-
-inline void QOpenGLFunctions_3_2_Compatibility::glNormal3dv(const GLdouble *v)
-{
- d_1_0_Deprecated->f.Normal3dv(v);
-}
-
-inline void QOpenGLFunctions_3_2_Compatibility::glNormal3d(GLdouble nx, GLdouble ny, GLdouble nz)
-{
- d_1_0_Deprecated->f.Normal3d(nx, ny, nz);
-}
-
-inline void QOpenGLFunctions_3_2_Compatibility::glNormal3bv(const GLbyte *v)
-{
- d_1_0_Deprecated->f.Normal3bv(v);
-}
-
-inline void QOpenGLFunctions_3_2_Compatibility::glNormal3b(GLbyte nx, GLbyte ny, GLbyte nz)
-{
- d_1_0_Deprecated->f.Normal3b(nx, ny, nz);
-}
-
-inline void QOpenGLFunctions_3_2_Compatibility::glIndexsv(const GLshort *c)
-{
- d_1_0_Deprecated->f.Indexsv(c);
-}
-
-inline void QOpenGLFunctions_3_2_Compatibility::glIndexs(GLshort c)
-{
- d_1_0_Deprecated->f.Indexs(c);
-}
-
-inline void QOpenGLFunctions_3_2_Compatibility::glIndexiv(const GLint *c)
-{
- d_1_0_Deprecated->f.Indexiv(c);
-}
-
-inline void QOpenGLFunctions_3_2_Compatibility::glIndexi(GLint c)
-{
- d_1_0_Deprecated->f.Indexi(c);
-}
-
-inline void QOpenGLFunctions_3_2_Compatibility::glIndexfv(const GLfloat *c)
-{
- d_1_0_Deprecated->f.Indexfv(c);
-}
-
-inline void QOpenGLFunctions_3_2_Compatibility::glIndexf(GLfloat c)
-{
- d_1_0_Deprecated->f.Indexf(c);
-}
-
-inline void QOpenGLFunctions_3_2_Compatibility::glIndexdv(const GLdouble *c)
-{
- d_1_0_Deprecated->f.Indexdv(c);
-}
-
-inline void QOpenGLFunctions_3_2_Compatibility::glIndexd(GLdouble c)
-{
- d_1_0_Deprecated->f.Indexd(c);
-}
-
-inline void QOpenGLFunctions_3_2_Compatibility::glEnd()
-{
- d_1_0_Deprecated->f.End();
-}
-
-inline void QOpenGLFunctions_3_2_Compatibility::glEdgeFlagv(const GLboolean *flag)
-{
- d_1_0_Deprecated->f.EdgeFlagv(flag);
-}
-
-inline void QOpenGLFunctions_3_2_Compatibility::glEdgeFlag(GLboolean flag)
-{
- d_1_0_Deprecated->f.EdgeFlag(flag);
-}
-
-inline void QOpenGLFunctions_3_2_Compatibility::glColor4usv(const GLushort *v)
-{
- d_1_0_Deprecated->f.Color4usv(v);
-}
-
-inline void QOpenGLFunctions_3_2_Compatibility::glColor4us(GLushort red, GLushort green, GLushort blue, GLushort alpha)
-{
- d_1_0_Deprecated->f.Color4us(red, green, blue, alpha);
-}
-
-inline void QOpenGLFunctions_3_2_Compatibility::glColor4uiv(const GLuint *v)
-{
- d_1_0_Deprecated->f.Color4uiv(v);
-}
-
-inline void QOpenGLFunctions_3_2_Compatibility::glColor4ui(GLuint red, GLuint green, GLuint blue, GLuint alpha)
-{
- d_1_0_Deprecated->f.Color4ui(red, green, blue, alpha);
-}
-
-inline void QOpenGLFunctions_3_2_Compatibility::glColor4ubv(const GLubyte *v)
-{
- d_1_0_Deprecated->f.Color4ubv(v);
-}
-
-inline void QOpenGLFunctions_3_2_Compatibility::glColor4ub(GLubyte red, GLubyte green, GLubyte blue, GLubyte alpha)
-{
- d_1_0_Deprecated->f.Color4ub(red, green, blue, alpha);
-}
-
-inline void QOpenGLFunctions_3_2_Compatibility::glColor4sv(const GLshort *v)
-{
- d_1_0_Deprecated->f.Color4sv(v);
-}
-
-inline void QOpenGLFunctions_3_2_Compatibility::glColor4s(GLshort red, GLshort green, GLshort blue, GLshort alpha)
-{
- d_1_0_Deprecated->f.Color4s(red, green, blue, alpha);
-}
-
-inline void QOpenGLFunctions_3_2_Compatibility::glColor4iv(const GLint *v)
-{
- d_1_0_Deprecated->f.Color4iv(v);
-}
-
-inline void QOpenGLFunctions_3_2_Compatibility::glColor4i(GLint red, GLint green, GLint blue, GLint alpha)
-{
- d_1_0_Deprecated->f.Color4i(red, green, blue, alpha);
-}
-
-inline void QOpenGLFunctions_3_2_Compatibility::glColor4fv(const GLfloat *v)
-{
- d_1_0_Deprecated->f.Color4fv(v);
-}
-
-inline void QOpenGLFunctions_3_2_Compatibility::glColor4f(GLfloat red, GLfloat green, GLfloat blue, GLfloat alpha)
-{
- d_1_0_Deprecated->f.Color4f(red, green, blue, alpha);
-}
-
-inline void QOpenGLFunctions_3_2_Compatibility::glColor4dv(const GLdouble *v)
-{
- d_1_0_Deprecated->f.Color4dv(v);
-}
-
-inline void QOpenGLFunctions_3_2_Compatibility::glColor4d(GLdouble red, GLdouble green, GLdouble blue, GLdouble alpha)
-{
- d_1_0_Deprecated->f.Color4d(red, green, blue, alpha);
-}
-
-inline void QOpenGLFunctions_3_2_Compatibility::glColor4bv(const GLbyte *v)
-{
- d_1_0_Deprecated->f.Color4bv(v);
-}
-
-inline void QOpenGLFunctions_3_2_Compatibility::glColor4b(GLbyte red, GLbyte green, GLbyte blue, GLbyte alpha)
-{
- d_1_0_Deprecated->f.Color4b(red, green, blue, alpha);
-}
-
-inline void QOpenGLFunctions_3_2_Compatibility::glColor3usv(const GLushort *v)
-{
- d_1_0_Deprecated->f.Color3usv(v);
-}
-
-inline void QOpenGLFunctions_3_2_Compatibility::glColor3us(GLushort red, GLushort green, GLushort blue)
-{
- d_1_0_Deprecated->f.Color3us(red, green, blue);
-}
-
-inline void QOpenGLFunctions_3_2_Compatibility::glColor3uiv(const GLuint *v)
-{
- d_1_0_Deprecated->f.Color3uiv(v);
-}
-
-inline void QOpenGLFunctions_3_2_Compatibility::glColor3ui(GLuint red, GLuint green, GLuint blue)
-{
- d_1_0_Deprecated->f.Color3ui(red, green, blue);
-}
-
-inline void QOpenGLFunctions_3_2_Compatibility::glColor3ubv(const GLubyte *v)
-{
- d_1_0_Deprecated->f.Color3ubv(v);
-}
-
-inline void QOpenGLFunctions_3_2_Compatibility::glColor3ub(GLubyte red, GLubyte green, GLubyte blue)
-{
- d_1_0_Deprecated->f.Color3ub(red, green, blue);
-}
-
-inline void QOpenGLFunctions_3_2_Compatibility::glColor3sv(const GLshort *v)
-{
- d_1_0_Deprecated->f.Color3sv(v);
-}
-
-inline void QOpenGLFunctions_3_2_Compatibility::glColor3s(GLshort red, GLshort green, GLshort blue)
-{
- d_1_0_Deprecated->f.Color3s(red, green, blue);
-}
-
-inline void QOpenGLFunctions_3_2_Compatibility::glColor3iv(const GLint *v)
-{
- d_1_0_Deprecated->f.Color3iv(v);
-}
-
-inline void QOpenGLFunctions_3_2_Compatibility::glColor3i(GLint red, GLint green, GLint blue)
-{
- d_1_0_Deprecated->f.Color3i(red, green, blue);
-}
-
-inline void QOpenGLFunctions_3_2_Compatibility::glColor3fv(const GLfloat *v)
-{
- d_1_0_Deprecated->f.Color3fv(v);
-}
-
-inline void QOpenGLFunctions_3_2_Compatibility::glColor3f(GLfloat red, GLfloat green, GLfloat blue)
-{
- d_1_0_Deprecated->f.Color3f(red, green, blue);
-}
-
-inline void QOpenGLFunctions_3_2_Compatibility::glColor3dv(const GLdouble *v)
-{
- d_1_0_Deprecated->f.Color3dv(v);
-}
-
-inline void QOpenGLFunctions_3_2_Compatibility::glColor3d(GLdouble red, GLdouble green, GLdouble blue)
-{
- d_1_0_Deprecated->f.Color3d(red, green, blue);
-}
-
-inline void QOpenGLFunctions_3_2_Compatibility::glColor3bv(const GLbyte *v)
-{
- d_1_0_Deprecated->f.Color3bv(v);
-}
-
-inline void QOpenGLFunctions_3_2_Compatibility::glColor3b(GLbyte red, GLbyte green, GLbyte blue)
-{
- d_1_0_Deprecated->f.Color3b(red, green, blue);
-}
-
-inline void QOpenGLFunctions_3_2_Compatibility::glBitmap(GLsizei width, GLsizei height, GLfloat xorig, GLfloat yorig, GLfloat xmove, GLfloat ymove, const GLubyte *bitmap)
-{
- d_1_0_Deprecated->f.Bitmap(width, height, xorig, yorig, xmove, ymove, bitmap);
-}
-
-inline void QOpenGLFunctions_3_2_Compatibility::glBegin(GLenum mode)
-{
- d_1_0_Deprecated->f.Begin(mode);
-}
-
-inline void QOpenGLFunctions_3_2_Compatibility::glListBase(GLuint base)
-{
- d_1_0_Deprecated->f.ListBase(base);
-}
-
-inline GLuint QOpenGLFunctions_3_2_Compatibility::glGenLists(GLsizei range)
-{
- return d_1_0_Deprecated->f.GenLists(range);
-}
-
-inline void QOpenGLFunctions_3_2_Compatibility::glDeleteLists(GLuint list, GLsizei range)
-{
- d_1_0_Deprecated->f.DeleteLists(list, range);
-}
-
-inline void QOpenGLFunctions_3_2_Compatibility::glCallLists(GLsizei n, GLenum type, const GLvoid *lists)
-{
- d_1_0_Deprecated->f.CallLists(n, type, lists);
-}
-
-inline void QOpenGLFunctions_3_2_Compatibility::glCallList(GLuint list)
-{
- d_1_0_Deprecated->f.CallList(list);
-}
-
-inline void QOpenGLFunctions_3_2_Compatibility::glEndList()
-{
- d_1_0_Deprecated->f.EndList();
-}
-
-inline void QOpenGLFunctions_3_2_Compatibility::glNewList(GLuint list, GLenum mode)
-{
- d_1_0_Deprecated->f.NewList(list, mode);
-}
-
-
-// OpenGL 1.1 deprecated functions
-inline void QOpenGLFunctions_3_2_Compatibility::glPushClientAttrib(GLbitfield mask)
-{
- d_1_1_Deprecated->f.PushClientAttrib(mask);
-}
-
-inline void QOpenGLFunctions_3_2_Compatibility::glPopClientAttrib()
-{
- d_1_1_Deprecated->f.PopClientAttrib();
-}
-
-inline void QOpenGLFunctions_3_2_Compatibility::glPrioritizeTextures(GLsizei n, const GLuint *textures, const GLfloat *priorities)
-{
- d_1_1_Deprecated->f.PrioritizeTextures(n, textures, priorities);
-}
-
-inline GLboolean QOpenGLFunctions_3_2_Compatibility::glAreTexturesResident(GLsizei n, const GLuint *textures, GLboolean *residences)
-{
- return d_1_1_Deprecated->f.AreTexturesResident(n, textures, residences);
-}
-
-inline void QOpenGLFunctions_3_2_Compatibility::glVertexPointer(GLint size, GLenum type, GLsizei stride, const GLvoid *pointer)
-{
- d_1_1_Deprecated->f.VertexPointer(size, type, stride, pointer);
-}
-
-inline void QOpenGLFunctions_3_2_Compatibility::glTexCoordPointer(GLint size, GLenum type, GLsizei stride, const GLvoid *pointer)
-{
- d_1_1_Deprecated->f.TexCoordPointer(size, type, stride, pointer);
-}
-
-inline void QOpenGLFunctions_3_2_Compatibility::glNormalPointer(GLenum type, GLsizei stride, const GLvoid *pointer)
-{
- d_1_1_Deprecated->f.NormalPointer(type, stride, pointer);
-}
-
-inline void QOpenGLFunctions_3_2_Compatibility::glInterleavedArrays(GLenum format, GLsizei stride, const GLvoid *pointer)
-{
- d_1_1_Deprecated->f.InterleavedArrays(format, stride, pointer);
-}
-
-inline void QOpenGLFunctions_3_2_Compatibility::glIndexPointer(GLenum type, GLsizei stride, const GLvoid *pointer)
-{
- d_1_1_Deprecated->f.IndexPointer(type, stride, pointer);
-}
-
-inline void QOpenGLFunctions_3_2_Compatibility::glEnableClientState(GLenum array)
-{
- d_1_1_Deprecated->f.EnableClientState(array);
-}
-
-inline void QOpenGLFunctions_3_2_Compatibility::glEdgeFlagPointer(GLsizei stride, const GLvoid *pointer)
-{
- d_1_1_Deprecated->f.EdgeFlagPointer(stride, pointer);
-}
-
-inline void QOpenGLFunctions_3_2_Compatibility::glDisableClientState(GLenum array)
-{
- d_1_1_Deprecated->f.DisableClientState(array);
-}
-
-inline void QOpenGLFunctions_3_2_Compatibility::glColorPointer(GLint size, GLenum type, GLsizei stride, const GLvoid *pointer)
-{
- d_1_1_Deprecated->f.ColorPointer(size, type, stride, pointer);
-}
-
-inline void QOpenGLFunctions_3_2_Compatibility::glArrayElement(GLint i)
-{
- d_1_1_Deprecated->f.ArrayElement(i);
-}
-
-
-// OpenGL 1.2 deprecated functions
-inline void QOpenGLFunctions_3_2_Compatibility::glResetMinmax(GLenum target)
-{
- d_1_2_Deprecated->f.ResetMinmax(target);
-}
-
-inline void QOpenGLFunctions_3_2_Compatibility::glResetHistogram(GLenum target)
-{
- d_1_2_Deprecated->f.ResetHistogram(target);
-}
-
-inline void QOpenGLFunctions_3_2_Compatibility::glMinmax(GLenum target, GLenum internalformat, GLboolean sink)
-{
- d_1_2_Deprecated->f.Minmax(target, internalformat, sink);
-}
-
-inline void QOpenGLFunctions_3_2_Compatibility::glHistogram(GLenum target, GLsizei width, GLenum internalformat, GLboolean sink)
-{
- d_1_2_Deprecated->f.Histogram(target, width, internalformat, sink);
-}
-
-inline void QOpenGLFunctions_3_2_Compatibility::glGetMinmaxParameteriv(GLenum target, GLenum pname, GLint *params)
-{
- d_1_2_Deprecated->f.GetMinmaxParameteriv(target, pname, params);
-}
-
-inline void QOpenGLFunctions_3_2_Compatibility::glGetMinmaxParameterfv(GLenum target, GLenum pname, GLfloat *params)
-{
- d_1_2_Deprecated->f.GetMinmaxParameterfv(target, pname, params);
-}
-
-inline void QOpenGLFunctions_3_2_Compatibility::glGetMinmax(GLenum target, GLboolean reset, GLenum format, GLenum type, GLvoid *values)
-{
- d_1_2_Deprecated->f.GetMinmax(target, reset, format, type, values);
-}
-
-inline void QOpenGLFunctions_3_2_Compatibility::glGetHistogramParameteriv(GLenum target, GLenum pname, GLint *params)
-{
- d_1_2_Deprecated->f.GetHistogramParameteriv(target, pname, params);
-}
-
-inline void QOpenGLFunctions_3_2_Compatibility::glGetHistogramParameterfv(GLenum target, GLenum pname, GLfloat *params)
-{
- d_1_2_Deprecated->f.GetHistogramParameterfv(target, pname, params);
-}
-
-inline void QOpenGLFunctions_3_2_Compatibility::glGetHistogram(GLenum target, GLboolean reset, GLenum format, GLenum type, GLvoid *values)
-{
- d_1_2_Deprecated->f.GetHistogram(target, reset, format, type, values);
-}
-
-inline void QOpenGLFunctions_3_2_Compatibility::glSeparableFilter2D(GLenum target, GLenum internalformat, GLsizei width, GLsizei height, GLenum format, GLenum type, const GLvoid *row, const GLvoid *column)
-{
- d_1_2_Deprecated->f.SeparableFilter2D(target, internalformat, width, height, format, type, row, column);
-}
-
-inline void QOpenGLFunctions_3_2_Compatibility::glGetSeparableFilter(GLenum target, GLenum format, GLenum type, GLvoid *row, GLvoid *column, GLvoid *span)
-{
- d_1_2_Deprecated->f.GetSeparableFilter(target, format, type, row, column, span);
-}
-
-inline void QOpenGLFunctions_3_2_Compatibility::glGetConvolutionParameteriv(GLenum target, GLenum pname, GLint *params)
-{
- d_1_2_Deprecated->f.GetConvolutionParameteriv(target, pname, params);
-}
-
-inline void QOpenGLFunctions_3_2_Compatibility::glGetConvolutionParameterfv(GLenum target, GLenum pname, GLfloat *params)
-{
- d_1_2_Deprecated->f.GetConvolutionParameterfv(target, pname, params);
-}
-
-inline void QOpenGLFunctions_3_2_Compatibility::glGetConvolutionFilter(GLenum target, GLenum format, GLenum type, GLvoid *image)
-{
- d_1_2_Deprecated->f.GetConvolutionFilter(target, format, type, image);
-}
-
-inline void QOpenGLFunctions_3_2_Compatibility::glCopyConvolutionFilter2D(GLenum target, GLenum internalformat, GLint x, GLint y, GLsizei width, GLsizei height)
-{
- d_1_2_Deprecated->f.CopyConvolutionFilter2D(target, internalformat, x, y, width, height);
-}
-
-inline void QOpenGLFunctions_3_2_Compatibility::glCopyConvolutionFilter1D(GLenum target, GLenum internalformat, GLint x, GLint y, GLsizei width)
-{
- d_1_2_Deprecated->f.CopyConvolutionFilter1D(target, internalformat, x, y, width);
-}
-
-inline void QOpenGLFunctions_3_2_Compatibility::glConvolutionParameteriv(GLenum target, GLenum pname, const GLint *params)
-{
- d_1_2_Deprecated->f.ConvolutionParameteriv(target, pname, params);
-}
-
-inline void QOpenGLFunctions_3_2_Compatibility::glConvolutionParameteri(GLenum target, GLenum pname, GLint params)
-{
- d_1_2_Deprecated->f.ConvolutionParameteri(target, pname, params);
-}
-
-inline void QOpenGLFunctions_3_2_Compatibility::glConvolutionParameterfv(GLenum target, GLenum pname, const GLfloat *params)
-{
- d_1_2_Deprecated->f.ConvolutionParameterfv(target, pname, params);
-}
-
-inline void QOpenGLFunctions_3_2_Compatibility::glConvolutionParameterf(GLenum target, GLenum pname, GLfloat params)
-{
- d_1_2_Deprecated->f.ConvolutionParameterf(target, pname, params);
-}
-
-inline void QOpenGLFunctions_3_2_Compatibility::glConvolutionFilter2D(GLenum target, GLenum internalformat, GLsizei width, GLsizei height, GLenum format, GLenum type, const GLvoid *image)
-{
- d_1_2_Deprecated->f.ConvolutionFilter2D(target, internalformat, width, height, format, type, image);
-}
-
-inline void QOpenGLFunctions_3_2_Compatibility::glConvolutionFilter1D(GLenum target, GLenum internalformat, GLsizei width, GLenum format, GLenum type, const GLvoid *image)
-{
- d_1_2_Deprecated->f.ConvolutionFilter1D(target, internalformat, width, format, type, image);
-}
-
-inline void QOpenGLFunctions_3_2_Compatibility::glCopyColorSubTable(GLenum target, GLsizei start, GLint x, GLint y, GLsizei width)
-{
- d_1_2_Deprecated->f.CopyColorSubTable(target, start, x, y, width);
-}
-
-inline void QOpenGLFunctions_3_2_Compatibility::glColorSubTable(GLenum target, GLsizei start, GLsizei count, GLenum format, GLenum type, const GLvoid *data)
-{
- d_1_2_Deprecated->f.ColorSubTable(target, start, count, format, type, data);
-}
-
-inline void QOpenGLFunctions_3_2_Compatibility::glGetColorTableParameteriv(GLenum target, GLenum pname, GLint *params)
-{
- d_1_2_Deprecated->f.GetColorTableParameteriv(target, pname, params);
-}
-
-inline void QOpenGLFunctions_3_2_Compatibility::glGetColorTableParameterfv(GLenum target, GLenum pname, GLfloat *params)
-{
- d_1_2_Deprecated->f.GetColorTableParameterfv(target, pname, params);
-}
-
-inline void QOpenGLFunctions_3_2_Compatibility::glGetColorTable(GLenum target, GLenum format, GLenum type, GLvoid *table)
-{
- d_1_2_Deprecated->f.GetColorTable(target, format, type, table);
-}
-
-inline void QOpenGLFunctions_3_2_Compatibility::glCopyColorTable(GLenum target, GLenum internalformat, GLint x, GLint y, GLsizei width)
-{
- d_1_2_Deprecated->f.CopyColorTable(target, internalformat, x, y, width);
-}
-
-inline void QOpenGLFunctions_3_2_Compatibility::glColorTableParameteriv(GLenum target, GLenum pname, const GLint *params)
-{
- d_1_2_Deprecated->f.ColorTableParameteriv(target, pname, params);
-}
-
-inline void QOpenGLFunctions_3_2_Compatibility::glColorTableParameterfv(GLenum target, GLenum pname, const GLfloat *params)
-{
- d_1_2_Deprecated->f.ColorTableParameterfv(target, pname, params);
-}
-
-inline void QOpenGLFunctions_3_2_Compatibility::glColorTable(GLenum target, GLenum internalformat, GLsizei width, GLenum format, GLenum type, const GLvoid *table)
-{
- d_1_2_Deprecated->f.ColorTable(target, internalformat, width, format, type, table);
-}
-
-
-// OpenGL 1.3 deprecated functions
-inline void QOpenGLFunctions_3_2_Compatibility::glMultTransposeMatrixd(const GLdouble *m)
-{
- d_1_3_Deprecated->f.MultTransposeMatrixd(m);
-}
-
-inline void QOpenGLFunctions_3_2_Compatibility::glMultTransposeMatrixf(const GLfloat *m)
-{
- d_1_3_Deprecated->f.MultTransposeMatrixf(m);
-}
-
-inline void QOpenGLFunctions_3_2_Compatibility::glLoadTransposeMatrixd(const GLdouble *m)
-{
- d_1_3_Deprecated->f.LoadTransposeMatrixd(m);
-}
-
-inline void QOpenGLFunctions_3_2_Compatibility::glLoadTransposeMatrixf(const GLfloat *m)
-{
- d_1_3_Deprecated->f.LoadTransposeMatrixf(m);
-}
-
-inline void QOpenGLFunctions_3_2_Compatibility::glMultiTexCoord4sv(GLenum target, const GLshort *v)
-{
- d_1_3_Deprecated->f.MultiTexCoord4sv(target, v);
-}
-
-inline void QOpenGLFunctions_3_2_Compatibility::glMultiTexCoord4s(GLenum target, GLshort s, GLshort t, GLshort r, GLshort q)
-{
- d_1_3_Deprecated->f.MultiTexCoord4s(target, s, t, r, q);
-}
-
-inline void QOpenGLFunctions_3_2_Compatibility::glMultiTexCoord4iv(GLenum target, const GLint *v)
-{
- d_1_3_Deprecated->f.MultiTexCoord4iv(target, v);
-}
-
-inline void QOpenGLFunctions_3_2_Compatibility::glMultiTexCoord4i(GLenum target, GLint s, GLint t, GLint r, GLint q)
-{
- d_1_3_Deprecated->f.MultiTexCoord4i(target, s, t, r, q);
-}
-
-inline void QOpenGLFunctions_3_2_Compatibility::glMultiTexCoord4fv(GLenum target, const GLfloat *v)
-{
- d_1_3_Deprecated->f.MultiTexCoord4fv(target, v);
-}
-
-inline void QOpenGLFunctions_3_2_Compatibility::glMultiTexCoord4f(GLenum target, GLfloat s, GLfloat t, GLfloat r, GLfloat q)
-{
- d_1_3_Deprecated->f.MultiTexCoord4f(target, s, t, r, q);
-}
-
-inline void QOpenGLFunctions_3_2_Compatibility::glMultiTexCoord4dv(GLenum target, const GLdouble *v)
-{
- d_1_3_Deprecated->f.MultiTexCoord4dv(target, v);
-}
-
-inline void QOpenGLFunctions_3_2_Compatibility::glMultiTexCoord4d(GLenum target, GLdouble s, GLdouble t, GLdouble r, GLdouble q)
-{
- d_1_3_Deprecated->f.MultiTexCoord4d(target, s, t, r, q);
-}
-
-inline void QOpenGLFunctions_3_2_Compatibility::glMultiTexCoord3sv(GLenum target, const GLshort *v)
-{
- d_1_3_Deprecated->f.MultiTexCoord3sv(target, v);
-}
-
-inline void QOpenGLFunctions_3_2_Compatibility::glMultiTexCoord3s(GLenum target, GLshort s, GLshort t, GLshort r)
-{
- d_1_3_Deprecated->f.MultiTexCoord3s(target, s, t, r);
-}
-
-inline void QOpenGLFunctions_3_2_Compatibility::glMultiTexCoord3iv(GLenum target, const GLint *v)
-{
- d_1_3_Deprecated->f.MultiTexCoord3iv(target, v);
-}
-
-inline void QOpenGLFunctions_3_2_Compatibility::glMultiTexCoord3i(GLenum target, GLint s, GLint t, GLint r)
-{
- d_1_3_Deprecated->f.MultiTexCoord3i(target, s, t, r);
-}
-
-inline void QOpenGLFunctions_3_2_Compatibility::glMultiTexCoord3fv(GLenum target, const GLfloat *v)
-{
- d_1_3_Deprecated->f.MultiTexCoord3fv(target, v);
-}
-
-inline void QOpenGLFunctions_3_2_Compatibility::glMultiTexCoord3f(GLenum target, GLfloat s, GLfloat t, GLfloat r)
-{
- d_1_3_Deprecated->f.MultiTexCoord3f(target, s, t, r);
-}
-
-inline void QOpenGLFunctions_3_2_Compatibility::glMultiTexCoord3dv(GLenum target, const GLdouble *v)
-{
- d_1_3_Deprecated->f.MultiTexCoord3dv(target, v);
-}
-
-inline void QOpenGLFunctions_3_2_Compatibility::glMultiTexCoord3d(GLenum target, GLdouble s, GLdouble t, GLdouble r)
-{
- d_1_3_Deprecated->f.MultiTexCoord3d(target, s, t, r);
-}
-
-inline void QOpenGLFunctions_3_2_Compatibility::glMultiTexCoord2sv(GLenum target, const GLshort *v)
-{
- d_1_3_Deprecated->f.MultiTexCoord2sv(target, v);
-}
-
-inline void QOpenGLFunctions_3_2_Compatibility::glMultiTexCoord2s(GLenum target, GLshort s, GLshort t)
-{
- d_1_3_Deprecated->f.MultiTexCoord2s(target, s, t);
-}
-
-inline void QOpenGLFunctions_3_2_Compatibility::glMultiTexCoord2iv(GLenum target, const GLint *v)
-{
- d_1_3_Deprecated->f.MultiTexCoord2iv(target, v);
-}
-
-inline void QOpenGLFunctions_3_2_Compatibility::glMultiTexCoord2i(GLenum target, GLint s, GLint t)
-{
- d_1_3_Deprecated->f.MultiTexCoord2i(target, s, t);
-}
-
-inline void QOpenGLFunctions_3_2_Compatibility::glMultiTexCoord2fv(GLenum target, const GLfloat *v)
-{
- d_1_3_Deprecated->f.MultiTexCoord2fv(target, v);
-}
-
-inline void QOpenGLFunctions_3_2_Compatibility::glMultiTexCoord2f(GLenum target, GLfloat s, GLfloat t)
-{
- d_1_3_Deprecated->f.MultiTexCoord2f(target, s, t);
-}
-
-inline void QOpenGLFunctions_3_2_Compatibility::glMultiTexCoord2dv(GLenum target, const GLdouble *v)
-{
- d_1_3_Deprecated->f.MultiTexCoord2dv(target, v);
-}
-
-inline void QOpenGLFunctions_3_2_Compatibility::glMultiTexCoord2d(GLenum target, GLdouble s, GLdouble t)
-{
- d_1_3_Deprecated->f.MultiTexCoord2d(target, s, t);
-}
-
-inline void QOpenGLFunctions_3_2_Compatibility::glMultiTexCoord1sv(GLenum target, const GLshort *v)
-{
- d_1_3_Deprecated->f.MultiTexCoord1sv(target, v);
-}
-
-inline void QOpenGLFunctions_3_2_Compatibility::glMultiTexCoord1s(GLenum target, GLshort s)
-{
- d_1_3_Deprecated->f.MultiTexCoord1s(target, s);
-}
-
-inline void QOpenGLFunctions_3_2_Compatibility::glMultiTexCoord1iv(GLenum target, const GLint *v)
-{
- d_1_3_Deprecated->f.MultiTexCoord1iv(target, v);
-}
-
-inline void QOpenGLFunctions_3_2_Compatibility::glMultiTexCoord1i(GLenum target, GLint s)
-{
- d_1_3_Deprecated->f.MultiTexCoord1i(target, s);
-}
-
-inline void QOpenGLFunctions_3_2_Compatibility::glMultiTexCoord1fv(GLenum target, const GLfloat *v)
-{
- d_1_3_Deprecated->f.MultiTexCoord1fv(target, v);
-}
-
-inline void QOpenGLFunctions_3_2_Compatibility::glMultiTexCoord1f(GLenum target, GLfloat s)
-{
- d_1_3_Deprecated->f.MultiTexCoord1f(target, s);
-}
-
-inline void QOpenGLFunctions_3_2_Compatibility::glMultiTexCoord1dv(GLenum target, const GLdouble *v)
-{
- d_1_3_Deprecated->f.MultiTexCoord1dv(target, v);
-}
-
-inline void QOpenGLFunctions_3_2_Compatibility::glMultiTexCoord1d(GLenum target, GLdouble s)
-{
- d_1_3_Deprecated->f.MultiTexCoord1d(target, s);
-}
-
-inline void QOpenGLFunctions_3_2_Compatibility::glClientActiveTexture(GLenum texture)
-{
- d_1_3_Deprecated->f.ClientActiveTexture(texture);
-}
-
-
-// OpenGL 1.4 deprecated functions
-inline void QOpenGLFunctions_3_2_Compatibility::glWindowPos3sv(const GLshort *v)
-{
- d_1_4_Deprecated->f.WindowPos3sv(v);
-}
-
-inline void QOpenGLFunctions_3_2_Compatibility::glWindowPos3s(GLshort x, GLshort y, GLshort z)
-{
- d_1_4_Deprecated->f.WindowPos3s(x, y, z);
-}
-
-inline void QOpenGLFunctions_3_2_Compatibility::glWindowPos3iv(const GLint *v)
-{
- d_1_4_Deprecated->f.WindowPos3iv(v);
-}
-
-inline void QOpenGLFunctions_3_2_Compatibility::glWindowPos3i(GLint x, GLint y, GLint z)
-{
- d_1_4_Deprecated->f.WindowPos3i(x, y, z);
-}
-
-inline void QOpenGLFunctions_3_2_Compatibility::glWindowPos3fv(const GLfloat *v)
-{
- d_1_4_Deprecated->f.WindowPos3fv(v);
-}
-
-inline void QOpenGLFunctions_3_2_Compatibility::glWindowPos3f(GLfloat x, GLfloat y, GLfloat z)
-{
- d_1_4_Deprecated->f.WindowPos3f(x, y, z);
-}
-
-inline void QOpenGLFunctions_3_2_Compatibility::glWindowPos3dv(const GLdouble *v)
-{
- d_1_4_Deprecated->f.WindowPos3dv(v);
-}
-
-inline void QOpenGLFunctions_3_2_Compatibility::glWindowPos3d(GLdouble x, GLdouble y, GLdouble z)
-{
- d_1_4_Deprecated->f.WindowPos3d(x, y, z);
-}
-
-inline void QOpenGLFunctions_3_2_Compatibility::glWindowPos2sv(const GLshort *v)
-{
- d_1_4_Deprecated->f.WindowPos2sv(v);
-}
-
-inline void QOpenGLFunctions_3_2_Compatibility::glWindowPos2s(GLshort x, GLshort y)
-{
- d_1_4_Deprecated->f.WindowPos2s(x, y);
-}
-
-inline void QOpenGLFunctions_3_2_Compatibility::glWindowPos2iv(const GLint *v)
-{
- d_1_4_Deprecated->f.WindowPos2iv(v);
-}
-
-inline void QOpenGLFunctions_3_2_Compatibility::glWindowPos2i(GLint x, GLint y)
-{
- d_1_4_Deprecated->f.WindowPos2i(x, y);
-}
-
-inline void QOpenGLFunctions_3_2_Compatibility::glWindowPos2fv(const GLfloat *v)
-{
- d_1_4_Deprecated->f.WindowPos2fv(v);
-}
-
-inline void QOpenGLFunctions_3_2_Compatibility::glWindowPos2f(GLfloat x, GLfloat y)
-{
- d_1_4_Deprecated->f.WindowPos2f(x, y);
-}
-
-inline void QOpenGLFunctions_3_2_Compatibility::glWindowPos2dv(const GLdouble *v)
-{
- d_1_4_Deprecated->f.WindowPos2dv(v);
-}
-
-inline void QOpenGLFunctions_3_2_Compatibility::glWindowPos2d(GLdouble x, GLdouble y)
-{
- d_1_4_Deprecated->f.WindowPos2d(x, y);
-}
-
-inline void QOpenGLFunctions_3_2_Compatibility::glSecondaryColorPointer(GLint size, GLenum type, GLsizei stride, const GLvoid *pointer)
-{
- d_1_4_Deprecated->f.SecondaryColorPointer(size, type, stride, pointer);
-}
-
-inline void QOpenGLFunctions_3_2_Compatibility::glSecondaryColor3usv(const GLushort *v)
-{
- d_1_4_Deprecated->f.SecondaryColor3usv(v);
-}
-
-inline void QOpenGLFunctions_3_2_Compatibility::glSecondaryColor3us(GLushort red, GLushort green, GLushort blue)
-{
- d_1_4_Deprecated->f.SecondaryColor3us(red, green, blue);
-}
-
-inline void QOpenGLFunctions_3_2_Compatibility::glSecondaryColor3uiv(const GLuint *v)
-{
- d_1_4_Deprecated->f.SecondaryColor3uiv(v);
-}
-
-inline void QOpenGLFunctions_3_2_Compatibility::glSecondaryColor3ui(GLuint red, GLuint green, GLuint blue)
-{
- d_1_4_Deprecated->f.SecondaryColor3ui(red, green, blue);
-}
-
-inline void QOpenGLFunctions_3_2_Compatibility::glSecondaryColor3ubv(const GLubyte *v)
-{
- d_1_4_Deprecated->f.SecondaryColor3ubv(v);
-}
-
-inline void QOpenGLFunctions_3_2_Compatibility::glSecondaryColor3ub(GLubyte red, GLubyte green, GLubyte blue)
-{
- d_1_4_Deprecated->f.SecondaryColor3ub(red, green, blue);
-}
-
-inline void QOpenGLFunctions_3_2_Compatibility::glSecondaryColor3sv(const GLshort *v)
-{
- d_1_4_Deprecated->f.SecondaryColor3sv(v);
-}
-
-inline void QOpenGLFunctions_3_2_Compatibility::glSecondaryColor3s(GLshort red, GLshort green, GLshort blue)
-{
- d_1_4_Deprecated->f.SecondaryColor3s(red, green, blue);
-}
-
-inline void QOpenGLFunctions_3_2_Compatibility::glSecondaryColor3iv(const GLint *v)
-{
- d_1_4_Deprecated->f.SecondaryColor3iv(v);
-}
-
-inline void QOpenGLFunctions_3_2_Compatibility::glSecondaryColor3i(GLint red, GLint green, GLint blue)
-{
- d_1_4_Deprecated->f.SecondaryColor3i(red, green, blue);
-}
-
-inline void QOpenGLFunctions_3_2_Compatibility::glSecondaryColor3fv(const GLfloat *v)
-{
- d_1_4_Deprecated->f.SecondaryColor3fv(v);
-}
-
-inline void QOpenGLFunctions_3_2_Compatibility::glSecondaryColor3f(GLfloat red, GLfloat green, GLfloat blue)
-{
- d_1_4_Deprecated->f.SecondaryColor3f(red, green, blue);
-}
-
-inline void QOpenGLFunctions_3_2_Compatibility::glSecondaryColor3dv(const GLdouble *v)
-{
- d_1_4_Deprecated->f.SecondaryColor3dv(v);
-}
-
-inline void QOpenGLFunctions_3_2_Compatibility::glSecondaryColor3d(GLdouble red, GLdouble green, GLdouble blue)
-{
- d_1_4_Deprecated->f.SecondaryColor3d(red, green, blue);
-}
-
-inline void QOpenGLFunctions_3_2_Compatibility::glSecondaryColor3bv(const GLbyte *v)
-{
- d_1_4_Deprecated->f.SecondaryColor3bv(v);
-}
-
-inline void QOpenGLFunctions_3_2_Compatibility::glSecondaryColor3b(GLbyte red, GLbyte green, GLbyte blue)
-{
- d_1_4_Deprecated->f.SecondaryColor3b(red, green, blue);
-}
-
-inline void QOpenGLFunctions_3_2_Compatibility::glFogCoordPointer(GLenum type, GLsizei stride, const GLvoid *pointer)
-{
- d_1_4_Deprecated->f.FogCoordPointer(type, stride, pointer);
-}
-
-inline void QOpenGLFunctions_3_2_Compatibility::glFogCoorddv(const GLdouble *coord)
-{
- d_1_4_Deprecated->f.FogCoorddv(coord);
-}
-
-inline void QOpenGLFunctions_3_2_Compatibility::glFogCoordd(GLdouble coord)
-{
- d_1_4_Deprecated->f.FogCoordd(coord);
-}
-
-inline void QOpenGLFunctions_3_2_Compatibility::glFogCoordfv(const GLfloat *coord)
-{
- d_1_4_Deprecated->f.FogCoordfv(coord);
-}
-
-inline void QOpenGLFunctions_3_2_Compatibility::glFogCoordf(GLfloat coord)
-{
- d_1_4_Deprecated->f.FogCoordf(coord);
-}
-
-
-// OpenGL 1.5 deprecated functions
-
-// OpenGL 2.0 deprecated functions
-inline void QOpenGLFunctions_3_2_Compatibility::glVertexAttrib4usv(GLuint index, const GLushort *v)
-{
- d_2_0_Core->f.VertexAttrib4usv(index, v);
-}
-
-inline void QOpenGLFunctions_3_2_Compatibility::glVertexAttrib4uiv(GLuint index, const GLuint *v)
-{
- d_2_0_Core->f.VertexAttrib4uiv(index, v);
-}
-
-inline void QOpenGLFunctions_3_2_Compatibility::glVertexAttrib4ubv(GLuint index, const GLubyte *v)
-{
- d_2_0_Core->f.VertexAttrib4ubv(index, v);
-}
-
-inline void QOpenGLFunctions_3_2_Compatibility::glVertexAttrib4sv(GLuint index, const GLshort *v)
-{
- d_2_0_Core->f.VertexAttrib4sv(index, v);
-}
-
-inline void QOpenGLFunctions_3_2_Compatibility::glVertexAttrib4s(GLuint index, GLshort x, GLshort y, GLshort z, GLshort w)
-{
- d_2_0_Core->f.VertexAttrib4s(index, x, y, z, w);
-}
-
-inline void QOpenGLFunctions_3_2_Compatibility::glVertexAttrib4iv(GLuint index, const GLint *v)
-{
- d_2_0_Core->f.VertexAttrib4iv(index, v);
-}
-
-inline void QOpenGLFunctions_3_2_Compatibility::glVertexAttrib4fv(GLuint index, const GLfloat *v)
-{
- d_2_0_Core->f.VertexAttrib4fv(index, v);
-}
-
-inline void QOpenGLFunctions_3_2_Compatibility::glVertexAttrib4f(GLuint index, GLfloat x, GLfloat y, GLfloat z, GLfloat w)
-{
- d_2_0_Core->f.VertexAttrib4f(index, x, y, z, w);
-}
-
-inline void QOpenGLFunctions_3_2_Compatibility::glVertexAttrib4dv(GLuint index, const GLdouble *v)
-{
- d_2_0_Core->f.VertexAttrib4dv(index, v);
-}
-
-inline void QOpenGLFunctions_3_2_Compatibility::glVertexAttrib4d(GLuint index, GLdouble x, GLdouble y, GLdouble z, GLdouble w)
-{
- d_2_0_Core->f.VertexAttrib4d(index, x, y, z, w);
-}
-
-inline void QOpenGLFunctions_3_2_Compatibility::glVertexAttrib4bv(GLuint index, const GLbyte *v)
-{
- d_2_0_Core->f.VertexAttrib4bv(index, v);
-}
-
-inline void QOpenGLFunctions_3_2_Compatibility::glVertexAttrib4Nusv(GLuint index, const GLushort *v)
-{
- d_2_0_Core->f.VertexAttrib4Nusv(index, v);
-}
-
-inline void QOpenGLFunctions_3_2_Compatibility::glVertexAttrib4Nuiv(GLuint index, const GLuint *v)
-{
- d_2_0_Core->f.VertexAttrib4Nuiv(index, v);
-}
-
-inline void QOpenGLFunctions_3_2_Compatibility::glVertexAttrib4Nubv(GLuint index, const GLubyte *v)
-{
- d_2_0_Core->f.VertexAttrib4Nubv(index, v);
-}
-
-inline void QOpenGLFunctions_3_2_Compatibility::glVertexAttrib4Nub(GLuint index, GLubyte x, GLubyte y, GLubyte z, GLubyte w)
-{
- d_2_0_Core->f.VertexAttrib4Nub(index, x, y, z, w);
-}
-
-inline void QOpenGLFunctions_3_2_Compatibility::glVertexAttrib4Nsv(GLuint index, const GLshort *v)
-{
- d_2_0_Core->f.VertexAttrib4Nsv(index, v);
-}
-
-inline void QOpenGLFunctions_3_2_Compatibility::glVertexAttrib4Niv(GLuint index, const GLint *v)
-{
- d_2_0_Core->f.VertexAttrib4Niv(index, v);
-}
-
-inline void QOpenGLFunctions_3_2_Compatibility::glVertexAttrib4Nbv(GLuint index, const GLbyte *v)
-{
- d_2_0_Core->f.VertexAttrib4Nbv(index, v);
-}
-
-inline void QOpenGLFunctions_3_2_Compatibility::glVertexAttrib3sv(GLuint index, const GLshort *v)
-{
- d_2_0_Core->f.VertexAttrib3sv(index, v);
-}
-
-inline void QOpenGLFunctions_3_2_Compatibility::glVertexAttrib3s(GLuint index, GLshort x, GLshort y, GLshort z)
-{
- d_2_0_Core->f.VertexAttrib3s(index, x, y, z);
-}
-
-inline void QOpenGLFunctions_3_2_Compatibility::glVertexAttrib3fv(GLuint index, const GLfloat *v)
-{
- d_2_0_Core->f.VertexAttrib3fv(index, v);
-}
-
-inline void QOpenGLFunctions_3_2_Compatibility::glVertexAttrib3f(GLuint index, GLfloat x, GLfloat y, GLfloat z)
-{
- d_2_0_Core->f.VertexAttrib3f(index, x, y, z);
-}
-
-inline void QOpenGLFunctions_3_2_Compatibility::glVertexAttrib3dv(GLuint index, const GLdouble *v)
-{
- d_2_0_Core->f.VertexAttrib3dv(index, v);
-}
-
-inline void QOpenGLFunctions_3_2_Compatibility::glVertexAttrib3d(GLuint index, GLdouble x, GLdouble y, GLdouble z)
-{
- d_2_0_Core->f.VertexAttrib3d(index, x, y, z);
-}
-
-inline void QOpenGLFunctions_3_2_Compatibility::glVertexAttrib2sv(GLuint index, const GLshort *v)
-{
- d_2_0_Core->f.VertexAttrib2sv(index, v);
-}
-
-inline void QOpenGLFunctions_3_2_Compatibility::glVertexAttrib2s(GLuint index, GLshort x, GLshort y)
-{
- d_2_0_Core->f.VertexAttrib2s(index, x, y);
-}
-
-inline void QOpenGLFunctions_3_2_Compatibility::glVertexAttrib2fv(GLuint index, const GLfloat *v)
-{
- d_2_0_Core->f.VertexAttrib2fv(index, v);
-}
-
-inline void QOpenGLFunctions_3_2_Compatibility::glVertexAttrib2f(GLuint index, GLfloat x, GLfloat y)
-{
- d_2_0_Core->f.VertexAttrib2f(index, x, y);
-}
-
-inline void QOpenGLFunctions_3_2_Compatibility::glVertexAttrib2dv(GLuint index, const GLdouble *v)
-{
- d_2_0_Core->f.VertexAttrib2dv(index, v);
-}
-
-inline void QOpenGLFunctions_3_2_Compatibility::glVertexAttrib2d(GLuint index, GLdouble x, GLdouble y)
-{
- d_2_0_Core->f.VertexAttrib2d(index, x, y);
-}
-
-inline void QOpenGLFunctions_3_2_Compatibility::glVertexAttrib1sv(GLuint index, const GLshort *v)
-{
- d_2_0_Core->f.VertexAttrib1sv(index, v);
-}
-
-inline void QOpenGLFunctions_3_2_Compatibility::glVertexAttrib1s(GLuint index, GLshort x)
-{
- d_2_0_Core->f.VertexAttrib1s(index, x);
-}
-
-inline void QOpenGLFunctions_3_2_Compatibility::glVertexAttrib1fv(GLuint index, const GLfloat *v)
-{
- d_2_0_Core->f.VertexAttrib1fv(index, v);
-}
-
-inline void QOpenGLFunctions_3_2_Compatibility::glVertexAttrib1f(GLuint index, GLfloat x)
-{
- d_2_0_Core->f.VertexAttrib1f(index, x);
-}
-
-inline void QOpenGLFunctions_3_2_Compatibility::glVertexAttrib1dv(GLuint index, const GLdouble *v)
-{
- d_2_0_Core->f.VertexAttrib1dv(index, v);
-}
-
-inline void QOpenGLFunctions_3_2_Compatibility::glVertexAttrib1d(GLuint index, GLdouble x)
-{
- d_2_0_Core->f.VertexAttrib1d(index, x);
-}
-
-
-// OpenGL 2.1 deprecated functions
-
-// OpenGL 3.0 deprecated functions
-inline void QOpenGLFunctions_3_2_Compatibility::glVertexAttribI4usv(GLuint index, const GLushort *v)
-{
- d_3_0_Core->f.VertexAttribI4usv(index, v);
-}
-
-inline void QOpenGLFunctions_3_2_Compatibility::glVertexAttribI4ubv(GLuint index, const GLubyte *v)
-{
- d_3_0_Core->f.VertexAttribI4ubv(index, v);
-}
-
-inline void QOpenGLFunctions_3_2_Compatibility::glVertexAttribI4sv(GLuint index, const GLshort *v)
-{
- d_3_0_Core->f.VertexAttribI4sv(index, v);
-}
-
-inline void QOpenGLFunctions_3_2_Compatibility::glVertexAttribI4bv(GLuint index, const GLbyte *v)
-{
- d_3_0_Core->f.VertexAttribI4bv(index, v);
-}
-
-inline void QOpenGLFunctions_3_2_Compatibility::glVertexAttribI4uiv(GLuint index, const GLuint *v)
-{
- d_3_0_Core->f.VertexAttribI4uiv(index, v);
-}
-
-inline void QOpenGLFunctions_3_2_Compatibility::glVertexAttribI3uiv(GLuint index, const GLuint *v)
-{
- d_3_0_Core->f.VertexAttribI3uiv(index, v);
-}
-
-inline void QOpenGLFunctions_3_2_Compatibility::glVertexAttribI2uiv(GLuint index, const GLuint *v)
-{
- d_3_0_Core->f.VertexAttribI2uiv(index, v);
-}
-
-inline void QOpenGLFunctions_3_2_Compatibility::glVertexAttribI1uiv(GLuint index, const GLuint *v)
-{
- d_3_0_Core->f.VertexAttribI1uiv(index, v);
-}
-
-inline void QOpenGLFunctions_3_2_Compatibility::glVertexAttribI4iv(GLuint index, const GLint *v)
-{
- d_3_0_Core->f.VertexAttribI4iv(index, v);
-}
-
-inline void QOpenGLFunctions_3_2_Compatibility::glVertexAttribI3iv(GLuint index, const GLint *v)
-{
- d_3_0_Core->f.VertexAttribI3iv(index, v);
-}
-
-inline void QOpenGLFunctions_3_2_Compatibility::glVertexAttribI2iv(GLuint index, const GLint *v)
-{
- d_3_0_Core->f.VertexAttribI2iv(index, v);
-}
-
-inline void QOpenGLFunctions_3_2_Compatibility::glVertexAttribI1iv(GLuint index, const GLint *v)
-{
- d_3_0_Core->f.VertexAttribI1iv(index, v);
-}
-
-inline void QOpenGLFunctions_3_2_Compatibility::glVertexAttribI4ui(GLuint index, GLuint x, GLuint y, GLuint z, GLuint w)
-{
- d_3_0_Core->f.VertexAttribI4ui(index, x, y, z, w);
-}
-
-inline void QOpenGLFunctions_3_2_Compatibility::glVertexAttribI3ui(GLuint index, GLuint x, GLuint y, GLuint z)
-{
- d_3_0_Core->f.VertexAttribI3ui(index, x, y, z);
-}
-
-inline void QOpenGLFunctions_3_2_Compatibility::glVertexAttribI2ui(GLuint index, GLuint x, GLuint y)
-{
- d_3_0_Core->f.VertexAttribI2ui(index, x, y);
-}
-
-inline void QOpenGLFunctions_3_2_Compatibility::glVertexAttribI1ui(GLuint index, GLuint x)
-{
- d_3_0_Core->f.VertexAttribI1ui(index, x);
-}
-
-inline void QOpenGLFunctions_3_2_Compatibility::glVertexAttribI4i(GLuint index, GLint x, GLint y, GLint z, GLint w)
-{
- d_3_0_Core->f.VertexAttribI4i(index, x, y, z, w);
-}
-
-inline void QOpenGLFunctions_3_2_Compatibility::glVertexAttribI3i(GLuint index, GLint x, GLint y, GLint z)
-{
- d_3_0_Core->f.VertexAttribI3i(index, x, y, z);
-}
-
-inline void QOpenGLFunctions_3_2_Compatibility::glVertexAttribI2i(GLuint index, GLint x, GLint y)
-{
- d_3_0_Core->f.VertexAttribI2i(index, x, y);
-}
-
-inline void QOpenGLFunctions_3_2_Compatibility::glVertexAttribI1i(GLuint index, GLint x)
-{
- d_3_0_Core->f.VertexAttribI1i(index, x);
-}
-
-
-// OpenGL 3.1 deprecated functions
-
-// OpenGL 3.2 deprecated functions
-
-
-QT_END_NAMESPACE
-
-#endif // QT_NO_OPENGL && !QT_OPENGL_ES_2
-
-#endif
diff --git a/src/gui/opengl/qopenglfunctions_3_2_core.cpp b/src/gui/opengl/qopenglfunctions_3_2_core.cpp
deleted file mode 100644
index ea89fc9e48..0000000000
--- a/src/gui/opengl/qopenglfunctions_3_2_core.cpp
+++ /dev/null
@@ -1,215 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2013 Klaralvdalens Datakonsult AB (KDAB)
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the QtGui module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-**
-** This file was generated by glgen version 0.1
-** Command line was: glgen
-**
-** glgen is Copyright (C) 2013 Klaralvdalens Datakonsult AB (KDAB)
-**
-** This is an auto-generated file.
-** Do not edit! All changes made to it will be lost.
-**
-****************************************************************************/
-
-#include "qopenglfunctions_3_2_core.h"
-#include "qopenglcontext.h"
-
-QT_BEGIN_NAMESPACE
-
-/*!
- \class QOpenGLFunctions_3_2_Core
- \inmodule QtGui
- \since 5.1
- \wrapper
- \brief The QOpenGLFunctions_3_2_Core class provides all functions for OpenGL 3.2 core profile.
-
- This class is a wrapper for functions from OpenGL 3.2 core profile.
- See reference pages on \l {http://www.opengl.org/sdk/docs/}{opengl.org}
- for function documentation.
-
- \sa QAbstractOpenGLFunctions
-*/
-
-QOpenGLFunctions_3_2_Core::QOpenGLFunctions_3_2_Core()
- : QAbstractOpenGLFunctions()
- , d_1_0_Core(nullptr)
- , d_1_1_Core(nullptr)
- , d_1_2_Core(nullptr)
- , d_1_3_Core(nullptr)
- , d_1_4_Core(nullptr)
- , d_1_5_Core(nullptr)
- , d_2_0_Core(nullptr)
- , d_2_1_Core(nullptr)
- , d_3_0_Core(nullptr)
- , d_3_1_Core(nullptr)
- , d_3_2_Core(nullptr)
-{
-}
-
-QOpenGLFunctions_3_2_Core::~QOpenGLFunctions_3_2_Core()
-{
- if (d_1_0_Core) {
- d_1_0_Core->refs.deref();
- Q_ASSERT(d_1_0_Core->refs.loadRelaxed());
- }
- if (d_1_1_Core) {
- d_1_1_Core->refs.deref();
- Q_ASSERT(d_1_1_Core->refs.loadRelaxed());
- }
- if (d_1_2_Core) {
- d_1_2_Core->refs.deref();
- Q_ASSERT(d_1_2_Core->refs.loadRelaxed());
- }
- if (d_1_3_Core) {
- d_1_3_Core->refs.deref();
- Q_ASSERT(d_1_3_Core->refs.loadRelaxed());
- }
- if (d_1_4_Core) {
- d_1_4_Core->refs.deref();
- Q_ASSERT(d_1_4_Core->refs.loadRelaxed());
- }
- if (d_1_5_Core) {
- d_1_5_Core->refs.deref();
- Q_ASSERT(d_1_5_Core->refs.loadRelaxed());
- }
- if (d_2_0_Core) {
- d_2_0_Core->refs.deref();
- Q_ASSERT(d_2_0_Core->refs.loadRelaxed());
- }
- if (d_2_1_Core) {
- d_2_1_Core->refs.deref();
- Q_ASSERT(d_2_1_Core->refs.loadRelaxed());
- }
- if (d_3_0_Core) {
- d_3_0_Core->refs.deref();
- Q_ASSERT(d_3_0_Core->refs.loadRelaxed());
- }
- if (d_3_1_Core) {
- d_3_1_Core->refs.deref();
- Q_ASSERT(d_3_1_Core->refs.loadRelaxed());
- }
- if (d_3_2_Core) {
- d_3_2_Core->refs.deref();
- Q_ASSERT(d_3_2_Core->refs.loadRelaxed());
- }
-}
-
-bool QOpenGLFunctions_3_2_Core::initializeOpenGLFunctions()
-{
- if ( isInitialized() )
- return true;
-
- QOpenGLContext* context = QOpenGLContext::currentContext();
-
- // If owned by a context object make sure it is current.
- // Also check that current context is capable of resolving all needed functions
- if (((owningContext() && owningContext() == context) || !owningContext())
- && QOpenGLFunctions_3_2_Core::isContextCompatible(context))
- {
- // Associate with private implementation, creating if necessary
- // Function pointers in the backends are resolved at creation time
- QOpenGLVersionFunctionsBackend* d = nullptr;
- d = QAbstractOpenGLFunctionsPrivate::functionsBackend(context, QOpenGLFunctions_1_0_CoreBackend::versionStatus());
- d_1_0_Core = static_cast<QOpenGLFunctions_1_0_CoreBackend*>(d);
- d->refs.ref();
-
- d = QAbstractOpenGLFunctionsPrivate::functionsBackend(context, QOpenGLFunctions_1_1_CoreBackend::versionStatus());
- d_1_1_Core = static_cast<QOpenGLFunctions_1_1_CoreBackend*>(d);
- d->refs.ref();
-
- d = QAbstractOpenGLFunctionsPrivate::functionsBackend(context, QOpenGLFunctions_1_2_CoreBackend::versionStatus());
- d_1_2_Core = static_cast<QOpenGLFunctions_1_2_CoreBackend*>(d);
- d->refs.ref();
-
- d = QAbstractOpenGLFunctionsPrivate::functionsBackend(context, QOpenGLFunctions_1_3_CoreBackend::versionStatus());
- d_1_3_Core = static_cast<QOpenGLFunctions_1_3_CoreBackend*>(d);
- d->refs.ref();
-
- d = QAbstractOpenGLFunctionsPrivate::functionsBackend(context, QOpenGLFunctions_1_4_CoreBackend::versionStatus());
- d_1_4_Core = static_cast<QOpenGLFunctions_1_4_CoreBackend*>(d);
- d->refs.ref();
-
- d = QAbstractOpenGLFunctionsPrivate::functionsBackend(context, QOpenGLFunctions_1_5_CoreBackend::versionStatus());
- d_1_5_Core = static_cast<QOpenGLFunctions_1_5_CoreBackend*>(d);
- d->refs.ref();
-
- d = QAbstractOpenGLFunctionsPrivate::functionsBackend(context, QOpenGLFunctions_2_0_CoreBackend::versionStatus());
- d_2_0_Core = static_cast<QOpenGLFunctions_2_0_CoreBackend*>(d);
- d->refs.ref();
-
- d = QAbstractOpenGLFunctionsPrivate::functionsBackend(context, QOpenGLFunctions_2_1_CoreBackend::versionStatus());
- d_2_1_Core = static_cast<QOpenGLFunctions_2_1_CoreBackend*>(d);
- d->refs.ref();
-
- d = QAbstractOpenGLFunctionsPrivate::functionsBackend(context, QOpenGLFunctions_3_0_CoreBackend::versionStatus());
- d_3_0_Core = static_cast<QOpenGLFunctions_3_0_CoreBackend*>(d);
- d->refs.ref();
-
- d = QAbstractOpenGLFunctionsPrivate::functionsBackend(context, QOpenGLFunctions_3_1_CoreBackend::versionStatus());
- d_3_1_Core = static_cast<QOpenGLFunctions_3_1_CoreBackend*>(d);
- d->refs.ref();
-
- d = QAbstractOpenGLFunctionsPrivate::functionsBackend(context, QOpenGLFunctions_3_2_CoreBackend::versionStatus());
- d_3_2_Core = static_cast<QOpenGLFunctions_3_2_CoreBackend*>(d);
- d->refs.ref();
-
- QAbstractOpenGLFunctions::initializeOpenGLFunctions();
- }
- return isInitialized();
-}
-
-bool QOpenGLFunctions_3_2_Core::isContextCompatible(QOpenGLContext *context)
-{
- Q_ASSERT(context);
- QSurfaceFormat f = context->format();
- const QPair<int, int> v = qMakePair(f.majorVersion(), f.minorVersion());
- if (v < qMakePair(3, 2))
- return false;
-
- return true;
-}
-
-QOpenGLVersionProfile QOpenGLFunctions_3_2_Core::versionProfile()
-{
- QOpenGLVersionProfile v;
- v.setVersion(3, 2);
- v.setProfile(QSurfaceFormat::CoreProfile);
- return v;
-}
-
-QT_END_NAMESPACE
diff --git a/src/gui/opengl/qopenglfunctions_3_2_core.h b/src/gui/opengl/qopenglfunctions_3_2_core.h
deleted file mode 100644
index 1eafb6f441..0000000000
--- a/src/gui/opengl/qopenglfunctions_3_2_core.h
+++ /dev/null
@@ -1,1720 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2013 Klaralvdalens Datakonsult AB (KDAB)
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the QtGui module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-**
-** This file was generated by glgen version 0.1
-** Command line was: glgen
-**
-** glgen is Copyright (C) 2013 Klaralvdalens Datakonsult AB (KDAB)
-**
-** This is an auto-generated file.
-** Do not edit! All changes made to it will be lost.
-**
-****************************************************************************/
-
-#ifndef QOPENGLVERSIONFUNCTIONS_3_2_CORE_H
-#define QOPENGLVERSIONFUNCTIONS_3_2_CORE_H
-
-#include <QtGui/qtguiglobal.h>
-
-#if !defined(QT_NO_OPENGL) && !defined(QT_OPENGL_ES_2)
-
-#include <QtGui/QOpenGLVersionFunctions>
-#include <QtGui/qopenglcontext.h>
-
-QT_BEGIN_NAMESPACE
-
-class Q_GUI_EXPORT QOpenGLFunctions_3_2_Core : public QAbstractOpenGLFunctions
-{
-public:
- QOpenGLFunctions_3_2_Core();
- ~QOpenGLFunctions_3_2_Core();
-
- bool initializeOpenGLFunctions() override;
-
- // OpenGL 1.0 core functions
- void glViewport(GLint x, GLint y, GLsizei width, GLsizei height);
- void glDepthRange(GLdouble nearVal, GLdouble farVal);
- GLboolean glIsEnabled(GLenum cap);
- void glGetTexLevelParameteriv(GLenum target, GLint level, GLenum pname, GLint *params);
- void glGetTexLevelParameterfv(GLenum target, GLint level, GLenum pname, GLfloat *params);
- void glGetTexParameteriv(GLenum target, GLenum pname, GLint *params);
- void glGetTexParameterfv(GLenum target, GLenum pname, GLfloat *params);
- void glGetTexImage(GLenum target, GLint level, GLenum format, GLenum type, GLvoid *pixels);
- const GLubyte * glGetString(GLenum name);
- void glGetIntegerv(GLenum pname, GLint *params);
- void glGetFloatv(GLenum pname, GLfloat *params);
- GLenum glGetError();
- void glGetDoublev(GLenum pname, GLdouble *params);
- void glGetBooleanv(GLenum pname, GLboolean *params);
- void glReadPixels(GLint x, GLint y, GLsizei width, GLsizei height, GLenum format, GLenum type, GLvoid *pixels);
- void glReadBuffer(GLenum mode);
- void glPixelStorei(GLenum pname, GLint param);
- void glPixelStoref(GLenum pname, GLfloat param);
- void glDepthFunc(GLenum func);
- void glStencilOp(GLenum fail, GLenum zfail, GLenum zpass);
- void glStencilFunc(GLenum func, GLint ref, GLuint mask);
- void glLogicOp(GLenum opcode);
- void glBlendFunc(GLenum sfactor, GLenum dfactor);
- void glFlush();
- void glFinish();
- void glEnable(GLenum cap);
- void glDisable(GLenum cap);
- void glDepthMask(GLboolean flag);
- void glColorMask(GLboolean red, GLboolean green, GLboolean blue, GLboolean alpha);
- void glStencilMask(GLuint mask);
- void glClearDepth(GLdouble depth);
- void glClearStencil(GLint s);
- void glClearColor(GLfloat red, GLfloat green, GLfloat blue, GLfloat alpha);
- void glClear(GLbitfield mask);
- void glDrawBuffer(GLenum mode);
- void glTexImage2D(GLenum target, GLint level, GLint internalformat, GLsizei width, GLsizei height, GLint border, GLenum format, GLenum type, const GLvoid *pixels);
- void glTexImage1D(GLenum target, GLint level, GLint internalformat, GLsizei width, GLint border, GLenum format, GLenum type, const GLvoid *pixels);
- void glTexParameteriv(GLenum target, GLenum pname, const GLint *params);
- void glTexParameteri(GLenum target, GLenum pname, GLint param);
- void glTexParameterfv(GLenum target, GLenum pname, const GLfloat *params);
- void glTexParameterf(GLenum target, GLenum pname, GLfloat param);
- void glScissor(GLint x, GLint y, GLsizei width, GLsizei height);
- void glPolygonMode(GLenum face, GLenum mode);
- void glPointSize(GLfloat size);
- void glLineWidth(GLfloat width);
- void glHint(GLenum target, GLenum mode);
- void glFrontFace(GLenum mode);
- void glCullFace(GLenum mode);
-
- // OpenGL 1.1 core functions
- void glIndexubv(const GLubyte *c);
- void glIndexub(GLubyte c);
- GLboolean glIsTexture(GLuint texture);
- void glGenTextures(GLsizei n, GLuint *textures);
- void glDeleteTextures(GLsizei n, const GLuint *textures);
- void glBindTexture(GLenum target, GLuint texture);
- void glTexSubImage2D(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLenum type, const GLvoid *pixels);
- void glTexSubImage1D(GLenum target, GLint level, GLint xoffset, GLsizei width, GLenum format, GLenum type, const GLvoid *pixels);
- void glCopyTexSubImage2D(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint x, GLint y, GLsizei width, GLsizei height);
- void glCopyTexSubImage1D(GLenum target, GLint level, GLint xoffset, GLint x, GLint y, GLsizei width);
- void glCopyTexImage2D(GLenum target, GLint level, GLenum internalformat, GLint x, GLint y, GLsizei width, GLsizei height, GLint border);
- void glCopyTexImage1D(GLenum target, GLint level, GLenum internalformat, GLint x, GLint y, GLsizei width, GLint border);
- void glPolygonOffset(GLfloat factor, GLfloat units);
- void glGetPointerv(GLenum pname, GLvoid* *params);
- void glDrawElements(GLenum mode, GLsizei count, GLenum type, const GLvoid *indices);
- void glDrawArrays(GLenum mode, GLint first, GLsizei count);
-
- // OpenGL 1.2 core functions
- void glCopyTexSubImage3D(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLint x, GLint y, GLsizei width, GLsizei height);
- void glTexSubImage3D(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLenum type, const GLvoid *pixels);
- void glTexImage3D(GLenum target, GLint level, GLint internalformat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLenum format, GLenum type, const GLvoid *pixels);
- void glDrawRangeElements(GLenum mode, GLuint start, GLuint end, GLsizei count, GLenum type, const GLvoid *indices);
- void glBlendEquation(GLenum mode);
- void glBlendColor(GLfloat red, GLfloat green, GLfloat blue, GLfloat alpha);
-
- // OpenGL 1.3 core functions
- void glGetCompressedTexImage(GLenum target, GLint level, GLvoid *img);
- void glCompressedTexSubImage1D(GLenum target, GLint level, GLint xoffset, GLsizei width, GLenum format, GLsizei imageSize, const GLvoid *data);
- void glCompressedTexSubImage2D(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLsizei imageSize, const GLvoid *data);
- void glCompressedTexSubImage3D(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLsizei imageSize, const GLvoid *data);
- void glCompressedTexImage1D(GLenum target, GLint level, GLenum internalformat, GLsizei width, GLint border, GLsizei imageSize, const GLvoid *data);
- void glCompressedTexImage2D(GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLint border, GLsizei imageSize, const GLvoid *data);
- void glCompressedTexImage3D(GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLsizei imageSize, const GLvoid *data);
- void glSampleCoverage(GLfloat value, GLboolean invert);
- void glActiveTexture(GLenum texture);
-
- // OpenGL 1.4 core functions
- void glPointParameteriv(GLenum pname, const GLint *params);
- void glPointParameteri(GLenum pname, GLint param);
- void glPointParameterfv(GLenum pname, const GLfloat *params);
- void glPointParameterf(GLenum pname, GLfloat param);
- void glMultiDrawElements(GLenum mode, const GLsizei *count, GLenum type, const GLvoid* const *indices, GLsizei drawcount);
- void glMultiDrawArrays(GLenum mode, const GLint *first, const GLsizei *count, GLsizei drawcount);
- void glBlendFuncSeparate(GLenum sfactorRGB, GLenum dfactorRGB, GLenum sfactorAlpha, GLenum dfactorAlpha);
-
- // OpenGL 1.5 core functions
- void glGetBufferPointerv(GLenum target, GLenum pname, GLvoid* *params);
- void glGetBufferParameteriv(GLenum target, GLenum pname, GLint *params);
- GLboolean glUnmapBuffer(GLenum target);
- GLvoid* glMapBuffer(GLenum target, GLenum access);
- void glGetBufferSubData(GLenum target, GLintptr offset, GLsizeiptr size, GLvoid *data);
- void glBufferSubData(GLenum target, GLintptr offset, GLsizeiptr size, const GLvoid *data);
- void glBufferData(GLenum target, GLsizeiptr size, const GLvoid *data, GLenum usage);
- GLboolean glIsBuffer(GLuint buffer);
- void glGenBuffers(GLsizei n, GLuint *buffers);
- void glDeleteBuffers(GLsizei n, const GLuint *buffers);
- void glBindBuffer(GLenum target, GLuint buffer);
- void glGetQueryObjectuiv(GLuint id, GLenum pname, GLuint *params);
- void glGetQueryObjectiv(GLuint id, GLenum pname, GLint *params);
- void glGetQueryiv(GLenum target, GLenum pname, GLint *params);
- void glEndQuery(GLenum target);
- void glBeginQuery(GLenum target, GLuint id);
- GLboolean glIsQuery(GLuint id);
- void glDeleteQueries(GLsizei n, const GLuint *ids);
- void glGenQueries(GLsizei n, GLuint *ids);
-
- // OpenGL 2.0 core functions
- void glVertexAttribPointer(GLuint index, GLint size, GLenum type, GLboolean normalized, GLsizei stride, const GLvoid *pointer);
- void glValidateProgram(GLuint program);
- void glUniformMatrix4fv(GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
- void glUniformMatrix3fv(GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
- void glUniformMatrix2fv(GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
- void glUniform4iv(GLint location, GLsizei count, const GLint *value);
- void glUniform3iv(GLint location, GLsizei count, const GLint *value);
- void glUniform2iv(GLint location, GLsizei count, const GLint *value);
- void glUniform1iv(GLint location, GLsizei count, const GLint *value);
- void glUniform4fv(GLint location, GLsizei count, const GLfloat *value);
- void glUniform3fv(GLint location, GLsizei count, const GLfloat *value);
- void glUniform2fv(GLint location, GLsizei count, const GLfloat *value);
- void glUniform1fv(GLint location, GLsizei count, const GLfloat *value);
- void glUniform4i(GLint location, GLint v0, GLint v1, GLint v2, GLint v3);
- void glUniform3i(GLint location, GLint v0, GLint v1, GLint v2);
- void glUniform2i(GLint location, GLint v0, GLint v1);
- void glUniform1i(GLint location, GLint v0);
- void glUniform4f(GLint location, GLfloat v0, GLfloat v1, GLfloat v2, GLfloat v3);
- void glUniform3f(GLint location, GLfloat v0, GLfloat v1, GLfloat v2);
- void glUniform2f(GLint location, GLfloat v0, GLfloat v1);
- void glUniform1f(GLint location, GLfloat v0);
- void glUseProgram(GLuint program);
- void glShaderSource(GLuint shader, GLsizei count, const GLchar* const *string, const GLint *length);
- void glLinkProgram(GLuint program);
- GLboolean glIsShader(GLuint shader);
- GLboolean glIsProgram(GLuint program);
- void glGetVertexAttribPointerv(GLuint index, GLenum pname, GLvoid* *pointer);
- void glGetVertexAttribiv(GLuint index, GLenum pname, GLint *params);
- void glGetVertexAttribfv(GLuint index, GLenum pname, GLfloat *params);
- void glGetVertexAttribdv(GLuint index, GLenum pname, GLdouble *params);
- void glGetUniformiv(GLuint program, GLint location, GLint *params);
- void glGetUniformfv(GLuint program, GLint location, GLfloat *params);
- GLint glGetUniformLocation(GLuint program, const GLchar *name);
- void glGetShaderSource(GLuint shader, GLsizei bufSize, GLsizei *length, GLchar *source);
- void glGetShaderInfoLog(GLuint shader, GLsizei bufSize, GLsizei *length, GLchar *infoLog);
- void glGetShaderiv(GLuint shader, GLenum pname, GLint *params);
- void glGetProgramInfoLog(GLuint program, GLsizei bufSize, GLsizei *length, GLchar *infoLog);
- void glGetProgramiv(GLuint program, GLenum pname, GLint *params);
- GLint glGetAttribLocation(GLuint program, const GLchar *name);
- void glGetAttachedShaders(GLuint program, GLsizei maxCount, GLsizei *count, GLuint *obj);
- void glGetActiveUniform(GLuint program, GLuint index, GLsizei bufSize, GLsizei *length, GLint *size, GLenum *type, GLchar *name);
- void glGetActiveAttrib(GLuint program, GLuint index, GLsizei bufSize, GLsizei *length, GLint *size, GLenum *type, GLchar *name);
- void glEnableVertexAttribArray(GLuint index);
- void glDisableVertexAttribArray(GLuint index);
- void glDetachShader(GLuint program, GLuint shader);
- void glDeleteShader(GLuint shader);
- void glDeleteProgram(GLuint program);
- GLuint glCreateShader(GLenum type);
- GLuint glCreateProgram();
- void glCompileShader(GLuint shader);
- void glBindAttribLocation(GLuint program, GLuint index, const GLchar *name);
- void glAttachShader(GLuint program, GLuint shader);
- void glStencilMaskSeparate(GLenum face, GLuint mask);
- void glStencilFuncSeparate(GLenum face, GLenum func, GLint ref, GLuint mask);
- void glStencilOpSeparate(GLenum face, GLenum sfail, GLenum dpfail, GLenum dppass);
- void glDrawBuffers(GLsizei n, const GLenum *bufs);
- void glBlendEquationSeparate(GLenum modeRGB, GLenum modeAlpha);
-
- // OpenGL 2.1 core functions
- void glUniformMatrix4x3fv(GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
- void glUniformMatrix3x4fv(GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
- void glUniformMatrix4x2fv(GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
- void glUniformMatrix2x4fv(GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
- void glUniformMatrix3x2fv(GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
- void glUniformMatrix2x3fv(GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
-
- // OpenGL 3.0 core functions
- GLboolean glIsVertexArray(GLuint array);
- void glGenVertexArrays(GLsizei n, GLuint *arrays);
- void glDeleteVertexArrays(GLsizei n, const GLuint *arrays);
- void glBindVertexArray(GLuint array);
- void glFlushMappedBufferRange(GLenum target, GLintptr offset, GLsizeiptr length);
- GLvoid* glMapBufferRange(GLenum target, GLintptr offset, GLsizeiptr length, GLbitfield access);
- void glFramebufferTextureLayer(GLenum target, GLenum attachment, GLuint texture, GLint level, GLint layer);
- void glRenderbufferStorageMultisample(GLenum target, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height);
- void glBlitFramebuffer(GLint srcX0, GLint srcY0, GLint srcX1, GLint srcY1, GLint dstX0, GLint dstY0, GLint dstX1, GLint dstY1, GLbitfield mask, GLenum filter);
- void glGenerateMipmap(GLenum target);
- void glGetFramebufferAttachmentParameteriv(GLenum target, GLenum attachment, GLenum pname, GLint *params);
- void glFramebufferRenderbuffer(GLenum target, GLenum attachment, GLenum renderbuffertarget, GLuint renderbuffer);
- void glFramebufferTexture3D(GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level, GLint zoffset);
- void glFramebufferTexture2D(GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level);
- void glFramebufferTexture1D(GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level);
- GLenum glCheckFramebufferStatus(GLenum target);
- void glGenFramebuffers(GLsizei n, GLuint *framebuffers);
- void glDeleteFramebuffers(GLsizei n, const GLuint *framebuffers);
- void glBindFramebuffer(GLenum target, GLuint framebuffer);
- GLboolean glIsFramebuffer(GLuint framebuffer);
- void glGetRenderbufferParameteriv(GLenum target, GLenum pname, GLint *params);
- void glRenderbufferStorage(GLenum target, GLenum internalformat, GLsizei width, GLsizei height);
- void glGenRenderbuffers(GLsizei n, GLuint *renderbuffers);
- void glDeleteRenderbuffers(GLsizei n, const GLuint *renderbuffers);
- void glBindRenderbuffer(GLenum target, GLuint renderbuffer);
- GLboolean glIsRenderbuffer(GLuint renderbuffer);
- const GLubyte * glGetStringi(GLenum name, GLuint index);
- void glClearBufferfi(GLenum buffer, GLint drawbuffer, GLfloat depth, GLint stencil);
- void glClearBufferfv(GLenum buffer, GLint drawbuffer, const GLfloat *value);
- void glClearBufferuiv(GLenum buffer, GLint drawbuffer, const GLuint *value);
- void glClearBufferiv(GLenum buffer, GLint drawbuffer, const GLint *value);
- void glGetTexParameterIuiv(GLenum target, GLenum pname, GLuint *params);
- void glGetTexParameterIiv(GLenum target, GLenum pname, GLint *params);
- void glTexParameterIuiv(GLenum target, GLenum pname, const GLuint *params);
- void glTexParameterIiv(GLenum target, GLenum pname, const GLint *params);
- void glUniform4uiv(GLint location, GLsizei count, const GLuint *value);
- void glUniform3uiv(GLint location, GLsizei count, const GLuint *value);
- void glUniform2uiv(GLint location, GLsizei count, const GLuint *value);
- void glUniform1uiv(GLint location, GLsizei count, const GLuint *value);
- void glUniform4ui(GLint location, GLuint v0, GLuint v1, GLuint v2, GLuint v3);
- void glUniform3ui(GLint location, GLuint v0, GLuint v1, GLuint v2);
- void glUniform2ui(GLint location, GLuint v0, GLuint v1);
- void glUniform1ui(GLint location, GLuint v0);
- GLint glGetFragDataLocation(GLuint program, const GLchar *name);
- void glBindFragDataLocation(GLuint program, GLuint color, const GLchar *name);
- void glGetUniformuiv(GLuint program, GLint location, GLuint *params);
- void glGetVertexAttribIuiv(GLuint index, GLenum pname, GLuint *params);
- void glGetVertexAttribIiv(GLuint index, GLenum pname, GLint *params);
- void glVertexAttribIPointer(GLuint index, GLint size, GLenum type, GLsizei stride, const GLvoid *pointer);
- void glEndConditionalRender();
- void glBeginConditionalRender(GLuint id, GLenum mode);
- void glClampColor(GLenum target, GLenum clamp);
- void glGetTransformFeedbackVarying(GLuint program, GLuint index, GLsizei bufSize, GLsizei *length, GLsizei *size, GLenum *type, GLchar *name);
- void glTransformFeedbackVaryings(GLuint program, GLsizei count, const GLchar* const *varyings, GLenum bufferMode);
- void glBindBufferBase(GLenum target, GLuint index, GLuint buffer);
- void glBindBufferRange(GLenum target, GLuint index, GLuint buffer, GLintptr offset, GLsizeiptr size);
- void glEndTransformFeedback();
- void glBeginTransformFeedback(GLenum primitiveMode);
- GLboolean glIsEnabledi(GLenum target, GLuint index);
- void glDisablei(GLenum target, GLuint index);
- void glEnablei(GLenum target, GLuint index);
- void glGetIntegeri_v(GLenum target, GLuint index, GLint *data);
- void glGetBooleani_v(GLenum target, GLuint index, GLboolean *data);
- void glColorMaski(GLuint index, GLboolean r, GLboolean g, GLboolean b, GLboolean a);
-
- // OpenGL 3.1 core functions
- void glCopyBufferSubData(GLenum readTarget, GLenum writeTarget, GLintptr readOffset, GLintptr writeOffset, GLsizeiptr size);
- void glUniformBlockBinding(GLuint program, GLuint uniformBlockIndex, GLuint uniformBlockBinding);
- void glGetActiveUniformBlockName(GLuint program, GLuint uniformBlockIndex, GLsizei bufSize, GLsizei *length, GLchar *uniformBlockName);
- void glGetActiveUniformBlockiv(GLuint program, GLuint uniformBlockIndex, GLenum pname, GLint *params);
- GLuint glGetUniformBlockIndex(GLuint program, const GLchar *uniformBlockName);
- void glGetActiveUniformName(GLuint program, GLuint uniformIndex, GLsizei bufSize, GLsizei *length, GLchar *uniformName);
- void glGetActiveUniformsiv(GLuint program, GLsizei uniformCount, const GLuint *uniformIndices, GLenum pname, GLint *params);
- void glGetUniformIndices(GLuint program, GLsizei uniformCount, const GLchar* const *uniformNames, GLuint *uniformIndices);
- void glPrimitiveRestartIndex(GLuint index);
- void glTexBuffer(GLenum target, GLenum internalformat, GLuint buffer);
- void glDrawElementsInstanced(GLenum mode, GLsizei count, GLenum type, const GLvoid *indices, GLsizei instancecount);
- void glDrawArraysInstanced(GLenum mode, GLint first, GLsizei count, GLsizei instancecount);
-
- // OpenGL 3.2 core functions
- void glSampleMaski(GLuint index, GLbitfield mask);
- void glGetMultisamplefv(GLenum pname, GLuint index, GLfloat *val);
- void glTexImage3DMultisample(GLenum target, GLsizei samples, GLint internalformat, GLsizei width, GLsizei height, GLsizei depth, GLboolean fixedsamplelocations);
- void glTexImage2DMultisample(GLenum target, GLsizei samples, GLint internalformat, GLsizei width, GLsizei height, GLboolean fixedsamplelocations);
- void glGetSynciv(GLsync sync, GLenum pname, GLsizei bufSize, GLsizei *length, GLint *values);
- void glGetInteger64v(GLenum pname, GLint64 *params);
- void glWaitSync(GLsync sync, GLbitfield flags, GLuint64 timeout);
- GLenum glClientWaitSync(GLsync sync, GLbitfield flags, GLuint64 timeout);
- void glDeleteSync(GLsync sync);
- GLboolean glIsSync(GLsync sync);
- GLsync glFenceSync(GLenum condition, GLbitfield flags);
- void glProvokingVertex(GLenum mode);
- void glMultiDrawElementsBaseVertex(GLenum mode, const GLsizei *count, GLenum type, const GLvoid* const *indices, GLsizei drawcount, const GLint *basevertex);
- void glDrawElementsInstancedBaseVertex(GLenum mode, GLsizei count, GLenum type, const GLvoid *indices, GLsizei instancecount, GLint basevertex);
- void glDrawRangeElementsBaseVertex(GLenum mode, GLuint start, GLuint end, GLsizei count, GLenum type, const GLvoid *indices, GLint basevertex);
- void glDrawElementsBaseVertex(GLenum mode, GLsizei count, GLenum type, const GLvoid *indices, GLint basevertex);
- void glFramebufferTexture(GLenum target, GLenum attachment, GLuint texture, GLint level);
- void glGetBufferParameteri64v(GLenum target, GLenum pname, GLint64 *params);
- void glGetInteger64i_v(GLenum target, GLuint index, GLint64 *data);
-
-private:
- friend class QOpenGLContext;
-
- static bool isContextCompatible(QOpenGLContext *context);
- static QOpenGLVersionProfile versionProfile();
-
- QOpenGLFunctions_1_0_CoreBackend* d_1_0_Core;
- QOpenGLFunctions_1_1_CoreBackend* d_1_1_Core;
- QOpenGLFunctions_1_2_CoreBackend* d_1_2_Core;
- QOpenGLFunctions_1_3_CoreBackend* d_1_3_Core;
- QOpenGLFunctions_1_4_CoreBackend* d_1_4_Core;
- QOpenGLFunctions_1_5_CoreBackend* d_1_5_Core;
- QOpenGLFunctions_2_0_CoreBackend* d_2_0_Core;
- QOpenGLFunctions_2_1_CoreBackend* d_2_1_Core;
- QOpenGLFunctions_3_0_CoreBackend* d_3_0_Core;
- QOpenGLFunctions_3_1_CoreBackend* d_3_1_Core;
- QOpenGLFunctions_3_2_CoreBackend* d_3_2_Core;
-};
-
-// OpenGL 1.0 core functions
-inline void QOpenGLFunctions_3_2_Core::glViewport(GLint x, GLint y, GLsizei width, GLsizei height)
-{
- d_1_0_Core->f.Viewport(x, y, width, height);
-}
-
-inline void QOpenGLFunctions_3_2_Core::glDepthRange(GLdouble nearVal, GLdouble farVal)
-{
- d_1_0_Core->f.DepthRange(nearVal, farVal);
-}
-
-inline GLboolean QOpenGLFunctions_3_2_Core::glIsEnabled(GLenum cap)
-{
- return d_1_0_Core->f.IsEnabled(cap);
-}
-
-inline void QOpenGLFunctions_3_2_Core::glGetTexLevelParameteriv(GLenum target, GLint level, GLenum pname, GLint *params)
-{
- d_1_0_Core->f.GetTexLevelParameteriv(target, level, pname, params);
-}
-
-inline void QOpenGLFunctions_3_2_Core::glGetTexLevelParameterfv(GLenum target, GLint level, GLenum pname, GLfloat *params)
-{
- d_1_0_Core->f.GetTexLevelParameterfv(target, level, pname, params);
-}
-
-inline void QOpenGLFunctions_3_2_Core::glGetTexParameteriv(GLenum target, GLenum pname, GLint *params)
-{
- d_1_0_Core->f.GetTexParameteriv(target, pname, params);
-}
-
-inline void QOpenGLFunctions_3_2_Core::glGetTexParameterfv(GLenum target, GLenum pname, GLfloat *params)
-{
- d_1_0_Core->f.GetTexParameterfv(target, pname, params);
-}
-
-inline void QOpenGLFunctions_3_2_Core::glGetTexImage(GLenum target, GLint level, GLenum format, GLenum type, GLvoid *pixels)
-{
- d_1_0_Core->f.GetTexImage(target, level, format, type, pixels);
-}
-
-inline const GLubyte * QOpenGLFunctions_3_2_Core::glGetString(GLenum name)
-{
- return d_1_0_Core->f.GetString(name);
-}
-
-inline void QOpenGLFunctions_3_2_Core::glGetIntegerv(GLenum pname, GLint *params)
-{
- d_1_0_Core->f.GetIntegerv(pname, params);
-}
-
-inline void QOpenGLFunctions_3_2_Core::glGetFloatv(GLenum pname, GLfloat *params)
-{
- d_1_0_Core->f.GetFloatv(pname, params);
-}
-
-inline GLenum QOpenGLFunctions_3_2_Core::glGetError()
-{
- return d_1_0_Core->f.GetError();
-}
-
-inline void QOpenGLFunctions_3_2_Core::glGetDoublev(GLenum pname, GLdouble *params)
-{
- d_1_0_Core->f.GetDoublev(pname, params);
-}
-
-inline void QOpenGLFunctions_3_2_Core::glGetBooleanv(GLenum pname, GLboolean *params)
-{
- d_1_0_Core->f.GetBooleanv(pname, params);
-}
-
-inline void QOpenGLFunctions_3_2_Core::glReadPixels(GLint x, GLint y, GLsizei width, GLsizei height, GLenum format, GLenum type, GLvoid *pixels)
-{
- d_1_0_Core->f.ReadPixels(x, y, width, height, format, type, pixels);
-}
-
-inline void QOpenGLFunctions_3_2_Core::glReadBuffer(GLenum mode)
-{
- d_1_0_Core->f.ReadBuffer(mode);
-}
-
-inline void QOpenGLFunctions_3_2_Core::glPixelStorei(GLenum pname, GLint param)
-{
- d_1_0_Core->f.PixelStorei(pname, param);
-}
-
-inline void QOpenGLFunctions_3_2_Core::glPixelStoref(GLenum pname, GLfloat param)
-{
- d_1_0_Core->f.PixelStoref(pname, param);
-}
-
-inline void QOpenGLFunctions_3_2_Core::glDepthFunc(GLenum func)
-{
- d_1_0_Core->f.DepthFunc(func);
-}
-
-inline void QOpenGLFunctions_3_2_Core::glStencilOp(GLenum fail, GLenum zfail, GLenum zpass)
-{
- d_1_0_Core->f.StencilOp(fail, zfail, zpass);
-}
-
-inline void QOpenGLFunctions_3_2_Core::glStencilFunc(GLenum func, GLint ref, GLuint mask)
-{
- d_1_0_Core->f.StencilFunc(func, ref, mask);
-}
-
-inline void QOpenGLFunctions_3_2_Core::glLogicOp(GLenum opcode)
-{
- d_1_0_Core->f.LogicOp(opcode);
-}
-
-inline void QOpenGLFunctions_3_2_Core::glBlendFunc(GLenum sfactor, GLenum dfactor)
-{
- d_1_0_Core->f.BlendFunc(sfactor, dfactor);
-}
-
-inline void QOpenGLFunctions_3_2_Core::glFlush()
-{
- d_1_0_Core->f.Flush();
-}
-
-inline void QOpenGLFunctions_3_2_Core::glFinish()
-{
- d_1_0_Core->f.Finish();
-}
-
-inline void QOpenGLFunctions_3_2_Core::glEnable(GLenum cap)
-{
- d_1_0_Core->f.Enable(cap);
-}
-
-inline void QOpenGLFunctions_3_2_Core::glDisable(GLenum cap)
-{
- d_1_0_Core->f.Disable(cap);
-}
-
-inline void QOpenGLFunctions_3_2_Core::glDepthMask(GLboolean flag)
-{
- d_1_0_Core->f.DepthMask(flag);
-}
-
-inline void QOpenGLFunctions_3_2_Core::glColorMask(GLboolean red, GLboolean green, GLboolean blue, GLboolean alpha)
-{
- d_1_0_Core->f.ColorMask(red, green, blue, alpha);
-}
-
-inline void QOpenGLFunctions_3_2_Core::glStencilMask(GLuint mask)
-{
- d_1_0_Core->f.StencilMask(mask);
-}
-
-inline void QOpenGLFunctions_3_2_Core::glClearDepth(GLdouble depth)
-{
- d_1_0_Core->f.ClearDepth(depth);
-}
-
-inline void QOpenGLFunctions_3_2_Core::glClearStencil(GLint s)
-{
- d_1_0_Core->f.ClearStencil(s);
-}
-
-inline void QOpenGLFunctions_3_2_Core::glClearColor(GLfloat red, GLfloat green, GLfloat blue, GLfloat alpha)
-{
- d_1_0_Core->f.ClearColor(red, green, blue, alpha);
-}
-
-inline void QOpenGLFunctions_3_2_Core::glClear(GLbitfield mask)
-{
- d_1_0_Core->f.Clear(mask);
-}
-
-inline void QOpenGLFunctions_3_2_Core::glDrawBuffer(GLenum mode)
-{
- d_1_0_Core->f.DrawBuffer(mode);
-}
-
-inline void QOpenGLFunctions_3_2_Core::glTexImage2D(GLenum target, GLint level, GLint internalformat, GLsizei width, GLsizei height, GLint border, GLenum format, GLenum type, const GLvoid *pixels)
-{
- d_1_0_Core->f.TexImage2D(target, level, internalformat, width, height, border, format, type, pixels);
-}
-
-inline void QOpenGLFunctions_3_2_Core::glTexImage1D(GLenum target, GLint level, GLint internalformat, GLsizei width, GLint border, GLenum format, GLenum type, const GLvoid *pixels)
-{
- d_1_0_Core->f.TexImage1D(target, level, internalformat, width, border, format, type, pixels);
-}
-
-inline void QOpenGLFunctions_3_2_Core::glTexParameteriv(GLenum target, GLenum pname, const GLint *params)
-{
- d_1_0_Core->f.TexParameteriv(target, pname, params);
-}
-
-inline void QOpenGLFunctions_3_2_Core::glTexParameteri(GLenum target, GLenum pname, GLint param)
-{
- d_1_0_Core->f.TexParameteri(target, pname, param);
-}
-
-inline void QOpenGLFunctions_3_2_Core::glTexParameterfv(GLenum target, GLenum pname, const GLfloat *params)
-{
- d_1_0_Core->f.TexParameterfv(target, pname, params);
-}
-
-inline void QOpenGLFunctions_3_2_Core::glTexParameterf(GLenum target, GLenum pname, GLfloat param)
-{
- d_1_0_Core->f.TexParameterf(target, pname, param);
-}
-
-inline void QOpenGLFunctions_3_2_Core::glScissor(GLint x, GLint y, GLsizei width, GLsizei height)
-{
- d_1_0_Core->f.Scissor(x, y, width, height);
-}
-
-inline void QOpenGLFunctions_3_2_Core::glPolygonMode(GLenum face, GLenum mode)
-{
- d_1_0_Core->f.PolygonMode(face, mode);
-}
-
-inline void QOpenGLFunctions_3_2_Core::glPointSize(GLfloat size)
-{
- d_1_0_Core->f.PointSize(size);
-}
-
-inline void QOpenGLFunctions_3_2_Core::glLineWidth(GLfloat width)
-{
- d_1_0_Core->f.LineWidth(width);
-}
-
-inline void QOpenGLFunctions_3_2_Core::glHint(GLenum target, GLenum mode)
-{
- d_1_0_Core->f.Hint(target, mode);
-}
-
-inline void QOpenGLFunctions_3_2_Core::glFrontFace(GLenum mode)
-{
- d_1_0_Core->f.FrontFace(mode);
-}
-
-inline void QOpenGLFunctions_3_2_Core::glCullFace(GLenum mode)
-{
- d_1_0_Core->f.CullFace(mode);
-}
-
-
-// OpenGL 1.1 core functions
-inline void QOpenGLFunctions_3_2_Core::glIndexubv(const GLubyte *c)
-{
- Q_UNUSED(c);
- QOPENGL_DEPRECATEDFUNCTION;
-}
-
-inline void QOpenGLFunctions_3_2_Core::glIndexub(GLubyte c)
-{
- Q_UNUSED(c);
- QOPENGL_DEPRECATEDFUNCTION;
-}
-
-inline GLboolean QOpenGLFunctions_3_2_Core::glIsTexture(GLuint texture)
-{
- return d_1_1_Core->f.IsTexture(texture);
-}
-
-inline void QOpenGLFunctions_3_2_Core::glGenTextures(GLsizei n, GLuint *textures)
-{
- d_1_1_Core->f.GenTextures(n, textures);
-}
-
-inline void QOpenGLFunctions_3_2_Core::glDeleteTextures(GLsizei n, const GLuint *textures)
-{
- d_1_1_Core->f.DeleteTextures(n, textures);
-}
-
-inline void QOpenGLFunctions_3_2_Core::glBindTexture(GLenum target, GLuint texture)
-{
- d_1_1_Core->f.BindTexture(target, texture);
-}
-
-inline void QOpenGLFunctions_3_2_Core::glTexSubImage2D(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLenum type, const GLvoid *pixels)
-{
- d_1_1_Core->f.TexSubImage2D(target, level, xoffset, yoffset, width, height, format, type, pixels);
-}
-
-inline void QOpenGLFunctions_3_2_Core::glTexSubImage1D(GLenum target, GLint level, GLint xoffset, GLsizei width, GLenum format, GLenum type, const GLvoid *pixels)
-{
- d_1_1_Core->f.TexSubImage1D(target, level, xoffset, width, format, type, pixels);
-}
-
-inline void QOpenGLFunctions_3_2_Core::glCopyTexSubImage2D(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint x, GLint y, GLsizei width, GLsizei height)
-{
- d_1_1_Core->f.CopyTexSubImage2D(target, level, xoffset, yoffset, x, y, width, height);
-}
-
-inline void QOpenGLFunctions_3_2_Core::glCopyTexSubImage1D(GLenum target, GLint level, GLint xoffset, GLint x, GLint y, GLsizei width)
-{
- d_1_1_Core->f.CopyTexSubImage1D(target, level, xoffset, x, y, width);
-}
-
-inline void QOpenGLFunctions_3_2_Core::glCopyTexImage2D(GLenum target, GLint level, GLenum internalformat, GLint x, GLint y, GLsizei width, GLsizei height, GLint border)
-{
- d_1_1_Core->f.CopyTexImage2D(target, level, internalformat, x, y, width, height, border);
-}
-
-inline void QOpenGLFunctions_3_2_Core::glCopyTexImage1D(GLenum target, GLint level, GLenum internalformat, GLint x, GLint y, GLsizei width, GLint border)
-{
- d_1_1_Core->f.CopyTexImage1D(target, level, internalformat, x, y, width, border);
-}
-
-inline void QOpenGLFunctions_3_2_Core::glPolygonOffset(GLfloat factor, GLfloat units)
-{
- d_1_1_Core->f.PolygonOffset(factor, units);
-}
-
-inline void QOpenGLFunctions_3_2_Core::glGetPointerv(GLenum pname, GLvoid* *params)
-{
- Q_UNUSED(pname);
- Q_UNUSED(params);
- QOPENGL_DEPRECATEDFUNCTION;
-}
-
-inline void QOpenGLFunctions_3_2_Core::glDrawElements(GLenum mode, GLsizei count, GLenum type, const GLvoid *indices)
-{
- d_1_1_Core->f.DrawElements(mode, count, type, indices);
-}
-
-inline void QOpenGLFunctions_3_2_Core::glDrawArrays(GLenum mode, GLint first, GLsizei count)
-{
- d_1_1_Core->f.DrawArrays(mode, first, count);
-}
-
-
-// OpenGL 1.2 core functions
-inline void QOpenGLFunctions_3_2_Core::glCopyTexSubImage3D(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLint x, GLint y, GLsizei width, GLsizei height)
-{
- d_1_2_Core->f.CopyTexSubImage3D(target, level, xoffset, yoffset, zoffset, x, y, width, height);
-}
-
-inline void QOpenGLFunctions_3_2_Core::glTexSubImage3D(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLenum type, const GLvoid *pixels)
-{
- d_1_2_Core->f.TexSubImage3D(target, level, xoffset, yoffset, zoffset, width, height, depth, format, type, pixels);
-}
-
-inline void QOpenGLFunctions_3_2_Core::glTexImage3D(GLenum target, GLint level, GLint internalformat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLenum format, GLenum type, const GLvoid *pixels)
-{
- d_1_2_Core->f.TexImage3D(target, level, internalformat, width, height, depth, border, format, type, pixels);
-}
-
-inline void QOpenGLFunctions_3_2_Core::glDrawRangeElements(GLenum mode, GLuint start, GLuint end, GLsizei count, GLenum type, const GLvoid *indices)
-{
- d_1_2_Core->f.DrawRangeElements(mode, start, end, count, type, indices);
-}
-
-inline void QOpenGLFunctions_3_2_Core::glBlendEquation(GLenum mode)
-{
- d_1_2_Core->f.BlendEquation(mode);
-}
-
-inline void QOpenGLFunctions_3_2_Core::glBlendColor(GLfloat red, GLfloat green, GLfloat blue, GLfloat alpha)
-{
- d_1_2_Core->f.BlendColor(red, green, blue, alpha);
-}
-
-
-// OpenGL 1.3 core functions
-inline void QOpenGLFunctions_3_2_Core::glGetCompressedTexImage(GLenum target, GLint level, GLvoid *img)
-{
- d_1_3_Core->f.GetCompressedTexImage(target, level, img);
-}
-
-inline void QOpenGLFunctions_3_2_Core::glCompressedTexSubImage1D(GLenum target, GLint level, GLint xoffset, GLsizei width, GLenum format, GLsizei imageSize, const GLvoid *data)
-{
- d_1_3_Core->f.CompressedTexSubImage1D(target, level, xoffset, width, format, imageSize, data);
-}
-
-inline void QOpenGLFunctions_3_2_Core::glCompressedTexSubImage2D(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLsizei imageSize, const GLvoid *data)
-{
- d_1_3_Core->f.CompressedTexSubImage2D(target, level, xoffset, yoffset, width, height, format, imageSize, data);
-}
-
-inline void QOpenGLFunctions_3_2_Core::glCompressedTexSubImage3D(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLsizei imageSize, const GLvoid *data)
-{
- d_1_3_Core->f.CompressedTexSubImage3D(target, level, xoffset, yoffset, zoffset, width, height, depth, format, imageSize, data);
-}
-
-inline void QOpenGLFunctions_3_2_Core::glCompressedTexImage1D(GLenum target, GLint level, GLenum internalformat, GLsizei width, GLint border, GLsizei imageSize, const GLvoid *data)
-{
- d_1_3_Core->f.CompressedTexImage1D(target, level, internalformat, width, border, imageSize, data);
-}
-
-inline void QOpenGLFunctions_3_2_Core::glCompressedTexImage2D(GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLint border, GLsizei imageSize, const GLvoid *data)
-{
- d_1_3_Core->f.CompressedTexImage2D(target, level, internalformat, width, height, border, imageSize, data);
-}
-
-inline void QOpenGLFunctions_3_2_Core::glCompressedTexImage3D(GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLsizei imageSize, const GLvoid *data)
-{
- d_1_3_Core->f.CompressedTexImage3D(target, level, internalformat, width, height, depth, border, imageSize, data);
-}
-
-inline void QOpenGLFunctions_3_2_Core::glSampleCoverage(GLfloat value, GLboolean invert)
-{
- d_1_3_Core->f.SampleCoverage(value, invert);
-}
-
-inline void QOpenGLFunctions_3_2_Core::glActiveTexture(GLenum texture)
-{
- d_1_3_Core->f.ActiveTexture(texture);
-}
-
-
-// OpenGL 1.4 core functions
-inline void QOpenGLFunctions_3_2_Core::glPointParameteriv(GLenum pname, const GLint *params)
-{
- d_1_4_Core->f.PointParameteriv(pname, params);
-}
-
-inline void QOpenGLFunctions_3_2_Core::glPointParameteri(GLenum pname, GLint param)
-{
- d_1_4_Core->f.PointParameteri(pname, param);
-}
-
-inline void QOpenGLFunctions_3_2_Core::glPointParameterfv(GLenum pname, const GLfloat *params)
-{
- d_1_4_Core->f.PointParameterfv(pname, params);
-}
-
-inline void QOpenGLFunctions_3_2_Core::glPointParameterf(GLenum pname, GLfloat param)
-{
- d_1_4_Core->f.PointParameterf(pname, param);
-}
-
-inline void QOpenGLFunctions_3_2_Core::glMultiDrawElements(GLenum mode, const GLsizei *count, GLenum type, const GLvoid* const *indices, GLsizei drawcount)
-{
- d_1_4_Core->f.MultiDrawElements(mode, count, type, indices, drawcount);
-}
-
-inline void QOpenGLFunctions_3_2_Core::glMultiDrawArrays(GLenum mode, const GLint *first, const GLsizei *count, GLsizei drawcount)
-{
- d_1_4_Core->f.MultiDrawArrays(mode, first, count, drawcount);
-}
-
-inline void QOpenGLFunctions_3_2_Core::glBlendFuncSeparate(GLenum sfactorRGB, GLenum dfactorRGB, GLenum sfactorAlpha, GLenum dfactorAlpha)
-{
- d_1_4_Core->f.BlendFuncSeparate(sfactorRGB, dfactorRGB, sfactorAlpha, dfactorAlpha);
-}
-
-
-// OpenGL 1.5 core functions
-inline void QOpenGLFunctions_3_2_Core::glGetBufferPointerv(GLenum target, GLenum pname, GLvoid* *params)
-{
- d_1_5_Core->f.GetBufferPointerv(target, pname, params);
-}
-
-inline void QOpenGLFunctions_3_2_Core::glGetBufferParameteriv(GLenum target, GLenum pname, GLint *params)
-{
- d_1_5_Core->f.GetBufferParameteriv(target, pname, params);
-}
-
-inline GLboolean QOpenGLFunctions_3_2_Core::glUnmapBuffer(GLenum target)
-{
- return d_1_5_Core->f.UnmapBuffer(target);
-}
-
-inline GLvoid* QOpenGLFunctions_3_2_Core::glMapBuffer(GLenum target, GLenum access)
-{
- return d_1_5_Core->f.MapBuffer(target, access);
-}
-
-inline void QOpenGLFunctions_3_2_Core::glGetBufferSubData(GLenum target, GLintptr offset, GLsizeiptr size, GLvoid *data)
-{
- d_1_5_Core->f.GetBufferSubData(target, offset, size, data);
-}
-
-inline void QOpenGLFunctions_3_2_Core::glBufferSubData(GLenum target, GLintptr offset, GLsizeiptr size, const GLvoid *data)
-{
- d_1_5_Core->f.BufferSubData(target, offset, size, data);
-}
-
-inline void QOpenGLFunctions_3_2_Core::glBufferData(GLenum target, GLsizeiptr size, const GLvoid *data, GLenum usage)
-{
- d_1_5_Core->f.BufferData(target, size, data, usage);
-}
-
-inline GLboolean QOpenGLFunctions_3_2_Core::glIsBuffer(GLuint buffer)
-{
- return d_1_5_Core->f.IsBuffer(buffer);
-}
-
-inline void QOpenGLFunctions_3_2_Core::glGenBuffers(GLsizei n, GLuint *buffers)
-{
- d_1_5_Core->f.GenBuffers(n, buffers);
-}
-
-inline void QOpenGLFunctions_3_2_Core::glDeleteBuffers(GLsizei n, const GLuint *buffers)
-{
- d_1_5_Core->f.DeleteBuffers(n, buffers);
-}
-
-inline void QOpenGLFunctions_3_2_Core::glBindBuffer(GLenum target, GLuint buffer)
-{
- d_1_5_Core->f.BindBuffer(target, buffer);
-}
-
-inline void QOpenGLFunctions_3_2_Core::glGetQueryObjectuiv(GLuint id, GLenum pname, GLuint *params)
-{
- d_1_5_Core->f.GetQueryObjectuiv(id, pname, params);
-}
-
-inline void QOpenGLFunctions_3_2_Core::glGetQueryObjectiv(GLuint id, GLenum pname, GLint *params)
-{
- d_1_5_Core->f.GetQueryObjectiv(id, pname, params);
-}
-
-inline void QOpenGLFunctions_3_2_Core::glGetQueryiv(GLenum target, GLenum pname, GLint *params)
-{
- d_1_5_Core->f.GetQueryiv(target, pname, params);
-}
-
-inline void QOpenGLFunctions_3_2_Core::glEndQuery(GLenum target)
-{
- d_1_5_Core->f.EndQuery(target);
-}
-
-inline void QOpenGLFunctions_3_2_Core::glBeginQuery(GLenum target, GLuint id)
-{
- d_1_5_Core->f.BeginQuery(target, id);
-}
-
-inline GLboolean QOpenGLFunctions_3_2_Core::glIsQuery(GLuint id)
-{
- return d_1_5_Core->f.IsQuery(id);
-}
-
-inline void QOpenGLFunctions_3_2_Core::glDeleteQueries(GLsizei n, const GLuint *ids)
-{
- d_1_5_Core->f.DeleteQueries(n, ids);
-}
-
-inline void QOpenGLFunctions_3_2_Core::glGenQueries(GLsizei n, GLuint *ids)
-{
- d_1_5_Core->f.GenQueries(n, ids);
-}
-
-
-// OpenGL 2.0 core functions
-inline void QOpenGLFunctions_3_2_Core::glVertexAttribPointer(GLuint index, GLint size, GLenum type, GLboolean normalized, GLsizei stride, const GLvoid *pointer)
-{
- d_2_0_Core->f.VertexAttribPointer(index, size, type, normalized, stride, pointer);
-}
-
-inline void QOpenGLFunctions_3_2_Core::glValidateProgram(GLuint program)
-{
- d_2_0_Core->f.ValidateProgram(program);
-}
-
-inline void QOpenGLFunctions_3_2_Core::glUniformMatrix4fv(GLint location, GLsizei count, GLboolean transpose, const GLfloat *value)
-{
- d_2_0_Core->f.UniformMatrix4fv(location, count, transpose, value);
-}
-
-inline void QOpenGLFunctions_3_2_Core::glUniformMatrix3fv(GLint location, GLsizei count, GLboolean transpose, const GLfloat *value)
-{
- d_2_0_Core->f.UniformMatrix3fv(location, count, transpose, value);
-}
-
-inline void QOpenGLFunctions_3_2_Core::glUniformMatrix2fv(GLint location, GLsizei count, GLboolean transpose, const GLfloat *value)
-{
- d_2_0_Core->f.UniformMatrix2fv(location, count, transpose, value);
-}
-
-inline void QOpenGLFunctions_3_2_Core::glUniform4iv(GLint location, GLsizei count, const GLint *value)
-{
- d_2_0_Core->f.Uniform4iv(location, count, value);
-}
-
-inline void QOpenGLFunctions_3_2_Core::glUniform3iv(GLint location, GLsizei count, const GLint *value)
-{
- d_2_0_Core->f.Uniform3iv(location, count, value);
-}
-
-inline void QOpenGLFunctions_3_2_Core::glUniform2iv(GLint location, GLsizei count, const GLint *value)
-{
- d_2_0_Core->f.Uniform2iv(location, count, value);
-}
-
-inline void QOpenGLFunctions_3_2_Core::glUniform1iv(GLint location, GLsizei count, const GLint *value)
-{
- d_2_0_Core->f.Uniform1iv(location, count, value);
-}
-
-inline void QOpenGLFunctions_3_2_Core::glUniform4fv(GLint location, GLsizei count, const GLfloat *value)
-{
- d_2_0_Core->f.Uniform4fv(location, count, value);
-}
-
-inline void QOpenGLFunctions_3_2_Core::glUniform3fv(GLint location, GLsizei count, const GLfloat *value)
-{
- d_2_0_Core->f.Uniform3fv(location, count, value);
-}
-
-inline void QOpenGLFunctions_3_2_Core::glUniform2fv(GLint location, GLsizei count, const GLfloat *value)
-{
- d_2_0_Core->f.Uniform2fv(location, count, value);
-}
-
-inline void QOpenGLFunctions_3_2_Core::glUniform1fv(GLint location, GLsizei count, const GLfloat *value)
-{
- d_2_0_Core->f.Uniform1fv(location, count, value);
-}
-
-inline void QOpenGLFunctions_3_2_Core::glUniform4i(GLint location, GLint v0, GLint v1, GLint v2, GLint v3)
-{
- d_2_0_Core->f.Uniform4i(location, v0, v1, v2, v3);
-}
-
-inline void QOpenGLFunctions_3_2_Core::glUniform3i(GLint location, GLint v0, GLint v1, GLint v2)
-{
- d_2_0_Core->f.Uniform3i(location, v0, v1, v2);
-}
-
-inline void QOpenGLFunctions_3_2_Core::glUniform2i(GLint location, GLint v0, GLint v1)
-{
- d_2_0_Core->f.Uniform2i(location, v0, v1);
-}
-
-inline void QOpenGLFunctions_3_2_Core::glUniform1i(GLint location, GLint v0)
-{
- d_2_0_Core->f.Uniform1i(location, v0);
-}
-
-inline void QOpenGLFunctions_3_2_Core::glUniform4f(GLint location, GLfloat v0, GLfloat v1, GLfloat v2, GLfloat v3)
-{
- d_2_0_Core->f.Uniform4f(location, v0, v1, v2, v3);
-}
-
-inline void QOpenGLFunctions_3_2_Core::glUniform3f(GLint location, GLfloat v0, GLfloat v1, GLfloat v2)
-{
- d_2_0_Core->f.Uniform3f(location, v0, v1, v2);
-}
-
-inline void QOpenGLFunctions_3_2_Core::glUniform2f(GLint location, GLfloat v0, GLfloat v1)
-{
- d_2_0_Core->f.Uniform2f(location, v0, v1);
-}
-
-inline void QOpenGLFunctions_3_2_Core::glUniform1f(GLint location, GLfloat v0)
-{
- d_2_0_Core->f.Uniform1f(location, v0);
-}
-
-inline void QOpenGLFunctions_3_2_Core::glUseProgram(GLuint program)
-{
- d_2_0_Core->f.UseProgram(program);
-}
-
-inline void QOpenGLFunctions_3_2_Core::glShaderSource(GLuint shader, GLsizei count, const GLchar* const *string, const GLint *length)
-{
- d_2_0_Core->f.ShaderSource(shader, count, string, length);
-}
-
-inline void QOpenGLFunctions_3_2_Core::glLinkProgram(GLuint program)
-{
- d_2_0_Core->f.LinkProgram(program);
-}
-
-inline GLboolean QOpenGLFunctions_3_2_Core::glIsShader(GLuint shader)
-{
- return d_2_0_Core->f.IsShader(shader);
-}
-
-inline GLboolean QOpenGLFunctions_3_2_Core::glIsProgram(GLuint program)
-{
- return d_2_0_Core->f.IsProgram(program);
-}
-
-inline void QOpenGLFunctions_3_2_Core::glGetVertexAttribPointerv(GLuint index, GLenum pname, GLvoid* *pointer)
-{
- d_2_0_Core->f.GetVertexAttribPointerv(index, pname, pointer);
-}
-
-inline void QOpenGLFunctions_3_2_Core::glGetVertexAttribiv(GLuint index, GLenum pname, GLint *params)
-{
- d_2_0_Core->f.GetVertexAttribiv(index, pname, params);
-}
-
-inline void QOpenGLFunctions_3_2_Core::glGetVertexAttribfv(GLuint index, GLenum pname, GLfloat *params)
-{
- d_2_0_Core->f.GetVertexAttribfv(index, pname, params);
-}
-
-inline void QOpenGLFunctions_3_2_Core::glGetVertexAttribdv(GLuint index, GLenum pname, GLdouble *params)
-{
- d_2_0_Core->f.GetVertexAttribdv(index, pname, params);
-}
-
-inline void QOpenGLFunctions_3_2_Core::glGetUniformiv(GLuint program, GLint location, GLint *params)
-{
- d_2_0_Core->f.GetUniformiv(program, location, params);
-}
-
-inline void QOpenGLFunctions_3_2_Core::glGetUniformfv(GLuint program, GLint location, GLfloat *params)
-{
- d_2_0_Core->f.GetUniformfv(program, location, params);
-}
-
-inline GLint QOpenGLFunctions_3_2_Core::glGetUniformLocation(GLuint program, const GLchar *name)
-{
- return d_2_0_Core->f.GetUniformLocation(program, name);
-}
-
-inline void QOpenGLFunctions_3_2_Core::glGetShaderSource(GLuint shader, GLsizei bufSize, GLsizei *length, GLchar *source)
-{
- d_2_0_Core->f.GetShaderSource(shader, bufSize, length, source);
-}
-
-inline void QOpenGLFunctions_3_2_Core::glGetShaderInfoLog(GLuint shader, GLsizei bufSize, GLsizei *length, GLchar *infoLog)
-{
- d_2_0_Core->f.GetShaderInfoLog(shader, bufSize, length, infoLog);
-}
-
-inline void QOpenGLFunctions_3_2_Core::glGetShaderiv(GLuint shader, GLenum pname, GLint *params)
-{
- d_2_0_Core->f.GetShaderiv(shader, pname, params);
-}
-
-inline void QOpenGLFunctions_3_2_Core::glGetProgramInfoLog(GLuint program, GLsizei bufSize, GLsizei *length, GLchar *infoLog)
-{
- d_2_0_Core->f.GetProgramInfoLog(program, bufSize, length, infoLog);
-}
-
-inline void QOpenGLFunctions_3_2_Core::glGetProgramiv(GLuint program, GLenum pname, GLint *params)
-{
- d_2_0_Core->f.GetProgramiv(program, pname, params);
-}
-
-inline GLint QOpenGLFunctions_3_2_Core::glGetAttribLocation(GLuint program, const GLchar *name)
-{
- return d_2_0_Core->f.GetAttribLocation(program, name);
-}
-
-inline void QOpenGLFunctions_3_2_Core::glGetAttachedShaders(GLuint program, GLsizei maxCount, GLsizei *count, GLuint *obj)
-{
- d_2_0_Core->f.GetAttachedShaders(program, maxCount, count, obj);
-}
-
-inline void QOpenGLFunctions_3_2_Core::glGetActiveUniform(GLuint program, GLuint index, GLsizei bufSize, GLsizei *length, GLint *size, GLenum *type, GLchar *name)
-{
- d_2_0_Core->f.GetActiveUniform(program, index, bufSize, length, size, type, name);
-}
-
-inline void QOpenGLFunctions_3_2_Core::glGetActiveAttrib(GLuint program, GLuint index, GLsizei bufSize, GLsizei *length, GLint *size, GLenum *type, GLchar *name)
-{
- d_2_0_Core->f.GetActiveAttrib(program, index, bufSize, length, size, type, name);
-}
-
-inline void QOpenGLFunctions_3_2_Core::glEnableVertexAttribArray(GLuint index)
-{
- d_2_0_Core->f.EnableVertexAttribArray(index);
-}
-
-inline void QOpenGLFunctions_3_2_Core::glDisableVertexAttribArray(GLuint index)
-{
- d_2_0_Core->f.DisableVertexAttribArray(index);
-}
-
-inline void QOpenGLFunctions_3_2_Core::glDetachShader(GLuint program, GLuint shader)
-{
- d_2_0_Core->f.DetachShader(program, shader);
-}
-
-inline void QOpenGLFunctions_3_2_Core::glDeleteShader(GLuint shader)
-{
- d_2_0_Core->f.DeleteShader(shader);
-}
-
-inline void QOpenGLFunctions_3_2_Core::glDeleteProgram(GLuint program)
-{
- d_2_0_Core->f.DeleteProgram(program);
-}
-
-inline GLuint QOpenGLFunctions_3_2_Core::glCreateShader(GLenum type)
-{
- return d_2_0_Core->f.CreateShader(type);
-}
-
-inline GLuint QOpenGLFunctions_3_2_Core::glCreateProgram()
-{
- return d_2_0_Core->f.CreateProgram();
-}
-
-inline void QOpenGLFunctions_3_2_Core::glCompileShader(GLuint shader)
-{
- d_2_0_Core->f.CompileShader(shader);
-}
-
-inline void QOpenGLFunctions_3_2_Core::glBindAttribLocation(GLuint program, GLuint index, const GLchar *name)
-{
- d_2_0_Core->f.BindAttribLocation(program, index, name);
-}
-
-inline void QOpenGLFunctions_3_2_Core::glAttachShader(GLuint program, GLuint shader)
-{
- d_2_0_Core->f.AttachShader(program, shader);
-}
-
-inline void QOpenGLFunctions_3_2_Core::glStencilMaskSeparate(GLenum face, GLuint mask)
-{
- d_2_0_Core->f.StencilMaskSeparate(face, mask);
-}
-
-inline void QOpenGLFunctions_3_2_Core::glStencilFuncSeparate(GLenum face, GLenum func, GLint ref, GLuint mask)
-{
- d_2_0_Core->f.StencilFuncSeparate(face, func, ref, mask);
-}
-
-inline void QOpenGLFunctions_3_2_Core::glStencilOpSeparate(GLenum face, GLenum sfail, GLenum dpfail, GLenum dppass)
-{
- d_2_0_Core->f.StencilOpSeparate(face, sfail, dpfail, dppass);
-}
-
-inline void QOpenGLFunctions_3_2_Core::glDrawBuffers(GLsizei n, const GLenum *bufs)
-{
- d_2_0_Core->f.DrawBuffers(n, bufs);
-}
-
-inline void QOpenGLFunctions_3_2_Core::glBlendEquationSeparate(GLenum modeRGB, GLenum modeAlpha)
-{
- d_2_0_Core->f.BlendEquationSeparate(modeRGB, modeAlpha);
-}
-
-
-// OpenGL 2.1 core functions
-inline void QOpenGLFunctions_3_2_Core::glUniformMatrix4x3fv(GLint location, GLsizei count, GLboolean transpose, const GLfloat *value)
-{
- d_2_1_Core->f.UniformMatrix4x3fv(location, count, transpose, value);
-}
-
-inline void QOpenGLFunctions_3_2_Core::glUniformMatrix3x4fv(GLint location, GLsizei count, GLboolean transpose, const GLfloat *value)
-{
- d_2_1_Core->f.UniformMatrix3x4fv(location, count, transpose, value);
-}
-
-inline void QOpenGLFunctions_3_2_Core::glUniformMatrix4x2fv(GLint location, GLsizei count, GLboolean transpose, const GLfloat *value)
-{
- d_2_1_Core->f.UniformMatrix4x2fv(location, count, transpose, value);
-}
-
-inline void QOpenGLFunctions_3_2_Core::glUniformMatrix2x4fv(GLint location, GLsizei count, GLboolean transpose, const GLfloat *value)
-{
- d_2_1_Core->f.UniformMatrix2x4fv(location, count, transpose, value);
-}
-
-inline void QOpenGLFunctions_3_2_Core::glUniformMatrix3x2fv(GLint location, GLsizei count, GLboolean transpose, const GLfloat *value)
-{
- d_2_1_Core->f.UniformMatrix3x2fv(location, count, transpose, value);
-}
-
-inline void QOpenGLFunctions_3_2_Core::glUniformMatrix2x3fv(GLint location, GLsizei count, GLboolean transpose, const GLfloat *value)
-{
- d_2_1_Core->f.UniformMatrix2x3fv(location, count, transpose, value);
-}
-
-
-// OpenGL 3.0 core functions
-inline GLboolean QOpenGLFunctions_3_2_Core::glIsVertexArray(GLuint array)
-{
- return d_3_0_Core->f.IsVertexArray(array);
-}
-
-inline void QOpenGLFunctions_3_2_Core::glGenVertexArrays(GLsizei n, GLuint *arrays)
-{
- d_3_0_Core->f.GenVertexArrays(n, arrays);
-}
-
-inline void QOpenGLFunctions_3_2_Core::glDeleteVertexArrays(GLsizei n, const GLuint *arrays)
-{
- d_3_0_Core->f.DeleteVertexArrays(n, arrays);
-}
-
-inline void QOpenGLFunctions_3_2_Core::glBindVertexArray(GLuint array)
-{
- d_3_0_Core->f.BindVertexArray(array);
-}
-
-inline void QOpenGLFunctions_3_2_Core::glFlushMappedBufferRange(GLenum target, GLintptr offset, GLsizeiptr length)
-{
- d_3_0_Core->f.FlushMappedBufferRange(target, offset, length);
-}
-
-inline GLvoid* QOpenGLFunctions_3_2_Core::glMapBufferRange(GLenum target, GLintptr offset, GLsizeiptr length, GLbitfield access)
-{
- return d_3_0_Core->f.MapBufferRange(target, offset, length, access);
-}
-
-inline void QOpenGLFunctions_3_2_Core::glFramebufferTextureLayer(GLenum target, GLenum attachment, GLuint texture, GLint level, GLint layer)
-{
- d_3_0_Core->f.FramebufferTextureLayer(target, attachment, texture, level, layer);
-}
-
-inline void QOpenGLFunctions_3_2_Core::glRenderbufferStorageMultisample(GLenum target, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height)
-{
- d_3_0_Core->f.RenderbufferStorageMultisample(target, samples, internalformat, width, height);
-}
-
-inline void QOpenGLFunctions_3_2_Core::glBlitFramebuffer(GLint srcX0, GLint srcY0, GLint srcX1, GLint srcY1, GLint dstX0, GLint dstY0, GLint dstX1, GLint dstY1, GLbitfield mask, GLenum filter)
-{
- d_3_0_Core->f.BlitFramebuffer(srcX0, srcY0, srcX1, srcY1, dstX0, dstY0, dstX1, dstY1, mask, filter);
-}
-
-inline void QOpenGLFunctions_3_2_Core::glGenerateMipmap(GLenum target)
-{
- d_3_0_Core->f.GenerateMipmap(target);
-}
-
-inline void QOpenGLFunctions_3_2_Core::glGetFramebufferAttachmentParameteriv(GLenum target, GLenum attachment, GLenum pname, GLint *params)
-{
- d_3_0_Core->f.GetFramebufferAttachmentParameteriv(target, attachment, pname, params);
-}
-
-inline void QOpenGLFunctions_3_2_Core::glFramebufferRenderbuffer(GLenum target, GLenum attachment, GLenum renderbuffertarget, GLuint renderbuffer)
-{
- d_3_0_Core->f.FramebufferRenderbuffer(target, attachment, renderbuffertarget, renderbuffer);
-}
-
-inline void QOpenGLFunctions_3_2_Core::glFramebufferTexture3D(GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level, GLint zoffset)
-{
- d_3_0_Core->f.FramebufferTexture3D(target, attachment, textarget, texture, level, zoffset);
-}
-
-inline void QOpenGLFunctions_3_2_Core::glFramebufferTexture2D(GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level)
-{
- d_3_0_Core->f.FramebufferTexture2D(target, attachment, textarget, texture, level);
-}
-
-inline void QOpenGLFunctions_3_2_Core::glFramebufferTexture1D(GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level)
-{
- d_3_0_Core->f.FramebufferTexture1D(target, attachment, textarget, texture, level);
-}
-
-inline GLenum QOpenGLFunctions_3_2_Core::glCheckFramebufferStatus(GLenum target)
-{
- return d_3_0_Core->f.CheckFramebufferStatus(target);
-}
-
-inline void QOpenGLFunctions_3_2_Core::glGenFramebuffers(GLsizei n, GLuint *framebuffers)
-{
- d_3_0_Core->f.GenFramebuffers(n, framebuffers);
-}
-
-inline void QOpenGLFunctions_3_2_Core::glDeleteFramebuffers(GLsizei n, const GLuint *framebuffers)
-{
- d_3_0_Core->f.DeleteFramebuffers(n, framebuffers);
-}
-
-inline void QOpenGLFunctions_3_2_Core::glBindFramebuffer(GLenum target, GLuint framebuffer)
-{
- d_3_0_Core->f.BindFramebuffer(target, framebuffer);
-}
-
-inline GLboolean QOpenGLFunctions_3_2_Core::glIsFramebuffer(GLuint framebuffer)
-{
- return d_3_0_Core->f.IsFramebuffer(framebuffer);
-}
-
-inline void QOpenGLFunctions_3_2_Core::glGetRenderbufferParameteriv(GLenum target, GLenum pname, GLint *params)
-{
- d_3_0_Core->f.GetRenderbufferParameteriv(target, pname, params);
-}
-
-inline void QOpenGLFunctions_3_2_Core::glRenderbufferStorage(GLenum target, GLenum internalformat, GLsizei width, GLsizei height)
-{
- d_3_0_Core->f.RenderbufferStorage(target, internalformat, width, height);
-}
-
-inline void QOpenGLFunctions_3_2_Core::glGenRenderbuffers(GLsizei n, GLuint *renderbuffers)
-{
- d_3_0_Core->f.GenRenderbuffers(n, renderbuffers);
-}
-
-inline void QOpenGLFunctions_3_2_Core::glDeleteRenderbuffers(GLsizei n, const GLuint *renderbuffers)
-{
- d_3_0_Core->f.DeleteRenderbuffers(n, renderbuffers);
-}
-
-inline void QOpenGLFunctions_3_2_Core::glBindRenderbuffer(GLenum target, GLuint renderbuffer)
-{
- d_3_0_Core->f.BindRenderbuffer(target, renderbuffer);
-}
-
-inline GLboolean QOpenGLFunctions_3_2_Core::glIsRenderbuffer(GLuint renderbuffer)
-{
- return d_3_0_Core->f.IsRenderbuffer(renderbuffer);
-}
-
-inline const GLubyte * QOpenGLFunctions_3_2_Core::glGetStringi(GLenum name, GLuint index)
-{
- return d_3_0_Core->f.GetStringi(name, index);
-}
-
-inline void QOpenGLFunctions_3_2_Core::glClearBufferfi(GLenum buffer, GLint drawbuffer, GLfloat depth, GLint stencil)
-{
- d_3_0_Core->f.ClearBufferfi(buffer, drawbuffer, depth, stencil);
-}
-
-inline void QOpenGLFunctions_3_2_Core::glClearBufferfv(GLenum buffer, GLint drawbuffer, const GLfloat *value)
-{
- d_3_0_Core->f.ClearBufferfv(buffer, drawbuffer, value);
-}
-
-inline void QOpenGLFunctions_3_2_Core::glClearBufferuiv(GLenum buffer, GLint drawbuffer, const GLuint *value)
-{
- d_3_0_Core->f.ClearBufferuiv(buffer, drawbuffer, value);
-}
-
-inline void QOpenGLFunctions_3_2_Core::glClearBufferiv(GLenum buffer, GLint drawbuffer, const GLint *value)
-{
- d_3_0_Core->f.ClearBufferiv(buffer, drawbuffer, value);
-}
-
-inline void QOpenGLFunctions_3_2_Core::glGetTexParameterIuiv(GLenum target, GLenum pname, GLuint *params)
-{
- d_3_0_Core->f.GetTexParameterIuiv(target, pname, params);
-}
-
-inline void QOpenGLFunctions_3_2_Core::glGetTexParameterIiv(GLenum target, GLenum pname, GLint *params)
-{
- d_3_0_Core->f.GetTexParameterIiv(target, pname, params);
-}
-
-inline void QOpenGLFunctions_3_2_Core::glTexParameterIuiv(GLenum target, GLenum pname, const GLuint *params)
-{
- d_3_0_Core->f.TexParameterIuiv(target, pname, params);
-}
-
-inline void QOpenGLFunctions_3_2_Core::glTexParameterIiv(GLenum target, GLenum pname, const GLint *params)
-{
- d_3_0_Core->f.TexParameterIiv(target, pname, params);
-}
-
-inline void QOpenGLFunctions_3_2_Core::glUniform4uiv(GLint location, GLsizei count, const GLuint *value)
-{
- d_3_0_Core->f.Uniform4uiv(location, count, value);
-}
-
-inline void QOpenGLFunctions_3_2_Core::glUniform3uiv(GLint location, GLsizei count, const GLuint *value)
-{
- d_3_0_Core->f.Uniform3uiv(location, count, value);
-}
-
-inline void QOpenGLFunctions_3_2_Core::glUniform2uiv(GLint location, GLsizei count, const GLuint *value)
-{
- d_3_0_Core->f.Uniform2uiv(location, count, value);
-}
-
-inline void QOpenGLFunctions_3_2_Core::glUniform1uiv(GLint location, GLsizei count, const GLuint *value)
-{
- d_3_0_Core->f.Uniform1uiv(location, count, value);
-}
-
-inline void QOpenGLFunctions_3_2_Core::glUniform4ui(GLint location, GLuint v0, GLuint v1, GLuint v2, GLuint v3)
-{
- d_3_0_Core->f.Uniform4ui(location, v0, v1, v2, v3);
-}
-
-inline void QOpenGLFunctions_3_2_Core::glUniform3ui(GLint location, GLuint v0, GLuint v1, GLuint v2)
-{
- d_3_0_Core->f.Uniform3ui(location, v0, v1, v2);
-}
-
-inline void QOpenGLFunctions_3_2_Core::glUniform2ui(GLint location, GLuint v0, GLuint v1)
-{
- d_3_0_Core->f.Uniform2ui(location, v0, v1);
-}
-
-inline void QOpenGLFunctions_3_2_Core::glUniform1ui(GLint location, GLuint v0)
-{
- d_3_0_Core->f.Uniform1ui(location, v0);
-}
-
-inline GLint QOpenGLFunctions_3_2_Core::glGetFragDataLocation(GLuint program, const GLchar *name)
-{
- return d_3_0_Core->f.GetFragDataLocation(program, name);
-}
-
-inline void QOpenGLFunctions_3_2_Core::glBindFragDataLocation(GLuint program, GLuint color, const GLchar *name)
-{
- d_3_0_Core->f.BindFragDataLocation(program, color, name);
-}
-
-inline void QOpenGLFunctions_3_2_Core::glGetUniformuiv(GLuint program, GLint location, GLuint *params)
-{
- d_3_0_Core->f.GetUniformuiv(program, location, params);
-}
-
-inline void QOpenGLFunctions_3_2_Core::glGetVertexAttribIuiv(GLuint index, GLenum pname, GLuint *params)
-{
- d_3_0_Core->f.GetVertexAttribIuiv(index, pname, params);
-}
-
-inline void QOpenGLFunctions_3_2_Core::glGetVertexAttribIiv(GLuint index, GLenum pname, GLint *params)
-{
- d_3_0_Core->f.GetVertexAttribIiv(index, pname, params);
-}
-
-inline void QOpenGLFunctions_3_2_Core::glVertexAttribIPointer(GLuint index, GLint size, GLenum type, GLsizei stride, const GLvoid *pointer)
-{
- d_3_0_Core->f.VertexAttribIPointer(index, size, type, stride, pointer);
-}
-
-inline void QOpenGLFunctions_3_2_Core::glEndConditionalRender()
-{
- d_3_0_Core->f.EndConditionalRender();
-}
-
-inline void QOpenGLFunctions_3_2_Core::glBeginConditionalRender(GLuint id, GLenum mode)
-{
- d_3_0_Core->f.BeginConditionalRender(id, mode);
-}
-
-inline void QOpenGLFunctions_3_2_Core::glClampColor(GLenum target, GLenum clamp)
-{
- d_3_0_Core->f.ClampColor(target, clamp);
-}
-
-inline void QOpenGLFunctions_3_2_Core::glGetTransformFeedbackVarying(GLuint program, GLuint index, GLsizei bufSize, GLsizei *length, GLsizei *size, GLenum *type, GLchar *name)
-{
- d_3_0_Core->f.GetTransformFeedbackVarying(program, index, bufSize, length, size, type, name);
-}
-
-inline void QOpenGLFunctions_3_2_Core::glTransformFeedbackVaryings(GLuint program, GLsizei count, const GLchar* const *varyings, GLenum bufferMode)
-{
- d_3_0_Core->f.TransformFeedbackVaryings(program, count, varyings, bufferMode);
-}
-
-inline void QOpenGLFunctions_3_2_Core::glBindBufferBase(GLenum target, GLuint index, GLuint buffer)
-{
- d_3_0_Core->f.BindBufferBase(target, index, buffer);
-}
-
-inline void QOpenGLFunctions_3_2_Core::glBindBufferRange(GLenum target, GLuint index, GLuint buffer, GLintptr offset, GLsizeiptr size)
-{
- d_3_0_Core->f.BindBufferRange(target, index, buffer, offset, size);
-}
-
-inline void QOpenGLFunctions_3_2_Core::glEndTransformFeedback()
-{
- d_3_0_Core->f.EndTransformFeedback();
-}
-
-inline void QOpenGLFunctions_3_2_Core::glBeginTransformFeedback(GLenum primitiveMode)
-{
- d_3_0_Core->f.BeginTransformFeedback(primitiveMode);
-}
-
-inline GLboolean QOpenGLFunctions_3_2_Core::glIsEnabledi(GLenum target, GLuint index)
-{
- return d_3_0_Core->f.IsEnabledi(target, index);
-}
-
-inline void QOpenGLFunctions_3_2_Core::glDisablei(GLenum target, GLuint index)
-{
- d_3_0_Core->f.Disablei(target, index);
-}
-
-inline void QOpenGLFunctions_3_2_Core::glEnablei(GLenum target, GLuint index)
-{
- d_3_0_Core->f.Enablei(target, index);
-}
-
-inline void QOpenGLFunctions_3_2_Core::glGetIntegeri_v(GLenum target, GLuint index, GLint *data)
-{
- d_3_0_Core->f.GetIntegeri_v(target, index, data);
-}
-
-inline void QOpenGLFunctions_3_2_Core::glGetBooleani_v(GLenum target, GLuint index, GLboolean *data)
-{
- d_3_0_Core->f.GetBooleani_v(target, index, data);
-}
-
-inline void QOpenGLFunctions_3_2_Core::glColorMaski(GLuint index, GLboolean r, GLboolean g, GLboolean b, GLboolean a)
-{
- d_3_0_Core->f.ColorMaski(index, r, g, b, a);
-}
-
-
-// OpenGL 3.1 core functions
-inline void QOpenGLFunctions_3_2_Core::glCopyBufferSubData(GLenum readTarget, GLenum writeTarget, GLintptr readOffset, GLintptr writeOffset, GLsizeiptr size)
-{
- d_3_1_Core->f.CopyBufferSubData(readTarget, writeTarget, readOffset, writeOffset, size);
-}
-
-inline void QOpenGLFunctions_3_2_Core::glUniformBlockBinding(GLuint program, GLuint uniformBlockIndex, GLuint uniformBlockBinding)
-{
- d_3_1_Core->f.UniformBlockBinding(program, uniformBlockIndex, uniformBlockBinding);
-}
-
-inline void QOpenGLFunctions_3_2_Core::glGetActiveUniformBlockName(GLuint program, GLuint uniformBlockIndex, GLsizei bufSize, GLsizei *length, GLchar *uniformBlockName)
-{
- d_3_1_Core->f.GetActiveUniformBlockName(program, uniformBlockIndex, bufSize, length, uniformBlockName);
-}
-
-inline void QOpenGLFunctions_3_2_Core::glGetActiveUniformBlockiv(GLuint program, GLuint uniformBlockIndex, GLenum pname, GLint *params)
-{
- d_3_1_Core->f.GetActiveUniformBlockiv(program, uniformBlockIndex, pname, params);
-}
-
-inline GLuint QOpenGLFunctions_3_2_Core::glGetUniformBlockIndex(GLuint program, const GLchar *uniformBlockName)
-{
- return d_3_1_Core->f.GetUniformBlockIndex(program, uniformBlockName);
-}
-
-inline void QOpenGLFunctions_3_2_Core::glGetActiveUniformName(GLuint program, GLuint uniformIndex, GLsizei bufSize, GLsizei *length, GLchar *uniformName)
-{
- d_3_1_Core->f.GetActiveUniformName(program, uniformIndex, bufSize, length, uniformName);
-}
-
-inline void QOpenGLFunctions_3_2_Core::glGetActiveUniformsiv(GLuint program, GLsizei uniformCount, const GLuint *uniformIndices, GLenum pname, GLint *params)
-{
- d_3_1_Core->f.GetActiveUniformsiv(program, uniformCount, uniformIndices, pname, params);
-}
-
-inline void QOpenGLFunctions_3_2_Core::glGetUniformIndices(GLuint program, GLsizei uniformCount, const GLchar* const *uniformNames, GLuint *uniformIndices)
-{
- d_3_1_Core->f.GetUniformIndices(program, uniformCount, uniformNames, uniformIndices);
-}
-
-inline void QOpenGLFunctions_3_2_Core::glPrimitiveRestartIndex(GLuint index)
-{
- d_3_1_Core->f.PrimitiveRestartIndex(index);
-}
-
-inline void QOpenGLFunctions_3_2_Core::glTexBuffer(GLenum target, GLenum internalformat, GLuint buffer)
-{
- d_3_1_Core->f.TexBuffer(target, internalformat, buffer);
-}
-
-inline void QOpenGLFunctions_3_2_Core::glDrawElementsInstanced(GLenum mode, GLsizei count, GLenum type, const GLvoid *indices, GLsizei instancecount)
-{
- d_3_1_Core->f.DrawElementsInstanced(mode, count, type, indices, instancecount);
-}
-
-inline void QOpenGLFunctions_3_2_Core::glDrawArraysInstanced(GLenum mode, GLint first, GLsizei count, GLsizei instancecount)
-{
- d_3_1_Core->f.DrawArraysInstanced(mode, first, count, instancecount);
-}
-
-
-// OpenGL 3.2 core functions
-inline void QOpenGLFunctions_3_2_Core::glSampleMaski(GLuint index, GLbitfield mask)
-{
- d_3_2_Core->f.SampleMaski(index, mask);
-}
-
-inline void QOpenGLFunctions_3_2_Core::glGetMultisamplefv(GLenum pname, GLuint index, GLfloat *val)
-{
- d_3_2_Core->f.GetMultisamplefv(pname, index, val);
-}
-
-inline void QOpenGLFunctions_3_2_Core::glTexImage3DMultisample(GLenum target, GLsizei samples, GLint internalformat, GLsizei width, GLsizei height, GLsizei depth, GLboolean fixedsamplelocations)
-{
- d_3_2_Core->f.TexImage3DMultisample(target, samples, internalformat, width, height, depth, fixedsamplelocations);
-}
-
-inline void QOpenGLFunctions_3_2_Core::glTexImage2DMultisample(GLenum target, GLsizei samples, GLint internalformat, GLsizei width, GLsizei height, GLboolean fixedsamplelocations)
-{
- d_3_2_Core->f.TexImage2DMultisample(target, samples, internalformat, width, height, fixedsamplelocations);
-}
-
-inline void QOpenGLFunctions_3_2_Core::glGetSynciv(GLsync sync, GLenum pname, GLsizei bufSize, GLsizei *length, GLint *values)
-{
- d_3_2_Core->f.GetSynciv(sync, pname, bufSize, length, values);
-}
-
-inline void QOpenGLFunctions_3_2_Core::glGetInteger64v(GLenum pname, GLint64 *params)
-{
- d_3_2_Core->f.GetInteger64v(pname, params);
-}
-
-inline void QOpenGLFunctions_3_2_Core::glWaitSync(GLsync sync, GLbitfield flags, GLuint64 timeout)
-{
- d_3_2_Core->f.WaitSync(sync, flags, timeout);
-}
-
-inline GLenum QOpenGLFunctions_3_2_Core::glClientWaitSync(GLsync sync, GLbitfield flags, GLuint64 timeout)
-{
- return d_3_2_Core->f.ClientWaitSync(sync, flags, timeout);
-}
-
-inline void QOpenGLFunctions_3_2_Core::glDeleteSync(GLsync sync)
-{
- d_3_2_Core->f.DeleteSync(sync);
-}
-
-inline GLboolean QOpenGLFunctions_3_2_Core::glIsSync(GLsync sync)
-{
- return d_3_2_Core->f.IsSync(sync);
-}
-
-inline GLsync QOpenGLFunctions_3_2_Core::glFenceSync(GLenum condition, GLbitfield flags)
-{
- return d_3_2_Core->f.FenceSync(condition, flags);
-}
-
-inline void QOpenGLFunctions_3_2_Core::glProvokingVertex(GLenum mode)
-{
- d_3_2_Core->f.ProvokingVertex(mode);
-}
-
-inline void QOpenGLFunctions_3_2_Core::glMultiDrawElementsBaseVertex(GLenum mode, const GLsizei *count, GLenum type, const GLvoid* const *indices, GLsizei drawcount, const GLint *basevertex)
-{
- d_3_2_Core->f.MultiDrawElementsBaseVertex(mode, count, type, indices, drawcount, basevertex);
-}
-
-inline void QOpenGLFunctions_3_2_Core::glDrawElementsInstancedBaseVertex(GLenum mode, GLsizei count, GLenum type, const GLvoid *indices, GLsizei instancecount, GLint basevertex)
-{
- d_3_2_Core->f.DrawElementsInstancedBaseVertex(mode, count, type, indices, instancecount, basevertex);
-}
-
-inline void QOpenGLFunctions_3_2_Core::glDrawRangeElementsBaseVertex(GLenum mode, GLuint start, GLuint end, GLsizei count, GLenum type, const GLvoid *indices, GLint basevertex)
-{
- d_3_2_Core->f.DrawRangeElementsBaseVertex(mode, start, end, count, type, indices, basevertex);
-}
-
-inline void QOpenGLFunctions_3_2_Core::glDrawElementsBaseVertex(GLenum mode, GLsizei count, GLenum type, const GLvoid *indices, GLint basevertex)
-{
- d_3_2_Core->f.DrawElementsBaseVertex(mode, count, type, indices, basevertex);
-}
-
-inline void QOpenGLFunctions_3_2_Core::glFramebufferTexture(GLenum target, GLenum attachment, GLuint texture, GLint level)
-{
- d_3_2_Core->f.FramebufferTexture(target, attachment, texture, level);
-}
-
-inline void QOpenGLFunctions_3_2_Core::glGetBufferParameteri64v(GLenum target, GLenum pname, GLint64 *params)
-{
- d_3_2_Core->f.GetBufferParameteri64v(target, pname, params);
-}
-
-inline void QOpenGLFunctions_3_2_Core::glGetInteger64i_v(GLenum target, GLuint index, GLint64 *data)
-{
- d_3_2_Core->f.GetInteger64i_v(target, index, data);
-}
-
-
-
-QT_END_NAMESPACE
-
-#endif // QT_NO_OPENGL && !QT_OPENGL_ES_2
-
-#endif
diff --git a/src/gui/opengl/qopenglfunctions_3_3_compatibility.cpp b/src/gui/opengl/qopenglfunctions_3_3_compatibility.cpp
deleted file mode 100644
index a26d7d99b1..0000000000
--- a/src/gui/opengl/qopenglfunctions_3_3_compatibility.cpp
+++ /dev/null
@@ -1,282 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2013 Klaralvdalens Datakonsult AB (KDAB)
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the QtGui module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-**
-** This file was generated by glgen version 0.1
-** Command line was: glgen
-**
-** glgen is Copyright (C) 2013 Klaralvdalens Datakonsult AB (KDAB)
-**
-** This is an auto-generated file.
-** Do not edit! All changes made to it will be lost.
-**
-****************************************************************************/
-
-#include "qopenglfunctions_3_3_compatibility.h"
-#include "qopenglcontext.h"
-
-QT_BEGIN_NAMESPACE
-
-/*!
- \class QOpenGLFunctions_3_3_Compatibility
- \inmodule QtGui
- \since 5.1
- \wrapper
- \brief The QOpenGLFunctions_3_3_Compatibility class provides all functions for OpenGL 3.3 compatibility profile.
-
- This class is a wrapper for functions from OpenGL 3.3 compatibility profile.
- See reference pages on \l {http://www.opengl.org/sdk/docs/}{opengl.org}
- for function documentation.
-
- \sa QAbstractOpenGLFunctions
-*/
-
-QOpenGLFunctions_3_3_Compatibility::QOpenGLFunctions_3_3_Compatibility()
- : QAbstractOpenGLFunctions()
- , d_1_0_Core(nullptr)
- , d_1_1_Core(nullptr)
- , d_1_2_Core(nullptr)
- , d_1_3_Core(nullptr)
- , d_1_4_Core(nullptr)
- , d_1_5_Core(nullptr)
- , d_2_0_Core(nullptr)
- , d_2_1_Core(nullptr)
- , d_3_0_Core(nullptr)
- , d_3_1_Core(nullptr)
- , d_3_2_Core(nullptr)
- , d_3_3_Core(nullptr)
- , d_1_0_Deprecated(nullptr)
- , d_1_1_Deprecated(nullptr)
- , d_1_2_Deprecated(nullptr)
- , d_1_3_Deprecated(nullptr)
- , d_1_4_Deprecated(nullptr)
- , m_reserved_2_0_Deprecated(nullptr)
- , d_3_3_Deprecated(nullptr)
-{
-}
-
-QOpenGLFunctions_3_3_Compatibility::~QOpenGLFunctions_3_3_Compatibility()
-{
- if (d_1_0_Core) {
- d_1_0_Core->refs.deref();
- Q_ASSERT(d_1_0_Core->refs.loadRelaxed());
- }
- if (d_1_1_Core) {
- d_1_1_Core->refs.deref();
- Q_ASSERT(d_1_1_Core->refs.loadRelaxed());
- }
- if (d_1_2_Core) {
- d_1_2_Core->refs.deref();
- Q_ASSERT(d_1_2_Core->refs.loadRelaxed());
- }
- if (d_1_3_Core) {
- d_1_3_Core->refs.deref();
- Q_ASSERT(d_1_3_Core->refs.loadRelaxed());
- }
- if (d_1_4_Core) {
- d_1_4_Core->refs.deref();
- Q_ASSERT(d_1_4_Core->refs.loadRelaxed());
- }
- if (d_1_5_Core) {
- d_1_5_Core->refs.deref();
- Q_ASSERT(d_1_5_Core->refs.loadRelaxed());
- }
- if (d_2_0_Core) {
- d_2_0_Core->refs.deref();
- Q_ASSERT(d_2_0_Core->refs.loadRelaxed());
- }
- if (d_2_1_Core) {
- d_2_1_Core->refs.deref();
- Q_ASSERT(d_2_1_Core->refs.loadRelaxed());
- }
- if (d_3_0_Core) {
- d_3_0_Core->refs.deref();
- Q_ASSERT(d_3_0_Core->refs.loadRelaxed());
- }
- if (d_3_1_Core) {
- d_3_1_Core->refs.deref();
- Q_ASSERT(d_3_1_Core->refs.loadRelaxed());
- }
- if (d_3_2_Core) {
- d_3_2_Core->refs.deref();
- Q_ASSERT(d_3_2_Core->refs.loadRelaxed());
- }
- if (d_3_3_Core) {
- d_3_3_Core->refs.deref();
- Q_ASSERT(d_3_3_Core->refs.loadRelaxed());
- }
- if (d_1_0_Deprecated) {
- d_1_0_Deprecated->refs.deref();
- Q_ASSERT(d_1_0_Deprecated->refs.loadRelaxed());
- }
- if (d_1_1_Deprecated) {
- d_1_1_Deprecated->refs.deref();
- Q_ASSERT(d_1_1_Deprecated->refs.loadRelaxed());
- }
- if (d_1_2_Deprecated) {
- d_1_2_Deprecated->refs.deref();
- Q_ASSERT(d_1_2_Deprecated->refs.loadRelaxed());
- }
- if (d_1_3_Deprecated) {
- d_1_3_Deprecated->refs.deref();
- Q_ASSERT(d_1_3_Deprecated->refs.loadRelaxed());
- }
- if (d_1_4_Deprecated) {
- d_1_4_Deprecated->refs.deref();
- Q_ASSERT(d_1_4_Deprecated->refs.loadRelaxed());
- }
- if (d_3_3_Deprecated) {
- d_3_3_Deprecated->refs.deref();
- Q_ASSERT(d_3_3_Deprecated->refs.loadRelaxed());
- }
-}
-
-bool QOpenGLFunctions_3_3_Compatibility::initializeOpenGLFunctions()
-{
- if ( isInitialized() )
- return true;
-
- QOpenGLContext* context = QOpenGLContext::currentContext();
-
- // If owned by a context object make sure it is current.
- // Also check that current context is capable of resolving all needed functions
- if (((owningContext() && owningContext() == context) || !owningContext())
- && QOpenGLFunctions_3_3_Compatibility::isContextCompatible(context))
- {
- // Associate with private implementation, creating if necessary
- // Function pointers in the backends are resolved at creation time
- QOpenGLVersionFunctionsBackend* d = nullptr;
- d = QAbstractOpenGLFunctionsPrivate::functionsBackend(context, QOpenGLFunctions_1_0_CoreBackend::versionStatus());
- d_1_0_Core = static_cast<QOpenGLFunctions_1_0_CoreBackend*>(d);
- d->refs.ref();
-
- d = QAbstractOpenGLFunctionsPrivate::functionsBackend(context, QOpenGLFunctions_1_1_CoreBackend::versionStatus());
- d_1_1_Core = static_cast<QOpenGLFunctions_1_1_CoreBackend*>(d);
- d->refs.ref();
-
- d = QAbstractOpenGLFunctionsPrivate::functionsBackend(context, QOpenGLFunctions_1_2_CoreBackend::versionStatus());
- d_1_2_Core = static_cast<QOpenGLFunctions_1_2_CoreBackend*>(d);
- d->refs.ref();
-
- d = QAbstractOpenGLFunctionsPrivate::functionsBackend(context, QOpenGLFunctions_1_3_CoreBackend::versionStatus());
- d_1_3_Core = static_cast<QOpenGLFunctions_1_3_CoreBackend*>(d);
- d->refs.ref();
-
- d = QAbstractOpenGLFunctionsPrivate::functionsBackend(context, QOpenGLFunctions_1_4_CoreBackend::versionStatus());
- d_1_4_Core = static_cast<QOpenGLFunctions_1_4_CoreBackend*>(d);
- d->refs.ref();
-
- d = QAbstractOpenGLFunctionsPrivate::functionsBackend(context, QOpenGLFunctions_1_5_CoreBackend::versionStatus());
- d_1_5_Core = static_cast<QOpenGLFunctions_1_5_CoreBackend*>(d);
- d->refs.ref();
-
- d = QAbstractOpenGLFunctionsPrivate::functionsBackend(context, QOpenGLFunctions_2_0_CoreBackend::versionStatus());
- d_2_0_Core = static_cast<QOpenGLFunctions_2_0_CoreBackend*>(d);
- d->refs.ref();
-
- d = QAbstractOpenGLFunctionsPrivate::functionsBackend(context, QOpenGLFunctions_2_1_CoreBackend::versionStatus());
- d_2_1_Core = static_cast<QOpenGLFunctions_2_1_CoreBackend*>(d);
- d->refs.ref();
-
- d = QAbstractOpenGLFunctionsPrivate::functionsBackend(context, QOpenGLFunctions_3_0_CoreBackend::versionStatus());
- d_3_0_Core = static_cast<QOpenGLFunctions_3_0_CoreBackend*>(d);
- d->refs.ref();
-
- d = QAbstractOpenGLFunctionsPrivate::functionsBackend(context, QOpenGLFunctions_3_1_CoreBackend::versionStatus());
- d_3_1_Core = static_cast<QOpenGLFunctions_3_1_CoreBackend*>(d);
- d->refs.ref();
-
- d = QAbstractOpenGLFunctionsPrivate::functionsBackend(context, QOpenGLFunctions_3_2_CoreBackend::versionStatus());
- d_3_2_Core = static_cast<QOpenGLFunctions_3_2_CoreBackend*>(d);
- d->refs.ref();
-
- d = QAbstractOpenGLFunctionsPrivate::functionsBackend(context, QOpenGLFunctions_3_3_CoreBackend::versionStatus());
- d_3_3_Core = static_cast<QOpenGLFunctions_3_3_CoreBackend*>(d);
- d->refs.ref();
-
- d = QAbstractOpenGLFunctionsPrivate::functionsBackend(context, QOpenGLFunctions_1_0_DeprecatedBackend::versionStatus());
- d_1_0_Deprecated = static_cast<QOpenGLFunctions_1_0_DeprecatedBackend*>(d);
- d->refs.ref();
-
- d = QAbstractOpenGLFunctionsPrivate::functionsBackend(context, QOpenGLFunctions_1_1_DeprecatedBackend::versionStatus());
- d_1_1_Deprecated = static_cast<QOpenGLFunctions_1_1_DeprecatedBackend*>(d);
- d->refs.ref();
-
- d = QAbstractOpenGLFunctionsPrivate::functionsBackend(context, QOpenGLFunctions_1_2_DeprecatedBackend::versionStatus());
- d_1_2_Deprecated = static_cast<QOpenGLFunctions_1_2_DeprecatedBackend*>(d);
- d->refs.ref();
-
- d = QAbstractOpenGLFunctionsPrivate::functionsBackend(context, QOpenGLFunctions_1_3_DeprecatedBackend::versionStatus());
- d_1_3_Deprecated = static_cast<QOpenGLFunctions_1_3_DeprecatedBackend*>(d);
- d->refs.ref();
-
- d = QAbstractOpenGLFunctionsPrivate::functionsBackend(context, QOpenGLFunctions_1_4_DeprecatedBackend::versionStatus());
- d_1_4_Deprecated = static_cast<QOpenGLFunctions_1_4_DeprecatedBackend*>(d);
- d->refs.ref();
-
- d = QAbstractOpenGLFunctionsPrivate::functionsBackend(context, QOpenGLFunctions_3_3_DeprecatedBackend::versionStatus());
- d_3_3_Deprecated = static_cast<QOpenGLFunctions_3_3_DeprecatedBackend*>(d);
- d->refs.ref();
-
- QAbstractOpenGLFunctions::initializeOpenGLFunctions();
- }
- return isInitialized();
-}
-
-bool QOpenGLFunctions_3_3_Compatibility::isContextCompatible(QOpenGLContext *context)
-{
- Q_ASSERT(context);
- QSurfaceFormat f = context->format();
- const QPair<int, int> v = qMakePair(f.majorVersion(), f.minorVersion());
- if (v < qMakePair(3, 3))
- return false;
-
- if (f.profile() == QSurfaceFormat::CoreProfile)
- return false;
-
- return true;
-}
-
-QOpenGLVersionProfile QOpenGLFunctions_3_3_Compatibility::versionProfile()
-{
- QOpenGLVersionProfile v;
- v.setVersion(3, 3);
- v.setProfile(QSurfaceFormat::CompatibilityProfile);
- return v;
-}
-
-QT_END_NAMESPACE
diff --git a/src/gui/opengl/qopenglfunctions_3_3_compatibility.h b/src/gui/opengl/qopenglfunctions_3_3_compatibility.h
deleted file mode 100644
index 185dd5aab4..0000000000
--- a/src/gui/opengl/qopenglfunctions_3_3_compatibility.h
+++ /dev/null
@@ -1,4734 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2013 Klaralvdalens Datakonsult AB (KDAB)
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the QtGui module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-**
-** This file was generated by glgen version 0.1
-** Command line was: glgen
-**
-** glgen is Copyright (C) 2013 Klaralvdalens Datakonsult AB (KDAB)
-**
-** This is an auto-generated file.
-** Do not edit! All changes made to it will be lost.
-**
-****************************************************************************/
-
-#ifndef QOPENGLVERSIONFUNCTIONS_3_3_COMPATIBILITY_H
-#define QOPENGLVERSIONFUNCTIONS_3_3_COMPATIBILITY_H
-
-#include <QtGui/qtguiglobal.h>
-
-#if !defined(QT_NO_OPENGL) && !defined(QT_OPENGL_ES_2)
-
-#include <QtGui/QOpenGLVersionFunctions>
-#include <QtGui/qopenglcontext.h>
-
-QT_BEGIN_NAMESPACE
-
-class Q_GUI_EXPORT QOpenGLFunctions_3_3_Compatibility : public QAbstractOpenGLFunctions
-{
-public:
- QOpenGLFunctions_3_3_Compatibility();
- ~QOpenGLFunctions_3_3_Compatibility();
-
- bool initializeOpenGLFunctions() override;
-
- // OpenGL 1.0 core functions
- void glViewport(GLint x, GLint y, GLsizei width, GLsizei height);
- void glDepthRange(GLdouble nearVal, GLdouble farVal);
- GLboolean glIsEnabled(GLenum cap);
- void glGetTexLevelParameteriv(GLenum target, GLint level, GLenum pname, GLint *params);
- void glGetTexLevelParameterfv(GLenum target, GLint level, GLenum pname, GLfloat *params);
- void glGetTexParameteriv(GLenum target, GLenum pname, GLint *params);
- void glGetTexParameterfv(GLenum target, GLenum pname, GLfloat *params);
- void glGetTexImage(GLenum target, GLint level, GLenum format, GLenum type, GLvoid *pixels);
- const GLubyte * glGetString(GLenum name);
- void glGetIntegerv(GLenum pname, GLint *params);
- void glGetFloatv(GLenum pname, GLfloat *params);
- GLenum glGetError();
- void glGetDoublev(GLenum pname, GLdouble *params);
- void glGetBooleanv(GLenum pname, GLboolean *params);
- void glReadPixels(GLint x, GLint y, GLsizei width, GLsizei height, GLenum format, GLenum type, GLvoid *pixels);
- void glReadBuffer(GLenum mode);
- void glPixelStorei(GLenum pname, GLint param);
- void glPixelStoref(GLenum pname, GLfloat param);
- void glDepthFunc(GLenum func);
- void glStencilOp(GLenum fail, GLenum zfail, GLenum zpass);
- void glStencilFunc(GLenum func, GLint ref, GLuint mask);
- void glLogicOp(GLenum opcode);
- void glBlendFunc(GLenum sfactor, GLenum dfactor);
- void glFlush();
- void glFinish();
- void glEnable(GLenum cap);
- void glDisable(GLenum cap);
- void glDepthMask(GLboolean flag);
- void glColorMask(GLboolean red, GLboolean green, GLboolean blue, GLboolean alpha);
- void glStencilMask(GLuint mask);
- void glClearDepth(GLdouble depth);
- void glClearStencil(GLint s);
- void glClearColor(GLfloat red, GLfloat green, GLfloat blue, GLfloat alpha);
- void glClear(GLbitfield mask);
- void glDrawBuffer(GLenum mode);
- void glTexImage2D(GLenum target, GLint level, GLint internalformat, GLsizei width, GLsizei height, GLint border, GLenum format, GLenum type, const GLvoid *pixels);
- void glTexImage1D(GLenum target, GLint level, GLint internalformat, GLsizei width, GLint border, GLenum format, GLenum type, const GLvoid *pixels);
- void glTexParameteriv(GLenum target, GLenum pname, const GLint *params);
- void glTexParameteri(GLenum target, GLenum pname, GLint param);
- void glTexParameterfv(GLenum target, GLenum pname, const GLfloat *params);
- void glTexParameterf(GLenum target, GLenum pname, GLfloat param);
- void glScissor(GLint x, GLint y, GLsizei width, GLsizei height);
- void glPolygonMode(GLenum face, GLenum mode);
- void glPointSize(GLfloat size);
- void glLineWidth(GLfloat width);
- void glHint(GLenum target, GLenum mode);
- void glFrontFace(GLenum mode);
- void glCullFace(GLenum mode);
-
- // OpenGL 1.1 core functions
- void glIndexubv(const GLubyte *c);
- void glIndexub(GLubyte c);
- GLboolean glIsTexture(GLuint texture);
- void glGenTextures(GLsizei n, GLuint *textures);
- void glDeleteTextures(GLsizei n, const GLuint *textures);
- void glBindTexture(GLenum target, GLuint texture);
- void glTexSubImage2D(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLenum type, const GLvoid *pixels);
- void glTexSubImage1D(GLenum target, GLint level, GLint xoffset, GLsizei width, GLenum format, GLenum type, const GLvoid *pixels);
- void glCopyTexSubImage2D(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint x, GLint y, GLsizei width, GLsizei height);
- void glCopyTexSubImage1D(GLenum target, GLint level, GLint xoffset, GLint x, GLint y, GLsizei width);
- void glCopyTexImage2D(GLenum target, GLint level, GLenum internalformat, GLint x, GLint y, GLsizei width, GLsizei height, GLint border);
- void glCopyTexImage1D(GLenum target, GLint level, GLenum internalformat, GLint x, GLint y, GLsizei width, GLint border);
- void glPolygonOffset(GLfloat factor, GLfloat units);
- void glGetPointerv(GLenum pname, GLvoid* *params);
- void glDrawElements(GLenum mode, GLsizei count, GLenum type, const GLvoid *indices);
- void glDrawArrays(GLenum mode, GLint first, GLsizei count);
-
- // OpenGL 1.2 core functions
- void glCopyTexSubImage3D(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLint x, GLint y, GLsizei width, GLsizei height);
- void glTexSubImage3D(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLenum type, const GLvoid *pixels);
- void glTexImage3D(GLenum target, GLint level, GLint internalformat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLenum format, GLenum type, const GLvoid *pixels);
- void glDrawRangeElements(GLenum mode, GLuint start, GLuint end, GLsizei count, GLenum type, const GLvoid *indices);
- void glBlendEquation(GLenum mode);
- void glBlendColor(GLfloat red, GLfloat green, GLfloat blue, GLfloat alpha);
-
- // OpenGL 1.3 core functions
- void glGetCompressedTexImage(GLenum target, GLint level, GLvoid *img);
- void glCompressedTexSubImage1D(GLenum target, GLint level, GLint xoffset, GLsizei width, GLenum format, GLsizei imageSize, const GLvoid *data);
- void glCompressedTexSubImage2D(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLsizei imageSize, const GLvoid *data);
- void glCompressedTexSubImage3D(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLsizei imageSize, const GLvoid *data);
- void glCompressedTexImage1D(GLenum target, GLint level, GLenum internalformat, GLsizei width, GLint border, GLsizei imageSize, const GLvoid *data);
- void glCompressedTexImage2D(GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLint border, GLsizei imageSize, const GLvoid *data);
- void glCompressedTexImage3D(GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLsizei imageSize, const GLvoid *data);
- void glSampleCoverage(GLfloat value, GLboolean invert);
- void glActiveTexture(GLenum texture);
-
- // OpenGL 1.4 core functions
- void glPointParameteriv(GLenum pname, const GLint *params);
- void glPointParameteri(GLenum pname, GLint param);
- void glPointParameterfv(GLenum pname, const GLfloat *params);
- void glPointParameterf(GLenum pname, GLfloat param);
- void glMultiDrawElements(GLenum mode, const GLsizei *count, GLenum type, const GLvoid* const *indices, GLsizei drawcount);
- void glMultiDrawArrays(GLenum mode, const GLint *first, const GLsizei *count, GLsizei drawcount);
- void glBlendFuncSeparate(GLenum sfactorRGB, GLenum dfactorRGB, GLenum sfactorAlpha, GLenum dfactorAlpha);
-
- // OpenGL 1.5 core functions
- void glGetBufferPointerv(GLenum target, GLenum pname, GLvoid* *params);
- void glGetBufferParameteriv(GLenum target, GLenum pname, GLint *params);
- GLboolean glUnmapBuffer(GLenum target);
- GLvoid* glMapBuffer(GLenum target, GLenum access);
- void glGetBufferSubData(GLenum target, GLintptr offset, GLsizeiptr size, GLvoid *data);
- void glBufferSubData(GLenum target, GLintptr offset, GLsizeiptr size, const GLvoid *data);
- void glBufferData(GLenum target, GLsizeiptr size, const GLvoid *data, GLenum usage);
- GLboolean glIsBuffer(GLuint buffer);
- void glGenBuffers(GLsizei n, GLuint *buffers);
- void glDeleteBuffers(GLsizei n, const GLuint *buffers);
- void glBindBuffer(GLenum target, GLuint buffer);
- void glGetQueryObjectuiv(GLuint id, GLenum pname, GLuint *params);
- void glGetQueryObjectiv(GLuint id, GLenum pname, GLint *params);
- void glGetQueryiv(GLenum target, GLenum pname, GLint *params);
- void glEndQuery(GLenum target);
- void glBeginQuery(GLenum target, GLuint id);
- GLboolean glIsQuery(GLuint id);
- void glDeleteQueries(GLsizei n, const GLuint *ids);
- void glGenQueries(GLsizei n, GLuint *ids);
-
- // OpenGL 2.0 core functions
- void glVertexAttribPointer(GLuint index, GLint size, GLenum type, GLboolean normalized, GLsizei stride, const GLvoid *pointer);
- void glValidateProgram(GLuint program);
- void glUniformMatrix4fv(GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
- void glUniformMatrix3fv(GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
- void glUniformMatrix2fv(GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
- void glUniform4iv(GLint location, GLsizei count, const GLint *value);
- void glUniform3iv(GLint location, GLsizei count, const GLint *value);
- void glUniform2iv(GLint location, GLsizei count, const GLint *value);
- void glUniform1iv(GLint location, GLsizei count, const GLint *value);
- void glUniform4fv(GLint location, GLsizei count, const GLfloat *value);
- void glUniform3fv(GLint location, GLsizei count, const GLfloat *value);
- void glUniform2fv(GLint location, GLsizei count, const GLfloat *value);
- void glUniform1fv(GLint location, GLsizei count, const GLfloat *value);
- void glUniform4i(GLint location, GLint v0, GLint v1, GLint v2, GLint v3);
- void glUniform3i(GLint location, GLint v0, GLint v1, GLint v2);
- void glUniform2i(GLint location, GLint v0, GLint v1);
- void glUniform1i(GLint location, GLint v0);
- void glUniform4f(GLint location, GLfloat v0, GLfloat v1, GLfloat v2, GLfloat v3);
- void glUniform3f(GLint location, GLfloat v0, GLfloat v1, GLfloat v2);
- void glUniform2f(GLint location, GLfloat v0, GLfloat v1);
- void glUniform1f(GLint location, GLfloat v0);
- void glUseProgram(GLuint program);
- void glShaderSource(GLuint shader, GLsizei count, const GLchar* const *string, const GLint *length);
- void glLinkProgram(GLuint program);
- GLboolean glIsShader(GLuint shader);
- GLboolean glIsProgram(GLuint program);
- void glGetVertexAttribPointerv(GLuint index, GLenum pname, GLvoid* *pointer);
- void glGetVertexAttribiv(GLuint index, GLenum pname, GLint *params);
- void glGetVertexAttribfv(GLuint index, GLenum pname, GLfloat *params);
- void glGetVertexAttribdv(GLuint index, GLenum pname, GLdouble *params);
- void glGetUniformiv(GLuint program, GLint location, GLint *params);
- void glGetUniformfv(GLuint program, GLint location, GLfloat *params);
- GLint glGetUniformLocation(GLuint program, const GLchar *name);
- void glGetShaderSource(GLuint shader, GLsizei bufSize, GLsizei *length, GLchar *source);
- void glGetShaderInfoLog(GLuint shader, GLsizei bufSize, GLsizei *length, GLchar *infoLog);
- void glGetShaderiv(GLuint shader, GLenum pname, GLint *params);
- void glGetProgramInfoLog(GLuint program, GLsizei bufSize, GLsizei *length, GLchar *infoLog);
- void glGetProgramiv(GLuint program, GLenum pname, GLint *params);
- GLint glGetAttribLocation(GLuint program, const GLchar *name);
- void glGetAttachedShaders(GLuint program, GLsizei maxCount, GLsizei *count, GLuint *obj);
- void glGetActiveUniform(GLuint program, GLuint index, GLsizei bufSize, GLsizei *length, GLint *size, GLenum *type, GLchar *name);
- void glGetActiveAttrib(GLuint program, GLuint index, GLsizei bufSize, GLsizei *length, GLint *size, GLenum *type, GLchar *name);
- void glEnableVertexAttribArray(GLuint index);
- void glDisableVertexAttribArray(GLuint index);
- void glDetachShader(GLuint program, GLuint shader);
- void glDeleteShader(GLuint shader);
- void glDeleteProgram(GLuint program);
- GLuint glCreateShader(GLenum type);
- GLuint glCreateProgram();
- void glCompileShader(GLuint shader);
- void glBindAttribLocation(GLuint program, GLuint index, const GLchar *name);
- void glAttachShader(GLuint program, GLuint shader);
- void glStencilMaskSeparate(GLenum face, GLuint mask);
- void glStencilFuncSeparate(GLenum face, GLenum func, GLint ref, GLuint mask);
- void glStencilOpSeparate(GLenum face, GLenum sfail, GLenum dpfail, GLenum dppass);
- void glDrawBuffers(GLsizei n, const GLenum *bufs);
- void glBlendEquationSeparate(GLenum modeRGB, GLenum modeAlpha);
-
- // OpenGL 2.1 core functions
- void glUniformMatrix4x3fv(GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
- void glUniformMatrix3x4fv(GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
- void glUniformMatrix4x2fv(GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
- void glUniformMatrix2x4fv(GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
- void glUniformMatrix3x2fv(GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
- void glUniformMatrix2x3fv(GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
-
- // OpenGL 3.0 core functions
- GLboolean glIsVertexArray(GLuint array);
- void glGenVertexArrays(GLsizei n, GLuint *arrays);
- void glDeleteVertexArrays(GLsizei n, const GLuint *arrays);
- void glBindVertexArray(GLuint array);
- void glFlushMappedBufferRange(GLenum target, GLintptr offset, GLsizeiptr length);
- GLvoid* glMapBufferRange(GLenum target, GLintptr offset, GLsizeiptr length, GLbitfield access);
- void glFramebufferTextureLayer(GLenum target, GLenum attachment, GLuint texture, GLint level, GLint layer);
- void glRenderbufferStorageMultisample(GLenum target, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height);
- void glBlitFramebuffer(GLint srcX0, GLint srcY0, GLint srcX1, GLint srcY1, GLint dstX0, GLint dstY0, GLint dstX1, GLint dstY1, GLbitfield mask, GLenum filter);
- void glGenerateMipmap(GLenum target);
- void glGetFramebufferAttachmentParameteriv(GLenum target, GLenum attachment, GLenum pname, GLint *params);
- void glFramebufferRenderbuffer(GLenum target, GLenum attachment, GLenum renderbuffertarget, GLuint renderbuffer);
- void glFramebufferTexture3D(GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level, GLint zoffset);
- void glFramebufferTexture2D(GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level);
- void glFramebufferTexture1D(GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level);
- GLenum glCheckFramebufferStatus(GLenum target);
- void glGenFramebuffers(GLsizei n, GLuint *framebuffers);
- void glDeleteFramebuffers(GLsizei n, const GLuint *framebuffers);
- void glBindFramebuffer(GLenum target, GLuint framebuffer);
- GLboolean glIsFramebuffer(GLuint framebuffer);
- void glGetRenderbufferParameteriv(GLenum target, GLenum pname, GLint *params);
- void glRenderbufferStorage(GLenum target, GLenum internalformat, GLsizei width, GLsizei height);
- void glGenRenderbuffers(GLsizei n, GLuint *renderbuffers);
- void glDeleteRenderbuffers(GLsizei n, const GLuint *renderbuffers);
- void glBindRenderbuffer(GLenum target, GLuint renderbuffer);
- GLboolean glIsRenderbuffer(GLuint renderbuffer);
- const GLubyte * glGetStringi(GLenum name, GLuint index);
- void glClearBufferfi(GLenum buffer, GLint drawbuffer, GLfloat depth, GLint stencil);
- void glClearBufferfv(GLenum buffer, GLint drawbuffer, const GLfloat *value);
- void glClearBufferuiv(GLenum buffer, GLint drawbuffer, const GLuint *value);
- void glClearBufferiv(GLenum buffer, GLint drawbuffer, const GLint *value);
- void glGetTexParameterIuiv(GLenum target, GLenum pname, GLuint *params);
- void glGetTexParameterIiv(GLenum target, GLenum pname, GLint *params);
- void glTexParameterIuiv(GLenum target, GLenum pname, const GLuint *params);
- void glTexParameterIiv(GLenum target, GLenum pname, const GLint *params);
- void glUniform4uiv(GLint location, GLsizei count, const GLuint *value);
- void glUniform3uiv(GLint location, GLsizei count, const GLuint *value);
- void glUniform2uiv(GLint location, GLsizei count, const GLuint *value);
- void glUniform1uiv(GLint location, GLsizei count, const GLuint *value);
- void glUniform4ui(GLint location, GLuint v0, GLuint v1, GLuint v2, GLuint v3);
- void glUniform3ui(GLint location, GLuint v0, GLuint v1, GLuint v2);
- void glUniform2ui(GLint location, GLuint v0, GLuint v1);
- void glUniform1ui(GLint location, GLuint v0);
- GLint glGetFragDataLocation(GLuint program, const GLchar *name);
- void glBindFragDataLocation(GLuint program, GLuint color, const GLchar *name);
- void glGetUniformuiv(GLuint program, GLint location, GLuint *params);
- void glGetVertexAttribIuiv(GLuint index, GLenum pname, GLuint *params);
- void glGetVertexAttribIiv(GLuint index, GLenum pname, GLint *params);
- void glVertexAttribIPointer(GLuint index, GLint size, GLenum type, GLsizei stride, const GLvoid *pointer);
- void glEndConditionalRender();
- void glBeginConditionalRender(GLuint id, GLenum mode);
- void glClampColor(GLenum target, GLenum clamp);
- void glGetTransformFeedbackVarying(GLuint program, GLuint index, GLsizei bufSize, GLsizei *length, GLsizei *size, GLenum *type, GLchar *name);
- void glTransformFeedbackVaryings(GLuint program, GLsizei count, const GLchar* const *varyings, GLenum bufferMode);
- void glBindBufferBase(GLenum target, GLuint index, GLuint buffer);
- void glBindBufferRange(GLenum target, GLuint index, GLuint buffer, GLintptr offset, GLsizeiptr size);
- void glEndTransformFeedback();
- void glBeginTransformFeedback(GLenum primitiveMode);
- GLboolean glIsEnabledi(GLenum target, GLuint index);
- void glDisablei(GLenum target, GLuint index);
- void glEnablei(GLenum target, GLuint index);
- void glGetIntegeri_v(GLenum target, GLuint index, GLint *data);
- void glGetBooleani_v(GLenum target, GLuint index, GLboolean *data);
- void glColorMaski(GLuint index, GLboolean r, GLboolean g, GLboolean b, GLboolean a);
-
- // OpenGL 3.1 core functions
- void glCopyBufferSubData(GLenum readTarget, GLenum writeTarget, GLintptr readOffset, GLintptr writeOffset, GLsizeiptr size);
- void glUniformBlockBinding(GLuint program, GLuint uniformBlockIndex, GLuint uniformBlockBinding);
- void glGetActiveUniformBlockName(GLuint program, GLuint uniformBlockIndex, GLsizei bufSize, GLsizei *length, GLchar *uniformBlockName);
- void glGetActiveUniformBlockiv(GLuint program, GLuint uniformBlockIndex, GLenum pname, GLint *params);
- GLuint glGetUniformBlockIndex(GLuint program, const GLchar *uniformBlockName);
- void glGetActiveUniformName(GLuint program, GLuint uniformIndex, GLsizei bufSize, GLsizei *length, GLchar *uniformName);
- void glGetActiveUniformsiv(GLuint program, GLsizei uniformCount, const GLuint *uniformIndices, GLenum pname, GLint *params);
- void glGetUniformIndices(GLuint program, GLsizei uniformCount, const GLchar* const *uniformNames, GLuint *uniformIndices);
- void glPrimitiveRestartIndex(GLuint index);
- void glTexBuffer(GLenum target, GLenum internalformat, GLuint buffer);
- void glDrawElementsInstanced(GLenum mode, GLsizei count, GLenum type, const GLvoid *indices, GLsizei instancecount);
- void glDrawArraysInstanced(GLenum mode, GLint first, GLsizei count, GLsizei instancecount);
-
- // OpenGL 3.2 core functions
- void glSampleMaski(GLuint index, GLbitfield mask);
- void glGetMultisamplefv(GLenum pname, GLuint index, GLfloat *val);
- void glTexImage3DMultisample(GLenum target, GLsizei samples, GLint internalformat, GLsizei width, GLsizei height, GLsizei depth, GLboolean fixedsamplelocations);
- void glTexImage2DMultisample(GLenum target, GLsizei samples, GLint internalformat, GLsizei width, GLsizei height, GLboolean fixedsamplelocations);
- void glGetSynciv(GLsync sync, GLenum pname, GLsizei bufSize, GLsizei *length, GLint *values);
- void glGetInteger64v(GLenum pname, GLint64 *params);
- void glWaitSync(GLsync sync, GLbitfield flags, GLuint64 timeout);
- GLenum glClientWaitSync(GLsync sync, GLbitfield flags, GLuint64 timeout);
- void glDeleteSync(GLsync sync);
- GLboolean glIsSync(GLsync sync);
- GLsync glFenceSync(GLenum condition, GLbitfield flags);
- void glProvokingVertex(GLenum mode);
- void glMultiDrawElementsBaseVertex(GLenum mode, const GLsizei *count, GLenum type, const GLvoid* const *indices, GLsizei drawcount, const GLint *basevertex);
- void glDrawElementsInstancedBaseVertex(GLenum mode, GLsizei count, GLenum type, const GLvoid *indices, GLsizei instancecount, GLint basevertex);
- void glDrawRangeElementsBaseVertex(GLenum mode, GLuint start, GLuint end, GLsizei count, GLenum type, const GLvoid *indices, GLint basevertex);
- void glDrawElementsBaseVertex(GLenum mode, GLsizei count, GLenum type, const GLvoid *indices, GLint basevertex);
- void glFramebufferTexture(GLenum target, GLenum attachment, GLuint texture, GLint level);
- void glGetBufferParameteri64v(GLenum target, GLenum pname, GLint64 *params);
- void glGetInteger64i_v(GLenum target, GLuint index, GLint64 *data);
-
- // OpenGL 3.3 core functions
- void glVertexAttribP4uiv(GLuint index, GLenum type, GLboolean normalized, const GLuint *value);
- void glVertexAttribP4ui(GLuint index, GLenum type, GLboolean normalized, GLuint value);
- void glVertexAttribP3uiv(GLuint index, GLenum type, GLboolean normalized, const GLuint *value);
- void glVertexAttribP3ui(GLuint index, GLenum type, GLboolean normalized, GLuint value);
- void glVertexAttribP2uiv(GLuint index, GLenum type, GLboolean normalized, const GLuint *value);
- void glVertexAttribP2ui(GLuint index, GLenum type, GLboolean normalized, GLuint value);
- void glVertexAttribP1uiv(GLuint index, GLenum type, GLboolean normalized, const GLuint *value);
- void glVertexAttribP1ui(GLuint index, GLenum type, GLboolean normalized, GLuint value);
- void glSecondaryColorP3uiv(GLenum type, const GLuint *color);
- void glSecondaryColorP3ui(GLenum type, GLuint color);
- void glColorP4uiv(GLenum type, const GLuint *color);
- void glColorP4ui(GLenum type, GLuint color);
- void glColorP3uiv(GLenum type, const GLuint *color);
- void glColorP3ui(GLenum type, GLuint color);
- void glNormalP3uiv(GLenum type, const GLuint *coords);
- void glNormalP3ui(GLenum type, GLuint coords);
- void glMultiTexCoordP4uiv(GLenum texture, GLenum type, const GLuint *coords);
- void glMultiTexCoordP4ui(GLenum texture, GLenum type, GLuint coords);
- void glMultiTexCoordP3uiv(GLenum texture, GLenum type, const GLuint *coords);
- void glMultiTexCoordP3ui(GLenum texture, GLenum type, GLuint coords);
- void glMultiTexCoordP2uiv(GLenum texture, GLenum type, const GLuint *coords);
- void glMultiTexCoordP2ui(GLenum texture, GLenum type, GLuint coords);
- void glMultiTexCoordP1uiv(GLenum texture, GLenum type, const GLuint *coords);
- void glMultiTexCoordP1ui(GLenum texture, GLenum type, GLuint coords);
- void glTexCoordP4uiv(GLenum type, const GLuint *coords);
- void glTexCoordP4ui(GLenum type, GLuint coords);
- void glTexCoordP3uiv(GLenum type, const GLuint *coords);
- void glTexCoordP3ui(GLenum type, GLuint coords);
- void glTexCoordP2uiv(GLenum type, const GLuint *coords);
- void glTexCoordP2ui(GLenum type, GLuint coords);
- void glTexCoordP1uiv(GLenum type, const GLuint *coords);
- void glTexCoordP1ui(GLenum type, GLuint coords);
- void glVertexP4uiv(GLenum type, const GLuint *value);
- void glVertexP4ui(GLenum type, GLuint value);
- void glVertexP3uiv(GLenum type, const GLuint *value);
- void glVertexP3ui(GLenum type, GLuint value);
- void glVertexP2uiv(GLenum type, const GLuint *value);
- void glVertexP2ui(GLenum type, GLuint value);
- void glGetQueryObjectui64v(GLuint id, GLenum pname, GLuint64 *params);
- void glGetQueryObjecti64v(GLuint id, GLenum pname, GLint64 *params);
- void glQueryCounter(GLuint id, GLenum target);
- void glGetSamplerParameterIuiv(GLuint sampler, GLenum pname, GLuint *params);
- void glGetSamplerParameterfv(GLuint sampler, GLenum pname, GLfloat *params);
- void glGetSamplerParameterIiv(GLuint sampler, GLenum pname, GLint *params);
- void glGetSamplerParameteriv(GLuint sampler, GLenum pname, GLint *params);
- void glSamplerParameterIuiv(GLuint sampler, GLenum pname, const GLuint *param);
- void glSamplerParameterIiv(GLuint sampler, GLenum pname, const GLint *param);
- void glSamplerParameterfv(GLuint sampler, GLenum pname, const GLfloat *param);
- void glSamplerParameterf(GLuint sampler, GLenum pname, GLfloat param);
- void glSamplerParameteriv(GLuint sampler, GLenum pname, const GLint *param);
- void glSamplerParameteri(GLuint sampler, GLenum pname, GLint param);
- void glBindSampler(GLuint unit, GLuint sampler);
- GLboolean glIsSampler(GLuint sampler);
- void glDeleteSamplers(GLsizei count, const GLuint *samplers);
- void glGenSamplers(GLsizei count, GLuint *samplers);
- GLint glGetFragDataIndex(GLuint program, const GLchar *name);
- void glBindFragDataLocationIndexed(GLuint program, GLuint colorNumber, GLuint index, const GLchar *name);
- void glVertexAttribDivisor(GLuint index, GLuint divisor);
-
- // OpenGL 1.0 deprecated functions
- void glTranslatef(GLfloat x, GLfloat y, GLfloat z);
- void glTranslated(GLdouble x, GLdouble y, GLdouble z);
- void glScalef(GLfloat x, GLfloat y, GLfloat z);
- void glScaled(GLdouble x, GLdouble y, GLdouble z);
- void glRotatef(GLfloat angle, GLfloat x, GLfloat y, GLfloat z);
- void glRotated(GLdouble angle, GLdouble x, GLdouble y, GLdouble z);
- void glPushMatrix();
- void glPopMatrix();
- void glOrtho(GLdouble left, GLdouble right, GLdouble bottom, GLdouble top, GLdouble zNear, GLdouble zFar);
- void glMultMatrixd(const GLdouble *m);
- void glMultMatrixf(const GLfloat *m);
- void glMatrixMode(GLenum mode);
- void glLoadMatrixd(const GLdouble *m);
- void glLoadMatrixf(const GLfloat *m);
- void glLoadIdentity();
- void glFrustum(GLdouble left, GLdouble right, GLdouble bottom, GLdouble top, GLdouble zNear, GLdouble zFar);
- GLboolean glIsList(GLuint list);
- void glGetTexGeniv(GLenum coord, GLenum pname, GLint *params);
- void glGetTexGenfv(GLenum coord, GLenum pname, GLfloat *params);
- void glGetTexGendv(GLenum coord, GLenum pname, GLdouble *params);
- void glGetTexEnviv(GLenum target, GLenum pname, GLint *params);
- void glGetTexEnvfv(GLenum target, GLenum pname, GLfloat *params);
- void glGetPolygonStipple(GLubyte *mask);
- void glGetPixelMapusv(GLenum map, GLushort *values);
- void glGetPixelMapuiv(GLenum map, GLuint *values);
- void glGetPixelMapfv(GLenum map, GLfloat *values);
- void glGetMaterialiv(GLenum face, GLenum pname, GLint *params);
- void glGetMaterialfv(GLenum face, GLenum pname, GLfloat *params);
- void glGetMapiv(GLenum target, GLenum query, GLint *v);
- void glGetMapfv(GLenum target, GLenum query, GLfloat *v);
- void glGetMapdv(GLenum target, GLenum query, GLdouble *v);
- void glGetLightiv(GLenum light, GLenum pname, GLint *params);
- void glGetLightfv(GLenum light, GLenum pname, GLfloat *params);
- void glGetClipPlane(GLenum plane, GLdouble *equation);
- void glDrawPixels(GLsizei width, GLsizei height, GLenum format, GLenum type, const GLvoid *pixels);
- void glCopyPixels(GLint x, GLint y, GLsizei width, GLsizei height, GLenum type);
- void glPixelMapusv(GLenum map, GLint mapsize, const GLushort *values);
- void glPixelMapuiv(GLenum map, GLint mapsize, const GLuint *values);
- void glPixelMapfv(GLenum map, GLint mapsize, const GLfloat *values);
- void glPixelTransferi(GLenum pname, GLint param);
- void glPixelTransferf(GLenum pname, GLfloat param);
- void glPixelZoom(GLfloat xfactor, GLfloat yfactor);
- void glAlphaFunc(GLenum func, GLfloat ref);
- void glEvalPoint2(GLint i, GLint j);
- void glEvalMesh2(GLenum mode, GLint i1, GLint i2, GLint j1, GLint j2);
- void glEvalPoint1(GLint i);
- void glEvalMesh1(GLenum mode, GLint i1, GLint i2);
- void glEvalCoord2fv(const GLfloat *u);
- void glEvalCoord2f(GLfloat u, GLfloat v);
- void glEvalCoord2dv(const GLdouble *u);
- void glEvalCoord2d(GLdouble u, GLdouble v);
- void glEvalCoord1fv(const GLfloat *u);
- void glEvalCoord1f(GLfloat u);
- void glEvalCoord1dv(const GLdouble *u);
- void glEvalCoord1d(GLdouble u);
- void glMapGrid2f(GLint un, GLfloat u1, GLfloat u2, GLint vn, GLfloat v1, GLfloat v2);
- void glMapGrid2d(GLint un, GLdouble u1, GLdouble u2, GLint vn, GLdouble v1, GLdouble v2);
- void glMapGrid1f(GLint un, GLfloat u1, GLfloat u2);
- void glMapGrid1d(GLint un, GLdouble u1, GLdouble u2);
- void glMap2f(GLenum target, GLfloat u1, GLfloat u2, GLint ustride, GLint uorder, GLfloat v1, GLfloat v2, GLint vstride, GLint vorder, const GLfloat *points);
- void glMap2d(GLenum target, GLdouble u1, GLdouble u2, GLint ustride, GLint uorder, GLdouble v1, GLdouble v2, GLint vstride, GLint vorder, const GLdouble *points);
- void glMap1f(GLenum target, GLfloat u1, GLfloat u2, GLint stride, GLint order, const GLfloat *points);
- void glMap1d(GLenum target, GLdouble u1, GLdouble u2, GLint stride, GLint order, const GLdouble *points);
- void glPushAttrib(GLbitfield mask);
- void glPopAttrib();
- void glAccum(GLenum op, GLfloat value);
- void glIndexMask(GLuint mask);
- void glClearIndex(GLfloat c);
- void glClearAccum(GLfloat red, GLfloat green, GLfloat blue, GLfloat alpha);
- void glPushName(GLuint name);
- void glPopName();
- void glPassThrough(GLfloat token);
- void glLoadName(GLuint name);
- void glInitNames();
- GLint glRenderMode(GLenum mode);
- void glSelectBuffer(GLsizei size, GLuint *buffer);
- void glFeedbackBuffer(GLsizei size, GLenum type, GLfloat *buffer);
- void glTexGeniv(GLenum coord, GLenum pname, const GLint *params);
- void glTexGeni(GLenum coord, GLenum pname, GLint param);
- void glTexGenfv(GLenum coord, GLenum pname, const GLfloat *params);
- void glTexGenf(GLenum coord, GLenum pname, GLfloat param);
- void glTexGendv(GLenum coord, GLenum pname, const GLdouble *params);
- void glTexGend(GLenum coord, GLenum pname, GLdouble param);
- void glTexEnviv(GLenum target, GLenum pname, const GLint *params);
- void glTexEnvi(GLenum target, GLenum pname, GLint param);
- void glTexEnvfv(GLenum target, GLenum pname, const GLfloat *params);
- void glTexEnvf(GLenum target, GLenum pname, GLfloat param);
- void glShadeModel(GLenum mode);
- void glPolygonStipple(const GLubyte *mask);
- void glMaterialiv(GLenum face, GLenum pname, const GLint *params);
- void glMateriali(GLenum face, GLenum pname, GLint param);
- void glMaterialfv(GLenum face, GLenum pname, const GLfloat *params);
- void glMaterialf(GLenum face, GLenum pname, GLfloat param);
- void glLineStipple(GLint factor, GLushort pattern);
- void glLightModeliv(GLenum pname, const GLint *params);
- void glLightModeli(GLenum pname, GLint param);
- void glLightModelfv(GLenum pname, const GLfloat *params);
- void glLightModelf(GLenum pname, GLfloat param);
- void glLightiv(GLenum light, GLenum pname, const GLint *params);
- void glLighti(GLenum light, GLenum pname, GLint param);
- void glLightfv(GLenum light, GLenum pname, const GLfloat *params);
- void glLightf(GLenum light, GLenum pname, GLfloat param);
- void glFogiv(GLenum pname, const GLint *params);
- void glFogi(GLenum pname, GLint param);
- void glFogfv(GLenum pname, const GLfloat *params);
- void glFogf(GLenum pname, GLfloat param);
- void glColorMaterial(GLenum face, GLenum mode);
- void glClipPlane(GLenum plane, const GLdouble *equation);
- void glVertex4sv(const GLshort *v);
- void glVertex4s(GLshort x, GLshort y, GLshort z, GLshort w);
- void glVertex4iv(const GLint *v);
- void glVertex4i(GLint x, GLint y, GLint z, GLint w);
- void glVertex4fv(const GLfloat *v);
- void glVertex4f(GLfloat x, GLfloat y, GLfloat z, GLfloat w);
- void glVertex4dv(const GLdouble *v);
- void glVertex4d(GLdouble x, GLdouble y, GLdouble z, GLdouble w);
- void glVertex3sv(const GLshort *v);
- void glVertex3s(GLshort x, GLshort y, GLshort z);
- void glVertex3iv(const GLint *v);
- void glVertex3i(GLint x, GLint y, GLint z);
- void glVertex3fv(const GLfloat *v);
- void glVertex3f(GLfloat x, GLfloat y, GLfloat z);
- void glVertex3dv(const GLdouble *v);
- void glVertex3d(GLdouble x, GLdouble y, GLdouble z);
- void glVertex2sv(const GLshort *v);
- void glVertex2s(GLshort x, GLshort y);
- void glVertex2iv(const GLint *v);
- void glVertex2i(GLint x, GLint y);
- void glVertex2fv(const GLfloat *v);
- void glVertex2f(GLfloat x, GLfloat y);
- void glVertex2dv(const GLdouble *v);
- void glVertex2d(GLdouble x, GLdouble y);
- void glTexCoord4sv(const GLshort *v);
- void glTexCoord4s(GLshort s, GLshort t, GLshort r, GLshort q);
- void glTexCoord4iv(const GLint *v);
- void glTexCoord4i(GLint s, GLint t, GLint r, GLint q);
- void glTexCoord4fv(const GLfloat *v);
- void glTexCoord4f(GLfloat s, GLfloat t, GLfloat r, GLfloat q);
- void glTexCoord4dv(const GLdouble *v);
- void glTexCoord4d(GLdouble s, GLdouble t, GLdouble r, GLdouble q);
- void glTexCoord3sv(const GLshort *v);
- void glTexCoord3s(GLshort s, GLshort t, GLshort r);
- void glTexCoord3iv(const GLint *v);
- void glTexCoord3i(GLint s, GLint t, GLint r);
- void glTexCoord3fv(const GLfloat *v);
- void glTexCoord3f(GLfloat s, GLfloat t, GLfloat r);
- void glTexCoord3dv(const GLdouble *v);
- void glTexCoord3d(GLdouble s, GLdouble t, GLdouble r);
- void glTexCoord2sv(const GLshort *v);
- void glTexCoord2s(GLshort s, GLshort t);
- void glTexCoord2iv(const GLint *v);
- void glTexCoord2i(GLint s, GLint t);
- void glTexCoord2fv(const GLfloat *v);
- void glTexCoord2f(GLfloat s, GLfloat t);
- void glTexCoord2dv(const GLdouble *v);
- void glTexCoord2d(GLdouble s, GLdouble t);
- void glTexCoord1sv(const GLshort *v);
- void glTexCoord1s(GLshort s);
- void glTexCoord1iv(const GLint *v);
- void glTexCoord1i(GLint s);
- void glTexCoord1fv(const GLfloat *v);
- void glTexCoord1f(GLfloat s);
- void glTexCoord1dv(const GLdouble *v);
- void glTexCoord1d(GLdouble s);
- void glRectsv(const GLshort *v1, const GLshort *v2);
- void glRects(GLshort x1, GLshort y1, GLshort x2, GLshort y2);
- void glRectiv(const GLint *v1, const GLint *v2);
- void glRecti(GLint x1, GLint y1, GLint x2, GLint y2);
- void glRectfv(const GLfloat *v1, const GLfloat *v2);
- void glRectf(GLfloat x1, GLfloat y1, GLfloat x2, GLfloat y2);
- void glRectdv(const GLdouble *v1, const GLdouble *v2);
- void glRectd(GLdouble x1, GLdouble y1, GLdouble x2, GLdouble y2);
- void glRasterPos4sv(const GLshort *v);
- void glRasterPos4s(GLshort x, GLshort y, GLshort z, GLshort w);
- void glRasterPos4iv(const GLint *v);
- void glRasterPos4i(GLint x, GLint y, GLint z, GLint w);
- void glRasterPos4fv(const GLfloat *v);
- void glRasterPos4f(GLfloat x, GLfloat y, GLfloat z, GLfloat w);
- void glRasterPos4dv(const GLdouble *v);
- void glRasterPos4d(GLdouble x, GLdouble y, GLdouble z, GLdouble w);
- void glRasterPos3sv(const GLshort *v);
- void glRasterPos3s(GLshort x, GLshort y, GLshort z);
- void glRasterPos3iv(const GLint *v);
- void glRasterPos3i(GLint x, GLint y, GLint z);
- void glRasterPos3fv(const GLfloat *v);
- void glRasterPos3f(GLfloat x, GLfloat y, GLfloat z);
- void glRasterPos3dv(const GLdouble *v);
- void glRasterPos3d(GLdouble x, GLdouble y, GLdouble z);
- void glRasterPos2sv(const GLshort *v);
- void glRasterPos2s(GLshort x, GLshort y);
- void glRasterPos2iv(const GLint *v);
- void glRasterPos2i(GLint x, GLint y);
- void glRasterPos2fv(const GLfloat *v);
- void glRasterPos2f(GLfloat x, GLfloat y);
- void glRasterPos2dv(const GLdouble *v);
- void glRasterPos2d(GLdouble x, GLdouble y);
- void glNormal3sv(const GLshort *v);
- void glNormal3s(GLshort nx, GLshort ny, GLshort nz);
- void glNormal3iv(const GLint *v);
- void glNormal3i(GLint nx, GLint ny, GLint nz);
- void glNormal3fv(const GLfloat *v);
- void glNormal3f(GLfloat nx, GLfloat ny, GLfloat nz);
- void glNormal3dv(const GLdouble *v);
- void glNormal3d(GLdouble nx, GLdouble ny, GLdouble nz);
- void glNormal3bv(const GLbyte *v);
- void glNormal3b(GLbyte nx, GLbyte ny, GLbyte nz);
- void glIndexsv(const GLshort *c);
- void glIndexs(GLshort c);
- void glIndexiv(const GLint *c);
- void glIndexi(GLint c);
- void glIndexfv(const GLfloat *c);
- void glIndexf(GLfloat c);
- void glIndexdv(const GLdouble *c);
- void glIndexd(GLdouble c);
- void glEnd();
- void glEdgeFlagv(const GLboolean *flag);
- void glEdgeFlag(GLboolean flag);
- void glColor4usv(const GLushort *v);
- void glColor4us(GLushort red, GLushort green, GLushort blue, GLushort alpha);
- void glColor4uiv(const GLuint *v);
- void glColor4ui(GLuint red, GLuint green, GLuint blue, GLuint alpha);
- void glColor4ubv(const GLubyte *v);
- void glColor4ub(GLubyte red, GLubyte green, GLubyte blue, GLubyte alpha);
- void glColor4sv(const GLshort *v);
- void glColor4s(GLshort red, GLshort green, GLshort blue, GLshort alpha);
- void glColor4iv(const GLint *v);
- void glColor4i(GLint red, GLint green, GLint blue, GLint alpha);
- void glColor4fv(const GLfloat *v);
- void glColor4f(GLfloat red, GLfloat green, GLfloat blue, GLfloat alpha);
- void glColor4dv(const GLdouble *v);
- void glColor4d(GLdouble red, GLdouble green, GLdouble blue, GLdouble alpha);
- void glColor4bv(const GLbyte *v);
- void glColor4b(GLbyte red, GLbyte green, GLbyte blue, GLbyte alpha);
- void glColor3usv(const GLushort *v);
- void glColor3us(GLushort red, GLushort green, GLushort blue);
- void glColor3uiv(const GLuint *v);
- void glColor3ui(GLuint red, GLuint green, GLuint blue);
- void glColor3ubv(const GLubyte *v);
- void glColor3ub(GLubyte red, GLubyte green, GLubyte blue);
- void glColor3sv(const GLshort *v);
- void glColor3s(GLshort red, GLshort green, GLshort blue);
- void glColor3iv(const GLint *v);
- void glColor3i(GLint red, GLint green, GLint blue);
- void glColor3fv(const GLfloat *v);
- void glColor3f(GLfloat red, GLfloat green, GLfloat blue);
- void glColor3dv(const GLdouble *v);
- void glColor3d(GLdouble red, GLdouble green, GLdouble blue);
- void glColor3bv(const GLbyte *v);
- void glColor3b(GLbyte red, GLbyte green, GLbyte blue);
- void glBitmap(GLsizei width, GLsizei height, GLfloat xorig, GLfloat yorig, GLfloat xmove, GLfloat ymove, const GLubyte *bitmap);
- void glBegin(GLenum mode);
- void glListBase(GLuint base);
- GLuint glGenLists(GLsizei range);
- void glDeleteLists(GLuint list, GLsizei range);
- void glCallLists(GLsizei n, GLenum type, const GLvoid *lists);
- void glCallList(GLuint list);
- void glEndList();
- void glNewList(GLuint list, GLenum mode);
-
- // OpenGL 1.1 deprecated functions
- void glPushClientAttrib(GLbitfield mask);
- void glPopClientAttrib();
- void glPrioritizeTextures(GLsizei n, const GLuint *textures, const GLfloat *priorities);
- GLboolean glAreTexturesResident(GLsizei n, const GLuint *textures, GLboolean *residences);
- void glVertexPointer(GLint size, GLenum type, GLsizei stride, const GLvoid *pointer);
- void glTexCoordPointer(GLint size, GLenum type, GLsizei stride, const GLvoid *pointer);
- void glNormalPointer(GLenum type, GLsizei stride, const GLvoid *pointer);
- void glInterleavedArrays(GLenum format, GLsizei stride, const GLvoid *pointer);
- void glIndexPointer(GLenum type, GLsizei stride, const GLvoid *pointer);
- void glEnableClientState(GLenum array);
- void glEdgeFlagPointer(GLsizei stride, const GLvoid *pointer);
- void glDisableClientState(GLenum array);
- void glColorPointer(GLint size, GLenum type, GLsizei stride, const GLvoid *pointer);
- void glArrayElement(GLint i);
-
- // OpenGL 1.2 deprecated functions
- void glResetMinmax(GLenum target);
- void glResetHistogram(GLenum target);
- void glMinmax(GLenum target, GLenum internalformat, GLboolean sink);
- void glHistogram(GLenum target, GLsizei width, GLenum internalformat, GLboolean sink);
- void glGetMinmaxParameteriv(GLenum target, GLenum pname, GLint *params);
- void glGetMinmaxParameterfv(GLenum target, GLenum pname, GLfloat *params);
- void glGetMinmax(GLenum target, GLboolean reset, GLenum format, GLenum type, GLvoid *values);
- void glGetHistogramParameteriv(GLenum target, GLenum pname, GLint *params);
- void glGetHistogramParameterfv(GLenum target, GLenum pname, GLfloat *params);
- void glGetHistogram(GLenum target, GLboolean reset, GLenum format, GLenum type, GLvoid *values);
- void glSeparableFilter2D(GLenum target, GLenum internalformat, GLsizei width, GLsizei height, GLenum format, GLenum type, const GLvoid *row, const GLvoid *column);
- void glGetSeparableFilter(GLenum target, GLenum format, GLenum type, GLvoid *row, GLvoid *column, GLvoid *span);
- void glGetConvolutionParameteriv(GLenum target, GLenum pname, GLint *params);
- void glGetConvolutionParameterfv(GLenum target, GLenum pname, GLfloat *params);
- void glGetConvolutionFilter(GLenum target, GLenum format, GLenum type, GLvoid *image);
- void glCopyConvolutionFilter2D(GLenum target, GLenum internalformat, GLint x, GLint y, GLsizei width, GLsizei height);
- void glCopyConvolutionFilter1D(GLenum target, GLenum internalformat, GLint x, GLint y, GLsizei width);
- void glConvolutionParameteriv(GLenum target, GLenum pname, const GLint *params);
- void glConvolutionParameteri(GLenum target, GLenum pname, GLint params);
- void glConvolutionParameterfv(GLenum target, GLenum pname, const GLfloat *params);
- void glConvolutionParameterf(GLenum target, GLenum pname, GLfloat params);
- void glConvolutionFilter2D(GLenum target, GLenum internalformat, GLsizei width, GLsizei height, GLenum format, GLenum type, const GLvoid *image);
- void glConvolutionFilter1D(GLenum target, GLenum internalformat, GLsizei width, GLenum format, GLenum type, const GLvoid *image);
- void glCopyColorSubTable(GLenum target, GLsizei start, GLint x, GLint y, GLsizei width);
- void glColorSubTable(GLenum target, GLsizei start, GLsizei count, GLenum format, GLenum type, const GLvoid *data);
- void glGetColorTableParameteriv(GLenum target, GLenum pname, GLint *params);
- void glGetColorTableParameterfv(GLenum target, GLenum pname, GLfloat *params);
- void glGetColorTable(GLenum target, GLenum format, GLenum type, GLvoid *table);
- void glCopyColorTable(GLenum target, GLenum internalformat, GLint x, GLint y, GLsizei width);
- void glColorTableParameteriv(GLenum target, GLenum pname, const GLint *params);
- void glColorTableParameterfv(GLenum target, GLenum pname, const GLfloat *params);
- void glColorTable(GLenum target, GLenum internalformat, GLsizei width, GLenum format, GLenum type, const GLvoid *table);
-
- // OpenGL 1.3 deprecated functions
- void glMultTransposeMatrixd(const GLdouble *m);
- void glMultTransposeMatrixf(const GLfloat *m);
- void glLoadTransposeMatrixd(const GLdouble *m);
- void glLoadTransposeMatrixf(const GLfloat *m);
- void glMultiTexCoord4sv(GLenum target, const GLshort *v);
- void glMultiTexCoord4s(GLenum target, GLshort s, GLshort t, GLshort r, GLshort q);
- void glMultiTexCoord4iv(GLenum target, const GLint *v);
- void glMultiTexCoord4i(GLenum target, GLint s, GLint t, GLint r, GLint q);
- void glMultiTexCoord4fv(GLenum target, const GLfloat *v);
- void glMultiTexCoord4f(GLenum target, GLfloat s, GLfloat t, GLfloat r, GLfloat q);
- void glMultiTexCoord4dv(GLenum target, const GLdouble *v);
- void glMultiTexCoord4d(GLenum target, GLdouble s, GLdouble t, GLdouble r, GLdouble q);
- void glMultiTexCoord3sv(GLenum target, const GLshort *v);
- void glMultiTexCoord3s(GLenum target, GLshort s, GLshort t, GLshort r);
- void glMultiTexCoord3iv(GLenum target, const GLint *v);
- void glMultiTexCoord3i(GLenum target, GLint s, GLint t, GLint r);
- void glMultiTexCoord3fv(GLenum target, const GLfloat *v);
- void glMultiTexCoord3f(GLenum target, GLfloat s, GLfloat t, GLfloat r);
- void glMultiTexCoord3dv(GLenum target, const GLdouble *v);
- void glMultiTexCoord3d(GLenum target, GLdouble s, GLdouble t, GLdouble r);
- void glMultiTexCoord2sv(GLenum target, const GLshort *v);
- void glMultiTexCoord2s(GLenum target, GLshort s, GLshort t);
- void glMultiTexCoord2iv(GLenum target, const GLint *v);
- void glMultiTexCoord2i(GLenum target, GLint s, GLint t);
- void glMultiTexCoord2fv(GLenum target, const GLfloat *v);
- void glMultiTexCoord2f(GLenum target, GLfloat s, GLfloat t);
- void glMultiTexCoord2dv(GLenum target, const GLdouble *v);
- void glMultiTexCoord2d(GLenum target, GLdouble s, GLdouble t);
- void glMultiTexCoord1sv(GLenum target, const GLshort *v);
- void glMultiTexCoord1s(GLenum target, GLshort s);
- void glMultiTexCoord1iv(GLenum target, const GLint *v);
- void glMultiTexCoord1i(GLenum target, GLint s);
- void glMultiTexCoord1fv(GLenum target, const GLfloat *v);
- void glMultiTexCoord1f(GLenum target, GLfloat s);
- void glMultiTexCoord1dv(GLenum target, const GLdouble *v);
- void glMultiTexCoord1d(GLenum target, GLdouble s);
- void glClientActiveTexture(GLenum texture);
-
- // OpenGL 1.4 deprecated functions
- void glWindowPos3sv(const GLshort *v);
- void glWindowPos3s(GLshort x, GLshort y, GLshort z);
- void glWindowPos3iv(const GLint *v);
- void glWindowPos3i(GLint x, GLint y, GLint z);
- void glWindowPos3fv(const GLfloat *v);
- void glWindowPos3f(GLfloat x, GLfloat y, GLfloat z);
- void glWindowPos3dv(const GLdouble *v);
- void glWindowPos3d(GLdouble x, GLdouble y, GLdouble z);
- void glWindowPos2sv(const GLshort *v);
- void glWindowPos2s(GLshort x, GLshort y);
- void glWindowPos2iv(const GLint *v);
- void glWindowPos2i(GLint x, GLint y);
- void glWindowPos2fv(const GLfloat *v);
- void glWindowPos2f(GLfloat x, GLfloat y);
- void glWindowPos2dv(const GLdouble *v);
- void glWindowPos2d(GLdouble x, GLdouble y);
- void glSecondaryColorPointer(GLint size, GLenum type, GLsizei stride, const GLvoid *pointer);
- void glSecondaryColor3usv(const GLushort *v);
- void glSecondaryColor3us(GLushort red, GLushort green, GLushort blue);
- void glSecondaryColor3uiv(const GLuint *v);
- void glSecondaryColor3ui(GLuint red, GLuint green, GLuint blue);
- void glSecondaryColor3ubv(const GLubyte *v);
- void glSecondaryColor3ub(GLubyte red, GLubyte green, GLubyte blue);
- void glSecondaryColor3sv(const GLshort *v);
- void glSecondaryColor3s(GLshort red, GLshort green, GLshort blue);
- void glSecondaryColor3iv(const GLint *v);
- void glSecondaryColor3i(GLint red, GLint green, GLint blue);
- void glSecondaryColor3fv(const GLfloat *v);
- void glSecondaryColor3f(GLfloat red, GLfloat green, GLfloat blue);
- void glSecondaryColor3dv(const GLdouble *v);
- void glSecondaryColor3d(GLdouble red, GLdouble green, GLdouble blue);
- void glSecondaryColor3bv(const GLbyte *v);
- void glSecondaryColor3b(GLbyte red, GLbyte green, GLbyte blue);
- void glFogCoordPointer(GLenum type, GLsizei stride, const GLvoid *pointer);
- void glFogCoorddv(const GLdouble *coord);
- void glFogCoordd(GLdouble coord);
- void glFogCoordfv(const GLfloat *coord);
- void glFogCoordf(GLfloat coord);
-
- // OpenGL 1.5 deprecated functions
-
- // OpenGL 2.0 deprecated functions
- void glVertexAttrib4usv(GLuint index, const GLushort *v);
- void glVertexAttrib4uiv(GLuint index, const GLuint *v);
- void glVertexAttrib4ubv(GLuint index, const GLubyte *v);
- void glVertexAttrib4sv(GLuint index, const GLshort *v);
- void glVertexAttrib4s(GLuint index, GLshort x, GLshort y, GLshort z, GLshort w);
- void glVertexAttrib4iv(GLuint index, const GLint *v);
- void glVertexAttrib4fv(GLuint index, const GLfloat *v);
- void glVertexAttrib4f(GLuint index, GLfloat x, GLfloat y, GLfloat z, GLfloat w);
- void glVertexAttrib4dv(GLuint index, const GLdouble *v);
- void glVertexAttrib4d(GLuint index, GLdouble x, GLdouble y, GLdouble z, GLdouble w);
- void glVertexAttrib4bv(GLuint index, const GLbyte *v);
- void glVertexAttrib4Nusv(GLuint index, const GLushort *v);
- void glVertexAttrib4Nuiv(GLuint index, const GLuint *v);
- void glVertexAttrib4Nubv(GLuint index, const GLubyte *v);
- void glVertexAttrib4Nub(GLuint index, GLubyte x, GLubyte y, GLubyte z, GLubyte w);
- void glVertexAttrib4Nsv(GLuint index, const GLshort *v);
- void glVertexAttrib4Niv(GLuint index, const GLint *v);
- void glVertexAttrib4Nbv(GLuint index, const GLbyte *v);
- void glVertexAttrib3sv(GLuint index, const GLshort *v);
- void glVertexAttrib3s(GLuint index, GLshort x, GLshort y, GLshort z);
- void glVertexAttrib3fv(GLuint index, const GLfloat *v);
- void glVertexAttrib3f(GLuint index, GLfloat x, GLfloat y, GLfloat z);
- void glVertexAttrib3dv(GLuint index, const GLdouble *v);
- void glVertexAttrib3d(GLuint index, GLdouble x, GLdouble y, GLdouble z);
- void glVertexAttrib2sv(GLuint index, const GLshort *v);
- void glVertexAttrib2s(GLuint index, GLshort x, GLshort y);
- void glVertexAttrib2fv(GLuint index, const GLfloat *v);
- void glVertexAttrib2f(GLuint index, GLfloat x, GLfloat y);
- void glVertexAttrib2dv(GLuint index, const GLdouble *v);
- void glVertexAttrib2d(GLuint index, GLdouble x, GLdouble y);
- void glVertexAttrib1sv(GLuint index, const GLshort *v);
- void glVertexAttrib1s(GLuint index, GLshort x);
- void glVertexAttrib1fv(GLuint index, const GLfloat *v);
- void glVertexAttrib1f(GLuint index, GLfloat x);
- void glVertexAttrib1dv(GLuint index, const GLdouble *v);
- void glVertexAttrib1d(GLuint index, GLdouble x);
-
- // OpenGL 2.1 deprecated functions
-
- // OpenGL 3.0 deprecated functions
- void glVertexAttribI4usv(GLuint index, const GLushort *v);
- void glVertexAttribI4ubv(GLuint index, const GLubyte *v);
- void glVertexAttribI4sv(GLuint index, const GLshort *v);
- void glVertexAttribI4bv(GLuint index, const GLbyte *v);
- void glVertexAttribI4uiv(GLuint index, const GLuint *v);
- void glVertexAttribI3uiv(GLuint index, const GLuint *v);
- void glVertexAttribI2uiv(GLuint index, const GLuint *v);
- void glVertexAttribI1uiv(GLuint index, const GLuint *v);
- void glVertexAttribI4iv(GLuint index, const GLint *v);
- void glVertexAttribI3iv(GLuint index, const GLint *v);
- void glVertexAttribI2iv(GLuint index, const GLint *v);
- void glVertexAttribI1iv(GLuint index, const GLint *v);
- void glVertexAttribI4ui(GLuint index, GLuint x, GLuint y, GLuint z, GLuint w);
- void glVertexAttribI3ui(GLuint index, GLuint x, GLuint y, GLuint z);
- void glVertexAttribI2ui(GLuint index, GLuint x, GLuint y);
- void glVertexAttribI1ui(GLuint index, GLuint x);
- void glVertexAttribI4i(GLuint index, GLint x, GLint y, GLint z, GLint w);
- void glVertexAttribI3i(GLuint index, GLint x, GLint y, GLint z);
- void glVertexAttribI2i(GLuint index, GLint x, GLint y);
- void glVertexAttribI1i(GLuint index, GLint x);
-
- // OpenGL 3.1 deprecated functions
-
- // OpenGL 3.2 deprecated functions
-
- // OpenGL 3.3 deprecated functions
-
-private:
- friend class QOpenGLContext;
-
- static bool isContextCompatible(QOpenGLContext *context);
- static QOpenGLVersionProfile versionProfile();
-
- QOpenGLFunctions_1_0_CoreBackend* d_1_0_Core;
- QOpenGLFunctions_1_1_CoreBackend* d_1_1_Core;
- QOpenGLFunctions_1_2_CoreBackend* d_1_2_Core;
- QOpenGLFunctions_1_3_CoreBackend* d_1_3_Core;
- QOpenGLFunctions_1_4_CoreBackend* d_1_4_Core;
- QOpenGLFunctions_1_5_CoreBackend* d_1_5_Core;
- QOpenGLFunctions_2_0_CoreBackend* d_2_0_Core;
- QOpenGLFunctions_2_1_CoreBackend* d_2_1_Core;
- QOpenGLFunctions_3_0_CoreBackend* d_3_0_Core;
- QOpenGLFunctions_3_1_CoreBackend* d_3_1_Core;
- QOpenGLFunctions_3_2_CoreBackend* d_3_2_Core;
- QOpenGLFunctions_3_3_CoreBackend* d_3_3_Core;
- QOpenGLFunctions_1_0_DeprecatedBackend* d_1_0_Deprecated;
- QOpenGLFunctions_1_1_DeprecatedBackend* d_1_1_Deprecated;
- QOpenGLFunctions_1_2_DeprecatedBackend* d_1_2_Deprecated;
- QOpenGLFunctions_1_3_DeprecatedBackend* d_1_3_Deprecated;
- QOpenGLFunctions_1_4_DeprecatedBackend* d_1_4_Deprecated;
- void *m_reserved_2_0_Deprecated; // To maintain BC
- QOpenGLFunctions_3_3_DeprecatedBackend* d_3_3_Deprecated;
-};
-
-// OpenGL 1.0 core functions
-inline void QOpenGLFunctions_3_3_Compatibility::glViewport(GLint x, GLint y, GLsizei width, GLsizei height)
-{
- d_1_0_Core->f.Viewport(x, y, width, height);
-}
-
-inline void QOpenGLFunctions_3_3_Compatibility::glDepthRange(GLdouble nearVal, GLdouble farVal)
-{
- d_1_0_Core->f.DepthRange(nearVal, farVal);
-}
-
-inline GLboolean QOpenGLFunctions_3_3_Compatibility::glIsEnabled(GLenum cap)
-{
- return d_1_0_Core->f.IsEnabled(cap);
-}
-
-inline void QOpenGLFunctions_3_3_Compatibility::glGetTexLevelParameteriv(GLenum target, GLint level, GLenum pname, GLint *params)
-{
- d_1_0_Core->f.GetTexLevelParameteriv(target, level, pname, params);
-}
-
-inline void QOpenGLFunctions_3_3_Compatibility::glGetTexLevelParameterfv(GLenum target, GLint level, GLenum pname, GLfloat *params)
-{
- d_1_0_Core->f.GetTexLevelParameterfv(target, level, pname, params);
-}
-
-inline void QOpenGLFunctions_3_3_Compatibility::glGetTexParameteriv(GLenum target, GLenum pname, GLint *params)
-{
- d_1_0_Core->f.GetTexParameteriv(target, pname, params);
-}
-
-inline void QOpenGLFunctions_3_3_Compatibility::glGetTexParameterfv(GLenum target, GLenum pname, GLfloat *params)
-{
- d_1_0_Core->f.GetTexParameterfv(target, pname, params);
-}
-
-inline void QOpenGLFunctions_3_3_Compatibility::glGetTexImage(GLenum target, GLint level, GLenum format, GLenum type, GLvoid *pixels)
-{
- d_1_0_Core->f.GetTexImage(target, level, format, type, pixels);
-}
-
-inline const GLubyte * QOpenGLFunctions_3_3_Compatibility::glGetString(GLenum name)
-{
- return d_1_0_Core->f.GetString(name);
-}
-
-inline void QOpenGLFunctions_3_3_Compatibility::glGetIntegerv(GLenum pname, GLint *params)
-{
- d_1_0_Core->f.GetIntegerv(pname, params);
-}
-
-inline void QOpenGLFunctions_3_3_Compatibility::glGetFloatv(GLenum pname, GLfloat *params)
-{
- d_1_0_Core->f.GetFloatv(pname, params);
-}
-
-inline GLenum QOpenGLFunctions_3_3_Compatibility::glGetError()
-{
- return d_1_0_Core->f.GetError();
-}
-
-inline void QOpenGLFunctions_3_3_Compatibility::glGetDoublev(GLenum pname, GLdouble *params)
-{
- d_1_0_Core->f.GetDoublev(pname, params);
-}
-
-inline void QOpenGLFunctions_3_3_Compatibility::glGetBooleanv(GLenum pname, GLboolean *params)
-{
- d_1_0_Core->f.GetBooleanv(pname, params);
-}
-
-inline void QOpenGLFunctions_3_3_Compatibility::glReadPixels(GLint x, GLint y, GLsizei width, GLsizei height, GLenum format, GLenum type, GLvoid *pixels)
-{
- d_1_0_Core->f.ReadPixels(x, y, width, height, format, type, pixels);
-}
-
-inline void QOpenGLFunctions_3_3_Compatibility::glReadBuffer(GLenum mode)
-{
- d_1_0_Core->f.ReadBuffer(mode);
-}
-
-inline void QOpenGLFunctions_3_3_Compatibility::glPixelStorei(GLenum pname, GLint param)
-{
- d_1_0_Core->f.PixelStorei(pname, param);
-}
-
-inline void QOpenGLFunctions_3_3_Compatibility::glPixelStoref(GLenum pname, GLfloat param)
-{
- d_1_0_Core->f.PixelStoref(pname, param);
-}
-
-inline void QOpenGLFunctions_3_3_Compatibility::glDepthFunc(GLenum func)
-{
- d_1_0_Core->f.DepthFunc(func);
-}
-
-inline void QOpenGLFunctions_3_3_Compatibility::glStencilOp(GLenum fail, GLenum zfail, GLenum zpass)
-{
- d_1_0_Core->f.StencilOp(fail, zfail, zpass);
-}
-
-inline void QOpenGLFunctions_3_3_Compatibility::glStencilFunc(GLenum func, GLint ref, GLuint mask)
-{
- d_1_0_Core->f.StencilFunc(func, ref, mask);
-}
-
-inline void QOpenGLFunctions_3_3_Compatibility::glLogicOp(GLenum opcode)
-{
- d_1_0_Core->f.LogicOp(opcode);
-}
-
-inline void QOpenGLFunctions_3_3_Compatibility::glBlendFunc(GLenum sfactor, GLenum dfactor)
-{
- d_1_0_Core->f.BlendFunc(sfactor, dfactor);
-}
-
-inline void QOpenGLFunctions_3_3_Compatibility::glFlush()
-{
- d_1_0_Core->f.Flush();
-}
-
-inline void QOpenGLFunctions_3_3_Compatibility::glFinish()
-{
- d_1_0_Core->f.Finish();
-}
-
-inline void QOpenGLFunctions_3_3_Compatibility::glEnable(GLenum cap)
-{
- d_1_0_Core->f.Enable(cap);
-}
-
-inline void QOpenGLFunctions_3_3_Compatibility::glDisable(GLenum cap)
-{
- d_1_0_Core->f.Disable(cap);
-}
-
-inline void QOpenGLFunctions_3_3_Compatibility::glDepthMask(GLboolean flag)
-{
- d_1_0_Core->f.DepthMask(flag);
-}
-
-inline void QOpenGLFunctions_3_3_Compatibility::glColorMask(GLboolean red, GLboolean green, GLboolean blue, GLboolean alpha)
-{
- d_1_0_Core->f.ColorMask(red, green, blue, alpha);
-}
-
-inline void QOpenGLFunctions_3_3_Compatibility::glStencilMask(GLuint mask)
-{
- d_1_0_Core->f.StencilMask(mask);
-}
-
-inline void QOpenGLFunctions_3_3_Compatibility::glClearDepth(GLdouble depth)
-{
- d_1_0_Core->f.ClearDepth(depth);
-}
-
-inline void QOpenGLFunctions_3_3_Compatibility::glClearStencil(GLint s)
-{
- d_1_0_Core->f.ClearStencil(s);
-}
-
-inline void QOpenGLFunctions_3_3_Compatibility::glClearColor(GLfloat red, GLfloat green, GLfloat blue, GLfloat alpha)
-{
- d_1_0_Core->f.ClearColor(red, green, blue, alpha);
-}
-
-inline void QOpenGLFunctions_3_3_Compatibility::glClear(GLbitfield mask)
-{
- d_1_0_Core->f.Clear(mask);
-}
-
-inline void QOpenGLFunctions_3_3_Compatibility::glDrawBuffer(GLenum mode)
-{
- d_1_0_Core->f.DrawBuffer(mode);
-}
-
-inline void QOpenGLFunctions_3_3_Compatibility::glTexImage2D(GLenum target, GLint level, GLint internalformat, GLsizei width, GLsizei height, GLint border, GLenum format, GLenum type, const GLvoid *pixels)
-{
- d_1_0_Core->f.TexImage2D(target, level, internalformat, width, height, border, format, type, pixels);
-}
-
-inline void QOpenGLFunctions_3_3_Compatibility::glTexImage1D(GLenum target, GLint level, GLint internalformat, GLsizei width, GLint border, GLenum format, GLenum type, const GLvoid *pixels)
-{
- d_1_0_Core->f.TexImage1D(target, level, internalformat, width, border, format, type, pixels);
-}
-
-inline void QOpenGLFunctions_3_3_Compatibility::glTexParameteriv(GLenum target, GLenum pname, const GLint *params)
-{
- d_1_0_Core->f.TexParameteriv(target, pname, params);
-}
-
-inline void QOpenGLFunctions_3_3_Compatibility::glTexParameteri(GLenum target, GLenum pname, GLint param)
-{
- d_1_0_Core->f.TexParameteri(target, pname, param);
-}
-
-inline void QOpenGLFunctions_3_3_Compatibility::glTexParameterfv(GLenum target, GLenum pname, const GLfloat *params)
-{
- d_1_0_Core->f.TexParameterfv(target, pname, params);
-}
-
-inline void QOpenGLFunctions_3_3_Compatibility::glTexParameterf(GLenum target, GLenum pname, GLfloat param)
-{
- d_1_0_Core->f.TexParameterf(target, pname, param);
-}
-
-inline void QOpenGLFunctions_3_3_Compatibility::glScissor(GLint x, GLint y, GLsizei width, GLsizei height)
-{
- d_1_0_Core->f.Scissor(x, y, width, height);
-}
-
-inline void QOpenGLFunctions_3_3_Compatibility::glPolygonMode(GLenum face, GLenum mode)
-{
- d_1_0_Core->f.PolygonMode(face, mode);
-}
-
-inline void QOpenGLFunctions_3_3_Compatibility::glPointSize(GLfloat size)
-{
- d_1_0_Core->f.PointSize(size);
-}
-
-inline void QOpenGLFunctions_3_3_Compatibility::glLineWidth(GLfloat width)
-{
- d_1_0_Core->f.LineWidth(width);
-}
-
-inline void QOpenGLFunctions_3_3_Compatibility::glHint(GLenum target, GLenum mode)
-{
- d_1_0_Core->f.Hint(target, mode);
-}
-
-inline void QOpenGLFunctions_3_3_Compatibility::glFrontFace(GLenum mode)
-{
- d_1_0_Core->f.FrontFace(mode);
-}
-
-inline void QOpenGLFunctions_3_3_Compatibility::glCullFace(GLenum mode)
-{
- d_1_0_Core->f.CullFace(mode);
-}
-
-
-// OpenGL 1.1 core functions
-inline void QOpenGLFunctions_3_3_Compatibility::glIndexubv(const GLubyte *c)
-{
- d_1_1_Deprecated->f.Indexubv(c);
-}
-
-inline void QOpenGLFunctions_3_3_Compatibility::glIndexub(GLubyte c)
-{
- d_1_1_Deprecated->f.Indexub(c);
-}
-
-inline GLboolean QOpenGLFunctions_3_3_Compatibility::glIsTexture(GLuint texture)
-{
- return d_1_1_Core->f.IsTexture(texture);
-}
-
-inline void QOpenGLFunctions_3_3_Compatibility::glGenTextures(GLsizei n, GLuint *textures)
-{
- d_1_1_Core->f.GenTextures(n, textures);
-}
-
-inline void QOpenGLFunctions_3_3_Compatibility::glDeleteTextures(GLsizei n, const GLuint *textures)
-{
- d_1_1_Core->f.DeleteTextures(n, textures);
-}
-
-inline void QOpenGLFunctions_3_3_Compatibility::glBindTexture(GLenum target, GLuint texture)
-{
- d_1_1_Core->f.BindTexture(target, texture);
-}
-
-inline void QOpenGLFunctions_3_3_Compatibility::glTexSubImage2D(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLenum type, const GLvoid *pixels)
-{
- d_1_1_Core->f.TexSubImage2D(target, level, xoffset, yoffset, width, height, format, type, pixels);
-}
-
-inline void QOpenGLFunctions_3_3_Compatibility::glTexSubImage1D(GLenum target, GLint level, GLint xoffset, GLsizei width, GLenum format, GLenum type, const GLvoid *pixels)
-{
- d_1_1_Core->f.TexSubImage1D(target, level, xoffset, width, format, type, pixels);
-}
-
-inline void QOpenGLFunctions_3_3_Compatibility::glCopyTexSubImage2D(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint x, GLint y, GLsizei width, GLsizei height)
-{
- d_1_1_Core->f.CopyTexSubImage2D(target, level, xoffset, yoffset, x, y, width, height);
-}
-
-inline void QOpenGLFunctions_3_3_Compatibility::glCopyTexSubImage1D(GLenum target, GLint level, GLint xoffset, GLint x, GLint y, GLsizei width)
-{
- d_1_1_Core->f.CopyTexSubImage1D(target, level, xoffset, x, y, width);
-}
-
-inline void QOpenGLFunctions_3_3_Compatibility::glCopyTexImage2D(GLenum target, GLint level, GLenum internalformat, GLint x, GLint y, GLsizei width, GLsizei height, GLint border)
-{
- d_1_1_Core->f.CopyTexImage2D(target, level, internalformat, x, y, width, height, border);
-}
-
-inline void QOpenGLFunctions_3_3_Compatibility::glCopyTexImage1D(GLenum target, GLint level, GLenum internalformat, GLint x, GLint y, GLsizei width, GLint border)
-{
- d_1_1_Core->f.CopyTexImage1D(target, level, internalformat, x, y, width, border);
-}
-
-inline void QOpenGLFunctions_3_3_Compatibility::glPolygonOffset(GLfloat factor, GLfloat units)
-{
- d_1_1_Core->f.PolygonOffset(factor, units);
-}
-
-inline void QOpenGLFunctions_3_3_Compatibility::glGetPointerv(GLenum pname, GLvoid* *params)
-{
- d_1_1_Deprecated->f.GetPointerv(pname, params);
-}
-
-inline void QOpenGLFunctions_3_3_Compatibility::glDrawElements(GLenum mode, GLsizei count, GLenum type, const GLvoid *indices)
-{
- d_1_1_Core->f.DrawElements(mode, count, type, indices);
-}
-
-inline void QOpenGLFunctions_3_3_Compatibility::glDrawArrays(GLenum mode, GLint first, GLsizei count)
-{
- d_1_1_Core->f.DrawArrays(mode, first, count);
-}
-
-
-// OpenGL 1.2 core functions
-inline void QOpenGLFunctions_3_3_Compatibility::glCopyTexSubImage3D(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLint x, GLint y, GLsizei width, GLsizei height)
-{
- d_1_2_Core->f.CopyTexSubImage3D(target, level, xoffset, yoffset, zoffset, x, y, width, height);
-}
-
-inline void QOpenGLFunctions_3_3_Compatibility::glTexSubImage3D(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLenum type, const GLvoid *pixels)
-{
- d_1_2_Core->f.TexSubImage3D(target, level, xoffset, yoffset, zoffset, width, height, depth, format, type, pixels);
-}
-
-inline void QOpenGLFunctions_3_3_Compatibility::glTexImage3D(GLenum target, GLint level, GLint internalformat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLenum format, GLenum type, const GLvoid *pixels)
-{
- d_1_2_Core->f.TexImage3D(target, level, internalformat, width, height, depth, border, format, type, pixels);
-}
-
-inline void QOpenGLFunctions_3_3_Compatibility::glDrawRangeElements(GLenum mode, GLuint start, GLuint end, GLsizei count, GLenum type, const GLvoid *indices)
-{
- d_1_2_Core->f.DrawRangeElements(mode, start, end, count, type, indices);
-}
-
-inline void QOpenGLFunctions_3_3_Compatibility::glBlendEquation(GLenum mode)
-{
- d_1_2_Core->f.BlendEquation(mode);
-}
-
-inline void QOpenGLFunctions_3_3_Compatibility::glBlendColor(GLfloat red, GLfloat green, GLfloat blue, GLfloat alpha)
-{
- d_1_2_Core->f.BlendColor(red, green, blue, alpha);
-}
-
-
-// OpenGL 1.3 core functions
-inline void QOpenGLFunctions_3_3_Compatibility::glGetCompressedTexImage(GLenum target, GLint level, GLvoid *img)
-{
- d_1_3_Core->f.GetCompressedTexImage(target, level, img);
-}
-
-inline void QOpenGLFunctions_3_3_Compatibility::glCompressedTexSubImage1D(GLenum target, GLint level, GLint xoffset, GLsizei width, GLenum format, GLsizei imageSize, const GLvoid *data)
-{
- d_1_3_Core->f.CompressedTexSubImage1D(target, level, xoffset, width, format, imageSize, data);
-}
-
-inline void QOpenGLFunctions_3_3_Compatibility::glCompressedTexSubImage2D(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLsizei imageSize, const GLvoid *data)
-{
- d_1_3_Core->f.CompressedTexSubImage2D(target, level, xoffset, yoffset, width, height, format, imageSize, data);
-}
-
-inline void QOpenGLFunctions_3_3_Compatibility::glCompressedTexSubImage3D(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLsizei imageSize, const GLvoid *data)
-{
- d_1_3_Core->f.CompressedTexSubImage3D(target, level, xoffset, yoffset, zoffset, width, height, depth, format, imageSize, data);
-}
-
-inline void QOpenGLFunctions_3_3_Compatibility::glCompressedTexImage1D(GLenum target, GLint level, GLenum internalformat, GLsizei width, GLint border, GLsizei imageSize, const GLvoid *data)
-{
- d_1_3_Core->f.CompressedTexImage1D(target, level, internalformat, width, border, imageSize, data);
-}
-
-inline void QOpenGLFunctions_3_3_Compatibility::glCompressedTexImage2D(GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLint border, GLsizei imageSize, const GLvoid *data)
-{
- d_1_3_Core->f.CompressedTexImage2D(target, level, internalformat, width, height, border, imageSize, data);
-}
-
-inline void QOpenGLFunctions_3_3_Compatibility::glCompressedTexImage3D(GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLsizei imageSize, const GLvoid *data)
-{
- d_1_3_Core->f.CompressedTexImage3D(target, level, internalformat, width, height, depth, border, imageSize, data);
-}
-
-inline void QOpenGLFunctions_3_3_Compatibility::glSampleCoverage(GLfloat value, GLboolean invert)
-{
- d_1_3_Core->f.SampleCoverage(value, invert);
-}
-
-inline void QOpenGLFunctions_3_3_Compatibility::glActiveTexture(GLenum texture)
-{
- d_1_3_Core->f.ActiveTexture(texture);
-}
-
-
-// OpenGL 1.4 core functions
-inline void QOpenGLFunctions_3_3_Compatibility::glPointParameteriv(GLenum pname, const GLint *params)
-{
- d_1_4_Core->f.PointParameteriv(pname, params);
-}
-
-inline void QOpenGLFunctions_3_3_Compatibility::glPointParameteri(GLenum pname, GLint param)
-{
- d_1_4_Core->f.PointParameteri(pname, param);
-}
-
-inline void QOpenGLFunctions_3_3_Compatibility::glPointParameterfv(GLenum pname, const GLfloat *params)
-{
- d_1_4_Core->f.PointParameterfv(pname, params);
-}
-
-inline void QOpenGLFunctions_3_3_Compatibility::glPointParameterf(GLenum pname, GLfloat param)
-{
- d_1_4_Core->f.PointParameterf(pname, param);
-}
-
-inline void QOpenGLFunctions_3_3_Compatibility::glMultiDrawElements(GLenum mode, const GLsizei *count, GLenum type, const GLvoid* const *indices, GLsizei drawcount)
-{
- d_1_4_Core->f.MultiDrawElements(mode, count, type, indices, drawcount);
-}
-
-inline void QOpenGLFunctions_3_3_Compatibility::glMultiDrawArrays(GLenum mode, const GLint *first, const GLsizei *count, GLsizei drawcount)
-{
- d_1_4_Core->f.MultiDrawArrays(mode, first, count, drawcount);
-}
-
-inline void QOpenGLFunctions_3_3_Compatibility::glBlendFuncSeparate(GLenum sfactorRGB, GLenum dfactorRGB, GLenum sfactorAlpha, GLenum dfactorAlpha)
-{
- d_1_4_Core->f.BlendFuncSeparate(sfactorRGB, dfactorRGB, sfactorAlpha, dfactorAlpha);
-}
-
-
-// OpenGL 1.5 core functions
-inline void QOpenGLFunctions_3_3_Compatibility::glGetBufferPointerv(GLenum target, GLenum pname, GLvoid* *params)
-{
- d_1_5_Core->f.GetBufferPointerv(target, pname, params);
-}
-
-inline void QOpenGLFunctions_3_3_Compatibility::glGetBufferParameteriv(GLenum target, GLenum pname, GLint *params)
-{
- d_1_5_Core->f.GetBufferParameteriv(target, pname, params);
-}
-
-inline GLboolean QOpenGLFunctions_3_3_Compatibility::glUnmapBuffer(GLenum target)
-{
- return d_1_5_Core->f.UnmapBuffer(target);
-}
-
-inline GLvoid* QOpenGLFunctions_3_3_Compatibility::glMapBuffer(GLenum target, GLenum access)
-{
- return d_1_5_Core->f.MapBuffer(target, access);
-}
-
-inline void QOpenGLFunctions_3_3_Compatibility::glGetBufferSubData(GLenum target, GLintptr offset, GLsizeiptr size, GLvoid *data)
-{
- d_1_5_Core->f.GetBufferSubData(target, offset, size, data);
-}
-
-inline void QOpenGLFunctions_3_3_Compatibility::glBufferSubData(GLenum target, GLintptr offset, GLsizeiptr size, const GLvoid *data)
-{
- d_1_5_Core->f.BufferSubData(target, offset, size, data);
-}
-
-inline void QOpenGLFunctions_3_3_Compatibility::glBufferData(GLenum target, GLsizeiptr size, const GLvoid *data, GLenum usage)
-{
- d_1_5_Core->f.BufferData(target, size, data, usage);
-}
-
-inline GLboolean QOpenGLFunctions_3_3_Compatibility::glIsBuffer(GLuint buffer)
-{
- return d_1_5_Core->f.IsBuffer(buffer);
-}
-
-inline void QOpenGLFunctions_3_3_Compatibility::glGenBuffers(GLsizei n, GLuint *buffers)
-{
- d_1_5_Core->f.GenBuffers(n, buffers);
-}
-
-inline void QOpenGLFunctions_3_3_Compatibility::glDeleteBuffers(GLsizei n, const GLuint *buffers)
-{
- d_1_5_Core->f.DeleteBuffers(n, buffers);
-}
-
-inline void QOpenGLFunctions_3_3_Compatibility::glBindBuffer(GLenum target, GLuint buffer)
-{
- d_1_5_Core->f.BindBuffer(target, buffer);
-}
-
-inline void QOpenGLFunctions_3_3_Compatibility::glGetQueryObjectuiv(GLuint id, GLenum pname, GLuint *params)
-{
- d_1_5_Core->f.GetQueryObjectuiv(id, pname, params);
-}
-
-inline void QOpenGLFunctions_3_3_Compatibility::glGetQueryObjectiv(GLuint id, GLenum pname, GLint *params)
-{
- d_1_5_Core->f.GetQueryObjectiv(id, pname, params);
-}
-
-inline void QOpenGLFunctions_3_3_Compatibility::glGetQueryiv(GLenum target, GLenum pname, GLint *params)
-{
- d_1_5_Core->f.GetQueryiv(target, pname, params);
-}
-
-inline void QOpenGLFunctions_3_3_Compatibility::glEndQuery(GLenum target)
-{
- d_1_5_Core->f.EndQuery(target);
-}
-
-inline void QOpenGLFunctions_3_3_Compatibility::glBeginQuery(GLenum target, GLuint id)
-{
- d_1_5_Core->f.BeginQuery(target, id);
-}
-
-inline GLboolean QOpenGLFunctions_3_3_Compatibility::glIsQuery(GLuint id)
-{
- return d_1_5_Core->f.IsQuery(id);
-}
-
-inline void QOpenGLFunctions_3_3_Compatibility::glDeleteQueries(GLsizei n, const GLuint *ids)
-{
- d_1_5_Core->f.DeleteQueries(n, ids);
-}
-
-inline void QOpenGLFunctions_3_3_Compatibility::glGenQueries(GLsizei n, GLuint *ids)
-{
- d_1_5_Core->f.GenQueries(n, ids);
-}
-
-
-// OpenGL 2.0 core functions
-inline void QOpenGLFunctions_3_3_Compatibility::glVertexAttribPointer(GLuint index, GLint size, GLenum type, GLboolean normalized, GLsizei stride, const GLvoid *pointer)
-{
- d_2_0_Core->f.VertexAttribPointer(index, size, type, normalized, stride, pointer);
-}
-
-inline void QOpenGLFunctions_3_3_Compatibility::glValidateProgram(GLuint program)
-{
- d_2_0_Core->f.ValidateProgram(program);
-}
-
-inline void QOpenGLFunctions_3_3_Compatibility::glUniformMatrix4fv(GLint location, GLsizei count, GLboolean transpose, const GLfloat *value)
-{
- d_2_0_Core->f.UniformMatrix4fv(location, count, transpose, value);
-}
-
-inline void QOpenGLFunctions_3_3_Compatibility::glUniformMatrix3fv(GLint location, GLsizei count, GLboolean transpose, const GLfloat *value)
-{
- d_2_0_Core->f.UniformMatrix3fv(location, count, transpose, value);
-}
-
-inline void QOpenGLFunctions_3_3_Compatibility::glUniformMatrix2fv(GLint location, GLsizei count, GLboolean transpose, const GLfloat *value)
-{
- d_2_0_Core->f.UniformMatrix2fv(location, count, transpose, value);
-}
-
-inline void QOpenGLFunctions_3_3_Compatibility::glUniform4iv(GLint location, GLsizei count, const GLint *value)
-{
- d_2_0_Core->f.Uniform4iv(location, count, value);
-}
-
-inline void QOpenGLFunctions_3_3_Compatibility::glUniform3iv(GLint location, GLsizei count, const GLint *value)
-{
- d_2_0_Core->f.Uniform3iv(location, count, value);
-}
-
-inline void QOpenGLFunctions_3_3_Compatibility::glUniform2iv(GLint location, GLsizei count, const GLint *value)
-{
- d_2_0_Core->f.Uniform2iv(location, count, value);
-}
-
-inline void QOpenGLFunctions_3_3_Compatibility::glUniform1iv(GLint location, GLsizei count, const GLint *value)
-{
- d_2_0_Core->f.Uniform1iv(location, count, value);
-}
-
-inline void QOpenGLFunctions_3_3_Compatibility::glUniform4fv(GLint location, GLsizei count, const GLfloat *value)
-{
- d_2_0_Core->f.Uniform4fv(location, count, value);
-}
-
-inline void QOpenGLFunctions_3_3_Compatibility::glUniform3fv(GLint location, GLsizei count, const GLfloat *value)
-{
- d_2_0_Core->f.Uniform3fv(location, count, value);
-}
-
-inline void QOpenGLFunctions_3_3_Compatibility::glUniform2fv(GLint location, GLsizei count, const GLfloat *value)
-{
- d_2_0_Core->f.Uniform2fv(location, count, value);
-}
-
-inline void QOpenGLFunctions_3_3_Compatibility::glUniform1fv(GLint location, GLsizei count, const GLfloat *value)
-{
- d_2_0_Core->f.Uniform1fv(location, count, value);
-}
-
-inline void QOpenGLFunctions_3_3_Compatibility::glUniform4i(GLint location, GLint v0, GLint v1, GLint v2, GLint v3)
-{
- d_2_0_Core->f.Uniform4i(location, v0, v1, v2, v3);
-}
-
-inline void QOpenGLFunctions_3_3_Compatibility::glUniform3i(GLint location, GLint v0, GLint v1, GLint v2)
-{
- d_2_0_Core->f.Uniform3i(location, v0, v1, v2);
-}
-
-inline void QOpenGLFunctions_3_3_Compatibility::glUniform2i(GLint location, GLint v0, GLint v1)
-{
- d_2_0_Core->f.Uniform2i(location, v0, v1);
-}
-
-inline void QOpenGLFunctions_3_3_Compatibility::glUniform1i(GLint location, GLint v0)
-{
- d_2_0_Core->f.Uniform1i(location, v0);
-}
-
-inline void QOpenGLFunctions_3_3_Compatibility::glUniform4f(GLint location, GLfloat v0, GLfloat v1, GLfloat v2, GLfloat v3)
-{
- d_2_0_Core->f.Uniform4f(location, v0, v1, v2, v3);
-}
-
-inline void QOpenGLFunctions_3_3_Compatibility::glUniform3f(GLint location, GLfloat v0, GLfloat v1, GLfloat v2)
-{
- d_2_0_Core->f.Uniform3f(location, v0, v1, v2);
-}
-
-inline void QOpenGLFunctions_3_3_Compatibility::glUniform2f(GLint location, GLfloat v0, GLfloat v1)
-{
- d_2_0_Core->f.Uniform2f(location, v0, v1);
-}
-
-inline void QOpenGLFunctions_3_3_Compatibility::glUniform1f(GLint location, GLfloat v0)
-{
- d_2_0_Core->f.Uniform1f(location, v0);
-}
-
-inline void QOpenGLFunctions_3_3_Compatibility::glUseProgram(GLuint program)
-{
- d_2_0_Core->f.UseProgram(program);
-}
-
-inline void QOpenGLFunctions_3_3_Compatibility::glShaderSource(GLuint shader, GLsizei count, const GLchar* const *string, const GLint *length)
-{
- d_2_0_Core->f.ShaderSource(shader, count, string, length);
-}
-
-inline void QOpenGLFunctions_3_3_Compatibility::glLinkProgram(GLuint program)
-{
- d_2_0_Core->f.LinkProgram(program);
-}
-
-inline GLboolean QOpenGLFunctions_3_3_Compatibility::glIsShader(GLuint shader)
-{
- return d_2_0_Core->f.IsShader(shader);
-}
-
-inline GLboolean QOpenGLFunctions_3_3_Compatibility::glIsProgram(GLuint program)
-{
- return d_2_0_Core->f.IsProgram(program);
-}
-
-inline void QOpenGLFunctions_3_3_Compatibility::glGetVertexAttribPointerv(GLuint index, GLenum pname, GLvoid* *pointer)
-{
- d_2_0_Core->f.GetVertexAttribPointerv(index, pname, pointer);
-}
-
-inline void QOpenGLFunctions_3_3_Compatibility::glGetVertexAttribiv(GLuint index, GLenum pname, GLint *params)
-{
- d_2_0_Core->f.GetVertexAttribiv(index, pname, params);
-}
-
-inline void QOpenGLFunctions_3_3_Compatibility::glGetVertexAttribfv(GLuint index, GLenum pname, GLfloat *params)
-{
- d_2_0_Core->f.GetVertexAttribfv(index, pname, params);
-}
-
-inline void QOpenGLFunctions_3_3_Compatibility::glGetVertexAttribdv(GLuint index, GLenum pname, GLdouble *params)
-{
- d_2_0_Core->f.GetVertexAttribdv(index, pname, params);
-}
-
-inline void QOpenGLFunctions_3_3_Compatibility::glGetUniformiv(GLuint program, GLint location, GLint *params)
-{
- d_2_0_Core->f.GetUniformiv(program, location, params);
-}
-
-inline void QOpenGLFunctions_3_3_Compatibility::glGetUniformfv(GLuint program, GLint location, GLfloat *params)
-{
- d_2_0_Core->f.GetUniformfv(program, location, params);
-}
-
-inline GLint QOpenGLFunctions_3_3_Compatibility::glGetUniformLocation(GLuint program, const GLchar *name)
-{
- return d_2_0_Core->f.GetUniformLocation(program, name);
-}
-
-inline void QOpenGLFunctions_3_3_Compatibility::glGetShaderSource(GLuint shader, GLsizei bufSize, GLsizei *length, GLchar *source)
-{
- d_2_0_Core->f.GetShaderSource(shader, bufSize, length, source);
-}
-
-inline void QOpenGLFunctions_3_3_Compatibility::glGetShaderInfoLog(GLuint shader, GLsizei bufSize, GLsizei *length, GLchar *infoLog)
-{
- d_2_0_Core->f.GetShaderInfoLog(shader, bufSize, length, infoLog);
-}
-
-inline void QOpenGLFunctions_3_3_Compatibility::glGetShaderiv(GLuint shader, GLenum pname, GLint *params)
-{
- d_2_0_Core->f.GetShaderiv(shader, pname, params);
-}
-
-inline void QOpenGLFunctions_3_3_Compatibility::glGetProgramInfoLog(GLuint program, GLsizei bufSize, GLsizei *length, GLchar *infoLog)
-{
- d_2_0_Core->f.GetProgramInfoLog(program, bufSize, length, infoLog);
-}
-
-inline void QOpenGLFunctions_3_3_Compatibility::glGetProgramiv(GLuint program, GLenum pname, GLint *params)
-{
- d_2_0_Core->f.GetProgramiv(program, pname, params);
-}
-
-inline GLint QOpenGLFunctions_3_3_Compatibility::glGetAttribLocation(GLuint program, const GLchar *name)
-{
- return d_2_0_Core->f.GetAttribLocation(program, name);
-}
-
-inline void QOpenGLFunctions_3_3_Compatibility::glGetAttachedShaders(GLuint program, GLsizei maxCount, GLsizei *count, GLuint *obj)
-{
- d_2_0_Core->f.GetAttachedShaders(program, maxCount, count, obj);
-}
-
-inline void QOpenGLFunctions_3_3_Compatibility::glGetActiveUniform(GLuint program, GLuint index, GLsizei bufSize, GLsizei *length, GLint *size, GLenum *type, GLchar *name)
-{
- d_2_0_Core->f.GetActiveUniform(program, index, bufSize, length, size, type, name);
-}
-
-inline void QOpenGLFunctions_3_3_Compatibility::glGetActiveAttrib(GLuint program, GLuint index, GLsizei bufSize, GLsizei *length, GLint *size, GLenum *type, GLchar *name)
-{
- d_2_0_Core->f.GetActiveAttrib(program, index, bufSize, length, size, type, name);
-}
-
-inline void QOpenGLFunctions_3_3_Compatibility::glEnableVertexAttribArray(GLuint index)
-{
- d_2_0_Core->f.EnableVertexAttribArray(index);
-}
-
-inline void QOpenGLFunctions_3_3_Compatibility::glDisableVertexAttribArray(GLuint index)
-{
- d_2_0_Core->f.DisableVertexAttribArray(index);
-}
-
-inline void QOpenGLFunctions_3_3_Compatibility::glDetachShader(GLuint program, GLuint shader)
-{
- d_2_0_Core->f.DetachShader(program, shader);
-}
-
-inline void QOpenGLFunctions_3_3_Compatibility::glDeleteShader(GLuint shader)
-{
- d_2_0_Core->f.DeleteShader(shader);
-}
-
-inline void QOpenGLFunctions_3_3_Compatibility::glDeleteProgram(GLuint program)
-{
- d_2_0_Core->f.DeleteProgram(program);
-}
-
-inline GLuint QOpenGLFunctions_3_3_Compatibility::glCreateShader(GLenum type)
-{
- return d_2_0_Core->f.CreateShader(type);
-}
-
-inline GLuint QOpenGLFunctions_3_3_Compatibility::glCreateProgram()
-{
- return d_2_0_Core->f.CreateProgram();
-}
-
-inline void QOpenGLFunctions_3_3_Compatibility::glCompileShader(GLuint shader)
-{
- d_2_0_Core->f.CompileShader(shader);
-}
-
-inline void QOpenGLFunctions_3_3_Compatibility::glBindAttribLocation(GLuint program, GLuint index, const GLchar *name)
-{
- d_2_0_Core->f.BindAttribLocation(program, index, name);
-}
-
-inline void QOpenGLFunctions_3_3_Compatibility::glAttachShader(GLuint program, GLuint shader)
-{
- d_2_0_Core->f.AttachShader(program, shader);
-}
-
-inline void QOpenGLFunctions_3_3_Compatibility::glStencilMaskSeparate(GLenum face, GLuint mask)
-{
- d_2_0_Core->f.StencilMaskSeparate(face, mask);
-}
-
-inline void QOpenGLFunctions_3_3_Compatibility::glStencilFuncSeparate(GLenum face, GLenum func, GLint ref, GLuint mask)
-{
- d_2_0_Core->f.StencilFuncSeparate(face, func, ref, mask);
-}
-
-inline void QOpenGLFunctions_3_3_Compatibility::glStencilOpSeparate(GLenum face, GLenum sfail, GLenum dpfail, GLenum dppass)
-{
- d_2_0_Core->f.StencilOpSeparate(face, sfail, dpfail, dppass);
-}
-
-inline void QOpenGLFunctions_3_3_Compatibility::glDrawBuffers(GLsizei n, const GLenum *bufs)
-{
- d_2_0_Core->f.DrawBuffers(n, bufs);
-}
-
-inline void QOpenGLFunctions_3_3_Compatibility::glBlendEquationSeparate(GLenum modeRGB, GLenum modeAlpha)
-{
- d_2_0_Core->f.BlendEquationSeparate(modeRGB, modeAlpha);
-}
-
-
-// OpenGL 2.1 core functions
-inline void QOpenGLFunctions_3_3_Compatibility::glUniformMatrix4x3fv(GLint location, GLsizei count, GLboolean transpose, const GLfloat *value)
-{
- d_2_1_Core->f.UniformMatrix4x3fv(location, count, transpose, value);
-}
-
-inline void QOpenGLFunctions_3_3_Compatibility::glUniformMatrix3x4fv(GLint location, GLsizei count, GLboolean transpose, const GLfloat *value)
-{
- d_2_1_Core->f.UniformMatrix3x4fv(location, count, transpose, value);
-}
-
-inline void QOpenGLFunctions_3_3_Compatibility::glUniformMatrix4x2fv(GLint location, GLsizei count, GLboolean transpose, const GLfloat *value)
-{
- d_2_1_Core->f.UniformMatrix4x2fv(location, count, transpose, value);
-}
-
-inline void QOpenGLFunctions_3_3_Compatibility::glUniformMatrix2x4fv(GLint location, GLsizei count, GLboolean transpose, const GLfloat *value)
-{
- d_2_1_Core->f.UniformMatrix2x4fv(location, count, transpose, value);
-}
-
-inline void QOpenGLFunctions_3_3_Compatibility::glUniformMatrix3x2fv(GLint location, GLsizei count, GLboolean transpose, const GLfloat *value)
-{
- d_2_1_Core->f.UniformMatrix3x2fv(location, count, transpose, value);
-}
-
-inline void QOpenGLFunctions_3_3_Compatibility::glUniformMatrix2x3fv(GLint location, GLsizei count, GLboolean transpose, const GLfloat *value)
-{
- d_2_1_Core->f.UniformMatrix2x3fv(location, count, transpose, value);
-}
-
-
-// OpenGL 3.0 core functions
-inline GLboolean QOpenGLFunctions_3_3_Compatibility::glIsVertexArray(GLuint array)
-{
- return d_3_0_Core->f.IsVertexArray(array);
-}
-
-inline void QOpenGLFunctions_3_3_Compatibility::glGenVertexArrays(GLsizei n, GLuint *arrays)
-{
- d_3_0_Core->f.GenVertexArrays(n, arrays);
-}
-
-inline void QOpenGLFunctions_3_3_Compatibility::glDeleteVertexArrays(GLsizei n, const GLuint *arrays)
-{
- d_3_0_Core->f.DeleteVertexArrays(n, arrays);
-}
-
-inline void QOpenGLFunctions_3_3_Compatibility::glBindVertexArray(GLuint array)
-{
- d_3_0_Core->f.BindVertexArray(array);
-}
-
-inline void QOpenGLFunctions_3_3_Compatibility::glFlushMappedBufferRange(GLenum target, GLintptr offset, GLsizeiptr length)
-{
- d_3_0_Core->f.FlushMappedBufferRange(target, offset, length);
-}
-
-inline GLvoid* QOpenGLFunctions_3_3_Compatibility::glMapBufferRange(GLenum target, GLintptr offset, GLsizeiptr length, GLbitfield access)
-{
- return d_3_0_Core->f.MapBufferRange(target, offset, length, access);
-}
-
-inline void QOpenGLFunctions_3_3_Compatibility::glFramebufferTextureLayer(GLenum target, GLenum attachment, GLuint texture, GLint level, GLint layer)
-{
- d_3_0_Core->f.FramebufferTextureLayer(target, attachment, texture, level, layer);
-}
-
-inline void QOpenGLFunctions_3_3_Compatibility::glRenderbufferStorageMultisample(GLenum target, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height)
-{
- d_3_0_Core->f.RenderbufferStorageMultisample(target, samples, internalformat, width, height);
-}
-
-inline void QOpenGLFunctions_3_3_Compatibility::glBlitFramebuffer(GLint srcX0, GLint srcY0, GLint srcX1, GLint srcY1, GLint dstX0, GLint dstY0, GLint dstX1, GLint dstY1, GLbitfield mask, GLenum filter)
-{
- d_3_0_Core->f.BlitFramebuffer(srcX0, srcY0, srcX1, srcY1, dstX0, dstY0, dstX1, dstY1, mask, filter);
-}
-
-inline void QOpenGLFunctions_3_3_Compatibility::glGenerateMipmap(GLenum target)
-{
- d_3_0_Core->f.GenerateMipmap(target);
-}
-
-inline void QOpenGLFunctions_3_3_Compatibility::glGetFramebufferAttachmentParameteriv(GLenum target, GLenum attachment, GLenum pname, GLint *params)
-{
- d_3_0_Core->f.GetFramebufferAttachmentParameteriv(target, attachment, pname, params);
-}
-
-inline void QOpenGLFunctions_3_3_Compatibility::glFramebufferRenderbuffer(GLenum target, GLenum attachment, GLenum renderbuffertarget, GLuint renderbuffer)
-{
- d_3_0_Core->f.FramebufferRenderbuffer(target, attachment, renderbuffertarget, renderbuffer);
-}
-
-inline void QOpenGLFunctions_3_3_Compatibility::glFramebufferTexture3D(GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level, GLint zoffset)
-{
- d_3_0_Core->f.FramebufferTexture3D(target, attachment, textarget, texture, level, zoffset);
-}
-
-inline void QOpenGLFunctions_3_3_Compatibility::glFramebufferTexture2D(GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level)
-{
- d_3_0_Core->f.FramebufferTexture2D(target, attachment, textarget, texture, level);
-}
-
-inline void QOpenGLFunctions_3_3_Compatibility::glFramebufferTexture1D(GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level)
-{
- d_3_0_Core->f.FramebufferTexture1D(target, attachment, textarget, texture, level);
-}
-
-inline GLenum QOpenGLFunctions_3_3_Compatibility::glCheckFramebufferStatus(GLenum target)
-{
- return d_3_0_Core->f.CheckFramebufferStatus(target);
-}
-
-inline void QOpenGLFunctions_3_3_Compatibility::glGenFramebuffers(GLsizei n, GLuint *framebuffers)
-{
- d_3_0_Core->f.GenFramebuffers(n, framebuffers);
-}
-
-inline void QOpenGLFunctions_3_3_Compatibility::glDeleteFramebuffers(GLsizei n, const GLuint *framebuffers)
-{
- d_3_0_Core->f.DeleteFramebuffers(n, framebuffers);
-}
-
-inline void QOpenGLFunctions_3_3_Compatibility::glBindFramebuffer(GLenum target, GLuint framebuffer)
-{
- d_3_0_Core->f.BindFramebuffer(target, framebuffer);
-}
-
-inline GLboolean QOpenGLFunctions_3_3_Compatibility::glIsFramebuffer(GLuint framebuffer)
-{
- return d_3_0_Core->f.IsFramebuffer(framebuffer);
-}
-
-inline void QOpenGLFunctions_3_3_Compatibility::glGetRenderbufferParameteriv(GLenum target, GLenum pname, GLint *params)
-{
- d_3_0_Core->f.GetRenderbufferParameteriv(target, pname, params);
-}
-
-inline void QOpenGLFunctions_3_3_Compatibility::glRenderbufferStorage(GLenum target, GLenum internalformat, GLsizei width, GLsizei height)
-{
- d_3_0_Core->f.RenderbufferStorage(target, internalformat, width, height);
-}
-
-inline void QOpenGLFunctions_3_3_Compatibility::glGenRenderbuffers(GLsizei n, GLuint *renderbuffers)
-{
- d_3_0_Core->f.GenRenderbuffers(n, renderbuffers);
-}
-
-inline void QOpenGLFunctions_3_3_Compatibility::glDeleteRenderbuffers(GLsizei n, const GLuint *renderbuffers)
-{
- d_3_0_Core->f.DeleteRenderbuffers(n, renderbuffers);
-}
-
-inline void QOpenGLFunctions_3_3_Compatibility::glBindRenderbuffer(GLenum target, GLuint renderbuffer)
-{
- d_3_0_Core->f.BindRenderbuffer(target, renderbuffer);
-}
-
-inline GLboolean QOpenGLFunctions_3_3_Compatibility::glIsRenderbuffer(GLuint renderbuffer)
-{
- return d_3_0_Core->f.IsRenderbuffer(renderbuffer);
-}
-
-inline const GLubyte * QOpenGLFunctions_3_3_Compatibility::glGetStringi(GLenum name, GLuint index)
-{
- return d_3_0_Core->f.GetStringi(name, index);
-}
-
-inline void QOpenGLFunctions_3_3_Compatibility::glClearBufferfi(GLenum buffer, GLint drawbuffer, GLfloat depth, GLint stencil)
-{
- d_3_0_Core->f.ClearBufferfi(buffer, drawbuffer, depth, stencil);
-}
-
-inline void QOpenGLFunctions_3_3_Compatibility::glClearBufferfv(GLenum buffer, GLint drawbuffer, const GLfloat *value)
-{
- d_3_0_Core->f.ClearBufferfv(buffer, drawbuffer, value);
-}
-
-inline void QOpenGLFunctions_3_3_Compatibility::glClearBufferuiv(GLenum buffer, GLint drawbuffer, const GLuint *value)
-{
- d_3_0_Core->f.ClearBufferuiv(buffer, drawbuffer, value);
-}
-
-inline void QOpenGLFunctions_3_3_Compatibility::glClearBufferiv(GLenum buffer, GLint drawbuffer, const GLint *value)
-{
- d_3_0_Core->f.ClearBufferiv(buffer, drawbuffer, value);
-}
-
-inline void QOpenGLFunctions_3_3_Compatibility::glGetTexParameterIuiv(GLenum target, GLenum pname, GLuint *params)
-{
- d_3_0_Core->f.GetTexParameterIuiv(target, pname, params);
-}
-
-inline void QOpenGLFunctions_3_3_Compatibility::glGetTexParameterIiv(GLenum target, GLenum pname, GLint *params)
-{
- d_3_0_Core->f.GetTexParameterIiv(target, pname, params);
-}
-
-inline void QOpenGLFunctions_3_3_Compatibility::glTexParameterIuiv(GLenum target, GLenum pname, const GLuint *params)
-{
- d_3_0_Core->f.TexParameterIuiv(target, pname, params);
-}
-
-inline void QOpenGLFunctions_3_3_Compatibility::glTexParameterIiv(GLenum target, GLenum pname, const GLint *params)
-{
- d_3_0_Core->f.TexParameterIiv(target, pname, params);
-}
-
-inline void QOpenGLFunctions_3_3_Compatibility::glUniform4uiv(GLint location, GLsizei count, const GLuint *value)
-{
- d_3_0_Core->f.Uniform4uiv(location, count, value);
-}
-
-inline void QOpenGLFunctions_3_3_Compatibility::glUniform3uiv(GLint location, GLsizei count, const GLuint *value)
-{
- d_3_0_Core->f.Uniform3uiv(location, count, value);
-}
-
-inline void QOpenGLFunctions_3_3_Compatibility::glUniform2uiv(GLint location, GLsizei count, const GLuint *value)
-{
- d_3_0_Core->f.Uniform2uiv(location, count, value);
-}
-
-inline void QOpenGLFunctions_3_3_Compatibility::glUniform1uiv(GLint location, GLsizei count, const GLuint *value)
-{
- d_3_0_Core->f.Uniform1uiv(location, count, value);
-}
-
-inline void QOpenGLFunctions_3_3_Compatibility::glUniform4ui(GLint location, GLuint v0, GLuint v1, GLuint v2, GLuint v3)
-{
- d_3_0_Core->f.Uniform4ui(location, v0, v1, v2, v3);
-}
-
-inline void QOpenGLFunctions_3_3_Compatibility::glUniform3ui(GLint location, GLuint v0, GLuint v1, GLuint v2)
-{
- d_3_0_Core->f.Uniform3ui(location, v0, v1, v2);
-}
-
-inline void QOpenGLFunctions_3_3_Compatibility::glUniform2ui(GLint location, GLuint v0, GLuint v1)
-{
- d_3_0_Core->f.Uniform2ui(location, v0, v1);
-}
-
-inline void QOpenGLFunctions_3_3_Compatibility::glUniform1ui(GLint location, GLuint v0)
-{
- d_3_0_Core->f.Uniform1ui(location, v0);
-}
-
-inline GLint QOpenGLFunctions_3_3_Compatibility::glGetFragDataLocation(GLuint program, const GLchar *name)
-{
- return d_3_0_Core->f.GetFragDataLocation(program, name);
-}
-
-inline void QOpenGLFunctions_3_3_Compatibility::glBindFragDataLocation(GLuint program, GLuint color, const GLchar *name)
-{
- d_3_0_Core->f.BindFragDataLocation(program, color, name);
-}
-
-inline void QOpenGLFunctions_3_3_Compatibility::glGetUniformuiv(GLuint program, GLint location, GLuint *params)
-{
- d_3_0_Core->f.GetUniformuiv(program, location, params);
-}
-
-inline void QOpenGLFunctions_3_3_Compatibility::glGetVertexAttribIuiv(GLuint index, GLenum pname, GLuint *params)
-{
- d_3_0_Core->f.GetVertexAttribIuiv(index, pname, params);
-}
-
-inline void QOpenGLFunctions_3_3_Compatibility::glGetVertexAttribIiv(GLuint index, GLenum pname, GLint *params)
-{
- d_3_0_Core->f.GetVertexAttribIiv(index, pname, params);
-}
-
-inline void QOpenGLFunctions_3_3_Compatibility::glVertexAttribIPointer(GLuint index, GLint size, GLenum type, GLsizei stride, const GLvoid *pointer)
-{
- d_3_0_Core->f.VertexAttribIPointer(index, size, type, stride, pointer);
-}
-
-inline void QOpenGLFunctions_3_3_Compatibility::glEndConditionalRender()
-{
- d_3_0_Core->f.EndConditionalRender();
-}
-
-inline void QOpenGLFunctions_3_3_Compatibility::glBeginConditionalRender(GLuint id, GLenum mode)
-{
- d_3_0_Core->f.BeginConditionalRender(id, mode);
-}
-
-inline void QOpenGLFunctions_3_3_Compatibility::glClampColor(GLenum target, GLenum clamp)
-{
- d_3_0_Core->f.ClampColor(target, clamp);
-}
-
-inline void QOpenGLFunctions_3_3_Compatibility::glGetTransformFeedbackVarying(GLuint program, GLuint index, GLsizei bufSize, GLsizei *length, GLsizei *size, GLenum *type, GLchar *name)
-{
- d_3_0_Core->f.GetTransformFeedbackVarying(program, index, bufSize, length, size, type, name);
-}
-
-inline void QOpenGLFunctions_3_3_Compatibility::glTransformFeedbackVaryings(GLuint program, GLsizei count, const GLchar* const *varyings, GLenum bufferMode)
-{
- d_3_0_Core->f.TransformFeedbackVaryings(program, count, varyings, bufferMode);
-}
-
-inline void QOpenGLFunctions_3_3_Compatibility::glBindBufferBase(GLenum target, GLuint index, GLuint buffer)
-{
- d_3_0_Core->f.BindBufferBase(target, index, buffer);
-}
-
-inline void QOpenGLFunctions_3_3_Compatibility::glBindBufferRange(GLenum target, GLuint index, GLuint buffer, GLintptr offset, GLsizeiptr size)
-{
- d_3_0_Core->f.BindBufferRange(target, index, buffer, offset, size);
-}
-
-inline void QOpenGLFunctions_3_3_Compatibility::glEndTransformFeedback()
-{
- d_3_0_Core->f.EndTransformFeedback();
-}
-
-inline void QOpenGLFunctions_3_3_Compatibility::glBeginTransformFeedback(GLenum primitiveMode)
-{
- d_3_0_Core->f.BeginTransformFeedback(primitiveMode);
-}
-
-inline GLboolean QOpenGLFunctions_3_3_Compatibility::glIsEnabledi(GLenum target, GLuint index)
-{
- return d_3_0_Core->f.IsEnabledi(target, index);
-}
-
-inline void QOpenGLFunctions_3_3_Compatibility::glDisablei(GLenum target, GLuint index)
-{
- d_3_0_Core->f.Disablei(target, index);
-}
-
-inline void QOpenGLFunctions_3_3_Compatibility::glEnablei(GLenum target, GLuint index)
-{
- d_3_0_Core->f.Enablei(target, index);
-}
-
-inline void QOpenGLFunctions_3_3_Compatibility::glGetIntegeri_v(GLenum target, GLuint index, GLint *data)
-{
- d_3_0_Core->f.GetIntegeri_v(target, index, data);
-}
-
-inline void QOpenGLFunctions_3_3_Compatibility::glGetBooleani_v(GLenum target, GLuint index, GLboolean *data)
-{
- d_3_0_Core->f.GetBooleani_v(target, index, data);
-}
-
-inline void QOpenGLFunctions_3_3_Compatibility::glColorMaski(GLuint index, GLboolean r, GLboolean g, GLboolean b, GLboolean a)
-{
- d_3_0_Core->f.ColorMaski(index, r, g, b, a);
-}
-
-
-// OpenGL 3.1 core functions
-inline void QOpenGLFunctions_3_3_Compatibility::glCopyBufferSubData(GLenum readTarget, GLenum writeTarget, GLintptr readOffset, GLintptr writeOffset, GLsizeiptr size)
-{
- d_3_1_Core->f.CopyBufferSubData(readTarget, writeTarget, readOffset, writeOffset, size);
-}
-
-inline void QOpenGLFunctions_3_3_Compatibility::glUniformBlockBinding(GLuint program, GLuint uniformBlockIndex, GLuint uniformBlockBinding)
-{
- d_3_1_Core->f.UniformBlockBinding(program, uniformBlockIndex, uniformBlockBinding);
-}
-
-inline void QOpenGLFunctions_3_3_Compatibility::glGetActiveUniformBlockName(GLuint program, GLuint uniformBlockIndex, GLsizei bufSize, GLsizei *length, GLchar *uniformBlockName)
-{
- d_3_1_Core->f.GetActiveUniformBlockName(program, uniformBlockIndex, bufSize, length, uniformBlockName);
-}
-
-inline void QOpenGLFunctions_3_3_Compatibility::glGetActiveUniformBlockiv(GLuint program, GLuint uniformBlockIndex, GLenum pname, GLint *params)
-{
- d_3_1_Core->f.GetActiveUniformBlockiv(program, uniformBlockIndex, pname, params);
-}
-
-inline GLuint QOpenGLFunctions_3_3_Compatibility::glGetUniformBlockIndex(GLuint program, const GLchar *uniformBlockName)
-{
- return d_3_1_Core->f.GetUniformBlockIndex(program, uniformBlockName);
-}
-
-inline void QOpenGLFunctions_3_3_Compatibility::glGetActiveUniformName(GLuint program, GLuint uniformIndex, GLsizei bufSize, GLsizei *length, GLchar *uniformName)
-{
- d_3_1_Core->f.GetActiveUniformName(program, uniformIndex, bufSize, length, uniformName);
-}
-
-inline void QOpenGLFunctions_3_3_Compatibility::glGetActiveUniformsiv(GLuint program, GLsizei uniformCount, const GLuint *uniformIndices, GLenum pname, GLint *params)
-{
- d_3_1_Core->f.GetActiveUniformsiv(program, uniformCount, uniformIndices, pname, params);
-}
-
-inline void QOpenGLFunctions_3_3_Compatibility::glGetUniformIndices(GLuint program, GLsizei uniformCount, const GLchar* const *uniformNames, GLuint *uniformIndices)
-{
- d_3_1_Core->f.GetUniformIndices(program, uniformCount, uniformNames, uniformIndices);
-}
-
-inline void QOpenGLFunctions_3_3_Compatibility::glPrimitiveRestartIndex(GLuint index)
-{
- d_3_1_Core->f.PrimitiveRestartIndex(index);
-}
-
-inline void QOpenGLFunctions_3_3_Compatibility::glTexBuffer(GLenum target, GLenum internalformat, GLuint buffer)
-{
- d_3_1_Core->f.TexBuffer(target, internalformat, buffer);
-}
-
-inline void QOpenGLFunctions_3_3_Compatibility::glDrawElementsInstanced(GLenum mode, GLsizei count, GLenum type, const GLvoid *indices, GLsizei instancecount)
-{
- d_3_1_Core->f.DrawElementsInstanced(mode, count, type, indices, instancecount);
-}
-
-inline void QOpenGLFunctions_3_3_Compatibility::glDrawArraysInstanced(GLenum mode, GLint first, GLsizei count, GLsizei instancecount)
-{
- d_3_1_Core->f.DrawArraysInstanced(mode, first, count, instancecount);
-}
-
-
-// OpenGL 3.2 core functions
-inline void QOpenGLFunctions_3_3_Compatibility::glSampleMaski(GLuint index, GLbitfield mask)
-{
- d_3_2_Core->f.SampleMaski(index, mask);
-}
-
-inline void QOpenGLFunctions_3_3_Compatibility::glGetMultisamplefv(GLenum pname, GLuint index, GLfloat *val)
-{
- d_3_2_Core->f.GetMultisamplefv(pname, index, val);
-}
-
-inline void QOpenGLFunctions_3_3_Compatibility::glTexImage3DMultisample(GLenum target, GLsizei samples, GLint internalformat, GLsizei width, GLsizei height, GLsizei depth, GLboolean fixedsamplelocations)
-{
- d_3_2_Core->f.TexImage3DMultisample(target, samples, internalformat, width, height, depth, fixedsamplelocations);
-}
-
-inline void QOpenGLFunctions_3_3_Compatibility::glTexImage2DMultisample(GLenum target, GLsizei samples, GLint internalformat, GLsizei width, GLsizei height, GLboolean fixedsamplelocations)
-{
- d_3_2_Core->f.TexImage2DMultisample(target, samples, internalformat, width, height, fixedsamplelocations);
-}
-
-inline void QOpenGLFunctions_3_3_Compatibility::glGetSynciv(GLsync sync, GLenum pname, GLsizei bufSize, GLsizei *length, GLint *values)
-{
- d_3_2_Core->f.GetSynciv(sync, pname, bufSize, length, values);
-}
-
-inline void QOpenGLFunctions_3_3_Compatibility::glGetInteger64v(GLenum pname, GLint64 *params)
-{
- d_3_2_Core->f.GetInteger64v(pname, params);
-}
-
-inline void QOpenGLFunctions_3_3_Compatibility::glWaitSync(GLsync sync, GLbitfield flags, GLuint64 timeout)
-{
- d_3_2_Core->f.WaitSync(sync, flags, timeout);
-}
-
-inline GLenum QOpenGLFunctions_3_3_Compatibility::glClientWaitSync(GLsync sync, GLbitfield flags, GLuint64 timeout)
-{
- return d_3_2_Core->f.ClientWaitSync(sync, flags, timeout);
-}
-
-inline void QOpenGLFunctions_3_3_Compatibility::glDeleteSync(GLsync sync)
-{
- d_3_2_Core->f.DeleteSync(sync);
-}
-
-inline GLboolean QOpenGLFunctions_3_3_Compatibility::glIsSync(GLsync sync)
-{
- return d_3_2_Core->f.IsSync(sync);
-}
-
-inline GLsync QOpenGLFunctions_3_3_Compatibility::glFenceSync(GLenum condition, GLbitfield flags)
-{
- return d_3_2_Core->f.FenceSync(condition, flags);
-}
-
-inline void QOpenGLFunctions_3_3_Compatibility::glProvokingVertex(GLenum mode)
-{
- d_3_2_Core->f.ProvokingVertex(mode);
-}
-
-inline void QOpenGLFunctions_3_3_Compatibility::glMultiDrawElementsBaseVertex(GLenum mode, const GLsizei *count, GLenum type, const GLvoid* const *indices, GLsizei drawcount, const GLint *basevertex)
-{
- d_3_2_Core->f.MultiDrawElementsBaseVertex(mode, count, type, indices, drawcount, basevertex);
-}
-
-inline void QOpenGLFunctions_3_3_Compatibility::glDrawElementsInstancedBaseVertex(GLenum mode, GLsizei count, GLenum type, const GLvoid *indices, GLsizei instancecount, GLint basevertex)
-{
- d_3_2_Core->f.DrawElementsInstancedBaseVertex(mode, count, type, indices, instancecount, basevertex);
-}
-
-inline void QOpenGLFunctions_3_3_Compatibility::glDrawRangeElementsBaseVertex(GLenum mode, GLuint start, GLuint end, GLsizei count, GLenum type, const GLvoid *indices, GLint basevertex)
-{
- d_3_2_Core->f.DrawRangeElementsBaseVertex(mode, start, end, count, type, indices, basevertex);
-}
-
-inline void QOpenGLFunctions_3_3_Compatibility::glDrawElementsBaseVertex(GLenum mode, GLsizei count, GLenum type, const GLvoid *indices, GLint basevertex)
-{
- d_3_2_Core->f.DrawElementsBaseVertex(mode, count, type, indices, basevertex);
-}
-
-inline void QOpenGLFunctions_3_3_Compatibility::glFramebufferTexture(GLenum target, GLenum attachment, GLuint texture, GLint level)
-{
- d_3_2_Core->f.FramebufferTexture(target, attachment, texture, level);
-}
-
-inline void QOpenGLFunctions_3_3_Compatibility::glGetBufferParameteri64v(GLenum target, GLenum pname, GLint64 *params)
-{
- d_3_2_Core->f.GetBufferParameteri64v(target, pname, params);
-}
-
-inline void QOpenGLFunctions_3_3_Compatibility::glGetInteger64i_v(GLenum target, GLuint index, GLint64 *data)
-{
- d_3_2_Core->f.GetInteger64i_v(target, index, data);
-}
-
-
-// OpenGL 3.3 core functions
-inline void QOpenGLFunctions_3_3_Compatibility::glVertexAttribP4uiv(GLuint index, GLenum type, GLboolean normalized, const GLuint *value)
-{
- d_3_3_Core->f.VertexAttribP4uiv(index, type, normalized, value);
-}
-
-inline void QOpenGLFunctions_3_3_Compatibility::glVertexAttribP4ui(GLuint index, GLenum type, GLboolean normalized, GLuint value)
-{
- d_3_3_Core->f.VertexAttribP4ui(index, type, normalized, value);
-}
-
-inline void QOpenGLFunctions_3_3_Compatibility::glVertexAttribP3uiv(GLuint index, GLenum type, GLboolean normalized, const GLuint *value)
-{
- d_3_3_Core->f.VertexAttribP3uiv(index, type, normalized, value);
-}
-
-inline void QOpenGLFunctions_3_3_Compatibility::glVertexAttribP3ui(GLuint index, GLenum type, GLboolean normalized, GLuint value)
-{
- d_3_3_Core->f.VertexAttribP3ui(index, type, normalized, value);
-}
-
-inline void QOpenGLFunctions_3_3_Compatibility::glVertexAttribP2uiv(GLuint index, GLenum type, GLboolean normalized, const GLuint *value)
-{
- d_3_3_Core->f.VertexAttribP2uiv(index, type, normalized, value);
-}
-
-inline void QOpenGLFunctions_3_3_Compatibility::glVertexAttribP2ui(GLuint index, GLenum type, GLboolean normalized, GLuint value)
-{
- d_3_3_Core->f.VertexAttribP2ui(index, type, normalized, value);
-}
-
-inline void QOpenGLFunctions_3_3_Compatibility::glVertexAttribP1uiv(GLuint index, GLenum type, GLboolean normalized, const GLuint *value)
-{
- d_3_3_Core->f.VertexAttribP1uiv(index, type, normalized, value);
-}
-
-inline void QOpenGLFunctions_3_3_Compatibility::glVertexAttribP1ui(GLuint index, GLenum type, GLboolean normalized, GLuint value)
-{
- d_3_3_Core->f.VertexAttribP1ui(index, type, normalized, value);
-}
-
-inline void QOpenGLFunctions_3_3_Compatibility::glSecondaryColorP3uiv(GLenum type, const GLuint *color)
-{
- d_3_3_Deprecated->f.SecondaryColorP3uiv(type, color);
-}
-
-inline void QOpenGLFunctions_3_3_Compatibility::glSecondaryColorP3ui(GLenum type, GLuint color)
-{
- d_3_3_Deprecated->f.SecondaryColorP3ui(type, color);
-}
-
-inline void QOpenGLFunctions_3_3_Compatibility::glColorP4uiv(GLenum type, const GLuint *color)
-{
- d_3_3_Deprecated->f.ColorP4uiv(type, color);
-}
-
-inline void QOpenGLFunctions_3_3_Compatibility::glColorP4ui(GLenum type, GLuint color)
-{
- d_3_3_Deprecated->f.ColorP4ui(type, color);
-}
-
-inline void QOpenGLFunctions_3_3_Compatibility::glColorP3uiv(GLenum type, const GLuint *color)
-{
- d_3_3_Deprecated->f.ColorP3uiv(type, color);
-}
-
-inline void QOpenGLFunctions_3_3_Compatibility::glColorP3ui(GLenum type, GLuint color)
-{
- d_3_3_Deprecated->f.ColorP3ui(type, color);
-}
-
-inline void QOpenGLFunctions_3_3_Compatibility::glNormalP3uiv(GLenum type, const GLuint *coords)
-{
- d_3_3_Deprecated->f.NormalP3uiv(type, coords);
-}
-
-inline void QOpenGLFunctions_3_3_Compatibility::glNormalP3ui(GLenum type, GLuint coords)
-{
- d_3_3_Deprecated->f.NormalP3ui(type, coords);
-}
-
-inline void QOpenGLFunctions_3_3_Compatibility::glMultiTexCoordP4uiv(GLenum texture, GLenum type, const GLuint *coords)
-{
- d_3_3_Deprecated->f.MultiTexCoordP4uiv(texture, type, coords);
-}
-
-inline void QOpenGLFunctions_3_3_Compatibility::glMultiTexCoordP4ui(GLenum texture, GLenum type, GLuint coords)
-{
- d_3_3_Deprecated->f.MultiTexCoordP4ui(texture, type, coords);
-}
-
-inline void QOpenGLFunctions_3_3_Compatibility::glMultiTexCoordP3uiv(GLenum texture, GLenum type, const GLuint *coords)
-{
- d_3_3_Deprecated->f.MultiTexCoordP3uiv(texture, type, coords);
-}
-
-inline void QOpenGLFunctions_3_3_Compatibility::glMultiTexCoordP3ui(GLenum texture, GLenum type, GLuint coords)
-{
- d_3_3_Deprecated->f.MultiTexCoordP3ui(texture, type, coords);
-}
-
-inline void QOpenGLFunctions_3_3_Compatibility::glMultiTexCoordP2uiv(GLenum texture, GLenum type, const GLuint *coords)
-{
- d_3_3_Deprecated->f.MultiTexCoordP2uiv(texture, type, coords);
-}
-
-inline void QOpenGLFunctions_3_3_Compatibility::glMultiTexCoordP2ui(GLenum texture, GLenum type, GLuint coords)
-{
- d_3_3_Deprecated->f.MultiTexCoordP2ui(texture, type, coords);
-}
-
-inline void QOpenGLFunctions_3_3_Compatibility::glMultiTexCoordP1uiv(GLenum texture, GLenum type, const GLuint *coords)
-{
- d_3_3_Deprecated->f.MultiTexCoordP1uiv(texture, type, coords);
-}
-
-inline void QOpenGLFunctions_3_3_Compatibility::glMultiTexCoordP1ui(GLenum texture, GLenum type, GLuint coords)
-{
- d_3_3_Deprecated->f.MultiTexCoordP1ui(texture, type, coords);
-}
-
-inline void QOpenGLFunctions_3_3_Compatibility::glTexCoordP4uiv(GLenum type, const GLuint *coords)
-{
- d_3_3_Deprecated->f.TexCoordP4uiv(type, coords);
-}
-
-inline void QOpenGLFunctions_3_3_Compatibility::glTexCoordP4ui(GLenum type, GLuint coords)
-{
- d_3_3_Deprecated->f.TexCoordP4ui(type, coords);
-}
-
-inline void QOpenGLFunctions_3_3_Compatibility::glTexCoordP3uiv(GLenum type, const GLuint *coords)
-{
- d_3_3_Deprecated->f.TexCoordP3uiv(type, coords);
-}
-
-inline void QOpenGLFunctions_3_3_Compatibility::glTexCoordP3ui(GLenum type, GLuint coords)
-{
- d_3_3_Deprecated->f.TexCoordP3ui(type, coords);
-}
-
-inline void QOpenGLFunctions_3_3_Compatibility::glTexCoordP2uiv(GLenum type, const GLuint *coords)
-{
- d_3_3_Deprecated->f.TexCoordP2uiv(type, coords);
-}
-
-inline void QOpenGLFunctions_3_3_Compatibility::glTexCoordP2ui(GLenum type, GLuint coords)
-{
- d_3_3_Deprecated->f.TexCoordP2ui(type, coords);
-}
-
-inline void QOpenGLFunctions_3_3_Compatibility::glTexCoordP1uiv(GLenum type, const GLuint *coords)
-{
- d_3_3_Deprecated->f.TexCoordP1uiv(type, coords);
-}
-
-inline void QOpenGLFunctions_3_3_Compatibility::glTexCoordP1ui(GLenum type, GLuint coords)
-{
- d_3_3_Deprecated->f.TexCoordP1ui(type, coords);
-}
-
-inline void QOpenGLFunctions_3_3_Compatibility::glVertexP4uiv(GLenum type, const GLuint *value)
-{
- d_3_3_Deprecated->f.VertexP4uiv(type, value);
-}
-
-inline void QOpenGLFunctions_3_3_Compatibility::glVertexP4ui(GLenum type, GLuint value)
-{
- d_3_3_Deprecated->f.VertexP4ui(type, value);
-}
-
-inline void QOpenGLFunctions_3_3_Compatibility::glVertexP3uiv(GLenum type, const GLuint *value)
-{
- d_3_3_Deprecated->f.VertexP3uiv(type, value);
-}
-
-inline void QOpenGLFunctions_3_3_Compatibility::glVertexP3ui(GLenum type, GLuint value)
-{
- d_3_3_Deprecated->f.VertexP3ui(type, value);
-}
-
-inline void QOpenGLFunctions_3_3_Compatibility::glVertexP2uiv(GLenum type, const GLuint *value)
-{
- d_3_3_Deprecated->f.VertexP2uiv(type, value);
-}
-
-inline void QOpenGLFunctions_3_3_Compatibility::glVertexP2ui(GLenum type, GLuint value)
-{
- d_3_3_Deprecated->f.VertexP2ui(type, value);
-}
-
-inline void QOpenGLFunctions_3_3_Compatibility::glGetQueryObjectui64v(GLuint id, GLenum pname, GLuint64 *params)
-{
- d_3_3_Core->f.GetQueryObjectui64v(id, pname, params);
-}
-
-inline void QOpenGLFunctions_3_3_Compatibility::glGetQueryObjecti64v(GLuint id, GLenum pname, GLint64 *params)
-{
- d_3_3_Core->f.GetQueryObjecti64v(id, pname, params);
-}
-
-inline void QOpenGLFunctions_3_3_Compatibility::glQueryCounter(GLuint id, GLenum target)
-{
- d_3_3_Core->f.QueryCounter(id, target);
-}
-
-inline void QOpenGLFunctions_3_3_Compatibility::glGetSamplerParameterIuiv(GLuint sampler, GLenum pname, GLuint *params)
-{
- d_3_3_Core->f.GetSamplerParameterIuiv(sampler, pname, params);
-}
-
-inline void QOpenGLFunctions_3_3_Compatibility::glGetSamplerParameterfv(GLuint sampler, GLenum pname, GLfloat *params)
-{
- d_3_3_Core->f.GetSamplerParameterfv(sampler, pname, params);
-}
-
-inline void QOpenGLFunctions_3_3_Compatibility::glGetSamplerParameterIiv(GLuint sampler, GLenum pname, GLint *params)
-{
- d_3_3_Core->f.GetSamplerParameterIiv(sampler, pname, params);
-}
-
-inline void QOpenGLFunctions_3_3_Compatibility::glGetSamplerParameteriv(GLuint sampler, GLenum pname, GLint *params)
-{
- d_3_3_Core->f.GetSamplerParameteriv(sampler, pname, params);
-}
-
-inline void QOpenGLFunctions_3_3_Compatibility::glSamplerParameterIuiv(GLuint sampler, GLenum pname, const GLuint *param)
-{
- d_3_3_Core->f.SamplerParameterIuiv(sampler, pname, param);
-}
-
-inline void QOpenGLFunctions_3_3_Compatibility::glSamplerParameterIiv(GLuint sampler, GLenum pname, const GLint *param)
-{
- d_3_3_Core->f.SamplerParameterIiv(sampler, pname, param);
-}
-
-inline void QOpenGLFunctions_3_3_Compatibility::glSamplerParameterfv(GLuint sampler, GLenum pname, const GLfloat *param)
-{
- d_3_3_Core->f.SamplerParameterfv(sampler, pname, param);
-}
-
-inline void QOpenGLFunctions_3_3_Compatibility::glSamplerParameterf(GLuint sampler, GLenum pname, GLfloat param)
-{
- d_3_3_Core->f.SamplerParameterf(sampler, pname, param);
-}
-
-inline void QOpenGLFunctions_3_3_Compatibility::glSamplerParameteriv(GLuint sampler, GLenum pname, const GLint *param)
-{
- d_3_3_Core->f.SamplerParameteriv(sampler, pname, param);
-}
-
-inline void QOpenGLFunctions_3_3_Compatibility::glSamplerParameteri(GLuint sampler, GLenum pname, GLint param)
-{
- d_3_3_Core->f.SamplerParameteri(sampler, pname, param);
-}
-
-inline void QOpenGLFunctions_3_3_Compatibility::glBindSampler(GLuint unit, GLuint sampler)
-{
- d_3_3_Core->f.BindSampler(unit, sampler);
-}
-
-inline GLboolean QOpenGLFunctions_3_3_Compatibility::glIsSampler(GLuint sampler)
-{
- return d_3_3_Core->f.IsSampler(sampler);
-}
-
-inline void QOpenGLFunctions_3_3_Compatibility::glDeleteSamplers(GLsizei count, const GLuint *samplers)
-{
- d_3_3_Core->f.DeleteSamplers(count, samplers);
-}
-
-inline void QOpenGLFunctions_3_3_Compatibility::glGenSamplers(GLsizei count, GLuint *samplers)
-{
- d_3_3_Core->f.GenSamplers(count, samplers);
-}
-
-inline GLint QOpenGLFunctions_3_3_Compatibility::glGetFragDataIndex(GLuint program, const GLchar *name)
-{
- return d_3_3_Core->f.GetFragDataIndex(program, name);
-}
-
-inline void QOpenGLFunctions_3_3_Compatibility::glBindFragDataLocationIndexed(GLuint program, GLuint colorNumber, GLuint index, const GLchar *name)
-{
- d_3_3_Core->f.BindFragDataLocationIndexed(program, colorNumber, index, name);
-}
-
-inline void QOpenGLFunctions_3_3_Compatibility::glVertexAttribDivisor(GLuint index, GLuint divisor)
-{
- d_3_3_Core->f.VertexAttribDivisor(index, divisor);
-}
-
-
-// OpenGL 1.0 deprecated functions
-inline void QOpenGLFunctions_3_3_Compatibility::glTranslatef(GLfloat x, GLfloat y, GLfloat z)
-{
- d_1_0_Deprecated->f.Translatef(x, y, z);
-}
-
-inline void QOpenGLFunctions_3_3_Compatibility::glTranslated(GLdouble x, GLdouble y, GLdouble z)
-{
- d_1_0_Deprecated->f.Translated(x, y, z);
-}
-
-inline void QOpenGLFunctions_3_3_Compatibility::glScalef(GLfloat x, GLfloat y, GLfloat z)
-{
- d_1_0_Deprecated->f.Scalef(x, y, z);
-}
-
-inline void QOpenGLFunctions_3_3_Compatibility::glScaled(GLdouble x, GLdouble y, GLdouble z)
-{
- d_1_0_Deprecated->f.Scaled(x, y, z);
-}
-
-inline void QOpenGLFunctions_3_3_Compatibility::glRotatef(GLfloat angle, GLfloat x, GLfloat y, GLfloat z)
-{
- d_1_0_Deprecated->f.Rotatef(angle, x, y, z);
-}
-
-inline void QOpenGLFunctions_3_3_Compatibility::glRotated(GLdouble angle, GLdouble x, GLdouble y, GLdouble z)
-{
- d_1_0_Deprecated->f.Rotated(angle, x, y, z);
-}
-
-inline void QOpenGLFunctions_3_3_Compatibility::glPushMatrix()
-{
- d_1_0_Deprecated->f.PushMatrix();
-}
-
-inline void QOpenGLFunctions_3_3_Compatibility::glPopMatrix()
-{
- d_1_0_Deprecated->f.PopMatrix();
-}
-
-inline void QOpenGLFunctions_3_3_Compatibility::glOrtho(GLdouble left, GLdouble right, GLdouble bottom, GLdouble top, GLdouble zNear, GLdouble zFar)
-{
- d_1_0_Deprecated->f.Ortho(left, right, bottom, top, zNear, zFar);
-}
-
-inline void QOpenGLFunctions_3_3_Compatibility::glMultMatrixd(const GLdouble *m)
-{
- d_1_0_Deprecated->f.MultMatrixd(m);
-}
-
-inline void QOpenGLFunctions_3_3_Compatibility::glMultMatrixf(const GLfloat *m)
-{
- d_1_0_Deprecated->f.MultMatrixf(m);
-}
-
-inline void QOpenGLFunctions_3_3_Compatibility::glMatrixMode(GLenum mode)
-{
- d_1_0_Deprecated->f.MatrixMode(mode);
-}
-
-inline void QOpenGLFunctions_3_3_Compatibility::glLoadMatrixd(const GLdouble *m)
-{
- d_1_0_Deprecated->f.LoadMatrixd(m);
-}
-
-inline void QOpenGLFunctions_3_3_Compatibility::glLoadMatrixf(const GLfloat *m)
-{
- d_1_0_Deprecated->f.LoadMatrixf(m);
-}
-
-inline void QOpenGLFunctions_3_3_Compatibility::glLoadIdentity()
-{
- d_1_0_Deprecated->f.LoadIdentity();
-}
-
-inline void QOpenGLFunctions_3_3_Compatibility::glFrustum(GLdouble left, GLdouble right, GLdouble bottom, GLdouble top, GLdouble zNear, GLdouble zFar)
-{
- d_1_0_Deprecated->f.Frustum(left, right, bottom, top, zNear, zFar);
-}
-
-inline GLboolean QOpenGLFunctions_3_3_Compatibility::glIsList(GLuint list)
-{
- return d_1_0_Deprecated->f.IsList(list);
-}
-
-inline void QOpenGLFunctions_3_3_Compatibility::glGetTexGeniv(GLenum coord, GLenum pname, GLint *params)
-{
- d_1_0_Deprecated->f.GetTexGeniv(coord, pname, params);
-}
-
-inline void QOpenGLFunctions_3_3_Compatibility::glGetTexGenfv(GLenum coord, GLenum pname, GLfloat *params)
-{
- d_1_0_Deprecated->f.GetTexGenfv(coord, pname, params);
-}
-
-inline void QOpenGLFunctions_3_3_Compatibility::glGetTexGendv(GLenum coord, GLenum pname, GLdouble *params)
-{
- d_1_0_Deprecated->f.GetTexGendv(coord, pname, params);
-}
-
-inline void QOpenGLFunctions_3_3_Compatibility::glGetTexEnviv(GLenum target, GLenum pname, GLint *params)
-{
- d_1_0_Deprecated->f.GetTexEnviv(target, pname, params);
-}
-
-inline void QOpenGLFunctions_3_3_Compatibility::glGetTexEnvfv(GLenum target, GLenum pname, GLfloat *params)
-{
- d_1_0_Deprecated->f.GetTexEnvfv(target, pname, params);
-}
-
-inline void QOpenGLFunctions_3_3_Compatibility::glGetPolygonStipple(GLubyte *mask)
-{
- d_1_0_Deprecated->f.GetPolygonStipple(mask);
-}
-
-inline void QOpenGLFunctions_3_3_Compatibility::glGetPixelMapusv(GLenum map, GLushort *values)
-{
- d_1_0_Deprecated->f.GetPixelMapusv(map, values);
-}
-
-inline void QOpenGLFunctions_3_3_Compatibility::glGetPixelMapuiv(GLenum map, GLuint *values)
-{
- d_1_0_Deprecated->f.GetPixelMapuiv(map, values);
-}
-
-inline void QOpenGLFunctions_3_3_Compatibility::glGetPixelMapfv(GLenum map, GLfloat *values)
-{
- d_1_0_Deprecated->f.GetPixelMapfv(map, values);
-}
-
-inline void QOpenGLFunctions_3_3_Compatibility::glGetMaterialiv(GLenum face, GLenum pname, GLint *params)
-{
- d_1_0_Deprecated->f.GetMaterialiv(face, pname, params);
-}
-
-inline void QOpenGLFunctions_3_3_Compatibility::glGetMaterialfv(GLenum face, GLenum pname, GLfloat *params)
-{
- d_1_0_Deprecated->f.GetMaterialfv(face, pname, params);
-}
-
-inline void QOpenGLFunctions_3_3_Compatibility::glGetMapiv(GLenum target, GLenum query, GLint *v)
-{
- d_1_0_Deprecated->f.GetMapiv(target, query, v);
-}
-
-inline void QOpenGLFunctions_3_3_Compatibility::glGetMapfv(GLenum target, GLenum query, GLfloat *v)
-{
- d_1_0_Deprecated->f.GetMapfv(target, query, v);
-}
-
-inline void QOpenGLFunctions_3_3_Compatibility::glGetMapdv(GLenum target, GLenum query, GLdouble *v)
-{
- d_1_0_Deprecated->f.GetMapdv(target, query, v);
-}
-
-inline void QOpenGLFunctions_3_3_Compatibility::glGetLightiv(GLenum light, GLenum pname, GLint *params)
-{
- d_1_0_Deprecated->f.GetLightiv(light, pname, params);
-}
-
-inline void QOpenGLFunctions_3_3_Compatibility::glGetLightfv(GLenum light, GLenum pname, GLfloat *params)
-{
- d_1_0_Deprecated->f.GetLightfv(light, pname, params);
-}
-
-inline void QOpenGLFunctions_3_3_Compatibility::glGetClipPlane(GLenum plane, GLdouble *equation)
-{
- d_1_0_Deprecated->f.GetClipPlane(plane, equation);
-}
-
-inline void QOpenGLFunctions_3_3_Compatibility::glDrawPixels(GLsizei width, GLsizei height, GLenum format, GLenum type, const GLvoid *pixels)
-{
- d_1_0_Deprecated->f.DrawPixels(width, height, format, type, pixels);
-}
-
-inline void QOpenGLFunctions_3_3_Compatibility::glCopyPixels(GLint x, GLint y, GLsizei width, GLsizei height, GLenum type)
-{
- d_1_0_Deprecated->f.CopyPixels(x, y, width, height, type);
-}
-
-inline void QOpenGLFunctions_3_3_Compatibility::glPixelMapusv(GLenum map, GLint mapsize, const GLushort *values)
-{
- d_1_0_Deprecated->f.PixelMapusv(map, mapsize, values);
-}
-
-inline void QOpenGLFunctions_3_3_Compatibility::glPixelMapuiv(GLenum map, GLint mapsize, const GLuint *values)
-{
- d_1_0_Deprecated->f.PixelMapuiv(map, mapsize, values);
-}
-
-inline void QOpenGLFunctions_3_3_Compatibility::glPixelMapfv(GLenum map, GLint mapsize, const GLfloat *values)
-{
- d_1_0_Deprecated->f.PixelMapfv(map, mapsize, values);
-}
-
-inline void QOpenGLFunctions_3_3_Compatibility::glPixelTransferi(GLenum pname, GLint param)
-{
- d_1_0_Deprecated->f.PixelTransferi(pname, param);
-}
-
-inline void QOpenGLFunctions_3_3_Compatibility::glPixelTransferf(GLenum pname, GLfloat param)
-{
- d_1_0_Deprecated->f.PixelTransferf(pname, param);
-}
-
-inline void QOpenGLFunctions_3_3_Compatibility::glPixelZoom(GLfloat xfactor, GLfloat yfactor)
-{
- d_1_0_Deprecated->f.PixelZoom(xfactor, yfactor);
-}
-
-inline void QOpenGLFunctions_3_3_Compatibility::glAlphaFunc(GLenum func, GLfloat ref)
-{
- d_1_0_Deprecated->f.AlphaFunc(func, ref);
-}
-
-inline void QOpenGLFunctions_3_3_Compatibility::glEvalPoint2(GLint i, GLint j)
-{
- d_1_0_Deprecated->f.EvalPoint2(i, j);
-}
-
-inline void QOpenGLFunctions_3_3_Compatibility::glEvalMesh2(GLenum mode, GLint i1, GLint i2, GLint j1, GLint j2)
-{
- d_1_0_Deprecated->f.EvalMesh2(mode, i1, i2, j1, j2);
-}
-
-inline void QOpenGLFunctions_3_3_Compatibility::glEvalPoint1(GLint i)
-{
- d_1_0_Deprecated->f.EvalPoint1(i);
-}
-
-inline void QOpenGLFunctions_3_3_Compatibility::glEvalMesh1(GLenum mode, GLint i1, GLint i2)
-{
- d_1_0_Deprecated->f.EvalMesh1(mode, i1, i2);
-}
-
-inline void QOpenGLFunctions_3_3_Compatibility::glEvalCoord2fv(const GLfloat *u)
-{
- d_1_0_Deprecated->f.EvalCoord2fv(u);
-}
-
-inline void QOpenGLFunctions_3_3_Compatibility::glEvalCoord2f(GLfloat u, GLfloat v)
-{
- d_1_0_Deprecated->f.EvalCoord2f(u, v);
-}
-
-inline void QOpenGLFunctions_3_3_Compatibility::glEvalCoord2dv(const GLdouble *u)
-{
- d_1_0_Deprecated->f.EvalCoord2dv(u);
-}
-
-inline void QOpenGLFunctions_3_3_Compatibility::glEvalCoord2d(GLdouble u, GLdouble v)
-{
- d_1_0_Deprecated->f.EvalCoord2d(u, v);
-}
-
-inline void QOpenGLFunctions_3_3_Compatibility::glEvalCoord1fv(const GLfloat *u)
-{
- d_1_0_Deprecated->f.EvalCoord1fv(u);
-}
-
-inline void QOpenGLFunctions_3_3_Compatibility::glEvalCoord1f(GLfloat u)
-{
- d_1_0_Deprecated->f.EvalCoord1f(u);
-}
-
-inline void QOpenGLFunctions_3_3_Compatibility::glEvalCoord1dv(const GLdouble *u)
-{
- d_1_0_Deprecated->f.EvalCoord1dv(u);
-}
-
-inline void QOpenGLFunctions_3_3_Compatibility::glEvalCoord1d(GLdouble u)
-{
- d_1_0_Deprecated->f.EvalCoord1d(u);
-}
-
-inline void QOpenGLFunctions_3_3_Compatibility::glMapGrid2f(GLint un, GLfloat u1, GLfloat u2, GLint vn, GLfloat v1, GLfloat v2)
-{
- d_1_0_Deprecated->f.MapGrid2f(un, u1, u2, vn, v1, v2);
-}
-
-inline void QOpenGLFunctions_3_3_Compatibility::glMapGrid2d(GLint un, GLdouble u1, GLdouble u2, GLint vn, GLdouble v1, GLdouble v2)
-{
- d_1_0_Deprecated->f.MapGrid2d(un, u1, u2, vn, v1, v2);
-}
-
-inline void QOpenGLFunctions_3_3_Compatibility::glMapGrid1f(GLint un, GLfloat u1, GLfloat u2)
-{
- d_1_0_Deprecated->f.MapGrid1f(un, u1, u2);
-}
-
-inline void QOpenGLFunctions_3_3_Compatibility::glMapGrid1d(GLint un, GLdouble u1, GLdouble u2)
-{
- d_1_0_Deprecated->f.MapGrid1d(un, u1, u2);
-}
-
-inline void QOpenGLFunctions_3_3_Compatibility::glMap2f(GLenum target, GLfloat u1, GLfloat u2, GLint ustride, GLint uorder, GLfloat v1, GLfloat v2, GLint vstride, GLint vorder, const GLfloat *points)
-{
- d_1_0_Deprecated->f.Map2f(target, u1, u2, ustride, uorder, v1, v2, vstride, vorder, points);
-}
-
-inline void QOpenGLFunctions_3_3_Compatibility::glMap2d(GLenum target, GLdouble u1, GLdouble u2, GLint ustride, GLint uorder, GLdouble v1, GLdouble v2, GLint vstride, GLint vorder, const GLdouble *points)
-{
- d_1_0_Deprecated->f.Map2d(target, u1, u2, ustride, uorder, v1, v2, vstride, vorder, points);
-}
-
-inline void QOpenGLFunctions_3_3_Compatibility::glMap1f(GLenum target, GLfloat u1, GLfloat u2, GLint stride, GLint order, const GLfloat *points)
-{
- d_1_0_Deprecated->f.Map1f(target, u1, u2, stride, order, points);
-}
-
-inline void QOpenGLFunctions_3_3_Compatibility::glMap1d(GLenum target, GLdouble u1, GLdouble u2, GLint stride, GLint order, const GLdouble *points)
-{
- d_1_0_Deprecated->f.Map1d(target, u1, u2, stride, order, points);
-}
-
-inline void QOpenGLFunctions_3_3_Compatibility::glPushAttrib(GLbitfield mask)
-{
- d_1_0_Deprecated->f.PushAttrib(mask);
-}
-
-inline void QOpenGLFunctions_3_3_Compatibility::glPopAttrib()
-{
- d_1_0_Deprecated->f.PopAttrib();
-}
-
-inline void QOpenGLFunctions_3_3_Compatibility::glAccum(GLenum op, GLfloat value)
-{
- d_1_0_Deprecated->f.Accum(op, value);
-}
-
-inline void QOpenGLFunctions_3_3_Compatibility::glIndexMask(GLuint mask)
-{
- d_1_0_Deprecated->f.IndexMask(mask);
-}
-
-inline void QOpenGLFunctions_3_3_Compatibility::glClearIndex(GLfloat c)
-{
- d_1_0_Deprecated->f.ClearIndex(c);
-}
-
-inline void QOpenGLFunctions_3_3_Compatibility::glClearAccum(GLfloat red, GLfloat green, GLfloat blue, GLfloat alpha)
-{
- d_1_0_Deprecated->f.ClearAccum(red, green, blue, alpha);
-}
-
-inline void QOpenGLFunctions_3_3_Compatibility::glPushName(GLuint name)
-{
- d_1_0_Deprecated->f.PushName(name);
-}
-
-inline void QOpenGLFunctions_3_3_Compatibility::glPopName()
-{
- d_1_0_Deprecated->f.PopName();
-}
-
-inline void QOpenGLFunctions_3_3_Compatibility::glPassThrough(GLfloat token)
-{
- d_1_0_Deprecated->f.PassThrough(token);
-}
-
-inline void QOpenGLFunctions_3_3_Compatibility::glLoadName(GLuint name)
-{
- d_1_0_Deprecated->f.LoadName(name);
-}
-
-inline void QOpenGLFunctions_3_3_Compatibility::glInitNames()
-{
- d_1_0_Deprecated->f.InitNames();
-}
-
-inline GLint QOpenGLFunctions_3_3_Compatibility::glRenderMode(GLenum mode)
-{
- return d_1_0_Deprecated->f.RenderMode(mode);
-}
-
-inline void QOpenGLFunctions_3_3_Compatibility::glSelectBuffer(GLsizei size, GLuint *buffer)
-{
- d_1_0_Deprecated->f.SelectBuffer(size, buffer);
-}
-
-inline void QOpenGLFunctions_3_3_Compatibility::glFeedbackBuffer(GLsizei size, GLenum type, GLfloat *buffer)
-{
- d_1_0_Deprecated->f.FeedbackBuffer(size, type, buffer);
-}
-
-inline void QOpenGLFunctions_3_3_Compatibility::glTexGeniv(GLenum coord, GLenum pname, const GLint *params)
-{
- d_1_0_Deprecated->f.TexGeniv(coord, pname, params);
-}
-
-inline void QOpenGLFunctions_3_3_Compatibility::glTexGeni(GLenum coord, GLenum pname, GLint param)
-{
- d_1_0_Deprecated->f.TexGeni(coord, pname, param);
-}
-
-inline void QOpenGLFunctions_3_3_Compatibility::glTexGenfv(GLenum coord, GLenum pname, const GLfloat *params)
-{
- d_1_0_Deprecated->f.TexGenfv(coord, pname, params);
-}
-
-inline void QOpenGLFunctions_3_3_Compatibility::glTexGenf(GLenum coord, GLenum pname, GLfloat param)
-{
- d_1_0_Deprecated->f.TexGenf(coord, pname, param);
-}
-
-inline void QOpenGLFunctions_3_3_Compatibility::glTexGendv(GLenum coord, GLenum pname, const GLdouble *params)
-{
- d_1_0_Deprecated->f.TexGendv(coord, pname, params);
-}
-
-inline void QOpenGLFunctions_3_3_Compatibility::glTexGend(GLenum coord, GLenum pname, GLdouble param)
-{
- d_1_0_Deprecated->f.TexGend(coord, pname, param);
-}
-
-inline void QOpenGLFunctions_3_3_Compatibility::glTexEnviv(GLenum target, GLenum pname, const GLint *params)
-{
- d_1_0_Deprecated->f.TexEnviv(target, pname, params);
-}
-
-inline void QOpenGLFunctions_3_3_Compatibility::glTexEnvi(GLenum target, GLenum pname, GLint param)
-{
- d_1_0_Deprecated->f.TexEnvi(target, pname, param);
-}
-
-inline void QOpenGLFunctions_3_3_Compatibility::glTexEnvfv(GLenum target, GLenum pname, const GLfloat *params)
-{
- d_1_0_Deprecated->f.TexEnvfv(target, pname, params);
-}
-
-inline void QOpenGLFunctions_3_3_Compatibility::glTexEnvf(GLenum target, GLenum pname, GLfloat param)
-{
- d_1_0_Deprecated->f.TexEnvf(target, pname, param);
-}
-
-inline void QOpenGLFunctions_3_3_Compatibility::glShadeModel(GLenum mode)
-{
- d_1_0_Deprecated->f.ShadeModel(mode);
-}
-
-inline void QOpenGLFunctions_3_3_Compatibility::glPolygonStipple(const GLubyte *mask)
-{
- d_1_0_Deprecated->f.PolygonStipple(mask);
-}
-
-inline void QOpenGLFunctions_3_3_Compatibility::glMaterialiv(GLenum face, GLenum pname, const GLint *params)
-{
- d_1_0_Deprecated->f.Materialiv(face, pname, params);
-}
-
-inline void QOpenGLFunctions_3_3_Compatibility::glMateriali(GLenum face, GLenum pname, GLint param)
-{
- d_1_0_Deprecated->f.Materiali(face, pname, param);
-}
-
-inline void QOpenGLFunctions_3_3_Compatibility::glMaterialfv(GLenum face, GLenum pname, const GLfloat *params)
-{
- d_1_0_Deprecated->f.Materialfv(face, pname, params);
-}
-
-inline void QOpenGLFunctions_3_3_Compatibility::glMaterialf(GLenum face, GLenum pname, GLfloat param)
-{
- d_1_0_Deprecated->f.Materialf(face, pname, param);
-}
-
-inline void QOpenGLFunctions_3_3_Compatibility::glLineStipple(GLint factor, GLushort pattern)
-{
- d_1_0_Deprecated->f.LineStipple(factor, pattern);
-}
-
-inline void QOpenGLFunctions_3_3_Compatibility::glLightModeliv(GLenum pname, const GLint *params)
-{
- d_1_0_Deprecated->f.LightModeliv(pname, params);
-}
-
-inline void QOpenGLFunctions_3_3_Compatibility::glLightModeli(GLenum pname, GLint param)
-{
- d_1_0_Deprecated->f.LightModeli(pname, param);
-}
-
-inline void QOpenGLFunctions_3_3_Compatibility::glLightModelfv(GLenum pname, const GLfloat *params)
-{
- d_1_0_Deprecated->f.LightModelfv(pname, params);
-}
-
-inline void QOpenGLFunctions_3_3_Compatibility::glLightModelf(GLenum pname, GLfloat param)
-{
- d_1_0_Deprecated->f.LightModelf(pname, param);
-}
-
-inline void QOpenGLFunctions_3_3_Compatibility::glLightiv(GLenum light, GLenum pname, const GLint *params)
-{
- d_1_0_Deprecated->f.Lightiv(light, pname, params);
-}
-
-inline void QOpenGLFunctions_3_3_Compatibility::glLighti(GLenum light, GLenum pname, GLint param)
-{
- d_1_0_Deprecated->f.Lighti(light, pname, param);
-}
-
-inline void QOpenGLFunctions_3_3_Compatibility::glLightfv(GLenum light, GLenum pname, const GLfloat *params)
-{
- d_1_0_Deprecated->f.Lightfv(light, pname, params);
-}
-
-inline void QOpenGLFunctions_3_3_Compatibility::glLightf(GLenum light, GLenum pname, GLfloat param)
-{
- d_1_0_Deprecated->f.Lightf(light, pname, param);
-}
-
-inline void QOpenGLFunctions_3_3_Compatibility::glFogiv(GLenum pname, const GLint *params)
-{
- d_1_0_Deprecated->f.Fogiv(pname, params);
-}
-
-inline void QOpenGLFunctions_3_3_Compatibility::glFogi(GLenum pname, GLint param)
-{
- d_1_0_Deprecated->f.Fogi(pname, param);
-}
-
-inline void QOpenGLFunctions_3_3_Compatibility::glFogfv(GLenum pname, const GLfloat *params)
-{
- d_1_0_Deprecated->f.Fogfv(pname, params);
-}
-
-inline void QOpenGLFunctions_3_3_Compatibility::glFogf(GLenum pname, GLfloat param)
-{
- d_1_0_Deprecated->f.Fogf(pname, param);
-}
-
-inline void QOpenGLFunctions_3_3_Compatibility::glColorMaterial(GLenum face, GLenum mode)
-{
- d_1_0_Deprecated->f.ColorMaterial(face, mode);
-}
-
-inline void QOpenGLFunctions_3_3_Compatibility::glClipPlane(GLenum plane, const GLdouble *equation)
-{
- d_1_0_Deprecated->f.ClipPlane(plane, equation);
-}
-
-inline void QOpenGLFunctions_3_3_Compatibility::glVertex4sv(const GLshort *v)
-{
- d_1_0_Deprecated->f.Vertex4sv(v);
-}
-
-inline void QOpenGLFunctions_3_3_Compatibility::glVertex4s(GLshort x, GLshort y, GLshort z, GLshort w)
-{
- d_1_0_Deprecated->f.Vertex4s(x, y, z, w);
-}
-
-inline void QOpenGLFunctions_3_3_Compatibility::glVertex4iv(const GLint *v)
-{
- d_1_0_Deprecated->f.Vertex4iv(v);
-}
-
-inline void QOpenGLFunctions_3_3_Compatibility::glVertex4i(GLint x, GLint y, GLint z, GLint w)
-{
- d_1_0_Deprecated->f.Vertex4i(x, y, z, w);
-}
-
-inline void QOpenGLFunctions_3_3_Compatibility::glVertex4fv(const GLfloat *v)
-{
- d_1_0_Deprecated->f.Vertex4fv(v);
-}
-
-inline void QOpenGLFunctions_3_3_Compatibility::glVertex4f(GLfloat x, GLfloat y, GLfloat z, GLfloat w)
-{
- d_1_0_Deprecated->f.Vertex4f(x, y, z, w);
-}
-
-inline void QOpenGLFunctions_3_3_Compatibility::glVertex4dv(const GLdouble *v)
-{
- d_1_0_Deprecated->f.Vertex4dv(v);
-}
-
-inline void QOpenGLFunctions_3_3_Compatibility::glVertex4d(GLdouble x, GLdouble y, GLdouble z, GLdouble w)
-{
- d_1_0_Deprecated->f.Vertex4d(x, y, z, w);
-}
-
-inline void QOpenGLFunctions_3_3_Compatibility::glVertex3sv(const GLshort *v)
-{
- d_1_0_Deprecated->f.Vertex3sv(v);
-}
-
-inline void QOpenGLFunctions_3_3_Compatibility::glVertex3s(GLshort x, GLshort y, GLshort z)
-{
- d_1_0_Deprecated->f.Vertex3s(x, y, z);
-}
-
-inline void QOpenGLFunctions_3_3_Compatibility::glVertex3iv(const GLint *v)
-{
- d_1_0_Deprecated->f.Vertex3iv(v);
-}
-
-inline void QOpenGLFunctions_3_3_Compatibility::glVertex3i(GLint x, GLint y, GLint z)
-{
- d_1_0_Deprecated->f.Vertex3i(x, y, z);
-}
-
-inline void QOpenGLFunctions_3_3_Compatibility::glVertex3fv(const GLfloat *v)
-{
- d_1_0_Deprecated->f.Vertex3fv(v);
-}
-
-inline void QOpenGLFunctions_3_3_Compatibility::glVertex3f(GLfloat x, GLfloat y, GLfloat z)
-{
- d_1_0_Deprecated->f.Vertex3f(x, y, z);
-}
-
-inline void QOpenGLFunctions_3_3_Compatibility::glVertex3dv(const GLdouble *v)
-{
- d_1_0_Deprecated->f.Vertex3dv(v);
-}
-
-inline void QOpenGLFunctions_3_3_Compatibility::glVertex3d(GLdouble x, GLdouble y, GLdouble z)
-{
- d_1_0_Deprecated->f.Vertex3d(x, y, z);
-}
-
-inline void QOpenGLFunctions_3_3_Compatibility::glVertex2sv(const GLshort *v)
-{
- d_1_0_Deprecated->f.Vertex2sv(v);
-}
-
-inline void QOpenGLFunctions_3_3_Compatibility::glVertex2s(GLshort x, GLshort y)
-{
- d_1_0_Deprecated->f.Vertex2s(x, y);
-}
-
-inline void QOpenGLFunctions_3_3_Compatibility::glVertex2iv(const GLint *v)
-{
- d_1_0_Deprecated->f.Vertex2iv(v);
-}
-
-inline void QOpenGLFunctions_3_3_Compatibility::glVertex2i(GLint x, GLint y)
-{
- d_1_0_Deprecated->f.Vertex2i(x, y);
-}
-
-inline void QOpenGLFunctions_3_3_Compatibility::glVertex2fv(const GLfloat *v)
-{
- d_1_0_Deprecated->f.Vertex2fv(v);
-}
-
-inline void QOpenGLFunctions_3_3_Compatibility::glVertex2f(GLfloat x, GLfloat y)
-{
- d_1_0_Deprecated->f.Vertex2f(x, y);
-}
-
-inline void QOpenGLFunctions_3_3_Compatibility::glVertex2dv(const GLdouble *v)
-{
- d_1_0_Deprecated->f.Vertex2dv(v);
-}
-
-inline void QOpenGLFunctions_3_3_Compatibility::glVertex2d(GLdouble x, GLdouble y)
-{
- d_1_0_Deprecated->f.Vertex2d(x, y);
-}
-
-inline void QOpenGLFunctions_3_3_Compatibility::glTexCoord4sv(const GLshort *v)
-{
- d_1_0_Deprecated->f.TexCoord4sv(v);
-}
-
-inline void QOpenGLFunctions_3_3_Compatibility::glTexCoord4s(GLshort s, GLshort t, GLshort r, GLshort q)
-{
- d_1_0_Deprecated->f.TexCoord4s(s, t, r, q);
-}
-
-inline void QOpenGLFunctions_3_3_Compatibility::glTexCoord4iv(const GLint *v)
-{
- d_1_0_Deprecated->f.TexCoord4iv(v);
-}
-
-inline void QOpenGLFunctions_3_3_Compatibility::glTexCoord4i(GLint s, GLint t, GLint r, GLint q)
-{
- d_1_0_Deprecated->f.TexCoord4i(s, t, r, q);
-}
-
-inline void QOpenGLFunctions_3_3_Compatibility::glTexCoord4fv(const GLfloat *v)
-{
- d_1_0_Deprecated->f.TexCoord4fv(v);
-}
-
-inline void QOpenGLFunctions_3_3_Compatibility::glTexCoord4f(GLfloat s, GLfloat t, GLfloat r, GLfloat q)
-{
- d_1_0_Deprecated->f.TexCoord4f(s, t, r, q);
-}
-
-inline void QOpenGLFunctions_3_3_Compatibility::glTexCoord4dv(const GLdouble *v)
-{
- d_1_0_Deprecated->f.TexCoord4dv(v);
-}
-
-inline void QOpenGLFunctions_3_3_Compatibility::glTexCoord4d(GLdouble s, GLdouble t, GLdouble r, GLdouble q)
-{
- d_1_0_Deprecated->f.TexCoord4d(s, t, r, q);
-}
-
-inline void QOpenGLFunctions_3_3_Compatibility::glTexCoord3sv(const GLshort *v)
-{
- d_1_0_Deprecated->f.TexCoord3sv(v);
-}
-
-inline void QOpenGLFunctions_3_3_Compatibility::glTexCoord3s(GLshort s, GLshort t, GLshort r)
-{
- d_1_0_Deprecated->f.TexCoord3s(s, t, r);
-}
-
-inline void QOpenGLFunctions_3_3_Compatibility::glTexCoord3iv(const GLint *v)
-{
- d_1_0_Deprecated->f.TexCoord3iv(v);
-}
-
-inline void QOpenGLFunctions_3_3_Compatibility::glTexCoord3i(GLint s, GLint t, GLint r)
-{
- d_1_0_Deprecated->f.TexCoord3i(s, t, r);
-}
-
-inline void QOpenGLFunctions_3_3_Compatibility::glTexCoord3fv(const GLfloat *v)
-{
- d_1_0_Deprecated->f.TexCoord3fv(v);
-}
-
-inline void QOpenGLFunctions_3_3_Compatibility::glTexCoord3f(GLfloat s, GLfloat t, GLfloat r)
-{
- d_1_0_Deprecated->f.TexCoord3f(s, t, r);
-}
-
-inline void QOpenGLFunctions_3_3_Compatibility::glTexCoord3dv(const GLdouble *v)
-{
- d_1_0_Deprecated->f.TexCoord3dv(v);
-}
-
-inline void QOpenGLFunctions_3_3_Compatibility::glTexCoord3d(GLdouble s, GLdouble t, GLdouble r)
-{
- d_1_0_Deprecated->f.TexCoord3d(s, t, r);
-}
-
-inline void QOpenGLFunctions_3_3_Compatibility::glTexCoord2sv(const GLshort *v)
-{
- d_1_0_Deprecated->f.TexCoord2sv(v);
-}
-
-inline void QOpenGLFunctions_3_3_Compatibility::glTexCoord2s(GLshort s, GLshort t)
-{
- d_1_0_Deprecated->f.TexCoord2s(s, t);
-}
-
-inline void QOpenGLFunctions_3_3_Compatibility::glTexCoord2iv(const GLint *v)
-{
- d_1_0_Deprecated->f.TexCoord2iv(v);
-}
-
-inline void QOpenGLFunctions_3_3_Compatibility::glTexCoord2i(GLint s, GLint t)
-{
- d_1_0_Deprecated->f.TexCoord2i(s, t);
-}
-
-inline void QOpenGLFunctions_3_3_Compatibility::glTexCoord2fv(const GLfloat *v)
-{
- d_1_0_Deprecated->f.TexCoord2fv(v);
-}
-
-inline void QOpenGLFunctions_3_3_Compatibility::glTexCoord2f(GLfloat s, GLfloat t)
-{
- d_1_0_Deprecated->f.TexCoord2f(s, t);
-}
-
-inline void QOpenGLFunctions_3_3_Compatibility::glTexCoord2dv(const GLdouble *v)
-{
- d_1_0_Deprecated->f.TexCoord2dv(v);
-}
-
-inline void QOpenGLFunctions_3_3_Compatibility::glTexCoord2d(GLdouble s, GLdouble t)
-{
- d_1_0_Deprecated->f.TexCoord2d(s, t);
-}
-
-inline void QOpenGLFunctions_3_3_Compatibility::glTexCoord1sv(const GLshort *v)
-{
- d_1_0_Deprecated->f.TexCoord1sv(v);
-}
-
-inline void QOpenGLFunctions_3_3_Compatibility::glTexCoord1s(GLshort s)
-{
- d_1_0_Deprecated->f.TexCoord1s(s);
-}
-
-inline void QOpenGLFunctions_3_3_Compatibility::glTexCoord1iv(const GLint *v)
-{
- d_1_0_Deprecated->f.TexCoord1iv(v);
-}
-
-inline void QOpenGLFunctions_3_3_Compatibility::glTexCoord1i(GLint s)
-{
- d_1_0_Deprecated->f.TexCoord1i(s);
-}
-
-inline void QOpenGLFunctions_3_3_Compatibility::glTexCoord1fv(const GLfloat *v)
-{
- d_1_0_Deprecated->f.TexCoord1fv(v);
-}
-
-inline void QOpenGLFunctions_3_3_Compatibility::glTexCoord1f(GLfloat s)
-{
- d_1_0_Deprecated->f.TexCoord1f(s);
-}
-
-inline void QOpenGLFunctions_3_3_Compatibility::glTexCoord1dv(const GLdouble *v)
-{
- d_1_0_Deprecated->f.TexCoord1dv(v);
-}
-
-inline void QOpenGLFunctions_3_3_Compatibility::glTexCoord1d(GLdouble s)
-{
- d_1_0_Deprecated->f.TexCoord1d(s);
-}
-
-inline void QOpenGLFunctions_3_3_Compatibility::glRectsv(const GLshort *v1, const GLshort *v2)
-{
- d_1_0_Deprecated->f.Rectsv(v1, v2);
-}
-
-inline void QOpenGLFunctions_3_3_Compatibility::glRects(GLshort x1, GLshort y1, GLshort x2, GLshort y2)
-{
- d_1_0_Deprecated->f.Rects(x1, y1, x2, y2);
-}
-
-inline void QOpenGLFunctions_3_3_Compatibility::glRectiv(const GLint *v1, const GLint *v2)
-{
- d_1_0_Deprecated->f.Rectiv(v1, v2);
-}
-
-inline void QOpenGLFunctions_3_3_Compatibility::glRecti(GLint x1, GLint y1, GLint x2, GLint y2)
-{
- d_1_0_Deprecated->f.Recti(x1, y1, x2, y2);
-}
-
-inline void QOpenGLFunctions_3_3_Compatibility::glRectfv(const GLfloat *v1, const GLfloat *v2)
-{
- d_1_0_Deprecated->f.Rectfv(v1, v2);
-}
-
-inline void QOpenGLFunctions_3_3_Compatibility::glRectf(GLfloat x1, GLfloat y1, GLfloat x2, GLfloat y2)
-{
- d_1_0_Deprecated->f.Rectf(x1, y1, x2, y2);
-}
-
-inline void QOpenGLFunctions_3_3_Compatibility::glRectdv(const GLdouble *v1, const GLdouble *v2)
-{
- d_1_0_Deprecated->f.Rectdv(v1, v2);
-}
-
-inline void QOpenGLFunctions_3_3_Compatibility::glRectd(GLdouble x1, GLdouble y1, GLdouble x2, GLdouble y2)
-{
- d_1_0_Deprecated->f.Rectd(x1, y1, x2, y2);
-}
-
-inline void QOpenGLFunctions_3_3_Compatibility::glRasterPos4sv(const GLshort *v)
-{
- d_1_0_Deprecated->f.RasterPos4sv(v);
-}
-
-inline void QOpenGLFunctions_3_3_Compatibility::glRasterPos4s(GLshort x, GLshort y, GLshort z, GLshort w)
-{
- d_1_0_Deprecated->f.RasterPos4s(x, y, z, w);
-}
-
-inline void QOpenGLFunctions_3_3_Compatibility::glRasterPos4iv(const GLint *v)
-{
- d_1_0_Deprecated->f.RasterPos4iv(v);
-}
-
-inline void QOpenGLFunctions_3_3_Compatibility::glRasterPos4i(GLint x, GLint y, GLint z, GLint w)
-{
- d_1_0_Deprecated->f.RasterPos4i(x, y, z, w);
-}
-
-inline void QOpenGLFunctions_3_3_Compatibility::glRasterPos4fv(const GLfloat *v)
-{
- d_1_0_Deprecated->f.RasterPos4fv(v);
-}
-
-inline void QOpenGLFunctions_3_3_Compatibility::glRasterPos4f(GLfloat x, GLfloat y, GLfloat z, GLfloat w)
-{
- d_1_0_Deprecated->f.RasterPos4f(x, y, z, w);
-}
-
-inline void QOpenGLFunctions_3_3_Compatibility::glRasterPos4dv(const GLdouble *v)
-{
- d_1_0_Deprecated->f.RasterPos4dv(v);
-}
-
-inline void QOpenGLFunctions_3_3_Compatibility::glRasterPos4d(GLdouble x, GLdouble y, GLdouble z, GLdouble w)
-{
- d_1_0_Deprecated->f.RasterPos4d(x, y, z, w);
-}
-
-inline void QOpenGLFunctions_3_3_Compatibility::glRasterPos3sv(const GLshort *v)
-{
- d_1_0_Deprecated->f.RasterPos3sv(v);
-}
-
-inline void QOpenGLFunctions_3_3_Compatibility::glRasterPos3s(GLshort x, GLshort y, GLshort z)
-{
- d_1_0_Deprecated->f.RasterPos3s(x, y, z);
-}
-
-inline void QOpenGLFunctions_3_3_Compatibility::glRasterPos3iv(const GLint *v)
-{
- d_1_0_Deprecated->f.RasterPos3iv(v);
-}
-
-inline void QOpenGLFunctions_3_3_Compatibility::glRasterPos3i(GLint x, GLint y, GLint z)
-{
- d_1_0_Deprecated->f.RasterPos3i(x, y, z);
-}
-
-inline void QOpenGLFunctions_3_3_Compatibility::glRasterPos3fv(const GLfloat *v)
-{
- d_1_0_Deprecated->f.RasterPos3fv(v);
-}
-
-inline void QOpenGLFunctions_3_3_Compatibility::glRasterPos3f(GLfloat x, GLfloat y, GLfloat z)
-{
- d_1_0_Deprecated->f.RasterPos3f(x, y, z);
-}
-
-inline void QOpenGLFunctions_3_3_Compatibility::glRasterPos3dv(const GLdouble *v)
-{
- d_1_0_Deprecated->f.RasterPos3dv(v);
-}
-
-inline void QOpenGLFunctions_3_3_Compatibility::glRasterPos3d(GLdouble x, GLdouble y, GLdouble z)
-{
- d_1_0_Deprecated->f.RasterPos3d(x, y, z);
-}
-
-inline void QOpenGLFunctions_3_3_Compatibility::glRasterPos2sv(const GLshort *v)
-{
- d_1_0_Deprecated->f.RasterPos2sv(v);
-}
-
-inline void QOpenGLFunctions_3_3_Compatibility::glRasterPos2s(GLshort x, GLshort y)
-{
- d_1_0_Deprecated->f.RasterPos2s(x, y);
-}
-
-inline void QOpenGLFunctions_3_3_Compatibility::glRasterPos2iv(const GLint *v)
-{
- d_1_0_Deprecated->f.RasterPos2iv(v);
-}
-
-inline void QOpenGLFunctions_3_3_Compatibility::glRasterPos2i(GLint x, GLint y)
-{
- d_1_0_Deprecated->f.RasterPos2i(x, y);
-}
-
-inline void QOpenGLFunctions_3_3_Compatibility::glRasterPos2fv(const GLfloat *v)
-{
- d_1_0_Deprecated->f.RasterPos2fv(v);
-}
-
-inline void QOpenGLFunctions_3_3_Compatibility::glRasterPos2f(GLfloat x, GLfloat y)
-{
- d_1_0_Deprecated->f.RasterPos2f(x, y);
-}
-
-inline void QOpenGLFunctions_3_3_Compatibility::glRasterPos2dv(const GLdouble *v)
-{
- d_1_0_Deprecated->f.RasterPos2dv(v);
-}
-
-inline void QOpenGLFunctions_3_3_Compatibility::glRasterPos2d(GLdouble x, GLdouble y)
-{
- d_1_0_Deprecated->f.RasterPos2d(x, y);
-}
-
-inline void QOpenGLFunctions_3_3_Compatibility::glNormal3sv(const GLshort *v)
-{
- d_1_0_Deprecated->f.Normal3sv(v);
-}
-
-inline void QOpenGLFunctions_3_3_Compatibility::glNormal3s(GLshort nx, GLshort ny, GLshort nz)
-{
- d_1_0_Deprecated->f.Normal3s(nx, ny, nz);
-}
-
-inline void QOpenGLFunctions_3_3_Compatibility::glNormal3iv(const GLint *v)
-{
- d_1_0_Deprecated->f.Normal3iv(v);
-}
-
-inline void QOpenGLFunctions_3_3_Compatibility::glNormal3i(GLint nx, GLint ny, GLint nz)
-{
- d_1_0_Deprecated->f.Normal3i(nx, ny, nz);
-}
-
-inline void QOpenGLFunctions_3_3_Compatibility::glNormal3fv(const GLfloat *v)
-{
- d_1_0_Deprecated->f.Normal3fv(v);
-}
-
-inline void QOpenGLFunctions_3_3_Compatibility::glNormal3f(GLfloat nx, GLfloat ny, GLfloat nz)
-{
- d_1_0_Deprecated->f.Normal3f(nx, ny, nz);
-}
-
-inline void QOpenGLFunctions_3_3_Compatibility::glNormal3dv(const GLdouble *v)
-{
- d_1_0_Deprecated->f.Normal3dv(v);
-}
-
-inline void QOpenGLFunctions_3_3_Compatibility::glNormal3d(GLdouble nx, GLdouble ny, GLdouble nz)
-{
- d_1_0_Deprecated->f.Normal3d(nx, ny, nz);
-}
-
-inline void QOpenGLFunctions_3_3_Compatibility::glNormal3bv(const GLbyte *v)
-{
- d_1_0_Deprecated->f.Normal3bv(v);
-}
-
-inline void QOpenGLFunctions_3_3_Compatibility::glNormal3b(GLbyte nx, GLbyte ny, GLbyte nz)
-{
- d_1_0_Deprecated->f.Normal3b(nx, ny, nz);
-}
-
-inline void QOpenGLFunctions_3_3_Compatibility::glIndexsv(const GLshort *c)
-{
- d_1_0_Deprecated->f.Indexsv(c);
-}
-
-inline void QOpenGLFunctions_3_3_Compatibility::glIndexs(GLshort c)
-{
- d_1_0_Deprecated->f.Indexs(c);
-}
-
-inline void QOpenGLFunctions_3_3_Compatibility::glIndexiv(const GLint *c)
-{
- d_1_0_Deprecated->f.Indexiv(c);
-}
-
-inline void QOpenGLFunctions_3_3_Compatibility::glIndexi(GLint c)
-{
- d_1_0_Deprecated->f.Indexi(c);
-}
-
-inline void QOpenGLFunctions_3_3_Compatibility::glIndexfv(const GLfloat *c)
-{
- d_1_0_Deprecated->f.Indexfv(c);
-}
-
-inline void QOpenGLFunctions_3_3_Compatibility::glIndexf(GLfloat c)
-{
- d_1_0_Deprecated->f.Indexf(c);
-}
-
-inline void QOpenGLFunctions_3_3_Compatibility::glIndexdv(const GLdouble *c)
-{
- d_1_0_Deprecated->f.Indexdv(c);
-}
-
-inline void QOpenGLFunctions_3_3_Compatibility::glIndexd(GLdouble c)
-{
- d_1_0_Deprecated->f.Indexd(c);
-}
-
-inline void QOpenGLFunctions_3_3_Compatibility::glEnd()
-{
- d_1_0_Deprecated->f.End();
-}
-
-inline void QOpenGLFunctions_3_3_Compatibility::glEdgeFlagv(const GLboolean *flag)
-{
- d_1_0_Deprecated->f.EdgeFlagv(flag);
-}
-
-inline void QOpenGLFunctions_3_3_Compatibility::glEdgeFlag(GLboolean flag)
-{
- d_1_0_Deprecated->f.EdgeFlag(flag);
-}
-
-inline void QOpenGLFunctions_3_3_Compatibility::glColor4usv(const GLushort *v)
-{
- d_1_0_Deprecated->f.Color4usv(v);
-}
-
-inline void QOpenGLFunctions_3_3_Compatibility::glColor4us(GLushort red, GLushort green, GLushort blue, GLushort alpha)
-{
- d_1_0_Deprecated->f.Color4us(red, green, blue, alpha);
-}
-
-inline void QOpenGLFunctions_3_3_Compatibility::glColor4uiv(const GLuint *v)
-{
- d_1_0_Deprecated->f.Color4uiv(v);
-}
-
-inline void QOpenGLFunctions_3_3_Compatibility::glColor4ui(GLuint red, GLuint green, GLuint blue, GLuint alpha)
-{
- d_1_0_Deprecated->f.Color4ui(red, green, blue, alpha);
-}
-
-inline void QOpenGLFunctions_3_3_Compatibility::glColor4ubv(const GLubyte *v)
-{
- d_1_0_Deprecated->f.Color4ubv(v);
-}
-
-inline void QOpenGLFunctions_3_3_Compatibility::glColor4ub(GLubyte red, GLubyte green, GLubyte blue, GLubyte alpha)
-{
- d_1_0_Deprecated->f.Color4ub(red, green, blue, alpha);
-}
-
-inline void QOpenGLFunctions_3_3_Compatibility::glColor4sv(const GLshort *v)
-{
- d_1_0_Deprecated->f.Color4sv(v);
-}
-
-inline void QOpenGLFunctions_3_3_Compatibility::glColor4s(GLshort red, GLshort green, GLshort blue, GLshort alpha)
-{
- d_1_0_Deprecated->f.Color4s(red, green, blue, alpha);
-}
-
-inline void QOpenGLFunctions_3_3_Compatibility::glColor4iv(const GLint *v)
-{
- d_1_0_Deprecated->f.Color4iv(v);
-}
-
-inline void QOpenGLFunctions_3_3_Compatibility::glColor4i(GLint red, GLint green, GLint blue, GLint alpha)
-{
- d_1_0_Deprecated->f.Color4i(red, green, blue, alpha);
-}
-
-inline void QOpenGLFunctions_3_3_Compatibility::glColor4fv(const GLfloat *v)
-{
- d_1_0_Deprecated->f.Color4fv(v);
-}
-
-inline void QOpenGLFunctions_3_3_Compatibility::glColor4f(GLfloat red, GLfloat green, GLfloat blue, GLfloat alpha)
-{
- d_1_0_Deprecated->f.Color4f(red, green, blue, alpha);
-}
-
-inline void QOpenGLFunctions_3_3_Compatibility::glColor4dv(const GLdouble *v)
-{
- d_1_0_Deprecated->f.Color4dv(v);
-}
-
-inline void QOpenGLFunctions_3_3_Compatibility::glColor4d(GLdouble red, GLdouble green, GLdouble blue, GLdouble alpha)
-{
- d_1_0_Deprecated->f.Color4d(red, green, blue, alpha);
-}
-
-inline void QOpenGLFunctions_3_3_Compatibility::glColor4bv(const GLbyte *v)
-{
- d_1_0_Deprecated->f.Color4bv(v);
-}
-
-inline void QOpenGLFunctions_3_3_Compatibility::glColor4b(GLbyte red, GLbyte green, GLbyte blue, GLbyte alpha)
-{
- d_1_0_Deprecated->f.Color4b(red, green, blue, alpha);
-}
-
-inline void QOpenGLFunctions_3_3_Compatibility::glColor3usv(const GLushort *v)
-{
- d_1_0_Deprecated->f.Color3usv(v);
-}
-
-inline void QOpenGLFunctions_3_3_Compatibility::glColor3us(GLushort red, GLushort green, GLushort blue)
-{
- d_1_0_Deprecated->f.Color3us(red, green, blue);
-}
-
-inline void QOpenGLFunctions_3_3_Compatibility::glColor3uiv(const GLuint *v)
-{
- d_1_0_Deprecated->f.Color3uiv(v);
-}
-
-inline void QOpenGLFunctions_3_3_Compatibility::glColor3ui(GLuint red, GLuint green, GLuint blue)
-{
- d_1_0_Deprecated->f.Color3ui(red, green, blue);
-}
-
-inline void QOpenGLFunctions_3_3_Compatibility::glColor3ubv(const GLubyte *v)
-{
- d_1_0_Deprecated->f.Color3ubv(v);
-}
-
-inline void QOpenGLFunctions_3_3_Compatibility::glColor3ub(GLubyte red, GLubyte green, GLubyte blue)
-{
- d_1_0_Deprecated->f.Color3ub(red, green, blue);
-}
-
-inline void QOpenGLFunctions_3_3_Compatibility::glColor3sv(const GLshort *v)
-{
- d_1_0_Deprecated->f.Color3sv(v);
-}
-
-inline void QOpenGLFunctions_3_3_Compatibility::glColor3s(GLshort red, GLshort green, GLshort blue)
-{
- d_1_0_Deprecated->f.Color3s(red, green, blue);
-}
-
-inline void QOpenGLFunctions_3_3_Compatibility::glColor3iv(const GLint *v)
-{
- d_1_0_Deprecated->f.Color3iv(v);
-}
-
-inline void QOpenGLFunctions_3_3_Compatibility::glColor3i(GLint red, GLint green, GLint blue)
-{
- d_1_0_Deprecated->f.Color3i(red, green, blue);
-}
-
-inline void QOpenGLFunctions_3_3_Compatibility::glColor3fv(const GLfloat *v)
-{
- d_1_0_Deprecated->f.Color3fv(v);
-}
-
-inline void QOpenGLFunctions_3_3_Compatibility::glColor3f(GLfloat red, GLfloat green, GLfloat blue)
-{
- d_1_0_Deprecated->f.Color3f(red, green, blue);
-}
-
-inline void QOpenGLFunctions_3_3_Compatibility::glColor3dv(const GLdouble *v)
-{
- d_1_0_Deprecated->f.Color3dv(v);
-}
-
-inline void QOpenGLFunctions_3_3_Compatibility::glColor3d(GLdouble red, GLdouble green, GLdouble blue)
-{
- d_1_0_Deprecated->f.Color3d(red, green, blue);
-}
-
-inline void QOpenGLFunctions_3_3_Compatibility::glColor3bv(const GLbyte *v)
-{
- d_1_0_Deprecated->f.Color3bv(v);
-}
-
-inline void QOpenGLFunctions_3_3_Compatibility::glColor3b(GLbyte red, GLbyte green, GLbyte blue)
-{
- d_1_0_Deprecated->f.Color3b(red, green, blue);
-}
-
-inline void QOpenGLFunctions_3_3_Compatibility::glBitmap(GLsizei width, GLsizei height, GLfloat xorig, GLfloat yorig, GLfloat xmove, GLfloat ymove, const GLubyte *bitmap)
-{
- d_1_0_Deprecated->f.Bitmap(width, height, xorig, yorig, xmove, ymove, bitmap);
-}
-
-inline void QOpenGLFunctions_3_3_Compatibility::glBegin(GLenum mode)
-{
- d_1_0_Deprecated->f.Begin(mode);
-}
-
-inline void QOpenGLFunctions_3_3_Compatibility::glListBase(GLuint base)
-{
- d_1_0_Deprecated->f.ListBase(base);
-}
-
-inline GLuint QOpenGLFunctions_3_3_Compatibility::glGenLists(GLsizei range)
-{
- return d_1_0_Deprecated->f.GenLists(range);
-}
-
-inline void QOpenGLFunctions_3_3_Compatibility::glDeleteLists(GLuint list, GLsizei range)
-{
- d_1_0_Deprecated->f.DeleteLists(list, range);
-}
-
-inline void QOpenGLFunctions_3_3_Compatibility::glCallLists(GLsizei n, GLenum type, const GLvoid *lists)
-{
- d_1_0_Deprecated->f.CallLists(n, type, lists);
-}
-
-inline void QOpenGLFunctions_3_3_Compatibility::glCallList(GLuint list)
-{
- d_1_0_Deprecated->f.CallList(list);
-}
-
-inline void QOpenGLFunctions_3_3_Compatibility::glEndList()
-{
- d_1_0_Deprecated->f.EndList();
-}
-
-inline void QOpenGLFunctions_3_3_Compatibility::glNewList(GLuint list, GLenum mode)
-{
- d_1_0_Deprecated->f.NewList(list, mode);
-}
-
-
-// OpenGL 1.1 deprecated functions
-inline void QOpenGLFunctions_3_3_Compatibility::glPushClientAttrib(GLbitfield mask)
-{
- d_1_1_Deprecated->f.PushClientAttrib(mask);
-}
-
-inline void QOpenGLFunctions_3_3_Compatibility::glPopClientAttrib()
-{
- d_1_1_Deprecated->f.PopClientAttrib();
-}
-
-inline void QOpenGLFunctions_3_3_Compatibility::glPrioritizeTextures(GLsizei n, const GLuint *textures, const GLfloat *priorities)
-{
- d_1_1_Deprecated->f.PrioritizeTextures(n, textures, priorities);
-}
-
-inline GLboolean QOpenGLFunctions_3_3_Compatibility::glAreTexturesResident(GLsizei n, const GLuint *textures, GLboolean *residences)
-{
- return d_1_1_Deprecated->f.AreTexturesResident(n, textures, residences);
-}
-
-inline void QOpenGLFunctions_3_3_Compatibility::glVertexPointer(GLint size, GLenum type, GLsizei stride, const GLvoid *pointer)
-{
- d_1_1_Deprecated->f.VertexPointer(size, type, stride, pointer);
-}
-
-inline void QOpenGLFunctions_3_3_Compatibility::glTexCoordPointer(GLint size, GLenum type, GLsizei stride, const GLvoid *pointer)
-{
- d_1_1_Deprecated->f.TexCoordPointer(size, type, stride, pointer);
-}
-
-inline void QOpenGLFunctions_3_3_Compatibility::glNormalPointer(GLenum type, GLsizei stride, const GLvoid *pointer)
-{
- d_1_1_Deprecated->f.NormalPointer(type, stride, pointer);
-}
-
-inline void QOpenGLFunctions_3_3_Compatibility::glInterleavedArrays(GLenum format, GLsizei stride, const GLvoid *pointer)
-{
- d_1_1_Deprecated->f.InterleavedArrays(format, stride, pointer);
-}
-
-inline void QOpenGLFunctions_3_3_Compatibility::glIndexPointer(GLenum type, GLsizei stride, const GLvoid *pointer)
-{
- d_1_1_Deprecated->f.IndexPointer(type, stride, pointer);
-}
-
-inline void QOpenGLFunctions_3_3_Compatibility::glEnableClientState(GLenum array)
-{
- d_1_1_Deprecated->f.EnableClientState(array);
-}
-
-inline void QOpenGLFunctions_3_3_Compatibility::glEdgeFlagPointer(GLsizei stride, const GLvoid *pointer)
-{
- d_1_1_Deprecated->f.EdgeFlagPointer(stride, pointer);
-}
-
-inline void QOpenGLFunctions_3_3_Compatibility::glDisableClientState(GLenum array)
-{
- d_1_1_Deprecated->f.DisableClientState(array);
-}
-
-inline void QOpenGLFunctions_3_3_Compatibility::glColorPointer(GLint size, GLenum type, GLsizei stride, const GLvoid *pointer)
-{
- d_1_1_Deprecated->f.ColorPointer(size, type, stride, pointer);
-}
-
-inline void QOpenGLFunctions_3_3_Compatibility::glArrayElement(GLint i)
-{
- d_1_1_Deprecated->f.ArrayElement(i);
-}
-
-
-// OpenGL 1.2 deprecated functions
-inline void QOpenGLFunctions_3_3_Compatibility::glResetMinmax(GLenum target)
-{
- d_1_2_Deprecated->f.ResetMinmax(target);
-}
-
-inline void QOpenGLFunctions_3_3_Compatibility::glResetHistogram(GLenum target)
-{
- d_1_2_Deprecated->f.ResetHistogram(target);
-}
-
-inline void QOpenGLFunctions_3_3_Compatibility::glMinmax(GLenum target, GLenum internalformat, GLboolean sink)
-{
- d_1_2_Deprecated->f.Minmax(target, internalformat, sink);
-}
-
-inline void QOpenGLFunctions_3_3_Compatibility::glHistogram(GLenum target, GLsizei width, GLenum internalformat, GLboolean sink)
-{
- d_1_2_Deprecated->f.Histogram(target, width, internalformat, sink);
-}
-
-inline void QOpenGLFunctions_3_3_Compatibility::glGetMinmaxParameteriv(GLenum target, GLenum pname, GLint *params)
-{
- d_1_2_Deprecated->f.GetMinmaxParameteriv(target, pname, params);
-}
-
-inline void QOpenGLFunctions_3_3_Compatibility::glGetMinmaxParameterfv(GLenum target, GLenum pname, GLfloat *params)
-{
- d_1_2_Deprecated->f.GetMinmaxParameterfv(target, pname, params);
-}
-
-inline void QOpenGLFunctions_3_3_Compatibility::glGetMinmax(GLenum target, GLboolean reset, GLenum format, GLenum type, GLvoid *values)
-{
- d_1_2_Deprecated->f.GetMinmax(target, reset, format, type, values);
-}
-
-inline void QOpenGLFunctions_3_3_Compatibility::glGetHistogramParameteriv(GLenum target, GLenum pname, GLint *params)
-{
- d_1_2_Deprecated->f.GetHistogramParameteriv(target, pname, params);
-}
-
-inline void QOpenGLFunctions_3_3_Compatibility::glGetHistogramParameterfv(GLenum target, GLenum pname, GLfloat *params)
-{
- d_1_2_Deprecated->f.GetHistogramParameterfv(target, pname, params);
-}
-
-inline void QOpenGLFunctions_3_3_Compatibility::glGetHistogram(GLenum target, GLboolean reset, GLenum format, GLenum type, GLvoid *values)
-{
- d_1_2_Deprecated->f.GetHistogram(target, reset, format, type, values);
-}
-
-inline void QOpenGLFunctions_3_3_Compatibility::glSeparableFilter2D(GLenum target, GLenum internalformat, GLsizei width, GLsizei height, GLenum format, GLenum type, const GLvoid *row, const GLvoid *column)
-{
- d_1_2_Deprecated->f.SeparableFilter2D(target, internalformat, width, height, format, type, row, column);
-}
-
-inline void QOpenGLFunctions_3_3_Compatibility::glGetSeparableFilter(GLenum target, GLenum format, GLenum type, GLvoid *row, GLvoid *column, GLvoid *span)
-{
- d_1_2_Deprecated->f.GetSeparableFilter(target, format, type, row, column, span);
-}
-
-inline void QOpenGLFunctions_3_3_Compatibility::glGetConvolutionParameteriv(GLenum target, GLenum pname, GLint *params)
-{
- d_1_2_Deprecated->f.GetConvolutionParameteriv(target, pname, params);
-}
-
-inline void QOpenGLFunctions_3_3_Compatibility::glGetConvolutionParameterfv(GLenum target, GLenum pname, GLfloat *params)
-{
- d_1_2_Deprecated->f.GetConvolutionParameterfv(target, pname, params);
-}
-
-inline void QOpenGLFunctions_3_3_Compatibility::glGetConvolutionFilter(GLenum target, GLenum format, GLenum type, GLvoid *image)
-{
- d_1_2_Deprecated->f.GetConvolutionFilter(target, format, type, image);
-}
-
-inline void QOpenGLFunctions_3_3_Compatibility::glCopyConvolutionFilter2D(GLenum target, GLenum internalformat, GLint x, GLint y, GLsizei width, GLsizei height)
-{
- d_1_2_Deprecated->f.CopyConvolutionFilter2D(target, internalformat, x, y, width, height);
-}
-
-inline void QOpenGLFunctions_3_3_Compatibility::glCopyConvolutionFilter1D(GLenum target, GLenum internalformat, GLint x, GLint y, GLsizei width)
-{
- d_1_2_Deprecated->f.CopyConvolutionFilter1D(target, internalformat, x, y, width);
-}
-
-inline void QOpenGLFunctions_3_3_Compatibility::glConvolutionParameteriv(GLenum target, GLenum pname, const GLint *params)
-{
- d_1_2_Deprecated->f.ConvolutionParameteriv(target, pname, params);
-}
-
-inline void QOpenGLFunctions_3_3_Compatibility::glConvolutionParameteri(GLenum target, GLenum pname, GLint params)
-{
- d_1_2_Deprecated->f.ConvolutionParameteri(target, pname, params);
-}
-
-inline void QOpenGLFunctions_3_3_Compatibility::glConvolutionParameterfv(GLenum target, GLenum pname, const GLfloat *params)
-{
- d_1_2_Deprecated->f.ConvolutionParameterfv(target, pname, params);
-}
-
-inline void QOpenGLFunctions_3_3_Compatibility::glConvolutionParameterf(GLenum target, GLenum pname, GLfloat params)
-{
- d_1_2_Deprecated->f.ConvolutionParameterf(target, pname, params);
-}
-
-inline void QOpenGLFunctions_3_3_Compatibility::glConvolutionFilter2D(GLenum target, GLenum internalformat, GLsizei width, GLsizei height, GLenum format, GLenum type, const GLvoid *image)
-{
- d_1_2_Deprecated->f.ConvolutionFilter2D(target, internalformat, width, height, format, type, image);
-}
-
-inline void QOpenGLFunctions_3_3_Compatibility::glConvolutionFilter1D(GLenum target, GLenum internalformat, GLsizei width, GLenum format, GLenum type, const GLvoid *image)
-{
- d_1_2_Deprecated->f.ConvolutionFilter1D(target, internalformat, width, format, type, image);
-}
-
-inline void QOpenGLFunctions_3_3_Compatibility::glCopyColorSubTable(GLenum target, GLsizei start, GLint x, GLint y, GLsizei width)
-{
- d_1_2_Deprecated->f.CopyColorSubTable(target, start, x, y, width);
-}
-
-inline void QOpenGLFunctions_3_3_Compatibility::glColorSubTable(GLenum target, GLsizei start, GLsizei count, GLenum format, GLenum type, const GLvoid *data)
-{
- d_1_2_Deprecated->f.ColorSubTable(target, start, count, format, type, data);
-}
-
-inline void QOpenGLFunctions_3_3_Compatibility::glGetColorTableParameteriv(GLenum target, GLenum pname, GLint *params)
-{
- d_1_2_Deprecated->f.GetColorTableParameteriv(target, pname, params);
-}
-
-inline void QOpenGLFunctions_3_3_Compatibility::glGetColorTableParameterfv(GLenum target, GLenum pname, GLfloat *params)
-{
- d_1_2_Deprecated->f.GetColorTableParameterfv(target, pname, params);
-}
-
-inline void QOpenGLFunctions_3_3_Compatibility::glGetColorTable(GLenum target, GLenum format, GLenum type, GLvoid *table)
-{
- d_1_2_Deprecated->f.GetColorTable(target, format, type, table);
-}
-
-inline void QOpenGLFunctions_3_3_Compatibility::glCopyColorTable(GLenum target, GLenum internalformat, GLint x, GLint y, GLsizei width)
-{
- d_1_2_Deprecated->f.CopyColorTable(target, internalformat, x, y, width);
-}
-
-inline void QOpenGLFunctions_3_3_Compatibility::glColorTableParameteriv(GLenum target, GLenum pname, const GLint *params)
-{
- d_1_2_Deprecated->f.ColorTableParameteriv(target, pname, params);
-}
-
-inline void QOpenGLFunctions_3_3_Compatibility::glColorTableParameterfv(GLenum target, GLenum pname, const GLfloat *params)
-{
- d_1_2_Deprecated->f.ColorTableParameterfv(target, pname, params);
-}
-
-inline void QOpenGLFunctions_3_3_Compatibility::glColorTable(GLenum target, GLenum internalformat, GLsizei width, GLenum format, GLenum type, const GLvoid *table)
-{
- d_1_2_Deprecated->f.ColorTable(target, internalformat, width, format, type, table);
-}
-
-
-// OpenGL 1.3 deprecated functions
-inline void QOpenGLFunctions_3_3_Compatibility::glMultTransposeMatrixd(const GLdouble *m)
-{
- d_1_3_Deprecated->f.MultTransposeMatrixd(m);
-}
-
-inline void QOpenGLFunctions_3_3_Compatibility::glMultTransposeMatrixf(const GLfloat *m)
-{
- d_1_3_Deprecated->f.MultTransposeMatrixf(m);
-}
-
-inline void QOpenGLFunctions_3_3_Compatibility::glLoadTransposeMatrixd(const GLdouble *m)
-{
- d_1_3_Deprecated->f.LoadTransposeMatrixd(m);
-}
-
-inline void QOpenGLFunctions_3_3_Compatibility::glLoadTransposeMatrixf(const GLfloat *m)
-{
- d_1_3_Deprecated->f.LoadTransposeMatrixf(m);
-}
-
-inline void QOpenGLFunctions_3_3_Compatibility::glMultiTexCoord4sv(GLenum target, const GLshort *v)
-{
- d_1_3_Deprecated->f.MultiTexCoord4sv(target, v);
-}
-
-inline void QOpenGLFunctions_3_3_Compatibility::glMultiTexCoord4s(GLenum target, GLshort s, GLshort t, GLshort r, GLshort q)
-{
- d_1_3_Deprecated->f.MultiTexCoord4s(target, s, t, r, q);
-}
-
-inline void QOpenGLFunctions_3_3_Compatibility::glMultiTexCoord4iv(GLenum target, const GLint *v)
-{
- d_1_3_Deprecated->f.MultiTexCoord4iv(target, v);
-}
-
-inline void QOpenGLFunctions_3_3_Compatibility::glMultiTexCoord4i(GLenum target, GLint s, GLint t, GLint r, GLint q)
-{
- d_1_3_Deprecated->f.MultiTexCoord4i(target, s, t, r, q);
-}
-
-inline void QOpenGLFunctions_3_3_Compatibility::glMultiTexCoord4fv(GLenum target, const GLfloat *v)
-{
- d_1_3_Deprecated->f.MultiTexCoord4fv(target, v);
-}
-
-inline void QOpenGLFunctions_3_3_Compatibility::glMultiTexCoord4f(GLenum target, GLfloat s, GLfloat t, GLfloat r, GLfloat q)
-{
- d_1_3_Deprecated->f.MultiTexCoord4f(target, s, t, r, q);
-}
-
-inline void QOpenGLFunctions_3_3_Compatibility::glMultiTexCoord4dv(GLenum target, const GLdouble *v)
-{
- d_1_3_Deprecated->f.MultiTexCoord4dv(target, v);
-}
-
-inline void QOpenGLFunctions_3_3_Compatibility::glMultiTexCoord4d(GLenum target, GLdouble s, GLdouble t, GLdouble r, GLdouble q)
-{
- d_1_3_Deprecated->f.MultiTexCoord4d(target, s, t, r, q);
-}
-
-inline void QOpenGLFunctions_3_3_Compatibility::glMultiTexCoord3sv(GLenum target, const GLshort *v)
-{
- d_1_3_Deprecated->f.MultiTexCoord3sv(target, v);
-}
-
-inline void QOpenGLFunctions_3_3_Compatibility::glMultiTexCoord3s(GLenum target, GLshort s, GLshort t, GLshort r)
-{
- d_1_3_Deprecated->f.MultiTexCoord3s(target, s, t, r);
-}
-
-inline void QOpenGLFunctions_3_3_Compatibility::glMultiTexCoord3iv(GLenum target, const GLint *v)
-{
- d_1_3_Deprecated->f.MultiTexCoord3iv(target, v);
-}
-
-inline void QOpenGLFunctions_3_3_Compatibility::glMultiTexCoord3i(GLenum target, GLint s, GLint t, GLint r)
-{
- d_1_3_Deprecated->f.MultiTexCoord3i(target, s, t, r);
-}
-
-inline void QOpenGLFunctions_3_3_Compatibility::glMultiTexCoord3fv(GLenum target, const GLfloat *v)
-{
- d_1_3_Deprecated->f.MultiTexCoord3fv(target, v);
-}
-
-inline void QOpenGLFunctions_3_3_Compatibility::glMultiTexCoord3f(GLenum target, GLfloat s, GLfloat t, GLfloat r)
-{
- d_1_3_Deprecated->f.MultiTexCoord3f(target, s, t, r);
-}
-
-inline void QOpenGLFunctions_3_3_Compatibility::glMultiTexCoord3dv(GLenum target, const GLdouble *v)
-{
- d_1_3_Deprecated->f.MultiTexCoord3dv(target, v);
-}
-
-inline void QOpenGLFunctions_3_3_Compatibility::glMultiTexCoord3d(GLenum target, GLdouble s, GLdouble t, GLdouble r)
-{
- d_1_3_Deprecated->f.MultiTexCoord3d(target, s, t, r);
-}
-
-inline void QOpenGLFunctions_3_3_Compatibility::glMultiTexCoord2sv(GLenum target, const GLshort *v)
-{
- d_1_3_Deprecated->f.MultiTexCoord2sv(target, v);
-}
-
-inline void QOpenGLFunctions_3_3_Compatibility::glMultiTexCoord2s(GLenum target, GLshort s, GLshort t)
-{
- d_1_3_Deprecated->f.MultiTexCoord2s(target, s, t);
-}
-
-inline void QOpenGLFunctions_3_3_Compatibility::glMultiTexCoord2iv(GLenum target, const GLint *v)
-{
- d_1_3_Deprecated->f.MultiTexCoord2iv(target, v);
-}
-
-inline void QOpenGLFunctions_3_3_Compatibility::glMultiTexCoord2i(GLenum target, GLint s, GLint t)
-{
- d_1_3_Deprecated->f.MultiTexCoord2i(target, s, t);
-}
-
-inline void QOpenGLFunctions_3_3_Compatibility::glMultiTexCoord2fv(GLenum target, const GLfloat *v)
-{
- d_1_3_Deprecated->f.MultiTexCoord2fv(target, v);
-}
-
-inline void QOpenGLFunctions_3_3_Compatibility::glMultiTexCoord2f(GLenum target, GLfloat s, GLfloat t)
-{
- d_1_3_Deprecated->f.MultiTexCoord2f(target, s, t);
-}
-
-inline void QOpenGLFunctions_3_3_Compatibility::glMultiTexCoord2dv(GLenum target, const GLdouble *v)
-{
- d_1_3_Deprecated->f.MultiTexCoord2dv(target, v);
-}
-
-inline void QOpenGLFunctions_3_3_Compatibility::glMultiTexCoord2d(GLenum target, GLdouble s, GLdouble t)
-{
- d_1_3_Deprecated->f.MultiTexCoord2d(target, s, t);
-}
-
-inline void QOpenGLFunctions_3_3_Compatibility::glMultiTexCoord1sv(GLenum target, const GLshort *v)
-{
- d_1_3_Deprecated->f.MultiTexCoord1sv(target, v);
-}
-
-inline void QOpenGLFunctions_3_3_Compatibility::glMultiTexCoord1s(GLenum target, GLshort s)
-{
- d_1_3_Deprecated->f.MultiTexCoord1s(target, s);
-}
-
-inline void QOpenGLFunctions_3_3_Compatibility::glMultiTexCoord1iv(GLenum target, const GLint *v)
-{
- d_1_3_Deprecated->f.MultiTexCoord1iv(target, v);
-}
-
-inline void QOpenGLFunctions_3_3_Compatibility::glMultiTexCoord1i(GLenum target, GLint s)
-{
- d_1_3_Deprecated->f.MultiTexCoord1i(target, s);
-}
-
-inline void QOpenGLFunctions_3_3_Compatibility::glMultiTexCoord1fv(GLenum target, const GLfloat *v)
-{
- d_1_3_Deprecated->f.MultiTexCoord1fv(target, v);
-}
-
-inline void QOpenGLFunctions_3_3_Compatibility::glMultiTexCoord1f(GLenum target, GLfloat s)
-{
- d_1_3_Deprecated->f.MultiTexCoord1f(target, s);
-}
-
-inline void QOpenGLFunctions_3_3_Compatibility::glMultiTexCoord1dv(GLenum target, const GLdouble *v)
-{
- d_1_3_Deprecated->f.MultiTexCoord1dv(target, v);
-}
-
-inline void QOpenGLFunctions_3_3_Compatibility::glMultiTexCoord1d(GLenum target, GLdouble s)
-{
- d_1_3_Deprecated->f.MultiTexCoord1d(target, s);
-}
-
-inline void QOpenGLFunctions_3_3_Compatibility::glClientActiveTexture(GLenum texture)
-{
- d_1_3_Deprecated->f.ClientActiveTexture(texture);
-}
-
-
-// OpenGL 1.4 deprecated functions
-inline void QOpenGLFunctions_3_3_Compatibility::glWindowPos3sv(const GLshort *v)
-{
- d_1_4_Deprecated->f.WindowPos3sv(v);
-}
-
-inline void QOpenGLFunctions_3_3_Compatibility::glWindowPos3s(GLshort x, GLshort y, GLshort z)
-{
- d_1_4_Deprecated->f.WindowPos3s(x, y, z);
-}
-
-inline void QOpenGLFunctions_3_3_Compatibility::glWindowPos3iv(const GLint *v)
-{
- d_1_4_Deprecated->f.WindowPos3iv(v);
-}
-
-inline void QOpenGLFunctions_3_3_Compatibility::glWindowPos3i(GLint x, GLint y, GLint z)
-{
- d_1_4_Deprecated->f.WindowPos3i(x, y, z);
-}
-
-inline void QOpenGLFunctions_3_3_Compatibility::glWindowPos3fv(const GLfloat *v)
-{
- d_1_4_Deprecated->f.WindowPos3fv(v);
-}
-
-inline void QOpenGLFunctions_3_3_Compatibility::glWindowPos3f(GLfloat x, GLfloat y, GLfloat z)
-{
- d_1_4_Deprecated->f.WindowPos3f(x, y, z);
-}
-
-inline void QOpenGLFunctions_3_3_Compatibility::glWindowPos3dv(const GLdouble *v)
-{
- d_1_4_Deprecated->f.WindowPos3dv(v);
-}
-
-inline void QOpenGLFunctions_3_3_Compatibility::glWindowPos3d(GLdouble x, GLdouble y, GLdouble z)
-{
- d_1_4_Deprecated->f.WindowPos3d(x, y, z);
-}
-
-inline void QOpenGLFunctions_3_3_Compatibility::glWindowPos2sv(const GLshort *v)
-{
- d_1_4_Deprecated->f.WindowPos2sv(v);
-}
-
-inline void QOpenGLFunctions_3_3_Compatibility::glWindowPos2s(GLshort x, GLshort y)
-{
- d_1_4_Deprecated->f.WindowPos2s(x, y);
-}
-
-inline void QOpenGLFunctions_3_3_Compatibility::glWindowPos2iv(const GLint *v)
-{
- d_1_4_Deprecated->f.WindowPos2iv(v);
-}
-
-inline void QOpenGLFunctions_3_3_Compatibility::glWindowPos2i(GLint x, GLint y)
-{
- d_1_4_Deprecated->f.WindowPos2i(x, y);
-}
-
-inline void QOpenGLFunctions_3_3_Compatibility::glWindowPos2fv(const GLfloat *v)
-{
- d_1_4_Deprecated->f.WindowPos2fv(v);
-}
-
-inline void QOpenGLFunctions_3_3_Compatibility::glWindowPos2f(GLfloat x, GLfloat y)
-{
- d_1_4_Deprecated->f.WindowPos2f(x, y);
-}
-
-inline void QOpenGLFunctions_3_3_Compatibility::glWindowPos2dv(const GLdouble *v)
-{
- d_1_4_Deprecated->f.WindowPos2dv(v);
-}
-
-inline void QOpenGLFunctions_3_3_Compatibility::glWindowPos2d(GLdouble x, GLdouble y)
-{
- d_1_4_Deprecated->f.WindowPos2d(x, y);
-}
-
-inline void QOpenGLFunctions_3_3_Compatibility::glSecondaryColorPointer(GLint size, GLenum type, GLsizei stride, const GLvoid *pointer)
-{
- d_1_4_Deprecated->f.SecondaryColorPointer(size, type, stride, pointer);
-}
-
-inline void QOpenGLFunctions_3_3_Compatibility::glSecondaryColor3usv(const GLushort *v)
-{
- d_1_4_Deprecated->f.SecondaryColor3usv(v);
-}
-
-inline void QOpenGLFunctions_3_3_Compatibility::glSecondaryColor3us(GLushort red, GLushort green, GLushort blue)
-{
- d_1_4_Deprecated->f.SecondaryColor3us(red, green, blue);
-}
-
-inline void QOpenGLFunctions_3_3_Compatibility::glSecondaryColor3uiv(const GLuint *v)
-{
- d_1_4_Deprecated->f.SecondaryColor3uiv(v);
-}
-
-inline void QOpenGLFunctions_3_3_Compatibility::glSecondaryColor3ui(GLuint red, GLuint green, GLuint blue)
-{
- d_1_4_Deprecated->f.SecondaryColor3ui(red, green, blue);
-}
-
-inline void QOpenGLFunctions_3_3_Compatibility::glSecondaryColor3ubv(const GLubyte *v)
-{
- d_1_4_Deprecated->f.SecondaryColor3ubv(v);
-}
-
-inline void QOpenGLFunctions_3_3_Compatibility::glSecondaryColor3ub(GLubyte red, GLubyte green, GLubyte blue)
-{
- d_1_4_Deprecated->f.SecondaryColor3ub(red, green, blue);
-}
-
-inline void QOpenGLFunctions_3_3_Compatibility::glSecondaryColor3sv(const GLshort *v)
-{
- d_1_4_Deprecated->f.SecondaryColor3sv(v);
-}
-
-inline void QOpenGLFunctions_3_3_Compatibility::glSecondaryColor3s(GLshort red, GLshort green, GLshort blue)
-{
- d_1_4_Deprecated->f.SecondaryColor3s(red, green, blue);
-}
-
-inline void QOpenGLFunctions_3_3_Compatibility::glSecondaryColor3iv(const GLint *v)
-{
- d_1_4_Deprecated->f.SecondaryColor3iv(v);
-}
-
-inline void QOpenGLFunctions_3_3_Compatibility::glSecondaryColor3i(GLint red, GLint green, GLint blue)
-{
- d_1_4_Deprecated->f.SecondaryColor3i(red, green, blue);
-}
-
-inline void QOpenGLFunctions_3_3_Compatibility::glSecondaryColor3fv(const GLfloat *v)
-{
- d_1_4_Deprecated->f.SecondaryColor3fv(v);
-}
-
-inline void QOpenGLFunctions_3_3_Compatibility::glSecondaryColor3f(GLfloat red, GLfloat green, GLfloat blue)
-{
- d_1_4_Deprecated->f.SecondaryColor3f(red, green, blue);
-}
-
-inline void QOpenGLFunctions_3_3_Compatibility::glSecondaryColor3dv(const GLdouble *v)
-{
- d_1_4_Deprecated->f.SecondaryColor3dv(v);
-}
-
-inline void QOpenGLFunctions_3_3_Compatibility::glSecondaryColor3d(GLdouble red, GLdouble green, GLdouble blue)
-{
- d_1_4_Deprecated->f.SecondaryColor3d(red, green, blue);
-}
-
-inline void QOpenGLFunctions_3_3_Compatibility::glSecondaryColor3bv(const GLbyte *v)
-{
- d_1_4_Deprecated->f.SecondaryColor3bv(v);
-}
-
-inline void QOpenGLFunctions_3_3_Compatibility::glSecondaryColor3b(GLbyte red, GLbyte green, GLbyte blue)
-{
- d_1_4_Deprecated->f.SecondaryColor3b(red, green, blue);
-}
-
-inline void QOpenGLFunctions_3_3_Compatibility::glFogCoordPointer(GLenum type, GLsizei stride, const GLvoid *pointer)
-{
- d_1_4_Deprecated->f.FogCoordPointer(type, stride, pointer);
-}
-
-inline void QOpenGLFunctions_3_3_Compatibility::glFogCoorddv(const GLdouble *coord)
-{
- d_1_4_Deprecated->f.FogCoorddv(coord);
-}
-
-inline void QOpenGLFunctions_3_3_Compatibility::glFogCoordd(GLdouble coord)
-{
- d_1_4_Deprecated->f.FogCoordd(coord);
-}
-
-inline void QOpenGLFunctions_3_3_Compatibility::glFogCoordfv(const GLfloat *coord)
-{
- d_1_4_Deprecated->f.FogCoordfv(coord);
-}
-
-inline void QOpenGLFunctions_3_3_Compatibility::glFogCoordf(GLfloat coord)
-{
- d_1_4_Deprecated->f.FogCoordf(coord);
-}
-
-
-// OpenGL 1.5 deprecated functions
-
-// OpenGL 2.0 deprecated functions
-inline void QOpenGLFunctions_3_3_Compatibility::glVertexAttrib4usv(GLuint index, const GLushort *v)
-{
- d_2_0_Core->f.VertexAttrib4usv(index, v);
-}
-
-inline void QOpenGLFunctions_3_3_Compatibility::glVertexAttrib4uiv(GLuint index, const GLuint *v)
-{
- d_2_0_Core->f.VertexAttrib4uiv(index, v);
-}
-
-inline void QOpenGLFunctions_3_3_Compatibility::glVertexAttrib4ubv(GLuint index, const GLubyte *v)
-{
- d_2_0_Core->f.VertexAttrib4ubv(index, v);
-}
-
-inline void QOpenGLFunctions_3_3_Compatibility::glVertexAttrib4sv(GLuint index, const GLshort *v)
-{
- d_2_0_Core->f.VertexAttrib4sv(index, v);
-}
-
-inline void QOpenGLFunctions_3_3_Compatibility::glVertexAttrib4s(GLuint index, GLshort x, GLshort y, GLshort z, GLshort w)
-{
- d_2_0_Core->f.VertexAttrib4s(index, x, y, z, w);
-}
-
-inline void QOpenGLFunctions_3_3_Compatibility::glVertexAttrib4iv(GLuint index, const GLint *v)
-{
- d_2_0_Core->f.VertexAttrib4iv(index, v);
-}
-
-inline void QOpenGLFunctions_3_3_Compatibility::glVertexAttrib4fv(GLuint index, const GLfloat *v)
-{
- d_2_0_Core->f.VertexAttrib4fv(index, v);
-}
-
-inline void QOpenGLFunctions_3_3_Compatibility::glVertexAttrib4f(GLuint index, GLfloat x, GLfloat y, GLfloat z, GLfloat w)
-{
- d_2_0_Core->f.VertexAttrib4f(index, x, y, z, w);
-}
-
-inline void QOpenGLFunctions_3_3_Compatibility::glVertexAttrib4dv(GLuint index, const GLdouble *v)
-{
- d_2_0_Core->f.VertexAttrib4dv(index, v);
-}
-
-inline void QOpenGLFunctions_3_3_Compatibility::glVertexAttrib4d(GLuint index, GLdouble x, GLdouble y, GLdouble z, GLdouble w)
-{
- d_2_0_Core->f.VertexAttrib4d(index, x, y, z, w);
-}
-
-inline void QOpenGLFunctions_3_3_Compatibility::glVertexAttrib4bv(GLuint index, const GLbyte *v)
-{
- d_2_0_Core->f.VertexAttrib4bv(index, v);
-}
-
-inline void QOpenGLFunctions_3_3_Compatibility::glVertexAttrib4Nusv(GLuint index, const GLushort *v)
-{
- d_2_0_Core->f.VertexAttrib4Nusv(index, v);
-}
-
-inline void QOpenGLFunctions_3_3_Compatibility::glVertexAttrib4Nuiv(GLuint index, const GLuint *v)
-{
- d_2_0_Core->f.VertexAttrib4Nuiv(index, v);
-}
-
-inline void QOpenGLFunctions_3_3_Compatibility::glVertexAttrib4Nubv(GLuint index, const GLubyte *v)
-{
- d_2_0_Core->f.VertexAttrib4Nubv(index, v);
-}
-
-inline void QOpenGLFunctions_3_3_Compatibility::glVertexAttrib4Nub(GLuint index, GLubyte x, GLubyte y, GLubyte z, GLubyte w)
-{
- d_2_0_Core->f.VertexAttrib4Nub(index, x, y, z, w);
-}
-
-inline void QOpenGLFunctions_3_3_Compatibility::glVertexAttrib4Nsv(GLuint index, const GLshort *v)
-{
- d_2_0_Core->f.VertexAttrib4Nsv(index, v);
-}
-
-inline void QOpenGLFunctions_3_3_Compatibility::glVertexAttrib4Niv(GLuint index, const GLint *v)
-{
- d_2_0_Core->f.VertexAttrib4Niv(index, v);
-}
-
-inline void QOpenGLFunctions_3_3_Compatibility::glVertexAttrib4Nbv(GLuint index, const GLbyte *v)
-{
- d_2_0_Core->f.VertexAttrib4Nbv(index, v);
-}
-
-inline void QOpenGLFunctions_3_3_Compatibility::glVertexAttrib3sv(GLuint index, const GLshort *v)
-{
- d_2_0_Core->f.VertexAttrib3sv(index, v);
-}
-
-inline void QOpenGLFunctions_3_3_Compatibility::glVertexAttrib3s(GLuint index, GLshort x, GLshort y, GLshort z)
-{
- d_2_0_Core->f.VertexAttrib3s(index, x, y, z);
-}
-
-inline void QOpenGLFunctions_3_3_Compatibility::glVertexAttrib3fv(GLuint index, const GLfloat *v)
-{
- d_2_0_Core->f.VertexAttrib3fv(index, v);
-}
-
-inline void QOpenGLFunctions_3_3_Compatibility::glVertexAttrib3f(GLuint index, GLfloat x, GLfloat y, GLfloat z)
-{
- d_2_0_Core->f.VertexAttrib3f(index, x, y, z);
-}
-
-inline void QOpenGLFunctions_3_3_Compatibility::glVertexAttrib3dv(GLuint index, const GLdouble *v)
-{
- d_2_0_Core->f.VertexAttrib3dv(index, v);
-}
-
-inline void QOpenGLFunctions_3_3_Compatibility::glVertexAttrib3d(GLuint index, GLdouble x, GLdouble y, GLdouble z)
-{
- d_2_0_Core->f.VertexAttrib3d(index, x, y, z);
-}
-
-inline void QOpenGLFunctions_3_3_Compatibility::glVertexAttrib2sv(GLuint index, const GLshort *v)
-{
- d_2_0_Core->f.VertexAttrib2sv(index, v);
-}
-
-inline void QOpenGLFunctions_3_3_Compatibility::glVertexAttrib2s(GLuint index, GLshort x, GLshort y)
-{
- d_2_0_Core->f.VertexAttrib2s(index, x, y);
-}
-
-inline void QOpenGLFunctions_3_3_Compatibility::glVertexAttrib2fv(GLuint index, const GLfloat *v)
-{
- d_2_0_Core->f.VertexAttrib2fv(index, v);
-}
-
-inline void QOpenGLFunctions_3_3_Compatibility::glVertexAttrib2f(GLuint index, GLfloat x, GLfloat y)
-{
- d_2_0_Core->f.VertexAttrib2f(index, x, y);
-}
-
-inline void QOpenGLFunctions_3_3_Compatibility::glVertexAttrib2dv(GLuint index, const GLdouble *v)
-{
- d_2_0_Core->f.VertexAttrib2dv(index, v);
-}
-
-inline void QOpenGLFunctions_3_3_Compatibility::glVertexAttrib2d(GLuint index, GLdouble x, GLdouble y)
-{
- d_2_0_Core->f.VertexAttrib2d(index, x, y);
-}
-
-inline void QOpenGLFunctions_3_3_Compatibility::glVertexAttrib1sv(GLuint index, const GLshort *v)
-{
- d_2_0_Core->f.VertexAttrib1sv(index, v);
-}
-
-inline void QOpenGLFunctions_3_3_Compatibility::glVertexAttrib1s(GLuint index, GLshort x)
-{
- d_2_0_Core->f.VertexAttrib1s(index, x);
-}
-
-inline void QOpenGLFunctions_3_3_Compatibility::glVertexAttrib1fv(GLuint index, const GLfloat *v)
-{
- d_2_0_Core->f.VertexAttrib1fv(index, v);
-}
-
-inline void QOpenGLFunctions_3_3_Compatibility::glVertexAttrib1f(GLuint index, GLfloat x)
-{
- d_2_0_Core->f.VertexAttrib1f(index, x);
-}
-
-inline void QOpenGLFunctions_3_3_Compatibility::glVertexAttrib1dv(GLuint index, const GLdouble *v)
-{
- d_2_0_Core->f.VertexAttrib1dv(index, v);
-}
-
-inline void QOpenGLFunctions_3_3_Compatibility::glVertexAttrib1d(GLuint index, GLdouble x)
-{
- d_2_0_Core->f.VertexAttrib1d(index, x);
-}
-
-
-// OpenGL 2.1 deprecated functions
-
-// OpenGL 3.0 deprecated functions
-inline void QOpenGLFunctions_3_3_Compatibility::glVertexAttribI4usv(GLuint index, const GLushort *v)
-{
- d_3_0_Core->f.VertexAttribI4usv(index, v);
-}
-
-inline void QOpenGLFunctions_3_3_Compatibility::glVertexAttribI4ubv(GLuint index, const GLubyte *v)
-{
- d_3_0_Core->f.VertexAttribI4ubv(index, v);
-}
-
-inline void QOpenGLFunctions_3_3_Compatibility::glVertexAttribI4sv(GLuint index, const GLshort *v)
-{
- d_3_0_Core->f.VertexAttribI4sv(index, v);
-}
-
-inline void QOpenGLFunctions_3_3_Compatibility::glVertexAttribI4bv(GLuint index, const GLbyte *v)
-{
- d_3_0_Core->f.VertexAttribI4bv(index, v);
-}
-
-inline void QOpenGLFunctions_3_3_Compatibility::glVertexAttribI4uiv(GLuint index, const GLuint *v)
-{
- d_3_0_Core->f.VertexAttribI4uiv(index, v);
-}
-
-inline void QOpenGLFunctions_3_3_Compatibility::glVertexAttribI3uiv(GLuint index, const GLuint *v)
-{
- d_3_0_Core->f.VertexAttribI3uiv(index, v);
-}
-
-inline void QOpenGLFunctions_3_3_Compatibility::glVertexAttribI2uiv(GLuint index, const GLuint *v)
-{
- d_3_0_Core->f.VertexAttribI2uiv(index, v);
-}
-
-inline void QOpenGLFunctions_3_3_Compatibility::glVertexAttribI1uiv(GLuint index, const GLuint *v)
-{
- d_3_0_Core->f.VertexAttribI1uiv(index, v);
-}
-
-inline void QOpenGLFunctions_3_3_Compatibility::glVertexAttribI4iv(GLuint index, const GLint *v)
-{
- d_3_0_Core->f.VertexAttribI4iv(index, v);
-}
-
-inline void QOpenGLFunctions_3_3_Compatibility::glVertexAttribI3iv(GLuint index, const GLint *v)
-{
- d_3_0_Core->f.VertexAttribI3iv(index, v);
-}
-
-inline void QOpenGLFunctions_3_3_Compatibility::glVertexAttribI2iv(GLuint index, const GLint *v)
-{
- d_3_0_Core->f.VertexAttribI2iv(index, v);
-}
-
-inline void QOpenGLFunctions_3_3_Compatibility::glVertexAttribI1iv(GLuint index, const GLint *v)
-{
- d_3_0_Core->f.VertexAttribI1iv(index, v);
-}
-
-inline void QOpenGLFunctions_3_3_Compatibility::glVertexAttribI4ui(GLuint index, GLuint x, GLuint y, GLuint z, GLuint w)
-{
- d_3_0_Core->f.VertexAttribI4ui(index, x, y, z, w);
-}
-
-inline void QOpenGLFunctions_3_3_Compatibility::glVertexAttribI3ui(GLuint index, GLuint x, GLuint y, GLuint z)
-{
- d_3_0_Core->f.VertexAttribI3ui(index, x, y, z);
-}
-
-inline void QOpenGLFunctions_3_3_Compatibility::glVertexAttribI2ui(GLuint index, GLuint x, GLuint y)
-{
- d_3_0_Core->f.VertexAttribI2ui(index, x, y);
-}
-
-inline void QOpenGLFunctions_3_3_Compatibility::glVertexAttribI1ui(GLuint index, GLuint x)
-{
- d_3_0_Core->f.VertexAttribI1ui(index, x);
-}
-
-inline void QOpenGLFunctions_3_3_Compatibility::glVertexAttribI4i(GLuint index, GLint x, GLint y, GLint z, GLint w)
-{
- d_3_0_Core->f.VertexAttribI4i(index, x, y, z, w);
-}
-
-inline void QOpenGLFunctions_3_3_Compatibility::glVertexAttribI3i(GLuint index, GLint x, GLint y, GLint z)
-{
- d_3_0_Core->f.VertexAttribI3i(index, x, y, z);
-}
-
-inline void QOpenGLFunctions_3_3_Compatibility::glVertexAttribI2i(GLuint index, GLint x, GLint y)
-{
- d_3_0_Core->f.VertexAttribI2i(index, x, y);
-}
-
-inline void QOpenGLFunctions_3_3_Compatibility::glVertexAttribI1i(GLuint index, GLint x)
-{
- d_3_0_Core->f.VertexAttribI1i(index, x);
-}
-
-
-// OpenGL 3.1 deprecated functions
-
-// OpenGL 3.2 deprecated functions
-
-// OpenGL 3.3 deprecated functions
-
-
-QT_END_NAMESPACE
-
-#endif // QT_NO_OPENGL && !QT_OPENGL_ES_2
-
-#endif
diff --git a/src/gui/opengl/qopenglfunctions_3_3_core.cpp b/src/gui/opengl/qopenglfunctions_3_3_core.cpp
deleted file mode 100644
index 277ad1eb14..0000000000
--- a/src/gui/opengl/qopenglfunctions_3_3_core.cpp
+++ /dev/null
@@ -1,224 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2013 Klaralvdalens Datakonsult AB (KDAB)
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the QtGui module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-**
-** This file was generated by glgen version 0.1
-** Command line was: glgen
-**
-** glgen is Copyright (C) 2013 Klaralvdalens Datakonsult AB (KDAB)
-**
-** This is an auto-generated file.
-** Do not edit! All changes made to it will be lost.
-**
-****************************************************************************/
-
-#include "qopenglfunctions_3_3_core.h"
-#include "qopenglcontext.h"
-
-QT_BEGIN_NAMESPACE
-
-/*!
- \class QOpenGLFunctions_3_3_Core
- \inmodule QtGui
- \since 5.1
- \wrapper
- \brief The QOpenGLFunctions_3_3_Core class provides all functions for OpenGL 3.3 core profile.
-
- This class is a wrapper for functions from OpenGL 3.3 core profile.
- See reference pages on \l {http://www.opengl.org/sdk/docs/}{opengl.org}
- for function documentation.
-
- \sa QAbstractOpenGLFunctions
-*/
-
-QOpenGLFunctions_3_3_Core::QOpenGLFunctions_3_3_Core()
- : QAbstractOpenGLFunctions()
- , d_1_0_Core(nullptr)
- , d_1_1_Core(nullptr)
- , d_1_2_Core(nullptr)
- , d_1_3_Core(nullptr)
- , d_1_4_Core(nullptr)
- , d_1_5_Core(nullptr)
- , d_2_0_Core(nullptr)
- , d_2_1_Core(nullptr)
- , d_3_0_Core(nullptr)
- , d_3_1_Core(nullptr)
- , d_3_2_Core(nullptr)
- , d_3_3_Core(nullptr)
-{
-}
-
-QOpenGLFunctions_3_3_Core::~QOpenGLFunctions_3_3_Core()
-{
- if (d_1_0_Core) {
- d_1_0_Core->refs.deref();
- Q_ASSERT(d_1_0_Core->refs.loadRelaxed());
- }
- if (d_1_1_Core) {
- d_1_1_Core->refs.deref();
- Q_ASSERT(d_1_1_Core->refs.loadRelaxed());
- }
- if (d_1_2_Core) {
- d_1_2_Core->refs.deref();
- Q_ASSERT(d_1_2_Core->refs.loadRelaxed());
- }
- if (d_1_3_Core) {
- d_1_3_Core->refs.deref();
- Q_ASSERT(d_1_3_Core->refs.loadRelaxed());
- }
- if (d_1_4_Core) {
- d_1_4_Core->refs.deref();
- Q_ASSERT(d_1_4_Core->refs.loadRelaxed());
- }
- if (d_1_5_Core) {
- d_1_5_Core->refs.deref();
- Q_ASSERT(d_1_5_Core->refs.loadRelaxed());
- }
- if (d_2_0_Core) {
- d_2_0_Core->refs.deref();
- Q_ASSERT(d_2_0_Core->refs.loadRelaxed());
- }
- if (d_2_1_Core) {
- d_2_1_Core->refs.deref();
- Q_ASSERT(d_2_1_Core->refs.loadRelaxed());
- }
- if (d_3_0_Core) {
- d_3_0_Core->refs.deref();
- Q_ASSERT(d_3_0_Core->refs.loadRelaxed());
- }
- if (d_3_1_Core) {
- d_3_1_Core->refs.deref();
- Q_ASSERT(d_3_1_Core->refs.loadRelaxed());
- }
- if (d_3_2_Core) {
- d_3_2_Core->refs.deref();
- Q_ASSERT(d_3_2_Core->refs.loadRelaxed());
- }
- if (d_3_3_Core) {
- d_3_3_Core->refs.deref();
- Q_ASSERT(d_3_3_Core->refs.loadRelaxed());
- }
-}
-
-bool QOpenGLFunctions_3_3_Core::initializeOpenGLFunctions()
-{
- if ( isInitialized() )
- return true;
-
- QOpenGLContext* context = QOpenGLContext::currentContext();
-
- // If owned by a context object make sure it is current.
- // Also check that current context is capable of resolving all needed functions
- if (((owningContext() && owningContext() == context) || !owningContext())
- && QOpenGLFunctions_3_3_Core::isContextCompatible(context))
- {
- // Associate with private implementation, creating if necessary
- // Function pointers in the backends are resolved at creation time
- QOpenGLVersionFunctionsBackend* d = nullptr;
- d = QAbstractOpenGLFunctionsPrivate::functionsBackend(context, QOpenGLFunctions_1_0_CoreBackend::versionStatus());
- d_1_0_Core = static_cast<QOpenGLFunctions_1_0_CoreBackend*>(d);
- d->refs.ref();
-
- d = QAbstractOpenGLFunctionsPrivate::functionsBackend(context, QOpenGLFunctions_1_1_CoreBackend::versionStatus());
- d_1_1_Core = static_cast<QOpenGLFunctions_1_1_CoreBackend*>(d);
- d->refs.ref();
-
- d = QAbstractOpenGLFunctionsPrivate::functionsBackend(context, QOpenGLFunctions_1_2_CoreBackend::versionStatus());
- d_1_2_Core = static_cast<QOpenGLFunctions_1_2_CoreBackend*>(d);
- d->refs.ref();
-
- d = QAbstractOpenGLFunctionsPrivate::functionsBackend(context, QOpenGLFunctions_1_3_CoreBackend::versionStatus());
- d_1_3_Core = static_cast<QOpenGLFunctions_1_3_CoreBackend*>(d);
- d->refs.ref();
-
- d = QAbstractOpenGLFunctionsPrivate::functionsBackend(context, QOpenGLFunctions_1_4_CoreBackend::versionStatus());
- d_1_4_Core = static_cast<QOpenGLFunctions_1_4_CoreBackend*>(d);
- d->refs.ref();
-
- d = QAbstractOpenGLFunctionsPrivate::functionsBackend(context, QOpenGLFunctions_1_5_CoreBackend::versionStatus());
- d_1_5_Core = static_cast<QOpenGLFunctions_1_5_CoreBackend*>(d);
- d->refs.ref();
-
- d = QAbstractOpenGLFunctionsPrivate::functionsBackend(context, QOpenGLFunctions_2_0_CoreBackend::versionStatus());
- d_2_0_Core = static_cast<QOpenGLFunctions_2_0_CoreBackend*>(d);
- d->refs.ref();
-
- d = QAbstractOpenGLFunctionsPrivate::functionsBackend(context, QOpenGLFunctions_2_1_CoreBackend::versionStatus());
- d_2_1_Core = static_cast<QOpenGLFunctions_2_1_CoreBackend*>(d);
- d->refs.ref();
-
- d = QAbstractOpenGLFunctionsPrivate::functionsBackend(context, QOpenGLFunctions_3_0_CoreBackend::versionStatus());
- d_3_0_Core = static_cast<QOpenGLFunctions_3_0_CoreBackend*>(d);
- d->refs.ref();
-
- d = QAbstractOpenGLFunctionsPrivate::functionsBackend(context, QOpenGLFunctions_3_1_CoreBackend::versionStatus());
- d_3_1_Core = static_cast<QOpenGLFunctions_3_1_CoreBackend*>(d);
- d->refs.ref();
-
- d = QAbstractOpenGLFunctionsPrivate::functionsBackend(context, QOpenGLFunctions_3_2_CoreBackend::versionStatus());
- d_3_2_Core = static_cast<QOpenGLFunctions_3_2_CoreBackend*>(d);
- d->refs.ref();
-
- d = QAbstractOpenGLFunctionsPrivate::functionsBackend(context, QOpenGLFunctions_3_3_CoreBackend::versionStatus());
- d_3_3_Core = static_cast<QOpenGLFunctions_3_3_CoreBackend*>(d);
- d->refs.ref();
-
- QAbstractOpenGLFunctions::initializeOpenGLFunctions();
- }
- return isInitialized();
-}
-
-bool QOpenGLFunctions_3_3_Core::isContextCompatible(QOpenGLContext *context)
-{
- Q_ASSERT(context);
- QSurfaceFormat f = context->format();
- const QPair<int, int> v = qMakePair(f.majorVersion(), f.minorVersion());
- if (v < qMakePair(3, 3))
- return false;
-
- return true;
-}
-
-QOpenGLVersionProfile QOpenGLFunctions_3_3_Core::versionProfile()
-{
- QOpenGLVersionProfile v;
- v.setVersion(3, 3);
- v.setProfile(QSurfaceFormat::CoreProfile);
- return v;
-}
-
-QT_END_NAMESPACE
diff --git a/src/gui/opengl/qopenglfunctions_3_3_core.h b/src/gui/opengl/qopenglfunctions_3_3_core.h
deleted file mode 100644
index 47d54d717e..0000000000
--- a/src/gui/opengl/qopenglfunctions_3_3_core.h
+++ /dev/null
@@ -1,2141 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2013 Klaralvdalens Datakonsult AB (KDAB)
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the QtGui module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-**
-** This file was generated by glgen version 0.1
-** Command line was: glgen
-**
-** glgen is Copyright (C) 2013 Klaralvdalens Datakonsult AB (KDAB)
-**
-** This is an auto-generated file.
-** Do not edit! All changes made to it will be lost.
-**
-****************************************************************************/
-
-#ifndef QOPENGLVERSIONFUNCTIONS_3_3_CORE_H
-#define QOPENGLVERSIONFUNCTIONS_3_3_CORE_H
-
-#include <QtGui/qtguiglobal.h>
-
-#if !defined(QT_NO_OPENGL) && !defined(QT_OPENGL_ES_2)
-
-#include <QtGui/QOpenGLVersionFunctions>
-#include <QtGui/qopenglcontext.h>
-
-QT_BEGIN_NAMESPACE
-
-class Q_GUI_EXPORT QOpenGLFunctions_3_3_Core : public QAbstractOpenGLFunctions
-{
-public:
- QOpenGLFunctions_3_3_Core();
- ~QOpenGLFunctions_3_3_Core();
-
- bool initializeOpenGLFunctions() override;
-
- // OpenGL 1.0 core functions
- void glViewport(GLint x, GLint y, GLsizei width, GLsizei height);
- void glDepthRange(GLdouble nearVal, GLdouble farVal);
- GLboolean glIsEnabled(GLenum cap);
- void glGetTexLevelParameteriv(GLenum target, GLint level, GLenum pname, GLint *params);
- void glGetTexLevelParameterfv(GLenum target, GLint level, GLenum pname, GLfloat *params);
- void glGetTexParameteriv(GLenum target, GLenum pname, GLint *params);
- void glGetTexParameterfv(GLenum target, GLenum pname, GLfloat *params);
- void glGetTexImage(GLenum target, GLint level, GLenum format, GLenum type, GLvoid *pixels);
- const GLubyte * glGetString(GLenum name);
- void glGetIntegerv(GLenum pname, GLint *params);
- void glGetFloatv(GLenum pname, GLfloat *params);
- GLenum glGetError();
- void glGetDoublev(GLenum pname, GLdouble *params);
- void glGetBooleanv(GLenum pname, GLboolean *params);
- void glReadPixels(GLint x, GLint y, GLsizei width, GLsizei height, GLenum format, GLenum type, GLvoid *pixels);
- void glReadBuffer(GLenum mode);
- void glPixelStorei(GLenum pname, GLint param);
- void glPixelStoref(GLenum pname, GLfloat param);
- void glDepthFunc(GLenum func);
- void glStencilOp(GLenum fail, GLenum zfail, GLenum zpass);
- void glStencilFunc(GLenum func, GLint ref, GLuint mask);
- void glLogicOp(GLenum opcode);
- void glBlendFunc(GLenum sfactor, GLenum dfactor);
- void glFlush();
- void glFinish();
- void glEnable(GLenum cap);
- void glDisable(GLenum cap);
- void glDepthMask(GLboolean flag);
- void glColorMask(GLboolean red, GLboolean green, GLboolean blue, GLboolean alpha);
- void glStencilMask(GLuint mask);
- void glClearDepth(GLdouble depth);
- void glClearStencil(GLint s);
- void glClearColor(GLfloat red, GLfloat green, GLfloat blue, GLfloat alpha);
- void glClear(GLbitfield mask);
- void glDrawBuffer(GLenum mode);
- void glTexImage2D(GLenum target, GLint level, GLint internalformat, GLsizei width, GLsizei height, GLint border, GLenum format, GLenum type, const GLvoid *pixels);
- void glTexImage1D(GLenum target, GLint level, GLint internalformat, GLsizei width, GLint border, GLenum format, GLenum type, const GLvoid *pixels);
- void glTexParameteriv(GLenum target, GLenum pname, const GLint *params);
- void glTexParameteri(GLenum target, GLenum pname, GLint param);
- void glTexParameterfv(GLenum target, GLenum pname, const GLfloat *params);
- void glTexParameterf(GLenum target, GLenum pname, GLfloat param);
- void glScissor(GLint x, GLint y, GLsizei width, GLsizei height);
- void glPolygonMode(GLenum face, GLenum mode);
- void glPointSize(GLfloat size);
- void glLineWidth(GLfloat width);
- void glHint(GLenum target, GLenum mode);
- void glFrontFace(GLenum mode);
- void glCullFace(GLenum mode);
-
- // OpenGL 1.1 core functions
- void glIndexubv(const GLubyte *c);
- void glIndexub(GLubyte c);
- GLboolean glIsTexture(GLuint texture);
- void glGenTextures(GLsizei n, GLuint *textures);
- void glDeleteTextures(GLsizei n, const GLuint *textures);
- void glBindTexture(GLenum target, GLuint texture);
- void glTexSubImage2D(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLenum type, const GLvoid *pixels);
- void glTexSubImage1D(GLenum target, GLint level, GLint xoffset, GLsizei width, GLenum format, GLenum type, const GLvoid *pixels);
- void glCopyTexSubImage2D(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint x, GLint y, GLsizei width, GLsizei height);
- void glCopyTexSubImage1D(GLenum target, GLint level, GLint xoffset, GLint x, GLint y, GLsizei width);
- void glCopyTexImage2D(GLenum target, GLint level, GLenum internalformat, GLint x, GLint y, GLsizei width, GLsizei height, GLint border);
- void glCopyTexImage1D(GLenum target, GLint level, GLenum internalformat, GLint x, GLint y, GLsizei width, GLint border);
- void glPolygonOffset(GLfloat factor, GLfloat units);
- void glGetPointerv(GLenum pname, GLvoid* *params);
- void glDrawElements(GLenum mode, GLsizei count, GLenum type, const GLvoid *indices);
- void glDrawArrays(GLenum mode, GLint first, GLsizei count);
-
- // OpenGL 1.2 core functions
- void glCopyTexSubImage3D(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLint x, GLint y, GLsizei width, GLsizei height);
- void glTexSubImage3D(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLenum type, const GLvoid *pixels);
- void glTexImage3D(GLenum target, GLint level, GLint internalformat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLenum format, GLenum type, const GLvoid *pixels);
- void glDrawRangeElements(GLenum mode, GLuint start, GLuint end, GLsizei count, GLenum type, const GLvoid *indices);
- void glBlendEquation(GLenum mode);
- void glBlendColor(GLfloat red, GLfloat green, GLfloat blue, GLfloat alpha);
-
- // OpenGL 1.3 core functions
- void glGetCompressedTexImage(GLenum target, GLint level, GLvoid *img);
- void glCompressedTexSubImage1D(GLenum target, GLint level, GLint xoffset, GLsizei width, GLenum format, GLsizei imageSize, const GLvoid *data);
- void glCompressedTexSubImage2D(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLsizei imageSize, const GLvoid *data);
- void glCompressedTexSubImage3D(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLsizei imageSize, const GLvoid *data);
- void glCompressedTexImage1D(GLenum target, GLint level, GLenum internalformat, GLsizei width, GLint border, GLsizei imageSize, const GLvoid *data);
- void glCompressedTexImage2D(GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLint border, GLsizei imageSize, const GLvoid *data);
- void glCompressedTexImage3D(GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLsizei imageSize, const GLvoid *data);
- void glSampleCoverage(GLfloat value, GLboolean invert);
- void glActiveTexture(GLenum texture);
-
- // OpenGL 1.4 core functions
- void glPointParameteriv(GLenum pname, const GLint *params);
- void glPointParameteri(GLenum pname, GLint param);
- void glPointParameterfv(GLenum pname, const GLfloat *params);
- void glPointParameterf(GLenum pname, GLfloat param);
- void glMultiDrawElements(GLenum mode, const GLsizei *count, GLenum type, const GLvoid* const *indices, GLsizei drawcount);
- void glMultiDrawArrays(GLenum mode, const GLint *first, const GLsizei *count, GLsizei drawcount);
- void glBlendFuncSeparate(GLenum sfactorRGB, GLenum dfactorRGB, GLenum sfactorAlpha, GLenum dfactorAlpha);
-
- // OpenGL 1.5 core functions
- void glGetBufferPointerv(GLenum target, GLenum pname, GLvoid* *params);
- void glGetBufferParameteriv(GLenum target, GLenum pname, GLint *params);
- GLboolean glUnmapBuffer(GLenum target);
- GLvoid* glMapBuffer(GLenum target, GLenum access);
- void glGetBufferSubData(GLenum target, GLintptr offset, GLsizeiptr size, GLvoid *data);
- void glBufferSubData(GLenum target, GLintptr offset, GLsizeiptr size, const GLvoid *data);
- void glBufferData(GLenum target, GLsizeiptr size, const GLvoid *data, GLenum usage);
- GLboolean glIsBuffer(GLuint buffer);
- void glGenBuffers(GLsizei n, GLuint *buffers);
- void glDeleteBuffers(GLsizei n, const GLuint *buffers);
- void glBindBuffer(GLenum target, GLuint buffer);
- void glGetQueryObjectuiv(GLuint id, GLenum pname, GLuint *params);
- void glGetQueryObjectiv(GLuint id, GLenum pname, GLint *params);
- void glGetQueryiv(GLenum target, GLenum pname, GLint *params);
- void glEndQuery(GLenum target);
- void glBeginQuery(GLenum target, GLuint id);
- GLboolean glIsQuery(GLuint id);
- void glDeleteQueries(GLsizei n, const GLuint *ids);
- void glGenQueries(GLsizei n, GLuint *ids);
-
- // OpenGL 2.0 core functions
- void glVertexAttribPointer(GLuint index, GLint size, GLenum type, GLboolean normalized, GLsizei stride, const GLvoid *pointer);
- void glValidateProgram(GLuint program);
- void glUniformMatrix4fv(GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
- void glUniformMatrix3fv(GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
- void glUniformMatrix2fv(GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
- void glUniform4iv(GLint location, GLsizei count, const GLint *value);
- void glUniform3iv(GLint location, GLsizei count, const GLint *value);
- void glUniform2iv(GLint location, GLsizei count, const GLint *value);
- void glUniform1iv(GLint location, GLsizei count, const GLint *value);
- void glUniform4fv(GLint location, GLsizei count, const GLfloat *value);
- void glUniform3fv(GLint location, GLsizei count, const GLfloat *value);
- void glUniform2fv(GLint location, GLsizei count, const GLfloat *value);
- void glUniform1fv(GLint location, GLsizei count, const GLfloat *value);
- void glUniform4i(GLint location, GLint v0, GLint v1, GLint v2, GLint v3);
- void glUniform3i(GLint location, GLint v0, GLint v1, GLint v2);
- void glUniform2i(GLint location, GLint v0, GLint v1);
- void glUniform1i(GLint location, GLint v0);
- void glUniform4f(GLint location, GLfloat v0, GLfloat v1, GLfloat v2, GLfloat v3);
- void glUniform3f(GLint location, GLfloat v0, GLfloat v1, GLfloat v2);
- void glUniform2f(GLint location, GLfloat v0, GLfloat v1);
- void glUniform1f(GLint location, GLfloat v0);
- void glUseProgram(GLuint program);
- void glShaderSource(GLuint shader, GLsizei count, const GLchar* const *string, const GLint *length);
- void glLinkProgram(GLuint program);
- GLboolean glIsShader(GLuint shader);
- GLboolean glIsProgram(GLuint program);
- void glGetVertexAttribPointerv(GLuint index, GLenum pname, GLvoid* *pointer);
- void glGetVertexAttribiv(GLuint index, GLenum pname, GLint *params);
- void glGetVertexAttribfv(GLuint index, GLenum pname, GLfloat *params);
- void glGetVertexAttribdv(GLuint index, GLenum pname, GLdouble *params);
- void glGetUniformiv(GLuint program, GLint location, GLint *params);
- void glGetUniformfv(GLuint program, GLint location, GLfloat *params);
- GLint glGetUniformLocation(GLuint program, const GLchar *name);
- void glGetShaderSource(GLuint shader, GLsizei bufSize, GLsizei *length, GLchar *source);
- void glGetShaderInfoLog(GLuint shader, GLsizei bufSize, GLsizei *length, GLchar *infoLog);
- void glGetShaderiv(GLuint shader, GLenum pname, GLint *params);
- void glGetProgramInfoLog(GLuint program, GLsizei bufSize, GLsizei *length, GLchar *infoLog);
- void glGetProgramiv(GLuint program, GLenum pname, GLint *params);
- GLint glGetAttribLocation(GLuint program, const GLchar *name);
- void glGetAttachedShaders(GLuint program, GLsizei maxCount, GLsizei *count, GLuint *obj);
- void glGetActiveUniform(GLuint program, GLuint index, GLsizei bufSize, GLsizei *length, GLint *size, GLenum *type, GLchar *name);
- void glGetActiveAttrib(GLuint program, GLuint index, GLsizei bufSize, GLsizei *length, GLint *size, GLenum *type, GLchar *name);
- void glEnableVertexAttribArray(GLuint index);
- void glDisableVertexAttribArray(GLuint index);
- void glDetachShader(GLuint program, GLuint shader);
- void glDeleteShader(GLuint shader);
- void glDeleteProgram(GLuint program);
- GLuint glCreateShader(GLenum type);
- GLuint glCreateProgram();
- void glCompileShader(GLuint shader);
- void glBindAttribLocation(GLuint program, GLuint index, const GLchar *name);
- void glAttachShader(GLuint program, GLuint shader);
- void glStencilMaskSeparate(GLenum face, GLuint mask);
- void glStencilFuncSeparate(GLenum face, GLenum func, GLint ref, GLuint mask);
- void glStencilOpSeparate(GLenum face, GLenum sfail, GLenum dpfail, GLenum dppass);
- void glDrawBuffers(GLsizei n, const GLenum *bufs);
- void glBlendEquationSeparate(GLenum modeRGB, GLenum modeAlpha);
-
- // OpenGL 2.1 core functions
- void glUniformMatrix4x3fv(GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
- void glUniformMatrix3x4fv(GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
- void glUniformMatrix4x2fv(GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
- void glUniformMatrix2x4fv(GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
- void glUniformMatrix3x2fv(GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
- void glUniformMatrix2x3fv(GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
-
- // OpenGL 3.0 core functions
- GLboolean glIsVertexArray(GLuint array);
- void glGenVertexArrays(GLsizei n, GLuint *arrays);
- void glDeleteVertexArrays(GLsizei n, const GLuint *arrays);
- void glBindVertexArray(GLuint array);
- void glFlushMappedBufferRange(GLenum target, GLintptr offset, GLsizeiptr length);
- GLvoid* glMapBufferRange(GLenum target, GLintptr offset, GLsizeiptr length, GLbitfield access);
- void glFramebufferTextureLayer(GLenum target, GLenum attachment, GLuint texture, GLint level, GLint layer);
- void glRenderbufferStorageMultisample(GLenum target, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height);
- void glBlitFramebuffer(GLint srcX0, GLint srcY0, GLint srcX1, GLint srcY1, GLint dstX0, GLint dstY0, GLint dstX1, GLint dstY1, GLbitfield mask, GLenum filter);
- void glGenerateMipmap(GLenum target);
- void glGetFramebufferAttachmentParameteriv(GLenum target, GLenum attachment, GLenum pname, GLint *params);
- void glFramebufferRenderbuffer(GLenum target, GLenum attachment, GLenum renderbuffertarget, GLuint renderbuffer);
- void glFramebufferTexture3D(GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level, GLint zoffset);
- void glFramebufferTexture2D(GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level);
- void glFramebufferTexture1D(GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level);
- GLenum glCheckFramebufferStatus(GLenum target);
- void glGenFramebuffers(GLsizei n, GLuint *framebuffers);
- void glDeleteFramebuffers(GLsizei n, const GLuint *framebuffers);
- void glBindFramebuffer(GLenum target, GLuint framebuffer);
- GLboolean glIsFramebuffer(GLuint framebuffer);
- void glGetRenderbufferParameteriv(GLenum target, GLenum pname, GLint *params);
- void glRenderbufferStorage(GLenum target, GLenum internalformat, GLsizei width, GLsizei height);
- void glGenRenderbuffers(GLsizei n, GLuint *renderbuffers);
- void glDeleteRenderbuffers(GLsizei n, const GLuint *renderbuffers);
- void glBindRenderbuffer(GLenum target, GLuint renderbuffer);
- GLboolean glIsRenderbuffer(GLuint renderbuffer);
- const GLubyte * glGetStringi(GLenum name, GLuint index);
- void glClearBufferfi(GLenum buffer, GLint drawbuffer, GLfloat depth, GLint stencil);
- void glClearBufferfv(GLenum buffer, GLint drawbuffer, const GLfloat *value);
- void glClearBufferuiv(GLenum buffer, GLint drawbuffer, const GLuint *value);
- void glClearBufferiv(GLenum buffer, GLint drawbuffer, const GLint *value);
- void glGetTexParameterIuiv(GLenum target, GLenum pname, GLuint *params);
- void glGetTexParameterIiv(GLenum target, GLenum pname, GLint *params);
- void glTexParameterIuiv(GLenum target, GLenum pname, const GLuint *params);
- void glTexParameterIiv(GLenum target, GLenum pname, const GLint *params);
- void glUniform4uiv(GLint location, GLsizei count, const GLuint *value);
- void glUniform3uiv(GLint location, GLsizei count, const GLuint *value);
- void glUniform2uiv(GLint location, GLsizei count, const GLuint *value);
- void glUniform1uiv(GLint location, GLsizei count, const GLuint *value);
- void glUniform4ui(GLint location, GLuint v0, GLuint v1, GLuint v2, GLuint v3);
- void glUniform3ui(GLint location, GLuint v0, GLuint v1, GLuint v2);
- void glUniform2ui(GLint location, GLuint v0, GLuint v1);
- void glUniform1ui(GLint location, GLuint v0);
- GLint glGetFragDataLocation(GLuint program, const GLchar *name);
- void glBindFragDataLocation(GLuint program, GLuint color, const GLchar *name);
- void glGetUniformuiv(GLuint program, GLint location, GLuint *params);
- void glGetVertexAttribIuiv(GLuint index, GLenum pname, GLuint *params);
- void glGetVertexAttribIiv(GLuint index, GLenum pname, GLint *params);
- void glVertexAttribIPointer(GLuint index, GLint size, GLenum type, GLsizei stride, const GLvoid *pointer);
- void glEndConditionalRender();
- void glBeginConditionalRender(GLuint id, GLenum mode);
- void glClampColor(GLenum target, GLenum clamp);
- void glGetTransformFeedbackVarying(GLuint program, GLuint index, GLsizei bufSize, GLsizei *length, GLsizei *size, GLenum *type, GLchar *name);
- void glTransformFeedbackVaryings(GLuint program, GLsizei count, const GLchar* const *varyings, GLenum bufferMode);
- void glBindBufferBase(GLenum target, GLuint index, GLuint buffer);
- void glBindBufferRange(GLenum target, GLuint index, GLuint buffer, GLintptr offset, GLsizeiptr size);
- void glEndTransformFeedback();
- void glBeginTransformFeedback(GLenum primitiveMode);
- GLboolean glIsEnabledi(GLenum target, GLuint index);
- void glDisablei(GLenum target, GLuint index);
- void glEnablei(GLenum target, GLuint index);
- void glGetIntegeri_v(GLenum target, GLuint index, GLint *data);
- void glGetBooleani_v(GLenum target, GLuint index, GLboolean *data);
- void glColorMaski(GLuint index, GLboolean r, GLboolean g, GLboolean b, GLboolean a);
-
- // OpenGL 3.1 core functions
- void glCopyBufferSubData(GLenum readTarget, GLenum writeTarget, GLintptr readOffset, GLintptr writeOffset, GLsizeiptr size);
- void glUniformBlockBinding(GLuint program, GLuint uniformBlockIndex, GLuint uniformBlockBinding);
- void glGetActiveUniformBlockName(GLuint program, GLuint uniformBlockIndex, GLsizei bufSize, GLsizei *length, GLchar *uniformBlockName);
- void glGetActiveUniformBlockiv(GLuint program, GLuint uniformBlockIndex, GLenum pname, GLint *params);
- GLuint glGetUniformBlockIndex(GLuint program, const GLchar *uniformBlockName);
- void glGetActiveUniformName(GLuint program, GLuint uniformIndex, GLsizei bufSize, GLsizei *length, GLchar *uniformName);
- void glGetActiveUniformsiv(GLuint program, GLsizei uniformCount, const GLuint *uniformIndices, GLenum pname, GLint *params);
- void glGetUniformIndices(GLuint program, GLsizei uniformCount, const GLchar* const *uniformNames, GLuint *uniformIndices);
- void glPrimitiveRestartIndex(GLuint index);
- void glTexBuffer(GLenum target, GLenum internalformat, GLuint buffer);
- void glDrawElementsInstanced(GLenum mode, GLsizei count, GLenum type, const GLvoid *indices, GLsizei instancecount);
- void glDrawArraysInstanced(GLenum mode, GLint first, GLsizei count, GLsizei instancecount);
-
- // OpenGL 3.2 core functions
- void glSampleMaski(GLuint index, GLbitfield mask);
- void glGetMultisamplefv(GLenum pname, GLuint index, GLfloat *val);
- void glTexImage3DMultisample(GLenum target, GLsizei samples, GLint internalformat, GLsizei width, GLsizei height, GLsizei depth, GLboolean fixedsamplelocations);
- void glTexImage2DMultisample(GLenum target, GLsizei samples, GLint internalformat, GLsizei width, GLsizei height, GLboolean fixedsamplelocations);
- void glGetSynciv(GLsync sync, GLenum pname, GLsizei bufSize, GLsizei *length, GLint *values);
- void glGetInteger64v(GLenum pname, GLint64 *params);
- void glWaitSync(GLsync sync, GLbitfield flags, GLuint64 timeout);
- GLenum glClientWaitSync(GLsync sync, GLbitfield flags, GLuint64 timeout);
- void glDeleteSync(GLsync sync);
- GLboolean glIsSync(GLsync sync);
- GLsync glFenceSync(GLenum condition, GLbitfield flags);
- void glProvokingVertex(GLenum mode);
- void glMultiDrawElementsBaseVertex(GLenum mode, const GLsizei *count, GLenum type, const GLvoid* const *indices, GLsizei drawcount, const GLint *basevertex);
- void glDrawElementsInstancedBaseVertex(GLenum mode, GLsizei count, GLenum type, const GLvoid *indices, GLsizei instancecount, GLint basevertex);
- void glDrawRangeElementsBaseVertex(GLenum mode, GLuint start, GLuint end, GLsizei count, GLenum type, const GLvoid *indices, GLint basevertex);
- void glDrawElementsBaseVertex(GLenum mode, GLsizei count, GLenum type, const GLvoid *indices, GLint basevertex);
- void glFramebufferTexture(GLenum target, GLenum attachment, GLuint texture, GLint level);
- void glGetBufferParameteri64v(GLenum target, GLenum pname, GLint64 *params);
- void glGetInteger64i_v(GLenum target, GLuint index, GLint64 *data);
-
- // OpenGL 3.3 core functions
- void glVertexAttribP4uiv(GLuint index, GLenum type, GLboolean normalized, const GLuint *value);
- void glVertexAttribP4ui(GLuint index, GLenum type, GLboolean normalized, GLuint value);
- void glVertexAttribP3uiv(GLuint index, GLenum type, GLboolean normalized, const GLuint *value);
- void glVertexAttribP3ui(GLuint index, GLenum type, GLboolean normalized, GLuint value);
- void glVertexAttribP2uiv(GLuint index, GLenum type, GLboolean normalized, const GLuint *value);
- void glVertexAttribP2ui(GLuint index, GLenum type, GLboolean normalized, GLuint value);
- void glVertexAttribP1uiv(GLuint index, GLenum type, GLboolean normalized, const GLuint *value);
- void glVertexAttribP1ui(GLuint index, GLenum type, GLboolean normalized, GLuint value);
- void glSecondaryColorP3uiv(GLenum type, const GLuint *color);
- void glSecondaryColorP3ui(GLenum type, GLuint color);
- void glColorP4uiv(GLenum type, const GLuint *color);
- void glColorP4ui(GLenum type, GLuint color);
- void glColorP3uiv(GLenum type, const GLuint *color);
- void glColorP3ui(GLenum type, GLuint color);
- void glNormalP3uiv(GLenum type, const GLuint *coords);
- void glNormalP3ui(GLenum type, GLuint coords);
- void glMultiTexCoordP4uiv(GLenum texture, GLenum type, const GLuint *coords);
- void glMultiTexCoordP4ui(GLenum texture, GLenum type, GLuint coords);
- void glMultiTexCoordP3uiv(GLenum texture, GLenum type, const GLuint *coords);
- void glMultiTexCoordP3ui(GLenum texture, GLenum type, GLuint coords);
- void glMultiTexCoordP2uiv(GLenum texture, GLenum type, const GLuint *coords);
- void glMultiTexCoordP2ui(GLenum texture, GLenum type, GLuint coords);
- void glMultiTexCoordP1uiv(GLenum texture, GLenum type, const GLuint *coords);
- void glMultiTexCoordP1ui(GLenum texture, GLenum type, GLuint coords);
- void glTexCoordP4uiv(GLenum type, const GLuint *coords);
- void glTexCoordP4ui(GLenum type, GLuint coords);
- void glTexCoordP3uiv(GLenum type, const GLuint *coords);
- void glTexCoordP3ui(GLenum type, GLuint coords);
- void glTexCoordP2uiv(GLenum type, const GLuint *coords);
- void glTexCoordP2ui(GLenum type, GLuint coords);
- void glTexCoordP1uiv(GLenum type, const GLuint *coords);
- void glTexCoordP1ui(GLenum type, GLuint coords);
- void glVertexP4uiv(GLenum type, const GLuint *value);
- void glVertexP4ui(GLenum type, GLuint value);
- void glVertexP3uiv(GLenum type, const GLuint *value);
- void glVertexP3ui(GLenum type, GLuint value);
- void glVertexP2uiv(GLenum type, const GLuint *value);
- void glVertexP2ui(GLenum type, GLuint value);
- void glGetQueryObjectui64v(GLuint id, GLenum pname, GLuint64 *params);
- void glGetQueryObjecti64v(GLuint id, GLenum pname, GLint64 *params);
- void glQueryCounter(GLuint id, GLenum target);
- void glGetSamplerParameterIuiv(GLuint sampler, GLenum pname, GLuint *params);
- void glGetSamplerParameterfv(GLuint sampler, GLenum pname, GLfloat *params);
- void glGetSamplerParameterIiv(GLuint sampler, GLenum pname, GLint *params);
- void glGetSamplerParameteriv(GLuint sampler, GLenum pname, GLint *params);
- void glSamplerParameterIuiv(GLuint sampler, GLenum pname, const GLuint *param);
- void glSamplerParameterIiv(GLuint sampler, GLenum pname, const GLint *param);
- void glSamplerParameterfv(GLuint sampler, GLenum pname, const GLfloat *param);
- void glSamplerParameterf(GLuint sampler, GLenum pname, GLfloat param);
- void glSamplerParameteriv(GLuint sampler, GLenum pname, const GLint *param);
- void glSamplerParameteri(GLuint sampler, GLenum pname, GLint param);
- void glBindSampler(GLuint unit, GLuint sampler);
- GLboolean glIsSampler(GLuint sampler);
- void glDeleteSamplers(GLsizei count, const GLuint *samplers);
- void glGenSamplers(GLsizei count, GLuint *samplers);
- GLint glGetFragDataIndex(GLuint program, const GLchar *name);
- void glBindFragDataLocationIndexed(GLuint program, GLuint colorNumber, GLuint index, const GLchar *name);
- void glVertexAttribDivisor(GLuint index, GLuint divisor);
-
-private:
- friend class QOpenGLContext;
-
- static bool isContextCompatible(QOpenGLContext *context);
- static QOpenGLVersionProfile versionProfile();
-
- QOpenGLFunctions_1_0_CoreBackend* d_1_0_Core;
- QOpenGLFunctions_1_1_CoreBackend* d_1_1_Core;
- QOpenGLFunctions_1_2_CoreBackend* d_1_2_Core;
- QOpenGLFunctions_1_3_CoreBackend* d_1_3_Core;
- QOpenGLFunctions_1_4_CoreBackend* d_1_4_Core;
- QOpenGLFunctions_1_5_CoreBackend* d_1_5_Core;
- QOpenGLFunctions_2_0_CoreBackend* d_2_0_Core;
- QOpenGLFunctions_2_1_CoreBackend* d_2_1_Core;
- QOpenGLFunctions_3_0_CoreBackend* d_3_0_Core;
- QOpenGLFunctions_3_1_CoreBackend* d_3_1_Core;
- QOpenGLFunctions_3_2_CoreBackend* d_3_2_Core;
- QOpenGLFunctions_3_3_CoreBackend* d_3_3_Core;
-};
-
-// OpenGL 1.0 core functions
-inline void QOpenGLFunctions_3_3_Core::glViewport(GLint x, GLint y, GLsizei width, GLsizei height)
-{
- d_1_0_Core->f.Viewport(x, y, width, height);
-}
-
-inline void QOpenGLFunctions_3_3_Core::glDepthRange(GLdouble nearVal, GLdouble farVal)
-{
- d_1_0_Core->f.DepthRange(nearVal, farVal);
-}
-
-inline GLboolean QOpenGLFunctions_3_3_Core::glIsEnabled(GLenum cap)
-{
- return d_1_0_Core->f.IsEnabled(cap);
-}
-
-inline void QOpenGLFunctions_3_3_Core::glGetTexLevelParameteriv(GLenum target, GLint level, GLenum pname, GLint *params)
-{
- d_1_0_Core->f.GetTexLevelParameteriv(target, level, pname, params);
-}
-
-inline void QOpenGLFunctions_3_3_Core::glGetTexLevelParameterfv(GLenum target, GLint level, GLenum pname, GLfloat *params)
-{
- d_1_0_Core->f.GetTexLevelParameterfv(target, level, pname, params);
-}
-
-inline void QOpenGLFunctions_3_3_Core::glGetTexParameteriv(GLenum target, GLenum pname, GLint *params)
-{
- d_1_0_Core->f.GetTexParameteriv(target, pname, params);
-}
-
-inline void QOpenGLFunctions_3_3_Core::glGetTexParameterfv(GLenum target, GLenum pname, GLfloat *params)
-{
- d_1_0_Core->f.GetTexParameterfv(target, pname, params);
-}
-
-inline void QOpenGLFunctions_3_3_Core::glGetTexImage(GLenum target, GLint level, GLenum format, GLenum type, GLvoid *pixels)
-{
- d_1_0_Core->f.GetTexImage(target, level, format, type, pixels);
-}
-
-inline const GLubyte * QOpenGLFunctions_3_3_Core::glGetString(GLenum name)
-{
- return d_1_0_Core->f.GetString(name);
-}
-
-inline void QOpenGLFunctions_3_3_Core::glGetIntegerv(GLenum pname, GLint *params)
-{
- d_1_0_Core->f.GetIntegerv(pname, params);
-}
-
-inline void QOpenGLFunctions_3_3_Core::glGetFloatv(GLenum pname, GLfloat *params)
-{
- d_1_0_Core->f.GetFloatv(pname, params);
-}
-
-inline GLenum QOpenGLFunctions_3_3_Core::glGetError()
-{
- return d_1_0_Core->f.GetError();
-}
-
-inline void QOpenGLFunctions_3_3_Core::glGetDoublev(GLenum pname, GLdouble *params)
-{
- d_1_0_Core->f.GetDoublev(pname, params);
-}
-
-inline void QOpenGLFunctions_3_3_Core::glGetBooleanv(GLenum pname, GLboolean *params)
-{
- d_1_0_Core->f.GetBooleanv(pname, params);
-}
-
-inline void QOpenGLFunctions_3_3_Core::glReadPixels(GLint x, GLint y, GLsizei width, GLsizei height, GLenum format, GLenum type, GLvoid *pixels)
-{
- d_1_0_Core->f.ReadPixels(x, y, width, height, format, type, pixels);
-}
-
-inline void QOpenGLFunctions_3_3_Core::glReadBuffer(GLenum mode)
-{
- d_1_0_Core->f.ReadBuffer(mode);
-}
-
-inline void QOpenGLFunctions_3_3_Core::glPixelStorei(GLenum pname, GLint param)
-{
- d_1_0_Core->f.PixelStorei(pname, param);
-}
-
-inline void QOpenGLFunctions_3_3_Core::glPixelStoref(GLenum pname, GLfloat param)
-{
- d_1_0_Core->f.PixelStoref(pname, param);
-}
-
-inline void QOpenGLFunctions_3_3_Core::glDepthFunc(GLenum func)
-{
- d_1_0_Core->f.DepthFunc(func);
-}
-
-inline void QOpenGLFunctions_3_3_Core::glStencilOp(GLenum fail, GLenum zfail, GLenum zpass)
-{
- d_1_0_Core->f.StencilOp(fail, zfail, zpass);
-}
-
-inline void QOpenGLFunctions_3_3_Core::glStencilFunc(GLenum func, GLint ref, GLuint mask)
-{
- d_1_0_Core->f.StencilFunc(func, ref, mask);
-}
-
-inline void QOpenGLFunctions_3_3_Core::glLogicOp(GLenum opcode)
-{
- d_1_0_Core->f.LogicOp(opcode);
-}
-
-inline void QOpenGLFunctions_3_3_Core::glBlendFunc(GLenum sfactor, GLenum dfactor)
-{
- d_1_0_Core->f.BlendFunc(sfactor, dfactor);
-}
-
-inline void QOpenGLFunctions_3_3_Core::glFlush()
-{
- d_1_0_Core->f.Flush();
-}
-
-inline void QOpenGLFunctions_3_3_Core::glFinish()
-{
- d_1_0_Core->f.Finish();
-}
-
-inline void QOpenGLFunctions_3_3_Core::glEnable(GLenum cap)
-{
- d_1_0_Core->f.Enable(cap);
-}
-
-inline void QOpenGLFunctions_3_3_Core::glDisable(GLenum cap)
-{
- d_1_0_Core->f.Disable(cap);
-}
-
-inline void QOpenGLFunctions_3_3_Core::glDepthMask(GLboolean flag)
-{
- d_1_0_Core->f.DepthMask(flag);
-}
-
-inline void QOpenGLFunctions_3_3_Core::glColorMask(GLboolean red, GLboolean green, GLboolean blue, GLboolean alpha)
-{
- d_1_0_Core->f.ColorMask(red, green, blue, alpha);
-}
-
-inline void QOpenGLFunctions_3_3_Core::glStencilMask(GLuint mask)
-{
- d_1_0_Core->f.StencilMask(mask);
-}
-
-inline void QOpenGLFunctions_3_3_Core::glClearDepth(GLdouble depth)
-{
- d_1_0_Core->f.ClearDepth(depth);
-}
-
-inline void QOpenGLFunctions_3_3_Core::glClearStencil(GLint s)
-{
- d_1_0_Core->f.ClearStencil(s);
-}
-
-inline void QOpenGLFunctions_3_3_Core::glClearColor(GLfloat red, GLfloat green, GLfloat blue, GLfloat alpha)
-{
- d_1_0_Core->f.ClearColor(red, green, blue, alpha);
-}
-
-inline void QOpenGLFunctions_3_3_Core::glClear(GLbitfield mask)
-{
- d_1_0_Core->f.Clear(mask);
-}
-
-inline void QOpenGLFunctions_3_3_Core::glDrawBuffer(GLenum mode)
-{
- d_1_0_Core->f.DrawBuffer(mode);
-}
-
-inline void QOpenGLFunctions_3_3_Core::glTexImage2D(GLenum target, GLint level, GLint internalformat, GLsizei width, GLsizei height, GLint border, GLenum format, GLenum type, const GLvoid *pixels)
-{
- d_1_0_Core->f.TexImage2D(target, level, internalformat, width, height, border, format, type, pixels);
-}
-
-inline void QOpenGLFunctions_3_3_Core::glTexImage1D(GLenum target, GLint level, GLint internalformat, GLsizei width, GLint border, GLenum format, GLenum type, const GLvoid *pixels)
-{
- d_1_0_Core->f.TexImage1D(target, level, internalformat, width, border, format, type, pixels);
-}
-
-inline void QOpenGLFunctions_3_3_Core::glTexParameteriv(GLenum target, GLenum pname, const GLint *params)
-{
- d_1_0_Core->f.TexParameteriv(target, pname, params);
-}
-
-inline void QOpenGLFunctions_3_3_Core::glTexParameteri(GLenum target, GLenum pname, GLint param)
-{
- d_1_0_Core->f.TexParameteri(target, pname, param);
-}
-
-inline void QOpenGLFunctions_3_3_Core::glTexParameterfv(GLenum target, GLenum pname, const GLfloat *params)
-{
- d_1_0_Core->f.TexParameterfv(target, pname, params);
-}
-
-inline void QOpenGLFunctions_3_3_Core::glTexParameterf(GLenum target, GLenum pname, GLfloat param)
-{
- d_1_0_Core->f.TexParameterf(target, pname, param);
-}
-
-inline void QOpenGLFunctions_3_3_Core::glScissor(GLint x, GLint y, GLsizei width, GLsizei height)
-{
- d_1_0_Core->f.Scissor(x, y, width, height);
-}
-
-inline void QOpenGLFunctions_3_3_Core::glPolygonMode(GLenum face, GLenum mode)
-{
- d_1_0_Core->f.PolygonMode(face, mode);
-}
-
-inline void QOpenGLFunctions_3_3_Core::glPointSize(GLfloat size)
-{
- d_1_0_Core->f.PointSize(size);
-}
-
-inline void QOpenGLFunctions_3_3_Core::glLineWidth(GLfloat width)
-{
- d_1_0_Core->f.LineWidth(width);
-}
-
-inline void QOpenGLFunctions_3_3_Core::glHint(GLenum target, GLenum mode)
-{
- d_1_0_Core->f.Hint(target, mode);
-}
-
-inline void QOpenGLFunctions_3_3_Core::glFrontFace(GLenum mode)
-{
- d_1_0_Core->f.FrontFace(mode);
-}
-
-inline void QOpenGLFunctions_3_3_Core::glCullFace(GLenum mode)
-{
- d_1_0_Core->f.CullFace(mode);
-}
-
-
-// OpenGL 1.1 core functions
-inline void QOpenGLFunctions_3_3_Core::glIndexubv(const GLubyte *c)
-{
- Q_UNUSED(c);
- QOPENGL_DEPRECATEDFUNCTION;
-}
-
-inline void QOpenGLFunctions_3_3_Core::glIndexub(GLubyte c)
-{
- Q_UNUSED(c);
- QOPENGL_DEPRECATEDFUNCTION;
-}
-
-inline GLboolean QOpenGLFunctions_3_3_Core::glIsTexture(GLuint texture)
-{
- return d_1_1_Core->f.IsTexture(texture);
-}
-
-inline void QOpenGLFunctions_3_3_Core::glGenTextures(GLsizei n, GLuint *textures)
-{
- d_1_1_Core->f.GenTextures(n, textures);
-}
-
-inline void QOpenGLFunctions_3_3_Core::glDeleteTextures(GLsizei n, const GLuint *textures)
-{
- d_1_1_Core->f.DeleteTextures(n, textures);
-}
-
-inline void QOpenGLFunctions_3_3_Core::glBindTexture(GLenum target, GLuint texture)
-{
- d_1_1_Core->f.BindTexture(target, texture);
-}
-
-inline void QOpenGLFunctions_3_3_Core::glTexSubImage2D(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLenum type, const GLvoid *pixels)
-{
- d_1_1_Core->f.TexSubImage2D(target, level, xoffset, yoffset, width, height, format, type, pixels);
-}
-
-inline void QOpenGLFunctions_3_3_Core::glTexSubImage1D(GLenum target, GLint level, GLint xoffset, GLsizei width, GLenum format, GLenum type, const GLvoid *pixels)
-{
- d_1_1_Core->f.TexSubImage1D(target, level, xoffset, width, format, type, pixels);
-}
-
-inline void QOpenGLFunctions_3_3_Core::glCopyTexSubImage2D(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint x, GLint y, GLsizei width, GLsizei height)
-{
- d_1_1_Core->f.CopyTexSubImage2D(target, level, xoffset, yoffset, x, y, width, height);
-}
-
-inline void QOpenGLFunctions_3_3_Core::glCopyTexSubImage1D(GLenum target, GLint level, GLint xoffset, GLint x, GLint y, GLsizei width)
-{
- d_1_1_Core->f.CopyTexSubImage1D(target, level, xoffset, x, y, width);
-}
-
-inline void QOpenGLFunctions_3_3_Core::glCopyTexImage2D(GLenum target, GLint level, GLenum internalformat, GLint x, GLint y, GLsizei width, GLsizei height, GLint border)
-{
- d_1_1_Core->f.CopyTexImage2D(target, level, internalformat, x, y, width, height, border);
-}
-
-inline void QOpenGLFunctions_3_3_Core::glCopyTexImage1D(GLenum target, GLint level, GLenum internalformat, GLint x, GLint y, GLsizei width, GLint border)
-{
- d_1_1_Core->f.CopyTexImage1D(target, level, internalformat, x, y, width, border);
-}
-
-inline void QOpenGLFunctions_3_3_Core::glPolygonOffset(GLfloat factor, GLfloat units)
-{
- d_1_1_Core->f.PolygonOffset(factor, units);
-}
-
-inline void QOpenGLFunctions_3_3_Core::glGetPointerv(GLenum pname, GLvoid* *params)
-{
- Q_UNUSED(pname);
- Q_UNUSED(params);
- QOPENGL_DEPRECATEDFUNCTION;
-}
-
-inline void QOpenGLFunctions_3_3_Core::glDrawElements(GLenum mode, GLsizei count, GLenum type, const GLvoid *indices)
-{
- d_1_1_Core->f.DrawElements(mode, count, type, indices);
-}
-
-inline void QOpenGLFunctions_3_3_Core::glDrawArrays(GLenum mode, GLint first, GLsizei count)
-{
- d_1_1_Core->f.DrawArrays(mode, first, count);
-}
-
-
-// OpenGL 1.2 core functions
-inline void QOpenGLFunctions_3_3_Core::glCopyTexSubImage3D(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLint x, GLint y, GLsizei width, GLsizei height)
-{
- d_1_2_Core->f.CopyTexSubImage3D(target, level, xoffset, yoffset, zoffset, x, y, width, height);
-}
-
-inline void QOpenGLFunctions_3_3_Core::glTexSubImage3D(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLenum type, const GLvoid *pixels)
-{
- d_1_2_Core->f.TexSubImage3D(target, level, xoffset, yoffset, zoffset, width, height, depth, format, type, pixels);
-}
-
-inline void QOpenGLFunctions_3_3_Core::glTexImage3D(GLenum target, GLint level, GLint internalformat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLenum format, GLenum type, const GLvoid *pixels)
-{
- d_1_2_Core->f.TexImage3D(target, level, internalformat, width, height, depth, border, format, type, pixels);
-}
-
-inline void QOpenGLFunctions_3_3_Core::glDrawRangeElements(GLenum mode, GLuint start, GLuint end, GLsizei count, GLenum type, const GLvoid *indices)
-{
- d_1_2_Core->f.DrawRangeElements(mode, start, end, count, type, indices);
-}
-
-inline void QOpenGLFunctions_3_3_Core::glBlendEquation(GLenum mode)
-{
- d_1_2_Core->f.BlendEquation(mode);
-}
-
-inline void QOpenGLFunctions_3_3_Core::glBlendColor(GLfloat red, GLfloat green, GLfloat blue, GLfloat alpha)
-{
- d_1_2_Core->f.BlendColor(red, green, blue, alpha);
-}
-
-
-// OpenGL 1.3 core functions
-inline void QOpenGLFunctions_3_3_Core::glGetCompressedTexImage(GLenum target, GLint level, GLvoid *img)
-{
- d_1_3_Core->f.GetCompressedTexImage(target, level, img);
-}
-
-inline void QOpenGLFunctions_3_3_Core::glCompressedTexSubImage1D(GLenum target, GLint level, GLint xoffset, GLsizei width, GLenum format, GLsizei imageSize, const GLvoid *data)
-{
- d_1_3_Core->f.CompressedTexSubImage1D(target, level, xoffset, width, format, imageSize, data);
-}
-
-inline void QOpenGLFunctions_3_3_Core::glCompressedTexSubImage2D(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLsizei imageSize, const GLvoid *data)
-{
- d_1_3_Core->f.CompressedTexSubImage2D(target, level, xoffset, yoffset, width, height, format, imageSize, data);
-}
-
-inline void QOpenGLFunctions_3_3_Core::glCompressedTexSubImage3D(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLsizei imageSize, const GLvoid *data)
-{
- d_1_3_Core->f.CompressedTexSubImage3D(target, level, xoffset, yoffset, zoffset, width, height, depth, format, imageSize, data);
-}
-
-inline void QOpenGLFunctions_3_3_Core::glCompressedTexImage1D(GLenum target, GLint level, GLenum internalformat, GLsizei width, GLint border, GLsizei imageSize, const GLvoid *data)
-{
- d_1_3_Core->f.CompressedTexImage1D(target, level, internalformat, width, border, imageSize, data);
-}
-
-inline void QOpenGLFunctions_3_3_Core::glCompressedTexImage2D(GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLint border, GLsizei imageSize, const GLvoid *data)
-{
- d_1_3_Core->f.CompressedTexImage2D(target, level, internalformat, width, height, border, imageSize, data);
-}
-
-inline void QOpenGLFunctions_3_3_Core::glCompressedTexImage3D(GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLsizei imageSize, const GLvoid *data)
-{
- d_1_3_Core->f.CompressedTexImage3D(target, level, internalformat, width, height, depth, border, imageSize, data);
-}
-
-inline void QOpenGLFunctions_3_3_Core::glSampleCoverage(GLfloat value, GLboolean invert)
-{
- d_1_3_Core->f.SampleCoverage(value, invert);
-}
-
-inline void QOpenGLFunctions_3_3_Core::glActiveTexture(GLenum texture)
-{
- d_1_3_Core->f.ActiveTexture(texture);
-}
-
-
-// OpenGL 1.4 core functions
-inline void QOpenGLFunctions_3_3_Core::glPointParameteriv(GLenum pname, const GLint *params)
-{
- d_1_4_Core->f.PointParameteriv(pname, params);
-}
-
-inline void QOpenGLFunctions_3_3_Core::glPointParameteri(GLenum pname, GLint param)
-{
- d_1_4_Core->f.PointParameteri(pname, param);
-}
-
-inline void QOpenGLFunctions_3_3_Core::glPointParameterfv(GLenum pname, const GLfloat *params)
-{
- d_1_4_Core->f.PointParameterfv(pname, params);
-}
-
-inline void QOpenGLFunctions_3_3_Core::glPointParameterf(GLenum pname, GLfloat param)
-{
- d_1_4_Core->f.PointParameterf(pname, param);
-}
-
-inline void QOpenGLFunctions_3_3_Core::glMultiDrawElements(GLenum mode, const GLsizei *count, GLenum type, const GLvoid* const *indices, GLsizei drawcount)
-{
- d_1_4_Core->f.MultiDrawElements(mode, count, type, indices, drawcount);
-}
-
-inline void QOpenGLFunctions_3_3_Core::glMultiDrawArrays(GLenum mode, const GLint *first, const GLsizei *count, GLsizei drawcount)
-{
- d_1_4_Core->f.MultiDrawArrays(mode, first, count, drawcount);
-}
-
-inline void QOpenGLFunctions_3_3_Core::glBlendFuncSeparate(GLenum sfactorRGB, GLenum dfactorRGB, GLenum sfactorAlpha, GLenum dfactorAlpha)
-{
- d_1_4_Core->f.BlendFuncSeparate(sfactorRGB, dfactorRGB, sfactorAlpha, dfactorAlpha);
-}
-
-
-// OpenGL 1.5 core functions
-inline void QOpenGLFunctions_3_3_Core::glGetBufferPointerv(GLenum target, GLenum pname, GLvoid* *params)
-{
- d_1_5_Core->f.GetBufferPointerv(target, pname, params);
-}
-
-inline void QOpenGLFunctions_3_3_Core::glGetBufferParameteriv(GLenum target, GLenum pname, GLint *params)
-{
- d_1_5_Core->f.GetBufferParameteriv(target, pname, params);
-}
-
-inline GLboolean QOpenGLFunctions_3_3_Core::glUnmapBuffer(GLenum target)
-{
- return d_1_5_Core->f.UnmapBuffer(target);
-}
-
-inline GLvoid* QOpenGLFunctions_3_3_Core::glMapBuffer(GLenum target, GLenum access)
-{
- return d_1_5_Core->f.MapBuffer(target, access);
-}
-
-inline void QOpenGLFunctions_3_3_Core::glGetBufferSubData(GLenum target, GLintptr offset, GLsizeiptr size, GLvoid *data)
-{
- d_1_5_Core->f.GetBufferSubData(target, offset, size, data);
-}
-
-inline void QOpenGLFunctions_3_3_Core::glBufferSubData(GLenum target, GLintptr offset, GLsizeiptr size, const GLvoid *data)
-{
- d_1_5_Core->f.BufferSubData(target, offset, size, data);
-}
-
-inline void QOpenGLFunctions_3_3_Core::glBufferData(GLenum target, GLsizeiptr size, const GLvoid *data, GLenum usage)
-{
- d_1_5_Core->f.BufferData(target, size, data, usage);
-}
-
-inline GLboolean QOpenGLFunctions_3_3_Core::glIsBuffer(GLuint buffer)
-{
- return d_1_5_Core->f.IsBuffer(buffer);
-}
-
-inline void QOpenGLFunctions_3_3_Core::glGenBuffers(GLsizei n, GLuint *buffers)
-{
- d_1_5_Core->f.GenBuffers(n, buffers);
-}
-
-inline void QOpenGLFunctions_3_3_Core::glDeleteBuffers(GLsizei n, const GLuint *buffers)
-{
- d_1_5_Core->f.DeleteBuffers(n, buffers);
-}
-
-inline void QOpenGLFunctions_3_3_Core::glBindBuffer(GLenum target, GLuint buffer)
-{
- d_1_5_Core->f.BindBuffer(target, buffer);
-}
-
-inline void QOpenGLFunctions_3_3_Core::glGetQueryObjectuiv(GLuint id, GLenum pname, GLuint *params)
-{
- d_1_5_Core->f.GetQueryObjectuiv(id, pname, params);
-}
-
-inline void QOpenGLFunctions_3_3_Core::glGetQueryObjectiv(GLuint id, GLenum pname, GLint *params)
-{
- d_1_5_Core->f.GetQueryObjectiv(id, pname, params);
-}
-
-inline void QOpenGLFunctions_3_3_Core::glGetQueryiv(GLenum target, GLenum pname, GLint *params)
-{
- d_1_5_Core->f.GetQueryiv(target, pname, params);
-}
-
-inline void QOpenGLFunctions_3_3_Core::glEndQuery(GLenum target)
-{
- d_1_5_Core->f.EndQuery(target);
-}
-
-inline void QOpenGLFunctions_3_3_Core::glBeginQuery(GLenum target, GLuint id)
-{
- d_1_5_Core->f.BeginQuery(target, id);
-}
-
-inline GLboolean QOpenGLFunctions_3_3_Core::glIsQuery(GLuint id)
-{
- return d_1_5_Core->f.IsQuery(id);
-}
-
-inline void QOpenGLFunctions_3_3_Core::glDeleteQueries(GLsizei n, const GLuint *ids)
-{
- d_1_5_Core->f.DeleteQueries(n, ids);
-}
-
-inline void QOpenGLFunctions_3_3_Core::glGenQueries(GLsizei n, GLuint *ids)
-{
- d_1_5_Core->f.GenQueries(n, ids);
-}
-
-
-// OpenGL 2.0 core functions
-inline void QOpenGLFunctions_3_3_Core::glVertexAttribPointer(GLuint index, GLint size, GLenum type, GLboolean normalized, GLsizei stride, const GLvoid *pointer)
-{
- d_2_0_Core->f.VertexAttribPointer(index, size, type, normalized, stride, pointer);
-}
-
-inline void QOpenGLFunctions_3_3_Core::glValidateProgram(GLuint program)
-{
- d_2_0_Core->f.ValidateProgram(program);
-}
-
-inline void QOpenGLFunctions_3_3_Core::glUniformMatrix4fv(GLint location, GLsizei count, GLboolean transpose, const GLfloat *value)
-{
- d_2_0_Core->f.UniformMatrix4fv(location, count, transpose, value);
-}
-
-inline void QOpenGLFunctions_3_3_Core::glUniformMatrix3fv(GLint location, GLsizei count, GLboolean transpose, const GLfloat *value)
-{
- d_2_0_Core->f.UniformMatrix3fv(location, count, transpose, value);
-}
-
-inline void QOpenGLFunctions_3_3_Core::glUniformMatrix2fv(GLint location, GLsizei count, GLboolean transpose, const GLfloat *value)
-{
- d_2_0_Core->f.UniformMatrix2fv(location, count, transpose, value);
-}
-
-inline void QOpenGLFunctions_3_3_Core::glUniform4iv(GLint location, GLsizei count, const GLint *value)
-{
- d_2_0_Core->f.Uniform4iv(location, count, value);
-}
-
-inline void QOpenGLFunctions_3_3_Core::glUniform3iv(GLint location, GLsizei count, const GLint *value)
-{
- d_2_0_Core->f.Uniform3iv(location, count, value);
-}
-
-inline void QOpenGLFunctions_3_3_Core::glUniform2iv(GLint location, GLsizei count, const GLint *value)
-{
- d_2_0_Core->f.Uniform2iv(location, count, value);
-}
-
-inline void QOpenGLFunctions_3_3_Core::glUniform1iv(GLint location, GLsizei count, const GLint *value)
-{
- d_2_0_Core->f.Uniform1iv(location, count, value);
-}
-
-inline void QOpenGLFunctions_3_3_Core::glUniform4fv(GLint location, GLsizei count, const GLfloat *value)
-{
- d_2_0_Core->f.Uniform4fv(location, count, value);
-}
-
-inline void QOpenGLFunctions_3_3_Core::glUniform3fv(GLint location, GLsizei count, const GLfloat *value)
-{
- d_2_0_Core->f.Uniform3fv(location, count, value);
-}
-
-inline void QOpenGLFunctions_3_3_Core::glUniform2fv(GLint location, GLsizei count, const GLfloat *value)
-{
- d_2_0_Core->f.Uniform2fv(location, count, value);
-}
-
-inline void QOpenGLFunctions_3_3_Core::glUniform1fv(GLint location, GLsizei count, const GLfloat *value)
-{
- d_2_0_Core->f.Uniform1fv(location, count, value);
-}
-
-inline void QOpenGLFunctions_3_3_Core::glUniform4i(GLint location, GLint v0, GLint v1, GLint v2, GLint v3)
-{
- d_2_0_Core->f.Uniform4i(location, v0, v1, v2, v3);
-}
-
-inline void QOpenGLFunctions_3_3_Core::glUniform3i(GLint location, GLint v0, GLint v1, GLint v2)
-{
- d_2_0_Core->f.Uniform3i(location, v0, v1, v2);
-}
-
-inline void QOpenGLFunctions_3_3_Core::glUniform2i(GLint location, GLint v0, GLint v1)
-{
- d_2_0_Core->f.Uniform2i(location, v0, v1);
-}
-
-inline void QOpenGLFunctions_3_3_Core::glUniform1i(GLint location, GLint v0)
-{
- d_2_0_Core->f.Uniform1i(location, v0);
-}
-
-inline void QOpenGLFunctions_3_3_Core::glUniform4f(GLint location, GLfloat v0, GLfloat v1, GLfloat v2, GLfloat v3)
-{
- d_2_0_Core->f.Uniform4f(location, v0, v1, v2, v3);
-}
-
-inline void QOpenGLFunctions_3_3_Core::glUniform3f(GLint location, GLfloat v0, GLfloat v1, GLfloat v2)
-{
- d_2_0_Core->f.Uniform3f(location, v0, v1, v2);
-}
-
-inline void QOpenGLFunctions_3_3_Core::glUniform2f(GLint location, GLfloat v0, GLfloat v1)
-{
- d_2_0_Core->f.Uniform2f(location, v0, v1);
-}
-
-inline void QOpenGLFunctions_3_3_Core::glUniform1f(GLint location, GLfloat v0)
-{
- d_2_0_Core->f.Uniform1f(location, v0);
-}
-
-inline void QOpenGLFunctions_3_3_Core::glUseProgram(GLuint program)
-{
- d_2_0_Core->f.UseProgram(program);
-}
-
-inline void QOpenGLFunctions_3_3_Core::glShaderSource(GLuint shader, GLsizei count, const GLchar* const *string, const GLint *length)
-{
- d_2_0_Core->f.ShaderSource(shader, count, string, length);
-}
-
-inline void QOpenGLFunctions_3_3_Core::glLinkProgram(GLuint program)
-{
- d_2_0_Core->f.LinkProgram(program);
-}
-
-inline GLboolean QOpenGLFunctions_3_3_Core::glIsShader(GLuint shader)
-{
- return d_2_0_Core->f.IsShader(shader);
-}
-
-inline GLboolean QOpenGLFunctions_3_3_Core::glIsProgram(GLuint program)
-{
- return d_2_0_Core->f.IsProgram(program);
-}
-
-inline void QOpenGLFunctions_3_3_Core::glGetVertexAttribPointerv(GLuint index, GLenum pname, GLvoid* *pointer)
-{
- d_2_0_Core->f.GetVertexAttribPointerv(index, pname, pointer);
-}
-
-inline void QOpenGLFunctions_3_3_Core::glGetVertexAttribiv(GLuint index, GLenum pname, GLint *params)
-{
- d_2_0_Core->f.GetVertexAttribiv(index, pname, params);
-}
-
-inline void QOpenGLFunctions_3_3_Core::glGetVertexAttribfv(GLuint index, GLenum pname, GLfloat *params)
-{
- d_2_0_Core->f.GetVertexAttribfv(index, pname, params);
-}
-
-inline void QOpenGLFunctions_3_3_Core::glGetVertexAttribdv(GLuint index, GLenum pname, GLdouble *params)
-{
- d_2_0_Core->f.GetVertexAttribdv(index, pname, params);
-}
-
-inline void QOpenGLFunctions_3_3_Core::glGetUniformiv(GLuint program, GLint location, GLint *params)
-{
- d_2_0_Core->f.GetUniformiv(program, location, params);
-}
-
-inline void QOpenGLFunctions_3_3_Core::glGetUniformfv(GLuint program, GLint location, GLfloat *params)
-{
- d_2_0_Core->f.GetUniformfv(program, location, params);
-}
-
-inline GLint QOpenGLFunctions_3_3_Core::glGetUniformLocation(GLuint program, const GLchar *name)
-{
- return d_2_0_Core->f.GetUniformLocation(program, name);
-}
-
-inline void QOpenGLFunctions_3_3_Core::glGetShaderSource(GLuint shader, GLsizei bufSize, GLsizei *length, GLchar *source)
-{
- d_2_0_Core->f.GetShaderSource(shader, bufSize, length, source);
-}
-
-inline void QOpenGLFunctions_3_3_Core::glGetShaderInfoLog(GLuint shader, GLsizei bufSize, GLsizei *length, GLchar *infoLog)
-{
- d_2_0_Core->f.GetShaderInfoLog(shader, bufSize, length, infoLog);
-}
-
-inline void QOpenGLFunctions_3_3_Core::glGetShaderiv(GLuint shader, GLenum pname, GLint *params)
-{
- d_2_0_Core->f.GetShaderiv(shader, pname, params);
-}
-
-inline void QOpenGLFunctions_3_3_Core::glGetProgramInfoLog(GLuint program, GLsizei bufSize, GLsizei *length, GLchar *infoLog)
-{
- d_2_0_Core->f.GetProgramInfoLog(program, bufSize, length, infoLog);
-}
-
-inline void QOpenGLFunctions_3_3_Core::glGetProgramiv(GLuint program, GLenum pname, GLint *params)
-{
- d_2_0_Core->f.GetProgramiv(program, pname, params);
-}
-
-inline GLint QOpenGLFunctions_3_3_Core::glGetAttribLocation(GLuint program, const GLchar *name)
-{
- return d_2_0_Core->f.GetAttribLocation(program, name);
-}
-
-inline void QOpenGLFunctions_3_3_Core::glGetAttachedShaders(GLuint program, GLsizei maxCount, GLsizei *count, GLuint *obj)
-{
- d_2_0_Core->f.GetAttachedShaders(program, maxCount, count, obj);
-}
-
-inline void QOpenGLFunctions_3_3_Core::glGetActiveUniform(GLuint program, GLuint index, GLsizei bufSize, GLsizei *length, GLint *size, GLenum *type, GLchar *name)
-{
- d_2_0_Core->f.GetActiveUniform(program, index, bufSize, length, size, type, name);
-}
-
-inline void QOpenGLFunctions_3_3_Core::glGetActiveAttrib(GLuint program, GLuint index, GLsizei bufSize, GLsizei *length, GLint *size, GLenum *type, GLchar *name)
-{
- d_2_0_Core->f.GetActiveAttrib(program, index, bufSize, length, size, type, name);
-}
-
-inline void QOpenGLFunctions_3_3_Core::glEnableVertexAttribArray(GLuint index)
-{
- d_2_0_Core->f.EnableVertexAttribArray(index);
-}
-
-inline void QOpenGLFunctions_3_3_Core::glDisableVertexAttribArray(GLuint index)
-{
- d_2_0_Core->f.DisableVertexAttribArray(index);
-}
-
-inline void QOpenGLFunctions_3_3_Core::glDetachShader(GLuint program, GLuint shader)
-{
- d_2_0_Core->f.DetachShader(program, shader);
-}
-
-inline void QOpenGLFunctions_3_3_Core::glDeleteShader(GLuint shader)
-{
- d_2_0_Core->f.DeleteShader(shader);
-}
-
-inline void QOpenGLFunctions_3_3_Core::glDeleteProgram(GLuint program)
-{
- d_2_0_Core->f.DeleteProgram(program);
-}
-
-inline GLuint QOpenGLFunctions_3_3_Core::glCreateShader(GLenum type)
-{
- return d_2_0_Core->f.CreateShader(type);
-}
-
-inline GLuint QOpenGLFunctions_3_3_Core::glCreateProgram()
-{
- return d_2_0_Core->f.CreateProgram();
-}
-
-inline void QOpenGLFunctions_3_3_Core::glCompileShader(GLuint shader)
-{
- d_2_0_Core->f.CompileShader(shader);
-}
-
-inline void QOpenGLFunctions_3_3_Core::glBindAttribLocation(GLuint program, GLuint index, const GLchar *name)
-{
- d_2_0_Core->f.BindAttribLocation(program, index, name);
-}
-
-inline void QOpenGLFunctions_3_3_Core::glAttachShader(GLuint program, GLuint shader)
-{
- d_2_0_Core->f.AttachShader(program, shader);
-}
-
-inline void QOpenGLFunctions_3_3_Core::glStencilMaskSeparate(GLenum face, GLuint mask)
-{
- d_2_0_Core->f.StencilMaskSeparate(face, mask);
-}
-
-inline void QOpenGLFunctions_3_3_Core::glStencilFuncSeparate(GLenum face, GLenum func, GLint ref, GLuint mask)
-{
- d_2_0_Core->f.StencilFuncSeparate(face, func, ref, mask);
-}
-
-inline void QOpenGLFunctions_3_3_Core::glStencilOpSeparate(GLenum face, GLenum sfail, GLenum dpfail, GLenum dppass)
-{
- d_2_0_Core->f.StencilOpSeparate(face, sfail, dpfail, dppass);
-}
-
-inline void QOpenGLFunctions_3_3_Core::glDrawBuffers(GLsizei n, const GLenum *bufs)
-{
- d_2_0_Core->f.DrawBuffers(n, bufs);
-}
-
-inline void QOpenGLFunctions_3_3_Core::glBlendEquationSeparate(GLenum modeRGB, GLenum modeAlpha)
-{
- d_2_0_Core->f.BlendEquationSeparate(modeRGB, modeAlpha);
-}
-
-
-// OpenGL 2.1 core functions
-inline void QOpenGLFunctions_3_3_Core::glUniformMatrix4x3fv(GLint location, GLsizei count, GLboolean transpose, const GLfloat *value)
-{
- d_2_1_Core->f.UniformMatrix4x3fv(location, count, transpose, value);
-}
-
-inline void QOpenGLFunctions_3_3_Core::glUniformMatrix3x4fv(GLint location, GLsizei count, GLboolean transpose, const GLfloat *value)
-{
- d_2_1_Core->f.UniformMatrix3x4fv(location, count, transpose, value);
-}
-
-inline void QOpenGLFunctions_3_3_Core::glUniformMatrix4x2fv(GLint location, GLsizei count, GLboolean transpose, const GLfloat *value)
-{
- d_2_1_Core->f.UniformMatrix4x2fv(location, count, transpose, value);
-}
-
-inline void QOpenGLFunctions_3_3_Core::glUniformMatrix2x4fv(GLint location, GLsizei count, GLboolean transpose, const GLfloat *value)
-{
- d_2_1_Core->f.UniformMatrix2x4fv(location, count, transpose, value);
-}
-
-inline void QOpenGLFunctions_3_3_Core::glUniformMatrix3x2fv(GLint location, GLsizei count, GLboolean transpose, const GLfloat *value)
-{
- d_2_1_Core->f.UniformMatrix3x2fv(location, count, transpose, value);
-}
-
-inline void QOpenGLFunctions_3_3_Core::glUniformMatrix2x3fv(GLint location, GLsizei count, GLboolean transpose, const GLfloat *value)
-{
- d_2_1_Core->f.UniformMatrix2x3fv(location, count, transpose, value);
-}
-
-
-// OpenGL 3.0 core functions
-inline GLboolean QOpenGLFunctions_3_3_Core::glIsVertexArray(GLuint array)
-{
- return d_3_0_Core->f.IsVertexArray(array);
-}
-
-inline void QOpenGLFunctions_3_3_Core::glGenVertexArrays(GLsizei n, GLuint *arrays)
-{
- d_3_0_Core->f.GenVertexArrays(n, arrays);
-}
-
-inline void QOpenGLFunctions_3_3_Core::glDeleteVertexArrays(GLsizei n, const GLuint *arrays)
-{
- d_3_0_Core->f.DeleteVertexArrays(n, arrays);
-}
-
-inline void QOpenGLFunctions_3_3_Core::glBindVertexArray(GLuint array)
-{
- d_3_0_Core->f.BindVertexArray(array);
-}
-
-inline void QOpenGLFunctions_3_3_Core::glFlushMappedBufferRange(GLenum target, GLintptr offset, GLsizeiptr length)
-{
- d_3_0_Core->f.FlushMappedBufferRange(target, offset, length);
-}
-
-inline GLvoid* QOpenGLFunctions_3_3_Core::glMapBufferRange(GLenum target, GLintptr offset, GLsizeiptr length, GLbitfield access)
-{
- return d_3_0_Core->f.MapBufferRange(target, offset, length, access);
-}
-
-inline void QOpenGLFunctions_3_3_Core::glFramebufferTextureLayer(GLenum target, GLenum attachment, GLuint texture, GLint level, GLint layer)
-{
- d_3_0_Core->f.FramebufferTextureLayer(target, attachment, texture, level, layer);
-}
-
-inline void QOpenGLFunctions_3_3_Core::glRenderbufferStorageMultisample(GLenum target, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height)
-{
- d_3_0_Core->f.RenderbufferStorageMultisample(target, samples, internalformat, width, height);
-}
-
-inline void QOpenGLFunctions_3_3_Core::glBlitFramebuffer(GLint srcX0, GLint srcY0, GLint srcX1, GLint srcY1, GLint dstX0, GLint dstY0, GLint dstX1, GLint dstY1, GLbitfield mask, GLenum filter)
-{
- d_3_0_Core->f.BlitFramebuffer(srcX0, srcY0, srcX1, srcY1, dstX0, dstY0, dstX1, dstY1, mask, filter);
-}
-
-inline void QOpenGLFunctions_3_3_Core::glGenerateMipmap(GLenum target)
-{
- d_3_0_Core->f.GenerateMipmap(target);
-}
-
-inline void QOpenGLFunctions_3_3_Core::glGetFramebufferAttachmentParameteriv(GLenum target, GLenum attachment, GLenum pname, GLint *params)
-{
- d_3_0_Core->f.GetFramebufferAttachmentParameteriv(target, attachment, pname, params);
-}
-
-inline void QOpenGLFunctions_3_3_Core::glFramebufferRenderbuffer(GLenum target, GLenum attachment, GLenum renderbuffertarget, GLuint renderbuffer)
-{
- d_3_0_Core->f.FramebufferRenderbuffer(target, attachment, renderbuffertarget, renderbuffer);
-}
-
-inline void QOpenGLFunctions_3_3_Core::glFramebufferTexture3D(GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level, GLint zoffset)
-{
- d_3_0_Core->f.FramebufferTexture3D(target, attachment, textarget, texture, level, zoffset);
-}
-
-inline void QOpenGLFunctions_3_3_Core::glFramebufferTexture2D(GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level)
-{
- d_3_0_Core->f.FramebufferTexture2D(target, attachment, textarget, texture, level);
-}
-
-inline void QOpenGLFunctions_3_3_Core::glFramebufferTexture1D(GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level)
-{
- d_3_0_Core->f.FramebufferTexture1D(target, attachment, textarget, texture, level);
-}
-
-inline GLenum QOpenGLFunctions_3_3_Core::glCheckFramebufferStatus(GLenum target)
-{
- return d_3_0_Core->f.CheckFramebufferStatus(target);
-}
-
-inline void QOpenGLFunctions_3_3_Core::glGenFramebuffers(GLsizei n, GLuint *framebuffers)
-{
- d_3_0_Core->f.GenFramebuffers(n, framebuffers);
-}
-
-inline void QOpenGLFunctions_3_3_Core::glDeleteFramebuffers(GLsizei n, const GLuint *framebuffers)
-{
- d_3_0_Core->f.DeleteFramebuffers(n, framebuffers);
-}
-
-inline void QOpenGLFunctions_3_3_Core::glBindFramebuffer(GLenum target, GLuint framebuffer)
-{
- d_3_0_Core->f.BindFramebuffer(target, framebuffer);
-}
-
-inline GLboolean QOpenGLFunctions_3_3_Core::glIsFramebuffer(GLuint framebuffer)
-{
- return d_3_0_Core->f.IsFramebuffer(framebuffer);
-}
-
-inline void QOpenGLFunctions_3_3_Core::glGetRenderbufferParameteriv(GLenum target, GLenum pname, GLint *params)
-{
- d_3_0_Core->f.GetRenderbufferParameteriv(target, pname, params);
-}
-
-inline void QOpenGLFunctions_3_3_Core::glRenderbufferStorage(GLenum target, GLenum internalformat, GLsizei width, GLsizei height)
-{
- d_3_0_Core->f.RenderbufferStorage(target, internalformat, width, height);
-}
-
-inline void QOpenGLFunctions_3_3_Core::glGenRenderbuffers(GLsizei n, GLuint *renderbuffers)
-{
- d_3_0_Core->f.GenRenderbuffers(n, renderbuffers);
-}
-
-inline void QOpenGLFunctions_3_3_Core::glDeleteRenderbuffers(GLsizei n, const GLuint *renderbuffers)
-{
- d_3_0_Core->f.DeleteRenderbuffers(n, renderbuffers);
-}
-
-inline void QOpenGLFunctions_3_3_Core::glBindRenderbuffer(GLenum target, GLuint renderbuffer)
-{
- d_3_0_Core->f.BindRenderbuffer(target, renderbuffer);
-}
-
-inline GLboolean QOpenGLFunctions_3_3_Core::glIsRenderbuffer(GLuint renderbuffer)
-{
- return d_3_0_Core->f.IsRenderbuffer(renderbuffer);
-}
-
-inline const GLubyte * QOpenGLFunctions_3_3_Core::glGetStringi(GLenum name, GLuint index)
-{
- return d_3_0_Core->f.GetStringi(name, index);
-}
-
-inline void QOpenGLFunctions_3_3_Core::glClearBufferfi(GLenum buffer, GLint drawbuffer, GLfloat depth, GLint stencil)
-{
- d_3_0_Core->f.ClearBufferfi(buffer, drawbuffer, depth, stencil);
-}
-
-inline void QOpenGLFunctions_3_3_Core::glClearBufferfv(GLenum buffer, GLint drawbuffer, const GLfloat *value)
-{
- d_3_0_Core->f.ClearBufferfv(buffer, drawbuffer, value);
-}
-
-inline void QOpenGLFunctions_3_3_Core::glClearBufferuiv(GLenum buffer, GLint drawbuffer, const GLuint *value)
-{
- d_3_0_Core->f.ClearBufferuiv(buffer, drawbuffer, value);
-}
-
-inline void QOpenGLFunctions_3_3_Core::glClearBufferiv(GLenum buffer, GLint drawbuffer, const GLint *value)
-{
- d_3_0_Core->f.ClearBufferiv(buffer, drawbuffer, value);
-}
-
-inline void QOpenGLFunctions_3_3_Core::glGetTexParameterIuiv(GLenum target, GLenum pname, GLuint *params)
-{
- d_3_0_Core->f.GetTexParameterIuiv(target, pname, params);
-}
-
-inline void QOpenGLFunctions_3_3_Core::glGetTexParameterIiv(GLenum target, GLenum pname, GLint *params)
-{
- d_3_0_Core->f.GetTexParameterIiv(target, pname, params);
-}
-
-inline void QOpenGLFunctions_3_3_Core::glTexParameterIuiv(GLenum target, GLenum pname, const GLuint *params)
-{
- d_3_0_Core->f.TexParameterIuiv(target, pname, params);
-}
-
-inline void QOpenGLFunctions_3_3_Core::glTexParameterIiv(GLenum target, GLenum pname, const GLint *params)
-{
- d_3_0_Core->f.TexParameterIiv(target, pname, params);
-}
-
-inline void QOpenGLFunctions_3_3_Core::glUniform4uiv(GLint location, GLsizei count, const GLuint *value)
-{
- d_3_0_Core->f.Uniform4uiv(location, count, value);
-}
-
-inline void QOpenGLFunctions_3_3_Core::glUniform3uiv(GLint location, GLsizei count, const GLuint *value)
-{
- d_3_0_Core->f.Uniform3uiv(location, count, value);
-}
-
-inline void QOpenGLFunctions_3_3_Core::glUniform2uiv(GLint location, GLsizei count, const GLuint *value)
-{
- d_3_0_Core->f.Uniform2uiv(location, count, value);
-}
-
-inline void QOpenGLFunctions_3_3_Core::glUniform1uiv(GLint location, GLsizei count, const GLuint *value)
-{
- d_3_0_Core->f.Uniform1uiv(location, count, value);
-}
-
-inline void QOpenGLFunctions_3_3_Core::glUniform4ui(GLint location, GLuint v0, GLuint v1, GLuint v2, GLuint v3)
-{
- d_3_0_Core->f.Uniform4ui(location, v0, v1, v2, v3);
-}
-
-inline void QOpenGLFunctions_3_3_Core::glUniform3ui(GLint location, GLuint v0, GLuint v1, GLuint v2)
-{
- d_3_0_Core->f.Uniform3ui(location, v0, v1, v2);
-}
-
-inline void QOpenGLFunctions_3_3_Core::glUniform2ui(GLint location, GLuint v0, GLuint v1)
-{
- d_3_0_Core->f.Uniform2ui(location, v0, v1);
-}
-
-inline void QOpenGLFunctions_3_3_Core::glUniform1ui(GLint location, GLuint v0)
-{
- d_3_0_Core->f.Uniform1ui(location, v0);
-}
-
-inline GLint QOpenGLFunctions_3_3_Core::glGetFragDataLocation(GLuint program, const GLchar *name)
-{
- return d_3_0_Core->f.GetFragDataLocation(program, name);
-}
-
-inline void QOpenGLFunctions_3_3_Core::glBindFragDataLocation(GLuint program, GLuint color, const GLchar *name)
-{
- d_3_0_Core->f.BindFragDataLocation(program, color, name);
-}
-
-inline void QOpenGLFunctions_3_3_Core::glGetUniformuiv(GLuint program, GLint location, GLuint *params)
-{
- d_3_0_Core->f.GetUniformuiv(program, location, params);
-}
-
-inline void QOpenGLFunctions_3_3_Core::glGetVertexAttribIuiv(GLuint index, GLenum pname, GLuint *params)
-{
- d_3_0_Core->f.GetVertexAttribIuiv(index, pname, params);
-}
-
-inline void QOpenGLFunctions_3_3_Core::glGetVertexAttribIiv(GLuint index, GLenum pname, GLint *params)
-{
- d_3_0_Core->f.GetVertexAttribIiv(index, pname, params);
-}
-
-inline void QOpenGLFunctions_3_3_Core::glVertexAttribIPointer(GLuint index, GLint size, GLenum type, GLsizei stride, const GLvoid *pointer)
-{
- d_3_0_Core->f.VertexAttribIPointer(index, size, type, stride, pointer);
-}
-
-inline void QOpenGLFunctions_3_3_Core::glEndConditionalRender()
-{
- d_3_0_Core->f.EndConditionalRender();
-}
-
-inline void QOpenGLFunctions_3_3_Core::glBeginConditionalRender(GLuint id, GLenum mode)
-{
- d_3_0_Core->f.BeginConditionalRender(id, mode);
-}
-
-inline void QOpenGLFunctions_3_3_Core::glClampColor(GLenum target, GLenum clamp)
-{
- d_3_0_Core->f.ClampColor(target, clamp);
-}
-
-inline void QOpenGLFunctions_3_3_Core::glGetTransformFeedbackVarying(GLuint program, GLuint index, GLsizei bufSize, GLsizei *length, GLsizei *size, GLenum *type, GLchar *name)
-{
- d_3_0_Core->f.GetTransformFeedbackVarying(program, index, bufSize, length, size, type, name);
-}
-
-inline void QOpenGLFunctions_3_3_Core::glTransformFeedbackVaryings(GLuint program, GLsizei count, const GLchar* const *varyings, GLenum bufferMode)
-{
- d_3_0_Core->f.TransformFeedbackVaryings(program, count, varyings, bufferMode);
-}
-
-inline void QOpenGLFunctions_3_3_Core::glBindBufferBase(GLenum target, GLuint index, GLuint buffer)
-{
- d_3_0_Core->f.BindBufferBase(target, index, buffer);
-}
-
-inline void QOpenGLFunctions_3_3_Core::glBindBufferRange(GLenum target, GLuint index, GLuint buffer, GLintptr offset, GLsizeiptr size)
-{
- d_3_0_Core->f.BindBufferRange(target, index, buffer, offset, size);
-}
-
-inline void QOpenGLFunctions_3_3_Core::glEndTransformFeedback()
-{
- d_3_0_Core->f.EndTransformFeedback();
-}
-
-inline void QOpenGLFunctions_3_3_Core::glBeginTransformFeedback(GLenum primitiveMode)
-{
- d_3_0_Core->f.BeginTransformFeedback(primitiveMode);
-}
-
-inline GLboolean QOpenGLFunctions_3_3_Core::glIsEnabledi(GLenum target, GLuint index)
-{
- return d_3_0_Core->f.IsEnabledi(target, index);
-}
-
-inline void QOpenGLFunctions_3_3_Core::glDisablei(GLenum target, GLuint index)
-{
- d_3_0_Core->f.Disablei(target, index);
-}
-
-inline void QOpenGLFunctions_3_3_Core::glEnablei(GLenum target, GLuint index)
-{
- d_3_0_Core->f.Enablei(target, index);
-}
-
-inline void QOpenGLFunctions_3_3_Core::glGetIntegeri_v(GLenum target, GLuint index, GLint *data)
-{
- d_3_0_Core->f.GetIntegeri_v(target, index, data);
-}
-
-inline void QOpenGLFunctions_3_3_Core::glGetBooleani_v(GLenum target, GLuint index, GLboolean *data)
-{
- d_3_0_Core->f.GetBooleani_v(target, index, data);
-}
-
-inline void QOpenGLFunctions_3_3_Core::glColorMaski(GLuint index, GLboolean r, GLboolean g, GLboolean b, GLboolean a)
-{
- d_3_0_Core->f.ColorMaski(index, r, g, b, a);
-}
-
-
-// OpenGL 3.1 core functions
-inline void QOpenGLFunctions_3_3_Core::glCopyBufferSubData(GLenum readTarget, GLenum writeTarget, GLintptr readOffset, GLintptr writeOffset, GLsizeiptr size)
-{
- d_3_1_Core->f.CopyBufferSubData(readTarget, writeTarget, readOffset, writeOffset, size);
-}
-
-inline void QOpenGLFunctions_3_3_Core::glUniformBlockBinding(GLuint program, GLuint uniformBlockIndex, GLuint uniformBlockBinding)
-{
- d_3_1_Core->f.UniformBlockBinding(program, uniformBlockIndex, uniformBlockBinding);
-}
-
-inline void QOpenGLFunctions_3_3_Core::glGetActiveUniformBlockName(GLuint program, GLuint uniformBlockIndex, GLsizei bufSize, GLsizei *length, GLchar *uniformBlockName)
-{
- d_3_1_Core->f.GetActiveUniformBlockName(program, uniformBlockIndex, bufSize, length, uniformBlockName);
-}
-
-inline void QOpenGLFunctions_3_3_Core::glGetActiveUniformBlockiv(GLuint program, GLuint uniformBlockIndex, GLenum pname, GLint *params)
-{
- d_3_1_Core->f.GetActiveUniformBlockiv(program, uniformBlockIndex, pname, params);
-}
-
-inline GLuint QOpenGLFunctions_3_3_Core::glGetUniformBlockIndex(GLuint program, const GLchar *uniformBlockName)
-{
- return d_3_1_Core->f.GetUniformBlockIndex(program, uniformBlockName);
-}
-
-inline void QOpenGLFunctions_3_3_Core::glGetActiveUniformName(GLuint program, GLuint uniformIndex, GLsizei bufSize, GLsizei *length, GLchar *uniformName)
-{
- d_3_1_Core->f.GetActiveUniformName(program, uniformIndex, bufSize, length, uniformName);
-}
-
-inline void QOpenGLFunctions_3_3_Core::glGetActiveUniformsiv(GLuint program, GLsizei uniformCount, const GLuint *uniformIndices, GLenum pname, GLint *params)
-{
- d_3_1_Core->f.GetActiveUniformsiv(program, uniformCount, uniformIndices, pname, params);
-}
-
-inline void QOpenGLFunctions_3_3_Core::glGetUniformIndices(GLuint program, GLsizei uniformCount, const GLchar* const *uniformNames, GLuint *uniformIndices)
-{
- d_3_1_Core->f.GetUniformIndices(program, uniformCount, uniformNames, uniformIndices);
-}
-
-inline void QOpenGLFunctions_3_3_Core::glPrimitiveRestartIndex(GLuint index)
-{
- d_3_1_Core->f.PrimitiveRestartIndex(index);
-}
-
-inline void QOpenGLFunctions_3_3_Core::glTexBuffer(GLenum target, GLenum internalformat, GLuint buffer)
-{
- d_3_1_Core->f.TexBuffer(target, internalformat, buffer);
-}
-
-inline void QOpenGLFunctions_3_3_Core::glDrawElementsInstanced(GLenum mode, GLsizei count, GLenum type, const GLvoid *indices, GLsizei instancecount)
-{
- d_3_1_Core->f.DrawElementsInstanced(mode, count, type, indices, instancecount);
-}
-
-inline void QOpenGLFunctions_3_3_Core::glDrawArraysInstanced(GLenum mode, GLint first, GLsizei count, GLsizei instancecount)
-{
- d_3_1_Core->f.DrawArraysInstanced(mode, first, count, instancecount);
-}
-
-
-// OpenGL 3.2 core functions
-inline void QOpenGLFunctions_3_3_Core::glSampleMaski(GLuint index, GLbitfield mask)
-{
- d_3_2_Core->f.SampleMaski(index, mask);
-}
-
-inline void QOpenGLFunctions_3_3_Core::glGetMultisamplefv(GLenum pname, GLuint index, GLfloat *val)
-{
- d_3_2_Core->f.GetMultisamplefv(pname, index, val);
-}
-
-inline void QOpenGLFunctions_3_3_Core::glTexImage3DMultisample(GLenum target, GLsizei samples, GLint internalformat, GLsizei width, GLsizei height, GLsizei depth, GLboolean fixedsamplelocations)
-{
- d_3_2_Core->f.TexImage3DMultisample(target, samples, internalformat, width, height, depth, fixedsamplelocations);
-}
-
-inline void QOpenGLFunctions_3_3_Core::glTexImage2DMultisample(GLenum target, GLsizei samples, GLint internalformat, GLsizei width, GLsizei height, GLboolean fixedsamplelocations)
-{
- d_3_2_Core->f.TexImage2DMultisample(target, samples, internalformat, width, height, fixedsamplelocations);
-}
-
-inline void QOpenGLFunctions_3_3_Core::glGetSynciv(GLsync sync, GLenum pname, GLsizei bufSize, GLsizei *length, GLint *values)
-{
- d_3_2_Core->f.GetSynciv(sync, pname, bufSize, length, values);
-}
-
-inline void QOpenGLFunctions_3_3_Core::glGetInteger64v(GLenum pname, GLint64 *params)
-{
- d_3_2_Core->f.GetInteger64v(pname, params);
-}
-
-inline void QOpenGLFunctions_3_3_Core::glWaitSync(GLsync sync, GLbitfield flags, GLuint64 timeout)
-{
- d_3_2_Core->f.WaitSync(sync, flags, timeout);
-}
-
-inline GLenum QOpenGLFunctions_3_3_Core::glClientWaitSync(GLsync sync, GLbitfield flags, GLuint64 timeout)
-{
- return d_3_2_Core->f.ClientWaitSync(sync, flags, timeout);
-}
-
-inline void QOpenGLFunctions_3_3_Core::glDeleteSync(GLsync sync)
-{
- d_3_2_Core->f.DeleteSync(sync);
-}
-
-inline GLboolean QOpenGLFunctions_3_3_Core::glIsSync(GLsync sync)
-{
- return d_3_2_Core->f.IsSync(sync);
-}
-
-inline GLsync QOpenGLFunctions_3_3_Core::glFenceSync(GLenum condition, GLbitfield flags)
-{
- return d_3_2_Core->f.FenceSync(condition, flags);
-}
-
-inline void QOpenGLFunctions_3_3_Core::glProvokingVertex(GLenum mode)
-{
- d_3_2_Core->f.ProvokingVertex(mode);
-}
-
-inline void QOpenGLFunctions_3_3_Core::glMultiDrawElementsBaseVertex(GLenum mode, const GLsizei *count, GLenum type, const GLvoid* const *indices, GLsizei drawcount, const GLint *basevertex)
-{
- d_3_2_Core->f.MultiDrawElementsBaseVertex(mode, count, type, indices, drawcount, basevertex);
-}
-
-inline void QOpenGLFunctions_3_3_Core::glDrawElementsInstancedBaseVertex(GLenum mode, GLsizei count, GLenum type, const GLvoid *indices, GLsizei instancecount, GLint basevertex)
-{
- d_3_2_Core->f.DrawElementsInstancedBaseVertex(mode, count, type, indices, instancecount, basevertex);
-}
-
-inline void QOpenGLFunctions_3_3_Core::glDrawRangeElementsBaseVertex(GLenum mode, GLuint start, GLuint end, GLsizei count, GLenum type, const GLvoid *indices, GLint basevertex)
-{
- d_3_2_Core->f.DrawRangeElementsBaseVertex(mode, start, end, count, type, indices, basevertex);
-}
-
-inline void QOpenGLFunctions_3_3_Core::glDrawElementsBaseVertex(GLenum mode, GLsizei count, GLenum type, const GLvoid *indices, GLint basevertex)
-{
- d_3_2_Core->f.DrawElementsBaseVertex(mode, count, type, indices, basevertex);
-}
-
-inline void QOpenGLFunctions_3_3_Core::glFramebufferTexture(GLenum target, GLenum attachment, GLuint texture, GLint level)
-{
- d_3_2_Core->f.FramebufferTexture(target, attachment, texture, level);
-}
-
-inline void QOpenGLFunctions_3_3_Core::glGetBufferParameteri64v(GLenum target, GLenum pname, GLint64 *params)
-{
- d_3_2_Core->f.GetBufferParameteri64v(target, pname, params);
-}
-
-inline void QOpenGLFunctions_3_3_Core::glGetInteger64i_v(GLenum target, GLuint index, GLint64 *data)
-{
- d_3_2_Core->f.GetInteger64i_v(target, index, data);
-}
-
-
-// OpenGL 3.3 core functions
-inline void QOpenGLFunctions_3_3_Core::glVertexAttribP4uiv(GLuint index, GLenum type, GLboolean normalized, const GLuint *value)
-{
- d_3_3_Core->f.VertexAttribP4uiv(index, type, normalized, value);
-}
-
-inline void QOpenGLFunctions_3_3_Core::glVertexAttribP4ui(GLuint index, GLenum type, GLboolean normalized, GLuint value)
-{
- d_3_3_Core->f.VertexAttribP4ui(index, type, normalized, value);
-}
-
-inline void QOpenGLFunctions_3_3_Core::glVertexAttribP3uiv(GLuint index, GLenum type, GLboolean normalized, const GLuint *value)
-{
- d_3_3_Core->f.VertexAttribP3uiv(index, type, normalized, value);
-}
-
-inline void QOpenGLFunctions_3_3_Core::glVertexAttribP3ui(GLuint index, GLenum type, GLboolean normalized, GLuint value)
-{
- d_3_3_Core->f.VertexAttribP3ui(index, type, normalized, value);
-}
-
-inline void QOpenGLFunctions_3_3_Core::glVertexAttribP2uiv(GLuint index, GLenum type, GLboolean normalized, const GLuint *value)
-{
- d_3_3_Core->f.VertexAttribP2uiv(index, type, normalized, value);
-}
-
-inline void QOpenGLFunctions_3_3_Core::glVertexAttribP2ui(GLuint index, GLenum type, GLboolean normalized, GLuint value)
-{
- d_3_3_Core->f.VertexAttribP2ui(index, type, normalized, value);
-}
-
-inline void QOpenGLFunctions_3_3_Core::glVertexAttribP1uiv(GLuint index, GLenum type, GLboolean normalized, const GLuint *value)
-{
- d_3_3_Core->f.VertexAttribP1uiv(index, type, normalized, value);
-}
-
-inline void QOpenGLFunctions_3_3_Core::glVertexAttribP1ui(GLuint index, GLenum type, GLboolean normalized, GLuint value)
-{
- d_3_3_Core->f.VertexAttribP1ui(index, type, normalized, value);
-}
-
-inline void QOpenGLFunctions_3_3_Core::glSecondaryColorP3uiv(GLenum type, const GLuint *color)
-{
- Q_UNUSED(type);
- Q_UNUSED(color);
- QOPENGL_DEPRECATEDFUNCTION;
-}
-
-inline void QOpenGLFunctions_3_3_Core::glSecondaryColorP3ui(GLenum type, GLuint color)
-{
- Q_UNUSED(type);
- Q_UNUSED(color);
- QOPENGL_DEPRECATEDFUNCTION;
-}
-
-inline void QOpenGLFunctions_3_3_Core::glColorP4uiv(GLenum type, const GLuint *color)
-{
- Q_UNUSED(type);
- Q_UNUSED(color);
- QOPENGL_DEPRECATEDFUNCTION;
-}
-
-inline void QOpenGLFunctions_3_3_Core::glColorP4ui(GLenum type, GLuint color)
-{
- Q_UNUSED(type);
- Q_UNUSED(color);
- QOPENGL_DEPRECATEDFUNCTION;
-}
-
-inline void QOpenGLFunctions_3_3_Core::glColorP3uiv(GLenum type, const GLuint *color)
-{
- Q_UNUSED(type);
- Q_UNUSED(color);
- QOPENGL_DEPRECATEDFUNCTION;
-}
-
-inline void QOpenGLFunctions_3_3_Core::glColorP3ui(GLenum type, GLuint color)
-{
- Q_UNUSED(type);
- Q_UNUSED(color);
- QOPENGL_DEPRECATEDFUNCTION;
-}
-
-inline void QOpenGLFunctions_3_3_Core::glNormalP3uiv(GLenum type, const GLuint *coords)
-{
- Q_UNUSED(type);
- Q_UNUSED(coords);
- QOPENGL_DEPRECATEDFUNCTION;
-}
-
-inline void QOpenGLFunctions_3_3_Core::glNormalP3ui(GLenum type, GLuint coords)
-{
- Q_UNUSED(type);
- Q_UNUSED(coords);
- QOPENGL_DEPRECATEDFUNCTION;
-}
-
-inline void QOpenGLFunctions_3_3_Core::glMultiTexCoordP4uiv(GLenum texture, GLenum type, const GLuint *coords)
-{
- Q_UNUSED(texture);
- Q_UNUSED(type);
- Q_UNUSED(coords);
- QOPENGL_DEPRECATEDFUNCTION;
-}
-
-inline void QOpenGLFunctions_3_3_Core::glMultiTexCoordP4ui(GLenum texture, GLenum type, GLuint coords)
-{
- Q_UNUSED(texture);
- Q_UNUSED(type);
- Q_UNUSED(coords);
- QOPENGL_DEPRECATEDFUNCTION;
-}
-
-inline void QOpenGLFunctions_3_3_Core::glMultiTexCoordP3uiv(GLenum texture, GLenum type, const GLuint *coords)
-{
- Q_UNUSED(texture);
- Q_UNUSED(type);
- Q_UNUSED(coords);
- QOPENGL_DEPRECATEDFUNCTION;
-}
-
-inline void QOpenGLFunctions_3_3_Core::glMultiTexCoordP3ui(GLenum texture, GLenum type, GLuint coords)
-{
- Q_UNUSED(texture);
- Q_UNUSED(type);
- Q_UNUSED(coords);
- QOPENGL_DEPRECATEDFUNCTION;
-}
-
-inline void QOpenGLFunctions_3_3_Core::glMultiTexCoordP2uiv(GLenum texture, GLenum type, const GLuint *coords)
-{
- Q_UNUSED(texture);
- Q_UNUSED(type);
- Q_UNUSED(coords);
- QOPENGL_DEPRECATEDFUNCTION;
-}
-
-inline void QOpenGLFunctions_3_3_Core::glMultiTexCoordP2ui(GLenum texture, GLenum type, GLuint coords)
-{
- Q_UNUSED(texture);
- Q_UNUSED(type);
- Q_UNUSED(coords);
- QOPENGL_DEPRECATEDFUNCTION;
-}
-
-inline void QOpenGLFunctions_3_3_Core::glMultiTexCoordP1uiv(GLenum texture, GLenum type, const GLuint *coords)
-{
- Q_UNUSED(texture);
- Q_UNUSED(type);
- Q_UNUSED(coords);
- QOPENGL_DEPRECATEDFUNCTION;
-}
-
-inline void QOpenGLFunctions_3_3_Core::glMultiTexCoordP1ui(GLenum texture, GLenum type, GLuint coords)
-{
- Q_UNUSED(texture);
- Q_UNUSED(type);
- Q_UNUSED(coords);
- QOPENGL_DEPRECATEDFUNCTION;
-}
-
-inline void QOpenGLFunctions_3_3_Core::glTexCoordP4uiv(GLenum type, const GLuint *coords)
-{
- Q_UNUSED(type);
- Q_UNUSED(coords);
- QOPENGL_DEPRECATEDFUNCTION;
-}
-
-inline void QOpenGLFunctions_3_3_Core::glTexCoordP4ui(GLenum type, GLuint coords)
-{
- Q_UNUSED(type);
- Q_UNUSED(coords);
- QOPENGL_DEPRECATEDFUNCTION;
-}
-
-inline void QOpenGLFunctions_3_3_Core::glTexCoordP3uiv(GLenum type, const GLuint *coords)
-{
- Q_UNUSED(type);
- Q_UNUSED(coords);
- QOPENGL_DEPRECATEDFUNCTION;
-}
-
-inline void QOpenGLFunctions_3_3_Core::glTexCoordP3ui(GLenum type, GLuint coords)
-{
- Q_UNUSED(type);
- Q_UNUSED(coords);
- QOPENGL_DEPRECATEDFUNCTION;
-}
-
-inline void QOpenGLFunctions_3_3_Core::glTexCoordP2uiv(GLenum type, const GLuint *coords)
-{
- Q_UNUSED(type);
- Q_UNUSED(coords);
- QOPENGL_DEPRECATEDFUNCTION;
-}
-
-inline void QOpenGLFunctions_3_3_Core::glTexCoordP2ui(GLenum type, GLuint coords)
-{
- Q_UNUSED(type);
- Q_UNUSED(coords);
- QOPENGL_DEPRECATEDFUNCTION;
-}
-
-inline void QOpenGLFunctions_3_3_Core::glTexCoordP1uiv(GLenum type, const GLuint *coords)
-{
- Q_UNUSED(type);
- Q_UNUSED(coords);
- QOPENGL_DEPRECATEDFUNCTION;
-}
-
-inline void QOpenGLFunctions_3_3_Core::glTexCoordP1ui(GLenum type, GLuint coords)
-{
- Q_UNUSED(type);
- Q_UNUSED(coords);
- QOPENGL_DEPRECATEDFUNCTION;
-}
-
-inline void QOpenGLFunctions_3_3_Core::glVertexP4uiv(GLenum type, const GLuint *value)
-{
- Q_UNUSED(type);
- Q_UNUSED(value);
- QOPENGL_DEPRECATEDFUNCTION;
-}
-
-inline void QOpenGLFunctions_3_3_Core::glVertexP4ui(GLenum type, GLuint value)
-{
- Q_UNUSED(type);
- Q_UNUSED(value);
- QOPENGL_DEPRECATEDFUNCTION;
-}
-
-inline void QOpenGLFunctions_3_3_Core::glVertexP3uiv(GLenum type, const GLuint *value)
-{
- Q_UNUSED(type);
- Q_UNUSED(value);
- QOPENGL_DEPRECATEDFUNCTION;
-}
-
-inline void QOpenGLFunctions_3_3_Core::glVertexP3ui(GLenum type, GLuint value)
-{
- Q_UNUSED(type);
- Q_UNUSED(value);
- QOPENGL_DEPRECATEDFUNCTION;
-}
-
-inline void QOpenGLFunctions_3_3_Core::glVertexP2uiv(GLenum type, const GLuint *value)
-{
- Q_UNUSED(type);
- Q_UNUSED(value);
- QOPENGL_DEPRECATEDFUNCTION;
-}
-
-inline void QOpenGLFunctions_3_3_Core::glVertexP2ui(GLenum type, GLuint value)
-{
- Q_UNUSED(type);
- Q_UNUSED(value);
- QOPENGL_DEPRECATEDFUNCTION;
-}
-
-inline void QOpenGLFunctions_3_3_Core::glGetQueryObjectui64v(GLuint id, GLenum pname, GLuint64 *params)
-{
- d_3_3_Core->f.GetQueryObjectui64v(id, pname, params);
-}
-
-inline void QOpenGLFunctions_3_3_Core::glGetQueryObjecti64v(GLuint id, GLenum pname, GLint64 *params)
-{
- d_3_3_Core->f.GetQueryObjecti64v(id, pname, params);
-}
-
-inline void QOpenGLFunctions_3_3_Core::glQueryCounter(GLuint id, GLenum target)
-{
- d_3_3_Core->f.QueryCounter(id, target);
-}
-
-inline void QOpenGLFunctions_3_3_Core::glGetSamplerParameterIuiv(GLuint sampler, GLenum pname, GLuint *params)
-{
- d_3_3_Core->f.GetSamplerParameterIuiv(sampler, pname, params);
-}
-
-inline void QOpenGLFunctions_3_3_Core::glGetSamplerParameterfv(GLuint sampler, GLenum pname, GLfloat *params)
-{
- d_3_3_Core->f.GetSamplerParameterfv(sampler, pname, params);
-}
-
-inline void QOpenGLFunctions_3_3_Core::glGetSamplerParameterIiv(GLuint sampler, GLenum pname, GLint *params)
-{
- d_3_3_Core->f.GetSamplerParameterIiv(sampler, pname, params);
-}
-
-inline void QOpenGLFunctions_3_3_Core::glGetSamplerParameteriv(GLuint sampler, GLenum pname, GLint *params)
-{
- d_3_3_Core->f.GetSamplerParameteriv(sampler, pname, params);
-}
-
-inline void QOpenGLFunctions_3_3_Core::glSamplerParameterIuiv(GLuint sampler, GLenum pname, const GLuint *param)
-{
- d_3_3_Core->f.SamplerParameterIuiv(sampler, pname, param);
-}
-
-inline void QOpenGLFunctions_3_3_Core::glSamplerParameterIiv(GLuint sampler, GLenum pname, const GLint *param)
-{
- d_3_3_Core->f.SamplerParameterIiv(sampler, pname, param);
-}
-
-inline void QOpenGLFunctions_3_3_Core::glSamplerParameterfv(GLuint sampler, GLenum pname, const GLfloat *param)
-{
- d_3_3_Core->f.SamplerParameterfv(sampler, pname, param);
-}
-
-inline void QOpenGLFunctions_3_3_Core::glSamplerParameterf(GLuint sampler, GLenum pname, GLfloat param)
-{
- d_3_3_Core->f.SamplerParameterf(sampler, pname, param);
-}
-
-inline void QOpenGLFunctions_3_3_Core::glSamplerParameteriv(GLuint sampler, GLenum pname, const GLint *param)
-{
- d_3_3_Core->f.SamplerParameteriv(sampler, pname, param);
-}
-
-inline void QOpenGLFunctions_3_3_Core::glSamplerParameteri(GLuint sampler, GLenum pname, GLint param)
-{
- d_3_3_Core->f.SamplerParameteri(sampler, pname, param);
-}
-
-inline void QOpenGLFunctions_3_3_Core::glBindSampler(GLuint unit, GLuint sampler)
-{
- d_3_3_Core->f.BindSampler(unit, sampler);
-}
-
-inline GLboolean QOpenGLFunctions_3_3_Core::glIsSampler(GLuint sampler)
-{
- return d_3_3_Core->f.IsSampler(sampler);
-}
-
-inline void QOpenGLFunctions_3_3_Core::glDeleteSamplers(GLsizei count, const GLuint *samplers)
-{
- d_3_3_Core->f.DeleteSamplers(count, samplers);
-}
-
-inline void QOpenGLFunctions_3_3_Core::glGenSamplers(GLsizei count, GLuint *samplers)
-{
- d_3_3_Core->f.GenSamplers(count, samplers);
-}
-
-inline GLint QOpenGLFunctions_3_3_Core::glGetFragDataIndex(GLuint program, const GLchar *name)
-{
- return d_3_3_Core->f.GetFragDataIndex(program, name);
-}
-
-inline void QOpenGLFunctions_3_3_Core::glBindFragDataLocationIndexed(GLuint program, GLuint colorNumber, GLuint index, const GLchar *name)
-{
- d_3_3_Core->f.BindFragDataLocationIndexed(program, colorNumber, index, name);
-}
-
-inline void QOpenGLFunctions_3_3_Core::glVertexAttribDivisor(GLuint index, GLuint divisor)
-{
- d_3_3_Core->f.VertexAttribDivisor(index, divisor);
-}
-
-
-
-QT_END_NAMESPACE
-
-#endif // QT_NO_OPENGL && !QT_OPENGL_ES_2
-
-#endif
diff --git a/src/gui/opengl/qopenglfunctions_4_0_compatibility.cpp b/src/gui/opengl/qopenglfunctions_4_0_compatibility.cpp
deleted file mode 100644
index 655f1e6fd4..0000000000
--- a/src/gui/opengl/qopenglfunctions_4_0_compatibility.cpp
+++ /dev/null
@@ -1,291 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2013 Klaralvdalens Datakonsult AB (KDAB)
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the QtGui module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-**
-** This file was generated by glgen version 0.1
-** Command line was: glgen
-**
-** glgen is Copyright (C) 2013 Klaralvdalens Datakonsult AB (KDAB)
-**
-** This is an auto-generated file.
-** Do not edit! All changes made to it will be lost.
-**
-****************************************************************************/
-
-#include "qopenglfunctions_4_0_compatibility.h"
-#include "qopenglcontext.h"
-
-QT_BEGIN_NAMESPACE
-
-/*!
- \class QOpenGLFunctions_4_0_Compatibility
- \inmodule QtGui
- \since 5.1
- \wrapper
- \brief The QOpenGLFunctions_4_0_Compatibility class provides all functions for OpenGL 4.0 compatibility profile.
-
- This class is a wrapper for functions from OpenGL 4.0 compatibility profile.
- See reference pages on \l {http://www.opengl.org/sdk/docs/}{opengl.org}
- for function documentation.
-
- \sa QAbstractOpenGLFunctions
-*/
-
-QOpenGLFunctions_4_0_Compatibility::QOpenGLFunctions_4_0_Compatibility()
- : QAbstractOpenGLFunctions()
- , d_1_0_Core(nullptr)
- , d_1_1_Core(nullptr)
- , d_1_2_Core(nullptr)
- , d_1_3_Core(nullptr)
- , d_1_4_Core(nullptr)
- , d_1_5_Core(nullptr)
- , d_2_0_Core(nullptr)
- , d_2_1_Core(nullptr)
- , d_3_0_Core(nullptr)
- , d_3_1_Core(nullptr)
- , d_3_2_Core(nullptr)
- , d_3_3_Core(nullptr)
- , d_4_0_Core(nullptr)
- , d_1_0_Deprecated(nullptr)
- , d_1_1_Deprecated(nullptr)
- , d_1_2_Deprecated(nullptr)
- , d_1_3_Deprecated(nullptr)
- , d_1_4_Deprecated(nullptr)
- , m_reserved_2_0_Deprecated(nullptr)
- , d_3_3_Deprecated(nullptr)
-{
-}
-
-QOpenGLFunctions_4_0_Compatibility::~QOpenGLFunctions_4_0_Compatibility()
-{
- if (d_1_0_Core) {
- d_1_0_Core->refs.deref();
- Q_ASSERT(d_1_0_Core->refs.loadRelaxed());
- }
- if (d_1_1_Core) {
- d_1_1_Core->refs.deref();
- Q_ASSERT(d_1_1_Core->refs.loadRelaxed());
- }
- if (d_1_2_Core) {
- d_1_2_Core->refs.deref();
- Q_ASSERT(d_1_2_Core->refs.loadRelaxed());
- }
- if (d_1_3_Core) {
- d_1_3_Core->refs.deref();
- Q_ASSERT(d_1_3_Core->refs.loadRelaxed());
- }
- if (d_1_4_Core) {
- d_1_4_Core->refs.deref();
- Q_ASSERT(d_1_4_Core->refs.loadRelaxed());
- }
- if (d_1_5_Core) {
- d_1_5_Core->refs.deref();
- Q_ASSERT(d_1_5_Core->refs.loadRelaxed());
- }
- if (d_2_0_Core) {
- d_2_0_Core->refs.deref();
- Q_ASSERT(d_2_0_Core->refs.loadRelaxed());
- }
- if (d_2_1_Core) {
- d_2_1_Core->refs.deref();
- Q_ASSERT(d_2_1_Core->refs.loadRelaxed());
- }
- if (d_3_0_Core) {
- d_3_0_Core->refs.deref();
- Q_ASSERT(d_3_0_Core->refs.loadRelaxed());
- }
- if (d_3_1_Core) {
- d_3_1_Core->refs.deref();
- Q_ASSERT(d_3_1_Core->refs.loadRelaxed());
- }
- if (d_3_2_Core) {
- d_3_2_Core->refs.deref();
- Q_ASSERT(d_3_2_Core->refs.loadRelaxed());
- }
- if (d_3_3_Core) {
- d_3_3_Core->refs.deref();
- Q_ASSERT(d_3_3_Core->refs.loadRelaxed());
- }
- if (d_4_0_Core) {
- d_4_0_Core->refs.deref();
- Q_ASSERT(d_4_0_Core->refs.loadRelaxed());
- }
- if (d_1_0_Deprecated) {
- d_1_0_Deprecated->refs.deref();
- Q_ASSERT(d_1_0_Deprecated->refs.loadRelaxed());
- }
- if (d_1_1_Deprecated) {
- d_1_1_Deprecated->refs.deref();
- Q_ASSERT(d_1_1_Deprecated->refs.loadRelaxed());
- }
- if (d_1_2_Deprecated) {
- d_1_2_Deprecated->refs.deref();
- Q_ASSERT(d_1_2_Deprecated->refs.loadRelaxed());
- }
- if (d_1_3_Deprecated) {
- d_1_3_Deprecated->refs.deref();
- Q_ASSERT(d_1_3_Deprecated->refs.loadRelaxed());
- }
- if (d_1_4_Deprecated) {
- d_1_4_Deprecated->refs.deref();
- Q_ASSERT(d_1_4_Deprecated->refs.loadRelaxed());
- }
- if (d_3_3_Deprecated) {
- d_3_3_Deprecated->refs.deref();
- Q_ASSERT(d_3_3_Deprecated->refs.loadRelaxed());
- }
-}
-
-bool QOpenGLFunctions_4_0_Compatibility::initializeOpenGLFunctions()
-{
- if ( isInitialized() )
- return true;
-
- QOpenGLContext* context = QOpenGLContext::currentContext();
-
- // If owned by a context object make sure it is current.
- // Also check that current context is capable of resolving all needed functions
- if (((owningContext() && owningContext() == context) || !owningContext())
- && QOpenGLFunctions_4_0_Compatibility::isContextCompatible(context))
- {
- // Associate with private implementation, creating if necessary
- // Function pointers in the backends are resolved at creation time
- QOpenGLVersionFunctionsBackend* d = nullptr;
- d = QAbstractOpenGLFunctionsPrivate::functionsBackend(context, QOpenGLFunctions_1_0_CoreBackend::versionStatus());
- d_1_0_Core = static_cast<QOpenGLFunctions_1_0_CoreBackend*>(d);
- d->refs.ref();
-
- d = QAbstractOpenGLFunctionsPrivate::functionsBackend(context, QOpenGLFunctions_1_1_CoreBackend::versionStatus());
- d_1_1_Core = static_cast<QOpenGLFunctions_1_1_CoreBackend*>(d);
- d->refs.ref();
-
- d = QAbstractOpenGLFunctionsPrivate::functionsBackend(context, QOpenGLFunctions_1_2_CoreBackend::versionStatus());
- d_1_2_Core = static_cast<QOpenGLFunctions_1_2_CoreBackend*>(d);
- d->refs.ref();
-
- d = QAbstractOpenGLFunctionsPrivate::functionsBackend(context, QOpenGLFunctions_1_3_CoreBackend::versionStatus());
- d_1_3_Core = static_cast<QOpenGLFunctions_1_3_CoreBackend*>(d);
- d->refs.ref();
-
- d = QAbstractOpenGLFunctionsPrivate::functionsBackend(context, QOpenGLFunctions_1_4_CoreBackend::versionStatus());
- d_1_4_Core = static_cast<QOpenGLFunctions_1_4_CoreBackend*>(d);
- d->refs.ref();
-
- d = QAbstractOpenGLFunctionsPrivate::functionsBackend(context, QOpenGLFunctions_1_5_CoreBackend::versionStatus());
- d_1_5_Core = static_cast<QOpenGLFunctions_1_5_CoreBackend*>(d);
- d->refs.ref();
-
- d = QAbstractOpenGLFunctionsPrivate::functionsBackend(context, QOpenGLFunctions_2_0_CoreBackend::versionStatus());
- d_2_0_Core = static_cast<QOpenGLFunctions_2_0_CoreBackend*>(d);
- d->refs.ref();
-
- d = QAbstractOpenGLFunctionsPrivate::functionsBackend(context, QOpenGLFunctions_2_1_CoreBackend::versionStatus());
- d_2_1_Core = static_cast<QOpenGLFunctions_2_1_CoreBackend*>(d);
- d->refs.ref();
-
- d = QAbstractOpenGLFunctionsPrivate::functionsBackend(context, QOpenGLFunctions_3_0_CoreBackend::versionStatus());
- d_3_0_Core = static_cast<QOpenGLFunctions_3_0_CoreBackend*>(d);
- d->refs.ref();
-
- d = QAbstractOpenGLFunctionsPrivate::functionsBackend(context, QOpenGLFunctions_3_1_CoreBackend::versionStatus());
- d_3_1_Core = static_cast<QOpenGLFunctions_3_1_CoreBackend*>(d);
- d->refs.ref();
-
- d = QAbstractOpenGLFunctionsPrivate::functionsBackend(context, QOpenGLFunctions_3_2_CoreBackend::versionStatus());
- d_3_2_Core = static_cast<QOpenGLFunctions_3_2_CoreBackend*>(d);
- d->refs.ref();
-
- d = QAbstractOpenGLFunctionsPrivate::functionsBackend(context, QOpenGLFunctions_3_3_CoreBackend::versionStatus());
- d_3_3_Core = static_cast<QOpenGLFunctions_3_3_CoreBackend*>(d);
- d->refs.ref();
-
- d = QAbstractOpenGLFunctionsPrivate::functionsBackend(context, QOpenGLFunctions_4_0_CoreBackend::versionStatus());
- d_4_0_Core = static_cast<QOpenGLFunctions_4_0_CoreBackend*>(d);
- d->refs.ref();
-
- d = QAbstractOpenGLFunctionsPrivate::functionsBackend(context, QOpenGLFunctions_1_0_DeprecatedBackend::versionStatus());
- d_1_0_Deprecated = static_cast<QOpenGLFunctions_1_0_DeprecatedBackend*>(d);
- d->refs.ref();
-
- d = QAbstractOpenGLFunctionsPrivate::functionsBackend(context, QOpenGLFunctions_1_1_DeprecatedBackend::versionStatus());
- d_1_1_Deprecated = static_cast<QOpenGLFunctions_1_1_DeprecatedBackend*>(d);
- d->refs.ref();
-
- d = QAbstractOpenGLFunctionsPrivate::functionsBackend(context, QOpenGLFunctions_1_2_DeprecatedBackend::versionStatus());
- d_1_2_Deprecated = static_cast<QOpenGLFunctions_1_2_DeprecatedBackend*>(d);
- d->refs.ref();
-
- d = QAbstractOpenGLFunctionsPrivate::functionsBackend(context, QOpenGLFunctions_1_3_DeprecatedBackend::versionStatus());
- d_1_3_Deprecated = static_cast<QOpenGLFunctions_1_3_DeprecatedBackend*>(d);
- d->refs.ref();
-
- d = QAbstractOpenGLFunctionsPrivate::functionsBackend(context, QOpenGLFunctions_1_4_DeprecatedBackend::versionStatus());
- d_1_4_Deprecated = static_cast<QOpenGLFunctions_1_4_DeprecatedBackend*>(d);
- d->refs.ref();
-
- d = QAbstractOpenGLFunctionsPrivate::functionsBackend(context, QOpenGLFunctions_3_3_DeprecatedBackend::versionStatus());
- d_3_3_Deprecated = static_cast<QOpenGLFunctions_3_3_DeprecatedBackend*>(d);
- d->refs.ref();
-
- QAbstractOpenGLFunctions::initializeOpenGLFunctions();
- }
- return isInitialized();
-}
-
-bool QOpenGLFunctions_4_0_Compatibility::isContextCompatible(QOpenGLContext *context)
-{
- Q_ASSERT(context);
- QSurfaceFormat f = context->format();
- const QPair<int, int> v = qMakePair(f.majorVersion(), f.minorVersion());
- if (v < qMakePair(4, 0))
- return false;
-
- if (f.profile() == QSurfaceFormat::CoreProfile)
- return false;
-
- return true;
-}
-
-QOpenGLVersionProfile QOpenGLFunctions_4_0_Compatibility::versionProfile()
-{
- QOpenGLVersionProfile v;
- v.setVersion(4, 0);
- v.setProfile(QSurfaceFormat::CompatibilityProfile);
- return v;
-}
-
-QT_END_NAMESPACE
diff --git a/src/gui/opengl/qopenglfunctions_4_0_compatibility.h b/src/gui/opengl/qopenglfunctions_4_0_compatibility.h
deleted file mode 100644
index c0e42443d3..0000000000
--- a/src/gui/opengl/qopenglfunctions_4_0_compatibility.h
+++ /dev/null
@@ -1,5019 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2013 Klaralvdalens Datakonsult AB (KDAB)
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the QtGui module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-**
-** This file was generated by glgen version 0.1
-** Command line was: glgen
-**
-** glgen is Copyright (C) 2013 Klaralvdalens Datakonsult AB (KDAB)
-**
-** This is an auto-generated file.
-** Do not edit! All changes made to it will be lost.
-**
-****************************************************************************/
-
-#ifndef QOPENGLVERSIONFUNCTIONS_4_0_COMPATIBILITY_H
-#define QOPENGLVERSIONFUNCTIONS_4_0_COMPATIBILITY_H
-
-#include <QtGui/qtguiglobal.h>
-
-#if !defined(QT_NO_OPENGL) && !defined(QT_OPENGL_ES_2)
-
-#include <QtGui/QOpenGLVersionFunctions>
-#include <QtGui/qopenglcontext.h>
-
-QT_BEGIN_NAMESPACE
-
-class Q_GUI_EXPORT QOpenGLFunctions_4_0_Compatibility : public QAbstractOpenGLFunctions
-{
-public:
- QOpenGLFunctions_4_0_Compatibility();
- ~QOpenGLFunctions_4_0_Compatibility();
-
- bool initializeOpenGLFunctions() override;
-
- // OpenGL 1.0 core functions
- void glViewport(GLint x, GLint y, GLsizei width, GLsizei height);
- void glDepthRange(GLdouble nearVal, GLdouble farVal);
- GLboolean glIsEnabled(GLenum cap);
- void glGetTexLevelParameteriv(GLenum target, GLint level, GLenum pname, GLint *params);
- void glGetTexLevelParameterfv(GLenum target, GLint level, GLenum pname, GLfloat *params);
- void glGetTexParameteriv(GLenum target, GLenum pname, GLint *params);
- void glGetTexParameterfv(GLenum target, GLenum pname, GLfloat *params);
- void glGetTexImage(GLenum target, GLint level, GLenum format, GLenum type, GLvoid *pixels);
- const GLubyte * glGetString(GLenum name);
- void glGetIntegerv(GLenum pname, GLint *params);
- void glGetFloatv(GLenum pname, GLfloat *params);
- GLenum glGetError();
- void glGetDoublev(GLenum pname, GLdouble *params);
- void glGetBooleanv(GLenum pname, GLboolean *params);
- void glReadPixels(GLint x, GLint y, GLsizei width, GLsizei height, GLenum format, GLenum type, GLvoid *pixels);
- void glReadBuffer(GLenum mode);
- void glPixelStorei(GLenum pname, GLint param);
- void glPixelStoref(GLenum pname, GLfloat param);
- void glDepthFunc(GLenum func);
- void glStencilOp(GLenum fail, GLenum zfail, GLenum zpass);
- void glStencilFunc(GLenum func, GLint ref, GLuint mask);
- void glLogicOp(GLenum opcode);
- void glBlendFunc(GLenum sfactor, GLenum dfactor);
- void glFlush();
- void glFinish();
- void glEnable(GLenum cap);
- void glDisable(GLenum cap);
- void glDepthMask(GLboolean flag);
- void glColorMask(GLboolean red, GLboolean green, GLboolean blue, GLboolean alpha);
- void glStencilMask(GLuint mask);
- void glClearDepth(GLdouble depth);
- void glClearStencil(GLint s);
- void glClearColor(GLfloat red, GLfloat green, GLfloat blue, GLfloat alpha);
- void glClear(GLbitfield mask);
- void glDrawBuffer(GLenum mode);
- void glTexImage2D(GLenum target, GLint level, GLint internalformat, GLsizei width, GLsizei height, GLint border, GLenum format, GLenum type, const GLvoid *pixels);
- void glTexImage1D(GLenum target, GLint level, GLint internalformat, GLsizei width, GLint border, GLenum format, GLenum type, const GLvoid *pixels);
- void glTexParameteriv(GLenum target, GLenum pname, const GLint *params);
- void glTexParameteri(GLenum target, GLenum pname, GLint param);
- void glTexParameterfv(GLenum target, GLenum pname, const GLfloat *params);
- void glTexParameterf(GLenum target, GLenum pname, GLfloat param);
- void glScissor(GLint x, GLint y, GLsizei width, GLsizei height);
- void glPolygonMode(GLenum face, GLenum mode);
- void glPointSize(GLfloat size);
- void glLineWidth(GLfloat width);
- void glHint(GLenum target, GLenum mode);
- void glFrontFace(GLenum mode);
- void glCullFace(GLenum mode);
-
- // OpenGL 1.1 core functions
- void glIndexubv(const GLubyte *c);
- void glIndexub(GLubyte c);
- GLboolean glIsTexture(GLuint texture);
- void glGenTextures(GLsizei n, GLuint *textures);
- void glDeleteTextures(GLsizei n, const GLuint *textures);
- void glBindTexture(GLenum target, GLuint texture);
- void glTexSubImage2D(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLenum type, const GLvoid *pixels);
- void glTexSubImage1D(GLenum target, GLint level, GLint xoffset, GLsizei width, GLenum format, GLenum type, const GLvoid *pixels);
- void glCopyTexSubImage2D(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint x, GLint y, GLsizei width, GLsizei height);
- void glCopyTexSubImage1D(GLenum target, GLint level, GLint xoffset, GLint x, GLint y, GLsizei width);
- void glCopyTexImage2D(GLenum target, GLint level, GLenum internalformat, GLint x, GLint y, GLsizei width, GLsizei height, GLint border);
- void glCopyTexImage1D(GLenum target, GLint level, GLenum internalformat, GLint x, GLint y, GLsizei width, GLint border);
- void glPolygonOffset(GLfloat factor, GLfloat units);
- void glGetPointerv(GLenum pname, GLvoid* *params);
- void glDrawElements(GLenum mode, GLsizei count, GLenum type, const GLvoid *indices);
- void glDrawArrays(GLenum mode, GLint first, GLsizei count);
-
- // OpenGL 1.2 core functions
- void glCopyTexSubImage3D(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLint x, GLint y, GLsizei width, GLsizei height);
- void glTexSubImage3D(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLenum type, const GLvoid *pixels);
- void glTexImage3D(GLenum target, GLint level, GLint internalformat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLenum format, GLenum type, const GLvoid *pixels);
- void glDrawRangeElements(GLenum mode, GLuint start, GLuint end, GLsizei count, GLenum type, const GLvoid *indices);
- void glBlendEquation(GLenum mode);
- void glBlendColor(GLfloat red, GLfloat green, GLfloat blue, GLfloat alpha);
-
- // OpenGL 1.3 core functions
- void glGetCompressedTexImage(GLenum target, GLint level, GLvoid *img);
- void glCompressedTexSubImage1D(GLenum target, GLint level, GLint xoffset, GLsizei width, GLenum format, GLsizei imageSize, const GLvoid *data);
- void glCompressedTexSubImage2D(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLsizei imageSize, const GLvoid *data);
- void glCompressedTexSubImage3D(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLsizei imageSize, const GLvoid *data);
- void glCompressedTexImage1D(GLenum target, GLint level, GLenum internalformat, GLsizei width, GLint border, GLsizei imageSize, const GLvoid *data);
- void glCompressedTexImage2D(GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLint border, GLsizei imageSize, const GLvoid *data);
- void glCompressedTexImage3D(GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLsizei imageSize, const GLvoid *data);
- void glSampleCoverage(GLfloat value, GLboolean invert);
- void glActiveTexture(GLenum texture);
-
- // OpenGL 1.4 core functions
- void glPointParameteriv(GLenum pname, const GLint *params);
- void glPointParameteri(GLenum pname, GLint param);
- void glPointParameterfv(GLenum pname, const GLfloat *params);
- void glPointParameterf(GLenum pname, GLfloat param);
- void glMultiDrawElements(GLenum mode, const GLsizei *count, GLenum type, const GLvoid* const *indices, GLsizei drawcount);
- void glMultiDrawArrays(GLenum mode, const GLint *first, const GLsizei *count, GLsizei drawcount);
- void glBlendFuncSeparate(GLenum sfactorRGB, GLenum dfactorRGB, GLenum sfactorAlpha, GLenum dfactorAlpha);
-
- // OpenGL 1.5 core functions
- void glGetBufferPointerv(GLenum target, GLenum pname, GLvoid* *params);
- void glGetBufferParameteriv(GLenum target, GLenum pname, GLint *params);
- GLboolean glUnmapBuffer(GLenum target);
- GLvoid* glMapBuffer(GLenum target, GLenum access);
- void glGetBufferSubData(GLenum target, GLintptr offset, GLsizeiptr size, GLvoid *data);
- void glBufferSubData(GLenum target, GLintptr offset, GLsizeiptr size, const GLvoid *data);
- void glBufferData(GLenum target, GLsizeiptr size, const GLvoid *data, GLenum usage);
- GLboolean glIsBuffer(GLuint buffer);
- void glGenBuffers(GLsizei n, GLuint *buffers);
- void glDeleteBuffers(GLsizei n, const GLuint *buffers);
- void glBindBuffer(GLenum target, GLuint buffer);
- void glGetQueryObjectuiv(GLuint id, GLenum pname, GLuint *params);
- void glGetQueryObjectiv(GLuint id, GLenum pname, GLint *params);
- void glGetQueryiv(GLenum target, GLenum pname, GLint *params);
- void glEndQuery(GLenum target);
- void glBeginQuery(GLenum target, GLuint id);
- GLboolean glIsQuery(GLuint id);
- void glDeleteQueries(GLsizei n, const GLuint *ids);
- void glGenQueries(GLsizei n, GLuint *ids);
-
- // OpenGL 2.0 core functions
- void glVertexAttribPointer(GLuint index, GLint size, GLenum type, GLboolean normalized, GLsizei stride, const GLvoid *pointer);
- void glValidateProgram(GLuint program);
- void glUniformMatrix4fv(GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
- void glUniformMatrix3fv(GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
- void glUniformMatrix2fv(GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
- void glUniform4iv(GLint location, GLsizei count, const GLint *value);
- void glUniform3iv(GLint location, GLsizei count, const GLint *value);
- void glUniform2iv(GLint location, GLsizei count, const GLint *value);
- void glUniform1iv(GLint location, GLsizei count, const GLint *value);
- void glUniform4fv(GLint location, GLsizei count, const GLfloat *value);
- void glUniform3fv(GLint location, GLsizei count, const GLfloat *value);
- void glUniform2fv(GLint location, GLsizei count, const GLfloat *value);
- void glUniform1fv(GLint location, GLsizei count, const GLfloat *value);
- void glUniform4i(GLint location, GLint v0, GLint v1, GLint v2, GLint v3);
- void glUniform3i(GLint location, GLint v0, GLint v1, GLint v2);
- void glUniform2i(GLint location, GLint v0, GLint v1);
- void glUniform1i(GLint location, GLint v0);
- void glUniform4f(GLint location, GLfloat v0, GLfloat v1, GLfloat v2, GLfloat v3);
- void glUniform3f(GLint location, GLfloat v0, GLfloat v1, GLfloat v2);
- void glUniform2f(GLint location, GLfloat v0, GLfloat v1);
- void glUniform1f(GLint location, GLfloat v0);
- void glUseProgram(GLuint program);
- void glShaderSource(GLuint shader, GLsizei count, const GLchar* const *string, const GLint *length);
- void glLinkProgram(GLuint program);
- GLboolean glIsShader(GLuint shader);
- GLboolean glIsProgram(GLuint program);
- void glGetVertexAttribPointerv(GLuint index, GLenum pname, GLvoid* *pointer);
- void glGetVertexAttribiv(GLuint index, GLenum pname, GLint *params);
- void glGetVertexAttribfv(GLuint index, GLenum pname, GLfloat *params);
- void glGetVertexAttribdv(GLuint index, GLenum pname, GLdouble *params);
- void glGetUniformiv(GLuint program, GLint location, GLint *params);
- void glGetUniformfv(GLuint program, GLint location, GLfloat *params);
- GLint glGetUniformLocation(GLuint program, const GLchar *name);
- void glGetShaderSource(GLuint shader, GLsizei bufSize, GLsizei *length, GLchar *source);
- void glGetShaderInfoLog(GLuint shader, GLsizei bufSize, GLsizei *length, GLchar *infoLog);
- void glGetShaderiv(GLuint shader, GLenum pname, GLint *params);
- void glGetProgramInfoLog(GLuint program, GLsizei bufSize, GLsizei *length, GLchar *infoLog);
- void glGetProgramiv(GLuint program, GLenum pname, GLint *params);
- GLint glGetAttribLocation(GLuint program, const GLchar *name);
- void glGetAttachedShaders(GLuint program, GLsizei maxCount, GLsizei *count, GLuint *obj);
- void glGetActiveUniform(GLuint program, GLuint index, GLsizei bufSize, GLsizei *length, GLint *size, GLenum *type, GLchar *name);
- void glGetActiveAttrib(GLuint program, GLuint index, GLsizei bufSize, GLsizei *length, GLint *size, GLenum *type, GLchar *name);
- void glEnableVertexAttribArray(GLuint index);
- void glDisableVertexAttribArray(GLuint index);
- void glDetachShader(GLuint program, GLuint shader);
- void glDeleteShader(GLuint shader);
- void glDeleteProgram(GLuint program);
- GLuint glCreateShader(GLenum type);
- GLuint glCreateProgram();
- void glCompileShader(GLuint shader);
- void glBindAttribLocation(GLuint program, GLuint index, const GLchar *name);
- void glAttachShader(GLuint program, GLuint shader);
- void glStencilMaskSeparate(GLenum face, GLuint mask);
- void glStencilFuncSeparate(GLenum face, GLenum func, GLint ref, GLuint mask);
- void glStencilOpSeparate(GLenum face, GLenum sfail, GLenum dpfail, GLenum dppass);
- void glDrawBuffers(GLsizei n, const GLenum *bufs);
- void glBlendEquationSeparate(GLenum modeRGB, GLenum modeAlpha);
-
- // OpenGL 2.1 core functions
- void glUniformMatrix4x3fv(GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
- void glUniformMatrix3x4fv(GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
- void glUniformMatrix4x2fv(GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
- void glUniformMatrix2x4fv(GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
- void glUniformMatrix3x2fv(GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
- void glUniformMatrix2x3fv(GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
-
- // OpenGL 3.0 core functions
- GLboolean glIsVertexArray(GLuint array);
- void glGenVertexArrays(GLsizei n, GLuint *arrays);
- void glDeleteVertexArrays(GLsizei n, const GLuint *arrays);
- void glBindVertexArray(GLuint array);
- void glFlushMappedBufferRange(GLenum target, GLintptr offset, GLsizeiptr length);
- GLvoid* glMapBufferRange(GLenum target, GLintptr offset, GLsizeiptr length, GLbitfield access);
- void glFramebufferTextureLayer(GLenum target, GLenum attachment, GLuint texture, GLint level, GLint layer);
- void glRenderbufferStorageMultisample(GLenum target, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height);
- void glBlitFramebuffer(GLint srcX0, GLint srcY0, GLint srcX1, GLint srcY1, GLint dstX0, GLint dstY0, GLint dstX1, GLint dstY1, GLbitfield mask, GLenum filter);
- void glGenerateMipmap(GLenum target);
- void glGetFramebufferAttachmentParameteriv(GLenum target, GLenum attachment, GLenum pname, GLint *params);
- void glFramebufferRenderbuffer(GLenum target, GLenum attachment, GLenum renderbuffertarget, GLuint renderbuffer);
- void glFramebufferTexture3D(GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level, GLint zoffset);
- void glFramebufferTexture2D(GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level);
- void glFramebufferTexture1D(GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level);
- GLenum glCheckFramebufferStatus(GLenum target);
- void glGenFramebuffers(GLsizei n, GLuint *framebuffers);
- void glDeleteFramebuffers(GLsizei n, const GLuint *framebuffers);
- void glBindFramebuffer(GLenum target, GLuint framebuffer);
- GLboolean glIsFramebuffer(GLuint framebuffer);
- void glGetRenderbufferParameteriv(GLenum target, GLenum pname, GLint *params);
- void glRenderbufferStorage(GLenum target, GLenum internalformat, GLsizei width, GLsizei height);
- void glGenRenderbuffers(GLsizei n, GLuint *renderbuffers);
- void glDeleteRenderbuffers(GLsizei n, const GLuint *renderbuffers);
- void glBindRenderbuffer(GLenum target, GLuint renderbuffer);
- GLboolean glIsRenderbuffer(GLuint renderbuffer);
- const GLubyte * glGetStringi(GLenum name, GLuint index);
- void glClearBufferfi(GLenum buffer, GLint drawbuffer, GLfloat depth, GLint stencil);
- void glClearBufferfv(GLenum buffer, GLint drawbuffer, const GLfloat *value);
- void glClearBufferuiv(GLenum buffer, GLint drawbuffer, const GLuint *value);
- void glClearBufferiv(GLenum buffer, GLint drawbuffer, const GLint *value);
- void glGetTexParameterIuiv(GLenum target, GLenum pname, GLuint *params);
- void glGetTexParameterIiv(GLenum target, GLenum pname, GLint *params);
- void glTexParameterIuiv(GLenum target, GLenum pname, const GLuint *params);
- void glTexParameterIiv(GLenum target, GLenum pname, const GLint *params);
- void glUniform4uiv(GLint location, GLsizei count, const GLuint *value);
- void glUniform3uiv(GLint location, GLsizei count, const GLuint *value);
- void glUniform2uiv(GLint location, GLsizei count, const GLuint *value);
- void glUniform1uiv(GLint location, GLsizei count, const GLuint *value);
- void glUniform4ui(GLint location, GLuint v0, GLuint v1, GLuint v2, GLuint v3);
- void glUniform3ui(GLint location, GLuint v0, GLuint v1, GLuint v2);
- void glUniform2ui(GLint location, GLuint v0, GLuint v1);
- void glUniform1ui(GLint location, GLuint v0);
- GLint glGetFragDataLocation(GLuint program, const GLchar *name);
- void glBindFragDataLocation(GLuint program, GLuint color, const GLchar *name);
- void glGetUniformuiv(GLuint program, GLint location, GLuint *params);
- void glGetVertexAttribIuiv(GLuint index, GLenum pname, GLuint *params);
- void glGetVertexAttribIiv(GLuint index, GLenum pname, GLint *params);
- void glVertexAttribIPointer(GLuint index, GLint size, GLenum type, GLsizei stride, const GLvoid *pointer);
- void glEndConditionalRender();
- void glBeginConditionalRender(GLuint id, GLenum mode);
- void glClampColor(GLenum target, GLenum clamp);
- void glGetTransformFeedbackVarying(GLuint program, GLuint index, GLsizei bufSize, GLsizei *length, GLsizei *size, GLenum *type, GLchar *name);
- void glTransformFeedbackVaryings(GLuint program, GLsizei count, const GLchar* const *varyings, GLenum bufferMode);
- void glBindBufferBase(GLenum target, GLuint index, GLuint buffer);
- void glBindBufferRange(GLenum target, GLuint index, GLuint buffer, GLintptr offset, GLsizeiptr size);
- void glEndTransformFeedback();
- void glBeginTransformFeedback(GLenum primitiveMode);
- GLboolean glIsEnabledi(GLenum target, GLuint index);
- void glDisablei(GLenum target, GLuint index);
- void glEnablei(GLenum target, GLuint index);
- void glGetIntegeri_v(GLenum target, GLuint index, GLint *data);
- void glGetBooleani_v(GLenum target, GLuint index, GLboolean *data);
- void glColorMaski(GLuint index, GLboolean r, GLboolean g, GLboolean b, GLboolean a);
-
- // OpenGL 3.1 core functions
- void glCopyBufferSubData(GLenum readTarget, GLenum writeTarget, GLintptr readOffset, GLintptr writeOffset, GLsizeiptr size);
- void glUniformBlockBinding(GLuint program, GLuint uniformBlockIndex, GLuint uniformBlockBinding);
- void glGetActiveUniformBlockName(GLuint program, GLuint uniformBlockIndex, GLsizei bufSize, GLsizei *length, GLchar *uniformBlockName);
- void glGetActiveUniformBlockiv(GLuint program, GLuint uniformBlockIndex, GLenum pname, GLint *params);
- GLuint glGetUniformBlockIndex(GLuint program, const GLchar *uniformBlockName);
- void glGetActiveUniformName(GLuint program, GLuint uniformIndex, GLsizei bufSize, GLsizei *length, GLchar *uniformName);
- void glGetActiveUniformsiv(GLuint program, GLsizei uniformCount, const GLuint *uniformIndices, GLenum pname, GLint *params);
- void glGetUniformIndices(GLuint program, GLsizei uniformCount, const GLchar* const *uniformNames, GLuint *uniformIndices);
- void glPrimitiveRestartIndex(GLuint index);
- void glTexBuffer(GLenum target, GLenum internalformat, GLuint buffer);
- void glDrawElementsInstanced(GLenum mode, GLsizei count, GLenum type, const GLvoid *indices, GLsizei instancecount);
- void glDrawArraysInstanced(GLenum mode, GLint first, GLsizei count, GLsizei instancecount);
-
- // OpenGL 3.2 core functions
- void glSampleMaski(GLuint index, GLbitfield mask);
- void glGetMultisamplefv(GLenum pname, GLuint index, GLfloat *val);
- void glTexImage3DMultisample(GLenum target, GLsizei samples, GLint internalformat, GLsizei width, GLsizei height, GLsizei depth, GLboolean fixedsamplelocations);
- void glTexImage2DMultisample(GLenum target, GLsizei samples, GLint internalformat, GLsizei width, GLsizei height, GLboolean fixedsamplelocations);
- void glGetSynciv(GLsync sync, GLenum pname, GLsizei bufSize, GLsizei *length, GLint *values);
- void glGetInteger64v(GLenum pname, GLint64 *params);
- void glWaitSync(GLsync sync, GLbitfield flags, GLuint64 timeout);
- GLenum glClientWaitSync(GLsync sync, GLbitfield flags, GLuint64 timeout);
- void glDeleteSync(GLsync sync);
- GLboolean glIsSync(GLsync sync);
- GLsync glFenceSync(GLenum condition, GLbitfield flags);
- void glProvokingVertex(GLenum mode);
- void glMultiDrawElementsBaseVertex(GLenum mode, const GLsizei *count, GLenum type, const GLvoid* const *indices, GLsizei drawcount, const GLint *basevertex);
- void glDrawElementsInstancedBaseVertex(GLenum mode, GLsizei count, GLenum type, const GLvoid *indices, GLsizei instancecount, GLint basevertex);
- void glDrawRangeElementsBaseVertex(GLenum mode, GLuint start, GLuint end, GLsizei count, GLenum type, const GLvoid *indices, GLint basevertex);
- void glDrawElementsBaseVertex(GLenum mode, GLsizei count, GLenum type, const GLvoid *indices, GLint basevertex);
- void glFramebufferTexture(GLenum target, GLenum attachment, GLuint texture, GLint level);
- void glGetBufferParameteri64v(GLenum target, GLenum pname, GLint64 *params);
- void glGetInteger64i_v(GLenum target, GLuint index, GLint64 *data);
-
- // OpenGL 3.3 core functions
- void glVertexAttribP4uiv(GLuint index, GLenum type, GLboolean normalized, const GLuint *value);
- void glVertexAttribP4ui(GLuint index, GLenum type, GLboolean normalized, GLuint value);
- void glVertexAttribP3uiv(GLuint index, GLenum type, GLboolean normalized, const GLuint *value);
- void glVertexAttribP3ui(GLuint index, GLenum type, GLboolean normalized, GLuint value);
- void glVertexAttribP2uiv(GLuint index, GLenum type, GLboolean normalized, const GLuint *value);
- void glVertexAttribP2ui(GLuint index, GLenum type, GLboolean normalized, GLuint value);
- void glVertexAttribP1uiv(GLuint index, GLenum type, GLboolean normalized, const GLuint *value);
- void glVertexAttribP1ui(GLuint index, GLenum type, GLboolean normalized, GLuint value);
- void glSecondaryColorP3uiv(GLenum type, const GLuint *color);
- void glSecondaryColorP3ui(GLenum type, GLuint color);
- void glColorP4uiv(GLenum type, const GLuint *color);
- void glColorP4ui(GLenum type, GLuint color);
- void glColorP3uiv(GLenum type, const GLuint *color);
- void glColorP3ui(GLenum type, GLuint color);
- void glNormalP3uiv(GLenum type, const GLuint *coords);
- void glNormalP3ui(GLenum type, GLuint coords);
- void glMultiTexCoordP4uiv(GLenum texture, GLenum type, const GLuint *coords);
- void glMultiTexCoordP4ui(GLenum texture, GLenum type, GLuint coords);
- void glMultiTexCoordP3uiv(GLenum texture, GLenum type, const GLuint *coords);
- void glMultiTexCoordP3ui(GLenum texture, GLenum type, GLuint coords);
- void glMultiTexCoordP2uiv(GLenum texture, GLenum type, const GLuint *coords);
- void glMultiTexCoordP2ui(GLenum texture, GLenum type, GLuint coords);
- void glMultiTexCoordP1uiv(GLenum texture, GLenum type, const GLuint *coords);
- void glMultiTexCoordP1ui(GLenum texture, GLenum type, GLuint coords);
- void glTexCoordP4uiv(GLenum type, const GLuint *coords);
- void glTexCoordP4ui(GLenum type, GLuint coords);
- void glTexCoordP3uiv(GLenum type, const GLuint *coords);
- void glTexCoordP3ui(GLenum type, GLuint coords);
- void glTexCoordP2uiv(GLenum type, const GLuint *coords);
- void glTexCoordP2ui(GLenum type, GLuint coords);
- void glTexCoordP1uiv(GLenum type, const GLuint *coords);
- void glTexCoordP1ui(GLenum type, GLuint coords);
- void glVertexP4uiv(GLenum type, const GLuint *value);
- void glVertexP4ui(GLenum type, GLuint value);
- void glVertexP3uiv(GLenum type, const GLuint *value);
- void glVertexP3ui(GLenum type, GLuint value);
- void glVertexP2uiv(GLenum type, const GLuint *value);
- void glVertexP2ui(GLenum type, GLuint value);
- void glGetQueryObjectui64v(GLuint id, GLenum pname, GLuint64 *params);
- void glGetQueryObjecti64v(GLuint id, GLenum pname, GLint64 *params);
- void glQueryCounter(GLuint id, GLenum target);
- void glGetSamplerParameterIuiv(GLuint sampler, GLenum pname, GLuint *params);
- void glGetSamplerParameterfv(GLuint sampler, GLenum pname, GLfloat *params);
- void glGetSamplerParameterIiv(GLuint sampler, GLenum pname, GLint *params);
- void glGetSamplerParameteriv(GLuint sampler, GLenum pname, GLint *params);
- void glSamplerParameterIuiv(GLuint sampler, GLenum pname, const GLuint *param);
- void glSamplerParameterIiv(GLuint sampler, GLenum pname, const GLint *param);
- void glSamplerParameterfv(GLuint sampler, GLenum pname, const GLfloat *param);
- void glSamplerParameterf(GLuint sampler, GLenum pname, GLfloat param);
- void glSamplerParameteriv(GLuint sampler, GLenum pname, const GLint *param);
- void glSamplerParameteri(GLuint sampler, GLenum pname, GLint param);
- void glBindSampler(GLuint unit, GLuint sampler);
- GLboolean glIsSampler(GLuint sampler);
- void glDeleteSamplers(GLsizei count, const GLuint *samplers);
- void glGenSamplers(GLsizei count, GLuint *samplers);
- GLint glGetFragDataIndex(GLuint program, const GLchar *name);
- void glBindFragDataLocationIndexed(GLuint program, GLuint colorNumber, GLuint index, const GLchar *name);
- void glVertexAttribDivisor(GLuint index, GLuint divisor);
-
- // OpenGL 4.0 core functions
- void glGetQueryIndexediv(GLenum target, GLuint index, GLenum pname, GLint *params);
- void glEndQueryIndexed(GLenum target, GLuint index);
- void glBeginQueryIndexed(GLenum target, GLuint index, GLuint id);
- void glDrawTransformFeedbackStream(GLenum mode, GLuint id, GLuint stream);
- void glDrawTransformFeedback(GLenum mode, GLuint id);
- void glResumeTransformFeedback();
- void glPauseTransformFeedback();
- GLboolean glIsTransformFeedback(GLuint id);
- void glGenTransformFeedbacks(GLsizei n, GLuint *ids);
- void glDeleteTransformFeedbacks(GLsizei n, const GLuint *ids);
- void glBindTransformFeedback(GLenum target, GLuint id);
- void glPatchParameterfv(GLenum pname, const GLfloat *values);
- void glPatchParameteri(GLenum pname, GLint value);
- void glGetProgramStageiv(GLuint program, GLenum shadertype, GLenum pname, GLint *values);
- void glGetUniformSubroutineuiv(GLenum shadertype, GLint location, GLuint *params);
- void glUniformSubroutinesuiv(GLenum shadertype, GLsizei count, const GLuint *indices);
- void glGetActiveSubroutineName(GLuint program, GLenum shadertype, GLuint index, GLsizei bufsize, GLsizei *length, GLchar *name);
- void glGetActiveSubroutineUniformName(GLuint program, GLenum shadertype, GLuint index, GLsizei bufsize, GLsizei *length, GLchar *name);
- void glGetActiveSubroutineUniformiv(GLuint program, GLenum shadertype, GLuint index, GLenum pname, GLint *values);
- GLuint glGetSubroutineIndex(GLuint program, GLenum shadertype, const GLchar *name);
- GLint glGetSubroutineUniformLocation(GLuint program, GLenum shadertype, const GLchar *name);
- void glGetUniformdv(GLuint program, GLint location, GLdouble *params);
- void glUniformMatrix4x3dv(GLint location, GLsizei count, GLboolean transpose, const GLdouble *value);
- void glUniformMatrix4x2dv(GLint location, GLsizei count, GLboolean transpose, const GLdouble *value);
- void glUniformMatrix3x4dv(GLint location, GLsizei count, GLboolean transpose, const GLdouble *value);
- void glUniformMatrix3x2dv(GLint location, GLsizei count, GLboolean transpose, const GLdouble *value);
- void glUniformMatrix2x4dv(GLint location, GLsizei count, GLboolean transpose, const GLdouble *value);
- void glUniformMatrix2x3dv(GLint location, GLsizei count, GLboolean transpose, const GLdouble *value);
- void glUniformMatrix4dv(GLint location, GLsizei count, GLboolean transpose, const GLdouble *value);
- void glUniformMatrix3dv(GLint location, GLsizei count, GLboolean transpose, const GLdouble *value);
- void glUniformMatrix2dv(GLint location, GLsizei count, GLboolean transpose, const GLdouble *value);
- void glUniform4dv(GLint location, GLsizei count, const GLdouble *value);
- void glUniform3dv(GLint location, GLsizei count, const GLdouble *value);
- void glUniform2dv(GLint location, GLsizei count, const GLdouble *value);
- void glUniform1dv(GLint location, GLsizei count, const GLdouble *value);
- void glUniform4d(GLint location, GLdouble x, GLdouble y, GLdouble z, GLdouble w);
- void glUniform3d(GLint location, GLdouble x, GLdouble y, GLdouble z);
- void glUniform2d(GLint location, GLdouble x, GLdouble y);
- void glUniform1d(GLint location, GLdouble x);
- void glDrawElementsIndirect(GLenum mode, GLenum type, const GLvoid *indirect);
- void glDrawArraysIndirect(GLenum mode, const GLvoid *indirect);
- void glBlendFuncSeparatei(GLuint buf, GLenum srcRGB, GLenum dstRGB, GLenum srcAlpha, GLenum dstAlpha);
- void glBlendFunci(GLuint buf, GLenum src, GLenum dst);
- void glBlendEquationSeparatei(GLuint buf, GLenum modeRGB, GLenum modeAlpha);
- void glBlendEquationi(GLuint buf, GLenum mode);
- void glMinSampleShading(GLfloat value);
-
- // OpenGL 1.0 deprecated functions
- void glTranslatef(GLfloat x, GLfloat y, GLfloat z);
- void glTranslated(GLdouble x, GLdouble y, GLdouble z);
- void glScalef(GLfloat x, GLfloat y, GLfloat z);
- void glScaled(GLdouble x, GLdouble y, GLdouble z);
- void glRotatef(GLfloat angle, GLfloat x, GLfloat y, GLfloat z);
- void glRotated(GLdouble angle, GLdouble x, GLdouble y, GLdouble z);
- void glPushMatrix();
- void glPopMatrix();
- void glOrtho(GLdouble left, GLdouble right, GLdouble bottom, GLdouble top, GLdouble zNear, GLdouble zFar);
- void glMultMatrixd(const GLdouble *m);
- void glMultMatrixf(const GLfloat *m);
- void glMatrixMode(GLenum mode);
- void glLoadMatrixd(const GLdouble *m);
- void glLoadMatrixf(const GLfloat *m);
- void glLoadIdentity();
- void glFrustum(GLdouble left, GLdouble right, GLdouble bottom, GLdouble top, GLdouble zNear, GLdouble zFar);
- GLboolean glIsList(GLuint list);
- void glGetTexGeniv(GLenum coord, GLenum pname, GLint *params);
- void glGetTexGenfv(GLenum coord, GLenum pname, GLfloat *params);
- void glGetTexGendv(GLenum coord, GLenum pname, GLdouble *params);
- void glGetTexEnviv(GLenum target, GLenum pname, GLint *params);
- void glGetTexEnvfv(GLenum target, GLenum pname, GLfloat *params);
- void glGetPolygonStipple(GLubyte *mask);
- void glGetPixelMapusv(GLenum map, GLushort *values);
- void glGetPixelMapuiv(GLenum map, GLuint *values);
- void glGetPixelMapfv(GLenum map, GLfloat *values);
- void glGetMaterialiv(GLenum face, GLenum pname, GLint *params);
- void glGetMaterialfv(GLenum face, GLenum pname, GLfloat *params);
- void glGetMapiv(GLenum target, GLenum query, GLint *v);
- void glGetMapfv(GLenum target, GLenum query, GLfloat *v);
- void glGetMapdv(GLenum target, GLenum query, GLdouble *v);
- void glGetLightiv(GLenum light, GLenum pname, GLint *params);
- void glGetLightfv(GLenum light, GLenum pname, GLfloat *params);
- void glGetClipPlane(GLenum plane, GLdouble *equation);
- void glDrawPixels(GLsizei width, GLsizei height, GLenum format, GLenum type, const GLvoid *pixels);
- void glCopyPixels(GLint x, GLint y, GLsizei width, GLsizei height, GLenum type);
- void glPixelMapusv(GLenum map, GLint mapsize, const GLushort *values);
- void glPixelMapuiv(GLenum map, GLint mapsize, const GLuint *values);
- void glPixelMapfv(GLenum map, GLint mapsize, const GLfloat *values);
- void glPixelTransferi(GLenum pname, GLint param);
- void glPixelTransferf(GLenum pname, GLfloat param);
- void glPixelZoom(GLfloat xfactor, GLfloat yfactor);
- void glAlphaFunc(GLenum func, GLfloat ref);
- void glEvalPoint2(GLint i, GLint j);
- void glEvalMesh2(GLenum mode, GLint i1, GLint i2, GLint j1, GLint j2);
- void glEvalPoint1(GLint i);
- void glEvalMesh1(GLenum mode, GLint i1, GLint i2);
- void glEvalCoord2fv(const GLfloat *u);
- void glEvalCoord2f(GLfloat u, GLfloat v);
- void glEvalCoord2dv(const GLdouble *u);
- void glEvalCoord2d(GLdouble u, GLdouble v);
- void glEvalCoord1fv(const GLfloat *u);
- void glEvalCoord1f(GLfloat u);
- void glEvalCoord1dv(const GLdouble *u);
- void glEvalCoord1d(GLdouble u);
- void glMapGrid2f(GLint un, GLfloat u1, GLfloat u2, GLint vn, GLfloat v1, GLfloat v2);
- void glMapGrid2d(GLint un, GLdouble u1, GLdouble u2, GLint vn, GLdouble v1, GLdouble v2);
- void glMapGrid1f(GLint un, GLfloat u1, GLfloat u2);
- void glMapGrid1d(GLint un, GLdouble u1, GLdouble u2);
- void glMap2f(GLenum target, GLfloat u1, GLfloat u2, GLint ustride, GLint uorder, GLfloat v1, GLfloat v2, GLint vstride, GLint vorder, const GLfloat *points);
- void glMap2d(GLenum target, GLdouble u1, GLdouble u2, GLint ustride, GLint uorder, GLdouble v1, GLdouble v2, GLint vstride, GLint vorder, const GLdouble *points);
- void glMap1f(GLenum target, GLfloat u1, GLfloat u2, GLint stride, GLint order, const GLfloat *points);
- void glMap1d(GLenum target, GLdouble u1, GLdouble u2, GLint stride, GLint order, const GLdouble *points);
- void glPushAttrib(GLbitfield mask);
- void glPopAttrib();
- void glAccum(GLenum op, GLfloat value);
- void glIndexMask(GLuint mask);
- void glClearIndex(GLfloat c);
- void glClearAccum(GLfloat red, GLfloat green, GLfloat blue, GLfloat alpha);
- void glPushName(GLuint name);
- void glPopName();
- void glPassThrough(GLfloat token);
- void glLoadName(GLuint name);
- void glInitNames();
- GLint glRenderMode(GLenum mode);
- void glSelectBuffer(GLsizei size, GLuint *buffer);
- void glFeedbackBuffer(GLsizei size, GLenum type, GLfloat *buffer);
- void glTexGeniv(GLenum coord, GLenum pname, const GLint *params);
- void glTexGeni(GLenum coord, GLenum pname, GLint param);
- void glTexGenfv(GLenum coord, GLenum pname, const GLfloat *params);
- void glTexGenf(GLenum coord, GLenum pname, GLfloat param);
- void glTexGendv(GLenum coord, GLenum pname, const GLdouble *params);
- void glTexGend(GLenum coord, GLenum pname, GLdouble param);
- void glTexEnviv(GLenum target, GLenum pname, const GLint *params);
- void glTexEnvi(GLenum target, GLenum pname, GLint param);
- void glTexEnvfv(GLenum target, GLenum pname, const GLfloat *params);
- void glTexEnvf(GLenum target, GLenum pname, GLfloat param);
- void glShadeModel(GLenum mode);
- void glPolygonStipple(const GLubyte *mask);
- void glMaterialiv(GLenum face, GLenum pname, const GLint *params);
- void glMateriali(GLenum face, GLenum pname, GLint param);
- void glMaterialfv(GLenum face, GLenum pname, const GLfloat *params);
- void glMaterialf(GLenum face, GLenum pname, GLfloat param);
- void glLineStipple(GLint factor, GLushort pattern);
- void glLightModeliv(GLenum pname, const GLint *params);
- void glLightModeli(GLenum pname, GLint param);
- void glLightModelfv(GLenum pname, const GLfloat *params);
- void glLightModelf(GLenum pname, GLfloat param);
- void glLightiv(GLenum light, GLenum pname, const GLint *params);
- void glLighti(GLenum light, GLenum pname, GLint param);
- void glLightfv(GLenum light, GLenum pname, const GLfloat *params);
- void glLightf(GLenum light, GLenum pname, GLfloat param);
- void glFogiv(GLenum pname, const GLint *params);
- void glFogi(GLenum pname, GLint param);
- void glFogfv(GLenum pname, const GLfloat *params);
- void glFogf(GLenum pname, GLfloat param);
- void glColorMaterial(GLenum face, GLenum mode);
- void glClipPlane(GLenum plane, const GLdouble *equation);
- void glVertex4sv(const GLshort *v);
- void glVertex4s(GLshort x, GLshort y, GLshort z, GLshort w);
- void glVertex4iv(const GLint *v);
- void glVertex4i(GLint x, GLint y, GLint z, GLint w);
- void glVertex4fv(const GLfloat *v);
- void glVertex4f(GLfloat x, GLfloat y, GLfloat z, GLfloat w);
- void glVertex4dv(const GLdouble *v);
- void glVertex4d(GLdouble x, GLdouble y, GLdouble z, GLdouble w);
- void glVertex3sv(const GLshort *v);
- void glVertex3s(GLshort x, GLshort y, GLshort z);
- void glVertex3iv(const GLint *v);
- void glVertex3i(GLint x, GLint y, GLint z);
- void glVertex3fv(const GLfloat *v);
- void glVertex3f(GLfloat x, GLfloat y, GLfloat z);
- void glVertex3dv(const GLdouble *v);
- void glVertex3d(GLdouble x, GLdouble y, GLdouble z);
- void glVertex2sv(const GLshort *v);
- void glVertex2s(GLshort x, GLshort y);
- void glVertex2iv(const GLint *v);
- void glVertex2i(GLint x, GLint y);
- void glVertex2fv(const GLfloat *v);
- void glVertex2f(GLfloat x, GLfloat y);
- void glVertex2dv(const GLdouble *v);
- void glVertex2d(GLdouble x, GLdouble y);
- void glTexCoord4sv(const GLshort *v);
- void glTexCoord4s(GLshort s, GLshort t, GLshort r, GLshort q);
- void glTexCoord4iv(const GLint *v);
- void glTexCoord4i(GLint s, GLint t, GLint r, GLint q);
- void glTexCoord4fv(const GLfloat *v);
- void glTexCoord4f(GLfloat s, GLfloat t, GLfloat r, GLfloat q);
- void glTexCoord4dv(const GLdouble *v);
- void glTexCoord4d(GLdouble s, GLdouble t, GLdouble r, GLdouble q);
- void glTexCoord3sv(const GLshort *v);
- void glTexCoord3s(GLshort s, GLshort t, GLshort r);
- void glTexCoord3iv(const GLint *v);
- void glTexCoord3i(GLint s, GLint t, GLint r);
- void glTexCoord3fv(const GLfloat *v);
- void glTexCoord3f(GLfloat s, GLfloat t, GLfloat r);
- void glTexCoord3dv(const GLdouble *v);
- void glTexCoord3d(GLdouble s, GLdouble t, GLdouble r);
- void glTexCoord2sv(const GLshort *v);
- void glTexCoord2s(GLshort s, GLshort t);
- void glTexCoord2iv(const GLint *v);
- void glTexCoord2i(GLint s, GLint t);
- void glTexCoord2fv(const GLfloat *v);
- void glTexCoord2f(GLfloat s, GLfloat t);
- void glTexCoord2dv(const GLdouble *v);
- void glTexCoord2d(GLdouble s, GLdouble t);
- void glTexCoord1sv(const GLshort *v);
- void glTexCoord1s(GLshort s);
- void glTexCoord1iv(const GLint *v);
- void glTexCoord1i(GLint s);
- void glTexCoord1fv(const GLfloat *v);
- void glTexCoord1f(GLfloat s);
- void glTexCoord1dv(const GLdouble *v);
- void glTexCoord1d(GLdouble s);
- void glRectsv(const GLshort *v1, const GLshort *v2);
- void glRects(GLshort x1, GLshort y1, GLshort x2, GLshort y2);
- void glRectiv(const GLint *v1, const GLint *v2);
- void glRecti(GLint x1, GLint y1, GLint x2, GLint y2);
- void glRectfv(const GLfloat *v1, const GLfloat *v2);
- void glRectf(GLfloat x1, GLfloat y1, GLfloat x2, GLfloat y2);
- void glRectdv(const GLdouble *v1, const GLdouble *v2);
- void glRectd(GLdouble x1, GLdouble y1, GLdouble x2, GLdouble y2);
- void glRasterPos4sv(const GLshort *v);
- void glRasterPos4s(GLshort x, GLshort y, GLshort z, GLshort w);
- void glRasterPos4iv(const GLint *v);
- void glRasterPos4i(GLint x, GLint y, GLint z, GLint w);
- void glRasterPos4fv(const GLfloat *v);
- void glRasterPos4f(GLfloat x, GLfloat y, GLfloat z, GLfloat w);
- void glRasterPos4dv(const GLdouble *v);
- void glRasterPos4d(GLdouble x, GLdouble y, GLdouble z, GLdouble w);
- void glRasterPos3sv(const GLshort *v);
- void glRasterPos3s(GLshort x, GLshort y, GLshort z);
- void glRasterPos3iv(const GLint *v);
- void glRasterPos3i(GLint x, GLint y, GLint z);
- void glRasterPos3fv(const GLfloat *v);
- void glRasterPos3f(GLfloat x, GLfloat y, GLfloat z);
- void glRasterPos3dv(const GLdouble *v);
- void glRasterPos3d(GLdouble x, GLdouble y, GLdouble z);
- void glRasterPos2sv(const GLshort *v);
- void glRasterPos2s(GLshort x, GLshort y);
- void glRasterPos2iv(const GLint *v);
- void glRasterPos2i(GLint x, GLint y);
- void glRasterPos2fv(const GLfloat *v);
- void glRasterPos2f(GLfloat x, GLfloat y);
- void glRasterPos2dv(const GLdouble *v);
- void glRasterPos2d(GLdouble x, GLdouble y);
- void glNormal3sv(const GLshort *v);
- void glNormal3s(GLshort nx, GLshort ny, GLshort nz);
- void glNormal3iv(const GLint *v);
- void glNormal3i(GLint nx, GLint ny, GLint nz);
- void glNormal3fv(const GLfloat *v);
- void glNormal3f(GLfloat nx, GLfloat ny, GLfloat nz);
- void glNormal3dv(const GLdouble *v);
- void glNormal3d(GLdouble nx, GLdouble ny, GLdouble nz);
- void glNormal3bv(const GLbyte *v);
- void glNormal3b(GLbyte nx, GLbyte ny, GLbyte nz);
- void glIndexsv(const GLshort *c);
- void glIndexs(GLshort c);
- void glIndexiv(const GLint *c);
- void glIndexi(GLint c);
- void glIndexfv(const GLfloat *c);
- void glIndexf(GLfloat c);
- void glIndexdv(const GLdouble *c);
- void glIndexd(GLdouble c);
- void glEnd();
- void glEdgeFlagv(const GLboolean *flag);
- void glEdgeFlag(GLboolean flag);
- void glColor4usv(const GLushort *v);
- void glColor4us(GLushort red, GLushort green, GLushort blue, GLushort alpha);
- void glColor4uiv(const GLuint *v);
- void glColor4ui(GLuint red, GLuint green, GLuint blue, GLuint alpha);
- void glColor4ubv(const GLubyte *v);
- void glColor4ub(GLubyte red, GLubyte green, GLubyte blue, GLubyte alpha);
- void glColor4sv(const GLshort *v);
- void glColor4s(GLshort red, GLshort green, GLshort blue, GLshort alpha);
- void glColor4iv(const GLint *v);
- void glColor4i(GLint red, GLint green, GLint blue, GLint alpha);
- void glColor4fv(const GLfloat *v);
- void glColor4f(GLfloat red, GLfloat green, GLfloat blue, GLfloat alpha);
- void glColor4dv(const GLdouble *v);
- void glColor4d(GLdouble red, GLdouble green, GLdouble blue, GLdouble alpha);
- void glColor4bv(const GLbyte *v);
- void glColor4b(GLbyte red, GLbyte green, GLbyte blue, GLbyte alpha);
- void glColor3usv(const GLushort *v);
- void glColor3us(GLushort red, GLushort green, GLushort blue);
- void glColor3uiv(const GLuint *v);
- void glColor3ui(GLuint red, GLuint green, GLuint blue);
- void glColor3ubv(const GLubyte *v);
- void glColor3ub(GLubyte red, GLubyte green, GLubyte blue);
- void glColor3sv(const GLshort *v);
- void glColor3s(GLshort red, GLshort green, GLshort blue);
- void glColor3iv(const GLint *v);
- void glColor3i(GLint red, GLint green, GLint blue);
- void glColor3fv(const GLfloat *v);
- void glColor3f(GLfloat red, GLfloat green, GLfloat blue);
- void glColor3dv(const GLdouble *v);
- void glColor3d(GLdouble red, GLdouble green, GLdouble blue);
- void glColor3bv(const GLbyte *v);
- void glColor3b(GLbyte red, GLbyte green, GLbyte blue);
- void glBitmap(GLsizei width, GLsizei height, GLfloat xorig, GLfloat yorig, GLfloat xmove, GLfloat ymove, const GLubyte *bitmap);
- void glBegin(GLenum mode);
- void glListBase(GLuint base);
- GLuint glGenLists(GLsizei range);
- void glDeleteLists(GLuint list, GLsizei range);
- void glCallLists(GLsizei n, GLenum type, const GLvoid *lists);
- void glCallList(GLuint list);
- void glEndList();
- void glNewList(GLuint list, GLenum mode);
-
- // OpenGL 1.1 deprecated functions
- void glPushClientAttrib(GLbitfield mask);
- void glPopClientAttrib();
- void glPrioritizeTextures(GLsizei n, const GLuint *textures, const GLfloat *priorities);
- GLboolean glAreTexturesResident(GLsizei n, const GLuint *textures, GLboolean *residences);
- void glVertexPointer(GLint size, GLenum type, GLsizei stride, const GLvoid *pointer);
- void glTexCoordPointer(GLint size, GLenum type, GLsizei stride, const GLvoid *pointer);
- void glNormalPointer(GLenum type, GLsizei stride, const GLvoid *pointer);
- void glInterleavedArrays(GLenum format, GLsizei stride, const GLvoid *pointer);
- void glIndexPointer(GLenum type, GLsizei stride, const GLvoid *pointer);
- void glEnableClientState(GLenum array);
- void glEdgeFlagPointer(GLsizei stride, const GLvoid *pointer);
- void glDisableClientState(GLenum array);
- void glColorPointer(GLint size, GLenum type, GLsizei stride, const GLvoid *pointer);
- void glArrayElement(GLint i);
-
- // OpenGL 1.2 deprecated functions
- void glResetMinmax(GLenum target);
- void glResetHistogram(GLenum target);
- void glMinmax(GLenum target, GLenum internalformat, GLboolean sink);
- void glHistogram(GLenum target, GLsizei width, GLenum internalformat, GLboolean sink);
- void glGetMinmaxParameteriv(GLenum target, GLenum pname, GLint *params);
- void glGetMinmaxParameterfv(GLenum target, GLenum pname, GLfloat *params);
- void glGetMinmax(GLenum target, GLboolean reset, GLenum format, GLenum type, GLvoid *values);
- void glGetHistogramParameteriv(GLenum target, GLenum pname, GLint *params);
- void glGetHistogramParameterfv(GLenum target, GLenum pname, GLfloat *params);
- void glGetHistogram(GLenum target, GLboolean reset, GLenum format, GLenum type, GLvoid *values);
- void glSeparableFilter2D(GLenum target, GLenum internalformat, GLsizei width, GLsizei height, GLenum format, GLenum type, const GLvoid *row, const GLvoid *column);
- void glGetSeparableFilter(GLenum target, GLenum format, GLenum type, GLvoid *row, GLvoid *column, GLvoid *span);
- void glGetConvolutionParameteriv(GLenum target, GLenum pname, GLint *params);
- void glGetConvolutionParameterfv(GLenum target, GLenum pname, GLfloat *params);
- void glGetConvolutionFilter(GLenum target, GLenum format, GLenum type, GLvoid *image);
- void glCopyConvolutionFilter2D(GLenum target, GLenum internalformat, GLint x, GLint y, GLsizei width, GLsizei height);
- void glCopyConvolutionFilter1D(GLenum target, GLenum internalformat, GLint x, GLint y, GLsizei width);
- void glConvolutionParameteriv(GLenum target, GLenum pname, const GLint *params);
- void glConvolutionParameteri(GLenum target, GLenum pname, GLint params);
- void glConvolutionParameterfv(GLenum target, GLenum pname, const GLfloat *params);
- void glConvolutionParameterf(GLenum target, GLenum pname, GLfloat params);
- void glConvolutionFilter2D(GLenum target, GLenum internalformat, GLsizei width, GLsizei height, GLenum format, GLenum type, const GLvoid *image);
- void glConvolutionFilter1D(GLenum target, GLenum internalformat, GLsizei width, GLenum format, GLenum type, const GLvoid *image);
- void glCopyColorSubTable(GLenum target, GLsizei start, GLint x, GLint y, GLsizei width);
- void glColorSubTable(GLenum target, GLsizei start, GLsizei count, GLenum format, GLenum type, const GLvoid *data);
- void glGetColorTableParameteriv(GLenum target, GLenum pname, GLint *params);
- void glGetColorTableParameterfv(GLenum target, GLenum pname, GLfloat *params);
- void glGetColorTable(GLenum target, GLenum format, GLenum type, GLvoid *table);
- void glCopyColorTable(GLenum target, GLenum internalformat, GLint x, GLint y, GLsizei width);
- void glColorTableParameteriv(GLenum target, GLenum pname, const GLint *params);
- void glColorTableParameterfv(GLenum target, GLenum pname, const GLfloat *params);
- void glColorTable(GLenum target, GLenum internalformat, GLsizei width, GLenum format, GLenum type, const GLvoid *table);
-
- // OpenGL 1.3 deprecated functions
- void glMultTransposeMatrixd(const GLdouble *m);
- void glMultTransposeMatrixf(const GLfloat *m);
- void glLoadTransposeMatrixd(const GLdouble *m);
- void glLoadTransposeMatrixf(const GLfloat *m);
- void glMultiTexCoord4sv(GLenum target, const GLshort *v);
- void glMultiTexCoord4s(GLenum target, GLshort s, GLshort t, GLshort r, GLshort q);
- void glMultiTexCoord4iv(GLenum target, const GLint *v);
- void glMultiTexCoord4i(GLenum target, GLint s, GLint t, GLint r, GLint q);
- void glMultiTexCoord4fv(GLenum target, const GLfloat *v);
- void glMultiTexCoord4f(GLenum target, GLfloat s, GLfloat t, GLfloat r, GLfloat q);
- void glMultiTexCoord4dv(GLenum target, const GLdouble *v);
- void glMultiTexCoord4d(GLenum target, GLdouble s, GLdouble t, GLdouble r, GLdouble q);
- void glMultiTexCoord3sv(GLenum target, const GLshort *v);
- void glMultiTexCoord3s(GLenum target, GLshort s, GLshort t, GLshort r);
- void glMultiTexCoord3iv(GLenum target, const GLint *v);
- void glMultiTexCoord3i(GLenum target, GLint s, GLint t, GLint r);
- void glMultiTexCoord3fv(GLenum target, const GLfloat *v);
- void glMultiTexCoord3f(GLenum target, GLfloat s, GLfloat t, GLfloat r);
- void glMultiTexCoord3dv(GLenum target, const GLdouble *v);
- void glMultiTexCoord3d(GLenum target, GLdouble s, GLdouble t, GLdouble r);
- void glMultiTexCoord2sv(GLenum target, const GLshort *v);
- void glMultiTexCoord2s(GLenum target, GLshort s, GLshort t);
- void glMultiTexCoord2iv(GLenum target, const GLint *v);
- void glMultiTexCoord2i(GLenum target, GLint s, GLint t);
- void glMultiTexCoord2fv(GLenum target, const GLfloat *v);
- void glMultiTexCoord2f(GLenum target, GLfloat s, GLfloat t);
- void glMultiTexCoord2dv(GLenum target, const GLdouble *v);
- void glMultiTexCoord2d(GLenum target, GLdouble s, GLdouble t);
- void glMultiTexCoord1sv(GLenum target, const GLshort *v);
- void glMultiTexCoord1s(GLenum target, GLshort s);
- void glMultiTexCoord1iv(GLenum target, const GLint *v);
- void glMultiTexCoord1i(GLenum target, GLint s);
- void glMultiTexCoord1fv(GLenum target, const GLfloat *v);
- void glMultiTexCoord1f(GLenum target, GLfloat s);
- void glMultiTexCoord1dv(GLenum target, const GLdouble *v);
- void glMultiTexCoord1d(GLenum target, GLdouble s);
- void glClientActiveTexture(GLenum texture);
-
- // OpenGL 1.4 deprecated functions
- void glWindowPos3sv(const GLshort *v);
- void glWindowPos3s(GLshort x, GLshort y, GLshort z);
- void glWindowPos3iv(const GLint *v);
- void glWindowPos3i(GLint x, GLint y, GLint z);
- void glWindowPos3fv(const GLfloat *v);
- void glWindowPos3f(GLfloat x, GLfloat y, GLfloat z);
- void glWindowPos3dv(const GLdouble *v);
- void glWindowPos3d(GLdouble x, GLdouble y, GLdouble z);
- void glWindowPos2sv(const GLshort *v);
- void glWindowPos2s(GLshort x, GLshort y);
- void glWindowPos2iv(const GLint *v);
- void glWindowPos2i(GLint x, GLint y);
- void glWindowPos2fv(const GLfloat *v);
- void glWindowPos2f(GLfloat x, GLfloat y);
- void glWindowPos2dv(const GLdouble *v);
- void glWindowPos2d(GLdouble x, GLdouble y);
- void glSecondaryColorPointer(GLint size, GLenum type, GLsizei stride, const GLvoid *pointer);
- void glSecondaryColor3usv(const GLushort *v);
- void glSecondaryColor3us(GLushort red, GLushort green, GLushort blue);
- void glSecondaryColor3uiv(const GLuint *v);
- void glSecondaryColor3ui(GLuint red, GLuint green, GLuint blue);
- void glSecondaryColor3ubv(const GLubyte *v);
- void glSecondaryColor3ub(GLubyte red, GLubyte green, GLubyte blue);
- void glSecondaryColor3sv(const GLshort *v);
- void glSecondaryColor3s(GLshort red, GLshort green, GLshort blue);
- void glSecondaryColor3iv(const GLint *v);
- void glSecondaryColor3i(GLint red, GLint green, GLint blue);
- void glSecondaryColor3fv(const GLfloat *v);
- void glSecondaryColor3f(GLfloat red, GLfloat green, GLfloat blue);
- void glSecondaryColor3dv(const GLdouble *v);
- void glSecondaryColor3d(GLdouble red, GLdouble green, GLdouble blue);
- void glSecondaryColor3bv(const GLbyte *v);
- void glSecondaryColor3b(GLbyte red, GLbyte green, GLbyte blue);
- void glFogCoordPointer(GLenum type, GLsizei stride, const GLvoid *pointer);
- void glFogCoorddv(const GLdouble *coord);
- void glFogCoordd(GLdouble coord);
- void glFogCoordfv(const GLfloat *coord);
- void glFogCoordf(GLfloat coord);
-
- // OpenGL 1.5 deprecated functions
-
- // OpenGL 2.0 deprecated functions
- void glVertexAttrib4usv(GLuint index, const GLushort *v);
- void glVertexAttrib4uiv(GLuint index, const GLuint *v);
- void glVertexAttrib4ubv(GLuint index, const GLubyte *v);
- void glVertexAttrib4sv(GLuint index, const GLshort *v);
- void glVertexAttrib4s(GLuint index, GLshort x, GLshort y, GLshort z, GLshort w);
- void glVertexAttrib4iv(GLuint index, const GLint *v);
- void glVertexAttrib4fv(GLuint index, const GLfloat *v);
- void glVertexAttrib4f(GLuint index, GLfloat x, GLfloat y, GLfloat z, GLfloat w);
- void glVertexAttrib4dv(GLuint index, const GLdouble *v);
- void glVertexAttrib4d(GLuint index, GLdouble x, GLdouble y, GLdouble z, GLdouble w);
- void glVertexAttrib4bv(GLuint index, const GLbyte *v);
- void glVertexAttrib4Nusv(GLuint index, const GLushort *v);
- void glVertexAttrib4Nuiv(GLuint index, const GLuint *v);
- void glVertexAttrib4Nubv(GLuint index, const GLubyte *v);
- void glVertexAttrib4Nub(GLuint index, GLubyte x, GLubyte y, GLubyte z, GLubyte w);
- void glVertexAttrib4Nsv(GLuint index, const GLshort *v);
- void glVertexAttrib4Niv(GLuint index, const GLint *v);
- void glVertexAttrib4Nbv(GLuint index, const GLbyte *v);
- void glVertexAttrib3sv(GLuint index, const GLshort *v);
- void glVertexAttrib3s(GLuint index, GLshort x, GLshort y, GLshort z);
- void glVertexAttrib3fv(GLuint index, const GLfloat *v);
- void glVertexAttrib3f(GLuint index, GLfloat x, GLfloat y, GLfloat z);
- void glVertexAttrib3dv(GLuint index, const GLdouble *v);
- void glVertexAttrib3d(GLuint index, GLdouble x, GLdouble y, GLdouble z);
- void glVertexAttrib2sv(GLuint index, const GLshort *v);
- void glVertexAttrib2s(GLuint index, GLshort x, GLshort y);
- void glVertexAttrib2fv(GLuint index, const GLfloat *v);
- void glVertexAttrib2f(GLuint index, GLfloat x, GLfloat y);
- void glVertexAttrib2dv(GLuint index, const GLdouble *v);
- void glVertexAttrib2d(GLuint index, GLdouble x, GLdouble y);
- void glVertexAttrib1sv(GLuint index, const GLshort *v);
- void glVertexAttrib1s(GLuint index, GLshort x);
- void glVertexAttrib1fv(GLuint index, const GLfloat *v);
- void glVertexAttrib1f(GLuint index, GLfloat x);
- void glVertexAttrib1dv(GLuint index, const GLdouble *v);
- void glVertexAttrib1d(GLuint index, GLdouble x);
-
- // OpenGL 2.1 deprecated functions
-
- // OpenGL 3.0 deprecated functions
- void glVertexAttribI4usv(GLuint index, const GLushort *v);
- void glVertexAttribI4ubv(GLuint index, const GLubyte *v);
- void glVertexAttribI4sv(GLuint index, const GLshort *v);
- void glVertexAttribI4bv(GLuint index, const GLbyte *v);
- void glVertexAttribI4uiv(GLuint index, const GLuint *v);
- void glVertexAttribI3uiv(GLuint index, const GLuint *v);
- void glVertexAttribI2uiv(GLuint index, const GLuint *v);
- void glVertexAttribI1uiv(GLuint index, const GLuint *v);
- void glVertexAttribI4iv(GLuint index, const GLint *v);
- void glVertexAttribI3iv(GLuint index, const GLint *v);
- void glVertexAttribI2iv(GLuint index, const GLint *v);
- void glVertexAttribI1iv(GLuint index, const GLint *v);
- void glVertexAttribI4ui(GLuint index, GLuint x, GLuint y, GLuint z, GLuint w);
- void glVertexAttribI3ui(GLuint index, GLuint x, GLuint y, GLuint z);
- void glVertexAttribI2ui(GLuint index, GLuint x, GLuint y);
- void glVertexAttribI1ui(GLuint index, GLuint x);
- void glVertexAttribI4i(GLuint index, GLint x, GLint y, GLint z, GLint w);
- void glVertexAttribI3i(GLuint index, GLint x, GLint y, GLint z);
- void glVertexAttribI2i(GLuint index, GLint x, GLint y);
- void glVertexAttribI1i(GLuint index, GLint x);
-
- // OpenGL 3.1 deprecated functions
-
- // OpenGL 3.2 deprecated functions
-
- // OpenGL 3.3 deprecated functions
-
- // OpenGL 4.0 deprecated functions
-
-private:
- friend class QOpenGLContext;
-
- static bool isContextCompatible(QOpenGLContext *context);
- static QOpenGLVersionProfile versionProfile();
-
- QOpenGLFunctions_1_0_CoreBackend* d_1_0_Core;
- QOpenGLFunctions_1_1_CoreBackend* d_1_1_Core;
- QOpenGLFunctions_1_2_CoreBackend* d_1_2_Core;
- QOpenGLFunctions_1_3_CoreBackend* d_1_3_Core;
- QOpenGLFunctions_1_4_CoreBackend* d_1_4_Core;
- QOpenGLFunctions_1_5_CoreBackend* d_1_5_Core;
- QOpenGLFunctions_2_0_CoreBackend* d_2_0_Core;
- QOpenGLFunctions_2_1_CoreBackend* d_2_1_Core;
- QOpenGLFunctions_3_0_CoreBackend* d_3_0_Core;
- QOpenGLFunctions_3_1_CoreBackend* d_3_1_Core;
- QOpenGLFunctions_3_2_CoreBackend* d_3_2_Core;
- QOpenGLFunctions_3_3_CoreBackend* d_3_3_Core;
- QOpenGLFunctions_4_0_CoreBackend* d_4_0_Core;
- QOpenGLFunctions_1_0_DeprecatedBackend* d_1_0_Deprecated;
- QOpenGLFunctions_1_1_DeprecatedBackend* d_1_1_Deprecated;
- QOpenGLFunctions_1_2_DeprecatedBackend* d_1_2_Deprecated;
- QOpenGLFunctions_1_3_DeprecatedBackend* d_1_3_Deprecated;
- QOpenGLFunctions_1_4_DeprecatedBackend* d_1_4_Deprecated;
- void *m_reserved_2_0_Deprecated; // To maintain BC
- QOpenGLFunctions_3_3_DeprecatedBackend* d_3_3_Deprecated;
-};
-
-// OpenGL 1.0 core functions
-inline void QOpenGLFunctions_4_0_Compatibility::glViewport(GLint x, GLint y, GLsizei width, GLsizei height)
-{
- d_1_0_Core->f.Viewport(x, y, width, height);
-}
-
-inline void QOpenGLFunctions_4_0_Compatibility::glDepthRange(GLdouble nearVal, GLdouble farVal)
-{
- d_1_0_Core->f.DepthRange(nearVal, farVal);
-}
-
-inline GLboolean QOpenGLFunctions_4_0_Compatibility::glIsEnabled(GLenum cap)
-{
- return d_1_0_Core->f.IsEnabled(cap);
-}
-
-inline void QOpenGLFunctions_4_0_Compatibility::glGetTexLevelParameteriv(GLenum target, GLint level, GLenum pname, GLint *params)
-{
- d_1_0_Core->f.GetTexLevelParameteriv(target, level, pname, params);
-}
-
-inline void QOpenGLFunctions_4_0_Compatibility::glGetTexLevelParameterfv(GLenum target, GLint level, GLenum pname, GLfloat *params)
-{
- d_1_0_Core->f.GetTexLevelParameterfv(target, level, pname, params);
-}
-
-inline void QOpenGLFunctions_4_0_Compatibility::glGetTexParameteriv(GLenum target, GLenum pname, GLint *params)
-{
- d_1_0_Core->f.GetTexParameteriv(target, pname, params);
-}
-
-inline void QOpenGLFunctions_4_0_Compatibility::glGetTexParameterfv(GLenum target, GLenum pname, GLfloat *params)
-{
- d_1_0_Core->f.GetTexParameterfv(target, pname, params);
-}
-
-inline void QOpenGLFunctions_4_0_Compatibility::glGetTexImage(GLenum target, GLint level, GLenum format, GLenum type, GLvoid *pixels)
-{
- d_1_0_Core->f.GetTexImage(target, level, format, type, pixels);
-}
-
-inline const GLubyte * QOpenGLFunctions_4_0_Compatibility::glGetString(GLenum name)
-{
- return d_1_0_Core->f.GetString(name);
-}
-
-inline void QOpenGLFunctions_4_0_Compatibility::glGetIntegerv(GLenum pname, GLint *params)
-{
- d_1_0_Core->f.GetIntegerv(pname, params);
-}
-
-inline void QOpenGLFunctions_4_0_Compatibility::glGetFloatv(GLenum pname, GLfloat *params)
-{
- d_1_0_Core->f.GetFloatv(pname, params);
-}
-
-inline GLenum QOpenGLFunctions_4_0_Compatibility::glGetError()
-{
- return d_1_0_Core->f.GetError();
-}
-
-inline void QOpenGLFunctions_4_0_Compatibility::glGetDoublev(GLenum pname, GLdouble *params)
-{
- d_1_0_Core->f.GetDoublev(pname, params);
-}
-
-inline void QOpenGLFunctions_4_0_Compatibility::glGetBooleanv(GLenum pname, GLboolean *params)
-{
- d_1_0_Core->f.GetBooleanv(pname, params);
-}
-
-inline void QOpenGLFunctions_4_0_Compatibility::glReadPixels(GLint x, GLint y, GLsizei width, GLsizei height, GLenum format, GLenum type, GLvoid *pixels)
-{
- d_1_0_Core->f.ReadPixels(x, y, width, height, format, type, pixels);
-}
-
-inline void QOpenGLFunctions_4_0_Compatibility::glReadBuffer(GLenum mode)
-{
- d_1_0_Core->f.ReadBuffer(mode);
-}
-
-inline void QOpenGLFunctions_4_0_Compatibility::glPixelStorei(GLenum pname, GLint param)
-{
- d_1_0_Core->f.PixelStorei(pname, param);
-}
-
-inline void QOpenGLFunctions_4_0_Compatibility::glPixelStoref(GLenum pname, GLfloat param)
-{
- d_1_0_Core->f.PixelStoref(pname, param);
-}
-
-inline void QOpenGLFunctions_4_0_Compatibility::glDepthFunc(GLenum func)
-{
- d_1_0_Core->f.DepthFunc(func);
-}
-
-inline void QOpenGLFunctions_4_0_Compatibility::glStencilOp(GLenum fail, GLenum zfail, GLenum zpass)
-{
- d_1_0_Core->f.StencilOp(fail, zfail, zpass);
-}
-
-inline void QOpenGLFunctions_4_0_Compatibility::glStencilFunc(GLenum func, GLint ref, GLuint mask)
-{
- d_1_0_Core->f.StencilFunc(func, ref, mask);
-}
-
-inline void QOpenGLFunctions_4_0_Compatibility::glLogicOp(GLenum opcode)
-{
- d_1_0_Core->f.LogicOp(opcode);
-}
-
-inline void QOpenGLFunctions_4_0_Compatibility::glBlendFunc(GLenum sfactor, GLenum dfactor)
-{
- d_1_0_Core->f.BlendFunc(sfactor, dfactor);
-}
-
-inline void QOpenGLFunctions_4_0_Compatibility::glFlush()
-{
- d_1_0_Core->f.Flush();
-}
-
-inline void QOpenGLFunctions_4_0_Compatibility::glFinish()
-{
- d_1_0_Core->f.Finish();
-}
-
-inline void QOpenGLFunctions_4_0_Compatibility::glEnable(GLenum cap)
-{
- d_1_0_Core->f.Enable(cap);
-}
-
-inline void QOpenGLFunctions_4_0_Compatibility::glDisable(GLenum cap)
-{
- d_1_0_Core->f.Disable(cap);
-}
-
-inline void QOpenGLFunctions_4_0_Compatibility::glDepthMask(GLboolean flag)
-{
- d_1_0_Core->f.DepthMask(flag);
-}
-
-inline void QOpenGLFunctions_4_0_Compatibility::glColorMask(GLboolean red, GLboolean green, GLboolean blue, GLboolean alpha)
-{
- d_1_0_Core->f.ColorMask(red, green, blue, alpha);
-}
-
-inline void QOpenGLFunctions_4_0_Compatibility::glStencilMask(GLuint mask)
-{
- d_1_0_Core->f.StencilMask(mask);
-}
-
-inline void QOpenGLFunctions_4_0_Compatibility::glClearDepth(GLdouble depth)
-{
- d_1_0_Core->f.ClearDepth(depth);
-}
-
-inline void QOpenGLFunctions_4_0_Compatibility::glClearStencil(GLint s)
-{
- d_1_0_Core->f.ClearStencil(s);
-}
-
-inline void QOpenGLFunctions_4_0_Compatibility::glClearColor(GLfloat red, GLfloat green, GLfloat blue, GLfloat alpha)
-{
- d_1_0_Core->f.ClearColor(red, green, blue, alpha);
-}
-
-inline void QOpenGLFunctions_4_0_Compatibility::glClear(GLbitfield mask)
-{
- d_1_0_Core->f.Clear(mask);
-}
-
-inline void QOpenGLFunctions_4_0_Compatibility::glDrawBuffer(GLenum mode)
-{
- d_1_0_Core->f.DrawBuffer(mode);
-}
-
-inline void QOpenGLFunctions_4_0_Compatibility::glTexImage2D(GLenum target, GLint level, GLint internalformat, GLsizei width, GLsizei height, GLint border, GLenum format, GLenum type, const GLvoid *pixels)
-{
- d_1_0_Core->f.TexImage2D(target, level, internalformat, width, height, border, format, type, pixels);
-}
-
-inline void QOpenGLFunctions_4_0_Compatibility::glTexImage1D(GLenum target, GLint level, GLint internalformat, GLsizei width, GLint border, GLenum format, GLenum type, const GLvoid *pixels)
-{
- d_1_0_Core->f.TexImage1D(target, level, internalformat, width, border, format, type, pixels);
-}
-
-inline void QOpenGLFunctions_4_0_Compatibility::glTexParameteriv(GLenum target, GLenum pname, const GLint *params)
-{
- d_1_0_Core->f.TexParameteriv(target, pname, params);
-}
-
-inline void QOpenGLFunctions_4_0_Compatibility::glTexParameteri(GLenum target, GLenum pname, GLint param)
-{
- d_1_0_Core->f.TexParameteri(target, pname, param);
-}
-
-inline void QOpenGLFunctions_4_0_Compatibility::glTexParameterfv(GLenum target, GLenum pname, const GLfloat *params)
-{
- d_1_0_Core->f.TexParameterfv(target, pname, params);
-}
-
-inline void QOpenGLFunctions_4_0_Compatibility::glTexParameterf(GLenum target, GLenum pname, GLfloat param)
-{
- d_1_0_Core->f.TexParameterf(target, pname, param);
-}
-
-inline void QOpenGLFunctions_4_0_Compatibility::glScissor(GLint x, GLint y, GLsizei width, GLsizei height)
-{
- d_1_0_Core->f.Scissor(x, y, width, height);
-}
-
-inline void QOpenGLFunctions_4_0_Compatibility::glPolygonMode(GLenum face, GLenum mode)
-{
- d_1_0_Core->f.PolygonMode(face, mode);
-}
-
-inline void QOpenGLFunctions_4_0_Compatibility::glPointSize(GLfloat size)
-{
- d_1_0_Core->f.PointSize(size);
-}
-
-inline void QOpenGLFunctions_4_0_Compatibility::glLineWidth(GLfloat width)
-{
- d_1_0_Core->f.LineWidth(width);
-}
-
-inline void QOpenGLFunctions_4_0_Compatibility::glHint(GLenum target, GLenum mode)
-{
- d_1_0_Core->f.Hint(target, mode);
-}
-
-inline void QOpenGLFunctions_4_0_Compatibility::glFrontFace(GLenum mode)
-{
- d_1_0_Core->f.FrontFace(mode);
-}
-
-inline void QOpenGLFunctions_4_0_Compatibility::glCullFace(GLenum mode)
-{
- d_1_0_Core->f.CullFace(mode);
-}
-
-
-// OpenGL 1.1 core functions
-inline void QOpenGLFunctions_4_0_Compatibility::glIndexubv(const GLubyte *c)
-{
- d_1_1_Deprecated->f.Indexubv(c);
-}
-
-inline void QOpenGLFunctions_4_0_Compatibility::glIndexub(GLubyte c)
-{
- d_1_1_Deprecated->f.Indexub(c);
-}
-
-inline GLboolean QOpenGLFunctions_4_0_Compatibility::glIsTexture(GLuint texture)
-{
- return d_1_1_Core->f.IsTexture(texture);
-}
-
-inline void QOpenGLFunctions_4_0_Compatibility::glGenTextures(GLsizei n, GLuint *textures)
-{
- d_1_1_Core->f.GenTextures(n, textures);
-}
-
-inline void QOpenGLFunctions_4_0_Compatibility::glDeleteTextures(GLsizei n, const GLuint *textures)
-{
- d_1_1_Core->f.DeleteTextures(n, textures);
-}
-
-inline void QOpenGLFunctions_4_0_Compatibility::glBindTexture(GLenum target, GLuint texture)
-{
- d_1_1_Core->f.BindTexture(target, texture);
-}
-
-inline void QOpenGLFunctions_4_0_Compatibility::glTexSubImage2D(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLenum type, const GLvoid *pixels)
-{
- d_1_1_Core->f.TexSubImage2D(target, level, xoffset, yoffset, width, height, format, type, pixels);
-}
-
-inline void QOpenGLFunctions_4_0_Compatibility::glTexSubImage1D(GLenum target, GLint level, GLint xoffset, GLsizei width, GLenum format, GLenum type, const GLvoid *pixels)
-{
- d_1_1_Core->f.TexSubImage1D(target, level, xoffset, width, format, type, pixels);
-}
-
-inline void QOpenGLFunctions_4_0_Compatibility::glCopyTexSubImage2D(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint x, GLint y, GLsizei width, GLsizei height)
-{
- d_1_1_Core->f.CopyTexSubImage2D(target, level, xoffset, yoffset, x, y, width, height);
-}
-
-inline void QOpenGLFunctions_4_0_Compatibility::glCopyTexSubImage1D(GLenum target, GLint level, GLint xoffset, GLint x, GLint y, GLsizei width)
-{
- d_1_1_Core->f.CopyTexSubImage1D(target, level, xoffset, x, y, width);
-}
-
-inline void QOpenGLFunctions_4_0_Compatibility::glCopyTexImage2D(GLenum target, GLint level, GLenum internalformat, GLint x, GLint y, GLsizei width, GLsizei height, GLint border)
-{
- d_1_1_Core->f.CopyTexImage2D(target, level, internalformat, x, y, width, height, border);
-}
-
-inline void QOpenGLFunctions_4_0_Compatibility::glCopyTexImage1D(GLenum target, GLint level, GLenum internalformat, GLint x, GLint y, GLsizei width, GLint border)
-{
- d_1_1_Core->f.CopyTexImage1D(target, level, internalformat, x, y, width, border);
-}
-
-inline void QOpenGLFunctions_4_0_Compatibility::glPolygonOffset(GLfloat factor, GLfloat units)
-{
- d_1_1_Core->f.PolygonOffset(factor, units);
-}
-
-inline void QOpenGLFunctions_4_0_Compatibility::glGetPointerv(GLenum pname, GLvoid* *params)
-{
- d_1_1_Deprecated->f.GetPointerv(pname, params);
-}
-
-inline void QOpenGLFunctions_4_0_Compatibility::glDrawElements(GLenum mode, GLsizei count, GLenum type, const GLvoid *indices)
-{
- d_1_1_Core->f.DrawElements(mode, count, type, indices);
-}
-
-inline void QOpenGLFunctions_4_0_Compatibility::glDrawArrays(GLenum mode, GLint first, GLsizei count)
-{
- d_1_1_Core->f.DrawArrays(mode, first, count);
-}
-
-
-// OpenGL 1.2 core functions
-inline void QOpenGLFunctions_4_0_Compatibility::glCopyTexSubImage3D(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLint x, GLint y, GLsizei width, GLsizei height)
-{
- d_1_2_Core->f.CopyTexSubImage3D(target, level, xoffset, yoffset, zoffset, x, y, width, height);
-}
-
-inline void QOpenGLFunctions_4_0_Compatibility::glTexSubImage3D(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLenum type, const GLvoid *pixels)
-{
- d_1_2_Core->f.TexSubImage3D(target, level, xoffset, yoffset, zoffset, width, height, depth, format, type, pixels);
-}
-
-inline void QOpenGLFunctions_4_0_Compatibility::glTexImage3D(GLenum target, GLint level, GLint internalformat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLenum format, GLenum type, const GLvoid *pixels)
-{
- d_1_2_Core->f.TexImage3D(target, level, internalformat, width, height, depth, border, format, type, pixels);
-}
-
-inline void QOpenGLFunctions_4_0_Compatibility::glDrawRangeElements(GLenum mode, GLuint start, GLuint end, GLsizei count, GLenum type, const GLvoid *indices)
-{
- d_1_2_Core->f.DrawRangeElements(mode, start, end, count, type, indices);
-}
-
-inline void QOpenGLFunctions_4_0_Compatibility::glBlendEquation(GLenum mode)
-{
- d_1_2_Core->f.BlendEquation(mode);
-}
-
-inline void QOpenGLFunctions_4_0_Compatibility::glBlendColor(GLfloat red, GLfloat green, GLfloat blue, GLfloat alpha)
-{
- d_1_2_Core->f.BlendColor(red, green, blue, alpha);
-}
-
-
-// OpenGL 1.3 core functions
-inline void QOpenGLFunctions_4_0_Compatibility::glGetCompressedTexImage(GLenum target, GLint level, GLvoid *img)
-{
- d_1_3_Core->f.GetCompressedTexImage(target, level, img);
-}
-
-inline void QOpenGLFunctions_4_0_Compatibility::glCompressedTexSubImage1D(GLenum target, GLint level, GLint xoffset, GLsizei width, GLenum format, GLsizei imageSize, const GLvoid *data)
-{
- d_1_3_Core->f.CompressedTexSubImage1D(target, level, xoffset, width, format, imageSize, data);
-}
-
-inline void QOpenGLFunctions_4_0_Compatibility::glCompressedTexSubImage2D(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLsizei imageSize, const GLvoid *data)
-{
- d_1_3_Core->f.CompressedTexSubImage2D(target, level, xoffset, yoffset, width, height, format, imageSize, data);
-}
-
-inline void QOpenGLFunctions_4_0_Compatibility::glCompressedTexSubImage3D(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLsizei imageSize, const GLvoid *data)
-{
- d_1_3_Core->f.CompressedTexSubImage3D(target, level, xoffset, yoffset, zoffset, width, height, depth, format, imageSize, data);
-}
-
-inline void QOpenGLFunctions_4_0_Compatibility::glCompressedTexImage1D(GLenum target, GLint level, GLenum internalformat, GLsizei width, GLint border, GLsizei imageSize, const GLvoid *data)
-{
- d_1_3_Core->f.CompressedTexImage1D(target, level, internalformat, width, border, imageSize, data);
-}
-
-inline void QOpenGLFunctions_4_0_Compatibility::glCompressedTexImage2D(GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLint border, GLsizei imageSize, const GLvoid *data)
-{
- d_1_3_Core->f.CompressedTexImage2D(target, level, internalformat, width, height, border, imageSize, data);
-}
-
-inline void QOpenGLFunctions_4_0_Compatibility::glCompressedTexImage3D(GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLsizei imageSize, const GLvoid *data)
-{
- d_1_3_Core->f.CompressedTexImage3D(target, level, internalformat, width, height, depth, border, imageSize, data);
-}
-
-inline void QOpenGLFunctions_4_0_Compatibility::glSampleCoverage(GLfloat value, GLboolean invert)
-{
- d_1_3_Core->f.SampleCoverage(value, invert);
-}
-
-inline void QOpenGLFunctions_4_0_Compatibility::glActiveTexture(GLenum texture)
-{
- d_1_3_Core->f.ActiveTexture(texture);
-}
-
-
-// OpenGL 1.4 core functions
-inline void QOpenGLFunctions_4_0_Compatibility::glPointParameteriv(GLenum pname, const GLint *params)
-{
- d_1_4_Core->f.PointParameteriv(pname, params);
-}
-
-inline void QOpenGLFunctions_4_0_Compatibility::glPointParameteri(GLenum pname, GLint param)
-{
- d_1_4_Core->f.PointParameteri(pname, param);
-}
-
-inline void QOpenGLFunctions_4_0_Compatibility::glPointParameterfv(GLenum pname, const GLfloat *params)
-{
- d_1_4_Core->f.PointParameterfv(pname, params);
-}
-
-inline void QOpenGLFunctions_4_0_Compatibility::glPointParameterf(GLenum pname, GLfloat param)
-{
- d_1_4_Core->f.PointParameterf(pname, param);
-}
-
-inline void QOpenGLFunctions_4_0_Compatibility::glMultiDrawElements(GLenum mode, const GLsizei *count, GLenum type, const GLvoid* const *indices, GLsizei drawcount)
-{
- d_1_4_Core->f.MultiDrawElements(mode, count, type, indices, drawcount);
-}
-
-inline void QOpenGLFunctions_4_0_Compatibility::glMultiDrawArrays(GLenum mode, const GLint *first, const GLsizei *count, GLsizei drawcount)
-{
- d_1_4_Core->f.MultiDrawArrays(mode, first, count, drawcount);
-}
-
-inline void QOpenGLFunctions_4_0_Compatibility::glBlendFuncSeparate(GLenum sfactorRGB, GLenum dfactorRGB, GLenum sfactorAlpha, GLenum dfactorAlpha)
-{
- d_1_4_Core->f.BlendFuncSeparate(sfactorRGB, dfactorRGB, sfactorAlpha, dfactorAlpha);
-}
-
-
-// OpenGL 1.5 core functions
-inline void QOpenGLFunctions_4_0_Compatibility::glGetBufferPointerv(GLenum target, GLenum pname, GLvoid* *params)
-{
- d_1_5_Core->f.GetBufferPointerv(target, pname, params);
-}
-
-inline void QOpenGLFunctions_4_0_Compatibility::glGetBufferParameteriv(GLenum target, GLenum pname, GLint *params)
-{
- d_1_5_Core->f.GetBufferParameteriv(target, pname, params);
-}
-
-inline GLboolean QOpenGLFunctions_4_0_Compatibility::glUnmapBuffer(GLenum target)
-{
- return d_1_5_Core->f.UnmapBuffer(target);
-}
-
-inline GLvoid* QOpenGLFunctions_4_0_Compatibility::glMapBuffer(GLenum target, GLenum access)
-{
- return d_1_5_Core->f.MapBuffer(target, access);
-}
-
-inline void QOpenGLFunctions_4_0_Compatibility::glGetBufferSubData(GLenum target, GLintptr offset, GLsizeiptr size, GLvoid *data)
-{
- d_1_5_Core->f.GetBufferSubData(target, offset, size, data);
-}
-
-inline void QOpenGLFunctions_4_0_Compatibility::glBufferSubData(GLenum target, GLintptr offset, GLsizeiptr size, const GLvoid *data)
-{
- d_1_5_Core->f.BufferSubData(target, offset, size, data);
-}
-
-inline void QOpenGLFunctions_4_0_Compatibility::glBufferData(GLenum target, GLsizeiptr size, const GLvoid *data, GLenum usage)
-{
- d_1_5_Core->f.BufferData(target, size, data, usage);
-}
-
-inline GLboolean QOpenGLFunctions_4_0_Compatibility::glIsBuffer(GLuint buffer)
-{
- return d_1_5_Core->f.IsBuffer(buffer);
-}
-
-inline void QOpenGLFunctions_4_0_Compatibility::glGenBuffers(GLsizei n, GLuint *buffers)
-{
- d_1_5_Core->f.GenBuffers(n, buffers);
-}
-
-inline void QOpenGLFunctions_4_0_Compatibility::glDeleteBuffers(GLsizei n, const GLuint *buffers)
-{
- d_1_5_Core->f.DeleteBuffers(n, buffers);
-}
-
-inline void QOpenGLFunctions_4_0_Compatibility::glBindBuffer(GLenum target, GLuint buffer)
-{
- d_1_5_Core->f.BindBuffer(target, buffer);
-}
-
-inline void QOpenGLFunctions_4_0_Compatibility::glGetQueryObjectuiv(GLuint id, GLenum pname, GLuint *params)
-{
- d_1_5_Core->f.GetQueryObjectuiv(id, pname, params);
-}
-
-inline void QOpenGLFunctions_4_0_Compatibility::glGetQueryObjectiv(GLuint id, GLenum pname, GLint *params)
-{
- d_1_5_Core->f.GetQueryObjectiv(id, pname, params);
-}
-
-inline void QOpenGLFunctions_4_0_Compatibility::glGetQueryiv(GLenum target, GLenum pname, GLint *params)
-{
- d_1_5_Core->f.GetQueryiv(target, pname, params);
-}
-
-inline void QOpenGLFunctions_4_0_Compatibility::glEndQuery(GLenum target)
-{
- d_1_5_Core->f.EndQuery(target);
-}
-
-inline void QOpenGLFunctions_4_0_Compatibility::glBeginQuery(GLenum target, GLuint id)
-{
- d_1_5_Core->f.BeginQuery(target, id);
-}
-
-inline GLboolean QOpenGLFunctions_4_0_Compatibility::glIsQuery(GLuint id)
-{
- return d_1_5_Core->f.IsQuery(id);
-}
-
-inline void QOpenGLFunctions_4_0_Compatibility::glDeleteQueries(GLsizei n, const GLuint *ids)
-{
- d_1_5_Core->f.DeleteQueries(n, ids);
-}
-
-inline void QOpenGLFunctions_4_0_Compatibility::glGenQueries(GLsizei n, GLuint *ids)
-{
- d_1_5_Core->f.GenQueries(n, ids);
-}
-
-
-// OpenGL 2.0 core functions
-inline void QOpenGLFunctions_4_0_Compatibility::glVertexAttribPointer(GLuint index, GLint size, GLenum type, GLboolean normalized, GLsizei stride, const GLvoid *pointer)
-{
- d_2_0_Core->f.VertexAttribPointer(index, size, type, normalized, stride, pointer);
-}
-
-inline void QOpenGLFunctions_4_0_Compatibility::glValidateProgram(GLuint program)
-{
- d_2_0_Core->f.ValidateProgram(program);
-}
-
-inline void QOpenGLFunctions_4_0_Compatibility::glUniformMatrix4fv(GLint location, GLsizei count, GLboolean transpose, const GLfloat *value)
-{
- d_2_0_Core->f.UniformMatrix4fv(location, count, transpose, value);
-}
-
-inline void QOpenGLFunctions_4_0_Compatibility::glUniformMatrix3fv(GLint location, GLsizei count, GLboolean transpose, const GLfloat *value)
-{
- d_2_0_Core->f.UniformMatrix3fv(location, count, transpose, value);
-}
-
-inline void QOpenGLFunctions_4_0_Compatibility::glUniformMatrix2fv(GLint location, GLsizei count, GLboolean transpose, const GLfloat *value)
-{
- d_2_0_Core->f.UniformMatrix2fv(location, count, transpose, value);
-}
-
-inline void QOpenGLFunctions_4_0_Compatibility::glUniform4iv(GLint location, GLsizei count, const GLint *value)
-{
- d_2_0_Core->f.Uniform4iv(location, count, value);
-}
-
-inline void QOpenGLFunctions_4_0_Compatibility::glUniform3iv(GLint location, GLsizei count, const GLint *value)
-{
- d_2_0_Core->f.Uniform3iv(location, count, value);
-}
-
-inline void QOpenGLFunctions_4_0_Compatibility::glUniform2iv(GLint location, GLsizei count, const GLint *value)
-{
- d_2_0_Core->f.Uniform2iv(location, count, value);
-}
-
-inline void QOpenGLFunctions_4_0_Compatibility::glUniform1iv(GLint location, GLsizei count, const GLint *value)
-{
- d_2_0_Core->f.Uniform1iv(location, count, value);
-}
-
-inline void QOpenGLFunctions_4_0_Compatibility::glUniform4fv(GLint location, GLsizei count, const GLfloat *value)
-{
- d_2_0_Core->f.Uniform4fv(location, count, value);
-}
-
-inline void QOpenGLFunctions_4_0_Compatibility::glUniform3fv(GLint location, GLsizei count, const GLfloat *value)
-{
- d_2_0_Core->f.Uniform3fv(location, count, value);
-}
-
-inline void QOpenGLFunctions_4_0_Compatibility::glUniform2fv(GLint location, GLsizei count, const GLfloat *value)
-{
- d_2_0_Core->f.Uniform2fv(location, count, value);
-}
-
-inline void QOpenGLFunctions_4_0_Compatibility::glUniform1fv(GLint location, GLsizei count, const GLfloat *value)
-{
- d_2_0_Core->f.Uniform1fv(location, count, value);
-}
-
-inline void QOpenGLFunctions_4_0_Compatibility::glUniform4i(GLint location, GLint v0, GLint v1, GLint v2, GLint v3)
-{
- d_2_0_Core->f.Uniform4i(location, v0, v1, v2, v3);
-}
-
-inline void QOpenGLFunctions_4_0_Compatibility::glUniform3i(GLint location, GLint v0, GLint v1, GLint v2)
-{
- d_2_0_Core->f.Uniform3i(location, v0, v1, v2);
-}
-
-inline void QOpenGLFunctions_4_0_Compatibility::glUniform2i(GLint location, GLint v0, GLint v1)
-{
- d_2_0_Core->f.Uniform2i(location, v0, v1);
-}
-
-inline void QOpenGLFunctions_4_0_Compatibility::glUniform1i(GLint location, GLint v0)
-{
- d_2_0_Core->f.Uniform1i(location, v0);
-}
-
-inline void QOpenGLFunctions_4_0_Compatibility::glUniform4f(GLint location, GLfloat v0, GLfloat v1, GLfloat v2, GLfloat v3)
-{
- d_2_0_Core->f.Uniform4f(location, v0, v1, v2, v3);
-}
-
-inline void QOpenGLFunctions_4_0_Compatibility::glUniform3f(GLint location, GLfloat v0, GLfloat v1, GLfloat v2)
-{
- d_2_0_Core->f.Uniform3f(location, v0, v1, v2);
-}
-
-inline void QOpenGLFunctions_4_0_Compatibility::glUniform2f(GLint location, GLfloat v0, GLfloat v1)
-{
- d_2_0_Core->f.Uniform2f(location, v0, v1);
-}
-
-inline void QOpenGLFunctions_4_0_Compatibility::glUniform1f(GLint location, GLfloat v0)
-{
- d_2_0_Core->f.Uniform1f(location, v0);
-}
-
-inline void QOpenGLFunctions_4_0_Compatibility::glUseProgram(GLuint program)
-{
- d_2_0_Core->f.UseProgram(program);
-}
-
-inline void QOpenGLFunctions_4_0_Compatibility::glShaderSource(GLuint shader, GLsizei count, const GLchar* const *string, const GLint *length)
-{
- d_2_0_Core->f.ShaderSource(shader, count, string, length);
-}
-
-inline void QOpenGLFunctions_4_0_Compatibility::glLinkProgram(GLuint program)
-{
- d_2_0_Core->f.LinkProgram(program);
-}
-
-inline GLboolean QOpenGLFunctions_4_0_Compatibility::glIsShader(GLuint shader)
-{
- return d_2_0_Core->f.IsShader(shader);
-}
-
-inline GLboolean QOpenGLFunctions_4_0_Compatibility::glIsProgram(GLuint program)
-{
- return d_2_0_Core->f.IsProgram(program);
-}
-
-inline void QOpenGLFunctions_4_0_Compatibility::glGetVertexAttribPointerv(GLuint index, GLenum pname, GLvoid* *pointer)
-{
- d_2_0_Core->f.GetVertexAttribPointerv(index, pname, pointer);
-}
-
-inline void QOpenGLFunctions_4_0_Compatibility::glGetVertexAttribiv(GLuint index, GLenum pname, GLint *params)
-{
- d_2_0_Core->f.GetVertexAttribiv(index, pname, params);
-}
-
-inline void QOpenGLFunctions_4_0_Compatibility::glGetVertexAttribfv(GLuint index, GLenum pname, GLfloat *params)
-{
- d_2_0_Core->f.GetVertexAttribfv(index, pname, params);
-}
-
-inline void QOpenGLFunctions_4_0_Compatibility::glGetVertexAttribdv(GLuint index, GLenum pname, GLdouble *params)
-{
- d_2_0_Core->f.GetVertexAttribdv(index, pname, params);
-}
-
-inline void QOpenGLFunctions_4_0_Compatibility::glGetUniformiv(GLuint program, GLint location, GLint *params)
-{
- d_2_0_Core->f.GetUniformiv(program, location, params);
-}
-
-inline void QOpenGLFunctions_4_0_Compatibility::glGetUniformfv(GLuint program, GLint location, GLfloat *params)
-{
- d_2_0_Core->f.GetUniformfv(program, location, params);
-}
-
-inline GLint QOpenGLFunctions_4_0_Compatibility::glGetUniformLocation(GLuint program, const GLchar *name)
-{
- return d_2_0_Core->f.GetUniformLocation(program, name);
-}
-
-inline void QOpenGLFunctions_4_0_Compatibility::glGetShaderSource(GLuint shader, GLsizei bufSize, GLsizei *length, GLchar *source)
-{
- d_2_0_Core->f.GetShaderSource(shader, bufSize, length, source);
-}
-
-inline void QOpenGLFunctions_4_0_Compatibility::glGetShaderInfoLog(GLuint shader, GLsizei bufSize, GLsizei *length, GLchar *infoLog)
-{
- d_2_0_Core->f.GetShaderInfoLog(shader, bufSize, length, infoLog);
-}
-
-inline void QOpenGLFunctions_4_0_Compatibility::glGetShaderiv(GLuint shader, GLenum pname, GLint *params)
-{
- d_2_0_Core->f.GetShaderiv(shader, pname, params);
-}
-
-inline void QOpenGLFunctions_4_0_Compatibility::glGetProgramInfoLog(GLuint program, GLsizei bufSize, GLsizei *length, GLchar *infoLog)
-{
- d_2_0_Core->f.GetProgramInfoLog(program, bufSize, length, infoLog);
-}
-
-inline void QOpenGLFunctions_4_0_Compatibility::glGetProgramiv(GLuint program, GLenum pname, GLint *params)
-{
- d_2_0_Core->f.GetProgramiv(program, pname, params);
-}
-
-inline GLint QOpenGLFunctions_4_0_Compatibility::glGetAttribLocation(GLuint program, const GLchar *name)
-{
- return d_2_0_Core->f.GetAttribLocation(program, name);
-}
-
-inline void QOpenGLFunctions_4_0_Compatibility::glGetAttachedShaders(GLuint program, GLsizei maxCount, GLsizei *count, GLuint *obj)
-{
- d_2_0_Core->f.GetAttachedShaders(program, maxCount, count, obj);
-}
-
-inline void QOpenGLFunctions_4_0_Compatibility::glGetActiveUniform(GLuint program, GLuint index, GLsizei bufSize, GLsizei *length, GLint *size, GLenum *type, GLchar *name)
-{
- d_2_0_Core->f.GetActiveUniform(program, index, bufSize, length, size, type, name);
-}
-
-inline void QOpenGLFunctions_4_0_Compatibility::glGetActiveAttrib(GLuint program, GLuint index, GLsizei bufSize, GLsizei *length, GLint *size, GLenum *type, GLchar *name)
-{
- d_2_0_Core->f.GetActiveAttrib(program, index, bufSize, length, size, type, name);
-}
-
-inline void QOpenGLFunctions_4_0_Compatibility::glEnableVertexAttribArray(GLuint index)
-{
- d_2_0_Core->f.EnableVertexAttribArray(index);
-}
-
-inline void QOpenGLFunctions_4_0_Compatibility::glDisableVertexAttribArray(GLuint index)
-{
- d_2_0_Core->f.DisableVertexAttribArray(index);
-}
-
-inline void QOpenGLFunctions_4_0_Compatibility::glDetachShader(GLuint program, GLuint shader)
-{
- d_2_0_Core->f.DetachShader(program, shader);
-}
-
-inline void QOpenGLFunctions_4_0_Compatibility::glDeleteShader(GLuint shader)
-{
- d_2_0_Core->f.DeleteShader(shader);
-}
-
-inline void QOpenGLFunctions_4_0_Compatibility::glDeleteProgram(GLuint program)
-{
- d_2_0_Core->f.DeleteProgram(program);
-}
-
-inline GLuint QOpenGLFunctions_4_0_Compatibility::glCreateShader(GLenum type)
-{
- return d_2_0_Core->f.CreateShader(type);
-}
-
-inline GLuint QOpenGLFunctions_4_0_Compatibility::glCreateProgram()
-{
- return d_2_0_Core->f.CreateProgram();
-}
-
-inline void QOpenGLFunctions_4_0_Compatibility::glCompileShader(GLuint shader)
-{
- d_2_0_Core->f.CompileShader(shader);
-}
-
-inline void QOpenGLFunctions_4_0_Compatibility::glBindAttribLocation(GLuint program, GLuint index, const GLchar *name)
-{
- d_2_0_Core->f.BindAttribLocation(program, index, name);
-}
-
-inline void QOpenGLFunctions_4_0_Compatibility::glAttachShader(GLuint program, GLuint shader)
-{
- d_2_0_Core->f.AttachShader(program, shader);
-}
-
-inline void QOpenGLFunctions_4_0_Compatibility::glStencilMaskSeparate(GLenum face, GLuint mask)
-{
- d_2_0_Core->f.StencilMaskSeparate(face, mask);
-}
-
-inline void QOpenGLFunctions_4_0_Compatibility::glStencilFuncSeparate(GLenum face, GLenum func, GLint ref, GLuint mask)
-{
- d_2_0_Core->f.StencilFuncSeparate(face, func, ref, mask);
-}
-
-inline void QOpenGLFunctions_4_0_Compatibility::glStencilOpSeparate(GLenum face, GLenum sfail, GLenum dpfail, GLenum dppass)
-{
- d_2_0_Core->f.StencilOpSeparate(face, sfail, dpfail, dppass);
-}
-
-inline void QOpenGLFunctions_4_0_Compatibility::glDrawBuffers(GLsizei n, const GLenum *bufs)
-{
- d_2_0_Core->f.DrawBuffers(n, bufs);
-}
-
-inline void QOpenGLFunctions_4_0_Compatibility::glBlendEquationSeparate(GLenum modeRGB, GLenum modeAlpha)
-{
- d_2_0_Core->f.BlendEquationSeparate(modeRGB, modeAlpha);
-}
-
-
-// OpenGL 2.1 core functions
-inline void QOpenGLFunctions_4_0_Compatibility::glUniformMatrix4x3fv(GLint location, GLsizei count, GLboolean transpose, const GLfloat *value)
-{
- d_2_1_Core->f.UniformMatrix4x3fv(location, count, transpose, value);
-}
-
-inline void QOpenGLFunctions_4_0_Compatibility::glUniformMatrix3x4fv(GLint location, GLsizei count, GLboolean transpose, const GLfloat *value)
-{
- d_2_1_Core->f.UniformMatrix3x4fv(location, count, transpose, value);
-}
-
-inline void QOpenGLFunctions_4_0_Compatibility::glUniformMatrix4x2fv(GLint location, GLsizei count, GLboolean transpose, const GLfloat *value)
-{
- d_2_1_Core->f.UniformMatrix4x2fv(location, count, transpose, value);
-}
-
-inline void QOpenGLFunctions_4_0_Compatibility::glUniformMatrix2x4fv(GLint location, GLsizei count, GLboolean transpose, const GLfloat *value)
-{
- d_2_1_Core->f.UniformMatrix2x4fv(location, count, transpose, value);
-}
-
-inline void QOpenGLFunctions_4_0_Compatibility::glUniformMatrix3x2fv(GLint location, GLsizei count, GLboolean transpose, const GLfloat *value)
-{
- d_2_1_Core->f.UniformMatrix3x2fv(location, count, transpose, value);
-}
-
-inline void QOpenGLFunctions_4_0_Compatibility::glUniformMatrix2x3fv(GLint location, GLsizei count, GLboolean transpose, const GLfloat *value)
-{
- d_2_1_Core->f.UniformMatrix2x3fv(location, count, transpose, value);
-}
-
-
-// OpenGL 3.0 core functions
-inline GLboolean QOpenGLFunctions_4_0_Compatibility::glIsVertexArray(GLuint array)
-{
- return d_3_0_Core->f.IsVertexArray(array);
-}
-
-inline void QOpenGLFunctions_4_0_Compatibility::glGenVertexArrays(GLsizei n, GLuint *arrays)
-{
- d_3_0_Core->f.GenVertexArrays(n, arrays);
-}
-
-inline void QOpenGLFunctions_4_0_Compatibility::glDeleteVertexArrays(GLsizei n, const GLuint *arrays)
-{
- d_3_0_Core->f.DeleteVertexArrays(n, arrays);
-}
-
-inline void QOpenGLFunctions_4_0_Compatibility::glBindVertexArray(GLuint array)
-{
- d_3_0_Core->f.BindVertexArray(array);
-}
-
-inline void QOpenGLFunctions_4_0_Compatibility::glFlushMappedBufferRange(GLenum target, GLintptr offset, GLsizeiptr length)
-{
- d_3_0_Core->f.FlushMappedBufferRange(target, offset, length);
-}
-
-inline GLvoid* QOpenGLFunctions_4_0_Compatibility::glMapBufferRange(GLenum target, GLintptr offset, GLsizeiptr length, GLbitfield access)
-{
- return d_3_0_Core->f.MapBufferRange(target, offset, length, access);
-}
-
-inline void QOpenGLFunctions_4_0_Compatibility::glFramebufferTextureLayer(GLenum target, GLenum attachment, GLuint texture, GLint level, GLint layer)
-{
- d_3_0_Core->f.FramebufferTextureLayer(target, attachment, texture, level, layer);
-}
-
-inline void QOpenGLFunctions_4_0_Compatibility::glRenderbufferStorageMultisample(GLenum target, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height)
-{
- d_3_0_Core->f.RenderbufferStorageMultisample(target, samples, internalformat, width, height);
-}
-
-inline void QOpenGLFunctions_4_0_Compatibility::glBlitFramebuffer(GLint srcX0, GLint srcY0, GLint srcX1, GLint srcY1, GLint dstX0, GLint dstY0, GLint dstX1, GLint dstY1, GLbitfield mask, GLenum filter)
-{
- d_3_0_Core->f.BlitFramebuffer(srcX0, srcY0, srcX1, srcY1, dstX0, dstY0, dstX1, dstY1, mask, filter);
-}
-
-inline void QOpenGLFunctions_4_0_Compatibility::glGenerateMipmap(GLenum target)
-{
- d_3_0_Core->f.GenerateMipmap(target);
-}
-
-inline void QOpenGLFunctions_4_0_Compatibility::glGetFramebufferAttachmentParameteriv(GLenum target, GLenum attachment, GLenum pname, GLint *params)
-{
- d_3_0_Core->f.GetFramebufferAttachmentParameteriv(target, attachment, pname, params);
-}
-
-inline void QOpenGLFunctions_4_0_Compatibility::glFramebufferRenderbuffer(GLenum target, GLenum attachment, GLenum renderbuffertarget, GLuint renderbuffer)
-{
- d_3_0_Core->f.FramebufferRenderbuffer(target, attachment, renderbuffertarget, renderbuffer);
-}
-
-inline void QOpenGLFunctions_4_0_Compatibility::glFramebufferTexture3D(GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level, GLint zoffset)
-{
- d_3_0_Core->f.FramebufferTexture3D(target, attachment, textarget, texture, level, zoffset);
-}
-
-inline void QOpenGLFunctions_4_0_Compatibility::glFramebufferTexture2D(GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level)
-{
- d_3_0_Core->f.FramebufferTexture2D(target, attachment, textarget, texture, level);
-}
-
-inline void QOpenGLFunctions_4_0_Compatibility::glFramebufferTexture1D(GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level)
-{
- d_3_0_Core->f.FramebufferTexture1D(target, attachment, textarget, texture, level);
-}
-
-inline GLenum QOpenGLFunctions_4_0_Compatibility::glCheckFramebufferStatus(GLenum target)
-{
- return d_3_0_Core->f.CheckFramebufferStatus(target);
-}
-
-inline void QOpenGLFunctions_4_0_Compatibility::glGenFramebuffers(GLsizei n, GLuint *framebuffers)
-{
- d_3_0_Core->f.GenFramebuffers(n, framebuffers);
-}
-
-inline void QOpenGLFunctions_4_0_Compatibility::glDeleteFramebuffers(GLsizei n, const GLuint *framebuffers)
-{
- d_3_0_Core->f.DeleteFramebuffers(n, framebuffers);
-}
-
-inline void QOpenGLFunctions_4_0_Compatibility::glBindFramebuffer(GLenum target, GLuint framebuffer)
-{
- d_3_0_Core->f.BindFramebuffer(target, framebuffer);
-}
-
-inline GLboolean QOpenGLFunctions_4_0_Compatibility::glIsFramebuffer(GLuint framebuffer)
-{
- return d_3_0_Core->f.IsFramebuffer(framebuffer);
-}
-
-inline void QOpenGLFunctions_4_0_Compatibility::glGetRenderbufferParameteriv(GLenum target, GLenum pname, GLint *params)
-{
- d_3_0_Core->f.GetRenderbufferParameteriv(target, pname, params);
-}
-
-inline void QOpenGLFunctions_4_0_Compatibility::glRenderbufferStorage(GLenum target, GLenum internalformat, GLsizei width, GLsizei height)
-{
- d_3_0_Core->f.RenderbufferStorage(target, internalformat, width, height);
-}
-
-inline void QOpenGLFunctions_4_0_Compatibility::glGenRenderbuffers(GLsizei n, GLuint *renderbuffers)
-{
- d_3_0_Core->f.GenRenderbuffers(n, renderbuffers);
-}
-
-inline void QOpenGLFunctions_4_0_Compatibility::glDeleteRenderbuffers(GLsizei n, const GLuint *renderbuffers)
-{
- d_3_0_Core->f.DeleteRenderbuffers(n, renderbuffers);
-}
-
-inline void QOpenGLFunctions_4_0_Compatibility::glBindRenderbuffer(GLenum target, GLuint renderbuffer)
-{
- d_3_0_Core->f.BindRenderbuffer(target, renderbuffer);
-}
-
-inline GLboolean QOpenGLFunctions_4_0_Compatibility::glIsRenderbuffer(GLuint renderbuffer)
-{
- return d_3_0_Core->f.IsRenderbuffer(renderbuffer);
-}
-
-inline const GLubyte * QOpenGLFunctions_4_0_Compatibility::glGetStringi(GLenum name, GLuint index)
-{
- return d_3_0_Core->f.GetStringi(name, index);
-}
-
-inline void QOpenGLFunctions_4_0_Compatibility::glClearBufferfi(GLenum buffer, GLint drawbuffer, GLfloat depth, GLint stencil)
-{
- d_3_0_Core->f.ClearBufferfi(buffer, drawbuffer, depth, stencil);
-}
-
-inline void QOpenGLFunctions_4_0_Compatibility::glClearBufferfv(GLenum buffer, GLint drawbuffer, const GLfloat *value)
-{
- d_3_0_Core->f.ClearBufferfv(buffer, drawbuffer, value);
-}
-
-inline void QOpenGLFunctions_4_0_Compatibility::glClearBufferuiv(GLenum buffer, GLint drawbuffer, const GLuint *value)
-{
- d_3_0_Core->f.ClearBufferuiv(buffer, drawbuffer, value);
-}
-
-inline void QOpenGLFunctions_4_0_Compatibility::glClearBufferiv(GLenum buffer, GLint drawbuffer, const GLint *value)
-{
- d_3_0_Core->f.ClearBufferiv(buffer, drawbuffer, value);
-}
-
-inline void QOpenGLFunctions_4_0_Compatibility::glGetTexParameterIuiv(GLenum target, GLenum pname, GLuint *params)
-{
- d_3_0_Core->f.GetTexParameterIuiv(target, pname, params);
-}
-
-inline void QOpenGLFunctions_4_0_Compatibility::glGetTexParameterIiv(GLenum target, GLenum pname, GLint *params)
-{
- d_3_0_Core->f.GetTexParameterIiv(target, pname, params);
-}
-
-inline void QOpenGLFunctions_4_0_Compatibility::glTexParameterIuiv(GLenum target, GLenum pname, const GLuint *params)
-{
- d_3_0_Core->f.TexParameterIuiv(target, pname, params);
-}
-
-inline void QOpenGLFunctions_4_0_Compatibility::glTexParameterIiv(GLenum target, GLenum pname, const GLint *params)
-{
- d_3_0_Core->f.TexParameterIiv(target, pname, params);
-}
-
-inline void QOpenGLFunctions_4_0_Compatibility::glUniform4uiv(GLint location, GLsizei count, const GLuint *value)
-{
- d_3_0_Core->f.Uniform4uiv(location, count, value);
-}
-
-inline void QOpenGLFunctions_4_0_Compatibility::glUniform3uiv(GLint location, GLsizei count, const GLuint *value)
-{
- d_3_0_Core->f.Uniform3uiv(location, count, value);
-}
-
-inline void QOpenGLFunctions_4_0_Compatibility::glUniform2uiv(GLint location, GLsizei count, const GLuint *value)
-{
- d_3_0_Core->f.Uniform2uiv(location, count, value);
-}
-
-inline void QOpenGLFunctions_4_0_Compatibility::glUniform1uiv(GLint location, GLsizei count, const GLuint *value)
-{
- d_3_0_Core->f.Uniform1uiv(location, count, value);
-}
-
-inline void QOpenGLFunctions_4_0_Compatibility::glUniform4ui(GLint location, GLuint v0, GLuint v1, GLuint v2, GLuint v3)
-{
- d_3_0_Core->f.Uniform4ui(location, v0, v1, v2, v3);
-}
-
-inline void QOpenGLFunctions_4_0_Compatibility::glUniform3ui(GLint location, GLuint v0, GLuint v1, GLuint v2)
-{
- d_3_0_Core->f.Uniform3ui(location, v0, v1, v2);
-}
-
-inline void QOpenGLFunctions_4_0_Compatibility::glUniform2ui(GLint location, GLuint v0, GLuint v1)
-{
- d_3_0_Core->f.Uniform2ui(location, v0, v1);
-}
-
-inline void QOpenGLFunctions_4_0_Compatibility::glUniform1ui(GLint location, GLuint v0)
-{
- d_3_0_Core->f.Uniform1ui(location, v0);
-}
-
-inline GLint QOpenGLFunctions_4_0_Compatibility::glGetFragDataLocation(GLuint program, const GLchar *name)
-{
- return d_3_0_Core->f.GetFragDataLocation(program, name);
-}
-
-inline void QOpenGLFunctions_4_0_Compatibility::glBindFragDataLocation(GLuint program, GLuint color, const GLchar *name)
-{
- d_3_0_Core->f.BindFragDataLocation(program, color, name);
-}
-
-inline void QOpenGLFunctions_4_0_Compatibility::glGetUniformuiv(GLuint program, GLint location, GLuint *params)
-{
- d_3_0_Core->f.GetUniformuiv(program, location, params);
-}
-
-inline void QOpenGLFunctions_4_0_Compatibility::glGetVertexAttribIuiv(GLuint index, GLenum pname, GLuint *params)
-{
- d_3_0_Core->f.GetVertexAttribIuiv(index, pname, params);
-}
-
-inline void QOpenGLFunctions_4_0_Compatibility::glGetVertexAttribIiv(GLuint index, GLenum pname, GLint *params)
-{
- d_3_0_Core->f.GetVertexAttribIiv(index, pname, params);
-}
-
-inline void QOpenGLFunctions_4_0_Compatibility::glVertexAttribIPointer(GLuint index, GLint size, GLenum type, GLsizei stride, const GLvoid *pointer)
-{
- d_3_0_Core->f.VertexAttribIPointer(index, size, type, stride, pointer);
-}
-
-inline void QOpenGLFunctions_4_0_Compatibility::glEndConditionalRender()
-{
- d_3_0_Core->f.EndConditionalRender();
-}
-
-inline void QOpenGLFunctions_4_0_Compatibility::glBeginConditionalRender(GLuint id, GLenum mode)
-{
- d_3_0_Core->f.BeginConditionalRender(id, mode);
-}
-
-inline void QOpenGLFunctions_4_0_Compatibility::glClampColor(GLenum target, GLenum clamp)
-{
- d_3_0_Core->f.ClampColor(target, clamp);
-}
-
-inline void QOpenGLFunctions_4_0_Compatibility::glGetTransformFeedbackVarying(GLuint program, GLuint index, GLsizei bufSize, GLsizei *length, GLsizei *size, GLenum *type, GLchar *name)
-{
- d_3_0_Core->f.GetTransformFeedbackVarying(program, index, bufSize, length, size, type, name);
-}
-
-inline void QOpenGLFunctions_4_0_Compatibility::glTransformFeedbackVaryings(GLuint program, GLsizei count, const GLchar* const *varyings, GLenum bufferMode)
-{
- d_3_0_Core->f.TransformFeedbackVaryings(program, count, varyings, bufferMode);
-}
-
-inline void QOpenGLFunctions_4_0_Compatibility::glBindBufferBase(GLenum target, GLuint index, GLuint buffer)
-{
- d_3_0_Core->f.BindBufferBase(target, index, buffer);
-}
-
-inline void QOpenGLFunctions_4_0_Compatibility::glBindBufferRange(GLenum target, GLuint index, GLuint buffer, GLintptr offset, GLsizeiptr size)
-{
- d_3_0_Core->f.BindBufferRange(target, index, buffer, offset, size);
-}
-
-inline void QOpenGLFunctions_4_0_Compatibility::glEndTransformFeedback()
-{
- d_3_0_Core->f.EndTransformFeedback();
-}
-
-inline void QOpenGLFunctions_4_0_Compatibility::glBeginTransformFeedback(GLenum primitiveMode)
-{
- d_3_0_Core->f.BeginTransformFeedback(primitiveMode);
-}
-
-inline GLboolean QOpenGLFunctions_4_0_Compatibility::glIsEnabledi(GLenum target, GLuint index)
-{
- return d_3_0_Core->f.IsEnabledi(target, index);
-}
-
-inline void QOpenGLFunctions_4_0_Compatibility::glDisablei(GLenum target, GLuint index)
-{
- d_3_0_Core->f.Disablei(target, index);
-}
-
-inline void QOpenGLFunctions_4_0_Compatibility::glEnablei(GLenum target, GLuint index)
-{
- d_3_0_Core->f.Enablei(target, index);
-}
-
-inline void QOpenGLFunctions_4_0_Compatibility::glGetIntegeri_v(GLenum target, GLuint index, GLint *data)
-{
- d_3_0_Core->f.GetIntegeri_v(target, index, data);
-}
-
-inline void QOpenGLFunctions_4_0_Compatibility::glGetBooleani_v(GLenum target, GLuint index, GLboolean *data)
-{
- d_3_0_Core->f.GetBooleani_v(target, index, data);
-}
-
-inline void QOpenGLFunctions_4_0_Compatibility::glColorMaski(GLuint index, GLboolean r, GLboolean g, GLboolean b, GLboolean a)
-{
- d_3_0_Core->f.ColorMaski(index, r, g, b, a);
-}
-
-
-// OpenGL 3.1 core functions
-inline void QOpenGLFunctions_4_0_Compatibility::glCopyBufferSubData(GLenum readTarget, GLenum writeTarget, GLintptr readOffset, GLintptr writeOffset, GLsizeiptr size)
-{
- d_3_1_Core->f.CopyBufferSubData(readTarget, writeTarget, readOffset, writeOffset, size);
-}
-
-inline void QOpenGLFunctions_4_0_Compatibility::glUniformBlockBinding(GLuint program, GLuint uniformBlockIndex, GLuint uniformBlockBinding)
-{
- d_3_1_Core->f.UniformBlockBinding(program, uniformBlockIndex, uniformBlockBinding);
-}
-
-inline void QOpenGLFunctions_4_0_Compatibility::glGetActiveUniformBlockName(GLuint program, GLuint uniformBlockIndex, GLsizei bufSize, GLsizei *length, GLchar *uniformBlockName)
-{
- d_3_1_Core->f.GetActiveUniformBlockName(program, uniformBlockIndex, bufSize, length, uniformBlockName);
-}
-
-inline void QOpenGLFunctions_4_0_Compatibility::glGetActiveUniformBlockiv(GLuint program, GLuint uniformBlockIndex, GLenum pname, GLint *params)
-{
- d_3_1_Core->f.GetActiveUniformBlockiv(program, uniformBlockIndex, pname, params);
-}
-
-inline GLuint QOpenGLFunctions_4_0_Compatibility::glGetUniformBlockIndex(GLuint program, const GLchar *uniformBlockName)
-{
- return d_3_1_Core->f.GetUniformBlockIndex(program, uniformBlockName);
-}
-
-inline void QOpenGLFunctions_4_0_Compatibility::glGetActiveUniformName(GLuint program, GLuint uniformIndex, GLsizei bufSize, GLsizei *length, GLchar *uniformName)
-{
- d_3_1_Core->f.GetActiveUniformName(program, uniformIndex, bufSize, length, uniformName);
-}
-
-inline void QOpenGLFunctions_4_0_Compatibility::glGetActiveUniformsiv(GLuint program, GLsizei uniformCount, const GLuint *uniformIndices, GLenum pname, GLint *params)
-{
- d_3_1_Core->f.GetActiveUniformsiv(program, uniformCount, uniformIndices, pname, params);
-}
-
-inline void QOpenGLFunctions_4_0_Compatibility::glGetUniformIndices(GLuint program, GLsizei uniformCount, const GLchar* const *uniformNames, GLuint *uniformIndices)
-{
- d_3_1_Core->f.GetUniformIndices(program, uniformCount, uniformNames, uniformIndices);
-}
-
-inline void QOpenGLFunctions_4_0_Compatibility::glPrimitiveRestartIndex(GLuint index)
-{
- d_3_1_Core->f.PrimitiveRestartIndex(index);
-}
-
-inline void QOpenGLFunctions_4_0_Compatibility::glTexBuffer(GLenum target, GLenum internalformat, GLuint buffer)
-{
- d_3_1_Core->f.TexBuffer(target, internalformat, buffer);
-}
-
-inline void QOpenGLFunctions_4_0_Compatibility::glDrawElementsInstanced(GLenum mode, GLsizei count, GLenum type, const GLvoid *indices, GLsizei instancecount)
-{
- d_3_1_Core->f.DrawElementsInstanced(mode, count, type, indices, instancecount);
-}
-
-inline void QOpenGLFunctions_4_0_Compatibility::glDrawArraysInstanced(GLenum mode, GLint first, GLsizei count, GLsizei instancecount)
-{
- d_3_1_Core->f.DrawArraysInstanced(mode, first, count, instancecount);
-}
-
-
-// OpenGL 3.2 core functions
-inline void QOpenGLFunctions_4_0_Compatibility::glSampleMaski(GLuint index, GLbitfield mask)
-{
- d_3_2_Core->f.SampleMaski(index, mask);
-}
-
-inline void QOpenGLFunctions_4_0_Compatibility::glGetMultisamplefv(GLenum pname, GLuint index, GLfloat *val)
-{
- d_3_2_Core->f.GetMultisamplefv(pname, index, val);
-}
-
-inline void QOpenGLFunctions_4_0_Compatibility::glTexImage3DMultisample(GLenum target, GLsizei samples, GLint internalformat, GLsizei width, GLsizei height, GLsizei depth, GLboolean fixedsamplelocations)
-{
- d_3_2_Core->f.TexImage3DMultisample(target, samples, internalformat, width, height, depth, fixedsamplelocations);
-}
-
-inline void QOpenGLFunctions_4_0_Compatibility::glTexImage2DMultisample(GLenum target, GLsizei samples, GLint internalformat, GLsizei width, GLsizei height, GLboolean fixedsamplelocations)
-{
- d_3_2_Core->f.TexImage2DMultisample(target, samples, internalformat, width, height, fixedsamplelocations);
-}
-
-inline void QOpenGLFunctions_4_0_Compatibility::glGetSynciv(GLsync sync, GLenum pname, GLsizei bufSize, GLsizei *length, GLint *values)
-{
- d_3_2_Core->f.GetSynciv(sync, pname, bufSize, length, values);
-}
-
-inline void QOpenGLFunctions_4_0_Compatibility::glGetInteger64v(GLenum pname, GLint64 *params)
-{
- d_3_2_Core->f.GetInteger64v(pname, params);
-}
-
-inline void QOpenGLFunctions_4_0_Compatibility::glWaitSync(GLsync sync, GLbitfield flags, GLuint64 timeout)
-{
- d_3_2_Core->f.WaitSync(sync, flags, timeout);
-}
-
-inline GLenum QOpenGLFunctions_4_0_Compatibility::glClientWaitSync(GLsync sync, GLbitfield flags, GLuint64 timeout)
-{
- return d_3_2_Core->f.ClientWaitSync(sync, flags, timeout);
-}
-
-inline void QOpenGLFunctions_4_0_Compatibility::glDeleteSync(GLsync sync)
-{
- d_3_2_Core->f.DeleteSync(sync);
-}
-
-inline GLboolean QOpenGLFunctions_4_0_Compatibility::glIsSync(GLsync sync)
-{
- return d_3_2_Core->f.IsSync(sync);
-}
-
-inline GLsync QOpenGLFunctions_4_0_Compatibility::glFenceSync(GLenum condition, GLbitfield flags)
-{
- return d_3_2_Core->f.FenceSync(condition, flags);
-}
-
-inline void QOpenGLFunctions_4_0_Compatibility::glProvokingVertex(GLenum mode)
-{
- d_3_2_Core->f.ProvokingVertex(mode);
-}
-
-inline void QOpenGLFunctions_4_0_Compatibility::glMultiDrawElementsBaseVertex(GLenum mode, const GLsizei *count, GLenum type, const GLvoid* const *indices, GLsizei drawcount, const GLint *basevertex)
-{
- d_3_2_Core->f.MultiDrawElementsBaseVertex(mode, count, type, indices, drawcount, basevertex);
-}
-
-inline void QOpenGLFunctions_4_0_Compatibility::glDrawElementsInstancedBaseVertex(GLenum mode, GLsizei count, GLenum type, const GLvoid *indices, GLsizei instancecount, GLint basevertex)
-{
- d_3_2_Core->f.DrawElementsInstancedBaseVertex(mode, count, type, indices, instancecount, basevertex);
-}
-
-inline void QOpenGLFunctions_4_0_Compatibility::glDrawRangeElementsBaseVertex(GLenum mode, GLuint start, GLuint end, GLsizei count, GLenum type, const GLvoid *indices, GLint basevertex)
-{
- d_3_2_Core->f.DrawRangeElementsBaseVertex(mode, start, end, count, type, indices, basevertex);
-}
-
-inline void QOpenGLFunctions_4_0_Compatibility::glDrawElementsBaseVertex(GLenum mode, GLsizei count, GLenum type, const GLvoid *indices, GLint basevertex)
-{
- d_3_2_Core->f.DrawElementsBaseVertex(mode, count, type, indices, basevertex);
-}
-
-inline void QOpenGLFunctions_4_0_Compatibility::glFramebufferTexture(GLenum target, GLenum attachment, GLuint texture, GLint level)
-{
- d_3_2_Core->f.FramebufferTexture(target, attachment, texture, level);
-}
-
-inline void QOpenGLFunctions_4_0_Compatibility::glGetBufferParameteri64v(GLenum target, GLenum pname, GLint64 *params)
-{
- d_3_2_Core->f.GetBufferParameteri64v(target, pname, params);
-}
-
-inline void QOpenGLFunctions_4_0_Compatibility::glGetInteger64i_v(GLenum target, GLuint index, GLint64 *data)
-{
- d_3_2_Core->f.GetInteger64i_v(target, index, data);
-}
-
-
-// OpenGL 3.3 core functions
-inline void QOpenGLFunctions_4_0_Compatibility::glVertexAttribP4uiv(GLuint index, GLenum type, GLboolean normalized, const GLuint *value)
-{
- d_3_3_Core->f.VertexAttribP4uiv(index, type, normalized, value);
-}
-
-inline void QOpenGLFunctions_4_0_Compatibility::glVertexAttribP4ui(GLuint index, GLenum type, GLboolean normalized, GLuint value)
-{
- d_3_3_Core->f.VertexAttribP4ui(index, type, normalized, value);
-}
-
-inline void QOpenGLFunctions_4_0_Compatibility::glVertexAttribP3uiv(GLuint index, GLenum type, GLboolean normalized, const GLuint *value)
-{
- d_3_3_Core->f.VertexAttribP3uiv(index, type, normalized, value);
-}
-
-inline void QOpenGLFunctions_4_0_Compatibility::glVertexAttribP3ui(GLuint index, GLenum type, GLboolean normalized, GLuint value)
-{
- d_3_3_Core->f.VertexAttribP3ui(index, type, normalized, value);
-}
-
-inline void QOpenGLFunctions_4_0_Compatibility::glVertexAttribP2uiv(GLuint index, GLenum type, GLboolean normalized, const GLuint *value)
-{
- d_3_3_Core->f.VertexAttribP2uiv(index, type, normalized, value);
-}
-
-inline void QOpenGLFunctions_4_0_Compatibility::glVertexAttribP2ui(GLuint index, GLenum type, GLboolean normalized, GLuint value)
-{
- d_3_3_Core->f.VertexAttribP2ui(index, type, normalized, value);
-}
-
-inline void QOpenGLFunctions_4_0_Compatibility::glVertexAttribP1uiv(GLuint index, GLenum type, GLboolean normalized, const GLuint *value)
-{
- d_3_3_Core->f.VertexAttribP1uiv(index, type, normalized, value);
-}
-
-inline void QOpenGLFunctions_4_0_Compatibility::glVertexAttribP1ui(GLuint index, GLenum type, GLboolean normalized, GLuint value)
-{
- d_3_3_Core->f.VertexAttribP1ui(index, type, normalized, value);
-}
-
-inline void QOpenGLFunctions_4_0_Compatibility::glSecondaryColorP3uiv(GLenum type, const GLuint *color)
-{
- d_3_3_Deprecated->f.SecondaryColorP3uiv(type, color);
-}
-
-inline void QOpenGLFunctions_4_0_Compatibility::glSecondaryColorP3ui(GLenum type, GLuint color)
-{
- d_3_3_Deprecated->f.SecondaryColorP3ui(type, color);
-}
-
-inline void QOpenGLFunctions_4_0_Compatibility::glColorP4uiv(GLenum type, const GLuint *color)
-{
- d_3_3_Deprecated->f.ColorP4uiv(type, color);
-}
-
-inline void QOpenGLFunctions_4_0_Compatibility::glColorP4ui(GLenum type, GLuint color)
-{
- d_3_3_Deprecated->f.ColorP4ui(type, color);
-}
-
-inline void QOpenGLFunctions_4_0_Compatibility::glColorP3uiv(GLenum type, const GLuint *color)
-{
- d_3_3_Deprecated->f.ColorP3uiv(type, color);
-}
-
-inline void QOpenGLFunctions_4_0_Compatibility::glColorP3ui(GLenum type, GLuint color)
-{
- d_3_3_Deprecated->f.ColorP3ui(type, color);
-}
-
-inline void QOpenGLFunctions_4_0_Compatibility::glNormalP3uiv(GLenum type, const GLuint *coords)
-{
- d_3_3_Deprecated->f.NormalP3uiv(type, coords);
-}
-
-inline void QOpenGLFunctions_4_0_Compatibility::glNormalP3ui(GLenum type, GLuint coords)
-{
- d_3_3_Deprecated->f.NormalP3ui(type, coords);
-}
-
-inline void QOpenGLFunctions_4_0_Compatibility::glMultiTexCoordP4uiv(GLenum texture, GLenum type, const GLuint *coords)
-{
- d_3_3_Deprecated->f.MultiTexCoordP4uiv(texture, type, coords);
-}
-
-inline void QOpenGLFunctions_4_0_Compatibility::glMultiTexCoordP4ui(GLenum texture, GLenum type, GLuint coords)
-{
- d_3_3_Deprecated->f.MultiTexCoordP4ui(texture, type, coords);
-}
-
-inline void QOpenGLFunctions_4_0_Compatibility::glMultiTexCoordP3uiv(GLenum texture, GLenum type, const GLuint *coords)
-{
- d_3_3_Deprecated->f.MultiTexCoordP3uiv(texture, type, coords);
-}
-
-inline void QOpenGLFunctions_4_0_Compatibility::glMultiTexCoordP3ui(GLenum texture, GLenum type, GLuint coords)
-{
- d_3_3_Deprecated->f.MultiTexCoordP3ui(texture, type, coords);
-}
-
-inline void QOpenGLFunctions_4_0_Compatibility::glMultiTexCoordP2uiv(GLenum texture, GLenum type, const GLuint *coords)
-{
- d_3_3_Deprecated->f.MultiTexCoordP2uiv(texture, type, coords);
-}
-
-inline void QOpenGLFunctions_4_0_Compatibility::glMultiTexCoordP2ui(GLenum texture, GLenum type, GLuint coords)
-{
- d_3_3_Deprecated->f.MultiTexCoordP2ui(texture, type, coords);
-}
-
-inline void QOpenGLFunctions_4_0_Compatibility::glMultiTexCoordP1uiv(GLenum texture, GLenum type, const GLuint *coords)
-{
- d_3_3_Deprecated->f.MultiTexCoordP1uiv(texture, type, coords);
-}
-
-inline void QOpenGLFunctions_4_0_Compatibility::glMultiTexCoordP1ui(GLenum texture, GLenum type, GLuint coords)
-{
- d_3_3_Deprecated->f.MultiTexCoordP1ui(texture, type, coords);
-}
-
-inline void QOpenGLFunctions_4_0_Compatibility::glTexCoordP4uiv(GLenum type, const GLuint *coords)
-{
- d_3_3_Deprecated->f.TexCoordP4uiv(type, coords);
-}
-
-inline void QOpenGLFunctions_4_0_Compatibility::glTexCoordP4ui(GLenum type, GLuint coords)
-{
- d_3_3_Deprecated->f.TexCoordP4ui(type, coords);
-}
-
-inline void QOpenGLFunctions_4_0_Compatibility::glTexCoordP3uiv(GLenum type, const GLuint *coords)
-{
- d_3_3_Deprecated->f.TexCoordP3uiv(type, coords);
-}
-
-inline void QOpenGLFunctions_4_0_Compatibility::glTexCoordP3ui(GLenum type, GLuint coords)
-{
- d_3_3_Deprecated->f.TexCoordP3ui(type, coords);
-}
-
-inline void QOpenGLFunctions_4_0_Compatibility::glTexCoordP2uiv(GLenum type, const GLuint *coords)
-{
- d_3_3_Deprecated->f.TexCoordP2uiv(type, coords);
-}
-
-inline void QOpenGLFunctions_4_0_Compatibility::glTexCoordP2ui(GLenum type, GLuint coords)
-{
- d_3_3_Deprecated->f.TexCoordP2ui(type, coords);
-}
-
-inline void QOpenGLFunctions_4_0_Compatibility::glTexCoordP1uiv(GLenum type, const GLuint *coords)
-{
- d_3_3_Deprecated->f.TexCoordP1uiv(type, coords);
-}
-
-inline void QOpenGLFunctions_4_0_Compatibility::glTexCoordP1ui(GLenum type, GLuint coords)
-{
- d_3_3_Deprecated->f.TexCoordP1ui(type, coords);
-}
-
-inline void QOpenGLFunctions_4_0_Compatibility::glVertexP4uiv(GLenum type, const GLuint *value)
-{
- d_3_3_Deprecated->f.VertexP4uiv(type, value);
-}
-
-inline void QOpenGLFunctions_4_0_Compatibility::glVertexP4ui(GLenum type, GLuint value)
-{
- d_3_3_Deprecated->f.VertexP4ui(type, value);
-}
-
-inline void QOpenGLFunctions_4_0_Compatibility::glVertexP3uiv(GLenum type, const GLuint *value)
-{
- d_3_3_Deprecated->f.VertexP3uiv(type, value);
-}
-
-inline void QOpenGLFunctions_4_0_Compatibility::glVertexP3ui(GLenum type, GLuint value)
-{
- d_3_3_Deprecated->f.VertexP3ui(type, value);
-}
-
-inline void QOpenGLFunctions_4_0_Compatibility::glVertexP2uiv(GLenum type, const GLuint *value)
-{
- d_3_3_Deprecated->f.VertexP2uiv(type, value);
-}
-
-inline void QOpenGLFunctions_4_0_Compatibility::glVertexP2ui(GLenum type, GLuint value)
-{
- d_3_3_Deprecated->f.VertexP2ui(type, value);
-}
-
-inline void QOpenGLFunctions_4_0_Compatibility::glGetQueryObjectui64v(GLuint id, GLenum pname, GLuint64 *params)
-{
- d_3_3_Core->f.GetQueryObjectui64v(id, pname, params);
-}
-
-inline void QOpenGLFunctions_4_0_Compatibility::glGetQueryObjecti64v(GLuint id, GLenum pname, GLint64 *params)
-{
- d_3_3_Core->f.GetQueryObjecti64v(id, pname, params);
-}
-
-inline void QOpenGLFunctions_4_0_Compatibility::glQueryCounter(GLuint id, GLenum target)
-{
- d_3_3_Core->f.QueryCounter(id, target);
-}
-
-inline void QOpenGLFunctions_4_0_Compatibility::glGetSamplerParameterIuiv(GLuint sampler, GLenum pname, GLuint *params)
-{
- d_3_3_Core->f.GetSamplerParameterIuiv(sampler, pname, params);
-}
-
-inline void QOpenGLFunctions_4_0_Compatibility::glGetSamplerParameterfv(GLuint sampler, GLenum pname, GLfloat *params)
-{
- d_3_3_Core->f.GetSamplerParameterfv(sampler, pname, params);
-}
-
-inline void QOpenGLFunctions_4_0_Compatibility::glGetSamplerParameterIiv(GLuint sampler, GLenum pname, GLint *params)
-{
- d_3_3_Core->f.GetSamplerParameterIiv(sampler, pname, params);
-}
-
-inline void QOpenGLFunctions_4_0_Compatibility::glGetSamplerParameteriv(GLuint sampler, GLenum pname, GLint *params)
-{
- d_3_3_Core->f.GetSamplerParameteriv(sampler, pname, params);
-}
-
-inline void QOpenGLFunctions_4_0_Compatibility::glSamplerParameterIuiv(GLuint sampler, GLenum pname, const GLuint *param)
-{
- d_3_3_Core->f.SamplerParameterIuiv(sampler, pname, param);
-}
-
-inline void QOpenGLFunctions_4_0_Compatibility::glSamplerParameterIiv(GLuint sampler, GLenum pname, const GLint *param)
-{
- d_3_3_Core->f.SamplerParameterIiv(sampler, pname, param);
-}
-
-inline void QOpenGLFunctions_4_0_Compatibility::glSamplerParameterfv(GLuint sampler, GLenum pname, const GLfloat *param)
-{
- d_3_3_Core->f.SamplerParameterfv(sampler, pname, param);
-}
-
-inline void QOpenGLFunctions_4_0_Compatibility::glSamplerParameterf(GLuint sampler, GLenum pname, GLfloat param)
-{
- d_3_3_Core->f.SamplerParameterf(sampler, pname, param);
-}
-
-inline void QOpenGLFunctions_4_0_Compatibility::glSamplerParameteriv(GLuint sampler, GLenum pname, const GLint *param)
-{
- d_3_3_Core->f.SamplerParameteriv(sampler, pname, param);
-}
-
-inline void QOpenGLFunctions_4_0_Compatibility::glSamplerParameteri(GLuint sampler, GLenum pname, GLint param)
-{
- d_3_3_Core->f.SamplerParameteri(sampler, pname, param);
-}
-
-inline void QOpenGLFunctions_4_0_Compatibility::glBindSampler(GLuint unit, GLuint sampler)
-{
- d_3_3_Core->f.BindSampler(unit, sampler);
-}
-
-inline GLboolean QOpenGLFunctions_4_0_Compatibility::glIsSampler(GLuint sampler)
-{
- return d_3_3_Core->f.IsSampler(sampler);
-}
-
-inline void QOpenGLFunctions_4_0_Compatibility::glDeleteSamplers(GLsizei count, const GLuint *samplers)
-{
- d_3_3_Core->f.DeleteSamplers(count, samplers);
-}
-
-inline void QOpenGLFunctions_4_0_Compatibility::glGenSamplers(GLsizei count, GLuint *samplers)
-{
- d_3_3_Core->f.GenSamplers(count, samplers);
-}
-
-inline GLint QOpenGLFunctions_4_0_Compatibility::glGetFragDataIndex(GLuint program, const GLchar *name)
-{
- return d_3_3_Core->f.GetFragDataIndex(program, name);
-}
-
-inline void QOpenGLFunctions_4_0_Compatibility::glBindFragDataLocationIndexed(GLuint program, GLuint colorNumber, GLuint index, const GLchar *name)
-{
- d_3_3_Core->f.BindFragDataLocationIndexed(program, colorNumber, index, name);
-}
-
-inline void QOpenGLFunctions_4_0_Compatibility::glVertexAttribDivisor(GLuint index, GLuint divisor)
-{
- d_3_3_Core->f.VertexAttribDivisor(index, divisor);
-}
-
-
-// OpenGL 4.0 core functions
-inline void QOpenGLFunctions_4_0_Compatibility::glGetQueryIndexediv(GLenum target, GLuint index, GLenum pname, GLint *params)
-{
- d_4_0_Core->f.GetQueryIndexediv(target, index, pname, params);
-}
-
-inline void QOpenGLFunctions_4_0_Compatibility::glEndQueryIndexed(GLenum target, GLuint index)
-{
- d_4_0_Core->f.EndQueryIndexed(target, index);
-}
-
-inline void QOpenGLFunctions_4_0_Compatibility::glBeginQueryIndexed(GLenum target, GLuint index, GLuint id)
-{
- d_4_0_Core->f.BeginQueryIndexed(target, index, id);
-}
-
-inline void QOpenGLFunctions_4_0_Compatibility::glDrawTransformFeedbackStream(GLenum mode, GLuint id, GLuint stream)
-{
- d_4_0_Core->f.DrawTransformFeedbackStream(mode, id, stream);
-}
-
-inline void QOpenGLFunctions_4_0_Compatibility::glDrawTransformFeedback(GLenum mode, GLuint id)
-{
- d_4_0_Core->f.DrawTransformFeedback(mode, id);
-}
-
-inline void QOpenGLFunctions_4_0_Compatibility::glResumeTransformFeedback()
-{
- d_4_0_Core->f.ResumeTransformFeedback();
-}
-
-inline void QOpenGLFunctions_4_0_Compatibility::glPauseTransformFeedback()
-{
- d_4_0_Core->f.PauseTransformFeedback();
-}
-
-inline GLboolean QOpenGLFunctions_4_0_Compatibility::glIsTransformFeedback(GLuint id)
-{
- return d_4_0_Core->f.IsTransformFeedback(id);
-}
-
-inline void QOpenGLFunctions_4_0_Compatibility::glGenTransformFeedbacks(GLsizei n, GLuint *ids)
-{
- d_4_0_Core->f.GenTransformFeedbacks(n, ids);
-}
-
-inline void QOpenGLFunctions_4_0_Compatibility::glDeleteTransformFeedbacks(GLsizei n, const GLuint *ids)
-{
- d_4_0_Core->f.DeleteTransformFeedbacks(n, ids);
-}
-
-inline void QOpenGLFunctions_4_0_Compatibility::glBindTransformFeedback(GLenum target, GLuint id)
-{
- d_4_0_Core->f.BindTransformFeedback(target, id);
-}
-
-inline void QOpenGLFunctions_4_0_Compatibility::glPatchParameterfv(GLenum pname, const GLfloat *values)
-{
- d_4_0_Core->f.PatchParameterfv(pname, values);
-}
-
-inline void QOpenGLFunctions_4_0_Compatibility::glPatchParameteri(GLenum pname, GLint value)
-{
- d_4_0_Core->f.PatchParameteri(pname, value);
-}
-
-inline void QOpenGLFunctions_4_0_Compatibility::glGetProgramStageiv(GLuint program, GLenum shadertype, GLenum pname, GLint *values)
-{
- d_4_0_Core->f.GetProgramStageiv(program, shadertype, pname, values);
-}
-
-inline void QOpenGLFunctions_4_0_Compatibility::glGetUniformSubroutineuiv(GLenum shadertype, GLint location, GLuint *params)
-{
- d_4_0_Core->f.GetUniformSubroutineuiv(shadertype, location, params);
-}
-
-inline void QOpenGLFunctions_4_0_Compatibility::glUniformSubroutinesuiv(GLenum shadertype, GLsizei count, const GLuint *indices)
-{
- d_4_0_Core->f.UniformSubroutinesuiv(shadertype, count, indices);
-}
-
-inline void QOpenGLFunctions_4_0_Compatibility::glGetActiveSubroutineName(GLuint program, GLenum shadertype, GLuint index, GLsizei bufsize, GLsizei *length, GLchar *name)
-{
- d_4_0_Core->f.GetActiveSubroutineName(program, shadertype, index, bufsize, length, name);
-}
-
-inline void QOpenGLFunctions_4_0_Compatibility::glGetActiveSubroutineUniformName(GLuint program, GLenum shadertype, GLuint index, GLsizei bufsize, GLsizei *length, GLchar *name)
-{
- d_4_0_Core->f.GetActiveSubroutineUniformName(program, shadertype, index, bufsize, length, name);
-}
-
-inline void QOpenGLFunctions_4_0_Compatibility::glGetActiveSubroutineUniformiv(GLuint program, GLenum shadertype, GLuint index, GLenum pname, GLint *values)
-{
- d_4_0_Core->f.GetActiveSubroutineUniformiv(program, shadertype, index, pname, values);
-}
-
-inline GLuint QOpenGLFunctions_4_0_Compatibility::glGetSubroutineIndex(GLuint program, GLenum shadertype, const GLchar *name)
-{
- return d_4_0_Core->f.GetSubroutineIndex(program, shadertype, name);
-}
-
-inline GLint QOpenGLFunctions_4_0_Compatibility::glGetSubroutineUniformLocation(GLuint program, GLenum shadertype, const GLchar *name)
-{
- return d_4_0_Core->f.GetSubroutineUniformLocation(program, shadertype, name);
-}
-
-inline void QOpenGLFunctions_4_0_Compatibility::glGetUniformdv(GLuint program, GLint location, GLdouble *params)
-{
- d_4_0_Core->f.GetUniformdv(program, location, params);
-}
-
-inline void QOpenGLFunctions_4_0_Compatibility::glUniformMatrix4x3dv(GLint location, GLsizei count, GLboolean transpose, const GLdouble *value)
-{
- d_4_0_Core->f.UniformMatrix4x3dv(location, count, transpose, value);
-}
-
-inline void QOpenGLFunctions_4_0_Compatibility::glUniformMatrix4x2dv(GLint location, GLsizei count, GLboolean transpose, const GLdouble *value)
-{
- d_4_0_Core->f.UniformMatrix4x2dv(location, count, transpose, value);
-}
-
-inline void QOpenGLFunctions_4_0_Compatibility::glUniformMatrix3x4dv(GLint location, GLsizei count, GLboolean transpose, const GLdouble *value)
-{
- d_4_0_Core->f.UniformMatrix3x4dv(location, count, transpose, value);
-}
-
-inline void QOpenGLFunctions_4_0_Compatibility::glUniformMatrix3x2dv(GLint location, GLsizei count, GLboolean transpose, const GLdouble *value)
-{
- d_4_0_Core->f.UniformMatrix3x2dv(location, count, transpose, value);
-}
-
-inline void QOpenGLFunctions_4_0_Compatibility::glUniformMatrix2x4dv(GLint location, GLsizei count, GLboolean transpose, const GLdouble *value)
-{
- d_4_0_Core->f.UniformMatrix2x4dv(location, count, transpose, value);
-}
-
-inline void QOpenGLFunctions_4_0_Compatibility::glUniformMatrix2x3dv(GLint location, GLsizei count, GLboolean transpose, const GLdouble *value)
-{
- d_4_0_Core->f.UniformMatrix2x3dv(location, count, transpose, value);
-}
-
-inline void QOpenGLFunctions_4_0_Compatibility::glUniformMatrix4dv(GLint location, GLsizei count, GLboolean transpose, const GLdouble *value)
-{
- d_4_0_Core->f.UniformMatrix4dv(location, count, transpose, value);
-}
-
-inline void QOpenGLFunctions_4_0_Compatibility::glUniformMatrix3dv(GLint location, GLsizei count, GLboolean transpose, const GLdouble *value)
-{
- d_4_0_Core->f.UniformMatrix3dv(location, count, transpose, value);
-}
-
-inline void QOpenGLFunctions_4_0_Compatibility::glUniformMatrix2dv(GLint location, GLsizei count, GLboolean transpose, const GLdouble *value)
-{
- d_4_0_Core->f.UniformMatrix2dv(location, count, transpose, value);
-}
-
-inline void QOpenGLFunctions_4_0_Compatibility::glUniform4dv(GLint location, GLsizei count, const GLdouble *value)
-{
- d_4_0_Core->f.Uniform4dv(location, count, value);
-}
-
-inline void QOpenGLFunctions_4_0_Compatibility::glUniform3dv(GLint location, GLsizei count, const GLdouble *value)
-{
- d_4_0_Core->f.Uniform3dv(location, count, value);
-}
-
-inline void QOpenGLFunctions_4_0_Compatibility::glUniform2dv(GLint location, GLsizei count, const GLdouble *value)
-{
- d_4_0_Core->f.Uniform2dv(location, count, value);
-}
-
-inline void QOpenGLFunctions_4_0_Compatibility::glUniform1dv(GLint location, GLsizei count, const GLdouble *value)
-{
- d_4_0_Core->f.Uniform1dv(location, count, value);
-}
-
-inline void QOpenGLFunctions_4_0_Compatibility::glUniform4d(GLint location, GLdouble x, GLdouble y, GLdouble z, GLdouble w)
-{
- d_4_0_Core->f.Uniform4d(location, x, y, z, w);
-}
-
-inline void QOpenGLFunctions_4_0_Compatibility::glUniform3d(GLint location, GLdouble x, GLdouble y, GLdouble z)
-{
- d_4_0_Core->f.Uniform3d(location, x, y, z);
-}
-
-inline void QOpenGLFunctions_4_0_Compatibility::glUniform2d(GLint location, GLdouble x, GLdouble y)
-{
- d_4_0_Core->f.Uniform2d(location, x, y);
-}
-
-inline void QOpenGLFunctions_4_0_Compatibility::glUniform1d(GLint location, GLdouble x)
-{
- d_4_0_Core->f.Uniform1d(location, x);
-}
-
-inline void QOpenGLFunctions_4_0_Compatibility::glDrawElementsIndirect(GLenum mode, GLenum type, const GLvoid *indirect)
-{
- d_4_0_Core->f.DrawElementsIndirect(mode, type, indirect);
-}
-
-inline void QOpenGLFunctions_4_0_Compatibility::glDrawArraysIndirect(GLenum mode, const GLvoid *indirect)
-{
- d_4_0_Core->f.DrawArraysIndirect(mode, indirect);
-}
-
-inline void QOpenGLFunctions_4_0_Compatibility::glBlendFuncSeparatei(GLuint buf, GLenum srcRGB, GLenum dstRGB, GLenum srcAlpha, GLenum dstAlpha)
-{
- d_4_0_Core->f.BlendFuncSeparatei(buf, srcRGB, dstRGB, srcAlpha, dstAlpha);
-}
-
-inline void QOpenGLFunctions_4_0_Compatibility::glBlendFunci(GLuint buf, GLenum src, GLenum dst)
-{
- d_4_0_Core->f.BlendFunci(buf, src, dst);
-}
-
-inline void QOpenGLFunctions_4_0_Compatibility::glBlendEquationSeparatei(GLuint buf, GLenum modeRGB, GLenum modeAlpha)
-{
- d_4_0_Core->f.BlendEquationSeparatei(buf, modeRGB, modeAlpha);
-}
-
-inline void QOpenGLFunctions_4_0_Compatibility::glBlendEquationi(GLuint buf, GLenum mode)
-{
- d_4_0_Core->f.BlendEquationi(buf, mode);
-}
-
-inline void QOpenGLFunctions_4_0_Compatibility::glMinSampleShading(GLfloat value)
-{
- d_4_0_Core->f.MinSampleShading(value);
-}
-
-
-// OpenGL 1.0 deprecated functions
-inline void QOpenGLFunctions_4_0_Compatibility::glTranslatef(GLfloat x, GLfloat y, GLfloat z)
-{
- d_1_0_Deprecated->f.Translatef(x, y, z);
-}
-
-inline void QOpenGLFunctions_4_0_Compatibility::glTranslated(GLdouble x, GLdouble y, GLdouble z)
-{
- d_1_0_Deprecated->f.Translated(x, y, z);
-}
-
-inline void QOpenGLFunctions_4_0_Compatibility::glScalef(GLfloat x, GLfloat y, GLfloat z)
-{
- d_1_0_Deprecated->f.Scalef(x, y, z);
-}
-
-inline void QOpenGLFunctions_4_0_Compatibility::glScaled(GLdouble x, GLdouble y, GLdouble z)
-{
- d_1_0_Deprecated->f.Scaled(x, y, z);
-}
-
-inline void QOpenGLFunctions_4_0_Compatibility::glRotatef(GLfloat angle, GLfloat x, GLfloat y, GLfloat z)
-{
- d_1_0_Deprecated->f.Rotatef(angle, x, y, z);
-}
-
-inline void QOpenGLFunctions_4_0_Compatibility::glRotated(GLdouble angle, GLdouble x, GLdouble y, GLdouble z)
-{
- d_1_0_Deprecated->f.Rotated(angle, x, y, z);
-}
-
-inline void QOpenGLFunctions_4_0_Compatibility::glPushMatrix()
-{
- d_1_0_Deprecated->f.PushMatrix();
-}
-
-inline void QOpenGLFunctions_4_0_Compatibility::glPopMatrix()
-{
- d_1_0_Deprecated->f.PopMatrix();
-}
-
-inline void QOpenGLFunctions_4_0_Compatibility::glOrtho(GLdouble left, GLdouble right, GLdouble bottom, GLdouble top, GLdouble zNear, GLdouble zFar)
-{
- d_1_0_Deprecated->f.Ortho(left, right, bottom, top, zNear, zFar);
-}
-
-inline void QOpenGLFunctions_4_0_Compatibility::glMultMatrixd(const GLdouble *m)
-{
- d_1_0_Deprecated->f.MultMatrixd(m);
-}
-
-inline void QOpenGLFunctions_4_0_Compatibility::glMultMatrixf(const GLfloat *m)
-{
- d_1_0_Deprecated->f.MultMatrixf(m);
-}
-
-inline void QOpenGLFunctions_4_0_Compatibility::glMatrixMode(GLenum mode)
-{
- d_1_0_Deprecated->f.MatrixMode(mode);
-}
-
-inline void QOpenGLFunctions_4_0_Compatibility::glLoadMatrixd(const GLdouble *m)
-{
- d_1_0_Deprecated->f.LoadMatrixd(m);
-}
-
-inline void QOpenGLFunctions_4_0_Compatibility::glLoadMatrixf(const GLfloat *m)
-{
- d_1_0_Deprecated->f.LoadMatrixf(m);
-}
-
-inline void QOpenGLFunctions_4_0_Compatibility::glLoadIdentity()
-{
- d_1_0_Deprecated->f.LoadIdentity();
-}
-
-inline void QOpenGLFunctions_4_0_Compatibility::glFrustum(GLdouble left, GLdouble right, GLdouble bottom, GLdouble top, GLdouble zNear, GLdouble zFar)
-{
- d_1_0_Deprecated->f.Frustum(left, right, bottom, top, zNear, zFar);
-}
-
-inline GLboolean QOpenGLFunctions_4_0_Compatibility::glIsList(GLuint list)
-{
- return d_1_0_Deprecated->f.IsList(list);
-}
-
-inline void QOpenGLFunctions_4_0_Compatibility::glGetTexGeniv(GLenum coord, GLenum pname, GLint *params)
-{
- d_1_0_Deprecated->f.GetTexGeniv(coord, pname, params);
-}
-
-inline void QOpenGLFunctions_4_0_Compatibility::glGetTexGenfv(GLenum coord, GLenum pname, GLfloat *params)
-{
- d_1_0_Deprecated->f.GetTexGenfv(coord, pname, params);
-}
-
-inline void QOpenGLFunctions_4_0_Compatibility::glGetTexGendv(GLenum coord, GLenum pname, GLdouble *params)
-{
- d_1_0_Deprecated->f.GetTexGendv(coord, pname, params);
-}
-
-inline void QOpenGLFunctions_4_0_Compatibility::glGetTexEnviv(GLenum target, GLenum pname, GLint *params)
-{
- d_1_0_Deprecated->f.GetTexEnviv(target, pname, params);
-}
-
-inline void QOpenGLFunctions_4_0_Compatibility::glGetTexEnvfv(GLenum target, GLenum pname, GLfloat *params)
-{
- d_1_0_Deprecated->f.GetTexEnvfv(target, pname, params);
-}
-
-inline void QOpenGLFunctions_4_0_Compatibility::glGetPolygonStipple(GLubyte *mask)
-{
- d_1_0_Deprecated->f.GetPolygonStipple(mask);
-}
-
-inline void QOpenGLFunctions_4_0_Compatibility::glGetPixelMapusv(GLenum map, GLushort *values)
-{
- d_1_0_Deprecated->f.GetPixelMapusv(map, values);
-}
-
-inline void QOpenGLFunctions_4_0_Compatibility::glGetPixelMapuiv(GLenum map, GLuint *values)
-{
- d_1_0_Deprecated->f.GetPixelMapuiv(map, values);
-}
-
-inline void QOpenGLFunctions_4_0_Compatibility::glGetPixelMapfv(GLenum map, GLfloat *values)
-{
- d_1_0_Deprecated->f.GetPixelMapfv(map, values);
-}
-
-inline void QOpenGLFunctions_4_0_Compatibility::glGetMaterialiv(GLenum face, GLenum pname, GLint *params)
-{
- d_1_0_Deprecated->f.GetMaterialiv(face, pname, params);
-}
-
-inline void QOpenGLFunctions_4_0_Compatibility::glGetMaterialfv(GLenum face, GLenum pname, GLfloat *params)
-{
- d_1_0_Deprecated->f.GetMaterialfv(face, pname, params);
-}
-
-inline void QOpenGLFunctions_4_0_Compatibility::glGetMapiv(GLenum target, GLenum query, GLint *v)
-{
- d_1_0_Deprecated->f.GetMapiv(target, query, v);
-}
-
-inline void QOpenGLFunctions_4_0_Compatibility::glGetMapfv(GLenum target, GLenum query, GLfloat *v)
-{
- d_1_0_Deprecated->f.GetMapfv(target, query, v);
-}
-
-inline void QOpenGLFunctions_4_0_Compatibility::glGetMapdv(GLenum target, GLenum query, GLdouble *v)
-{
- d_1_0_Deprecated->f.GetMapdv(target, query, v);
-}
-
-inline void QOpenGLFunctions_4_0_Compatibility::glGetLightiv(GLenum light, GLenum pname, GLint *params)
-{
- d_1_0_Deprecated->f.GetLightiv(light, pname, params);
-}
-
-inline void QOpenGLFunctions_4_0_Compatibility::glGetLightfv(GLenum light, GLenum pname, GLfloat *params)
-{
- d_1_0_Deprecated->f.GetLightfv(light, pname, params);
-}
-
-inline void QOpenGLFunctions_4_0_Compatibility::glGetClipPlane(GLenum plane, GLdouble *equation)
-{
- d_1_0_Deprecated->f.GetClipPlane(plane, equation);
-}
-
-inline void QOpenGLFunctions_4_0_Compatibility::glDrawPixels(GLsizei width, GLsizei height, GLenum format, GLenum type, const GLvoid *pixels)
-{
- d_1_0_Deprecated->f.DrawPixels(width, height, format, type, pixels);
-}
-
-inline void QOpenGLFunctions_4_0_Compatibility::glCopyPixels(GLint x, GLint y, GLsizei width, GLsizei height, GLenum type)
-{
- d_1_0_Deprecated->f.CopyPixels(x, y, width, height, type);
-}
-
-inline void QOpenGLFunctions_4_0_Compatibility::glPixelMapusv(GLenum map, GLint mapsize, const GLushort *values)
-{
- d_1_0_Deprecated->f.PixelMapusv(map, mapsize, values);
-}
-
-inline void QOpenGLFunctions_4_0_Compatibility::glPixelMapuiv(GLenum map, GLint mapsize, const GLuint *values)
-{
- d_1_0_Deprecated->f.PixelMapuiv(map, mapsize, values);
-}
-
-inline void QOpenGLFunctions_4_0_Compatibility::glPixelMapfv(GLenum map, GLint mapsize, const GLfloat *values)
-{
- d_1_0_Deprecated->f.PixelMapfv(map, mapsize, values);
-}
-
-inline void QOpenGLFunctions_4_0_Compatibility::glPixelTransferi(GLenum pname, GLint param)
-{
- d_1_0_Deprecated->f.PixelTransferi(pname, param);
-}
-
-inline void QOpenGLFunctions_4_0_Compatibility::glPixelTransferf(GLenum pname, GLfloat param)
-{
- d_1_0_Deprecated->f.PixelTransferf(pname, param);
-}
-
-inline void QOpenGLFunctions_4_0_Compatibility::glPixelZoom(GLfloat xfactor, GLfloat yfactor)
-{
- d_1_0_Deprecated->f.PixelZoom(xfactor, yfactor);
-}
-
-inline void QOpenGLFunctions_4_0_Compatibility::glAlphaFunc(GLenum func, GLfloat ref)
-{
- d_1_0_Deprecated->f.AlphaFunc(func, ref);
-}
-
-inline void QOpenGLFunctions_4_0_Compatibility::glEvalPoint2(GLint i, GLint j)
-{
- d_1_0_Deprecated->f.EvalPoint2(i, j);
-}
-
-inline void QOpenGLFunctions_4_0_Compatibility::glEvalMesh2(GLenum mode, GLint i1, GLint i2, GLint j1, GLint j2)
-{
- d_1_0_Deprecated->f.EvalMesh2(mode, i1, i2, j1, j2);
-}
-
-inline void QOpenGLFunctions_4_0_Compatibility::glEvalPoint1(GLint i)
-{
- d_1_0_Deprecated->f.EvalPoint1(i);
-}
-
-inline void QOpenGLFunctions_4_0_Compatibility::glEvalMesh1(GLenum mode, GLint i1, GLint i2)
-{
- d_1_0_Deprecated->f.EvalMesh1(mode, i1, i2);
-}
-
-inline void QOpenGLFunctions_4_0_Compatibility::glEvalCoord2fv(const GLfloat *u)
-{
- d_1_0_Deprecated->f.EvalCoord2fv(u);
-}
-
-inline void QOpenGLFunctions_4_0_Compatibility::glEvalCoord2f(GLfloat u, GLfloat v)
-{
- d_1_0_Deprecated->f.EvalCoord2f(u, v);
-}
-
-inline void QOpenGLFunctions_4_0_Compatibility::glEvalCoord2dv(const GLdouble *u)
-{
- d_1_0_Deprecated->f.EvalCoord2dv(u);
-}
-
-inline void QOpenGLFunctions_4_0_Compatibility::glEvalCoord2d(GLdouble u, GLdouble v)
-{
- d_1_0_Deprecated->f.EvalCoord2d(u, v);
-}
-
-inline void QOpenGLFunctions_4_0_Compatibility::glEvalCoord1fv(const GLfloat *u)
-{
- d_1_0_Deprecated->f.EvalCoord1fv(u);
-}
-
-inline void QOpenGLFunctions_4_0_Compatibility::glEvalCoord1f(GLfloat u)
-{
- d_1_0_Deprecated->f.EvalCoord1f(u);
-}
-
-inline void QOpenGLFunctions_4_0_Compatibility::glEvalCoord1dv(const GLdouble *u)
-{
- d_1_0_Deprecated->f.EvalCoord1dv(u);
-}
-
-inline void QOpenGLFunctions_4_0_Compatibility::glEvalCoord1d(GLdouble u)
-{
- d_1_0_Deprecated->f.EvalCoord1d(u);
-}
-
-inline void QOpenGLFunctions_4_0_Compatibility::glMapGrid2f(GLint un, GLfloat u1, GLfloat u2, GLint vn, GLfloat v1, GLfloat v2)
-{
- d_1_0_Deprecated->f.MapGrid2f(un, u1, u2, vn, v1, v2);
-}
-
-inline void QOpenGLFunctions_4_0_Compatibility::glMapGrid2d(GLint un, GLdouble u1, GLdouble u2, GLint vn, GLdouble v1, GLdouble v2)
-{
- d_1_0_Deprecated->f.MapGrid2d(un, u1, u2, vn, v1, v2);
-}
-
-inline void QOpenGLFunctions_4_0_Compatibility::glMapGrid1f(GLint un, GLfloat u1, GLfloat u2)
-{
- d_1_0_Deprecated->f.MapGrid1f(un, u1, u2);
-}
-
-inline void QOpenGLFunctions_4_0_Compatibility::glMapGrid1d(GLint un, GLdouble u1, GLdouble u2)
-{
- d_1_0_Deprecated->f.MapGrid1d(un, u1, u2);
-}
-
-inline void QOpenGLFunctions_4_0_Compatibility::glMap2f(GLenum target, GLfloat u1, GLfloat u2, GLint ustride, GLint uorder, GLfloat v1, GLfloat v2, GLint vstride, GLint vorder, const GLfloat *points)
-{
- d_1_0_Deprecated->f.Map2f(target, u1, u2, ustride, uorder, v1, v2, vstride, vorder, points);
-}
-
-inline void QOpenGLFunctions_4_0_Compatibility::glMap2d(GLenum target, GLdouble u1, GLdouble u2, GLint ustride, GLint uorder, GLdouble v1, GLdouble v2, GLint vstride, GLint vorder, const GLdouble *points)
-{
- d_1_0_Deprecated->f.Map2d(target, u1, u2, ustride, uorder, v1, v2, vstride, vorder, points);
-}
-
-inline void QOpenGLFunctions_4_0_Compatibility::glMap1f(GLenum target, GLfloat u1, GLfloat u2, GLint stride, GLint order, const GLfloat *points)
-{
- d_1_0_Deprecated->f.Map1f(target, u1, u2, stride, order, points);
-}
-
-inline void QOpenGLFunctions_4_0_Compatibility::glMap1d(GLenum target, GLdouble u1, GLdouble u2, GLint stride, GLint order, const GLdouble *points)
-{
- d_1_0_Deprecated->f.Map1d(target, u1, u2, stride, order, points);
-}
-
-inline void QOpenGLFunctions_4_0_Compatibility::glPushAttrib(GLbitfield mask)
-{
- d_1_0_Deprecated->f.PushAttrib(mask);
-}
-
-inline void QOpenGLFunctions_4_0_Compatibility::glPopAttrib()
-{
- d_1_0_Deprecated->f.PopAttrib();
-}
-
-inline void QOpenGLFunctions_4_0_Compatibility::glAccum(GLenum op, GLfloat value)
-{
- d_1_0_Deprecated->f.Accum(op, value);
-}
-
-inline void QOpenGLFunctions_4_0_Compatibility::glIndexMask(GLuint mask)
-{
- d_1_0_Deprecated->f.IndexMask(mask);
-}
-
-inline void QOpenGLFunctions_4_0_Compatibility::glClearIndex(GLfloat c)
-{
- d_1_0_Deprecated->f.ClearIndex(c);
-}
-
-inline void QOpenGLFunctions_4_0_Compatibility::glClearAccum(GLfloat red, GLfloat green, GLfloat blue, GLfloat alpha)
-{
- d_1_0_Deprecated->f.ClearAccum(red, green, blue, alpha);
-}
-
-inline void QOpenGLFunctions_4_0_Compatibility::glPushName(GLuint name)
-{
- d_1_0_Deprecated->f.PushName(name);
-}
-
-inline void QOpenGLFunctions_4_0_Compatibility::glPopName()
-{
- d_1_0_Deprecated->f.PopName();
-}
-
-inline void QOpenGLFunctions_4_0_Compatibility::glPassThrough(GLfloat token)
-{
- d_1_0_Deprecated->f.PassThrough(token);
-}
-
-inline void QOpenGLFunctions_4_0_Compatibility::glLoadName(GLuint name)
-{
- d_1_0_Deprecated->f.LoadName(name);
-}
-
-inline void QOpenGLFunctions_4_0_Compatibility::glInitNames()
-{
- d_1_0_Deprecated->f.InitNames();
-}
-
-inline GLint QOpenGLFunctions_4_0_Compatibility::glRenderMode(GLenum mode)
-{
- return d_1_0_Deprecated->f.RenderMode(mode);
-}
-
-inline void QOpenGLFunctions_4_0_Compatibility::glSelectBuffer(GLsizei size, GLuint *buffer)
-{
- d_1_0_Deprecated->f.SelectBuffer(size, buffer);
-}
-
-inline void QOpenGLFunctions_4_0_Compatibility::glFeedbackBuffer(GLsizei size, GLenum type, GLfloat *buffer)
-{
- d_1_0_Deprecated->f.FeedbackBuffer(size, type, buffer);
-}
-
-inline void QOpenGLFunctions_4_0_Compatibility::glTexGeniv(GLenum coord, GLenum pname, const GLint *params)
-{
- d_1_0_Deprecated->f.TexGeniv(coord, pname, params);
-}
-
-inline void QOpenGLFunctions_4_0_Compatibility::glTexGeni(GLenum coord, GLenum pname, GLint param)
-{
- d_1_0_Deprecated->f.TexGeni(coord, pname, param);
-}
-
-inline void QOpenGLFunctions_4_0_Compatibility::glTexGenfv(GLenum coord, GLenum pname, const GLfloat *params)
-{
- d_1_0_Deprecated->f.TexGenfv(coord, pname, params);
-}
-
-inline void QOpenGLFunctions_4_0_Compatibility::glTexGenf(GLenum coord, GLenum pname, GLfloat param)
-{
- d_1_0_Deprecated->f.TexGenf(coord, pname, param);
-}
-
-inline void QOpenGLFunctions_4_0_Compatibility::glTexGendv(GLenum coord, GLenum pname, const GLdouble *params)
-{
- d_1_0_Deprecated->f.TexGendv(coord, pname, params);
-}
-
-inline void QOpenGLFunctions_4_0_Compatibility::glTexGend(GLenum coord, GLenum pname, GLdouble param)
-{
- d_1_0_Deprecated->f.TexGend(coord, pname, param);
-}
-
-inline void QOpenGLFunctions_4_0_Compatibility::glTexEnviv(GLenum target, GLenum pname, const GLint *params)
-{
- d_1_0_Deprecated->f.TexEnviv(target, pname, params);
-}
-
-inline void QOpenGLFunctions_4_0_Compatibility::glTexEnvi(GLenum target, GLenum pname, GLint param)
-{
- d_1_0_Deprecated->f.TexEnvi(target, pname, param);
-}
-
-inline void QOpenGLFunctions_4_0_Compatibility::glTexEnvfv(GLenum target, GLenum pname, const GLfloat *params)
-{
- d_1_0_Deprecated->f.TexEnvfv(target, pname, params);
-}
-
-inline void QOpenGLFunctions_4_0_Compatibility::glTexEnvf(GLenum target, GLenum pname, GLfloat param)
-{
- d_1_0_Deprecated->f.TexEnvf(target, pname, param);
-}
-
-inline void QOpenGLFunctions_4_0_Compatibility::glShadeModel(GLenum mode)
-{
- d_1_0_Deprecated->f.ShadeModel(mode);
-}
-
-inline void QOpenGLFunctions_4_0_Compatibility::glPolygonStipple(const GLubyte *mask)
-{
- d_1_0_Deprecated->f.PolygonStipple(mask);
-}
-
-inline void QOpenGLFunctions_4_0_Compatibility::glMaterialiv(GLenum face, GLenum pname, const GLint *params)
-{
- d_1_0_Deprecated->f.Materialiv(face, pname, params);
-}
-
-inline void QOpenGLFunctions_4_0_Compatibility::glMateriali(GLenum face, GLenum pname, GLint param)
-{
- d_1_0_Deprecated->f.Materiali(face, pname, param);
-}
-
-inline void QOpenGLFunctions_4_0_Compatibility::glMaterialfv(GLenum face, GLenum pname, const GLfloat *params)
-{
- d_1_0_Deprecated->f.Materialfv(face, pname, params);
-}
-
-inline void QOpenGLFunctions_4_0_Compatibility::glMaterialf(GLenum face, GLenum pname, GLfloat param)
-{
- d_1_0_Deprecated->f.Materialf(face, pname, param);
-}
-
-inline void QOpenGLFunctions_4_0_Compatibility::glLineStipple(GLint factor, GLushort pattern)
-{
- d_1_0_Deprecated->f.LineStipple(factor, pattern);
-}
-
-inline void QOpenGLFunctions_4_0_Compatibility::glLightModeliv(GLenum pname, const GLint *params)
-{
- d_1_0_Deprecated->f.LightModeliv(pname, params);
-}
-
-inline void QOpenGLFunctions_4_0_Compatibility::glLightModeli(GLenum pname, GLint param)
-{
- d_1_0_Deprecated->f.LightModeli(pname, param);
-}
-
-inline void QOpenGLFunctions_4_0_Compatibility::glLightModelfv(GLenum pname, const GLfloat *params)
-{
- d_1_0_Deprecated->f.LightModelfv(pname, params);
-}
-
-inline void QOpenGLFunctions_4_0_Compatibility::glLightModelf(GLenum pname, GLfloat param)
-{
- d_1_0_Deprecated->f.LightModelf(pname, param);
-}
-
-inline void QOpenGLFunctions_4_0_Compatibility::glLightiv(GLenum light, GLenum pname, const GLint *params)
-{
- d_1_0_Deprecated->f.Lightiv(light, pname, params);
-}
-
-inline void QOpenGLFunctions_4_0_Compatibility::glLighti(GLenum light, GLenum pname, GLint param)
-{
- d_1_0_Deprecated->f.Lighti(light, pname, param);
-}
-
-inline void QOpenGLFunctions_4_0_Compatibility::glLightfv(GLenum light, GLenum pname, const GLfloat *params)
-{
- d_1_0_Deprecated->f.Lightfv(light, pname, params);
-}
-
-inline void QOpenGLFunctions_4_0_Compatibility::glLightf(GLenum light, GLenum pname, GLfloat param)
-{
- d_1_0_Deprecated->f.Lightf(light, pname, param);
-}
-
-inline void QOpenGLFunctions_4_0_Compatibility::glFogiv(GLenum pname, const GLint *params)
-{
- d_1_0_Deprecated->f.Fogiv(pname, params);
-}
-
-inline void QOpenGLFunctions_4_0_Compatibility::glFogi(GLenum pname, GLint param)
-{
- d_1_0_Deprecated->f.Fogi(pname, param);
-}
-
-inline void QOpenGLFunctions_4_0_Compatibility::glFogfv(GLenum pname, const GLfloat *params)
-{
- d_1_0_Deprecated->f.Fogfv(pname, params);
-}
-
-inline void QOpenGLFunctions_4_0_Compatibility::glFogf(GLenum pname, GLfloat param)
-{
- d_1_0_Deprecated->f.Fogf(pname, param);
-}
-
-inline void QOpenGLFunctions_4_0_Compatibility::glColorMaterial(GLenum face, GLenum mode)
-{
- d_1_0_Deprecated->f.ColorMaterial(face, mode);
-}
-
-inline void QOpenGLFunctions_4_0_Compatibility::glClipPlane(GLenum plane, const GLdouble *equation)
-{
- d_1_0_Deprecated->f.ClipPlane(plane, equation);
-}
-
-inline void QOpenGLFunctions_4_0_Compatibility::glVertex4sv(const GLshort *v)
-{
- d_1_0_Deprecated->f.Vertex4sv(v);
-}
-
-inline void QOpenGLFunctions_4_0_Compatibility::glVertex4s(GLshort x, GLshort y, GLshort z, GLshort w)
-{
- d_1_0_Deprecated->f.Vertex4s(x, y, z, w);
-}
-
-inline void QOpenGLFunctions_4_0_Compatibility::glVertex4iv(const GLint *v)
-{
- d_1_0_Deprecated->f.Vertex4iv(v);
-}
-
-inline void QOpenGLFunctions_4_0_Compatibility::glVertex4i(GLint x, GLint y, GLint z, GLint w)
-{
- d_1_0_Deprecated->f.Vertex4i(x, y, z, w);
-}
-
-inline void QOpenGLFunctions_4_0_Compatibility::glVertex4fv(const GLfloat *v)
-{
- d_1_0_Deprecated->f.Vertex4fv(v);
-}
-
-inline void QOpenGLFunctions_4_0_Compatibility::glVertex4f(GLfloat x, GLfloat y, GLfloat z, GLfloat w)
-{
- d_1_0_Deprecated->f.Vertex4f(x, y, z, w);
-}
-
-inline void QOpenGLFunctions_4_0_Compatibility::glVertex4dv(const GLdouble *v)
-{
- d_1_0_Deprecated->f.Vertex4dv(v);
-}
-
-inline void QOpenGLFunctions_4_0_Compatibility::glVertex4d(GLdouble x, GLdouble y, GLdouble z, GLdouble w)
-{
- d_1_0_Deprecated->f.Vertex4d(x, y, z, w);
-}
-
-inline void QOpenGLFunctions_4_0_Compatibility::glVertex3sv(const GLshort *v)
-{
- d_1_0_Deprecated->f.Vertex3sv(v);
-}
-
-inline void QOpenGLFunctions_4_0_Compatibility::glVertex3s(GLshort x, GLshort y, GLshort z)
-{
- d_1_0_Deprecated->f.Vertex3s(x, y, z);
-}
-
-inline void QOpenGLFunctions_4_0_Compatibility::glVertex3iv(const GLint *v)
-{
- d_1_0_Deprecated->f.Vertex3iv(v);
-}
-
-inline void QOpenGLFunctions_4_0_Compatibility::glVertex3i(GLint x, GLint y, GLint z)
-{
- d_1_0_Deprecated->f.Vertex3i(x, y, z);
-}
-
-inline void QOpenGLFunctions_4_0_Compatibility::glVertex3fv(const GLfloat *v)
-{
- d_1_0_Deprecated->f.Vertex3fv(v);
-}
-
-inline void QOpenGLFunctions_4_0_Compatibility::glVertex3f(GLfloat x, GLfloat y, GLfloat z)
-{
- d_1_0_Deprecated->f.Vertex3f(x, y, z);
-}
-
-inline void QOpenGLFunctions_4_0_Compatibility::glVertex3dv(const GLdouble *v)
-{
- d_1_0_Deprecated->f.Vertex3dv(v);
-}
-
-inline void QOpenGLFunctions_4_0_Compatibility::glVertex3d(GLdouble x, GLdouble y, GLdouble z)
-{
- d_1_0_Deprecated->f.Vertex3d(x, y, z);
-}
-
-inline void QOpenGLFunctions_4_0_Compatibility::glVertex2sv(const GLshort *v)
-{
- d_1_0_Deprecated->f.Vertex2sv(v);
-}
-
-inline void QOpenGLFunctions_4_0_Compatibility::glVertex2s(GLshort x, GLshort y)
-{
- d_1_0_Deprecated->f.Vertex2s(x, y);
-}
-
-inline void QOpenGLFunctions_4_0_Compatibility::glVertex2iv(const GLint *v)
-{
- d_1_0_Deprecated->f.Vertex2iv(v);
-}
-
-inline void QOpenGLFunctions_4_0_Compatibility::glVertex2i(GLint x, GLint y)
-{
- d_1_0_Deprecated->f.Vertex2i(x, y);
-}
-
-inline void QOpenGLFunctions_4_0_Compatibility::glVertex2fv(const GLfloat *v)
-{
- d_1_0_Deprecated->f.Vertex2fv(v);
-}
-
-inline void QOpenGLFunctions_4_0_Compatibility::glVertex2f(GLfloat x, GLfloat y)
-{
- d_1_0_Deprecated->f.Vertex2f(x, y);
-}
-
-inline void QOpenGLFunctions_4_0_Compatibility::glVertex2dv(const GLdouble *v)
-{
- d_1_0_Deprecated->f.Vertex2dv(v);
-}
-
-inline void QOpenGLFunctions_4_0_Compatibility::glVertex2d(GLdouble x, GLdouble y)
-{
- d_1_0_Deprecated->f.Vertex2d(x, y);
-}
-
-inline void QOpenGLFunctions_4_0_Compatibility::glTexCoord4sv(const GLshort *v)
-{
- d_1_0_Deprecated->f.TexCoord4sv(v);
-}
-
-inline void QOpenGLFunctions_4_0_Compatibility::glTexCoord4s(GLshort s, GLshort t, GLshort r, GLshort q)
-{
- d_1_0_Deprecated->f.TexCoord4s(s, t, r, q);
-}
-
-inline void QOpenGLFunctions_4_0_Compatibility::glTexCoord4iv(const GLint *v)
-{
- d_1_0_Deprecated->f.TexCoord4iv(v);
-}
-
-inline void QOpenGLFunctions_4_0_Compatibility::glTexCoord4i(GLint s, GLint t, GLint r, GLint q)
-{
- d_1_0_Deprecated->f.TexCoord4i(s, t, r, q);
-}
-
-inline void QOpenGLFunctions_4_0_Compatibility::glTexCoord4fv(const GLfloat *v)
-{
- d_1_0_Deprecated->f.TexCoord4fv(v);
-}
-
-inline void QOpenGLFunctions_4_0_Compatibility::glTexCoord4f(GLfloat s, GLfloat t, GLfloat r, GLfloat q)
-{
- d_1_0_Deprecated->f.TexCoord4f(s, t, r, q);
-}
-
-inline void QOpenGLFunctions_4_0_Compatibility::glTexCoord4dv(const GLdouble *v)
-{
- d_1_0_Deprecated->f.TexCoord4dv(v);
-}
-
-inline void QOpenGLFunctions_4_0_Compatibility::glTexCoord4d(GLdouble s, GLdouble t, GLdouble r, GLdouble q)
-{
- d_1_0_Deprecated->f.TexCoord4d(s, t, r, q);
-}
-
-inline void QOpenGLFunctions_4_0_Compatibility::glTexCoord3sv(const GLshort *v)
-{
- d_1_0_Deprecated->f.TexCoord3sv(v);
-}
-
-inline void QOpenGLFunctions_4_0_Compatibility::glTexCoord3s(GLshort s, GLshort t, GLshort r)
-{
- d_1_0_Deprecated->f.TexCoord3s(s, t, r);
-}
-
-inline void QOpenGLFunctions_4_0_Compatibility::glTexCoord3iv(const GLint *v)
-{
- d_1_0_Deprecated->f.TexCoord3iv(v);
-}
-
-inline void QOpenGLFunctions_4_0_Compatibility::glTexCoord3i(GLint s, GLint t, GLint r)
-{
- d_1_0_Deprecated->f.TexCoord3i(s, t, r);
-}
-
-inline void QOpenGLFunctions_4_0_Compatibility::glTexCoord3fv(const GLfloat *v)
-{
- d_1_0_Deprecated->f.TexCoord3fv(v);
-}
-
-inline void QOpenGLFunctions_4_0_Compatibility::glTexCoord3f(GLfloat s, GLfloat t, GLfloat r)
-{
- d_1_0_Deprecated->f.TexCoord3f(s, t, r);
-}
-
-inline void QOpenGLFunctions_4_0_Compatibility::glTexCoord3dv(const GLdouble *v)
-{
- d_1_0_Deprecated->f.TexCoord3dv(v);
-}
-
-inline void QOpenGLFunctions_4_0_Compatibility::glTexCoord3d(GLdouble s, GLdouble t, GLdouble r)
-{
- d_1_0_Deprecated->f.TexCoord3d(s, t, r);
-}
-
-inline void QOpenGLFunctions_4_0_Compatibility::glTexCoord2sv(const GLshort *v)
-{
- d_1_0_Deprecated->f.TexCoord2sv(v);
-}
-
-inline void QOpenGLFunctions_4_0_Compatibility::glTexCoord2s(GLshort s, GLshort t)
-{
- d_1_0_Deprecated->f.TexCoord2s(s, t);
-}
-
-inline void QOpenGLFunctions_4_0_Compatibility::glTexCoord2iv(const GLint *v)
-{
- d_1_0_Deprecated->f.TexCoord2iv(v);
-}
-
-inline void QOpenGLFunctions_4_0_Compatibility::glTexCoord2i(GLint s, GLint t)
-{
- d_1_0_Deprecated->f.TexCoord2i(s, t);
-}
-
-inline void QOpenGLFunctions_4_0_Compatibility::glTexCoord2fv(const GLfloat *v)
-{
- d_1_0_Deprecated->f.TexCoord2fv(v);
-}
-
-inline void QOpenGLFunctions_4_0_Compatibility::glTexCoord2f(GLfloat s, GLfloat t)
-{
- d_1_0_Deprecated->f.TexCoord2f(s, t);
-}
-
-inline void QOpenGLFunctions_4_0_Compatibility::glTexCoord2dv(const GLdouble *v)
-{
- d_1_0_Deprecated->f.TexCoord2dv(v);
-}
-
-inline void QOpenGLFunctions_4_0_Compatibility::glTexCoord2d(GLdouble s, GLdouble t)
-{
- d_1_0_Deprecated->f.TexCoord2d(s, t);
-}
-
-inline void QOpenGLFunctions_4_0_Compatibility::glTexCoord1sv(const GLshort *v)
-{
- d_1_0_Deprecated->f.TexCoord1sv(v);
-}
-
-inline void QOpenGLFunctions_4_0_Compatibility::glTexCoord1s(GLshort s)
-{
- d_1_0_Deprecated->f.TexCoord1s(s);
-}
-
-inline void QOpenGLFunctions_4_0_Compatibility::glTexCoord1iv(const GLint *v)
-{
- d_1_0_Deprecated->f.TexCoord1iv(v);
-}
-
-inline void QOpenGLFunctions_4_0_Compatibility::glTexCoord1i(GLint s)
-{
- d_1_0_Deprecated->f.TexCoord1i(s);
-}
-
-inline void QOpenGLFunctions_4_0_Compatibility::glTexCoord1fv(const GLfloat *v)
-{
- d_1_0_Deprecated->f.TexCoord1fv(v);
-}
-
-inline void QOpenGLFunctions_4_0_Compatibility::glTexCoord1f(GLfloat s)
-{
- d_1_0_Deprecated->f.TexCoord1f(s);
-}
-
-inline void QOpenGLFunctions_4_0_Compatibility::glTexCoord1dv(const GLdouble *v)
-{
- d_1_0_Deprecated->f.TexCoord1dv(v);
-}
-
-inline void QOpenGLFunctions_4_0_Compatibility::glTexCoord1d(GLdouble s)
-{
- d_1_0_Deprecated->f.TexCoord1d(s);
-}
-
-inline void QOpenGLFunctions_4_0_Compatibility::glRectsv(const GLshort *v1, const GLshort *v2)
-{
- d_1_0_Deprecated->f.Rectsv(v1, v2);
-}
-
-inline void QOpenGLFunctions_4_0_Compatibility::glRects(GLshort x1, GLshort y1, GLshort x2, GLshort y2)
-{
- d_1_0_Deprecated->f.Rects(x1, y1, x2, y2);
-}
-
-inline void QOpenGLFunctions_4_0_Compatibility::glRectiv(const GLint *v1, const GLint *v2)
-{
- d_1_0_Deprecated->f.Rectiv(v1, v2);
-}
-
-inline void QOpenGLFunctions_4_0_Compatibility::glRecti(GLint x1, GLint y1, GLint x2, GLint y2)
-{
- d_1_0_Deprecated->f.Recti(x1, y1, x2, y2);
-}
-
-inline void QOpenGLFunctions_4_0_Compatibility::glRectfv(const GLfloat *v1, const GLfloat *v2)
-{
- d_1_0_Deprecated->f.Rectfv(v1, v2);
-}
-
-inline void QOpenGLFunctions_4_0_Compatibility::glRectf(GLfloat x1, GLfloat y1, GLfloat x2, GLfloat y2)
-{
- d_1_0_Deprecated->f.Rectf(x1, y1, x2, y2);
-}
-
-inline void QOpenGLFunctions_4_0_Compatibility::glRectdv(const GLdouble *v1, const GLdouble *v2)
-{
- d_1_0_Deprecated->f.Rectdv(v1, v2);
-}
-
-inline void QOpenGLFunctions_4_0_Compatibility::glRectd(GLdouble x1, GLdouble y1, GLdouble x2, GLdouble y2)
-{
- d_1_0_Deprecated->f.Rectd(x1, y1, x2, y2);
-}
-
-inline void QOpenGLFunctions_4_0_Compatibility::glRasterPos4sv(const GLshort *v)
-{
- d_1_0_Deprecated->f.RasterPos4sv(v);
-}
-
-inline void QOpenGLFunctions_4_0_Compatibility::glRasterPos4s(GLshort x, GLshort y, GLshort z, GLshort w)
-{
- d_1_0_Deprecated->f.RasterPos4s(x, y, z, w);
-}
-
-inline void QOpenGLFunctions_4_0_Compatibility::glRasterPos4iv(const GLint *v)
-{
- d_1_0_Deprecated->f.RasterPos4iv(v);
-}
-
-inline void QOpenGLFunctions_4_0_Compatibility::glRasterPos4i(GLint x, GLint y, GLint z, GLint w)
-{
- d_1_0_Deprecated->f.RasterPos4i(x, y, z, w);
-}
-
-inline void QOpenGLFunctions_4_0_Compatibility::glRasterPos4fv(const GLfloat *v)
-{
- d_1_0_Deprecated->f.RasterPos4fv(v);
-}
-
-inline void QOpenGLFunctions_4_0_Compatibility::glRasterPos4f(GLfloat x, GLfloat y, GLfloat z, GLfloat w)
-{
- d_1_0_Deprecated->f.RasterPos4f(x, y, z, w);
-}
-
-inline void QOpenGLFunctions_4_0_Compatibility::glRasterPos4dv(const GLdouble *v)
-{
- d_1_0_Deprecated->f.RasterPos4dv(v);
-}
-
-inline void QOpenGLFunctions_4_0_Compatibility::glRasterPos4d(GLdouble x, GLdouble y, GLdouble z, GLdouble w)
-{
- d_1_0_Deprecated->f.RasterPos4d(x, y, z, w);
-}
-
-inline void QOpenGLFunctions_4_0_Compatibility::glRasterPos3sv(const GLshort *v)
-{
- d_1_0_Deprecated->f.RasterPos3sv(v);
-}
-
-inline void QOpenGLFunctions_4_0_Compatibility::glRasterPos3s(GLshort x, GLshort y, GLshort z)
-{
- d_1_0_Deprecated->f.RasterPos3s(x, y, z);
-}
-
-inline void QOpenGLFunctions_4_0_Compatibility::glRasterPos3iv(const GLint *v)
-{
- d_1_0_Deprecated->f.RasterPos3iv(v);
-}
-
-inline void QOpenGLFunctions_4_0_Compatibility::glRasterPos3i(GLint x, GLint y, GLint z)
-{
- d_1_0_Deprecated->f.RasterPos3i(x, y, z);
-}
-
-inline void QOpenGLFunctions_4_0_Compatibility::glRasterPos3fv(const GLfloat *v)
-{
- d_1_0_Deprecated->f.RasterPos3fv(v);
-}
-
-inline void QOpenGLFunctions_4_0_Compatibility::glRasterPos3f(GLfloat x, GLfloat y, GLfloat z)
-{
- d_1_0_Deprecated->f.RasterPos3f(x, y, z);
-}
-
-inline void QOpenGLFunctions_4_0_Compatibility::glRasterPos3dv(const GLdouble *v)
-{
- d_1_0_Deprecated->f.RasterPos3dv(v);
-}
-
-inline void QOpenGLFunctions_4_0_Compatibility::glRasterPos3d(GLdouble x, GLdouble y, GLdouble z)
-{
- d_1_0_Deprecated->f.RasterPos3d(x, y, z);
-}
-
-inline void QOpenGLFunctions_4_0_Compatibility::glRasterPos2sv(const GLshort *v)
-{
- d_1_0_Deprecated->f.RasterPos2sv(v);
-}
-
-inline void QOpenGLFunctions_4_0_Compatibility::glRasterPos2s(GLshort x, GLshort y)
-{
- d_1_0_Deprecated->f.RasterPos2s(x, y);
-}
-
-inline void QOpenGLFunctions_4_0_Compatibility::glRasterPos2iv(const GLint *v)
-{
- d_1_0_Deprecated->f.RasterPos2iv(v);
-}
-
-inline void QOpenGLFunctions_4_0_Compatibility::glRasterPos2i(GLint x, GLint y)
-{
- d_1_0_Deprecated->f.RasterPos2i(x, y);
-}
-
-inline void QOpenGLFunctions_4_0_Compatibility::glRasterPos2fv(const GLfloat *v)
-{
- d_1_0_Deprecated->f.RasterPos2fv(v);
-}
-
-inline void QOpenGLFunctions_4_0_Compatibility::glRasterPos2f(GLfloat x, GLfloat y)
-{
- d_1_0_Deprecated->f.RasterPos2f(x, y);
-}
-
-inline void QOpenGLFunctions_4_0_Compatibility::glRasterPos2dv(const GLdouble *v)
-{
- d_1_0_Deprecated->f.RasterPos2dv(v);
-}
-
-inline void QOpenGLFunctions_4_0_Compatibility::glRasterPos2d(GLdouble x, GLdouble y)
-{
- d_1_0_Deprecated->f.RasterPos2d(x, y);
-}
-
-inline void QOpenGLFunctions_4_0_Compatibility::glNormal3sv(const GLshort *v)
-{
- d_1_0_Deprecated->f.Normal3sv(v);
-}
-
-inline void QOpenGLFunctions_4_0_Compatibility::glNormal3s(GLshort nx, GLshort ny, GLshort nz)
-{
- d_1_0_Deprecated->f.Normal3s(nx, ny, nz);
-}
-
-inline void QOpenGLFunctions_4_0_Compatibility::glNormal3iv(const GLint *v)
-{
- d_1_0_Deprecated->f.Normal3iv(v);
-}
-
-inline void QOpenGLFunctions_4_0_Compatibility::glNormal3i(GLint nx, GLint ny, GLint nz)
-{
- d_1_0_Deprecated->f.Normal3i(nx, ny, nz);
-}
-
-inline void QOpenGLFunctions_4_0_Compatibility::glNormal3fv(const GLfloat *v)
-{
- d_1_0_Deprecated->f.Normal3fv(v);
-}
-
-inline void QOpenGLFunctions_4_0_Compatibility::glNormal3f(GLfloat nx, GLfloat ny, GLfloat nz)
-{
- d_1_0_Deprecated->f.Normal3f(nx, ny, nz);
-}
-
-inline void QOpenGLFunctions_4_0_Compatibility::glNormal3dv(const GLdouble *v)
-{
- d_1_0_Deprecated->f.Normal3dv(v);
-}
-
-inline void QOpenGLFunctions_4_0_Compatibility::glNormal3d(GLdouble nx, GLdouble ny, GLdouble nz)
-{
- d_1_0_Deprecated->f.Normal3d(nx, ny, nz);
-}
-
-inline void QOpenGLFunctions_4_0_Compatibility::glNormal3bv(const GLbyte *v)
-{
- d_1_0_Deprecated->f.Normal3bv(v);
-}
-
-inline void QOpenGLFunctions_4_0_Compatibility::glNormal3b(GLbyte nx, GLbyte ny, GLbyte nz)
-{
- d_1_0_Deprecated->f.Normal3b(nx, ny, nz);
-}
-
-inline void QOpenGLFunctions_4_0_Compatibility::glIndexsv(const GLshort *c)
-{
- d_1_0_Deprecated->f.Indexsv(c);
-}
-
-inline void QOpenGLFunctions_4_0_Compatibility::glIndexs(GLshort c)
-{
- d_1_0_Deprecated->f.Indexs(c);
-}
-
-inline void QOpenGLFunctions_4_0_Compatibility::glIndexiv(const GLint *c)
-{
- d_1_0_Deprecated->f.Indexiv(c);
-}
-
-inline void QOpenGLFunctions_4_0_Compatibility::glIndexi(GLint c)
-{
- d_1_0_Deprecated->f.Indexi(c);
-}
-
-inline void QOpenGLFunctions_4_0_Compatibility::glIndexfv(const GLfloat *c)
-{
- d_1_0_Deprecated->f.Indexfv(c);
-}
-
-inline void QOpenGLFunctions_4_0_Compatibility::glIndexf(GLfloat c)
-{
- d_1_0_Deprecated->f.Indexf(c);
-}
-
-inline void QOpenGLFunctions_4_0_Compatibility::glIndexdv(const GLdouble *c)
-{
- d_1_0_Deprecated->f.Indexdv(c);
-}
-
-inline void QOpenGLFunctions_4_0_Compatibility::glIndexd(GLdouble c)
-{
- d_1_0_Deprecated->f.Indexd(c);
-}
-
-inline void QOpenGLFunctions_4_0_Compatibility::glEnd()
-{
- d_1_0_Deprecated->f.End();
-}
-
-inline void QOpenGLFunctions_4_0_Compatibility::glEdgeFlagv(const GLboolean *flag)
-{
- d_1_0_Deprecated->f.EdgeFlagv(flag);
-}
-
-inline void QOpenGLFunctions_4_0_Compatibility::glEdgeFlag(GLboolean flag)
-{
- d_1_0_Deprecated->f.EdgeFlag(flag);
-}
-
-inline void QOpenGLFunctions_4_0_Compatibility::glColor4usv(const GLushort *v)
-{
- d_1_0_Deprecated->f.Color4usv(v);
-}
-
-inline void QOpenGLFunctions_4_0_Compatibility::glColor4us(GLushort red, GLushort green, GLushort blue, GLushort alpha)
-{
- d_1_0_Deprecated->f.Color4us(red, green, blue, alpha);
-}
-
-inline void QOpenGLFunctions_4_0_Compatibility::glColor4uiv(const GLuint *v)
-{
- d_1_0_Deprecated->f.Color4uiv(v);
-}
-
-inline void QOpenGLFunctions_4_0_Compatibility::glColor4ui(GLuint red, GLuint green, GLuint blue, GLuint alpha)
-{
- d_1_0_Deprecated->f.Color4ui(red, green, blue, alpha);
-}
-
-inline void QOpenGLFunctions_4_0_Compatibility::glColor4ubv(const GLubyte *v)
-{
- d_1_0_Deprecated->f.Color4ubv(v);
-}
-
-inline void QOpenGLFunctions_4_0_Compatibility::glColor4ub(GLubyte red, GLubyte green, GLubyte blue, GLubyte alpha)
-{
- d_1_0_Deprecated->f.Color4ub(red, green, blue, alpha);
-}
-
-inline void QOpenGLFunctions_4_0_Compatibility::glColor4sv(const GLshort *v)
-{
- d_1_0_Deprecated->f.Color4sv(v);
-}
-
-inline void QOpenGLFunctions_4_0_Compatibility::glColor4s(GLshort red, GLshort green, GLshort blue, GLshort alpha)
-{
- d_1_0_Deprecated->f.Color4s(red, green, blue, alpha);
-}
-
-inline void QOpenGLFunctions_4_0_Compatibility::glColor4iv(const GLint *v)
-{
- d_1_0_Deprecated->f.Color4iv(v);
-}
-
-inline void QOpenGLFunctions_4_0_Compatibility::glColor4i(GLint red, GLint green, GLint blue, GLint alpha)
-{
- d_1_0_Deprecated->f.Color4i(red, green, blue, alpha);
-}
-
-inline void QOpenGLFunctions_4_0_Compatibility::glColor4fv(const GLfloat *v)
-{
- d_1_0_Deprecated->f.Color4fv(v);
-}
-
-inline void QOpenGLFunctions_4_0_Compatibility::glColor4f(GLfloat red, GLfloat green, GLfloat blue, GLfloat alpha)
-{
- d_1_0_Deprecated->f.Color4f(red, green, blue, alpha);
-}
-
-inline void QOpenGLFunctions_4_0_Compatibility::glColor4dv(const GLdouble *v)
-{
- d_1_0_Deprecated->f.Color4dv(v);
-}
-
-inline void QOpenGLFunctions_4_0_Compatibility::glColor4d(GLdouble red, GLdouble green, GLdouble blue, GLdouble alpha)
-{
- d_1_0_Deprecated->f.Color4d(red, green, blue, alpha);
-}
-
-inline void QOpenGLFunctions_4_0_Compatibility::glColor4bv(const GLbyte *v)
-{
- d_1_0_Deprecated->f.Color4bv(v);
-}
-
-inline void QOpenGLFunctions_4_0_Compatibility::glColor4b(GLbyte red, GLbyte green, GLbyte blue, GLbyte alpha)
-{
- d_1_0_Deprecated->f.Color4b(red, green, blue, alpha);
-}
-
-inline void QOpenGLFunctions_4_0_Compatibility::glColor3usv(const GLushort *v)
-{
- d_1_0_Deprecated->f.Color3usv(v);
-}
-
-inline void QOpenGLFunctions_4_0_Compatibility::glColor3us(GLushort red, GLushort green, GLushort blue)
-{
- d_1_0_Deprecated->f.Color3us(red, green, blue);
-}
-
-inline void QOpenGLFunctions_4_0_Compatibility::glColor3uiv(const GLuint *v)
-{
- d_1_0_Deprecated->f.Color3uiv(v);
-}
-
-inline void QOpenGLFunctions_4_0_Compatibility::glColor3ui(GLuint red, GLuint green, GLuint blue)
-{
- d_1_0_Deprecated->f.Color3ui(red, green, blue);
-}
-
-inline void QOpenGLFunctions_4_0_Compatibility::glColor3ubv(const GLubyte *v)
-{
- d_1_0_Deprecated->f.Color3ubv(v);
-}
-
-inline void QOpenGLFunctions_4_0_Compatibility::glColor3ub(GLubyte red, GLubyte green, GLubyte blue)
-{
- d_1_0_Deprecated->f.Color3ub(red, green, blue);
-}
-
-inline void QOpenGLFunctions_4_0_Compatibility::glColor3sv(const GLshort *v)
-{
- d_1_0_Deprecated->f.Color3sv(v);
-}
-
-inline void QOpenGLFunctions_4_0_Compatibility::glColor3s(GLshort red, GLshort green, GLshort blue)
-{
- d_1_0_Deprecated->f.Color3s(red, green, blue);
-}
-
-inline void QOpenGLFunctions_4_0_Compatibility::glColor3iv(const GLint *v)
-{
- d_1_0_Deprecated->f.Color3iv(v);
-}
-
-inline void QOpenGLFunctions_4_0_Compatibility::glColor3i(GLint red, GLint green, GLint blue)
-{
- d_1_0_Deprecated->f.Color3i(red, green, blue);
-}
-
-inline void QOpenGLFunctions_4_0_Compatibility::glColor3fv(const GLfloat *v)
-{
- d_1_0_Deprecated->f.Color3fv(v);
-}
-
-inline void QOpenGLFunctions_4_0_Compatibility::glColor3f(GLfloat red, GLfloat green, GLfloat blue)
-{
- d_1_0_Deprecated->f.Color3f(red, green, blue);
-}
-
-inline void QOpenGLFunctions_4_0_Compatibility::glColor3dv(const GLdouble *v)
-{
- d_1_0_Deprecated->f.Color3dv(v);
-}
-
-inline void QOpenGLFunctions_4_0_Compatibility::glColor3d(GLdouble red, GLdouble green, GLdouble blue)
-{
- d_1_0_Deprecated->f.Color3d(red, green, blue);
-}
-
-inline void QOpenGLFunctions_4_0_Compatibility::glColor3bv(const GLbyte *v)
-{
- d_1_0_Deprecated->f.Color3bv(v);
-}
-
-inline void QOpenGLFunctions_4_0_Compatibility::glColor3b(GLbyte red, GLbyte green, GLbyte blue)
-{
- d_1_0_Deprecated->f.Color3b(red, green, blue);
-}
-
-inline void QOpenGLFunctions_4_0_Compatibility::glBitmap(GLsizei width, GLsizei height, GLfloat xorig, GLfloat yorig, GLfloat xmove, GLfloat ymove, const GLubyte *bitmap)
-{
- d_1_0_Deprecated->f.Bitmap(width, height, xorig, yorig, xmove, ymove, bitmap);
-}
-
-inline void QOpenGLFunctions_4_0_Compatibility::glBegin(GLenum mode)
-{
- d_1_0_Deprecated->f.Begin(mode);
-}
-
-inline void QOpenGLFunctions_4_0_Compatibility::glListBase(GLuint base)
-{
- d_1_0_Deprecated->f.ListBase(base);
-}
-
-inline GLuint QOpenGLFunctions_4_0_Compatibility::glGenLists(GLsizei range)
-{
- return d_1_0_Deprecated->f.GenLists(range);
-}
-
-inline void QOpenGLFunctions_4_0_Compatibility::glDeleteLists(GLuint list, GLsizei range)
-{
- d_1_0_Deprecated->f.DeleteLists(list, range);
-}
-
-inline void QOpenGLFunctions_4_0_Compatibility::glCallLists(GLsizei n, GLenum type, const GLvoid *lists)
-{
- d_1_0_Deprecated->f.CallLists(n, type, lists);
-}
-
-inline void QOpenGLFunctions_4_0_Compatibility::glCallList(GLuint list)
-{
- d_1_0_Deprecated->f.CallList(list);
-}
-
-inline void QOpenGLFunctions_4_0_Compatibility::glEndList()
-{
- d_1_0_Deprecated->f.EndList();
-}
-
-inline void QOpenGLFunctions_4_0_Compatibility::glNewList(GLuint list, GLenum mode)
-{
- d_1_0_Deprecated->f.NewList(list, mode);
-}
-
-
-// OpenGL 1.1 deprecated functions
-inline void QOpenGLFunctions_4_0_Compatibility::glPushClientAttrib(GLbitfield mask)
-{
- d_1_1_Deprecated->f.PushClientAttrib(mask);
-}
-
-inline void QOpenGLFunctions_4_0_Compatibility::glPopClientAttrib()
-{
- d_1_1_Deprecated->f.PopClientAttrib();
-}
-
-inline void QOpenGLFunctions_4_0_Compatibility::glPrioritizeTextures(GLsizei n, const GLuint *textures, const GLfloat *priorities)
-{
- d_1_1_Deprecated->f.PrioritizeTextures(n, textures, priorities);
-}
-
-inline GLboolean QOpenGLFunctions_4_0_Compatibility::glAreTexturesResident(GLsizei n, const GLuint *textures, GLboolean *residences)
-{
- return d_1_1_Deprecated->f.AreTexturesResident(n, textures, residences);
-}
-
-inline void QOpenGLFunctions_4_0_Compatibility::glVertexPointer(GLint size, GLenum type, GLsizei stride, const GLvoid *pointer)
-{
- d_1_1_Deprecated->f.VertexPointer(size, type, stride, pointer);
-}
-
-inline void QOpenGLFunctions_4_0_Compatibility::glTexCoordPointer(GLint size, GLenum type, GLsizei stride, const GLvoid *pointer)
-{
- d_1_1_Deprecated->f.TexCoordPointer(size, type, stride, pointer);
-}
-
-inline void QOpenGLFunctions_4_0_Compatibility::glNormalPointer(GLenum type, GLsizei stride, const GLvoid *pointer)
-{
- d_1_1_Deprecated->f.NormalPointer(type, stride, pointer);
-}
-
-inline void QOpenGLFunctions_4_0_Compatibility::glInterleavedArrays(GLenum format, GLsizei stride, const GLvoid *pointer)
-{
- d_1_1_Deprecated->f.InterleavedArrays(format, stride, pointer);
-}
-
-inline void QOpenGLFunctions_4_0_Compatibility::glIndexPointer(GLenum type, GLsizei stride, const GLvoid *pointer)
-{
- d_1_1_Deprecated->f.IndexPointer(type, stride, pointer);
-}
-
-inline void QOpenGLFunctions_4_0_Compatibility::glEnableClientState(GLenum array)
-{
- d_1_1_Deprecated->f.EnableClientState(array);
-}
-
-inline void QOpenGLFunctions_4_0_Compatibility::glEdgeFlagPointer(GLsizei stride, const GLvoid *pointer)
-{
- d_1_1_Deprecated->f.EdgeFlagPointer(stride, pointer);
-}
-
-inline void QOpenGLFunctions_4_0_Compatibility::glDisableClientState(GLenum array)
-{
- d_1_1_Deprecated->f.DisableClientState(array);
-}
-
-inline void QOpenGLFunctions_4_0_Compatibility::glColorPointer(GLint size, GLenum type, GLsizei stride, const GLvoid *pointer)
-{
- d_1_1_Deprecated->f.ColorPointer(size, type, stride, pointer);
-}
-
-inline void QOpenGLFunctions_4_0_Compatibility::glArrayElement(GLint i)
-{
- d_1_1_Deprecated->f.ArrayElement(i);
-}
-
-
-// OpenGL 1.2 deprecated functions
-inline void QOpenGLFunctions_4_0_Compatibility::glResetMinmax(GLenum target)
-{
- d_1_2_Deprecated->f.ResetMinmax(target);
-}
-
-inline void QOpenGLFunctions_4_0_Compatibility::glResetHistogram(GLenum target)
-{
- d_1_2_Deprecated->f.ResetHistogram(target);
-}
-
-inline void QOpenGLFunctions_4_0_Compatibility::glMinmax(GLenum target, GLenum internalformat, GLboolean sink)
-{
- d_1_2_Deprecated->f.Minmax(target, internalformat, sink);
-}
-
-inline void QOpenGLFunctions_4_0_Compatibility::glHistogram(GLenum target, GLsizei width, GLenum internalformat, GLboolean sink)
-{
- d_1_2_Deprecated->f.Histogram(target, width, internalformat, sink);
-}
-
-inline void QOpenGLFunctions_4_0_Compatibility::glGetMinmaxParameteriv(GLenum target, GLenum pname, GLint *params)
-{
- d_1_2_Deprecated->f.GetMinmaxParameteriv(target, pname, params);
-}
-
-inline void QOpenGLFunctions_4_0_Compatibility::glGetMinmaxParameterfv(GLenum target, GLenum pname, GLfloat *params)
-{
- d_1_2_Deprecated->f.GetMinmaxParameterfv(target, pname, params);
-}
-
-inline void QOpenGLFunctions_4_0_Compatibility::glGetMinmax(GLenum target, GLboolean reset, GLenum format, GLenum type, GLvoid *values)
-{
- d_1_2_Deprecated->f.GetMinmax(target, reset, format, type, values);
-}
-
-inline void QOpenGLFunctions_4_0_Compatibility::glGetHistogramParameteriv(GLenum target, GLenum pname, GLint *params)
-{
- d_1_2_Deprecated->f.GetHistogramParameteriv(target, pname, params);
-}
-
-inline void QOpenGLFunctions_4_0_Compatibility::glGetHistogramParameterfv(GLenum target, GLenum pname, GLfloat *params)
-{
- d_1_2_Deprecated->f.GetHistogramParameterfv(target, pname, params);
-}
-
-inline void QOpenGLFunctions_4_0_Compatibility::glGetHistogram(GLenum target, GLboolean reset, GLenum format, GLenum type, GLvoid *values)
-{
- d_1_2_Deprecated->f.GetHistogram(target, reset, format, type, values);
-}
-
-inline void QOpenGLFunctions_4_0_Compatibility::glSeparableFilter2D(GLenum target, GLenum internalformat, GLsizei width, GLsizei height, GLenum format, GLenum type, const GLvoid *row, const GLvoid *column)
-{
- d_1_2_Deprecated->f.SeparableFilter2D(target, internalformat, width, height, format, type, row, column);
-}
-
-inline void QOpenGLFunctions_4_0_Compatibility::glGetSeparableFilter(GLenum target, GLenum format, GLenum type, GLvoid *row, GLvoid *column, GLvoid *span)
-{
- d_1_2_Deprecated->f.GetSeparableFilter(target, format, type, row, column, span);
-}
-
-inline void QOpenGLFunctions_4_0_Compatibility::glGetConvolutionParameteriv(GLenum target, GLenum pname, GLint *params)
-{
- d_1_2_Deprecated->f.GetConvolutionParameteriv(target, pname, params);
-}
-
-inline void QOpenGLFunctions_4_0_Compatibility::glGetConvolutionParameterfv(GLenum target, GLenum pname, GLfloat *params)
-{
- d_1_2_Deprecated->f.GetConvolutionParameterfv(target, pname, params);
-}
-
-inline void QOpenGLFunctions_4_0_Compatibility::glGetConvolutionFilter(GLenum target, GLenum format, GLenum type, GLvoid *image)
-{
- d_1_2_Deprecated->f.GetConvolutionFilter(target, format, type, image);
-}
-
-inline void QOpenGLFunctions_4_0_Compatibility::glCopyConvolutionFilter2D(GLenum target, GLenum internalformat, GLint x, GLint y, GLsizei width, GLsizei height)
-{
- d_1_2_Deprecated->f.CopyConvolutionFilter2D(target, internalformat, x, y, width, height);
-}
-
-inline void QOpenGLFunctions_4_0_Compatibility::glCopyConvolutionFilter1D(GLenum target, GLenum internalformat, GLint x, GLint y, GLsizei width)
-{
- d_1_2_Deprecated->f.CopyConvolutionFilter1D(target, internalformat, x, y, width);
-}
-
-inline void QOpenGLFunctions_4_0_Compatibility::glConvolutionParameteriv(GLenum target, GLenum pname, const GLint *params)
-{
- d_1_2_Deprecated->f.ConvolutionParameteriv(target, pname, params);
-}
-
-inline void QOpenGLFunctions_4_0_Compatibility::glConvolutionParameteri(GLenum target, GLenum pname, GLint params)
-{
- d_1_2_Deprecated->f.ConvolutionParameteri(target, pname, params);
-}
-
-inline void QOpenGLFunctions_4_0_Compatibility::glConvolutionParameterfv(GLenum target, GLenum pname, const GLfloat *params)
-{
- d_1_2_Deprecated->f.ConvolutionParameterfv(target, pname, params);
-}
-
-inline void QOpenGLFunctions_4_0_Compatibility::glConvolutionParameterf(GLenum target, GLenum pname, GLfloat params)
-{
- d_1_2_Deprecated->f.ConvolutionParameterf(target, pname, params);
-}
-
-inline void QOpenGLFunctions_4_0_Compatibility::glConvolutionFilter2D(GLenum target, GLenum internalformat, GLsizei width, GLsizei height, GLenum format, GLenum type, const GLvoid *image)
-{
- d_1_2_Deprecated->f.ConvolutionFilter2D(target, internalformat, width, height, format, type, image);
-}
-
-inline void QOpenGLFunctions_4_0_Compatibility::glConvolutionFilter1D(GLenum target, GLenum internalformat, GLsizei width, GLenum format, GLenum type, const GLvoid *image)
-{
- d_1_2_Deprecated->f.ConvolutionFilter1D(target, internalformat, width, format, type, image);
-}
-
-inline void QOpenGLFunctions_4_0_Compatibility::glCopyColorSubTable(GLenum target, GLsizei start, GLint x, GLint y, GLsizei width)
-{
- d_1_2_Deprecated->f.CopyColorSubTable(target, start, x, y, width);
-}
-
-inline void QOpenGLFunctions_4_0_Compatibility::glColorSubTable(GLenum target, GLsizei start, GLsizei count, GLenum format, GLenum type, const GLvoid *data)
-{
- d_1_2_Deprecated->f.ColorSubTable(target, start, count, format, type, data);
-}
-
-inline void QOpenGLFunctions_4_0_Compatibility::glGetColorTableParameteriv(GLenum target, GLenum pname, GLint *params)
-{
- d_1_2_Deprecated->f.GetColorTableParameteriv(target, pname, params);
-}
-
-inline void QOpenGLFunctions_4_0_Compatibility::glGetColorTableParameterfv(GLenum target, GLenum pname, GLfloat *params)
-{
- d_1_2_Deprecated->f.GetColorTableParameterfv(target, pname, params);
-}
-
-inline void QOpenGLFunctions_4_0_Compatibility::glGetColorTable(GLenum target, GLenum format, GLenum type, GLvoid *table)
-{
- d_1_2_Deprecated->f.GetColorTable(target, format, type, table);
-}
-
-inline void QOpenGLFunctions_4_0_Compatibility::glCopyColorTable(GLenum target, GLenum internalformat, GLint x, GLint y, GLsizei width)
-{
- d_1_2_Deprecated->f.CopyColorTable(target, internalformat, x, y, width);
-}
-
-inline void QOpenGLFunctions_4_0_Compatibility::glColorTableParameteriv(GLenum target, GLenum pname, const GLint *params)
-{
- d_1_2_Deprecated->f.ColorTableParameteriv(target, pname, params);
-}
-
-inline void QOpenGLFunctions_4_0_Compatibility::glColorTableParameterfv(GLenum target, GLenum pname, const GLfloat *params)
-{
- d_1_2_Deprecated->f.ColorTableParameterfv(target, pname, params);
-}
-
-inline void QOpenGLFunctions_4_0_Compatibility::glColorTable(GLenum target, GLenum internalformat, GLsizei width, GLenum format, GLenum type, const GLvoid *table)
-{
- d_1_2_Deprecated->f.ColorTable(target, internalformat, width, format, type, table);
-}
-
-
-// OpenGL 1.3 deprecated functions
-inline void QOpenGLFunctions_4_0_Compatibility::glMultTransposeMatrixd(const GLdouble *m)
-{
- d_1_3_Deprecated->f.MultTransposeMatrixd(m);
-}
-
-inline void QOpenGLFunctions_4_0_Compatibility::glMultTransposeMatrixf(const GLfloat *m)
-{
- d_1_3_Deprecated->f.MultTransposeMatrixf(m);
-}
-
-inline void QOpenGLFunctions_4_0_Compatibility::glLoadTransposeMatrixd(const GLdouble *m)
-{
- d_1_3_Deprecated->f.LoadTransposeMatrixd(m);
-}
-
-inline void QOpenGLFunctions_4_0_Compatibility::glLoadTransposeMatrixf(const GLfloat *m)
-{
- d_1_3_Deprecated->f.LoadTransposeMatrixf(m);
-}
-
-inline void QOpenGLFunctions_4_0_Compatibility::glMultiTexCoord4sv(GLenum target, const GLshort *v)
-{
- d_1_3_Deprecated->f.MultiTexCoord4sv(target, v);
-}
-
-inline void QOpenGLFunctions_4_0_Compatibility::glMultiTexCoord4s(GLenum target, GLshort s, GLshort t, GLshort r, GLshort q)
-{
- d_1_3_Deprecated->f.MultiTexCoord4s(target, s, t, r, q);
-}
-
-inline void QOpenGLFunctions_4_0_Compatibility::glMultiTexCoord4iv(GLenum target, const GLint *v)
-{
- d_1_3_Deprecated->f.MultiTexCoord4iv(target, v);
-}
-
-inline void QOpenGLFunctions_4_0_Compatibility::glMultiTexCoord4i(GLenum target, GLint s, GLint t, GLint r, GLint q)
-{
- d_1_3_Deprecated->f.MultiTexCoord4i(target, s, t, r, q);
-}
-
-inline void QOpenGLFunctions_4_0_Compatibility::glMultiTexCoord4fv(GLenum target, const GLfloat *v)
-{
- d_1_3_Deprecated->f.MultiTexCoord4fv(target, v);
-}
-
-inline void QOpenGLFunctions_4_0_Compatibility::glMultiTexCoord4f(GLenum target, GLfloat s, GLfloat t, GLfloat r, GLfloat q)
-{
- d_1_3_Deprecated->f.MultiTexCoord4f(target, s, t, r, q);
-}
-
-inline void QOpenGLFunctions_4_0_Compatibility::glMultiTexCoord4dv(GLenum target, const GLdouble *v)
-{
- d_1_3_Deprecated->f.MultiTexCoord4dv(target, v);
-}
-
-inline void QOpenGLFunctions_4_0_Compatibility::glMultiTexCoord4d(GLenum target, GLdouble s, GLdouble t, GLdouble r, GLdouble q)
-{
- d_1_3_Deprecated->f.MultiTexCoord4d(target, s, t, r, q);
-}
-
-inline void QOpenGLFunctions_4_0_Compatibility::glMultiTexCoord3sv(GLenum target, const GLshort *v)
-{
- d_1_3_Deprecated->f.MultiTexCoord3sv(target, v);
-}
-
-inline void QOpenGLFunctions_4_0_Compatibility::glMultiTexCoord3s(GLenum target, GLshort s, GLshort t, GLshort r)
-{
- d_1_3_Deprecated->f.MultiTexCoord3s(target, s, t, r);
-}
-
-inline void QOpenGLFunctions_4_0_Compatibility::glMultiTexCoord3iv(GLenum target, const GLint *v)
-{
- d_1_3_Deprecated->f.MultiTexCoord3iv(target, v);
-}
-
-inline void QOpenGLFunctions_4_0_Compatibility::glMultiTexCoord3i(GLenum target, GLint s, GLint t, GLint r)
-{
- d_1_3_Deprecated->f.MultiTexCoord3i(target, s, t, r);
-}
-
-inline void QOpenGLFunctions_4_0_Compatibility::glMultiTexCoord3fv(GLenum target, const GLfloat *v)
-{
- d_1_3_Deprecated->f.MultiTexCoord3fv(target, v);
-}
-
-inline void QOpenGLFunctions_4_0_Compatibility::glMultiTexCoord3f(GLenum target, GLfloat s, GLfloat t, GLfloat r)
-{
- d_1_3_Deprecated->f.MultiTexCoord3f(target, s, t, r);
-}
-
-inline void QOpenGLFunctions_4_0_Compatibility::glMultiTexCoord3dv(GLenum target, const GLdouble *v)
-{
- d_1_3_Deprecated->f.MultiTexCoord3dv(target, v);
-}
-
-inline void QOpenGLFunctions_4_0_Compatibility::glMultiTexCoord3d(GLenum target, GLdouble s, GLdouble t, GLdouble r)
-{
- d_1_3_Deprecated->f.MultiTexCoord3d(target, s, t, r);
-}
-
-inline void QOpenGLFunctions_4_0_Compatibility::glMultiTexCoord2sv(GLenum target, const GLshort *v)
-{
- d_1_3_Deprecated->f.MultiTexCoord2sv(target, v);
-}
-
-inline void QOpenGLFunctions_4_0_Compatibility::glMultiTexCoord2s(GLenum target, GLshort s, GLshort t)
-{
- d_1_3_Deprecated->f.MultiTexCoord2s(target, s, t);
-}
-
-inline void QOpenGLFunctions_4_0_Compatibility::glMultiTexCoord2iv(GLenum target, const GLint *v)
-{
- d_1_3_Deprecated->f.MultiTexCoord2iv(target, v);
-}
-
-inline void QOpenGLFunctions_4_0_Compatibility::glMultiTexCoord2i(GLenum target, GLint s, GLint t)
-{
- d_1_3_Deprecated->f.MultiTexCoord2i(target, s, t);
-}
-
-inline void QOpenGLFunctions_4_0_Compatibility::glMultiTexCoord2fv(GLenum target, const GLfloat *v)
-{
- d_1_3_Deprecated->f.MultiTexCoord2fv(target, v);
-}
-
-inline void QOpenGLFunctions_4_0_Compatibility::glMultiTexCoord2f(GLenum target, GLfloat s, GLfloat t)
-{
- d_1_3_Deprecated->f.MultiTexCoord2f(target, s, t);
-}
-
-inline void QOpenGLFunctions_4_0_Compatibility::glMultiTexCoord2dv(GLenum target, const GLdouble *v)
-{
- d_1_3_Deprecated->f.MultiTexCoord2dv(target, v);
-}
-
-inline void QOpenGLFunctions_4_0_Compatibility::glMultiTexCoord2d(GLenum target, GLdouble s, GLdouble t)
-{
- d_1_3_Deprecated->f.MultiTexCoord2d(target, s, t);
-}
-
-inline void QOpenGLFunctions_4_0_Compatibility::glMultiTexCoord1sv(GLenum target, const GLshort *v)
-{
- d_1_3_Deprecated->f.MultiTexCoord1sv(target, v);
-}
-
-inline void QOpenGLFunctions_4_0_Compatibility::glMultiTexCoord1s(GLenum target, GLshort s)
-{
- d_1_3_Deprecated->f.MultiTexCoord1s(target, s);
-}
-
-inline void QOpenGLFunctions_4_0_Compatibility::glMultiTexCoord1iv(GLenum target, const GLint *v)
-{
- d_1_3_Deprecated->f.MultiTexCoord1iv(target, v);
-}
-
-inline void QOpenGLFunctions_4_0_Compatibility::glMultiTexCoord1i(GLenum target, GLint s)
-{
- d_1_3_Deprecated->f.MultiTexCoord1i(target, s);
-}
-
-inline void QOpenGLFunctions_4_0_Compatibility::glMultiTexCoord1fv(GLenum target, const GLfloat *v)
-{
- d_1_3_Deprecated->f.MultiTexCoord1fv(target, v);
-}
-
-inline void QOpenGLFunctions_4_0_Compatibility::glMultiTexCoord1f(GLenum target, GLfloat s)
-{
- d_1_3_Deprecated->f.MultiTexCoord1f(target, s);
-}
-
-inline void QOpenGLFunctions_4_0_Compatibility::glMultiTexCoord1dv(GLenum target, const GLdouble *v)
-{
- d_1_3_Deprecated->f.MultiTexCoord1dv(target, v);
-}
-
-inline void QOpenGLFunctions_4_0_Compatibility::glMultiTexCoord1d(GLenum target, GLdouble s)
-{
- d_1_3_Deprecated->f.MultiTexCoord1d(target, s);
-}
-
-inline void QOpenGLFunctions_4_0_Compatibility::glClientActiveTexture(GLenum texture)
-{
- d_1_3_Deprecated->f.ClientActiveTexture(texture);
-}
-
-
-// OpenGL 1.4 deprecated functions
-inline void QOpenGLFunctions_4_0_Compatibility::glWindowPos3sv(const GLshort *v)
-{
- d_1_4_Deprecated->f.WindowPos3sv(v);
-}
-
-inline void QOpenGLFunctions_4_0_Compatibility::glWindowPos3s(GLshort x, GLshort y, GLshort z)
-{
- d_1_4_Deprecated->f.WindowPos3s(x, y, z);
-}
-
-inline void QOpenGLFunctions_4_0_Compatibility::glWindowPos3iv(const GLint *v)
-{
- d_1_4_Deprecated->f.WindowPos3iv(v);
-}
-
-inline void QOpenGLFunctions_4_0_Compatibility::glWindowPos3i(GLint x, GLint y, GLint z)
-{
- d_1_4_Deprecated->f.WindowPos3i(x, y, z);
-}
-
-inline void QOpenGLFunctions_4_0_Compatibility::glWindowPos3fv(const GLfloat *v)
-{
- d_1_4_Deprecated->f.WindowPos3fv(v);
-}
-
-inline void QOpenGLFunctions_4_0_Compatibility::glWindowPos3f(GLfloat x, GLfloat y, GLfloat z)
-{
- d_1_4_Deprecated->f.WindowPos3f(x, y, z);
-}
-
-inline void QOpenGLFunctions_4_0_Compatibility::glWindowPos3dv(const GLdouble *v)
-{
- d_1_4_Deprecated->f.WindowPos3dv(v);
-}
-
-inline void QOpenGLFunctions_4_0_Compatibility::glWindowPos3d(GLdouble x, GLdouble y, GLdouble z)
-{
- d_1_4_Deprecated->f.WindowPos3d(x, y, z);
-}
-
-inline void QOpenGLFunctions_4_0_Compatibility::glWindowPos2sv(const GLshort *v)
-{
- d_1_4_Deprecated->f.WindowPos2sv(v);
-}
-
-inline void QOpenGLFunctions_4_0_Compatibility::glWindowPos2s(GLshort x, GLshort y)
-{
- d_1_4_Deprecated->f.WindowPos2s(x, y);
-}
-
-inline void QOpenGLFunctions_4_0_Compatibility::glWindowPos2iv(const GLint *v)
-{
- d_1_4_Deprecated->f.WindowPos2iv(v);
-}
-
-inline void QOpenGLFunctions_4_0_Compatibility::glWindowPos2i(GLint x, GLint y)
-{
- d_1_4_Deprecated->f.WindowPos2i(x, y);
-}
-
-inline void QOpenGLFunctions_4_0_Compatibility::glWindowPos2fv(const GLfloat *v)
-{
- d_1_4_Deprecated->f.WindowPos2fv(v);
-}
-
-inline void QOpenGLFunctions_4_0_Compatibility::glWindowPos2f(GLfloat x, GLfloat y)
-{
- d_1_4_Deprecated->f.WindowPos2f(x, y);
-}
-
-inline void QOpenGLFunctions_4_0_Compatibility::glWindowPos2dv(const GLdouble *v)
-{
- d_1_4_Deprecated->f.WindowPos2dv(v);
-}
-
-inline void QOpenGLFunctions_4_0_Compatibility::glWindowPos2d(GLdouble x, GLdouble y)
-{
- d_1_4_Deprecated->f.WindowPos2d(x, y);
-}
-
-inline void QOpenGLFunctions_4_0_Compatibility::glSecondaryColorPointer(GLint size, GLenum type, GLsizei stride, const GLvoid *pointer)
-{
- d_1_4_Deprecated->f.SecondaryColorPointer(size, type, stride, pointer);
-}
-
-inline void QOpenGLFunctions_4_0_Compatibility::glSecondaryColor3usv(const GLushort *v)
-{
- d_1_4_Deprecated->f.SecondaryColor3usv(v);
-}
-
-inline void QOpenGLFunctions_4_0_Compatibility::glSecondaryColor3us(GLushort red, GLushort green, GLushort blue)
-{
- d_1_4_Deprecated->f.SecondaryColor3us(red, green, blue);
-}
-
-inline void QOpenGLFunctions_4_0_Compatibility::glSecondaryColor3uiv(const GLuint *v)
-{
- d_1_4_Deprecated->f.SecondaryColor3uiv(v);
-}
-
-inline void QOpenGLFunctions_4_0_Compatibility::glSecondaryColor3ui(GLuint red, GLuint green, GLuint blue)
-{
- d_1_4_Deprecated->f.SecondaryColor3ui(red, green, blue);
-}
-
-inline void QOpenGLFunctions_4_0_Compatibility::glSecondaryColor3ubv(const GLubyte *v)
-{
- d_1_4_Deprecated->f.SecondaryColor3ubv(v);
-}
-
-inline void QOpenGLFunctions_4_0_Compatibility::glSecondaryColor3ub(GLubyte red, GLubyte green, GLubyte blue)
-{
- d_1_4_Deprecated->f.SecondaryColor3ub(red, green, blue);
-}
-
-inline void QOpenGLFunctions_4_0_Compatibility::glSecondaryColor3sv(const GLshort *v)
-{
- d_1_4_Deprecated->f.SecondaryColor3sv(v);
-}
-
-inline void QOpenGLFunctions_4_0_Compatibility::glSecondaryColor3s(GLshort red, GLshort green, GLshort blue)
-{
- d_1_4_Deprecated->f.SecondaryColor3s(red, green, blue);
-}
-
-inline void QOpenGLFunctions_4_0_Compatibility::glSecondaryColor3iv(const GLint *v)
-{
- d_1_4_Deprecated->f.SecondaryColor3iv(v);
-}
-
-inline void QOpenGLFunctions_4_0_Compatibility::glSecondaryColor3i(GLint red, GLint green, GLint blue)
-{
- d_1_4_Deprecated->f.SecondaryColor3i(red, green, blue);
-}
-
-inline void QOpenGLFunctions_4_0_Compatibility::glSecondaryColor3fv(const GLfloat *v)
-{
- d_1_4_Deprecated->f.SecondaryColor3fv(v);
-}
-
-inline void QOpenGLFunctions_4_0_Compatibility::glSecondaryColor3f(GLfloat red, GLfloat green, GLfloat blue)
-{
- d_1_4_Deprecated->f.SecondaryColor3f(red, green, blue);
-}
-
-inline void QOpenGLFunctions_4_0_Compatibility::glSecondaryColor3dv(const GLdouble *v)
-{
- d_1_4_Deprecated->f.SecondaryColor3dv(v);
-}
-
-inline void QOpenGLFunctions_4_0_Compatibility::glSecondaryColor3d(GLdouble red, GLdouble green, GLdouble blue)
-{
- d_1_4_Deprecated->f.SecondaryColor3d(red, green, blue);
-}
-
-inline void QOpenGLFunctions_4_0_Compatibility::glSecondaryColor3bv(const GLbyte *v)
-{
- d_1_4_Deprecated->f.SecondaryColor3bv(v);
-}
-
-inline void QOpenGLFunctions_4_0_Compatibility::glSecondaryColor3b(GLbyte red, GLbyte green, GLbyte blue)
-{
- d_1_4_Deprecated->f.SecondaryColor3b(red, green, blue);
-}
-
-inline void QOpenGLFunctions_4_0_Compatibility::glFogCoordPointer(GLenum type, GLsizei stride, const GLvoid *pointer)
-{
- d_1_4_Deprecated->f.FogCoordPointer(type, stride, pointer);
-}
-
-inline void QOpenGLFunctions_4_0_Compatibility::glFogCoorddv(const GLdouble *coord)
-{
- d_1_4_Deprecated->f.FogCoorddv(coord);
-}
-
-inline void QOpenGLFunctions_4_0_Compatibility::glFogCoordd(GLdouble coord)
-{
- d_1_4_Deprecated->f.FogCoordd(coord);
-}
-
-inline void QOpenGLFunctions_4_0_Compatibility::glFogCoordfv(const GLfloat *coord)
-{
- d_1_4_Deprecated->f.FogCoordfv(coord);
-}
-
-inline void QOpenGLFunctions_4_0_Compatibility::glFogCoordf(GLfloat coord)
-{
- d_1_4_Deprecated->f.FogCoordf(coord);
-}
-
-
-// OpenGL 1.5 deprecated functions
-
-// OpenGL 2.0 deprecated functions
-inline void QOpenGLFunctions_4_0_Compatibility::glVertexAttrib4usv(GLuint index, const GLushort *v)
-{
- d_2_0_Core->f.VertexAttrib4usv(index, v);
-}
-
-inline void QOpenGLFunctions_4_0_Compatibility::glVertexAttrib4uiv(GLuint index, const GLuint *v)
-{
- d_2_0_Core->f.VertexAttrib4uiv(index, v);
-}
-
-inline void QOpenGLFunctions_4_0_Compatibility::glVertexAttrib4ubv(GLuint index, const GLubyte *v)
-{
- d_2_0_Core->f.VertexAttrib4ubv(index, v);
-}
-
-inline void QOpenGLFunctions_4_0_Compatibility::glVertexAttrib4sv(GLuint index, const GLshort *v)
-{
- d_2_0_Core->f.VertexAttrib4sv(index, v);
-}
-
-inline void QOpenGLFunctions_4_0_Compatibility::glVertexAttrib4s(GLuint index, GLshort x, GLshort y, GLshort z, GLshort w)
-{
- d_2_0_Core->f.VertexAttrib4s(index, x, y, z, w);
-}
-
-inline void QOpenGLFunctions_4_0_Compatibility::glVertexAttrib4iv(GLuint index, const GLint *v)
-{
- d_2_0_Core->f.VertexAttrib4iv(index, v);
-}
-
-inline void QOpenGLFunctions_4_0_Compatibility::glVertexAttrib4fv(GLuint index, const GLfloat *v)
-{
- d_2_0_Core->f.VertexAttrib4fv(index, v);
-}
-
-inline void QOpenGLFunctions_4_0_Compatibility::glVertexAttrib4f(GLuint index, GLfloat x, GLfloat y, GLfloat z, GLfloat w)
-{
- d_2_0_Core->f.VertexAttrib4f(index, x, y, z, w);
-}
-
-inline void QOpenGLFunctions_4_0_Compatibility::glVertexAttrib4dv(GLuint index, const GLdouble *v)
-{
- d_2_0_Core->f.VertexAttrib4dv(index, v);
-}
-
-inline void QOpenGLFunctions_4_0_Compatibility::glVertexAttrib4d(GLuint index, GLdouble x, GLdouble y, GLdouble z, GLdouble w)
-{
- d_2_0_Core->f.VertexAttrib4d(index, x, y, z, w);
-}
-
-inline void QOpenGLFunctions_4_0_Compatibility::glVertexAttrib4bv(GLuint index, const GLbyte *v)
-{
- d_2_0_Core->f.VertexAttrib4bv(index, v);
-}
-
-inline void QOpenGLFunctions_4_0_Compatibility::glVertexAttrib4Nusv(GLuint index, const GLushort *v)
-{
- d_2_0_Core->f.VertexAttrib4Nusv(index, v);
-}
-
-inline void QOpenGLFunctions_4_0_Compatibility::glVertexAttrib4Nuiv(GLuint index, const GLuint *v)
-{
- d_2_0_Core->f.VertexAttrib4Nuiv(index, v);
-}
-
-inline void QOpenGLFunctions_4_0_Compatibility::glVertexAttrib4Nubv(GLuint index, const GLubyte *v)
-{
- d_2_0_Core->f.VertexAttrib4Nubv(index, v);
-}
-
-inline void QOpenGLFunctions_4_0_Compatibility::glVertexAttrib4Nub(GLuint index, GLubyte x, GLubyte y, GLubyte z, GLubyte w)
-{
- d_2_0_Core->f.VertexAttrib4Nub(index, x, y, z, w);
-}
-
-inline void QOpenGLFunctions_4_0_Compatibility::glVertexAttrib4Nsv(GLuint index, const GLshort *v)
-{
- d_2_0_Core->f.VertexAttrib4Nsv(index, v);
-}
-
-inline void QOpenGLFunctions_4_0_Compatibility::glVertexAttrib4Niv(GLuint index, const GLint *v)
-{
- d_2_0_Core->f.VertexAttrib4Niv(index, v);
-}
-
-inline void QOpenGLFunctions_4_0_Compatibility::glVertexAttrib4Nbv(GLuint index, const GLbyte *v)
-{
- d_2_0_Core->f.VertexAttrib4Nbv(index, v);
-}
-
-inline void QOpenGLFunctions_4_0_Compatibility::glVertexAttrib3sv(GLuint index, const GLshort *v)
-{
- d_2_0_Core->f.VertexAttrib3sv(index, v);
-}
-
-inline void QOpenGLFunctions_4_0_Compatibility::glVertexAttrib3s(GLuint index, GLshort x, GLshort y, GLshort z)
-{
- d_2_0_Core->f.VertexAttrib3s(index, x, y, z);
-}
-
-inline void QOpenGLFunctions_4_0_Compatibility::glVertexAttrib3fv(GLuint index, const GLfloat *v)
-{
- d_2_0_Core->f.VertexAttrib3fv(index, v);
-}
-
-inline void QOpenGLFunctions_4_0_Compatibility::glVertexAttrib3f(GLuint index, GLfloat x, GLfloat y, GLfloat z)
-{
- d_2_0_Core->f.VertexAttrib3f(index, x, y, z);
-}
-
-inline void QOpenGLFunctions_4_0_Compatibility::glVertexAttrib3dv(GLuint index, const GLdouble *v)
-{
- d_2_0_Core->f.VertexAttrib3dv(index, v);
-}
-
-inline void QOpenGLFunctions_4_0_Compatibility::glVertexAttrib3d(GLuint index, GLdouble x, GLdouble y, GLdouble z)
-{
- d_2_0_Core->f.VertexAttrib3d(index, x, y, z);
-}
-
-inline void QOpenGLFunctions_4_0_Compatibility::glVertexAttrib2sv(GLuint index, const GLshort *v)
-{
- d_2_0_Core->f.VertexAttrib2sv(index, v);
-}
-
-inline void QOpenGLFunctions_4_0_Compatibility::glVertexAttrib2s(GLuint index, GLshort x, GLshort y)
-{
- d_2_0_Core->f.VertexAttrib2s(index, x, y);
-}
-
-inline void QOpenGLFunctions_4_0_Compatibility::glVertexAttrib2fv(GLuint index, const GLfloat *v)
-{
- d_2_0_Core->f.VertexAttrib2fv(index, v);
-}
-
-inline void QOpenGLFunctions_4_0_Compatibility::glVertexAttrib2f(GLuint index, GLfloat x, GLfloat y)
-{
- d_2_0_Core->f.VertexAttrib2f(index, x, y);
-}
-
-inline void QOpenGLFunctions_4_0_Compatibility::glVertexAttrib2dv(GLuint index, const GLdouble *v)
-{
- d_2_0_Core->f.VertexAttrib2dv(index, v);
-}
-
-inline void QOpenGLFunctions_4_0_Compatibility::glVertexAttrib2d(GLuint index, GLdouble x, GLdouble y)
-{
- d_2_0_Core->f.VertexAttrib2d(index, x, y);
-}
-
-inline void QOpenGLFunctions_4_0_Compatibility::glVertexAttrib1sv(GLuint index, const GLshort *v)
-{
- d_2_0_Core->f.VertexAttrib1sv(index, v);
-}
-
-inline void QOpenGLFunctions_4_0_Compatibility::glVertexAttrib1s(GLuint index, GLshort x)
-{
- d_2_0_Core->f.VertexAttrib1s(index, x);
-}
-
-inline void QOpenGLFunctions_4_0_Compatibility::glVertexAttrib1fv(GLuint index, const GLfloat *v)
-{
- d_2_0_Core->f.VertexAttrib1fv(index, v);
-}
-
-inline void QOpenGLFunctions_4_0_Compatibility::glVertexAttrib1f(GLuint index, GLfloat x)
-{
- d_2_0_Core->f.VertexAttrib1f(index, x);
-}
-
-inline void QOpenGLFunctions_4_0_Compatibility::glVertexAttrib1dv(GLuint index, const GLdouble *v)
-{
- d_2_0_Core->f.VertexAttrib1dv(index, v);
-}
-
-inline void QOpenGLFunctions_4_0_Compatibility::glVertexAttrib1d(GLuint index, GLdouble x)
-{
- d_2_0_Core->f.VertexAttrib1d(index, x);
-}
-
-
-// OpenGL 2.1 deprecated functions
-
-// OpenGL 3.0 deprecated functions
-inline void QOpenGLFunctions_4_0_Compatibility::glVertexAttribI4usv(GLuint index, const GLushort *v)
-{
- d_3_0_Core->f.VertexAttribI4usv(index, v);
-}
-
-inline void QOpenGLFunctions_4_0_Compatibility::glVertexAttribI4ubv(GLuint index, const GLubyte *v)
-{
- d_3_0_Core->f.VertexAttribI4ubv(index, v);
-}
-
-inline void QOpenGLFunctions_4_0_Compatibility::glVertexAttribI4sv(GLuint index, const GLshort *v)
-{
- d_3_0_Core->f.VertexAttribI4sv(index, v);
-}
-
-inline void QOpenGLFunctions_4_0_Compatibility::glVertexAttribI4bv(GLuint index, const GLbyte *v)
-{
- d_3_0_Core->f.VertexAttribI4bv(index, v);
-}
-
-inline void QOpenGLFunctions_4_0_Compatibility::glVertexAttribI4uiv(GLuint index, const GLuint *v)
-{
- d_3_0_Core->f.VertexAttribI4uiv(index, v);
-}
-
-inline void QOpenGLFunctions_4_0_Compatibility::glVertexAttribI3uiv(GLuint index, const GLuint *v)
-{
- d_3_0_Core->f.VertexAttribI3uiv(index, v);
-}
-
-inline void QOpenGLFunctions_4_0_Compatibility::glVertexAttribI2uiv(GLuint index, const GLuint *v)
-{
- d_3_0_Core->f.VertexAttribI2uiv(index, v);
-}
-
-inline void QOpenGLFunctions_4_0_Compatibility::glVertexAttribI1uiv(GLuint index, const GLuint *v)
-{
- d_3_0_Core->f.VertexAttribI1uiv(index, v);
-}
-
-inline void QOpenGLFunctions_4_0_Compatibility::glVertexAttribI4iv(GLuint index, const GLint *v)
-{
- d_3_0_Core->f.VertexAttribI4iv(index, v);
-}
-
-inline void QOpenGLFunctions_4_0_Compatibility::glVertexAttribI3iv(GLuint index, const GLint *v)
-{
- d_3_0_Core->f.VertexAttribI3iv(index, v);
-}
-
-inline void QOpenGLFunctions_4_0_Compatibility::glVertexAttribI2iv(GLuint index, const GLint *v)
-{
- d_3_0_Core->f.VertexAttribI2iv(index, v);
-}
-
-inline void QOpenGLFunctions_4_0_Compatibility::glVertexAttribI1iv(GLuint index, const GLint *v)
-{
- d_3_0_Core->f.VertexAttribI1iv(index, v);
-}
-
-inline void QOpenGLFunctions_4_0_Compatibility::glVertexAttribI4ui(GLuint index, GLuint x, GLuint y, GLuint z, GLuint w)
-{
- d_3_0_Core->f.VertexAttribI4ui(index, x, y, z, w);
-}
-
-inline void QOpenGLFunctions_4_0_Compatibility::glVertexAttribI3ui(GLuint index, GLuint x, GLuint y, GLuint z)
-{
- d_3_0_Core->f.VertexAttribI3ui(index, x, y, z);
-}
-
-inline void QOpenGLFunctions_4_0_Compatibility::glVertexAttribI2ui(GLuint index, GLuint x, GLuint y)
-{
- d_3_0_Core->f.VertexAttribI2ui(index, x, y);
-}
-
-inline void QOpenGLFunctions_4_0_Compatibility::glVertexAttribI1ui(GLuint index, GLuint x)
-{
- d_3_0_Core->f.VertexAttribI1ui(index, x);
-}
-
-inline void QOpenGLFunctions_4_0_Compatibility::glVertexAttribI4i(GLuint index, GLint x, GLint y, GLint z, GLint w)
-{
- d_3_0_Core->f.VertexAttribI4i(index, x, y, z, w);
-}
-
-inline void QOpenGLFunctions_4_0_Compatibility::glVertexAttribI3i(GLuint index, GLint x, GLint y, GLint z)
-{
- d_3_0_Core->f.VertexAttribI3i(index, x, y, z);
-}
-
-inline void QOpenGLFunctions_4_0_Compatibility::glVertexAttribI2i(GLuint index, GLint x, GLint y)
-{
- d_3_0_Core->f.VertexAttribI2i(index, x, y);
-}
-
-inline void QOpenGLFunctions_4_0_Compatibility::glVertexAttribI1i(GLuint index, GLint x)
-{
- d_3_0_Core->f.VertexAttribI1i(index, x);
-}
-
-
-// OpenGL 3.1 deprecated functions
-
-// OpenGL 3.2 deprecated functions
-
-// OpenGL 3.3 deprecated functions
-
-// OpenGL 4.0 deprecated functions
-
-
-QT_END_NAMESPACE
-
-#endif // QT_NO_OPENGL && !QT_OPENGL_ES_2
-
-#endif
diff --git a/src/gui/opengl/qopenglfunctions_4_0_core.cpp b/src/gui/opengl/qopenglfunctions_4_0_core.cpp
deleted file mode 100644
index 60453d147c..0000000000
--- a/src/gui/opengl/qopenglfunctions_4_0_core.cpp
+++ /dev/null
@@ -1,233 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2013 Klaralvdalens Datakonsult AB (KDAB)
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the QtGui module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-**
-** This file was generated by glgen version 0.1
-** Command line was: glgen
-**
-** glgen is Copyright (C) 2013 Klaralvdalens Datakonsult AB (KDAB)
-**
-** This is an auto-generated file.
-** Do not edit! All changes made to it will be lost.
-**
-****************************************************************************/
-
-#include "qopenglfunctions_4_0_core.h"
-#include "qopenglcontext.h"
-
-QT_BEGIN_NAMESPACE
-
-/*!
- \class QOpenGLFunctions_4_0_Core
- \inmodule QtGui
- \since 5.1
- \wrapper
- \brief The QOpenGLFunctions_4_0_Core class provides all functions for OpenGL 4.0 core profile.
-
- This class is a wrapper for functions from OpenGL 4.0 core profile.
- See reference pages on \l {http://www.opengl.org/sdk/docs/}{opengl.org}
- for function documentation.
-
- \sa QAbstractOpenGLFunctions
-*/
-
-QOpenGLFunctions_4_0_Core::QOpenGLFunctions_4_0_Core()
- : QAbstractOpenGLFunctions()
- , d_1_0_Core(nullptr)
- , d_1_1_Core(nullptr)
- , d_1_2_Core(nullptr)
- , d_1_3_Core(nullptr)
- , d_1_4_Core(nullptr)
- , d_1_5_Core(nullptr)
- , d_2_0_Core(nullptr)
- , d_2_1_Core(nullptr)
- , d_3_0_Core(nullptr)
- , d_3_1_Core(nullptr)
- , d_3_2_Core(nullptr)
- , d_3_3_Core(nullptr)
- , d_4_0_Core(nullptr)
-{
-}
-
-QOpenGLFunctions_4_0_Core::~QOpenGLFunctions_4_0_Core()
-{
- if (d_1_0_Core) {
- d_1_0_Core->refs.deref();
- Q_ASSERT(d_1_0_Core->refs.loadRelaxed());
- }
- if (d_1_1_Core) {
- d_1_1_Core->refs.deref();
- Q_ASSERT(d_1_1_Core->refs.loadRelaxed());
- }
- if (d_1_2_Core) {
- d_1_2_Core->refs.deref();
- Q_ASSERT(d_1_2_Core->refs.loadRelaxed());
- }
- if (d_1_3_Core) {
- d_1_3_Core->refs.deref();
- Q_ASSERT(d_1_3_Core->refs.loadRelaxed());
- }
- if (d_1_4_Core) {
- d_1_4_Core->refs.deref();
- Q_ASSERT(d_1_4_Core->refs.loadRelaxed());
- }
- if (d_1_5_Core) {
- d_1_5_Core->refs.deref();
- Q_ASSERT(d_1_5_Core->refs.loadRelaxed());
- }
- if (d_2_0_Core) {
- d_2_0_Core->refs.deref();
- Q_ASSERT(d_2_0_Core->refs.loadRelaxed());
- }
- if (d_2_1_Core) {
- d_2_1_Core->refs.deref();
- Q_ASSERT(d_2_1_Core->refs.loadRelaxed());
- }
- if (d_3_0_Core) {
- d_3_0_Core->refs.deref();
- Q_ASSERT(d_3_0_Core->refs.loadRelaxed());
- }
- if (d_3_1_Core) {
- d_3_1_Core->refs.deref();
- Q_ASSERT(d_3_1_Core->refs.loadRelaxed());
- }
- if (d_3_2_Core) {
- d_3_2_Core->refs.deref();
- Q_ASSERT(d_3_2_Core->refs.loadRelaxed());
- }
- if (d_3_3_Core) {
- d_3_3_Core->refs.deref();
- Q_ASSERT(d_3_3_Core->refs.loadRelaxed());
- }
- if (d_4_0_Core) {
- d_4_0_Core->refs.deref();
- Q_ASSERT(d_4_0_Core->refs.loadRelaxed());
- }
-}
-
-bool QOpenGLFunctions_4_0_Core::initializeOpenGLFunctions()
-{
- if ( isInitialized() )
- return true;
-
- QOpenGLContext* context = QOpenGLContext::currentContext();
-
- // If owned by a context object make sure it is current.
- // Also check that current context is capable of resolving all needed functions
- if (((owningContext() && owningContext() == context) || !owningContext())
- && QOpenGLFunctions_4_0_Core::isContextCompatible(context))
- {
- // Associate with private implementation, creating if necessary
- // Function pointers in the backends are resolved at creation time
- QOpenGLVersionFunctionsBackend* d = nullptr;
- d = QAbstractOpenGLFunctionsPrivate::functionsBackend(context, QOpenGLFunctions_1_0_CoreBackend::versionStatus());
- d_1_0_Core = static_cast<QOpenGLFunctions_1_0_CoreBackend*>(d);
- d->refs.ref();
-
- d = QAbstractOpenGLFunctionsPrivate::functionsBackend(context, QOpenGLFunctions_1_1_CoreBackend::versionStatus());
- d_1_1_Core = static_cast<QOpenGLFunctions_1_1_CoreBackend*>(d);
- d->refs.ref();
-
- d = QAbstractOpenGLFunctionsPrivate::functionsBackend(context, QOpenGLFunctions_1_2_CoreBackend::versionStatus());
- d_1_2_Core = static_cast<QOpenGLFunctions_1_2_CoreBackend*>(d);
- d->refs.ref();
-
- d = QAbstractOpenGLFunctionsPrivate::functionsBackend(context, QOpenGLFunctions_1_3_CoreBackend::versionStatus());
- d_1_3_Core = static_cast<QOpenGLFunctions_1_3_CoreBackend*>(d);
- d->refs.ref();
-
- d = QAbstractOpenGLFunctionsPrivate::functionsBackend(context, QOpenGLFunctions_1_4_CoreBackend::versionStatus());
- d_1_4_Core = static_cast<QOpenGLFunctions_1_4_CoreBackend*>(d);
- d->refs.ref();
-
- d = QAbstractOpenGLFunctionsPrivate::functionsBackend(context, QOpenGLFunctions_1_5_CoreBackend::versionStatus());
- d_1_5_Core = static_cast<QOpenGLFunctions_1_5_CoreBackend*>(d);
- d->refs.ref();
-
- d = QAbstractOpenGLFunctionsPrivate::functionsBackend(context, QOpenGLFunctions_2_0_CoreBackend::versionStatus());
- d_2_0_Core = static_cast<QOpenGLFunctions_2_0_CoreBackend*>(d);
- d->refs.ref();
-
- d = QAbstractOpenGLFunctionsPrivate::functionsBackend(context, QOpenGLFunctions_2_1_CoreBackend::versionStatus());
- d_2_1_Core = static_cast<QOpenGLFunctions_2_1_CoreBackend*>(d);
- d->refs.ref();
-
- d = QAbstractOpenGLFunctionsPrivate::functionsBackend(context, QOpenGLFunctions_3_0_CoreBackend::versionStatus());
- d_3_0_Core = static_cast<QOpenGLFunctions_3_0_CoreBackend*>(d);
- d->refs.ref();
-
- d = QAbstractOpenGLFunctionsPrivate::functionsBackend(context, QOpenGLFunctions_3_1_CoreBackend::versionStatus());
- d_3_1_Core = static_cast<QOpenGLFunctions_3_1_CoreBackend*>(d);
- d->refs.ref();
-
- d = QAbstractOpenGLFunctionsPrivate::functionsBackend(context, QOpenGLFunctions_3_2_CoreBackend::versionStatus());
- d_3_2_Core = static_cast<QOpenGLFunctions_3_2_CoreBackend*>(d);
- d->refs.ref();
-
- d = QAbstractOpenGLFunctionsPrivate::functionsBackend(context, QOpenGLFunctions_3_3_CoreBackend::versionStatus());
- d_3_3_Core = static_cast<QOpenGLFunctions_3_3_CoreBackend*>(d);
- d->refs.ref();
-
- d = QAbstractOpenGLFunctionsPrivate::functionsBackend(context, QOpenGLFunctions_4_0_CoreBackend::versionStatus());
- d_4_0_Core = static_cast<QOpenGLFunctions_4_0_CoreBackend*>(d);
- d->refs.ref();
-
- QAbstractOpenGLFunctions::initializeOpenGLFunctions();
- }
- return isInitialized();
-}
-
-bool QOpenGLFunctions_4_0_Core::isContextCompatible(QOpenGLContext *context)
-{
- Q_ASSERT(context);
- QSurfaceFormat f = context->format();
- const QPair<int, int> v = qMakePair(f.majorVersion(), f.minorVersion());
- if (v < qMakePair(4, 0))
- return false;
-
- return true;
-}
-
-QOpenGLVersionProfile QOpenGLFunctions_4_0_Core::versionProfile()
-{
- QOpenGLVersionProfile v;
- v.setVersion(4, 0);
- v.setProfile(QSurfaceFormat::CoreProfile);
- return v;
-}
-
-QT_END_NAMESPACE
diff --git a/src/gui/opengl/qopenglfunctions_4_0_core.h b/src/gui/opengl/qopenglfunctions_4_0_core.h
deleted file mode 100644
index 6cb55e86f7..0000000000
--- a/src/gui/opengl/qopenglfunctions_4_0_core.h
+++ /dev/null
@@ -1,2422 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2013 Klaralvdalens Datakonsult AB (KDAB)
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the QtGui module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-**
-** This file was generated by glgen version 0.1
-** Command line was: glgen
-**
-** glgen is Copyright (C) 2013 Klaralvdalens Datakonsult AB (KDAB)
-**
-** This is an auto-generated file.
-** Do not edit! All changes made to it will be lost.
-**
-****************************************************************************/
-
-#ifndef QOPENGLVERSIONFUNCTIONS_4_0_CORE_H
-#define QOPENGLVERSIONFUNCTIONS_4_0_CORE_H
-
-#include <QtGui/qtguiglobal.h>
-
-#if !defined(QT_NO_OPENGL) && !defined(QT_OPENGL_ES_2)
-
-#include <QtGui/QOpenGLVersionFunctions>
-#include <QtGui/qopenglcontext.h>
-
-QT_BEGIN_NAMESPACE
-
-class Q_GUI_EXPORT QOpenGLFunctions_4_0_Core : public QAbstractOpenGLFunctions
-{
-public:
- QOpenGLFunctions_4_0_Core();
- ~QOpenGLFunctions_4_0_Core();
-
- bool initializeOpenGLFunctions() override;
-
- // OpenGL 1.0 core functions
- void glViewport(GLint x, GLint y, GLsizei width, GLsizei height);
- void glDepthRange(GLdouble nearVal, GLdouble farVal);
- GLboolean glIsEnabled(GLenum cap);
- void glGetTexLevelParameteriv(GLenum target, GLint level, GLenum pname, GLint *params);
- void glGetTexLevelParameterfv(GLenum target, GLint level, GLenum pname, GLfloat *params);
- void glGetTexParameteriv(GLenum target, GLenum pname, GLint *params);
- void glGetTexParameterfv(GLenum target, GLenum pname, GLfloat *params);
- void glGetTexImage(GLenum target, GLint level, GLenum format, GLenum type, GLvoid *pixels);
- const GLubyte * glGetString(GLenum name);
- void glGetIntegerv(GLenum pname, GLint *params);
- void glGetFloatv(GLenum pname, GLfloat *params);
- GLenum glGetError();
- void glGetDoublev(GLenum pname, GLdouble *params);
- void glGetBooleanv(GLenum pname, GLboolean *params);
- void glReadPixels(GLint x, GLint y, GLsizei width, GLsizei height, GLenum format, GLenum type, GLvoid *pixels);
- void glReadBuffer(GLenum mode);
- void glPixelStorei(GLenum pname, GLint param);
- void glPixelStoref(GLenum pname, GLfloat param);
- void glDepthFunc(GLenum func);
- void glStencilOp(GLenum fail, GLenum zfail, GLenum zpass);
- void glStencilFunc(GLenum func, GLint ref, GLuint mask);
- void glLogicOp(GLenum opcode);
- void glBlendFunc(GLenum sfactor, GLenum dfactor);
- void glFlush();
- void glFinish();
- void glEnable(GLenum cap);
- void glDisable(GLenum cap);
- void glDepthMask(GLboolean flag);
- void glColorMask(GLboolean red, GLboolean green, GLboolean blue, GLboolean alpha);
- void glStencilMask(GLuint mask);
- void glClearDepth(GLdouble depth);
- void glClearStencil(GLint s);
- void glClearColor(GLfloat red, GLfloat green, GLfloat blue, GLfloat alpha);
- void glClear(GLbitfield mask);
- void glDrawBuffer(GLenum mode);
- void glTexImage2D(GLenum target, GLint level, GLint internalformat, GLsizei width, GLsizei height, GLint border, GLenum format, GLenum type, const GLvoid *pixels);
- void glTexImage1D(GLenum target, GLint level, GLint internalformat, GLsizei width, GLint border, GLenum format, GLenum type, const GLvoid *pixels);
- void glTexParameteriv(GLenum target, GLenum pname, const GLint *params);
- void glTexParameteri(GLenum target, GLenum pname, GLint param);
- void glTexParameterfv(GLenum target, GLenum pname, const GLfloat *params);
- void glTexParameterf(GLenum target, GLenum pname, GLfloat param);
- void glScissor(GLint x, GLint y, GLsizei width, GLsizei height);
- void glPolygonMode(GLenum face, GLenum mode);
- void glPointSize(GLfloat size);
- void glLineWidth(GLfloat width);
- void glHint(GLenum target, GLenum mode);
- void glFrontFace(GLenum mode);
- void glCullFace(GLenum mode);
-
- // OpenGL 1.1 core functions
- void glIndexubv(const GLubyte *c);
- void glIndexub(GLubyte c);
- GLboolean glIsTexture(GLuint texture);
- void glGenTextures(GLsizei n, GLuint *textures);
- void glDeleteTextures(GLsizei n, const GLuint *textures);
- void glBindTexture(GLenum target, GLuint texture);
- void glTexSubImage2D(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLenum type, const GLvoid *pixels);
- void glTexSubImage1D(GLenum target, GLint level, GLint xoffset, GLsizei width, GLenum format, GLenum type, const GLvoid *pixels);
- void glCopyTexSubImage2D(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint x, GLint y, GLsizei width, GLsizei height);
- void glCopyTexSubImage1D(GLenum target, GLint level, GLint xoffset, GLint x, GLint y, GLsizei width);
- void glCopyTexImage2D(GLenum target, GLint level, GLenum internalformat, GLint x, GLint y, GLsizei width, GLsizei height, GLint border);
- void glCopyTexImage1D(GLenum target, GLint level, GLenum internalformat, GLint x, GLint y, GLsizei width, GLint border);
- void glPolygonOffset(GLfloat factor, GLfloat units);
- void glGetPointerv(GLenum pname, GLvoid* *params);
- void glDrawElements(GLenum mode, GLsizei count, GLenum type, const GLvoid *indices);
- void glDrawArrays(GLenum mode, GLint first, GLsizei count);
-
- // OpenGL 1.2 core functions
- void glCopyTexSubImage3D(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLint x, GLint y, GLsizei width, GLsizei height);
- void glTexSubImage3D(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLenum type, const GLvoid *pixels);
- void glTexImage3D(GLenum target, GLint level, GLint internalformat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLenum format, GLenum type, const GLvoid *pixels);
- void glDrawRangeElements(GLenum mode, GLuint start, GLuint end, GLsizei count, GLenum type, const GLvoid *indices);
- void glBlendEquation(GLenum mode);
- void glBlendColor(GLfloat red, GLfloat green, GLfloat blue, GLfloat alpha);
-
- // OpenGL 1.3 core functions
- void glGetCompressedTexImage(GLenum target, GLint level, GLvoid *img);
- void glCompressedTexSubImage1D(GLenum target, GLint level, GLint xoffset, GLsizei width, GLenum format, GLsizei imageSize, const GLvoid *data);
- void glCompressedTexSubImage2D(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLsizei imageSize, const GLvoid *data);
- void glCompressedTexSubImage3D(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLsizei imageSize, const GLvoid *data);
- void glCompressedTexImage1D(GLenum target, GLint level, GLenum internalformat, GLsizei width, GLint border, GLsizei imageSize, const GLvoid *data);
- void glCompressedTexImage2D(GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLint border, GLsizei imageSize, const GLvoid *data);
- void glCompressedTexImage3D(GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLsizei imageSize, const GLvoid *data);
- void glSampleCoverage(GLfloat value, GLboolean invert);
- void glActiveTexture(GLenum texture);
-
- // OpenGL 1.4 core functions
- void glPointParameteriv(GLenum pname, const GLint *params);
- void glPointParameteri(GLenum pname, GLint param);
- void glPointParameterfv(GLenum pname, const GLfloat *params);
- void glPointParameterf(GLenum pname, GLfloat param);
- void glMultiDrawElements(GLenum mode, const GLsizei *count, GLenum type, const GLvoid* const *indices, GLsizei drawcount);
- void glMultiDrawArrays(GLenum mode, const GLint *first, const GLsizei *count, GLsizei drawcount);
- void glBlendFuncSeparate(GLenum sfactorRGB, GLenum dfactorRGB, GLenum sfactorAlpha, GLenum dfactorAlpha);
-
- // OpenGL 1.5 core functions
- void glGetBufferPointerv(GLenum target, GLenum pname, GLvoid* *params);
- void glGetBufferParameteriv(GLenum target, GLenum pname, GLint *params);
- GLboolean glUnmapBuffer(GLenum target);
- GLvoid* glMapBuffer(GLenum target, GLenum access);
- void glGetBufferSubData(GLenum target, GLintptr offset, GLsizeiptr size, GLvoid *data);
- void glBufferSubData(GLenum target, GLintptr offset, GLsizeiptr size, const GLvoid *data);
- void glBufferData(GLenum target, GLsizeiptr size, const GLvoid *data, GLenum usage);
- GLboolean glIsBuffer(GLuint buffer);
- void glGenBuffers(GLsizei n, GLuint *buffers);
- void glDeleteBuffers(GLsizei n, const GLuint *buffers);
- void glBindBuffer(GLenum target, GLuint buffer);
- void glGetQueryObjectuiv(GLuint id, GLenum pname, GLuint *params);
- void glGetQueryObjectiv(GLuint id, GLenum pname, GLint *params);
- void glGetQueryiv(GLenum target, GLenum pname, GLint *params);
- void glEndQuery(GLenum target);
- void glBeginQuery(GLenum target, GLuint id);
- GLboolean glIsQuery(GLuint id);
- void glDeleteQueries(GLsizei n, const GLuint *ids);
- void glGenQueries(GLsizei n, GLuint *ids);
-
- // OpenGL 2.0 core functions
- void glVertexAttribPointer(GLuint index, GLint size, GLenum type, GLboolean normalized, GLsizei stride, const GLvoid *pointer);
- void glValidateProgram(GLuint program);
- void glUniformMatrix4fv(GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
- void glUniformMatrix3fv(GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
- void glUniformMatrix2fv(GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
- void glUniform4iv(GLint location, GLsizei count, const GLint *value);
- void glUniform3iv(GLint location, GLsizei count, const GLint *value);
- void glUniform2iv(GLint location, GLsizei count, const GLint *value);
- void glUniform1iv(GLint location, GLsizei count, const GLint *value);
- void glUniform4fv(GLint location, GLsizei count, const GLfloat *value);
- void glUniform3fv(GLint location, GLsizei count, const GLfloat *value);
- void glUniform2fv(GLint location, GLsizei count, const GLfloat *value);
- void glUniform1fv(GLint location, GLsizei count, const GLfloat *value);
- void glUniform4i(GLint location, GLint v0, GLint v1, GLint v2, GLint v3);
- void glUniform3i(GLint location, GLint v0, GLint v1, GLint v2);
- void glUniform2i(GLint location, GLint v0, GLint v1);
- void glUniform1i(GLint location, GLint v0);
- void glUniform4f(GLint location, GLfloat v0, GLfloat v1, GLfloat v2, GLfloat v3);
- void glUniform3f(GLint location, GLfloat v0, GLfloat v1, GLfloat v2);
- void glUniform2f(GLint location, GLfloat v0, GLfloat v1);
- void glUniform1f(GLint location, GLfloat v0);
- void glUseProgram(GLuint program);
- void glShaderSource(GLuint shader, GLsizei count, const GLchar* const *string, const GLint *length);
- void glLinkProgram(GLuint program);
- GLboolean glIsShader(GLuint shader);
- GLboolean glIsProgram(GLuint program);
- void glGetVertexAttribPointerv(GLuint index, GLenum pname, GLvoid* *pointer);
- void glGetVertexAttribiv(GLuint index, GLenum pname, GLint *params);
- void glGetVertexAttribfv(GLuint index, GLenum pname, GLfloat *params);
- void glGetVertexAttribdv(GLuint index, GLenum pname, GLdouble *params);
- void glGetUniformiv(GLuint program, GLint location, GLint *params);
- void glGetUniformfv(GLuint program, GLint location, GLfloat *params);
- GLint glGetUniformLocation(GLuint program, const GLchar *name);
- void glGetShaderSource(GLuint shader, GLsizei bufSize, GLsizei *length, GLchar *source);
- void glGetShaderInfoLog(GLuint shader, GLsizei bufSize, GLsizei *length, GLchar *infoLog);
- void glGetShaderiv(GLuint shader, GLenum pname, GLint *params);
- void glGetProgramInfoLog(GLuint program, GLsizei bufSize, GLsizei *length, GLchar *infoLog);
- void glGetProgramiv(GLuint program, GLenum pname, GLint *params);
- GLint glGetAttribLocation(GLuint program, const GLchar *name);
- void glGetAttachedShaders(GLuint program, GLsizei maxCount, GLsizei *count, GLuint *obj);
- void glGetActiveUniform(GLuint program, GLuint index, GLsizei bufSize, GLsizei *length, GLint *size, GLenum *type, GLchar *name);
- void glGetActiveAttrib(GLuint program, GLuint index, GLsizei bufSize, GLsizei *length, GLint *size, GLenum *type, GLchar *name);
- void glEnableVertexAttribArray(GLuint index);
- void glDisableVertexAttribArray(GLuint index);
- void glDetachShader(GLuint program, GLuint shader);
- void glDeleteShader(GLuint shader);
- void glDeleteProgram(GLuint program);
- GLuint glCreateShader(GLenum type);
- GLuint glCreateProgram();
- void glCompileShader(GLuint shader);
- void glBindAttribLocation(GLuint program, GLuint index, const GLchar *name);
- void glAttachShader(GLuint program, GLuint shader);
- void glStencilMaskSeparate(GLenum face, GLuint mask);
- void glStencilFuncSeparate(GLenum face, GLenum func, GLint ref, GLuint mask);
- void glStencilOpSeparate(GLenum face, GLenum sfail, GLenum dpfail, GLenum dppass);
- void glDrawBuffers(GLsizei n, const GLenum *bufs);
- void glBlendEquationSeparate(GLenum modeRGB, GLenum modeAlpha);
-
- // OpenGL 2.1 core functions
- void glUniformMatrix4x3fv(GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
- void glUniformMatrix3x4fv(GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
- void glUniformMatrix4x2fv(GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
- void glUniformMatrix2x4fv(GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
- void glUniformMatrix3x2fv(GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
- void glUniformMatrix2x3fv(GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
-
- // OpenGL 3.0 core functions
- GLboolean glIsVertexArray(GLuint array);
- void glGenVertexArrays(GLsizei n, GLuint *arrays);
- void glDeleteVertexArrays(GLsizei n, const GLuint *arrays);
- void glBindVertexArray(GLuint array);
- void glFlushMappedBufferRange(GLenum target, GLintptr offset, GLsizeiptr length);
- GLvoid* glMapBufferRange(GLenum target, GLintptr offset, GLsizeiptr length, GLbitfield access);
- void glFramebufferTextureLayer(GLenum target, GLenum attachment, GLuint texture, GLint level, GLint layer);
- void glRenderbufferStorageMultisample(GLenum target, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height);
- void glBlitFramebuffer(GLint srcX0, GLint srcY0, GLint srcX1, GLint srcY1, GLint dstX0, GLint dstY0, GLint dstX1, GLint dstY1, GLbitfield mask, GLenum filter);
- void glGenerateMipmap(GLenum target);
- void glGetFramebufferAttachmentParameteriv(GLenum target, GLenum attachment, GLenum pname, GLint *params);
- void glFramebufferRenderbuffer(GLenum target, GLenum attachment, GLenum renderbuffertarget, GLuint renderbuffer);
- void glFramebufferTexture3D(GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level, GLint zoffset);
- void glFramebufferTexture2D(GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level);
- void glFramebufferTexture1D(GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level);
- GLenum glCheckFramebufferStatus(GLenum target);
- void glGenFramebuffers(GLsizei n, GLuint *framebuffers);
- void glDeleteFramebuffers(GLsizei n, const GLuint *framebuffers);
- void glBindFramebuffer(GLenum target, GLuint framebuffer);
- GLboolean glIsFramebuffer(GLuint framebuffer);
- void glGetRenderbufferParameteriv(GLenum target, GLenum pname, GLint *params);
- void glRenderbufferStorage(GLenum target, GLenum internalformat, GLsizei width, GLsizei height);
- void glGenRenderbuffers(GLsizei n, GLuint *renderbuffers);
- void glDeleteRenderbuffers(GLsizei n, const GLuint *renderbuffers);
- void glBindRenderbuffer(GLenum target, GLuint renderbuffer);
- GLboolean glIsRenderbuffer(GLuint renderbuffer);
- const GLubyte * glGetStringi(GLenum name, GLuint index);
- void glClearBufferfi(GLenum buffer, GLint drawbuffer, GLfloat depth, GLint stencil);
- void glClearBufferfv(GLenum buffer, GLint drawbuffer, const GLfloat *value);
- void glClearBufferuiv(GLenum buffer, GLint drawbuffer, const GLuint *value);
- void glClearBufferiv(GLenum buffer, GLint drawbuffer, const GLint *value);
- void glGetTexParameterIuiv(GLenum target, GLenum pname, GLuint *params);
- void glGetTexParameterIiv(GLenum target, GLenum pname, GLint *params);
- void glTexParameterIuiv(GLenum target, GLenum pname, const GLuint *params);
- void glTexParameterIiv(GLenum target, GLenum pname, const GLint *params);
- void glUniform4uiv(GLint location, GLsizei count, const GLuint *value);
- void glUniform3uiv(GLint location, GLsizei count, const GLuint *value);
- void glUniform2uiv(GLint location, GLsizei count, const GLuint *value);
- void glUniform1uiv(GLint location, GLsizei count, const GLuint *value);
- void glUniform4ui(GLint location, GLuint v0, GLuint v1, GLuint v2, GLuint v3);
- void glUniform3ui(GLint location, GLuint v0, GLuint v1, GLuint v2);
- void glUniform2ui(GLint location, GLuint v0, GLuint v1);
- void glUniform1ui(GLint location, GLuint v0);
- GLint glGetFragDataLocation(GLuint program, const GLchar *name);
- void glBindFragDataLocation(GLuint program, GLuint color, const GLchar *name);
- void glGetUniformuiv(GLuint program, GLint location, GLuint *params);
- void glGetVertexAttribIuiv(GLuint index, GLenum pname, GLuint *params);
- void glGetVertexAttribIiv(GLuint index, GLenum pname, GLint *params);
- void glVertexAttribIPointer(GLuint index, GLint size, GLenum type, GLsizei stride, const GLvoid *pointer);
- void glEndConditionalRender();
- void glBeginConditionalRender(GLuint id, GLenum mode);
- void glClampColor(GLenum target, GLenum clamp);
- void glGetTransformFeedbackVarying(GLuint program, GLuint index, GLsizei bufSize, GLsizei *length, GLsizei *size, GLenum *type, GLchar *name);
- void glTransformFeedbackVaryings(GLuint program, GLsizei count, const GLchar* const *varyings, GLenum bufferMode);
- void glBindBufferBase(GLenum target, GLuint index, GLuint buffer);
- void glBindBufferRange(GLenum target, GLuint index, GLuint buffer, GLintptr offset, GLsizeiptr size);
- void glEndTransformFeedback();
- void glBeginTransformFeedback(GLenum primitiveMode);
- GLboolean glIsEnabledi(GLenum target, GLuint index);
- void glDisablei(GLenum target, GLuint index);
- void glEnablei(GLenum target, GLuint index);
- void glGetIntegeri_v(GLenum target, GLuint index, GLint *data);
- void glGetBooleani_v(GLenum target, GLuint index, GLboolean *data);
- void glColorMaski(GLuint index, GLboolean r, GLboolean g, GLboolean b, GLboolean a);
-
- // OpenGL 3.1 core functions
- void glCopyBufferSubData(GLenum readTarget, GLenum writeTarget, GLintptr readOffset, GLintptr writeOffset, GLsizeiptr size);
- void glUniformBlockBinding(GLuint program, GLuint uniformBlockIndex, GLuint uniformBlockBinding);
- void glGetActiveUniformBlockName(GLuint program, GLuint uniformBlockIndex, GLsizei bufSize, GLsizei *length, GLchar *uniformBlockName);
- void glGetActiveUniformBlockiv(GLuint program, GLuint uniformBlockIndex, GLenum pname, GLint *params);
- GLuint glGetUniformBlockIndex(GLuint program, const GLchar *uniformBlockName);
- void glGetActiveUniformName(GLuint program, GLuint uniformIndex, GLsizei bufSize, GLsizei *length, GLchar *uniformName);
- void glGetActiveUniformsiv(GLuint program, GLsizei uniformCount, const GLuint *uniformIndices, GLenum pname, GLint *params);
- void glGetUniformIndices(GLuint program, GLsizei uniformCount, const GLchar* const *uniformNames, GLuint *uniformIndices);
- void glPrimitiveRestartIndex(GLuint index);
- void glTexBuffer(GLenum target, GLenum internalformat, GLuint buffer);
- void glDrawElementsInstanced(GLenum mode, GLsizei count, GLenum type, const GLvoid *indices, GLsizei instancecount);
- void glDrawArraysInstanced(GLenum mode, GLint first, GLsizei count, GLsizei instancecount);
-
- // OpenGL 3.2 core functions
- void glSampleMaski(GLuint index, GLbitfield mask);
- void glGetMultisamplefv(GLenum pname, GLuint index, GLfloat *val);
- void glTexImage3DMultisample(GLenum target, GLsizei samples, GLint internalformat, GLsizei width, GLsizei height, GLsizei depth, GLboolean fixedsamplelocations);
- void glTexImage2DMultisample(GLenum target, GLsizei samples, GLint internalformat, GLsizei width, GLsizei height, GLboolean fixedsamplelocations);
- void glGetSynciv(GLsync sync, GLenum pname, GLsizei bufSize, GLsizei *length, GLint *values);
- void glGetInteger64v(GLenum pname, GLint64 *params);
- void glWaitSync(GLsync sync, GLbitfield flags, GLuint64 timeout);
- GLenum glClientWaitSync(GLsync sync, GLbitfield flags, GLuint64 timeout);
- void glDeleteSync(GLsync sync);
- GLboolean glIsSync(GLsync sync);
- GLsync glFenceSync(GLenum condition, GLbitfield flags);
- void glProvokingVertex(GLenum mode);
- void glMultiDrawElementsBaseVertex(GLenum mode, const GLsizei *count, GLenum type, const GLvoid* const *indices, GLsizei drawcount, const GLint *basevertex);
- void glDrawElementsInstancedBaseVertex(GLenum mode, GLsizei count, GLenum type, const GLvoid *indices, GLsizei instancecount, GLint basevertex);
- void glDrawRangeElementsBaseVertex(GLenum mode, GLuint start, GLuint end, GLsizei count, GLenum type, const GLvoid *indices, GLint basevertex);
- void glDrawElementsBaseVertex(GLenum mode, GLsizei count, GLenum type, const GLvoid *indices, GLint basevertex);
- void glFramebufferTexture(GLenum target, GLenum attachment, GLuint texture, GLint level);
- void glGetBufferParameteri64v(GLenum target, GLenum pname, GLint64 *params);
- void glGetInteger64i_v(GLenum target, GLuint index, GLint64 *data);
-
- // OpenGL 3.3 core functions
- void glVertexAttribP4uiv(GLuint index, GLenum type, GLboolean normalized, const GLuint *value);
- void glVertexAttribP4ui(GLuint index, GLenum type, GLboolean normalized, GLuint value);
- void glVertexAttribP3uiv(GLuint index, GLenum type, GLboolean normalized, const GLuint *value);
- void glVertexAttribP3ui(GLuint index, GLenum type, GLboolean normalized, GLuint value);
- void glVertexAttribP2uiv(GLuint index, GLenum type, GLboolean normalized, const GLuint *value);
- void glVertexAttribP2ui(GLuint index, GLenum type, GLboolean normalized, GLuint value);
- void glVertexAttribP1uiv(GLuint index, GLenum type, GLboolean normalized, const GLuint *value);
- void glVertexAttribP1ui(GLuint index, GLenum type, GLboolean normalized, GLuint value);
- void glSecondaryColorP3uiv(GLenum type, const GLuint *color);
- void glSecondaryColorP3ui(GLenum type, GLuint color);
- void glColorP4uiv(GLenum type, const GLuint *color);
- void glColorP4ui(GLenum type, GLuint color);
- void glColorP3uiv(GLenum type, const GLuint *color);
- void glColorP3ui(GLenum type, GLuint color);
- void glNormalP3uiv(GLenum type, const GLuint *coords);
- void glNormalP3ui(GLenum type, GLuint coords);
- void glMultiTexCoordP4uiv(GLenum texture, GLenum type, const GLuint *coords);
- void glMultiTexCoordP4ui(GLenum texture, GLenum type, GLuint coords);
- void glMultiTexCoordP3uiv(GLenum texture, GLenum type, const GLuint *coords);
- void glMultiTexCoordP3ui(GLenum texture, GLenum type, GLuint coords);
- void glMultiTexCoordP2uiv(GLenum texture, GLenum type, const GLuint *coords);
- void glMultiTexCoordP2ui(GLenum texture, GLenum type, GLuint coords);
- void glMultiTexCoordP1uiv(GLenum texture, GLenum type, const GLuint *coords);
- void glMultiTexCoordP1ui(GLenum texture, GLenum type, GLuint coords);
- void glTexCoordP4uiv(GLenum type, const GLuint *coords);
- void glTexCoordP4ui(GLenum type, GLuint coords);
- void glTexCoordP3uiv(GLenum type, const GLuint *coords);
- void glTexCoordP3ui(GLenum type, GLuint coords);
- void glTexCoordP2uiv(GLenum type, const GLuint *coords);
- void glTexCoordP2ui(GLenum type, GLuint coords);
- void glTexCoordP1uiv(GLenum type, const GLuint *coords);
- void glTexCoordP1ui(GLenum type, GLuint coords);
- void glVertexP4uiv(GLenum type, const GLuint *value);
- void glVertexP4ui(GLenum type, GLuint value);
- void glVertexP3uiv(GLenum type, const GLuint *value);
- void glVertexP3ui(GLenum type, GLuint value);
- void glVertexP2uiv(GLenum type, const GLuint *value);
- void glVertexP2ui(GLenum type, GLuint value);
- void glGetQueryObjectui64v(GLuint id, GLenum pname, GLuint64 *params);
- void glGetQueryObjecti64v(GLuint id, GLenum pname, GLint64 *params);
- void glQueryCounter(GLuint id, GLenum target);
- void glGetSamplerParameterIuiv(GLuint sampler, GLenum pname, GLuint *params);
- void glGetSamplerParameterfv(GLuint sampler, GLenum pname, GLfloat *params);
- void glGetSamplerParameterIiv(GLuint sampler, GLenum pname, GLint *params);
- void glGetSamplerParameteriv(GLuint sampler, GLenum pname, GLint *params);
- void glSamplerParameterIuiv(GLuint sampler, GLenum pname, const GLuint *param);
- void glSamplerParameterIiv(GLuint sampler, GLenum pname, const GLint *param);
- void glSamplerParameterfv(GLuint sampler, GLenum pname, const GLfloat *param);
- void glSamplerParameterf(GLuint sampler, GLenum pname, GLfloat param);
- void glSamplerParameteriv(GLuint sampler, GLenum pname, const GLint *param);
- void glSamplerParameteri(GLuint sampler, GLenum pname, GLint param);
- void glBindSampler(GLuint unit, GLuint sampler);
- GLboolean glIsSampler(GLuint sampler);
- void glDeleteSamplers(GLsizei count, const GLuint *samplers);
- void glGenSamplers(GLsizei count, GLuint *samplers);
- GLint glGetFragDataIndex(GLuint program, const GLchar *name);
- void glBindFragDataLocationIndexed(GLuint program, GLuint colorNumber, GLuint index, const GLchar *name);
- void glVertexAttribDivisor(GLuint index, GLuint divisor);
-
- // OpenGL 4.0 core functions
- void glGetQueryIndexediv(GLenum target, GLuint index, GLenum pname, GLint *params);
- void glEndQueryIndexed(GLenum target, GLuint index);
- void glBeginQueryIndexed(GLenum target, GLuint index, GLuint id);
- void glDrawTransformFeedbackStream(GLenum mode, GLuint id, GLuint stream);
- void glDrawTransformFeedback(GLenum mode, GLuint id);
- void glResumeTransformFeedback();
- void glPauseTransformFeedback();
- GLboolean glIsTransformFeedback(GLuint id);
- void glGenTransformFeedbacks(GLsizei n, GLuint *ids);
- void glDeleteTransformFeedbacks(GLsizei n, const GLuint *ids);
- void glBindTransformFeedback(GLenum target, GLuint id);
- void glPatchParameterfv(GLenum pname, const GLfloat *values);
- void glPatchParameteri(GLenum pname, GLint value);
- void glGetProgramStageiv(GLuint program, GLenum shadertype, GLenum pname, GLint *values);
- void glGetUniformSubroutineuiv(GLenum shadertype, GLint location, GLuint *params);
- void glUniformSubroutinesuiv(GLenum shadertype, GLsizei count, const GLuint *indices);
- void glGetActiveSubroutineName(GLuint program, GLenum shadertype, GLuint index, GLsizei bufsize, GLsizei *length, GLchar *name);
- void glGetActiveSubroutineUniformName(GLuint program, GLenum shadertype, GLuint index, GLsizei bufsize, GLsizei *length, GLchar *name);
- void glGetActiveSubroutineUniformiv(GLuint program, GLenum shadertype, GLuint index, GLenum pname, GLint *values);
- GLuint glGetSubroutineIndex(GLuint program, GLenum shadertype, const GLchar *name);
- GLint glGetSubroutineUniformLocation(GLuint program, GLenum shadertype, const GLchar *name);
- void glGetUniformdv(GLuint program, GLint location, GLdouble *params);
- void glUniformMatrix4x3dv(GLint location, GLsizei count, GLboolean transpose, const GLdouble *value);
- void glUniformMatrix4x2dv(GLint location, GLsizei count, GLboolean transpose, const GLdouble *value);
- void glUniformMatrix3x4dv(GLint location, GLsizei count, GLboolean transpose, const GLdouble *value);
- void glUniformMatrix3x2dv(GLint location, GLsizei count, GLboolean transpose, const GLdouble *value);
- void glUniformMatrix2x4dv(GLint location, GLsizei count, GLboolean transpose, const GLdouble *value);
- void glUniformMatrix2x3dv(GLint location, GLsizei count, GLboolean transpose, const GLdouble *value);
- void glUniformMatrix4dv(GLint location, GLsizei count, GLboolean transpose, const GLdouble *value);
- void glUniformMatrix3dv(GLint location, GLsizei count, GLboolean transpose, const GLdouble *value);
- void glUniformMatrix2dv(GLint location, GLsizei count, GLboolean transpose, const GLdouble *value);
- void glUniform4dv(GLint location, GLsizei count, const GLdouble *value);
- void glUniform3dv(GLint location, GLsizei count, const GLdouble *value);
- void glUniform2dv(GLint location, GLsizei count, const GLdouble *value);
- void glUniform1dv(GLint location, GLsizei count, const GLdouble *value);
- void glUniform4d(GLint location, GLdouble x, GLdouble y, GLdouble z, GLdouble w);
- void glUniform3d(GLint location, GLdouble x, GLdouble y, GLdouble z);
- void glUniform2d(GLint location, GLdouble x, GLdouble y);
- void glUniform1d(GLint location, GLdouble x);
- void glDrawElementsIndirect(GLenum mode, GLenum type, const GLvoid *indirect);
- void glDrawArraysIndirect(GLenum mode, const GLvoid *indirect);
- void glBlendFuncSeparatei(GLuint buf, GLenum srcRGB, GLenum dstRGB, GLenum srcAlpha, GLenum dstAlpha);
- void glBlendFunci(GLuint buf, GLenum src, GLenum dst);
- void glBlendEquationSeparatei(GLuint buf, GLenum modeRGB, GLenum modeAlpha);
- void glBlendEquationi(GLuint buf, GLenum mode);
- void glMinSampleShading(GLfloat value);
-
-private:
- friend class QOpenGLContext;
-
- static bool isContextCompatible(QOpenGLContext *context);
- static QOpenGLVersionProfile versionProfile();
-
- QOpenGLFunctions_1_0_CoreBackend* d_1_0_Core;
- QOpenGLFunctions_1_1_CoreBackend* d_1_1_Core;
- QOpenGLFunctions_1_2_CoreBackend* d_1_2_Core;
- QOpenGLFunctions_1_3_CoreBackend* d_1_3_Core;
- QOpenGLFunctions_1_4_CoreBackend* d_1_4_Core;
- QOpenGLFunctions_1_5_CoreBackend* d_1_5_Core;
- QOpenGLFunctions_2_0_CoreBackend* d_2_0_Core;
- QOpenGLFunctions_2_1_CoreBackend* d_2_1_Core;
- QOpenGLFunctions_3_0_CoreBackend* d_3_0_Core;
- QOpenGLFunctions_3_1_CoreBackend* d_3_1_Core;
- QOpenGLFunctions_3_2_CoreBackend* d_3_2_Core;
- QOpenGLFunctions_3_3_CoreBackend* d_3_3_Core;
- QOpenGLFunctions_4_0_CoreBackend* d_4_0_Core;
-};
-
-// OpenGL 1.0 core functions
-inline void QOpenGLFunctions_4_0_Core::glViewport(GLint x, GLint y, GLsizei width, GLsizei height)
-{
- d_1_0_Core->f.Viewport(x, y, width, height);
-}
-
-inline void QOpenGLFunctions_4_0_Core::glDepthRange(GLdouble nearVal, GLdouble farVal)
-{
- d_1_0_Core->f.DepthRange(nearVal, farVal);
-}
-
-inline GLboolean QOpenGLFunctions_4_0_Core::glIsEnabled(GLenum cap)
-{
- return d_1_0_Core->f.IsEnabled(cap);
-}
-
-inline void QOpenGLFunctions_4_0_Core::glGetTexLevelParameteriv(GLenum target, GLint level, GLenum pname, GLint *params)
-{
- d_1_0_Core->f.GetTexLevelParameteriv(target, level, pname, params);
-}
-
-inline void QOpenGLFunctions_4_0_Core::glGetTexLevelParameterfv(GLenum target, GLint level, GLenum pname, GLfloat *params)
-{
- d_1_0_Core->f.GetTexLevelParameterfv(target, level, pname, params);
-}
-
-inline void QOpenGLFunctions_4_0_Core::glGetTexParameteriv(GLenum target, GLenum pname, GLint *params)
-{
- d_1_0_Core->f.GetTexParameteriv(target, pname, params);
-}
-
-inline void QOpenGLFunctions_4_0_Core::glGetTexParameterfv(GLenum target, GLenum pname, GLfloat *params)
-{
- d_1_0_Core->f.GetTexParameterfv(target, pname, params);
-}
-
-inline void QOpenGLFunctions_4_0_Core::glGetTexImage(GLenum target, GLint level, GLenum format, GLenum type, GLvoid *pixels)
-{
- d_1_0_Core->f.GetTexImage(target, level, format, type, pixels);
-}
-
-inline const GLubyte * QOpenGLFunctions_4_0_Core::glGetString(GLenum name)
-{
- return d_1_0_Core->f.GetString(name);
-}
-
-inline void QOpenGLFunctions_4_0_Core::glGetIntegerv(GLenum pname, GLint *params)
-{
- d_1_0_Core->f.GetIntegerv(pname, params);
-}
-
-inline void QOpenGLFunctions_4_0_Core::glGetFloatv(GLenum pname, GLfloat *params)
-{
- d_1_0_Core->f.GetFloatv(pname, params);
-}
-
-inline GLenum QOpenGLFunctions_4_0_Core::glGetError()
-{
- return d_1_0_Core->f.GetError();
-}
-
-inline void QOpenGLFunctions_4_0_Core::glGetDoublev(GLenum pname, GLdouble *params)
-{
- d_1_0_Core->f.GetDoublev(pname, params);
-}
-
-inline void QOpenGLFunctions_4_0_Core::glGetBooleanv(GLenum pname, GLboolean *params)
-{
- d_1_0_Core->f.GetBooleanv(pname, params);
-}
-
-inline void QOpenGLFunctions_4_0_Core::glReadPixels(GLint x, GLint y, GLsizei width, GLsizei height, GLenum format, GLenum type, GLvoid *pixels)
-{
- d_1_0_Core->f.ReadPixels(x, y, width, height, format, type, pixels);
-}
-
-inline void QOpenGLFunctions_4_0_Core::glReadBuffer(GLenum mode)
-{
- d_1_0_Core->f.ReadBuffer(mode);
-}
-
-inline void QOpenGLFunctions_4_0_Core::glPixelStorei(GLenum pname, GLint param)
-{
- d_1_0_Core->f.PixelStorei(pname, param);
-}
-
-inline void QOpenGLFunctions_4_0_Core::glPixelStoref(GLenum pname, GLfloat param)
-{
- d_1_0_Core->f.PixelStoref(pname, param);
-}
-
-inline void QOpenGLFunctions_4_0_Core::glDepthFunc(GLenum func)
-{
- d_1_0_Core->f.DepthFunc(func);
-}
-
-inline void QOpenGLFunctions_4_0_Core::glStencilOp(GLenum fail, GLenum zfail, GLenum zpass)
-{
- d_1_0_Core->f.StencilOp(fail, zfail, zpass);
-}
-
-inline void QOpenGLFunctions_4_0_Core::glStencilFunc(GLenum func, GLint ref, GLuint mask)
-{
- d_1_0_Core->f.StencilFunc(func, ref, mask);
-}
-
-inline void QOpenGLFunctions_4_0_Core::glLogicOp(GLenum opcode)
-{
- d_1_0_Core->f.LogicOp(opcode);
-}
-
-inline void QOpenGLFunctions_4_0_Core::glBlendFunc(GLenum sfactor, GLenum dfactor)
-{
- d_1_0_Core->f.BlendFunc(sfactor, dfactor);
-}
-
-inline void QOpenGLFunctions_4_0_Core::glFlush()
-{
- d_1_0_Core->f.Flush();
-}
-
-inline void QOpenGLFunctions_4_0_Core::glFinish()
-{
- d_1_0_Core->f.Finish();
-}
-
-inline void QOpenGLFunctions_4_0_Core::glEnable(GLenum cap)
-{
- d_1_0_Core->f.Enable(cap);
-}
-
-inline void QOpenGLFunctions_4_0_Core::glDisable(GLenum cap)
-{
- d_1_0_Core->f.Disable(cap);
-}
-
-inline void QOpenGLFunctions_4_0_Core::glDepthMask(GLboolean flag)
-{
- d_1_0_Core->f.DepthMask(flag);
-}
-
-inline void QOpenGLFunctions_4_0_Core::glColorMask(GLboolean red, GLboolean green, GLboolean blue, GLboolean alpha)
-{
- d_1_0_Core->f.ColorMask(red, green, blue, alpha);
-}
-
-inline void QOpenGLFunctions_4_0_Core::glStencilMask(GLuint mask)
-{
- d_1_0_Core->f.StencilMask(mask);
-}
-
-inline void QOpenGLFunctions_4_0_Core::glClearDepth(GLdouble depth)
-{
- d_1_0_Core->f.ClearDepth(depth);
-}
-
-inline void QOpenGLFunctions_4_0_Core::glClearStencil(GLint s)
-{
- d_1_0_Core->f.ClearStencil(s);
-}
-
-inline void QOpenGLFunctions_4_0_Core::glClearColor(GLfloat red, GLfloat green, GLfloat blue, GLfloat alpha)
-{
- d_1_0_Core->f.ClearColor(red, green, blue, alpha);
-}
-
-inline void QOpenGLFunctions_4_0_Core::glClear(GLbitfield mask)
-{
- d_1_0_Core->f.Clear(mask);
-}
-
-inline void QOpenGLFunctions_4_0_Core::glDrawBuffer(GLenum mode)
-{
- d_1_0_Core->f.DrawBuffer(mode);
-}
-
-inline void QOpenGLFunctions_4_0_Core::glTexImage2D(GLenum target, GLint level, GLint internalformat, GLsizei width, GLsizei height, GLint border, GLenum format, GLenum type, const GLvoid *pixels)
-{
- d_1_0_Core->f.TexImage2D(target, level, internalformat, width, height, border, format, type, pixels);
-}
-
-inline void QOpenGLFunctions_4_0_Core::glTexImage1D(GLenum target, GLint level, GLint internalformat, GLsizei width, GLint border, GLenum format, GLenum type, const GLvoid *pixels)
-{
- d_1_0_Core->f.TexImage1D(target, level, internalformat, width, border, format, type, pixels);
-}
-
-inline void QOpenGLFunctions_4_0_Core::glTexParameteriv(GLenum target, GLenum pname, const GLint *params)
-{
- d_1_0_Core->f.TexParameteriv(target, pname, params);
-}
-
-inline void QOpenGLFunctions_4_0_Core::glTexParameteri(GLenum target, GLenum pname, GLint param)
-{
- d_1_0_Core->f.TexParameteri(target, pname, param);
-}
-
-inline void QOpenGLFunctions_4_0_Core::glTexParameterfv(GLenum target, GLenum pname, const GLfloat *params)
-{
- d_1_0_Core->f.TexParameterfv(target, pname, params);
-}
-
-inline void QOpenGLFunctions_4_0_Core::glTexParameterf(GLenum target, GLenum pname, GLfloat param)
-{
- d_1_0_Core->f.TexParameterf(target, pname, param);
-}
-
-inline void QOpenGLFunctions_4_0_Core::glScissor(GLint x, GLint y, GLsizei width, GLsizei height)
-{
- d_1_0_Core->f.Scissor(x, y, width, height);
-}
-
-inline void QOpenGLFunctions_4_0_Core::glPolygonMode(GLenum face, GLenum mode)
-{
- d_1_0_Core->f.PolygonMode(face, mode);
-}
-
-inline void QOpenGLFunctions_4_0_Core::glPointSize(GLfloat size)
-{
- d_1_0_Core->f.PointSize(size);
-}
-
-inline void QOpenGLFunctions_4_0_Core::glLineWidth(GLfloat width)
-{
- d_1_0_Core->f.LineWidth(width);
-}
-
-inline void QOpenGLFunctions_4_0_Core::glHint(GLenum target, GLenum mode)
-{
- d_1_0_Core->f.Hint(target, mode);
-}
-
-inline void QOpenGLFunctions_4_0_Core::glFrontFace(GLenum mode)
-{
- d_1_0_Core->f.FrontFace(mode);
-}
-
-inline void QOpenGLFunctions_4_0_Core::glCullFace(GLenum mode)
-{
- d_1_0_Core->f.CullFace(mode);
-}
-
-
-// OpenGL 1.1 core functions
-inline void QOpenGLFunctions_4_0_Core::glIndexubv(const GLubyte *c)
-{
- Q_UNUSED(c);
- QOPENGL_DEPRECATEDFUNCTION;
-}
-
-inline void QOpenGLFunctions_4_0_Core::glIndexub(GLubyte c)
-{
- Q_UNUSED(c);
- QOPENGL_DEPRECATEDFUNCTION;
-}
-
-inline GLboolean QOpenGLFunctions_4_0_Core::glIsTexture(GLuint texture)
-{
- return d_1_1_Core->f.IsTexture(texture);
-}
-
-inline void QOpenGLFunctions_4_0_Core::glGenTextures(GLsizei n, GLuint *textures)
-{
- d_1_1_Core->f.GenTextures(n, textures);
-}
-
-inline void QOpenGLFunctions_4_0_Core::glDeleteTextures(GLsizei n, const GLuint *textures)
-{
- d_1_1_Core->f.DeleteTextures(n, textures);
-}
-
-inline void QOpenGLFunctions_4_0_Core::glBindTexture(GLenum target, GLuint texture)
-{
- d_1_1_Core->f.BindTexture(target, texture);
-}
-
-inline void QOpenGLFunctions_4_0_Core::glTexSubImage2D(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLenum type, const GLvoid *pixels)
-{
- d_1_1_Core->f.TexSubImage2D(target, level, xoffset, yoffset, width, height, format, type, pixels);
-}
-
-inline void QOpenGLFunctions_4_0_Core::glTexSubImage1D(GLenum target, GLint level, GLint xoffset, GLsizei width, GLenum format, GLenum type, const GLvoid *pixels)
-{
- d_1_1_Core->f.TexSubImage1D(target, level, xoffset, width, format, type, pixels);
-}
-
-inline void QOpenGLFunctions_4_0_Core::glCopyTexSubImage2D(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint x, GLint y, GLsizei width, GLsizei height)
-{
- d_1_1_Core->f.CopyTexSubImage2D(target, level, xoffset, yoffset, x, y, width, height);
-}
-
-inline void QOpenGLFunctions_4_0_Core::glCopyTexSubImage1D(GLenum target, GLint level, GLint xoffset, GLint x, GLint y, GLsizei width)
-{
- d_1_1_Core->f.CopyTexSubImage1D(target, level, xoffset, x, y, width);
-}
-
-inline void QOpenGLFunctions_4_0_Core::glCopyTexImage2D(GLenum target, GLint level, GLenum internalformat, GLint x, GLint y, GLsizei width, GLsizei height, GLint border)
-{
- d_1_1_Core->f.CopyTexImage2D(target, level, internalformat, x, y, width, height, border);
-}
-
-inline void QOpenGLFunctions_4_0_Core::glCopyTexImage1D(GLenum target, GLint level, GLenum internalformat, GLint x, GLint y, GLsizei width, GLint border)
-{
- d_1_1_Core->f.CopyTexImage1D(target, level, internalformat, x, y, width, border);
-}
-
-inline void QOpenGLFunctions_4_0_Core::glPolygonOffset(GLfloat factor, GLfloat units)
-{
- d_1_1_Core->f.PolygonOffset(factor, units);
-}
-
-inline void QOpenGLFunctions_4_0_Core::glGetPointerv(GLenum pname, GLvoid* *params)
-{
- Q_UNUSED(pname);
- Q_UNUSED(params);
- QOPENGL_DEPRECATEDFUNCTION;
-}
-
-inline void QOpenGLFunctions_4_0_Core::glDrawElements(GLenum mode, GLsizei count, GLenum type, const GLvoid *indices)
-{
- d_1_1_Core->f.DrawElements(mode, count, type, indices);
-}
-
-inline void QOpenGLFunctions_4_0_Core::glDrawArrays(GLenum mode, GLint first, GLsizei count)
-{
- d_1_1_Core->f.DrawArrays(mode, first, count);
-}
-
-
-// OpenGL 1.2 core functions
-inline void QOpenGLFunctions_4_0_Core::glCopyTexSubImage3D(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLint x, GLint y, GLsizei width, GLsizei height)
-{
- d_1_2_Core->f.CopyTexSubImage3D(target, level, xoffset, yoffset, zoffset, x, y, width, height);
-}
-
-inline void QOpenGLFunctions_4_0_Core::glTexSubImage3D(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLenum type, const GLvoid *pixels)
-{
- d_1_2_Core->f.TexSubImage3D(target, level, xoffset, yoffset, zoffset, width, height, depth, format, type, pixels);
-}
-
-inline void QOpenGLFunctions_4_0_Core::glTexImage3D(GLenum target, GLint level, GLint internalformat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLenum format, GLenum type, const GLvoid *pixels)
-{
- d_1_2_Core->f.TexImage3D(target, level, internalformat, width, height, depth, border, format, type, pixels);
-}
-
-inline void QOpenGLFunctions_4_0_Core::glDrawRangeElements(GLenum mode, GLuint start, GLuint end, GLsizei count, GLenum type, const GLvoid *indices)
-{
- d_1_2_Core->f.DrawRangeElements(mode, start, end, count, type, indices);
-}
-
-inline void QOpenGLFunctions_4_0_Core::glBlendEquation(GLenum mode)
-{
- d_1_2_Core->f.BlendEquation(mode);
-}
-
-inline void QOpenGLFunctions_4_0_Core::glBlendColor(GLfloat red, GLfloat green, GLfloat blue, GLfloat alpha)
-{
- d_1_2_Core->f.BlendColor(red, green, blue, alpha);
-}
-
-
-// OpenGL 1.3 core functions
-inline void QOpenGLFunctions_4_0_Core::glGetCompressedTexImage(GLenum target, GLint level, GLvoid *img)
-{
- d_1_3_Core->f.GetCompressedTexImage(target, level, img);
-}
-
-inline void QOpenGLFunctions_4_0_Core::glCompressedTexSubImage1D(GLenum target, GLint level, GLint xoffset, GLsizei width, GLenum format, GLsizei imageSize, const GLvoid *data)
-{
- d_1_3_Core->f.CompressedTexSubImage1D(target, level, xoffset, width, format, imageSize, data);
-}
-
-inline void QOpenGLFunctions_4_0_Core::glCompressedTexSubImage2D(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLsizei imageSize, const GLvoid *data)
-{
- d_1_3_Core->f.CompressedTexSubImage2D(target, level, xoffset, yoffset, width, height, format, imageSize, data);
-}
-
-inline void QOpenGLFunctions_4_0_Core::glCompressedTexSubImage3D(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLsizei imageSize, const GLvoid *data)
-{
- d_1_3_Core->f.CompressedTexSubImage3D(target, level, xoffset, yoffset, zoffset, width, height, depth, format, imageSize, data);
-}
-
-inline void QOpenGLFunctions_4_0_Core::glCompressedTexImage1D(GLenum target, GLint level, GLenum internalformat, GLsizei width, GLint border, GLsizei imageSize, const GLvoid *data)
-{
- d_1_3_Core->f.CompressedTexImage1D(target, level, internalformat, width, border, imageSize, data);
-}
-
-inline void QOpenGLFunctions_4_0_Core::glCompressedTexImage2D(GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLint border, GLsizei imageSize, const GLvoid *data)
-{
- d_1_3_Core->f.CompressedTexImage2D(target, level, internalformat, width, height, border, imageSize, data);
-}
-
-inline void QOpenGLFunctions_4_0_Core::glCompressedTexImage3D(GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLsizei imageSize, const GLvoid *data)
-{
- d_1_3_Core->f.CompressedTexImage3D(target, level, internalformat, width, height, depth, border, imageSize, data);
-}
-
-inline void QOpenGLFunctions_4_0_Core::glSampleCoverage(GLfloat value, GLboolean invert)
-{
- d_1_3_Core->f.SampleCoverage(value, invert);
-}
-
-inline void QOpenGLFunctions_4_0_Core::glActiveTexture(GLenum texture)
-{
- d_1_3_Core->f.ActiveTexture(texture);
-}
-
-
-// OpenGL 1.4 core functions
-inline void QOpenGLFunctions_4_0_Core::glPointParameteriv(GLenum pname, const GLint *params)
-{
- d_1_4_Core->f.PointParameteriv(pname, params);
-}
-
-inline void QOpenGLFunctions_4_0_Core::glPointParameteri(GLenum pname, GLint param)
-{
- d_1_4_Core->f.PointParameteri(pname, param);
-}
-
-inline void QOpenGLFunctions_4_0_Core::glPointParameterfv(GLenum pname, const GLfloat *params)
-{
- d_1_4_Core->f.PointParameterfv(pname, params);
-}
-
-inline void QOpenGLFunctions_4_0_Core::glPointParameterf(GLenum pname, GLfloat param)
-{
- d_1_4_Core->f.PointParameterf(pname, param);
-}
-
-inline void QOpenGLFunctions_4_0_Core::glMultiDrawElements(GLenum mode, const GLsizei *count, GLenum type, const GLvoid* const *indices, GLsizei drawcount)
-{
- d_1_4_Core->f.MultiDrawElements(mode, count, type, indices, drawcount);
-}
-
-inline void QOpenGLFunctions_4_0_Core::glMultiDrawArrays(GLenum mode, const GLint *first, const GLsizei *count, GLsizei drawcount)
-{
- d_1_4_Core->f.MultiDrawArrays(mode, first, count, drawcount);
-}
-
-inline void QOpenGLFunctions_4_0_Core::glBlendFuncSeparate(GLenum sfactorRGB, GLenum dfactorRGB, GLenum sfactorAlpha, GLenum dfactorAlpha)
-{
- d_1_4_Core->f.BlendFuncSeparate(sfactorRGB, dfactorRGB, sfactorAlpha, dfactorAlpha);
-}
-
-
-// OpenGL 1.5 core functions
-inline void QOpenGLFunctions_4_0_Core::glGetBufferPointerv(GLenum target, GLenum pname, GLvoid* *params)
-{
- d_1_5_Core->f.GetBufferPointerv(target, pname, params);
-}
-
-inline void QOpenGLFunctions_4_0_Core::glGetBufferParameteriv(GLenum target, GLenum pname, GLint *params)
-{
- d_1_5_Core->f.GetBufferParameteriv(target, pname, params);
-}
-
-inline GLboolean QOpenGLFunctions_4_0_Core::glUnmapBuffer(GLenum target)
-{
- return d_1_5_Core->f.UnmapBuffer(target);
-}
-
-inline GLvoid* QOpenGLFunctions_4_0_Core::glMapBuffer(GLenum target, GLenum access)
-{
- return d_1_5_Core->f.MapBuffer(target, access);
-}
-
-inline void QOpenGLFunctions_4_0_Core::glGetBufferSubData(GLenum target, GLintptr offset, GLsizeiptr size, GLvoid *data)
-{
- d_1_5_Core->f.GetBufferSubData(target, offset, size, data);
-}
-
-inline void QOpenGLFunctions_4_0_Core::glBufferSubData(GLenum target, GLintptr offset, GLsizeiptr size, const GLvoid *data)
-{
- d_1_5_Core->f.BufferSubData(target, offset, size, data);
-}
-
-inline void QOpenGLFunctions_4_0_Core::glBufferData(GLenum target, GLsizeiptr size, const GLvoid *data, GLenum usage)
-{
- d_1_5_Core->f.BufferData(target, size, data, usage);
-}
-
-inline GLboolean QOpenGLFunctions_4_0_Core::glIsBuffer(GLuint buffer)
-{
- return d_1_5_Core->f.IsBuffer(buffer);
-}
-
-inline void QOpenGLFunctions_4_0_Core::glGenBuffers(GLsizei n, GLuint *buffers)
-{
- d_1_5_Core->f.GenBuffers(n, buffers);
-}
-
-inline void QOpenGLFunctions_4_0_Core::glDeleteBuffers(GLsizei n, const GLuint *buffers)
-{
- d_1_5_Core->f.DeleteBuffers(n, buffers);
-}
-
-inline void QOpenGLFunctions_4_0_Core::glBindBuffer(GLenum target, GLuint buffer)
-{
- d_1_5_Core->f.BindBuffer(target, buffer);
-}
-
-inline void QOpenGLFunctions_4_0_Core::glGetQueryObjectuiv(GLuint id, GLenum pname, GLuint *params)
-{
- d_1_5_Core->f.GetQueryObjectuiv(id, pname, params);
-}
-
-inline void QOpenGLFunctions_4_0_Core::glGetQueryObjectiv(GLuint id, GLenum pname, GLint *params)
-{
- d_1_5_Core->f.GetQueryObjectiv(id, pname, params);
-}
-
-inline void QOpenGLFunctions_4_0_Core::glGetQueryiv(GLenum target, GLenum pname, GLint *params)
-{
- d_1_5_Core->f.GetQueryiv(target, pname, params);
-}
-
-inline void QOpenGLFunctions_4_0_Core::glEndQuery(GLenum target)
-{
- d_1_5_Core->f.EndQuery(target);
-}
-
-inline void QOpenGLFunctions_4_0_Core::glBeginQuery(GLenum target, GLuint id)
-{
- d_1_5_Core->f.BeginQuery(target, id);
-}
-
-inline GLboolean QOpenGLFunctions_4_0_Core::glIsQuery(GLuint id)
-{
- return d_1_5_Core->f.IsQuery(id);
-}
-
-inline void QOpenGLFunctions_4_0_Core::glDeleteQueries(GLsizei n, const GLuint *ids)
-{
- d_1_5_Core->f.DeleteQueries(n, ids);
-}
-
-inline void QOpenGLFunctions_4_0_Core::glGenQueries(GLsizei n, GLuint *ids)
-{
- d_1_5_Core->f.GenQueries(n, ids);
-}
-
-
-// OpenGL 2.0 core functions
-inline void QOpenGLFunctions_4_0_Core::glVertexAttribPointer(GLuint index, GLint size, GLenum type, GLboolean normalized, GLsizei stride, const GLvoid *pointer)
-{
- d_2_0_Core->f.VertexAttribPointer(index, size, type, normalized, stride, pointer);
-}
-
-inline void QOpenGLFunctions_4_0_Core::glValidateProgram(GLuint program)
-{
- d_2_0_Core->f.ValidateProgram(program);
-}
-
-inline void QOpenGLFunctions_4_0_Core::glUniformMatrix4fv(GLint location, GLsizei count, GLboolean transpose, const GLfloat *value)
-{
- d_2_0_Core->f.UniformMatrix4fv(location, count, transpose, value);
-}
-
-inline void QOpenGLFunctions_4_0_Core::glUniformMatrix3fv(GLint location, GLsizei count, GLboolean transpose, const GLfloat *value)
-{
- d_2_0_Core->f.UniformMatrix3fv(location, count, transpose, value);
-}
-
-inline void QOpenGLFunctions_4_0_Core::glUniformMatrix2fv(GLint location, GLsizei count, GLboolean transpose, const GLfloat *value)
-{
- d_2_0_Core->f.UniformMatrix2fv(location, count, transpose, value);
-}
-
-inline void QOpenGLFunctions_4_0_Core::glUniform4iv(GLint location, GLsizei count, const GLint *value)
-{
- d_2_0_Core->f.Uniform4iv(location, count, value);
-}
-
-inline void QOpenGLFunctions_4_0_Core::glUniform3iv(GLint location, GLsizei count, const GLint *value)
-{
- d_2_0_Core->f.Uniform3iv(location, count, value);
-}
-
-inline void QOpenGLFunctions_4_0_Core::glUniform2iv(GLint location, GLsizei count, const GLint *value)
-{
- d_2_0_Core->f.Uniform2iv(location, count, value);
-}
-
-inline void QOpenGLFunctions_4_0_Core::glUniform1iv(GLint location, GLsizei count, const GLint *value)
-{
- d_2_0_Core->f.Uniform1iv(location, count, value);
-}
-
-inline void QOpenGLFunctions_4_0_Core::glUniform4fv(GLint location, GLsizei count, const GLfloat *value)
-{
- d_2_0_Core->f.Uniform4fv(location, count, value);
-}
-
-inline void QOpenGLFunctions_4_0_Core::glUniform3fv(GLint location, GLsizei count, const GLfloat *value)
-{
- d_2_0_Core->f.Uniform3fv(location, count, value);
-}
-
-inline void QOpenGLFunctions_4_0_Core::glUniform2fv(GLint location, GLsizei count, const GLfloat *value)
-{
- d_2_0_Core->f.Uniform2fv(location, count, value);
-}
-
-inline void QOpenGLFunctions_4_0_Core::glUniform1fv(GLint location, GLsizei count, const GLfloat *value)
-{
- d_2_0_Core->f.Uniform1fv(location, count, value);
-}
-
-inline void QOpenGLFunctions_4_0_Core::glUniform4i(GLint location, GLint v0, GLint v1, GLint v2, GLint v3)
-{
- d_2_0_Core->f.Uniform4i(location, v0, v1, v2, v3);
-}
-
-inline void QOpenGLFunctions_4_0_Core::glUniform3i(GLint location, GLint v0, GLint v1, GLint v2)
-{
- d_2_0_Core->f.Uniform3i(location, v0, v1, v2);
-}
-
-inline void QOpenGLFunctions_4_0_Core::glUniform2i(GLint location, GLint v0, GLint v1)
-{
- d_2_0_Core->f.Uniform2i(location, v0, v1);
-}
-
-inline void QOpenGLFunctions_4_0_Core::glUniform1i(GLint location, GLint v0)
-{
- d_2_0_Core->f.Uniform1i(location, v0);
-}
-
-inline void QOpenGLFunctions_4_0_Core::glUniform4f(GLint location, GLfloat v0, GLfloat v1, GLfloat v2, GLfloat v3)
-{
- d_2_0_Core->f.Uniform4f(location, v0, v1, v2, v3);
-}
-
-inline void QOpenGLFunctions_4_0_Core::glUniform3f(GLint location, GLfloat v0, GLfloat v1, GLfloat v2)
-{
- d_2_0_Core->f.Uniform3f(location, v0, v1, v2);
-}
-
-inline void QOpenGLFunctions_4_0_Core::glUniform2f(GLint location, GLfloat v0, GLfloat v1)
-{
- d_2_0_Core->f.Uniform2f(location, v0, v1);
-}
-
-inline void QOpenGLFunctions_4_0_Core::glUniform1f(GLint location, GLfloat v0)
-{
- d_2_0_Core->f.Uniform1f(location, v0);
-}
-
-inline void QOpenGLFunctions_4_0_Core::glUseProgram(GLuint program)
-{
- d_2_0_Core->f.UseProgram(program);
-}
-
-inline void QOpenGLFunctions_4_0_Core::glShaderSource(GLuint shader, GLsizei count, const GLchar* const *string, const GLint *length)
-{
- d_2_0_Core->f.ShaderSource(shader, count, string, length);
-}
-
-inline void QOpenGLFunctions_4_0_Core::glLinkProgram(GLuint program)
-{
- d_2_0_Core->f.LinkProgram(program);
-}
-
-inline GLboolean QOpenGLFunctions_4_0_Core::glIsShader(GLuint shader)
-{
- return d_2_0_Core->f.IsShader(shader);
-}
-
-inline GLboolean QOpenGLFunctions_4_0_Core::glIsProgram(GLuint program)
-{
- return d_2_0_Core->f.IsProgram(program);
-}
-
-inline void QOpenGLFunctions_4_0_Core::glGetVertexAttribPointerv(GLuint index, GLenum pname, GLvoid* *pointer)
-{
- d_2_0_Core->f.GetVertexAttribPointerv(index, pname, pointer);
-}
-
-inline void QOpenGLFunctions_4_0_Core::glGetVertexAttribiv(GLuint index, GLenum pname, GLint *params)
-{
- d_2_0_Core->f.GetVertexAttribiv(index, pname, params);
-}
-
-inline void QOpenGLFunctions_4_0_Core::glGetVertexAttribfv(GLuint index, GLenum pname, GLfloat *params)
-{
- d_2_0_Core->f.GetVertexAttribfv(index, pname, params);
-}
-
-inline void QOpenGLFunctions_4_0_Core::glGetVertexAttribdv(GLuint index, GLenum pname, GLdouble *params)
-{
- d_2_0_Core->f.GetVertexAttribdv(index, pname, params);
-}
-
-inline void QOpenGLFunctions_4_0_Core::glGetUniformiv(GLuint program, GLint location, GLint *params)
-{
- d_2_0_Core->f.GetUniformiv(program, location, params);
-}
-
-inline void QOpenGLFunctions_4_0_Core::glGetUniformfv(GLuint program, GLint location, GLfloat *params)
-{
- d_2_0_Core->f.GetUniformfv(program, location, params);
-}
-
-inline GLint QOpenGLFunctions_4_0_Core::glGetUniformLocation(GLuint program, const GLchar *name)
-{
- return d_2_0_Core->f.GetUniformLocation(program, name);
-}
-
-inline void QOpenGLFunctions_4_0_Core::glGetShaderSource(GLuint shader, GLsizei bufSize, GLsizei *length, GLchar *source)
-{
- d_2_0_Core->f.GetShaderSource(shader, bufSize, length, source);
-}
-
-inline void QOpenGLFunctions_4_0_Core::glGetShaderInfoLog(GLuint shader, GLsizei bufSize, GLsizei *length, GLchar *infoLog)
-{
- d_2_0_Core->f.GetShaderInfoLog(shader, bufSize, length, infoLog);
-}
-
-inline void QOpenGLFunctions_4_0_Core::glGetShaderiv(GLuint shader, GLenum pname, GLint *params)
-{
- d_2_0_Core->f.GetShaderiv(shader, pname, params);
-}
-
-inline void QOpenGLFunctions_4_0_Core::glGetProgramInfoLog(GLuint program, GLsizei bufSize, GLsizei *length, GLchar *infoLog)
-{
- d_2_0_Core->f.GetProgramInfoLog(program, bufSize, length, infoLog);
-}
-
-inline void QOpenGLFunctions_4_0_Core::glGetProgramiv(GLuint program, GLenum pname, GLint *params)
-{
- d_2_0_Core->f.GetProgramiv(program, pname, params);
-}
-
-inline GLint QOpenGLFunctions_4_0_Core::glGetAttribLocation(GLuint program, const GLchar *name)
-{
- return d_2_0_Core->f.GetAttribLocation(program, name);
-}
-
-inline void QOpenGLFunctions_4_0_Core::glGetAttachedShaders(GLuint program, GLsizei maxCount, GLsizei *count, GLuint *obj)
-{
- d_2_0_Core->f.GetAttachedShaders(program, maxCount, count, obj);
-}
-
-inline void QOpenGLFunctions_4_0_Core::glGetActiveUniform(GLuint program, GLuint index, GLsizei bufSize, GLsizei *length, GLint *size, GLenum *type, GLchar *name)
-{
- d_2_0_Core->f.GetActiveUniform(program, index, bufSize, length, size, type, name);
-}
-
-inline void QOpenGLFunctions_4_0_Core::glGetActiveAttrib(GLuint program, GLuint index, GLsizei bufSize, GLsizei *length, GLint *size, GLenum *type, GLchar *name)
-{
- d_2_0_Core->f.GetActiveAttrib(program, index, bufSize, length, size, type, name);
-}
-
-inline void QOpenGLFunctions_4_0_Core::glEnableVertexAttribArray(GLuint index)
-{
- d_2_0_Core->f.EnableVertexAttribArray(index);
-}
-
-inline void QOpenGLFunctions_4_0_Core::glDisableVertexAttribArray(GLuint index)
-{
- d_2_0_Core->f.DisableVertexAttribArray(index);
-}
-
-inline void QOpenGLFunctions_4_0_Core::glDetachShader(GLuint program, GLuint shader)
-{
- d_2_0_Core->f.DetachShader(program, shader);
-}
-
-inline void QOpenGLFunctions_4_0_Core::glDeleteShader(GLuint shader)
-{
- d_2_0_Core->f.DeleteShader(shader);
-}
-
-inline void QOpenGLFunctions_4_0_Core::glDeleteProgram(GLuint program)
-{
- d_2_0_Core->f.DeleteProgram(program);
-}
-
-inline GLuint QOpenGLFunctions_4_0_Core::glCreateShader(GLenum type)
-{
- return d_2_0_Core->f.CreateShader(type);
-}
-
-inline GLuint QOpenGLFunctions_4_0_Core::glCreateProgram()
-{
- return d_2_0_Core->f.CreateProgram();
-}
-
-inline void QOpenGLFunctions_4_0_Core::glCompileShader(GLuint shader)
-{
- d_2_0_Core->f.CompileShader(shader);
-}
-
-inline void QOpenGLFunctions_4_0_Core::glBindAttribLocation(GLuint program, GLuint index, const GLchar *name)
-{
- d_2_0_Core->f.BindAttribLocation(program, index, name);
-}
-
-inline void QOpenGLFunctions_4_0_Core::glAttachShader(GLuint program, GLuint shader)
-{
- d_2_0_Core->f.AttachShader(program, shader);
-}
-
-inline void QOpenGLFunctions_4_0_Core::glStencilMaskSeparate(GLenum face, GLuint mask)
-{
- d_2_0_Core->f.StencilMaskSeparate(face, mask);
-}
-
-inline void QOpenGLFunctions_4_0_Core::glStencilFuncSeparate(GLenum face, GLenum func, GLint ref, GLuint mask)
-{
- d_2_0_Core->f.StencilFuncSeparate(face, func, ref, mask);
-}
-
-inline void QOpenGLFunctions_4_0_Core::glStencilOpSeparate(GLenum face, GLenum sfail, GLenum dpfail, GLenum dppass)
-{
- d_2_0_Core->f.StencilOpSeparate(face, sfail, dpfail, dppass);
-}
-
-inline void QOpenGLFunctions_4_0_Core::glDrawBuffers(GLsizei n, const GLenum *bufs)
-{
- d_2_0_Core->f.DrawBuffers(n, bufs);
-}
-
-inline void QOpenGLFunctions_4_0_Core::glBlendEquationSeparate(GLenum modeRGB, GLenum modeAlpha)
-{
- d_2_0_Core->f.BlendEquationSeparate(modeRGB, modeAlpha);
-}
-
-
-// OpenGL 2.1 core functions
-inline void QOpenGLFunctions_4_0_Core::glUniformMatrix4x3fv(GLint location, GLsizei count, GLboolean transpose, const GLfloat *value)
-{
- d_2_1_Core->f.UniformMatrix4x3fv(location, count, transpose, value);
-}
-
-inline void QOpenGLFunctions_4_0_Core::glUniformMatrix3x4fv(GLint location, GLsizei count, GLboolean transpose, const GLfloat *value)
-{
- d_2_1_Core->f.UniformMatrix3x4fv(location, count, transpose, value);
-}
-
-inline void QOpenGLFunctions_4_0_Core::glUniformMatrix4x2fv(GLint location, GLsizei count, GLboolean transpose, const GLfloat *value)
-{
- d_2_1_Core->f.UniformMatrix4x2fv(location, count, transpose, value);
-}
-
-inline void QOpenGLFunctions_4_0_Core::glUniformMatrix2x4fv(GLint location, GLsizei count, GLboolean transpose, const GLfloat *value)
-{
- d_2_1_Core->f.UniformMatrix2x4fv(location, count, transpose, value);
-}
-
-inline void QOpenGLFunctions_4_0_Core::glUniformMatrix3x2fv(GLint location, GLsizei count, GLboolean transpose, const GLfloat *value)
-{
- d_2_1_Core->f.UniformMatrix3x2fv(location, count, transpose, value);
-}
-
-inline void QOpenGLFunctions_4_0_Core::glUniformMatrix2x3fv(GLint location, GLsizei count, GLboolean transpose, const GLfloat *value)
-{
- d_2_1_Core->f.UniformMatrix2x3fv(location, count, transpose, value);
-}
-
-
-// OpenGL 3.0 core functions
-inline GLboolean QOpenGLFunctions_4_0_Core::glIsVertexArray(GLuint array)
-{
- return d_3_0_Core->f.IsVertexArray(array);
-}
-
-inline void QOpenGLFunctions_4_0_Core::glGenVertexArrays(GLsizei n, GLuint *arrays)
-{
- d_3_0_Core->f.GenVertexArrays(n, arrays);
-}
-
-inline void QOpenGLFunctions_4_0_Core::glDeleteVertexArrays(GLsizei n, const GLuint *arrays)
-{
- d_3_0_Core->f.DeleteVertexArrays(n, arrays);
-}
-
-inline void QOpenGLFunctions_4_0_Core::glBindVertexArray(GLuint array)
-{
- d_3_0_Core->f.BindVertexArray(array);
-}
-
-inline void QOpenGLFunctions_4_0_Core::glFlushMappedBufferRange(GLenum target, GLintptr offset, GLsizeiptr length)
-{
- d_3_0_Core->f.FlushMappedBufferRange(target, offset, length);
-}
-
-inline GLvoid* QOpenGLFunctions_4_0_Core::glMapBufferRange(GLenum target, GLintptr offset, GLsizeiptr length, GLbitfield access)
-{
- return d_3_0_Core->f.MapBufferRange(target, offset, length, access);
-}
-
-inline void QOpenGLFunctions_4_0_Core::glFramebufferTextureLayer(GLenum target, GLenum attachment, GLuint texture, GLint level, GLint layer)
-{
- d_3_0_Core->f.FramebufferTextureLayer(target, attachment, texture, level, layer);
-}
-
-inline void QOpenGLFunctions_4_0_Core::glRenderbufferStorageMultisample(GLenum target, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height)
-{
- d_3_0_Core->f.RenderbufferStorageMultisample(target, samples, internalformat, width, height);
-}
-
-inline void QOpenGLFunctions_4_0_Core::glBlitFramebuffer(GLint srcX0, GLint srcY0, GLint srcX1, GLint srcY1, GLint dstX0, GLint dstY0, GLint dstX1, GLint dstY1, GLbitfield mask, GLenum filter)
-{
- d_3_0_Core->f.BlitFramebuffer(srcX0, srcY0, srcX1, srcY1, dstX0, dstY0, dstX1, dstY1, mask, filter);
-}
-
-inline void QOpenGLFunctions_4_0_Core::glGenerateMipmap(GLenum target)
-{
- d_3_0_Core->f.GenerateMipmap(target);
-}
-
-inline void QOpenGLFunctions_4_0_Core::glGetFramebufferAttachmentParameteriv(GLenum target, GLenum attachment, GLenum pname, GLint *params)
-{
- d_3_0_Core->f.GetFramebufferAttachmentParameteriv(target, attachment, pname, params);
-}
-
-inline void QOpenGLFunctions_4_0_Core::glFramebufferRenderbuffer(GLenum target, GLenum attachment, GLenum renderbuffertarget, GLuint renderbuffer)
-{
- d_3_0_Core->f.FramebufferRenderbuffer(target, attachment, renderbuffertarget, renderbuffer);
-}
-
-inline void QOpenGLFunctions_4_0_Core::glFramebufferTexture3D(GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level, GLint zoffset)
-{
- d_3_0_Core->f.FramebufferTexture3D(target, attachment, textarget, texture, level, zoffset);
-}
-
-inline void QOpenGLFunctions_4_0_Core::glFramebufferTexture2D(GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level)
-{
- d_3_0_Core->f.FramebufferTexture2D(target, attachment, textarget, texture, level);
-}
-
-inline void QOpenGLFunctions_4_0_Core::glFramebufferTexture1D(GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level)
-{
- d_3_0_Core->f.FramebufferTexture1D(target, attachment, textarget, texture, level);
-}
-
-inline GLenum QOpenGLFunctions_4_0_Core::glCheckFramebufferStatus(GLenum target)
-{
- return d_3_0_Core->f.CheckFramebufferStatus(target);
-}
-
-inline void QOpenGLFunctions_4_0_Core::glGenFramebuffers(GLsizei n, GLuint *framebuffers)
-{
- d_3_0_Core->f.GenFramebuffers(n, framebuffers);
-}
-
-inline void QOpenGLFunctions_4_0_Core::glDeleteFramebuffers(GLsizei n, const GLuint *framebuffers)
-{
- d_3_0_Core->f.DeleteFramebuffers(n, framebuffers);
-}
-
-inline void QOpenGLFunctions_4_0_Core::glBindFramebuffer(GLenum target, GLuint framebuffer)
-{
- d_3_0_Core->f.BindFramebuffer(target, framebuffer);
-}
-
-inline GLboolean QOpenGLFunctions_4_0_Core::glIsFramebuffer(GLuint framebuffer)
-{
- return d_3_0_Core->f.IsFramebuffer(framebuffer);
-}
-
-inline void QOpenGLFunctions_4_0_Core::glGetRenderbufferParameteriv(GLenum target, GLenum pname, GLint *params)
-{
- d_3_0_Core->f.GetRenderbufferParameteriv(target, pname, params);
-}
-
-inline void QOpenGLFunctions_4_0_Core::glRenderbufferStorage(GLenum target, GLenum internalformat, GLsizei width, GLsizei height)
-{
- d_3_0_Core->f.RenderbufferStorage(target, internalformat, width, height);
-}
-
-inline void QOpenGLFunctions_4_0_Core::glGenRenderbuffers(GLsizei n, GLuint *renderbuffers)
-{
- d_3_0_Core->f.GenRenderbuffers(n, renderbuffers);
-}
-
-inline void QOpenGLFunctions_4_0_Core::glDeleteRenderbuffers(GLsizei n, const GLuint *renderbuffers)
-{
- d_3_0_Core->f.DeleteRenderbuffers(n, renderbuffers);
-}
-
-inline void QOpenGLFunctions_4_0_Core::glBindRenderbuffer(GLenum target, GLuint renderbuffer)
-{
- d_3_0_Core->f.BindRenderbuffer(target, renderbuffer);
-}
-
-inline GLboolean QOpenGLFunctions_4_0_Core::glIsRenderbuffer(GLuint renderbuffer)
-{
- return d_3_0_Core->f.IsRenderbuffer(renderbuffer);
-}
-
-inline const GLubyte * QOpenGLFunctions_4_0_Core::glGetStringi(GLenum name, GLuint index)
-{
- return d_3_0_Core->f.GetStringi(name, index);
-}
-
-inline void QOpenGLFunctions_4_0_Core::glClearBufferfi(GLenum buffer, GLint drawbuffer, GLfloat depth, GLint stencil)
-{
- d_3_0_Core->f.ClearBufferfi(buffer, drawbuffer, depth, stencil);
-}
-
-inline void QOpenGLFunctions_4_0_Core::glClearBufferfv(GLenum buffer, GLint drawbuffer, const GLfloat *value)
-{
- d_3_0_Core->f.ClearBufferfv(buffer, drawbuffer, value);
-}
-
-inline void QOpenGLFunctions_4_0_Core::glClearBufferuiv(GLenum buffer, GLint drawbuffer, const GLuint *value)
-{
- d_3_0_Core->f.ClearBufferuiv(buffer, drawbuffer, value);
-}
-
-inline void QOpenGLFunctions_4_0_Core::glClearBufferiv(GLenum buffer, GLint drawbuffer, const GLint *value)
-{
- d_3_0_Core->f.ClearBufferiv(buffer, drawbuffer, value);
-}
-
-inline void QOpenGLFunctions_4_0_Core::glGetTexParameterIuiv(GLenum target, GLenum pname, GLuint *params)
-{
- d_3_0_Core->f.GetTexParameterIuiv(target, pname, params);
-}
-
-inline void QOpenGLFunctions_4_0_Core::glGetTexParameterIiv(GLenum target, GLenum pname, GLint *params)
-{
- d_3_0_Core->f.GetTexParameterIiv(target, pname, params);
-}
-
-inline void QOpenGLFunctions_4_0_Core::glTexParameterIuiv(GLenum target, GLenum pname, const GLuint *params)
-{
- d_3_0_Core->f.TexParameterIuiv(target, pname, params);
-}
-
-inline void QOpenGLFunctions_4_0_Core::glTexParameterIiv(GLenum target, GLenum pname, const GLint *params)
-{
- d_3_0_Core->f.TexParameterIiv(target, pname, params);
-}
-
-inline void QOpenGLFunctions_4_0_Core::glUniform4uiv(GLint location, GLsizei count, const GLuint *value)
-{
- d_3_0_Core->f.Uniform4uiv(location, count, value);
-}
-
-inline void QOpenGLFunctions_4_0_Core::glUniform3uiv(GLint location, GLsizei count, const GLuint *value)
-{
- d_3_0_Core->f.Uniform3uiv(location, count, value);
-}
-
-inline void QOpenGLFunctions_4_0_Core::glUniform2uiv(GLint location, GLsizei count, const GLuint *value)
-{
- d_3_0_Core->f.Uniform2uiv(location, count, value);
-}
-
-inline void QOpenGLFunctions_4_0_Core::glUniform1uiv(GLint location, GLsizei count, const GLuint *value)
-{
- d_3_0_Core->f.Uniform1uiv(location, count, value);
-}
-
-inline void QOpenGLFunctions_4_0_Core::glUniform4ui(GLint location, GLuint v0, GLuint v1, GLuint v2, GLuint v3)
-{
- d_3_0_Core->f.Uniform4ui(location, v0, v1, v2, v3);
-}
-
-inline void QOpenGLFunctions_4_0_Core::glUniform3ui(GLint location, GLuint v0, GLuint v1, GLuint v2)
-{
- d_3_0_Core->f.Uniform3ui(location, v0, v1, v2);
-}
-
-inline void QOpenGLFunctions_4_0_Core::glUniform2ui(GLint location, GLuint v0, GLuint v1)
-{
- d_3_0_Core->f.Uniform2ui(location, v0, v1);
-}
-
-inline void QOpenGLFunctions_4_0_Core::glUniform1ui(GLint location, GLuint v0)
-{
- d_3_0_Core->f.Uniform1ui(location, v0);
-}
-
-inline GLint QOpenGLFunctions_4_0_Core::glGetFragDataLocation(GLuint program, const GLchar *name)
-{
- return d_3_0_Core->f.GetFragDataLocation(program, name);
-}
-
-inline void QOpenGLFunctions_4_0_Core::glBindFragDataLocation(GLuint program, GLuint color, const GLchar *name)
-{
- d_3_0_Core->f.BindFragDataLocation(program, color, name);
-}
-
-inline void QOpenGLFunctions_4_0_Core::glGetUniformuiv(GLuint program, GLint location, GLuint *params)
-{
- d_3_0_Core->f.GetUniformuiv(program, location, params);
-}
-
-inline void QOpenGLFunctions_4_0_Core::glGetVertexAttribIuiv(GLuint index, GLenum pname, GLuint *params)
-{
- d_3_0_Core->f.GetVertexAttribIuiv(index, pname, params);
-}
-
-inline void QOpenGLFunctions_4_0_Core::glGetVertexAttribIiv(GLuint index, GLenum pname, GLint *params)
-{
- d_3_0_Core->f.GetVertexAttribIiv(index, pname, params);
-}
-
-inline void QOpenGLFunctions_4_0_Core::glVertexAttribIPointer(GLuint index, GLint size, GLenum type, GLsizei stride, const GLvoid *pointer)
-{
- d_3_0_Core->f.VertexAttribIPointer(index, size, type, stride, pointer);
-}
-
-inline void QOpenGLFunctions_4_0_Core::glEndConditionalRender()
-{
- d_3_0_Core->f.EndConditionalRender();
-}
-
-inline void QOpenGLFunctions_4_0_Core::glBeginConditionalRender(GLuint id, GLenum mode)
-{
- d_3_0_Core->f.BeginConditionalRender(id, mode);
-}
-
-inline void QOpenGLFunctions_4_0_Core::glClampColor(GLenum target, GLenum clamp)
-{
- d_3_0_Core->f.ClampColor(target, clamp);
-}
-
-inline void QOpenGLFunctions_4_0_Core::glGetTransformFeedbackVarying(GLuint program, GLuint index, GLsizei bufSize, GLsizei *length, GLsizei *size, GLenum *type, GLchar *name)
-{
- d_3_0_Core->f.GetTransformFeedbackVarying(program, index, bufSize, length, size, type, name);
-}
-
-inline void QOpenGLFunctions_4_0_Core::glTransformFeedbackVaryings(GLuint program, GLsizei count, const GLchar* const *varyings, GLenum bufferMode)
-{
- d_3_0_Core->f.TransformFeedbackVaryings(program, count, varyings, bufferMode);
-}
-
-inline void QOpenGLFunctions_4_0_Core::glBindBufferBase(GLenum target, GLuint index, GLuint buffer)
-{
- d_3_0_Core->f.BindBufferBase(target, index, buffer);
-}
-
-inline void QOpenGLFunctions_4_0_Core::glBindBufferRange(GLenum target, GLuint index, GLuint buffer, GLintptr offset, GLsizeiptr size)
-{
- d_3_0_Core->f.BindBufferRange(target, index, buffer, offset, size);
-}
-
-inline void QOpenGLFunctions_4_0_Core::glEndTransformFeedback()
-{
- d_3_0_Core->f.EndTransformFeedback();
-}
-
-inline void QOpenGLFunctions_4_0_Core::glBeginTransformFeedback(GLenum primitiveMode)
-{
- d_3_0_Core->f.BeginTransformFeedback(primitiveMode);
-}
-
-inline GLboolean QOpenGLFunctions_4_0_Core::glIsEnabledi(GLenum target, GLuint index)
-{
- return d_3_0_Core->f.IsEnabledi(target, index);
-}
-
-inline void QOpenGLFunctions_4_0_Core::glDisablei(GLenum target, GLuint index)
-{
- d_3_0_Core->f.Disablei(target, index);
-}
-
-inline void QOpenGLFunctions_4_0_Core::glEnablei(GLenum target, GLuint index)
-{
- d_3_0_Core->f.Enablei(target, index);
-}
-
-inline void QOpenGLFunctions_4_0_Core::glGetIntegeri_v(GLenum target, GLuint index, GLint *data)
-{
- d_3_0_Core->f.GetIntegeri_v(target, index, data);
-}
-
-inline void QOpenGLFunctions_4_0_Core::glGetBooleani_v(GLenum target, GLuint index, GLboolean *data)
-{
- d_3_0_Core->f.GetBooleani_v(target, index, data);
-}
-
-inline void QOpenGLFunctions_4_0_Core::glColorMaski(GLuint index, GLboolean r, GLboolean g, GLboolean b, GLboolean a)
-{
- d_3_0_Core->f.ColorMaski(index, r, g, b, a);
-}
-
-
-// OpenGL 3.1 core functions
-inline void QOpenGLFunctions_4_0_Core::glCopyBufferSubData(GLenum readTarget, GLenum writeTarget, GLintptr readOffset, GLintptr writeOffset, GLsizeiptr size)
-{
- d_3_1_Core->f.CopyBufferSubData(readTarget, writeTarget, readOffset, writeOffset, size);
-}
-
-inline void QOpenGLFunctions_4_0_Core::glUniformBlockBinding(GLuint program, GLuint uniformBlockIndex, GLuint uniformBlockBinding)
-{
- d_3_1_Core->f.UniformBlockBinding(program, uniformBlockIndex, uniformBlockBinding);
-}
-
-inline void QOpenGLFunctions_4_0_Core::glGetActiveUniformBlockName(GLuint program, GLuint uniformBlockIndex, GLsizei bufSize, GLsizei *length, GLchar *uniformBlockName)
-{
- d_3_1_Core->f.GetActiveUniformBlockName(program, uniformBlockIndex, bufSize, length, uniformBlockName);
-}
-
-inline void QOpenGLFunctions_4_0_Core::glGetActiveUniformBlockiv(GLuint program, GLuint uniformBlockIndex, GLenum pname, GLint *params)
-{
- d_3_1_Core->f.GetActiveUniformBlockiv(program, uniformBlockIndex, pname, params);
-}
-
-inline GLuint QOpenGLFunctions_4_0_Core::glGetUniformBlockIndex(GLuint program, const GLchar *uniformBlockName)
-{
- return d_3_1_Core->f.GetUniformBlockIndex(program, uniformBlockName);
-}
-
-inline void QOpenGLFunctions_4_0_Core::glGetActiveUniformName(GLuint program, GLuint uniformIndex, GLsizei bufSize, GLsizei *length, GLchar *uniformName)
-{
- d_3_1_Core->f.GetActiveUniformName(program, uniformIndex, bufSize, length, uniformName);
-}
-
-inline void QOpenGLFunctions_4_0_Core::glGetActiveUniformsiv(GLuint program, GLsizei uniformCount, const GLuint *uniformIndices, GLenum pname, GLint *params)
-{
- d_3_1_Core->f.GetActiveUniformsiv(program, uniformCount, uniformIndices, pname, params);
-}
-
-inline void QOpenGLFunctions_4_0_Core::glGetUniformIndices(GLuint program, GLsizei uniformCount, const GLchar* const *uniformNames, GLuint *uniformIndices)
-{
- d_3_1_Core->f.GetUniformIndices(program, uniformCount, uniformNames, uniformIndices);
-}
-
-inline void QOpenGLFunctions_4_0_Core::glPrimitiveRestartIndex(GLuint index)
-{
- d_3_1_Core->f.PrimitiveRestartIndex(index);
-}
-
-inline void QOpenGLFunctions_4_0_Core::glTexBuffer(GLenum target, GLenum internalformat, GLuint buffer)
-{
- d_3_1_Core->f.TexBuffer(target, internalformat, buffer);
-}
-
-inline void QOpenGLFunctions_4_0_Core::glDrawElementsInstanced(GLenum mode, GLsizei count, GLenum type, const GLvoid *indices, GLsizei instancecount)
-{
- d_3_1_Core->f.DrawElementsInstanced(mode, count, type, indices, instancecount);
-}
-
-inline void QOpenGLFunctions_4_0_Core::glDrawArraysInstanced(GLenum mode, GLint first, GLsizei count, GLsizei instancecount)
-{
- d_3_1_Core->f.DrawArraysInstanced(mode, first, count, instancecount);
-}
-
-
-// OpenGL 3.2 core functions
-inline void QOpenGLFunctions_4_0_Core::glSampleMaski(GLuint index, GLbitfield mask)
-{
- d_3_2_Core->f.SampleMaski(index, mask);
-}
-
-inline void QOpenGLFunctions_4_0_Core::glGetMultisamplefv(GLenum pname, GLuint index, GLfloat *val)
-{
- d_3_2_Core->f.GetMultisamplefv(pname, index, val);
-}
-
-inline void QOpenGLFunctions_4_0_Core::glTexImage3DMultisample(GLenum target, GLsizei samples, GLint internalformat, GLsizei width, GLsizei height, GLsizei depth, GLboolean fixedsamplelocations)
-{
- d_3_2_Core->f.TexImage3DMultisample(target, samples, internalformat, width, height, depth, fixedsamplelocations);
-}
-
-inline void QOpenGLFunctions_4_0_Core::glTexImage2DMultisample(GLenum target, GLsizei samples, GLint internalformat, GLsizei width, GLsizei height, GLboolean fixedsamplelocations)
-{
- d_3_2_Core->f.TexImage2DMultisample(target, samples, internalformat, width, height, fixedsamplelocations);
-}
-
-inline void QOpenGLFunctions_4_0_Core::glGetSynciv(GLsync sync, GLenum pname, GLsizei bufSize, GLsizei *length, GLint *values)
-{
- d_3_2_Core->f.GetSynciv(sync, pname, bufSize, length, values);
-}
-
-inline void QOpenGLFunctions_4_0_Core::glGetInteger64v(GLenum pname, GLint64 *params)
-{
- d_3_2_Core->f.GetInteger64v(pname, params);
-}
-
-inline void QOpenGLFunctions_4_0_Core::glWaitSync(GLsync sync, GLbitfield flags, GLuint64 timeout)
-{
- d_3_2_Core->f.WaitSync(sync, flags, timeout);
-}
-
-inline GLenum QOpenGLFunctions_4_0_Core::glClientWaitSync(GLsync sync, GLbitfield flags, GLuint64 timeout)
-{
- return d_3_2_Core->f.ClientWaitSync(sync, flags, timeout);
-}
-
-inline void QOpenGLFunctions_4_0_Core::glDeleteSync(GLsync sync)
-{
- d_3_2_Core->f.DeleteSync(sync);
-}
-
-inline GLboolean QOpenGLFunctions_4_0_Core::glIsSync(GLsync sync)
-{
- return d_3_2_Core->f.IsSync(sync);
-}
-
-inline GLsync QOpenGLFunctions_4_0_Core::glFenceSync(GLenum condition, GLbitfield flags)
-{
- return d_3_2_Core->f.FenceSync(condition, flags);
-}
-
-inline void QOpenGLFunctions_4_0_Core::glProvokingVertex(GLenum mode)
-{
- d_3_2_Core->f.ProvokingVertex(mode);
-}
-
-inline void QOpenGLFunctions_4_0_Core::glMultiDrawElementsBaseVertex(GLenum mode, const GLsizei *count, GLenum type, const GLvoid* const *indices, GLsizei drawcount, const GLint *basevertex)
-{
- d_3_2_Core->f.MultiDrawElementsBaseVertex(mode, count, type, indices, drawcount, basevertex);
-}
-
-inline void QOpenGLFunctions_4_0_Core::glDrawElementsInstancedBaseVertex(GLenum mode, GLsizei count, GLenum type, const GLvoid *indices, GLsizei instancecount, GLint basevertex)
-{
- d_3_2_Core->f.DrawElementsInstancedBaseVertex(mode, count, type, indices, instancecount, basevertex);
-}
-
-inline void QOpenGLFunctions_4_0_Core::glDrawRangeElementsBaseVertex(GLenum mode, GLuint start, GLuint end, GLsizei count, GLenum type, const GLvoid *indices, GLint basevertex)
-{
- d_3_2_Core->f.DrawRangeElementsBaseVertex(mode, start, end, count, type, indices, basevertex);
-}
-
-inline void QOpenGLFunctions_4_0_Core::glDrawElementsBaseVertex(GLenum mode, GLsizei count, GLenum type, const GLvoid *indices, GLint basevertex)
-{
- d_3_2_Core->f.DrawElementsBaseVertex(mode, count, type, indices, basevertex);
-}
-
-inline void QOpenGLFunctions_4_0_Core::glFramebufferTexture(GLenum target, GLenum attachment, GLuint texture, GLint level)
-{
- d_3_2_Core->f.FramebufferTexture(target, attachment, texture, level);
-}
-
-inline void QOpenGLFunctions_4_0_Core::glGetBufferParameteri64v(GLenum target, GLenum pname, GLint64 *params)
-{
- d_3_2_Core->f.GetBufferParameteri64v(target, pname, params);
-}
-
-inline void QOpenGLFunctions_4_0_Core::glGetInteger64i_v(GLenum target, GLuint index, GLint64 *data)
-{
- d_3_2_Core->f.GetInteger64i_v(target, index, data);
-}
-
-
-// OpenGL 3.3 core functions
-inline void QOpenGLFunctions_4_0_Core::glVertexAttribP4uiv(GLuint index, GLenum type, GLboolean normalized, const GLuint *value)
-{
- d_3_3_Core->f.VertexAttribP4uiv(index, type, normalized, value);
-}
-
-inline void QOpenGLFunctions_4_0_Core::glVertexAttribP4ui(GLuint index, GLenum type, GLboolean normalized, GLuint value)
-{
- d_3_3_Core->f.VertexAttribP4ui(index, type, normalized, value);
-}
-
-inline void QOpenGLFunctions_4_0_Core::glVertexAttribP3uiv(GLuint index, GLenum type, GLboolean normalized, const GLuint *value)
-{
- d_3_3_Core->f.VertexAttribP3uiv(index, type, normalized, value);
-}
-
-inline void QOpenGLFunctions_4_0_Core::glVertexAttribP3ui(GLuint index, GLenum type, GLboolean normalized, GLuint value)
-{
- d_3_3_Core->f.VertexAttribP3ui(index, type, normalized, value);
-}
-
-inline void QOpenGLFunctions_4_0_Core::glVertexAttribP2uiv(GLuint index, GLenum type, GLboolean normalized, const GLuint *value)
-{
- d_3_3_Core->f.VertexAttribP2uiv(index, type, normalized, value);
-}
-
-inline void QOpenGLFunctions_4_0_Core::glVertexAttribP2ui(GLuint index, GLenum type, GLboolean normalized, GLuint value)
-{
- d_3_3_Core->f.VertexAttribP2ui(index, type, normalized, value);
-}
-
-inline void QOpenGLFunctions_4_0_Core::glVertexAttribP1uiv(GLuint index, GLenum type, GLboolean normalized, const GLuint *value)
-{
- d_3_3_Core->f.VertexAttribP1uiv(index, type, normalized, value);
-}
-
-inline void QOpenGLFunctions_4_0_Core::glVertexAttribP1ui(GLuint index, GLenum type, GLboolean normalized, GLuint value)
-{
- d_3_3_Core->f.VertexAttribP1ui(index, type, normalized, value);
-}
-
-inline void QOpenGLFunctions_4_0_Core::glSecondaryColorP3uiv(GLenum type, const GLuint *color)
-{
- Q_UNUSED(type);
- Q_UNUSED(color);
- QOPENGL_DEPRECATEDFUNCTION;
-}
-
-inline void QOpenGLFunctions_4_0_Core::glSecondaryColorP3ui(GLenum type, GLuint color)
-{
- Q_UNUSED(type);
- Q_UNUSED(color);
- QOPENGL_DEPRECATEDFUNCTION;
-}
-
-inline void QOpenGLFunctions_4_0_Core::glColorP4uiv(GLenum type, const GLuint *color)
-{
- Q_UNUSED(type);
- Q_UNUSED(color);
- QOPENGL_DEPRECATEDFUNCTION;
-}
-
-inline void QOpenGLFunctions_4_0_Core::glColorP4ui(GLenum type, GLuint color)
-{
- Q_UNUSED(type);
- Q_UNUSED(color);
- QOPENGL_DEPRECATEDFUNCTION;
-}
-
-inline void QOpenGLFunctions_4_0_Core::glColorP3uiv(GLenum type, const GLuint *color)
-{
- Q_UNUSED(type);
- Q_UNUSED(color);
- QOPENGL_DEPRECATEDFUNCTION;
-}
-
-inline void QOpenGLFunctions_4_0_Core::glColorP3ui(GLenum type, GLuint color)
-{
- Q_UNUSED(type);
- Q_UNUSED(color);
- QOPENGL_DEPRECATEDFUNCTION;
-}
-
-inline void QOpenGLFunctions_4_0_Core::glNormalP3uiv(GLenum type, const GLuint *coords)
-{
- Q_UNUSED(type);
- Q_UNUSED(coords);
- QOPENGL_DEPRECATEDFUNCTION;
-}
-
-inline void QOpenGLFunctions_4_0_Core::glNormalP3ui(GLenum type, GLuint coords)
-{
- Q_UNUSED(type);
- Q_UNUSED(coords);
- QOPENGL_DEPRECATEDFUNCTION;
-}
-
-inline void QOpenGLFunctions_4_0_Core::glMultiTexCoordP4uiv(GLenum texture, GLenum type, const GLuint *coords)
-{
- Q_UNUSED(texture);
- Q_UNUSED(type);
- Q_UNUSED(coords);
- QOPENGL_DEPRECATEDFUNCTION;
-}
-
-inline void QOpenGLFunctions_4_0_Core::glMultiTexCoordP4ui(GLenum texture, GLenum type, GLuint coords)
-{
- Q_UNUSED(texture);
- Q_UNUSED(type);
- Q_UNUSED(coords);
- QOPENGL_DEPRECATEDFUNCTION;
-}
-
-inline void QOpenGLFunctions_4_0_Core::glMultiTexCoordP3uiv(GLenum texture, GLenum type, const GLuint *coords)
-{
- Q_UNUSED(texture);
- Q_UNUSED(type);
- Q_UNUSED(coords);
- QOPENGL_DEPRECATEDFUNCTION;
-}
-
-inline void QOpenGLFunctions_4_0_Core::glMultiTexCoordP3ui(GLenum texture, GLenum type, GLuint coords)
-{
- Q_UNUSED(texture);
- Q_UNUSED(type);
- Q_UNUSED(coords);
- QOPENGL_DEPRECATEDFUNCTION;
-}
-
-inline void QOpenGLFunctions_4_0_Core::glMultiTexCoordP2uiv(GLenum texture, GLenum type, const GLuint *coords)
-{
- Q_UNUSED(texture);
- Q_UNUSED(type);
- Q_UNUSED(coords);
- QOPENGL_DEPRECATEDFUNCTION;
-}
-
-inline void QOpenGLFunctions_4_0_Core::glMultiTexCoordP2ui(GLenum texture, GLenum type, GLuint coords)
-{
- Q_UNUSED(texture);
- Q_UNUSED(type);
- Q_UNUSED(coords);
- QOPENGL_DEPRECATEDFUNCTION;
-}
-
-inline void QOpenGLFunctions_4_0_Core::glMultiTexCoordP1uiv(GLenum texture, GLenum type, const GLuint *coords)
-{
- Q_UNUSED(texture);
- Q_UNUSED(type);
- Q_UNUSED(coords);
- QOPENGL_DEPRECATEDFUNCTION;
-}
-
-inline void QOpenGLFunctions_4_0_Core::glMultiTexCoordP1ui(GLenum texture, GLenum type, GLuint coords)
-{
- Q_UNUSED(texture);
- Q_UNUSED(type);
- Q_UNUSED(coords);
- QOPENGL_DEPRECATEDFUNCTION;
-}
-
-inline void QOpenGLFunctions_4_0_Core::glTexCoordP4uiv(GLenum type, const GLuint *coords)
-{
- Q_UNUSED(type);
- Q_UNUSED(coords);
- QOPENGL_DEPRECATEDFUNCTION;
-}
-
-inline void QOpenGLFunctions_4_0_Core::glTexCoordP4ui(GLenum type, GLuint coords)
-{
- Q_UNUSED(type);
- Q_UNUSED(coords);
- QOPENGL_DEPRECATEDFUNCTION;
-}
-
-inline void QOpenGLFunctions_4_0_Core::glTexCoordP3uiv(GLenum type, const GLuint *coords)
-{
- Q_UNUSED(type);
- Q_UNUSED(coords);
- QOPENGL_DEPRECATEDFUNCTION;
-}
-
-inline void QOpenGLFunctions_4_0_Core::glTexCoordP3ui(GLenum type, GLuint coords)
-{
- Q_UNUSED(type);
- Q_UNUSED(coords);
- QOPENGL_DEPRECATEDFUNCTION;
-}
-
-inline void QOpenGLFunctions_4_0_Core::glTexCoordP2uiv(GLenum type, const GLuint *coords)
-{
- Q_UNUSED(type);
- Q_UNUSED(coords);
- QOPENGL_DEPRECATEDFUNCTION;
-}
-
-inline void QOpenGLFunctions_4_0_Core::glTexCoordP2ui(GLenum type, GLuint coords)
-{
- Q_UNUSED(type);
- Q_UNUSED(coords);
- QOPENGL_DEPRECATEDFUNCTION;
-}
-
-inline void QOpenGLFunctions_4_0_Core::glTexCoordP1uiv(GLenum type, const GLuint *coords)
-{
- Q_UNUSED(type);
- Q_UNUSED(coords);
- QOPENGL_DEPRECATEDFUNCTION;
-}
-
-inline void QOpenGLFunctions_4_0_Core::glTexCoordP1ui(GLenum type, GLuint coords)
-{
- Q_UNUSED(type);
- Q_UNUSED(coords);
- QOPENGL_DEPRECATEDFUNCTION;
-}
-
-inline void QOpenGLFunctions_4_0_Core::glVertexP4uiv(GLenum type, const GLuint *value)
-{
- Q_UNUSED(type);
- Q_UNUSED(value);
- QOPENGL_DEPRECATEDFUNCTION;
-}
-
-inline void QOpenGLFunctions_4_0_Core::glVertexP4ui(GLenum type, GLuint value)
-{
- Q_UNUSED(type);
- Q_UNUSED(value);
- QOPENGL_DEPRECATEDFUNCTION;
-}
-
-inline void QOpenGLFunctions_4_0_Core::glVertexP3uiv(GLenum type, const GLuint *value)
-{
- Q_UNUSED(type);
- Q_UNUSED(value);
- QOPENGL_DEPRECATEDFUNCTION;
-}
-
-inline void QOpenGLFunctions_4_0_Core::glVertexP3ui(GLenum type, GLuint value)
-{
- Q_UNUSED(type);
- Q_UNUSED(value);
- QOPENGL_DEPRECATEDFUNCTION;
-}
-
-inline void QOpenGLFunctions_4_0_Core::glVertexP2uiv(GLenum type, const GLuint *value)
-{
- Q_UNUSED(type);
- Q_UNUSED(value);
- QOPENGL_DEPRECATEDFUNCTION;
-}
-
-inline void QOpenGLFunctions_4_0_Core::glVertexP2ui(GLenum type, GLuint value)
-{
- Q_UNUSED(type);
- Q_UNUSED(value);
- QOPENGL_DEPRECATEDFUNCTION;
-}
-
-inline void QOpenGLFunctions_4_0_Core::glGetQueryObjectui64v(GLuint id, GLenum pname, GLuint64 *params)
-{
- d_3_3_Core->f.GetQueryObjectui64v(id, pname, params);
-}
-
-inline void QOpenGLFunctions_4_0_Core::glGetQueryObjecti64v(GLuint id, GLenum pname, GLint64 *params)
-{
- d_3_3_Core->f.GetQueryObjecti64v(id, pname, params);
-}
-
-inline void QOpenGLFunctions_4_0_Core::glQueryCounter(GLuint id, GLenum target)
-{
- d_3_3_Core->f.QueryCounter(id, target);
-}
-
-inline void QOpenGLFunctions_4_0_Core::glGetSamplerParameterIuiv(GLuint sampler, GLenum pname, GLuint *params)
-{
- d_3_3_Core->f.GetSamplerParameterIuiv(sampler, pname, params);
-}
-
-inline void QOpenGLFunctions_4_0_Core::glGetSamplerParameterfv(GLuint sampler, GLenum pname, GLfloat *params)
-{
- d_3_3_Core->f.GetSamplerParameterfv(sampler, pname, params);
-}
-
-inline void QOpenGLFunctions_4_0_Core::glGetSamplerParameterIiv(GLuint sampler, GLenum pname, GLint *params)
-{
- d_3_3_Core->f.GetSamplerParameterIiv(sampler, pname, params);
-}
-
-inline void QOpenGLFunctions_4_0_Core::glGetSamplerParameteriv(GLuint sampler, GLenum pname, GLint *params)
-{
- d_3_3_Core->f.GetSamplerParameteriv(sampler, pname, params);
-}
-
-inline void QOpenGLFunctions_4_0_Core::glSamplerParameterIuiv(GLuint sampler, GLenum pname, const GLuint *param)
-{
- d_3_3_Core->f.SamplerParameterIuiv(sampler, pname, param);
-}
-
-inline void QOpenGLFunctions_4_0_Core::glSamplerParameterIiv(GLuint sampler, GLenum pname, const GLint *param)
-{
- d_3_3_Core->f.SamplerParameterIiv(sampler, pname, param);
-}
-
-inline void QOpenGLFunctions_4_0_Core::glSamplerParameterfv(GLuint sampler, GLenum pname, const GLfloat *param)
-{
- d_3_3_Core->f.SamplerParameterfv(sampler, pname, param);
-}
-
-inline void QOpenGLFunctions_4_0_Core::glSamplerParameterf(GLuint sampler, GLenum pname, GLfloat param)
-{
- d_3_3_Core->f.SamplerParameterf(sampler, pname, param);
-}
-
-inline void QOpenGLFunctions_4_0_Core::glSamplerParameteriv(GLuint sampler, GLenum pname, const GLint *param)
-{
- d_3_3_Core->f.SamplerParameteriv(sampler, pname, param);
-}
-
-inline void QOpenGLFunctions_4_0_Core::glSamplerParameteri(GLuint sampler, GLenum pname, GLint param)
-{
- d_3_3_Core->f.SamplerParameteri(sampler, pname, param);
-}
-
-inline void QOpenGLFunctions_4_0_Core::glBindSampler(GLuint unit, GLuint sampler)
-{
- d_3_3_Core->f.BindSampler(unit, sampler);
-}
-
-inline GLboolean QOpenGLFunctions_4_0_Core::glIsSampler(GLuint sampler)
-{
- return d_3_3_Core->f.IsSampler(sampler);
-}
-
-inline void QOpenGLFunctions_4_0_Core::glDeleteSamplers(GLsizei count, const GLuint *samplers)
-{
- d_3_3_Core->f.DeleteSamplers(count, samplers);
-}
-
-inline void QOpenGLFunctions_4_0_Core::glGenSamplers(GLsizei count, GLuint *samplers)
-{
- d_3_3_Core->f.GenSamplers(count, samplers);
-}
-
-inline GLint QOpenGLFunctions_4_0_Core::glGetFragDataIndex(GLuint program, const GLchar *name)
-{
- return d_3_3_Core->f.GetFragDataIndex(program, name);
-}
-
-inline void QOpenGLFunctions_4_0_Core::glBindFragDataLocationIndexed(GLuint program, GLuint colorNumber, GLuint index, const GLchar *name)
-{
- d_3_3_Core->f.BindFragDataLocationIndexed(program, colorNumber, index, name);
-}
-
-inline void QOpenGLFunctions_4_0_Core::glVertexAttribDivisor(GLuint index, GLuint divisor)
-{
- d_3_3_Core->f.VertexAttribDivisor(index, divisor);
-}
-
-
-// OpenGL 4.0 core functions
-inline void QOpenGLFunctions_4_0_Core::glGetQueryIndexediv(GLenum target, GLuint index, GLenum pname, GLint *params)
-{
- d_4_0_Core->f.GetQueryIndexediv(target, index, pname, params);
-}
-
-inline void QOpenGLFunctions_4_0_Core::glEndQueryIndexed(GLenum target, GLuint index)
-{
- d_4_0_Core->f.EndQueryIndexed(target, index);
-}
-
-inline void QOpenGLFunctions_4_0_Core::glBeginQueryIndexed(GLenum target, GLuint index, GLuint id)
-{
- d_4_0_Core->f.BeginQueryIndexed(target, index, id);
-}
-
-inline void QOpenGLFunctions_4_0_Core::glDrawTransformFeedbackStream(GLenum mode, GLuint id, GLuint stream)
-{
- d_4_0_Core->f.DrawTransformFeedbackStream(mode, id, stream);
-}
-
-inline void QOpenGLFunctions_4_0_Core::glDrawTransformFeedback(GLenum mode, GLuint id)
-{
- d_4_0_Core->f.DrawTransformFeedback(mode, id);
-}
-
-inline void QOpenGLFunctions_4_0_Core::glResumeTransformFeedback()
-{
- d_4_0_Core->f.ResumeTransformFeedback();
-}
-
-inline void QOpenGLFunctions_4_0_Core::glPauseTransformFeedback()
-{
- d_4_0_Core->f.PauseTransformFeedback();
-}
-
-inline GLboolean QOpenGLFunctions_4_0_Core::glIsTransformFeedback(GLuint id)
-{
- return d_4_0_Core->f.IsTransformFeedback(id);
-}
-
-inline void QOpenGLFunctions_4_0_Core::glGenTransformFeedbacks(GLsizei n, GLuint *ids)
-{
- d_4_0_Core->f.GenTransformFeedbacks(n, ids);
-}
-
-inline void QOpenGLFunctions_4_0_Core::glDeleteTransformFeedbacks(GLsizei n, const GLuint *ids)
-{
- d_4_0_Core->f.DeleteTransformFeedbacks(n, ids);
-}
-
-inline void QOpenGLFunctions_4_0_Core::glBindTransformFeedback(GLenum target, GLuint id)
-{
- d_4_0_Core->f.BindTransformFeedback(target, id);
-}
-
-inline void QOpenGLFunctions_4_0_Core::glPatchParameterfv(GLenum pname, const GLfloat *values)
-{
- d_4_0_Core->f.PatchParameterfv(pname, values);
-}
-
-inline void QOpenGLFunctions_4_0_Core::glPatchParameteri(GLenum pname, GLint value)
-{
- d_4_0_Core->f.PatchParameteri(pname, value);
-}
-
-inline void QOpenGLFunctions_4_0_Core::glGetProgramStageiv(GLuint program, GLenum shadertype, GLenum pname, GLint *values)
-{
- d_4_0_Core->f.GetProgramStageiv(program, shadertype, pname, values);
-}
-
-inline void QOpenGLFunctions_4_0_Core::glGetUniformSubroutineuiv(GLenum shadertype, GLint location, GLuint *params)
-{
- d_4_0_Core->f.GetUniformSubroutineuiv(shadertype, location, params);
-}
-
-inline void QOpenGLFunctions_4_0_Core::glUniformSubroutinesuiv(GLenum shadertype, GLsizei count, const GLuint *indices)
-{
- d_4_0_Core->f.UniformSubroutinesuiv(shadertype, count, indices);
-}
-
-inline void QOpenGLFunctions_4_0_Core::glGetActiveSubroutineName(GLuint program, GLenum shadertype, GLuint index, GLsizei bufsize, GLsizei *length, GLchar *name)
-{
- d_4_0_Core->f.GetActiveSubroutineName(program, shadertype, index, bufsize, length, name);
-}
-
-inline void QOpenGLFunctions_4_0_Core::glGetActiveSubroutineUniformName(GLuint program, GLenum shadertype, GLuint index, GLsizei bufsize, GLsizei *length, GLchar *name)
-{
- d_4_0_Core->f.GetActiveSubroutineUniformName(program, shadertype, index, bufsize, length, name);
-}
-
-inline void QOpenGLFunctions_4_0_Core::glGetActiveSubroutineUniformiv(GLuint program, GLenum shadertype, GLuint index, GLenum pname, GLint *values)
-{
- d_4_0_Core->f.GetActiveSubroutineUniformiv(program, shadertype, index, pname, values);
-}
-
-inline GLuint QOpenGLFunctions_4_0_Core::glGetSubroutineIndex(GLuint program, GLenum shadertype, const GLchar *name)
-{
- return d_4_0_Core->f.GetSubroutineIndex(program, shadertype, name);
-}
-
-inline GLint QOpenGLFunctions_4_0_Core::glGetSubroutineUniformLocation(GLuint program, GLenum shadertype, const GLchar *name)
-{
- return d_4_0_Core->f.GetSubroutineUniformLocation(program, shadertype, name);
-}
-
-inline void QOpenGLFunctions_4_0_Core::glGetUniformdv(GLuint program, GLint location, GLdouble *params)
-{
- d_4_0_Core->f.GetUniformdv(program, location, params);
-}
-
-inline void QOpenGLFunctions_4_0_Core::glUniformMatrix4x3dv(GLint location, GLsizei count, GLboolean transpose, const GLdouble *value)
-{
- d_4_0_Core->f.UniformMatrix4x3dv(location, count, transpose, value);
-}
-
-inline void QOpenGLFunctions_4_0_Core::glUniformMatrix4x2dv(GLint location, GLsizei count, GLboolean transpose, const GLdouble *value)
-{
- d_4_0_Core->f.UniformMatrix4x2dv(location, count, transpose, value);
-}
-
-inline void QOpenGLFunctions_4_0_Core::glUniformMatrix3x4dv(GLint location, GLsizei count, GLboolean transpose, const GLdouble *value)
-{
- d_4_0_Core->f.UniformMatrix3x4dv(location, count, transpose, value);
-}
-
-inline void QOpenGLFunctions_4_0_Core::glUniformMatrix3x2dv(GLint location, GLsizei count, GLboolean transpose, const GLdouble *value)
-{
- d_4_0_Core->f.UniformMatrix3x2dv(location, count, transpose, value);
-}
-
-inline void QOpenGLFunctions_4_0_Core::glUniformMatrix2x4dv(GLint location, GLsizei count, GLboolean transpose, const GLdouble *value)
-{
- d_4_0_Core->f.UniformMatrix2x4dv(location, count, transpose, value);
-}
-
-inline void QOpenGLFunctions_4_0_Core::glUniformMatrix2x3dv(GLint location, GLsizei count, GLboolean transpose, const GLdouble *value)
-{
- d_4_0_Core->f.UniformMatrix2x3dv(location, count, transpose, value);
-}
-
-inline void QOpenGLFunctions_4_0_Core::glUniformMatrix4dv(GLint location, GLsizei count, GLboolean transpose, const GLdouble *value)
-{
- d_4_0_Core->f.UniformMatrix4dv(location, count, transpose, value);
-}
-
-inline void QOpenGLFunctions_4_0_Core::glUniformMatrix3dv(GLint location, GLsizei count, GLboolean transpose, const GLdouble *value)
-{
- d_4_0_Core->f.UniformMatrix3dv(location, count, transpose, value);
-}
-
-inline void QOpenGLFunctions_4_0_Core::glUniformMatrix2dv(GLint location, GLsizei count, GLboolean transpose, const GLdouble *value)
-{
- d_4_0_Core->f.UniformMatrix2dv(location, count, transpose, value);
-}
-
-inline void QOpenGLFunctions_4_0_Core::glUniform4dv(GLint location, GLsizei count, const GLdouble *value)
-{
- d_4_0_Core->f.Uniform4dv(location, count, value);
-}
-
-inline void QOpenGLFunctions_4_0_Core::glUniform3dv(GLint location, GLsizei count, const GLdouble *value)
-{
- d_4_0_Core->f.Uniform3dv(location, count, value);
-}
-
-inline void QOpenGLFunctions_4_0_Core::glUniform2dv(GLint location, GLsizei count, const GLdouble *value)
-{
- d_4_0_Core->f.Uniform2dv(location, count, value);
-}
-
-inline void QOpenGLFunctions_4_0_Core::glUniform1dv(GLint location, GLsizei count, const GLdouble *value)
-{
- d_4_0_Core->f.Uniform1dv(location, count, value);
-}
-
-inline void QOpenGLFunctions_4_0_Core::glUniform4d(GLint location, GLdouble x, GLdouble y, GLdouble z, GLdouble w)
-{
- d_4_0_Core->f.Uniform4d(location, x, y, z, w);
-}
-
-inline void QOpenGLFunctions_4_0_Core::glUniform3d(GLint location, GLdouble x, GLdouble y, GLdouble z)
-{
- d_4_0_Core->f.Uniform3d(location, x, y, z);
-}
-
-inline void QOpenGLFunctions_4_0_Core::glUniform2d(GLint location, GLdouble x, GLdouble y)
-{
- d_4_0_Core->f.Uniform2d(location, x, y);
-}
-
-inline void QOpenGLFunctions_4_0_Core::glUniform1d(GLint location, GLdouble x)
-{
- d_4_0_Core->f.Uniform1d(location, x);
-}
-
-inline void QOpenGLFunctions_4_0_Core::glDrawElementsIndirect(GLenum mode, GLenum type, const GLvoid *indirect)
-{
- d_4_0_Core->f.DrawElementsIndirect(mode, type, indirect);
-}
-
-inline void QOpenGLFunctions_4_0_Core::glDrawArraysIndirect(GLenum mode, const GLvoid *indirect)
-{
- d_4_0_Core->f.DrawArraysIndirect(mode, indirect);
-}
-
-inline void QOpenGLFunctions_4_0_Core::glBlendFuncSeparatei(GLuint buf, GLenum srcRGB, GLenum dstRGB, GLenum srcAlpha, GLenum dstAlpha)
-{
- d_4_0_Core->f.BlendFuncSeparatei(buf, srcRGB, dstRGB, srcAlpha, dstAlpha);
-}
-
-inline void QOpenGLFunctions_4_0_Core::glBlendFunci(GLuint buf, GLenum src, GLenum dst)
-{
- d_4_0_Core->f.BlendFunci(buf, src, dst);
-}
-
-inline void QOpenGLFunctions_4_0_Core::glBlendEquationSeparatei(GLuint buf, GLenum modeRGB, GLenum modeAlpha)
-{
- d_4_0_Core->f.BlendEquationSeparatei(buf, modeRGB, modeAlpha);
-}
-
-inline void QOpenGLFunctions_4_0_Core::glBlendEquationi(GLuint buf, GLenum mode)
-{
- d_4_0_Core->f.BlendEquationi(buf, mode);
-}
-
-inline void QOpenGLFunctions_4_0_Core::glMinSampleShading(GLfloat value)
-{
- d_4_0_Core->f.MinSampleShading(value);
-}
-
-
-
-QT_END_NAMESPACE
-
-#endif // QT_NO_OPENGL && !QT_OPENGL_ES_2
-
-#endif
diff --git a/src/gui/opengl/qopenglfunctions_4_1_compatibility.cpp b/src/gui/opengl/qopenglfunctions_4_1_compatibility.cpp
deleted file mode 100644
index bdea8b5ba9..0000000000
--- a/src/gui/opengl/qopenglfunctions_4_1_compatibility.cpp
+++ /dev/null
@@ -1,300 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2013 Klaralvdalens Datakonsult AB (KDAB)
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the QtGui module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-**
-** This file was generated by glgen version 0.1
-** Command line was: glgen
-**
-** glgen is Copyright (C) 2013 Klaralvdalens Datakonsult AB (KDAB)
-**
-** This is an auto-generated file.
-** Do not edit! All changes made to it will be lost.
-**
-****************************************************************************/
-
-#include "qopenglfunctions_4_1_compatibility.h"
-#include "qopenglcontext.h"
-
-QT_BEGIN_NAMESPACE
-
-/*!
- \class QOpenGLFunctions_4_1_Compatibility
- \inmodule QtGui
- \since 5.1
- \wrapper
- \brief The QOpenGLFunctions_4_1_Compatibility class provides all functions for OpenGL 4.1 compatibility profile.
-
- This class is a wrapper for functions from OpenGL 4.1 compatibility profile.
- See reference pages on \l {http://www.opengl.org/sdk/docs/}{opengl.org}
- for function documentation.
-
- \sa QAbstractOpenGLFunctions
-*/
-
-QOpenGLFunctions_4_1_Compatibility::QOpenGLFunctions_4_1_Compatibility()
- : QAbstractOpenGLFunctions()
- , d_1_0_Core(nullptr)
- , d_1_1_Core(nullptr)
- , d_1_2_Core(nullptr)
- , d_1_3_Core(nullptr)
- , d_1_4_Core(nullptr)
- , d_1_5_Core(nullptr)
- , d_2_0_Core(nullptr)
- , d_2_1_Core(nullptr)
- , d_3_0_Core(nullptr)
- , d_3_1_Core(nullptr)
- , d_3_2_Core(nullptr)
- , d_3_3_Core(nullptr)
- , d_4_0_Core(nullptr)
- , d_4_1_Core(nullptr)
- , d_1_0_Deprecated(nullptr)
- , d_1_1_Deprecated(nullptr)
- , d_1_2_Deprecated(nullptr)
- , d_1_3_Deprecated(nullptr)
- , d_1_4_Deprecated(nullptr)
- , m_reserved_2_0_Deprecated(nullptr)
- , d_3_3_Deprecated(nullptr)
-{
-}
-
-QOpenGLFunctions_4_1_Compatibility::~QOpenGLFunctions_4_1_Compatibility()
-{
- if (d_1_0_Core) {
- d_1_0_Core->refs.deref();
- Q_ASSERT(d_1_0_Core->refs.loadRelaxed());
- }
- if (d_1_1_Core) {
- d_1_1_Core->refs.deref();
- Q_ASSERT(d_1_1_Core->refs.loadRelaxed());
- }
- if (d_1_2_Core) {
- d_1_2_Core->refs.deref();
- Q_ASSERT(d_1_2_Core->refs.loadRelaxed());
- }
- if (d_1_3_Core) {
- d_1_3_Core->refs.deref();
- Q_ASSERT(d_1_3_Core->refs.loadRelaxed());
- }
- if (d_1_4_Core) {
- d_1_4_Core->refs.deref();
- Q_ASSERT(d_1_4_Core->refs.loadRelaxed());
- }
- if (d_1_5_Core) {
- d_1_5_Core->refs.deref();
- Q_ASSERT(d_1_5_Core->refs.loadRelaxed());
- }
- if (d_2_0_Core) {
- d_2_0_Core->refs.deref();
- Q_ASSERT(d_2_0_Core->refs.loadRelaxed());
- }
- if (d_2_1_Core) {
- d_2_1_Core->refs.deref();
- Q_ASSERT(d_2_1_Core->refs.loadRelaxed());
- }
- if (d_3_0_Core) {
- d_3_0_Core->refs.deref();
- Q_ASSERT(d_3_0_Core->refs.loadRelaxed());
- }
- if (d_3_1_Core) {
- d_3_1_Core->refs.deref();
- Q_ASSERT(d_3_1_Core->refs.loadRelaxed());
- }
- if (d_3_2_Core) {
- d_3_2_Core->refs.deref();
- Q_ASSERT(d_3_2_Core->refs.loadRelaxed());
- }
- if (d_3_3_Core) {
- d_3_3_Core->refs.deref();
- Q_ASSERT(d_3_3_Core->refs.loadRelaxed());
- }
- if (d_4_0_Core) {
- d_4_0_Core->refs.deref();
- Q_ASSERT(d_4_0_Core->refs.loadRelaxed());
- }
- if (d_4_1_Core) {
- d_4_1_Core->refs.deref();
- Q_ASSERT(d_4_1_Core->refs.loadRelaxed());
- }
- if (d_1_0_Deprecated) {
- d_1_0_Deprecated->refs.deref();
- Q_ASSERT(d_1_0_Deprecated->refs.loadRelaxed());
- }
- if (d_1_1_Deprecated) {
- d_1_1_Deprecated->refs.deref();
- Q_ASSERT(d_1_1_Deprecated->refs.loadRelaxed());
- }
- if (d_1_2_Deprecated) {
- d_1_2_Deprecated->refs.deref();
- Q_ASSERT(d_1_2_Deprecated->refs.loadRelaxed());
- }
- if (d_1_3_Deprecated) {
- d_1_3_Deprecated->refs.deref();
- Q_ASSERT(d_1_3_Deprecated->refs.loadRelaxed());
- }
- if (d_1_4_Deprecated) {
- d_1_4_Deprecated->refs.deref();
- Q_ASSERT(d_1_4_Deprecated->refs.loadRelaxed());
- }
- if (d_3_3_Deprecated) {
- d_3_3_Deprecated->refs.deref();
- Q_ASSERT(d_3_3_Deprecated->refs.loadRelaxed());
- }
-}
-
-bool QOpenGLFunctions_4_1_Compatibility::initializeOpenGLFunctions()
-{
- if ( isInitialized() )
- return true;
-
- QOpenGLContext* context = QOpenGLContext::currentContext();
-
- // If owned by a context object make sure it is current.
- // Also check that current context is capable of resolving all needed functions
- if (((owningContext() && owningContext() == context) || !owningContext())
- && QOpenGLFunctions_4_1_Compatibility::isContextCompatible(context))
- {
- // Associate with private implementation, creating if necessary
- // Function pointers in the backends are resolved at creation time
- QOpenGLVersionFunctionsBackend* d = nullptr;
- d = QAbstractOpenGLFunctionsPrivate::functionsBackend(context, QOpenGLFunctions_1_0_CoreBackend::versionStatus());
- d_1_0_Core = static_cast<QOpenGLFunctions_1_0_CoreBackend*>(d);
- d->refs.ref();
-
- d = QAbstractOpenGLFunctionsPrivate::functionsBackend(context, QOpenGLFunctions_1_1_CoreBackend::versionStatus());
- d_1_1_Core = static_cast<QOpenGLFunctions_1_1_CoreBackend*>(d);
- d->refs.ref();
-
- d = QAbstractOpenGLFunctionsPrivate::functionsBackend(context, QOpenGLFunctions_1_2_CoreBackend::versionStatus());
- d_1_2_Core = static_cast<QOpenGLFunctions_1_2_CoreBackend*>(d);
- d->refs.ref();
-
- d = QAbstractOpenGLFunctionsPrivate::functionsBackend(context, QOpenGLFunctions_1_3_CoreBackend::versionStatus());
- d_1_3_Core = static_cast<QOpenGLFunctions_1_3_CoreBackend*>(d);
- d->refs.ref();
-
- d = QAbstractOpenGLFunctionsPrivate::functionsBackend(context, QOpenGLFunctions_1_4_CoreBackend::versionStatus());
- d_1_4_Core = static_cast<QOpenGLFunctions_1_4_CoreBackend*>(d);
- d->refs.ref();
-
- d = QAbstractOpenGLFunctionsPrivate::functionsBackend(context, QOpenGLFunctions_1_5_CoreBackend::versionStatus());
- d_1_5_Core = static_cast<QOpenGLFunctions_1_5_CoreBackend*>(d);
- d->refs.ref();
-
- d = QAbstractOpenGLFunctionsPrivate::functionsBackend(context, QOpenGLFunctions_2_0_CoreBackend::versionStatus());
- d_2_0_Core = static_cast<QOpenGLFunctions_2_0_CoreBackend*>(d);
- d->refs.ref();
-
- d = QAbstractOpenGLFunctionsPrivate::functionsBackend(context, QOpenGLFunctions_2_1_CoreBackend::versionStatus());
- d_2_1_Core = static_cast<QOpenGLFunctions_2_1_CoreBackend*>(d);
- d->refs.ref();
-
- d = QAbstractOpenGLFunctionsPrivate::functionsBackend(context, QOpenGLFunctions_3_0_CoreBackend::versionStatus());
- d_3_0_Core = static_cast<QOpenGLFunctions_3_0_CoreBackend*>(d);
- d->refs.ref();
-
- d = QAbstractOpenGLFunctionsPrivate::functionsBackend(context, QOpenGLFunctions_3_1_CoreBackend::versionStatus());
- d_3_1_Core = static_cast<QOpenGLFunctions_3_1_CoreBackend*>(d);
- d->refs.ref();
-
- d = QAbstractOpenGLFunctionsPrivate::functionsBackend(context, QOpenGLFunctions_3_2_CoreBackend::versionStatus());
- d_3_2_Core = static_cast<QOpenGLFunctions_3_2_CoreBackend*>(d);
- d->refs.ref();
-
- d = QAbstractOpenGLFunctionsPrivate::functionsBackend(context, QOpenGLFunctions_3_3_CoreBackend::versionStatus());
- d_3_3_Core = static_cast<QOpenGLFunctions_3_3_CoreBackend*>(d);
- d->refs.ref();
-
- d = QAbstractOpenGLFunctionsPrivate::functionsBackend(context, QOpenGLFunctions_4_0_CoreBackend::versionStatus());
- d_4_0_Core = static_cast<QOpenGLFunctions_4_0_CoreBackend*>(d);
- d->refs.ref();
-
- d = QAbstractOpenGLFunctionsPrivate::functionsBackend(context, QOpenGLFunctions_4_1_CoreBackend::versionStatus());
- d_4_1_Core = static_cast<QOpenGLFunctions_4_1_CoreBackend*>(d);
- d->refs.ref();
-
- d = QAbstractOpenGLFunctionsPrivate::functionsBackend(context, QOpenGLFunctions_1_0_DeprecatedBackend::versionStatus());
- d_1_0_Deprecated = static_cast<QOpenGLFunctions_1_0_DeprecatedBackend*>(d);
- d->refs.ref();
-
- d = QAbstractOpenGLFunctionsPrivate::functionsBackend(context, QOpenGLFunctions_1_1_DeprecatedBackend::versionStatus());
- d_1_1_Deprecated = static_cast<QOpenGLFunctions_1_1_DeprecatedBackend*>(d);
- d->refs.ref();
-
- d = QAbstractOpenGLFunctionsPrivate::functionsBackend(context, QOpenGLFunctions_1_2_DeprecatedBackend::versionStatus());
- d_1_2_Deprecated = static_cast<QOpenGLFunctions_1_2_DeprecatedBackend*>(d);
- d->refs.ref();
-
- d = QAbstractOpenGLFunctionsPrivate::functionsBackend(context, QOpenGLFunctions_1_3_DeprecatedBackend::versionStatus());
- d_1_3_Deprecated = static_cast<QOpenGLFunctions_1_3_DeprecatedBackend*>(d);
- d->refs.ref();
-
- d = QAbstractOpenGLFunctionsPrivate::functionsBackend(context, QOpenGLFunctions_1_4_DeprecatedBackend::versionStatus());
- d_1_4_Deprecated = static_cast<QOpenGLFunctions_1_4_DeprecatedBackend*>(d);
- d->refs.ref();
-
- d = QAbstractOpenGLFunctionsPrivate::functionsBackend(context, QOpenGLFunctions_3_3_DeprecatedBackend::versionStatus());
- d_3_3_Deprecated = static_cast<QOpenGLFunctions_3_3_DeprecatedBackend*>(d);
- d->refs.ref();
-
- QAbstractOpenGLFunctions::initializeOpenGLFunctions();
- }
- return isInitialized();
-}
-
-bool QOpenGLFunctions_4_1_Compatibility::isContextCompatible(QOpenGLContext *context)
-{
- Q_ASSERT(context);
- QSurfaceFormat f = context->format();
- const QPair<int, int> v = qMakePair(f.majorVersion(), f.minorVersion());
- if (v < qMakePair(4, 1))
- return false;
-
- if (f.profile() == QSurfaceFormat::CoreProfile)
- return false;
-
- return true;
-}
-
-QOpenGLVersionProfile QOpenGLFunctions_4_1_Compatibility::versionProfile()
-{
- QOpenGLVersionProfile v;
- v.setVersion(4, 1);
- v.setProfile(QSurfaceFormat::CompatibilityProfile);
- return v;
-}
-
-QT_END_NAMESPACE
diff --git a/src/gui/opengl/qopenglfunctions_4_1_compatibility.h b/src/gui/opengl/qopenglfunctions_4_1_compatibility.h
deleted file mode 100644
index bee169b50c..0000000000
--- a/src/gui/opengl/qopenglfunctions_4_1_compatibility.h
+++ /dev/null
@@ -1,5556 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2013 Klaralvdalens Datakonsult AB (KDAB)
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the QtGui module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-**
-** This file was generated by glgen version 0.1
-** Command line was: glgen
-**
-** glgen is Copyright (C) 2013 Klaralvdalens Datakonsult AB (KDAB)
-**
-** This is an auto-generated file.
-** Do not edit! All changes made to it will be lost.
-**
-****************************************************************************/
-
-#ifndef QOPENGLVERSIONFUNCTIONS_4_1_COMPATIBILITY_H
-#define QOPENGLVERSIONFUNCTIONS_4_1_COMPATIBILITY_H
-
-#include <QtGui/qtguiglobal.h>
-
-#if !defined(QT_NO_OPENGL) && !defined(QT_OPENGL_ES_2)
-
-#include <QtGui/QOpenGLVersionFunctions>
-#include <QtGui/qopenglcontext.h>
-
-QT_BEGIN_NAMESPACE
-
-class Q_GUI_EXPORT QOpenGLFunctions_4_1_Compatibility : public QAbstractOpenGLFunctions
-{
-public:
- QOpenGLFunctions_4_1_Compatibility();
- ~QOpenGLFunctions_4_1_Compatibility();
-
- bool initializeOpenGLFunctions() override;
-
- // OpenGL 1.0 core functions
- void glViewport(GLint x, GLint y, GLsizei width, GLsizei height);
- void glDepthRange(GLdouble nearVal, GLdouble farVal);
- GLboolean glIsEnabled(GLenum cap);
- void glGetTexLevelParameteriv(GLenum target, GLint level, GLenum pname, GLint *params);
- void glGetTexLevelParameterfv(GLenum target, GLint level, GLenum pname, GLfloat *params);
- void glGetTexParameteriv(GLenum target, GLenum pname, GLint *params);
- void glGetTexParameterfv(GLenum target, GLenum pname, GLfloat *params);
- void glGetTexImage(GLenum target, GLint level, GLenum format, GLenum type, GLvoid *pixels);
- const GLubyte * glGetString(GLenum name);
- void glGetIntegerv(GLenum pname, GLint *params);
- void glGetFloatv(GLenum pname, GLfloat *params);
- GLenum glGetError();
- void glGetDoublev(GLenum pname, GLdouble *params);
- void glGetBooleanv(GLenum pname, GLboolean *params);
- void glReadPixels(GLint x, GLint y, GLsizei width, GLsizei height, GLenum format, GLenum type, GLvoid *pixels);
- void glReadBuffer(GLenum mode);
- void glPixelStorei(GLenum pname, GLint param);
- void glPixelStoref(GLenum pname, GLfloat param);
- void glDepthFunc(GLenum func);
- void glStencilOp(GLenum fail, GLenum zfail, GLenum zpass);
- void glStencilFunc(GLenum func, GLint ref, GLuint mask);
- void glLogicOp(GLenum opcode);
- void glBlendFunc(GLenum sfactor, GLenum dfactor);
- void glFlush();
- void glFinish();
- void glEnable(GLenum cap);
- void glDisable(GLenum cap);
- void glDepthMask(GLboolean flag);
- void glColorMask(GLboolean red, GLboolean green, GLboolean blue, GLboolean alpha);
- void glStencilMask(GLuint mask);
- void glClearDepth(GLdouble depth);
- void glClearStencil(GLint s);
- void glClearColor(GLfloat red, GLfloat green, GLfloat blue, GLfloat alpha);
- void glClear(GLbitfield mask);
- void glDrawBuffer(GLenum mode);
- void glTexImage2D(GLenum target, GLint level, GLint internalformat, GLsizei width, GLsizei height, GLint border, GLenum format, GLenum type, const GLvoid *pixels);
- void glTexImage1D(GLenum target, GLint level, GLint internalformat, GLsizei width, GLint border, GLenum format, GLenum type, const GLvoid *pixels);
- void glTexParameteriv(GLenum target, GLenum pname, const GLint *params);
- void glTexParameteri(GLenum target, GLenum pname, GLint param);
- void glTexParameterfv(GLenum target, GLenum pname, const GLfloat *params);
- void glTexParameterf(GLenum target, GLenum pname, GLfloat param);
- void glScissor(GLint x, GLint y, GLsizei width, GLsizei height);
- void glPolygonMode(GLenum face, GLenum mode);
- void glPointSize(GLfloat size);
- void glLineWidth(GLfloat width);
- void glHint(GLenum target, GLenum mode);
- void glFrontFace(GLenum mode);
- void glCullFace(GLenum mode);
-
- // OpenGL 1.1 core functions
- void glIndexubv(const GLubyte *c);
- void glIndexub(GLubyte c);
- GLboolean glIsTexture(GLuint texture);
- void glGenTextures(GLsizei n, GLuint *textures);
- void glDeleteTextures(GLsizei n, const GLuint *textures);
- void glBindTexture(GLenum target, GLuint texture);
- void glTexSubImage2D(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLenum type, const GLvoid *pixels);
- void glTexSubImage1D(GLenum target, GLint level, GLint xoffset, GLsizei width, GLenum format, GLenum type, const GLvoid *pixels);
- void glCopyTexSubImage2D(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint x, GLint y, GLsizei width, GLsizei height);
- void glCopyTexSubImage1D(GLenum target, GLint level, GLint xoffset, GLint x, GLint y, GLsizei width);
- void glCopyTexImage2D(GLenum target, GLint level, GLenum internalformat, GLint x, GLint y, GLsizei width, GLsizei height, GLint border);
- void glCopyTexImage1D(GLenum target, GLint level, GLenum internalformat, GLint x, GLint y, GLsizei width, GLint border);
- void glPolygonOffset(GLfloat factor, GLfloat units);
- void glGetPointerv(GLenum pname, GLvoid* *params);
- void glDrawElements(GLenum mode, GLsizei count, GLenum type, const GLvoid *indices);
- void glDrawArrays(GLenum mode, GLint first, GLsizei count);
-
- // OpenGL 1.2 core functions
- void glCopyTexSubImage3D(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLint x, GLint y, GLsizei width, GLsizei height);
- void glTexSubImage3D(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLenum type, const GLvoid *pixels);
- void glTexImage3D(GLenum target, GLint level, GLint internalformat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLenum format, GLenum type, const GLvoid *pixels);
- void glDrawRangeElements(GLenum mode, GLuint start, GLuint end, GLsizei count, GLenum type, const GLvoid *indices);
- void glBlendEquation(GLenum mode);
- void glBlendColor(GLfloat red, GLfloat green, GLfloat blue, GLfloat alpha);
-
- // OpenGL 1.3 core functions
- void glGetCompressedTexImage(GLenum target, GLint level, GLvoid *img);
- void glCompressedTexSubImage1D(GLenum target, GLint level, GLint xoffset, GLsizei width, GLenum format, GLsizei imageSize, const GLvoid *data);
- void glCompressedTexSubImage2D(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLsizei imageSize, const GLvoid *data);
- void glCompressedTexSubImage3D(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLsizei imageSize, const GLvoid *data);
- void glCompressedTexImage1D(GLenum target, GLint level, GLenum internalformat, GLsizei width, GLint border, GLsizei imageSize, const GLvoid *data);
- void glCompressedTexImage2D(GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLint border, GLsizei imageSize, const GLvoid *data);
- void glCompressedTexImage3D(GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLsizei imageSize, const GLvoid *data);
- void glSampleCoverage(GLfloat value, GLboolean invert);
- void glActiveTexture(GLenum texture);
-
- // OpenGL 1.4 core functions
- void glPointParameteriv(GLenum pname, const GLint *params);
- void glPointParameteri(GLenum pname, GLint param);
- void glPointParameterfv(GLenum pname, const GLfloat *params);
- void glPointParameterf(GLenum pname, GLfloat param);
- void glMultiDrawElements(GLenum mode, const GLsizei *count, GLenum type, const GLvoid* const *indices, GLsizei drawcount);
- void glMultiDrawArrays(GLenum mode, const GLint *first, const GLsizei *count, GLsizei drawcount);
- void glBlendFuncSeparate(GLenum sfactorRGB, GLenum dfactorRGB, GLenum sfactorAlpha, GLenum dfactorAlpha);
-
- // OpenGL 1.5 core functions
- void glGetBufferPointerv(GLenum target, GLenum pname, GLvoid* *params);
- void glGetBufferParameteriv(GLenum target, GLenum pname, GLint *params);
- GLboolean glUnmapBuffer(GLenum target);
- GLvoid* glMapBuffer(GLenum target, GLenum access);
- void glGetBufferSubData(GLenum target, GLintptr offset, GLsizeiptr size, GLvoid *data);
- void glBufferSubData(GLenum target, GLintptr offset, GLsizeiptr size, const GLvoid *data);
- void glBufferData(GLenum target, GLsizeiptr size, const GLvoid *data, GLenum usage);
- GLboolean glIsBuffer(GLuint buffer);
- void glGenBuffers(GLsizei n, GLuint *buffers);
- void glDeleteBuffers(GLsizei n, const GLuint *buffers);
- void glBindBuffer(GLenum target, GLuint buffer);
- void glGetQueryObjectuiv(GLuint id, GLenum pname, GLuint *params);
- void glGetQueryObjectiv(GLuint id, GLenum pname, GLint *params);
- void glGetQueryiv(GLenum target, GLenum pname, GLint *params);
- void glEndQuery(GLenum target);
- void glBeginQuery(GLenum target, GLuint id);
- GLboolean glIsQuery(GLuint id);
- void glDeleteQueries(GLsizei n, const GLuint *ids);
- void glGenQueries(GLsizei n, GLuint *ids);
-
- // OpenGL 2.0 core functions
- void glVertexAttribPointer(GLuint index, GLint size, GLenum type, GLboolean normalized, GLsizei stride, const GLvoid *pointer);
- void glValidateProgram(GLuint program);
- void glUniformMatrix4fv(GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
- void glUniformMatrix3fv(GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
- void glUniformMatrix2fv(GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
- void glUniform4iv(GLint location, GLsizei count, const GLint *value);
- void glUniform3iv(GLint location, GLsizei count, const GLint *value);
- void glUniform2iv(GLint location, GLsizei count, const GLint *value);
- void glUniform1iv(GLint location, GLsizei count, const GLint *value);
- void glUniform4fv(GLint location, GLsizei count, const GLfloat *value);
- void glUniform3fv(GLint location, GLsizei count, const GLfloat *value);
- void glUniform2fv(GLint location, GLsizei count, const GLfloat *value);
- void glUniform1fv(GLint location, GLsizei count, const GLfloat *value);
- void glUniform4i(GLint location, GLint v0, GLint v1, GLint v2, GLint v3);
- void glUniform3i(GLint location, GLint v0, GLint v1, GLint v2);
- void glUniform2i(GLint location, GLint v0, GLint v1);
- void glUniform1i(GLint location, GLint v0);
- void glUniform4f(GLint location, GLfloat v0, GLfloat v1, GLfloat v2, GLfloat v3);
- void glUniform3f(GLint location, GLfloat v0, GLfloat v1, GLfloat v2);
- void glUniform2f(GLint location, GLfloat v0, GLfloat v1);
- void glUniform1f(GLint location, GLfloat v0);
- void glUseProgram(GLuint program);
- void glShaderSource(GLuint shader, GLsizei count, const GLchar* const *string, const GLint *length);
- void glLinkProgram(GLuint program);
- GLboolean glIsShader(GLuint shader);
- GLboolean glIsProgram(GLuint program);
- void glGetVertexAttribPointerv(GLuint index, GLenum pname, GLvoid* *pointer);
- void glGetVertexAttribiv(GLuint index, GLenum pname, GLint *params);
- void glGetVertexAttribfv(GLuint index, GLenum pname, GLfloat *params);
- void glGetVertexAttribdv(GLuint index, GLenum pname, GLdouble *params);
- void glGetUniformiv(GLuint program, GLint location, GLint *params);
- void glGetUniformfv(GLuint program, GLint location, GLfloat *params);
- GLint glGetUniformLocation(GLuint program, const GLchar *name);
- void glGetShaderSource(GLuint shader, GLsizei bufSize, GLsizei *length, GLchar *source);
- void glGetShaderInfoLog(GLuint shader, GLsizei bufSize, GLsizei *length, GLchar *infoLog);
- void glGetShaderiv(GLuint shader, GLenum pname, GLint *params);
- void glGetProgramInfoLog(GLuint program, GLsizei bufSize, GLsizei *length, GLchar *infoLog);
- void glGetProgramiv(GLuint program, GLenum pname, GLint *params);
- GLint glGetAttribLocation(GLuint program, const GLchar *name);
- void glGetAttachedShaders(GLuint program, GLsizei maxCount, GLsizei *count, GLuint *obj);
- void glGetActiveUniform(GLuint program, GLuint index, GLsizei bufSize, GLsizei *length, GLint *size, GLenum *type, GLchar *name);
- void glGetActiveAttrib(GLuint program, GLuint index, GLsizei bufSize, GLsizei *length, GLint *size, GLenum *type, GLchar *name);
- void glEnableVertexAttribArray(GLuint index);
- void glDisableVertexAttribArray(GLuint index);
- void glDetachShader(GLuint program, GLuint shader);
- void glDeleteShader(GLuint shader);
- void glDeleteProgram(GLuint program);
- GLuint glCreateShader(GLenum type);
- GLuint glCreateProgram();
- void glCompileShader(GLuint shader);
- void glBindAttribLocation(GLuint program, GLuint index, const GLchar *name);
- void glAttachShader(GLuint program, GLuint shader);
- void glStencilMaskSeparate(GLenum face, GLuint mask);
- void glStencilFuncSeparate(GLenum face, GLenum func, GLint ref, GLuint mask);
- void glStencilOpSeparate(GLenum face, GLenum sfail, GLenum dpfail, GLenum dppass);
- void glDrawBuffers(GLsizei n, const GLenum *bufs);
- void glBlendEquationSeparate(GLenum modeRGB, GLenum modeAlpha);
-
- // OpenGL 2.1 core functions
- void glUniformMatrix4x3fv(GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
- void glUniformMatrix3x4fv(GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
- void glUniformMatrix4x2fv(GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
- void glUniformMatrix2x4fv(GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
- void glUniformMatrix3x2fv(GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
- void glUniformMatrix2x3fv(GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
-
- // OpenGL 3.0 core functions
- GLboolean glIsVertexArray(GLuint array);
- void glGenVertexArrays(GLsizei n, GLuint *arrays);
- void glDeleteVertexArrays(GLsizei n, const GLuint *arrays);
- void glBindVertexArray(GLuint array);
- void glFlushMappedBufferRange(GLenum target, GLintptr offset, GLsizeiptr length);
- GLvoid* glMapBufferRange(GLenum target, GLintptr offset, GLsizeiptr length, GLbitfield access);
- void glFramebufferTextureLayer(GLenum target, GLenum attachment, GLuint texture, GLint level, GLint layer);
- void glRenderbufferStorageMultisample(GLenum target, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height);
- void glBlitFramebuffer(GLint srcX0, GLint srcY0, GLint srcX1, GLint srcY1, GLint dstX0, GLint dstY0, GLint dstX1, GLint dstY1, GLbitfield mask, GLenum filter);
- void glGenerateMipmap(GLenum target);
- void glGetFramebufferAttachmentParameteriv(GLenum target, GLenum attachment, GLenum pname, GLint *params);
- void glFramebufferRenderbuffer(GLenum target, GLenum attachment, GLenum renderbuffertarget, GLuint renderbuffer);
- void glFramebufferTexture3D(GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level, GLint zoffset);
- void glFramebufferTexture2D(GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level);
- void glFramebufferTexture1D(GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level);
- GLenum glCheckFramebufferStatus(GLenum target);
- void glGenFramebuffers(GLsizei n, GLuint *framebuffers);
- void glDeleteFramebuffers(GLsizei n, const GLuint *framebuffers);
- void glBindFramebuffer(GLenum target, GLuint framebuffer);
- GLboolean glIsFramebuffer(GLuint framebuffer);
- void glGetRenderbufferParameteriv(GLenum target, GLenum pname, GLint *params);
- void glRenderbufferStorage(GLenum target, GLenum internalformat, GLsizei width, GLsizei height);
- void glGenRenderbuffers(GLsizei n, GLuint *renderbuffers);
- void glDeleteRenderbuffers(GLsizei n, const GLuint *renderbuffers);
- void glBindRenderbuffer(GLenum target, GLuint renderbuffer);
- GLboolean glIsRenderbuffer(GLuint renderbuffer);
- const GLubyte * glGetStringi(GLenum name, GLuint index);
- void glClearBufferfi(GLenum buffer, GLint drawbuffer, GLfloat depth, GLint stencil);
- void glClearBufferfv(GLenum buffer, GLint drawbuffer, const GLfloat *value);
- void glClearBufferuiv(GLenum buffer, GLint drawbuffer, const GLuint *value);
- void glClearBufferiv(GLenum buffer, GLint drawbuffer, const GLint *value);
- void glGetTexParameterIuiv(GLenum target, GLenum pname, GLuint *params);
- void glGetTexParameterIiv(GLenum target, GLenum pname, GLint *params);
- void glTexParameterIuiv(GLenum target, GLenum pname, const GLuint *params);
- void glTexParameterIiv(GLenum target, GLenum pname, const GLint *params);
- void glUniform4uiv(GLint location, GLsizei count, const GLuint *value);
- void glUniform3uiv(GLint location, GLsizei count, const GLuint *value);
- void glUniform2uiv(GLint location, GLsizei count, const GLuint *value);
- void glUniform1uiv(GLint location, GLsizei count, const GLuint *value);
- void glUniform4ui(GLint location, GLuint v0, GLuint v1, GLuint v2, GLuint v3);
- void glUniform3ui(GLint location, GLuint v0, GLuint v1, GLuint v2);
- void glUniform2ui(GLint location, GLuint v0, GLuint v1);
- void glUniform1ui(GLint location, GLuint v0);
- GLint glGetFragDataLocation(GLuint program, const GLchar *name);
- void glBindFragDataLocation(GLuint program, GLuint color, const GLchar *name);
- void glGetUniformuiv(GLuint program, GLint location, GLuint *params);
- void glGetVertexAttribIuiv(GLuint index, GLenum pname, GLuint *params);
- void glGetVertexAttribIiv(GLuint index, GLenum pname, GLint *params);
- void glVertexAttribIPointer(GLuint index, GLint size, GLenum type, GLsizei stride, const GLvoid *pointer);
- void glEndConditionalRender();
- void glBeginConditionalRender(GLuint id, GLenum mode);
- void glClampColor(GLenum target, GLenum clamp);
- void glGetTransformFeedbackVarying(GLuint program, GLuint index, GLsizei bufSize, GLsizei *length, GLsizei *size, GLenum *type, GLchar *name);
- void glTransformFeedbackVaryings(GLuint program, GLsizei count, const GLchar* const *varyings, GLenum bufferMode);
- void glBindBufferBase(GLenum target, GLuint index, GLuint buffer);
- void glBindBufferRange(GLenum target, GLuint index, GLuint buffer, GLintptr offset, GLsizeiptr size);
- void glEndTransformFeedback();
- void glBeginTransformFeedback(GLenum primitiveMode);
- GLboolean glIsEnabledi(GLenum target, GLuint index);
- void glDisablei(GLenum target, GLuint index);
- void glEnablei(GLenum target, GLuint index);
- void glGetIntegeri_v(GLenum target, GLuint index, GLint *data);
- void glGetBooleani_v(GLenum target, GLuint index, GLboolean *data);
- void glColorMaski(GLuint index, GLboolean r, GLboolean g, GLboolean b, GLboolean a);
-
- // OpenGL 3.1 core functions
- void glCopyBufferSubData(GLenum readTarget, GLenum writeTarget, GLintptr readOffset, GLintptr writeOffset, GLsizeiptr size);
- void glUniformBlockBinding(GLuint program, GLuint uniformBlockIndex, GLuint uniformBlockBinding);
- void glGetActiveUniformBlockName(GLuint program, GLuint uniformBlockIndex, GLsizei bufSize, GLsizei *length, GLchar *uniformBlockName);
- void glGetActiveUniformBlockiv(GLuint program, GLuint uniformBlockIndex, GLenum pname, GLint *params);
- GLuint glGetUniformBlockIndex(GLuint program, const GLchar *uniformBlockName);
- void glGetActiveUniformName(GLuint program, GLuint uniformIndex, GLsizei bufSize, GLsizei *length, GLchar *uniformName);
- void glGetActiveUniformsiv(GLuint program, GLsizei uniformCount, const GLuint *uniformIndices, GLenum pname, GLint *params);
- void glGetUniformIndices(GLuint program, GLsizei uniformCount, const GLchar* const *uniformNames, GLuint *uniformIndices);
- void glPrimitiveRestartIndex(GLuint index);
- void glTexBuffer(GLenum target, GLenum internalformat, GLuint buffer);
- void glDrawElementsInstanced(GLenum mode, GLsizei count, GLenum type, const GLvoid *indices, GLsizei instancecount);
- void glDrawArraysInstanced(GLenum mode, GLint first, GLsizei count, GLsizei instancecount);
-
- // OpenGL 3.2 core functions
- void glSampleMaski(GLuint index, GLbitfield mask);
- void glGetMultisamplefv(GLenum pname, GLuint index, GLfloat *val);
- void glTexImage3DMultisample(GLenum target, GLsizei samples, GLint internalformat, GLsizei width, GLsizei height, GLsizei depth, GLboolean fixedsamplelocations);
- void glTexImage2DMultisample(GLenum target, GLsizei samples, GLint internalformat, GLsizei width, GLsizei height, GLboolean fixedsamplelocations);
- void glGetSynciv(GLsync sync, GLenum pname, GLsizei bufSize, GLsizei *length, GLint *values);
- void glGetInteger64v(GLenum pname, GLint64 *params);
- void glWaitSync(GLsync sync, GLbitfield flags, GLuint64 timeout);
- GLenum glClientWaitSync(GLsync sync, GLbitfield flags, GLuint64 timeout);
- void glDeleteSync(GLsync sync);
- GLboolean glIsSync(GLsync sync);
- GLsync glFenceSync(GLenum condition, GLbitfield flags);
- void glProvokingVertex(GLenum mode);
- void glMultiDrawElementsBaseVertex(GLenum mode, const GLsizei *count, GLenum type, const GLvoid* const *indices, GLsizei drawcount, const GLint *basevertex);
- void glDrawElementsInstancedBaseVertex(GLenum mode, GLsizei count, GLenum type, const GLvoid *indices, GLsizei instancecount, GLint basevertex);
- void glDrawRangeElementsBaseVertex(GLenum mode, GLuint start, GLuint end, GLsizei count, GLenum type, const GLvoid *indices, GLint basevertex);
- void glDrawElementsBaseVertex(GLenum mode, GLsizei count, GLenum type, const GLvoid *indices, GLint basevertex);
- void glFramebufferTexture(GLenum target, GLenum attachment, GLuint texture, GLint level);
- void glGetBufferParameteri64v(GLenum target, GLenum pname, GLint64 *params);
- void glGetInteger64i_v(GLenum target, GLuint index, GLint64 *data);
-
- // OpenGL 3.3 core functions
- void glVertexAttribP4uiv(GLuint index, GLenum type, GLboolean normalized, const GLuint *value);
- void glVertexAttribP4ui(GLuint index, GLenum type, GLboolean normalized, GLuint value);
- void glVertexAttribP3uiv(GLuint index, GLenum type, GLboolean normalized, const GLuint *value);
- void glVertexAttribP3ui(GLuint index, GLenum type, GLboolean normalized, GLuint value);
- void glVertexAttribP2uiv(GLuint index, GLenum type, GLboolean normalized, const GLuint *value);
- void glVertexAttribP2ui(GLuint index, GLenum type, GLboolean normalized, GLuint value);
- void glVertexAttribP1uiv(GLuint index, GLenum type, GLboolean normalized, const GLuint *value);
- void glVertexAttribP1ui(GLuint index, GLenum type, GLboolean normalized, GLuint value);
- void glSecondaryColorP3uiv(GLenum type, const GLuint *color);
- void glSecondaryColorP3ui(GLenum type, GLuint color);
- void glColorP4uiv(GLenum type, const GLuint *color);
- void glColorP4ui(GLenum type, GLuint color);
- void glColorP3uiv(GLenum type, const GLuint *color);
- void glColorP3ui(GLenum type, GLuint color);
- void glNormalP3uiv(GLenum type, const GLuint *coords);
- void glNormalP3ui(GLenum type, GLuint coords);
- void glMultiTexCoordP4uiv(GLenum texture, GLenum type, const GLuint *coords);
- void glMultiTexCoordP4ui(GLenum texture, GLenum type, GLuint coords);
- void glMultiTexCoordP3uiv(GLenum texture, GLenum type, const GLuint *coords);
- void glMultiTexCoordP3ui(GLenum texture, GLenum type, GLuint coords);
- void glMultiTexCoordP2uiv(GLenum texture, GLenum type, const GLuint *coords);
- void glMultiTexCoordP2ui(GLenum texture, GLenum type, GLuint coords);
- void glMultiTexCoordP1uiv(GLenum texture, GLenum type, const GLuint *coords);
- void glMultiTexCoordP1ui(GLenum texture, GLenum type, GLuint coords);
- void glTexCoordP4uiv(GLenum type, const GLuint *coords);
- void glTexCoordP4ui(GLenum type, GLuint coords);
- void glTexCoordP3uiv(GLenum type, const GLuint *coords);
- void glTexCoordP3ui(GLenum type, GLuint coords);
- void glTexCoordP2uiv(GLenum type, const GLuint *coords);
- void glTexCoordP2ui(GLenum type, GLuint coords);
- void glTexCoordP1uiv(GLenum type, const GLuint *coords);
- void glTexCoordP1ui(GLenum type, GLuint coords);
- void glVertexP4uiv(GLenum type, const GLuint *value);
- void glVertexP4ui(GLenum type, GLuint value);
- void glVertexP3uiv(GLenum type, const GLuint *value);
- void glVertexP3ui(GLenum type, GLuint value);
- void glVertexP2uiv(GLenum type, const GLuint *value);
- void glVertexP2ui(GLenum type, GLuint value);
- void glGetQueryObjectui64v(GLuint id, GLenum pname, GLuint64 *params);
- void glGetQueryObjecti64v(GLuint id, GLenum pname, GLint64 *params);
- void glQueryCounter(GLuint id, GLenum target);
- void glGetSamplerParameterIuiv(GLuint sampler, GLenum pname, GLuint *params);
- void glGetSamplerParameterfv(GLuint sampler, GLenum pname, GLfloat *params);
- void glGetSamplerParameterIiv(GLuint sampler, GLenum pname, GLint *params);
- void glGetSamplerParameteriv(GLuint sampler, GLenum pname, GLint *params);
- void glSamplerParameterIuiv(GLuint sampler, GLenum pname, const GLuint *param);
- void glSamplerParameterIiv(GLuint sampler, GLenum pname, const GLint *param);
- void glSamplerParameterfv(GLuint sampler, GLenum pname, const GLfloat *param);
- void glSamplerParameterf(GLuint sampler, GLenum pname, GLfloat param);
- void glSamplerParameteriv(GLuint sampler, GLenum pname, const GLint *param);
- void glSamplerParameteri(GLuint sampler, GLenum pname, GLint param);
- void glBindSampler(GLuint unit, GLuint sampler);
- GLboolean glIsSampler(GLuint sampler);
- void glDeleteSamplers(GLsizei count, const GLuint *samplers);
- void glGenSamplers(GLsizei count, GLuint *samplers);
- GLint glGetFragDataIndex(GLuint program, const GLchar *name);
- void glBindFragDataLocationIndexed(GLuint program, GLuint colorNumber, GLuint index, const GLchar *name);
- void glVertexAttribDivisor(GLuint index, GLuint divisor);
-
- // OpenGL 4.0 core functions
- void glGetQueryIndexediv(GLenum target, GLuint index, GLenum pname, GLint *params);
- void glEndQueryIndexed(GLenum target, GLuint index);
- void glBeginQueryIndexed(GLenum target, GLuint index, GLuint id);
- void glDrawTransformFeedbackStream(GLenum mode, GLuint id, GLuint stream);
- void glDrawTransformFeedback(GLenum mode, GLuint id);
- void glResumeTransformFeedback();
- void glPauseTransformFeedback();
- GLboolean glIsTransformFeedback(GLuint id);
- void glGenTransformFeedbacks(GLsizei n, GLuint *ids);
- void glDeleteTransformFeedbacks(GLsizei n, const GLuint *ids);
- void glBindTransformFeedback(GLenum target, GLuint id);
- void glPatchParameterfv(GLenum pname, const GLfloat *values);
- void glPatchParameteri(GLenum pname, GLint value);
- void glGetProgramStageiv(GLuint program, GLenum shadertype, GLenum pname, GLint *values);
- void glGetUniformSubroutineuiv(GLenum shadertype, GLint location, GLuint *params);
- void glUniformSubroutinesuiv(GLenum shadertype, GLsizei count, const GLuint *indices);
- void glGetActiveSubroutineName(GLuint program, GLenum shadertype, GLuint index, GLsizei bufsize, GLsizei *length, GLchar *name);
- void glGetActiveSubroutineUniformName(GLuint program, GLenum shadertype, GLuint index, GLsizei bufsize, GLsizei *length, GLchar *name);
- void glGetActiveSubroutineUniformiv(GLuint program, GLenum shadertype, GLuint index, GLenum pname, GLint *values);
- GLuint glGetSubroutineIndex(GLuint program, GLenum shadertype, const GLchar *name);
- GLint glGetSubroutineUniformLocation(GLuint program, GLenum shadertype, const GLchar *name);
- void glGetUniformdv(GLuint program, GLint location, GLdouble *params);
- void glUniformMatrix4x3dv(GLint location, GLsizei count, GLboolean transpose, const GLdouble *value);
- void glUniformMatrix4x2dv(GLint location, GLsizei count, GLboolean transpose, const GLdouble *value);
- void glUniformMatrix3x4dv(GLint location, GLsizei count, GLboolean transpose, const GLdouble *value);
- void glUniformMatrix3x2dv(GLint location, GLsizei count, GLboolean transpose, const GLdouble *value);
- void glUniformMatrix2x4dv(GLint location, GLsizei count, GLboolean transpose, const GLdouble *value);
- void glUniformMatrix2x3dv(GLint location, GLsizei count, GLboolean transpose, const GLdouble *value);
- void glUniformMatrix4dv(GLint location, GLsizei count, GLboolean transpose, const GLdouble *value);
- void glUniformMatrix3dv(GLint location, GLsizei count, GLboolean transpose, const GLdouble *value);
- void glUniformMatrix2dv(GLint location, GLsizei count, GLboolean transpose, const GLdouble *value);
- void glUniform4dv(GLint location, GLsizei count, const GLdouble *value);
- void glUniform3dv(GLint location, GLsizei count, const GLdouble *value);
- void glUniform2dv(GLint location, GLsizei count, const GLdouble *value);
- void glUniform1dv(GLint location, GLsizei count, const GLdouble *value);
- void glUniform4d(GLint location, GLdouble x, GLdouble y, GLdouble z, GLdouble w);
- void glUniform3d(GLint location, GLdouble x, GLdouble y, GLdouble z);
- void glUniform2d(GLint location, GLdouble x, GLdouble y);
- void glUniform1d(GLint location, GLdouble x);
- void glDrawElementsIndirect(GLenum mode, GLenum type, const GLvoid *indirect);
- void glDrawArraysIndirect(GLenum mode, const GLvoid *indirect);
- void glBlendFuncSeparatei(GLuint buf, GLenum srcRGB, GLenum dstRGB, GLenum srcAlpha, GLenum dstAlpha);
- void glBlendFunci(GLuint buf, GLenum src, GLenum dst);
- void glBlendEquationSeparatei(GLuint buf, GLenum modeRGB, GLenum modeAlpha);
- void glBlendEquationi(GLuint buf, GLenum mode);
- void glMinSampleShading(GLfloat value);
-
- // OpenGL 4.1 core functions
- void glGetDoublei_v(GLenum target, GLuint index, GLdouble *data);
- void glGetFloati_v(GLenum target, GLuint index, GLfloat *data);
- void glDepthRangeIndexed(GLuint index, GLdouble n, GLdouble f);
- void glDepthRangeArrayv(GLuint first, GLsizei count, const GLdouble *v);
- void glScissorIndexedv(GLuint index, const GLint *v);
- void glScissorIndexed(GLuint index, GLint left, GLint bottom, GLsizei width, GLsizei height);
- void glScissorArrayv(GLuint first, GLsizei count, const GLint *v);
- void glViewportIndexedfv(GLuint index, const GLfloat *v);
- void glViewportIndexedf(GLuint index, GLfloat x, GLfloat y, GLfloat w, GLfloat h);
- void glViewportArrayv(GLuint first, GLsizei count, const GLfloat *v);
- void glGetVertexAttribLdv(GLuint index, GLenum pname, GLdouble *params);
- void glVertexAttribLPointer(GLuint index, GLint size, GLenum type, GLsizei stride, const GLvoid *pointer);
- void glVertexAttribL4dv(GLuint index, const GLdouble *v);
- void glVertexAttribL3dv(GLuint index, const GLdouble *v);
- void glVertexAttribL2dv(GLuint index, const GLdouble *v);
- void glVertexAttribL1dv(GLuint index, const GLdouble *v);
- void glVertexAttribL4d(GLuint index, GLdouble x, GLdouble y, GLdouble z, GLdouble w);
- void glVertexAttribL3d(GLuint index, GLdouble x, GLdouble y, GLdouble z);
- void glVertexAttribL2d(GLuint index, GLdouble x, GLdouble y);
- void glVertexAttribL1d(GLuint index, GLdouble x);
- void glGetProgramPipelineInfoLog(GLuint pipeline, GLsizei bufSize, GLsizei *length, GLchar *infoLog);
- void glValidateProgramPipeline(GLuint pipeline);
- void glProgramUniformMatrix4x3dv(GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLdouble *value);
- void glProgramUniformMatrix3x4dv(GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLdouble *value);
- void glProgramUniformMatrix4x2dv(GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLdouble *value);
- void glProgramUniformMatrix2x4dv(GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLdouble *value);
- void glProgramUniformMatrix3x2dv(GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLdouble *value);
- void glProgramUniformMatrix2x3dv(GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLdouble *value);
- void glProgramUniformMatrix4x3fv(GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
- void glProgramUniformMatrix3x4fv(GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
- void glProgramUniformMatrix4x2fv(GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
- void glProgramUniformMatrix2x4fv(GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
- void glProgramUniformMatrix3x2fv(GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
- void glProgramUniformMatrix2x3fv(GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
- void glProgramUniformMatrix4dv(GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLdouble *value);
- void glProgramUniformMatrix3dv(GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLdouble *value);
- void glProgramUniformMatrix2dv(GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLdouble *value);
- void glProgramUniformMatrix4fv(GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
- void glProgramUniformMatrix3fv(GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
- void glProgramUniformMatrix2fv(GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
- void glProgramUniform4uiv(GLuint program, GLint location, GLsizei count, const GLuint *value);
- void glProgramUniform4ui(GLuint program, GLint location, GLuint v0, GLuint v1, GLuint v2, GLuint v3);
- void glProgramUniform4dv(GLuint program, GLint location, GLsizei count, const GLdouble *value);
- void glProgramUniform4d(GLuint program, GLint location, GLdouble v0, GLdouble v1, GLdouble v2, GLdouble v3);
- void glProgramUniform4fv(GLuint program, GLint location, GLsizei count, const GLfloat *value);
- void glProgramUniform4f(GLuint program, GLint location, GLfloat v0, GLfloat v1, GLfloat v2, GLfloat v3);
- void glProgramUniform4iv(GLuint program, GLint location, GLsizei count, const GLint *value);
- void glProgramUniform4i(GLuint program, GLint location, GLint v0, GLint v1, GLint v2, GLint v3);
- void glProgramUniform3uiv(GLuint program, GLint location, GLsizei count, const GLuint *value);
- void glProgramUniform3ui(GLuint program, GLint location, GLuint v0, GLuint v1, GLuint v2);
- void glProgramUniform3dv(GLuint program, GLint location, GLsizei count, const GLdouble *value);
- void glProgramUniform3d(GLuint program, GLint location, GLdouble v0, GLdouble v1, GLdouble v2);
- void glProgramUniform3fv(GLuint program, GLint location, GLsizei count, const GLfloat *value);
- void glProgramUniform3f(GLuint program, GLint location, GLfloat v0, GLfloat v1, GLfloat v2);
- void glProgramUniform3iv(GLuint program, GLint location, GLsizei count, const GLint *value);
- void glProgramUniform3i(GLuint program, GLint location, GLint v0, GLint v1, GLint v2);
- void glProgramUniform2uiv(GLuint program, GLint location, GLsizei count, const GLuint *value);
- void glProgramUniform2ui(GLuint program, GLint location, GLuint v0, GLuint v1);
- void glProgramUniform2dv(GLuint program, GLint location, GLsizei count, const GLdouble *value);
- void glProgramUniform2d(GLuint program, GLint location, GLdouble v0, GLdouble v1);
- void glProgramUniform2fv(GLuint program, GLint location, GLsizei count, const GLfloat *value);
- void glProgramUniform2f(GLuint program, GLint location, GLfloat v0, GLfloat v1);
- void glProgramUniform2iv(GLuint program, GLint location, GLsizei count, const GLint *value);
- void glProgramUniform2i(GLuint program, GLint location, GLint v0, GLint v1);
- void glProgramUniform1uiv(GLuint program, GLint location, GLsizei count, const GLuint *value);
- void glProgramUniform1ui(GLuint program, GLint location, GLuint v0);
- void glProgramUniform1dv(GLuint program, GLint location, GLsizei count, const GLdouble *value);
- void glProgramUniform1d(GLuint program, GLint location, GLdouble v0);
- void glProgramUniform1fv(GLuint program, GLint location, GLsizei count, const GLfloat *value);
- void glProgramUniform1f(GLuint program, GLint location, GLfloat v0);
- void glProgramUniform1iv(GLuint program, GLint location, GLsizei count, const GLint *value);
- void glProgramUniform1i(GLuint program, GLint location, GLint v0);
- void glGetProgramPipelineiv(GLuint pipeline, GLenum pname, GLint *params);
- GLboolean glIsProgramPipeline(GLuint pipeline);
- void glGenProgramPipelines(GLsizei n, GLuint *pipelines);
- void glDeleteProgramPipelines(GLsizei n, const GLuint *pipelines);
- void glBindProgramPipeline(GLuint pipeline);
- GLuint glCreateShaderProgramv(GLenum type, GLsizei count, const GLchar* const *strings);
- void glActiveShaderProgram(GLuint pipeline, GLuint program);
- void glUseProgramStages(GLuint pipeline, GLbitfield stages, GLuint program);
- void glProgramParameteri(GLuint program, GLenum pname, GLint value);
- void glProgramBinary(GLuint program, GLenum binaryFormat, const GLvoid *binary, GLsizei length);
- void glGetProgramBinary(GLuint program, GLsizei bufSize, GLsizei *length, GLenum *binaryFormat, GLvoid *binary);
- void glClearDepthf(GLfloat dd);
- void glDepthRangef(GLfloat n, GLfloat f);
- void glGetShaderPrecisionFormat(GLenum shadertype, GLenum precisiontype, GLint *range, GLint *precision);
- void glShaderBinary(GLsizei count, const GLuint *shaders, GLenum binaryformat, const GLvoid *binary, GLsizei length);
- void glReleaseShaderCompiler();
-
- // OpenGL 1.0 deprecated functions
- void glTranslatef(GLfloat x, GLfloat y, GLfloat z);
- void glTranslated(GLdouble x, GLdouble y, GLdouble z);
- void glScalef(GLfloat x, GLfloat y, GLfloat z);
- void glScaled(GLdouble x, GLdouble y, GLdouble z);
- void glRotatef(GLfloat angle, GLfloat x, GLfloat y, GLfloat z);
- void glRotated(GLdouble angle, GLdouble x, GLdouble y, GLdouble z);
- void glPushMatrix();
- void glPopMatrix();
- void glOrtho(GLdouble left, GLdouble right, GLdouble bottom, GLdouble top, GLdouble zNear, GLdouble zFar);
- void glMultMatrixd(const GLdouble *m);
- void glMultMatrixf(const GLfloat *m);
- void glMatrixMode(GLenum mode);
- void glLoadMatrixd(const GLdouble *m);
- void glLoadMatrixf(const GLfloat *m);
- void glLoadIdentity();
- void glFrustum(GLdouble left, GLdouble right, GLdouble bottom, GLdouble top, GLdouble zNear, GLdouble zFar);
- GLboolean glIsList(GLuint list);
- void glGetTexGeniv(GLenum coord, GLenum pname, GLint *params);
- void glGetTexGenfv(GLenum coord, GLenum pname, GLfloat *params);
- void glGetTexGendv(GLenum coord, GLenum pname, GLdouble *params);
- void glGetTexEnviv(GLenum target, GLenum pname, GLint *params);
- void glGetTexEnvfv(GLenum target, GLenum pname, GLfloat *params);
- void glGetPolygonStipple(GLubyte *mask);
- void glGetPixelMapusv(GLenum map, GLushort *values);
- void glGetPixelMapuiv(GLenum map, GLuint *values);
- void glGetPixelMapfv(GLenum map, GLfloat *values);
- void glGetMaterialiv(GLenum face, GLenum pname, GLint *params);
- void glGetMaterialfv(GLenum face, GLenum pname, GLfloat *params);
- void glGetMapiv(GLenum target, GLenum query, GLint *v);
- void glGetMapfv(GLenum target, GLenum query, GLfloat *v);
- void glGetMapdv(GLenum target, GLenum query, GLdouble *v);
- void glGetLightiv(GLenum light, GLenum pname, GLint *params);
- void glGetLightfv(GLenum light, GLenum pname, GLfloat *params);
- void glGetClipPlane(GLenum plane, GLdouble *equation);
- void glDrawPixels(GLsizei width, GLsizei height, GLenum format, GLenum type, const GLvoid *pixels);
- void glCopyPixels(GLint x, GLint y, GLsizei width, GLsizei height, GLenum type);
- void glPixelMapusv(GLenum map, GLint mapsize, const GLushort *values);
- void glPixelMapuiv(GLenum map, GLint mapsize, const GLuint *values);
- void glPixelMapfv(GLenum map, GLint mapsize, const GLfloat *values);
- void glPixelTransferi(GLenum pname, GLint param);
- void glPixelTransferf(GLenum pname, GLfloat param);
- void glPixelZoom(GLfloat xfactor, GLfloat yfactor);
- void glAlphaFunc(GLenum func, GLfloat ref);
- void glEvalPoint2(GLint i, GLint j);
- void glEvalMesh2(GLenum mode, GLint i1, GLint i2, GLint j1, GLint j2);
- void glEvalPoint1(GLint i);
- void glEvalMesh1(GLenum mode, GLint i1, GLint i2);
- void glEvalCoord2fv(const GLfloat *u);
- void glEvalCoord2f(GLfloat u, GLfloat v);
- void glEvalCoord2dv(const GLdouble *u);
- void glEvalCoord2d(GLdouble u, GLdouble v);
- void glEvalCoord1fv(const GLfloat *u);
- void glEvalCoord1f(GLfloat u);
- void glEvalCoord1dv(const GLdouble *u);
- void glEvalCoord1d(GLdouble u);
- void glMapGrid2f(GLint un, GLfloat u1, GLfloat u2, GLint vn, GLfloat v1, GLfloat v2);
- void glMapGrid2d(GLint un, GLdouble u1, GLdouble u2, GLint vn, GLdouble v1, GLdouble v2);
- void glMapGrid1f(GLint un, GLfloat u1, GLfloat u2);
- void glMapGrid1d(GLint un, GLdouble u1, GLdouble u2);
- void glMap2f(GLenum target, GLfloat u1, GLfloat u2, GLint ustride, GLint uorder, GLfloat v1, GLfloat v2, GLint vstride, GLint vorder, const GLfloat *points);
- void glMap2d(GLenum target, GLdouble u1, GLdouble u2, GLint ustride, GLint uorder, GLdouble v1, GLdouble v2, GLint vstride, GLint vorder, const GLdouble *points);
- void glMap1f(GLenum target, GLfloat u1, GLfloat u2, GLint stride, GLint order, const GLfloat *points);
- void glMap1d(GLenum target, GLdouble u1, GLdouble u2, GLint stride, GLint order, const GLdouble *points);
- void glPushAttrib(GLbitfield mask);
- void glPopAttrib();
- void glAccum(GLenum op, GLfloat value);
- void glIndexMask(GLuint mask);
- void glClearIndex(GLfloat c);
- void glClearAccum(GLfloat red, GLfloat green, GLfloat blue, GLfloat alpha);
- void glPushName(GLuint name);
- void glPopName();
- void glPassThrough(GLfloat token);
- void glLoadName(GLuint name);
- void glInitNames();
- GLint glRenderMode(GLenum mode);
- void glSelectBuffer(GLsizei size, GLuint *buffer);
- void glFeedbackBuffer(GLsizei size, GLenum type, GLfloat *buffer);
- void glTexGeniv(GLenum coord, GLenum pname, const GLint *params);
- void glTexGeni(GLenum coord, GLenum pname, GLint param);
- void glTexGenfv(GLenum coord, GLenum pname, const GLfloat *params);
- void glTexGenf(GLenum coord, GLenum pname, GLfloat param);
- void glTexGendv(GLenum coord, GLenum pname, const GLdouble *params);
- void glTexGend(GLenum coord, GLenum pname, GLdouble param);
- void glTexEnviv(GLenum target, GLenum pname, const GLint *params);
- void glTexEnvi(GLenum target, GLenum pname, GLint param);
- void glTexEnvfv(GLenum target, GLenum pname, const GLfloat *params);
- void glTexEnvf(GLenum target, GLenum pname, GLfloat param);
- void glShadeModel(GLenum mode);
- void glPolygonStipple(const GLubyte *mask);
- void glMaterialiv(GLenum face, GLenum pname, const GLint *params);
- void glMateriali(GLenum face, GLenum pname, GLint param);
- void glMaterialfv(GLenum face, GLenum pname, const GLfloat *params);
- void glMaterialf(GLenum face, GLenum pname, GLfloat param);
- void glLineStipple(GLint factor, GLushort pattern);
- void glLightModeliv(GLenum pname, const GLint *params);
- void glLightModeli(GLenum pname, GLint param);
- void glLightModelfv(GLenum pname, const GLfloat *params);
- void glLightModelf(GLenum pname, GLfloat param);
- void glLightiv(GLenum light, GLenum pname, const GLint *params);
- void glLighti(GLenum light, GLenum pname, GLint param);
- void glLightfv(GLenum light, GLenum pname, const GLfloat *params);
- void glLightf(GLenum light, GLenum pname, GLfloat param);
- void glFogiv(GLenum pname, const GLint *params);
- void glFogi(GLenum pname, GLint param);
- void glFogfv(GLenum pname, const GLfloat *params);
- void glFogf(GLenum pname, GLfloat param);
- void glColorMaterial(GLenum face, GLenum mode);
- void glClipPlane(GLenum plane, const GLdouble *equation);
- void glVertex4sv(const GLshort *v);
- void glVertex4s(GLshort x, GLshort y, GLshort z, GLshort w);
- void glVertex4iv(const GLint *v);
- void glVertex4i(GLint x, GLint y, GLint z, GLint w);
- void glVertex4fv(const GLfloat *v);
- void glVertex4f(GLfloat x, GLfloat y, GLfloat z, GLfloat w);
- void glVertex4dv(const GLdouble *v);
- void glVertex4d(GLdouble x, GLdouble y, GLdouble z, GLdouble w);
- void glVertex3sv(const GLshort *v);
- void glVertex3s(GLshort x, GLshort y, GLshort z);
- void glVertex3iv(const GLint *v);
- void glVertex3i(GLint x, GLint y, GLint z);
- void glVertex3fv(const GLfloat *v);
- void glVertex3f(GLfloat x, GLfloat y, GLfloat z);
- void glVertex3dv(const GLdouble *v);
- void glVertex3d(GLdouble x, GLdouble y, GLdouble z);
- void glVertex2sv(const GLshort *v);
- void glVertex2s(GLshort x, GLshort y);
- void glVertex2iv(const GLint *v);
- void glVertex2i(GLint x, GLint y);
- void glVertex2fv(const GLfloat *v);
- void glVertex2f(GLfloat x, GLfloat y);
- void glVertex2dv(const GLdouble *v);
- void glVertex2d(GLdouble x, GLdouble y);
- void glTexCoord4sv(const GLshort *v);
- void glTexCoord4s(GLshort s, GLshort t, GLshort r, GLshort q);
- void glTexCoord4iv(const GLint *v);
- void glTexCoord4i(GLint s, GLint t, GLint r, GLint q);
- void glTexCoord4fv(const GLfloat *v);
- void glTexCoord4f(GLfloat s, GLfloat t, GLfloat r, GLfloat q);
- void glTexCoord4dv(const GLdouble *v);
- void glTexCoord4d(GLdouble s, GLdouble t, GLdouble r, GLdouble q);
- void glTexCoord3sv(const GLshort *v);
- void glTexCoord3s(GLshort s, GLshort t, GLshort r);
- void glTexCoord3iv(const GLint *v);
- void glTexCoord3i(GLint s, GLint t, GLint r);
- void glTexCoord3fv(const GLfloat *v);
- void glTexCoord3f(GLfloat s, GLfloat t, GLfloat r);
- void glTexCoord3dv(const GLdouble *v);
- void glTexCoord3d(GLdouble s, GLdouble t, GLdouble r);
- void glTexCoord2sv(const GLshort *v);
- void glTexCoord2s(GLshort s, GLshort t);
- void glTexCoord2iv(const GLint *v);
- void glTexCoord2i(GLint s, GLint t);
- void glTexCoord2fv(const GLfloat *v);
- void glTexCoord2f(GLfloat s, GLfloat t);
- void glTexCoord2dv(const GLdouble *v);
- void glTexCoord2d(GLdouble s, GLdouble t);
- void glTexCoord1sv(const GLshort *v);
- void glTexCoord1s(GLshort s);
- void glTexCoord1iv(const GLint *v);
- void glTexCoord1i(GLint s);
- void glTexCoord1fv(const GLfloat *v);
- void glTexCoord1f(GLfloat s);
- void glTexCoord1dv(const GLdouble *v);
- void glTexCoord1d(GLdouble s);
- void glRectsv(const GLshort *v1, const GLshort *v2);
- void glRects(GLshort x1, GLshort y1, GLshort x2, GLshort y2);
- void glRectiv(const GLint *v1, const GLint *v2);
- void glRecti(GLint x1, GLint y1, GLint x2, GLint y2);
- void glRectfv(const GLfloat *v1, const GLfloat *v2);
- void glRectf(GLfloat x1, GLfloat y1, GLfloat x2, GLfloat y2);
- void glRectdv(const GLdouble *v1, const GLdouble *v2);
- void glRectd(GLdouble x1, GLdouble y1, GLdouble x2, GLdouble y2);
- void glRasterPos4sv(const GLshort *v);
- void glRasterPos4s(GLshort x, GLshort y, GLshort z, GLshort w);
- void glRasterPos4iv(const GLint *v);
- void glRasterPos4i(GLint x, GLint y, GLint z, GLint w);
- void glRasterPos4fv(const GLfloat *v);
- void glRasterPos4f(GLfloat x, GLfloat y, GLfloat z, GLfloat w);
- void glRasterPos4dv(const GLdouble *v);
- void glRasterPos4d(GLdouble x, GLdouble y, GLdouble z, GLdouble w);
- void glRasterPos3sv(const GLshort *v);
- void glRasterPos3s(GLshort x, GLshort y, GLshort z);
- void glRasterPos3iv(const GLint *v);
- void glRasterPos3i(GLint x, GLint y, GLint z);
- void glRasterPos3fv(const GLfloat *v);
- void glRasterPos3f(GLfloat x, GLfloat y, GLfloat z);
- void glRasterPos3dv(const GLdouble *v);
- void glRasterPos3d(GLdouble x, GLdouble y, GLdouble z);
- void glRasterPos2sv(const GLshort *v);
- void glRasterPos2s(GLshort x, GLshort y);
- void glRasterPos2iv(const GLint *v);
- void glRasterPos2i(GLint x, GLint y);
- void glRasterPos2fv(const GLfloat *v);
- void glRasterPos2f(GLfloat x, GLfloat y);
- void glRasterPos2dv(const GLdouble *v);
- void glRasterPos2d(GLdouble x, GLdouble y);
- void glNormal3sv(const GLshort *v);
- void glNormal3s(GLshort nx, GLshort ny, GLshort nz);
- void glNormal3iv(const GLint *v);
- void glNormal3i(GLint nx, GLint ny, GLint nz);
- void glNormal3fv(const GLfloat *v);
- void glNormal3f(GLfloat nx, GLfloat ny, GLfloat nz);
- void glNormal3dv(const GLdouble *v);
- void glNormal3d(GLdouble nx, GLdouble ny, GLdouble nz);
- void glNormal3bv(const GLbyte *v);
- void glNormal3b(GLbyte nx, GLbyte ny, GLbyte nz);
- void glIndexsv(const GLshort *c);
- void glIndexs(GLshort c);
- void glIndexiv(const GLint *c);
- void glIndexi(GLint c);
- void glIndexfv(const GLfloat *c);
- void glIndexf(GLfloat c);
- void glIndexdv(const GLdouble *c);
- void glIndexd(GLdouble c);
- void glEnd();
- void glEdgeFlagv(const GLboolean *flag);
- void glEdgeFlag(GLboolean flag);
- void glColor4usv(const GLushort *v);
- void glColor4us(GLushort red, GLushort green, GLushort blue, GLushort alpha);
- void glColor4uiv(const GLuint *v);
- void glColor4ui(GLuint red, GLuint green, GLuint blue, GLuint alpha);
- void glColor4ubv(const GLubyte *v);
- void glColor4ub(GLubyte red, GLubyte green, GLubyte blue, GLubyte alpha);
- void glColor4sv(const GLshort *v);
- void glColor4s(GLshort red, GLshort green, GLshort blue, GLshort alpha);
- void glColor4iv(const GLint *v);
- void glColor4i(GLint red, GLint green, GLint blue, GLint alpha);
- void glColor4fv(const GLfloat *v);
- void glColor4f(GLfloat red, GLfloat green, GLfloat blue, GLfloat alpha);
- void glColor4dv(const GLdouble *v);
- void glColor4d(GLdouble red, GLdouble green, GLdouble blue, GLdouble alpha);
- void glColor4bv(const GLbyte *v);
- void glColor4b(GLbyte red, GLbyte green, GLbyte blue, GLbyte alpha);
- void glColor3usv(const GLushort *v);
- void glColor3us(GLushort red, GLushort green, GLushort blue);
- void glColor3uiv(const GLuint *v);
- void glColor3ui(GLuint red, GLuint green, GLuint blue);
- void glColor3ubv(const GLubyte *v);
- void glColor3ub(GLubyte red, GLubyte green, GLubyte blue);
- void glColor3sv(const GLshort *v);
- void glColor3s(GLshort red, GLshort green, GLshort blue);
- void glColor3iv(const GLint *v);
- void glColor3i(GLint red, GLint green, GLint blue);
- void glColor3fv(const GLfloat *v);
- void glColor3f(GLfloat red, GLfloat green, GLfloat blue);
- void glColor3dv(const GLdouble *v);
- void glColor3d(GLdouble red, GLdouble green, GLdouble blue);
- void glColor3bv(const GLbyte *v);
- void glColor3b(GLbyte red, GLbyte green, GLbyte blue);
- void glBitmap(GLsizei width, GLsizei height, GLfloat xorig, GLfloat yorig, GLfloat xmove, GLfloat ymove, const GLubyte *bitmap);
- void glBegin(GLenum mode);
- void glListBase(GLuint base);
- GLuint glGenLists(GLsizei range);
- void glDeleteLists(GLuint list, GLsizei range);
- void glCallLists(GLsizei n, GLenum type, const GLvoid *lists);
- void glCallList(GLuint list);
- void glEndList();
- void glNewList(GLuint list, GLenum mode);
-
- // OpenGL 1.1 deprecated functions
- void glPushClientAttrib(GLbitfield mask);
- void glPopClientAttrib();
- void glPrioritizeTextures(GLsizei n, const GLuint *textures, const GLfloat *priorities);
- GLboolean glAreTexturesResident(GLsizei n, const GLuint *textures, GLboolean *residences);
- void glVertexPointer(GLint size, GLenum type, GLsizei stride, const GLvoid *pointer);
- void glTexCoordPointer(GLint size, GLenum type, GLsizei stride, const GLvoid *pointer);
- void glNormalPointer(GLenum type, GLsizei stride, const GLvoid *pointer);
- void glInterleavedArrays(GLenum format, GLsizei stride, const GLvoid *pointer);
- void glIndexPointer(GLenum type, GLsizei stride, const GLvoid *pointer);
- void glEnableClientState(GLenum array);
- void glEdgeFlagPointer(GLsizei stride, const GLvoid *pointer);
- void glDisableClientState(GLenum array);
- void glColorPointer(GLint size, GLenum type, GLsizei stride, const GLvoid *pointer);
- void glArrayElement(GLint i);
-
- // OpenGL 1.2 deprecated functions
- void glResetMinmax(GLenum target);
- void glResetHistogram(GLenum target);
- void glMinmax(GLenum target, GLenum internalformat, GLboolean sink);
- void glHistogram(GLenum target, GLsizei width, GLenum internalformat, GLboolean sink);
- void glGetMinmaxParameteriv(GLenum target, GLenum pname, GLint *params);
- void glGetMinmaxParameterfv(GLenum target, GLenum pname, GLfloat *params);
- void glGetMinmax(GLenum target, GLboolean reset, GLenum format, GLenum type, GLvoid *values);
- void glGetHistogramParameteriv(GLenum target, GLenum pname, GLint *params);
- void glGetHistogramParameterfv(GLenum target, GLenum pname, GLfloat *params);
- void glGetHistogram(GLenum target, GLboolean reset, GLenum format, GLenum type, GLvoid *values);
- void glSeparableFilter2D(GLenum target, GLenum internalformat, GLsizei width, GLsizei height, GLenum format, GLenum type, const GLvoid *row, const GLvoid *column);
- void glGetSeparableFilter(GLenum target, GLenum format, GLenum type, GLvoid *row, GLvoid *column, GLvoid *span);
- void glGetConvolutionParameteriv(GLenum target, GLenum pname, GLint *params);
- void glGetConvolutionParameterfv(GLenum target, GLenum pname, GLfloat *params);
- void glGetConvolutionFilter(GLenum target, GLenum format, GLenum type, GLvoid *image);
- void glCopyConvolutionFilter2D(GLenum target, GLenum internalformat, GLint x, GLint y, GLsizei width, GLsizei height);
- void glCopyConvolutionFilter1D(GLenum target, GLenum internalformat, GLint x, GLint y, GLsizei width);
- void glConvolutionParameteriv(GLenum target, GLenum pname, const GLint *params);
- void glConvolutionParameteri(GLenum target, GLenum pname, GLint params);
- void glConvolutionParameterfv(GLenum target, GLenum pname, const GLfloat *params);
- void glConvolutionParameterf(GLenum target, GLenum pname, GLfloat params);
- void glConvolutionFilter2D(GLenum target, GLenum internalformat, GLsizei width, GLsizei height, GLenum format, GLenum type, const GLvoid *image);
- void glConvolutionFilter1D(GLenum target, GLenum internalformat, GLsizei width, GLenum format, GLenum type, const GLvoid *image);
- void glCopyColorSubTable(GLenum target, GLsizei start, GLint x, GLint y, GLsizei width);
- void glColorSubTable(GLenum target, GLsizei start, GLsizei count, GLenum format, GLenum type, const GLvoid *data);
- void glGetColorTableParameteriv(GLenum target, GLenum pname, GLint *params);
- void glGetColorTableParameterfv(GLenum target, GLenum pname, GLfloat *params);
- void glGetColorTable(GLenum target, GLenum format, GLenum type, GLvoid *table);
- void glCopyColorTable(GLenum target, GLenum internalformat, GLint x, GLint y, GLsizei width);
- void glColorTableParameteriv(GLenum target, GLenum pname, const GLint *params);
- void glColorTableParameterfv(GLenum target, GLenum pname, const GLfloat *params);
- void glColorTable(GLenum target, GLenum internalformat, GLsizei width, GLenum format, GLenum type, const GLvoid *table);
-
- // OpenGL 1.3 deprecated functions
- void glMultTransposeMatrixd(const GLdouble *m);
- void glMultTransposeMatrixf(const GLfloat *m);
- void glLoadTransposeMatrixd(const GLdouble *m);
- void glLoadTransposeMatrixf(const GLfloat *m);
- void glMultiTexCoord4sv(GLenum target, const GLshort *v);
- void glMultiTexCoord4s(GLenum target, GLshort s, GLshort t, GLshort r, GLshort q);
- void glMultiTexCoord4iv(GLenum target, const GLint *v);
- void glMultiTexCoord4i(GLenum target, GLint s, GLint t, GLint r, GLint q);
- void glMultiTexCoord4fv(GLenum target, const GLfloat *v);
- void glMultiTexCoord4f(GLenum target, GLfloat s, GLfloat t, GLfloat r, GLfloat q);
- void glMultiTexCoord4dv(GLenum target, const GLdouble *v);
- void glMultiTexCoord4d(GLenum target, GLdouble s, GLdouble t, GLdouble r, GLdouble q);
- void glMultiTexCoord3sv(GLenum target, const GLshort *v);
- void glMultiTexCoord3s(GLenum target, GLshort s, GLshort t, GLshort r);
- void glMultiTexCoord3iv(GLenum target, const GLint *v);
- void glMultiTexCoord3i(GLenum target, GLint s, GLint t, GLint r);
- void glMultiTexCoord3fv(GLenum target, const GLfloat *v);
- void glMultiTexCoord3f(GLenum target, GLfloat s, GLfloat t, GLfloat r);
- void glMultiTexCoord3dv(GLenum target, const GLdouble *v);
- void glMultiTexCoord3d(GLenum target, GLdouble s, GLdouble t, GLdouble r);
- void glMultiTexCoord2sv(GLenum target, const GLshort *v);
- void glMultiTexCoord2s(GLenum target, GLshort s, GLshort t);
- void glMultiTexCoord2iv(GLenum target, const GLint *v);
- void glMultiTexCoord2i(GLenum target, GLint s, GLint t);
- void glMultiTexCoord2fv(GLenum target, const GLfloat *v);
- void glMultiTexCoord2f(GLenum target, GLfloat s, GLfloat t);
- void glMultiTexCoord2dv(GLenum target, const GLdouble *v);
- void glMultiTexCoord2d(GLenum target, GLdouble s, GLdouble t);
- void glMultiTexCoord1sv(GLenum target, const GLshort *v);
- void glMultiTexCoord1s(GLenum target, GLshort s);
- void glMultiTexCoord1iv(GLenum target, const GLint *v);
- void glMultiTexCoord1i(GLenum target, GLint s);
- void glMultiTexCoord1fv(GLenum target, const GLfloat *v);
- void glMultiTexCoord1f(GLenum target, GLfloat s);
- void glMultiTexCoord1dv(GLenum target, const GLdouble *v);
- void glMultiTexCoord1d(GLenum target, GLdouble s);
- void glClientActiveTexture(GLenum texture);
-
- // OpenGL 1.4 deprecated functions
- void glWindowPos3sv(const GLshort *v);
- void glWindowPos3s(GLshort x, GLshort y, GLshort z);
- void glWindowPos3iv(const GLint *v);
- void glWindowPos3i(GLint x, GLint y, GLint z);
- void glWindowPos3fv(const GLfloat *v);
- void glWindowPos3f(GLfloat x, GLfloat y, GLfloat z);
- void glWindowPos3dv(const GLdouble *v);
- void glWindowPos3d(GLdouble x, GLdouble y, GLdouble z);
- void glWindowPos2sv(const GLshort *v);
- void glWindowPos2s(GLshort x, GLshort y);
- void glWindowPos2iv(const GLint *v);
- void glWindowPos2i(GLint x, GLint y);
- void glWindowPos2fv(const GLfloat *v);
- void glWindowPos2f(GLfloat x, GLfloat y);
- void glWindowPos2dv(const GLdouble *v);
- void glWindowPos2d(GLdouble x, GLdouble y);
- void glSecondaryColorPointer(GLint size, GLenum type, GLsizei stride, const GLvoid *pointer);
- void glSecondaryColor3usv(const GLushort *v);
- void glSecondaryColor3us(GLushort red, GLushort green, GLushort blue);
- void glSecondaryColor3uiv(const GLuint *v);
- void glSecondaryColor3ui(GLuint red, GLuint green, GLuint blue);
- void glSecondaryColor3ubv(const GLubyte *v);
- void glSecondaryColor3ub(GLubyte red, GLubyte green, GLubyte blue);
- void glSecondaryColor3sv(const GLshort *v);
- void glSecondaryColor3s(GLshort red, GLshort green, GLshort blue);
- void glSecondaryColor3iv(const GLint *v);
- void glSecondaryColor3i(GLint red, GLint green, GLint blue);
- void glSecondaryColor3fv(const GLfloat *v);
- void glSecondaryColor3f(GLfloat red, GLfloat green, GLfloat blue);
- void glSecondaryColor3dv(const GLdouble *v);
- void glSecondaryColor3d(GLdouble red, GLdouble green, GLdouble blue);
- void glSecondaryColor3bv(const GLbyte *v);
- void glSecondaryColor3b(GLbyte red, GLbyte green, GLbyte blue);
- void glFogCoordPointer(GLenum type, GLsizei stride, const GLvoid *pointer);
- void glFogCoorddv(const GLdouble *coord);
- void glFogCoordd(GLdouble coord);
- void glFogCoordfv(const GLfloat *coord);
- void glFogCoordf(GLfloat coord);
-
- // OpenGL 1.5 deprecated functions
-
- // OpenGL 2.0 deprecated functions
- void glVertexAttrib4usv(GLuint index, const GLushort *v);
- void glVertexAttrib4uiv(GLuint index, const GLuint *v);
- void glVertexAttrib4ubv(GLuint index, const GLubyte *v);
- void glVertexAttrib4sv(GLuint index, const GLshort *v);
- void glVertexAttrib4s(GLuint index, GLshort x, GLshort y, GLshort z, GLshort w);
- void glVertexAttrib4iv(GLuint index, const GLint *v);
- void glVertexAttrib4fv(GLuint index, const GLfloat *v);
- void glVertexAttrib4f(GLuint index, GLfloat x, GLfloat y, GLfloat z, GLfloat w);
- void glVertexAttrib4dv(GLuint index, const GLdouble *v);
- void glVertexAttrib4d(GLuint index, GLdouble x, GLdouble y, GLdouble z, GLdouble w);
- void glVertexAttrib4bv(GLuint index, const GLbyte *v);
- void glVertexAttrib4Nusv(GLuint index, const GLushort *v);
- void glVertexAttrib4Nuiv(GLuint index, const GLuint *v);
- void glVertexAttrib4Nubv(GLuint index, const GLubyte *v);
- void glVertexAttrib4Nub(GLuint index, GLubyte x, GLubyte y, GLubyte z, GLubyte w);
- void glVertexAttrib4Nsv(GLuint index, const GLshort *v);
- void glVertexAttrib4Niv(GLuint index, const GLint *v);
- void glVertexAttrib4Nbv(GLuint index, const GLbyte *v);
- void glVertexAttrib3sv(GLuint index, const GLshort *v);
- void glVertexAttrib3s(GLuint index, GLshort x, GLshort y, GLshort z);
- void glVertexAttrib3fv(GLuint index, const GLfloat *v);
- void glVertexAttrib3f(GLuint index, GLfloat x, GLfloat y, GLfloat z);
- void glVertexAttrib3dv(GLuint index, const GLdouble *v);
- void glVertexAttrib3d(GLuint index, GLdouble x, GLdouble y, GLdouble z);
- void glVertexAttrib2sv(GLuint index, const GLshort *v);
- void glVertexAttrib2s(GLuint index, GLshort x, GLshort y);
- void glVertexAttrib2fv(GLuint index, const GLfloat *v);
- void glVertexAttrib2f(GLuint index, GLfloat x, GLfloat y);
- void glVertexAttrib2dv(GLuint index, const GLdouble *v);
- void glVertexAttrib2d(GLuint index, GLdouble x, GLdouble y);
- void glVertexAttrib1sv(GLuint index, const GLshort *v);
- void glVertexAttrib1s(GLuint index, GLshort x);
- void glVertexAttrib1fv(GLuint index, const GLfloat *v);
- void glVertexAttrib1f(GLuint index, GLfloat x);
- void glVertexAttrib1dv(GLuint index, const GLdouble *v);
- void glVertexAttrib1d(GLuint index, GLdouble x);
-
- // OpenGL 2.1 deprecated functions
-
- // OpenGL 3.0 deprecated functions
- void glVertexAttribI4usv(GLuint index, const GLushort *v);
- void glVertexAttribI4ubv(GLuint index, const GLubyte *v);
- void glVertexAttribI4sv(GLuint index, const GLshort *v);
- void glVertexAttribI4bv(GLuint index, const GLbyte *v);
- void glVertexAttribI4uiv(GLuint index, const GLuint *v);
- void glVertexAttribI3uiv(GLuint index, const GLuint *v);
- void glVertexAttribI2uiv(GLuint index, const GLuint *v);
- void glVertexAttribI1uiv(GLuint index, const GLuint *v);
- void glVertexAttribI4iv(GLuint index, const GLint *v);
- void glVertexAttribI3iv(GLuint index, const GLint *v);
- void glVertexAttribI2iv(GLuint index, const GLint *v);
- void glVertexAttribI1iv(GLuint index, const GLint *v);
- void glVertexAttribI4ui(GLuint index, GLuint x, GLuint y, GLuint z, GLuint w);
- void glVertexAttribI3ui(GLuint index, GLuint x, GLuint y, GLuint z);
- void glVertexAttribI2ui(GLuint index, GLuint x, GLuint y);
- void glVertexAttribI1ui(GLuint index, GLuint x);
- void glVertexAttribI4i(GLuint index, GLint x, GLint y, GLint z, GLint w);
- void glVertexAttribI3i(GLuint index, GLint x, GLint y, GLint z);
- void glVertexAttribI2i(GLuint index, GLint x, GLint y);
- void glVertexAttribI1i(GLuint index, GLint x);
-
- // OpenGL 3.1 deprecated functions
-
- // OpenGL 3.2 deprecated functions
-
- // OpenGL 3.3 deprecated functions
-
- // OpenGL 4.0 deprecated functions
-
- // OpenGL 4.1 deprecated functions
-
-private:
- friend class QOpenGLContext;
-
- static bool isContextCompatible(QOpenGLContext *context);
- static QOpenGLVersionProfile versionProfile();
-
- QOpenGLFunctions_1_0_CoreBackend* d_1_0_Core;
- QOpenGLFunctions_1_1_CoreBackend* d_1_1_Core;
- QOpenGLFunctions_1_2_CoreBackend* d_1_2_Core;
- QOpenGLFunctions_1_3_CoreBackend* d_1_3_Core;
- QOpenGLFunctions_1_4_CoreBackend* d_1_4_Core;
- QOpenGLFunctions_1_5_CoreBackend* d_1_5_Core;
- QOpenGLFunctions_2_0_CoreBackend* d_2_0_Core;
- QOpenGLFunctions_2_1_CoreBackend* d_2_1_Core;
- QOpenGLFunctions_3_0_CoreBackend* d_3_0_Core;
- QOpenGLFunctions_3_1_CoreBackend* d_3_1_Core;
- QOpenGLFunctions_3_2_CoreBackend* d_3_2_Core;
- QOpenGLFunctions_3_3_CoreBackend* d_3_3_Core;
- QOpenGLFunctions_4_0_CoreBackend* d_4_0_Core;
- QOpenGLFunctions_4_1_CoreBackend* d_4_1_Core;
- QOpenGLFunctions_1_0_DeprecatedBackend* d_1_0_Deprecated;
- QOpenGLFunctions_1_1_DeprecatedBackend* d_1_1_Deprecated;
- QOpenGLFunctions_1_2_DeprecatedBackend* d_1_2_Deprecated;
- QOpenGLFunctions_1_3_DeprecatedBackend* d_1_3_Deprecated;
- QOpenGLFunctions_1_4_DeprecatedBackend* d_1_4_Deprecated;
- void *m_reserved_2_0_Deprecated; // To maintain BC
- QOpenGLFunctions_3_3_DeprecatedBackend* d_3_3_Deprecated;
-};
-
-// OpenGL 1.0 core functions
-inline void QOpenGLFunctions_4_1_Compatibility::glViewport(GLint x, GLint y, GLsizei width, GLsizei height)
-{
- d_1_0_Core->f.Viewport(x, y, width, height);
-}
-
-inline void QOpenGLFunctions_4_1_Compatibility::glDepthRange(GLdouble nearVal, GLdouble farVal)
-{
- d_1_0_Core->f.DepthRange(nearVal, farVal);
-}
-
-inline GLboolean QOpenGLFunctions_4_1_Compatibility::glIsEnabled(GLenum cap)
-{
- return d_1_0_Core->f.IsEnabled(cap);
-}
-
-inline void QOpenGLFunctions_4_1_Compatibility::glGetTexLevelParameteriv(GLenum target, GLint level, GLenum pname, GLint *params)
-{
- d_1_0_Core->f.GetTexLevelParameteriv(target, level, pname, params);
-}
-
-inline void QOpenGLFunctions_4_1_Compatibility::glGetTexLevelParameterfv(GLenum target, GLint level, GLenum pname, GLfloat *params)
-{
- d_1_0_Core->f.GetTexLevelParameterfv(target, level, pname, params);
-}
-
-inline void QOpenGLFunctions_4_1_Compatibility::glGetTexParameteriv(GLenum target, GLenum pname, GLint *params)
-{
- d_1_0_Core->f.GetTexParameteriv(target, pname, params);
-}
-
-inline void QOpenGLFunctions_4_1_Compatibility::glGetTexParameterfv(GLenum target, GLenum pname, GLfloat *params)
-{
- d_1_0_Core->f.GetTexParameterfv(target, pname, params);
-}
-
-inline void QOpenGLFunctions_4_1_Compatibility::glGetTexImage(GLenum target, GLint level, GLenum format, GLenum type, GLvoid *pixels)
-{
- d_1_0_Core->f.GetTexImage(target, level, format, type, pixels);
-}
-
-inline const GLubyte * QOpenGLFunctions_4_1_Compatibility::glGetString(GLenum name)
-{
- return d_1_0_Core->f.GetString(name);
-}
-
-inline void QOpenGLFunctions_4_1_Compatibility::glGetIntegerv(GLenum pname, GLint *params)
-{
- d_1_0_Core->f.GetIntegerv(pname, params);
-}
-
-inline void QOpenGLFunctions_4_1_Compatibility::glGetFloatv(GLenum pname, GLfloat *params)
-{
- d_1_0_Core->f.GetFloatv(pname, params);
-}
-
-inline GLenum QOpenGLFunctions_4_1_Compatibility::glGetError()
-{
- return d_1_0_Core->f.GetError();
-}
-
-inline void QOpenGLFunctions_4_1_Compatibility::glGetDoublev(GLenum pname, GLdouble *params)
-{
- d_1_0_Core->f.GetDoublev(pname, params);
-}
-
-inline void QOpenGLFunctions_4_1_Compatibility::glGetBooleanv(GLenum pname, GLboolean *params)
-{
- d_1_0_Core->f.GetBooleanv(pname, params);
-}
-
-inline void QOpenGLFunctions_4_1_Compatibility::glReadPixels(GLint x, GLint y, GLsizei width, GLsizei height, GLenum format, GLenum type, GLvoid *pixels)
-{
- d_1_0_Core->f.ReadPixels(x, y, width, height, format, type, pixels);
-}
-
-inline void QOpenGLFunctions_4_1_Compatibility::glReadBuffer(GLenum mode)
-{
- d_1_0_Core->f.ReadBuffer(mode);
-}
-
-inline void QOpenGLFunctions_4_1_Compatibility::glPixelStorei(GLenum pname, GLint param)
-{
- d_1_0_Core->f.PixelStorei(pname, param);
-}
-
-inline void QOpenGLFunctions_4_1_Compatibility::glPixelStoref(GLenum pname, GLfloat param)
-{
- d_1_0_Core->f.PixelStoref(pname, param);
-}
-
-inline void QOpenGLFunctions_4_1_Compatibility::glDepthFunc(GLenum func)
-{
- d_1_0_Core->f.DepthFunc(func);
-}
-
-inline void QOpenGLFunctions_4_1_Compatibility::glStencilOp(GLenum fail, GLenum zfail, GLenum zpass)
-{
- d_1_0_Core->f.StencilOp(fail, zfail, zpass);
-}
-
-inline void QOpenGLFunctions_4_1_Compatibility::glStencilFunc(GLenum func, GLint ref, GLuint mask)
-{
- d_1_0_Core->f.StencilFunc(func, ref, mask);
-}
-
-inline void QOpenGLFunctions_4_1_Compatibility::glLogicOp(GLenum opcode)
-{
- d_1_0_Core->f.LogicOp(opcode);
-}
-
-inline void QOpenGLFunctions_4_1_Compatibility::glBlendFunc(GLenum sfactor, GLenum dfactor)
-{
- d_1_0_Core->f.BlendFunc(sfactor, dfactor);
-}
-
-inline void QOpenGLFunctions_4_1_Compatibility::glFlush()
-{
- d_1_0_Core->f.Flush();
-}
-
-inline void QOpenGLFunctions_4_1_Compatibility::glFinish()
-{
- d_1_0_Core->f.Finish();
-}
-
-inline void QOpenGLFunctions_4_1_Compatibility::glEnable(GLenum cap)
-{
- d_1_0_Core->f.Enable(cap);
-}
-
-inline void QOpenGLFunctions_4_1_Compatibility::glDisable(GLenum cap)
-{
- d_1_0_Core->f.Disable(cap);
-}
-
-inline void QOpenGLFunctions_4_1_Compatibility::glDepthMask(GLboolean flag)
-{
- d_1_0_Core->f.DepthMask(flag);
-}
-
-inline void QOpenGLFunctions_4_1_Compatibility::glColorMask(GLboolean red, GLboolean green, GLboolean blue, GLboolean alpha)
-{
- d_1_0_Core->f.ColorMask(red, green, blue, alpha);
-}
-
-inline void QOpenGLFunctions_4_1_Compatibility::glStencilMask(GLuint mask)
-{
- d_1_0_Core->f.StencilMask(mask);
-}
-
-inline void QOpenGLFunctions_4_1_Compatibility::glClearDepth(GLdouble depth)
-{
- d_1_0_Core->f.ClearDepth(depth);
-}
-
-inline void QOpenGLFunctions_4_1_Compatibility::glClearStencil(GLint s)
-{
- d_1_0_Core->f.ClearStencil(s);
-}
-
-inline void QOpenGLFunctions_4_1_Compatibility::glClearColor(GLfloat red, GLfloat green, GLfloat blue, GLfloat alpha)
-{
- d_1_0_Core->f.ClearColor(red, green, blue, alpha);
-}
-
-inline void QOpenGLFunctions_4_1_Compatibility::glClear(GLbitfield mask)
-{
- d_1_0_Core->f.Clear(mask);
-}
-
-inline void QOpenGLFunctions_4_1_Compatibility::glDrawBuffer(GLenum mode)
-{
- d_1_0_Core->f.DrawBuffer(mode);
-}
-
-inline void QOpenGLFunctions_4_1_Compatibility::glTexImage2D(GLenum target, GLint level, GLint internalformat, GLsizei width, GLsizei height, GLint border, GLenum format, GLenum type, const GLvoid *pixels)
-{
- d_1_0_Core->f.TexImage2D(target, level, internalformat, width, height, border, format, type, pixels);
-}
-
-inline void QOpenGLFunctions_4_1_Compatibility::glTexImage1D(GLenum target, GLint level, GLint internalformat, GLsizei width, GLint border, GLenum format, GLenum type, const GLvoid *pixels)
-{
- d_1_0_Core->f.TexImage1D(target, level, internalformat, width, border, format, type, pixels);
-}
-
-inline void QOpenGLFunctions_4_1_Compatibility::glTexParameteriv(GLenum target, GLenum pname, const GLint *params)
-{
- d_1_0_Core->f.TexParameteriv(target, pname, params);
-}
-
-inline void QOpenGLFunctions_4_1_Compatibility::glTexParameteri(GLenum target, GLenum pname, GLint param)
-{
- d_1_0_Core->f.TexParameteri(target, pname, param);
-}
-
-inline void QOpenGLFunctions_4_1_Compatibility::glTexParameterfv(GLenum target, GLenum pname, const GLfloat *params)
-{
- d_1_0_Core->f.TexParameterfv(target, pname, params);
-}
-
-inline void QOpenGLFunctions_4_1_Compatibility::glTexParameterf(GLenum target, GLenum pname, GLfloat param)
-{
- d_1_0_Core->f.TexParameterf(target, pname, param);
-}
-
-inline void QOpenGLFunctions_4_1_Compatibility::glScissor(GLint x, GLint y, GLsizei width, GLsizei height)
-{
- d_1_0_Core->f.Scissor(x, y, width, height);
-}
-
-inline void QOpenGLFunctions_4_1_Compatibility::glPolygonMode(GLenum face, GLenum mode)
-{
- d_1_0_Core->f.PolygonMode(face, mode);
-}
-
-inline void QOpenGLFunctions_4_1_Compatibility::glPointSize(GLfloat size)
-{
- d_1_0_Core->f.PointSize(size);
-}
-
-inline void QOpenGLFunctions_4_1_Compatibility::glLineWidth(GLfloat width)
-{
- d_1_0_Core->f.LineWidth(width);
-}
-
-inline void QOpenGLFunctions_4_1_Compatibility::glHint(GLenum target, GLenum mode)
-{
- d_1_0_Core->f.Hint(target, mode);
-}
-
-inline void QOpenGLFunctions_4_1_Compatibility::glFrontFace(GLenum mode)
-{
- d_1_0_Core->f.FrontFace(mode);
-}
-
-inline void QOpenGLFunctions_4_1_Compatibility::glCullFace(GLenum mode)
-{
- d_1_0_Core->f.CullFace(mode);
-}
-
-
-// OpenGL 1.1 core functions
-inline void QOpenGLFunctions_4_1_Compatibility::glIndexubv(const GLubyte *c)
-{
- d_1_1_Deprecated->f.Indexubv(c);
-}
-
-inline void QOpenGLFunctions_4_1_Compatibility::glIndexub(GLubyte c)
-{
- d_1_1_Deprecated->f.Indexub(c);
-}
-
-inline GLboolean QOpenGLFunctions_4_1_Compatibility::glIsTexture(GLuint texture)
-{
- return d_1_1_Core->f.IsTexture(texture);
-}
-
-inline void QOpenGLFunctions_4_1_Compatibility::glGenTextures(GLsizei n, GLuint *textures)
-{
- d_1_1_Core->f.GenTextures(n, textures);
-}
-
-inline void QOpenGLFunctions_4_1_Compatibility::glDeleteTextures(GLsizei n, const GLuint *textures)
-{
- d_1_1_Core->f.DeleteTextures(n, textures);
-}
-
-inline void QOpenGLFunctions_4_1_Compatibility::glBindTexture(GLenum target, GLuint texture)
-{
- d_1_1_Core->f.BindTexture(target, texture);
-}
-
-inline void QOpenGLFunctions_4_1_Compatibility::glTexSubImage2D(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLenum type, const GLvoid *pixels)
-{
- d_1_1_Core->f.TexSubImage2D(target, level, xoffset, yoffset, width, height, format, type, pixels);
-}
-
-inline void QOpenGLFunctions_4_1_Compatibility::glTexSubImage1D(GLenum target, GLint level, GLint xoffset, GLsizei width, GLenum format, GLenum type, const GLvoid *pixels)
-{
- d_1_1_Core->f.TexSubImage1D(target, level, xoffset, width, format, type, pixels);
-}
-
-inline void QOpenGLFunctions_4_1_Compatibility::glCopyTexSubImage2D(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint x, GLint y, GLsizei width, GLsizei height)
-{
- d_1_1_Core->f.CopyTexSubImage2D(target, level, xoffset, yoffset, x, y, width, height);
-}
-
-inline void QOpenGLFunctions_4_1_Compatibility::glCopyTexSubImage1D(GLenum target, GLint level, GLint xoffset, GLint x, GLint y, GLsizei width)
-{
- d_1_1_Core->f.CopyTexSubImage1D(target, level, xoffset, x, y, width);
-}
-
-inline void QOpenGLFunctions_4_1_Compatibility::glCopyTexImage2D(GLenum target, GLint level, GLenum internalformat, GLint x, GLint y, GLsizei width, GLsizei height, GLint border)
-{
- d_1_1_Core->f.CopyTexImage2D(target, level, internalformat, x, y, width, height, border);
-}
-
-inline void QOpenGLFunctions_4_1_Compatibility::glCopyTexImage1D(GLenum target, GLint level, GLenum internalformat, GLint x, GLint y, GLsizei width, GLint border)
-{
- d_1_1_Core->f.CopyTexImage1D(target, level, internalformat, x, y, width, border);
-}
-
-inline void QOpenGLFunctions_4_1_Compatibility::glPolygonOffset(GLfloat factor, GLfloat units)
-{
- d_1_1_Core->f.PolygonOffset(factor, units);
-}
-
-inline void QOpenGLFunctions_4_1_Compatibility::glGetPointerv(GLenum pname, GLvoid* *params)
-{
- d_1_1_Deprecated->f.GetPointerv(pname, params);
-}
-
-inline void QOpenGLFunctions_4_1_Compatibility::glDrawElements(GLenum mode, GLsizei count, GLenum type, const GLvoid *indices)
-{
- d_1_1_Core->f.DrawElements(mode, count, type, indices);
-}
-
-inline void QOpenGLFunctions_4_1_Compatibility::glDrawArrays(GLenum mode, GLint first, GLsizei count)
-{
- d_1_1_Core->f.DrawArrays(mode, first, count);
-}
-
-
-// OpenGL 1.2 core functions
-inline void QOpenGLFunctions_4_1_Compatibility::glCopyTexSubImage3D(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLint x, GLint y, GLsizei width, GLsizei height)
-{
- d_1_2_Core->f.CopyTexSubImage3D(target, level, xoffset, yoffset, zoffset, x, y, width, height);
-}
-
-inline void QOpenGLFunctions_4_1_Compatibility::glTexSubImage3D(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLenum type, const GLvoid *pixels)
-{
- d_1_2_Core->f.TexSubImage3D(target, level, xoffset, yoffset, zoffset, width, height, depth, format, type, pixels);
-}
-
-inline void QOpenGLFunctions_4_1_Compatibility::glTexImage3D(GLenum target, GLint level, GLint internalformat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLenum format, GLenum type, const GLvoid *pixels)
-{
- d_1_2_Core->f.TexImage3D(target, level, internalformat, width, height, depth, border, format, type, pixels);
-}
-
-inline void QOpenGLFunctions_4_1_Compatibility::glDrawRangeElements(GLenum mode, GLuint start, GLuint end, GLsizei count, GLenum type, const GLvoid *indices)
-{
- d_1_2_Core->f.DrawRangeElements(mode, start, end, count, type, indices);
-}
-
-inline void QOpenGLFunctions_4_1_Compatibility::glBlendEquation(GLenum mode)
-{
- d_1_2_Core->f.BlendEquation(mode);
-}
-
-inline void QOpenGLFunctions_4_1_Compatibility::glBlendColor(GLfloat red, GLfloat green, GLfloat blue, GLfloat alpha)
-{
- d_1_2_Core->f.BlendColor(red, green, blue, alpha);
-}
-
-
-// OpenGL 1.3 core functions
-inline void QOpenGLFunctions_4_1_Compatibility::glGetCompressedTexImage(GLenum target, GLint level, GLvoid *img)
-{
- d_1_3_Core->f.GetCompressedTexImage(target, level, img);
-}
-
-inline void QOpenGLFunctions_4_1_Compatibility::glCompressedTexSubImage1D(GLenum target, GLint level, GLint xoffset, GLsizei width, GLenum format, GLsizei imageSize, const GLvoid *data)
-{
- d_1_3_Core->f.CompressedTexSubImage1D(target, level, xoffset, width, format, imageSize, data);
-}
-
-inline void QOpenGLFunctions_4_1_Compatibility::glCompressedTexSubImage2D(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLsizei imageSize, const GLvoid *data)
-{
- d_1_3_Core->f.CompressedTexSubImage2D(target, level, xoffset, yoffset, width, height, format, imageSize, data);
-}
-
-inline void QOpenGLFunctions_4_1_Compatibility::glCompressedTexSubImage3D(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLsizei imageSize, const GLvoid *data)
-{
- d_1_3_Core->f.CompressedTexSubImage3D(target, level, xoffset, yoffset, zoffset, width, height, depth, format, imageSize, data);
-}
-
-inline void QOpenGLFunctions_4_1_Compatibility::glCompressedTexImage1D(GLenum target, GLint level, GLenum internalformat, GLsizei width, GLint border, GLsizei imageSize, const GLvoid *data)
-{
- d_1_3_Core->f.CompressedTexImage1D(target, level, internalformat, width, border, imageSize, data);
-}
-
-inline void QOpenGLFunctions_4_1_Compatibility::glCompressedTexImage2D(GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLint border, GLsizei imageSize, const GLvoid *data)
-{
- d_1_3_Core->f.CompressedTexImage2D(target, level, internalformat, width, height, border, imageSize, data);
-}
-
-inline void QOpenGLFunctions_4_1_Compatibility::glCompressedTexImage3D(GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLsizei imageSize, const GLvoid *data)
-{
- d_1_3_Core->f.CompressedTexImage3D(target, level, internalformat, width, height, depth, border, imageSize, data);
-}
-
-inline void QOpenGLFunctions_4_1_Compatibility::glSampleCoverage(GLfloat value, GLboolean invert)
-{
- d_1_3_Core->f.SampleCoverage(value, invert);
-}
-
-inline void QOpenGLFunctions_4_1_Compatibility::glActiveTexture(GLenum texture)
-{
- d_1_3_Core->f.ActiveTexture(texture);
-}
-
-
-// OpenGL 1.4 core functions
-inline void QOpenGLFunctions_4_1_Compatibility::glPointParameteriv(GLenum pname, const GLint *params)
-{
- d_1_4_Core->f.PointParameteriv(pname, params);
-}
-
-inline void QOpenGLFunctions_4_1_Compatibility::glPointParameteri(GLenum pname, GLint param)
-{
- d_1_4_Core->f.PointParameteri(pname, param);
-}
-
-inline void QOpenGLFunctions_4_1_Compatibility::glPointParameterfv(GLenum pname, const GLfloat *params)
-{
- d_1_4_Core->f.PointParameterfv(pname, params);
-}
-
-inline void QOpenGLFunctions_4_1_Compatibility::glPointParameterf(GLenum pname, GLfloat param)
-{
- d_1_4_Core->f.PointParameterf(pname, param);
-}
-
-inline void QOpenGLFunctions_4_1_Compatibility::glMultiDrawElements(GLenum mode, const GLsizei *count, GLenum type, const GLvoid* const *indices, GLsizei drawcount)
-{
- d_1_4_Core->f.MultiDrawElements(mode, count, type, indices, drawcount);
-}
-
-inline void QOpenGLFunctions_4_1_Compatibility::glMultiDrawArrays(GLenum mode, const GLint *first, const GLsizei *count, GLsizei drawcount)
-{
- d_1_4_Core->f.MultiDrawArrays(mode, first, count, drawcount);
-}
-
-inline void QOpenGLFunctions_4_1_Compatibility::glBlendFuncSeparate(GLenum sfactorRGB, GLenum dfactorRGB, GLenum sfactorAlpha, GLenum dfactorAlpha)
-{
- d_1_4_Core->f.BlendFuncSeparate(sfactorRGB, dfactorRGB, sfactorAlpha, dfactorAlpha);
-}
-
-
-// OpenGL 1.5 core functions
-inline void QOpenGLFunctions_4_1_Compatibility::glGetBufferPointerv(GLenum target, GLenum pname, GLvoid* *params)
-{
- d_1_5_Core->f.GetBufferPointerv(target, pname, params);
-}
-
-inline void QOpenGLFunctions_4_1_Compatibility::glGetBufferParameteriv(GLenum target, GLenum pname, GLint *params)
-{
- d_1_5_Core->f.GetBufferParameteriv(target, pname, params);
-}
-
-inline GLboolean QOpenGLFunctions_4_1_Compatibility::glUnmapBuffer(GLenum target)
-{
- return d_1_5_Core->f.UnmapBuffer(target);
-}
-
-inline GLvoid* QOpenGLFunctions_4_1_Compatibility::glMapBuffer(GLenum target, GLenum access)
-{
- return d_1_5_Core->f.MapBuffer(target, access);
-}
-
-inline void QOpenGLFunctions_4_1_Compatibility::glGetBufferSubData(GLenum target, GLintptr offset, GLsizeiptr size, GLvoid *data)
-{
- d_1_5_Core->f.GetBufferSubData(target, offset, size, data);
-}
-
-inline void QOpenGLFunctions_4_1_Compatibility::glBufferSubData(GLenum target, GLintptr offset, GLsizeiptr size, const GLvoid *data)
-{
- d_1_5_Core->f.BufferSubData(target, offset, size, data);
-}
-
-inline void QOpenGLFunctions_4_1_Compatibility::glBufferData(GLenum target, GLsizeiptr size, const GLvoid *data, GLenum usage)
-{
- d_1_5_Core->f.BufferData(target, size, data, usage);
-}
-
-inline GLboolean QOpenGLFunctions_4_1_Compatibility::glIsBuffer(GLuint buffer)
-{
- return d_1_5_Core->f.IsBuffer(buffer);
-}
-
-inline void QOpenGLFunctions_4_1_Compatibility::glGenBuffers(GLsizei n, GLuint *buffers)
-{
- d_1_5_Core->f.GenBuffers(n, buffers);
-}
-
-inline void QOpenGLFunctions_4_1_Compatibility::glDeleteBuffers(GLsizei n, const GLuint *buffers)
-{
- d_1_5_Core->f.DeleteBuffers(n, buffers);
-}
-
-inline void QOpenGLFunctions_4_1_Compatibility::glBindBuffer(GLenum target, GLuint buffer)
-{
- d_1_5_Core->f.BindBuffer(target, buffer);
-}
-
-inline void QOpenGLFunctions_4_1_Compatibility::glGetQueryObjectuiv(GLuint id, GLenum pname, GLuint *params)
-{
- d_1_5_Core->f.GetQueryObjectuiv(id, pname, params);
-}
-
-inline void QOpenGLFunctions_4_1_Compatibility::glGetQueryObjectiv(GLuint id, GLenum pname, GLint *params)
-{
- d_1_5_Core->f.GetQueryObjectiv(id, pname, params);
-}
-
-inline void QOpenGLFunctions_4_1_Compatibility::glGetQueryiv(GLenum target, GLenum pname, GLint *params)
-{
- d_1_5_Core->f.GetQueryiv(target, pname, params);
-}
-
-inline void QOpenGLFunctions_4_1_Compatibility::glEndQuery(GLenum target)
-{
- d_1_5_Core->f.EndQuery(target);
-}
-
-inline void QOpenGLFunctions_4_1_Compatibility::glBeginQuery(GLenum target, GLuint id)
-{
- d_1_5_Core->f.BeginQuery(target, id);
-}
-
-inline GLboolean QOpenGLFunctions_4_1_Compatibility::glIsQuery(GLuint id)
-{
- return d_1_5_Core->f.IsQuery(id);
-}
-
-inline void QOpenGLFunctions_4_1_Compatibility::glDeleteQueries(GLsizei n, const GLuint *ids)
-{
- d_1_5_Core->f.DeleteQueries(n, ids);
-}
-
-inline void QOpenGLFunctions_4_1_Compatibility::glGenQueries(GLsizei n, GLuint *ids)
-{
- d_1_5_Core->f.GenQueries(n, ids);
-}
-
-
-// OpenGL 2.0 core functions
-inline void QOpenGLFunctions_4_1_Compatibility::glVertexAttribPointer(GLuint index, GLint size, GLenum type, GLboolean normalized, GLsizei stride, const GLvoid *pointer)
-{
- d_2_0_Core->f.VertexAttribPointer(index, size, type, normalized, stride, pointer);
-}
-
-inline void QOpenGLFunctions_4_1_Compatibility::glValidateProgram(GLuint program)
-{
- d_2_0_Core->f.ValidateProgram(program);
-}
-
-inline void QOpenGLFunctions_4_1_Compatibility::glUniformMatrix4fv(GLint location, GLsizei count, GLboolean transpose, const GLfloat *value)
-{
- d_2_0_Core->f.UniformMatrix4fv(location, count, transpose, value);
-}
-
-inline void QOpenGLFunctions_4_1_Compatibility::glUniformMatrix3fv(GLint location, GLsizei count, GLboolean transpose, const GLfloat *value)
-{
- d_2_0_Core->f.UniformMatrix3fv(location, count, transpose, value);
-}
-
-inline void QOpenGLFunctions_4_1_Compatibility::glUniformMatrix2fv(GLint location, GLsizei count, GLboolean transpose, const GLfloat *value)
-{
- d_2_0_Core->f.UniformMatrix2fv(location, count, transpose, value);
-}
-
-inline void QOpenGLFunctions_4_1_Compatibility::glUniform4iv(GLint location, GLsizei count, const GLint *value)
-{
- d_2_0_Core->f.Uniform4iv(location, count, value);
-}
-
-inline void QOpenGLFunctions_4_1_Compatibility::glUniform3iv(GLint location, GLsizei count, const GLint *value)
-{
- d_2_0_Core->f.Uniform3iv(location, count, value);
-}
-
-inline void QOpenGLFunctions_4_1_Compatibility::glUniform2iv(GLint location, GLsizei count, const GLint *value)
-{
- d_2_0_Core->f.Uniform2iv(location, count, value);
-}
-
-inline void QOpenGLFunctions_4_1_Compatibility::glUniform1iv(GLint location, GLsizei count, const GLint *value)
-{
- d_2_0_Core->f.Uniform1iv(location, count, value);
-}
-
-inline void QOpenGLFunctions_4_1_Compatibility::glUniform4fv(GLint location, GLsizei count, const GLfloat *value)
-{
- d_2_0_Core->f.Uniform4fv(location, count, value);
-}
-
-inline void QOpenGLFunctions_4_1_Compatibility::glUniform3fv(GLint location, GLsizei count, const GLfloat *value)
-{
- d_2_0_Core->f.Uniform3fv(location, count, value);
-}
-
-inline void QOpenGLFunctions_4_1_Compatibility::glUniform2fv(GLint location, GLsizei count, const GLfloat *value)
-{
- d_2_0_Core->f.Uniform2fv(location, count, value);
-}
-
-inline void QOpenGLFunctions_4_1_Compatibility::glUniform1fv(GLint location, GLsizei count, const GLfloat *value)
-{
- d_2_0_Core->f.Uniform1fv(location, count, value);
-}
-
-inline void QOpenGLFunctions_4_1_Compatibility::glUniform4i(GLint location, GLint v0, GLint v1, GLint v2, GLint v3)
-{
- d_2_0_Core->f.Uniform4i(location, v0, v1, v2, v3);
-}
-
-inline void QOpenGLFunctions_4_1_Compatibility::glUniform3i(GLint location, GLint v0, GLint v1, GLint v2)
-{
- d_2_0_Core->f.Uniform3i(location, v0, v1, v2);
-}
-
-inline void QOpenGLFunctions_4_1_Compatibility::glUniform2i(GLint location, GLint v0, GLint v1)
-{
- d_2_0_Core->f.Uniform2i(location, v0, v1);
-}
-
-inline void QOpenGLFunctions_4_1_Compatibility::glUniform1i(GLint location, GLint v0)
-{
- d_2_0_Core->f.Uniform1i(location, v0);
-}
-
-inline void QOpenGLFunctions_4_1_Compatibility::glUniform4f(GLint location, GLfloat v0, GLfloat v1, GLfloat v2, GLfloat v3)
-{
- d_2_0_Core->f.Uniform4f(location, v0, v1, v2, v3);
-}
-
-inline void QOpenGLFunctions_4_1_Compatibility::glUniform3f(GLint location, GLfloat v0, GLfloat v1, GLfloat v2)
-{
- d_2_0_Core->f.Uniform3f(location, v0, v1, v2);
-}
-
-inline void QOpenGLFunctions_4_1_Compatibility::glUniform2f(GLint location, GLfloat v0, GLfloat v1)
-{
- d_2_0_Core->f.Uniform2f(location, v0, v1);
-}
-
-inline void QOpenGLFunctions_4_1_Compatibility::glUniform1f(GLint location, GLfloat v0)
-{
- d_2_0_Core->f.Uniform1f(location, v0);
-}
-
-inline void QOpenGLFunctions_4_1_Compatibility::glUseProgram(GLuint program)
-{
- d_2_0_Core->f.UseProgram(program);
-}
-
-inline void QOpenGLFunctions_4_1_Compatibility::glShaderSource(GLuint shader, GLsizei count, const GLchar* const *string, const GLint *length)
-{
- d_2_0_Core->f.ShaderSource(shader, count, string, length);
-}
-
-inline void QOpenGLFunctions_4_1_Compatibility::glLinkProgram(GLuint program)
-{
- d_2_0_Core->f.LinkProgram(program);
-}
-
-inline GLboolean QOpenGLFunctions_4_1_Compatibility::glIsShader(GLuint shader)
-{
- return d_2_0_Core->f.IsShader(shader);
-}
-
-inline GLboolean QOpenGLFunctions_4_1_Compatibility::glIsProgram(GLuint program)
-{
- return d_2_0_Core->f.IsProgram(program);
-}
-
-inline void QOpenGLFunctions_4_1_Compatibility::glGetVertexAttribPointerv(GLuint index, GLenum pname, GLvoid* *pointer)
-{
- d_2_0_Core->f.GetVertexAttribPointerv(index, pname, pointer);
-}
-
-inline void QOpenGLFunctions_4_1_Compatibility::glGetVertexAttribiv(GLuint index, GLenum pname, GLint *params)
-{
- d_2_0_Core->f.GetVertexAttribiv(index, pname, params);
-}
-
-inline void QOpenGLFunctions_4_1_Compatibility::glGetVertexAttribfv(GLuint index, GLenum pname, GLfloat *params)
-{
- d_2_0_Core->f.GetVertexAttribfv(index, pname, params);
-}
-
-inline void QOpenGLFunctions_4_1_Compatibility::glGetVertexAttribdv(GLuint index, GLenum pname, GLdouble *params)
-{
- d_2_0_Core->f.GetVertexAttribdv(index, pname, params);
-}
-
-inline void QOpenGLFunctions_4_1_Compatibility::glGetUniformiv(GLuint program, GLint location, GLint *params)
-{
- d_2_0_Core->f.GetUniformiv(program, location, params);
-}
-
-inline void QOpenGLFunctions_4_1_Compatibility::glGetUniformfv(GLuint program, GLint location, GLfloat *params)
-{
- d_2_0_Core->f.GetUniformfv(program, location, params);
-}
-
-inline GLint QOpenGLFunctions_4_1_Compatibility::glGetUniformLocation(GLuint program, const GLchar *name)
-{
- return d_2_0_Core->f.GetUniformLocation(program, name);
-}
-
-inline void QOpenGLFunctions_4_1_Compatibility::glGetShaderSource(GLuint shader, GLsizei bufSize, GLsizei *length, GLchar *source)
-{
- d_2_0_Core->f.GetShaderSource(shader, bufSize, length, source);
-}
-
-inline void QOpenGLFunctions_4_1_Compatibility::glGetShaderInfoLog(GLuint shader, GLsizei bufSize, GLsizei *length, GLchar *infoLog)
-{
- d_2_0_Core->f.GetShaderInfoLog(shader, bufSize, length, infoLog);
-}
-
-inline void QOpenGLFunctions_4_1_Compatibility::glGetShaderiv(GLuint shader, GLenum pname, GLint *params)
-{
- d_2_0_Core->f.GetShaderiv(shader, pname, params);
-}
-
-inline void QOpenGLFunctions_4_1_Compatibility::glGetProgramInfoLog(GLuint program, GLsizei bufSize, GLsizei *length, GLchar *infoLog)
-{
- d_2_0_Core->f.GetProgramInfoLog(program, bufSize, length, infoLog);
-}
-
-inline void QOpenGLFunctions_4_1_Compatibility::glGetProgramiv(GLuint program, GLenum pname, GLint *params)
-{
- d_2_0_Core->f.GetProgramiv(program, pname, params);
-}
-
-inline GLint QOpenGLFunctions_4_1_Compatibility::glGetAttribLocation(GLuint program, const GLchar *name)
-{
- return d_2_0_Core->f.GetAttribLocation(program, name);
-}
-
-inline void QOpenGLFunctions_4_1_Compatibility::glGetAttachedShaders(GLuint program, GLsizei maxCount, GLsizei *count, GLuint *obj)
-{
- d_2_0_Core->f.GetAttachedShaders(program, maxCount, count, obj);
-}
-
-inline void QOpenGLFunctions_4_1_Compatibility::glGetActiveUniform(GLuint program, GLuint index, GLsizei bufSize, GLsizei *length, GLint *size, GLenum *type, GLchar *name)
-{
- d_2_0_Core->f.GetActiveUniform(program, index, bufSize, length, size, type, name);
-}
-
-inline void QOpenGLFunctions_4_1_Compatibility::glGetActiveAttrib(GLuint program, GLuint index, GLsizei bufSize, GLsizei *length, GLint *size, GLenum *type, GLchar *name)
-{
- d_2_0_Core->f.GetActiveAttrib(program, index, bufSize, length, size, type, name);
-}
-
-inline void QOpenGLFunctions_4_1_Compatibility::glEnableVertexAttribArray(GLuint index)
-{
- d_2_0_Core->f.EnableVertexAttribArray(index);
-}
-
-inline void QOpenGLFunctions_4_1_Compatibility::glDisableVertexAttribArray(GLuint index)
-{
- d_2_0_Core->f.DisableVertexAttribArray(index);
-}
-
-inline void QOpenGLFunctions_4_1_Compatibility::glDetachShader(GLuint program, GLuint shader)
-{
- d_2_0_Core->f.DetachShader(program, shader);
-}
-
-inline void QOpenGLFunctions_4_1_Compatibility::glDeleteShader(GLuint shader)
-{
- d_2_0_Core->f.DeleteShader(shader);
-}
-
-inline void QOpenGLFunctions_4_1_Compatibility::glDeleteProgram(GLuint program)
-{
- d_2_0_Core->f.DeleteProgram(program);
-}
-
-inline GLuint QOpenGLFunctions_4_1_Compatibility::glCreateShader(GLenum type)
-{
- return d_2_0_Core->f.CreateShader(type);
-}
-
-inline GLuint QOpenGLFunctions_4_1_Compatibility::glCreateProgram()
-{
- return d_2_0_Core->f.CreateProgram();
-}
-
-inline void QOpenGLFunctions_4_1_Compatibility::glCompileShader(GLuint shader)
-{
- d_2_0_Core->f.CompileShader(shader);
-}
-
-inline void QOpenGLFunctions_4_1_Compatibility::glBindAttribLocation(GLuint program, GLuint index, const GLchar *name)
-{
- d_2_0_Core->f.BindAttribLocation(program, index, name);
-}
-
-inline void QOpenGLFunctions_4_1_Compatibility::glAttachShader(GLuint program, GLuint shader)
-{
- d_2_0_Core->f.AttachShader(program, shader);
-}
-
-inline void QOpenGLFunctions_4_1_Compatibility::glStencilMaskSeparate(GLenum face, GLuint mask)
-{
- d_2_0_Core->f.StencilMaskSeparate(face, mask);
-}
-
-inline void QOpenGLFunctions_4_1_Compatibility::glStencilFuncSeparate(GLenum face, GLenum func, GLint ref, GLuint mask)
-{
- d_2_0_Core->f.StencilFuncSeparate(face, func, ref, mask);
-}
-
-inline void QOpenGLFunctions_4_1_Compatibility::glStencilOpSeparate(GLenum face, GLenum sfail, GLenum dpfail, GLenum dppass)
-{
- d_2_0_Core->f.StencilOpSeparate(face, sfail, dpfail, dppass);
-}
-
-inline void QOpenGLFunctions_4_1_Compatibility::glDrawBuffers(GLsizei n, const GLenum *bufs)
-{
- d_2_0_Core->f.DrawBuffers(n, bufs);
-}
-
-inline void QOpenGLFunctions_4_1_Compatibility::glBlendEquationSeparate(GLenum modeRGB, GLenum modeAlpha)
-{
- d_2_0_Core->f.BlendEquationSeparate(modeRGB, modeAlpha);
-}
-
-
-// OpenGL 2.1 core functions
-inline void QOpenGLFunctions_4_1_Compatibility::glUniformMatrix4x3fv(GLint location, GLsizei count, GLboolean transpose, const GLfloat *value)
-{
- d_2_1_Core->f.UniformMatrix4x3fv(location, count, transpose, value);
-}
-
-inline void QOpenGLFunctions_4_1_Compatibility::glUniformMatrix3x4fv(GLint location, GLsizei count, GLboolean transpose, const GLfloat *value)
-{
- d_2_1_Core->f.UniformMatrix3x4fv(location, count, transpose, value);
-}
-
-inline void QOpenGLFunctions_4_1_Compatibility::glUniformMatrix4x2fv(GLint location, GLsizei count, GLboolean transpose, const GLfloat *value)
-{
- d_2_1_Core->f.UniformMatrix4x2fv(location, count, transpose, value);
-}
-
-inline void QOpenGLFunctions_4_1_Compatibility::glUniformMatrix2x4fv(GLint location, GLsizei count, GLboolean transpose, const GLfloat *value)
-{
- d_2_1_Core->f.UniformMatrix2x4fv(location, count, transpose, value);
-}
-
-inline void QOpenGLFunctions_4_1_Compatibility::glUniformMatrix3x2fv(GLint location, GLsizei count, GLboolean transpose, const GLfloat *value)
-{
- d_2_1_Core->f.UniformMatrix3x2fv(location, count, transpose, value);
-}
-
-inline void QOpenGLFunctions_4_1_Compatibility::glUniformMatrix2x3fv(GLint location, GLsizei count, GLboolean transpose, const GLfloat *value)
-{
- d_2_1_Core->f.UniformMatrix2x3fv(location, count, transpose, value);
-}
-
-
-// OpenGL 3.0 core functions
-inline GLboolean QOpenGLFunctions_4_1_Compatibility::glIsVertexArray(GLuint array)
-{
- return d_3_0_Core->f.IsVertexArray(array);
-}
-
-inline void QOpenGLFunctions_4_1_Compatibility::glGenVertexArrays(GLsizei n, GLuint *arrays)
-{
- d_3_0_Core->f.GenVertexArrays(n, arrays);
-}
-
-inline void QOpenGLFunctions_4_1_Compatibility::glDeleteVertexArrays(GLsizei n, const GLuint *arrays)
-{
- d_3_0_Core->f.DeleteVertexArrays(n, arrays);
-}
-
-inline void QOpenGLFunctions_4_1_Compatibility::glBindVertexArray(GLuint array)
-{
- d_3_0_Core->f.BindVertexArray(array);
-}
-
-inline void QOpenGLFunctions_4_1_Compatibility::glFlushMappedBufferRange(GLenum target, GLintptr offset, GLsizeiptr length)
-{
- d_3_0_Core->f.FlushMappedBufferRange(target, offset, length);
-}
-
-inline GLvoid* QOpenGLFunctions_4_1_Compatibility::glMapBufferRange(GLenum target, GLintptr offset, GLsizeiptr length, GLbitfield access)
-{
- return d_3_0_Core->f.MapBufferRange(target, offset, length, access);
-}
-
-inline void QOpenGLFunctions_4_1_Compatibility::glFramebufferTextureLayer(GLenum target, GLenum attachment, GLuint texture, GLint level, GLint layer)
-{
- d_3_0_Core->f.FramebufferTextureLayer(target, attachment, texture, level, layer);
-}
-
-inline void QOpenGLFunctions_4_1_Compatibility::glRenderbufferStorageMultisample(GLenum target, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height)
-{
- d_3_0_Core->f.RenderbufferStorageMultisample(target, samples, internalformat, width, height);
-}
-
-inline void QOpenGLFunctions_4_1_Compatibility::glBlitFramebuffer(GLint srcX0, GLint srcY0, GLint srcX1, GLint srcY1, GLint dstX0, GLint dstY0, GLint dstX1, GLint dstY1, GLbitfield mask, GLenum filter)
-{
- d_3_0_Core->f.BlitFramebuffer(srcX0, srcY0, srcX1, srcY1, dstX0, dstY0, dstX1, dstY1, mask, filter);
-}
-
-inline void QOpenGLFunctions_4_1_Compatibility::glGenerateMipmap(GLenum target)
-{
- d_3_0_Core->f.GenerateMipmap(target);
-}
-
-inline void QOpenGLFunctions_4_1_Compatibility::glGetFramebufferAttachmentParameteriv(GLenum target, GLenum attachment, GLenum pname, GLint *params)
-{
- d_3_0_Core->f.GetFramebufferAttachmentParameteriv(target, attachment, pname, params);
-}
-
-inline void QOpenGLFunctions_4_1_Compatibility::glFramebufferRenderbuffer(GLenum target, GLenum attachment, GLenum renderbuffertarget, GLuint renderbuffer)
-{
- d_3_0_Core->f.FramebufferRenderbuffer(target, attachment, renderbuffertarget, renderbuffer);
-}
-
-inline void QOpenGLFunctions_4_1_Compatibility::glFramebufferTexture3D(GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level, GLint zoffset)
-{
- d_3_0_Core->f.FramebufferTexture3D(target, attachment, textarget, texture, level, zoffset);
-}
-
-inline void QOpenGLFunctions_4_1_Compatibility::glFramebufferTexture2D(GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level)
-{
- d_3_0_Core->f.FramebufferTexture2D(target, attachment, textarget, texture, level);
-}
-
-inline void QOpenGLFunctions_4_1_Compatibility::glFramebufferTexture1D(GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level)
-{
- d_3_0_Core->f.FramebufferTexture1D(target, attachment, textarget, texture, level);
-}
-
-inline GLenum QOpenGLFunctions_4_1_Compatibility::glCheckFramebufferStatus(GLenum target)
-{
- return d_3_0_Core->f.CheckFramebufferStatus(target);
-}
-
-inline void QOpenGLFunctions_4_1_Compatibility::glGenFramebuffers(GLsizei n, GLuint *framebuffers)
-{
- d_3_0_Core->f.GenFramebuffers(n, framebuffers);
-}
-
-inline void QOpenGLFunctions_4_1_Compatibility::glDeleteFramebuffers(GLsizei n, const GLuint *framebuffers)
-{
- d_3_0_Core->f.DeleteFramebuffers(n, framebuffers);
-}
-
-inline void QOpenGLFunctions_4_1_Compatibility::glBindFramebuffer(GLenum target, GLuint framebuffer)
-{
- d_3_0_Core->f.BindFramebuffer(target, framebuffer);
-}
-
-inline GLboolean QOpenGLFunctions_4_1_Compatibility::glIsFramebuffer(GLuint framebuffer)
-{
- return d_3_0_Core->f.IsFramebuffer(framebuffer);
-}
-
-inline void QOpenGLFunctions_4_1_Compatibility::glGetRenderbufferParameteriv(GLenum target, GLenum pname, GLint *params)
-{
- d_3_0_Core->f.GetRenderbufferParameteriv(target, pname, params);
-}
-
-inline void QOpenGLFunctions_4_1_Compatibility::glRenderbufferStorage(GLenum target, GLenum internalformat, GLsizei width, GLsizei height)
-{
- d_3_0_Core->f.RenderbufferStorage(target, internalformat, width, height);
-}
-
-inline void QOpenGLFunctions_4_1_Compatibility::glGenRenderbuffers(GLsizei n, GLuint *renderbuffers)
-{
- d_3_0_Core->f.GenRenderbuffers(n, renderbuffers);
-}
-
-inline void QOpenGLFunctions_4_1_Compatibility::glDeleteRenderbuffers(GLsizei n, const GLuint *renderbuffers)
-{
- d_3_0_Core->f.DeleteRenderbuffers(n, renderbuffers);
-}
-
-inline void QOpenGLFunctions_4_1_Compatibility::glBindRenderbuffer(GLenum target, GLuint renderbuffer)
-{
- d_3_0_Core->f.BindRenderbuffer(target, renderbuffer);
-}
-
-inline GLboolean QOpenGLFunctions_4_1_Compatibility::glIsRenderbuffer(GLuint renderbuffer)
-{
- return d_3_0_Core->f.IsRenderbuffer(renderbuffer);
-}
-
-inline const GLubyte * QOpenGLFunctions_4_1_Compatibility::glGetStringi(GLenum name, GLuint index)
-{
- return d_3_0_Core->f.GetStringi(name, index);
-}
-
-inline void QOpenGLFunctions_4_1_Compatibility::glClearBufferfi(GLenum buffer, GLint drawbuffer, GLfloat depth, GLint stencil)
-{
- d_3_0_Core->f.ClearBufferfi(buffer, drawbuffer, depth, stencil);
-}
-
-inline void QOpenGLFunctions_4_1_Compatibility::glClearBufferfv(GLenum buffer, GLint drawbuffer, const GLfloat *value)
-{
- d_3_0_Core->f.ClearBufferfv(buffer, drawbuffer, value);
-}
-
-inline void QOpenGLFunctions_4_1_Compatibility::glClearBufferuiv(GLenum buffer, GLint drawbuffer, const GLuint *value)
-{
- d_3_0_Core->f.ClearBufferuiv(buffer, drawbuffer, value);
-}
-
-inline void QOpenGLFunctions_4_1_Compatibility::glClearBufferiv(GLenum buffer, GLint drawbuffer, const GLint *value)
-{
- d_3_0_Core->f.ClearBufferiv(buffer, drawbuffer, value);
-}
-
-inline void QOpenGLFunctions_4_1_Compatibility::glGetTexParameterIuiv(GLenum target, GLenum pname, GLuint *params)
-{
- d_3_0_Core->f.GetTexParameterIuiv(target, pname, params);
-}
-
-inline void QOpenGLFunctions_4_1_Compatibility::glGetTexParameterIiv(GLenum target, GLenum pname, GLint *params)
-{
- d_3_0_Core->f.GetTexParameterIiv(target, pname, params);
-}
-
-inline void QOpenGLFunctions_4_1_Compatibility::glTexParameterIuiv(GLenum target, GLenum pname, const GLuint *params)
-{
- d_3_0_Core->f.TexParameterIuiv(target, pname, params);
-}
-
-inline void QOpenGLFunctions_4_1_Compatibility::glTexParameterIiv(GLenum target, GLenum pname, const GLint *params)
-{
- d_3_0_Core->f.TexParameterIiv(target, pname, params);
-}
-
-inline void QOpenGLFunctions_4_1_Compatibility::glUniform4uiv(GLint location, GLsizei count, const GLuint *value)
-{
- d_3_0_Core->f.Uniform4uiv(location, count, value);
-}
-
-inline void QOpenGLFunctions_4_1_Compatibility::glUniform3uiv(GLint location, GLsizei count, const GLuint *value)
-{
- d_3_0_Core->f.Uniform3uiv(location, count, value);
-}
-
-inline void QOpenGLFunctions_4_1_Compatibility::glUniform2uiv(GLint location, GLsizei count, const GLuint *value)
-{
- d_3_0_Core->f.Uniform2uiv(location, count, value);
-}
-
-inline void QOpenGLFunctions_4_1_Compatibility::glUniform1uiv(GLint location, GLsizei count, const GLuint *value)
-{
- d_3_0_Core->f.Uniform1uiv(location, count, value);
-}
-
-inline void QOpenGLFunctions_4_1_Compatibility::glUniform4ui(GLint location, GLuint v0, GLuint v1, GLuint v2, GLuint v3)
-{
- d_3_0_Core->f.Uniform4ui(location, v0, v1, v2, v3);
-}
-
-inline void QOpenGLFunctions_4_1_Compatibility::glUniform3ui(GLint location, GLuint v0, GLuint v1, GLuint v2)
-{
- d_3_0_Core->f.Uniform3ui(location, v0, v1, v2);
-}
-
-inline void QOpenGLFunctions_4_1_Compatibility::glUniform2ui(GLint location, GLuint v0, GLuint v1)
-{
- d_3_0_Core->f.Uniform2ui(location, v0, v1);
-}
-
-inline void QOpenGLFunctions_4_1_Compatibility::glUniform1ui(GLint location, GLuint v0)
-{
- d_3_0_Core->f.Uniform1ui(location, v0);
-}
-
-inline GLint QOpenGLFunctions_4_1_Compatibility::glGetFragDataLocation(GLuint program, const GLchar *name)
-{
- return d_3_0_Core->f.GetFragDataLocation(program, name);
-}
-
-inline void QOpenGLFunctions_4_1_Compatibility::glBindFragDataLocation(GLuint program, GLuint color, const GLchar *name)
-{
- d_3_0_Core->f.BindFragDataLocation(program, color, name);
-}
-
-inline void QOpenGLFunctions_4_1_Compatibility::glGetUniformuiv(GLuint program, GLint location, GLuint *params)
-{
- d_3_0_Core->f.GetUniformuiv(program, location, params);
-}
-
-inline void QOpenGLFunctions_4_1_Compatibility::glGetVertexAttribIuiv(GLuint index, GLenum pname, GLuint *params)
-{
- d_3_0_Core->f.GetVertexAttribIuiv(index, pname, params);
-}
-
-inline void QOpenGLFunctions_4_1_Compatibility::glGetVertexAttribIiv(GLuint index, GLenum pname, GLint *params)
-{
- d_3_0_Core->f.GetVertexAttribIiv(index, pname, params);
-}
-
-inline void QOpenGLFunctions_4_1_Compatibility::glVertexAttribIPointer(GLuint index, GLint size, GLenum type, GLsizei stride, const GLvoid *pointer)
-{
- d_3_0_Core->f.VertexAttribIPointer(index, size, type, stride, pointer);
-}
-
-inline void QOpenGLFunctions_4_1_Compatibility::glEndConditionalRender()
-{
- d_3_0_Core->f.EndConditionalRender();
-}
-
-inline void QOpenGLFunctions_4_1_Compatibility::glBeginConditionalRender(GLuint id, GLenum mode)
-{
- d_3_0_Core->f.BeginConditionalRender(id, mode);
-}
-
-inline void QOpenGLFunctions_4_1_Compatibility::glClampColor(GLenum target, GLenum clamp)
-{
- d_3_0_Core->f.ClampColor(target, clamp);
-}
-
-inline void QOpenGLFunctions_4_1_Compatibility::glGetTransformFeedbackVarying(GLuint program, GLuint index, GLsizei bufSize, GLsizei *length, GLsizei *size, GLenum *type, GLchar *name)
-{
- d_3_0_Core->f.GetTransformFeedbackVarying(program, index, bufSize, length, size, type, name);
-}
-
-inline void QOpenGLFunctions_4_1_Compatibility::glTransformFeedbackVaryings(GLuint program, GLsizei count, const GLchar* const *varyings, GLenum bufferMode)
-{
- d_3_0_Core->f.TransformFeedbackVaryings(program, count, varyings, bufferMode);
-}
-
-inline void QOpenGLFunctions_4_1_Compatibility::glBindBufferBase(GLenum target, GLuint index, GLuint buffer)
-{
- d_3_0_Core->f.BindBufferBase(target, index, buffer);
-}
-
-inline void QOpenGLFunctions_4_1_Compatibility::glBindBufferRange(GLenum target, GLuint index, GLuint buffer, GLintptr offset, GLsizeiptr size)
-{
- d_3_0_Core->f.BindBufferRange(target, index, buffer, offset, size);
-}
-
-inline void QOpenGLFunctions_4_1_Compatibility::glEndTransformFeedback()
-{
- d_3_0_Core->f.EndTransformFeedback();
-}
-
-inline void QOpenGLFunctions_4_1_Compatibility::glBeginTransformFeedback(GLenum primitiveMode)
-{
- d_3_0_Core->f.BeginTransformFeedback(primitiveMode);
-}
-
-inline GLboolean QOpenGLFunctions_4_1_Compatibility::glIsEnabledi(GLenum target, GLuint index)
-{
- return d_3_0_Core->f.IsEnabledi(target, index);
-}
-
-inline void QOpenGLFunctions_4_1_Compatibility::glDisablei(GLenum target, GLuint index)
-{
- d_3_0_Core->f.Disablei(target, index);
-}
-
-inline void QOpenGLFunctions_4_1_Compatibility::glEnablei(GLenum target, GLuint index)
-{
- d_3_0_Core->f.Enablei(target, index);
-}
-
-inline void QOpenGLFunctions_4_1_Compatibility::glGetIntegeri_v(GLenum target, GLuint index, GLint *data)
-{
- d_3_0_Core->f.GetIntegeri_v(target, index, data);
-}
-
-inline void QOpenGLFunctions_4_1_Compatibility::glGetBooleani_v(GLenum target, GLuint index, GLboolean *data)
-{
- d_3_0_Core->f.GetBooleani_v(target, index, data);
-}
-
-inline void QOpenGLFunctions_4_1_Compatibility::glColorMaski(GLuint index, GLboolean r, GLboolean g, GLboolean b, GLboolean a)
-{
- d_3_0_Core->f.ColorMaski(index, r, g, b, a);
-}
-
-
-// OpenGL 3.1 core functions
-inline void QOpenGLFunctions_4_1_Compatibility::glCopyBufferSubData(GLenum readTarget, GLenum writeTarget, GLintptr readOffset, GLintptr writeOffset, GLsizeiptr size)
-{
- d_3_1_Core->f.CopyBufferSubData(readTarget, writeTarget, readOffset, writeOffset, size);
-}
-
-inline void QOpenGLFunctions_4_1_Compatibility::glUniformBlockBinding(GLuint program, GLuint uniformBlockIndex, GLuint uniformBlockBinding)
-{
- d_3_1_Core->f.UniformBlockBinding(program, uniformBlockIndex, uniformBlockBinding);
-}
-
-inline void QOpenGLFunctions_4_1_Compatibility::glGetActiveUniformBlockName(GLuint program, GLuint uniformBlockIndex, GLsizei bufSize, GLsizei *length, GLchar *uniformBlockName)
-{
- d_3_1_Core->f.GetActiveUniformBlockName(program, uniformBlockIndex, bufSize, length, uniformBlockName);
-}
-
-inline void QOpenGLFunctions_4_1_Compatibility::glGetActiveUniformBlockiv(GLuint program, GLuint uniformBlockIndex, GLenum pname, GLint *params)
-{
- d_3_1_Core->f.GetActiveUniformBlockiv(program, uniformBlockIndex, pname, params);
-}
-
-inline GLuint QOpenGLFunctions_4_1_Compatibility::glGetUniformBlockIndex(GLuint program, const GLchar *uniformBlockName)
-{
- return d_3_1_Core->f.GetUniformBlockIndex(program, uniformBlockName);
-}
-
-inline void QOpenGLFunctions_4_1_Compatibility::glGetActiveUniformName(GLuint program, GLuint uniformIndex, GLsizei bufSize, GLsizei *length, GLchar *uniformName)
-{
- d_3_1_Core->f.GetActiveUniformName(program, uniformIndex, bufSize, length, uniformName);
-}
-
-inline void QOpenGLFunctions_4_1_Compatibility::glGetActiveUniformsiv(GLuint program, GLsizei uniformCount, const GLuint *uniformIndices, GLenum pname, GLint *params)
-{
- d_3_1_Core->f.GetActiveUniformsiv(program, uniformCount, uniformIndices, pname, params);
-}
-
-inline void QOpenGLFunctions_4_1_Compatibility::glGetUniformIndices(GLuint program, GLsizei uniformCount, const GLchar* const *uniformNames, GLuint *uniformIndices)
-{
- d_3_1_Core->f.GetUniformIndices(program, uniformCount, uniformNames, uniformIndices);
-}
-
-inline void QOpenGLFunctions_4_1_Compatibility::glPrimitiveRestartIndex(GLuint index)
-{
- d_3_1_Core->f.PrimitiveRestartIndex(index);
-}
-
-inline void QOpenGLFunctions_4_1_Compatibility::glTexBuffer(GLenum target, GLenum internalformat, GLuint buffer)
-{
- d_3_1_Core->f.TexBuffer(target, internalformat, buffer);
-}
-
-inline void QOpenGLFunctions_4_1_Compatibility::glDrawElementsInstanced(GLenum mode, GLsizei count, GLenum type, const GLvoid *indices, GLsizei instancecount)
-{
- d_3_1_Core->f.DrawElementsInstanced(mode, count, type, indices, instancecount);
-}
-
-inline void QOpenGLFunctions_4_1_Compatibility::glDrawArraysInstanced(GLenum mode, GLint first, GLsizei count, GLsizei instancecount)
-{
- d_3_1_Core->f.DrawArraysInstanced(mode, first, count, instancecount);
-}
-
-
-// OpenGL 3.2 core functions
-inline void QOpenGLFunctions_4_1_Compatibility::glSampleMaski(GLuint index, GLbitfield mask)
-{
- d_3_2_Core->f.SampleMaski(index, mask);
-}
-
-inline void QOpenGLFunctions_4_1_Compatibility::glGetMultisamplefv(GLenum pname, GLuint index, GLfloat *val)
-{
- d_3_2_Core->f.GetMultisamplefv(pname, index, val);
-}
-
-inline void QOpenGLFunctions_4_1_Compatibility::glTexImage3DMultisample(GLenum target, GLsizei samples, GLint internalformat, GLsizei width, GLsizei height, GLsizei depth, GLboolean fixedsamplelocations)
-{
- d_3_2_Core->f.TexImage3DMultisample(target, samples, internalformat, width, height, depth, fixedsamplelocations);
-}
-
-inline void QOpenGLFunctions_4_1_Compatibility::glTexImage2DMultisample(GLenum target, GLsizei samples, GLint internalformat, GLsizei width, GLsizei height, GLboolean fixedsamplelocations)
-{
- d_3_2_Core->f.TexImage2DMultisample(target, samples, internalformat, width, height, fixedsamplelocations);
-}
-
-inline void QOpenGLFunctions_4_1_Compatibility::glGetSynciv(GLsync sync, GLenum pname, GLsizei bufSize, GLsizei *length, GLint *values)
-{
- d_3_2_Core->f.GetSynciv(sync, pname, bufSize, length, values);
-}
-
-inline void QOpenGLFunctions_4_1_Compatibility::glGetInteger64v(GLenum pname, GLint64 *params)
-{
- d_3_2_Core->f.GetInteger64v(pname, params);
-}
-
-inline void QOpenGLFunctions_4_1_Compatibility::glWaitSync(GLsync sync, GLbitfield flags, GLuint64 timeout)
-{
- d_3_2_Core->f.WaitSync(sync, flags, timeout);
-}
-
-inline GLenum QOpenGLFunctions_4_1_Compatibility::glClientWaitSync(GLsync sync, GLbitfield flags, GLuint64 timeout)
-{
- return d_3_2_Core->f.ClientWaitSync(sync, flags, timeout);
-}
-
-inline void QOpenGLFunctions_4_1_Compatibility::glDeleteSync(GLsync sync)
-{
- d_3_2_Core->f.DeleteSync(sync);
-}
-
-inline GLboolean QOpenGLFunctions_4_1_Compatibility::glIsSync(GLsync sync)
-{
- return d_3_2_Core->f.IsSync(sync);
-}
-
-inline GLsync QOpenGLFunctions_4_1_Compatibility::glFenceSync(GLenum condition, GLbitfield flags)
-{
- return d_3_2_Core->f.FenceSync(condition, flags);
-}
-
-inline void QOpenGLFunctions_4_1_Compatibility::glProvokingVertex(GLenum mode)
-{
- d_3_2_Core->f.ProvokingVertex(mode);
-}
-
-inline void QOpenGLFunctions_4_1_Compatibility::glMultiDrawElementsBaseVertex(GLenum mode, const GLsizei *count, GLenum type, const GLvoid* const *indices, GLsizei drawcount, const GLint *basevertex)
-{
- d_3_2_Core->f.MultiDrawElementsBaseVertex(mode, count, type, indices, drawcount, basevertex);
-}
-
-inline void QOpenGLFunctions_4_1_Compatibility::glDrawElementsInstancedBaseVertex(GLenum mode, GLsizei count, GLenum type, const GLvoid *indices, GLsizei instancecount, GLint basevertex)
-{
- d_3_2_Core->f.DrawElementsInstancedBaseVertex(mode, count, type, indices, instancecount, basevertex);
-}
-
-inline void QOpenGLFunctions_4_1_Compatibility::glDrawRangeElementsBaseVertex(GLenum mode, GLuint start, GLuint end, GLsizei count, GLenum type, const GLvoid *indices, GLint basevertex)
-{
- d_3_2_Core->f.DrawRangeElementsBaseVertex(mode, start, end, count, type, indices, basevertex);
-}
-
-inline void QOpenGLFunctions_4_1_Compatibility::glDrawElementsBaseVertex(GLenum mode, GLsizei count, GLenum type, const GLvoid *indices, GLint basevertex)
-{
- d_3_2_Core->f.DrawElementsBaseVertex(mode, count, type, indices, basevertex);
-}
-
-inline void QOpenGLFunctions_4_1_Compatibility::glFramebufferTexture(GLenum target, GLenum attachment, GLuint texture, GLint level)
-{
- d_3_2_Core->f.FramebufferTexture(target, attachment, texture, level);
-}
-
-inline void QOpenGLFunctions_4_1_Compatibility::glGetBufferParameteri64v(GLenum target, GLenum pname, GLint64 *params)
-{
- d_3_2_Core->f.GetBufferParameteri64v(target, pname, params);
-}
-
-inline void QOpenGLFunctions_4_1_Compatibility::glGetInteger64i_v(GLenum target, GLuint index, GLint64 *data)
-{
- d_3_2_Core->f.GetInteger64i_v(target, index, data);
-}
-
-
-// OpenGL 3.3 core functions
-inline void QOpenGLFunctions_4_1_Compatibility::glVertexAttribP4uiv(GLuint index, GLenum type, GLboolean normalized, const GLuint *value)
-{
- d_3_3_Core->f.VertexAttribP4uiv(index, type, normalized, value);
-}
-
-inline void QOpenGLFunctions_4_1_Compatibility::glVertexAttribP4ui(GLuint index, GLenum type, GLboolean normalized, GLuint value)
-{
- d_3_3_Core->f.VertexAttribP4ui(index, type, normalized, value);
-}
-
-inline void QOpenGLFunctions_4_1_Compatibility::glVertexAttribP3uiv(GLuint index, GLenum type, GLboolean normalized, const GLuint *value)
-{
- d_3_3_Core->f.VertexAttribP3uiv(index, type, normalized, value);
-}
-
-inline void QOpenGLFunctions_4_1_Compatibility::glVertexAttribP3ui(GLuint index, GLenum type, GLboolean normalized, GLuint value)
-{
- d_3_3_Core->f.VertexAttribP3ui(index, type, normalized, value);
-}
-
-inline void QOpenGLFunctions_4_1_Compatibility::glVertexAttribP2uiv(GLuint index, GLenum type, GLboolean normalized, const GLuint *value)
-{
- d_3_3_Core->f.VertexAttribP2uiv(index, type, normalized, value);
-}
-
-inline void QOpenGLFunctions_4_1_Compatibility::glVertexAttribP2ui(GLuint index, GLenum type, GLboolean normalized, GLuint value)
-{
- d_3_3_Core->f.VertexAttribP2ui(index, type, normalized, value);
-}
-
-inline void QOpenGLFunctions_4_1_Compatibility::glVertexAttribP1uiv(GLuint index, GLenum type, GLboolean normalized, const GLuint *value)
-{
- d_3_3_Core->f.VertexAttribP1uiv(index, type, normalized, value);
-}
-
-inline void QOpenGLFunctions_4_1_Compatibility::glVertexAttribP1ui(GLuint index, GLenum type, GLboolean normalized, GLuint value)
-{
- d_3_3_Core->f.VertexAttribP1ui(index, type, normalized, value);
-}
-
-inline void QOpenGLFunctions_4_1_Compatibility::glSecondaryColorP3uiv(GLenum type, const GLuint *color)
-{
- d_3_3_Deprecated->f.SecondaryColorP3uiv(type, color);
-}
-
-inline void QOpenGLFunctions_4_1_Compatibility::glSecondaryColorP3ui(GLenum type, GLuint color)
-{
- d_3_3_Deprecated->f.SecondaryColorP3ui(type, color);
-}
-
-inline void QOpenGLFunctions_4_1_Compatibility::glColorP4uiv(GLenum type, const GLuint *color)
-{
- d_3_3_Deprecated->f.ColorP4uiv(type, color);
-}
-
-inline void QOpenGLFunctions_4_1_Compatibility::glColorP4ui(GLenum type, GLuint color)
-{
- d_3_3_Deprecated->f.ColorP4ui(type, color);
-}
-
-inline void QOpenGLFunctions_4_1_Compatibility::glColorP3uiv(GLenum type, const GLuint *color)
-{
- d_3_3_Deprecated->f.ColorP3uiv(type, color);
-}
-
-inline void QOpenGLFunctions_4_1_Compatibility::glColorP3ui(GLenum type, GLuint color)
-{
- d_3_3_Deprecated->f.ColorP3ui(type, color);
-}
-
-inline void QOpenGLFunctions_4_1_Compatibility::glNormalP3uiv(GLenum type, const GLuint *coords)
-{
- d_3_3_Deprecated->f.NormalP3uiv(type, coords);
-}
-
-inline void QOpenGLFunctions_4_1_Compatibility::glNormalP3ui(GLenum type, GLuint coords)
-{
- d_3_3_Deprecated->f.NormalP3ui(type, coords);
-}
-
-inline void QOpenGLFunctions_4_1_Compatibility::glMultiTexCoordP4uiv(GLenum texture, GLenum type, const GLuint *coords)
-{
- d_3_3_Deprecated->f.MultiTexCoordP4uiv(texture, type, coords);
-}
-
-inline void QOpenGLFunctions_4_1_Compatibility::glMultiTexCoordP4ui(GLenum texture, GLenum type, GLuint coords)
-{
- d_3_3_Deprecated->f.MultiTexCoordP4ui(texture, type, coords);
-}
-
-inline void QOpenGLFunctions_4_1_Compatibility::glMultiTexCoordP3uiv(GLenum texture, GLenum type, const GLuint *coords)
-{
- d_3_3_Deprecated->f.MultiTexCoordP3uiv(texture, type, coords);
-}
-
-inline void QOpenGLFunctions_4_1_Compatibility::glMultiTexCoordP3ui(GLenum texture, GLenum type, GLuint coords)
-{
- d_3_3_Deprecated->f.MultiTexCoordP3ui(texture, type, coords);
-}
-
-inline void QOpenGLFunctions_4_1_Compatibility::glMultiTexCoordP2uiv(GLenum texture, GLenum type, const GLuint *coords)
-{
- d_3_3_Deprecated->f.MultiTexCoordP2uiv(texture, type, coords);
-}
-
-inline void QOpenGLFunctions_4_1_Compatibility::glMultiTexCoordP2ui(GLenum texture, GLenum type, GLuint coords)
-{
- d_3_3_Deprecated->f.MultiTexCoordP2ui(texture, type, coords);
-}
-
-inline void QOpenGLFunctions_4_1_Compatibility::glMultiTexCoordP1uiv(GLenum texture, GLenum type, const GLuint *coords)
-{
- d_3_3_Deprecated->f.MultiTexCoordP1uiv(texture, type, coords);
-}
-
-inline void QOpenGLFunctions_4_1_Compatibility::glMultiTexCoordP1ui(GLenum texture, GLenum type, GLuint coords)
-{
- d_3_3_Deprecated->f.MultiTexCoordP1ui(texture, type, coords);
-}
-
-inline void QOpenGLFunctions_4_1_Compatibility::glTexCoordP4uiv(GLenum type, const GLuint *coords)
-{
- d_3_3_Deprecated->f.TexCoordP4uiv(type, coords);
-}
-
-inline void QOpenGLFunctions_4_1_Compatibility::glTexCoordP4ui(GLenum type, GLuint coords)
-{
- d_3_3_Deprecated->f.TexCoordP4ui(type, coords);
-}
-
-inline void QOpenGLFunctions_4_1_Compatibility::glTexCoordP3uiv(GLenum type, const GLuint *coords)
-{
- d_3_3_Deprecated->f.TexCoordP3uiv(type, coords);
-}
-
-inline void QOpenGLFunctions_4_1_Compatibility::glTexCoordP3ui(GLenum type, GLuint coords)
-{
- d_3_3_Deprecated->f.TexCoordP3ui(type, coords);
-}
-
-inline void QOpenGLFunctions_4_1_Compatibility::glTexCoordP2uiv(GLenum type, const GLuint *coords)
-{
- d_3_3_Deprecated->f.TexCoordP2uiv(type, coords);
-}
-
-inline void QOpenGLFunctions_4_1_Compatibility::glTexCoordP2ui(GLenum type, GLuint coords)
-{
- d_3_3_Deprecated->f.TexCoordP2ui(type, coords);
-}
-
-inline void QOpenGLFunctions_4_1_Compatibility::glTexCoordP1uiv(GLenum type, const GLuint *coords)
-{
- d_3_3_Deprecated->f.TexCoordP1uiv(type, coords);
-}
-
-inline void QOpenGLFunctions_4_1_Compatibility::glTexCoordP1ui(GLenum type, GLuint coords)
-{
- d_3_3_Deprecated->f.TexCoordP1ui(type, coords);
-}
-
-inline void QOpenGLFunctions_4_1_Compatibility::glVertexP4uiv(GLenum type, const GLuint *value)
-{
- d_3_3_Deprecated->f.VertexP4uiv(type, value);
-}
-
-inline void QOpenGLFunctions_4_1_Compatibility::glVertexP4ui(GLenum type, GLuint value)
-{
- d_3_3_Deprecated->f.VertexP4ui(type, value);
-}
-
-inline void QOpenGLFunctions_4_1_Compatibility::glVertexP3uiv(GLenum type, const GLuint *value)
-{
- d_3_3_Deprecated->f.VertexP3uiv(type, value);
-}
-
-inline void QOpenGLFunctions_4_1_Compatibility::glVertexP3ui(GLenum type, GLuint value)
-{
- d_3_3_Deprecated->f.VertexP3ui(type, value);
-}
-
-inline void QOpenGLFunctions_4_1_Compatibility::glVertexP2uiv(GLenum type, const GLuint *value)
-{
- d_3_3_Deprecated->f.VertexP2uiv(type, value);
-}
-
-inline void QOpenGLFunctions_4_1_Compatibility::glVertexP2ui(GLenum type, GLuint value)
-{
- d_3_3_Deprecated->f.VertexP2ui(type, value);
-}
-
-inline void QOpenGLFunctions_4_1_Compatibility::glGetQueryObjectui64v(GLuint id, GLenum pname, GLuint64 *params)
-{
- d_3_3_Core->f.GetQueryObjectui64v(id, pname, params);
-}
-
-inline void QOpenGLFunctions_4_1_Compatibility::glGetQueryObjecti64v(GLuint id, GLenum pname, GLint64 *params)
-{
- d_3_3_Core->f.GetQueryObjecti64v(id, pname, params);
-}
-
-inline void QOpenGLFunctions_4_1_Compatibility::glQueryCounter(GLuint id, GLenum target)
-{
- d_3_3_Core->f.QueryCounter(id, target);
-}
-
-inline void QOpenGLFunctions_4_1_Compatibility::glGetSamplerParameterIuiv(GLuint sampler, GLenum pname, GLuint *params)
-{
- d_3_3_Core->f.GetSamplerParameterIuiv(sampler, pname, params);
-}
-
-inline void QOpenGLFunctions_4_1_Compatibility::glGetSamplerParameterfv(GLuint sampler, GLenum pname, GLfloat *params)
-{
- d_3_3_Core->f.GetSamplerParameterfv(sampler, pname, params);
-}
-
-inline void QOpenGLFunctions_4_1_Compatibility::glGetSamplerParameterIiv(GLuint sampler, GLenum pname, GLint *params)
-{
- d_3_3_Core->f.GetSamplerParameterIiv(sampler, pname, params);
-}
-
-inline void QOpenGLFunctions_4_1_Compatibility::glGetSamplerParameteriv(GLuint sampler, GLenum pname, GLint *params)
-{
- d_3_3_Core->f.GetSamplerParameteriv(sampler, pname, params);
-}
-
-inline void QOpenGLFunctions_4_1_Compatibility::glSamplerParameterIuiv(GLuint sampler, GLenum pname, const GLuint *param)
-{
- d_3_3_Core->f.SamplerParameterIuiv(sampler, pname, param);
-}
-
-inline void QOpenGLFunctions_4_1_Compatibility::glSamplerParameterIiv(GLuint sampler, GLenum pname, const GLint *param)
-{
- d_3_3_Core->f.SamplerParameterIiv(sampler, pname, param);
-}
-
-inline void QOpenGLFunctions_4_1_Compatibility::glSamplerParameterfv(GLuint sampler, GLenum pname, const GLfloat *param)
-{
- d_3_3_Core->f.SamplerParameterfv(sampler, pname, param);
-}
-
-inline void QOpenGLFunctions_4_1_Compatibility::glSamplerParameterf(GLuint sampler, GLenum pname, GLfloat param)
-{
- d_3_3_Core->f.SamplerParameterf(sampler, pname, param);
-}
-
-inline void QOpenGLFunctions_4_1_Compatibility::glSamplerParameteriv(GLuint sampler, GLenum pname, const GLint *param)
-{
- d_3_3_Core->f.SamplerParameteriv(sampler, pname, param);
-}
-
-inline void QOpenGLFunctions_4_1_Compatibility::glSamplerParameteri(GLuint sampler, GLenum pname, GLint param)
-{
- d_3_3_Core->f.SamplerParameteri(sampler, pname, param);
-}
-
-inline void QOpenGLFunctions_4_1_Compatibility::glBindSampler(GLuint unit, GLuint sampler)
-{
- d_3_3_Core->f.BindSampler(unit, sampler);
-}
-
-inline GLboolean QOpenGLFunctions_4_1_Compatibility::glIsSampler(GLuint sampler)
-{
- return d_3_3_Core->f.IsSampler(sampler);
-}
-
-inline void QOpenGLFunctions_4_1_Compatibility::glDeleteSamplers(GLsizei count, const GLuint *samplers)
-{
- d_3_3_Core->f.DeleteSamplers(count, samplers);
-}
-
-inline void QOpenGLFunctions_4_1_Compatibility::glGenSamplers(GLsizei count, GLuint *samplers)
-{
- d_3_3_Core->f.GenSamplers(count, samplers);
-}
-
-inline GLint QOpenGLFunctions_4_1_Compatibility::glGetFragDataIndex(GLuint program, const GLchar *name)
-{
- return d_3_3_Core->f.GetFragDataIndex(program, name);
-}
-
-inline void QOpenGLFunctions_4_1_Compatibility::glBindFragDataLocationIndexed(GLuint program, GLuint colorNumber, GLuint index, const GLchar *name)
-{
- d_3_3_Core->f.BindFragDataLocationIndexed(program, colorNumber, index, name);
-}
-
-inline void QOpenGLFunctions_4_1_Compatibility::glVertexAttribDivisor(GLuint index, GLuint divisor)
-{
- d_3_3_Core->f.VertexAttribDivisor(index, divisor);
-}
-
-
-// OpenGL 4.0 core functions
-inline void QOpenGLFunctions_4_1_Compatibility::glGetQueryIndexediv(GLenum target, GLuint index, GLenum pname, GLint *params)
-{
- d_4_0_Core->f.GetQueryIndexediv(target, index, pname, params);
-}
-
-inline void QOpenGLFunctions_4_1_Compatibility::glEndQueryIndexed(GLenum target, GLuint index)
-{
- d_4_0_Core->f.EndQueryIndexed(target, index);
-}
-
-inline void QOpenGLFunctions_4_1_Compatibility::glBeginQueryIndexed(GLenum target, GLuint index, GLuint id)
-{
- d_4_0_Core->f.BeginQueryIndexed(target, index, id);
-}
-
-inline void QOpenGLFunctions_4_1_Compatibility::glDrawTransformFeedbackStream(GLenum mode, GLuint id, GLuint stream)
-{
- d_4_0_Core->f.DrawTransformFeedbackStream(mode, id, stream);
-}
-
-inline void QOpenGLFunctions_4_1_Compatibility::glDrawTransformFeedback(GLenum mode, GLuint id)
-{
- d_4_0_Core->f.DrawTransformFeedback(mode, id);
-}
-
-inline void QOpenGLFunctions_4_1_Compatibility::glResumeTransformFeedback()
-{
- d_4_0_Core->f.ResumeTransformFeedback();
-}
-
-inline void QOpenGLFunctions_4_1_Compatibility::glPauseTransformFeedback()
-{
- d_4_0_Core->f.PauseTransformFeedback();
-}
-
-inline GLboolean QOpenGLFunctions_4_1_Compatibility::glIsTransformFeedback(GLuint id)
-{
- return d_4_0_Core->f.IsTransformFeedback(id);
-}
-
-inline void QOpenGLFunctions_4_1_Compatibility::glGenTransformFeedbacks(GLsizei n, GLuint *ids)
-{
- d_4_0_Core->f.GenTransformFeedbacks(n, ids);
-}
-
-inline void QOpenGLFunctions_4_1_Compatibility::glDeleteTransformFeedbacks(GLsizei n, const GLuint *ids)
-{
- d_4_0_Core->f.DeleteTransformFeedbacks(n, ids);
-}
-
-inline void QOpenGLFunctions_4_1_Compatibility::glBindTransformFeedback(GLenum target, GLuint id)
-{
- d_4_0_Core->f.BindTransformFeedback(target, id);
-}
-
-inline void QOpenGLFunctions_4_1_Compatibility::glPatchParameterfv(GLenum pname, const GLfloat *values)
-{
- d_4_0_Core->f.PatchParameterfv(pname, values);
-}
-
-inline void QOpenGLFunctions_4_1_Compatibility::glPatchParameteri(GLenum pname, GLint value)
-{
- d_4_0_Core->f.PatchParameteri(pname, value);
-}
-
-inline void QOpenGLFunctions_4_1_Compatibility::glGetProgramStageiv(GLuint program, GLenum shadertype, GLenum pname, GLint *values)
-{
- d_4_0_Core->f.GetProgramStageiv(program, shadertype, pname, values);
-}
-
-inline void QOpenGLFunctions_4_1_Compatibility::glGetUniformSubroutineuiv(GLenum shadertype, GLint location, GLuint *params)
-{
- d_4_0_Core->f.GetUniformSubroutineuiv(shadertype, location, params);
-}
-
-inline void QOpenGLFunctions_4_1_Compatibility::glUniformSubroutinesuiv(GLenum shadertype, GLsizei count, const GLuint *indices)
-{
- d_4_0_Core->f.UniformSubroutinesuiv(shadertype, count, indices);
-}
-
-inline void QOpenGLFunctions_4_1_Compatibility::glGetActiveSubroutineName(GLuint program, GLenum shadertype, GLuint index, GLsizei bufsize, GLsizei *length, GLchar *name)
-{
- d_4_0_Core->f.GetActiveSubroutineName(program, shadertype, index, bufsize, length, name);
-}
-
-inline void QOpenGLFunctions_4_1_Compatibility::glGetActiveSubroutineUniformName(GLuint program, GLenum shadertype, GLuint index, GLsizei bufsize, GLsizei *length, GLchar *name)
-{
- d_4_0_Core->f.GetActiveSubroutineUniformName(program, shadertype, index, bufsize, length, name);
-}
-
-inline void QOpenGLFunctions_4_1_Compatibility::glGetActiveSubroutineUniformiv(GLuint program, GLenum shadertype, GLuint index, GLenum pname, GLint *values)
-{
- d_4_0_Core->f.GetActiveSubroutineUniformiv(program, shadertype, index, pname, values);
-}
-
-inline GLuint QOpenGLFunctions_4_1_Compatibility::glGetSubroutineIndex(GLuint program, GLenum shadertype, const GLchar *name)
-{
- return d_4_0_Core->f.GetSubroutineIndex(program, shadertype, name);
-}
-
-inline GLint QOpenGLFunctions_4_1_Compatibility::glGetSubroutineUniformLocation(GLuint program, GLenum shadertype, const GLchar *name)
-{
- return d_4_0_Core->f.GetSubroutineUniformLocation(program, shadertype, name);
-}
-
-inline void QOpenGLFunctions_4_1_Compatibility::glGetUniformdv(GLuint program, GLint location, GLdouble *params)
-{
- d_4_0_Core->f.GetUniformdv(program, location, params);
-}
-
-inline void QOpenGLFunctions_4_1_Compatibility::glUniformMatrix4x3dv(GLint location, GLsizei count, GLboolean transpose, const GLdouble *value)
-{
- d_4_0_Core->f.UniformMatrix4x3dv(location, count, transpose, value);
-}
-
-inline void QOpenGLFunctions_4_1_Compatibility::glUniformMatrix4x2dv(GLint location, GLsizei count, GLboolean transpose, const GLdouble *value)
-{
- d_4_0_Core->f.UniformMatrix4x2dv(location, count, transpose, value);
-}
-
-inline void QOpenGLFunctions_4_1_Compatibility::glUniformMatrix3x4dv(GLint location, GLsizei count, GLboolean transpose, const GLdouble *value)
-{
- d_4_0_Core->f.UniformMatrix3x4dv(location, count, transpose, value);
-}
-
-inline void QOpenGLFunctions_4_1_Compatibility::glUniformMatrix3x2dv(GLint location, GLsizei count, GLboolean transpose, const GLdouble *value)
-{
- d_4_0_Core->f.UniformMatrix3x2dv(location, count, transpose, value);
-}
-
-inline void QOpenGLFunctions_4_1_Compatibility::glUniformMatrix2x4dv(GLint location, GLsizei count, GLboolean transpose, const GLdouble *value)
-{
- d_4_0_Core->f.UniformMatrix2x4dv(location, count, transpose, value);
-}
-
-inline void QOpenGLFunctions_4_1_Compatibility::glUniformMatrix2x3dv(GLint location, GLsizei count, GLboolean transpose, const GLdouble *value)
-{
- d_4_0_Core->f.UniformMatrix2x3dv(location, count, transpose, value);
-}
-
-inline void QOpenGLFunctions_4_1_Compatibility::glUniformMatrix4dv(GLint location, GLsizei count, GLboolean transpose, const GLdouble *value)
-{
- d_4_0_Core->f.UniformMatrix4dv(location, count, transpose, value);
-}
-
-inline void QOpenGLFunctions_4_1_Compatibility::glUniformMatrix3dv(GLint location, GLsizei count, GLboolean transpose, const GLdouble *value)
-{
- d_4_0_Core->f.UniformMatrix3dv(location, count, transpose, value);
-}
-
-inline void QOpenGLFunctions_4_1_Compatibility::glUniformMatrix2dv(GLint location, GLsizei count, GLboolean transpose, const GLdouble *value)
-{
- d_4_0_Core->f.UniformMatrix2dv(location, count, transpose, value);
-}
-
-inline void QOpenGLFunctions_4_1_Compatibility::glUniform4dv(GLint location, GLsizei count, const GLdouble *value)
-{
- d_4_0_Core->f.Uniform4dv(location, count, value);
-}
-
-inline void QOpenGLFunctions_4_1_Compatibility::glUniform3dv(GLint location, GLsizei count, const GLdouble *value)
-{
- d_4_0_Core->f.Uniform3dv(location, count, value);
-}
-
-inline void QOpenGLFunctions_4_1_Compatibility::glUniform2dv(GLint location, GLsizei count, const GLdouble *value)
-{
- d_4_0_Core->f.Uniform2dv(location, count, value);
-}
-
-inline void QOpenGLFunctions_4_1_Compatibility::glUniform1dv(GLint location, GLsizei count, const GLdouble *value)
-{
- d_4_0_Core->f.Uniform1dv(location, count, value);
-}
-
-inline void QOpenGLFunctions_4_1_Compatibility::glUniform4d(GLint location, GLdouble x, GLdouble y, GLdouble z, GLdouble w)
-{
- d_4_0_Core->f.Uniform4d(location, x, y, z, w);
-}
-
-inline void QOpenGLFunctions_4_1_Compatibility::glUniform3d(GLint location, GLdouble x, GLdouble y, GLdouble z)
-{
- d_4_0_Core->f.Uniform3d(location, x, y, z);
-}
-
-inline void QOpenGLFunctions_4_1_Compatibility::glUniform2d(GLint location, GLdouble x, GLdouble y)
-{
- d_4_0_Core->f.Uniform2d(location, x, y);
-}
-
-inline void QOpenGLFunctions_4_1_Compatibility::glUniform1d(GLint location, GLdouble x)
-{
- d_4_0_Core->f.Uniform1d(location, x);
-}
-
-inline void QOpenGLFunctions_4_1_Compatibility::glDrawElementsIndirect(GLenum mode, GLenum type, const GLvoid *indirect)
-{
- d_4_0_Core->f.DrawElementsIndirect(mode, type, indirect);
-}
-
-inline void QOpenGLFunctions_4_1_Compatibility::glDrawArraysIndirect(GLenum mode, const GLvoid *indirect)
-{
- d_4_0_Core->f.DrawArraysIndirect(mode, indirect);
-}
-
-inline void QOpenGLFunctions_4_1_Compatibility::glBlendFuncSeparatei(GLuint buf, GLenum srcRGB, GLenum dstRGB, GLenum srcAlpha, GLenum dstAlpha)
-{
- d_4_0_Core->f.BlendFuncSeparatei(buf, srcRGB, dstRGB, srcAlpha, dstAlpha);
-}
-
-inline void QOpenGLFunctions_4_1_Compatibility::glBlendFunci(GLuint buf, GLenum src, GLenum dst)
-{
- d_4_0_Core->f.BlendFunci(buf, src, dst);
-}
-
-inline void QOpenGLFunctions_4_1_Compatibility::glBlendEquationSeparatei(GLuint buf, GLenum modeRGB, GLenum modeAlpha)
-{
- d_4_0_Core->f.BlendEquationSeparatei(buf, modeRGB, modeAlpha);
-}
-
-inline void QOpenGLFunctions_4_1_Compatibility::glBlendEquationi(GLuint buf, GLenum mode)
-{
- d_4_0_Core->f.BlendEquationi(buf, mode);
-}
-
-inline void QOpenGLFunctions_4_1_Compatibility::glMinSampleShading(GLfloat value)
-{
- d_4_0_Core->f.MinSampleShading(value);
-}
-
-
-// OpenGL 4.1 core functions
-inline void QOpenGLFunctions_4_1_Compatibility::glGetDoublei_v(GLenum target, GLuint index, GLdouble *data)
-{
- d_4_1_Core->f.GetDoublei_v(target, index, data);
-}
-
-inline void QOpenGLFunctions_4_1_Compatibility::glGetFloati_v(GLenum target, GLuint index, GLfloat *data)
-{
- d_4_1_Core->f.GetFloati_v(target, index, data);
-}
-
-inline void QOpenGLFunctions_4_1_Compatibility::glDepthRangeIndexed(GLuint index, GLdouble n, GLdouble f)
-{
- d_4_1_Core->f.DepthRangeIndexed(index, n, f);
-}
-
-inline void QOpenGLFunctions_4_1_Compatibility::glDepthRangeArrayv(GLuint first, GLsizei count, const GLdouble *v)
-{
- d_4_1_Core->f.DepthRangeArrayv(first, count, v);
-}
-
-inline void QOpenGLFunctions_4_1_Compatibility::glScissorIndexedv(GLuint index, const GLint *v)
-{
- d_4_1_Core->f.ScissorIndexedv(index, v);
-}
-
-inline void QOpenGLFunctions_4_1_Compatibility::glScissorIndexed(GLuint index, GLint left, GLint bottom, GLsizei width, GLsizei height)
-{
- d_4_1_Core->f.ScissorIndexed(index, left, bottom, width, height);
-}
-
-inline void QOpenGLFunctions_4_1_Compatibility::glScissorArrayv(GLuint first, GLsizei count, const GLint *v)
-{
- d_4_1_Core->f.ScissorArrayv(first, count, v);
-}
-
-inline void QOpenGLFunctions_4_1_Compatibility::glViewportIndexedfv(GLuint index, const GLfloat *v)
-{
- d_4_1_Core->f.ViewportIndexedfv(index, v);
-}
-
-inline void QOpenGLFunctions_4_1_Compatibility::glViewportIndexedf(GLuint index, GLfloat x, GLfloat y, GLfloat w, GLfloat h)
-{
- d_4_1_Core->f.ViewportIndexedf(index, x, y, w, h);
-}
-
-inline void QOpenGLFunctions_4_1_Compatibility::glViewportArrayv(GLuint first, GLsizei count, const GLfloat *v)
-{
- d_4_1_Core->f.ViewportArrayv(first, count, v);
-}
-
-inline void QOpenGLFunctions_4_1_Compatibility::glGetVertexAttribLdv(GLuint index, GLenum pname, GLdouble *params)
-{
- d_4_1_Core->f.GetVertexAttribLdv(index, pname, params);
-}
-
-inline void QOpenGLFunctions_4_1_Compatibility::glVertexAttribLPointer(GLuint index, GLint size, GLenum type, GLsizei stride, const GLvoid *pointer)
-{
- d_4_1_Core->f.VertexAttribLPointer(index, size, type, stride, pointer);
-}
-
-inline void QOpenGLFunctions_4_1_Compatibility::glVertexAttribL4dv(GLuint index, const GLdouble *v)
-{
- d_4_1_Core->f.VertexAttribL4dv(index, v);
-}
-
-inline void QOpenGLFunctions_4_1_Compatibility::glVertexAttribL3dv(GLuint index, const GLdouble *v)
-{
- d_4_1_Core->f.VertexAttribL3dv(index, v);
-}
-
-inline void QOpenGLFunctions_4_1_Compatibility::glVertexAttribL2dv(GLuint index, const GLdouble *v)
-{
- d_4_1_Core->f.VertexAttribL2dv(index, v);
-}
-
-inline void QOpenGLFunctions_4_1_Compatibility::glVertexAttribL1dv(GLuint index, const GLdouble *v)
-{
- d_4_1_Core->f.VertexAttribL1dv(index, v);
-}
-
-inline void QOpenGLFunctions_4_1_Compatibility::glVertexAttribL4d(GLuint index, GLdouble x, GLdouble y, GLdouble z, GLdouble w)
-{
- d_4_1_Core->f.VertexAttribL4d(index, x, y, z, w);
-}
-
-inline void QOpenGLFunctions_4_1_Compatibility::glVertexAttribL3d(GLuint index, GLdouble x, GLdouble y, GLdouble z)
-{
- d_4_1_Core->f.VertexAttribL3d(index, x, y, z);
-}
-
-inline void QOpenGLFunctions_4_1_Compatibility::glVertexAttribL2d(GLuint index, GLdouble x, GLdouble y)
-{
- d_4_1_Core->f.VertexAttribL2d(index, x, y);
-}
-
-inline void QOpenGLFunctions_4_1_Compatibility::glVertexAttribL1d(GLuint index, GLdouble x)
-{
- d_4_1_Core->f.VertexAttribL1d(index, x);
-}
-
-inline void QOpenGLFunctions_4_1_Compatibility::glGetProgramPipelineInfoLog(GLuint pipeline, GLsizei bufSize, GLsizei *length, GLchar *infoLog)
-{
- d_4_1_Core->f.GetProgramPipelineInfoLog(pipeline, bufSize, length, infoLog);
-}
-
-inline void QOpenGLFunctions_4_1_Compatibility::glValidateProgramPipeline(GLuint pipeline)
-{
- d_4_1_Core->f.ValidateProgramPipeline(pipeline);
-}
-
-inline void QOpenGLFunctions_4_1_Compatibility::glProgramUniformMatrix4x3dv(GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLdouble *value)
-{
- d_4_1_Core->f.ProgramUniformMatrix4x3dv(program, location, count, transpose, value);
-}
-
-inline void QOpenGLFunctions_4_1_Compatibility::glProgramUniformMatrix3x4dv(GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLdouble *value)
-{
- d_4_1_Core->f.ProgramUniformMatrix3x4dv(program, location, count, transpose, value);
-}
-
-inline void QOpenGLFunctions_4_1_Compatibility::glProgramUniformMatrix4x2dv(GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLdouble *value)
-{
- d_4_1_Core->f.ProgramUniformMatrix4x2dv(program, location, count, transpose, value);
-}
-
-inline void QOpenGLFunctions_4_1_Compatibility::glProgramUniformMatrix2x4dv(GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLdouble *value)
-{
- d_4_1_Core->f.ProgramUniformMatrix2x4dv(program, location, count, transpose, value);
-}
-
-inline void QOpenGLFunctions_4_1_Compatibility::glProgramUniformMatrix3x2dv(GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLdouble *value)
-{
- d_4_1_Core->f.ProgramUniformMatrix3x2dv(program, location, count, transpose, value);
-}
-
-inline void QOpenGLFunctions_4_1_Compatibility::glProgramUniformMatrix2x3dv(GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLdouble *value)
-{
- d_4_1_Core->f.ProgramUniformMatrix2x3dv(program, location, count, transpose, value);
-}
-
-inline void QOpenGLFunctions_4_1_Compatibility::glProgramUniformMatrix4x3fv(GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value)
-{
- d_4_1_Core->f.ProgramUniformMatrix4x3fv(program, location, count, transpose, value);
-}
-
-inline void QOpenGLFunctions_4_1_Compatibility::glProgramUniformMatrix3x4fv(GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value)
-{
- d_4_1_Core->f.ProgramUniformMatrix3x4fv(program, location, count, transpose, value);
-}
-
-inline void QOpenGLFunctions_4_1_Compatibility::glProgramUniformMatrix4x2fv(GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value)
-{
- d_4_1_Core->f.ProgramUniformMatrix4x2fv(program, location, count, transpose, value);
-}
-
-inline void QOpenGLFunctions_4_1_Compatibility::glProgramUniformMatrix2x4fv(GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value)
-{
- d_4_1_Core->f.ProgramUniformMatrix2x4fv(program, location, count, transpose, value);
-}
-
-inline void QOpenGLFunctions_4_1_Compatibility::glProgramUniformMatrix3x2fv(GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value)
-{
- d_4_1_Core->f.ProgramUniformMatrix3x2fv(program, location, count, transpose, value);
-}
-
-inline void QOpenGLFunctions_4_1_Compatibility::glProgramUniformMatrix2x3fv(GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value)
-{
- d_4_1_Core->f.ProgramUniformMatrix2x3fv(program, location, count, transpose, value);
-}
-
-inline void QOpenGLFunctions_4_1_Compatibility::glProgramUniformMatrix4dv(GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLdouble *value)
-{
- d_4_1_Core->f.ProgramUniformMatrix4dv(program, location, count, transpose, value);
-}
-
-inline void QOpenGLFunctions_4_1_Compatibility::glProgramUniformMatrix3dv(GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLdouble *value)
-{
- d_4_1_Core->f.ProgramUniformMatrix3dv(program, location, count, transpose, value);
-}
-
-inline void QOpenGLFunctions_4_1_Compatibility::glProgramUniformMatrix2dv(GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLdouble *value)
-{
- d_4_1_Core->f.ProgramUniformMatrix2dv(program, location, count, transpose, value);
-}
-
-inline void QOpenGLFunctions_4_1_Compatibility::glProgramUniformMatrix4fv(GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value)
-{
- d_4_1_Core->f.ProgramUniformMatrix4fv(program, location, count, transpose, value);
-}
-
-inline void QOpenGLFunctions_4_1_Compatibility::glProgramUniformMatrix3fv(GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value)
-{
- d_4_1_Core->f.ProgramUniformMatrix3fv(program, location, count, transpose, value);
-}
-
-inline void QOpenGLFunctions_4_1_Compatibility::glProgramUniformMatrix2fv(GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value)
-{
- d_4_1_Core->f.ProgramUniformMatrix2fv(program, location, count, transpose, value);
-}
-
-inline void QOpenGLFunctions_4_1_Compatibility::glProgramUniform4uiv(GLuint program, GLint location, GLsizei count, const GLuint *value)
-{
- d_4_1_Core->f.ProgramUniform4uiv(program, location, count, value);
-}
-
-inline void QOpenGLFunctions_4_1_Compatibility::glProgramUniform4ui(GLuint program, GLint location, GLuint v0, GLuint v1, GLuint v2, GLuint v3)
-{
- d_4_1_Core->f.ProgramUniform4ui(program, location, v0, v1, v2, v3);
-}
-
-inline void QOpenGLFunctions_4_1_Compatibility::glProgramUniform4dv(GLuint program, GLint location, GLsizei count, const GLdouble *value)
-{
- d_4_1_Core->f.ProgramUniform4dv(program, location, count, value);
-}
-
-inline void QOpenGLFunctions_4_1_Compatibility::glProgramUniform4d(GLuint program, GLint location, GLdouble v0, GLdouble v1, GLdouble v2, GLdouble v3)
-{
- d_4_1_Core->f.ProgramUniform4d(program, location, v0, v1, v2, v3);
-}
-
-inline void QOpenGLFunctions_4_1_Compatibility::glProgramUniform4fv(GLuint program, GLint location, GLsizei count, const GLfloat *value)
-{
- d_4_1_Core->f.ProgramUniform4fv(program, location, count, value);
-}
-
-inline void QOpenGLFunctions_4_1_Compatibility::glProgramUniform4f(GLuint program, GLint location, GLfloat v0, GLfloat v1, GLfloat v2, GLfloat v3)
-{
- d_4_1_Core->f.ProgramUniform4f(program, location, v0, v1, v2, v3);
-}
-
-inline void QOpenGLFunctions_4_1_Compatibility::glProgramUniform4iv(GLuint program, GLint location, GLsizei count, const GLint *value)
-{
- d_4_1_Core->f.ProgramUniform4iv(program, location, count, value);
-}
-
-inline void QOpenGLFunctions_4_1_Compatibility::glProgramUniform4i(GLuint program, GLint location, GLint v0, GLint v1, GLint v2, GLint v3)
-{
- d_4_1_Core->f.ProgramUniform4i(program, location, v0, v1, v2, v3);
-}
-
-inline void QOpenGLFunctions_4_1_Compatibility::glProgramUniform3uiv(GLuint program, GLint location, GLsizei count, const GLuint *value)
-{
- d_4_1_Core->f.ProgramUniform3uiv(program, location, count, value);
-}
-
-inline void QOpenGLFunctions_4_1_Compatibility::glProgramUniform3ui(GLuint program, GLint location, GLuint v0, GLuint v1, GLuint v2)
-{
- d_4_1_Core->f.ProgramUniform3ui(program, location, v0, v1, v2);
-}
-
-inline void QOpenGLFunctions_4_1_Compatibility::glProgramUniform3dv(GLuint program, GLint location, GLsizei count, const GLdouble *value)
-{
- d_4_1_Core->f.ProgramUniform3dv(program, location, count, value);
-}
-
-inline void QOpenGLFunctions_4_1_Compatibility::glProgramUniform3d(GLuint program, GLint location, GLdouble v0, GLdouble v1, GLdouble v2)
-{
- d_4_1_Core->f.ProgramUniform3d(program, location, v0, v1, v2);
-}
-
-inline void QOpenGLFunctions_4_1_Compatibility::glProgramUniform3fv(GLuint program, GLint location, GLsizei count, const GLfloat *value)
-{
- d_4_1_Core->f.ProgramUniform3fv(program, location, count, value);
-}
-
-inline void QOpenGLFunctions_4_1_Compatibility::glProgramUniform3f(GLuint program, GLint location, GLfloat v0, GLfloat v1, GLfloat v2)
-{
- d_4_1_Core->f.ProgramUniform3f(program, location, v0, v1, v2);
-}
-
-inline void QOpenGLFunctions_4_1_Compatibility::glProgramUniform3iv(GLuint program, GLint location, GLsizei count, const GLint *value)
-{
- d_4_1_Core->f.ProgramUniform3iv(program, location, count, value);
-}
-
-inline void QOpenGLFunctions_4_1_Compatibility::glProgramUniform3i(GLuint program, GLint location, GLint v0, GLint v1, GLint v2)
-{
- d_4_1_Core->f.ProgramUniform3i(program, location, v0, v1, v2);
-}
-
-inline void QOpenGLFunctions_4_1_Compatibility::glProgramUniform2uiv(GLuint program, GLint location, GLsizei count, const GLuint *value)
-{
- d_4_1_Core->f.ProgramUniform2uiv(program, location, count, value);
-}
-
-inline void QOpenGLFunctions_4_1_Compatibility::glProgramUniform2ui(GLuint program, GLint location, GLuint v0, GLuint v1)
-{
- d_4_1_Core->f.ProgramUniform2ui(program, location, v0, v1);
-}
-
-inline void QOpenGLFunctions_4_1_Compatibility::glProgramUniform2dv(GLuint program, GLint location, GLsizei count, const GLdouble *value)
-{
- d_4_1_Core->f.ProgramUniform2dv(program, location, count, value);
-}
-
-inline void QOpenGLFunctions_4_1_Compatibility::glProgramUniform2d(GLuint program, GLint location, GLdouble v0, GLdouble v1)
-{
- d_4_1_Core->f.ProgramUniform2d(program, location, v0, v1);
-}
-
-inline void QOpenGLFunctions_4_1_Compatibility::glProgramUniform2fv(GLuint program, GLint location, GLsizei count, const GLfloat *value)
-{
- d_4_1_Core->f.ProgramUniform2fv(program, location, count, value);
-}
-
-inline void QOpenGLFunctions_4_1_Compatibility::glProgramUniform2f(GLuint program, GLint location, GLfloat v0, GLfloat v1)
-{
- d_4_1_Core->f.ProgramUniform2f(program, location, v0, v1);
-}
-
-inline void QOpenGLFunctions_4_1_Compatibility::glProgramUniform2iv(GLuint program, GLint location, GLsizei count, const GLint *value)
-{
- d_4_1_Core->f.ProgramUniform2iv(program, location, count, value);
-}
-
-inline void QOpenGLFunctions_4_1_Compatibility::glProgramUniform2i(GLuint program, GLint location, GLint v0, GLint v1)
-{
- d_4_1_Core->f.ProgramUniform2i(program, location, v0, v1);
-}
-
-inline void QOpenGLFunctions_4_1_Compatibility::glProgramUniform1uiv(GLuint program, GLint location, GLsizei count, const GLuint *value)
-{
- d_4_1_Core->f.ProgramUniform1uiv(program, location, count, value);
-}
-
-inline void QOpenGLFunctions_4_1_Compatibility::glProgramUniform1ui(GLuint program, GLint location, GLuint v0)
-{
- d_4_1_Core->f.ProgramUniform1ui(program, location, v0);
-}
-
-inline void QOpenGLFunctions_4_1_Compatibility::glProgramUniform1dv(GLuint program, GLint location, GLsizei count, const GLdouble *value)
-{
- d_4_1_Core->f.ProgramUniform1dv(program, location, count, value);
-}
-
-inline void QOpenGLFunctions_4_1_Compatibility::glProgramUniform1d(GLuint program, GLint location, GLdouble v0)
-{
- d_4_1_Core->f.ProgramUniform1d(program, location, v0);
-}
-
-inline void QOpenGLFunctions_4_1_Compatibility::glProgramUniform1fv(GLuint program, GLint location, GLsizei count, const GLfloat *value)
-{
- d_4_1_Core->f.ProgramUniform1fv(program, location, count, value);
-}
-
-inline void QOpenGLFunctions_4_1_Compatibility::glProgramUniform1f(GLuint program, GLint location, GLfloat v0)
-{
- d_4_1_Core->f.ProgramUniform1f(program, location, v0);
-}
-
-inline void QOpenGLFunctions_4_1_Compatibility::glProgramUniform1iv(GLuint program, GLint location, GLsizei count, const GLint *value)
-{
- d_4_1_Core->f.ProgramUniform1iv(program, location, count, value);
-}
-
-inline void QOpenGLFunctions_4_1_Compatibility::glProgramUniform1i(GLuint program, GLint location, GLint v0)
-{
- d_4_1_Core->f.ProgramUniform1i(program, location, v0);
-}
-
-inline void QOpenGLFunctions_4_1_Compatibility::glGetProgramPipelineiv(GLuint pipeline, GLenum pname, GLint *params)
-{
- d_4_1_Core->f.GetProgramPipelineiv(pipeline, pname, params);
-}
-
-inline GLboolean QOpenGLFunctions_4_1_Compatibility::glIsProgramPipeline(GLuint pipeline)
-{
- return d_4_1_Core->f.IsProgramPipeline(pipeline);
-}
-
-inline void QOpenGLFunctions_4_1_Compatibility::glGenProgramPipelines(GLsizei n, GLuint *pipelines)
-{
- d_4_1_Core->f.GenProgramPipelines(n, pipelines);
-}
-
-inline void QOpenGLFunctions_4_1_Compatibility::glDeleteProgramPipelines(GLsizei n, const GLuint *pipelines)
-{
- d_4_1_Core->f.DeleteProgramPipelines(n, pipelines);
-}
-
-inline void QOpenGLFunctions_4_1_Compatibility::glBindProgramPipeline(GLuint pipeline)
-{
- d_4_1_Core->f.BindProgramPipeline(pipeline);
-}
-
-inline GLuint QOpenGLFunctions_4_1_Compatibility::glCreateShaderProgramv(GLenum type, GLsizei count, const GLchar* const *strings)
-{
- return d_4_1_Core->f.CreateShaderProgramv(type, count, strings);
-}
-
-inline void QOpenGLFunctions_4_1_Compatibility::glActiveShaderProgram(GLuint pipeline, GLuint program)
-{
- d_4_1_Core->f.ActiveShaderProgram(pipeline, program);
-}
-
-inline void QOpenGLFunctions_4_1_Compatibility::glUseProgramStages(GLuint pipeline, GLbitfield stages, GLuint program)
-{
- d_4_1_Core->f.UseProgramStages(pipeline, stages, program);
-}
-
-inline void QOpenGLFunctions_4_1_Compatibility::glProgramParameteri(GLuint program, GLenum pname, GLint value)
-{
- d_4_1_Core->f.ProgramParameteri(program, pname, value);
-}
-
-inline void QOpenGLFunctions_4_1_Compatibility::glProgramBinary(GLuint program, GLenum binaryFormat, const GLvoid *binary, GLsizei length)
-{
- d_4_1_Core->f.ProgramBinary(program, binaryFormat, binary, length);
-}
-
-inline void QOpenGLFunctions_4_1_Compatibility::glGetProgramBinary(GLuint program, GLsizei bufSize, GLsizei *length, GLenum *binaryFormat, GLvoid *binary)
-{
- d_4_1_Core->f.GetProgramBinary(program, bufSize, length, binaryFormat, binary);
-}
-
-inline void QOpenGLFunctions_4_1_Compatibility::glClearDepthf(GLfloat dd)
-{
- d_4_1_Core->f.ClearDepthf(dd);
-}
-
-inline void QOpenGLFunctions_4_1_Compatibility::glDepthRangef(GLfloat n, GLfloat f)
-{
- d_4_1_Core->f.DepthRangef(n, f);
-}
-
-inline void QOpenGLFunctions_4_1_Compatibility::glGetShaderPrecisionFormat(GLenum shadertype, GLenum precisiontype, GLint *range, GLint *precision)
-{
- d_4_1_Core->f.GetShaderPrecisionFormat(shadertype, precisiontype, range, precision);
-}
-
-inline void QOpenGLFunctions_4_1_Compatibility::glShaderBinary(GLsizei count, const GLuint *shaders, GLenum binaryformat, const GLvoid *binary, GLsizei length)
-{
- d_4_1_Core->f.ShaderBinary(count, shaders, binaryformat, binary, length);
-}
-
-inline void QOpenGLFunctions_4_1_Compatibility::glReleaseShaderCompiler()
-{
- d_4_1_Core->f.ReleaseShaderCompiler();
-}
-
-
-// OpenGL 1.0 deprecated functions
-inline void QOpenGLFunctions_4_1_Compatibility::glTranslatef(GLfloat x, GLfloat y, GLfloat z)
-{
- d_1_0_Deprecated->f.Translatef(x, y, z);
-}
-
-inline void QOpenGLFunctions_4_1_Compatibility::glTranslated(GLdouble x, GLdouble y, GLdouble z)
-{
- d_1_0_Deprecated->f.Translated(x, y, z);
-}
-
-inline void QOpenGLFunctions_4_1_Compatibility::glScalef(GLfloat x, GLfloat y, GLfloat z)
-{
- d_1_0_Deprecated->f.Scalef(x, y, z);
-}
-
-inline void QOpenGLFunctions_4_1_Compatibility::glScaled(GLdouble x, GLdouble y, GLdouble z)
-{
- d_1_0_Deprecated->f.Scaled(x, y, z);
-}
-
-inline void QOpenGLFunctions_4_1_Compatibility::glRotatef(GLfloat angle, GLfloat x, GLfloat y, GLfloat z)
-{
- d_1_0_Deprecated->f.Rotatef(angle, x, y, z);
-}
-
-inline void QOpenGLFunctions_4_1_Compatibility::glRotated(GLdouble angle, GLdouble x, GLdouble y, GLdouble z)
-{
- d_1_0_Deprecated->f.Rotated(angle, x, y, z);
-}
-
-inline void QOpenGLFunctions_4_1_Compatibility::glPushMatrix()
-{
- d_1_0_Deprecated->f.PushMatrix();
-}
-
-inline void QOpenGLFunctions_4_1_Compatibility::glPopMatrix()
-{
- d_1_0_Deprecated->f.PopMatrix();
-}
-
-inline void QOpenGLFunctions_4_1_Compatibility::glOrtho(GLdouble left, GLdouble right, GLdouble bottom, GLdouble top, GLdouble zNear, GLdouble zFar)
-{
- d_1_0_Deprecated->f.Ortho(left, right, bottom, top, zNear, zFar);
-}
-
-inline void QOpenGLFunctions_4_1_Compatibility::glMultMatrixd(const GLdouble *m)
-{
- d_1_0_Deprecated->f.MultMatrixd(m);
-}
-
-inline void QOpenGLFunctions_4_1_Compatibility::glMultMatrixf(const GLfloat *m)
-{
- d_1_0_Deprecated->f.MultMatrixf(m);
-}
-
-inline void QOpenGLFunctions_4_1_Compatibility::glMatrixMode(GLenum mode)
-{
- d_1_0_Deprecated->f.MatrixMode(mode);
-}
-
-inline void QOpenGLFunctions_4_1_Compatibility::glLoadMatrixd(const GLdouble *m)
-{
- d_1_0_Deprecated->f.LoadMatrixd(m);
-}
-
-inline void QOpenGLFunctions_4_1_Compatibility::glLoadMatrixf(const GLfloat *m)
-{
- d_1_0_Deprecated->f.LoadMatrixf(m);
-}
-
-inline void QOpenGLFunctions_4_1_Compatibility::glLoadIdentity()
-{
- d_1_0_Deprecated->f.LoadIdentity();
-}
-
-inline void QOpenGLFunctions_4_1_Compatibility::glFrustum(GLdouble left, GLdouble right, GLdouble bottom, GLdouble top, GLdouble zNear, GLdouble zFar)
-{
- d_1_0_Deprecated->f.Frustum(left, right, bottom, top, zNear, zFar);
-}
-
-inline GLboolean QOpenGLFunctions_4_1_Compatibility::glIsList(GLuint list)
-{
- return d_1_0_Deprecated->f.IsList(list);
-}
-
-inline void QOpenGLFunctions_4_1_Compatibility::glGetTexGeniv(GLenum coord, GLenum pname, GLint *params)
-{
- d_1_0_Deprecated->f.GetTexGeniv(coord, pname, params);
-}
-
-inline void QOpenGLFunctions_4_1_Compatibility::glGetTexGenfv(GLenum coord, GLenum pname, GLfloat *params)
-{
- d_1_0_Deprecated->f.GetTexGenfv(coord, pname, params);
-}
-
-inline void QOpenGLFunctions_4_1_Compatibility::glGetTexGendv(GLenum coord, GLenum pname, GLdouble *params)
-{
- d_1_0_Deprecated->f.GetTexGendv(coord, pname, params);
-}
-
-inline void QOpenGLFunctions_4_1_Compatibility::glGetTexEnviv(GLenum target, GLenum pname, GLint *params)
-{
- d_1_0_Deprecated->f.GetTexEnviv(target, pname, params);
-}
-
-inline void QOpenGLFunctions_4_1_Compatibility::glGetTexEnvfv(GLenum target, GLenum pname, GLfloat *params)
-{
- d_1_0_Deprecated->f.GetTexEnvfv(target, pname, params);
-}
-
-inline void QOpenGLFunctions_4_1_Compatibility::glGetPolygonStipple(GLubyte *mask)
-{
- d_1_0_Deprecated->f.GetPolygonStipple(mask);
-}
-
-inline void QOpenGLFunctions_4_1_Compatibility::glGetPixelMapusv(GLenum map, GLushort *values)
-{
- d_1_0_Deprecated->f.GetPixelMapusv(map, values);
-}
-
-inline void QOpenGLFunctions_4_1_Compatibility::glGetPixelMapuiv(GLenum map, GLuint *values)
-{
- d_1_0_Deprecated->f.GetPixelMapuiv(map, values);
-}
-
-inline void QOpenGLFunctions_4_1_Compatibility::glGetPixelMapfv(GLenum map, GLfloat *values)
-{
- d_1_0_Deprecated->f.GetPixelMapfv(map, values);
-}
-
-inline void QOpenGLFunctions_4_1_Compatibility::glGetMaterialiv(GLenum face, GLenum pname, GLint *params)
-{
- d_1_0_Deprecated->f.GetMaterialiv(face, pname, params);
-}
-
-inline void QOpenGLFunctions_4_1_Compatibility::glGetMaterialfv(GLenum face, GLenum pname, GLfloat *params)
-{
- d_1_0_Deprecated->f.GetMaterialfv(face, pname, params);
-}
-
-inline void QOpenGLFunctions_4_1_Compatibility::glGetMapiv(GLenum target, GLenum query, GLint *v)
-{
- d_1_0_Deprecated->f.GetMapiv(target, query, v);
-}
-
-inline void QOpenGLFunctions_4_1_Compatibility::glGetMapfv(GLenum target, GLenum query, GLfloat *v)
-{
- d_1_0_Deprecated->f.GetMapfv(target, query, v);
-}
-
-inline void QOpenGLFunctions_4_1_Compatibility::glGetMapdv(GLenum target, GLenum query, GLdouble *v)
-{
- d_1_0_Deprecated->f.GetMapdv(target, query, v);
-}
-
-inline void QOpenGLFunctions_4_1_Compatibility::glGetLightiv(GLenum light, GLenum pname, GLint *params)
-{
- d_1_0_Deprecated->f.GetLightiv(light, pname, params);
-}
-
-inline void QOpenGLFunctions_4_1_Compatibility::glGetLightfv(GLenum light, GLenum pname, GLfloat *params)
-{
- d_1_0_Deprecated->f.GetLightfv(light, pname, params);
-}
-
-inline void QOpenGLFunctions_4_1_Compatibility::glGetClipPlane(GLenum plane, GLdouble *equation)
-{
- d_1_0_Deprecated->f.GetClipPlane(plane, equation);
-}
-
-inline void QOpenGLFunctions_4_1_Compatibility::glDrawPixels(GLsizei width, GLsizei height, GLenum format, GLenum type, const GLvoid *pixels)
-{
- d_1_0_Deprecated->f.DrawPixels(width, height, format, type, pixels);
-}
-
-inline void QOpenGLFunctions_4_1_Compatibility::glCopyPixels(GLint x, GLint y, GLsizei width, GLsizei height, GLenum type)
-{
- d_1_0_Deprecated->f.CopyPixels(x, y, width, height, type);
-}
-
-inline void QOpenGLFunctions_4_1_Compatibility::glPixelMapusv(GLenum map, GLint mapsize, const GLushort *values)
-{
- d_1_0_Deprecated->f.PixelMapusv(map, mapsize, values);
-}
-
-inline void QOpenGLFunctions_4_1_Compatibility::glPixelMapuiv(GLenum map, GLint mapsize, const GLuint *values)
-{
- d_1_0_Deprecated->f.PixelMapuiv(map, mapsize, values);
-}
-
-inline void QOpenGLFunctions_4_1_Compatibility::glPixelMapfv(GLenum map, GLint mapsize, const GLfloat *values)
-{
- d_1_0_Deprecated->f.PixelMapfv(map, mapsize, values);
-}
-
-inline void QOpenGLFunctions_4_1_Compatibility::glPixelTransferi(GLenum pname, GLint param)
-{
- d_1_0_Deprecated->f.PixelTransferi(pname, param);
-}
-
-inline void QOpenGLFunctions_4_1_Compatibility::glPixelTransferf(GLenum pname, GLfloat param)
-{
- d_1_0_Deprecated->f.PixelTransferf(pname, param);
-}
-
-inline void QOpenGLFunctions_4_1_Compatibility::glPixelZoom(GLfloat xfactor, GLfloat yfactor)
-{
- d_1_0_Deprecated->f.PixelZoom(xfactor, yfactor);
-}
-
-inline void QOpenGLFunctions_4_1_Compatibility::glAlphaFunc(GLenum func, GLfloat ref)
-{
- d_1_0_Deprecated->f.AlphaFunc(func, ref);
-}
-
-inline void QOpenGLFunctions_4_1_Compatibility::glEvalPoint2(GLint i, GLint j)
-{
- d_1_0_Deprecated->f.EvalPoint2(i, j);
-}
-
-inline void QOpenGLFunctions_4_1_Compatibility::glEvalMesh2(GLenum mode, GLint i1, GLint i2, GLint j1, GLint j2)
-{
- d_1_0_Deprecated->f.EvalMesh2(mode, i1, i2, j1, j2);
-}
-
-inline void QOpenGLFunctions_4_1_Compatibility::glEvalPoint1(GLint i)
-{
- d_1_0_Deprecated->f.EvalPoint1(i);
-}
-
-inline void QOpenGLFunctions_4_1_Compatibility::glEvalMesh1(GLenum mode, GLint i1, GLint i2)
-{
- d_1_0_Deprecated->f.EvalMesh1(mode, i1, i2);
-}
-
-inline void QOpenGLFunctions_4_1_Compatibility::glEvalCoord2fv(const GLfloat *u)
-{
- d_1_0_Deprecated->f.EvalCoord2fv(u);
-}
-
-inline void QOpenGLFunctions_4_1_Compatibility::glEvalCoord2f(GLfloat u, GLfloat v)
-{
- d_1_0_Deprecated->f.EvalCoord2f(u, v);
-}
-
-inline void QOpenGLFunctions_4_1_Compatibility::glEvalCoord2dv(const GLdouble *u)
-{
- d_1_0_Deprecated->f.EvalCoord2dv(u);
-}
-
-inline void QOpenGLFunctions_4_1_Compatibility::glEvalCoord2d(GLdouble u, GLdouble v)
-{
- d_1_0_Deprecated->f.EvalCoord2d(u, v);
-}
-
-inline void QOpenGLFunctions_4_1_Compatibility::glEvalCoord1fv(const GLfloat *u)
-{
- d_1_0_Deprecated->f.EvalCoord1fv(u);
-}
-
-inline void QOpenGLFunctions_4_1_Compatibility::glEvalCoord1f(GLfloat u)
-{
- d_1_0_Deprecated->f.EvalCoord1f(u);
-}
-
-inline void QOpenGLFunctions_4_1_Compatibility::glEvalCoord1dv(const GLdouble *u)
-{
- d_1_0_Deprecated->f.EvalCoord1dv(u);
-}
-
-inline void QOpenGLFunctions_4_1_Compatibility::glEvalCoord1d(GLdouble u)
-{
- d_1_0_Deprecated->f.EvalCoord1d(u);
-}
-
-inline void QOpenGLFunctions_4_1_Compatibility::glMapGrid2f(GLint un, GLfloat u1, GLfloat u2, GLint vn, GLfloat v1, GLfloat v2)
-{
- d_1_0_Deprecated->f.MapGrid2f(un, u1, u2, vn, v1, v2);
-}
-
-inline void QOpenGLFunctions_4_1_Compatibility::glMapGrid2d(GLint un, GLdouble u1, GLdouble u2, GLint vn, GLdouble v1, GLdouble v2)
-{
- d_1_0_Deprecated->f.MapGrid2d(un, u1, u2, vn, v1, v2);
-}
-
-inline void QOpenGLFunctions_4_1_Compatibility::glMapGrid1f(GLint un, GLfloat u1, GLfloat u2)
-{
- d_1_0_Deprecated->f.MapGrid1f(un, u1, u2);
-}
-
-inline void QOpenGLFunctions_4_1_Compatibility::glMapGrid1d(GLint un, GLdouble u1, GLdouble u2)
-{
- d_1_0_Deprecated->f.MapGrid1d(un, u1, u2);
-}
-
-inline void QOpenGLFunctions_4_1_Compatibility::glMap2f(GLenum target, GLfloat u1, GLfloat u2, GLint ustride, GLint uorder, GLfloat v1, GLfloat v2, GLint vstride, GLint vorder, const GLfloat *points)
-{
- d_1_0_Deprecated->f.Map2f(target, u1, u2, ustride, uorder, v1, v2, vstride, vorder, points);
-}
-
-inline void QOpenGLFunctions_4_1_Compatibility::glMap2d(GLenum target, GLdouble u1, GLdouble u2, GLint ustride, GLint uorder, GLdouble v1, GLdouble v2, GLint vstride, GLint vorder, const GLdouble *points)
-{
- d_1_0_Deprecated->f.Map2d(target, u1, u2, ustride, uorder, v1, v2, vstride, vorder, points);
-}
-
-inline void QOpenGLFunctions_4_1_Compatibility::glMap1f(GLenum target, GLfloat u1, GLfloat u2, GLint stride, GLint order, const GLfloat *points)
-{
- d_1_0_Deprecated->f.Map1f(target, u1, u2, stride, order, points);
-}
-
-inline void QOpenGLFunctions_4_1_Compatibility::glMap1d(GLenum target, GLdouble u1, GLdouble u2, GLint stride, GLint order, const GLdouble *points)
-{
- d_1_0_Deprecated->f.Map1d(target, u1, u2, stride, order, points);
-}
-
-inline void QOpenGLFunctions_4_1_Compatibility::glPushAttrib(GLbitfield mask)
-{
- d_1_0_Deprecated->f.PushAttrib(mask);
-}
-
-inline void QOpenGLFunctions_4_1_Compatibility::glPopAttrib()
-{
- d_1_0_Deprecated->f.PopAttrib();
-}
-
-inline void QOpenGLFunctions_4_1_Compatibility::glAccum(GLenum op, GLfloat value)
-{
- d_1_0_Deprecated->f.Accum(op, value);
-}
-
-inline void QOpenGLFunctions_4_1_Compatibility::glIndexMask(GLuint mask)
-{
- d_1_0_Deprecated->f.IndexMask(mask);
-}
-
-inline void QOpenGLFunctions_4_1_Compatibility::glClearIndex(GLfloat c)
-{
- d_1_0_Deprecated->f.ClearIndex(c);
-}
-
-inline void QOpenGLFunctions_4_1_Compatibility::glClearAccum(GLfloat red, GLfloat green, GLfloat blue, GLfloat alpha)
-{
- d_1_0_Deprecated->f.ClearAccum(red, green, blue, alpha);
-}
-
-inline void QOpenGLFunctions_4_1_Compatibility::glPushName(GLuint name)
-{
- d_1_0_Deprecated->f.PushName(name);
-}
-
-inline void QOpenGLFunctions_4_1_Compatibility::glPopName()
-{
- d_1_0_Deprecated->f.PopName();
-}
-
-inline void QOpenGLFunctions_4_1_Compatibility::glPassThrough(GLfloat token)
-{
- d_1_0_Deprecated->f.PassThrough(token);
-}
-
-inline void QOpenGLFunctions_4_1_Compatibility::glLoadName(GLuint name)
-{
- d_1_0_Deprecated->f.LoadName(name);
-}
-
-inline void QOpenGLFunctions_4_1_Compatibility::glInitNames()
-{
- d_1_0_Deprecated->f.InitNames();
-}
-
-inline GLint QOpenGLFunctions_4_1_Compatibility::glRenderMode(GLenum mode)
-{
- return d_1_0_Deprecated->f.RenderMode(mode);
-}
-
-inline void QOpenGLFunctions_4_1_Compatibility::glSelectBuffer(GLsizei size, GLuint *buffer)
-{
- d_1_0_Deprecated->f.SelectBuffer(size, buffer);
-}
-
-inline void QOpenGLFunctions_4_1_Compatibility::glFeedbackBuffer(GLsizei size, GLenum type, GLfloat *buffer)
-{
- d_1_0_Deprecated->f.FeedbackBuffer(size, type, buffer);
-}
-
-inline void QOpenGLFunctions_4_1_Compatibility::glTexGeniv(GLenum coord, GLenum pname, const GLint *params)
-{
- d_1_0_Deprecated->f.TexGeniv(coord, pname, params);
-}
-
-inline void QOpenGLFunctions_4_1_Compatibility::glTexGeni(GLenum coord, GLenum pname, GLint param)
-{
- d_1_0_Deprecated->f.TexGeni(coord, pname, param);
-}
-
-inline void QOpenGLFunctions_4_1_Compatibility::glTexGenfv(GLenum coord, GLenum pname, const GLfloat *params)
-{
- d_1_0_Deprecated->f.TexGenfv(coord, pname, params);
-}
-
-inline void QOpenGLFunctions_4_1_Compatibility::glTexGenf(GLenum coord, GLenum pname, GLfloat param)
-{
- d_1_0_Deprecated->f.TexGenf(coord, pname, param);
-}
-
-inline void QOpenGLFunctions_4_1_Compatibility::glTexGendv(GLenum coord, GLenum pname, const GLdouble *params)
-{
- d_1_0_Deprecated->f.TexGendv(coord, pname, params);
-}
-
-inline void QOpenGLFunctions_4_1_Compatibility::glTexGend(GLenum coord, GLenum pname, GLdouble param)
-{
- d_1_0_Deprecated->f.TexGend(coord, pname, param);
-}
-
-inline void QOpenGLFunctions_4_1_Compatibility::glTexEnviv(GLenum target, GLenum pname, const GLint *params)
-{
- d_1_0_Deprecated->f.TexEnviv(target, pname, params);
-}
-
-inline void QOpenGLFunctions_4_1_Compatibility::glTexEnvi(GLenum target, GLenum pname, GLint param)
-{
- d_1_0_Deprecated->f.TexEnvi(target, pname, param);
-}
-
-inline void QOpenGLFunctions_4_1_Compatibility::glTexEnvfv(GLenum target, GLenum pname, const GLfloat *params)
-{
- d_1_0_Deprecated->f.TexEnvfv(target, pname, params);
-}
-
-inline void QOpenGLFunctions_4_1_Compatibility::glTexEnvf(GLenum target, GLenum pname, GLfloat param)
-{
- d_1_0_Deprecated->f.TexEnvf(target, pname, param);
-}
-
-inline void QOpenGLFunctions_4_1_Compatibility::glShadeModel(GLenum mode)
-{
- d_1_0_Deprecated->f.ShadeModel(mode);
-}
-
-inline void QOpenGLFunctions_4_1_Compatibility::glPolygonStipple(const GLubyte *mask)
-{
- d_1_0_Deprecated->f.PolygonStipple(mask);
-}
-
-inline void QOpenGLFunctions_4_1_Compatibility::glMaterialiv(GLenum face, GLenum pname, const GLint *params)
-{
- d_1_0_Deprecated->f.Materialiv(face, pname, params);
-}
-
-inline void QOpenGLFunctions_4_1_Compatibility::glMateriali(GLenum face, GLenum pname, GLint param)
-{
- d_1_0_Deprecated->f.Materiali(face, pname, param);
-}
-
-inline void QOpenGLFunctions_4_1_Compatibility::glMaterialfv(GLenum face, GLenum pname, const GLfloat *params)
-{
- d_1_0_Deprecated->f.Materialfv(face, pname, params);
-}
-
-inline void QOpenGLFunctions_4_1_Compatibility::glMaterialf(GLenum face, GLenum pname, GLfloat param)
-{
- d_1_0_Deprecated->f.Materialf(face, pname, param);
-}
-
-inline void QOpenGLFunctions_4_1_Compatibility::glLineStipple(GLint factor, GLushort pattern)
-{
- d_1_0_Deprecated->f.LineStipple(factor, pattern);
-}
-
-inline void QOpenGLFunctions_4_1_Compatibility::glLightModeliv(GLenum pname, const GLint *params)
-{
- d_1_0_Deprecated->f.LightModeliv(pname, params);
-}
-
-inline void QOpenGLFunctions_4_1_Compatibility::glLightModeli(GLenum pname, GLint param)
-{
- d_1_0_Deprecated->f.LightModeli(pname, param);
-}
-
-inline void QOpenGLFunctions_4_1_Compatibility::glLightModelfv(GLenum pname, const GLfloat *params)
-{
- d_1_0_Deprecated->f.LightModelfv(pname, params);
-}
-
-inline void QOpenGLFunctions_4_1_Compatibility::glLightModelf(GLenum pname, GLfloat param)
-{
- d_1_0_Deprecated->f.LightModelf(pname, param);
-}
-
-inline void QOpenGLFunctions_4_1_Compatibility::glLightiv(GLenum light, GLenum pname, const GLint *params)
-{
- d_1_0_Deprecated->f.Lightiv(light, pname, params);
-}
-
-inline void QOpenGLFunctions_4_1_Compatibility::glLighti(GLenum light, GLenum pname, GLint param)
-{
- d_1_0_Deprecated->f.Lighti(light, pname, param);
-}
-
-inline void QOpenGLFunctions_4_1_Compatibility::glLightfv(GLenum light, GLenum pname, const GLfloat *params)
-{
- d_1_0_Deprecated->f.Lightfv(light, pname, params);
-}
-
-inline void QOpenGLFunctions_4_1_Compatibility::glLightf(GLenum light, GLenum pname, GLfloat param)
-{
- d_1_0_Deprecated->f.Lightf(light, pname, param);
-}
-
-inline void QOpenGLFunctions_4_1_Compatibility::glFogiv(GLenum pname, const GLint *params)
-{
- d_1_0_Deprecated->f.Fogiv(pname, params);
-}
-
-inline void QOpenGLFunctions_4_1_Compatibility::glFogi(GLenum pname, GLint param)
-{
- d_1_0_Deprecated->f.Fogi(pname, param);
-}
-
-inline void QOpenGLFunctions_4_1_Compatibility::glFogfv(GLenum pname, const GLfloat *params)
-{
- d_1_0_Deprecated->f.Fogfv(pname, params);
-}
-
-inline void QOpenGLFunctions_4_1_Compatibility::glFogf(GLenum pname, GLfloat param)
-{
- d_1_0_Deprecated->f.Fogf(pname, param);
-}
-
-inline void QOpenGLFunctions_4_1_Compatibility::glColorMaterial(GLenum face, GLenum mode)
-{
- d_1_0_Deprecated->f.ColorMaterial(face, mode);
-}
-
-inline void QOpenGLFunctions_4_1_Compatibility::glClipPlane(GLenum plane, const GLdouble *equation)
-{
- d_1_0_Deprecated->f.ClipPlane(plane, equation);
-}
-
-inline void QOpenGLFunctions_4_1_Compatibility::glVertex4sv(const GLshort *v)
-{
- d_1_0_Deprecated->f.Vertex4sv(v);
-}
-
-inline void QOpenGLFunctions_4_1_Compatibility::glVertex4s(GLshort x, GLshort y, GLshort z, GLshort w)
-{
- d_1_0_Deprecated->f.Vertex4s(x, y, z, w);
-}
-
-inline void QOpenGLFunctions_4_1_Compatibility::glVertex4iv(const GLint *v)
-{
- d_1_0_Deprecated->f.Vertex4iv(v);
-}
-
-inline void QOpenGLFunctions_4_1_Compatibility::glVertex4i(GLint x, GLint y, GLint z, GLint w)
-{
- d_1_0_Deprecated->f.Vertex4i(x, y, z, w);
-}
-
-inline void QOpenGLFunctions_4_1_Compatibility::glVertex4fv(const GLfloat *v)
-{
- d_1_0_Deprecated->f.Vertex4fv(v);
-}
-
-inline void QOpenGLFunctions_4_1_Compatibility::glVertex4f(GLfloat x, GLfloat y, GLfloat z, GLfloat w)
-{
- d_1_0_Deprecated->f.Vertex4f(x, y, z, w);
-}
-
-inline void QOpenGLFunctions_4_1_Compatibility::glVertex4dv(const GLdouble *v)
-{
- d_1_0_Deprecated->f.Vertex4dv(v);
-}
-
-inline void QOpenGLFunctions_4_1_Compatibility::glVertex4d(GLdouble x, GLdouble y, GLdouble z, GLdouble w)
-{
- d_1_0_Deprecated->f.Vertex4d(x, y, z, w);
-}
-
-inline void QOpenGLFunctions_4_1_Compatibility::glVertex3sv(const GLshort *v)
-{
- d_1_0_Deprecated->f.Vertex3sv(v);
-}
-
-inline void QOpenGLFunctions_4_1_Compatibility::glVertex3s(GLshort x, GLshort y, GLshort z)
-{
- d_1_0_Deprecated->f.Vertex3s(x, y, z);
-}
-
-inline void QOpenGLFunctions_4_1_Compatibility::glVertex3iv(const GLint *v)
-{
- d_1_0_Deprecated->f.Vertex3iv(v);
-}
-
-inline void QOpenGLFunctions_4_1_Compatibility::glVertex3i(GLint x, GLint y, GLint z)
-{
- d_1_0_Deprecated->f.Vertex3i(x, y, z);
-}
-
-inline void QOpenGLFunctions_4_1_Compatibility::glVertex3fv(const GLfloat *v)
-{
- d_1_0_Deprecated->f.Vertex3fv(v);
-}
-
-inline void QOpenGLFunctions_4_1_Compatibility::glVertex3f(GLfloat x, GLfloat y, GLfloat z)
-{
- d_1_0_Deprecated->f.Vertex3f(x, y, z);
-}
-
-inline void QOpenGLFunctions_4_1_Compatibility::glVertex3dv(const GLdouble *v)
-{
- d_1_0_Deprecated->f.Vertex3dv(v);
-}
-
-inline void QOpenGLFunctions_4_1_Compatibility::glVertex3d(GLdouble x, GLdouble y, GLdouble z)
-{
- d_1_0_Deprecated->f.Vertex3d(x, y, z);
-}
-
-inline void QOpenGLFunctions_4_1_Compatibility::glVertex2sv(const GLshort *v)
-{
- d_1_0_Deprecated->f.Vertex2sv(v);
-}
-
-inline void QOpenGLFunctions_4_1_Compatibility::glVertex2s(GLshort x, GLshort y)
-{
- d_1_0_Deprecated->f.Vertex2s(x, y);
-}
-
-inline void QOpenGLFunctions_4_1_Compatibility::glVertex2iv(const GLint *v)
-{
- d_1_0_Deprecated->f.Vertex2iv(v);
-}
-
-inline void QOpenGLFunctions_4_1_Compatibility::glVertex2i(GLint x, GLint y)
-{
- d_1_0_Deprecated->f.Vertex2i(x, y);
-}
-
-inline void QOpenGLFunctions_4_1_Compatibility::glVertex2fv(const GLfloat *v)
-{
- d_1_0_Deprecated->f.Vertex2fv(v);
-}
-
-inline void QOpenGLFunctions_4_1_Compatibility::glVertex2f(GLfloat x, GLfloat y)
-{
- d_1_0_Deprecated->f.Vertex2f(x, y);
-}
-
-inline void QOpenGLFunctions_4_1_Compatibility::glVertex2dv(const GLdouble *v)
-{
- d_1_0_Deprecated->f.Vertex2dv(v);
-}
-
-inline void QOpenGLFunctions_4_1_Compatibility::glVertex2d(GLdouble x, GLdouble y)
-{
- d_1_0_Deprecated->f.Vertex2d(x, y);
-}
-
-inline void QOpenGLFunctions_4_1_Compatibility::glTexCoord4sv(const GLshort *v)
-{
- d_1_0_Deprecated->f.TexCoord4sv(v);
-}
-
-inline void QOpenGLFunctions_4_1_Compatibility::glTexCoord4s(GLshort s, GLshort t, GLshort r, GLshort q)
-{
- d_1_0_Deprecated->f.TexCoord4s(s, t, r, q);
-}
-
-inline void QOpenGLFunctions_4_1_Compatibility::glTexCoord4iv(const GLint *v)
-{
- d_1_0_Deprecated->f.TexCoord4iv(v);
-}
-
-inline void QOpenGLFunctions_4_1_Compatibility::glTexCoord4i(GLint s, GLint t, GLint r, GLint q)
-{
- d_1_0_Deprecated->f.TexCoord4i(s, t, r, q);
-}
-
-inline void QOpenGLFunctions_4_1_Compatibility::glTexCoord4fv(const GLfloat *v)
-{
- d_1_0_Deprecated->f.TexCoord4fv(v);
-}
-
-inline void QOpenGLFunctions_4_1_Compatibility::glTexCoord4f(GLfloat s, GLfloat t, GLfloat r, GLfloat q)
-{
- d_1_0_Deprecated->f.TexCoord4f(s, t, r, q);
-}
-
-inline void QOpenGLFunctions_4_1_Compatibility::glTexCoord4dv(const GLdouble *v)
-{
- d_1_0_Deprecated->f.TexCoord4dv(v);
-}
-
-inline void QOpenGLFunctions_4_1_Compatibility::glTexCoord4d(GLdouble s, GLdouble t, GLdouble r, GLdouble q)
-{
- d_1_0_Deprecated->f.TexCoord4d(s, t, r, q);
-}
-
-inline void QOpenGLFunctions_4_1_Compatibility::glTexCoord3sv(const GLshort *v)
-{
- d_1_0_Deprecated->f.TexCoord3sv(v);
-}
-
-inline void QOpenGLFunctions_4_1_Compatibility::glTexCoord3s(GLshort s, GLshort t, GLshort r)
-{
- d_1_0_Deprecated->f.TexCoord3s(s, t, r);
-}
-
-inline void QOpenGLFunctions_4_1_Compatibility::glTexCoord3iv(const GLint *v)
-{
- d_1_0_Deprecated->f.TexCoord3iv(v);
-}
-
-inline void QOpenGLFunctions_4_1_Compatibility::glTexCoord3i(GLint s, GLint t, GLint r)
-{
- d_1_0_Deprecated->f.TexCoord3i(s, t, r);
-}
-
-inline void QOpenGLFunctions_4_1_Compatibility::glTexCoord3fv(const GLfloat *v)
-{
- d_1_0_Deprecated->f.TexCoord3fv(v);
-}
-
-inline void QOpenGLFunctions_4_1_Compatibility::glTexCoord3f(GLfloat s, GLfloat t, GLfloat r)
-{
- d_1_0_Deprecated->f.TexCoord3f(s, t, r);
-}
-
-inline void QOpenGLFunctions_4_1_Compatibility::glTexCoord3dv(const GLdouble *v)
-{
- d_1_0_Deprecated->f.TexCoord3dv(v);
-}
-
-inline void QOpenGLFunctions_4_1_Compatibility::glTexCoord3d(GLdouble s, GLdouble t, GLdouble r)
-{
- d_1_0_Deprecated->f.TexCoord3d(s, t, r);
-}
-
-inline void QOpenGLFunctions_4_1_Compatibility::glTexCoord2sv(const GLshort *v)
-{
- d_1_0_Deprecated->f.TexCoord2sv(v);
-}
-
-inline void QOpenGLFunctions_4_1_Compatibility::glTexCoord2s(GLshort s, GLshort t)
-{
- d_1_0_Deprecated->f.TexCoord2s(s, t);
-}
-
-inline void QOpenGLFunctions_4_1_Compatibility::glTexCoord2iv(const GLint *v)
-{
- d_1_0_Deprecated->f.TexCoord2iv(v);
-}
-
-inline void QOpenGLFunctions_4_1_Compatibility::glTexCoord2i(GLint s, GLint t)
-{
- d_1_0_Deprecated->f.TexCoord2i(s, t);
-}
-
-inline void QOpenGLFunctions_4_1_Compatibility::glTexCoord2fv(const GLfloat *v)
-{
- d_1_0_Deprecated->f.TexCoord2fv(v);
-}
-
-inline void QOpenGLFunctions_4_1_Compatibility::glTexCoord2f(GLfloat s, GLfloat t)
-{
- d_1_0_Deprecated->f.TexCoord2f(s, t);
-}
-
-inline void QOpenGLFunctions_4_1_Compatibility::glTexCoord2dv(const GLdouble *v)
-{
- d_1_0_Deprecated->f.TexCoord2dv(v);
-}
-
-inline void QOpenGLFunctions_4_1_Compatibility::glTexCoord2d(GLdouble s, GLdouble t)
-{
- d_1_0_Deprecated->f.TexCoord2d(s, t);
-}
-
-inline void QOpenGLFunctions_4_1_Compatibility::glTexCoord1sv(const GLshort *v)
-{
- d_1_0_Deprecated->f.TexCoord1sv(v);
-}
-
-inline void QOpenGLFunctions_4_1_Compatibility::glTexCoord1s(GLshort s)
-{
- d_1_0_Deprecated->f.TexCoord1s(s);
-}
-
-inline void QOpenGLFunctions_4_1_Compatibility::glTexCoord1iv(const GLint *v)
-{
- d_1_0_Deprecated->f.TexCoord1iv(v);
-}
-
-inline void QOpenGLFunctions_4_1_Compatibility::glTexCoord1i(GLint s)
-{
- d_1_0_Deprecated->f.TexCoord1i(s);
-}
-
-inline void QOpenGLFunctions_4_1_Compatibility::glTexCoord1fv(const GLfloat *v)
-{
- d_1_0_Deprecated->f.TexCoord1fv(v);
-}
-
-inline void QOpenGLFunctions_4_1_Compatibility::glTexCoord1f(GLfloat s)
-{
- d_1_0_Deprecated->f.TexCoord1f(s);
-}
-
-inline void QOpenGLFunctions_4_1_Compatibility::glTexCoord1dv(const GLdouble *v)
-{
- d_1_0_Deprecated->f.TexCoord1dv(v);
-}
-
-inline void QOpenGLFunctions_4_1_Compatibility::glTexCoord1d(GLdouble s)
-{
- d_1_0_Deprecated->f.TexCoord1d(s);
-}
-
-inline void QOpenGLFunctions_4_1_Compatibility::glRectsv(const GLshort *v1, const GLshort *v2)
-{
- d_1_0_Deprecated->f.Rectsv(v1, v2);
-}
-
-inline void QOpenGLFunctions_4_1_Compatibility::glRects(GLshort x1, GLshort y1, GLshort x2, GLshort y2)
-{
- d_1_0_Deprecated->f.Rects(x1, y1, x2, y2);
-}
-
-inline void QOpenGLFunctions_4_1_Compatibility::glRectiv(const GLint *v1, const GLint *v2)
-{
- d_1_0_Deprecated->f.Rectiv(v1, v2);
-}
-
-inline void QOpenGLFunctions_4_1_Compatibility::glRecti(GLint x1, GLint y1, GLint x2, GLint y2)
-{
- d_1_0_Deprecated->f.Recti(x1, y1, x2, y2);
-}
-
-inline void QOpenGLFunctions_4_1_Compatibility::glRectfv(const GLfloat *v1, const GLfloat *v2)
-{
- d_1_0_Deprecated->f.Rectfv(v1, v2);
-}
-
-inline void QOpenGLFunctions_4_1_Compatibility::glRectf(GLfloat x1, GLfloat y1, GLfloat x2, GLfloat y2)
-{
- d_1_0_Deprecated->f.Rectf(x1, y1, x2, y2);
-}
-
-inline void QOpenGLFunctions_4_1_Compatibility::glRectdv(const GLdouble *v1, const GLdouble *v2)
-{
- d_1_0_Deprecated->f.Rectdv(v1, v2);
-}
-
-inline void QOpenGLFunctions_4_1_Compatibility::glRectd(GLdouble x1, GLdouble y1, GLdouble x2, GLdouble y2)
-{
- d_1_0_Deprecated->f.Rectd(x1, y1, x2, y2);
-}
-
-inline void QOpenGLFunctions_4_1_Compatibility::glRasterPos4sv(const GLshort *v)
-{
- d_1_0_Deprecated->f.RasterPos4sv(v);
-}
-
-inline void QOpenGLFunctions_4_1_Compatibility::glRasterPos4s(GLshort x, GLshort y, GLshort z, GLshort w)
-{
- d_1_0_Deprecated->f.RasterPos4s(x, y, z, w);
-}
-
-inline void QOpenGLFunctions_4_1_Compatibility::glRasterPos4iv(const GLint *v)
-{
- d_1_0_Deprecated->f.RasterPos4iv(v);
-}
-
-inline void QOpenGLFunctions_4_1_Compatibility::glRasterPos4i(GLint x, GLint y, GLint z, GLint w)
-{
- d_1_0_Deprecated->f.RasterPos4i(x, y, z, w);
-}
-
-inline void QOpenGLFunctions_4_1_Compatibility::glRasterPos4fv(const GLfloat *v)
-{
- d_1_0_Deprecated->f.RasterPos4fv(v);
-}
-
-inline void QOpenGLFunctions_4_1_Compatibility::glRasterPos4f(GLfloat x, GLfloat y, GLfloat z, GLfloat w)
-{
- d_1_0_Deprecated->f.RasterPos4f(x, y, z, w);
-}
-
-inline void QOpenGLFunctions_4_1_Compatibility::glRasterPos4dv(const GLdouble *v)
-{
- d_1_0_Deprecated->f.RasterPos4dv(v);
-}
-
-inline void QOpenGLFunctions_4_1_Compatibility::glRasterPos4d(GLdouble x, GLdouble y, GLdouble z, GLdouble w)
-{
- d_1_0_Deprecated->f.RasterPos4d(x, y, z, w);
-}
-
-inline void QOpenGLFunctions_4_1_Compatibility::glRasterPos3sv(const GLshort *v)
-{
- d_1_0_Deprecated->f.RasterPos3sv(v);
-}
-
-inline void QOpenGLFunctions_4_1_Compatibility::glRasterPos3s(GLshort x, GLshort y, GLshort z)
-{
- d_1_0_Deprecated->f.RasterPos3s(x, y, z);
-}
-
-inline void QOpenGLFunctions_4_1_Compatibility::glRasterPos3iv(const GLint *v)
-{
- d_1_0_Deprecated->f.RasterPos3iv(v);
-}
-
-inline void QOpenGLFunctions_4_1_Compatibility::glRasterPos3i(GLint x, GLint y, GLint z)
-{
- d_1_0_Deprecated->f.RasterPos3i(x, y, z);
-}
-
-inline void QOpenGLFunctions_4_1_Compatibility::glRasterPos3fv(const GLfloat *v)
-{
- d_1_0_Deprecated->f.RasterPos3fv(v);
-}
-
-inline void QOpenGLFunctions_4_1_Compatibility::glRasterPos3f(GLfloat x, GLfloat y, GLfloat z)
-{
- d_1_0_Deprecated->f.RasterPos3f(x, y, z);
-}
-
-inline void QOpenGLFunctions_4_1_Compatibility::glRasterPos3dv(const GLdouble *v)
-{
- d_1_0_Deprecated->f.RasterPos3dv(v);
-}
-
-inline void QOpenGLFunctions_4_1_Compatibility::glRasterPos3d(GLdouble x, GLdouble y, GLdouble z)
-{
- d_1_0_Deprecated->f.RasterPos3d(x, y, z);
-}
-
-inline void QOpenGLFunctions_4_1_Compatibility::glRasterPos2sv(const GLshort *v)
-{
- d_1_0_Deprecated->f.RasterPos2sv(v);
-}
-
-inline void QOpenGLFunctions_4_1_Compatibility::glRasterPos2s(GLshort x, GLshort y)
-{
- d_1_0_Deprecated->f.RasterPos2s(x, y);
-}
-
-inline void QOpenGLFunctions_4_1_Compatibility::glRasterPos2iv(const GLint *v)
-{
- d_1_0_Deprecated->f.RasterPos2iv(v);
-}
-
-inline void QOpenGLFunctions_4_1_Compatibility::glRasterPos2i(GLint x, GLint y)
-{
- d_1_0_Deprecated->f.RasterPos2i(x, y);
-}
-
-inline void QOpenGLFunctions_4_1_Compatibility::glRasterPos2fv(const GLfloat *v)
-{
- d_1_0_Deprecated->f.RasterPos2fv(v);
-}
-
-inline void QOpenGLFunctions_4_1_Compatibility::glRasterPos2f(GLfloat x, GLfloat y)
-{
- d_1_0_Deprecated->f.RasterPos2f(x, y);
-}
-
-inline void QOpenGLFunctions_4_1_Compatibility::glRasterPos2dv(const GLdouble *v)
-{
- d_1_0_Deprecated->f.RasterPos2dv(v);
-}
-
-inline void QOpenGLFunctions_4_1_Compatibility::glRasterPos2d(GLdouble x, GLdouble y)
-{
- d_1_0_Deprecated->f.RasterPos2d(x, y);
-}
-
-inline void QOpenGLFunctions_4_1_Compatibility::glNormal3sv(const GLshort *v)
-{
- d_1_0_Deprecated->f.Normal3sv(v);
-}
-
-inline void QOpenGLFunctions_4_1_Compatibility::glNormal3s(GLshort nx, GLshort ny, GLshort nz)
-{
- d_1_0_Deprecated->f.Normal3s(nx, ny, nz);
-}
-
-inline void QOpenGLFunctions_4_1_Compatibility::glNormal3iv(const GLint *v)
-{
- d_1_0_Deprecated->f.Normal3iv(v);
-}
-
-inline void QOpenGLFunctions_4_1_Compatibility::glNormal3i(GLint nx, GLint ny, GLint nz)
-{
- d_1_0_Deprecated->f.Normal3i(nx, ny, nz);
-}
-
-inline void QOpenGLFunctions_4_1_Compatibility::glNormal3fv(const GLfloat *v)
-{
- d_1_0_Deprecated->f.Normal3fv(v);
-}
-
-inline void QOpenGLFunctions_4_1_Compatibility::glNormal3f(GLfloat nx, GLfloat ny, GLfloat nz)
-{
- d_1_0_Deprecated->f.Normal3f(nx, ny, nz);
-}
-
-inline void QOpenGLFunctions_4_1_Compatibility::glNormal3dv(const GLdouble *v)
-{
- d_1_0_Deprecated->f.Normal3dv(v);
-}
-
-inline void QOpenGLFunctions_4_1_Compatibility::glNormal3d(GLdouble nx, GLdouble ny, GLdouble nz)
-{
- d_1_0_Deprecated->f.Normal3d(nx, ny, nz);
-}
-
-inline void QOpenGLFunctions_4_1_Compatibility::glNormal3bv(const GLbyte *v)
-{
- d_1_0_Deprecated->f.Normal3bv(v);
-}
-
-inline void QOpenGLFunctions_4_1_Compatibility::glNormal3b(GLbyte nx, GLbyte ny, GLbyte nz)
-{
- d_1_0_Deprecated->f.Normal3b(nx, ny, nz);
-}
-
-inline void QOpenGLFunctions_4_1_Compatibility::glIndexsv(const GLshort *c)
-{
- d_1_0_Deprecated->f.Indexsv(c);
-}
-
-inline void QOpenGLFunctions_4_1_Compatibility::glIndexs(GLshort c)
-{
- d_1_0_Deprecated->f.Indexs(c);
-}
-
-inline void QOpenGLFunctions_4_1_Compatibility::glIndexiv(const GLint *c)
-{
- d_1_0_Deprecated->f.Indexiv(c);
-}
-
-inline void QOpenGLFunctions_4_1_Compatibility::glIndexi(GLint c)
-{
- d_1_0_Deprecated->f.Indexi(c);
-}
-
-inline void QOpenGLFunctions_4_1_Compatibility::glIndexfv(const GLfloat *c)
-{
- d_1_0_Deprecated->f.Indexfv(c);
-}
-
-inline void QOpenGLFunctions_4_1_Compatibility::glIndexf(GLfloat c)
-{
- d_1_0_Deprecated->f.Indexf(c);
-}
-
-inline void QOpenGLFunctions_4_1_Compatibility::glIndexdv(const GLdouble *c)
-{
- d_1_0_Deprecated->f.Indexdv(c);
-}
-
-inline void QOpenGLFunctions_4_1_Compatibility::glIndexd(GLdouble c)
-{
- d_1_0_Deprecated->f.Indexd(c);
-}
-
-inline void QOpenGLFunctions_4_1_Compatibility::glEnd()
-{
- d_1_0_Deprecated->f.End();
-}
-
-inline void QOpenGLFunctions_4_1_Compatibility::glEdgeFlagv(const GLboolean *flag)
-{
- d_1_0_Deprecated->f.EdgeFlagv(flag);
-}
-
-inline void QOpenGLFunctions_4_1_Compatibility::glEdgeFlag(GLboolean flag)
-{
- d_1_0_Deprecated->f.EdgeFlag(flag);
-}
-
-inline void QOpenGLFunctions_4_1_Compatibility::glColor4usv(const GLushort *v)
-{
- d_1_0_Deprecated->f.Color4usv(v);
-}
-
-inline void QOpenGLFunctions_4_1_Compatibility::glColor4us(GLushort red, GLushort green, GLushort blue, GLushort alpha)
-{
- d_1_0_Deprecated->f.Color4us(red, green, blue, alpha);
-}
-
-inline void QOpenGLFunctions_4_1_Compatibility::glColor4uiv(const GLuint *v)
-{
- d_1_0_Deprecated->f.Color4uiv(v);
-}
-
-inline void QOpenGLFunctions_4_1_Compatibility::glColor4ui(GLuint red, GLuint green, GLuint blue, GLuint alpha)
-{
- d_1_0_Deprecated->f.Color4ui(red, green, blue, alpha);
-}
-
-inline void QOpenGLFunctions_4_1_Compatibility::glColor4ubv(const GLubyte *v)
-{
- d_1_0_Deprecated->f.Color4ubv(v);
-}
-
-inline void QOpenGLFunctions_4_1_Compatibility::glColor4ub(GLubyte red, GLubyte green, GLubyte blue, GLubyte alpha)
-{
- d_1_0_Deprecated->f.Color4ub(red, green, blue, alpha);
-}
-
-inline void QOpenGLFunctions_4_1_Compatibility::glColor4sv(const GLshort *v)
-{
- d_1_0_Deprecated->f.Color4sv(v);
-}
-
-inline void QOpenGLFunctions_4_1_Compatibility::glColor4s(GLshort red, GLshort green, GLshort blue, GLshort alpha)
-{
- d_1_0_Deprecated->f.Color4s(red, green, blue, alpha);
-}
-
-inline void QOpenGLFunctions_4_1_Compatibility::glColor4iv(const GLint *v)
-{
- d_1_0_Deprecated->f.Color4iv(v);
-}
-
-inline void QOpenGLFunctions_4_1_Compatibility::glColor4i(GLint red, GLint green, GLint blue, GLint alpha)
-{
- d_1_0_Deprecated->f.Color4i(red, green, blue, alpha);
-}
-
-inline void QOpenGLFunctions_4_1_Compatibility::glColor4fv(const GLfloat *v)
-{
- d_1_0_Deprecated->f.Color4fv(v);
-}
-
-inline void QOpenGLFunctions_4_1_Compatibility::glColor4f(GLfloat red, GLfloat green, GLfloat blue, GLfloat alpha)
-{
- d_1_0_Deprecated->f.Color4f(red, green, blue, alpha);
-}
-
-inline void QOpenGLFunctions_4_1_Compatibility::glColor4dv(const GLdouble *v)
-{
- d_1_0_Deprecated->f.Color4dv(v);
-}
-
-inline void QOpenGLFunctions_4_1_Compatibility::glColor4d(GLdouble red, GLdouble green, GLdouble blue, GLdouble alpha)
-{
- d_1_0_Deprecated->f.Color4d(red, green, blue, alpha);
-}
-
-inline void QOpenGLFunctions_4_1_Compatibility::glColor4bv(const GLbyte *v)
-{
- d_1_0_Deprecated->f.Color4bv(v);
-}
-
-inline void QOpenGLFunctions_4_1_Compatibility::glColor4b(GLbyte red, GLbyte green, GLbyte blue, GLbyte alpha)
-{
- d_1_0_Deprecated->f.Color4b(red, green, blue, alpha);
-}
-
-inline void QOpenGLFunctions_4_1_Compatibility::glColor3usv(const GLushort *v)
-{
- d_1_0_Deprecated->f.Color3usv(v);
-}
-
-inline void QOpenGLFunctions_4_1_Compatibility::glColor3us(GLushort red, GLushort green, GLushort blue)
-{
- d_1_0_Deprecated->f.Color3us(red, green, blue);
-}
-
-inline void QOpenGLFunctions_4_1_Compatibility::glColor3uiv(const GLuint *v)
-{
- d_1_0_Deprecated->f.Color3uiv(v);
-}
-
-inline void QOpenGLFunctions_4_1_Compatibility::glColor3ui(GLuint red, GLuint green, GLuint blue)
-{
- d_1_0_Deprecated->f.Color3ui(red, green, blue);
-}
-
-inline void QOpenGLFunctions_4_1_Compatibility::glColor3ubv(const GLubyte *v)
-{
- d_1_0_Deprecated->f.Color3ubv(v);
-}
-
-inline void QOpenGLFunctions_4_1_Compatibility::glColor3ub(GLubyte red, GLubyte green, GLubyte blue)
-{
- d_1_0_Deprecated->f.Color3ub(red, green, blue);
-}
-
-inline void QOpenGLFunctions_4_1_Compatibility::glColor3sv(const GLshort *v)
-{
- d_1_0_Deprecated->f.Color3sv(v);
-}
-
-inline void QOpenGLFunctions_4_1_Compatibility::glColor3s(GLshort red, GLshort green, GLshort blue)
-{
- d_1_0_Deprecated->f.Color3s(red, green, blue);
-}
-
-inline void QOpenGLFunctions_4_1_Compatibility::glColor3iv(const GLint *v)
-{
- d_1_0_Deprecated->f.Color3iv(v);
-}
-
-inline void QOpenGLFunctions_4_1_Compatibility::glColor3i(GLint red, GLint green, GLint blue)
-{
- d_1_0_Deprecated->f.Color3i(red, green, blue);
-}
-
-inline void QOpenGLFunctions_4_1_Compatibility::glColor3fv(const GLfloat *v)
-{
- d_1_0_Deprecated->f.Color3fv(v);
-}
-
-inline void QOpenGLFunctions_4_1_Compatibility::glColor3f(GLfloat red, GLfloat green, GLfloat blue)
-{
- d_1_0_Deprecated->f.Color3f(red, green, blue);
-}
-
-inline void QOpenGLFunctions_4_1_Compatibility::glColor3dv(const GLdouble *v)
-{
- d_1_0_Deprecated->f.Color3dv(v);
-}
-
-inline void QOpenGLFunctions_4_1_Compatibility::glColor3d(GLdouble red, GLdouble green, GLdouble blue)
-{
- d_1_0_Deprecated->f.Color3d(red, green, blue);
-}
-
-inline void QOpenGLFunctions_4_1_Compatibility::glColor3bv(const GLbyte *v)
-{
- d_1_0_Deprecated->f.Color3bv(v);
-}
-
-inline void QOpenGLFunctions_4_1_Compatibility::glColor3b(GLbyte red, GLbyte green, GLbyte blue)
-{
- d_1_0_Deprecated->f.Color3b(red, green, blue);
-}
-
-inline void QOpenGLFunctions_4_1_Compatibility::glBitmap(GLsizei width, GLsizei height, GLfloat xorig, GLfloat yorig, GLfloat xmove, GLfloat ymove, const GLubyte *bitmap)
-{
- d_1_0_Deprecated->f.Bitmap(width, height, xorig, yorig, xmove, ymove, bitmap);
-}
-
-inline void QOpenGLFunctions_4_1_Compatibility::glBegin(GLenum mode)
-{
- d_1_0_Deprecated->f.Begin(mode);
-}
-
-inline void QOpenGLFunctions_4_1_Compatibility::glListBase(GLuint base)
-{
- d_1_0_Deprecated->f.ListBase(base);
-}
-
-inline GLuint QOpenGLFunctions_4_1_Compatibility::glGenLists(GLsizei range)
-{
- return d_1_0_Deprecated->f.GenLists(range);
-}
-
-inline void QOpenGLFunctions_4_1_Compatibility::glDeleteLists(GLuint list, GLsizei range)
-{
- d_1_0_Deprecated->f.DeleteLists(list, range);
-}
-
-inline void QOpenGLFunctions_4_1_Compatibility::glCallLists(GLsizei n, GLenum type, const GLvoid *lists)
-{
- d_1_0_Deprecated->f.CallLists(n, type, lists);
-}
-
-inline void QOpenGLFunctions_4_1_Compatibility::glCallList(GLuint list)
-{
- d_1_0_Deprecated->f.CallList(list);
-}
-
-inline void QOpenGLFunctions_4_1_Compatibility::glEndList()
-{
- d_1_0_Deprecated->f.EndList();
-}
-
-inline void QOpenGLFunctions_4_1_Compatibility::glNewList(GLuint list, GLenum mode)
-{
- d_1_0_Deprecated->f.NewList(list, mode);
-}
-
-
-// OpenGL 1.1 deprecated functions
-inline void QOpenGLFunctions_4_1_Compatibility::glPushClientAttrib(GLbitfield mask)
-{
- d_1_1_Deprecated->f.PushClientAttrib(mask);
-}
-
-inline void QOpenGLFunctions_4_1_Compatibility::glPopClientAttrib()
-{
- d_1_1_Deprecated->f.PopClientAttrib();
-}
-
-inline void QOpenGLFunctions_4_1_Compatibility::glPrioritizeTextures(GLsizei n, const GLuint *textures, const GLfloat *priorities)
-{
- d_1_1_Deprecated->f.PrioritizeTextures(n, textures, priorities);
-}
-
-inline GLboolean QOpenGLFunctions_4_1_Compatibility::glAreTexturesResident(GLsizei n, const GLuint *textures, GLboolean *residences)
-{
- return d_1_1_Deprecated->f.AreTexturesResident(n, textures, residences);
-}
-
-inline void QOpenGLFunctions_4_1_Compatibility::glVertexPointer(GLint size, GLenum type, GLsizei stride, const GLvoid *pointer)
-{
- d_1_1_Deprecated->f.VertexPointer(size, type, stride, pointer);
-}
-
-inline void QOpenGLFunctions_4_1_Compatibility::glTexCoordPointer(GLint size, GLenum type, GLsizei stride, const GLvoid *pointer)
-{
- d_1_1_Deprecated->f.TexCoordPointer(size, type, stride, pointer);
-}
-
-inline void QOpenGLFunctions_4_1_Compatibility::glNormalPointer(GLenum type, GLsizei stride, const GLvoid *pointer)
-{
- d_1_1_Deprecated->f.NormalPointer(type, stride, pointer);
-}
-
-inline void QOpenGLFunctions_4_1_Compatibility::glInterleavedArrays(GLenum format, GLsizei stride, const GLvoid *pointer)
-{
- d_1_1_Deprecated->f.InterleavedArrays(format, stride, pointer);
-}
-
-inline void QOpenGLFunctions_4_1_Compatibility::glIndexPointer(GLenum type, GLsizei stride, const GLvoid *pointer)
-{
- d_1_1_Deprecated->f.IndexPointer(type, stride, pointer);
-}
-
-inline void QOpenGLFunctions_4_1_Compatibility::glEnableClientState(GLenum array)
-{
- d_1_1_Deprecated->f.EnableClientState(array);
-}
-
-inline void QOpenGLFunctions_4_1_Compatibility::glEdgeFlagPointer(GLsizei stride, const GLvoid *pointer)
-{
- d_1_1_Deprecated->f.EdgeFlagPointer(stride, pointer);
-}
-
-inline void QOpenGLFunctions_4_1_Compatibility::glDisableClientState(GLenum array)
-{
- d_1_1_Deprecated->f.DisableClientState(array);
-}
-
-inline void QOpenGLFunctions_4_1_Compatibility::glColorPointer(GLint size, GLenum type, GLsizei stride, const GLvoid *pointer)
-{
- d_1_1_Deprecated->f.ColorPointer(size, type, stride, pointer);
-}
-
-inline void QOpenGLFunctions_4_1_Compatibility::glArrayElement(GLint i)
-{
- d_1_1_Deprecated->f.ArrayElement(i);
-}
-
-
-// OpenGL 1.2 deprecated functions
-inline void QOpenGLFunctions_4_1_Compatibility::glResetMinmax(GLenum target)
-{
- d_1_2_Deprecated->f.ResetMinmax(target);
-}
-
-inline void QOpenGLFunctions_4_1_Compatibility::glResetHistogram(GLenum target)
-{
- d_1_2_Deprecated->f.ResetHistogram(target);
-}
-
-inline void QOpenGLFunctions_4_1_Compatibility::glMinmax(GLenum target, GLenum internalformat, GLboolean sink)
-{
- d_1_2_Deprecated->f.Minmax(target, internalformat, sink);
-}
-
-inline void QOpenGLFunctions_4_1_Compatibility::glHistogram(GLenum target, GLsizei width, GLenum internalformat, GLboolean sink)
-{
- d_1_2_Deprecated->f.Histogram(target, width, internalformat, sink);
-}
-
-inline void QOpenGLFunctions_4_1_Compatibility::glGetMinmaxParameteriv(GLenum target, GLenum pname, GLint *params)
-{
- d_1_2_Deprecated->f.GetMinmaxParameteriv(target, pname, params);
-}
-
-inline void QOpenGLFunctions_4_1_Compatibility::glGetMinmaxParameterfv(GLenum target, GLenum pname, GLfloat *params)
-{
- d_1_2_Deprecated->f.GetMinmaxParameterfv(target, pname, params);
-}
-
-inline void QOpenGLFunctions_4_1_Compatibility::glGetMinmax(GLenum target, GLboolean reset, GLenum format, GLenum type, GLvoid *values)
-{
- d_1_2_Deprecated->f.GetMinmax(target, reset, format, type, values);
-}
-
-inline void QOpenGLFunctions_4_1_Compatibility::glGetHistogramParameteriv(GLenum target, GLenum pname, GLint *params)
-{
- d_1_2_Deprecated->f.GetHistogramParameteriv(target, pname, params);
-}
-
-inline void QOpenGLFunctions_4_1_Compatibility::glGetHistogramParameterfv(GLenum target, GLenum pname, GLfloat *params)
-{
- d_1_2_Deprecated->f.GetHistogramParameterfv(target, pname, params);
-}
-
-inline void QOpenGLFunctions_4_1_Compatibility::glGetHistogram(GLenum target, GLboolean reset, GLenum format, GLenum type, GLvoid *values)
-{
- d_1_2_Deprecated->f.GetHistogram(target, reset, format, type, values);
-}
-
-inline void QOpenGLFunctions_4_1_Compatibility::glSeparableFilter2D(GLenum target, GLenum internalformat, GLsizei width, GLsizei height, GLenum format, GLenum type, const GLvoid *row, const GLvoid *column)
-{
- d_1_2_Deprecated->f.SeparableFilter2D(target, internalformat, width, height, format, type, row, column);
-}
-
-inline void QOpenGLFunctions_4_1_Compatibility::glGetSeparableFilter(GLenum target, GLenum format, GLenum type, GLvoid *row, GLvoid *column, GLvoid *span)
-{
- d_1_2_Deprecated->f.GetSeparableFilter(target, format, type, row, column, span);
-}
-
-inline void QOpenGLFunctions_4_1_Compatibility::glGetConvolutionParameteriv(GLenum target, GLenum pname, GLint *params)
-{
- d_1_2_Deprecated->f.GetConvolutionParameteriv(target, pname, params);
-}
-
-inline void QOpenGLFunctions_4_1_Compatibility::glGetConvolutionParameterfv(GLenum target, GLenum pname, GLfloat *params)
-{
- d_1_2_Deprecated->f.GetConvolutionParameterfv(target, pname, params);
-}
-
-inline void QOpenGLFunctions_4_1_Compatibility::glGetConvolutionFilter(GLenum target, GLenum format, GLenum type, GLvoid *image)
-{
- d_1_2_Deprecated->f.GetConvolutionFilter(target, format, type, image);
-}
-
-inline void QOpenGLFunctions_4_1_Compatibility::glCopyConvolutionFilter2D(GLenum target, GLenum internalformat, GLint x, GLint y, GLsizei width, GLsizei height)
-{
- d_1_2_Deprecated->f.CopyConvolutionFilter2D(target, internalformat, x, y, width, height);
-}
-
-inline void QOpenGLFunctions_4_1_Compatibility::glCopyConvolutionFilter1D(GLenum target, GLenum internalformat, GLint x, GLint y, GLsizei width)
-{
- d_1_2_Deprecated->f.CopyConvolutionFilter1D(target, internalformat, x, y, width);
-}
-
-inline void QOpenGLFunctions_4_1_Compatibility::glConvolutionParameteriv(GLenum target, GLenum pname, const GLint *params)
-{
- d_1_2_Deprecated->f.ConvolutionParameteriv(target, pname, params);
-}
-
-inline void QOpenGLFunctions_4_1_Compatibility::glConvolutionParameteri(GLenum target, GLenum pname, GLint params)
-{
- d_1_2_Deprecated->f.ConvolutionParameteri(target, pname, params);
-}
-
-inline void QOpenGLFunctions_4_1_Compatibility::glConvolutionParameterfv(GLenum target, GLenum pname, const GLfloat *params)
-{
- d_1_2_Deprecated->f.ConvolutionParameterfv(target, pname, params);
-}
-
-inline void QOpenGLFunctions_4_1_Compatibility::glConvolutionParameterf(GLenum target, GLenum pname, GLfloat params)
-{
- d_1_2_Deprecated->f.ConvolutionParameterf(target, pname, params);
-}
-
-inline void QOpenGLFunctions_4_1_Compatibility::glConvolutionFilter2D(GLenum target, GLenum internalformat, GLsizei width, GLsizei height, GLenum format, GLenum type, const GLvoid *image)
-{
- d_1_2_Deprecated->f.ConvolutionFilter2D(target, internalformat, width, height, format, type, image);
-}
-
-inline void QOpenGLFunctions_4_1_Compatibility::glConvolutionFilter1D(GLenum target, GLenum internalformat, GLsizei width, GLenum format, GLenum type, const GLvoid *image)
-{
- d_1_2_Deprecated->f.ConvolutionFilter1D(target, internalformat, width, format, type, image);
-}
-
-inline void QOpenGLFunctions_4_1_Compatibility::glCopyColorSubTable(GLenum target, GLsizei start, GLint x, GLint y, GLsizei width)
-{
- d_1_2_Deprecated->f.CopyColorSubTable(target, start, x, y, width);
-}
-
-inline void QOpenGLFunctions_4_1_Compatibility::glColorSubTable(GLenum target, GLsizei start, GLsizei count, GLenum format, GLenum type, const GLvoid *data)
-{
- d_1_2_Deprecated->f.ColorSubTable(target, start, count, format, type, data);
-}
-
-inline void QOpenGLFunctions_4_1_Compatibility::glGetColorTableParameteriv(GLenum target, GLenum pname, GLint *params)
-{
- d_1_2_Deprecated->f.GetColorTableParameteriv(target, pname, params);
-}
-
-inline void QOpenGLFunctions_4_1_Compatibility::glGetColorTableParameterfv(GLenum target, GLenum pname, GLfloat *params)
-{
- d_1_2_Deprecated->f.GetColorTableParameterfv(target, pname, params);
-}
-
-inline void QOpenGLFunctions_4_1_Compatibility::glGetColorTable(GLenum target, GLenum format, GLenum type, GLvoid *table)
-{
- d_1_2_Deprecated->f.GetColorTable(target, format, type, table);
-}
-
-inline void QOpenGLFunctions_4_1_Compatibility::glCopyColorTable(GLenum target, GLenum internalformat, GLint x, GLint y, GLsizei width)
-{
- d_1_2_Deprecated->f.CopyColorTable(target, internalformat, x, y, width);
-}
-
-inline void QOpenGLFunctions_4_1_Compatibility::glColorTableParameteriv(GLenum target, GLenum pname, const GLint *params)
-{
- d_1_2_Deprecated->f.ColorTableParameteriv(target, pname, params);
-}
-
-inline void QOpenGLFunctions_4_1_Compatibility::glColorTableParameterfv(GLenum target, GLenum pname, const GLfloat *params)
-{
- d_1_2_Deprecated->f.ColorTableParameterfv(target, pname, params);
-}
-
-inline void QOpenGLFunctions_4_1_Compatibility::glColorTable(GLenum target, GLenum internalformat, GLsizei width, GLenum format, GLenum type, const GLvoid *table)
-{
- d_1_2_Deprecated->f.ColorTable(target, internalformat, width, format, type, table);
-}
-
-
-// OpenGL 1.3 deprecated functions
-inline void QOpenGLFunctions_4_1_Compatibility::glMultTransposeMatrixd(const GLdouble *m)
-{
- d_1_3_Deprecated->f.MultTransposeMatrixd(m);
-}
-
-inline void QOpenGLFunctions_4_1_Compatibility::glMultTransposeMatrixf(const GLfloat *m)
-{
- d_1_3_Deprecated->f.MultTransposeMatrixf(m);
-}
-
-inline void QOpenGLFunctions_4_1_Compatibility::glLoadTransposeMatrixd(const GLdouble *m)
-{
- d_1_3_Deprecated->f.LoadTransposeMatrixd(m);
-}
-
-inline void QOpenGLFunctions_4_1_Compatibility::glLoadTransposeMatrixf(const GLfloat *m)
-{
- d_1_3_Deprecated->f.LoadTransposeMatrixf(m);
-}
-
-inline void QOpenGLFunctions_4_1_Compatibility::glMultiTexCoord4sv(GLenum target, const GLshort *v)
-{
- d_1_3_Deprecated->f.MultiTexCoord4sv(target, v);
-}
-
-inline void QOpenGLFunctions_4_1_Compatibility::glMultiTexCoord4s(GLenum target, GLshort s, GLshort t, GLshort r, GLshort q)
-{
- d_1_3_Deprecated->f.MultiTexCoord4s(target, s, t, r, q);
-}
-
-inline void QOpenGLFunctions_4_1_Compatibility::glMultiTexCoord4iv(GLenum target, const GLint *v)
-{
- d_1_3_Deprecated->f.MultiTexCoord4iv(target, v);
-}
-
-inline void QOpenGLFunctions_4_1_Compatibility::glMultiTexCoord4i(GLenum target, GLint s, GLint t, GLint r, GLint q)
-{
- d_1_3_Deprecated->f.MultiTexCoord4i(target, s, t, r, q);
-}
-
-inline void QOpenGLFunctions_4_1_Compatibility::glMultiTexCoord4fv(GLenum target, const GLfloat *v)
-{
- d_1_3_Deprecated->f.MultiTexCoord4fv(target, v);
-}
-
-inline void QOpenGLFunctions_4_1_Compatibility::glMultiTexCoord4f(GLenum target, GLfloat s, GLfloat t, GLfloat r, GLfloat q)
-{
- d_1_3_Deprecated->f.MultiTexCoord4f(target, s, t, r, q);
-}
-
-inline void QOpenGLFunctions_4_1_Compatibility::glMultiTexCoord4dv(GLenum target, const GLdouble *v)
-{
- d_1_3_Deprecated->f.MultiTexCoord4dv(target, v);
-}
-
-inline void QOpenGLFunctions_4_1_Compatibility::glMultiTexCoord4d(GLenum target, GLdouble s, GLdouble t, GLdouble r, GLdouble q)
-{
- d_1_3_Deprecated->f.MultiTexCoord4d(target, s, t, r, q);
-}
-
-inline void QOpenGLFunctions_4_1_Compatibility::glMultiTexCoord3sv(GLenum target, const GLshort *v)
-{
- d_1_3_Deprecated->f.MultiTexCoord3sv(target, v);
-}
-
-inline void QOpenGLFunctions_4_1_Compatibility::glMultiTexCoord3s(GLenum target, GLshort s, GLshort t, GLshort r)
-{
- d_1_3_Deprecated->f.MultiTexCoord3s(target, s, t, r);
-}
-
-inline void QOpenGLFunctions_4_1_Compatibility::glMultiTexCoord3iv(GLenum target, const GLint *v)
-{
- d_1_3_Deprecated->f.MultiTexCoord3iv(target, v);
-}
-
-inline void QOpenGLFunctions_4_1_Compatibility::glMultiTexCoord3i(GLenum target, GLint s, GLint t, GLint r)
-{
- d_1_3_Deprecated->f.MultiTexCoord3i(target, s, t, r);
-}
-
-inline void QOpenGLFunctions_4_1_Compatibility::glMultiTexCoord3fv(GLenum target, const GLfloat *v)
-{
- d_1_3_Deprecated->f.MultiTexCoord3fv(target, v);
-}
-
-inline void QOpenGLFunctions_4_1_Compatibility::glMultiTexCoord3f(GLenum target, GLfloat s, GLfloat t, GLfloat r)
-{
- d_1_3_Deprecated->f.MultiTexCoord3f(target, s, t, r);
-}
-
-inline void QOpenGLFunctions_4_1_Compatibility::glMultiTexCoord3dv(GLenum target, const GLdouble *v)
-{
- d_1_3_Deprecated->f.MultiTexCoord3dv(target, v);
-}
-
-inline void QOpenGLFunctions_4_1_Compatibility::glMultiTexCoord3d(GLenum target, GLdouble s, GLdouble t, GLdouble r)
-{
- d_1_3_Deprecated->f.MultiTexCoord3d(target, s, t, r);
-}
-
-inline void QOpenGLFunctions_4_1_Compatibility::glMultiTexCoord2sv(GLenum target, const GLshort *v)
-{
- d_1_3_Deprecated->f.MultiTexCoord2sv(target, v);
-}
-
-inline void QOpenGLFunctions_4_1_Compatibility::glMultiTexCoord2s(GLenum target, GLshort s, GLshort t)
-{
- d_1_3_Deprecated->f.MultiTexCoord2s(target, s, t);
-}
-
-inline void QOpenGLFunctions_4_1_Compatibility::glMultiTexCoord2iv(GLenum target, const GLint *v)
-{
- d_1_3_Deprecated->f.MultiTexCoord2iv(target, v);
-}
-
-inline void QOpenGLFunctions_4_1_Compatibility::glMultiTexCoord2i(GLenum target, GLint s, GLint t)
-{
- d_1_3_Deprecated->f.MultiTexCoord2i(target, s, t);
-}
-
-inline void QOpenGLFunctions_4_1_Compatibility::glMultiTexCoord2fv(GLenum target, const GLfloat *v)
-{
- d_1_3_Deprecated->f.MultiTexCoord2fv(target, v);
-}
-
-inline void QOpenGLFunctions_4_1_Compatibility::glMultiTexCoord2f(GLenum target, GLfloat s, GLfloat t)
-{
- d_1_3_Deprecated->f.MultiTexCoord2f(target, s, t);
-}
-
-inline void QOpenGLFunctions_4_1_Compatibility::glMultiTexCoord2dv(GLenum target, const GLdouble *v)
-{
- d_1_3_Deprecated->f.MultiTexCoord2dv(target, v);
-}
-
-inline void QOpenGLFunctions_4_1_Compatibility::glMultiTexCoord2d(GLenum target, GLdouble s, GLdouble t)
-{
- d_1_3_Deprecated->f.MultiTexCoord2d(target, s, t);
-}
-
-inline void QOpenGLFunctions_4_1_Compatibility::glMultiTexCoord1sv(GLenum target, const GLshort *v)
-{
- d_1_3_Deprecated->f.MultiTexCoord1sv(target, v);
-}
-
-inline void QOpenGLFunctions_4_1_Compatibility::glMultiTexCoord1s(GLenum target, GLshort s)
-{
- d_1_3_Deprecated->f.MultiTexCoord1s(target, s);
-}
-
-inline void QOpenGLFunctions_4_1_Compatibility::glMultiTexCoord1iv(GLenum target, const GLint *v)
-{
- d_1_3_Deprecated->f.MultiTexCoord1iv(target, v);
-}
-
-inline void QOpenGLFunctions_4_1_Compatibility::glMultiTexCoord1i(GLenum target, GLint s)
-{
- d_1_3_Deprecated->f.MultiTexCoord1i(target, s);
-}
-
-inline void QOpenGLFunctions_4_1_Compatibility::glMultiTexCoord1fv(GLenum target, const GLfloat *v)
-{
- d_1_3_Deprecated->f.MultiTexCoord1fv(target, v);
-}
-
-inline void QOpenGLFunctions_4_1_Compatibility::glMultiTexCoord1f(GLenum target, GLfloat s)
-{
- d_1_3_Deprecated->f.MultiTexCoord1f(target, s);
-}
-
-inline void QOpenGLFunctions_4_1_Compatibility::glMultiTexCoord1dv(GLenum target, const GLdouble *v)
-{
- d_1_3_Deprecated->f.MultiTexCoord1dv(target, v);
-}
-
-inline void QOpenGLFunctions_4_1_Compatibility::glMultiTexCoord1d(GLenum target, GLdouble s)
-{
- d_1_3_Deprecated->f.MultiTexCoord1d(target, s);
-}
-
-inline void QOpenGLFunctions_4_1_Compatibility::glClientActiveTexture(GLenum texture)
-{
- d_1_3_Deprecated->f.ClientActiveTexture(texture);
-}
-
-
-// OpenGL 1.4 deprecated functions
-inline void QOpenGLFunctions_4_1_Compatibility::glWindowPos3sv(const GLshort *v)
-{
- d_1_4_Deprecated->f.WindowPos3sv(v);
-}
-
-inline void QOpenGLFunctions_4_1_Compatibility::glWindowPos3s(GLshort x, GLshort y, GLshort z)
-{
- d_1_4_Deprecated->f.WindowPos3s(x, y, z);
-}
-
-inline void QOpenGLFunctions_4_1_Compatibility::glWindowPos3iv(const GLint *v)
-{
- d_1_4_Deprecated->f.WindowPos3iv(v);
-}
-
-inline void QOpenGLFunctions_4_1_Compatibility::glWindowPos3i(GLint x, GLint y, GLint z)
-{
- d_1_4_Deprecated->f.WindowPos3i(x, y, z);
-}
-
-inline void QOpenGLFunctions_4_1_Compatibility::glWindowPos3fv(const GLfloat *v)
-{
- d_1_4_Deprecated->f.WindowPos3fv(v);
-}
-
-inline void QOpenGLFunctions_4_1_Compatibility::glWindowPos3f(GLfloat x, GLfloat y, GLfloat z)
-{
- d_1_4_Deprecated->f.WindowPos3f(x, y, z);
-}
-
-inline void QOpenGLFunctions_4_1_Compatibility::glWindowPos3dv(const GLdouble *v)
-{
- d_1_4_Deprecated->f.WindowPos3dv(v);
-}
-
-inline void QOpenGLFunctions_4_1_Compatibility::glWindowPos3d(GLdouble x, GLdouble y, GLdouble z)
-{
- d_1_4_Deprecated->f.WindowPos3d(x, y, z);
-}
-
-inline void QOpenGLFunctions_4_1_Compatibility::glWindowPos2sv(const GLshort *v)
-{
- d_1_4_Deprecated->f.WindowPos2sv(v);
-}
-
-inline void QOpenGLFunctions_4_1_Compatibility::glWindowPos2s(GLshort x, GLshort y)
-{
- d_1_4_Deprecated->f.WindowPos2s(x, y);
-}
-
-inline void QOpenGLFunctions_4_1_Compatibility::glWindowPos2iv(const GLint *v)
-{
- d_1_4_Deprecated->f.WindowPos2iv(v);
-}
-
-inline void QOpenGLFunctions_4_1_Compatibility::glWindowPos2i(GLint x, GLint y)
-{
- d_1_4_Deprecated->f.WindowPos2i(x, y);
-}
-
-inline void QOpenGLFunctions_4_1_Compatibility::glWindowPos2fv(const GLfloat *v)
-{
- d_1_4_Deprecated->f.WindowPos2fv(v);
-}
-
-inline void QOpenGLFunctions_4_1_Compatibility::glWindowPos2f(GLfloat x, GLfloat y)
-{
- d_1_4_Deprecated->f.WindowPos2f(x, y);
-}
-
-inline void QOpenGLFunctions_4_1_Compatibility::glWindowPos2dv(const GLdouble *v)
-{
- d_1_4_Deprecated->f.WindowPos2dv(v);
-}
-
-inline void QOpenGLFunctions_4_1_Compatibility::glWindowPos2d(GLdouble x, GLdouble y)
-{
- d_1_4_Deprecated->f.WindowPos2d(x, y);
-}
-
-inline void QOpenGLFunctions_4_1_Compatibility::glSecondaryColorPointer(GLint size, GLenum type, GLsizei stride, const GLvoid *pointer)
-{
- d_1_4_Deprecated->f.SecondaryColorPointer(size, type, stride, pointer);
-}
-
-inline void QOpenGLFunctions_4_1_Compatibility::glSecondaryColor3usv(const GLushort *v)
-{
- d_1_4_Deprecated->f.SecondaryColor3usv(v);
-}
-
-inline void QOpenGLFunctions_4_1_Compatibility::glSecondaryColor3us(GLushort red, GLushort green, GLushort blue)
-{
- d_1_4_Deprecated->f.SecondaryColor3us(red, green, blue);
-}
-
-inline void QOpenGLFunctions_4_1_Compatibility::glSecondaryColor3uiv(const GLuint *v)
-{
- d_1_4_Deprecated->f.SecondaryColor3uiv(v);
-}
-
-inline void QOpenGLFunctions_4_1_Compatibility::glSecondaryColor3ui(GLuint red, GLuint green, GLuint blue)
-{
- d_1_4_Deprecated->f.SecondaryColor3ui(red, green, blue);
-}
-
-inline void QOpenGLFunctions_4_1_Compatibility::glSecondaryColor3ubv(const GLubyte *v)
-{
- d_1_4_Deprecated->f.SecondaryColor3ubv(v);
-}
-
-inline void QOpenGLFunctions_4_1_Compatibility::glSecondaryColor3ub(GLubyte red, GLubyte green, GLubyte blue)
-{
- d_1_4_Deprecated->f.SecondaryColor3ub(red, green, blue);
-}
-
-inline void QOpenGLFunctions_4_1_Compatibility::glSecondaryColor3sv(const GLshort *v)
-{
- d_1_4_Deprecated->f.SecondaryColor3sv(v);
-}
-
-inline void QOpenGLFunctions_4_1_Compatibility::glSecondaryColor3s(GLshort red, GLshort green, GLshort blue)
-{
- d_1_4_Deprecated->f.SecondaryColor3s(red, green, blue);
-}
-
-inline void QOpenGLFunctions_4_1_Compatibility::glSecondaryColor3iv(const GLint *v)
-{
- d_1_4_Deprecated->f.SecondaryColor3iv(v);
-}
-
-inline void QOpenGLFunctions_4_1_Compatibility::glSecondaryColor3i(GLint red, GLint green, GLint blue)
-{
- d_1_4_Deprecated->f.SecondaryColor3i(red, green, blue);
-}
-
-inline void QOpenGLFunctions_4_1_Compatibility::glSecondaryColor3fv(const GLfloat *v)
-{
- d_1_4_Deprecated->f.SecondaryColor3fv(v);
-}
-
-inline void QOpenGLFunctions_4_1_Compatibility::glSecondaryColor3f(GLfloat red, GLfloat green, GLfloat blue)
-{
- d_1_4_Deprecated->f.SecondaryColor3f(red, green, blue);
-}
-
-inline void QOpenGLFunctions_4_1_Compatibility::glSecondaryColor3dv(const GLdouble *v)
-{
- d_1_4_Deprecated->f.SecondaryColor3dv(v);
-}
-
-inline void QOpenGLFunctions_4_1_Compatibility::glSecondaryColor3d(GLdouble red, GLdouble green, GLdouble blue)
-{
- d_1_4_Deprecated->f.SecondaryColor3d(red, green, blue);
-}
-
-inline void QOpenGLFunctions_4_1_Compatibility::glSecondaryColor3bv(const GLbyte *v)
-{
- d_1_4_Deprecated->f.SecondaryColor3bv(v);
-}
-
-inline void QOpenGLFunctions_4_1_Compatibility::glSecondaryColor3b(GLbyte red, GLbyte green, GLbyte blue)
-{
- d_1_4_Deprecated->f.SecondaryColor3b(red, green, blue);
-}
-
-inline void QOpenGLFunctions_4_1_Compatibility::glFogCoordPointer(GLenum type, GLsizei stride, const GLvoid *pointer)
-{
- d_1_4_Deprecated->f.FogCoordPointer(type, stride, pointer);
-}
-
-inline void QOpenGLFunctions_4_1_Compatibility::glFogCoorddv(const GLdouble *coord)
-{
- d_1_4_Deprecated->f.FogCoorddv(coord);
-}
-
-inline void QOpenGLFunctions_4_1_Compatibility::glFogCoordd(GLdouble coord)
-{
- d_1_4_Deprecated->f.FogCoordd(coord);
-}
-
-inline void QOpenGLFunctions_4_1_Compatibility::glFogCoordfv(const GLfloat *coord)
-{
- d_1_4_Deprecated->f.FogCoordfv(coord);
-}
-
-inline void QOpenGLFunctions_4_1_Compatibility::glFogCoordf(GLfloat coord)
-{
- d_1_4_Deprecated->f.FogCoordf(coord);
-}
-
-
-// OpenGL 1.5 deprecated functions
-
-// OpenGL 2.0 deprecated functions
-inline void QOpenGLFunctions_4_1_Compatibility::glVertexAttrib4usv(GLuint index, const GLushort *v)
-{
- d_2_0_Core->f.VertexAttrib4usv(index, v);
-}
-
-inline void QOpenGLFunctions_4_1_Compatibility::glVertexAttrib4uiv(GLuint index, const GLuint *v)
-{
- d_2_0_Core->f.VertexAttrib4uiv(index, v);
-}
-
-inline void QOpenGLFunctions_4_1_Compatibility::glVertexAttrib4ubv(GLuint index, const GLubyte *v)
-{
- d_2_0_Core->f.VertexAttrib4ubv(index, v);
-}
-
-inline void QOpenGLFunctions_4_1_Compatibility::glVertexAttrib4sv(GLuint index, const GLshort *v)
-{
- d_2_0_Core->f.VertexAttrib4sv(index, v);
-}
-
-inline void QOpenGLFunctions_4_1_Compatibility::glVertexAttrib4s(GLuint index, GLshort x, GLshort y, GLshort z, GLshort w)
-{
- d_2_0_Core->f.VertexAttrib4s(index, x, y, z, w);
-}
-
-inline void QOpenGLFunctions_4_1_Compatibility::glVertexAttrib4iv(GLuint index, const GLint *v)
-{
- d_2_0_Core->f.VertexAttrib4iv(index, v);
-}
-
-inline void QOpenGLFunctions_4_1_Compatibility::glVertexAttrib4fv(GLuint index, const GLfloat *v)
-{
- d_2_0_Core->f.VertexAttrib4fv(index, v);
-}
-
-inline void QOpenGLFunctions_4_1_Compatibility::glVertexAttrib4f(GLuint index, GLfloat x, GLfloat y, GLfloat z, GLfloat w)
-{
- d_2_0_Core->f.VertexAttrib4f(index, x, y, z, w);
-}
-
-inline void QOpenGLFunctions_4_1_Compatibility::glVertexAttrib4dv(GLuint index, const GLdouble *v)
-{
- d_2_0_Core->f.VertexAttrib4dv(index, v);
-}
-
-inline void QOpenGLFunctions_4_1_Compatibility::glVertexAttrib4d(GLuint index, GLdouble x, GLdouble y, GLdouble z, GLdouble w)
-{
- d_2_0_Core->f.VertexAttrib4d(index, x, y, z, w);
-}
-
-inline void QOpenGLFunctions_4_1_Compatibility::glVertexAttrib4bv(GLuint index, const GLbyte *v)
-{
- d_2_0_Core->f.VertexAttrib4bv(index, v);
-}
-
-inline void QOpenGLFunctions_4_1_Compatibility::glVertexAttrib4Nusv(GLuint index, const GLushort *v)
-{
- d_2_0_Core->f.VertexAttrib4Nusv(index, v);
-}
-
-inline void QOpenGLFunctions_4_1_Compatibility::glVertexAttrib4Nuiv(GLuint index, const GLuint *v)
-{
- d_2_0_Core->f.VertexAttrib4Nuiv(index, v);
-}
-
-inline void QOpenGLFunctions_4_1_Compatibility::glVertexAttrib4Nubv(GLuint index, const GLubyte *v)
-{
- d_2_0_Core->f.VertexAttrib4Nubv(index, v);
-}
-
-inline void QOpenGLFunctions_4_1_Compatibility::glVertexAttrib4Nub(GLuint index, GLubyte x, GLubyte y, GLubyte z, GLubyte w)
-{
- d_2_0_Core->f.VertexAttrib4Nub(index, x, y, z, w);
-}
-
-inline void QOpenGLFunctions_4_1_Compatibility::glVertexAttrib4Nsv(GLuint index, const GLshort *v)
-{
- d_2_0_Core->f.VertexAttrib4Nsv(index, v);
-}
-
-inline void QOpenGLFunctions_4_1_Compatibility::glVertexAttrib4Niv(GLuint index, const GLint *v)
-{
- d_2_0_Core->f.VertexAttrib4Niv(index, v);
-}
-
-inline void QOpenGLFunctions_4_1_Compatibility::glVertexAttrib4Nbv(GLuint index, const GLbyte *v)
-{
- d_2_0_Core->f.VertexAttrib4Nbv(index, v);
-}
-
-inline void QOpenGLFunctions_4_1_Compatibility::glVertexAttrib3sv(GLuint index, const GLshort *v)
-{
- d_2_0_Core->f.VertexAttrib3sv(index, v);
-}
-
-inline void QOpenGLFunctions_4_1_Compatibility::glVertexAttrib3s(GLuint index, GLshort x, GLshort y, GLshort z)
-{
- d_2_0_Core->f.VertexAttrib3s(index, x, y, z);
-}
-
-inline void QOpenGLFunctions_4_1_Compatibility::glVertexAttrib3fv(GLuint index, const GLfloat *v)
-{
- d_2_0_Core->f.VertexAttrib3fv(index, v);
-}
-
-inline void QOpenGLFunctions_4_1_Compatibility::glVertexAttrib3f(GLuint index, GLfloat x, GLfloat y, GLfloat z)
-{
- d_2_0_Core->f.VertexAttrib3f(index, x, y, z);
-}
-
-inline void QOpenGLFunctions_4_1_Compatibility::glVertexAttrib3dv(GLuint index, const GLdouble *v)
-{
- d_2_0_Core->f.VertexAttrib3dv(index, v);
-}
-
-inline void QOpenGLFunctions_4_1_Compatibility::glVertexAttrib3d(GLuint index, GLdouble x, GLdouble y, GLdouble z)
-{
- d_2_0_Core->f.VertexAttrib3d(index, x, y, z);
-}
-
-inline void QOpenGLFunctions_4_1_Compatibility::glVertexAttrib2sv(GLuint index, const GLshort *v)
-{
- d_2_0_Core->f.VertexAttrib2sv(index, v);
-}
-
-inline void QOpenGLFunctions_4_1_Compatibility::glVertexAttrib2s(GLuint index, GLshort x, GLshort y)
-{
- d_2_0_Core->f.VertexAttrib2s(index, x, y);
-}
-
-inline void QOpenGLFunctions_4_1_Compatibility::glVertexAttrib2fv(GLuint index, const GLfloat *v)
-{
- d_2_0_Core->f.VertexAttrib2fv(index, v);
-}
-
-inline void QOpenGLFunctions_4_1_Compatibility::glVertexAttrib2f(GLuint index, GLfloat x, GLfloat y)
-{
- d_2_0_Core->f.VertexAttrib2f(index, x, y);
-}
-
-inline void QOpenGLFunctions_4_1_Compatibility::glVertexAttrib2dv(GLuint index, const GLdouble *v)
-{
- d_2_0_Core->f.VertexAttrib2dv(index, v);
-}
-
-inline void QOpenGLFunctions_4_1_Compatibility::glVertexAttrib2d(GLuint index, GLdouble x, GLdouble y)
-{
- d_2_0_Core->f.VertexAttrib2d(index, x, y);
-}
-
-inline void QOpenGLFunctions_4_1_Compatibility::glVertexAttrib1sv(GLuint index, const GLshort *v)
-{
- d_2_0_Core->f.VertexAttrib1sv(index, v);
-}
-
-inline void QOpenGLFunctions_4_1_Compatibility::glVertexAttrib1s(GLuint index, GLshort x)
-{
- d_2_0_Core->f.VertexAttrib1s(index, x);
-}
-
-inline void QOpenGLFunctions_4_1_Compatibility::glVertexAttrib1fv(GLuint index, const GLfloat *v)
-{
- d_2_0_Core->f.VertexAttrib1fv(index, v);
-}
-
-inline void QOpenGLFunctions_4_1_Compatibility::glVertexAttrib1f(GLuint index, GLfloat x)
-{
- d_2_0_Core->f.VertexAttrib1f(index, x);
-}
-
-inline void QOpenGLFunctions_4_1_Compatibility::glVertexAttrib1dv(GLuint index, const GLdouble *v)
-{
- d_2_0_Core->f.VertexAttrib1dv(index, v);
-}
-
-inline void QOpenGLFunctions_4_1_Compatibility::glVertexAttrib1d(GLuint index, GLdouble x)
-{
- d_2_0_Core->f.VertexAttrib1d(index, x);
-}
-
-
-// OpenGL 2.1 deprecated functions
-
-// OpenGL 3.0 deprecated functions
-inline void QOpenGLFunctions_4_1_Compatibility::glVertexAttribI4usv(GLuint index, const GLushort *v)
-{
- d_3_0_Core->f.VertexAttribI4usv(index, v);
-}
-
-inline void QOpenGLFunctions_4_1_Compatibility::glVertexAttribI4ubv(GLuint index, const GLubyte *v)
-{
- d_3_0_Core->f.VertexAttribI4ubv(index, v);
-}
-
-inline void QOpenGLFunctions_4_1_Compatibility::glVertexAttribI4sv(GLuint index, const GLshort *v)
-{
- d_3_0_Core->f.VertexAttribI4sv(index, v);
-}
-
-inline void QOpenGLFunctions_4_1_Compatibility::glVertexAttribI4bv(GLuint index, const GLbyte *v)
-{
- d_3_0_Core->f.VertexAttribI4bv(index, v);
-}
-
-inline void QOpenGLFunctions_4_1_Compatibility::glVertexAttribI4uiv(GLuint index, const GLuint *v)
-{
- d_3_0_Core->f.VertexAttribI4uiv(index, v);
-}
-
-inline void QOpenGLFunctions_4_1_Compatibility::glVertexAttribI3uiv(GLuint index, const GLuint *v)
-{
- d_3_0_Core->f.VertexAttribI3uiv(index, v);
-}
-
-inline void QOpenGLFunctions_4_1_Compatibility::glVertexAttribI2uiv(GLuint index, const GLuint *v)
-{
- d_3_0_Core->f.VertexAttribI2uiv(index, v);
-}
-
-inline void QOpenGLFunctions_4_1_Compatibility::glVertexAttribI1uiv(GLuint index, const GLuint *v)
-{
- d_3_0_Core->f.VertexAttribI1uiv(index, v);
-}
-
-inline void QOpenGLFunctions_4_1_Compatibility::glVertexAttribI4iv(GLuint index, const GLint *v)
-{
- d_3_0_Core->f.VertexAttribI4iv(index, v);
-}
-
-inline void QOpenGLFunctions_4_1_Compatibility::glVertexAttribI3iv(GLuint index, const GLint *v)
-{
- d_3_0_Core->f.VertexAttribI3iv(index, v);
-}
-
-inline void QOpenGLFunctions_4_1_Compatibility::glVertexAttribI2iv(GLuint index, const GLint *v)
-{
- d_3_0_Core->f.VertexAttribI2iv(index, v);
-}
-
-inline void QOpenGLFunctions_4_1_Compatibility::glVertexAttribI1iv(GLuint index, const GLint *v)
-{
- d_3_0_Core->f.VertexAttribI1iv(index, v);
-}
-
-inline void QOpenGLFunctions_4_1_Compatibility::glVertexAttribI4ui(GLuint index, GLuint x, GLuint y, GLuint z, GLuint w)
-{
- d_3_0_Core->f.VertexAttribI4ui(index, x, y, z, w);
-}
-
-inline void QOpenGLFunctions_4_1_Compatibility::glVertexAttribI3ui(GLuint index, GLuint x, GLuint y, GLuint z)
-{
- d_3_0_Core->f.VertexAttribI3ui(index, x, y, z);
-}
-
-inline void QOpenGLFunctions_4_1_Compatibility::glVertexAttribI2ui(GLuint index, GLuint x, GLuint y)
-{
- d_3_0_Core->f.VertexAttribI2ui(index, x, y);
-}
-
-inline void QOpenGLFunctions_4_1_Compatibility::glVertexAttribI1ui(GLuint index, GLuint x)
-{
- d_3_0_Core->f.VertexAttribI1ui(index, x);
-}
-
-inline void QOpenGLFunctions_4_1_Compatibility::glVertexAttribI4i(GLuint index, GLint x, GLint y, GLint z, GLint w)
-{
- d_3_0_Core->f.VertexAttribI4i(index, x, y, z, w);
-}
-
-inline void QOpenGLFunctions_4_1_Compatibility::glVertexAttribI3i(GLuint index, GLint x, GLint y, GLint z)
-{
- d_3_0_Core->f.VertexAttribI3i(index, x, y, z);
-}
-
-inline void QOpenGLFunctions_4_1_Compatibility::glVertexAttribI2i(GLuint index, GLint x, GLint y)
-{
- d_3_0_Core->f.VertexAttribI2i(index, x, y);
-}
-
-inline void QOpenGLFunctions_4_1_Compatibility::glVertexAttribI1i(GLuint index, GLint x)
-{
- d_3_0_Core->f.VertexAttribI1i(index, x);
-}
-
-
-// OpenGL 3.1 deprecated functions
-
-// OpenGL 3.2 deprecated functions
-
-// OpenGL 3.3 deprecated functions
-
-// OpenGL 4.0 deprecated functions
-
-// OpenGL 4.1 deprecated functions
-
-
-QT_END_NAMESPACE
-
-#endif // QT_NO_OPENGL && !QT_OPENGL_ES_2
-
-#endif
diff --git a/src/gui/opengl/qopenglfunctions_4_1_core.cpp b/src/gui/opengl/qopenglfunctions_4_1_core.cpp
deleted file mode 100644
index b21742d9c1..0000000000
--- a/src/gui/opengl/qopenglfunctions_4_1_core.cpp
+++ /dev/null
@@ -1,242 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2013 Klaralvdalens Datakonsult AB (KDAB)
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the QtGui module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-**
-** This file was generated by glgen version 0.1
-** Command line was: glgen
-**
-** glgen is Copyright (C) 2013 Klaralvdalens Datakonsult AB (KDAB)
-**
-** This is an auto-generated file.
-** Do not edit! All changes made to it will be lost.
-**
-****************************************************************************/
-
-#include "qopenglfunctions_4_1_core.h"
-#include "qopenglcontext.h"
-
-QT_BEGIN_NAMESPACE
-
-/*!
- \class QOpenGLFunctions_4_1_Core
- \inmodule QtGui
- \since 5.1
- \wrapper
- \brief The QOpenGLFunctions_4_1_Core class provides all functions for OpenGL 4.1 core profile.
-
- This class is a wrapper for functions from OpenGL 4.1 core profile.
- See reference pages on \l {http://www.opengl.org/sdk/docs/}{opengl.org}
- for function documentation.
-
- \sa QAbstractOpenGLFunctions
-*/
-
-QOpenGLFunctions_4_1_Core::QOpenGLFunctions_4_1_Core()
- : QAbstractOpenGLFunctions()
- , d_1_0_Core(nullptr)
- , d_1_1_Core(nullptr)
- , d_1_2_Core(nullptr)
- , d_1_3_Core(nullptr)
- , d_1_4_Core(nullptr)
- , d_1_5_Core(nullptr)
- , d_2_0_Core(nullptr)
- , d_2_1_Core(nullptr)
- , d_3_0_Core(nullptr)
- , d_3_1_Core(nullptr)
- , d_3_2_Core(nullptr)
- , d_3_3_Core(nullptr)
- , d_4_0_Core(nullptr)
- , d_4_1_Core(nullptr)
-{
-}
-
-QOpenGLFunctions_4_1_Core::~QOpenGLFunctions_4_1_Core()
-{
- if (d_1_0_Core) {
- d_1_0_Core->refs.deref();
- Q_ASSERT(d_1_0_Core->refs.loadRelaxed());
- }
- if (d_1_1_Core) {
- d_1_1_Core->refs.deref();
- Q_ASSERT(d_1_1_Core->refs.loadRelaxed());
- }
- if (d_1_2_Core) {
- d_1_2_Core->refs.deref();
- Q_ASSERT(d_1_2_Core->refs.loadRelaxed());
- }
- if (d_1_3_Core) {
- d_1_3_Core->refs.deref();
- Q_ASSERT(d_1_3_Core->refs.loadRelaxed());
- }
- if (d_1_4_Core) {
- d_1_4_Core->refs.deref();
- Q_ASSERT(d_1_4_Core->refs.loadRelaxed());
- }
- if (d_1_5_Core) {
- d_1_5_Core->refs.deref();
- Q_ASSERT(d_1_5_Core->refs.loadRelaxed());
- }
- if (d_2_0_Core) {
- d_2_0_Core->refs.deref();
- Q_ASSERT(d_2_0_Core->refs.loadRelaxed());
- }
- if (d_2_1_Core) {
- d_2_1_Core->refs.deref();
- Q_ASSERT(d_2_1_Core->refs.loadRelaxed());
- }
- if (d_3_0_Core) {
- d_3_0_Core->refs.deref();
- Q_ASSERT(d_3_0_Core->refs.loadRelaxed());
- }
- if (d_3_1_Core) {
- d_3_1_Core->refs.deref();
- Q_ASSERT(d_3_1_Core->refs.loadRelaxed());
- }
- if (d_3_2_Core) {
- d_3_2_Core->refs.deref();
- Q_ASSERT(d_3_2_Core->refs.loadRelaxed());
- }
- if (d_3_3_Core) {
- d_3_3_Core->refs.deref();
- Q_ASSERT(d_3_3_Core->refs.loadRelaxed());
- }
- if (d_4_0_Core) {
- d_4_0_Core->refs.deref();
- Q_ASSERT(d_4_0_Core->refs.loadRelaxed());
- }
- if (d_4_1_Core) {
- d_4_1_Core->refs.deref();
- Q_ASSERT(d_4_1_Core->refs.loadRelaxed());
- }
-}
-
-bool QOpenGLFunctions_4_1_Core::initializeOpenGLFunctions()
-{
- if ( isInitialized() )
- return true;
-
- QOpenGLContext* context = QOpenGLContext::currentContext();
-
- // If owned by a context object make sure it is current.
- // Also check that current context is capable of resolving all needed functions
- if (((owningContext() && owningContext() == context) || !owningContext())
- && QOpenGLFunctions_4_1_Core::isContextCompatible(context))
- {
- // Associate with private implementation, creating if necessary
- // Function pointers in the backends are resolved at creation time
- QOpenGLVersionFunctionsBackend* d = nullptr;
- d = QAbstractOpenGLFunctionsPrivate::functionsBackend(context, QOpenGLFunctions_1_0_CoreBackend::versionStatus());
- d_1_0_Core = static_cast<QOpenGLFunctions_1_0_CoreBackend*>(d);
- d->refs.ref();
-
- d = QAbstractOpenGLFunctionsPrivate::functionsBackend(context, QOpenGLFunctions_1_1_CoreBackend::versionStatus());
- d_1_1_Core = static_cast<QOpenGLFunctions_1_1_CoreBackend*>(d);
- d->refs.ref();
-
- d = QAbstractOpenGLFunctionsPrivate::functionsBackend(context, QOpenGLFunctions_1_2_CoreBackend::versionStatus());
- d_1_2_Core = static_cast<QOpenGLFunctions_1_2_CoreBackend*>(d);
- d->refs.ref();
-
- d = QAbstractOpenGLFunctionsPrivate::functionsBackend(context, QOpenGLFunctions_1_3_CoreBackend::versionStatus());
- d_1_3_Core = static_cast<QOpenGLFunctions_1_3_CoreBackend*>(d);
- d->refs.ref();
-
- d = QAbstractOpenGLFunctionsPrivate::functionsBackend(context, QOpenGLFunctions_1_4_CoreBackend::versionStatus());
- d_1_4_Core = static_cast<QOpenGLFunctions_1_4_CoreBackend*>(d);
- d->refs.ref();
-
- d = QAbstractOpenGLFunctionsPrivate::functionsBackend(context, QOpenGLFunctions_1_5_CoreBackend::versionStatus());
- d_1_5_Core = static_cast<QOpenGLFunctions_1_5_CoreBackend*>(d);
- d->refs.ref();
-
- d = QAbstractOpenGLFunctionsPrivate::functionsBackend(context, QOpenGLFunctions_2_0_CoreBackend::versionStatus());
- d_2_0_Core = static_cast<QOpenGLFunctions_2_0_CoreBackend*>(d);
- d->refs.ref();
-
- d = QAbstractOpenGLFunctionsPrivate::functionsBackend(context, QOpenGLFunctions_2_1_CoreBackend::versionStatus());
- d_2_1_Core = static_cast<QOpenGLFunctions_2_1_CoreBackend*>(d);
- d->refs.ref();
-
- d = QAbstractOpenGLFunctionsPrivate::functionsBackend(context, QOpenGLFunctions_3_0_CoreBackend::versionStatus());
- d_3_0_Core = static_cast<QOpenGLFunctions_3_0_CoreBackend*>(d);
- d->refs.ref();
-
- d = QAbstractOpenGLFunctionsPrivate::functionsBackend(context, QOpenGLFunctions_3_1_CoreBackend::versionStatus());
- d_3_1_Core = static_cast<QOpenGLFunctions_3_1_CoreBackend*>(d);
- d->refs.ref();
-
- d = QAbstractOpenGLFunctionsPrivate::functionsBackend(context, QOpenGLFunctions_3_2_CoreBackend::versionStatus());
- d_3_2_Core = static_cast<QOpenGLFunctions_3_2_CoreBackend*>(d);
- d->refs.ref();
-
- d = QAbstractOpenGLFunctionsPrivate::functionsBackend(context, QOpenGLFunctions_3_3_CoreBackend::versionStatus());
- d_3_3_Core = static_cast<QOpenGLFunctions_3_3_CoreBackend*>(d);
- d->refs.ref();
-
- d = QAbstractOpenGLFunctionsPrivate::functionsBackend(context, QOpenGLFunctions_4_0_CoreBackend::versionStatus());
- d_4_0_Core = static_cast<QOpenGLFunctions_4_0_CoreBackend*>(d);
- d->refs.ref();
-
- d = QAbstractOpenGLFunctionsPrivate::functionsBackend(context, QOpenGLFunctions_4_1_CoreBackend::versionStatus());
- d_4_1_Core = static_cast<QOpenGLFunctions_4_1_CoreBackend*>(d);
- d->refs.ref();
-
- QAbstractOpenGLFunctions::initializeOpenGLFunctions();
- }
- return isInitialized();
-}
-
-bool QOpenGLFunctions_4_1_Core::isContextCompatible(QOpenGLContext *context)
-{
- Q_ASSERT(context);
- QSurfaceFormat f = context->format();
- const QPair<int, int> v = qMakePair(f.majorVersion(), f.minorVersion());
- if (v < qMakePair(4, 1))
- return false;
-
- return true;
-}
-
-QOpenGLVersionProfile QOpenGLFunctions_4_1_Core::versionProfile()
-{
- QOpenGLVersionProfile v;
- v.setVersion(4, 1);
- v.setProfile(QSurfaceFormat::CoreProfile);
- return v;
-}
-
-QT_END_NAMESPACE
diff --git a/src/gui/opengl/qopenglfunctions_4_1_core.h b/src/gui/opengl/qopenglfunctions_4_1_core.h
deleted file mode 100644
index 3a4fd0743b..0000000000
--- a/src/gui/opengl/qopenglfunctions_4_1_core.h
+++ /dev/null
@@ -1,2955 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2013 Klaralvdalens Datakonsult AB (KDAB)
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the QtGui module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-**
-** This file was generated by glgen version 0.1
-** Command line was: glgen
-**
-** glgen is Copyright (C) 2013 Klaralvdalens Datakonsult AB (KDAB)
-**
-** This is an auto-generated file.
-** Do not edit! All changes made to it will be lost.
-**
-****************************************************************************/
-
-#ifndef QOPENGLVERSIONFUNCTIONS_4_1_CORE_H
-#define QOPENGLVERSIONFUNCTIONS_4_1_CORE_H
-
-#include <QtGui/qtguiglobal.h>
-
-#if !defined(QT_NO_OPENGL) && !defined(QT_OPENGL_ES_2)
-
-#include <QtGui/QOpenGLVersionFunctions>
-#include <QtGui/qopenglcontext.h>
-
-QT_BEGIN_NAMESPACE
-
-class Q_GUI_EXPORT QOpenGLFunctions_4_1_Core : public QAbstractOpenGLFunctions
-{
-public:
- QOpenGLFunctions_4_1_Core();
- ~QOpenGLFunctions_4_1_Core();
-
- bool initializeOpenGLFunctions() override;
-
- // OpenGL 1.0 core functions
- void glViewport(GLint x, GLint y, GLsizei width, GLsizei height);
- void glDepthRange(GLdouble nearVal, GLdouble farVal);
- GLboolean glIsEnabled(GLenum cap);
- void glGetTexLevelParameteriv(GLenum target, GLint level, GLenum pname, GLint *params);
- void glGetTexLevelParameterfv(GLenum target, GLint level, GLenum pname, GLfloat *params);
- void glGetTexParameteriv(GLenum target, GLenum pname, GLint *params);
- void glGetTexParameterfv(GLenum target, GLenum pname, GLfloat *params);
- void glGetTexImage(GLenum target, GLint level, GLenum format, GLenum type, GLvoid *pixels);
- const GLubyte * glGetString(GLenum name);
- void glGetIntegerv(GLenum pname, GLint *params);
- void glGetFloatv(GLenum pname, GLfloat *params);
- GLenum glGetError();
- void glGetDoublev(GLenum pname, GLdouble *params);
- void glGetBooleanv(GLenum pname, GLboolean *params);
- void glReadPixels(GLint x, GLint y, GLsizei width, GLsizei height, GLenum format, GLenum type, GLvoid *pixels);
- void glReadBuffer(GLenum mode);
- void glPixelStorei(GLenum pname, GLint param);
- void glPixelStoref(GLenum pname, GLfloat param);
- void glDepthFunc(GLenum func);
- void glStencilOp(GLenum fail, GLenum zfail, GLenum zpass);
- void glStencilFunc(GLenum func, GLint ref, GLuint mask);
- void glLogicOp(GLenum opcode);
- void glBlendFunc(GLenum sfactor, GLenum dfactor);
- void glFlush();
- void glFinish();
- void glEnable(GLenum cap);
- void glDisable(GLenum cap);
- void glDepthMask(GLboolean flag);
- void glColorMask(GLboolean red, GLboolean green, GLboolean blue, GLboolean alpha);
- void glStencilMask(GLuint mask);
- void glClearDepth(GLdouble depth);
- void glClearStencil(GLint s);
- void glClearColor(GLfloat red, GLfloat green, GLfloat blue, GLfloat alpha);
- void glClear(GLbitfield mask);
- void glDrawBuffer(GLenum mode);
- void glTexImage2D(GLenum target, GLint level, GLint internalformat, GLsizei width, GLsizei height, GLint border, GLenum format, GLenum type, const GLvoid *pixels);
- void glTexImage1D(GLenum target, GLint level, GLint internalformat, GLsizei width, GLint border, GLenum format, GLenum type, const GLvoid *pixels);
- void glTexParameteriv(GLenum target, GLenum pname, const GLint *params);
- void glTexParameteri(GLenum target, GLenum pname, GLint param);
- void glTexParameterfv(GLenum target, GLenum pname, const GLfloat *params);
- void glTexParameterf(GLenum target, GLenum pname, GLfloat param);
- void glScissor(GLint x, GLint y, GLsizei width, GLsizei height);
- void glPolygonMode(GLenum face, GLenum mode);
- void glPointSize(GLfloat size);
- void glLineWidth(GLfloat width);
- void glHint(GLenum target, GLenum mode);
- void glFrontFace(GLenum mode);
- void glCullFace(GLenum mode);
-
- // OpenGL 1.1 core functions
- void glIndexubv(const GLubyte *c);
- void glIndexub(GLubyte c);
- GLboolean glIsTexture(GLuint texture);
- void glGenTextures(GLsizei n, GLuint *textures);
- void glDeleteTextures(GLsizei n, const GLuint *textures);
- void glBindTexture(GLenum target, GLuint texture);
- void glTexSubImage2D(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLenum type, const GLvoid *pixels);
- void glTexSubImage1D(GLenum target, GLint level, GLint xoffset, GLsizei width, GLenum format, GLenum type, const GLvoid *pixels);
- void glCopyTexSubImage2D(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint x, GLint y, GLsizei width, GLsizei height);
- void glCopyTexSubImage1D(GLenum target, GLint level, GLint xoffset, GLint x, GLint y, GLsizei width);
- void glCopyTexImage2D(GLenum target, GLint level, GLenum internalformat, GLint x, GLint y, GLsizei width, GLsizei height, GLint border);
- void glCopyTexImage1D(GLenum target, GLint level, GLenum internalformat, GLint x, GLint y, GLsizei width, GLint border);
- void glPolygonOffset(GLfloat factor, GLfloat units);
- void glGetPointerv(GLenum pname, GLvoid* *params);
- void glDrawElements(GLenum mode, GLsizei count, GLenum type, const GLvoid *indices);
- void glDrawArrays(GLenum mode, GLint first, GLsizei count);
-
- // OpenGL 1.2 core functions
- void glCopyTexSubImage3D(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLint x, GLint y, GLsizei width, GLsizei height);
- void glTexSubImage3D(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLenum type, const GLvoid *pixels);
- void glTexImage3D(GLenum target, GLint level, GLint internalformat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLenum format, GLenum type, const GLvoid *pixels);
- void glDrawRangeElements(GLenum mode, GLuint start, GLuint end, GLsizei count, GLenum type, const GLvoid *indices);
- void glBlendEquation(GLenum mode);
- void glBlendColor(GLfloat red, GLfloat green, GLfloat blue, GLfloat alpha);
-
- // OpenGL 1.3 core functions
- void glGetCompressedTexImage(GLenum target, GLint level, GLvoid *img);
- void glCompressedTexSubImage1D(GLenum target, GLint level, GLint xoffset, GLsizei width, GLenum format, GLsizei imageSize, const GLvoid *data);
- void glCompressedTexSubImage2D(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLsizei imageSize, const GLvoid *data);
- void glCompressedTexSubImage3D(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLsizei imageSize, const GLvoid *data);
- void glCompressedTexImage1D(GLenum target, GLint level, GLenum internalformat, GLsizei width, GLint border, GLsizei imageSize, const GLvoid *data);
- void glCompressedTexImage2D(GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLint border, GLsizei imageSize, const GLvoid *data);
- void glCompressedTexImage3D(GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLsizei imageSize, const GLvoid *data);
- void glSampleCoverage(GLfloat value, GLboolean invert);
- void glActiveTexture(GLenum texture);
-
- // OpenGL 1.4 core functions
- void glPointParameteriv(GLenum pname, const GLint *params);
- void glPointParameteri(GLenum pname, GLint param);
- void glPointParameterfv(GLenum pname, const GLfloat *params);
- void glPointParameterf(GLenum pname, GLfloat param);
- void glMultiDrawElements(GLenum mode, const GLsizei *count, GLenum type, const GLvoid* const *indices, GLsizei drawcount);
- void glMultiDrawArrays(GLenum mode, const GLint *first, const GLsizei *count, GLsizei drawcount);
- void glBlendFuncSeparate(GLenum sfactorRGB, GLenum dfactorRGB, GLenum sfactorAlpha, GLenum dfactorAlpha);
-
- // OpenGL 1.5 core functions
- void glGetBufferPointerv(GLenum target, GLenum pname, GLvoid* *params);
- void glGetBufferParameteriv(GLenum target, GLenum pname, GLint *params);
- GLboolean glUnmapBuffer(GLenum target);
- GLvoid* glMapBuffer(GLenum target, GLenum access);
- void glGetBufferSubData(GLenum target, GLintptr offset, GLsizeiptr size, GLvoid *data);
- void glBufferSubData(GLenum target, GLintptr offset, GLsizeiptr size, const GLvoid *data);
- void glBufferData(GLenum target, GLsizeiptr size, const GLvoid *data, GLenum usage);
- GLboolean glIsBuffer(GLuint buffer);
- void glGenBuffers(GLsizei n, GLuint *buffers);
- void glDeleteBuffers(GLsizei n, const GLuint *buffers);
- void glBindBuffer(GLenum target, GLuint buffer);
- void glGetQueryObjectuiv(GLuint id, GLenum pname, GLuint *params);
- void glGetQueryObjectiv(GLuint id, GLenum pname, GLint *params);
- void glGetQueryiv(GLenum target, GLenum pname, GLint *params);
- void glEndQuery(GLenum target);
- void glBeginQuery(GLenum target, GLuint id);
- GLboolean glIsQuery(GLuint id);
- void glDeleteQueries(GLsizei n, const GLuint *ids);
- void glGenQueries(GLsizei n, GLuint *ids);
-
- // OpenGL 2.0 core functions
- void glVertexAttribPointer(GLuint index, GLint size, GLenum type, GLboolean normalized, GLsizei stride, const GLvoid *pointer);
- void glValidateProgram(GLuint program);
- void glUniformMatrix4fv(GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
- void glUniformMatrix3fv(GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
- void glUniformMatrix2fv(GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
- void glUniform4iv(GLint location, GLsizei count, const GLint *value);
- void glUniform3iv(GLint location, GLsizei count, const GLint *value);
- void glUniform2iv(GLint location, GLsizei count, const GLint *value);
- void glUniform1iv(GLint location, GLsizei count, const GLint *value);
- void glUniform4fv(GLint location, GLsizei count, const GLfloat *value);
- void glUniform3fv(GLint location, GLsizei count, const GLfloat *value);
- void glUniform2fv(GLint location, GLsizei count, const GLfloat *value);
- void glUniform1fv(GLint location, GLsizei count, const GLfloat *value);
- void glUniform4i(GLint location, GLint v0, GLint v1, GLint v2, GLint v3);
- void glUniform3i(GLint location, GLint v0, GLint v1, GLint v2);
- void glUniform2i(GLint location, GLint v0, GLint v1);
- void glUniform1i(GLint location, GLint v0);
- void glUniform4f(GLint location, GLfloat v0, GLfloat v1, GLfloat v2, GLfloat v3);
- void glUniform3f(GLint location, GLfloat v0, GLfloat v1, GLfloat v2);
- void glUniform2f(GLint location, GLfloat v0, GLfloat v1);
- void glUniform1f(GLint location, GLfloat v0);
- void glUseProgram(GLuint program);
- void glShaderSource(GLuint shader, GLsizei count, const GLchar* const *string, const GLint *length);
- void glLinkProgram(GLuint program);
- GLboolean glIsShader(GLuint shader);
- GLboolean glIsProgram(GLuint program);
- void glGetVertexAttribPointerv(GLuint index, GLenum pname, GLvoid* *pointer);
- void glGetVertexAttribiv(GLuint index, GLenum pname, GLint *params);
- void glGetVertexAttribfv(GLuint index, GLenum pname, GLfloat *params);
- void glGetVertexAttribdv(GLuint index, GLenum pname, GLdouble *params);
- void glGetUniformiv(GLuint program, GLint location, GLint *params);
- void glGetUniformfv(GLuint program, GLint location, GLfloat *params);
- GLint glGetUniformLocation(GLuint program, const GLchar *name);
- void glGetShaderSource(GLuint shader, GLsizei bufSize, GLsizei *length, GLchar *source);
- void glGetShaderInfoLog(GLuint shader, GLsizei bufSize, GLsizei *length, GLchar *infoLog);
- void glGetShaderiv(GLuint shader, GLenum pname, GLint *params);
- void glGetProgramInfoLog(GLuint program, GLsizei bufSize, GLsizei *length, GLchar *infoLog);
- void glGetProgramiv(GLuint program, GLenum pname, GLint *params);
- GLint glGetAttribLocation(GLuint program, const GLchar *name);
- void glGetAttachedShaders(GLuint program, GLsizei maxCount, GLsizei *count, GLuint *obj);
- void glGetActiveUniform(GLuint program, GLuint index, GLsizei bufSize, GLsizei *length, GLint *size, GLenum *type, GLchar *name);
- void glGetActiveAttrib(GLuint program, GLuint index, GLsizei bufSize, GLsizei *length, GLint *size, GLenum *type, GLchar *name);
- void glEnableVertexAttribArray(GLuint index);
- void glDisableVertexAttribArray(GLuint index);
- void glDetachShader(GLuint program, GLuint shader);
- void glDeleteShader(GLuint shader);
- void glDeleteProgram(GLuint program);
- GLuint glCreateShader(GLenum type);
- GLuint glCreateProgram();
- void glCompileShader(GLuint shader);
- void glBindAttribLocation(GLuint program, GLuint index, const GLchar *name);
- void glAttachShader(GLuint program, GLuint shader);
- void glStencilMaskSeparate(GLenum face, GLuint mask);
- void glStencilFuncSeparate(GLenum face, GLenum func, GLint ref, GLuint mask);
- void glStencilOpSeparate(GLenum face, GLenum sfail, GLenum dpfail, GLenum dppass);
- void glDrawBuffers(GLsizei n, const GLenum *bufs);
- void glBlendEquationSeparate(GLenum modeRGB, GLenum modeAlpha);
-
- // OpenGL 2.1 core functions
- void glUniformMatrix4x3fv(GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
- void glUniformMatrix3x4fv(GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
- void glUniformMatrix4x2fv(GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
- void glUniformMatrix2x4fv(GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
- void glUniformMatrix3x2fv(GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
- void glUniformMatrix2x3fv(GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
-
- // OpenGL 3.0 core functions
- GLboolean glIsVertexArray(GLuint array);
- void glGenVertexArrays(GLsizei n, GLuint *arrays);
- void glDeleteVertexArrays(GLsizei n, const GLuint *arrays);
- void glBindVertexArray(GLuint array);
- void glFlushMappedBufferRange(GLenum target, GLintptr offset, GLsizeiptr length);
- GLvoid* glMapBufferRange(GLenum target, GLintptr offset, GLsizeiptr length, GLbitfield access);
- void glFramebufferTextureLayer(GLenum target, GLenum attachment, GLuint texture, GLint level, GLint layer);
- void glRenderbufferStorageMultisample(GLenum target, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height);
- void glBlitFramebuffer(GLint srcX0, GLint srcY0, GLint srcX1, GLint srcY1, GLint dstX0, GLint dstY0, GLint dstX1, GLint dstY1, GLbitfield mask, GLenum filter);
- void glGenerateMipmap(GLenum target);
- void glGetFramebufferAttachmentParameteriv(GLenum target, GLenum attachment, GLenum pname, GLint *params);
- void glFramebufferRenderbuffer(GLenum target, GLenum attachment, GLenum renderbuffertarget, GLuint renderbuffer);
- void glFramebufferTexture3D(GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level, GLint zoffset);
- void glFramebufferTexture2D(GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level);
- void glFramebufferTexture1D(GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level);
- GLenum glCheckFramebufferStatus(GLenum target);
- void glGenFramebuffers(GLsizei n, GLuint *framebuffers);
- void glDeleteFramebuffers(GLsizei n, const GLuint *framebuffers);
- void glBindFramebuffer(GLenum target, GLuint framebuffer);
- GLboolean glIsFramebuffer(GLuint framebuffer);
- void glGetRenderbufferParameteriv(GLenum target, GLenum pname, GLint *params);
- void glRenderbufferStorage(GLenum target, GLenum internalformat, GLsizei width, GLsizei height);
- void glGenRenderbuffers(GLsizei n, GLuint *renderbuffers);
- void glDeleteRenderbuffers(GLsizei n, const GLuint *renderbuffers);
- void glBindRenderbuffer(GLenum target, GLuint renderbuffer);
- GLboolean glIsRenderbuffer(GLuint renderbuffer);
- const GLubyte * glGetStringi(GLenum name, GLuint index);
- void glClearBufferfi(GLenum buffer, GLint drawbuffer, GLfloat depth, GLint stencil);
- void glClearBufferfv(GLenum buffer, GLint drawbuffer, const GLfloat *value);
- void glClearBufferuiv(GLenum buffer, GLint drawbuffer, const GLuint *value);
- void glClearBufferiv(GLenum buffer, GLint drawbuffer, const GLint *value);
- void glGetTexParameterIuiv(GLenum target, GLenum pname, GLuint *params);
- void glGetTexParameterIiv(GLenum target, GLenum pname, GLint *params);
- void glTexParameterIuiv(GLenum target, GLenum pname, const GLuint *params);
- void glTexParameterIiv(GLenum target, GLenum pname, const GLint *params);
- void glUniform4uiv(GLint location, GLsizei count, const GLuint *value);
- void glUniform3uiv(GLint location, GLsizei count, const GLuint *value);
- void glUniform2uiv(GLint location, GLsizei count, const GLuint *value);
- void glUniform1uiv(GLint location, GLsizei count, const GLuint *value);
- void glUniform4ui(GLint location, GLuint v0, GLuint v1, GLuint v2, GLuint v3);
- void glUniform3ui(GLint location, GLuint v0, GLuint v1, GLuint v2);
- void glUniform2ui(GLint location, GLuint v0, GLuint v1);
- void glUniform1ui(GLint location, GLuint v0);
- GLint glGetFragDataLocation(GLuint program, const GLchar *name);
- void glBindFragDataLocation(GLuint program, GLuint color, const GLchar *name);
- void glGetUniformuiv(GLuint program, GLint location, GLuint *params);
- void glGetVertexAttribIuiv(GLuint index, GLenum pname, GLuint *params);
- void glGetVertexAttribIiv(GLuint index, GLenum pname, GLint *params);
- void glVertexAttribIPointer(GLuint index, GLint size, GLenum type, GLsizei stride, const GLvoid *pointer);
- void glEndConditionalRender();
- void glBeginConditionalRender(GLuint id, GLenum mode);
- void glClampColor(GLenum target, GLenum clamp);
- void glGetTransformFeedbackVarying(GLuint program, GLuint index, GLsizei bufSize, GLsizei *length, GLsizei *size, GLenum *type, GLchar *name);
- void glTransformFeedbackVaryings(GLuint program, GLsizei count, const GLchar* const *varyings, GLenum bufferMode);
- void glBindBufferBase(GLenum target, GLuint index, GLuint buffer);
- void glBindBufferRange(GLenum target, GLuint index, GLuint buffer, GLintptr offset, GLsizeiptr size);
- void glEndTransformFeedback();
- void glBeginTransformFeedback(GLenum primitiveMode);
- GLboolean glIsEnabledi(GLenum target, GLuint index);
- void glDisablei(GLenum target, GLuint index);
- void glEnablei(GLenum target, GLuint index);
- void glGetIntegeri_v(GLenum target, GLuint index, GLint *data);
- void glGetBooleani_v(GLenum target, GLuint index, GLboolean *data);
- void glColorMaski(GLuint index, GLboolean r, GLboolean g, GLboolean b, GLboolean a);
-
- // OpenGL 3.1 core functions
- void glCopyBufferSubData(GLenum readTarget, GLenum writeTarget, GLintptr readOffset, GLintptr writeOffset, GLsizeiptr size);
- void glUniformBlockBinding(GLuint program, GLuint uniformBlockIndex, GLuint uniformBlockBinding);
- void glGetActiveUniformBlockName(GLuint program, GLuint uniformBlockIndex, GLsizei bufSize, GLsizei *length, GLchar *uniformBlockName);
- void glGetActiveUniformBlockiv(GLuint program, GLuint uniformBlockIndex, GLenum pname, GLint *params);
- GLuint glGetUniformBlockIndex(GLuint program, const GLchar *uniformBlockName);
- void glGetActiveUniformName(GLuint program, GLuint uniformIndex, GLsizei bufSize, GLsizei *length, GLchar *uniformName);
- void glGetActiveUniformsiv(GLuint program, GLsizei uniformCount, const GLuint *uniformIndices, GLenum pname, GLint *params);
- void glGetUniformIndices(GLuint program, GLsizei uniformCount, const GLchar* const *uniformNames, GLuint *uniformIndices);
- void glPrimitiveRestartIndex(GLuint index);
- void glTexBuffer(GLenum target, GLenum internalformat, GLuint buffer);
- void glDrawElementsInstanced(GLenum mode, GLsizei count, GLenum type, const GLvoid *indices, GLsizei instancecount);
- void glDrawArraysInstanced(GLenum mode, GLint first, GLsizei count, GLsizei instancecount);
-
- // OpenGL 3.2 core functions
- void glSampleMaski(GLuint index, GLbitfield mask);
- void glGetMultisamplefv(GLenum pname, GLuint index, GLfloat *val);
- void glTexImage3DMultisample(GLenum target, GLsizei samples, GLint internalformat, GLsizei width, GLsizei height, GLsizei depth, GLboolean fixedsamplelocations);
- void glTexImage2DMultisample(GLenum target, GLsizei samples, GLint internalformat, GLsizei width, GLsizei height, GLboolean fixedsamplelocations);
- void glGetSynciv(GLsync sync, GLenum pname, GLsizei bufSize, GLsizei *length, GLint *values);
- void glGetInteger64v(GLenum pname, GLint64 *params);
- void glWaitSync(GLsync sync, GLbitfield flags, GLuint64 timeout);
- GLenum glClientWaitSync(GLsync sync, GLbitfield flags, GLuint64 timeout);
- void glDeleteSync(GLsync sync);
- GLboolean glIsSync(GLsync sync);
- GLsync glFenceSync(GLenum condition, GLbitfield flags);
- void glProvokingVertex(GLenum mode);
- void glMultiDrawElementsBaseVertex(GLenum mode, const GLsizei *count, GLenum type, const GLvoid* const *indices, GLsizei drawcount, const GLint *basevertex);
- void glDrawElementsInstancedBaseVertex(GLenum mode, GLsizei count, GLenum type, const GLvoid *indices, GLsizei instancecount, GLint basevertex);
- void glDrawRangeElementsBaseVertex(GLenum mode, GLuint start, GLuint end, GLsizei count, GLenum type, const GLvoid *indices, GLint basevertex);
- void glDrawElementsBaseVertex(GLenum mode, GLsizei count, GLenum type, const GLvoid *indices, GLint basevertex);
- void glFramebufferTexture(GLenum target, GLenum attachment, GLuint texture, GLint level);
- void glGetBufferParameteri64v(GLenum target, GLenum pname, GLint64 *params);
- void glGetInteger64i_v(GLenum target, GLuint index, GLint64 *data);
-
- // OpenGL 3.3 core functions
- void glVertexAttribP4uiv(GLuint index, GLenum type, GLboolean normalized, const GLuint *value);
- void glVertexAttribP4ui(GLuint index, GLenum type, GLboolean normalized, GLuint value);
- void glVertexAttribP3uiv(GLuint index, GLenum type, GLboolean normalized, const GLuint *value);
- void glVertexAttribP3ui(GLuint index, GLenum type, GLboolean normalized, GLuint value);
- void glVertexAttribP2uiv(GLuint index, GLenum type, GLboolean normalized, const GLuint *value);
- void glVertexAttribP2ui(GLuint index, GLenum type, GLboolean normalized, GLuint value);
- void glVertexAttribP1uiv(GLuint index, GLenum type, GLboolean normalized, const GLuint *value);
- void glVertexAttribP1ui(GLuint index, GLenum type, GLboolean normalized, GLuint value);
- void glSecondaryColorP3uiv(GLenum type, const GLuint *color);
- void glSecondaryColorP3ui(GLenum type, GLuint color);
- void glColorP4uiv(GLenum type, const GLuint *color);
- void glColorP4ui(GLenum type, GLuint color);
- void glColorP3uiv(GLenum type, const GLuint *color);
- void glColorP3ui(GLenum type, GLuint color);
- void glNormalP3uiv(GLenum type, const GLuint *coords);
- void glNormalP3ui(GLenum type, GLuint coords);
- void glMultiTexCoordP4uiv(GLenum texture, GLenum type, const GLuint *coords);
- void glMultiTexCoordP4ui(GLenum texture, GLenum type, GLuint coords);
- void glMultiTexCoordP3uiv(GLenum texture, GLenum type, const GLuint *coords);
- void glMultiTexCoordP3ui(GLenum texture, GLenum type, GLuint coords);
- void glMultiTexCoordP2uiv(GLenum texture, GLenum type, const GLuint *coords);
- void glMultiTexCoordP2ui(GLenum texture, GLenum type, GLuint coords);
- void glMultiTexCoordP1uiv(GLenum texture, GLenum type, const GLuint *coords);
- void glMultiTexCoordP1ui(GLenum texture, GLenum type, GLuint coords);
- void glTexCoordP4uiv(GLenum type, const GLuint *coords);
- void glTexCoordP4ui(GLenum type, GLuint coords);
- void glTexCoordP3uiv(GLenum type, const GLuint *coords);
- void glTexCoordP3ui(GLenum type, GLuint coords);
- void glTexCoordP2uiv(GLenum type, const GLuint *coords);
- void glTexCoordP2ui(GLenum type, GLuint coords);
- void glTexCoordP1uiv(GLenum type, const GLuint *coords);
- void glTexCoordP1ui(GLenum type, GLuint coords);
- void glVertexP4uiv(GLenum type, const GLuint *value);
- void glVertexP4ui(GLenum type, GLuint value);
- void glVertexP3uiv(GLenum type, const GLuint *value);
- void glVertexP3ui(GLenum type, GLuint value);
- void glVertexP2uiv(GLenum type, const GLuint *value);
- void glVertexP2ui(GLenum type, GLuint value);
- void glGetQueryObjectui64v(GLuint id, GLenum pname, GLuint64 *params);
- void glGetQueryObjecti64v(GLuint id, GLenum pname, GLint64 *params);
- void glQueryCounter(GLuint id, GLenum target);
- void glGetSamplerParameterIuiv(GLuint sampler, GLenum pname, GLuint *params);
- void glGetSamplerParameterfv(GLuint sampler, GLenum pname, GLfloat *params);
- void glGetSamplerParameterIiv(GLuint sampler, GLenum pname, GLint *params);
- void glGetSamplerParameteriv(GLuint sampler, GLenum pname, GLint *params);
- void glSamplerParameterIuiv(GLuint sampler, GLenum pname, const GLuint *param);
- void glSamplerParameterIiv(GLuint sampler, GLenum pname, const GLint *param);
- void glSamplerParameterfv(GLuint sampler, GLenum pname, const GLfloat *param);
- void glSamplerParameterf(GLuint sampler, GLenum pname, GLfloat param);
- void glSamplerParameteriv(GLuint sampler, GLenum pname, const GLint *param);
- void glSamplerParameteri(GLuint sampler, GLenum pname, GLint param);
- void glBindSampler(GLuint unit, GLuint sampler);
- GLboolean glIsSampler(GLuint sampler);
- void glDeleteSamplers(GLsizei count, const GLuint *samplers);
- void glGenSamplers(GLsizei count, GLuint *samplers);
- GLint glGetFragDataIndex(GLuint program, const GLchar *name);
- void glBindFragDataLocationIndexed(GLuint program, GLuint colorNumber, GLuint index, const GLchar *name);
- void glVertexAttribDivisor(GLuint index, GLuint divisor);
-
- // OpenGL 4.0 core functions
- void glGetQueryIndexediv(GLenum target, GLuint index, GLenum pname, GLint *params);
- void glEndQueryIndexed(GLenum target, GLuint index);
- void glBeginQueryIndexed(GLenum target, GLuint index, GLuint id);
- void glDrawTransformFeedbackStream(GLenum mode, GLuint id, GLuint stream);
- void glDrawTransformFeedback(GLenum mode, GLuint id);
- void glResumeTransformFeedback();
- void glPauseTransformFeedback();
- GLboolean glIsTransformFeedback(GLuint id);
- void glGenTransformFeedbacks(GLsizei n, GLuint *ids);
- void glDeleteTransformFeedbacks(GLsizei n, const GLuint *ids);
- void glBindTransformFeedback(GLenum target, GLuint id);
- void glPatchParameterfv(GLenum pname, const GLfloat *values);
- void glPatchParameteri(GLenum pname, GLint value);
- void glGetProgramStageiv(GLuint program, GLenum shadertype, GLenum pname, GLint *values);
- void glGetUniformSubroutineuiv(GLenum shadertype, GLint location, GLuint *params);
- void glUniformSubroutinesuiv(GLenum shadertype, GLsizei count, const GLuint *indices);
- void glGetActiveSubroutineName(GLuint program, GLenum shadertype, GLuint index, GLsizei bufsize, GLsizei *length, GLchar *name);
- void glGetActiveSubroutineUniformName(GLuint program, GLenum shadertype, GLuint index, GLsizei bufsize, GLsizei *length, GLchar *name);
- void glGetActiveSubroutineUniformiv(GLuint program, GLenum shadertype, GLuint index, GLenum pname, GLint *values);
- GLuint glGetSubroutineIndex(GLuint program, GLenum shadertype, const GLchar *name);
- GLint glGetSubroutineUniformLocation(GLuint program, GLenum shadertype, const GLchar *name);
- void glGetUniformdv(GLuint program, GLint location, GLdouble *params);
- void glUniformMatrix4x3dv(GLint location, GLsizei count, GLboolean transpose, const GLdouble *value);
- void glUniformMatrix4x2dv(GLint location, GLsizei count, GLboolean transpose, const GLdouble *value);
- void glUniformMatrix3x4dv(GLint location, GLsizei count, GLboolean transpose, const GLdouble *value);
- void glUniformMatrix3x2dv(GLint location, GLsizei count, GLboolean transpose, const GLdouble *value);
- void glUniformMatrix2x4dv(GLint location, GLsizei count, GLboolean transpose, const GLdouble *value);
- void glUniformMatrix2x3dv(GLint location, GLsizei count, GLboolean transpose, const GLdouble *value);
- void glUniformMatrix4dv(GLint location, GLsizei count, GLboolean transpose, const GLdouble *value);
- void glUniformMatrix3dv(GLint location, GLsizei count, GLboolean transpose, const GLdouble *value);
- void glUniformMatrix2dv(GLint location, GLsizei count, GLboolean transpose, const GLdouble *value);
- void glUniform4dv(GLint location, GLsizei count, const GLdouble *value);
- void glUniform3dv(GLint location, GLsizei count, const GLdouble *value);
- void glUniform2dv(GLint location, GLsizei count, const GLdouble *value);
- void glUniform1dv(GLint location, GLsizei count, const GLdouble *value);
- void glUniform4d(GLint location, GLdouble x, GLdouble y, GLdouble z, GLdouble w);
- void glUniform3d(GLint location, GLdouble x, GLdouble y, GLdouble z);
- void glUniform2d(GLint location, GLdouble x, GLdouble y);
- void glUniform1d(GLint location, GLdouble x);
- void glDrawElementsIndirect(GLenum mode, GLenum type, const GLvoid *indirect);
- void glDrawArraysIndirect(GLenum mode, const GLvoid *indirect);
- void glBlendFuncSeparatei(GLuint buf, GLenum srcRGB, GLenum dstRGB, GLenum srcAlpha, GLenum dstAlpha);
- void glBlendFunci(GLuint buf, GLenum src, GLenum dst);
- void glBlendEquationSeparatei(GLuint buf, GLenum modeRGB, GLenum modeAlpha);
- void glBlendEquationi(GLuint buf, GLenum mode);
- void glMinSampleShading(GLfloat value);
-
- // OpenGL 4.1 core functions
- void glGetDoublei_v(GLenum target, GLuint index, GLdouble *data);
- void glGetFloati_v(GLenum target, GLuint index, GLfloat *data);
- void glDepthRangeIndexed(GLuint index, GLdouble n, GLdouble f);
- void glDepthRangeArrayv(GLuint first, GLsizei count, const GLdouble *v);
- void glScissorIndexedv(GLuint index, const GLint *v);
- void glScissorIndexed(GLuint index, GLint left, GLint bottom, GLsizei width, GLsizei height);
- void glScissorArrayv(GLuint first, GLsizei count, const GLint *v);
- void glViewportIndexedfv(GLuint index, const GLfloat *v);
- void glViewportIndexedf(GLuint index, GLfloat x, GLfloat y, GLfloat w, GLfloat h);
- void glViewportArrayv(GLuint first, GLsizei count, const GLfloat *v);
- void glGetVertexAttribLdv(GLuint index, GLenum pname, GLdouble *params);
- void glVertexAttribLPointer(GLuint index, GLint size, GLenum type, GLsizei stride, const GLvoid *pointer);
- void glVertexAttribL4dv(GLuint index, const GLdouble *v);
- void glVertexAttribL3dv(GLuint index, const GLdouble *v);
- void glVertexAttribL2dv(GLuint index, const GLdouble *v);
- void glVertexAttribL1dv(GLuint index, const GLdouble *v);
- void glVertexAttribL4d(GLuint index, GLdouble x, GLdouble y, GLdouble z, GLdouble w);
- void glVertexAttribL3d(GLuint index, GLdouble x, GLdouble y, GLdouble z);
- void glVertexAttribL2d(GLuint index, GLdouble x, GLdouble y);
- void glVertexAttribL1d(GLuint index, GLdouble x);
- void glGetProgramPipelineInfoLog(GLuint pipeline, GLsizei bufSize, GLsizei *length, GLchar *infoLog);
- void glValidateProgramPipeline(GLuint pipeline);
- void glProgramUniformMatrix4x3dv(GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLdouble *value);
- void glProgramUniformMatrix3x4dv(GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLdouble *value);
- void glProgramUniformMatrix4x2dv(GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLdouble *value);
- void glProgramUniformMatrix2x4dv(GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLdouble *value);
- void glProgramUniformMatrix3x2dv(GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLdouble *value);
- void glProgramUniformMatrix2x3dv(GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLdouble *value);
- void glProgramUniformMatrix4x3fv(GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
- void glProgramUniformMatrix3x4fv(GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
- void glProgramUniformMatrix4x2fv(GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
- void glProgramUniformMatrix2x4fv(GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
- void glProgramUniformMatrix3x2fv(GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
- void glProgramUniformMatrix2x3fv(GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
- void glProgramUniformMatrix4dv(GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLdouble *value);
- void glProgramUniformMatrix3dv(GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLdouble *value);
- void glProgramUniformMatrix2dv(GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLdouble *value);
- void glProgramUniformMatrix4fv(GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
- void glProgramUniformMatrix3fv(GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
- void glProgramUniformMatrix2fv(GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
- void glProgramUniform4uiv(GLuint program, GLint location, GLsizei count, const GLuint *value);
- void glProgramUniform4ui(GLuint program, GLint location, GLuint v0, GLuint v1, GLuint v2, GLuint v3);
- void glProgramUniform4dv(GLuint program, GLint location, GLsizei count, const GLdouble *value);
- void glProgramUniform4d(GLuint program, GLint location, GLdouble v0, GLdouble v1, GLdouble v2, GLdouble v3);
- void glProgramUniform4fv(GLuint program, GLint location, GLsizei count, const GLfloat *value);
- void glProgramUniform4f(GLuint program, GLint location, GLfloat v0, GLfloat v1, GLfloat v2, GLfloat v3);
- void glProgramUniform4iv(GLuint program, GLint location, GLsizei count, const GLint *value);
- void glProgramUniform4i(GLuint program, GLint location, GLint v0, GLint v1, GLint v2, GLint v3);
- void glProgramUniform3uiv(GLuint program, GLint location, GLsizei count, const GLuint *value);
- void glProgramUniform3ui(GLuint program, GLint location, GLuint v0, GLuint v1, GLuint v2);
- void glProgramUniform3dv(GLuint program, GLint location, GLsizei count, const GLdouble *value);
- void glProgramUniform3d(GLuint program, GLint location, GLdouble v0, GLdouble v1, GLdouble v2);
- void glProgramUniform3fv(GLuint program, GLint location, GLsizei count, const GLfloat *value);
- void glProgramUniform3f(GLuint program, GLint location, GLfloat v0, GLfloat v1, GLfloat v2);
- void glProgramUniform3iv(GLuint program, GLint location, GLsizei count, const GLint *value);
- void glProgramUniform3i(GLuint program, GLint location, GLint v0, GLint v1, GLint v2);
- void glProgramUniform2uiv(GLuint program, GLint location, GLsizei count, const GLuint *value);
- void glProgramUniform2ui(GLuint program, GLint location, GLuint v0, GLuint v1);
- void glProgramUniform2dv(GLuint program, GLint location, GLsizei count, const GLdouble *value);
- void glProgramUniform2d(GLuint program, GLint location, GLdouble v0, GLdouble v1);
- void glProgramUniform2fv(GLuint program, GLint location, GLsizei count, const GLfloat *value);
- void glProgramUniform2f(GLuint program, GLint location, GLfloat v0, GLfloat v1);
- void glProgramUniform2iv(GLuint program, GLint location, GLsizei count, const GLint *value);
- void glProgramUniform2i(GLuint program, GLint location, GLint v0, GLint v1);
- void glProgramUniform1uiv(GLuint program, GLint location, GLsizei count, const GLuint *value);
- void glProgramUniform1ui(GLuint program, GLint location, GLuint v0);
- void glProgramUniform1dv(GLuint program, GLint location, GLsizei count, const GLdouble *value);
- void glProgramUniform1d(GLuint program, GLint location, GLdouble v0);
- void glProgramUniform1fv(GLuint program, GLint location, GLsizei count, const GLfloat *value);
- void glProgramUniform1f(GLuint program, GLint location, GLfloat v0);
- void glProgramUniform1iv(GLuint program, GLint location, GLsizei count, const GLint *value);
- void glProgramUniform1i(GLuint program, GLint location, GLint v0);
- void glGetProgramPipelineiv(GLuint pipeline, GLenum pname, GLint *params);
- GLboolean glIsProgramPipeline(GLuint pipeline);
- void glGenProgramPipelines(GLsizei n, GLuint *pipelines);
- void glDeleteProgramPipelines(GLsizei n, const GLuint *pipelines);
- void glBindProgramPipeline(GLuint pipeline);
- GLuint glCreateShaderProgramv(GLenum type, GLsizei count, const GLchar* const *strings);
- void glActiveShaderProgram(GLuint pipeline, GLuint program);
- void glUseProgramStages(GLuint pipeline, GLbitfield stages, GLuint program);
- void glProgramParameteri(GLuint program, GLenum pname, GLint value);
- void glProgramBinary(GLuint program, GLenum binaryFormat, const GLvoid *binary, GLsizei length);
- void glGetProgramBinary(GLuint program, GLsizei bufSize, GLsizei *length, GLenum *binaryFormat, GLvoid *binary);
- void glClearDepthf(GLfloat dd);
- void glDepthRangef(GLfloat n, GLfloat f);
- void glGetShaderPrecisionFormat(GLenum shadertype, GLenum precisiontype, GLint *range, GLint *precision);
- void glShaderBinary(GLsizei count, const GLuint *shaders, GLenum binaryformat, const GLvoid *binary, GLsizei length);
- void glReleaseShaderCompiler();
-
-private:
- friend class QOpenGLContext;
-
- static bool isContextCompatible(QOpenGLContext *context);
- static QOpenGLVersionProfile versionProfile();
-
- QOpenGLFunctions_1_0_CoreBackend* d_1_0_Core;
- QOpenGLFunctions_1_1_CoreBackend* d_1_1_Core;
- QOpenGLFunctions_1_2_CoreBackend* d_1_2_Core;
- QOpenGLFunctions_1_3_CoreBackend* d_1_3_Core;
- QOpenGLFunctions_1_4_CoreBackend* d_1_4_Core;
- QOpenGLFunctions_1_5_CoreBackend* d_1_5_Core;
- QOpenGLFunctions_2_0_CoreBackend* d_2_0_Core;
- QOpenGLFunctions_2_1_CoreBackend* d_2_1_Core;
- QOpenGLFunctions_3_0_CoreBackend* d_3_0_Core;
- QOpenGLFunctions_3_1_CoreBackend* d_3_1_Core;
- QOpenGLFunctions_3_2_CoreBackend* d_3_2_Core;
- QOpenGLFunctions_3_3_CoreBackend* d_3_3_Core;
- QOpenGLFunctions_4_0_CoreBackend* d_4_0_Core;
- QOpenGLFunctions_4_1_CoreBackend* d_4_1_Core;
-};
-
-// OpenGL 1.0 core functions
-inline void QOpenGLFunctions_4_1_Core::glViewport(GLint x, GLint y, GLsizei width, GLsizei height)
-{
- d_1_0_Core->f.Viewport(x, y, width, height);
-}
-
-inline void QOpenGLFunctions_4_1_Core::glDepthRange(GLdouble nearVal, GLdouble farVal)
-{
- d_1_0_Core->f.DepthRange(nearVal, farVal);
-}
-
-inline GLboolean QOpenGLFunctions_4_1_Core::glIsEnabled(GLenum cap)
-{
- return d_1_0_Core->f.IsEnabled(cap);
-}
-
-inline void QOpenGLFunctions_4_1_Core::glGetTexLevelParameteriv(GLenum target, GLint level, GLenum pname, GLint *params)
-{
- d_1_0_Core->f.GetTexLevelParameteriv(target, level, pname, params);
-}
-
-inline void QOpenGLFunctions_4_1_Core::glGetTexLevelParameterfv(GLenum target, GLint level, GLenum pname, GLfloat *params)
-{
- d_1_0_Core->f.GetTexLevelParameterfv(target, level, pname, params);
-}
-
-inline void QOpenGLFunctions_4_1_Core::glGetTexParameteriv(GLenum target, GLenum pname, GLint *params)
-{
- d_1_0_Core->f.GetTexParameteriv(target, pname, params);
-}
-
-inline void QOpenGLFunctions_4_1_Core::glGetTexParameterfv(GLenum target, GLenum pname, GLfloat *params)
-{
- d_1_0_Core->f.GetTexParameterfv(target, pname, params);
-}
-
-inline void QOpenGLFunctions_4_1_Core::glGetTexImage(GLenum target, GLint level, GLenum format, GLenum type, GLvoid *pixels)
-{
- d_1_0_Core->f.GetTexImage(target, level, format, type, pixels);
-}
-
-inline const GLubyte * QOpenGLFunctions_4_1_Core::glGetString(GLenum name)
-{
- return d_1_0_Core->f.GetString(name);
-}
-
-inline void QOpenGLFunctions_4_1_Core::glGetIntegerv(GLenum pname, GLint *params)
-{
- d_1_0_Core->f.GetIntegerv(pname, params);
-}
-
-inline void QOpenGLFunctions_4_1_Core::glGetFloatv(GLenum pname, GLfloat *params)
-{
- d_1_0_Core->f.GetFloatv(pname, params);
-}
-
-inline GLenum QOpenGLFunctions_4_1_Core::glGetError()
-{
- return d_1_0_Core->f.GetError();
-}
-
-inline void QOpenGLFunctions_4_1_Core::glGetDoublev(GLenum pname, GLdouble *params)
-{
- d_1_0_Core->f.GetDoublev(pname, params);
-}
-
-inline void QOpenGLFunctions_4_1_Core::glGetBooleanv(GLenum pname, GLboolean *params)
-{
- d_1_0_Core->f.GetBooleanv(pname, params);
-}
-
-inline void QOpenGLFunctions_4_1_Core::glReadPixels(GLint x, GLint y, GLsizei width, GLsizei height, GLenum format, GLenum type, GLvoid *pixels)
-{
- d_1_0_Core->f.ReadPixels(x, y, width, height, format, type, pixels);
-}
-
-inline void QOpenGLFunctions_4_1_Core::glReadBuffer(GLenum mode)
-{
- d_1_0_Core->f.ReadBuffer(mode);
-}
-
-inline void QOpenGLFunctions_4_1_Core::glPixelStorei(GLenum pname, GLint param)
-{
- d_1_0_Core->f.PixelStorei(pname, param);
-}
-
-inline void QOpenGLFunctions_4_1_Core::glPixelStoref(GLenum pname, GLfloat param)
-{
- d_1_0_Core->f.PixelStoref(pname, param);
-}
-
-inline void QOpenGLFunctions_4_1_Core::glDepthFunc(GLenum func)
-{
- d_1_0_Core->f.DepthFunc(func);
-}
-
-inline void QOpenGLFunctions_4_1_Core::glStencilOp(GLenum fail, GLenum zfail, GLenum zpass)
-{
- d_1_0_Core->f.StencilOp(fail, zfail, zpass);
-}
-
-inline void QOpenGLFunctions_4_1_Core::glStencilFunc(GLenum func, GLint ref, GLuint mask)
-{
- d_1_0_Core->f.StencilFunc(func, ref, mask);
-}
-
-inline void QOpenGLFunctions_4_1_Core::glLogicOp(GLenum opcode)
-{
- d_1_0_Core->f.LogicOp(opcode);
-}
-
-inline void QOpenGLFunctions_4_1_Core::glBlendFunc(GLenum sfactor, GLenum dfactor)
-{
- d_1_0_Core->f.BlendFunc(sfactor, dfactor);
-}
-
-inline void QOpenGLFunctions_4_1_Core::glFlush()
-{
- d_1_0_Core->f.Flush();
-}
-
-inline void QOpenGLFunctions_4_1_Core::glFinish()
-{
- d_1_0_Core->f.Finish();
-}
-
-inline void QOpenGLFunctions_4_1_Core::glEnable(GLenum cap)
-{
- d_1_0_Core->f.Enable(cap);
-}
-
-inline void QOpenGLFunctions_4_1_Core::glDisable(GLenum cap)
-{
- d_1_0_Core->f.Disable(cap);
-}
-
-inline void QOpenGLFunctions_4_1_Core::glDepthMask(GLboolean flag)
-{
- d_1_0_Core->f.DepthMask(flag);
-}
-
-inline void QOpenGLFunctions_4_1_Core::glColorMask(GLboolean red, GLboolean green, GLboolean blue, GLboolean alpha)
-{
- d_1_0_Core->f.ColorMask(red, green, blue, alpha);
-}
-
-inline void QOpenGLFunctions_4_1_Core::glStencilMask(GLuint mask)
-{
- d_1_0_Core->f.StencilMask(mask);
-}
-
-inline void QOpenGLFunctions_4_1_Core::glClearDepth(GLdouble depth)
-{
- d_1_0_Core->f.ClearDepth(depth);
-}
-
-inline void QOpenGLFunctions_4_1_Core::glClearStencil(GLint s)
-{
- d_1_0_Core->f.ClearStencil(s);
-}
-
-inline void QOpenGLFunctions_4_1_Core::glClearColor(GLfloat red, GLfloat green, GLfloat blue, GLfloat alpha)
-{
- d_1_0_Core->f.ClearColor(red, green, blue, alpha);
-}
-
-inline void QOpenGLFunctions_4_1_Core::glClear(GLbitfield mask)
-{
- d_1_0_Core->f.Clear(mask);
-}
-
-inline void QOpenGLFunctions_4_1_Core::glDrawBuffer(GLenum mode)
-{
- d_1_0_Core->f.DrawBuffer(mode);
-}
-
-inline void QOpenGLFunctions_4_1_Core::glTexImage2D(GLenum target, GLint level, GLint internalformat, GLsizei width, GLsizei height, GLint border, GLenum format, GLenum type, const GLvoid *pixels)
-{
- d_1_0_Core->f.TexImage2D(target, level, internalformat, width, height, border, format, type, pixels);
-}
-
-inline void QOpenGLFunctions_4_1_Core::glTexImage1D(GLenum target, GLint level, GLint internalformat, GLsizei width, GLint border, GLenum format, GLenum type, const GLvoid *pixels)
-{
- d_1_0_Core->f.TexImage1D(target, level, internalformat, width, border, format, type, pixels);
-}
-
-inline void QOpenGLFunctions_4_1_Core::glTexParameteriv(GLenum target, GLenum pname, const GLint *params)
-{
- d_1_0_Core->f.TexParameteriv(target, pname, params);
-}
-
-inline void QOpenGLFunctions_4_1_Core::glTexParameteri(GLenum target, GLenum pname, GLint param)
-{
- d_1_0_Core->f.TexParameteri(target, pname, param);
-}
-
-inline void QOpenGLFunctions_4_1_Core::glTexParameterfv(GLenum target, GLenum pname, const GLfloat *params)
-{
- d_1_0_Core->f.TexParameterfv(target, pname, params);
-}
-
-inline void QOpenGLFunctions_4_1_Core::glTexParameterf(GLenum target, GLenum pname, GLfloat param)
-{
- d_1_0_Core->f.TexParameterf(target, pname, param);
-}
-
-inline void QOpenGLFunctions_4_1_Core::glScissor(GLint x, GLint y, GLsizei width, GLsizei height)
-{
- d_1_0_Core->f.Scissor(x, y, width, height);
-}
-
-inline void QOpenGLFunctions_4_1_Core::glPolygonMode(GLenum face, GLenum mode)
-{
- d_1_0_Core->f.PolygonMode(face, mode);
-}
-
-inline void QOpenGLFunctions_4_1_Core::glPointSize(GLfloat size)
-{
- d_1_0_Core->f.PointSize(size);
-}
-
-inline void QOpenGLFunctions_4_1_Core::glLineWidth(GLfloat width)
-{
- d_1_0_Core->f.LineWidth(width);
-}
-
-inline void QOpenGLFunctions_4_1_Core::glHint(GLenum target, GLenum mode)
-{
- d_1_0_Core->f.Hint(target, mode);
-}
-
-inline void QOpenGLFunctions_4_1_Core::glFrontFace(GLenum mode)
-{
- d_1_0_Core->f.FrontFace(mode);
-}
-
-inline void QOpenGLFunctions_4_1_Core::glCullFace(GLenum mode)
-{
- d_1_0_Core->f.CullFace(mode);
-}
-
-
-// OpenGL 1.1 core functions
-inline void QOpenGLFunctions_4_1_Core::glIndexubv(const GLubyte *c)
-{
- Q_UNUSED(c);
- QOPENGL_DEPRECATEDFUNCTION;
-}
-
-inline void QOpenGLFunctions_4_1_Core::glIndexub(GLubyte c)
-{
- Q_UNUSED(c);
- QOPENGL_DEPRECATEDFUNCTION;
-}
-
-inline GLboolean QOpenGLFunctions_4_1_Core::glIsTexture(GLuint texture)
-{
- return d_1_1_Core->f.IsTexture(texture);
-}
-
-inline void QOpenGLFunctions_4_1_Core::glGenTextures(GLsizei n, GLuint *textures)
-{
- d_1_1_Core->f.GenTextures(n, textures);
-}
-
-inline void QOpenGLFunctions_4_1_Core::glDeleteTextures(GLsizei n, const GLuint *textures)
-{
- d_1_1_Core->f.DeleteTextures(n, textures);
-}
-
-inline void QOpenGLFunctions_4_1_Core::glBindTexture(GLenum target, GLuint texture)
-{
- d_1_1_Core->f.BindTexture(target, texture);
-}
-
-inline void QOpenGLFunctions_4_1_Core::glTexSubImage2D(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLenum type, const GLvoid *pixels)
-{
- d_1_1_Core->f.TexSubImage2D(target, level, xoffset, yoffset, width, height, format, type, pixels);
-}
-
-inline void QOpenGLFunctions_4_1_Core::glTexSubImage1D(GLenum target, GLint level, GLint xoffset, GLsizei width, GLenum format, GLenum type, const GLvoid *pixels)
-{
- d_1_1_Core->f.TexSubImage1D(target, level, xoffset, width, format, type, pixels);
-}
-
-inline void QOpenGLFunctions_4_1_Core::glCopyTexSubImage2D(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint x, GLint y, GLsizei width, GLsizei height)
-{
- d_1_1_Core->f.CopyTexSubImage2D(target, level, xoffset, yoffset, x, y, width, height);
-}
-
-inline void QOpenGLFunctions_4_1_Core::glCopyTexSubImage1D(GLenum target, GLint level, GLint xoffset, GLint x, GLint y, GLsizei width)
-{
- d_1_1_Core->f.CopyTexSubImage1D(target, level, xoffset, x, y, width);
-}
-
-inline void QOpenGLFunctions_4_1_Core::glCopyTexImage2D(GLenum target, GLint level, GLenum internalformat, GLint x, GLint y, GLsizei width, GLsizei height, GLint border)
-{
- d_1_1_Core->f.CopyTexImage2D(target, level, internalformat, x, y, width, height, border);
-}
-
-inline void QOpenGLFunctions_4_1_Core::glCopyTexImage1D(GLenum target, GLint level, GLenum internalformat, GLint x, GLint y, GLsizei width, GLint border)
-{
- d_1_1_Core->f.CopyTexImage1D(target, level, internalformat, x, y, width, border);
-}
-
-inline void QOpenGLFunctions_4_1_Core::glPolygonOffset(GLfloat factor, GLfloat units)
-{
- d_1_1_Core->f.PolygonOffset(factor, units);
-}
-
-inline void QOpenGLFunctions_4_1_Core::glGetPointerv(GLenum pname, GLvoid* *params)
-{
- Q_UNUSED(pname);
- Q_UNUSED(params);
- QOPENGL_DEPRECATEDFUNCTION;
-}
-
-inline void QOpenGLFunctions_4_1_Core::glDrawElements(GLenum mode, GLsizei count, GLenum type, const GLvoid *indices)
-{
- d_1_1_Core->f.DrawElements(mode, count, type, indices);
-}
-
-inline void QOpenGLFunctions_4_1_Core::glDrawArrays(GLenum mode, GLint first, GLsizei count)
-{
- d_1_1_Core->f.DrawArrays(mode, first, count);
-}
-
-
-// OpenGL 1.2 core functions
-inline void QOpenGLFunctions_4_1_Core::glCopyTexSubImage3D(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLint x, GLint y, GLsizei width, GLsizei height)
-{
- d_1_2_Core->f.CopyTexSubImage3D(target, level, xoffset, yoffset, zoffset, x, y, width, height);
-}
-
-inline void QOpenGLFunctions_4_1_Core::glTexSubImage3D(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLenum type, const GLvoid *pixels)
-{
- d_1_2_Core->f.TexSubImage3D(target, level, xoffset, yoffset, zoffset, width, height, depth, format, type, pixels);
-}
-
-inline void QOpenGLFunctions_4_1_Core::glTexImage3D(GLenum target, GLint level, GLint internalformat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLenum format, GLenum type, const GLvoid *pixels)
-{
- d_1_2_Core->f.TexImage3D(target, level, internalformat, width, height, depth, border, format, type, pixels);
-}
-
-inline void QOpenGLFunctions_4_1_Core::glDrawRangeElements(GLenum mode, GLuint start, GLuint end, GLsizei count, GLenum type, const GLvoid *indices)
-{
- d_1_2_Core->f.DrawRangeElements(mode, start, end, count, type, indices);
-}
-
-inline void QOpenGLFunctions_4_1_Core::glBlendEquation(GLenum mode)
-{
- d_1_2_Core->f.BlendEquation(mode);
-}
-
-inline void QOpenGLFunctions_4_1_Core::glBlendColor(GLfloat red, GLfloat green, GLfloat blue, GLfloat alpha)
-{
- d_1_2_Core->f.BlendColor(red, green, blue, alpha);
-}
-
-
-// OpenGL 1.3 core functions
-inline void QOpenGLFunctions_4_1_Core::glGetCompressedTexImage(GLenum target, GLint level, GLvoid *img)
-{
- d_1_3_Core->f.GetCompressedTexImage(target, level, img);
-}
-
-inline void QOpenGLFunctions_4_1_Core::glCompressedTexSubImage1D(GLenum target, GLint level, GLint xoffset, GLsizei width, GLenum format, GLsizei imageSize, const GLvoid *data)
-{
- d_1_3_Core->f.CompressedTexSubImage1D(target, level, xoffset, width, format, imageSize, data);
-}
-
-inline void QOpenGLFunctions_4_1_Core::glCompressedTexSubImage2D(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLsizei imageSize, const GLvoid *data)
-{
- d_1_3_Core->f.CompressedTexSubImage2D(target, level, xoffset, yoffset, width, height, format, imageSize, data);
-}
-
-inline void QOpenGLFunctions_4_1_Core::glCompressedTexSubImage3D(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLsizei imageSize, const GLvoid *data)
-{
- d_1_3_Core->f.CompressedTexSubImage3D(target, level, xoffset, yoffset, zoffset, width, height, depth, format, imageSize, data);
-}
-
-inline void QOpenGLFunctions_4_1_Core::glCompressedTexImage1D(GLenum target, GLint level, GLenum internalformat, GLsizei width, GLint border, GLsizei imageSize, const GLvoid *data)
-{
- d_1_3_Core->f.CompressedTexImage1D(target, level, internalformat, width, border, imageSize, data);
-}
-
-inline void QOpenGLFunctions_4_1_Core::glCompressedTexImage2D(GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLint border, GLsizei imageSize, const GLvoid *data)
-{
- d_1_3_Core->f.CompressedTexImage2D(target, level, internalformat, width, height, border, imageSize, data);
-}
-
-inline void QOpenGLFunctions_4_1_Core::glCompressedTexImage3D(GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLsizei imageSize, const GLvoid *data)
-{
- d_1_3_Core->f.CompressedTexImage3D(target, level, internalformat, width, height, depth, border, imageSize, data);
-}
-
-inline void QOpenGLFunctions_4_1_Core::glSampleCoverage(GLfloat value, GLboolean invert)
-{
- d_1_3_Core->f.SampleCoverage(value, invert);
-}
-
-inline void QOpenGLFunctions_4_1_Core::glActiveTexture(GLenum texture)
-{
- d_1_3_Core->f.ActiveTexture(texture);
-}
-
-
-// OpenGL 1.4 core functions
-inline void QOpenGLFunctions_4_1_Core::glPointParameteriv(GLenum pname, const GLint *params)
-{
- d_1_4_Core->f.PointParameteriv(pname, params);
-}
-
-inline void QOpenGLFunctions_4_1_Core::glPointParameteri(GLenum pname, GLint param)
-{
- d_1_4_Core->f.PointParameteri(pname, param);
-}
-
-inline void QOpenGLFunctions_4_1_Core::glPointParameterfv(GLenum pname, const GLfloat *params)
-{
- d_1_4_Core->f.PointParameterfv(pname, params);
-}
-
-inline void QOpenGLFunctions_4_1_Core::glPointParameterf(GLenum pname, GLfloat param)
-{
- d_1_4_Core->f.PointParameterf(pname, param);
-}
-
-inline void QOpenGLFunctions_4_1_Core::glMultiDrawElements(GLenum mode, const GLsizei *count, GLenum type, const GLvoid* const *indices, GLsizei drawcount)
-{
- d_1_4_Core->f.MultiDrawElements(mode, count, type, indices, drawcount);
-}
-
-inline void QOpenGLFunctions_4_1_Core::glMultiDrawArrays(GLenum mode, const GLint *first, const GLsizei *count, GLsizei drawcount)
-{
- d_1_4_Core->f.MultiDrawArrays(mode, first, count, drawcount);
-}
-
-inline void QOpenGLFunctions_4_1_Core::glBlendFuncSeparate(GLenum sfactorRGB, GLenum dfactorRGB, GLenum sfactorAlpha, GLenum dfactorAlpha)
-{
- d_1_4_Core->f.BlendFuncSeparate(sfactorRGB, dfactorRGB, sfactorAlpha, dfactorAlpha);
-}
-
-
-// OpenGL 1.5 core functions
-inline void QOpenGLFunctions_4_1_Core::glGetBufferPointerv(GLenum target, GLenum pname, GLvoid* *params)
-{
- d_1_5_Core->f.GetBufferPointerv(target, pname, params);
-}
-
-inline void QOpenGLFunctions_4_1_Core::glGetBufferParameteriv(GLenum target, GLenum pname, GLint *params)
-{
- d_1_5_Core->f.GetBufferParameteriv(target, pname, params);
-}
-
-inline GLboolean QOpenGLFunctions_4_1_Core::glUnmapBuffer(GLenum target)
-{
- return d_1_5_Core->f.UnmapBuffer(target);
-}
-
-inline GLvoid* QOpenGLFunctions_4_1_Core::glMapBuffer(GLenum target, GLenum access)
-{
- return d_1_5_Core->f.MapBuffer(target, access);
-}
-
-inline void QOpenGLFunctions_4_1_Core::glGetBufferSubData(GLenum target, GLintptr offset, GLsizeiptr size, GLvoid *data)
-{
- d_1_5_Core->f.GetBufferSubData(target, offset, size, data);
-}
-
-inline void QOpenGLFunctions_4_1_Core::glBufferSubData(GLenum target, GLintptr offset, GLsizeiptr size, const GLvoid *data)
-{
- d_1_5_Core->f.BufferSubData(target, offset, size, data);
-}
-
-inline void QOpenGLFunctions_4_1_Core::glBufferData(GLenum target, GLsizeiptr size, const GLvoid *data, GLenum usage)
-{
- d_1_5_Core->f.BufferData(target, size, data, usage);
-}
-
-inline GLboolean QOpenGLFunctions_4_1_Core::glIsBuffer(GLuint buffer)
-{
- return d_1_5_Core->f.IsBuffer(buffer);
-}
-
-inline void QOpenGLFunctions_4_1_Core::glGenBuffers(GLsizei n, GLuint *buffers)
-{
- d_1_5_Core->f.GenBuffers(n, buffers);
-}
-
-inline void QOpenGLFunctions_4_1_Core::glDeleteBuffers(GLsizei n, const GLuint *buffers)
-{
- d_1_5_Core->f.DeleteBuffers(n, buffers);
-}
-
-inline void QOpenGLFunctions_4_1_Core::glBindBuffer(GLenum target, GLuint buffer)
-{
- d_1_5_Core->f.BindBuffer(target, buffer);
-}
-
-inline void QOpenGLFunctions_4_1_Core::glGetQueryObjectuiv(GLuint id, GLenum pname, GLuint *params)
-{
- d_1_5_Core->f.GetQueryObjectuiv(id, pname, params);
-}
-
-inline void QOpenGLFunctions_4_1_Core::glGetQueryObjectiv(GLuint id, GLenum pname, GLint *params)
-{
- d_1_5_Core->f.GetQueryObjectiv(id, pname, params);
-}
-
-inline void QOpenGLFunctions_4_1_Core::glGetQueryiv(GLenum target, GLenum pname, GLint *params)
-{
- d_1_5_Core->f.GetQueryiv(target, pname, params);
-}
-
-inline void QOpenGLFunctions_4_1_Core::glEndQuery(GLenum target)
-{
- d_1_5_Core->f.EndQuery(target);
-}
-
-inline void QOpenGLFunctions_4_1_Core::glBeginQuery(GLenum target, GLuint id)
-{
- d_1_5_Core->f.BeginQuery(target, id);
-}
-
-inline GLboolean QOpenGLFunctions_4_1_Core::glIsQuery(GLuint id)
-{
- return d_1_5_Core->f.IsQuery(id);
-}
-
-inline void QOpenGLFunctions_4_1_Core::glDeleteQueries(GLsizei n, const GLuint *ids)
-{
- d_1_5_Core->f.DeleteQueries(n, ids);
-}
-
-inline void QOpenGLFunctions_4_1_Core::glGenQueries(GLsizei n, GLuint *ids)
-{
- d_1_5_Core->f.GenQueries(n, ids);
-}
-
-
-// OpenGL 2.0 core functions
-inline void QOpenGLFunctions_4_1_Core::glVertexAttribPointer(GLuint index, GLint size, GLenum type, GLboolean normalized, GLsizei stride, const GLvoid *pointer)
-{
- d_2_0_Core->f.VertexAttribPointer(index, size, type, normalized, stride, pointer);
-}
-
-inline void QOpenGLFunctions_4_1_Core::glValidateProgram(GLuint program)
-{
- d_2_0_Core->f.ValidateProgram(program);
-}
-
-inline void QOpenGLFunctions_4_1_Core::glUniformMatrix4fv(GLint location, GLsizei count, GLboolean transpose, const GLfloat *value)
-{
- d_2_0_Core->f.UniformMatrix4fv(location, count, transpose, value);
-}
-
-inline void QOpenGLFunctions_4_1_Core::glUniformMatrix3fv(GLint location, GLsizei count, GLboolean transpose, const GLfloat *value)
-{
- d_2_0_Core->f.UniformMatrix3fv(location, count, transpose, value);
-}
-
-inline void QOpenGLFunctions_4_1_Core::glUniformMatrix2fv(GLint location, GLsizei count, GLboolean transpose, const GLfloat *value)
-{
- d_2_0_Core->f.UniformMatrix2fv(location, count, transpose, value);
-}
-
-inline void QOpenGLFunctions_4_1_Core::glUniform4iv(GLint location, GLsizei count, const GLint *value)
-{
- d_2_0_Core->f.Uniform4iv(location, count, value);
-}
-
-inline void QOpenGLFunctions_4_1_Core::glUniform3iv(GLint location, GLsizei count, const GLint *value)
-{
- d_2_0_Core->f.Uniform3iv(location, count, value);
-}
-
-inline void QOpenGLFunctions_4_1_Core::glUniform2iv(GLint location, GLsizei count, const GLint *value)
-{
- d_2_0_Core->f.Uniform2iv(location, count, value);
-}
-
-inline void QOpenGLFunctions_4_1_Core::glUniform1iv(GLint location, GLsizei count, const GLint *value)
-{
- d_2_0_Core->f.Uniform1iv(location, count, value);
-}
-
-inline void QOpenGLFunctions_4_1_Core::glUniform4fv(GLint location, GLsizei count, const GLfloat *value)
-{
- d_2_0_Core->f.Uniform4fv(location, count, value);
-}
-
-inline void QOpenGLFunctions_4_1_Core::glUniform3fv(GLint location, GLsizei count, const GLfloat *value)
-{
- d_2_0_Core->f.Uniform3fv(location, count, value);
-}
-
-inline void QOpenGLFunctions_4_1_Core::glUniform2fv(GLint location, GLsizei count, const GLfloat *value)
-{
- d_2_0_Core->f.Uniform2fv(location, count, value);
-}
-
-inline void QOpenGLFunctions_4_1_Core::glUniform1fv(GLint location, GLsizei count, const GLfloat *value)
-{
- d_2_0_Core->f.Uniform1fv(location, count, value);
-}
-
-inline void QOpenGLFunctions_4_1_Core::glUniform4i(GLint location, GLint v0, GLint v1, GLint v2, GLint v3)
-{
- d_2_0_Core->f.Uniform4i(location, v0, v1, v2, v3);
-}
-
-inline void QOpenGLFunctions_4_1_Core::glUniform3i(GLint location, GLint v0, GLint v1, GLint v2)
-{
- d_2_0_Core->f.Uniform3i(location, v0, v1, v2);
-}
-
-inline void QOpenGLFunctions_4_1_Core::glUniform2i(GLint location, GLint v0, GLint v1)
-{
- d_2_0_Core->f.Uniform2i(location, v0, v1);
-}
-
-inline void QOpenGLFunctions_4_1_Core::glUniform1i(GLint location, GLint v0)
-{
- d_2_0_Core->f.Uniform1i(location, v0);
-}
-
-inline void QOpenGLFunctions_4_1_Core::glUniform4f(GLint location, GLfloat v0, GLfloat v1, GLfloat v2, GLfloat v3)
-{
- d_2_0_Core->f.Uniform4f(location, v0, v1, v2, v3);
-}
-
-inline void QOpenGLFunctions_4_1_Core::glUniform3f(GLint location, GLfloat v0, GLfloat v1, GLfloat v2)
-{
- d_2_0_Core->f.Uniform3f(location, v0, v1, v2);
-}
-
-inline void QOpenGLFunctions_4_1_Core::glUniform2f(GLint location, GLfloat v0, GLfloat v1)
-{
- d_2_0_Core->f.Uniform2f(location, v0, v1);
-}
-
-inline void QOpenGLFunctions_4_1_Core::glUniform1f(GLint location, GLfloat v0)
-{
- d_2_0_Core->f.Uniform1f(location, v0);
-}
-
-inline void QOpenGLFunctions_4_1_Core::glUseProgram(GLuint program)
-{
- d_2_0_Core->f.UseProgram(program);
-}
-
-inline void QOpenGLFunctions_4_1_Core::glShaderSource(GLuint shader, GLsizei count, const GLchar* const *string, const GLint *length)
-{
- d_2_0_Core->f.ShaderSource(shader, count, string, length);
-}
-
-inline void QOpenGLFunctions_4_1_Core::glLinkProgram(GLuint program)
-{
- d_2_0_Core->f.LinkProgram(program);
-}
-
-inline GLboolean QOpenGLFunctions_4_1_Core::glIsShader(GLuint shader)
-{
- return d_2_0_Core->f.IsShader(shader);
-}
-
-inline GLboolean QOpenGLFunctions_4_1_Core::glIsProgram(GLuint program)
-{
- return d_2_0_Core->f.IsProgram(program);
-}
-
-inline void QOpenGLFunctions_4_1_Core::glGetVertexAttribPointerv(GLuint index, GLenum pname, GLvoid* *pointer)
-{
- d_2_0_Core->f.GetVertexAttribPointerv(index, pname, pointer);
-}
-
-inline void QOpenGLFunctions_4_1_Core::glGetVertexAttribiv(GLuint index, GLenum pname, GLint *params)
-{
- d_2_0_Core->f.GetVertexAttribiv(index, pname, params);
-}
-
-inline void QOpenGLFunctions_4_1_Core::glGetVertexAttribfv(GLuint index, GLenum pname, GLfloat *params)
-{
- d_2_0_Core->f.GetVertexAttribfv(index, pname, params);
-}
-
-inline void QOpenGLFunctions_4_1_Core::glGetVertexAttribdv(GLuint index, GLenum pname, GLdouble *params)
-{
- d_2_0_Core->f.GetVertexAttribdv(index, pname, params);
-}
-
-inline void QOpenGLFunctions_4_1_Core::glGetUniformiv(GLuint program, GLint location, GLint *params)
-{
- d_2_0_Core->f.GetUniformiv(program, location, params);
-}
-
-inline void QOpenGLFunctions_4_1_Core::glGetUniformfv(GLuint program, GLint location, GLfloat *params)
-{
- d_2_0_Core->f.GetUniformfv(program, location, params);
-}
-
-inline GLint QOpenGLFunctions_4_1_Core::glGetUniformLocation(GLuint program, const GLchar *name)
-{
- return d_2_0_Core->f.GetUniformLocation(program, name);
-}
-
-inline void QOpenGLFunctions_4_1_Core::glGetShaderSource(GLuint shader, GLsizei bufSize, GLsizei *length, GLchar *source)
-{
- d_2_0_Core->f.GetShaderSource(shader, bufSize, length, source);
-}
-
-inline void QOpenGLFunctions_4_1_Core::glGetShaderInfoLog(GLuint shader, GLsizei bufSize, GLsizei *length, GLchar *infoLog)
-{
- d_2_0_Core->f.GetShaderInfoLog(shader, bufSize, length, infoLog);
-}
-
-inline void QOpenGLFunctions_4_1_Core::glGetShaderiv(GLuint shader, GLenum pname, GLint *params)
-{
- d_2_0_Core->f.GetShaderiv(shader, pname, params);
-}
-
-inline void QOpenGLFunctions_4_1_Core::glGetProgramInfoLog(GLuint program, GLsizei bufSize, GLsizei *length, GLchar *infoLog)
-{
- d_2_0_Core->f.GetProgramInfoLog(program, bufSize, length, infoLog);
-}
-
-inline void QOpenGLFunctions_4_1_Core::glGetProgramiv(GLuint program, GLenum pname, GLint *params)
-{
- d_2_0_Core->f.GetProgramiv(program, pname, params);
-}
-
-inline GLint QOpenGLFunctions_4_1_Core::glGetAttribLocation(GLuint program, const GLchar *name)
-{
- return d_2_0_Core->f.GetAttribLocation(program, name);
-}
-
-inline void QOpenGLFunctions_4_1_Core::glGetAttachedShaders(GLuint program, GLsizei maxCount, GLsizei *count, GLuint *obj)
-{
- d_2_0_Core->f.GetAttachedShaders(program, maxCount, count, obj);
-}
-
-inline void QOpenGLFunctions_4_1_Core::glGetActiveUniform(GLuint program, GLuint index, GLsizei bufSize, GLsizei *length, GLint *size, GLenum *type, GLchar *name)
-{
- d_2_0_Core->f.GetActiveUniform(program, index, bufSize, length, size, type, name);
-}
-
-inline void QOpenGLFunctions_4_1_Core::glGetActiveAttrib(GLuint program, GLuint index, GLsizei bufSize, GLsizei *length, GLint *size, GLenum *type, GLchar *name)
-{
- d_2_0_Core->f.GetActiveAttrib(program, index, bufSize, length, size, type, name);
-}
-
-inline void QOpenGLFunctions_4_1_Core::glEnableVertexAttribArray(GLuint index)
-{
- d_2_0_Core->f.EnableVertexAttribArray(index);
-}
-
-inline void QOpenGLFunctions_4_1_Core::glDisableVertexAttribArray(GLuint index)
-{
- d_2_0_Core->f.DisableVertexAttribArray(index);
-}
-
-inline void QOpenGLFunctions_4_1_Core::glDetachShader(GLuint program, GLuint shader)
-{
- d_2_0_Core->f.DetachShader(program, shader);
-}
-
-inline void QOpenGLFunctions_4_1_Core::glDeleteShader(GLuint shader)
-{
- d_2_0_Core->f.DeleteShader(shader);
-}
-
-inline void QOpenGLFunctions_4_1_Core::glDeleteProgram(GLuint program)
-{
- d_2_0_Core->f.DeleteProgram(program);
-}
-
-inline GLuint QOpenGLFunctions_4_1_Core::glCreateShader(GLenum type)
-{
- return d_2_0_Core->f.CreateShader(type);
-}
-
-inline GLuint QOpenGLFunctions_4_1_Core::glCreateProgram()
-{
- return d_2_0_Core->f.CreateProgram();
-}
-
-inline void QOpenGLFunctions_4_1_Core::glCompileShader(GLuint shader)
-{
- d_2_0_Core->f.CompileShader(shader);
-}
-
-inline void QOpenGLFunctions_4_1_Core::glBindAttribLocation(GLuint program, GLuint index, const GLchar *name)
-{
- d_2_0_Core->f.BindAttribLocation(program, index, name);
-}
-
-inline void QOpenGLFunctions_4_1_Core::glAttachShader(GLuint program, GLuint shader)
-{
- d_2_0_Core->f.AttachShader(program, shader);
-}
-
-inline void QOpenGLFunctions_4_1_Core::glStencilMaskSeparate(GLenum face, GLuint mask)
-{
- d_2_0_Core->f.StencilMaskSeparate(face, mask);
-}
-
-inline void QOpenGLFunctions_4_1_Core::glStencilFuncSeparate(GLenum face, GLenum func, GLint ref, GLuint mask)
-{
- d_2_0_Core->f.StencilFuncSeparate(face, func, ref, mask);
-}
-
-inline void QOpenGLFunctions_4_1_Core::glStencilOpSeparate(GLenum face, GLenum sfail, GLenum dpfail, GLenum dppass)
-{
- d_2_0_Core->f.StencilOpSeparate(face, sfail, dpfail, dppass);
-}
-
-inline void QOpenGLFunctions_4_1_Core::glDrawBuffers(GLsizei n, const GLenum *bufs)
-{
- d_2_0_Core->f.DrawBuffers(n, bufs);
-}
-
-inline void QOpenGLFunctions_4_1_Core::glBlendEquationSeparate(GLenum modeRGB, GLenum modeAlpha)
-{
- d_2_0_Core->f.BlendEquationSeparate(modeRGB, modeAlpha);
-}
-
-
-// OpenGL 2.1 core functions
-inline void QOpenGLFunctions_4_1_Core::glUniformMatrix4x3fv(GLint location, GLsizei count, GLboolean transpose, const GLfloat *value)
-{
- d_2_1_Core->f.UniformMatrix4x3fv(location, count, transpose, value);
-}
-
-inline void QOpenGLFunctions_4_1_Core::glUniformMatrix3x4fv(GLint location, GLsizei count, GLboolean transpose, const GLfloat *value)
-{
- d_2_1_Core->f.UniformMatrix3x4fv(location, count, transpose, value);
-}
-
-inline void QOpenGLFunctions_4_1_Core::glUniformMatrix4x2fv(GLint location, GLsizei count, GLboolean transpose, const GLfloat *value)
-{
- d_2_1_Core->f.UniformMatrix4x2fv(location, count, transpose, value);
-}
-
-inline void QOpenGLFunctions_4_1_Core::glUniformMatrix2x4fv(GLint location, GLsizei count, GLboolean transpose, const GLfloat *value)
-{
- d_2_1_Core->f.UniformMatrix2x4fv(location, count, transpose, value);
-}
-
-inline void QOpenGLFunctions_4_1_Core::glUniformMatrix3x2fv(GLint location, GLsizei count, GLboolean transpose, const GLfloat *value)
-{
- d_2_1_Core->f.UniformMatrix3x2fv(location, count, transpose, value);
-}
-
-inline void QOpenGLFunctions_4_1_Core::glUniformMatrix2x3fv(GLint location, GLsizei count, GLboolean transpose, const GLfloat *value)
-{
- d_2_1_Core->f.UniformMatrix2x3fv(location, count, transpose, value);
-}
-
-
-// OpenGL 3.0 core functions
-inline GLboolean QOpenGLFunctions_4_1_Core::glIsVertexArray(GLuint array)
-{
- return d_3_0_Core->f.IsVertexArray(array);
-}
-
-inline void QOpenGLFunctions_4_1_Core::glGenVertexArrays(GLsizei n, GLuint *arrays)
-{
- d_3_0_Core->f.GenVertexArrays(n, arrays);
-}
-
-inline void QOpenGLFunctions_4_1_Core::glDeleteVertexArrays(GLsizei n, const GLuint *arrays)
-{
- d_3_0_Core->f.DeleteVertexArrays(n, arrays);
-}
-
-inline void QOpenGLFunctions_4_1_Core::glBindVertexArray(GLuint array)
-{
- d_3_0_Core->f.BindVertexArray(array);
-}
-
-inline void QOpenGLFunctions_4_1_Core::glFlushMappedBufferRange(GLenum target, GLintptr offset, GLsizeiptr length)
-{
- d_3_0_Core->f.FlushMappedBufferRange(target, offset, length);
-}
-
-inline GLvoid* QOpenGLFunctions_4_1_Core::glMapBufferRange(GLenum target, GLintptr offset, GLsizeiptr length, GLbitfield access)
-{
- return d_3_0_Core->f.MapBufferRange(target, offset, length, access);
-}
-
-inline void QOpenGLFunctions_4_1_Core::glFramebufferTextureLayer(GLenum target, GLenum attachment, GLuint texture, GLint level, GLint layer)
-{
- d_3_0_Core->f.FramebufferTextureLayer(target, attachment, texture, level, layer);
-}
-
-inline void QOpenGLFunctions_4_1_Core::glRenderbufferStorageMultisample(GLenum target, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height)
-{
- d_3_0_Core->f.RenderbufferStorageMultisample(target, samples, internalformat, width, height);
-}
-
-inline void QOpenGLFunctions_4_1_Core::glBlitFramebuffer(GLint srcX0, GLint srcY0, GLint srcX1, GLint srcY1, GLint dstX0, GLint dstY0, GLint dstX1, GLint dstY1, GLbitfield mask, GLenum filter)
-{
- d_3_0_Core->f.BlitFramebuffer(srcX0, srcY0, srcX1, srcY1, dstX0, dstY0, dstX1, dstY1, mask, filter);
-}
-
-inline void QOpenGLFunctions_4_1_Core::glGenerateMipmap(GLenum target)
-{
- d_3_0_Core->f.GenerateMipmap(target);
-}
-
-inline void QOpenGLFunctions_4_1_Core::glGetFramebufferAttachmentParameteriv(GLenum target, GLenum attachment, GLenum pname, GLint *params)
-{
- d_3_0_Core->f.GetFramebufferAttachmentParameteriv(target, attachment, pname, params);
-}
-
-inline void QOpenGLFunctions_4_1_Core::glFramebufferRenderbuffer(GLenum target, GLenum attachment, GLenum renderbuffertarget, GLuint renderbuffer)
-{
- d_3_0_Core->f.FramebufferRenderbuffer(target, attachment, renderbuffertarget, renderbuffer);
-}
-
-inline void QOpenGLFunctions_4_1_Core::glFramebufferTexture3D(GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level, GLint zoffset)
-{
- d_3_0_Core->f.FramebufferTexture3D(target, attachment, textarget, texture, level, zoffset);
-}
-
-inline void QOpenGLFunctions_4_1_Core::glFramebufferTexture2D(GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level)
-{
- d_3_0_Core->f.FramebufferTexture2D(target, attachment, textarget, texture, level);
-}
-
-inline void QOpenGLFunctions_4_1_Core::glFramebufferTexture1D(GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level)
-{
- d_3_0_Core->f.FramebufferTexture1D(target, attachment, textarget, texture, level);
-}
-
-inline GLenum QOpenGLFunctions_4_1_Core::glCheckFramebufferStatus(GLenum target)
-{
- return d_3_0_Core->f.CheckFramebufferStatus(target);
-}
-
-inline void QOpenGLFunctions_4_1_Core::glGenFramebuffers(GLsizei n, GLuint *framebuffers)
-{
- d_3_0_Core->f.GenFramebuffers(n, framebuffers);
-}
-
-inline void QOpenGLFunctions_4_1_Core::glDeleteFramebuffers(GLsizei n, const GLuint *framebuffers)
-{
- d_3_0_Core->f.DeleteFramebuffers(n, framebuffers);
-}
-
-inline void QOpenGLFunctions_4_1_Core::glBindFramebuffer(GLenum target, GLuint framebuffer)
-{
- d_3_0_Core->f.BindFramebuffer(target, framebuffer);
-}
-
-inline GLboolean QOpenGLFunctions_4_1_Core::glIsFramebuffer(GLuint framebuffer)
-{
- return d_3_0_Core->f.IsFramebuffer(framebuffer);
-}
-
-inline void QOpenGLFunctions_4_1_Core::glGetRenderbufferParameteriv(GLenum target, GLenum pname, GLint *params)
-{
- d_3_0_Core->f.GetRenderbufferParameteriv(target, pname, params);
-}
-
-inline void QOpenGLFunctions_4_1_Core::glRenderbufferStorage(GLenum target, GLenum internalformat, GLsizei width, GLsizei height)
-{
- d_3_0_Core->f.RenderbufferStorage(target, internalformat, width, height);
-}
-
-inline void QOpenGLFunctions_4_1_Core::glGenRenderbuffers(GLsizei n, GLuint *renderbuffers)
-{
- d_3_0_Core->f.GenRenderbuffers(n, renderbuffers);
-}
-
-inline void QOpenGLFunctions_4_1_Core::glDeleteRenderbuffers(GLsizei n, const GLuint *renderbuffers)
-{
- d_3_0_Core->f.DeleteRenderbuffers(n, renderbuffers);
-}
-
-inline void QOpenGLFunctions_4_1_Core::glBindRenderbuffer(GLenum target, GLuint renderbuffer)
-{
- d_3_0_Core->f.BindRenderbuffer(target, renderbuffer);
-}
-
-inline GLboolean QOpenGLFunctions_4_1_Core::glIsRenderbuffer(GLuint renderbuffer)
-{
- return d_3_0_Core->f.IsRenderbuffer(renderbuffer);
-}
-
-inline const GLubyte * QOpenGLFunctions_4_1_Core::glGetStringi(GLenum name, GLuint index)
-{
- return d_3_0_Core->f.GetStringi(name, index);
-}
-
-inline void QOpenGLFunctions_4_1_Core::glClearBufferfi(GLenum buffer, GLint drawbuffer, GLfloat depth, GLint stencil)
-{
- d_3_0_Core->f.ClearBufferfi(buffer, drawbuffer, depth, stencil);
-}
-
-inline void QOpenGLFunctions_4_1_Core::glClearBufferfv(GLenum buffer, GLint drawbuffer, const GLfloat *value)
-{
- d_3_0_Core->f.ClearBufferfv(buffer, drawbuffer, value);
-}
-
-inline void QOpenGLFunctions_4_1_Core::glClearBufferuiv(GLenum buffer, GLint drawbuffer, const GLuint *value)
-{
- d_3_0_Core->f.ClearBufferuiv(buffer, drawbuffer, value);
-}
-
-inline void QOpenGLFunctions_4_1_Core::glClearBufferiv(GLenum buffer, GLint drawbuffer, const GLint *value)
-{
- d_3_0_Core->f.ClearBufferiv(buffer, drawbuffer, value);
-}
-
-inline void QOpenGLFunctions_4_1_Core::glGetTexParameterIuiv(GLenum target, GLenum pname, GLuint *params)
-{
- d_3_0_Core->f.GetTexParameterIuiv(target, pname, params);
-}
-
-inline void QOpenGLFunctions_4_1_Core::glGetTexParameterIiv(GLenum target, GLenum pname, GLint *params)
-{
- d_3_0_Core->f.GetTexParameterIiv(target, pname, params);
-}
-
-inline void QOpenGLFunctions_4_1_Core::glTexParameterIuiv(GLenum target, GLenum pname, const GLuint *params)
-{
- d_3_0_Core->f.TexParameterIuiv(target, pname, params);
-}
-
-inline void QOpenGLFunctions_4_1_Core::glTexParameterIiv(GLenum target, GLenum pname, const GLint *params)
-{
- d_3_0_Core->f.TexParameterIiv(target, pname, params);
-}
-
-inline void QOpenGLFunctions_4_1_Core::glUniform4uiv(GLint location, GLsizei count, const GLuint *value)
-{
- d_3_0_Core->f.Uniform4uiv(location, count, value);
-}
-
-inline void QOpenGLFunctions_4_1_Core::glUniform3uiv(GLint location, GLsizei count, const GLuint *value)
-{
- d_3_0_Core->f.Uniform3uiv(location, count, value);
-}
-
-inline void QOpenGLFunctions_4_1_Core::glUniform2uiv(GLint location, GLsizei count, const GLuint *value)
-{
- d_3_0_Core->f.Uniform2uiv(location, count, value);
-}
-
-inline void QOpenGLFunctions_4_1_Core::glUniform1uiv(GLint location, GLsizei count, const GLuint *value)
-{
- d_3_0_Core->f.Uniform1uiv(location, count, value);
-}
-
-inline void QOpenGLFunctions_4_1_Core::glUniform4ui(GLint location, GLuint v0, GLuint v1, GLuint v2, GLuint v3)
-{
- d_3_0_Core->f.Uniform4ui(location, v0, v1, v2, v3);
-}
-
-inline void QOpenGLFunctions_4_1_Core::glUniform3ui(GLint location, GLuint v0, GLuint v1, GLuint v2)
-{
- d_3_0_Core->f.Uniform3ui(location, v0, v1, v2);
-}
-
-inline void QOpenGLFunctions_4_1_Core::glUniform2ui(GLint location, GLuint v0, GLuint v1)
-{
- d_3_0_Core->f.Uniform2ui(location, v0, v1);
-}
-
-inline void QOpenGLFunctions_4_1_Core::glUniform1ui(GLint location, GLuint v0)
-{
- d_3_0_Core->f.Uniform1ui(location, v0);
-}
-
-inline GLint QOpenGLFunctions_4_1_Core::glGetFragDataLocation(GLuint program, const GLchar *name)
-{
- return d_3_0_Core->f.GetFragDataLocation(program, name);
-}
-
-inline void QOpenGLFunctions_4_1_Core::glBindFragDataLocation(GLuint program, GLuint color, const GLchar *name)
-{
- d_3_0_Core->f.BindFragDataLocation(program, color, name);
-}
-
-inline void QOpenGLFunctions_4_1_Core::glGetUniformuiv(GLuint program, GLint location, GLuint *params)
-{
- d_3_0_Core->f.GetUniformuiv(program, location, params);
-}
-
-inline void QOpenGLFunctions_4_1_Core::glGetVertexAttribIuiv(GLuint index, GLenum pname, GLuint *params)
-{
- d_3_0_Core->f.GetVertexAttribIuiv(index, pname, params);
-}
-
-inline void QOpenGLFunctions_4_1_Core::glGetVertexAttribIiv(GLuint index, GLenum pname, GLint *params)
-{
- d_3_0_Core->f.GetVertexAttribIiv(index, pname, params);
-}
-
-inline void QOpenGLFunctions_4_1_Core::glVertexAttribIPointer(GLuint index, GLint size, GLenum type, GLsizei stride, const GLvoid *pointer)
-{
- d_3_0_Core->f.VertexAttribIPointer(index, size, type, stride, pointer);
-}
-
-inline void QOpenGLFunctions_4_1_Core::glEndConditionalRender()
-{
- d_3_0_Core->f.EndConditionalRender();
-}
-
-inline void QOpenGLFunctions_4_1_Core::glBeginConditionalRender(GLuint id, GLenum mode)
-{
- d_3_0_Core->f.BeginConditionalRender(id, mode);
-}
-
-inline void QOpenGLFunctions_4_1_Core::glClampColor(GLenum target, GLenum clamp)
-{
- d_3_0_Core->f.ClampColor(target, clamp);
-}
-
-inline void QOpenGLFunctions_4_1_Core::glGetTransformFeedbackVarying(GLuint program, GLuint index, GLsizei bufSize, GLsizei *length, GLsizei *size, GLenum *type, GLchar *name)
-{
- d_3_0_Core->f.GetTransformFeedbackVarying(program, index, bufSize, length, size, type, name);
-}
-
-inline void QOpenGLFunctions_4_1_Core::glTransformFeedbackVaryings(GLuint program, GLsizei count, const GLchar* const *varyings, GLenum bufferMode)
-{
- d_3_0_Core->f.TransformFeedbackVaryings(program, count, varyings, bufferMode);
-}
-
-inline void QOpenGLFunctions_4_1_Core::glBindBufferBase(GLenum target, GLuint index, GLuint buffer)
-{
- d_3_0_Core->f.BindBufferBase(target, index, buffer);
-}
-
-inline void QOpenGLFunctions_4_1_Core::glBindBufferRange(GLenum target, GLuint index, GLuint buffer, GLintptr offset, GLsizeiptr size)
-{
- d_3_0_Core->f.BindBufferRange(target, index, buffer, offset, size);
-}
-
-inline void QOpenGLFunctions_4_1_Core::glEndTransformFeedback()
-{
- d_3_0_Core->f.EndTransformFeedback();
-}
-
-inline void QOpenGLFunctions_4_1_Core::glBeginTransformFeedback(GLenum primitiveMode)
-{
- d_3_0_Core->f.BeginTransformFeedback(primitiveMode);
-}
-
-inline GLboolean QOpenGLFunctions_4_1_Core::glIsEnabledi(GLenum target, GLuint index)
-{
- return d_3_0_Core->f.IsEnabledi(target, index);
-}
-
-inline void QOpenGLFunctions_4_1_Core::glDisablei(GLenum target, GLuint index)
-{
- d_3_0_Core->f.Disablei(target, index);
-}
-
-inline void QOpenGLFunctions_4_1_Core::glEnablei(GLenum target, GLuint index)
-{
- d_3_0_Core->f.Enablei(target, index);
-}
-
-inline void QOpenGLFunctions_4_1_Core::glGetIntegeri_v(GLenum target, GLuint index, GLint *data)
-{
- d_3_0_Core->f.GetIntegeri_v(target, index, data);
-}
-
-inline void QOpenGLFunctions_4_1_Core::glGetBooleani_v(GLenum target, GLuint index, GLboolean *data)
-{
- d_3_0_Core->f.GetBooleani_v(target, index, data);
-}
-
-inline void QOpenGLFunctions_4_1_Core::glColorMaski(GLuint index, GLboolean r, GLboolean g, GLboolean b, GLboolean a)
-{
- d_3_0_Core->f.ColorMaski(index, r, g, b, a);
-}
-
-
-// OpenGL 3.1 core functions
-inline void QOpenGLFunctions_4_1_Core::glCopyBufferSubData(GLenum readTarget, GLenum writeTarget, GLintptr readOffset, GLintptr writeOffset, GLsizeiptr size)
-{
- d_3_1_Core->f.CopyBufferSubData(readTarget, writeTarget, readOffset, writeOffset, size);
-}
-
-inline void QOpenGLFunctions_4_1_Core::glUniformBlockBinding(GLuint program, GLuint uniformBlockIndex, GLuint uniformBlockBinding)
-{
- d_3_1_Core->f.UniformBlockBinding(program, uniformBlockIndex, uniformBlockBinding);
-}
-
-inline void QOpenGLFunctions_4_1_Core::glGetActiveUniformBlockName(GLuint program, GLuint uniformBlockIndex, GLsizei bufSize, GLsizei *length, GLchar *uniformBlockName)
-{
- d_3_1_Core->f.GetActiveUniformBlockName(program, uniformBlockIndex, bufSize, length, uniformBlockName);
-}
-
-inline void QOpenGLFunctions_4_1_Core::glGetActiveUniformBlockiv(GLuint program, GLuint uniformBlockIndex, GLenum pname, GLint *params)
-{
- d_3_1_Core->f.GetActiveUniformBlockiv(program, uniformBlockIndex, pname, params);
-}
-
-inline GLuint QOpenGLFunctions_4_1_Core::glGetUniformBlockIndex(GLuint program, const GLchar *uniformBlockName)
-{
- return d_3_1_Core->f.GetUniformBlockIndex(program, uniformBlockName);
-}
-
-inline void QOpenGLFunctions_4_1_Core::glGetActiveUniformName(GLuint program, GLuint uniformIndex, GLsizei bufSize, GLsizei *length, GLchar *uniformName)
-{
- d_3_1_Core->f.GetActiveUniformName(program, uniformIndex, bufSize, length, uniformName);
-}
-
-inline void QOpenGLFunctions_4_1_Core::glGetActiveUniformsiv(GLuint program, GLsizei uniformCount, const GLuint *uniformIndices, GLenum pname, GLint *params)
-{
- d_3_1_Core->f.GetActiveUniformsiv(program, uniformCount, uniformIndices, pname, params);
-}
-
-inline void QOpenGLFunctions_4_1_Core::glGetUniformIndices(GLuint program, GLsizei uniformCount, const GLchar* const *uniformNames, GLuint *uniformIndices)
-{
- d_3_1_Core->f.GetUniformIndices(program, uniformCount, uniformNames, uniformIndices);
-}
-
-inline void QOpenGLFunctions_4_1_Core::glPrimitiveRestartIndex(GLuint index)
-{
- d_3_1_Core->f.PrimitiveRestartIndex(index);
-}
-
-inline void QOpenGLFunctions_4_1_Core::glTexBuffer(GLenum target, GLenum internalformat, GLuint buffer)
-{
- d_3_1_Core->f.TexBuffer(target, internalformat, buffer);
-}
-
-inline void QOpenGLFunctions_4_1_Core::glDrawElementsInstanced(GLenum mode, GLsizei count, GLenum type, const GLvoid *indices, GLsizei instancecount)
-{
- d_3_1_Core->f.DrawElementsInstanced(mode, count, type, indices, instancecount);
-}
-
-inline void QOpenGLFunctions_4_1_Core::glDrawArraysInstanced(GLenum mode, GLint first, GLsizei count, GLsizei instancecount)
-{
- d_3_1_Core->f.DrawArraysInstanced(mode, first, count, instancecount);
-}
-
-
-// OpenGL 3.2 core functions
-inline void QOpenGLFunctions_4_1_Core::glSampleMaski(GLuint index, GLbitfield mask)
-{
- d_3_2_Core->f.SampleMaski(index, mask);
-}
-
-inline void QOpenGLFunctions_4_1_Core::glGetMultisamplefv(GLenum pname, GLuint index, GLfloat *val)
-{
- d_3_2_Core->f.GetMultisamplefv(pname, index, val);
-}
-
-inline void QOpenGLFunctions_4_1_Core::glTexImage3DMultisample(GLenum target, GLsizei samples, GLint internalformat, GLsizei width, GLsizei height, GLsizei depth, GLboolean fixedsamplelocations)
-{
- d_3_2_Core->f.TexImage3DMultisample(target, samples, internalformat, width, height, depth, fixedsamplelocations);
-}
-
-inline void QOpenGLFunctions_4_1_Core::glTexImage2DMultisample(GLenum target, GLsizei samples, GLint internalformat, GLsizei width, GLsizei height, GLboolean fixedsamplelocations)
-{
- d_3_2_Core->f.TexImage2DMultisample(target, samples, internalformat, width, height, fixedsamplelocations);
-}
-
-inline void QOpenGLFunctions_4_1_Core::glGetSynciv(GLsync sync, GLenum pname, GLsizei bufSize, GLsizei *length, GLint *values)
-{
- d_3_2_Core->f.GetSynciv(sync, pname, bufSize, length, values);
-}
-
-inline void QOpenGLFunctions_4_1_Core::glGetInteger64v(GLenum pname, GLint64 *params)
-{
- d_3_2_Core->f.GetInteger64v(pname, params);
-}
-
-inline void QOpenGLFunctions_4_1_Core::glWaitSync(GLsync sync, GLbitfield flags, GLuint64 timeout)
-{
- d_3_2_Core->f.WaitSync(sync, flags, timeout);
-}
-
-inline GLenum QOpenGLFunctions_4_1_Core::glClientWaitSync(GLsync sync, GLbitfield flags, GLuint64 timeout)
-{
- return d_3_2_Core->f.ClientWaitSync(sync, flags, timeout);
-}
-
-inline void QOpenGLFunctions_4_1_Core::glDeleteSync(GLsync sync)
-{
- d_3_2_Core->f.DeleteSync(sync);
-}
-
-inline GLboolean QOpenGLFunctions_4_1_Core::glIsSync(GLsync sync)
-{
- return d_3_2_Core->f.IsSync(sync);
-}
-
-inline GLsync QOpenGLFunctions_4_1_Core::glFenceSync(GLenum condition, GLbitfield flags)
-{
- return d_3_2_Core->f.FenceSync(condition, flags);
-}
-
-inline void QOpenGLFunctions_4_1_Core::glProvokingVertex(GLenum mode)
-{
- d_3_2_Core->f.ProvokingVertex(mode);
-}
-
-inline void QOpenGLFunctions_4_1_Core::glMultiDrawElementsBaseVertex(GLenum mode, const GLsizei *count, GLenum type, const GLvoid* const *indices, GLsizei drawcount, const GLint *basevertex)
-{
- d_3_2_Core->f.MultiDrawElementsBaseVertex(mode, count, type, indices, drawcount, basevertex);
-}
-
-inline void QOpenGLFunctions_4_1_Core::glDrawElementsInstancedBaseVertex(GLenum mode, GLsizei count, GLenum type, const GLvoid *indices, GLsizei instancecount, GLint basevertex)
-{
- d_3_2_Core->f.DrawElementsInstancedBaseVertex(mode, count, type, indices, instancecount, basevertex);
-}
-
-inline void QOpenGLFunctions_4_1_Core::glDrawRangeElementsBaseVertex(GLenum mode, GLuint start, GLuint end, GLsizei count, GLenum type, const GLvoid *indices, GLint basevertex)
-{
- d_3_2_Core->f.DrawRangeElementsBaseVertex(mode, start, end, count, type, indices, basevertex);
-}
-
-inline void QOpenGLFunctions_4_1_Core::glDrawElementsBaseVertex(GLenum mode, GLsizei count, GLenum type, const GLvoid *indices, GLint basevertex)
-{
- d_3_2_Core->f.DrawElementsBaseVertex(mode, count, type, indices, basevertex);
-}
-
-inline void QOpenGLFunctions_4_1_Core::glFramebufferTexture(GLenum target, GLenum attachment, GLuint texture, GLint level)
-{
- d_3_2_Core->f.FramebufferTexture(target, attachment, texture, level);
-}
-
-inline void QOpenGLFunctions_4_1_Core::glGetBufferParameteri64v(GLenum target, GLenum pname, GLint64 *params)
-{
- d_3_2_Core->f.GetBufferParameteri64v(target, pname, params);
-}
-
-inline void QOpenGLFunctions_4_1_Core::glGetInteger64i_v(GLenum target, GLuint index, GLint64 *data)
-{
- d_3_2_Core->f.GetInteger64i_v(target, index, data);
-}
-
-
-// OpenGL 3.3 core functions
-inline void QOpenGLFunctions_4_1_Core::glVertexAttribP4uiv(GLuint index, GLenum type, GLboolean normalized, const GLuint *value)
-{
- d_3_3_Core->f.VertexAttribP4uiv(index, type, normalized, value);
-}
-
-inline void QOpenGLFunctions_4_1_Core::glVertexAttribP4ui(GLuint index, GLenum type, GLboolean normalized, GLuint value)
-{
- d_3_3_Core->f.VertexAttribP4ui(index, type, normalized, value);
-}
-
-inline void QOpenGLFunctions_4_1_Core::glVertexAttribP3uiv(GLuint index, GLenum type, GLboolean normalized, const GLuint *value)
-{
- d_3_3_Core->f.VertexAttribP3uiv(index, type, normalized, value);
-}
-
-inline void QOpenGLFunctions_4_1_Core::glVertexAttribP3ui(GLuint index, GLenum type, GLboolean normalized, GLuint value)
-{
- d_3_3_Core->f.VertexAttribP3ui(index, type, normalized, value);
-}
-
-inline void QOpenGLFunctions_4_1_Core::glVertexAttribP2uiv(GLuint index, GLenum type, GLboolean normalized, const GLuint *value)
-{
- d_3_3_Core->f.VertexAttribP2uiv(index, type, normalized, value);
-}
-
-inline void QOpenGLFunctions_4_1_Core::glVertexAttribP2ui(GLuint index, GLenum type, GLboolean normalized, GLuint value)
-{
- d_3_3_Core->f.VertexAttribP2ui(index, type, normalized, value);
-}
-
-inline void QOpenGLFunctions_4_1_Core::glVertexAttribP1uiv(GLuint index, GLenum type, GLboolean normalized, const GLuint *value)
-{
- d_3_3_Core->f.VertexAttribP1uiv(index, type, normalized, value);
-}
-
-inline void QOpenGLFunctions_4_1_Core::glVertexAttribP1ui(GLuint index, GLenum type, GLboolean normalized, GLuint value)
-{
- d_3_3_Core->f.VertexAttribP1ui(index, type, normalized, value);
-}
-
-inline void QOpenGLFunctions_4_1_Core::glSecondaryColorP3uiv(GLenum type, const GLuint *color)
-{
- Q_UNUSED(type);
- Q_UNUSED(color);
- QOPENGL_DEPRECATEDFUNCTION;
-}
-
-inline void QOpenGLFunctions_4_1_Core::glSecondaryColorP3ui(GLenum type, GLuint color)
-{
- Q_UNUSED(type);
- Q_UNUSED(color);
- QOPENGL_DEPRECATEDFUNCTION;
-}
-
-inline void QOpenGLFunctions_4_1_Core::glColorP4uiv(GLenum type, const GLuint *color)
-{
- Q_UNUSED(type);
- Q_UNUSED(color);
- QOPENGL_DEPRECATEDFUNCTION;
-}
-
-inline void QOpenGLFunctions_4_1_Core::glColorP4ui(GLenum type, GLuint color)
-{
- Q_UNUSED(type);
- Q_UNUSED(color);
- QOPENGL_DEPRECATEDFUNCTION;
-}
-
-inline void QOpenGLFunctions_4_1_Core::glColorP3uiv(GLenum type, const GLuint *color)
-{
- Q_UNUSED(type);
- Q_UNUSED(color);
- QOPENGL_DEPRECATEDFUNCTION;
-}
-
-inline void QOpenGLFunctions_4_1_Core::glColorP3ui(GLenum type, GLuint color)
-{
- Q_UNUSED(type);
- Q_UNUSED(color);
- QOPENGL_DEPRECATEDFUNCTION;
-}
-
-inline void QOpenGLFunctions_4_1_Core::glNormalP3uiv(GLenum type, const GLuint *coords)
-{
- Q_UNUSED(type);
- Q_UNUSED(coords);
- QOPENGL_DEPRECATEDFUNCTION;
-}
-
-inline void QOpenGLFunctions_4_1_Core::glNormalP3ui(GLenum type, GLuint coords)
-{
- Q_UNUSED(type);
- Q_UNUSED(coords);
- QOPENGL_DEPRECATEDFUNCTION;
-}
-
-inline void QOpenGLFunctions_4_1_Core::glMultiTexCoordP4uiv(GLenum texture, GLenum type, const GLuint *coords)
-{
- Q_UNUSED(texture);
- Q_UNUSED(type);
- Q_UNUSED(coords);
- QOPENGL_DEPRECATEDFUNCTION;
-}
-
-inline void QOpenGLFunctions_4_1_Core::glMultiTexCoordP4ui(GLenum texture, GLenum type, GLuint coords)
-{
- Q_UNUSED(texture);
- Q_UNUSED(type);
- Q_UNUSED(coords);
- QOPENGL_DEPRECATEDFUNCTION;
-}
-
-inline void QOpenGLFunctions_4_1_Core::glMultiTexCoordP3uiv(GLenum texture, GLenum type, const GLuint *coords)
-{
- Q_UNUSED(texture);
- Q_UNUSED(type);
- Q_UNUSED(coords);
- QOPENGL_DEPRECATEDFUNCTION;
-}
-
-inline void QOpenGLFunctions_4_1_Core::glMultiTexCoordP3ui(GLenum texture, GLenum type, GLuint coords)
-{
- Q_UNUSED(texture);
- Q_UNUSED(type);
- Q_UNUSED(coords);
- QOPENGL_DEPRECATEDFUNCTION;
-}
-
-inline void QOpenGLFunctions_4_1_Core::glMultiTexCoordP2uiv(GLenum texture, GLenum type, const GLuint *coords)
-{
- Q_UNUSED(texture);
- Q_UNUSED(type);
- Q_UNUSED(coords);
- QOPENGL_DEPRECATEDFUNCTION;
-}
-
-inline void QOpenGLFunctions_4_1_Core::glMultiTexCoordP2ui(GLenum texture, GLenum type, GLuint coords)
-{
- Q_UNUSED(texture);
- Q_UNUSED(type);
- Q_UNUSED(coords);
- QOPENGL_DEPRECATEDFUNCTION;
-}
-
-inline void QOpenGLFunctions_4_1_Core::glMultiTexCoordP1uiv(GLenum texture, GLenum type, const GLuint *coords)
-{
- Q_UNUSED(texture);
- Q_UNUSED(type);
- Q_UNUSED(coords);
- QOPENGL_DEPRECATEDFUNCTION;
-}
-
-inline void QOpenGLFunctions_4_1_Core::glMultiTexCoordP1ui(GLenum texture, GLenum type, GLuint coords)
-{
- Q_UNUSED(texture);
- Q_UNUSED(type);
- Q_UNUSED(coords);
- QOPENGL_DEPRECATEDFUNCTION;
-}
-
-inline void QOpenGLFunctions_4_1_Core::glTexCoordP4uiv(GLenum type, const GLuint *coords)
-{
- Q_UNUSED(type);
- Q_UNUSED(coords);
- QOPENGL_DEPRECATEDFUNCTION;
-}
-
-inline void QOpenGLFunctions_4_1_Core::glTexCoordP4ui(GLenum type, GLuint coords)
-{
- Q_UNUSED(type);
- Q_UNUSED(coords);
- QOPENGL_DEPRECATEDFUNCTION;
-}
-
-inline void QOpenGLFunctions_4_1_Core::glTexCoordP3uiv(GLenum type, const GLuint *coords)
-{
- Q_UNUSED(type);
- Q_UNUSED(coords);
- QOPENGL_DEPRECATEDFUNCTION;
-}
-
-inline void QOpenGLFunctions_4_1_Core::glTexCoordP3ui(GLenum type, GLuint coords)
-{
- Q_UNUSED(type);
- Q_UNUSED(coords);
- QOPENGL_DEPRECATEDFUNCTION;
-}
-
-inline void QOpenGLFunctions_4_1_Core::glTexCoordP2uiv(GLenum type, const GLuint *coords)
-{
- Q_UNUSED(type);
- Q_UNUSED(coords);
- QOPENGL_DEPRECATEDFUNCTION;
-}
-
-inline void QOpenGLFunctions_4_1_Core::glTexCoordP2ui(GLenum type, GLuint coords)
-{
- Q_UNUSED(type);
- Q_UNUSED(coords);
- QOPENGL_DEPRECATEDFUNCTION;
-}
-
-inline void QOpenGLFunctions_4_1_Core::glTexCoordP1uiv(GLenum type, const GLuint *coords)
-{
- Q_UNUSED(type);
- Q_UNUSED(coords);
- QOPENGL_DEPRECATEDFUNCTION;
-}
-
-inline void QOpenGLFunctions_4_1_Core::glTexCoordP1ui(GLenum type, GLuint coords)
-{
- Q_UNUSED(type);
- Q_UNUSED(coords);
- QOPENGL_DEPRECATEDFUNCTION;
-}
-
-inline void QOpenGLFunctions_4_1_Core::glVertexP4uiv(GLenum type, const GLuint *value)
-{
- Q_UNUSED(type);
- Q_UNUSED(value);
- QOPENGL_DEPRECATEDFUNCTION;
-}
-
-inline void QOpenGLFunctions_4_1_Core::glVertexP4ui(GLenum type, GLuint value)
-{
- Q_UNUSED(type);
- Q_UNUSED(value);
- QOPENGL_DEPRECATEDFUNCTION;
-}
-
-inline void QOpenGLFunctions_4_1_Core::glVertexP3uiv(GLenum type, const GLuint *value)
-{
- Q_UNUSED(type);
- Q_UNUSED(value);
- QOPENGL_DEPRECATEDFUNCTION;
-}
-
-inline void QOpenGLFunctions_4_1_Core::glVertexP3ui(GLenum type, GLuint value)
-{
- Q_UNUSED(type);
- Q_UNUSED(value);
- QOPENGL_DEPRECATEDFUNCTION;
-}
-
-inline void QOpenGLFunctions_4_1_Core::glVertexP2uiv(GLenum type, const GLuint *value)
-{
- Q_UNUSED(type);
- Q_UNUSED(value);
- QOPENGL_DEPRECATEDFUNCTION;
-}
-
-inline void QOpenGLFunctions_4_1_Core::glVertexP2ui(GLenum type, GLuint value)
-{
- Q_UNUSED(type);
- Q_UNUSED(value);
- QOPENGL_DEPRECATEDFUNCTION;
-}
-
-inline void QOpenGLFunctions_4_1_Core::glGetQueryObjectui64v(GLuint id, GLenum pname, GLuint64 *params)
-{
- d_3_3_Core->f.GetQueryObjectui64v(id, pname, params);
-}
-
-inline void QOpenGLFunctions_4_1_Core::glGetQueryObjecti64v(GLuint id, GLenum pname, GLint64 *params)
-{
- d_3_3_Core->f.GetQueryObjecti64v(id, pname, params);
-}
-
-inline void QOpenGLFunctions_4_1_Core::glQueryCounter(GLuint id, GLenum target)
-{
- d_3_3_Core->f.QueryCounter(id, target);
-}
-
-inline void QOpenGLFunctions_4_1_Core::glGetSamplerParameterIuiv(GLuint sampler, GLenum pname, GLuint *params)
-{
- d_3_3_Core->f.GetSamplerParameterIuiv(sampler, pname, params);
-}
-
-inline void QOpenGLFunctions_4_1_Core::glGetSamplerParameterfv(GLuint sampler, GLenum pname, GLfloat *params)
-{
- d_3_3_Core->f.GetSamplerParameterfv(sampler, pname, params);
-}
-
-inline void QOpenGLFunctions_4_1_Core::glGetSamplerParameterIiv(GLuint sampler, GLenum pname, GLint *params)
-{
- d_3_3_Core->f.GetSamplerParameterIiv(sampler, pname, params);
-}
-
-inline void QOpenGLFunctions_4_1_Core::glGetSamplerParameteriv(GLuint sampler, GLenum pname, GLint *params)
-{
- d_3_3_Core->f.GetSamplerParameteriv(sampler, pname, params);
-}
-
-inline void QOpenGLFunctions_4_1_Core::glSamplerParameterIuiv(GLuint sampler, GLenum pname, const GLuint *param)
-{
- d_3_3_Core->f.SamplerParameterIuiv(sampler, pname, param);
-}
-
-inline void QOpenGLFunctions_4_1_Core::glSamplerParameterIiv(GLuint sampler, GLenum pname, const GLint *param)
-{
- d_3_3_Core->f.SamplerParameterIiv(sampler, pname, param);
-}
-
-inline void QOpenGLFunctions_4_1_Core::glSamplerParameterfv(GLuint sampler, GLenum pname, const GLfloat *param)
-{
- d_3_3_Core->f.SamplerParameterfv(sampler, pname, param);
-}
-
-inline void QOpenGLFunctions_4_1_Core::glSamplerParameterf(GLuint sampler, GLenum pname, GLfloat param)
-{
- d_3_3_Core->f.SamplerParameterf(sampler, pname, param);
-}
-
-inline void QOpenGLFunctions_4_1_Core::glSamplerParameteriv(GLuint sampler, GLenum pname, const GLint *param)
-{
- d_3_3_Core->f.SamplerParameteriv(sampler, pname, param);
-}
-
-inline void QOpenGLFunctions_4_1_Core::glSamplerParameteri(GLuint sampler, GLenum pname, GLint param)
-{
- d_3_3_Core->f.SamplerParameteri(sampler, pname, param);
-}
-
-inline void QOpenGLFunctions_4_1_Core::glBindSampler(GLuint unit, GLuint sampler)
-{
- d_3_3_Core->f.BindSampler(unit, sampler);
-}
-
-inline GLboolean QOpenGLFunctions_4_1_Core::glIsSampler(GLuint sampler)
-{
- return d_3_3_Core->f.IsSampler(sampler);
-}
-
-inline void QOpenGLFunctions_4_1_Core::glDeleteSamplers(GLsizei count, const GLuint *samplers)
-{
- d_3_3_Core->f.DeleteSamplers(count, samplers);
-}
-
-inline void QOpenGLFunctions_4_1_Core::glGenSamplers(GLsizei count, GLuint *samplers)
-{
- d_3_3_Core->f.GenSamplers(count, samplers);
-}
-
-inline GLint QOpenGLFunctions_4_1_Core::glGetFragDataIndex(GLuint program, const GLchar *name)
-{
- return d_3_3_Core->f.GetFragDataIndex(program, name);
-}
-
-inline void QOpenGLFunctions_4_1_Core::glBindFragDataLocationIndexed(GLuint program, GLuint colorNumber, GLuint index, const GLchar *name)
-{
- d_3_3_Core->f.BindFragDataLocationIndexed(program, colorNumber, index, name);
-}
-
-inline void QOpenGLFunctions_4_1_Core::glVertexAttribDivisor(GLuint index, GLuint divisor)
-{
- d_3_3_Core->f.VertexAttribDivisor(index, divisor);
-}
-
-
-// OpenGL 4.0 core functions
-inline void QOpenGLFunctions_4_1_Core::glGetQueryIndexediv(GLenum target, GLuint index, GLenum pname, GLint *params)
-{
- d_4_0_Core->f.GetQueryIndexediv(target, index, pname, params);
-}
-
-inline void QOpenGLFunctions_4_1_Core::glEndQueryIndexed(GLenum target, GLuint index)
-{
- d_4_0_Core->f.EndQueryIndexed(target, index);
-}
-
-inline void QOpenGLFunctions_4_1_Core::glBeginQueryIndexed(GLenum target, GLuint index, GLuint id)
-{
- d_4_0_Core->f.BeginQueryIndexed(target, index, id);
-}
-
-inline void QOpenGLFunctions_4_1_Core::glDrawTransformFeedbackStream(GLenum mode, GLuint id, GLuint stream)
-{
- d_4_0_Core->f.DrawTransformFeedbackStream(mode, id, stream);
-}
-
-inline void QOpenGLFunctions_4_1_Core::glDrawTransformFeedback(GLenum mode, GLuint id)
-{
- d_4_0_Core->f.DrawTransformFeedback(mode, id);
-}
-
-inline void QOpenGLFunctions_4_1_Core::glResumeTransformFeedback()
-{
- d_4_0_Core->f.ResumeTransformFeedback();
-}
-
-inline void QOpenGLFunctions_4_1_Core::glPauseTransformFeedback()
-{
- d_4_0_Core->f.PauseTransformFeedback();
-}
-
-inline GLboolean QOpenGLFunctions_4_1_Core::glIsTransformFeedback(GLuint id)
-{
- return d_4_0_Core->f.IsTransformFeedback(id);
-}
-
-inline void QOpenGLFunctions_4_1_Core::glGenTransformFeedbacks(GLsizei n, GLuint *ids)
-{
- d_4_0_Core->f.GenTransformFeedbacks(n, ids);
-}
-
-inline void QOpenGLFunctions_4_1_Core::glDeleteTransformFeedbacks(GLsizei n, const GLuint *ids)
-{
- d_4_0_Core->f.DeleteTransformFeedbacks(n, ids);
-}
-
-inline void QOpenGLFunctions_4_1_Core::glBindTransformFeedback(GLenum target, GLuint id)
-{
- d_4_0_Core->f.BindTransformFeedback(target, id);
-}
-
-inline void QOpenGLFunctions_4_1_Core::glPatchParameterfv(GLenum pname, const GLfloat *values)
-{
- d_4_0_Core->f.PatchParameterfv(pname, values);
-}
-
-inline void QOpenGLFunctions_4_1_Core::glPatchParameteri(GLenum pname, GLint value)
-{
- d_4_0_Core->f.PatchParameteri(pname, value);
-}
-
-inline void QOpenGLFunctions_4_1_Core::glGetProgramStageiv(GLuint program, GLenum shadertype, GLenum pname, GLint *values)
-{
- d_4_0_Core->f.GetProgramStageiv(program, shadertype, pname, values);
-}
-
-inline void QOpenGLFunctions_4_1_Core::glGetUniformSubroutineuiv(GLenum shadertype, GLint location, GLuint *params)
-{
- d_4_0_Core->f.GetUniformSubroutineuiv(shadertype, location, params);
-}
-
-inline void QOpenGLFunctions_4_1_Core::glUniformSubroutinesuiv(GLenum shadertype, GLsizei count, const GLuint *indices)
-{
- d_4_0_Core->f.UniformSubroutinesuiv(shadertype, count, indices);
-}
-
-inline void QOpenGLFunctions_4_1_Core::glGetActiveSubroutineName(GLuint program, GLenum shadertype, GLuint index, GLsizei bufsize, GLsizei *length, GLchar *name)
-{
- d_4_0_Core->f.GetActiveSubroutineName(program, shadertype, index, bufsize, length, name);
-}
-
-inline void QOpenGLFunctions_4_1_Core::glGetActiveSubroutineUniformName(GLuint program, GLenum shadertype, GLuint index, GLsizei bufsize, GLsizei *length, GLchar *name)
-{
- d_4_0_Core->f.GetActiveSubroutineUniformName(program, shadertype, index, bufsize, length, name);
-}
-
-inline void QOpenGLFunctions_4_1_Core::glGetActiveSubroutineUniformiv(GLuint program, GLenum shadertype, GLuint index, GLenum pname, GLint *values)
-{
- d_4_0_Core->f.GetActiveSubroutineUniformiv(program, shadertype, index, pname, values);
-}
-
-inline GLuint QOpenGLFunctions_4_1_Core::glGetSubroutineIndex(GLuint program, GLenum shadertype, const GLchar *name)
-{
- return d_4_0_Core->f.GetSubroutineIndex(program, shadertype, name);
-}
-
-inline GLint QOpenGLFunctions_4_1_Core::glGetSubroutineUniformLocation(GLuint program, GLenum shadertype, const GLchar *name)
-{
- return d_4_0_Core->f.GetSubroutineUniformLocation(program, shadertype, name);
-}
-
-inline void QOpenGLFunctions_4_1_Core::glGetUniformdv(GLuint program, GLint location, GLdouble *params)
-{
- d_4_0_Core->f.GetUniformdv(program, location, params);
-}
-
-inline void QOpenGLFunctions_4_1_Core::glUniformMatrix4x3dv(GLint location, GLsizei count, GLboolean transpose, const GLdouble *value)
-{
- d_4_0_Core->f.UniformMatrix4x3dv(location, count, transpose, value);
-}
-
-inline void QOpenGLFunctions_4_1_Core::glUniformMatrix4x2dv(GLint location, GLsizei count, GLboolean transpose, const GLdouble *value)
-{
- d_4_0_Core->f.UniformMatrix4x2dv(location, count, transpose, value);
-}
-
-inline void QOpenGLFunctions_4_1_Core::glUniformMatrix3x4dv(GLint location, GLsizei count, GLboolean transpose, const GLdouble *value)
-{
- d_4_0_Core->f.UniformMatrix3x4dv(location, count, transpose, value);
-}
-
-inline void QOpenGLFunctions_4_1_Core::glUniformMatrix3x2dv(GLint location, GLsizei count, GLboolean transpose, const GLdouble *value)
-{
- d_4_0_Core->f.UniformMatrix3x2dv(location, count, transpose, value);
-}
-
-inline void QOpenGLFunctions_4_1_Core::glUniformMatrix2x4dv(GLint location, GLsizei count, GLboolean transpose, const GLdouble *value)
-{
- d_4_0_Core->f.UniformMatrix2x4dv(location, count, transpose, value);
-}
-
-inline void QOpenGLFunctions_4_1_Core::glUniformMatrix2x3dv(GLint location, GLsizei count, GLboolean transpose, const GLdouble *value)
-{
- d_4_0_Core->f.UniformMatrix2x3dv(location, count, transpose, value);
-}
-
-inline void QOpenGLFunctions_4_1_Core::glUniformMatrix4dv(GLint location, GLsizei count, GLboolean transpose, const GLdouble *value)
-{
- d_4_0_Core->f.UniformMatrix4dv(location, count, transpose, value);
-}
-
-inline void QOpenGLFunctions_4_1_Core::glUniformMatrix3dv(GLint location, GLsizei count, GLboolean transpose, const GLdouble *value)
-{
- d_4_0_Core->f.UniformMatrix3dv(location, count, transpose, value);
-}
-
-inline void QOpenGLFunctions_4_1_Core::glUniformMatrix2dv(GLint location, GLsizei count, GLboolean transpose, const GLdouble *value)
-{
- d_4_0_Core->f.UniformMatrix2dv(location, count, transpose, value);
-}
-
-inline void QOpenGLFunctions_4_1_Core::glUniform4dv(GLint location, GLsizei count, const GLdouble *value)
-{
- d_4_0_Core->f.Uniform4dv(location, count, value);
-}
-
-inline void QOpenGLFunctions_4_1_Core::glUniform3dv(GLint location, GLsizei count, const GLdouble *value)
-{
- d_4_0_Core->f.Uniform3dv(location, count, value);
-}
-
-inline void QOpenGLFunctions_4_1_Core::glUniform2dv(GLint location, GLsizei count, const GLdouble *value)
-{
- d_4_0_Core->f.Uniform2dv(location, count, value);
-}
-
-inline void QOpenGLFunctions_4_1_Core::glUniform1dv(GLint location, GLsizei count, const GLdouble *value)
-{
- d_4_0_Core->f.Uniform1dv(location, count, value);
-}
-
-inline void QOpenGLFunctions_4_1_Core::glUniform4d(GLint location, GLdouble x, GLdouble y, GLdouble z, GLdouble w)
-{
- d_4_0_Core->f.Uniform4d(location, x, y, z, w);
-}
-
-inline void QOpenGLFunctions_4_1_Core::glUniform3d(GLint location, GLdouble x, GLdouble y, GLdouble z)
-{
- d_4_0_Core->f.Uniform3d(location, x, y, z);
-}
-
-inline void QOpenGLFunctions_4_1_Core::glUniform2d(GLint location, GLdouble x, GLdouble y)
-{
- d_4_0_Core->f.Uniform2d(location, x, y);
-}
-
-inline void QOpenGLFunctions_4_1_Core::glUniform1d(GLint location, GLdouble x)
-{
- d_4_0_Core->f.Uniform1d(location, x);
-}
-
-inline void QOpenGLFunctions_4_1_Core::glDrawElementsIndirect(GLenum mode, GLenum type, const GLvoid *indirect)
-{
- d_4_0_Core->f.DrawElementsIndirect(mode, type, indirect);
-}
-
-inline void QOpenGLFunctions_4_1_Core::glDrawArraysIndirect(GLenum mode, const GLvoid *indirect)
-{
- d_4_0_Core->f.DrawArraysIndirect(mode, indirect);
-}
-
-inline void QOpenGLFunctions_4_1_Core::glBlendFuncSeparatei(GLuint buf, GLenum srcRGB, GLenum dstRGB, GLenum srcAlpha, GLenum dstAlpha)
-{
- d_4_0_Core->f.BlendFuncSeparatei(buf, srcRGB, dstRGB, srcAlpha, dstAlpha);
-}
-
-inline void QOpenGLFunctions_4_1_Core::glBlendFunci(GLuint buf, GLenum src, GLenum dst)
-{
- d_4_0_Core->f.BlendFunci(buf, src, dst);
-}
-
-inline void QOpenGLFunctions_4_1_Core::glBlendEquationSeparatei(GLuint buf, GLenum modeRGB, GLenum modeAlpha)
-{
- d_4_0_Core->f.BlendEquationSeparatei(buf, modeRGB, modeAlpha);
-}
-
-inline void QOpenGLFunctions_4_1_Core::glBlendEquationi(GLuint buf, GLenum mode)
-{
- d_4_0_Core->f.BlendEquationi(buf, mode);
-}
-
-inline void QOpenGLFunctions_4_1_Core::glMinSampleShading(GLfloat value)
-{
- d_4_0_Core->f.MinSampleShading(value);
-}
-
-
-// OpenGL 4.1 core functions
-inline void QOpenGLFunctions_4_1_Core::glGetDoublei_v(GLenum target, GLuint index, GLdouble *data)
-{
- d_4_1_Core->f.GetDoublei_v(target, index, data);
-}
-
-inline void QOpenGLFunctions_4_1_Core::glGetFloati_v(GLenum target, GLuint index, GLfloat *data)
-{
- d_4_1_Core->f.GetFloati_v(target, index, data);
-}
-
-inline void QOpenGLFunctions_4_1_Core::glDepthRangeIndexed(GLuint index, GLdouble n, GLdouble f)
-{
- d_4_1_Core->f.DepthRangeIndexed(index, n, f);
-}
-
-inline void QOpenGLFunctions_4_1_Core::glDepthRangeArrayv(GLuint first, GLsizei count, const GLdouble *v)
-{
- d_4_1_Core->f.DepthRangeArrayv(first, count, v);
-}
-
-inline void QOpenGLFunctions_4_1_Core::glScissorIndexedv(GLuint index, const GLint *v)
-{
- d_4_1_Core->f.ScissorIndexedv(index, v);
-}
-
-inline void QOpenGLFunctions_4_1_Core::glScissorIndexed(GLuint index, GLint left, GLint bottom, GLsizei width, GLsizei height)
-{
- d_4_1_Core->f.ScissorIndexed(index, left, bottom, width, height);
-}
-
-inline void QOpenGLFunctions_4_1_Core::glScissorArrayv(GLuint first, GLsizei count, const GLint *v)
-{
- d_4_1_Core->f.ScissorArrayv(first, count, v);
-}
-
-inline void QOpenGLFunctions_4_1_Core::glViewportIndexedfv(GLuint index, const GLfloat *v)
-{
- d_4_1_Core->f.ViewportIndexedfv(index, v);
-}
-
-inline void QOpenGLFunctions_4_1_Core::glViewportIndexedf(GLuint index, GLfloat x, GLfloat y, GLfloat w, GLfloat h)
-{
- d_4_1_Core->f.ViewportIndexedf(index, x, y, w, h);
-}
-
-inline void QOpenGLFunctions_4_1_Core::glViewportArrayv(GLuint first, GLsizei count, const GLfloat *v)
-{
- d_4_1_Core->f.ViewportArrayv(first, count, v);
-}
-
-inline void QOpenGLFunctions_4_1_Core::glGetVertexAttribLdv(GLuint index, GLenum pname, GLdouble *params)
-{
- d_4_1_Core->f.GetVertexAttribLdv(index, pname, params);
-}
-
-inline void QOpenGLFunctions_4_1_Core::glVertexAttribLPointer(GLuint index, GLint size, GLenum type, GLsizei stride, const GLvoid *pointer)
-{
- d_4_1_Core->f.VertexAttribLPointer(index, size, type, stride, pointer);
-}
-
-inline void QOpenGLFunctions_4_1_Core::glVertexAttribL4dv(GLuint index, const GLdouble *v)
-{
- d_4_1_Core->f.VertexAttribL4dv(index, v);
-}
-
-inline void QOpenGLFunctions_4_1_Core::glVertexAttribL3dv(GLuint index, const GLdouble *v)
-{
- d_4_1_Core->f.VertexAttribL3dv(index, v);
-}
-
-inline void QOpenGLFunctions_4_1_Core::glVertexAttribL2dv(GLuint index, const GLdouble *v)
-{
- d_4_1_Core->f.VertexAttribL2dv(index, v);
-}
-
-inline void QOpenGLFunctions_4_1_Core::glVertexAttribL1dv(GLuint index, const GLdouble *v)
-{
- d_4_1_Core->f.VertexAttribL1dv(index, v);
-}
-
-inline void QOpenGLFunctions_4_1_Core::glVertexAttribL4d(GLuint index, GLdouble x, GLdouble y, GLdouble z, GLdouble w)
-{
- d_4_1_Core->f.VertexAttribL4d(index, x, y, z, w);
-}
-
-inline void QOpenGLFunctions_4_1_Core::glVertexAttribL3d(GLuint index, GLdouble x, GLdouble y, GLdouble z)
-{
- d_4_1_Core->f.VertexAttribL3d(index, x, y, z);
-}
-
-inline void QOpenGLFunctions_4_1_Core::glVertexAttribL2d(GLuint index, GLdouble x, GLdouble y)
-{
- d_4_1_Core->f.VertexAttribL2d(index, x, y);
-}
-
-inline void QOpenGLFunctions_4_1_Core::glVertexAttribL1d(GLuint index, GLdouble x)
-{
- d_4_1_Core->f.VertexAttribL1d(index, x);
-}
-
-inline void QOpenGLFunctions_4_1_Core::glGetProgramPipelineInfoLog(GLuint pipeline, GLsizei bufSize, GLsizei *length, GLchar *infoLog)
-{
- d_4_1_Core->f.GetProgramPipelineInfoLog(pipeline, bufSize, length, infoLog);
-}
-
-inline void QOpenGLFunctions_4_1_Core::glValidateProgramPipeline(GLuint pipeline)
-{
- d_4_1_Core->f.ValidateProgramPipeline(pipeline);
-}
-
-inline void QOpenGLFunctions_4_1_Core::glProgramUniformMatrix4x3dv(GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLdouble *value)
-{
- d_4_1_Core->f.ProgramUniformMatrix4x3dv(program, location, count, transpose, value);
-}
-
-inline void QOpenGLFunctions_4_1_Core::glProgramUniformMatrix3x4dv(GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLdouble *value)
-{
- d_4_1_Core->f.ProgramUniformMatrix3x4dv(program, location, count, transpose, value);
-}
-
-inline void QOpenGLFunctions_4_1_Core::glProgramUniformMatrix4x2dv(GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLdouble *value)
-{
- d_4_1_Core->f.ProgramUniformMatrix4x2dv(program, location, count, transpose, value);
-}
-
-inline void QOpenGLFunctions_4_1_Core::glProgramUniformMatrix2x4dv(GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLdouble *value)
-{
- d_4_1_Core->f.ProgramUniformMatrix2x4dv(program, location, count, transpose, value);
-}
-
-inline void QOpenGLFunctions_4_1_Core::glProgramUniformMatrix3x2dv(GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLdouble *value)
-{
- d_4_1_Core->f.ProgramUniformMatrix3x2dv(program, location, count, transpose, value);
-}
-
-inline void QOpenGLFunctions_4_1_Core::glProgramUniformMatrix2x3dv(GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLdouble *value)
-{
- d_4_1_Core->f.ProgramUniformMatrix2x3dv(program, location, count, transpose, value);
-}
-
-inline void QOpenGLFunctions_4_1_Core::glProgramUniformMatrix4x3fv(GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value)
-{
- d_4_1_Core->f.ProgramUniformMatrix4x3fv(program, location, count, transpose, value);
-}
-
-inline void QOpenGLFunctions_4_1_Core::glProgramUniformMatrix3x4fv(GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value)
-{
- d_4_1_Core->f.ProgramUniformMatrix3x4fv(program, location, count, transpose, value);
-}
-
-inline void QOpenGLFunctions_4_1_Core::glProgramUniformMatrix4x2fv(GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value)
-{
- d_4_1_Core->f.ProgramUniformMatrix4x2fv(program, location, count, transpose, value);
-}
-
-inline void QOpenGLFunctions_4_1_Core::glProgramUniformMatrix2x4fv(GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value)
-{
- d_4_1_Core->f.ProgramUniformMatrix2x4fv(program, location, count, transpose, value);
-}
-
-inline void QOpenGLFunctions_4_1_Core::glProgramUniformMatrix3x2fv(GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value)
-{
- d_4_1_Core->f.ProgramUniformMatrix3x2fv(program, location, count, transpose, value);
-}
-
-inline void QOpenGLFunctions_4_1_Core::glProgramUniformMatrix2x3fv(GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value)
-{
- d_4_1_Core->f.ProgramUniformMatrix2x3fv(program, location, count, transpose, value);
-}
-
-inline void QOpenGLFunctions_4_1_Core::glProgramUniformMatrix4dv(GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLdouble *value)
-{
- d_4_1_Core->f.ProgramUniformMatrix4dv(program, location, count, transpose, value);
-}
-
-inline void QOpenGLFunctions_4_1_Core::glProgramUniformMatrix3dv(GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLdouble *value)
-{
- d_4_1_Core->f.ProgramUniformMatrix3dv(program, location, count, transpose, value);
-}
-
-inline void QOpenGLFunctions_4_1_Core::glProgramUniformMatrix2dv(GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLdouble *value)
-{
- d_4_1_Core->f.ProgramUniformMatrix2dv(program, location, count, transpose, value);
-}
-
-inline void QOpenGLFunctions_4_1_Core::glProgramUniformMatrix4fv(GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value)
-{
- d_4_1_Core->f.ProgramUniformMatrix4fv(program, location, count, transpose, value);
-}
-
-inline void QOpenGLFunctions_4_1_Core::glProgramUniformMatrix3fv(GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value)
-{
- d_4_1_Core->f.ProgramUniformMatrix3fv(program, location, count, transpose, value);
-}
-
-inline void QOpenGLFunctions_4_1_Core::glProgramUniformMatrix2fv(GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value)
-{
- d_4_1_Core->f.ProgramUniformMatrix2fv(program, location, count, transpose, value);
-}
-
-inline void QOpenGLFunctions_4_1_Core::glProgramUniform4uiv(GLuint program, GLint location, GLsizei count, const GLuint *value)
-{
- d_4_1_Core->f.ProgramUniform4uiv(program, location, count, value);
-}
-
-inline void QOpenGLFunctions_4_1_Core::glProgramUniform4ui(GLuint program, GLint location, GLuint v0, GLuint v1, GLuint v2, GLuint v3)
-{
- d_4_1_Core->f.ProgramUniform4ui(program, location, v0, v1, v2, v3);
-}
-
-inline void QOpenGLFunctions_4_1_Core::glProgramUniform4dv(GLuint program, GLint location, GLsizei count, const GLdouble *value)
-{
- d_4_1_Core->f.ProgramUniform4dv(program, location, count, value);
-}
-
-inline void QOpenGLFunctions_4_1_Core::glProgramUniform4d(GLuint program, GLint location, GLdouble v0, GLdouble v1, GLdouble v2, GLdouble v3)
-{
- d_4_1_Core->f.ProgramUniform4d(program, location, v0, v1, v2, v3);
-}
-
-inline void QOpenGLFunctions_4_1_Core::glProgramUniform4fv(GLuint program, GLint location, GLsizei count, const GLfloat *value)
-{
- d_4_1_Core->f.ProgramUniform4fv(program, location, count, value);
-}
-
-inline void QOpenGLFunctions_4_1_Core::glProgramUniform4f(GLuint program, GLint location, GLfloat v0, GLfloat v1, GLfloat v2, GLfloat v3)
-{
- d_4_1_Core->f.ProgramUniform4f(program, location, v0, v1, v2, v3);
-}
-
-inline void QOpenGLFunctions_4_1_Core::glProgramUniform4iv(GLuint program, GLint location, GLsizei count, const GLint *value)
-{
- d_4_1_Core->f.ProgramUniform4iv(program, location, count, value);
-}
-
-inline void QOpenGLFunctions_4_1_Core::glProgramUniform4i(GLuint program, GLint location, GLint v0, GLint v1, GLint v2, GLint v3)
-{
- d_4_1_Core->f.ProgramUniform4i(program, location, v0, v1, v2, v3);
-}
-
-inline void QOpenGLFunctions_4_1_Core::glProgramUniform3uiv(GLuint program, GLint location, GLsizei count, const GLuint *value)
-{
- d_4_1_Core->f.ProgramUniform3uiv(program, location, count, value);
-}
-
-inline void QOpenGLFunctions_4_1_Core::glProgramUniform3ui(GLuint program, GLint location, GLuint v0, GLuint v1, GLuint v2)
-{
- d_4_1_Core->f.ProgramUniform3ui(program, location, v0, v1, v2);
-}
-
-inline void QOpenGLFunctions_4_1_Core::glProgramUniform3dv(GLuint program, GLint location, GLsizei count, const GLdouble *value)
-{
- d_4_1_Core->f.ProgramUniform3dv(program, location, count, value);
-}
-
-inline void QOpenGLFunctions_4_1_Core::glProgramUniform3d(GLuint program, GLint location, GLdouble v0, GLdouble v1, GLdouble v2)
-{
- d_4_1_Core->f.ProgramUniform3d(program, location, v0, v1, v2);
-}
-
-inline void QOpenGLFunctions_4_1_Core::glProgramUniform3fv(GLuint program, GLint location, GLsizei count, const GLfloat *value)
-{
- d_4_1_Core->f.ProgramUniform3fv(program, location, count, value);
-}
-
-inline void QOpenGLFunctions_4_1_Core::glProgramUniform3f(GLuint program, GLint location, GLfloat v0, GLfloat v1, GLfloat v2)
-{
- d_4_1_Core->f.ProgramUniform3f(program, location, v0, v1, v2);
-}
-
-inline void QOpenGLFunctions_4_1_Core::glProgramUniform3iv(GLuint program, GLint location, GLsizei count, const GLint *value)
-{
- d_4_1_Core->f.ProgramUniform3iv(program, location, count, value);
-}
-
-inline void QOpenGLFunctions_4_1_Core::glProgramUniform3i(GLuint program, GLint location, GLint v0, GLint v1, GLint v2)
-{
- d_4_1_Core->f.ProgramUniform3i(program, location, v0, v1, v2);
-}
-
-inline void QOpenGLFunctions_4_1_Core::glProgramUniform2uiv(GLuint program, GLint location, GLsizei count, const GLuint *value)
-{
- d_4_1_Core->f.ProgramUniform2uiv(program, location, count, value);
-}
-
-inline void QOpenGLFunctions_4_1_Core::glProgramUniform2ui(GLuint program, GLint location, GLuint v0, GLuint v1)
-{
- d_4_1_Core->f.ProgramUniform2ui(program, location, v0, v1);
-}
-
-inline void QOpenGLFunctions_4_1_Core::glProgramUniform2dv(GLuint program, GLint location, GLsizei count, const GLdouble *value)
-{
- d_4_1_Core->f.ProgramUniform2dv(program, location, count, value);
-}
-
-inline void QOpenGLFunctions_4_1_Core::glProgramUniform2d(GLuint program, GLint location, GLdouble v0, GLdouble v1)
-{
- d_4_1_Core->f.ProgramUniform2d(program, location, v0, v1);
-}
-
-inline void QOpenGLFunctions_4_1_Core::glProgramUniform2fv(GLuint program, GLint location, GLsizei count, const GLfloat *value)
-{
- d_4_1_Core->f.ProgramUniform2fv(program, location, count, value);
-}
-
-inline void QOpenGLFunctions_4_1_Core::glProgramUniform2f(GLuint program, GLint location, GLfloat v0, GLfloat v1)
-{
- d_4_1_Core->f.ProgramUniform2f(program, location, v0, v1);
-}
-
-inline void QOpenGLFunctions_4_1_Core::glProgramUniform2iv(GLuint program, GLint location, GLsizei count, const GLint *value)
-{
- d_4_1_Core->f.ProgramUniform2iv(program, location, count, value);
-}
-
-inline void QOpenGLFunctions_4_1_Core::glProgramUniform2i(GLuint program, GLint location, GLint v0, GLint v1)
-{
- d_4_1_Core->f.ProgramUniform2i(program, location, v0, v1);
-}
-
-inline void QOpenGLFunctions_4_1_Core::glProgramUniform1uiv(GLuint program, GLint location, GLsizei count, const GLuint *value)
-{
- d_4_1_Core->f.ProgramUniform1uiv(program, location, count, value);
-}
-
-inline void QOpenGLFunctions_4_1_Core::glProgramUniform1ui(GLuint program, GLint location, GLuint v0)
-{
- d_4_1_Core->f.ProgramUniform1ui(program, location, v0);
-}
-
-inline void QOpenGLFunctions_4_1_Core::glProgramUniform1dv(GLuint program, GLint location, GLsizei count, const GLdouble *value)
-{
- d_4_1_Core->f.ProgramUniform1dv(program, location, count, value);
-}
-
-inline void QOpenGLFunctions_4_1_Core::glProgramUniform1d(GLuint program, GLint location, GLdouble v0)
-{
- d_4_1_Core->f.ProgramUniform1d(program, location, v0);
-}
-
-inline void QOpenGLFunctions_4_1_Core::glProgramUniform1fv(GLuint program, GLint location, GLsizei count, const GLfloat *value)
-{
- d_4_1_Core->f.ProgramUniform1fv(program, location, count, value);
-}
-
-inline void QOpenGLFunctions_4_1_Core::glProgramUniform1f(GLuint program, GLint location, GLfloat v0)
-{
- d_4_1_Core->f.ProgramUniform1f(program, location, v0);
-}
-
-inline void QOpenGLFunctions_4_1_Core::glProgramUniform1iv(GLuint program, GLint location, GLsizei count, const GLint *value)
-{
- d_4_1_Core->f.ProgramUniform1iv(program, location, count, value);
-}
-
-inline void QOpenGLFunctions_4_1_Core::glProgramUniform1i(GLuint program, GLint location, GLint v0)
-{
- d_4_1_Core->f.ProgramUniform1i(program, location, v0);
-}
-
-inline void QOpenGLFunctions_4_1_Core::glGetProgramPipelineiv(GLuint pipeline, GLenum pname, GLint *params)
-{
- d_4_1_Core->f.GetProgramPipelineiv(pipeline, pname, params);
-}
-
-inline GLboolean QOpenGLFunctions_4_1_Core::glIsProgramPipeline(GLuint pipeline)
-{
- return d_4_1_Core->f.IsProgramPipeline(pipeline);
-}
-
-inline void QOpenGLFunctions_4_1_Core::glGenProgramPipelines(GLsizei n, GLuint *pipelines)
-{
- d_4_1_Core->f.GenProgramPipelines(n, pipelines);
-}
-
-inline void QOpenGLFunctions_4_1_Core::glDeleteProgramPipelines(GLsizei n, const GLuint *pipelines)
-{
- d_4_1_Core->f.DeleteProgramPipelines(n, pipelines);
-}
-
-inline void QOpenGLFunctions_4_1_Core::glBindProgramPipeline(GLuint pipeline)
-{
- d_4_1_Core->f.BindProgramPipeline(pipeline);
-}
-
-inline GLuint QOpenGLFunctions_4_1_Core::glCreateShaderProgramv(GLenum type, GLsizei count, const GLchar* const *strings)
-{
- return d_4_1_Core->f.CreateShaderProgramv(type, count, strings);
-}
-
-inline void QOpenGLFunctions_4_1_Core::glActiveShaderProgram(GLuint pipeline, GLuint program)
-{
- d_4_1_Core->f.ActiveShaderProgram(pipeline, program);
-}
-
-inline void QOpenGLFunctions_4_1_Core::glUseProgramStages(GLuint pipeline, GLbitfield stages, GLuint program)
-{
- d_4_1_Core->f.UseProgramStages(pipeline, stages, program);
-}
-
-inline void QOpenGLFunctions_4_1_Core::glProgramParameteri(GLuint program, GLenum pname, GLint value)
-{
- d_4_1_Core->f.ProgramParameteri(program, pname, value);
-}
-
-inline void QOpenGLFunctions_4_1_Core::glProgramBinary(GLuint program, GLenum binaryFormat, const GLvoid *binary, GLsizei length)
-{
- d_4_1_Core->f.ProgramBinary(program, binaryFormat, binary, length);
-}
-
-inline void QOpenGLFunctions_4_1_Core::glGetProgramBinary(GLuint program, GLsizei bufSize, GLsizei *length, GLenum *binaryFormat, GLvoid *binary)
-{
- d_4_1_Core->f.GetProgramBinary(program, bufSize, length, binaryFormat, binary);
-}
-
-inline void QOpenGLFunctions_4_1_Core::glClearDepthf(GLfloat dd)
-{
- d_4_1_Core->f.ClearDepthf(dd);
-}
-
-inline void QOpenGLFunctions_4_1_Core::glDepthRangef(GLfloat n, GLfloat f)
-{
- d_4_1_Core->f.DepthRangef(n, f);
-}
-
-inline void QOpenGLFunctions_4_1_Core::glGetShaderPrecisionFormat(GLenum shadertype, GLenum precisiontype, GLint *range, GLint *precision)
-{
- d_4_1_Core->f.GetShaderPrecisionFormat(shadertype, precisiontype, range, precision);
-}
-
-inline void QOpenGLFunctions_4_1_Core::glShaderBinary(GLsizei count, const GLuint *shaders, GLenum binaryformat, const GLvoid *binary, GLsizei length)
-{
- d_4_1_Core->f.ShaderBinary(count, shaders, binaryformat, binary, length);
-}
-
-inline void QOpenGLFunctions_4_1_Core::glReleaseShaderCompiler()
-{
- d_4_1_Core->f.ReleaseShaderCompiler();
-}
-
-
-
-QT_END_NAMESPACE
-
-#endif // QT_NO_OPENGL && !QT_OPENGL_ES_2
-
-#endif
diff --git a/src/gui/opengl/qopenglfunctions_4_2_compatibility.cpp b/src/gui/opengl/qopenglfunctions_4_2_compatibility.cpp
deleted file mode 100644
index 41ab9ae762..0000000000
--- a/src/gui/opengl/qopenglfunctions_4_2_compatibility.cpp
+++ /dev/null
@@ -1,309 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2013 Klaralvdalens Datakonsult AB (KDAB)
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the QtGui module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-**
-** This file was generated by glgen version 0.1
-** Command line was: glgen
-**
-** glgen is Copyright (C) 2013 Klaralvdalens Datakonsult AB (KDAB)
-**
-** This is an auto-generated file.
-** Do not edit! All changes made to it will be lost.
-**
-****************************************************************************/
-
-#include "qopenglfunctions_4_2_compatibility.h"
-#include "qopenglcontext.h"
-
-QT_BEGIN_NAMESPACE
-
-/*!
- \class QOpenGLFunctions_4_2_Compatibility
- \inmodule QtGui
- \since 5.1
- \wrapper
- \brief The QOpenGLFunctions_4_2_Compatibility class provides all functions for OpenGL 4.2 compatibility profile.
-
- This class is a wrapper for functions from OpenGL 4.2 compatibility profile.
- See reference pages on \l {http://www.opengl.org/sdk/docs/}{opengl.org}
- for function documentation.
-
- \sa QAbstractOpenGLFunctions
-*/
-
-QOpenGLFunctions_4_2_Compatibility::QOpenGLFunctions_4_2_Compatibility()
- : QAbstractOpenGLFunctions()
- , d_1_0_Core(nullptr)
- , d_1_1_Core(nullptr)
- , d_1_2_Core(nullptr)
- , d_1_3_Core(nullptr)
- , d_1_4_Core(nullptr)
- , d_1_5_Core(nullptr)
- , d_2_0_Core(nullptr)
- , d_2_1_Core(nullptr)
- , d_3_0_Core(nullptr)
- , d_3_1_Core(nullptr)
- , d_3_2_Core(nullptr)
- , d_3_3_Core(nullptr)
- , d_4_0_Core(nullptr)
- , d_4_1_Core(nullptr)
- , d_4_2_Core(nullptr)
- , d_1_0_Deprecated(nullptr)
- , d_1_1_Deprecated(nullptr)
- , d_1_2_Deprecated(nullptr)
- , d_1_3_Deprecated(nullptr)
- , d_1_4_Deprecated(nullptr)
- , m_reserved_2_0_Deprecated(nullptr)
- , d_3_3_Deprecated(nullptr)
-{
-}
-
-QOpenGLFunctions_4_2_Compatibility::~QOpenGLFunctions_4_2_Compatibility()
-{
- if (d_1_0_Core) {
- d_1_0_Core->refs.deref();
- Q_ASSERT(d_1_0_Core->refs.loadRelaxed());
- }
- if (d_1_1_Core) {
- d_1_1_Core->refs.deref();
- Q_ASSERT(d_1_1_Core->refs.loadRelaxed());
- }
- if (d_1_2_Core) {
- d_1_2_Core->refs.deref();
- Q_ASSERT(d_1_2_Core->refs.loadRelaxed());
- }
- if (d_1_3_Core) {
- d_1_3_Core->refs.deref();
- Q_ASSERT(d_1_3_Core->refs.loadRelaxed());
- }
- if (d_1_4_Core) {
- d_1_4_Core->refs.deref();
- Q_ASSERT(d_1_4_Core->refs.loadRelaxed());
- }
- if (d_1_5_Core) {
- d_1_5_Core->refs.deref();
- Q_ASSERT(d_1_5_Core->refs.loadRelaxed());
- }
- if (d_2_0_Core) {
- d_2_0_Core->refs.deref();
- Q_ASSERT(d_2_0_Core->refs.loadRelaxed());
- }
- if (d_2_1_Core) {
- d_2_1_Core->refs.deref();
- Q_ASSERT(d_2_1_Core->refs.loadRelaxed());
- }
- if (d_3_0_Core) {
- d_3_0_Core->refs.deref();
- Q_ASSERT(d_3_0_Core->refs.loadRelaxed());
- }
- if (d_3_1_Core) {
- d_3_1_Core->refs.deref();
- Q_ASSERT(d_3_1_Core->refs.loadRelaxed());
- }
- if (d_3_2_Core) {
- d_3_2_Core->refs.deref();
- Q_ASSERT(d_3_2_Core->refs.loadRelaxed());
- }
- if (d_3_3_Core) {
- d_3_3_Core->refs.deref();
- Q_ASSERT(d_3_3_Core->refs.loadRelaxed());
- }
- if (d_4_0_Core) {
- d_4_0_Core->refs.deref();
- Q_ASSERT(d_4_0_Core->refs.loadRelaxed());
- }
- if (d_4_1_Core) {
- d_4_1_Core->refs.deref();
- Q_ASSERT(d_4_1_Core->refs.loadRelaxed());
- }
- if (d_4_2_Core) {
- d_4_2_Core->refs.deref();
- Q_ASSERT(d_4_2_Core->refs.loadRelaxed());
- }
- if (d_1_0_Deprecated) {
- d_1_0_Deprecated->refs.deref();
- Q_ASSERT(d_1_0_Deprecated->refs.loadRelaxed());
- }
- if (d_1_1_Deprecated) {
- d_1_1_Deprecated->refs.deref();
- Q_ASSERT(d_1_1_Deprecated->refs.loadRelaxed());
- }
- if (d_1_2_Deprecated) {
- d_1_2_Deprecated->refs.deref();
- Q_ASSERT(d_1_2_Deprecated->refs.loadRelaxed());
- }
- if (d_1_3_Deprecated) {
- d_1_3_Deprecated->refs.deref();
- Q_ASSERT(d_1_3_Deprecated->refs.loadRelaxed());
- }
- if (d_1_4_Deprecated) {
- d_1_4_Deprecated->refs.deref();
- Q_ASSERT(d_1_4_Deprecated->refs.loadRelaxed());
- }
- if (d_3_3_Deprecated) {
- d_3_3_Deprecated->refs.deref();
- Q_ASSERT(d_3_3_Deprecated->refs.loadRelaxed());
- }
-}
-
-bool QOpenGLFunctions_4_2_Compatibility::initializeOpenGLFunctions()
-{
- if ( isInitialized() )
- return true;
-
- QOpenGLContext* context = QOpenGLContext::currentContext();
-
- // If owned by a context object make sure it is current.
- // Also check that current context is capable of resolving all needed functions
- if (((owningContext() && owningContext() == context) || !owningContext())
- && QOpenGLFunctions_4_2_Compatibility::isContextCompatible(context))
- {
- // Associate with private implementation, creating if necessary
- // Function pointers in the backends are resolved at creation time
- QOpenGLVersionFunctionsBackend* d = nullptr;
- d = QAbstractOpenGLFunctionsPrivate::functionsBackend(context, QOpenGLFunctions_1_0_CoreBackend::versionStatus());
- d_1_0_Core = static_cast<QOpenGLFunctions_1_0_CoreBackend*>(d);
- d->refs.ref();
-
- d = QAbstractOpenGLFunctionsPrivate::functionsBackend(context, QOpenGLFunctions_1_1_CoreBackend::versionStatus());
- d_1_1_Core = static_cast<QOpenGLFunctions_1_1_CoreBackend*>(d);
- d->refs.ref();
-
- d = QAbstractOpenGLFunctionsPrivate::functionsBackend(context, QOpenGLFunctions_1_2_CoreBackend::versionStatus());
- d_1_2_Core = static_cast<QOpenGLFunctions_1_2_CoreBackend*>(d);
- d->refs.ref();
-
- d = QAbstractOpenGLFunctionsPrivate::functionsBackend(context, QOpenGLFunctions_1_3_CoreBackend::versionStatus());
- d_1_3_Core = static_cast<QOpenGLFunctions_1_3_CoreBackend*>(d);
- d->refs.ref();
-
- d = QAbstractOpenGLFunctionsPrivate::functionsBackend(context, QOpenGLFunctions_1_4_CoreBackend::versionStatus());
- d_1_4_Core = static_cast<QOpenGLFunctions_1_4_CoreBackend*>(d);
- d->refs.ref();
-
- d = QAbstractOpenGLFunctionsPrivate::functionsBackend(context, QOpenGLFunctions_1_5_CoreBackend::versionStatus());
- d_1_5_Core = static_cast<QOpenGLFunctions_1_5_CoreBackend*>(d);
- d->refs.ref();
-
- d = QAbstractOpenGLFunctionsPrivate::functionsBackend(context, QOpenGLFunctions_2_0_CoreBackend::versionStatus());
- d_2_0_Core = static_cast<QOpenGLFunctions_2_0_CoreBackend*>(d);
- d->refs.ref();
-
- d = QAbstractOpenGLFunctionsPrivate::functionsBackend(context, QOpenGLFunctions_2_1_CoreBackend::versionStatus());
- d_2_1_Core = static_cast<QOpenGLFunctions_2_1_CoreBackend*>(d);
- d->refs.ref();
-
- d = QAbstractOpenGLFunctionsPrivate::functionsBackend(context, QOpenGLFunctions_3_0_CoreBackend::versionStatus());
- d_3_0_Core = static_cast<QOpenGLFunctions_3_0_CoreBackend*>(d);
- d->refs.ref();
-
- d = QAbstractOpenGLFunctionsPrivate::functionsBackend(context, QOpenGLFunctions_3_1_CoreBackend::versionStatus());
- d_3_1_Core = static_cast<QOpenGLFunctions_3_1_CoreBackend*>(d);
- d->refs.ref();
-
- d = QAbstractOpenGLFunctionsPrivate::functionsBackend(context, QOpenGLFunctions_3_2_CoreBackend::versionStatus());
- d_3_2_Core = static_cast<QOpenGLFunctions_3_2_CoreBackend*>(d);
- d->refs.ref();
-
- d = QAbstractOpenGLFunctionsPrivate::functionsBackend(context, QOpenGLFunctions_3_3_CoreBackend::versionStatus());
- d_3_3_Core = static_cast<QOpenGLFunctions_3_3_CoreBackend*>(d);
- d->refs.ref();
-
- d = QAbstractOpenGLFunctionsPrivate::functionsBackend(context, QOpenGLFunctions_4_0_CoreBackend::versionStatus());
- d_4_0_Core = static_cast<QOpenGLFunctions_4_0_CoreBackend*>(d);
- d->refs.ref();
-
- d = QAbstractOpenGLFunctionsPrivate::functionsBackend(context, QOpenGLFunctions_4_1_CoreBackend::versionStatus());
- d_4_1_Core = static_cast<QOpenGLFunctions_4_1_CoreBackend*>(d);
- d->refs.ref();
-
- d = QAbstractOpenGLFunctionsPrivate::functionsBackend(context, QOpenGLFunctions_4_2_CoreBackend::versionStatus());
- d_4_2_Core = static_cast<QOpenGLFunctions_4_2_CoreBackend*>(d);
- d->refs.ref();
-
- d = QAbstractOpenGLFunctionsPrivate::functionsBackend(context, QOpenGLFunctions_1_0_DeprecatedBackend::versionStatus());
- d_1_0_Deprecated = static_cast<QOpenGLFunctions_1_0_DeprecatedBackend*>(d);
- d->refs.ref();
-
- d = QAbstractOpenGLFunctionsPrivate::functionsBackend(context, QOpenGLFunctions_1_1_DeprecatedBackend::versionStatus());
- d_1_1_Deprecated = static_cast<QOpenGLFunctions_1_1_DeprecatedBackend*>(d);
- d->refs.ref();
-
- d = QAbstractOpenGLFunctionsPrivate::functionsBackend(context, QOpenGLFunctions_1_2_DeprecatedBackend::versionStatus());
- d_1_2_Deprecated = static_cast<QOpenGLFunctions_1_2_DeprecatedBackend*>(d);
- d->refs.ref();
-
- d = QAbstractOpenGLFunctionsPrivate::functionsBackend(context, QOpenGLFunctions_1_3_DeprecatedBackend::versionStatus());
- d_1_3_Deprecated = static_cast<QOpenGLFunctions_1_3_DeprecatedBackend*>(d);
- d->refs.ref();
-
- d = QAbstractOpenGLFunctionsPrivate::functionsBackend(context, QOpenGLFunctions_1_4_DeprecatedBackend::versionStatus());
- d_1_4_Deprecated = static_cast<QOpenGLFunctions_1_4_DeprecatedBackend*>(d);
- d->refs.ref();
-
- d = QAbstractOpenGLFunctionsPrivate::functionsBackend(context, QOpenGLFunctions_3_3_DeprecatedBackend::versionStatus());
- d_3_3_Deprecated = static_cast<QOpenGLFunctions_3_3_DeprecatedBackend*>(d);
- d->refs.ref();
-
- QAbstractOpenGLFunctions::initializeOpenGLFunctions();
- }
- return isInitialized();
-}
-
-bool QOpenGLFunctions_4_2_Compatibility::isContextCompatible(QOpenGLContext *context)
-{
- Q_ASSERT(context);
- QSurfaceFormat f = context->format();
- const QPair<int, int> v = qMakePair(f.majorVersion(), f.minorVersion());
- if (v < qMakePair(4, 2))
- return false;
-
- if (f.profile() == QSurfaceFormat::CoreProfile)
- return false;
-
- return true;
-}
-
-QOpenGLVersionProfile QOpenGLFunctions_4_2_Compatibility::versionProfile()
-{
- QOpenGLVersionProfile v;
- v.setVersion(4, 2);
- v.setProfile(QSurfaceFormat::CompatibilityProfile);
- return v;
-}
-
-QT_END_NAMESPACE
diff --git a/src/gui/opengl/qopenglfunctions_4_2_compatibility.h b/src/gui/opengl/qopenglfunctions_4_2_compatibility.h
deleted file mode 100644
index a48d581c2d..0000000000
--- a/src/gui/opengl/qopenglfunctions_4_2_compatibility.h
+++ /dev/null
@@ -1,5647 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2013 Klaralvdalens Datakonsult AB (KDAB)
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the QtGui module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-**
-** This file was generated by glgen version 0.1
-** Command line was: glgen
-**
-** glgen is Copyright (C) 2013 Klaralvdalens Datakonsult AB (KDAB)
-**
-** This is an auto-generated file.
-** Do not edit! All changes made to it will be lost.
-**
-****************************************************************************/
-
-#ifndef QOPENGLVERSIONFUNCTIONS_4_2_COMPATIBILITY_H
-#define QOPENGLVERSIONFUNCTIONS_4_2_COMPATIBILITY_H
-
-#include <QtGui/qtguiglobal.h>
-
-#if !defined(QT_NO_OPENGL) && !defined(QT_OPENGL_ES_2)
-
-#include <QtGui/QOpenGLVersionFunctions>
-#include <QtGui/qopenglcontext.h>
-
-// MemoryBarrier is a macro on some architectures on Windows
-#ifdef Q_OS_WIN
-#pragma push_macro("MemoryBarrier")
-#undef MemoryBarrier
-#endif
-
-QT_BEGIN_NAMESPACE
-
-class Q_GUI_EXPORT QOpenGLFunctions_4_2_Compatibility : public QAbstractOpenGLFunctions
-{
-public:
- QOpenGLFunctions_4_2_Compatibility();
- ~QOpenGLFunctions_4_2_Compatibility();
-
- bool initializeOpenGLFunctions() override;
-
- // OpenGL 1.0 core functions
- void glViewport(GLint x, GLint y, GLsizei width, GLsizei height);
- void glDepthRange(GLdouble nearVal, GLdouble farVal);
- GLboolean glIsEnabled(GLenum cap);
- void glGetTexLevelParameteriv(GLenum target, GLint level, GLenum pname, GLint *params);
- void glGetTexLevelParameterfv(GLenum target, GLint level, GLenum pname, GLfloat *params);
- void glGetTexParameteriv(GLenum target, GLenum pname, GLint *params);
- void glGetTexParameterfv(GLenum target, GLenum pname, GLfloat *params);
- void glGetTexImage(GLenum target, GLint level, GLenum format, GLenum type, GLvoid *pixels);
- const GLubyte * glGetString(GLenum name);
- void glGetIntegerv(GLenum pname, GLint *params);
- void glGetFloatv(GLenum pname, GLfloat *params);
- GLenum glGetError();
- void glGetDoublev(GLenum pname, GLdouble *params);
- void glGetBooleanv(GLenum pname, GLboolean *params);
- void glReadPixels(GLint x, GLint y, GLsizei width, GLsizei height, GLenum format, GLenum type, GLvoid *pixels);
- void glReadBuffer(GLenum mode);
- void glPixelStorei(GLenum pname, GLint param);
- void glPixelStoref(GLenum pname, GLfloat param);
- void glDepthFunc(GLenum func);
- void glStencilOp(GLenum fail, GLenum zfail, GLenum zpass);
- void glStencilFunc(GLenum func, GLint ref, GLuint mask);
- void glLogicOp(GLenum opcode);
- void glBlendFunc(GLenum sfactor, GLenum dfactor);
- void glFlush();
- void glFinish();
- void glEnable(GLenum cap);
- void glDisable(GLenum cap);
- void glDepthMask(GLboolean flag);
- void glColorMask(GLboolean red, GLboolean green, GLboolean blue, GLboolean alpha);
- void glStencilMask(GLuint mask);
- void glClearDepth(GLdouble depth);
- void glClearStencil(GLint s);
- void glClearColor(GLfloat red, GLfloat green, GLfloat blue, GLfloat alpha);
- void glClear(GLbitfield mask);
- void glDrawBuffer(GLenum mode);
- void glTexImage2D(GLenum target, GLint level, GLint internalformat, GLsizei width, GLsizei height, GLint border, GLenum format, GLenum type, const GLvoid *pixels);
- void glTexImage1D(GLenum target, GLint level, GLint internalformat, GLsizei width, GLint border, GLenum format, GLenum type, const GLvoid *pixels);
- void glTexParameteriv(GLenum target, GLenum pname, const GLint *params);
- void glTexParameteri(GLenum target, GLenum pname, GLint param);
- void glTexParameterfv(GLenum target, GLenum pname, const GLfloat *params);
- void glTexParameterf(GLenum target, GLenum pname, GLfloat param);
- void glScissor(GLint x, GLint y, GLsizei width, GLsizei height);
- void glPolygonMode(GLenum face, GLenum mode);
- void glPointSize(GLfloat size);
- void glLineWidth(GLfloat width);
- void glHint(GLenum target, GLenum mode);
- void glFrontFace(GLenum mode);
- void glCullFace(GLenum mode);
-
- // OpenGL 1.1 core functions
- void glIndexubv(const GLubyte *c);
- void glIndexub(GLubyte c);
- GLboolean glIsTexture(GLuint texture);
- void glGenTextures(GLsizei n, GLuint *textures);
- void glDeleteTextures(GLsizei n, const GLuint *textures);
- void glBindTexture(GLenum target, GLuint texture);
- void glTexSubImage2D(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLenum type, const GLvoid *pixels);
- void glTexSubImage1D(GLenum target, GLint level, GLint xoffset, GLsizei width, GLenum format, GLenum type, const GLvoid *pixels);
- void glCopyTexSubImage2D(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint x, GLint y, GLsizei width, GLsizei height);
- void glCopyTexSubImage1D(GLenum target, GLint level, GLint xoffset, GLint x, GLint y, GLsizei width);
- void glCopyTexImage2D(GLenum target, GLint level, GLenum internalformat, GLint x, GLint y, GLsizei width, GLsizei height, GLint border);
- void glCopyTexImage1D(GLenum target, GLint level, GLenum internalformat, GLint x, GLint y, GLsizei width, GLint border);
- void glPolygonOffset(GLfloat factor, GLfloat units);
- void glGetPointerv(GLenum pname, GLvoid* *params);
- void glDrawElements(GLenum mode, GLsizei count, GLenum type, const GLvoid *indices);
- void glDrawArrays(GLenum mode, GLint first, GLsizei count);
-
- // OpenGL 1.2 core functions
- void glCopyTexSubImage3D(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLint x, GLint y, GLsizei width, GLsizei height);
- void glTexSubImage3D(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLenum type, const GLvoid *pixels);
- void glTexImage3D(GLenum target, GLint level, GLint internalformat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLenum format, GLenum type, const GLvoid *pixels);
- void glDrawRangeElements(GLenum mode, GLuint start, GLuint end, GLsizei count, GLenum type, const GLvoid *indices);
- void glBlendEquation(GLenum mode);
- void glBlendColor(GLfloat red, GLfloat green, GLfloat blue, GLfloat alpha);
-
- // OpenGL 1.3 core functions
- void glGetCompressedTexImage(GLenum target, GLint level, GLvoid *img);
- void glCompressedTexSubImage1D(GLenum target, GLint level, GLint xoffset, GLsizei width, GLenum format, GLsizei imageSize, const GLvoid *data);
- void glCompressedTexSubImage2D(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLsizei imageSize, const GLvoid *data);
- void glCompressedTexSubImage3D(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLsizei imageSize, const GLvoid *data);
- void glCompressedTexImage1D(GLenum target, GLint level, GLenum internalformat, GLsizei width, GLint border, GLsizei imageSize, const GLvoid *data);
- void glCompressedTexImage2D(GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLint border, GLsizei imageSize, const GLvoid *data);
- void glCompressedTexImage3D(GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLsizei imageSize, const GLvoid *data);
- void glSampleCoverage(GLfloat value, GLboolean invert);
- void glActiveTexture(GLenum texture);
-
- // OpenGL 1.4 core functions
- void glPointParameteriv(GLenum pname, const GLint *params);
- void glPointParameteri(GLenum pname, GLint param);
- void glPointParameterfv(GLenum pname, const GLfloat *params);
- void glPointParameterf(GLenum pname, GLfloat param);
- void glMultiDrawElements(GLenum mode, const GLsizei *count, GLenum type, const GLvoid* const *indices, GLsizei drawcount);
- void glMultiDrawArrays(GLenum mode, const GLint *first, const GLsizei *count, GLsizei drawcount);
- void glBlendFuncSeparate(GLenum sfactorRGB, GLenum dfactorRGB, GLenum sfactorAlpha, GLenum dfactorAlpha);
-
- // OpenGL 1.5 core functions
- void glGetBufferPointerv(GLenum target, GLenum pname, GLvoid* *params);
- void glGetBufferParameteriv(GLenum target, GLenum pname, GLint *params);
- GLboolean glUnmapBuffer(GLenum target);
- GLvoid* glMapBuffer(GLenum target, GLenum access);
- void glGetBufferSubData(GLenum target, GLintptr offset, GLsizeiptr size, GLvoid *data);
- void glBufferSubData(GLenum target, GLintptr offset, GLsizeiptr size, const GLvoid *data);
- void glBufferData(GLenum target, GLsizeiptr size, const GLvoid *data, GLenum usage);
- GLboolean glIsBuffer(GLuint buffer);
- void glGenBuffers(GLsizei n, GLuint *buffers);
- void glDeleteBuffers(GLsizei n, const GLuint *buffers);
- void glBindBuffer(GLenum target, GLuint buffer);
- void glGetQueryObjectuiv(GLuint id, GLenum pname, GLuint *params);
- void glGetQueryObjectiv(GLuint id, GLenum pname, GLint *params);
- void glGetQueryiv(GLenum target, GLenum pname, GLint *params);
- void glEndQuery(GLenum target);
- void glBeginQuery(GLenum target, GLuint id);
- GLboolean glIsQuery(GLuint id);
- void glDeleteQueries(GLsizei n, const GLuint *ids);
- void glGenQueries(GLsizei n, GLuint *ids);
-
- // OpenGL 2.0 core functions
- void glVertexAttribPointer(GLuint index, GLint size, GLenum type, GLboolean normalized, GLsizei stride, const GLvoid *pointer);
- void glValidateProgram(GLuint program);
- void glUniformMatrix4fv(GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
- void glUniformMatrix3fv(GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
- void glUniformMatrix2fv(GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
- void glUniform4iv(GLint location, GLsizei count, const GLint *value);
- void glUniform3iv(GLint location, GLsizei count, const GLint *value);
- void glUniform2iv(GLint location, GLsizei count, const GLint *value);
- void glUniform1iv(GLint location, GLsizei count, const GLint *value);
- void glUniform4fv(GLint location, GLsizei count, const GLfloat *value);
- void glUniform3fv(GLint location, GLsizei count, const GLfloat *value);
- void glUniform2fv(GLint location, GLsizei count, const GLfloat *value);
- void glUniform1fv(GLint location, GLsizei count, const GLfloat *value);
- void glUniform4i(GLint location, GLint v0, GLint v1, GLint v2, GLint v3);
- void glUniform3i(GLint location, GLint v0, GLint v1, GLint v2);
- void glUniform2i(GLint location, GLint v0, GLint v1);
- void glUniform1i(GLint location, GLint v0);
- void glUniform4f(GLint location, GLfloat v0, GLfloat v1, GLfloat v2, GLfloat v3);
- void glUniform3f(GLint location, GLfloat v0, GLfloat v1, GLfloat v2);
- void glUniform2f(GLint location, GLfloat v0, GLfloat v1);
- void glUniform1f(GLint location, GLfloat v0);
- void glUseProgram(GLuint program);
- void glShaderSource(GLuint shader, GLsizei count, const GLchar* const *string, const GLint *length);
- void glLinkProgram(GLuint program);
- GLboolean glIsShader(GLuint shader);
- GLboolean glIsProgram(GLuint program);
- void glGetVertexAttribPointerv(GLuint index, GLenum pname, GLvoid* *pointer);
- void glGetVertexAttribiv(GLuint index, GLenum pname, GLint *params);
- void glGetVertexAttribfv(GLuint index, GLenum pname, GLfloat *params);
- void glGetVertexAttribdv(GLuint index, GLenum pname, GLdouble *params);
- void glGetUniformiv(GLuint program, GLint location, GLint *params);
- void glGetUniformfv(GLuint program, GLint location, GLfloat *params);
- GLint glGetUniformLocation(GLuint program, const GLchar *name);
- void glGetShaderSource(GLuint shader, GLsizei bufSize, GLsizei *length, GLchar *source);
- void glGetShaderInfoLog(GLuint shader, GLsizei bufSize, GLsizei *length, GLchar *infoLog);
- void glGetShaderiv(GLuint shader, GLenum pname, GLint *params);
- void glGetProgramInfoLog(GLuint program, GLsizei bufSize, GLsizei *length, GLchar *infoLog);
- void glGetProgramiv(GLuint program, GLenum pname, GLint *params);
- GLint glGetAttribLocation(GLuint program, const GLchar *name);
- void glGetAttachedShaders(GLuint program, GLsizei maxCount, GLsizei *count, GLuint *obj);
- void glGetActiveUniform(GLuint program, GLuint index, GLsizei bufSize, GLsizei *length, GLint *size, GLenum *type, GLchar *name);
- void glGetActiveAttrib(GLuint program, GLuint index, GLsizei bufSize, GLsizei *length, GLint *size, GLenum *type, GLchar *name);
- void glEnableVertexAttribArray(GLuint index);
- void glDisableVertexAttribArray(GLuint index);
- void glDetachShader(GLuint program, GLuint shader);
- void glDeleteShader(GLuint shader);
- void glDeleteProgram(GLuint program);
- GLuint glCreateShader(GLenum type);
- GLuint glCreateProgram();
- void glCompileShader(GLuint shader);
- void glBindAttribLocation(GLuint program, GLuint index, const GLchar *name);
- void glAttachShader(GLuint program, GLuint shader);
- void glStencilMaskSeparate(GLenum face, GLuint mask);
- void glStencilFuncSeparate(GLenum face, GLenum func, GLint ref, GLuint mask);
- void glStencilOpSeparate(GLenum face, GLenum sfail, GLenum dpfail, GLenum dppass);
- void glDrawBuffers(GLsizei n, const GLenum *bufs);
- void glBlendEquationSeparate(GLenum modeRGB, GLenum modeAlpha);
-
- // OpenGL 2.1 core functions
- void glUniformMatrix4x3fv(GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
- void glUniformMatrix3x4fv(GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
- void glUniformMatrix4x2fv(GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
- void glUniformMatrix2x4fv(GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
- void glUniformMatrix3x2fv(GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
- void glUniformMatrix2x3fv(GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
-
- // OpenGL 3.0 core functions
- GLboolean glIsVertexArray(GLuint array);
- void glGenVertexArrays(GLsizei n, GLuint *arrays);
- void glDeleteVertexArrays(GLsizei n, const GLuint *arrays);
- void glBindVertexArray(GLuint array);
- void glFlushMappedBufferRange(GLenum target, GLintptr offset, GLsizeiptr length);
- GLvoid* glMapBufferRange(GLenum target, GLintptr offset, GLsizeiptr length, GLbitfield access);
- void glFramebufferTextureLayer(GLenum target, GLenum attachment, GLuint texture, GLint level, GLint layer);
- void glRenderbufferStorageMultisample(GLenum target, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height);
- void glBlitFramebuffer(GLint srcX0, GLint srcY0, GLint srcX1, GLint srcY1, GLint dstX0, GLint dstY0, GLint dstX1, GLint dstY1, GLbitfield mask, GLenum filter);
- void glGenerateMipmap(GLenum target);
- void glGetFramebufferAttachmentParameteriv(GLenum target, GLenum attachment, GLenum pname, GLint *params);
- void glFramebufferRenderbuffer(GLenum target, GLenum attachment, GLenum renderbuffertarget, GLuint renderbuffer);
- void glFramebufferTexture3D(GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level, GLint zoffset);
- void glFramebufferTexture2D(GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level);
- void glFramebufferTexture1D(GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level);
- GLenum glCheckFramebufferStatus(GLenum target);
- void glGenFramebuffers(GLsizei n, GLuint *framebuffers);
- void glDeleteFramebuffers(GLsizei n, const GLuint *framebuffers);
- void glBindFramebuffer(GLenum target, GLuint framebuffer);
- GLboolean glIsFramebuffer(GLuint framebuffer);
- void glGetRenderbufferParameteriv(GLenum target, GLenum pname, GLint *params);
- void glRenderbufferStorage(GLenum target, GLenum internalformat, GLsizei width, GLsizei height);
- void glGenRenderbuffers(GLsizei n, GLuint *renderbuffers);
- void glDeleteRenderbuffers(GLsizei n, const GLuint *renderbuffers);
- void glBindRenderbuffer(GLenum target, GLuint renderbuffer);
- GLboolean glIsRenderbuffer(GLuint renderbuffer);
- const GLubyte * glGetStringi(GLenum name, GLuint index);
- void glClearBufferfi(GLenum buffer, GLint drawbuffer, GLfloat depth, GLint stencil);
- void glClearBufferfv(GLenum buffer, GLint drawbuffer, const GLfloat *value);
- void glClearBufferuiv(GLenum buffer, GLint drawbuffer, const GLuint *value);
- void glClearBufferiv(GLenum buffer, GLint drawbuffer, const GLint *value);
- void glGetTexParameterIuiv(GLenum target, GLenum pname, GLuint *params);
- void glGetTexParameterIiv(GLenum target, GLenum pname, GLint *params);
- void glTexParameterIuiv(GLenum target, GLenum pname, const GLuint *params);
- void glTexParameterIiv(GLenum target, GLenum pname, const GLint *params);
- void glUniform4uiv(GLint location, GLsizei count, const GLuint *value);
- void glUniform3uiv(GLint location, GLsizei count, const GLuint *value);
- void glUniform2uiv(GLint location, GLsizei count, const GLuint *value);
- void glUniform1uiv(GLint location, GLsizei count, const GLuint *value);
- void glUniform4ui(GLint location, GLuint v0, GLuint v1, GLuint v2, GLuint v3);
- void glUniform3ui(GLint location, GLuint v0, GLuint v1, GLuint v2);
- void glUniform2ui(GLint location, GLuint v0, GLuint v1);
- void glUniform1ui(GLint location, GLuint v0);
- GLint glGetFragDataLocation(GLuint program, const GLchar *name);
- void glBindFragDataLocation(GLuint program, GLuint color, const GLchar *name);
- void glGetUniformuiv(GLuint program, GLint location, GLuint *params);
- void glGetVertexAttribIuiv(GLuint index, GLenum pname, GLuint *params);
- void glGetVertexAttribIiv(GLuint index, GLenum pname, GLint *params);
- void glVertexAttribIPointer(GLuint index, GLint size, GLenum type, GLsizei stride, const GLvoid *pointer);
- void glEndConditionalRender();
- void glBeginConditionalRender(GLuint id, GLenum mode);
- void glClampColor(GLenum target, GLenum clamp);
- void glGetTransformFeedbackVarying(GLuint program, GLuint index, GLsizei bufSize, GLsizei *length, GLsizei *size, GLenum *type, GLchar *name);
- void glTransformFeedbackVaryings(GLuint program, GLsizei count, const GLchar* const *varyings, GLenum bufferMode);
- void glBindBufferBase(GLenum target, GLuint index, GLuint buffer);
- void glBindBufferRange(GLenum target, GLuint index, GLuint buffer, GLintptr offset, GLsizeiptr size);
- void glEndTransformFeedback();
- void glBeginTransformFeedback(GLenum primitiveMode);
- GLboolean glIsEnabledi(GLenum target, GLuint index);
- void glDisablei(GLenum target, GLuint index);
- void glEnablei(GLenum target, GLuint index);
- void glGetIntegeri_v(GLenum target, GLuint index, GLint *data);
- void glGetBooleani_v(GLenum target, GLuint index, GLboolean *data);
- void glColorMaski(GLuint index, GLboolean r, GLboolean g, GLboolean b, GLboolean a);
-
- // OpenGL 3.1 core functions
- void glCopyBufferSubData(GLenum readTarget, GLenum writeTarget, GLintptr readOffset, GLintptr writeOffset, GLsizeiptr size);
- void glUniformBlockBinding(GLuint program, GLuint uniformBlockIndex, GLuint uniformBlockBinding);
- void glGetActiveUniformBlockName(GLuint program, GLuint uniformBlockIndex, GLsizei bufSize, GLsizei *length, GLchar *uniformBlockName);
- void glGetActiveUniformBlockiv(GLuint program, GLuint uniformBlockIndex, GLenum pname, GLint *params);
- GLuint glGetUniformBlockIndex(GLuint program, const GLchar *uniformBlockName);
- void glGetActiveUniformName(GLuint program, GLuint uniformIndex, GLsizei bufSize, GLsizei *length, GLchar *uniformName);
- void glGetActiveUniformsiv(GLuint program, GLsizei uniformCount, const GLuint *uniformIndices, GLenum pname, GLint *params);
- void glGetUniformIndices(GLuint program, GLsizei uniformCount, const GLchar* const *uniformNames, GLuint *uniformIndices);
- void glPrimitiveRestartIndex(GLuint index);
- void glTexBuffer(GLenum target, GLenum internalformat, GLuint buffer);
- void glDrawElementsInstanced(GLenum mode, GLsizei count, GLenum type, const GLvoid *indices, GLsizei instancecount);
- void glDrawArraysInstanced(GLenum mode, GLint first, GLsizei count, GLsizei instancecount);
-
- // OpenGL 3.2 core functions
- void glSampleMaski(GLuint index, GLbitfield mask);
- void glGetMultisamplefv(GLenum pname, GLuint index, GLfloat *val);
- void glTexImage3DMultisample(GLenum target, GLsizei samples, GLint internalformat, GLsizei width, GLsizei height, GLsizei depth, GLboolean fixedsamplelocations);
- void glTexImage2DMultisample(GLenum target, GLsizei samples, GLint internalformat, GLsizei width, GLsizei height, GLboolean fixedsamplelocations);
- void glGetSynciv(GLsync sync, GLenum pname, GLsizei bufSize, GLsizei *length, GLint *values);
- void glGetInteger64v(GLenum pname, GLint64 *params);
- void glWaitSync(GLsync sync, GLbitfield flags, GLuint64 timeout);
- GLenum glClientWaitSync(GLsync sync, GLbitfield flags, GLuint64 timeout);
- void glDeleteSync(GLsync sync);
- GLboolean glIsSync(GLsync sync);
- GLsync glFenceSync(GLenum condition, GLbitfield flags);
- void glProvokingVertex(GLenum mode);
- void glMultiDrawElementsBaseVertex(GLenum mode, const GLsizei *count, GLenum type, const GLvoid* const *indices, GLsizei drawcount, const GLint *basevertex);
- void glDrawElementsInstancedBaseVertex(GLenum mode, GLsizei count, GLenum type, const GLvoid *indices, GLsizei instancecount, GLint basevertex);
- void glDrawRangeElementsBaseVertex(GLenum mode, GLuint start, GLuint end, GLsizei count, GLenum type, const GLvoid *indices, GLint basevertex);
- void glDrawElementsBaseVertex(GLenum mode, GLsizei count, GLenum type, const GLvoid *indices, GLint basevertex);
- void glFramebufferTexture(GLenum target, GLenum attachment, GLuint texture, GLint level);
- void glGetBufferParameteri64v(GLenum target, GLenum pname, GLint64 *params);
- void glGetInteger64i_v(GLenum target, GLuint index, GLint64 *data);
-
- // OpenGL 3.3 core functions
- void glVertexAttribP4uiv(GLuint index, GLenum type, GLboolean normalized, const GLuint *value);
- void glVertexAttribP4ui(GLuint index, GLenum type, GLboolean normalized, GLuint value);
- void glVertexAttribP3uiv(GLuint index, GLenum type, GLboolean normalized, const GLuint *value);
- void glVertexAttribP3ui(GLuint index, GLenum type, GLboolean normalized, GLuint value);
- void glVertexAttribP2uiv(GLuint index, GLenum type, GLboolean normalized, const GLuint *value);
- void glVertexAttribP2ui(GLuint index, GLenum type, GLboolean normalized, GLuint value);
- void glVertexAttribP1uiv(GLuint index, GLenum type, GLboolean normalized, const GLuint *value);
- void glVertexAttribP1ui(GLuint index, GLenum type, GLboolean normalized, GLuint value);
- void glSecondaryColorP3uiv(GLenum type, const GLuint *color);
- void glSecondaryColorP3ui(GLenum type, GLuint color);
- void glColorP4uiv(GLenum type, const GLuint *color);
- void glColorP4ui(GLenum type, GLuint color);
- void glColorP3uiv(GLenum type, const GLuint *color);
- void glColorP3ui(GLenum type, GLuint color);
- void glNormalP3uiv(GLenum type, const GLuint *coords);
- void glNormalP3ui(GLenum type, GLuint coords);
- void glMultiTexCoordP4uiv(GLenum texture, GLenum type, const GLuint *coords);
- void glMultiTexCoordP4ui(GLenum texture, GLenum type, GLuint coords);
- void glMultiTexCoordP3uiv(GLenum texture, GLenum type, const GLuint *coords);
- void glMultiTexCoordP3ui(GLenum texture, GLenum type, GLuint coords);
- void glMultiTexCoordP2uiv(GLenum texture, GLenum type, const GLuint *coords);
- void glMultiTexCoordP2ui(GLenum texture, GLenum type, GLuint coords);
- void glMultiTexCoordP1uiv(GLenum texture, GLenum type, const GLuint *coords);
- void glMultiTexCoordP1ui(GLenum texture, GLenum type, GLuint coords);
- void glTexCoordP4uiv(GLenum type, const GLuint *coords);
- void glTexCoordP4ui(GLenum type, GLuint coords);
- void glTexCoordP3uiv(GLenum type, const GLuint *coords);
- void glTexCoordP3ui(GLenum type, GLuint coords);
- void glTexCoordP2uiv(GLenum type, const GLuint *coords);
- void glTexCoordP2ui(GLenum type, GLuint coords);
- void glTexCoordP1uiv(GLenum type, const GLuint *coords);
- void glTexCoordP1ui(GLenum type, GLuint coords);
- void glVertexP4uiv(GLenum type, const GLuint *value);
- void glVertexP4ui(GLenum type, GLuint value);
- void glVertexP3uiv(GLenum type, const GLuint *value);
- void glVertexP3ui(GLenum type, GLuint value);
- void glVertexP2uiv(GLenum type, const GLuint *value);
- void glVertexP2ui(GLenum type, GLuint value);
- void glGetQueryObjectui64v(GLuint id, GLenum pname, GLuint64 *params);
- void glGetQueryObjecti64v(GLuint id, GLenum pname, GLint64 *params);
- void glQueryCounter(GLuint id, GLenum target);
- void glGetSamplerParameterIuiv(GLuint sampler, GLenum pname, GLuint *params);
- void glGetSamplerParameterfv(GLuint sampler, GLenum pname, GLfloat *params);
- void glGetSamplerParameterIiv(GLuint sampler, GLenum pname, GLint *params);
- void glGetSamplerParameteriv(GLuint sampler, GLenum pname, GLint *params);
- void glSamplerParameterIuiv(GLuint sampler, GLenum pname, const GLuint *param);
- void glSamplerParameterIiv(GLuint sampler, GLenum pname, const GLint *param);
- void glSamplerParameterfv(GLuint sampler, GLenum pname, const GLfloat *param);
- void glSamplerParameterf(GLuint sampler, GLenum pname, GLfloat param);
- void glSamplerParameteriv(GLuint sampler, GLenum pname, const GLint *param);
- void glSamplerParameteri(GLuint sampler, GLenum pname, GLint param);
- void glBindSampler(GLuint unit, GLuint sampler);
- GLboolean glIsSampler(GLuint sampler);
- void glDeleteSamplers(GLsizei count, const GLuint *samplers);
- void glGenSamplers(GLsizei count, GLuint *samplers);
- GLint glGetFragDataIndex(GLuint program, const GLchar *name);
- void glBindFragDataLocationIndexed(GLuint program, GLuint colorNumber, GLuint index, const GLchar *name);
- void glVertexAttribDivisor(GLuint index, GLuint divisor);
-
- // OpenGL 4.0 core functions
- void glGetQueryIndexediv(GLenum target, GLuint index, GLenum pname, GLint *params);
- void glEndQueryIndexed(GLenum target, GLuint index);
- void glBeginQueryIndexed(GLenum target, GLuint index, GLuint id);
- void glDrawTransformFeedbackStream(GLenum mode, GLuint id, GLuint stream);
- void glDrawTransformFeedback(GLenum mode, GLuint id);
- void glResumeTransformFeedback();
- void glPauseTransformFeedback();
- GLboolean glIsTransformFeedback(GLuint id);
- void glGenTransformFeedbacks(GLsizei n, GLuint *ids);
- void glDeleteTransformFeedbacks(GLsizei n, const GLuint *ids);
- void glBindTransformFeedback(GLenum target, GLuint id);
- void glPatchParameterfv(GLenum pname, const GLfloat *values);
- void glPatchParameteri(GLenum pname, GLint value);
- void glGetProgramStageiv(GLuint program, GLenum shadertype, GLenum pname, GLint *values);
- void glGetUniformSubroutineuiv(GLenum shadertype, GLint location, GLuint *params);
- void glUniformSubroutinesuiv(GLenum shadertype, GLsizei count, const GLuint *indices);
- void glGetActiveSubroutineName(GLuint program, GLenum shadertype, GLuint index, GLsizei bufsize, GLsizei *length, GLchar *name);
- void glGetActiveSubroutineUniformName(GLuint program, GLenum shadertype, GLuint index, GLsizei bufsize, GLsizei *length, GLchar *name);
- void glGetActiveSubroutineUniformiv(GLuint program, GLenum shadertype, GLuint index, GLenum pname, GLint *values);
- GLuint glGetSubroutineIndex(GLuint program, GLenum shadertype, const GLchar *name);
- GLint glGetSubroutineUniformLocation(GLuint program, GLenum shadertype, const GLchar *name);
- void glGetUniformdv(GLuint program, GLint location, GLdouble *params);
- void glUniformMatrix4x3dv(GLint location, GLsizei count, GLboolean transpose, const GLdouble *value);
- void glUniformMatrix4x2dv(GLint location, GLsizei count, GLboolean transpose, const GLdouble *value);
- void glUniformMatrix3x4dv(GLint location, GLsizei count, GLboolean transpose, const GLdouble *value);
- void glUniformMatrix3x2dv(GLint location, GLsizei count, GLboolean transpose, const GLdouble *value);
- void glUniformMatrix2x4dv(GLint location, GLsizei count, GLboolean transpose, const GLdouble *value);
- void glUniformMatrix2x3dv(GLint location, GLsizei count, GLboolean transpose, const GLdouble *value);
- void glUniformMatrix4dv(GLint location, GLsizei count, GLboolean transpose, const GLdouble *value);
- void glUniformMatrix3dv(GLint location, GLsizei count, GLboolean transpose, const GLdouble *value);
- void glUniformMatrix2dv(GLint location, GLsizei count, GLboolean transpose, const GLdouble *value);
- void glUniform4dv(GLint location, GLsizei count, const GLdouble *value);
- void glUniform3dv(GLint location, GLsizei count, const GLdouble *value);
- void glUniform2dv(GLint location, GLsizei count, const GLdouble *value);
- void glUniform1dv(GLint location, GLsizei count, const GLdouble *value);
- void glUniform4d(GLint location, GLdouble x, GLdouble y, GLdouble z, GLdouble w);
- void glUniform3d(GLint location, GLdouble x, GLdouble y, GLdouble z);
- void glUniform2d(GLint location, GLdouble x, GLdouble y);
- void glUniform1d(GLint location, GLdouble x);
- void glDrawElementsIndirect(GLenum mode, GLenum type, const GLvoid *indirect);
- void glDrawArraysIndirect(GLenum mode, const GLvoid *indirect);
- void glBlendFuncSeparatei(GLuint buf, GLenum srcRGB, GLenum dstRGB, GLenum srcAlpha, GLenum dstAlpha);
- void glBlendFunci(GLuint buf, GLenum src, GLenum dst);
- void glBlendEquationSeparatei(GLuint buf, GLenum modeRGB, GLenum modeAlpha);
- void glBlendEquationi(GLuint buf, GLenum mode);
- void glMinSampleShading(GLfloat value);
-
- // OpenGL 4.1 core functions
- void glGetDoublei_v(GLenum target, GLuint index, GLdouble *data);
- void glGetFloati_v(GLenum target, GLuint index, GLfloat *data);
- void glDepthRangeIndexed(GLuint index, GLdouble n, GLdouble f);
- void glDepthRangeArrayv(GLuint first, GLsizei count, const GLdouble *v);
- void glScissorIndexedv(GLuint index, const GLint *v);
- void glScissorIndexed(GLuint index, GLint left, GLint bottom, GLsizei width, GLsizei height);
- void glScissorArrayv(GLuint first, GLsizei count, const GLint *v);
- void glViewportIndexedfv(GLuint index, const GLfloat *v);
- void glViewportIndexedf(GLuint index, GLfloat x, GLfloat y, GLfloat w, GLfloat h);
- void glViewportArrayv(GLuint first, GLsizei count, const GLfloat *v);
- void glGetVertexAttribLdv(GLuint index, GLenum pname, GLdouble *params);
- void glVertexAttribLPointer(GLuint index, GLint size, GLenum type, GLsizei stride, const GLvoid *pointer);
- void glVertexAttribL4dv(GLuint index, const GLdouble *v);
- void glVertexAttribL3dv(GLuint index, const GLdouble *v);
- void glVertexAttribL2dv(GLuint index, const GLdouble *v);
- void glVertexAttribL1dv(GLuint index, const GLdouble *v);
- void glVertexAttribL4d(GLuint index, GLdouble x, GLdouble y, GLdouble z, GLdouble w);
- void glVertexAttribL3d(GLuint index, GLdouble x, GLdouble y, GLdouble z);
- void glVertexAttribL2d(GLuint index, GLdouble x, GLdouble y);
- void glVertexAttribL1d(GLuint index, GLdouble x);
- void glGetProgramPipelineInfoLog(GLuint pipeline, GLsizei bufSize, GLsizei *length, GLchar *infoLog);
- void glValidateProgramPipeline(GLuint pipeline);
- void glProgramUniformMatrix4x3dv(GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLdouble *value);
- void glProgramUniformMatrix3x4dv(GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLdouble *value);
- void glProgramUniformMatrix4x2dv(GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLdouble *value);
- void glProgramUniformMatrix2x4dv(GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLdouble *value);
- void glProgramUniformMatrix3x2dv(GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLdouble *value);
- void glProgramUniformMatrix2x3dv(GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLdouble *value);
- void glProgramUniformMatrix4x3fv(GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
- void glProgramUniformMatrix3x4fv(GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
- void glProgramUniformMatrix4x2fv(GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
- void glProgramUniformMatrix2x4fv(GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
- void glProgramUniformMatrix3x2fv(GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
- void glProgramUniformMatrix2x3fv(GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
- void glProgramUniformMatrix4dv(GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLdouble *value);
- void glProgramUniformMatrix3dv(GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLdouble *value);
- void glProgramUniformMatrix2dv(GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLdouble *value);
- void glProgramUniformMatrix4fv(GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
- void glProgramUniformMatrix3fv(GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
- void glProgramUniformMatrix2fv(GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
- void glProgramUniform4uiv(GLuint program, GLint location, GLsizei count, const GLuint *value);
- void glProgramUniform4ui(GLuint program, GLint location, GLuint v0, GLuint v1, GLuint v2, GLuint v3);
- void glProgramUniform4dv(GLuint program, GLint location, GLsizei count, const GLdouble *value);
- void glProgramUniform4d(GLuint program, GLint location, GLdouble v0, GLdouble v1, GLdouble v2, GLdouble v3);
- void glProgramUniform4fv(GLuint program, GLint location, GLsizei count, const GLfloat *value);
- void glProgramUniform4f(GLuint program, GLint location, GLfloat v0, GLfloat v1, GLfloat v2, GLfloat v3);
- void glProgramUniform4iv(GLuint program, GLint location, GLsizei count, const GLint *value);
- void glProgramUniform4i(GLuint program, GLint location, GLint v0, GLint v1, GLint v2, GLint v3);
- void glProgramUniform3uiv(GLuint program, GLint location, GLsizei count, const GLuint *value);
- void glProgramUniform3ui(GLuint program, GLint location, GLuint v0, GLuint v1, GLuint v2);
- void glProgramUniform3dv(GLuint program, GLint location, GLsizei count, const GLdouble *value);
- void glProgramUniform3d(GLuint program, GLint location, GLdouble v0, GLdouble v1, GLdouble v2);
- void glProgramUniform3fv(GLuint program, GLint location, GLsizei count, const GLfloat *value);
- void glProgramUniform3f(GLuint program, GLint location, GLfloat v0, GLfloat v1, GLfloat v2);
- void glProgramUniform3iv(GLuint program, GLint location, GLsizei count, const GLint *value);
- void glProgramUniform3i(GLuint program, GLint location, GLint v0, GLint v1, GLint v2);
- void glProgramUniform2uiv(GLuint program, GLint location, GLsizei count, const GLuint *value);
- void glProgramUniform2ui(GLuint program, GLint location, GLuint v0, GLuint v1);
- void glProgramUniform2dv(GLuint program, GLint location, GLsizei count, const GLdouble *value);
- void glProgramUniform2d(GLuint program, GLint location, GLdouble v0, GLdouble v1);
- void glProgramUniform2fv(GLuint program, GLint location, GLsizei count, const GLfloat *value);
- void glProgramUniform2f(GLuint program, GLint location, GLfloat v0, GLfloat v1);
- void glProgramUniform2iv(GLuint program, GLint location, GLsizei count, const GLint *value);
- void glProgramUniform2i(GLuint program, GLint location, GLint v0, GLint v1);
- void glProgramUniform1uiv(GLuint program, GLint location, GLsizei count, const GLuint *value);
- void glProgramUniform1ui(GLuint program, GLint location, GLuint v0);
- void glProgramUniform1dv(GLuint program, GLint location, GLsizei count, const GLdouble *value);
- void glProgramUniform1d(GLuint program, GLint location, GLdouble v0);
- void glProgramUniform1fv(GLuint program, GLint location, GLsizei count, const GLfloat *value);
- void glProgramUniform1f(GLuint program, GLint location, GLfloat v0);
- void glProgramUniform1iv(GLuint program, GLint location, GLsizei count, const GLint *value);
- void glProgramUniform1i(GLuint program, GLint location, GLint v0);
- void glGetProgramPipelineiv(GLuint pipeline, GLenum pname, GLint *params);
- GLboolean glIsProgramPipeline(GLuint pipeline);
- void glGenProgramPipelines(GLsizei n, GLuint *pipelines);
- void glDeleteProgramPipelines(GLsizei n, const GLuint *pipelines);
- void glBindProgramPipeline(GLuint pipeline);
- GLuint glCreateShaderProgramv(GLenum type, GLsizei count, const GLchar* const *strings);
- void glActiveShaderProgram(GLuint pipeline, GLuint program);
- void glUseProgramStages(GLuint pipeline, GLbitfield stages, GLuint program);
- void glProgramParameteri(GLuint program, GLenum pname, GLint value);
- void glProgramBinary(GLuint program, GLenum binaryFormat, const GLvoid *binary, GLsizei length);
- void glGetProgramBinary(GLuint program, GLsizei bufSize, GLsizei *length, GLenum *binaryFormat, GLvoid *binary);
- void glClearDepthf(GLfloat dd);
- void glDepthRangef(GLfloat n, GLfloat f);
- void glGetShaderPrecisionFormat(GLenum shadertype, GLenum precisiontype, GLint *range, GLint *precision);
- void glShaderBinary(GLsizei count, const GLuint *shaders, GLenum binaryformat, const GLvoid *binary, GLsizei length);
- void glReleaseShaderCompiler();
-
- // OpenGL 4.2 core functions
- void glTexStorage3D(GLenum target, GLsizei levels, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth);
- void glTexStorage2D(GLenum target, GLsizei levels, GLenum internalformat, GLsizei width, GLsizei height);
- void glTexStorage1D(GLenum target, GLsizei levels, GLenum internalformat, GLsizei width);
- void glMemoryBarrier(GLbitfield barriers);
- void glBindImageTexture(GLuint unit, GLuint texture, GLint level, GLboolean layered, GLint layer, GLenum access, GLenum format);
- void glGetActiveAtomicCounterBufferiv(GLuint program, GLuint bufferIndex, GLenum pname, GLint *params);
- void glGetInternalformativ(GLenum target, GLenum internalformat, GLenum pname, GLsizei bufSize, GLint *params);
- void glDrawTransformFeedbackStreamInstanced(GLenum mode, GLuint id, GLuint stream, GLsizei instancecount);
- void glDrawTransformFeedbackInstanced(GLenum mode, GLuint id, GLsizei instancecount);
- void glDrawElementsInstancedBaseVertexBaseInstance(GLenum mode, GLsizei count, GLenum type, const void *indices, GLsizei instancecount, GLint basevertex, GLuint baseinstance);
- void glDrawElementsInstancedBaseInstance(GLenum mode, GLsizei count, GLenum type, const void *indices, GLsizei instancecount, GLuint baseinstance);
- void glDrawArraysInstancedBaseInstance(GLenum mode, GLint first, GLsizei count, GLsizei instancecount, GLuint baseinstance);
-
- // OpenGL 1.0 deprecated functions
- void glTranslatef(GLfloat x, GLfloat y, GLfloat z);
- void glTranslated(GLdouble x, GLdouble y, GLdouble z);
- void glScalef(GLfloat x, GLfloat y, GLfloat z);
- void glScaled(GLdouble x, GLdouble y, GLdouble z);
- void glRotatef(GLfloat angle, GLfloat x, GLfloat y, GLfloat z);
- void glRotated(GLdouble angle, GLdouble x, GLdouble y, GLdouble z);
- void glPushMatrix();
- void glPopMatrix();
- void glOrtho(GLdouble left, GLdouble right, GLdouble bottom, GLdouble top, GLdouble zNear, GLdouble zFar);
- void glMultMatrixd(const GLdouble *m);
- void glMultMatrixf(const GLfloat *m);
- void glMatrixMode(GLenum mode);
- void glLoadMatrixd(const GLdouble *m);
- void glLoadMatrixf(const GLfloat *m);
- void glLoadIdentity();
- void glFrustum(GLdouble left, GLdouble right, GLdouble bottom, GLdouble top, GLdouble zNear, GLdouble zFar);
- GLboolean glIsList(GLuint list);
- void glGetTexGeniv(GLenum coord, GLenum pname, GLint *params);
- void glGetTexGenfv(GLenum coord, GLenum pname, GLfloat *params);
- void glGetTexGendv(GLenum coord, GLenum pname, GLdouble *params);
- void glGetTexEnviv(GLenum target, GLenum pname, GLint *params);
- void glGetTexEnvfv(GLenum target, GLenum pname, GLfloat *params);
- void glGetPolygonStipple(GLubyte *mask);
- void glGetPixelMapusv(GLenum map, GLushort *values);
- void glGetPixelMapuiv(GLenum map, GLuint *values);
- void glGetPixelMapfv(GLenum map, GLfloat *values);
- void glGetMaterialiv(GLenum face, GLenum pname, GLint *params);
- void glGetMaterialfv(GLenum face, GLenum pname, GLfloat *params);
- void glGetMapiv(GLenum target, GLenum query, GLint *v);
- void glGetMapfv(GLenum target, GLenum query, GLfloat *v);
- void glGetMapdv(GLenum target, GLenum query, GLdouble *v);
- void glGetLightiv(GLenum light, GLenum pname, GLint *params);
- void glGetLightfv(GLenum light, GLenum pname, GLfloat *params);
- void glGetClipPlane(GLenum plane, GLdouble *equation);
- void glDrawPixels(GLsizei width, GLsizei height, GLenum format, GLenum type, const GLvoid *pixels);
- void glCopyPixels(GLint x, GLint y, GLsizei width, GLsizei height, GLenum type);
- void glPixelMapusv(GLenum map, GLint mapsize, const GLushort *values);
- void glPixelMapuiv(GLenum map, GLint mapsize, const GLuint *values);
- void glPixelMapfv(GLenum map, GLint mapsize, const GLfloat *values);
- void glPixelTransferi(GLenum pname, GLint param);
- void glPixelTransferf(GLenum pname, GLfloat param);
- void glPixelZoom(GLfloat xfactor, GLfloat yfactor);
- void glAlphaFunc(GLenum func, GLfloat ref);
- void glEvalPoint2(GLint i, GLint j);
- void glEvalMesh2(GLenum mode, GLint i1, GLint i2, GLint j1, GLint j2);
- void glEvalPoint1(GLint i);
- void glEvalMesh1(GLenum mode, GLint i1, GLint i2);
- void glEvalCoord2fv(const GLfloat *u);
- void glEvalCoord2f(GLfloat u, GLfloat v);
- void glEvalCoord2dv(const GLdouble *u);
- void glEvalCoord2d(GLdouble u, GLdouble v);
- void glEvalCoord1fv(const GLfloat *u);
- void glEvalCoord1f(GLfloat u);
- void glEvalCoord1dv(const GLdouble *u);
- void glEvalCoord1d(GLdouble u);
- void glMapGrid2f(GLint un, GLfloat u1, GLfloat u2, GLint vn, GLfloat v1, GLfloat v2);
- void glMapGrid2d(GLint un, GLdouble u1, GLdouble u2, GLint vn, GLdouble v1, GLdouble v2);
- void glMapGrid1f(GLint un, GLfloat u1, GLfloat u2);
- void glMapGrid1d(GLint un, GLdouble u1, GLdouble u2);
- void glMap2f(GLenum target, GLfloat u1, GLfloat u2, GLint ustride, GLint uorder, GLfloat v1, GLfloat v2, GLint vstride, GLint vorder, const GLfloat *points);
- void glMap2d(GLenum target, GLdouble u1, GLdouble u2, GLint ustride, GLint uorder, GLdouble v1, GLdouble v2, GLint vstride, GLint vorder, const GLdouble *points);
- void glMap1f(GLenum target, GLfloat u1, GLfloat u2, GLint stride, GLint order, const GLfloat *points);
- void glMap1d(GLenum target, GLdouble u1, GLdouble u2, GLint stride, GLint order, const GLdouble *points);
- void glPushAttrib(GLbitfield mask);
- void glPopAttrib();
- void glAccum(GLenum op, GLfloat value);
- void glIndexMask(GLuint mask);
- void glClearIndex(GLfloat c);
- void glClearAccum(GLfloat red, GLfloat green, GLfloat blue, GLfloat alpha);
- void glPushName(GLuint name);
- void glPopName();
- void glPassThrough(GLfloat token);
- void glLoadName(GLuint name);
- void glInitNames();
- GLint glRenderMode(GLenum mode);
- void glSelectBuffer(GLsizei size, GLuint *buffer);
- void glFeedbackBuffer(GLsizei size, GLenum type, GLfloat *buffer);
- void glTexGeniv(GLenum coord, GLenum pname, const GLint *params);
- void glTexGeni(GLenum coord, GLenum pname, GLint param);
- void glTexGenfv(GLenum coord, GLenum pname, const GLfloat *params);
- void glTexGenf(GLenum coord, GLenum pname, GLfloat param);
- void glTexGendv(GLenum coord, GLenum pname, const GLdouble *params);
- void glTexGend(GLenum coord, GLenum pname, GLdouble param);
- void glTexEnviv(GLenum target, GLenum pname, const GLint *params);
- void glTexEnvi(GLenum target, GLenum pname, GLint param);
- void glTexEnvfv(GLenum target, GLenum pname, const GLfloat *params);
- void glTexEnvf(GLenum target, GLenum pname, GLfloat param);
- void glShadeModel(GLenum mode);
- void glPolygonStipple(const GLubyte *mask);
- void glMaterialiv(GLenum face, GLenum pname, const GLint *params);
- void glMateriali(GLenum face, GLenum pname, GLint param);
- void glMaterialfv(GLenum face, GLenum pname, const GLfloat *params);
- void glMaterialf(GLenum face, GLenum pname, GLfloat param);
- void glLineStipple(GLint factor, GLushort pattern);
- void glLightModeliv(GLenum pname, const GLint *params);
- void glLightModeli(GLenum pname, GLint param);
- void glLightModelfv(GLenum pname, const GLfloat *params);
- void glLightModelf(GLenum pname, GLfloat param);
- void glLightiv(GLenum light, GLenum pname, const GLint *params);
- void glLighti(GLenum light, GLenum pname, GLint param);
- void glLightfv(GLenum light, GLenum pname, const GLfloat *params);
- void glLightf(GLenum light, GLenum pname, GLfloat param);
- void glFogiv(GLenum pname, const GLint *params);
- void glFogi(GLenum pname, GLint param);
- void glFogfv(GLenum pname, const GLfloat *params);
- void glFogf(GLenum pname, GLfloat param);
- void glColorMaterial(GLenum face, GLenum mode);
- void glClipPlane(GLenum plane, const GLdouble *equation);
- void glVertex4sv(const GLshort *v);
- void glVertex4s(GLshort x, GLshort y, GLshort z, GLshort w);
- void glVertex4iv(const GLint *v);
- void glVertex4i(GLint x, GLint y, GLint z, GLint w);
- void glVertex4fv(const GLfloat *v);
- void glVertex4f(GLfloat x, GLfloat y, GLfloat z, GLfloat w);
- void glVertex4dv(const GLdouble *v);
- void glVertex4d(GLdouble x, GLdouble y, GLdouble z, GLdouble w);
- void glVertex3sv(const GLshort *v);
- void glVertex3s(GLshort x, GLshort y, GLshort z);
- void glVertex3iv(const GLint *v);
- void glVertex3i(GLint x, GLint y, GLint z);
- void glVertex3fv(const GLfloat *v);
- void glVertex3f(GLfloat x, GLfloat y, GLfloat z);
- void glVertex3dv(const GLdouble *v);
- void glVertex3d(GLdouble x, GLdouble y, GLdouble z);
- void glVertex2sv(const GLshort *v);
- void glVertex2s(GLshort x, GLshort y);
- void glVertex2iv(const GLint *v);
- void glVertex2i(GLint x, GLint y);
- void glVertex2fv(const GLfloat *v);
- void glVertex2f(GLfloat x, GLfloat y);
- void glVertex2dv(const GLdouble *v);
- void glVertex2d(GLdouble x, GLdouble y);
- void glTexCoord4sv(const GLshort *v);
- void glTexCoord4s(GLshort s, GLshort t, GLshort r, GLshort q);
- void glTexCoord4iv(const GLint *v);
- void glTexCoord4i(GLint s, GLint t, GLint r, GLint q);
- void glTexCoord4fv(const GLfloat *v);
- void glTexCoord4f(GLfloat s, GLfloat t, GLfloat r, GLfloat q);
- void glTexCoord4dv(const GLdouble *v);
- void glTexCoord4d(GLdouble s, GLdouble t, GLdouble r, GLdouble q);
- void glTexCoord3sv(const GLshort *v);
- void glTexCoord3s(GLshort s, GLshort t, GLshort r);
- void glTexCoord3iv(const GLint *v);
- void glTexCoord3i(GLint s, GLint t, GLint r);
- void glTexCoord3fv(const GLfloat *v);
- void glTexCoord3f(GLfloat s, GLfloat t, GLfloat r);
- void glTexCoord3dv(const GLdouble *v);
- void glTexCoord3d(GLdouble s, GLdouble t, GLdouble r);
- void glTexCoord2sv(const GLshort *v);
- void glTexCoord2s(GLshort s, GLshort t);
- void glTexCoord2iv(const GLint *v);
- void glTexCoord2i(GLint s, GLint t);
- void glTexCoord2fv(const GLfloat *v);
- void glTexCoord2f(GLfloat s, GLfloat t);
- void glTexCoord2dv(const GLdouble *v);
- void glTexCoord2d(GLdouble s, GLdouble t);
- void glTexCoord1sv(const GLshort *v);
- void glTexCoord1s(GLshort s);
- void glTexCoord1iv(const GLint *v);
- void glTexCoord1i(GLint s);
- void glTexCoord1fv(const GLfloat *v);
- void glTexCoord1f(GLfloat s);
- void glTexCoord1dv(const GLdouble *v);
- void glTexCoord1d(GLdouble s);
- void glRectsv(const GLshort *v1, const GLshort *v2);
- void glRects(GLshort x1, GLshort y1, GLshort x2, GLshort y2);
- void glRectiv(const GLint *v1, const GLint *v2);
- void glRecti(GLint x1, GLint y1, GLint x2, GLint y2);
- void glRectfv(const GLfloat *v1, const GLfloat *v2);
- void glRectf(GLfloat x1, GLfloat y1, GLfloat x2, GLfloat y2);
- void glRectdv(const GLdouble *v1, const GLdouble *v2);
- void glRectd(GLdouble x1, GLdouble y1, GLdouble x2, GLdouble y2);
- void glRasterPos4sv(const GLshort *v);
- void glRasterPos4s(GLshort x, GLshort y, GLshort z, GLshort w);
- void glRasterPos4iv(const GLint *v);
- void glRasterPos4i(GLint x, GLint y, GLint z, GLint w);
- void glRasterPos4fv(const GLfloat *v);
- void glRasterPos4f(GLfloat x, GLfloat y, GLfloat z, GLfloat w);
- void glRasterPos4dv(const GLdouble *v);
- void glRasterPos4d(GLdouble x, GLdouble y, GLdouble z, GLdouble w);
- void glRasterPos3sv(const GLshort *v);
- void glRasterPos3s(GLshort x, GLshort y, GLshort z);
- void glRasterPos3iv(const GLint *v);
- void glRasterPos3i(GLint x, GLint y, GLint z);
- void glRasterPos3fv(const GLfloat *v);
- void glRasterPos3f(GLfloat x, GLfloat y, GLfloat z);
- void glRasterPos3dv(const GLdouble *v);
- void glRasterPos3d(GLdouble x, GLdouble y, GLdouble z);
- void glRasterPos2sv(const GLshort *v);
- void glRasterPos2s(GLshort x, GLshort y);
- void glRasterPos2iv(const GLint *v);
- void glRasterPos2i(GLint x, GLint y);
- void glRasterPos2fv(const GLfloat *v);
- void glRasterPos2f(GLfloat x, GLfloat y);
- void glRasterPos2dv(const GLdouble *v);
- void glRasterPos2d(GLdouble x, GLdouble y);
- void glNormal3sv(const GLshort *v);
- void glNormal3s(GLshort nx, GLshort ny, GLshort nz);
- void glNormal3iv(const GLint *v);
- void glNormal3i(GLint nx, GLint ny, GLint nz);
- void glNormal3fv(const GLfloat *v);
- void glNormal3f(GLfloat nx, GLfloat ny, GLfloat nz);
- void glNormal3dv(const GLdouble *v);
- void glNormal3d(GLdouble nx, GLdouble ny, GLdouble nz);
- void glNormal3bv(const GLbyte *v);
- void glNormal3b(GLbyte nx, GLbyte ny, GLbyte nz);
- void glIndexsv(const GLshort *c);
- void glIndexs(GLshort c);
- void glIndexiv(const GLint *c);
- void glIndexi(GLint c);
- void glIndexfv(const GLfloat *c);
- void glIndexf(GLfloat c);
- void glIndexdv(const GLdouble *c);
- void glIndexd(GLdouble c);
- void glEnd();
- void glEdgeFlagv(const GLboolean *flag);
- void glEdgeFlag(GLboolean flag);
- void glColor4usv(const GLushort *v);
- void glColor4us(GLushort red, GLushort green, GLushort blue, GLushort alpha);
- void glColor4uiv(const GLuint *v);
- void glColor4ui(GLuint red, GLuint green, GLuint blue, GLuint alpha);
- void glColor4ubv(const GLubyte *v);
- void glColor4ub(GLubyte red, GLubyte green, GLubyte blue, GLubyte alpha);
- void glColor4sv(const GLshort *v);
- void glColor4s(GLshort red, GLshort green, GLshort blue, GLshort alpha);
- void glColor4iv(const GLint *v);
- void glColor4i(GLint red, GLint green, GLint blue, GLint alpha);
- void glColor4fv(const GLfloat *v);
- void glColor4f(GLfloat red, GLfloat green, GLfloat blue, GLfloat alpha);
- void glColor4dv(const GLdouble *v);
- void glColor4d(GLdouble red, GLdouble green, GLdouble blue, GLdouble alpha);
- void glColor4bv(const GLbyte *v);
- void glColor4b(GLbyte red, GLbyte green, GLbyte blue, GLbyte alpha);
- void glColor3usv(const GLushort *v);
- void glColor3us(GLushort red, GLushort green, GLushort blue);
- void glColor3uiv(const GLuint *v);
- void glColor3ui(GLuint red, GLuint green, GLuint blue);
- void glColor3ubv(const GLubyte *v);
- void glColor3ub(GLubyte red, GLubyte green, GLubyte blue);
- void glColor3sv(const GLshort *v);
- void glColor3s(GLshort red, GLshort green, GLshort blue);
- void glColor3iv(const GLint *v);
- void glColor3i(GLint red, GLint green, GLint blue);
- void glColor3fv(const GLfloat *v);
- void glColor3f(GLfloat red, GLfloat green, GLfloat blue);
- void glColor3dv(const GLdouble *v);
- void glColor3d(GLdouble red, GLdouble green, GLdouble blue);
- void glColor3bv(const GLbyte *v);
- void glColor3b(GLbyte red, GLbyte green, GLbyte blue);
- void glBitmap(GLsizei width, GLsizei height, GLfloat xorig, GLfloat yorig, GLfloat xmove, GLfloat ymove, const GLubyte *bitmap);
- void glBegin(GLenum mode);
- void glListBase(GLuint base);
- GLuint glGenLists(GLsizei range);
- void glDeleteLists(GLuint list, GLsizei range);
- void glCallLists(GLsizei n, GLenum type, const GLvoid *lists);
- void glCallList(GLuint list);
- void glEndList();
- void glNewList(GLuint list, GLenum mode);
-
- // OpenGL 1.1 deprecated functions
- void glPushClientAttrib(GLbitfield mask);
- void glPopClientAttrib();
- void glPrioritizeTextures(GLsizei n, const GLuint *textures, const GLfloat *priorities);
- GLboolean glAreTexturesResident(GLsizei n, const GLuint *textures, GLboolean *residences);
- void glVertexPointer(GLint size, GLenum type, GLsizei stride, const GLvoid *pointer);
- void glTexCoordPointer(GLint size, GLenum type, GLsizei stride, const GLvoid *pointer);
- void glNormalPointer(GLenum type, GLsizei stride, const GLvoid *pointer);
- void glInterleavedArrays(GLenum format, GLsizei stride, const GLvoid *pointer);
- void glIndexPointer(GLenum type, GLsizei stride, const GLvoid *pointer);
- void glEnableClientState(GLenum array);
- void glEdgeFlagPointer(GLsizei stride, const GLvoid *pointer);
- void glDisableClientState(GLenum array);
- void glColorPointer(GLint size, GLenum type, GLsizei stride, const GLvoid *pointer);
- void glArrayElement(GLint i);
-
- // OpenGL 1.2 deprecated functions
- void glResetMinmax(GLenum target);
- void glResetHistogram(GLenum target);
- void glMinmax(GLenum target, GLenum internalformat, GLboolean sink);
- void glHistogram(GLenum target, GLsizei width, GLenum internalformat, GLboolean sink);
- void glGetMinmaxParameteriv(GLenum target, GLenum pname, GLint *params);
- void glGetMinmaxParameterfv(GLenum target, GLenum pname, GLfloat *params);
- void glGetMinmax(GLenum target, GLboolean reset, GLenum format, GLenum type, GLvoid *values);
- void glGetHistogramParameteriv(GLenum target, GLenum pname, GLint *params);
- void glGetHistogramParameterfv(GLenum target, GLenum pname, GLfloat *params);
- void glGetHistogram(GLenum target, GLboolean reset, GLenum format, GLenum type, GLvoid *values);
- void glSeparableFilter2D(GLenum target, GLenum internalformat, GLsizei width, GLsizei height, GLenum format, GLenum type, const GLvoid *row, const GLvoid *column);
- void glGetSeparableFilter(GLenum target, GLenum format, GLenum type, GLvoid *row, GLvoid *column, GLvoid *span);
- void glGetConvolutionParameteriv(GLenum target, GLenum pname, GLint *params);
- void glGetConvolutionParameterfv(GLenum target, GLenum pname, GLfloat *params);
- void glGetConvolutionFilter(GLenum target, GLenum format, GLenum type, GLvoid *image);
- void glCopyConvolutionFilter2D(GLenum target, GLenum internalformat, GLint x, GLint y, GLsizei width, GLsizei height);
- void glCopyConvolutionFilter1D(GLenum target, GLenum internalformat, GLint x, GLint y, GLsizei width);
- void glConvolutionParameteriv(GLenum target, GLenum pname, const GLint *params);
- void glConvolutionParameteri(GLenum target, GLenum pname, GLint params);
- void glConvolutionParameterfv(GLenum target, GLenum pname, const GLfloat *params);
- void glConvolutionParameterf(GLenum target, GLenum pname, GLfloat params);
- void glConvolutionFilter2D(GLenum target, GLenum internalformat, GLsizei width, GLsizei height, GLenum format, GLenum type, const GLvoid *image);
- void glConvolutionFilter1D(GLenum target, GLenum internalformat, GLsizei width, GLenum format, GLenum type, const GLvoid *image);
- void glCopyColorSubTable(GLenum target, GLsizei start, GLint x, GLint y, GLsizei width);
- void glColorSubTable(GLenum target, GLsizei start, GLsizei count, GLenum format, GLenum type, const GLvoid *data);
- void glGetColorTableParameteriv(GLenum target, GLenum pname, GLint *params);
- void glGetColorTableParameterfv(GLenum target, GLenum pname, GLfloat *params);
- void glGetColorTable(GLenum target, GLenum format, GLenum type, GLvoid *table);
- void glCopyColorTable(GLenum target, GLenum internalformat, GLint x, GLint y, GLsizei width);
- void glColorTableParameteriv(GLenum target, GLenum pname, const GLint *params);
- void glColorTableParameterfv(GLenum target, GLenum pname, const GLfloat *params);
- void glColorTable(GLenum target, GLenum internalformat, GLsizei width, GLenum format, GLenum type, const GLvoid *table);
-
- // OpenGL 1.3 deprecated functions
- void glMultTransposeMatrixd(const GLdouble *m);
- void glMultTransposeMatrixf(const GLfloat *m);
- void glLoadTransposeMatrixd(const GLdouble *m);
- void glLoadTransposeMatrixf(const GLfloat *m);
- void glMultiTexCoord4sv(GLenum target, const GLshort *v);
- void glMultiTexCoord4s(GLenum target, GLshort s, GLshort t, GLshort r, GLshort q);
- void glMultiTexCoord4iv(GLenum target, const GLint *v);
- void glMultiTexCoord4i(GLenum target, GLint s, GLint t, GLint r, GLint q);
- void glMultiTexCoord4fv(GLenum target, const GLfloat *v);
- void glMultiTexCoord4f(GLenum target, GLfloat s, GLfloat t, GLfloat r, GLfloat q);
- void glMultiTexCoord4dv(GLenum target, const GLdouble *v);
- void glMultiTexCoord4d(GLenum target, GLdouble s, GLdouble t, GLdouble r, GLdouble q);
- void glMultiTexCoord3sv(GLenum target, const GLshort *v);
- void glMultiTexCoord3s(GLenum target, GLshort s, GLshort t, GLshort r);
- void glMultiTexCoord3iv(GLenum target, const GLint *v);
- void glMultiTexCoord3i(GLenum target, GLint s, GLint t, GLint r);
- void glMultiTexCoord3fv(GLenum target, const GLfloat *v);
- void glMultiTexCoord3f(GLenum target, GLfloat s, GLfloat t, GLfloat r);
- void glMultiTexCoord3dv(GLenum target, const GLdouble *v);
- void glMultiTexCoord3d(GLenum target, GLdouble s, GLdouble t, GLdouble r);
- void glMultiTexCoord2sv(GLenum target, const GLshort *v);
- void glMultiTexCoord2s(GLenum target, GLshort s, GLshort t);
- void glMultiTexCoord2iv(GLenum target, const GLint *v);
- void glMultiTexCoord2i(GLenum target, GLint s, GLint t);
- void glMultiTexCoord2fv(GLenum target, const GLfloat *v);
- void glMultiTexCoord2f(GLenum target, GLfloat s, GLfloat t);
- void glMultiTexCoord2dv(GLenum target, const GLdouble *v);
- void glMultiTexCoord2d(GLenum target, GLdouble s, GLdouble t);
- void glMultiTexCoord1sv(GLenum target, const GLshort *v);
- void glMultiTexCoord1s(GLenum target, GLshort s);
- void glMultiTexCoord1iv(GLenum target, const GLint *v);
- void glMultiTexCoord1i(GLenum target, GLint s);
- void glMultiTexCoord1fv(GLenum target, const GLfloat *v);
- void glMultiTexCoord1f(GLenum target, GLfloat s);
- void glMultiTexCoord1dv(GLenum target, const GLdouble *v);
- void glMultiTexCoord1d(GLenum target, GLdouble s);
- void glClientActiveTexture(GLenum texture);
-
- // OpenGL 1.4 deprecated functions
- void glWindowPos3sv(const GLshort *v);
- void glWindowPos3s(GLshort x, GLshort y, GLshort z);
- void glWindowPos3iv(const GLint *v);
- void glWindowPos3i(GLint x, GLint y, GLint z);
- void glWindowPos3fv(const GLfloat *v);
- void glWindowPos3f(GLfloat x, GLfloat y, GLfloat z);
- void glWindowPos3dv(const GLdouble *v);
- void glWindowPos3d(GLdouble x, GLdouble y, GLdouble z);
- void glWindowPos2sv(const GLshort *v);
- void glWindowPos2s(GLshort x, GLshort y);
- void glWindowPos2iv(const GLint *v);
- void glWindowPos2i(GLint x, GLint y);
- void glWindowPos2fv(const GLfloat *v);
- void glWindowPos2f(GLfloat x, GLfloat y);
- void glWindowPos2dv(const GLdouble *v);
- void glWindowPos2d(GLdouble x, GLdouble y);
- void glSecondaryColorPointer(GLint size, GLenum type, GLsizei stride, const GLvoid *pointer);
- void glSecondaryColor3usv(const GLushort *v);
- void glSecondaryColor3us(GLushort red, GLushort green, GLushort blue);
- void glSecondaryColor3uiv(const GLuint *v);
- void glSecondaryColor3ui(GLuint red, GLuint green, GLuint blue);
- void glSecondaryColor3ubv(const GLubyte *v);
- void glSecondaryColor3ub(GLubyte red, GLubyte green, GLubyte blue);
- void glSecondaryColor3sv(const GLshort *v);
- void glSecondaryColor3s(GLshort red, GLshort green, GLshort blue);
- void glSecondaryColor3iv(const GLint *v);
- void glSecondaryColor3i(GLint red, GLint green, GLint blue);
- void glSecondaryColor3fv(const GLfloat *v);
- void glSecondaryColor3f(GLfloat red, GLfloat green, GLfloat blue);
- void glSecondaryColor3dv(const GLdouble *v);
- void glSecondaryColor3d(GLdouble red, GLdouble green, GLdouble blue);
- void glSecondaryColor3bv(const GLbyte *v);
- void glSecondaryColor3b(GLbyte red, GLbyte green, GLbyte blue);
- void glFogCoordPointer(GLenum type, GLsizei stride, const GLvoid *pointer);
- void glFogCoorddv(const GLdouble *coord);
- void glFogCoordd(GLdouble coord);
- void glFogCoordfv(const GLfloat *coord);
- void glFogCoordf(GLfloat coord);
-
- // OpenGL 1.5 deprecated functions
-
- // OpenGL 2.0 deprecated functions
- void glVertexAttrib4usv(GLuint index, const GLushort *v);
- void glVertexAttrib4uiv(GLuint index, const GLuint *v);
- void glVertexAttrib4ubv(GLuint index, const GLubyte *v);
- void glVertexAttrib4sv(GLuint index, const GLshort *v);
- void glVertexAttrib4s(GLuint index, GLshort x, GLshort y, GLshort z, GLshort w);
- void glVertexAttrib4iv(GLuint index, const GLint *v);
- void glVertexAttrib4fv(GLuint index, const GLfloat *v);
- void glVertexAttrib4f(GLuint index, GLfloat x, GLfloat y, GLfloat z, GLfloat w);
- void glVertexAttrib4dv(GLuint index, const GLdouble *v);
- void glVertexAttrib4d(GLuint index, GLdouble x, GLdouble y, GLdouble z, GLdouble w);
- void glVertexAttrib4bv(GLuint index, const GLbyte *v);
- void glVertexAttrib4Nusv(GLuint index, const GLushort *v);
- void glVertexAttrib4Nuiv(GLuint index, const GLuint *v);
- void glVertexAttrib4Nubv(GLuint index, const GLubyte *v);
- void glVertexAttrib4Nub(GLuint index, GLubyte x, GLubyte y, GLubyte z, GLubyte w);
- void glVertexAttrib4Nsv(GLuint index, const GLshort *v);
- void glVertexAttrib4Niv(GLuint index, const GLint *v);
- void glVertexAttrib4Nbv(GLuint index, const GLbyte *v);
- void glVertexAttrib3sv(GLuint index, const GLshort *v);
- void glVertexAttrib3s(GLuint index, GLshort x, GLshort y, GLshort z);
- void glVertexAttrib3fv(GLuint index, const GLfloat *v);
- void glVertexAttrib3f(GLuint index, GLfloat x, GLfloat y, GLfloat z);
- void glVertexAttrib3dv(GLuint index, const GLdouble *v);
- void glVertexAttrib3d(GLuint index, GLdouble x, GLdouble y, GLdouble z);
- void glVertexAttrib2sv(GLuint index, const GLshort *v);
- void glVertexAttrib2s(GLuint index, GLshort x, GLshort y);
- void glVertexAttrib2fv(GLuint index, const GLfloat *v);
- void glVertexAttrib2f(GLuint index, GLfloat x, GLfloat y);
- void glVertexAttrib2dv(GLuint index, const GLdouble *v);
- void glVertexAttrib2d(GLuint index, GLdouble x, GLdouble y);
- void glVertexAttrib1sv(GLuint index, const GLshort *v);
- void glVertexAttrib1s(GLuint index, GLshort x);
- void glVertexAttrib1fv(GLuint index, const GLfloat *v);
- void glVertexAttrib1f(GLuint index, GLfloat x);
- void glVertexAttrib1dv(GLuint index, const GLdouble *v);
- void glVertexAttrib1d(GLuint index, GLdouble x);
-
- // OpenGL 2.1 deprecated functions
-
- // OpenGL 3.0 deprecated functions
- void glVertexAttribI4usv(GLuint index, const GLushort *v);
- void glVertexAttribI4ubv(GLuint index, const GLubyte *v);
- void glVertexAttribI4sv(GLuint index, const GLshort *v);
- void glVertexAttribI4bv(GLuint index, const GLbyte *v);
- void glVertexAttribI4uiv(GLuint index, const GLuint *v);
- void glVertexAttribI3uiv(GLuint index, const GLuint *v);
- void glVertexAttribI2uiv(GLuint index, const GLuint *v);
- void glVertexAttribI1uiv(GLuint index, const GLuint *v);
- void glVertexAttribI4iv(GLuint index, const GLint *v);
- void glVertexAttribI3iv(GLuint index, const GLint *v);
- void glVertexAttribI2iv(GLuint index, const GLint *v);
- void glVertexAttribI1iv(GLuint index, const GLint *v);
- void glVertexAttribI4ui(GLuint index, GLuint x, GLuint y, GLuint z, GLuint w);
- void glVertexAttribI3ui(GLuint index, GLuint x, GLuint y, GLuint z);
- void glVertexAttribI2ui(GLuint index, GLuint x, GLuint y);
- void glVertexAttribI1ui(GLuint index, GLuint x);
- void glVertexAttribI4i(GLuint index, GLint x, GLint y, GLint z, GLint w);
- void glVertexAttribI3i(GLuint index, GLint x, GLint y, GLint z);
- void glVertexAttribI2i(GLuint index, GLint x, GLint y);
- void glVertexAttribI1i(GLuint index, GLint x);
-
- // OpenGL 3.1 deprecated functions
-
- // OpenGL 3.2 deprecated functions
-
- // OpenGL 3.3 deprecated functions
-
- // OpenGL 4.0 deprecated functions
-
- // OpenGL 4.1 deprecated functions
-
- // OpenGL 4.2 deprecated functions
-
-private:
- friend class QOpenGLContext;
-
- static bool isContextCompatible(QOpenGLContext *context);
- static QOpenGLVersionProfile versionProfile();
-
- QOpenGLFunctions_1_0_CoreBackend* d_1_0_Core;
- QOpenGLFunctions_1_1_CoreBackend* d_1_1_Core;
- QOpenGLFunctions_1_2_CoreBackend* d_1_2_Core;
- QOpenGLFunctions_1_3_CoreBackend* d_1_3_Core;
- QOpenGLFunctions_1_4_CoreBackend* d_1_4_Core;
- QOpenGLFunctions_1_5_CoreBackend* d_1_5_Core;
- QOpenGLFunctions_2_0_CoreBackend* d_2_0_Core;
- QOpenGLFunctions_2_1_CoreBackend* d_2_1_Core;
- QOpenGLFunctions_3_0_CoreBackend* d_3_0_Core;
- QOpenGLFunctions_3_1_CoreBackend* d_3_1_Core;
- QOpenGLFunctions_3_2_CoreBackend* d_3_2_Core;
- QOpenGLFunctions_3_3_CoreBackend* d_3_3_Core;
- QOpenGLFunctions_4_0_CoreBackend* d_4_0_Core;
- QOpenGLFunctions_4_1_CoreBackend* d_4_1_Core;
- QOpenGLFunctions_4_2_CoreBackend* d_4_2_Core;
- QOpenGLFunctions_1_0_DeprecatedBackend* d_1_0_Deprecated;
- QOpenGLFunctions_1_1_DeprecatedBackend* d_1_1_Deprecated;
- QOpenGLFunctions_1_2_DeprecatedBackend* d_1_2_Deprecated;
- QOpenGLFunctions_1_3_DeprecatedBackend* d_1_3_Deprecated;
- QOpenGLFunctions_1_4_DeprecatedBackend* d_1_4_Deprecated;
- void *m_reserved_2_0_Deprecated; // To maintain BC
- QOpenGLFunctions_3_3_DeprecatedBackend* d_3_3_Deprecated;
-};
-
-// OpenGL 1.0 core functions
-inline void QOpenGLFunctions_4_2_Compatibility::glViewport(GLint x, GLint y, GLsizei width, GLsizei height)
-{
- d_1_0_Core->f.Viewport(x, y, width, height);
-}
-
-inline void QOpenGLFunctions_4_2_Compatibility::glDepthRange(GLdouble nearVal, GLdouble farVal)
-{
- d_1_0_Core->f.DepthRange(nearVal, farVal);
-}
-
-inline GLboolean QOpenGLFunctions_4_2_Compatibility::glIsEnabled(GLenum cap)
-{
- return d_1_0_Core->f.IsEnabled(cap);
-}
-
-inline void QOpenGLFunctions_4_2_Compatibility::glGetTexLevelParameteriv(GLenum target, GLint level, GLenum pname, GLint *params)
-{
- d_1_0_Core->f.GetTexLevelParameteriv(target, level, pname, params);
-}
-
-inline void QOpenGLFunctions_4_2_Compatibility::glGetTexLevelParameterfv(GLenum target, GLint level, GLenum pname, GLfloat *params)
-{
- d_1_0_Core->f.GetTexLevelParameterfv(target, level, pname, params);
-}
-
-inline void QOpenGLFunctions_4_2_Compatibility::glGetTexParameteriv(GLenum target, GLenum pname, GLint *params)
-{
- d_1_0_Core->f.GetTexParameteriv(target, pname, params);
-}
-
-inline void QOpenGLFunctions_4_2_Compatibility::glGetTexParameterfv(GLenum target, GLenum pname, GLfloat *params)
-{
- d_1_0_Core->f.GetTexParameterfv(target, pname, params);
-}
-
-inline void QOpenGLFunctions_4_2_Compatibility::glGetTexImage(GLenum target, GLint level, GLenum format, GLenum type, GLvoid *pixels)
-{
- d_1_0_Core->f.GetTexImage(target, level, format, type, pixels);
-}
-
-inline const GLubyte * QOpenGLFunctions_4_2_Compatibility::glGetString(GLenum name)
-{
- return d_1_0_Core->f.GetString(name);
-}
-
-inline void QOpenGLFunctions_4_2_Compatibility::glGetIntegerv(GLenum pname, GLint *params)
-{
- d_1_0_Core->f.GetIntegerv(pname, params);
-}
-
-inline void QOpenGLFunctions_4_2_Compatibility::glGetFloatv(GLenum pname, GLfloat *params)
-{
- d_1_0_Core->f.GetFloatv(pname, params);
-}
-
-inline GLenum QOpenGLFunctions_4_2_Compatibility::glGetError()
-{
- return d_1_0_Core->f.GetError();
-}
-
-inline void QOpenGLFunctions_4_2_Compatibility::glGetDoublev(GLenum pname, GLdouble *params)
-{
- d_1_0_Core->f.GetDoublev(pname, params);
-}
-
-inline void QOpenGLFunctions_4_2_Compatibility::glGetBooleanv(GLenum pname, GLboolean *params)
-{
- d_1_0_Core->f.GetBooleanv(pname, params);
-}
-
-inline void QOpenGLFunctions_4_2_Compatibility::glReadPixels(GLint x, GLint y, GLsizei width, GLsizei height, GLenum format, GLenum type, GLvoid *pixels)
-{
- d_1_0_Core->f.ReadPixels(x, y, width, height, format, type, pixels);
-}
-
-inline void QOpenGLFunctions_4_2_Compatibility::glReadBuffer(GLenum mode)
-{
- d_1_0_Core->f.ReadBuffer(mode);
-}
-
-inline void QOpenGLFunctions_4_2_Compatibility::glPixelStorei(GLenum pname, GLint param)
-{
- d_1_0_Core->f.PixelStorei(pname, param);
-}
-
-inline void QOpenGLFunctions_4_2_Compatibility::glPixelStoref(GLenum pname, GLfloat param)
-{
- d_1_0_Core->f.PixelStoref(pname, param);
-}
-
-inline void QOpenGLFunctions_4_2_Compatibility::glDepthFunc(GLenum func)
-{
- d_1_0_Core->f.DepthFunc(func);
-}
-
-inline void QOpenGLFunctions_4_2_Compatibility::glStencilOp(GLenum fail, GLenum zfail, GLenum zpass)
-{
- d_1_0_Core->f.StencilOp(fail, zfail, zpass);
-}
-
-inline void QOpenGLFunctions_4_2_Compatibility::glStencilFunc(GLenum func, GLint ref, GLuint mask)
-{
- d_1_0_Core->f.StencilFunc(func, ref, mask);
-}
-
-inline void QOpenGLFunctions_4_2_Compatibility::glLogicOp(GLenum opcode)
-{
- d_1_0_Core->f.LogicOp(opcode);
-}
-
-inline void QOpenGLFunctions_4_2_Compatibility::glBlendFunc(GLenum sfactor, GLenum dfactor)
-{
- d_1_0_Core->f.BlendFunc(sfactor, dfactor);
-}
-
-inline void QOpenGLFunctions_4_2_Compatibility::glFlush()
-{
- d_1_0_Core->f.Flush();
-}
-
-inline void QOpenGLFunctions_4_2_Compatibility::glFinish()
-{
- d_1_0_Core->f.Finish();
-}
-
-inline void QOpenGLFunctions_4_2_Compatibility::glEnable(GLenum cap)
-{
- d_1_0_Core->f.Enable(cap);
-}
-
-inline void QOpenGLFunctions_4_2_Compatibility::glDisable(GLenum cap)
-{
- d_1_0_Core->f.Disable(cap);
-}
-
-inline void QOpenGLFunctions_4_2_Compatibility::glDepthMask(GLboolean flag)
-{
- d_1_0_Core->f.DepthMask(flag);
-}
-
-inline void QOpenGLFunctions_4_2_Compatibility::glColorMask(GLboolean red, GLboolean green, GLboolean blue, GLboolean alpha)
-{
- d_1_0_Core->f.ColorMask(red, green, blue, alpha);
-}
-
-inline void QOpenGLFunctions_4_2_Compatibility::glStencilMask(GLuint mask)
-{
- d_1_0_Core->f.StencilMask(mask);
-}
-
-inline void QOpenGLFunctions_4_2_Compatibility::glClearDepth(GLdouble depth)
-{
- d_1_0_Core->f.ClearDepth(depth);
-}
-
-inline void QOpenGLFunctions_4_2_Compatibility::glClearStencil(GLint s)
-{
- d_1_0_Core->f.ClearStencil(s);
-}
-
-inline void QOpenGLFunctions_4_2_Compatibility::glClearColor(GLfloat red, GLfloat green, GLfloat blue, GLfloat alpha)
-{
- d_1_0_Core->f.ClearColor(red, green, blue, alpha);
-}
-
-inline void QOpenGLFunctions_4_2_Compatibility::glClear(GLbitfield mask)
-{
- d_1_0_Core->f.Clear(mask);
-}
-
-inline void QOpenGLFunctions_4_2_Compatibility::glDrawBuffer(GLenum mode)
-{
- d_1_0_Core->f.DrawBuffer(mode);
-}
-
-inline void QOpenGLFunctions_4_2_Compatibility::glTexImage2D(GLenum target, GLint level, GLint internalformat, GLsizei width, GLsizei height, GLint border, GLenum format, GLenum type, const GLvoid *pixels)
-{
- d_1_0_Core->f.TexImage2D(target, level, internalformat, width, height, border, format, type, pixels);
-}
-
-inline void QOpenGLFunctions_4_2_Compatibility::glTexImage1D(GLenum target, GLint level, GLint internalformat, GLsizei width, GLint border, GLenum format, GLenum type, const GLvoid *pixels)
-{
- d_1_0_Core->f.TexImage1D(target, level, internalformat, width, border, format, type, pixels);
-}
-
-inline void QOpenGLFunctions_4_2_Compatibility::glTexParameteriv(GLenum target, GLenum pname, const GLint *params)
-{
- d_1_0_Core->f.TexParameteriv(target, pname, params);
-}
-
-inline void QOpenGLFunctions_4_2_Compatibility::glTexParameteri(GLenum target, GLenum pname, GLint param)
-{
- d_1_0_Core->f.TexParameteri(target, pname, param);
-}
-
-inline void QOpenGLFunctions_4_2_Compatibility::glTexParameterfv(GLenum target, GLenum pname, const GLfloat *params)
-{
- d_1_0_Core->f.TexParameterfv(target, pname, params);
-}
-
-inline void QOpenGLFunctions_4_2_Compatibility::glTexParameterf(GLenum target, GLenum pname, GLfloat param)
-{
- d_1_0_Core->f.TexParameterf(target, pname, param);
-}
-
-inline void QOpenGLFunctions_4_2_Compatibility::glScissor(GLint x, GLint y, GLsizei width, GLsizei height)
-{
- d_1_0_Core->f.Scissor(x, y, width, height);
-}
-
-inline void QOpenGLFunctions_4_2_Compatibility::glPolygonMode(GLenum face, GLenum mode)
-{
- d_1_0_Core->f.PolygonMode(face, mode);
-}
-
-inline void QOpenGLFunctions_4_2_Compatibility::glPointSize(GLfloat size)
-{
- d_1_0_Core->f.PointSize(size);
-}
-
-inline void QOpenGLFunctions_4_2_Compatibility::glLineWidth(GLfloat width)
-{
- d_1_0_Core->f.LineWidth(width);
-}
-
-inline void QOpenGLFunctions_4_2_Compatibility::glHint(GLenum target, GLenum mode)
-{
- d_1_0_Core->f.Hint(target, mode);
-}
-
-inline void QOpenGLFunctions_4_2_Compatibility::glFrontFace(GLenum mode)
-{
- d_1_0_Core->f.FrontFace(mode);
-}
-
-inline void QOpenGLFunctions_4_2_Compatibility::glCullFace(GLenum mode)
-{
- d_1_0_Core->f.CullFace(mode);
-}
-
-
-// OpenGL 1.1 core functions
-inline void QOpenGLFunctions_4_2_Compatibility::glIndexubv(const GLubyte *c)
-{
- d_1_1_Deprecated->f.Indexubv(c);
-}
-
-inline void QOpenGLFunctions_4_2_Compatibility::glIndexub(GLubyte c)
-{
- d_1_1_Deprecated->f.Indexub(c);
-}
-
-inline GLboolean QOpenGLFunctions_4_2_Compatibility::glIsTexture(GLuint texture)
-{
- return d_1_1_Core->f.IsTexture(texture);
-}
-
-inline void QOpenGLFunctions_4_2_Compatibility::glGenTextures(GLsizei n, GLuint *textures)
-{
- d_1_1_Core->f.GenTextures(n, textures);
-}
-
-inline void QOpenGLFunctions_4_2_Compatibility::glDeleteTextures(GLsizei n, const GLuint *textures)
-{
- d_1_1_Core->f.DeleteTextures(n, textures);
-}
-
-inline void QOpenGLFunctions_4_2_Compatibility::glBindTexture(GLenum target, GLuint texture)
-{
- d_1_1_Core->f.BindTexture(target, texture);
-}
-
-inline void QOpenGLFunctions_4_2_Compatibility::glTexSubImage2D(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLenum type, const GLvoid *pixels)
-{
- d_1_1_Core->f.TexSubImage2D(target, level, xoffset, yoffset, width, height, format, type, pixels);
-}
-
-inline void QOpenGLFunctions_4_2_Compatibility::glTexSubImage1D(GLenum target, GLint level, GLint xoffset, GLsizei width, GLenum format, GLenum type, const GLvoid *pixels)
-{
- d_1_1_Core->f.TexSubImage1D(target, level, xoffset, width, format, type, pixels);
-}
-
-inline void QOpenGLFunctions_4_2_Compatibility::glCopyTexSubImage2D(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint x, GLint y, GLsizei width, GLsizei height)
-{
- d_1_1_Core->f.CopyTexSubImage2D(target, level, xoffset, yoffset, x, y, width, height);
-}
-
-inline void QOpenGLFunctions_4_2_Compatibility::glCopyTexSubImage1D(GLenum target, GLint level, GLint xoffset, GLint x, GLint y, GLsizei width)
-{
- d_1_1_Core->f.CopyTexSubImage1D(target, level, xoffset, x, y, width);
-}
-
-inline void QOpenGLFunctions_4_2_Compatibility::glCopyTexImage2D(GLenum target, GLint level, GLenum internalformat, GLint x, GLint y, GLsizei width, GLsizei height, GLint border)
-{
- d_1_1_Core->f.CopyTexImage2D(target, level, internalformat, x, y, width, height, border);
-}
-
-inline void QOpenGLFunctions_4_2_Compatibility::glCopyTexImage1D(GLenum target, GLint level, GLenum internalformat, GLint x, GLint y, GLsizei width, GLint border)
-{
- d_1_1_Core->f.CopyTexImage1D(target, level, internalformat, x, y, width, border);
-}
-
-inline void QOpenGLFunctions_4_2_Compatibility::glPolygonOffset(GLfloat factor, GLfloat units)
-{
- d_1_1_Core->f.PolygonOffset(factor, units);
-}
-
-inline void QOpenGLFunctions_4_2_Compatibility::glGetPointerv(GLenum pname, GLvoid* *params)
-{
- d_1_1_Deprecated->f.GetPointerv(pname, params);
-}
-
-inline void QOpenGLFunctions_4_2_Compatibility::glDrawElements(GLenum mode, GLsizei count, GLenum type, const GLvoid *indices)
-{
- d_1_1_Core->f.DrawElements(mode, count, type, indices);
-}
-
-inline void QOpenGLFunctions_4_2_Compatibility::glDrawArrays(GLenum mode, GLint first, GLsizei count)
-{
- d_1_1_Core->f.DrawArrays(mode, first, count);
-}
-
-
-// OpenGL 1.2 core functions
-inline void QOpenGLFunctions_4_2_Compatibility::glCopyTexSubImage3D(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLint x, GLint y, GLsizei width, GLsizei height)
-{
- d_1_2_Core->f.CopyTexSubImage3D(target, level, xoffset, yoffset, zoffset, x, y, width, height);
-}
-
-inline void QOpenGLFunctions_4_2_Compatibility::glTexSubImage3D(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLenum type, const GLvoid *pixels)
-{
- d_1_2_Core->f.TexSubImage3D(target, level, xoffset, yoffset, zoffset, width, height, depth, format, type, pixels);
-}
-
-inline void QOpenGLFunctions_4_2_Compatibility::glTexImage3D(GLenum target, GLint level, GLint internalformat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLenum format, GLenum type, const GLvoid *pixels)
-{
- d_1_2_Core->f.TexImage3D(target, level, internalformat, width, height, depth, border, format, type, pixels);
-}
-
-inline void QOpenGLFunctions_4_2_Compatibility::glDrawRangeElements(GLenum mode, GLuint start, GLuint end, GLsizei count, GLenum type, const GLvoid *indices)
-{
- d_1_2_Core->f.DrawRangeElements(mode, start, end, count, type, indices);
-}
-
-inline void QOpenGLFunctions_4_2_Compatibility::glBlendEquation(GLenum mode)
-{
- d_1_2_Core->f.BlendEquation(mode);
-}
-
-inline void QOpenGLFunctions_4_2_Compatibility::glBlendColor(GLfloat red, GLfloat green, GLfloat blue, GLfloat alpha)
-{
- d_1_2_Core->f.BlendColor(red, green, blue, alpha);
-}
-
-
-// OpenGL 1.3 core functions
-inline void QOpenGLFunctions_4_2_Compatibility::glGetCompressedTexImage(GLenum target, GLint level, GLvoid *img)
-{
- d_1_3_Core->f.GetCompressedTexImage(target, level, img);
-}
-
-inline void QOpenGLFunctions_4_2_Compatibility::glCompressedTexSubImage1D(GLenum target, GLint level, GLint xoffset, GLsizei width, GLenum format, GLsizei imageSize, const GLvoid *data)
-{
- d_1_3_Core->f.CompressedTexSubImage1D(target, level, xoffset, width, format, imageSize, data);
-}
-
-inline void QOpenGLFunctions_4_2_Compatibility::glCompressedTexSubImage2D(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLsizei imageSize, const GLvoid *data)
-{
- d_1_3_Core->f.CompressedTexSubImage2D(target, level, xoffset, yoffset, width, height, format, imageSize, data);
-}
-
-inline void QOpenGLFunctions_4_2_Compatibility::glCompressedTexSubImage3D(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLsizei imageSize, const GLvoid *data)
-{
- d_1_3_Core->f.CompressedTexSubImage3D(target, level, xoffset, yoffset, zoffset, width, height, depth, format, imageSize, data);
-}
-
-inline void QOpenGLFunctions_4_2_Compatibility::glCompressedTexImage1D(GLenum target, GLint level, GLenum internalformat, GLsizei width, GLint border, GLsizei imageSize, const GLvoid *data)
-{
- d_1_3_Core->f.CompressedTexImage1D(target, level, internalformat, width, border, imageSize, data);
-}
-
-inline void QOpenGLFunctions_4_2_Compatibility::glCompressedTexImage2D(GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLint border, GLsizei imageSize, const GLvoid *data)
-{
- d_1_3_Core->f.CompressedTexImage2D(target, level, internalformat, width, height, border, imageSize, data);
-}
-
-inline void QOpenGLFunctions_4_2_Compatibility::glCompressedTexImage3D(GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLsizei imageSize, const GLvoid *data)
-{
- d_1_3_Core->f.CompressedTexImage3D(target, level, internalformat, width, height, depth, border, imageSize, data);
-}
-
-inline void QOpenGLFunctions_4_2_Compatibility::glSampleCoverage(GLfloat value, GLboolean invert)
-{
- d_1_3_Core->f.SampleCoverage(value, invert);
-}
-
-inline void QOpenGLFunctions_4_2_Compatibility::glActiveTexture(GLenum texture)
-{
- d_1_3_Core->f.ActiveTexture(texture);
-}
-
-
-// OpenGL 1.4 core functions
-inline void QOpenGLFunctions_4_2_Compatibility::glPointParameteriv(GLenum pname, const GLint *params)
-{
- d_1_4_Core->f.PointParameteriv(pname, params);
-}
-
-inline void QOpenGLFunctions_4_2_Compatibility::glPointParameteri(GLenum pname, GLint param)
-{
- d_1_4_Core->f.PointParameteri(pname, param);
-}
-
-inline void QOpenGLFunctions_4_2_Compatibility::glPointParameterfv(GLenum pname, const GLfloat *params)
-{
- d_1_4_Core->f.PointParameterfv(pname, params);
-}
-
-inline void QOpenGLFunctions_4_2_Compatibility::glPointParameterf(GLenum pname, GLfloat param)
-{
- d_1_4_Core->f.PointParameterf(pname, param);
-}
-
-inline void QOpenGLFunctions_4_2_Compatibility::glMultiDrawElements(GLenum mode, const GLsizei *count, GLenum type, const GLvoid* const *indices, GLsizei drawcount)
-{
- d_1_4_Core->f.MultiDrawElements(mode, count, type, indices, drawcount);
-}
-
-inline void QOpenGLFunctions_4_2_Compatibility::glMultiDrawArrays(GLenum mode, const GLint *first, const GLsizei *count, GLsizei drawcount)
-{
- d_1_4_Core->f.MultiDrawArrays(mode, first, count, drawcount);
-}
-
-inline void QOpenGLFunctions_4_2_Compatibility::glBlendFuncSeparate(GLenum sfactorRGB, GLenum dfactorRGB, GLenum sfactorAlpha, GLenum dfactorAlpha)
-{
- d_1_4_Core->f.BlendFuncSeparate(sfactorRGB, dfactorRGB, sfactorAlpha, dfactorAlpha);
-}
-
-
-// OpenGL 1.5 core functions
-inline void QOpenGLFunctions_4_2_Compatibility::glGetBufferPointerv(GLenum target, GLenum pname, GLvoid* *params)
-{
- d_1_5_Core->f.GetBufferPointerv(target, pname, params);
-}
-
-inline void QOpenGLFunctions_4_2_Compatibility::glGetBufferParameteriv(GLenum target, GLenum pname, GLint *params)
-{
- d_1_5_Core->f.GetBufferParameteriv(target, pname, params);
-}
-
-inline GLboolean QOpenGLFunctions_4_2_Compatibility::glUnmapBuffer(GLenum target)
-{
- return d_1_5_Core->f.UnmapBuffer(target);
-}
-
-inline GLvoid* QOpenGLFunctions_4_2_Compatibility::glMapBuffer(GLenum target, GLenum access)
-{
- return d_1_5_Core->f.MapBuffer(target, access);
-}
-
-inline void QOpenGLFunctions_4_2_Compatibility::glGetBufferSubData(GLenum target, GLintptr offset, GLsizeiptr size, GLvoid *data)
-{
- d_1_5_Core->f.GetBufferSubData(target, offset, size, data);
-}
-
-inline void QOpenGLFunctions_4_2_Compatibility::glBufferSubData(GLenum target, GLintptr offset, GLsizeiptr size, const GLvoid *data)
-{
- d_1_5_Core->f.BufferSubData(target, offset, size, data);
-}
-
-inline void QOpenGLFunctions_4_2_Compatibility::glBufferData(GLenum target, GLsizeiptr size, const GLvoid *data, GLenum usage)
-{
- d_1_5_Core->f.BufferData(target, size, data, usage);
-}
-
-inline GLboolean QOpenGLFunctions_4_2_Compatibility::glIsBuffer(GLuint buffer)
-{
- return d_1_5_Core->f.IsBuffer(buffer);
-}
-
-inline void QOpenGLFunctions_4_2_Compatibility::glGenBuffers(GLsizei n, GLuint *buffers)
-{
- d_1_5_Core->f.GenBuffers(n, buffers);
-}
-
-inline void QOpenGLFunctions_4_2_Compatibility::glDeleteBuffers(GLsizei n, const GLuint *buffers)
-{
- d_1_5_Core->f.DeleteBuffers(n, buffers);
-}
-
-inline void QOpenGLFunctions_4_2_Compatibility::glBindBuffer(GLenum target, GLuint buffer)
-{
- d_1_5_Core->f.BindBuffer(target, buffer);
-}
-
-inline void QOpenGLFunctions_4_2_Compatibility::glGetQueryObjectuiv(GLuint id, GLenum pname, GLuint *params)
-{
- d_1_5_Core->f.GetQueryObjectuiv(id, pname, params);
-}
-
-inline void QOpenGLFunctions_4_2_Compatibility::glGetQueryObjectiv(GLuint id, GLenum pname, GLint *params)
-{
- d_1_5_Core->f.GetQueryObjectiv(id, pname, params);
-}
-
-inline void QOpenGLFunctions_4_2_Compatibility::glGetQueryiv(GLenum target, GLenum pname, GLint *params)
-{
- d_1_5_Core->f.GetQueryiv(target, pname, params);
-}
-
-inline void QOpenGLFunctions_4_2_Compatibility::glEndQuery(GLenum target)
-{
- d_1_5_Core->f.EndQuery(target);
-}
-
-inline void QOpenGLFunctions_4_2_Compatibility::glBeginQuery(GLenum target, GLuint id)
-{
- d_1_5_Core->f.BeginQuery(target, id);
-}
-
-inline GLboolean QOpenGLFunctions_4_2_Compatibility::glIsQuery(GLuint id)
-{
- return d_1_5_Core->f.IsQuery(id);
-}
-
-inline void QOpenGLFunctions_4_2_Compatibility::glDeleteQueries(GLsizei n, const GLuint *ids)
-{
- d_1_5_Core->f.DeleteQueries(n, ids);
-}
-
-inline void QOpenGLFunctions_4_2_Compatibility::glGenQueries(GLsizei n, GLuint *ids)
-{
- d_1_5_Core->f.GenQueries(n, ids);
-}
-
-
-// OpenGL 2.0 core functions
-inline void QOpenGLFunctions_4_2_Compatibility::glVertexAttribPointer(GLuint index, GLint size, GLenum type, GLboolean normalized, GLsizei stride, const GLvoid *pointer)
-{
- d_2_0_Core->f.VertexAttribPointer(index, size, type, normalized, stride, pointer);
-}
-
-inline void QOpenGLFunctions_4_2_Compatibility::glValidateProgram(GLuint program)
-{
- d_2_0_Core->f.ValidateProgram(program);
-}
-
-inline void QOpenGLFunctions_4_2_Compatibility::glUniformMatrix4fv(GLint location, GLsizei count, GLboolean transpose, const GLfloat *value)
-{
- d_2_0_Core->f.UniformMatrix4fv(location, count, transpose, value);
-}
-
-inline void QOpenGLFunctions_4_2_Compatibility::glUniformMatrix3fv(GLint location, GLsizei count, GLboolean transpose, const GLfloat *value)
-{
- d_2_0_Core->f.UniformMatrix3fv(location, count, transpose, value);
-}
-
-inline void QOpenGLFunctions_4_2_Compatibility::glUniformMatrix2fv(GLint location, GLsizei count, GLboolean transpose, const GLfloat *value)
-{
- d_2_0_Core->f.UniformMatrix2fv(location, count, transpose, value);
-}
-
-inline void QOpenGLFunctions_4_2_Compatibility::glUniform4iv(GLint location, GLsizei count, const GLint *value)
-{
- d_2_0_Core->f.Uniform4iv(location, count, value);
-}
-
-inline void QOpenGLFunctions_4_2_Compatibility::glUniform3iv(GLint location, GLsizei count, const GLint *value)
-{
- d_2_0_Core->f.Uniform3iv(location, count, value);
-}
-
-inline void QOpenGLFunctions_4_2_Compatibility::glUniform2iv(GLint location, GLsizei count, const GLint *value)
-{
- d_2_0_Core->f.Uniform2iv(location, count, value);
-}
-
-inline void QOpenGLFunctions_4_2_Compatibility::glUniform1iv(GLint location, GLsizei count, const GLint *value)
-{
- d_2_0_Core->f.Uniform1iv(location, count, value);
-}
-
-inline void QOpenGLFunctions_4_2_Compatibility::glUniform4fv(GLint location, GLsizei count, const GLfloat *value)
-{
- d_2_0_Core->f.Uniform4fv(location, count, value);
-}
-
-inline void QOpenGLFunctions_4_2_Compatibility::glUniform3fv(GLint location, GLsizei count, const GLfloat *value)
-{
- d_2_0_Core->f.Uniform3fv(location, count, value);
-}
-
-inline void QOpenGLFunctions_4_2_Compatibility::glUniform2fv(GLint location, GLsizei count, const GLfloat *value)
-{
- d_2_0_Core->f.Uniform2fv(location, count, value);
-}
-
-inline void QOpenGLFunctions_4_2_Compatibility::glUniform1fv(GLint location, GLsizei count, const GLfloat *value)
-{
- d_2_0_Core->f.Uniform1fv(location, count, value);
-}
-
-inline void QOpenGLFunctions_4_2_Compatibility::glUniform4i(GLint location, GLint v0, GLint v1, GLint v2, GLint v3)
-{
- d_2_0_Core->f.Uniform4i(location, v0, v1, v2, v3);
-}
-
-inline void QOpenGLFunctions_4_2_Compatibility::glUniform3i(GLint location, GLint v0, GLint v1, GLint v2)
-{
- d_2_0_Core->f.Uniform3i(location, v0, v1, v2);
-}
-
-inline void QOpenGLFunctions_4_2_Compatibility::glUniform2i(GLint location, GLint v0, GLint v1)
-{
- d_2_0_Core->f.Uniform2i(location, v0, v1);
-}
-
-inline void QOpenGLFunctions_4_2_Compatibility::glUniform1i(GLint location, GLint v0)
-{
- d_2_0_Core->f.Uniform1i(location, v0);
-}
-
-inline void QOpenGLFunctions_4_2_Compatibility::glUniform4f(GLint location, GLfloat v0, GLfloat v1, GLfloat v2, GLfloat v3)
-{
- d_2_0_Core->f.Uniform4f(location, v0, v1, v2, v3);
-}
-
-inline void QOpenGLFunctions_4_2_Compatibility::glUniform3f(GLint location, GLfloat v0, GLfloat v1, GLfloat v2)
-{
- d_2_0_Core->f.Uniform3f(location, v0, v1, v2);
-}
-
-inline void QOpenGLFunctions_4_2_Compatibility::glUniform2f(GLint location, GLfloat v0, GLfloat v1)
-{
- d_2_0_Core->f.Uniform2f(location, v0, v1);
-}
-
-inline void QOpenGLFunctions_4_2_Compatibility::glUniform1f(GLint location, GLfloat v0)
-{
- d_2_0_Core->f.Uniform1f(location, v0);
-}
-
-inline void QOpenGLFunctions_4_2_Compatibility::glUseProgram(GLuint program)
-{
- d_2_0_Core->f.UseProgram(program);
-}
-
-inline void QOpenGLFunctions_4_2_Compatibility::glShaderSource(GLuint shader, GLsizei count, const GLchar* const *string, const GLint *length)
-{
- d_2_0_Core->f.ShaderSource(shader, count, string, length);
-}
-
-inline void QOpenGLFunctions_4_2_Compatibility::glLinkProgram(GLuint program)
-{
- d_2_0_Core->f.LinkProgram(program);
-}
-
-inline GLboolean QOpenGLFunctions_4_2_Compatibility::glIsShader(GLuint shader)
-{
- return d_2_0_Core->f.IsShader(shader);
-}
-
-inline GLboolean QOpenGLFunctions_4_2_Compatibility::glIsProgram(GLuint program)
-{
- return d_2_0_Core->f.IsProgram(program);
-}
-
-inline void QOpenGLFunctions_4_2_Compatibility::glGetVertexAttribPointerv(GLuint index, GLenum pname, GLvoid* *pointer)
-{
- d_2_0_Core->f.GetVertexAttribPointerv(index, pname, pointer);
-}
-
-inline void QOpenGLFunctions_4_2_Compatibility::glGetVertexAttribiv(GLuint index, GLenum pname, GLint *params)
-{
- d_2_0_Core->f.GetVertexAttribiv(index, pname, params);
-}
-
-inline void QOpenGLFunctions_4_2_Compatibility::glGetVertexAttribfv(GLuint index, GLenum pname, GLfloat *params)
-{
- d_2_0_Core->f.GetVertexAttribfv(index, pname, params);
-}
-
-inline void QOpenGLFunctions_4_2_Compatibility::glGetVertexAttribdv(GLuint index, GLenum pname, GLdouble *params)
-{
- d_2_0_Core->f.GetVertexAttribdv(index, pname, params);
-}
-
-inline void QOpenGLFunctions_4_2_Compatibility::glGetUniformiv(GLuint program, GLint location, GLint *params)
-{
- d_2_0_Core->f.GetUniformiv(program, location, params);
-}
-
-inline void QOpenGLFunctions_4_2_Compatibility::glGetUniformfv(GLuint program, GLint location, GLfloat *params)
-{
- d_2_0_Core->f.GetUniformfv(program, location, params);
-}
-
-inline GLint QOpenGLFunctions_4_2_Compatibility::glGetUniformLocation(GLuint program, const GLchar *name)
-{
- return d_2_0_Core->f.GetUniformLocation(program, name);
-}
-
-inline void QOpenGLFunctions_4_2_Compatibility::glGetShaderSource(GLuint shader, GLsizei bufSize, GLsizei *length, GLchar *source)
-{
- d_2_0_Core->f.GetShaderSource(shader, bufSize, length, source);
-}
-
-inline void QOpenGLFunctions_4_2_Compatibility::glGetShaderInfoLog(GLuint shader, GLsizei bufSize, GLsizei *length, GLchar *infoLog)
-{
- d_2_0_Core->f.GetShaderInfoLog(shader, bufSize, length, infoLog);
-}
-
-inline void QOpenGLFunctions_4_2_Compatibility::glGetShaderiv(GLuint shader, GLenum pname, GLint *params)
-{
- d_2_0_Core->f.GetShaderiv(shader, pname, params);
-}
-
-inline void QOpenGLFunctions_4_2_Compatibility::glGetProgramInfoLog(GLuint program, GLsizei bufSize, GLsizei *length, GLchar *infoLog)
-{
- d_2_0_Core->f.GetProgramInfoLog(program, bufSize, length, infoLog);
-}
-
-inline void QOpenGLFunctions_4_2_Compatibility::glGetProgramiv(GLuint program, GLenum pname, GLint *params)
-{
- d_2_0_Core->f.GetProgramiv(program, pname, params);
-}
-
-inline GLint QOpenGLFunctions_4_2_Compatibility::glGetAttribLocation(GLuint program, const GLchar *name)
-{
- return d_2_0_Core->f.GetAttribLocation(program, name);
-}
-
-inline void QOpenGLFunctions_4_2_Compatibility::glGetAttachedShaders(GLuint program, GLsizei maxCount, GLsizei *count, GLuint *obj)
-{
- d_2_0_Core->f.GetAttachedShaders(program, maxCount, count, obj);
-}
-
-inline void QOpenGLFunctions_4_2_Compatibility::glGetActiveUniform(GLuint program, GLuint index, GLsizei bufSize, GLsizei *length, GLint *size, GLenum *type, GLchar *name)
-{
- d_2_0_Core->f.GetActiveUniform(program, index, bufSize, length, size, type, name);
-}
-
-inline void QOpenGLFunctions_4_2_Compatibility::glGetActiveAttrib(GLuint program, GLuint index, GLsizei bufSize, GLsizei *length, GLint *size, GLenum *type, GLchar *name)
-{
- d_2_0_Core->f.GetActiveAttrib(program, index, bufSize, length, size, type, name);
-}
-
-inline void QOpenGLFunctions_4_2_Compatibility::glEnableVertexAttribArray(GLuint index)
-{
- d_2_0_Core->f.EnableVertexAttribArray(index);
-}
-
-inline void QOpenGLFunctions_4_2_Compatibility::glDisableVertexAttribArray(GLuint index)
-{
- d_2_0_Core->f.DisableVertexAttribArray(index);
-}
-
-inline void QOpenGLFunctions_4_2_Compatibility::glDetachShader(GLuint program, GLuint shader)
-{
- d_2_0_Core->f.DetachShader(program, shader);
-}
-
-inline void QOpenGLFunctions_4_2_Compatibility::glDeleteShader(GLuint shader)
-{
- d_2_0_Core->f.DeleteShader(shader);
-}
-
-inline void QOpenGLFunctions_4_2_Compatibility::glDeleteProgram(GLuint program)
-{
- d_2_0_Core->f.DeleteProgram(program);
-}
-
-inline GLuint QOpenGLFunctions_4_2_Compatibility::glCreateShader(GLenum type)
-{
- return d_2_0_Core->f.CreateShader(type);
-}
-
-inline GLuint QOpenGLFunctions_4_2_Compatibility::glCreateProgram()
-{
- return d_2_0_Core->f.CreateProgram();
-}
-
-inline void QOpenGLFunctions_4_2_Compatibility::glCompileShader(GLuint shader)
-{
- d_2_0_Core->f.CompileShader(shader);
-}
-
-inline void QOpenGLFunctions_4_2_Compatibility::glBindAttribLocation(GLuint program, GLuint index, const GLchar *name)
-{
- d_2_0_Core->f.BindAttribLocation(program, index, name);
-}
-
-inline void QOpenGLFunctions_4_2_Compatibility::glAttachShader(GLuint program, GLuint shader)
-{
- d_2_0_Core->f.AttachShader(program, shader);
-}
-
-inline void QOpenGLFunctions_4_2_Compatibility::glStencilMaskSeparate(GLenum face, GLuint mask)
-{
- d_2_0_Core->f.StencilMaskSeparate(face, mask);
-}
-
-inline void QOpenGLFunctions_4_2_Compatibility::glStencilFuncSeparate(GLenum face, GLenum func, GLint ref, GLuint mask)
-{
- d_2_0_Core->f.StencilFuncSeparate(face, func, ref, mask);
-}
-
-inline void QOpenGLFunctions_4_2_Compatibility::glStencilOpSeparate(GLenum face, GLenum sfail, GLenum dpfail, GLenum dppass)
-{
- d_2_0_Core->f.StencilOpSeparate(face, sfail, dpfail, dppass);
-}
-
-inline void QOpenGLFunctions_4_2_Compatibility::glDrawBuffers(GLsizei n, const GLenum *bufs)
-{
- d_2_0_Core->f.DrawBuffers(n, bufs);
-}
-
-inline void QOpenGLFunctions_4_2_Compatibility::glBlendEquationSeparate(GLenum modeRGB, GLenum modeAlpha)
-{
- d_2_0_Core->f.BlendEquationSeparate(modeRGB, modeAlpha);
-}
-
-
-// OpenGL 2.1 core functions
-inline void QOpenGLFunctions_4_2_Compatibility::glUniformMatrix4x3fv(GLint location, GLsizei count, GLboolean transpose, const GLfloat *value)
-{
- d_2_1_Core->f.UniformMatrix4x3fv(location, count, transpose, value);
-}
-
-inline void QOpenGLFunctions_4_2_Compatibility::glUniformMatrix3x4fv(GLint location, GLsizei count, GLboolean transpose, const GLfloat *value)
-{
- d_2_1_Core->f.UniformMatrix3x4fv(location, count, transpose, value);
-}
-
-inline void QOpenGLFunctions_4_2_Compatibility::glUniformMatrix4x2fv(GLint location, GLsizei count, GLboolean transpose, const GLfloat *value)
-{
- d_2_1_Core->f.UniformMatrix4x2fv(location, count, transpose, value);
-}
-
-inline void QOpenGLFunctions_4_2_Compatibility::glUniformMatrix2x4fv(GLint location, GLsizei count, GLboolean transpose, const GLfloat *value)
-{
- d_2_1_Core->f.UniformMatrix2x4fv(location, count, transpose, value);
-}
-
-inline void QOpenGLFunctions_4_2_Compatibility::glUniformMatrix3x2fv(GLint location, GLsizei count, GLboolean transpose, const GLfloat *value)
-{
- d_2_1_Core->f.UniformMatrix3x2fv(location, count, transpose, value);
-}
-
-inline void QOpenGLFunctions_4_2_Compatibility::glUniformMatrix2x3fv(GLint location, GLsizei count, GLboolean transpose, const GLfloat *value)
-{
- d_2_1_Core->f.UniformMatrix2x3fv(location, count, transpose, value);
-}
-
-
-// OpenGL 3.0 core functions
-inline GLboolean QOpenGLFunctions_4_2_Compatibility::glIsVertexArray(GLuint array)
-{
- return d_3_0_Core->f.IsVertexArray(array);
-}
-
-inline void QOpenGLFunctions_4_2_Compatibility::glGenVertexArrays(GLsizei n, GLuint *arrays)
-{
- d_3_0_Core->f.GenVertexArrays(n, arrays);
-}
-
-inline void QOpenGLFunctions_4_2_Compatibility::glDeleteVertexArrays(GLsizei n, const GLuint *arrays)
-{
- d_3_0_Core->f.DeleteVertexArrays(n, arrays);
-}
-
-inline void QOpenGLFunctions_4_2_Compatibility::glBindVertexArray(GLuint array)
-{
- d_3_0_Core->f.BindVertexArray(array);
-}
-
-inline void QOpenGLFunctions_4_2_Compatibility::glFlushMappedBufferRange(GLenum target, GLintptr offset, GLsizeiptr length)
-{
- d_3_0_Core->f.FlushMappedBufferRange(target, offset, length);
-}
-
-inline GLvoid* QOpenGLFunctions_4_2_Compatibility::glMapBufferRange(GLenum target, GLintptr offset, GLsizeiptr length, GLbitfield access)
-{
- return d_3_0_Core->f.MapBufferRange(target, offset, length, access);
-}
-
-inline void QOpenGLFunctions_4_2_Compatibility::glFramebufferTextureLayer(GLenum target, GLenum attachment, GLuint texture, GLint level, GLint layer)
-{
- d_3_0_Core->f.FramebufferTextureLayer(target, attachment, texture, level, layer);
-}
-
-inline void QOpenGLFunctions_4_2_Compatibility::glRenderbufferStorageMultisample(GLenum target, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height)
-{
- d_3_0_Core->f.RenderbufferStorageMultisample(target, samples, internalformat, width, height);
-}
-
-inline void QOpenGLFunctions_4_2_Compatibility::glBlitFramebuffer(GLint srcX0, GLint srcY0, GLint srcX1, GLint srcY1, GLint dstX0, GLint dstY0, GLint dstX1, GLint dstY1, GLbitfield mask, GLenum filter)
-{
- d_3_0_Core->f.BlitFramebuffer(srcX0, srcY0, srcX1, srcY1, dstX0, dstY0, dstX1, dstY1, mask, filter);
-}
-
-inline void QOpenGLFunctions_4_2_Compatibility::glGenerateMipmap(GLenum target)
-{
- d_3_0_Core->f.GenerateMipmap(target);
-}
-
-inline void QOpenGLFunctions_4_2_Compatibility::glGetFramebufferAttachmentParameteriv(GLenum target, GLenum attachment, GLenum pname, GLint *params)
-{
- d_3_0_Core->f.GetFramebufferAttachmentParameteriv(target, attachment, pname, params);
-}
-
-inline void QOpenGLFunctions_4_2_Compatibility::glFramebufferRenderbuffer(GLenum target, GLenum attachment, GLenum renderbuffertarget, GLuint renderbuffer)
-{
- d_3_0_Core->f.FramebufferRenderbuffer(target, attachment, renderbuffertarget, renderbuffer);
-}
-
-inline void QOpenGLFunctions_4_2_Compatibility::glFramebufferTexture3D(GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level, GLint zoffset)
-{
- d_3_0_Core->f.FramebufferTexture3D(target, attachment, textarget, texture, level, zoffset);
-}
-
-inline void QOpenGLFunctions_4_2_Compatibility::glFramebufferTexture2D(GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level)
-{
- d_3_0_Core->f.FramebufferTexture2D(target, attachment, textarget, texture, level);
-}
-
-inline void QOpenGLFunctions_4_2_Compatibility::glFramebufferTexture1D(GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level)
-{
- d_3_0_Core->f.FramebufferTexture1D(target, attachment, textarget, texture, level);
-}
-
-inline GLenum QOpenGLFunctions_4_2_Compatibility::glCheckFramebufferStatus(GLenum target)
-{
- return d_3_0_Core->f.CheckFramebufferStatus(target);
-}
-
-inline void QOpenGLFunctions_4_2_Compatibility::glGenFramebuffers(GLsizei n, GLuint *framebuffers)
-{
- d_3_0_Core->f.GenFramebuffers(n, framebuffers);
-}
-
-inline void QOpenGLFunctions_4_2_Compatibility::glDeleteFramebuffers(GLsizei n, const GLuint *framebuffers)
-{
- d_3_0_Core->f.DeleteFramebuffers(n, framebuffers);
-}
-
-inline void QOpenGLFunctions_4_2_Compatibility::glBindFramebuffer(GLenum target, GLuint framebuffer)
-{
- d_3_0_Core->f.BindFramebuffer(target, framebuffer);
-}
-
-inline GLboolean QOpenGLFunctions_4_2_Compatibility::glIsFramebuffer(GLuint framebuffer)
-{
- return d_3_0_Core->f.IsFramebuffer(framebuffer);
-}
-
-inline void QOpenGLFunctions_4_2_Compatibility::glGetRenderbufferParameteriv(GLenum target, GLenum pname, GLint *params)
-{
- d_3_0_Core->f.GetRenderbufferParameteriv(target, pname, params);
-}
-
-inline void QOpenGLFunctions_4_2_Compatibility::glRenderbufferStorage(GLenum target, GLenum internalformat, GLsizei width, GLsizei height)
-{
- d_3_0_Core->f.RenderbufferStorage(target, internalformat, width, height);
-}
-
-inline void QOpenGLFunctions_4_2_Compatibility::glGenRenderbuffers(GLsizei n, GLuint *renderbuffers)
-{
- d_3_0_Core->f.GenRenderbuffers(n, renderbuffers);
-}
-
-inline void QOpenGLFunctions_4_2_Compatibility::glDeleteRenderbuffers(GLsizei n, const GLuint *renderbuffers)
-{
- d_3_0_Core->f.DeleteRenderbuffers(n, renderbuffers);
-}
-
-inline void QOpenGLFunctions_4_2_Compatibility::glBindRenderbuffer(GLenum target, GLuint renderbuffer)
-{
- d_3_0_Core->f.BindRenderbuffer(target, renderbuffer);
-}
-
-inline GLboolean QOpenGLFunctions_4_2_Compatibility::glIsRenderbuffer(GLuint renderbuffer)
-{
- return d_3_0_Core->f.IsRenderbuffer(renderbuffer);
-}
-
-inline const GLubyte * QOpenGLFunctions_4_2_Compatibility::glGetStringi(GLenum name, GLuint index)
-{
- return d_3_0_Core->f.GetStringi(name, index);
-}
-
-inline void QOpenGLFunctions_4_2_Compatibility::glClearBufferfi(GLenum buffer, GLint drawbuffer, GLfloat depth, GLint stencil)
-{
- d_3_0_Core->f.ClearBufferfi(buffer, drawbuffer, depth, stencil);
-}
-
-inline void QOpenGLFunctions_4_2_Compatibility::glClearBufferfv(GLenum buffer, GLint drawbuffer, const GLfloat *value)
-{
- d_3_0_Core->f.ClearBufferfv(buffer, drawbuffer, value);
-}
-
-inline void QOpenGLFunctions_4_2_Compatibility::glClearBufferuiv(GLenum buffer, GLint drawbuffer, const GLuint *value)
-{
- d_3_0_Core->f.ClearBufferuiv(buffer, drawbuffer, value);
-}
-
-inline void QOpenGLFunctions_4_2_Compatibility::glClearBufferiv(GLenum buffer, GLint drawbuffer, const GLint *value)
-{
- d_3_0_Core->f.ClearBufferiv(buffer, drawbuffer, value);
-}
-
-inline void QOpenGLFunctions_4_2_Compatibility::glGetTexParameterIuiv(GLenum target, GLenum pname, GLuint *params)
-{
- d_3_0_Core->f.GetTexParameterIuiv(target, pname, params);
-}
-
-inline void QOpenGLFunctions_4_2_Compatibility::glGetTexParameterIiv(GLenum target, GLenum pname, GLint *params)
-{
- d_3_0_Core->f.GetTexParameterIiv(target, pname, params);
-}
-
-inline void QOpenGLFunctions_4_2_Compatibility::glTexParameterIuiv(GLenum target, GLenum pname, const GLuint *params)
-{
- d_3_0_Core->f.TexParameterIuiv(target, pname, params);
-}
-
-inline void QOpenGLFunctions_4_2_Compatibility::glTexParameterIiv(GLenum target, GLenum pname, const GLint *params)
-{
- d_3_0_Core->f.TexParameterIiv(target, pname, params);
-}
-
-inline void QOpenGLFunctions_4_2_Compatibility::glUniform4uiv(GLint location, GLsizei count, const GLuint *value)
-{
- d_3_0_Core->f.Uniform4uiv(location, count, value);
-}
-
-inline void QOpenGLFunctions_4_2_Compatibility::glUniform3uiv(GLint location, GLsizei count, const GLuint *value)
-{
- d_3_0_Core->f.Uniform3uiv(location, count, value);
-}
-
-inline void QOpenGLFunctions_4_2_Compatibility::glUniform2uiv(GLint location, GLsizei count, const GLuint *value)
-{
- d_3_0_Core->f.Uniform2uiv(location, count, value);
-}
-
-inline void QOpenGLFunctions_4_2_Compatibility::glUniform1uiv(GLint location, GLsizei count, const GLuint *value)
-{
- d_3_0_Core->f.Uniform1uiv(location, count, value);
-}
-
-inline void QOpenGLFunctions_4_2_Compatibility::glUniform4ui(GLint location, GLuint v0, GLuint v1, GLuint v2, GLuint v3)
-{
- d_3_0_Core->f.Uniform4ui(location, v0, v1, v2, v3);
-}
-
-inline void QOpenGLFunctions_4_2_Compatibility::glUniform3ui(GLint location, GLuint v0, GLuint v1, GLuint v2)
-{
- d_3_0_Core->f.Uniform3ui(location, v0, v1, v2);
-}
-
-inline void QOpenGLFunctions_4_2_Compatibility::glUniform2ui(GLint location, GLuint v0, GLuint v1)
-{
- d_3_0_Core->f.Uniform2ui(location, v0, v1);
-}
-
-inline void QOpenGLFunctions_4_2_Compatibility::glUniform1ui(GLint location, GLuint v0)
-{
- d_3_0_Core->f.Uniform1ui(location, v0);
-}
-
-inline GLint QOpenGLFunctions_4_2_Compatibility::glGetFragDataLocation(GLuint program, const GLchar *name)
-{
- return d_3_0_Core->f.GetFragDataLocation(program, name);
-}
-
-inline void QOpenGLFunctions_4_2_Compatibility::glBindFragDataLocation(GLuint program, GLuint color, const GLchar *name)
-{
- d_3_0_Core->f.BindFragDataLocation(program, color, name);
-}
-
-inline void QOpenGLFunctions_4_2_Compatibility::glGetUniformuiv(GLuint program, GLint location, GLuint *params)
-{
- d_3_0_Core->f.GetUniformuiv(program, location, params);
-}
-
-inline void QOpenGLFunctions_4_2_Compatibility::glGetVertexAttribIuiv(GLuint index, GLenum pname, GLuint *params)
-{
- d_3_0_Core->f.GetVertexAttribIuiv(index, pname, params);
-}
-
-inline void QOpenGLFunctions_4_2_Compatibility::glGetVertexAttribIiv(GLuint index, GLenum pname, GLint *params)
-{
- d_3_0_Core->f.GetVertexAttribIiv(index, pname, params);
-}
-
-inline void QOpenGLFunctions_4_2_Compatibility::glVertexAttribIPointer(GLuint index, GLint size, GLenum type, GLsizei stride, const GLvoid *pointer)
-{
- d_3_0_Core->f.VertexAttribIPointer(index, size, type, stride, pointer);
-}
-
-inline void QOpenGLFunctions_4_2_Compatibility::glEndConditionalRender()
-{
- d_3_0_Core->f.EndConditionalRender();
-}
-
-inline void QOpenGLFunctions_4_2_Compatibility::glBeginConditionalRender(GLuint id, GLenum mode)
-{
- d_3_0_Core->f.BeginConditionalRender(id, mode);
-}
-
-inline void QOpenGLFunctions_4_2_Compatibility::glClampColor(GLenum target, GLenum clamp)
-{
- d_3_0_Core->f.ClampColor(target, clamp);
-}
-
-inline void QOpenGLFunctions_4_2_Compatibility::glGetTransformFeedbackVarying(GLuint program, GLuint index, GLsizei bufSize, GLsizei *length, GLsizei *size, GLenum *type, GLchar *name)
-{
- d_3_0_Core->f.GetTransformFeedbackVarying(program, index, bufSize, length, size, type, name);
-}
-
-inline void QOpenGLFunctions_4_2_Compatibility::glTransformFeedbackVaryings(GLuint program, GLsizei count, const GLchar* const *varyings, GLenum bufferMode)
-{
- d_3_0_Core->f.TransformFeedbackVaryings(program, count, varyings, bufferMode);
-}
-
-inline void QOpenGLFunctions_4_2_Compatibility::glBindBufferBase(GLenum target, GLuint index, GLuint buffer)
-{
- d_3_0_Core->f.BindBufferBase(target, index, buffer);
-}
-
-inline void QOpenGLFunctions_4_2_Compatibility::glBindBufferRange(GLenum target, GLuint index, GLuint buffer, GLintptr offset, GLsizeiptr size)
-{
- d_3_0_Core->f.BindBufferRange(target, index, buffer, offset, size);
-}
-
-inline void QOpenGLFunctions_4_2_Compatibility::glEndTransformFeedback()
-{
- d_3_0_Core->f.EndTransformFeedback();
-}
-
-inline void QOpenGLFunctions_4_2_Compatibility::glBeginTransformFeedback(GLenum primitiveMode)
-{
- d_3_0_Core->f.BeginTransformFeedback(primitiveMode);
-}
-
-inline GLboolean QOpenGLFunctions_4_2_Compatibility::glIsEnabledi(GLenum target, GLuint index)
-{
- return d_3_0_Core->f.IsEnabledi(target, index);
-}
-
-inline void QOpenGLFunctions_4_2_Compatibility::glDisablei(GLenum target, GLuint index)
-{
- d_3_0_Core->f.Disablei(target, index);
-}
-
-inline void QOpenGLFunctions_4_2_Compatibility::glEnablei(GLenum target, GLuint index)
-{
- d_3_0_Core->f.Enablei(target, index);
-}
-
-inline void QOpenGLFunctions_4_2_Compatibility::glGetIntegeri_v(GLenum target, GLuint index, GLint *data)
-{
- d_3_0_Core->f.GetIntegeri_v(target, index, data);
-}
-
-inline void QOpenGLFunctions_4_2_Compatibility::glGetBooleani_v(GLenum target, GLuint index, GLboolean *data)
-{
- d_3_0_Core->f.GetBooleani_v(target, index, data);
-}
-
-inline void QOpenGLFunctions_4_2_Compatibility::glColorMaski(GLuint index, GLboolean r, GLboolean g, GLboolean b, GLboolean a)
-{
- d_3_0_Core->f.ColorMaski(index, r, g, b, a);
-}
-
-
-// OpenGL 3.1 core functions
-inline void QOpenGLFunctions_4_2_Compatibility::glCopyBufferSubData(GLenum readTarget, GLenum writeTarget, GLintptr readOffset, GLintptr writeOffset, GLsizeiptr size)
-{
- d_3_1_Core->f.CopyBufferSubData(readTarget, writeTarget, readOffset, writeOffset, size);
-}
-
-inline void QOpenGLFunctions_4_2_Compatibility::glUniformBlockBinding(GLuint program, GLuint uniformBlockIndex, GLuint uniformBlockBinding)
-{
- d_3_1_Core->f.UniformBlockBinding(program, uniformBlockIndex, uniformBlockBinding);
-}
-
-inline void QOpenGLFunctions_4_2_Compatibility::glGetActiveUniformBlockName(GLuint program, GLuint uniformBlockIndex, GLsizei bufSize, GLsizei *length, GLchar *uniformBlockName)
-{
- d_3_1_Core->f.GetActiveUniformBlockName(program, uniformBlockIndex, bufSize, length, uniformBlockName);
-}
-
-inline void QOpenGLFunctions_4_2_Compatibility::glGetActiveUniformBlockiv(GLuint program, GLuint uniformBlockIndex, GLenum pname, GLint *params)
-{
- d_3_1_Core->f.GetActiveUniformBlockiv(program, uniformBlockIndex, pname, params);
-}
-
-inline GLuint QOpenGLFunctions_4_2_Compatibility::glGetUniformBlockIndex(GLuint program, const GLchar *uniformBlockName)
-{
- return d_3_1_Core->f.GetUniformBlockIndex(program, uniformBlockName);
-}
-
-inline void QOpenGLFunctions_4_2_Compatibility::glGetActiveUniformName(GLuint program, GLuint uniformIndex, GLsizei bufSize, GLsizei *length, GLchar *uniformName)
-{
- d_3_1_Core->f.GetActiveUniformName(program, uniformIndex, bufSize, length, uniformName);
-}
-
-inline void QOpenGLFunctions_4_2_Compatibility::glGetActiveUniformsiv(GLuint program, GLsizei uniformCount, const GLuint *uniformIndices, GLenum pname, GLint *params)
-{
- d_3_1_Core->f.GetActiveUniformsiv(program, uniformCount, uniformIndices, pname, params);
-}
-
-inline void QOpenGLFunctions_4_2_Compatibility::glGetUniformIndices(GLuint program, GLsizei uniformCount, const GLchar* const *uniformNames, GLuint *uniformIndices)
-{
- d_3_1_Core->f.GetUniformIndices(program, uniformCount, uniformNames, uniformIndices);
-}
-
-inline void QOpenGLFunctions_4_2_Compatibility::glPrimitiveRestartIndex(GLuint index)
-{
- d_3_1_Core->f.PrimitiveRestartIndex(index);
-}
-
-inline void QOpenGLFunctions_4_2_Compatibility::glTexBuffer(GLenum target, GLenum internalformat, GLuint buffer)
-{
- d_3_1_Core->f.TexBuffer(target, internalformat, buffer);
-}
-
-inline void QOpenGLFunctions_4_2_Compatibility::glDrawElementsInstanced(GLenum mode, GLsizei count, GLenum type, const GLvoid *indices, GLsizei instancecount)
-{
- d_3_1_Core->f.DrawElementsInstanced(mode, count, type, indices, instancecount);
-}
-
-inline void QOpenGLFunctions_4_2_Compatibility::glDrawArraysInstanced(GLenum mode, GLint first, GLsizei count, GLsizei instancecount)
-{
- d_3_1_Core->f.DrawArraysInstanced(mode, first, count, instancecount);
-}
-
-
-// OpenGL 3.2 core functions
-inline void QOpenGLFunctions_4_2_Compatibility::glSampleMaski(GLuint index, GLbitfield mask)
-{
- d_3_2_Core->f.SampleMaski(index, mask);
-}
-
-inline void QOpenGLFunctions_4_2_Compatibility::glGetMultisamplefv(GLenum pname, GLuint index, GLfloat *val)
-{
- d_3_2_Core->f.GetMultisamplefv(pname, index, val);
-}
-
-inline void QOpenGLFunctions_4_2_Compatibility::glTexImage3DMultisample(GLenum target, GLsizei samples, GLint internalformat, GLsizei width, GLsizei height, GLsizei depth, GLboolean fixedsamplelocations)
-{
- d_3_2_Core->f.TexImage3DMultisample(target, samples, internalformat, width, height, depth, fixedsamplelocations);
-}
-
-inline void QOpenGLFunctions_4_2_Compatibility::glTexImage2DMultisample(GLenum target, GLsizei samples, GLint internalformat, GLsizei width, GLsizei height, GLboolean fixedsamplelocations)
-{
- d_3_2_Core->f.TexImage2DMultisample(target, samples, internalformat, width, height, fixedsamplelocations);
-}
-
-inline void QOpenGLFunctions_4_2_Compatibility::glGetSynciv(GLsync sync, GLenum pname, GLsizei bufSize, GLsizei *length, GLint *values)
-{
- d_3_2_Core->f.GetSynciv(sync, pname, bufSize, length, values);
-}
-
-inline void QOpenGLFunctions_4_2_Compatibility::glGetInteger64v(GLenum pname, GLint64 *params)
-{
- d_3_2_Core->f.GetInteger64v(pname, params);
-}
-
-inline void QOpenGLFunctions_4_2_Compatibility::glWaitSync(GLsync sync, GLbitfield flags, GLuint64 timeout)
-{
- d_3_2_Core->f.WaitSync(sync, flags, timeout);
-}
-
-inline GLenum QOpenGLFunctions_4_2_Compatibility::glClientWaitSync(GLsync sync, GLbitfield flags, GLuint64 timeout)
-{
- return d_3_2_Core->f.ClientWaitSync(sync, flags, timeout);
-}
-
-inline void QOpenGLFunctions_4_2_Compatibility::glDeleteSync(GLsync sync)
-{
- d_3_2_Core->f.DeleteSync(sync);
-}
-
-inline GLboolean QOpenGLFunctions_4_2_Compatibility::glIsSync(GLsync sync)
-{
- return d_3_2_Core->f.IsSync(sync);
-}
-
-inline GLsync QOpenGLFunctions_4_2_Compatibility::glFenceSync(GLenum condition, GLbitfield flags)
-{
- return d_3_2_Core->f.FenceSync(condition, flags);
-}
-
-inline void QOpenGLFunctions_4_2_Compatibility::glProvokingVertex(GLenum mode)
-{
- d_3_2_Core->f.ProvokingVertex(mode);
-}
-
-inline void QOpenGLFunctions_4_2_Compatibility::glMultiDrawElementsBaseVertex(GLenum mode, const GLsizei *count, GLenum type, const GLvoid* const *indices, GLsizei drawcount, const GLint *basevertex)
-{
- d_3_2_Core->f.MultiDrawElementsBaseVertex(mode, count, type, indices, drawcount, basevertex);
-}
-
-inline void QOpenGLFunctions_4_2_Compatibility::glDrawElementsInstancedBaseVertex(GLenum mode, GLsizei count, GLenum type, const GLvoid *indices, GLsizei instancecount, GLint basevertex)
-{
- d_3_2_Core->f.DrawElementsInstancedBaseVertex(mode, count, type, indices, instancecount, basevertex);
-}
-
-inline void QOpenGLFunctions_4_2_Compatibility::glDrawRangeElementsBaseVertex(GLenum mode, GLuint start, GLuint end, GLsizei count, GLenum type, const GLvoid *indices, GLint basevertex)
-{
- d_3_2_Core->f.DrawRangeElementsBaseVertex(mode, start, end, count, type, indices, basevertex);
-}
-
-inline void QOpenGLFunctions_4_2_Compatibility::glDrawElementsBaseVertex(GLenum mode, GLsizei count, GLenum type, const GLvoid *indices, GLint basevertex)
-{
- d_3_2_Core->f.DrawElementsBaseVertex(mode, count, type, indices, basevertex);
-}
-
-inline void QOpenGLFunctions_4_2_Compatibility::glFramebufferTexture(GLenum target, GLenum attachment, GLuint texture, GLint level)
-{
- d_3_2_Core->f.FramebufferTexture(target, attachment, texture, level);
-}
-
-inline void QOpenGLFunctions_4_2_Compatibility::glGetBufferParameteri64v(GLenum target, GLenum pname, GLint64 *params)
-{
- d_3_2_Core->f.GetBufferParameteri64v(target, pname, params);
-}
-
-inline void QOpenGLFunctions_4_2_Compatibility::glGetInteger64i_v(GLenum target, GLuint index, GLint64 *data)
-{
- d_3_2_Core->f.GetInteger64i_v(target, index, data);
-}
-
-
-// OpenGL 3.3 core functions
-inline void QOpenGLFunctions_4_2_Compatibility::glVertexAttribP4uiv(GLuint index, GLenum type, GLboolean normalized, const GLuint *value)
-{
- d_3_3_Core->f.VertexAttribP4uiv(index, type, normalized, value);
-}
-
-inline void QOpenGLFunctions_4_2_Compatibility::glVertexAttribP4ui(GLuint index, GLenum type, GLboolean normalized, GLuint value)
-{
- d_3_3_Core->f.VertexAttribP4ui(index, type, normalized, value);
-}
-
-inline void QOpenGLFunctions_4_2_Compatibility::glVertexAttribP3uiv(GLuint index, GLenum type, GLboolean normalized, const GLuint *value)
-{
- d_3_3_Core->f.VertexAttribP3uiv(index, type, normalized, value);
-}
-
-inline void QOpenGLFunctions_4_2_Compatibility::glVertexAttribP3ui(GLuint index, GLenum type, GLboolean normalized, GLuint value)
-{
- d_3_3_Core->f.VertexAttribP3ui(index, type, normalized, value);
-}
-
-inline void QOpenGLFunctions_4_2_Compatibility::glVertexAttribP2uiv(GLuint index, GLenum type, GLboolean normalized, const GLuint *value)
-{
- d_3_3_Core->f.VertexAttribP2uiv(index, type, normalized, value);
-}
-
-inline void QOpenGLFunctions_4_2_Compatibility::glVertexAttribP2ui(GLuint index, GLenum type, GLboolean normalized, GLuint value)
-{
- d_3_3_Core->f.VertexAttribP2ui(index, type, normalized, value);
-}
-
-inline void QOpenGLFunctions_4_2_Compatibility::glVertexAttribP1uiv(GLuint index, GLenum type, GLboolean normalized, const GLuint *value)
-{
- d_3_3_Core->f.VertexAttribP1uiv(index, type, normalized, value);
-}
-
-inline void QOpenGLFunctions_4_2_Compatibility::glVertexAttribP1ui(GLuint index, GLenum type, GLboolean normalized, GLuint value)
-{
- d_3_3_Core->f.VertexAttribP1ui(index, type, normalized, value);
-}
-
-inline void QOpenGLFunctions_4_2_Compatibility::glSecondaryColorP3uiv(GLenum type, const GLuint *color)
-{
- d_3_3_Deprecated->f.SecondaryColorP3uiv(type, color);
-}
-
-inline void QOpenGLFunctions_4_2_Compatibility::glSecondaryColorP3ui(GLenum type, GLuint color)
-{
- d_3_3_Deprecated->f.SecondaryColorP3ui(type, color);
-}
-
-inline void QOpenGLFunctions_4_2_Compatibility::glColorP4uiv(GLenum type, const GLuint *color)
-{
- d_3_3_Deprecated->f.ColorP4uiv(type, color);
-}
-
-inline void QOpenGLFunctions_4_2_Compatibility::glColorP4ui(GLenum type, GLuint color)
-{
- d_3_3_Deprecated->f.ColorP4ui(type, color);
-}
-
-inline void QOpenGLFunctions_4_2_Compatibility::glColorP3uiv(GLenum type, const GLuint *color)
-{
- d_3_3_Deprecated->f.ColorP3uiv(type, color);
-}
-
-inline void QOpenGLFunctions_4_2_Compatibility::glColorP3ui(GLenum type, GLuint color)
-{
- d_3_3_Deprecated->f.ColorP3ui(type, color);
-}
-
-inline void QOpenGLFunctions_4_2_Compatibility::glNormalP3uiv(GLenum type, const GLuint *coords)
-{
- d_3_3_Deprecated->f.NormalP3uiv(type, coords);
-}
-
-inline void QOpenGLFunctions_4_2_Compatibility::glNormalP3ui(GLenum type, GLuint coords)
-{
- d_3_3_Deprecated->f.NormalP3ui(type, coords);
-}
-
-inline void QOpenGLFunctions_4_2_Compatibility::glMultiTexCoordP4uiv(GLenum texture, GLenum type, const GLuint *coords)
-{
- d_3_3_Deprecated->f.MultiTexCoordP4uiv(texture, type, coords);
-}
-
-inline void QOpenGLFunctions_4_2_Compatibility::glMultiTexCoordP4ui(GLenum texture, GLenum type, GLuint coords)
-{
- d_3_3_Deprecated->f.MultiTexCoordP4ui(texture, type, coords);
-}
-
-inline void QOpenGLFunctions_4_2_Compatibility::glMultiTexCoordP3uiv(GLenum texture, GLenum type, const GLuint *coords)
-{
- d_3_3_Deprecated->f.MultiTexCoordP3uiv(texture, type, coords);
-}
-
-inline void QOpenGLFunctions_4_2_Compatibility::glMultiTexCoordP3ui(GLenum texture, GLenum type, GLuint coords)
-{
- d_3_3_Deprecated->f.MultiTexCoordP3ui(texture, type, coords);
-}
-
-inline void QOpenGLFunctions_4_2_Compatibility::glMultiTexCoordP2uiv(GLenum texture, GLenum type, const GLuint *coords)
-{
- d_3_3_Deprecated->f.MultiTexCoordP2uiv(texture, type, coords);
-}
-
-inline void QOpenGLFunctions_4_2_Compatibility::glMultiTexCoordP2ui(GLenum texture, GLenum type, GLuint coords)
-{
- d_3_3_Deprecated->f.MultiTexCoordP2ui(texture, type, coords);
-}
-
-inline void QOpenGLFunctions_4_2_Compatibility::glMultiTexCoordP1uiv(GLenum texture, GLenum type, const GLuint *coords)
-{
- d_3_3_Deprecated->f.MultiTexCoordP1uiv(texture, type, coords);
-}
-
-inline void QOpenGLFunctions_4_2_Compatibility::glMultiTexCoordP1ui(GLenum texture, GLenum type, GLuint coords)
-{
- d_3_3_Deprecated->f.MultiTexCoordP1ui(texture, type, coords);
-}
-
-inline void QOpenGLFunctions_4_2_Compatibility::glTexCoordP4uiv(GLenum type, const GLuint *coords)
-{
- d_3_3_Deprecated->f.TexCoordP4uiv(type, coords);
-}
-
-inline void QOpenGLFunctions_4_2_Compatibility::glTexCoordP4ui(GLenum type, GLuint coords)
-{
- d_3_3_Deprecated->f.TexCoordP4ui(type, coords);
-}
-
-inline void QOpenGLFunctions_4_2_Compatibility::glTexCoordP3uiv(GLenum type, const GLuint *coords)
-{
- d_3_3_Deprecated->f.TexCoordP3uiv(type, coords);
-}
-
-inline void QOpenGLFunctions_4_2_Compatibility::glTexCoordP3ui(GLenum type, GLuint coords)
-{
- d_3_3_Deprecated->f.TexCoordP3ui(type, coords);
-}
-
-inline void QOpenGLFunctions_4_2_Compatibility::glTexCoordP2uiv(GLenum type, const GLuint *coords)
-{
- d_3_3_Deprecated->f.TexCoordP2uiv(type, coords);
-}
-
-inline void QOpenGLFunctions_4_2_Compatibility::glTexCoordP2ui(GLenum type, GLuint coords)
-{
- d_3_3_Deprecated->f.TexCoordP2ui(type, coords);
-}
-
-inline void QOpenGLFunctions_4_2_Compatibility::glTexCoordP1uiv(GLenum type, const GLuint *coords)
-{
- d_3_3_Deprecated->f.TexCoordP1uiv(type, coords);
-}
-
-inline void QOpenGLFunctions_4_2_Compatibility::glTexCoordP1ui(GLenum type, GLuint coords)
-{
- d_3_3_Deprecated->f.TexCoordP1ui(type, coords);
-}
-
-inline void QOpenGLFunctions_4_2_Compatibility::glVertexP4uiv(GLenum type, const GLuint *value)
-{
- d_3_3_Deprecated->f.VertexP4uiv(type, value);
-}
-
-inline void QOpenGLFunctions_4_2_Compatibility::glVertexP4ui(GLenum type, GLuint value)
-{
- d_3_3_Deprecated->f.VertexP4ui(type, value);
-}
-
-inline void QOpenGLFunctions_4_2_Compatibility::glVertexP3uiv(GLenum type, const GLuint *value)
-{
- d_3_3_Deprecated->f.VertexP3uiv(type, value);
-}
-
-inline void QOpenGLFunctions_4_2_Compatibility::glVertexP3ui(GLenum type, GLuint value)
-{
- d_3_3_Deprecated->f.VertexP3ui(type, value);
-}
-
-inline void QOpenGLFunctions_4_2_Compatibility::glVertexP2uiv(GLenum type, const GLuint *value)
-{
- d_3_3_Deprecated->f.VertexP2uiv(type, value);
-}
-
-inline void QOpenGLFunctions_4_2_Compatibility::glVertexP2ui(GLenum type, GLuint value)
-{
- d_3_3_Deprecated->f.VertexP2ui(type, value);
-}
-
-inline void QOpenGLFunctions_4_2_Compatibility::glGetQueryObjectui64v(GLuint id, GLenum pname, GLuint64 *params)
-{
- d_3_3_Core->f.GetQueryObjectui64v(id, pname, params);
-}
-
-inline void QOpenGLFunctions_4_2_Compatibility::glGetQueryObjecti64v(GLuint id, GLenum pname, GLint64 *params)
-{
- d_3_3_Core->f.GetQueryObjecti64v(id, pname, params);
-}
-
-inline void QOpenGLFunctions_4_2_Compatibility::glQueryCounter(GLuint id, GLenum target)
-{
- d_3_3_Core->f.QueryCounter(id, target);
-}
-
-inline void QOpenGLFunctions_4_2_Compatibility::glGetSamplerParameterIuiv(GLuint sampler, GLenum pname, GLuint *params)
-{
- d_3_3_Core->f.GetSamplerParameterIuiv(sampler, pname, params);
-}
-
-inline void QOpenGLFunctions_4_2_Compatibility::glGetSamplerParameterfv(GLuint sampler, GLenum pname, GLfloat *params)
-{
- d_3_3_Core->f.GetSamplerParameterfv(sampler, pname, params);
-}
-
-inline void QOpenGLFunctions_4_2_Compatibility::glGetSamplerParameterIiv(GLuint sampler, GLenum pname, GLint *params)
-{
- d_3_3_Core->f.GetSamplerParameterIiv(sampler, pname, params);
-}
-
-inline void QOpenGLFunctions_4_2_Compatibility::glGetSamplerParameteriv(GLuint sampler, GLenum pname, GLint *params)
-{
- d_3_3_Core->f.GetSamplerParameteriv(sampler, pname, params);
-}
-
-inline void QOpenGLFunctions_4_2_Compatibility::glSamplerParameterIuiv(GLuint sampler, GLenum pname, const GLuint *param)
-{
- d_3_3_Core->f.SamplerParameterIuiv(sampler, pname, param);
-}
-
-inline void QOpenGLFunctions_4_2_Compatibility::glSamplerParameterIiv(GLuint sampler, GLenum pname, const GLint *param)
-{
- d_3_3_Core->f.SamplerParameterIiv(sampler, pname, param);
-}
-
-inline void QOpenGLFunctions_4_2_Compatibility::glSamplerParameterfv(GLuint sampler, GLenum pname, const GLfloat *param)
-{
- d_3_3_Core->f.SamplerParameterfv(sampler, pname, param);
-}
-
-inline void QOpenGLFunctions_4_2_Compatibility::glSamplerParameterf(GLuint sampler, GLenum pname, GLfloat param)
-{
- d_3_3_Core->f.SamplerParameterf(sampler, pname, param);
-}
-
-inline void QOpenGLFunctions_4_2_Compatibility::glSamplerParameteriv(GLuint sampler, GLenum pname, const GLint *param)
-{
- d_3_3_Core->f.SamplerParameteriv(sampler, pname, param);
-}
-
-inline void QOpenGLFunctions_4_2_Compatibility::glSamplerParameteri(GLuint sampler, GLenum pname, GLint param)
-{
- d_3_3_Core->f.SamplerParameteri(sampler, pname, param);
-}
-
-inline void QOpenGLFunctions_4_2_Compatibility::glBindSampler(GLuint unit, GLuint sampler)
-{
- d_3_3_Core->f.BindSampler(unit, sampler);
-}
-
-inline GLboolean QOpenGLFunctions_4_2_Compatibility::glIsSampler(GLuint sampler)
-{
- return d_3_3_Core->f.IsSampler(sampler);
-}
-
-inline void QOpenGLFunctions_4_2_Compatibility::glDeleteSamplers(GLsizei count, const GLuint *samplers)
-{
- d_3_3_Core->f.DeleteSamplers(count, samplers);
-}
-
-inline void QOpenGLFunctions_4_2_Compatibility::glGenSamplers(GLsizei count, GLuint *samplers)
-{
- d_3_3_Core->f.GenSamplers(count, samplers);
-}
-
-inline GLint QOpenGLFunctions_4_2_Compatibility::glGetFragDataIndex(GLuint program, const GLchar *name)
-{
- return d_3_3_Core->f.GetFragDataIndex(program, name);
-}
-
-inline void QOpenGLFunctions_4_2_Compatibility::glBindFragDataLocationIndexed(GLuint program, GLuint colorNumber, GLuint index, const GLchar *name)
-{
- d_3_3_Core->f.BindFragDataLocationIndexed(program, colorNumber, index, name);
-}
-
-inline void QOpenGLFunctions_4_2_Compatibility::glVertexAttribDivisor(GLuint index, GLuint divisor)
-{
- d_3_3_Core->f.VertexAttribDivisor(index, divisor);
-}
-
-
-// OpenGL 4.0 core functions
-inline void QOpenGLFunctions_4_2_Compatibility::glGetQueryIndexediv(GLenum target, GLuint index, GLenum pname, GLint *params)
-{
- d_4_0_Core->f.GetQueryIndexediv(target, index, pname, params);
-}
-
-inline void QOpenGLFunctions_4_2_Compatibility::glEndQueryIndexed(GLenum target, GLuint index)
-{
- d_4_0_Core->f.EndQueryIndexed(target, index);
-}
-
-inline void QOpenGLFunctions_4_2_Compatibility::glBeginQueryIndexed(GLenum target, GLuint index, GLuint id)
-{
- d_4_0_Core->f.BeginQueryIndexed(target, index, id);
-}
-
-inline void QOpenGLFunctions_4_2_Compatibility::glDrawTransformFeedbackStream(GLenum mode, GLuint id, GLuint stream)
-{
- d_4_0_Core->f.DrawTransformFeedbackStream(mode, id, stream);
-}
-
-inline void QOpenGLFunctions_4_2_Compatibility::glDrawTransformFeedback(GLenum mode, GLuint id)
-{
- d_4_0_Core->f.DrawTransformFeedback(mode, id);
-}
-
-inline void QOpenGLFunctions_4_2_Compatibility::glResumeTransformFeedback()
-{
- d_4_0_Core->f.ResumeTransformFeedback();
-}
-
-inline void QOpenGLFunctions_4_2_Compatibility::glPauseTransformFeedback()
-{
- d_4_0_Core->f.PauseTransformFeedback();
-}
-
-inline GLboolean QOpenGLFunctions_4_2_Compatibility::glIsTransformFeedback(GLuint id)
-{
- return d_4_0_Core->f.IsTransformFeedback(id);
-}
-
-inline void QOpenGLFunctions_4_2_Compatibility::glGenTransformFeedbacks(GLsizei n, GLuint *ids)
-{
- d_4_0_Core->f.GenTransformFeedbacks(n, ids);
-}
-
-inline void QOpenGLFunctions_4_2_Compatibility::glDeleteTransformFeedbacks(GLsizei n, const GLuint *ids)
-{
- d_4_0_Core->f.DeleteTransformFeedbacks(n, ids);
-}
-
-inline void QOpenGLFunctions_4_2_Compatibility::glBindTransformFeedback(GLenum target, GLuint id)
-{
- d_4_0_Core->f.BindTransformFeedback(target, id);
-}
-
-inline void QOpenGLFunctions_4_2_Compatibility::glPatchParameterfv(GLenum pname, const GLfloat *values)
-{
- d_4_0_Core->f.PatchParameterfv(pname, values);
-}
-
-inline void QOpenGLFunctions_4_2_Compatibility::glPatchParameteri(GLenum pname, GLint value)
-{
- d_4_0_Core->f.PatchParameteri(pname, value);
-}
-
-inline void QOpenGLFunctions_4_2_Compatibility::glGetProgramStageiv(GLuint program, GLenum shadertype, GLenum pname, GLint *values)
-{
- d_4_0_Core->f.GetProgramStageiv(program, shadertype, pname, values);
-}
-
-inline void QOpenGLFunctions_4_2_Compatibility::glGetUniformSubroutineuiv(GLenum shadertype, GLint location, GLuint *params)
-{
- d_4_0_Core->f.GetUniformSubroutineuiv(shadertype, location, params);
-}
-
-inline void QOpenGLFunctions_4_2_Compatibility::glUniformSubroutinesuiv(GLenum shadertype, GLsizei count, const GLuint *indices)
-{
- d_4_0_Core->f.UniformSubroutinesuiv(shadertype, count, indices);
-}
-
-inline void QOpenGLFunctions_4_2_Compatibility::glGetActiveSubroutineName(GLuint program, GLenum shadertype, GLuint index, GLsizei bufsize, GLsizei *length, GLchar *name)
-{
- d_4_0_Core->f.GetActiveSubroutineName(program, shadertype, index, bufsize, length, name);
-}
-
-inline void QOpenGLFunctions_4_2_Compatibility::glGetActiveSubroutineUniformName(GLuint program, GLenum shadertype, GLuint index, GLsizei bufsize, GLsizei *length, GLchar *name)
-{
- d_4_0_Core->f.GetActiveSubroutineUniformName(program, shadertype, index, bufsize, length, name);
-}
-
-inline void QOpenGLFunctions_4_2_Compatibility::glGetActiveSubroutineUniformiv(GLuint program, GLenum shadertype, GLuint index, GLenum pname, GLint *values)
-{
- d_4_0_Core->f.GetActiveSubroutineUniformiv(program, shadertype, index, pname, values);
-}
-
-inline GLuint QOpenGLFunctions_4_2_Compatibility::glGetSubroutineIndex(GLuint program, GLenum shadertype, const GLchar *name)
-{
- return d_4_0_Core->f.GetSubroutineIndex(program, shadertype, name);
-}
-
-inline GLint QOpenGLFunctions_4_2_Compatibility::glGetSubroutineUniformLocation(GLuint program, GLenum shadertype, const GLchar *name)
-{
- return d_4_0_Core->f.GetSubroutineUniformLocation(program, shadertype, name);
-}
-
-inline void QOpenGLFunctions_4_2_Compatibility::glGetUniformdv(GLuint program, GLint location, GLdouble *params)
-{
- d_4_0_Core->f.GetUniformdv(program, location, params);
-}
-
-inline void QOpenGLFunctions_4_2_Compatibility::glUniformMatrix4x3dv(GLint location, GLsizei count, GLboolean transpose, const GLdouble *value)
-{
- d_4_0_Core->f.UniformMatrix4x3dv(location, count, transpose, value);
-}
-
-inline void QOpenGLFunctions_4_2_Compatibility::glUniformMatrix4x2dv(GLint location, GLsizei count, GLboolean transpose, const GLdouble *value)
-{
- d_4_0_Core->f.UniformMatrix4x2dv(location, count, transpose, value);
-}
-
-inline void QOpenGLFunctions_4_2_Compatibility::glUniformMatrix3x4dv(GLint location, GLsizei count, GLboolean transpose, const GLdouble *value)
-{
- d_4_0_Core->f.UniformMatrix3x4dv(location, count, transpose, value);
-}
-
-inline void QOpenGLFunctions_4_2_Compatibility::glUniformMatrix3x2dv(GLint location, GLsizei count, GLboolean transpose, const GLdouble *value)
-{
- d_4_0_Core->f.UniformMatrix3x2dv(location, count, transpose, value);
-}
-
-inline void QOpenGLFunctions_4_2_Compatibility::glUniformMatrix2x4dv(GLint location, GLsizei count, GLboolean transpose, const GLdouble *value)
-{
- d_4_0_Core->f.UniformMatrix2x4dv(location, count, transpose, value);
-}
-
-inline void QOpenGLFunctions_4_2_Compatibility::glUniformMatrix2x3dv(GLint location, GLsizei count, GLboolean transpose, const GLdouble *value)
-{
- d_4_0_Core->f.UniformMatrix2x3dv(location, count, transpose, value);
-}
-
-inline void QOpenGLFunctions_4_2_Compatibility::glUniformMatrix4dv(GLint location, GLsizei count, GLboolean transpose, const GLdouble *value)
-{
- d_4_0_Core->f.UniformMatrix4dv(location, count, transpose, value);
-}
-
-inline void QOpenGLFunctions_4_2_Compatibility::glUniformMatrix3dv(GLint location, GLsizei count, GLboolean transpose, const GLdouble *value)
-{
- d_4_0_Core->f.UniformMatrix3dv(location, count, transpose, value);
-}
-
-inline void QOpenGLFunctions_4_2_Compatibility::glUniformMatrix2dv(GLint location, GLsizei count, GLboolean transpose, const GLdouble *value)
-{
- d_4_0_Core->f.UniformMatrix2dv(location, count, transpose, value);
-}
-
-inline void QOpenGLFunctions_4_2_Compatibility::glUniform4dv(GLint location, GLsizei count, const GLdouble *value)
-{
- d_4_0_Core->f.Uniform4dv(location, count, value);
-}
-
-inline void QOpenGLFunctions_4_2_Compatibility::glUniform3dv(GLint location, GLsizei count, const GLdouble *value)
-{
- d_4_0_Core->f.Uniform3dv(location, count, value);
-}
-
-inline void QOpenGLFunctions_4_2_Compatibility::glUniform2dv(GLint location, GLsizei count, const GLdouble *value)
-{
- d_4_0_Core->f.Uniform2dv(location, count, value);
-}
-
-inline void QOpenGLFunctions_4_2_Compatibility::glUniform1dv(GLint location, GLsizei count, const GLdouble *value)
-{
- d_4_0_Core->f.Uniform1dv(location, count, value);
-}
-
-inline void QOpenGLFunctions_4_2_Compatibility::glUniform4d(GLint location, GLdouble x, GLdouble y, GLdouble z, GLdouble w)
-{
- d_4_0_Core->f.Uniform4d(location, x, y, z, w);
-}
-
-inline void QOpenGLFunctions_4_2_Compatibility::glUniform3d(GLint location, GLdouble x, GLdouble y, GLdouble z)
-{
- d_4_0_Core->f.Uniform3d(location, x, y, z);
-}
-
-inline void QOpenGLFunctions_4_2_Compatibility::glUniform2d(GLint location, GLdouble x, GLdouble y)
-{
- d_4_0_Core->f.Uniform2d(location, x, y);
-}
-
-inline void QOpenGLFunctions_4_2_Compatibility::glUniform1d(GLint location, GLdouble x)
-{
- d_4_0_Core->f.Uniform1d(location, x);
-}
-
-inline void QOpenGLFunctions_4_2_Compatibility::glDrawElementsIndirect(GLenum mode, GLenum type, const GLvoid *indirect)
-{
- d_4_0_Core->f.DrawElementsIndirect(mode, type, indirect);
-}
-
-inline void QOpenGLFunctions_4_2_Compatibility::glDrawArraysIndirect(GLenum mode, const GLvoid *indirect)
-{
- d_4_0_Core->f.DrawArraysIndirect(mode, indirect);
-}
-
-inline void QOpenGLFunctions_4_2_Compatibility::glBlendFuncSeparatei(GLuint buf, GLenum srcRGB, GLenum dstRGB, GLenum srcAlpha, GLenum dstAlpha)
-{
- d_4_0_Core->f.BlendFuncSeparatei(buf, srcRGB, dstRGB, srcAlpha, dstAlpha);
-}
-
-inline void QOpenGLFunctions_4_2_Compatibility::glBlendFunci(GLuint buf, GLenum src, GLenum dst)
-{
- d_4_0_Core->f.BlendFunci(buf, src, dst);
-}
-
-inline void QOpenGLFunctions_4_2_Compatibility::glBlendEquationSeparatei(GLuint buf, GLenum modeRGB, GLenum modeAlpha)
-{
- d_4_0_Core->f.BlendEquationSeparatei(buf, modeRGB, modeAlpha);
-}
-
-inline void QOpenGLFunctions_4_2_Compatibility::glBlendEquationi(GLuint buf, GLenum mode)
-{
- d_4_0_Core->f.BlendEquationi(buf, mode);
-}
-
-inline void QOpenGLFunctions_4_2_Compatibility::glMinSampleShading(GLfloat value)
-{
- d_4_0_Core->f.MinSampleShading(value);
-}
-
-
-// OpenGL 4.1 core functions
-inline void QOpenGLFunctions_4_2_Compatibility::glGetDoublei_v(GLenum target, GLuint index, GLdouble *data)
-{
- d_4_1_Core->f.GetDoublei_v(target, index, data);
-}
-
-inline void QOpenGLFunctions_4_2_Compatibility::glGetFloati_v(GLenum target, GLuint index, GLfloat *data)
-{
- d_4_1_Core->f.GetFloati_v(target, index, data);
-}
-
-inline void QOpenGLFunctions_4_2_Compatibility::glDepthRangeIndexed(GLuint index, GLdouble n, GLdouble f)
-{
- d_4_1_Core->f.DepthRangeIndexed(index, n, f);
-}
-
-inline void QOpenGLFunctions_4_2_Compatibility::glDepthRangeArrayv(GLuint first, GLsizei count, const GLdouble *v)
-{
- d_4_1_Core->f.DepthRangeArrayv(first, count, v);
-}
-
-inline void QOpenGLFunctions_4_2_Compatibility::glScissorIndexedv(GLuint index, const GLint *v)
-{
- d_4_1_Core->f.ScissorIndexedv(index, v);
-}
-
-inline void QOpenGLFunctions_4_2_Compatibility::glScissorIndexed(GLuint index, GLint left, GLint bottom, GLsizei width, GLsizei height)
-{
- d_4_1_Core->f.ScissorIndexed(index, left, bottom, width, height);
-}
-
-inline void QOpenGLFunctions_4_2_Compatibility::glScissorArrayv(GLuint first, GLsizei count, const GLint *v)
-{
- d_4_1_Core->f.ScissorArrayv(first, count, v);
-}
-
-inline void QOpenGLFunctions_4_2_Compatibility::glViewportIndexedfv(GLuint index, const GLfloat *v)
-{
- d_4_1_Core->f.ViewportIndexedfv(index, v);
-}
-
-inline void QOpenGLFunctions_4_2_Compatibility::glViewportIndexedf(GLuint index, GLfloat x, GLfloat y, GLfloat w, GLfloat h)
-{
- d_4_1_Core->f.ViewportIndexedf(index, x, y, w, h);
-}
-
-inline void QOpenGLFunctions_4_2_Compatibility::glViewportArrayv(GLuint first, GLsizei count, const GLfloat *v)
-{
- d_4_1_Core->f.ViewportArrayv(first, count, v);
-}
-
-inline void QOpenGLFunctions_4_2_Compatibility::glGetVertexAttribLdv(GLuint index, GLenum pname, GLdouble *params)
-{
- d_4_1_Core->f.GetVertexAttribLdv(index, pname, params);
-}
-
-inline void QOpenGLFunctions_4_2_Compatibility::glVertexAttribLPointer(GLuint index, GLint size, GLenum type, GLsizei stride, const GLvoid *pointer)
-{
- d_4_1_Core->f.VertexAttribLPointer(index, size, type, stride, pointer);
-}
-
-inline void QOpenGLFunctions_4_2_Compatibility::glVertexAttribL4dv(GLuint index, const GLdouble *v)
-{
- d_4_1_Core->f.VertexAttribL4dv(index, v);
-}
-
-inline void QOpenGLFunctions_4_2_Compatibility::glVertexAttribL3dv(GLuint index, const GLdouble *v)
-{
- d_4_1_Core->f.VertexAttribL3dv(index, v);
-}
-
-inline void QOpenGLFunctions_4_2_Compatibility::glVertexAttribL2dv(GLuint index, const GLdouble *v)
-{
- d_4_1_Core->f.VertexAttribL2dv(index, v);
-}
-
-inline void QOpenGLFunctions_4_2_Compatibility::glVertexAttribL1dv(GLuint index, const GLdouble *v)
-{
- d_4_1_Core->f.VertexAttribL1dv(index, v);
-}
-
-inline void QOpenGLFunctions_4_2_Compatibility::glVertexAttribL4d(GLuint index, GLdouble x, GLdouble y, GLdouble z, GLdouble w)
-{
- d_4_1_Core->f.VertexAttribL4d(index, x, y, z, w);
-}
-
-inline void QOpenGLFunctions_4_2_Compatibility::glVertexAttribL3d(GLuint index, GLdouble x, GLdouble y, GLdouble z)
-{
- d_4_1_Core->f.VertexAttribL3d(index, x, y, z);
-}
-
-inline void QOpenGLFunctions_4_2_Compatibility::glVertexAttribL2d(GLuint index, GLdouble x, GLdouble y)
-{
- d_4_1_Core->f.VertexAttribL2d(index, x, y);
-}
-
-inline void QOpenGLFunctions_4_2_Compatibility::glVertexAttribL1d(GLuint index, GLdouble x)
-{
- d_4_1_Core->f.VertexAttribL1d(index, x);
-}
-
-inline void QOpenGLFunctions_4_2_Compatibility::glGetProgramPipelineInfoLog(GLuint pipeline, GLsizei bufSize, GLsizei *length, GLchar *infoLog)
-{
- d_4_1_Core->f.GetProgramPipelineInfoLog(pipeline, bufSize, length, infoLog);
-}
-
-inline void QOpenGLFunctions_4_2_Compatibility::glValidateProgramPipeline(GLuint pipeline)
-{
- d_4_1_Core->f.ValidateProgramPipeline(pipeline);
-}
-
-inline void QOpenGLFunctions_4_2_Compatibility::glProgramUniformMatrix4x3dv(GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLdouble *value)
-{
- d_4_1_Core->f.ProgramUniformMatrix4x3dv(program, location, count, transpose, value);
-}
-
-inline void QOpenGLFunctions_4_2_Compatibility::glProgramUniformMatrix3x4dv(GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLdouble *value)
-{
- d_4_1_Core->f.ProgramUniformMatrix3x4dv(program, location, count, transpose, value);
-}
-
-inline void QOpenGLFunctions_4_2_Compatibility::glProgramUniformMatrix4x2dv(GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLdouble *value)
-{
- d_4_1_Core->f.ProgramUniformMatrix4x2dv(program, location, count, transpose, value);
-}
-
-inline void QOpenGLFunctions_4_2_Compatibility::glProgramUniformMatrix2x4dv(GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLdouble *value)
-{
- d_4_1_Core->f.ProgramUniformMatrix2x4dv(program, location, count, transpose, value);
-}
-
-inline void QOpenGLFunctions_4_2_Compatibility::glProgramUniformMatrix3x2dv(GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLdouble *value)
-{
- d_4_1_Core->f.ProgramUniformMatrix3x2dv(program, location, count, transpose, value);
-}
-
-inline void QOpenGLFunctions_4_2_Compatibility::glProgramUniformMatrix2x3dv(GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLdouble *value)
-{
- d_4_1_Core->f.ProgramUniformMatrix2x3dv(program, location, count, transpose, value);
-}
-
-inline void QOpenGLFunctions_4_2_Compatibility::glProgramUniformMatrix4x3fv(GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value)
-{
- d_4_1_Core->f.ProgramUniformMatrix4x3fv(program, location, count, transpose, value);
-}
-
-inline void QOpenGLFunctions_4_2_Compatibility::glProgramUniformMatrix3x4fv(GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value)
-{
- d_4_1_Core->f.ProgramUniformMatrix3x4fv(program, location, count, transpose, value);
-}
-
-inline void QOpenGLFunctions_4_2_Compatibility::glProgramUniformMatrix4x2fv(GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value)
-{
- d_4_1_Core->f.ProgramUniformMatrix4x2fv(program, location, count, transpose, value);
-}
-
-inline void QOpenGLFunctions_4_2_Compatibility::glProgramUniformMatrix2x4fv(GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value)
-{
- d_4_1_Core->f.ProgramUniformMatrix2x4fv(program, location, count, transpose, value);
-}
-
-inline void QOpenGLFunctions_4_2_Compatibility::glProgramUniformMatrix3x2fv(GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value)
-{
- d_4_1_Core->f.ProgramUniformMatrix3x2fv(program, location, count, transpose, value);
-}
-
-inline void QOpenGLFunctions_4_2_Compatibility::glProgramUniformMatrix2x3fv(GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value)
-{
- d_4_1_Core->f.ProgramUniformMatrix2x3fv(program, location, count, transpose, value);
-}
-
-inline void QOpenGLFunctions_4_2_Compatibility::glProgramUniformMatrix4dv(GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLdouble *value)
-{
- d_4_1_Core->f.ProgramUniformMatrix4dv(program, location, count, transpose, value);
-}
-
-inline void QOpenGLFunctions_4_2_Compatibility::glProgramUniformMatrix3dv(GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLdouble *value)
-{
- d_4_1_Core->f.ProgramUniformMatrix3dv(program, location, count, transpose, value);
-}
-
-inline void QOpenGLFunctions_4_2_Compatibility::glProgramUniformMatrix2dv(GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLdouble *value)
-{
- d_4_1_Core->f.ProgramUniformMatrix2dv(program, location, count, transpose, value);
-}
-
-inline void QOpenGLFunctions_4_2_Compatibility::glProgramUniformMatrix4fv(GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value)
-{
- d_4_1_Core->f.ProgramUniformMatrix4fv(program, location, count, transpose, value);
-}
-
-inline void QOpenGLFunctions_4_2_Compatibility::glProgramUniformMatrix3fv(GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value)
-{
- d_4_1_Core->f.ProgramUniformMatrix3fv(program, location, count, transpose, value);
-}
-
-inline void QOpenGLFunctions_4_2_Compatibility::glProgramUniformMatrix2fv(GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value)
-{
- d_4_1_Core->f.ProgramUniformMatrix2fv(program, location, count, transpose, value);
-}
-
-inline void QOpenGLFunctions_4_2_Compatibility::glProgramUniform4uiv(GLuint program, GLint location, GLsizei count, const GLuint *value)
-{
- d_4_1_Core->f.ProgramUniform4uiv(program, location, count, value);
-}
-
-inline void QOpenGLFunctions_4_2_Compatibility::glProgramUniform4ui(GLuint program, GLint location, GLuint v0, GLuint v1, GLuint v2, GLuint v3)
-{
- d_4_1_Core->f.ProgramUniform4ui(program, location, v0, v1, v2, v3);
-}
-
-inline void QOpenGLFunctions_4_2_Compatibility::glProgramUniform4dv(GLuint program, GLint location, GLsizei count, const GLdouble *value)
-{
- d_4_1_Core->f.ProgramUniform4dv(program, location, count, value);
-}
-
-inline void QOpenGLFunctions_4_2_Compatibility::glProgramUniform4d(GLuint program, GLint location, GLdouble v0, GLdouble v1, GLdouble v2, GLdouble v3)
-{
- d_4_1_Core->f.ProgramUniform4d(program, location, v0, v1, v2, v3);
-}
-
-inline void QOpenGLFunctions_4_2_Compatibility::glProgramUniform4fv(GLuint program, GLint location, GLsizei count, const GLfloat *value)
-{
- d_4_1_Core->f.ProgramUniform4fv(program, location, count, value);
-}
-
-inline void QOpenGLFunctions_4_2_Compatibility::glProgramUniform4f(GLuint program, GLint location, GLfloat v0, GLfloat v1, GLfloat v2, GLfloat v3)
-{
- d_4_1_Core->f.ProgramUniform4f(program, location, v0, v1, v2, v3);
-}
-
-inline void QOpenGLFunctions_4_2_Compatibility::glProgramUniform4iv(GLuint program, GLint location, GLsizei count, const GLint *value)
-{
- d_4_1_Core->f.ProgramUniform4iv(program, location, count, value);
-}
-
-inline void QOpenGLFunctions_4_2_Compatibility::glProgramUniform4i(GLuint program, GLint location, GLint v0, GLint v1, GLint v2, GLint v3)
-{
- d_4_1_Core->f.ProgramUniform4i(program, location, v0, v1, v2, v3);
-}
-
-inline void QOpenGLFunctions_4_2_Compatibility::glProgramUniform3uiv(GLuint program, GLint location, GLsizei count, const GLuint *value)
-{
- d_4_1_Core->f.ProgramUniform3uiv(program, location, count, value);
-}
-
-inline void QOpenGLFunctions_4_2_Compatibility::glProgramUniform3ui(GLuint program, GLint location, GLuint v0, GLuint v1, GLuint v2)
-{
- d_4_1_Core->f.ProgramUniform3ui(program, location, v0, v1, v2);
-}
-
-inline void QOpenGLFunctions_4_2_Compatibility::glProgramUniform3dv(GLuint program, GLint location, GLsizei count, const GLdouble *value)
-{
- d_4_1_Core->f.ProgramUniform3dv(program, location, count, value);
-}
-
-inline void QOpenGLFunctions_4_2_Compatibility::glProgramUniform3d(GLuint program, GLint location, GLdouble v0, GLdouble v1, GLdouble v2)
-{
- d_4_1_Core->f.ProgramUniform3d(program, location, v0, v1, v2);
-}
-
-inline void QOpenGLFunctions_4_2_Compatibility::glProgramUniform3fv(GLuint program, GLint location, GLsizei count, const GLfloat *value)
-{
- d_4_1_Core->f.ProgramUniform3fv(program, location, count, value);
-}
-
-inline void QOpenGLFunctions_4_2_Compatibility::glProgramUniform3f(GLuint program, GLint location, GLfloat v0, GLfloat v1, GLfloat v2)
-{
- d_4_1_Core->f.ProgramUniform3f(program, location, v0, v1, v2);
-}
-
-inline void QOpenGLFunctions_4_2_Compatibility::glProgramUniform3iv(GLuint program, GLint location, GLsizei count, const GLint *value)
-{
- d_4_1_Core->f.ProgramUniform3iv(program, location, count, value);
-}
-
-inline void QOpenGLFunctions_4_2_Compatibility::glProgramUniform3i(GLuint program, GLint location, GLint v0, GLint v1, GLint v2)
-{
- d_4_1_Core->f.ProgramUniform3i(program, location, v0, v1, v2);
-}
-
-inline void QOpenGLFunctions_4_2_Compatibility::glProgramUniform2uiv(GLuint program, GLint location, GLsizei count, const GLuint *value)
-{
- d_4_1_Core->f.ProgramUniform2uiv(program, location, count, value);
-}
-
-inline void QOpenGLFunctions_4_2_Compatibility::glProgramUniform2ui(GLuint program, GLint location, GLuint v0, GLuint v1)
-{
- d_4_1_Core->f.ProgramUniform2ui(program, location, v0, v1);
-}
-
-inline void QOpenGLFunctions_4_2_Compatibility::glProgramUniform2dv(GLuint program, GLint location, GLsizei count, const GLdouble *value)
-{
- d_4_1_Core->f.ProgramUniform2dv(program, location, count, value);
-}
-
-inline void QOpenGLFunctions_4_2_Compatibility::glProgramUniform2d(GLuint program, GLint location, GLdouble v0, GLdouble v1)
-{
- d_4_1_Core->f.ProgramUniform2d(program, location, v0, v1);
-}
-
-inline void QOpenGLFunctions_4_2_Compatibility::glProgramUniform2fv(GLuint program, GLint location, GLsizei count, const GLfloat *value)
-{
- d_4_1_Core->f.ProgramUniform2fv(program, location, count, value);
-}
-
-inline void QOpenGLFunctions_4_2_Compatibility::glProgramUniform2f(GLuint program, GLint location, GLfloat v0, GLfloat v1)
-{
- d_4_1_Core->f.ProgramUniform2f(program, location, v0, v1);
-}
-
-inline void QOpenGLFunctions_4_2_Compatibility::glProgramUniform2iv(GLuint program, GLint location, GLsizei count, const GLint *value)
-{
- d_4_1_Core->f.ProgramUniform2iv(program, location, count, value);
-}
-
-inline void QOpenGLFunctions_4_2_Compatibility::glProgramUniform2i(GLuint program, GLint location, GLint v0, GLint v1)
-{
- d_4_1_Core->f.ProgramUniform2i(program, location, v0, v1);
-}
-
-inline void QOpenGLFunctions_4_2_Compatibility::glProgramUniform1uiv(GLuint program, GLint location, GLsizei count, const GLuint *value)
-{
- d_4_1_Core->f.ProgramUniform1uiv(program, location, count, value);
-}
-
-inline void QOpenGLFunctions_4_2_Compatibility::glProgramUniform1ui(GLuint program, GLint location, GLuint v0)
-{
- d_4_1_Core->f.ProgramUniform1ui(program, location, v0);
-}
-
-inline void QOpenGLFunctions_4_2_Compatibility::glProgramUniform1dv(GLuint program, GLint location, GLsizei count, const GLdouble *value)
-{
- d_4_1_Core->f.ProgramUniform1dv(program, location, count, value);
-}
-
-inline void QOpenGLFunctions_4_2_Compatibility::glProgramUniform1d(GLuint program, GLint location, GLdouble v0)
-{
- d_4_1_Core->f.ProgramUniform1d(program, location, v0);
-}
-
-inline void QOpenGLFunctions_4_2_Compatibility::glProgramUniform1fv(GLuint program, GLint location, GLsizei count, const GLfloat *value)
-{
- d_4_1_Core->f.ProgramUniform1fv(program, location, count, value);
-}
-
-inline void QOpenGLFunctions_4_2_Compatibility::glProgramUniform1f(GLuint program, GLint location, GLfloat v0)
-{
- d_4_1_Core->f.ProgramUniform1f(program, location, v0);
-}
-
-inline void QOpenGLFunctions_4_2_Compatibility::glProgramUniform1iv(GLuint program, GLint location, GLsizei count, const GLint *value)
-{
- d_4_1_Core->f.ProgramUniform1iv(program, location, count, value);
-}
-
-inline void QOpenGLFunctions_4_2_Compatibility::glProgramUniform1i(GLuint program, GLint location, GLint v0)
-{
- d_4_1_Core->f.ProgramUniform1i(program, location, v0);
-}
-
-inline void QOpenGLFunctions_4_2_Compatibility::glGetProgramPipelineiv(GLuint pipeline, GLenum pname, GLint *params)
-{
- d_4_1_Core->f.GetProgramPipelineiv(pipeline, pname, params);
-}
-
-inline GLboolean QOpenGLFunctions_4_2_Compatibility::glIsProgramPipeline(GLuint pipeline)
-{
- return d_4_1_Core->f.IsProgramPipeline(pipeline);
-}
-
-inline void QOpenGLFunctions_4_2_Compatibility::glGenProgramPipelines(GLsizei n, GLuint *pipelines)
-{
- d_4_1_Core->f.GenProgramPipelines(n, pipelines);
-}
-
-inline void QOpenGLFunctions_4_2_Compatibility::glDeleteProgramPipelines(GLsizei n, const GLuint *pipelines)
-{
- d_4_1_Core->f.DeleteProgramPipelines(n, pipelines);
-}
-
-inline void QOpenGLFunctions_4_2_Compatibility::glBindProgramPipeline(GLuint pipeline)
-{
- d_4_1_Core->f.BindProgramPipeline(pipeline);
-}
-
-inline GLuint QOpenGLFunctions_4_2_Compatibility::glCreateShaderProgramv(GLenum type, GLsizei count, const GLchar* const *strings)
-{
- return d_4_1_Core->f.CreateShaderProgramv(type, count, strings);
-}
-
-inline void QOpenGLFunctions_4_2_Compatibility::glActiveShaderProgram(GLuint pipeline, GLuint program)
-{
- d_4_1_Core->f.ActiveShaderProgram(pipeline, program);
-}
-
-inline void QOpenGLFunctions_4_2_Compatibility::glUseProgramStages(GLuint pipeline, GLbitfield stages, GLuint program)
-{
- d_4_1_Core->f.UseProgramStages(pipeline, stages, program);
-}
-
-inline void QOpenGLFunctions_4_2_Compatibility::glProgramParameteri(GLuint program, GLenum pname, GLint value)
-{
- d_4_1_Core->f.ProgramParameteri(program, pname, value);
-}
-
-inline void QOpenGLFunctions_4_2_Compatibility::glProgramBinary(GLuint program, GLenum binaryFormat, const GLvoid *binary, GLsizei length)
-{
- d_4_1_Core->f.ProgramBinary(program, binaryFormat, binary, length);
-}
-
-inline void QOpenGLFunctions_4_2_Compatibility::glGetProgramBinary(GLuint program, GLsizei bufSize, GLsizei *length, GLenum *binaryFormat, GLvoid *binary)
-{
- d_4_1_Core->f.GetProgramBinary(program, bufSize, length, binaryFormat, binary);
-}
-
-inline void QOpenGLFunctions_4_2_Compatibility::glClearDepthf(GLfloat dd)
-{
- d_4_1_Core->f.ClearDepthf(dd);
-}
-
-inline void QOpenGLFunctions_4_2_Compatibility::glDepthRangef(GLfloat n, GLfloat f)
-{
- d_4_1_Core->f.DepthRangef(n, f);
-}
-
-inline void QOpenGLFunctions_4_2_Compatibility::glGetShaderPrecisionFormat(GLenum shadertype, GLenum precisiontype, GLint *range, GLint *precision)
-{
- d_4_1_Core->f.GetShaderPrecisionFormat(shadertype, precisiontype, range, precision);
-}
-
-inline void QOpenGLFunctions_4_2_Compatibility::glShaderBinary(GLsizei count, const GLuint *shaders, GLenum binaryformat, const GLvoid *binary, GLsizei length)
-{
- d_4_1_Core->f.ShaderBinary(count, shaders, binaryformat, binary, length);
-}
-
-inline void QOpenGLFunctions_4_2_Compatibility::glReleaseShaderCompiler()
-{
- d_4_1_Core->f.ReleaseShaderCompiler();
-}
-
-
-// OpenGL 4.2 core functions
-inline void QOpenGLFunctions_4_2_Compatibility::glTexStorage3D(GLenum target, GLsizei levels, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth)
-{
- d_4_2_Core->f.TexStorage3D(target, levels, internalformat, width, height, depth);
-}
-
-inline void QOpenGLFunctions_4_2_Compatibility::glTexStorage2D(GLenum target, GLsizei levels, GLenum internalformat, GLsizei width, GLsizei height)
-{
- d_4_2_Core->f.TexStorage2D(target, levels, internalformat, width, height);
-}
-
-inline void QOpenGLFunctions_4_2_Compatibility::glTexStorage1D(GLenum target, GLsizei levels, GLenum internalformat, GLsizei width)
-{
- d_4_2_Core->f.TexStorage1D(target, levels, internalformat, width);
-}
-
-inline void QOpenGLFunctions_4_2_Compatibility::glMemoryBarrier(GLbitfield barriers)
-{
- d_4_2_Core->f.MemoryBarrier(barriers);
-}
-
-inline void QOpenGLFunctions_4_2_Compatibility::glBindImageTexture(GLuint unit, GLuint texture, GLint level, GLboolean layered, GLint layer, GLenum access, GLenum format)
-{
- d_4_2_Core->f.BindImageTexture(unit, texture, level, layered, layer, access, format);
-}
-
-inline void QOpenGLFunctions_4_2_Compatibility::glGetActiveAtomicCounterBufferiv(GLuint program, GLuint bufferIndex, GLenum pname, GLint *params)
-{
- d_4_2_Core->f.GetActiveAtomicCounterBufferiv(program, bufferIndex, pname, params);
-}
-
-inline void QOpenGLFunctions_4_2_Compatibility::glGetInternalformativ(GLenum target, GLenum internalformat, GLenum pname, GLsizei bufSize, GLint *params)
-{
- d_4_2_Core->f.GetInternalformativ(target, internalformat, pname, bufSize, params);
-}
-
-inline void QOpenGLFunctions_4_2_Compatibility::glDrawTransformFeedbackStreamInstanced(GLenum mode, GLuint id, GLuint stream, GLsizei instancecount)
-{
- d_4_2_Core->f.DrawTransformFeedbackStreamInstanced(mode, id, stream, instancecount);
-}
-
-inline void QOpenGLFunctions_4_2_Compatibility::glDrawTransformFeedbackInstanced(GLenum mode, GLuint id, GLsizei instancecount)
-{
- d_4_2_Core->f.DrawTransformFeedbackInstanced(mode, id, instancecount);
-}
-
-inline void QOpenGLFunctions_4_2_Compatibility::glDrawElementsInstancedBaseVertexBaseInstance(GLenum mode, GLsizei count, GLenum type, const void *indices, GLsizei instancecount, GLint basevertex, GLuint baseinstance)
-{
- d_4_2_Core->f.DrawElementsInstancedBaseVertexBaseInstance(mode, count, type, indices, instancecount, basevertex, baseinstance);
-}
-
-inline void QOpenGLFunctions_4_2_Compatibility::glDrawElementsInstancedBaseInstance(GLenum mode, GLsizei count, GLenum type, const void *indices, GLsizei instancecount, GLuint baseinstance)
-{
- d_4_2_Core->f.DrawElementsInstancedBaseInstance(mode, count, type, indices, instancecount, baseinstance);
-}
-
-inline void QOpenGLFunctions_4_2_Compatibility::glDrawArraysInstancedBaseInstance(GLenum mode, GLint first, GLsizei count, GLsizei instancecount, GLuint baseinstance)
-{
- d_4_2_Core->f.DrawArraysInstancedBaseInstance(mode, first, count, instancecount, baseinstance);
-}
-
-
-// OpenGL 1.0 deprecated functions
-inline void QOpenGLFunctions_4_2_Compatibility::glTranslatef(GLfloat x, GLfloat y, GLfloat z)
-{
- d_1_0_Deprecated->f.Translatef(x, y, z);
-}
-
-inline void QOpenGLFunctions_4_2_Compatibility::glTranslated(GLdouble x, GLdouble y, GLdouble z)
-{
- d_1_0_Deprecated->f.Translated(x, y, z);
-}
-
-inline void QOpenGLFunctions_4_2_Compatibility::glScalef(GLfloat x, GLfloat y, GLfloat z)
-{
- d_1_0_Deprecated->f.Scalef(x, y, z);
-}
-
-inline void QOpenGLFunctions_4_2_Compatibility::glScaled(GLdouble x, GLdouble y, GLdouble z)
-{
- d_1_0_Deprecated->f.Scaled(x, y, z);
-}
-
-inline void QOpenGLFunctions_4_2_Compatibility::glRotatef(GLfloat angle, GLfloat x, GLfloat y, GLfloat z)
-{
- d_1_0_Deprecated->f.Rotatef(angle, x, y, z);
-}
-
-inline void QOpenGLFunctions_4_2_Compatibility::glRotated(GLdouble angle, GLdouble x, GLdouble y, GLdouble z)
-{
- d_1_0_Deprecated->f.Rotated(angle, x, y, z);
-}
-
-inline void QOpenGLFunctions_4_2_Compatibility::glPushMatrix()
-{
- d_1_0_Deprecated->f.PushMatrix();
-}
-
-inline void QOpenGLFunctions_4_2_Compatibility::glPopMatrix()
-{
- d_1_0_Deprecated->f.PopMatrix();
-}
-
-inline void QOpenGLFunctions_4_2_Compatibility::glOrtho(GLdouble left, GLdouble right, GLdouble bottom, GLdouble top, GLdouble zNear, GLdouble zFar)
-{
- d_1_0_Deprecated->f.Ortho(left, right, bottom, top, zNear, zFar);
-}
-
-inline void QOpenGLFunctions_4_2_Compatibility::glMultMatrixd(const GLdouble *m)
-{
- d_1_0_Deprecated->f.MultMatrixd(m);
-}
-
-inline void QOpenGLFunctions_4_2_Compatibility::glMultMatrixf(const GLfloat *m)
-{
- d_1_0_Deprecated->f.MultMatrixf(m);
-}
-
-inline void QOpenGLFunctions_4_2_Compatibility::glMatrixMode(GLenum mode)
-{
- d_1_0_Deprecated->f.MatrixMode(mode);
-}
-
-inline void QOpenGLFunctions_4_2_Compatibility::glLoadMatrixd(const GLdouble *m)
-{
- d_1_0_Deprecated->f.LoadMatrixd(m);
-}
-
-inline void QOpenGLFunctions_4_2_Compatibility::glLoadMatrixf(const GLfloat *m)
-{
- d_1_0_Deprecated->f.LoadMatrixf(m);
-}
-
-inline void QOpenGLFunctions_4_2_Compatibility::glLoadIdentity()
-{
- d_1_0_Deprecated->f.LoadIdentity();
-}
-
-inline void QOpenGLFunctions_4_2_Compatibility::glFrustum(GLdouble left, GLdouble right, GLdouble bottom, GLdouble top, GLdouble zNear, GLdouble zFar)
-{
- d_1_0_Deprecated->f.Frustum(left, right, bottom, top, zNear, zFar);
-}
-
-inline GLboolean QOpenGLFunctions_4_2_Compatibility::glIsList(GLuint list)
-{
- return d_1_0_Deprecated->f.IsList(list);
-}
-
-inline void QOpenGLFunctions_4_2_Compatibility::glGetTexGeniv(GLenum coord, GLenum pname, GLint *params)
-{
- d_1_0_Deprecated->f.GetTexGeniv(coord, pname, params);
-}
-
-inline void QOpenGLFunctions_4_2_Compatibility::glGetTexGenfv(GLenum coord, GLenum pname, GLfloat *params)
-{
- d_1_0_Deprecated->f.GetTexGenfv(coord, pname, params);
-}
-
-inline void QOpenGLFunctions_4_2_Compatibility::glGetTexGendv(GLenum coord, GLenum pname, GLdouble *params)
-{
- d_1_0_Deprecated->f.GetTexGendv(coord, pname, params);
-}
-
-inline void QOpenGLFunctions_4_2_Compatibility::glGetTexEnviv(GLenum target, GLenum pname, GLint *params)
-{
- d_1_0_Deprecated->f.GetTexEnviv(target, pname, params);
-}
-
-inline void QOpenGLFunctions_4_2_Compatibility::glGetTexEnvfv(GLenum target, GLenum pname, GLfloat *params)
-{
- d_1_0_Deprecated->f.GetTexEnvfv(target, pname, params);
-}
-
-inline void QOpenGLFunctions_4_2_Compatibility::glGetPolygonStipple(GLubyte *mask)
-{
- d_1_0_Deprecated->f.GetPolygonStipple(mask);
-}
-
-inline void QOpenGLFunctions_4_2_Compatibility::glGetPixelMapusv(GLenum map, GLushort *values)
-{
- d_1_0_Deprecated->f.GetPixelMapusv(map, values);
-}
-
-inline void QOpenGLFunctions_4_2_Compatibility::glGetPixelMapuiv(GLenum map, GLuint *values)
-{
- d_1_0_Deprecated->f.GetPixelMapuiv(map, values);
-}
-
-inline void QOpenGLFunctions_4_2_Compatibility::glGetPixelMapfv(GLenum map, GLfloat *values)
-{
- d_1_0_Deprecated->f.GetPixelMapfv(map, values);
-}
-
-inline void QOpenGLFunctions_4_2_Compatibility::glGetMaterialiv(GLenum face, GLenum pname, GLint *params)
-{
- d_1_0_Deprecated->f.GetMaterialiv(face, pname, params);
-}
-
-inline void QOpenGLFunctions_4_2_Compatibility::glGetMaterialfv(GLenum face, GLenum pname, GLfloat *params)
-{
- d_1_0_Deprecated->f.GetMaterialfv(face, pname, params);
-}
-
-inline void QOpenGLFunctions_4_2_Compatibility::glGetMapiv(GLenum target, GLenum query, GLint *v)
-{
- d_1_0_Deprecated->f.GetMapiv(target, query, v);
-}
-
-inline void QOpenGLFunctions_4_2_Compatibility::glGetMapfv(GLenum target, GLenum query, GLfloat *v)
-{
- d_1_0_Deprecated->f.GetMapfv(target, query, v);
-}
-
-inline void QOpenGLFunctions_4_2_Compatibility::glGetMapdv(GLenum target, GLenum query, GLdouble *v)
-{
- d_1_0_Deprecated->f.GetMapdv(target, query, v);
-}
-
-inline void QOpenGLFunctions_4_2_Compatibility::glGetLightiv(GLenum light, GLenum pname, GLint *params)
-{
- d_1_0_Deprecated->f.GetLightiv(light, pname, params);
-}
-
-inline void QOpenGLFunctions_4_2_Compatibility::glGetLightfv(GLenum light, GLenum pname, GLfloat *params)
-{
- d_1_0_Deprecated->f.GetLightfv(light, pname, params);
-}
-
-inline void QOpenGLFunctions_4_2_Compatibility::glGetClipPlane(GLenum plane, GLdouble *equation)
-{
- d_1_0_Deprecated->f.GetClipPlane(plane, equation);
-}
-
-inline void QOpenGLFunctions_4_2_Compatibility::glDrawPixels(GLsizei width, GLsizei height, GLenum format, GLenum type, const GLvoid *pixels)
-{
- d_1_0_Deprecated->f.DrawPixels(width, height, format, type, pixels);
-}
-
-inline void QOpenGLFunctions_4_2_Compatibility::glCopyPixels(GLint x, GLint y, GLsizei width, GLsizei height, GLenum type)
-{
- d_1_0_Deprecated->f.CopyPixels(x, y, width, height, type);
-}
-
-inline void QOpenGLFunctions_4_2_Compatibility::glPixelMapusv(GLenum map, GLint mapsize, const GLushort *values)
-{
- d_1_0_Deprecated->f.PixelMapusv(map, mapsize, values);
-}
-
-inline void QOpenGLFunctions_4_2_Compatibility::glPixelMapuiv(GLenum map, GLint mapsize, const GLuint *values)
-{
- d_1_0_Deprecated->f.PixelMapuiv(map, mapsize, values);
-}
-
-inline void QOpenGLFunctions_4_2_Compatibility::glPixelMapfv(GLenum map, GLint mapsize, const GLfloat *values)
-{
- d_1_0_Deprecated->f.PixelMapfv(map, mapsize, values);
-}
-
-inline void QOpenGLFunctions_4_2_Compatibility::glPixelTransferi(GLenum pname, GLint param)
-{
- d_1_0_Deprecated->f.PixelTransferi(pname, param);
-}
-
-inline void QOpenGLFunctions_4_2_Compatibility::glPixelTransferf(GLenum pname, GLfloat param)
-{
- d_1_0_Deprecated->f.PixelTransferf(pname, param);
-}
-
-inline void QOpenGLFunctions_4_2_Compatibility::glPixelZoom(GLfloat xfactor, GLfloat yfactor)
-{
- d_1_0_Deprecated->f.PixelZoom(xfactor, yfactor);
-}
-
-inline void QOpenGLFunctions_4_2_Compatibility::glAlphaFunc(GLenum func, GLfloat ref)
-{
- d_1_0_Deprecated->f.AlphaFunc(func, ref);
-}
-
-inline void QOpenGLFunctions_4_2_Compatibility::glEvalPoint2(GLint i, GLint j)
-{
- d_1_0_Deprecated->f.EvalPoint2(i, j);
-}
-
-inline void QOpenGLFunctions_4_2_Compatibility::glEvalMesh2(GLenum mode, GLint i1, GLint i2, GLint j1, GLint j2)
-{
- d_1_0_Deprecated->f.EvalMesh2(mode, i1, i2, j1, j2);
-}
-
-inline void QOpenGLFunctions_4_2_Compatibility::glEvalPoint1(GLint i)
-{
- d_1_0_Deprecated->f.EvalPoint1(i);
-}
-
-inline void QOpenGLFunctions_4_2_Compatibility::glEvalMesh1(GLenum mode, GLint i1, GLint i2)
-{
- d_1_0_Deprecated->f.EvalMesh1(mode, i1, i2);
-}
-
-inline void QOpenGLFunctions_4_2_Compatibility::glEvalCoord2fv(const GLfloat *u)
-{
- d_1_0_Deprecated->f.EvalCoord2fv(u);
-}
-
-inline void QOpenGLFunctions_4_2_Compatibility::glEvalCoord2f(GLfloat u, GLfloat v)
-{
- d_1_0_Deprecated->f.EvalCoord2f(u, v);
-}
-
-inline void QOpenGLFunctions_4_2_Compatibility::glEvalCoord2dv(const GLdouble *u)
-{
- d_1_0_Deprecated->f.EvalCoord2dv(u);
-}
-
-inline void QOpenGLFunctions_4_2_Compatibility::glEvalCoord2d(GLdouble u, GLdouble v)
-{
- d_1_0_Deprecated->f.EvalCoord2d(u, v);
-}
-
-inline void QOpenGLFunctions_4_2_Compatibility::glEvalCoord1fv(const GLfloat *u)
-{
- d_1_0_Deprecated->f.EvalCoord1fv(u);
-}
-
-inline void QOpenGLFunctions_4_2_Compatibility::glEvalCoord1f(GLfloat u)
-{
- d_1_0_Deprecated->f.EvalCoord1f(u);
-}
-
-inline void QOpenGLFunctions_4_2_Compatibility::glEvalCoord1dv(const GLdouble *u)
-{
- d_1_0_Deprecated->f.EvalCoord1dv(u);
-}
-
-inline void QOpenGLFunctions_4_2_Compatibility::glEvalCoord1d(GLdouble u)
-{
- d_1_0_Deprecated->f.EvalCoord1d(u);
-}
-
-inline void QOpenGLFunctions_4_2_Compatibility::glMapGrid2f(GLint un, GLfloat u1, GLfloat u2, GLint vn, GLfloat v1, GLfloat v2)
-{
- d_1_0_Deprecated->f.MapGrid2f(un, u1, u2, vn, v1, v2);
-}
-
-inline void QOpenGLFunctions_4_2_Compatibility::glMapGrid2d(GLint un, GLdouble u1, GLdouble u2, GLint vn, GLdouble v1, GLdouble v2)
-{
- d_1_0_Deprecated->f.MapGrid2d(un, u1, u2, vn, v1, v2);
-}
-
-inline void QOpenGLFunctions_4_2_Compatibility::glMapGrid1f(GLint un, GLfloat u1, GLfloat u2)
-{
- d_1_0_Deprecated->f.MapGrid1f(un, u1, u2);
-}
-
-inline void QOpenGLFunctions_4_2_Compatibility::glMapGrid1d(GLint un, GLdouble u1, GLdouble u2)
-{
- d_1_0_Deprecated->f.MapGrid1d(un, u1, u2);
-}
-
-inline void QOpenGLFunctions_4_2_Compatibility::glMap2f(GLenum target, GLfloat u1, GLfloat u2, GLint ustride, GLint uorder, GLfloat v1, GLfloat v2, GLint vstride, GLint vorder, const GLfloat *points)
-{
- d_1_0_Deprecated->f.Map2f(target, u1, u2, ustride, uorder, v1, v2, vstride, vorder, points);
-}
-
-inline void QOpenGLFunctions_4_2_Compatibility::glMap2d(GLenum target, GLdouble u1, GLdouble u2, GLint ustride, GLint uorder, GLdouble v1, GLdouble v2, GLint vstride, GLint vorder, const GLdouble *points)
-{
- d_1_0_Deprecated->f.Map2d(target, u1, u2, ustride, uorder, v1, v2, vstride, vorder, points);
-}
-
-inline void QOpenGLFunctions_4_2_Compatibility::glMap1f(GLenum target, GLfloat u1, GLfloat u2, GLint stride, GLint order, const GLfloat *points)
-{
- d_1_0_Deprecated->f.Map1f(target, u1, u2, stride, order, points);
-}
-
-inline void QOpenGLFunctions_4_2_Compatibility::glMap1d(GLenum target, GLdouble u1, GLdouble u2, GLint stride, GLint order, const GLdouble *points)
-{
- d_1_0_Deprecated->f.Map1d(target, u1, u2, stride, order, points);
-}
-
-inline void QOpenGLFunctions_4_2_Compatibility::glPushAttrib(GLbitfield mask)
-{
- d_1_0_Deprecated->f.PushAttrib(mask);
-}
-
-inline void QOpenGLFunctions_4_2_Compatibility::glPopAttrib()
-{
- d_1_0_Deprecated->f.PopAttrib();
-}
-
-inline void QOpenGLFunctions_4_2_Compatibility::glAccum(GLenum op, GLfloat value)
-{
- d_1_0_Deprecated->f.Accum(op, value);
-}
-
-inline void QOpenGLFunctions_4_2_Compatibility::glIndexMask(GLuint mask)
-{
- d_1_0_Deprecated->f.IndexMask(mask);
-}
-
-inline void QOpenGLFunctions_4_2_Compatibility::glClearIndex(GLfloat c)
-{
- d_1_0_Deprecated->f.ClearIndex(c);
-}
-
-inline void QOpenGLFunctions_4_2_Compatibility::glClearAccum(GLfloat red, GLfloat green, GLfloat blue, GLfloat alpha)
-{
- d_1_0_Deprecated->f.ClearAccum(red, green, blue, alpha);
-}
-
-inline void QOpenGLFunctions_4_2_Compatibility::glPushName(GLuint name)
-{
- d_1_0_Deprecated->f.PushName(name);
-}
-
-inline void QOpenGLFunctions_4_2_Compatibility::glPopName()
-{
- d_1_0_Deprecated->f.PopName();
-}
-
-inline void QOpenGLFunctions_4_2_Compatibility::glPassThrough(GLfloat token)
-{
- d_1_0_Deprecated->f.PassThrough(token);
-}
-
-inline void QOpenGLFunctions_4_2_Compatibility::glLoadName(GLuint name)
-{
- d_1_0_Deprecated->f.LoadName(name);
-}
-
-inline void QOpenGLFunctions_4_2_Compatibility::glInitNames()
-{
- d_1_0_Deprecated->f.InitNames();
-}
-
-inline GLint QOpenGLFunctions_4_2_Compatibility::glRenderMode(GLenum mode)
-{
- return d_1_0_Deprecated->f.RenderMode(mode);
-}
-
-inline void QOpenGLFunctions_4_2_Compatibility::glSelectBuffer(GLsizei size, GLuint *buffer)
-{
- d_1_0_Deprecated->f.SelectBuffer(size, buffer);
-}
-
-inline void QOpenGLFunctions_4_2_Compatibility::glFeedbackBuffer(GLsizei size, GLenum type, GLfloat *buffer)
-{
- d_1_0_Deprecated->f.FeedbackBuffer(size, type, buffer);
-}
-
-inline void QOpenGLFunctions_4_2_Compatibility::glTexGeniv(GLenum coord, GLenum pname, const GLint *params)
-{
- d_1_0_Deprecated->f.TexGeniv(coord, pname, params);
-}
-
-inline void QOpenGLFunctions_4_2_Compatibility::glTexGeni(GLenum coord, GLenum pname, GLint param)
-{
- d_1_0_Deprecated->f.TexGeni(coord, pname, param);
-}
-
-inline void QOpenGLFunctions_4_2_Compatibility::glTexGenfv(GLenum coord, GLenum pname, const GLfloat *params)
-{
- d_1_0_Deprecated->f.TexGenfv(coord, pname, params);
-}
-
-inline void QOpenGLFunctions_4_2_Compatibility::glTexGenf(GLenum coord, GLenum pname, GLfloat param)
-{
- d_1_0_Deprecated->f.TexGenf(coord, pname, param);
-}
-
-inline void QOpenGLFunctions_4_2_Compatibility::glTexGendv(GLenum coord, GLenum pname, const GLdouble *params)
-{
- d_1_0_Deprecated->f.TexGendv(coord, pname, params);
-}
-
-inline void QOpenGLFunctions_4_2_Compatibility::glTexGend(GLenum coord, GLenum pname, GLdouble param)
-{
- d_1_0_Deprecated->f.TexGend(coord, pname, param);
-}
-
-inline void QOpenGLFunctions_4_2_Compatibility::glTexEnviv(GLenum target, GLenum pname, const GLint *params)
-{
- d_1_0_Deprecated->f.TexEnviv(target, pname, params);
-}
-
-inline void QOpenGLFunctions_4_2_Compatibility::glTexEnvi(GLenum target, GLenum pname, GLint param)
-{
- d_1_0_Deprecated->f.TexEnvi(target, pname, param);
-}
-
-inline void QOpenGLFunctions_4_2_Compatibility::glTexEnvfv(GLenum target, GLenum pname, const GLfloat *params)
-{
- d_1_0_Deprecated->f.TexEnvfv(target, pname, params);
-}
-
-inline void QOpenGLFunctions_4_2_Compatibility::glTexEnvf(GLenum target, GLenum pname, GLfloat param)
-{
- d_1_0_Deprecated->f.TexEnvf(target, pname, param);
-}
-
-inline void QOpenGLFunctions_4_2_Compatibility::glShadeModel(GLenum mode)
-{
- d_1_0_Deprecated->f.ShadeModel(mode);
-}
-
-inline void QOpenGLFunctions_4_2_Compatibility::glPolygonStipple(const GLubyte *mask)
-{
- d_1_0_Deprecated->f.PolygonStipple(mask);
-}
-
-inline void QOpenGLFunctions_4_2_Compatibility::glMaterialiv(GLenum face, GLenum pname, const GLint *params)
-{
- d_1_0_Deprecated->f.Materialiv(face, pname, params);
-}
-
-inline void QOpenGLFunctions_4_2_Compatibility::glMateriali(GLenum face, GLenum pname, GLint param)
-{
- d_1_0_Deprecated->f.Materiali(face, pname, param);
-}
-
-inline void QOpenGLFunctions_4_2_Compatibility::glMaterialfv(GLenum face, GLenum pname, const GLfloat *params)
-{
- d_1_0_Deprecated->f.Materialfv(face, pname, params);
-}
-
-inline void QOpenGLFunctions_4_2_Compatibility::glMaterialf(GLenum face, GLenum pname, GLfloat param)
-{
- d_1_0_Deprecated->f.Materialf(face, pname, param);
-}
-
-inline void QOpenGLFunctions_4_2_Compatibility::glLineStipple(GLint factor, GLushort pattern)
-{
- d_1_0_Deprecated->f.LineStipple(factor, pattern);
-}
-
-inline void QOpenGLFunctions_4_2_Compatibility::glLightModeliv(GLenum pname, const GLint *params)
-{
- d_1_0_Deprecated->f.LightModeliv(pname, params);
-}
-
-inline void QOpenGLFunctions_4_2_Compatibility::glLightModeli(GLenum pname, GLint param)
-{
- d_1_0_Deprecated->f.LightModeli(pname, param);
-}
-
-inline void QOpenGLFunctions_4_2_Compatibility::glLightModelfv(GLenum pname, const GLfloat *params)
-{
- d_1_0_Deprecated->f.LightModelfv(pname, params);
-}
-
-inline void QOpenGLFunctions_4_2_Compatibility::glLightModelf(GLenum pname, GLfloat param)
-{
- d_1_0_Deprecated->f.LightModelf(pname, param);
-}
-
-inline void QOpenGLFunctions_4_2_Compatibility::glLightiv(GLenum light, GLenum pname, const GLint *params)
-{
- d_1_0_Deprecated->f.Lightiv(light, pname, params);
-}
-
-inline void QOpenGLFunctions_4_2_Compatibility::glLighti(GLenum light, GLenum pname, GLint param)
-{
- d_1_0_Deprecated->f.Lighti(light, pname, param);
-}
-
-inline void QOpenGLFunctions_4_2_Compatibility::glLightfv(GLenum light, GLenum pname, const GLfloat *params)
-{
- d_1_0_Deprecated->f.Lightfv(light, pname, params);
-}
-
-inline void QOpenGLFunctions_4_2_Compatibility::glLightf(GLenum light, GLenum pname, GLfloat param)
-{
- d_1_0_Deprecated->f.Lightf(light, pname, param);
-}
-
-inline void QOpenGLFunctions_4_2_Compatibility::glFogiv(GLenum pname, const GLint *params)
-{
- d_1_0_Deprecated->f.Fogiv(pname, params);
-}
-
-inline void QOpenGLFunctions_4_2_Compatibility::glFogi(GLenum pname, GLint param)
-{
- d_1_0_Deprecated->f.Fogi(pname, param);
-}
-
-inline void QOpenGLFunctions_4_2_Compatibility::glFogfv(GLenum pname, const GLfloat *params)
-{
- d_1_0_Deprecated->f.Fogfv(pname, params);
-}
-
-inline void QOpenGLFunctions_4_2_Compatibility::glFogf(GLenum pname, GLfloat param)
-{
- d_1_0_Deprecated->f.Fogf(pname, param);
-}
-
-inline void QOpenGLFunctions_4_2_Compatibility::glColorMaterial(GLenum face, GLenum mode)
-{
- d_1_0_Deprecated->f.ColorMaterial(face, mode);
-}
-
-inline void QOpenGLFunctions_4_2_Compatibility::glClipPlane(GLenum plane, const GLdouble *equation)
-{
- d_1_0_Deprecated->f.ClipPlane(plane, equation);
-}
-
-inline void QOpenGLFunctions_4_2_Compatibility::glVertex4sv(const GLshort *v)
-{
- d_1_0_Deprecated->f.Vertex4sv(v);
-}
-
-inline void QOpenGLFunctions_4_2_Compatibility::glVertex4s(GLshort x, GLshort y, GLshort z, GLshort w)
-{
- d_1_0_Deprecated->f.Vertex4s(x, y, z, w);
-}
-
-inline void QOpenGLFunctions_4_2_Compatibility::glVertex4iv(const GLint *v)
-{
- d_1_0_Deprecated->f.Vertex4iv(v);
-}
-
-inline void QOpenGLFunctions_4_2_Compatibility::glVertex4i(GLint x, GLint y, GLint z, GLint w)
-{
- d_1_0_Deprecated->f.Vertex4i(x, y, z, w);
-}
-
-inline void QOpenGLFunctions_4_2_Compatibility::glVertex4fv(const GLfloat *v)
-{
- d_1_0_Deprecated->f.Vertex4fv(v);
-}
-
-inline void QOpenGLFunctions_4_2_Compatibility::glVertex4f(GLfloat x, GLfloat y, GLfloat z, GLfloat w)
-{
- d_1_0_Deprecated->f.Vertex4f(x, y, z, w);
-}
-
-inline void QOpenGLFunctions_4_2_Compatibility::glVertex4dv(const GLdouble *v)
-{
- d_1_0_Deprecated->f.Vertex4dv(v);
-}
-
-inline void QOpenGLFunctions_4_2_Compatibility::glVertex4d(GLdouble x, GLdouble y, GLdouble z, GLdouble w)
-{
- d_1_0_Deprecated->f.Vertex4d(x, y, z, w);
-}
-
-inline void QOpenGLFunctions_4_2_Compatibility::glVertex3sv(const GLshort *v)
-{
- d_1_0_Deprecated->f.Vertex3sv(v);
-}
-
-inline void QOpenGLFunctions_4_2_Compatibility::glVertex3s(GLshort x, GLshort y, GLshort z)
-{
- d_1_0_Deprecated->f.Vertex3s(x, y, z);
-}
-
-inline void QOpenGLFunctions_4_2_Compatibility::glVertex3iv(const GLint *v)
-{
- d_1_0_Deprecated->f.Vertex3iv(v);
-}
-
-inline void QOpenGLFunctions_4_2_Compatibility::glVertex3i(GLint x, GLint y, GLint z)
-{
- d_1_0_Deprecated->f.Vertex3i(x, y, z);
-}
-
-inline void QOpenGLFunctions_4_2_Compatibility::glVertex3fv(const GLfloat *v)
-{
- d_1_0_Deprecated->f.Vertex3fv(v);
-}
-
-inline void QOpenGLFunctions_4_2_Compatibility::glVertex3f(GLfloat x, GLfloat y, GLfloat z)
-{
- d_1_0_Deprecated->f.Vertex3f(x, y, z);
-}
-
-inline void QOpenGLFunctions_4_2_Compatibility::glVertex3dv(const GLdouble *v)
-{
- d_1_0_Deprecated->f.Vertex3dv(v);
-}
-
-inline void QOpenGLFunctions_4_2_Compatibility::glVertex3d(GLdouble x, GLdouble y, GLdouble z)
-{
- d_1_0_Deprecated->f.Vertex3d(x, y, z);
-}
-
-inline void QOpenGLFunctions_4_2_Compatibility::glVertex2sv(const GLshort *v)
-{
- d_1_0_Deprecated->f.Vertex2sv(v);
-}
-
-inline void QOpenGLFunctions_4_2_Compatibility::glVertex2s(GLshort x, GLshort y)
-{
- d_1_0_Deprecated->f.Vertex2s(x, y);
-}
-
-inline void QOpenGLFunctions_4_2_Compatibility::glVertex2iv(const GLint *v)
-{
- d_1_0_Deprecated->f.Vertex2iv(v);
-}
-
-inline void QOpenGLFunctions_4_2_Compatibility::glVertex2i(GLint x, GLint y)
-{
- d_1_0_Deprecated->f.Vertex2i(x, y);
-}
-
-inline void QOpenGLFunctions_4_2_Compatibility::glVertex2fv(const GLfloat *v)
-{
- d_1_0_Deprecated->f.Vertex2fv(v);
-}
-
-inline void QOpenGLFunctions_4_2_Compatibility::glVertex2f(GLfloat x, GLfloat y)
-{
- d_1_0_Deprecated->f.Vertex2f(x, y);
-}
-
-inline void QOpenGLFunctions_4_2_Compatibility::glVertex2dv(const GLdouble *v)
-{
- d_1_0_Deprecated->f.Vertex2dv(v);
-}
-
-inline void QOpenGLFunctions_4_2_Compatibility::glVertex2d(GLdouble x, GLdouble y)
-{
- d_1_0_Deprecated->f.Vertex2d(x, y);
-}
-
-inline void QOpenGLFunctions_4_2_Compatibility::glTexCoord4sv(const GLshort *v)
-{
- d_1_0_Deprecated->f.TexCoord4sv(v);
-}
-
-inline void QOpenGLFunctions_4_2_Compatibility::glTexCoord4s(GLshort s, GLshort t, GLshort r, GLshort q)
-{
- d_1_0_Deprecated->f.TexCoord4s(s, t, r, q);
-}
-
-inline void QOpenGLFunctions_4_2_Compatibility::glTexCoord4iv(const GLint *v)
-{
- d_1_0_Deprecated->f.TexCoord4iv(v);
-}
-
-inline void QOpenGLFunctions_4_2_Compatibility::glTexCoord4i(GLint s, GLint t, GLint r, GLint q)
-{
- d_1_0_Deprecated->f.TexCoord4i(s, t, r, q);
-}
-
-inline void QOpenGLFunctions_4_2_Compatibility::glTexCoord4fv(const GLfloat *v)
-{
- d_1_0_Deprecated->f.TexCoord4fv(v);
-}
-
-inline void QOpenGLFunctions_4_2_Compatibility::glTexCoord4f(GLfloat s, GLfloat t, GLfloat r, GLfloat q)
-{
- d_1_0_Deprecated->f.TexCoord4f(s, t, r, q);
-}
-
-inline void QOpenGLFunctions_4_2_Compatibility::glTexCoord4dv(const GLdouble *v)
-{
- d_1_0_Deprecated->f.TexCoord4dv(v);
-}
-
-inline void QOpenGLFunctions_4_2_Compatibility::glTexCoord4d(GLdouble s, GLdouble t, GLdouble r, GLdouble q)
-{
- d_1_0_Deprecated->f.TexCoord4d(s, t, r, q);
-}
-
-inline void QOpenGLFunctions_4_2_Compatibility::glTexCoord3sv(const GLshort *v)
-{
- d_1_0_Deprecated->f.TexCoord3sv(v);
-}
-
-inline void QOpenGLFunctions_4_2_Compatibility::glTexCoord3s(GLshort s, GLshort t, GLshort r)
-{
- d_1_0_Deprecated->f.TexCoord3s(s, t, r);
-}
-
-inline void QOpenGLFunctions_4_2_Compatibility::glTexCoord3iv(const GLint *v)
-{
- d_1_0_Deprecated->f.TexCoord3iv(v);
-}
-
-inline void QOpenGLFunctions_4_2_Compatibility::glTexCoord3i(GLint s, GLint t, GLint r)
-{
- d_1_0_Deprecated->f.TexCoord3i(s, t, r);
-}
-
-inline void QOpenGLFunctions_4_2_Compatibility::glTexCoord3fv(const GLfloat *v)
-{
- d_1_0_Deprecated->f.TexCoord3fv(v);
-}
-
-inline void QOpenGLFunctions_4_2_Compatibility::glTexCoord3f(GLfloat s, GLfloat t, GLfloat r)
-{
- d_1_0_Deprecated->f.TexCoord3f(s, t, r);
-}
-
-inline void QOpenGLFunctions_4_2_Compatibility::glTexCoord3dv(const GLdouble *v)
-{
- d_1_0_Deprecated->f.TexCoord3dv(v);
-}
-
-inline void QOpenGLFunctions_4_2_Compatibility::glTexCoord3d(GLdouble s, GLdouble t, GLdouble r)
-{
- d_1_0_Deprecated->f.TexCoord3d(s, t, r);
-}
-
-inline void QOpenGLFunctions_4_2_Compatibility::glTexCoord2sv(const GLshort *v)
-{
- d_1_0_Deprecated->f.TexCoord2sv(v);
-}
-
-inline void QOpenGLFunctions_4_2_Compatibility::glTexCoord2s(GLshort s, GLshort t)
-{
- d_1_0_Deprecated->f.TexCoord2s(s, t);
-}
-
-inline void QOpenGLFunctions_4_2_Compatibility::glTexCoord2iv(const GLint *v)
-{
- d_1_0_Deprecated->f.TexCoord2iv(v);
-}
-
-inline void QOpenGLFunctions_4_2_Compatibility::glTexCoord2i(GLint s, GLint t)
-{
- d_1_0_Deprecated->f.TexCoord2i(s, t);
-}
-
-inline void QOpenGLFunctions_4_2_Compatibility::glTexCoord2fv(const GLfloat *v)
-{
- d_1_0_Deprecated->f.TexCoord2fv(v);
-}
-
-inline void QOpenGLFunctions_4_2_Compatibility::glTexCoord2f(GLfloat s, GLfloat t)
-{
- d_1_0_Deprecated->f.TexCoord2f(s, t);
-}
-
-inline void QOpenGLFunctions_4_2_Compatibility::glTexCoord2dv(const GLdouble *v)
-{
- d_1_0_Deprecated->f.TexCoord2dv(v);
-}
-
-inline void QOpenGLFunctions_4_2_Compatibility::glTexCoord2d(GLdouble s, GLdouble t)
-{
- d_1_0_Deprecated->f.TexCoord2d(s, t);
-}
-
-inline void QOpenGLFunctions_4_2_Compatibility::glTexCoord1sv(const GLshort *v)
-{
- d_1_0_Deprecated->f.TexCoord1sv(v);
-}
-
-inline void QOpenGLFunctions_4_2_Compatibility::glTexCoord1s(GLshort s)
-{
- d_1_0_Deprecated->f.TexCoord1s(s);
-}
-
-inline void QOpenGLFunctions_4_2_Compatibility::glTexCoord1iv(const GLint *v)
-{
- d_1_0_Deprecated->f.TexCoord1iv(v);
-}
-
-inline void QOpenGLFunctions_4_2_Compatibility::glTexCoord1i(GLint s)
-{
- d_1_0_Deprecated->f.TexCoord1i(s);
-}
-
-inline void QOpenGLFunctions_4_2_Compatibility::glTexCoord1fv(const GLfloat *v)
-{
- d_1_0_Deprecated->f.TexCoord1fv(v);
-}
-
-inline void QOpenGLFunctions_4_2_Compatibility::glTexCoord1f(GLfloat s)
-{
- d_1_0_Deprecated->f.TexCoord1f(s);
-}
-
-inline void QOpenGLFunctions_4_2_Compatibility::glTexCoord1dv(const GLdouble *v)
-{
- d_1_0_Deprecated->f.TexCoord1dv(v);
-}
-
-inline void QOpenGLFunctions_4_2_Compatibility::glTexCoord1d(GLdouble s)
-{
- d_1_0_Deprecated->f.TexCoord1d(s);
-}
-
-inline void QOpenGLFunctions_4_2_Compatibility::glRectsv(const GLshort *v1, const GLshort *v2)
-{
- d_1_0_Deprecated->f.Rectsv(v1, v2);
-}
-
-inline void QOpenGLFunctions_4_2_Compatibility::glRects(GLshort x1, GLshort y1, GLshort x2, GLshort y2)
-{
- d_1_0_Deprecated->f.Rects(x1, y1, x2, y2);
-}
-
-inline void QOpenGLFunctions_4_2_Compatibility::glRectiv(const GLint *v1, const GLint *v2)
-{
- d_1_0_Deprecated->f.Rectiv(v1, v2);
-}
-
-inline void QOpenGLFunctions_4_2_Compatibility::glRecti(GLint x1, GLint y1, GLint x2, GLint y2)
-{
- d_1_0_Deprecated->f.Recti(x1, y1, x2, y2);
-}
-
-inline void QOpenGLFunctions_4_2_Compatibility::glRectfv(const GLfloat *v1, const GLfloat *v2)
-{
- d_1_0_Deprecated->f.Rectfv(v1, v2);
-}
-
-inline void QOpenGLFunctions_4_2_Compatibility::glRectf(GLfloat x1, GLfloat y1, GLfloat x2, GLfloat y2)
-{
- d_1_0_Deprecated->f.Rectf(x1, y1, x2, y2);
-}
-
-inline void QOpenGLFunctions_4_2_Compatibility::glRectdv(const GLdouble *v1, const GLdouble *v2)
-{
- d_1_0_Deprecated->f.Rectdv(v1, v2);
-}
-
-inline void QOpenGLFunctions_4_2_Compatibility::glRectd(GLdouble x1, GLdouble y1, GLdouble x2, GLdouble y2)
-{
- d_1_0_Deprecated->f.Rectd(x1, y1, x2, y2);
-}
-
-inline void QOpenGLFunctions_4_2_Compatibility::glRasterPos4sv(const GLshort *v)
-{
- d_1_0_Deprecated->f.RasterPos4sv(v);
-}
-
-inline void QOpenGLFunctions_4_2_Compatibility::glRasterPos4s(GLshort x, GLshort y, GLshort z, GLshort w)
-{
- d_1_0_Deprecated->f.RasterPos4s(x, y, z, w);
-}
-
-inline void QOpenGLFunctions_4_2_Compatibility::glRasterPos4iv(const GLint *v)
-{
- d_1_0_Deprecated->f.RasterPos4iv(v);
-}
-
-inline void QOpenGLFunctions_4_2_Compatibility::glRasterPos4i(GLint x, GLint y, GLint z, GLint w)
-{
- d_1_0_Deprecated->f.RasterPos4i(x, y, z, w);
-}
-
-inline void QOpenGLFunctions_4_2_Compatibility::glRasterPos4fv(const GLfloat *v)
-{
- d_1_0_Deprecated->f.RasterPos4fv(v);
-}
-
-inline void QOpenGLFunctions_4_2_Compatibility::glRasterPos4f(GLfloat x, GLfloat y, GLfloat z, GLfloat w)
-{
- d_1_0_Deprecated->f.RasterPos4f(x, y, z, w);
-}
-
-inline void QOpenGLFunctions_4_2_Compatibility::glRasterPos4dv(const GLdouble *v)
-{
- d_1_0_Deprecated->f.RasterPos4dv(v);
-}
-
-inline void QOpenGLFunctions_4_2_Compatibility::glRasterPos4d(GLdouble x, GLdouble y, GLdouble z, GLdouble w)
-{
- d_1_0_Deprecated->f.RasterPos4d(x, y, z, w);
-}
-
-inline void QOpenGLFunctions_4_2_Compatibility::glRasterPos3sv(const GLshort *v)
-{
- d_1_0_Deprecated->f.RasterPos3sv(v);
-}
-
-inline void QOpenGLFunctions_4_2_Compatibility::glRasterPos3s(GLshort x, GLshort y, GLshort z)
-{
- d_1_0_Deprecated->f.RasterPos3s(x, y, z);
-}
-
-inline void QOpenGLFunctions_4_2_Compatibility::glRasterPos3iv(const GLint *v)
-{
- d_1_0_Deprecated->f.RasterPos3iv(v);
-}
-
-inline void QOpenGLFunctions_4_2_Compatibility::glRasterPos3i(GLint x, GLint y, GLint z)
-{
- d_1_0_Deprecated->f.RasterPos3i(x, y, z);
-}
-
-inline void QOpenGLFunctions_4_2_Compatibility::glRasterPos3fv(const GLfloat *v)
-{
- d_1_0_Deprecated->f.RasterPos3fv(v);
-}
-
-inline void QOpenGLFunctions_4_2_Compatibility::glRasterPos3f(GLfloat x, GLfloat y, GLfloat z)
-{
- d_1_0_Deprecated->f.RasterPos3f(x, y, z);
-}
-
-inline void QOpenGLFunctions_4_2_Compatibility::glRasterPos3dv(const GLdouble *v)
-{
- d_1_0_Deprecated->f.RasterPos3dv(v);
-}
-
-inline void QOpenGLFunctions_4_2_Compatibility::glRasterPos3d(GLdouble x, GLdouble y, GLdouble z)
-{
- d_1_0_Deprecated->f.RasterPos3d(x, y, z);
-}
-
-inline void QOpenGLFunctions_4_2_Compatibility::glRasterPos2sv(const GLshort *v)
-{
- d_1_0_Deprecated->f.RasterPos2sv(v);
-}
-
-inline void QOpenGLFunctions_4_2_Compatibility::glRasterPos2s(GLshort x, GLshort y)
-{
- d_1_0_Deprecated->f.RasterPos2s(x, y);
-}
-
-inline void QOpenGLFunctions_4_2_Compatibility::glRasterPos2iv(const GLint *v)
-{
- d_1_0_Deprecated->f.RasterPos2iv(v);
-}
-
-inline void QOpenGLFunctions_4_2_Compatibility::glRasterPos2i(GLint x, GLint y)
-{
- d_1_0_Deprecated->f.RasterPos2i(x, y);
-}
-
-inline void QOpenGLFunctions_4_2_Compatibility::glRasterPos2fv(const GLfloat *v)
-{
- d_1_0_Deprecated->f.RasterPos2fv(v);
-}
-
-inline void QOpenGLFunctions_4_2_Compatibility::glRasterPos2f(GLfloat x, GLfloat y)
-{
- d_1_0_Deprecated->f.RasterPos2f(x, y);
-}
-
-inline void QOpenGLFunctions_4_2_Compatibility::glRasterPos2dv(const GLdouble *v)
-{
- d_1_0_Deprecated->f.RasterPos2dv(v);
-}
-
-inline void QOpenGLFunctions_4_2_Compatibility::glRasterPos2d(GLdouble x, GLdouble y)
-{
- d_1_0_Deprecated->f.RasterPos2d(x, y);
-}
-
-inline void QOpenGLFunctions_4_2_Compatibility::glNormal3sv(const GLshort *v)
-{
- d_1_0_Deprecated->f.Normal3sv(v);
-}
-
-inline void QOpenGLFunctions_4_2_Compatibility::glNormal3s(GLshort nx, GLshort ny, GLshort nz)
-{
- d_1_0_Deprecated->f.Normal3s(nx, ny, nz);
-}
-
-inline void QOpenGLFunctions_4_2_Compatibility::glNormal3iv(const GLint *v)
-{
- d_1_0_Deprecated->f.Normal3iv(v);
-}
-
-inline void QOpenGLFunctions_4_2_Compatibility::glNormal3i(GLint nx, GLint ny, GLint nz)
-{
- d_1_0_Deprecated->f.Normal3i(nx, ny, nz);
-}
-
-inline void QOpenGLFunctions_4_2_Compatibility::glNormal3fv(const GLfloat *v)
-{
- d_1_0_Deprecated->f.Normal3fv(v);
-}
-
-inline void QOpenGLFunctions_4_2_Compatibility::glNormal3f(GLfloat nx, GLfloat ny, GLfloat nz)
-{
- d_1_0_Deprecated->f.Normal3f(nx, ny, nz);
-}
-
-inline void QOpenGLFunctions_4_2_Compatibility::glNormal3dv(const GLdouble *v)
-{
- d_1_0_Deprecated->f.Normal3dv(v);
-}
-
-inline void QOpenGLFunctions_4_2_Compatibility::glNormal3d(GLdouble nx, GLdouble ny, GLdouble nz)
-{
- d_1_0_Deprecated->f.Normal3d(nx, ny, nz);
-}
-
-inline void QOpenGLFunctions_4_2_Compatibility::glNormal3bv(const GLbyte *v)
-{
- d_1_0_Deprecated->f.Normal3bv(v);
-}
-
-inline void QOpenGLFunctions_4_2_Compatibility::glNormal3b(GLbyte nx, GLbyte ny, GLbyte nz)
-{
- d_1_0_Deprecated->f.Normal3b(nx, ny, nz);
-}
-
-inline void QOpenGLFunctions_4_2_Compatibility::glIndexsv(const GLshort *c)
-{
- d_1_0_Deprecated->f.Indexsv(c);
-}
-
-inline void QOpenGLFunctions_4_2_Compatibility::glIndexs(GLshort c)
-{
- d_1_0_Deprecated->f.Indexs(c);
-}
-
-inline void QOpenGLFunctions_4_2_Compatibility::glIndexiv(const GLint *c)
-{
- d_1_0_Deprecated->f.Indexiv(c);
-}
-
-inline void QOpenGLFunctions_4_2_Compatibility::glIndexi(GLint c)
-{
- d_1_0_Deprecated->f.Indexi(c);
-}
-
-inline void QOpenGLFunctions_4_2_Compatibility::glIndexfv(const GLfloat *c)
-{
- d_1_0_Deprecated->f.Indexfv(c);
-}
-
-inline void QOpenGLFunctions_4_2_Compatibility::glIndexf(GLfloat c)
-{
- d_1_0_Deprecated->f.Indexf(c);
-}
-
-inline void QOpenGLFunctions_4_2_Compatibility::glIndexdv(const GLdouble *c)
-{
- d_1_0_Deprecated->f.Indexdv(c);
-}
-
-inline void QOpenGLFunctions_4_2_Compatibility::glIndexd(GLdouble c)
-{
- d_1_0_Deprecated->f.Indexd(c);
-}
-
-inline void QOpenGLFunctions_4_2_Compatibility::glEnd()
-{
- d_1_0_Deprecated->f.End();
-}
-
-inline void QOpenGLFunctions_4_2_Compatibility::glEdgeFlagv(const GLboolean *flag)
-{
- d_1_0_Deprecated->f.EdgeFlagv(flag);
-}
-
-inline void QOpenGLFunctions_4_2_Compatibility::glEdgeFlag(GLboolean flag)
-{
- d_1_0_Deprecated->f.EdgeFlag(flag);
-}
-
-inline void QOpenGLFunctions_4_2_Compatibility::glColor4usv(const GLushort *v)
-{
- d_1_0_Deprecated->f.Color4usv(v);
-}
-
-inline void QOpenGLFunctions_4_2_Compatibility::glColor4us(GLushort red, GLushort green, GLushort blue, GLushort alpha)
-{
- d_1_0_Deprecated->f.Color4us(red, green, blue, alpha);
-}
-
-inline void QOpenGLFunctions_4_2_Compatibility::glColor4uiv(const GLuint *v)
-{
- d_1_0_Deprecated->f.Color4uiv(v);
-}
-
-inline void QOpenGLFunctions_4_2_Compatibility::glColor4ui(GLuint red, GLuint green, GLuint blue, GLuint alpha)
-{
- d_1_0_Deprecated->f.Color4ui(red, green, blue, alpha);
-}
-
-inline void QOpenGLFunctions_4_2_Compatibility::glColor4ubv(const GLubyte *v)
-{
- d_1_0_Deprecated->f.Color4ubv(v);
-}
-
-inline void QOpenGLFunctions_4_2_Compatibility::glColor4ub(GLubyte red, GLubyte green, GLubyte blue, GLubyte alpha)
-{
- d_1_0_Deprecated->f.Color4ub(red, green, blue, alpha);
-}
-
-inline void QOpenGLFunctions_4_2_Compatibility::glColor4sv(const GLshort *v)
-{
- d_1_0_Deprecated->f.Color4sv(v);
-}
-
-inline void QOpenGLFunctions_4_2_Compatibility::glColor4s(GLshort red, GLshort green, GLshort blue, GLshort alpha)
-{
- d_1_0_Deprecated->f.Color4s(red, green, blue, alpha);
-}
-
-inline void QOpenGLFunctions_4_2_Compatibility::glColor4iv(const GLint *v)
-{
- d_1_0_Deprecated->f.Color4iv(v);
-}
-
-inline void QOpenGLFunctions_4_2_Compatibility::glColor4i(GLint red, GLint green, GLint blue, GLint alpha)
-{
- d_1_0_Deprecated->f.Color4i(red, green, blue, alpha);
-}
-
-inline void QOpenGLFunctions_4_2_Compatibility::glColor4fv(const GLfloat *v)
-{
- d_1_0_Deprecated->f.Color4fv(v);
-}
-
-inline void QOpenGLFunctions_4_2_Compatibility::glColor4f(GLfloat red, GLfloat green, GLfloat blue, GLfloat alpha)
-{
- d_1_0_Deprecated->f.Color4f(red, green, blue, alpha);
-}
-
-inline void QOpenGLFunctions_4_2_Compatibility::glColor4dv(const GLdouble *v)
-{
- d_1_0_Deprecated->f.Color4dv(v);
-}
-
-inline void QOpenGLFunctions_4_2_Compatibility::glColor4d(GLdouble red, GLdouble green, GLdouble blue, GLdouble alpha)
-{
- d_1_0_Deprecated->f.Color4d(red, green, blue, alpha);
-}
-
-inline void QOpenGLFunctions_4_2_Compatibility::glColor4bv(const GLbyte *v)
-{
- d_1_0_Deprecated->f.Color4bv(v);
-}
-
-inline void QOpenGLFunctions_4_2_Compatibility::glColor4b(GLbyte red, GLbyte green, GLbyte blue, GLbyte alpha)
-{
- d_1_0_Deprecated->f.Color4b(red, green, blue, alpha);
-}
-
-inline void QOpenGLFunctions_4_2_Compatibility::glColor3usv(const GLushort *v)
-{
- d_1_0_Deprecated->f.Color3usv(v);
-}
-
-inline void QOpenGLFunctions_4_2_Compatibility::glColor3us(GLushort red, GLushort green, GLushort blue)
-{
- d_1_0_Deprecated->f.Color3us(red, green, blue);
-}
-
-inline void QOpenGLFunctions_4_2_Compatibility::glColor3uiv(const GLuint *v)
-{
- d_1_0_Deprecated->f.Color3uiv(v);
-}
-
-inline void QOpenGLFunctions_4_2_Compatibility::glColor3ui(GLuint red, GLuint green, GLuint blue)
-{
- d_1_0_Deprecated->f.Color3ui(red, green, blue);
-}
-
-inline void QOpenGLFunctions_4_2_Compatibility::glColor3ubv(const GLubyte *v)
-{
- d_1_0_Deprecated->f.Color3ubv(v);
-}
-
-inline void QOpenGLFunctions_4_2_Compatibility::glColor3ub(GLubyte red, GLubyte green, GLubyte blue)
-{
- d_1_0_Deprecated->f.Color3ub(red, green, blue);
-}
-
-inline void QOpenGLFunctions_4_2_Compatibility::glColor3sv(const GLshort *v)
-{
- d_1_0_Deprecated->f.Color3sv(v);
-}
-
-inline void QOpenGLFunctions_4_2_Compatibility::glColor3s(GLshort red, GLshort green, GLshort blue)
-{
- d_1_0_Deprecated->f.Color3s(red, green, blue);
-}
-
-inline void QOpenGLFunctions_4_2_Compatibility::glColor3iv(const GLint *v)
-{
- d_1_0_Deprecated->f.Color3iv(v);
-}
-
-inline void QOpenGLFunctions_4_2_Compatibility::glColor3i(GLint red, GLint green, GLint blue)
-{
- d_1_0_Deprecated->f.Color3i(red, green, blue);
-}
-
-inline void QOpenGLFunctions_4_2_Compatibility::glColor3fv(const GLfloat *v)
-{
- d_1_0_Deprecated->f.Color3fv(v);
-}
-
-inline void QOpenGLFunctions_4_2_Compatibility::glColor3f(GLfloat red, GLfloat green, GLfloat blue)
-{
- d_1_0_Deprecated->f.Color3f(red, green, blue);
-}
-
-inline void QOpenGLFunctions_4_2_Compatibility::glColor3dv(const GLdouble *v)
-{
- d_1_0_Deprecated->f.Color3dv(v);
-}
-
-inline void QOpenGLFunctions_4_2_Compatibility::glColor3d(GLdouble red, GLdouble green, GLdouble blue)
-{
- d_1_0_Deprecated->f.Color3d(red, green, blue);
-}
-
-inline void QOpenGLFunctions_4_2_Compatibility::glColor3bv(const GLbyte *v)
-{
- d_1_0_Deprecated->f.Color3bv(v);
-}
-
-inline void QOpenGLFunctions_4_2_Compatibility::glColor3b(GLbyte red, GLbyte green, GLbyte blue)
-{
- d_1_0_Deprecated->f.Color3b(red, green, blue);
-}
-
-inline void QOpenGLFunctions_4_2_Compatibility::glBitmap(GLsizei width, GLsizei height, GLfloat xorig, GLfloat yorig, GLfloat xmove, GLfloat ymove, const GLubyte *bitmap)
-{
- d_1_0_Deprecated->f.Bitmap(width, height, xorig, yorig, xmove, ymove, bitmap);
-}
-
-inline void QOpenGLFunctions_4_2_Compatibility::glBegin(GLenum mode)
-{
- d_1_0_Deprecated->f.Begin(mode);
-}
-
-inline void QOpenGLFunctions_4_2_Compatibility::glListBase(GLuint base)
-{
- d_1_0_Deprecated->f.ListBase(base);
-}
-
-inline GLuint QOpenGLFunctions_4_2_Compatibility::glGenLists(GLsizei range)
-{
- return d_1_0_Deprecated->f.GenLists(range);
-}
-
-inline void QOpenGLFunctions_4_2_Compatibility::glDeleteLists(GLuint list, GLsizei range)
-{
- d_1_0_Deprecated->f.DeleteLists(list, range);
-}
-
-inline void QOpenGLFunctions_4_2_Compatibility::glCallLists(GLsizei n, GLenum type, const GLvoid *lists)
-{
- d_1_0_Deprecated->f.CallLists(n, type, lists);
-}
-
-inline void QOpenGLFunctions_4_2_Compatibility::glCallList(GLuint list)
-{
- d_1_0_Deprecated->f.CallList(list);
-}
-
-inline void QOpenGLFunctions_4_2_Compatibility::glEndList()
-{
- d_1_0_Deprecated->f.EndList();
-}
-
-inline void QOpenGLFunctions_4_2_Compatibility::glNewList(GLuint list, GLenum mode)
-{
- d_1_0_Deprecated->f.NewList(list, mode);
-}
-
-
-// OpenGL 1.1 deprecated functions
-inline void QOpenGLFunctions_4_2_Compatibility::glPushClientAttrib(GLbitfield mask)
-{
- d_1_1_Deprecated->f.PushClientAttrib(mask);
-}
-
-inline void QOpenGLFunctions_4_2_Compatibility::glPopClientAttrib()
-{
- d_1_1_Deprecated->f.PopClientAttrib();
-}
-
-inline void QOpenGLFunctions_4_2_Compatibility::glPrioritizeTextures(GLsizei n, const GLuint *textures, const GLfloat *priorities)
-{
- d_1_1_Deprecated->f.PrioritizeTextures(n, textures, priorities);
-}
-
-inline GLboolean QOpenGLFunctions_4_2_Compatibility::glAreTexturesResident(GLsizei n, const GLuint *textures, GLboolean *residences)
-{
- return d_1_1_Deprecated->f.AreTexturesResident(n, textures, residences);
-}
-
-inline void QOpenGLFunctions_4_2_Compatibility::glVertexPointer(GLint size, GLenum type, GLsizei stride, const GLvoid *pointer)
-{
- d_1_1_Deprecated->f.VertexPointer(size, type, stride, pointer);
-}
-
-inline void QOpenGLFunctions_4_2_Compatibility::glTexCoordPointer(GLint size, GLenum type, GLsizei stride, const GLvoid *pointer)
-{
- d_1_1_Deprecated->f.TexCoordPointer(size, type, stride, pointer);
-}
-
-inline void QOpenGLFunctions_4_2_Compatibility::glNormalPointer(GLenum type, GLsizei stride, const GLvoid *pointer)
-{
- d_1_1_Deprecated->f.NormalPointer(type, stride, pointer);
-}
-
-inline void QOpenGLFunctions_4_2_Compatibility::glInterleavedArrays(GLenum format, GLsizei stride, const GLvoid *pointer)
-{
- d_1_1_Deprecated->f.InterleavedArrays(format, stride, pointer);
-}
-
-inline void QOpenGLFunctions_4_2_Compatibility::glIndexPointer(GLenum type, GLsizei stride, const GLvoid *pointer)
-{
- d_1_1_Deprecated->f.IndexPointer(type, stride, pointer);
-}
-
-inline void QOpenGLFunctions_4_2_Compatibility::glEnableClientState(GLenum array)
-{
- d_1_1_Deprecated->f.EnableClientState(array);
-}
-
-inline void QOpenGLFunctions_4_2_Compatibility::glEdgeFlagPointer(GLsizei stride, const GLvoid *pointer)
-{
- d_1_1_Deprecated->f.EdgeFlagPointer(stride, pointer);
-}
-
-inline void QOpenGLFunctions_4_2_Compatibility::glDisableClientState(GLenum array)
-{
- d_1_1_Deprecated->f.DisableClientState(array);
-}
-
-inline void QOpenGLFunctions_4_2_Compatibility::glColorPointer(GLint size, GLenum type, GLsizei stride, const GLvoid *pointer)
-{
- d_1_1_Deprecated->f.ColorPointer(size, type, stride, pointer);
-}
-
-inline void QOpenGLFunctions_4_2_Compatibility::glArrayElement(GLint i)
-{
- d_1_1_Deprecated->f.ArrayElement(i);
-}
-
-
-// OpenGL 1.2 deprecated functions
-inline void QOpenGLFunctions_4_2_Compatibility::glResetMinmax(GLenum target)
-{
- d_1_2_Deprecated->f.ResetMinmax(target);
-}
-
-inline void QOpenGLFunctions_4_2_Compatibility::glResetHistogram(GLenum target)
-{
- d_1_2_Deprecated->f.ResetHistogram(target);
-}
-
-inline void QOpenGLFunctions_4_2_Compatibility::glMinmax(GLenum target, GLenum internalformat, GLboolean sink)
-{
- d_1_2_Deprecated->f.Minmax(target, internalformat, sink);
-}
-
-inline void QOpenGLFunctions_4_2_Compatibility::glHistogram(GLenum target, GLsizei width, GLenum internalformat, GLboolean sink)
-{
- d_1_2_Deprecated->f.Histogram(target, width, internalformat, sink);
-}
-
-inline void QOpenGLFunctions_4_2_Compatibility::glGetMinmaxParameteriv(GLenum target, GLenum pname, GLint *params)
-{
- d_1_2_Deprecated->f.GetMinmaxParameteriv(target, pname, params);
-}
-
-inline void QOpenGLFunctions_4_2_Compatibility::glGetMinmaxParameterfv(GLenum target, GLenum pname, GLfloat *params)
-{
- d_1_2_Deprecated->f.GetMinmaxParameterfv(target, pname, params);
-}
-
-inline void QOpenGLFunctions_4_2_Compatibility::glGetMinmax(GLenum target, GLboolean reset, GLenum format, GLenum type, GLvoid *values)
-{
- d_1_2_Deprecated->f.GetMinmax(target, reset, format, type, values);
-}
-
-inline void QOpenGLFunctions_4_2_Compatibility::glGetHistogramParameteriv(GLenum target, GLenum pname, GLint *params)
-{
- d_1_2_Deprecated->f.GetHistogramParameteriv(target, pname, params);
-}
-
-inline void QOpenGLFunctions_4_2_Compatibility::glGetHistogramParameterfv(GLenum target, GLenum pname, GLfloat *params)
-{
- d_1_2_Deprecated->f.GetHistogramParameterfv(target, pname, params);
-}
-
-inline void QOpenGLFunctions_4_2_Compatibility::glGetHistogram(GLenum target, GLboolean reset, GLenum format, GLenum type, GLvoid *values)
-{
- d_1_2_Deprecated->f.GetHistogram(target, reset, format, type, values);
-}
-
-inline void QOpenGLFunctions_4_2_Compatibility::glSeparableFilter2D(GLenum target, GLenum internalformat, GLsizei width, GLsizei height, GLenum format, GLenum type, const GLvoid *row, const GLvoid *column)
-{
- d_1_2_Deprecated->f.SeparableFilter2D(target, internalformat, width, height, format, type, row, column);
-}
-
-inline void QOpenGLFunctions_4_2_Compatibility::glGetSeparableFilter(GLenum target, GLenum format, GLenum type, GLvoid *row, GLvoid *column, GLvoid *span)
-{
- d_1_2_Deprecated->f.GetSeparableFilter(target, format, type, row, column, span);
-}
-
-inline void QOpenGLFunctions_4_2_Compatibility::glGetConvolutionParameteriv(GLenum target, GLenum pname, GLint *params)
-{
- d_1_2_Deprecated->f.GetConvolutionParameteriv(target, pname, params);
-}
-
-inline void QOpenGLFunctions_4_2_Compatibility::glGetConvolutionParameterfv(GLenum target, GLenum pname, GLfloat *params)
-{
- d_1_2_Deprecated->f.GetConvolutionParameterfv(target, pname, params);
-}
-
-inline void QOpenGLFunctions_4_2_Compatibility::glGetConvolutionFilter(GLenum target, GLenum format, GLenum type, GLvoid *image)
-{
- d_1_2_Deprecated->f.GetConvolutionFilter(target, format, type, image);
-}
-
-inline void QOpenGLFunctions_4_2_Compatibility::glCopyConvolutionFilter2D(GLenum target, GLenum internalformat, GLint x, GLint y, GLsizei width, GLsizei height)
-{
- d_1_2_Deprecated->f.CopyConvolutionFilter2D(target, internalformat, x, y, width, height);
-}
-
-inline void QOpenGLFunctions_4_2_Compatibility::glCopyConvolutionFilter1D(GLenum target, GLenum internalformat, GLint x, GLint y, GLsizei width)
-{
- d_1_2_Deprecated->f.CopyConvolutionFilter1D(target, internalformat, x, y, width);
-}
-
-inline void QOpenGLFunctions_4_2_Compatibility::glConvolutionParameteriv(GLenum target, GLenum pname, const GLint *params)
-{
- d_1_2_Deprecated->f.ConvolutionParameteriv(target, pname, params);
-}
-
-inline void QOpenGLFunctions_4_2_Compatibility::glConvolutionParameteri(GLenum target, GLenum pname, GLint params)
-{
- d_1_2_Deprecated->f.ConvolutionParameteri(target, pname, params);
-}
-
-inline void QOpenGLFunctions_4_2_Compatibility::glConvolutionParameterfv(GLenum target, GLenum pname, const GLfloat *params)
-{
- d_1_2_Deprecated->f.ConvolutionParameterfv(target, pname, params);
-}
-
-inline void QOpenGLFunctions_4_2_Compatibility::glConvolutionParameterf(GLenum target, GLenum pname, GLfloat params)
-{
- d_1_2_Deprecated->f.ConvolutionParameterf(target, pname, params);
-}
-
-inline void QOpenGLFunctions_4_2_Compatibility::glConvolutionFilter2D(GLenum target, GLenum internalformat, GLsizei width, GLsizei height, GLenum format, GLenum type, const GLvoid *image)
-{
- d_1_2_Deprecated->f.ConvolutionFilter2D(target, internalformat, width, height, format, type, image);
-}
-
-inline void QOpenGLFunctions_4_2_Compatibility::glConvolutionFilter1D(GLenum target, GLenum internalformat, GLsizei width, GLenum format, GLenum type, const GLvoid *image)
-{
- d_1_2_Deprecated->f.ConvolutionFilter1D(target, internalformat, width, format, type, image);
-}
-
-inline void QOpenGLFunctions_4_2_Compatibility::glCopyColorSubTable(GLenum target, GLsizei start, GLint x, GLint y, GLsizei width)
-{
- d_1_2_Deprecated->f.CopyColorSubTable(target, start, x, y, width);
-}
-
-inline void QOpenGLFunctions_4_2_Compatibility::glColorSubTable(GLenum target, GLsizei start, GLsizei count, GLenum format, GLenum type, const GLvoid *data)
-{
- d_1_2_Deprecated->f.ColorSubTable(target, start, count, format, type, data);
-}
-
-inline void QOpenGLFunctions_4_2_Compatibility::glGetColorTableParameteriv(GLenum target, GLenum pname, GLint *params)
-{
- d_1_2_Deprecated->f.GetColorTableParameteriv(target, pname, params);
-}
-
-inline void QOpenGLFunctions_4_2_Compatibility::glGetColorTableParameterfv(GLenum target, GLenum pname, GLfloat *params)
-{
- d_1_2_Deprecated->f.GetColorTableParameterfv(target, pname, params);
-}
-
-inline void QOpenGLFunctions_4_2_Compatibility::glGetColorTable(GLenum target, GLenum format, GLenum type, GLvoid *table)
-{
- d_1_2_Deprecated->f.GetColorTable(target, format, type, table);
-}
-
-inline void QOpenGLFunctions_4_2_Compatibility::glCopyColorTable(GLenum target, GLenum internalformat, GLint x, GLint y, GLsizei width)
-{
- d_1_2_Deprecated->f.CopyColorTable(target, internalformat, x, y, width);
-}
-
-inline void QOpenGLFunctions_4_2_Compatibility::glColorTableParameteriv(GLenum target, GLenum pname, const GLint *params)
-{
- d_1_2_Deprecated->f.ColorTableParameteriv(target, pname, params);
-}
-
-inline void QOpenGLFunctions_4_2_Compatibility::glColorTableParameterfv(GLenum target, GLenum pname, const GLfloat *params)
-{
- d_1_2_Deprecated->f.ColorTableParameterfv(target, pname, params);
-}
-
-inline void QOpenGLFunctions_4_2_Compatibility::glColorTable(GLenum target, GLenum internalformat, GLsizei width, GLenum format, GLenum type, const GLvoid *table)
-{
- d_1_2_Deprecated->f.ColorTable(target, internalformat, width, format, type, table);
-}
-
-
-// OpenGL 1.3 deprecated functions
-inline void QOpenGLFunctions_4_2_Compatibility::glMultTransposeMatrixd(const GLdouble *m)
-{
- d_1_3_Deprecated->f.MultTransposeMatrixd(m);
-}
-
-inline void QOpenGLFunctions_4_2_Compatibility::glMultTransposeMatrixf(const GLfloat *m)
-{
- d_1_3_Deprecated->f.MultTransposeMatrixf(m);
-}
-
-inline void QOpenGLFunctions_4_2_Compatibility::glLoadTransposeMatrixd(const GLdouble *m)
-{
- d_1_3_Deprecated->f.LoadTransposeMatrixd(m);
-}
-
-inline void QOpenGLFunctions_4_2_Compatibility::glLoadTransposeMatrixf(const GLfloat *m)
-{
- d_1_3_Deprecated->f.LoadTransposeMatrixf(m);
-}
-
-inline void QOpenGLFunctions_4_2_Compatibility::glMultiTexCoord4sv(GLenum target, const GLshort *v)
-{
- d_1_3_Deprecated->f.MultiTexCoord4sv(target, v);
-}
-
-inline void QOpenGLFunctions_4_2_Compatibility::glMultiTexCoord4s(GLenum target, GLshort s, GLshort t, GLshort r, GLshort q)
-{
- d_1_3_Deprecated->f.MultiTexCoord4s(target, s, t, r, q);
-}
-
-inline void QOpenGLFunctions_4_2_Compatibility::glMultiTexCoord4iv(GLenum target, const GLint *v)
-{
- d_1_3_Deprecated->f.MultiTexCoord4iv(target, v);
-}
-
-inline void QOpenGLFunctions_4_2_Compatibility::glMultiTexCoord4i(GLenum target, GLint s, GLint t, GLint r, GLint q)
-{
- d_1_3_Deprecated->f.MultiTexCoord4i(target, s, t, r, q);
-}
-
-inline void QOpenGLFunctions_4_2_Compatibility::glMultiTexCoord4fv(GLenum target, const GLfloat *v)
-{
- d_1_3_Deprecated->f.MultiTexCoord4fv(target, v);
-}
-
-inline void QOpenGLFunctions_4_2_Compatibility::glMultiTexCoord4f(GLenum target, GLfloat s, GLfloat t, GLfloat r, GLfloat q)
-{
- d_1_3_Deprecated->f.MultiTexCoord4f(target, s, t, r, q);
-}
-
-inline void QOpenGLFunctions_4_2_Compatibility::glMultiTexCoord4dv(GLenum target, const GLdouble *v)
-{
- d_1_3_Deprecated->f.MultiTexCoord4dv(target, v);
-}
-
-inline void QOpenGLFunctions_4_2_Compatibility::glMultiTexCoord4d(GLenum target, GLdouble s, GLdouble t, GLdouble r, GLdouble q)
-{
- d_1_3_Deprecated->f.MultiTexCoord4d(target, s, t, r, q);
-}
-
-inline void QOpenGLFunctions_4_2_Compatibility::glMultiTexCoord3sv(GLenum target, const GLshort *v)
-{
- d_1_3_Deprecated->f.MultiTexCoord3sv(target, v);
-}
-
-inline void QOpenGLFunctions_4_2_Compatibility::glMultiTexCoord3s(GLenum target, GLshort s, GLshort t, GLshort r)
-{
- d_1_3_Deprecated->f.MultiTexCoord3s(target, s, t, r);
-}
-
-inline void QOpenGLFunctions_4_2_Compatibility::glMultiTexCoord3iv(GLenum target, const GLint *v)
-{
- d_1_3_Deprecated->f.MultiTexCoord3iv(target, v);
-}
-
-inline void QOpenGLFunctions_4_2_Compatibility::glMultiTexCoord3i(GLenum target, GLint s, GLint t, GLint r)
-{
- d_1_3_Deprecated->f.MultiTexCoord3i(target, s, t, r);
-}
-
-inline void QOpenGLFunctions_4_2_Compatibility::glMultiTexCoord3fv(GLenum target, const GLfloat *v)
-{
- d_1_3_Deprecated->f.MultiTexCoord3fv(target, v);
-}
-
-inline void QOpenGLFunctions_4_2_Compatibility::glMultiTexCoord3f(GLenum target, GLfloat s, GLfloat t, GLfloat r)
-{
- d_1_3_Deprecated->f.MultiTexCoord3f(target, s, t, r);
-}
-
-inline void QOpenGLFunctions_4_2_Compatibility::glMultiTexCoord3dv(GLenum target, const GLdouble *v)
-{
- d_1_3_Deprecated->f.MultiTexCoord3dv(target, v);
-}
-
-inline void QOpenGLFunctions_4_2_Compatibility::glMultiTexCoord3d(GLenum target, GLdouble s, GLdouble t, GLdouble r)
-{
- d_1_3_Deprecated->f.MultiTexCoord3d(target, s, t, r);
-}
-
-inline void QOpenGLFunctions_4_2_Compatibility::glMultiTexCoord2sv(GLenum target, const GLshort *v)
-{
- d_1_3_Deprecated->f.MultiTexCoord2sv(target, v);
-}
-
-inline void QOpenGLFunctions_4_2_Compatibility::glMultiTexCoord2s(GLenum target, GLshort s, GLshort t)
-{
- d_1_3_Deprecated->f.MultiTexCoord2s(target, s, t);
-}
-
-inline void QOpenGLFunctions_4_2_Compatibility::glMultiTexCoord2iv(GLenum target, const GLint *v)
-{
- d_1_3_Deprecated->f.MultiTexCoord2iv(target, v);
-}
-
-inline void QOpenGLFunctions_4_2_Compatibility::glMultiTexCoord2i(GLenum target, GLint s, GLint t)
-{
- d_1_3_Deprecated->f.MultiTexCoord2i(target, s, t);
-}
-
-inline void QOpenGLFunctions_4_2_Compatibility::glMultiTexCoord2fv(GLenum target, const GLfloat *v)
-{
- d_1_3_Deprecated->f.MultiTexCoord2fv(target, v);
-}
-
-inline void QOpenGLFunctions_4_2_Compatibility::glMultiTexCoord2f(GLenum target, GLfloat s, GLfloat t)
-{
- d_1_3_Deprecated->f.MultiTexCoord2f(target, s, t);
-}
-
-inline void QOpenGLFunctions_4_2_Compatibility::glMultiTexCoord2dv(GLenum target, const GLdouble *v)
-{
- d_1_3_Deprecated->f.MultiTexCoord2dv(target, v);
-}
-
-inline void QOpenGLFunctions_4_2_Compatibility::glMultiTexCoord2d(GLenum target, GLdouble s, GLdouble t)
-{
- d_1_3_Deprecated->f.MultiTexCoord2d(target, s, t);
-}
-
-inline void QOpenGLFunctions_4_2_Compatibility::glMultiTexCoord1sv(GLenum target, const GLshort *v)
-{
- d_1_3_Deprecated->f.MultiTexCoord1sv(target, v);
-}
-
-inline void QOpenGLFunctions_4_2_Compatibility::glMultiTexCoord1s(GLenum target, GLshort s)
-{
- d_1_3_Deprecated->f.MultiTexCoord1s(target, s);
-}
-
-inline void QOpenGLFunctions_4_2_Compatibility::glMultiTexCoord1iv(GLenum target, const GLint *v)
-{
- d_1_3_Deprecated->f.MultiTexCoord1iv(target, v);
-}
-
-inline void QOpenGLFunctions_4_2_Compatibility::glMultiTexCoord1i(GLenum target, GLint s)
-{
- d_1_3_Deprecated->f.MultiTexCoord1i(target, s);
-}
-
-inline void QOpenGLFunctions_4_2_Compatibility::glMultiTexCoord1fv(GLenum target, const GLfloat *v)
-{
- d_1_3_Deprecated->f.MultiTexCoord1fv(target, v);
-}
-
-inline void QOpenGLFunctions_4_2_Compatibility::glMultiTexCoord1f(GLenum target, GLfloat s)
-{
- d_1_3_Deprecated->f.MultiTexCoord1f(target, s);
-}
-
-inline void QOpenGLFunctions_4_2_Compatibility::glMultiTexCoord1dv(GLenum target, const GLdouble *v)
-{
- d_1_3_Deprecated->f.MultiTexCoord1dv(target, v);
-}
-
-inline void QOpenGLFunctions_4_2_Compatibility::glMultiTexCoord1d(GLenum target, GLdouble s)
-{
- d_1_3_Deprecated->f.MultiTexCoord1d(target, s);
-}
-
-inline void QOpenGLFunctions_4_2_Compatibility::glClientActiveTexture(GLenum texture)
-{
- d_1_3_Deprecated->f.ClientActiveTexture(texture);
-}
-
-
-// OpenGL 1.4 deprecated functions
-inline void QOpenGLFunctions_4_2_Compatibility::glWindowPos3sv(const GLshort *v)
-{
- d_1_4_Deprecated->f.WindowPos3sv(v);
-}
-
-inline void QOpenGLFunctions_4_2_Compatibility::glWindowPos3s(GLshort x, GLshort y, GLshort z)
-{
- d_1_4_Deprecated->f.WindowPos3s(x, y, z);
-}
-
-inline void QOpenGLFunctions_4_2_Compatibility::glWindowPos3iv(const GLint *v)
-{
- d_1_4_Deprecated->f.WindowPos3iv(v);
-}
-
-inline void QOpenGLFunctions_4_2_Compatibility::glWindowPos3i(GLint x, GLint y, GLint z)
-{
- d_1_4_Deprecated->f.WindowPos3i(x, y, z);
-}
-
-inline void QOpenGLFunctions_4_2_Compatibility::glWindowPos3fv(const GLfloat *v)
-{
- d_1_4_Deprecated->f.WindowPos3fv(v);
-}
-
-inline void QOpenGLFunctions_4_2_Compatibility::glWindowPos3f(GLfloat x, GLfloat y, GLfloat z)
-{
- d_1_4_Deprecated->f.WindowPos3f(x, y, z);
-}
-
-inline void QOpenGLFunctions_4_2_Compatibility::glWindowPos3dv(const GLdouble *v)
-{
- d_1_4_Deprecated->f.WindowPos3dv(v);
-}
-
-inline void QOpenGLFunctions_4_2_Compatibility::glWindowPos3d(GLdouble x, GLdouble y, GLdouble z)
-{
- d_1_4_Deprecated->f.WindowPos3d(x, y, z);
-}
-
-inline void QOpenGLFunctions_4_2_Compatibility::glWindowPos2sv(const GLshort *v)
-{
- d_1_4_Deprecated->f.WindowPos2sv(v);
-}
-
-inline void QOpenGLFunctions_4_2_Compatibility::glWindowPos2s(GLshort x, GLshort y)
-{
- d_1_4_Deprecated->f.WindowPos2s(x, y);
-}
-
-inline void QOpenGLFunctions_4_2_Compatibility::glWindowPos2iv(const GLint *v)
-{
- d_1_4_Deprecated->f.WindowPos2iv(v);
-}
-
-inline void QOpenGLFunctions_4_2_Compatibility::glWindowPos2i(GLint x, GLint y)
-{
- d_1_4_Deprecated->f.WindowPos2i(x, y);
-}
-
-inline void QOpenGLFunctions_4_2_Compatibility::glWindowPos2fv(const GLfloat *v)
-{
- d_1_4_Deprecated->f.WindowPos2fv(v);
-}
-
-inline void QOpenGLFunctions_4_2_Compatibility::glWindowPos2f(GLfloat x, GLfloat y)
-{
- d_1_4_Deprecated->f.WindowPos2f(x, y);
-}
-
-inline void QOpenGLFunctions_4_2_Compatibility::glWindowPos2dv(const GLdouble *v)
-{
- d_1_4_Deprecated->f.WindowPos2dv(v);
-}
-
-inline void QOpenGLFunctions_4_2_Compatibility::glWindowPos2d(GLdouble x, GLdouble y)
-{
- d_1_4_Deprecated->f.WindowPos2d(x, y);
-}
-
-inline void QOpenGLFunctions_4_2_Compatibility::glSecondaryColorPointer(GLint size, GLenum type, GLsizei stride, const GLvoid *pointer)
-{
- d_1_4_Deprecated->f.SecondaryColorPointer(size, type, stride, pointer);
-}
-
-inline void QOpenGLFunctions_4_2_Compatibility::glSecondaryColor3usv(const GLushort *v)
-{
- d_1_4_Deprecated->f.SecondaryColor3usv(v);
-}
-
-inline void QOpenGLFunctions_4_2_Compatibility::glSecondaryColor3us(GLushort red, GLushort green, GLushort blue)
-{
- d_1_4_Deprecated->f.SecondaryColor3us(red, green, blue);
-}
-
-inline void QOpenGLFunctions_4_2_Compatibility::glSecondaryColor3uiv(const GLuint *v)
-{
- d_1_4_Deprecated->f.SecondaryColor3uiv(v);
-}
-
-inline void QOpenGLFunctions_4_2_Compatibility::glSecondaryColor3ui(GLuint red, GLuint green, GLuint blue)
-{
- d_1_4_Deprecated->f.SecondaryColor3ui(red, green, blue);
-}
-
-inline void QOpenGLFunctions_4_2_Compatibility::glSecondaryColor3ubv(const GLubyte *v)
-{
- d_1_4_Deprecated->f.SecondaryColor3ubv(v);
-}
-
-inline void QOpenGLFunctions_4_2_Compatibility::glSecondaryColor3ub(GLubyte red, GLubyte green, GLubyte blue)
-{
- d_1_4_Deprecated->f.SecondaryColor3ub(red, green, blue);
-}
-
-inline void QOpenGLFunctions_4_2_Compatibility::glSecondaryColor3sv(const GLshort *v)
-{
- d_1_4_Deprecated->f.SecondaryColor3sv(v);
-}
-
-inline void QOpenGLFunctions_4_2_Compatibility::glSecondaryColor3s(GLshort red, GLshort green, GLshort blue)
-{
- d_1_4_Deprecated->f.SecondaryColor3s(red, green, blue);
-}
-
-inline void QOpenGLFunctions_4_2_Compatibility::glSecondaryColor3iv(const GLint *v)
-{
- d_1_4_Deprecated->f.SecondaryColor3iv(v);
-}
-
-inline void QOpenGLFunctions_4_2_Compatibility::glSecondaryColor3i(GLint red, GLint green, GLint blue)
-{
- d_1_4_Deprecated->f.SecondaryColor3i(red, green, blue);
-}
-
-inline void QOpenGLFunctions_4_2_Compatibility::glSecondaryColor3fv(const GLfloat *v)
-{
- d_1_4_Deprecated->f.SecondaryColor3fv(v);
-}
-
-inline void QOpenGLFunctions_4_2_Compatibility::glSecondaryColor3f(GLfloat red, GLfloat green, GLfloat blue)
-{
- d_1_4_Deprecated->f.SecondaryColor3f(red, green, blue);
-}
-
-inline void QOpenGLFunctions_4_2_Compatibility::glSecondaryColor3dv(const GLdouble *v)
-{
- d_1_4_Deprecated->f.SecondaryColor3dv(v);
-}
-
-inline void QOpenGLFunctions_4_2_Compatibility::glSecondaryColor3d(GLdouble red, GLdouble green, GLdouble blue)
-{
- d_1_4_Deprecated->f.SecondaryColor3d(red, green, blue);
-}
-
-inline void QOpenGLFunctions_4_2_Compatibility::glSecondaryColor3bv(const GLbyte *v)
-{
- d_1_4_Deprecated->f.SecondaryColor3bv(v);
-}
-
-inline void QOpenGLFunctions_4_2_Compatibility::glSecondaryColor3b(GLbyte red, GLbyte green, GLbyte blue)
-{
- d_1_4_Deprecated->f.SecondaryColor3b(red, green, blue);
-}
-
-inline void QOpenGLFunctions_4_2_Compatibility::glFogCoordPointer(GLenum type, GLsizei stride, const GLvoid *pointer)
-{
- d_1_4_Deprecated->f.FogCoordPointer(type, stride, pointer);
-}
-
-inline void QOpenGLFunctions_4_2_Compatibility::glFogCoorddv(const GLdouble *coord)
-{
- d_1_4_Deprecated->f.FogCoorddv(coord);
-}
-
-inline void QOpenGLFunctions_4_2_Compatibility::glFogCoordd(GLdouble coord)
-{
- d_1_4_Deprecated->f.FogCoordd(coord);
-}
-
-inline void QOpenGLFunctions_4_2_Compatibility::glFogCoordfv(const GLfloat *coord)
-{
- d_1_4_Deprecated->f.FogCoordfv(coord);
-}
-
-inline void QOpenGLFunctions_4_2_Compatibility::glFogCoordf(GLfloat coord)
-{
- d_1_4_Deprecated->f.FogCoordf(coord);
-}
-
-
-// OpenGL 1.5 deprecated functions
-
-// OpenGL 2.0 deprecated functions
-inline void QOpenGLFunctions_4_2_Compatibility::glVertexAttrib4usv(GLuint index, const GLushort *v)
-{
- d_2_0_Core->f.VertexAttrib4usv(index, v);
-}
-
-inline void QOpenGLFunctions_4_2_Compatibility::glVertexAttrib4uiv(GLuint index, const GLuint *v)
-{
- d_2_0_Core->f.VertexAttrib4uiv(index, v);
-}
-
-inline void QOpenGLFunctions_4_2_Compatibility::glVertexAttrib4ubv(GLuint index, const GLubyte *v)
-{
- d_2_0_Core->f.VertexAttrib4ubv(index, v);
-}
-
-inline void QOpenGLFunctions_4_2_Compatibility::glVertexAttrib4sv(GLuint index, const GLshort *v)
-{
- d_2_0_Core->f.VertexAttrib4sv(index, v);
-}
-
-inline void QOpenGLFunctions_4_2_Compatibility::glVertexAttrib4s(GLuint index, GLshort x, GLshort y, GLshort z, GLshort w)
-{
- d_2_0_Core->f.VertexAttrib4s(index, x, y, z, w);
-}
-
-inline void QOpenGLFunctions_4_2_Compatibility::glVertexAttrib4iv(GLuint index, const GLint *v)
-{
- d_2_0_Core->f.VertexAttrib4iv(index, v);
-}
-
-inline void QOpenGLFunctions_4_2_Compatibility::glVertexAttrib4fv(GLuint index, const GLfloat *v)
-{
- d_2_0_Core->f.VertexAttrib4fv(index, v);
-}
-
-inline void QOpenGLFunctions_4_2_Compatibility::glVertexAttrib4f(GLuint index, GLfloat x, GLfloat y, GLfloat z, GLfloat w)
-{
- d_2_0_Core->f.VertexAttrib4f(index, x, y, z, w);
-}
-
-inline void QOpenGLFunctions_4_2_Compatibility::glVertexAttrib4dv(GLuint index, const GLdouble *v)
-{
- d_2_0_Core->f.VertexAttrib4dv(index, v);
-}
-
-inline void QOpenGLFunctions_4_2_Compatibility::glVertexAttrib4d(GLuint index, GLdouble x, GLdouble y, GLdouble z, GLdouble w)
-{
- d_2_0_Core->f.VertexAttrib4d(index, x, y, z, w);
-}
-
-inline void QOpenGLFunctions_4_2_Compatibility::glVertexAttrib4bv(GLuint index, const GLbyte *v)
-{
- d_2_0_Core->f.VertexAttrib4bv(index, v);
-}
-
-inline void QOpenGLFunctions_4_2_Compatibility::glVertexAttrib4Nusv(GLuint index, const GLushort *v)
-{
- d_2_0_Core->f.VertexAttrib4Nusv(index, v);
-}
-
-inline void QOpenGLFunctions_4_2_Compatibility::glVertexAttrib4Nuiv(GLuint index, const GLuint *v)
-{
- d_2_0_Core->f.VertexAttrib4Nuiv(index, v);
-}
-
-inline void QOpenGLFunctions_4_2_Compatibility::glVertexAttrib4Nubv(GLuint index, const GLubyte *v)
-{
- d_2_0_Core->f.VertexAttrib4Nubv(index, v);
-}
-
-inline void QOpenGLFunctions_4_2_Compatibility::glVertexAttrib4Nub(GLuint index, GLubyte x, GLubyte y, GLubyte z, GLubyte w)
-{
- d_2_0_Core->f.VertexAttrib4Nub(index, x, y, z, w);
-}
-
-inline void QOpenGLFunctions_4_2_Compatibility::glVertexAttrib4Nsv(GLuint index, const GLshort *v)
-{
- d_2_0_Core->f.VertexAttrib4Nsv(index, v);
-}
-
-inline void QOpenGLFunctions_4_2_Compatibility::glVertexAttrib4Niv(GLuint index, const GLint *v)
-{
- d_2_0_Core->f.VertexAttrib4Niv(index, v);
-}
-
-inline void QOpenGLFunctions_4_2_Compatibility::glVertexAttrib4Nbv(GLuint index, const GLbyte *v)
-{
- d_2_0_Core->f.VertexAttrib4Nbv(index, v);
-}
-
-inline void QOpenGLFunctions_4_2_Compatibility::glVertexAttrib3sv(GLuint index, const GLshort *v)
-{
- d_2_0_Core->f.VertexAttrib3sv(index, v);
-}
-
-inline void QOpenGLFunctions_4_2_Compatibility::glVertexAttrib3s(GLuint index, GLshort x, GLshort y, GLshort z)
-{
- d_2_0_Core->f.VertexAttrib3s(index, x, y, z);
-}
-
-inline void QOpenGLFunctions_4_2_Compatibility::glVertexAttrib3fv(GLuint index, const GLfloat *v)
-{
- d_2_0_Core->f.VertexAttrib3fv(index, v);
-}
-
-inline void QOpenGLFunctions_4_2_Compatibility::glVertexAttrib3f(GLuint index, GLfloat x, GLfloat y, GLfloat z)
-{
- d_2_0_Core->f.VertexAttrib3f(index, x, y, z);
-}
-
-inline void QOpenGLFunctions_4_2_Compatibility::glVertexAttrib3dv(GLuint index, const GLdouble *v)
-{
- d_2_0_Core->f.VertexAttrib3dv(index, v);
-}
-
-inline void QOpenGLFunctions_4_2_Compatibility::glVertexAttrib3d(GLuint index, GLdouble x, GLdouble y, GLdouble z)
-{
- d_2_0_Core->f.VertexAttrib3d(index, x, y, z);
-}
-
-inline void QOpenGLFunctions_4_2_Compatibility::glVertexAttrib2sv(GLuint index, const GLshort *v)
-{
- d_2_0_Core->f.VertexAttrib2sv(index, v);
-}
-
-inline void QOpenGLFunctions_4_2_Compatibility::glVertexAttrib2s(GLuint index, GLshort x, GLshort y)
-{
- d_2_0_Core->f.VertexAttrib2s(index, x, y);
-}
-
-inline void QOpenGLFunctions_4_2_Compatibility::glVertexAttrib2fv(GLuint index, const GLfloat *v)
-{
- d_2_0_Core->f.VertexAttrib2fv(index, v);
-}
-
-inline void QOpenGLFunctions_4_2_Compatibility::glVertexAttrib2f(GLuint index, GLfloat x, GLfloat y)
-{
- d_2_0_Core->f.VertexAttrib2f(index, x, y);
-}
-
-inline void QOpenGLFunctions_4_2_Compatibility::glVertexAttrib2dv(GLuint index, const GLdouble *v)
-{
- d_2_0_Core->f.VertexAttrib2dv(index, v);
-}
-
-inline void QOpenGLFunctions_4_2_Compatibility::glVertexAttrib2d(GLuint index, GLdouble x, GLdouble y)
-{
- d_2_0_Core->f.VertexAttrib2d(index, x, y);
-}
-
-inline void QOpenGLFunctions_4_2_Compatibility::glVertexAttrib1sv(GLuint index, const GLshort *v)
-{
- d_2_0_Core->f.VertexAttrib1sv(index, v);
-}
-
-inline void QOpenGLFunctions_4_2_Compatibility::glVertexAttrib1s(GLuint index, GLshort x)
-{
- d_2_0_Core->f.VertexAttrib1s(index, x);
-}
-
-inline void QOpenGLFunctions_4_2_Compatibility::glVertexAttrib1fv(GLuint index, const GLfloat *v)
-{
- d_2_0_Core->f.VertexAttrib1fv(index, v);
-}
-
-inline void QOpenGLFunctions_4_2_Compatibility::glVertexAttrib1f(GLuint index, GLfloat x)
-{
- d_2_0_Core->f.VertexAttrib1f(index, x);
-}
-
-inline void QOpenGLFunctions_4_2_Compatibility::glVertexAttrib1dv(GLuint index, const GLdouble *v)
-{
- d_2_0_Core->f.VertexAttrib1dv(index, v);
-}
-
-inline void QOpenGLFunctions_4_2_Compatibility::glVertexAttrib1d(GLuint index, GLdouble x)
-{
- d_2_0_Core->f.VertexAttrib1d(index, x);
-}
-
-
-// OpenGL 2.1 deprecated functions
-
-// OpenGL 3.0 deprecated functions
-inline void QOpenGLFunctions_4_2_Compatibility::glVertexAttribI4usv(GLuint index, const GLushort *v)
-{
- d_3_0_Core->f.VertexAttribI4usv(index, v);
-}
-
-inline void QOpenGLFunctions_4_2_Compatibility::glVertexAttribI4ubv(GLuint index, const GLubyte *v)
-{
- d_3_0_Core->f.VertexAttribI4ubv(index, v);
-}
-
-inline void QOpenGLFunctions_4_2_Compatibility::glVertexAttribI4sv(GLuint index, const GLshort *v)
-{
- d_3_0_Core->f.VertexAttribI4sv(index, v);
-}
-
-inline void QOpenGLFunctions_4_2_Compatibility::glVertexAttribI4bv(GLuint index, const GLbyte *v)
-{
- d_3_0_Core->f.VertexAttribI4bv(index, v);
-}
-
-inline void QOpenGLFunctions_4_2_Compatibility::glVertexAttribI4uiv(GLuint index, const GLuint *v)
-{
- d_3_0_Core->f.VertexAttribI4uiv(index, v);
-}
-
-inline void QOpenGLFunctions_4_2_Compatibility::glVertexAttribI3uiv(GLuint index, const GLuint *v)
-{
- d_3_0_Core->f.VertexAttribI3uiv(index, v);
-}
-
-inline void QOpenGLFunctions_4_2_Compatibility::glVertexAttribI2uiv(GLuint index, const GLuint *v)
-{
- d_3_0_Core->f.VertexAttribI2uiv(index, v);
-}
-
-inline void QOpenGLFunctions_4_2_Compatibility::glVertexAttribI1uiv(GLuint index, const GLuint *v)
-{
- d_3_0_Core->f.VertexAttribI1uiv(index, v);
-}
-
-inline void QOpenGLFunctions_4_2_Compatibility::glVertexAttribI4iv(GLuint index, const GLint *v)
-{
- d_3_0_Core->f.VertexAttribI4iv(index, v);
-}
-
-inline void QOpenGLFunctions_4_2_Compatibility::glVertexAttribI3iv(GLuint index, const GLint *v)
-{
- d_3_0_Core->f.VertexAttribI3iv(index, v);
-}
-
-inline void QOpenGLFunctions_4_2_Compatibility::glVertexAttribI2iv(GLuint index, const GLint *v)
-{
- d_3_0_Core->f.VertexAttribI2iv(index, v);
-}
-
-inline void QOpenGLFunctions_4_2_Compatibility::glVertexAttribI1iv(GLuint index, const GLint *v)
-{
- d_3_0_Core->f.VertexAttribI1iv(index, v);
-}
-
-inline void QOpenGLFunctions_4_2_Compatibility::glVertexAttribI4ui(GLuint index, GLuint x, GLuint y, GLuint z, GLuint w)
-{
- d_3_0_Core->f.VertexAttribI4ui(index, x, y, z, w);
-}
-
-inline void QOpenGLFunctions_4_2_Compatibility::glVertexAttribI3ui(GLuint index, GLuint x, GLuint y, GLuint z)
-{
- d_3_0_Core->f.VertexAttribI3ui(index, x, y, z);
-}
-
-inline void QOpenGLFunctions_4_2_Compatibility::glVertexAttribI2ui(GLuint index, GLuint x, GLuint y)
-{
- d_3_0_Core->f.VertexAttribI2ui(index, x, y);
-}
-
-inline void QOpenGLFunctions_4_2_Compatibility::glVertexAttribI1ui(GLuint index, GLuint x)
-{
- d_3_0_Core->f.VertexAttribI1ui(index, x);
-}
-
-inline void QOpenGLFunctions_4_2_Compatibility::glVertexAttribI4i(GLuint index, GLint x, GLint y, GLint z, GLint w)
-{
- d_3_0_Core->f.VertexAttribI4i(index, x, y, z, w);
-}
-
-inline void QOpenGLFunctions_4_2_Compatibility::glVertexAttribI3i(GLuint index, GLint x, GLint y, GLint z)
-{
- d_3_0_Core->f.VertexAttribI3i(index, x, y, z);
-}
-
-inline void QOpenGLFunctions_4_2_Compatibility::glVertexAttribI2i(GLuint index, GLint x, GLint y)
-{
- d_3_0_Core->f.VertexAttribI2i(index, x, y);
-}
-
-inline void QOpenGLFunctions_4_2_Compatibility::glVertexAttribI1i(GLuint index, GLint x)
-{
- d_3_0_Core->f.VertexAttribI1i(index, x);
-}
-
-
-// OpenGL 3.1 deprecated functions
-
-// OpenGL 3.2 deprecated functions
-
-// OpenGL 3.3 deprecated functions
-
-// OpenGL 4.0 deprecated functions
-
-// OpenGL 4.1 deprecated functions
-
-// OpenGL 4.2 deprecated functions
-
-
-QT_END_NAMESPACE
-
-#ifdef Q_OS_WIN
-#pragma pop_macro("MemoryBarrier")
-#endif
-
-#endif // QT_NO_OPENGL && !QT_OPENGL_ES_2
-
-#endif
diff --git a/src/gui/opengl/qopenglfunctions_4_2_core.cpp b/src/gui/opengl/qopenglfunctions_4_2_core.cpp
deleted file mode 100644
index 38dbe1b596..0000000000
--- a/src/gui/opengl/qopenglfunctions_4_2_core.cpp
+++ /dev/null
@@ -1,251 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2013 Klaralvdalens Datakonsult AB (KDAB)
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the QtGui module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-**
-** This file was generated by glgen version 0.1
-** Command line was: glgen
-**
-** glgen is Copyright (C) 2013 Klaralvdalens Datakonsult AB (KDAB)
-**
-** This is an auto-generated file.
-** Do not edit! All changes made to it will be lost.
-**
-****************************************************************************/
-
-#include "qopenglfunctions_4_2_core.h"
-#include "qopenglcontext.h"
-
-QT_BEGIN_NAMESPACE
-
-/*!
- \class QOpenGLFunctions_4_2_Core
- \inmodule QtGui
- \since 5.1
- \wrapper
- \brief The QOpenGLFunctions_4_2_Core class provides all functions for OpenGL 4.2 core profile.
-
- This class is a wrapper for functions from OpenGL 4.2 core profile.
- See reference pages on \l {http://www.opengl.org/sdk/docs/}{opengl.org}
- for function documentation.
-
- \sa QAbstractOpenGLFunctions
-*/
-
-QOpenGLFunctions_4_2_Core::QOpenGLFunctions_4_2_Core()
- : QAbstractOpenGLFunctions()
- , d_1_0_Core(nullptr)
- , d_1_1_Core(nullptr)
- , d_1_2_Core(nullptr)
- , d_1_3_Core(nullptr)
- , d_1_4_Core(nullptr)
- , d_1_5_Core(nullptr)
- , d_2_0_Core(nullptr)
- , d_2_1_Core(nullptr)
- , d_3_0_Core(nullptr)
- , d_3_1_Core(nullptr)
- , d_3_2_Core(nullptr)
- , d_3_3_Core(nullptr)
- , d_4_0_Core(nullptr)
- , d_4_1_Core(nullptr)
- , d_4_2_Core(nullptr)
-{
-}
-
-QOpenGLFunctions_4_2_Core::~QOpenGLFunctions_4_2_Core()
-{
- if (d_1_0_Core) {
- d_1_0_Core->refs.deref();
- Q_ASSERT(d_1_0_Core->refs.loadRelaxed());
- }
- if (d_1_1_Core) {
- d_1_1_Core->refs.deref();
- Q_ASSERT(d_1_1_Core->refs.loadRelaxed());
- }
- if (d_1_2_Core) {
- d_1_2_Core->refs.deref();
- Q_ASSERT(d_1_2_Core->refs.loadRelaxed());
- }
- if (d_1_3_Core) {
- d_1_3_Core->refs.deref();
- Q_ASSERT(d_1_3_Core->refs.loadRelaxed());
- }
- if (d_1_4_Core) {
- d_1_4_Core->refs.deref();
- Q_ASSERT(d_1_4_Core->refs.loadRelaxed());
- }
- if (d_1_5_Core) {
- d_1_5_Core->refs.deref();
- Q_ASSERT(d_1_5_Core->refs.loadRelaxed());
- }
- if (d_2_0_Core) {
- d_2_0_Core->refs.deref();
- Q_ASSERT(d_2_0_Core->refs.loadRelaxed());
- }
- if (d_2_1_Core) {
- d_2_1_Core->refs.deref();
- Q_ASSERT(d_2_1_Core->refs.loadRelaxed());
- }
- if (d_3_0_Core) {
- d_3_0_Core->refs.deref();
- Q_ASSERT(d_3_0_Core->refs.loadRelaxed());
- }
- if (d_3_1_Core) {
- d_3_1_Core->refs.deref();
- Q_ASSERT(d_3_1_Core->refs.loadRelaxed());
- }
- if (d_3_2_Core) {
- d_3_2_Core->refs.deref();
- Q_ASSERT(d_3_2_Core->refs.loadRelaxed());
- }
- if (d_3_3_Core) {
- d_3_3_Core->refs.deref();
- Q_ASSERT(d_3_3_Core->refs.loadRelaxed());
- }
- if (d_4_0_Core) {
- d_4_0_Core->refs.deref();
- Q_ASSERT(d_4_0_Core->refs.loadRelaxed());
- }
- if (d_4_1_Core) {
- d_4_1_Core->refs.deref();
- Q_ASSERT(d_4_1_Core->refs.loadRelaxed());
- }
- if (d_4_2_Core) {
- d_4_2_Core->refs.deref();
- Q_ASSERT(d_4_2_Core->refs.loadRelaxed());
- }
-}
-
-bool QOpenGLFunctions_4_2_Core::initializeOpenGLFunctions()
-{
- if ( isInitialized() )
- return true;
-
- QOpenGLContext* context = QOpenGLContext::currentContext();
-
- // If owned by a context object make sure it is current.
- // Also check that current context is capable of resolving all needed functions
- if (((owningContext() && owningContext() == context) || !owningContext())
- && QOpenGLFunctions_4_2_Core::isContextCompatible(context))
- {
- // Associate with private implementation, creating if necessary
- // Function pointers in the backends are resolved at creation time
- QOpenGLVersionFunctionsBackend* d = nullptr;
- d = QAbstractOpenGLFunctionsPrivate::functionsBackend(context, QOpenGLFunctions_1_0_CoreBackend::versionStatus());
- d_1_0_Core = static_cast<QOpenGLFunctions_1_0_CoreBackend*>(d);
- d->refs.ref();
-
- d = QAbstractOpenGLFunctionsPrivate::functionsBackend(context, QOpenGLFunctions_1_1_CoreBackend::versionStatus());
- d_1_1_Core = static_cast<QOpenGLFunctions_1_1_CoreBackend*>(d);
- d->refs.ref();
-
- d = QAbstractOpenGLFunctionsPrivate::functionsBackend(context, QOpenGLFunctions_1_2_CoreBackend::versionStatus());
- d_1_2_Core = static_cast<QOpenGLFunctions_1_2_CoreBackend*>(d);
- d->refs.ref();
-
- d = QAbstractOpenGLFunctionsPrivate::functionsBackend(context, QOpenGLFunctions_1_3_CoreBackend::versionStatus());
- d_1_3_Core = static_cast<QOpenGLFunctions_1_3_CoreBackend*>(d);
- d->refs.ref();
-
- d = QAbstractOpenGLFunctionsPrivate::functionsBackend(context, QOpenGLFunctions_1_4_CoreBackend::versionStatus());
- d_1_4_Core = static_cast<QOpenGLFunctions_1_4_CoreBackend*>(d);
- d->refs.ref();
-
- d = QAbstractOpenGLFunctionsPrivate::functionsBackend(context, QOpenGLFunctions_1_5_CoreBackend::versionStatus());
- d_1_5_Core = static_cast<QOpenGLFunctions_1_5_CoreBackend*>(d);
- d->refs.ref();
-
- d = QAbstractOpenGLFunctionsPrivate::functionsBackend(context, QOpenGLFunctions_2_0_CoreBackend::versionStatus());
- d_2_0_Core = static_cast<QOpenGLFunctions_2_0_CoreBackend*>(d);
- d->refs.ref();
-
- d = QAbstractOpenGLFunctionsPrivate::functionsBackend(context, QOpenGLFunctions_2_1_CoreBackend::versionStatus());
- d_2_1_Core = static_cast<QOpenGLFunctions_2_1_CoreBackend*>(d);
- d->refs.ref();
-
- d = QAbstractOpenGLFunctionsPrivate::functionsBackend(context, QOpenGLFunctions_3_0_CoreBackend::versionStatus());
- d_3_0_Core = static_cast<QOpenGLFunctions_3_0_CoreBackend*>(d);
- d->refs.ref();
-
- d = QAbstractOpenGLFunctionsPrivate::functionsBackend(context, QOpenGLFunctions_3_1_CoreBackend::versionStatus());
- d_3_1_Core = static_cast<QOpenGLFunctions_3_1_CoreBackend*>(d);
- d->refs.ref();
-
- d = QAbstractOpenGLFunctionsPrivate::functionsBackend(context, QOpenGLFunctions_3_2_CoreBackend::versionStatus());
- d_3_2_Core = static_cast<QOpenGLFunctions_3_2_CoreBackend*>(d);
- d->refs.ref();
-
- d = QAbstractOpenGLFunctionsPrivate::functionsBackend(context, QOpenGLFunctions_3_3_CoreBackend::versionStatus());
- d_3_3_Core = static_cast<QOpenGLFunctions_3_3_CoreBackend*>(d);
- d->refs.ref();
-
- d = QAbstractOpenGLFunctionsPrivate::functionsBackend(context, QOpenGLFunctions_4_0_CoreBackend::versionStatus());
- d_4_0_Core = static_cast<QOpenGLFunctions_4_0_CoreBackend*>(d);
- d->refs.ref();
-
- d = QAbstractOpenGLFunctionsPrivate::functionsBackend(context, QOpenGLFunctions_4_1_CoreBackend::versionStatus());
- d_4_1_Core = static_cast<QOpenGLFunctions_4_1_CoreBackend*>(d);
- d->refs.ref();
-
- d = QAbstractOpenGLFunctionsPrivate::functionsBackend(context, QOpenGLFunctions_4_2_CoreBackend::versionStatus());
- d_4_2_Core = static_cast<QOpenGLFunctions_4_2_CoreBackend*>(d);
- d->refs.ref();
-
- QAbstractOpenGLFunctions::initializeOpenGLFunctions();
- }
- return isInitialized();
-}
-
-bool QOpenGLFunctions_4_2_Core::isContextCompatible(QOpenGLContext *context)
-{
- Q_ASSERT(context);
- QSurfaceFormat f = context->format();
- const QPair<int, int> v = qMakePair(f.majorVersion(), f.minorVersion());
- if (v < qMakePair(4, 2))
- return false;
-
- return true;
-}
-
-QOpenGLVersionProfile QOpenGLFunctions_4_2_Core::versionProfile()
-{
- QOpenGLVersionProfile v;
- v.setVersion(4, 2);
- v.setProfile(QSurfaceFormat::CoreProfile);
- return v;
-}
-
-QT_END_NAMESPACE
diff --git a/src/gui/opengl/qopenglfunctions_4_2_core.h b/src/gui/opengl/qopenglfunctions_4_2_core.h
deleted file mode 100644
index 5ca98e9808..0000000000
--- a/src/gui/opengl/qopenglfunctions_4_2_core.h
+++ /dev/null
@@ -1,3042 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2013 Klaralvdalens Datakonsult AB (KDAB)
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the QtGui module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-**
-** This file was generated by glgen version 0.1
-** Command line was: glgen
-**
-** glgen is Copyright (C) 2013 Klaralvdalens Datakonsult AB (KDAB)
-**
-** This is an auto-generated file.
-** Do not edit! All changes made to it will be lost.
-**
-****************************************************************************/
-
-#ifndef QOPENGLVERSIONFUNCTIONS_4_2_CORE_H
-#define QOPENGLVERSIONFUNCTIONS_4_2_CORE_H
-
-#include <QtGui/qtguiglobal.h>
-
-#if !defined(QT_NO_OPENGL) && !defined(QT_OPENGL_ES_2)
-
-#include <QtGui/QOpenGLVersionFunctions>
-#include <QtGui/qopenglcontext.h>
-
-// MemoryBarrier is a macro on some architectures on Windows
-#ifdef Q_OS_WIN
-#pragma push_macro("MemoryBarrier")
-#undef MemoryBarrier
-#endif
-
-QT_BEGIN_NAMESPACE
-
-class Q_GUI_EXPORT QOpenGLFunctions_4_2_Core : public QAbstractOpenGLFunctions
-{
-public:
- QOpenGLFunctions_4_2_Core();
- ~QOpenGLFunctions_4_2_Core();
-
- bool initializeOpenGLFunctions() override;
-
- // OpenGL 1.0 core functions
- void glViewport(GLint x, GLint y, GLsizei width, GLsizei height);
- void glDepthRange(GLdouble nearVal, GLdouble farVal);
- GLboolean glIsEnabled(GLenum cap);
- void glGetTexLevelParameteriv(GLenum target, GLint level, GLenum pname, GLint *params);
- void glGetTexLevelParameterfv(GLenum target, GLint level, GLenum pname, GLfloat *params);
- void glGetTexParameteriv(GLenum target, GLenum pname, GLint *params);
- void glGetTexParameterfv(GLenum target, GLenum pname, GLfloat *params);
- void glGetTexImage(GLenum target, GLint level, GLenum format, GLenum type, GLvoid *pixels);
- const GLubyte * glGetString(GLenum name);
- void glGetIntegerv(GLenum pname, GLint *params);
- void glGetFloatv(GLenum pname, GLfloat *params);
- GLenum glGetError();
- void glGetDoublev(GLenum pname, GLdouble *params);
- void glGetBooleanv(GLenum pname, GLboolean *params);
- void glReadPixels(GLint x, GLint y, GLsizei width, GLsizei height, GLenum format, GLenum type, GLvoid *pixels);
- void glReadBuffer(GLenum mode);
- void glPixelStorei(GLenum pname, GLint param);
- void glPixelStoref(GLenum pname, GLfloat param);
- void glDepthFunc(GLenum func);
- void glStencilOp(GLenum fail, GLenum zfail, GLenum zpass);
- void glStencilFunc(GLenum func, GLint ref, GLuint mask);
- void glLogicOp(GLenum opcode);
- void glBlendFunc(GLenum sfactor, GLenum dfactor);
- void glFlush();
- void glFinish();
- void glEnable(GLenum cap);
- void glDisable(GLenum cap);
- void glDepthMask(GLboolean flag);
- void glColorMask(GLboolean red, GLboolean green, GLboolean blue, GLboolean alpha);
- void glStencilMask(GLuint mask);
- void glClearDepth(GLdouble depth);
- void glClearStencil(GLint s);
- void glClearColor(GLfloat red, GLfloat green, GLfloat blue, GLfloat alpha);
- void glClear(GLbitfield mask);
- void glDrawBuffer(GLenum mode);
- void glTexImage2D(GLenum target, GLint level, GLint internalformat, GLsizei width, GLsizei height, GLint border, GLenum format, GLenum type, const GLvoid *pixels);
- void glTexImage1D(GLenum target, GLint level, GLint internalformat, GLsizei width, GLint border, GLenum format, GLenum type, const GLvoid *pixels);
- void glTexParameteriv(GLenum target, GLenum pname, const GLint *params);
- void glTexParameteri(GLenum target, GLenum pname, GLint param);
- void glTexParameterfv(GLenum target, GLenum pname, const GLfloat *params);
- void glTexParameterf(GLenum target, GLenum pname, GLfloat param);
- void glScissor(GLint x, GLint y, GLsizei width, GLsizei height);
- void glPolygonMode(GLenum face, GLenum mode);
- void glPointSize(GLfloat size);
- void glLineWidth(GLfloat width);
- void glHint(GLenum target, GLenum mode);
- void glFrontFace(GLenum mode);
- void glCullFace(GLenum mode);
-
- // OpenGL 1.1 core functions
- void glIndexubv(const GLubyte *c);
- void glIndexub(GLubyte c);
- GLboolean glIsTexture(GLuint texture);
- void glGenTextures(GLsizei n, GLuint *textures);
- void glDeleteTextures(GLsizei n, const GLuint *textures);
- void glBindTexture(GLenum target, GLuint texture);
- void glTexSubImage2D(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLenum type, const GLvoid *pixels);
- void glTexSubImage1D(GLenum target, GLint level, GLint xoffset, GLsizei width, GLenum format, GLenum type, const GLvoid *pixels);
- void glCopyTexSubImage2D(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint x, GLint y, GLsizei width, GLsizei height);
- void glCopyTexSubImage1D(GLenum target, GLint level, GLint xoffset, GLint x, GLint y, GLsizei width);
- void glCopyTexImage2D(GLenum target, GLint level, GLenum internalformat, GLint x, GLint y, GLsizei width, GLsizei height, GLint border);
- void glCopyTexImage1D(GLenum target, GLint level, GLenum internalformat, GLint x, GLint y, GLsizei width, GLint border);
- void glPolygonOffset(GLfloat factor, GLfloat units);
- void glGetPointerv(GLenum pname, GLvoid* *params);
- void glDrawElements(GLenum mode, GLsizei count, GLenum type, const GLvoid *indices);
- void glDrawArrays(GLenum mode, GLint first, GLsizei count);
-
- // OpenGL 1.2 core functions
- void glCopyTexSubImage3D(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLint x, GLint y, GLsizei width, GLsizei height);
- void glTexSubImage3D(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLenum type, const GLvoid *pixels);
- void glTexImage3D(GLenum target, GLint level, GLint internalformat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLenum format, GLenum type, const GLvoid *pixels);
- void glDrawRangeElements(GLenum mode, GLuint start, GLuint end, GLsizei count, GLenum type, const GLvoid *indices);
- void glBlendEquation(GLenum mode);
- void glBlendColor(GLfloat red, GLfloat green, GLfloat blue, GLfloat alpha);
-
- // OpenGL 1.3 core functions
- void glGetCompressedTexImage(GLenum target, GLint level, GLvoid *img);
- void glCompressedTexSubImage1D(GLenum target, GLint level, GLint xoffset, GLsizei width, GLenum format, GLsizei imageSize, const GLvoid *data);
- void glCompressedTexSubImage2D(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLsizei imageSize, const GLvoid *data);
- void glCompressedTexSubImage3D(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLsizei imageSize, const GLvoid *data);
- void glCompressedTexImage1D(GLenum target, GLint level, GLenum internalformat, GLsizei width, GLint border, GLsizei imageSize, const GLvoid *data);
- void glCompressedTexImage2D(GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLint border, GLsizei imageSize, const GLvoid *data);
- void glCompressedTexImage3D(GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLsizei imageSize, const GLvoid *data);
- void glSampleCoverage(GLfloat value, GLboolean invert);
- void glActiveTexture(GLenum texture);
-
- // OpenGL 1.4 core functions
- void glPointParameteriv(GLenum pname, const GLint *params);
- void glPointParameteri(GLenum pname, GLint param);
- void glPointParameterfv(GLenum pname, const GLfloat *params);
- void glPointParameterf(GLenum pname, GLfloat param);
- void glMultiDrawElements(GLenum mode, const GLsizei *count, GLenum type, const GLvoid* const *indices, GLsizei drawcount);
- void glMultiDrawArrays(GLenum mode, const GLint *first, const GLsizei *count, GLsizei drawcount);
- void glBlendFuncSeparate(GLenum sfactorRGB, GLenum dfactorRGB, GLenum sfactorAlpha, GLenum dfactorAlpha);
-
- // OpenGL 1.5 core functions
- void glGetBufferPointerv(GLenum target, GLenum pname, GLvoid* *params);
- void glGetBufferParameteriv(GLenum target, GLenum pname, GLint *params);
- GLboolean glUnmapBuffer(GLenum target);
- GLvoid* glMapBuffer(GLenum target, GLenum access);
- void glGetBufferSubData(GLenum target, GLintptr offset, GLsizeiptr size, GLvoid *data);
- void glBufferSubData(GLenum target, GLintptr offset, GLsizeiptr size, const GLvoid *data);
- void glBufferData(GLenum target, GLsizeiptr size, const GLvoid *data, GLenum usage);
- GLboolean glIsBuffer(GLuint buffer);
- void glGenBuffers(GLsizei n, GLuint *buffers);
- void glDeleteBuffers(GLsizei n, const GLuint *buffers);
- void glBindBuffer(GLenum target, GLuint buffer);
- void glGetQueryObjectuiv(GLuint id, GLenum pname, GLuint *params);
- void glGetQueryObjectiv(GLuint id, GLenum pname, GLint *params);
- void glGetQueryiv(GLenum target, GLenum pname, GLint *params);
- void glEndQuery(GLenum target);
- void glBeginQuery(GLenum target, GLuint id);
- GLboolean glIsQuery(GLuint id);
- void glDeleteQueries(GLsizei n, const GLuint *ids);
- void glGenQueries(GLsizei n, GLuint *ids);
-
- // OpenGL 2.0 core functions
- void glVertexAttribPointer(GLuint index, GLint size, GLenum type, GLboolean normalized, GLsizei stride, const GLvoid *pointer);
- void glValidateProgram(GLuint program);
- void glUniformMatrix4fv(GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
- void glUniformMatrix3fv(GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
- void glUniformMatrix2fv(GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
- void glUniform4iv(GLint location, GLsizei count, const GLint *value);
- void glUniform3iv(GLint location, GLsizei count, const GLint *value);
- void glUniform2iv(GLint location, GLsizei count, const GLint *value);
- void glUniform1iv(GLint location, GLsizei count, const GLint *value);
- void glUniform4fv(GLint location, GLsizei count, const GLfloat *value);
- void glUniform3fv(GLint location, GLsizei count, const GLfloat *value);
- void glUniform2fv(GLint location, GLsizei count, const GLfloat *value);
- void glUniform1fv(GLint location, GLsizei count, const GLfloat *value);
- void glUniform4i(GLint location, GLint v0, GLint v1, GLint v2, GLint v3);
- void glUniform3i(GLint location, GLint v0, GLint v1, GLint v2);
- void glUniform2i(GLint location, GLint v0, GLint v1);
- void glUniform1i(GLint location, GLint v0);
- void glUniform4f(GLint location, GLfloat v0, GLfloat v1, GLfloat v2, GLfloat v3);
- void glUniform3f(GLint location, GLfloat v0, GLfloat v1, GLfloat v2);
- void glUniform2f(GLint location, GLfloat v0, GLfloat v1);
- void glUniform1f(GLint location, GLfloat v0);
- void glUseProgram(GLuint program);
- void glShaderSource(GLuint shader, GLsizei count, const GLchar* const *string, const GLint *length);
- void glLinkProgram(GLuint program);
- GLboolean glIsShader(GLuint shader);
- GLboolean glIsProgram(GLuint program);
- void glGetVertexAttribPointerv(GLuint index, GLenum pname, GLvoid* *pointer);
- void glGetVertexAttribiv(GLuint index, GLenum pname, GLint *params);
- void glGetVertexAttribfv(GLuint index, GLenum pname, GLfloat *params);
- void glGetVertexAttribdv(GLuint index, GLenum pname, GLdouble *params);
- void glGetUniformiv(GLuint program, GLint location, GLint *params);
- void glGetUniformfv(GLuint program, GLint location, GLfloat *params);
- GLint glGetUniformLocation(GLuint program, const GLchar *name);
- void glGetShaderSource(GLuint shader, GLsizei bufSize, GLsizei *length, GLchar *source);
- void glGetShaderInfoLog(GLuint shader, GLsizei bufSize, GLsizei *length, GLchar *infoLog);
- void glGetShaderiv(GLuint shader, GLenum pname, GLint *params);
- void glGetProgramInfoLog(GLuint program, GLsizei bufSize, GLsizei *length, GLchar *infoLog);
- void glGetProgramiv(GLuint program, GLenum pname, GLint *params);
- GLint glGetAttribLocation(GLuint program, const GLchar *name);
- void glGetAttachedShaders(GLuint program, GLsizei maxCount, GLsizei *count, GLuint *obj);
- void glGetActiveUniform(GLuint program, GLuint index, GLsizei bufSize, GLsizei *length, GLint *size, GLenum *type, GLchar *name);
- void glGetActiveAttrib(GLuint program, GLuint index, GLsizei bufSize, GLsizei *length, GLint *size, GLenum *type, GLchar *name);
- void glEnableVertexAttribArray(GLuint index);
- void glDisableVertexAttribArray(GLuint index);
- void glDetachShader(GLuint program, GLuint shader);
- void glDeleteShader(GLuint shader);
- void glDeleteProgram(GLuint program);
- GLuint glCreateShader(GLenum type);
- GLuint glCreateProgram();
- void glCompileShader(GLuint shader);
- void glBindAttribLocation(GLuint program, GLuint index, const GLchar *name);
- void glAttachShader(GLuint program, GLuint shader);
- void glStencilMaskSeparate(GLenum face, GLuint mask);
- void glStencilFuncSeparate(GLenum face, GLenum func, GLint ref, GLuint mask);
- void glStencilOpSeparate(GLenum face, GLenum sfail, GLenum dpfail, GLenum dppass);
- void glDrawBuffers(GLsizei n, const GLenum *bufs);
- void glBlendEquationSeparate(GLenum modeRGB, GLenum modeAlpha);
-
- // OpenGL 2.1 core functions
- void glUniformMatrix4x3fv(GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
- void glUniformMatrix3x4fv(GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
- void glUniformMatrix4x2fv(GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
- void glUniformMatrix2x4fv(GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
- void glUniformMatrix3x2fv(GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
- void glUniformMatrix2x3fv(GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
-
- // OpenGL 3.0 core functions
- GLboolean glIsVertexArray(GLuint array);
- void glGenVertexArrays(GLsizei n, GLuint *arrays);
- void glDeleteVertexArrays(GLsizei n, const GLuint *arrays);
- void glBindVertexArray(GLuint array);
- void glFlushMappedBufferRange(GLenum target, GLintptr offset, GLsizeiptr length);
- GLvoid* glMapBufferRange(GLenum target, GLintptr offset, GLsizeiptr length, GLbitfield access);
- void glFramebufferTextureLayer(GLenum target, GLenum attachment, GLuint texture, GLint level, GLint layer);
- void glRenderbufferStorageMultisample(GLenum target, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height);
- void glBlitFramebuffer(GLint srcX0, GLint srcY0, GLint srcX1, GLint srcY1, GLint dstX0, GLint dstY0, GLint dstX1, GLint dstY1, GLbitfield mask, GLenum filter);
- void glGenerateMipmap(GLenum target);
- void glGetFramebufferAttachmentParameteriv(GLenum target, GLenum attachment, GLenum pname, GLint *params);
- void glFramebufferRenderbuffer(GLenum target, GLenum attachment, GLenum renderbuffertarget, GLuint renderbuffer);
- void glFramebufferTexture3D(GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level, GLint zoffset);
- void glFramebufferTexture2D(GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level);
- void glFramebufferTexture1D(GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level);
- GLenum glCheckFramebufferStatus(GLenum target);
- void glGenFramebuffers(GLsizei n, GLuint *framebuffers);
- void glDeleteFramebuffers(GLsizei n, const GLuint *framebuffers);
- void glBindFramebuffer(GLenum target, GLuint framebuffer);
- GLboolean glIsFramebuffer(GLuint framebuffer);
- void glGetRenderbufferParameteriv(GLenum target, GLenum pname, GLint *params);
- void glRenderbufferStorage(GLenum target, GLenum internalformat, GLsizei width, GLsizei height);
- void glGenRenderbuffers(GLsizei n, GLuint *renderbuffers);
- void glDeleteRenderbuffers(GLsizei n, const GLuint *renderbuffers);
- void glBindRenderbuffer(GLenum target, GLuint renderbuffer);
- GLboolean glIsRenderbuffer(GLuint renderbuffer);
- const GLubyte * glGetStringi(GLenum name, GLuint index);
- void glClearBufferfi(GLenum buffer, GLint drawbuffer, GLfloat depth, GLint stencil);
- void glClearBufferfv(GLenum buffer, GLint drawbuffer, const GLfloat *value);
- void glClearBufferuiv(GLenum buffer, GLint drawbuffer, const GLuint *value);
- void glClearBufferiv(GLenum buffer, GLint drawbuffer, const GLint *value);
- void glGetTexParameterIuiv(GLenum target, GLenum pname, GLuint *params);
- void glGetTexParameterIiv(GLenum target, GLenum pname, GLint *params);
- void glTexParameterIuiv(GLenum target, GLenum pname, const GLuint *params);
- void glTexParameterIiv(GLenum target, GLenum pname, const GLint *params);
- void glUniform4uiv(GLint location, GLsizei count, const GLuint *value);
- void glUniform3uiv(GLint location, GLsizei count, const GLuint *value);
- void glUniform2uiv(GLint location, GLsizei count, const GLuint *value);
- void glUniform1uiv(GLint location, GLsizei count, const GLuint *value);
- void glUniform4ui(GLint location, GLuint v0, GLuint v1, GLuint v2, GLuint v3);
- void glUniform3ui(GLint location, GLuint v0, GLuint v1, GLuint v2);
- void glUniform2ui(GLint location, GLuint v0, GLuint v1);
- void glUniform1ui(GLint location, GLuint v0);
- GLint glGetFragDataLocation(GLuint program, const GLchar *name);
- void glBindFragDataLocation(GLuint program, GLuint color, const GLchar *name);
- void glGetUniformuiv(GLuint program, GLint location, GLuint *params);
- void glGetVertexAttribIuiv(GLuint index, GLenum pname, GLuint *params);
- void glGetVertexAttribIiv(GLuint index, GLenum pname, GLint *params);
- void glVertexAttribIPointer(GLuint index, GLint size, GLenum type, GLsizei stride, const GLvoid *pointer);
- void glEndConditionalRender();
- void glBeginConditionalRender(GLuint id, GLenum mode);
- void glClampColor(GLenum target, GLenum clamp);
- void glGetTransformFeedbackVarying(GLuint program, GLuint index, GLsizei bufSize, GLsizei *length, GLsizei *size, GLenum *type, GLchar *name);
- void glTransformFeedbackVaryings(GLuint program, GLsizei count, const GLchar* const *varyings, GLenum bufferMode);
- void glBindBufferBase(GLenum target, GLuint index, GLuint buffer);
- void glBindBufferRange(GLenum target, GLuint index, GLuint buffer, GLintptr offset, GLsizeiptr size);
- void glEndTransformFeedback();
- void glBeginTransformFeedback(GLenum primitiveMode);
- GLboolean glIsEnabledi(GLenum target, GLuint index);
- void glDisablei(GLenum target, GLuint index);
- void glEnablei(GLenum target, GLuint index);
- void glGetIntegeri_v(GLenum target, GLuint index, GLint *data);
- void glGetBooleani_v(GLenum target, GLuint index, GLboolean *data);
- void glColorMaski(GLuint index, GLboolean r, GLboolean g, GLboolean b, GLboolean a);
-
- // OpenGL 3.1 core functions
- void glCopyBufferSubData(GLenum readTarget, GLenum writeTarget, GLintptr readOffset, GLintptr writeOffset, GLsizeiptr size);
- void glUniformBlockBinding(GLuint program, GLuint uniformBlockIndex, GLuint uniformBlockBinding);
- void glGetActiveUniformBlockName(GLuint program, GLuint uniformBlockIndex, GLsizei bufSize, GLsizei *length, GLchar *uniformBlockName);
- void glGetActiveUniformBlockiv(GLuint program, GLuint uniformBlockIndex, GLenum pname, GLint *params);
- GLuint glGetUniformBlockIndex(GLuint program, const GLchar *uniformBlockName);
- void glGetActiveUniformName(GLuint program, GLuint uniformIndex, GLsizei bufSize, GLsizei *length, GLchar *uniformName);
- void glGetActiveUniformsiv(GLuint program, GLsizei uniformCount, const GLuint *uniformIndices, GLenum pname, GLint *params);
- void glGetUniformIndices(GLuint program, GLsizei uniformCount, const GLchar* const *uniformNames, GLuint *uniformIndices);
- void glPrimitiveRestartIndex(GLuint index);
- void glTexBuffer(GLenum target, GLenum internalformat, GLuint buffer);
- void glDrawElementsInstanced(GLenum mode, GLsizei count, GLenum type, const GLvoid *indices, GLsizei instancecount);
- void glDrawArraysInstanced(GLenum mode, GLint first, GLsizei count, GLsizei instancecount);
-
- // OpenGL 3.2 core functions
- void glSampleMaski(GLuint index, GLbitfield mask);
- void glGetMultisamplefv(GLenum pname, GLuint index, GLfloat *val);
- void glTexImage3DMultisample(GLenum target, GLsizei samples, GLint internalformat, GLsizei width, GLsizei height, GLsizei depth, GLboolean fixedsamplelocations);
- void glTexImage2DMultisample(GLenum target, GLsizei samples, GLint internalformat, GLsizei width, GLsizei height, GLboolean fixedsamplelocations);
- void glGetSynciv(GLsync sync, GLenum pname, GLsizei bufSize, GLsizei *length, GLint *values);
- void glGetInteger64v(GLenum pname, GLint64 *params);
- void glWaitSync(GLsync sync, GLbitfield flags, GLuint64 timeout);
- GLenum glClientWaitSync(GLsync sync, GLbitfield flags, GLuint64 timeout);
- void glDeleteSync(GLsync sync);
- GLboolean glIsSync(GLsync sync);
- GLsync glFenceSync(GLenum condition, GLbitfield flags);
- void glProvokingVertex(GLenum mode);
- void glMultiDrawElementsBaseVertex(GLenum mode, const GLsizei *count, GLenum type, const GLvoid* const *indices, GLsizei drawcount, const GLint *basevertex);
- void glDrawElementsInstancedBaseVertex(GLenum mode, GLsizei count, GLenum type, const GLvoid *indices, GLsizei instancecount, GLint basevertex);
- void glDrawRangeElementsBaseVertex(GLenum mode, GLuint start, GLuint end, GLsizei count, GLenum type, const GLvoid *indices, GLint basevertex);
- void glDrawElementsBaseVertex(GLenum mode, GLsizei count, GLenum type, const GLvoid *indices, GLint basevertex);
- void glFramebufferTexture(GLenum target, GLenum attachment, GLuint texture, GLint level);
- void glGetBufferParameteri64v(GLenum target, GLenum pname, GLint64 *params);
- void glGetInteger64i_v(GLenum target, GLuint index, GLint64 *data);
-
- // OpenGL 3.3 core functions
- void glVertexAttribP4uiv(GLuint index, GLenum type, GLboolean normalized, const GLuint *value);
- void glVertexAttribP4ui(GLuint index, GLenum type, GLboolean normalized, GLuint value);
- void glVertexAttribP3uiv(GLuint index, GLenum type, GLboolean normalized, const GLuint *value);
- void glVertexAttribP3ui(GLuint index, GLenum type, GLboolean normalized, GLuint value);
- void glVertexAttribP2uiv(GLuint index, GLenum type, GLboolean normalized, const GLuint *value);
- void glVertexAttribP2ui(GLuint index, GLenum type, GLboolean normalized, GLuint value);
- void glVertexAttribP1uiv(GLuint index, GLenum type, GLboolean normalized, const GLuint *value);
- void glVertexAttribP1ui(GLuint index, GLenum type, GLboolean normalized, GLuint value);
- void glSecondaryColorP3uiv(GLenum type, const GLuint *color);
- void glSecondaryColorP3ui(GLenum type, GLuint color);
- void glColorP4uiv(GLenum type, const GLuint *color);
- void glColorP4ui(GLenum type, GLuint color);
- void glColorP3uiv(GLenum type, const GLuint *color);
- void glColorP3ui(GLenum type, GLuint color);
- void glNormalP3uiv(GLenum type, const GLuint *coords);
- void glNormalP3ui(GLenum type, GLuint coords);
- void glMultiTexCoordP4uiv(GLenum texture, GLenum type, const GLuint *coords);
- void glMultiTexCoordP4ui(GLenum texture, GLenum type, GLuint coords);
- void glMultiTexCoordP3uiv(GLenum texture, GLenum type, const GLuint *coords);
- void glMultiTexCoordP3ui(GLenum texture, GLenum type, GLuint coords);
- void glMultiTexCoordP2uiv(GLenum texture, GLenum type, const GLuint *coords);
- void glMultiTexCoordP2ui(GLenum texture, GLenum type, GLuint coords);
- void glMultiTexCoordP1uiv(GLenum texture, GLenum type, const GLuint *coords);
- void glMultiTexCoordP1ui(GLenum texture, GLenum type, GLuint coords);
- void glTexCoordP4uiv(GLenum type, const GLuint *coords);
- void glTexCoordP4ui(GLenum type, GLuint coords);
- void glTexCoordP3uiv(GLenum type, const GLuint *coords);
- void glTexCoordP3ui(GLenum type, GLuint coords);
- void glTexCoordP2uiv(GLenum type, const GLuint *coords);
- void glTexCoordP2ui(GLenum type, GLuint coords);
- void glTexCoordP1uiv(GLenum type, const GLuint *coords);
- void glTexCoordP1ui(GLenum type, GLuint coords);
- void glVertexP4uiv(GLenum type, const GLuint *value);
- void glVertexP4ui(GLenum type, GLuint value);
- void glVertexP3uiv(GLenum type, const GLuint *value);
- void glVertexP3ui(GLenum type, GLuint value);
- void glVertexP2uiv(GLenum type, const GLuint *value);
- void glVertexP2ui(GLenum type, GLuint value);
- void glGetQueryObjectui64v(GLuint id, GLenum pname, GLuint64 *params);
- void glGetQueryObjecti64v(GLuint id, GLenum pname, GLint64 *params);
- void glQueryCounter(GLuint id, GLenum target);
- void glGetSamplerParameterIuiv(GLuint sampler, GLenum pname, GLuint *params);
- void glGetSamplerParameterfv(GLuint sampler, GLenum pname, GLfloat *params);
- void glGetSamplerParameterIiv(GLuint sampler, GLenum pname, GLint *params);
- void glGetSamplerParameteriv(GLuint sampler, GLenum pname, GLint *params);
- void glSamplerParameterIuiv(GLuint sampler, GLenum pname, const GLuint *param);
- void glSamplerParameterIiv(GLuint sampler, GLenum pname, const GLint *param);
- void glSamplerParameterfv(GLuint sampler, GLenum pname, const GLfloat *param);
- void glSamplerParameterf(GLuint sampler, GLenum pname, GLfloat param);
- void glSamplerParameteriv(GLuint sampler, GLenum pname, const GLint *param);
- void glSamplerParameteri(GLuint sampler, GLenum pname, GLint param);
- void glBindSampler(GLuint unit, GLuint sampler);
- GLboolean glIsSampler(GLuint sampler);
- void glDeleteSamplers(GLsizei count, const GLuint *samplers);
- void glGenSamplers(GLsizei count, GLuint *samplers);
- GLint glGetFragDataIndex(GLuint program, const GLchar *name);
- void glBindFragDataLocationIndexed(GLuint program, GLuint colorNumber, GLuint index, const GLchar *name);
- void glVertexAttribDivisor(GLuint index, GLuint divisor);
-
- // OpenGL 4.0 core functions
- void glGetQueryIndexediv(GLenum target, GLuint index, GLenum pname, GLint *params);
- void glEndQueryIndexed(GLenum target, GLuint index);
- void glBeginQueryIndexed(GLenum target, GLuint index, GLuint id);
- void glDrawTransformFeedbackStream(GLenum mode, GLuint id, GLuint stream);
- void glDrawTransformFeedback(GLenum mode, GLuint id);
- void glResumeTransformFeedback();
- void glPauseTransformFeedback();
- GLboolean glIsTransformFeedback(GLuint id);
- void glGenTransformFeedbacks(GLsizei n, GLuint *ids);
- void glDeleteTransformFeedbacks(GLsizei n, const GLuint *ids);
- void glBindTransformFeedback(GLenum target, GLuint id);
- void glPatchParameterfv(GLenum pname, const GLfloat *values);
- void glPatchParameteri(GLenum pname, GLint value);
- void glGetProgramStageiv(GLuint program, GLenum shadertype, GLenum pname, GLint *values);
- void glGetUniformSubroutineuiv(GLenum shadertype, GLint location, GLuint *params);
- void glUniformSubroutinesuiv(GLenum shadertype, GLsizei count, const GLuint *indices);
- void glGetActiveSubroutineName(GLuint program, GLenum shadertype, GLuint index, GLsizei bufsize, GLsizei *length, GLchar *name);
- void glGetActiveSubroutineUniformName(GLuint program, GLenum shadertype, GLuint index, GLsizei bufsize, GLsizei *length, GLchar *name);
- void glGetActiveSubroutineUniformiv(GLuint program, GLenum shadertype, GLuint index, GLenum pname, GLint *values);
- GLuint glGetSubroutineIndex(GLuint program, GLenum shadertype, const GLchar *name);
- GLint glGetSubroutineUniformLocation(GLuint program, GLenum shadertype, const GLchar *name);
- void glGetUniformdv(GLuint program, GLint location, GLdouble *params);
- void glUniformMatrix4x3dv(GLint location, GLsizei count, GLboolean transpose, const GLdouble *value);
- void glUniformMatrix4x2dv(GLint location, GLsizei count, GLboolean transpose, const GLdouble *value);
- void glUniformMatrix3x4dv(GLint location, GLsizei count, GLboolean transpose, const GLdouble *value);
- void glUniformMatrix3x2dv(GLint location, GLsizei count, GLboolean transpose, const GLdouble *value);
- void glUniformMatrix2x4dv(GLint location, GLsizei count, GLboolean transpose, const GLdouble *value);
- void glUniformMatrix2x3dv(GLint location, GLsizei count, GLboolean transpose, const GLdouble *value);
- void glUniformMatrix4dv(GLint location, GLsizei count, GLboolean transpose, const GLdouble *value);
- void glUniformMatrix3dv(GLint location, GLsizei count, GLboolean transpose, const GLdouble *value);
- void glUniformMatrix2dv(GLint location, GLsizei count, GLboolean transpose, const GLdouble *value);
- void glUniform4dv(GLint location, GLsizei count, const GLdouble *value);
- void glUniform3dv(GLint location, GLsizei count, const GLdouble *value);
- void glUniform2dv(GLint location, GLsizei count, const GLdouble *value);
- void glUniform1dv(GLint location, GLsizei count, const GLdouble *value);
- void glUniform4d(GLint location, GLdouble x, GLdouble y, GLdouble z, GLdouble w);
- void glUniform3d(GLint location, GLdouble x, GLdouble y, GLdouble z);
- void glUniform2d(GLint location, GLdouble x, GLdouble y);
- void glUniform1d(GLint location, GLdouble x);
- void glDrawElementsIndirect(GLenum mode, GLenum type, const GLvoid *indirect);
- void glDrawArraysIndirect(GLenum mode, const GLvoid *indirect);
- void glBlendFuncSeparatei(GLuint buf, GLenum srcRGB, GLenum dstRGB, GLenum srcAlpha, GLenum dstAlpha);
- void glBlendFunci(GLuint buf, GLenum src, GLenum dst);
- void glBlendEquationSeparatei(GLuint buf, GLenum modeRGB, GLenum modeAlpha);
- void glBlendEquationi(GLuint buf, GLenum mode);
- void glMinSampleShading(GLfloat value);
-
- // OpenGL 4.1 core functions
- void glGetDoublei_v(GLenum target, GLuint index, GLdouble *data);
- void glGetFloati_v(GLenum target, GLuint index, GLfloat *data);
- void glDepthRangeIndexed(GLuint index, GLdouble n, GLdouble f);
- void glDepthRangeArrayv(GLuint first, GLsizei count, const GLdouble *v);
- void glScissorIndexedv(GLuint index, const GLint *v);
- void glScissorIndexed(GLuint index, GLint left, GLint bottom, GLsizei width, GLsizei height);
- void glScissorArrayv(GLuint first, GLsizei count, const GLint *v);
- void glViewportIndexedfv(GLuint index, const GLfloat *v);
- void glViewportIndexedf(GLuint index, GLfloat x, GLfloat y, GLfloat w, GLfloat h);
- void glViewportArrayv(GLuint first, GLsizei count, const GLfloat *v);
- void glGetVertexAttribLdv(GLuint index, GLenum pname, GLdouble *params);
- void glVertexAttribLPointer(GLuint index, GLint size, GLenum type, GLsizei stride, const GLvoid *pointer);
- void glVertexAttribL4dv(GLuint index, const GLdouble *v);
- void glVertexAttribL3dv(GLuint index, const GLdouble *v);
- void glVertexAttribL2dv(GLuint index, const GLdouble *v);
- void glVertexAttribL1dv(GLuint index, const GLdouble *v);
- void glVertexAttribL4d(GLuint index, GLdouble x, GLdouble y, GLdouble z, GLdouble w);
- void glVertexAttribL3d(GLuint index, GLdouble x, GLdouble y, GLdouble z);
- void glVertexAttribL2d(GLuint index, GLdouble x, GLdouble y);
- void glVertexAttribL1d(GLuint index, GLdouble x);
- void glGetProgramPipelineInfoLog(GLuint pipeline, GLsizei bufSize, GLsizei *length, GLchar *infoLog);
- void glValidateProgramPipeline(GLuint pipeline);
- void glProgramUniformMatrix4x3dv(GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLdouble *value);
- void glProgramUniformMatrix3x4dv(GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLdouble *value);
- void glProgramUniformMatrix4x2dv(GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLdouble *value);
- void glProgramUniformMatrix2x4dv(GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLdouble *value);
- void glProgramUniformMatrix3x2dv(GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLdouble *value);
- void glProgramUniformMatrix2x3dv(GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLdouble *value);
- void glProgramUniformMatrix4x3fv(GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
- void glProgramUniformMatrix3x4fv(GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
- void glProgramUniformMatrix4x2fv(GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
- void glProgramUniformMatrix2x4fv(GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
- void glProgramUniformMatrix3x2fv(GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
- void glProgramUniformMatrix2x3fv(GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
- void glProgramUniformMatrix4dv(GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLdouble *value);
- void glProgramUniformMatrix3dv(GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLdouble *value);
- void glProgramUniformMatrix2dv(GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLdouble *value);
- void glProgramUniformMatrix4fv(GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
- void glProgramUniformMatrix3fv(GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
- void glProgramUniformMatrix2fv(GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
- void glProgramUniform4uiv(GLuint program, GLint location, GLsizei count, const GLuint *value);
- void glProgramUniform4ui(GLuint program, GLint location, GLuint v0, GLuint v1, GLuint v2, GLuint v3);
- void glProgramUniform4dv(GLuint program, GLint location, GLsizei count, const GLdouble *value);
- void glProgramUniform4d(GLuint program, GLint location, GLdouble v0, GLdouble v1, GLdouble v2, GLdouble v3);
- void glProgramUniform4fv(GLuint program, GLint location, GLsizei count, const GLfloat *value);
- void glProgramUniform4f(GLuint program, GLint location, GLfloat v0, GLfloat v1, GLfloat v2, GLfloat v3);
- void glProgramUniform4iv(GLuint program, GLint location, GLsizei count, const GLint *value);
- void glProgramUniform4i(GLuint program, GLint location, GLint v0, GLint v1, GLint v2, GLint v3);
- void glProgramUniform3uiv(GLuint program, GLint location, GLsizei count, const GLuint *value);
- void glProgramUniform3ui(GLuint program, GLint location, GLuint v0, GLuint v1, GLuint v2);
- void glProgramUniform3dv(GLuint program, GLint location, GLsizei count, const GLdouble *value);
- void glProgramUniform3d(GLuint program, GLint location, GLdouble v0, GLdouble v1, GLdouble v2);
- void glProgramUniform3fv(GLuint program, GLint location, GLsizei count, const GLfloat *value);
- void glProgramUniform3f(GLuint program, GLint location, GLfloat v0, GLfloat v1, GLfloat v2);
- void glProgramUniform3iv(GLuint program, GLint location, GLsizei count, const GLint *value);
- void glProgramUniform3i(GLuint program, GLint location, GLint v0, GLint v1, GLint v2);
- void glProgramUniform2uiv(GLuint program, GLint location, GLsizei count, const GLuint *value);
- void glProgramUniform2ui(GLuint program, GLint location, GLuint v0, GLuint v1);
- void glProgramUniform2dv(GLuint program, GLint location, GLsizei count, const GLdouble *value);
- void glProgramUniform2d(GLuint program, GLint location, GLdouble v0, GLdouble v1);
- void glProgramUniform2fv(GLuint program, GLint location, GLsizei count, const GLfloat *value);
- void glProgramUniform2f(GLuint program, GLint location, GLfloat v0, GLfloat v1);
- void glProgramUniform2iv(GLuint program, GLint location, GLsizei count, const GLint *value);
- void glProgramUniform2i(GLuint program, GLint location, GLint v0, GLint v1);
- void glProgramUniform1uiv(GLuint program, GLint location, GLsizei count, const GLuint *value);
- void glProgramUniform1ui(GLuint program, GLint location, GLuint v0);
- void glProgramUniform1dv(GLuint program, GLint location, GLsizei count, const GLdouble *value);
- void glProgramUniform1d(GLuint program, GLint location, GLdouble v0);
- void glProgramUniform1fv(GLuint program, GLint location, GLsizei count, const GLfloat *value);
- void glProgramUniform1f(GLuint program, GLint location, GLfloat v0);
- void glProgramUniform1iv(GLuint program, GLint location, GLsizei count, const GLint *value);
- void glProgramUniform1i(GLuint program, GLint location, GLint v0);
- void glGetProgramPipelineiv(GLuint pipeline, GLenum pname, GLint *params);
- GLboolean glIsProgramPipeline(GLuint pipeline);
- void glGenProgramPipelines(GLsizei n, GLuint *pipelines);
- void glDeleteProgramPipelines(GLsizei n, const GLuint *pipelines);
- void glBindProgramPipeline(GLuint pipeline);
- GLuint glCreateShaderProgramv(GLenum type, GLsizei count, const GLchar* const *strings);
- void glActiveShaderProgram(GLuint pipeline, GLuint program);
- void glUseProgramStages(GLuint pipeline, GLbitfield stages, GLuint program);
- void glProgramParameteri(GLuint program, GLenum pname, GLint value);
- void glProgramBinary(GLuint program, GLenum binaryFormat, const GLvoid *binary, GLsizei length);
- void glGetProgramBinary(GLuint program, GLsizei bufSize, GLsizei *length, GLenum *binaryFormat, GLvoid *binary);
- void glClearDepthf(GLfloat dd);
- void glDepthRangef(GLfloat n, GLfloat f);
- void glGetShaderPrecisionFormat(GLenum shadertype, GLenum precisiontype, GLint *range, GLint *precision);
- void glShaderBinary(GLsizei count, const GLuint *shaders, GLenum binaryformat, const GLvoid *binary, GLsizei length);
- void glReleaseShaderCompiler();
-
- // OpenGL 4.2 core functions
- void glTexStorage3D(GLenum target, GLsizei levels, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth);
- void glTexStorage2D(GLenum target, GLsizei levels, GLenum internalformat, GLsizei width, GLsizei height);
- void glTexStorage1D(GLenum target, GLsizei levels, GLenum internalformat, GLsizei width);
- void glMemoryBarrier(GLbitfield barriers);
- void glBindImageTexture(GLuint unit, GLuint texture, GLint level, GLboolean layered, GLint layer, GLenum access, GLenum format);
- void glGetActiveAtomicCounterBufferiv(GLuint program, GLuint bufferIndex, GLenum pname, GLint *params);
- void glGetInternalformativ(GLenum target, GLenum internalformat, GLenum pname, GLsizei bufSize, GLint *params);
- void glDrawTransformFeedbackStreamInstanced(GLenum mode, GLuint id, GLuint stream, GLsizei instancecount);
- void glDrawTransformFeedbackInstanced(GLenum mode, GLuint id, GLsizei instancecount);
- void glDrawElementsInstancedBaseVertexBaseInstance(GLenum mode, GLsizei count, GLenum type, const void *indices, GLsizei instancecount, GLint basevertex, GLuint baseinstance);
- void glDrawElementsInstancedBaseInstance(GLenum mode, GLsizei count, GLenum type, const void *indices, GLsizei instancecount, GLuint baseinstance);
- void glDrawArraysInstancedBaseInstance(GLenum mode, GLint first, GLsizei count, GLsizei instancecount, GLuint baseinstance);
-
-private:
- friend class QOpenGLContext;
-
- static bool isContextCompatible(QOpenGLContext *context);
- static QOpenGLVersionProfile versionProfile();
-
- QOpenGLFunctions_1_0_CoreBackend* d_1_0_Core;
- QOpenGLFunctions_1_1_CoreBackend* d_1_1_Core;
- QOpenGLFunctions_1_2_CoreBackend* d_1_2_Core;
- QOpenGLFunctions_1_3_CoreBackend* d_1_3_Core;
- QOpenGLFunctions_1_4_CoreBackend* d_1_4_Core;
- QOpenGLFunctions_1_5_CoreBackend* d_1_5_Core;
- QOpenGLFunctions_2_0_CoreBackend* d_2_0_Core;
- QOpenGLFunctions_2_1_CoreBackend* d_2_1_Core;
- QOpenGLFunctions_3_0_CoreBackend* d_3_0_Core;
- QOpenGLFunctions_3_1_CoreBackend* d_3_1_Core;
- QOpenGLFunctions_3_2_CoreBackend* d_3_2_Core;
- QOpenGLFunctions_3_3_CoreBackend* d_3_3_Core;
- QOpenGLFunctions_4_0_CoreBackend* d_4_0_Core;
- QOpenGLFunctions_4_1_CoreBackend* d_4_1_Core;
- QOpenGLFunctions_4_2_CoreBackend* d_4_2_Core;
-};
-
-// OpenGL 1.0 core functions
-inline void QOpenGLFunctions_4_2_Core::glViewport(GLint x, GLint y, GLsizei width, GLsizei height)
-{
- d_1_0_Core->f.Viewport(x, y, width, height);
-}
-
-inline void QOpenGLFunctions_4_2_Core::glDepthRange(GLdouble nearVal, GLdouble farVal)
-{
- d_1_0_Core->f.DepthRange(nearVal, farVal);
-}
-
-inline GLboolean QOpenGLFunctions_4_2_Core::glIsEnabled(GLenum cap)
-{
- return d_1_0_Core->f.IsEnabled(cap);
-}
-
-inline void QOpenGLFunctions_4_2_Core::glGetTexLevelParameteriv(GLenum target, GLint level, GLenum pname, GLint *params)
-{
- d_1_0_Core->f.GetTexLevelParameteriv(target, level, pname, params);
-}
-
-inline void QOpenGLFunctions_4_2_Core::glGetTexLevelParameterfv(GLenum target, GLint level, GLenum pname, GLfloat *params)
-{
- d_1_0_Core->f.GetTexLevelParameterfv(target, level, pname, params);
-}
-
-inline void QOpenGLFunctions_4_2_Core::glGetTexParameteriv(GLenum target, GLenum pname, GLint *params)
-{
- d_1_0_Core->f.GetTexParameteriv(target, pname, params);
-}
-
-inline void QOpenGLFunctions_4_2_Core::glGetTexParameterfv(GLenum target, GLenum pname, GLfloat *params)
-{
- d_1_0_Core->f.GetTexParameterfv(target, pname, params);
-}
-
-inline void QOpenGLFunctions_4_2_Core::glGetTexImage(GLenum target, GLint level, GLenum format, GLenum type, GLvoid *pixels)
-{
- d_1_0_Core->f.GetTexImage(target, level, format, type, pixels);
-}
-
-inline const GLubyte * QOpenGLFunctions_4_2_Core::glGetString(GLenum name)
-{
- return d_1_0_Core->f.GetString(name);
-}
-
-inline void QOpenGLFunctions_4_2_Core::glGetIntegerv(GLenum pname, GLint *params)
-{
- d_1_0_Core->f.GetIntegerv(pname, params);
-}
-
-inline void QOpenGLFunctions_4_2_Core::glGetFloatv(GLenum pname, GLfloat *params)
-{
- d_1_0_Core->f.GetFloatv(pname, params);
-}
-
-inline GLenum QOpenGLFunctions_4_2_Core::glGetError()
-{
- return d_1_0_Core->f.GetError();
-}
-
-inline void QOpenGLFunctions_4_2_Core::glGetDoublev(GLenum pname, GLdouble *params)
-{
- d_1_0_Core->f.GetDoublev(pname, params);
-}
-
-inline void QOpenGLFunctions_4_2_Core::glGetBooleanv(GLenum pname, GLboolean *params)
-{
- d_1_0_Core->f.GetBooleanv(pname, params);
-}
-
-inline void QOpenGLFunctions_4_2_Core::glReadPixels(GLint x, GLint y, GLsizei width, GLsizei height, GLenum format, GLenum type, GLvoid *pixels)
-{
- d_1_0_Core->f.ReadPixels(x, y, width, height, format, type, pixels);
-}
-
-inline void QOpenGLFunctions_4_2_Core::glReadBuffer(GLenum mode)
-{
- d_1_0_Core->f.ReadBuffer(mode);
-}
-
-inline void QOpenGLFunctions_4_2_Core::glPixelStorei(GLenum pname, GLint param)
-{
- d_1_0_Core->f.PixelStorei(pname, param);
-}
-
-inline void QOpenGLFunctions_4_2_Core::glPixelStoref(GLenum pname, GLfloat param)
-{
- d_1_0_Core->f.PixelStoref(pname, param);
-}
-
-inline void QOpenGLFunctions_4_2_Core::glDepthFunc(GLenum func)
-{
- d_1_0_Core->f.DepthFunc(func);
-}
-
-inline void QOpenGLFunctions_4_2_Core::glStencilOp(GLenum fail, GLenum zfail, GLenum zpass)
-{
- d_1_0_Core->f.StencilOp(fail, zfail, zpass);
-}
-
-inline void QOpenGLFunctions_4_2_Core::glStencilFunc(GLenum func, GLint ref, GLuint mask)
-{
- d_1_0_Core->f.StencilFunc(func, ref, mask);
-}
-
-inline void QOpenGLFunctions_4_2_Core::glLogicOp(GLenum opcode)
-{
- d_1_0_Core->f.LogicOp(opcode);
-}
-
-inline void QOpenGLFunctions_4_2_Core::glBlendFunc(GLenum sfactor, GLenum dfactor)
-{
- d_1_0_Core->f.BlendFunc(sfactor, dfactor);
-}
-
-inline void QOpenGLFunctions_4_2_Core::glFlush()
-{
- d_1_0_Core->f.Flush();
-}
-
-inline void QOpenGLFunctions_4_2_Core::glFinish()
-{
- d_1_0_Core->f.Finish();
-}
-
-inline void QOpenGLFunctions_4_2_Core::glEnable(GLenum cap)
-{
- d_1_0_Core->f.Enable(cap);
-}
-
-inline void QOpenGLFunctions_4_2_Core::glDisable(GLenum cap)
-{
- d_1_0_Core->f.Disable(cap);
-}
-
-inline void QOpenGLFunctions_4_2_Core::glDepthMask(GLboolean flag)
-{
- d_1_0_Core->f.DepthMask(flag);
-}
-
-inline void QOpenGLFunctions_4_2_Core::glColorMask(GLboolean red, GLboolean green, GLboolean blue, GLboolean alpha)
-{
- d_1_0_Core->f.ColorMask(red, green, blue, alpha);
-}
-
-inline void QOpenGLFunctions_4_2_Core::glStencilMask(GLuint mask)
-{
- d_1_0_Core->f.StencilMask(mask);
-}
-
-inline void QOpenGLFunctions_4_2_Core::glClearDepth(GLdouble depth)
-{
- d_1_0_Core->f.ClearDepth(depth);
-}
-
-inline void QOpenGLFunctions_4_2_Core::glClearStencil(GLint s)
-{
- d_1_0_Core->f.ClearStencil(s);
-}
-
-inline void QOpenGLFunctions_4_2_Core::glClearColor(GLfloat red, GLfloat green, GLfloat blue, GLfloat alpha)
-{
- d_1_0_Core->f.ClearColor(red, green, blue, alpha);
-}
-
-inline void QOpenGLFunctions_4_2_Core::glClear(GLbitfield mask)
-{
- d_1_0_Core->f.Clear(mask);
-}
-
-inline void QOpenGLFunctions_4_2_Core::glDrawBuffer(GLenum mode)
-{
- d_1_0_Core->f.DrawBuffer(mode);
-}
-
-inline void QOpenGLFunctions_4_2_Core::glTexImage2D(GLenum target, GLint level, GLint internalformat, GLsizei width, GLsizei height, GLint border, GLenum format, GLenum type, const GLvoid *pixels)
-{
- d_1_0_Core->f.TexImage2D(target, level, internalformat, width, height, border, format, type, pixels);
-}
-
-inline void QOpenGLFunctions_4_2_Core::glTexImage1D(GLenum target, GLint level, GLint internalformat, GLsizei width, GLint border, GLenum format, GLenum type, const GLvoid *pixels)
-{
- d_1_0_Core->f.TexImage1D(target, level, internalformat, width, border, format, type, pixels);
-}
-
-inline void QOpenGLFunctions_4_2_Core::glTexParameteriv(GLenum target, GLenum pname, const GLint *params)
-{
- d_1_0_Core->f.TexParameteriv(target, pname, params);
-}
-
-inline void QOpenGLFunctions_4_2_Core::glTexParameteri(GLenum target, GLenum pname, GLint param)
-{
- d_1_0_Core->f.TexParameteri(target, pname, param);
-}
-
-inline void QOpenGLFunctions_4_2_Core::glTexParameterfv(GLenum target, GLenum pname, const GLfloat *params)
-{
- d_1_0_Core->f.TexParameterfv(target, pname, params);
-}
-
-inline void QOpenGLFunctions_4_2_Core::glTexParameterf(GLenum target, GLenum pname, GLfloat param)
-{
- d_1_0_Core->f.TexParameterf(target, pname, param);
-}
-
-inline void QOpenGLFunctions_4_2_Core::glScissor(GLint x, GLint y, GLsizei width, GLsizei height)
-{
- d_1_0_Core->f.Scissor(x, y, width, height);
-}
-
-inline void QOpenGLFunctions_4_2_Core::glPolygonMode(GLenum face, GLenum mode)
-{
- d_1_0_Core->f.PolygonMode(face, mode);
-}
-
-inline void QOpenGLFunctions_4_2_Core::glPointSize(GLfloat size)
-{
- d_1_0_Core->f.PointSize(size);
-}
-
-inline void QOpenGLFunctions_4_2_Core::glLineWidth(GLfloat width)
-{
- d_1_0_Core->f.LineWidth(width);
-}
-
-inline void QOpenGLFunctions_4_2_Core::glHint(GLenum target, GLenum mode)
-{
- d_1_0_Core->f.Hint(target, mode);
-}
-
-inline void QOpenGLFunctions_4_2_Core::glFrontFace(GLenum mode)
-{
- d_1_0_Core->f.FrontFace(mode);
-}
-
-inline void QOpenGLFunctions_4_2_Core::glCullFace(GLenum mode)
-{
- d_1_0_Core->f.CullFace(mode);
-}
-
-
-// OpenGL 1.1 core functions
-inline void QOpenGLFunctions_4_2_Core::glIndexubv(const GLubyte *c)
-{
- Q_UNUSED(c);
- QOPENGL_DEPRECATEDFUNCTION;
-}
-
-inline void QOpenGLFunctions_4_2_Core::glIndexub(GLubyte c)
-{
- Q_UNUSED(c);
- QOPENGL_DEPRECATEDFUNCTION;
-}
-
-inline GLboolean QOpenGLFunctions_4_2_Core::glIsTexture(GLuint texture)
-{
- return d_1_1_Core->f.IsTexture(texture);
-}
-
-inline void QOpenGLFunctions_4_2_Core::glGenTextures(GLsizei n, GLuint *textures)
-{
- d_1_1_Core->f.GenTextures(n, textures);
-}
-
-inline void QOpenGLFunctions_4_2_Core::glDeleteTextures(GLsizei n, const GLuint *textures)
-{
- d_1_1_Core->f.DeleteTextures(n, textures);
-}
-
-inline void QOpenGLFunctions_4_2_Core::glBindTexture(GLenum target, GLuint texture)
-{
- d_1_1_Core->f.BindTexture(target, texture);
-}
-
-inline void QOpenGLFunctions_4_2_Core::glTexSubImage2D(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLenum type, const GLvoid *pixels)
-{
- d_1_1_Core->f.TexSubImage2D(target, level, xoffset, yoffset, width, height, format, type, pixels);
-}
-
-inline void QOpenGLFunctions_4_2_Core::glTexSubImage1D(GLenum target, GLint level, GLint xoffset, GLsizei width, GLenum format, GLenum type, const GLvoid *pixels)
-{
- d_1_1_Core->f.TexSubImage1D(target, level, xoffset, width, format, type, pixels);
-}
-
-inline void QOpenGLFunctions_4_2_Core::glCopyTexSubImage2D(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint x, GLint y, GLsizei width, GLsizei height)
-{
- d_1_1_Core->f.CopyTexSubImage2D(target, level, xoffset, yoffset, x, y, width, height);
-}
-
-inline void QOpenGLFunctions_4_2_Core::glCopyTexSubImage1D(GLenum target, GLint level, GLint xoffset, GLint x, GLint y, GLsizei width)
-{
- d_1_1_Core->f.CopyTexSubImage1D(target, level, xoffset, x, y, width);
-}
-
-inline void QOpenGLFunctions_4_2_Core::glCopyTexImage2D(GLenum target, GLint level, GLenum internalformat, GLint x, GLint y, GLsizei width, GLsizei height, GLint border)
-{
- d_1_1_Core->f.CopyTexImage2D(target, level, internalformat, x, y, width, height, border);
-}
-
-inline void QOpenGLFunctions_4_2_Core::glCopyTexImage1D(GLenum target, GLint level, GLenum internalformat, GLint x, GLint y, GLsizei width, GLint border)
-{
- d_1_1_Core->f.CopyTexImage1D(target, level, internalformat, x, y, width, border);
-}
-
-inline void QOpenGLFunctions_4_2_Core::glPolygonOffset(GLfloat factor, GLfloat units)
-{
- d_1_1_Core->f.PolygonOffset(factor, units);
-}
-
-inline void QOpenGLFunctions_4_2_Core::glGetPointerv(GLenum pname, GLvoid* *params)
-{
- Q_UNUSED(pname);
- Q_UNUSED(params);
- QOPENGL_DEPRECATEDFUNCTION;
-}
-
-inline void QOpenGLFunctions_4_2_Core::glDrawElements(GLenum mode, GLsizei count, GLenum type, const GLvoid *indices)
-{
- d_1_1_Core->f.DrawElements(mode, count, type, indices);
-}
-
-inline void QOpenGLFunctions_4_2_Core::glDrawArrays(GLenum mode, GLint first, GLsizei count)
-{
- d_1_1_Core->f.DrawArrays(mode, first, count);
-}
-
-
-// OpenGL 1.2 core functions
-inline void QOpenGLFunctions_4_2_Core::glCopyTexSubImage3D(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLint x, GLint y, GLsizei width, GLsizei height)
-{
- d_1_2_Core->f.CopyTexSubImage3D(target, level, xoffset, yoffset, zoffset, x, y, width, height);
-}
-
-inline void QOpenGLFunctions_4_2_Core::glTexSubImage3D(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLenum type, const GLvoid *pixels)
-{
- d_1_2_Core->f.TexSubImage3D(target, level, xoffset, yoffset, zoffset, width, height, depth, format, type, pixels);
-}
-
-inline void QOpenGLFunctions_4_2_Core::glTexImage3D(GLenum target, GLint level, GLint internalformat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLenum format, GLenum type, const GLvoid *pixels)
-{
- d_1_2_Core->f.TexImage3D(target, level, internalformat, width, height, depth, border, format, type, pixels);
-}
-
-inline void QOpenGLFunctions_4_2_Core::glDrawRangeElements(GLenum mode, GLuint start, GLuint end, GLsizei count, GLenum type, const GLvoid *indices)
-{
- d_1_2_Core->f.DrawRangeElements(mode, start, end, count, type, indices);
-}
-
-inline void QOpenGLFunctions_4_2_Core::glBlendEquation(GLenum mode)
-{
- d_1_2_Core->f.BlendEquation(mode);
-}
-
-inline void QOpenGLFunctions_4_2_Core::glBlendColor(GLfloat red, GLfloat green, GLfloat blue, GLfloat alpha)
-{
- d_1_2_Core->f.BlendColor(red, green, blue, alpha);
-}
-
-
-// OpenGL 1.3 core functions
-inline void QOpenGLFunctions_4_2_Core::glGetCompressedTexImage(GLenum target, GLint level, GLvoid *img)
-{
- d_1_3_Core->f.GetCompressedTexImage(target, level, img);
-}
-
-inline void QOpenGLFunctions_4_2_Core::glCompressedTexSubImage1D(GLenum target, GLint level, GLint xoffset, GLsizei width, GLenum format, GLsizei imageSize, const GLvoid *data)
-{
- d_1_3_Core->f.CompressedTexSubImage1D(target, level, xoffset, width, format, imageSize, data);
-}
-
-inline void QOpenGLFunctions_4_2_Core::glCompressedTexSubImage2D(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLsizei imageSize, const GLvoid *data)
-{
- d_1_3_Core->f.CompressedTexSubImage2D(target, level, xoffset, yoffset, width, height, format, imageSize, data);
-}
-
-inline void QOpenGLFunctions_4_2_Core::glCompressedTexSubImage3D(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLsizei imageSize, const GLvoid *data)
-{
- d_1_3_Core->f.CompressedTexSubImage3D(target, level, xoffset, yoffset, zoffset, width, height, depth, format, imageSize, data);
-}
-
-inline void QOpenGLFunctions_4_2_Core::glCompressedTexImage1D(GLenum target, GLint level, GLenum internalformat, GLsizei width, GLint border, GLsizei imageSize, const GLvoid *data)
-{
- d_1_3_Core->f.CompressedTexImage1D(target, level, internalformat, width, border, imageSize, data);
-}
-
-inline void QOpenGLFunctions_4_2_Core::glCompressedTexImage2D(GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLint border, GLsizei imageSize, const GLvoid *data)
-{
- d_1_3_Core->f.CompressedTexImage2D(target, level, internalformat, width, height, border, imageSize, data);
-}
-
-inline void QOpenGLFunctions_4_2_Core::glCompressedTexImage3D(GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLsizei imageSize, const GLvoid *data)
-{
- d_1_3_Core->f.CompressedTexImage3D(target, level, internalformat, width, height, depth, border, imageSize, data);
-}
-
-inline void QOpenGLFunctions_4_2_Core::glSampleCoverage(GLfloat value, GLboolean invert)
-{
- d_1_3_Core->f.SampleCoverage(value, invert);
-}
-
-inline void QOpenGLFunctions_4_2_Core::glActiveTexture(GLenum texture)
-{
- d_1_3_Core->f.ActiveTexture(texture);
-}
-
-
-// OpenGL 1.4 core functions
-inline void QOpenGLFunctions_4_2_Core::glPointParameteriv(GLenum pname, const GLint *params)
-{
- d_1_4_Core->f.PointParameteriv(pname, params);
-}
-
-inline void QOpenGLFunctions_4_2_Core::glPointParameteri(GLenum pname, GLint param)
-{
- d_1_4_Core->f.PointParameteri(pname, param);
-}
-
-inline void QOpenGLFunctions_4_2_Core::glPointParameterfv(GLenum pname, const GLfloat *params)
-{
- d_1_4_Core->f.PointParameterfv(pname, params);
-}
-
-inline void QOpenGLFunctions_4_2_Core::glPointParameterf(GLenum pname, GLfloat param)
-{
- d_1_4_Core->f.PointParameterf(pname, param);
-}
-
-inline void QOpenGLFunctions_4_2_Core::glMultiDrawElements(GLenum mode, const GLsizei *count, GLenum type, const GLvoid* const *indices, GLsizei drawcount)
-{
- d_1_4_Core->f.MultiDrawElements(mode, count, type, indices, drawcount);
-}
-
-inline void QOpenGLFunctions_4_2_Core::glMultiDrawArrays(GLenum mode, const GLint *first, const GLsizei *count, GLsizei drawcount)
-{
- d_1_4_Core->f.MultiDrawArrays(mode, first, count, drawcount);
-}
-
-inline void QOpenGLFunctions_4_2_Core::glBlendFuncSeparate(GLenum sfactorRGB, GLenum dfactorRGB, GLenum sfactorAlpha, GLenum dfactorAlpha)
-{
- d_1_4_Core->f.BlendFuncSeparate(sfactorRGB, dfactorRGB, sfactorAlpha, dfactorAlpha);
-}
-
-
-// OpenGL 1.5 core functions
-inline void QOpenGLFunctions_4_2_Core::glGetBufferPointerv(GLenum target, GLenum pname, GLvoid* *params)
-{
- d_1_5_Core->f.GetBufferPointerv(target, pname, params);
-}
-
-inline void QOpenGLFunctions_4_2_Core::glGetBufferParameteriv(GLenum target, GLenum pname, GLint *params)
-{
- d_1_5_Core->f.GetBufferParameteriv(target, pname, params);
-}
-
-inline GLboolean QOpenGLFunctions_4_2_Core::glUnmapBuffer(GLenum target)
-{
- return d_1_5_Core->f.UnmapBuffer(target);
-}
-
-inline GLvoid* QOpenGLFunctions_4_2_Core::glMapBuffer(GLenum target, GLenum access)
-{
- return d_1_5_Core->f.MapBuffer(target, access);
-}
-
-inline void QOpenGLFunctions_4_2_Core::glGetBufferSubData(GLenum target, GLintptr offset, GLsizeiptr size, GLvoid *data)
-{
- d_1_5_Core->f.GetBufferSubData(target, offset, size, data);
-}
-
-inline void QOpenGLFunctions_4_2_Core::glBufferSubData(GLenum target, GLintptr offset, GLsizeiptr size, const GLvoid *data)
-{
- d_1_5_Core->f.BufferSubData(target, offset, size, data);
-}
-
-inline void QOpenGLFunctions_4_2_Core::glBufferData(GLenum target, GLsizeiptr size, const GLvoid *data, GLenum usage)
-{
- d_1_5_Core->f.BufferData(target, size, data, usage);
-}
-
-inline GLboolean QOpenGLFunctions_4_2_Core::glIsBuffer(GLuint buffer)
-{
- return d_1_5_Core->f.IsBuffer(buffer);
-}
-
-inline void QOpenGLFunctions_4_2_Core::glGenBuffers(GLsizei n, GLuint *buffers)
-{
- d_1_5_Core->f.GenBuffers(n, buffers);
-}
-
-inline void QOpenGLFunctions_4_2_Core::glDeleteBuffers(GLsizei n, const GLuint *buffers)
-{
- d_1_5_Core->f.DeleteBuffers(n, buffers);
-}
-
-inline void QOpenGLFunctions_4_2_Core::glBindBuffer(GLenum target, GLuint buffer)
-{
- d_1_5_Core->f.BindBuffer(target, buffer);
-}
-
-inline void QOpenGLFunctions_4_2_Core::glGetQueryObjectuiv(GLuint id, GLenum pname, GLuint *params)
-{
- d_1_5_Core->f.GetQueryObjectuiv(id, pname, params);
-}
-
-inline void QOpenGLFunctions_4_2_Core::glGetQueryObjectiv(GLuint id, GLenum pname, GLint *params)
-{
- d_1_5_Core->f.GetQueryObjectiv(id, pname, params);
-}
-
-inline void QOpenGLFunctions_4_2_Core::glGetQueryiv(GLenum target, GLenum pname, GLint *params)
-{
- d_1_5_Core->f.GetQueryiv(target, pname, params);
-}
-
-inline void QOpenGLFunctions_4_2_Core::glEndQuery(GLenum target)
-{
- d_1_5_Core->f.EndQuery(target);
-}
-
-inline void QOpenGLFunctions_4_2_Core::glBeginQuery(GLenum target, GLuint id)
-{
- d_1_5_Core->f.BeginQuery(target, id);
-}
-
-inline GLboolean QOpenGLFunctions_4_2_Core::glIsQuery(GLuint id)
-{
- return d_1_5_Core->f.IsQuery(id);
-}
-
-inline void QOpenGLFunctions_4_2_Core::glDeleteQueries(GLsizei n, const GLuint *ids)
-{
- d_1_5_Core->f.DeleteQueries(n, ids);
-}
-
-inline void QOpenGLFunctions_4_2_Core::glGenQueries(GLsizei n, GLuint *ids)
-{
- d_1_5_Core->f.GenQueries(n, ids);
-}
-
-
-// OpenGL 2.0 core functions
-inline void QOpenGLFunctions_4_2_Core::glVertexAttribPointer(GLuint index, GLint size, GLenum type, GLboolean normalized, GLsizei stride, const GLvoid *pointer)
-{
- d_2_0_Core->f.VertexAttribPointer(index, size, type, normalized, stride, pointer);
-}
-
-inline void QOpenGLFunctions_4_2_Core::glValidateProgram(GLuint program)
-{
- d_2_0_Core->f.ValidateProgram(program);
-}
-
-inline void QOpenGLFunctions_4_2_Core::glUniformMatrix4fv(GLint location, GLsizei count, GLboolean transpose, const GLfloat *value)
-{
- d_2_0_Core->f.UniformMatrix4fv(location, count, transpose, value);
-}
-
-inline void QOpenGLFunctions_4_2_Core::glUniformMatrix3fv(GLint location, GLsizei count, GLboolean transpose, const GLfloat *value)
-{
- d_2_0_Core->f.UniformMatrix3fv(location, count, transpose, value);
-}
-
-inline void QOpenGLFunctions_4_2_Core::glUniformMatrix2fv(GLint location, GLsizei count, GLboolean transpose, const GLfloat *value)
-{
- d_2_0_Core->f.UniformMatrix2fv(location, count, transpose, value);
-}
-
-inline void QOpenGLFunctions_4_2_Core::glUniform4iv(GLint location, GLsizei count, const GLint *value)
-{
- d_2_0_Core->f.Uniform4iv(location, count, value);
-}
-
-inline void QOpenGLFunctions_4_2_Core::glUniform3iv(GLint location, GLsizei count, const GLint *value)
-{
- d_2_0_Core->f.Uniform3iv(location, count, value);
-}
-
-inline void QOpenGLFunctions_4_2_Core::glUniform2iv(GLint location, GLsizei count, const GLint *value)
-{
- d_2_0_Core->f.Uniform2iv(location, count, value);
-}
-
-inline void QOpenGLFunctions_4_2_Core::glUniform1iv(GLint location, GLsizei count, const GLint *value)
-{
- d_2_0_Core->f.Uniform1iv(location, count, value);
-}
-
-inline void QOpenGLFunctions_4_2_Core::glUniform4fv(GLint location, GLsizei count, const GLfloat *value)
-{
- d_2_0_Core->f.Uniform4fv(location, count, value);
-}
-
-inline void QOpenGLFunctions_4_2_Core::glUniform3fv(GLint location, GLsizei count, const GLfloat *value)
-{
- d_2_0_Core->f.Uniform3fv(location, count, value);
-}
-
-inline void QOpenGLFunctions_4_2_Core::glUniform2fv(GLint location, GLsizei count, const GLfloat *value)
-{
- d_2_0_Core->f.Uniform2fv(location, count, value);
-}
-
-inline void QOpenGLFunctions_4_2_Core::glUniform1fv(GLint location, GLsizei count, const GLfloat *value)
-{
- d_2_0_Core->f.Uniform1fv(location, count, value);
-}
-
-inline void QOpenGLFunctions_4_2_Core::glUniform4i(GLint location, GLint v0, GLint v1, GLint v2, GLint v3)
-{
- d_2_0_Core->f.Uniform4i(location, v0, v1, v2, v3);
-}
-
-inline void QOpenGLFunctions_4_2_Core::glUniform3i(GLint location, GLint v0, GLint v1, GLint v2)
-{
- d_2_0_Core->f.Uniform3i(location, v0, v1, v2);
-}
-
-inline void QOpenGLFunctions_4_2_Core::glUniform2i(GLint location, GLint v0, GLint v1)
-{
- d_2_0_Core->f.Uniform2i(location, v0, v1);
-}
-
-inline void QOpenGLFunctions_4_2_Core::glUniform1i(GLint location, GLint v0)
-{
- d_2_0_Core->f.Uniform1i(location, v0);
-}
-
-inline void QOpenGLFunctions_4_2_Core::glUniform4f(GLint location, GLfloat v0, GLfloat v1, GLfloat v2, GLfloat v3)
-{
- d_2_0_Core->f.Uniform4f(location, v0, v1, v2, v3);
-}
-
-inline void QOpenGLFunctions_4_2_Core::glUniform3f(GLint location, GLfloat v0, GLfloat v1, GLfloat v2)
-{
- d_2_0_Core->f.Uniform3f(location, v0, v1, v2);
-}
-
-inline void QOpenGLFunctions_4_2_Core::glUniform2f(GLint location, GLfloat v0, GLfloat v1)
-{
- d_2_0_Core->f.Uniform2f(location, v0, v1);
-}
-
-inline void QOpenGLFunctions_4_2_Core::glUniform1f(GLint location, GLfloat v0)
-{
- d_2_0_Core->f.Uniform1f(location, v0);
-}
-
-inline void QOpenGLFunctions_4_2_Core::glUseProgram(GLuint program)
-{
- d_2_0_Core->f.UseProgram(program);
-}
-
-inline void QOpenGLFunctions_4_2_Core::glShaderSource(GLuint shader, GLsizei count, const GLchar* const *string, const GLint *length)
-{
- d_2_0_Core->f.ShaderSource(shader, count, string, length);
-}
-
-inline void QOpenGLFunctions_4_2_Core::glLinkProgram(GLuint program)
-{
- d_2_0_Core->f.LinkProgram(program);
-}
-
-inline GLboolean QOpenGLFunctions_4_2_Core::glIsShader(GLuint shader)
-{
- return d_2_0_Core->f.IsShader(shader);
-}
-
-inline GLboolean QOpenGLFunctions_4_2_Core::glIsProgram(GLuint program)
-{
- return d_2_0_Core->f.IsProgram(program);
-}
-
-inline void QOpenGLFunctions_4_2_Core::glGetVertexAttribPointerv(GLuint index, GLenum pname, GLvoid* *pointer)
-{
- d_2_0_Core->f.GetVertexAttribPointerv(index, pname, pointer);
-}
-
-inline void QOpenGLFunctions_4_2_Core::glGetVertexAttribiv(GLuint index, GLenum pname, GLint *params)
-{
- d_2_0_Core->f.GetVertexAttribiv(index, pname, params);
-}
-
-inline void QOpenGLFunctions_4_2_Core::glGetVertexAttribfv(GLuint index, GLenum pname, GLfloat *params)
-{
- d_2_0_Core->f.GetVertexAttribfv(index, pname, params);
-}
-
-inline void QOpenGLFunctions_4_2_Core::glGetVertexAttribdv(GLuint index, GLenum pname, GLdouble *params)
-{
- d_2_0_Core->f.GetVertexAttribdv(index, pname, params);
-}
-
-inline void QOpenGLFunctions_4_2_Core::glGetUniformiv(GLuint program, GLint location, GLint *params)
-{
- d_2_0_Core->f.GetUniformiv(program, location, params);
-}
-
-inline void QOpenGLFunctions_4_2_Core::glGetUniformfv(GLuint program, GLint location, GLfloat *params)
-{
- d_2_0_Core->f.GetUniformfv(program, location, params);
-}
-
-inline GLint QOpenGLFunctions_4_2_Core::glGetUniformLocation(GLuint program, const GLchar *name)
-{
- return d_2_0_Core->f.GetUniformLocation(program, name);
-}
-
-inline void QOpenGLFunctions_4_2_Core::glGetShaderSource(GLuint shader, GLsizei bufSize, GLsizei *length, GLchar *source)
-{
- d_2_0_Core->f.GetShaderSource(shader, bufSize, length, source);
-}
-
-inline void QOpenGLFunctions_4_2_Core::glGetShaderInfoLog(GLuint shader, GLsizei bufSize, GLsizei *length, GLchar *infoLog)
-{
- d_2_0_Core->f.GetShaderInfoLog(shader, bufSize, length, infoLog);
-}
-
-inline void QOpenGLFunctions_4_2_Core::glGetShaderiv(GLuint shader, GLenum pname, GLint *params)
-{
- d_2_0_Core->f.GetShaderiv(shader, pname, params);
-}
-
-inline void QOpenGLFunctions_4_2_Core::glGetProgramInfoLog(GLuint program, GLsizei bufSize, GLsizei *length, GLchar *infoLog)
-{
- d_2_0_Core->f.GetProgramInfoLog(program, bufSize, length, infoLog);
-}
-
-inline void QOpenGLFunctions_4_2_Core::glGetProgramiv(GLuint program, GLenum pname, GLint *params)
-{
- d_2_0_Core->f.GetProgramiv(program, pname, params);
-}
-
-inline GLint QOpenGLFunctions_4_2_Core::glGetAttribLocation(GLuint program, const GLchar *name)
-{
- return d_2_0_Core->f.GetAttribLocation(program, name);
-}
-
-inline void QOpenGLFunctions_4_2_Core::glGetAttachedShaders(GLuint program, GLsizei maxCount, GLsizei *count, GLuint *obj)
-{
- d_2_0_Core->f.GetAttachedShaders(program, maxCount, count, obj);
-}
-
-inline void QOpenGLFunctions_4_2_Core::glGetActiveUniform(GLuint program, GLuint index, GLsizei bufSize, GLsizei *length, GLint *size, GLenum *type, GLchar *name)
-{
- d_2_0_Core->f.GetActiveUniform(program, index, bufSize, length, size, type, name);
-}
-
-inline void QOpenGLFunctions_4_2_Core::glGetActiveAttrib(GLuint program, GLuint index, GLsizei bufSize, GLsizei *length, GLint *size, GLenum *type, GLchar *name)
-{
- d_2_0_Core->f.GetActiveAttrib(program, index, bufSize, length, size, type, name);
-}
-
-inline void QOpenGLFunctions_4_2_Core::glEnableVertexAttribArray(GLuint index)
-{
- d_2_0_Core->f.EnableVertexAttribArray(index);
-}
-
-inline void QOpenGLFunctions_4_2_Core::glDisableVertexAttribArray(GLuint index)
-{
- d_2_0_Core->f.DisableVertexAttribArray(index);
-}
-
-inline void QOpenGLFunctions_4_2_Core::glDetachShader(GLuint program, GLuint shader)
-{
- d_2_0_Core->f.DetachShader(program, shader);
-}
-
-inline void QOpenGLFunctions_4_2_Core::glDeleteShader(GLuint shader)
-{
- d_2_0_Core->f.DeleteShader(shader);
-}
-
-inline void QOpenGLFunctions_4_2_Core::glDeleteProgram(GLuint program)
-{
- d_2_0_Core->f.DeleteProgram(program);
-}
-
-inline GLuint QOpenGLFunctions_4_2_Core::glCreateShader(GLenum type)
-{
- return d_2_0_Core->f.CreateShader(type);
-}
-
-inline GLuint QOpenGLFunctions_4_2_Core::glCreateProgram()
-{
- return d_2_0_Core->f.CreateProgram();
-}
-
-inline void QOpenGLFunctions_4_2_Core::glCompileShader(GLuint shader)
-{
- d_2_0_Core->f.CompileShader(shader);
-}
-
-inline void QOpenGLFunctions_4_2_Core::glBindAttribLocation(GLuint program, GLuint index, const GLchar *name)
-{
- d_2_0_Core->f.BindAttribLocation(program, index, name);
-}
-
-inline void QOpenGLFunctions_4_2_Core::glAttachShader(GLuint program, GLuint shader)
-{
- d_2_0_Core->f.AttachShader(program, shader);
-}
-
-inline void QOpenGLFunctions_4_2_Core::glStencilMaskSeparate(GLenum face, GLuint mask)
-{
- d_2_0_Core->f.StencilMaskSeparate(face, mask);
-}
-
-inline void QOpenGLFunctions_4_2_Core::glStencilFuncSeparate(GLenum face, GLenum func, GLint ref, GLuint mask)
-{
- d_2_0_Core->f.StencilFuncSeparate(face, func, ref, mask);
-}
-
-inline void QOpenGLFunctions_4_2_Core::glStencilOpSeparate(GLenum face, GLenum sfail, GLenum dpfail, GLenum dppass)
-{
- d_2_0_Core->f.StencilOpSeparate(face, sfail, dpfail, dppass);
-}
-
-inline void QOpenGLFunctions_4_2_Core::glDrawBuffers(GLsizei n, const GLenum *bufs)
-{
- d_2_0_Core->f.DrawBuffers(n, bufs);
-}
-
-inline void QOpenGLFunctions_4_2_Core::glBlendEquationSeparate(GLenum modeRGB, GLenum modeAlpha)
-{
- d_2_0_Core->f.BlendEquationSeparate(modeRGB, modeAlpha);
-}
-
-
-// OpenGL 2.1 core functions
-inline void QOpenGLFunctions_4_2_Core::glUniformMatrix4x3fv(GLint location, GLsizei count, GLboolean transpose, const GLfloat *value)
-{
- d_2_1_Core->f.UniformMatrix4x3fv(location, count, transpose, value);
-}
-
-inline void QOpenGLFunctions_4_2_Core::glUniformMatrix3x4fv(GLint location, GLsizei count, GLboolean transpose, const GLfloat *value)
-{
- d_2_1_Core->f.UniformMatrix3x4fv(location, count, transpose, value);
-}
-
-inline void QOpenGLFunctions_4_2_Core::glUniformMatrix4x2fv(GLint location, GLsizei count, GLboolean transpose, const GLfloat *value)
-{
- d_2_1_Core->f.UniformMatrix4x2fv(location, count, transpose, value);
-}
-
-inline void QOpenGLFunctions_4_2_Core::glUniformMatrix2x4fv(GLint location, GLsizei count, GLboolean transpose, const GLfloat *value)
-{
- d_2_1_Core->f.UniformMatrix2x4fv(location, count, transpose, value);
-}
-
-inline void QOpenGLFunctions_4_2_Core::glUniformMatrix3x2fv(GLint location, GLsizei count, GLboolean transpose, const GLfloat *value)
-{
- d_2_1_Core->f.UniformMatrix3x2fv(location, count, transpose, value);
-}
-
-inline void QOpenGLFunctions_4_2_Core::glUniformMatrix2x3fv(GLint location, GLsizei count, GLboolean transpose, const GLfloat *value)
-{
- d_2_1_Core->f.UniformMatrix2x3fv(location, count, transpose, value);
-}
-
-
-// OpenGL 3.0 core functions
-inline GLboolean QOpenGLFunctions_4_2_Core::glIsVertexArray(GLuint array)
-{
- return d_3_0_Core->f.IsVertexArray(array);
-}
-
-inline void QOpenGLFunctions_4_2_Core::glGenVertexArrays(GLsizei n, GLuint *arrays)
-{
- d_3_0_Core->f.GenVertexArrays(n, arrays);
-}
-
-inline void QOpenGLFunctions_4_2_Core::glDeleteVertexArrays(GLsizei n, const GLuint *arrays)
-{
- d_3_0_Core->f.DeleteVertexArrays(n, arrays);
-}
-
-inline void QOpenGLFunctions_4_2_Core::glBindVertexArray(GLuint array)
-{
- d_3_0_Core->f.BindVertexArray(array);
-}
-
-inline void QOpenGLFunctions_4_2_Core::glFlushMappedBufferRange(GLenum target, GLintptr offset, GLsizeiptr length)
-{
- d_3_0_Core->f.FlushMappedBufferRange(target, offset, length);
-}
-
-inline GLvoid* QOpenGLFunctions_4_2_Core::glMapBufferRange(GLenum target, GLintptr offset, GLsizeiptr length, GLbitfield access)
-{
- return d_3_0_Core->f.MapBufferRange(target, offset, length, access);
-}
-
-inline void QOpenGLFunctions_4_2_Core::glFramebufferTextureLayer(GLenum target, GLenum attachment, GLuint texture, GLint level, GLint layer)
-{
- d_3_0_Core->f.FramebufferTextureLayer(target, attachment, texture, level, layer);
-}
-
-inline void QOpenGLFunctions_4_2_Core::glRenderbufferStorageMultisample(GLenum target, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height)
-{
- d_3_0_Core->f.RenderbufferStorageMultisample(target, samples, internalformat, width, height);
-}
-
-inline void QOpenGLFunctions_4_2_Core::glBlitFramebuffer(GLint srcX0, GLint srcY0, GLint srcX1, GLint srcY1, GLint dstX0, GLint dstY0, GLint dstX1, GLint dstY1, GLbitfield mask, GLenum filter)
-{
- d_3_0_Core->f.BlitFramebuffer(srcX0, srcY0, srcX1, srcY1, dstX0, dstY0, dstX1, dstY1, mask, filter);
-}
-
-inline void QOpenGLFunctions_4_2_Core::glGenerateMipmap(GLenum target)
-{
- d_3_0_Core->f.GenerateMipmap(target);
-}
-
-inline void QOpenGLFunctions_4_2_Core::glGetFramebufferAttachmentParameteriv(GLenum target, GLenum attachment, GLenum pname, GLint *params)
-{
- d_3_0_Core->f.GetFramebufferAttachmentParameteriv(target, attachment, pname, params);
-}
-
-inline void QOpenGLFunctions_4_2_Core::glFramebufferRenderbuffer(GLenum target, GLenum attachment, GLenum renderbuffertarget, GLuint renderbuffer)
-{
- d_3_0_Core->f.FramebufferRenderbuffer(target, attachment, renderbuffertarget, renderbuffer);
-}
-
-inline void QOpenGLFunctions_4_2_Core::glFramebufferTexture3D(GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level, GLint zoffset)
-{
- d_3_0_Core->f.FramebufferTexture3D(target, attachment, textarget, texture, level, zoffset);
-}
-
-inline void QOpenGLFunctions_4_2_Core::glFramebufferTexture2D(GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level)
-{
- d_3_0_Core->f.FramebufferTexture2D(target, attachment, textarget, texture, level);
-}
-
-inline void QOpenGLFunctions_4_2_Core::glFramebufferTexture1D(GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level)
-{
- d_3_0_Core->f.FramebufferTexture1D(target, attachment, textarget, texture, level);
-}
-
-inline GLenum QOpenGLFunctions_4_2_Core::glCheckFramebufferStatus(GLenum target)
-{
- return d_3_0_Core->f.CheckFramebufferStatus(target);
-}
-
-inline void QOpenGLFunctions_4_2_Core::glGenFramebuffers(GLsizei n, GLuint *framebuffers)
-{
- d_3_0_Core->f.GenFramebuffers(n, framebuffers);
-}
-
-inline void QOpenGLFunctions_4_2_Core::glDeleteFramebuffers(GLsizei n, const GLuint *framebuffers)
-{
- d_3_0_Core->f.DeleteFramebuffers(n, framebuffers);
-}
-
-inline void QOpenGLFunctions_4_2_Core::glBindFramebuffer(GLenum target, GLuint framebuffer)
-{
- d_3_0_Core->f.BindFramebuffer(target, framebuffer);
-}
-
-inline GLboolean QOpenGLFunctions_4_2_Core::glIsFramebuffer(GLuint framebuffer)
-{
- return d_3_0_Core->f.IsFramebuffer(framebuffer);
-}
-
-inline void QOpenGLFunctions_4_2_Core::glGetRenderbufferParameteriv(GLenum target, GLenum pname, GLint *params)
-{
- d_3_0_Core->f.GetRenderbufferParameteriv(target, pname, params);
-}
-
-inline void QOpenGLFunctions_4_2_Core::glRenderbufferStorage(GLenum target, GLenum internalformat, GLsizei width, GLsizei height)
-{
- d_3_0_Core->f.RenderbufferStorage(target, internalformat, width, height);
-}
-
-inline void QOpenGLFunctions_4_2_Core::glGenRenderbuffers(GLsizei n, GLuint *renderbuffers)
-{
- d_3_0_Core->f.GenRenderbuffers(n, renderbuffers);
-}
-
-inline void QOpenGLFunctions_4_2_Core::glDeleteRenderbuffers(GLsizei n, const GLuint *renderbuffers)
-{
- d_3_0_Core->f.DeleteRenderbuffers(n, renderbuffers);
-}
-
-inline void QOpenGLFunctions_4_2_Core::glBindRenderbuffer(GLenum target, GLuint renderbuffer)
-{
- d_3_0_Core->f.BindRenderbuffer(target, renderbuffer);
-}
-
-inline GLboolean QOpenGLFunctions_4_2_Core::glIsRenderbuffer(GLuint renderbuffer)
-{
- return d_3_0_Core->f.IsRenderbuffer(renderbuffer);
-}
-
-inline const GLubyte * QOpenGLFunctions_4_2_Core::glGetStringi(GLenum name, GLuint index)
-{
- return d_3_0_Core->f.GetStringi(name, index);
-}
-
-inline void QOpenGLFunctions_4_2_Core::glClearBufferfi(GLenum buffer, GLint drawbuffer, GLfloat depth, GLint stencil)
-{
- d_3_0_Core->f.ClearBufferfi(buffer, drawbuffer, depth, stencil);
-}
-
-inline void QOpenGLFunctions_4_2_Core::glClearBufferfv(GLenum buffer, GLint drawbuffer, const GLfloat *value)
-{
- d_3_0_Core->f.ClearBufferfv(buffer, drawbuffer, value);
-}
-
-inline void QOpenGLFunctions_4_2_Core::glClearBufferuiv(GLenum buffer, GLint drawbuffer, const GLuint *value)
-{
- d_3_0_Core->f.ClearBufferuiv(buffer, drawbuffer, value);
-}
-
-inline void QOpenGLFunctions_4_2_Core::glClearBufferiv(GLenum buffer, GLint drawbuffer, const GLint *value)
-{
- d_3_0_Core->f.ClearBufferiv(buffer, drawbuffer, value);
-}
-
-inline void QOpenGLFunctions_4_2_Core::glGetTexParameterIuiv(GLenum target, GLenum pname, GLuint *params)
-{
- d_3_0_Core->f.GetTexParameterIuiv(target, pname, params);
-}
-
-inline void QOpenGLFunctions_4_2_Core::glGetTexParameterIiv(GLenum target, GLenum pname, GLint *params)
-{
- d_3_0_Core->f.GetTexParameterIiv(target, pname, params);
-}
-
-inline void QOpenGLFunctions_4_2_Core::glTexParameterIuiv(GLenum target, GLenum pname, const GLuint *params)
-{
- d_3_0_Core->f.TexParameterIuiv(target, pname, params);
-}
-
-inline void QOpenGLFunctions_4_2_Core::glTexParameterIiv(GLenum target, GLenum pname, const GLint *params)
-{
- d_3_0_Core->f.TexParameterIiv(target, pname, params);
-}
-
-inline void QOpenGLFunctions_4_2_Core::glUniform4uiv(GLint location, GLsizei count, const GLuint *value)
-{
- d_3_0_Core->f.Uniform4uiv(location, count, value);
-}
-
-inline void QOpenGLFunctions_4_2_Core::glUniform3uiv(GLint location, GLsizei count, const GLuint *value)
-{
- d_3_0_Core->f.Uniform3uiv(location, count, value);
-}
-
-inline void QOpenGLFunctions_4_2_Core::glUniform2uiv(GLint location, GLsizei count, const GLuint *value)
-{
- d_3_0_Core->f.Uniform2uiv(location, count, value);
-}
-
-inline void QOpenGLFunctions_4_2_Core::glUniform1uiv(GLint location, GLsizei count, const GLuint *value)
-{
- d_3_0_Core->f.Uniform1uiv(location, count, value);
-}
-
-inline void QOpenGLFunctions_4_2_Core::glUniform4ui(GLint location, GLuint v0, GLuint v1, GLuint v2, GLuint v3)
-{
- d_3_0_Core->f.Uniform4ui(location, v0, v1, v2, v3);
-}
-
-inline void QOpenGLFunctions_4_2_Core::glUniform3ui(GLint location, GLuint v0, GLuint v1, GLuint v2)
-{
- d_3_0_Core->f.Uniform3ui(location, v0, v1, v2);
-}
-
-inline void QOpenGLFunctions_4_2_Core::glUniform2ui(GLint location, GLuint v0, GLuint v1)
-{
- d_3_0_Core->f.Uniform2ui(location, v0, v1);
-}
-
-inline void QOpenGLFunctions_4_2_Core::glUniform1ui(GLint location, GLuint v0)
-{
- d_3_0_Core->f.Uniform1ui(location, v0);
-}
-
-inline GLint QOpenGLFunctions_4_2_Core::glGetFragDataLocation(GLuint program, const GLchar *name)
-{
- return d_3_0_Core->f.GetFragDataLocation(program, name);
-}
-
-inline void QOpenGLFunctions_4_2_Core::glBindFragDataLocation(GLuint program, GLuint color, const GLchar *name)
-{
- d_3_0_Core->f.BindFragDataLocation(program, color, name);
-}
-
-inline void QOpenGLFunctions_4_2_Core::glGetUniformuiv(GLuint program, GLint location, GLuint *params)
-{
- d_3_0_Core->f.GetUniformuiv(program, location, params);
-}
-
-inline void QOpenGLFunctions_4_2_Core::glGetVertexAttribIuiv(GLuint index, GLenum pname, GLuint *params)
-{
- d_3_0_Core->f.GetVertexAttribIuiv(index, pname, params);
-}
-
-inline void QOpenGLFunctions_4_2_Core::glGetVertexAttribIiv(GLuint index, GLenum pname, GLint *params)
-{
- d_3_0_Core->f.GetVertexAttribIiv(index, pname, params);
-}
-
-inline void QOpenGLFunctions_4_2_Core::glVertexAttribIPointer(GLuint index, GLint size, GLenum type, GLsizei stride, const GLvoid *pointer)
-{
- d_3_0_Core->f.VertexAttribIPointer(index, size, type, stride, pointer);
-}
-
-inline void QOpenGLFunctions_4_2_Core::glEndConditionalRender()
-{
- d_3_0_Core->f.EndConditionalRender();
-}
-
-inline void QOpenGLFunctions_4_2_Core::glBeginConditionalRender(GLuint id, GLenum mode)
-{
- d_3_0_Core->f.BeginConditionalRender(id, mode);
-}
-
-inline void QOpenGLFunctions_4_2_Core::glClampColor(GLenum target, GLenum clamp)
-{
- d_3_0_Core->f.ClampColor(target, clamp);
-}
-
-inline void QOpenGLFunctions_4_2_Core::glGetTransformFeedbackVarying(GLuint program, GLuint index, GLsizei bufSize, GLsizei *length, GLsizei *size, GLenum *type, GLchar *name)
-{
- d_3_0_Core->f.GetTransformFeedbackVarying(program, index, bufSize, length, size, type, name);
-}
-
-inline void QOpenGLFunctions_4_2_Core::glTransformFeedbackVaryings(GLuint program, GLsizei count, const GLchar* const *varyings, GLenum bufferMode)
-{
- d_3_0_Core->f.TransformFeedbackVaryings(program, count, varyings, bufferMode);
-}
-
-inline void QOpenGLFunctions_4_2_Core::glBindBufferBase(GLenum target, GLuint index, GLuint buffer)
-{
- d_3_0_Core->f.BindBufferBase(target, index, buffer);
-}
-
-inline void QOpenGLFunctions_4_2_Core::glBindBufferRange(GLenum target, GLuint index, GLuint buffer, GLintptr offset, GLsizeiptr size)
-{
- d_3_0_Core->f.BindBufferRange(target, index, buffer, offset, size);
-}
-
-inline void QOpenGLFunctions_4_2_Core::glEndTransformFeedback()
-{
- d_3_0_Core->f.EndTransformFeedback();
-}
-
-inline void QOpenGLFunctions_4_2_Core::glBeginTransformFeedback(GLenum primitiveMode)
-{
- d_3_0_Core->f.BeginTransformFeedback(primitiveMode);
-}
-
-inline GLboolean QOpenGLFunctions_4_2_Core::glIsEnabledi(GLenum target, GLuint index)
-{
- return d_3_0_Core->f.IsEnabledi(target, index);
-}
-
-inline void QOpenGLFunctions_4_2_Core::glDisablei(GLenum target, GLuint index)
-{
- d_3_0_Core->f.Disablei(target, index);
-}
-
-inline void QOpenGLFunctions_4_2_Core::glEnablei(GLenum target, GLuint index)
-{
- d_3_0_Core->f.Enablei(target, index);
-}
-
-inline void QOpenGLFunctions_4_2_Core::glGetIntegeri_v(GLenum target, GLuint index, GLint *data)
-{
- d_3_0_Core->f.GetIntegeri_v(target, index, data);
-}
-
-inline void QOpenGLFunctions_4_2_Core::glGetBooleani_v(GLenum target, GLuint index, GLboolean *data)
-{
- d_3_0_Core->f.GetBooleani_v(target, index, data);
-}
-
-inline void QOpenGLFunctions_4_2_Core::glColorMaski(GLuint index, GLboolean r, GLboolean g, GLboolean b, GLboolean a)
-{
- d_3_0_Core->f.ColorMaski(index, r, g, b, a);
-}
-
-
-// OpenGL 3.1 core functions
-inline void QOpenGLFunctions_4_2_Core::glCopyBufferSubData(GLenum readTarget, GLenum writeTarget, GLintptr readOffset, GLintptr writeOffset, GLsizeiptr size)
-{
- d_3_1_Core->f.CopyBufferSubData(readTarget, writeTarget, readOffset, writeOffset, size);
-}
-
-inline void QOpenGLFunctions_4_2_Core::glUniformBlockBinding(GLuint program, GLuint uniformBlockIndex, GLuint uniformBlockBinding)
-{
- d_3_1_Core->f.UniformBlockBinding(program, uniformBlockIndex, uniformBlockBinding);
-}
-
-inline void QOpenGLFunctions_4_2_Core::glGetActiveUniformBlockName(GLuint program, GLuint uniformBlockIndex, GLsizei bufSize, GLsizei *length, GLchar *uniformBlockName)
-{
- d_3_1_Core->f.GetActiveUniformBlockName(program, uniformBlockIndex, bufSize, length, uniformBlockName);
-}
-
-inline void QOpenGLFunctions_4_2_Core::glGetActiveUniformBlockiv(GLuint program, GLuint uniformBlockIndex, GLenum pname, GLint *params)
-{
- d_3_1_Core->f.GetActiveUniformBlockiv(program, uniformBlockIndex, pname, params);
-}
-
-inline GLuint QOpenGLFunctions_4_2_Core::glGetUniformBlockIndex(GLuint program, const GLchar *uniformBlockName)
-{
- return d_3_1_Core->f.GetUniformBlockIndex(program, uniformBlockName);
-}
-
-inline void QOpenGLFunctions_4_2_Core::glGetActiveUniformName(GLuint program, GLuint uniformIndex, GLsizei bufSize, GLsizei *length, GLchar *uniformName)
-{
- d_3_1_Core->f.GetActiveUniformName(program, uniformIndex, bufSize, length, uniformName);
-}
-
-inline void QOpenGLFunctions_4_2_Core::glGetActiveUniformsiv(GLuint program, GLsizei uniformCount, const GLuint *uniformIndices, GLenum pname, GLint *params)
-{
- d_3_1_Core->f.GetActiveUniformsiv(program, uniformCount, uniformIndices, pname, params);
-}
-
-inline void QOpenGLFunctions_4_2_Core::glGetUniformIndices(GLuint program, GLsizei uniformCount, const GLchar* const *uniformNames, GLuint *uniformIndices)
-{
- d_3_1_Core->f.GetUniformIndices(program, uniformCount, uniformNames, uniformIndices);
-}
-
-inline void QOpenGLFunctions_4_2_Core::glPrimitiveRestartIndex(GLuint index)
-{
- d_3_1_Core->f.PrimitiveRestartIndex(index);
-}
-
-inline void QOpenGLFunctions_4_2_Core::glTexBuffer(GLenum target, GLenum internalformat, GLuint buffer)
-{
- d_3_1_Core->f.TexBuffer(target, internalformat, buffer);
-}
-
-inline void QOpenGLFunctions_4_2_Core::glDrawElementsInstanced(GLenum mode, GLsizei count, GLenum type, const GLvoid *indices, GLsizei instancecount)
-{
- d_3_1_Core->f.DrawElementsInstanced(mode, count, type, indices, instancecount);
-}
-
-inline void QOpenGLFunctions_4_2_Core::glDrawArraysInstanced(GLenum mode, GLint first, GLsizei count, GLsizei instancecount)
-{
- d_3_1_Core->f.DrawArraysInstanced(mode, first, count, instancecount);
-}
-
-
-// OpenGL 3.2 core functions
-inline void QOpenGLFunctions_4_2_Core::glSampleMaski(GLuint index, GLbitfield mask)
-{
- d_3_2_Core->f.SampleMaski(index, mask);
-}
-
-inline void QOpenGLFunctions_4_2_Core::glGetMultisamplefv(GLenum pname, GLuint index, GLfloat *val)
-{
- d_3_2_Core->f.GetMultisamplefv(pname, index, val);
-}
-
-inline void QOpenGLFunctions_4_2_Core::glTexImage3DMultisample(GLenum target, GLsizei samples, GLint internalformat, GLsizei width, GLsizei height, GLsizei depth, GLboolean fixedsamplelocations)
-{
- d_3_2_Core->f.TexImage3DMultisample(target, samples, internalformat, width, height, depth, fixedsamplelocations);
-}
-
-inline void QOpenGLFunctions_4_2_Core::glTexImage2DMultisample(GLenum target, GLsizei samples, GLint internalformat, GLsizei width, GLsizei height, GLboolean fixedsamplelocations)
-{
- d_3_2_Core->f.TexImage2DMultisample(target, samples, internalformat, width, height, fixedsamplelocations);
-}
-
-inline void QOpenGLFunctions_4_2_Core::glGetSynciv(GLsync sync, GLenum pname, GLsizei bufSize, GLsizei *length, GLint *values)
-{
- d_3_2_Core->f.GetSynciv(sync, pname, bufSize, length, values);
-}
-
-inline void QOpenGLFunctions_4_2_Core::glGetInteger64v(GLenum pname, GLint64 *params)
-{
- d_3_2_Core->f.GetInteger64v(pname, params);
-}
-
-inline void QOpenGLFunctions_4_2_Core::glWaitSync(GLsync sync, GLbitfield flags, GLuint64 timeout)
-{
- d_3_2_Core->f.WaitSync(sync, flags, timeout);
-}
-
-inline GLenum QOpenGLFunctions_4_2_Core::glClientWaitSync(GLsync sync, GLbitfield flags, GLuint64 timeout)
-{
- return d_3_2_Core->f.ClientWaitSync(sync, flags, timeout);
-}
-
-inline void QOpenGLFunctions_4_2_Core::glDeleteSync(GLsync sync)
-{
- d_3_2_Core->f.DeleteSync(sync);
-}
-
-inline GLboolean QOpenGLFunctions_4_2_Core::glIsSync(GLsync sync)
-{
- return d_3_2_Core->f.IsSync(sync);
-}
-
-inline GLsync QOpenGLFunctions_4_2_Core::glFenceSync(GLenum condition, GLbitfield flags)
-{
- return d_3_2_Core->f.FenceSync(condition, flags);
-}
-
-inline void QOpenGLFunctions_4_2_Core::glProvokingVertex(GLenum mode)
-{
- d_3_2_Core->f.ProvokingVertex(mode);
-}
-
-inline void QOpenGLFunctions_4_2_Core::glMultiDrawElementsBaseVertex(GLenum mode, const GLsizei *count, GLenum type, const GLvoid* const *indices, GLsizei drawcount, const GLint *basevertex)
-{
- d_3_2_Core->f.MultiDrawElementsBaseVertex(mode, count, type, indices, drawcount, basevertex);
-}
-
-inline void QOpenGLFunctions_4_2_Core::glDrawElementsInstancedBaseVertex(GLenum mode, GLsizei count, GLenum type, const GLvoid *indices, GLsizei instancecount, GLint basevertex)
-{
- d_3_2_Core->f.DrawElementsInstancedBaseVertex(mode, count, type, indices, instancecount, basevertex);
-}
-
-inline void QOpenGLFunctions_4_2_Core::glDrawRangeElementsBaseVertex(GLenum mode, GLuint start, GLuint end, GLsizei count, GLenum type, const GLvoid *indices, GLint basevertex)
-{
- d_3_2_Core->f.DrawRangeElementsBaseVertex(mode, start, end, count, type, indices, basevertex);
-}
-
-inline void QOpenGLFunctions_4_2_Core::glDrawElementsBaseVertex(GLenum mode, GLsizei count, GLenum type, const GLvoid *indices, GLint basevertex)
-{
- d_3_2_Core->f.DrawElementsBaseVertex(mode, count, type, indices, basevertex);
-}
-
-inline void QOpenGLFunctions_4_2_Core::glFramebufferTexture(GLenum target, GLenum attachment, GLuint texture, GLint level)
-{
- d_3_2_Core->f.FramebufferTexture(target, attachment, texture, level);
-}
-
-inline void QOpenGLFunctions_4_2_Core::glGetBufferParameteri64v(GLenum target, GLenum pname, GLint64 *params)
-{
- d_3_2_Core->f.GetBufferParameteri64v(target, pname, params);
-}
-
-inline void QOpenGLFunctions_4_2_Core::glGetInteger64i_v(GLenum target, GLuint index, GLint64 *data)
-{
- d_3_2_Core->f.GetInteger64i_v(target, index, data);
-}
-
-
-// OpenGL 3.3 core functions
-inline void QOpenGLFunctions_4_2_Core::glVertexAttribP4uiv(GLuint index, GLenum type, GLboolean normalized, const GLuint *value)
-{
- d_3_3_Core->f.VertexAttribP4uiv(index, type, normalized, value);
-}
-
-inline void QOpenGLFunctions_4_2_Core::glVertexAttribP4ui(GLuint index, GLenum type, GLboolean normalized, GLuint value)
-{
- d_3_3_Core->f.VertexAttribP4ui(index, type, normalized, value);
-}
-
-inline void QOpenGLFunctions_4_2_Core::glVertexAttribP3uiv(GLuint index, GLenum type, GLboolean normalized, const GLuint *value)
-{
- d_3_3_Core->f.VertexAttribP3uiv(index, type, normalized, value);
-}
-
-inline void QOpenGLFunctions_4_2_Core::glVertexAttribP3ui(GLuint index, GLenum type, GLboolean normalized, GLuint value)
-{
- d_3_3_Core->f.VertexAttribP3ui(index, type, normalized, value);
-}
-
-inline void QOpenGLFunctions_4_2_Core::glVertexAttribP2uiv(GLuint index, GLenum type, GLboolean normalized, const GLuint *value)
-{
- d_3_3_Core->f.VertexAttribP2uiv(index, type, normalized, value);
-}
-
-inline void QOpenGLFunctions_4_2_Core::glVertexAttribP2ui(GLuint index, GLenum type, GLboolean normalized, GLuint value)
-{
- d_3_3_Core->f.VertexAttribP2ui(index, type, normalized, value);
-}
-
-inline void QOpenGLFunctions_4_2_Core::glVertexAttribP1uiv(GLuint index, GLenum type, GLboolean normalized, const GLuint *value)
-{
- d_3_3_Core->f.VertexAttribP1uiv(index, type, normalized, value);
-}
-
-inline void QOpenGLFunctions_4_2_Core::glVertexAttribP1ui(GLuint index, GLenum type, GLboolean normalized, GLuint value)
-{
- d_3_3_Core->f.VertexAttribP1ui(index, type, normalized, value);
-}
-
-inline void QOpenGLFunctions_4_2_Core::glSecondaryColorP3uiv(GLenum type, const GLuint *color)
-{
- Q_UNUSED(type);
- Q_UNUSED(color);
- QOPENGL_DEPRECATEDFUNCTION;
-}
-
-inline void QOpenGLFunctions_4_2_Core::glSecondaryColorP3ui(GLenum type, GLuint color)
-{
- Q_UNUSED(type);
- Q_UNUSED(color);
- QOPENGL_DEPRECATEDFUNCTION;
-}
-
-inline void QOpenGLFunctions_4_2_Core::glColorP4uiv(GLenum type, const GLuint *color)
-{
- Q_UNUSED(type);
- Q_UNUSED(color);
- QOPENGL_DEPRECATEDFUNCTION;
-}
-
-inline void QOpenGLFunctions_4_2_Core::glColorP4ui(GLenum type, GLuint color)
-{
- Q_UNUSED(type);
- Q_UNUSED(color);
- QOPENGL_DEPRECATEDFUNCTION;
-}
-
-inline void QOpenGLFunctions_4_2_Core::glColorP3uiv(GLenum type, const GLuint *color)
-{
- Q_UNUSED(type);
- Q_UNUSED(color);
- QOPENGL_DEPRECATEDFUNCTION;
-}
-
-inline void QOpenGLFunctions_4_2_Core::glColorP3ui(GLenum type, GLuint color)
-{
- Q_UNUSED(type);
- Q_UNUSED(color);
- QOPENGL_DEPRECATEDFUNCTION;
-}
-
-inline void QOpenGLFunctions_4_2_Core::glNormalP3uiv(GLenum type, const GLuint *coords)
-{
- Q_UNUSED(type);
- Q_UNUSED(coords);
- QOPENGL_DEPRECATEDFUNCTION;
-}
-
-inline void QOpenGLFunctions_4_2_Core::glNormalP3ui(GLenum type, GLuint coords)
-{
- Q_UNUSED(type);
- Q_UNUSED(coords);
- QOPENGL_DEPRECATEDFUNCTION;
-}
-
-inline void QOpenGLFunctions_4_2_Core::glMultiTexCoordP4uiv(GLenum texture, GLenum type, const GLuint *coords)
-{
- Q_UNUSED(texture);
- Q_UNUSED(type);
- Q_UNUSED(coords);
- QOPENGL_DEPRECATEDFUNCTION;
-}
-
-inline void QOpenGLFunctions_4_2_Core::glMultiTexCoordP4ui(GLenum texture, GLenum type, GLuint coords)
-{
- Q_UNUSED(texture);
- Q_UNUSED(type);
- Q_UNUSED(coords);
- QOPENGL_DEPRECATEDFUNCTION;
-}
-
-inline void QOpenGLFunctions_4_2_Core::glMultiTexCoordP3uiv(GLenum texture, GLenum type, const GLuint *coords)
-{
- Q_UNUSED(texture);
- Q_UNUSED(type);
- Q_UNUSED(coords);
- QOPENGL_DEPRECATEDFUNCTION;
-}
-
-inline void QOpenGLFunctions_4_2_Core::glMultiTexCoordP3ui(GLenum texture, GLenum type, GLuint coords)
-{
- Q_UNUSED(texture);
- Q_UNUSED(type);
- Q_UNUSED(coords);
- QOPENGL_DEPRECATEDFUNCTION;
-}
-
-inline void QOpenGLFunctions_4_2_Core::glMultiTexCoordP2uiv(GLenum texture, GLenum type, const GLuint *coords)
-{
- Q_UNUSED(texture);
- Q_UNUSED(type);
- Q_UNUSED(coords);
- QOPENGL_DEPRECATEDFUNCTION;
-}
-
-inline void QOpenGLFunctions_4_2_Core::glMultiTexCoordP2ui(GLenum texture, GLenum type, GLuint coords)
-{
- Q_UNUSED(texture);
- Q_UNUSED(type);
- Q_UNUSED(coords);
- QOPENGL_DEPRECATEDFUNCTION;
-}
-
-inline void QOpenGLFunctions_4_2_Core::glMultiTexCoordP1uiv(GLenum texture, GLenum type, const GLuint *coords)
-{
- Q_UNUSED(texture);
- Q_UNUSED(type);
- Q_UNUSED(coords);
- QOPENGL_DEPRECATEDFUNCTION;
-}
-
-inline void QOpenGLFunctions_4_2_Core::glMultiTexCoordP1ui(GLenum texture, GLenum type, GLuint coords)
-{
- Q_UNUSED(texture);
- Q_UNUSED(type);
- Q_UNUSED(coords);
- QOPENGL_DEPRECATEDFUNCTION;
-}
-
-inline void QOpenGLFunctions_4_2_Core::glTexCoordP4uiv(GLenum type, const GLuint *coords)
-{
- Q_UNUSED(type);
- Q_UNUSED(coords);
- QOPENGL_DEPRECATEDFUNCTION;
-}
-
-inline void QOpenGLFunctions_4_2_Core::glTexCoordP4ui(GLenum type, GLuint coords)
-{
- Q_UNUSED(type);
- Q_UNUSED(coords);
- QOPENGL_DEPRECATEDFUNCTION;
-}
-
-inline void QOpenGLFunctions_4_2_Core::glTexCoordP3uiv(GLenum type, const GLuint *coords)
-{
- Q_UNUSED(type);
- Q_UNUSED(coords);
- QOPENGL_DEPRECATEDFUNCTION;
-}
-
-inline void QOpenGLFunctions_4_2_Core::glTexCoordP3ui(GLenum type, GLuint coords)
-{
- Q_UNUSED(type);
- Q_UNUSED(coords);
- QOPENGL_DEPRECATEDFUNCTION;
-}
-
-inline void QOpenGLFunctions_4_2_Core::glTexCoordP2uiv(GLenum type, const GLuint *coords)
-{
- Q_UNUSED(type);
- Q_UNUSED(coords);
- QOPENGL_DEPRECATEDFUNCTION;
-}
-
-inline void QOpenGLFunctions_4_2_Core::glTexCoordP2ui(GLenum type, GLuint coords)
-{
- Q_UNUSED(type);
- Q_UNUSED(coords);
- QOPENGL_DEPRECATEDFUNCTION;
-}
-
-inline void QOpenGLFunctions_4_2_Core::glTexCoordP1uiv(GLenum type, const GLuint *coords)
-{
- Q_UNUSED(type);
- Q_UNUSED(coords);
- QOPENGL_DEPRECATEDFUNCTION;
-}
-
-inline void QOpenGLFunctions_4_2_Core::glTexCoordP1ui(GLenum type, GLuint coords)
-{
- Q_UNUSED(type);
- Q_UNUSED(coords);
- QOPENGL_DEPRECATEDFUNCTION;
-}
-
-inline void QOpenGLFunctions_4_2_Core::glVertexP4uiv(GLenum type, const GLuint *value)
-{
- Q_UNUSED(type);
- Q_UNUSED(value);
- QOPENGL_DEPRECATEDFUNCTION;
-}
-
-inline void QOpenGLFunctions_4_2_Core::glVertexP4ui(GLenum type, GLuint value)
-{
- Q_UNUSED(type);
- Q_UNUSED(value);
- QOPENGL_DEPRECATEDFUNCTION;
-}
-
-inline void QOpenGLFunctions_4_2_Core::glVertexP3uiv(GLenum type, const GLuint *value)
-{
- Q_UNUSED(type);
- Q_UNUSED(value);
- QOPENGL_DEPRECATEDFUNCTION;
-}
-
-inline void QOpenGLFunctions_4_2_Core::glVertexP3ui(GLenum type, GLuint value)
-{
- Q_UNUSED(type);
- Q_UNUSED(value);
- QOPENGL_DEPRECATEDFUNCTION;
-}
-
-inline void QOpenGLFunctions_4_2_Core::glVertexP2uiv(GLenum type, const GLuint *value)
-{
- Q_UNUSED(type);
- Q_UNUSED(value);
- QOPENGL_DEPRECATEDFUNCTION;
-}
-
-inline void QOpenGLFunctions_4_2_Core::glVertexP2ui(GLenum type, GLuint value)
-{
- Q_UNUSED(type);
- Q_UNUSED(value);
- QOPENGL_DEPRECATEDFUNCTION;
-}
-
-inline void QOpenGLFunctions_4_2_Core::glGetQueryObjectui64v(GLuint id, GLenum pname, GLuint64 *params)
-{
- d_3_3_Core->f.GetQueryObjectui64v(id, pname, params);
-}
-
-inline void QOpenGLFunctions_4_2_Core::glGetQueryObjecti64v(GLuint id, GLenum pname, GLint64 *params)
-{
- d_3_3_Core->f.GetQueryObjecti64v(id, pname, params);
-}
-
-inline void QOpenGLFunctions_4_2_Core::glQueryCounter(GLuint id, GLenum target)
-{
- d_3_3_Core->f.QueryCounter(id, target);
-}
-
-inline void QOpenGLFunctions_4_2_Core::glGetSamplerParameterIuiv(GLuint sampler, GLenum pname, GLuint *params)
-{
- d_3_3_Core->f.GetSamplerParameterIuiv(sampler, pname, params);
-}
-
-inline void QOpenGLFunctions_4_2_Core::glGetSamplerParameterfv(GLuint sampler, GLenum pname, GLfloat *params)
-{
- d_3_3_Core->f.GetSamplerParameterfv(sampler, pname, params);
-}
-
-inline void QOpenGLFunctions_4_2_Core::glGetSamplerParameterIiv(GLuint sampler, GLenum pname, GLint *params)
-{
- d_3_3_Core->f.GetSamplerParameterIiv(sampler, pname, params);
-}
-
-inline void QOpenGLFunctions_4_2_Core::glGetSamplerParameteriv(GLuint sampler, GLenum pname, GLint *params)
-{
- d_3_3_Core->f.GetSamplerParameteriv(sampler, pname, params);
-}
-
-inline void QOpenGLFunctions_4_2_Core::glSamplerParameterIuiv(GLuint sampler, GLenum pname, const GLuint *param)
-{
- d_3_3_Core->f.SamplerParameterIuiv(sampler, pname, param);
-}
-
-inline void QOpenGLFunctions_4_2_Core::glSamplerParameterIiv(GLuint sampler, GLenum pname, const GLint *param)
-{
- d_3_3_Core->f.SamplerParameterIiv(sampler, pname, param);
-}
-
-inline void QOpenGLFunctions_4_2_Core::glSamplerParameterfv(GLuint sampler, GLenum pname, const GLfloat *param)
-{
- d_3_3_Core->f.SamplerParameterfv(sampler, pname, param);
-}
-
-inline void QOpenGLFunctions_4_2_Core::glSamplerParameterf(GLuint sampler, GLenum pname, GLfloat param)
-{
- d_3_3_Core->f.SamplerParameterf(sampler, pname, param);
-}
-
-inline void QOpenGLFunctions_4_2_Core::glSamplerParameteriv(GLuint sampler, GLenum pname, const GLint *param)
-{
- d_3_3_Core->f.SamplerParameteriv(sampler, pname, param);
-}
-
-inline void QOpenGLFunctions_4_2_Core::glSamplerParameteri(GLuint sampler, GLenum pname, GLint param)
-{
- d_3_3_Core->f.SamplerParameteri(sampler, pname, param);
-}
-
-inline void QOpenGLFunctions_4_2_Core::glBindSampler(GLuint unit, GLuint sampler)
-{
- d_3_3_Core->f.BindSampler(unit, sampler);
-}
-
-inline GLboolean QOpenGLFunctions_4_2_Core::glIsSampler(GLuint sampler)
-{
- return d_3_3_Core->f.IsSampler(sampler);
-}
-
-inline void QOpenGLFunctions_4_2_Core::glDeleteSamplers(GLsizei count, const GLuint *samplers)
-{
- d_3_3_Core->f.DeleteSamplers(count, samplers);
-}
-
-inline void QOpenGLFunctions_4_2_Core::glGenSamplers(GLsizei count, GLuint *samplers)
-{
- d_3_3_Core->f.GenSamplers(count, samplers);
-}
-
-inline GLint QOpenGLFunctions_4_2_Core::glGetFragDataIndex(GLuint program, const GLchar *name)
-{
- return d_3_3_Core->f.GetFragDataIndex(program, name);
-}
-
-inline void QOpenGLFunctions_4_2_Core::glBindFragDataLocationIndexed(GLuint program, GLuint colorNumber, GLuint index, const GLchar *name)
-{
- d_3_3_Core->f.BindFragDataLocationIndexed(program, colorNumber, index, name);
-}
-
-inline void QOpenGLFunctions_4_2_Core::glVertexAttribDivisor(GLuint index, GLuint divisor)
-{
- d_3_3_Core->f.VertexAttribDivisor(index, divisor);
-}
-
-
-// OpenGL 4.0 core functions
-inline void QOpenGLFunctions_4_2_Core::glGetQueryIndexediv(GLenum target, GLuint index, GLenum pname, GLint *params)
-{
- d_4_0_Core->f.GetQueryIndexediv(target, index, pname, params);
-}
-
-inline void QOpenGLFunctions_4_2_Core::glEndQueryIndexed(GLenum target, GLuint index)
-{
- d_4_0_Core->f.EndQueryIndexed(target, index);
-}
-
-inline void QOpenGLFunctions_4_2_Core::glBeginQueryIndexed(GLenum target, GLuint index, GLuint id)
-{
- d_4_0_Core->f.BeginQueryIndexed(target, index, id);
-}
-
-inline void QOpenGLFunctions_4_2_Core::glDrawTransformFeedbackStream(GLenum mode, GLuint id, GLuint stream)
-{
- d_4_0_Core->f.DrawTransformFeedbackStream(mode, id, stream);
-}
-
-inline void QOpenGLFunctions_4_2_Core::glDrawTransformFeedback(GLenum mode, GLuint id)
-{
- d_4_0_Core->f.DrawTransformFeedback(mode, id);
-}
-
-inline void QOpenGLFunctions_4_2_Core::glResumeTransformFeedback()
-{
- d_4_0_Core->f.ResumeTransformFeedback();
-}
-
-inline void QOpenGLFunctions_4_2_Core::glPauseTransformFeedback()
-{
- d_4_0_Core->f.PauseTransformFeedback();
-}
-
-inline GLboolean QOpenGLFunctions_4_2_Core::glIsTransformFeedback(GLuint id)
-{
- return d_4_0_Core->f.IsTransformFeedback(id);
-}
-
-inline void QOpenGLFunctions_4_2_Core::glGenTransformFeedbacks(GLsizei n, GLuint *ids)
-{
- d_4_0_Core->f.GenTransformFeedbacks(n, ids);
-}
-
-inline void QOpenGLFunctions_4_2_Core::glDeleteTransformFeedbacks(GLsizei n, const GLuint *ids)
-{
- d_4_0_Core->f.DeleteTransformFeedbacks(n, ids);
-}
-
-inline void QOpenGLFunctions_4_2_Core::glBindTransformFeedback(GLenum target, GLuint id)
-{
- d_4_0_Core->f.BindTransformFeedback(target, id);
-}
-
-inline void QOpenGLFunctions_4_2_Core::glPatchParameterfv(GLenum pname, const GLfloat *values)
-{
- d_4_0_Core->f.PatchParameterfv(pname, values);
-}
-
-inline void QOpenGLFunctions_4_2_Core::glPatchParameteri(GLenum pname, GLint value)
-{
- d_4_0_Core->f.PatchParameteri(pname, value);
-}
-
-inline void QOpenGLFunctions_4_2_Core::glGetProgramStageiv(GLuint program, GLenum shadertype, GLenum pname, GLint *values)
-{
- d_4_0_Core->f.GetProgramStageiv(program, shadertype, pname, values);
-}
-
-inline void QOpenGLFunctions_4_2_Core::glGetUniformSubroutineuiv(GLenum shadertype, GLint location, GLuint *params)
-{
- d_4_0_Core->f.GetUniformSubroutineuiv(shadertype, location, params);
-}
-
-inline void QOpenGLFunctions_4_2_Core::glUniformSubroutinesuiv(GLenum shadertype, GLsizei count, const GLuint *indices)
-{
- d_4_0_Core->f.UniformSubroutinesuiv(shadertype, count, indices);
-}
-
-inline void QOpenGLFunctions_4_2_Core::glGetActiveSubroutineName(GLuint program, GLenum shadertype, GLuint index, GLsizei bufsize, GLsizei *length, GLchar *name)
-{
- d_4_0_Core->f.GetActiveSubroutineName(program, shadertype, index, bufsize, length, name);
-}
-
-inline void QOpenGLFunctions_4_2_Core::glGetActiveSubroutineUniformName(GLuint program, GLenum shadertype, GLuint index, GLsizei bufsize, GLsizei *length, GLchar *name)
-{
- d_4_0_Core->f.GetActiveSubroutineUniformName(program, shadertype, index, bufsize, length, name);
-}
-
-inline void QOpenGLFunctions_4_2_Core::glGetActiveSubroutineUniformiv(GLuint program, GLenum shadertype, GLuint index, GLenum pname, GLint *values)
-{
- d_4_0_Core->f.GetActiveSubroutineUniformiv(program, shadertype, index, pname, values);
-}
-
-inline GLuint QOpenGLFunctions_4_2_Core::glGetSubroutineIndex(GLuint program, GLenum shadertype, const GLchar *name)
-{
- return d_4_0_Core->f.GetSubroutineIndex(program, shadertype, name);
-}
-
-inline GLint QOpenGLFunctions_4_2_Core::glGetSubroutineUniformLocation(GLuint program, GLenum shadertype, const GLchar *name)
-{
- return d_4_0_Core->f.GetSubroutineUniformLocation(program, shadertype, name);
-}
-
-inline void QOpenGLFunctions_4_2_Core::glGetUniformdv(GLuint program, GLint location, GLdouble *params)
-{
- d_4_0_Core->f.GetUniformdv(program, location, params);
-}
-
-inline void QOpenGLFunctions_4_2_Core::glUniformMatrix4x3dv(GLint location, GLsizei count, GLboolean transpose, const GLdouble *value)
-{
- d_4_0_Core->f.UniformMatrix4x3dv(location, count, transpose, value);
-}
-
-inline void QOpenGLFunctions_4_2_Core::glUniformMatrix4x2dv(GLint location, GLsizei count, GLboolean transpose, const GLdouble *value)
-{
- d_4_0_Core->f.UniformMatrix4x2dv(location, count, transpose, value);
-}
-
-inline void QOpenGLFunctions_4_2_Core::glUniformMatrix3x4dv(GLint location, GLsizei count, GLboolean transpose, const GLdouble *value)
-{
- d_4_0_Core->f.UniformMatrix3x4dv(location, count, transpose, value);
-}
-
-inline void QOpenGLFunctions_4_2_Core::glUniformMatrix3x2dv(GLint location, GLsizei count, GLboolean transpose, const GLdouble *value)
-{
- d_4_0_Core->f.UniformMatrix3x2dv(location, count, transpose, value);
-}
-
-inline void QOpenGLFunctions_4_2_Core::glUniformMatrix2x4dv(GLint location, GLsizei count, GLboolean transpose, const GLdouble *value)
-{
- d_4_0_Core->f.UniformMatrix2x4dv(location, count, transpose, value);
-}
-
-inline void QOpenGLFunctions_4_2_Core::glUniformMatrix2x3dv(GLint location, GLsizei count, GLboolean transpose, const GLdouble *value)
-{
- d_4_0_Core->f.UniformMatrix2x3dv(location, count, transpose, value);
-}
-
-inline void QOpenGLFunctions_4_2_Core::glUniformMatrix4dv(GLint location, GLsizei count, GLboolean transpose, const GLdouble *value)
-{
- d_4_0_Core->f.UniformMatrix4dv(location, count, transpose, value);
-}
-
-inline void QOpenGLFunctions_4_2_Core::glUniformMatrix3dv(GLint location, GLsizei count, GLboolean transpose, const GLdouble *value)
-{
- d_4_0_Core->f.UniformMatrix3dv(location, count, transpose, value);
-}
-
-inline void QOpenGLFunctions_4_2_Core::glUniformMatrix2dv(GLint location, GLsizei count, GLboolean transpose, const GLdouble *value)
-{
- d_4_0_Core->f.UniformMatrix2dv(location, count, transpose, value);
-}
-
-inline void QOpenGLFunctions_4_2_Core::glUniform4dv(GLint location, GLsizei count, const GLdouble *value)
-{
- d_4_0_Core->f.Uniform4dv(location, count, value);
-}
-
-inline void QOpenGLFunctions_4_2_Core::glUniform3dv(GLint location, GLsizei count, const GLdouble *value)
-{
- d_4_0_Core->f.Uniform3dv(location, count, value);
-}
-
-inline void QOpenGLFunctions_4_2_Core::glUniform2dv(GLint location, GLsizei count, const GLdouble *value)
-{
- d_4_0_Core->f.Uniform2dv(location, count, value);
-}
-
-inline void QOpenGLFunctions_4_2_Core::glUniform1dv(GLint location, GLsizei count, const GLdouble *value)
-{
- d_4_0_Core->f.Uniform1dv(location, count, value);
-}
-
-inline void QOpenGLFunctions_4_2_Core::glUniform4d(GLint location, GLdouble x, GLdouble y, GLdouble z, GLdouble w)
-{
- d_4_0_Core->f.Uniform4d(location, x, y, z, w);
-}
-
-inline void QOpenGLFunctions_4_2_Core::glUniform3d(GLint location, GLdouble x, GLdouble y, GLdouble z)
-{
- d_4_0_Core->f.Uniform3d(location, x, y, z);
-}
-
-inline void QOpenGLFunctions_4_2_Core::glUniform2d(GLint location, GLdouble x, GLdouble y)
-{
- d_4_0_Core->f.Uniform2d(location, x, y);
-}
-
-inline void QOpenGLFunctions_4_2_Core::glUniform1d(GLint location, GLdouble x)
-{
- d_4_0_Core->f.Uniform1d(location, x);
-}
-
-inline void QOpenGLFunctions_4_2_Core::glDrawElementsIndirect(GLenum mode, GLenum type, const GLvoid *indirect)
-{
- d_4_0_Core->f.DrawElementsIndirect(mode, type, indirect);
-}
-
-inline void QOpenGLFunctions_4_2_Core::glDrawArraysIndirect(GLenum mode, const GLvoid *indirect)
-{
- d_4_0_Core->f.DrawArraysIndirect(mode, indirect);
-}
-
-inline void QOpenGLFunctions_4_2_Core::glBlendFuncSeparatei(GLuint buf, GLenum srcRGB, GLenum dstRGB, GLenum srcAlpha, GLenum dstAlpha)
-{
- d_4_0_Core->f.BlendFuncSeparatei(buf, srcRGB, dstRGB, srcAlpha, dstAlpha);
-}
-
-inline void QOpenGLFunctions_4_2_Core::glBlendFunci(GLuint buf, GLenum src, GLenum dst)
-{
- d_4_0_Core->f.BlendFunci(buf, src, dst);
-}
-
-inline void QOpenGLFunctions_4_2_Core::glBlendEquationSeparatei(GLuint buf, GLenum modeRGB, GLenum modeAlpha)
-{
- d_4_0_Core->f.BlendEquationSeparatei(buf, modeRGB, modeAlpha);
-}
-
-inline void QOpenGLFunctions_4_2_Core::glBlendEquationi(GLuint buf, GLenum mode)
-{
- d_4_0_Core->f.BlendEquationi(buf, mode);
-}
-
-inline void QOpenGLFunctions_4_2_Core::glMinSampleShading(GLfloat value)
-{
- d_4_0_Core->f.MinSampleShading(value);
-}
-
-
-// OpenGL 4.1 core functions
-inline void QOpenGLFunctions_4_2_Core::glGetDoublei_v(GLenum target, GLuint index, GLdouble *data)
-{
- d_4_1_Core->f.GetDoublei_v(target, index, data);
-}
-
-inline void QOpenGLFunctions_4_2_Core::glGetFloati_v(GLenum target, GLuint index, GLfloat *data)
-{
- d_4_1_Core->f.GetFloati_v(target, index, data);
-}
-
-inline void QOpenGLFunctions_4_2_Core::glDepthRangeIndexed(GLuint index, GLdouble n, GLdouble f)
-{
- d_4_1_Core->f.DepthRangeIndexed(index, n, f);
-}
-
-inline void QOpenGLFunctions_4_2_Core::glDepthRangeArrayv(GLuint first, GLsizei count, const GLdouble *v)
-{
- d_4_1_Core->f.DepthRangeArrayv(first, count, v);
-}
-
-inline void QOpenGLFunctions_4_2_Core::glScissorIndexedv(GLuint index, const GLint *v)
-{
- d_4_1_Core->f.ScissorIndexedv(index, v);
-}
-
-inline void QOpenGLFunctions_4_2_Core::glScissorIndexed(GLuint index, GLint left, GLint bottom, GLsizei width, GLsizei height)
-{
- d_4_1_Core->f.ScissorIndexed(index, left, bottom, width, height);
-}
-
-inline void QOpenGLFunctions_4_2_Core::glScissorArrayv(GLuint first, GLsizei count, const GLint *v)
-{
- d_4_1_Core->f.ScissorArrayv(first, count, v);
-}
-
-inline void QOpenGLFunctions_4_2_Core::glViewportIndexedfv(GLuint index, const GLfloat *v)
-{
- d_4_1_Core->f.ViewportIndexedfv(index, v);
-}
-
-inline void QOpenGLFunctions_4_2_Core::glViewportIndexedf(GLuint index, GLfloat x, GLfloat y, GLfloat w, GLfloat h)
-{
- d_4_1_Core->f.ViewportIndexedf(index, x, y, w, h);
-}
-
-inline void QOpenGLFunctions_4_2_Core::glViewportArrayv(GLuint first, GLsizei count, const GLfloat *v)
-{
- d_4_1_Core->f.ViewportArrayv(first, count, v);
-}
-
-inline void QOpenGLFunctions_4_2_Core::glGetVertexAttribLdv(GLuint index, GLenum pname, GLdouble *params)
-{
- d_4_1_Core->f.GetVertexAttribLdv(index, pname, params);
-}
-
-inline void QOpenGLFunctions_4_2_Core::glVertexAttribLPointer(GLuint index, GLint size, GLenum type, GLsizei stride, const GLvoid *pointer)
-{
- d_4_1_Core->f.VertexAttribLPointer(index, size, type, stride, pointer);
-}
-
-inline void QOpenGLFunctions_4_2_Core::glVertexAttribL4dv(GLuint index, const GLdouble *v)
-{
- d_4_1_Core->f.VertexAttribL4dv(index, v);
-}
-
-inline void QOpenGLFunctions_4_2_Core::glVertexAttribL3dv(GLuint index, const GLdouble *v)
-{
- d_4_1_Core->f.VertexAttribL3dv(index, v);
-}
-
-inline void QOpenGLFunctions_4_2_Core::glVertexAttribL2dv(GLuint index, const GLdouble *v)
-{
- d_4_1_Core->f.VertexAttribL2dv(index, v);
-}
-
-inline void QOpenGLFunctions_4_2_Core::glVertexAttribL1dv(GLuint index, const GLdouble *v)
-{
- d_4_1_Core->f.VertexAttribL1dv(index, v);
-}
-
-inline void QOpenGLFunctions_4_2_Core::glVertexAttribL4d(GLuint index, GLdouble x, GLdouble y, GLdouble z, GLdouble w)
-{
- d_4_1_Core->f.VertexAttribL4d(index, x, y, z, w);
-}
-
-inline void QOpenGLFunctions_4_2_Core::glVertexAttribL3d(GLuint index, GLdouble x, GLdouble y, GLdouble z)
-{
- d_4_1_Core->f.VertexAttribL3d(index, x, y, z);
-}
-
-inline void QOpenGLFunctions_4_2_Core::glVertexAttribL2d(GLuint index, GLdouble x, GLdouble y)
-{
- d_4_1_Core->f.VertexAttribL2d(index, x, y);
-}
-
-inline void QOpenGLFunctions_4_2_Core::glVertexAttribL1d(GLuint index, GLdouble x)
-{
- d_4_1_Core->f.VertexAttribL1d(index, x);
-}
-
-inline void QOpenGLFunctions_4_2_Core::glGetProgramPipelineInfoLog(GLuint pipeline, GLsizei bufSize, GLsizei *length, GLchar *infoLog)
-{
- d_4_1_Core->f.GetProgramPipelineInfoLog(pipeline, bufSize, length, infoLog);
-}
-
-inline void QOpenGLFunctions_4_2_Core::glValidateProgramPipeline(GLuint pipeline)
-{
- d_4_1_Core->f.ValidateProgramPipeline(pipeline);
-}
-
-inline void QOpenGLFunctions_4_2_Core::glProgramUniformMatrix4x3dv(GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLdouble *value)
-{
- d_4_1_Core->f.ProgramUniformMatrix4x3dv(program, location, count, transpose, value);
-}
-
-inline void QOpenGLFunctions_4_2_Core::glProgramUniformMatrix3x4dv(GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLdouble *value)
-{
- d_4_1_Core->f.ProgramUniformMatrix3x4dv(program, location, count, transpose, value);
-}
-
-inline void QOpenGLFunctions_4_2_Core::glProgramUniformMatrix4x2dv(GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLdouble *value)
-{
- d_4_1_Core->f.ProgramUniformMatrix4x2dv(program, location, count, transpose, value);
-}
-
-inline void QOpenGLFunctions_4_2_Core::glProgramUniformMatrix2x4dv(GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLdouble *value)
-{
- d_4_1_Core->f.ProgramUniformMatrix2x4dv(program, location, count, transpose, value);
-}
-
-inline void QOpenGLFunctions_4_2_Core::glProgramUniformMatrix3x2dv(GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLdouble *value)
-{
- d_4_1_Core->f.ProgramUniformMatrix3x2dv(program, location, count, transpose, value);
-}
-
-inline void QOpenGLFunctions_4_2_Core::glProgramUniformMatrix2x3dv(GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLdouble *value)
-{
- d_4_1_Core->f.ProgramUniformMatrix2x3dv(program, location, count, transpose, value);
-}
-
-inline void QOpenGLFunctions_4_2_Core::glProgramUniformMatrix4x3fv(GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value)
-{
- d_4_1_Core->f.ProgramUniformMatrix4x3fv(program, location, count, transpose, value);
-}
-
-inline void QOpenGLFunctions_4_2_Core::glProgramUniformMatrix3x4fv(GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value)
-{
- d_4_1_Core->f.ProgramUniformMatrix3x4fv(program, location, count, transpose, value);
-}
-
-inline void QOpenGLFunctions_4_2_Core::glProgramUniformMatrix4x2fv(GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value)
-{
- d_4_1_Core->f.ProgramUniformMatrix4x2fv(program, location, count, transpose, value);
-}
-
-inline void QOpenGLFunctions_4_2_Core::glProgramUniformMatrix2x4fv(GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value)
-{
- d_4_1_Core->f.ProgramUniformMatrix2x4fv(program, location, count, transpose, value);
-}
-
-inline void QOpenGLFunctions_4_2_Core::glProgramUniformMatrix3x2fv(GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value)
-{
- d_4_1_Core->f.ProgramUniformMatrix3x2fv(program, location, count, transpose, value);
-}
-
-inline void QOpenGLFunctions_4_2_Core::glProgramUniformMatrix2x3fv(GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value)
-{
- d_4_1_Core->f.ProgramUniformMatrix2x3fv(program, location, count, transpose, value);
-}
-
-inline void QOpenGLFunctions_4_2_Core::glProgramUniformMatrix4dv(GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLdouble *value)
-{
- d_4_1_Core->f.ProgramUniformMatrix4dv(program, location, count, transpose, value);
-}
-
-inline void QOpenGLFunctions_4_2_Core::glProgramUniformMatrix3dv(GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLdouble *value)
-{
- d_4_1_Core->f.ProgramUniformMatrix3dv(program, location, count, transpose, value);
-}
-
-inline void QOpenGLFunctions_4_2_Core::glProgramUniformMatrix2dv(GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLdouble *value)
-{
- d_4_1_Core->f.ProgramUniformMatrix2dv(program, location, count, transpose, value);
-}
-
-inline void QOpenGLFunctions_4_2_Core::glProgramUniformMatrix4fv(GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value)
-{
- d_4_1_Core->f.ProgramUniformMatrix4fv(program, location, count, transpose, value);
-}
-
-inline void QOpenGLFunctions_4_2_Core::glProgramUniformMatrix3fv(GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value)
-{
- d_4_1_Core->f.ProgramUniformMatrix3fv(program, location, count, transpose, value);
-}
-
-inline void QOpenGLFunctions_4_2_Core::glProgramUniformMatrix2fv(GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value)
-{
- d_4_1_Core->f.ProgramUniformMatrix2fv(program, location, count, transpose, value);
-}
-
-inline void QOpenGLFunctions_4_2_Core::glProgramUniform4uiv(GLuint program, GLint location, GLsizei count, const GLuint *value)
-{
- d_4_1_Core->f.ProgramUniform4uiv(program, location, count, value);
-}
-
-inline void QOpenGLFunctions_4_2_Core::glProgramUniform4ui(GLuint program, GLint location, GLuint v0, GLuint v1, GLuint v2, GLuint v3)
-{
- d_4_1_Core->f.ProgramUniform4ui(program, location, v0, v1, v2, v3);
-}
-
-inline void QOpenGLFunctions_4_2_Core::glProgramUniform4dv(GLuint program, GLint location, GLsizei count, const GLdouble *value)
-{
- d_4_1_Core->f.ProgramUniform4dv(program, location, count, value);
-}
-
-inline void QOpenGLFunctions_4_2_Core::glProgramUniform4d(GLuint program, GLint location, GLdouble v0, GLdouble v1, GLdouble v2, GLdouble v3)
-{
- d_4_1_Core->f.ProgramUniform4d(program, location, v0, v1, v2, v3);
-}
-
-inline void QOpenGLFunctions_4_2_Core::glProgramUniform4fv(GLuint program, GLint location, GLsizei count, const GLfloat *value)
-{
- d_4_1_Core->f.ProgramUniform4fv(program, location, count, value);
-}
-
-inline void QOpenGLFunctions_4_2_Core::glProgramUniform4f(GLuint program, GLint location, GLfloat v0, GLfloat v1, GLfloat v2, GLfloat v3)
-{
- d_4_1_Core->f.ProgramUniform4f(program, location, v0, v1, v2, v3);
-}
-
-inline void QOpenGLFunctions_4_2_Core::glProgramUniform4iv(GLuint program, GLint location, GLsizei count, const GLint *value)
-{
- d_4_1_Core->f.ProgramUniform4iv(program, location, count, value);
-}
-
-inline void QOpenGLFunctions_4_2_Core::glProgramUniform4i(GLuint program, GLint location, GLint v0, GLint v1, GLint v2, GLint v3)
-{
- d_4_1_Core->f.ProgramUniform4i(program, location, v0, v1, v2, v3);
-}
-
-inline void QOpenGLFunctions_4_2_Core::glProgramUniform3uiv(GLuint program, GLint location, GLsizei count, const GLuint *value)
-{
- d_4_1_Core->f.ProgramUniform3uiv(program, location, count, value);
-}
-
-inline void QOpenGLFunctions_4_2_Core::glProgramUniform3ui(GLuint program, GLint location, GLuint v0, GLuint v1, GLuint v2)
-{
- d_4_1_Core->f.ProgramUniform3ui(program, location, v0, v1, v2);
-}
-
-inline void QOpenGLFunctions_4_2_Core::glProgramUniform3dv(GLuint program, GLint location, GLsizei count, const GLdouble *value)
-{
- d_4_1_Core->f.ProgramUniform3dv(program, location, count, value);
-}
-
-inline void QOpenGLFunctions_4_2_Core::glProgramUniform3d(GLuint program, GLint location, GLdouble v0, GLdouble v1, GLdouble v2)
-{
- d_4_1_Core->f.ProgramUniform3d(program, location, v0, v1, v2);
-}
-
-inline void QOpenGLFunctions_4_2_Core::glProgramUniform3fv(GLuint program, GLint location, GLsizei count, const GLfloat *value)
-{
- d_4_1_Core->f.ProgramUniform3fv(program, location, count, value);
-}
-
-inline void QOpenGLFunctions_4_2_Core::glProgramUniform3f(GLuint program, GLint location, GLfloat v0, GLfloat v1, GLfloat v2)
-{
- d_4_1_Core->f.ProgramUniform3f(program, location, v0, v1, v2);
-}
-
-inline void QOpenGLFunctions_4_2_Core::glProgramUniform3iv(GLuint program, GLint location, GLsizei count, const GLint *value)
-{
- d_4_1_Core->f.ProgramUniform3iv(program, location, count, value);
-}
-
-inline void QOpenGLFunctions_4_2_Core::glProgramUniform3i(GLuint program, GLint location, GLint v0, GLint v1, GLint v2)
-{
- d_4_1_Core->f.ProgramUniform3i(program, location, v0, v1, v2);
-}
-
-inline void QOpenGLFunctions_4_2_Core::glProgramUniform2uiv(GLuint program, GLint location, GLsizei count, const GLuint *value)
-{
- d_4_1_Core->f.ProgramUniform2uiv(program, location, count, value);
-}
-
-inline void QOpenGLFunctions_4_2_Core::glProgramUniform2ui(GLuint program, GLint location, GLuint v0, GLuint v1)
-{
- d_4_1_Core->f.ProgramUniform2ui(program, location, v0, v1);
-}
-
-inline void QOpenGLFunctions_4_2_Core::glProgramUniform2dv(GLuint program, GLint location, GLsizei count, const GLdouble *value)
-{
- d_4_1_Core->f.ProgramUniform2dv(program, location, count, value);
-}
-
-inline void QOpenGLFunctions_4_2_Core::glProgramUniform2d(GLuint program, GLint location, GLdouble v0, GLdouble v1)
-{
- d_4_1_Core->f.ProgramUniform2d(program, location, v0, v1);
-}
-
-inline void QOpenGLFunctions_4_2_Core::glProgramUniform2fv(GLuint program, GLint location, GLsizei count, const GLfloat *value)
-{
- d_4_1_Core->f.ProgramUniform2fv(program, location, count, value);
-}
-
-inline void QOpenGLFunctions_4_2_Core::glProgramUniform2f(GLuint program, GLint location, GLfloat v0, GLfloat v1)
-{
- d_4_1_Core->f.ProgramUniform2f(program, location, v0, v1);
-}
-
-inline void QOpenGLFunctions_4_2_Core::glProgramUniform2iv(GLuint program, GLint location, GLsizei count, const GLint *value)
-{
- d_4_1_Core->f.ProgramUniform2iv(program, location, count, value);
-}
-
-inline void QOpenGLFunctions_4_2_Core::glProgramUniform2i(GLuint program, GLint location, GLint v0, GLint v1)
-{
- d_4_1_Core->f.ProgramUniform2i(program, location, v0, v1);
-}
-
-inline void QOpenGLFunctions_4_2_Core::glProgramUniform1uiv(GLuint program, GLint location, GLsizei count, const GLuint *value)
-{
- d_4_1_Core->f.ProgramUniform1uiv(program, location, count, value);
-}
-
-inline void QOpenGLFunctions_4_2_Core::glProgramUniform1ui(GLuint program, GLint location, GLuint v0)
-{
- d_4_1_Core->f.ProgramUniform1ui(program, location, v0);
-}
-
-inline void QOpenGLFunctions_4_2_Core::glProgramUniform1dv(GLuint program, GLint location, GLsizei count, const GLdouble *value)
-{
- d_4_1_Core->f.ProgramUniform1dv(program, location, count, value);
-}
-
-inline void QOpenGLFunctions_4_2_Core::glProgramUniform1d(GLuint program, GLint location, GLdouble v0)
-{
- d_4_1_Core->f.ProgramUniform1d(program, location, v0);
-}
-
-inline void QOpenGLFunctions_4_2_Core::glProgramUniform1fv(GLuint program, GLint location, GLsizei count, const GLfloat *value)
-{
- d_4_1_Core->f.ProgramUniform1fv(program, location, count, value);
-}
-
-inline void QOpenGLFunctions_4_2_Core::glProgramUniform1f(GLuint program, GLint location, GLfloat v0)
-{
- d_4_1_Core->f.ProgramUniform1f(program, location, v0);
-}
-
-inline void QOpenGLFunctions_4_2_Core::glProgramUniform1iv(GLuint program, GLint location, GLsizei count, const GLint *value)
-{
- d_4_1_Core->f.ProgramUniform1iv(program, location, count, value);
-}
-
-inline void QOpenGLFunctions_4_2_Core::glProgramUniform1i(GLuint program, GLint location, GLint v0)
-{
- d_4_1_Core->f.ProgramUniform1i(program, location, v0);
-}
-
-inline void QOpenGLFunctions_4_2_Core::glGetProgramPipelineiv(GLuint pipeline, GLenum pname, GLint *params)
-{
- d_4_1_Core->f.GetProgramPipelineiv(pipeline, pname, params);
-}
-
-inline GLboolean QOpenGLFunctions_4_2_Core::glIsProgramPipeline(GLuint pipeline)
-{
- return d_4_1_Core->f.IsProgramPipeline(pipeline);
-}
-
-inline void QOpenGLFunctions_4_2_Core::glGenProgramPipelines(GLsizei n, GLuint *pipelines)
-{
- d_4_1_Core->f.GenProgramPipelines(n, pipelines);
-}
-
-inline void QOpenGLFunctions_4_2_Core::glDeleteProgramPipelines(GLsizei n, const GLuint *pipelines)
-{
- d_4_1_Core->f.DeleteProgramPipelines(n, pipelines);
-}
-
-inline void QOpenGLFunctions_4_2_Core::glBindProgramPipeline(GLuint pipeline)
-{
- d_4_1_Core->f.BindProgramPipeline(pipeline);
-}
-
-inline GLuint QOpenGLFunctions_4_2_Core::glCreateShaderProgramv(GLenum type, GLsizei count, const GLchar* const *strings)
-{
- return d_4_1_Core->f.CreateShaderProgramv(type, count, strings);
-}
-
-inline void QOpenGLFunctions_4_2_Core::glActiveShaderProgram(GLuint pipeline, GLuint program)
-{
- d_4_1_Core->f.ActiveShaderProgram(pipeline, program);
-}
-
-inline void QOpenGLFunctions_4_2_Core::glUseProgramStages(GLuint pipeline, GLbitfield stages, GLuint program)
-{
- d_4_1_Core->f.UseProgramStages(pipeline, stages, program);
-}
-
-inline void QOpenGLFunctions_4_2_Core::glProgramParameteri(GLuint program, GLenum pname, GLint value)
-{
- d_4_1_Core->f.ProgramParameteri(program, pname, value);
-}
-
-inline void QOpenGLFunctions_4_2_Core::glProgramBinary(GLuint program, GLenum binaryFormat, const GLvoid *binary, GLsizei length)
-{
- d_4_1_Core->f.ProgramBinary(program, binaryFormat, binary, length);
-}
-
-inline void QOpenGLFunctions_4_2_Core::glGetProgramBinary(GLuint program, GLsizei bufSize, GLsizei *length, GLenum *binaryFormat, GLvoid *binary)
-{
- d_4_1_Core->f.GetProgramBinary(program, bufSize, length, binaryFormat, binary);
-}
-
-inline void QOpenGLFunctions_4_2_Core::glClearDepthf(GLfloat dd)
-{
- d_4_1_Core->f.ClearDepthf(dd);
-}
-
-inline void QOpenGLFunctions_4_2_Core::glDepthRangef(GLfloat n, GLfloat f)
-{
- d_4_1_Core->f.DepthRangef(n, f);
-}
-
-inline void QOpenGLFunctions_4_2_Core::glGetShaderPrecisionFormat(GLenum shadertype, GLenum precisiontype, GLint *range, GLint *precision)
-{
- d_4_1_Core->f.GetShaderPrecisionFormat(shadertype, precisiontype, range, precision);
-}
-
-inline void QOpenGLFunctions_4_2_Core::glShaderBinary(GLsizei count, const GLuint *shaders, GLenum binaryformat, const GLvoid *binary, GLsizei length)
-{
- d_4_1_Core->f.ShaderBinary(count, shaders, binaryformat, binary, length);
-}
-
-inline void QOpenGLFunctions_4_2_Core::glReleaseShaderCompiler()
-{
- d_4_1_Core->f.ReleaseShaderCompiler();
-}
-
-
-// OpenGL 4.2 core functions
-inline void QOpenGLFunctions_4_2_Core::glTexStorage3D(GLenum target, GLsizei levels, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth)
-{
- d_4_2_Core->f.TexStorage3D(target, levels, internalformat, width, height, depth);
-}
-
-inline void QOpenGLFunctions_4_2_Core::glTexStorage2D(GLenum target, GLsizei levels, GLenum internalformat, GLsizei width, GLsizei height)
-{
- d_4_2_Core->f.TexStorage2D(target, levels, internalformat, width, height);
-}
-
-inline void QOpenGLFunctions_4_2_Core::glTexStorage1D(GLenum target, GLsizei levels, GLenum internalformat, GLsizei width)
-{
- d_4_2_Core->f.TexStorage1D(target, levels, internalformat, width);
-}
-
-inline void QOpenGLFunctions_4_2_Core::glMemoryBarrier(GLbitfield barriers)
-{
- d_4_2_Core->f.MemoryBarrier(barriers);
-}
-
-inline void QOpenGLFunctions_4_2_Core::glBindImageTexture(GLuint unit, GLuint texture, GLint level, GLboolean layered, GLint layer, GLenum access, GLenum format)
-{
- d_4_2_Core->f.BindImageTexture(unit, texture, level, layered, layer, access, format);
-}
-
-inline void QOpenGLFunctions_4_2_Core::glGetActiveAtomicCounterBufferiv(GLuint program, GLuint bufferIndex, GLenum pname, GLint *params)
-{
- d_4_2_Core->f.GetActiveAtomicCounterBufferiv(program, bufferIndex, pname, params);
-}
-
-inline void QOpenGLFunctions_4_2_Core::glGetInternalformativ(GLenum target, GLenum internalformat, GLenum pname, GLsizei bufSize, GLint *params)
-{
- d_4_2_Core->f.GetInternalformativ(target, internalformat, pname, bufSize, params);
-}
-
-inline void QOpenGLFunctions_4_2_Core::glDrawTransformFeedbackStreamInstanced(GLenum mode, GLuint id, GLuint stream, GLsizei instancecount)
-{
- d_4_2_Core->f.DrawTransformFeedbackStreamInstanced(mode, id, stream, instancecount);
-}
-
-inline void QOpenGLFunctions_4_2_Core::glDrawTransformFeedbackInstanced(GLenum mode, GLuint id, GLsizei instancecount)
-{
- d_4_2_Core->f.DrawTransformFeedbackInstanced(mode, id, instancecount);
-}
-
-inline void QOpenGLFunctions_4_2_Core::glDrawElementsInstancedBaseVertexBaseInstance(GLenum mode, GLsizei count, GLenum type, const void *indices, GLsizei instancecount, GLint basevertex, GLuint baseinstance)
-{
- d_4_2_Core->f.DrawElementsInstancedBaseVertexBaseInstance(mode, count, type, indices, instancecount, basevertex, baseinstance);
-}
-
-inline void QOpenGLFunctions_4_2_Core::glDrawElementsInstancedBaseInstance(GLenum mode, GLsizei count, GLenum type, const void *indices, GLsizei instancecount, GLuint baseinstance)
-{
- d_4_2_Core->f.DrawElementsInstancedBaseInstance(mode, count, type, indices, instancecount, baseinstance);
-}
-
-inline void QOpenGLFunctions_4_2_Core::glDrawArraysInstancedBaseInstance(GLenum mode, GLint first, GLsizei count, GLsizei instancecount, GLuint baseinstance)
-{
- d_4_2_Core->f.DrawArraysInstancedBaseInstance(mode, first, count, instancecount, baseinstance);
-}
-
-
-
-QT_END_NAMESPACE
-
-#ifdef Q_OS_WIN
-#pragma pop_macro("MemoryBarrier")
-#endif
-
-#endif // QT_NO_OPENGL && !QT_OPENGL_ES_2
-
-#endif
diff --git a/src/gui/opengl/qopenglfunctions_4_3_compatibility.cpp b/src/gui/opengl/qopenglfunctions_4_3_compatibility.cpp
deleted file mode 100644
index 1b23d08ee2..0000000000
--- a/src/gui/opengl/qopenglfunctions_4_3_compatibility.cpp
+++ /dev/null
@@ -1,318 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2013 Klaralvdalens Datakonsult AB (KDAB)
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the QtGui module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-**
-** This file was generated by glgen version 0.1
-** Command line was: glgen
-**
-** glgen is Copyright (C) 2013 Klaralvdalens Datakonsult AB (KDAB)
-**
-** This is an auto-generated file.
-** Do not edit! All changes made to it will be lost.
-**
-****************************************************************************/
-
-#include "qopenglfunctions_4_3_compatibility.h"
-#include "qopenglcontext.h"
-
-QT_BEGIN_NAMESPACE
-
-/*!
- \class QOpenGLFunctions_4_3_Compatibility
- \inmodule QtGui
- \since 5.1
- \wrapper
- \brief The QOpenGLFunctions_4_3_Compatibility class provides all functions for OpenGL 4.3 compatibility profile.
-
- This class is a wrapper for functions from OpenGL 4.3 compatibility profile.
- See reference pages on \l {http://www.opengl.org/sdk/docs/}{opengl.org}
- for function documentation.
-
- \sa QAbstractOpenGLFunctions
-*/
-
-QOpenGLFunctions_4_3_Compatibility::QOpenGLFunctions_4_3_Compatibility()
- : QAbstractOpenGLFunctions()
- , d_1_0_Core(nullptr)
- , d_1_1_Core(nullptr)
- , d_1_2_Core(nullptr)
- , d_1_3_Core(nullptr)
- , d_1_4_Core(nullptr)
- , d_1_5_Core(nullptr)
- , d_2_0_Core(nullptr)
- , d_2_1_Core(nullptr)
- , d_3_0_Core(nullptr)
- , d_3_1_Core(nullptr)
- , d_3_2_Core(nullptr)
- , d_3_3_Core(nullptr)
- , d_4_0_Core(nullptr)
- , d_4_1_Core(nullptr)
- , d_4_2_Core(nullptr)
- , d_4_3_Core(nullptr)
- , d_1_0_Deprecated(nullptr)
- , d_1_1_Deprecated(nullptr)
- , d_1_2_Deprecated(nullptr)
- , d_1_3_Deprecated(nullptr)
- , d_1_4_Deprecated(nullptr)
- , m_reserved_2_0_Deprecated(nullptr)
- , d_3_3_Deprecated(nullptr)
-{
-}
-
-QOpenGLFunctions_4_3_Compatibility::~QOpenGLFunctions_4_3_Compatibility()
-{
- if (d_1_0_Core) {
- d_1_0_Core->refs.deref();
- Q_ASSERT(d_1_0_Core->refs.loadRelaxed());
- }
- if (d_1_1_Core) {
- d_1_1_Core->refs.deref();
- Q_ASSERT(d_1_1_Core->refs.loadRelaxed());
- }
- if (d_1_2_Core) {
- d_1_2_Core->refs.deref();
- Q_ASSERT(d_1_2_Core->refs.loadRelaxed());
- }
- if (d_1_3_Core) {
- d_1_3_Core->refs.deref();
- Q_ASSERT(d_1_3_Core->refs.loadRelaxed());
- }
- if (d_1_4_Core) {
- d_1_4_Core->refs.deref();
- Q_ASSERT(d_1_4_Core->refs.loadRelaxed());
- }
- if (d_1_5_Core) {
- d_1_5_Core->refs.deref();
- Q_ASSERT(d_1_5_Core->refs.loadRelaxed());
- }
- if (d_2_0_Core) {
- d_2_0_Core->refs.deref();
- Q_ASSERT(d_2_0_Core->refs.loadRelaxed());
- }
- if (d_2_1_Core) {
- d_2_1_Core->refs.deref();
- Q_ASSERT(d_2_1_Core->refs.loadRelaxed());
- }
- if (d_3_0_Core) {
- d_3_0_Core->refs.deref();
- Q_ASSERT(d_3_0_Core->refs.loadRelaxed());
- }
- if (d_3_1_Core) {
- d_3_1_Core->refs.deref();
- Q_ASSERT(d_3_1_Core->refs.loadRelaxed());
- }
- if (d_3_2_Core) {
- d_3_2_Core->refs.deref();
- Q_ASSERT(d_3_2_Core->refs.loadRelaxed());
- }
- if (d_3_3_Core) {
- d_3_3_Core->refs.deref();
- Q_ASSERT(d_3_3_Core->refs.loadRelaxed());
- }
- if (d_4_0_Core) {
- d_4_0_Core->refs.deref();
- Q_ASSERT(d_4_0_Core->refs.loadRelaxed());
- }
- if (d_4_1_Core) {
- d_4_1_Core->refs.deref();
- Q_ASSERT(d_4_1_Core->refs.loadRelaxed());
- }
- if (d_4_2_Core) {
- d_4_2_Core->refs.deref();
- Q_ASSERT(d_4_2_Core->refs.loadRelaxed());
- }
- if (d_4_3_Core) {
- d_4_3_Core->refs.deref();
- Q_ASSERT(d_4_3_Core->refs.loadRelaxed());
- }
- if (d_1_0_Deprecated) {
- d_1_0_Deprecated->refs.deref();
- Q_ASSERT(d_1_0_Deprecated->refs.loadRelaxed());
- }
- if (d_1_1_Deprecated) {
- d_1_1_Deprecated->refs.deref();
- Q_ASSERT(d_1_1_Deprecated->refs.loadRelaxed());
- }
- if (d_1_2_Deprecated) {
- d_1_2_Deprecated->refs.deref();
- Q_ASSERT(d_1_2_Deprecated->refs.loadRelaxed());
- }
- if (d_1_3_Deprecated) {
- d_1_3_Deprecated->refs.deref();
- Q_ASSERT(d_1_3_Deprecated->refs.loadRelaxed());
- }
- if (d_1_4_Deprecated) {
- d_1_4_Deprecated->refs.deref();
- Q_ASSERT(d_1_4_Deprecated->refs.loadRelaxed());
- }
- if (d_3_3_Deprecated) {
- d_3_3_Deprecated->refs.deref();
- Q_ASSERT(d_3_3_Deprecated->refs.loadRelaxed());
- }
-}
-
-bool QOpenGLFunctions_4_3_Compatibility::initializeOpenGLFunctions()
-{
- if ( isInitialized() )
- return true;
-
- QOpenGLContext* context = QOpenGLContext::currentContext();
-
- // If owned by a context object make sure it is current.
- // Also check that current context is capable of resolving all needed functions
- if (((owningContext() && owningContext() == context) || !owningContext())
- && QOpenGLFunctions_4_3_Compatibility::isContextCompatible(context))
- {
- // Associate with private implementation, creating if necessary
- // Function pointers in the backends are resolved at creation time
- QOpenGLVersionFunctionsBackend* d = nullptr;
- d = QAbstractOpenGLFunctionsPrivate::functionsBackend(context, QOpenGLFunctions_1_0_CoreBackend::versionStatus());
- d_1_0_Core = static_cast<QOpenGLFunctions_1_0_CoreBackend*>(d);
- d->refs.ref();
-
- d = QAbstractOpenGLFunctionsPrivate::functionsBackend(context, QOpenGLFunctions_1_1_CoreBackend::versionStatus());
- d_1_1_Core = static_cast<QOpenGLFunctions_1_1_CoreBackend*>(d);
- d->refs.ref();
-
- d = QAbstractOpenGLFunctionsPrivate::functionsBackend(context, QOpenGLFunctions_1_2_CoreBackend::versionStatus());
- d_1_2_Core = static_cast<QOpenGLFunctions_1_2_CoreBackend*>(d);
- d->refs.ref();
-
- d = QAbstractOpenGLFunctionsPrivate::functionsBackend(context, QOpenGLFunctions_1_3_CoreBackend::versionStatus());
- d_1_3_Core = static_cast<QOpenGLFunctions_1_3_CoreBackend*>(d);
- d->refs.ref();
-
- d = QAbstractOpenGLFunctionsPrivate::functionsBackend(context, QOpenGLFunctions_1_4_CoreBackend::versionStatus());
- d_1_4_Core = static_cast<QOpenGLFunctions_1_4_CoreBackend*>(d);
- d->refs.ref();
-
- d = QAbstractOpenGLFunctionsPrivate::functionsBackend(context, QOpenGLFunctions_1_5_CoreBackend::versionStatus());
- d_1_5_Core = static_cast<QOpenGLFunctions_1_5_CoreBackend*>(d);
- d->refs.ref();
-
- d = QAbstractOpenGLFunctionsPrivate::functionsBackend(context, QOpenGLFunctions_2_0_CoreBackend::versionStatus());
- d_2_0_Core = static_cast<QOpenGLFunctions_2_0_CoreBackend*>(d);
- d->refs.ref();
-
- d = QAbstractOpenGLFunctionsPrivate::functionsBackend(context, QOpenGLFunctions_2_1_CoreBackend::versionStatus());
- d_2_1_Core = static_cast<QOpenGLFunctions_2_1_CoreBackend*>(d);
- d->refs.ref();
-
- d = QAbstractOpenGLFunctionsPrivate::functionsBackend(context, QOpenGLFunctions_3_0_CoreBackend::versionStatus());
- d_3_0_Core = static_cast<QOpenGLFunctions_3_0_CoreBackend*>(d);
- d->refs.ref();
-
- d = QAbstractOpenGLFunctionsPrivate::functionsBackend(context, QOpenGLFunctions_3_1_CoreBackend::versionStatus());
- d_3_1_Core = static_cast<QOpenGLFunctions_3_1_CoreBackend*>(d);
- d->refs.ref();
-
- d = QAbstractOpenGLFunctionsPrivate::functionsBackend(context, QOpenGLFunctions_3_2_CoreBackend::versionStatus());
- d_3_2_Core = static_cast<QOpenGLFunctions_3_2_CoreBackend*>(d);
- d->refs.ref();
-
- d = QAbstractOpenGLFunctionsPrivate::functionsBackend(context, QOpenGLFunctions_3_3_CoreBackend::versionStatus());
- d_3_3_Core = static_cast<QOpenGLFunctions_3_3_CoreBackend*>(d);
- d->refs.ref();
-
- d = QAbstractOpenGLFunctionsPrivate::functionsBackend(context, QOpenGLFunctions_4_0_CoreBackend::versionStatus());
- d_4_0_Core = static_cast<QOpenGLFunctions_4_0_CoreBackend*>(d);
- d->refs.ref();
-
- d = QAbstractOpenGLFunctionsPrivate::functionsBackend(context, QOpenGLFunctions_4_1_CoreBackend::versionStatus());
- d_4_1_Core = static_cast<QOpenGLFunctions_4_1_CoreBackend*>(d);
- d->refs.ref();
-
- d = QAbstractOpenGLFunctionsPrivate::functionsBackend(context, QOpenGLFunctions_4_2_CoreBackend::versionStatus());
- d_4_2_Core = static_cast<QOpenGLFunctions_4_2_CoreBackend*>(d);
- d->refs.ref();
-
- d = QAbstractOpenGLFunctionsPrivate::functionsBackend(context, QOpenGLFunctions_4_3_CoreBackend::versionStatus());
- d_4_3_Core = static_cast<QOpenGLFunctions_4_3_CoreBackend*>(d);
- d->refs.ref();
-
- d = QAbstractOpenGLFunctionsPrivate::functionsBackend(context, QOpenGLFunctions_1_0_DeprecatedBackend::versionStatus());
- d_1_0_Deprecated = static_cast<QOpenGLFunctions_1_0_DeprecatedBackend*>(d);
- d->refs.ref();
-
- d = QAbstractOpenGLFunctionsPrivate::functionsBackend(context, QOpenGLFunctions_1_1_DeprecatedBackend::versionStatus());
- d_1_1_Deprecated = static_cast<QOpenGLFunctions_1_1_DeprecatedBackend*>(d);
- d->refs.ref();
-
- d = QAbstractOpenGLFunctionsPrivate::functionsBackend(context, QOpenGLFunctions_1_2_DeprecatedBackend::versionStatus());
- d_1_2_Deprecated = static_cast<QOpenGLFunctions_1_2_DeprecatedBackend*>(d);
- d->refs.ref();
-
- d = QAbstractOpenGLFunctionsPrivate::functionsBackend(context, QOpenGLFunctions_1_3_DeprecatedBackend::versionStatus());
- d_1_3_Deprecated = static_cast<QOpenGLFunctions_1_3_DeprecatedBackend*>(d);
- d->refs.ref();
-
- d = QAbstractOpenGLFunctionsPrivate::functionsBackend(context, QOpenGLFunctions_1_4_DeprecatedBackend::versionStatus());
- d_1_4_Deprecated = static_cast<QOpenGLFunctions_1_4_DeprecatedBackend*>(d);
- d->refs.ref();
-
- d = QAbstractOpenGLFunctionsPrivate::functionsBackend(context, QOpenGLFunctions_3_3_DeprecatedBackend::versionStatus());
- d_3_3_Deprecated = static_cast<QOpenGLFunctions_3_3_DeprecatedBackend*>(d);
- d->refs.ref();
-
- QAbstractOpenGLFunctions::initializeOpenGLFunctions();
- }
- return isInitialized();
-}
-
-bool QOpenGLFunctions_4_3_Compatibility::isContextCompatible(QOpenGLContext *context)
-{
- Q_ASSERT(context);
- QSurfaceFormat f = context->format();
- const QPair<int, int> v = qMakePair(f.majorVersion(), f.minorVersion());
- if (v < qMakePair(4, 3))
- return false;
-
- if (f.profile() == QSurfaceFormat::CoreProfile)
- return false;
-
- return true;
-}
-
-QOpenGLVersionProfile QOpenGLFunctions_4_3_Compatibility::versionProfile()
-{
- QOpenGLVersionProfile v;
- v.setVersion(4, 3);
- v.setProfile(QSurfaceFormat::CompatibilityProfile);
- return v;
-}
-
-QT_END_NAMESPACE
diff --git a/src/gui/opengl/qopenglfunctions_4_3_compatibility.h b/src/gui/opengl/qopenglfunctions_4_3_compatibility.h
deleted file mode 100644
index d969f5b3b4..0000000000
--- a/src/gui/opengl/qopenglfunctions_4_3_compatibility.h
+++ /dev/null
@@ -1,5854 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2013 Klaralvdalens Datakonsult AB (KDAB)
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the QtGui module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-**
-** This file was generated by glgen version 0.1
-** Command line was: glgen
-**
-** glgen is Copyright (C) 2013 Klaralvdalens Datakonsult AB (KDAB)
-**
-** This is an auto-generated file.
-** Do not edit! All changes made to it will be lost.
-**
-****************************************************************************/
-
-#ifndef QOPENGLVERSIONFUNCTIONS_4_3_COMPATIBILITY_H
-#define QOPENGLVERSIONFUNCTIONS_4_3_COMPATIBILITY_H
-
-#include <QtGui/qtguiglobal.h>
-
-#if !defined(QT_NO_OPENGL) && !defined(QT_OPENGL_ES_2)
-
-#include <QtGui/QOpenGLVersionFunctions>
-#include <QtGui/qopenglcontext.h>
-
-// MemoryBarrier is a macro on some architectures on Windows
-#ifdef Q_OS_WIN
-#pragma push_macro("MemoryBarrier")
-#undef MemoryBarrier
-#endif
-
-QT_BEGIN_NAMESPACE
-
-class Q_GUI_EXPORT QOpenGLFunctions_4_3_Compatibility : public QAbstractOpenGLFunctions
-{
-public:
- QOpenGLFunctions_4_3_Compatibility();
- ~QOpenGLFunctions_4_3_Compatibility();
-
- bool initializeOpenGLFunctions() override;
-
- // OpenGL 1.0 core functions
- void glViewport(GLint x, GLint y, GLsizei width, GLsizei height);
- void glDepthRange(GLdouble nearVal, GLdouble farVal);
- GLboolean glIsEnabled(GLenum cap);
- void glGetTexLevelParameteriv(GLenum target, GLint level, GLenum pname, GLint *params);
- void glGetTexLevelParameterfv(GLenum target, GLint level, GLenum pname, GLfloat *params);
- void glGetTexParameteriv(GLenum target, GLenum pname, GLint *params);
- void glGetTexParameterfv(GLenum target, GLenum pname, GLfloat *params);
- void glGetTexImage(GLenum target, GLint level, GLenum format, GLenum type, GLvoid *pixels);
- const GLubyte * glGetString(GLenum name);
- void glGetIntegerv(GLenum pname, GLint *params);
- void glGetFloatv(GLenum pname, GLfloat *params);
- GLenum glGetError();
- void glGetDoublev(GLenum pname, GLdouble *params);
- void glGetBooleanv(GLenum pname, GLboolean *params);
- void glReadPixels(GLint x, GLint y, GLsizei width, GLsizei height, GLenum format, GLenum type, GLvoid *pixels);
- void glReadBuffer(GLenum mode);
- void glPixelStorei(GLenum pname, GLint param);
- void glPixelStoref(GLenum pname, GLfloat param);
- void glDepthFunc(GLenum func);
- void glStencilOp(GLenum fail, GLenum zfail, GLenum zpass);
- void glStencilFunc(GLenum func, GLint ref, GLuint mask);
- void glLogicOp(GLenum opcode);
- void glBlendFunc(GLenum sfactor, GLenum dfactor);
- void glFlush();
- void glFinish();
- void glEnable(GLenum cap);
- void glDisable(GLenum cap);
- void glDepthMask(GLboolean flag);
- void glColorMask(GLboolean red, GLboolean green, GLboolean blue, GLboolean alpha);
- void glStencilMask(GLuint mask);
- void glClearDepth(GLdouble depth);
- void glClearStencil(GLint s);
- void glClearColor(GLfloat red, GLfloat green, GLfloat blue, GLfloat alpha);
- void glClear(GLbitfield mask);
- void glDrawBuffer(GLenum mode);
- void glTexImage2D(GLenum target, GLint level, GLint internalformat, GLsizei width, GLsizei height, GLint border, GLenum format, GLenum type, const GLvoid *pixels);
- void glTexImage1D(GLenum target, GLint level, GLint internalformat, GLsizei width, GLint border, GLenum format, GLenum type, const GLvoid *pixels);
- void glTexParameteriv(GLenum target, GLenum pname, const GLint *params);
- void glTexParameteri(GLenum target, GLenum pname, GLint param);
- void glTexParameterfv(GLenum target, GLenum pname, const GLfloat *params);
- void glTexParameterf(GLenum target, GLenum pname, GLfloat param);
- void glScissor(GLint x, GLint y, GLsizei width, GLsizei height);
- void glPolygonMode(GLenum face, GLenum mode);
- void glPointSize(GLfloat size);
- void glLineWidth(GLfloat width);
- void glHint(GLenum target, GLenum mode);
- void glFrontFace(GLenum mode);
- void glCullFace(GLenum mode);
-
- // OpenGL 1.1 core functions
- void glIndexubv(const GLubyte *c);
- void glIndexub(GLubyte c);
- GLboolean glIsTexture(GLuint texture);
- void glGenTextures(GLsizei n, GLuint *textures);
- void glDeleteTextures(GLsizei n, const GLuint *textures);
- void glBindTexture(GLenum target, GLuint texture);
- void glTexSubImage2D(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLenum type, const GLvoid *pixels);
- void glTexSubImage1D(GLenum target, GLint level, GLint xoffset, GLsizei width, GLenum format, GLenum type, const GLvoid *pixels);
- void glCopyTexSubImage2D(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint x, GLint y, GLsizei width, GLsizei height);
- void glCopyTexSubImage1D(GLenum target, GLint level, GLint xoffset, GLint x, GLint y, GLsizei width);
- void glCopyTexImage2D(GLenum target, GLint level, GLenum internalformat, GLint x, GLint y, GLsizei width, GLsizei height, GLint border);
- void glCopyTexImage1D(GLenum target, GLint level, GLenum internalformat, GLint x, GLint y, GLsizei width, GLint border);
- void glPolygonOffset(GLfloat factor, GLfloat units);
- void glGetPointerv(GLenum pname, GLvoid* *params);
- void glDrawElements(GLenum mode, GLsizei count, GLenum type, const GLvoid *indices);
- void glDrawArrays(GLenum mode, GLint first, GLsizei count);
-
- // OpenGL 1.2 core functions
- void glCopyTexSubImage3D(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLint x, GLint y, GLsizei width, GLsizei height);
- void glTexSubImage3D(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLenum type, const GLvoid *pixels);
- void glTexImage3D(GLenum target, GLint level, GLint internalformat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLenum format, GLenum type, const GLvoid *pixels);
- void glDrawRangeElements(GLenum mode, GLuint start, GLuint end, GLsizei count, GLenum type, const GLvoid *indices);
- void glBlendEquation(GLenum mode);
- void glBlendColor(GLfloat red, GLfloat green, GLfloat blue, GLfloat alpha);
-
- // OpenGL 1.3 core functions
- void glGetCompressedTexImage(GLenum target, GLint level, GLvoid *img);
- void glCompressedTexSubImage1D(GLenum target, GLint level, GLint xoffset, GLsizei width, GLenum format, GLsizei imageSize, const GLvoid *data);
- void glCompressedTexSubImage2D(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLsizei imageSize, const GLvoid *data);
- void glCompressedTexSubImage3D(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLsizei imageSize, const GLvoid *data);
- void glCompressedTexImage1D(GLenum target, GLint level, GLenum internalformat, GLsizei width, GLint border, GLsizei imageSize, const GLvoid *data);
- void glCompressedTexImage2D(GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLint border, GLsizei imageSize, const GLvoid *data);
- void glCompressedTexImage3D(GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLsizei imageSize, const GLvoid *data);
- void glSampleCoverage(GLfloat value, GLboolean invert);
- void glActiveTexture(GLenum texture);
-
- // OpenGL 1.4 core functions
- void glPointParameteriv(GLenum pname, const GLint *params);
- void glPointParameteri(GLenum pname, GLint param);
- void glPointParameterfv(GLenum pname, const GLfloat *params);
- void glPointParameterf(GLenum pname, GLfloat param);
- void glMultiDrawElements(GLenum mode, const GLsizei *count, GLenum type, const GLvoid* const *indices, GLsizei drawcount);
- void glMultiDrawArrays(GLenum mode, const GLint *first, const GLsizei *count, GLsizei drawcount);
- void glBlendFuncSeparate(GLenum sfactorRGB, GLenum dfactorRGB, GLenum sfactorAlpha, GLenum dfactorAlpha);
-
- // OpenGL 1.5 core functions
- void glGetBufferPointerv(GLenum target, GLenum pname, GLvoid* *params);
- void glGetBufferParameteriv(GLenum target, GLenum pname, GLint *params);
- GLboolean glUnmapBuffer(GLenum target);
- GLvoid* glMapBuffer(GLenum target, GLenum access);
- void glGetBufferSubData(GLenum target, GLintptr offset, GLsizeiptr size, GLvoid *data);
- void glBufferSubData(GLenum target, GLintptr offset, GLsizeiptr size, const GLvoid *data);
- void glBufferData(GLenum target, GLsizeiptr size, const GLvoid *data, GLenum usage);
- GLboolean glIsBuffer(GLuint buffer);
- void glGenBuffers(GLsizei n, GLuint *buffers);
- void glDeleteBuffers(GLsizei n, const GLuint *buffers);
- void glBindBuffer(GLenum target, GLuint buffer);
- void glGetQueryObjectuiv(GLuint id, GLenum pname, GLuint *params);
- void glGetQueryObjectiv(GLuint id, GLenum pname, GLint *params);
- void glGetQueryiv(GLenum target, GLenum pname, GLint *params);
- void glEndQuery(GLenum target);
- void glBeginQuery(GLenum target, GLuint id);
- GLboolean glIsQuery(GLuint id);
- void glDeleteQueries(GLsizei n, const GLuint *ids);
- void glGenQueries(GLsizei n, GLuint *ids);
-
- // OpenGL 2.0 core functions
- void glVertexAttribPointer(GLuint index, GLint size, GLenum type, GLboolean normalized, GLsizei stride, const GLvoid *pointer);
- void glValidateProgram(GLuint program);
- void glUniformMatrix4fv(GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
- void glUniformMatrix3fv(GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
- void glUniformMatrix2fv(GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
- void glUniform4iv(GLint location, GLsizei count, const GLint *value);
- void glUniform3iv(GLint location, GLsizei count, const GLint *value);
- void glUniform2iv(GLint location, GLsizei count, const GLint *value);
- void glUniform1iv(GLint location, GLsizei count, const GLint *value);
- void glUniform4fv(GLint location, GLsizei count, const GLfloat *value);
- void glUniform3fv(GLint location, GLsizei count, const GLfloat *value);
- void glUniform2fv(GLint location, GLsizei count, const GLfloat *value);
- void glUniform1fv(GLint location, GLsizei count, const GLfloat *value);
- void glUniform4i(GLint location, GLint v0, GLint v1, GLint v2, GLint v3);
- void glUniform3i(GLint location, GLint v0, GLint v1, GLint v2);
- void glUniform2i(GLint location, GLint v0, GLint v1);
- void glUniform1i(GLint location, GLint v0);
- void glUniform4f(GLint location, GLfloat v0, GLfloat v1, GLfloat v2, GLfloat v3);
- void glUniform3f(GLint location, GLfloat v0, GLfloat v1, GLfloat v2);
- void glUniform2f(GLint location, GLfloat v0, GLfloat v1);
- void glUniform1f(GLint location, GLfloat v0);
- void glUseProgram(GLuint program);
- void glShaderSource(GLuint shader, GLsizei count, const GLchar* const *string, const GLint *length);
- void glLinkProgram(GLuint program);
- GLboolean glIsShader(GLuint shader);
- GLboolean glIsProgram(GLuint program);
- void glGetVertexAttribPointerv(GLuint index, GLenum pname, GLvoid* *pointer);
- void glGetVertexAttribiv(GLuint index, GLenum pname, GLint *params);
- void glGetVertexAttribfv(GLuint index, GLenum pname, GLfloat *params);
- void glGetVertexAttribdv(GLuint index, GLenum pname, GLdouble *params);
- void glGetUniformiv(GLuint program, GLint location, GLint *params);
- void glGetUniformfv(GLuint program, GLint location, GLfloat *params);
- GLint glGetUniformLocation(GLuint program, const GLchar *name);
- void glGetShaderSource(GLuint shader, GLsizei bufSize, GLsizei *length, GLchar *source);
- void glGetShaderInfoLog(GLuint shader, GLsizei bufSize, GLsizei *length, GLchar *infoLog);
- void glGetShaderiv(GLuint shader, GLenum pname, GLint *params);
- void glGetProgramInfoLog(GLuint program, GLsizei bufSize, GLsizei *length, GLchar *infoLog);
- void glGetProgramiv(GLuint program, GLenum pname, GLint *params);
- GLint glGetAttribLocation(GLuint program, const GLchar *name);
- void glGetAttachedShaders(GLuint program, GLsizei maxCount, GLsizei *count, GLuint *obj);
- void glGetActiveUniform(GLuint program, GLuint index, GLsizei bufSize, GLsizei *length, GLint *size, GLenum *type, GLchar *name);
- void glGetActiveAttrib(GLuint program, GLuint index, GLsizei bufSize, GLsizei *length, GLint *size, GLenum *type, GLchar *name);
- void glEnableVertexAttribArray(GLuint index);
- void glDisableVertexAttribArray(GLuint index);
- void glDetachShader(GLuint program, GLuint shader);
- void glDeleteShader(GLuint shader);
- void glDeleteProgram(GLuint program);
- GLuint glCreateShader(GLenum type);
- GLuint glCreateProgram();
- void glCompileShader(GLuint shader);
- void glBindAttribLocation(GLuint program, GLuint index, const GLchar *name);
- void glAttachShader(GLuint program, GLuint shader);
- void glStencilMaskSeparate(GLenum face, GLuint mask);
- void glStencilFuncSeparate(GLenum face, GLenum func, GLint ref, GLuint mask);
- void glStencilOpSeparate(GLenum face, GLenum sfail, GLenum dpfail, GLenum dppass);
- void glDrawBuffers(GLsizei n, const GLenum *bufs);
- void glBlendEquationSeparate(GLenum modeRGB, GLenum modeAlpha);
-
- // OpenGL 2.1 core functions
- void glUniformMatrix4x3fv(GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
- void glUniformMatrix3x4fv(GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
- void glUniformMatrix4x2fv(GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
- void glUniformMatrix2x4fv(GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
- void glUniformMatrix3x2fv(GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
- void glUniformMatrix2x3fv(GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
-
- // OpenGL 3.0 core functions
- GLboolean glIsVertexArray(GLuint array);
- void glGenVertexArrays(GLsizei n, GLuint *arrays);
- void glDeleteVertexArrays(GLsizei n, const GLuint *arrays);
- void glBindVertexArray(GLuint array);
- void glFlushMappedBufferRange(GLenum target, GLintptr offset, GLsizeiptr length);
- GLvoid* glMapBufferRange(GLenum target, GLintptr offset, GLsizeiptr length, GLbitfield access);
- void glFramebufferTextureLayer(GLenum target, GLenum attachment, GLuint texture, GLint level, GLint layer);
- void glRenderbufferStorageMultisample(GLenum target, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height);
- void glBlitFramebuffer(GLint srcX0, GLint srcY0, GLint srcX1, GLint srcY1, GLint dstX0, GLint dstY0, GLint dstX1, GLint dstY1, GLbitfield mask, GLenum filter);
- void glGenerateMipmap(GLenum target);
- void glGetFramebufferAttachmentParameteriv(GLenum target, GLenum attachment, GLenum pname, GLint *params);
- void glFramebufferRenderbuffer(GLenum target, GLenum attachment, GLenum renderbuffertarget, GLuint renderbuffer);
- void glFramebufferTexture3D(GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level, GLint zoffset);
- void glFramebufferTexture2D(GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level);
- void glFramebufferTexture1D(GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level);
- GLenum glCheckFramebufferStatus(GLenum target);
- void glGenFramebuffers(GLsizei n, GLuint *framebuffers);
- void glDeleteFramebuffers(GLsizei n, const GLuint *framebuffers);
- void glBindFramebuffer(GLenum target, GLuint framebuffer);
- GLboolean glIsFramebuffer(GLuint framebuffer);
- void glGetRenderbufferParameteriv(GLenum target, GLenum pname, GLint *params);
- void glRenderbufferStorage(GLenum target, GLenum internalformat, GLsizei width, GLsizei height);
- void glGenRenderbuffers(GLsizei n, GLuint *renderbuffers);
- void glDeleteRenderbuffers(GLsizei n, const GLuint *renderbuffers);
- void glBindRenderbuffer(GLenum target, GLuint renderbuffer);
- GLboolean glIsRenderbuffer(GLuint renderbuffer);
- const GLubyte * glGetStringi(GLenum name, GLuint index);
- void glClearBufferfi(GLenum buffer, GLint drawbuffer, GLfloat depth, GLint stencil);
- void glClearBufferfv(GLenum buffer, GLint drawbuffer, const GLfloat *value);
- void glClearBufferuiv(GLenum buffer, GLint drawbuffer, const GLuint *value);
- void glClearBufferiv(GLenum buffer, GLint drawbuffer, const GLint *value);
- void glGetTexParameterIuiv(GLenum target, GLenum pname, GLuint *params);
- void glGetTexParameterIiv(GLenum target, GLenum pname, GLint *params);
- void glTexParameterIuiv(GLenum target, GLenum pname, const GLuint *params);
- void glTexParameterIiv(GLenum target, GLenum pname, const GLint *params);
- void glUniform4uiv(GLint location, GLsizei count, const GLuint *value);
- void glUniform3uiv(GLint location, GLsizei count, const GLuint *value);
- void glUniform2uiv(GLint location, GLsizei count, const GLuint *value);
- void glUniform1uiv(GLint location, GLsizei count, const GLuint *value);
- void glUniform4ui(GLint location, GLuint v0, GLuint v1, GLuint v2, GLuint v3);
- void glUniform3ui(GLint location, GLuint v0, GLuint v1, GLuint v2);
- void glUniform2ui(GLint location, GLuint v0, GLuint v1);
- void glUniform1ui(GLint location, GLuint v0);
- GLint glGetFragDataLocation(GLuint program, const GLchar *name);
- void glBindFragDataLocation(GLuint program, GLuint color, const GLchar *name);
- void glGetUniformuiv(GLuint program, GLint location, GLuint *params);
- void glGetVertexAttribIuiv(GLuint index, GLenum pname, GLuint *params);
- void glGetVertexAttribIiv(GLuint index, GLenum pname, GLint *params);
- void glVertexAttribIPointer(GLuint index, GLint size, GLenum type, GLsizei stride, const GLvoid *pointer);
- void glEndConditionalRender();
- void glBeginConditionalRender(GLuint id, GLenum mode);
- void glClampColor(GLenum target, GLenum clamp);
- void glGetTransformFeedbackVarying(GLuint program, GLuint index, GLsizei bufSize, GLsizei *length, GLsizei *size, GLenum *type, GLchar *name);
- void glTransformFeedbackVaryings(GLuint program, GLsizei count, const GLchar* const *varyings, GLenum bufferMode);
- void glBindBufferBase(GLenum target, GLuint index, GLuint buffer);
- void glBindBufferRange(GLenum target, GLuint index, GLuint buffer, GLintptr offset, GLsizeiptr size);
- void glEndTransformFeedback();
- void glBeginTransformFeedback(GLenum primitiveMode);
- GLboolean glIsEnabledi(GLenum target, GLuint index);
- void glDisablei(GLenum target, GLuint index);
- void glEnablei(GLenum target, GLuint index);
- void glGetIntegeri_v(GLenum target, GLuint index, GLint *data);
- void glGetBooleani_v(GLenum target, GLuint index, GLboolean *data);
- void glColorMaski(GLuint index, GLboolean r, GLboolean g, GLboolean b, GLboolean a);
-
- // OpenGL 3.1 core functions
- void glCopyBufferSubData(GLenum readTarget, GLenum writeTarget, GLintptr readOffset, GLintptr writeOffset, GLsizeiptr size);
- void glUniformBlockBinding(GLuint program, GLuint uniformBlockIndex, GLuint uniformBlockBinding);
- void glGetActiveUniformBlockName(GLuint program, GLuint uniformBlockIndex, GLsizei bufSize, GLsizei *length, GLchar *uniformBlockName);
- void glGetActiveUniformBlockiv(GLuint program, GLuint uniformBlockIndex, GLenum pname, GLint *params);
- GLuint glGetUniformBlockIndex(GLuint program, const GLchar *uniformBlockName);
- void glGetActiveUniformName(GLuint program, GLuint uniformIndex, GLsizei bufSize, GLsizei *length, GLchar *uniformName);
- void glGetActiveUniformsiv(GLuint program, GLsizei uniformCount, const GLuint *uniformIndices, GLenum pname, GLint *params);
- void glGetUniformIndices(GLuint program, GLsizei uniformCount, const GLchar* const *uniformNames, GLuint *uniformIndices);
- void glPrimitiveRestartIndex(GLuint index);
- void glTexBuffer(GLenum target, GLenum internalformat, GLuint buffer);
- void glDrawElementsInstanced(GLenum mode, GLsizei count, GLenum type, const GLvoid *indices, GLsizei instancecount);
- void glDrawArraysInstanced(GLenum mode, GLint first, GLsizei count, GLsizei instancecount);
-
- // OpenGL 3.2 core functions
- void glSampleMaski(GLuint index, GLbitfield mask);
- void glGetMultisamplefv(GLenum pname, GLuint index, GLfloat *val);
- void glTexImage3DMultisample(GLenum target, GLsizei samples, GLint internalformat, GLsizei width, GLsizei height, GLsizei depth, GLboolean fixedsamplelocations);
- void glTexImage2DMultisample(GLenum target, GLsizei samples, GLint internalformat, GLsizei width, GLsizei height, GLboolean fixedsamplelocations);
- void glGetSynciv(GLsync sync, GLenum pname, GLsizei bufSize, GLsizei *length, GLint *values);
- void glGetInteger64v(GLenum pname, GLint64 *params);
- void glWaitSync(GLsync sync, GLbitfield flags, GLuint64 timeout);
- GLenum glClientWaitSync(GLsync sync, GLbitfield flags, GLuint64 timeout);
- void glDeleteSync(GLsync sync);
- GLboolean glIsSync(GLsync sync);
- GLsync glFenceSync(GLenum condition, GLbitfield flags);
- void glProvokingVertex(GLenum mode);
- void glMultiDrawElementsBaseVertex(GLenum mode, const GLsizei *count, GLenum type, const GLvoid* const *indices, GLsizei drawcount, const GLint *basevertex);
- void glDrawElementsInstancedBaseVertex(GLenum mode, GLsizei count, GLenum type, const GLvoid *indices, GLsizei instancecount, GLint basevertex);
- void glDrawRangeElementsBaseVertex(GLenum mode, GLuint start, GLuint end, GLsizei count, GLenum type, const GLvoid *indices, GLint basevertex);
- void glDrawElementsBaseVertex(GLenum mode, GLsizei count, GLenum type, const GLvoid *indices, GLint basevertex);
- void glFramebufferTexture(GLenum target, GLenum attachment, GLuint texture, GLint level);
- void glGetBufferParameteri64v(GLenum target, GLenum pname, GLint64 *params);
- void glGetInteger64i_v(GLenum target, GLuint index, GLint64 *data);
-
- // OpenGL 3.3 core functions
- void glVertexAttribP4uiv(GLuint index, GLenum type, GLboolean normalized, const GLuint *value);
- void glVertexAttribP4ui(GLuint index, GLenum type, GLboolean normalized, GLuint value);
- void glVertexAttribP3uiv(GLuint index, GLenum type, GLboolean normalized, const GLuint *value);
- void glVertexAttribP3ui(GLuint index, GLenum type, GLboolean normalized, GLuint value);
- void glVertexAttribP2uiv(GLuint index, GLenum type, GLboolean normalized, const GLuint *value);
- void glVertexAttribP2ui(GLuint index, GLenum type, GLboolean normalized, GLuint value);
- void glVertexAttribP1uiv(GLuint index, GLenum type, GLboolean normalized, const GLuint *value);
- void glVertexAttribP1ui(GLuint index, GLenum type, GLboolean normalized, GLuint value);
- void glSecondaryColorP3uiv(GLenum type, const GLuint *color);
- void glSecondaryColorP3ui(GLenum type, GLuint color);
- void glColorP4uiv(GLenum type, const GLuint *color);
- void glColorP4ui(GLenum type, GLuint color);
- void glColorP3uiv(GLenum type, const GLuint *color);
- void glColorP3ui(GLenum type, GLuint color);
- void glNormalP3uiv(GLenum type, const GLuint *coords);
- void glNormalP3ui(GLenum type, GLuint coords);
- void glMultiTexCoordP4uiv(GLenum texture, GLenum type, const GLuint *coords);
- void glMultiTexCoordP4ui(GLenum texture, GLenum type, GLuint coords);
- void glMultiTexCoordP3uiv(GLenum texture, GLenum type, const GLuint *coords);
- void glMultiTexCoordP3ui(GLenum texture, GLenum type, GLuint coords);
- void glMultiTexCoordP2uiv(GLenum texture, GLenum type, const GLuint *coords);
- void glMultiTexCoordP2ui(GLenum texture, GLenum type, GLuint coords);
- void glMultiTexCoordP1uiv(GLenum texture, GLenum type, const GLuint *coords);
- void glMultiTexCoordP1ui(GLenum texture, GLenum type, GLuint coords);
- void glTexCoordP4uiv(GLenum type, const GLuint *coords);
- void glTexCoordP4ui(GLenum type, GLuint coords);
- void glTexCoordP3uiv(GLenum type, const GLuint *coords);
- void glTexCoordP3ui(GLenum type, GLuint coords);
- void glTexCoordP2uiv(GLenum type, const GLuint *coords);
- void glTexCoordP2ui(GLenum type, GLuint coords);
- void glTexCoordP1uiv(GLenum type, const GLuint *coords);
- void glTexCoordP1ui(GLenum type, GLuint coords);
- void glVertexP4uiv(GLenum type, const GLuint *value);
- void glVertexP4ui(GLenum type, GLuint value);
- void glVertexP3uiv(GLenum type, const GLuint *value);
- void glVertexP3ui(GLenum type, GLuint value);
- void glVertexP2uiv(GLenum type, const GLuint *value);
- void glVertexP2ui(GLenum type, GLuint value);
- void glGetQueryObjectui64v(GLuint id, GLenum pname, GLuint64 *params);
- void glGetQueryObjecti64v(GLuint id, GLenum pname, GLint64 *params);
- void glQueryCounter(GLuint id, GLenum target);
- void glGetSamplerParameterIuiv(GLuint sampler, GLenum pname, GLuint *params);
- void glGetSamplerParameterfv(GLuint sampler, GLenum pname, GLfloat *params);
- void glGetSamplerParameterIiv(GLuint sampler, GLenum pname, GLint *params);
- void glGetSamplerParameteriv(GLuint sampler, GLenum pname, GLint *params);
- void glSamplerParameterIuiv(GLuint sampler, GLenum pname, const GLuint *param);
- void glSamplerParameterIiv(GLuint sampler, GLenum pname, const GLint *param);
- void glSamplerParameterfv(GLuint sampler, GLenum pname, const GLfloat *param);
- void glSamplerParameterf(GLuint sampler, GLenum pname, GLfloat param);
- void glSamplerParameteriv(GLuint sampler, GLenum pname, const GLint *param);
- void glSamplerParameteri(GLuint sampler, GLenum pname, GLint param);
- void glBindSampler(GLuint unit, GLuint sampler);
- GLboolean glIsSampler(GLuint sampler);
- void glDeleteSamplers(GLsizei count, const GLuint *samplers);
- void glGenSamplers(GLsizei count, GLuint *samplers);
- GLint glGetFragDataIndex(GLuint program, const GLchar *name);
- void glBindFragDataLocationIndexed(GLuint program, GLuint colorNumber, GLuint index, const GLchar *name);
- void glVertexAttribDivisor(GLuint index, GLuint divisor);
-
- // OpenGL 4.0 core functions
- void glGetQueryIndexediv(GLenum target, GLuint index, GLenum pname, GLint *params);
- void glEndQueryIndexed(GLenum target, GLuint index);
- void glBeginQueryIndexed(GLenum target, GLuint index, GLuint id);
- void glDrawTransformFeedbackStream(GLenum mode, GLuint id, GLuint stream);
- void glDrawTransformFeedback(GLenum mode, GLuint id);
- void glResumeTransformFeedback();
- void glPauseTransformFeedback();
- GLboolean glIsTransformFeedback(GLuint id);
- void glGenTransformFeedbacks(GLsizei n, GLuint *ids);
- void glDeleteTransformFeedbacks(GLsizei n, const GLuint *ids);
- void glBindTransformFeedback(GLenum target, GLuint id);
- void glPatchParameterfv(GLenum pname, const GLfloat *values);
- void glPatchParameteri(GLenum pname, GLint value);
- void glGetProgramStageiv(GLuint program, GLenum shadertype, GLenum pname, GLint *values);
- void glGetUniformSubroutineuiv(GLenum shadertype, GLint location, GLuint *params);
- void glUniformSubroutinesuiv(GLenum shadertype, GLsizei count, const GLuint *indices);
- void glGetActiveSubroutineName(GLuint program, GLenum shadertype, GLuint index, GLsizei bufsize, GLsizei *length, GLchar *name);
- void glGetActiveSubroutineUniformName(GLuint program, GLenum shadertype, GLuint index, GLsizei bufsize, GLsizei *length, GLchar *name);
- void glGetActiveSubroutineUniformiv(GLuint program, GLenum shadertype, GLuint index, GLenum pname, GLint *values);
- GLuint glGetSubroutineIndex(GLuint program, GLenum shadertype, const GLchar *name);
- GLint glGetSubroutineUniformLocation(GLuint program, GLenum shadertype, const GLchar *name);
- void glGetUniformdv(GLuint program, GLint location, GLdouble *params);
- void glUniformMatrix4x3dv(GLint location, GLsizei count, GLboolean transpose, const GLdouble *value);
- void glUniformMatrix4x2dv(GLint location, GLsizei count, GLboolean transpose, const GLdouble *value);
- void glUniformMatrix3x4dv(GLint location, GLsizei count, GLboolean transpose, const GLdouble *value);
- void glUniformMatrix3x2dv(GLint location, GLsizei count, GLboolean transpose, const GLdouble *value);
- void glUniformMatrix2x4dv(GLint location, GLsizei count, GLboolean transpose, const GLdouble *value);
- void glUniformMatrix2x3dv(GLint location, GLsizei count, GLboolean transpose, const GLdouble *value);
- void glUniformMatrix4dv(GLint location, GLsizei count, GLboolean transpose, const GLdouble *value);
- void glUniformMatrix3dv(GLint location, GLsizei count, GLboolean transpose, const GLdouble *value);
- void glUniformMatrix2dv(GLint location, GLsizei count, GLboolean transpose, const GLdouble *value);
- void glUniform4dv(GLint location, GLsizei count, const GLdouble *value);
- void glUniform3dv(GLint location, GLsizei count, const GLdouble *value);
- void glUniform2dv(GLint location, GLsizei count, const GLdouble *value);
- void glUniform1dv(GLint location, GLsizei count, const GLdouble *value);
- void glUniform4d(GLint location, GLdouble x, GLdouble y, GLdouble z, GLdouble w);
- void glUniform3d(GLint location, GLdouble x, GLdouble y, GLdouble z);
- void glUniform2d(GLint location, GLdouble x, GLdouble y);
- void glUniform1d(GLint location, GLdouble x);
- void glDrawElementsIndirect(GLenum mode, GLenum type, const GLvoid *indirect);
- void glDrawArraysIndirect(GLenum mode, const GLvoid *indirect);
- void glBlendFuncSeparatei(GLuint buf, GLenum srcRGB, GLenum dstRGB, GLenum srcAlpha, GLenum dstAlpha);
- void glBlendFunci(GLuint buf, GLenum src, GLenum dst);
- void glBlendEquationSeparatei(GLuint buf, GLenum modeRGB, GLenum modeAlpha);
- void glBlendEquationi(GLuint buf, GLenum mode);
- void glMinSampleShading(GLfloat value);
-
- // OpenGL 4.1 core functions
- void glGetDoublei_v(GLenum target, GLuint index, GLdouble *data);
- void glGetFloati_v(GLenum target, GLuint index, GLfloat *data);
- void glDepthRangeIndexed(GLuint index, GLdouble n, GLdouble f);
- void glDepthRangeArrayv(GLuint first, GLsizei count, const GLdouble *v);
- void glScissorIndexedv(GLuint index, const GLint *v);
- void glScissorIndexed(GLuint index, GLint left, GLint bottom, GLsizei width, GLsizei height);
- void glScissorArrayv(GLuint first, GLsizei count, const GLint *v);
- void glViewportIndexedfv(GLuint index, const GLfloat *v);
- void glViewportIndexedf(GLuint index, GLfloat x, GLfloat y, GLfloat w, GLfloat h);
- void glViewportArrayv(GLuint first, GLsizei count, const GLfloat *v);
- void glGetVertexAttribLdv(GLuint index, GLenum pname, GLdouble *params);
- void glVertexAttribLPointer(GLuint index, GLint size, GLenum type, GLsizei stride, const GLvoid *pointer);
- void glVertexAttribL4dv(GLuint index, const GLdouble *v);
- void glVertexAttribL3dv(GLuint index, const GLdouble *v);
- void glVertexAttribL2dv(GLuint index, const GLdouble *v);
- void glVertexAttribL1dv(GLuint index, const GLdouble *v);
- void glVertexAttribL4d(GLuint index, GLdouble x, GLdouble y, GLdouble z, GLdouble w);
- void glVertexAttribL3d(GLuint index, GLdouble x, GLdouble y, GLdouble z);
- void glVertexAttribL2d(GLuint index, GLdouble x, GLdouble y);
- void glVertexAttribL1d(GLuint index, GLdouble x);
- void glGetProgramPipelineInfoLog(GLuint pipeline, GLsizei bufSize, GLsizei *length, GLchar *infoLog);
- void glValidateProgramPipeline(GLuint pipeline);
- void glProgramUniformMatrix4x3dv(GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLdouble *value);
- void glProgramUniformMatrix3x4dv(GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLdouble *value);
- void glProgramUniformMatrix4x2dv(GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLdouble *value);
- void glProgramUniformMatrix2x4dv(GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLdouble *value);
- void glProgramUniformMatrix3x2dv(GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLdouble *value);
- void glProgramUniformMatrix2x3dv(GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLdouble *value);
- void glProgramUniformMatrix4x3fv(GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
- void glProgramUniformMatrix3x4fv(GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
- void glProgramUniformMatrix4x2fv(GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
- void glProgramUniformMatrix2x4fv(GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
- void glProgramUniformMatrix3x2fv(GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
- void glProgramUniformMatrix2x3fv(GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
- void glProgramUniformMatrix4dv(GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLdouble *value);
- void glProgramUniformMatrix3dv(GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLdouble *value);
- void glProgramUniformMatrix2dv(GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLdouble *value);
- void glProgramUniformMatrix4fv(GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
- void glProgramUniformMatrix3fv(GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
- void glProgramUniformMatrix2fv(GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
- void glProgramUniform4uiv(GLuint program, GLint location, GLsizei count, const GLuint *value);
- void glProgramUniform4ui(GLuint program, GLint location, GLuint v0, GLuint v1, GLuint v2, GLuint v3);
- void glProgramUniform4dv(GLuint program, GLint location, GLsizei count, const GLdouble *value);
- void glProgramUniform4d(GLuint program, GLint location, GLdouble v0, GLdouble v1, GLdouble v2, GLdouble v3);
- void glProgramUniform4fv(GLuint program, GLint location, GLsizei count, const GLfloat *value);
- void glProgramUniform4f(GLuint program, GLint location, GLfloat v0, GLfloat v1, GLfloat v2, GLfloat v3);
- void glProgramUniform4iv(GLuint program, GLint location, GLsizei count, const GLint *value);
- void glProgramUniform4i(GLuint program, GLint location, GLint v0, GLint v1, GLint v2, GLint v3);
- void glProgramUniform3uiv(GLuint program, GLint location, GLsizei count, const GLuint *value);
- void glProgramUniform3ui(GLuint program, GLint location, GLuint v0, GLuint v1, GLuint v2);
- void glProgramUniform3dv(GLuint program, GLint location, GLsizei count, const GLdouble *value);
- void glProgramUniform3d(GLuint program, GLint location, GLdouble v0, GLdouble v1, GLdouble v2);
- void glProgramUniform3fv(GLuint program, GLint location, GLsizei count, const GLfloat *value);
- void glProgramUniform3f(GLuint program, GLint location, GLfloat v0, GLfloat v1, GLfloat v2);
- void glProgramUniform3iv(GLuint program, GLint location, GLsizei count, const GLint *value);
- void glProgramUniform3i(GLuint program, GLint location, GLint v0, GLint v1, GLint v2);
- void glProgramUniform2uiv(GLuint program, GLint location, GLsizei count, const GLuint *value);
- void glProgramUniform2ui(GLuint program, GLint location, GLuint v0, GLuint v1);
- void glProgramUniform2dv(GLuint program, GLint location, GLsizei count, const GLdouble *value);
- void glProgramUniform2d(GLuint program, GLint location, GLdouble v0, GLdouble v1);
- void glProgramUniform2fv(GLuint program, GLint location, GLsizei count, const GLfloat *value);
- void glProgramUniform2f(GLuint program, GLint location, GLfloat v0, GLfloat v1);
- void glProgramUniform2iv(GLuint program, GLint location, GLsizei count, const GLint *value);
- void glProgramUniform2i(GLuint program, GLint location, GLint v0, GLint v1);
- void glProgramUniform1uiv(GLuint program, GLint location, GLsizei count, const GLuint *value);
- void glProgramUniform1ui(GLuint program, GLint location, GLuint v0);
- void glProgramUniform1dv(GLuint program, GLint location, GLsizei count, const GLdouble *value);
- void glProgramUniform1d(GLuint program, GLint location, GLdouble v0);
- void glProgramUniform1fv(GLuint program, GLint location, GLsizei count, const GLfloat *value);
- void glProgramUniform1f(GLuint program, GLint location, GLfloat v0);
- void glProgramUniform1iv(GLuint program, GLint location, GLsizei count, const GLint *value);
- void glProgramUniform1i(GLuint program, GLint location, GLint v0);
- void glGetProgramPipelineiv(GLuint pipeline, GLenum pname, GLint *params);
- GLboolean glIsProgramPipeline(GLuint pipeline);
- void glGenProgramPipelines(GLsizei n, GLuint *pipelines);
- void glDeleteProgramPipelines(GLsizei n, const GLuint *pipelines);
- void glBindProgramPipeline(GLuint pipeline);
- GLuint glCreateShaderProgramv(GLenum type, GLsizei count, const GLchar* const *strings);
- void glActiveShaderProgram(GLuint pipeline, GLuint program);
- void glUseProgramStages(GLuint pipeline, GLbitfield stages, GLuint program);
- void glProgramParameteri(GLuint program, GLenum pname, GLint value);
- void glProgramBinary(GLuint program, GLenum binaryFormat, const GLvoid *binary, GLsizei length);
- void glGetProgramBinary(GLuint program, GLsizei bufSize, GLsizei *length, GLenum *binaryFormat, GLvoid *binary);
- void glClearDepthf(GLfloat dd);
- void glDepthRangef(GLfloat n, GLfloat f);
- void glGetShaderPrecisionFormat(GLenum shadertype, GLenum precisiontype, GLint *range, GLint *precision);
- void glShaderBinary(GLsizei count, const GLuint *shaders, GLenum binaryformat, const GLvoid *binary, GLsizei length);
- void glReleaseShaderCompiler();
-
- // OpenGL 4.2 core functions
- void glTexStorage3D(GLenum target, GLsizei levels, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth);
- void glTexStorage2D(GLenum target, GLsizei levels, GLenum internalformat, GLsizei width, GLsizei height);
- void glTexStorage1D(GLenum target, GLsizei levels, GLenum internalformat, GLsizei width);
- void glMemoryBarrier(GLbitfield barriers);
- void glBindImageTexture(GLuint unit, GLuint texture, GLint level, GLboolean layered, GLint layer, GLenum access, GLenum format);
- void glGetActiveAtomicCounterBufferiv(GLuint program, GLuint bufferIndex, GLenum pname, GLint *params);
- void glGetInternalformativ(GLenum target, GLenum internalformat, GLenum pname, GLsizei bufSize, GLint *params);
- void glDrawTransformFeedbackStreamInstanced(GLenum mode, GLuint id, GLuint stream, GLsizei instancecount);
- void glDrawTransformFeedbackInstanced(GLenum mode, GLuint id, GLsizei instancecount);
- void glDrawElementsInstancedBaseVertexBaseInstance(GLenum mode, GLsizei count, GLenum type, const void *indices, GLsizei instancecount, GLint basevertex, GLuint baseinstance);
- void glDrawElementsInstancedBaseInstance(GLenum mode, GLsizei count, GLenum type, const void *indices, GLsizei instancecount, GLuint baseinstance);
- void glDrawArraysInstancedBaseInstance(GLenum mode, GLint first, GLsizei count, GLsizei instancecount, GLuint baseinstance);
-
- // OpenGL 4.3 core functions
- void glTexStorage3DMultisample(GLenum target, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth, GLboolean fixedsamplelocations);
- void glTexStorage2DMultisample(GLenum target, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height, GLboolean fixedsamplelocations);
- void glTexBufferRange(GLenum target, GLenum internalformat, GLuint buffer, GLintptr offset, GLsizeiptr size);
- void glShaderStorageBlockBinding(GLuint program, GLuint storageBlockIndex, GLuint storageBlockBinding);
- GLint glGetProgramResourceLocationIndex(GLuint program, GLenum programInterface, const GLchar *name);
- GLint glGetProgramResourceLocation(GLuint program, GLenum programInterface, const GLchar *name);
- void glGetProgramResourceiv(GLuint program, GLenum programInterface, GLuint index, GLsizei propCount, const GLenum *props, GLsizei bufSize, GLsizei *length, GLint *params);
- void glGetProgramResourceName(GLuint program, GLenum programInterface, GLuint index, GLsizei bufSize, GLsizei *length, GLchar *name);
- GLuint glGetProgramResourceIndex(GLuint program, GLenum programInterface, const GLchar *name);
- void glGetProgramInterfaceiv(GLuint program, GLenum programInterface, GLenum pname, GLint *params);
- void glMultiDrawElementsIndirect(GLenum mode, GLenum type, const void *indirect, GLsizei drawcount, GLsizei stride);
- void glMultiDrawArraysIndirect(GLenum mode, const void *indirect, GLsizei drawcount, GLsizei stride);
- void glInvalidateSubFramebuffer(GLenum target, GLsizei numAttachments, const GLenum *attachments, GLint x, GLint y, GLsizei width, GLsizei height);
- void glInvalidateFramebuffer(GLenum target, GLsizei numAttachments, const GLenum *attachments);
- void glInvalidateBufferData(GLuint buffer);
- void glInvalidateBufferSubData(GLuint buffer, GLintptr offset, GLsizeiptr length);
- void glInvalidateTexImage(GLuint texture, GLint level);
- void glInvalidateTexSubImage(GLuint texture, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth);
- void glGetInternalformati64v(GLenum target, GLenum internalformat, GLenum pname, GLsizei bufSize, GLint64 *params);
- void glGetFramebufferParameteriv(GLenum target, GLenum pname, GLint *params);
- void glFramebufferParameteri(GLenum target, GLenum pname, GLint param);
- void glVertexBindingDivisor(GLuint bindingindex, GLuint divisor);
- void glVertexAttribBinding(GLuint attribindex, GLuint bindingindex);
- void glVertexAttribLFormat(GLuint attribindex, GLint size, GLenum type, GLuint relativeoffset);
- void glVertexAttribIFormat(GLuint attribindex, GLint size, GLenum type, GLuint relativeoffset);
- void glVertexAttribFormat(GLuint attribindex, GLint size, GLenum type, GLboolean normalized, GLuint relativeoffset);
- void glBindVertexBuffer(GLuint bindingindex, GLuint buffer, GLintptr offset, GLsizei stride);
- void glTextureView(GLuint texture, GLenum target, GLuint origtexture, GLenum internalformat, GLuint minlevel, GLuint numlevels, GLuint minlayer, GLuint numlayers);
- void glCopyImageSubData(GLuint srcName, GLenum srcTarget, GLint srcLevel, GLint srcX, GLint srcY, GLint srcZ, GLuint dstName, GLenum dstTarget, GLint dstLevel, GLint dstX, GLint dstY, GLint dstZ, GLsizei srcWidth, GLsizei srcHeight, GLsizei srcDepth);
- void glDispatchComputeIndirect(GLintptr indirect);
- void glDispatchCompute(GLuint num_groups_x, GLuint num_groups_y, GLuint num_groups_z);
- void glClearBufferSubData(GLenum target, GLenum internalformat, GLintptr offset, GLsizeiptr size, GLenum format, GLenum type, const void *data);
- void glClearBufferData(GLenum target, GLenum internalformat, GLenum format, GLenum type, const void *data);
-
- // OpenGL 1.0 deprecated functions
- void glTranslatef(GLfloat x, GLfloat y, GLfloat z);
- void glTranslated(GLdouble x, GLdouble y, GLdouble z);
- void glScalef(GLfloat x, GLfloat y, GLfloat z);
- void glScaled(GLdouble x, GLdouble y, GLdouble z);
- void glRotatef(GLfloat angle, GLfloat x, GLfloat y, GLfloat z);
- void glRotated(GLdouble angle, GLdouble x, GLdouble y, GLdouble z);
- void glPushMatrix();
- void glPopMatrix();
- void glOrtho(GLdouble left, GLdouble right, GLdouble bottom, GLdouble top, GLdouble zNear, GLdouble zFar);
- void glMultMatrixd(const GLdouble *m);
- void glMultMatrixf(const GLfloat *m);
- void glMatrixMode(GLenum mode);
- void glLoadMatrixd(const GLdouble *m);
- void glLoadMatrixf(const GLfloat *m);
- void glLoadIdentity();
- void glFrustum(GLdouble left, GLdouble right, GLdouble bottom, GLdouble top, GLdouble zNear, GLdouble zFar);
- GLboolean glIsList(GLuint list);
- void glGetTexGeniv(GLenum coord, GLenum pname, GLint *params);
- void glGetTexGenfv(GLenum coord, GLenum pname, GLfloat *params);
- void glGetTexGendv(GLenum coord, GLenum pname, GLdouble *params);
- void glGetTexEnviv(GLenum target, GLenum pname, GLint *params);
- void glGetTexEnvfv(GLenum target, GLenum pname, GLfloat *params);
- void glGetPolygonStipple(GLubyte *mask);
- void glGetPixelMapusv(GLenum map, GLushort *values);
- void glGetPixelMapuiv(GLenum map, GLuint *values);
- void glGetPixelMapfv(GLenum map, GLfloat *values);
- void glGetMaterialiv(GLenum face, GLenum pname, GLint *params);
- void glGetMaterialfv(GLenum face, GLenum pname, GLfloat *params);
- void glGetMapiv(GLenum target, GLenum query, GLint *v);
- void glGetMapfv(GLenum target, GLenum query, GLfloat *v);
- void glGetMapdv(GLenum target, GLenum query, GLdouble *v);
- void glGetLightiv(GLenum light, GLenum pname, GLint *params);
- void glGetLightfv(GLenum light, GLenum pname, GLfloat *params);
- void glGetClipPlane(GLenum plane, GLdouble *equation);
- void glDrawPixels(GLsizei width, GLsizei height, GLenum format, GLenum type, const GLvoid *pixels);
- void glCopyPixels(GLint x, GLint y, GLsizei width, GLsizei height, GLenum type);
- void glPixelMapusv(GLenum map, GLint mapsize, const GLushort *values);
- void glPixelMapuiv(GLenum map, GLint mapsize, const GLuint *values);
- void glPixelMapfv(GLenum map, GLint mapsize, const GLfloat *values);
- void glPixelTransferi(GLenum pname, GLint param);
- void glPixelTransferf(GLenum pname, GLfloat param);
- void glPixelZoom(GLfloat xfactor, GLfloat yfactor);
- void glAlphaFunc(GLenum func, GLfloat ref);
- void glEvalPoint2(GLint i, GLint j);
- void glEvalMesh2(GLenum mode, GLint i1, GLint i2, GLint j1, GLint j2);
- void glEvalPoint1(GLint i);
- void glEvalMesh1(GLenum mode, GLint i1, GLint i2);
- void glEvalCoord2fv(const GLfloat *u);
- void glEvalCoord2f(GLfloat u, GLfloat v);
- void glEvalCoord2dv(const GLdouble *u);
- void glEvalCoord2d(GLdouble u, GLdouble v);
- void glEvalCoord1fv(const GLfloat *u);
- void glEvalCoord1f(GLfloat u);
- void glEvalCoord1dv(const GLdouble *u);
- void glEvalCoord1d(GLdouble u);
- void glMapGrid2f(GLint un, GLfloat u1, GLfloat u2, GLint vn, GLfloat v1, GLfloat v2);
- void glMapGrid2d(GLint un, GLdouble u1, GLdouble u2, GLint vn, GLdouble v1, GLdouble v2);
- void glMapGrid1f(GLint un, GLfloat u1, GLfloat u2);
- void glMapGrid1d(GLint un, GLdouble u1, GLdouble u2);
- void glMap2f(GLenum target, GLfloat u1, GLfloat u2, GLint ustride, GLint uorder, GLfloat v1, GLfloat v2, GLint vstride, GLint vorder, const GLfloat *points);
- void glMap2d(GLenum target, GLdouble u1, GLdouble u2, GLint ustride, GLint uorder, GLdouble v1, GLdouble v2, GLint vstride, GLint vorder, const GLdouble *points);
- void glMap1f(GLenum target, GLfloat u1, GLfloat u2, GLint stride, GLint order, const GLfloat *points);
- void glMap1d(GLenum target, GLdouble u1, GLdouble u2, GLint stride, GLint order, const GLdouble *points);
- void glPushAttrib(GLbitfield mask);
- void glPopAttrib();
- void glAccum(GLenum op, GLfloat value);
- void glIndexMask(GLuint mask);
- void glClearIndex(GLfloat c);
- void glClearAccum(GLfloat red, GLfloat green, GLfloat blue, GLfloat alpha);
- void glPushName(GLuint name);
- void glPopName();
- void glPassThrough(GLfloat token);
- void glLoadName(GLuint name);
- void glInitNames();
- GLint glRenderMode(GLenum mode);
- void glSelectBuffer(GLsizei size, GLuint *buffer);
- void glFeedbackBuffer(GLsizei size, GLenum type, GLfloat *buffer);
- void glTexGeniv(GLenum coord, GLenum pname, const GLint *params);
- void glTexGeni(GLenum coord, GLenum pname, GLint param);
- void glTexGenfv(GLenum coord, GLenum pname, const GLfloat *params);
- void glTexGenf(GLenum coord, GLenum pname, GLfloat param);
- void glTexGendv(GLenum coord, GLenum pname, const GLdouble *params);
- void glTexGend(GLenum coord, GLenum pname, GLdouble param);
- void glTexEnviv(GLenum target, GLenum pname, const GLint *params);
- void glTexEnvi(GLenum target, GLenum pname, GLint param);
- void glTexEnvfv(GLenum target, GLenum pname, const GLfloat *params);
- void glTexEnvf(GLenum target, GLenum pname, GLfloat param);
- void glShadeModel(GLenum mode);
- void glPolygonStipple(const GLubyte *mask);
- void glMaterialiv(GLenum face, GLenum pname, const GLint *params);
- void glMateriali(GLenum face, GLenum pname, GLint param);
- void glMaterialfv(GLenum face, GLenum pname, const GLfloat *params);
- void glMaterialf(GLenum face, GLenum pname, GLfloat param);
- void glLineStipple(GLint factor, GLushort pattern);
- void glLightModeliv(GLenum pname, const GLint *params);
- void glLightModeli(GLenum pname, GLint param);
- void glLightModelfv(GLenum pname, const GLfloat *params);
- void glLightModelf(GLenum pname, GLfloat param);
- void glLightiv(GLenum light, GLenum pname, const GLint *params);
- void glLighti(GLenum light, GLenum pname, GLint param);
- void glLightfv(GLenum light, GLenum pname, const GLfloat *params);
- void glLightf(GLenum light, GLenum pname, GLfloat param);
- void glFogiv(GLenum pname, const GLint *params);
- void glFogi(GLenum pname, GLint param);
- void glFogfv(GLenum pname, const GLfloat *params);
- void glFogf(GLenum pname, GLfloat param);
- void glColorMaterial(GLenum face, GLenum mode);
- void glClipPlane(GLenum plane, const GLdouble *equation);
- void glVertex4sv(const GLshort *v);
- void glVertex4s(GLshort x, GLshort y, GLshort z, GLshort w);
- void glVertex4iv(const GLint *v);
- void glVertex4i(GLint x, GLint y, GLint z, GLint w);
- void glVertex4fv(const GLfloat *v);
- void glVertex4f(GLfloat x, GLfloat y, GLfloat z, GLfloat w);
- void glVertex4dv(const GLdouble *v);
- void glVertex4d(GLdouble x, GLdouble y, GLdouble z, GLdouble w);
- void glVertex3sv(const GLshort *v);
- void glVertex3s(GLshort x, GLshort y, GLshort z);
- void glVertex3iv(const GLint *v);
- void glVertex3i(GLint x, GLint y, GLint z);
- void glVertex3fv(const GLfloat *v);
- void glVertex3f(GLfloat x, GLfloat y, GLfloat z);
- void glVertex3dv(const GLdouble *v);
- void glVertex3d(GLdouble x, GLdouble y, GLdouble z);
- void glVertex2sv(const GLshort *v);
- void glVertex2s(GLshort x, GLshort y);
- void glVertex2iv(const GLint *v);
- void glVertex2i(GLint x, GLint y);
- void glVertex2fv(const GLfloat *v);
- void glVertex2f(GLfloat x, GLfloat y);
- void glVertex2dv(const GLdouble *v);
- void glVertex2d(GLdouble x, GLdouble y);
- void glTexCoord4sv(const GLshort *v);
- void glTexCoord4s(GLshort s, GLshort t, GLshort r, GLshort q);
- void glTexCoord4iv(const GLint *v);
- void glTexCoord4i(GLint s, GLint t, GLint r, GLint q);
- void glTexCoord4fv(const GLfloat *v);
- void glTexCoord4f(GLfloat s, GLfloat t, GLfloat r, GLfloat q);
- void glTexCoord4dv(const GLdouble *v);
- void glTexCoord4d(GLdouble s, GLdouble t, GLdouble r, GLdouble q);
- void glTexCoord3sv(const GLshort *v);
- void glTexCoord3s(GLshort s, GLshort t, GLshort r);
- void glTexCoord3iv(const GLint *v);
- void glTexCoord3i(GLint s, GLint t, GLint r);
- void glTexCoord3fv(const GLfloat *v);
- void glTexCoord3f(GLfloat s, GLfloat t, GLfloat r);
- void glTexCoord3dv(const GLdouble *v);
- void glTexCoord3d(GLdouble s, GLdouble t, GLdouble r);
- void glTexCoord2sv(const GLshort *v);
- void glTexCoord2s(GLshort s, GLshort t);
- void glTexCoord2iv(const GLint *v);
- void glTexCoord2i(GLint s, GLint t);
- void glTexCoord2fv(const GLfloat *v);
- void glTexCoord2f(GLfloat s, GLfloat t);
- void glTexCoord2dv(const GLdouble *v);
- void glTexCoord2d(GLdouble s, GLdouble t);
- void glTexCoord1sv(const GLshort *v);
- void glTexCoord1s(GLshort s);
- void glTexCoord1iv(const GLint *v);
- void glTexCoord1i(GLint s);
- void glTexCoord1fv(const GLfloat *v);
- void glTexCoord1f(GLfloat s);
- void glTexCoord1dv(const GLdouble *v);
- void glTexCoord1d(GLdouble s);
- void glRectsv(const GLshort *v1, const GLshort *v2);
- void glRects(GLshort x1, GLshort y1, GLshort x2, GLshort y2);
- void glRectiv(const GLint *v1, const GLint *v2);
- void glRecti(GLint x1, GLint y1, GLint x2, GLint y2);
- void glRectfv(const GLfloat *v1, const GLfloat *v2);
- void glRectf(GLfloat x1, GLfloat y1, GLfloat x2, GLfloat y2);
- void glRectdv(const GLdouble *v1, const GLdouble *v2);
- void glRectd(GLdouble x1, GLdouble y1, GLdouble x2, GLdouble y2);
- void glRasterPos4sv(const GLshort *v);
- void glRasterPos4s(GLshort x, GLshort y, GLshort z, GLshort w);
- void glRasterPos4iv(const GLint *v);
- void glRasterPos4i(GLint x, GLint y, GLint z, GLint w);
- void glRasterPos4fv(const GLfloat *v);
- void glRasterPos4f(GLfloat x, GLfloat y, GLfloat z, GLfloat w);
- void glRasterPos4dv(const GLdouble *v);
- void glRasterPos4d(GLdouble x, GLdouble y, GLdouble z, GLdouble w);
- void glRasterPos3sv(const GLshort *v);
- void glRasterPos3s(GLshort x, GLshort y, GLshort z);
- void glRasterPos3iv(const GLint *v);
- void glRasterPos3i(GLint x, GLint y, GLint z);
- void glRasterPos3fv(const GLfloat *v);
- void glRasterPos3f(GLfloat x, GLfloat y, GLfloat z);
- void glRasterPos3dv(const GLdouble *v);
- void glRasterPos3d(GLdouble x, GLdouble y, GLdouble z);
- void glRasterPos2sv(const GLshort *v);
- void glRasterPos2s(GLshort x, GLshort y);
- void glRasterPos2iv(const GLint *v);
- void glRasterPos2i(GLint x, GLint y);
- void glRasterPos2fv(const GLfloat *v);
- void glRasterPos2f(GLfloat x, GLfloat y);
- void glRasterPos2dv(const GLdouble *v);
- void glRasterPos2d(GLdouble x, GLdouble y);
- void glNormal3sv(const GLshort *v);
- void glNormal3s(GLshort nx, GLshort ny, GLshort nz);
- void glNormal3iv(const GLint *v);
- void glNormal3i(GLint nx, GLint ny, GLint nz);
- void glNormal3fv(const GLfloat *v);
- void glNormal3f(GLfloat nx, GLfloat ny, GLfloat nz);
- void glNormal3dv(const GLdouble *v);
- void glNormal3d(GLdouble nx, GLdouble ny, GLdouble nz);
- void glNormal3bv(const GLbyte *v);
- void glNormal3b(GLbyte nx, GLbyte ny, GLbyte nz);
- void glIndexsv(const GLshort *c);
- void glIndexs(GLshort c);
- void glIndexiv(const GLint *c);
- void glIndexi(GLint c);
- void glIndexfv(const GLfloat *c);
- void glIndexf(GLfloat c);
- void glIndexdv(const GLdouble *c);
- void glIndexd(GLdouble c);
- void glEnd();
- void glEdgeFlagv(const GLboolean *flag);
- void glEdgeFlag(GLboolean flag);
- void glColor4usv(const GLushort *v);
- void glColor4us(GLushort red, GLushort green, GLushort blue, GLushort alpha);
- void glColor4uiv(const GLuint *v);
- void glColor4ui(GLuint red, GLuint green, GLuint blue, GLuint alpha);
- void glColor4ubv(const GLubyte *v);
- void glColor4ub(GLubyte red, GLubyte green, GLubyte blue, GLubyte alpha);
- void glColor4sv(const GLshort *v);
- void glColor4s(GLshort red, GLshort green, GLshort blue, GLshort alpha);
- void glColor4iv(const GLint *v);
- void glColor4i(GLint red, GLint green, GLint blue, GLint alpha);
- void glColor4fv(const GLfloat *v);
- void glColor4f(GLfloat red, GLfloat green, GLfloat blue, GLfloat alpha);
- void glColor4dv(const GLdouble *v);
- void glColor4d(GLdouble red, GLdouble green, GLdouble blue, GLdouble alpha);
- void glColor4bv(const GLbyte *v);
- void glColor4b(GLbyte red, GLbyte green, GLbyte blue, GLbyte alpha);
- void glColor3usv(const GLushort *v);
- void glColor3us(GLushort red, GLushort green, GLushort blue);
- void glColor3uiv(const GLuint *v);
- void glColor3ui(GLuint red, GLuint green, GLuint blue);
- void glColor3ubv(const GLubyte *v);
- void glColor3ub(GLubyte red, GLubyte green, GLubyte blue);
- void glColor3sv(const GLshort *v);
- void glColor3s(GLshort red, GLshort green, GLshort blue);
- void glColor3iv(const GLint *v);
- void glColor3i(GLint red, GLint green, GLint blue);
- void glColor3fv(const GLfloat *v);
- void glColor3f(GLfloat red, GLfloat green, GLfloat blue);
- void glColor3dv(const GLdouble *v);
- void glColor3d(GLdouble red, GLdouble green, GLdouble blue);
- void glColor3bv(const GLbyte *v);
- void glColor3b(GLbyte red, GLbyte green, GLbyte blue);
- void glBitmap(GLsizei width, GLsizei height, GLfloat xorig, GLfloat yorig, GLfloat xmove, GLfloat ymove, const GLubyte *bitmap);
- void glBegin(GLenum mode);
- void glListBase(GLuint base);
- GLuint glGenLists(GLsizei range);
- void glDeleteLists(GLuint list, GLsizei range);
- void glCallLists(GLsizei n, GLenum type, const GLvoid *lists);
- void glCallList(GLuint list);
- void glEndList();
- void glNewList(GLuint list, GLenum mode);
-
- // OpenGL 1.1 deprecated functions
- void glPushClientAttrib(GLbitfield mask);
- void glPopClientAttrib();
- void glPrioritizeTextures(GLsizei n, const GLuint *textures, const GLfloat *priorities);
- GLboolean glAreTexturesResident(GLsizei n, const GLuint *textures, GLboolean *residences);
- void glVertexPointer(GLint size, GLenum type, GLsizei stride, const GLvoid *pointer);
- void glTexCoordPointer(GLint size, GLenum type, GLsizei stride, const GLvoid *pointer);
- void glNormalPointer(GLenum type, GLsizei stride, const GLvoid *pointer);
- void glInterleavedArrays(GLenum format, GLsizei stride, const GLvoid *pointer);
- void glIndexPointer(GLenum type, GLsizei stride, const GLvoid *pointer);
- void glEnableClientState(GLenum array);
- void glEdgeFlagPointer(GLsizei stride, const GLvoid *pointer);
- void glDisableClientState(GLenum array);
- void glColorPointer(GLint size, GLenum type, GLsizei stride, const GLvoid *pointer);
- void glArrayElement(GLint i);
-
- // OpenGL 1.2 deprecated functions
- void glResetMinmax(GLenum target);
- void glResetHistogram(GLenum target);
- void glMinmax(GLenum target, GLenum internalformat, GLboolean sink);
- void glHistogram(GLenum target, GLsizei width, GLenum internalformat, GLboolean sink);
- void glGetMinmaxParameteriv(GLenum target, GLenum pname, GLint *params);
- void glGetMinmaxParameterfv(GLenum target, GLenum pname, GLfloat *params);
- void glGetMinmax(GLenum target, GLboolean reset, GLenum format, GLenum type, GLvoid *values);
- void glGetHistogramParameteriv(GLenum target, GLenum pname, GLint *params);
- void glGetHistogramParameterfv(GLenum target, GLenum pname, GLfloat *params);
- void glGetHistogram(GLenum target, GLboolean reset, GLenum format, GLenum type, GLvoid *values);
- void glSeparableFilter2D(GLenum target, GLenum internalformat, GLsizei width, GLsizei height, GLenum format, GLenum type, const GLvoid *row, const GLvoid *column);
- void glGetSeparableFilter(GLenum target, GLenum format, GLenum type, GLvoid *row, GLvoid *column, GLvoid *span);
- void glGetConvolutionParameteriv(GLenum target, GLenum pname, GLint *params);
- void glGetConvolutionParameterfv(GLenum target, GLenum pname, GLfloat *params);
- void glGetConvolutionFilter(GLenum target, GLenum format, GLenum type, GLvoid *image);
- void glCopyConvolutionFilter2D(GLenum target, GLenum internalformat, GLint x, GLint y, GLsizei width, GLsizei height);
- void glCopyConvolutionFilter1D(GLenum target, GLenum internalformat, GLint x, GLint y, GLsizei width);
- void glConvolutionParameteriv(GLenum target, GLenum pname, const GLint *params);
- void glConvolutionParameteri(GLenum target, GLenum pname, GLint params);
- void glConvolutionParameterfv(GLenum target, GLenum pname, const GLfloat *params);
- void glConvolutionParameterf(GLenum target, GLenum pname, GLfloat params);
- void glConvolutionFilter2D(GLenum target, GLenum internalformat, GLsizei width, GLsizei height, GLenum format, GLenum type, const GLvoid *image);
- void glConvolutionFilter1D(GLenum target, GLenum internalformat, GLsizei width, GLenum format, GLenum type, const GLvoid *image);
- void glCopyColorSubTable(GLenum target, GLsizei start, GLint x, GLint y, GLsizei width);
- void glColorSubTable(GLenum target, GLsizei start, GLsizei count, GLenum format, GLenum type, const GLvoid *data);
- void glGetColorTableParameteriv(GLenum target, GLenum pname, GLint *params);
- void glGetColorTableParameterfv(GLenum target, GLenum pname, GLfloat *params);
- void glGetColorTable(GLenum target, GLenum format, GLenum type, GLvoid *table);
- void glCopyColorTable(GLenum target, GLenum internalformat, GLint x, GLint y, GLsizei width);
- void glColorTableParameteriv(GLenum target, GLenum pname, const GLint *params);
- void glColorTableParameterfv(GLenum target, GLenum pname, const GLfloat *params);
- void glColorTable(GLenum target, GLenum internalformat, GLsizei width, GLenum format, GLenum type, const GLvoid *table);
-
- // OpenGL 1.3 deprecated functions
- void glMultTransposeMatrixd(const GLdouble *m);
- void glMultTransposeMatrixf(const GLfloat *m);
- void glLoadTransposeMatrixd(const GLdouble *m);
- void glLoadTransposeMatrixf(const GLfloat *m);
- void glMultiTexCoord4sv(GLenum target, const GLshort *v);
- void glMultiTexCoord4s(GLenum target, GLshort s, GLshort t, GLshort r, GLshort q);
- void glMultiTexCoord4iv(GLenum target, const GLint *v);
- void glMultiTexCoord4i(GLenum target, GLint s, GLint t, GLint r, GLint q);
- void glMultiTexCoord4fv(GLenum target, const GLfloat *v);
- void glMultiTexCoord4f(GLenum target, GLfloat s, GLfloat t, GLfloat r, GLfloat q);
- void glMultiTexCoord4dv(GLenum target, const GLdouble *v);
- void glMultiTexCoord4d(GLenum target, GLdouble s, GLdouble t, GLdouble r, GLdouble q);
- void glMultiTexCoord3sv(GLenum target, const GLshort *v);
- void glMultiTexCoord3s(GLenum target, GLshort s, GLshort t, GLshort r);
- void glMultiTexCoord3iv(GLenum target, const GLint *v);
- void glMultiTexCoord3i(GLenum target, GLint s, GLint t, GLint r);
- void glMultiTexCoord3fv(GLenum target, const GLfloat *v);
- void glMultiTexCoord3f(GLenum target, GLfloat s, GLfloat t, GLfloat r);
- void glMultiTexCoord3dv(GLenum target, const GLdouble *v);
- void glMultiTexCoord3d(GLenum target, GLdouble s, GLdouble t, GLdouble r);
- void glMultiTexCoord2sv(GLenum target, const GLshort *v);
- void glMultiTexCoord2s(GLenum target, GLshort s, GLshort t);
- void glMultiTexCoord2iv(GLenum target, const GLint *v);
- void glMultiTexCoord2i(GLenum target, GLint s, GLint t);
- void glMultiTexCoord2fv(GLenum target, const GLfloat *v);
- void glMultiTexCoord2f(GLenum target, GLfloat s, GLfloat t);
- void glMultiTexCoord2dv(GLenum target, const GLdouble *v);
- void glMultiTexCoord2d(GLenum target, GLdouble s, GLdouble t);
- void glMultiTexCoord1sv(GLenum target, const GLshort *v);
- void glMultiTexCoord1s(GLenum target, GLshort s);
- void glMultiTexCoord1iv(GLenum target, const GLint *v);
- void glMultiTexCoord1i(GLenum target, GLint s);
- void glMultiTexCoord1fv(GLenum target, const GLfloat *v);
- void glMultiTexCoord1f(GLenum target, GLfloat s);
- void glMultiTexCoord1dv(GLenum target, const GLdouble *v);
- void glMultiTexCoord1d(GLenum target, GLdouble s);
- void glClientActiveTexture(GLenum texture);
-
- // OpenGL 1.4 deprecated functions
- void glWindowPos3sv(const GLshort *v);
- void glWindowPos3s(GLshort x, GLshort y, GLshort z);
- void glWindowPos3iv(const GLint *v);
- void glWindowPos3i(GLint x, GLint y, GLint z);
- void glWindowPos3fv(const GLfloat *v);
- void glWindowPos3f(GLfloat x, GLfloat y, GLfloat z);
- void glWindowPos3dv(const GLdouble *v);
- void glWindowPos3d(GLdouble x, GLdouble y, GLdouble z);
- void glWindowPos2sv(const GLshort *v);
- void glWindowPos2s(GLshort x, GLshort y);
- void glWindowPos2iv(const GLint *v);
- void glWindowPos2i(GLint x, GLint y);
- void glWindowPos2fv(const GLfloat *v);
- void glWindowPos2f(GLfloat x, GLfloat y);
- void glWindowPos2dv(const GLdouble *v);
- void glWindowPos2d(GLdouble x, GLdouble y);
- void glSecondaryColorPointer(GLint size, GLenum type, GLsizei stride, const GLvoid *pointer);
- void glSecondaryColor3usv(const GLushort *v);
- void glSecondaryColor3us(GLushort red, GLushort green, GLushort blue);
- void glSecondaryColor3uiv(const GLuint *v);
- void glSecondaryColor3ui(GLuint red, GLuint green, GLuint blue);
- void glSecondaryColor3ubv(const GLubyte *v);
- void glSecondaryColor3ub(GLubyte red, GLubyte green, GLubyte blue);
- void glSecondaryColor3sv(const GLshort *v);
- void glSecondaryColor3s(GLshort red, GLshort green, GLshort blue);
- void glSecondaryColor3iv(const GLint *v);
- void glSecondaryColor3i(GLint red, GLint green, GLint blue);
- void glSecondaryColor3fv(const GLfloat *v);
- void glSecondaryColor3f(GLfloat red, GLfloat green, GLfloat blue);
- void glSecondaryColor3dv(const GLdouble *v);
- void glSecondaryColor3d(GLdouble red, GLdouble green, GLdouble blue);
- void glSecondaryColor3bv(const GLbyte *v);
- void glSecondaryColor3b(GLbyte red, GLbyte green, GLbyte blue);
- void glFogCoordPointer(GLenum type, GLsizei stride, const GLvoid *pointer);
- void glFogCoorddv(const GLdouble *coord);
- void glFogCoordd(GLdouble coord);
- void glFogCoordfv(const GLfloat *coord);
- void glFogCoordf(GLfloat coord);
-
- // OpenGL 1.5 deprecated functions
-
- // OpenGL 2.0 deprecated functions
- void glVertexAttrib4usv(GLuint index, const GLushort *v);
- void glVertexAttrib4uiv(GLuint index, const GLuint *v);
- void glVertexAttrib4ubv(GLuint index, const GLubyte *v);
- void glVertexAttrib4sv(GLuint index, const GLshort *v);
- void glVertexAttrib4s(GLuint index, GLshort x, GLshort y, GLshort z, GLshort w);
- void glVertexAttrib4iv(GLuint index, const GLint *v);
- void glVertexAttrib4fv(GLuint index, const GLfloat *v);
- void glVertexAttrib4f(GLuint index, GLfloat x, GLfloat y, GLfloat z, GLfloat w);
- void glVertexAttrib4dv(GLuint index, const GLdouble *v);
- void glVertexAttrib4d(GLuint index, GLdouble x, GLdouble y, GLdouble z, GLdouble w);
- void glVertexAttrib4bv(GLuint index, const GLbyte *v);
- void glVertexAttrib4Nusv(GLuint index, const GLushort *v);
- void glVertexAttrib4Nuiv(GLuint index, const GLuint *v);
- void glVertexAttrib4Nubv(GLuint index, const GLubyte *v);
- void glVertexAttrib4Nub(GLuint index, GLubyte x, GLubyte y, GLubyte z, GLubyte w);
- void glVertexAttrib4Nsv(GLuint index, const GLshort *v);
- void glVertexAttrib4Niv(GLuint index, const GLint *v);
- void glVertexAttrib4Nbv(GLuint index, const GLbyte *v);
- void glVertexAttrib3sv(GLuint index, const GLshort *v);
- void glVertexAttrib3s(GLuint index, GLshort x, GLshort y, GLshort z);
- void glVertexAttrib3fv(GLuint index, const GLfloat *v);
- void glVertexAttrib3f(GLuint index, GLfloat x, GLfloat y, GLfloat z);
- void glVertexAttrib3dv(GLuint index, const GLdouble *v);
- void glVertexAttrib3d(GLuint index, GLdouble x, GLdouble y, GLdouble z);
- void glVertexAttrib2sv(GLuint index, const GLshort *v);
- void glVertexAttrib2s(GLuint index, GLshort x, GLshort y);
- void glVertexAttrib2fv(GLuint index, const GLfloat *v);
- void glVertexAttrib2f(GLuint index, GLfloat x, GLfloat y);
- void glVertexAttrib2dv(GLuint index, const GLdouble *v);
- void glVertexAttrib2d(GLuint index, GLdouble x, GLdouble y);
- void glVertexAttrib1sv(GLuint index, const GLshort *v);
- void glVertexAttrib1s(GLuint index, GLshort x);
- void glVertexAttrib1fv(GLuint index, const GLfloat *v);
- void glVertexAttrib1f(GLuint index, GLfloat x);
- void glVertexAttrib1dv(GLuint index, const GLdouble *v);
- void glVertexAttrib1d(GLuint index, GLdouble x);
-
- // OpenGL 2.1 deprecated functions
-
- // OpenGL 3.0 deprecated functions
- void glVertexAttribI4usv(GLuint index, const GLushort *v);
- void glVertexAttribI4ubv(GLuint index, const GLubyte *v);
- void glVertexAttribI4sv(GLuint index, const GLshort *v);
- void glVertexAttribI4bv(GLuint index, const GLbyte *v);
- void glVertexAttribI4uiv(GLuint index, const GLuint *v);
- void glVertexAttribI3uiv(GLuint index, const GLuint *v);
- void glVertexAttribI2uiv(GLuint index, const GLuint *v);
- void glVertexAttribI1uiv(GLuint index, const GLuint *v);
- void glVertexAttribI4iv(GLuint index, const GLint *v);
- void glVertexAttribI3iv(GLuint index, const GLint *v);
- void glVertexAttribI2iv(GLuint index, const GLint *v);
- void glVertexAttribI1iv(GLuint index, const GLint *v);
- void glVertexAttribI4ui(GLuint index, GLuint x, GLuint y, GLuint z, GLuint w);
- void glVertexAttribI3ui(GLuint index, GLuint x, GLuint y, GLuint z);
- void glVertexAttribI2ui(GLuint index, GLuint x, GLuint y);
- void glVertexAttribI1ui(GLuint index, GLuint x);
- void glVertexAttribI4i(GLuint index, GLint x, GLint y, GLint z, GLint w);
- void glVertexAttribI3i(GLuint index, GLint x, GLint y, GLint z);
- void glVertexAttribI2i(GLuint index, GLint x, GLint y);
- void glVertexAttribI1i(GLuint index, GLint x);
-
- // OpenGL 3.1 deprecated functions
-
- // OpenGL 3.2 deprecated functions
-
- // OpenGL 3.3 deprecated functions
-
- // OpenGL 4.0 deprecated functions
-
- // OpenGL 4.1 deprecated functions
-
- // OpenGL 4.2 deprecated functions
-
- // OpenGL 4.3 deprecated functions
-
-private:
- friend class QOpenGLContext;
-
- static bool isContextCompatible(QOpenGLContext *context);
- static QOpenGLVersionProfile versionProfile();
-
- QOpenGLFunctions_1_0_CoreBackend* d_1_0_Core;
- QOpenGLFunctions_1_1_CoreBackend* d_1_1_Core;
- QOpenGLFunctions_1_2_CoreBackend* d_1_2_Core;
- QOpenGLFunctions_1_3_CoreBackend* d_1_3_Core;
- QOpenGLFunctions_1_4_CoreBackend* d_1_4_Core;
- QOpenGLFunctions_1_5_CoreBackend* d_1_5_Core;
- QOpenGLFunctions_2_0_CoreBackend* d_2_0_Core;
- QOpenGLFunctions_2_1_CoreBackend* d_2_1_Core;
- QOpenGLFunctions_3_0_CoreBackend* d_3_0_Core;
- QOpenGLFunctions_3_1_CoreBackend* d_3_1_Core;
- QOpenGLFunctions_3_2_CoreBackend* d_3_2_Core;
- QOpenGLFunctions_3_3_CoreBackend* d_3_3_Core;
- QOpenGLFunctions_4_0_CoreBackend* d_4_0_Core;
- QOpenGLFunctions_4_1_CoreBackend* d_4_1_Core;
- QOpenGLFunctions_4_2_CoreBackend* d_4_2_Core;
- QOpenGLFunctions_4_3_CoreBackend* d_4_3_Core;
- QOpenGLFunctions_1_0_DeprecatedBackend* d_1_0_Deprecated;
- QOpenGLFunctions_1_1_DeprecatedBackend* d_1_1_Deprecated;
- QOpenGLFunctions_1_2_DeprecatedBackend* d_1_2_Deprecated;
- QOpenGLFunctions_1_3_DeprecatedBackend* d_1_3_Deprecated;
- QOpenGLFunctions_1_4_DeprecatedBackend* d_1_4_Deprecated;
- void *m_reserved_2_0_Deprecated; // To maintain BC
- QOpenGLFunctions_3_3_DeprecatedBackend* d_3_3_Deprecated;
-};
-
-// OpenGL 1.0 core functions
-inline void QOpenGLFunctions_4_3_Compatibility::glViewport(GLint x, GLint y, GLsizei width, GLsizei height)
-{
- d_1_0_Core->f.Viewport(x, y, width, height);
-}
-
-inline void QOpenGLFunctions_4_3_Compatibility::glDepthRange(GLdouble nearVal, GLdouble farVal)
-{
- d_1_0_Core->f.DepthRange(nearVal, farVal);
-}
-
-inline GLboolean QOpenGLFunctions_4_3_Compatibility::glIsEnabled(GLenum cap)
-{
- return d_1_0_Core->f.IsEnabled(cap);
-}
-
-inline void QOpenGLFunctions_4_3_Compatibility::glGetTexLevelParameteriv(GLenum target, GLint level, GLenum pname, GLint *params)
-{
- d_1_0_Core->f.GetTexLevelParameteriv(target, level, pname, params);
-}
-
-inline void QOpenGLFunctions_4_3_Compatibility::glGetTexLevelParameterfv(GLenum target, GLint level, GLenum pname, GLfloat *params)
-{
- d_1_0_Core->f.GetTexLevelParameterfv(target, level, pname, params);
-}
-
-inline void QOpenGLFunctions_4_3_Compatibility::glGetTexParameteriv(GLenum target, GLenum pname, GLint *params)
-{
- d_1_0_Core->f.GetTexParameteriv(target, pname, params);
-}
-
-inline void QOpenGLFunctions_4_3_Compatibility::glGetTexParameterfv(GLenum target, GLenum pname, GLfloat *params)
-{
- d_1_0_Core->f.GetTexParameterfv(target, pname, params);
-}
-
-inline void QOpenGLFunctions_4_3_Compatibility::glGetTexImage(GLenum target, GLint level, GLenum format, GLenum type, GLvoid *pixels)
-{
- d_1_0_Core->f.GetTexImage(target, level, format, type, pixels);
-}
-
-inline const GLubyte * QOpenGLFunctions_4_3_Compatibility::glGetString(GLenum name)
-{
- return d_1_0_Core->f.GetString(name);
-}
-
-inline void QOpenGLFunctions_4_3_Compatibility::glGetIntegerv(GLenum pname, GLint *params)
-{
- d_1_0_Core->f.GetIntegerv(pname, params);
-}
-
-inline void QOpenGLFunctions_4_3_Compatibility::glGetFloatv(GLenum pname, GLfloat *params)
-{
- d_1_0_Core->f.GetFloatv(pname, params);
-}
-
-inline GLenum QOpenGLFunctions_4_3_Compatibility::glGetError()
-{
- return d_1_0_Core->f.GetError();
-}
-
-inline void QOpenGLFunctions_4_3_Compatibility::glGetDoublev(GLenum pname, GLdouble *params)
-{
- d_1_0_Core->f.GetDoublev(pname, params);
-}
-
-inline void QOpenGLFunctions_4_3_Compatibility::glGetBooleanv(GLenum pname, GLboolean *params)
-{
- d_1_0_Core->f.GetBooleanv(pname, params);
-}
-
-inline void QOpenGLFunctions_4_3_Compatibility::glReadPixels(GLint x, GLint y, GLsizei width, GLsizei height, GLenum format, GLenum type, GLvoid *pixels)
-{
- d_1_0_Core->f.ReadPixels(x, y, width, height, format, type, pixels);
-}
-
-inline void QOpenGLFunctions_4_3_Compatibility::glReadBuffer(GLenum mode)
-{
- d_1_0_Core->f.ReadBuffer(mode);
-}
-
-inline void QOpenGLFunctions_4_3_Compatibility::glPixelStorei(GLenum pname, GLint param)
-{
- d_1_0_Core->f.PixelStorei(pname, param);
-}
-
-inline void QOpenGLFunctions_4_3_Compatibility::glPixelStoref(GLenum pname, GLfloat param)
-{
- d_1_0_Core->f.PixelStoref(pname, param);
-}
-
-inline void QOpenGLFunctions_4_3_Compatibility::glDepthFunc(GLenum func)
-{
- d_1_0_Core->f.DepthFunc(func);
-}
-
-inline void QOpenGLFunctions_4_3_Compatibility::glStencilOp(GLenum fail, GLenum zfail, GLenum zpass)
-{
- d_1_0_Core->f.StencilOp(fail, zfail, zpass);
-}
-
-inline void QOpenGLFunctions_4_3_Compatibility::glStencilFunc(GLenum func, GLint ref, GLuint mask)
-{
- d_1_0_Core->f.StencilFunc(func, ref, mask);
-}
-
-inline void QOpenGLFunctions_4_3_Compatibility::glLogicOp(GLenum opcode)
-{
- d_1_0_Core->f.LogicOp(opcode);
-}
-
-inline void QOpenGLFunctions_4_3_Compatibility::glBlendFunc(GLenum sfactor, GLenum dfactor)
-{
- d_1_0_Core->f.BlendFunc(sfactor, dfactor);
-}
-
-inline void QOpenGLFunctions_4_3_Compatibility::glFlush()
-{
- d_1_0_Core->f.Flush();
-}
-
-inline void QOpenGLFunctions_4_3_Compatibility::glFinish()
-{
- d_1_0_Core->f.Finish();
-}
-
-inline void QOpenGLFunctions_4_3_Compatibility::glEnable(GLenum cap)
-{
- d_1_0_Core->f.Enable(cap);
-}
-
-inline void QOpenGLFunctions_4_3_Compatibility::glDisable(GLenum cap)
-{
- d_1_0_Core->f.Disable(cap);
-}
-
-inline void QOpenGLFunctions_4_3_Compatibility::glDepthMask(GLboolean flag)
-{
- d_1_0_Core->f.DepthMask(flag);
-}
-
-inline void QOpenGLFunctions_4_3_Compatibility::glColorMask(GLboolean red, GLboolean green, GLboolean blue, GLboolean alpha)
-{
- d_1_0_Core->f.ColorMask(red, green, blue, alpha);
-}
-
-inline void QOpenGLFunctions_4_3_Compatibility::glStencilMask(GLuint mask)
-{
- d_1_0_Core->f.StencilMask(mask);
-}
-
-inline void QOpenGLFunctions_4_3_Compatibility::glClearDepth(GLdouble depth)
-{
- d_1_0_Core->f.ClearDepth(depth);
-}
-
-inline void QOpenGLFunctions_4_3_Compatibility::glClearStencil(GLint s)
-{
- d_1_0_Core->f.ClearStencil(s);
-}
-
-inline void QOpenGLFunctions_4_3_Compatibility::glClearColor(GLfloat red, GLfloat green, GLfloat blue, GLfloat alpha)
-{
- d_1_0_Core->f.ClearColor(red, green, blue, alpha);
-}
-
-inline void QOpenGLFunctions_4_3_Compatibility::glClear(GLbitfield mask)
-{
- d_1_0_Core->f.Clear(mask);
-}
-
-inline void QOpenGLFunctions_4_3_Compatibility::glDrawBuffer(GLenum mode)
-{
- d_1_0_Core->f.DrawBuffer(mode);
-}
-
-inline void QOpenGLFunctions_4_3_Compatibility::glTexImage2D(GLenum target, GLint level, GLint internalformat, GLsizei width, GLsizei height, GLint border, GLenum format, GLenum type, const GLvoid *pixels)
-{
- d_1_0_Core->f.TexImage2D(target, level, internalformat, width, height, border, format, type, pixels);
-}
-
-inline void QOpenGLFunctions_4_3_Compatibility::glTexImage1D(GLenum target, GLint level, GLint internalformat, GLsizei width, GLint border, GLenum format, GLenum type, const GLvoid *pixels)
-{
- d_1_0_Core->f.TexImage1D(target, level, internalformat, width, border, format, type, pixels);
-}
-
-inline void QOpenGLFunctions_4_3_Compatibility::glTexParameteriv(GLenum target, GLenum pname, const GLint *params)
-{
- d_1_0_Core->f.TexParameteriv(target, pname, params);
-}
-
-inline void QOpenGLFunctions_4_3_Compatibility::glTexParameteri(GLenum target, GLenum pname, GLint param)
-{
- d_1_0_Core->f.TexParameteri(target, pname, param);
-}
-
-inline void QOpenGLFunctions_4_3_Compatibility::glTexParameterfv(GLenum target, GLenum pname, const GLfloat *params)
-{
- d_1_0_Core->f.TexParameterfv(target, pname, params);
-}
-
-inline void QOpenGLFunctions_4_3_Compatibility::glTexParameterf(GLenum target, GLenum pname, GLfloat param)
-{
- d_1_0_Core->f.TexParameterf(target, pname, param);
-}
-
-inline void QOpenGLFunctions_4_3_Compatibility::glScissor(GLint x, GLint y, GLsizei width, GLsizei height)
-{
- d_1_0_Core->f.Scissor(x, y, width, height);
-}
-
-inline void QOpenGLFunctions_4_3_Compatibility::glPolygonMode(GLenum face, GLenum mode)
-{
- d_1_0_Core->f.PolygonMode(face, mode);
-}
-
-inline void QOpenGLFunctions_4_3_Compatibility::glPointSize(GLfloat size)
-{
- d_1_0_Core->f.PointSize(size);
-}
-
-inline void QOpenGLFunctions_4_3_Compatibility::glLineWidth(GLfloat width)
-{
- d_1_0_Core->f.LineWidth(width);
-}
-
-inline void QOpenGLFunctions_4_3_Compatibility::glHint(GLenum target, GLenum mode)
-{
- d_1_0_Core->f.Hint(target, mode);
-}
-
-inline void QOpenGLFunctions_4_3_Compatibility::glFrontFace(GLenum mode)
-{
- d_1_0_Core->f.FrontFace(mode);
-}
-
-inline void QOpenGLFunctions_4_3_Compatibility::glCullFace(GLenum mode)
-{
- d_1_0_Core->f.CullFace(mode);
-}
-
-
-// OpenGL 1.1 core functions
-inline void QOpenGLFunctions_4_3_Compatibility::glIndexubv(const GLubyte *c)
-{
- d_1_1_Deprecated->f.Indexubv(c);
-}
-
-inline void QOpenGLFunctions_4_3_Compatibility::glIndexub(GLubyte c)
-{
- d_1_1_Deprecated->f.Indexub(c);
-}
-
-inline GLboolean QOpenGLFunctions_4_3_Compatibility::glIsTexture(GLuint texture)
-{
- return d_1_1_Core->f.IsTexture(texture);
-}
-
-inline void QOpenGLFunctions_4_3_Compatibility::glGenTextures(GLsizei n, GLuint *textures)
-{
- d_1_1_Core->f.GenTextures(n, textures);
-}
-
-inline void QOpenGLFunctions_4_3_Compatibility::glDeleteTextures(GLsizei n, const GLuint *textures)
-{
- d_1_1_Core->f.DeleteTextures(n, textures);
-}
-
-inline void QOpenGLFunctions_4_3_Compatibility::glBindTexture(GLenum target, GLuint texture)
-{
- d_1_1_Core->f.BindTexture(target, texture);
-}
-
-inline void QOpenGLFunctions_4_3_Compatibility::glTexSubImage2D(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLenum type, const GLvoid *pixels)
-{
- d_1_1_Core->f.TexSubImage2D(target, level, xoffset, yoffset, width, height, format, type, pixels);
-}
-
-inline void QOpenGLFunctions_4_3_Compatibility::glTexSubImage1D(GLenum target, GLint level, GLint xoffset, GLsizei width, GLenum format, GLenum type, const GLvoid *pixels)
-{
- d_1_1_Core->f.TexSubImage1D(target, level, xoffset, width, format, type, pixels);
-}
-
-inline void QOpenGLFunctions_4_3_Compatibility::glCopyTexSubImage2D(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint x, GLint y, GLsizei width, GLsizei height)
-{
- d_1_1_Core->f.CopyTexSubImage2D(target, level, xoffset, yoffset, x, y, width, height);
-}
-
-inline void QOpenGLFunctions_4_3_Compatibility::glCopyTexSubImage1D(GLenum target, GLint level, GLint xoffset, GLint x, GLint y, GLsizei width)
-{
- d_1_1_Core->f.CopyTexSubImage1D(target, level, xoffset, x, y, width);
-}
-
-inline void QOpenGLFunctions_4_3_Compatibility::glCopyTexImage2D(GLenum target, GLint level, GLenum internalformat, GLint x, GLint y, GLsizei width, GLsizei height, GLint border)
-{
- d_1_1_Core->f.CopyTexImage2D(target, level, internalformat, x, y, width, height, border);
-}
-
-inline void QOpenGLFunctions_4_3_Compatibility::glCopyTexImage1D(GLenum target, GLint level, GLenum internalformat, GLint x, GLint y, GLsizei width, GLint border)
-{
- d_1_1_Core->f.CopyTexImage1D(target, level, internalformat, x, y, width, border);
-}
-
-inline void QOpenGLFunctions_4_3_Compatibility::glPolygonOffset(GLfloat factor, GLfloat units)
-{
- d_1_1_Core->f.PolygonOffset(factor, units);
-}
-
-inline void QOpenGLFunctions_4_3_Compatibility::glGetPointerv(GLenum pname, GLvoid* *params)
-{
- d_1_1_Deprecated->f.GetPointerv(pname, params);
-}
-
-inline void QOpenGLFunctions_4_3_Compatibility::glDrawElements(GLenum mode, GLsizei count, GLenum type, const GLvoid *indices)
-{
- d_1_1_Core->f.DrawElements(mode, count, type, indices);
-}
-
-inline void QOpenGLFunctions_4_3_Compatibility::glDrawArrays(GLenum mode, GLint first, GLsizei count)
-{
- d_1_1_Core->f.DrawArrays(mode, first, count);
-}
-
-
-// OpenGL 1.2 core functions
-inline void QOpenGLFunctions_4_3_Compatibility::glCopyTexSubImage3D(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLint x, GLint y, GLsizei width, GLsizei height)
-{
- d_1_2_Core->f.CopyTexSubImage3D(target, level, xoffset, yoffset, zoffset, x, y, width, height);
-}
-
-inline void QOpenGLFunctions_4_3_Compatibility::glTexSubImage3D(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLenum type, const GLvoid *pixels)
-{
- d_1_2_Core->f.TexSubImage3D(target, level, xoffset, yoffset, zoffset, width, height, depth, format, type, pixels);
-}
-
-inline void QOpenGLFunctions_4_3_Compatibility::glTexImage3D(GLenum target, GLint level, GLint internalformat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLenum format, GLenum type, const GLvoid *pixels)
-{
- d_1_2_Core->f.TexImage3D(target, level, internalformat, width, height, depth, border, format, type, pixels);
-}
-
-inline void QOpenGLFunctions_4_3_Compatibility::glDrawRangeElements(GLenum mode, GLuint start, GLuint end, GLsizei count, GLenum type, const GLvoid *indices)
-{
- d_1_2_Core->f.DrawRangeElements(mode, start, end, count, type, indices);
-}
-
-inline void QOpenGLFunctions_4_3_Compatibility::glBlendEquation(GLenum mode)
-{
- d_1_2_Core->f.BlendEquation(mode);
-}
-
-inline void QOpenGLFunctions_4_3_Compatibility::glBlendColor(GLfloat red, GLfloat green, GLfloat blue, GLfloat alpha)
-{
- d_1_2_Core->f.BlendColor(red, green, blue, alpha);
-}
-
-
-// OpenGL 1.3 core functions
-inline void QOpenGLFunctions_4_3_Compatibility::glGetCompressedTexImage(GLenum target, GLint level, GLvoid *img)
-{
- d_1_3_Core->f.GetCompressedTexImage(target, level, img);
-}
-
-inline void QOpenGLFunctions_4_3_Compatibility::glCompressedTexSubImage1D(GLenum target, GLint level, GLint xoffset, GLsizei width, GLenum format, GLsizei imageSize, const GLvoid *data)
-{
- d_1_3_Core->f.CompressedTexSubImage1D(target, level, xoffset, width, format, imageSize, data);
-}
-
-inline void QOpenGLFunctions_4_3_Compatibility::glCompressedTexSubImage2D(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLsizei imageSize, const GLvoid *data)
-{
- d_1_3_Core->f.CompressedTexSubImage2D(target, level, xoffset, yoffset, width, height, format, imageSize, data);
-}
-
-inline void QOpenGLFunctions_4_3_Compatibility::glCompressedTexSubImage3D(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLsizei imageSize, const GLvoid *data)
-{
- d_1_3_Core->f.CompressedTexSubImage3D(target, level, xoffset, yoffset, zoffset, width, height, depth, format, imageSize, data);
-}
-
-inline void QOpenGLFunctions_4_3_Compatibility::glCompressedTexImage1D(GLenum target, GLint level, GLenum internalformat, GLsizei width, GLint border, GLsizei imageSize, const GLvoid *data)
-{
- d_1_3_Core->f.CompressedTexImage1D(target, level, internalformat, width, border, imageSize, data);
-}
-
-inline void QOpenGLFunctions_4_3_Compatibility::glCompressedTexImage2D(GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLint border, GLsizei imageSize, const GLvoid *data)
-{
- d_1_3_Core->f.CompressedTexImage2D(target, level, internalformat, width, height, border, imageSize, data);
-}
-
-inline void QOpenGLFunctions_4_3_Compatibility::glCompressedTexImage3D(GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLsizei imageSize, const GLvoid *data)
-{
- d_1_3_Core->f.CompressedTexImage3D(target, level, internalformat, width, height, depth, border, imageSize, data);
-}
-
-inline void QOpenGLFunctions_4_3_Compatibility::glSampleCoverage(GLfloat value, GLboolean invert)
-{
- d_1_3_Core->f.SampleCoverage(value, invert);
-}
-
-inline void QOpenGLFunctions_4_3_Compatibility::glActiveTexture(GLenum texture)
-{
- d_1_3_Core->f.ActiveTexture(texture);
-}
-
-
-// OpenGL 1.4 core functions
-inline void QOpenGLFunctions_4_3_Compatibility::glPointParameteriv(GLenum pname, const GLint *params)
-{
- d_1_4_Core->f.PointParameteriv(pname, params);
-}
-
-inline void QOpenGLFunctions_4_3_Compatibility::glPointParameteri(GLenum pname, GLint param)
-{
- d_1_4_Core->f.PointParameteri(pname, param);
-}
-
-inline void QOpenGLFunctions_4_3_Compatibility::glPointParameterfv(GLenum pname, const GLfloat *params)
-{
- d_1_4_Core->f.PointParameterfv(pname, params);
-}
-
-inline void QOpenGLFunctions_4_3_Compatibility::glPointParameterf(GLenum pname, GLfloat param)
-{
- d_1_4_Core->f.PointParameterf(pname, param);
-}
-
-inline void QOpenGLFunctions_4_3_Compatibility::glMultiDrawElements(GLenum mode, const GLsizei *count, GLenum type, const GLvoid* const *indices, GLsizei drawcount)
-{
- d_1_4_Core->f.MultiDrawElements(mode, count, type, indices, drawcount);
-}
-
-inline void QOpenGLFunctions_4_3_Compatibility::glMultiDrawArrays(GLenum mode, const GLint *first, const GLsizei *count, GLsizei drawcount)
-{
- d_1_4_Core->f.MultiDrawArrays(mode, first, count, drawcount);
-}
-
-inline void QOpenGLFunctions_4_3_Compatibility::glBlendFuncSeparate(GLenum sfactorRGB, GLenum dfactorRGB, GLenum sfactorAlpha, GLenum dfactorAlpha)
-{
- d_1_4_Core->f.BlendFuncSeparate(sfactorRGB, dfactorRGB, sfactorAlpha, dfactorAlpha);
-}
-
-
-// OpenGL 1.5 core functions
-inline void QOpenGLFunctions_4_3_Compatibility::glGetBufferPointerv(GLenum target, GLenum pname, GLvoid* *params)
-{
- d_1_5_Core->f.GetBufferPointerv(target, pname, params);
-}
-
-inline void QOpenGLFunctions_4_3_Compatibility::glGetBufferParameteriv(GLenum target, GLenum pname, GLint *params)
-{
- d_1_5_Core->f.GetBufferParameteriv(target, pname, params);
-}
-
-inline GLboolean QOpenGLFunctions_4_3_Compatibility::glUnmapBuffer(GLenum target)
-{
- return d_1_5_Core->f.UnmapBuffer(target);
-}
-
-inline GLvoid* QOpenGLFunctions_4_3_Compatibility::glMapBuffer(GLenum target, GLenum access)
-{
- return d_1_5_Core->f.MapBuffer(target, access);
-}
-
-inline void QOpenGLFunctions_4_3_Compatibility::glGetBufferSubData(GLenum target, GLintptr offset, GLsizeiptr size, GLvoid *data)
-{
- d_1_5_Core->f.GetBufferSubData(target, offset, size, data);
-}
-
-inline void QOpenGLFunctions_4_3_Compatibility::glBufferSubData(GLenum target, GLintptr offset, GLsizeiptr size, const GLvoid *data)
-{
- d_1_5_Core->f.BufferSubData(target, offset, size, data);
-}
-
-inline void QOpenGLFunctions_4_3_Compatibility::glBufferData(GLenum target, GLsizeiptr size, const GLvoid *data, GLenum usage)
-{
- d_1_5_Core->f.BufferData(target, size, data, usage);
-}
-
-inline GLboolean QOpenGLFunctions_4_3_Compatibility::glIsBuffer(GLuint buffer)
-{
- return d_1_5_Core->f.IsBuffer(buffer);
-}
-
-inline void QOpenGLFunctions_4_3_Compatibility::glGenBuffers(GLsizei n, GLuint *buffers)
-{
- d_1_5_Core->f.GenBuffers(n, buffers);
-}
-
-inline void QOpenGLFunctions_4_3_Compatibility::glDeleteBuffers(GLsizei n, const GLuint *buffers)
-{
- d_1_5_Core->f.DeleteBuffers(n, buffers);
-}
-
-inline void QOpenGLFunctions_4_3_Compatibility::glBindBuffer(GLenum target, GLuint buffer)
-{
- d_1_5_Core->f.BindBuffer(target, buffer);
-}
-
-inline void QOpenGLFunctions_4_3_Compatibility::glGetQueryObjectuiv(GLuint id, GLenum pname, GLuint *params)
-{
- d_1_5_Core->f.GetQueryObjectuiv(id, pname, params);
-}
-
-inline void QOpenGLFunctions_4_3_Compatibility::glGetQueryObjectiv(GLuint id, GLenum pname, GLint *params)
-{
- d_1_5_Core->f.GetQueryObjectiv(id, pname, params);
-}
-
-inline void QOpenGLFunctions_4_3_Compatibility::glGetQueryiv(GLenum target, GLenum pname, GLint *params)
-{
- d_1_5_Core->f.GetQueryiv(target, pname, params);
-}
-
-inline void QOpenGLFunctions_4_3_Compatibility::glEndQuery(GLenum target)
-{
- d_1_5_Core->f.EndQuery(target);
-}
-
-inline void QOpenGLFunctions_4_3_Compatibility::glBeginQuery(GLenum target, GLuint id)
-{
- d_1_5_Core->f.BeginQuery(target, id);
-}
-
-inline GLboolean QOpenGLFunctions_4_3_Compatibility::glIsQuery(GLuint id)
-{
- return d_1_5_Core->f.IsQuery(id);
-}
-
-inline void QOpenGLFunctions_4_3_Compatibility::glDeleteQueries(GLsizei n, const GLuint *ids)
-{
- d_1_5_Core->f.DeleteQueries(n, ids);
-}
-
-inline void QOpenGLFunctions_4_3_Compatibility::glGenQueries(GLsizei n, GLuint *ids)
-{
- d_1_5_Core->f.GenQueries(n, ids);
-}
-
-
-// OpenGL 2.0 core functions
-inline void QOpenGLFunctions_4_3_Compatibility::glVertexAttribPointer(GLuint index, GLint size, GLenum type, GLboolean normalized, GLsizei stride, const GLvoid *pointer)
-{
- d_2_0_Core->f.VertexAttribPointer(index, size, type, normalized, stride, pointer);
-}
-
-inline void QOpenGLFunctions_4_3_Compatibility::glValidateProgram(GLuint program)
-{
- d_2_0_Core->f.ValidateProgram(program);
-}
-
-inline void QOpenGLFunctions_4_3_Compatibility::glUniformMatrix4fv(GLint location, GLsizei count, GLboolean transpose, const GLfloat *value)
-{
- d_2_0_Core->f.UniformMatrix4fv(location, count, transpose, value);
-}
-
-inline void QOpenGLFunctions_4_3_Compatibility::glUniformMatrix3fv(GLint location, GLsizei count, GLboolean transpose, const GLfloat *value)
-{
- d_2_0_Core->f.UniformMatrix3fv(location, count, transpose, value);
-}
-
-inline void QOpenGLFunctions_4_3_Compatibility::glUniformMatrix2fv(GLint location, GLsizei count, GLboolean transpose, const GLfloat *value)
-{
- d_2_0_Core->f.UniformMatrix2fv(location, count, transpose, value);
-}
-
-inline void QOpenGLFunctions_4_3_Compatibility::glUniform4iv(GLint location, GLsizei count, const GLint *value)
-{
- d_2_0_Core->f.Uniform4iv(location, count, value);
-}
-
-inline void QOpenGLFunctions_4_3_Compatibility::glUniform3iv(GLint location, GLsizei count, const GLint *value)
-{
- d_2_0_Core->f.Uniform3iv(location, count, value);
-}
-
-inline void QOpenGLFunctions_4_3_Compatibility::glUniform2iv(GLint location, GLsizei count, const GLint *value)
-{
- d_2_0_Core->f.Uniform2iv(location, count, value);
-}
-
-inline void QOpenGLFunctions_4_3_Compatibility::glUniform1iv(GLint location, GLsizei count, const GLint *value)
-{
- d_2_0_Core->f.Uniform1iv(location, count, value);
-}
-
-inline void QOpenGLFunctions_4_3_Compatibility::glUniform4fv(GLint location, GLsizei count, const GLfloat *value)
-{
- d_2_0_Core->f.Uniform4fv(location, count, value);
-}
-
-inline void QOpenGLFunctions_4_3_Compatibility::glUniform3fv(GLint location, GLsizei count, const GLfloat *value)
-{
- d_2_0_Core->f.Uniform3fv(location, count, value);
-}
-
-inline void QOpenGLFunctions_4_3_Compatibility::glUniform2fv(GLint location, GLsizei count, const GLfloat *value)
-{
- d_2_0_Core->f.Uniform2fv(location, count, value);
-}
-
-inline void QOpenGLFunctions_4_3_Compatibility::glUniform1fv(GLint location, GLsizei count, const GLfloat *value)
-{
- d_2_0_Core->f.Uniform1fv(location, count, value);
-}
-
-inline void QOpenGLFunctions_4_3_Compatibility::glUniform4i(GLint location, GLint v0, GLint v1, GLint v2, GLint v3)
-{
- d_2_0_Core->f.Uniform4i(location, v0, v1, v2, v3);
-}
-
-inline void QOpenGLFunctions_4_3_Compatibility::glUniform3i(GLint location, GLint v0, GLint v1, GLint v2)
-{
- d_2_0_Core->f.Uniform3i(location, v0, v1, v2);
-}
-
-inline void QOpenGLFunctions_4_3_Compatibility::glUniform2i(GLint location, GLint v0, GLint v1)
-{
- d_2_0_Core->f.Uniform2i(location, v0, v1);
-}
-
-inline void QOpenGLFunctions_4_3_Compatibility::glUniform1i(GLint location, GLint v0)
-{
- d_2_0_Core->f.Uniform1i(location, v0);
-}
-
-inline void QOpenGLFunctions_4_3_Compatibility::glUniform4f(GLint location, GLfloat v0, GLfloat v1, GLfloat v2, GLfloat v3)
-{
- d_2_0_Core->f.Uniform4f(location, v0, v1, v2, v3);
-}
-
-inline void QOpenGLFunctions_4_3_Compatibility::glUniform3f(GLint location, GLfloat v0, GLfloat v1, GLfloat v2)
-{
- d_2_0_Core->f.Uniform3f(location, v0, v1, v2);
-}
-
-inline void QOpenGLFunctions_4_3_Compatibility::glUniform2f(GLint location, GLfloat v0, GLfloat v1)
-{
- d_2_0_Core->f.Uniform2f(location, v0, v1);
-}
-
-inline void QOpenGLFunctions_4_3_Compatibility::glUniform1f(GLint location, GLfloat v0)
-{
- d_2_0_Core->f.Uniform1f(location, v0);
-}
-
-inline void QOpenGLFunctions_4_3_Compatibility::glUseProgram(GLuint program)
-{
- d_2_0_Core->f.UseProgram(program);
-}
-
-inline void QOpenGLFunctions_4_3_Compatibility::glShaderSource(GLuint shader, GLsizei count, const GLchar* const *string, const GLint *length)
-{
- d_2_0_Core->f.ShaderSource(shader, count, string, length);
-}
-
-inline void QOpenGLFunctions_4_3_Compatibility::glLinkProgram(GLuint program)
-{
- d_2_0_Core->f.LinkProgram(program);
-}
-
-inline GLboolean QOpenGLFunctions_4_3_Compatibility::glIsShader(GLuint shader)
-{
- return d_2_0_Core->f.IsShader(shader);
-}
-
-inline GLboolean QOpenGLFunctions_4_3_Compatibility::glIsProgram(GLuint program)
-{
- return d_2_0_Core->f.IsProgram(program);
-}
-
-inline void QOpenGLFunctions_4_3_Compatibility::glGetVertexAttribPointerv(GLuint index, GLenum pname, GLvoid* *pointer)
-{
- d_2_0_Core->f.GetVertexAttribPointerv(index, pname, pointer);
-}
-
-inline void QOpenGLFunctions_4_3_Compatibility::glGetVertexAttribiv(GLuint index, GLenum pname, GLint *params)
-{
- d_2_0_Core->f.GetVertexAttribiv(index, pname, params);
-}
-
-inline void QOpenGLFunctions_4_3_Compatibility::glGetVertexAttribfv(GLuint index, GLenum pname, GLfloat *params)
-{
- d_2_0_Core->f.GetVertexAttribfv(index, pname, params);
-}
-
-inline void QOpenGLFunctions_4_3_Compatibility::glGetVertexAttribdv(GLuint index, GLenum pname, GLdouble *params)
-{
- d_2_0_Core->f.GetVertexAttribdv(index, pname, params);
-}
-
-inline void QOpenGLFunctions_4_3_Compatibility::glGetUniformiv(GLuint program, GLint location, GLint *params)
-{
- d_2_0_Core->f.GetUniformiv(program, location, params);
-}
-
-inline void QOpenGLFunctions_4_3_Compatibility::glGetUniformfv(GLuint program, GLint location, GLfloat *params)
-{
- d_2_0_Core->f.GetUniformfv(program, location, params);
-}
-
-inline GLint QOpenGLFunctions_4_3_Compatibility::glGetUniformLocation(GLuint program, const GLchar *name)
-{
- return d_2_0_Core->f.GetUniformLocation(program, name);
-}
-
-inline void QOpenGLFunctions_4_3_Compatibility::glGetShaderSource(GLuint shader, GLsizei bufSize, GLsizei *length, GLchar *source)
-{
- d_2_0_Core->f.GetShaderSource(shader, bufSize, length, source);
-}
-
-inline void QOpenGLFunctions_4_3_Compatibility::glGetShaderInfoLog(GLuint shader, GLsizei bufSize, GLsizei *length, GLchar *infoLog)
-{
- d_2_0_Core->f.GetShaderInfoLog(shader, bufSize, length, infoLog);
-}
-
-inline void QOpenGLFunctions_4_3_Compatibility::glGetShaderiv(GLuint shader, GLenum pname, GLint *params)
-{
- d_2_0_Core->f.GetShaderiv(shader, pname, params);
-}
-
-inline void QOpenGLFunctions_4_3_Compatibility::glGetProgramInfoLog(GLuint program, GLsizei bufSize, GLsizei *length, GLchar *infoLog)
-{
- d_2_0_Core->f.GetProgramInfoLog(program, bufSize, length, infoLog);
-}
-
-inline void QOpenGLFunctions_4_3_Compatibility::glGetProgramiv(GLuint program, GLenum pname, GLint *params)
-{
- d_2_0_Core->f.GetProgramiv(program, pname, params);
-}
-
-inline GLint QOpenGLFunctions_4_3_Compatibility::glGetAttribLocation(GLuint program, const GLchar *name)
-{
- return d_2_0_Core->f.GetAttribLocation(program, name);
-}
-
-inline void QOpenGLFunctions_4_3_Compatibility::glGetAttachedShaders(GLuint program, GLsizei maxCount, GLsizei *count, GLuint *obj)
-{
- d_2_0_Core->f.GetAttachedShaders(program, maxCount, count, obj);
-}
-
-inline void QOpenGLFunctions_4_3_Compatibility::glGetActiveUniform(GLuint program, GLuint index, GLsizei bufSize, GLsizei *length, GLint *size, GLenum *type, GLchar *name)
-{
- d_2_0_Core->f.GetActiveUniform(program, index, bufSize, length, size, type, name);
-}
-
-inline void QOpenGLFunctions_4_3_Compatibility::glGetActiveAttrib(GLuint program, GLuint index, GLsizei bufSize, GLsizei *length, GLint *size, GLenum *type, GLchar *name)
-{
- d_2_0_Core->f.GetActiveAttrib(program, index, bufSize, length, size, type, name);
-}
-
-inline void QOpenGLFunctions_4_3_Compatibility::glEnableVertexAttribArray(GLuint index)
-{
- d_2_0_Core->f.EnableVertexAttribArray(index);
-}
-
-inline void QOpenGLFunctions_4_3_Compatibility::glDisableVertexAttribArray(GLuint index)
-{
- d_2_0_Core->f.DisableVertexAttribArray(index);
-}
-
-inline void QOpenGLFunctions_4_3_Compatibility::glDetachShader(GLuint program, GLuint shader)
-{
- d_2_0_Core->f.DetachShader(program, shader);
-}
-
-inline void QOpenGLFunctions_4_3_Compatibility::glDeleteShader(GLuint shader)
-{
- d_2_0_Core->f.DeleteShader(shader);
-}
-
-inline void QOpenGLFunctions_4_3_Compatibility::glDeleteProgram(GLuint program)
-{
- d_2_0_Core->f.DeleteProgram(program);
-}
-
-inline GLuint QOpenGLFunctions_4_3_Compatibility::glCreateShader(GLenum type)
-{
- return d_2_0_Core->f.CreateShader(type);
-}
-
-inline GLuint QOpenGLFunctions_4_3_Compatibility::glCreateProgram()
-{
- return d_2_0_Core->f.CreateProgram();
-}
-
-inline void QOpenGLFunctions_4_3_Compatibility::glCompileShader(GLuint shader)
-{
- d_2_0_Core->f.CompileShader(shader);
-}
-
-inline void QOpenGLFunctions_4_3_Compatibility::glBindAttribLocation(GLuint program, GLuint index, const GLchar *name)
-{
- d_2_0_Core->f.BindAttribLocation(program, index, name);
-}
-
-inline void QOpenGLFunctions_4_3_Compatibility::glAttachShader(GLuint program, GLuint shader)
-{
- d_2_0_Core->f.AttachShader(program, shader);
-}
-
-inline void QOpenGLFunctions_4_3_Compatibility::glStencilMaskSeparate(GLenum face, GLuint mask)
-{
- d_2_0_Core->f.StencilMaskSeparate(face, mask);
-}
-
-inline void QOpenGLFunctions_4_3_Compatibility::glStencilFuncSeparate(GLenum face, GLenum func, GLint ref, GLuint mask)
-{
- d_2_0_Core->f.StencilFuncSeparate(face, func, ref, mask);
-}
-
-inline void QOpenGLFunctions_4_3_Compatibility::glStencilOpSeparate(GLenum face, GLenum sfail, GLenum dpfail, GLenum dppass)
-{
- d_2_0_Core->f.StencilOpSeparate(face, sfail, dpfail, dppass);
-}
-
-inline void QOpenGLFunctions_4_3_Compatibility::glDrawBuffers(GLsizei n, const GLenum *bufs)
-{
- d_2_0_Core->f.DrawBuffers(n, bufs);
-}
-
-inline void QOpenGLFunctions_4_3_Compatibility::glBlendEquationSeparate(GLenum modeRGB, GLenum modeAlpha)
-{
- d_2_0_Core->f.BlendEquationSeparate(modeRGB, modeAlpha);
-}
-
-
-// OpenGL 2.1 core functions
-inline void QOpenGLFunctions_4_3_Compatibility::glUniformMatrix4x3fv(GLint location, GLsizei count, GLboolean transpose, const GLfloat *value)
-{
- d_2_1_Core->f.UniformMatrix4x3fv(location, count, transpose, value);
-}
-
-inline void QOpenGLFunctions_4_3_Compatibility::glUniformMatrix3x4fv(GLint location, GLsizei count, GLboolean transpose, const GLfloat *value)
-{
- d_2_1_Core->f.UniformMatrix3x4fv(location, count, transpose, value);
-}
-
-inline void QOpenGLFunctions_4_3_Compatibility::glUniformMatrix4x2fv(GLint location, GLsizei count, GLboolean transpose, const GLfloat *value)
-{
- d_2_1_Core->f.UniformMatrix4x2fv(location, count, transpose, value);
-}
-
-inline void QOpenGLFunctions_4_3_Compatibility::glUniformMatrix2x4fv(GLint location, GLsizei count, GLboolean transpose, const GLfloat *value)
-{
- d_2_1_Core->f.UniformMatrix2x4fv(location, count, transpose, value);
-}
-
-inline void QOpenGLFunctions_4_3_Compatibility::glUniformMatrix3x2fv(GLint location, GLsizei count, GLboolean transpose, const GLfloat *value)
-{
- d_2_1_Core->f.UniformMatrix3x2fv(location, count, transpose, value);
-}
-
-inline void QOpenGLFunctions_4_3_Compatibility::glUniformMatrix2x3fv(GLint location, GLsizei count, GLboolean transpose, const GLfloat *value)
-{
- d_2_1_Core->f.UniformMatrix2x3fv(location, count, transpose, value);
-}
-
-
-// OpenGL 3.0 core functions
-inline GLboolean QOpenGLFunctions_4_3_Compatibility::glIsVertexArray(GLuint array)
-{
- return d_3_0_Core->f.IsVertexArray(array);
-}
-
-inline void QOpenGLFunctions_4_3_Compatibility::glGenVertexArrays(GLsizei n, GLuint *arrays)
-{
- d_3_0_Core->f.GenVertexArrays(n, arrays);
-}
-
-inline void QOpenGLFunctions_4_3_Compatibility::glDeleteVertexArrays(GLsizei n, const GLuint *arrays)
-{
- d_3_0_Core->f.DeleteVertexArrays(n, arrays);
-}
-
-inline void QOpenGLFunctions_4_3_Compatibility::glBindVertexArray(GLuint array)
-{
- d_3_0_Core->f.BindVertexArray(array);
-}
-
-inline void QOpenGLFunctions_4_3_Compatibility::glFlushMappedBufferRange(GLenum target, GLintptr offset, GLsizeiptr length)
-{
- d_3_0_Core->f.FlushMappedBufferRange(target, offset, length);
-}
-
-inline GLvoid* QOpenGLFunctions_4_3_Compatibility::glMapBufferRange(GLenum target, GLintptr offset, GLsizeiptr length, GLbitfield access)
-{
- return d_3_0_Core->f.MapBufferRange(target, offset, length, access);
-}
-
-inline void QOpenGLFunctions_4_3_Compatibility::glFramebufferTextureLayer(GLenum target, GLenum attachment, GLuint texture, GLint level, GLint layer)
-{
- d_3_0_Core->f.FramebufferTextureLayer(target, attachment, texture, level, layer);
-}
-
-inline void QOpenGLFunctions_4_3_Compatibility::glRenderbufferStorageMultisample(GLenum target, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height)
-{
- d_3_0_Core->f.RenderbufferStorageMultisample(target, samples, internalformat, width, height);
-}
-
-inline void QOpenGLFunctions_4_3_Compatibility::glBlitFramebuffer(GLint srcX0, GLint srcY0, GLint srcX1, GLint srcY1, GLint dstX0, GLint dstY0, GLint dstX1, GLint dstY1, GLbitfield mask, GLenum filter)
-{
- d_3_0_Core->f.BlitFramebuffer(srcX0, srcY0, srcX1, srcY1, dstX0, dstY0, dstX1, dstY1, mask, filter);
-}
-
-inline void QOpenGLFunctions_4_3_Compatibility::glGenerateMipmap(GLenum target)
-{
- d_3_0_Core->f.GenerateMipmap(target);
-}
-
-inline void QOpenGLFunctions_4_3_Compatibility::glGetFramebufferAttachmentParameteriv(GLenum target, GLenum attachment, GLenum pname, GLint *params)
-{
- d_3_0_Core->f.GetFramebufferAttachmentParameteriv(target, attachment, pname, params);
-}
-
-inline void QOpenGLFunctions_4_3_Compatibility::glFramebufferRenderbuffer(GLenum target, GLenum attachment, GLenum renderbuffertarget, GLuint renderbuffer)
-{
- d_3_0_Core->f.FramebufferRenderbuffer(target, attachment, renderbuffertarget, renderbuffer);
-}
-
-inline void QOpenGLFunctions_4_3_Compatibility::glFramebufferTexture3D(GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level, GLint zoffset)
-{
- d_3_0_Core->f.FramebufferTexture3D(target, attachment, textarget, texture, level, zoffset);
-}
-
-inline void QOpenGLFunctions_4_3_Compatibility::glFramebufferTexture2D(GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level)
-{
- d_3_0_Core->f.FramebufferTexture2D(target, attachment, textarget, texture, level);
-}
-
-inline void QOpenGLFunctions_4_3_Compatibility::glFramebufferTexture1D(GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level)
-{
- d_3_0_Core->f.FramebufferTexture1D(target, attachment, textarget, texture, level);
-}
-
-inline GLenum QOpenGLFunctions_4_3_Compatibility::glCheckFramebufferStatus(GLenum target)
-{
- return d_3_0_Core->f.CheckFramebufferStatus(target);
-}
-
-inline void QOpenGLFunctions_4_3_Compatibility::glGenFramebuffers(GLsizei n, GLuint *framebuffers)
-{
- d_3_0_Core->f.GenFramebuffers(n, framebuffers);
-}
-
-inline void QOpenGLFunctions_4_3_Compatibility::glDeleteFramebuffers(GLsizei n, const GLuint *framebuffers)
-{
- d_3_0_Core->f.DeleteFramebuffers(n, framebuffers);
-}
-
-inline void QOpenGLFunctions_4_3_Compatibility::glBindFramebuffer(GLenum target, GLuint framebuffer)
-{
- d_3_0_Core->f.BindFramebuffer(target, framebuffer);
-}
-
-inline GLboolean QOpenGLFunctions_4_3_Compatibility::glIsFramebuffer(GLuint framebuffer)
-{
- return d_3_0_Core->f.IsFramebuffer(framebuffer);
-}
-
-inline void QOpenGLFunctions_4_3_Compatibility::glGetRenderbufferParameteriv(GLenum target, GLenum pname, GLint *params)
-{
- d_3_0_Core->f.GetRenderbufferParameteriv(target, pname, params);
-}
-
-inline void QOpenGLFunctions_4_3_Compatibility::glRenderbufferStorage(GLenum target, GLenum internalformat, GLsizei width, GLsizei height)
-{
- d_3_0_Core->f.RenderbufferStorage(target, internalformat, width, height);
-}
-
-inline void QOpenGLFunctions_4_3_Compatibility::glGenRenderbuffers(GLsizei n, GLuint *renderbuffers)
-{
- d_3_0_Core->f.GenRenderbuffers(n, renderbuffers);
-}
-
-inline void QOpenGLFunctions_4_3_Compatibility::glDeleteRenderbuffers(GLsizei n, const GLuint *renderbuffers)
-{
- d_3_0_Core->f.DeleteRenderbuffers(n, renderbuffers);
-}
-
-inline void QOpenGLFunctions_4_3_Compatibility::glBindRenderbuffer(GLenum target, GLuint renderbuffer)
-{
- d_3_0_Core->f.BindRenderbuffer(target, renderbuffer);
-}
-
-inline GLboolean QOpenGLFunctions_4_3_Compatibility::glIsRenderbuffer(GLuint renderbuffer)
-{
- return d_3_0_Core->f.IsRenderbuffer(renderbuffer);
-}
-
-inline const GLubyte * QOpenGLFunctions_4_3_Compatibility::glGetStringi(GLenum name, GLuint index)
-{
- return d_3_0_Core->f.GetStringi(name, index);
-}
-
-inline void QOpenGLFunctions_4_3_Compatibility::glClearBufferfi(GLenum buffer, GLint drawbuffer, GLfloat depth, GLint stencil)
-{
- d_3_0_Core->f.ClearBufferfi(buffer, drawbuffer, depth, stencil);
-}
-
-inline void QOpenGLFunctions_4_3_Compatibility::glClearBufferfv(GLenum buffer, GLint drawbuffer, const GLfloat *value)
-{
- d_3_0_Core->f.ClearBufferfv(buffer, drawbuffer, value);
-}
-
-inline void QOpenGLFunctions_4_3_Compatibility::glClearBufferuiv(GLenum buffer, GLint drawbuffer, const GLuint *value)
-{
- d_3_0_Core->f.ClearBufferuiv(buffer, drawbuffer, value);
-}
-
-inline void QOpenGLFunctions_4_3_Compatibility::glClearBufferiv(GLenum buffer, GLint drawbuffer, const GLint *value)
-{
- d_3_0_Core->f.ClearBufferiv(buffer, drawbuffer, value);
-}
-
-inline void QOpenGLFunctions_4_3_Compatibility::glGetTexParameterIuiv(GLenum target, GLenum pname, GLuint *params)
-{
- d_3_0_Core->f.GetTexParameterIuiv(target, pname, params);
-}
-
-inline void QOpenGLFunctions_4_3_Compatibility::glGetTexParameterIiv(GLenum target, GLenum pname, GLint *params)
-{
- d_3_0_Core->f.GetTexParameterIiv(target, pname, params);
-}
-
-inline void QOpenGLFunctions_4_3_Compatibility::glTexParameterIuiv(GLenum target, GLenum pname, const GLuint *params)
-{
- d_3_0_Core->f.TexParameterIuiv(target, pname, params);
-}
-
-inline void QOpenGLFunctions_4_3_Compatibility::glTexParameterIiv(GLenum target, GLenum pname, const GLint *params)
-{
- d_3_0_Core->f.TexParameterIiv(target, pname, params);
-}
-
-inline void QOpenGLFunctions_4_3_Compatibility::glUniform4uiv(GLint location, GLsizei count, const GLuint *value)
-{
- d_3_0_Core->f.Uniform4uiv(location, count, value);
-}
-
-inline void QOpenGLFunctions_4_3_Compatibility::glUniform3uiv(GLint location, GLsizei count, const GLuint *value)
-{
- d_3_0_Core->f.Uniform3uiv(location, count, value);
-}
-
-inline void QOpenGLFunctions_4_3_Compatibility::glUniform2uiv(GLint location, GLsizei count, const GLuint *value)
-{
- d_3_0_Core->f.Uniform2uiv(location, count, value);
-}
-
-inline void QOpenGLFunctions_4_3_Compatibility::glUniform1uiv(GLint location, GLsizei count, const GLuint *value)
-{
- d_3_0_Core->f.Uniform1uiv(location, count, value);
-}
-
-inline void QOpenGLFunctions_4_3_Compatibility::glUniform4ui(GLint location, GLuint v0, GLuint v1, GLuint v2, GLuint v3)
-{
- d_3_0_Core->f.Uniform4ui(location, v0, v1, v2, v3);
-}
-
-inline void QOpenGLFunctions_4_3_Compatibility::glUniform3ui(GLint location, GLuint v0, GLuint v1, GLuint v2)
-{
- d_3_0_Core->f.Uniform3ui(location, v0, v1, v2);
-}
-
-inline void QOpenGLFunctions_4_3_Compatibility::glUniform2ui(GLint location, GLuint v0, GLuint v1)
-{
- d_3_0_Core->f.Uniform2ui(location, v0, v1);
-}
-
-inline void QOpenGLFunctions_4_3_Compatibility::glUniform1ui(GLint location, GLuint v0)
-{
- d_3_0_Core->f.Uniform1ui(location, v0);
-}
-
-inline GLint QOpenGLFunctions_4_3_Compatibility::glGetFragDataLocation(GLuint program, const GLchar *name)
-{
- return d_3_0_Core->f.GetFragDataLocation(program, name);
-}
-
-inline void QOpenGLFunctions_4_3_Compatibility::glBindFragDataLocation(GLuint program, GLuint color, const GLchar *name)
-{
- d_3_0_Core->f.BindFragDataLocation(program, color, name);
-}
-
-inline void QOpenGLFunctions_4_3_Compatibility::glGetUniformuiv(GLuint program, GLint location, GLuint *params)
-{
- d_3_0_Core->f.GetUniformuiv(program, location, params);
-}
-
-inline void QOpenGLFunctions_4_3_Compatibility::glGetVertexAttribIuiv(GLuint index, GLenum pname, GLuint *params)
-{
- d_3_0_Core->f.GetVertexAttribIuiv(index, pname, params);
-}
-
-inline void QOpenGLFunctions_4_3_Compatibility::glGetVertexAttribIiv(GLuint index, GLenum pname, GLint *params)
-{
- d_3_0_Core->f.GetVertexAttribIiv(index, pname, params);
-}
-
-inline void QOpenGLFunctions_4_3_Compatibility::glVertexAttribIPointer(GLuint index, GLint size, GLenum type, GLsizei stride, const GLvoid *pointer)
-{
- d_3_0_Core->f.VertexAttribIPointer(index, size, type, stride, pointer);
-}
-
-inline void QOpenGLFunctions_4_3_Compatibility::glEndConditionalRender()
-{
- d_3_0_Core->f.EndConditionalRender();
-}
-
-inline void QOpenGLFunctions_4_3_Compatibility::glBeginConditionalRender(GLuint id, GLenum mode)
-{
- d_3_0_Core->f.BeginConditionalRender(id, mode);
-}
-
-inline void QOpenGLFunctions_4_3_Compatibility::glClampColor(GLenum target, GLenum clamp)
-{
- d_3_0_Core->f.ClampColor(target, clamp);
-}
-
-inline void QOpenGLFunctions_4_3_Compatibility::glGetTransformFeedbackVarying(GLuint program, GLuint index, GLsizei bufSize, GLsizei *length, GLsizei *size, GLenum *type, GLchar *name)
-{
- d_3_0_Core->f.GetTransformFeedbackVarying(program, index, bufSize, length, size, type, name);
-}
-
-inline void QOpenGLFunctions_4_3_Compatibility::glTransformFeedbackVaryings(GLuint program, GLsizei count, const GLchar* const *varyings, GLenum bufferMode)
-{
- d_3_0_Core->f.TransformFeedbackVaryings(program, count, varyings, bufferMode);
-}
-
-inline void QOpenGLFunctions_4_3_Compatibility::glBindBufferBase(GLenum target, GLuint index, GLuint buffer)
-{
- d_3_0_Core->f.BindBufferBase(target, index, buffer);
-}
-
-inline void QOpenGLFunctions_4_3_Compatibility::glBindBufferRange(GLenum target, GLuint index, GLuint buffer, GLintptr offset, GLsizeiptr size)
-{
- d_3_0_Core->f.BindBufferRange(target, index, buffer, offset, size);
-}
-
-inline void QOpenGLFunctions_4_3_Compatibility::glEndTransformFeedback()
-{
- d_3_0_Core->f.EndTransformFeedback();
-}
-
-inline void QOpenGLFunctions_4_3_Compatibility::glBeginTransformFeedback(GLenum primitiveMode)
-{
- d_3_0_Core->f.BeginTransformFeedback(primitiveMode);
-}
-
-inline GLboolean QOpenGLFunctions_4_3_Compatibility::glIsEnabledi(GLenum target, GLuint index)
-{
- return d_3_0_Core->f.IsEnabledi(target, index);
-}
-
-inline void QOpenGLFunctions_4_3_Compatibility::glDisablei(GLenum target, GLuint index)
-{
- d_3_0_Core->f.Disablei(target, index);
-}
-
-inline void QOpenGLFunctions_4_3_Compatibility::glEnablei(GLenum target, GLuint index)
-{
- d_3_0_Core->f.Enablei(target, index);
-}
-
-inline void QOpenGLFunctions_4_3_Compatibility::glGetIntegeri_v(GLenum target, GLuint index, GLint *data)
-{
- d_3_0_Core->f.GetIntegeri_v(target, index, data);
-}
-
-inline void QOpenGLFunctions_4_3_Compatibility::glGetBooleani_v(GLenum target, GLuint index, GLboolean *data)
-{
- d_3_0_Core->f.GetBooleani_v(target, index, data);
-}
-
-inline void QOpenGLFunctions_4_3_Compatibility::glColorMaski(GLuint index, GLboolean r, GLboolean g, GLboolean b, GLboolean a)
-{
- d_3_0_Core->f.ColorMaski(index, r, g, b, a);
-}
-
-
-// OpenGL 3.1 core functions
-inline void QOpenGLFunctions_4_3_Compatibility::glCopyBufferSubData(GLenum readTarget, GLenum writeTarget, GLintptr readOffset, GLintptr writeOffset, GLsizeiptr size)
-{
- d_3_1_Core->f.CopyBufferSubData(readTarget, writeTarget, readOffset, writeOffset, size);
-}
-
-inline void QOpenGLFunctions_4_3_Compatibility::glUniformBlockBinding(GLuint program, GLuint uniformBlockIndex, GLuint uniformBlockBinding)
-{
- d_3_1_Core->f.UniformBlockBinding(program, uniformBlockIndex, uniformBlockBinding);
-}
-
-inline void QOpenGLFunctions_4_3_Compatibility::glGetActiveUniformBlockName(GLuint program, GLuint uniformBlockIndex, GLsizei bufSize, GLsizei *length, GLchar *uniformBlockName)
-{
- d_3_1_Core->f.GetActiveUniformBlockName(program, uniformBlockIndex, bufSize, length, uniformBlockName);
-}
-
-inline void QOpenGLFunctions_4_3_Compatibility::glGetActiveUniformBlockiv(GLuint program, GLuint uniformBlockIndex, GLenum pname, GLint *params)
-{
- d_3_1_Core->f.GetActiveUniformBlockiv(program, uniformBlockIndex, pname, params);
-}
-
-inline GLuint QOpenGLFunctions_4_3_Compatibility::glGetUniformBlockIndex(GLuint program, const GLchar *uniformBlockName)
-{
- return d_3_1_Core->f.GetUniformBlockIndex(program, uniformBlockName);
-}
-
-inline void QOpenGLFunctions_4_3_Compatibility::glGetActiveUniformName(GLuint program, GLuint uniformIndex, GLsizei bufSize, GLsizei *length, GLchar *uniformName)
-{
- d_3_1_Core->f.GetActiveUniformName(program, uniformIndex, bufSize, length, uniformName);
-}
-
-inline void QOpenGLFunctions_4_3_Compatibility::glGetActiveUniformsiv(GLuint program, GLsizei uniformCount, const GLuint *uniformIndices, GLenum pname, GLint *params)
-{
- d_3_1_Core->f.GetActiveUniformsiv(program, uniformCount, uniformIndices, pname, params);
-}
-
-inline void QOpenGLFunctions_4_3_Compatibility::glGetUniformIndices(GLuint program, GLsizei uniformCount, const GLchar* const *uniformNames, GLuint *uniformIndices)
-{
- d_3_1_Core->f.GetUniformIndices(program, uniformCount, uniformNames, uniformIndices);
-}
-
-inline void QOpenGLFunctions_4_3_Compatibility::glPrimitiveRestartIndex(GLuint index)
-{
- d_3_1_Core->f.PrimitiveRestartIndex(index);
-}
-
-inline void QOpenGLFunctions_4_3_Compatibility::glTexBuffer(GLenum target, GLenum internalformat, GLuint buffer)
-{
- d_3_1_Core->f.TexBuffer(target, internalformat, buffer);
-}
-
-inline void QOpenGLFunctions_4_3_Compatibility::glDrawElementsInstanced(GLenum mode, GLsizei count, GLenum type, const GLvoid *indices, GLsizei instancecount)
-{
- d_3_1_Core->f.DrawElementsInstanced(mode, count, type, indices, instancecount);
-}
-
-inline void QOpenGLFunctions_4_3_Compatibility::glDrawArraysInstanced(GLenum mode, GLint first, GLsizei count, GLsizei instancecount)
-{
- d_3_1_Core->f.DrawArraysInstanced(mode, first, count, instancecount);
-}
-
-
-// OpenGL 3.2 core functions
-inline void QOpenGLFunctions_4_3_Compatibility::glSampleMaski(GLuint index, GLbitfield mask)
-{
- d_3_2_Core->f.SampleMaski(index, mask);
-}
-
-inline void QOpenGLFunctions_4_3_Compatibility::glGetMultisamplefv(GLenum pname, GLuint index, GLfloat *val)
-{
- d_3_2_Core->f.GetMultisamplefv(pname, index, val);
-}
-
-inline void QOpenGLFunctions_4_3_Compatibility::glTexImage3DMultisample(GLenum target, GLsizei samples, GLint internalformat, GLsizei width, GLsizei height, GLsizei depth, GLboolean fixedsamplelocations)
-{
- d_3_2_Core->f.TexImage3DMultisample(target, samples, internalformat, width, height, depth, fixedsamplelocations);
-}
-
-inline void QOpenGLFunctions_4_3_Compatibility::glTexImage2DMultisample(GLenum target, GLsizei samples, GLint internalformat, GLsizei width, GLsizei height, GLboolean fixedsamplelocations)
-{
- d_3_2_Core->f.TexImage2DMultisample(target, samples, internalformat, width, height, fixedsamplelocations);
-}
-
-inline void QOpenGLFunctions_4_3_Compatibility::glGetSynciv(GLsync sync, GLenum pname, GLsizei bufSize, GLsizei *length, GLint *values)
-{
- d_3_2_Core->f.GetSynciv(sync, pname, bufSize, length, values);
-}
-
-inline void QOpenGLFunctions_4_3_Compatibility::glGetInteger64v(GLenum pname, GLint64 *params)
-{
- d_3_2_Core->f.GetInteger64v(pname, params);
-}
-
-inline void QOpenGLFunctions_4_3_Compatibility::glWaitSync(GLsync sync, GLbitfield flags, GLuint64 timeout)
-{
- d_3_2_Core->f.WaitSync(sync, flags, timeout);
-}
-
-inline GLenum QOpenGLFunctions_4_3_Compatibility::glClientWaitSync(GLsync sync, GLbitfield flags, GLuint64 timeout)
-{
- return d_3_2_Core->f.ClientWaitSync(sync, flags, timeout);
-}
-
-inline void QOpenGLFunctions_4_3_Compatibility::glDeleteSync(GLsync sync)
-{
- d_3_2_Core->f.DeleteSync(sync);
-}
-
-inline GLboolean QOpenGLFunctions_4_3_Compatibility::glIsSync(GLsync sync)
-{
- return d_3_2_Core->f.IsSync(sync);
-}
-
-inline GLsync QOpenGLFunctions_4_3_Compatibility::glFenceSync(GLenum condition, GLbitfield flags)
-{
- return d_3_2_Core->f.FenceSync(condition, flags);
-}
-
-inline void QOpenGLFunctions_4_3_Compatibility::glProvokingVertex(GLenum mode)
-{
- d_3_2_Core->f.ProvokingVertex(mode);
-}
-
-inline void QOpenGLFunctions_4_3_Compatibility::glMultiDrawElementsBaseVertex(GLenum mode, const GLsizei *count, GLenum type, const GLvoid* const *indices, GLsizei drawcount, const GLint *basevertex)
-{
- d_3_2_Core->f.MultiDrawElementsBaseVertex(mode, count, type, indices, drawcount, basevertex);
-}
-
-inline void QOpenGLFunctions_4_3_Compatibility::glDrawElementsInstancedBaseVertex(GLenum mode, GLsizei count, GLenum type, const GLvoid *indices, GLsizei instancecount, GLint basevertex)
-{
- d_3_2_Core->f.DrawElementsInstancedBaseVertex(mode, count, type, indices, instancecount, basevertex);
-}
-
-inline void QOpenGLFunctions_4_3_Compatibility::glDrawRangeElementsBaseVertex(GLenum mode, GLuint start, GLuint end, GLsizei count, GLenum type, const GLvoid *indices, GLint basevertex)
-{
- d_3_2_Core->f.DrawRangeElementsBaseVertex(mode, start, end, count, type, indices, basevertex);
-}
-
-inline void QOpenGLFunctions_4_3_Compatibility::glDrawElementsBaseVertex(GLenum mode, GLsizei count, GLenum type, const GLvoid *indices, GLint basevertex)
-{
- d_3_2_Core->f.DrawElementsBaseVertex(mode, count, type, indices, basevertex);
-}
-
-inline void QOpenGLFunctions_4_3_Compatibility::glFramebufferTexture(GLenum target, GLenum attachment, GLuint texture, GLint level)
-{
- d_3_2_Core->f.FramebufferTexture(target, attachment, texture, level);
-}
-
-inline void QOpenGLFunctions_4_3_Compatibility::glGetBufferParameteri64v(GLenum target, GLenum pname, GLint64 *params)
-{
- d_3_2_Core->f.GetBufferParameteri64v(target, pname, params);
-}
-
-inline void QOpenGLFunctions_4_3_Compatibility::glGetInteger64i_v(GLenum target, GLuint index, GLint64 *data)
-{
- d_3_2_Core->f.GetInteger64i_v(target, index, data);
-}
-
-
-// OpenGL 3.3 core functions
-inline void QOpenGLFunctions_4_3_Compatibility::glVertexAttribP4uiv(GLuint index, GLenum type, GLboolean normalized, const GLuint *value)
-{
- d_3_3_Core->f.VertexAttribP4uiv(index, type, normalized, value);
-}
-
-inline void QOpenGLFunctions_4_3_Compatibility::glVertexAttribP4ui(GLuint index, GLenum type, GLboolean normalized, GLuint value)
-{
- d_3_3_Core->f.VertexAttribP4ui(index, type, normalized, value);
-}
-
-inline void QOpenGLFunctions_4_3_Compatibility::glVertexAttribP3uiv(GLuint index, GLenum type, GLboolean normalized, const GLuint *value)
-{
- d_3_3_Core->f.VertexAttribP3uiv(index, type, normalized, value);
-}
-
-inline void QOpenGLFunctions_4_3_Compatibility::glVertexAttribP3ui(GLuint index, GLenum type, GLboolean normalized, GLuint value)
-{
- d_3_3_Core->f.VertexAttribP3ui(index, type, normalized, value);
-}
-
-inline void QOpenGLFunctions_4_3_Compatibility::glVertexAttribP2uiv(GLuint index, GLenum type, GLboolean normalized, const GLuint *value)
-{
- d_3_3_Core->f.VertexAttribP2uiv(index, type, normalized, value);
-}
-
-inline void QOpenGLFunctions_4_3_Compatibility::glVertexAttribP2ui(GLuint index, GLenum type, GLboolean normalized, GLuint value)
-{
- d_3_3_Core->f.VertexAttribP2ui(index, type, normalized, value);
-}
-
-inline void QOpenGLFunctions_4_3_Compatibility::glVertexAttribP1uiv(GLuint index, GLenum type, GLboolean normalized, const GLuint *value)
-{
- d_3_3_Core->f.VertexAttribP1uiv(index, type, normalized, value);
-}
-
-inline void QOpenGLFunctions_4_3_Compatibility::glVertexAttribP1ui(GLuint index, GLenum type, GLboolean normalized, GLuint value)
-{
- d_3_3_Core->f.VertexAttribP1ui(index, type, normalized, value);
-}
-
-inline void QOpenGLFunctions_4_3_Compatibility::glSecondaryColorP3uiv(GLenum type, const GLuint *color)
-{
- d_3_3_Deprecated->f.SecondaryColorP3uiv(type, color);
-}
-
-inline void QOpenGLFunctions_4_3_Compatibility::glSecondaryColorP3ui(GLenum type, GLuint color)
-{
- d_3_3_Deprecated->f.SecondaryColorP3ui(type, color);
-}
-
-inline void QOpenGLFunctions_4_3_Compatibility::glColorP4uiv(GLenum type, const GLuint *color)
-{
- d_3_3_Deprecated->f.ColorP4uiv(type, color);
-}
-
-inline void QOpenGLFunctions_4_3_Compatibility::glColorP4ui(GLenum type, GLuint color)
-{
- d_3_3_Deprecated->f.ColorP4ui(type, color);
-}
-
-inline void QOpenGLFunctions_4_3_Compatibility::glColorP3uiv(GLenum type, const GLuint *color)
-{
- d_3_3_Deprecated->f.ColorP3uiv(type, color);
-}
-
-inline void QOpenGLFunctions_4_3_Compatibility::glColorP3ui(GLenum type, GLuint color)
-{
- d_3_3_Deprecated->f.ColorP3ui(type, color);
-}
-
-inline void QOpenGLFunctions_4_3_Compatibility::glNormalP3uiv(GLenum type, const GLuint *coords)
-{
- d_3_3_Deprecated->f.NormalP3uiv(type, coords);
-}
-
-inline void QOpenGLFunctions_4_3_Compatibility::glNormalP3ui(GLenum type, GLuint coords)
-{
- d_3_3_Deprecated->f.NormalP3ui(type, coords);
-}
-
-inline void QOpenGLFunctions_4_3_Compatibility::glMultiTexCoordP4uiv(GLenum texture, GLenum type, const GLuint *coords)
-{
- d_3_3_Deprecated->f.MultiTexCoordP4uiv(texture, type, coords);
-}
-
-inline void QOpenGLFunctions_4_3_Compatibility::glMultiTexCoordP4ui(GLenum texture, GLenum type, GLuint coords)
-{
- d_3_3_Deprecated->f.MultiTexCoordP4ui(texture, type, coords);
-}
-
-inline void QOpenGLFunctions_4_3_Compatibility::glMultiTexCoordP3uiv(GLenum texture, GLenum type, const GLuint *coords)
-{
- d_3_3_Deprecated->f.MultiTexCoordP3uiv(texture, type, coords);
-}
-
-inline void QOpenGLFunctions_4_3_Compatibility::glMultiTexCoordP3ui(GLenum texture, GLenum type, GLuint coords)
-{
- d_3_3_Deprecated->f.MultiTexCoordP3ui(texture, type, coords);
-}
-
-inline void QOpenGLFunctions_4_3_Compatibility::glMultiTexCoordP2uiv(GLenum texture, GLenum type, const GLuint *coords)
-{
- d_3_3_Deprecated->f.MultiTexCoordP2uiv(texture, type, coords);
-}
-
-inline void QOpenGLFunctions_4_3_Compatibility::glMultiTexCoordP2ui(GLenum texture, GLenum type, GLuint coords)
-{
- d_3_3_Deprecated->f.MultiTexCoordP2ui(texture, type, coords);
-}
-
-inline void QOpenGLFunctions_4_3_Compatibility::glMultiTexCoordP1uiv(GLenum texture, GLenum type, const GLuint *coords)
-{
- d_3_3_Deprecated->f.MultiTexCoordP1uiv(texture, type, coords);
-}
-
-inline void QOpenGLFunctions_4_3_Compatibility::glMultiTexCoordP1ui(GLenum texture, GLenum type, GLuint coords)
-{
- d_3_3_Deprecated->f.MultiTexCoordP1ui(texture, type, coords);
-}
-
-inline void QOpenGLFunctions_4_3_Compatibility::glTexCoordP4uiv(GLenum type, const GLuint *coords)
-{
- d_3_3_Deprecated->f.TexCoordP4uiv(type, coords);
-}
-
-inline void QOpenGLFunctions_4_3_Compatibility::glTexCoordP4ui(GLenum type, GLuint coords)
-{
- d_3_3_Deprecated->f.TexCoordP4ui(type, coords);
-}
-
-inline void QOpenGLFunctions_4_3_Compatibility::glTexCoordP3uiv(GLenum type, const GLuint *coords)
-{
- d_3_3_Deprecated->f.TexCoordP3uiv(type, coords);
-}
-
-inline void QOpenGLFunctions_4_3_Compatibility::glTexCoordP3ui(GLenum type, GLuint coords)
-{
- d_3_3_Deprecated->f.TexCoordP3ui(type, coords);
-}
-
-inline void QOpenGLFunctions_4_3_Compatibility::glTexCoordP2uiv(GLenum type, const GLuint *coords)
-{
- d_3_3_Deprecated->f.TexCoordP2uiv(type, coords);
-}
-
-inline void QOpenGLFunctions_4_3_Compatibility::glTexCoordP2ui(GLenum type, GLuint coords)
-{
- d_3_3_Deprecated->f.TexCoordP2ui(type, coords);
-}
-
-inline void QOpenGLFunctions_4_3_Compatibility::glTexCoordP1uiv(GLenum type, const GLuint *coords)
-{
- d_3_3_Deprecated->f.TexCoordP1uiv(type, coords);
-}
-
-inline void QOpenGLFunctions_4_3_Compatibility::glTexCoordP1ui(GLenum type, GLuint coords)
-{
- d_3_3_Deprecated->f.TexCoordP1ui(type, coords);
-}
-
-inline void QOpenGLFunctions_4_3_Compatibility::glVertexP4uiv(GLenum type, const GLuint *value)
-{
- d_3_3_Deprecated->f.VertexP4uiv(type, value);
-}
-
-inline void QOpenGLFunctions_4_3_Compatibility::glVertexP4ui(GLenum type, GLuint value)
-{
- d_3_3_Deprecated->f.VertexP4ui(type, value);
-}
-
-inline void QOpenGLFunctions_4_3_Compatibility::glVertexP3uiv(GLenum type, const GLuint *value)
-{
- d_3_3_Deprecated->f.VertexP3uiv(type, value);
-}
-
-inline void QOpenGLFunctions_4_3_Compatibility::glVertexP3ui(GLenum type, GLuint value)
-{
- d_3_3_Deprecated->f.VertexP3ui(type, value);
-}
-
-inline void QOpenGLFunctions_4_3_Compatibility::glVertexP2uiv(GLenum type, const GLuint *value)
-{
- d_3_3_Deprecated->f.VertexP2uiv(type, value);
-}
-
-inline void QOpenGLFunctions_4_3_Compatibility::glVertexP2ui(GLenum type, GLuint value)
-{
- d_3_3_Deprecated->f.VertexP2ui(type, value);
-}
-
-inline void QOpenGLFunctions_4_3_Compatibility::glGetQueryObjectui64v(GLuint id, GLenum pname, GLuint64 *params)
-{
- d_3_3_Core->f.GetQueryObjectui64v(id, pname, params);
-}
-
-inline void QOpenGLFunctions_4_3_Compatibility::glGetQueryObjecti64v(GLuint id, GLenum pname, GLint64 *params)
-{
- d_3_3_Core->f.GetQueryObjecti64v(id, pname, params);
-}
-
-inline void QOpenGLFunctions_4_3_Compatibility::glQueryCounter(GLuint id, GLenum target)
-{
- d_3_3_Core->f.QueryCounter(id, target);
-}
-
-inline void QOpenGLFunctions_4_3_Compatibility::glGetSamplerParameterIuiv(GLuint sampler, GLenum pname, GLuint *params)
-{
- d_3_3_Core->f.GetSamplerParameterIuiv(sampler, pname, params);
-}
-
-inline void QOpenGLFunctions_4_3_Compatibility::glGetSamplerParameterfv(GLuint sampler, GLenum pname, GLfloat *params)
-{
- d_3_3_Core->f.GetSamplerParameterfv(sampler, pname, params);
-}
-
-inline void QOpenGLFunctions_4_3_Compatibility::glGetSamplerParameterIiv(GLuint sampler, GLenum pname, GLint *params)
-{
- d_3_3_Core->f.GetSamplerParameterIiv(sampler, pname, params);
-}
-
-inline void QOpenGLFunctions_4_3_Compatibility::glGetSamplerParameteriv(GLuint sampler, GLenum pname, GLint *params)
-{
- d_3_3_Core->f.GetSamplerParameteriv(sampler, pname, params);
-}
-
-inline void QOpenGLFunctions_4_3_Compatibility::glSamplerParameterIuiv(GLuint sampler, GLenum pname, const GLuint *param)
-{
- d_3_3_Core->f.SamplerParameterIuiv(sampler, pname, param);
-}
-
-inline void QOpenGLFunctions_4_3_Compatibility::glSamplerParameterIiv(GLuint sampler, GLenum pname, const GLint *param)
-{
- d_3_3_Core->f.SamplerParameterIiv(sampler, pname, param);
-}
-
-inline void QOpenGLFunctions_4_3_Compatibility::glSamplerParameterfv(GLuint sampler, GLenum pname, const GLfloat *param)
-{
- d_3_3_Core->f.SamplerParameterfv(sampler, pname, param);
-}
-
-inline void QOpenGLFunctions_4_3_Compatibility::glSamplerParameterf(GLuint sampler, GLenum pname, GLfloat param)
-{
- d_3_3_Core->f.SamplerParameterf(sampler, pname, param);
-}
-
-inline void QOpenGLFunctions_4_3_Compatibility::glSamplerParameteriv(GLuint sampler, GLenum pname, const GLint *param)
-{
- d_3_3_Core->f.SamplerParameteriv(sampler, pname, param);
-}
-
-inline void QOpenGLFunctions_4_3_Compatibility::glSamplerParameteri(GLuint sampler, GLenum pname, GLint param)
-{
- d_3_3_Core->f.SamplerParameteri(sampler, pname, param);
-}
-
-inline void QOpenGLFunctions_4_3_Compatibility::glBindSampler(GLuint unit, GLuint sampler)
-{
- d_3_3_Core->f.BindSampler(unit, sampler);
-}
-
-inline GLboolean QOpenGLFunctions_4_3_Compatibility::glIsSampler(GLuint sampler)
-{
- return d_3_3_Core->f.IsSampler(sampler);
-}
-
-inline void QOpenGLFunctions_4_3_Compatibility::glDeleteSamplers(GLsizei count, const GLuint *samplers)
-{
- d_3_3_Core->f.DeleteSamplers(count, samplers);
-}
-
-inline void QOpenGLFunctions_4_3_Compatibility::glGenSamplers(GLsizei count, GLuint *samplers)
-{
- d_3_3_Core->f.GenSamplers(count, samplers);
-}
-
-inline GLint QOpenGLFunctions_4_3_Compatibility::glGetFragDataIndex(GLuint program, const GLchar *name)
-{
- return d_3_3_Core->f.GetFragDataIndex(program, name);
-}
-
-inline void QOpenGLFunctions_4_3_Compatibility::glBindFragDataLocationIndexed(GLuint program, GLuint colorNumber, GLuint index, const GLchar *name)
-{
- d_3_3_Core->f.BindFragDataLocationIndexed(program, colorNumber, index, name);
-}
-
-inline void QOpenGLFunctions_4_3_Compatibility::glVertexAttribDivisor(GLuint index, GLuint divisor)
-{
- d_3_3_Core->f.VertexAttribDivisor(index, divisor);
-}
-
-
-// OpenGL 4.0 core functions
-inline void QOpenGLFunctions_4_3_Compatibility::glGetQueryIndexediv(GLenum target, GLuint index, GLenum pname, GLint *params)
-{
- d_4_0_Core->f.GetQueryIndexediv(target, index, pname, params);
-}
-
-inline void QOpenGLFunctions_4_3_Compatibility::glEndQueryIndexed(GLenum target, GLuint index)
-{
- d_4_0_Core->f.EndQueryIndexed(target, index);
-}
-
-inline void QOpenGLFunctions_4_3_Compatibility::glBeginQueryIndexed(GLenum target, GLuint index, GLuint id)
-{
- d_4_0_Core->f.BeginQueryIndexed(target, index, id);
-}
-
-inline void QOpenGLFunctions_4_3_Compatibility::glDrawTransformFeedbackStream(GLenum mode, GLuint id, GLuint stream)
-{
- d_4_0_Core->f.DrawTransformFeedbackStream(mode, id, stream);
-}
-
-inline void QOpenGLFunctions_4_3_Compatibility::glDrawTransformFeedback(GLenum mode, GLuint id)
-{
- d_4_0_Core->f.DrawTransformFeedback(mode, id);
-}
-
-inline void QOpenGLFunctions_4_3_Compatibility::glResumeTransformFeedback()
-{
- d_4_0_Core->f.ResumeTransformFeedback();
-}
-
-inline void QOpenGLFunctions_4_3_Compatibility::glPauseTransformFeedback()
-{
- d_4_0_Core->f.PauseTransformFeedback();
-}
-
-inline GLboolean QOpenGLFunctions_4_3_Compatibility::glIsTransformFeedback(GLuint id)
-{
- return d_4_0_Core->f.IsTransformFeedback(id);
-}
-
-inline void QOpenGLFunctions_4_3_Compatibility::glGenTransformFeedbacks(GLsizei n, GLuint *ids)
-{
- d_4_0_Core->f.GenTransformFeedbacks(n, ids);
-}
-
-inline void QOpenGLFunctions_4_3_Compatibility::glDeleteTransformFeedbacks(GLsizei n, const GLuint *ids)
-{
- d_4_0_Core->f.DeleteTransformFeedbacks(n, ids);
-}
-
-inline void QOpenGLFunctions_4_3_Compatibility::glBindTransformFeedback(GLenum target, GLuint id)
-{
- d_4_0_Core->f.BindTransformFeedback(target, id);
-}
-
-inline void QOpenGLFunctions_4_3_Compatibility::glPatchParameterfv(GLenum pname, const GLfloat *values)
-{
- d_4_0_Core->f.PatchParameterfv(pname, values);
-}
-
-inline void QOpenGLFunctions_4_3_Compatibility::glPatchParameteri(GLenum pname, GLint value)
-{
- d_4_0_Core->f.PatchParameteri(pname, value);
-}
-
-inline void QOpenGLFunctions_4_3_Compatibility::glGetProgramStageiv(GLuint program, GLenum shadertype, GLenum pname, GLint *values)
-{
- d_4_0_Core->f.GetProgramStageiv(program, shadertype, pname, values);
-}
-
-inline void QOpenGLFunctions_4_3_Compatibility::glGetUniformSubroutineuiv(GLenum shadertype, GLint location, GLuint *params)
-{
- d_4_0_Core->f.GetUniformSubroutineuiv(shadertype, location, params);
-}
-
-inline void QOpenGLFunctions_4_3_Compatibility::glUniformSubroutinesuiv(GLenum shadertype, GLsizei count, const GLuint *indices)
-{
- d_4_0_Core->f.UniformSubroutinesuiv(shadertype, count, indices);
-}
-
-inline void QOpenGLFunctions_4_3_Compatibility::glGetActiveSubroutineName(GLuint program, GLenum shadertype, GLuint index, GLsizei bufsize, GLsizei *length, GLchar *name)
-{
- d_4_0_Core->f.GetActiveSubroutineName(program, shadertype, index, bufsize, length, name);
-}
-
-inline void QOpenGLFunctions_4_3_Compatibility::glGetActiveSubroutineUniformName(GLuint program, GLenum shadertype, GLuint index, GLsizei bufsize, GLsizei *length, GLchar *name)
-{
- d_4_0_Core->f.GetActiveSubroutineUniformName(program, shadertype, index, bufsize, length, name);
-}
-
-inline void QOpenGLFunctions_4_3_Compatibility::glGetActiveSubroutineUniformiv(GLuint program, GLenum shadertype, GLuint index, GLenum pname, GLint *values)
-{
- d_4_0_Core->f.GetActiveSubroutineUniformiv(program, shadertype, index, pname, values);
-}
-
-inline GLuint QOpenGLFunctions_4_3_Compatibility::glGetSubroutineIndex(GLuint program, GLenum shadertype, const GLchar *name)
-{
- return d_4_0_Core->f.GetSubroutineIndex(program, shadertype, name);
-}
-
-inline GLint QOpenGLFunctions_4_3_Compatibility::glGetSubroutineUniformLocation(GLuint program, GLenum shadertype, const GLchar *name)
-{
- return d_4_0_Core->f.GetSubroutineUniformLocation(program, shadertype, name);
-}
-
-inline void QOpenGLFunctions_4_3_Compatibility::glGetUniformdv(GLuint program, GLint location, GLdouble *params)
-{
- d_4_0_Core->f.GetUniformdv(program, location, params);
-}
-
-inline void QOpenGLFunctions_4_3_Compatibility::glUniformMatrix4x3dv(GLint location, GLsizei count, GLboolean transpose, const GLdouble *value)
-{
- d_4_0_Core->f.UniformMatrix4x3dv(location, count, transpose, value);
-}
-
-inline void QOpenGLFunctions_4_3_Compatibility::glUniformMatrix4x2dv(GLint location, GLsizei count, GLboolean transpose, const GLdouble *value)
-{
- d_4_0_Core->f.UniformMatrix4x2dv(location, count, transpose, value);
-}
-
-inline void QOpenGLFunctions_4_3_Compatibility::glUniformMatrix3x4dv(GLint location, GLsizei count, GLboolean transpose, const GLdouble *value)
-{
- d_4_0_Core->f.UniformMatrix3x4dv(location, count, transpose, value);
-}
-
-inline void QOpenGLFunctions_4_3_Compatibility::glUniformMatrix3x2dv(GLint location, GLsizei count, GLboolean transpose, const GLdouble *value)
-{
- d_4_0_Core->f.UniformMatrix3x2dv(location, count, transpose, value);
-}
-
-inline void QOpenGLFunctions_4_3_Compatibility::glUniformMatrix2x4dv(GLint location, GLsizei count, GLboolean transpose, const GLdouble *value)
-{
- d_4_0_Core->f.UniformMatrix2x4dv(location, count, transpose, value);
-}
-
-inline void QOpenGLFunctions_4_3_Compatibility::glUniformMatrix2x3dv(GLint location, GLsizei count, GLboolean transpose, const GLdouble *value)
-{
- d_4_0_Core->f.UniformMatrix2x3dv(location, count, transpose, value);
-}
-
-inline void QOpenGLFunctions_4_3_Compatibility::glUniformMatrix4dv(GLint location, GLsizei count, GLboolean transpose, const GLdouble *value)
-{
- d_4_0_Core->f.UniformMatrix4dv(location, count, transpose, value);
-}
-
-inline void QOpenGLFunctions_4_3_Compatibility::glUniformMatrix3dv(GLint location, GLsizei count, GLboolean transpose, const GLdouble *value)
-{
- d_4_0_Core->f.UniformMatrix3dv(location, count, transpose, value);
-}
-
-inline void QOpenGLFunctions_4_3_Compatibility::glUniformMatrix2dv(GLint location, GLsizei count, GLboolean transpose, const GLdouble *value)
-{
- d_4_0_Core->f.UniformMatrix2dv(location, count, transpose, value);
-}
-
-inline void QOpenGLFunctions_4_3_Compatibility::glUniform4dv(GLint location, GLsizei count, const GLdouble *value)
-{
- d_4_0_Core->f.Uniform4dv(location, count, value);
-}
-
-inline void QOpenGLFunctions_4_3_Compatibility::glUniform3dv(GLint location, GLsizei count, const GLdouble *value)
-{
- d_4_0_Core->f.Uniform3dv(location, count, value);
-}
-
-inline void QOpenGLFunctions_4_3_Compatibility::glUniform2dv(GLint location, GLsizei count, const GLdouble *value)
-{
- d_4_0_Core->f.Uniform2dv(location, count, value);
-}
-
-inline void QOpenGLFunctions_4_3_Compatibility::glUniform1dv(GLint location, GLsizei count, const GLdouble *value)
-{
- d_4_0_Core->f.Uniform1dv(location, count, value);
-}
-
-inline void QOpenGLFunctions_4_3_Compatibility::glUniform4d(GLint location, GLdouble x, GLdouble y, GLdouble z, GLdouble w)
-{
- d_4_0_Core->f.Uniform4d(location, x, y, z, w);
-}
-
-inline void QOpenGLFunctions_4_3_Compatibility::glUniform3d(GLint location, GLdouble x, GLdouble y, GLdouble z)
-{
- d_4_0_Core->f.Uniform3d(location, x, y, z);
-}
-
-inline void QOpenGLFunctions_4_3_Compatibility::glUniform2d(GLint location, GLdouble x, GLdouble y)
-{
- d_4_0_Core->f.Uniform2d(location, x, y);
-}
-
-inline void QOpenGLFunctions_4_3_Compatibility::glUniform1d(GLint location, GLdouble x)
-{
- d_4_0_Core->f.Uniform1d(location, x);
-}
-
-inline void QOpenGLFunctions_4_3_Compatibility::glDrawElementsIndirect(GLenum mode, GLenum type, const GLvoid *indirect)
-{
- d_4_0_Core->f.DrawElementsIndirect(mode, type, indirect);
-}
-
-inline void QOpenGLFunctions_4_3_Compatibility::glDrawArraysIndirect(GLenum mode, const GLvoid *indirect)
-{
- d_4_0_Core->f.DrawArraysIndirect(mode, indirect);
-}
-
-inline void QOpenGLFunctions_4_3_Compatibility::glBlendFuncSeparatei(GLuint buf, GLenum srcRGB, GLenum dstRGB, GLenum srcAlpha, GLenum dstAlpha)
-{
- d_4_0_Core->f.BlendFuncSeparatei(buf, srcRGB, dstRGB, srcAlpha, dstAlpha);
-}
-
-inline void QOpenGLFunctions_4_3_Compatibility::glBlendFunci(GLuint buf, GLenum src, GLenum dst)
-{
- d_4_0_Core->f.BlendFunci(buf, src, dst);
-}
-
-inline void QOpenGLFunctions_4_3_Compatibility::glBlendEquationSeparatei(GLuint buf, GLenum modeRGB, GLenum modeAlpha)
-{
- d_4_0_Core->f.BlendEquationSeparatei(buf, modeRGB, modeAlpha);
-}
-
-inline void QOpenGLFunctions_4_3_Compatibility::glBlendEquationi(GLuint buf, GLenum mode)
-{
- d_4_0_Core->f.BlendEquationi(buf, mode);
-}
-
-inline void QOpenGLFunctions_4_3_Compatibility::glMinSampleShading(GLfloat value)
-{
- d_4_0_Core->f.MinSampleShading(value);
-}
-
-
-// OpenGL 4.1 core functions
-inline void QOpenGLFunctions_4_3_Compatibility::glGetDoublei_v(GLenum target, GLuint index, GLdouble *data)
-{
- d_4_1_Core->f.GetDoublei_v(target, index, data);
-}
-
-inline void QOpenGLFunctions_4_3_Compatibility::glGetFloati_v(GLenum target, GLuint index, GLfloat *data)
-{
- d_4_1_Core->f.GetFloati_v(target, index, data);
-}
-
-inline void QOpenGLFunctions_4_3_Compatibility::glDepthRangeIndexed(GLuint index, GLdouble n, GLdouble f)
-{
- d_4_1_Core->f.DepthRangeIndexed(index, n, f);
-}
-
-inline void QOpenGLFunctions_4_3_Compatibility::glDepthRangeArrayv(GLuint first, GLsizei count, const GLdouble *v)
-{
- d_4_1_Core->f.DepthRangeArrayv(first, count, v);
-}
-
-inline void QOpenGLFunctions_4_3_Compatibility::glScissorIndexedv(GLuint index, const GLint *v)
-{
- d_4_1_Core->f.ScissorIndexedv(index, v);
-}
-
-inline void QOpenGLFunctions_4_3_Compatibility::glScissorIndexed(GLuint index, GLint left, GLint bottom, GLsizei width, GLsizei height)
-{
- d_4_1_Core->f.ScissorIndexed(index, left, bottom, width, height);
-}
-
-inline void QOpenGLFunctions_4_3_Compatibility::glScissorArrayv(GLuint first, GLsizei count, const GLint *v)
-{
- d_4_1_Core->f.ScissorArrayv(first, count, v);
-}
-
-inline void QOpenGLFunctions_4_3_Compatibility::glViewportIndexedfv(GLuint index, const GLfloat *v)
-{
- d_4_1_Core->f.ViewportIndexedfv(index, v);
-}
-
-inline void QOpenGLFunctions_4_3_Compatibility::glViewportIndexedf(GLuint index, GLfloat x, GLfloat y, GLfloat w, GLfloat h)
-{
- d_4_1_Core->f.ViewportIndexedf(index, x, y, w, h);
-}
-
-inline void QOpenGLFunctions_4_3_Compatibility::glViewportArrayv(GLuint first, GLsizei count, const GLfloat *v)
-{
- d_4_1_Core->f.ViewportArrayv(first, count, v);
-}
-
-inline void QOpenGLFunctions_4_3_Compatibility::glGetVertexAttribLdv(GLuint index, GLenum pname, GLdouble *params)
-{
- d_4_1_Core->f.GetVertexAttribLdv(index, pname, params);
-}
-
-inline void QOpenGLFunctions_4_3_Compatibility::glVertexAttribLPointer(GLuint index, GLint size, GLenum type, GLsizei stride, const GLvoid *pointer)
-{
- d_4_1_Core->f.VertexAttribLPointer(index, size, type, stride, pointer);
-}
-
-inline void QOpenGLFunctions_4_3_Compatibility::glVertexAttribL4dv(GLuint index, const GLdouble *v)
-{
- d_4_1_Core->f.VertexAttribL4dv(index, v);
-}
-
-inline void QOpenGLFunctions_4_3_Compatibility::glVertexAttribL3dv(GLuint index, const GLdouble *v)
-{
- d_4_1_Core->f.VertexAttribL3dv(index, v);
-}
-
-inline void QOpenGLFunctions_4_3_Compatibility::glVertexAttribL2dv(GLuint index, const GLdouble *v)
-{
- d_4_1_Core->f.VertexAttribL2dv(index, v);
-}
-
-inline void QOpenGLFunctions_4_3_Compatibility::glVertexAttribL1dv(GLuint index, const GLdouble *v)
-{
- d_4_1_Core->f.VertexAttribL1dv(index, v);
-}
-
-inline void QOpenGLFunctions_4_3_Compatibility::glVertexAttribL4d(GLuint index, GLdouble x, GLdouble y, GLdouble z, GLdouble w)
-{
- d_4_1_Core->f.VertexAttribL4d(index, x, y, z, w);
-}
-
-inline void QOpenGLFunctions_4_3_Compatibility::glVertexAttribL3d(GLuint index, GLdouble x, GLdouble y, GLdouble z)
-{
- d_4_1_Core->f.VertexAttribL3d(index, x, y, z);
-}
-
-inline void QOpenGLFunctions_4_3_Compatibility::glVertexAttribL2d(GLuint index, GLdouble x, GLdouble y)
-{
- d_4_1_Core->f.VertexAttribL2d(index, x, y);
-}
-
-inline void QOpenGLFunctions_4_3_Compatibility::glVertexAttribL1d(GLuint index, GLdouble x)
-{
- d_4_1_Core->f.VertexAttribL1d(index, x);
-}
-
-inline void QOpenGLFunctions_4_3_Compatibility::glGetProgramPipelineInfoLog(GLuint pipeline, GLsizei bufSize, GLsizei *length, GLchar *infoLog)
-{
- d_4_1_Core->f.GetProgramPipelineInfoLog(pipeline, bufSize, length, infoLog);
-}
-
-inline void QOpenGLFunctions_4_3_Compatibility::glValidateProgramPipeline(GLuint pipeline)
-{
- d_4_1_Core->f.ValidateProgramPipeline(pipeline);
-}
-
-inline void QOpenGLFunctions_4_3_Compatibility::glProgramUniformMatrix4x3dv(GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLdouble *value)
-{
- d_4_1_Core->f.ProgramUniformMatrix4x3dv(program, location, count, transpose, value);
-}
-
-inline void QOpenGLFunctions_4_3_Compatibility::glProgramUniformMatrix3x4dv(GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLdouble *value)
-{
- d_4_1_Core->f.ProgramUniformMatrix3x4dv(program, location, count, transpose, value);
-}
-
-inline void QOpenGLFunctions_4_3_Compatibility::glProgramUniformMatrix4x2dv(GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLdouble *value)
-{
- d_4_1_Core->f.ProgramUniformMatrix4x2dv(program, location, count, transpose, value);
-}
-
-inline void QOpenGLFunctions_4_3_Compatibility::glProgramUniformMatrix2x4dv(GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLdouble *value)
-{
- d_4_1_Core->f.ProgramUniformMatrix2x4dv(program, location, count, transpose, value);
-}
-
-inline void QOpenGLFunctions_4_3_Compatibility::glProgramUniformMatrix3x2dv(GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLdouble *value)
-{
- d_4_1_Core->f.ProgramUniformMatrix3x2dv(program, location, count, transpose, value);
-}
-
-inline void QOpenGLFunctions_4_3_Compatibility::glProgramUniformMatrix2x3dv(GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLdouble *value)
-{
- d_4_1_Core->f.ProgramUniformMatrix2x3dv(program, location, count, transpose, value);
-}
-
-inline void QOpenGLFunctions_4_3_Compatibility::glProgramUniformMatrix4x3fv(GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value)
-{
- d_4_1_Core->f.ProgramUniformMatrix4x3fv(program, location, count, transpose, value);
-}
-
-inline void QOpenGLFunctions_4_3_Compatibility::glProgramUniformMatrix3x4fv(GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value)
-{
- d_4_1_Core->f.ProgramUniformMatrix3x4fv(program, location, count, transpose, value);
-}
-
-inline void QOpenGLFunctions_4_3_Compatibility::glProgramUniformMatrix4x2fv(GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value)
-{
- d_4_1_Core->f.ProgramUniformMatrix4x2fv(program, location, count, transpose, value);
-}
-
-inline void QOpenGLFunctions_4_3_Compatibility::glProgramUniformMatrix2x4fv(GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value)
-{
- d_4_1_Core->f.ProgramUniformMatrix2x4fv(program, location, count, transpose, value);
-}
-
-inline void QOpenGLFunctions_4_3_Compatibility::glProgramUniformMatrix3x2fv(GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value)
-{
- d_4_1_Core->f.ProgramUniformMatrix3x2fv(program, location, count, transpose, value);
-}
-
-inline void QOpenGLFunctions_4_3_Compatibility::glProgramUniformMatrix2x3fv(GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value)
-{
- d_4_1_Core->f.ProgramUniformMatrix2x3fv(program, location, count, transpose, value);
-}
-
-inline void QOpenGLFunctions_4_3_Compatibility::glProgramUniformMatrix4dv(GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLdouble *value)
-{
- d_4_1_Core->f.ProgramUniformMatrix4dv(program, location, count, transpose, value);
-}
-
-inline void QOpenGLFunctions_4_3_Compatibility::glProgramUniformMatrix3dv(GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLdouble *value)
-{
- d_4_1_Core->f.ProgramUniformMatrix3dv(program, location, count, transpose, value);
-}
-
-inline void QOpenGLFunctions_4_3_Compatibility::glProgramUniformMatrix2dv(GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLdouble *value)
-{
- d_4_1_Core->f.ProgramUniformMatrix2dv(program, location, count, transpose, value);
-}
-
-inline void QOpenGLFunctions_4_3_Compatibility::glProgramUniformMatrix4fv(GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value)
-{
- d_4_1_Core->f.ProgramUniformMatrix4fv(program, location, count, transpose, value);
-}
-
-inline void QOpenGLFunctions_4_3_Compatibility::glProgramUniformMatrix3fv(GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value)
-{
- d_4_1_Core->f.ProgramUniformMatrix3fv(program, location, count, transpose, value);
-}
-
-inline void QOpenGLFunctions_4_3_Compatibility::glProgramUniformMatrix2fv(GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value)
-{
- d_4_1_Core->f.ProgramUniformMatrix2fv(program, location, count, transpose, value);
-}
-
-inline void QOpenGLFunctions_4_3_Compatibility::glProgramUniform4uiv(GLuint program, GLint location, GLsizei count, const GLuint *value)
-{
- d_4_1_Core->f.ProgramUniform4uiv(program, location, count, value);
-}
-
-inline void QOpenGLFunctions_4_3_Compatibility::glProgramUniform4ui(GLuint program, GLint location, GLuint v0, GLuint v1, GLuint v2, GLuint v3)
-{
- d_4_1_Core->f.ProgramUniform4ui(program, location, v0, v1, v2, v3);
-}
-
-inline void QOpenGLFunctions_4_3_Compatibility::glProgramUniform4dv(GLuint program, GLint location, GLsizei count, const GLdouble *value)
-{
- d_4_1_Core->f.ProgramUniform4dv(program, location, count, value);
-}
-
-inline void QOpenGLFunctions_4_3_Compatibility::glProgramUniform4d(GLuint program, GLint location, GLdouble v0, GLdouble v1, GLdouble v2, GLdouble v3)
-{
- d_4_1_Core->f.ProgramUniform4d(program, location, v0, v1, v2, v3);
-}
-
-inline void QOpenGLFunctions_4_3_Compatibility::glProgramUniform4fv(GLuint program, GLint location, GLsizei count, const GLfloat *value)
-{
- d_4_1_Core->f.ProgramUniform4fv(program, location, count, value);
-}
-
-inline void QOpenGLFunctions_4_3_Compatibility::glProgramUniform4f(GLuint program, GLint location, GLfloat v0, GLfloat v1, GLfloat v2, GLfloat v3)
-{
- d_4_1_Core->f.ProgramUniform4f(program, location, v0, v1, v2, v3);
-}
-
-inline void QOpenGLFunctions_4_3_Compatibility::glProgramUniform4iv(GLuint program, GLint location, GLsizei count, const GLint *value)
-{
- d_4_1_Core->f.ProgramUniform4iv(program, location, count, value);
-}
-
-inline void QOpenGLFunctions_4_3_Compatibility::glProgramUniform4i(GLuint program, GLint location, GLint v0, GLint v1, GLint v2, GLint v3)
-{
- d_4_1_Core->f.ProgramUniform4i(program, location, v0, v1, v2, v3);
-}
-
-inline void QOpenGLFunctions_4_3_Compatibility::glProgramUniform3uiv(GLuint program, GLint location, GLsizei count, const GLuint *value)
-{
- d_4_1_Core->f.ProgramUniform3uiv(program, location, count, value);
-}
-
-inline void QOpenGLFunctions_4_3_Compatibility::glProgramUniform3ui(GLuint program, GLint location, GLuint v0, GLuint v1, GLuint v2)
-{
- d_4_1_Core->f.ProgramUniform3ui(program, location, v0, v1, v2);
-}
-
-inline void QOpenGLFunctions_4_3_Compatibility::glProgramUniform3dv(GLuint program, GLint location, GLsizei count, const GLdouble *value)
-{
- d_4_1_Core->f.ProgramUniform3dv(program, location, count, value);
-}
-
-inline void QOpenGLFunctions_4_3_Compatibility::glProgramUniform3d(GLuint program, GLint location, GLdouble v0, GLdouble v1, GLdouble v2)
-{
- d_4_1_Core->f.ProgramUniform3d(program, location, v0, v1, v2);
-}
-
-inline void QOpenGLFunctions_4_3_Compatibility::glProgramUniform3fv(GLuint program, GLint location, GLsizei count, const GLfloat *value)
-{
- d_4_1_Core->f.ProgramUniform3fv(program, location, count, value);
-}
-
-inline void QOpenGLFunctions_4_3_Compatibility::glProgramUniform3f(GLuint program, GLint location, GLfloat v0, GLfloat v1, GLfloat v2)
-{
- d_4_1_Core->f.ProgramUniform3f(program, location, v0, v1, v2);
-}
-
-inline void QOpenGLFunctions_4_3_Compatibility::glProgramUniform3iv(GLuint program, GLint location, GLsizei count, const GLint *value)
-{
- d_4_1_Core->f.ProgramUniform3iv(program, location, count, value);
-}
-
-inline void QOpenGLFunctions_4_3_Compatibility::glProgramUniform3i(GLuint program, GLint location, GLint v0, GLint v1, GLint v2)
-{
- d_4_1_Core->f.ProgramUniform3i(program, location, v0, v1, v2);
-}
-
-inline void QOpenGLFunctions_4_3_Compatibility::glProgramUniform2uiv(GLuint program, GLint location, GLsizei count, const GLuint *value)
-{
- d_4_1_Core->f.ProgramUniform2uiv(program, location, count, value);
-}
-
-inline void QOpenGLFunctions_4_3_Compatibility::glProgramUniform2ui(GLuint program, GLint location, GLuint v0, GLuint v1)
-{
- d_4_1_Core->f.ProgramUniform2ui(program, location, v0, v1);
-}
-
-inline void QOpenGLFunctions_4_3_Compatibility::glProgramUniform2dv(GLuint program, GLint location, GLsizei count, const GLdouble *value)
-{
- d_4_1_Core->f.ProgramUniform2dv(program, location, count, value);
-}
-
-inline void QOpenGLFunctions_4_3_Compatibility::glProgramUniform2d(GLuint program, GLint location, GLdouble v0, GLdouble v1)
-{
- d_4_1_Core->f.ProgramUniform2d(program, location, v0, v1);
-}
-
-inline void QOpenGLFunctions_4_3_Compatibility::glProgramUniform2fv(GLuint program, GLint location, GLsizei count, const GLfloat *value)
-{
- d_4_1_Core->f.ProgramUniform2fv(program, location, count, value);
-}
-
-inline void QOpenGLFunctions_4_3_Compatibility::glProgramUniform2f(GLuint program, GLint location, GLfloat v0, GLfloat v1)
-{
- d_4_1_Core->f.ProgramUniform2f(program, location, v0, v1);
-}
-
-inline void QOpenGLFunctions_4_3_Compatibility::glProgramUniform2iv(GLuint program, GLint location, GLsizei count, const GLint *value)
-{
- d_4_1_Core->f.ProgramUniform2iv(program, location, count, value);
-}
-
-inline void QOpenGLFunctions_4_3_Compatibility::glProgramUniform2i(GLuint program, GLint location, GLint v0, GLint v1)
-{
- d_4_1_Core->f.ProgramUniform2i(program, location, v0, v1);
-}
-
-inline void QOpenGLFunctions_4_3_Compatibility::glProgramUniform1uiv(GLuint program, GLint location, GLsizei count, const GLuint *value)
-{
- d_4_1_Core->f.ProgramUniform1uiv(program, location, count, value);
-}
-
-inline void QOpenGLFunctions_4_3_Compatibility::glProgramUniform1ui(GLuint program, GLint location, GLuint v0)
-{
- d_4_1_Core->f.ProgramUniform1ui(program, location, v0);
-}
-
-inline void QOpenGLFunctions_4_3_Compatibility::glProgramUniform1dv(GLuint program, GLint location, GLsizei count, const GLdouble *value)
-{
- d_4_1_Core->f.ProgramUniform1dv(program, location, count, value);
-}
-
-inline void QOpenGLFunctions_4_3_Compatibility::glProgramUniform1d(GLuint program, GLint location, GLdouble v0)
-{
- d_4_1_Core->f.ProgramUniform1d(program, location, v0);
-}
-
-inline void QOpenGLFunctions_4_3_Compatibility::glProgramUniform1fv(GLuint program, GLint location, GLsizei count, const GLfloat *value)
-{
- d_4_1_Core->f.ProgramUniform1fv(program, location, count, value);
-}
-
-inline void QOpenGLFunctions_4_3_Compatibility::glProgramUniform1f(GLuint program, GLint location, GLfloat v0)
-{
- d_4_1_Core->f.ProgramUniform1f(program, location, v0);
-}
-
-inline void QOpenGLFunctions_4_3_Compatibility::glProgramUniform1iv(GLuint program, GLint location, GLsizei count, const GLint *value)
-{
- d_4_1_Core->f.ProgramUniform1iv(program, location, count, value);
-}
-
-inline void QOpenGLFunctions_4_3_Compatibility::glProgramUniform1i(GLuint program, GLint location, GLint v0)
-{
- d_4_1_Core->f.ProgramUniform1i(program, location, v0);
-}
-
-inline void QOpenGLFunctions_4_3_Compatibility::glGetProgramPipelineiv(GLuint pipeline, GLenum pname, GLint *params)
-{
- d_4_1_Core->f.GetProgramPipelineiv(pipeline, pname, params);
-}
-
-inline GLboolean QOpenGLFunctions_4_3_Compatibility::glIsProgramPipeline(GLuint pipeline)
-{
- return d_4_1_Core->f.IsProgramPipeline(pipeline);
-}
-
-inline void QOpenGLFunctions_4_3_Compatibility::glGenProgramPipelines(GLsizei n, GLuint *pipelines)
-{
- d_4_1_Core->f.GenProgramPipelines(n, pipelines);
-}
-
-inline void QOpenGLFunctions_4_3_Compatibility::glDeleteProgramPipelines(GLsizei n, const GLuint *pipelines)
-{
- d_4_1_Core->f.DeleteProgramPipelines(n, pipelines);
-}
-
-inline void QOpenGLFunctions_4_3_Compatibility::glBindProgramPipeline(GLuint pipeline)
-{
- d_4_1_Core->f.BindProgramPipeline(pipeline);
-}
-
-inline GLuint QOpenGLFunctions_4_3_Compatibility::glCreateShaderProgramv(GLenum type, GLsizei count, const GLchar* const *strings)
-{
- return d_4_1_Core->f.CreateShaderProgramv(type, count, strings);
-}
-
-inline void QOpenGLFunctions_4_3_Compatibility::glActiveShaderProgram(GLuint pipeline, GLuint program)
-{
- d_4_1_Core->f.ActiveShaderProgram(pipeline, program);
-}
-
-inline void QOpenGLFunctions_4_3_Compatibility::glUseProgramStages(GLuint pipeline, GLbitfield stages, GLuint program)
-{
- d_4_1_Core->f.UseProgramStages(pipeline, stages, program);
-}
-
-inline void QOpenGLFunctions_4_3_Compatibility::glProgramParameteri(GLuint program, GLenum pname, GLint value)
-{
- d_4_1_Core->f.ProgramParameteri(program, pname, value);
-}
-
-inline void QOpenGLFunctions_4_3_Compatibility::glProgramBinary(GLuint program, GLenum binaryFormat, const GLvoid *binary, GLsizei length)
-{
- d_4_1_Core->f.ProgramBinary(program, binaryFormat, binary, length);
-}
-
-inline void QOpenGLFunctions_4_3_Compatibility::glGetProgramBinary(GLuint program, GLsizei bufSize, GLsizei *length, GLenum *binaryFormat, GLvoid *binary)
-{
- d_4_1_Core->f.GetProgramBinary(program, bufSize, length, binaryFormat, binary);
-}
-
-inline void QOpenGLFunctions_4_3_Compatibility::glClearDepthf(GLfloat dd)
-{
- d_4_1_Core->f.ClearDepthf(dd);
-}
-
-inline void QOpenGLFunctions_4_3_Compatibility::glDepthRangef(GLfloat n, GLfloat f)
-{
- d_4_1_Core->f.DepthRangef(n, f);
-}
-
-inline void QOpenGLFunctions_4_3_Compatibility::glGetShaderPrecisionFormat(GLenum shadertype, GLenum precisiontype, GLint *range, GLint *precision)
-{
- d_4_1_Core->f.GetShaderPrecisionFormat(shadertype, precisiontype, range, precision);
-}
-
-inline void QOpenGLFunctions_4_3_Compatibility::glShaderBinary(GLsizei count, const GLuint *shaders, GLenum binaryformat, const GLvoid *binary, GLsizei length)
-{
- d_4_1_Core->f.ShaderBinary(count, shaders, binaryformat, binary, length);
-}
-
-inline void QOpenGLFunctions_4_3_Compatibility::glReleaseShaderCompiler()
-{
- d_4_1_Core->f.ReleaseShaderCompiler();
-}
-
-
-// OpenGL 4.2 core functions
-inline void QOpenGLFunctions_4_3_Compatibility::glTexStorage3D(GLenum target, GLsizei levels, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth)
-{
- d_4_2_Core->f.TexStorage3D(target, levels, internalformat, width, height, depth);
-}
-
-inline void QOpenGLFunctions_4_3_Compatibility::glTexStorage2D(GLenum target, GLsizei levels, GLenum internalformat, GLsizei width, GLsizei height)
-{
- d_4_2_Core->f.TexStorage2D(target, levels, internalformat, width, height);
-}
-
-inline void QOpenGLFunctions_4_3_Compatibility::glTexStorage1D(GLenum target, GLsizei levels, GLenum internalformat, GLsizei width)
-{
- d_4_2_Core->f.TexStorage1D(target, levels, internalformat, width);
-}
-
-inline void QOpenGLFunctions_4_3_Compatibility::glMemoryBarrier(GLbitfield barriers)
-{
- d_4_2_Core->f.MemoryBarrier(barriers);
-}
-
-inline void QOpenGLFunctions_4_3_Compatibility::glBindImageTexture(GLuint unit, GLuint texture, GLint level, GLboolean layered, GLint layer, GLenum access, GLenum format)
-{
- d_4_2_Core->f.BindImageTexture(unit, texture, level, layered, layer, access, format);
-}
-
-inline void QOpenGLFunctions_4_3_Compatibility::glGetActiveAtomicCounterBufferiv(GLuint program, GLuint bufferIndex, GLenum pname, GLint *params)
-{
- d_4_2_Core->f.GetActiveAtomicCounterBufferiv(program, bufferIndex, pname, params);
-}
-
-inline void QOpenGLFunctions_4_3_Compatibility::glGetInternalformativ(GLenum target, GLenum internalformat, GLenum pname, GLsizei bufSize, GLint *params)
-{
- d_4_2_Core->f.GetInternalformativ(target, internalformat, pname, bufSize, params);
-}
-
-inline void QOpenGLFunctions_4_3_Compatibility::glDrawTransformFeedbackStreamInstanced(GLenum mode, GLuint id, GLuint stream, GLsizei instancecount)
-{
- d_4_2_Core->f.DrawTransformFeedbackStreamInstanced(mode, id, stream, instancecount);
-}
-
-inline void QOpenGLFunctions_4_3_Compatibility::glDrawTransformFeedbackInstanced(GLenum mode, GLuint id, GLsizei instancecount)
-{
- d_4_2_Core->f.DrawTransformFeedbackInstanced(mode, id, instancecount);
-}
-
-inline void QOpenGLFunctions_4_3_Compatibility::glDrawElementsInstancedBaseVertexBaseInstance(GLenum mode, GLsizei count, GLenum type, const void *indices, GLsizei instancecount, GLint basevertex, GLuint baseinstance)
-{
- d_4_2_Core->f.DrawElementsInstancedBaseVertexBaseInstance(mode, count, type, indices, instancecount, basevertex, baseinstance);
-}
-
-inline void QOpenGLFunctions_4_3_Compatibility::glDrawElementsInstancedBaseInstance(GLenum mode, GLsizei count, GLenum type, const void *indices, GLsizei instancecount, GLuint baseinstance)
-{
- d_4_2_Core->f.DrawElementsInstancedBaseInstance(mode, count, type, indices, instancecount, baseinstance);
-}
-
-inline void QOpenGLFunctions_4_3_Compatibility::glDrawArraysInstancedBaseInstance(GLenum mode, GLint first, GLsizei count, GLsizei instancecount, GLuint baseinstance)
-{
- d_4_2_Core->f.DrawArraysInstancedBaseInstance(mode, first, count, instancecount, baseinstance);
-}
-
-
-// OpenGL 4.3 core functions
-inline void QOpenGLFunctions_4_3_Compatibility::glTexStorage3DMultisample(GLenum target, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth, GLboolean fixedsamplelocations)
-{
- d_4_3_Core->f.TexStorage3DMultisample(target, samples, internalformat, width, height, depth, fixedsamplelocations);
-}
-
-inline void QOpenGLFunctions_4_3_Compatibility::glTexStorage2DMultisample(GLenum target, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height, GLboolean fixedsamplelocations)
-{
- d_4_3_Core->f.TexStorage2DMultisample(target, samples, internalformat, width, height, fixedsamplelocations);
-}
-
-inline void QOpenGLFunctions_4_3_Compatibility::glTexBufferRange(GLenum target, GLenum internalformat, GLuint buffer, GLintptr offset, GLsizeiptr size)
-{
- d_4_3_Core->f.TexBufferRange(target, internalformat, buffer, offset, size);
-}
-
-inline void QOpenGLFunctions_4_3_Compatibility::glShaderStorageBlockBinding(GLuint program, GLuint storageBlockIndex, GLuint storageBlockBinding)
-{
- d_4_3_Core->f.ShaderStorageBlockBinding(program, storageBlockIndex, storageBlockBinding);
-}
-
-inline GLint QOpenGLFunctions_4_3_Compatibility::glGetProgramResourceLocationIndex(GLuint program, GLenum programInterface, const GLchar *name)
-{
- return d_4_3_Core->f.GetProgramResourceLocationIndex(program, programInterface, name);
-}
-
-inline GLint QOpenGLFunctions_4_3_Compatibility::glGetProgramResourceLocation(GLuint program, GLenum programInterface, const GLchar *name)
-{
- return d_4_3_Core->f.GetProgramResourceLocation(program, programInterface, name);
-}
-
-inline void QOpenGLFunctions_4_3_Compatibility::glGetProgramResourceiv(GLuint program, GLenum programInterface, GLuint index, GLsizei propCount, const GLenum *props, GLsizei bufSize, GLsizei *length, GLint *params)
-{
- d_4_3_Core->f.GetProgramResourceiv(program, programInterface, index, propCount, props, bufSize, length, params);
-}
-
-inline void QOpenGLFunctions_4_3_Compatibility::glGetProgramResourceName(GLuint program, GLenum programInterface, GLuint index, GLsizei bufSize, GLsizei *length, GLchar *name)
-{
- d_4_3_Core->f.GetProgramResourceName(program, programInterface, index, bufSize, length, name);
-}
-
-inline GLuint QOpenGLFunctions_4_3_Compatibility::glGetProgramResourceIndex(GLuint program, GLenum programInterface, const GLchar *name)
-{
- return d_4_3_Core->f.GetProgramResourceIndex(program, programInterface, name);
-}
-
-inline void QOpenGLFunctions_4_3_Compatibility::glGetProgramInterfaceiv(GLuint program, GLenum programInterface, GLenum pname, GLint *params)
-{
- d_4_3_Core->f.GetProgramInterfaceiv(program, programInterface, pname, params);
-}
-
-inline void QOpenGLFunctions_4_3_Compatibility::glMultiDrawElementsIndirect(GLenum mode, GLenum type, const void *indirect, GLsizei drawcount, GLsizei stride)
-{
- d_4_3_Core->f.MultiDrawElementsIndirect(mode, type, indirect, drawcount, stride);
-}
-
-inline void QOpenGLFunctions_4_3_Compatibility::glMultiDrawArraysIndirect(GLenum mode, const void *indirect, GLsizei drawcount, GLsizei stride)
-{
- d_4_3_Core->f.MultiDrawArraysIndirect(mode, indirect, drawcount, stride);
-}
-
-inline void QOpenGLFunctions_4_3_Compatibility::glInvalidateSubFramebuffer(GLenum target, GLsizei numAttachments, const GLenum *attachments, GLint x, GLint y, GLsizei width, GLsizei height)
-{
- d_4_3_Core->f.InvalidateSubFramebuffer(target, numAttachments, attachments, x, y, width, height);
-}
-
-inline void QOpenGLFunctions_4_3_Compatibility::glInvalidateFramebuffer(GLenum target, GLsizei numAttachments, const GLenum *attachments)
-{
- d_4_3_Core->f.InvalidateFramebuffer(target, numAttachments, attachments);
-}
-
-inline void QOpenGLFunctions_4_3_Compatibility::glInvalidateBufferData(GLuint buffer)
-{
- d_4_3_Core->f.InvalidateBufferData(buffer);
-}
-
-inline void QOpenGLFunctions_4_3_Compatibility::glInvalidateBufferSubData(GLuint buffer, GLintptr offset, GLsizeiptr length)
-{
- d_4_3_Core->f.InvalidateBufferSubData(buffer, offset, length);
-}
-
-inline void QOpenGLFunctions_4_3_Compatibility::glInvalidateTexImage(GLuint texture, GLint level)
-{
- d_4_3_Core->f.InvalidateTexImage(texture, level);
-}
-
-inline void QOpenGLFunctions_4_3_Compatibility::glInvalidateTexSubImage(GLuint texture, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth)
-{
- d_4_3_Core->f.InvalidateTexSubImage(texture, level, xoffset, yoffset, zoffset, width, height, depth);
-}
-
-inline void QOpenGLFunctions_4_3_Compatibility::glGetInternalformati64v(GLenum target, GLenum internalformat, GLenum pname, GLsizei bufSize, GLint64 *params)
-{
- d_4_3_Core->f.GetInternalformati64v(target, internalformat, pname, bufSize, params);
-}
-
-inline void QOpenGLFunctions_4_3_Compatibility::glGetFramebufferParameteriv(GLenum target, GLenum pname, GLint *params)
-{
- d_4_3_Core->f.GetFramebufferParameteriv(target, pname, params);
-}
-
-inline void QOpenGLFunctions_4_3_Compatibility::glFramebufferParameteri(GLenum target, GLenum pname, GLint param)
-{
- d_4_3_Core->f.FramebufferParameteri(target, pname, param);
-}
-
-inline void QOpenGLFunctions_4_3_Compatibility::glVertexBindingDivisor(GLuint bindingindex, GLuint divisor)
-{
- d_4_3_Core->f.VertexBindingDivisor(bindingindex, divisor);
-}
-
-inline void QOpenGLFunctions_4_3_Compatibility::glVertexAttribBinding(GLuint attribindex, GLuint bindingindex)
-{
- d_4_3_Core->f.VertexAttribBinding(attribindex, bindingindex);
-}
-
-inline void QOpenGLFunctions_4_3_Compatibility::glVertexAttribLFormat(GLuint attribindex, GLint size, GLenum type, GLuint relativeoffset)
-{
- d_4_3_Core->f.VertexAttribLFormat(attribindex, size, type, relativeoffset);
-}
-
-inline void QOpenGLFunctions_4_3_Compatibility::glVertexAttribIFormat(GLuint attribindex, GLint size, GLenum type, GLuint relativeoffset)
-{
- d_4_3_Core->f.VertexAttribIFormat(attribindex, size, type, relativeoffset);
-}
-
-inline void QOpenGLFunctions_4_3_Compatibility::glVertexAttribFormat(GLuint attribindex, GLint size, GLenum type, GLboolean normalized, GLuint relativeoffset)
-{
- d_4_3_Core->f.VertexAttribFormat(attribindex, size, type, normalized, relativeoffset);
-}
-
-inline void QOpenGLFunctions_4_3_Compatibility::glBindVertexBuffer(GLuint bindingindex, GLuint buffer, GLintptr offset, GLsizei stride)
-{
- d_4_3_Core->f.BindVertexBuffer(bindingindex, buffer, offset, stride);
-}
-
-inline void QOpenGLFunctions_4_3_Compatibility::glTextureView(GLuint texture, GLenum target, GLuint origtexture, GLenum internalformat, GLuint minlevel, GLuint numlevels, GLuint minlayer, GLuint numlayers)
-{
- d_4_3_Core->f.TextureView(texture, target, origtexture, internalformat, minlevel, numlevels, minlayer, numlayers);
-}
-
-inline void QOpenGLFunctions_4_3_Compatibility::glCopyImageSubData(GLuint srcName, GLenum srcTarget, GLint srcLevel, GLint srcX, GLint srcY, GLint srcZ, GLuint dstName, GLenum dstTarget, GLint dstLevel, GLint dstX, GLint dstY, GLint dstZ, GLsizei srcWidth, GLsizei srcHeight, GLsizei srcDepth)
-{
- d_4_3_Core->f.CopyImageSubData(srcName, srcTarget, srcLevel, srcX, srcY, srcZ, dstName, dstTarget, dstLevel, dstX, dstY, dstZ, srcWidth, srcHeight, srcDepth);
-}
-
-inline void QOpenGLFunctions_4_3_Compatibility::glDispatchComputeIndirect(GLintptr indirect)
-{
- d_4_3_Core->f.DispatchComputeIndirect(indirect);
-}
-
-inline void QOpenGLFunctions_4_3_Compatibility::glDispatchCompute(GLuint num_groups_x, GLuint num_groups_y, GLuint num_groups_z)
-{
- d_4_3_Core->f.DispatchCompute(num_groups_x, num_groups_y, num_groups_z);
-}
-
-inline void QOpenGLFunctions_4_3_Compatibility::glClearBufferSubData(GLenum target, GLenum internalformat, GLintptr offset, GLsizeiptr size, GLenum format, GLenum type, const void *data)
-{
- d_4_3_Core->f.ClearBufferSubData(target, internalformat, offset, size, format, type, data);
-}
-
-inline void QOpenGLFunctions_4_3_Compatibility::glClearBufferData(GLenum target, GLenum internalformat, GLenum format, GLenum type, const void *data)
-{
- d_4_3_Core->f.ClearBufferData(target, internalformat, format, type, data);
-}
-
-
-// OpenGL 1.0 deprecated functions
-inline void QOpenGLFunctions_4_3_Compatibility::glTranslatef(GLfloat x, GLfloat y, GLfloat z)
-{
- d_1_0_Deprecated->f.Translatef(x, y, z);
-}
-
-inline void QOpenGLFunctions_4_3_Compatibility::glTranslated(GLdouble x, GLdouble y, GLdouble z)
-{
- d_1_0_Deprecated->f.Translated(x, y, z);
-}
-
-inline void QOpenGLFunctions_4_3_Compatibility::glScalef(GLfloat x, GLfloat y, GLfloat z)
-{
- d_1_0_Deprecated->f.Scalef(x, y, z);
-}
-
-inline void QOpenGLFunctions_4_3_Compatibility::glScaled(GLdouble x, GLdouble y, GLdouble z)
-{
- d_1_0_Deprecated->f.Scaled(x, y, z);
-}
-
-inline void QOpenGLFunctions_4_3_Compatibility::glRotatef(GLfloat angle, GLfloat x, GLfloat y, GLfloat z)
-{
- d_1_0_Deprecated->f.Rotatef(angle, x, y, z);
-}
-
-inline void QOpenGLFunctions_4_3_Compatibility::glRotated(GLdouble angle, GLdouble x, GLdouble y, GLdouble z)
-{
- d_1_0_Deprecated->f.Rotated(angle, x, y, z);
-}
-
-inline void QOpenGLFunctions_4_3_Compatibility::glPushMatrix()
-{
- d_1_0_Deprecated->f.PushMatrix();
-}
-
-inline void QOpenGLFunctions_4_3_Compatibility::glPopMatrix()
-{
- d_1_0_Deprecated->f.PopMatrix();
-}
-
-inline void QOpenGLFunctions_4_3_Compatibility::glOrtho(GLdouble left, GLdouble right, GLdouble bottom, GLdouble top, GLdouble zNear, GLdouble zFar)
-{
- d_1_0_Deprecated->f.Ortho(left, right, bottom, top, zNear, zFar);
-}
-
-inline void QOpenGLFunctions_4_3_Compatibility::glMultMatrixd(const GLdouble *m)
-{
- d_1_0_Deprecated->f.MultMatrixd(m);
-}
-
-inline void QOpenGLFunctions_4_3_Compatibility::glMultMatrixf(const GLfloat *m)
-{
- d_1_0_Deprecated->f.MultMatrixf(m);
-}
-
-inline void QOpenGLFunctions_4_3_Compatibility::glMatrixMode(GLenum mode)
-{
- d_1_0_Deprecated->f.MatrixMode(mode);
-}
-
-inline void QOpenGLFunctions_4_3_Compatibility::glLoadMatrixd(const GLdouble *m)
-{
- d_1_0_Deprecated->f.LoadMatrixd(m);
-}
-
-inline void QOpenGLFunctions_4_3_Compatibility::glLoadMatrixf(const GLfloat *m)
-{
- d_1_0_Deprecated->f.LoadMatrixf(m);
-}
-
-inline void QOpenGLFunctions_4_3_Compatibility::glLoadIdentity()
-{
- d_1_0_Deprecated->f.LoadIdentity();
-}
-
-inline void QOpenGLFunctions_4_3_Compatibility::glFrustum(GLdouble left, GLdouble right, GLdouble bottom, GLdouble top, GLdouble zNear, GLdouble zFar)
-{
- d_1_0_Deprecated->f.Frustum(left, right, bottom, top, zNear, zFar);
-}
-
-inline GLboolean QOpenGLFunctions_4_3_Compatibility::glIsList(GLuint list)
-{
- return d_1_0_Deprecated->f.IsList(list);
-}
-
-inline void QOpenGLFunctions_4_3_Compatibility::glGetTexGeniv(GLenum coord, GLenum pname, GLint *params)
-{
- d_1_0_Deprecated->f.GetTexGeniv(coord, pname, params);
-}
-
-inline void QOpenGLFunctions_4_3_Compatibility::glGetTexGenfv(GLenum coord, GLenum pname, GLfloat *params)
-{
- d_1_0_Deprecated->f.GetTexGenfv(coord, pname, params);
-}
-
-inline void QOpenGLFunctions_4_3_Compatibility::glGetTexGendv(GLenum coord, GLenum pname, GLdouble *params)
-{
- d_1_0_Deprecated->f.GetTexGendv(coord, pname, params);
-}
-
-inline void QOpenGLFunctions_4_3_Compatibility::glGetTexEnviv(GLenum target, GLenum pname, GLint *params)
-{
- d_1_0_Deprecated->f.GetTexEnviv(target, pname, params);
-}
-
-inline void QOpenGLFunctions_4_3_Compatibility::glGetTexEnvfv(GLenum target, GLenum pname, GLfloat *params)
-{
- d_1_0_Deprecated->f.GetTexEnvfv(target, pname, params);
-}
-
-inline void QOpenGLFunctions_4_3_Compatibility::glGetPolygonStipple(GLubyte *mask)
-{
- d_1_0_Deprecated->f.GetPolygonStipple(mask);
-}
-
-inline void QOpenGLFunctions_4_3_Compatibility::glGetPixelMapusv(GLenum map, GLushort *values)
-{
- d_1_0_Deprecated->f.GetPixelMapusv(map, values);
-}
-
-inline void QOpenGLFunctions_4_3_Compatibility::glGetPixelMapuiv(GLenum map, GLuint *values)
-{
- d_1_0_Deprecated->f.GetPixelMapuiv(map, values);
-}
-
-inline void QOpenGLFunctions_4_3_Compatibility::glGetPixelMapfv(GLenum map, GLfloat *values)
-{
- d_1_0_Deprecated->f.GetPixelMapfv(map, values);
-}
-
-inline void QOpenGLFunctions_4_3_Compatibility::glGetMaterialiv(GLenum face, GLenum pname, GLint *params)
-{
- d_1_0_Deprecated->f.GetMaterialiv(face, pname, params);
-}
-
-inline void QOpenGLFunctions_4_3_Compatibility::glGetMaterialfv(GLenum face, GLenum pname, GLfloat *params)
-{
- d_1_0_Deprecated->f.GetMaterialfv(face, pname, params);
-}
-
-inline void QOpenGLFunctions_4_3_Compatibility::glGetMapiv(GLenum target, GLenum query, GLint *v)
-{
- d_1_0_Deprecated->f.GetMapiv(target, query, v);
-}
-
-inline void QOpenGLFunctions_4_3_Compatibility::glGetMapfv(GLenum target, GLenum query, GLfloat *v)
-{
- d_1_0_Deprecated->f.GetMapfv(target, query, v);
-}
-
-inline void QOpenGLFunctions_4_3_Compatibility::glGetMapdv(GLenum target, GLenum query, GLdouble *v)
-{
- d_1_0_Deprecated->f.GetMapdv(target, query, v);
-}
-
-inline void QOpenGLFunctions_4_3_Compatibility::glGetLightiv(GLenum light, GLenum pname, GLint *params)
-{
- d_1_0_Deprecated->f.GetLightiv(light, pname, params);
-}
-
-inline void QOpenGLFunctions_4_3_Compatibility::glGetLightfv(GLenum light, GLenum pname, GLfloat *params)
-{
- d_1_0_Deprecated->f.GetLightfv(light, pname, params);
-}
-
-inline void QOpenGLFunctions_4_3_Compatibility::glGetClipPlane(GLenum plane, GLdouble *equation)
-{
- d_1_0_Deprecated->f.GetClipPlane(plane, equation);
-}
-
-inline void QOpenGLFunctions_4_3_Compatibility::glDrawPixels(GLsizei width, GLsizei height, GLenum format, GLenum type, const GLvoid *pixels)
-{
- d_1_0_Deprecated->f.DrawPixels(width, height, format, type, pixels);
-}
-
-inline void QOpenGLFunctions_4_3_Compatibility::glCopyPixels(GLint x, GLint y, GLsizei width, GLsizei height, GLenum type)
-{
- d_1_0_Deprecated->f.CopyPixels(x, y, width, height, type);
-}
-
-inline void QOpenGLFunctions_4_3_Compatibility::glPixelMapusv(GLenum map, GLint mapsize, const GLushort *values)
-{
- d_1_0_Deprecated->f.PixelMapusv(map, mapsize, values);
-}
-
-inline void QOpenGLFunctions_4_3_Compatibility::glPixelMapuiv(GLenum map, GLint mapsize, const GLuint *values)
-{
- d_1_0_Deprecated->f.PixelMapuiv(map, mapsize, values);
-}
-
-inline void QOpenGLFunctions_4_3_Compatibility::glPixelMapfv(GLenum map, GLint mapsize, const GLfloat *values)
-{
- d_1_0_Deprecated->f.PixelMapfv(map, mapsize, values);
-}
-
-inline void QOpenGLFunctions_4_3_Compatibility::glPixelTransferi(GLenum pname, GLint param)
-{
- d_1_0_Deprecated->f.PixelTransferi(pname, param);
-}
-
-inline void QOpenGLFunctions_4_3_Compatibility::glPixelTransferf(GLenum pname, GLfloat param)
-{
- d_1_0_Deprecated->f.PixelTransferf(pname, param);
-}
-
-inline void QOpenGLFunctions_4_3_Compatibility::glPixelZoom(GLfloat xfactor, GLfloat yfactor)
-{
- d_1_0_Deprecated->f.PixelZoom(xfactor, yfactor);
-}
-
-inline void QOpenGLFunctions_4_3_Compatibility::glAlphaFunc(GLenum func, GLfloat ref)
-{
- d_1_0_Deprecated->f.AlphaFunc(func, ref);
-}
-
-inline void QOpenGLFunctions_4_3_Compatibility::glEvalPoint2(GLint i, GLint j)
-{
- d_1_0_Deprecated->f.EvalPoint2(i, j);
-}
-
-inline void QOpenGLFunctions_4_3_Compatibility::glEvalMesh2(GLenum mode, GLint i1, GLint i2, GLint j1, GLint j2)
-{
- d_1_0_Deprecated->f.EvalMesh2(mode, i1, i2, j1, j2);
-}
-
-inline void QOpenGLFunctions_4_3_Compatibility::glEvalPoint1(GLint i)
-{
- d_1_0_Deprecated->f.EvalPoint1(i);
-}
-
-inline void QOpenGLFunctions_4_3_Compatibility::glEvalMesh1(GLenum mode, GLint i1, GLint i2)
-{
- d_1_0_Deprecated->f.EvalMesh1(mode, i1, i2);
-}
-
-inline void QOpenGLFunctions_4_3_Compatibility::glEvalCoord2fv(const GLfloat *u)
-{
- d_1_0_Deprecated->f.EvalCoord2fv(u);
-}
-
-inline void QOpenGLFunctions_4_3_Compatibility::glEvalCoord2f(GLfloat u, GLfloat v)
-{
- d_1_0_Deprecated->f.EvalCoord2f(u, v);
-}
-
-inline void QOpenGLFunctions_4_3_Compatibility::glEvalCoord2dv(const GLdouble *u)
-{
- d_1_0_Deprecated->f.EvalCoord2dv(u);
-}
-
-inline void QOpenGLFunctions_4_3_Compatibility::glEvalCoord2d(GLdouble u, GLdouble v)
-{
- d_1_0_Deprecated->f.EvalCoord2d(u, v);
-}
-
-inline void QOpenGLFunctions_4_3_Compatibility::glEvalCoord1fv(const GLfloat *u)
-{
- d_1_0_Deprecated->f.EvalCoord1fv(u);
-}
-
-inline void QOpenGLFunctions_4_3_Compatibility::glEvalCoord1f(GLfloat u)
-{
- d_1_0_Deprecated->f.EvalCoord1f(u);
-}
-
-inline void QOpenGLFunctions_4_3_Compatibility::glEvalCoord1dv(const GLdouble *u)
-{
- d_1_0_Deprecated->f.EvalCoord1dv(u);
-}
-
-inline void QOpenGLFunctions_4_3_Compatibility::glEvalCoord1d(GLdouble u)
-{
- d_1_0_Deprecated->f.EvalCoord1d(u);
-}
-
-inline void QOpenGLFunctions_4_3_Compatibility::glMapGrid2f(GLint un, GLfloat u1, GLfloat u2, GLint vn, GLfloat v1, GLfloat v2)
-{
- d_1_0_Deprecated->f.MapGrid2f(un, u1, u2, vn, v1, v2);
-}
-
-inline void QOpenGLFunctions_4_3_Compatibility::glMapGrid2d(GLint un, GLdouble u1, GLdouble u2, GLint vn, GLdouble v1, GLdouble v2)
-{
- d_1_0_Deprecated->f.MapGrid2d(un, u1, u2, vn, v1, v2);
-}
-
-inline void QOpenGLFunctions_4_3_Compatibility::glMapGrid1f(GLint un, GLfloat u1, GLfloat u2)
-{
- d_1_0_Deprecated->f.MapGrid1f(un, u1, u2);
-}
-
-inline void QOpenGLFunctions_4_3_Compatibility::glMapGrid1d(GLint un, GLdouble u1, GLdouble u2)
-{
- d_1_0_Deprecated->f.MapGrid1d(un, u1, u2);
-}
-
-inline void QOpenGLFunctions_4_3_Compatibility::glMap2f(GLenum target, GLfloat u1, GLfloat u2, GLint ustride, GLint uorder, GLfloat v1, GLfloat v2, GLint vstride, GLint vorder, const GLfloat *points)
-{
- d_1_0_Deprecated->f.Map2f(target, u1, u2, ustride, uorder, v1, v2, vstride, vorder, points);
-}
-
-inline void QOpenGLFunctions_4_3_Compatibility::glMap2d(GLenum target, GLdouble u1, GLdouble u2, GLint ustride, GLint uorder, GLdouble v1, GLdouble v2, GLint vstride, GLint vorder, const GLdouble *points)
-{
- d_1_0_Deprecated->f.Map2d(target, u1, u2, ustride, uorder, v1, v2, vstride, vorder, points);
-}
-
-inline void QOpenGLFunctions_4_3_Compatibility::glMap1f(GLenum target, GLfloat u1, GLfloat u2, GLint stride, GLint order, const GLfloat *points)
-{
- d_1_0_Deprecated->f.Map1f(target, u1, u2, stride, order, points);
-}
-
-inline void QOpenGLFunctions_4_3_Compatibility::glMap1d(GLenum target, GLdouble u1, GLdouble u2, GLint stride, GLint order, const GLdouble *points)
-{
- d_1_0_Deprecated->f.Map1d(target, u1, u2, stride, order, points);
-}
-
-inline void QOpenGLFunctions_4_3_Compatibility::glPushAttrib(GLbitfield mask)
-{
- d_1_0_Deprecated->f.PushAttrib(mask);
-}
-
-inline void QOpenGLFunctions_4_3_Compatibility::glPopAttrib()
-{
- d_1_0_Deprecated->f.PopAttrib();
-}
-
-inline void QOpenGLFunctions_4_3_Compatibility::glAccum(GLenum op, GLfloat value)
-{
- d_1_0_Deprecated->f.Accum(op, value);
-}
-
-inline void QOpenGLFunctions_4_3_Compatibility::glIndexMask(GLuint mask)
-{
- d_1_0_Deprecated->f.IndexMask(mask);
-}
-
-inline void QOpenGLFunctions_4_3_Compatibility::glClearIndex(GLfloat c)
-{
- d_1_0_Deprecated->f.ClearIndex(c);
-}
-
-inline void QOpenGLFunctions_4_3_Compatibility::glClearAccum(GLfloat red, GLfloat green, GLfloat blue, GLfloat alpha)
-{
- d_1_0_Deprecated->f.ClearAccum(red, green, blue, alpha);
-}
-
-inline void QOpenGLFunctions_4_3_Compatibility::glPushName(GLuint name)
-{
- d_1_0_Deprecated->f.PushName(name);
-}
-
-inline void QOpenGLFunctions_4_3_Compatibility::glPopName()
-{
- d_1_0_Deprecated->f.PopName();
-}
-
-inline void QOpenGLFunctions_4_3_Compatibility::glPassThrough(GLfloat token)
-{
- d_1_0_Deprecated->f.PassThrough(token);
-}
-
-inline void QOpenGLFunctions_4_3_Compatibility::glLoadName(GLuint name)
-{
- d_1_0_Deprecated->f.LoadName(name);
-}
-
-inline void QOpenGLFunctions_4_3_Compatibility::glInitNames()
-{
- d_1_0_Deprecated->f.InitNames();
-}
-
-inline GLint QOpenGLFunctions_4_3_Compatibility::glRenderMode(GLenum mode)
-{
- return d_1_0_Deprecated->f.RenderMode(mode);
-}
-
-inline void QOpenGLFunctions_4_3_Compatibility::glSelectBuffer(GLsizei size, GLuint *buffer)
-{
- d_1_0_Deprecated->f.SelectBuffer(size, buffer);
-}
-
-inline void QOpenGLFunctions_4_3_Compatibility::glFeedbackBuffer(GLsizei size, GLenum type, GLfloat *buffer)
-{
- d_1_0_Deprecated->f.FeedbackBuffer(size, type, buffer);
-}
-
-inline void QOpenGLFunctions_4_3_Compatibility::glTexGeniv(GLenum coord, GLenum pname, const GLint *params)
-{
- d_1_0_Deprecated->f.TexGeniv(coord, pname, params);
-}
-
-inline void QOpenGLFunctions_4_3_Compatibility::glTexGeni(GLenum coord, GLenum pname, GLint param)
-{
- d_1_0_Deprecated->f.TexGeni(coord, pname, param);
-}
-
-inline void QOpenGLFunctions_4_3_Compatibility::glTexGenfv(GLenum coord, GLenum pname, const GLfloat *params)
-{
- d_1_0_Deprecated->f.TexGenfv(coord, pname, params);
-}
-
-inline void QOpenGLFunctions_4_3_Compatibility::glTexGenf(GLenum coord, GLenum pname, GLfloat param)
-{
- d_1_0_Deprecated->f.TexGenf(coord, pname, param);
-}
-
-inline void QOpenGLFunctions_4_3_Compatibility::glTexGendv(GLenum coord, GLenum pname, const GLdouble *params)
-{
- d_1_0_Deprecated->f.TexGendv(coord, pname, params);
-}
-
-inline void QOpenGLFunctions_4_3_Compatibility::glTexGend(GLenum coord, GLenum pname, GLdouble param)
-{
- d_1_0_Deprecated->f.TexGend(coord, pname, param);
-}
-
-inline void QOpenGLFunctions_4_3_Compatibility::glTexEnviv(GLenum target, GLenum pname, const GLint *params)
-{
- d_1_0_Deprecated->f.TexEnviv(target, pname, params);
-}
-
-inline void QOpenGLFunctions_4_3_Compatibility::glTexEnvi(GLenum target, GLenum pname, GLint param)
-{
- d_1_0_Deprecated->f.TexEnvi(target, pname, param);
-}
-
-inline void QOpenGLFunctions_4_3_Compatibility::glTexEnvfv(GLenum target, GLenum pname, const GLfloat *params)
-{
- d_1_0_Deprecated->f.TexEnvfv(target, pname, params);
-}
-
-inline void QOpenGLFunctions_4_3_Compatibility::glTexEnvf(GLenum target, GLenum pname, GLfloat param)
-{
- d_1_0_Deprecated->f.TexEnvf(target, pname, param);
-}
-
-inline void QOpenGLFunctions_4_3_Compatibility::glShadeModel(GLenum mode)
-{
- d_1_0_Deprecated->f.ShadeModel(mode);
-}
-
-inline void QOpenGLFunctions_4_3_Compatibility::glPolygonStipple(const GLubyte *mask)
-{
- d_1_0_Deprecated->f.PolygonStipple(mask);
-}
-
-inline void QOpenGLFunctions_4_3_Compatibility::glMaterialiv(GLenum face, GLenum pname, const GLint *params)
-{
- d_1_0_Deprecated->f.Materialiv(face, pname, params);
-}
-
-inline void QOpenGLFunctions_4_3_Compatibility::glMateriali(GLenum face, GLenum pname, GLint param)
-{
- d_1_0_Deprecated->f.Materiali(face, pname, param);
-}
-
-inline void QOpenGLFunctions_4_3_Compatibility::glMaterialfv(GLenum face, GLenum pname, const GLfloat *params)
-{
- d_1_0_Deprecated->f.Materialfv(face, pname, params);
-}
-
-inline void QOpenGLFunctions_4_3_Compatibility::glMaterialf(GLenum face, GLenum pname, GLfloat param)
-{
- d_1_0_Deprecated->f.Materialf(face, pname, param);
-}
-
-inline void QOpenGLFunctions_4_3_Compatibility::glLineStipple(GLint factor, GLushort pattern)
-{
- d_1_0_Deprecated->f.LineStipple(factor, pattern);
-}
-
-inline void QOpenGLFunctions_4_3_Compatibility::glLightModeliv(GLenum pname, const GLint *params)
-{
- d_1_0_Deprecated->f.LightModeliv(pname, params);
-}
-
-inline void QOpenGLFunctions_4_3_Compatibility::glLightModeli(GLenum pname, GLint param)
-{
- d_1_0_Deprecated->f.LightModeli(pname, param);
-}
-
-inline void QOpenGLFunctions_4_3_Compatibility::glLightModelfv(GLenum pname, const GLfloat *params)
-{
- d_1_0_Deprecated->f.LightModelfv(pname, params);
-}
-
-inline void QOpenGLFunctions_4_3_Compatibility::glLightModelf(GLenum pname, GLfloat param)
-{
- d_1_0_Deprecated->f.LightModelf(pname, param);
-}
-
-inline void QOpenGLFunctions_4_3_Compatibility::glLightiv(GLenum light, GLenum pname, const GLint *params)
-{
- d_1_0_Deprecated->f.Lightiv(light, pname, params);
-}
-
-inline void QOpenGLFunctions_4_3_Compatibility::glLighti(GLenum light, GLenum pname, GLint param)
-{
- d_1_0_Deprecated->f.Lighti(light, pname, param);
-}
-
-inline void QOpenGLFunctions_4_3_Compatibility::glLightfv(GLenum light, GLenum pname, const GLfloat *params)
-{
- d_1_0_Deprecated->f.Lightfv(light, pname, params);
-}
-
-inline void QOpenGLFunctions_4_3_Compatibility::glLightf(GLenum light, GLenum pname, GLfloat param)
-{
- d_1_0_Deprecated->f.Lightf(light, pname, param);
-}
-
-inline void QOpenGLFunctions_4_3_Compatibility::glFogiv(GLenum pname, const GLint *params)
-{
- d_1_0_Deprecated->f.Fogiv(pname, params);
-}
-
-inline void QOpenGLFunctions_4_3_Compatibility::glFogi(GLenum pname, GLint param)
-{
- d_1_0_Deprecated->f.Fogi(pname, param);
-}
-
-inline void QOpenGLFunctions_4_3_Compatibility::glFogfv(GLenum pname, const GLfloat *params)
-{
- d_1_0_Deprecated->f.Fogfv(pname, params);
-}
-
-inline void QOpenGLFunctions_4_3_Compatibility::glFogf(GLenum pname, GLfloat param)
-{
- d_1_0_Deprecated->f.Fogf(pname, param);
-}
-
-inline void QOpenGLFunctions_4_3_Compatibility::glColorMaterial(GLenum face, GLenum mode)
-{
- d_1_0_Deprecated->f.ColorMaterial(face, mode);
-}
-
-inline void QOpenGLFunctions_4_3_Compatibility::glClipPlane(GLenum plane, const GLdouble *equation)
-{
- d_1_0_Deprecated->f.ClipPlane(plane, equation);
-}
-
-inline void QOpenGLFunctions_4_3_Compatibility::glVertex4sv(const GLshort *v)
-{
- d_1_0_Deprecated->f.Vertex4sv(v);
-}
-
-inline void QOpenGLFunctions_4_3_Compatibility::glVertex4s(GLshort x, GLshort y, GLshort z, GLshort w)
-{
- d_1_0_Deprecated->f.Vertex4s(x, y, z, w);
-}
-
-inline void QOpenGLFunctions_4_3_Compatibility::glVertex4iv(const GLint *v)
-{
- d_1_0_Deprecated->f.Vertex4iv(v);
-}
-
-inline void QOpenGLFunctions_4_3_Compatibility::glVertex4i(GLint x, GLint y, GLint z, GLint w)
-{
- d_1_0_Deprecated->f.Vertex4i(x, y, z, w);
-}
-
-inline void QOpenGLFunctions_4_3_Compatibility::glVertex4fv(const GLfloat *v)
-{
- d_1_0_Deprecated->f.Vertex4fv(v);
-}
-
-inline void QOpenGLFunctions_4_3_Compatibility::glVertex4f(GLfloat x, GLfloat y, GLfloat z, GLfloat w)
-{
- d_1_0_Deprecated->f.Vertex4f(x, y, z, w);
-}
-
-inline void QOpenGLFunctions_4_3_Compatibility::glVertex4dv(const GLdouble *v)
-{
- d_1_0_Deprecated->f.Vertex4dv(v);
-}
-
-inline void QOpenGLFunctions_4_3_Compatibility::glVertex4d(GLdouble x, GLdouble y, GLdouble z, GLdouble w)
-{
- d_1_0_Deprecated->f.Vertex4d(x, y, z, w);
-}
-
-inline void QOpenGLFunctions_4_3_Compatibility::glVertex3sv(const GLshort *v)
-{
- d_1_0_Deprecated->f.Vertex3sv(v);
-}
-
-inline void QOpenGLFunctions_4_3_Compatibility::glVertex3s(GLshort x, GLshort y, GLshort z)
-{
- d_1_0_Deprecated->f.Vertex3s(x, y, z);
-}
-
-inline void QOpenGLFunctions_4_3_Compatibility::glVertex3iv(const GLint *v)
-{
- d_1_0_Deprecated->f.Vertex3iv(v);
-}
-
-inline void QOpenGLFunctions_4_3_Compatibility::glVertex3i(GLint x, GLint y, GLint z)
-{
- d_1_0_Deprecated->f.Vertex3i(x, y, z);
-}
-
-inline void QOpenGLFunctions_4_3_Compatibility::glVertex3fv(const GLfloat *v)
-{
- d_1_0_Deprecated->f.Vertex3fv(v);
-}
-
-inline void QOpenGLFunctions_4_3_Compatibility::glVertex3f(GLfloat x, GLfloat y, GLfloat z)
-{
- d_1_0_Deprecated->f.Vertex3f(x, y, z);
-}
-
-inline void QOpenGLFunctions_4_3_Compatibility::glVertex3dv(const GLdouble *v)
-{
- d_1_0_Deprecated->f.Vertex3dv(v);
-}
-
-inline void QOpenGLFunctions_4_3_Compatibility::glVertex3d(GLdouble x, GLdouble y, GLdouble z)
-{
- d_1_0_Deprecated->f.Vertex3d(x, y, z);
-}
-
-inline void QOpenGLFunctions_4_3_Compatibility::glVertex2sv(const GLshort *v)
-{
- d_1_0_Deprecated->f.Vertex2sv(v);
-}
-
-inline void QOpenGLFunctions_4_3_Compatibility::glVertex2s(GLshort x, GLshort y)
-{
- d_1_0_Deprecated->f.Vertex2s(x, y);
-}
-
-inline void QOpenGLFunctions_4_3_Compatibility::glVertex2iv(const GLint *v)
-{
- d_1_0_Deprecated->f.Vertex2iv(v);
-}
-
-inline void QOpenGLFunctions_4_3_Compatibility::glVertex2i(GLint x, GLint y)
-{
- d_1_0_Deprecated->f.Vertex2i(x, y);
-}
-
-inline void QOpenGLFunctions_4_3_Compatibility::glVertex2fv(const GLfloat *v)
-{
- d_1_0_Deprecated->f.Vertex2fv(v);
-}
-
-inline void QOpenGLFunctions_4_3_Compatibility::glVertex2f(GLfloat x, GLfloat y)
-{
- d_1_0_Deprecated->f.Vertex2f(x, y);
-}
-
-inline void QOpenGLFunctions_4_3_Compatibility::glVertex2dv(const GLdouble *v)
-{
- d_1_0_Deprecated->f.Vertex2dv(v);
-}
-
-inline void QOpenGLFunctions_4_3_Compatibility::glVertex2d(GLdouble x, GLdouble y)
-{
- d_1_0_Deprecated->f.Vertex2d(x, y);
-}
-
-inline void QOpenGLFunctions_4_3_Compatibility::glTexCoord4sv(const GLshort *v)
-{
- d_1_0_Deprecated->f.TexCoord4sv(v);
-}
-
-inline void QOpenGLFunctions_4_3_Compatibility::glTexCoord4s(GLshort s, GLshort t, GLshort r, GLshort q)
-{
- d_1_0_Deprecated->f.TexCoord4s(s, t, r, q);
-}
-
-inline void QOpenGLFunctions_4_3_Compatibility::glTexCoord4iv(const GLint *v)
-{
- d_1_0_Deprecated->f.TexCoord4iv(v);
-}
-
-inline void QOpenGLFunctions_4_3_Compatibility::glTexCoord4i(GLint s, GLint t, GLint r, GLint q)
-{
- d_1_0_Deprecated->f.TexCoord4i(s, t, r, q);
-}
-
-inline void QOpenGLFunctions_4_3_Compatibility::glTexCoord4fv(const GLfloat *v)
-{
- d_1_0_Deprecated->f.TexCoord4fv(v);
-}
-
-inline void QOpenGLFunctions_4_3_Compatibility::glTexCoord4f(GLfloat s, GLfloat t, GLfloat r, GLfloat q)
-{
- d_1_0_Deprecated->f.TexCoord4f(s, t, r, q);
-}
-
-inline void QOpenGLFunctions_4_3_Compatibility::glTexCoord4dv(const GLdouble *v)
-{
- d_1_0_Deprecated->f.TexCoord4dv(v);
-}
-
-inline void QOpenGLFunctions_4_3_Compatibility::glTexCoord4d(GLdouble s, GLdouble t, GLdouble r, GLdouble q)
-{
- d_1_0_Deprecated->f.TexCoord4d(s, t, r, q);
-}
-
-inline void QOpenGLFunctions_4_3_Compatibility::glTexCoord3sv(const GLshort *v)
-{
- d_1_0_Deprecated->f.TexCoord3sv(v);
-}
-
-inline void QOpenGLFunctions_4_3_Compatibility::glTexCoord3s(GLshort s, GLshort t, GLshort r)
-{
- d_1_0_Deprecated->f.TexCoord3s(s, t, r);
-}
-
-inline void QOpenGLFunctions_4_3_Compatibility::glTexCoord3iv(const GLint *v)
-{
- d_1_0_Deprecated->f.TexCoord3iv(v);
-}
-
-inline void QOpenGLFunctions_4_3_Compatibility::glTexCoord3i(GLint s, GLint t, GLint r)
-{
- d_1_0_Deprecated->f.TexCoord3i(s, t, r);
-}
-
-inline void QOpenGLFunctions_4_3_Compatibility::glTexCoord3fv(const GLfloat *v)
-{
- d_1_0_Deprecated->f.TexCoord3fv(v);
-}
-
-inline void QOpenGLFunctions_4_3_Compatibility::glTexCoord3f(GLfloat s, GLfloat t, GLfloat r)
-{
- d_1_0_Deprecated->f.TexCoord3f(s, t, r);
-}
-
-inline void QOpenGLFunctions_4_3_Compatibility::glTexCoord3dv(const GLdouble *v)
-{
- d_1_0_Deprecated->f.TexCoord3dv(v);
-}
-
-inline void QOpenGLFunctions_4_3_Compatibility::glTexCoord3d(GLdouble s, GLdouble t, GLdouble r)
-{
- d_1_0_Deprecated->f.TexCoord3d(s, t, r);
-}
-
-inline void QOpenGLFunctions_4_3_Compatibility::glTexCoord2sv(const GLshort *v)
-{
- d_1_0_Deprecated->f.TexCoord2sv(v);
-}
-
-inline void QOpenGLFunctions_4_3_Compatibility::glTexCoord2s(GLshort s, GLshort t)
-{
- d_1_0_Deprecated->f.TexCoord2s(s, t);
-}
-
-inline void QOpenGLFunctions_4_3_Compatibility::glTexCoord2iv(const GLint *v)
-{
- d_1_0_Deprecated->f.TexCoord2iv(v);
-}
-
-inline void QOpenGLFunctions_4_3_Compatibility::glTexCoord2i(GLint s, GLint t)
-{
- d_1_0_Deprecated->f.TexCoord2i(s, t);
-}
-
-inline void QOpenGLFunctions_4_3_Compatibility::glTexCoord2fv(const GLfloat *v)
-{
- d_1_0_Deprecated->f.TexCoord2fv(v);
-}
-
-inline void QOpenGLFunctions_4_3_Compatibility::glTexCoord2f(GLfloat s, GLfloat t)
-{
- d_1_0_Deprecated->f.TexCoord2f(s, t);
-}
-
-inline void QOpenGLFunctions_4_3_Compatibility::glTexCoord2dv(const GLdouble *v)
-{
- d_1_0_Deprecated->f.TexCoord2dv(v);
-}
-
-inline void QOpenGLFunctions_4_3_Compatibility::glTexCoord2d(GLdouble s, GLdouble t)
-{
- d_1_0_Deprecated->f.TexCoord2d(s, t);
-}
-
-inline void QOpenGLFunctions_4_3_Compatibility::glTexCoord1sv(const GLshort *v)
-{
- d_1_0_Deprecated->f.TexCoord1sv(v);
-}
-
-inline void QOpenGLFunctions_4_3_Compatibility::glTexCoord1s(GLshort s)
-{
- d_1_0_Deprecated->f.TexCoord1s(s);
-}
-
-inline void QOpenGLFunctions_4_3_Compatibility::glTexCoord1iv(const GLint *v)
-{
- d_1_0_Deprecated->f.TexCoord1iv(v);
-}
-
-inline void QOpenGLFunctions_4_3_Compatibility::glTexCoord1i(GLint s)
-{
- d_1_0_Deprecated->f.TexCoord1i(s);
-}
-
-inline void QOpenGLFunctions_4_3_Compatibility::glTexCoord1fv(const GLfloat *v)
-{
- d_1_0_Deprecated->f.TexCoord1fv(v);
-}
-
-inline void QOpenGLFunctions_4_3_Compatibility::glTexCoord1f(GLfloat s)
-{
- d_1_0_Deprecated->f.TexCoord1f(s);
-}
-
-inline void QOpenGLFunctions_4_3_Compatibility::glTexCoord1dv(const GLdouble *v)
-{
- d_1_0_Deprecated->f.TexCoord1dv(v);
-}
-
-inline void QOpenGLFunctions_4_3_Compatibility::glTexCoord1d(GLdouble s)
-{
- d_1_0_Deprecated->f.TexCoord1d(s);
-}
-
-inline void QOpenGLFunctions_4_3_Compatibility::glRectsv(const GLshort *v1, const GLshort *v2)
-{
- d_1_0_Deprecated->f.Rectsv(v1, v2);
-}
-
-inline void QOpenGLFunctions_4_3_Compatibility::glRects(GLshort x1, GLshort y1, GLshort x2, GLshort y2)
-{
- d_1_0_Deprecated->f.Rects(x1, y1, x2, y2);
-}
-
-inline void QOpenGLFunctions_4_3_Compatibility::glRectiv(const GLint *v1, const GLint *v2)
-{
- d_1_0_Deprecated->f.Rectiv(v1, v2);
-}
-
-inline void QOpenGLFunctions_4_3_Compatibility::glRecti(GLint x1, GLint y1, GLint x2, GLint y2)
-{
- d_1_0_Deprecated->f.Recti(x1, y1, x2, y2);
-}
-
-inline void QOpenGLFunctions_4_3_Compatibility::glRectfv(const GLfloat *v1, const GLfloat *v2)
-{
- d_1_0_Deprecated->f.Rectfv(v1, v2);
-}
-
-inline void QOpenGLFunctions_4_3_Compatibility::glRectf(GLfloat x1, GLfloat y1, GLfloat x2, GLfloat y2)
-{
- d_1_0_Deprecated->f.Rectf(x1, y1, x2, y2);
-}
-
-inline void QOpenGLFunctions_4_3_Compatibility::glRectdv(const GLdouble *v1, const GLdouble *v2)
-{
- d_1_0_Deprecated->f.Rectdv(v1, v2);
-}
-
-inline void QOpenGLFunctions_4_3_Compatibility::glRectd(GLdouble x1, GLdouble y1, GLdouble x2, GLdouble y2)
-{
- d_1_0_Deprecated->f.Rectd(x1, y1, x2, y2);
-}
-
-inline void QOpenGLFunctions_4_3_Compatibility::glRasterPos4sv(const GLshort *v)
-{
- d_1_0_Deprecated->f.RasterPos4sv(v);
-}
-
-inline void QOpenGLFunctions_4_3_Compatibility::glRasterPos4s(GLshort x, GLshort y, GLshort z, GLshort w)
-{
- d_1_0_Deprecated->f.RasterPos4s(x, y, z, w);
-}
-
-inline void QOpenGLFunctions_4_3_Compatibility::glRasterPos4iv(const GLint *v)
-{
- d_1_0_Deprecated->f.RasterPos4iv(v);
-}
-
-inline void QOpenGLFunctions_4_3_Compatibility::glRasterPos4i(GLint x, GLint y, GLint z, GLint w)
-{
- d_1_0_Deprecated->f.RasterPos4i(x, y, z, w);
-}
-
-inline void QOpenGLFunctions_4_3_Compatibility::glRasterPos4fv(const GLfloat *v)
-{
- d_1_0_Deprecated->f.RasterPos4fv(v);
-}
-
-inline void QOpenGLFunctions_4_3_Compatibility::glRasterPos4f(GLfloat x, GLfloat y, GLfloat z, GLfloat w)
-{
- d_1_0_Deprecated->f.RasterPos4f(x, y, z, w);
-}
-
-inline void QOpenGLFunctions_4_3_Compatibility::glRasterPos4dv(const GLdouble *v)
-{
- d_1_0_Deprecated->f.RasterPos4dv(v);
-}
-
-inline void QOpenGLFunctions_4_3_Compatibility::glRasterPos4d(GLdouble x, GLdouble y, GLdouble z, GLdouble w)
-{
- d_1_0_Deprecated->f.RasterPos4d(x, y, z, w);
-}
-
-inline void QOpenGLFunctions_4_3_Compatibility::glRasterPos3sv(const GLshort *v)
-{
- d_1_0_Deprecated->f.RasterPos3sv(v);
-}
-
-inline void QOpenGLFunctions_4_3_Compatibility::glRasterPos3s(GLshort x, GLshort y, GLshort z)
-{
- d_1_0_Deprecated->f.RasterPos3s(x, y, z);
-}
-
-inline void QOpenGLFunctions_4_3_Compatibility::glRasterPos3iv(const GLint *v)
-{
- d_1_0_Deprecated->f.RasterPos3iv(v);
-}
-
-inline void QOpenGLFunctions_4_3_Compatibility::glRasterPos3i(GLint x, GLint y, GLint z)
-{
- d_1_0_Deprecated->f.RasterPos3i(x, y, z);
-}
-
-inline void QOpenGLFunctions_4_3_Compatibility::glRasterPos3fv(const GLfloat *v)
-{
- d_1_0_Deprecated->f.RasterPos3fv(v);
-}
-
-inline void QOpenGLFunctions_4_3_Compatibility::glRasterPos3f(GLfloat x, GLfloat y, GLfloat z)
-{
- d_1_0_Deprecated->f.RasterPos3f(x, y, z);
-}
-
-inline void QOpenGLFunctions_4_3_Compatibility::glRasterPos3dv(const GLdouble *v)
-{
- d_1_0_Deprecated->f.RasterPos3dv(v);
-}
-
-inline void QOpenGLFunctions_4_3_Compatibility::glRasterPos3d(GLdouble x, GLdouble y, GLdouble z)
-{
- d_1_0_Deprecated->f.RasterPos3d(x, y, z);
-}
-
-inline void QOpenGLFunctions_4_3_Compatibility::glRasterPos2sv(const GLshort *v)
-{
- d_1_0_Deprecated->f.RasterPos2sv(v);
-}
-
-inline void QOpenGLFunctions_4_3_Compatibility::glRasterPos2s(GLshort x, GLshort y)
-{
- d_1_0_Deprecated->f.RasterPos2s(x, y);
-}
-
-inline void QOpenGLFunctions_4_3_Compatibility::glRasterPos2iv(const GLint *v)
-{
- d_1_0_Deprecated->f.RasterPos2iv(v);
-}
-
-inline void QOpenGLFunctions_4_3_Compatibility::glRasterPos2i(GLint x, GLint y)
-{
- d_1_0_Deprecated->f.RasterPos2i(x, y);
-}
-
-inline void QOpenGLFunctions_4_3_Compatibility::glRasterPos2fv(const GLfloat *v)
-{
- d_1_0_Deprecated->f.RasterPos2fv(v);
-}
-
-inline void QOpenGLFunctions_4_3_Compatibility::glRasterPos2f(GLfloat x, GLfloat y)
-{
- d_1_0_Deprecated->f.RasterPos2f(x, y);
-}
-
-inline void QOpenGLFunctions_4_3_Compatibility::glRasterPos2dv(const GLdouble *v)
-{
- d_1_0_Deprecated->f.RasterPos2dv(v);
-}
-
-inline void QOpenGLFunctions_4_3_Compatibility::glRasterPos2d(GLdouble x, GLdouble y)
-{
- d_1_0_Deprecated->f.RasterPos2d(x, y);
-}
-
-inline void QOpenGLFunctions_4_3_Compatibility::glNormal3sv(const GLshort *v)
-{
- d_1_0_Deprecated->f.Normal3sv(v);
-}
-
-inline void QOpenGLFunctions_4_3_Compatibility::glNormal3s(GLshort nx, GLshort ny, GLshort nz)
-{
- d_1_0_Deprecated->f.Normal3s(nx, ny, nz);
-}
-
-inline void QOpenGLFunctions_4_3_Compatibility::glNormal3iv(const GLint *v)
-{
- d_1_0_Deprecated->f.Normal3iv(v);
-}
-
-inline void QOpenGLFunctions_4_3_Compatibility::glNormal3i(GLint nx, GLint ny, GLint nz)
-{
- d_1_0_Deprecated->f.Normal3i(nx, ny, nz);
-}
-
-inline void QOpenGLFunctions_4_3_Compatibility::glNormal3fv(const GLfloat *v)
-{
- d_1_0_Deprecated->f.Normal3fv(v);
-}
-
-inline void QOpenGLFunctions_4_3_Compatibility::glNormal3f(GLfloat nx, GLfloat ny, GLfloat nz)
-{
- d_1_0_Deprecated->f.Normal3f(nx, ny, nz);
-}
-
-inline void QOpenGLFunctions_4_3_Compatibility::glNormal3dv(const GLdouble *v)
-{
- d_1_0_Deprecated->f.Normal3dv(v);
-}
-
-inline void QOpenGLFunctions_4_3_Compatibility::glNormal3d(GLdouble nx, GLdouble ny, GLdouble nz)
-{
- d_1_0_Deprecated->f.Normal3d(nx, ny, nz);
-}
-
-inline void QOpenGLFunctions_4_3_Compatibility::glNormal3bv(const GLbyte *v)
-{
- d_1_0_Deprecated->f.Normal3bv(v);
-}
-
-inline void QOpenGLFunctions_4_3_Compatibility::glNormal3b(GLbyte nx, GLbyte ny, GLbyte nz)
-{
- d_1_0_Deprecated->f.Normal3b(nx, ny, nz);
-}
-
-inline void QOpenGLFunctions_4_3_Compatibility::glIndexsv(const GLshort *c)
-{
- d_1_0_Deprecated->f.Indexsv(c);
-}
-
-inline void QOpenGLFunctions_4_3_Compatibility::glIndexs(GLshort c)
-{
- d_1_0_Deprecated->f.Indexs(c);
-}
-
-inline void QOpenGLFunctions_4_3_Compatibility::glIndexiv(const GLint *c)
-{
- d_1_0_Deprecated->f.Indexiv(c);
-}
-
-inline void QOpenGLFunctions_4_3_Compatibility::glIndexi(GLint c)
-{
- d_1_0_Deprecated->f.Indexi(c);
-}
-
-inline void QOpenGLFunctions_4_3_Compatibility::glIndexfv(const GLfloat *c)
-{
- d_1_0_Deprecated->f.Indexfv(c);
-}
-
-inline void QOpenGLFunctions_4_3_Compatibility::glIndexf(GLfloat c)
-{
- d_1_0_Deprecated->f.Indexf(c);
-}
-
-inline void QOpenGLFunctions_4_3_Compatibility::glIndexdv(const GLdouble *c)
-{
- d_1_0_Deprecated->f.Indexdv(c);
-}
-
-inline void QOpenGLFunctions_4_3_Compatibility::glIndexd(GLdouble c)
-{
- d_1_0_Deprecated->f.Indexd(c);
-}
-
-inline void QOpenGLFunctions_4_3_Compatibility::glEnd()
-{
- d_1_0_Deprecated->f.End();
-}
-
-inline void QOpenGLFunctions_4_3_Compatibility::glEdgeFlagv(const GLboolean *flag)
-{
- d_1_0_Deprecated->f.EdgeFlagv(flag);
-}
-
-inline void QOpenGLFunctions_4_3_Compatibility::glEdgeFlag(GLboolean flag)
-{
- d_1_0_Deprecated->f.EdgeFlag(flag);
-}
-
-inline void QOpenGLFunctions_4_3_Compatibility::glColor4usv(const GLushort *v)
-{
- d_1_0_Deprecated->f.Color4usv(v);
-}
-
-inline void QOpenGLFunctions_4_3_Compatibility::glColor4us(GLushort red, GLushort green, GLushort blue, GLushort alpha)
-{
- d_1_0_Deprecated->f.Color4us(red, green, blue, alpha);
-}
-
-inline void QOpenGLFunctions_4_3_Compatibility::glColor4uiv(const GLuint *v)
-{
- d_1_0_Deprecated->f.Color4uiv(v);
-}
-
-inline void QOpenGLFunctions_4_3_Compatibility::glColor4ui(GLuint red, GLuint green, GLuint blue, GLuint alpha)
-{
- d_1_0_Deprecated->f.Color4ui(red, green, blue, alpha);
-}
-
-inline void QOpenGLFunctions_4_3_Compatibility::glColor4ubv(const GLubyte *v)
-{
- d_1_0_Deprecated->f.Color4ubv(v);
-}
-
-inline void QOpenGLFunctions_4_3_Compatibility::glColor4ub(GLubyte red, GLubyte green, GLubyte blue, GLubyte alpha)
-{
- d_1_0_Deprecated->f.Color4ub(red, green, blue, alpha);
-}
-
-inline void QOpenGLFunctions_4_3_Compatibility::glColor4sv(const GLshort *v)
-{
- d_1_0_Deprecated->f.Color4sv(v);
-}
-
-inline void QOpenGLFunctions_4_3_Compatibility::glColor4s(GLshort red, GLshort green, GLshort blue, GLshort alpha)
-{
- d_1_0_Deprecated->f.Color4s(red, green, blue, alpha);
-}
-
-inline void QOpenGLFunctions_4_3_Compatibility::glColor4iv(const GLint *v)
-{
- d_1_0_Deprecated->f.Color4iv(v);
-}
-
-inline void QOpenGLFunctions_4_3_Compatibility::glColor4i(GLint red, GLint green, GLint blue, GLint alpha)
-{
- d_1_0_Deprecated->f.Color4i(red, green, blue, alpha);
-}
-
-inline void QOpenGLFunctions_4_3_Compatibility::glColor4fv(const GLfloat *v)
-{
- d_1_0_Deprecated->f.Color4fv(v);
-}
-
-inline void QOpenGLFunctions_4_3_Compatibility::glColor4f(GLfloat red, GLfloat green, GLfloat blue, GLfloat alpha)
-{
- d_1_0_Deprecated->f.Color4f(red, green, blue, alpha);
-}
-
-inline void QOpenGLFunctions_4_3_Compatibility::glColor4dv(const GLdouble *v)
-{
- d_1_0_Deprecated->f.Color4dv(v);
-}
-
-inline void QOpenGLFunctions_4_3_Compatibility::glColor4d(GLdouble red, GLdouble green, GLdouble blue, GLdouble alpha)
-{
- d_1_0_Deprecated->f.Color4d(red, green, blue, alpha);
-}
-
-inline void QOpenGLFunctions_4_3_Compatibility::glColor4bv(const GLbyte *v)
-{
- d_1_0_Deprecated->f.Color4bv(v);
-}
-
-inline void QOpenGLFunctions_4_3_Compatibility::glColor4b(GLbyte red, GLbyte green, GLbyte blue, GLbyte alpha)
-{
- d_1_0_Deprecated->f.Color4b(red, green, blue, alpha);
-}
-
-inline void QOpenGLFunctions_4_3_Compatibility::glColor3usv(const GLushort *v)
-{
- d_1_0_Deprecated->f.Color3usv(v);
-}
-
-inline void QOpenGLFunctions_4_3_Compatibility::glColor3us(GLushort red, GLushort green, GLushort blue)
-{
- d_1_0_Deprecated->f.Color3us(red, green, blue);
-}
-
-inline void QOpenGLFunctions_4_3_Compatibility::glColor3uiv(const GLuint *v)
-{
- d_1_0_Deprecated->f.Color3uiv(v);
-}
-
-inline void QOpenGLFunctions_4_3_Compatibility::glColor3ui(GLuint red, GLuint green, GLuint blue)
-{
- d_1_0_Deprecated->f.Color3ui(red, green, blue);
-}
-
-inline void QOpenGLFunctions_4_3_Compatibility::glColor3ubv(const GLubyte *v)
-{
- d_1_0_Deprecated->f.Color3ubv(v);
-}
-
-inline void QOpenGLFunctions_4_3_Compatibility::glColor3ub(GLubyte red, GLubyte green, GLubyte blue)
-{
- d_1_0_Deprecated->f.Color3ub(red, green, blue);
-}
-
-inline void QOpenGLFunctions_4_3_Compatibility::glColor3sv(const GLshort *v)
-{
- d_1_0_Deprecated->f.Color3sv(v);
-}
-
-inline void QOpenGLFunctions_4_3_Compatibility::glColor3s(GLshort red, GLshort green, GLshort blue)
-{
- d_1_0_Deprecated->f.Color3s(red, green, blue);
-}
-
-inline void QOpenGLFunctions_4_3_Compatibility::glColor3iv(const GLint *v)
-{
- d_1_0_Deprecated->f.Color3iv(v);
-}
-
-inline void QOpenGLFunctions_4_3_Compatibility::glColor3i(GLint red, GLint green, GLint blue)
-{
- d_1_0_Deprecated->f.Color3i(red, green, blue);
-}
-
-inline void QOpenGLFunctions_4_3_Compatibility::glColor3fv(const GLfloat *v)
-{
- d_1_0_Deprecated->f.Color3fv(v);
-}
-
-inline void QOpenGLFunctions_4_3_Compatibility::glColor3f(GLfloat red, GLfloat green, GLfloat blue)
-{
- d_1_0_Deprecated->f.Color3f(red, green, blue);
-}
-
-inline void QOpenGLFunctions_4_3_Compatibility::glColor3dv(const GLdouble *v)
-{
- d_1_0_Deprecated->f.Color3dv(v);
-}
-
-inline void QOpenGLFunctions_4_3_Compatibility::glColor3d(GLdouble red, GLdouble green, GLdouble blue)
-{
- d_1_0_Deprecated->f.Color3d(red, green, blue);
-}
-
-inline void QOpenGLFunctions_4_3_Compatibility::glColor3bv(const GLbyte *v)
-{
- d_1_0_Deprecated->f.Color3bv(v);
-}
-
-inline void QOpenGLFunctions_4_3_Compatibility::glColor3b(GLbyte red, GLbyte green, GLbyte blue)
-{
- d_1_0_Deprecated->f.Color3b(red, green, blue);
-}
-
-inline void QOpenGLFunctions_4_3_Compatibility::glBitmap(GLsizei width, GLsizei height, GLfloat xorig, GLfloat yorig, GLfloat xmove, GLfloat ymove, const GLubyte *bitmap)
-{
- d_1_0_Deprecated->f.Bitmap(width, height, xorig, yorig, xmove, ymove, bitmap);
-}
-
-inline void QOpenGLFunctions_4_3_Compatibility::glBegin(GLenum mode)
-{
- d_1_0_Deprecated->f.Begin(mode);
-}
-
-inline void QOpenGLFunctions_4_3_Compatibility::glListBase(GLuint base)
-{
- d_1_0_Deprecated->f.ListBase(base);
-}
-
-inline GLuint QOpenGLFunctions_4_3_Compatibility::glGenLists(GLsizei range)
-{
- return d_1_0_Deprecated->f.GenLists(range);
-}
-
-inline void QOpenGLFunctions_4_3_Compatibility::glDeleteLists(GLuint list, GLsizei range)
-{
- d_1_0_Deprecated->f.DeleteLists(list, range);
-}
-
-inline void QOpenGLFunctions_4_3_Compatibility::glCallLists(GLsizei n, GLenum type, const GLvoid *lists)
-{
- d_1_0_Deprecated->f.CallLists(n, type, lists);
-}
-
-inline void QOpenGLFunctions_4_3_Compatibility::glCallList(GLuint list)
-{
- d_1_0_Deprecated->f.CallList(list);
-}
-
-inline void QOpenGLFunctions_4_3_Compatibility::glEndList()
-{
- d_1_0_Deprecated->f.EndList();
-}
-
-inline void QOpenGLFunctions_4_3_Compatibility::glNewList(GLuint list, GLenum mode)
-{
- d_1_0_Deprecated->f.NewList(list, mode);
-}
-
-
-// OpenGL 1.1 deprecated functions
-inline void QOpenGLFunctions_4_3_Compatibility::glPushClientAttrib(GLbitfield mask)
-{
- d_1_1_Deprecated->f.PushClientAttrib(mask);
-}
-
-inline void QOpenGLFunctions_4_3_Compatibility::glPopClientAttrib()
-{
- d_1_1_Deprecated->f.PopClientAttrib();
-}
-
-inline void QOpenGLFunctions_4_3_Compatibility::glPrioritizeTextures(GLsizei n, const GLuint *textures, const GLfloat *priorities)
-{
- d_1_1_Deprecated->f.PrioritizeTextures(n, textures, priorities);
-}
-
-inline GLboolean QOpenGLFunctions_4_3_Compatibility::glAreTexturesResident(GLsizei n, const GLuint *textures, GLboolean *residences)
-{
- return d_1_1_Deprecated->f.AreTexturesResident(n, textures, residences);
-}
-
-inline void QOpenGLFunctions_4_3_Compatibility::glVertexPointer(GLint size, GLenum type, GLsizei stride, const GLvoid *pointer)
-{
- d_1_1_Deprecated->f.VertexPointer(size, type, stride, pointer);
-}
-
-inline void QOpenGLFunctions_4_3_Compatibility::glTexCoordPointer(GLint size, GLenum type, GLsizei stride, const GLvoid *pointer)
-{
- d_1_1_Deprecated->f.TexCoordPointer(size, type, stride, pointer);
-}
-
-inline void QOpenGLFunctions_4_3_Compatibility::glNormalPointer(GLenum type, GLsizei stride, const GLvoid *pointer)
-{
- d_1_1_Deprecated->f.NormalPointer(type, stride, pointer);
-}
-
-inline void QOpenGLFunctions_4_3_Compatibility::glInterleavedArrays(GLenum format, GLsizei stride, const GLvoid *pointer)
-{
- d_1_1_Deprecated->f.InterleavedArrays(format, stride, pointer);
-}
-
-inline void QOpenGLFunctions_4_3_Compatibility::glIndexPointer(GLenum type, GLsizei stride, const GLvoid *pointer)
-{
- d_1_1_Deprecated->f.IndexPointer(type, stride, pointer);
-}
-
-inline void QOpenGLFunctions_4_3_Compatibility::glEnableClientState(GLenum array)
-{
- d_1_1_Deprecated->f.EnableClientState(array);
-}
-
-inline void QOpenGLFunctions_4_3_Compatibility::glEdgeFlagPointer(GLsizei stride, const GLvoid *pointer)
-{
- d_1_1_Deprecated->f.EdgeFlagPointer(stride, pointer);
-}
-
-inline void QOpenGLFunctions_4_3_Compatibility::glDisableClientState(GLenum array)
-{
- d_1_1_Deprecated->f.DisableClientState(array);
-}
-
-inline void QOpenGLFunctions_4_3_Compatibility::glColorPointer(GLint size, GLenum type, GLsizei stride, const GLvoid *pointer)
-{
- d_1_1_Deprecated->f.ColorPointer(size, type, stride, pointer);
-}
-
-inline void QOpenGLFunctions_4_3_Compatibility::glArrayElement(GLint i)
-{
- d_1_1_Deprecated->f.ArrayElement(i);
-}
-
-
-// OpenGL 1.2 deprecated functions
-inline void QOpenGLFunctions_4_3_Compatibility::glResetMinmax(GLenum target)
-{
- d_1_2_Deprecated->f.ResetMinmax(target);
-}
-
-inline void QOpenGLFunctions_4_3_Compatibility::glResetHistogram(GLenum target)
-{
- d_1_2_Deprecated->f.ResetHistogram(target);
-}
-
-inline void QOpenGLFunctions_4_3_Compatibility::glMinmax(GLenum target, GLenum internalformat, GLboolean sink)
-{
- d_1_2_Deprecated->f.Minmax(target, internalformat, sink);
-}
-
-inline void QOpenGLFunctions_4_3_Compatibility::glHistogram(GLenum target, GLsizei width, GLenum internalformat, GLboolean sink)
-{
- d_1_2_Deprecated->f.Histogram(target, width, internalformat, sink);
-}
-
-inline void QOpenGLFunctions_4_3_Compatibility::glGetMinmaxParameteriv(GLenum target, GLenum pname, GLint *params)
-{
- d_1_2_Deprecated->f.GetMinmaxParameteriv(target, pname, params);
-}
-
-inline void QOpenGLFunctions_4_3_Compatibility::glGetMinmaxParameterfv(GLenum target, GLenum pname, GLfloat *params)
-{
- d_1_2_Deprecated->f.GetMinmaxParameterfv(target, pname, params);
-}
-
-inline void QOpenGLFunctions_4_3_Compatibility::glGetMinmax(GLenum target, GLboolean reset, GLenum format, GLenum type, GLvoid *values)
-{
- d_1_2_Deprecated->f.GetMinmax(target, reset, format, type, values);
-}
-
-inline void QOpenGLFunctions_4_3_Compatibility::glGetHistogramParameteriv(GLenum target, GLenum pname, GLint *params)
-{
- d_1_2_Deprecated->f.GetHistogramParameteriv(target, pname, params);
-}
-
-inline void QOpenGLFunctions_4_3_Compatibility::glGetHistogramParameterfv(GLenum target, GLenum pname, GLfloat *params)
-{
- d_1_2_Deprecated->f.GetHistogramParameterfv(target, pname, params);
-}
-
-inline void QOpenGLFunctions_4_3_Compatibility::glGetHistogram(GLenum target, GLboolean reset, GLenum format, GLenum type, GLvoid *values)
-{
- d_1_2_Deprecated->f.GetHistogram(target, reset, format, type, values);
-}
-
-inline void QOpenGLFunctions_4_3_Compatibility::glSeparableFilter2D(GLenum target, GLenum internalformat, GLsizei width, GLsizei height, GLenum format, GLenum type, const GLvoid *row, const GLvoid *column)
-{
- d_1_2_Deprecated->f.SeparableFilter2D(target, internalformat, width, height, format, type, row, column);
-}
-
-inline void QOpenGLFunctions_4_3_Compatibility::glGetSeparableFilter(GLenum target, GLenum format, GLenum type, GLvoid *row, GLvoid *column, GLvoid *span)
-{
- d_1_2_Deprecated->f.GetSeparableFilter(target, format, type, row, column, span);
-}
-
-inline void QOpenGLFunctions_4_3_Compatibility::glGetConvolutionParameteriv(GLenum target, GLenum pname, GLint *params)
-{
- d_1_2_Deprecated->f.GetConvolutionParameteriv(target, pname, params);
-}
-
-inline void QOpenGLFunctions_4_3_Compatibility::glGetConvolutionParameterfv(GLenum target, GLenum pname, GLfloat *params)
-{
- d_1_2_Deprecated->f.GetConvolutionParameterfv(target, pname, params);
-}
-
-inline void QOpenGLFunctions_4_3_Compatibility::glGetConvolutionFilter(GLenum target, GLenum format, GLenum type, GLvoid *image)
-{
- d_1_2_Deprecated->f.GetConvolutionFilter(target, format, type, image);
-}
-
-inline void QOpenGLFunctions_4_3_Compatibility::glCopyConvolutionFilter2D(GLenum target, GLenum internalformat, GLint x, GLint y, GLsizei width, GLsizei height)
-{
- d_1_2_Deprecated->f.CopyConvolutionFilter2D(target, internalformat, x, y, width, height);
-}
-
-inline void QOpenGLFunctions_4_3_Compatibility::glCopyConvolutionFilter1D(GLenum target, GLenum internalformat, GLint x, GLint y, GLsizei width)
-{
- d_1_2_Deprecated->f.CopyConvolutionFilter1D(target, internalformat, x, y, width);
-}
-
-inline void QOpenGLFunctions_4_3_Compatibility::glConvolutionParameteriv(GLenum target, GLenum pname, const GLint *params)
-{
- d_1_2_Deprecated->f.ConvolutionParameteriv(target, pname, params);
-}
-
-inline void QOpenGLFunctions_4_3_Compatibility::glConvolutionParameteri(GLenum target, GLenum pname, GLint params)
-{
- d_1_2_Deprecated->f.ConvolutionParameteri(target, pname, params);
-}
-
-inline void QOpenGLFunctions_4_3_Compatibility::glConvolutionParameterfv(GLenum target, GLenum pname, const GLfloat *params)
-{
- d_1_2_Deprecated->f.ConvolutionParameterfv(target, pname, params);
-}
-
-inline void QOpenGLFunctions_4_3_Compatibility::glConvolutionParameterf(GLenum target, GLenum pname, GLfloat params)
-{
- d_1_2_Deprecated->f.ConvolutionParameterf(target, pname, params);
-}
-
-inline void QOpenGLFunctions_4_3_Compatibility::glConvolutionFilter2D(GLenum target, GLenum internalformat, GLsizei width, GLsizei height, GLenum format, GLenum type, const GLvoid *image)
-{
- d_1_2_Deprecated->f.ConvolutionFilter2D(target, internalformat, width, height, format, type, image);
-}
-
-inline void QOpenGLFunctions_4_3_Compatibility::glConvolutionFilter1D(GLenum target, GLenum internalformat, GLsizei width, GLenum format, GLenum type, const GLvoid *image)
-{
- d_1_2_Deprecated->f.ConvolutionFilter1D(target, internalformat, width, format, type, image);
-}
-
-inline void QOpenGLFunctions_4_3_Compatibility::glCopyColorSubTable(GLenum target, GLsizei start, GLint x, GLint y, GLsizei width)
-{
- d_1_2_Deprecated->f.CopyColorSubTable(target, start, x, y, width);
-}
-
-inline void QOpenGLFunctions_4_3_Compatibility::glColorSubTable(GLenum target, GLsizei start, GLsizei count, GLenum format, GLenum type, const GLvoid *data)
-{
- d_1_2_Deprecated->f.ColorSubTable(target, start, count, format, type, data);
-}
-
-inline void QOpenGLFunctions_4_3_Compatibility::glGetColorTableParameteriv(GLenum target, GLenum pname, GLint *params)
-{
- d_1_2_Deprecated->f.GetColorTableParameteriv(target, pname, params);
-}
-
-inline void QOpenGLFunctions_4_3_Compatibility::glGetColorTableParameterfv(GLenum target, GLenum pname, GLfloat *params)
-{
- d_1_2_Deprecated->f.GetColorTableParameterfv(target, pname, params);
-}
-
-inline void QOpenGLFunctions_4_3_Compatibility::glGetColorTable(GLenum target, GLenum format, GLenum type, GLvoid *table)
-{
- d_1_2_Deprecated->f.GetColorTable(target, format, type, table);
-}
-
-inline void QOpenGLFunctions_4_3_Compatibility::glCopyColorTable(GLenum target, GLenum internalformat, GLint x, GLint y, GLsizei width)
-{
- d_1_2_Deprecated->f.CopyColorTable(target, internalformat, x, y, width);
-}
-
-inline void QOpenGLFunctions_4_3_Compatibility::glColorTableParameteriv(GLenum target, GLenum pname, const GLint *params)
-{
- d_1_2_Deprecated->f.ColorTableParameteriv(target, pname, params);
-}
-
-inline void QOpenGLFunctions_4_3_Compatibility::glColorTableParameterfv(GLenum target, GLenum pname, const GLfloat *params)
-{
- d_1_2_Deprecated->f.ColorTableParameterfv(target, pname, params);
-}
-
-inline void QOpenGLFunctions_4_3_Compatibility::glColorTable(GLenum target, GLenum internalformat, GLsizei width, GLenum format, GLenum type, const GLvoid *table)
-{
- d_1_2_Deprecated->f.ColorTable(target, internalformat, width, format, type, table);
-}
-
-
-// OpenGL 1.3 deprecated functions
-inline void QOpenGLFunctions_4_3_Compatibility::glMultTransposeMatrixd(const GLdouble *m)
-{
- d_1_3_Deprecated->f.MultTransposeMatrixd(m);
-}
-
-inline void QOpenGLFunctions_4_3_Compatibility::glMultTransposeMatrixf(const GLfloat *m)
-{
- d_1_3_Deprecated->f.MultTransposeMatrixf(m);
-}
-
-inline void QOpenGLFunctions_4_3_Compatibility::glLoadTransposeMatrixd(const GLdouble *m)
-{
- d_1_3_Deprecated->f.LoadTransposeMatrixd(m);
-}
-
-inline void QOpenGLFunctions_4_3_Compatibility::glLoadTransposeMatrixf(const GLfloat *m)
-{
- d_1_3_Deprecated->f.LoadTransposeMatrixf(m);
-}
-
-inline void QOpenGLFunctions_4_3_Compatibility::glMultiTexCoord4sv(GLenum target, const GLshort *v)
-{
- d_1_3_Deprecated->f.MultiTexCoord4sv(target, v);
-}
-
-inline void QOpenGLFunctions_4_3_Compatibility::glMultiTexCoord4s(GLenum target, GLshort s, GLshort t, GLshort r, GLshort q)
-{
- d_1_3_Deprecated->f.MultiTexCoord4s(target, s, t, r, q);
-}
-
-inline void QOpenGLFunctions_4_3_Compatibility::glMultiTexCoord4iv(GLenum target, const GLint *v)
-{
- d_1_3_Deprecated->f.MultiTexCoord4iv(target, v);
-}
-
-inline void QOpenGLFunctions_4_3_Compatibility::glMultiTexCoord4i(GLenum target, GLint s, GLint t, GLint r, GLint q)
-{
- d_1_3_Deprecated->f.MultiTexCoord4i(target, s, t, r, q);
-}
-
-inline void QOpenGLFunctions_4_3_Compatibility::glMultiTexCoord4fv(GLenum target, const GLfloat *v)
-{
- d_1_3_Deprecated->f.MultiTexCoord4fv(target, v);
-}
-
-inline void QOpenGLFunctions_4_3_Compatibility::glMultiTexCoord4f(GLenum target, GLfloat s, GLfloat t, GLfloat r, GLfloat q)
-{
- d_1_3_Deprecated->f.MultiTexCoord4f(target, s, t, r, q);
-}
-
-inline void QOpenGLFunctions_4_3_Compatibility::glMultiTexCoord4dv(GLenum target, const GLdouble *v)
-{
- d_1_3_Deprecated->f.MultiTexCoord4dv(target, v);
-}
-
-inline void QOpenGLFunctions_4_3_Compatibility::glMultiTexCoord4d(GLenum target, GLdouble s, GLdouble t, GLdouble r, GLdouble q)
-{
- d_1_3_Deprecated->f.MultiTexCoord4d(target, s, t, r, q);
-}
-
-inline void QOpenGLFunctions_4_3_Compatibility::glMultiTexCoord3sv(GLenum target, const GLshort *v)
-{
- d_1_3_Deprecated->f.MultiTexCoord3sv(target, v);
-}
-
-inline void QOpenGLFunctions_4_3_Compatibility::glMultiTexCoord3s(GLenum target, GLshort s, GLshort t, GLshort r)
-{
- d_1_3_Deprecated->f.MultiTexCoord3s(target, s, t, r);
-}
-
-inline void QOpenGLFunctions_4_3_Compatibility::glMultiTexCoord3iv(GLenum target, const GLint *v)
-{
- d_1_3_Deprecated->f.MultiTexCoord3iv(target, v);
-}
-
-inline void QOpenGLFunctions_4_3_Compatibility::glMultiTexCoord3i(GLenum target, GLint s, GLint t, GLint r)
-{
- d_1_3_Deprecated->f.MultiTexCoord3i(target, s, t, r);
-}
-
-inline void QOpenGLFunctions_4_3_Compatibility::glMultiTexCoord3fv(GLenum target, const GLfloat *v)
-{
- d_1_3_Deprecated->f.MultiTexCoord3fv(target, v);
-}
-
-inline void QOpenGLFunctions_4_3_Compatibility::glMultiTexCoord3f(GLenum target, GLfloat s, GLfloat t, GLfloat r)
-{
- d_1_3_Deprecated->f.MultiTexCoord3f(target, s, t, r);
-}
-
-inline void QOpenGLFunctions_4_3_Compatibility::glMultiTexCoord3dv(GLenum target, const GLdouble *v)
-{
- d_1_3_Deprecated->f.MultiTexCoord3dv(target, v);
-}
-
-inline void QOpenGLFunctions_4_3_Compatibility::glMultiTexCoord3d(GLenum target, GLdouble s, GLdouble t, GLdouble r)
-{
- d_1_3_Deprecated->f.MultiTexCoord3d(target, s, t, r);
-}
-
-inline void QOpenGLFunctions_4_3_Compatibility::glMultiTexCoord2sv(GLenum target, const GLshort *v)
-{
- d_1_3_Deprecated->f.MultiTexCoord2sv(target, v);
-}
-
-inline void QOpenGLFunctions_4_3_Compatibility::glMultiTexCoord2s(GLenum target, GLshort s, GLshort t)
-{
- d_1_3_Deprecated->f.MultiTexCoord2s(target, s, t);
-}
-
-inline void QOpenGLFunctions_4_3_Compatibility::glMultiTexCoord2iv(GLenum target, const GLint *v)
-{
- d_1_3_Deprecated->f.MultiTexCoord2iv(target, v);
-}
-
-inline void QOpenGLFunctions_4_3_Compatibility::glMultiTexCoord2i(GLenum target, GLint s, GLint t)
-{
- d_1_3_Deprecated->f.MultiTexCoord2i(target, s, t);
-}
-
-inline void QOpenGLFunctions_4_3_Compatibility::glMultiTexCoord2fv(GLenum target, const GLfloat *v)
-{
- d_1_3_Deprecated->f.MultiTexCoord2fv(target, v);
-}
-
-inline void QOpenGLFunctions_4_3_Compatibility::glMultiTexCoord2f(GLenum target, GLfloat s, GLfloat t)
-{
- d_1_3_Deprecated->f.MultiTexCoord2f(target, s, t);
-}
-
-inline void QOpenGLFunctions_4_3_Compatibility::glMultiTexCoord2dv(GLenum target, const GLdouble *v)
-{
- d_1_3_Deprecated->f.MultiTexCoord2dv(target, v);
-}
-
-inline void QOpenGLFunctions_4_3_Compatibility::glMultiTexCoord2d(GLenum target, GLdouble s, GLdouble t)
-{
- d_1_3_Deprecated->f.MultiTexCoord2d(target, s, t);
-}
-
-inline void QOpenGLFunctions_4_3_Compatibility::glMultiTexCoord1sv(GLenum target, const GLshort *v)
-{
- d_1_3_Deprecated->f.MultiTexCoord1sv(target, v);
-}
-
-inline void QOpenGLFunctions_4_3_Compatibility::glMultiTexCoord1s(GLenum target, GLshort s)
-{
- d_1_3_Deprecated->f.MultiTexCoord1s(target, s);
-}
-
-inline void QOpenGLFunctions_4_3_Compatibility::glMultiTexCoord1iv(GLenum target, const GLint *v)
-{
- d_1_3_Deprecated->f.MultiTexCoord1iv(target, v);
-}
-
-inline void QOpenGLFunctions_4_3_Compatibility::glMultiTexCoord1i(GLenum target, GLint s)
-{
- d_1_3_Deprecated->f.MultiTexCoord1i(target, s);
-}
-
-inline void QOpenGLFunctions_4_3_Compatibility::glMultiTexCoord1fv(GLenum target, const GLfloat *v)
-{
- d_1_3_Deprecated->f.MultiTexCoord1fv(target, v);
-}
-
-inline void QOpenGLFunctions_4_3_Compatibility::glMultiTexCoord1f(GLenum target, GLfloat s)
-{
- d_1_3_Deprecated->f.MultiTexCoord1f(target, s);
-}
-
-inline void QOpenGLFunctions_4_3_Compatibility::glMultiTexCoord1dv(GLenum target, const GLdouble *v)
-{
- d_1_3_Deprecated->f.MultiTexCoord1dv(target, v);
-}
-
-inline void QOpenGLFunctions_4_3_Compatibility::glMultiTexCoord1d(GLenum target, GLdouble s)
-{
- d_1_3_Deprecated->f.MultiTexCoord1d(target, s);
-}
-
-inline void QOpenGLFunctions_4_3_Compatibility::glClientActiveTexture(GLenum texture)
-{
- d_1_3_Deprecated->f.ClientActiveTexture(texture);
-}
-
-
-// OpenGL 1.4 deprecated functions
-inline void QOpenGLFunctions_4_3_Compatibility::glWindowPos3sv(const GLshort *v)
-{
- d_1_4_Deprecated->f.WindowPos3sv(v);
-}
-
-inline void QOpenGLFunctions_4_3_Compatibility::glWindowPos3s(GLshort x, GLshort y, GLshort z)
-{
- d_1_4_Deprecated->f.WindowPos3s(x, y, z);
-}
-
-inline void QOpenGLFunctions_4_3_Compatibility::glWindowPos3iv(const GLint *v)
-{
- d_1_4_Deprecated->f.WindowPos3iv(v);
-}
-
-inline void QOpenGLFunctions_4_3_Compatibility::glWindowPos3i(GLint x, GLint y, GLint z)
-{
- d_1_4_Deprecated->f.WindowPos3i(x, y, z);
-}
-
-inline void QOpenGLFunctions_4_3_Compatibility::glWindowPos3fv(const GLfloat *v)
-{
- d_1_4_Deprecated->f.WindowPos3fv(v);
-}
-
-inline void QOpenGLFunctions_4_3_Compatibility::glWindowPos3f(GLfloat x, GLfloat y, GLfloat z)
-{
- d_1_4_Deprecated->f.WindowPos3f(x, y, z);
-}
-
-inline void QOpenGLFunctions_4_3_Compatibility::glWindowPos3dv(const GLdouble *v)
-{
- d_1_4_Deprecated->f.WindowPos3dv(v);
-}
-
-inline void QOpenGLFunctions_4_3_Compatibility::glWindowPos3d(GLdouble x, GLdouble y, GLdouble z)
-{
- d_1_4_Deprecated->f.WindowPos3d(x, y, z);
-}
-
-inline void QOpenGLFunctions_4_3_Compatibility::glWindowPos2sv(const GLshort *v)
-{
- d_1_4_Deprecated->f.WindowPos2sv(v);
-}
-
-inline void QOpenGLFunctions_4_3_Compatibility::glWindowPos2s(GLshort x, GLshort y)
-{
- d_1_4_Deprecated->f.WindowPos2s(x, y);
-}
-
-inline void QOpenGLFunctions_4_3_Compatibility::glWindowPos2iv(const GLint *v)
-{
- d_1_4_Deprecated->f.WindowPos2iv(v);
-}
-
-inline void QOpenGLFunctions_4_3_Compatibility::glWindowPos2i(GLint x, GLint y)
-{
- d_1_4_Deprecated->f.WindowPos2i(x, y);
-}
-
-inline void QOpenGLFunctions_4_3_Compatibility::glWindowPos2fv(const GLfloat *v)
-{
- d_1_4_Deprecated->f.WindowPos2fv(v);
-}
-
-inline void QOpenGLFunctions_4_3_Compatibility::glWindowPos2f(GLfloat x, GLfloat y)
-{
- d_1_4_Deprecated->f.WindowPos2f(x, y);
-}
-
-inline void QOpenGLFunctions_4_3_Compatibility::glWindowPos2dv(const GLdouble *v)
-{
- d_1_4_Deprecated->f.WindowPos2dv(v);
-}
-
-inline void QOpenGLFunctions_4_3_Compatibility::glWindowPos2d(GLdouble x, GLdouble y)
-{
- d_1_4_Deprecated->f.WindowPos2d(x, y);
-}
-
-inline void QOpenGLFunctions_4_3_Compatibility::glSecondaryColorPointer(GLint size, GLenum type, GLsizei stride, const GLvoid *pointer)
-{
- d_1_4_Deprecated->f.SecondaryColorPointer(size, type, stride, pointer);
-}
-
-inline void QOpenGLFunctions_4_3_Compatibility::glSecondaryColor3usv(const GLushort *v)
-{
- d_1_4_Deprecated->f.SecondaryColor3usv(v);
-}
-
-inline void QOpenGLFunctions_4_3_Compatibility::glSecondaryColor3us(GLushort red, GLushort green, GLushort blue)
-{
- d_1_4_Deprecated->f.SecondaryColor3us(red, green, blue);
-}
-
-inline void QOpenGLFunctions_4_3_Compatibility::glSecondaryColor3uiv(const GLuint *v)
-{
- d_1_4_Deprecated->f.SecondaryColor3uiv(v);
-}
-
-inline void QOpenGLFunctions_4_3_Compatibility::glSecondaryColor3ui(GLuint red, GLuint green, GLuint blue)
-{
- d_1_4_Deprecated->f.SecondaryColor3ui(red, green, blue);
-}
-
-inline void QOpenGLFunctions_4_3_Compatibility::glSecondaryColor3ubv(const GLubyte *v)
-{
- d_1_4_Deprecated->f.SecondaryColor3ubv(v);
-}
-
-inline void QOpenGLFunctions_4_3_Compatibility::glSecondaryColor3ub(GLubyte red, GLubyte green, GLubyte blue)
-{
- d_1_4_Deprecated->f.SecondaryColor3ub(red, green, blue);
-}
-
-inline void QOpenGLFunctions_4_3_Compatibility::glSecondaryColor3sv(const GLshort *v)
-{
- d_1_4_Deprecated->f.SecondaryColor3sv(v);
-}
-
-inline void QOpenGLFunctions_4_3_Compatibility::glSecondaryColor3s(GLshort red, GLshort green, GLshort blue)
-{
- d_1_4_Deprecated->f.SecondaryColor3s(red, green, blue);
-}
-
-inline void QOpenGLFunctions_4_3_Compatibility::glSecondaryColor3iv(const GLint *v)
-{
- d_1_4_Deprecated->f.SecondaryColor3iv(v);
-}
-
-inline void QOpenGLFunctions_4_3_Compatibility::glSecondaryColor3i(GLint red, GLint green, GLint blue)
-{
- d_1_4_Deprecated->f.SecondaryColor3i(red, green, blue);
-}
-
-inline void QOpenGLFunctions_4_3_Compatibility::glSecondaryColor3fv(const GLfloat *v)
-{
- d_1_4_Deprecated->f.SecondaryColor3fv(v);
-}
-
-inline void QOpenGLFunctions_4_3_Compatibility::glSecondaryColor3f(GLfloat red, GLfloat green, GLfloat blue)
-{
- d_1_4_Deprecated->f.SecondaryColor3f(red, green, blue);
-}
-
-inline void QOpenGLFunctions_4_3_Compatibility::glSecondaryColor3dv(const GLdouble *v)
-{
- d_1_4_Deprecated->f.SecondaryColor3dv(v);
-}
-
-inline void QOpenGLFunctions_4_3_Compatibility::glSecondaryColor3d(GLdouble red, GLdouble green, GLdouble blue)
-{
- d_1_4_Deprecated->f.SecondaryColor3d(red, green, blue);
-}
-
-inline void QOpenGLFunctions_4_3_Compatibility::glSecondaryColor3bv(const GLbyte *v)
-{
- d_1_4_Deprecated->f.SecondaryColor3bv(v);
-}
-
-inline void QOpenGLFunctions_4_3_Compatibility::glSecondaryColor3b(GLbyte red, GLbyte green, GLbyte blue)
-{
- d_1_4_Deprecated->f.SecondaryColor3b(red, green, blue);
-}
-
-inline void QOpenGLFunctions_4_3_Compatibility::glFogCoordPointer(GLenum type, GLsizei stride, const GLvoid *pointer)
-{
- d_1_4_Deprecated->f.FogCoordPointer(type, stride, pointer);
-}
-
-inline void QOpenGLFunctions_4_3_Compatibility::glFogCoorddv(const GLdouble *coord)
-{
- d_1_4_Deprecated->f.FogCoorddv(coord);
-}
-
-inline void QOpenGLFunctions_4_3_Compatibility::glFogCoordd(GLdouble coord)
-{
- d_1_4_Deprecated->f.FogCoordd(coord);
-}
-
-inline void QOpenGLFunctions_4_3_Compatibility::glFogCoordfv(const GLfloat *coord)
-{
- d_1_4_Deprecated->f.FogCoordfv(coord);
-}
-
-inline void QOpenGLFunctions_4_3_Compatibility::glFogCoordf(GLfloat coord)
-{
- d_1_4_Deprecated->f.FogCoordf(coord);
-}
-
-
-// OpenGL 1.5 deprecated functions
-
-// OpenGL 2.0 deprecated functions
-inline void QOpenGLFunctions_4_3_Compatibility::glVertexAttrib4usv(GLuint index, const GLushort *v)
-{
- d_2_0_Core->f.VertexAttrib4usv(index, v);
-}
-
-inline void QOpenGLFunctions_4_3_Compatibility::glVertexAttrib4uiv(GLuint index, const GLuint *v)
-{
- d_2_0_Core->f.VertexAttrib4uiv(index, v);
-}
-
-inline void QOpenGLFunctions_4_3_Compatibility::glVertexAttrib4ubv(GLuint index, const GLubyte *v)
-{
- d_2_0_Core->f.VertexAttrib4ubv(index, v);
-}
-
-inline void QOpenGLFunctions_4_3_Compatibility::glVertexAttrib4sv(GLuint index, const GLshort *v)
-{
- d_2_0_Core->f.VertexAttrib4sv(index, v);
-}
-
-inline void QOpenGLFunctions_4_3_Compatibility::glVertexAttrib4s(GLuint index, GLshort x, GLshort y, GLshort z, GLshort w)
-{
- d_2_0_Core->f.VertexAttrib4s(index, x, y, z, w);
-}
-
-inline void QOpenGLFunctions_4_3_Compatibility::glVertexAttrib4iv(GLuint index, const GLint *v)
-{
- d_2_0_Core->f.VertexAttrib4iv(index, v);
-}
-
-inline void QOpenGLFunctions_4_3_Compatibility::glVertexAttrib4fv(GLuint index, const GLfloat *v)
-{
- d_2_0_Core->f.VertexAttrib4fv(index, v);
-}
-
-inline void QOpenGLFunctions_4_3_Compatibility::glVertexAttrib4f(GLuint index, GLfloat x, GLfloat y, GLfloat z, GLfloat w)
-{
- d_2_0_Core->f.VertexAttrib4f(index, x, y, z, w);
-}
-
-inline void QOpenGLFunctions_4_3_Compatibility::glVertexAttrib4dv(GLuint index, const GLdouble *v)
-{
- d_2_0_Core->f.VertexAttrib4dv(index, v);
-}
-
-inline void QOpenGLFunctions_4_3_Compatibility::glVertexAttrib4d(GLuint index, GLdouble x, GLdouble y, GLdouble z, GLdouble w)
-{
- d_2_0_Core->f.VertexAttrib4d(index, x, y, z, w);
-}
-
-inline void QOpenGLFunctions_4_3_Compatibility::glVertexAttrib4bv(GLuint index, const GLbyte *v)
-{
- d_2_0_Core->f.VertexAttrib4bv(index, v);
-}
-
-inline void QOpenGLFunctions_4_3_Compatibility::glVertexAttrib4Nusv(GLuint index, const GLushort *v)
-{
- d_2_0_Core->f.VertexAttrib4Nusv(index, v);
-}
-
-inline void QOpenGLFunctions_4_3_Compatibility::glVertexAttrib4Nuiv(GLuint index, const GLuint *v)
-{
- d_2_0_Core->f.VertexAttrib4Nuiv(index, v);
-}
-
-inline void QOpenGLFunctions_4_3_Compatibility::glVertexAttrib4Nubv(GLuint index, const GLubyte *v)
-{
- d_2_0_Core->f.VertexAttrib4Nubv(index, v);
-}
-
-inline void QOpenGLFunctions_4_3_Compatibility::glVertexAttrib4Nub(GLuint index, GLubyte x, GLubyte y, GLubyte z, GLubyte w)
-{
- d_2_0_Core->f.VertexAttrib4Nub(index, x, y, z, w);
-}
-
-inline void QOpenGLFunctions_4_3_Compatibility::glVertexAttrib4Nsv(GLuint index, const GLshort *v)
-{
- d_2_0_Core->f.VertexAttrib4Nsv(index, v);
-}
-
-inline void QOpenGLFunctions_4_3_Compatibility::glVertexAttrib4Niv(GLuint index, const GLint *v)
-{
- d_2_0_Core->f.VertexAttrib4Niv(index, v);
-}
-
-inline void QOpenGLFunctions_4_3_Compatibility::glVertexAttrib4Nbv(GLuint index, const GLbyte *v)
-{
- d_2_0_Core->f.VertexAttrib4Nbv(index, v);
-}
-
-inline void QOpenGLFunctions_4_3_Compatibility::glVertexAttrib3sv(GLuint index, const GLshort *v)
-{
- d_2_0_Core->f.VertexAttrib3sv(index, v);
-}
-
-inline void QOpenGLFunctions_4_3_Compatibility::glVertexAttrib3s(GLuint index, GLshort x, GLshort y, GLshort z)
-{
- d_2_0_Core->f.VertexAttrib3s(index, x, y, z);
-}
-
-inline void QOpenGLFunctions_4_3_Compatibility::glVertexAttrib3fv(GLuint index, const GLfloat *v)
-{
- d_2_0_Core->f.VertexAttrib3fv(index, v);
-}
-
-inline void QOpenGLFunctions_4_3_Compatibility::glVertexAttrib3f(GLuint index, GLfloat x, GLfloat y, GLfloat z)
-{
- d_2_0_Core->f.VertexAttrib3f(index, x, y, z);
-}
-
-inline void QOpenGLFunctions_4_3_Compatibility::glVertexAttrib3dv(GLuint index, const GLdouble *v)
-{
- d_2_0_Core->f.VertexAttrib3dv(index, v);
-}
-
-inline void QOpenGLFunctions_4_3_Compatibility::glVertexAttrib3d(GLuint index, GLdouble x, GLdouble y, GLdouble z)
-{
- d_2_0_Core->f.VertexAttrib3d(index, x, y, z);
-}
-
-inline void QOpenGLFunctions_4_3_Compatibility::glVertexAttrib2sv(GLuint index, const GLshort *v)
-{
- d_2_0_Core->f.VertexAttrib2sv(index, v);
-}
-
-inline void QOpenGLFunctions_4_3_Compatibility::glVertexAttrib2s(GLuint index, GLshort x, GLshort y)
-{
- d_2_0_Core->f.VertexAttrib2s(index, x, y);
-}
-
-inline void QOpenGLFunctions_4_3_Compatibility::glVertexAttrib2fv(GLuint index, const GLfloat *v)
-{
- d_2_0_Core->f.VertexAttrib2fv(index, v);
-}
-
-inline void QOpenGLFunctions_4_3_Compatibility::glVertexAttrib2f(GLuint index, GLfloat x, GLfloat y)
-{
- d_2_0_Core->f.VertexAttrib2f(index, x, y);
-}
-
-inline void QOpenGLFunctions_4_3_Compatibility::glVertexAttrib2dv(GLuint index, const GLdouble *v)
-{
- d_2_0_Core->f.VertexAttrib2dv(index, v);
-}
-
-inline void QOpenGLFunctions_4_3_Compatibility::glVertexAttrib2d(GLuint index, GLdouble x, GLdouble y)
-{
- d_2_0_Core->f.VertexAttrib2d(index, x, y);
-}
-
-inline void QOpenGLFunctions_4_3_Compatibility::glVertexAttrib1sv(GLuint index, const GLshort *v)
-{
- d_2_0_Core->f.VertexAttrib1sv(index, v);
-}
-
-inline void QOpenGLFunctions_4_3_Compatibility::glVertexAttrib1s(GLuint index, GLshort x)
-{
- d_2_0_Core->f.VertexAttrib1s(index, x);
-}
-
-inline void QOpenGLFunctions_4_3_Compatibility::glVertexAttrib1fv(GLuint index, const GLfloat *v)
-{
- d_2_0_Core->f.VertexAttrib1fv(index, v);
-}
-
-inline void QOpenGLFunctions_4_3_Compatibility::glVertexAttrib1f(GLuint index, GLfloat x)
-{
- d_2_0_Core->f.VertexAttrib1f(index, x);
-}
-
-inline void QOpenGLFunctions_4_3_Compatibility::glVertexAttrib1dv(GLuint index, const GLdouble *v)
-{
- d_2_0_Core->f.VertexAttrib1dv(index, v);
-}
-
-inline void QOpenGLFunctions_4_3_Compatibility::glVertexAttrib1d(GLuint index, GLdouble x)
-{
- d_2_0_Core->f.VertexAttrib1d(index, x);
-}
-
-
-// OpenGL 2.1 deprecated functions
-
-// OpenGL 3.0 deprecated functions
-inline void QOpenGLFunctions_4_3_Compatibility::glVertexAttribI4usv(GLuint index, const GLushort *v)
-{
- d_3_0_Core->f.VertexAttribI4usv(index, v);
-}
-
-inline void QOpenGLFunctions_4_3_Compatibility::glVertexAttribI4ubv(GLuint index, const GLubyte *v)
-{
- d_3_0_Core->f.VertexAttribI4ubv(index, v);
-}
-
-inline void QOpenGLFunctions_4_3_Compatibility::glVertexAttribI4sv(GLuint index, const GLshort *v)
-{
- d_3_0_Core->f.VertexAttribI4sv(index, v);
-}
-
-inline void QOpenGLFunctions_4_3_Compatibility::glVertexAttribI4bv(GLuint index, const GLbyte *v)
-{
- d_3_0_Core->f.VertexAttribI4bv(index, v);
-}
-
-inline void QOpenGLFunctions_4_3_Compatibility::glVertexAttribI4uiv(GLuint index, const GLuint *v)
-{
- d_3_0_Core->f.VertexAttribI4uiv(index, v);
-}
-
-inline void QOpenGLFunctions_4_3_Compatibility::glVertexAttribI3uiv(GLuint index, const GLuint *v)
-{
- d_3_0_Core->f.VertexAttribI3uiv(index, v);
-}
-
-inline void QOpenGLFunctions_4_3_Compatibility::glVertexAttribI2uiv(GLuint index, const GLuint *v)
-{
- d_3_0_Core->f.VertexAttribI2uiv(index, v);
-}
-
-inline void QOpenGLFunctions_4_3_Compatibility::glVertexAttribI1uiv(GLuint index, const GLuint *v)
-{
- d_3_0_Core->f.VertexAttribI1uiv(index, v);
-}
-
-inline void QOpenGLFunctions_4_3_Compatibility::glVertexAttribI4iv(GLuint index, const GLint *v)
-{
- d_3_0_Core->f.VertexAttribI4iv(index, v);
-}
-
-inline void QOpenGLFunctions_4_3_Compatibility::glVertexAttribI3iv(GLuint index, const GLint *v)
-{
- d_3_0_Core->f.VertexAttribI3iv(index, v);
-}
-
-inline void QOpenGLFunctions_4_3_Compatibility::glVertexAttribI2iv(GLuint index, const GLint *v)
-{
- d_3_0_Core->f.VertexAttribI2iv(index, v);
-}
-
-inline void QOpenGLFunctions_4_3_Compatibility::glVertexAttribI1iv(GLuint index, const GLint *v)
-{
- d_3_0_Core->f.VertexAttribI1iv(index, v);
-}
-
-inline void QOpenGLFunctions_4_3_Compatibility::glVertexAttribI4ui(GLuint index, GLuint x, GLuint y, GLuint z, GLuint w)
-{
- d_3_0_Core->f.VertexAttribI4ui(index, x, y, z, w);
-}
-
-inline void QOpenGLFunctions_4_3_Compatibility::glVertexAttribI3ui(GLuint index, GLuint x, GLuint y, GLuint z)
-{
- d_3_0_Core->f.VertexAttribI3ui(index, x, y, z);
-}
-
-inline void QOpenGLFunctions_4_3_Compatibility::glVertexAttribI2ui(GLuint index, GLuint x, GLuint y)
-{
- d_3_0_Core->f.VertexAttribI2ui(index, x, y);
-}
-
-inline void QOpenGLFunctions_4_3_Compatibility::glVertexAttribI1ui(GLuint index, GLuint x)
-{
- d_3_0_Core->f.VertexAttribI1ui(index, x);
-}
-
-inline void QOpenGLFunctions_4_3_Compatibility::glVertexAttribI4i(GLuint index, GLint x, GLint y, GLint z, GLint w)
-{
- d_3_0_Core->f.VertexAttribI4i(index, x, y, z, w);
-}
-
-inline void QOpenGLFunctions_4_3_Compatibility::glVertexAttribI3i(GLuint index, GLint x, GLint y, GLint z)
-{
- d_3_0_Core->f.VertexAttribI3i(index, x, y, z);
-}
-
-inline void QOpenGLFunctions_4_3_Compatibility::glVertexAttribI2i(GLuint index, GLint x, GLint y)
-{
- d_3_0_Core->f.VertexAttribI2i(index, x, y);
-}
-
-inline void QOpenGLFunctions_4_3_Compatibility::glVertexAttribI1i(GLuint index, GLint x)
-{
- d_3_0_Core->f.VertexAttribI1i(index, x);
-}
-
-
-// OpenGL 3.1 deprecated functions
-
-// OpenGL 3.2 deprecated functions
-
-// OpenGL 3.3 deprecated functions
-
-// OpenGL 4.0 deprecated functions
-
-// OpenGL 4.1 deprecated functions
-
-// OpenGL 4.2 deprecated functions
-
-// OpenGL 4.3 deprecated functions
-
-
-QT_END_NAMESPACE
-
-#ifdef Q_OS_WIN
-#pragma pop_macro("MemoryBarrier")
-#endif
-
-#endif // QT_NO_OPENGL && !QT_OPENGL_ES_2
-
-#endif
diff --git a/src/gui/opengl/qopenglfunctions_4_3_core.cpp b/src/gui/opengl/qopenglfunctions_4_3_core.cpp
deleted file mode 100644
index 8a867471b8..0000000000
--- a/src/gui/opengl/qopenglfunctions_4_3_core.cpp
+++ /dev/null
@@ -1,260 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2013 Klaralvdalens Datakonsult AB (KDAB)
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the QtGui module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-**
-** This file was generated by glgen version 0.1
-** Command line was: glgen
-**
-** glgen is Copyright (C) 2013 Klaralvdalens Datakonsult AB (KDAB)
-**
-** This is an auto-generated file.
-** Do not edit! All changes made to it will be lost.
-**
-****************************************************************************/
-
-#include "qopenglfunctions_4_3_core.h"
-#include "qopenglcontext.h"
-
-QT_BEGIN_NAMESPACE
-
-/*!
- \class QOpenGLFunctions_4_3_Core
- \inmodule QtGui
- \since 5.1
- \wrapper
- \brief The QOpenGLFunctions_4_3_Core class provides all functions for OpenGL 4.3 core profile.
-
- This class is a wrapper for functions from OpenGL 4.3 core profile.
- See reference pages on \l {http://www.opengl.org/sdk/docs/}{opengl.org}
- for function documentation.
-
- \sa QAbstractOpenGLFunctions
-*/
-
-QOpenGLFunctions_4_3_Core::QOpenGLFunctions_4_3_Core()
- : QAbstractOpenGLFunctions()
- , d_1_0_Core(nullptr)
- , d_1_1_Core(nullptr)
- , d_1_2_Core(nullptr)
- , d_1_3_Core(nullptr)
- , d_1_4_Core(nullptr)
- , d_1_5_Core(nullptr)
- , d_2_0_Core(nullptr)
- , d_2_1_Core(nullptr)
- , d_3_0_Core(nullptr)
- , d_3_1_Core(nullptr)
- , d_3_2_Core(nullptr)
- , d_3_3_Core(nullptr)
- , d_4_0_Core(nullptr)
- , d_4_1_Core(nullptr)
- , d_4_2_Core(nullptr)
- , d_4_3_Core(nullptr)
-{
-}
-
-QOpenGLFunctions_4_3_Core::~QOpenGLFunctions_4_3_Core()
-{
- if (d_1_0_Core) {
- d_1_0_Core->refs.deref();
- Q_ASSERT(d_1_0_Core->refs.loadRelaxed());
- }
- if (d_1_1_Core) {
- d_1_1_Core->refs.deref();
- Q_ASSERT(d_1_1_Core->refs.loadRelaxed());
- }
- if (d_1_2_Core) {
- d_1_2_Core->refs.deref();
- Q_ASSERT(d_1_2_Core->refs.loadRelaxed());
- }
- if (d_1_3_Core) {
- d_1_3_Core->refs.deref();
- Q_ASSERT(d_1_3_Core->refs.loadRelaxed());
- }
- if (d_1_4_Core) {
- d_1_4_Core->refs.deref();
- Q_ASSERT(d_1_4_Core->refs.loadRelaxed());
- }
- if (d_1_5_Core) {
- d_1_5_Core->refs.deref();
- Q_ASSERT(d_1_5_Core->refs.loadRelaxed());
- }
- if (d_2_0_Core) {
- d_2_0_Core->refs.deref();
- Q_ASSERT(d_2_0_Core->refs.loadRelaxed());
- }
- if (d_2_1_Core) {
- d_2_1_Core->refs.deref();
- Q_ASSERT(d_2_1_Core->refs.loadRelaxed());
- }
- if (d_3_0_Core) {
- d_3_0_Core->refs.deref();
- Q_ASSERT(d_3_0_Core->refs.loadRelaxed());
- }
- if (d_3_1_Core) {
- d_3_1_Core->refs.deref();
- Q_ASSERT(d_3_1_Core->refs.loadRelaxed());
- }
- if (d_3_2_Core) {
- d_3_2_Core->refs.deref();
- Q_ASSERT(d_3_2_Core->refs.loadRelaxed());
- }
- if (d_3_3_Core) {
- d_3_3_Core->refs.deref();
- Q_ASSERT(d_3_3_Core->refs.loadRelaxed());
- }
- if (d_4_0_Core) {
- d_4_0_Core->refs.deref();
- Q_ASSERT(d_4_0_Core->refs.loadRelaxed());
- }
- if (d_4_1_Core) {
- d_4_1_Core->refs.deref();
- Q_ASSERT(d_4_1_Core->refs.loadRelaxed());
- }
- if (d_4_2_Core) {
- d_4_2_Core->refs.deref();
- Q_ASSERT(d_4_2_Core->refs.loadRelaxed());
- }
- if (d_4_3_Core) {
- d_4_3_Core->refs.deref();
- Q_ASSERT(d_4_3_Core->refs.loadRelaxed());
- }
-}
-
-bool QOpenGLFunctions_4_3_Core::initializeOpenGLFunctions()
-{
- if ( isInitialized() )
- return true;
-
- QOpenGLContext* context = QOpenGLContext::currentContext();
-
- // If owned by a context object make sure it is current.
- // Also check that current context is capable of resolving all needed functions
- if (((owningContext() && owningContext() == context) || !owningContext())
- && QOpenGLFunctions_4_3_Core::isContextCompatible(context))
- {
- // Associate with private implementation, creating if necessary
- // Function pointers in the backends are resolved at creation time
- QOpenGLVersionFunctionsBackend* d = nullptr;
- d = QAbstractOpenGLFunctionsPrivate::functionsBackend(context, QOpenGLFunctions_1_0_CoreBackend::versionStatus());
- d_1_0_Core = static_cast<QOpenGLFunctions_1_0_CoreBackend*>(d);
- d->refs.ref();
-
- d = QAbstractOpenGLFunctionsPrivate::functionsBackend(context, QOpenGLFunctions_1_1_CoreBackend::versionStatus());
- d_1_1_Core = static_cast<QOpenGLFunctions_1_1_CoreBackend*>(d);
- d->refs.ref();
-
- d = QAbstractOpenGLFunctionsPrivate::functionsBackend(context, QOpenGLFunctions_1_2_CoreBackend::versionStatus());
- d_1_2_Core = static_cast<QOpenGLFunctions_1_2_CoreBackend*>(d);
- d->refs.ref();
-
- d = QAbstractOpenGLFunctionsPrivate::functionsBackend(context, QOpenGLFunctions_1_3_CoreBackend::versionStatus());
- d_1_3_Core = static_cast<QOpenGLFunctions_1_3_CoreBackend*>(d);
- d->refs.ref();
-
- d = QAbstractOpenGLFunctionsPrivate::functionsBackend(context, QOpenGLFunctions_1_4_CoreBackend::versionStatus());
- d_1_4_Core = static_cast<QOpenGLFunctions_1_4_CoreBackend*>(d);
- d->refs.ref();
-
- d = QAbstractOpenGLFunctionsPrivate::functionsBackend(context, QOpenGLFunctions_1_5_CoreBackend::versionStatus());
- d_1_5_Core = static_cast<QOpenGLFunctions_1_5_CoreBackend*>(d);
- d->refs.ref();
-
- d = QAbstractOpenGLFunctionsPrivate::functionsBackend(context, QOpenGLFunctions_2_0_CoreBackend::versionStatus());
- d_2_0_Core = static_cast<QOpenGLFunctions_2_0_CoreBackend*>(d);
- d->refs.ref();
-
- d = QAbstractOpenGLFunctionsPrivate::functionsBackend(context, QOpenGLFunctions_2_1_CoreBackend::versionStatus());
- d_2_1_Core = static_cast<QOpenGLFunctions_2_1_CoreBackend*>(d);
- d->refs.ref();
-
- d = QAbstractOpenGLFunctionsPrivate::functionsBackend(context, QOpenGLFunctions_3_0_CoreBackend::versionStatus());
- d_3_0_Core = static_cast<QOpenGLFunctions_3_0_CoreBackend*>(d);
- d->refs.ref();
-
- d = QAbstractOpenGLFunctionsPrivate::functionsBackend(context, QOpenGLFunctions_3_1_CoreBackend::versionStatus());
- d_3_1_Core = static_cast<QOpenGLFunctions_3_1_CoreBackend*>(d);
- d->refs.ref();
-
- d = QAbstractOpenGLFunctionsPrivate::functionsBackend(context, QOpenGLFunctions_3_2_CoreBackend::versionStatus());
- d_3_2_Core = static_cast<QOpenGLFunctions_3_2_CoreBackend*>(d);
- d->refs.ref();
-
- d = QAbstractOpenGLFunctionsPrivate::functionsBackend(context, QOpenGLFunctions_3_3_CoreBackend::versionStatus());
- d_3_3_Core = static_cast<QOpenGLFunctions_3_3_CoreBackend*>(d);
- d->refs.ref();
-
- d = QAbstractOpenGLFunctionsPrivate::functionsBackend(context, QOpenGLFunctions_4_0_CoreBackend::versionStatus());
- d_4_0_Core = static_cast<QOpenGLFunctions_4_0_CoreBackend*>(d);
- d->refs.ref();
-
- d = QAbstractOpenGLFunctionsPrivate::functionsBackend(context, QOpenGLFunctions_4_1_CoreBackend::versionStatus());
- d_4_1_Core = static_cast<QOpenGLFunctions_4_1_CoreBackend*>(d);
- d->refs.ref();
-
- d = QAbstractOpenGLFunctionsPrivate::functionsBackend(context, QOpenGLFunctions_4_2_CoreBackend::versionStatus());
- d_4_2_Core = static_cast<QOpenGLFunctions_4_2_CoreBackend*>(d);
- d->refs.ref();
-
- d = QAbstractOpenGLFunctionsPrivate::functionsBackend(context, QOpenGLFunctions_4_3_CoreBackend::versionStatus());
- d_4_3_Core = static_cast<QOpenGLFunctions_4_3_CoreBackend*>(d);
- d->refs.ref();
-
- QAbstractOpenGLFunctions::initializeOpenGLFunctions();
- }
- return isInitialized();
-}
-
-bool QOpenGLFunctions_4_3_Core::isContextCompatible(QOpenGLContext *context)
-{
- Q_ASSERT(context);
- QSurfaceFormat f = context->format();
- const QPair<int, int> v = qMakePair(f.majorVersion(), f.minorVersion());
- if (v < qMakePair(4, 3))
- return false;
-
- return true;
-}
-
-QOpenGLVersionProfile QOpenGLFunctions_4_3_Core::versionProfile()
-{
- QOpenGLVersionProfile v;
- v.setVersion(4, 3);
- v.setProfile(QSurfaceFormat::CoreProfile);
- return v;
-}
-
-QT_END_NAMESPACE
diff --git a/src/gui/opengl/qopenglfunctions_4_3_core.h b/src/gui/opengl/qopenglfunctions_4_3_core.h
deleted file mode 100644
index 13675caf62..0000000000
--- a/src/gui/opengl/qopenglfunctions_4_3_core.h
+++ /dev/null
@@ -1,3246 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2013 Klaralvdalens Datakonsult AB (KDAB)
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the QtGui module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-**
-** This file was generated by glgen version 0.1
-** Command line was: glgen
-**
-** glgen is Copyright (C) 2013 Klaralvdalens Datakonsult AB (KDAB)
-**
-** This is an auto-generated file.
-** Do not edit! All changes made to it will be lost.
-**
-****************************************************************************/
-
-#ifndef QOPENGLVERSIONFUNCTIONS_4_3_CORE_H
-#define QOPENGLVERSIONFUNCTIONS_4_3_CORE_H
-
-#include <QtGui/qtguiglobal.h>
-
-#if !defined(QT_NO_OPENGL) && !defined(QT_OPENGL_ES_2)
-
-#include <QtGui/QOpenGLVersionFunctions>
-#include <QtGui/qopenglcontext.h>
-
-// MemoryBarrier is a macro on some architectures on Windows
-#ifdef Q_OS_WIN
-#pragma push_macro("MemoryBarrier")
-#undef MemoryBarrier
-#endif
-
-
-QT_BEGIN_NAMESPACE
-
-class Q_GUI_EXPORT QOpenGLFunctions_4_3_Core : public QAbstractOpenGLFunctions
-{
-public:
- QOpenGLFunctions_4_3_Core();
- ~QOpenGLFunctions_4_3_Core();
-
- bool initializeOpenGLFunctions() override;
-
- // OpenGL 1.0 core functions
- void glViewport(GLint x, GLint y, GLsizei width, GLsizei height);
- void glDepthRange(GLdouble nearVal, GLdouble farVal);
- GLboolean glIsEnabled(GLenum cap);
- void glGetTexLevelParameteriv(GLenum target, GLint level, GLenum pname, GLint *params);
- void glGetTexLevelParameterfv(GLenum target, GLint level, GLenum pname, GLfloat *params);
- void glGetTexParameteriv(GLenum target, GLenum pname, GLint *params);
- void glGetTexParameterfv(GLenum target, GLenum pname, GLfloat *params);
- void glGetTexImage(GLenum target, GLint level, GLenum format, GLenum type, GLvoid *pixels);
- const GLubyte * glGetString(GLenum name);
- void glGetIntegerv(GLenum pname, GLint *params);
- void glGetFloatv(GLenum pname, GLfloat *params);
- GLenum glGetError();
- void glGetDoublev(GLenum pname, GLdouble *params);
- void glGetBooleanv(GLenum pname, GLboolean *params);
- void glReadPixels(GLint x, GLint y, GLsizei width, GLsizei height, GLenum format, GLenum type, GLvoid *pixels);
- void glReadBuffer(GLenum mode);
- void glPixelStorei(GLenum pname, GLint param);
- void glPixelStoref(GLenum pname, GLfloat param);
- void glDepthFunc(GLenum func);
- void glStencilOp(GLenum fail, GLenum zfail, GLenum zpass);
- void glStencilFunc(GLenum func, GLint ref, GLuint mask);
- void glLogicOp(GLenum opcode);
- void glBlendFunc(GLenum sfactor, GLenum dfactor);
- void glFlush();
- void glFinish();
- void glEnable(GLenum cap);
- void glDisable(GLenum cap);
- void glDepthMask(GLboolean flag);
- void glColorMask(GLboolean red, GLboolean green, GLboolean blue, GLboolean alpha);
- void glStencilMask(GLuint mask);
- void glClearDepth(GLdouble depth);
- void glClearStencil(GLint s);
- void glClearColor(GLfloat red, GLfloat green, GLfloat blue, GLfloat alpha);
- void glClear(GLbitfield mask);
- void glDrawBuffer(GLenum mode);
- void glTexImage2D(GLenum target, GLint level, GLint internalformat, GLsizei width, GLsizei height, GLint border, GLenum format, GLenum type, const GLvoid *pixels);
- void glTexImage1D(GLenum target, GLint level, GLint internalformat, GLsizei width, GLint border, GLenum format, GLenum type, const GLvoid *pixels);
- void glTexParameteriv(GLenum target, GLenum pname, const GLint *params);
- void glTexParameteri(GLenum target, GLenum pname, GLint param);
- void glTexParameterfv(GLenum target, GLenum pname, const GLfloat *params);
- void glTexParameterf(GLenum target, GLenum pname, GLfloat param);
- void glScissor(GLint x, GLint y, GLsizei width, GLsizei height);
- void glPolygonMode(GLenum face, GLenum mode);
- void glPointSize(GLfloat size);
- void glLineWidth(GLfloat width);
- void glHint(GLenum target, GLenum mode);
- void glFrontFace(GLenum mode);
- void glCullFace(GLenum mode);
-
- // OpenGL 1.1 core functions
- void glIndexubv(const GLubyte *c);
- void glIndexub(GLubyte c);
- GLboolean glIsTexture(GLuint texture);
- void glGenTextures(GLsizei n, GLuint *textures);
- void glDeleteTextures(GLsizei n, const GLuint *textures);
- void glBindTexture(GLenum target, GLuint texture);
- void glTexSubImage2D(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLenum type, const GLvoid *pixels);
- void glTexSubImage1D(GLenum target, GLint level, GLint xoffset, GLsizei width, GLenum format, GLenum type, const GLvoid *pixels);
- void glCopyTexSubImage2D(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint x, GLint y, GLsizei width, GLsizei height);
- void glCopyTexSubImage1D(GLenum target, GLint level, GLint xoffset, GLint x, GLint y, GLsizei width);
- void glCopyTexImage2D(GLenum target, GLint level, GLenum internalformat, GLint x, GLint y, GLsizei width, GLsizei height, GLint border);
- void glCopyTexImage1D(GLenum target, GLint level, GLenum internalformat, GLint x, GLint y, GLsizei width, GLint border);
- void glPolygonOffset(GLfloat factor, GLfloat units);
- void glGetPointerv(GLenum pname, GLvoid* *params);
- void glDrawElements(GLenum mode, GLsizei count, GLenum type, const GLvoid *indices);
- void glDrawArrays(GLenum mode, GLint first, GLsizei count);
-
- // OpenGL 1.2 core functions
- void glCopyTexSubImage3D(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLint x, GLint y, GLsizei width, GLsizei height);
- void glTexSubImage3D(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLenum type, const GLvoid *pixels);
- void glTexImage3D(GLenum target, GLint level, GLint internalformat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLenum format, GLenum type, const GLvoid *pixels);
- void glDrawRangeElements(GLenum mode, GLuint start, GLuint end, GLsizei count, GLenum type, const GLvoid *indices);
- void glBlendEquation(GLenum mode);
- void glBlendColor(GLfloat red, GLfloat green, GLfloat blue, GLfloat alpha);
-
- // OpenGL 1.3 core functions
- void glGetCompressedTexImage(GLenum target, GLint level, GLvoid *img);
- void glCompressedTexSubImage1D(GLenum target, GLint level, GLint xoffset, GLsizei width, GLenum format, GLsizei imageSize, const GLvoid *data);
- void glCompressedTexSubImage2D(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLsizei imageSize, const GLvoid *data);
- void glCompressedTexSubImage3D(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLsizei imageSize, const GLvoid *data);
- void glCompressedTexImage1D(GLenum target, GLint level, GLenum internalformat, GLsizei width, GLint border, GLsizei imageSize, const GLvoid *data);
- void glCompressedTexImage2D(GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLint border, GLsizei imageSize, const GLvoid *data);
- void glCompressedTexImage3D(GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLsizei imageSize, const GLvoid *data);
- void glSampleCoverage(GLfloat value, GLboolean invert);
- void glActiveTexture(GLenum texture);
-
- // OpenGL 1.4 core functions
- void glPointParameteriv(GLenum pname, const GLint *params);
- void glPointParameteri(GLenum pname, GLint param);
- void glPointParameterfv(GLenum pname, const GLfloat *params);
- void glPointParameterf(GLenum pname, GLfloat param);
- void glMultiDrawElements(GLenum mode, const GLsizei *count, GLenum type, const GLvoid* const *indices, GLsizei drawcount);
- void glMultiDrawArrays(GLenum mode, const GLint *first, const GLsizei *count, GLsizei drawcount);
- void glBlendFuncSeparate(GLenum sfactorRGB, GLenum dfactorRGB, GLenum sfactorAlpha, GLenum dfactorAlpha);
-
- // OpenGL 1.5 core functions
- void glGetBufferPointerv(GLenum target, GLenum pname, GLvoid* *params);
- void glGetBufferParameteriv(GLenum target, GLenum pname, GLint *params);
- GLboolean glUnmapBuffer(GLenum target);
- GLvoid* glMapBuffer(GLenum target, GLenum access);
- void glGetBufferSubData(GLenum target, GLintptr offset, GLsizeiptr size, GLvoid *data);
- void glBufferSubData(GLenum target, GLintptr offset, GLsizeiptr size, const GLvoid *data);
- void glBufferData(GLenum target, GLsizeiptr size, const GLvoid *data, GLenum usage);
- GLboolean glIsBuffer(GLuint buffer);
- void glGenBuffers(GLsizei n, GLuint *buffers);
- void glDeleteBuffers(GLsizei n, const GLuint *buffers);
- void glBindBuffer(GLenum target, GLuint buffer);
- void glGetQueryObjectuiv(GLuint id, GLenum pname, GLuint *params);
- void glGetQueryObjectiv(GLuint id, GLenum pname, GLint *params);
- void glGetQueryiv(GLenum target, GLenum pname, GLint *params);
- void glEndQuery(GLenum target);
- void glBeginQuery(GLenum target, GLuint id);
- GLboolean glIsQuery(GLuint id);
- void glDeleteQueries(GLsizei n, const GLuint *ids);
- void glGenQueries(GLsizei n, GLuint *ids);
-
- // OpenGL 2.0 core functions
- void glVertexAttribPointer(GLuint index, GLint size, GLenum type, GLboolean normalized, GLsizei stride, const GLvoid *pointer);
- void glValidateProgram(GLuint program);
- void glUniformMatrix4fv(GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
- void glUniformMatrix3fv(GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
- void glUniformMatrix2fv(GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
- void glUniform4iv(GLint location, GLsizei count, const GLint *value);
- void glUniform3iv(GLint location, GLsizei count, const GLint *value);
- void glUniform2iv(GLint location, GLsizei count, const GLint *value);
- void glUniform1iv(GLint location, GLsizei count, const GLint *value);
- void glUniform4fv(GLint location, GLsizei count, const GLfloat *value);
- void glUniform3fv(GLint location, GLsizei count, const GLfloat *value);
- void glUniform2fv(GLint location, GLsizei count, const GLfloat *value);
- void glUniform1fv(GLint location, GLsizei count, const GLfloat *value);
- void glUniform4i(GLint location, GLint v0, GLint v1, GLint v2, GLint v3);
- void glUniform3i(GLint location, GLint v0, GLint v1, GLint v2);
- void glUniform2i(GLint location, GLint v0, GLint v1);
- void glUniform1i(GLint location, GLint v0);
- void glUniform4f(GLint location, GLfloat v0, GLfloat v1, GLfloat v2, GLfloat v3);
- void glUniform3f(GLint location, GLfloat v0, GLfloat v1, GLfloat v2);
- void glUniform2f(GLint location, GLfloat v0, GLfloat v1);
- void glUniform1f(GLint location, GLfloat v0);
- void glUseProgram(GLuint program);
- void glShaderSource(GLuint shader, GLsizei count, const GLchar* const *string, const GLint *length);
- void glLinkProgram(GLuint program);
- GLboolean glIsShader(GLuint shader);
- GLboolean glIsProgram(GLuint program);
- void glGetVertexAttribPointerv(GLuint index, GLenum pname, GLvoid* *pointer);
- void glGetVertexAttribiv(GLuint index, GLenum pname, GLint *params);
- void glGetVertexAttribfv(GLuint index, GLenum pname, GLfloat *params);
- void glGetVertexAttribdv(GLuint index, GLenum pname, GLdouble *params);
- void glGetUniformiv(GLuint program, GLint location, GLint *params);
- void glGetUniformfv(GLuint program, GLint location, GLfloat *params);
- GLint glGetUniformLocation(GLuint program, const GLchar *name);
- void glGetShaderSource(GLuint shader, GLsizei bufSize, GLsizei *length, GLchar *source);
- void glGetShaderInfoLog(GLuint shader, GLsizei bufSize, GLsizei *length, GLchar *infoLog);
- void glGetShaderiv(GLuint shader, GLenum pname, GLint *params);
- void glGetProgramInfoLog(GLuint program, GLsizei bufSize, GLsizei *length, GLchar *infoLog);
- void glGetProgramiv(GLuint program, GLenum pname, GLint *params);
- GLint glGetAttribLocation(GLuint program, const GLchar *name);
- void glGetAttachedShaders(GLuint program, GLsizei maxCount, GLsizei *count, GLuint *obj);
- void glGetActiveUniform(GLuint program, GLuint index, GLsizei bufSize, GLsizei *length, GLint *size, GLenum *type, GLchar *name);
- void glGetActiveAttrib(GLuint program, GLuint index, GLsizei bufSize, GLsizei *length, GLint *size, GLenum *type, GLchar *name);
- void glEnableVertexAttribArray(GLuint index);
- void glDisableVertexAttribArray(GLuint index);
- void glDetachShader(GLuint program, GLuint shader);
- void glDeleteShader(GLuint shader);
- void glDeleteProgram(GLuint program);
- GLuint glCreateShader(GLenum type);
- GLuint glCreateProgram();
- void glCompileShader(GLuint shader);
- void glBindAttribLocation(GLuint program, GLuint index, const GLchar *name);
- void glAttachShader(GLuint program, GLuint shader);
- void glStencilMaskSeparate(GLenum face, GLuint mask);
- void glStencilFuncSeparate(GLenum face, GLenum func, GLint ref, GLuint mask);
- void glStencilOpSeparate(GLenum face, GLenum sfail, GLenum dpfail, GLenum dppass);
- void glDrawBuffers(GLsizei n, const GLenum *bufs);
- void glBlendEquationSeparate(GLenum modeRGB, GLenum modeAlpha);
-
- // OpenGL 2.1 core functions
- void glUniformMatrix4x3fv(GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
- void glUniformMatrix3x4fv(GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
- void glUniformMatrix4x2fv(GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
- void glUniformMatrix2x4fv(GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
- void glUniformMatrix3x2fv(GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
- void glUniformMatrix2x3fv(GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
-
- // OpenGL 3.0 core functions
- GLboolean glIsVertexArray(GLuint array);
- void glGenVertexArrays(GLsizei n, GLuint *arrays);
- void glDeleteVertexArrays(GLsizei n, const GLuint *arrays);
- void glBindVertexArray(GLuint array);
- void glFlushMappedBufferRange(GLenum target, GLintptr offset, GLsizeiptr length);
- GLvoid* glMapBufferRange(GLenum target, GLintptr offset, GLsizeiptr length, GLbitfield access);
- void glFramebufferTextureLayer(GLenum target, GLenum attachment, GLuint texture, GLint level, GLint layer);
- void glRenderbufferStorageMultisample(GLenum target, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height);
- void glBlitFramebuffer(GLint srcX0, GLint srcY0, GLint srcX1, GLint srcY1, GLint dstX0, GLint dstY0, GLint dstX1, GLint dstY1, GLbitfield mask, GLenum filter);
- void glGenerateMipmap(GLenum target);
- void glGetFramebufferAttachmentParameteriv(GLenum target, GLenum attachment, GLenum pname, GLint *params);
- void glFramebufferRenderbuffer(GLenum target, GLenum attachment, GLenum renderbuffertarget, GLuint renderbuffer);
- void glFramebufferTexture3D(GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level, GLint zoffset);
- void glFramebufferTexture2D(GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level);
- void glFramebufferTexture1D(GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level);
- GLenum glCheckFramebufferStatus(GLenum target);
- void glGenFramebuffers(GLsizei n, GLuint *framebuffers);
- void glDeleteFramebuffers(GLsizei n, const GLuint *framebuffers);
- void glBindFramebuffer(GLenum target, GLuint framebuffer);
- GLboolean glIsFramebuffer(GLuint framebuffer);
- void glGetRenderbufferParameteriv(GLenum target, GLenum pname, GLint *params);
- void glRenderbufferStorage(GLenum target, GLenum internalformat, GLsizei width, GLsizei height);
- void glGenRenderbuffers(GLsizei n, GLuint *renderbuffers);
- void glDeleteRenderbuffers(GLsizei n, const GLuint *renderbuffers);
- void glBindRenderbuffer(GLenum target, GLuint renderbuffer);
- GLboolean glIsRenderbuffer(GLuint renderbuffer);
- const GLubyte * glGetStringi(GLenum name, GLuint index);
- void glClearBufferfi(GLenum buffer, GLint drawbuffer, GLfloat depth, GLint stencil);
- void glClearBufferfv(GLenum buffer, GLint drawbuffer, const GLfloat *value);
- void glClearBufferuiv(GLenum buffer, GLint drawbuffer, const GLuint *value);
- void glClearBufferiv(GLenum buffer, GLint drawbuffer, const GLint *value);
- void glGetTexParameterIuiv(GLenum target, GLenum pname, GLuint *params);
- void glGetTexParameterIiv(GLenum target, GLenum pname, GLint *params);
- void glTexParameterIuiv(GLenum target, GLenum pname, const GLuint *params);
- void glTexParameterIiv(GLenum target, GLenum pname, const GLint *params);
- void glUniform4uiv(GLint location, GLsizei count, const GLuint *value);
- void glUniform3uiv(GLint location, GLsizei count, const GLuint *value);
- void glUniform2uiv(GLint location, GLsizei count, const GLuint *value);
- void glUniform1uiv(GLint location, GLsizei count, const GLuint *value);
- void glUniform4ui(GLint location, GLuint v0, GLuint v1, GLuint v2, GLuint v3);
- void glUniform3ui(GLint location, GLuint v0, GLuint v1, GLuint v2);
- void glUniform2ui(GLint location, GLuint v0, GLuint v1);
- void glUniform1ui(GLint location, GLuint v0);
- GLint glGetFragDataLocation(GLuint program, const GLchar *name);
- void glBindFragDataLocation(GLuint program, GLuint color, const GLchar *name);
- void glGetUniformuiv(GLuint program, GLint location, GLuint *params);
- void glGetVertexAttribIuiv(GLuint index, GLenum pname, GLuint *params);
- void glGetVertexAttribIiv(GLuint index, GLenum pname, GLint *params);
- void glVertexAttribIPointer(GLuint index, GLint size, GLenum type, GLsizei stride, const GLvoid *pointer);
- void glEndConditionalRender();
- void glBeginConditionalRender(GLuint id, GLenum mode);
- void glClampColor(GLenum target, GLenum clamp);
- void glGetTransformFeedbackVarying(GLuint program, GLuint index, GLsizei bufSize, GLsizei *length, GLsizei *size, GLenum *type, GLchar *name);
- void glTransformFeedbackVaryings(GLuint program, GLsizei count, const GLchar* const *varyings, GLenum bufferMode);
- void glBindBufferBase(GLenum target, GLuint index, GLuint buffer);
- void glBindBufferRange(GLenum target, GLuint index, GLuint buffer, GLintptr offset, GLsizeiptr size);
- void glEndTransformFeedback();
- void glBeginTransformFeedback(GLenum primitiveMode);
- GLboolean glIsEnabledi(GLenum target, GLuint index);
- void glDisablei(GLenum target, GLuint index);
- void glEnablei(GLenum target, GLuint index);
- void glGetIntegeri_v(GLenum target, GLuint index, GLint *data);
- void glGetBooleani_v(GLenum target, GLuint index, GLboolean *data);
- void glColorMaski(GLuint index, GLboolean r, GLboolean g, GLboolean b, GLboolean a);
-
- // OpenGL 3.1 core functions
- void glCopyBufferSubData(GLenum readTarget, GLenum writeTarget, GLintptr readOffset, GLintptr writeOffset, GLsizeiptr size);
- void glUniformBlockBinding(GLuint program, GLuint uniformBlockIndex, GLuint uniformBlockBinding);
- void glGetActiveUniformBlockName(GLuint program, GLuint uniformBlockIndex, GLsizei bufSize, GLsizei *length, GLchar *uniformBlockName);
- void glGetActiveUniformBlockiv(GLuint program, GLuint uniformBlockIndex, GLenum pname, GLint *params);
- GLuint glGetUniformBlockIndex(GLuint program, const GLchar *uniformBlockName);
- void glGetActiveUniformName(GLuint program, GLuint uniformIndex, GLsizei bufSize, GLsizei *length, GLchar *uniformName);
- void glGetActiveUniformsiv(GLuint program, GLsizei uniformCount, const GLuint *uniformIndices, GLenum pname, GLint *params);
- void glGetUniformIndices(GLuint program, GLsizei uniformCount, const GLchar* const *uniformNames, GLuint *uniformIndices);
- void glPrimitiveRestartIndex(GLuint index);
- void glTexBuffer(GLenum target, GLenum internalformat, GLuint buffer);
- void glDrawElementsInstanced(GLenum mode, GLsizei count, GLenum type, const GLvoid *indices, GLsizei instancecount);
- void glDrawArraysInstanced(GLenum mode, GLint first, GLsizei count, GLsizei instancecount);
-
- // OpenGL 3.2 core functions
- void glSampleMaski(GLuint index, GLbitfield mask);
- void glGetMultisamplefv(GLenum pname, GLuint index, GLfloat *val);
- void glTexImage3DMultisample(GLenum target, GLsizei samples, GLint internalformat, GLsizei width, GLsizei height, GLsizei depth, GLboolean fixedsamplelocations);
- void glTexImage2DMultisample(GLenum target, GLsizei samples, GLint internalformat, GLsizei width, GLsizei height, GLboolean fixedsamplelocations);
- void glGetSynciv(GLsync sync, GLenum pname, GLsizei bufSize, GLsizei *length, GLint *values);
- void glGetInteger64v(GLenum pname, GLint64 *params);
- void glWaitSync(GLsync sync, GLbitfield flags, GLuint64 timeout);
- GLenum glClientWaitSync(GLsync sync, GLbitfield flags, GLuint64 timeout);
- void glDeleteSync(GLsync sync);
- GLboolean glIsSync(GLsync sync);
- GLsync glFenceSync(GLenum condition, GLbitfield flags);
- void glProvokingVertex(GLenum mode);
- void glMultiDrawElementsBaseVertex(GLenum mode, const GLsizei *count, GLenum type, const GLvoid* const *indices, GLsizei drawcount, const GLint *basevertex);
- void glDrawElementsInstancedBaseVertex(GLenum mode, GLsizei count, GLenum type, const GLvoid *indices, GLsizei instancecount, GLint basevertex);
- void glDrawRangeElementsBaseVertex(GLenum mode, GLuint start, GLuint end, GLsizei count, GLenum type, const GLvoid *indices, GLint basevertex);
- void glDrawElementsBaseVertex(GLenum mode, GLsizei count, GLenum type, const GLvoid *indices, GLint basevertex);
- void glFramebufferTexture(GLenum target, GLenum attachment, GLuint texture, GLint level);
- void glGetBufferParameteri64v(GLenum target, GLenum pname, GLint64 *params);
- void glGetInteger64i_v(GLenum target, GLuint index, GLint64 *data);
-
- // OpenGL 3.3 core functions
- void glVertexAttribP4uiv(GLuint index, GLenum type, GLboolean normalized, const GLuint *value);
- void glVertexAttribP4ui(GLuint index, GLenum type, GLboolean normalized, GLuint value);
- void glVertexAttribP3uiv(GLuint index, GLenum type, GLboolean normalized, const GLuint *value);
- void glVertexAttribP3ui(GLuint index, GLenum type, GLboolean normalized, GLuint value);
- void glVertexAttribP2uiv(GLuint index, GLenum type, GLboolean normalized, const GLuint *value);
- void glVertexAttribP2ui(GLuint index, GLenum type, GLboolean normalized, GLuint value);
- void glVertexAttribP1uiv(GLuint index, GLenum type, GLboolean normalized, const GLuint *value);
- void glVertexAttribP1ui(GLuint index, GLenum type, GLboolean normalized, GLuint value);
- void glSecondaryColorP3uiv(GLenum type, const GLuint *color);
- void glSecondaryColorP3ui(GLenum type, GLuint color);
- void glColorP4uiv(GLenum type, const GLuint *color);
- void glColorP4ui(GLenum type, GLuint color);
- void glColorP3uiv(GLenum type, const GLuint *color);
- void glColorP3ui(GLenum type, GLuint color);
- void glNormalP3uiv(GLenum type, const GLuint *coords);
- void glNormalP3ui(GLenum type, GLuint coords);
- void glMultiTexCoordP4uiv(GLenum texture, GLenum type, const GLuint *coords);
- void glMultiTexCoordP4ui(GLenum texture, GLenum type, GLuint coords);
- void glMultiTexCoordP3uiv(GLenum texture, GLenum type, const GLuint *coords);
- void glMultiTexCoordP3ui(GLenum texture, GLenum type, GLuint coords);
- void glMultiTexCoordP2uiv(GLenum texture, GLenum type, const GLuint *coords);
- void glMultiTexCoordP2ui(GLenum texture, GLenum type, GLuint coords);
- void glMultiTexCoordP1uiv(GLenum texture, GLenum type, const GLuint *coords);
- void glMultiTexCoordP1ui(GLenum texture, GLenum type, GLuint coords);
- void glTexCoordP4uiv(GLenum type, const GLuint *coords);
- void glTexCoordP4ui(GLenum type, GLuint coords);
- void glTexCoordP3uiv(GLenum type, const GLuint *coords);
- void glTexCoordP3ui(GLenum type, GLuint coords);
- void glTexCoordP2uiv(GLenum type, const GLuint *coords);
- void glTexCoordP2ui(GLenum type, GLuint coords);
- void glTexCoordP1uiv(GLenum type, const GLuint *coords);
- void glTexCoordP1ui(GLenum type, GLuint coords);
- void glVertexP4uiv(GLenum type, const GLuint *value);
- void glVertexP4ui(GLenum type, GLuint value);
- void glVertexP3uiv(GLenum type, const GLuint *value);
- void glVertexP3ui(GLenum type, GLuint value);
- void glVertexP2uiv(GLenum type, const GLuint *value);
- void glVertexP2ui(GLenum type, GLuint value);
- void glGetQueryObjectui64v(GLuint id, GLenum pname, GLuint64 *params);
- void glGetQueryObjecti64v(GLuint id, GLenum pname, GLint64 *params);
- void glQueryCounter(GLuint id, GLenum target);
- void glGetSamplerParameterIuiv(GLuint sampler, GLenum pname, GLuint *params);
- void glGetSamplerParameterfv(GLuint sampler, GLenum pname, GLfloat *params);
- void glGetSamplerParameterIiv(GLuint sampler, GLenum pname, GLint *params);
- void glGetSamplerParameteriv(GLuint sampler, GLenum pname, GLint *params);
- void glSamplerParameterIuiv(GLuint sampler, GLenum pname, const GLuint *param);
- void glSamplerParameterIiv(GLuint sampler, GLenum pname, const GLint *param);
- void glSamplerParameterfv(GLuint sampler, GLenum pname, const GLfloat *param);
- void glSamplerParameterf(GLuint sampler, GLenum pname, GLfloat param);
- void glSamplerParameteriv(GLuint sampler, GLenum pname, const GLint *param);
- void glSamplerParameteri(GLuint sampler, GLenum pname, GLint param);
- void glBindSampler(GLuint unit, GLuint sampler);
- GLboolean glIsSampler(GLuint sampler);
- void glDeleteSamplers(GLsizei count, const GLuint *samplers);
- void glGenSamplers(GLsizei count, GLuint *samplers);
- GLint glGetFragDataIndex(GLuint program, const GLchar *name);
- void glBindFragDataLocationIndexed(GLuint program, GLuint colorNumber, GLuint index, const GLchar *name);
- void glVertexAttribDivisor(GLuint index, GLuint divisor);
-
- // OpenGL 4.0 core functions
- void glGetQueryIndexediv(GLenum target, GLuint index, GLenum pname, GLint *params);
- void glEndQueryIndexed(GLenum target, GLuint index);
- void glBeginQueryIndexed(GLenum target, GLuint index, GLuint id);
- void glDrawTransformFeedbackStream(GLenum mode, GLuint id, GLuint stream);
- void glDrawTransformFeedback(GLenum mode, GLuint id);
- void glResumeTransformFeedback();
- void glPauseTransformFeedback();
- GLboolean glIsTransformFeedback(GLuint id);
- void glGenTransformFeedbacks(GLsizei n, GLuint *ids);
- void glDeleteTransformFeedbacks(GLsizei n, const GLuint *ids);
- void glBindTransformFeedback(GLenum target, GLuint id);
- void glPatchParameterfv(GLenum pname, const GLfloat *values);
- void glPatchParameteri(GLenum pname, GLint value);
- void glGetProgramStageiv(GLuint program, GLenum shadertype, GLenum pname, GLint *values);
- void glGetUniformSubroutineuiv(GLenum shadertype, GLint location, GLuint *params);
- void glUniformSubroutinesuiv(GLenum shadertype, GLsizei count, const GLuint *indices);
- void glGetActiveSubroutineName(GLuint program, GLenum shadertype, GLuint index, GLsizei bufsize, GLsizei *length, GLchar *name);
- void glGetActiveSubroutineUniformName(GLuint program, GLenum shadertype, GLuint index, GLsizei bufsize, GLsizei *length, GLchar *name);
- void glGetActiveSubroutineUniformiv(GLuint program, GLenum shadertype, GLuint index, GLenum pname, GLint *values);
- GLuint glGetSubroutineIndex(GLuint program, GLenum shadertype, const GLchar *name);
- GLint glGetSubroutineUniformLocation(GLuint program, GLenum shadertype, const GLchar *name);
- void glGetUniformdv(GLuint program, GLint location, GLdouble *params);
- void glUniformMatrix4x3dv(GLint location, GLsizei count, GLboolean transpose, const GLdouble *value);
- void glUniformMatrix4x2dv(GLint location, GLsizei count, GLboolean transpose, const GLdouble *value);
- void glUniformMatrix3x4dv(GLint location, GLsizei count, GLboolean transpose, const GLdouble *value);
- void glUniformMatrix3x2dv(GLint location, GLsizei count, GLboolean transpose, const GLdouble *value);
- void glUniformMatrix2x4dv(GLint location, GLsizei count, GLboolean transpose, const GLdouble *value);
- void glUniformMatrix2x3dv(GLint location, GLsizei count, GLboolean transpose, const GLdouble *value);
- void glUniformMatrix4dv(GLint location, GLsizei count, GLboolean transpose, const GLdouble *value);
- void glUniformMatrix3dv(GLint location, GLsizei count, GLboolean transpose, const GLdouble *value);
- void glUniformMatrix2dv(GLint location, GLsizei count, GLboolean transpose, const GLdouble *value);
- void glUniform4dv(GLint location, GLsizei count, const GLdouble *value);
- void glUniform3dv(GLint location, GLsizei count, const GLdouble *value);
- void glUniform2dv(GLint location, GLsizei count, const GLdouble *value);
- void glUniform1dv(GLint location, GLsizei count, const GLdouble *value);
- void glUniform4d(GLint location, GLdouble x, GLdouble y, GLdouble z, GLdouble w);
- void glUniform3d(GLint location, GLdouble x, GLdouble y, GLdouble z);
- void glUniform2d(GLint location, GLdouble x, GLdouble y);
- void glUniform1d(GLint location, GLdouble x);
- void glDrawElementsIndirect(GLenum mode, GLenum type, const GLvoid *indirect);
- void glDrawArraysIndirect(GLenum mode, const GLvoid *indirect);
- void glBlendFuncSeparatei(GLuint buf, GLenum srcRGB, GLenum dstRGB, GLenum srcAlpha, GLenum dstAlpha);
- void glBlendFunci(GLuint buf, GLenum src, GLenum dst);
- void glBlendEquationSeparatei(GLuint buf, GLenum modeRGB, GLenum modeAlpha);
- void glBlendEquationi(GLuint buf, GLenum mode);
- void glMinSampleShading(GLfloat value);
-
- // OpenGL 4.1 core functions
- void glGetDoublei_v(GLenum target, GLuint index, GLdouble *data);
- void glGetFloati_v(GLenum target, GLuint index, GLfloat *data);
- void glDepthRangeIndexed(GLuint index, GLdouble n, GLdouble f);
- void glDepthRangeArrayv(GLuint first, GLsizei count, const GLdouble *v);
- void glScissorIndexedv(GLuint index, const GLint *v);
- void glScissorIndexed(GLuint index, GLint left, GLint bottom, GLsizei width, GLsizei height);
- void glScissorArrayv(GLuint first, GLsizei count, const GLint *v);
- void glViewportIndexedfv(GLuint index, const GLfloat *v);
- void glViewportIndexedf(GLuint index, GLfloat x, GLfloat y, GLfloat w, GLfloat h);
- void glViewportArrayv(GLuint first, GLsizei count, const GLfloat *v);
- void glGetVertexAttribLdv(GLuint index, GLenum pname, GLdouble *params);
- void glVertexAttribLPointer(GLuint index, GLint size, GLenum type, GLsizei stride, const GLvoid *pointer);
- void glVertexAttribL4dv(GLuint index, const GLdouble *v);
- void glVertexAttribL3dv(GLuint index, const GLdouble *v);
- void glVertexAttribL2dv(GLuint index, const GLdouble *v);
- void glVertexAttribL1dv(GLuint index, const GLdouble *v);
- void glVertexAttribL4d(GLuint index, GLdouble x, GLdouble y, GLdouble z, GLdouble w);
- void glVertexAttribL3d(GLuint index, GLdouble x, GLdouble y, GLdouble z);
- void glVertexAttribL2d(GLuint index, GLdouble x, GLdouble y);
- void glVertexAttribL1d(GLuint index, GLdouble x);
- void glGetProgramPipelineInfoLog(GLuint pipeline, GLsizei bufSize, GLsizei *length, GLchar *infoLog);
- void glValidateProgramPipeline(GLuint pipeline);
- void glProgramUniformMatrix4x3dv(GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLdouble *value);
- void glProgramUniformMatrix3x4dv(GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLdouble *value);
- void glProgramUniformMatrix4x2dv(GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLdouble *value);
- void glProgramUniformMatrix2x4dv(GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLdouble *value);
- void glProgramUniformMatrix3x2dv(GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLdouble *value);
- void glProgramUniformMatrix2x3dv(GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLdouble *value);
- void glProgramUniformMatrix4x3fv(GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
- void glProgramUniformMatrix3x4fv(GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
- void glProgramUniformMatrix4x2fv(GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
- void glProgramUniformMatrix2x4fv(GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
- void glProgramUniformMatrix3x2fv(GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
- void glProgramUniformMatrix2x3fv(GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
- void glProgramUniformMatrix4dv(GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLdouble *value);
- void glProgramUniformMatrix3dv(GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLdouble *value);
- void glProgramUniformMatrix2dv(GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLdouble *value);
- void glProgramUniformMatrix4fv(GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
- void glProgramUniformMatrix3fv(GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
- void glProgramUniformMatrix2fv(GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
- void glProgramUniform4uiv(GLuint program, GLint location, GLsizei count, const GLuint *value);
- void glProgramUniform4ui(GLuint program, GLint location, GLuint v0, GLuint v1, GLuint v2, GLuint v3);
- void glProgramUniform4dv(GLuint program, GLint location, GLsizei count, const GLdouble *value);
- void glProgramUniform4d(GLuint program, GLint location, GLdouble v0, GLdouble v1, GLdouble v2, GLdouble v3);
- void glProgramUniform4fv(GLuint program, GLint location, GLsizei count, const GLfloat *value);
- void glProgramUniform4f(GLuint program, GLint location, GLfloat v0, GLfloat v1, GLfloat v2, GLfloat v3);
- void glProgramUniform4iv(GLuint program, GLint location, GLsizei count, const GLint *value);
- void glProgramUniform4i(GLuint program, GLint location, GLint v0, GLint v1, GLint v2, GLint v3);
- void glProgramUniform3uiv(GLuint program, GLint location, GLsizei count, const GLuint *value);
- void glProgramUniform3ui(GLuint program, GLint location, GLuint v0, GLuint v1, GLuint v2);
- void glProgramUniform3dv(GLuint program, GLint location, GLsizei count, const GLdouble *value);
- void glProgramUniform3d(GLuint program, GLint location, GLdouble v0, GLdouble v1, GLdouble v2);
- void glProgramUniform3fv(GLuint program, GLint location, GLsizei count, const GLfloat *value);
- void glProgramUniform3f(GLuint program, GLint location, GLfloat v0, GLfloat v1, GLfloat v2);
- void glProgramUniform3iv(GLuint program, GLint location, GLsizei count, const GLint *value);
- void glProgramUniform3i(GLuint program, GLint location, GLint v0, GLint v1, GLint v2);
- void glProgramUniform2uiv(GLuint program, GLint location, GLsizei count, const GLuint *value);
- void glProgramUniform2ui(GLuint program, GLint location, GLuint v0, GLuint v1);
- void glProgramUniform2dv(GLuint program, GLint location, GLsizei count, const GLdouble *value);
- void glProgramUniform2d(GLuint program, GLint location, GLdouble v0, GLdouble v1);
- void glProgramUniform2fv(GLuint program, GLint location, GLsizei count, const GLfloat *value);
- void glProgramUniform2f(GLuint program, GLint location, GLfloat v0, GLfloat v1);
- void glProgramUniform2iv(GLuint program, GLint location, GLsizei count, const GLint *value);
- void glProgramUniform2i(GLuint program, GLint location, GLint v0, GLint v1);
- void glProgramUniform1uiv(GLuint program, GLint location, GLsizei count, const GLuint *value);
- void glProgramUniform1ui(GLuint program, GLint location, GLuint v0);
- void glProgramUniform1dv(GLuint program, GLint location, GLsizei count, const GLdouble *value);
- void glProgramUniform1d(GLuint program, GLint location, GLdouble v0);
- void glProgramUniform1fv(GLuint program, GLint location, GLsizei count, const GLfloat *value);
- void glProgramUniform1f(GLuint program, GLint location, GLfloat v0);
- void glProgramUniform1iv(GLuint program, GLint location, GLsizei count, const GLint *value);
- void glProgramUniform1i(GLuint program, GLint location, GLint v0);
- void glGetProgramPipelineiv(GLuint pipeline, GLenum pname, GLint *params);
- GLboolean glIsProgramPipeline(GLuint pipeline);
- void glGenProgramPipelines(GLsizei n, GLuint *pipelines);
- void glDeleteProgramPipelines(GLsizei n, const GLuint *pipelines);
- void glBindProgramPipeline(GLuint pipeline);
- GLuint glCreateShaderProgramv(GLenum type, GLsizei count, const GLchar* const *strings);
- void glActiveShaderProgram(GLuint pipeline, GLuint program);
- void glUseProgramStages(GLuint pipeline, GLbitfield stages, GLuint program);
- void glProgramParameteri(GLuint program, GLenum pname, GLint value);
- void glProgramBinary(GLuint program, GLenum binaryFormat, const GLvoid *binary, GLsizei length);
- void glGetProgramBinary(GLuint program, GLsizei bufSize, GLsizei *length, GLenum *binaryFormat, GLvoid *binary);
- void glClearDepthf(GLfloat dd);
- void glDepthRangef(GLfloat n, GLfloat f);
- void glGetShaderPrecisionFormat(GLenum shadertype, GLenum precisiontype, GLint *range, GLint *precision);
- void glShaderBinary(GLsizei count, const GLuint *shaders, GLenum binaryformat, const GLvoid *binary, GLsizei length);
- void glReleaseShaderCompiler();
-
- // OpenGL 4.2 core functions
- void glTexStorage3D(GLenum target, GLsizei levels, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth);
- void glTexStorage2D(GLenum target, GLsizei levels, GLenum internalformat, GLsizei width, GLsizei height);
- void glTexStorage1D(GLenum target, GLsizei levels, GLenum internalformat, GLsizei width);
- void glMemoryBarrier(GLbitfield barriers);
- void glBindImageTexture(GLuint unit, GLuint texture, GLint level, GLboolean layered, GLint layer, GLenum access, GLenum format);
- void glGetActiveAtomicCounterBufferiv(GLuint program, GLuint bufferIndex, GLenum pname, GLint *params);
- void glGetInternalformativ(GLenum target, GLenum internalformat, GLenum pname, GLsizei bufSize, GLint *params);
- void glDrawTransformFeedbackStreamInstanced(GLenum mode, GLuint id, GLuint stream, GLsizei instancecount);
- void glDrawTransformFeedbackInstanced(GLenum mode, GLuint id, GLsizei instancecount);
- void glDrawElementsInstancedBaseVertexBaseInstance(GLenum mode, GLsizei count, GLenum type, const void *indices, GLsizei instancecount, GLint basevertex, GLuint baseinstance);
- void glDrawElementsInstancedBaseInstance(GLenum mode, GLsizei count, GLenum type, const void *indices, GLsizei instancecount, GLuint baseinstance);
- void glDrawArraysInstancedBaseInstance(GLenum mode, GLint first, GLsizei count, GLsizei instancecount, GLuint baseinstance);
-
- // OpenGL 4.3 core functions
- void glTexStorage3DMultisample(GLenum target, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth, GLboolean fixedsamplelocations);
- void glTexStorage2DMultisample(GLenum target, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height, GLboolean fixedsamplelocations);
- void glTexBufferRange(GLenum target, GLenum internalformat, GLuint buffer, GLintptr offset, GLsizeiptr size);
- void glShaderStorageBlockBinding(GLuint program, GLuint storageBlockIndex, GLuint storageBlockBinding);
- GLint glGetProgramResourceLocationIndex(GLuint program, GLenum programInterface, const GLchar *name);
- GLint glGetProgramResourceLocation(GLuint program, GLenum programInterface, const GLchar *name);
- void glGetProgramResourceiv(GLuint program, GLenum programInterface, GLuint index, GLsizei propCount, const GLenum *props, GLsizei bufSize, GLsizei *length, GLint *params);
- void glGetProgramResourceName(GLuint program, GLenum programInterface, GLuint index, GLsizei bufSize, GLsizei *length, GLchar *name);
- GLuint glGetProgramResourceIndex(GLuint program, GLenum programInterface, const GLchar *name);
- void glGetProgramInterfaceiv(GLuint program, GLenum programInterface, GLenum pname, GLint *params);
- void glMultiDrawElementsIndirect(GLenum mode, GLenum type, const void *indirect, GLsizei drawcount, GLsizei stride);
- void glMultiDrawArraysIndirect(GLenum mode, const void *indirect, GLsizei drawcount, GLsizei stride);
- void glInvalidateSubFramebuffer(GLenum target, GLsizei numAttachments, const GLenum *attachments, GLint x, GLint y, GLsizei width, GLsizei height);
- void glInvalidateFramebuffer(GLenum target, GLsizei numAttachments, const GLenum *attachments);
- void glInvalidateBufferData(GLuint buffer);
- void glInvalidateBufferSubData(GLuint buffer, GLintptr offset, GLsizeiptr length);
- void glInvalidateTexImage(GLuint texture, GLint level);
- void glInvalidateTexSubImage(GLuint texture, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth);
- void glGetInternalformati64v(GLenum target, GLenum internalformat, GLenum pname, GLsizei bufSize, GLint64 *params);
- void glGetFramebufferParameteriv(GLenum target, GLenum pname, GLint *params);
- void glFramebufferParameteri(GLenum target, GLenum pname, GLint param);
- void glVertexBindingDivisor(GLuint bindingindex, GLuint divisor);
- void glVertexAttribBinding(GLuint attribindex, GLuint bindingindex);
- void glVertexAttribLFormat(GLuint attribindex, GLint size, GLenum type, GLuint relativeoffset);
- void glVertexAttribIFormat(GLuint attribindex, GLint size, GLenum type, GLuint relativeoffset);
- void glVertexAttribFormat(GLuint attribindex, GLint size, GLenum type, GLboolean normalized, GLuint relativeoffset);
- void glBindVertexBuffer(GLuint bindingindex, GLuint buffer, GLintptr offset, GLsizei stride);
- void glTextureView(GLuint texture, GLenum target, GLuint origtexture, GLenum internalformat, GLuint minlevel, GLuint numlevels, GLuint minlayer, GLuint numlayers);
- void glCopyImageSubData(GLuint srcName, GLenum srcTarget, GLint srcLevel, GLint srcX, GLint srcY, GLint srcZ, GLuint dstName, GLenum dstTarget, GLint dstLevel, GLint dstX, GLint dstY, GLint dstZ, GLsizei srcWidth, GLsizei srcHeight, GLsizei srcDepth);
- void glDispatchComputeIndirect(GLintptr indirect);
- void glDispatchCompute(GLuint num_groups_x, GLuint num_groups_y, GLuint num_groups_z);
- void glClearBufferSubData(GLenum target, GLenum internalformat, GLintptr offset, GLsizeiptr size, GLenum format, GLenum type, const void *data);
- void glClearBufferData(GLenum target, GLenum internalformat, GLenum format, GLenum type, const void *data);
-
-private:
- friend class QOpenGLContext;
-
- static bool isContextCompatible(QOpenGLContext *context);
- static QOpenGLVersionProfile versionProfile();
-
- QOpenGLFunctions_1_0_CoreBackend* d_1_0_Core;
- QOpenGLFunctions_1_1_CoreBackend* d_1_1_Core;
- QOpenGLFunctions_1_2_CoreBackend* d_1_2_Core;
- QOpenGLFunctions_1_3_CoreBackend* d_1_3_Core;
- QOpenGLFunctions_1_4_CoreBackend* d_1_4_Core;
- QOpenGLFunctions_1_5_CoreBackend* d_1_5_Core;
- QOpenGLFunctions_2_0_CoreBackend* d_2_0_Core;
- QOpenGLFunctions_2_1_CoreBackend* d_2_1_Core;
- QOpenGLFunctions_3_0_CoreBackend* d_3_0_Core;
- QOpenGLFunctions_3_1_CoreBackend* d_3_1_Core;
- QOpenGLFunctions_3_2_CoreBackend* d_3_2_Core;
- QOpenGLFunctions_3_3_CoreBackend* d_3_3_Core;
- QOpenGLFunctions_4_0_CoreBackend* d_4_0_Core;
- QOpenGLFunctions_4_1_CoreBackend* d_4_1_Core;
- QOpenGLFunctions_4_2_CoreBackend* d_4_2_Core;
- QOpenGLFunctions_4_3_CoreBackend* d_4_3_Core;
-};
-
-// OpenGL 1.0 core functions
-inline void QOpenGLFunctions_4_3_Core::glViewport(GLint x, GLint y, GLsizei width, GLsizei height)
-{
- d_1_0_Core->f.Viewport(x, y, width, height);
-}
-
-inline void QOpenGLFunctions_4_3_Core::glDepthRange(GLdouble nearVal, GLdouble farVal)
-{
- d_1_0_Core->f.DepthRange(nearVal, farVal);
-}
-
-inline GLboolean QOpenGLFunctions_4_3_Core::glIsEnabled(GLenum cap)
-{
- return d_1_0_Core->f.IsEnabled(cap);
-}
-
-inline void QOpenGLFunctions_4_3_Core::glGetTexLevelParameteriv(GLenum target, GLint level, GLenum pname, GLint *params)
-{
- d_1_0_Core->f.GetTexLevelParameteriv(target, level, pname, params);
-}
-
-inline void QOpenGLFunctions_4_3_Core::glGetTexLevelParameterfv(GLenum target, GLint level, GLenum pname, GLfloat *params)
-{
- d_1_0_Core->f.GetTexLevelParameterfv(target, level, pname, params);
-}
-
-inline void QOpenGLFunctions_4_3_Core::glGetTexParameteriv(GLenum target, GLenum pname, GLint *params)
-{
- d_1_0_Core->f.GetTexParameteriv(target, pname, params);
-}
-
-inline void QOpenGLFunctions_4_3_Core::glGetTexParameterfv(GLenum target, GLenum pname, GLfloat *params)
-{
- d_1_0_Core->f.GetTexParameterfv(target, pname, params);
-}
-
-inline void QOpenGLFunctions_4_3_Core::glGetTexImage(GLenum target, GLint level, GLenum format, GLenum type, GLvoid *pixels)
-{
- d_1_0_Core->f.GetTexImage(target, level, format, type, pixels);
-}
-
-inline const GLubyte * QOpenGLFunctions_4_3_Core::glGetString(GLenum name)
-{
- return d_1_0_Core->f.GetString(name);
-}
-
-inline void QOpenGLFunctions_4_3_Core::glGetIntegerv(GLenum pname, GLint *params)
-{
- d_1_0_Core->f.GetIntegerv(pname, params);
-}
-
-inline void QOpenGLFunctions_4_3_Core::glGetFloatv(GLenum pname, GLfloat *params)
-{
- d_1_0_Core->f.GetFloatv(pname, params);
-}
-
-inline GLenum QOpenGLFunctions_4_3_Core::glGetError()
-{
- return d_1_0_Core->f.GetError();
-}
-
-inline void QOpenGLFunctions_4_3_Core::glGetDoublev(GLenum pname, GLdouble *params)
-{
- d_1_0_Core->f.GetDoublev(pname, params);
-}
-
-inline void QOpenGLFunctions_4_3_Core::glGetBooleanv(GLenum pname, GLboolean *params)
-{
- d_1_0_Core->f.GetBooleanv(pname, params);
-}
-
-inline void QOpenGLFunctions_4_3_Core::glReadPixels(GLint x, GLint y, GLsizei width, GLsizei height, GLenum format, GLenum type, GLvoid *pixels)
-{
- d_1_0_Core->f.ReadPixels(x, y, width, height, format, type, pixels);
-}
-
-inline void QOpenGLFunctions_4_3_Core::glReadBuffer(GLenum mode)
-{
- d_1_0_Core->f.ReadBuffer(mode);
-}
-
-inline void QOpenGLFunctions_4_3_Core::glPixelStorei(GLenum pname, GLint param)
-{
- d_1_0_Core->f.PixelStorei(pname, param);
-}
-
-inline void QOpenGLFunctions_4_3_Core::glPixelStoref(GLenum pname, GLfloat param)
-{
- d_1_0_Core->f.PixelStoref(pname, param);
-}
-
-inline void QOpenGLFunctions_4_3_Core::glDepthFunc(GLenum func)
-{
- d_1_0_Core->f.DepthFunc(func);
-}
-
-inline void QOpenGLFunctions_4_3_Core::glStencilOp(GLenum fail, GLenum zfail, GLenum zpass)
-{
- d_1_0_Core->f.StencilOp(fail, zfail, zpass);
-}
-
-inline void QOpenGLFunctions_4_3_Core::glStencilFunc(GLenum func, GLint ref, GLuint mask)
-{
- d_1_0_Core->f.StencilFunc(func, ref, mask);
-}
-
-inline void QOpenGLFunctions_4_3_Core::glLogicOp(GLenum opcode)
-{
- d_1_0_Core->f.LogicOp(opcode);
-}
-
-inline void QOpenGLFunctions_4_3_Core::glBlendFunc(GLenum sfactor, GLenum dfactor)
-{
- d_1_0_Core->f.BlendFunc(sfactor, dfactor);
-}
-
-inline void QOpenGLFunctions_4_3_Core::glFlush()
-{
- d_1_0_Core->f.Flush();
-}
-
-inline void QOpenGLFunctions_4_3_Core::glFinish()
-{
- d_1_0_Core->f.Finish();
-}
-
-inline void QOpenGLFunctions_4_3_Core::glEnable(GLenum cap)
-{
- d_1_0_Core->f.Enable(cap);
-}
-
-inline void QOpenGLFunctions_4_3_Core::glDisable(GLenum cap)
-{
- d_1_0_Core->f.Disable(cap);
-}
-
-inline void QOpenGLFunctions_4_3_Core::glDepthMask(GLboolean flag)
-{
- d_1_0_Core->f.DepthMask(flag);
-}
-
-inline void QOpenGLFunctions_4_3_Core::glColorMask(GLboolean red, GLboolean green, GLboolean blue, GLboolean alpha)
-{
- d_1_0_Core->f.ColorMask(red, green, blue, alpha);
-}
-
-inline void QOpenGLFunctions_4_3_Core::glStencilMask(GLuint mask)
-{
- d_1_0_Core->f.StencilMask(mask);
-}
-
-inline void QOpenGLFunctions_4_3_Core::glClearDepth(GLdouble depth)
-{
- d_1_0_Core->f.ClearDepth(depth);
-}
-
-inline void QOpenGLFunctions_4_3_Core::glClearStencil(GLint s)
-{
- d_1_0_Core->f.ClearStencil(s);
-}
-
-inline void QOpenGLFunctions_4_3_Core::glClearColor(GLfloat red, GLfloat green, GLfloat blue, GLfloat alpha)
-{
- d_1_0_Core->f.ClearColor(red, green, blue, alpha);
-}
-
-inline void QOpenGLFunctions_4_3_Core::glClear(GLbitfield mask)
-{
- d_1_0_Core->f.Clear(mask);
-}
-
-inline void QOpenGLFunctions_4_3_Core::glDrawBuffer(GLenum mode)
-{
- d_1_0_Core->f.DrawBuffer(mode);
-}
-
-inline void QOpenGLFunctions_4_3_Core::glTexImage2D(GLenum target, GLint level, GLint internalformat, GLsizei width, GLsizei height, GLint border, GLenum format, GLenum type, const GLvoid *pixels)
-{
- d_1_0_Core->f.TexImage2D(target, level, internalformat, width, height, border, format, type, pixels);
-}
-
-inline void QOpenGLFunctions_4_3_Core::glTexImage1D(GLenum target, GLint level, GLint internalformat, GLsizei width, GLint border, GLenum format, GLenum type, const GLvoid *pixels)
-{
- d_1_0_Core->f.TexImage1D(target, level, internalformat, width, border, format, type, pixels);
-}
-
-inline void QOpenGLFunctions_4_3_Core::glTexParameteriv(GLenum target, GLenum pname, const GLint *params)
-{
- d_1_0_Core->f.TexParameteriv(target, pname, params);
-}
-
-inline void QOpenGLFunctions_4_3_Core::glTexParameteri(GLenum target, GLenum pname, GLint param)
-{
- d_1_0_Core->f.TexParameteri(target, pname, param);
-}
-
-inline void QOpenGLFunctions_4_3_Core::glTexParameterfv(GLenum target, GLenum pname, const GLfloat *params)
-{
- d_1_0_Core->f.TexParameterfv(target, pname, params);
-}
-
-inline void QOpenGLFunctions_4_3_Core::glTexParameterf(GLenum target, GLenum pname, GLfloat param)
-{
- d_1_0_Core->f.TexParameterf(target, pname, param);
-}
-
-inline void QOpenGLFunctions_4_3_Core::glScissor(GLint x, GLint y, GLsizei width, GLsizei height)
-{
- d_1_0_Core->f.Scissor(x, y, width, height);
-}
-
-inline void QOpenGLFunctions_4_3_Core::glPolygonMode(GLenum face, GLenum mode)
-{
- d_1_0_Core->f.PolygonMode(face, mode);
-}
-
-inline void QOpenGLFunctions_4_3_Core::glPointSize(GLfloat size)
-{
- d_1_0_Core->f.PointSize(size);
-}
-
-inline void QOpenGLFunctions_4_3_Core::glLineWidth(GLfloat width)
-{
- d_1_0_Core->f.LineWidth(width);
-}
-
-inline void QOpenGLFunctions_4_3_Core::glHint(GLenum target, GLenum mode)
-{
- d_1_0_Core->f.Hint(target, mode);
-}
-
-inline void QOpenGLFunctions_4_3_Core::glFrontFace(GLenum mode)
-{
- d_1_0_Core->f.FrontFace(mode);
-}
-
-inline void QOpenGLFunctions_4_3_Core::glCullFace(GLenum mode)
-{
- d_1_0_Core->f.CullFace(mode);
-}
-
-
-// OpenGL 1.1 core functions
-inline void QOpenGLFunctions_4_3_Core::glIndexubv(const GLubyte *c)
-{
- Q_UNUSED(c);
- QOPENGL_DEPRECATEDFUNCTION;
-}
-
-inline void QOpenGLFunctions_4_3_Core::glIndexub(GLubyte c)
-{
- Q_UNUSED(c);
- QOPENGL_DEPRECATEDFUNCTION;
-}
-
-inline GLboolean QOpenGLFunctions_4_3_Core::glIsTexture(GLuint texture)
-{
- return d_1_1_Core->f.IsTexture(texture);
-}
-
-inline void QOpenGLFunctions_4_3_Core::glGenTextures(GLsizei n, GLuint *textures)
-{
- d_1_1_Core->f.GenTextures(n, textures);
-}
-
-inline void QOpenGLFunctions_4_3_Core::glDeleteTextures(GLsizei n, const GLuint *textures)
-{
- d_1_1_Core->f.DeleteTextures(n, textures);
-}
-
-inline void QOpenGLFunctions_4_3_Core::glBindTexture(GLenum target, GLuint texture)
-{
- d_1_1_Core->f.BindTexture(target, texture);
-}
-
-inline void QOpenGLFunctions_4_3_Core::glTexSubImage2D(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLenum type, const GLvoid *pixels)
-{
- d_1_1_Core->f.TexSubImage2D(target, level, xoffset, yoffset, width, height, format, type, pixels);
-}
-
-inline void QOpenGLFunctions_4_3_Core::glTexSubImage1D(GLenum target, GLint level, GLint xoffset, GLsizei width, GLenum format, GLenum type, const GLvoid *pixels)
-{
- d_1_1_Core->f.TexSubImage1D(target, level, xoffset, width, format, type, pixels);
-}
-
-inline void QOpenGLFunctions_4_3_Core::glCopyTexSubImage2D(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint x, GLint y, GLsizei width, GLsizei height)
-{
- d_1_1_Core->f.CopyTexSubImage2D(target, level, xoffset, yoffset, x, y, width, height);
-}
-
-inline void QOpenGLFunctions_4_3_Core::glCopyTexSubImage1D(GLenum target, GLint level, GLint xoffset, GLint x, GLint y, GLsizei width)
-{
- d_1_1_Core->f.CopyTexSubImage1D(target, level, xoffset, x, y, width);
-}
-
-inline void QOpenGLFunctions_4_3_Core::glCopyTexImage2D(GLenum target, GLint level, GLenum internalformat, GLint x, GLint y, GLsizei width, GLsizei height, GLint border)
-{
- d_1_1_Core->f.CopyTexImage2D(target, level, internalformat, x, y, width, height, border);
-}
-
-inline void QOpenGLFunctions_4_3_Core::glCopyTexImage1D(GLenum target, GLint level, GLenum internalformat, GLint x, GLint y, GLsizei width, GLint border)
-{
- d_1_1_Core->f.CopyTexImage1D(target, level, internalformat, x, y, width, border);
-}
-
-inline void QOpenGLFunctions_4_3_Core::glPolygonOffset(GLfloat factor, GLfloat units)
-{
- d_1_1_Core->f.PolygonOffset(factor, units);
-}
-
-inline void QOpenGLFunctions_4_3_Core::glGetPointerv(GLenum pname, GLvoid* *params)
-{
- Q_UNUSED(pname);
- Q_UNUSED(params);
- QOPENGL_DEPRECATEDFUNCTION;
-}
-
-inline void QOpenGLFunctions_4_3_Core::glDrawElements(GLenum mode, GLsizei count, GLenum type, const GLvoid *indices)
-{
- d_1_1_Core->f.DrawElements(mode, count, type, indices);
-}
-
-inline void QOpenGLFunctions_4_3_Core::glDrawArrays(GLenum mode, GLint first, GLsizei count)
-{
- d_1_1_Core->f.DrawArrays(mode, first, count);
-}
-
-
-// OpenGL 1.2 core functions
-inline void QOpenGLFunctions_4_3_Core::glCopyTexSubImage3D(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLint x, GLint y, GLsizei width, GLsizei height)
-{
- d_1_2_Core->f.CopyTexSubImage3D(target, level, xoffset, yoffset, zoffset, x, y, width, height);
-}
-
-inline void QOpenGLFunctions_4_3_Core::glTexSubImage3D(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLenum type, const GLvoid *pixels)
-{
- d_1_2_Core->f.TexSubImage3D(target, level, xoffset, yoffset, zoffset, width, height, depth, format, type, pixels);
-}
-
-inline void QOpenGLFunctions_4_3_Core::glTexImage3D(GLenum target, GLint level, GLint internalformat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLenum format, GLenum type, const GLvoid *pixels)
-{
- d_1_2_Core->f.TexImage3D(target, level, internalformat, width, height, depth, border, format, type, pixels);
-}
-
-inline void QOpenGLFunctions_4_3_Core::glDrawRangeElements(GLenum mode, GLuint start, GLuint end, GLsizei count, GLenum type, const GLvoid *indices)
-{
- d_1_2_Core->f.DrawRangeElements(mode, start, end, count, type, indices);
-}
-
-inline void QOpenGLFunctions_4_3_Core::glBlendEquation(GLenum mode)
-{
- d_1_2_Core->f.BlendEquation(mode);
-}
-
-inline void QOpenGLFunctions_4_3_Core::glBlendColor(GLfloat red, GLfloat green, GLfloat blue, GLfloat alpha)
-{
- d_1_2_Core->f.BlendColor(red, green, blue, alpha);
-}
-
-
-// OpenGL 1.3 core functions
-inline void QOpenGLFunctions_4_3_Core::glGetCompressedTexImage(GLenum target, GLint level, GLvoid *img)
-{
- d_1_3_Core->f.GetCompressedTexImage(target, level, img);
-}
-
-inline void QOpenGLFunctions_4_3_Core::glCompressedTexSubImage1D(GLenum target, GLint level, GLint xoffset, GLsizei width, GLenum format, GLsizei imageSize, const GLvoid *data)
-{
- d_1_3_Core->f.CompressedTexSubImage1D(target, level, xoffset, width, format, imageSize, data);
-}
-
-inline void QOpenGLFunctions_4_3_Core::glCompressedTexSubImage2D(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLsizei imageSize, const GLvoid *data)
-{
- d_1_3_Core->f.CompressedTexSubImage2D(target, level, xoffset, yoffset, width, height, format, imageSize, data);
-}
-
-inline void QOpenGLFunctions_4_3_Core::glCompressedTexSubImage3D(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLsizei imageSize, const GLvoid *data)
-{
- d_1_3_Core->f.CompressedTexSubImage3D(target, level, xoffset, yoffset, zoffset, width, height, depth, format, imageSize, data);
-}
-
-inline void QOpenGLFunctions_4_3_Core::glCompressedTexImage1D(GLenum target, GLint level, GLenum internalformat, GLsizei width, GLint border, GLsizei imageSize, const GLvoid *data)
-{
- d_1_3_Core->f.CompressedTexImage1D(target, level, internalformat, width, border, imageSize, data);
-}
-
-inline void QOpenGLFunctions_4_3_Core::glCompressedTexImage2D(GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLint border, GLsizei imageSize, const GLvoid *data)
-{
- d_1_3_Core->f.CompressedTexImage2D(target, level, internalformat, width, height, border, imageSize, data);
-}
-
-inline void QOpenGLFunctions_4_3_Core::glCompressedTexImage3D(GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLsizei imageSize, const GLvoid *data)
-{
- d_1_3_Core->f.CompressedTexImage3D(target, level, internalformat, width, height, depth, border, imageSize, data);
-}
-
-inline void QOpenGLFunctions_4_3_Core::glSampleCoverage(GLfloat value, GLboolean invert)
-{
- d_1_3_Core->f.SampleCoverage(value, invert);
-}
-
-inline void QOpenGLFunctions_4_3_Core::glActiveTexture(GLenum texture)
-{
- d_1_3_Core->f.ActiveTexture(texture);
-}
-
-
-// OpenGL 1.4 core functions
-inline void QOpenGLFunctions_4_3_Core::glPointParameteriv(GLenum pname, const GLint *params)
-{
- d_1_4_Core->f.PointParameteriv(pname, params);
-}
-
-inline void QOpenGLFunctions_4_3_Core::glPointParameteri(GLenum pname, GLint param)
-{
- d_1_4_Core->f.PointParameteri(pname, param);
-}
-
-inline void QOpenGLFunctions_4_3_Core::glPointParameterfv(GLenum pname, const GLfloat *params)
-{
- d_1_4_Core->f.PointParameterfv(pname, params);
-}
-
-inline void QOpenGLFunctions_4_3_Core::glPointParameterf(GLenum pname, GLfloat param)
-{
- d_1_4_Core->f.PointParameterf(pname, param);
-}
-
-inline void QOpenGLFunctions_4_3_Core::glMultiDrawElements(GLenum mode, const GLsizei *count, GLenum type, const GLvoid* const *indices, GLsizei drawcount)
-{
- d_1_4_Core->f.MultiDrawElements(mode, count, type, indices, drawcount);
-}
-
-inline void QOpenGLFunctions_4_3_Core::glMultiDrawArrays(GLenum mode, const GLint *first, const GLsizei *count, GLsizei drawcount)
-{
- d_1_4_Core->f.MultiDrawArrays(mode, first, count, drawcount);
-}
-
-inline void QOpenGLFunctions_4_3_Core::glBlendFuncSeparate(GLenum sfactorRGB, GLenum dfactorRGB, GLenum sfactorAlpha, GLenum dfactorAlpha)
-{
- d_1_4_Core->f.BlendFuncSeparate(sfactorRGB, dfactorRGB, sfactorAlpha, dfactorAlpha);
-}
-
-
-// OpenGL 1.5 core functions
-inline void QOpenGLFunctions_4_3_Core::glGetBufferPointerv(GLenum target, GLenum pname, GLvoid* *params)
-{
- d_1_5_Core->f.GetBufferPointerv(target, pname, params);
-}
-
-inline void QOpenGLFunctions_4_3_Core::glGetBufferParameteriv(GLenum target, GLenum pname, GLint *params)
-{
- d_1_5_Core->f.GetBufferParameteriv(target, pname, params);
-}
-
-inline GLboolean QOpenGLFunctions_4_3_Core::glUnmapBuffer(GLenum target)
-{
- return d_1_5_Core->f.UnmapBuffer(target);
-}
-
-inline GLvoid* QOpenGLFunctions_4_3_Core::glMapBuffer(GLenum target, GLenum access)
-{
- return d_1_5_Core->f.MapBuffer(target, access);
-}
-
-inline void QOpenGLFunctions_4_3_Core::glGetBufferSubData(GLenum target, GLintptr offset, GLsizeiptr size, GLvoid *data)
-{
- d_1_5_Core->f.GetBufferSubData(target, offset, size, data);
-}
-
-inline void QOpenGLFunctions_4_3_Core::glBufferSubData(GLenum target, GLintptr offset, GLsizeiptr size, const GLvoid *data)
-{
- d_1_5_Core->f.BufferSubData(target, offset, size, data);
-}
-
-inline void QOpenGLFunctions_4_3_Core::glBufferData(GLenum target, GLsizeiptr size, const GLvoid *data, GLenum usage)
-{
- d_1_5_Core->f.BufferData(target, size, data, usage);
-}
-
-inline GLboolean QOpenGLFunctions_4_3_Core::glIsBuffer(GLuint buffer)
-{
- return d_1_5_Core->f.IsBuffer(buffer);
-}
-
-inline void QOpenGLFunctions_4_3_Core::glGenBuffers(GLsizei n, GLuint *buffers)
-{
- d_1_5_Core->f.GenBuffers(n, buffers);
-}
-
-inline void QOpenGLFunctions_4_3_Core::glDeleteBuffers(GLsizei n, const GLuint *buffers)
-{
- d_1_5_Core->f.DeleteBuffers(n, buffers);
-}
-
-inline void QOpenGLFunctions_4_3_Core::glBindBuffer(GLenum target, GLuint buffer)
-{
- d_1_5_Core->f.BindBuffer(target, buffer);
-}
-
-inline void QOpenGLFunctions_4_3_Core::glGetQueryObjectuiv(GLuint id, GLenum pname, GLuint *params)
-{
- d_1_5_Core->f.GetQueryObjectuiv(id, pname, params);
-}
-
-inline void QOpenGLFunctions_4_3_Core::glGetQueryObjectiv(GLuint id, GLenum pname, GLint *params)
-{
- d_1_5_Core->f.GetQueryObjectiv(id, pname, params);
-}
-
-inline void QOpenGLFunctions_4_3_Core::glGetQueryiv(GLenum target, GLenum pname, GLint *params)
-{
- d_1_5_Core->f.GetQueryiv(target, pname, params);
-}
-
-inline void QOpenGLFunctions_4_3_Core::glEndQuery(GLenum target)
-{
- d_1_5_Core->f.EndQuery(target);
-}
-
-inline void QOpenGLFunctions_4_3_Core::glBeginQuery(GLenum target, GLuint id)
-{
- d_1_5_Core->f.BeginQuery(target, id);
-}
-
-inline GLboolean QOpenGLFunctions_4_3_Core::glIsQuery(GLuint id)
-{
- return d_1_5_Core->f.IsQuery(id);
-}
-
-inline void QOpenGLFunctions_4_3_Core::glDeleteQueries(GLsizei n, const GLuint *ids)
-{
- d_1_5_Core->f.DeleteQueries(n, ids);
-}
-
-inline void QOpenGLFunctions_4_3_Core::glGenQueries(GLsizei n, GLuint *ids)
-{
- d_1_5_Core->f.GenQueries(n, ids);
-}
-
-
-// OpenGL 2.0 core functions
-inline void QOpenGLFunctions_4_3_Core::glVertexAttribPointer(GLuint index, GLint size, GLenum type, GLboolean normalized, GLsizei stride, const GLvoid *pointer)
-{
- d_2_0_Core->f.VertexAttribPointer(index, size, type, normalized, stride, pointer);
-}
-
-inline void QOpenGLFunctions_4_3_Core::glValidateProgram(GLuint program)
-{
- d_2_0_Core->f.ValidateProgram(program);
-}
-
-inline void QOpenGLFunctions_4_3_Core::glUniformMatrix4fv(GLint location, GLsizei count, GLboolean transpose, const GLfloat *value)
-{
- d_2_0_Core->f.UniformMatrix4fv(location, count, transpose, value);
-}
-
-inline void QOpenGLFunctions_4_3_Core::glUniformMatrix3fv(GLint location, GLsizei count, GLboolean transpose, const GLfloat *value)
-{
- d_2_0_Core->f.UniformMatrix3fv(location, count, transpose, value);
-}
-
-inline void QOpenGLFunctions_4_3_Core::glUniformMatrix2fv(GLint location, GLsizei count, GLboolean transpose, const GLfloat *value)
-{
- d_2_0_Core->f.UniformMatrix2fv(location, count, transpose, value);
-}
-
-inline void QOpenGLFunctions_4_3_Core::glUniform4iv(GLint location, GLsizei count, const GLint *value)
-{
- d_2_0_Core->f.Uniform4iv(location, count, value);
-}
-
-inline void QOpenGLFunctions_4_3_Core::glUniform3iv(GLint location, GLsizei count, const GLint *value)
-{
- d_2_0_Core->f.Uniform3iv(location, count, value);
-}
-
-inline void QOpenGLFunctions_4_3_Core::glUniform2iv(GLint location, GLsizei count, const GLint *value)
-{
- d_2_0_Core->f.Uniform2iv(location, count, value);
-}
-
-inline void QOpenGLFunctions_4_3_Core::glUniform1iv(GLint location, GLsizei count, const GLint *value)
-{
- d_2_0_Core->f.Uniform1iv(location, count, value);
-}
-
-inline void QOpenGLFunctions_4_3_Core::glUniform4fv(GLint location, GLsizei count, const GLfloat *value)
-{
- d_2_0_Core->f.Uniform4fv(location, count, value);
-}
-
-inline void QOpenGLFunctions_4_3_Core::glUniform3fv(GLint location, GLsizei count, const GLfloat *value)
-{
- d_2_0_Core->f.Uniform3fv(location, count, value);
-}
-
-inline void QOpenGLFunctions_4_3_Core::glUniform2fv(GLint location, GLsizei count, const GLfloat *value)
-{
- d_2_0_Core->f.Uniform2fv(location, count, value);
-}
-
-inline void QOpenGLFunctions_4_3_Core::glUniform1fv(GLint location, GLsizei count, const GLfloat *value)
-{
- d_2_0_Core->f.Uniform1fv(location, count, value);
-}
-
-inline void QOpenGLFunctions_4_3_Core::glUniform4i(GLint location, GLint v0, GLint v1, GLint v2, GLint v3)
-{
- d_2_0_Core->f.Uniform4i(location, v0, v1, v2, v3);
-}
-
-inline void QOpenGLFunctions_4_3_Core::glUniform3i(GLint location, GLint v0, GLint v1, GLint v2)
-{
- d_2_0_Core->f.Uniform3i(location, v0, v1, v2);
-}
-
-inline void QOpenGLFunctions_4_3_Core::glUniform2i(GLint location, GLint v0, GLint v1)
-{
- d_2_0_Core->f.Uniform2i(location, v0, v1);
-}
-
-inline void QOpenGLFunctions_4_3_Core::glUniform1i(GLint location, GLint v0)
-{
- d_2_0_Core->f.Uniform1i(location, v0);
-}
-
-inline void QOpenGLFunctions_4_3_Core::glUniform4f(GLint location, GLfloat v0, GLfloat v1, GLfloat v2, GLfloat v3)
-{
- d_2_0_Core->f.Uniform4f(location, v0, v1, v2, v3);
-}
-
-inline void QOpenGLFunctions_4_3_Core::glUniform3f(GLint location, GLfloat v0, GLfloat v1, GLfloat v2)
-{
- d_2_0_Core->f.Uniform3f(location, v0, v1, v2);
-}
-
-inline void QOpenGLFunctions_4_3_Core::glUniform2f(GLint location, GLfloat v0, GLfloat v1)
-{
- d_2_0_Core->f.Uniform2f(location, v0, v1);
-}
-
-inline void QOpenGLFunctions_4_3_Core::glUniform1f(GLint location, GLfloat v0)
-{
- d_2_0_Core->f.Uniform1f(location, v0);
-}
-
-inline void QOpenGLFunctions_4_3_Core::glUseProgram(GLuint program)
-{
- d_2_0_Core->f.UseProgram(program);
-}
-
-inline void QOpenGLFunctions_4_3_Core::glShaderSource(GLuint shader, GLsizei count, const GLchar* const *string, const GLint *length)
-{
- d_2_0_Core->f.ShaderSource(shader, count, string, length);
-}
-
-inline void QOpenGLFunctions_4_3_Core::glLinkProgram(GLuint program)
-{
- d_2_0_Core->f.LinkProgram(program);
-}
-
-inline GLboolean QOpenGLFunctions_4_3_Core::glIsShader(GLuint shader)
-{
- return d_2_0_Core->f.IsShader(shader);
-}
-
-inline GLboolean QOpenGLFunctions_4_3_Core::glIsProgram(GLuint program)
-{
- return d_2_0_Core->f.IsProgram(program);
-}
-
-inline void QOpenGLFunctions_4_3_Core::glGetVertexAttribPointerv(GLuint index, GLenum pname, GLvoid* *pointer)
-{
- d_2_0_Core->f.GetVertexAttribPointerv(index, pname, pointer);
-}
-
-inline void QOpenGLFunctions_4_3_Core::glGetVertexAttribiv(GLuint index, GLenum pname, GLint *params)
-{
- d_2_0_Core->f.GetVertexAttribiv(index, pname, params);
-}
-
-inline void QOpenGLFunctions_4_3_Core::glGetVertexAttribfv(GLuint index, GLenum pname, GLfloat *params)
-{
- d_2_0_Core->f.GetVertexAttribfv(index, pname, params);
-}
-
-inline void QOpenGLFunctions_4_3_Core::glGetVertexAttribdv(GLuint index, GLenum pname, GLdouble *params)
-{
- d_2_0_Core->f.GetVertexAttribdv(index, pname, params);
-}
-
-inline void QOpenGLFunctions_4_3_Core::glGetUniformiv(GLuint program, GLint location, GLint *params)
-{
- d_2_0_Core->f.GetUniformiv(program, location, params);
-}
-
-inline void QOpenGLFunctions_4_3_Core::glGetUniformfv(GLuint program, GLint location, GLfloat *params)
-{
- d_2_0_Core->f.GetUniformfv(program, location, params);
-}
-
-inline GLint QOpenGLFunctions_4_3_Core::glGetUniformLocation(GLuint program, const GLchar *name)
-{
- return d_2_0_Core->f.GetUniformLocation(program, name);
-}
-
-inline void QOpenGLFunctions_4_3_Core::glGetShaderSource(GLuint shader, GLsizei bufSize, GLsizei *length, GLchar *source)
-{
- d_2_0_Core->f.GetShaderSource(shader, bufSize, length, source);
-}
-
-inline void QOpenGLFunctions_4_3_Core::glGetShaderInfoLog(GLuint shader, GLsizei bufSize, GLsizei *length, GLchar *infoLog)
-{
- d_2_0_Core->f.GetShaderInfoLog(shader, bufSize, length, infoLog);
-}
-
-inline void QOpenGLFunctions_4_3_Core::glGetShaderiv(GLuint shader, GLenum pname, GLint *params)
-{
- d_2_0_Core->f.GetShaderiv(shader, pname, params);
-}
-
-inline void QOpenGLFunctions_4_3_Core::glGetProgramInfoLog(GLuint program, GLsizei bufSize, GLsizei *length, GLchar *infoLog)
-{
- d_2_0_Core->f.GetProgramInfoLog(program, bufSize, length, infoLog);
-}
-
-inline void QOpenGLFunctions_4_3_Core::glGetProgramiv(GLuint program, GLenum pname, GLint *params)
-{
- d_2_0_Core->f.GetProgramiv(program, pname, params);
-}
-
-inline GLint QOpenGLFunctions_4_3_Core::glGetAttribLocation(GLuint program, const GLchar *name)
-{
- return d_2_0_Core->f.GetAttribLocation(program, name);
-}
-
-inline void QOpenGLFunctions_4_3_Core::glGetAttachedShaders(GLuint program, GLsizei maxCount, GLsizei *count, GLuint *obj)
-{
- d_2_0_Core->f.GetAttachedShaders(program, maxCount, count, obj);
-}
-
-inline void QOpenGLFunctions_4_3_Core::glGetActiveUniform(GLuint program, GLuint index, GLsizei bufSize, GLsizei *length, GLint *size, GLenum *type, GLchar *name)
-{
- d_2_0_Core->f.GetActiveUniform(program, index, bufSize, length, size, type, name);
-}
-
-inline void QOpenGLFunctions_4_3_Core::glGetActiveAttrib(GLuint program, GLuint index, GLsizei bufSize, GLsizei *length, GLint *size, GLenum *type, GLchar *name)
-{
- d_2_0_Core->f.GetActiveAttrib(program, index, bufSize, length, size, type, name);
-}
-
-inline void QOpenGLFunctions_4_3_Core::glEnableVertexAttribArray(GLuint index)
-{
- d_2_0_Core->f.EnableVertexAttribArray(index);
-}
-
-inline void QOpenGLFunctions_4_3_Core::glDisableVertexAttribArray(GLuint index)
-{
- d_2_0_Core->f.DisableVertexAttribArray(index);
-}
-
-inline void QOpenGLFunctions_4_3_Core::glDetachShader(GLuint program, GLuint shader)
-{
- d_2_0_Core->f.DetachShader(program, shader);
-}
-
-inline void QOpenGLFunctions_4_3_Core::glDeleteShader(GLuint shader)
-{
- d_2_0_Core->f.DeleteShader(shader);
-}
-
-inline void QOpenGLFunctions_4_3_Core::glDeleteProgram(GLuint program)
-{
- d_2_0_Core->f.DeleteProgram(program);
-}
-
-inline GLuint QOpenGLFunctions_4_3_Core::glCreateShader(GLenum type)
-{
- return d_2_0_Core->f.CreateShader(type);
-}
-
-inline GLuint QOpenGLFunctions_4_3_Core::glCreateProgram()
-{
- return d_2_0_Core->f.CreateProgram();
-}
-
-inline void QOpenGLFunctions_4_3_Core::glCompileShader(GLuint shader)
-{
- d_2_0_Core->f.CompileShader(shader);
-}
-
-inline void QOpenGLFunctions_4_3_Core::glBindAttribLocation(GLuint program, GLuint index, const GLchar *name)
-{
- d_2_0_Core->f.BindAttribLocation(program, index, name);
-}
-
-inline void QOpenGLFunctions_4_3_Core::glAttachShader(GLuint program, GLuint shader)
-{
- d_2_0_Core->f.AttachShader(program, shader);
-}
-
-inline void QOpenGLFunctions_4_3_Core::glStencilMaskSeparate(GLenum face, GLuint mask)
-{
- d_2_0_Core->f.StencilMaskSeparate(face, mask);
-}
-
-inline void QOpenGLFunctions_4_3_Core::glStencilFuncSeparate(GLenum face, GLenum func, GLint ref, GLuint mask)
-{
- d_2_0_Core->f.StencilFuncSeparate(face, func, ref, mask);
-}
-
-inline void QOpenGLFunctions_4_3_Core::glStencilOpSeparate(GLenum face, GLenum sfail, GLenum dpfail, GLenum dppass)
-{
- d_2_0_Core->f.StencilOpSeparate(face, sfail, dpfail, dppass);
-}
-
-inline void QOpenGLFunctions_4_3_Core::glDrawBuffers(GLsizei n, const GLenum *bufs)
-{
- d_2_0_Core->f.DrawBuffers(n, bufs);
-}
-
-inline void QOpenGLFunctions_4_3_Core::glBlendEquationSeparate(GLenum modeRGB, GLenum modeAlpha)
-{
- d_2_0_Core->f.BlendEquationSeparate(modeRGB, modeAlpha);
-}
-
-
-// OpenGL 2.1 core functions
-inline void QOpenGLFunctions_4_3_Core::glUniformMatrix4x3fv(GLint location, GLsizei count, GLboolean transpose, const GLfloat *value)
-{
- d_2_1_Core->f.UniformMatrix4x3fv(location, count, transpose, value);
-}
-
-inline void QOpenGLFunctions_4_3_Core::glUniformMatrix3x4fv(GLint location, GLsizei count, GLboolean transpose, const GLfloat *value)
-{
- d_2_1_Core->f.UniformMatrix3x4fv(location, count, transpose, value);
-}
-
-inline void QOpenGLFunctions_4_3_Core::glUniformMatrix4x2fv(GLint location, GLsizei count, GLboolean transpose, const GLfloat *value)
-{
- d_2_1_Core->f.UniformMatrix4x2fv(location, count, transpose, value);
-}
-
-inline void QOpenGLFunctions_4_3_Core::glUniformMatrix2x4fv(GLint location, GLsizei count, GLboolean transpose, const GLfloat *value)
-{
- d_2_1_Core->f.UniformMatrix2x4fv(location, count, transpose, value);
-}
-
-inline void QOpenGLFunctions_4_3_Core::glUniformMatrix3x2fv(GLint location, GLsizei count, GLboolean transpose, const GLfloat *value)
-{
- d_2_1_Core->f.UniformMatrix3x2fv(location, count, transpose, value);
-}
-
-inline void QOpenGLFunctions_4_3_Core::glUniformMatrix2x3fv(GLint location, GLsizei count, GLboolean transpose, const GLfloat *value)
-{
- d_2_1_Core->f.UniformMatrix2x3fv(location, count, transpose, value);
-}
-
-
-// OpenGL 3.0 core functions
-inline GLboolean QOpenGLFunctions_4_3_Core::glIsVertexArray(GLuint array)
-{
- return d_3_0_Core->f.IsVertexArray(array);
-}
-
-inline void QOpenGLFunctions_4_3_Core::glGenVertexArrays(GLsizei n, GLuint *arrays)
-{
- d_3_0_Core->f.GenVertexArrays(n, arrays);
-}
-
-inline void QOpenGLFunctions_4_3_Core::glDeleteVertexArrays(GLsizei n, const GLuint *arrays)
-{
- d_3_0_Core->f.DeleteVertexArrays(n, arrays);
-}
-
-inline void QOpenGLFunctions_4_3_Core::glBindVertexArray(GLuint array)
-{
- d_3_0_Core->f.BindVertexArray(array);
-}
-
-inline void QOpenGLFunctions_4_3_Core::glFlushMappedBufferRange(GLenum target, GLintptr offset, GLsizeiptr length)
-{
- d_3_0_Core->f.FlushMappedBufferRange(target, offset, length);
-}
-
-inline GLvoid* QOpenGLFunctions_4_3_Core::glMapBufferRange(GLenum target, GLintptr offset, GLsizeiptr length, GLbitfield access)
-{
- return d_3_0_Core->f.MapBufferRange(target, offset, length, access);
-}
-
-inline void QOpenGLFunctions_4_3_Core::glFramebufferTextureLayer(GLenum target, GLenum attachment, GLuint texture, GLint level, GLint layer)
-{
- d_3_0_Core->f.FramebufferTextureLayer(target, attachment, texture, level, layer);
-}
-
-inline void QOpenGLFunctions_4_3_Core::glRenderbufferStorageMultisample(GLenum target, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height)
-{
- d_3_0_Core->f.RenderbufferStorageMultisample(target, samples, internalformat, width, height);
-}
-
-inline void QOpenGLFunctions_4_3_Core::glBlitFramebuffer(GLint srcX0, GLint srcY0, GLint srcX1, GLint srcY1, GLint dstX0, GLint dstY0, GLint dstX1, GLint dstY1, GLbitfield mask, GLenum filter)
-{
- d_3_0_Core->f.BlitFramebuffer(srcX0, srcY0, srcX1, srcY1, dstX0, dstY0, dstX1, dstY1, mask, filter);
-}
-
-inline void QOpenGLFunctions_4_3_Core::glGenerateMipmap(GLenum target)
-{
- d_3_0_Core->f.GenerateMipmap(target);
-}
-
-inline void QOpenGLFunctions_4_3_Core::glGetFramebufferAttachmentParameteriv(GLenum target, GLenum attachment, GLenum pname, GLint *params)
-{
- d_3_0_Core->f.GetFramebufferAttachmentParameteriv(target, attachment, pname, params);
-}
-
-inline void QOpenGLFunctions_4_3_Core::glFramebufferRenderbuffer(GLenum target, GLenum attachment, GLenum renderbuffertarget, GLuint renderbuffer)
-{
- d_3_0_Core->f.FramebufferRenderbuffer(target, attachment, renderbuffertarget, renderbuffer);
-}
-
-inline void QOpenGLFunctions_4_3_Core::glFramebufferTexture3D(GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level, GLint zoffset)
-{
- d_3_0_Core->f.FramebufferTexture3D(target, attachment, textarget, texture, level, zoffset);
-}
-
-inline void QOpenGLFunctions_4_3_Core::glFramebufferTexture2D(GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level)
-{
- d_3_0_Core->f.FramebufferTexture2D(target, attachment, textarget, texture, level);
-}
-
-inline void QOpenGLFunctions_4_3_Core::glFramebufferTexture1D(GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level)
-{
- d_3_0_Core->f.FramebufferTexture1D(target, attachment, textarget, texture, level);
-}
-
-inline GLenum QOpenGLFunctions_4_3_Core::glCheckFramebufferStatus(GLenum target)
-{
- return d_3_0_Core->f.CheckFramebufferStatus(target);
-}
-
-inline void QOpenGLFunctions_4_3_Core::glGenFramebuffers(GLsizei n, GLuint *framebuffers)
-{
- d_3_0_Core->f.GenFramebuffers(n, framebuffers);
-}
-
-inline void QOpenGLFunctions_4_3_Core::glDeleteFramebuffers(GLsizei n, const GLuint *framebuffers)
-{
- d_3_0_Core->f.DeleteFramebuffers(n, framebuffers);
-}
-
-inline void QOpenGLFunctions_4_3_Core::glBindFramebuffer(GLenum target, GLuint framebuffer)
-{
- d_3_0_Core->f.BindFramebuffer(target, framebuffer);
-}
-
-inline GLboolean QOpenGLFunctions_4_3_Core::glIsFramebuffer(GLuint framebuffer)
-{
- return d_3_0_Core->f.IsFramebuffer(framebuffer);
-}
-
-inline void QOpenGLFunctions_4_3_Core::glGetRenderbufferParameteriv(GLenum target, GLenum pname, GLint *params)
-{
- d_3_0_Core->f.GetRenderbufferParameteriv(target, pname, params);
-}
-
-inline void QOpenGLFunctions_4_3_Core::glRenderbufferStorage(GLenum target, GLenum internalformat, GLsizei width, GLsizei height)
-{
- d_3_0_Core->f.RenderbufferStorage(target, internalformat, width, height);
-}
-
-inline void QOpenGLFunctions_4_3_Core::glGenRenderbuffers(GLsizei n, GLuint *renderbuffers)
-{
- d_3_0_Core->f.GenRenderbuffers(n, renderbuffers);
-}
-
-inline void QOpenGLFunctions_4_3_Core::glDeleteRenderbuffers(GLsizei n, const GLuint *renderbuffers)
-{
- d_3_0_Core->f.DeleteRenderbuffers(n, renderbuffers);
-}
-
-inline void QOpenGLFunctions_4_3_Core::glBindRenderbuffer(GLenum target, GLuint renderbuffer)
-{
- d_3_0_Core->f.BindRenderbuffer(target, renderbuffer);
-}
-
-inline GLboolean QOpenGLFunctions_4_3_Core::glIsRenderbuffer(GLuint renderbuffer)
-{
- return d_3_0_Core->f.IsRenderbuffer(renderbuffer);
-}
-
-inline const GLubyte * QOpenGLFunctions_4_3_Core::glGetStringi(GLenum name, GLuint index)
-{
- return d_3_0_Core->f.GetStringi(name, index);
-}
-
-inline void QOpenGLFunctions_4_3_Core::glClearBufferfi(GLenum buffer, GLint drawbuffer, GLfloat depth, GLint stencil)
-{
- d_3_0_Core->f.ClearBufferfi(buffer, drawbuffer, depth, stencil);
-}
-
-inline void QOpenGLFunctions_4_3_Core::glClearBufferfv(GLenum buffer, GLint drawbuffer, const GLfloat *value)
-{
- d_3_0_Core->f.ClearBufferfv(buffer, drawbuffer, value);
-}
-
-inline void QOpenGLFunctions_4_3_Core::glClearBufferuiv(GLenum buffer, GLint drawbuffer, const GLuint *value)
-{
- d_3_0_Core->f.ClearBufferuiv(buffer, drawbuffer, value);
-}
-
-inline void QOpenGLFunctions_4_3_Core::glClearBufferiv(GLenum buffer, GLint drawbuffer, const GLint *value)
-{
- d_3_0_Core->f.ClearBufferiv(buffer, drawbuffer, value);
-}
-
-inline void QOpenGLFunctions_4_3_Core::glGetTexParameterIuiv(GLenum target, GLenum pname, GLuint *params)
-{
- d_3_0_Core->f.GetTexParameterIuiv(target, pname, params);
-}
-
-inline void QOpenGLFunctions_4_3_Core::glGetTexParameterIiv(GLenum target, GLenum pname, GLint *params)
-{
- d_3_0_Core->f.GetTexParameterIiv(target, pname, params);
-}
-
-inline void QOpenGLFunctions_4_3_Core::glTexParameterIuiv(GLenum target, GLenum pname, const GLuint *params)
-{
- d_3_0_Core->f.TexParameterIuiv(target, pname, params);
-}
-
-inline void QOpenGLFunctions_4_3_Core::glTexParameterIiv(GLenum target, GLenum pname, const GLint *params)
-{
- d_3_0_Core->f.TexParameterIiv(target, pname, params);
-}
-
-inline void QOpenGLFunctions_4_3_Core::glUniform4uiv(GLint location, GLsizei count, const GLuint *value)
-{
- d_3_0_Core->f.Uniform4uiv(location, count, value);
-}
-
-inline void QOpenGLFunctions_4_3_Core::glUniform3uiv(GLint location, GLsizei count, const GLuint *value)
-{
- d_3_0_Core->f.Uniform3uiv(location, count, value);
-}
-
-inline void QOpenGLFunctions_4_3_Core::glUniform2uiv(GLint location, GLsizei count, const GLuint *value)
-{
- d_3_0_Core->f.Uniform2uiv(location, count, value);
-}
-
-inline void QOpenGLFunctions_4_3_Core::glUniform1uiv(GLint location, GLsizei count, const GLuint *value)
-{
- d_3_0_Core->f.Uniform1uiv(location, count, value);
-}
-
-inline void QOpenGLFunctions_4_3_Core::glUniform4ui(GLint location, GLuint v0, GLuint v1, GLuint v2, GLuint v3)
-{
- d_3_0_Core->f.Uniform4ui(location, v0, v1, v2, v3);
-}
-
-inline void QOpenGLFunctions_4_3_Core::glUniform3ui(GLint location, GLuint v0, GLuint v1, GLuint v2)
-{
- d_3_0_Core->f.Uniform3ui(location, v0, v1, v2);
-}
-
-inline void QOpenGLFunctions_4_3_Core::glUniform2ui(GLint location, GLuint v0, GLuint v1)
-{
- d_3_0_Core->f.Uniform2ui(location, v0, v1);
-}
-
-inline void QOpenGLFunctions_4_3_Core::glUniform1ui(GLint location, GLuint v0)
-{
- d_3_0_Core->f.Uniform1ui(location, v0);
-}
-
-inline GLint QOpenGLFunctions_4_3_Core::glGetFragDataLocation(GLuint program, const GLchar *name)
-{
- return d_3_0_Core->f.GetFragDataLocation(program, name);
-}
-
-inline void QOpenGLFunctions_4_3_Core::glBindFragDataLocation(GLuint program, GLuint color, const GLchar *name)
-{
- d_3_0_Core->f.BindFragDataLocation(program, color, name);
-}
-
-inline void QOpenGLFunctions_4_3_Core::glGetUniformuiv(GLuint program, GLint location, GLuint *params)
-{
- d_3_0_Core->f.GetUniformuiv(program, location, params);
-}
-
-inline void QOpenGLFunctions_4_3_Core::glGetVertexAttribIuiv(GLuint index, GLenum pname, GLuint *params)
-{
- d_3_0_Core->f.GetVertexAttribIuiv(index, pname, params);
-}
-
-inline void QOpenGLFunctions_4_3_Core::glGetVertexAttribIiv(GLuint index, GLenum pname, GLint *params)
-{
- d_3_0_Core->f.GetVertexAttribIiv(index, pname, params);
-}
-
-inline void QOpenGLFunctions_4_3_Core::glVertexAttribIPointer(GLuint index, GLint size, GLenum type, GLsizei stride, const GLvoid *pointer)
-{
- d_3_0_Core->f.VertexAttribIPointer(index, size, type, stride, pointer);
-}
-
-inline void QOpenGLFunctions_4_3_Core::glEndConditionalRender()
-{
- d_3_0_Core->f.EndConditionalRender();
-}
-
-inline void QOpenGLFunctions_4_3_Core::glBeginConditionalRender(GLuint id, GLenum mode)
-{
- d_3_0_Core->f.BeginConditionalRender(id, mode);
-}
-
-inline void QOpenGLFunctions_4_3_Core::glClampColor(GLenum target, GLenum clamp)
-{
- d_3_0_Core->f.ClampColor(target, clamp);
-}
-
-inline void QOpenGLFunctions_4_3_Core::glGetTransformFeedbackVarying(GLuint program, GLuint index, GLsizei bufSize, GLsizei *length, GLsizei *size, GLenum *type, GLchar *name)
-{
- d_3_0_Core->f.GetTransformFeedbackVarying(program, index, bufSize, length, size, type, name);
-}
-
-inline void QOpenGLFunctions_4_3_Core::glTransformFeedbackVaryings(GLuint program, GLsizei count, const GLchar* const *varyings, GLenum bufferMode)
-{
- d_3_0_Core->f.TransformFeedbackVaryings(program, count, varyings, bufferMode);
-}
-
-inline void QOpenGLFunctions_4_3_Core::glBindBufferBase(GLenum target, GLuint index, GLuint buffer)
-{
- d_3_0_Core->f.BindBufferBase(target, index, buffer);
-}
-
-inline void QOpenGLFunctions_4_3_Core::glBindBufferRange(GLenum target, GLuint index, GLuint buffer, GLintptr offset, GLsizeiptr size)
-{
- d_3_0_Core->f.BindBufferRange(target, index, buffer, offset, size);
-}
-
-inline void QOpenGLFunctions_4_3_Core::glEndTransformFeedback()
-{
- d_3_0_Core->f.EndTransformFeedback();
-}
-
-inline void QOpenGLFunctions_4_3_Core::glBeginTransformFeedback(GLenum primitiveMode)
-{
- d_3_0_Core->f.BeginTransformFeedback(primitiveMode);
-}
-
-inline GLboolean QOpenGLFunctions_4_3_Core::glIsEnabledi(GLenum target, GLuint index)
-{
- return d_3_0_Core->f.IsEnabledi(target, index);
-}
-
-inline void QOpenGLFunctions_4_3_Core::glDisablei(GLenum target, GLuint index)
-{
- d_3_0_Core->f.Disablei(target, index);
-}
-
-inline void QOpenGLFunctions_4_3_Core::glEnablei(GLenum target, GLuint index)
-{
- d_3_0_Core->f.Enablei(target, index);
-}
-
-inline void QOpenGLFunctions_4_3_Core::glGetIntegeri_v(GLenum target, GLuint index, GLint *data)
-{
- d_3_0_Core->f.GetIntegeri_v(target, index, data);
-}
-
-inline void QOpenGLFunctions_4_3_Core::glGetBooleani_v(GLenum target, GLuint index, GLboolean *data)
-{
- d_3_0_Core->f.GetBooleani_v(target, index, data);
-}
-
-inline void QOpenGLFunctions_4_3_Core::glColorMaski(GLuint index, GLboolean r, GLboolean g, GLboolean b, GLboolean a)
-{
- d_3_0_Core->f.ColorMaski(index, r, g, b, a);
-}
-
-
-// OpenGL 3.1 core functions
-inline void QOpenGLFunctions_4_3_Core::glCopyBufferSubData(GLenum readTarget, GLenum writeTarget, GLintptr readOffset, GLintptr writeOffset, GLsizeiptr size)
-{
- d_3_1_Core->f.CopyBufferSubData(readTarget, writeTarget, readOffset, writeOffset, size);
-}
-
-inline void QOpenGLFunctions_4_3_Core::glUniformBlockBinding(GLuint program, GLuint uniformBlockIndex, GLuint uniformBlockBinding)
-{
- d_3_1_Core->f.UniformBlockBinding(program, uniformBlockIndex, uniformBlockBinding);
-}
-
-inline void QOpenGLFunctions_4_3_Core::glGetActiveUniformBlockName(GLuint program, GLuint uniformBlockIndex, GLsizei bufSize, GLsizei *length, GLchar *uniformBlockName)
-{
- d_3_1_Core->f.GetActiveUniformBlockName(program, uniformBlockIndex, bufSize, length, uniformBlockName);
-}
-
-inline void QOpenGLFunctions_4_3_Core::glGetActiveUniformBlockiv(GLuint program, GLuint uniformBlockIndex, GLenum pname, GLint *params)
-{
- d_3_1_Core->f.GetActiveUniformBlockiv(program, uniformBlockIndex, pname, params);
-}
-
-inline GLuint QOpenGLFunctions_4_3_Core::glGetUniformBlockIndex(GLuint program, const GLchar *uniformBlockName)
-{
- return d_3_1_Core->f.GetUniformBlockIndex(program, uniformBlockName);
-}
-
-inline void QOpenGLFunctions_4_3_Core::glGetActiveUniformName(GLuint program, GLuint uniformIndex, GLsizei bufSize, GLsizei *length, GLchar *uniformName)
-{
- d_3_1_Core->f.GetActiveUniformName(program, uniformIndex, bufSize, length, uniformName);
-}
-
-inline void QOpenGLFunctions_4_3_Core::glGetActiveUniformsiv(GLuint program, GLsizei uniformCount, const GLuint *uniformIndices, GLenum pname, GLint *params)
-{
- d_3_1_Core->f.GetActiveUniformsiv(program, uniformCount, uniformIndices, pname, params);
-}
-
-inline void QOpenGLFunctions_4_3_Core::glGetUniformIndices(GLuint program, GLsizei uniformCount, const GLchar* const *uniformNames, GLuint *uniformIndices)
-{
- d_3_1_Core->f.GetUniformIndices(program, uniformCount, uniformNames, uniformIndices);
-}
-
-inline void QOpenGLFunctions_4_3_Core::glPrimitiveRestartIndex(GLuint index)
-{
- d_3_1_Core->f.PrimitiveRestartIndex(index);
-}
-
-inline void QOpenGLFunctions_4_3_Core::glTexBuffer(GLenum target, GLenum internalformat, GLuint buffer)
-{
- d_3_1_Core->f.TexBuffer(target, internalformat, buffer);
-}
-
-inline void QOpenGLFunctions_4_3_Core::glDrawElementsInstanced(GLenum mode, GLsizei count, GLenum type, const GLvoid *indices, GLsizei instancecount)
-{
- d_3_1_Core->f.DrawElementsInstanced(mode, count, type, indices, instancecount);
-}
-
-inline void QOpenGLFunctions_4_3_Core::glDrawArraysInstanced(GLenum mode, GLint first, GLsizei count, GLsizei instancecount)
-{
- d_3_1_Core->f.DrawArraysInstanced(mode, first, count, instancecount);
-}
-
-
-// OpenGL 3.2 core functions
-inline void QOpenGLFunctions_4_3_Core::glSampleMaski(GLuint index, GLbitfield mask)
-{
- d_3_2_Core->f.SampleMaski(index, mask);
-}
-
-inline void QOpenGLFunctions_4_3_Core::glGetMultisamplefv(GLenum pname, GLuint index, GLfloat *val)
-{
- d_3_2_Core->f.GetMultisamplefv(pname, index, val);
-}
-
-inline void QOpenGLFunctions_4_3_Core::glTexImage3DMultisample(GLenum target, GLsizei samples, GLint internalformat, GLsizei width, GLsizei height, GLsizei depth, GLboolean fixedsamplelocations)
-{
- d_3_2_Core->f.TexImage3DMultisample(target, samples, internalformat, width, height, depth, fixedsamplelocations);
-}
-
-inline void QOpenGLFunctions_4_3_Core::glTexImage2DMultisample(GLenum target, GLsizei samples, GLint internalformat, GLsizei width, GLsizei height, GLboolean fixedsamplelocations)
-{
- d_3_2_Core->f.TexImage2DMultisample(target, samples, internalformat, width, height, fixedsamplelocations);
-}
-
-inline void QOpenGLFunctions_4_3_Core::glGetSynciv(GLsync sync, GLenum pname, GLsizei bufSize, GLsizei *length, GLint *values)
-{
- d_3_2_Core->f.GetSynciv(sync, pname, bufSize, length, values);
-}
-
-inline void QOpenGLFunctions_4_3_Core::glGetInteger64v(GLenum pname, GLint64 *params)
-{
- d_3_2_Core->f.GetInteger64v(pname, params);
-}
-
-inline void QOpenGLFunctions_4_3_Core::glWaitSync(GLsync sync, GLbitfield flags, GLuint64 timeout)
-{
- d_3_2_Core->f.WaitSync(sync, flags, timeout);
-}
-
-inline GLenum QOpenGLFunctions_4_3_Core::glClientWaitSync(GLsync sync, GLbitfield flags, GLuint64 timeout)
-{
- return d_3_2_Core->f.ClientWaitSync(sync, flags, timeout);
-}
-
-inline void QOpenGLFunctions_4_3_Core::glDeleteSync(GLsync sync)
-{
- d_3_2_Core->f.DeleteSync(sync);
-}
-
-inline GLboolean QOpenGLFunctions_4_3_Core::glIsSync(GLsync sync)
-{
- return d_3_2_Core->f.IsSync(sync);
-}
-
-inline GLsync QOpenGLFunctions_4_3_Core::glFenceSync(GLenum condition, GLbitfield flags)
-{
- return d_3_2_Core->f.FenceSync(condition, flags);
-}
-
-inline void QOpenGLFunctions_4_3_Core::glProvokingVertex(GLenum mode)
-{
- d_3_2_Core->f.ProvokingVertex(mode);
-}
-
-inline void QOpenGLFunctions_4_3_Core::glMultiDrawElementsBaseVertex(GLenum mode, const GLsizei *count, GLenum type, const GLvoid* const *indices, GLsizei drawcount, const GLint *basevertex)
-{
- d_3_2_Core->f.MultiDrawElementsBaseVertex(mode, count, type, indices, drawcount, basevertex);
-}
-
-inline void QOpenGLFunctions_4_3_Core::glDrawElementsInstancedBaseVertex(GLenum mode, GLsizei count, GLenum type, const GLvoid *indices, GLsizei instancecount, GLint basevertex)
-{
- d_3_2_Core->f.DrawElementsInstancedBaseVertex(mode, count, type, indices, instancecount, basevertex);
-}
-
-inline void QOpenGLFunctions_4_3_Core::glDrawRangeElementsBaseVertex(GLenum mode, GLuint start, GLuint end, GLsizei count, GLenum type, const GLvoid *indices, GLint basevertex)
-{
- d_3_2_Core->f.DrawRangeElementsBaseVertex(mode, start, end, count, type, indices, basevertex);
-}
-
-inline void QOpenGLFunctions_4_3_Core::glDrawElementsBaseVertex(GLenum mode, GLsizei count, GLenum type, const GLvoid *indices, GLint basevertex)
-{
- d_3_2_Core->f.DrawElementsBaseVertex(mode, count, type, indices, basevertex);
-}
-
-inline void QOpenGLFunctions_4_3_Core::glFramebufferTexture(GLenum target, GLenum attachment, GLuint texture, GLint level)
-{
- d_3_2_Core->f.FramebufferTexture(target, attachment, texture, level);
-}
-
-inline void QOpenGLFunctions_4_3_Core::glGetBufferParameteri64v(GLenum target, GLenum pname, GLint64 *params)
-{
- d_3_2_Core->f.GetBufferParameteri64v(target, pname, params);
-}
-
-inline void QOpenGLFunctions_4_3_Core::glGetInteger64i_v(GLenum target, GLuint index, GLint64 *data)
-{
- d_3_2_Core->f.GetInteger64i_v(target, index, data);
-}
-
-
-// OpenGL 3.3 core functions
-inline void QOpenGLFunctions_4_3_Core::glVertexAttribP4uiv(GLuint index, GLenum type, GLboolean normalized, const GLuint *value)
-{
- d_3_3_Core->f.VertexAttribP4uiv(index, type, normalized, value);
-}
-
-inline void QOpenGLFunctions_4_3_Core::glVertexAttribP4ui(GLuint index, GLenum type, GLboolean normalized, GLuint value)
-{
- d_3_3_Core->f.VertexAttribP4ui(index, type, normalized, value);
-}
-
-inline void QOpenGLFunctions_4_3_Core::glVertexAttribP3uiv(GLuint index, GLenum type, GLboolean normalized, const GLuint *value)
-{
- d_3_3_Core->f.VertexAttribP3uiv(index, type, normalized, value);
-}
-
-inline void QOpenGLFunctions_4_3_Core::glVertexAttribP3ui(GLuint index, GLenum type, GLboolean normalized, GLuint value)
-{
- d_3_3_Core->f.VertexAttribP3ui(index, type, normalized, value);
-}
-
-inline void QOpenGLFunctions_4_3_Core::glVertexAttribP2uiv(GLuint index, GLenum type, GLboolean normalized, const GLuint *value)
-{
- d_3_3_Core->f.VertexAttribP2uiv(index, type, normalized, value);
-}
-
-inline void QOpenGLFunctions_4_3_Core::glVertexAttribP2ui(GLuint index, GLenum type, GLboolean normalized, GLuint value)
-{
- d_3_3_Core->f.VertexAttribP2ui(index, type, normalized, value);
-}
-
-inline void QOpenGLFunctions_4_3_Core::glVertexAttribP1uiv(GLuint index, GLenum type, GLboolean normalized, const GLuint *value)
-{
- d_3_3_Core->f.VertexAttribP1uiv(index, type, normalized, value);
-}
-
-inline void QOpenGLFunctions_4_3_Core::glVertexAttribP1ui(GLuint index, GLenum type, GLboolean normalized, GLuint value)
-{
- d_3_3_Core->f.VertexAttribP1ui(index, type, normalized, value);
-}
-
-inline void QOpenGLFunctions_4_3_Core::glSecondaryColorP3uiv(GLenum type, const GLuint *color)
-{
- Q_UNUSED(type);
- Q_UNUSED(color);
- QOPENGL_DEPRECATEDFUNCTION;
-}
-
-inline void QOpenGLFunctions_4_3_Core::glSecondaryColorP3ui(GLenum type, GLuint color)
-{
- Q_UNUSED(type);
- Q_UNUSED(color);
- QOPENGL_DEPRECATEDFUNCTION;
-}
-
-inline void QOpenGLFunctions_4_3_Core::glColorP4uiv(GLenum type, const GLuint *color)
-{
- Q_UNUSED(type);
- Q_UNUSED(color);
- QOPENGL_DEPRECATEDFUNCTION;
-}
-
-inline void QOpenGLFunctions_4_3_Core::glColorP4ui(GLenum type, GLuint color)
-{
- Q_UNUSED(type);
- Q_UNUSED(color);
- QOPENGL_DEPRECATEDFUNCTION;
-}
-
-inline void QOpenGLFunctions_4_3_Core::glColorP3uiv(GLenum type, const GLuint *color)
-{
- Q_UNUSED(type);
- Q_UNUSED(color);
- QOPENGL_DEPRECATEDFUNCTION;
-}
-
-inline void QOpenGLFunctions_4_3_Core::glColorP3ui(GLenum type, GLuint color)
-{
- Q_UNUSED(type);
- Q_UNUSED(color);
- QOPENGL_DEPRECATEDFUNCTION;
-}
-
-inline void QOpenGLFunctions_4_3_Core::glNormalP3uiv(GLenum type, const GLuint *coords)
-{
- Q_UNUSED(type);
- Q_UNUSED(coords);
- QOPENGL_DEPRECATEDFUNCTION;
-}
-
-inline void QOpenGLFunctions_4_3_Core::glNormalP3ui(GLenum type, GLuint coords)
-{
- Q_UNUSED(type);
- Q_UNUSED(coords);
- QOPENGL_DEPRECATEDFUNCTION;
-}
-
-inline void QOpenGLFunctions_4_3_Core::glMultiTexCoordP4uiv(GLenum texture, GLenum type, const GLuint *coords)
-{
- Q_UNUSED(texture);
- Q_UNUSED(type);
- Q_UNUSED(coords);
- QOPENGL_DEPRECATEDFUNCTION;
-}
-
-inline void QOpenGLFunctions_4_3_Core::glMultiTexCoordP4ui(GLenum texture, GLenum type, GLuint coords)
-{
- Q_UNUSED(texture);
- Q_UNUSED(type);
- Q_UNUSED(coords);
- QOPENGL_DEPRECATEDFUNCTION;
-}
-
-inline void QOpenGLFunctions_4_3_Core::glMultiTexCoordP3uiv(GLenum texture, GLenum type, const GLuint *coords)
-{
- Q_UNUSED(texture);
- Q_UNUSED(type);
- Q_UNUSED(coords);
- QOPENGL_DEPRECATEDFUNCTION;
-}
-
-inline void QOpenGLFunctions_4_3_Core::glMultiTexCoordP3ui(GLenum texture, GLenum type, GLuint coords)
-{
- Q_UNUSED(texture);
- Q_UNUSED(type);
- Q_UNUSED(coords);
- QOPENGL_DEPRECATEDFUNCTION;
-}
-
-inline void QOpenGLFunctions_4_3_Core::glMultiTexCoordP2uiv(GLenum texture, GLenum type, const GLuint *coords)
-{
- Q_UNUSED(texture);
- Q_UNUSED(type);
- Q_UNUSED(coords);
- QOPENGL_DEPRECATEDFUNCTION;
-}
-
-inline void QOpenGLFunctions_4_3_Core::glMultiTexCoordP2ui(GLenum texture, GLenum type, GLuint coords)
-{
- Q_UNUSED(texture);
- Q_UNUSED(type);
- Q_UNUSED(coords);
- QOPENGL_DEPRECATEDFUNCTION;
-}
-
-inline void QOpenGLFunctions_4_3_Core::glMultiTexCoordP1uiv(GLenum texture, GLenum type, const GLuint *coords)
-{
- Q_UNUSED(texture);
- Q_UNUSED(type);
- Q_UNUSED(coords);
- QOPENGL_DEPRECATEDFUNCTION;
-}
-
-inline void QOpenGLFunctions_4_3_Core::glMultiTexCoordP1ui(GLenum texture, GLenum type, GLuint coords)
-{
- Q_UNUSED(texture);
- Q_UNUSED(type);
- Q_UNUSED(coords);
- QOPENGL_DEPRECATEDFUNCTION;
-}
-
-inline void QOpenGLFunctions_4_3_Core::glTexCoordP4uiv(GLenum type, const GLuint *coords)
-{
- Q_UNUSED(type);
- Q_UNUSED(coords);
- QOPENGL_DEPRECATEDFUNCTION;
-}
-
-inline void QOpenGLFunctions_4_3_Core::glTexCoordP4ui(GLenum type, GLuint coords)
-{
- Q_UNUSED(type);
- Q_UNUSED(coords);
- QOPENGL_DEPRECATEDFUNCTION;
-}
-
-inline void QOpenGLFunctions_4_3_Core::glTexCoordP3uiv(GLenum type, const GLuint *coords)
-{
- Q_UNUSED(type);
- Q_UNUSED(coords);
- QOPENGL_DEPRECATEDFUNCTION;
-}
-
-inline void QOpenGLFunctions_4_3_Core::glTexCoordP3ui(GLenum type, GLuint coords)
-{
- Q_UNUSED(type);
- Q_UNUSED(coords);
- QOPENGL_DEPRECATEDFUNCTION;
-}
-
-inline void QOpenGLFunctions_4_3_Core::glTexCoordP2uiv(GLenum type, const GLuint *coords)
-{
- Q_UNUSED(type);
- Q_UNUSED(coords);
- QOPENGL_DEPRECATEDFUNCTION;
-}
-
-inline void QOpenGLFunctions_4_3_Core::glTexCoordP2ui(GLenum type, GLuint coords)
-{
- Q_UNUSED(type);
- Q_UNUSED(coords);
- QOPENGL_DEPRECATEDFUNCTION;
-}
-
-inline void QOpenGLFunctions_4_3_Core::glTexCoordP1uiv(GLenum type, const GLuint *coords)
-{
- Q_UNUSED(type);
- Q_UNUSED(coords);
- QOPENGL_DEPRECATEDFUNCTION;
-}
-
-inline void QOpenGLFunctions_4_3_Core::glTexCoordP1ui(GLenum type, GLuint coords)
-{
- Q_UNUSED(type);
- Q_UNUSED(coords);
- QOPENGL_DEPRECATEDFUNCTION;
-}
-
-inline void QOpenGLFunctions_4_3_Core::glVertexP4uiv(GLenum type, const GLuint *value)
-{
- Q_UNUSED(type);
- Q_UNUSED(value);
- QOPENGL_DEPRECATEDFUNCTION;
-}
-
-inline void QOpenGLFunctions_4_3_Core::glVertexP4ui(GLenum type, GLuint value)
-{
- Q_UNUSED(type);
- Q_UNUSED(value);
- QOPENGL_DEPRECATEDFUNCTION;
-}
-
-inline void QOpenGLFunctions_4_3_Core::glVertexP3uiv(GLenum type, const GLuint *value)
-{
- Q_UNUSED(type);
- Q_UNUSED(value);
- QOPENGL_DEPRECATEDFUNCTION;
-}
-
-inline void QOpenGLFunctions_4_3_Core::glVertexP3ui(GLenum type, GLuint value)
-{
- Q_UNUSED(type);
- Q_UNUSED(value);
- QOPENGL_DEPRECATEDFUNCTION;
-}
-
-inline void QOpenGLFunctions_4_3_Core::glVertexP2uiv(GLenum type, const GLuint *value)
-{
- Q_UNUSED(type);
- Q_UNUSED(value);
- QOPENGL_DEPRECATEDFUNCTION;
-}
-
-inline void QOpenGLFunctions_4_3_Core::glVertexP2ui(GLenum type, GLuint value)
-{
- Q_UNUSED(type);
- Q_UNUSED(value);
- QOPENGL_DEPRECATEDFUNCTION;
-}
-
-inline void QOpenGLFunctions_4_3_Core::glGetQueryObjectui64v(GLuint id, GLenum pname, GLuint64 *params)
-{
- d_3_3_Core->f.GetQueryObjectui64v(id, pname, params);
-}
-
-inline void QOpenGLFunctions_4_3_Core::glGetQueryObjecti64v(GLuint id, GLenum pname, GLint64 *params)
-{
- d_3_3_Core->f.GetQueryObjecti64v(id, pname, params);
-}
-
-inline void QOpenGLFunctions_4_3_Core::glQueryCounter(GLuint id, GLenum target)
-{
- d_3_3_Core->f.QueryCounter(id, target);
-}
-
-inline void QOpenGLFunctions_4_3_Core::glGetSamplerParameterIuiv(GLuint sampler, GLenum pname, GLuint *params)
-{
- d_3_3_Core->f.GetSamplerParameterIuiv(sampler, pname, params);
-}
-
-inline void QOpenGLFunctions_4_3_Core::glGetSamplerParameterfv(GLuint sampler, GLenum pname, GLfloat *params)
-{
- d_3_3_Core->f.GetSamplerParameterfv(sampler, pname, params);
-}
-
-inline void QOpenGLFunctions_4_3_Core::glGetSamplerParameterIiv(GLuint sampler, GLenum pname, GLint *params)
-{
- d_3_3_Core->f.GetSamplerParameterIiv(sampler, pname, params);
-}
-
-inline void QOpenGLFunctions_4_3_Core::glGetSamplerParameteriv(GLuint sampler, GLenum pname, GLint *params)
-{
- d_3_3_Core->f.GetSamplerParameteriv(sampler, pname, params);
-}
-
-inline void QOpenGLFunctions_4_3_Core::glSamplerParameterIuiv(GLuint sampler, GLenum pname, const GLuint *param)
-{
- d_3_3_Core->f.SamplerParameterIuiv(sampler, pname, param);
-}
-
-inline void QOpenGLFunctions_4_3_Core::glSamplerParameterIiv(GLuint sampler, GLenum pname, const GLint *param)
-{
- d_3_3_Core->f.SamplerParameterIiv(sampler, pname, param);
-}
-
-inline void QOpenGLFunctions_4_3_Core::glSamplerParameterfv(GLuint sampler, GLenum pname, const GLfloat *param)
-{
- d_3_3_Core->f.SamplerParameterfv(sampler, pname, param);
-}
-
-inline void QOpenGLFunctions_4_3_Core::glSamplerParameterf(GLuint sampler, GLenum pname, GLfloat param)
-{
- d_3_3_Core->f.SamplerParameterf(sampler, pname, param);
-}
-
-inline void QOpenGLFunctions_4_3_Core::glSamplerParameteriv(GLuint sampler, GLenum pname, const GLint *param)
-{
- d_3_3_Core->f.SamplerParameteriv(sampler, pname, param);
-}
-
-inline void QOpenGLFunctions_4_3_Core::glSamplerParameteri(GLuint sampler, GLenum pname, GLint param)
-{
- d_3_3_Core->f.SamplerParameteri(sampler, pname, param);
-}
-
-inline void QOpenGLFunctions_4_3_Core::glBindSampler(GLuint unit, GLuint sampler)
-{
- d_3_3_Core->f.BindSampler(unit, sampler);
-}
-
-inline GLboolean QOpenGLFunctions_4_3_Core::glIsSampler(GLuint sampler)
-{
- return d_3_3_Core->f.IsSampler(sampler);
-}
-
-inline void QOpenGLFunctions_4_3_Core::glDeleteSamplers(GLsizei count, const GLuint *samplers)
-{
- d_3_3_Core->f.DeleteSamplers(count, samplers);
-}
-
-inline void QOpenGLFunctions_4_3_Core::glGenSamplers(GLsizei count, GLuint *samplers)
-{
- d_3_3_Core->f.GenSamplers(count, samplers);
-}
-
-inline GLint QOpenGLFunctions_4_3_Core::glGetFragDataIndex(GLuint program, const GLchar *name)
-{
- return d_3_3_Core->f.GetFragDataIndex(program, name);
-}
-
-inline void QOpenGLFunctions_4_3_Core::glBindFragDataLocationIndexed(GLuint program, GLuint colorNumber, GLuint index, const GLchar *name)
-{
- d_3_3_Core->f.BindFragDataLocationIndexed(program, colorNumber, index, name);
-}
-
-inline void QOpenGLFunctions_4_3_Core::glVertexAttribDivisor(GLuint index, GLuint divisor)
-{
- d_3_3_Core->f.VertexAttribDivisor(index, divisor);
-}
-
-
-// OpenGL 4.0 core functions
-inline void QOpenGLFunctions_4_3_Core::glGetQueryIndexediv(GLenum target, GLuint index, GLenum pname, GLint *params)
-{
- d_4_0_Core->f.GetQueryIndexediv(target, index, pname, params);
-}
-
-inline void QOpenGLFunctions_4_3_Core::glEndQueryIndexed(GLenum target, GLuint index)
-{
- d_4_0_Core->f.EndQueryIndexed(target, index);
-}
-
-inline void QOpenGLFunctions_4_3_Core::glBeginQueryIndexed(GLenum target, GLuint index, GLuint id)
-{
- d_4_0_Core->f.BeginQueryIndexed(target, index, id);
-}
-
-inline void QOpenGLFunctions_4_3_Core::glDrawTransformFeedbackStream(GLenum mode, GLuint id, GLuint stream)
-{
- d_4_0_Core->f.DrawTransformFeedbackStream(mode, id, stream);
-}
-
-inline void QOpenGLFunctions_4_3_Core::glDrawTransformFeedback(GLenum mode, GLuint id)
-{
- d_4_0_Core->f.DrawTransformFeedback(mode, id);
-}
-
-inline void QOpenGLFunctions_4_3_Core::glResumeTransformFeedback()
-{
- d_4_0_Core->f.ResumeTransformFeedback();
-}
-
-inline void QOpenGLFunctions_4_3_Core::glPauseTransformFeedback()
-{
- d_4_0_Core->f.PauseTransformFeedback();
-}
-
-inline GLboolean QOpenGLFunctions_4_3_Core::glIsTransformFeedback(GLuint id)
-{
- return d_4_0_Core->f.IsTransformFeedback(id);
-}
-
-inline void QOpenGLFunctions_4_3_Core::glGenTransformFeedbacks(GLsizei n, GLuint *ids)
-{
- d_4_0_Core->f.GenTransformFeedbacks(n, ids);
-}
-
-inline void QOpenGLFunctions_4_3_Core::glDeleteTransformFeedbacks(GLsizei n, const GLuint *ids)
-{
- d_4_0_Core->f.DeleteTransformFeedbacks(n, ids);
-}
-
-inline void QOpenGLFunctions_4_3_Core::glBindTransformFeedback(GLenum target, GLuint id)
-{
- d_4_0_Core->f.BindTransformFeedback(target, id);
-}
-
-inline void QOpenGLFunctions_4_3_Core::glPatchParameterfv(GLenum pname, const GLfloat *values)
-{
- d_4_0_Core->f.PatchParameterfv(pname, values);
-}
-
-inline void QOpenGLFunctions_4_3_Core::glPatchParameteri(GLenum pname, GLint value)
-{
- d_4_0_Core->f.PatchParameteri(pname, value);
-}
-
-inline void QOpenGLFunctions_4_3_Core::glGetProgramStageiv(GLuint program, GLenum shadertype, GLenum pname, GLint *values)
-{
- d_4_0_Core->f.GetProgramStageiv(program, shadertype, pname, values);
-}
-
-inline void QOpenGLFunctions_4_3_Core::glGetUniformSubroutineuiv(GLenum shadertype, GLint location, GLuint *params)
-{
- d_4_0_Core->f.GetUniformSubroutineuiv(shadertype, location, params);
-}
-
-inline void QOpenGLFunctions_4_3_Core::glUniformSubroutinesuiv(GLenum shadertype, GLsizei count, const GLuint *indices)
-{
- d_4_0_Core->f.UniformSubroutinesuiv(shadertype, count, indices);
-}
-
-inline void QOpenGLFunctions_4_3_Core::glGetActiveSubroutineName(GLuint program, GLenum shadertype, GLuint index, GLsizei bufsize, GLsizei *length, GLchar *name)
-{
- d_4_0_Core->f.GetActiveSubroutineName(program, shadertype, index, bufsize, length, name);
-}
-
-inline void QOpenGLFunctions_4_3_Core::glGetActiveSubroutineUniformName(GLuint program, GLenum shadertype, GLuint index, GLsizei bufsize, GLsizei *length, GLchar *name)
-{
- d_4_0_Core->f.GetActiveSubroutineUniformName(program, shadertype, index, bufsize, length, name);
-}
-
-inline void QOpenGLFunctions_4_3_Core::glGetActiveSubroutineUniformiv(GLuint program, GLenum shadertype, GLuint index, GLenum pname, GLint *values)
-{
- d_4_0_Core->f.GetActiveSubroutineUniformiv(program, shadertype, index, pname, values);
-}
-
-inline GLuint QOpenGLFunctions_4_3_Core::glGetSubroutineIndex(GLuint program, GLenum shadertype, const GLchar *name)
-{
- return d_4_0_Core->f.GetSubroutineIndex(program, shadertype, name);
-}
-
-inline GLint QOpenGLFunctions_4_3_Core::glGetSubroutineUniformLocation(GLuint program, GLenum shadertype, const GLchar *name)
-{
- return d_4_0_Core->f.GetSubroutineUniformLocation(program, shadertype, name);
-}
-
-inline void QOpenGLFunctions_4_3_Core::glGetUniformdv(GLuint program, GLint location, GLdouble *params)
-{
- d_4_0_Core->f.GetUniformdv(program, location, params);
-}
-
-inline void QOpenGLFunctions_4_3_Core::glUniformMatrix4x3dv(GLint location, GLsizei count, GLboolean transpose, const GLdouble *value)
-{
- d_4_0_Core->f.UniformMatrix4x3dv(location, count, transpose, value);
-}
-
-inline void QOpenGLFunctions_4_3_Core::glUniformMatrix4x2dv(GLint location, GLsizei count, GLboolean transpose, const GLdouble *value)
-{
- d_4_0_Core->f.UniformMatrix4x2dv(location, count, transpose, value);
-}
-
-inline void QOpenGLFunctions_4_3_Core::glUniformMatrix3x4dv(GLint location, GLsizei count, GLboolean transpose, const GLdouble *value)
-{
- d_4_0_Core->f.UniformMatrix3x4dv(location, count, transpose, value);
-}
-
-inline void QOpenGLFunctions_4_3_Core::glUniformMatrix3x2dv(GLint location, GLsizei count, GLboolean transpose, const GLdouble *value)
-{
- d_4_0_Core->f.UniformMatrix3x2dv(location, count, transpose, value);
-}
-
-inline void QOpenGLFunctions_4_3_Core::glUniformMatrix2x4dv(GLint location, GLsizei count, GLboolean transpose, const GLdouble *value)
-{
- d_4_0_Core->f.UniformMatrix2x4dv(location, count, transpose, value);
-}
-
-inline void QOpenGLFunctions_4_3_Core::glUniformMatrix2x3dv(GLint location, GLsizei count, GLboolean transpose, const GLdouble *value)
-{
- d_4_0_Core->f.UniformMatrix2x3dv(location, count, transpose, value);
-}
-
-inline void QOpenGLFunctions_4_3_Core::glUniformMatrix4dv(GLint location, GLsizei count, GLboolean transpose, const GLdouble *value)
-{
- d_4_0_Core->f.UniformMatrix4dv(location, count, transpose, value);
-}
-
-inline void QOpenGLFunctions_4_3_Core::glUniformMatrix3dv(GLint location, GLsizei count, GLboolean transpose, const GLdouble *value)
-{
- d_4_0_Core->f.UniformMatrix3dv(location, count, transpose, value);
-}
-
-inline void QOpenGLFunctions_4_3_Core::glUniformMatrix2dv(GLint location, GLsizei count, GLboolean transpose, const GLdouble *value)
-{
- d_4_0_Core->f.UniformMatrix2dv(location, count, transpose, value);
-}
-
-inline void QOpenGLFunctions_4_3_Core::glUniform4dv(GLint location, GLsizei count, const GLdouble *value)
-{
- d_4_0_Core->f.Uniform4dv(location, count, value);
-}
-
-inline void QOpenGLFunctions_4_3_Core::glUniform3dv(GLint location, GLsizei count, const GLdouble *value)
-{
- d_4_0_Core->f.Uniform3dv(location, count, value);
-}
-
-inline void QOpenGLFunctions_4_3_Core::glUniform2dv(GLint location, GLsizei count, const GLdouble *value)
-{
- d_4_0_Core->f.Uniform2dv(location, count, value);
-}
-
-inline void QOpenGLFunctions_4_3_Core::glUniform1dv(GLint location, GLsizei count, const GLdouble *value)
-{
- d_4_0_Core->f.Uniform1dv(location, count, value);
-}
-
-inline void QOpenGLFunctions_4_3_Core::glUniform4d(GLint location, GLdouble x, GLdouble y, GLdouble z, GLdouble w)
-{
- d_4_0_Core->f.Uniform4d(location, x, y, z, w);
-}
-
-inline void QOpenGLFunctions_4_3_Core::glUniform3d(GLint location, GLdouble x, GLdouble y, GLdouble z)
-{
- d_4_0_Core->f.Uniform3d(location, x, y, z);
-}
-
-inline void QOpenGLFunctions_4_3_Core::glUniform2d(GLint location, GLdouble x, GLdouble y)
-{
- d_4_0_Core->f.Uniform2d(location, x, y);
-}
-
-inline void QOpenGLFunctions_4_3_Core::glUniform1d(GLint location, GLdouble x)
-{
- d_4_0_Core->f.Uniform1d(location, x);
-}
-
-inline void QOpenGLFunctions_4_3_Core::glDrawElementsIndirect(GLenum mode, GLenum type, const GLvoid *indirect)
-{
- d_4_0_Core->f.DrawElementsIndirect(mode, type, indirect);
-}
-
-inline void QOpenGLFunctions_4_3_Core::glDrawArraysIndirect(GLenum mode, const GLvoid *indirect)
-{
- d_4_0_Core->f.DrawArraysIndirect(mode, indirect);
-}
-
-inline void QOpenGLFunctions_4_3_Core::glBlendFuncSeparatei(GLuint buf, GLenum srcRGB, GLenum dstRGB, GLenum srcAlpha, GLenum dstAlpha)
-{
- d_4_0_Core->f.BlendFuncSeparatei(buf, srcRGB, dstRGB, srcAlpha, dstAlpha);
-}
-
-inline void QOpenGLFunctions_4_3_Core::glBlendFunci(GLuint buf, GLenum src, GLenum dst)
-{
- d_4_0_Core->f.BlendFunci(buf, src, dst);
-}
-
-inline void QOpenGLFunctions_4_3_Core::glBlendEquationSeparatei(GLuint buf, GLenum modeRGB, GLenum modeAlpha)
-{
- d_4_0_Core->f.BlendEquationSeparatei(buf, modeRGB, modeAlpha);
-}
-
-inline void QOpenGLFunctions_4_3_Core::glBlendEquationi(GLuint buf, GLenum mode)
-{
- d_4_0_Core->f.BlendEquationi(buf, mode);
-}
-
-inline void QOpenGLFunctions_4_3_Core::glMinSampleShading(GLfloat value)
-{
- d_4_0_Core->f.MinSampleShading(value);
-}
-
-
-// OpenGL 4.1 core functions
-inline void QOpenGLFunctions_4_3_Core::glGetDoublei_v(GLenum target, GLuint index, GLdouble *data)
-{
- d_4_1_Core->f.GetDoublei_v(target, index, data);
-}
-
-inline void QOpenGLFunctions_4_3_Core::glGetFloati_v(GLenum target, GLuint index, GLfloat *data)
-{
- d_4_1_Core->f.GetFloati_v(target, index, data);
-}
-
-inline void QOpenGLFunctions_4_3_Core::glDepthRangeIndexed(GLuint index, GLdouble n, GLdouble f)
-{
- d_4_1_Core->f.DepthRangeIndexed(index, n, f);
-}
-
-inline void QOpenGLFunctions_4_3_Core::glDepthRangeArrayv(GLuint first, GLsizei count, const GLdouble *v)
-{
- d_4_1_Core->f.DepthRangeArrayv(first, count, v);
-}
-
-inline void QOpenGLFunctions_4_3_Core::glScissorIndexedv(GLuint index, const GLint *v)
-{
- d_4_1_Core->f.ScissorIndexedv(index, v);
-}
-
-inline void QOpenGLFunctions_4_3_Core::glScissorIndexed(GLuint index, GLint left, GLint bottom, GLsizei width, GLsizei height)
-{
- d_4_1_Core->f.ScissorIndexed(index, left, bottom, width, height);
-}
-
-inline void QOpenGLFunctions_4_3_Core::glScissorArrayv(GLuint first, GLsizei count, const GLint *v)
-{
- d_4_1_Core->f.ScissorArrayv(first, count, v);
-}
-
-inline void QOpenGLFunctions_4_3_Core::glViewportIndexedfv(GLuint index, const GLfloat *v)
-{
- d_4_1_Core->f.ViewportIndexedfv(index, v);
-}
-
-inline void QOpenGLFunctions_4_3_Core::glViewportIndexedf(GLuint index, GLfloat x, GLfloat y, GLfloat w, GLfloat h)
-{
- d_4_1_Core->f.ViewportIndexedf(index, x, y, w, h);
-}
-
-inline void QOpenGLFunctions_4_3_Core::glViewportArrayv(GLuint first, GLsizei count, const GLfloat *v)
-{
- d_4_1_Core->f.ViewportArrayv(first, count, v);
-}
-
-inline void QOpenGLFunctions_4_3_Core::glGetVertexAttribLdv(GLuint index, GLenum pname, GLdouble *params)
-{
- d_4_1_Core->f.GetVertexAttribLdv(index, pname, params);
-}
-
-inline void QOpenGLFunctions_4_3_Core::glVertexAttribLPointer(GLuint index, GLint size, GLenum type, GLsizei stride, const GLvoid *pointer)
-{
- d_4_1_Core->f.VertexAttribLPointer(index, size, type, stride, pointer);
-}
-
-inline void QOpenGLFunctions_4_3_Core::glVertexAttribL4dv(GLuint index, const GLdouble *v)
-{
- d_4_1_Core->f.VertexAttribL4dv(index, v);
-}
-
-inline void QOpenGLFunctions_4_3_Core::glVertexAttribL3dv(GLuint index, const GLdouble *v)
-{
- d_4_1_Core->f.VertexAttribL3dv(index, v);
-}
-
-inline void QOpenGLFunctions_4_3_Core::glVertexAttribL2dv(GLuint index, const GLdouble *v)
-{
- d_4_1_Core->f.VertexAttribL2dv(index, v);
-}
-
-inline void QOpenGLFunctions_4_3_Core::glVertexAttribL1dv(GLuint index, const GLdouble *v)
-{
- d_4_1_Core->f.VertexAttribL1dv(index, v);
-}
-
-inline void QOpenGLFunctions_4_3_Core::glVertexAttribL4d(GLuint index, GLdouble x, GLdouble y, GLdouble z, GLdouble w)
-{
- d_4_1_Core->f.VertexAttribL4d(index, x, y, z, w);
-}
-
-inline void QOpenGLFunctions_4_3_Core::glVertexAttribL3d(GLuint index, GLdouble x, GLdouble y, GLdouble z)
-{
- d_4_1_Core->f.VertexAttribL3d(index, x, y, z);
-}
-
-inline void QOpenGLFunctions_4_3_Core::glVertexAttribL2d(GLuint index, GLdouble x, GLdouble y)
-{
- d_4_1_Core->f.VertexAttribL2d(index, x, y);
-}
-
-inline void QOpenGLFunctions_4_3_Core::glVertexAttribL1d(GLuint index, GLdouble x)
-{
- d_4_1_Core->f.VertexAttribL1d(index, x);
-}
-
-inline void QOpenGLFunctions_4_3_Core::glGetProgramPipelineInfoLog(GLuint pipeline, GLsizei bufSize, GLsizei *length, GLchar *infoLog)
-{
- d_4_1_Core->f.GetProgramPipelineInfoLog(pipeline, bufSize, length, infoLog);
-}
-
-inline void QOpenGLFunctions_4_3_Core::glValidateProgramPipeline(GLuint pipeline)
-{
- d_4_1_Core->f.ValidateProgramPipeline(pipeline);
-}
-
-inline void QOpenGLFunctions_4_3_Core::glProgramUniformMatrix4x3dv(GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLdouble *value)
-{
- d_4_1_Core->f.ProgramUniformMatrix4x3dv(program, location, count, transpose, value);
-}
-
-inline void QOpenGLFunctions_4_3_Core::glProgramUniformMatrix3x4dv(GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLdouble *value)
-{
- d_4_1_Core->f.ProgramUniformMatrix3x4dv(program, location, count, transpose, value);
-}
-
-inline void QOpenGLFunctions_4_3_Core::glProgramUniformMatrix4x2dv(GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLdouble *value)
-{
- d_4_1_Core->f.ProgramUniformMatrix4x2dv(program, location, count, transpose, value);
-}
-
-inline void QOpenGLFunctions_4_3_Core::glProgramUniformMatrix2x4dv(GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLdouble *value)
-{
- d_4_1_Core->f.ProgramUniformMatrix2x4dv(program, location, count, transpose, value);
-}
-
-inline void QOpenGLFunctions_4_3_Core::glProgramUniformMatrix3x2dv(GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLdouble *value)
-{
- d_4_1_Core->f.ProgramUniformMatrix3x2dv(program, location, count, transpose, value);
-}
-
-inline void QOpenGLFunctions_4_3_Core::glProgramUniformMatrix2x3dv(GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLdouble *value)
-{
- d_4_1_Core->f.ProgramUniformMatrix2x3dv(program, location, count, transpose, value);
-}
-
-inline void QOpenGLFunctions_4_3_Core::glProgramUniformMatrix4x3fv(GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value)
-{
- d_4_1_Core->f.ProgramUniformMatrix4x3fv(program, location, count, transpose, value);
-}
-
-inline void QOpenGLFunctions_4_3_Core::glProgramUniformMatrix3x4fv(GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value)
-{
- d_4_1_Core->f.ProgramUniformMatrix3x4fv(program, location, count, transpose, value);
-}
-
-inline void QOpenGLFunctions_4_3_Core::glProgramUniformMatrix4x2fv(GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value)
-{
- d_4_1_Core->f.ProgramUniformMatrix4x2fv(program, location, count, transpose, value);
-}
-
-inline void QOpenGLFunctions_4_3_Core::glProgramUniformMatrix2x4fv(GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value)
-{
- d_4_1_Core->f.ProgramUniformMatrix2x4fv(program, location, count, transpose, value);
-}
-
-inline void QOpenGLFunctions_4_3_Core::glProgramUniformMatrix3x2fv(GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value)
-{
- d_4_1_Core->f.ProgramUniformMatrix3x2fv(program, location, count, transpose, value);
-}
-
-inline void QOpenGLFunctions_4_3_Core::glProgramUniformMatrix2x3fv(GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value)
-{
- d_4_1_Core->f.ProgramUniformMatrix2x3fv(program, location, count, transpose, value);
-}
-
-inline void QOpenGLFunctions_4_3_Core::glProgramUniformMatrix4dv(GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLdouble *value)
-{
- d_4_1_Core->f.ProgramUniformMatrix4dv(program, location, count, transpose, value);
-}
-
-inline void QOpenGLFunctions_4_3_Core::glProgramUniformMatrix3dv(GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLdouble *value)
-{
- d_4_1_Core->f.ProgramUniformMatrix3dv(program, location, count, transpose, value);
-}
-
-inline void QOpenGLFunctions_4_3_Core::glProgramUniformMatrix2dv(GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLdouble *value)
-{
- d_4_1_Core->f.ProgramUniformMatrix2dv(program, location, count, transpose, value);
-}
-
-inline void QOpenGLFunctions_4_3_Core::glProgramUniformMatrix4fv(GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value)
-{
- d_4_1_Core->f.ProgramUniformMatrix4fv(program, location, count, transpose, value);
-}
-
-inline void QOpenGLFunctions_4_3_Core::glProgramUniformMatrix3fv(GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value)
-{
- d_4_1_Core->f.ProgramUniformMatrix3fv(program, location, count, transpose, value);
-}
-
-inline void QOpenGLFunctions_4_3_Core::glProgramUniformMatrix2fv(GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value)
-{
- d_4_1_Core->f.ProgramUniformMatrix2fv(program, location, count, transpose, value);
-}
-
-inline void QOpenGLFunctions_4_3_Core::glProgramUniform4uiv(GLuint program, GLint location, GLsizei count, const GLuint *value)
-{
- d_4_1_Core->f.ProgramUniform4uiv(program, location, count, value);
-}
-
-inline void QOpenGLFunctions_4_3_Core::glProgramUniform4ui(GLuint program, GLint location, GLuint v0, GLuint v1, GLuint v2, GLuint v3)
-{
- d_4_1_Core->f.ProgramUniform4ui(program, location, v0, v1, v2, v3);
-}
-
-inline void QOpenGLFunctions_4_3_Core::glProgramUniform4dv(GLuint program, GLint location, GLsizei count, const GLdouble *value)
-{
- d_4_1_Core->f.ProgramUniform4dv(program, location, count, value);
-}
-
-inline void QOpenGLFunctions_4_3_Core::glProgramUniform4d(GLuint program, GLint location, GLdouble v0, GLdouble v1, GLdouble v2, GLdouble v3)
-{
- d_4_1_Core->f.ProgramUniform4d(program, location, v0, v1, v2, v3);
-}
-
-inline void QOpenGLFunctions_4_3_Core::glProgramUniform4fv(GLuint program, GLint location, GLsizei count, const GLfloat *value)
-{
- d_4_1_Core->f.ProgramUniform4fv(program, location, count, value);
-}
-
-inline void QOpenGLFunctions_4_3_Core::glProgramUniform4f(GLuint program, GLint location, GLfloat v0, GLfloat v1, GLfloat v2, GLfloat v3)
-{
- d_4_1_Core->f.ProgramUniform4f(program, location, v0, v1, v2, v3);
-}
-
-inline void QOpenGLFunctions_4_3_Core::glProgramUniform4iv(GLuint program, GLint location, GLsizei count, const GLint *value)
-{
- d_4_1_Core->f.ProgramUniform4iv(program, location, count, value);
-}
-
-inline void QOpenGLFunctions_4_3_Core::glProgramUniform4i(GLuint program, GLint location, GLint v0, GLint v1, GLint v2, GLint v3)
-{
- d_4_1_Core->f.ProgramUniform4i(program, location, v0, v1, v2, v3);
-}
-
-inline void QOpenGLFunctions_4_3_Core::glProgramUniform3uiv(GLuint program, GLint location, GLsizei count, const GLuint *value)
-{
- d_4_1_Core->f.ProgramUniform3uiv(program, location, count, value);
-}
-
-inline void QOpenGLFunctions_4_3_Core::glProgramUniform3ui(GLuint program, GLint location, GLuint v0, GLuint v1, GLuint v2)
-{
- d_4_1_Core->f.ProgramUniform3ui(program, location, v0, v1, v2);
-}
-
-inline void QOpenGLFunctions_4_3_Core::glProgramUniform3dv(GLuint program, GLint location, GLsizei count, const GLdouble *value)
-{
- d_4_1_Core->f.ProgramUniform3dv(program, location, count, value);
-}
-
-inline void QOpenGLFunctions_4_3_Core::glProgramUniform3d(GLuint program, GLint location, GLdouble v0, GLdouble v1, GLdouble v2)
-{
- d_4_1_Core->f.ProgramUniform3d(program, location, v0, v1, v2);
-}
-
-inline void QOpenGLFunctions_4_3_Core::glProgramUniform3fv(GLuint program, GLint location, GLsizei count, const GLfloat *value)
-{
- d_4_1_Core->f.ProgramUniform3fv(program, location, count, value);
-}
-
-inline void QOpenGLFunctions_4_3_Core::glProgramUniform3f(GLuint program, GLint location, GLfloat v0, GLfloat v1, GLfloat v2)
-{
- d_4_1_Core->f.ProgramUniform3f(program, location, v0, v1, v2);
-}
-
-inline void QOpenGLFunctions_4_3_Core::glProgramUniform3iv(GLuint program, GLint location, GLsizei count, const GLint *value)
-{
- d_4_1_Core->f.ProgramUniform3iv(program, location, count, value);
-}
-
-inline void QOpenGLFunctions_4_3_Core::glProgramUniform3i(GLuint program, GLint location, GLint v0, GLint v1, GLint v2)
-{
- d_4_1_Core->f.ProgramUniform3i(program, location, v0, v1, v2);
-}
-
-inline void QOpenGLFunctions_4_3_Core::glProgramUniform2uiv(GLuint program, GLint location, GLsizei count, const GLuint *value)
-{
- d_4_1_Core->f.ProgramUniform2uiv(program, location, count, value);
-}
-
-inline void QOpenGLFunctions_4_3_Core::glProgramUniform2ui(GLuint program, GLint location, GLuint v0, GLuint v1)
-{
- d_4_1_Core->f.ProgramUniform2ui(program, location, v0, v1);
-}
-
-inline void QOpenGLFunctions_4_3_Core::glProgramUniform2dv(GLuint program, GLint location, GLsizei count, const GLdouble *value)
-{
- d_4_1_Core->f.ProgramUniform2dv(program, location, count, value);
-}
-
-inline void QOpenGLFunctions_4_3_Core::glProgramUniform2d(GLuint program, GLint location, GLdouble v0, GLdouble v1)
-{
- d_4_1_Core->f.ProgramUniform2d(program, location, v0, v1);
-}
-
-inline void QOpenGLFunctions_4_3_Core::glProgramUniform2fv(GLuint program, GLint location, GLsizei count, const GLfloat *value)
-{
- d_4_1_Core->f.ProgramUniform2fv(program, location, count, value);
-}
-
-inline void QOpenGLFunctions_4_3_Core::glProgramUniform2f(GLuint program, GLint location, GLfloat v0, GLfloat v1)
-{
- d_4_1_Core->f.ProgramUniform2f(program, location, v0, v1);
-}
-
-inline void QOpenGLFunctions_4_3_Core::glProgramUniform2iv(GLuint program, GLint location, GLsizei count, const GLint *value)
-{
- d_4_1_Core->f.ProgramUniform2iv(program, location, count, value);
-}
-
-inline void QOpenGLFunctions_4_3_Core::glProgramUniform2i(GLuint program, GLint location, GLint v0, GLint v1)
-{
- d_4_1_Core->f.ProgramUniform2i(program, location, v0, v1);
-}
-
-inline void QOpenGLFunctions_4_3_Core::glProgramUniform1uiv(GLuint program, GLint location, GLsizei count, const GLuint *value)
-{
- d_4_1_Core->f.ProgramUniform1uiv(program, location, count, value);
-}
-
-inline void QOpenGLFunctions_4_3_Core::glProgramUniform1ui(GLuint program, GLint location, GLuint v0)
-{
- d_4_1_Core->f.ProgramUniform1ui(program, location, v0);
-}
-
-inline void QOpenGLFunctions_4_3_Core::glProgramUniform1dv(GLuint program, GLint location, GLsizei count, const GLdouble *value)
-{
- d_4_1_Core->f.ProgramUniform1dv(program, location, count, value);
-}
-
-inline void QOpenGLFunctions_4_3_Core::glProgramUniform1d(GLuint program, GLint location, GLdouble v0)
-{
- d_4_1_Core->f.ProgramUniform1d(program, location, v0);
-}
-
-inline void QOpenGLFunctions_4_3_Core::glProgramUniform1fv(GLuint program, GLint location, GLsizei count, const GLfloat *value)
-{
- d_4_1_Core->f.ProgramUniform1fv(program, location, count, value);
-}
-
-inline void QOpenGLFunctions_4_3_Core::glProgramUniform1f(GLuint program, GLint location, GLfloat v0)
-{
- d_4_1_Core->f.ProgramUniform1f(program, location, v0);
-}
-
-inline void QOpenGLFunctions_4_3_Core::glProgramUniform1iv(GLuint program, GLint location, GLsizei count, const GLint *value)
-{
- d_4_1_Core->f.ProgramUniform1iv(program, location, count, value);
-}
-
-inline void QOpenGLFunctions_4_3_Core::glProgramUniform1i(GLuint program, GLint location, GLint v0)
-{
- d_4_1_Core->f.ProgramUniform1i(program, location, v0);
-}
-
-inline void QOpenGLFunctions_4_3_Core::glGetProgramPipelineiv(GLuint pipeline, GLenum pname, GLint *params)
-{
- d_4_1_Core->f.GetProgramPipelineiv(pipeline, pname, params);
-}
-
-inline GLboolean QOpenGLFunctions_4_3_Core::glIsProgramPipeline(GLuint pipeline)
-{
- return d_4_1_Core->f.IsProgramPipeline(pipeline);
-}
-
-inline void QOpenGLFunctions_4_3_Core::glGenProgramPipelines(GLsizei n, GLuint *pipelines)
-{
- d_4_1_Core->f.GenProgramPipelines(n, pipelines);
-}
-
-inline void QOpenGLFunctions_4_3_Core::glDeleteProgramPipelines(GLsizei n, const GLuint *pipelines)
-{
- d_4_1_Core->f.DeleteProgramPipelines(n, pipelines);
-}
-
-inline void QOpenGLFunctions_4_3_Core::glBindProgramPipeline(GLuint pipeline)
-{
- d_4_1_Core->f.BindProgramPipeline(pipeline);
-}
-
-inline GLuint QOpenGLFunctions_4_3_Core::glCreateShaderProgramv(GLenum type, GLsizei count, const GLchar* const *strings)
-{
- return d_4_1_Core->f.CreateShaderProgramv(type, count, strings);
-}
-
-inline void QOpenGLFunctions_4_3_Core::glActiveShaderProgram(GLuint pipeline, GLuint program)
-{
- d_4_1_Core->f.ActiveShaderProgram(pipeline, program);
-}
-
-inline void QOpenGLFunctions_4_3_Core::glUseProgramStages(GLuint pipeline, GLbitfield stages, GLuint program)
-{
- d_4_1_Core->f.UseProgramStages(pipeline, stages, program);
-}
-
-inline void QOpenGLFunctions_4_3_Core::glProgramParameteri(GLuint program, GLenum pname, GLint value)
-{
- d_4_1_Core->f.ProgramParameteri(program, pname, value);
-}
-
-inline void QOpenGLFunctions_4_3_Core::glProgramBinary(GLuint program, GLenum binaryFormat, const GLvoid *binary, GLsizei length)
-{
- d_4_1_Core->f.ProgramBinary(program, binaryFormat, binary, length);
-}
-
-inline void QOpenGLFunctions_4_3_Core::glGetProgramBinary(GLuint program, GLsizei bufSize, GLsizei *length, GLenum *binaryFormat, GLvoid *binary)
-{
- d_4_1_Core->f.GetProgramBinary(program, bufSize, length, binaryFormat, binary);
-}
-
-inline void QOpenGLFunctions_4_3_Core::glClearDepthf(GLfloat dd)
-{
- d_4_1_Core->f.ClearDepthf(dd);
-}
-
-inline void QOpenGLFunctions_4_3_Core::glDepthRangef(GLfloat n, GLfloat f)
-{
- d_4_1_Core->f.DepthRangef(n, f);
-}
-
-inline void QOpenGLFunctions_4_3_Core::glGetShaderPrecisionFormat(GLenum shadertype, GLenum precisiontype, GLint *range, GLint *precision)
-{
- d_4_1_Core->f.GetShaderPrecisionFormat(shadertype, precisiontype, range, precision);
-}
-
-inline void QOpenGLFunctions_4_3_Core::glShaderBinary(GLsizei count, const GLuint *shaders, GLenum binaryformat, const GLvoid *binary, GLsizei length)
-{
- d_4_1_Core->f.ShaderBinary(count, shaders, binaryformat, binary, length);
-}
-
-inline void QOpenGLFunctions_4_3_Core::glReleaseShaderCompiler()
-{
- d_4_1_Core->f.ReleaseShaderCompiler();
-}
-
-
-// OpenGL 4.2 core functions
-inline void QOpenGLFunctions_4_3_Core::glTexStorage3D(GLenum target, GLsizei levels, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth)
-{
- d_4_2_Core->f.TexStorage3D(target, levels, internalformat, width, height, depth);
-}
-
-inline void QOpenGLFunctions_4_3_Core::glTexStorage2D(GLenum target, GLsizei levels, GLenum internalformat, GLsizei width, GLsizei height)
-{
- d_4_2_Core->f.TexStorage2D(target, levels, internalformat, width, height);
-}
-
-inline void QOpenGLFunctions_4_3_Core::glTexStorage1D(GLenum target, GLsizei levels, GLenum internalformat, GLsizei width)
-{
- d_4_2_Core->f.TexStorage1D(target, levels, internalformat, width);
-}
-
-inline void QOpenGLFunctions_4_3_Core::glMemoryBarrier(GLbitfield barriers)
-{
- d_4_2_Core->f.MemoryBarrier(barriers);
-}
-
-inline void QOpenGLFunctions_4_3_Core::glBindImageTexture(GLuint unit, GLuint texture, GLint level, GLboolean layered, GLint layer, GLenum access, GLenum format)
-{
- d_4_2_Core->f.BindImageTexture(unit, texture, level, layered, layer, access, format);
-}
-
-inline void QOpenGLFunctions_4_3_Core::glGetActiveAtomicCounterBufferiv(GLuint program, GLuint bufferIndex, GLenum pname, GLint *params)
-{
- d_4_2_Core->f.GetActiveAtomicCounterBufferiv(program, bufferIndex, pname, params);
-}
-
-inline void QOpenGLFunctions_4_3_Core::glGetInternalformativ(GLenum target, GLenum internalformat, GLenum pname, GLsizei bufSize, GLint *params)
-{
- d_4_2_Core->f.GetInternalformativ(target, internalformat, pname, bufSize, params);
-}
-
-inline void QOpenGLFunctions_4_3_Core::glDrawTransformFeedbackStreamInstanced(GLenum mode, GLuint id, GLuint stream, GLsizei instancecount)
-{
- d_4_2_Core->f.DrawTransformFeedbackStreamInstanced(mode, id, stream, instancecount);
-}
-
-inline void QOpenGLFunctions_4_3_Core::glDrawTransformFeedbackInstanced(GLenum mode, GLuint id, GLsizei instancecount)
-{
- d_4_2_Core->f.DrawTransformFeedbackInstanced(mode, id, instancecount);
-}
-
-inline void QOpenGLFunctions_4_3_Core::glDrawElementsInstancedBaseVertexBaseInstance(GLenum mode, GLsizei count, GLenum type, const void *indices, GLsizei instancecount, GLint basevertex, GLuint baseinstance)
-{
- d_4_2_Core->f.DrawElementsInstancedBaseVertexBaseInstance(mode, count, type, indices, instancecount, basevertex, baseinstance);
-}
-
-inline void QOpenGLFunctions_4_3_Core::glDrawElementsInstancedBaseInstance(GLenum mode, GLsizei count, GLenum type, const void *indices, GLsizei instancecount, GLuint baseinstance)
-{
- d_4_2_Core->f.DrawElementsInstancedBaseInstance(mode, count, type, indices, instancecount, baseinstance);
-}
-
-inline void QOpenGLFunctions_4_3_Core::glDrawArraysInstancedBaseInstance(GLenum mode, GLint first, GLsizei count, GLsizei instancecount, GLuint baseinstance)
-{
- d_4_2_Core->f.DrawArraysInstancedBaseInstance(mode, first, count, instancecount, baseinstance);
-}
-
-
-// OpenGL 4.3 core functions
-inline void QOpenGLFunctions_4_3_Core::glTexStorage3DMultisample(GLenum target, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth, GLboolean fixedsamplelocations)
-{
- d_4_3_Core->f.TexStorage3DMultisample(target, samples, internalformat, width, height, depth, fixedsamplelocations);
-}
-
-inline void QOpenGLFunctions_4_3_Core::glTexStorage2DMultisample(GLenum target, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height, GLboolean fixedsamplelocations)
-{
- d_4_3_Core->f.TexStorage2DMultisample(target, samples, internalformat, width, height, fixedsamplelocations);
-}
-
-inline void QOpenGLFunctions_4_3_Core::glTexBufferRange(GLenum target, GLenum internalformat, GLuint buffer, GLintptr offset, GLsizeiptr size)
-{
- d_4_3_Core->f.TexBufferRange(target, internalformat, buffer, offset, size);
-}
-
-inline void QOpenGLFunctions_4_3_Core::glShaderStorageBlockBinding(GLuint program, GLuint storageBlockIndex, GLuint storageBlockBinding)
-{
- d_4_3_Core->f.ShaderStorageBlockBinding(program, storageBlockIndex, storageBlockBinding);
-}
-
-inline GLint QOpenGLFunctions_4_3_Core::glGetProgramResourceLocationIndex(GLuint program, GLenum programInterface, const GLchar *name)
-{
- return d_4_3_Core->f.GetProgramResourceLocationIndex(program, programInterface, name);
-}
-
-inline GLint QOpenGLFunctions_4_3_Core::glGetProgramResourceLocation(GLuint program, GLenum programInterface, const GLchar *name)
-{
- return d_4_3_Core->f.GetProgramResourceLocation(program, programInterface, name);
-}
-
-inline void QOpenGLFunctions_4_3_Core::glGetProgramResourceiv(GLuint program, GLenum programInterface, GLuint index, GLsizei propCount, const GLenum *props, GLsizei bufSize, GLsizei *length, GLint *params)
-{
- d_4_3_Core->f.GetProgramResourceiv(program, programInterface, index, propCount, props, bufSize, length, params);
-}
-
-inline void QOpenGLFunctions_4_3_Core::glGetProgramResourceName(GLuint program, GLenum programInterface, GLuint index, GLsizei bufSize, GLsizei *length, GLchar *name)
-{
- d_4_3_Core->f.GetProgramResourceName(program, programInterface, index, bufSize, length, name);
-}
-
-inline GLuint QOpenGLFunctions_4_3_Core::glGetProgramResourceIndex(GLuint program, GLenum programInterface, const GLchar *name)
-{
- return d_4_3_Core->f.GetProgramResourceIndex(program, programInterface, name);
-}
-
-inline void QOpenGLFunctions_4_3_Core::glGetProgramInterfaceiv(GLuint program, GLenum programInterface, GLenum pname, GLint *params)
-{
- d_4_3_Core->f.GetProgramInterfaceiv(program, programInterface, pname, params);
-}
-
-inline void QOpenGLFunctions_4_3_Core::glMultiDrawElementsIndirect(GLenum mode, GLenum type, const void *indirect, GLsizei drawcount, GLsizei stride)
-{
- d_4_3_Core->f.MultiDrawElementsIndirect(mode, type, indirect, drawcount, stride);
-}
-
-inline void QOpenGLFunctions_4_3_Core::glMultiDrawArraysIndirect(GLenum mode, const void *indirect, GLsizei drawcount, GLsizei stride)
-{
- d_4_3_Core->f.MultiDrawArraysIndirect(mode, indirect, drawcount, stride);
-}
-
-inline void QOpenGLFunctions_4_3_Core::glInvalidateSubFramebuffer(GLenum target, GLsizei numAttachments, const GLenum *attachments, GLint x, GLint y, GLsizei width, GLsizei height)
-{
- d_4_3_Core->f.InvalidateSubFramebuffer(target, numAttachments, attachments, x, y, width, height);
-}
-
-inline void QOpenGLFunctions_4_3_Core::glInvalidateFramebuffer(GLenum target, GLsizei numAttachments, const GLenum *attachments)
-{
- d_4_3_Core->f.InvalidateFramebuffer(target, numAttachments, attachments);
-}
-
-inline void QOpenGLFunctions_4_3_Core::glInvalidateBufferData(GLuint buffer)
-{
- d_4_3_Core->f.InvalidateBufferData(buffer);
-}
-
-inline void QOpenGLFunctions_4_3_Core::glInvalidateBufferSubData(GLuint buffer, GLintptr offset, GLsizeiptr length)
-{
- d_4_3_Core->f.InvalidateBufferSubData(buffer, offset, length);
-}
-
-inline void QOpenGLFunctions_4_3_Core::glInvalidateTexImage(GLuint texture, GLint level)
-{
- d_4_3_Core->f.InvalidateTexImage(texture, level);
-}
-
-inline void QOpenGLFunctions_4_3_Core::glInvalidateTexSubImage(GLuint texture, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth)
-{
- d_4_3_Core->f.InvalidateTexSubImage(texture, level, xoffset, yoffset, zoffset, width, height, depth);
-}
-
-inline void QOpenGLFunctions_4_3_Core::glGetInternalformati64v(GLenum target, GLenum internalformat, GLenum pname, GLsizei bufSize, GLint64 *params)
-{
- d_4_3_Core->f.GetInternalformati64v(target, internalformat, pname, bufSize, params);
-}
-
-inline void QOpenGLFunctions_4_3_Core::glGetFramebufferParameteriv(GLenum target, GLenum pname, GLint *params)
-{
- d_4_3_Core->f.GetFramebufferParameteriv(target, pname, params);
-}
-
-inline void QOpenGLFunctions_4_3_Core::glFramebufferParameteri(GLenum target, GLenum pname, GLint param)
-{
- d_4_3_Core->f.FramebufferParameteri(target, pname, param);
-}
-
-inline void QOpenGLFunctions_4_3_Core::glVertexBindingDivisor(GLuint bindingindex, GLuint divisor)
-{
- d_4_3_Core->f.VertexBindingDivisor(bindingindex, divisor);
-}
-
-inline void QOpenGLFunctions_4_3_Core::glVertexAttribBinding(GLuint attribindex, GLuint bindingindex)
-{
- d_4_3_Core->f.VertexAttribBinding(attribindex, bindingindex);
-}
-
-inline void QOpenGLFunctions_4_3_Core::glVertexAttribLFormat(GLuint attribindex, GLint size, GLenum type, GLuint relativeoffset)
-{
- d_4_3_Core->f.VertexAttribLFormat(attribindex, size, type, relativeoffset);
-}
-
-inline void QOpenGLFunctions_4_3_Core::glVertexAttribIFormat(GLuint attribindex, GLint size, GLenum type, GLuint relativeoffset)
-{
- d_4_3_Core->f.VertexAttribIFormat(attribindex, size, type, relativeoffset);
-}
-
-inline void QOpenGLFunctions_4_3_Core::glVertexAttribFormat(GLuint attribindex, GLint size, GLenum type, GLboolean normalized, GLuint relativeoffset)
-{
- d_4_3_Core->f.VertexAttribFormat(attribindex, size, type, normalized, relativeoffset);
-}
-
-inline void QOpenGLFunctions_4_3_Core::glBindVertexBuffer(GLuint bindingindex, GLuint buffer, GLintptr offset, GLsizei stride)
-{
- d_4_3_Core->f.BindVertexBuffer(bindingindex, buffer, offset, stride);
-}
-
-inline void QOpenGLFunctions_4_3_Core::glTextureView(GLuint texture, GLenum target, GLuint origtexture, GLenum internalformat, GLuint minlevel, GLuint numlevels, GLuint minlayer, GLuint numlayers)
-{
- d_4_3_Core->f.TextureView(texture, target, origtexture, internalformat, minlevel, numlevels, minlayer, numlayers);
-}
-
-inline void QOpenGLFunctions_4_3_Core::glCopyImageSubData(GLuint srcName, GLenum srcTarget, GLint srcLevel, GLint srcX, GLint srcY, GLint srcZ, GLuint dstName, GLenum dstTarget, GLint dstLevel, GLint dstX, GLint dstY, GLint dstZ, GLsizei srcWidth, GLsizei srcHeight, GLsizei srcDepth)
-{
- d_4_3_Core->f.CopyImageSubData(srcName, srcTarget, srcLevel, srcX, srcY, srcZ, dstName, dstTarget, dstLevel, dstX, dstY, dstZ, srcWidth, srcHeight, srcDepth);
-}
-
-inline void QOpenGLFunctions_4_3_Core::glDispatchComputeIndirect(GLintptr indirect)
-{
- d_4_3_Core->f.DispatchComputeIndirect(indirect);
-}
-
-inline void QOpenGLFunctions_4_3_Core::glDispatchCompute(GLuint num_groups_x, GLuint num_groups_y, GLuint num_groups_z)
-{
- d_4_3_Core->f.DispatchCompute(num_groups_x, num_groups_y, num_groups_z);
-}
-
-inline void QOpenGLFunctions_4_3_Core::glClearBufferSubData(GLenum target, GLenum internalformat, GLintptr offset, GLsizeiptr size, GLenum format, GLenum type, const void *data)
-{
- d_4_3_Core->f.ClearBufferSubData(target, internalformat, offset, size, format, type, data);
-}
-
-inline void QOpenGLFunctions_4_3_Core::glClearBufferData(GLenum target, GLenum internalformat, GLenum format, GLenum type, const void *data)
-{
- d_4_3_Core->f.ClearBufferData(target, internalformat, format, type, data);
-}
-
-
-
-QT_END_NAMESPACE
-
-#ifdef Q_OS_WIN
-#pragma pop_macro("MemoryBarrier")
-#endif
-
-#endif // QT_NO_OPENGL && !QT_OPENGL_ES_2
-
-#endif
diff --git a/src/gui/opengl/qopenglfunctions_4_4_compatibility.cpp b/src/gui/opengl/qopenglfunctions_4_4_compatibility.cpp
deleted file mode 100644
index 4fc4b50100..0000000000
--- a/src/gui/opengl/qopenglfunctions_4_4_compatibility.cpp
+++ /dev/null
@@ -1,326 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2015 Klaralvdalens Datakonsult AB (KDAB)
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the QtGui module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-**
-** This file was generated by glgen version 0.1
-** Command line was: glgen
-**
-** glgen is Copyright (C) 2013 Klaralvdalens Datakonsult AB (KDAB)
-**
-** This is an auto-generated file.
-** Do not edit! All changes made to it will be lost.
-**
-****************************************************************************/
-
-#include "qopenglfunctions_4_4_compatibility.h"
-#include "qopenglcontext.h"
-
-QT_BEGIN_NAMESPACE
-
-/*!
- \class QOpenGLFunctions_4_4_Compatibility
- \inmodule QtGui
- \since 5.5
- \wrapper
- \brief The QOpenGLFunctions_4_4_Compatibility class provides all functions for OpenGL 4.4 compatibility profile.
-
- This class is a wrapper for functions from OpenGL 4.4 compatibility profile.
- See reference pages on \l {http://www.opengl.org/sdk/docs/}{opengl.org}
- for function documentation.
-
- \sa QAbstractOpenGLFunctions
-*/
-
-QOpenGLFunctions_4_4_Compatibility::QOpenGLFunctions_4_4_Compatibility()
- : QAbstractOpenGLFunctions()
- , d_1_0_Core(nullptr)
- , d_1_1_Core(nullptr)
- , d_1_2_Core(nullptr)
- , d_1_3_Core(nullptr)
- , d_1_4_Core(nullptr)
- , d_1_5_Core(nullptr)
- , d_2_0_Core(nullptr)
- , d_2_1_Core(nullptr)
- , d_3_0_Core(nullptr)
- , d_3_1_Core(nullptr)
- , d_3_2_Core(nullptr)
- , d_3_3_Core(nullptr)
- , d_4_0_Core(nullptr)
- , d_4_1_Core(nullptr)
- , d_4_2_Core(nullptr)
- , d_4_3_Core(nullptr)
- , d_4_4_Core(nullptr)
- , d_1_0_Deprecated(nullptr)
- , d_1_1_Deprecated(nullptr)
- , d_1_2_Deprecated(nullptr)
- , d_1_3_Deprecated(nullptr)
- , d_1_4_Deprecated(nullptr)
- , d_3_3_Deprecated(nullptr)
-{
-}
-
-QOpenGLFunctions_4_4_Compatibility::~QOpenGLFunctions_4_4_Compatibility()
-{
- if (d_1_0_Core) {
- d_1_0_Core->refs.deref();
- Q_ASSERT(d_1_0_Core->refs.loadRelaxed());
- }
- if (d_1_1_Core) {
- d_1_1_Core->refs.deref();
- Q_ASSERT(d_1_1_Core->refs.loadRelaxed());
- }
- if (d_1_2_Core) {
- d_1_2_Core->refs.deref();
- Q_ASSERT(d_1_2_Core->refs.loadRelaxed());
- }
- if (d_1_3_Core) {
- d_1_3_Core->refs.deref();
- Q_ASSERT(d_1_3_Core->refs.loadRelaxed());
- }
- if (d_1_4_Core) {
- d_1_4_Core->refs.deref();
- Q_ASSERT(d_1_4_Core->refs.loadRelaxed());
- }
- if (d_1_5_Core) {
- d_1_5_Core->refs.deref();
- Q_ASSERT(d_1_5_Core->refs.loadRelaxed());
- }
- if (d_2_0_Core) {
- d_2_0_Core->refs.deref();
- Q_ASSERT(d_2_0_Core->refs.loadRelaxed());
- }
- if (d_2_1_Core) {
- d_2_1_Core->refs.deref();
- Q_ASSERT(d_2_1_Core->refs.loadRelaxed());
- }
- if (d_3_0_Core) {
- d_3_0_Core->refs.deref();
- Q_ASSERT(d_3_0_Core->refs.loadRelaxed());
- }
- if (d_3_1_Core) {
- d_3_1_Core->refs.deref();
- Q_ASSERT(d_3_1_Core->refs.loadRelaxed());
- }
- if (d_3_2_Core) {
- d_3_2_Core->refs.deref();
- Q_ASSERT(d_3_2_Core->refs.loadRelaxed());
- }
- if (d_3_3_Core) {
- d_3_3_Core->refs.deref();
- Q_ASSERT(d_3_3_Core->refs.loadRelaxed());
- }
- if (d_4_0_Core) {
- d_4_0_Core->refs.deref();
- Q_ASSERT(d_4_0_Core->refs.loadRelaxed());
- }
- if (d_4_1_Core) {
- d_4_1_Core->refs.deref();
- Q_ASSERT(d_4_1_Core->refs.loadRelaxed());
- }
- if (d_4_2_Core) {
- d_4_2_Core->refs.deref();
- Q_ASSERT(d_4_2_Core->refs.loadRelaxed());
- }
- if (d_4_3_Core) {
- d_4_3_Core->refs.deref();
- Q_ASSERT(d_4_3_Core->refs.loadRelaxed());
- }
- if (d_4_4_Core) {
- d_4_4_Core->refs.deref();
- Q_ASSERT(d_4_4_Core->refs.loadRelaxed());
- }
- if (d_1_0_Deprecated) {
- d_1_0_Deprecated->refs.deref();
- Q_ASSERT(d_1_0_Deprecated->refs.loadRelaxed());
- }
- if (d_1_1_Deprecated) {
- d_1_1_Deprecated->refs.deref();
- Q_ASSERT(d_1_1_Deprecated->refs.loadRelaxed());
- }
- if (d_1_2_Deprecated) {
- d_1_2_Deprecated->refs.deref();
- Q_ASSERT(d_1_2_Deprecated->refs.loadRelaxed());
- }
- if (d_1_3_Deprecated) {
- d_1_3_Deprecated->refs.deref();
- Q_ASSERT(d_1_3_Deprecated->refs.loadRelaxed());
- }
- if (d_1_4_Deprecated) {
- d_1_4_Deprecated->refs.deref();
- Q_ASSERT(d_1_4_Deprecated->refs.loadRelaxed());
- }
- if (d_3_3_Deprecated) {
- d_3_3_Deprecated->refs.deref();
- Q_ASSERT(d_3_3_Deprecated->refs.loadRelaxed());
- }
-}
-
-bool QOpenGLFunctions_4_4_Compatibility::initializeOpenGLFunctions()
-{
- if ( isInitialized() )
- return true;
-
- QOpenGLContext* context = QOpenGLContext::currentContext();
-
- // If owned by a context object make sure it is current.
- // Also check that current context is capable of resolving all needed functions
- if (((owningContext() && owningContext() == context) || !owningContext())
- && QOpenGLFunctions_4_4_Compatibility::isContextCompatible(context))
- {
- // Associate with private implementation, creating if necessary
- // Function pointers in the backends are resolved at creation time
- QOpenGLVersionFunctionsBackend* d = nullptr;
- d = QAbstractOpenGLFunctionsPrivate::functionsBackend(context, QOpenGLFunctions_1_0_CoreBackend::versionStatus());
- d_1_0_Core = static_cast<QOpenGLFunctions_1_0_CoreBackend*>(d);
- d->refs.ref();
-
- d = QAbstractOpenGLFunctionsPrivate::functionsBackend(context, QOpenGLFunctions_1_1_CoreBackend::versionStatus());
- d_1_1_Core = static_cast<QOpenGLFunctions_1_1_CoreBackend*>(d);
- d->refs.ref();
-
- d = QAbstractOpenGLFunctionsPrivate::functionsBackend(context, QOpenGLFunctions_1_2_CoreBackend::versionStatus());
- d_1_2_Core = static_cast<QOpenGLFunctions_1_2_CoreBackend*>(d);
- d->refs.ref();
-
- d = QAbstractOpenGLFunctionsPrivate::functionsBackend(context, QOpenGLFunctions_1_3_CoreBackend::versionStatus());
- d_1_3_Core = static_cast<QOpenGLFunctions_1_3_CoreBackend*>(d);
- d->refs.ref();
-
- d = QAbstractOpenGLFunctionsPrivate::functionsBackend(context, QOpenGLFunctions_1_4_CoreBackend::versionStatus());
- d_1_4_Core = static_cast<QOpenGLFunctions_1_4_CoreBackend*>(d);
- d->refs.ref();
-
- d = QAbstractOpenGLFunctionsPrivate::functionsBackend(context, QOpenGLFunctions_1_5_CoreBackend::versionStatus());
- d_1_5_Core = static_cast<QOpenGLFunctions_1_5_CoreBackend*>(d);
- d->refs.ref();
-
- d = QAbstractOpenGLFunctionsPrivate::functionsBackend(context, QOpenGLFunctions_2_0_CoreBackend::versionStatus());
- d_2_0_Core = static_cast<QOpenGLFunctions_2_0_CoreBackend*>(d);
- d->refs.ref();
-
- d = QAbstractOpenGLFunctionsPrivate::functionsBackend(context, QOpenGLFunctions_2_1_CoreBackend::versionStatus());
- d_2_1_Core = static_cast<QOpenGLFunctions_2_1_CoreBackend*>(d);
- d->refs.ref();
-
- d = QAbstractOpenGLFunctionsPrivate::functionsBackend(context, QOpenGLFunctions_3_0_CoreBackend::versionStatus());
- d_3_0_Core = static_cast<QOpenGLFunctions_3_0_CoreBackend*>(d);
- d->refs.ref();
-
- d = QAbstractOpenGLFunctionsPrivate::functionsBackend(context, QOpenGLFunctions_3_1_CoreBackend::versionStatus());
- d_3_1_Core = static_cast<QOpenGLFunctions_3_1_CoreBackend*>(d);
- d->refs.ref();
-
- d = QAbstractOpenGLFunctionsPrivate::functionsBackend(context, QOpenGLFunctions_3_2_CoreBackend::versionStatus());
- d_3_2_Core = static_cast<QOpenGLFunctions_3_2_CoreBackend*>(d);
- d->refs.ref();
-
- d = QAbstractOpenGLFunctionsPrivate::functionsBackend(context, QOpenGLFunctions_3_3_CoreBackend::versionStatus());
- d_3_3_Core = static_cast<QOpenGLFunctions_3_3_CoreBackend*>(d);
- d->refs.ref();
-
- d = QAbstractOpenGLFunctionsPrivate::functionsBackend(context, QOpenGLFunctions_4_0_CoreBackend::versionStatus());
- d_4_0_Core = static_cast<QOpenGLFunctions_4_0_CoreBackend*>(d);
- d->refs.ref();
-
- d = QAbstractOpenGLFunctionsPrivate::functionsBackend(context, QOpenGLFunctions_4_1_CoreBackend::versionStatus());
- d_4_1_Core = static_cast<QOpenGLFunctions_4_1_CoreBackend*>(d);
- d->refs.ref();
-
- d = QAbstractOpenGLFunctionsPrivate::functionsBackend(context, QOpenGLFunctions_4_2_CoreBackend::versionStatus());
- d_4_2_Core = static_cast<QOpenGLFunctions_4_2_CoreBackend*>(d);
- d->refs.ref();
-
- d = QAbstractOpenGLFunctionsPrivate::functionsBackend(context, QOpenGLFunctions_4_3_CoreBackend::versionStatus());
- d_4_3_Core = static_cast<QOpenGLFunctions_4_3_CoreBackend*>(d);
- d->refs.ref();
-
- d = QAbstractOpenGLFunctionsPrivate::functionsBackend(context, QOpenGLFunctions_4_4_CoreBackend::versionStatus());
- d_4_4_Core = static_cast<QOpenGLFunctions_4_4_CoreBackend*>(d);
- d->refs.ref();
-
- d = QAbstractOpenGLFunctionsPrivate::functionsBackend(context, QOpenGLFunctions_1_0_DeprecatedBackend::versionStatus());
- d_1_0_Deprecated = static_cast<QOpenGLFunctions_1_0_DeprecatedBackend*>(d);
- d->refs.ref();
-
- d = QAbstractOpenGLFunctionsPrivate::functionsBackend(context, QOpenGLFunctions_1_1_DeprecatedBackend::versionStatus());
- d_1_1_Deprecated = static_cast<QOpenGLFunctions_1_1_DeprecatedBackend*>(d);
- d->refs.ref();
-
- d = QAbstractOpenGLFunctionsPrivate::functionsBackend(context, QOpenGLFunctions_1_2_DeprecatedBackend::versionStatus());
- d_1_2_Deprecated = static_cast<QOpenGLFunctions_1_2_DeprecatedBackend*>(d);
- d->refs.ref();
-
- d = QAbstractOpenGLFunctionsPrivate::functionsBackend(context, QOpenGLFunctions_1_3_DeprecatedBackend::versionStatus());
- d_1_3_Deprecated = static_cast<QOpenGLFunctions_1_3_DeprecatedBackend*>(d);
- d->refs.ref();
-
- d = QAbstractOpenGLFunctionsPrivate::functionsBackend(context, QOpenGLFunctions_1_4_DeprecatedBackend::versionStatus());
- d_1_4_Deprecated = static_cast<QOpenGLFunctions_1_4_DeprecatedBackend*>(d);
- d->refs.ref();
-
- d = QAbstractOpenGLFunctionsPrivate::functionsBackend(context, QOpenGLFunctions_3_3_DeprecatedBackend::versionStatus());
- d_3_3_Deprecated = static_cast<QOpenGLFunctions_3_3_DeprecatedBackend*>(d);
- d->refs.ref();
-
- QAbstractOpenGLFunctions::initializeOpenGLFunctions();
- }
- return isInitialized();
-}
-
-bool QOpenGLFunctions_4_4_Compatibility::isContextCompatible(QOpenGLContext *context)
-{
- Q_ASSERT(context);
- QSurfaceFormat f = context->format();
- const QPair<int, int> v = qMakePair(f.majorVersion(), f.minorVersion());
- if (v < qMakePair(4, 4))
- return false;
-
- if (f.profile() == QSurfaceFormat::CoreProfile)
- return false;
-
- return true;
-}
-
-QOpenGLVersionProfile QOpenGLFunctions_4_4_Compatibility::versionProfile()
-{
- QOpenGLVersionProfile v;
- v.setVersion(4, 4);
- v.setProfile(QSurfaceFormat::CompatibilityProfile);
- return v;
-}
-
-QT_END_NAMESPACE
diff --git a/src/gui/opengl/qopenglfunctions_4_4_compatibility.h b/src/gui/opengl/qopenglfunctions_4_4_compatibility.h
deleted file mode 100644
index 0acab349a1..0000000000
--- a/src/gui/opengl/qopenglfunctions_4_4_compatibility.h
+++ /dev/null
@@ -1,5976 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2015 Klaralvdalens Datakonsult AB (KDAB)
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the QtGui module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-**
-** This file was generated by glgen version 0.1
-** Command line was: glgen
-**
-** glgen is Copyright (C) 2013 Klaralvdalens Datakonsult AB (KDAB)
-**
-** This is an auto-generated file.
-** Do not edit! All changes made to it will be lost.
-**
-****************************************************************************/
-
-#ifndef QOPENGLVERSIONFUNCTIONS_4_4_COMPATIBILITY_H
-#define QOPENGLVERSIONFUNCTIONS_4_4_COMPATIBILITY_H
-
-#include <QtGui/qtguiglobal.h>
-
-#if !defined(QT_NO_OPENGL) && !defined(QT_OPENGL_ES_2)
-
-#include <QtGui/QOpenGLVersionFunctions>
-#include <QtGui/qopenglcontext.h>
-
-QT_BEGIN_NAMESPACE
-
-// MemoryBarrier is a macro on some architectures on Windows
-#ifdef Q_OS_WIN
-#pragma push_macro("MemoryBarrier")
-#undef MemoryBarrier
-#endif
-
-class Q_GUI_EXPORT QOpenGLFunctions_4_4_Compatibility : public QAbstractOpenGLFunctions
-{
-public:
- QOpenGLFunctions_4_4_Compatibility();
- ~QOpenGLFunctions_4_4_Compatibility();
-
- bool initializeOpenGLFunctions() override;
-
- // OpenGL 1.0 core functions
- void glViewport(GLint x, GLint y, GLsizei width, GLsizei height);
- void glDepthRange(GLdouble nearVal, GLdouble farVal);
- GLboolean glIsEnabled(GLenum cap);
- void glGetTexLevelParameteriv(GLenum target, GLint level, GLenum pname, GLint *params);
- void glGetTexLevelParameterfv(GLenum target, GLint level, GLenum pname, GLfloat *params);
- void glGetTexParameteriv(GLenum target, GLenum pname, GLint *params);
- void glGetTexParameterfv(GLenum target, GLenum pname, GLfloat *params);
- void glGetTexImage(GLenum target, GLint level, GLenum format, GLenum type, void *pixels);
- const GLubyte * glGetString(GLenum name);
- void glGetIntegerv(GLenum pname, GLint *data);
- void glGetFloatv(GLenum pname, GLfloat *data);
- GLenum glGetError();
- void glGetDoublev(GLenum pname, GLdouble *data);
- void glGetBooleanv(GLenum pname, GLboolean *data);
- void glReadPixels(GLint x, GLint y, GLsizei width, GLsizei height, GLenum format, GLenum type, void *pixels);
- void glReadBuffer(GLenum src);
- void glPixelStorei(GLenum pname, GLint param);
- void glPixelStoref(GLenum pname, GLfloat param);
- void glDepthFunc(GLenum func);
- void glStencilOp(GLenum fail, GLenum zfail, GLenum zpass);
- void glStencilFunc(GLenum func, GLint ref, GLuint mask);
- void glLogicOp(GLenum opcode);
- void glBlendFunc(GLenum sfactor, GLenum dfactor);
- void glFlush();
- void glFinish();
- void glEnable(GLenum cap);
- void glDisable(GLenum cap);
- void glDepthMask(GLboolean flag);
- void glColorMask(GLboolean red, GLboolean green, GLboolean blue, GLboolean alpha);
- void glStencilMask(GLuint mask);
- void glClearDepth(GLdouble depth);
- void glClearStencil(GLint s);
- void glClearColor(GLfloat red, GLfloat green, GLfloat blue, GLfloat alpha);
- void glClear(GLbitfield mask);
- void glDrawBuffer(GLenum buf);
- void glTexImage2D(GLenum target, GLint level, GLint internalformat, GLsizei width, GLsizei height, GLint border, GLenum format, GLenum type, const void *pixels);
- void glTexImage1D(GLenum target, GLint level, GLint internalformat, GLsizei width, GLint border, GLenum format, GLenum type, const void *pixels);
- void glTexParameteriv(GLenum target, GLenum pname, const GLint *params);
- void glTexParameteri(GLenum target, GLenum pname, GLint param);
- void glTexParameterfv(GLenum target, GLenum pname, const GLfloat *params);
- void glTexParameterf(GLenum target, GLenum pname, GLfloat param);
- void glScissor(GLint x, GLint y, GLsizei width, GLsizei height);
- void glPolygonMode(GLenum face, GLenum mode);
- void glPointSize(GLfloat size);
- void glLineWidth(GLfloat width);
- void glHint(GLenum target, GLenum mode);
- void glFrontFace(GLenum mode);
- void glCullFace(GLenum mode);
-
- // OpenGL 1.1 core functions
- GLboolean glIsTexture(GLuint texture);
- void glGenTextures(GLsizei n, GLuint *textures);
- void glDeleteTextures(GLsizei n, const GLuint *textures);
- void glBindTexture(GLenum target, GLuint texture);
- void glTexSubImage2D(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLenum type, const void *pixels);
- void glTexSubImage1D(GLenum target, GLint level, GLint xoffset, GLsizei width, GLenum format, GLenum type, const void *pixels);
- void glCopyTexSubImage2D(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint x, GLint y, GLsizei width, GLsizei height);
- void glCopyTexSubImage1D(GLenum target, GLint level, GLint xoffset, GLint x, GLint y, GLsizei width);
- void glCopyTexImage2D(GLenum target, GLint level, GLenum internalformat, GLint x, GLint y, GLsizei width, GLsizei height, GLint border);
- void glCopyTexImage1D(GLenum target, GLint level, GLenum internalformat, GLint x, GLint y, GLsizei width, GLint border);
- void glPolygonOffset(GLfloat factor, GLfloat units);
- void glDrawElements(GLenum mode, GLsizei count, GLenum type, const void *indices);
- void glDrawArrays(GLenum mode, GLint first, GLsizei count);
-
- // OpenGL 1.2 core functions
- void glBlendColor(GLfloat red, GLfloat green, GLfloat blue, GLfloat alpha);
- void glBlendEquation(GLenum mode);
- void glCopyTexSubImage3D(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLint x, GLint y, GLsizei width, GLsizei height);
- void glTexSubImage3D(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLenum type, const void *pixels);
- void glTexImage3D(GLenum target, GLint level, GLint internalformat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLenum format, GLenum type, const void *pixels);
- void glDrawRangeElements(GLenum mode, GLuint start, GLuint end, GLsizei count, GLenum type, const void *indices);
-
- // OpenGL 1.3 core functions
- void glGetCompressedTexImage(GLenum target, GLint level, void *img);
- void glCompressedTexSubImage1D(GLenum target, GLint level, GLint xoffset, GLsizei width, GLenum format, GLsizei imageSize, const void *data);
- void glCompressedTexSubImage2D(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLsizei imageSize, const void *data);
- void glCompressedTexSubImage3D(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLsizei imageSize, const void *data);
- void glCompressedTexImage1D(GLenum target, GLint level, GLenum internalformat, GLsizei width, GLint border, GLsizei imageSize, const void *data);
- void glCompressedTexImage2D(GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLint border, GLsizei imageSize, const void *data);
- void glCompressedTexImage3D(GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLsizei imageSize, const void *data);
- void glSampleCoverage(GLfloat value, GLboolean invert);
- void glActiveTexture(GLenum texture);
-
- // OpenGL 1.4 core functions
- void glPointParameteriv(GLenum pname, const GLint *params);
- void glPointParameteri(GLenum pname, GLint param);
- void glPointParameterfv(GLenum pname, const GLfloat *params);
- void glPointParameterf(GLenum pname, GLfloat param);
- void glMultiDrawElements(GLenum mode, const GLsizei *count, GLenum type, const void *const *indices, GLsizei drawcount);
- void glMultiDrawArrays(GLenum mode, const GLint *first, const GLsizei *count, GLsizei drawcount);
- void glBlendFuncSeparate(GLenum sfactorRGB, GLenum dfactorRGB, GLenum sfactorAlpha, GLenum dfactorAlpha);
-
- // OpenGL 1.5 core functions
- void glGetBufferPointerv(GLenum target, GLenum pname, void * *params);
- void glGetBufferParameteriv(GLenum target, GLenum pname, GLint *params);
- GLboolean glUnmapBuffer(GLenum target);
- void * glMapBuffer(GLenum target, GLenum access);
- void glGetBufferSubData(GLenum target, GLintptr offset, GLsizeiptr size, void *data);
- void glBufferSubData(GLenum target, GLintptr offset, GLsizeiptr size, const void *data);
- void glBufferData(GLenum target, GLsizeiptr size, const void *data, GLenum usage);
- GLboolean glIsBuffer(GLuint buffer);
- void glGenBuffers(GLsizei n, GLuint *buffers);
- void glDeleteBuffers(GLsizei n, const GLuint *buffers);
- void glBindBuffer(GLenum target, GLuint buffer);
- void glGetQueryObjectuiv(GLuint id, GLenum pname, GLuint *params);
- void glGetQueryObjectiv(GLuint id, GLenum pname, GLint *params);
- void glGetQueryiv(GLenum target, GLenum pname, GLint *params);
- void glEndQuery(GLenum target);
- void glBeginQuery(GLenum target, GLuint id);
- GLboolean glIsQuery(GLuint id);
- void glDeleteQueries(GLsizei n, const GLuint *ids);
- void glGenQueries(GLsizei n, GLuint *ids);
-
- // OpenGL 2.0 core functions
- void glVertexAttribPointer(GLuint index, GLint size, GLenum type, GLboolean normalized, GLsizei stride, const void *pointer);
- void glVertexAttrib4usv(GLuint index, const GLushort *v);
- void glVertexAttrib4uiv(GLuint index, const GLuint *v);
- void glVertexAttrib4ubv(GLuint index, const GLubyte *v);
- void glVertexAttrib4sv(GLuint index, const GLshort *v);
- void glVertexAttrib4s(GLuint index, GLshort x, GLshort y, GLshort z, GLshort w);
- void glVertexAttrib4iv(GLuint index, const GLint *v);
- void glVertexAttrib4fv(GLuint index, const GLfloat *v);
- void glVertexAttrib4f(GLuint index, GLfloat x, GLfloat y, GLfloat z, GLfloat w);
- void glVertexAttrib4dv(GLuint index, const GLdouble *v);
- void glVertexAttrib4d(GLuint index, GLdouble x, GLdouble y, GLdouble z, GLdouble w);
- void glVertexAttrib4bv(GLuint index, const GLbyte *v);
- void glVertexAttrib4Nusv(GLuint index, const GLushort *v);
- void glVertexAttrib4Nuiv(GLuint index, const GLuint *v);
- void glVertexAttrib4Nubv(GLuint index, const GLubyte *v);
- void glVertexAttrib4Nub(GLuint index, GLubyte x, GLubyte y, GLubyte z, GLubyte w);
- void glVertexAttrib4Nsv(GLuint index, const GLshort *v);
- void glVertexAttrib4Niv(GLuint index, const GLint *v);
- void glVertexAttrib4Nbv(GLuint index, const GLbyte *v);
- void glVertexAttrib3sv(GLuint index, const GLshort *v);
- void glVertexAttrib3s(GLuint index, GLshort x, GLshort y, GLshort z);
- void glVertexAttrib3fv(GLuint index, const GLfloat *v);
- void glVertexAttrib3f(GLuint index, GLfloat x, GLfloat y, GLfloat z);
- void glVertexAttrib3dv(GLuint index, const GLdouble *v);
- void glVertexAttrib3d(GLuint index, GLdouble x, GLdouble y, GLdouble z);
- void glVertexAttrib2sv(GLuint index, const GLshort *v);
- void glVertexAttrib2s(GLuint index, GLshort x, GLshort y);
- void glVertexAttrib2fv(GLuint index, const GLfloat *v);
- void glVertexAttrib2f(GLuint index, GLfloat x, GLfloat y);
- void glVertexAttrib2dv(GLuint index, const GLdouble *v);
- void glVertexAttrib2d(GLuint index, GLdouble x, GLdouble y);
- void glVertexAttrib1sv(GLuint index, const GLshort *v);
- void glVertexAttrib1s(GLuint index, GLshort x);
- void glVertexAttrib1fv(GLuint index, const GLfloat *v);
- void glVertexAttrib1f(GLuint index, GLfloat x);
- void glVertexAttrib1dv(GLuint index, const GLdouble *v);
- void glVertexAttrib1d(GLuint index, GLdouble x);
- void glValidateProgram(GLuint program);
- void glUniformMatrix4fv(GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
- void glUniformMatrix3fv(GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
- void glUniformMatrix2fv(GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
- void glUniform4iv(GLint location, GLsizei count, const GLint *value);
- void glUniform3iv(GLint location, GLsizei count, const GLint *value);
- void glUniform2iv(GLint location, GLsizei count, const GLint *value);
- void glUniform1iv(GLint location, GLsizei count, const GLint *value);
- void glUniform4fv(GLint location, GLsizei count, const GLfloat *value);
- void glUniform3fv(GLint location, GLsizei count, const GLfloat *value);
- void glUniform2fv(GLint location, GLsizei count, const GLfloat *value);
- void glUniform1fv(GLint location, GLsizei count, const GLfloat *value);
- void glUniform4i(GLint location, GLint v0, GLint v1, GLint v2, GLint v3);
- void glUniform3i(GLint location, GLint v0, GLint v1, GLint v2);
- void glUniform2i(GLint location, GLint v0, GLint v1);
- void glUniform1i(GLint location, GLint v0);
- void glUniform4f(GLint location, GLfloat v0, GLfloat v1, GLfloat v2, GLfloat v3);
- void glUniform3f(GLint location, GLfloat v0, GLfloat v1, GLfloat v2);
- void glUniform2f(GLint location, GLfloat v0, GLfloat v1);
- void glUniform1f(GLint location, GLfloat v0);
- void glUseProgram(GLuint program);
- void glShaderSource(GLuint shader, GLsizei count, const GLchar* const *string, const GLint *length);
- void glLinkProgram(GLuint program);
- GLboolean glIsShader(GLuint shader);
- GLboolean glIsProgram(GLuint program);
- void glGetVertexAttribPointerv(GLuint index, GLenum pname, void * *pointer);
- void glGetVertexAttribiv(GLuint index, GLenum pname, GLint *params);
- void glGetVertexAttribfv(GLuint index, GLenum pname, GLfloat *params);
- void glGetVertexAttribdv(GLuint index, GLenum pname, GLdouble *params);
- void glGetUniformiv(GLuint program, GLint location, GLint *params);
- void glGetUniformfv(GLuint program, GLint location, GLfloat *params);
- GLint glGetUniformLocation(GLuint program, const GLchar *name);
- void glGetShaderSource(GLuint shader, GLsizei bufSize, GLsizei *length, GLchar *source);
- void glGetShaderInfoLog(GLuint shader, GLsizei bufSize, GLsizei *length, GLchar *infoLog);
- void glGetShaderiv(GLuint shader, GLenum pname, GLint *params);
- void glGetProgramInfoLog(GLuint program, GLsizei bufSize, GLsizei *length, GLchar *infoLog);
- void glGetProgramiv(GLuint program, GLenum pname, GLint *params);
- GLint glGetAttribLocation(GLuint program, const GLchar *name);
- void glGetAttachedShaders(GLuint program, GLsizei maxCount, GLsizei *count, GLuint *shaders);
- void glGetActiveUniform(GLuint program, GLuint index, GLsizei bufSize, GLsizei *length, GLint *size, GLenum *type, GLchar *name);
- void glGetActiveAttrib(GLuint program, GLuint index, GLsizei bufSize, GLsizei *length, GLint *size, GLenum *type, GLchar *name);
- void glEnableVertexAttribArray(GLuint index);
- void glDisableVertexAttribArray(GLuint index);
- void glDetachShader(GLuint program, GLuint shader);
- void glDeleteShader(GLuint shader);
- void glDeleteProgram(GLuint program);
- GLuint glCreateShader(GLenum type);
- GLuint glCreateProgram();
- void glCompileShader(GLuint shader);
- void glBindAttribLocation(GLuint program, GLuint index, const GLchar *name);
- void glAttachShader(GLuint program, GLuint shader);
- void glStencilMaskSeparate(GLenum face, GLuint mask);
- void glStencilFuncSeparate(GLenum face, GLenum func, GLint ref, GLuint mask);
- void glStencilOpSeparate(GLenum face, GLenum sfail, GLenum dpfail, GLenum dppass);
- void glDrawBuffers(GLsizei n, const GLenum *bufs);
- void glBlendEquationSeparate(GLenum modeRGB, GLenum modeAlpha);
-
- // OpenGL 2.1 core functions
- void glUniformMatrix4x3fv(GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
- void glUniformMatrix3x4fv(GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
- void glUniformMatrix4x2fv(GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
- void glUniformMatrix2x4fv(GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
- void glUniformMatrix3x2fv(GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
- void glUniformMatrix2x3fv(GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
-
- // OpenGL 3.0 core functions
- GLboolean glIsVertexArray(GLuint array);
- void glGenVertexArrays(GLsizei n, GLuint *arrays);
- void glDeleteVertexArrays(GLsizei n, const GLuint *arrays);
- void glBindVertexArray(GLuint array);
- void glFlushMappedBufferRange(GLenum target, GLintptr offset, GLsizeiptr length);
- void * glMapBufferRange(GLenum target, GLintptr offset, GLsizeiptr length, GLbitfield access);
- void glFramebufferTextureLayer(GLenum target, GLenum attachment, GLuint texture, GLint level, GLint layer);
- void glRenderbufferStorageMultisample(GLenum target, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height);
- void glBlitFramebuffer(GLint srcX0, GLint srcY0, GLint srcX1, GLint srcY1, GLint dstX0, GLint dstY0, GLint dstX1, GLint dstY1, GLbitfield mask, GLenum filter);
- void glGenerateMipmap(GLenum target);
- void glGetFramebufferAttachmentParameteriv(GLenum target, GLenum attachment, GLenum pname, GLint *params);
- void glFramebufferRenderbuffer(GLenum target, GLenum attachment, GLenum renderbuffertarget, GLuint renderbuffer);
- void glFramebufferTexture3D(GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level, GLint zoffset);
- void glFramebufferTexture2D(GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level);
- void glFramebufferTexture1D(GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level);
- GLenum glCheckFramebufferStatus(GLenum target);
- void glGenFramebuffers(GLsizei n, GLuint *framebuffers);
- void glDeleteFramebuffers(GLsizei n, const GLuint *framebuffers);
- void glBindFramebuffer(GLenum target, GLuint framebuffer);
- GLboolean glIsFramebuffer(GLuint framebuffer);
- void glGetRenderbufferParameteriv(GLenum target, GLenum pname, GLint *params);
- void glRenderbufferStorage(GLenum target, GLenum internalformat, GLsizei width, GLsizei height);
- void glGenRenderbuffers(GLsizei n, GLuint *renderbuffers);
- void glDeleteRenderbuffers(GLsizei n, const GLuint *renderbuffers);
- void glBindRenderbuffer(GLenum target, GLuint renderbuffer);
- GLboolean glIsRenderbuffer(GLuint renderbuffer);
- const GLubyte * glGetStringi(GLenum name, GLuint index);
- void glClearBufferfi(GLenum buffer, GLint drawbuffer, GLfloat depth, GLint stencil);
- void glClearBufferfv(GLenum buffer, GLint drawbuffer, const GLfloat *value);
- void glClearBufferuiv(GLenum buffer, GLint drawbuffer, const GLuint *value);
- void glClearBufferiv(GLenum buffer, GLint drawbuffer, const GLint *value);
- void glGetTexParameterIuiv(GLenum target, GLenum pname, GLuint *params);
- void glGetTexParameterIiv(GLenum target, GLenum pname, GLint *params);
- void glTexParameterIuiv(GLenum target, GLenum pname, const GLuint *params);
- void glTexParameterIiv(GLenum target, GLenum pname, const GLint *params);
- void glUniform4uiv(GLint location, GLsizei count, const GLuint *value);
- void glUniform3uiv(GLint location, GLsizei count, const GLuint *value);
- void glUniform2uiv(GLint location, GLsizei count, const GLuint *value);
- void glUniform1uiv(GLint location, GLsizei count, const GLuint *value);
- void glUniform4ui(GLint location, GLuint v0, GLuint v1, GLuint v2, GLuint v3);
- void glUniform3ui(GLint location, GLuint v0, GLuint v1, GLuint v2);
- void glUniform2ui(GLint location, GLuint v0, GLuint v1);
- void glUniform1ui(GLint location, GLuint v0);
- GLint glGetFragDataLocation(GLuint program, const GLchar *name);
- void glBindFragDataLocation(GLuint program, GLuint color, const GLchar *name);
- void glGetUniformuiv(GLuint program, GLint location, GLuint *params);
- void glVertexAttribI4usv(GLuint index, const GLushort *v);
- void glVertexAttribI4ubv(GLuint index, const GLubyte *v);
- void glVertexAttribI4sv(GLuint index, const GLshort *v);
- void glVertexAttribI4bv(GLuint index, const GLbyte *v);
- void glVertexAttribI4uiv(GLuint index, const GLuint *v);
- void glVertexAttribI3uiv(GLuint index, const GLuint *v);
- void glVertexAttribI2uiv(GLuint index, const GLuint *v);
- void glVertexAttribI1uiv(GLuint index, const GLuint *v);
- void glVertexAttribI4iv(GLuint index, const GLint *v);
- void glVertexAttribI3iv(GLuint index, const GLint *v);
- void glVertexAttribI2iv(GLuint index, const GLint *v);
- void glVertexAttribI1iv(GLuint index, const GLint *v);
- void glVertexAttribI4ui(GLuint index, GLuint x, GLuint y, GLuint z, GLuint w);
- void glVertexAttribI3ui(GLuint index, GLuint x, GLuint y, GLuint z);
- void glVertexAttribI2ui(GLuint index, GLuint x, GLuint y);
- void glVertexAttribI1ui(GLuint index, GLuint x);
- void glVertexAttribI4i(GLuint index, GLint x, GLint y, GLint z, GLint w);
- void glVertexAttribI3i(GLuint index, GLint x, GLint y, GLint z);
- void glVertexAttribI2i(GLuint index, GLint x, GLint y);
- void glVertexAttribI1i(GLuint index, GLint x);
- void glGetVertexAttribIuiv(GLuint index, GLenum pname, GLuint *params);
- void glGetVertexAttribIiv(GLuint index, GLenum pname, GLint *params);
- void glVertexAttribIPointer(GLuint index, GLint size, GLenum type, GLsizei stride, const void *pointer);
- void glEndConditionalRender();
- void glBeginConditionalRender(GLuint id, GLenum mode);
- void glClampColor(GLenum target, GLenum clamp);
- void glGetTransformFeedbackVarying(GLuint program, GLuint index, GLsizei bufSize, GLsizei *length, GLsizei *size, GLenum *type, GLchar *name);
- void glTransformFeedbackVaryings(GLuint program, GLsizei count, const GLchar* const *varyings, GLenum bufferMode);
- void glBindBufferBase(GLenum target, GLuint index, GLuint buffer);
- void glBindBufferRange(GLenum target, GLuint index, GLuint buffer, GLintptr offset, GLsizeiptr size);
- void glEndTransformFeedback();
- void glBeginTransformFeedback(GLenum primitiveMode);
- GLboolean glIsEnabledi(GLenum target, GLuint index);
- void glDisablei(GLenum target, GLuint index);
- void glEnablei(GLenum target, GLuint index);
- void glGetIntegeri_v(GLenum target, GLuint index, GLint *data);
- void glGetBooleani_v(GLenum target, GLuint index, GLboolean *data);
- void glColorMaski(GLuint index, GLboolean r, GLboolean g, GLboolean b, GLboolean a);
-
- // OpenGL 3.1 core functions
- void glUniformBlockBinding(GLuint program, GLuint uniformBlockIndex, GLuint uniformBlockBinding);
- void glGetActiveUniformBlockName(GLuint program, GLuint uniformBlockIndex, GLsizei bufSize, GLsizei *length, GLchar *uniformBlockName);
- void glGetActiveUniformBlockiv(GLuint program, GLuint uniformBlockIndex, GLenum pname, GLint *params);
- GLuint glGetUniformBlockIndex(GLuint program, const GLchar *uniformBlockName);
- void glGetActiveUniformName(GLuint program, GLuint uniformIndex, GLsizei bufSize, GLsizei *length, GLchar *uniformName);
- void glGetActiveUniformsiv(GLuint program, GLsizei uniformCount, const GLuint *uniformIndices, GLenum pname, GLint *params);
- void glGetUniformIndices(GLuint program, GLsizei uniformCount, const GLchar *const *uniformNames, GLuint *uniformIndices);
- void glCopyBufferSubData(GLenum readTarget, GLenum writeTarget, GLintptr readOffset, GLintptr writeOffset, GLsizeiptr size);
- void glPrimitiveRestartIndex(GLuint index);
- void glTexBuffer(GLenum target, GLenum internalformat, GLuint buffer);
- void glDrawElementsInstanced(GLenum mode, GLsizei count, GLenum type, const void *indices, GLsizei instancecount);
- void glDrawArraysInstanced(GLenum mode, GLint first, GLsizei count, GLsizei instancecount);
-
- // OpenGL 3.2 core functions
- void glSampleMaski(GLuint maskNumber, GLbitfield mask);
- void glGetMultisamplefv(GLenum pname, GLuint index, GLfloat *val);
- void glTexImage3DMultisample(GLenum target, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth, GLboolean fixedsamplelocations);
- void glTexImage2DMultisample(GLenum target, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height, GLboolean fixedsamplelocations);
- void glFramebufferTexture(GLenum target, GLenum attachment, GLuint texture, GLint level);
- void glGetBufferParameteri64v(GLenum target, GLenum pname, GLint64 *params);
- void glGetInteger64i_v(GLenum target, GLuint index, GLint64 *data);
- void glGetSynciv(GLsync sync, GLenum pname, GLsizei bufSize, GLsizei *length, GLint *values);
- void glGetInteger64v(GLenum pname, GLint64 *data);
- void glWaitSync(GLsync sync, GLbitfield flags, GLuint64 timeout);
- GLenum glClientWaitSync(GLsync sync, GLbitfield flags, GLuint64 timeout);
- void glDeleteSync(GLsync sync);
- GLboolean glIsSync(GLsync sync);
- GLsync glFenceSync(GLenum condition, GLbitfield flags);
- void glProvokingVertex(GLenum mode);
- void glMultiDrawElementsBaseVertex(GLenum mode, const GLsizei *count, GLenum type, const void *const *indices, GLsizei drawcount, const GLint *basevertex);
- void glDrawElementsInstancedBaseVertex(GLenum mode, GLsizei count, GLenum type, const void *indices, GLsizei instancecount, GLint basevertex);
- void glDrawRangeElementsBaseVertex(GLenum mode, GLuint start, GLuint end, GLsizei count, GLenum type, const void *indices, GLint basevertex);
- void glDrawElementsBaseVertex(GLenum mode, GLsizei count, GLenum type, const void *indices, GLint basevertex);
-
- // OpenGL 3.3 core functions
- void glVertexAttribP4uiv(GLuint index, GLenum type, GLboolean normalized, const GLuint *value);
- void glVertexAttribP4ui(GLuint index, GLenum type, GLboolean normalized, GLuint value);
- void glVertexAttribP3uiv(GLuint index, GLenum type, GLboolean normalized, const GLuint *value);
- void glVertexAttribP3ui(GLuint index, GLenum type, GLboolean normalized, GLuint value);
- void glVertexAttribP2uiv(GLuint index, GLenum type, GLboolean normalized, const GLuint *value);
- void glVertexAttribP2ui(GLuint index, GLenum type, GLboolean normalized, GLuint value);
- void glVertexAttribP1uiv(GLuint index, GLenum type, GLboolean normalized, const GLuint *value);
- void glVertexAttribP1ui(GLuint index, GLenum type, GLboolean normalized, GLuint value);
- void glVertexAttribDivisor(GLuint index, GLuint divisor);
- void glGetQueryObjectui64v(GLuint id, GLenum pname, GLuint64 *params);
- void glGetQueryObjecti64v(GLuint id, GLenum pname, GLint64 *params);
- void glQueryCounter(GLuint id, GLenum target);
- void glGetSamplerParameterIuiv(GLuint sampler, GLenum pname, GLuint *params);
- void glGetSamplerParameterfv(GLuint sampler, GLenum pname, GLfloat *params);
- void glGetSamplerParameterIiv(GLuint sampler, GLenum pname, GLint *params);
- void glGetSamplerParameteriv(GLuint sampler, GLenum pname, GLint *params);
- void glSamplerParameterIuiv(GLuint sampler, GLenum pname, const GLuint *param);
- void glSamplerParameterIiv(GLuint sampler, GLenum pname, const GLint *param);
- void glSamplerParameterfv(GLuint sampler, GLenum pname, const GLfloat *param);
- void glSamplerParameterf(GLuint sampler, GLenum pname, GLfloat param);
- void glSamplerParameteriv(GLuint sampler, GLenum pname, const GLint *param);
- void glSamplerParameteri(GLuint sampler, GLenum pname, GLint param);
- void glBindSampler(GLuint unit, GLuint sampler);
- GLboolean glIsSampler(GLuint sampler);
- void glDeleteSamplers(GLsizei count, const GLuint *samplers);
- void glGenSamplers(GLsizei count, GLuint *samplers);
- GLint glGetFragDataIndex(GLuint program, const GLchar *name);
- void glBindFragDataLocationIndexed(GLuint program, GLuint colorNumber, GLuint index, const GLchar *name);
-
- // OpenGL 4.0 core functions
- void glGetQueryIndexediv(GLenum target, GLuint index, GLenum pname, GLint *params);
- void glEndQueryIndexed(GLenum target, GLuint index);
- void glBeginQueryIndexed(GLenum target, GLuint index, GLuint id);
- void glDrawTransformFeedbackStream(GLenum mode, GLuint id, GLuint stream);
- void glDrawTransformFeedback(GLenum mode, GLuint id);
- void glResumeTransformFeedback();
- void glPauseTransformFeedback();
- GLboolean glIsTransformFeedback(GLuint id);
- void glGenTransformFeedbacks(GLsizei n, GLuint *ids);
- void glDeleteTransformFeedbacks(GLsizei n, const GLuint *ids);
- void glBindTransformFeedback(GLenum target, GLuint id);
- void glPatchParameterfv(GLenum pname, const GLfloat *values);
- void glPatchParameteri(GLenum pname, GLint value);
- void glGetProgramStageiv(GLuint program, GLenum shadertype, GLenum pname, GLint *values);
- void glGetUniformSubroutineuiv(GLenum shadertype, GLint location, GLuint *params);
- void glUniformSubroutinesuiv(GLenum shadertype, GLsizei count, const GLuint *indices);
- void glGetActiveSubroutineName(GLuint program, GLenum shadertype, GLuint index, GLsizei bufsize, GLsizei *length, GLchar *name);
- void glGetActiveSubroutineUniformName(GLuint program, GLenum shadertype, GLuint index, GLsizei bufsize, GLsizei *length, GLchar *name);
- void glGetActiveSubroutineUniformiv(GLuint program, GLenum shadertype, GLuint index, GLenum pname, GLint *values);
- GLuint glGetSubroutineIndex(GLuint program, GLenum shadertype, const GLchar *name);
- GLint glGetSubroutineUniformLocation(GLuint program, GLenum shadertype, const GLchar *name);
- void glGetUniformdv(GLuint program, GLint location, GLdouble *params);
- void glUniformMatrix4x3dv(GLint location, GLsizei count, GLboolean transpose, const GLdouble *value);
- void glUniformMatrix4x2dv(GLint location, GLsizei count, GLboolean transpose, const GLdouble *value);
- void glUniformMatrix3x4dv(GLint location, GLsizei count, GLboolean transpose, const GLdouble *value);
- void glUniformMatrix3x2dv(GLint location, GLsizei count, GLboolean transpose, const GLdouble *value);
- void glUniformMatrix2x4dv(GLint location, GLsizei count, GLboolean transpose, const GLdouble *value);
- void glUniformMatrix2x3dv(GLint location, GLsizei count, GLboolean transpose, const GLdouble *value);
- void glUniformMatrix4dv(GLint location, GLsizei count, GLboolean transpose, const GLdouble *value);
- void glUniformMatrix3dv(GLint location, GLsizei count, GLboolean transpose, const GLdouble *value);
- void glUniformMatrix2dv(GLint location, GLsizei count, GLboolean transpose, const GLdouble *value);
- void glUniform4dv(GLint location, GLsizei count, const GLdouble *value);
- void glUniform3dv(GLint location, GLsizei count, const GLdouble *value);
- void glUniform2dv(GLint location, GLsizei count, const GLdouble *value);
- void glUniform1dv(GLint location, GLsizei count, const GLdouble *value);
- void glUniform4d(GLint location, GLdouble x, GLdouble y, GLdouble z, GLdouble w);
- void glUniform3d(GLint location, GLdouble x, GLdouble y, GLdouble z);
- void glUniform2d(GLint location, GLdouble x, GLdouble y);
- void glUniform1d(GLint location, GLdouble x);
- void glDrawElementsIndirect(GLenum mode, GLenum type, const void *indirect);
- void glDrawArraysIndirect(GLenum mode, const void *indirect);
- void glBlendFuncSeparatei(GLuint buf, GLenum srcRGB, GLenum dstRGB, GLenum srcAlpha, GLenum dstAlpha);
- void glBlendFunci(GLuint buf, GLenum src, GLenum dst);
- void glBlendEquationSeparatei(GLuint buf, GLenum modeRGB, GLenum modeAlpha);
- void glBlendEquationi(GLuint buf, GLenum mode);
- void glMinSampleShading(GLfloat value);
-
- // OpenGL 4.1 core functions
- void glGetDoublei_v(GLenum target, GLuint index, GLdouble *data);
- void glGetFloati_v(GLenum target, GLuint index, GLfloat *data);
- void glDepthRangeIndexed(GLuint index, GLdouble n, GLdouble f);
- void glDepthRangeArrayv(GLuint first, GLsizei count, const GLdouble *v);
- void glScissorIndexedv(GLuint index, const GLint *v);
- void glScissorIndexed(GLuint index, GLint left, GLint bottom, GLsizei width, GLsizei height);
- void glScissorArrayv(GLuint first, GLsizei count, const GLint *v);
- void glViewportIndexedfv(GLuint index, const GLfloat *v);
- void glViewportIndexedf(GLuint index, GLfloat x, GLfloat y, GLfloat w, GLfloat h);
- void glViewportArrayv(GLuint first, GLsizei count, const GLfloat *v);
- void glGetVertexAttribLdv(GLuint index, GLenum pname, GLdouble *params);
- void glVertexAttribLPointer(GLuint index, GLint size, GLenum type, GLsizei stride, const void *pointer);
- void glVertexAttribL4dv(GLuint index, const GLdouble *v);
- void glVertexAttribL3dv(GLuint index, const GLdouble *v);
- void glVertexAttribL2dv(GLuint index, const GLdouble *v);
- void glVertexAttribL1dv(GLuint index, const GLdouble *v);
- void glVertexAttribL4d(GLuint index, GLdouble x, GLdouble y, GLdouble z, GLdouble w);
- void glVertexAttribL3d(GLuint index, GLdouble x, GLdouble y, GLdouble z);
- void glVertexAttribL2d(GLuint index, GLdouble x, GLdouble y);
- void glVertexAttribL1d(GLuint index, GLdouble x);
- void glGetProgramPipelineInfoLog(GLuint pipeline, GLsizei bufSize, GLsizei *length, GLchar *infoLog);
- void glValidateProgramPipeline(GLuint pipeline);
- void glProgramUniformMatrix4x3dv(GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLdouble *value);
- void glProgramUniformMatrix3x4dv(GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLdouble *value);
- void glProgramUniformMatrix4x2dv(GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLdouble *value);
- void glProgramUniformMatrix2x4dv(GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLdouble *value);
- void glProgramUniformMatrix3x2dv(GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLdouble *value);
- void glProgramUniformMatrix2x3dv(GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLdouble *value);
- void glProgramUniformMatrix4x3fv(GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
- void glProgramUniformMatrix3x4fv(GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
- void glProgramUniformMatrix4x2fv(GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
- void glProgramUniformMatrix2x4fv(GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
- void glProgramUniformMatrix3x2fv(GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
- void glProgramUniformMatrix2x3fv(GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
- void glProgramUniformMatrix4dv(GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLdouble *value);
- void glProgramUniformMatrix3dv(GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLdouble *value);
- void glProgramUniformMatrix2dv(GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLdouble *value);
- void glProgramUniformMatrix4fv(GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
- void glProgramUniformMatrix3fv(GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
- void glProgramUniformMatrix2fv(GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
- void glProgramUniform4uiv(GLuint program, GLint location, GLsizei count, const GLuint *value);
- void glProgramUniform4ui(GLuint program, GLint location, GLuint v0, GLuint v1, GLuint v2, GLuint v3);
- void glProgramUniform4dv(GLuint program, GLint location, GLsizei count, const GLdouble *value);
- void glProgramUniform4d(GLuint program, GLint location, GLdouble v0, GLdouble v1, GLdouble v2, GLdouble v3);
- void glProgramUniform4fv(GLuint program, GLint location, GLsizei count, const GLfloat *value);
- void glProgramUniform4f(GLuint program, GLint location, GLfloat v0, GLfloat v1, GLfloat v2, GLfloat v3);
- void glProgramUniform4iv(GLuint program, GLint location, GLsizei count, const GLint *value);
- void glProgramUniform4i(GLuint program, GLint location, GLint v0, GLint v1, GLint v2, GLint v3);
- void glProgramUniform3uiv(GLuint program, GLint location, GLsizei count, const GLuint *value);
- void glProgramUniform3ui(GLuint program, GLint location, GLuint v0, GLuint v1, GLuint v2);
- void glProgramUniform3dv(GLuint program, GLint location, GLsizei count, const GLdouble *value);
- void glProgramUniform3d(GLuint program, GLint location, GLdouble v0, GLdouble v1, GLdouble v2);
- void glProgramUniform3fv(GLuint program, GLint location, GLsizei count, const GLfloat *value);
- void glProgramUniform3f(GLuint program, GLint location, GLfloat v0, GLfloat v1, GLfloat v2);
- void glProgramUniform3iv(GLuint program, GLint location, GLsizei count, const GLint *value);
- void glProgramUniform3i(GLuint program, GLint location, GLint v0, GLint v1, GLint v2);
- void glProgramUniform2uiv(GLuint program, GLint location, GLsizei count, const GLuint *value);
- void glProgramUniform2ui(GLuint program, GLint location, GLuint v0, GLuint v1);
- void glProgramUniform2dv(GLuint program, GLint location, GLsizei count, const GLdouble *value);
- void glProgramUniform2d(GLuint program, GLint location, GLdouble v0, GLdouble v1);
- void glProgramUniform2fv(GLuint program, GLint location, GLsizei count, const GLfloat *value);
- void glProgramUniform2f(GLuint program, GLint location, GLfloat v0, GLfloat v1);
- void glProgramUniform2iv(GLuint program, GLint location, GLsizei count, const GLint *value);
- void glProgramUniform2i(GLuint program, GLint location, GLint v0, GLint v1);
- void glProgramUniform1uiv(GLuint program, GLint location, GLsizei count, const GLuint *value);
- void glProgramUniform1ui(GLuint program, GLint location, GLuint v0);
- void glProgramUniform1dv(GLuint program, GLint location, GLsizei count, const GLdouble *value);
- void glProgramUniform1d(GLuint program, GLint location, GLdouble v0);
- void glProgramUniform1fv(GLuint program, GLint location, GLsizei count, const GLfloat *value);
- void glProgramUniform1f(GLuint program, GLint location, GLfloat v0);
- void glProgramUniform1iv(GLuint program, GLint location, GLsizei count, const GLint *value);
- void glProgramUniform1i(GLuint program, GLint location, GLint v0);
- void glGetProgramPipelineiv(GLuint pipeline, GLenum pname, GLint *params);
- GLboolean glIsProgramPipeline(GLuint pipeline);
- void glGenProgramPipelines(GLsizei n, GLuint *pipelines);
- void glDeleteProgramPipelines(GLsizei n, const GLuint *pipelines);
- void glBindProgramPipeline(GLuint pipeline);
- GLuint glCreateShaderProgramv(GLenum type, GLsizei count, const GLchar* const *strings);
- void glActiveShaderProgram(GLuint pipeline, GLuint program);
- void glUseProgramStages(GLuint pipeline, GLbitfield stages, GLuint program);
- void glProgramParameteri(GLuint program, GLenum pname, GLint value);
- void glProgramBinary(GLuint program, GLenum binaryFormat, const void *binary, GLsizei length);
- void glGetProgramBinary(GLuint program, GLsizei bufSize, GLsizei *length, GLenum *binaryFormat, void *binary);
- void glClearDepthf(GLfloat dd);
- void glDepthRangef(GLfloat n, GLfloat f);
- void glGetShaderPrecisionFormat(GLenum shadertype, GLenum precisiontype, GLint *range, GLint *precision);
- void glShaderBinary(GLsizei count, const GLuint *shaders, GLenum binaryformat, const void *binary, GLsizei length);
- void glReleaseShaderCompiler();
-
- // OpenGL 4.2 core functions
- void glDrawTransformFeedbackStreamInstanced(GLenum mode, GLuint id, GLuint stream, GLsizei instancecount);
- void glDrawTransformFeedbackInstanced(GLenum mode, GLuint id, GLsizei instancecount);
- void glTexStorage3D(GLenum target, GLsizei levels, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth);
- void glTexStorage2D(GLenum target, GLsizei levels, GLenum internalformat, GLsizei width, GLsizei height);
- void glTexStorage1D(GLenum target, GLsizei levels, GLenum internalformat, GLsizei width);
- void glMemoryBarrier(GLbitfield barriers);
- void glBindImageTexture(GLuint unit, GLuint texture, GLint level, GLboolean layered, GLint layer, GLenum access, GLenum format);
- void glGetActiveAtomicCounterBufferiv(GLuint program, GLuint bufferIndex, GLenum pname, GLint *params);
- void glGetInternalformativ(GLenum target, GLenum internalformat, GLenum pname, GLsizei bufSize, GLint *params);
- void glDrawElementsInstancedBaseVertexBaseInstance(GLenum mode, GLsizei count, GLenum type, const void *indices, GLsizei instancecount, GLint basevertex, GLuint baseinstance);
- void glDrawElementsInstancedBaseInstance(GLenum mode, GLsizei count, GLenum type, const void *indices, GLsizei instancecount, GLuint baseinstance);
- void glDrawArraysInstancedBaseInstance(GLenum mode, GLint first, GLsizei count, GLsizei instancecount, GLuint baseinstance);
-
- // OpenGL 4.3 core functions
- void glGetObjectPtrLabel(const void *ptr, GLsizei bufSize, GLsizei *length, GLchar *label);
- void glObjectPtrLabel(const void *ptr, GLsizei length, const GLchar *label);
- void glGetObjectLabel(GLenum identifier, GLuint name, GLsizei bufSize, GLsizei *length, GLchar *label);
- void glObjectLabel(GLenum identifier, GLuint name, GLsizei length, const GLchar *label);
- void glPopDebugGroup();
- void glPushDebugGroup(GLenum source, GLuint id, GLsizei length, const GLchar *message);
- GLuint glGetDebugMessageLog(GLuint count, GLsizei bufSize, GLenum *sources, GLenum *types, GLuint *ids, GLenum *severities, GLsizei *lengths, GLchar *messageLog);
- void glDebugMessageCallback(GLDEBUGPROC callback, const void *userParam);
- void glDebugMessageInsert(GLenum source, GLenum type, GLuint id, GLenum severity, GLsizei length, const GLchar *buf);
- void glDebugMessageControl(GLenum source, GLenum type, GLenum severity, GLsizei count, const GLuint *ids, GLboolean enabled);
- void glVertexBindingDivisor(GLuint bindingindex, GLuint divisor);
- void glVertexAttribBinding(GLuint attribindex, GLuint bindingindex);
- void glVertexAttribLFormat(GLuint attribindex, GLint size, GLenum type, GLuint relativeoffset);
- void glVertexAttribIFormat(GLuint attribindex, GLint size, GLenum type, GLuint relativeoffset);
- void glVertexAttribFormat(GLuint attribindex, GLint size, GLenum type, GLboolean normalized, GLuint relativeoffset);
- void glBindVertexBuffer(GLuint bindingindex, GLuint buffer, GLintptr offset, GLsizei stride);
- void glTextureView(GLuint texture, GLenum target, GLuint origtexture, GLenum internalformat, GLuint minlevel, GLuint numlevels, GLuint minlayer, GLuint numlayers);
- void glTexStorage3DMultisample(GLenum target, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth, GLboolean fixedsamplelocations);
- void glTexStorage2DMultisample(GLenum target, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height, GLboolean fixedsamplelocations);
- void glTexBufferRange(GLenum target, GLenum internalformat, GLuint buffer, GLintptr offset, GLsizeiptr size);
- void glShaderStorageBlockBinding(GLuint program, GLuint storageBlockIndex, GLuint storageBlockBinding);
- GLint glGetProgramResourceLocationIndex(GLuint program, GLenum programInterface, const GLchar *name);
- GLint glGetProgramResourceLocation(GLuint program, GLenum programInterface, const GLchar *name);
- void glGetProgramResourceiv(GLuint program, GLenum programInterface, GLuint index, GLsizei propCount, const GLenum *props, GLsizei bufSize, GLsizei *length, GLint *params);
- void glGetProgramResourceName(GLuint program, GLenum programInterface, GLuint index, GLsizei bufSize, GLsizei *length, GLchar *name);
- GLuint glGetProgramResourceIndex(GLuint program, GLenum programInterface, const GLchar *name);
- void glGetProgramInterfaceiv(GLuint program, GLenum programInterface, GLenum pname, GLint *params);
- void glMultiDrawElementsIndirect(GLenum mode, GLenum type, const void *indirect, GLsizei drawcount, GLsizei stride);
- void glMultiDrawArraysIndirect(GLenum mode, const void *indirect, GLsizei drawcount, GLsizei stride);
- void glInvalidateSubFramebuffer(GLenum target, GLsizei numAttachments, const GLenum *attachments, GLint x, GLint y, GLsizei width, GLsizei height);
- void glInvalidateFramebuffer(GLenum target, GLsizei numAttachments, const GLenum *attachments);
- void glInvalidateBufferData(GLuint buffer);
- void glInvalidateBufferSubData(GLuint buffer, GLintptr offset, GLsizeiptr length);
- void glInvalidateTexImage(GLuint texture, GLint level);
- void glInvalidateTexSubImage(GLuint texture, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth);
- void glGetInternalformati64v(GLenum target, GLenum internalformat, GLenum pname, GLsizei bufSize, GLint64 *params);
- void glGetFramebufferParameteriv(GLenum target, GLenum pname, GLint *params);
- void glFramebufferParameteri(GLenum target, GLenum pname, GLint param);
- void glCopyImageSubData(GLuint srcName, GLenum srcTarget, GLint srcLevel, GLint srcX, GLint srcY, GLint srcZ, GLuint dstName, GLenum dstTarget, GLint dstLevel, GLint dstX, GLint dstY, GLint dstZ, GLsizei srcWidth, GLsizei srcHeight, GLsizei srcDepth);
- void glDispatchComputeIndirect(GLintptr indirect);
- void glDispatchCompute(GLuint num_groups_x, GLuint num_groups_y, GLuint num_groups_z);
- void glClearBufferSubData(GLenum target, GLenum internalformat, GLintptr offset, GLsizeiptr size, GLenum format, GLenum type, const void *data);
- void glClearBufferData(GLenum target, GLenum internalformat, GLenum format, GLenum type, const void *data);
-
- // OpenGL 4.4 core functions
- void glBindVertexBuffers(GLuint first, GLsizei count, const GLuint *buffers, const GLintptr *offsets, const GLsizei *strides);
- void glBindImageTextures(GLuint first, GLsizei count, const GLuint *textures);
- void glBindSamplers(GLuint first, GLsizei count, const GLuint *samplers);
- void glBindTextures(GLuint first, GLsizei count, const GLuint *textures);
- void glBindBuffersRange(GLenum target, GLuint first, GLsizei count, const GLuint *buffers, const GLintptr *offsets, const GLsizeiptr *sizes);
- void glBindBuffersBase(GLenum target, GLuint first, GLsizei count, const GLuint *buffers);
- void glClearTexSubImage(GLuint texture, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLenum type, const void *data);
- void glClearTexImage(GLuint texture, GLint level, GLenum format, GLenum type, const void *data);
- void glBufferStorage(GLenum target, GLsizeiptr size, const void *data, GLbitfield flags);
-
- // OpenGL 1.0 deprecated functions
- void glTranslatef(GLfloat x, GLfloat y, GLfloat z);
- void glTranslated(GLdouble x, GLdouble y, GLdouble z);
- void glScalef(GLfloat x, GLfloat y, GLfloat z);
- void glScaled(GLdouble x, GLdouble y, GLdouble z);
- void glRotatef(GLfloat angle, GLfloat x, GLfloat y, GLfloat z);
- void glRotated(GLdouble angle, GLdouble x, GLdouble y, GLdouble z);
- void glPushMatrix();
- void glPopMatrix();
- void glOrtho(GLdouble left, GLdouble right, GLdouble bottom, GLdouble top, GLdouble zNear, GLdouble zFar);
- void glMultMatrixd(const GLdouble *m);
- void glMultMatrixf(const GLfloat *m);
- void glMatrixMode(GLenum mode);
- void glLoadMatrixd(const GLdouble *m);
- void glLoadMatrixf(const GLfloat *m);
- void glLoadIdentity();
- void glFrustum(GLdouble left, GLdouble right, GLdouble bottom, GLdouble top, GLdouble zNear, GLdouble zFar);
- GLboolean glIsList(GLuint list);
- void glGetTexGeniv(GLenum coord, GLenum pname, GLint *params);
- void glGetTexGenfv(GLenum coord, GLenum pname, GLfloat *params);
- void glGetTexGendv(GLenum coord, GLenum pname, GLdouble *params);
- void glGetTexEnviv(GLenum target, GLenum pname, GLint *params);
- void glGetTexEnvfv(GLenum target, GLenum pname, GLfloat *params);
- void glGetPolygonStipple(GLubyte *mask);
- void glGetPixelMapusv(GLenum map, GLushort *values);
- void glGetPixelMapuiv(GLenum map, GLuint *values);
- void glGetPixelMapfv(GLenum map, GLfloat *values);
- void glGetMaterialiv(GLenum face, GLenum pname, GLint *params);
- void glGetMaterialfv(GLenum face, GLenum pname, GLfloat *params);
- void glGetMapiv(GLenum target, GLenum query, GLint *v);
- void glGetMapfv(GLenum target, GLenum query, GLfloat *v);
- void glGetMapdv(GLenum target, GLenum query, GLdouble *v);
- void glGetLightiv(GLenum light, GLenum pname, GLint *params);
- void glGetLightfv(GLenum light, GLenum pname, GLfloat *params);
- void glGetClipPlane(GLenum plane, GLdouble *equation);
- void glDrawPixels(GLsizei width, GLsizei height, GLenum format, GLenum type, const void *pixels);
- void glCopyPixels(GLint x, GLint y, GLsizei width, GLsizei height, GLenum type);
- void glPixelMapusv(GLenum map, GLsizei mapsize, const GLushort *values);
- void glPixelMapuiv(GLenum map, GLsizei mapsize, const GLuint *values);
- void glPixelMapfv(GLenum map, GLsizei mapsize, const GLfloat *values);
- void glPixelTransferi(GLenum pname, GLint param);
- void glPixelTransferf(GLenum pname, GLfloat param);
- void glPixelZoom(GLfloat xfactor, GLfloat yfactor);
- void glAlphaFunc(GLenum func, GLfloat ref);
- void glEvalPoint2(GLint i, GLint j);
- void glEvalMesh2(GLenum mode, GLint i1, GLint i2, GLint j1, GLint j2);
- void glEvalPoint1(GLint i);
- void glEvalMesh1(GLenum mode, GLint i1, GLint i2);
- void glEvalCoord2fv(const GLfloat *u);
- void glEvalCoord2f(GLfloat u, GLfloat v);
- void glEvalCoord2dv(const GLdouble *u);
- void glEvalCoord2d(GLdouble u, GLdouble v);
- void glEvalCoord1fv(const GLfloat *u);
- void glEvalCoord1f(GLfloat u);
- void glEvalCoord1dv(const GLdouble *u);
- void glEvalCoord1d(GLdouble u);
- void glMapGrid2f(GLint un, GLfloat u1, GLfloat u2, GLint vn, GLfloat v1, GLfloat v2);
- void glMapGrid2d(GLint un, GLdouble u1, GLdouble u2, GLint vn, GLdouble v1, GLdouble v2);
- void glMapGrid1f(GLint un, GLfloat u1, GLfloat u2);
- void glMapGrid1d(GLint un, GLdouble u1, GLdouble u2);
- void glMap2f(GLenum target, GLfloat u1, GLfloat u2, GLint ustride, GLint uorder, GLfloat v1, GLfloat v2, GLint vstride, GLint vorder, const GLfloat *points);
- void glMap2d(GLenum target, GLdouble u1, GLdouble u2, GLint ustride, GLint uorder, GLdouble v1, GLdouble v2, GLint vstride, GLint vorder, const GLdouble *points);
- void glMap1f(GLenum target, GLfloat u1, GLfloat u2, GLint stride, GLint order, const GLfloat *points);
- void glMap1d(GLenum target, GLdouble u1, GLdouble u2, GLint stride, GLint order, const GLdouble *points);
- void glPushAttrib(GLbitfield mask);
- void glPopAttrib();
- void glAccum(GLenum op, GLfloat value);
- void glIndexMask(GLuint mask);
- void glClearIndex(GLfloat c);
- void glClearAccum(GLfloat red, GLfloat green, GLfloat blue, GLfloat alpha);
- void glPushName(GLuint name);
- void glPopName();
- void glPassThrough(GLfloat token);
- void glLoadName(GLuint name);
- void glInitNames();
- GLint glRenderMode(GLenum mode);
- void glSelectBuffer(GLsizei size, GLuint *buffer);
- void glFeedbackBuffer(GLsizei size, GLenum type, GLfloat *buffer);
- void glTexGeniv(GLenum coord, GLenum pname, const GLint *params);
- void glTexGeni(GLenum coord, GLenum pname, GLint param);
- void glTexGenfv(GLenum coord, GLenum pname, const GLfloat *params);
- void glTexGenf(GLenum coord, GLenum pname, GLfloat param);
- void glTexGendv(GLenum coord, GLenum pname, const GLdouble *params);
- void glTexGend(GLenum coord, GLenum pname, GLdouble param);
- void glTexEnviv(GLenum target, GLenum pname, const GLint *params);
- void glTexEnvi(GLenum target, GLenum pname, GLint param);
- void glTexEnvfv(GLenum target, GLenum pname, const GLfloat *params);
- void glTexEnvf(GLenum target, GLenum pname, GLfloat param);
- void glShadeModel(GLenum mode);
- void glPolygonStipple(const GLubyte *mask);
- void glMaterialiv(GLenum face, GLenum pname, const GLint *params);
- void glMateriali(GLenum face, GLenum pname, GLint param);
- void glMaterialfv(GLenum face, GLenum pname, const GLfloat *params);
- void glMaterialf(GLenum face, GLenum pname, GLfloat param);
- void glLineStipple(GLint factor, GLushort pattern);
- void glLightModeliv(GLenum pname, const GLint *params);
- void glLightModeli(GLenum pname, GLint param);
- void glLightModelfv(GLenum pname, const GLfloat *params);
- void glLightModelf(GLenum pname, GLfloat param);
- void glLightiv(GLenum light, GLenum pname, const GLint *params);
- void glLighti(GLenum light, GLenum pname, GLint param);
- void glLightfv(GLenum light, GLenum pname, const GLfloat *params);
- void glLightf(GLenum light, GLenum pname, GLfloat param);
- void glFogiv(GLenum pname, const GLint *params);
- void glFogi(GLenum pname, GLint param);
- void glFogfv(GLenum pname, const GLfloat *params);
- void glFogf(GLenum pname, GLfloat param);
- void glColorMaterial(GLenum face, GLenum mode);
- void glClipPlane(GLenum plane, const GLdouble *equation);
- void glVertex4sv(const GLshort *v);
- void glVertex4s(GLshort x, GLshort y, GLshort z, GLshort w);
- void glVertex4iv(const GLint *v);
- void glVertex4i(GLint x, GLint y, GLint z, GLint w);
- void glVertex4fv(const GLfloat *v);
- void glVertex4f(GLfloat x, GLfloat y, GLfloat z, GLfloat w);
- void glVertex4dv(const GLdouble *v);
- void glVertex4d(GLdouble x, GLdouble y, GLdouble z, GLdouble w);
- void glVertex3sv(const GLshort *v);
- void glVertex3s(GLshort x, GLshort y, GLshort z);
- void glVertex3iv(const GLint *v);
- void glVertex3i(GLint x, GLint y, GLint z);
- void glVertex3fv(const GLfloat *v);
- void glVertex3f(GLfloat x, GLfloat y, GLfloat z);
- void glVertex3dv(const GLdouble *v);
- void glVertex3d(GLdouble x, GLdouble y, GLdouble z);
- void glVertex2sv(const GLshort *v);
- void glVertex2s(GLshort x, GLshort y);
- void glVertex2iv(const GLint *v);
- void glVertex2i(GLint x, GLint y);
- void glVertex2fv(const GLfloat *v);
- void glVertex2f(GLfloat x, GLfloat y);
- void glVertex2dv(const GLdouble *v);
- void glVertex2d(GLdouble x, GLdouble y);
- void glTexCoord4sv(const GLshort *v);
- void glTexCoord4s(GLshort s, GLshort t, GLshort r, GLshort q);
- void glTexCoord4iv(const GLint *v);
- void glTexCoord4i(GLint s, GLint t, GLint r, GLint q);
- void glTexCoord4fv(const GLfloat *v);
- void glTexCoord4f(GLfloat s, GLfloat t, GLfloat r, GLfloat q);
- void glTexCoord4dv(const GLdouble *v);
- void glTexCoord4d(GLdouble s, GLdouble t, GLdouble r, GLdouble q);
- void glTexCoord3sv(const GLshort *v);
- void glTexCoord3s(GLshort s, GLshort t, GLshort r);
- void glTexCoord3iv(const GLint *v);
- void glTexCoord3i(GLint s, GLint t, GLint r);
- void glTexCoord3fv(const GLfloat *v);
- void glTexCoord3f(GLfloat s, GLfloat t, GLfloat r);
- void glTexCoord3dv(const GLdouble *v);
- void glTexCoord3d(GLdouble s, GLdouble t, GLdouble r);
- void glTexCoord2sv(const GLshort *v);
- void glTexCoord2s(GLshort s, GLshort t);
- void glTexCoord2iv(const GLint *v);
- void glTexCoord2i(GLint s, GLint t);
- void glTexCoord2fv(const GLfloat *v);
- void glTexCoord2f(GLfloat s, GLfloat t);
- void glTexCoord2dv(const GLdouble *v);
- void glTexCoord2d(GLdouble s, GLdouble t);
- void glTexCoord1sv(const GLshort *v);
- void glTexCoord1s(GLshort s);
- void glTexCoord1iv(const GLint *v);
- void glTexCoord1i(GLint s);
- void glTexCoord1fv(const GLfloat *v);
- void glTexCoord1f(GLfloat s);
- void glTexCoord1dv(const GLdouble *v);
- void glTexCoord1d(GLdouble s);
- void glRectsv(const GLshort *v1, const GLshort *v2);
- void glRects(GLshort x1, GLshort y1, GLshort x2, GLshort y2);
- void glRectiv(const GLint *v1, const GLint *v2);
- void glRecti(GLint x1, GLint y1, GLint x2, GLint y2);
- void glRectfv(const GLfloat *v1, const GLfloat *v2);
- void glRectf(GLfloat x1, GLfloat y1, GLfloat x2, GLfloat y2);
- void glRectdv(const GLdouble *v1, const GLdouble *v2);
- void glRectd(GLdouble x1, GLdouble y1, GLdouble x2, GLdouble y2);
- void glRasterPos4sv(const GLshort *v);
- void glRasterPos4s(GLshort x, GLshort y, GLshort z, GLshort w);
- void glRasterPos4iv(const GLint *v);
- void glRasterPos4i(GLint x, GLint y, GLint z, GLint w);
- void glRasterPos4fv(const GLfloat *v);
- void glRasterPos4f(GLfloat x, GLfloat y, GLfloat z, GLfloat w);
- void glRasterPos4dv(const GLdouble *v);
- void glRasterPos4d(GLdouble x, GLdouble y, GLdouble z, GLdouble w);
- void glRasterPos3sv(const GLshort *v);
- void glRasterPos3s(GLshort x, GLshort y, GLshort z);
- void glRasterPos3iv(const GLint *v);
- void glRasterPos3i(GLint x, GLint y, GLint z);
- void glRasterPos3fv(const GLfloat *v);
- void glRasterPos3f(GLfloat x, GLfloat y, GLfloat z);
- void glRasterPos3dv(const GLdouble *v);
- void glRasterPos3d(GLdouble x, GLdouble y, GLdouble z);
- void glRasterPos2sv(const GLshort *v);
- void glRasterPos2s(GLshort x, GLshort y);
- void glRasterPos2iv(const GLint *v);
- void glRasterPos2i(GLint x, GLint y);
- void glRasterPos2fv(const GLfloat *v);
- void glRasterPos2f(GLfloat x, GLfloat y);
- void glRasterPos2dv(const GLdouble *v);
- void glRasterPos2d(GLdouble x, GLdouble y);
- void glNormal3sv(const GLshort *v);
- void glNormal3s(GLshort nx, GLshort ny, GLshort nz);
- void glNormal3iv(const GLint *v);
- void glNormal3i(GLint nx, GLint ny, GLint nz);
- void glNormal3fv(const GLfloat *v);
- void glNormal3f(GLfloat nx, GLfloat ny, GLfloat nz);
- void glNormal3dv(const GLdouble *v);
- void glNormal3d(GLdouble nx, GLdouble ny, GLdouble nz);
- void glNormal3bv(const GLbyte *v);
- void glNormal3b(GLbyte nx, GLbyte ny, GLbyte nz);
- void glIndexsv(const GLshort *c);
- void glIndexs(GLshort c);
- void glIndexiv(const GLint *c);
- void glIndexi(GLint c);
- void glIndexfv(const GLfloat *c);
- void glIndexf(GLfloat c);
- void glIndexdv(const GLdouble *c);
- void glIndexd(GLdouble c);
- void glEnd();
- void glEdgeFlagv(const GLboolean *flag);
- void glEdgeFlag(GLboolean flag);
- void glColor4usv(const GLushort *v);
- void glColor4us(GLushort red, GLushort green, GLushort blue, GLushort alpha);
- void glColor4uiv(const GLuint *v);
- void glColor4ui(GLuint red, GLuint green, GLuint blue, GLuint alpha);
- void glColor4ubv(const GLubyte *v);
- void glColor4ub(GLubyte red, GLubyte green, GLubyte blue, GLubyte alpha);
- void glColor4sv(const GLshort *v);
- void glColor4s(GLshort red, GLshort green, GLshort blue, GLshort alpha);
- void glColor4iv(const GLint *v);
- void glColor4i(GLint red, GLint green, GLint blue, GLint alpha);
- void glColor4fv(const GLfloat *v);
- void glColor4f(GLfloat red, GLfloat green, GLfloat blue, GLfloat alpha);
- void glColor4dv(const GLdouble *v);
- void glColor4d(GLdouble red, GLdouble green, GLdouble blue, GLdouble alpha);
- void glColor4bv(const GLbyte *v);
- void glColor4b(GLbyte red, GLbyte green, GLbyte blue, GLbyte alpha);
- void glColor3usv(const GLushort *v);
- void glColor3us(GLushort red, GLushort green, GLushort blue);
- void glColor3uiv(const GLuint *v);
- void glColor3ui(GLuint red, GLuint green, GLuint blue);
- void glColor3ubv(const GLubyte *v);
- void glColor3ub(GLubyte red, GLubyte green, GLubyte blue);
- void glColor3sv(const GLshort *v);
- void glColor3s(GLshort red, GLshort green, GLshort blue);
- void glColor3iv(const GLint *v);
- void glColor3i(GLint red, GLint green, GLint blue);
- void glColor3fv(const GLfloat *v);
- void glColor3f(GLfloat red, GLfloat green, GLfloat blue);
- void glColor3dv(const GLdouble *v);
- void glColor3d(GLdouble red, GLdouble green, GLdouble blue);
- void glColor3bv(const GLbyte *v);
- void glColor3b(GLbyte red, GLbyte green, GLbyte blue);
- void glBitmap(GLsizei width, GLsizei height, GLfloat xorig, GLfloat yorig, GLfloat xmove, GLfloat ymove, const GLubyte *bitmap);
- void glBegin(GLenum mode);
- void glListBase(GLuint base);
- GLuint glGenLists(GLsizei range);
- void glDeleteLists(GLuint list, GLsizei range);
- void glCallLists(GLsizei n, GLenum type, const void *lists);
- void glCallList(GLuint list);
- void glEndList();
- void glNewList(GLuint list, GLenum mode);
-
- // OpenGL 1.1 deprecated functions
- void glPushClientAttrib(GLbitfield mask);
- void glPopClientAttrib();
- void glIndexubv(const GLubyte *c);
- void glIndexub(GLubyte c);
- void glPrioritizeTextures(GLsizei n, const GLuint *textures, const GLfloat *priorities);
- GLboolean glAreTexturesResident(GLsizei n, const GLuint *textures, GLboolean *residences);
- void glVertexPointer(GLint size, GLenum type, GLsizei stride, const void *pointer);
- void glTexCoordPointer(GLint size, GLenum type, GLsizei stride, const void *pointer);
- void glNormalPointer(GLenum type, GLsizei stride, const void *pointer);
- void glInterleavedArrays(GLenum format, GLsizei stride, const void *pointer);
- void glGetPointerv(GLenum pname, void * *params);
- void glIndexPointer(GLenum type, GLsizei stride, const void *pointer);
- void glEnableClientState(GLenum array);
- void glEdgeFlagPointer(GLsizei stride, const void *pointer);
- void glDisableClientState(GLenum array);
- void glColorPointer(GLint size, GLenum type, GLsizei stride, const void *pointer);
- void glArrayElement(GLint i);
-
- // OpenGL 1.2 deprecated functions
- void glColorTable(GLenum target, GLenum internalformat, GLsizei width, GLenum format, GLenum type, const void *table);
- void glColorTableParameterfv(GLenum target, GLenum pname, const GLfloat *params);
- void glColorTableParameteriv(GLenum target, GLenum pname, const GLint *params);
- void glCopyColorTable(GLenum target, GLenum internalformat, GLint x, GLint y, GLsizei width);
- void glGetColorTable(GLenum target, GLenum format, GLenum type, void *table);
- void glGetColorTableParameterfv(GLenum target, GLenum pname, GLfloat *params);
- void glGetColorTableParameteriv(GLenum target, GLenum pname, GLint *params);
- void glColorSubTable(GLenum target, GLsizei start, GLsizei count, GLenum format, GLenum type, const void *data);
- void glCopyColorSubTable(GLenum target, GLsizei start, GLint x, GLint y, GLsizei width);
- void glConvolutionFilter1D(GLenum target, GLenum internalformat, GLsizei width, GLenum format, GLenum type, const void *image);
- void glConvolutionFilter2D(GLenum target, GLenum internalformat, GLsizei width, GLsizei height, GLenum format, GLenum type, const void *image);
- void glConvolutionParameterf(GLenum target, GLenum pname, GLfloat params);
- void glConvolutionParameterfv(GLenum target, GLenum pname, const GLfloat *params);
- void glConvolutionParameteri(GLenum target, GLenum pname, GLint params);
- void glConvolutionParameteriv(GLenum target, GLenum pname, const GLint *params);
- void glCopyConvolutionFilter1D(GLenum target, GLenum internalformat, GLint x, GLint y, GLsizei width);
- void glCopyConvolutionFilter2D(GLenum target, GLenum internalformat, GLint x, GLint y, GLsizei width, GLsizei height);
- void glGetConvolutionFilter(GLenum target, GLenum format, GLenum type, void *image);
- void glGetConvolutionParameterfv(GLenum target, GLenum pname, GLfloat *params);
- void glGetConvolutionParameteriv(GLenum target, GLenum pname, GLint *params);
- void glGetSeparableFilter(GLenum target, GLenum format, GLenum type, void *row, void *column, void *span);
- void glSeparableFilter2D(GLenum target, GLenum internalformat, GLsizei width, GLsizei height, GLenum format, GLenum type, const void *row, const void *column);
- void glGetHistogram(GLenum target, GLboolean reset, GLenum format, GLenum type, void *values);
- void glGetHistogramParameterfv(GLenum target, GLenum pname, GLfloat *params);
- void glGetHistogramParameteriv(GLenum target, GLenum pname, GLint *params);
- void glGetMinmax(GLenum target, GLboolean reset, GLenum format, GLenum type, void *values);
- void glGetMinmaxParameterfv(GLenum target, GLenum pname, GLfloat *params);
- void glGetMinmaxParameteriv(GLenum target, GLenum pname, GLint *params);
- void glHistogram(GLenum target, GLsizei width, GLenum internalformat, GLboolean sink);
- void glMinmax(GLenum target, GLenum internalformat, GLboolean sink);
- void glResetHistogram(GLenum target);
- void glResetMinmax(GLenum target);
-
- // OpenGL 1.3 deprecated functions
- void glMultTransposeMatrixd(const GLdouble *m);
- void glMultTransposeMatrixf(const GLfloat *m);
- void glLoadTransposeMatrixd(const GLdouble *m);
- void glLoadTransposeMatrixf(const GLfloat *m);
- void glMultiTexCoord4sv(GLenum target, const GLshort *v);
- void glMultiTexCoord4s(GLenum target, GLshort s, GLshort t, GLshort r, GLshort q);
- void glMultiTexCoord4iv(GLenum target, const GLint *v);
- void glMultiTexCoord4i(GLenum target, GLint s, GLint t, GLint r, GLint q);
- void glMultiTexCoord4fv(GLenum target, const GLfloat *v);
- void glMultiTexCoord4f(GLenum target, GLfloat s, GLfloat t, GLfloat r, GLfloat q);
- void glMultiTexCoord4dv(GLenum target, const GLdouble *v);
- void glMultiTexCoord4d(GLenum target, GLdouble s, GLdouble t, GLdouble r, GLdouble q);
- void glMultiTexCoord3sv(GLenum target, const GLshort *v);
- void glMultiTexCoord3s(GLenum target, GLshort s, GLshort t, GLshort r);
- void glMultiTexCoord3iv(GLenum target, const GLint *v);
- void glMultiTexCoord3i(GLenum target, GLint s, GLint t, GLint r);
- void glMultiTexCoord3fv(GLenum target, const GLfloat *v);
- void glMultiTexCoord3f(GLenum target, GLfloat s, GLfloat t, GLfloat r);
- void glMultiTexCoord3dv(GLenum target, const GLdouble *v);
- void glMultiTexCoord3d(GLenum target, GLdouble s, GLdouble t, GLdouble r);
- void glMultiTexCoord2sv(GLenum target, const GLshort *v);
- void glMultiTexCoord2s(GLenum target, GLshort s, GLshort t);
- void glMultiTexCoord2iv(GLenum target, const GLint *v);
- void glMultiTexCoord2i(GLenum target, GLint s, GLint t);
- void glMultiTexCoord2fv(GLenum target, const GLfloat *v);
- void glMultiTexCoord2f(GLenum target, GLfloat s, GLfloat t);
- void glMultiTexCoord2dv(GLenum target, const GLdouble *v);
- void glMultiTexCoord2d(GLenum target, GLdouble s, GLdouble t);
- void glMultiTexCoord1sv(GLenum target, const GLshort *v);
- void glMultiTexCoord1s(GLenum target, GLshort s);
- void glMultiTexCoord1iv(GLenum target, const GLint *v);
- void glMultiTexCoord1i(GLenum target, GLint s);
- void glMultiTexCoord1fv(GLenum target, const GLfloat *v);
- void glMultiTexCoord1f(GLenum target, GLfloat s);
- void glMultiTexCoord1dv(GLenum target, const GLdouble *v);
- void glMultiTexCoord1d(GLenum target, GLdouble s);
- void glClientActiveTexture(GLenum texture);
-
- // OpenGL 1.4 deprecated functions
- void glWindowPos3sv(const GLshort *v);
- void glWindowPos3s(GLshort x, GLshort y, GLshort z);
- void glWindowPos3iv(const GLint *v);
- void glWindowPos3i(GLint x, GLint y, GLint z);
- void glWindowPos3fv(const GLfloat *v);
- void glWindowPos3f(GLfloat x, GLfloat y, GLfloat z);
- void glWindowPos3dv(const GLdouble *v);
- void glWindowPos3d(GLdouble x, GLdouble y, GLdouble z);
- void glWindowPos2sv(const GLshort *v);
- void glWindowPos2s(GLshort x, GLshort y);
- void glWindowPos2iv(const GLint *v);
- void glWindowPos2i(GLint x, GLint y);
- void glWindowPos2fv(const GLfloat *v);
- void glWindowPos2f(GLfloat x, GLfloat y);
- void glWindowPos2dv(const GLdouble *v);
- void glWindowPos2d(GLdouble x, GLdouble y);
- void glSecondaryColorPointer(GLint size, GLenum type, GLsizei stride, const void *pointer);
- void glSecondaryColor3usv(const GLushort *v);
- void glSecondaryColor3us(GLushort red, GLushort green, GLushort blue);
- void glSecondaryColor3uiv(const GLuint *v);
- void glSecondaryColor3ui(GLuint red, GLuint green, GLuint blue);
- void glSecondaryColor3ubv(const GLubyte *v);
- void glSecondaryColor3ub(GLubyte red, GLubyte green, GLubyte blue);
- void glSecondaryColor3sv(const GLshort *v);
- void glSecondaryColor3s(GLshort red, GLshort green, GLshort blue);
- void glSecondaryColor3iv(const GLint *v);
- void glSecondaryColor3i(GLint red, GLint green, GLint blue);
- void glSecondaryColor3fv(const GLfloat *v);
- void glSecondaryColor3f(GLfloat red, GLfloat green, GLfloat blue);
- void glSecondaryColor3dv(const GLdouble *v);
- void glSecondaryColor3d(GLdouble red, GLdouble green, GLdouble blue);
- void glSecondaryColor3bv(const GLbyte *v);
- void glSecondaryColor3b(GLbyte red, GLbyte green, GLbyte blue);
- void glFogCoordPointer(GLenum type, GLsizei stride, const void *pointer);
- void glFogCoorddv(const GLdouble *coord);
- void glFogCoordd(GLdouble coord);
- void glFogCoordfv(const GLfloat *coord);
- void glFogCoordf(GLfloat coord);
-
- // OpenGL 1.5 deprecated functions
-
- // OpenGL 2.0 deprecated functions
-
- // OpenGL 2.1 deprecated functions
-
- // OpenGL 3.0 deprecated functions
-
- // OpenGL 3.1 deprecated functions
-
- // OpenGL 3.2 deprecated functions
-
- // OpenGL 3.3 deprecated functions
- void glSecondaryColorP3uiv(GLenum type, const GLuint *color);
- void glSecondaryColorP3ui(GLenum type, GLuint color);
- void glColorP4uiv(GLenum type, const GLuint *color);
- void glColorP4ui(GLenum type, GLuint color);
- void glColorP3uiv(GLenum type, const GLuint *color);
- void glColorP3ui(GLenum type, GLuint color);
- void glNormalP3uiv(GLenum type, const GLuint *coords);
- void glNormalP3ui(GLenum type, GLuint coords);
- void glMultiTexCoordP4uiv(GLenum texture, GLenum type, const GLuint *coords);
- void glMultiTexCoordP4ui(GLenum texture, GLenum type, GLuint coords);
- void glMultiTexCoordP3uiv(GLenum texture, GLenum type, const GLuint *coords);
- void glMultiTexCoordP3ui(GLenum texture, GLenum type, GLuint coords);
- void glMultiTexCoordP2uiv(GLenum texture, GLenum type, const GLuint *coords);
- void glMultiTexCoordP2ui(GLenum texture, GLenum type, GLuint coords);
- void glMultiTexCoordP1uiv(GLenum texture, GLenum type, const GLuint *coords);
- void glMultiTexCoordP1ui(GLenum texture, GLenum type, GLuint coords);
- void glTexCoordP4uiv(GLenum type, const GLuint *coords);
- void glTexCoordP4ui(GLenum type, GLuint coords);
- void glTexCoordP3uiv(GLenum type, const GLuint *coords);
- void glTexCoordP3ui(GLenum type, GLuint coords);
- void glTexCoordP2uiv(GLenum type, const GLuint *coords);
- void glTexCoordP2ui(GLenum type, GLuint coords);
- void glTexCoordP1uiv(GLenum type, const GLuint *coords);
- void glTexCoordP1ui(GLenum type, GLuint coords);
- void glVertexP4uiv(GLenum type, const GLuint *value);
- void glVertexP4ui(GLenum type, GLuint value);
- void glVertexP3uiv(GLenum type, const GLuint *value);
- void glVertexP3ui(GLenum type, GLuint value);
- void glVertexP2uiv(GLenum type, const GLuint *value);
- void glVertexP2ui(GLenum type, GLuint value);
-
- // OpenGL 4.0 deprecated functions
-
- // OpenGL 4.1 deprecated functions
-
- // OpenGL 4.2 deprecated functions
-
- // OpenGL 4.3 deprecated functions
-
- // OpenGL 4.4 deprecated functions
-
-private:
- friend class QOpenGLContext;
-
- static bool isContextCompatible(QOpenGLContext *context);
- static QOpenGLVersionProfile versionProfile();
-
- QOpenGLFunctions_1_0_CoreBackend* d_1_0_Core;
- QOpenGLFunctions_1_1_CoreBackend* d_1_1_Core;
- QOpenGLFunctions_1_2_CoreBackend* d_1_2_Core;
- QOpenGLFunctions_1_3_CoreBackend* d_1_3_Core;
- QOpenGLFunctions_1_4_CoreBackend* d_1_4_Core;
- QOpenGLFunctions_1_5_CoreBackend* d_1_5_Core;
- QOpenGLFunctions_2_0_CoreBackend* d_2_0_Core;
- QOpenGLFunctions_2_1_CoreBackend* d_2_1_Core;
- QOpenGLFunctions_3_0_CoreBackend* d_3_0_Core;
- QOpenGLFunctions_3_1_CoreBackend* d_3_1_Core;
- QOpenGLFunctions_3_2_CoreBackend* d_3_2_Core;
- QOpenGLFunctions_3_3_CoreBackend* d_3_3_Core;
- QOpenGLFunctions_4_0_CoreBackend* d_4_0_Core;
- QOpenGLFunctions_4_1_CoreBackend* d_4_1_Core;
- QOpenGLFunctions_4_2_CoreBackend* d_4_2_Core;
- QOpenGLFunctions_4_3_CoreBackend* d_4_3_Core;
- QOpenGLFunctions_4_4_CoreBackend* d_4_4_Core;
- QOpenGLFunctions_1_0_DeprecatedBackend* d_1_0_Deprecated;
- QOpenGLFunctions_1_1_DeprecatedBackend* d_1_1_Deprecated;
- QOpenGLFunctions_1_2_DeprecatedBackend* d_1_2_Deprecated;
- QOpenGLFunctions_1_3_DeprecatedBackend* d_1_3_Deprecated;
- QOpenGLFunctions_1_4_DeprecatedBackend* d_1_4_Deprecated;
- QOpenGLFunctions_3_3_DeprecatedBackend* d_3_3_Deprecated;
-};
-
-// OpenGL 1.0 core functions
-inline void QOpenGLFunctions_4_4_Compatibility::glViewport(GLint x, GLint y, GLsizei width, GLsizei height)
-{
- d_1_0_Core->f.Viewport(x, y, width, height);
-}
-
-inline void QOpenGLFunctions_4_4_Compatibility::glDepthRange(GLdouble nearVal, GLdouble farVal)
-{
- d_1_0_Core->f.DepthRange(nearVal, farVal);
-}
-
-inline GLboolean QOpenGLFunctions_4_4_Compatibility::glIsEnabled(GLenum cap)
-{
- return d_1_0_Core->f.IsEnabled(cap);
-}
-
-inline void QOpenGLFunctions_4_4_Compatibility::glGetTexLevelParameteriv(GLenum target, GLint level, GLenum pname, GLint *params)
-{
- d_1_0_Core->f.GetTexLevelParameteriv(target, level, pname, params);
-}
-
-inline void QOpenGLFunctions_4_4_Compatibility::glGetTexLevelParameterfv(GLenum target, GLint level, GLenum pname, GLfloat *params)
-{
- d_1_0_Core->f.GetTexLevelParameterfv(target, level, pname, params);
-}
-
-inline void QOpenGLFunctions_4_4_Compatibility::glGetTexParameteriv(GLenum target, GLenum pname, GLint *params)
-{
- d_1_0_Core->f.GetTexParameteriv(target, pname, params);
-}
-
-inline void QOpenGLFunctions_4_4_Compatibility::glGetTexParameterfv(GLenum target, GLenum pname, GLfloat *params)
-{
- d_1_0_Core->f.GetTexParameterfv(target, pname, params);
-}
-
-inline void QOpenGLFunctions_4_4_Compatibility::glGetTexImage(GLenum target, GLint level, GLenum format, GLenum type, void *pixels)
-{
- d_1_0_Core->f.GetTexImage(target, level, format, type, pixels);
-}
-
-inline const GLubyte * QOpenGLFunctions_4_4_Compatibility::glGetString(GLenum name)
-{
- return d_1_0_Core->f.GetString(name);
-}
-
-inline void QOpenGLFunctions_4_4_Compatibility::glGetIntegerv(GLenum pname, GLint *data)
-{
- d_1_0_Core->f.GetIntegerv(pname, data);
-}
-
-inline void QOpenGLFunctions_4_4_Compatibility::glGetFloatv(GLenum pname, GLfloat *data)
-{
- d_1_0_Core->f.GetFloatv(pname, data);
-}
-
-inline GLenum QOpenGLFunctions_4_4_Compatibility::glGetError()
-{
- return d_1_0_Core->f.GetError();
-}
-
-inline void QOpenGLFunctions_4_4_Compatibility::glGetDoublev(GLenum pname, GLdouble *data)
-{
- d_1_0_Core->f.GetDoublev(pname, data);
-}
-
-inline void QOpenGLFunctions_4_4_Compatibility::glGetBooleanv(GLenum pname, GLboolean *data)
-{
- d_1_0_Core->f.GetBooleanv(pname, data);
-}
-
-inline void QOpenGLFunctions_4_4_Compatibility::glReadPixels(GLint x, GLint y, GLsizei width, GLsizei height, GLenum format, GLenum type, void *pixels)
-{
- d_1_0_Core->f.ReadPixels(x, y, width, height, format, type, pixels);
-}
-
-inline void QOpenGLFunctions_4_4_Compatibility::glReadBuffer(GLenum src)
-{
- d_1_0_Core->f.ReadBuffer(src);
-}
-
-inline void QOpenGLFunctions_4_4_Compatibility::glPixelStorei(GLenum pname, GLint param)
-{
- d_1_0_Core->f.PixelStorei(pname, param);
-}
-
-inline void QOpenGLFunctions_4_4_Compatibility::glPixelStoref(GLenum pname, GLfloat param)
-{
- d_1_0_Core->f.PixelStoref(pname, param);
-}
-
-inline void QOpenGLFunctions_4_4_Compatibility::glDepthFunc(GLenum func)
-{
- d_1_0_Core->f.DepthFunc(func);
-}
-
-inline void QOpenGLFunctions_4_4_Compatibility::glStencilOp(GLenum fail, GLenum zfail, GLenum zpass)
-{
- d_1_0_Core->f.StencilOp(fail, zfail, zpass);
-}
-
-inline void QOpenGLFunctions_4_4_Compatibility::glStencilFunc(GLenum func, GLint ref, GLuint mask)
-{
- d_1_0_Core->f.StencilFunc(func, ref, mask);
-}
-
-inline void QOpenGLFunctions_4_4_Compatibility::glLogicOp(GLenum opcode)
-{
- d_1_0_Core->f.LogicOp(opcode);
-}
-
-inline void QOpenGLFunctions_4_4_Compatibility::glBlendFunc(GLenum sfactor, GLenum dfactor)
-{
- d_1_0_Core->f.BlendFunc(sfactor, dfactor);
-}
-
-inline void QOpenGLFunctions_4_4_Compatibility::glFlush()
-{
- d_1_0_Core->f.Flush();
-}
-
-inline void QOpenGLFunctions_4_4_Compatibility::glFinish()
-{
- d_1_0_Core->f.Finish();
-}
-
-inline void QOpenGLFunctions_4_4_Compatibility::glEnable(GLenum cap)
-{
- d_1_0_Core->f.Enable(cap);
-}
-
-inline void QOpenGLFunctions_4_4_Compatibility::glDisable(GLenum cap)
-{
- d_1_0_Core->f.Disable(cap);
-}
-
-inline void QOpenGLFunctions_4_4_Compatibility::glDepthMask(GLboolean flag)
-{
- d_1_0_Core->f.DepthMask(flag);
-}
-
-inline void QOpenGLFunctions_4_4_Compatibility::glColorMask(GLboolean red, GLboolean green, GLboolean blue, GLboolean alpha)
-{
- d_1_0_Core->f.ColorMask(red, green, blue, alpha);
-}
-
-inline void QOpenGLFunctions_4_4_Compatibility::glStencilMask(GLuint mask)
-{
- d_1_0_Core->f.StencilMask(mask);
-}
-
-inline void QOpenGLFunctions_4_4_Compatibility::glClearDepth(GLdouble depth)
-{
- d_1_0_Core->f.ClearDepth(depth);
-}
-
-inline void QOpenGLFunctions_4_4_Compatibility::glClearStencil(GLint s)
-{
- d_1_0_Core->f.ClearStencil(s);
-}
-
-inline void QOpenGLFunctions_4_4_Compatibility::glClearColor(GLfloat red, GLfloat green, GLfloat blue, GLfloat alpha)
-{
- d_1_0_Core->f.ClearColor(red, green, blue, alpha);
-}
-
-inline void QOpenGLFunctions_4_4_Compatibility::glClear(GLbitfield mask)
-{
- d_1_0_Core->f.Clear(mask);
-}
-
-inline void QOpenGLFunctions_4_4_Compatibility::glDrawBuffer(GLenum buf)
-{
- d_1_0_Core->f.DrawBuffer(buf);
-}
-
-inline void QOpenGLFunctions_4_4_Compatibility::glTexImage2D(GLenum target, GLint level, GLint internalformat, GLsizei width, GLsizei height, GLint border, GLenum format, GLenum type, const void *pixels)
-{
- d_1_0_Core->f.TexImage2D(target, level, internalformat, width, height, border, format, type, pixels);
-}
-
-inline void QOpenGLFunctions_4_4_Compatibility::glTexImage1D(GLenum target, GLint level, GLint internalformat, GLsizei width, GLint border, GLenum format, GLenum type, const void *pixels)
-{
- d_1_0_Core->f.TexImage1D(target, level, internalformat, width, border, format, type, pixels);
-}
-
-inline void QOpenGLFunctions_4_4_Compatibility::glTexParameteriv(GLenum target, GLenum pname, const GLint *params)
-{
- d_1_0_Core->f.TexParameteriv(target, pname, params);
-}
-
-inline void QOpenGLFunctions_4_4_Compatibility::glTexParameteri(GLenum target, GLenum pname, GLint param)
-{
- d_1_0_Core->f.TexParameteri(target, pname, param);
-}
-
-inline void QOpenGLFunctions_4_4_Compatibility::glTexParameterfv(GLenum target, GLenum pname, const GLfloat *params)
-{
- d_1_0_Core->f.TexParameterfv(target, pname, params);
-}
-
-inline void QOpenGLFunctions_4_4_Compatibility::glTexParameterf(GLenum target, GLenum pname, GLfloat param)
-{
- d_1_0_Core->f.TexParameterf(target, pname, param);
-}
-
-inline void QOpenGLFunctions_4_4_Compatibility::glScissor(GLint x, GLint y, GLsizei width, GLsizei height)
-{
- d_1_0_Core->f.Scissor(x, y, width, height);
-}
-
-inline void QOpenGLFunctions_4_4_Compatibility::glPolygonMode(GLenum face, GLenum mode)
-{
- d_1_0_Core->f.PolygonMode(face, mode);
-}
-
-inline void QOpenGLFunctions_4_4_Compatibility::glPointSize(GLfloat size)
-{
- d_1_0_Core->f.PointSize(size);
-}
-
-inline void QOpenGLFunctions_4_4_Compatibility::glLineWidth(GLfloat width)
-{
- d_1_0_Core->f.LineWidth(width);
-}
-
-inline void QOpenGLFunctions_4_4_Compatibility::glHint(GLenum target, GLenum mode)
-{
- d_1_0_Core->f.Hint(target, mode);
-}
-
-inline void QOpenGLFunctions_4_4_Compatibility::glFrontFace(GLenum mode)
-{
- d_1_0_Core->f.FrontFace(mode);
-}
-
-inline void QOpenGLFunctions_4_4_Compatibility::glCullFace(GLenum mode)
-{
- d_1_0_Core->f.CullFace(mode);
-}
-
-
-// OpenGL 1.1 core functions
-inline GLboolean QOpenGLFunctions_4_4_Compatibility::glIsTexture(GLuint texture)
-{
- return d_1_1_Core->f.IsTexture(texture);
-}
-
-inline void QOpenGLFunctions_4_4_Compatibility::glGenTextures(GLsizei n, GLuint *textures)
-{
- d_1_1_Core->f.GenTextures(n, textures);
-}
-
-inline void QOpenGLFunctions_4_4_Compatibility::glDeleteTextures(GLsizei n, const GLuint *textures)
-{
- d_1_1_Core->f.DeleteTextures(n, textures);
-}
-
-inline void QOpenGLFunctions_4_4_Compatibility::glBindTexture(GLenum target, GLuint texture)
-{
- d_1_1_Core->f.BindTexture(target, texture);
-}
-
-inline void QOpenGLFunctions_4_4_Compatibility::glTexSubImage2D(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLenum type, const void *pixels)
-{
- d_1_1_Core->f.TexSubImage2D(target, level, xoffset, yoffset, width, height, format, type, pixels);
-}
-
-inline void QOpenGLFunctions_4_4_Compatibility::glTexSubImage1D(GLenum target, GLint level, GLint xoffset, GLsizei width, GLenum format, GLenum type, const void *pixels)
-{
- d_1_1_Core->f.TexSubImage1D(target, level, xoffset, width, format, type, pixels);
-}
-
-inline void QOpenGLFunctions_4_4_Compatibility::glCopyTexSubImage2D(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint x, GLint y, GLsizei width, GLsizei height)
-{
- d_1_1_Core->f.CopyTexSubImage2D(target, level, xoffset, yoffset, x, y, width, height);
-}
-
-inline void QOpenGLFunctions_4_4_Compatibility::glCopyTexSubImage1D(GLenum target, GLint level, GLint xoffset, GLint x, GLint y, GLsizei width)
-{
- d_1_1_Core->f.CopyTexSubImage1D(target, level, xoffset, x, y, width);
-}
-
-inline void QOpenGLFunctions_4_4_Compatibility::glCopyTexImage2D(GLenum target, GLint level, GLenum internalformat, GLint x, GLint y, GLsizei width, GLsizei height, GLint border)
-{
- d_1_1_Core->f.CopyTexImage2D(target, level, internalformat, x, y, width, height, border);
-}
-
-inline void QOpenGLFunctions_4_4_Compatibility::glCopyTexImage1D(GLenum target, GLint level, GLenum internalformat, GLint x, GLint y, GLsizei width, GLint border)
-{
- d_1_1_Core->f.CopyTexImage1D(target, level, internalformat, x, y, width, border);
-}
-
-inline void QOpenGLFunctions_4_4_Compatibility::glPolygonOffset(GLfloat factor, GLfloat units)
-{
- d_1_1_Core->f.PolygonOffset(factor, units);
-}
-
-inline void QOpenGLFunctions_4_4_Compatibility::glDrawElements(GLenum mode, GLsizei count, GLenum type, const void *indices)
-{
- d_1_1_Core->f.DrawElements(mode, count, type, indices);
-}
-
-inline void QOpenGLFunctions_4_4_Compatibility::glDrawArrays(GLenum mode, GLint first, GLsizei count)
-{
- d_1_1_Core->f.DrawArrays(mode, first, count);
-}
-
-
-// OpenGL 1.2 core functions
-inline void QOpenGLFunctions_4_4_Compatibility::glBlendColor(GLfloat red, GLfloat green, GLfloat blue, GLfloat alpha)
-{
- d_1_2_Core->f.BlendColor(red, green, blue, alpha);
-}
-
-inline void QOpenGLFunctions_4_4_Compatibility::glBlendEquation(GLenum mode)
-{
- d_1_2_Core->f.BlendEquation(mode);
-}
-
-inline void QOpenGLFunctions_4_4_Compatibility::glCopyTexSubImage3D(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLint x, GLint y, GLsizei width, GLsizei height)
-{
- d_1_2_Core->f.CopyTexSubImage3D(target, level, xoffset, yoffset, zoffset, x, y, width, height);
-}
-
-inline void QOpenGLFunctions_4_4_Compatibility::glTexSubImage3D(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLenum type, const void *pixels)
-{
- d_1_2_Core->f.TexSubImage3D(target, level, xoffset, yoffset, zoffset, width, height, depth, format, type, pixels);
-}
-
-inline void QOpenGLFunctions_4_4_Compatibility::glTexImage3D(GLenum target, GLint level, GLint internalformat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLenum format, GLenum type, const void *pixels)
-{
- d_1_2_Core->f.TexImage3D(target, level, internalformat, width, height, depth, border, format, type, pixels);
-}
-
-inline void QOpenGLFunctions_4_4_Compatibility::glDrawRangeElements(GLenum mode, GLuint start, GLuint end, GLsizei count, GLenum type, const void *indices)
-{
- d_1_2_Core->f.DrawRangeElements(mode, start, end, count, type, indices);
-}
-
-
-// OpenGL 1.3 core functions
-inline void QOpenGLFunctions_4_4_Compatibility::glGetCompressedTexImage(GLenum target, GLint level, void *img)
-{
- d_1_3_Core->f.GetCompressedTexImage(target, level, img);
-}
-
-inline void QOpenGLFunctions_4_4_Compatibility::glCompressedTexSubImage1D(GLenum target, GLint level, GLint xoffset, GLsizei width, GLenum format, GLsizei imageSize, const void *data)
-{
- d_1_3_Core->f.CompressedTexSubImage1D(target, level, xoffset, width, format, imageSize, data);
-}
-
-inline void QOpenGLFunctions_4_4_Compatibility::glCompressedTexSubImage2D(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLsizei imageSize, const void *data)
-{
- d_1_3_Core->f.CompressedTexSubImage2D(target, level, xoffset, yoffset, width, height, format, imageSize, data);
-}
-
-inline void QOpenGLFunctions_4_4_Compatibility::glCompressedTexSubImage3D(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLsizei imageSize, const void *data)
-{
- d_1_3_Core->f.CompressedTexSubImage3D(target, level, xoffset, yoffset, zoffset, width, height, depth, format, imageSize, data);
-}
-
-inline void QOpenGLFunctions_4_4_Compatibility::glCompressedTexImage1D(GLenum target, GLint level, GLenum internalformat, GLsizei width, GLint border, GLsizei imageSize, const void *data)
-{
- d_1_3_Core->f.CompressedTexImage1D(target, level, internalformat, width, border, imageSize, data);
-}
-
-inline void QOpenGLFunctions_4_4_Compatibility::glCompressedTexImage2D(GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLint border, GLsizei imageSize, const void *data)
-{
- d_1_3_Core->f.CompressedTexImage2D(target, level, internalformat, width, height, border, imageSize, data);
-}
-
-inline void QOpenGLFunctions_4_4_Compatibility::glCompressedTexImage3D(GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLsizei imageSize, const void *data)
-{
- d_1_3_Core->f.CompressedTexImage3D(target, level, internalformat, width, height, depth, border, imageSize, data);
-}
-
-inline void QOpenGLFunctions_4_4_Compatibility::glSampleCoverage(GLfloat value, GLboolean invert)
-{
- d_1_3_Core->f.SampleCoverage(value, invert);
-}
-
-inline void QOpenGLFunctions_4_4_Compatibility::glActiveTexture(GLenum texture)
-{
- d_1_3_Core->f.ActiveTexture(texture);
-}
-
-
-// OpenGL 1.4 core functions
-inline void QOpenGLFunctions_4_4_Compatibility::glPointParameteriv(GLenum pname, const GLint *params)
-{
- d_1_4_Core->f.PointParameteriv(pname, params);
-}
-
-inline void QOpenGLFunctions_4_4_Compatibility::glPointParameteri(GLenum pname, GLint param)
-{
- d_1_4_Core->f.PointParameteri(pname, param);
-}
-
-inline void QOpenGLFunctions_4_4_Compatibility::glPointParameterfv(GLenum pname, const GLfloat *params)
-{
- d_1_4_Core->f.PointParameterfv(pname, params);
-}
-
-inline void QOpenGLFunctions_4_4_Compatibility::glPointParameterf(GLenum pname, GLfloat param)
-{
- d_1_4_Core->f.PointParameterf(pname, param);
-}
-
-inline void QOpenGLFunctions_4_4_Compatibility::glMultiDrawElements(GLenum mode, const GLsizei *count, GLenum type, const void *const *indices, GLsizei drawcount)
-{
- d_1_4_Core->f.MultiDrawElements(mode, count, type, indices, drawcount);
-}
-
-inline void QOpenGLFunctions_4_4_Compatibility::glMultiDrawArrays(GLenum mode, const GLint *first, const GLsizei *count, GLsizei drawcount)
-{
- d_1_4_Core->f.MultiDrawArrays(mode, first, count, drawcount);
-}
-
-inline void QOpenGLFunctions_4_4_Compatibility::glBlendFuncSeparate(GLenum sfactorRGB, GLenum dfactorRGB, GLenum sfactorAlpha, GLenum dfactorAlpha)
-{
- d_1_4_Core->f.BlendFuncSeparate(sfactorRGB, dfactorRGB, sfactorAlpha, dfactorAlpha);
-}
-
-
-// OpenGL 1.5 core functions
-inline void QOpenGLFunctions_4_4_Compatibility::glGetBufferPointerv(GLenum target, GLenum pname, void * *params)
-{
- d_1_5_Core->f.GetBufferPointerv(target, pname, params);
-}
-
-inline void QOpenGLFunctions_4_4_Compatibility::glGetBufferParameteriv(GLenum target, GLenum pname, GLint *params)
-{
- d_1_5_Core->f.GetBufferParameteriv(target, pname, params);
-}
-
-inline GLboolean QOpenGLFunctions_4_4_Compatibility::glUnmapBuffer(GLenum target)
-{
- return d_1_5_Core->f.UnmapBuffer(target);
-}
-
-inline void * QOpenGLFunctions_4_4_Compatibility::glMapBuffer(GLenum target, GLenum access)
-{
- return d_1_5_Core->f.MapBuffer(target, access);
-}
-
-inline void QOpenGLFunctions_4_4_Compatibility::glGetBufferSubData(GLenum target, GLintptr offset, GLsizeiptr size, void *data)
-{
- d_1_5_Core->f.GetBufferSubData(target, offset, size, data);
-}
-
-inline void QOpenGLFunctions_4_4_Compatibility::glBufferSubData(GLenum target, GLintptr offset, GLsizeiptr size, const void *data)
-{
- d_1_5_Core->f.BufferSubData(target, offset, size, data);
-}
-
-inline void QOpenGLFunctions_4_4_Compatibility::glBufferData(GLenum target, GLsizeiptr size, const void *data, GLenum usage)
-{
- d_1_5_Core->f.BufferData(target, size, data, usage);
-}
-
-inline GLboolean QOpenGLFunctions_4_4_Compatibility::glIsBuffer(GLuint buffer)
-{
- return d_1_5_Core->f.IsBuffer(buffer);
-}
-
-inline void QOpenGLFunctions_4_4_Compatibility::glGenBuffers(GLsizei n, GLuint *buffers)
-{
- d_1_5_Core->f.GenBuffers(n, buffers);
-}
-
-inline void QOpenGLFunctions_4_4_Compatibility::glDeleteBuffers(GLsizei n, const GLuint *buffers)
-{
- d_1_5_Core->f.DeleteBuffers(n, buffers);
-}
-
-inline void QOpenGLFunctions_4_4_Compatibility::glBindBuffer(GLenum target, GLuint buffer)
-{
- d_1_5_Core->f.BindBuffer(target, buffer);
-}
-
-inline void QOpenGLFunctions_4_4_Compatibility::glGetQueryObjectuiv(GLuint id, GLenum pname, GLuint *params)
-{
- d_1_5_Core->f.GetQueryObjectuiv(id, pname, params);
-}
-
-inline void QOpenGLFunctions_4_4_Compatibility::glGetQueryObjectiv(GLuint id, GLenum pname, GLint *params)
-{
- d_1_5_Core->f.GetQueryObjectiv(id, pname, params);
-}
-
-inline void QOpenGLFunctions_4_4_Compatibility::glGetQueryiv(GLenum target, GLenum pname, GLint *params)
-{
- d_1_5_Core->f.GetQueryiv(target, pname, params);
-}
-
-inline void QOpenGLFunctions_4_4_Compatibility::glEndQuery(GLenum target)
-{
- d_1_5_Core->f.EndQuery(target);
-}
-
-inline void QOpenGLFunctions_4_4_Compatibility::glBeginQuery(GLenum target, GLuint id)
-{
- d_1_5_Core->f.BeginQuery(target, id);
-}
-
-inline GLboolean QOpenGLFunctions_4_4_Compatibility::glIsQuery(GLuint id)
-{
- return d_1_5_Core->f.IsQuery(id);
-}
-
-inline void QOpenGLFunctions_4_4_Compatibility::glDeleteQueries(GLsizei n, const GLuint *ids)
-{
- d_1_5_Core->f.DeleteQueries(n, ids);
-}
-
-inline void QOpenGLFunctions_4_4_Compatibility::glGenQueries(GLsizei n, GLuint *ids)
-{
- d_1_5_Core->f.GenQueries(n, ids);
-}
-
-
-// OpenGL 2.0 core functions
-inline void QOpenGLFunctions_4_4_Compatibility::glVertexAttribPointer(GLuint index, GLint size, GLenum type, GLboolean normalized, GLsizei stride, const void *pointer)
-{
- d_2_0_Core->f.VertexAttribPointer(index, size, type, normalized, stride, pointer);
-}
-
-inline void QOpenGLFunctions_4_4_Compatibility::glVertexAttrib4usv(GLuint index, const GLushort *v)
-{
- d_2_0_Core->f.VertexAttrib4usv(index, v);
-}
-
-inline void QOpenGLFunctions_4_4_Compatibility::glVertexAttrib4uiv(GLuint index, const GLuint *v)
-{
- d_2_0_Core->f.VertexAttrib4uiv(index, v);
-}
-
-inline void QOpenGLFunctions_4_4_Compatibility::glVertexAttrib4ubv(GLuint index, const GLubyte *v)
-{
- d_2_0_Core->f.VertexAttrib4ubv(index, v);
-}
-
-inline void QOpenGLFunctions_4_4_Compatibility::glVertexAttrib4sv(GLuint index, const GLshort *v)
-{
- d_2_0_Core->f.VertexAttrib4sv(index, v);
-}
-
-inline void QOpenGLFunctions_4_4_Compatibility::glVertexAttrib4s(GLuint index, GLshort x, GLshort y, GLshort z, GLshort w)
-{
- d_2_0_Core->f.VertexAttrib4s(index, x, y, z, w);
-}
-
-inline void QOpenGLFunctions_4_4_Compatibility::glVertexAttrib4iv(GLuint index, const GLint *v)
-{
- d_2_0_Core->f.VertexAttrib4iv(index, v);
-}
-
-inline void QOpenGLFunctions_4_4_Compatibility::glVertexAttrib4fv(GLuint index, const GLfloat *v)
-{
- d_2_0_Core->f.VertexAttrib4fv(index, v);
-}
-
-inline void QOpenGLFunctions_4_4_Compatibility::glVertexAttrib4f(GLuint index, GLfloat x, GLfloat y, GLfloat z, GLfloat w)
-{
- d_2_0_Core->f.VertexAttrib4f(index, x, y, z, w);
-}
-
-inline void QOpenGLFunctions_4_4_Compatibility::glVertexAttrib4dv(GLuint index, const GLdouble *v)
-{
- d_2_0_Core->f.VertexAttrib4dv(index, v);
-}
-
-inline void QOpenGLFunctions_4_4_Compatibility::glVertexAttrib4d(GLuint index, GLdouble x, GLdouble y, GLdouble z, GLdouble w)
-{
- d_2_0_Core->f.VertexAttrib4d(index, x, y, z, w);
-}
-
-inline void QOpenGLFunctions_4_4_Compatibility::glVertexAttrib4bv(GLuint index, const GLbyte *v)
-{
- d_2_0_Core->f.VertexAttrib4bv(index, v);
-}
-
-inline void QOpenGLFunctions_4_4_Compatibility::glVertexAttrib4Nusv(GLuint index, const GLushort *v)
-{
- d_2_0_Core->f.VertexAttrib4Nusv(index, v);
-}
-
-inline void QOpenGLFunctions_4_4_Compatibility::glVertexAttrib4Nuiv(GLuint index, const GLuint *v)
-{
- d_2_0_Core->f.VertexAttrib4Nuiv(index, v);
-}
-
-inline void QOpenGLFunctions_4_4_Compatibility::glVertexAttrib4Nubv(GLuint index, const GLubyte *v)
-{
- d_2_0_Core->f.VertexAttrib4Nubv(index, v);
-}
-
-inline void QOpenGLFunctions_4_4_Compatibility::glVertexAttrib4Nub(GLuint index, GLubyte x, GLubyte y, GLubyte z, GLubyte w)
-{
- d_2_0_Core->f.VertexAttrib4Nub(index, x, y, z, w);
-}
-
-inline void QOpenGLFunctions_4_4_Compatibility::glVertexAttrib4Nsv(GLuint index, const GLshort *v)
-{
- d_2_0_Core->f.VertexAttrib4Nsv(index, v);
-}
-
-inline void QOpenGLFunctions_4_4_Compatibility::glVertexAttrib4Niv(GLuint index, const GLint *v)
-{
- d_2_0_Core->f.VertexAttrib4Niv(index, v);
-}
-
-inline void QOpenGLFunctions_4_4_Compatibility::glVertexAttrib4Nbv(GLuint index, const GLbyte *v)
-{
- d_2_0_Core->f.VertexAttrib4Nbv(index, v);
-}
-
-inline void QOpenGLFunctions_4_4_Compatibility::glVertexAttrib3sv(GLuint index, const GLshort *v)
-{
- d_2_0_Core->f.VertexAttrib3sv(index, v);
-}
-
-inline void QOpenGLFunctions_4_4_Compatibility::glVertexAttrib3s(GLuint index, GLshort x, GLshort y, GLshort z)
-{
- d_2_0_Core->f.VertexAttrib3s(index, x, y, z);
-}
-
-inline void QOpenGLFunctions_4_4_Compatibility::glVertexAttrib3fv(GLuint index, const GLfloat *v)
-{
- d_2_0_Core->f.VertexAttrib3fv(index, v);
-}
-
-inline void QOpenGLFunctions_4_4_Compatibility::glVertexAttrib3f(GLuint index, GLfloat x, GLfloat y, GLfloat z)
-{
- d_2_0_Core->f.VertexAttrib3f(index, x, y, z);
-}
-
-inline void QOpenGLFunctions_4_4_Compatibility::glVertexAttrib3dv(GLuint index, const GLdouble *v)
-{
- d_2_0_Core->f.VertexAttrib3dv(index, v);
-}
-
-inline void QOpenGLFunctions_4_4_Compatibility::glVertexAttrib3d(GLuint index, GLdouble x, GLdouble y, GLdouble z)
-{
- d_2_0_Core->f.VertexAttrib3d(index, x, y, z);
-}
-
-inline void QOpenGLFunctions_4_4_Compatibility::glVertexAttrib2sv(GLuint index, const GLshort *v)
-{
- d_2_0_Core->f.VertexAttrib2sv(index, v);
-}
-
-inline void QOpenGLFunctions_4_4_Compatibility::glVertexAttrib2s(GLuint index, GLshort x, GLshort y)
-{
- d_2_0_Core->f.VertexAttrib2s(index, x, y);
-}
-
-inline void QOpenGLFunctions_4_4_Compatibility::glVertexAttrib2fv(GLuint index, const GLfloat *v)
-{
- d_2_0_Core->f.VertexAttrib2fv(index, v);
-}
-
-inline void QOpenGLFunctions_4_4_Compatibility::glVertexAttrib2f(GLuint index, GLfloat x, GLfloat y)
-{
- d_2_0_Core->f.VertexAttrib2f(index, x, y);
-}
-
-inline void QOpenGLFunctions_4_4_Compatibility::glVertexAttrib2dv(GLuint index, const GLdouble *v)
-{
- d_2_0_Core->f.VertexAttrib2dv(index, v);
-}
-
-inline void QOpenGLFunctions_4_4_Compatibility::glVertexAttrib2d(GLuint index, GLdouble x, GLdouble y)
-{
- d_2_0_Core->f.VertexAttrib2d(index, x, y);
-}
-
-inline void QOpenGLFunctions_4_4_Compatibility::glVertexAttrib1sv(GLuint index, const GLshort *v)
-{
- d_2_0_Core->f.VertexAttrib1sv(index, v);
-}
-
-inline void QOpenGLFunctions_4_4_Compatibility::glVertexAttrib1s(GLuint index, GLshort x)
-{
- d_2_0_Core->f.VertexAttrib1s(index, x);
-}
-
-inline void QOpenGLFunctions_4_4_Compatibility::glVertexAttrib1fv(GLuint index, const GLfloat *v)
-{
- d_2_0_Core->f.VertexAttrib1fv(index, v);
-}
-
-inline void QOpenGLFunctions_4_4_Compatibility::glVertexAttrib1f(GLuint index, GLfloat x)
-{
- d_2_0_Core->f.VertexAttrib1f(index, x);
-}
-
-inline void QOpenGLFunctions_4_4_Compatibility::glVertexAttrib1dv(GLuint index, const GLdouble *v)
-{
- d_2_0_Core->f.VertexAttrib1dv(index, v);
-}
-
-inline void QOpenGLFunctions_4_4_Compatibility::glVertexAttrib1d(GLuint index, GLdouble x)
-{
- d_2_0_Core->f.VertexAttrib1d(index, x);
-}
-
-inline void QOpenGLFunctions_4_4_Compatibility::glValidateProgram(GLuint program)
-{
- d_2_0_Core->f.ValidateProgram(program);
-}
-
-inline void QOpenGLFunctions_4_4_Compatibility::glUniformMatrix4fv(GLint location, GLsizei count, GLboolean transpose, const GLfloat *value)
-{
- d_2_0_Core->f.UniformMatrix4fv(location, count, transpose, value);
-}
-
-inline void QOpenGLFunctions_4_4_Compatibility::glUniformMatrix3fv(GLint location, GLsizei count, GLboolean transpose, const GLfloat *value)
-{
- d_2_0_Core->f.UniformMatrix3fv(location, count, transpose, value);
-}
-
-inline void QOpenGLFunctions_4_4_Compatibility::glUniformMatrix2fv(GLint location, GLsizei count, GLboolean transpose, const GLfloat *value)
-{
- d_2_0_Core->f.UniformMatrix2fv(location, count, transpose, value);
-}
-
-inline void QOpenGLFunctions_4_4_Compatibility::glUniform4iv(GLint location, GLsizei count, const GLint *value)
-{
- d_2_0_Core->f.Uniform4iv(location, count, value);
-}
-
-inline void QOpenGLFunctions_4_4_Compatibility::glUniform3iv(GLint location, GLsizei count, const GLint *value)
-{
- d_2_0_Core->f.Uniform3iv(location, count, value);
-}
-
-inline void QOpenGLFunctions_4_4_Compatibility::glUniform2iv(GLint location, GLsizei count, const GLint *value)
-{
- d_2_0_Core->f.Uniform2iv(location, count, value);
-}
-
-inline void QOpenGLFunctions_4_4_Compatibility::glUniform1iv(GLint location, GLsizei count, const GLint *value)
-{
- d_2_0_Core->f.Uniform1iv(location, count, value);
-}
-
-inline void QOpenGLFunctions_4_4_Compatibility::glUniform4fv(GLint location, GLsizei count, const GLfloat *value)
-{
- d_2_0_Core->f.Uniform4fv(location, count, value);
-}
-
-inline void QOpenGLFunctions_4_4_Compatibility::glUniform3fv(GLint location, GLsizei count, const GLfloat *value)
-{
- d_2_0_Core->f.Uniform3fv(location, count, value);
-}
-
-inline void QOpenGLFunctions_4_4_Compatibility::glUniform2fv(GLint location, GLsizei count, const GLfloat *value)
-{
- d_2_0_Core->f.Uniform2fv(location, count, value);
-}
-
-inline void QOpenGLFunctions_4_4_Compatibility::glUniform1fv(GLint location, GLsizei count, const GLfloat *value)
-{
- d_2_0_Core->f.Uniform1fv(location, count, value);
-}
-
-inline void QOpenGLFunctions_4_4_Compatibility::glUniform4i(GLint location, GLint v0, GLint v1, GLint v2, GLint v3)
-{
- d_2_0_Core->f.Uniform4i(location, v0, v1, v2, v3);
-}
-
-inline void QOpenGLFunctions_4_4_Compatibility::glUniform3i(GLint location, GLint v0, GLint v1, GLint v2)
-{
- d_2_0_Core->f.Uniform3i(location, v0, v1, v2);
-}
-
-inline void QOpenGLFunctions_4_4_Compatibility::glUniform2i(GLint location, GLint v0, GLint v1)
-{
- d_2_0_Core->f.Uniform2i(location, v0, v1);
-}
-
-inline void QOpenGLFunctions_4_4_Compatibility::glUniform1i(GLint location, GLint v0)
-{
- d_2_0_Core->f.Uniform1i(location, v0);
-}
-
-inline void QOpenGLFunctions_4_4_Compatibility::glUniform4f(GLint location, GLfloat v0, GLfloat v1, GLfloat v2, GLfloat v3)
-{
- d_2_0_Core->f.Uniform4f(location, v0, v1, v2, v3);
-}
-
-inline void QOpenGLFunctions_4_4_Compatibility::glUniform3f(GLint location, GLfloat v0, GLfloat v1, GLfloat v2)
-{
- d_2_0_Core->f.Uniform3f(location, v0, v1, v2);
-}
-
-inline void QOpenGLFunctions_4_4_Compatibility::glUniform2f(GLint location, GLfloat v0, GLfloat v1)
-{
- d_2_0_Core->f.Uniform2f(location, v0, v1);
-}
-
-inline void QOpenGLFunctions_4_4_Compatibility::glUniform1f(GLint location, GLfloat v0)
-{
- d_2_0_Core->f.Uniform1f(location, v0);
-}
-
-inline void QOpenGLFunctions_4_4_Compatibility::glUseProgram(GLuint program)
-{
- d_2_0_Core->f.UseProgram(program);
-}
-
-inline void QOpenGLFunctions_4_4_Compatibility::glShaderSource(GLuint shader, GLsizei count, const GLchar *const *string, const GLint *length)
-{
- d_2_0_Core->f.ShaderSource(shader, count, string, length);
-}
-
-inline void QOpenGLFunctions_4_4_Compatibility::glLinkProgram(GLuint program)
-{
- d_2_0_Core->f.LinkProgram(program);
-}
-
-inline GLboolean QOpenGLFunctions_4_4_Compatibility::glIsShader(GLuint shader)
-{
- return d_2_0_Core->f.IsShader(shader);
-}
-
-inline GLboolean QOpenGLFunctions_4_4_Compatibility::glIsProgram(GLuint program)
-{
- return d_2_0_Core->f.IsProgram(program);
-}
-
-inline void QOpenGLFunctions_4_4_Compatibility::glGetVertexAttribPointerv(GLuint index, GLenum pname, void * *pointer)
-{
- d_2_0_Core->f.GetVertexAttribPointerv(index, pname, pointer);
-}
-
-inline void QOpenGLFunctions_4_4_Compatibility::glGetVertexAttribiv(GLuint index, GLenum pname, GLint *params)
-{
- d_2_0_Core->f.GetVertexAttribiv(index, pname, params);
-}
-
-inline void QOpenGLFunctions_4_4_Compatibility::glGetVertexAttribfv(GLuint index, GLenum pname, GLfloat *params)
-{
- d_2_0_Core->f.GetVertexAttribfv(index, pname, params);
-}
-
-inline void QOpenGLFunctions_4_4_Compatibility::glGetVertexAttribdv(GLuint index, GLenum pname, GLdouble *params)
-{
- d_2_0_Core->f.GetVertexAttribdv(index, pname, params);
-}
-
-inline void QOpenGLFunctions_4_4_Compatibility::glGetUniformiv(GLuint program, GLint location, GLint *params)
-{
- d_2_0_Core->f.GetUniformiv(program, location, params);
-}
-
-inline void QOpenGLFunctions_4_4_Compatibility::glGetUniformfv(GLuint program, GLint location, GLfloat *params)
-{
- d_2_0_Core->f.GetUniformfv(program, location, params);
-}
-
-inline GLint QOpenGLFunctions_4_4_Compatibility::glGetUniformLocation(GLuint program, const GLchar *name)
-{
- return d_2_0_Core->f.GetUniformLocation(program, name);
-}
-
-inline void QOpenGLFunctions_4_4_Compatibility::glGetShaderSource(GLuint shader, GLsizei bufSize, GLsizei *length, GLchar *source)
-{
- d_2_0_Core->f.GetShaderSource(shader, bufSize, length, source);
-}
-
-inline void QOpenGLFunctions_4_4_Compatibility::glGetShaderInfoLog(GLuint shader, GLsizei bufSize, GLsizei *length, GLchar *infoLog)
-{
- d_2_0_Core->f.GetShaderInfoLog(shader, bufSize, length, infoLog);
-}
-
-inline void QOpenGLFunctions_4_4_Compatibility::glGetShaderiv(GLuint shader, GLenum pname, GLint *params)
-{
- d_2_0_Core->f.GetShaderiv(shader, pname, params);
-}
-
-inline void QOpenGLFunctions_4_4_Compatibility::glGetProgramInfoLog(GLuint program, GLsizei bufSize, GLsizei *length, GLchar *infoLog)
-{
- d_2_0_Core->f.GetProgramInfoLog(program, bufSize, length, infoLog);
-}
-
-inline void QOpenGLFunctions_4_4_Compatibility::glGetProgramiv(GLuint program, GLenum pname, GLint *params)
-{
- d_2_0_Core->f.GetProgramiv(program, pname, params);
-}
-
-inline GLint QOpenGLFunctions_4_4_Compatibility::glGetAttribLocation(GLuint program, const GLchar *name)
-{
- return d_2_0_Core->f.GetAttribLocation(program, name);
-}
-
-inline void QOpenGLFunctions_4_4_Compatibility::glGetAttachedShaders(GLuint program, GLsizei maxCount, GLsizei *count, GLuint *shaders)
-{
- d_2_0_Core->f.GetAttachedShaders(program, maxCount, count, shaders);
-}
-
-inline void QOpenGLFunctions_4_4_Compatibility::glGetActiveUniform(GLuint program, GLuint index, GLsizei bufSize, GLsizei *length, GLint *size, GLenum *type, GLchar *name)
-{
- d_2_0_Core->f.GetActiveUniform(program, index, bufSize, length, size, type, name);
-}
-
-inline void QOpenGLFunctions_4_4_Compatibility::glGetActiveAttrib(GLuint program, GLuint index, GLsizei bufSize, GLsizei *length, GLint *size, GLenum *type, GLchar *name)
-{
- d_2_0_Core->f.GetActiveAttrib(program, index, bufSize, length, size, type, name);
-}
-
-inline void QOpenGLFunctions_4_4_Compatibility::glEnableVertexAttribArray(GLuint index)
-{
- d_2_0_Core->f.EnableVertexAttribArray(index);
-}
-
-inline void QOpenGLFunctions_4_4_Compatibility::glDisableVertexAttribArray(GLuint index)
-{
- d_2_0_Core->f.DisableVertexAttribArray(index);
-}
-
-inline void QOpenGLFunctions_4_4_Compatibility::glDetachShader(GLuint program, GLuint shader)
-{
- d_2_0_Core->f.DetachShader(program, shader);
-}
-
-inline void QOpenGLFunctions_4_4_Compatibility::glDeleteShader(GLuint shader)
-{
- d_2_0_Core->f.DeleteShader(shader);
-}
-
-inline void QOpenGLFunctions_4_4_Compatibility::glDeleteProgram(GLuint program)
-{
- d_2_0_Core->f.DeleteProgram(program);
-}
-
-inline GLuint QOpenGLFunctions_4_4_Compatibility::glCreateShader(GLenum type)
-{
- return d_2_0_Core->f.CreateShader(type);
-}
-
-inline GLuint QOpenGLFunctions_4_4_Compatibility::glCreateProgram()
-{
- return d_2_0_Core->f.CreateProgram();
-}
-
-inline void QOpenGLFunctions_4_4_Compatibility::glCompileShader(GLuint shader)
-{
- d_2_0_Core->f.CompileShader(shader);
-}
-
-inline void QOpenGLFunctions_4_4_Compatibility::glBindAttribLocation(GLuint program, GLuint index, const GLchar *name)
-{
- d_2_0_Core->f.BindAttribLocation(program, index, name);
-}
-
-inline void QOpenGLFunctions_4_4_Compatibility::glAttachShader(GLuint program, GLuint shader)
-{
- d_2_0_Core->f.AttachShader(program, shader);
-}
-
-inline void QOpenGLFunctions_4_4_Compatibility::glStencilMaskSeparate(GLenum face, GLuint mask)
-{
- d_2_0_Core->f.StencilMaskSeparate(face, mask);
-}
-
-inline void QOpenGLFunctions_4_4_Compatibility::glStencilFuncSeparate(GLenum face, GLenum func, GLint ref, GLuint mask)
-{
- d_2_0_Core->f.StencilFuncSeparate(face, func, ref, mask);
-}
-
-inline void QOpenGLFunctions_4_4_Compatibility::glStencilOpSeparate(GLenum face, GLenum sfail, GLenum dpfail, GLenum dppass)
-{
- d_2_0_Core->f.StencilOpSeparate(face, sfail, dpfail, dppass);
-}
-
-inline void QOpenGLFunctions_4_4_Compatibility::glDrawBuffers(GLsizei n, const GLenum *bufs)
-{
- d_2_0_Core->f.DrawBuffers(n, bufs);
-}
-
-inline void QOpenGLFunctions_4_4_Compatibility::glBlendEquationSeparate(GLenum modeRGB, GLenum modeAlpha)
-{
- d_2_0_Core->f.BlendEquationSeparate(modeRGB, modeAlpha);
-}
-
-
-// OpenGL 2.1 core functions
-inline void QOpenGLFunctions_4_4_Compatibility::glUniformMatrix4x3fv(GLint location, GLsizei count, GLboolean transpose, const GLfloat *value)
-{
- d_2_1_Core->f.UniformMatrix4x3fv(location, count, transpose, value);
-}
-
-inline void QOpenGLFunctions_4_4_Compatibility::glUniformMatrix3x4fv(GLint location, GLsizei count, GLboolean transpose, const GLfloat *value)
-{
- d_2_1_Core->f.UniformMatrix3x4fv(location, count, transpose, value);
-}
-
-inline void QOpenGLFunctions_4_4_Compatibility::glUniformMatrix4x2fv(GLint location, GLsizei count, GLboolean transpose, const GLfloat *value)
-{
- d_2_1_Core->f.UniformMatrix4x2fv(location, count, transpose, value);
-}
-
-inline void QOpenGLFunctions_4_4_Compatibility::glUniformMatrix2x4fv(GLint location, GLsizei count, GLboolean transpose, const GLfloat *value)
-{
- d_2_1_Core->f.UniformMatrix2x4fv(location, count, transpose, value);
-}
-
-inline void QOpenGLFunctions_4_4_Compatibility::glUniformMatrix3x2fv(GLint location, GLsizei count, GLboolean transpose, const GLfloat *value)
-{
- d_2_1_Core->f.UniformMatrix3x2fv(location, count, transpose, value);
-}
-
-inline void QOpenGLFunctions_4_4_Compatibility::glUniformMatrix2x3fv(GLint location, GLsizei count, GLboolean transpose, const GLfloat *value)
-{
- d_2_1_Core->f.UniformMatrix2x3fv(location, count, transpose, value);
-}
-
-
-// OpenGL 3.0 core functions
-inline GLboolean QOpenGLFunctions_4_4_Compatibility::glIsVertexArray(GLuint array)
-{
- return d_3_0_Core->f.IsVertexArray(array);
-}
-
-inline void QOpenGLFunctions_4_4_Compatibility::glGenVertexArrays(GLsizei n, GLuint *arrays)
-{
- d_3_0_Core->f.GenVertexArrays(n, arrays);
-}
-
-inline void QOpenGLFunctions_4_4_Compatibility::glDeleteVertexArrays(GLsizei n, const GLuint *arrays)
-{
- d_3_0_Core->f.DeleteVertexArrays(n, arrays);
-}
-
-inline void QOpenGLFunctions_4_4_Compatibility::glBindVertexArray(GLuint array)
-{
- d_3_0_Core->f.BindVertexArray(array);
-}
-
-inline void QOpenGLFunctions_4_4_Compatibility::glFlushMappedBufferRange(GLenum target, GLintptr offset, GLsizeiptr length)
-{
- d_3_0_Core->f.FlushMappedBufferRange(target, offset, length);
-}
-
-inline void * QOpenGLFunctions_4_4_Compatibility::glMapBufferRange(GLenum target, GLintptr offset, GLsizeiptr length, GLbitfield access)
-{
- return d_3_0_Core->f.MapBufferRange(target, offset, length, access);
-}
-
-inline void QOpenGLFunctions_4_4_Compatibility::glFramebufferTextureLayer(GLenum target, GLenum attachment, GLuint texture, GLint level, GLint layer)
-{
- d_3_0_Core->f.FramebufferTextureLayer(target, attachment, texture, level, layer);
-}
-
-inline void QOpenGLFunctions_4_4_Compatibility::glRenderbufferStorageMultisample(GLenum target, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height)
-{
- d_3_0_Core->f.RenderbufferStorageMultisample(target, samples, internalformat, width, height);
-}
-
-inline void QOpenGLFunctions_4_4_Compatibility::glBlitFramebuffer(GLint srcX0, GLint srcY0, GLint srcX1, GLint srcY1, GLint dstX0, GLint dstY0, GLint dstX1, GLint dstY1, GLbitfield mask, GLenum filter)
-{
- d_3_0_Core->f.BlitFramebuffer(srcX0, srcY0, srcX1, srcY1, dstX0, dstY0, dstX1, dstY1, mask, filter);
-}
-
-inline void QOpenGLFunctions_4_4_Compatibility::glGenerateMipmap(GLenum target)
-{
- d_3_0_Core->f.GenerateMipmap(target);
-}
-
-inline void QOpenGLFunctions_4_4_Compatibility::glGetFramebufferAttachmentParameteriv(GLenum target, GLenum attachment, GLenum pname, GLint *params)
-{
- d_3_0_Core->f.GetFramebufferAttachmentParameteriv(target, attachment, pname, params);
-}
-
-inline void QOpenGLFunctions_4_4_Compatibility::glFramebufferRenderbuffer(GLenum target, GLenum attachment, GLenum renderbuffertarget, GLuint renderbuffer)
-{
- d_3_0_Core->f.FramebufferRenderbuffer(target, attachment, renderbuffertarget, renderbuffer);
-}
-
-inline void QOpenGLFunctions_4_4_Compatibility::glFramebufferTexture3D(GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level, GLint zoffset)
-{
- d_3_0_Core->f.FramebufferTexture3D(target, attachment, textarget, texture, level, zoffset);
-}
-
-inline void QOpenGLFunctions_4_4_Compatibility::glFramebufferTexture2D(GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level)
-{
- d_3_0_Core->f.FramebufferTexture2D(target, attachment, textarget, texture, level);
-}
-
-inline void QOpenGLFunctions_4_4_Compatibility::glFramebufferTexture1D(GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level)
-{
- d_3_0_Core->f.FramebufferTexture1D(target, attachment, textarget, texture, level);
-}
-
-inline GLenum QOpenGLFunctions_4_4_Compatibility::glCheckFramebufferStatus(GLenum target)
-{
- return d_3_0_Core->f.CheckFramebufferStatus(target);
-}
-
-inline void QOpenGLFunctions_4_4_Compatibility::glGenFramebuffers(GLsizei n, GLuint *framebuffers)
-{
- d_3_0_Core->f.GenFramebuffers(n, framebuffers);
-}
-
-inline void QOpenGLFunctions_4_4_Compatibility::glDeleteFramebuffers(GLsizei n, const GLuint *framebuffers)
-{
- d_3_0_Core->f.DeleteFramebuffers(n, framebuffers);
-}
-
-inline void QOpenGLFunctions_4_4_Compatibility::glBindFramebuffer(GLenum target, GLuint framebuffer)
-{
- d_3_0_Core->f.BindFramebuffer(target, framebuffer);
-}
-
-inline GLboolean QOpenGLFunctions_4_4_Compatibility::glIsFramebuffer(GLuint framebuffer)
-{
- return d_3_0_Core->f.IsFramebuffer(framebuffer);
-}
-
-inline void QOpenGLFunctions_4_4_Compatibility::glGetRenderbufferParameteriv(GLenum target, GLenum pname, GLint *params)
-{
- d_3_0_Core->f.GetRenderbufferParameteriv(target, pname, params);
-}
-
-inline void QOpenGLFunctions_4_4_Compatibility::glRenderbufferStorage(GLenum target, GLenum internalformat, GLsizei width, GLsizei height)
-{
- d_3_0_Core->f.RenderbufferStorage(target, internalformat, width, height);
-}
-
-inline void QOpenGLFunctions_4_4_Compatibility::glGenRenderbuffers(GLsizei n, GLuint *renderbuffers)
-{
- d_3_0_Core->f.GenRenderbuffers(n, renderbuffers);
-}
-
-inline void QOpenGLFunctions_4_4_Compatibility::glDeleteRenderbuffers(GLsizei n, const GLuint *renderbuffers)
-{
- d_3_0_Core->f.DeleteRenderbuffers(n, renderbuffers);
-}
-
-inline void QOpenGLFunctions_4_4_Compatibility::glBindRenderbuffer(GLenum target, GLuint renderbuffer)
-{
- d_3_0_Core->f.BindRenderbuffer(target, renderbuffer);
-}
-
-inline GLboolean QOpenGLFunctions_4_4_Compatibility::glIsRenderbuffer(GLuint renderbuffer)
-{
- return d_3_0_Core->f.IsRenderbuffer(renderbuffer);
-}
-
-inline const GLubyte * QOpenGLFunctions_4_4_Compatibility::glGetStringi(GLenum name, GLuint index)
-{
- return d_3_0_Core->f.GetStringi(name, index);
-}
-
-inline void QOpenGLFunctions_4_4_Compatibility::glClearBufferfi(GLenum buffer, GLint drawbuffer, GLfloat depth, GLint stencil)
-{
- d_3_0_Core->f.ClearBufferfi(buffer, drawbuffer, depth, stencil);
-}
-
-inline void QOpenGLFunctions_4_4_Compatibility::glClearBufferfv(GLenum buffer, GLint drawbuffer, const GLfloat *value)
-{
- d_3_0_Core->f.ClearBufferfv(buffer, drawbuffer, value);
-}
-
-inline void QOpenGLFunctions_4_4_Compatibility::glClearBufferuiv(GLenum buffer, GLint drawbuffer, const GLuint *value)
-{
- d_3_0_Core->f.ClearBufferuiv(buffer, drawbuffer, value);
-}
-
-inline void QOpenGLFunctions_4_4_Compatibility::glClearBufferiv(GLenum buffer, GLint drawbuffer, const GLint *value)
-{
- d_3_0_Core->f.ClearBufferiv(buffer, drawbuffer, value);
-}
-
-inline void QOpenGLFunctions_4_4_Compatibility::glGetTexParameterIuiv(GLenum target, GLenum pname, GLuint *params)
-{
- d_3_0_Core->f.GetTexParameterIuiv(target, pname, params);
-}
-
-inline void QOpenGLFunctions_4_4_Compatibility::glGetTexParameterIiv(GLenum target, GLenum pname, GLint *params)
-{
- d_3_0_Core->f.GetTexParameterIiv(target, pname, params);
-}
-
-inline void QOpenGLFunctions_4_4_Compatibility::glTexParameterIuiv(GLenum target, GLenum pname, const GLuint *params)
-{
- d_3_0_Core->f.TexParameterIuiv(target, pname, params);
-}
-
-inline void QOpenGLFunctions_4_4_Compatibility::glTexParameterIiv(GLenum target, GLenum pname, const GLint *params)
-{
- d_3_0_Core->f.TexParameterIiv(target, pname, params);
-}
-
-inline void QOpenGLFunctions_4_4_Compatibility::glUniform4uiv(GLint location, GLsizei count, const GLuint *value)
-{
- d_3_0_Core->f.Uniform4uiv(location, count, value);
-}
-
-inline void QOpenGLFunctions_4_4_Compatibility::glUniform3uiv(GLint location, GLsizei count, const GLuint *value)
-{
- d_3_0_Core->f.Uniform3uiv(location, count, value);
-}
-
-inline void QOpenGLFunctions_4_4_Compatibility::glUniform2uiv(GLint location, GLsizei count, const GLuint *value)
-{
- d_3_0_Core->f.Uniform2uiv(location, count, value);
-}
-
-inline void QOpenGLFunctions_4_4_Compatibility::glUniform1uiv(GLint location, GLsizei count, const GLuint *value)
-{
- d_3_0_Core->f.Uniform1uiv(location, count, value);
-}
-
-inline void QOpenGLFunctions_4_4_Compatibility::glUniform4ui(GLint location, GLuint v0, GLuint v1, GLuint v2, GLuint v3)
-{
- d_3_0_Core->f.Uniform4ui(location, v0, v1, v2, v3);
-}
-
-inline void QOpenGLFunctions_4_4_Compatibility::glUniform3ui(GLint location, GLuint v0, GLuint v1, GLuint v2)
-{
- d_3_0_Core->f.Uniform3ui(location, v0, v1, v2);
-}
-
-inline void QOpenGLFunctions_4_4_Compatibility::glUniform2ui(GLint location, GLuint v0, GLuint v1)
-{
- d_3_0_Core->f.Uniform2ui(location, v0, v1);
-}
-
-inline void QOpenGLFunctions_4_4_Compatibility::glUniform1ui(GLint location, GLuint v0)
-{
- d_3_0_Core->f.Uniform1ui(location, v0);
-}
-
-inline GLint QOpenGLFunctions_4_4_Compatibility::glGetFragDataLocation(GLuint program, const GLchar *name)
-{
- return d_3_0_Core->f.GetFragDataLocation(program, name);
-}
-
-inline void QOpenGLFunctions_4_4_Compatibility::glBindFragDataLocation(GLuint program, GLuint color, const GLchar *name)
-{
- d_3_0_Core->f.BindFragDataLocation(program, color, name);
-}
-
-inline void QOpenGLFunctions_4_4_Compatibility::glGetUniformuiv(GLuint program, GLint location, GLuint *params)
-{
- d_3_0_Core->f.GetUniformuiv(program, location, params);
-}
-
-inline void QOpenGLFunctions_4_4_Compatibility::glVertexAttribI4usv(GLuint index, const GLushort *v)
-{
- d_3_0_Core->f.VertexAttribI4usv(index, v);
-}
-
-inline void QOpenGLFunctions_4_4_Compatibility::glVertexAttribI4ubv(GLuint index, const GLubyte *v)
-{
- d_3_0_Core->f.VertexAttribI4ubv(index, v);
-}
-
-inline void QOpenGLFunctions_4_4_Compatibility::glVertexAttribI4sv(GLuint index, const GLshort *v)
-{
- d_3_0_Core->f.VertexAttribI4sv(index, v);
-}
-
-inline void QOpenGLFunctions_4_4_Compatibility::glVertexAttribI4bv(GLuint index, const GLbyte *v)
-{
- d_3_0_Core->f.VertexAttribI4bv(index, v);
-}
-
-inline void QOpenGLFunctions_4_4_Compatibility::glVertexAttribI4uiv(GLuint index, const GLuint *v)
-{
- d_3_0_Core->f.VertexAttribI4uiv(index, v);
-}
-
-inline void QOpenGLFunctions_4_4_Compatibility::glVertexAttribI3uiv(GLuint index, const GLuint *v)
-{
- d_3_0_Core->f.VertexAttribI3uiv(index, v);
-}
-
-inline void QOpenGLFunctions_4_4_Compatibility::glVertexAttribI2uiv(GLuint index, const GLuint *v)
-{
- d_3_0_Core->f.VertexAttribI2uiv(index, v);
-}
-
-inline void QOpenGLFunctions_4_4_Compatibility::glVertexAttribI1uiv(GLuint index, const GLuint *v)
-{
- d_3_0_Core->f.VertexAttribI1uiv(index, v);
-}
-
-inline void QOpenGLFunctions_4_4_Compatibility::glVertexAttribI4iv(GLuint index, const GLint *v)
-{
- d_3_0_Core->f.VertexAttribI4iv(index, v);
-}
-
-inline void QOpenGLFunctions_4_4_Compatibility::glVertexAttribI3iv(GLuint index, const GLint *v)
-{
- d_3_0_Core->f.VertexAttribI3iv(index, v);
-}
-
-inline void QOpenGLFunctions_4_4_Compatibility::glVertexAttribI2iv(GLuint index, const GLint *v)
-{
- d_3_0_Core->f.VertexAttribI2iv(index, v);
-}
-
-inline void QOpenGLFunctions_4_4_Compatibility::glVertexAttribI1iv(GLuint index, const GLint *v)
-{
- d_3_0_Core->f.VertexAttribI1iv(index, v);
-}
-
-inline void QOpenGLFunctions_4_4_Compatibility::glVertexAttribI4ui(GLuint index, GLuint x, GLuint y, GLuint z, GLuint w)
-{
- d_3_0_Core->f.VertexAttribI4ui(index, x, y, z, w);
-}
-
-inline void QOpenGLFunctions_4_4_Compatibility::glVertexAttribI3ui(GLuint index, GLuint x, GLuint y, GLuint z)
-{
- d_3_0_Core->f.VertexAttribI3ui(index, x, y, z);
-}
-
-inline void QOpenGLFunctions_4_4_Compatibility::glVertexAttribI2ui(GLuint index, GLuint x, GLuint y)
-{
- d_3_0_Core->f.VertexAttribI2ui(index, x, y);
-}
-
-inline void QOpenGLFunctions_4_4_Compatibility::glVertexAttribI1ui(GLuint index, GLuint x)
-{
- d_3_0_Core->f.VertexAttribI1ui(index, x);
-}
-
-inline void QOpenGLFunctions_4_4_Compatibility::glVertexAttribI4i(GLuint index, GLint x, GLint y, GLint z, GLint w)
-{
- d_3_0_Core->f.VertexAttribI4i(index, x, y, z, w);
-}
-
-inline void QOpenGLFunctions_4_4_Compatibility::glVertexAttribI3i(GLuint index, GLint x, GLint y, GLint z)
-{
- d_3_0_Core->f.VertexAttribI3i(index, x, y, z);
-}
-
-inline void QOpenGLFunctions_4_4_Compatibility::glVertexAttribI2i(GLuint index, GLint x, GLint y)
-{
- d_3_0_Core->f.VertexAttribI2i(index, x, y);
-}
-
-inline void QOpenGLFunctions_4_4_Compatibility::glVertexAttribI1i(GLuint index, GLint x)
-{
- d_3_0_Core->f.VertexAttribI1i(index, x);
-}
-
-inline void QOpenGLFunctions_4_4_Compatibility::glGetVertexAttribIuiv(GLuint index, GLenum pname, GLuint *params)
-{
- d_3_0_Core->f.GetVertexAttribIuiv(index, pname, params);
-}
-
-inline void QOpenGLFunctions_4_4_Compatibility::glGetVertexAttribIiv(GLuint index, GLenum pname, GLint *params)
-{
- d_3_0_Core->f.GetVertexAttribIiv(index, pname, params);
-}
-
-inline void QOpenGLFunctions_4_4_Compatibility::glVertexAttribIPointer(GLuint index, GLint size, GLenum type, GLsizei stride, const void *pointer)
-{
- d_3_0_Core->f.VertexAttribIPointer(index, size, type, stride, pointer);
-}
-
-inline void QOpenGLFunctions_4_4_Compatibility::glEndConditionalRender()
-{
- d_3_0_Core->f.EndConditionalRender();
-}
-
-inline void QOpenGLFunctions_4_4_Compatibility::glBeginConditionalRender(GLuint id, GLenum mode)
-{
- d_3_0_Core->f.BeginConditionalRender(id, mode);
-}
-
-inline void QOpenGLFunctions_4_4_Compatibility::glClampColor(GLenum target, GLenum clamp)
-{
- d_3_0_Core->f.ClampColor(target, clamp);
-}
-
-inline void QOpenGLFunctions_4_4_Compatibility::glGetTransformFeedbackVarying(GLuint program, GLuint index, GLsizei bufSize, GLsizei *length, GLsizei *size, GLenum *type, GLchar *name)
-{
- d_3_0_Core->f.GetTransformFeedbackVarying(program, index, bufSize, length, size, type, name);
-}
-
-inline void QOpenGLFunctions_4_4_Compatibility::glTransformFeedbackVaryings(GLuint program, GLsizei count, const GLchar *const *varyings, GLenum bufferMode)
-{
- d_3_0_Core->f.TransformFeedbackVaryings(program, count, varyings, bufferMode);
-}
-
-inline void QOpenGLFunctions_4_4_Compatibility::glBindBufferBase(GLenum target, GLuint index, GLuint buffer)
-{
- d_3_0_Core->f.BindBufferBase(target, index, buffer);
-}
-
-inline void QOpenGLFunctions_4_4_Compatibility::glBindBufferRange(GLenum target, GLuint index, GLuint buffer, GLintptr offset, GLsizeiptr size)
-{
- d_3_0_Core->f.BindBufferRange(target, index, buffer, offset, size);
-}
-
-inline void QOpenGLFunctions_4_4_Compatibility::glEndTransformFeedback()
-{
- d_3_0_Core->f.EndTransformFeedback();
-}
-
-inline void QOpenGLFunctions_4_4_Compatibility::glBeginTransformFeedback(GLenum primitiveMode)
-{
- d_3_0_Core->f.BeginTransformFeedback(primitiveMode);
-}
-
-inline GLboolean QOpenGLFunctions_4_4_Compatibility::glIsEnabledi(GLenum target, GLuint index)
-{
- return d_3_0_Core->f.IsEnabledi(target, index);
-}
-
-inline void QOpenGLFunctions_4_4_Compatibility::glDisablei(GLenum target, GLuint index)
-{
- d_3_0_Core->f.Disablei(target, index);
-}
-
-inline void QOpenGLFunctions_4_4_Compatibility::glEnablei(GLenum target, GLuint index)
-{
- d_3_0_Core->f.Enablei(target, index);
-}
-
-inline void QOpenGLFunctions_4_4_Compatibility::glGetIntegeri_v(GLenum target, GLuint index, GLint *data)
-{
- d_3_0_Core->f.GetIntegeri_v(target, index, data);
-}
-
-inline void QOpenGLFunctions_4_4_Compatibility::glGetBooleani_v(GLenum target, GLuint index, GLboolean *data)
-{
- d_3_0_Core->f.GetBooleani_v(target, index, data);
-}
-
-inline void QOpenGLFunctions_4_4_Compatibility::glColorMaski(GLuint index, GLboolean r, GLboolean g, GLboolean b, GLboolean a)
-{
- d_3_0_Core->f.ColorMaski(index, r, g, b, a);
-}
-
-
-// OpenGL 3.1 core functions
-inline void QOpenGLFunctions_4_4_Compatibility::glUniformBlockBinding(GLuint program, GLuint uniformBlockIndex, GLuint uniformBlockBinding)
-{
- d_3_1_Core->f.UniformBlockBinding(program, uniformBlockIndex, uniformBlockBinding);
-}
-
-inline void QOpenGLFunctions_4_4_Compatibility::glGetActiveUniformBlockName(GLuint program, GLuint uniformBlockIndex, GLsizei bufSize, GLsizei *length, GLchar *uniformBlockName)
-{
- d_3_1_Core->f.GetActiveUniformBlockName(program, uniformBlockIndex, bufSize, length, uniformBlockName);
-}
-
-inline void QOpenGLFunctions_4_4_Compatibility::glGetActiveUniformBlockiv(GLuint program, GLuint uniformBlockIndex, GLenum pname, GLint *params)
-{
- d_3_1_Core->f.GetActiveUniformBlockiv(program, uniformBlockIndex, pname, params);
-}
-
-inline GLuint QOpenGLFunctions_4_4_Compatibility::glGetUniformBlockIndex(GLuint program, const GLchar *uniformBlockName)
-{
- return d_3_1_Core->f.GetUniformBlockIndex(program, uniformBlockName);
-}
-
-inline void QOpenGLFunctions_4_4_Compatibility::glGetActiveUniformName(GLuint program, GLuint uniformIndex, GLsizei bufSize, GLsizei *length, GLchar *uniformName)
-{
- d_3_1_Core->f.GetActiveUniformName(program, uniformIndex, bufSize, length, uniformName);
-}
-
-inline void QOpenGLFunctions_4_4_Compatibility::glGetActiveUniformsiv(GLuint program, GLsizei uniformCount, const GLuint *uniformIndices, GLenum pname, GLint *params)
-{
- d_3_1_Core->f.GetActiveUniformsiv(program, uniformCount, uniformIndices, pname, params);
-}
-
-inline void QOpenGLFunctions_4_4_Compatibility::glGetUniformIndices(GLuint program, GLsizei uniformCount, const GLchar *const *uniformNames, GLuint *uniformIndices)
-{
- d_3_1_Core->f.GetUniformIndices(program, uniformCount, uniformNames, uniformIndices);
-}
-
-inline void QOpenGLFunctions_4_4_Compatibility::glCopyBufferSubData(GLenum readTarget, GLenum writeTarget, GLintptr readOffset, GLintptr writeOffset, GLsizeiptr size)
-{
- d_3_1_Core->f.CopyBufferSubData(readTarget, writeTarget, readOffset, writeOffset, size);
-}
-
-inline void QOpenGLFunctions_4_4_Compatibility::glPrimitiveRestartIndex(GLuint index)
-{
- d_3_1_Core->f.PrimitiveRestartIndex(index);
-}
-
-inline void QOpenGLFunctions_4_4_Compatibility::glTexBuffer(GLenum target, GLenum internalformat, GLuint buffer)
-{
- d_3_1_Core->f.TexBuffer(target, internalformat, buffer);
-}
-
-inline void QOpenGLFunctions_4_4_Compatibility::glDrawElementsInstanced(GLenum mode, GLsizei count, GLenum type, const void *indices, GLsizei instancecount)
-{
- d_3_1_Core->f.DrawElementsInstanced(mode, count, type, indices, instancecount);
-}
-
-inline void QOpenGLFunctions_4_4_Compatibility::glDrawArraysInstanced(GLenum mode, GLint first, GLsizei count, GLsizei instancecount)
-{
- d_3_1_Core->f.DrawArraysInstanced(mode, first, count, instancecount);
-}
-
-
-// OpenGL 3.2 core functions
-inline void QOpenGLFunctions_4_4_Compatibility::glSampleMaski(GLuint maskNumber, GLbitfield mask)
-{
- d_3_2_Core->f.SampleMaski(maskNumber, mask);
-}
-
-inline void QOpenGLFunctions_4_4_Compatibility::glGetMultisamplefv(GLenum pname, GLuint index, GLfloat *val)
-{
- d_3_2_Core->f.GetMultisamplefv(pname, index, val);
-}
-
-inline void QOpenGLFunctions_4_4_Compatibility::glTexImage3DMultisample(GLenum target, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth, GLboolean fixedsamplelocations)
-{
- d_3_2_Core->f.TexImage3DMultisample(target, samples, internalformat, width, height, depth, fixedsamplelocations);
-}
-
-inline void QOpenGLFunctions_4_4_Compatibility::glTexImage2DMultisample(GLenum target, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height, GLboolean fixedsamplelocations)
-{
- d_3_2_Core->f.TexImage2DMultisample(target, samples, internalformat, width, height, fixedsamplelocations);
-}
-
-inline void QOpenGLFunctions_4_4_Compatibility::glFramebufferTexture(GLenum target, GLenum attachment, GLuint texture, GLint level)
-{
- d_3_2_Core->f.FramebufferTexture(target, attachment, texture, level);
-}
-
-inline void QOpenGLFunctions_4_4_Compatibility::glGetBufferParameteri64v(GLenum target, GLenum pname, GLint64 *params)
-{
- d_3_2_Core->f.GetBufferParameteri64v(target, pname, params);
-}
-
-inline void QOpenGLFunctions_4_4_Compatibility::glGetInteger64i_v(GLenum target, GLuint index, GLint64 *data)
-{
- d_3_2_Core->f.GetInteger64i_v(target, index, data);
-}
-
-inline void QOpenGLFunctions_4_4_Compatibility::glGetSynciv(GLsync sync, GLenum pname, GLsizei bufSize, GLsizei *length, GLint *values)
-{
- d_3_2_Core->f.GetSynciv(sync, pname, bufSize, length, values);
-}
-
-inline void QOpenGLFunctions_4_4_Compatibility::glGetInteger64v(GLenum pname, GLint64 *data)
-{
- d_3_2_Core->f.GetInteger64v(pname, data);
-}
-
-inline void QOpenGLFunctions_4_4_Compatibility::glWaitSync(GLsync sync, GLbitfield flags, GLuint64 timeout)
-{
- d_3_2_Core->f.WaitSync(sync, flags, timeout);
-}
-
-inline GLenum QOpenGLFunctions_4_4_Compatibility::glClientWaitSync(GLsync sync, GLbitfield flags, GLuint64 timeout)
-{
- return d_3_2_Core->f.ClientWaitSync(sync, flags, timeout);
-}
-
-inline void QOpenGLFunctions_4_4_Compatibility::glDeleteSync(GLsync sync)
-{
- d_3_2_Core->f.DeleteSync(sync);
-}
-
-inline GLboolean QOpenGLFunctions_4_4_Compatibility::glIsSync(GLsync sync)
-{
- return d_3_2_Core->f.IsSync(sync);
-}
-
-inline GLsync QOpenGLFunctions_4_4_Compatibility::glFenceSync(GLenum condition, GLbitfield flags)
-{
- return d_3_2_Core->f.FenceSync(condition, flags);
-}
-
-inline void QOpenGLFunctions_4_4_Compatibility::glProvokingVertex(GLenum mode)
-{
- d_3_2_Core->f.ProvokingVertex(mode);
-}
-
-inline void QOpenGLFunctions_4_4_Compatibility::glMultiDrawElementsBaseVertex(GLenum mode, const GLsizei *count, GLenum type, const void *const *indices, GLsizei drawcount, const GLint *basevertex)
-{
- d_3_2_Core->f.MultiDrawElementsBaseVertex(mode, count, type, indices, drawcount, basevertex);
-}
-
-inline void QOpenGLFunctions_4_4_Compatibility::glDrawElementsInstancedBaseVertex(GLenum mode, GLsizei count, GLenum type, const void *indices, GLsizei instancecount, GLint basevertex)
-{
- d_3_2_Core->f.DrawElementsInstancedBaseVertex(mode, count, type, indices, instancecount, basevertex);
-}
-
-inline void QOpenGLFunctions_4_4_Compatibility::glDrawRangeElementsBaseVertex(GLenum mode, GLuint start, GLuint end, GLsizei count, GLenum type, const void *indices, GLint basevertex)
-{
- d_3_2_Core->f.DrawRangeElementsBaseVertex(mode, start, end, count, type, indices, basevertex);
-}
-
-inline void QOpenGLFunctions_4_4_Compatibility::glDrawElementsBaseVertex(GLenum mode, GLsizei count, GLenum type, const void *indices, GLint basevertex)
-{
- d_3_2_Core->f.DrawElementsBaseVertex(mode, count, type, indices, basevertex);
-}
-
-
-// OpenGL 3.3 core functions
-inline void QOpenGLFunctions_4_4_Compatibility::glVertexAttribP4uiv(GLuint index, GLenum type, GLboolean normalized, const GLuint *value)
-{
- d_3_3_Core->f.VertexAttribP4uiv(index, type, normalized, value);
-}
-
-inline void QOpenGLFunctions_4_4_Compatibility::glVertexAttribP4ui(GLuint index, GLenum type, GLboolean normalized, GLuint value)
-{
- d_3_3_Core->f.VertexAttribP4ui(index, type, normalized, value);
-}
-
-inline void QOpenGLFunctions_4_4_Compatibility::glVertexAttribP3uiv(GLuint index, GLenum type, GLboolean normalized, const GLuint *value)
-{
- d_3_3_Core->f.VertexAttribP3uiv(index, type, normalized, value);
-}
-
-inline void QOpenGLFunctions_4_4_Compatibility::glVertexAttribP3ui(GLuint index, GLenum type, GLboolean normalized, GLuint value)
-{
- d_3_3_Core->f.VertexAttribP3ui(index, type, normalized, value);
-}
-
-inline void QOpenGLFunctions_4_4_Compatibility::glVertexAttribP2uiv(GLuint index, GLenum type, GLboolean normalized, const GLuint *value)
-{
- d_3_3_Core->f.VertexAttribP2uiv(index, type, normalized, value);
-}
-
-inline void QOpenGLFunctions_4_4_Compatibility::glVertexAttribP2ui(GLuint index, GLenum type, GLboolean normalized, GLuint value)
-{
- d_3_3_Core->f.VertexAttribP2ui(index, type, normalized, value);
-}
-
-inline void QOpenGLFunctions_4_4_Compatibility::glVertexAttribP1uiv(GLuint index, GLenum type, GLboolean normalized, const GLuint *value)
-{
- d_3_3_Core->f.VertexAttribP1uiv(index, type, normalized, value);
-}
-
-inline void QOpenGLFunctions_4_4_Compatibility::glVertexAttribP1ui(GLuint index, GLenum type, GLboolean normalized, GLuint value)
-{
- d_3_3_Core->f.VertexAttribP1ui(index, type, normalized, value);
-}
-
-inline void QOpenGLFunctions_4_4_Compatibility::glVertexAttribDivisor(GLuint index, GLuint divisor)
-{
- d_3_3_Core->f.VertexAttribDivisor(index, divisor);
-}
-
-inline void QOpenGLFunctions_4_4_Compatibility::glGetQueryObjectui64v(GLuint id, GLenum pname, GLuint64 *params)
-{
- d_3_3_Core->f.GetQueryObjectui64v(id, pname, params);
-}
-
-inline void QOpenGLFunctions_4_4_Compatibility::glGetQueryObjecti64v(GLuint id, GLenum pname, GLint64 *params)
-{
- d_3_3_Core->f.GetQueryObjecti64v(id, pname, params);
-}
-
-inline void QOpenGLFunctions_4_4_Compatibility::glQueryCounter(GLuint id, GLenum target)
-{
- d_3_3_Core->f.QueryCounter(id, target);
-}
-
-inline void QOpenGLFunctions_4_4_Compatibility::glGetSamplerParameterIuiv(GLuint sampler, GLenum pname, GLuint *params)
-{
- d_3_3_Core->f.GetSamplerParameterIuiv(sampler, pname, params);
-}
-
-inline void QOpenGLFunctions_4_4_Compatibility::glGetSamplerParameterfv(GLuint sampler, GLenum pname, GLfloat *params)
-{
- d_3_3_Core->f.GetSamplerParameterfv(sampler, pname, params);
-}
-
-inline void QOpenGLFunctions_4_4_Compatibility::glGetSamplerParameterIiv(GLuint sampler, GLenum pname, GLint *params)
-{
- d_3_3_Core->f.GetSamplerParameterIiv(sampler, pname, params);
-}
-
-inline void QOpenGLFunctions_4_4_Compatibility::glGetSamplerParameteriv(GLuint sampler, GLenum pname, GLint *params)
-{
- d_3_3_Core->f.GetSamplerParameteriv(sampler, pname, params);
-}
-
-inline void QOpenGLFunctions_4_4_Compatibility::glSamplerParameterIuiv(GLuint sampler, GLenum pname, const GLuint *param)
-{
- d_3_3_Core->f.SamplerParameterIuiv(sampler, pname, param);
-}
-
-inline void QOpenGLFunctions_4_4_Compatibility::glSamplerParameterIiv(GLuint sampler, GLenum pname, const GLint *param)
-{
- d_3_3_Core->f.SamplerParameterIiv(sampler, pname, param);
-}
-
-inline void QOpenGLFunctions_4_4_Compatibility::glSamplerParameterfv(GLuint sampler, GLenum pname, const GLfloat *param)
-{
- d_3_3_Core->f.SamplerParameterfv(sampler, pname, param);
-}
-
-inline void QOpenGLFunctions_4_4_Compatibility::glSamplerParameterf(GLuint sampler, GLenum pname, GLfloat param)
-{
- d_3_3_Core->f.SamplerParameterf(sampler, pname, param);
-}
-
-inline void QOpenGLFunctions_4_4_Compatibility::glSamplerParameteriv(GLuint sampler, GLenum pname, const GLint *param)
-{
- d_3_3_Core->f.SamplerParameteriv(sampler, pname, param);
-}
-
-inline void QOpenGLFunctions_4_4_Compatibility::glSamplerParameteri(GLuint sampler, GLenum pname, GLint param)
-{
- d_3_3_Core->f.SamplerParameteri(sampler, pname, param);
-}
-
-inline void QOpenGLFunctions_4_4_Compatibility::glBindSampler(GLuint unit, GLuint sampler)
-{
- d_3_3_Core->f.BindSampler(unit, sampler);
-}
-
-inline GLboolean QOpenGLFunctions_4_4_Compatibility::glIsSampler(GLuint sampler)
-{
- return d_3_3_Core->f.IsSampler(sampler);
-}
-
-inline void QOpenGLFunctions_4_4_Compatibility::glDeleteSamplers(GLsizei count, const GLuint *samplers)
-{
- d_3_3_Core->f.DeleteSamplers(count, samplers);
-}
-
-inline void QOpenGLFunctions_4_4_Compatibility::glGenSamplers(GLsizei count, GLuint *samplers)
-{
- d_3_3_Core->f.GenSamplers(count, samplers);
-}
-
-inline GLint QOpenGLFunctions_4_4_Compatibility::glGetFragDataIndex(GLuint program, const GLchar *name)
-{
- return d_3_3_Core->f.GetFragDataIndex(program, name);
-}
-
-inline void QOpenGLFunctions_4_4_Compatibility::glBindFragDataLocationIndexed(GLuint program, GLuint colorNumber, GLuint index, const GLchar *name)
-{
- d_3_3_Core->f.BindFragDataLocationIndexed(program, colorNumber, index, name);
-}
-
-
-// OpenGL 4.0 core functions
-inline void QOpenGLFunctions_4_4_Compatibility::glGetQueryIndexediv(GLenum target, GLuint index, GLenum pname, GLint *params)
-{
- d_4_0_Core->f.GetQueryIndexediv(target, index, pname, params);
-}
-
-inline void QOpenGLFunctions_4_4_Compatibility::glEndQueryIndexed(GLenum target, GLuint index)
-{
- d_4_0_Core->f.EndQueryIndexed(target, index);
-}
-
-inline void QOpenGLFunctions_4_4_Compatibility::glBeginQueryIndexed(GLenum target, GLuint index, GLuint id)
-{
- d_4_0_Core->f.BeginQueryIndexed(target, index, id);
-}
-
-inline void QOpenGLFunctions_4_4_Compatibility::glDrawTransformFeedbackStream(GLenum mode, GLuint id, GLuint stream)
-{
- d_4_0_Core->f.DrawTransformFeedbackStream(mode, id, stream);
-}
-
-inline void QOpenGLFunctions_4_4_Compatibility::glDrawTransformFeedback(GLenum mode, GLuint id)
-{
- d_4_0_Core->f.DrawTransformFeedback(mode, id);
-}
-
-inline void QOpenGLFunctions_4_4_Compatibility::glResumeTransformFeedback()
-{
- d_4_0_Core->f.ResumeTransformFeedback();
-}
-
-inline void QOpenGLFunctions_4_4_Compatibility::glPauseTransformFeedback()
-{
- d_4_0_Core->f.PauseTransformFeedback();
-}
-
-inline GLboolean QOpenGLFunctions_4_4_Compatibility::glIsTransformFeedback(GLuint id)
-{
- return d_4_0_Core->f.IsTransformFeedback(id);
-}
-
-inline void QOpenGLFunctions_4_4_Compatibility::glGenTransformFeedbacks(GLsizei n, GLuint *ids)
-{
- d_4_0_Core->f.GenTransformFeedbacks(n, ids);
-}
-
-inline void QOpenGLFunctions_4_4_Compatibility::glDeleteTransformFeedbacks(GLsizei n, const GLuint *ids)
-{
- d_4_0_Core->f.DeleteTransformFeedbacks(n, ids);
-}
-
-inline void QOpenGLFunctions_4_4_Compatibility::glBindTransformFeedback(GLenum target, GLuint id)
-{
- d_4_0_Core->f.BindTransformFeedback(target, id);
-}
-
-inline void QOpenGLFunctions_4_4_Compatibility::glPatchParameterfv(GLenum pname, const GLfloat *values)
-{
- d_4_0_Core->f.PatchParameterfv(pname, values);
-}
-
-inline void QOpenGLFunctions_4_4_Compatibility::glPatchParameteri(GLenum pname, GLint value)
-{
- d_4_0_Core->f.PatchParameteri(pname, value);
-}
-
-inline void QOpenGLFunctions_4_4_Compatibility::glGetProgramStageiv(GLuint program, GLenum shadertype, GLenum pname, GLint *values)
-{
- d_4_0_Core->f.GetProgramStageiv(program, shadertype, pname, values);
-}
-
-inline void QOpenGLFunctions_4_4_Compatibility::glGetUniformSubroutineuiv(GLenum shadertype, GLint location, GLuint *params)
-{
- d_4_0_Core->f.GetUniformSubroutineuiv(shadertype, location, params);
-}
-
-inline void QOpenGLFunctions_4_4_Compatibility::glUniformSubroutinesuiv(GLenum shadertype, GLsizei count, const GLuint *indices)
-{
- d_4_0_Core->f.UniformSubroutinesuiv(shadertype, count, indices);
-}
-
-inline void QOpenGLFunctions_4_4_Compatibility::glGetActiveSubroutineName(GLuint program, GLenum shadertype, GLuint index, GLsizei bufsize, GLsizei *length, GLchar *name)
-{
- d_4_0_Core->f.GetActiveSubroutineName(program, shadertype, index, bufsize, length, name);
-}
-
-inline void QOpenGLFunctions_4_4_Compatibility::glGetActiveSubroutineUniformName(GLuint program, GLenum shadertype, GLuint index, GLsizei bufsize, GLsizei *length, GLchar *name)
-{
- d_4_0_Core->f.GetActiveSubroutineUniformName(program, shadertype, index, bufsize, length, name);
-}
-
-inline void QOpenGLFunctions_4_4_Compatibility::glGetActiveSubroutineUniformiv(GLuint program, GLenum shadertype, GLuint index, GLenum pname, GLint *values)
-{
- d_4_0_Core->f.GetActiveSubroutineUniformiv(program, shadertype, index, pname, values);
-}
-
-inline GLuint QOpenGLFunctions_4_4_Compatibility::glGetSubroutineIndex(GLuint program, GLenum shadertype, const GLchar *name)
-{
- return d_4_0_Core->f.GetSubroutineIndex(program, shadertype, name);
-}
-
-inline GLint QOpenGLFunctions_4_4_Compatibility::glGetSubroutineUniformLocation(GLuint program, GLenum shadertype, const GLchar *name)
-{
- return d_4_0_Core->f.GetSubroutineUniformLocation(program, shadertype, name);
-}
-
-inline void QOpenGLFunctions_4_4_Compatibility::glGetUniformdv(GLuint program, GLint location, GLdouble *params)
-{
- d_4_0_Core->f.GetUniformdv(program, location, params);
-}
-
-inline void QOpenGLFunctions_4_4_Compatibility::glUniformMatrix4x3dv(GLint location, GLsizei count, GLboolean transpose, const GLdouble *value)
-{
- d_4_0_Core->f.UniformMatrix4x3dv(location, count, transpose, value);
-}
-
-inline void QOpenGLFunctions_4_4_Compatibility::glUniformMatrix4x2dv(GLint location, GLsizei count, GLboolean transpose, const GLdouble *value)
-{
- d_4_0_Core->f.UniformMatrix4x2dv(location, count, transpose, value);
-}
-
-inline void QOpenGLFunctions_4_4_Compatibility::glUniformMatrix3x4dv(GLint location, GLsizei count, GLboolean transpose, const GLdouble *value)
-{
- d_4_0_Core->f.UniformMatrix3x4dv(location, count, transpose, value);
-}
-
-inline void QOpenGLFunctions_4_4_Compatibility::glUniformMatrix3x2dv(GLint location, GLsizei count, GLboolean transpose, const GLdouble *value)
-{
- d_4_0_Core->f.UniformMatrix3x2dv(location, count, transpose, value);
-}
-
-inline void QOpenGLFunctions_4_4_Compatibility::glUniformMatrix2x4dv(GLint location, GLsizei count, GLboolean transpose, const GLdouble *value)
-{
- d_4_0_Core->f.UniformMatrix2x4dv(location, count, transpose, value);
-}
-
-inline void QOpenGLFunctions_4_4_Compatibility::glUniformMatrix2x3dv(GLint location, GLsizei count, GLboolean transpose, const GLdouble *value)
-{
- d_4_0_Core->f.UniformMatrix2x3dv(location, count, transpose, value);
-}
-
-inline void QOpenGLFunctions_4_4_Compatibility::glUniformMatrix4dv(GLint location, GLsizei count, GLboolean transpose, const GLdouble *value)
-{
- d_4_0_Core->f.UniformMatrix4dv(location, count, transpose, value);
-}
-
-inline void QOpenGLFunctions_4_4_Compatibility::glUniformMatrix3dv(GLint location, GLsizei count, GLboolean transpose, const GLdouble *value)
-{
- d_4_0_Core->f.UniformMatrix3dv(location, count, transpose, value);
-}
-
-inline void QOpenGLFunctions_4_4_Compatibility::glUniformMatrix2dv(GLint location, GLsizei count, GLboolean transpose, const GLdouble *value)
-{
- d_4_0_Core->f.UniformMatrix2dv(location, count, transpose, value);
-}
-
-inline void QOpenGLFunctions_4_4_Compatibility::glUniform4dv(GLint location, GLsizei count, const GLdouble *value)
-{
- d_4_0_Core->f.Uniform4dv(location, count, value);
-}
-
-inline void QOpenGLFunctions_4_4_Compatibility::glUniform3dv(GLint location, GLsizei count, const GLdouble *value)
-{
- d_4_0_Core->f.Uniform3dv(location, count, value);
-}
-
-inline void QOpenGLFunctions_4_4_Compatibility::glUniform2dv(GLint location, GLsizei count, const GLdouble *value)
-{
- d_4_0_Core->f.Uniform2dv(location, count, value);
-}
-
-inline void QOpenGLFunctions_4_4_Compatibility::glUniform1dv(GLint location, GLsizei count, const GLdouble *value)
-{
- d_4_0_Core->f.Uniform1dv(location, count, value);
-}
-
-inline void QOpenGLFunctions_4_4_Compatibility::glUniform4d(GLint location, GLdouble x, GLdouble y, GLdouble z, GLdouble w)
-{
- d_4_0_Core->f.Uniform4d(location, x, y, z, w);
-}
-
-inline void QOpenGLFunctions_4_4_Compatibility::glUniform3d(GLint location, GLdouble x, GLdouble y, GLdouble z)
-{
- d_4_0_Core->f.Uniform3d(location, x, y, z);
-}
-
-inline void QOpenGLFunctions_4_4_Compatibility::glUniform2d(GLint location, GLdouble x, GLdouble y)
-{
- d_4_0_Core->f.Uniform2d(location, x, y);
-}
-
-inline void QOpenGLFunctions_4_4_Compatibility::glUniform1d(GLint location, GLdouble x)
-{
- d_4_0_Core->f.Uniform1d(location, x);
-}
-
-inline void QOpenGLFunctions_4_4_Compatibility::glDrawElementsIndirect(GLenum mode, GLenum type, const void *indirect)
-{
- d_4_0_Core->f.DrawElementsIndirect(mode, type, indirect);
-}
-
-inline void QOpenGLFunctions_4_4_Compatibility::glDrawArraysIndirect(GLenum mode, const void *indirect)
-{
- d_4_0_Core->f.DrawArraysIndirect(mode, indirect);
-}
-
-inline void QOpenGLFunctions_4_4_Compatibility::glBlendFuncSeparatei(GLuint buf, GLenum srcRGB, GLenum dstRGB, GLenum srcAlpha, GLenum dstAlpha)
-{
- d_4_0_Core->f.BlendFuncSeparatei(buf, srcRGB, dstRGB, srcAlpha, dstAlpha);
-}
-
-inline void QOpenGLFunctions_4_4_Compatibility::glBlendFunci(GLuint buf, GLenum src, GLenum dst)
-{
- d_4_0_Core->f.BlendFunci(buf, src, dst);
-}
-
-inline void QOpenGLFunctions_4_4_Compatibility::glBlendEquationSeparatei(GLuint buf, GLenum modeRGB, GLenum modeAlpha)
-{
- d_4_0_Core->f.BlendEquationSeparatei(buf, modeRGB, modeAlpha);
-}
-
-inline void QOpenGLFunctions_4_4_Compatibility::glBlendEquationi(GLuint buf, GLenum mode)
-{
- d_4_0_Core->f.BlendEquationi(buf, mode);
-}
-
-inline void QOpenGLFunctions_4_4_Compatibility::glMinSampleShading(GLfloat value)
-{
- d_4_0_Core->f.MinSampleShading(value);
-}
-
-
-// OpenGL 4.1 core functions
-inline void QOpenGLFunctions_4_4_Compatibility::glGetDoublei_v(GLenum target, GLuint index, GLdouble *data)
-{
- d_4_1_Core->f.GetDoublei_v(target, index, data);
-}
-
-inline void QOpenGLFunctions_4_4_Compatibility::glGetFloati_v(GLenum target, GLuint index, GLfloat *data)
-{
- d_4_1_Core->f.GetFloati_v(target, index, data);
-}
-
-inline void QOpenGLFunctions_4_4_Compatibility::glDepthRangeIndexed(GLuint index, GLdouble n, GLdouble f)
-{
- d_4_1_Core->f.DepthRangeIndexed(index, n, f);
-}
-
-inline void QOpenGLFunctions_4_4_Compatibility::glDepthRangeArrayv(GLuint first, GLsizei count, const GLdouble *v)
-{
- d_4_1_Core->f.DepthRangeArrayv(first, count, v);
-}
-
-inline void QOpenGLFunctions_4_4_Compatibility::glScissorIndexedv(GLuint index, const GLint *v)
-{
- d_4_1_Core->f.ScissorIndexedv(index, v);
-}
-
-inline void QOpenGLFunctions_4_4_Compatibility::glScissorIndexed(GLuint index, GLint left, GLint bottom, GLsizei width, GLsizei height)
-{
- d_4_1_Core->f.ScissorIndexed(index, left, bottom, width, height);
-}
-
-inline void QOpenGLFunctions_4_4_Compatibility::glScissorArrayv(GLuint first, GLsizei count, const GLint *v)
-{
- d_4_1_Core->f.ScissorArrayv(first, count, v);
-}
-
-inline void QOpenGLFunctions_4_4_Compatibility::glViewportIndexedfv(GLuint index, const GLfloat *v)
-{
- d_4_1_Core->f.ViewportIndexedfv(index, v);
-}
-
-inline void QOpenGLFunctions_4_4_Compatibility::glViewportIndexedf(GLuint index, GLfloat x, GLfloat y, GLfloat w, GLfloat h)
-{
- d_4_1_Core->f.ViewportIndexedf(index, x, y, w, h);
-}
-
-inline void QOpenGLFunctions_4_4_Compatibility::glViewportArrayv(GLuint first, GLsizei count, const GLfloat *v)
-{
- d_4_1_Core->f.ViewportArrayv(first, count, v);
-}
-
-inline void QOpenGLFunctions_4_4_Compatibility::glGetVertexAttribLdv(GLuint index, GLenum pname, GLdouble *params)
-{
- d_4_1_Core->f.GetVertexAttribLdv(index, pname, params);
-}
-
-inline void QOpenGLFunctions_4_4_Compatibility::glVertexAttribLPointer(GLuint index, GLint size, GLenum type, GLsizei stride, const void *pointer)
-{
- d_4_1_Core->f.VertexAttribLPointer(index, size, type, stride, pointer);
-}
-
-inline void QOpenGLFunctions_4_4_Compatibility::glVertexAttribL4dv(GLuint index, const GLdouble *v)
-{
- d_4_1_Core->f.VertexAttribL4dv(index, v);
-}
-
-inline void QOpenGLFunctions_4_4_Compatibility::glVertexAttribL3dv(GLuint index, const GLdouble *v)
-{
- d_4_1_Core->f.VertexAttribL3dv(index, v);
-}
-
-inline void QOpenGLFunctions_4_4_Compatibility::glVertexAttribL2dv(GLuint index, const GLdouble *v)
-{
- d_4_1_Core->f.VertexAttribL2dv(index, v);
-}
-
-inline void QOpenGLFunctions_4_4_Compatibility::glVertexAttribL1dv(GLuint index, const GLdouble *v)
-{
- d_4_1_Core->f.VertexAttribL1dv(index, v);
-}
-
-inline void QOpenGLFunctions_4_4_Compatibility::glVertexAttribL4d(GLuint index, GLdouble x, GLdouble y, GLdouble z, GLdouble w)
-{
- d_4_1_Core->f.VertexAttribL4d(index, x, y, z, w);
-}
-
-inline void QOpenGLFunctions_4_4_Compatibility::glVertexAttribL3d(GLuint index, GLdouble x, GLdouble y, GLdouble z)
-{
- d_4_1_Core->f.VertexAttribL3d(index, x, y, z);
-}
-
-inline void QOpenGLFunctions_4_4_Compatibility::glVertexAttribL2d(GLuint index, GLdouble x, GLdouble y)
-{
- d_4_1_Core->f.VertexAttribL2d(index, x, y);
-}
-
-inline void QOpenGLFunctions_4_4_Compatibility::glVertexAttribL1d(GLuint index, GLdouble x)
-{
- d_4_1_Core->f.VertexAttribL1d(index, x);
-}
-
-inline void QOpenGLFunctions_4_4_Compatibility::glGetProgramPipelineInfoLog(GLuint pipeline, GLsizei bufSize, GLsizei *length, GLchar *infoLog)
-{
- d_4_1_Core->f.GetProgramPipelineInfoLog(pipeline, bufSize, length, infoLog);
-}
-
-inline void QOpenGLFunctions_4_4_Compatibility::glValidateProgramPipeline(GLuint pipeline)
-{
- d_4_1_Core->f.ValidateProgramPipeline(pipeline);
-}
-
-inline void QOpenGLFunctions_4_4_Compatibility::glProgramUniformMatrix4x3dv(GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLdouble *value)
-{
- d_4_1_Core->f.ProgramUniformMatrix4x3dv(program, location, count, transpose, value);
-}
-
-inline void QOpenGLFunctions_4_4_Compatibility::glProgramUniformMatrix3x4dv(GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLdouble *value)
-{
- d_4_1_Core->f.ProgramUniformMatrix3x4dv(program, location, count, transpose, value);
-}
-
-inline void QOpenGLFunctions_4_4_Compatibility::glProgramUniformMatrix4x2dv(GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLdouble *value)
-{
- d_4_1_Core->f.ProgramUniformMatrix4x2dv(program, location, count, transpose, value);
-}
-
-inline void QOpenGLFunctions_4_4_Compatibility::glProgramUniformMatrix2x4dv(GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLdouble *value)
-{
- d_4_1_Core->f.ProgramUniformMatrix2x4dv(program, location, count, transpose, value);
-}
-
-inline void QOpenGLFunctions_4_4_Compatibility::glProgramUniformMatrix3x2dv(GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLdouble *value)
-{
- d_4_1_Core->f.ProgramUniformMatrix3x2dv(program, location, count, transpose, value);
-}
-
-inline void QOpenGLFunctions_4_4_Compatibility::glProgramUniformMatrix2x3dv(GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLdouble *value)
-{
- d_4_1_Core->f.ProgramUniformMatrix2x3dv(program, location, count, transpose, value);
-}
-
-inline void QOpenGLFunctions_4_4_Compatibility::glProgramUniformMatrix4x3fv(GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value)
-{
- d_4_1_Core->f.ProgramUniformMatrix4x3fv(program, location, count, transpose, value);
-}
-
-inline void QOpenGLFunctions_4_4_Compatibility::glProgramUniformMatrix3x4fv(GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value)
-{
- d_4_1_Core->f.ProgramUniformMatrix3x4fv(program, location, count, transpose, value);
-}
-
-inline void QOpenGLFunctions_4_4_Compatibility::glProgramUniformMatrix4x2fv(GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value)
-{
- d_4_1_Core->f.ProgramUniformMatrix4x2fv(program, location, count, transpose, value);
-}
-
-inline void QOpenGLFunctions_4_4_Compatibility::glProgramUniformMatrix2x4fv(GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value)
-{
- d_4_1_Core->f.ProgramUniformMatrix2x4fv(program, location, count, transpose, value);
-}
-
-inline void QOpenGLFunctions_4_4_Compatibility::glProgramUniformMatrix3x2fv(GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value)
-{
- d_4_1_Core->f.ProgramUniformMatrix3x2fv(program, location, count, transpose, value);
-}
-
-inline void QOpenGLFunctions_4_4_Compatibility::glProgramUniformMatrix2x3fv(GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value)
-{
- d_4_1_Core->f.ProgramUniformMatrix2x3fv(program, location, count, transpose, value);
-}
-
-inline void QOpenGLFunctions_4_4_Compatibility::glProgramUniformMatrix4dv(GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLdouble *value)
-{
- d_4_1_Core->f.ProgramUniformMatrix4dv(program, location, count, transpose, value);
-}
-
-inline void QOpenGLFunctions_4_4_Compatibility::glProgramUniformMatrix3dv(GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLdouble *value)
-{
- d_4_1_Core->f.ProgramUniformMatrix3dv(program, location, count, transpose, value);
-}
-
-inline void QOpenGLFunctions_4_4_Compatibility::glProgramUniformMatrix2dv(GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLdouble *value)
-{
- d_4_1_Core->f.ProgramUniformMatrix2dv(program, location, count, transpose, value);
-}
-
-inline void QOpenGLFunctions_4_4_Compatibility::glProgramUniformMatrix4fv(GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value)
-{
- d_4_1_Core->f.ProgramUniformMatrix4fv(program, location, count, transpose, value);
-}
-
-inline void QOpenGLFunctions_4_4_Compatibility::glProgramUniformMatrix3fv(GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value)
-{
- d_4_1_Core->f.ProgramUniformMatrix3fv(program, location, count, transpose, value);
-}
-
-inline void QOpenGLFunctions_4_4_Compatibility::glProgramUniformMatrix2fv(GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value)
-{
- d_4_1_Core->f.ProgramUniformMatrix2fv(program, location, count, transpose, value);
-}
-
-inline void QOpenGLFunctions_4_4_Compatibility::glProgramUniform4uiv(GLuint program, GLint location, GLsizei count, const GLuint *value)
-{
- d_4_1_Core->f.ProgramUniform4uiv(program, location, count, value);
-}
-
-inline void QOpenGLFunctions_4_4_Compatibility::glProgramUniform4ui(GLuint program, GLint location, GLuint v0, GLuint v1, GLuint v2, GLuint v3)
-{
- d_4_1_Core->f.ProgramUniform4ui(program, location, v0, v1, v2, v3);
-}
-
-inline void QOpenGLFunctions_4_4_Compatibility::glProgramUniform4dv(GLuint program, GLint location, GLsizei count, const GLdouble *value)
-{
- d_4_1_Core->f.ProgramUniform4dv(program, location, count, value);
-}
-
-inline void QOpenGLFunctions_4_4_Compatibility::glProgramUniform4d(GLuint program, GLint location, GLdouble v0, GLdouble v1, GLdouble v2, GLdouble v3)
-{
- d_4_1_Core->f.ProgramUniform4d(program, location, v0, v1, v2, v3);
-}
-
-inline void QOpenGLFunctions_4_4_Compatibility::glProgramUniform4fv(GLuint program, GLint location, GLsizei count, const GLfloat *value)
-{
- d_4_1_Core->f.ProgramUniform4fv(program, location, count, value);
-}
-
-inline void QOpenGLFunctions_4_4_Compatibility::glProgramUniform4f(GLuint program, GLint location, GLfloat v0, GLfloat v1, GLfloat v2, GLfloat v3)
-{
- d_4_1_Core->f.ProgramUniform4f(program, location, v0, v1, v2, v3);
-}
-
-inline void QOpenGLFunctions_4_4_Compatibility::glProgramUniform4iv(GLuint program, GLint location, GLsizei count, const GLint *value)
-{
- d_4_1_Core->f.ProgramUniform4iv(program, location, count, value);
-}
-
-inline void QOpenGLFunctions_4_4_Compatibility::glProgramUniform4i(GLuint program, GLint location, GLint v0, GLint v1, GLint v2, GLint v3)
-{
- d_4_1_Core->f.ProgramUniform4i(program, location, v0, v1, v2, v3);
-}
-
-inline void QOpenGLFunctions_4_4_Compatibility::glProgramUniform3uiv(GLuint program, GLint location, GLsizei count, const GLuint *value)
-{
- d_4_1_Core->f.ProgramUniform3uiv(program, location, count, value);
-}
-
-inline void QOpenGLFunctions_4_4_Compatibility::glProgramUniform3ui(GLuint program, GLint location, GLuint v0, GLuint v1, GLuint v2)
-{
- d_4_1_Core->f.ProgramUniform3ui(program, location, v0, v1, v2);
-}
-
-inline void QOpenGLFunctions_4_4_Compatibility::glProgramUniform3dv(GLuint program, GLint location, GLsizei count, const GLdouble *value)
-{
- d_4_1_Core->f.ProgramUniform3dv(program, location, count, value);
-}
-
-inline void QOpenGLFunctions_4_4_Compatibility::glProgramUniform3d(GLuint program, GLint location, GLdouble v0, GLdouble v1, GLdouble v2)
-{
- d_4_1_Core->f.ProgramUniform3d(program, location, v0, v1, v2);
-}
-
-inline void QOpenGLFunctions_4_4_Compatibility::glProgramUniform3fv(GLuint program, GLint location, GLsizei count, const GLfloat *value)
-{
- d_4_1_Core->f.ProgramUniform3fv(program, location, count, value);
-}
-
-inline void QOpenGLFunctions_4_4_Compatibility::glProgramUniform3f(GLuint program, GLint location, GLfloat v0, GLfloat v1, GLfloat v2)
-{
- d_4_1_Core->f.ProgramUniform3f(program, location, v0, v1, v2);
-}
-
-inline void QOpenGLFunctions_4_4_Compatibility::glProgramUniform3iv(GLuint program, GLint location, GLsizei count, const GLint *value)
-{
- d_4_1_Core->f.ProgramUniform3iv(program, location, count, value);
-}
-
-inline void QOpenGLFunctions_4_4_Compatibility::glProgramUniform3i(GLuint program, GLint location, GLint v0, GLint v1, GLint v2)
-{
- d_4_1_Core->f.ProgramUniform3i(program, location, v0, v1, v2);
-}
-
-inline void QOpenGLFunctions_4_4_Compatibility::glProgramUniform2uiv(GLuint program, GLint location, GLsizei count, const GLuint *value)
-{
- d_4_1_Core->f.ProgramUniform2uiv(program, location, count, value);
-}
-
-inline void QOpenGLFunctions_4_4_Compatibility::glProgramUniform2ui(GLuint program, GLint location, GLuint v0, GLuint v1)
-{
- d_4_1_Core->f.ProgramUniform2ui(program, location, v0, v1);
-}
-
-inline void QOpenGLFunctions_4_4_Compatibility::glProgramUniform2dv(GLuint program, GLint location, GLsizei count, const GLdouble *value)
-{
- d_4_1_Core->f.ProgramUniform2dv(program, location, count, value);
-}
-
-inline void QOpenGLFunctions_4_4_Compatibility::glProgramUniform2d(GLuint program, GLint location, GLdouble v0, GLdouble v1)
-{
- d_4_1_Core->f.ProgramUniform2d(program, location, v0, v1);
-}
-
-inline void QOpenGLFunctions_4_4_Compatibility::glProgramUniform2fv(GLuint program, GLint location, GLsizei count, const GLfloat *value)
-{
- d_4_1_Core->f.ProgramUniform2fv(program, location, count, value);
-}
-
-inline void QOpenGLFunctions_4_4_Compatibility::glProgramUniform2f(GLuint program, GLint location, GLfloat v0, GLfloat v1)
-{
- d_4_1_Core->f.ProgramUniform2f(program, location, v0, v1);
-}
-
-inline void QOpenGLFunctions_4_4_Compatibility::glProgramUniform2iv(GLuint program, GLint location, GLsizei count, const GLint *value)
-{
- d_4_1_Core->f.ProgramUniform2iv(program, location, count, value);
-}
-
-inline void QOpenGLFunctions_4_4_Compatibility::glProgramUniform2i(GLuint program, GLint location, GLint v0, GLint v1)
-{
- d_4_1_Core->f.ProgramUniform2i(program, location, v0, v1);
-}
-
-inline void QOpenGLFunctions_4_4_Compatibility::glProgramUniform1uiv(GLuint program, GLint location, GLsizei count, const GLuint *value)
-{
- d_4_1_Core->f.ProgramUniform1uiv(program, location, count, value);
-}
-
-inline void QOpenGLFunctions_4_4_Compatibility::glProgramUniform1ui(GLuint program, GLint location, GLuint v0)
-{
- d_4_1_Core->f.ProgramUniform1ui(program, location, v0);
-}
-
-inline void QOpenGLFunctions_4_4_Compatibility::glProgramUniform1dv(GLuint program, GLint location, GLsizei count, const GLdouble *value)
-{
- d_4_1_Core->f.ProgramUniform1dv(program, location, count, value);
-}
-
-inline void QOpenGLFunctions_4_4_Compatibility::glProgramUniform1d(GLuint program, GLint location, GLdouble v0)
-{
- d_4_1_Core->f.ProgramUniform1d(program, location, v0);
-}
-
-inline void QOpenGLFunctions_4_4_Compatibility::glProgramUniform1fv(GLuint program, GLint location, GLsizei count, const GLfloat *value)
-{
- d_4_1_Core->f.ProgramUniform1fv(program, location, count, value);
-}
-
-inline void QOpenGLFunctions_4_4_Compatibility::glProgramUniform1f(GLuint program, GLint location, GLfloat v0)
-{
- d_4_1_Core->f.ProgramUniform1f(program, location, v0);
-}
-
-inline void QOpenGLFunctions_4_4_Compatibility::glProgramUniform1iv(GLuint program, GLint location, GLsizei count, const GLint *value)
-{
- d_4_1_Core->f.ProgramUniform1iv(program, location, count, value);
-}
-
-inline void QOpenGLFunctions_4_4_Compatibility::glProgramUniform1i(GLuint program, GLint location, GLint v0)
-{
- d_4_1_Core->f.ProgramUniform1i(program, location, v0);
-}
-
-inline void QOpenGLFunctions_4_4_Compatibility::glGetProgramPipelineiv(GLuint pipeline, GLenum pname, GLint *params)
-{
- d_4_1_Core->f.GetProgramPipelineiv(pipeline, pname, params);
-}
-
-inline GLboolean QOpenGLFunctions_4_4_Compatibility::glIsProgramPipeline(GLuint pipeline)
-{
- return d_4_1_Core->f.IsProgramPipeline(pipeline);
-}
-
-inline void QOpenGLFunctions_4_4_Compatibility::glGenProgramPipelines(GLsizei n, GLuint *pipelines)
-{
- d_4_1_Core->f.GenProgramPipelines(n, pipelines);
-}
-
-inline void QOpenGLFunctions_4_4_Compatibility::glDeleteProgramPipelines(GLsizei n, const GLuint *pipelines)
-{
- d_4_1_Core->f.DeleteProgramPipelines(n, pipelines);
-}
-
-inline void QOpenGLFunctions_4_4_Compatibility::glBindProgramPipeline(GLuint pipeline)
-{
- d_4_1_Core->f.BindProgramPipeline(pipeline);
-}
-
-inline GLuint QOpenGLFunctions_4_4_Compatibility::glCreateShaderProgramv(GLenum type, GLsizei count, const GLchar *const *strings)
-{
- return d_4_1_Core->f.CreateShaderProgramv(type, count, strings);
-}
-
-inline void QOpenGLFunctions_4_4_Compatibility::glActiveShaderProgram(GLuint pipeline, GLuint program)
-{
- d_4_1_Core->f.ActiveShaderProgram(pipeline, program);
-}
-
-inline void QOpenGLFunctions_4_4_Compatibility::glUseProgramStages(GLuint pipeline, GLbitfield stages, GLuint program)
-{
- d_4_1_Core->f.UseProgramStages(pipeline, stages, program);
-}
-
-inline void QOpenGLFunctions_4_4_Compatibility::glProgramParameteri(GLuint program, GLenum pname, GLint value)
-{
- d_4_1_Core->f.ProgramParameteri(program, pname, value);
-}
-
-inline void QOpenGLFunctions_4_4_Compatibility::glProgramBinary(GLuint program, GLenum binaryFormat, const void *binary, GLsizei length)
-{
- d_4_1_Core->f.ProgramBinary(program, binaryFormat, binary, length);
-}
-
-inline void QOpenGLFunctions_4_4_Compatibility::glGetProgramBinary(GLuint program, GLsizei bufSize, GLsizei *length, GLenum *binaryFormat, void *binary)
-{
- d_4_1_Core->f.GetProgramBinary(program, bufSize, length, binaryFormat, binary);
-}
-
-inline void QOpenGLFunctions_4_4_Compatibility::glClearDepthf(GLfloat dd)
-{
- d_4_1_Core->f.ClearDepthf(dd);
-}
-
-inline void QOpenGLFunctions_4_4_Compatibility::glDepthRangef(GLfloat n, GLfloat f)
-{
- d_4_1_Core->f.DepthRangef(n, f);
-}
-
-inline void QOpenGLFunctions_4_4_Compatibility::glGetShaderPrecisionFormat(GLenum shadertype, GLenum precisiontype, GLint *range, GLint *precision)
-{
- d_4_1_Core->f.GetShaderPrecisionFormat(shadertype, precisiontype, range, precision);
-}
-
-inline void QOpenGLFunctions_4_4_Compatibility::glShaderBinary(GLsizei count, const GLuint *shaders, GLenum binaryformat, const void *binary, GLsizei length)
-{
- d_4_1_Core->f.ShaderBinary(count, shaders, binaryformat, binary, length);
-}
-
-inline void QOpenGLFunctions_4_4_Compatibility::glReleaseShaderCompiler()
-{
- d_4_1_Core->f.ReleaseShaderCompiler();
-}
-
-
-// OpenGL 4.2 core functions
-inline void QOpenGLFunctions_4_4_Compatibility::glDrawTransformFeedbackStreamInstanced(GLenum mode, GLuint id, GLuint stream, GLsizei instancecount)
-{
- d_4_2_Core->f.DrawTransformFeedbackStreamInstanced(mode, id, stream, instancecount);
-}
-
-inline void QOpenGLFunctions_4_4_Compatibility::glDrawTransformFeedbackInstanced(GLenum mode, GLuint id, GLsizei instancecount)
-{
- d_4_2_Core->f.DrawTransformFeedbackInstanced(mode, id, instancecount);
-}
-
-inline void QOpenGLFunctions_4_4_Compatibility::glTexStorage3D(GLenum target, GLsizei levels, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth)
-{
- d_4_2_Core->f.TexStorage3D(target, levels, internalformat, width, height, depth);
-}
-
-inline void QOpenGLFunctions_4_4_Compatibility::glTexStorage2D(GLenum target, GLsizei levels, GLenum internalformat, GLsizei width, GLsizei height)
-{
- d_4_2_Core->f.TexStorage2D(target, levels, internalformat, width, height);
-}
-
-inline void QOpenGLFunctions_4_4_Compatibility::glTexStorage1D(GLenum target, GLsizei levels, GLenum internalformat, GLsizei width)
-{
- d_4_2_Core->f.TexStorage1D(target, levels, internalformat, width);
-}
-
-inline void QOpenGLFunctions_4_4_Compatibility::glMemoryBarrier(GLbitfield barriers)
-{
- d_4_2_Core->f.MemoryBarrier(barriers);
-}
-
-inline void QOpenGLFunctions_4_4_Compatibility::glBindImageTexture(GLuint unit, GLuint texture, GLint level, GLboolean layered, GLint layer, GLenum access, GLenum format)
-{
- d_4_2_Core->f.BindImageTexture(unit, texture, level, layered, layer, access, format);
-}
-
-inline void QOpenGLFunctions_4_4_Compatibility::glGetActiveAtomicCounterBufferiv(GLuint program, GLuint bufferIndex, GLenum pname, GLint *params)
-{
- d_4_2_Core->f.GetActiveAtomicCounterBufferiv(program, bufferIndex, pname, params);
-}
-
-inline void QOpenGLFunctions_4_4_Compatibility::glGetInternalformativ(GLenum target, GLenum internalformat, GLenum pname, GLsizei bufSize, GLint *params)
-{
- d_4_2_Core->f.GetInternalformativ(target, internalformat, pname, bufSize, params);
-}
-
-inline void QOpenGLFunctions_4_4_Compatibility::glDrawElementsInstancedBaseVertexBaseInstance(GLenum mode, GLsizei count, GLenum type, const void *indices, GLsizei instancecount, GLint basevertex, GLuint baseinstance)
-{
- d_4_2_Core->f.DrawElementsInstancedBaseVertexBaseInstance(mode, count, type, indices, instancecount, basevertex, baseinstance);
-}
-
-inline void QOpenGLFunctions_4_4_Compatibility::glDrawElementsInstancedBaseInstance(GLenum mode, GLsizei count, GLenum type, const void *indices, GLsizei instancecount, GLuint baseinstance)
-{
- d_4_2_Core->f.DrawElementsInstancedBaseInstance(mode, count, type, indices, instancecount, baseinstance);
-}
-
-inline void QOpenGLFunctions_4_4_Compatibility::glDrawArraysInstancedBaseInstance(GLenum mode, GLint first, GLsizei count, GLsizei instancecount, GLuint baseinstance)
-{
- d_4_2_Core->f.DrawArraysInstancedBaseInstance(mode, first, count, instancecount, baseinstance);
-}
-
-
-// OpenGL 4.3 core functions
-inline void QOpenGLFunctions_4_4_Compatibility::glGetObjectPtrLabel(const void *ptr, GLsizei bufSize, GLsizei *length, GLchar *label)
-{
- d_4_3_Core->f.GetObjectPtrLabel(ptr, bufSize, length, label);
-}
-
-inline void QOpenGLFunctions_4_4_Compatibility::glObjectPtrLabel(const void *ptr, GLsizei length, const GLchar *label)
-{
- d_4_3_Core->f.ObjectPtrLabel(ptr, length, label);
-}
-
-inline void QOpenGLFunctions_4_4_Compatibility::glGetObjectLabel(GLenum identifier, GLuint name, GLsizei bufSize, GLsizei *length, GLchar *label)
-{
- d_4_3_Core->f.GetObjectLabel(identifier, name, bufSize, length, label);
-}
-
-inline void QOpenGLFunctions_4_4_Compatibility::glObjectLabel(GLenum identifier, GLuint name, GLsizei length, const GLchar *label)
-{
- d_4_3_Core->f.ObjectLabel(identifier, name, length, label);
-}
-
-inline void QOpenGLFunctions_4_4_Compatibility::glPopDebugGroup()
-{
- d_4_3_Core->f.PopDebugGroup();
-}
-
-inline void QOpenGLFunctions_4_4_Compatibility::glPushDebugGroup(GLenum source, GLuint id, GLsizei length, const GLchar *message)
-{
- d_4_3_Core->f.PushDebugGroup(source, id, length, message);
-}
-
-inline GLuint QOpenGLFunctions_4_4_Compatibility::glGetDebugMessageLog(GLuint count, GLsizei bufSize, GLenum *sources, GLenum *types, GLuint *ids, GLenum *severities, GLsizei *lengths, GLchar *messageLog)
-{
- return d_4_3_Core->f.GetDebugMessageLog(count, bufSize, sources, types, ids, severities, lengths, messageLog);
-}
-
-inline void QOpenGLFunctions_4_4_Compatibility::glDebugMessageCallback(GLDEBUGPROC callback, const void *userParam)
-{
- d_4_3_Core->f.DebugMessageCallback(callback, userParam);
-}
-
-inline void QOpenGLFunctions_4_4_Compatibility::glDebugMessageInsert(GLenum source, GLenum type, GLuint id, GLenum severity, GLsizei length, const GLchar *buf)
-{
- d_4_3_Core->f.DebugMessageInsert(source, type, id, severity, length, buf);
-}
-
-inline void QOpenGLFunctions_4_4_Compatibility::glDebugMessageControl(GLenum source, GLenum type, GLenum severity, GLsizei count, const GLuint *ids, GLboolean enabled)
-{
- d_4_3_Core->f.DebugMessageControl(source, type, severity, count, ids, enabled);
-}
-
-inline void QOpenGLFunctions_4_4_Compatibility::glVertexBindingDivisor(GLuint bindingindex, GLuint divisor)
-{
- d_4_3_Core->f.VertexBindingDivisor(bindingindex, divisor);
-}
-
-inline void QOpenGLFunctions_4_4_Compatibility::glVertexAttribBinding(GLuint attribindex, GLuint bindingindex)
-{
- d_4_3_Core->f.VertexAttribBinding(attribindex, bindingindex);
-}
-
-inline void QOpenGLFunctions_4_4_Compatibility::glVertexAttribLFormat(GLuint attribindex, GLint size, GLenum type, GLuint relativeoffset)
-{
- d_4_3_Core->f.VertexAttribLFormat(attribindex, size, type, relativeoffset);
-}
-
-inline void QOpenGLFunctions_4_4_Compatibility::glVertexAttribIFormat(GLuint attribindex, GLint size, GLenum type, GLuint relativeoffset)
-{
- d_4_3_Core->f.VertexAttribIFormat(attribindex, size, type, relativeoffset);
-}
-
-inline void QOpenGLFunctions_4_4_Compatibility::glVertexAttribFormat(GLuint attribindex, GLint size, GLenum type, GLboolean normalized, GLuint relativeoffset)
-{
- d_4_3_Core->f.VertexAttribFormat(attribindex, size, type, normalized, relativeoffset);
-}
-
-inline void QOpenGLFunctions_4_4_Compatibility::glBindVertexBuffer(GLuint bindingindex, GLuint buffer, GLintptr offset, GLsizei stride)
-{
- d_4_3_Core->f.BindVertexBuffer(bindingindex, buffer, offset, stride);
-}
-
-inline void QOpenGLFunctions_4_4_Compatibility::glTextureView(GLuint texture, GLenum target, GLuint origtexture, GLenum internalformat, GLuint minlevel, GLuint numlevels, GLuint minlayer, GLuint numlayers)
-{
- d_4_3_Core->f.TextureView(texture, target, origtexture, internalformat, minlevel, numlevels, minlayer, numlayers);
-}
-
-inline void QOpenGLFunctions_4_4_Compatibility::glTexStorage3DMultisample(GLenum target, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth, GLboolean fixedsamplelocations)
-{
- d_4_3_Core->f.TexStorage3DMultisample(target, samples, internalformat, width, height, depth, fixedsamplelocations);
-}
-
-inline void QOpenGLFunctions_4_4_Compatibility::glTexStorage2DMultisample(GLenum target, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height, GLboolean fixedsamplelocations)
-{
- d_4_3_Core->f.TexStorage2DMultisample(target, samples, internalformat, width, height, fixedsamplelocations);
-}
-
-inline void QOpenGLFunctions_4_4_Compatibility::glTexBufferRange(GLenum target, GLenum internalformat, GLuint buffer, GLintptr offset, GLsizeiptr size)
-{
- d_4_3_Core->f.TexBufferRange(target, internalformat, buffer, offset, size);
-}
-
-inline void QOpenGLFunctions_4_4_Compatibility::glShaderStorageBlockBinding(GLuint program, GLuint storageBlockIndex, GLuint storageBlockBinding)
-{
- d_4_3_Core->f.ShaderStorageBlockBinding(program, storageBlockIndex, storageBlockBinding);
-}
-
-inline GLint QOpenGLFunctions_4_4_Compatibility::glGetProgramResourceLocationIndex(GLuint program, GLenum programInterface, const GLchar *name)
-{
- return d_4_3_Core->f.GetProgramResourceLocationIndex(program, programInterface, name);
-}
-
-inline GLint QOpenGLFunctions_4_4_Compatibility::glGetProgramResourceLocation(GLuint program, GLenum programInterface, const GLchar *name)
-{
- return d_4_3_Core->f.GetProgramResourceLocation(program, programInterface, name);
-}
-
-inline void QOpenGLFunctions_4_4_Compatibility::glGetProgramResourceiv(GLuint program, GLenum programInterface, GLuint index, GLsizei propCount, const GLenum *props, GLsizei bufSize, GLsizei *length, GLint *params)
-{
- d_4_3_Core->f.GetProgramResourceiv(program, programInterface, index, propCount, props, bufSize, length, params);
-}
-
-inline void QOpenGLFunctions_4_4_Compatibility::glGetProgramResourceName(GLuint program, GLenum programInterface, GLuint index, GLsizei bufSize, GLsizei *length, GLchar *name)
-{
- d_4_3_Core->f.GetProgramResourceName(program, programInterface, index, bufSize, length, name);
-}
-
-inline GLuint QOpenGLFunctions_4_4_Compatibility::glGetProgramResourceIndex(GLuint program, GLenum programInterface, const GLchar *name)
-{
- return d_4_3_Core->f.GetProgramResourceIndex(program, programInterface, name);
-}
-
-inline void QOpenGLFunctions_4_4_Compatibility::glGetProgramInterfaceiv(GLuint program, GLenum programInterface, GLenum pname, GLint *params)
-{
- d_4_3_Core->f.GetProgramInterfaceiv(program, programInterface, pname, params);
-}
-
-inline void QOpenGLFunctions_4_4_Compatibility::glMultiDrawElementsIndirect(GLenum mode, GLenum type, const void *indirect, GLsizei drawcount, GLsizei stride)
-{
- d_4_3_Core->f.MultiDrawElementsIndirect(mode, type, indirect, drawcount, stride);
-}
-
-inline void QOpenGLFunctions_4_4_Compatibility::glMultiDrawArraysIndirect(GLenum mode, const void *indirect, GLsizei drawcount, GLsizei stride)
-{
- d_4_3_Core->f.MultiDrawArraysIndirect(mode, indirect, drawcount, stride);
-}
-
-inline void QOpenGLFunctions_4_4_Compatibility::glInvalidateSubFramebuffer(GLenum target, GLsizei numAttachments, const GLenum *attachments, GLint x, GLint y, GLsizei width, GLsizei height)
-{
- d_4_3_Core->f.InvalidateSubFramebuffer(target, numAttachments, attachments, x, y, width, height);
-}
-
-inline void QOpenGLFunctions_4_4_Compatibility::glInvalidateFramebuffer(GLenum target, GLsizei numAttachments, const GLenum *attachments)
-{
- d_4_3_Core->f.InvalidateFramebuffer(target, numAttachments, attachments);
-}
-
-inline void QOpenGLFunctions_4_4_Compatibility::glInvalidateBufferData(GLuint buffer)
-{
- d_4_3_Core->f.InvalidateBufferData(buffer);
-}
-
-inline void QOpenGLFunctions_4_4_Compatibility::glInvalidateBufferSubData(GLuint buffer, GLintptr offset, GLsizeiptr length)
-{
- d_4_3_Core->f.InvalidateBufferSubData(buffer, offset, length);
-}
-
-inline void QOpenGLFunctions_4_4_Compatibility::glInvalidateTexImage(GLuint texture, GLint level)
-{
- d_4_3_Core->f.InvalidateTexImage(texture, level);
-}
-
-inline void QOpenGLFunctions_4_4_Compatibility::glInvalidateTexSubImage(GLuint texture, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth)
-{
- d_4_3_Core->f.InvalidateTexSubImage(texture, level, xoffset, yoffset, zoffset, width, height, depth);
-}
-
-inline void QOpenGLFunctions_4_4_Compatibility::glGetInternalformati64v(GLenum target, GLenum internalformat, GLenum pname, GLsizei bufSize, GLint64 *params)
-{
- d_4_3_Core->f.GetInternalformati64v(target, internalformat, pname, bufSize, params);
-}
-
-inline void QOpenGLFunctions_4_4_Compatibility::glGetFramebufferParameteriv(GLenum target, GLenum pname, GLint *params)
-{
- d_4_3_Core->f.GetFramebufferParameteriv(target, pname, params);
-}
-
-inline void QOpenGLFunctions_4_4_Compatibility::glFramebufferParameteri(GLenum target, GLenum pname, GLint param)
-{
- d_4_3_Core->f.FramebufferParameteri(target, pname, param);
-}
-
-inline void QOpenGLFunctions_4_4_Compatibility::glCopyImageSubData(GLuint srcName, GLenum srcTarget, GLint srcLevel, GLint srcX, GLint srcY, GLint srcZ, GLuint dstName, GLenum dstTarget, GLint dstLevel, GLint dstX, GLint dstY, GLint dstZ, GLsizei srcWidth, GLsizei srcHeight, GLsizei srcDepth)
-{
- d_4_3_Core->f.CopyImageSubData(srcName, srcTarget, srcLevel, srcX, srcY, srcZ, dstName, dstTarget, dstLevel, dstX, dstY, dstZ, srcWidth, srcHeight, srcDepth);
-}
-
-inline void QOpenGLFunctions_4_4_Compatibility::glDispatchComputeIndirect(GLintptr indirect)
-{
- d_4_3_Core->f.DispatchComputeIndirect(indirect);
-}
-
-inline void QOpenGLFunctions_4_4_Compatibility::glDispatchCompute(GLuint num_groups_x, GLuint num_groups_y, GLuint num_groups_z)
-{
- d_4_3_Core->f.DispatchCompute(num_groups_x, num_groups_y, num_groups_z);
-}
-
-inline void QOpenGLFunctions_4_4_Compatibility::glClearBufferSubData(GLenum target, GLenum internalformat, GLintptr offset, GLsizeiptr size, GLenum format, GLenum type, const void *data)
-{
- d_4_3_Core->f.ClearBufferSubData(target, internalformat, offset, size, format, type, data);
-}
-
-inline void QOpenGLFunctions_4_4_Compatibility::glClearBufferData(GLenum target, GLenum internalformat, GLenum format, GLenum type, const void *data)
-{
- d_4_3_Core->f.ClearBufferData(target, internalformat, format, type, data);
-}
-
-
-// OpenGL 4.4 core functions
-inline void QOpenGLFunctions_4_4_Compatibility::glBindVertexBuffers(GLuint first, GLsizei count, const GLuint *buffers, const GLintptr *offsets, const GLsizei *strides)
-{
- d_4_4_Core->f.BindVertexBuffers(first, count, buffers, offsets, strides);
-}
-
-inline void QOpenGLFunctions_4_4_Compatibility::glBindImageTextures(GLuint first, GLsizei count, const GLuint *textures)
-{
- d_4_4_Core->f.BindImageTextures(first, count, textures);
-}
-
-inline void QOpenGLFunctions_4_4_Compatibility::glBindSamplers(GLuint first, GLsizei count, const GLuint *samplers)
-{
- d_4_4_Core->f.BindSamplers(first, count, samplers);
-}
-
-inline void QOpenGLFunctions_4_4_Compatibility::glBindTextures(GLuint first, GLsizei count, const GLuint *textures)
-{
- d_4_4_Core->f.BindTextures(first, count, textures);
-}
-
-inline void QOpenGLFunctions_4_4_Compatibility::glBindBuffersRange(GLenum target, GLuint first, GLsizei count, const GLuint *buffers, const GLintptr *offsets, const GLsizeiptr *sizes)
-{
- d_4_4_Core->f.BindBuffersRange(target, first, count, buffers, offsets, sizes);
-}
-
-inline void QOpenGLFunctions_4_4_Compatibility::glBindBuffersBase(GLenum target, GLuint first, GLsizei count, const GLuint *buffers)
-{
- d_4_4_Core->f.BindBuffersBase(target, first, count, buffers);
-}
-
-inline void QOpenGLFunctions_4_4_Compatibility::glClearTexSubImage(GLuint texture, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLenum type, const void *data)
-{
- d_4_4_Core->f.ClearTexSubImage(texture, level, xoffset, yoffset, zoffset, width, height, depth, format, type, data);
-}
-
-inline void QOpenGLFunctions_4_4_Compatibility::glClearTexImage(GLuint texture, GLint level, GLenum format, GLenum type, const void *data)
-{
- d_4_4_Core->f.ClearTexImage(texture, level, format, type, data);
-}
-
-inline void QOpenGLFunctions_4_4_Compatibility::glBufferStorage(GLenum target, GLsizeiptr size, const void *data, GLbitfield flags)
-{
- d_4_4_Core->f.BufferStorage(target, size, data, flags);
-}
-
-
-// OpenGL 1.0 deprecated functions
-inline void QOpenGLFunctions_4_4_Compatibility::glTranslatef(GLfloat x, GLfloat y, GLfloat z)
-{
- d_1_0_Deprecated->f.Translatef(x, y, z);
-}
-
-inline void QOpenGLFunctions_4_4_Compatibility::glTranslated(GLdouble x, GLdouble y, GLdouble z)
-{
- d_1_0_Deprecated->f.Translated(x, y, z);
-}
-
-inline void QOpenGLFunctions_4_4_Compatibility::glScalef(GLfloat x, GLfloat y, GLfloat z)
-{
- d_1_0_Deprecated->f.Scalef(x, y, z);
-}
-
-inline void QOpenGLFunctions_4_4_Compatibility::glScaled(GLdouble x, GLdouble y, GLdouble z)
-{
- d_1_0_Deprecated->f.Scaled(x, y, z);
-}
-
-inline void QOpenGLFunctions_4_4_Compatibility::glRotatef(GLfloat angle, GLfloat x, GLfloat y, GLfloat z)
-{
- d_1_0_Deprecated->f.Rotatef(angle, x, y, z);
-}
-
-inline void QOpenGLFunctions_4_4_Compatibility::glRotated(GLdouble angle, GLdouble x, GLdouble y, GLdouble z)
-{
- d_1_0_Deprecated->f.Rotated(angle, x, y, z);
-}
-
-inline void QOpenGLFunctions_4_4_Compatibility::glPushMatrix()
-{
- d_1_0_Deprecated->f.PushMatrix();
-}
-
-inline void QOpenGLFunctions_4_4_Compatibility::glPopMatrix()
-{
- d_1_0_Deprecated->f.PopMatrix();
-}
-
-inline void QOpenGLFunctions_4_4_Compatibility::glOrtho(GLdouble left, GLdouble right, GLdouble bottom, GLdouble top, GLdouble zNear, GLdouble zFar)
-{
- d_1_0_Deprecated->f.Ortho(left, right, bottom, top, zNear, zFar);
-}
-
-inline void QOpenGLFunctions_4_4_Compatibility::glMultMatrixd(const GLdouble *m)
-{
- d_1_0_Deprecated->f.MultMatrixd(m);
-}
-
-inline void QOpenGLFunctions_4_4_Compatibility::glMultMatrixf(const GLfloat *m)
-{
- d_1_0_Deprecated->f.MultMatrixf(m);
-}
-
-inline void QOpenGLFunctions_4_4_Compatibility::glMatrixMode(GLenum mode)
-{
- d_1_0_Deprecated->f.MatrixMode(mode);
-}
-
-inline void QOpenGLFunctions_4_4_Compatibility::glLoadMatrixd(const GLdouble *m)
-{
- d_1_0_Deprecated->f.LoadMatrixd(m);
-}
-
-inline void QOpenGLFunctions_4_4_Compatibility::glLoadMatrixf(const GLfloat *m)
-{
- d_1_0_Deprecated->f.LoadMatrixf(m);
-}
-
-inline void QOpenGLFunctions_4_4_Compatibility::glLoadIdentity()
-{
- d_1_0_Deprecated->f.LoadIdentity();
-}
-
-inline void QOpenGLFunctions_4_4_Compatibility::glFrustum(GLdouble left, GLdouble right, GLdouble bottom, GLdouble top, GLdouble zNear, GLdouble zFar)
-{
- d_1_0_Deprecated->f.Frustum(left, right, bottom, top, zNear, zFar);
-}
-
-inline GLboolean QOpenGLFunctions_4_4_Compatibility::glIsList(GLuint list)
-{
- return d_1_0_Deprecated->f.IsList(list);
-}
-
-inline void QOpenGLFunctions_4_4_Compatibility::glGetTexGeniv(GLenum coord, GLenum pname, GLint *params)
-{
- d_1_0_Deprecated->f.GetTexGeniv(coord, pname, params);
-}
-
-inline void QOpenGLFunctions_4_4_Compatibility::glGetTexGenfv(GLenum coord, GLenum pname, GLfloat *params)
-{
- d_1_0_Deprecated->f.GetTexGenfv(coord, pname, params);
-}
-
-inline void QOpenGLFunctions_4_4_Compatibility::glGetTexGendv(GLenum coord, GLenum pname, GLdouble *params)
-{
- d_1_0_Deprecated->f.GetTexGendv(coord, pname, params);
-}
-
-inline void QOpenGLFunctions_4_4_Compatibility::glGetTexEnviv(GLenum target, GLenum pname, GLint *params)
-{
- d_1_0_Deprecated->f.GetTexEnviv(target, pname, params);
-}
-
-inline void QOpenGLFunctions_4_4_Compatibility::glGetTexEnvfv(GLenum target, GLenum pname, GLfloat *params)
-{
- d_1_0_Deprecated->f.GetTexEnvfv(target, pname, params);
-}
-
-inline void QOpenGLFunctions_4_4_Compatibility::glGetPolygonStipple(GLubyte *mask)
-{
- d_1_0_Deprecated->f.GetPolygonStipple(mask);
-}
-
-inline void QOpenGLFunctions_4_4_Compatibility::glGetPixelMapusv(GLenum map, GLushort *values)
-{
- d_1_0_Deprecated->f.GetPixelMapusv(map, values);
-}
-
-inline void QOpenGLFunctions_4_4_Compatibility::glGetPixelMapuiv(GLenum map, GLuint *values)
-{
- d_1_0_Deprecated->f.GetPixelMapuiv(map, values);
-}
-
-inline void QOpenGLFunctions_4_4_Compatibility::glGetPixelMapfv(GLenum map, GLfloat *values)
-{
- d_1_0_Deprecated->f.GetPixelMapfv(map, values);
-}
-
-inline void QOpenGLFunctions_4_4_Compatibility::glGetMaterialiv(GLenum face, GLenum pname, GLint *params)
-{
- d_1_0_Deprecated->f.GetMaterialiv(face, pname, params);
-}
-
-inline void QOpenGLFunctions_4_4_Compatibility::glGetMaterialfv(GLenum face, GLenum pname, GLfloat *params)
-{
- d_1_0_Deprecated->f.GetMaterialfv(face, pname, params);
-}
-
-inline void QOpenGLFunctions_4_4_Compatibility::glGetMapiv(GLenum target, GLenum query, GLint *v)
-{
- d_1_0_Deprecated->f.GetMapiv(target, query, v);
-}
-
-inline void QOpenGLFunctions_4_4_Compatibility::glGetMapfv(GLenum target, GLenum query, GLfloat *v)
-{
- d_1_0_Deprecated->f.GetMapfv(target, query, v);
-}
-
-inline void QOpenGLFunctions_4_4_Compatibility::glGetMapdv(GLenum target, GLenum query, GLdouble *v)
-{
- d_1_0_Deprecated->f.GetMapdv(target, query, v);
-}
-
-inline void QOpenGLFunctions_4_4_Compatibility::glGetLightiv(GLenum light, GLenum pname, GLint *params)
-{
- d_1_0_Deprecated->f.GetLightiv(light, pname, params);
-}
-
-inline void QOpenGLFunctions_4_4_Compatibility::glGetLightfv(GLenum light, GLenum pname, GLfloat *params)
-{
- d_1_0_Deprecated->f.GetLightfv(light, pname, params);
-}
-
-inline void QOpenGLFunctions_4_4_Compatibility::glGetClipPlane(GLenum plane, GLdouble *equation)
-{
- d_1_0_Deprecated->f.GetClipPlane(plane, equation);
-}
-
-inline void QOpenGLFunctions_4_4_Compatibility::glDrawPixels(GLsizei width, GLsizei height, GLenum format, GLenum type, const void *pixels)
-{
- d_1_0_Deprecated->f.DrawPixels(width, height, format, type, pixels);
-}
-
-inline void QOpenGLFunctions_4_4_Compatibility::glCopyPixels(GLint x, GLint y, GLsizei width, GLsizei height, GLenum type)
-{
- d_1_0_Deprecated->f.CopyPixels(x, y, width, height, type);
-}
-
-inline void QOpenGLFunctions_4_4_Compatibility::glPixelMapusv(GLenum map, GLsizei mapsize, const GLushort *values)
-{
- d_1_0_Deprecated->f.PixelMapusv(map, mapsize, values);
-}
-
-inline void QOpenGLFunctions_4_4_Compatibility::glPixelMapuiv(GLenum map, GLsizei mapsize, const GLuint *values)
-{
- d_1_0_Deprecated->f.PixelMapuiv(map, mapsize, values);
-}
-
-inline void QOpenGLFunctions_4_4_Compatibility::glPixelMapfv(GLenum map, GLsizei mapsize, const GLfloat *values)
-{
- d_1_0_Deprecated->f.PixelMapfv(map, mapsize, values);
-}
-
-inline void QOpenGLFunctions_4_4_Compatibility::glPixelTransferi(GLenum pname, GLint param)
-{
- d_1_0_Deprecated->f.PixelTransferi(pname, param);
-}
-
-inline void QOpenGLFunctions_4_4_Compatibility::glPixelTransferf(GLenum pname, GLfloat param)
-{
- d_1_0_Deprecated->f.PixelTransferf(pname, param);
-}
-
-inline void QOpenGLFunctions_4_4_Compatibility::glPixelZoom(GLfloat xfactor, GLfloat yfactor)
-{
- d_1_0_Deprecated->f.PixelZoom(xfactor, yfactor);
-}
-
-inline void QOpenGLFunctions_4_4_Compatibility::glAlphaFunc(GLenum func, GLfloat ref)
-{
- d_1_0_Deprecated->f.AlphaFunc(func, ref);
-}
-
-inline void QOpenGLFunctions_4_4_Compatibility::glEvalPoint2(GLint i, GLint j)
-{
- d_1_0_Deprecated->f.EvalPoint2(i, j);
-}
-
-inline void QOpenGLFunctions_4_4_Compatibility::glEvalMesh2(GLenum mode, GLint i1, GLint i2, GLint j1, GLint j2)
-{
- d_1_0_Deprecated->f.EvalMesh2(mode, i1, i2, j1, j2);
-}
-
-inline void QOpenGLFunctions_4_4_Compatibility::glEvalPoint1(GLint i)
-{
- d_1_0_Deprecated->f.EvalPoint1(i);
-}
-
-inline void QOpenGLFunctions_4_4_Compatibility::glEvalMesh1(GLenum mode, GLint i1, GLint i2)
-{
- d_1_0_Deprecated->f.EvalMesh1(mode, i1, i2);
-}
-
-inline void QOpenGLFunctions_4_4_Compatibility::glEvalCoord2fv(const GLfloat *u)
-{
- d_1_0_Deprecated->f.EvalCoord2fv(u);
-}
-
-inline void QOpenGLFunctions_4_4_Compatibility::glEvalCoord2f(GLfloat u, GLfloat v)
-{
- d_1_0_Deprecated->f.EvalCoord2f(u, v);
-}
-
-inline void QOpenGLFunctions_4_4_Compatibility::glEvalCoord2dv(const GLdouble *u)
-{
- d_1_0_Deprecated->f.EvalCoord2dv(u);
-}
-
-inline void QOpenGLFunctions_4_4_Compatibility::glEvalCoord2d(GLdouble u, GLdouble v)
-{
- d_1_0_Deprecated->f.EvalCoord2d(u, v);
-}
-
-inline void QOpenGLFunctions_4_4_Compatibility::glEvalCoord1fv(const GLfloat *u)
-{
- d_1_0_Deprecated->f.EvalCoord1fv(u);
-}
-
-inline void QOpenGLFunctions_4_4_Compatibility::glEvalCoord1f(GLfloat u)
-{
- d_1_0_Deprecated->f.EvalCoord1f(u);
-}
-
-inline void QOpenGLFunctions_4_4_Compatibility::glEvalCoord1dv(const GLdouble *u)
-{
- d_1_0_Deprecated->f.EvalCoord1dv(u);
-}
-
-inline void QOpenGLFunctions_4_4_Compatibility::glEvalCoord1d(GLdouble u)
-{
- d_1_0_Deprecated->f.EvalCoord1d(u);
-}
-
-inline void QOpenGLFunctions_4_4_Compatibility::glMapGrid2f(GLint un, GLfloat u1, GLfloat u2, GLint vn, GLfloat v1, GLfloat v2)
-{
- d_1_0_Deprecated->f.MapGrid2f(un, u1, u2, vn, v1, v2);
-}
-
-inline void QOpenGLFunctions_4_4_Compatibility::glMapGrid2d(GLint un, GLdouble u1, GLdouble u2, GLint vn, GLdouble v1, GLdouble v2)
-{
- d_1_0_Deprecated->f.MapGrid2d(un, u1, u2, vn, v1, v2);
-}
-
-inline void QOpenGLFunctions_4_4_Compatibility::glMapGrid1f(GLint un, GLfloat u1, GLfloat u2)
-{
- d_1_0_Deprecated->f.MapGrid1f(un, u1, u2);
-}
-
-inline void QOpenGLFunctions_4_4_Compatibility::glMapGrid1d(GLint un, GLdouble u1, GLdouble u2)
-{
- d_1_0_Deprecated->f.MapGrid1d(un, u1, u2);
-}
-
-inline void QOpenGLFunctions_4_4_Compatibility::glMap2f(GLenum target, GLfloat u1, GLfloat u2, GLint ustride, GLint uorder, GLfloat v1, GLfloat v2, GLint vstride, GLint vorder, const GLfloat *points)
-{
- d_1_0_Deprecated->f.Map2f(target, u1, u2, ustride, uorder, v1, v2, vstride, vorder, points);
-}
-
-inline void QOpenGLFunctions_4_4_Compatibility::glMap2d(GLenum target, GLdouble u1, GLdouble u2, GLint ustride, GLint uorder, GLdouble v1, GLdouble v2, GLint vstride, GLint vorder, const GLdouble *points)
-{
- d_1_0_Deprecated->f.Map2d(target, u1, u2, ustride, uorder, v1, v2, vstride, vorder, points);
-}
-
-inline void QOpenGLFunctions_4_4_Compatibility::glMap1f(GLenum target, GLfloat u1, GLfloat u2, GLint stride, GLint order, const GLfloat *points)
-{
- d_1_0_Deprecated->f.Map1f(target, u1, u2, stride, order, points);
-}
-
-inline void QOpenGLFunctions_4_4_Compatibility::glMap1d(GLenum target, GLdouble u1, GLdouble u2, GLint stride, GLint order, const GLdouble *points)
-{
- d_1_0_Deprecated->f.Map1d(target, u1, u2, stride, order, points);
-}
-
-inline void QOpenGLFunctions_4_4_Compatibility::glPushAttrib(GLbitfield mask)
-{
- d_1_0_Deprecated->f.PushAttrib(mask);
-}
-
-inline void QOpenGLFunctions_4_4_Compatibility::glPopAttrib()
-{
- d_1_0_Deprecated->f.PopAttrib();
-}
-
-inline void QOpenGLFunctions_4_4_Compatibility::glAccum(GLenum op, GLfloat value)
-{
- d_1_0_Deprecated->f.Accum(op, value);
-}
-
-inline void QOpenGLFunctions_4_4_Compatibility::glIndexMask(GLuint mask)
-{
- d_1_0_Deprecated->f.IndexMask(mask);
-}
-
-inline void QOpenGLFunctions_4_4_Compatibility::glClearIndex(GLfloat c)
-{
- d_1_0_Deprecated->f.ClearIndex(c);
-}
-
-inline void QOpenGLFunctions_4_4_Compatibility::glClearAccum(GLfloat red, GLfloat green, GLfloat blue, GLfloat alpha)
-{
- d_1_0_Deprecated->f.ClearAccum(red, green, blue, alpha);
-}
-
-inline void QOpenGLFunctions_4_4_Compatibility::glPushName(GLuint name)
-{
- d_1_0_Deprecated->f.PushName(name);
-}
-
-inline void QOpenGLFunctions_4_4_Compatibility::glPopName()
-{
- d_1_0_Deprecated->f.PopName();
-}
-
-inline void QOpenGLFunctions_4_4_Compatibility::glPassThrough(GLfloat token)
-{
- d_1_0_Deprecated->f.PassThrough(token);
-}
-
-inline void QOpenGLFunctions_4_4_Compatibility::glLoadName(GLuint name)
-{
- d_1_0_Deprecated->f.LoadName(name);
-}
-
-inline void QOpenGLFunctions_4_4_Compatibility::glInitNames()
-{
- d_1_0_Deprecated->f.InitNames();
-}
-
-inline GLint QOpenGLFunctions_4_4_Compatibility::glRenderMode(GLenum mode)
-{
- return d_1_0_Deprecated->f.RenderMode(mode);
-}
-
-inline void QOpenGLFunctions_4_4_Compatibility::glSelectBuffer(GLsizei size, GLuint *buffer)
-{
- d_1_0_Deprecated->f.SelectBuffer(size, buffer);
-}
-
-inline void QOpenGLFunctions_4_4_Compatibility::glFeedbackBuffer(GLsizei size, GLenum type, GLfloat *buffer)
-{
- d_1_0_Deprecated->f.FeedbackBuffer(size, type, buffer);
-}
-
-inline void QOpenGLFunctions_4_4_Compatibility::glTexGeniv(GLenum coord, GLenum pname, const GLint *params)
-{
- d_1_0_Deprecated->f.TexGeniv(coord, pname, params);
-}
-
-inline void QOpenGLFunctions_4_4_Compatibility::glTexGeni(GLenum coord, GLenum pname, GLint param)
-{
- d_1_0_Deprecated->f.TexGeni(coord, pname, param);
-}
-
-inline void QOpenGLFunctions_4_4_Compatibility::glTexGenfv(GLenum coord, GLenum pname, const GLfloat *params)
-{
- d_1_0_Deprecated->f.TexGenfv(coord, pname, params);
-}
-
-inline void QOpenGLFunctions_4_4_Compatibility::glTexGenf(GLenum coord, GLenum pname, GLfloat param)
-{
- d_1_0_Deprecated->f.TexGenf(coord, pname, param);
-}
-
-inline void QOpenGLFunctions_4_4_Compatibility::glTexGendv(GLenum coord, GLenum pname, const GLdouble *params)
-{
- d_1_0_Deprecated->f.TexGendv(coord, pname, params);
-}
-
-inline void QOpenGLFunctions_4_4_Compatibility::glTexGend(GLenum coord, GLenum pname, GLdouble param)
-{
- d_1_0_Deprecated->f.TexGend(coord, pname, param);
-}
-
-inline void QOpenGLFunctions_4_4_Compatibility::glTexEnviv(GLenum target, GLenum pname, const GLint *params)
-{
- d_1_0_Deprecated->f.TexEnviv(target, pname, params);
-}
-
-inline void QOpenGLFunctions_4_4_Compatibility::glTexEnvi(GLenum target, GLenum pname, GLint param)
-{
- d_1_0_Deprecated->f.TexEnvi(target, pname, param);
-}
-
-inline void QOpenGLFunctions_4_4_Compatibility::glTexEnvfv(GLenum target, GLenum pname, const GLfloat *params)
-{
- d_1_0_Deprecated->f.TexEnvfv(target, pname, params);
-}
-
-inline void QOpenGLFunctions_4_4_Compatibility::glTexEnvf(GLenum target, GLenum pname, GLfloat param)
-{
- d_1_0_Deprecated->f.TexEnvf(target, pname, param);
-}
-
-inline void QOpenGLFunctions_4_4_Compatibility::glShadeModel(GLenum mode)
-{
- d_1_0_Deprecated->f.ShadeModel(mode);
-}
-
-inline void QOpenGLFunctions_4_4_Compatibility::glPolygonStipple(const GLubyte *mask)
-{
- d_1_0_Deprecated->f.PolygonStipple(mask);
-}
-
-inline void QOpenGLFunctions_4_4_Compatibility::glMaterialiv(GLenum face, GLenum pname, const GLint *params)
-{
- d_1_0_Deprecated->f.Materialiv(face, pname, params);
-}
-
-inline void QOpenGLFunctions_4_4_Compatibility::glMateriali(GLenum face, GLenum pname, GLint param)
-{
- d_1_0_Deprecated->f.Materiali(face, pname, param);
-}
-
-inline void QOpenGLFunctions_4_4_Compatibility::glMaterialfv(GLenum face, GLenum pname, const GLfloat *params)
-{
- d_1_0_Deprecated->f.Materialfv(face, pname, params);
-}
-
-inline void QOpenGLFunctions_4_4_Compatibility::glMaterialf(GLenum face, GLenum pname, GLfloat param)
-{
- d_1_0_Deprecated->f.Materialf(face, pname, param);
-}
-
-inline void QOpenGLFunctions_4_4_Compatibility::glLineStipple(GLint factor, GLushort pattern)
-{
- d_1_0_Deprecated->f.LineStipple(factor, pattern);
-}
-
-inline void QOpenGLFunctions_4_4_Compatibility::glLightModeliv(GLenum pname, const GLint *params)
-{
- d_1_0_Deprecated->f.LightModeliv(pname, params);
-}
-
-inline void QOpenGLFunctions_4_4_Compatibility::glLightModeli(GLenum pname, GLint param)
-{
- d_1_0_Deprecated->f.LightModeli(pname, param);
-}
-
-inline void QOpenGLFunctions_4_4_Compatibility::glLightModelfv(GLenum pname, const GLfloat *params)
-{
- d_1_0_Deprecated->f.LightModelfv(pname, params);
-}
-
-inline void QOpenGLFunctions_4_4_Compatibility::glLightModelf(GLenum pname, GLfloat param)
-{
- d_1_0_Deprecated->f.LightModelf(pname, param);
-}
-
-inline void QOpenGLFunctions_4_4_Compatibility::glLightiv(GLenum light, GLenum pname, const GLint *params)
-{
- d_1_0_Deprecated->f.Lightiv(light, pname, params);
-}
-
-inline void QOpenGLFunctions_4_4_Compatibility::glLighti(GLenum light, GLenum pname, GLint param)
-{
- d_1_0_Deprecated->f.Lighti(light, pname, param);
-}
-
-inline void QOpenGLFunctions_4_4_Compatibility::glLightfv(GLenum light, GLenum pname, const GLfloat *params)
-{
- d_1_0_Deprecated->f.Lightfv(light, pname, params);
-}
-
-inline void QOpenGLFunctions_4_4_Compatibility::glLightf(GLenum light, GLenum pname, GLfloat param)
-{
- d_1_0_Deprecated->f.Lightf(light, pname, param);
-}
-
-inline void QOpenGLFunctions_4_4_Compatibility::glFogiv(GLenum pname, const GLint *params)
-{
- d_1_0_Deprecated->f.Fogiv(pname, params);
-}
-
-inline void QOpenGLFunctions_4_4_Compatibility::glFogi(GLenum pname, GLint param)
-{
- d_1_0_Deprecated->f.Fogi(pname, param);
-}
-
-inline void QOpenGLFunctions_4_4_Compatibility::glFogfv(GLenum pname, const GLfloat *params)
-{
- d_1_0_Deprecated->f.Fogfv(pname, params);
-}
-
-inline void QOpenGLFunctions_4_4_Compatibility::glFogf(GLenum pname, GLfloat param)
-{
- d_1_0_Deprecated->f.Fogf(pname, param);
-}
-
-inline void QOpenGLFunctions_4_4_Compatibility::glColorMaterial(GLenum face, GLenum mode)
-{
- d_1_0_Deprecated->f.ColorMaterial(face, mode);
-}
-
-inline void QOpenGLFunctions_4_4_Compatibility::glClipPlane(GLenum plane, const GLdouble *equation)
-{
- d_1_0_Deprecated->f.ClipPlane(plane, equation);
-}
-
-inline void QOpenGLFunctions_4_4_Compatibility::glVertex4sv(const GLshort *v)
-{
- d_1_0_Deprecated->f.Vertex4sv(v);
-}
-
-inline void QOpenGLFunctions_4_4_Compatibility::glVertex4s(GLshort x, GLshort y, GLshort z, GLshort w)
-{
- d_1_0_Deprecated->f.Vertex4s(x, y, z, w);
-}
-
-inline void QOpenGLFunctions_4_4_Compatibility::glVertex4iv(const GLint *v)
-{
- d_1_0_Deprecated->f.Vertex4iv(v);
-}
-
-inline void QOpenGLFunctions_4_4_Compatibility::glVertex4i(GLint x, GLint y, GLint z, GLint w)
-{
- d_1_0_Deprecated->f.Vertex4i(x, y, z, w);
-}
-
-inline void QOpenGLFunctions_4_4_Compatibility::glVertex4fv(const GLfloat *v)
-{
- d_1_0_Deprecated->f.Vertex4fv(v);
-}
-
-inline void QOpenGLFunctions_4_4_Compatibility::glVertex4f(GLfloat x, GLfloat y, GLfloat z, GLfloat w)
-{
- d_1_0_Deprecated->f.Vertex4f(x, y, z, w);
-}
-
-inline void QOpenGLFunctions_4_4_Compatibility::glVertex4dv(const GLdouble *v)
-{
- d_1_0_Deprecated->f.Vertex4dv(v);
-}
-
-inline void QOpenGLFunctions_4_4_Compatibility::glVertex4d(GLdouble x, GLdouble y, GLdouble z, GLdouble w)
-{
- d_1_0_Deprecated->f.Vertex4d(x, y, z, w);
-}
-
-inline void QOpenGLFunctions_4_4_Compatibility::glVertex3sv(const GLshort *v)
-{
- d_1_0_Deprecated->f.Vertex3sv(v);
-}
-
-inline void QOpenGLFunctions_4_4_Compatibility::glVertex3s(GLshort x, GLshort y, GLshort z)
-{
- d_1_0_Deprecated->f.Vertex3s(x, y, z);
-}
-
-inline void QOpenGLFunctions_4_4_Compatibility::glVertex3iv(const GLint *v)
-{
- d_1_0_Deprecated->f.Vertex3iv(v);
-}
-
-inline void QOpenGLFunctions_4_4_Compatibility::glVertex3i(GLint x, GLint y, GLint z)
-{
- d_1_0_Deprecated->f.Vertex3i(x, y, z);
-}
-
-inline void QOpenGLFunctions_4_4_Compatibility::glVertex3fv(const GLfloat *v)
-{
- d_1_0_Deprecated->f.Vertex3fv(v);
-}
-
-inline void QOpenGLFunctions_4_4_Compatibility::glVertex3f(GLfloat x, GLfloat y, GLfloat z)
-{
- d_1_0_Deprecated->f.Vertex3f(x, y, z);
-}
-
-inline void QOpenGLFunctions_4_4_Compatibility::glVertex3dv(const GLdouble *v)
-{
- d_1_0_Deprecated->f.Vertex3dv(v);
-}
-
-inline void QOpenGLFunctions_4_4_Compatibility::glVertex3d(GLdouble x, GLdouble y, GLdouble z)
-{
- d_1_0_Deprecated->f.Vertex3d(x, y, z);
-}
-
-inline void QOpenGLFunctions_4_4_Compatibility::glVertex2sv(const GLshort *v)
-{
- d_1_0_Deprecated->f.Vertex2sv(v);
-}
-
-inline void QOpenGLFunctions_4_4_Compatibility::glVertex2s(GLshort x, GLshort y)
-{
- d_1_0_Deprecated->f.Vertex2s(x, y);
-}
-
-inline void QOpenGLFunctions_4_4_Compatibility::glVertex2iv(const GLint *v)
-{
- d_1_0_Deprecated->f.Vertex2iv(v);
-}
-
-inline void QOpenGLFunctions_4_4_Compatibility::glVertex2i(GLint x, GLint y)
-{
- d_1_0_Deprecated->f.Vertex2i(x, y);
-}
-
-inline void QOpenGLFunctions_4_4_Compatibility::glVertex2fv(const GLfloat *v)
-{
- d_1_0_Deprecated->f.Vertex2fv(v);
-}
-
-inline void QOpenGLFunctions_4_4_Compatibility::glVertex2f(GLfloat x, GLfloat y)
-{
- d_1_0_Deprecated->f.Vertex2f(x, y);
-}
-
-inline void QOpenGLFunctions_4_4_Compatibility::glVertex2dv(const GLdouble *v)
-{
- d_1_0_Deprecated->f.Vertex2dv(v);
-}
-
-inline void QOpenGLFunctions_4_4_Compatibility::glVertex2d(GLdouble x, GLdouble y)
-{
- d_1_0_Deprecated->f.Vertex2d(x, y);
-}
-
-inline void QOpenGLFunctions_4_4_Compatibility::glTexCoord4sv(const GLshort *v)
-{
- d_1_0_Deprecated->f.TexCoord4sv(v);
-}
-
-inline void QOpenGLFunctions_4_4_Compatibility::glTexCoord4s(GLshort s, GLshort t, GLshort r, GLshort q)
-{
- d_1_0_Deprecated->f.TexCoord4s(s, t, r, q);
-}
-
-inline void QOpenGLFunctions_4_4_Compatibility::glTexCoord4iv(const GLint *v)
-{
- d_1_0_Deprecated->f.TexCoord4iv(v);
-}
-
-inline void QOpenGLFunctions_4_4_Compatibility::glTexCoord4i(GLint s, GLint t, GLint r, GLint q)
-{
- d_1_0_Deprecated->f.TexCoord4i(s, t, r, q);
-}
-
-inline void QOpenGLFunctions_4_4_Compatibility::glTexCoord4fv(const GLfloat *v)
-{
- d_1_0_Deprecated->f.TexCoord4fv(v);
-}
-
-inline void QOpenGLFunctions_4_4_Compatibility::glTexCoord4f(GLfloat s, GLfloat t, GLfloat r, GLfloat q)
-{
- d_1_0_Deprecated->f.TexCoord4f(s, t, r, q);
-}
-
-inline void QOpenGLFunctions_4_4_Compatibility::glTexCoord4dv(const GLdouble *v)
-{
- d_1_0_Deprecated->f.TexCoord4dv(v);
-}
-
-inline void QOpenGLFunctions_4_4_Compatibility::glTexCoord4d(GLdouble s, GLdouble t, GLdouble r, GLdouble q)
-{
- d_1_0_Deprecated->f.TexCoord4d(s, t, r, q);
-}
-
-inline void QOpenGLFunctions_4_4_Compatibility::glTexCoord3sv(const GLshort *v)
-{
- d_1_0_Deprecated->f.TexCoord3sv(v);
-}
-
-inline void QOpenGLFunctions_4_4_Compatibility::glTexCoord3s(GLshort s, GLshort t, GLshort r)
-{
- d_1_0_Deprecated->f.TexCoord3s(s, t, r);
-}
-
-inline void QOpenGLFunctions_4_4_Compatibility::glTexCoord3iv(const GLint *v)
-{
- d_1_0_Deprecated->f.TexCoord3iv(v);
-}
-
-inline void QOpenGLFunctions_4_4_Compatibility::glTexCoord3i(GLint s, GLint t, GLint r)
-{
- d_1_0_Deprecated->f.TexCoord3i(s, t, r);
-}
-
-inline void QOpenGLFunctions_4_4_Compatibility::glTexCoord3fv(const GLfloat *v)
-{
- d_1_0_Deprecated->f.TexCoord3fv(v);
-}
-
-inline void QOpenGLFunctions_4_4_Compatibility::glTexCoord3f(GLfloat s, GLfloat t, GLfloat r)
-{
- d_1_0_Deprecated->f.TexCoord3f(s, t, r);
-}
-
-inline void QOpenGLFunctions_4_4_Compatibility::glTexCoord3dv(const GLdouble *v)
-{
- d_1_0_Deprecated->f.TexCoord3dv(v);
-}
-
-inline void QOpenGLFunctions_4_4_Compatibility::glTexCoord3d(GLdouble s, GLdouble t, GLdouble r)
-{
- d_1_0_Deprecated->f.TexCoord3d(s, t, r);
-}
-
-inline void QOpenGLFunctions_4_4_Compatibility::glTexCoord2sv(const GLshort *v)
-{
- d_1_0_Deprecated->f.TexCoord2sv(v);
-}
-
-inline void QOpenGLFunctions_4_4_Compatibility::glTexCoord2s(GLshort s, GLshort t)
-{
- d_1_0_Deprecated->f.TexCoord2s(s, t);
-}
-
-inline void QOpenGLFunctions_4_4_Compatibility::glTexCoord2iv(const GLint *v)
-{
- d_1_0_Deprecated->f.TexCoord2iv(v);
-}
-
-inline void QOpenGLFunctions_4_4_Compatibility::glTexCoord2i(GLint s, GLint t)
-{
- d_1_0_Deprecated->f.TexCoord2i(s, t);
-}
-
-inline void QOpenGLFunctions_4_4_Compatibility::glTexCoord2fv(const GLfloat *v)
-{
- d_1_0_Deprecated->f.TexCoord2fv(v);
-}
-
-inline void QOpenGLFunctions_4_4_Compatibility::glTexCoord2f(GLfloat s, GLfloat t)
-{
- d_1_0_Deprecated->f.TexCoord2f(s, t);
-}
-
-inline void QOpenGLFunctions_4_4_Compatibility::glTexCoord2dv(const GLdouble *v)
-{
- d_1_0_Deprecated->f.TexCoord2dv(v);
-}
-
-inline void QOpenGLFunctions_4_4_Compatibility::glTexCoord2d(GLdouble s, GLdouble t)
-{
- d_1_0_Deprecated->f.TexCoord2d(s, t);
-}
-
-inline void QOpenGLFunctions_4_4_Compatibility::glTexCoord1sv(const GLshort *v)
-{
- d_1_0_Deprecated->f.TexCoord1sv(v);
-}
-
-inline void QOpenGLFunctions_4_4_Compatibility::glTexCoord1s(GLshort s)
-{
- d_1_0_Deprecated->f.TexCoord1s(s);
-}
-
-inline void QOpenGLFunctions_4_4_Compatibility::glTexCoord1iv(const GLint *v)
-{
- d_1_0_Deprecated->f.TexCoord1iv(v);
-}
-
-inline void QOpenGLFunctions_4_4_Compatibility::glTexCoord1i(GLint s)
-{
- d_1_0_Deprecated->f.TexCoord1i(s);
-}
-
-inline void QOpenGLFunctions_4_4_Compatibility::glTexCoord1fv(const GLfloat *v)
-{
- d_1_0_Deprecated->f.TexCoord1fv(v);
-}
-
-inline void QOpenGLFunctions_4_4_Compatibility::glTexCoord1f(GLfloat s)
-{
- d_1_0_Deprecated->f.TexCoord1f(s);
-}
-
-inline void QOpenGLFunctions_4_4_Compatibility::glTexCoord1dv(const GLdouble *v)
-{
- d_1_0_Deprecated->f.TexCoord1dv(v);
-}
-
-inline void QOpenGLFunctions_4_4_Compatibility::glTexCoord1d(GLdouble s)
-{
- d_1_0_Deprecated->f.TexCoord1d(s);
-}
-
-inline void QOpenGLFunctions_4_4_Compatibility::glRectsv(const GLshort *v1, const GLshort *v2)
-{
- d_1_0_Deprecated->f.Rectsv(v1, v2);
-}
-
-inline void QOpenGLFunctions_4_4_Compatibility::glRects(GLshort x1, GLshort y1, GLshort x2, GLshort y2)
-{
- d_1_0_Deprecated->f.Rects(x1, y1, x2, y2);
-}
-
-inline void QOpenGLFunctions_4_4_Compatibility::glRectiv(const GLint *v1, const GLint *v2)
-{
- d_1_0_Deprecated->f.Rectiv(v1, v2);
-}
-
-inline void QOpenGLFunctions_4_4_Compatibility::glRecti(GLint x1, GLint y1, GLint x2, GLint y2)
-{
- d_1_0_Deprecated->f.Recti(x1, y1, x2, y2);
-}
-
-inline void QOpenGLFunctions_4_4_Compatibility::glRectfv(const GLfloat *v1, const GLfloat *v2)
-{
- d_1_0_Deprecated->f.Rectfv(v1, v2);
-}
-
-inline void QOpenGLFunctions_4_4_Compatibility::glRectf(GLfloat x1, GLfloat y1, GLfloat x2, GLfloat y2)
-{
- d_1_0_Deprecated->f.Rectf(x1, y1, x2, y2);
-}
-
-inline void QOpenGLFunctions_4_4_Compatibility::glRectdv(const GLdouble *v1, const GLdouble *v2)
-{
- d_1_0_Deprecated->f.Rectdv(v1, v2);
-}
-
-inline void QOpenGLFunctions_4_4_Compatibility::glRectd(GLdouble x1, GLdouble y1, GLdouble x2, GLdouble y2)
-{
- d_1_0_Deprecated->f.Rectd(x1, y1, x2, y2);
-}
-
-inline void QOpenGLFunctions_4_4_Compatibility::glRasterPos4sv(const GLshort *v)
-{
- d_1_0_Deprecated->f.RasterPos4sv(v);
-}
-
-inline void QOpenGLFunctions_4_4_Compatibility::glRasterPos4s(GLshort x, GLshort y, GLshort z, GLshort w)
-{
- d_1_0_Deprecated->f.RasterPos4s(x, y, z, w);
-}
-
-inline void QOpenGLFunctions_4_4_Compatibility::glRasterPos4iv(const GLint *v)
-{
- d_1_0_Deprecated->f.RasterPos4iv(v);
-}
-
-inline void QOpenGLFunctions_4_4_Compatibility::glRasterPos4i(GLint x, GLint y, GLint z, GLint w)
-{
- d_1_0_Deprecated->f.RasterPos4i(x, y, z, w);
-}
-
-inline void QOpenGLFunctions_4_4_Compatibility::glRasterPos4fv(const GLfloat *v)
-{
- d_1_0_Deprecated->f.RasterPos4fv(v);
-}
-
-inline void QOpenGLFunctions_4_4_Compatibility::glRasterPos4f(GLfloat x, GLfloat y, GLfloat z, GLfloat w)
-{
- d_1_0_Deprecated->f.RasterPos4f(x, y, z, w);
-}
-
-inline void QOpenGLFunctions_4_4_Compatibility::glRasterPos4dv(const GLdouble *v)
-{
- d_1_0_Deprecated->f.RasterPos4dv(v);
-}
-
-inline void QOpenGLFunctions_4_4_Compatibility::glRasterPos4d(GLdouble x, GLdouble y, GLdouble z, GLdouble w)
-{
- d_1_0_Deprecated->f.RasterPos4d(x, y, z, w);
-}
-
-inline void QOpenGLFunctions_4_4_Compatibility::glRasterPos3sv(const GLshort *v)
-{
- d_1_0_Deprecated->f.RasterPos3sv(v);
-}
-
-inline void QOpenGLFunctions_4_4_Compatibility::glRasterPos3s(GLshort x, GLshort y, GLshort z)
-{
- d_1_0_Deprecated->f.RasterPos3s(x, y, z);
-}
-
-inline void QOpenGLFunctions_4_4_Compatibility::glRasterPos3iv(const GLint *v)
-{
- d_1_0_Deprecated->f.RasterPos3iv(v);
-}
-
-inline void QOpenGLFunctions_4_4_Compatibility::glRasterPos3i(GLint x, GLint y, GLint z)
-{
- d_1_0_Deprecated->f.RasterPos3i(x, y, z);
-}
-
-inline void QOpenGLFunctions_4_4_Compatibility::glRasterPos3fv(const GLfloat *v)
-{
- d_1_0_Deprecated->f.RasterPos3fv(v);
-}
-
-inline void QOpenGLFunctions_4_4_Compatibility::glRasterPos3f(GLfloat x, GLfloat y, GLfloat z)
-{
- d_1_0_Deprecated->f.RasterPos3f(x, y, z);
-}
-
-inline void QOpenGLFunctions_4_4_Compatibility::glRasterPos3dv(const GLdouble *v)
-{
- d_1_0_Deprecated->f.RasterPos3dv(v);
-}
-
-inline void QOpenGLFunctions_4_4_Compatibility::glRasterPos3d(GLdouble x, GLdouble y, GLdouble z)
-{
- d_1_0_Deprecated->f.RasterPos3d(x, y, z);
-}
-
-inline void QOpenGLFunctions_4_4_Compatibility::glRasterPos2sv(const GLshort *v)
-{
- d_1_0_Deprecated->f.RasterPos2sv(v);
-}
-
-inline void QOpenGLFunctions_4_4_Compatibility::glRasterPos2s(GLshort x, GLshort y)
-{
- d_1_0_Deprecated->f.RasterPos2s(x, y);
-}
-
-inline void QOpenGLFunctions_4_4_Compatibility::glRasterPos2iv(const GLint *v)
-{
- d_1_0_Deprecated->f.RasterPos2iv(v);
-}
-
-inline void QOpenGLFunctions_4_4_Compatibility::glRasterPos2i(GLint x, GLint y)
-{
- d_1_0_Deprecated->f.RasterPos2i(x, y);
-}
-
-inline void QOpenGLFunctions_4_4_Compatibility::glRasterPos2fv(const GLfloat *v)
-{
- d_1_0_Deprecated->f.RasterPos2fv(v);
-}
-
-inline void QOpenGLFunctions_4_4_Compatibility::glRasterPos2f(GLfloat x, GLfloat y)
-{
- d_1_0_Deprecated->f.RasterPos2f(x, y);
-}
-
-inline void QOpenGLFunctions_4_4_Compatibility::glRasterPos2dv(const GLdouble *v)
-{
- d_1_0_Deprecated->f.RasterPos2dv(v);
-}
-
-inline void QOpenGLFunctions_4_4_Compatibility::glRasterPos2d(GLdouble x, GLdouble y)
-{
- d_1_0_Deprecated->f.RasterPos2d(x, y);
-}
-
-inline void QOpenGLFunctions_4_4_Compatibility::glNormal3sv(const GLshort *v)
-{
- d_1_0_Deprecated->f.Normal3sv(v);
-}
-
-inline void QOpenGLFunctions_4_4_Compatibility::glNormal3s(GLshort nx, GLshort ny, GLshort nz)
-{
- d_1_0_Deprecated->f.Normal3s(nx, ny, nz);
-}
-
-inline void QOpenGLFunctions_4_4_Compatibility::glNormal3iv(const GLint *v)
-{
- d_1_0_Deprecated->f.Normal3iv(v);
-}
-
-inline void QOpenGLFunctions_4_4_Compatibility::glNormal3i(GLint nx, GLint ny, GLint nz)
-{
- d_1_0_Deprecated->f.Normal3i(nx, ny, nz);
-}
-
-inline void QOpenGLFunctions_4_4_Compatibility::glNormal3fv(const GLfloat *v)
-{
- d_1_0_Deprecated->f.Normal3fv(v);
-}
-
-inline void QOpenGLFunctions_4_4_Compatibility::glNormal3f(GLfloat nx, GLfloat ny, GLfloat nz)
-{
- d_1_0_Deprecated->f.Normal3f(nx, ny, nz);
-}
-
-inline void QOpenGLFunctions_4_4_Compatibility::glNormal3dv(const GLdouble *v)
-{
- d_1_0_Deprecated->f.Normal3dv(v);
-}
-
-inline void QOpenGLFunctions_4_4_Compatibility::glNormal3d(GLdouble nx, GLdouble ny, GLdouble nz)
-{
- d_1_0_Deprecated->f.Normal3d(nx, ny, nz);
-}
-
-inline void QOpenGLFunctions_4_4_Compatibility::glNormal3bv(const GLbyte *v)
-{
- d_1_0_Deprecated->f.Normal3bv(v);
-}
-
-inline void QOpenGLFunctions_4_4_Compatibility::glNormal3b(GLbyte nx, GLbyte ny, GLbyte nz)
-{
- d_1_0_Deprecated->f.Normal3b(nx, ny, nz);
-}
-
-inline void QOpenGLFunctions_4_4_Compatibility::glIndexsv(const GLshort *c)
-{
- d_1_0_Deprecated->f.Indexsv(c);
-}
-
-inline void QOpenGLFunctions_4_4_Compatibility::glIndexs(GLshort c)
-{
- d_1_0_Deprecated->f.Indexs(c);
-}
-
-inline void QOpenGLFunctions_4_4_Compatibility::glIndexiv(const GLint *c)
-{
- d_1_0_Deprecated->f.Indexiv(c);
-}
-
-inline void QOpenGLFunctions_4_4_Compatibility::glIndexi(GLint c)
-{
- d_1_0_Deprecated->f.Indexi(c);
-}
-
-inline void QOpenGLFunctions_4_4_Compatibility::glIndexfv(const GLfloat *c)
-{
- d_1_0_Deprecated->f.Indexfv(c);
-}
-
-inline void QOpenGLFunctions_4_4_Compatibility::glIndexf(GLfloat c)
-{
- d_1_0_Deprecated->f.Indexf(c);
-}
-
-inline void QOpenGLFunctions_4_4_Compatibility::glIndexdv(const GLdouble *c)
-{
- d_1_0_Deprecated->f.Indexdv(c);
-}
-
-inline void QOpenGLFunctions_4_4_Compatibility::glIndexd(GLdouble c)
-{
- d_1_0_Deprecated->f.Indexd(c);
-}
-
-inline void QOpenGLFunctions_4_4_Compatibility::glEnd()
-{
- d_1_0_Deprecated->f.End();
-}
-
-inline void QOpenGLFunctions_4_4_Compatibility::glEdgeFlagv(const GLboolean *flag)
-{
- d_1_0_Deprecated->f.EdgeFlagv(flag);
-}
-
-inline void QOpenGLFunctions_4_4_Compatibility::glEdgeFlag(GLboolean flag)
-{
- d_1_0_Deprecated->f.EdgeFlag(flag);
-}
-
-inline void QOpenGLFunctions_4_4_Compatibility::glColor4usv(const GLushort *v)
-{
- d_1_0_Deprecated->f.Color4usv(v);
-}
-
-inline void QOpenGLFunctions_4_4_Compatibility::glColor4us(GLushort red, GLushort green, GLushort blue, GLushort alpha)
-{
- d_1_0_Deprecated->f.Color4us(red, green, blue, alpha);
-}
-
-inline void QOpenGLFunctions_4_4_Compatibility::glColor4uiv(const GLuint *v)
-{
- d_1_0_Deprecated->f.Color4uiv(v);
-}
-
-inline void QOpenGLFunctions_4_4_Compatibility::glColor4ui(GLuint red, GLuint green, GLuint blue, GLuint alpha)
-{
- d_1_0_Deprecated->f.Color4ui(red, green, blue, alpha);
-}
-
-inline void QOpenGLFunctions_4_4_Compatibility::glColor4ubv(const GLubyte *v)
-{
- d_1_0_Deprecated->f.Color4ubv(v);
-}
-
-inline void QOpenGLFunctions_4_4_Compatibility::glColor4ub(GLubyte red, GLubyte green, GLubyte blue, GLubyte alpha)
-{
- d_1_0_Deprecated->f.Color4ub(red, green, blue, alpha);
-}
-
-inline void QOpenGLFunctions_4_4_Compatibility::glColor4sv(const GLshort *v)
-{
- d_1_0_Deprecated->f.Color4sv(v);
-}
-
-inline void QOpenGLFunctions_4_4_Compatibility::glColor4s(GLshort red, GLshort green, GLshort blue, GLshort alpha)
-{
- d_1_0_Deprecated->f.Color4s(red, green, blue, alpha);
-}
-
-inline void QOpenGLFunctions_4_4_Compatibility::glColor4iv(const GLint *v)
-{
- d_1_0_Deprecated->f.Color4iv(v);
-}
-
-inline void QOpenGLFunctions_4_4_Compatibility::glColor4i(GLint red, GLint green, GLint blue, GLint alpha)
-{
- d_1_0_Deprecated->f.Color4i(red, green, blue, alpha);
-}
-
-inline void QOpenGLFunctions_4_4_Compatibility::glColor4fv(const GLfloat *v)
-{
- d_1_0_Deprecated->f.Color4fv(v);
-}
-
-inline void QOpenGLFunctions_4_4_Compatibility::glColor4f(GLfloat red, GLfloat green, GLfloat blue, GLfloat alpha)
-{
- d_1_0_Deprecated->f.Color4f(red, green, blue, alpha);
-}
-
-inline void QOpenGLFunctions_4_4_Compatibility::glColor4dv(const GLdouble *v)
-{
- d_1_0_Deprecated->f.Color4dv(v);
-}
-
-inline void QOpenGLFunctions_4_4_Compatibility::glColor4d(GLdouble red, GLdouble green, GLdouble blue, GLdouble alpha)
-{
- d_1_0_Deprecated->f.Color4d(red, green, blue, alpha);
-}
-
-inline void QOpenGLFunctions_4_4_Compatibility::glColor4bv(const GLbyte *v)
-{
- d_1_0_Deprecated->f.Color4bv(v);
-}
-
-inline void QOpenGLFunctions_4_4_Compatibility::glColor4b(GLbyte red, GLbyte green, GLbyte blue, GLbyte alpha)
-{
- d_1_0_Deprecated->f.Color4b(red, green, blue, alpha);
-}
-
-inline void QOpenGLFunctions_4_4_Compatibility::glColor3usv(const GLushort *v)
-{
- d_1_0_Deprecated->f.Color3usv(v);
-}
-
-inline void QOpenGLFunctions_4_4_Compatibility::glColor3us(GLushort red, GLushort green, GLushort blue)
-{
- d_1_0_Deprecated->f.Color3us(red, green, blue);
-}
-
-inline void QOpenGLFunctions_4_4_Compatibility::glColor3uiv(const GLuint *v)
-{
- d_1_0_Deprecated->f.Color3uiv(v);
-}
-
-inline void QOpenGLFunctions_4_4_Compatibility::glColor3ui(GLuint red, GLuint green, GLuint blue)
-{
- d_1_0_Deprecated->f.Color3ui(red, green, blue);
-}
-
-inline void QOpenGLFunctions_4_4_Compatibility::glColor3ubv(const GLubyte *v)
-{
- d_1_0_Deprecated->f.Color3ubv(v);
-}
-
-inline void QOpenGLFunctions_4_4_Compatibility::glColor3ub(GLubyte red, GLubyte green, GLubyte blue)
-{
- d_1_0_Deprecated->f.Color3ub(red, green, blue);
-}
-
-inline void QOpenGLFunctions_4_4_Compatibility::glColor3sv(const GLshort *v)
-{
- d_1_0_Deprecated->f.Color3sv(v);
-}
-
-inline void QOpenGLFunctions_4_4_Compatibility::glColor3s(GLshort red, GLshort green, GLshort blue)
-{
- d_1_0_Deprecated->f.Color3s(red, green, blue);
-}
-
-inline void QOpenGLFunctions_4_4_Compatibility::glColor3iv(const GLint *v)
-{
- d_1_0_Deprecated->f.Color3iv(v);
-}
-
-inline void QOpenGLFunctions_4_4_Compatibility::glColor3i(GLint red, GLint green, GLint blue)
-{
- d_1_0_Deprecated->f.Color3i(red, green, blue);
-}
-
-inline void QOpenGLFunctions_4_4_Compatibility::glColor3fv(const GLfloat *v)
-{
- d_1_0_Deprecated->f.Color3fv(v);
-}
-
-inline void QOpenGLFunctions_4_4_Compatibility::glColor3f(GLfloat red, GLfloat green, GLfloat blue)
-{
- d_1_0_Deprecated->f.Color3f(red, green, blue);
-}
-
-inline void QOpenGLFunctions_4_4_Compatibility::glColor3dv(const GLdouble *v)
-{
- d_1_0_Deprecated->f.Color3dv(v);
-}
-
-inline void QOpenGLFunctions_4_4_Compatibility::glColor3d(GLdouble red, GLdouble green, GLdouble blue)
-{
- d_1_0_Deprecated->f.Color3d(red, green, blue);
-}
-
-inline void QOpenGLFunctions_4_4_Compatibility::glColor3bv(const GLbyte *v)
-{
- d_1_0_Deprecated->f.Color3bv(v);
-}
-
-inline void QOpenGLFunctions_4_4_Compatibility::glColor3b(GLbyte red, GLbyte green, GLbyte blue)
-{
- d_1_0_Deprecated->f.Color3b(red, green, blue);
-}
-
-inline void QOpenGLFunctions_4_4_Compatibility::glBitmap(GLsizei width, GLsizei height, GLfloat xorig, GLfloat yorig, GLfloat xmove, GLfloat ymove, const GLubyte *bitmap)
-{
- d_1_0_Deprecated->f.Bitmap(width, height, xorig, yorig, xmove, ymove, bitmap);
-}
-
-inline void QOpenGLFunctions_4_4_Compatibility::glBegin(GLenum mode)
-{
- d_1_0_Deprecated->f.Begin(mode);
-}
-
-inline void QOpenGLFunctions_4_4_Compatibility::glListBase(GLuint base)
-{
- d_1_0_Deprecated->f.ListBase(base);
-}
-
-inline GLuint QOpenGLFunctions_4_4_Compatibility::glGenLists(GLsizei range)
-{
- return d_1_0_Deprecated->f.GenLists(range);
-}
-
-inline void QOpenGLFunctions_4_4_Compatibility::glDeleteLists(GLuint list, GLsizei range)
-{
- d_1_0_Deprecated->f.DeleteLists(list, range);
-}
-
-inline void QOpenGLFunctions_4_4_Compatibility::glCallLists(GLsizei n, GLenum type, const void *lists)
-{
- d_1_0_Deprecated->f.CallLists(n, type, lists);
-}
-
-inline void QOpenGLFunctions_4_4_Compatibility::glCallList(GLuint list)
-{
- d_1_0_Deprecated->f.CallList(list);
-}
-
-inline void QOpenGLFunctions_4_4_Compatibility::glEndList()
-{
- d_1_0_Deprecated->f.EndList();
-}
-
-inline void QOpenGLFunctions_4_4_Compatibility::glNewList(GLuint list, GLenum mode)
-{
- d_1_0_Deprecated->f.NewList(list, mode);
-}
-
-
-// OpenGL 1.1 deprecated functions
-inline void QOpenGLFunctions_4_4_Compatibility::glPushClientAttrib(GLbitfield mask)
-{
- d_1_1_Deprecated->f.PushClientAttrib(mask);
-}
-
-inline void QOpenGLFunctions_4_4_Compatibility::glPopClientAttrib()
-{
- d_1_1_Deprecated->f.PopClientAttrib();
-}
-
-inline void QOpenGLFunctions_4_4_Compatibility::glIndexubv(const GLubyte *c)
-{
- d_1_1_Deprecated->f.Indexubv(c);
-}
-
-inline void QOpenGLFunctions_4_4_Compatibility::glIndexub(GLubyte c)
-{
- d_1_1_Deprecated->f.Indexub(c);
-}
-
-inline void QOpenGLFunctions_4_4_Compatibility::glPrioritizeTextures(GLsizei n, const GLuint *textures, const GLfloat *priorities)
-{
- d_1_1_Deprecated->f.PrioritizeTextures(n, textures, priorities);
-}
-
-inline GLboolean QOpenGLFunctions_4_4_Compatibility::glAreTexturesResident(GLsizei n, const GLuint *textures, GLboolean *residences)
-{
- return d_1_1_Deprecated->f.AreTexturesResident(n, textures, residences);
-}
-
-inline void QOpenGLFunctions_4_4_Compatibility::glVertexPointer(GLint size, GLenum type, GLsizei stride, const void *pointer)
-{
- d_1_1_Deprecated->f.VertexPointer(size, type, stride, pointer);
-}
-
-inline void QOpenGLFunctions_4_4_Compatibility::glTexCoordPointer(GLint size, GLenum type, GLsizei stride, const void *pointer)
-{
- d_1_1_Deprecated->f.TexCoordPointer(size, type, stride, pointer);
-}
-
-inline void QOpenGLFunctions_4_4_Compatibility::glNormalPointer(GLenum type, GLsizei stride, const void *pointer)
-{
- d_1_1_Deprecated->f.NormalPointer(type, stride, pointer);
-}
-
-inline void QOpenGLFunctions_4_4_Compatibility::glInterleavedArrays(GLenum format, GLsizei stride, const void *pointer)
-{
- d_1_1_Deprecated->f.InterleavedArrays(format, stride, pointer);
-}
-
-inline void QOpenGLFunctions_4_4_Compatibility::glGetPointerv(GLenum pname, void * *params)
-{
- d_1_1_Deprecated->f.GetPointerv(pname, params);
-}
-
-inline void QOpenGLFunctions_4_4_Compatibility::glIndexPointer(GLenum type, GLsizei stride, const void *pointer)
-{
- d_1_1_Deprecated->f.IndexPointer(type, stride, pointer);
-}
-
-inline void QOpenGLFunctions_4_4_Compatibility::glEnableClientState(GLenum array)
-{
- d_1_1_Deprecated->f.EnableClientState(array);
-}
-
-inline void QOpenGLFunctions_4_4_Compatibility::glEdgeFlagPointer(GLsizei stride, const void *pointer)
-{
- d_1_1_Deprecated->f.EdgeFlagPointer(stride, pointer);
-}
-
-inline void QOpenGLFunctions_4_4_Compatibility::glDisableClientState(GLenum array)
-{
- d_1_1_Deprecated->f.DisableClientState(array);
-}
-
-inline void QOpenGLFunctions_4_4_Compatibility::glColorPointer(GLint size, GLenum type, GLsizei stride, const void *pointer)
-{
- d_1_1_Deprecated->f.ColorPointer(size, type, stride, pointer);
-}
-
-inline void QOpenGLFunctions_4_4_Compatibility::glArrayElement(GLint i)
-{
- d_1_1_Deprecated->f.ArrayElement(i);
-}
-
-
-// OpenGL 1.2 deprecated functions
-inline void QOpenGLFunctions_4_4_Compatibility::glColorTable(GLenum target, GLenum internalformat, GLsizei width, GLenum format, GLenum type, const void *table)
-{
- d_1_2_Deprecated->f.ColorTable(target, internalformat, width, format, type, table);
-}
-
-inline void QOpenGLFunctions_4_4_Compatibility::glColorTableParameterfv(GLenum target, GLenum pname, const GLfloat *params)
-{
- d_1_2_Deprecated->f.ColorTableParameterfv(target, pname, params);
-}
-
-inline void QOpenGLFunctions_4_4_Compatibility::glColorTableParameteriv(GLenum target, GLenum pname, const GLint *params)
-{
- d_1_2_Deprecated->f.ColorTableParameteriv(target, pname, params);
-}
-
-inline void QOpenGLFunctions_4_4_Compatibility::glCopyColorTable(GLenum target, GLenum internalformat, GLint x, GLint y, GLsizei width)
-{
- d_1_2_Deprecated->f.CopyColorTable(target, internalformat, x, y, width);
-}
-
-inline void QOpenGLFunctions_4_4_Compatibility::glGetColorTable(GLenum target, GLenum format, GLenum type, void *table)
-{
- d_1_2_Deprecated->f.GetColorTable(target, format, type, table);
-}
-
-inline void QOpenGLFunctions_4_4_Compatibility::glGetColorTableParameterfv(GLenum target, GLenum pname, GLfloat *params)
-{
- d_1_2_Deprecated->f.GetColorTableParameterfv(target, pname, params);
-}
-
-inline void QOpenGLFunctions_4_4_Compatibility::glGetColorTableParameteriv(GLenum target, GLenum pname, GLint *params)
-{
- d_1_2_Deprecated->f.GetColorTableParameteriv(target, pname, params);
-}
-
-inline void QOpenGLFunctions_4_4_Compatibility::glColorSubTable(GLenum target, GLsizei start, GLsizei count, GLenum format, GLenum type, const void *data)
-{
- d_1_2_Deprecated->f.ColorSubTable(target, start, count, format, type, data);
-}
-
-inline void QOpenGLFunctions_4_4_Compatibility::glCopyColorSubTable(GLenum target, GLsizei start, GLint x, GLint y, GLsizei width)
-{
- d_1_2_Deprecated->f.CopyColorSubTable(target, start, x, y, width);
-}
-
-inline void QOpenGLFunctions_4_4_Compatibility::glConvolutionFilter1D(GLenum target, GLenum internalformat, GLsizei width, GLenum format, GLenum type, const void *image)
-{
- d_1_2_Deprecated->f.ConvolutionFilter1D(target, internalformat, width, format, type, image);
-}
-
-inline void QOpenGLFunctions_4_4_Compatibility::glConvolutionFilter2D(GLenum target, GLenum internalformat, GLsizei width, GLsizei height, GLenum format, GLenum type, const void *image)
-{
- d_1_2_Deprecated->f.ConvolutionFilter2D(target, internalformat, width, height, format, type, image);
-}
-
-inline void QOpenGLFunctions_4_4_Compatibility::glConvolutionParameterf(GLenum target, GLenum pname, GLfloat params)
-{
- d_1_2_Deprecated->f.ConvolutionParameterf(target, pname, params);
-}
-
-inline void QOpenGLFunctions_4_4_Compatibility::glConvolutionParameterfv(GLenum target, GLenum pname, const GLfloat *params)
-{
- d_1_2_Deprecated->f.ConvolutionParameterfv(target, pname, params);
-}
-
-inline void QOpenGLFunctions_4_4_Compatibility::glConvolutionParameteri(GLenum target, GLenum pname, GLint params)
-{
- d_1_2_Deprecated->f.ConvolutionParameteri(target, pname, params);
-}
-
-inline void QOpenGLFunctions_4_4_Compatibility::glConvolutionParameteriv(GLenum target, GLenum pname, const GLint *params)
-{
- d_1_2_Deprecated->f.ConvolutionParameteriv(target, pname, params);
-}
-
-inline void QOpenGLFunctions_4_4_Compatibility::glCopyConvolutionFilter1D(GLenum target, GLenum internalformat, GLint x, GLint y, GLsizei width)
-{
- d_1_2_Deprecated->f.CopyConvolutionFilter1D(target, internalformat, x, y, width);
-}
-
-inline void QOpenGLFunctions_4_4_Compatibility::glCopyConvolutionFilter2D(GLenum target, GLenum internalformat, GLint x, GLint y, GLsizei width, GLsizei height)
-{
- d_1_2_Deprecated->f.CopyConvolutionFilter2D(target, internalformat, x, y, width, height);
-}
-
-inline void QOpenGLFunctions_4_4_Compatibility::glGetConvolutionFilter(GLenum target, GLenum format, GLenum type, void *image)
-{
- d_1_2_Deprecated->f.GetConvolutionFilter(target, format, type, image);
-}
-
-inline void QOpenGLFunctions_4_4_Compatibility::glGetConvolutionParameterfv(GLenum target, GLenum pname, GLfloat *params)
-{
- d_1_2_Deprecated->f.GetConvolutionParameterfv(target, pname, params);
-}
-
-inline void QOpenGLFunctions_4_4_Compatibility::glGetConvolutionParameteriv(GLenum target, GLenum pname, GLint *params)
-{
- d_1_2_Deprecated->f.GetConvolutionParameteriv(target, pname, params);
-}
-
-inline void QOpenGLFunctions_4_4_Compatibility::glGetSeparableFilter(GLenum target, GLenum format, GLenum type, void *row, void *column, void *span)
-{
- d_1_2_Deprecated->f.GetSeparableFilter(target, format, type, row, column, span);
-}
-
-inline void QOpenGLFunctions_4_4_Compatibility::glSeparableFilter2D(GLenum target, GLenum internalformat, GLsizei width, GLsizei height, GLenum format, GLenum type, const void *row, const void *column)
-{
- d_1_2_Deprecated->f.SeparableFilter2D(target, internalformat, width, height, format, type, row, column);
-}
-
-inline void QOpenGLFunctions_4_4_Compatibility::glGetHistogram(GLenum target, GLboolean reset, GLenum format, GLenum type, void *values)
-{
- d_1_2_Deprecated->f.GetHistogram(target, reset, format, type, values);
-}
-
-inline void QOpenGLFunctions_4_4_Compatibility::glGetHistogramParameterfv(GLenum target, GLenum pname, GLfloat *params)
-{
- d_1_2_Deprecated->f.GetHistogramParameterfv(target, pname, params);
-}
-
-inline void QOpenGLFunctions_4_4_Compatibility::glGetHistogramParameteriv(GLenum target, GLenum pname, GLint *params)
-{
- d_1_2_Deprecated->f.GetHistogramParameteriv(target, pname, params);
-}
-
-inline void QOpenGLFunctions_4_4_Compatibility::glGetMinmax(GLenum target, GLboolean reset, GLenum format, GLenum type, void *values)
-{
- d_1_2_Deprecated->f.GetMinmax(target, reset, format, type, values);
-}
-
-inline void QOpenGLFunctions_4_4_Compatibility::glGetMinmaxParameterfv(GLenum target, GLenum pname, GLfloat *params)
-{
- d_1_2_Deprecated->f.GetMinmaxParameterfv(target, pname, params);
-}
-
-inline void QOpenGLFunctions_4_4_Compatibility::glGetMinmaxParameteriv(GLenum target, GLenum pname, GLint *params)
-{
- d_1_2_Deprecated->f.GetMinmaxParameteriv(target, pname, params);
-}
-
-inline void QOpenGLFunctions_4_4_Compatibility::glHistogram(GLenum target, GLsizei width, GLenum internalformat, GLboolean sink)
-{
- d_1_2_Deprecated->f.Histogram(target, width, internalformat, sink);
-}
-
-inline void QOpenGLFunctions_4_4_Compatibility::glMinmax(GLenum target, GLenum internalformat, GLboolean sink)
-{
- d_1_2_Deprecated->f.Minmax(target, internalformat, sink);
-}
-
-inline void QOpenGLFunctions_4_4_Compatibility::glResetHistogram(GLenum target)
-{
- d_1_2_Deprecated->f.ResetHistogram(target);
-}
-
-inline void QOpenGLFunctions_4_4_Compatibility::glResetMinmax(GLenum target)
-{
- d_1_2_Deprecated->f.ResetMinmax(target);
-}
-
-
-// OpenGL 1.3 deprecated functions
-inline void QOpenGLFunctions_4_4_Compatibility::glMultTransposeMatrixd(const GLdouble *m)
-{
- d_1_3_Deprecated->f.MultTransposeMatrixd(m);
-}
-
-inline void QOpenGLFunctions_4_4_Compatibility::glMultTransposeMatrixf(const GLfloat *m)
-{
- d_1_3_Deprecated->f.MultTransposeMatrixf(m);
-}
-
-inline void QOpenGLFunctions_4_4_Compatibility::glLoadTransposeMatrixd(const GLdouble *m)
-{
- d_1_3_Deprecated->f.LoadTransposeMatrixd(m);
-}
-
-inline void QOpenGLFunctions_4_4_Compatibility::glLoadTransposeMatrixf(const GLfloat *m)
-{
- d_1_3_Deprecated->f.LoadTransposeMatrixf(m);
-}
-
-inline void QOpenGLFunctions_4_4_Compatibility::glMultiTexCoord4sv(GLenum target, const GLshort *v)
-{
- d_1_3_Deprecated->f.MultiTexCoord4sv(target, v);
-}
-
-inline void QOpenGLFunctions_4_4_Compatibility::glMultiTexCoord4s(GLenum target, GLshort s, GLshort t, GLshort r, GLshort q)
-{
- d_1_3_Deprecated->f.MultiTexCoord4s(target, s, t, r, q);
-}
-
-inline void QOpenGLFunctions_4_4_Compatibility::glMultiTexCoord4iv(GLenum target, const GLint *v)
-{
- d_1_3_Deprecated->f.MultiTexCoord4iv(target, v);
-}
-
-inline void QOpenGLFunctions_4_4_Compatibility::glMultiTexCoord4i(GLenum target, GLint s, GLint t, GLint r, GLint q)
-{
- d_1_3_Deprecated->f.MultiTexCoord4i(target, s, t, r, q);
-}
-
-inline void QOpenGLFunctions_4_4_Compatibility::glMultiTexCoord4fv(GLenum target, const GLfloat *v)
-{
- d_1_3_Deprecated->f.MultiTexCoord4fv(target, v);
-}
-
-inline void QOpenGLFunctions_4_4_Compatibility::glMultiTexCoord4f(GLenum target, GLfloat s, GLfloat t, GLfloat r, GLfloat q)
-{
- d_1_3_Deprecated->f.MultiTexCoord4f(target, s, t, r, q);
-}
-
-inline void QOpenGLFunctions_4_4_Compatibility::glMultiTexCoord4dv(GLenum target, const GLdouble *v)
-{
- d_1_3_Deprecated->f.MultiTexCoord4dv(target, v);
-}
-
-inline void QOpenGLFunctions_4_4_Compatibility::glMultiTexCoord4d(GLenum target, GLdouble s, GLdouble t, GLdouble r, GLdouble q)
-{
- d_1_3_Deprecated->f.MultiTexCoord4d(target, s, t, r, q);
-}
-
-inline void QOpenGLFunctions_4_4_Compatibility::glMultiTexCoord3sv(GLenum target, const GLshort *v)
-{
- d_1_3_Deprecated->f.MultiTexCoord3sv(target, v);
-}
-
-inline void QOpenGLFunctions_4_4_Compatibility::glMultiTexCoord3s(GLenum target, GLshort s, GLshort t, GLshort r)
-{
- d_1_3_Deprecated->f.MultiTexCoord3s(target, s, t, r);
-}
-
-inline void QOpenGLFunctions_4_4_Compatibility::glMultiTexCoord3iv(GLenum target, const GLint *v)
-{
- d_1_3_Deprecated->f.MultiTexCoord3iv(target, v);
-}
-
-inline void QOpenGLFunctions_4_4_Compatibility::glMultiTexCoord3i(GLenum target, GLint s, GLint t, GLint r)
-{
- d_1_3_Deprecated->f.MultiTexCoord3i(target, s, t, r);
-}
-
-inline void QOpenGLFunctions_4_4_Compatibility::glMultiTexCoord3fv(GLenum target, const GLfloat *v)
-{
- d_1_3_Deprecated->f.MultiTexCoord3fv(target, v);
-}
-
-inline void QOpenGLFunctions_4_4_Compatibility::glMultiTexCoord3f(GLenum target, GLfloat s, GLfloat t, GLfloat r)
-{
- d_1_3_Deprecated->f.MultiTexCoord3f(target, s, t, r);
-}
-
-inline void QOpenGLFunctions_4_4_Compatibility::glMultiTexCoord3dv(GLenum target, const GLdouble *v)
-{
- d_1_3_Deprecated->f.MultiTexCoord3dv(target, v);
-}
-
-inline void QOpenGLFunctions_4_4_Compatibility::glMultiTexCoord3d(GLenum target, GLdouble s, GLdouble t, GLdouble r)
-{
- d_1_3_Deprecated->f.MultiTexCoord3d(target, s, t, r);
-}
-
-inline void QOpenGLFunctions_4_4_Compatibility::glMultiTexCoord2sv(GLenum target, const GLshort *v)
-{
- d_1_3_Deprecated->f.MultiTexCoord2sv(target, v);
-}
-
-inline void QOpenGLFunctions_4_4_Compatibility::glMultiTexCoord2s(GLenum target, GLshort s, GLshort t)
-{
- d_1_3_Deprecated->f.MultiTexCoord2s(target, s, t);
-}
-
-inline void QOpenGLFunctions_4_4_Compatibility::glMultiTexCoord2iv(GLenum target, const GLint *v)
-{
- d_1_3_Deprecated->f.MultiTexCoord2iv(target, v);
-}
-
-inline void QOpenGLFunctions_4_4_Compatibility::glMultiTexCoord2i(GLenum target, GLint s, GLint t)
-{
- d_1_3_Deprecated->f.MultiTexCoord2i(target, s, t);
-}
-
-inline void QOpenGLFunctions_4_4_Compatibility::glMultiTexCoord2fv(GLenum target, const GLfloat *v)
-{
- d_1_3_Deprecated->f.MultiTexCoord2fv(target, v);
-}
-
-inline void QOpenGLFunctions_4_4_Compatibility::glMultiTexCoord2f(GLenum target, GLfloat s, GLfloat t)
-{
- d_1_3_Deprecated->f.MultiTexCoord2f(target, s, t);
-}
-
-inline void QOpenGLFunctions_4_4_Compatibility::glMultiTexCoord2dv(GLenum target, const GLdouble *v)
-{
- d_1_3_Deprecated->f.MultiTexCoord2dv(target, v);
-}
-
-inline void QOpenGLFunctions_4_4_Compatibility::glMultiTexCoord2d(GLenum target, GLdouble s, GLdouble t)
-{
- d_1_3_Deprecated->f.MultiTexCoord2d(target, s, t);
-}
-
-inline void QOpenGLFunctions_4_4_Compatibility::glMultiTexCoord1sv(GLenum target, const GLshort *v)
-{
- d_1_3_Deprecated->f.MultiTexCoord1sv(target, v);
-}
-
-inline void QOpenGLFunctions_4_4_Compatibility::glMultiTexCoord1s(GLenum target, GLshort s)
-{
- d_1_3_Deprecated->f.MultiTexCoord1s(target, s);
-}
-
-inline void QOpenGLFunctions_4_4_Compatibility::glMultiTexCoord1iv(GLenum target, const GLint *v)
-{
- d_1_3_Deprecated->f.MultiTexCoord1iv(target, v);
-}
-
-inline void QOpenGLFunctions_4_4_Compatibility::glMultiTexCoord1i(GLenum target, GLint s)
-{
- d_1_3_Deprecated->f.MultiTexCoord1i(target, s);
-}
-
-inline void QOpenGLFunctions_4_4_Compatibility::glMultiTexCoord1fv(GLenum target, const GLfloat *v)
-{
- d_1_3_Deprecated->f.MultiTexCoord1fv(target, v);
-}
-
-inline void QOpenGLFunctions_4_4_Compatibility::glMultiTexCoord1f(GLenum target, GLfloat s)
-{
- d_1_3_Deprecated->f.MultiTexCoord1f(target, s);
-}
-
-inline void QOpenGLFunctions_4_4_Compatibility::glMultiTexCoord1dv(GLenum target, const GLdouble *v)
-{
- d_1_3_Deprecated->f.MultiTexCoord1dv(target, v);
-}
-
-inline void QOpenGLFunctions_4_4_Compatibility::glMultiTexCoord1d(GLenum target, GLdouble s)
-{
- d_1_3_Deprecated->f.MultiTexCoord1d(target, s);
-}
-
-inline void QOpenGLFunctions_4_4_Compatibility::glClientActiveTexture(GLenum texture)
-{
- d_1_3_Deprecated->f.ClientActiveTexture(texture);
-}
-
-
-// OpenGL 1.4 deprecated functions
-inline void QOpenGLFunctions_4_4_Compatibility::glWindowPos3sv(const GLshort *v)
-{
- d_1_4_Deprecated->f.WindowPos3sv(v);
-}
-
-inline void QOpenGLFunctions_4_4_Compatibility::glWindowPos3s(GLshort x, GLshort y, GLshort z)
-{
- d_1_4_Deprecated->f.WindowPos3s(x, y, z);
-}
-
-inline void QOpenGLFunctions_4_4_Compatibility::glWindowPos3iv(const GLint *v)
-{
- d_1_4_Deprecated->f.WindowPos3iv(v);
-}
-
-inline void QOpenGLFunctions_4_4_Compatibility::glWindowPos3i(GLint x, GLint y, GLint z)
-{
- d_1_4_Deprecated->f.WindowPos3i(x, y, z);
-}
-
-inline void QOpenGLFunctions_4_4_Compatibility::glWindowPos3fv(const GLfloat *v)
-{
- d_1_4_Deprecated->f.WindowPos3fv(v);
-}
-
-inline void QOpenGLFunctions_4_4_Compatibility::glWindowPos3f(GLfloat x, GLfloat y, GLfloat z)
-{
- d_1_4_Deprecated->f.WindowPos3f(x, y, z);
-}
-
-inline void QOpenGLFunctions_4_4_Compatibility::glWindowPos3dv(const GLdouble *v)
-{
- d_1_4_Deprecated->f.WindowPos3dv(v);
-}
-
-inline void QOpenGLFunctions_4_4_Compatibility::glWindowPos3d(GLdouble x, GLdouble y, GLdouble z)
-{
- d_1_4_Deprecated->f.WindowPos3d(x, y, z);
-}
-
-inline void QOpenGLFunctions_4_4_Compatibility::glWindowPos2sv(const GLshort *v)
-{
- d_1_4_Deprecated->f.WindowPos2sv(v);
-}
-
-inline void QOpenGLFunctions_4_4_Compatibility::glWindowPos2s(GLshort x, GLshort y)
-{
- d_1_4_Deprecated->f.WindowPos2s(x, y);
-}
-
-inline void QOpenGLFunctions_4_4_Compatibility::glWindowPos2iv(const GLint *v)
-{
- d_1_4_Deprecated->f.WindowPos2iv(v);
-}
-
-inline void QOpenGLFunctions_4_4_Compatibility::glWindowPos2i(GLint x, GLint y)
-{
- d_1_4_Deprecated->f.WindowPos2i(x, y);
-}
-
-inline void QOpenGLFunctions_4_4_Compatibility::glWindowPos2fv(const GLfloat *v)
-{
- d_1_4_Deprecated->f.WindowPos2fv(v);
-}
-
-inline void QOpenGLFunctions_4_4_Compatibility::glWindowPos2f(GLfloat x, GLfloat y)
-{
- d_1_4_Deprecated->f.WindowPos2f(x, y);
-}
-
-inline void QOpenGLFunctions_4_4_Compatibility::glWindowPos2dv(const GLdouble *v)
-{
- d_1_4_Deprecated->f.WindowPos2dv(v);
-}
-
-inline void QOpenGLFunctions_4_4_Compatibility::glWindowPos2d(GLdouble x, GLdouble y)
-{
- d_1_4_Deprecated->f.WindowPos2d(x, y);
-}
-
-inline void QOpenGLFunctions_4_4_Compatibility::glSecondaryColorPointer(GLint size, GLenum type, GLsizei stride, const void *pointer)
-{
- d_1_4_Deprecated->f.SecondaryColorPointer(size, type, stride, pointer);
-}
-
-inline void QOpenGLFunctions_4_4_Compatibility::glSecondaryColor3usv(const GLushort *v)
-{
- d_1_4_Deprecated->f.SecondaryColor3usv(v);
-}
-
-inline void QOpenGLFunctions_4_4_Compatibility::glSecondaryColor3us(GLushort red, GLushort green, GLushort blue)
-{
- d_1_4_Deprecated->f.SecondaryColor3us(red, green, blue);
-}
-
-inline void QOpenGLFunctions_4_4_Compatibility::glSecondaryColor3uiv(const GLuint *v)
-{
- d_1_4_Deprecated->f.SecondaryColor3uiv(v);
-}
-
-inline void QOpenGLFunctions_4_4_Compatibility::glSecondaryColor3ui(GLuint red, GLuint green, GLuint blue)
-{
- d_1_4_Deprecated->f.SecondaryColor3ui(red, green, blue);
-}
-
-inline void QOpenGLFunctions_4_4_Compatibility::glSecondaryColor3ubv(const GLubyte *v)
-{
- d_1_4_Deprecated->f.SecondaryColor3ubv(v);
-}
-
-inline void QOpenGLFunctions_4_4_Compatibility::glSecondaryColor3ub(GLubyte red, GLubyte green, GLubyte blue)
-{
- d_1_4_Deprecated->f.SecondaryColor3ub(red, green, blue);
-}
-
-inline void QOpenGLFunctions_4_4_Compatibility::glSecondaryColor3sv(const GLshort *v)
-{
- d_1_4_Deprecated->f.SecondaryColor3sv(v);
-}
-
-inline void QOpenGLFunctions_4_4_Compatibility::glSecondaryColor3s(GLshort red, GLshort green, GLshort blue)
-{
- d_1_4_Deprecated->f.SecondaryColor3s(red, green, blue);
-}
-
-inline void QOpenGLFunctions_4_4_Compatibility::glSecondaryColor3iv(const GLint *v)
-{
- d_1_4_Deprecated->f.SecondaryColor3iv(v);
-}
-
-inline void QOpenGLFunctions_4_4_Compatibility::glSecondaryColor3i(GLint red, GLint green, GLint blue)
-{
- d_1_4_Deprecated->f.SecondaryColor3i(red, green, blue);
-}
-
-inline void QOpenGLFunctions_4_4_Compatibility::glSecondaryColor3fv(const GLfloat *v)
-{
- d_1_4_Deprecated->f.SecondaryColor3fv(v);
-}
-
-inline void QOpenGLFunctions_4_4_Compatibility::glSecondaryColor3f(GLfloat red, GLfloat green, GLfloat blue)
-{
- d_1_4_Deprecated->f.SecondaryColor3f(red, green, blue);
-}
-
-inline void QOpenGLFunctions_4_4_Compatibility::glSecondaryColor3dv(const GLdouble *v)
-{
- d_1_4_Deprecated->f.SecondaryColor3dv(v);
-}
-
-inline void QOpenGLFunctions_4_4_Compatibility::glSecondaryColor3d(GLdouble red, GLdouble green, GLdouble blue)
-{
- d_1_4_Deprecated->f.SecondaryColor3d(red, green, blue);
-}
-
-inline void QOpenGLFunctions_4_4_Compatibility::glSecondaryColor3bv(const GLbyte *v)
-{
- d_1_4_Deprecated->f.SecondaryColor3bv(v);
-}
-
-inline void QOpenGLFunctions_4_4_Compatibility::glSecondaryColor3b(GLbyte red, GLbyte green, GLbyte blue)
-{
- d_1_4_Deprecated->f.SecondaryColor3b(red, green, blue);
-}
-
-inline void QOpenGLFunctions_4_4_Compatibility::glFogCoordPointer(GLenum type, GLsizei stride, const void *pointer)
-{
- d_1_4_Deprecated->f.FogCoordPointer(type, stride, pointer);
-}
-
-inline void QOpenGLFunctions_4_4_Compatibility::glFogCoorddv(const GLdouble *coord)
-{
- d_1_4_Deprecated->f.FogCoorddv(coord);
-}
-
-inline void QOpenGLFunctions_4_4_Compatibility::glFogCoordd(GLdouble coord)
-{
- d_1_4_Deprecated->f.FogCoordd(coord);
-}
-
-inline void QOpenGLFunctions_4_4_Compatibility::glFogCoordfv(const GLfloat *coord)
-{
- d_1_4_Deprecated->f.FogCoordfv(coord);
-}
-
-inline void QOpenGLFunctions_4_4_Compatibility::glFogCoordf(GLfloat coord)
-{
- d_1_4_Deprecated->f.FogCoordf(coord);
-}
-
-
-// OpenGL 1.5 deprecated functions
-
-// OpenGL 2.0 deprecated functions
-
-// OpenGL 2.1 deprecated functions
-
-// OpenGL 3.0 deprecated functions
-
-// OpenGL 3.1 deprecated functions
-
-// OpenGL 3.2 deprecated functions
-
-// OpenGL 3.3 deprecated functions
-inline void QOpenGLFunctions_4_4_Compatibility::glSecondaryColorP3uiv(GLenum type, const GLuint *color)
-{
- d_3_3_Deprecated->f.SecondaryColorP3uiv(type, color);
-}
-
-inline void QOpenGLFunctions_4_4_Compatibility::glSecondaryColorP3ui(GLenum type, GLuint color)
-{
- d_3_3_Deprecated->f.SecondaryColorP3ui(type, color);
-}
-
-inline void QOpenGLFunctions_4_4_Compatibility::glColorP4uiv(GLenum type, const GLuint *color)
-{
- d_3_3_Deprecated->f.ColorP4uiv(type, color);
-}
-
-inline void QOpenGLFunctions_4_4_Compatibility::glColorP4ui(GLenum type, GLuint color)
-{
- d_3_3_Deprecated->f.ColorP4ui(type, color);
-}
-
-inline void QOpenGLFunctions_4_4_Compatibility::glColorP3uiv(GLenum type, const GLuint *color)
-{
- d_3_3_Deprecated->f.ColorP3uiv(type, color);
-}
-
-inline void QOpenGLFunctions_4_4_Compatibility::glColorP3ui(GLenum type, GLuint color)
-{
- d_3_3_Deprecated->f.ColorP3ui(type, color);
-}
-
-inline void QOpenGLFunctions_4_4_Compatibility::glNormalP3uiv(GLenum type, const GLuint *coords)
-{
- d_3_3_Deprecated->f.NormalP3uiv(type, coords);
-}
-
-inline void QOpenGLFunctions_4_4_Compatibility::glNormalP3ui(GLenum type, GLuint coords)
-{
- d_3_3_Deprecated->f.NormalP3ui(type, coords);
-}
-
-inline void QOpenGLFunctions_4_4_Compatibility::glMultiTexCoordP4uiv(GLenum texture, GLenum type, const GLuint *coords)
-{
- d_3_3_Deprecated->f.MultiTexCoordP4uiv(texture, type, coords);
-}
-
-inline void QOpenGLFunctions_4_4_Compatibility::glMultiTexCoordP4ui(GLenum texture, GLenum type, GLuint coords)
-{
- d_3_3_Deprecated->f.MultiTexCoordP4ui(texture, type, coords);
-}
-
-inline void QOpenGLFunctions_4_4_Compatibility::glMultiTexCoordP3uiv(GLenum texture, GLenum type, const GLuint *coords)
-{
- d_3_3_Deprecated->f.MultiTexCoordP3uiv(texture, type, coords);
-}
-
-inline void QOpenGLFunctions_4_4_Compatibility::glMultiTexCoordP3ui(GLenum texture, GLenum type, GLuint coords)
-{
- d_3_3_Deprecated->f.MultiTexCoordP3ui(texture, type, coords);
-}
-
-inline void QOpenGLFunctions_4_4_Compatibility::glMultiTexCoordP2uiv(GLenum texture, GLenum type, const GLuint *coords)
-{
- d_3_3_Deprecated->f.MultiTexCoordP2uiv(texture, type, coords);
-}
-
-inline void QOpenGLFunctions_4_4_Compatibility::glMultiTexCoordP2ui(GLenum texture, GLenum type, GLuint coords)
-{
- d_3_3_Deprecated->f.MultiTexCoordP2ui(texture, type, coords);
-}
-
-inline void QOpenGLFunctions_4_4_Compatibility::glMultiTexCoordP1uiv(GLenum texture, GLenum type, const GLuint *coords)
-{
- d_3_3_Deprecated->f.MultiTexCoordP1uiv(texture, type, coords);
-}
-
-inline void QOpenGLFunctions_4_4_Compatibility::glMultiTexCoordP1ui(GLenum texture, GLenum type, GLuint coords)
-{
- d_3_3_Deprecated->f.MultiTexCoordP1ui(texture, type, coords);
-}
-
-inline void QOpenGLFunctions_4_4_Compatibility::glTexCoordP4uiv(GLenum type, const GLuint *coords)
-{
- d_3_3_Deprecated->f.TexCoordP4uiv(type, coords);
-}
-
-inline void QOpenGLFunctions_4_4_Compatibility::glTexCoordP4ui(GLenum type, GLuint coords)
-{
- d_3_3_Deprecated->f.TexCoordP4ui(type, coords);
-}
-
-inline void QOpenGLFunctions_4_4_Compatibility::glTexCoordP3uiv(GLenum type, const GLuint *coords)
-{
- d_3_3_Deprecated->f.TexCoordP3uiv(type, coords);
-}
-
-inline void QOpenGLFunctions_4_4_Compatibility::glTexCoordP3ui(GLenum type, GLuint coords)
-{
- d_3_3_Deprecated->f.TexCoordP3ui(type, coords);
-}
-
-inline void QOpenGLFunctions_4_4_Compatibility::glTexCoordP2uiv(GLenum type, const GLuint *coords)
-{
- d_3_3_Deprecated->f.TexCoordP2uiv(type, coords);
-}
-
-inline void QOpenGLFunctions_4_4_Compatibility::glTexCoordP2ui(GLenum type, GLuint coords)
-{
- d_3_3_Deprecated->f.TexCoordP2ui(type, coords);
-}
-
-inline void QOpenGLFunctions_4_4_Compatibility::glTexCoordP1uiv(GLenum type, const GLuint *coords)
-{
- d_3_3_Deprecated->f.TexCoordP1uiv(type, coords);
-}
-
-inline void QOpenGLFunctions_4_4_Compatibility::glTexCoordP1ui(GLenum type, GLuint coords)
-{
- d_3_3_Deprecated->f.TexCoordP1ui(type, coords);
-}
-
-inline void QOpenGLFunctions_4_4_Compatibility::glVertexP4uiv(GLenum type, const GLuint *value)
-{
- d_3_3_Deprecated->f.VertexP4uiv(type, value);
-}
-
-inline void QOpenGLFunctions_4_4_Compatibility::glVertexP4ui(GLenum type, GLuint value)
-{
- d_3_3_Deprecated->f.VertexP4ui(type, value);
-}
-
-inline void QOpenGLFunctions_4_4_Compatibility::glVertexP3uiv(GLenum type, const GLuint *value)
-{
- d_3_3_Deprecated->f.VertexP3uiv(type, value);
-}
-
-inline void QOpenGLFunctions_4_4_Compatibility::glVertexP3ui(GLenum type, GLuint value)
-{
- d_3_3_Deprecated->f.VertexP3ui(type, value);
-}
-
-inline void QOpenGLFunctions_4_4_Compatibility::glVertexP2uiv(GLenum type, const GLuint *value)
-{
- d_3_3_Deprecated->f.VertexP2uiv(type, value);
-}
-
-inline void QOpenGLFunctions_4_4_Compatibility::glVertexP2ui(GLenum type, GLuint value)
-{
- d_3_3_Deprecated->f.VertexP2ui(type, value);
-}
-
-
-// OpenGL 4.0 deprecated functions
-
-// OpenGL 4.1 deprecated functions
-
-// OpenGL 4.2 deprecated functions
-
-// OpenGL 4.3 deprecated functions
-
-// OpenGL 4.4 deprecated functions
-
-
-QT_END_NAMESPACE
-
-#ifdef Q_OS_WIN
-#pragma pop_macro("MemoryBarrier")
-#endif
-
-#endif // QT_NO_OPENGL && !QT_OPENGL_ES_2
-
-#endif
diff --git a/src/gui/opengl/qopenglfunctions_4_4_core.cpp b/src/gui/opengl/qopenglfunctions_4_4_core.cpp
deleted file mode 100644
index 6169c7f455..0000000000
--- a/src/gui/opengl/qopenglfunctions_4_4_core.cpp
+++ /dev/null
@@ -1,269 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2015 Klaralvdalens Datakonsult AB (KDAB)
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the QtGui module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-**
-** This file was generated by glgen version 0.1
-** Command line was: glgen
-**
-** glgen is Copyright (C) 2013 Klaralvdalens Datakonsult AB (KDAB)
-**
-** This is an auto-generated file.
-** Do not edit! All changes made to it will be lost.
-**
-****************************************************************************/
-
-#include "qopenglfunctions_4_4_core.h"
-#include "qopenglcontext.h"
-
-QT_BEGIN_NAMESPACE
-
-/*!
- \class QOpenGLFunctions_4_4_Core
- \inmodule QtGui
- \since 5.5
- \wrapper
- \brief The QOpenGLFunctions_4_4_Core class provides all functions for OpenGL 4.4 core profile.
-
- This class is a wrapper for functions from OpenGL 4.4 core profile.
- See reference pages on \l {http://www.opengl.org/sdk/docs/}{opengl.org}
- for function documentation.
-
- \sa QAbstractOpenGLFunctions
-*/
-
-QOpenGLFunctions_4_4_Core::QOpenGLFunctions_4_4_Core()
- : QAbstractOpenGLFunctions()
- , d_1_0_Core(nullptr)
- , d_1_1_Core(nullptr)
- , d_1_2_Core(nullptr)
- , d_1_3_Core(nullptr)
- , d_1_4_Core(nullptr)
- , d_1_5_Core(nullptr)
- , d_2_0_Core(nullptr)
- , d_2_1_Core(nullptr)
- , d_3_0_Core(nullptr)
- , d_3_1_Core(nullptr)
- , d_3_2_Core(nullptr)
- , d_3_3_Core(nullptr)
- , d_4_0_Core(nullptr)
- , d_4_1_Core(nullptr)
- , d_4_2_Core(nullptr)
- , d_4_3_Core(nullptr)
- , d_4_4_Core(nullptr)
-{
-}
-
-QOpenGLFunctions_4_4_Core::~QOpenGLFunctions_4_4_Core()
-{
- if (d_1_0_Core) {
- d_1_0_Core->refs.deref();
- Q_ASSERT(d_1_0_Core->refs.loadRelaxed());
- }
- if (d_1_1_Core) {
- d_1_1_Core->refs.deref();
- Q_ASSERT(d_1_1_Core->refs.loadRelaxed());
- }
- if (d_1_2_Core) {
- d_1_2_Core->refs.deref();
- Q_ASSERT(d_1_2_Core->refs.loadRelaxed());
- }
- if (d_1_3_Core) {
- d_1_3_Core->refs.deref();
- Q_ASSERT(d_1_3_Core->refs.loadRelaxed());
- }
- if (d_1_4_Core) {
- d_1_4_Core->refs.deref();
- Q_ASSERT(d_1_4_Core->refs.loadRelaxed());
- }
- if (d_1_5_Core) {
- d_1_5_Core->refs.deref();
- Q_ASSERT(d_1_5_Core->refs.loadRelaxed());
- }
- if (d_2_0_Core) {
- d_2_0_Core->refs.deref();
- Q_ASSERT(d_2_0_Core->refs.loadRelaxed());
- }
- if (d_2_1_Core) {
- d_2_1_Core->refs.deref();
- Q_ASSERT(d_2_1_Core->refs.loadRelaxed());
- }
- if (d_3_0_Core) {
- d_3_0_Core->refs.deref();
- Q_ASSERT(d_3_0_Core->refs.loadRelaxed());
- }
- if (d_3_1_Core) {
- d_3_1_Core->refs.deref();
- Q_ASSERT(d_3_1_Core->refs.loadRelaxed());
- }
- if (d_3_2_Core) {
- d_3_2_Core->refs.deref();
- Q_ASSERT(d_3_2_Core->refs.loadRelaxed());
- }
- if (d_3_3_Core) {
- d_3_3_Core->refs.deref();
- Q_ASSERT(d_3_3_Core->refs.loadRelaxed());
- }
- if (d_4_0_Core) {
- d_4_0_Core->refs.deref();
- Q_ASSERT(d_4_0_Core->refs.loadRelaxed());
- }
- if (d_4_1_Core) {
- d_4_1_Core->refs.deref();
- Q_ASSERT(d_4_1_Core->refs.loadRelaxed());
- }
- if (d_4_2_Core) {
- d_4_2_Core->refs.deref();
- Q_ASSERT(d_4_2_Core->refs.loadRelaxed());
- }
- if (d_4_3_Core) {
- d_4_3_Core->refs.deref();
- Q_ASSERT(d_4_3_Core->refs.loadRelaxed());
- }
- if (d_4_4_Core) {
- d_4_4_Core->refs.deref();
- Q_ASSERT(d_4_4_Core->refs.loadRelaxed());
- }
-}
-
-bool QOpenGLFunctions_4_4_Core::initializeOpenGLFunctions()
-{
- if ( isInitialized() )
- return true;
-
- QOpenGLContext* context = QOpenGLContext::currentContext();
-
- // If owned by a context object make sure it is current.
- // Also check that current context is capable of resolving all needed functions
- if (((owningContext() && owningContext() == context) || !owningContext())
- && QOpenGLFunctions_4_4_Core::isContextCompatible(context))
- {
- // Associate with private implementation, creating if necessary
- // Function pointers in the backends are resolved at creation time
- QOpenGLVersionFunctionsBackend* d = nullptr;
- d = QAbstractOpenGLFunctionsPrivate::functionsBackend(context, QOpenGLFunctions_1_0_CoreBackend::versionStatus());
- d_1_0_Core = static_cast<QOpenGLFunctions_1_0_CoreBackend*>(d);
- d->refs.ref();
-
- d = QAbstractOpenGLFunctionsPrivate::functionsBackend(context, QOpenGLFunctions_1_1_CoreBackend::versionStatus());
- d_1_1_Core = static_cast<QOpenGLFunctions_1_1_CoreBackend*>(d);
- d->refs.ref();
-
- d = QAbstractOpenGLFunctionsPrivate::functionsBackend(context, QOpenGLFunctions_1_2_CoreBackend::versionStatus());
- d_1_2_Core = static_cast<QOpenGLFunctions_1_2_CoreBackend*>(d);
- d->refs.ref();
-
- d = QAbstractOpenGLFunctionsPrivate::functionsBackend(context, QOpenGLFunctions_1_3_CoreBackend::versionStatus());
- d_1_3_Core = static_cast<QOpenGLFunctions_1_3_CoreBackend*>(d);
- d->refs.ref();
-
- d = QAbstractOpenGLFunctionsPrivate::functionsBackend(context, QOpenGLFunctions_1_4_CoreBackend::versionStatus());
- d_1_4_Core = static_cast<QOpenGLFunctions_1_4_CoreBackend*>(d);
- d->refs.ref();
-
- d = QAbstractOpenGLFunctionsPrivate::functionsBackend(context, QOpenGLFunctions_1_5_CoreBackend::versionStatus());
- d_1_5_Core = static_cast<QOpenGLFunctions_1_5_CoreBackend*>(d);
- d->refs.ref();
-
- d = QAbstractOpenGLFunctionsPrivate::functionsBackend(context, QOpenGLFunctions_2_0_CoreBackend::versionStatus());
- d_2_0_Core = static_cast<QOpenGLFunctions_2_0_CoreBackend*>(d);
- d->refs.ref();
-
- d = QAbstractOpenGLFunctionsPrivate::functionsBackend(context, QOpenGLFunctions_2_1_CoreBackend::versionStatus());
- d_2_1_Core = static_cast<QOpenGLFunctions_2_1_CoreBackend*>(d);
- d->refs.ref();
-
- d = QAbstractOpenGLFunctionsPrivate::functionsBackend(context, QOpenGLFunctions_3_0_CoreBackend::versionStatus());
- d_3_0_Core = static_cast<QOpenGLFunctions_3_0_CoreBackend*>(d);
- d->refs.ref();
-
- d = QAbstractOpenGLFunctionsPrivate::functionsBackend(context, QOpenGLFunctions_3_1_CoreBackend::versionStatus());
- d_3_1_Core = static_cast<QOpenGLFunctions_3_1_CoreBackend*>(d);
- d->refs.ref();
-
- d = QAbstractOpenGLFunctionsPrivate::functionsBackend(context, QOpenGLFunctions_3_2_CoreBackend::versionStatus());
- d_3_2_Core = static_cast<QOpenGLFunctions_3_2_CoreBackend*>(d);
- d->refs.ref();
-
- d = QAbstractOpenGLFunctionsPrivate::functionsBackend(context, QOpenGLFunctions_3_3_CoreBackend::versionStatus());
- d_3_3_Core = static_cast<QOpenGLFunctions_3_3_CoreBackend*>(d);
- d->refs.ref();
-
- d = QAbstractOpenGLFunctionsPrivate::functionsBackend(context, QOpenGLFunctions_4_0_CoreBackend::versionStatus());
- d_4_0_Core = static_cast<QOpenGLFunctions_4_0_CoreBackend*>(d);
- d->refs.ref();
-
- d = QAbstractOpenGLFunctionsPrivate::functionsBackend(context, QOpenGLFunctions_4_1_CoreBackend::versionStatus());
- d_4_1_Core = static_cast<QOpenGLFunctions_4_1_CoreBackend*>(d);
- d->refs.ref();
-
- d = QAbstractOpenGLFunctionsPrivate::functionsBackend(context, QOpenGLFunctions_4_2_CoreBackend::versionStatus());
- d_4_2_Core = static_cast<QOpenGLFunctions_4_2_CoreBackend*>(d);
- d->refs.ref();
-
- d = QAbstractOpenGLFunctionsPrivate::functionsBackend(context, QOpenGLFunctions_4_3_CoreBackend::versionStatus());
- d_4_3_Core = static_cast<QOpenGLFunctions_4_3_CoreBackend*>(d);
- d->refs.ref();
-
- d = QAbstractOpenGLFunctionsPrivate::functionsBackend(context, QOpenGLFunctions_4_4_CoreBackend::versionStatus());
- d_4_4_Core = static_cast<QOpenGLFunctions_4_4_CoreBackend*>(d);
- d->refs.ref();
-
- QAbstractOpenGLFunctions::initializeOpenGLFunctions();
- }
- return isInitialized();
-}
-
-bool QOpenGLFunctions_4_4_Core::isContextCompatible(QOpenGLContext *context)
-{
- Q_ASSERT(context);
- QSurfaceFormat f = context->format();
- const QPair<int, int> v = qMakePair(f.majorVersion(), f.minorVersion());
- if (v < qMakePair(4, 4))
- return false;
-
- return true;
-}
-
-QOpenGLVersionProfile QOpenGLFunctions_4_4_Core::versionProfile()
-{
- QOpenGLVersionProfile v;
- v.setVersion(4, 4);
- v.setProfile(QSurfaceFormat::CoreProfile);
- return v;
-}
-
-QT_END_NAMESPACE
diff --git a/src/gui/opengl/qopenglfunctions_4_4_core.h b/src/gui/opengl/qopenglfunctions_4_4_core.h
deleted file mode 100644
index 1ad6f40214..0000000000
--- a/src/gui/opengl/qopenglfunctions_4_4_core.h
+++ /dev/null
@@ -1,3430 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2015 Klaralvdalens Datakonsult AB (KDAB)
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the QtGui module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-**
-** This file was generated by glgen version 0.1
-** Command line was: glgen
-**
-** glgen is Copyright (C) 2013 Klaralvdalens Datakonsult AB (KDAB)
-**
-** This is an auto-generated file.
-** Do not edit! All changes made to it will be lost.
-**
-****************************************************************************/
-
-#ifndef QOPENGLVERSIONFUNCTIONS_4_4_CORE_H
-#define QOPENGLVERSIONFUNCTIONS_4_4_CORE_H
-
-#include <QtGui/qtguiglobal.h>
-
-#if !defined(QT_NO_OPENGL) && !defined(QT_OPENGL_ES_2)
-
-#include <QtGui/QOpenGLVersionFunctions>
-#include <QtGui/qopenglcontext.h>
-
-// MemoryBarrier is a macro on some architectures on Windows
-#ifdef Q_OS_WIN
-#pragma push_macro("MemoryBarrier")
-#undef MemoryBarrier
-#endif
-
-QT_BEGIN_NAMESPACE
-
-class Q_GUI_EXPORT QOpenGLFunctions_4_4_Core : public QAbstractOpenGLFunctions
-{
-public:
- QOpenGLFunctions_4_4_Core();
- ~QOpenGLFunctions_4_4_Core();
-
- bool initializeOpenGLFunctions() override;
-
- // OpenGL 1.0 core functions
- void glViewport(GLint x, GLint y, GLsizei width, GLsizei height);
- void glDepthRange(GLdouble nearVal, GLdouble farVal);
- GLboolean glIsEnabled(GLenum cap);
- void glGetTexLevelParameteriv(GLenum target, GLint level, GLenum pname, GLint *params);
- void glGetTexLevelParameterfv(GLenum target, GLint level, GLenum pname, GLfloat *params);
- void glGetTexParameteriv(GLenum target, GLenum pname, GLint *params);
- void glGetTexParameterfv(GLenum target, GLenum pname, GLfloat *params);
- void glGetTexImage(GLenum target, GLint level, GLenum format, GLenum type, void *pixels);
- const GLubyte * glGetString(GLenum name);
- void glGetIntegerv(GLenum pname, GLint *data);
- void glGetFloatv(GLenum pname, GLfloat *data);
- GLenum glGetError();
- void glGetDoublev(GLenum pname, GLdouble *data);
- void glGetBooleanv(GLenum pname, GLboolean *data);
- void glReadPixels(GLint x, GLint y, GLsizei width, GLsizei height, GLenum format, GLenum type, void *pixels);
- void glReadBuffer(GLenum src);
- void glPixelStorei(GLenum pname, GLint param);
- void glPixelStoref(GLenum pname, GLfloat param);
- void glDepthFunc(GLenum func);
- void glStencilOp(GLenum fail, GLenum zfail, GLenum zpass);
- void glStencilFunc(GLenum func, GLint ref, GLuint mask);
- void glLogicOp(GLenum opcode);
- void glBlendFunc(GLenum sfactor, GLenum dfactor);
- void glFlush();
- void glFinish();
- void glEnable(GLenum cap);
- void glDisable(GLenum cap);
- void glDepthMask(GLboolean flag);
- void glColorMask(GLboolean red, GLboolean green, GLboolean blue, GLboolean alpha);
- void glStencilMask(GLuint mask);
- void glClearDepth(GLdouble depth);
- void glClearStencil(GLint s);
- void glClearColor(GLfloat red, GLfloat green, GLfloat blue, GLfloat alpha);
- void glClear(GLbitfield mask);
- void glDrawBuffer(GLenum buf);
- void glTexImage2D(GLenum target, GLint level, GLint internalformat, GLsizei width, GLsizei height, GLint border, GLenum format, GLenum type, const void *pixels);
- void glTexImage1D(GLenum target, GLint level, GLint internalformat, GLsizei width, GLint border, GLenum format, GLenum type, const void *pixels);
- void glTexParameteriv(GLenum target, GLenum pname, const GLint *params);
- void glTexParameteri(GLenum target, GLenum pname, GLint param);
- void glTexParameterfv(GLenum target, GLenum pname, const GLfloat *params);
- void glTexParameterf(GLenum target, GLenum pname, GLfloat param);
- void glScissor(GLint x, GLint y, GLsizei width, GLsizei height);
- void glPolygonMode(GLenum face, GLenum mode);
- void glPointSize(GLfloat size);
- void glLineWidth(GLfloat width);
- void glHint(GLenum target, GLenum mode);
- void glFrontFace(GLenum mode);
- void glCullFace(GLenum mode);
-
- // OpenGL 1.1 core functions
- GLboolean glIsTexture(GLuint texture);
- void glGenTextures(GLsizei n, GLuint *textures);
- void glDeleteTextures(GLsizei n, const GLuint *textures);
- void glBindTexture(GLenum target, GLuint texture);
- void glTexSubImage2D(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLenum type, const void *pixels);
- void glTexSubImage1D(GLenum target, GLint level, GLint xoffset, GLsizei width, GLenum format, GLenum type, const void *pixels);
- void glCopyTexSubImage2D(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint x, GLint y, GLsizei width, GLsizei height);
- void glCopyTexSubImage1D(GLenum target, GLint level, GLint xoffset, GLint x, GLint y, GLsizei width);
- void glCopyTexImage2D(GLenum target, GLint level, GLenum internalformat, GLint x, GLint y, GLsizei width, GLsizei height, GLint border);
- void glCopyTexImage1D(GLenum target, GLint level, GLenum internalformat, GLint x, GLint y, GLsizei width, GLint border);
- void glPolygonOffset(GLfloat factor, GLfloat units);
- void glDrawElements(GLenum mode, GLsizei count, GLenum type, const void *indices);
- void glDrawArrays(GLenum mode, GLint first, GLsizei count);
-
- // OpenGL 1.2 core functions
- void glBlendColor(GLfloat red, GLfloat green, GLfloat blue, GLfloat alpha);
- void glBlendEquation(GLenum mode);
- void glCopyTexSubImage3D(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLint x, GLint y, GLsizei width, GLsizei height);
- void glTexSubImage3D(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLenum type, const void *pixels);
- void glTexImage3D(GLenum target, GLint level, GLint internalformat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLenum format, GLenum type, const void *pixels);
- void glDrawRangeElements(GLenum mode, GLuint start, GLuint end, GLsizei count, GLenum type, const void *indices);
-
- // OpenGL 1.3 core functions
- void glGetCompressedTexImage(GLenum target, GLint level, void *img);
- void glCompressedTexSubImage1D(GLenum target, GLint level, GLint xoffset, GLsizei width, GLenum format, GLsizei imageSize, const void *data);
- void glCompressedTexSubImage2D(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLsizei imageSize, const void *data);
- void glCompressedTexSubImage3D(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLsizei imageSize, const void *data);
- void glCompressedTexImage1D(GLenum target, GLint level, GLenum internalformat, GLsizei width, GLint border, GLsizei imageSize, const void *data);
- void glCompressedTexImage2D(GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLint border, GLsizei imageSize, const void *data);
- void glCompressedTexImage3D(GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLsizei imageSize, const void *data);
- void glSampleCoverage(GLfloat value, GLboolean invert);
- void glActiveTexture(GLenum texture);
-
- // OpenGL 1.4 core functions
- void glPointParameteriv(GLenum pname, const GLint *params);
- void glPointParameteri(GLenum pname, GLint param);
- void glPointParameterfv(GLenum pname, const GLfloat *params);
- void glPointParameterf(GLenum pname, GLfloat param);
- void glMultiDrawElements(GLenum mode, const GLsizei *count, GLenum type, const void *const *indices, GLsizei drawcount);
- void glMultiDrawArrays(GLenum mode, const GLint *first, const GLsizei *count, GLsizei drawcount);
- void glBlendFuncSeparate(GLenum sfactorRGB, GLenum dfactorRGB, GLenum sfactorAlpha, GLenum dfactorAlpha);
-
- // OpenGL 1.5 core functions
- void glGetBufferPointerv(GLenum target, GLenum pname, void * *params);
- void glGetBufferParameteriv(GLenum target, GLenum pname, GLint *params);
- GLboolean glUnmapBuffer(GLenum target);
- void * glMapBuffer(GLenum target, GLenum access);
- void glGetBufferSubData(GLenum target, GLintptr offset, GLsizeiptr size, void *data);
- void glBufferSubData(GLenum target, GLintptr offset, GLsizeiptr size, const void *data);
- void glBufferData(GLenum target, GLsizeiptr size, const void *data, GLenum usage);
- GLboolean glIsBuffer(GLuint buffer);
- void glGenBuffers(GLsizei n, GLuint *buffers);
- void glDeleteBuffers(GLsizei n, const GLuint *buffers);
- void glBindBuffer(GLenum target, GLuint buffer);
- void glGetQueryObjectuiv(GLuint id, GLenum pname, GLuint *params);
- void glGetQueryObjectiv(GLuint id, GLenum pname, GLint *params);
- void glGetQueryiv(GLenum target, GLenum pname, GLint *params);
- void glEndQuery(GLenum target);
- void glBeginQuery(GLenum target, GLuint id);
- GLboolean glIsQuery(GLuint id);
- void glDeleteQueries(GLsizei n, const GLuint *ids);
- void glGenQueries(GLsizei n, GLuint *ids);
-
- // OpenGL 2.0 core functions
- void glVertexAttribPointer(GLuint index, GLint size, GLenum type, GLboolean normalized, GLsizei stride, const void *pointer);
- void glVertexAttrib4usv(GLuint index, const GLushort *v);
- void glVertexAttrib4uiv(GLuint index, const GLuint *v);
- void glVertexAttrib4ubv(GLuint index, const GLubyte *v);
- void glVertexAttrib4sv(GLuint index, const GLshort *v);
- void glVertexAttrib4s(GLuint index, GLshort x, GLshort y, GLshort z, GLshort w);
- void glVertexAttrib4iv(GLuint index, const GLint *v);
- void glVertexAttrib4fv(GLuint index, const GLfloat *v);
- void glVertexAttrib4f(GLuint index, GLfloat x, GLfloat y, GLfloat z, GLfloat w);
- void glVertexAttrib4dv(GLuint index, const GLdouble *v);
- void glVertexAttrib4d(GLuint index, GLdouble x, GLdouble y, GLdouble z, GLdouble w);
- void glVertexAttrib4bv(GLuint index, const GLbyte *v);
- void glVertexAttrib4Nusv(GLuint index, const GLushort *v);
- void glVertexAttrib4Nuiv(GLuint index, const GLuint *v);
- void glVertexAttrib4Nubv(GLuint index, const GLubyte *v);
- void glVertexAttrib4Nub(GLuint index, GLubyte x, GLubyte y, GLubyte z, GLubyte w);
- void glVertexAttrib4Nsv(GLuint index, const GLshort *v);
- void glVertexAttrib4Niv(GLuint index, const GLint *v);
- void glVertexAttrib4Nbv(GLuint index, const GLbyte *v);
- void glVertexAttrib3sv(GLuint index, const GLshort *v);
- void glVertexAttrib3s(GLuint index, GLshort x, GLshort y, GLshort z);
- void glVertexAttrib3fv(GLuint index, const GLfloat *v);
- void glVertexAttrib3f(GLuint index, GLfloat x, GLfloat y, GLfloat z);
- void glVertexAttrib3dv(GLuint index, const GLdouble *v);
- void glVertexAttrib3d(GLuint index, GLdouble x, GLdouble y, GLdouble z);
- void glVertexAttrib2sv(GLuint index, const GLshort *v);
- void glVertexAttrib2s(GLuint index, GLshort x, GLshort y);
- void glVertexAttrib2fv(GLuint index, const GLfloat *v);
- void glVertexAttrib2f(GLuint index, GLfloat x, GLfloat y);
- void glVertexAttrib2dv(GLuint index, const GLdouble *v);
- void glVertexAttrib2d(GLuint index, GLdouble x, GLdouble y);
- void glVertexAttrib1sv(GLuint index, const GLshort *v);
- void glVertexAttrib1s(GLuint index, GLshort x);
- void glVertexAttrib1fv(GLuint index, const GLfloat *v);
- void glVertexAttrib1f(GLuint index, GLfloat x);
- void glVertexAttrib1dv(GLuint index, const GLdouble *v);
- void glVertexAttrib1d(GLuint index, GLdouble x);
- void glValidateProgram(GLuint program);
- void glUniformMatrix4fv(GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
- void glUniformMatrix3fv(GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
- void glUniformMatrix2fv(GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
- void glUniform4iv(GLint location, GLsizei count, const GLint *value);
- void glUniform3iv(GLint location, GLsizei count, const GLint *value);
- void glUniform2iv(GLint location, GLsizei count, const GLint *value);
- void glUniform1iv(GLint location, GLsizei count, const GLint *value);
- void glUniform4fv(GLint location, GLsizei count, const GLfloat *value);
- void glUniform3fv(GLint location, GLsizei count, const GLfloat *value);
- void glUniform2fv(GLint location, GLsizei count, const GLfloat *value);
- void glUniform1fv(GLint location, GLsizei count, const GLfloat *value);
- void glUniform4i(GLint location, GLint v0, GLint v1, GLint v2, GLint v3);
- void glUniform3i(GLint location, GLint v0, GLint v1, GLint v2);
- void glUniform2i(GLint location, GLint v0, GLint v1);
- void glUniform1i(GLint location, GLint v0);
- void glUniform4f(GLint location, GLfloat v0, GLfloat v1, GLfloat v2, GLfloat v3);
- void glUniform3f(GLint location, GLfloat v0, GLfloat v1, GLfloat v2);
- void glUniform2f(GLint location, GLfloat v0, GLfloat v1);
- void glUniform1f(GLint location, GLfloat v0);
- void glUseProgram(GLuint program);
- void glShaderSource(GLuint shader, GLsizei count, const GLchar* const *string, const GLint *length);
- void glLinkProgram(GLuint program);
- GLboolean glIsShader(GLuint shader);
- GLboolean glIsProgram(GLuint program);
- void glGetVertexAttribPointerv(GLuint index, GLenum pname, void * *pointer);
- void glGetVertexAttribiv(GLuint index, GLenum pname, GLint *params);
- void glGetVertexAttribfv(GLuint index, GLenum pname, GLfloat *params);
- void glGetVertexAttribdv(GLuint index, GLenum pname, GLdouble *params);
- void glGetUniformiv(GLuint program, GLint location, GLint *params);
- void glGetUniformfv(GLuint program, GLint location, GLfloat *params);
- GLint glGetUniformLocation(GLuint program, const GLchar *name);
- void glGetShaderSource(GLuint shader, GLsizei bufSize, GLsizei *length, GLchar *source);
- void glGetShaderInfoLog(GLuint shader, GLsizei bufSize, GLsizei *length, GLchar *infoLog);
- void glGetShaderiv(GLuint shader, GLenum pname, GLint *params);
- void glGetProgramInfoLog(GLuint program, GLsizei bufSize, GLsizei *length, GLchar *infoLog);
- void glGetProgramiv(GLuint program, GLenum pname, GLint *params);
- GLint glGetAttribLocation(GLuint program, const GLchar *name);
- void glGetAttachedShaders(GLuint program, GLsizei maxCount, GLsizei *count, GLuint *shaders);
- void glGetActiveUniform(GLuint program, GLuint index, GLsizei bufSize, GLsizei *length, GLint *size, GLenum *type, GLchar *name);
- void glGetActiveAttrib(GLuint program, GLuint index, GLsizei bufSize, GLsizei *length, GLint *size, GLenum *type, GLchar *name);
- void glEnableVertexAttribArray(GLuint index);
- void glDisableVertexAttribArray(GLuint index);
- void glDetachShader(GLuint program, GLuint shader);
- void glDeleteShader(GLuint shader);
- void glDeleteProgram(GLuint program);
- GLuint glCreateShader(GLenum type);
- GLuint glCreateProgram();
- void glCompileShader(GLuint shader);
- void glBindAttribLocation(GLuint program, GLuint index, const GLchar *name);
- void glAttachShader(GLuint program, GLuint shader);
- void glStencilMaskSeparate(GLenum face, GLuint mask);
- void glStencilFuncSeparate(GLenum face, GLenum func, GLint ref, GLuint mask);
- void glStencilOpSeparate(GLenum face, GLenum sfail, GLenum dpfail, GLenum dppass);
- void glDrawBuffers(GLsizei n, const GLenum *bufs);
- void glBlendEquationSeparate(GLenum modeRGB, GLenum modeAlpha);
-
- // OpenGL 2.1 core functions
- void glUniformMatrix4x3fv(GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
- void glUniformMatrix3x4fv(GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
- void glUniformMatrix4x2fv(GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
- void glUniformMatrix2x4fv(GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
- void glUniformMatrix3x2fv(GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
- void glUniformMatrix2x3fv(GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
-
- // OpenGL 3.0 core functions
- GLboolean glIsVertexArray(GLuint array);
- void glGenVertexArrays(GLsizei n, GLuint *arrays);
- void glDeleteVertexArrays(GLsizei n, const GLuint *arrays);
- void glBindVertexArray(GLuint array);
- void glFlushMappedBufferRange(GLenum target, GLintptr offset, GLsizeiptr length);
- void * glMapBufferRange(GLenum target, GLintptr offset, GLsizeiptr length, GLbitfield access);
- void glFramebufferTextureLayer(GLenum target, GLenum attachment, GLuint texture, GLint level, GLint layer);
- void glRenderbufferStorageMultisample(GLenum target, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height);
- void glBlitFramebuffer(GLint srcX0, GLint srcY0, GLint srcX1, GLint srcY1, GLint dstX0, GLint dstY0, GLint dstX1, GLint dstY1, GLbitfield mask, GLenum filter);
- void glGenerateMipmap(GLenum target);
- void glGetFramebufferAttachmentParameteriv(GLenum target, GLenum attachment, GLenum pname, GLint *params);
- void glFramebufferRenderbuffer(GLenum target, GLenum attachment, GLenum renderbuffertarget, GLuint renderbuffer);
- void glFramebufferTexture3D(GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level, GLint zoffset);
- void glFramebufferTexture2D(GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level);
- void glFramebufferTexture1D(GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level);
- GLenum glCheckFramebufferStatus(GLenum target);
- void glGenFramebuffers(GLsizei n, GLuint *framebuffers);
- void glDeleteFramebuffers(GLsizei n, const GLuint *framebuffers);
- void glBindFramebuffer(GLenum target, GLuint framebuffer);
- GLboolean glIsFramebuffer(GLuint framebuffer);
- void glGetRenderbufferParameteriv(GLenum target, GLenum pname, GLint *params);
- void glRenderbufferStorage(GLenum target, GLenum internalformat, GLsizei width, GLsizei height);
- void glGenRenderbuffers(GLsizei n, GLuint *renderbuffers);
- void glDeleteRenderbuffers(GLsizei n, const GLuint *renderbuffers);
- void glBindRenderbuffer(GLenum target, GLuint renderbuffer);
- GLboolean glIsRenderbuffer(GLuint renderbuffer);
- const GLubyte * glGetStringi(GLenum name, GLuint index);
- void glClearBufferfi(GLenum buffer, GLint drawbuffer, GLfloat depth, GLint stencil);
- void glClearBufferfv(GLenum buffer, GLint drawbuffer, const GLfloat *value);
- void glClearBufferuiv(GLenum buffer, GLint drawbuffer, const GLuint *value);
- void glClearBufferiv(GLenum buffer, GLint drawbuffer, const GLint *value);
- void glGetTexParameterIuiv(GLenum target, GLenum pname, GLuint *params);
- void glGetTexParameterIiv(GLenum target, GLenum pname, GLint *params);
- void glTexParameterIuiv(GLenum target, GLenum pname, const GLuint *params);
- void glTexParameterIiv(GLenum target, GLenum pname, const GLint *params);
- void glUniform4uiv(GLint location, GLsizei count, const GLuint *value);
- void glUniform3uiv(GLint location, GLsizei count, const GLuint *value);
- void glUniform2uiv(GLint location, GLsizei count, const GLuint *value);
- void glUniform1uiv(GLint location, GLsizei count, const GLuint *value);
- void glUniform4ui(GLint location, GLuint v0, GLuint v1, GLuint v2, GLuint v3);
- void glUniform3ui(GLint location, GLuint v0, GLuint v1, GLuint v2);
- void glUniform2ui(GLint location, GLuint v0, GLuint v1);
- void glUniform1ui(GLint location, GLuint v0);
- GLint glGetFragDataLocation(GLuint program, const GLchar *name);
- void glBindFragDataLocation(GLuint program, GLuint color, const GLchar *name);
- void glGetUniformuiv(GLuint program, GLint location, GLuint *params);
- void glVertexAttribI4usv(GLuint index, const GLushort *v);
- void glVertexAttribI4ubv(GLuint index, const GLubyte *v);
- void glVertexAttribI4sv(GLuint index, const GLshort *v);
- void glVertexAttribI4bv(GLuint index, const GLbyte *v);
- void glVertexAttribI4uiv(GLuint index, const GLuint *v);
- void glVertexAttribI3uiv(GLuint index, const GLuint *v);
- void glVertexAttribI2uiv(GLuint index, const GLuint *v);
- void glVertexAttribI1uiv(GLuint index, const GLuint *v);
- void glVertexAttribI4iv(GLuint index, const GLint *v);
- void glVertexAttribI3iv(GLuint index, const GLint *v);
- void glVertexAttribI2iv(GLuint index, const GLint *v);
- void glVertexAttribI1iv(GLuint index, const GLint *v);
- void glVertexAttribI4ui(GLuint index, GLuint x, GLuint y, GLuint z, GLuint w);
- void glVertexAttribI3ui(GLuint index, GLuint x, GLuint y, GLuint z);
- void glVertexAttribI2ui(GLuint index, GLuint x, GLuint y);
- void glVertexAttribI1ui(GLuint index, GLuint x);
- void glVertexAttribI4i(GLuint index, GLint x, GLint y, GLint z, GLint w);
- void glVertexAttribI3i(GLuint index, GLint x, GLint y, GLint z);
- void glVertexAttribI2i(GLuint index, GLint x, GLint y);
- void glVertexAttribI1i(GLuint index, GLint x);
- void glGetVertexAttribIuiv(GLuint index, GLenum pname, GLuint *params);
- void glGetVertexAttribIiv(GLuint index, GLenum pname, GLint *params);
- void glVertexAttribIPointer(GLuint index, GLint size, GLenum type, GLsizei stride, const void *pointer);
- void glEndConditionalRender();
- void glBeginConditionalRender(GLuint id, GLenum mode);
- void glClampColor(GLenum target, GLenum clamp);
- void glGetTransformFeedbackVarying(GLuint program, GLuint index, GLsizei bufSize, GLsizei *length, GLsizei *size, GLenum *type, GLchar *name);
- void glTransformFeedbackVaryings(GLuint program, GLsizei count, const GLchar* const *varyings, GLenum bufferMode);
- void glBindBufferBase(GLenum target, GLuint index, GLuint buffer);
- void glBindBufferRange(GLenum target, GLuint index, GLuint buffer, GLintptr offset, GLsizeiptr size);
- void glEndTransformFeedback();
- void glBeginTransformFeedback(GLenum primitiveMode);
- GLboolean glIsEnabledi(GLenum target, GLuint index);
- void glDisablei(GLenum target, GLuint index);
- void glEnablei(GLenum target, GLuint index);
- void glGetIntegeri_v(GLenum target, GLuint index, GLint *data);
- void glGetBooleani_v(GLenum target, GLuint index, GLboolean *data);
- void glColorMaski(GLuint index, GLboolean r, GLboolean g, GLboolean b, GLboolean a);
-
- // OpenGL 3.1 core functions
- void glUniformBlockBinding(GLuint program, GLuint uniformBlockIndex, GLuint uniformBlockBinding);
- void glGetActiveUniformBlockName(GLuint program, GLuint uniformBlockIndex, GLsizei bufSize, GLsizei *length, GLchar *uniformBlockName);
- void glGetActiveUniformBlockiv(GLuint program, GLuint uniformBlockIndex, GLenum pname, GLint *params);
- GLuint glGetUniformBlockIndex(GLuint program, const GLchar *uniformBlockName);
- void glGetActiveUniformName(GLuint program, GLuint uniformIndex, GLsizei bufSize, GLsizei *length, GLchar *uniformName);
- void glGetActiveUniformsiv(GLuint program, GLsizei uniformCount, const GLuint *uniformIndices, GLenum pname, GLint *params);
- void glGetUniformIndices(GLuint program, GLsizei uniformCount, const GLchar *const *uniformNames, GLuint *uniformIndices);
- void glCopyBufferSubData(GLenum readTarget, GLenum writeTarget, GLintptr readOffset, GLintptr writeOffset, GLsizeiptr size);
- void glPrimitiveRestartIndex(GLuint index);
- void glTexBuffer(GLenum target, GLenum internalformat, GLuint buffer);
- void glDrawElementsInstanced(GLenum mode, GLsizei count, GLenum type, const void *indices, GLsizei instancecount);
- void glDrawArraysInstanced(GLenum mode, GLint first, GLsizei count, GLsizei instancecount);
-
- // OpenGL 3.2 core functions
- void glSampleMaski(GLuint maskNumber, GLbitfield mask);
- void glGetMultisamplefv(GLenum pname, GLuint index, GLfloat *val);
- void glTexImage3DMultisample(GLenum target, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth, GLboolean fixedsamplelocations);
- void glTexImage2DMultisample(GLenum target, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height, GLboolean fixedsamplelocations);
- void glFramebufferTexture(GLenum target, GLenum attachment, GLuint texture, GLint level);
- void glGetBufferParameteri64v(GLenum target, GLenum pname, GLint64 *params);
- void glGetInteger64i_v(GLenum target, GLuint index, GLint64 *data);
- void glGetSynciv(GLsync sync, GLenum pname, GLsizei bufSize, GLsizei *length, GLint *values);
- void glGetInteger64v(GLenum pname, GLint64 *data);
- void glWaitSync(GLsync sync, GLbitfield flags, GLuint64 timeout);
- GLenum glClientWaitSync(GLsync sync, GLbitfield flags, GLuint64 timeout);
- void glDeleteSync(GLsync sync);
- GLboolean glIsSync(GLsync sync);
- GLsync glFenceSync(GLenum condition, GLbitfield flags);
- void glProvokingVertex(GLenum mode);
- void glMultiDrawElementsBaseVertex(GLenum mode, const GLsizei *count, GLenum type, const void *const *indices, GLsizei drawcount, const GLint *basevertex);
- void glDrawElementsInstancedBaseVertex(GLenum mode, GLsizei count, GLenum type, const void *indices, GLsizei instancecount, GLint basevertex);
- void glDrawRangeElementsBaseVertex(GLenum mode, GLuint start, GLuint end, GLsizei count, GLenum type, const void *indices, GLint basevertex);
- void glDrawElementsBaseVertex(GLenum mode, GLsizei count, GLenum type, const void *indices, GLint basevertex);
-
- // OpenGL 3.3 core functions
- void glVertexAttribP4uiv(GLuint index, GLenum type, GLboolean normalized, const GLuint *value);
- void glVertexAttribP4ui(GLuint index, GLenum type, GLboolean normalized, GLuint value);
- void glVertexAttribP3uiv(GLuint index, GLenum type, GLboolean normalized, const GLuint *value);
- void glVertexAttribP3ui(GLuint index, GLenum type, GLboolean normalized, GLuint value);
- void glVertexAttribP2uiv(GLuint index, GLenum type, GLboolean normalized, const GLuint *value);
- void glVertexAttribP2ui(GLuint index, GLenum type, GLboolean normalized, GLuint value);
- void glVertexAttribP1uiv(GLuint index, GLenum type, GLboolean normalized, const GLuint *value);
- void glVertexAttribP1ui(GLuint index, GLenum type, GLboolean normalized, GLuint value);
- void glVertexAttribDivisor(GLuint index, GLuint divisor);
- void glGetQueryObjectui64v(GLuint id, GLenum pname, GLuint64 *params);
- void glGetQueryObjecti64v(GLuint id, GLenum pname, GLint64 *params);
- void glQueryCounter(GLuint id, GLenum target);
- void glGetSamplerParameterIuiv(GLuint sampler, GLenum pname, GLuint *params);
- void glGetSamplerParameterfv(GLuint sampler, GLenum pname, GLfloat *params);
- void glGetSamplerParameterIiv(GLuint sampler, GLenum pname, GLint *params);
- void glGetSamplerParameteriv(GLuint sampler, GLenum pname, GLint *params);
- void glSamplerParameterIuiv(GLuint sampler, GLenum pname, const GLuint *param);
- void glSamplerParameterIiv(GLuint sampler, GLenum pname, const GLint *param);
- void glSamplerParameterfv(GLuint sampler, GLenum pname, const GLfloat *param);
- void glSamplerParameterf(GLuint sampler, GLenum pname, GLfloat param);
- void glSamplerParameteriv(GLuint sampler, GLenum pname, const GLint *param);
- void glSamplerParameteri(GLuint sampler, GLenum pname, GLint param);
- void glBindSampler(GLuint unit, GLuint sampler);
- GLboolean glIsSampler(GLuint sampler);
- void glDeleteSamplers(GLsizei count, const GLuint *samplers);
- void glGenSamplers(GLsizei count, GLuint *samplers);
- GLint glGetFragDataIndex(GLuint program, const GLchar *name);
- void glBindFragDataLocationIndexed(GLuint program, GLuint colorNumber, GLuint index, const GLchar *name);
-
- // OpenGL 4.0 core functions
- void glGetQueryIndexediv(GLenum target, GLuint index, GLenum pname, GLint *params);
- void glEndQueryIndexed(GLenum target, GLuint index);
- void glBeginQueryIndexed(GLenum target, GLuint index, GLuint id);
- void glDrawTransformFeedbackStream(GLenum mode, GLuint id, GLuint stream);
- void glDrawTransformFeedback(GLenum mode, GLuint id);
- void glResumeTransformFeedback();
- void glPauseTransformFeedback();
- GLboolean glIsTransformFeedback(GLuint id);
- void glGenTransformFeedbacks(GLsizei n, GLuint *ids);
- void glDeleteTransformFeedbacks(GLsizei n, const GLuint *ids);
- void glBindTransformFeedback(GLenum target, GLuint id);
- void glPatchParameterfv(GLenum pname, const GLfloat *values);
- void glPatchParameteri(GLenum pname, GLint value);
- void glGetProgramStageiv(GLuint program, GLenum shadertype, GLenum pname, GLint *values);
- void glGetUniformSubroutineuiv(GLenum shadertype, GLint location, GLuint *params);
- void glUniformSubroutinesuiv(GLenum shadertype, GLsizei count, const GLuint *indices);
- void glGetActiveSubroutineName(GLuint program, GLenum shadertype, GLuint index, GLsizei bufsize, GLsizei *length, GLchar *name);
- void glGetActiveSubroutineUniformName(GLuint program, GLenum shadertype, GLuint index, GLsizei bufsize, GLsizei *length, GLchar *name);
- void glGetActiveSubroutineUniformiv(GLuint program, GLenum shadertype, GLuint index, GLenum pname, GLint *values);
- GLuint glGetSubroutineIndex(GLuint program, GLenum shadertype, const GLchar *name);
- GLint glGetSubroutineUniformLocation(GLuint program, GLenum shadertype, const GLchar *name);
- void glGetUniformdv(GLuint program, GLint location, GLdouble *params);
- void glUniformMatrix4x3dv(GLint location, GLsizei count, GLboolean transpose, const GLdouble *value);
- void glUniformMatrix4x2dv(GLint location, GLsizei count, GLboolean transpose, const GLdouble *value);
- void glUniformMatrix3x4dv(GLint location, GLsizei count, GLboolean transpose, const GLdouble *value);
- void glUniformMatrix3x2dv(GLint location, GLsizei count, GLboolean transpose, const GLdouble *value);
- void glUniformMatrix2x4dv(GLint location, GLsizei count, GLboolean transpose, const GLdouble *value);
- void glUniformMatrix2x3dv(GLint location, GLsizei count, GLboolean transpose, const GLdouble *value);
- void glUniformMatrix4dv(GLint location, GLsizei count, GLboolean transpose, const GLdouble *value);
- void glUniformMatrix3dv(GLint location, GLsizei count, GLboolean transpose, const GLdouble *value);
- void glUniformMatrix2dv(GLint location, GLsizei count, GLboolean transpose, const GLdouble *value);
- void glUniform4dv(GLint location, GLsizei count, const GLdouble *value);
- void glUniform3dv(GLint location, GLsizei count, const GLdouble *value);
- void glUniform2dv(GLint location, GLsizei count, const GLdouble *value);
- void glUniform1dv(GLint location, GLsizei count, const GLdouble *value);
- void glUniform4d(GLint location, GLdouble x, GLdouble y, GLdouble z, GLdouble w);
- void glUniform3d(GLint location, GLdouble x, GLdouble y, GLdouble z);
- void glUniform2d(GLint location, GLdouble x, GLdouble y);
- void glUniform1d(GLint location, GLdouble x);
- void glDrawElementsIndirect(GLenum mode, GLenum type, const void *indirect);
- void glDrawArraysIndirect(GLenum mode, const void *indirect);
- void glBlendFuncSeparatei(GLuint buf, GLenum srcRGB, GLenum dstRGB, GLenum srcAlpha, GLenum dstAlpha);
- void glBlendFunci(GLuint buf, GLenum src, GLenum dst);
- void glBlendEquationSeparatei(GLuint buf, GLenum modeRGB, GLenum modeAlpha);
- void glBlendEquationi(GLuint buf, GLenum mode);
- void glMinSampleShading(GLfloat value);
-
- // OpenGL 4.1 core functions
- void glGetDoublei_v(GLenum target, GLuint index, GLdouble *data);
- void glGetFloati_v(GLenum target, GLuint index, GLfloat *data);
- void glDepthRangeIndexed(GLuint index, GLdouble n, GLdouble f);
- void glDepthRangeArrayv(GLuint first, GLsizei count, const GLdouble *v);
- void glScissorIndexedv(GLuint index, const GLint *v);
- void glScissorIndexed(GLuint index, GLint left, GLint bottom, GLsizei width, GLsizei height);
- void glScissorArrayv(GLuint first, GLsizei count, const GLint *v);
- void glViewportIndexedfv(GLuint index, const GLfloat *v);
- void glViewportIndexedf(GLuint index, GLfloat x, GLfloat y, GLfloat w, GLfloat h);
- void glViewportArrayv(GLuint first, GLsizei count, const GLfloat *v);
- void glGetVertexAttribLdv(GLuint index, GLenum pname, GLdouble *params);
- void glVertexAttribLPointer(GLuint index, GLint size, GLenum type, GLsizei stride, const void *pointer);
- void glVertexAttribL4dv(GLuint index, const GLdouble *v);
- void glVertexAttribL3dv(GLuint index, const GLdouble *v);
- void glVertexAttribL2dv(GLuint index, const GLdouble *v);
- void glVertexAttribL1dv(GLuint index, const GLdouble *v);
- void glVertexAttribL4d(GLuint index, GLdouble x, GLdouble y, GLdouble z, GLdouble w);
- void glVertexAttribL3d(GLuint index, GLdouble x, GLdouble y, GLdouble z);
- void glVertexAttribL2d(GLuint index, GLdouble x, GLdouble y);
- void glVertexAttribL1d(GLuint index, GLdouble x);
- void glGetProgramPipelineInfoLog(GLuint pipeline, GLsizei bufSize, GLsizei *length, GLchar *infoLog);
- void glValidateProgramPipeline(GLuint pipeline);
- void glProgramUniformMatrix4x3dv(GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLdouble *value);
- void glProgramUniformMatrix3x4dv(GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLdouble *value);
- void glProgramUniformMatrix4x2dv(GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLdouble *value);
- void glProgramUniformMatrix2x4dv(GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLdouble *value);
- void glProgramUniformMatrix3x2dv(GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLdouble *value);
- void glProgramUniformMatrix2x3dv(GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLdouble *value);
- void glProgramUniformMatrix4x3fv(GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
- void glProgramUniformMatrix3x4fv(GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
- void glProgramUniformMatrix4x2fv(GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
- void glProgramUniformMatrix2x4fv(GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
- void glProgramUniformMatrix3x2fv(GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
- void glProgramUniformMatrix2x3fv(GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
- void glProgramUniformMatrix4dv(GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLdouble *value);
- void glProgramUniformMatrix3dv(GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLdouble *value);
- void glProgramUniformMatrix2dv(GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLdouble *value);
- void glProgramUniformMatrix4fv(GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
- void glProgramUniformMatrix3fv(GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
- void glProgramUniformMatrix2fv(GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
- void glProgramUniform4uiv(GLuint program, GLint location, GLsizei count, const GLuint *value);
- void glProgramUniform4ui(GLuint program, GLint location, GLuint v0, GLuint v1, GLuint v2, GLuint v3);
- void glProgramUniform4dv(GLuint program, GLint location, GLsizei count, const GLdouble *value);
- void glProgramUniform4d(GLuint program, GLint location, GLdouble v0, GLdouble v1, GLdouble v2, GLdouble v3);
- void glProgramUniform4fv(GLuint program, GLint location, GLsizei count, const GLfloat *value);
- void glProgramUniform4f(GLuint program, GLint location, GLfloat v0, GLfloat v1, GLfloat v2, GLfloat v3);
- void glProgramUniform4iv(GLuint program, GLint location, GLsizei count, const GLint *value);
- void glProgramUniform4i(GLuint program, GLint location, GLint v0, GLint v1, GLint v2, GLint v3);
- void glProgramUniform3uiv(GLuint program, GLint location, GLsizei count, const GLuint *value);
- void glProgramUniform3ui(GLuint program, GLint location, GLuint v0, GLuint v1, GLuint v2);
- void glProgramUniform3dv(GLuint program, GLint location, GLsizei count, const GLdouble *value);
- void glProgramUniform3d(GLuint program, GLint location, GLdouble v0, GLdouble v1, GLdouble v2);
- void glProgramUniform3fv(GLuint program, GLint location, GLsizei count, const GLfloat *value);
- void glProgramUniform3f(GLuint program, GLint location, GLfloat v0, GLfloat v1, GLfloat v2);
- void glProgramUniform3iv(GLuint program, GLint location, GLsizei count, const GLint *value);
- void glProgramUniform3i(GLuint program, GLint location, GLint v0, GLint v1, GLint v2);
- void glProgramUniform2uiv(GLuint program, GLint location, GLsizei count, const GLuint *value);
- void glProgramUniform2ui(GLuint program, GLint location, GLuint v0, GLuint v1);
- void glProgramUniform2dv(GLuint program, GLint location, GLsizei count, const GLdouble *value);
- void glProgramUniform2d(GLuint program, GLint location, GLdouble v0, GLdouble v1);
- void glProgramUniform2fv(GLuint program, GLint location, GLsizei count, const GLfloat *value);
- void glProgramUniform2f(GLuint program, GLint location, GLfloat v0, GLfloat v1);
- void glProgramUniform2iv(GLuint program, GLint location, GLsizei count, const GLint *value);
- void glProgramUniform2i(GLuint program, GLint location, GLint v0, GLint v1);
- void glProgramUniform1uiv(GLuint program, GLint location, GLsizei count, const GLuint *value);
- void glProgramUniform1ui(GLuint program, GLint location, GLuint v0);
- void glProgramUniform1dv(GLuint program, GLint location, GLsizei count, const GLdouble *value);
- void glProgramUniform1d(GLuint program, GLint location, GLdouble v0);
- void glProgramUniform1fv(GLuint program, GLint location, GLsizei count, const GLfloat *value);
- void glProgramUniform1f(GLuint program, GLint location, GLfloat v0);
- void glProgramUniform1iv(GLuint program, GLint location, GLsizei count, const GLint *value);
- void glProgramUniform1i(GLuint program, GLint location, GLint v0);
- void glGetProgramPipelineiv(GLuint pipeline, GLenum pname, GLint *params);
- GLboolean glIsProgramPipeline(GLuint pipeline);
- void glGenProgramPipelines(GLsizei n, GLuint *pipelines);
- void glDeleteProgramPipelines(GLsizei n, const GLuint *pipelines);
- void glBindProgramPipeline(GLuint pipeline);
- GLuint glCreateShaderProgramv(GLenum type, GLsizei count, const GLchar* const *strings);
- void glActiveShaderProgram(GLuint pipeline, GLuint program);
- void glUseProgramStages(GLuint pipeline, GLbitfield stages, GLuint program);
- void glProgramParameteri(GLuint program, GLenum pname, GLint value);
- void glProgramBinary(GLuint program, GLenum binaryFormat, const void *binary, GLsizei length);
- void glGetProgramBinary(GLuint program, GLsizei bufSize, GLsizei *length, GLenum *binaryFormat, void *binary);
- void glClearDepthf(GLfloat dd);
- void glDepthRangef(GLfloat n, GLfloat f);
- void glGetShaderPrecisionFormat(GLenum shadertype, GLenum precisiontype, GLint *range, GLint *precision);
- void glShaderBinary(GLsizei count, const GLuint *shaders, GLenum binaryformat, const void *binary, GLsizei length);
- void glReleaseShaderCompiler();
-
- // OpenGL 4.2 core functions
- void glDrawTransformFeedbackStreamInstanced(GLenum mode, GLuint id, GLuint stream, GLsizei instancecount);
- void glDrawTransformFeedbackInstanced(GLenum mode, GLuint id, GLsizei instancecount);
- void glTexStorage3D(GLenum target, GLsizei levels, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth);
- void glTexStorage2D(GLenum target, GLsizei levels, GLenum internalformat, GLsizei width, GLsizei height);
- void glTexStorage1D(GLenum target, GLsizei levels, GLenum internalformat, GLsizei width);
- void glMemoryBarrier(GLbitfield barriers);
- void glBindImageTexture(GLuint unit, GLuint texture, GLint level, GLboolean layered, GLint layer, GLenum access, GLenum format);
- void glGetActiveAtomicCounterBufferiv(GLuint program, GLuint bufferIndex, GLenum pname, GLint *params);
- void glGetInternalformativ(GLenum target, GLenum internalformat, GLenum pname, GLsizei bufSize, GLint *params);
- void glDrawElementsInstancedBaseVertexBaseInstance(GLenum mode, GLsizei count, GLenum type, const void *indices, GLsizei instancecount, GLint basevertex, GLuint baseinstance);
- void glDrawElementsInstancedBaseInstance(GLenum mode, GLsizei count, GLenum type, const void *indices, GLsizei instancecount, GLuint baseinstance);
- void glDrawArraysInstancedBaseInstance(GLenum mode, GLint first, GLsizei count, GLsizei instancecount, GLuint baseinstance);
-
- // OpenGL 4.3 core functions
- void glGetObjectPtrLabel(const void *ptr, GLsizei bufSize, GLsizei *length, GLchar *label);
- void glObjectPtrLabel(const void *ptr, GLsizei length, const GLchar *label);
- void glGetObjectLabel(GLenum identifier, GLuint name, GLsizei bufSize, GLsizei *length, GLchar *label);
- void glObjectLabel(GLenum identifier, GLuint name, GLsizei length, const GLchar *label);
- void glPopDebugGroup();
- void glPushDebugGroup(GLenum source, GLuint id, GLsizei length, const GLchar *message);
- GLuint glGetDebugMessageLog(GLuint count, GLsizei bufSize, GLenum *sources, GLenum *types, GLuint *ids, GLenum *severities, GLsizei *lengths, GLchar *messageLog);
- void glDebugMessageCallback(GLDEBUGPROC callback, const void *userParam);
- void glDebugMessageInsert(GLenum source, GLenum type, GLuint id, GLenum severity, GLsizei length, const GLchar *buf);
- void glDebugMessageControl(GLenum source, GLenum type, GLenum severity, GLsizei count, const GLuint *ids, GLboolean enabled);
- void glVertexBindingDivisor(GLuint bindingindex, GLuint divisor);
- void glVertexAttribBinding(GLuint attribindex, GLuint bindingindex);
- void glVertexAttribLFormat(GLuint attribindex, GLint size, GLenum type, GLuint relativeoffset);
- void glVertexAttribIFormat(GLuint attribindex, GLint size, GLenum type, GLuint relativeoffset);
- void glVertexAttribFormat(GLuint attribindex, GLint size, GLenum type, GLboolean normalized, GLuint relativeoffset);
- void glBindVertexBuffer(GLuint bindingindex, GLuint buffer, GLintptr offset, GLsizei stride);
- void glTextureView(GLuint texture, GLenum target, GLuint origtexture, GLenum internalformat, GLuint minlevel, GLuint numlevels, GLuint minlayer, GLuint numlayers);
- void glTexStorage3DMultisample(GLenum target, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth, GLboolean fixedsamplelocations);
- void glTexStorage2DMultisample(GLenum target, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height, GLboolean fixedsamplelocations);
- void glTexBufferRange(GLenum target, GLenum internalformat, GLuint buffer, GLintptr offset, GLsizeiptr size);
- void glShaderStorageBlockBinding(GLuint program, GLuint storageBlockIndex, GLuint storageBlockBinding);
- GLint glGetProgramResourceLocationIndex(GLuint program, GLenum programInterface, const GLchar *name);
- GLint glGetProgramResourceLocation(GLuint program, GLenum programInterface, const GLchar *name);
- void glGetProgramResourceiv(GLuint program, GLenum programInterface, GLuint index, GLsizei propCount, const GLenum *props, GLsizei bufSize, GLsizei *length, GLint *params);
- void glGetProgramResourceName(GLuint program, GLenum programInterface, GLuint index, GLsizei bufSize, GLsizei *length, GLchar *name);
- GLuint glGetProgramResourceIndex(GLuint program, GLenum programInterface, const GLchar *name);
- void glGetProgramInterfaceiv(GLuint program, GLenum programInterface, GLenum pname, GLint *params);
- void glMultiDrawElementsIndirect(GLenum mode, GLenum type, const void *indirect, GLsizei drawcount, GLsizei stride);
- void glMultiDrawArraysIndirect(GLenum mode, const void *indirect, GLsizei drawcount, GLsizei stride);
- void glInvalidateSubFramebuffer(GLenum target, GLsizei numAttachments, const GLenum *attachments, GLint x, GLint y, GLsizei width, GLsizei height);
- void glInvalidateFramebuffer(GLenum target, GLsizei numAttachments, const GLenum *attachments);
- void glInvalidateBufferData(GLuint buffer);
- void glInvalidateBufferSubData(GLuint buffer, GLintptr offset, GLsizeiptr length);
- void glInvalidateTexImage(GLuint texture, GLint level);
- void glInvalidateTexSubImage(GLuint texture, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth);
- void glGetInternalformati64v(GLenum target, GLenum internalformat, GLenum pname, GLsizei bufSize, GLint64 *params);
- void glGetFramebufferParameteriv(GLenum target, GLenum pname, GLint *params);
- void glFramebufferParameteri(GLenum target, GLenum pname, GLint param);
- void glCopyImageSubData(GLuint srcName, GLenum srcTarget, GLint srcLevel, GLint srcX, GLint srcY, GLint srcZ, GLuint dstName, GLenum dstTarget, GLint dstLevel, GLint dstX, GLint dstY, GLint dstZ, GLsizei srcWidth, GLsizei srcHeight, GLsizei srcDepth);
- void glDispatchComputeIndirect(GLintptr indirect);
- void glDispatchCompute(GLuint num_groups_x, GLuint num_groups_y, GLuint num_groups_z);
- void glClearBufferSubData(GLenum target, GLenum internalformat, GLintptr offset, GLsizeiptr size, GLenum format, GLenum type, const void *data);
- void glClearBufferData(GLenum target, GLenum internalformat, GLenum format, GLenum type, const void *data);
-
- // OpenGL 4.4 core functions
- void glBindVertexBuffers(GLuint first, GLsizei count, const GLuint *buffers, const GLintptr *offsets, const GLsizei *strides);
- void glBindImageTextures(GLuint first, GLsizei count, const GLuint *textures);
- void glBindSamplers(GLuint first, GLsizei count, const GLuint *samplers);
- void glBindTextures(GLuint first, GLsizei count, const GLuint *textures);
- void glBindBuffersRange(GLenum target, GLuint first, GLsizei count, const GLuint *buffers, const GLintptr *offsets, const GLsizeiptr *sizes);
- void glBindBuffersBase(GLenum target, GLuint first, GLsizei count, const GLuint *buffers);
- void glClearTexSubImage(GLuint texture, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLenum type, const void *data);
- void glClearTexImage(GLuint texture, GLint level, GLenum format, GLenum type, const void *data);
- void glBufferStorage(GLenum target, GLsizeiptr size, const void *data, GLbitfield flags);
-
-private:
- friend class QOpenGLContext;
-
- static bool isContextCompatible(QOpenGLContext *context);
- static QOpenGLVersionProfile versionProfile();
-
- QOpenGLFunctions_1_0_CoreBackend* d_1_0_Core;
- QOpenGLFunctions_1_1_CoreBackend* d_1_1_Core;
- QOpenGLFunctions_1_2_CoreBackend* d_1_2_Core;
- QOpenGLFunctions_1_3_CoreBackend* d_1_3_Core;
- QOpenGLFunctions_1_4_CoreBackend* d_1_4_Core;
- QOpenGLFunctions_1_5_CoreBackend* d_1_5_Core;
- QOpenGLFunctions_2_0_CoreBackend* d_2_0_Core;
- QOpenGLFunctions_2_1_CoreBackend* d_2_1_Core;
- QOpenGLFunctions_3_0_CoreBackend* d_3_0_Core;
- QOpenGLFunctions_3_1_CoreBackend* d_3_1_Core;
- QOpenGLFunctions_3_2_CoreBackend* d_3_2_Core;
- QOpenGLFunctions_3_3_CoreBackend* d_3_3_Core;
- QOpenGLFunctions_4_0_CoreBackend* d_4_0_Core;
- QOpenGLFunctions_4_1_CoreBackend* d_4_1_Core;
- QOpenGLFunctions_4_2_CoreBackend* d_4_2_Core;
- QOpenGLFunctions_4_3_CoreBackend* d_4_3_Core;
- QOpenGLFunctions_4_4_CoreBackend* d_4_4_Core;
-};
-
-// OpenGL 1.0 core functions
-inline void QOpenGLFunctions_4_4_Core::glViewport(GLint x, GLint y, GLsizei width, GLsizei height)
-{
- d_1_0_Core->f.Viewport(x, y, width, height);
-}
-
-inline void QOpenGLFunctions_4_4_Core::glDepthRange(GLdouble nearVal, GLdouble farVal)
-{
- d_1_0_Core->f.DepthRange(nearVal, farVal);
-}
-
-inline GLboolean QOpenGLFunctions_4_4_Core::glIsEnabled(GLenum cap)
-{
- return d_1_0_Core->f.IsEnabled(cap);
-}
-
-inline void QOpenGLFunctions_4_4_Core::glGetTexLevelParameteriv(GLenum target, GLint level, GLenum pname, GLint *params)
-{
- d_1_0_Core->f.GetTexLevelParameteriv(target, level, pname, params);
-}
-
-inline void QOpenGLFunctions_4_4_Core::glGetTexLevelParameterfv(GLenum target, GLint level, GLenum pname, GLfloat *params)
-{
- d_1_0_Core->f.GetTexLevelParameterfv(target, level, pname, params);
-}
-
-inline void QOpenGLFunctions_4_4_Core::glGetTexParameteriv(GLenum target, GLenum pname, GLint *params)
-{
- d_1_0_Core->f.GetTexParameteriv(target, pname, params);
-}
-
-inline void QOpenGLFunctions_4_4_Core::glGetTexParameterfv(GLenum target, GLenum pname, GLfloat *params)
-{
- d_1_0_Core->f.GetTexParameterfv(target, pname, params);
-}
-
-inline void QOpenGLFunctions_4_4_Core::glGetTexImage(GLenum target, GLint level, GLenum format, GLenum type, void *pixels)
-{
- d_1_0_Core->f.GetTexImage(target, level, format, type, pixels);
-}
-
-inline const GLubyte * QOpenGLFunctions_4_4_Core::glGetString(GLenum name)
-{
- return d_1_0_Core->f.GetString(name);
-}
-
-inline void QOpenGLFunctions_4_4_Core::glGetIntegerv(GLenum pname, GLint *data)
-{
- d_1_0_Core->f.GetIntegerv(pname, data);
-}
-
-inline void QOpenGLFunctions_4_4_Core::glGetFloatv(GLenum pname, GLfloat *data)
-{
- d_1_0_Core->f.GetFloatv(pname, data);
-}
-
-inline GLenum QOpenGLFunctions_4_4_Core::glGetError()
-{
- return d_1_0_Core->f.GetError();
-}
-
-inline void QOpenGLFunctions_4_4_Core::glGetDoublev(GLenum pname, GLdouble *data)
-{
- d_1_0_Core->f.GetDoublev(pname, data);
-}
-
-inline void QOpenGLFunctions_4_4_Core::glGetBooleanv(GLenum pname, GLboolean *data)
-{
- d_1_0_Core->f.GetBooleanv(pname, data);
-}
-
-inline void QOpenGLFunctions_4_4_Core::glReadPixels(GLint x, GLint y, GLsizei width, GLsizei height, GLenum format, GLenum type, void *pixels)
-{
- d_1_0_Core->f.ReadPixels(x, y, width, height, format, type, pixels);
-}
-
-inline void QOpenGLFunctions_4_4_Core::glReadBuffer(GLenum src)
-{
- d_1_0_Core->f.ReadBuffer(src);
-}
-
-inline void QOpenGLFunctions_4_4_Core::glPixelStorei(GLenum pname, GLint param)
-{
- d_1_0_Core->f.PixelStorei(pname, param);
-}
-
-inline void QOpenGLFunctions_4_4_Core::glPixelStoref(GLenum pname, GLfloat param)
-{
- d_1_0_Core->f.PixelStoref(pname, param);
-}
-
-inline void QOpenGLFunctions_4_4_Core::glDepthFunc(GLenum func)
-{
- d_1_0_Core->f.DepthFunc(func);
-}
-
-inline void QOpenGLFunctions_4_4_Core::glStencilOp(GLenum fail, GLenum zfail, GLenum zpass)
-{
- d_1_0_Core->f.StencilOp(fail, zfail, zpass);
-}
-
-inline void QOpenGLFunctions_4_4_Core::glStencilFunc(GLenum func, GLint ref, GLuint mask)
-{
- d_1_0_Core->f.StencilFunc(func, ref, mask);
-}
-
-inline void QOpenGLFunctions_4_4_Core::glLogicOp(GLenum opcode)
-{
- d_1_0_Core->f.LogicOp(opcode);
-}
-
-inline void QOpenGLFunctions_4_4_Core::glBlendFunc(GLenum sfactor, GLenum dfactor)
-{
- d_1_0_Core->f.BlendFunc(sfactor, dfactor);
-}
-
-inline void QOpenGLFunctions_4_4_Core::glFlush()
-{
- d_1_0_Core->f.Flush();
-}
-
-inline void QOpenGLFunctions_4_4_Core::glFinish()
-{
- d_1_0_Core->f.Finish();
-}
-
-inline void QOpenGLFunctions_4_4_Core::glEnable(GLenum cap)
-{
- d_1_0_Core->f.Enable(cap);
-}
-
-inline void QOpenGLFunctions_4_4_Core::glDisable(GLenum cap)
-{
- d_1_0_Core->f.Disable(cap);
-}
-
-inline void QOpenGLFunctions_4_4_Core::glDepthMask(GLboolean flag)
-{
- d_1_0_Core->f.DepthMask(flag);
-}
-
-inline void QOpenGLFunctions_4_4_Core::glColorMask(GLboolean red, GLboolean green, GLboolean blue, GLboolean alpha)
-{
- d_1_0_Core->f.ColorMask(red, green, blue, alpha);
-}
-
-inline void QOpenGLFunctions_4_4_Core::glStencilMask(GLuint mask)
-{
- d_1_0_Core->f.StencilMask(mask);
-}
-
-inline void QOpenGLFunctions_4_4_Core::glClearDepth(GLdouble depth)
-{
- d_1_0_Core->f.ClearDepth(depth);
-}
-
-inline void QOpenGLFunctions_4_4_Core::glClearStencil(GLint s)
-{
- d_1_0_Core->f.ClearStencil(s);
-}
-
-inline void QOpenGLFunctions_4_4_Core::glClearColor(GLfloat red, GLfloat green, GLfloat blue, GLfloat alpha)
-{
- d_1_0_Core->f.ClearColor(red, green, blue, alpha);
-}
-
-inline void QOpenGLFunctions_4_4_Core::glClear(GLbitfield mask)
-{
- d_1_0_Core->f.Clear(mask);
-}
-
-inline void QOpenGLFunctions_4_4_Core::glDrawBuffer(GLenum buf)
-{
- d_1_0_Core->f.DrawBuffer(buf);
-}
-
-inline void QOpenGLFunctions_4_4_Core::glTexImage2D(GLenum target, GLint level, GLint internalformat, GLsizei width, GLsizei height, GLint border, GLenum format, GLenum type, const void *pixels)
-{
- d_1_0_Core->f.TexImage2D(target, level, internalformat, width, height, border, format, type, pixels);
-}
-
-inline void QOpenGLFunctions_4_4_Core::glTexImage1D(GLenum target, GLint level, GLint internalformat, GLsizei width, GLint border, GLenum format, GLenum type, const void *pixels)
-{
- d_1_0_Core->f.TexImage1D(target, level, internalformat, width, border, format, type, pixels);
-}
-
-inline void QOpenGLFunctions_4_4_Core::glTexParameteriv(GLenum target, GLenum pname, const GLint *params)
-{
- d_1_0_Core->f.TexParameteriv(target, pname, params);
-}
-
-inline void QOpenGLFunctions_4_4_Core::glTexParameteri(GLenum target, GLenum pname, GLint param)
-{
- d_1_0_Core->f.TexParameteri(target, pname, param);
-}
-
-inline void QOpenGLFunctions_4_4_Core::glTexParameterfv(GLenum target, GLenum pname, const GLfloat *params)
-{
- d_1_0_Core->f.TexParameterfv(target, pname, params);
-}
-
-inline void QOpenGLFunctions_4_4_Core::glTexParameterf(GLenum target, GLenum pname, GLfloat param)
-{
- d_1_0_Core->f.TexParameterf(target, pname, param);
-}
-
-inline void QOpenGLFunctions_4_4_Core::glScissor(GLint x, GLint y, GLsizei width, GLsizei height)
-{
- d_1_0_Core->f.Scissor(x, y, width, height);
-}
-
-inline void QOpenGLFunctions_4_4_Core::glPolygonMode(GLenum face, GLenum mode)
-{
- d_1_0_Core->f.PolygonMode(face, mode);
-}
-
-inline void QOpenGLFunctions_4_4_Core::glPointSize(GLfloat size)
-{
- d_1_0_Core->f.PointSize(size);
-}
-
-inline void QOpenGLFunctions_4_4_Core::glLineWidth(GLfloat width)
-{
- d_1_0_Core->f.LineWidth(width);
-}
-
-inline void QOpenGLFunctions_4_4_Core::glHint(GLenum target, GLenum mode)
-{
- d_1_0_Core->f.Hint(target, mode);
-}
-
-inline void QOpenGLFunctions_4_4_Core::glFrontFace(GLenum mode)
-{
- d_1_0_Core->f.FrontFace(mode);
-}
-
-inline void QOpenGLFunctions_4_4_Core::glCullFace(GLenum mode)
-{
- d_1_0_Core->f.CullFace(mode);
-}
-
-
-// OpenGL 1.1 core functions
-inline GLboolean QOpenGLFunctions_4_4_Core::glIsTexture(GLuint texture)
-{
- return d_1_1_Core->f.IsTexture(texture);
-}
-
-inline void QOpenGLFunctions_4_4_Core::glGenTextures(GLsizei n, GLuint *textures)
-{
- d_1_1_Core->f.GenTextures(n, textures);
-}
-
-inline void QOpenGLFunctions_4_4_Core::glDeleteTextures(GLsizei n, const GLuint *textures)
-{
- d_1_1_Core->f.DeleteTextures(n, textures);
-}
-
-inline void QOpenGLFunctions_4_4_Core::glBindTexture(GLenum target, GLuint texture)
-{
- d_1_1_Core->f.BindTexture(target, texture);
-}
-
-inline void QOpenGLFunctions_4_4_Core::glTexSubImage2D(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLenum type, const void *pixels)
-{
- d_1_1_Core->f.TexSubImage2D(target, level, xoffset, yoffset, width, height, format, type, pixels);
-}
-
-inline void QOpenGLFunctions_4_4_Core::glTexSubImage1D(GLenum target, GLint level, GLint xoffset, GLsizei width, GLenum format, GLenum type, const void *pixels)
-{
- d_1_1_Core->f.TexSubImage1D(target, level, xoffset, width, format, type, pixels);
-}
-
-inline void QOpenGLFunctions_4_4_Core::glCopyTexSubImage2D(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint x, GLint y, GLsizei width, GLsizei height)
-{
- d_1_1_Core->f.CopyTexSubImage2D(target, level, xoffset, yoffset, x, y, width, height);
-}
-
-inline void QOpenGLFunctions_4_4_Core::glCopyTexSubImage1D(GLenum target, GLint level, GLint xoffset, GLint x, GLint y, GLsizei width)
-{
- d_1_1_Core->f.CopyTexSubImage1D(target, level, xoffset, x, y, width);
-}
-
-inline void QOpenGLFunctions_4_4_Core::glCopyTexImage2D(GLenum target, GLint level, GLenum internalformat, GLint x, GLint y, GLsizei width, GLsizei height, GLint border)
-{
- d_1_1_Core->f.CopyTexImage2D(target, level, internalformat, x, y, width, height, border);
-}
-
-inline void QOpenGLFunctions_4_4_Core::glCopyTexImage1D(GLenum target, GLint level, GLenum internalformat, GLint x, GLint y, GLsizei width, GLint border)
-{
- d_1_1_Core->f.CopyTexImage1D(target, level, internalformat, x, y, width, border);
-}
-
-inline void QOpenGLFunctions_4_4_Core::glPolygonOffset(GLfloat factor, GLfloat units)
-{
- d_1_1_Core->f.PolygonOffset(factor, units);
-}
-
-inline void QOpenGLFunctions_4_4_Core::glDrawElements(GLenum mode, GLsizei count, GLenum type, const void *indices)
-{
- d_1_1_Core->f.DrawElements(mode, count, type, indices);
-}
-
-inline void QOpenGLFunctions_4_4_Core::glDrawArrays(GLenum mode, GLint first, GLsizei count)
-{
- d_1_1_Core->f.DrawArrays(mode, first, count);
-}
-
-
-// OpenGL 1.2 core functions
-inline void QOpenGLFunctions_4_4_Core::glBlendColor(GLfloat red, GLfloat green, GLfloat blue, GLfloat alpha)
-{
- d_1_2_Core->f.BlendColor(red, green, blue, alpha);
-}
-
-inline void QOpenGLFunctions_4_4_Core::glBlendEquation(GLenum mode)
-{
- d_1_2_Core->f.BlendEquation(mode);
-}
-
-inline void QOpenGLFunctions_4_4_Core::glCopyTexSubImage3D(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLint x, GLint y, GLsizei width, GLsizei height)
-{
- d_1_2_Core->f.CopyTexSubImage3D(target, level, xoffset, yoffset, zoffset, x, y, width, height);
-}
-
-inline void QOpenGLFunctions_4_4_Core::glTexSubImage3D(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLenum type, const void *pixels)
-{
- d_1_2_Core->f.TexSubImage3D(target, level, xoffset, yoffset, zoffset, width, height, depth, format, type, pixels);
-}
-
-inline void QOpenGLFunctions_4_4_Core::glTexImage3D(GLenum target, GLint level, GLint internalformat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLenum format, GLenum type, const void *pixels)
-{
- d_1_2_Core->f.TexImage3D(target, level, internalformat, width, height, depth, border, format, type, pixels);
-}
-
-inline void QOpenGLFunctions_4_4_Core::glDrawRangeElements(GLenum mode, GLuint start, GLuint end, GLsizei count, GLenum type, const void *indices)
-{
- d_1_2_Core->f.DrawRangeElements(mode, start, end, count, type, indices);
-}
-
-
-// OpenGL 1.3 core functions
-inline void QOpenGLFunctions_4_4_Core::glGetCompressedTexImage(GLenum target, GLint level, void *img)
-{
- d_1_3_Core->f.GetCompressedTexImage(target, level, img);
-}
-
-inline void QOpenGLFunctions_4_4_Core::glCompressedTexSubImage1D(GLenum target, GLint level, GLint xoffset, GLsizei width, GLenum format, GLsizei imageSize, const void *data)
-{
- d_1_3_Core->f.CompressedTexSubImage1D(target, level, xoffset, width, format, imageSize, data);
-}
-
-inline void QOpenGLFunctions_4_4_Core::glCompressedTexSubImage2D(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLsizei imageSize, const void *data)
-{
- d_1_3_Core->f.CompressedTexSubImage2D(target, level, xoffset, yoffset, width, height, format, imageSize, data);
-}
-
-inline void QOpenGLFunctions_4_4_Core::glCompressedTexSubImage3D(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLsizei imageSize, const void *data)
-{
- d_1_3_Core->f.CompressedTexSubImage3D(target, level, xoffset, yoffset, zoffset, width, height, depth, format, imageSize, data);
-}
-
-inline void QOpenGLFunctions_4_4_Core::glCompressedTexImage1D(GLenum target, GLint level, GLenum internalformat, GLsizei width, GLint border, GLsizei imageSize, const void *data)
-{
- d_1_3_Core->f.CompressedTexImage1D(target, level, internalformat, width, border, imageSize, data);
-}
-
-inline void QOpenGLFunctions_4_4_Core::glCompressedTexImage2D(GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLint border, GLsizei imageSize, const void *data)
-{
- d_1_3_Core->f.CompressedTexImage2D(target, level, internalformat, width, height, border, imageSize, data);
-}
-
-inline void QOpenGLFunctions_4_4_Core::glCompressedTexImage3D(GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLsizei imageSize, const void *data)
-{
- d_1_3_Core->f.CompressedTexImage3D(target, level, internalformat, width, height, depth, border, imageSize, data);
-}
-
-inline void QOpenGLFunctions_4_4_Core::glSampleCoverage(GLfloat value, GLboolean invert)
-{
- d_1_3_Core->f.SampleCoverage(value, invert);
-}
-
-inline void QOpenGLFunctions_4_4_Core::glActiveTexture(GLenum texture)
-{
- d_1_3_Core->f.ActiveTexture(texture);
-}
-
-
-// OpenGL 1.4 core functions
-inline void QOpenGLFunctions_4_4_Core::glPointParameteriv(GLenum pname, const GLint *params)
-{
- d_1_4_Core->f.PointParameteriv(pname, params);
-}
-
-inline void QOpenGLFunctions_4_4_Core::glPointParameteri(GLenum pname, GLint param)
-{
- d_1_4_Core->f.PointParameteri(pname, param);
-}
-
-inline void QOpenGLFunctions_4_4_Core::glPointParameterfv(GLenum pname, const GLfloat *params)
-{
- d_1_4_Core->f.PointParameterfv(pname, params);
-}
-
-inline void QOpenGLFunctions_4_4_Core::glPointParameterf(GLenum pname, GLfloat param)
-{
- d_1_4_Core->f.PointParameterf(pname, param);
-}
-
-inline void QOpenGLFunctions_4_4_Core::glMultiDrawElements(GLenum mode, const GLsizei *count, GLenum type, const void *const *indices, GLsizei drawcount)
-{
- d_1_4_Core->f.MultiDrawElements(mode, count, type, indices, drawcount);
-}
-
-inline void QOpenGLFunctions_4_4_Core::glMultiDrawArrays(GLenum mode, const GLint *first, const GLsizei *count, GLsizei drawcount)
-{
- d_1_4_Core->f.MultiDrawArrays(mode, first, count, drawcount);
-}
-
-inline void QOpenGLFunctions_4_4_Core::glBlendFuncSeparate(GLenum sfactorRGB, GLenum dfactorRGB, GLenum sfactorAlpha, GLenum dfactorAlpha)
-{
- d_1_4_Core->f.BlendFuncSeparate(sfactorRGB, dfactorRGB, sfactorAlpha, dfactorAlpha);
-}
-
-
-// OpenGL 1.5 core functions
-inline void QOpenGLFunctions_4_4_Core::glGetBufferPointerv(GLenum target, GLenum pname, void * *params)
-{
- d_1_5_Core->f.GetBufferPointerv(target, pname, params);
-}
-
-inline void QOpenGLFunctions_4_4_Core::glGetBufferParameteriv(GLenum target, GLenum pname, GLint *params)
-{
- d_1_5_Core->f.GetBufferParameteriv(target, pname, params);
-}
-
-inline GLboolean QOpenGLFunctions_4_4_Core::glUnmapBuffer(GLenum target)
-{
- return d_1_5_Core->f.UnmapBuffer(target);
-}
-
-inline void * QOpenGLFunctions_4_4_Core::glMapBuffer(GLenum target, GLenum access)
-{
- return d_1_5_Core->f.MapBuffer(target, access);
-}
-
-inline void QOpenGLFunctions_4_4_Core::glGetBufferSubData(GLenum target, GLintptr offset, GLsizeiptr size, void *data)
-{
- d_1_5_Core->f.GetBufferSubData(target, offset, size, data);
-}
-
-inline void QOpenGLFunctions_4_4_Core::glBufferSubData(GLenum target, GLintptr offset, GLsizeiptr size, const void *data)
-{
- d_1_5_Core->f.BufferSubData(target, offset, size, data);
-}
-
-inline void QOpenGLFunctions_4_4_Core::glBufferData(GLenum target, GLsizeiptr size, const void *data, GLenum usage)
-{
- d_1_5_Core->f.BufferData(target, size, data, usage);
-}
-
-inline GLboolean QOpenGLFunctions_4_4_Core::glIsBuffer(GLuint buffer)
-{
- return d_1_5_Core->f.IsBuffer(buffer);
-}
-
-inline void QOpenGLFunctions_4_4_Core::glGenBuffers(GLsizei n, GLuint *buffers)
-{
- d_1_5_Core->f.GenBuffers(n, buffers);
-}
-
-inline void QOpenGLFunctions_4_4_Core::glDeleteBuffers(GLsizei n, const GLuint *buffers)
-{
- d_1_5_Core->f.DeleteBuffers(n, buffers);
-}
-
-inline void QOpenGLFunctions_4_4_Core::glBindBuffer(GLenum target, GLuint buffer)
-{
- d_1_5_Core->f.BindBuffer(target, buffer);
-}
-
-inline void QOpenGLFunctions_4_4_Core::glGetQueryObjectuiv(GLuint id, GLenum pname, GLuint *params)
-{
- d_1_5_Core->f.GetQueryObjectuiv(id, pname, params);
-}
-
-inline void QOpenGLFunctions_4_4_Core::glGetQueryObjectiv(GLuint id, GLenum pname, GLint *params)
-{
- d_1_5_Core->f.GetQueryObjectiv(id, pname, params);
-}
-
-inline void QOpenGLFunctions_4_4_Core::glGetQueryiv(GLenum target, GLenum pname, GLint *params)
-{
- d_1_5_Core->f.GetQueryiv(target, pname, params);
-}
-
-inline void QOpenGLFunctions_4_4_Core::glEndQuery(GLenum target)
-{
- d_1_5_Core->f.EndQuery(target);
-}
-
-inline void QOpenGLFunctions_4_4_Core::glBeginQuery(GLenum target, GLuint id)
-{
- d_1_5_Core->f.BeginQuery(target, id);
-}
-
-inline GLboolean QOpenGLFunctions_4_4_Core::glIsQuery(GLuint id)
-{
- return d_1_5_Core->f.IsQuery(id);
-}
-
-inline void QOpenGLFunctions_4_4_Core::glDeleteQueries(GLsizei n, const GLuint *ids)
-{
- d_1_5_Core->f.DeleteQueries(n, ids);
-}
-
-inline void QOpenGLFunctions_4_4_Core::glGenQueries(GLsizei n, GLuint *ids)
-{
- d_1_5_Core->f.GenQueries(n, ids);
-}
-
-
-// OpenGL 2.0 core functions
-inline void QOpenGLFunctions_4_4_Core::glVertexAttribPointer(GLuint index, GLint size, GLenum type, GLboolean normalized, GLsizei stride, const void *pointer)
-{
- d_2_0_Core->f.VertexAttribPointer(index, size, type, normalized, stride, pointer);
-}
-
-inline void QOpenGLFunctions_4_4_Core::glVertexAttrib4usv(GLuint index, const GLushort *v)
-{
- d_2_0_Core->f.VertexAttrib4usv(index, v);
-}
-
-inline void QOpenGLFunctions_4_4_Core::glVertexAttrib4uiv(GLuint index, const GLuint *v)
-{
- d_2_0_Core->f.VertexAttrib4uiv(index, v);
-}
-
-inline void QOpenGLFunctions_4_4_Core::glVertexAttrib4ubv(GLuint index, const GLubyte *v)
-{
- d_2_0_Core->f.VertexAttrib4ubv(index, v);
-}
-
-inline void QOpenGLFunctions_4_4_Core::glVertexAttrib4sv(GLuint index, const GLshort *v)
-{
- d_2_0_Core->f.VertexAttrib4sv(index, v);
-}
-
-inline void QOpenGLFunctions_4_4_Core::glVertexAttrib4s(GLuint index, GLshort x, GLshort y, GLshort z, GLshort w)
-{
- d_2_0_Core->f.VertexAttrib4s(index, x, y, z, w);
-}
-
-inline void QOpenGLFunctions_4_4_Core::glVertexAttrib4iv(GLuint index, const GLint *v)
-{
- d_2_0_Core->f.VertexAttrib4iv(index, v);
-}
-
-inline void QOpenGLFunctions_4_4_Core::glVertexAttrib4fv(GLuint index, const GLfloat *v)
-{
- d_2_0_Core->f.VertexAttrib4fv(index, v);
-}
-
-inline void QOpenGLFunctions_4_4_Core::glVertexAttrib4f(GLuint index, GLfloat x, GLfloat y, GLfloat z, GLfloat w)
-{
- d_2_0_Core->f.VertexAttrib4f(index, x, y, z, w);
-}
-
-inline void QOpenGLFunctions_4_4_Core::glVertexAttrib4dv(GLuint index, const GLdouble *v)
-{
- d_2_0_Core->f.VertexAttrib4dv(index, v);
-}
-
-inline void QOpenGLFunctions_4_4_Core::glVertexAttrib4d(GLuint index, GLdouble x, GLdouble y, GLdouble z, GLdouble w)
-{
- d_2_0_Core->f.VertexAttrib4d(index, x, y, z, w);
-}
-
-inline void QOpenGLFunctions_4_4_Core::glVertexAttrib4bv(GLuint index, const GLbyte *v)
-{
- d_2_0_Core->f.VertexAttrib4bv(index, v);
-}
-
-inline void QOpenGLFunctions_4_4_Core::glVertexAttrib4Nusv(GLuint index, const GLushort *v)
-{
- d_2_0_Core->f.VertexAttrib4Nusv(index, v);
-}
-
-inline void QOpenGLFunctions_4_4_Core::glVertexAttrib4Nuiv(GLuint index, const GLuint *v)
-{
- d_2_0_Core->f.VertexAttrib4Nuiv(index, v);
-}
-
-inline void QOpenGLFunctions_4_4_Core::glVertexAttrib4Nubv(GLuint index, const GLubyte *v)
-{
- d_2_0_Core->f.VertexAttrib4Nubv(index, v);
-}
-
-inline void QOpenGLFunctions_4_4_Core::glVertexAttrib4Nub(GLuint index, GLubyte x, GLubyte y, GLubyte z, GLubyte w)
-{
- d_2_0_Core->f.VertexAttrib4Nub(index, x, y, z, w);
-}
-
-inline void QOpenGLFunctions_4_4_Core::glVertexAttrib4Nsv(GLuint index, const GLshort *v)
-{
- d_2_0_Core->f.VertexAttrib4Nsv(index, v);
-}
-
-inline void QOpenGLFunctions_4_4_Core::glVertexAttrib4Niv(GLuint index, const GLint *v)
-{
- d_2_0_Core->f.VertexAttrib4Niv(index, v);
-}
-
-inline void QOpenGLFunctions_4_4_Core::glVertexAttrib4Nbv(GLuint index, const GLbyte *v)
-{
- d_2_0_Core->f.VertexAttrib4Nbv(index, v);
-}
-
-inline void QOpenGLFunctions_4_4_Core::glVertexAttrib3sv(GLuint index, const GLshort *v)
-{
- d_2_0_Core->f.VertexAttrib3sv(index, v);
-}
-
-inline void QOpenGLFunctions_4_4_Core::glVertexAttrib3s(GLuint index, GLshort x, GLshort y, GLshort z)
-{
- d_2_0_Core->f.VertexAttrib3s(index, x, y, z);
-}
-
-inline void QOpenGLFunctions_4_4_Core::glVertexAttrib3fv(GLuint index, const GLfloat *v)
-{
- d_2_0_Core->f.VertexAttrib3fv(index, v);
-}
-
-inline void QOpenGLFunctions_4_4_Core::glVertexAttrib3f(GLuint index, GLfloat x, GLfloat y, GLfloat z)
-{
- d_2_0_Core->f.VertexAttrib3f(index, x, y, z);
-}
-
-inline void QOpenGLFunctions_4_4_Core::glVertexAttrib3dv(GLuint index, const GLdouble *v)
-{
- d_2_0_Core->f.VertexAttrib3dv(index, v);
-}
-
-inline void QOpenGLFunctions_4_4_Core::glVertexAttrib3d(GLuint index, GLdouble x, GLdouble y, GLdouble z)
-{
- d_2_0_Core->f.VertexAttrib3d(index, x, y, z);
-}
-
-inline void QOpenGLFunctions_4_4_Core::glVertexAttrib2sv(GLuint index, const GLshort *v)
-{
- d_2_0_Core->f.VertexAttrib2sv(index, v);
-}
-
-inline void QOpenGLFunctions_4_4_Core::glVertexAttrib2s(GLuint index, GLshort x, GLshort y)
-{
- d_2_0_Core->f.VertexAttrib2s(index, x, y);
-}
-
-inline void QOpenGLFunctions_4_4_Core::glVertexAttrib2fv(GLuint index, const GLfloat *v)
-{
- d_2_0_Core->f.VertexAttrib2fv(index, v);
-}
-
-inline void QOpenGLFunctions_4_4_Core::glVertexAttrib2f(GLuint index, GLfloat x, GLfloat y)
-{
- d_2_0_Core->f.VertexAttrib2f(index, x, y);
-}
-
-inline void QOpenGLFunctions_4_4_Core::glVertexAttrib2dv(GLuint index, const GLdouble *v)
-{
- d_2_0_Core->f.VertexAttrib2dv(index, v);
-}
-
-inline void QOpenGLFunctions_4_4_Core::glVertexAttrib2d(GLuint index, GLdouble x, GLdouble y)
-{
- d_2_0_Core->f.VertexAttrib2d(index, x, y);
-}
-
-inline void QOpenGLFunctions_4_4_Core::glVertexAttrib1sv(GLuint index, const GLshort *v)
-{
- d_2_0_Core->f.VertexAttrib1sv(index, v);
-}
-
-inline void QOpenGLFunctions_4_4_Core::glVertexAttrib1s(GLuint index, GLshort x)
-{
- d_2_0_Core->f.VertexAttrib1s(index, x);
-}
-
-inline void QOpenGLFunctions_4_4_Core::glVertexAttrib1fv(GLuint index, const GLfloat *v)
-{
- d_2_0_Core->f.VertexAttrib1fv(index, v);
-}
-
-inline void QOpenGLFunctions_4_4_Core::glVertexAttrib1f(GLuint index, GLfloat x)
-{
- d_2_0_Core->f.VertexAttrib1f(index, x);
-}
-
-inline void QOpenGLFunctions_4_4_Core::glVertexAttrib1dv(GLuint index, const GLdouble *v)
-{
- d_2_0_Core->f.VertexAttrib1dv(index, v);
-}
-
-inline void QOpenGLFunctions_4_4_Core::glVertexAttrib1d(GLuint index, GLdouble x)
-{
- d_2_0_Core->f.VertexAttrib1d(index, x);
-}
-
-inline void QOpenGLFunctions_4_4_Core::glValidateProgram(GLuint program)
-{
- d_2_0_Core->f.ValidateProgram(program);
-}
-
-inline void QOpenGLFunctions_4_4_Core::glUniformMatrix4fv(GLint location, GLsizei count, GLboolean transpose, const GLfloat *value)
-{
- d_2_0_Core->f.UniformMatrix4fv(location, count, transpose, value);
-}
-
-inline void QOpenGLFunctions_4_4_Core::glUniformMatrix3fv(GLint location, GLsizei count, GLboolean transpose, const GLfloat *value)
-{
- d_2_0_Core->f.UniformMatrix3fv(location, count, transpose, value);
-}
-
-inline void QOpenGLFunctions_4_4_Core::glUniformMatrix2fv(GLint location, GLsizei count, GLboolean transpose, const GLfloat *value)
-{
- d_2_0_Core->f.UniformMatrix2fv(location, count, transpose, value);
-}
-
-inline void QOpenGLFunctions_4_4_Core::glUniform4iv(GLint location, GLsizei count, const GLint *value)
-{
- d_2_0_Core->f.Uniform4iv(location, count, value);
-}
-
-inline void QOpenGLFunctions_4_4_Core::glUniform3iv(GLint location, GLsizei count, const GLint *value)
-{
- d_2_0_Core->f.Uniform3iv(location, count, value);
-}
-
-inline void QOpenGLFunctions_4_4_Core::glUniform2iv(GLint location, GLsizei count, const GLint *value)
-{
- d_2_0_Core->f.Uniform2iv(location, count, value);
-}
-
-inline void QOpenGLFunctions_4_4_Core::glUniform1iv(GLint location, GLsizei count, const GLint *value)
-{
- d_2_0_Core->f.Uniform1iv(location, count, value);
-}
-
-inline void QOpenGLFunctions_4_4_Core::glUniform4fv(GLint location, GLsizei count, const GLfloat *value)
-{
- d_2_0_Core->f.Uniform4fv(location, count, value);
-}
-
-inline void QOpenGLFunctions_4_4_Core::glUniform3fv(GLint location, GLsizei count, const GLfloat *value)
-{
- d_2_0_Core->f.Uniform3fv(location, count, value);
-}
-
-inline void QOpenGLFunctions_4_4_Core::glUniform2fv(GLint location, GLsizei count, const GLfloat *value)
-{
- d_2_0_Core->f.Uniform2fv(location, count, value);
-}
-
-inline void QOpenGLFunctions_4_4_Core::glUniform1fv(GLint location, GLsizei count, const GLfloat *value)
-{
- d_2_0_Core->f.Uniform1fv(location, count, value);
-}
-
-inline void QOpenGLFunctions_4_4_Core::glUniform4i(GLint location, GLint v0, GLint v1, GLint v2, GLint v3)
-{
- d_2_0_Core->f.Uniform4i(location, v0, v1, v2, v3);
-}
-
-inline void QOpenGLFunctions_4_4_Core::glUniform3i(GLint location, GLint v0, GLint v1, GLint v2)
-{
- d_2_0_Core->f.Uniform3i(location, v0, v1, v2);
-}
-
-inline void QOpenGLFunctions_4_4_Core::glUniform2i(GLint location, GLint v0, GLint v1)
-{
- d_2_0_Core->f.Uniform2i(location, v0, v1);
-}
-
-inline void QOpenGLFunctions_4_4_Core::glUniform1i(GLint location, GLint v0)
-{
- d_2_0_Core->f.Uniform1i(location, v0);
-}
-
-inline void QOpenGLFunctions_4_4_Core::glUniform4f(GLint location, GLfloat v0, GLfloat v1, GLfloat v2, GLfloat v3)
-{
- d_2_0_Core->f.Uniform4f(location, v0, v1, v2, v3);
-}
-
-inline void QOpenGLFunctions_4_4_Core::glUniform3f(GLint location, GLfloat v0, GLfloat v1, GLfloat v2)
-{
- d_2_0_Core->f.Uniform3f(location, v0, v1, v2);
-}
-
-inline void QOpenGLFunctions_4_4_Core::glUniform2f(GLint location, GLfloat v0, GLfloat v1)
-{
- d_2_0_Core->f.Uniform2f(location, v0, v1);
-}
-
-inline void QOpenGLFunctions_4_4_Core::glUniform1f(GLint location, GLfloat v0)
-{
- d_2_0_Core->f.Uniform1f(location, v0);
-}
-
-inline void QOpenGLFunctions_4_4_Core::glUseProgram(GLuint program)
-{
- d_2_0_Core->f.UseProgram(program);
-}
-
-inline void QOpenGLFunctions_4_4_Core::glShaderSource(GLuint shader, GLsizei count, const GLchar *const *string, const GLint *length)
-{
- d_2_0_Core->f.ShaderSource(shader, count, string, length);
-}
-
-inline void QOpenGLFunctions_4_4_Core::glLinkProgram(GLuint program)
-{
- d_2_0_Core->f.LinkProgram(program);
-}
-
-inline GLboolean QOpenGLFunctions_4_4_Core::glIsShader(GLuint shader)
-{
- return d_2_0_Core->f.IsShader(shader);
-}
-
-inline GLboolean QOpenGLFunctions_4_4_Core::glIsProgram(GLuint program)
-{
- return d_2_0_Core->f.IsProgram(program);
-}
-
-inline void QOpenGLFunctions_4_4_Core::glGetVertexAttribPointerv(GLuint index, GLenum pname, void * *pointer)
-{
- d_2_0_Core->f.GetVertexAttribPointerv(index, pname, pointer);
-}
-
-inline void QOpenGLFunctions_4_4_Core::glGetVertexAttribiv(GLuint index, GLenum pname, GLint *params)
-{
- d_2_0_Core->f.GetVertexAttribiv(index, pname, params);
-}
-
-inline void QOpenGLFunctions_4_4_Core::glGetVertexAttribfv(GLuint index, GLenum pname, GLfloat *params)
-{
- d_2_0_Core->f.GetVertexAttribfv(index, pname, params);
-}
-
-inline void QOpenGLFunctions_4_4_Core::glGetVertexAttribdv(GLuint index, GLenum pname, GLdouble *params)
-{
- d_2_0_Core->f.GetVertexAttribdv(index, pname, params);
-}
-
-inline void QOpenGLFunctions_4_4_Core::glGetUniformiv(GLuint program, GLint location, GLint *params)
-{
- d_2_0_Core->f.GetUniformiv(program, location, params);
-}
-
-inline void QOpenGLFunctions_4_4_Core::glGetUniformfv(GLuint program, GLint location, GLfloat *params)
-{
- d_2_0_Core->f.GetUniformfv(program, location, params);
-}
-
-inline GLint QOpenGLFunctions_4_4_Core::glGetUniformLocation(GLuint program, const GLchar *name)
-{
- return d_2_0_Core->f.GetUniformLocation(program, name);
-}
-
-inline void QOpenGLFunctions_4_4_Core::glGetShaderSource(GLuint shader, GLsizei bufSize, GLsizei *length, GLchar *source)
-{
- d_2_0_Core->f.GetShaderSource(shader, bufSize, length, source);
-}
-
-inline void QOpenGLFunctions_4_4_Core::glGetShaderInfoLog(GLuint shader, GLsizei bufSize, GLsizei *length, GLchar *infoLog)
-{
- d_2_0_Core->f.GetShaderInfoLog(shader, bufSize, length, infoLog);
-}
-
-inline void QOpenGLFunctions_4_4_Core::glGetShaderiv(GLuint shader, GLenum pname, GLint *params)
-{
- d_2_0_Core->f.GetShaderiv(shader, pname, params);
-}
-
-inline void QOpenGLFunctions_4_4_Core::glGetProgramInfoLog(GLuint program, GLsizei bufSize, GLsizei *length, GLchar *infoLog)
-{
- d_2_0_Core->f.GetProgramInfoLog(program, bufSize, length, infoLog);
-}
-
-inline void QOpenGLFunctions_4_4_Core::glGetProgramiv(GLuint program, GLenum pname, GLint *params)
-{
- d_2_0_Core->f.GetProgramiv(program, pname, params);
-}
-
-inline GLint QOpenGLFunctions_4_4_Core::glGetAttribLocation(GLuint program, const GLchar *name)
-{
- return d_2_0_Core->f.GetAttribLocation(program, name);
-}
-
-inline void QOpenGLFunctions_4_4_Core::glGetAttachedShaders(GLuint program, GLsizei maxCount, GLsizei *count, GLuint *shaders)
-{
- d_2_0_Core->f.GetAttachedShaders(program, maxCount, count, shaders);
-}
-
-inline void QOpenGLFunctions_4_4_Core::glGetActiveUniform(GLuint program, GLuint index, GLsizei bufSize, GLsizei *length, GLint *size, GLenum *type, GLchar *name)
-{
- d_2_0_Core->f.GetActiveUniform(program, index, bufSize, length, size, type, name);
-}
-
-inline void QOpenGLFunctions_4_4_Core::glGetActiveAttrib(GLuint program, GLuint index, GLsizei bufSize, GLsizei *length, GLint *size, GLenum *type, GLchar *name)
-{
- d_2_0_Core->f.GetActiveAttrib(program, index, bufSize, length, size, type, name);
-}
-
-inline void QOpenGLFunctions_4_4_Core::glEnableVertexAttribArray(GLuint index)
-{
- d_2_0_Core->f.EnableVertexAttribArray(index);
-}
-
-inline void QOpenGLFunctions_4_4_Core::glDisableVertexAttribArray(GLuint index)
-{
- d_2_0_Core->f.DisableVertexAttribArray(index);
-}
-
-inline void QOpenGLFunctions_4_4_Core::glDetachShader(GLuint program, GLuint shader)
-{
- d_2_0_Core->f.DetachShader(program, shader);
-}
-
-inline void QOpenGLFunctions_4_4_Core::glDeleteShader(GLuint shader)
-{
- d_2_0_Core->f.DeleteShader(shader);
-}
-
-inline void QOpenGLFunctions_4_4_Core::glDeleteProgram(GLuint program)
-{
- d_2_0_Core->f.DeleteProgram(program);
-}
-
-inline GLuint QOpenGLFunctions_4_4_Core::glCreateShader(GLenum type)
-{
- return d_2_0_Core->f.CreateShader(type);
-}
-
-inline GLuint QOpenGLFunctions_4_4_Core::glCreateProgram()
-{
- return d_2_0_Core->f.CreateProgram();
-}
-
-inline void QOpenGLFunctions_4_4_Core::glCompileShader(GLuint shader)
-{
- d_2_0_Core->f.CompileShader(shader);
-}
-
-inline void QOpenGLFunctions_4_4_Core::glBindAttribLocation(GLuint program, GLuint index, const GLchar *name)
-{
- d_2_0_Core->f.BindAttribLocation(program, index, name);
-}
-
-inline void QOpenGLFunctions_4_4_Core::glAttachShader(GLuint program, GLuint shader)
-{
- d_2_0_Core->f.AttachShader(program, shader);
-}
-
-inline void QOpenGLFunctions_4_4_Core::glStencilMaskSeparate(GLenum face, GLuint mask)
-{
- d_2_0_Core->f.StencilMaskSeparate(face, mask);
-}
-
-inline void QOpenGLFunctions_4_4_Core::glStencilFuncSeparate(GLenum face, GLenum func, GLint ref, GLuint mask)
-{
- d_2_0_Core->f.StencilFuncSeparate(face, func, ref, mask);
-}
-
-inline void QOpenGLFunctions_4_4_Core::glStencilOpSeparate(GLenum face, GLenum sfail, GLenum dpfail, GLenum dppass)
-{
- d_2_0_Core->f.StencilOpSeparate(face, sfail, dpfail, dppass);
-}
-
-inline void QOpenGLFunctions_4_4_Core::glDrawBuffers(GLsizei n, const GLenum *bufs)
-{
- d_2_0_Core->f.DrawBuffers(n, bufs);
-}
-
-inline void QOpenGLFunctions_4_4_Core::glBlendEquationSeparate(GLenum modeRGB, GLenum modeAlpha)
-{
- d_2_0_Core->f.BlendEquationSeparate(modeRGB, modeAlpha);
-}
-
-
-// OpenGL 2.1 core functions
-inline void QOpenGLFunctions_4_4_Core::glUniformMatrix4x3fv(GLint location, GLsizei count, GLboolean transpose, const GLfloat *value)
-{
- d_2_1_Core->f.UniformMatrix4x3fv(location, count, transpose, value);
-}
-
-inline void QOpenGLFunctions_4_4_Core::glUniformMatrix3x4fv(GLint location, GLsizei count, GLboolean transpose, const GLfloat *value)
-{
- d_2_1_Core->f.UniformMatrix3x4fv(location, count, transpose, value);
-}
-
-inline void QOpenGLFunctions_4_4_Core::glUniformMatrix4x2fv(GLint location, GLsizei count, GLboolean transpose, const GLfloat *value)
-{
- d_2_1_Core->f.UniformMatrix4x2fv(location, count, transpose, value);
-}
-
-inline void QOpenGLFunctions_4_4_Core::glUniformMatrix2x4fv(GLint location, GLsizei count, GLboolean transpose, const GLfloat *value)
-{
- d_2_1_Core->f.UniformMatrix2x4fv(location, count, transpose, value);
-}
-
-inline void QOpenGLFunctions_4_4_Core::glUniformMatrix3x2fv(GLint location, GLsizei count, GLboolean transpose, const GLfloat *value)
-{
- d_2_1_Core->f.UniformMatrix3x2fv(location, count, transpose, value);
-}
-
-inline void QOpenGLFunctions_4_4_Core::glUniformMatrix2x3fv(GLint location, GLsizei count, GLboolean transpose, const GLfloat *value)
-{
- d_2_1_Core->f.UniformMatrix2x3fv(location, count, transpose, value);
-}
-
-
-// OpenGL 3.0 core functions
-inline GLboolean QOpenGLFunctions_4_4_Core::glIsVertexArray(GLuint array)
-{
- return d_3_0_Core->f.IsVertexArray(array);
-}
-
-inline void QOpenGLFunctions_4_4_Core::glGenVertexArrays(GLsizei n, GLuint *arrays)
-{
- d_3_0_Core->f.GenVertexArrays(n, arrays);
-}
-
-inline void QOpenGLFunctions_4_4_Core::glDeleteVertexArrays(GLsizei n, const GLuint *arrays)
-{
- d_3_0_Core->f.DeleteVertexArrays(n, arrays);
-}
-
-inline void QOpenGLFunctions_4_4_Core::glBindVertexArray(GLuint array)
-{
- d_3_0_Core->f.BindVertexArray(array);
-}
-
-inline void QOpenGLFunctions_4_4_Core::glFlushMappedBufferRange(GLenum target, GLintptr offset, GLsizeiptr length)
-{
- d_3_0_Core->f.FlushMappedBufferRange(target, offset, length);
-}
-
-inline void * QOpenGLFunctions_4_4_Core::glMapBufferRange(GLenum target, GLintptr offset, GLsizeiptr length, GLbitfield access)
-{
- return d_3_0_Core->f.MapBufferRange(target, offset, length, access);
-}
-
-inline void QOpenGLFunctions_4_4_Core::glFramebufferTextureLayer(GLenum target, GLenum attachment, GLuint texture, GLint level, GLint layer)
-{
- d_3_0_Core->f.FramebufferTextureLayer(target, attachment, texture, level, layer);
-}
-
-inline void QOpenGLFunctions_4_4_Core::glRenderbufferStorageMultisample(GLenum target, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height)
-{
- d_3_0_Core->f.RenderbufferStorageMultisample(target, samples, internalformat, width, height);
-}
-
-inline void QOpenGLFunctions_4_4_Core::glBlitFramebuffer(GLint srcX0, GLint srcY0, GLint srcX1, GLint srcY1, GLint dstX0, GLint dstY0, GLint dstX1, GLint dstY1, GLbitfield mask, GLenum filter)
-{
- d_3_0_Core->f.BlitFramebuffer(srcX0, srcY0, srcX1, srcY1, dstX0, dstY0, dstX1, dstY1, mask, filter);
-}
-
-inline void QOpenGLFunctions_4_4_Core::glGenerateMipmap(GLenum target)
-{
- d_3_0_Core->f.GenerateMipmap(target);
-}
-
-inline void QOpenGLFunctions_4_4_Core::glGetFramebufferAttachmentParameteriv(GLenum target, GLenum attachment, GLenum pname, GLint *params)
-{
- d_3_0_Core->f.GetFramebufferAttachmentParameteriv(target, attachment, pname, params);
-}
-
-inline void QOpenGLFunctions_4_4_Core::glFramebufferRenderbuffer(GLenum target, GLenum attachment, GLenum renderbuffertarget, GLuint renderbuffer)
-{
- d_3_0_Core->f.FramebufferRenderbuffer(target, attachment, renderbuffertarget, renderbuffer);
-}
-
-inline void QOpenGLFunctions_4_4_Core::glFramebufferTexture3D(GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level, GLint zoffset)
-{
- d_3_0_Core->f.FramebufferTexture3D(target, attachment, textarget, texture, level, zoffset);
-}
-
-inline void QOpenGLFunctions_4_4_Core::glFramebufferTexture2D(GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level)
-{
- d_3_0_Core->f.FramebufferTexture2D(target, attachment, textarget, texture, level);
-}
-
-inline void QOpenGLFunctions_4_4_Core::glFramebufferTexture1D(GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level)
-{
- d_3_0_Core->f.FramebufferTexture1D(target, attachment, textarget, texture, level);
-}
-
-inline GLenum QOpenGLFunctions_4_4_Core::glCheckFramebufferStatus(GLenum target)
-{
- return d_3_0_Core->f.CheckFramebufferStatus(target);
-}
-
-inline void QOpenGLFunctions_4_4_Core::glGenFramebuffers(GLsizei n, GLuint *framebuffers)
-{
- d_3_0_Core->f.GenFramebuffers(n, framebuffers);
-}
-
-inline void QOpenGLFunctions_4_4_Core::glDeleteFramebuffers(GLsizei n, const GLuint *framebuffers)
-{
- d_3_0_Core->f.DeleteFramebuffers(n, framebuffers);
-}
-
-inline void QOpenGLFunctions_4_4_Core::glBindFramebuffer(GLenum target, GLuint framebuffer)
-{
- d_3_0_Core->f.BindFramebuffer(target, framebuffer);
-}
-
-inline GLboolean QOpenGLFunctions_4_4_Core::glIsFramebuffer(GLuint framebuffer)
-{
- return d_3_0_Core->f.IsFramebuffer(framebuffer);
-}
-
-inline void QOpenGLFunctions_4_4_Core::glGetRenderbufferParameteriv(GLenum target, GLenum pname, GLint *params)
-{
- d_3_0_Core->f.GetRenderbufferParameteriv(target, pname, params);
-}
-
-inline void QOpenGLFunctions_4_4_Core::glRenderbufferStorage(GLenum target, GLenum internalformat, GLsizei width, GLsizei height)
-{
- d_3_0_Core->f.RenderbufferStorage(target, internalformat, width, height);
-}
-
-inline void QOpenGLFunctions_4_4_Core::glGenRenderbuffers(GLsizei n, GLuint *renderbuffers)
-{
- d_3_0_Core->f.GenRenderbuffers(n, renderbuffers);
-}
-
-inline void QOpenGLFunctions_4_4_Core::glDeleteRenderbuffers(GLsizei n, const GLuint *renderbuffers)
-{
- d_3_0_Core->f.DeleteRenderbuffers(n, renderbuffers);
-}
-
-inline void QOpenGLFunctions_4_4_Core::glBindRenderbuffer(GLenum target, GLuint renderbuffer)
-{
- d_3_0_Core->f.BindRenderbuffer(target, renderbuffer);
-}
-
-inline GLboolean QOpenGLFunctions_4_4_Core::glIsRenderbuffer(GLuint renderbuffer)
-{
- return d_3_0_Core->f.IsRenderbuffer(renderbuffer);
-}
-
-inline const GLubyte * QOpenGLFunctions_4_4_Core::glGetStringi(GLenum name, GLuint index)
-{
- return d_3_0_Core->f.GetStringi(name, index);
-}
-
-inline void QOpenGLFunctions_4_4_Core::glClearBufferfi(GLenum buffer, GLint drawbuffer, GLfloat depth, GLint stencil)
-{
- d_3_0_Core->f.ClearBufferfi(buffer, drawbuffer, depth, stencil);
-}
-
-inline void QOpenGLFunctions_4_4_Core::glClearBufferfv(GLenum buffer, GLint drawbuffer, const GLfloat *value)
-{
- d_3_0_Core->f.ClearBufferfv(buffer, drawbuffer, value);
-}
-
-inline void QOpenGLFunctions_4_4_Core::glClearBufferuiv(GLenum buffer, GLint drawbuffer, const GLuint *value)
-{
- d_3_0_Core->f.ClearBufferuiv(buffer, drawbuffer, value);
-}
-
-inline void QOpenGLFunctions_4_4_Core::glClearBufferiv(GLenum buffer, GLint drawbuffer, const GLint *value)
-{
- d_3_0_Core->f.ClearBufferiv(buffer, drawbuffer, value);
-}
-
-inline void QOpenGLFunctions_4_4_Core::glGetTexParameterIuiv(GLenum target, GLenum pname, GLuint *params)
-{
- d_3_0_Core->f.GetTexParameterIuiv(target, pname, params);
-}
-
-inline void QOpenGLFunctions_4_4_Core::glGetTexParameterIiv(GLenum target, GLenum pname, GLint *params)
-{
- d_3_0_Core->f.GetTexParameterIiv(target, pname, params);
-}
-
-inline void QOpenGLFunctions_4_4_Core::glTexParameterIuiv(GLenum target, GLenum pname, const GLuint *params)
-{
- d_3_0_Core->f.TexParameterIuiv(target, pname, params);
-}
-
-inline void QOpenGLFunctions_4_4_Core::glTexParameterIiv(GLenum target, GLenum pname, const GLint *params)
-{
- d_3_0_Core->f.TexParameterIiv(target, pname, params);
-}
-
-inline void QOpenGLFunctions_4_4_Core::glUniform4uiv(GLint location, GLsizei count, const GLuint *value)
-{
- d_3_0_Core->f.Uniform4uiv(location, count, value);
-}
-
-inline void QOpenGLFunctions_4_4_Core::glUniform3uiv(GLint location, GLsizei count, const GLuint *value)
-{
- d_3_0_Core->f.Uniform3uiv(location, count, value);
-}
-
-inline void QOpenGLFunctions_4_4_Core::glUniform2uiv(GLint location, GLsizei count, const GLuint *value)
-{
- d_3_0_Core->f.Uniform2uiv(location, count, value);
-}
-
-inline void QOpenGLFunctions_4_4_Core::glUniform1uiv(GLint location, GLsizei count, const GLuint *value)
-{
- d_3_0_Core->f.Uniform1uiv(location, count, value);
-}
-
-inline void QOpenGLFunctions_4_4_Core::glUniform4ui(GLint location, GLuint v0, GLuint v1, GLuint v2, GLuint v3)
-{
- d_3_0_Core->f.Uniform4ui(location, v0, v1, v2, v3);
-}
-
-inline void QOpenGLFunctions_4_4_Core::glUniform3ui(GLint location, GLuint v0, GLuint v1, GLuint v2)
-{
- d_3_0_Core->f.Uniform3ui(location, v0, v1, v2);
-}
-
-inline void QOpenGLFunctions_4_4_Core::glUniform2ui(GLint location, GLuint v0, GLuint v1)
-{
- d_3_0_Core->f.Uniform2ui(location, v0, v1);
-}
-
-inline void QOpenGLFunctions_4_4_Core::glUniform1ui(GLint location, GLuint v0)
-{
- d_3_0_Core->f.Uniform1ui(location, v0);
-}
-
-inline GLint QOpenGLFunctions_4_4_Core::glGetFragDataLocation(GLuint program, const GLchar *name)
-{
- return d_3_0_Core->f.GetFragDataLocation(program, name);
-}
-
-inline void QOpenGLFunctions_4_4_Core::glBindFragDataLocation(GLuint program, GLuint color, const GLchar *name)
-{
- d_3_0_Core->f.BindFragDataLocation(program, color, name);
-}
-
-inline void QOpenGLFunctions_4_4_Core::glGetUniformuiv(GLuint program, GLint location, GLuint *params)
-{
- d_3_0_Core->f.GetUniformuiv(program, location, params);
-}
-
-inline void QOpenGLFunctions_4_4_Core::glVertexAttribI4usv(GLuint index, const GLushort *v)
-{
- d_3_0_Core->f.VertexAttribI4usv(index, v);
-}
-
-inline void QOpenGLFunctions_4_4_Core::glVertexAttribI4ubv(GLuint index, const GLubyte *v)
-{
- d_3_0_Core->f.VertexAttribI4ubv(index, v);
-}
-
-inline void QOpenGLFunctions_4_4_Core::glVertexAttribI4sv(GLuint index, const GLshort *v)
-{
- d_3_0_Core->f.VertexAttribI4sv(index, v);
-}
-
-inline void QOpenGLFunctions_4_4_Core::glVertexAttribI4bv(GLuint index, const GLbyte *v)
-{
- d_3_0_Core->f.VertexAttribI4bv(index, v);
-}
-
-inline void QOpenGLFunctions_4_4_Core::glVertexAttribI4uiv(GLuint index, const GLuint *v)
-{
- d_3_0_Core->f.VertexAttribI4uiv(index, v);
-}
-
-inline void QOpenGLFunctions_4_4_Core::glVertexAttribI3uiv(GLuint index, const GLuint *v)
-{
- d_3_0_Core->f.VertexAttribI3uiv(index, v);
-}
-
-inline void QOpenGLFunctions_4_4_Core::glVertexAttribI2uiv(GLuint index, const GLuint *v)
-{
- d_3_0_Core->f.VertexAttribI2uiv(index, v);
-}
-
-inline void QOpenGLFunctions_4_4_Core::glVertexAttribI1uiv(GLuint index, const GLuint *v)
-{
- d_3_0_Core->f.VertexAttribI1uiv(index, v);
-}
-
-inline void QOpenGLFunctions_4_4_Core::glVertexAttribI4iv(GLuint index, const GLint *v)
-{
- d_3_0_Core->f.VertexAttribI4iv(index, v);
-}
-
-inline void QOpenGLFunctions_4_4_Core::glVertexAttribI3iv(GLuint index, const GLint *v)
-{
- d_3_0_Core->f.VertexAttribI3iv(index, v);
-}
-
-inline void QOpenGLFunctions_4_4_Core::glVertexAttribI2iv(GLuint index, const GLint *v)
-{
- d_3_0_Core->f.VertexAttribI2iv(index, v);
-}
-
-inline void QOpenGLFunctions_4_4_Core::glVertexAttribI1iv(GLuint index, const GLint *v)
-{
- d_3_0_Core->f.VertexAttribI1iv(index, v);
-}
-
-inline void QOpenGLFunctions_4_4_Core::glVertexAttribI4ui(GLuint index, GLuint x, GLuint y, GLuint z, GLuint w)
-{
- d_3_0_Core->f.VertexAttribI4ui(index, x, y, z, w);
-}
-
-inline void QOpenGLFunctions_4_4_Core::glVertexAttribI3ui(GLuint index, GLuint x, GLuint y, GLuint z)
-{
- d_3_0_Core->f.VertexAttribI3ui(index, x, y, z);
-}
-
-inline void QOpenGLFunctions_4_4_Core::glVertexAttribI2ui(GLuint index, GLuint x, GLuint y)
-{
- d_3_0_Core->f.VertexAttribI2ui(index, x, y);
-}
-
-inline void QOpenGLFunctions_4_4_Core::glVertexAttribI1ui(GLuint index, GLuint x)
-{
- d_3_0_Core->f.VertexAttribI1ui(index, x);
-}
-
-inline void QOpenGLFunctions_4_4_Core::glVertexAttribI4i(GLuint index, GLint x, GLint y, GLint z, GLint w)
-{
- d_3_0_Core->f.VertexAttribI4i(index, x, y, z, w);
-}
-
-inline void QOpenGLFunctions_4_4_Core::glVertexAttribI3i(GLuint index, GLint x, GLint y, GLint z)
-{
- d_3_0_Core->f.VertexAttribI3i(index, x, y, z);
-}
-
-inline void QOpenGLFunctions_4_4_Core::glVertexAttribI2i(GLuint index, GLint x, GLint y)
-{
- d_3_0_Core->f.VertexAttribI2i(index, x, y);
-}
-
-inline void QOpenGLFunctions_4_4_Core::glVertexAttribI1i(GLuint index, GLint x)
-{
- d_3_0_Core->f.VertexAttribI1i(index, x);
-}
-
-inline void QOpenGLFunctions_4_4_Core::glGetVertexAttribIuiv(GLuint index, GLenum pname, GLuint *params)
-{
- d_3_0_Core->f.GetVertexAttribIuiv(index, pname, params);
-}
-
-inline void QOpenGLFunctions_4_4_Core::glGetVertexAttribIiv(GLuint index, GLenum pname, GLint *params)
-{
- d_3_0_Core->f.GetVertexAttribIiv(index, pname, params);
-}
-
-inline void QOpenGLFunctions_4_4_Core::glVertexAttribIPointer(GLuint index, GLint size, GLenum type, GLsizei stride, const void *pointer)
-{
- d_3_0_Core->f.VertexAttribIPointer(index, size, type, stride, pointer);
-}
-
-inline void QOpenGLFunctions_4_4_Core::glEndConditionalRender()
-{
- d_3_0_Core->f.EndConditionalRender();
-}
-
-inline void QOpenGLFunctions_4_4_Core::glBeginConditionalRender(GLuint id, GLenum mode)
-{
- d_3_0_Core->f.BeginConditionalRender(id, mode);
-}
-
-inline void QOpenGLFunctions_4_4_Core::glClampColor(GLenum target, GLenum clamp)
-{
- d_3_0_Core->f.ClampColor(target, clamp);
-}
-
-inline void QOpenGLFunctions_4_4_Core::glGetTransformFeedbackVarying(GLuint program, GLuint index, GLsizei bufSize, GLsizei *length, GLsizei *size, GLenum *type, GLchar *name)
-{
- d_3_0_Core->f.GetTransformFeedbackVarying(program, index, bufSize, length, size, type, name);
-}
-
-inline void QOpenGLFunctions_4_4_Core::glTransformFeedbackVaryings(GLuint program, GLsizei count, const GLchar *const *varyings, GLenum bufferMode)
-{
- d_3_0_Core->f.TransformFeedbackVaryings(program, count, varyings, bufferMode);
-}
-
-inline void QOpenGLFunctions_4_4_Core::glBindBufferBase(GLenum target, GLuint index, GLuint buffer)
-{
- d_3_0_Core->f.BindBufferBase(target, index, buffer);
-}
-
-inline void QOpenGLFunctions_4_4_Core::glBindBufferRange(GLenum target, GLuint index, GLuint buffer, GLintptr offset, GLsizeiptr size)
-{
- d_3_0_Core->f.BindBufferRange(target, index, buffer, offset, size);
-}
-
-inline void QOpenGLFunctions_4_4_Core::glEndTransformFeedback()
-{
- d_3_0_Core->f.EndTransformFeedback();
-}
-
-inline void QOpenGLFunctions_4_4_Core::glBeginTransformFeedback(GLenum primitiveMode)
-{
- d_3_0_Core->f.BeginTransformFeedback(primitiveMode);
-}
-
-inline GLboolean QOpenGLFunctions_4_4_Core::glIsEnabledi(GLenum target, GLuint index)
-{
- return d_3_0_Core->f.IsEnabledi(target, index);
-}
-
-inline void QOpenGLFunctions_4_4_Core::glDisablei(GLenum target, GLuint index)
-{
- d_3_0_Core->f.Disablei(target, index);
-}
-
-inline void QOpenGLFunctions_4_4_Core::glEnablei(GLenum target, GLuint index)
-{
- d_3_0_Core->f.Enablei(target, index);
-}
-
-inline void QOpenGLFunctions_4_4_Core::glGetIntegeri_v(GLenum target, GLuint index, GLint *data)
-{
- d_3_0_Core->f.GetIntegeri_v(target, index, data);
-}
-
-inline void QOpenGLFunctions_4_4_Core::glGetBooleani_v(GLenum target, GLuint index, GLboolean *data)
-{
- d_3_0_Core->f.GetBooleani_v(target, index, data);
-}
-
-inline void QOpenGLFunctions_4_4_Core::glColorMaski(GLuint index, GLboolean r, GLboolean g, GLboolean b, GLboolean a)
-{
- d_3_0_Core->f.ColorMaski(index, r, g, b, a);
-}
-
-
-// OpenGL 3.1 core functions
-inline void QOpenGLFunctions_4_4_Core::glUniformBlockBinding(GLuint program, GLuint uniformBlockIndex, GLuint uniformBlockBinding)
-{
- d_3_1_Core->f.UniformBlockBinding(program, uniformBlockIndex, uniformBlockBinding);
-}
-
-inline void QOpenGLFunctions_4_4_Core::glGetActiveUniformBlockName(GLuint program, GLuint uniformBlockIndex, GLsizei bufSize, GLsizei *length, GLchar *uniformBlockName)
-{
- d_3_1_Core->f.GetActiveUniformBlockName(program, uniformBlockIndex, bufSize, length, uniformBlockName);
-}
-
-inline void QOpenGLFunctions_4_4_Core::glGetActiveUniformBlockiv(GLuint program, GLuint uniformBlockIndex, GLenum pname, GLint *params)
-{
- d_3_1_Core->f.GetActiveUniformBlockiv(program, uniformBlockIndex, pname, params);
-}
-
-inline GLuint QOpenGLFunctions_4_4_Core::glGetUniformBlockIndex(GLuint program, const GLchar *uniformBlockName)
-{
- return d_3_1_Core->f.GetUniformBlockIndex(program, uniformBlockName);
-}
-
-inline void QOpenGLFunctions_4_4_Core::glGetActiveUniformName(GLuint program, GLuint uniformIndex, GLsizei bufSize, GLsizei *length, GLchar *uniformName)
-{
- d_3_1_Core->f.GetActiveUniformName(program, uniformIndex, bufSize, length, uniformName);
-}
-
-inline void QOpenGLFunctions_4_4_Core::glGetActiveUniformsiv(GLuint program, GLsizei uniformCount, const GLuint *uniformIndices, GLenum pname, GLint *params)
-{
- d_3_1_Core->f.GetActiveUniformsiv(program, uniformCount, uniformIndices, pname, params);
-}
-
-inline void QOpenGLFunctions_4_4_Core::glGetUniformIndices(GLuint program, GLsizei uniformCount, const GLchar *const *uniformNames, GLuint *uniformIndices)
-{
- d_3_1_Core->f.GetUniformIndices(program, uniformCount, uniformNames, uniformIndices);
-}
-
-inline void QOpenGLFunctions_4_4_Core::glCopyBufferSubData(GLenum readTarget, GLenum writeTarget, GLintptr readOffset, GLintptr writeOffset, GLsizeiptr size)
-{
- d_3_1_Core->f.CopyBufferSubData(readTarget, writeTarget, readOffset, writeOffset, size);
-}
-
-inline void QOpenGLFunctions_4_4_Core::glPrimitiveRestartIndex(GLuint index)
-{
- d_3_1_Core->f.PrimitiveRestartIndex(index);
-}
-
-inline void QOpenGLFunctions_4_4_Core::glTexBuffer(GLenum target, GLenum internalformat, GLuint buffer)
-{
- d_3_1_Core->f.TexBuffer(target, internalformat, buffer);
-}
-
-inline void QOpenGLFunctions_4_4_Core::glDrawElementsInstanced(GLenum mode, GLsizei count, GLenum type, const void *indices, GLsizei instancecount)
-{
- d_3_1_Core->f.DrawElementsInstanced(mode, count, type, indices, instancecount);
-}
-
-inline void QOpenGLFunctions_4_4_Core::glDrawArraysInstanced(GLenum mode, GLint first, GLsizei count, GLsizei instancecount)
-{
- d_3_1_Core->f.DrawArraysInstanced(mode, first, count, instancecount);
-}
-
-
-// OpenGL 3.2 core functions
-inline void QOpenGLFunctions_4_4_Core::glSampleMaski(GLuint maskNumber, GLbitfield mask)
-{
- d_3_2_Core->f.SampleMaski(maskNumber, mask);
-}
-
-inline void QOpenGLFunctions_4_4_Core::glGetMultisamplefv(GLenum pname, GLuint index, GLfloat *val)
-{
- d_3_2_Core->f.GetMultisamplefv(pname, index, val);
-}
-
-inline void QOpenGLFunctions_4_4_Core::glTexImage3DMultisample(GLenum target, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth, GLboolean fixedsamplelocations)
-{
- d_3_2_Core->f.TexImage3DMultisample(target, samples, internalformat, width, height, depth, fixedsamplelocations);
-}
-
-inline void QOpenGLFunctions_4_4_Core::glTexImage2DMultisample(GLenum target, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height, GLboolean fixedsamplelocations)
-{
- d_3_2_Core->f.TexImage2DMultisample(target, samples, internalformat, width, height, fixedsamplelocations);
-}
-
-inline void QOpenGLFunctions_4_4_Core::glFramebufferTexture(GLenum target, GLenum attachment, GLuint texture, GLint level)
-{
- d_3_2_Core->f.FramebufferTexture(target, attachment, texture, level);
-}
-
-inline void QOpenGLFunctions_4_4_Core::glGetBufferParameteri64v(GLenum target, GLenum pname, GLint64 *params)
-{
- d_3_2_Core->f.GetBufferParameteri64v(target, pname, params);
-}
-
-inline void QOpenGLFunctions_4_4_Core::glGetInteger64i_v(GLenum target, GLuint index, GLint64 *data)
-{
- d_3_2_Core->f.GetInteger64i_v(target, index, data);
-}
-
-inline void QOpenGLFunctions_4_4_Core::glGetSynciv(GLsync sync, GLenum pname, GLsizei bufSize, GLsizei *length, GLint *values)
-{
- d_3_2_Core->f.GetSynciv(sync, pname, bufSize, length, values);
-}
-
-inline void QOpenGLFunctions_4_4_Core::glGetInteger64v(GLenum pname, GLint64 *data)
-{
- d_3_2_Core->f.GetInteger64v(pname, data);
-}
-
-inline void QOpenGLFunctions_4_4_Core::glWaitSync(GLsync sync, GLbitfield flags, GLuint64 timeout)
-{
- d_3_2_Core->f.WaitSync(sync, flags, timeout);
-}
-
-inline GLenum QOpenGLFunctions_4_4_Core::glClientWaitSync(GLsync sync, GLbitfield flags, GLuint64 timeout)
-{
- return d_3_2_Core->f.ClientWaitSync(sync, flags, timeout);
-}
-
-inline void QOpenGLFunctions_4_4_Core::glDeleteSync(GLsync sync)
-{
- d_3_2_Core->f.DeleteSync(sync);
-}
-
-inline GLboolean QOpenGLFunctions_4_4_Core::glIsSync(GLsync sync)
-{
- return d_3_2_Core->f.IsSync(sync);
-}
-
-inline GLsync QOpenGLFunctions_4_4_Core::glFenceSync(GLenum condition, GLbitfield flags)
-{
- return d_3_2_Core->f.FenceSync(condition, flags);
-}
-
-inline void QOpenGLFunctions_4_4_Core::glProvokingVertex(GLenum mode)
-{
- d_3_2_Core->f.ProvokingVertex(mode);
-}
-
-inline void QOpenGLFunctions_4_4_Core::glMultiDrawElementsBaseVertex(GLenum mode, const GLsizei *count, GLenum type, const void *const *indices, GLsizei drawcount, const GLint *basevertex)
-{
- d_3_2_Core->f.MultiDrawElementsBaseVertex(mode, count, type, indices, drawcount, basevertex);
-}
-
-inline void QOpenGLFunctions_4_4_Core::glDrawElementsInstancedBaseVertex(GLenum mode, GLsizei count, GLenum type, const void *indices, GLsizei instancecount, GLint basevertex)
-{
- d_3_2_Core->f.DrawElementsInstancedBaseVertex(mode, count, type, indices, instancecount, basevertex);
-}
-
-inline void QOpenGLFunctions_4_4_Core::glDrawRangeElementsBaseVertex(GLenum mode, GLuint start, GLuint end, GLsizei count, GLenum type, const void *indices, GLint basevertex)
-{
- d_3_2_Core->f.DrawRangeElementsBaseVertex(mode, start, end, count, type, indices, basevertex);
-}
-
-inline void QOpenGLFunctions_4_4_Core::glDrawElementsBaseVertex(GLenum mode, GLsizei count, GLenum type, const void *indices, GLint basevertex)
-{
- d_3_2_Core->f.DrawElementsBaseVertex(mode, count, type, indices, basevertex);
-}
-
-
-// OpenGL 3.3 core functions
-inline void QOpenGLFunctions_4_4_Core::glVertexAttribP4uiv(GLuint index, GLenum type, GLboolean normalized, const GLuint *value)
-{
- d_3_3_Core->f.VertexAttribP4uiv(index, type, normalized, value);
-}
-
-inline void QOpenGLFunctions_4_4_Core::glVertexAttribP4ui(GLuint index, GLenum type, GLboolean normalized, GLuint value)
-{
- d_3_3_Core->f.VertexAttribP4ui(index, type, normalized, value);
-}
-
-inline void QOpenGLFunctions_4_4_Core::glVertexAttribP3uiv(GLuint index, GLenum type, GLboolean normalized, const GLuint *value)
-{
- d_3_3_Core->f.VertexAttribP3uiv(index, type, normalized, value);
-}
-
-inline void QOpenGLFunctions_4_4_Core::glVertexAttribP3ui(GLuint index, GLenum type, GLboolean normalized, GLuint value)
-{
- d_3_3_Core->f.VertexAttribP3ui(index, type, normalized, value);
-}
-
-inline void QOpenGLFunctions_4_4_Core::glVertexAttribP2uiv(GLuint index, GLenum type, GLboolean normalized, const GLuint *value)
-{
- d_3_3_Core->f.VertexAttribP2uiv(index, type, normalized, value);
-}
-
-inline void QOpenGLFunctions_4_4_Core::glVertexAttribP2ui(GLuint index, GLenum type, GLboolean normalized, GLuint value)
-{
- d_3_3_Core->f.VertexAttribP2ui(index, type, normalized, value);
-}
-
-inline void QOpenGLFunctions_4_4_Core::glVertexAttribP1uiv(GLuint index, GLenum type, GLboolean normalized, const GLuint *value)
-{
- d_3_3_Core->f.VertexAttribP1uiv(index, type, normalized, value);
-}
-
-inline void QOpenGLFunctions_4_4_Core::glVertexAttribP1ui(GLuint index, GLenum type, GLboolean normalized, GLuint value)
-{
- d_3_3_Core->f.VertexAttribP1ui(index, type, normalized, value);
-}
-
-inline void QOpenGLFunctions_4_4_Core::glVertexAttribDivisor(GLuint index, GLuint divisor)
-{
- d_3_3_Core->f.VertexAttribDivisor(index, divisor);
-}
-
-inline void QOpenGLFunctions_4_4_Core::glGetQueryObjectui64v(GLuint id, GLenum pname, GLuint64 *params)
-{
- d_3_3_Core->f.GetQueryObjectui64v(id, pname, params);
-}
-
-inline void QOpenGLFunctions_4_4_Core::glGetQueryObjecti64v(GLuint id, GLenum pname, GLint64 *params)
-{
- d_3_3_Core->f.GetQueryObjecti64v(id, pname, params);
-}
-
-inline void QOpenGLFunctions_4_4_Core::glQueryCounter(GLuint id, GLenum target)
-{
- d_3_3_Core->f.QueryCounter(id, target);
-}
-
-inline void QOpenGLFunctions_4_4_Core::glGetSamplerParameterIuiv(GLuint sampler, GLenum pname, GLuint *params)
-{
- d_3_3_Core->f.GetSamplerParameterIuiv(sampler, pname, params);
-}
-
-inline void QOpenGLFunctions_4_4_Core::glGetSamplerParameterfv(GLuint sampler, GLenum pname, GLfloat *params)
-{
- d_3_3_Core->f.GetSamplerParameterfv(sampler, pname, params);
-}
-
-inline void QOpenGLFunctions_4_4_Core::glGetSamplerParameterIiv(GLuint sampler, GLenum pname, GLint *params)
-{
- d_3_3_Core->f.GetSamplerParameterIiv(sampler, pname, params);
-}
-
-inline void QOpenGLFunctions_4_4_Core::glGetSamplerParameteriv(GLuint sampler, GLenum pname, GLint *params)
-{
- d_3_3_Core->f.GetSamplerParameteriv(sampler, pname, params);
-}
-
-inline void QOpenGLFunctions_4_4_Core::glSamplerParameterIuiv(GLuint sampler, GLenum pname, const GLuint *param)
-{
- d_3_3_Core->f.SamplerParameterIuiv(sampler, pname, param);
-}
-
-inline void QOpenGLFunctions_4_4_Core::glSamplerParameterIiv(GLuint sampler, GLenum pname, const GLint *param)
-{
- d_3_3_Core->f.SamplerParameterIiv(sampler, pname, param);
-}
-
-inline void QOpenGLFunctions_4_4_Core::glSamplerParameterfv(GLuint sampler, GLenum pname, const GLfloat *param)
-{
- d_3_3_Core->f.SamplerParameterfv(sampler, pname, param);
-}
-
-inline void QOpenGLFunctions_4_4_Core::glSamplerParameterf(GLuint sampler, GLenum pname, GLfloat param)
-{
- d_3_3_Core->f.SamplerParameterf(sampler, pname, param);
-}
-
-inline void QOpenGLFunctions_4_4_Core::glSamplerParameteriv(GLuint sampler, GLenum pname, const GLint *param)
-{
- d_3_3_Core->f.SamplerParameteriv(sampler, pname, param);
-}
-
-inline void QOpenGLFunctions_4_4_Core::glSamplerParameteri(GLuint sampler, GLenum pname, GLint param)
-{
- d_3_3_Core->f.SamplerParameteri(sampler, pname, param);
-}
-
-inline void QOpenGLFunctions_4_4_Core::glBindSampler(GLuint unit, GLuint sampler)
-{
- d_3_3_Core->f.BindSampler(unit, sampler);
-}
-
-inline GLboolean QOpenGLFunctions_4_4_Core::glIsSampler(GLuint sampler)
-{
- return d_3_3_Core->f.IsSampler(sampler);
-}
-
-inline void QOpenGLFunctions_4_4_Core::glDeleteSamplers(GLsizei count, const GLuint *samplers)
-{
- d_3_3_Core->f.DeleteSamplers(count, samplers);
-}
-
-inline void QOpenGLFunctions_4_4_Core::glGenSamplers(GLsizei count, GLuint *samplers)
-{
- d_3_3_Core->f.GenSamplers(count, samplers);
-}
-
-inline GLint QOpenGLFunctions_4_4_Core::glGetFragDataIndex(GLuint program, const GLchar *name)
-{
- return d_3_3_Core->f.GetFragDataIndex(program, name);
-}
-
-inline void QOpenGLFunctions_4_4_Core::glBindFragDataLocationIndexed(GLuint program, GLuint colorNumber, GLuint index, const GLchar *name)
-{
- d_3_3_Core->f.BindFragDataLocationIndexed(program, colorNumber, index, name);
-}
-
-
-// OpenGL 4.0 core functions
-inline void QOpenGLFunctions_4_4_Core::glGetQueryIndexediv(GLenum target, GLuint index, GLenum pname, GLint *params)
-{
- d_4_0_Core->f.GetQueryIndexediv(target, index, pname, params);
-}
-
-inline void QOpenGLFunctions_4_4_Core::glEndQueryIndexed(GLenum target, GLuint index)
-{
- d_4_0_Core->f.EndQueryIndexed(target, index);
-}
-
-inline void QOpenGLFunctions_4_4_Core::glBeginQueryIndexed(GLenum target, GLuint index, GLuint id)
-{
- d_4_0_Core->f.BeginQueryIndexed(target, index, id);
-}
-
-inline void QOpenGLFunctions_4_4_Core::glDrawTransformFeedbackStream(GLenum mode, GLuint id, GLuint stream)
-{
- d_4_0_Core->f.DrawTransformFeedbackStream(mode, id, stream);
-}
-
-inline void QOpenGLFunctions_4_4_Core::glDrawTransformFeedback(GLenum mode, GLuint id)
-{
- d_4_0_Core->f.DrawTransformFeedback(mode, id);
-}
-
-inline void QOpenGLFunctions_4_4_Core::glResumeTransformFeedback()
-{
- d_4_0_Core->f.ResumeTransformFeedback();
-}
-
-inline void QOpenGLFunctions_4_4_Core::glPauseTransformFeedback()
-{
- d_4_0_Core->f.PauseTransformFeedback();
-}
-
-inline GLboolean QOpenGLFunctions_4_4_Core::glIsTransformFeedback(GLuint id)
-{
- return d_4_0_Core->f.IsTransformFeedback(id);
-}
-
-inline void QOpenGLFunctions_4_4_Core::glGenTransformFeedbacks(GLsizei n, GLuint *ids)
-{
- d_4_0_Core->f.GenTransformFeedbacks(n, ids);
-}
-
-inline void QOpenGLFunctions_4_4_Core::glDeleteTransformFeedbacks(GLsizei n, const GLuint *ids)
-{
- d_4_0_Core->f.DeleteTransformFeedbacks(n, ids);
-}
-
-inline void QOpenGLFunctions_4_4_Core::glBindTransformFeedback(GLenum target, GLuint id)
-{
- d_4_0_Core->f.BindTransformFeedback(target, id);
-}
-
-inline void QOpenGLFunctions_4_4_Core::glPatchParameterfv(GLenum pname, const GLfloat *values)
-{
- d_4_0_Core->f.PatchParameterfv(pname, values);
-}
-
-inline void QOpenGLFunctions_4_4_Core::glPatchParameteri(GLenum pname, GLint value)
-{
- d_4_0_Core->f.PatchParameteri(pname, value);
-}
-
-inline void QOpenGLFunctions_4_4_Core::glGetProgramStageiv(GLuint program, GLenum shadertype, GLenum pname, GLint *values)
-{
- d_4_0_Core->f.GetProgramStageiv(program, shadertype, pname, values);
-}
-
-inline void QOpenGLFunctions_4_4_Core::glGetUniformSubroutineuiv(GLenum shadertype, GLint location, GLuint *params)
-{
- d_4_0_Core->f.GetUniformSubroutineuiv(shadertype, location, params);
-}
-
-inline void QOpenGLFunctions_4_4_Core::glUniformSubroutinesuiv(GLenum shadertype, GLsizei count, const GLuint *indices)
-{
- d_4_0_Core->f.UniformSubroutinesuiv(shadertype, count, indices);
-}
-
-inline void QOpenGLFunctions_4_4_Core::glGetActiveSubroutineName(GLuint program, GLenum shadertype, GLuint index, GLsizei bufsize, GLsizei *length, GLchar *name)
-{
- d_4_0_Core->f.GetActiveSubroutineName(program, shadertype, index, bufsize, length, name);
-}
-
-inline void QOpenGLFunctions_4_4_Core::glGetActiveSubroutineUniformName(GLuint program, GLenum shadertype, GLuint index, GLsizei bufsize, GLsizei *length, GLchar *name)
-{
- d_4_0_Core->f.GetActiveSubroutineUniformName(program, shadertype, index, bufsize, length, name);
-}
-
-inline void QOpenGLFunctions_4_4_Core::glGetActiveSubroutineUniformiv(GLuint program, GLenum shadertype, GLuint index, GLenum pname, GLint *values)
-{
- d_4_0_Core->f.GetActiveSubroutineUniformiv(program, shadertype, index, pname, values);
-}
-
-inline GLuint QOpenGLFunctions_4_4_Core::glGetSubroutineIndex(GLuint program, GLenum shadertype, const GLchar *name)
-{
- return d_4_0_Core->f.GetSubroutineIndex(program, shadertype, name);
-}
-
-inline GLint QOpenGLFunctions_4_4_Core::glGetSubroutineUniformLocation(GLuint program, GLenum shadertype, const GLchar *name)
-{
- return d_4_0_Core->f.GetSubroutineUniformLocation(program, shadertype, name);
-}
-
-inline void QOpenGLFunctions_4_4_Core::glGetUniformdv(GLuint program, GLint location, GLdouble *params)
-{
- d_4_0_Core->f.GetUniformdv(program, location, params);
-}
-
-inline void QOpenGLFunctions_4_4_Core::glUniformMatrix4x3dv(GLint location, GLsizei count, GLboolean transpose, const GLdouble *value)
-{
- d_4_0_Core->f.UniformMatrix4x3dv(location, count, transpose, value);
-}
-
-inline void QOpenGLFunctions_4_4_Core::glUniformMatrix4x2dv(GLint location, GLsizei count, GLboolean transpose, const GLdouble *value)
-{
- d_4_0_Core->f.UniformMatrix4x2dv(location, count, transpose, value);
-}
-
-inline void QOpenGLFunctions_4_4_Core::glUniformMatrix3x4dv(GLint location, GLsizei count, GLboolean transpose, const GLdouble *value)
-{
- d_4_0_Core->f.UniformMatrix3x4dv(location, count, transpose, value);
-}
-
-inline void QOpenGLFunctions_4_4_Core::glUniformMatrix3x2dv(GLint location, GLsizei count, GLboolean transpose, const GLdouble *value)
-{
- d_4_0_Core->f.UniformMatrix3x2dv(location, count, transpose, value);
-}
-
-inline void QOpenGLFunctions_4_4_Core::glUniformMatrix2x4dv(GLint location, GLsizei count, GLboolean transpose, const GLdouble *value)
-{
- d_4_0_Core->f.UniformMatrix2x4dv(location, count, transpose, value);
-}
-
-inline void QOpenGLFunctions_4_4_Core::glUniformMatrix2x3dv(GLint location, GLsizei count, GLboolean transpose, const GLdouble *value)
-{
- d_4_0_Core->f.UniformMatrix2x3dv(location, count, transpose, value);
-}
-
-inline void QOpenGLFunctions_4_4_Core::glUniformMatrix4dv(GLint location, GLsizei count, GLboolean transpose, const GLdouble *value)
-{
- d_4_0_Core->f.UniformMatrix4dv(location, count, transpose, value);
-}
-
-inline void QOpenGLFunctions_4_4_Core::glUniformMatrix3dv(GLint location, GLsizei count, GLboolean transpose, const GLdouble *value)
-{
- d_4_0_Core->f.UniformMatrix3dv(location, count, transpose, value);
-}
-
-inline void QOpenGLFunctions_4_4_Core::glUniformMatrix2dv(GLint location, GLsizei count, GLboolean transpose, const GLdouble *value)
-{
- d_4_0_Core->f.UniformMatrix2dv(location, count, transpose, value);
-}
-
-inline void QOpenGLFunctions_4_4_Core::glUniform4dv(GLint location, GLsizei count, const GLdouble *value)
-{
- d_4_0_Core->f.Uniform4dv(location, count, value);
-}
-
-inline void QOpenGLFunctions_4_4_Core::glUniform3dv(GLint location, GLsizei count, const GLdouble *value)
-{
- d_4_0_Core->f.Uniform3dv(location, count, value);
-}
-
-inline void QOpenGLFunctions_4_4_Core::glUniform2dv(GLint location, GLsizei count, const GLdouble *value)
-{
- d_4_0_Core->f.Uniform2dv(location, count, value);
-}
-
-inline void QOpenGLFunctions_4_4_Core::glUniform1dv(GLint location, GLsizei count, const GLdouble *value)
-{
- d_4_0_Core->f.Uniform1dv(location, count, value);
-}
-
-inline void QOpenGLFunctions_4_4_Core::glUniform4d(GLint location, GLdouble x, GLdouble y, GLdouble z, GLdouble w)
-{
- d_4_0_Core->f.Uniform4d(location, x, y, z, w);
-}
-
-inline void QOpenGLFunctions_4_4_Core::glUniform3d(GLint location, GLdouble x, GLdouble y, GLdouble z)
-{
- d_4_0_Core->f.Uniform3d(location, x, y, z);
-}
-
-inline void QOpenGLFunctions_4_4_Core::glUniform2d(GLint location, GLdouble x, GLdouble y)
-{
- d_4_0_Core->f.Uniform2d(location, x, y);
-}
-
-inline void QOpenGLFunctions_4_4_Core::glUniform1d(GLint location, GLdouble x)
-{
- d_4_0_Core->f.Uniform1d(location, x);
-}
-
-inline void QOpenGLFunctions_4_4_Core::glDrawElementsIndirect(GLenum mode, GLenum type, const void *indirect)
-{
- d_4_0_Core->f.DrawElementsIndirect(mode, type, indirect);
-}
-
-inline void QOpenGLFunctions_4_4_Core::glDrawArraysIndirect(GLenum mode, const void *indirect)
-{
- d_4_0_Core->f.DrawArraysIndirect(mode, indirect);
-}
-
-inline void QOpenGLFunctions_4_4_Core::glBlendFuncSeparatei(GLuint buf, GLenum srcRGB, GLenum dstRGB, GLenum srcAlpha, GLenum dstAlpha)
-{
- d_4_0_Core->f.BlendFuncSeparatei(buf, srcRGB, dstRGB, srcAlpha, dstAlpha);
-}
-
-inline void QOpenGLFunctions_4_4_Core::glBlendFunci(GLuint buf, GLenum src, GLenum dst)
-{
- d_4_0_Core->f.BlendFunci(buf, src, dst);
-}
-
-inline void QOpenGLFunctions_4_4_Core::glBlendEquationSeparatei(GLuint buf, GLenum modeRGB, GLenum modeAlpha)
-{
- d_4_0_Core->f.BlendEquationSeparatei(buf, modeRGB, modeAlpha);
-}
-
-inline void QOpenGLFunctions_4_4_Core::glBlendEquationi(GLuint buf, GLenum mode)
-{
- d_4_0_Core->f.BlendEquationi(buf, mode);
-}
-
-inline void QOpenGLFunctions_4_4_Core::glMinSampleShading(GLfloat value)
-{
- d_4_0_Core->f.MinSampleShading(value);
-}
-
-
-// OpenGL 4.1 core functions
-inline void QOpenGLFunctions_4_4_Core::glGetDoublei_v(GLenum target, GLuint index, GLdouble *data)
-{
- d_4_1_Core->f.GetDoublei_v(target, index, data);
-}
-
-inline void QOpenGLFunctions_4_4_Core::glGetFloati_v(GLenum target, GLuint index, GLfloat *data)
-{
- d_4_1_Core->f.GetFloati_v(target, index, data);
-}
-
-inline void QOpenGLFunctions_4_4_Core::glDepthRangeIndexed(GLuint index, GLdouble n, GLdouble f)
-{
- d_4_1_Core->f.DepthRangeIndexed(index, n, f);
-}
-
-inline void QOpenGLFunctions_4_4_Core::glDepthRangeArrayv(GLuint first, GLsizei count, const GLdouble *v)
-{
- d_4_1_Core->f.DepthRangeArrayv(first, count, v);
-}
-
-inline void QOpenGLFunctions_4_4_Core::glScissorIndexedv(GLuint index, const GLint *v)
-{
- d_4_1_Core->f.ScissorIndexedv(index, v);
-}
-
-inline void QOpenGLFunctions_4_4_Core::glScissorIndexed(GLuint index, GLint left, GLint bottom, GLsizei width, GLsizei height)
-{
- d_4_1_Core->f.ScissorIndexed(index, left, bottom, width, height);
-}
-
-inline void QOpenGLFunctions_4_4_Core::glScissorArrayv(GLuint first, GLsizei count, const GLint *v)
-{
- d_4_1_Core->f.ScissorArrayv(first, count, v);
-}
-
-inline void QOpenGLFunctions_4_4_Core::glViewportIndexedfv(GLuint index, const GLfloat *v)
-{
- d_4_1_Core->f.ViewportIndexedfv(index, v);
-}
-
-inline void QOpenGLFunctions_4_4_Core::glViewportIndexedf(GLuint index, GLfloat x, GLfloat y, GLfloat w, GLfloat h)
-{
- d_4_1_Core->f.ViewportIndexedf(index, x, y, w, h);
-}
-
-inline void QOpenGLFunctions_4_4_Core::glViewportArrayv(GLuint first, GLsizei count, const GLfloat *v)
-{
- d_4_1_Core->f.ViewportArrayv(first, count, v);
-}
-
-inline void QOpenGLFunctions_4_4_Core::glGetVertexAttribLdv(GLuint index, GLenum pname, GLdouble *params)
-{
- d_4_1_Core->f.GetVertexAttribLdv(index, pname, params);
-}
-
-inline void QOpenGLFunctions_4_4_Core::glVertexAttribLPointer(GLuint index, GLint size, GLenum type, GLsizei stride, const void *pointer)
-{
- d_4_1_Core->f.VertexAttribLPointer(index, size, type, stride, pointer);
-}
-
-inline void QOpenGLFunctions_4_4_Core::glVertexAttribL4dv(GLuint index, const GLdouble *v)
-{
- d_4_1_Core->f.VertexAttribL4dv(index, v);
-}
-
-inline void QOpenGLFunctions_4_4_Core::glVertexAttribL3dv(GLuint index, const GLdouble *v)
-{
- d_4_1_Core->f.VertexAttribL3dv(index, v);
-}
-
-inline void QOpenGLFunctions_4_4_Core::glVertexAttribL2dv(GLuint index, const GLdouble *v)
-{
- d_4_1_Core->f.VertexAttribL2dv(index, v);
-}
-
-inline void QOpenGLFunctions_4_4_Core::glVertexAttribL1dv(GLuint index, const GLdouble *v)
-{
- d_4_1_Core->f.VertexAttribL1dv(index, v);
-}
-
-inline void QOpenGLFunctions_4_4_Core::glVertexAttribL4d(GLuint index, GLdouble x, GLdouble y, GLdouble z, GLdouble w)
-{
- d_4_1_Core->f.VertexAttribL4d(index, x, y, z, w);
-}
-
-inline void QOpenGLFunctions_4_4_Core::glVertexAttribL3d(GLuint index, GLdouble x, GLdouble y, GLdouble z)
-{
- d_4_1_Core->f.VertexAttribL3d(index, x, y, z);
-}
-
-inline void QOpenGLFunctions_4_4_Core::glVertexAttribL2d(GLuint index, GLdouble x, GLdouble y)
-{
- d_4_1_Core->f.VertexAttribL2d(index, x, y);
-}
-
-inline void QOpenGLFunctions_4_4_Core::glVertexAttribL1d(GLuint index, GLdouble x)
-{
- d_4_1_Core->f.VertexAttribL1d(index, x);
-}
-
-inline void QOpenGLFunctions_4_4_Core::glGetProgramPipelineInfoLog(GLuint pipeline, GLsizei bufSize, GLsizei *length, GLchar *infoLog)
-{
- d_4_1_Core->f.GetProgramPipelineInfoLog(pipeline, bufSize, length, infoLog);
-}
-
-inline void QOpenGLFunctions_4_4_Core::glValidateProgramPipeline(GLuint pipeline)
-{
- d_4_1_Core->f.ValidateProgramPipeline(pipeline);
-}
-
-inline void QOpenGLFunctions_4_4_Core::glProgramUniformMatrix4x3dv(GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLdouble *value)
-{
- d_4_1_Core->f.ProgramUniformMatrix4x3dv(program, location, count, transpose, value);
-}
-
-inline void QOpenGLFunctions_4_4_Core::glProgramUniformMatrix3x4dv(GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLdouble *value)
-{
- d_4_1_Core->f.ProgramUniformMatrix3x4dv(program, location, count, transpose, value);
-}
-
-inline void QOpenGLFunctions_4_4_Core::glProgramUniformMatrix4x2dv(GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLdouble *value)
-{
- d_4_1_Core->f.ProgramUniformMatrix4x2dv(program, location, count, transpose, value);
-}
-
-inline void QOpenGLFunctions_4_4_Core::glProgramUniformMatrix2x4dv(GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLdouble *value)
-{
- d_4_1_Core->f.ProgramUniformMatrix2x4dv(program, location, count, transpose, value);
-}
-
-inline void QOpenGLFunctions_4_4_Core::glProgramUniformMatrix3x2dv(GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLdouble *value)
-{
- d_4_1_Core->f.ProgramUniformMatrix3x2dv(program, location, count, transpose, value);
-}
-
-inline void QOpenGLFunctions_4_4_Core::glProgramUniformMatrix2x3dv(GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLdouble *value)
-{
- d_4_1_Core->f.ProgramUniformMatrix2x3dv(program, location, count, transpose, value);
-}
-
-inline void QOpenGLFunctions_4_4_Core::glProgramUniformMatrix4x3fv(GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value)
-{
- d_4_1_Core->f.ProgramUniformMatrix4x3fv(program, location, count, transpose, value);
-}
-
-inline void QOpenGLFunctions_4_4_Core::glProgramUniformMatrix3x4fv(GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value)
-{
- d_4_1_Core->f.ProgramUniformMatrix3x4fv(program, location, count, transpose, value);
-}
-
-inline void QOpenGLFunctions_4_4_Core::glProgramUniformMatrix4x2fv(GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value)
-{
- d_4_1_Core->f.ProgramUniformMatrix4x2fv(program, location, count, transpose, value);
-}
-
-inline void QOpenGLFunctions_4_4_Core::glProgramUniformMatrix2x4fv(GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value)
-{
- d_4_1_Core->f.ProgramUniformMatrix2x4fv(program, location, count, transpose, value);
-}
-
-inline void QOpenGLFunctions_4_4_Core::glProgramUniformMatrix3x2fv(GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value)
-{
- d_4_1_Core->f.ProgramUniformMatrix3x2fv(program, location, count, transpose, value);
-}
-
-inline void QOpenGLFunctions_4_4_Core::glProgramUniformMatrix2x3fv(GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value)
-{
- d_4_1_Core->f.ProgramUniformMatrix2x3fv(program, location, count, transpose, value);
-}
-
-inline void QOpenGLFunctions_4_4_Core::glProgramUniformMatrix4dv(GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLdouble *value)
-{
- d_4_1_Core->f.ProgramUniformMatrix4dv(program, location, count, transpose, value);
-}
-
-inline void QOpenGLFunctions_4_4_Core::glProgramUniformMatrix3dv(GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLdouble *value)
-{
- d_4_1_Core->f.ProgramUniformMatrix3dv(program, location, count, transpose, value);
-}
-
-inline void QOpenGLFunctions_4_4_Core::glProgramUniformMatrix2dv(GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLdouble *value)
-{
- d_4_1_Core->f.ProgramUniformMatrix2dv(program, location, count, transpose, value);
-}
-
-inline void QOpenGLFunctions_4_4_Core::glProgramUniformMatrix4fv(GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value)
-{
- d_4_1_Core->f.ProgramUniformMatrix4fv(program, location, count, transpose, value);
-}
-
-inline void QOpenGLFunctions_4_4_Core::glProgramUniformMatrix3fv(GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value)
-{
- d_4_1_Core->f.ProgramUniformMatrix3fv(program, location, count, transpose, value);
-}
-
-inline void QOpenGLFunctions_4_4_Core::glProgramUniformMatrix2fv(GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value)
-{
- d_4_1_Core->f.ProgramUniformMatrix2fv(program, location, count, transpose, value);
-}
-
-inline void QOpenGLFunctions_4_4_Core::glProgramUniform4uiv(GLuint program, GLint location, GLsizei count, const GLuint *value)
-{
- d_4_1_Core->f.ProgramUniform4uiv(program, location, count, value);
-}
-
-inline void QOpenGLFunctions_4_4_Core::glProgramUniform4ui(GLuint program, GLint location, GLuint v0, GLuint v1, GLuint v2, GLuint v3)
-{
- d_4_1_Core->f.ProgramUniform4ui(program, location, v0, v1, v2, v3);
-}
-
-inline void QOpenGLFunctions_4_4_Core::glProgramUniform4dv(GLuint program, GLint location, GLsizei count, const GLdouble *value)
-{
- d_4_1_Core->f.ProgramUniform4dv(program, location, count, value);
-}
-
-inline void QOpenGLFunctions_4_4_Core::glProgramUniform4d(GLuint program, GLint location, GLdouble v0, GLdouble v1, GLdouble v2, GLdouble v3)
-{
- d_4_1_Core->f.ProgramUniform4d(program, location, v0, v1, v2, v3);
-}
-
-inline void QOpenGLFunctions_4_4_Core::glProgramUniform4fv(GLuint program, GLint location, GLsizei count, const GLfloat *value)
-{
- d_4_1_Core->f.ProgramUniform4fv(program, location, count, value);
-}
-
-inline void QOpenGLFunctions_4_4_Core::glProgramUniform4f(GLuint program, GLint location, GLfloat v0, GLfloat v1, GLfloat v2, GLfloat v3)
-{
- d_4_1_Core->f.ProgramUniform4f(program, location, v0, v1, v2, v3);
-}
-
-inline void QOpenGLFunctions_4_4_Core::glProgramUniform4iv(GLuint program, GLint location, GLsizei count, const GLint *value)
-{
- d_4_1_Core->f.ProgramUniform4iv(program, location, count, value);
-}
-
-inline void QOpenGLFunctions_4_4_Core::glProgramUniform4i(GLuint program, GLint location, GLint v0, GLint v1, GLint v2, GLint v3)
-{
- d_4_1_Core->f.ProgramUniform4i(program, location, v0, v1, v2, v3);
-}
-
-inline void QOpenGLFunctions_4_4_Core::glProgramUniform3uiv(GLuint program, GLint location, GLsizei count, const GLuint *value)
-{
- d_4_1_Core->f.ProgramUniform3uiv(program, location, count, value);
-}
-
-inline void QOpenGLFunctions_4_4_Core::glProgramUniform3ui(GLuint program, GLint location, GLuint v0, GLuint v1, GLuint v2)
-{
- d_4_1_Core->f.ProgramUniform3ui(program, location, v0, v1, v2);
-}
-
-inline void QOpenGLFunctions_4_4_Core::glProgramUniform3dv(GLuint program, GLint location, GLsizei count, const GLdouble *value)
-{
- d_4_1_Core->f.ProgramUniform3dv(program, location, count, value);
-}
-
-inline void QOpenGLFunctions_4_4_Core::glProgramUniform3d(GLuint program, GLint location, GLdouble v0, GLdouble v1, GLdouble v2)
-{
- d_4_1_Core->f.ProgramUniform3d(program, location, v0, v1, v2);
-}
-
-inline void QOpenGLFunctions_4_4_Core::glProgramUniform3fv(GLuint program, GLint location, GLsizei count, const GLfloat *value)
-{
- d_4_1_Core->f.ProgramUniform3fv(program, location, count, value);
-}
-
-inline void QOpenGLFunctions_4_4_Core::glProgramUniform3f(GLuint program, GLint location, GLfloat v0, GLfloat v1, GLfloat v2)
-{
- d_4_1_Core->f.ProgramUniform3f(program, location, v0, v1, v2);
-}
-
-inline void QOpenGLFunctions_4_4_Core::glProgramUniform3iv(GLuint program, GLint location, GLsizei count, const GLint *value)
-{
- d_4_1_Core->f.ProgramUniform3iv(program, location, count, value);
-}
-
-inline void QOpenGLFunctions_4_4_Core::glProgramUniform3i(GLuint program, GLint location, GLint v0, GLint v1, GLint v2)
-{
- d_4_1_Core->f.ProgramUniform3i(program, location, v0, v1, v2);
-}
-
-inline void QOpenGLFunctions_4_4_Core::glProgramUniform2uiv(GLuint program, GLint location, GLsizei count, const GLuint *value)
-{
- d_4_1_Core->f.ProgramUniform2uiv(program, location, count, value);
-}
-
-inline void QOpenGLFunctions_4_4_Core::glProgramUniform2ui(GLuint program, GLint location, GLuint v0, GLuint v1)
-{
- d_4_1_Core->f.ProgramUniform2ui(program, location, v0, v1);
-}
-
-inline void QOpenGLFunctions_4_4_Core::glProgramUniform2dv(GLuint program, GLint location, GLsizei count, const GLdouble *value)
-{
- d_4_1_Core->f.ProgramUniform2dv(program, location, count, value);
-}
-
-inline void QOpenGLFunctions_4_4_Core::glProgramUniform2d(GLuint program, GLint location, GLdouble v0, GLdouble v1)
-{
- d_4_1_Core->f.ProgramUniform2d(program, location, v0, v1);
-}
-
-inline void QOpenGLFunctions_4_4_Core::glProgramUniform2fv(GLuint program, GLint location, GLsizei count, const GLfloat *value)
-{
- d_4_1_Core->f.ProgramUniform2fv(program, location, count, value);
-}
-
-inline void QOpenGLFunctions_4_4_Core::glProgramUniform2f(GLuint program, GLint location, GLfloat v0, GLfloat v1)
-{
- d_4_1_Core->f.ProgramUniform2f(program, location, v0, v1);
-}
-
-inline void QOpenGLFunctions_4_4_Core::glProgramUniform2iv(GLuint program, GLint location, GLsizei count, const GLint *value)
-{
- d_4_1_Core->f.ProgramUniform2iv(program, location, count, value);
-}
-
-inline void QOpenGLFunctions_4_4_Core::glProgramUniform2i(GLuint program, GLint location, GLint v0, GLint v1)
-{
- d_4_1_Core->f.ProgramUniform2i(program, location, v0, v1);
-}
-
-inline void QOpenGLFunctions_4_4_Core::glProgramUniform1uiv(GLuint program, GLint location, GLsizei count, const GLuint *value)
-{
- d_4_1_Core->f.ProgramUniform1uiv(program, location, count, value);
-}
-
-inline void QOpenGLFunctions_4_4_Core::glProgramUniform1ui(GLuint program, GLint location, GLuint v0)
-{
- d_4_1_Core->f.ProgramUniform1ui(program, location, v0);
-}
-
-inline void QOpenGLFunctions_4_4_Core::glProgramUniform1dv(GLuint program, GLint location, GLsizei count, const GLdouble *value)
-{
- d_4_1_Core->f.ProgramUniform1dv(program, location, count, value);
-}
-
-inline void QOpenGLFunctions_4_4_Core::glProgramUniform1d(GLuint program, GLint location, GLdouble v0)
-{
- d_4_1_Core->f.ProgramUniform1d(program, location, v0);
-}
-
-inline void QOpenGLFunctions_4_4_Core::glProgramUniform1fv(GLuint program, GLint location, GLsizei count, const GLfloat *value)
-{
- d_4_1_Core->f.ProgramUniform1fv(program, location, count, value);
-}
-
-inline void QOpenGLFunctions_4_4_Core::glProgramUniform1f(GLuint program, GLint location, GLfloat v0)
-{
- d_4_1_Core->f.ProgramUniform1f(program, location, v0);
-}
-
-inline void QOpenGLFunctions_4_4_Core::glProgramUniform1iv(GLuint program, GLint location, GLsizei count, const GLint *value)
-{
- d_4_1_Core->f.ProgramUniform1iv(program, location, count, value);
-}
-
-inline void QOpenGLFunctions_4_4_Core::glProgramUniform1i(GLuint program, GLint location, GLint v0)
-{
- d_4_1_Core->f.ProgramUniform1i(program, location, v0);
-}
-
-inline void QOpenGLFunctions_4_4_Core::glGetProgramPipelineiv(GLuint pipeline, GLenum pname, GLint *params)
-{
- d_4_1_Core->f.GetProgramPipelineiv(pipeline, pname, params);
-}
-
-inline GLboolean QOpenGLFunctions_4_4_Core::glIsProgramPipeline(GLuint pipeline)
-{
- return d_4_1_Core->f.IsProgramPipeline(pipeline);
-}
-
-inline void QOpenGLFunctions_4_4_Core::glGenProgramPipelines(GLsizei n, GLuint *pipelines)
-{
- d_4_1_Core->f.GenProgramPipelines(n, pipelines);
-}
-
-inline void QOpenGLFunctions_4_4_Core::glDeleteProgramPipelines(GLsizei n, const GLuint *pipelines)
-{
- d_4_1_Core->f.DeleteProgramPipelines(n, pipelines);
-}
-
-inline void QOpenGLFunctions_4_4_Core::glBindProgramPipeline(GLuint pipeline)
-{
- d_4_1_Core->f.BindProgramPipeline(pipeline);
-}
-
-inline GLuint QOpenGLFunctions_4_4_Core::glCreateShaderProgramv(GLenum type, GLsizei count, const GLchar *const *strings)
-{
- return d_4_1_Core->f.CreateShaderProgramv(type, count, strings);
-}
-
-inline void QOpenGLFunctions_4_4_Core::glActiveShaderProgram(GLuint pipeline, GLuint program)
-{
- d_4_1_Core->f.ActiveShaderProgram(pipeline, program);
-}
-
-inline void QOpenGLFunctions_4_4_Core::glUseProgramStages(GLuint pipeline, GLbitfield stages, GLuint program)
-{
- d_4_1_Core->f.UseProgramStages(pipeline, stages, program);
-}
-
-inline void QOpenGLFunctions_4_4_Core::glProgramParameteri(GLuint program, GLenum pname, GLint value)
-{
- d_4_1_Core->f.ProgramParameteri(program, pname, value);
-}
-
-inline void QOpenGLFunctions_4_4_Core::glProgramBinary(GLuint program, GLenum binaryFormat, const void *binary, GLsizei length)
-{
- d_4_1_Core->f.ProgramBinary(program, binaryFormat, binary, length);
-}
-
-inline void QOpenGLFunctions_4_4_Core::glGetProgramBinary(GLuint program, GLsizei bufSize, GLsizei *length, GLenum *binaryFormat, void *binary)
-{
- d_4_1_Core->f.GetProgramBinary(program, bufSize, length, binaryFormat, binary);
-}
-
-inline void QOpenGLFunctions_4_4_Core::glClearDepthf(GLfloat dd)
-{
- d_4_1_Core->f.ClearDepthf(dd);
-}
-
-inline void QOpenGLFunctions_4_4_Core::glDepthRangef(GLfloat n, GLfloat f)
-{
- d_4_1_Core->f.DepthRangef(n, f);
-}
-
-inline void QOpenGLFunctions_4_4_Core::glGetShaderPrecisionFormat(GLenum shadertype, GLenum precisiontype, GLint *range, GLint *precision)
-{
- d_4_1_Core->f.GetShaderPrecisionFormat(shadertype, precisiontype, range, precision);
-}
-
-inline void QOpenGLFunctions_4_4_Core::glShaderBinary(GLsizei count, const GLuint *shaders, GLenum binaryformat, const void *binary, GLsizei length)
-{
- d_4_1_Core->f.ShaderBinary(count, shaders, binaryformat, binary, length);
-}
-
-inline void QOpenGLFunctions_4_4_Core::glReleaseShaderCompiler()
-{
- d_4_1_Core->f.ReleaseShaderCompiler();
-}
-
-
-// OpenGL 4.2 core functions
-inline void QOpenGLFunctions_4_4_Core::glDrawTransformFeedbackStreamInstanced(GLenum mode, GLuint id, GLuint stream, GLsizei instancecount)
-{
- d_4_2_Core->f.DrawTransformFeedbackStreamInstanced(mode, id, stream, instancecount);
-}
-
-inline void QOpenGLFunctions_4_4_Core::glDrawTransformFeedbackInstanced(GLenum mode, GLuint id, GLsizei instancecount)
-{
- d_4_2_Core->f.DrawTransformFeedbackInstanced(mode, id, instancecount);
-}
-
-inline void QOpenGLFunctions_4_4_Core::glTexStorage3D(GLenum target, GLsizei levels, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth)
-{
- d_4_2_Core->f.TexStorage3D(target, levels, internalformat, width, height, depth);
-}
-
-inline void QOpenGLFunctions_4_4_Core::glTexStorage2D(GLenum target, GLsizei levels, GLenum internalformat, GLsizei width, GLsizei height)
-{
- d_4_2_Core->f.TexStorage2D(target, levels, internalformat, width, height);
-}
-
-inline void QOpenGLFunctions_4_4_Core::glTexStorage1D(GLenum target, GLsizei levels, GLenum internalformat, GLsizei width)
-{
- d_4_2_Core->f.TexStorage1D(target, levels, internalformat, width);
-}
-
-inline void QOpenGLFunctions_4_4_Core::glMemoryBarrier(GLbitfield barriers)
-{
- d_4_2_Core->f.MemoryBarrier(barriers);
-}
-
-inline void QOpenGLFunctions_4_4_Core::glBindImageTexture(GLuint unit, GLuint texture, GLint level, GLboolean layered, GLint layer, GLenum access, GLenum format)
-{
- d_4_2_Core->f.BindImageTexture(unit, texture, level, layered, layer, access, format);
-}
-
-inline void QOpenGLFunctions_4_4_Core::glGetActiveAtomicCounterBufferiv(GLuint program, GLuint bufferIndex, GLenum pname, GLint *params)
-{
- d_4_2_Core->f.GetActiveAtomicCounterBufferiv(program, bufferIndex, pname, params);
-}
-
-inline void QOpenGLFunctions_4_4_Core::glGetInternalformativ(GLenum target, GLenum internalformat, GLenum pname, GLsizei bufSize, GLint *params)
-{
- d_4_2_Core->f.GetInternalformativ(target, internalformat, pname, bufSize, params);
-}
-
-inline void QOpenGLFunctions_4_4_Core::glDrawElementsInstancedBaseVertexBaseInstance(GLenum mode, GLsizei count, GLenum type, const void *indices, GLsizei instancecount, GLint basevertex, GLuint baseinstance)
-{
- d_4_2_Core->f.DrawElementsInstancedBaseVertexBaseInstance(mode, count, type, indices, instancecount, basevertex, baseinstance);
-}
-
-inline void QOpenGLFunctions_4_4_Core::glDrawElementsInstancedBaseInstance(GLenum mode, GLsizei count, GLenum type, const void *indices, GLsizei instancecount, GLuint baseinstance)
-{
- d_4_2_Core->f.DrawElementsInstancedBaseInstance(mode, count, type, indices, instancecount, baseinstance);
-}
-
-inline void QOpenGLFunctions_4_4_Core::glDrawArraysInstancedBaseInstance(GLenum mode, GLint first, GLsizei count, GLsizei instancecount, GLuint baseinstance)
-{
- d_4_2_Core->f.DrawArraysInstancedBaseInstance(mode, first, count, instancecount, baseinstance);
-}
-
-
-// OpenGL 4.3 core functions
-inline void QOpenGLFunctions_4_4_Core::glGetObjectPtrLabel(const void *ptr, GLsizei bufSize, GLsizei *length, GLchar *label)
-{
- d_4_3_Core->f.GetObjectPtrLabel(ptr, bufSize, length, label);
-}
-
-inline void QOpenGLFunctions_4_4_Core::glObjectPtrLabel(const void *ptr, GLsizei length, const GLchar *label)
-{
- d_4_3_Core->f.ObjectPtrLabel(ptr, length, label);
-}
-
-inline void QOpenGLFunctions_4_4_Core::glGetObjectLabel(GLenum identifier, GLuint name, GLsizei bufSize, GLsizei *length, GLchar *label)
-{
- d_4_3_Core->f.GetObjectLabel(identifier, name, bufSize, length, label);
-}
-
-inline void QOpenGLFunctions_4_4_Core::glObjectLabel(GLenum identifier, GLuint name, GLsizei length, const GLchar *label)
-{
- d_4_3_Core->f.ObjectLabel(identifier, name, length, label);
-}
-
-inline void QOpenGLFunctions_4_4_Core::glPopDebugGroup()
-{
- d_4_3_Core->f.PopDebugGroup();
-}
-
-inline void QOpenGLFunctions_4_4_Core::glPushDebugGroup(GLenum source, GLuint id, GLsizei length, const GLchar *message)
-{
- d_4_3_Core->f.PushDebugGroup(source, id, length, message);
-}
-
-inline GLuint QOpenGLFunctions_4_4_Core::glGetDebugMessageLog(GLuint count, GLsizei bufSize, GLenum *sources, GLenum *types, GLuint *ids, GLenum *severities, GLsizei *lengths, GLchar *messageLog)
-{
- return d_4_3_Core->f.GetDebugMessageLog(count, bufSize, sources, types, ids, severities, lengths, messageLog);
-}
-
-inline void QOpenGLFunctions_4_4_Core::glDebugMessageCallback(GLDEBUGPROC callback, const void *userParam)
-{
- d_4_3_Core->f.DebugMessageCallback(callback, userParam);
-}
-
-inline void QOpenGLFunctions_4_4_Core::glDebugMessageInsert(GLenum source, GLenum type, GLuint id, GLenum severity, GLsizei length, const GLchar *buf)
-{
- d_4_3_Core->f.DebugMessageInsert(source, type, id, severity, length, buf);
-}
-
-inline void QOpenGLFunctions_4_4_Core::glDebugMessageControl(GLenum source, GLenum type, GLenum severity, GLsizei count, const GLuint *ids, GLboolean enabled)
-{
- d_4_3_Core->f.DebugMessageControl(source, type, severity, count, ids, enabled);
-}
-
-inline void QOpenGLFunctions_4_4_Core::glVertexBindingDivisor(GLuint bindingindex, GLuint divisor)
-{
- d_4_3_Core->f.VertexBindingDivisor(bindingindex, divisor);
-}
-
-inline void QOpenGLFunctions_4_4_Core::glVertexAttribBinding(GLuint attribindex, GLuint bindingindex)
-{
- d_4_3_Core->f.VertexAttribBinding(attribindex, bindingindex);
-}
-
-inline void QOpenGLFunctions_4_4_Core::glVertexAttribLFormat(GLuint attribindex, GLint size, GLenum type, GLuint relativeoffset)
-{
- d_4_3_Core->f.VertexAttribLFormat(attribindex, size, type, relativeoffset);
-}
-
-inline void QOpenGLFunctions_4_4_Core::glVertexAttribIFormat(GLuint attribindex, GLint size, GLenum type, GLuint relativeoffset)
-{
- d_4_3_Core->f.VertexAttribIFormat(attribindex, size, type, relativeoffset);
-}
-
-inline void QOpenGLFunctions_4_4_Core::glVertexAttribFormat(GLuint attribindex, GLint size, GLenum type, GLboolean normalized, GLuint relativeoffset)
-{
- d_4_3_Core->f.VertexAttribFormat(attribindex, size, type, normalized, relativeoffset);
-}
-
-inline void QOpenGLFunctions_4_4_Core::glBindVertexBuffer(GLuint bindingindex, GLuint buffer, GLintptr offset, GLsizei stride)
-{
- d_4_3_Core->f.BindVertexBuffer(bindingindex, buffer, offset, stride);
-}
-
-inline void QOpenGLFunctions_4_4_Core::glTextureView(GLuint texture, GLenum target, GLuint origtexture, GLenum internalformat, GLuint minlevel, GLuint numlevels, GLuint minlayer, GLuint numlayers)
-{
- d_4_3_Core->f.TextureView(texture, target, origtexture, internalformat, minlevel, numlevels, minlayer, numlayers);
-}
-
-inline void QOpenGLFunctions_4_4_Core::glTexStorage3DMultisample(GLenum target, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth, GLboolean fixedsamplelocations)
-{
- d_4_3_Core->f.TexStorage3DMultisample(target, samples, internalformat, width, height, depth, fixedsamplelocations);
-}
-
-inline void QOpenGLFunctions_4_4_Core::glTexStorage2DMultisample(GLenum target, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height, GLboolean fixedsamplelocations)
-{
- d_4_3_Core->f.TexStorage2DMultisample(target, samples, internalformat, width, height, fixedsamplelocations);
-}
-
-inline void QOpenGLFunctions_4_4_Core::glTexBufferRange(GLenum target, GLenum internalformat, GLuint buffer, GLintptr offset, GLsizeiptr size)
-{
- d_4_3_Core->f.TexBufferRange(target, internalformat, buffer, offset, size);
-}
-
-inline void QOpenGLFunctions_4_4_Core::glShaderStorageBlockBinding(GLuint program, GLuint storageBlockIndex, GLuint storageBlockBinding)
-{
- d_4_3_Core->f.ShaderStorageBlockBinding(program, storageBlockIndex, storageBlockBinding);
-}
-
-inline GLint QOpenGLFunctions_4_4_Core::glGetProgramResourceLocationIndex(GLuint program, GLenum programInterface, const GLchar *name)
-{
- return d_4_3_Core->f.GetProgramResourceLocationIndex(program, programInterface, name);
-}
-
-inline GLint QOpenGLFunctions_4_4_Core::glGetProgramResourceLocation(GLuint program, GLenum programInterface, const GLchar *name)
-{
- return d_4_3_Core->f.GetProgramResourceLocation(program, programInterface, name);
-}
-
-inline void QOpenGLFunctions_4_4_Core::glGetProgramResourceiv(GLuint program, GLenum programInterface, GLuint index, GLsizei propCount, const GLenum *props, GLsizei bufSize, GLsizei *length, GLint *params)
-{
- d_4_3_Core->f.GetProgramResourceiv(program, programInterface, index, propCount, props, bufSize, length, params);
-}
-
-inline void QOpenGLFunctions_4_4_Core::glGetProgramResourceName(GLuint program, GLenum programInterface, GLuint index, GLsizei bufSize, GLsizei *length, GLchar *name)
-{
- d_4_3_Core->f.GetProgramResourceName(program, programInterface, index, bufSize, length, name);
-}
-
-inline GLuint QOpenGLFunctions_4_4_Core::glGetProgramResourceIndex(GLuint program, GLenum programInterface, const GLchar *name)
-{
- return d_4_3_Core->f.GetProgramResourceIndex(program, programInterface, name);
-}
-
-inline void QOpenGLFunctions_4_4_Core::glGetProgramInterfaceiv(GLuint program, GLenum programInterface, GLenum pname, GLint *params)
-{
- d_4_3_Core->f.GetProgramInterfaceiv(program, programInterface, pname, params);
-}
-
-inline void QOpenGLFunctions_4_4_Core::glMultiDrawElementsIndirect(GLenum mode, GLenum type, const void *indirect, GLsizei drawcount, GLsizei stride)
-{
- d_4_3_Core->f.MultiDrawElementsIndirect(mode, type, indirect, drawcount, stride);
-}
-
-inline void QOpenGLFunctions_4_4_Core::glMultiDrawArraysIndirect(GLenum mode, const void *indirect, GLsizei drawcount, GLsizei stride)
-{
- d_4_3_Core->f.MultiDrawArraysIndirect(mode, indirect, drawcount, stride);
-}
-
-inline void QOpenGLFunctions_4_4_Core::glInvalidateSubFramebuffer(GLenum target, GLsizei numAttachments, const GLenum *attachments, GLint x, GLint y, GLsizei width, GLsizei height)
-{
- d_4_3_Core->f.InvalidateSubFramebuffer(target, numAttachments, attachments, x, y, width, height);
-}
-
-inline void QOpenGLFunctions_4_4_Core::glInvalidateFramebuffer(GLenum target, GLsizei numAttachments, const GLenum *attachments)
-{
- d_4_3_Core->f.InvalidateFramebuffer(target, numAttachments, attachments);
-}
-
-inline void QOpenGLFunctions_4_4_Core::glInvalidateBufferData(GLuint buffer)
-{
- d_4_3_Core->f.InvalidateBufferData(buffer);
-}
-
-inline void QOpenGLFunctions_4_4_Core::glInvalidateBufferSubData(GLuint buffer, GLintptr offset, GLsizeiptr length)
-{
- d_4_3_Core->f.InvalidateBufferSubData(buffer, offset, length);
-}
-
-inline void QOpenGLFunctions_4_4_Core::glInvalidateTexImage(GLuint texture, GLint level)
-{
- d_4_3_Core->f.InvalidateTexImage(texture, level);
-}
-
-inline void QOpenGLFunctions_4_4_Core::glInvalidateTexSubImage(GLuint texture, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth)
-{
- d_4_3_Core->f.InvalidateTexSubImage(texture, level, xoffset, yoffset, zoffset, width, height, depth);
-}
-
-inline void QOpenGLFunctions_4_4_Core::glGetInternalformati64v(GLenum target, GLenum internalformat, GLenum pname, GLsizei bufSize, GLint64 *params)
-{
- d_4_3_Core->f.GetInternalformati64v(target, internalformat, pname, bufSize, params);
-}
-
-inline void QOpenGLFunctions_4_4_Core::glGetFramebufferParameteriv(GLenum target, GLenum pname, GLint *params)
-{
- d_4_3_Core->f.GetFramebufferParameteriv(target, pname, params);
-}
-
-inline void QOpenGLFunctions_4_4_Core::glFramebufferParameteri(GLenum target, GLenum pname, GLint param)
-{
- d_4_3_Core->f.FramebufferParameteri(target, pname, param);
-}
-
-inline void QOpenGLFunctions_4_4_Core::glCopyImageSubData(GLuint srcName, GLenum srcTarget, GLint srcLevel, GLint srcX, GLint srcY, GLint srcZ, GLuint dstName, GLenum dstTarget, GLint dstLevel, GLint dstX, GLint dstY, GLint dstZ, GLsizei srcWidth, GLsizei srcHeight, GLsizei srcDepth)
-{
- d_4_3_Core->f.CopyImageSubData(srcName, srcTarget, srcLevel, srcX, srcY, srcZ, dstName, dstTarget, dstLevel, dstX, dstY, dstZ, srcWidth, srcHeight, srcDepth);
-}
-
-inline void QOpenGLFunctions_4_4_Core::glDispatchComputeIndirect(GLintptr indirect)
-{
- d_4_3_Core->f.DispatchComputeIndirect(indirect);
-}
-
-inline void QOpenGLFunctions_4_4_Core::glDispatchCompute(GLuint num_groups_x, GLuint num_groups_y, GLuint num_groups_z)
-{
- d_4_3_Core->f.DispatchCompute(num_groups_x, num_groups_y, num_groups_z);
-}
-
-inline void QOpenGLFunctions_4_4_Core::glClearBufferSubData(GLenum target, GLenum internalformat, GLintptr offset, GLsizeiptr size, GLenum format, GLenum type, const void *data)
-{
- d_4_3_Core->f.ClearBufferSubData(target, internalformat, offset, size, format, type, data);
-}
-
-inline void QOpenGLFunctions_4_4_Core::glClearBufferData(GLenum target, GLenum internalformat, GLenum format, GLenum type, const void *data)
-{
- d_4_3_Core->f.ClearBufferData(target, internalformat, format, type, data);
-}
-
-
-// OpenGL 4.4 core functions
-inline void QOpenGLFunctions_4_4_Core::glBindVertexBuffers(GLuint first, GLsizei count, const GLuint *buffers, const GLintptr *offsets, const GLsizei *strides)
-{
- d_4_4_Core->f.BindVertexBuffers(first, count, buffers, offsets, strides);
-}
-
-inline void QOpenGLFunctions_4_4_Core::glBindImageTextures(GLuint first, GLsizei count, const GLuint *textures)
-{
- d_4_4_Core->f.BindImageTextures(first, count, textures);
-}
-
-inline void QOpenGLFunctions_4_4_Core::glBindSamplers(GLuint first, GLsizei count, const GLuint *samplers)
-{
- d_4_4_Core->f.BindSamplers(first, count, samplers);
-}
-
-inline void QOpenGLFunctions_4_4_Core::glBindTextures(GLuint first, GLsizei count, const GLuint *textures)
-{
- d_4_4_Core->f.BindTextures(first, count, textures);
-}
-
-inline void QOpenGLFunctions_4_4_Core::glBindBuffersRange(GLenum target, GLuint first, GLsizei count, const GLuint *buffers, const GLintptr *offsets, const GLsizeiptr *sizes)
-{
- d_4_4_Core->f.BindBuffersRange(target, first, count, buffers, offsets, sizes);
-}
-
-inline void QOpenGLFunctions_4_4_Core::glBindBuffersBase(GLenum target, GLuint first, GLsizei count, const GLuint *buffers)
-{
- d_4_4_Core->f.BindBuffersBase(target, first, count, buffers);
-}
-
-inline void QOpenGLFunctions_4_4_Core::glClearTexSubImage(GLuint texture, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLenum type, const void *data)
-{
- d_4_4_Core->f.ClearTexSubImage(texture, level, xoffset, yoffset, zoffset, width, height, depth, format, type, data);
-}
-
-inline void QOpenGLFunctions_4_4_Core::glClearTexImage(GLuint texture, GLint level, GLenum format, GLenum type, const void *data)
-{
- d_4_4_Core->f.ClearTexImage(texture, level, format, type, data);
-}
-
-inline void QOpenGLFunctions_4_4_Core::glBufferStorage(GLenum target, GLsizeiptr size, const void *data, GLbitfield flags)
-{
- d_4_4_Core->f.BufferStorage(target, size, data, flags);
-}
-
-
-
-QT_END_NAMESPACE
-
-#ifdef Q_OS_WIN
-#pragma pop_macro("MemoryBarrier")
-#endif
-
-#endif // QT_NO_OPENGL && !QT_OPENGL_ES_2
-
-#endif
diff --git a/src/gui/opengl/qopenglfunctions_4_5_compatibility.cpp b/src/gui/opengl/qopenglfunctions_4_5_compatibility.cpp
deleted file mode 100644
index 02af443498..0000000000
--- a/src/gui/opengl/qopenglfunctions_4_5_compatibility.cpp
+++ /dev/null
@@ -1,344 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2015 Klaralvdalens Datakonsult AB (KDAB)
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the QtGui module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-**
-** This file was generated by glgen version 0.1
-** Command line was: glgen
-**
-** glgen is Copyright (C) 2013 Klaralvdalens Datakonsult AB (KDAB)
-**
-** This is an auto-generated file.
-** Do not edit! All changes made to it will be lost.
-**
-****************************************************************************/
-
-#include "qopenglfunctions_4_5_compatibility.h"
-#include "qopenglcontext.h"
-
-QT_BEGIN_NAMESPACE
-
-/*!
- \class QOpenGLFunctions_4_5_Compatibility
- \inmodule QtGui
- \since 5.5
- \wrapper
- \brief The QOpenGLFunctions_4_5_Compatibility class provides all functions for OpenGL 4.5 compatibility profile.
-
- This class is a wrapper for functions from OpenGL 4.5 compatibility profile.
- See reference pages on \l {http://www.opengl.org/sdk/docs/}{opengl.org}
- for function documentation.
-
- \sa QAbstractOpenGLFunctions
-*/
-
-QOpenGLFunctions_4_5_Compatibility::QOpenGLFunctions_4_5_Compatibility()
- : QAbstractOpenGLFunctions()
- , d_1_0_Core(nullptr)
- , d_1_1_Core(nullptr)
- , d_1_2_Core(nullptr)
- , d_1_3_Core(nullptr)
- , d_1_4_Core(nullptr)
- , d_1_5_Core(nullptr)
- , d_2_0_Core(nullptr)
- , d_2_1_Core(nullptr)
- , d_3_0_Core(nullptr)
- , d_3_1_Core(nullptr)
- , d_3_2_Core(nullptr)
- , d_3_3_Core(nullptr)
- , d_4_0_Core(nullptr)
- , d_4_1_Core(nullptr)
- , d_4_2_Core(nullptr)
- , d_4_3_Core(nullptr)
- , d_4_4_Core(nullptr)
- , d_4_5_Core(nullptr)
- , d_1_0_Deprecated(nullptr)
- , d_1_1_Deprecated(nullptr)
- , d_1_2_Deprecated(nullptr)
- , d_1_3_Deprecated(nullptr)
- , d_1_4_Deprecated(nullptr)
- , d_3_3_Deprecated(nullptr)
- , d_4_5_Deprecated(nullptr)
-{
-}
-
-QOpenGLFunctions_4_5_Compatibility::~QOpenGLFunctions_4_5_Compatibility()
-{
- if (d_1_0_Core) {
- d_1_0_Core->refs.deref();
- Q_ASSERT(d_1_0_Core->refs.loadRelaxed());
- }
- if (d_1_1_Core) {
- d_1_1_Core->refs.deref();
- Q_ASSERT(d_1_1_Core->refs.loadRelaxed());
- }
- if (d_1_2_Core) {
- d_1_2_Core->refs.deref();
- Q_ASSERT(d_1_2_Core->refs.loadRelaxed());
- }
- if (d_1_3_Core) {
- d_1_3_Core->refs.deref();
- Q_ASSERT(d_1_3_Core->refs.loadRelaxed());
- }
- if (d_1_4_Core) {
- d_1_4_Core->refs.deref();
- Q_ASSERT(d_1_4_Core->refs.loadRelaxed());
- }
- if (d_1_5_Core) {
- d_1_5_Core->refs.deref();
- Q_ASSERT(d_1_5_Core->refs.loadRelaxed());
- }
- if (d_2_0_Core) {
- d_2_0_Core->refs.deref();
- Q_ASSERT(d_2_0_Core->refs.loadRelaxed());
- }
- if (d_2_1_Core) {
- d_2_1_Core->refs.deref();
- Q_ASSERT(d_2_1_Core->refs.loadRelaxed());
- }
- if (d_3_0_Core) {
- d_3_0_Core->refs.deref();
- Q_ASSERT(d_3_0_Core->refs.loadRelaxed());
- }
- if (d_3_1_Core) {
- d_3_1_Core->refs.deref();
- Q_ASSERT(d_3_1_Core->refs.loadRelaxed());
- }
- if (d_3_2_Core) {
- d_3_2_Core->refs.deref();
- Q_ASSERT(d_3_2_Core->refs.loadRelaxed());
- }
- if (d_3_3_Core) {
- d_3_3_Core->refs.deref();
- Q_ASSERT(d_3_3_Core->refs.loadRelaxed());
- }
- if (d_4_0_Core) {
- d_4_0_Core->refs.deref();
- Q_ASSERT(d_4_0_Core->refs.loadRelaxed());
- }
- if (d_4_1_Core) {
- d_4_1_Core->refs.deref();
- Q_ASSERT(d_4_1_Core->refs.loadRelaxed());
- }
- if (d_4_2_Core) {
- d_4_2_Core->refs.deref();
- Q_ASSERT(d_4_2_Core->refs.loadRelaxed());
- }
- if (d_4_3_Core) {
- d_4_3_Core->refs.deref();
- Q_ASSERT(d_4_3_Core->refs.loadRelaxed());
- }
- if (d_4_4_Core) {
- d_4_4_Core->refs.deref();
- Q_ASSERT(d_4_4_Core->refs.loadRelaxed());
- }
- if (d_4_5_Core) {
- d_4_5_Core->refs.deref();
- Q_ASSERT(d_4_5_Core->refs.loadRelaxed());
- }
- if (d_1_0_Deprecated) {
- d_1_0_Deprecated->refs.deref();
- Q_ASSERT(d_1_0_Deprecated->refs.loadRelaxed());
- }
- if (d_1_1_Deprecated) {
- d_1_1_Deprecated->refs.deref();
- Q_ASSERT(d_1_1_Deprecated->refs.loadRelaxed());
- }
- if (d_1_2_Deprecated) {
- d_1_2_Deprecated->refs.deref();
- Q_ASSERT(d_1_2_Deprecated->refs.loadRelaxed());
- }
- if (d_1_3_Deprecated) {
- d_1_3_Deprecated->refs.deref();
- Q_ASSERT(d_1_3_Deprecated->refs.loadRelaxed());
- }
- if (d_1_4_Deprecated) {
- d_1_4_Deprecated->refs.deref();
- Q_ASSERT(d_1_4_Deprecated->refs.loadRelaxed());
- }
- if (d_3_3_Deprecated) {
- d_3_3_Deprecated->refs.deref();
- Q_ASSERT(d_3_3_Deprecated->refs.loadRelaxed());
- }
- if (d_4_5_Deprecated) {
- d_4_5_Deprecated->refs.deref();
- Q_ASSERT(d_4_5_Deprecated->refs.loadRelaxed());
- }
-}
-
-bool QOpenGLFunctions_4_5_Compatibility::initializeOpenGLFunctions()
-{
- if ( isInitialized() )
- return true;
-
- QOpenGLContext* context = QOpenGLContext::currentContext();
-
- // If owned by a context object make sure it is current.
- // Also check that current context is capable of resolving all needed functions
- if (((owningContext() && owningContext() == context) || !owningContext())
- && QOpenGLFunctions_4_5_Compatibility::isContextCompatible(context))
- {
- // Associate with private implementation, creating if necessary
- // Function pointers in the backends are resolved at creation time
- QOpenGLVersionFunctionsBackend* d = nullptr;
- d = QAbstractOpenGLFunctionsPrivate::functionsBackend(context, QOpenGLFunctions_1_0_CoreBackend::versionStatus());
- d_1_0_Core = static_cast<QOpenGLFunctions_1_0_CoreBackend*>(d);
- d->refs.ref();
-
- d = QAbstractOpenGLFunctionsPrivate::functionsBackend(context, QOpenGLFunctions_1_1_CoreBackend::versionStatus());
- d_1_1_Core = static_cast<QOpenGLFunctions_1_1_CoreBackend*>(d);
- d->refs.ref();
-
- d = QAbstractOpenGLFunctionsPrivate::functionsBackend(context, QOpenGLFunctions_1_2_CoreBackend::versionStatus());
- d_1_2_Core = static_cast<QOpenGLFunctions_1_2_CoreBackend*>(d);
- d->refs.ref();
-
- d = QAbstractOpenGLFunctionsPrivate::functionsBackend(context, QOpenGLFunctions_1_3_CoreBackend::versionStatus());
- d_1_3_Core = static_cast<QOpenGLFunctions_1_3_CoreBackend*>(d);
- d->refs.ref();
-
- d = QAbstractOpenGLFunctionsPrivate::functionsBackend(context, QOpenGLFunctions_1_4_CoreBackend::versionStatus());
- d_1_4_Core = static_cast<QOpenGLFunctions_1_4_CoreBackend*>(d);
- d->refs.ref();
-
- d = QAbstractOpenGLFunctionsPrivate::functionsBackend(context, QOpenGLFunctions_1_5_CoreBackend::versionStatus());
- d_1_5_Core = static_cast<QOpenGLFunctions_1_5_CoreBackend*>(d);
- d->refs.ref();
-
- d = QAbstractOpenGLFunctionsPrivate::functionsBackend(context, QOpenGLFunctions_2_0_CoreBackend::versionStatus());
- d_2_0_Core = static_cast<QOpenGLFunctions_2_0_CoreBackend*>(d);
- d->refs.ref();
-
- d = QAbstractOpenGLFunctionsPrivate::functionsBackend(context, QOpenGLFunctions_2_1_CoreBackend::versionStatus());
- d_2_1_Core = static_cast<QOpenGLFunctions_2_1_CoreBackend*>(d);
- d->refs.ref();
-
- d = QAbstractOpenGLFunctionsPrivate::functionsBackend(context, QOpenGLFunctions_3_0_CoreBackend::versionStatus());
- d_3_0_Core = static_cast<QOpenGLFunctions_3_0_CoreBackend*>(d);
- d->refs.ref();
-
- d = QAbstractOpenGLFunctionsPrivate::functionsBackend(context, QOpenGLFunctions_3_1_CoreBackend::versionStatus());
- d_3_1_Core = static_cast<QOpenGLFunctions_3_1_CoreBackend*>(d);
- d->refs.ref();
-
- d = QAbstractOpenGLFunctionsPrivate::functionsBackend(context, QOpenGLFunctions_3_2_CoreBackend::versionStatus());
- d_3_2_Core = static_cast<QOpenGLFunctions_3_2_CoreBackend*>(d);
- d->refs.ref();
-
- d = QAbstractOpenGLFunctionsPrivate::functionsBackend(context, QOpenGLFunctions_3_3_CoreBackend::versionStatus());
- d_3_3_Core = static_cast<QOpenGLFunctions_3_3_CoreBackend*>(d);
- d->refs.ref();
-
- d = QAbstractOpenGLFunctionsPrivate::functionsBackend(context, QOpenGLFunctions_4_0_CoreBackend::versionStatus());
- d_4_0_Core = static_cast<QOpenGLFunctions_4_0_CoreBackend*>(d);
- d->refs.ref();
-
- d = QAbstractOpenGLFunctionsPrivate::functionsBackend(context, QOpenGLFunctions_4_1_CoreBackend::versionStatus());
- d_4_1_Core = static_cast<QOpenGLFunctions_4_1_CoreBackend*>(d);
- d->refs.ref();
-
- d = QAbstractOpenGLFunctionsPrivate::functionsBackend(context, QOpenGLFunctions_4_2_CoreBackend::versionStatus());
- d_4_2_Core = static_cast<QOpenGLFunctions_4_2_CoreBackend*>(d);
- d->refs.ref();
-
- d = QAbstractOpenGLFunctionsPrivate::functionsBackend(context, QOpenGLFunctions_4_3_CoreBackend::versionStatus());
- d_4_3_Core = static_cast<QOpenGLFunctions_4_3_CoreBackend*>(d);
- d->refs.ref();
-
- d = QAbstractOpenGLFunctionsPrivate::functionsBackend(context, QOpenGLFunctions_4_4_CoreBackend::versionStatus());
- d_4_4_Core = static_cast<QOpenGLFunctions_4_4_CoreBackend*>(d);
- d->refs.ref();
-
- d = QAbstractOpenGLFunctionsPrivate::functionsBackend(context, QOpenGLFunctions_4_5_CoreBackend::versionStatus());
- d_4_5_Core = static_cast<QOpenGLFunctions_4_5_CoreBackend*>(d);
- d->refs.ref();
-
- d = QAbstractOpenGLFunctionsPrivate::functionsBackend(context, QOpenGLFunctions_1_0_DeprecatedBackend::versionStatus());
- d_1_0_Deprecated = static_cast<QOpenGLFunctions_1_0_DeprecatedBackend*>(d);
- d->refs.ref();
-
- d = QAbstractOpenGLFunctionsPrivate::functionsBackend(context, QOpenGLFunctions_1_1_DeprecatedBackend::versionStatus());
- d_1_1_Deprecated = static_cast<QOpenGLFunctions_1_1_DeprecatedBackend*>(d);
- d->refs.ref();
-
- d = QAbstractOpenGLFunctionsPrivate::functionsBackend(context, QOpenGLFunctions_1_2_DeprecatedBackend::versionStatus());
- d_1_2_Deprecated = static_cast<QOpenGLFunctions_1_2_DeprecatedBackend*>(d);
- d->refs.ref();
-
- d = QAbstractOpenGLFunctionsPrivate::functionsBackend(context, QOpenGLFunctions_1_3_DeprecatedBackend::versionStatus());
- d_1_3_Deprecated = static_cast<QOpenGLFunctions_1_3_DeprecatedBackend*>(d);
- d->refs.ref();
-
- d = QAbstractOpenGLFunctionsPrivate::functionsBackend(context, QOpenGLFunctions_1_4_DeprecatedBackend::versionStatus());
- d_1_4_Deprecated = static_cast<QOpenGLFunctions_1_4_DeprecatedBackend*>(d);
- d->refs.ref();
-
- d = QAbstractOpenGLFunctionsPrivate::functionsBackend(context, QOpenGLFunctions_3_3_DeprecatedBackend::versionStatus());
- d_3_3_Deprecated = static_cast<QOpenGLFunctions_3_3_DeprecatedBackend*>(d);
- d->refs.ref();
-
- d = QAbstractOpenGLFunctionsPrivate::functionsBackend(context, QOpenGLFunctions_4_5_DeprecatedBackend::versionStatus());
- d_4_5_Deprecated = static_cast<QOpenGLFunctions_4_5_DeprecatedBackend*>(d);
- d->refs.ref();
-
- QAbstractOpenGLFunctions::initializeOpenGLFunctions();
- }
- return isInitialized();
-}
-
-bool QOpenGLFunctions_4_5_Compatibility::isContextCompatible(QOpenGLContext *context)
-{
- Q_ASSERT(context);
- QSurfaceFormat f = context->format();
- const QPair<int, int> v = qMakePair(f.majorVersion(), f.minorVersion());
- if (v < qMakePair(4, 5))
- return false;
-
- if (f.profile() == QSurfaceFormat::CoreProfile)
- return false;
-
- return true;
-}
-
-QOpenGLVersionProfile QOpenGLFunctions_4_5_Compatibility::versionProfile()
-{
- QOpenGLVersionProfile v;
- v.setVersion(4, 5);
- v.setProfile(QSurfaceFormat::CompatibilityProfile);
- return v;
-}
-
-QT_END_NAMESPACE
diff --git a/src/gui/opengl/qopenglfunctions_4_5_compatibility.h b/src/gui/opengl/qopenglfunctions_4_5_compatibility.h
deleted file mode 100644
index 9d9d14548b..0000000000
--- a/src/gui/opengl/qopenglfunctions_4_5_compatibility.h
+++ /dev/null
@@ -1,6694 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2015 Klaralvdalens Datakonsult AB (KDAB)
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the QtGui module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-**
-** This file was generated by glgen version 0.1
-** Command line was: glgen
-**
-** glgen is Copyright (C) 2013 Klaralvdalens Datakonsult AB (KDAB)
-**
-** This is an auto-generated file.
-** Do not edit! All changes made to it will be lost.
-**
-****************************************************************************/
-
-#ifndef QOPENGLVERSIONFUNCTIONS_4_5_COMPATIBILITY_H
-#define QOPENGLVERSIONFUNCTIONS_4_5_COMPATIBILITY_H
-
-#include <QtGui/qtguiglobal.h>
-
-#if !defined(QT_NO_OPENGL) && !defined(QT_OPENGL_ES_2)
-
-#include <QtGui/QOpenGLVersionFunctions>
-#include <QtGui/qopenglcontext.h>
-
-// MemoryBarrier is a macro on some architectures on Windows
-#ifdef Q_OS_WIN
-#pragma push_macro("MemoryBarrier")
-#undef MemoryBarrier
-#endif
-
-QT_BEGIN_NAMESPACE
-
-class Q_GUI_EXPORT QOpenGLFunctions_4_5_Compatibility : public QAbstractOpenGLFunctions
-{
-public:
- QOpenGLFunctions_4_5_Compatibility();
- ~QOpenGLFunctions_4_5_Compatibility();
-
- bool initializeOpenGLFunctions() override;
-
- // OpenGL 1.0 core functions
- void glViewport(GLint x, GLint y, GLsizei width, GLsizei height);
- void glDepthRange(GLdouble nearVal, GLdouble farVal);
- GLboolean glIsEnabled(GLenum cap);
- void glGetTexLevelParameteriv(GLenum target, GLint level, GLenum pname, GLint *params);
- void glGetTexLevelParameterfv(GLenum target, GLint level, GLenum pname, GLfloat *params);
- void glGetTexParameteriv(GLenum target, GLenum pname, GLint *params);
- void glGetTexParameterfv(GLenum target, GLenum pname, GLfloat *params);
- void glGetTexImage(GLenum target, GLint level, GLenum format, GLenum type, void *pixels);
- const GLubyte * glGetString(GLenum name);
- void glGetIntegerv(GLenum pname, GLint *data);
- void glGetFloatv(GLenum pname, GLfloat *data);
- GLenum glGetError();
- void glGetDoublev(GLenum pname, GLdouble *data);
- void glGetBooleanv(GLenum pname, GLboolean *data);
- void glReadPixels(GLint x, GLint y, GLsizei width, GLsizei height, GLenum format, GLenum type, void *pixels);
- void glReadBuffer(GLenum src);
- void glPixelStorei(GLenum pname, GLint param);
- void glPixelStoref(GLenum pname, GLfloat param);
- void glDepthFunc(GLenum func);
- void glStencilOp(GLenum fail, GLenum zfail, GLenum zpass);
- void glStencilFunc(GLenum func, GLint ref, GLuint mask);
- void glLogicOp(GLenum opcode);
- void glBlendFunc(GLenum sfactor, GLenum dfactor);
- void glFlush();
- void glFinish();
- void glEnable(GLenum cap);
- void glDisable(GLenum cap);
- void glDepthMask(GLboolean flag);
- void glColorMask(GLboolean red, GLboolean green, GLboolean blue, GLboolean alpha);
- void glStencilMask(GLuint mask);
- void glClearDepth(GLdouble depth);
- void glClearStencil(GLint s);
- void glClearColor(GLfloat red, GLfloat green, GLfloat blue, GLfloat alpha);
- void glClear(GLbitfield mask);
- void glDrawBuffer(GLenum buf);
- void glTexImage2D(GLenum target, GLint level, GLint internalformat, GLsizei width, GLsizei height, GLint border, GLenum format, GLenum type, const void *pixels);
- void glTexImage1D(GLenum target, GLint level, GLint internalformat, GLsizei width, GLint border, GLenum format, GLenum type, const void *pixels);
- void glTexParameteriv(GLenum target, GLenum pname, const GLint *params);
- void glTexParameteri(GLenum target, GLenum pname, GLint param);
- void glTexParameterfv(GLenum target, GLenum pname, const GLfloat *params);
- void glTexParameterf(GLenum target, GLenum pname, GLfloat param);
- void glScissor(GLint x, GLint y, GLsizei width, GLsizei height);
- void glPolygonMode(GLenum face, GLenum mode);
- void glPointSize(GLfloat size);
- void glLineWidth(GLfloat width);
- void glHint(GLenum target, GLenum mode);
- void glFrontFace(GLenum mode);
- void glCullFace(GLenum mode);
-
- // OpenGL 1.1 core functions
- GLboolean glIsTexture(GLuint texture);
- void glGenTextures(GLsizei n, GLuint *textures);
- void glDeleteTextures(GLsizei n, const GLuint *textures);
- void glBindTexture(GLenum target, GLuint texture);
- void glTexSubImage2D(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLenum type, const void *pixels);
- void glTexSubImage1D(GLenum target, GLint level, GLint xoffset, GLsizei width, GLenum format, GLenum type, const void *pixels);
- void glCopyTexSubImage2D(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint x, GLint y, GLsizei width, GLsizei height);
- void glCopyTexSubImage1D(GLenum target, GLint level, GLint xoffset, GLint x, GLint y, GLsizei width);
- void glCopyTexImage2D(GLenum target, GLint level, GLenum internalformat, GLint x, GLint y, GLsizei width, GLsizei height, GLint border);
- void glCopyTexImage1D(GLenum target, GLint level, GLenum internalformat, GLint x, GLint y, GLsizei width, GLint border);
- void glPolygonOffset(GLfloat factor, GLfloat units);
- void glDrawElements(GLenum mode, GLsizei count, GLenum type, const void *indices);
- void glDrawArrays(GLenum mode, GLint first, GLsizei count);
-
- // OpenGL 1.2 core functions
- void glBlendColor(GLfloat red, GLfloat green, GLfloat blue, GLfloat alpha);
- void glBlendEquation(GLenum mode);
- void glCopyTexSubImage3D(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLint x, GLint y, GLsizei width, GLsizei height);
- void glTexSubImage3D(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLenum type, const void *pixels);
- void glTexImage3D(GLenum target, GLint level, GLint internalformat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLenum format, GLenum type, const void *pixels);
- void glDrawRangeElements(GLenum mode, GLuint start, GLuint end, GLsizei count, GLenum type, const void *indices);
-
- // OpenGL 1.3 core functions
- void glGetCompressedTexImage(GLenum target, GLint level, void *img);
- void glCompressedTexSubImage1D(GLenum target, GLint level, GLint xoffset, GLsizei width, GLenum format, GLsizei imageSize, const void *data);
- void glCompressedTexSubImage2D(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLsizei imageSize, const void *data);
- void glCompressedTexSubImage3D(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLsizei imageSize, const void *data);
- void glCompressedTexImage1D(GLenum target, GLint level, GLenum internalformat, GLsizei width, GLint border, GLsizei imageSize, const void *data);
- void glCompressedTexImage2D(GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLint border, GLsizei imageSize, const void *data);
- void glCompressedTexImage3D(GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLsizei imageSize, const void *data);
- void glSampleCoverage(GLfloat value, GLboolean invert);
- void glActiveTexture(GLenum texture);
-
- // OpenGL 1.4 core functions
- void glPointParameteriv(GLenum pname, const GLint *params);
- void glPointParameteri(GLenum pname, GLint param);
- void glPointParameterfv(GLenum pname, const GLfloat *params);
- void glPointParameterf(GLenum pname, GLfloat param);
- void glMultiDrawElements(GLenum mode, const GLsizei *count, GLenum type, const void *const *indices, GLsizei drawcount);
- void glMultiDrawArrays(GLenum mode, const GLint *first, const GLsizei *count, GLsizei drawcount);
- void glBlendFuncSeparate(GLenum sfactorRGB, GLenum dfactorRGB, GLenum sfactorAlpha, GLenum dfactorAlpha);
-
- // OpenGL 1.5 core functions
- void glGetBufferPointerv(GLenum target, GLenum pname, void * *params);
- void glGetBufferParameteriv(GLenum target, GLenum pname, GLint *params);
- GLboolean glUnmapBuffer(GLenum target);
- void * glMapBuffer(GLenum target, GLenum access);
- void glGetBufferSubData(GLenum target, GLintptr offset, GLsizeiptr size, void *data);
- void glBufferSubData(GLenum target, GLintptr offset, GLsizeiptr size, const void *data);
- void glBufferData(GLenum target, GLsizeiptr size, const void *data, GLenum usage);
- GLboolean glIsBuffer(GLuint buffer);
- void glGenBuffers(GLsizei n, GLuint *buffers);
- void glDeleteBuffers(GLsizei n, const GLuint *buffers);
- void glBindBuffer(GLenum target, GLuint buffer);
- void glGetQueryObjectuiv(GLuint id, GLenum pname, GLuint *params);
- void glGetQueryObjectiv(GLuint id, GLenum pname, GLint *params);
- void glGetQueryiv(GLenum target, GLenum pname, GLint *params);
- void glEndQuery(GLenum target);
- void glBeginQuery(GLenum target, GLuint id);
- GLboolean glIsQuery(GLuint id);
- void glDeleteQueries(GLsizei n, const GLuint *ids);
- void glGenQueries(GLsizei n, GLuint *ids);
-
- // OpenGL 2.0 core functions
- void glVertexAttribPointer(GLuint index, GLint size, GLenum type, GLboolean normalized, GLsizei stride, const void *pointer);
- void glVertexAttrib4usv(GLuint index, const GLushort *v);
- void glVertexAttrib4uiv(GLuint index, const GLuint *v);
- void glVertexAttrib4ubv(GLuint index, const GLubyte *v);
- void glVertexAttrib4sv(GLuint index, const GLshort *v);
- void glVertexAttrib4s(GLuint index, GLshort x, GLshort y, GLshort z, GLshort w);
- void glVertexAttrib4iv(GLuint index, const GLint *v);
- void glVertexAttrib4fv(GLuint index, const GLfloat *v);
- void glVertexAttrib4f(GLuint index, GLfloat x, GLfloat y, GLfloat z, GLfloat w);
- void glVertexAttrib4dv(GLuint index, const GLdouble *v);
- void glVertexAttrib4d(GLuint index, GLdouble x, GLdouble y, GLdouble z, GLdouble w);
- void glVertexAttrib4bv(GLuint index, const GLbyte *v);
- void glVertexAttrib4Nusv(GLuint index, const GLushort *v);
- void glVertexAttrib4Nuiv(GLuint index, const GLuint *v);
- void glVertexAttrib4Nubv(GLuint index, const GLubyte *v);
- void glVertexAttrib4Nub(GLuint index, GLubyte x, GLubyte y, GLubyte z, GLubyte w);
- void glVertexAttrib4Nsv(GLuint index, const GLshort *v);
- void glVertexAttrib4Niv(GLuint index, const GLint *v);
- void glVertexAttrib4Nbv(GLuint index, const GLbyte *v);
- void glVertexAttrib3sv(GLuint index, const GLshort *v);
- void glVertexAttrib3s(GLuint index, GLshort x, GLshort y, GLshort z);
- void glVertexAttrib3fv(GLuint index, const GLfloat *v);
- void glVertexAttrib3f(GLuint index, GLfloat x, GLfloat y, GLfloat z);
- void glVertexAttrib3dv(GLuint index, const GLdouble *v);
- void glVertexAttrib3d(GLuint index, GLdouble x, GLdouble y, GLdouble z);
- void glVertexAttrib2sv(GLuint index, const GLshort *v);
- void glVertexAttrib2s(GLuint index, GLshort x, GLshort y);
- void glVertexAttrib2fv(GLuint index, const GLfloat *v);
- void glVertexAttrib2f(GLuint index, GLfloat x, GLfloat y);
- void glVertexAttrib2dv(GLuint index, const GLdouble *v);
- void glVertexAttrib2d(GLuint index, GLdouble x, GLdouble y);
- void glVertexAttrib1sv(GLuint index, const GLshort *v);
- void glVertexAttrib1s(GLuint index, GLshort x);
- void glVertexAttrib1fv(GLuint index, const GLfloat *v);
- void glVertexAttrib1f(GLuint index, GLfloat x);
- void glVertexAttrib1dv(GLuint index, const GLdouble *v);
- void glVertexAttrib1d(GLuint index, GLdouble x);
- void glValidateProgram(GLuint program);
- void glUniformMatrix4fv(GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
- void glUniformMatrix3fv(GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
- void glUniformMatrix2fv(GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
- void glUniform4iv(GLint location, GLsizei count, const GLint *value);
- void glUniform3iv(GLint location, GLsizei count, const GLint *value);
- void glUniform2iv(GLint location, GLsizei count, const GLint *value);
- void glUniform1iv(GLint location, GLsizei count, const GLint *value);
- void glUniform4fv(GLint location, GLsizei count, const GLfloat *value);
- void glUniform3fv(GLint location, GLsizei count, const GLfloat *value);
- void glUniform2fv(GLint location, GLsizei count, const GLfloat *value);
- void glUniform1fv(GLint location, GLsizei count, const GLfloat *value);
- void glUniform4i(GLint location, GLint v0, GLint v1, GLint v2, GLint v3);
- void glUniform3i(GLint location, GLint v0, GLint v1, GLint v2);
- void glUniform2i(GLint location, GLint v0, GLint v1);
- void glUniform1i(GLint location, GLint v0);
- void glUniform4f(GLint location, GLfloat v0, GLfloat v1, GLfloat v2, GLfloat v3);
- void glUniform3f(GLint location, GLfloat v0, GLfloat v1, GLfloat v2);
- void glUniform2f(GLint location, GLfloat v0, GLfloat v1);
- void glUniform1f(GLint location, GLfloat v0);
- void glUseProgram(GLuint program);
- void glShaderSource(GLuint shader, GLsizei count, const GLchar* const *string, const GLint *length);
- void glLinkProgram(GLuint program);
- GLboolean glIsShader(GLuint shader);
- GLboolean glIsProgram(GLuint program);
- void glGetVertexAttribPointerv(GLuint index, GLenum pname, void * *pointer);
- void glGetVertexAttribiv(GLuint index, GLenum pname, GLint *params);
- void glGetVertexAttribfv(GLuint index, GLenum pname, GLfloat *params);
- void glGetVertexAttribdv(GLuint index, GLenum pname, GLdouble *params);
- void glGetUniformiv(GLuint program, GLint location, GLint *params);
- void glGetUniformfv(GLuint program, GLint location, GLfloat *params);
- GLint glGetUniformLocation(GLuint program, const GLchar *name);
- void glGetShaderSource(GLuint shader, GLsizei bufSize, GLsizei *length, GLchar *source);
- void glGetShaderInfoLog(GLuint shader, GLsizei bufSize, GLsizei *length, GLchar *infoLog);
- void glGetShaderiv(GLuint shader, GLenum pname, GLint *params);
- void glGetProgramInfoLog(GLuint program, GLsizei bufSize, GLsizei *length, GLchar *infoLog);
- void glGetProgramiv(GLuint program, GLenum pname, GLint *params);
- GLint glGetAttribLocation(GLuint program, const GLchar *name);
- void glGetAttachedShaders(GLuint program, GLsizei maxCount, GLsizei *count, GLuint *shaders);
- void glGetActiveUniform(GLuint program, GLuint index, GLsizei bufSize, GLsizei *length, GLint *size, GLenum *type, GLchar *name);
- void glGetActiveAttrib(GLuint program, GLuint index, GLsizei bufSize, GLsizei *length, GLint *size, GLenum *type, GLchar *name);
- void glEnableVertexAttribArray(GLuint index);
- void glDisableVertexAttribArray(GLuint index);
- void glDetachShader(GLuint program, GLuint shader);
- void glDeleteShader(GLuint shader);
- void glDeleteProgram(GLuint program);
- GLuint glCreateShader(GLenum type);
- GLuint glCreateProgram();
- void glCompileShader(GLuint shader);
- void glBindAttribLocation(GLuint program, GLuint index, const GLchar *name);
- void glAttachShader(GLuint program, GLuint shader);
- void glStencilMaskSeparate(GLenum face, GLuint mask);
- void glStencilFuncSeparate(GLenum face, GLenum func, GLint ref, GLuint mask);
- void glStencilOpSeparate(GLenum face, GLenum sfail, GLenum dpfail, GLenum dppass);
- void glDrawBuffers(GLsizei n, const GLenum *bufs);
- void glBlendEquationSeparate(GLenum modeRGB, GLenum modeAlpha);
-
- // OpenGL 2.1 core functions
- void glUniformMatrix4x3fv(GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
- void glUniformMatrix3x4fv(GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
- void glUniformMatrix4x2fv(GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
- void glUniformMatrix2x4fv(GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
- void glUniformMatrix3x2fv(GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
- void glUniformMatrix2x3fv(GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
-
- // OpenGL 3.0 core functions
- GLboolean glIsVertexArray(GLuint array);
- void glGenVertexArrays(GLsizei n, GLuint *arrays);
- void glDeleteVertexArrays(GLsizei n, const GLuint *arrays);
- void glBindVertexArray(GLuint array);
- void glFlushMappedBufferRange(GLenum target, GLintptr offset, GLsizeiptr length);
- void * glMapBufferRange(GLenum target, GLintptr offset, GLsizeiptr length, GLbitfield access);
- void glFramebufferTextureLayer(GLenum target, GLenum attachment, GLuint texture, GLint level, GLint layer);
- void glRenderbufferStorageMultisample(GLenum target, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height);
- void glBlitFramebuffer(GLint srcX0, GLint srcY0, GLint srcX1, GLint srcY1, GLint dstX0, GLint dstY0, GLint dstX1, GLint dstY1, GLbitfield mask, GLenum filter);
- void glGenerateMipmap(GLenum target);
- void glGetFramebufferAttachmentParameteriv(GLenum target, GLenum attachment, GLenum pname, GLint *params);
- void glFramebufferRenderbuffer(GLenum target, GLenum attachment, GLenum renderbuffertarget, GLuint renderbuffer);
- void glFramebufferTexture3D(GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level, GLint zoffset);
- void glFramebufferTexture2D(GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level);
- void glFramebufferTexture1D(GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level);
- GLenum glCheckFramebufferStatus(GLenum target);
- void glGenFramebuffers(GLsizei n, GLuint *framebuffers);
- void glDeleteFramebuffers(GLsizei n, const GLuint *framebuffers);
- void glBindFramebuffer(GLenum target, GLuint framebuffer);
- GLboolean glIsFramebuffer(GLuint framebuffer);
- void glGetRenderbufferParameteriv(GLenum target, GLenum pname, GLint *params);
- void glRenderbufferStorage(GLenum target, GLenum internalformat, GLsizei width, GLsizei height);
- void glGenRenderbuffers(GLsizei n, GLuint *renderbuffers);
- void glDeleteRenderbuffers(GLsizei n, const GLuint *renderbuffers);
- void glBindRenderbuffer(GLenum target, GLuint renderbuffer);
- GLboolean glIsRenderbuffer(GLuint renderbuffer);
- const GLubyte * glGetStringi(GLenum name, GLuint index);
- void glClearBufferfi(GLenum buffer, GLint drawbuffer, GLfloat depth, GLint stencil);
- void glClearBufferfv(GLenum buffer, GLint drawbuffer, const GLfloat *value);
- void glClearBufferuiv(GLenum buffer, GLint drawbuffer, const GLuint *value);
- void glClearBufferiv(GLenum buffer, GLint drawbuffer, const GLint *value);
- void glGetTexParameterIuiv(GLenum target, GLenum pname, GLuint *params);
- void glGetTexParameterIiv(GLenum target, GLenum pname, GLint *params);
- void glTexParameterIuiv(GLenum target, GLenum pname, const GLuint *params);
- void glTexParameterIiv(GLenum target, GLenum pname, const GLint *params);
- void glUniform4uiv(GLint location, GLsizei count, const GLuint *value);
- void glUniform3uiv(GLint location, GLsizei count, const GLuint *value);
- void glUniform2uiv(GLint location, GLsizei count, const GLuint *value);
- void glUniform1uiv(GLint location, GLsizei count, const GLuint *value);
- void glUniform4ui(GLint location, GLuint v0, GLuint v1, GLuint v2, GLuint v3);
- void glUniform3ui(GLint location, GLuint v0, GLuint v1, GLuint v2);
- void glUniform2ui(GLint location, GLuint v0, GLuint v1);
- void glUniform1ui(GLint location, GLuint v0);
- GLint glGetFragDataLocation(GLuint program, const GLchar *name);
- void glBindFragDataLocation(GLuint program, GLuint color, const GLchar *name);
- void glGetUniformuiv(GLuint program, GLint location, GLuint *params);
- void glVertexAttribI4usv(GLuint index, const GLushort *v);
- void glVertexAttribI4ubv(GLuint index, const GLubyte *v);
- void glVertexAttribI4sv(GLuint index, const GLshort *v);
- void glVertexAttribI4bv(GLuint index, const GLbyte *v);
- void glVertexAttribI4uiv(GLuint index, const GLuint *v);
- void glVertexAttribI3uiv(GLuint index, const GLuint *v);
- void glVertexAttribI2uiv(GLuint index, const GLuint *v);
- void glVertexAttribI1uiv(GLuint index, const GLuint *v);
- void glVertexAttribI4iv(GLuint index, const GLint *v);
- void glVertexAttribI3iv(GLuint index, const GLint *v);
- void glVertexAttribI2iv(GLuint index, const GLint *v);
- void glVertexAttribI1iv(GLuint index, const GLint *v);
- void glVertexAttribI4ui(GLuint index, GLuint x, GLuint y, GLuint z, GLuint w);
- void glVertexAttribI3ui(GLuint index, GLuint x, GLuint y, GLuint z);
- void glVertexAttribI2ui(GLuint index, GLuint x, GLuint y);
- void glVertexAttribI1ui(GLuint index, GLuint x);
- void glVertexAttribI4i(GLuint index, GLint x, GLint y, GLint z, GLint w);
- void glVertexAttribI3i(GLuint index, GLint x, GLint y, GLint z);
- void glVertexAttribI2i(GLuint index, GLint x, GLint y);
- void glVertexAttribI1i(GLuint index, GLint x);
- void glGetVertexAttribIuiv(GLuint index, GLenum pname, GLuint *params);
- void glGetVertexAttribIiv(GLuint index, GLenum pname, GLint *params);
- void glVertexAttribIPointer(GLuint index, GLint size, GLenum type, GLsizei stride, const void *pointer);
- void glEndConditionalRender();
- void glBeginConditionalRender(GLuint id, GLenum mode);
- void glClampColor(GLenum target, GLenum clamp);
- void glGetTransformFeedbackVarying(GLuint program, GLuint index, GLsizei bufSize, GLsizei *length, GLsizei *size, GLenum *type, GLchar *name);
- void glTransformFeedbackVaryings(GLuint program, GLsizei count, const GLchar* const *varyings, GLenum bufferMode);
- void glBindBufferBase(GLenum target, GLuint index, GLuint buffer);
- void glBindBufferRange(GLenum target, GLuint index, GLuint buffer, GLintptr offset, GLsizeiptr size);
- void glEndTransformFeedback();
- void glBeginTransformFeedback(GLenum primitiveMode);
- GLboolean glIsEnabledi(GLenum target, GLuint index);
- void glDisablei(GLenum target, GLuint index);
- void glEnablei(GLenum target, GLuint index);
- void glGetIntegeri_v(GLenum target, GLuint index, GLint *data);
- void glGetBooleani_v(GLenum target, GLuint index, GLboolean *data);
- void glColorMaski(GLuint index, GLboolean r, GLboolean g, GLboolean b, GLboolean a);
-
- // OpenGL 3.1 core functions
- void glUniformBlockBinding(GLuint program, GLuint uniformBlockIndex, GLuint uniformBlockBinding);
- void glGetActiveUniformBlockName(GLuint program, GLuint uniformBlockIndex, GLsizei bufSize, GLsizei *length, GLchar *uniformBlockName);
- void glGetActiveUniformBlockiv(GLuint program, GLuint uniformBlockIndex, GLenum pname, GLint *params);
- GLuint glGetUniformBlockIndex(GLuint program, const GLchar *uniformBlockName);
- void glGetActiveUniformName(GLuint program, GLuint uniformIndex, GLsizei bufSize, GLsizei *length, GLchar *uniformName);
- void glGetActiveUniformsiv(GLuint program, GLsizei uniformCount, const GLuint *uniformIndices, GLenum pname, GLint *params);
- void glGetUniformIndices(GLuint program, GLsizei uniformCount, const GLchar *const *uniformNames, GLuint *uniformIndices);
- void glCopyBufferSubData(GLenum readTarget, GLenum writeTarget, GLintptr readOffset, GLintptr writeOffset, GLsizeiptr size);
- void glPrimitiveRestartIndex(GLuint index);
- void glTexBuffer(GLenum target, GLenum internalformat, GLuint buffer);
- void glDrawElementsInstanced(GLenum mode, GLsizei count, GLenum type, const void *indices, GLsizei instancecount);
- void glDrawArraysInstanced(GLenum mode, GLint first, GLsizei count, GLsizei instancecount);
-
- // OpenGL 3.2 core functions
- void glSampleMaski(GLuint maskNumber, GLbitfield mask);
- void glGetMultisamplefv(GLenum pname, GLuint index, GLfloat *val);
- void glTexImage3DMultisample(GLenum target, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth, GLboolean fixedsamplelocations);
- void glTexImage2DMultisample(GLenum target, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height, GLboolean fixedsamplelocations);
- void glFramebufferTexture(GLenum target, GLenum attachment, GLuint texture, GLint level);
- void glGetBufferParameteri64v(GLenum target, GLenum pname, GLint64 *params);
- void glGetInteger64i_v(GLenum target, GLuint index, GLint64 *data);
- void glGetSynciv(GLsync sync, GLenum pname, GLsizei bufSize, GLsizei *length, GLint *values);
- void glGetInteger64v(GLenum pname, GLint64 *data);
- void glWaitSync(GLsync sync, GLbitfield flags, GLuint64 timeout);
- GLenum glClientWaitSync(GLsync sync, GLbitfield flags, GLuint64 timeout);
- void glDeleteSync(GLsync sync);
- GLboolean glIsSync(GLsync sync);
- GLsync glFenceSync(GLenum condition, GLbitfield flags);
- void glProvokingVertex(GLenum mode);
- void glMultiDrawElementsBaseVertex(GLenum mode, const GLsizei *count, GLenum type, const void *const *indices, GLsizei drawcount, const GLint *basevertex);
- void glDrawElementsInstancedBaseVertex(GLenum mode, GLsizei count, GLenum type, const void *indices, GLsizei instancecount, GLint basevertex);
- void glDrawRangeElementsBaseVertex(GLenum mode, GLuint start, GLuint end, GLsizei count, GLenum type, const void *indices, GLint basevertex);
- void glDrawElementsBaseVertex(GLenum mode, GLsizei count, GLenum type, const void *indices, GLint basevertex);
-
- // OpenGL 3.3 core functions
- void glVertexAttribP4uiv(GLuint index, GLenum type, GLboolean normalized, const GLuint *value);
- void glVertexAttribP4ui(GLuint index, GLenum type, GLboolean normalized, GLuint value);
- void glVertexAttribP3uiv(GLuint index, GLenum type, GLboolean normalized, const GLuint *value);
- void glVertexAttribP3ui(GLuint index, GLenum type, GLboolean normalized, GLuint value);
- void glVertexAttribP2uiv(GLuint index, GLenum type, GLboolean normalized, const GLuint *value);
- void glVertexAttribP2ui(GLuint index, GLenum type, GLboolean normalized, GLuint value);
- void glVertexAttribP1uiv(GLuint index, GLenum type, GLboolean normalized, const GLuint *value);
- void glVertexAttribP1ui(GLuint index, GLenum type, GLboolean normalized, GLuint value);
- void glVertexAttribDivisor(GLuint index, GLuint divisor);
- void glGetQueryObjectui64v(GLuint id, GLenum pname, GLuint64 *params);
- void glGetQueryObjecti64v(GLuint id, GLenum pname, GLint64 *params);
- void glQueryCounter(GLuint id, GLenum target);
- void glGetSamplerParameterIuiv(GLuint sampler, GLenum pname, GLuint *params);
- void glGetSamplerParameterfv(GLuint sampler, GLenum pname, GLfloat *params);
- void glGetSamplerParameterIiv(GLuint sampler, GLenum pname, GLint *params);
- void glGetSamplerParameteriv(GLuint sampler, GLenum pname, GLint *params);
- void glSamplerParameterIuiv(GLuint sampler, GLenum pname, const GLuint *param);
- void glSamplerParameterIiv(GLuint sampler, GLenum pname, const GLint *param);
- void glSamplerParameterfv(GLuint sampler, GLenum pname, const GLfloat *param);
- void glSamplerParameterf(GLuint sampler, GLenum pname, GLfloat param);
- void glSamplerParameteriv(GLuint sampler, GLenum pname, const GLint *param);
- void glSamplerParameteri(GLuint sampler, GLenum pname, GLint param);
- void glBindSampler(GLuint unit, GLuint sampler);
- GLboolean glIsSampler(GLuint sampler);
- void glDeleteSamplers(GLsizei count, const GLuint *samplers);
- void glGenSamplers(GLsizei count, GLuint *samplers);
- GLint glGetFragDataIndex(GLuint program, const GLchar *name);
- void glBindFragDataLocationIndexed(GLuint program, GLuint colorNumber, GLuint index, const GLchar *name);
-
- // OpenGL 4.0 core functions
- void glGetQueryIndexediv(GLenum target, GLuint index, GLenum pname, GLint *params);
- void glEndQueryIndexed(GLenum target, GLuint index);
- void glBeginQueryIndexed(GLenum target, GLuint index, GLuint id);
- void glDrawTransformFeedbackStream(GLenum mode, GLuint id, GLuint stream);
- void glDrawTransformFeedback(GLenum mode, GLuint id);
- void glResumeTransformFeedback();
- void glPauseTransformFeedback();
- GLboolean glIsTransformFeedback(GLuint id);
- void glGenTransformFeedbacks(GLsizei n, GLuint *ids);
- void glDeleteTransformFeedbacks(GLsizei n, const GLuint *ids);
- void glBindTransformFeedback(GLenum target, GLuint id);
- void glPatchParameterfv(GLenum pname, const GLfloat *values);
- void glPatchParameteri(GLenum pname, GLint value);
- void glGetProgramStageiv(GLuint program, GLenum shadertype, GLenum pname, GLint *values);
- void glGetUniformSubroutineuiv(GLenum shadertype, GLint location, GLuint *params);
- void glUniformSubroutinesuiv(GLenum shadertype, GLsizei count, const GLuint *indices);
- void glGetActiveSubroutineName(GLuint program, GLenum shadertype, GLuint index, GLsizei bufsize, GLsizei *length, GLchar *name);
- void glGetActiveSubroutineUniformName(GLuint program, GLenum shadertype, GLuint index, GLsizei bufsize, GLsizei *length, GLchar *name);
- void glGetActiveSubroutineUniformiv(GLuint program, GLenum shadertype, GLuint index, GLenum pname, GLint *values);
- GLuint glGetSubroutineIndex(GLuint program, GLenum shadertype, const GLchar *name);
- GLint glGetSubroutineUniformLocation(GLuint program, GLenum shadertype, const GLchar *name);
- void glGetUniformdv(GLuint program, GLint location, GLdouble *params);
- void glUniformMatrix4x3dv(GLint location, GLsizei count, GLboolean transpose, const GLdouble *value);
- void glUniformMatrix4x2dv(GLint location, GLsizei count, GLboolean transpose, const GLdouble *value);
- void glUniformMatrix3x4dv(GLint location, GLsizei count, GLboolean transpose, const GLdouble *value);
- void glUniformMatrix3x2dv(GLint location, GLsizei count, GLboolean transpose, const GLdouble *value);
- void glUniformMatrix2x4dv(GLint location, GLsizei count, GLboolean transpose, const GLdouble *value);
- void glUniformMatrix2x3dv(GLint location, GLsizei count, GLboolean transpose, const GLdouble *value);
- void glUniformMatrix4dv(GLint location, GLsizei count, GLboolean transpose, const GLdouble *value);
- void glUniformMatrix3dv(GLint location, GLsizei count, GLboolean transpose, const GLdouble *value);
- void glUniformMatrix2dv(GLint location, GLsizei count, GLboolean transpose, const GLdouble *value);
- void glUniform4dv(GLint location, GLsizei count, const GLdouble *value);
- void glUniform3dv(GLint location, GLsizei count, const GLdouble *value);
- void glUniform2dv(GLint location, GLsizei count, const GLdouble *value);
- void glUniform1dv(GLint location, GLsizei count, const GLdouble *value);
- void glUniform4d(GLint location, GLdouble x, GLdouble y, GLdouble z, GLdouble w);
- void glUniform3d(GLint location, GLdouble x, GLdouble y, GLdouble z);
- void glUniform2d(GLint location, GLdouble x, GLdouble y);
- void glUniform1d(GLint location, GLdouble x);
- void glDrawElementsIndirect(GLenum mode, GLenum type, const void *indirect);
- void glDrawArraysIndirect(GLenum mode, const void *indirect);
- void glBlendFuncSeparatei(GLuint buf, GLenum srcRGB, GLenum dstRGB, GLenum srcAlpha, GLenum dstAlpha);
- void glBlendFunci(GLuint buf, GLenum src, GLenum dst);
- void glBlendEquationSeparatei(GLuint buf, GLenum modeRGB, GLenum modeAlpha);
- void glBlendEquationi(GLuint buf, GLenum mode);
- void glMinSampleShading(GLfloat value);
-
- // OpenGL 4.1 core functions
- void glGetDoublei_v(GLenum target, GLuint index, GLdouble *data);
- void glGetFloati_v(GLenum target, GLuint index, GLfloat *data);
- void glDepthRangeIndexed(GLuint index, GLdouble n, GLdouble f);
- void glDepthRangeArrayv(GLuint first, GLsizei count, const GLdouble *v);
- void glScissorIndexedv(GLuint index, const GLint *v);
- void glScissorIndexed(GLuint index, GLint left, GLint bottom, GLsizei width, GLsizei height);
- void glScissorArrayv(GLuint first, GLsizei count, const GLint *v);
- void glViewportIndexedfv(GLuint index, const GLfloat *v);
- void glViewportIndexedf(GLuint index, GLfloat x, GLfloat y, GLfloat w, GLfloat h);
- void glViewportArrayv(GLuint first, GLsizei count, const GLfloat *v);
- void glGetVertexAttribLdv(GLuint index, GLenum pname, GLdouble *params);
- void glVertexAttribLPointer(GLuint index, GLint size, GLenum type, GLsizei stride, const void *pointer);
- void glVertexAttribL4dv(GLuint index, const GLdouble *v);
- void glVertexAttribL3dv(GLuint index, const GLdouble *v);
- void glVertexAttribL2dv(GLuint index, const GLdouble *v);
- void glVertexAttribL1dv(GLuint index, const GLdouble *v);
- void glVertexAttribL4d(GLuint index, GLdouble x, GLdouble y, GLdouble z, GLdouble w);
- void glVertexAttribL3d(GLuint index, GLdouble x, GLdouble y, GLdouble z);
- void glVertexAttribL2d(GLuint index, GLdouble x, GLdouble y);
- void glVertexAttribL1d(GLuint index, GLdouble x);
- void glGetProgramPipelineInfoLog(GLuint pipeline, GLsizei bufSize, GLsizei *length, GLchar *infoLog);
- void glValidateProgramPipeline(GLuint pipeline);
- void glProgramUniformMatrix4x3dv(GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLdouble *value);
- void glProgramUniformMatrix3x4dv(GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLdouble *value);
- void glProgramUniformMatrix4x2dv(GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLdouble *value);
- void glProgramUniformMatrix2x4dv(GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLdouble *value);
- void glProgramUniformMatrix3x2dv(GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLdouble *value);
- void glProgramUniformMatrix2x3dv(GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLdouble *value);
- void glProgramUniformMatrix4x3fv(GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
- void glProgramUniformMatrix3x4fv(GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
- void glProgramUniformMatrix4x2fv(GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
- void glProgramUniformMatrix2x4fv(GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
- void glProgramUniformMatrix3x2fv(GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
- void glProgramUniformMatrix2x3fv(GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
- void glProgramUniformMatrix4dv(GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLdouble *value);
- void glProgramUniformMatrix3dv(GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLdouble *value);
- void glProgramUniformMatrix2dv(GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLdouble *value);
- void glProgramUniformMatrix4fv(GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
- void glProgramUniformMatrix3fv(GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
- void glProgramUniformMatrix2fv(GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
- void glProgramUniform4uiv(GLuint program, GLint location, GLsizei count, const GLuint *value);
- void glProgramUniform4ui(GLuint program, GLint location, GLuint v0, GLuint v1, GLuint v2, GLuint v3);
- void glProgramUniform4dv(GLuint program, GLint location, GLsizei count, const GLdouble *value);
- void glProgramUniform4d(GLuint program, GLint location, GLdouble v0, GLdouble v1, GLdouble v2, GLdouble v3);
- void glProgramUniform4fv(GLuint program, GLint location, GLsizei count, const GLfloat *value);
- void glProgramUniform4f(GLuint program, GLint location, GLfloat v0, GLfloat v1, GLfloat v2, GLfloat v3);
- void glProgramUniform4iv(GLuint program, GLint location, GLsizei count, const GLint *value);
- void glProgramUniform4i(GLuint program, GLint location, GLint v0, GLint v1, GLint v2, GLint v3);
- void glProgramUniform3uiv(GLuint program, GLint location, GLsizei count, const GLuint *value);
- void glProgramUniform3ui(GLuint program, GLint location, GLuint v0, GLuint v1, GLuint v2);
- void glProgramUniform3dv(GLuint program, GLint location, GLsizei count, const GLdouble *value);
- void glProgramUniform3d(GLuint program, GLint location, GLdouble v0, GLdouble v1, GLdouble v2);
- void glProgramUniform3fv(GLuint program, GLint location, GLsizei count, const GLfloat *value);
- void glProgramUniform3f(GLuint program, GLint location, GLfloat v0, GLfloat v1, GLfloat v2);
- void glProgramUniform3iv(GLuint program, GLint location, GLsizei count, const GLint *value);
- void glProgramUniform3i(GLuint program, GLint location, GLint v0, GLint v1, GLint v2);
- void glProgramUniform2uiv(GLuint program, GLint location, GLsizei count, const GLuint *value);
- void glProgramUniform2ui(GLuint program, GLint location, GLuint v0, GLuint v1);
- void glProgramUniform2dv(GLuint program, GLint location, GLsizei count, const GLdouble *value);
- void glProgramUniform2d(GLuint program, GLint location, GLdouble v0, GLdouble v1);
- void glProgramUniform2fv(GLuint program, GLint location, GLsizei count, const GLfloat *value);
- void glProgramUniform2f(GLuint program, GLint location, GLfloat v0, GLfloat v1);
- void glProgramUniform2iv(GLuint program, GLint location, GLsizei count, const GLint *value);
- void glProgramUniform2i(GLuint program, GLint location, GLint v0, GLint v1);
- void glProgramUniform1uiv(GLuint program, GLint location, GLsizei count, const GLuint *value);
- void glProgramUniform1ui(GLuint program, GLint location, GLuint v0);
- void glProgramUniform1dv(GLuint program, GLint location, GLsizei count, const GLdouble *value);
- void glProgramUniform1d(GLuint program, GLint location, GLdouble v0);
- void glProgramUniform1fv(GLuint program, GLint location, GLsizei count, const GLfloat *value);
- void glProgramUniform1f(GLuint program, GLint location, GLfloat v0);
- void glProgramUniform1iv(GLuint program, GLint location, GLsizei count, const GLint *value);
- void glProgramUniform1i(GLuint program, GLint location, GLint v0);
- void glGetProgramPipelineiv(GLuint pipeline, GLenum pname, GLint *params);
- GLboolean glIsProgramPipeline(GLuint pipeline);
- void glGenProgramPipelines(GLsizei n, GLuint *pipelines);
- void glDeleteProgramPipelines(GLsizei n, const GLuint *pipelines);
- void glBindProgramPipeline(GLuint pipeline);
- GLuint glCreateShaderProgramv(GLenum type, GLsizei count, const GLchar* const *strings);
- void glActiveShaderProgram(GLuint pipeline, GLuint program);
- void glUseProgramStages(GLuint pipeline, GLbitfield stages, GLuint program);
- void glProgramParameteri(GLuint program, GLenum pname, GLint value);
- void glProgramBinary(GLuint program, GLenum binaryFormat, const void *binary, GLsizei length);
- void glGetProgramBinary(GLuint program, GLsizei bufSize, GLsizei *length, GLenum *binaryFormat, void *binary);
- void glClearDepthf(GLfloat dd);
- void glDepthRangef(GLfloat n, GLfloat f);
- void glGetShaderPrecisionFormat(GLenum shadertype, GLenum precisiontype, GLint *range, GLint *precision);
- void glShaderBinary(GLsizei count, const GLuint *shaders, GLenum binaryformat, const void *binary, GLsizei length);
- void glReleaseShaderCompiler();
-
- // OpenGL 4.2 core functions
- void glDrawTransformFeedbackStreamInstanced(GLenum mode, GLuint id, GLuint stream, GLsizei instancecount);
- void glDrawTransformFeedbackInstanced(GLenum mode, GLuint id, GLsizei instancecount);
- void glTexStorage3D(GLenum target, GLsizei levels, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth);
- void glTexStorage2D(GLenum target, GLsizei levels, GLenum internalformat, GLsizei width, GLsizei height);
- void glTexStorage1D(GLenum target, GLsizei levels, GLenum internalformat, GLsizei width);
- void glMemoryBarrier(GLbitfield barriers);
- void glBindImageTexture(GLuint unit, GLuint texture, GLint level, GLboolean layered, GLint layer, GLenum access, GLenum format);
- void glGetActiveAtomicCounterBufferiv(GLuint program, GLuint bufferIndex, GLenum pname, GLint *params);
- void glGetInternalformativ(GLenum target, GLenum internalformat, GLenum pname, GLsizei bufSize, GLint *params);
- void glDrawElementsInstancedBaseVertexBaseInstance(GLenum mode, GLsizei count, GLenum type, const void *indices, GLsizei instancecount, GLint basevertex, GLuint baseinstance);
- void glDrawElementsInstancedBaseInstance(GLenum mode, GLsizei count, GLenum type, const void *indices, GLsizei instancecount, GLuint baseinstance);
- void glDrawArraysInstancedBaseInstance(GLenum mode, GLint first, GLsizei count, GLsizei instancecount, GLuint baseinstance);
-
- // OpenGL 4.3 core functions
- void glGetObjectPtrLabel(const void *ptr, GLsizei bufSize, GLsizei *length, GLchar *label);
- void glObjectPtrLabel(const void *ptr, GLsizei length, const GLchar *label);
- void glGetObjectLabel(GLenum identifier, GLuint name, GLsizei bufSize, GLsizei *length, GLchar *label);
- void glObjectLabel(GLenum identifier, GLuint name, GLsizei length, const GLchar *label);
- void glPopDebugGroup();
- void glPushDebugGroup(GLenum source, GLuint id, GLsizei length, const GLchar *message);
- GLuint glGetDebugMessageLog(GLuint count, GLsizei bufSize, GLenum *sources, GLenum *types, GLuint *ids, GLenum *severities, GLsizei *lengths, GLchar *messageLog);
- void glDebugMessageCallback(GLDEBUGPROC callback, const void *userParam);
- void glDebugMessageInsert(GLenum source, GLenum type, GLuint id, GLenum severity, GLsizei length, const GLchar *buf);
- void glDebugMessageControl(GLenum source, GLenum type, GLenum severity, GLsizei count, const GLuint *ids, GLboolean enabled);
- void glVertexBindingDivisor(GLuint bindingindex, GLuint divisor);
- void glVertexAttribBinding(GLuint attribindex, GLuint bindingindex);
- void glVertexAttribLFormat(GLuint attribindex, GLint size, GLenum type, GLuint relativeoffset);
- void glVertexAttribIFormat(GLuint attribindex, GLint size, GLenum type, GLuint relativeoffset);
- void glVertexAttribFormat(GLuint attribindex, GLint size, GLenum type, GLboolean normalized, GLuint relativeoffset);
- void glBindVertexBuffer(GLuint bindingindex, GLuint buffer, GLintptr offset, GLsizei stride);
- void glTextureView(GLuint texture, GLenum target, GLuint origtexture, GLenum internalformat, GLuint minlevel, GLuint numlevels, GLuint minlayer, GLuint numlayers);
- void glTexStorage3DMultisample(GLenum target, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth, GLboolean fixedsamplelocations);
- void glTexStorage2DMultisample(GLenum target, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height, GLboolean fixedsamplelocations);
- void glTexBufferRange(GLenum target, GLenum internalformat, GLuint buffer, GLintptr offset, GLsizeiptr size);
- void glShaderStorageBlockBinding(GLuint program, GLuint storageBlockIndex, GLuint storageBlockBinding);
- GLint glGetProgramResourceLocationIndex(GLuint program, GLenum programInterface, const GLchar *name);
- GLint glGetProgramResourceLocation(GLuint program, GLenum programInterface, const GLchar *name);
- void glGetProgramResourceiv(GLuint program, GLenum programInterface, GLuint index, GLsizei propCount, const GLenum *props, GLsizei bufSize, GLsizei *length, GLint *params);
- void glGetProgramResourceName(GLuint program, GLenum programInterface, GLuint index, GLsizei bufSize, GLsizei *length, GLchar *name);
- GLuint glGetProgramResourceIndex(GLuint program, GLenum programInterface, const GLchar *name);
- void glGetProgramInterfaceiv(GLuint program, GLenum programInterface, GLenum pname, GLint *params);
- void glMultiDrawElementsIndirect(GLenum mode, GLenum type, const void *indirect, GLsizei drawcount, GLsizei stride);
- void glMultiDrawArraysIndirect(GLenum mode, const void *indirect, GLsizei drawcount, GLsizei stride);
- void glInvalidateSubFramebuffer(GLenum target, GLsizei numAttachments, const GLenum *attachments, GLint x, GLint y, GLsizei width, GLsizei height);
- void glInvalidateFramebuffer(GLenum target, GLsizei numAttachments, const GLenum *attachments);
- void glInvalidateBufferData(GLuint buffer);
- void glInvalidateBufferSubData(GLuint buffer, GLintptr offset, GLsizeiptr length);
- void glInvalidateTexImage(GLuint texture, GLint level);
- void glInvalidateTexSubImage(GLuint texture, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth);
- void glGetInternalformati64v(GLenum target, GLenum internalformat, GLenum pname, GLsizei bufSize, GLint64 *params);
- void glGetFramebufferParameteriv(GLenum target, GLenum pname, GLint *params);
- void glFramebufferParameteri(GLenum target, GLenum pname, GLint param);
- void glCopyImageSubData(GLuint srcName, GLenum srcTarget, GLint srcLevel, GLint srcX, GLint srcY, GLint srcZ, GLuint dstName, GLenum dstTarget, GLint dstLevel, GLint dstX, GLint dstY, GLint dstZ, GLsizei srcWidth, GLsizei srcHeight, GLsizei srcDepth);
- void glDispatchComputeIndirect(GLintptr indirect);
- void glDispatchCompute(GLuint num_groups_x, GLuint num_groups_y, GLuint num_groups_z);
- void glClearBufferSubData(GLenum target, GLenum internalformat, GLintptr offset, GLsizeiptr size, GLenum format, GLenum type, const void *data);
- void glClearBufferData(GLenum target, GLenum internalformat, GLenum format, GLenum type, const void *data);
-
- // OpenGL 4.4 core functions
- void glBindVertexBuffers(GLuint first, GLsizei count, const GLuint *buffers, const GLintptr *offsets, const GLsizei *strides);
- void glBindImageTextures(GLuint first, GLsizei count, const GLuint *textures);
- void glBindSamplers(GLuint first, GLsizei count, const GLuint *samplers);
- void glBindTextures(GLuint first, GLsizei count, const GLuint *textures);
- void glBindBuffersRange(GLenum target, GLuint first, GLsizei count, const GLuint *buffers, const GLintptr *offsets, const GLsizeiptr *sizes);
- void glBindBuffersBase(GLenum target, GLuint first, GLsizei count, const GLuint *buffers);
- void glClearTexSubImage(GLuint texture, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLenum type, const void *data);
- void glClearTexImage(GLuint texture, GLint level, GLenum format, GLenum type, const void *data);
- void glBufferStorage(GLenum target, GLsizeiptr size, const void *data, GLbitfield flags);
-
- // OpenGL 4.5 core functions
- void glTextureBarrier();
- void glReadnPixels(GLint x, GLint y, GLsizei width, GLsizei height, GLenum format, GLenum type, GLsizei bufSize, void *data);
- void glGetnUniformuiv(GLuint program, GLint location, GLsizei bufSize, GLuint *params);
- void glGetnUniformiv(GLuint program, GLint location, GLsizei bufSize, GLint *params);
- void glGetnUniformfv(GLuint program, GLint location, GLsizei bufSize, GLfloat *params);
- void glGetnUniformdv(GLuint program, GLint location, GLsizei bufSize, GLdouble *params);
- void glGetnTexImage(GLenum target, GLint level, GLenum format, GLenum type, GLsizei bufSize, void *pixels);
- void glGetnCompressedTexImage(GLenum target, GLint lod, GLsizei bufSize, void *pixels);
- GLenum glGetGraphicsResetStatus();
- void glGetCompressedTextureSubImage(GLuint texture, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLsizei bufSize, void *pixels);
- void glGetTextureSubImage(GLuint texture, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLenum type, GLsizei bufSize, void *pixels);
- void glMemoryBarrierByRegion(GLbitfield barriers);
- void glCreateQueries(GLenum target, GLsizei n, GLuint *ids);
- void glCreateProgramPipelines(GLsizei n, GLuint *pipelines);
- void glCreateSamplers(GLsizei n, GLuint *samplers);
- void glGetVertexArrayIndexed64iv(GLuint vaobj, GLuint index, GLenum pname, GLint64 *param);
- void glGetVertexArrayIndexediv(GLuint vaobj, GLuint index, GLenum pname, GLint *param);
- void glGetVertexArrayiv(GLuint vaobj, GLenum pname, GLint *param);
- void glVertexArrayBindingDivisor(GLuint vaobj, GLuint bindingindex, GLuint divisor);
- void glVertexArrayAttribLFormat(GLuint vaobj, GLuint attribindex, GLint size, GLenum type, GLuint relativeoffset);
- void glVertexArrayAttribIFormat(GLuint vaobj, GLuint attribindex, GLint size, GLenum type, GLuint relativeoffset);
- void glVertexArrayAttribFormat(GLuint vaobj, GLuint attribindex, GLint size, GLenum type, GLboolean normalized, GLuint relativeoffset);
- void glVertexArrayAttribBinding(GLuint vaobj, GLuint attribindex, GLuint bindingindex);
- void glVertexArrayVertexBuffers(GLuint vaobj, GLuint first, GLsizei count, const GLuint *buffers, const GLintptr *offsets, const GLsizei *strides);
- void glVertexArrayVertexBuffer(GLuint vaobj, GLuint bindingindex, GLuint buffer, GLintptr offset, GLsizei stride);
- void glVertexArrayElementBuffer(GLuint vaobj, GLuint buffer);
- void glEnableVertexArrayAttrib(GLuint vaobj, GLuint index);
- void glDisableVertexArrayAttrib(GLuint vaobj, GLuint index);
- void glCreateVertexArrays(GLsizei n, GLuint *arrays);
- void glGetTextureParameteriv(GLuint texture, GLenum pname, GLint *params);
- void glGetTextureParameterIuiv(GLuint texture, GLenum pname, GLuint *params);
- void glGetTextureParameterIiv(GLuint texture, GLenum pname, GLint *params);
- void glGetTextureParameterfv(GLuint texture, GLenum pname, GLfloat *params);
- void glGetTextureLevelParameteriv(GLuint texture, GLint level, GLenum pname, GLint *params);
- void glGetTextureLevelParameterfv(GLuint texture, GLint level, GLenum pname, GLfloat *params);
- void glGetCompressedTextureImage(GLuint texture, GLint level, GLsizei bufSize, void *pixels);
- void glGetTextureImage(GLuint texture, GLint level, GLenum format, GLenum type, GLsizei bufSize, void *pixels);
- void glBindTextureUnit(GLuint unit, GLuint texture);
- void glGenerateTextureMipmap(GLuint texture);
- void glTextureParameteriv(GLuint texture, GLenum pname, const GLint *param);
- void glTextureParameterIuiv(GLuint texture, GLenum pname, const GLuint *params);
- void glTextureParameterIiv(GLuint texture, GLenum pname, const GLint *params);
- void glTextureParameteri(GLuint texture, GLenum pname, GLint param);
- void glTextureParameterfv(GLuint texture, GLenum pname, const GLfloat *param);
- void glTextureParameterf(GLuint texture, GLenum pname, GLfloat param);
- void glCopyTextureSubImage3D(GLuint texture, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLint x, GLint y, GLsizei width, GLsizei height);
- void glCopyTextureSubImage2D(GLuint texture, GLint level, GLint xoffset, GLint yoffset, GLint x, GLint y, GLsizei width, GLsizei height);
- void glCopyTextureSubImage1D(GLuint texture, GLint level, GLint xoffset, GLint x, GLint y, GLsizei width);
- void glCompressedTextureSubImage3D(GLuint texture, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLsizei imageSize, const void *data);
- void glCompressedTextureSubImage2D(GLuint texture, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLsizei imageSize, const void *data);
- void glCompressedTextureSubImage1D(GLuint texture, GLint level, GLint xoffset, GLsizei width, GLenum format, GLsizei imageSize, const void *data);
- void glTextureSubImage3D(GLuint texture, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLenum type, const void *pixels);
- void glTextureSubImage2D(GLuint texture, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLenum type, const void *pixels);
- void glTextureSubImage1D(GLuint texture, GLint level, GLint xoffset, GLsizei width, GLenum format, GLenum type, const void *pixels);
- void glTextureStorage3DMultisample(GLuint texture, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth, GLboolean fixedsamplelocations);
- void glTextureStorage2DMultisample(GLuint texture, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height, GLboolean fixedsamplelocations);
- void glTextureStorage3D(GLuint texture, GLsizei levels, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth);
- void glTextureStorage2D(GLuint texture, GLsizei levels, GLenum internalformat, GLsizei width, GLsizei height);
- void glTextureStorage1D(GLuint texture, GLsizei levels, GLenum internalformat, GLsizei width);
- void glTextureBufferRange(GLuint texture, GLenum internalformat, GLuint buffer, GLintptr offset, GLsizei size);
- void glTextureBuffer(GLuint texture, GLenum internalformat, GLuint buffer);
- void glCreateTextures(GLenum target, GLsizei n, GLuint *textures);
- void glGetNamedRenderbufferParameteriv(GLuint renderbuffer, GLenum pname, GLint *params);
- void glNamedRenderbufferStorageMultisample(GLuint renderbuffer, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height);
- void glNamedRenderbufferStorage(GLuint renderbuffer, GLenum internalformat, GLsizei width, GLsizei height);
- void glCreateRenderbuffers(GLsizei n, GLuint *renderbuffers);
- void glGetNamedFramebufferAttachmentParameteriv(GLuint framebuffer, GLenum attachment, GLenum pname, GLint *params);
- void glGetNamedFramebufferParameteriv(GLuint framebuffer, GLenum pname, GLint *param);
- GLenum glCheckNamedFramebufferStatus(GLuint framebuffer, GLenum target);
- void glBlitNamedFramebuffer(GLuint readFramebuffer, GLuint drawFramebuffer, GLint srcX0, GLint srcY0, GLint srcX1, GLint srcY1, GLint dstX0, GLint dstY0, GLint dstX1, GLint dstY1, GLbitfield mask, GLenum filter);
- void glClearNamedFramebufferfi(GLuint framebuffer, GLenum buffer, GLfloat depth, GLint stencil);
- void glClearNamedFramebufferfv(GLuint framebuffer, GLenum buffer, GLint drawbuffer, const GLfloat *value);
- void glClearNamedFramebufferuiv(GLuint framebuffer, GLenum buffer, GLint drawbuffer, const GLuint *value);
- void glClearNamedFramebufferiv(GLuint framebuffer, GLenum buffer, GLint drawbuffer, const GLint *value);
- void glInvalidateNamedFramebufferSubData(GLuint framebuffer, GLsizei numAttachments, const GLenum *attachments, GLint x, GLint y, GLsizei width, GLsizei height);
- void glInvalidateNamedFramebufferData(GLuint framebuffer, GLsizei numAttachments, const GLenum *attachments);
- void glNamedFramebufferReadBuffer(GLuint framebuffer, GLenum src);
- void glNamedFramebufferDrawBuffers(GLuint framebuffer, GLsizei n, const GLenum *bufs);
- void glNamedFramebufferDrawBuffer(GLuint framebuffer, GLenum buf);
- void glNamedFramebufferTextureLayer(GLuint framebuffer, GLenum attachment, GLuint texture, GLint level, GLint layer);
- void glNamedFramebufferTexture(GLuint framebuffer, GLenum attachment, GLuint texture, GLint level);
- void glNamedFramebufferParameteri(GLuint framebuffer, GLenum pname, GLint param);
- void glNamedFramebufferRenderbuffer(GLuint framebuffer, GLenum attachment, GLenum renderbuffertarget, GLuint renderbuffer);
- void glCreateFramebuffers(GLsizei n, GLuint *framebuffers);
- void glGetNamedBufferSubData(GLuint buffer, GLintptr offset, GLsizei size, void *data);
- void glGetNamedBufferPointerv(GLuint buffer, GLenum pname, void * *params);
- void glGetNamedBufferParameteri64v(GLuint buffer, GLenum pname, GLint64 *params);
- void glGetNamedBufferParameteriv(GLuint buffer, GLenum pname, GLint *params);
- void glFlushMappedNamedBufferRange(GLuint buffer, GLintptr offset, GLsizei length);
- GLboolean glUnmapNamedBuffer(GLuint buffer);
- void * glMapNamedBufferRange(GLuint buffer, GLintptr offset, GLsizei length, GLbitfield access);
- void * glMapNamedBuffer(GLuint buffer, GLenum access);
- void glClearNamedBufferSubData(GLuint buffer, GLenum internalformat, GLintptr offset, GLsizei size, GLenum format, GLenum type, const void *data);
- void glClearNamedBufferData(GLuint buffer, GLenum internalformat, GLenum format, GLenum type, const void *data);
- void glCopyNamedBufferSubData(GLuint readBuffer, GLuint writeBuffer, GLintptr readOffset, GLintptr writeOffset, GLsizei size);
- void glNamedBufferSubData(GLuint buffer, GLintptr offset, GLsizei size, const void *data);
- void glNamedBufferData(GLuint buffer, GLsizei size, const void *data, GLenum usage);
- void glNamedBufferStorage(GLuint buffer, GLsizei size, const void *data, GLbitfield flags);
- void glCreateBuffers(GLsizei n, GLuint *buffers);
- void glGetTransformFeedbacki64_v(GLuint xfb, GLenum pname, GLuint index, GLint64 *param);
- void glGetTransformFeedbacki_v(GLuint xfb, GLenum pname, GLuint index, GLint *param);
- void glGetTransformFeedbackiv(GLuint xfb, GLenum pname, GLint *param);
- void glTransformFeedbackBufferRange(GLuint xfb, GLuint index, GLuint buffer, GLintptr offset, GLsizei size);
- void glTransformFeedbackBufferBase(GLuint xfb, GLuint index, GLuint buffer);
- void glCreateTransformFeedbacks(GLsizei n, GLuint *ids);
- void glClipControl(GLenum origin, GLenum depth);
-
- // OpenGL 1.0 deprecated functions
- void glTranslatef(GLfloat x, GLfloat y, GLfloat z);
- void glTranslated(GLdouble x, GLdouble y, GLdouble z);
- void glScalef(GLfloat x, GLfloat y, GLfloat z);
- void glScaled(GLdouble x, GLdouble y, GLdouble z);
- void glRotatef(GLfloat angle, GLfloat x, GLfloat y, GLfloat z);
- void glRotated(GLdouble angle, GLdouble x, GLdouble y, GLdouble z);
- void glPushMatrix();
- void glPopMatrix();
- void glOrtho(GLdouble left, GLdouble right, GLdouble bottom, GLdouble top, GLdouble zNear, GLdouble zFar);
- void glMultMatrixd(const GLdouble *m);
- void glMultMatrixf(const GLfloat *m);
- void glMatrixMode(GLenum mode);
- void glLoadMatrixd(const GLdouble *m);
- void glLoadMatrixf(const GLfloat *m);
- void glLoadIdentity();
- void glFrustum(GLdouble left, GLdouble right, GLdouble bottom, GLdouble top, GLdouble zNear, GLdouble zFar);
- GLboolean glIsList(GLuint list);
- void glGetTexGeniv(GLenum coord, GLenum pname, GLint *params);
- void glGetTexGenfv(GLenum coord, GLenum pname, GLfloat *params);
- void glGetTexGendv(GLenum coord, GLenum pname, GLdouble *params);
- void glGetTexEnviv(GLenum target, GLenum pname, GLint *params);
- void glGetTexEnvfv(GLenum target, GLenum pname, GLfloat *params);
- void glGetPolygonStipple(GLubyte *mask);
- void glGetPixelMapusv(GLenum map, GLushort *values);
- void glGetPixelMapuiv(GLenum map, GLuint *values);
- void glGetPixelMapfv(GLenum map, GLfloat *values);
- void glGetMaterialiv(GLenum face, GLenum pname, GLint *params);
- void glGetMaterialfv(GLenum face, GLenum pname, GLfloat *params);
- void glGetMapiv(GLenum target, GLenum query, GLint *v);
- void glGetMapfv(GLenum target, GLenum query, GLfloat *v);
- void glGetMapdv(GLenum target, GLenum query, GLdouble *v);
- void glGetLightiv(GLenum light, GLenum pname, GLint *params);
- void glGetLightfv(GLenum light, GLenum pname, GLfloat *params);
- void glGetClipPlane(GLenum plane, GLdouble *equation);
- void glDrawPixels(GLsizei width, GLsizei height, GLenum format, GLenum type, const void *pixels);
- void glCopyPixels(GLint x, GLint y, GLsizei width, GLsizei height, GLenum type);
- void glPixelMapusv(GLenum map, GLsizei mapsize, const GLushort *values);
- void glPixelMapuiv(GLenum map, GLsizei mapsize, const GLuint *values);
- void glPixelMapfv(GLenum map, GLsizei mapsize, const GLfloat *values);
- void glPixelTransferi(GLenum pname, GLint param);
- void glPixelTransferf(GLenum pname, GLfloat param);
- void glPixelZoom(GLfloat xfactor, GLfloat yfactor);
- void glAlphaFunc(GLenum func, GLfloat ref);
- void glEvalPoint2(GLint i, GLint j);
- void glEvalMesh2(GLenum mode, GLint i1, GLint i2, GLint j1, GLint j2);
- void glEvalPoint1(GLint i);
- void glEvalMesh1(GLenum mode, GLint i1, GLint i2);
- void glEvalCoord2fv(const GLfloat *u);
- void glEvalCoord2f(GLfloat u, GLfloat v);
- void glEvalCoord2dv(const GLdouble *u);
- void glEvalCoord2d(GLdouble u, GLdouble v);
- void glEvalCoord1fv(const GLfloat *u);
- void glEvalCoord1f(GLfloat u);
- void glEvalCoord1dv(const GLdouble *u);
- void glEvalCoord1d(GLdouble u);
- void glMapGrid2f(GLint un, GLfloat u1, GLfloat u2, GLint vn, GLfloat v1, GLfloat v2);
- void glMapGrid2d(GLint un, GLdouble u1, GLdouble u2, GLint vn, GLdouble v1, GLdouble v2);
- void glMapGrid1f(GLint un, GLfloat u1, GLfloat u2);
- void glMapGrid1d(GLint un, GLdouble u1, GLdouble u2);
- void glMap2f(GLenum target, GLfloat u1, GLfloat u2, GLint ustride, GLint uorder, GLfloat v1, GLfloat v2, GLint vstride, GLint vorder, const GLfloat *points);
- void glMap2d(GLenum target, GLdouble u1, GLdouble u2, GLint ustride, GLint uorder, GLdouble v1, GLdouble v2, GLint vstride, GLint vorder, const GLdouble *points);
- void glMap1f(GLenum target, GLfloat u1, GLfloat u2, GLint stride, GLint order, const GLfloat *points);
- void glMap1d(GLenum target, GLdouble u1, GLdouble u2, GLint stride, GLint order, const GLdouble *points);
- void glPushAttrib(GLbitfield mask);
- void glPopAttrib();
- void glAccum(GLenum op, GLfloat value);
- void glIndexMask(GLuint mask);
- void glClearIndex(GLfloat c);
- void glClearAccum(GLfloat red, GLfloat green, GLfloat blue, GLfloat alpha);
- void glPushName(GLuint name);
- void glPopName();
- void glPassThrough(GLfloat token);
- void glLoadName(GLuint name);
- void glInitNames();
- GLint glRenderMode(GLenum mode);
- void glSelectBuffer(GLsizei size, GLuint *buffer);
- void glFeedbackBuffer(GLsizei size, GLenum type, GLfloat *buffer);
- void glTexGeniv(GLenum coord, GLenum pname, const GLint *params);
- void glTexGeni(GLenum coord, GLenum pname, GLint param);
- void glTexGenfv(GLenum coord, GLenum pname, const GLfloat *params);
- void glTexGenf(GLenum coord, GLenum pname, GLfloat param);
- void glTexGendv(GLenum coord, GLenum pname, const GLdouble *params);
- void glTexGend(GLenum coord, GLenum pname, GLdouble param);
- void glTexEnviv(GLenum target, GLenum pname, const GLint *params);
- void glTexEnvi(GLenum target, GLenum pname, GLint param);
- void glTexEnvfv(GLenum target, GLenum pname, const GLfloat *params);
- void glTexEnvf(GLenum target, GLenum pname, GLfloat param);
- void glShadeModel(GLenum mode);
- void glPolygonStipple(const GLubyte *mask);
- void glMaterialiv(GLenum face, GLenum pname, const GLint *params);
- void glMateriali(GLenum face, GLenum pname, GLint param);
- void glMaterialfv(GLenum face, GLenum pname, const GLfloat *params);
- void glMaterialf(GLenum face, GLenum pname, GLfloat param);
- void glLineStipple(GLint factor, GLushort pattern);
- void glLightModeliv(GLenum pname, const GLint *params);
- void glLightModeli(GLenum pname, GLint param);
- void glLightModelfv(GLenum pname, const GLfloat *params);
- void glLightModelf(GLenum pname, GLfloat param);
- void glLightiv(GLenum light, GLenum pname, const GLint *params);
- void glLighti(GLenum light, GLenum pname, GLint param);
- void glLightfv(GLenum light, GLenum pname, const GLfloat *params);
- void glLightf(GLenum light, GLenum pname, GLfloat param);
- void glFogiv(GLenum pname, const GLint *params);
- void glFogi(GLenum pname, GLint param);
- void glFogfv(GLenum pname, const GLfloat *params);
- void glFogf(GLenum pname, GLfloat param);
- void glColorMaterial(GLenum face, GLenum mode);
- void glClipPlane(GLenum plane, const GLdouble *equation);
- void glVertex4sv(const GLshort *v);
- void glVertex4s(GLshort x, GLshort y, GLshort z, GLshort w);
- void glVertex4iv(const GLint *v);
- void glVertex4i(GLint x, GLint y, GLint z, GLint w);
- void glVertex4fv(const GLfloat *v);
- void glVertex4f(GLfloat x, GLfloat y, GLfloat z, GLfloat w);
- void glVertex4dv(const GLdouble *v);
- void glVertex4d(GLdouble x, GLdouble y, GLdouble z, GLdouble w);
- void glVertex3sv(const GLshort *v);
- void glVertex3s(GLshort x, GLshort y, GLshort z);
- void glVertex3iv(const GLint *v);
- void glVertex3i(GLint x, GLint y, GLint z);
- void glVertex3fv(const GLfloat *v);
- void glVertex3f(GLfloat x, GLfloat y, GLfloat z);
- void glVertex3dv(const GLdouble *v);
- void glVertex3d(GLdouble x, GLdouble y, GLdouble z);
- void glVertex2sv(const GLshort *v);
- void glVertex2s(GLshort x, GLshort y);
- void glVertex2iv(const GLint *v);
- void glVertex2i(GLint x, GLint y);
- void glVertex2fv(const GLfloat *v);
- void glVertex2f(GLfloat x, GLfloat y);
- void glVertex2dv(const GLdouble *v);
- void glVertex2d(GLdouble x, GLdouble y);
- void glTexCoord4sv(const GLshort *v);
- void glTexCoord4s(GLshort s, GLshort t, GLshort r, GLshort q);
- void glTexCoord4iv(const GLint *v);
- void glTexCoord4i(GLint s, GLint t, GLint r, GLint q);
- void glTexCoord4fv(const GLfloat *v);
- void glTexCoord4f(GLfloat s, GLfloat t, GLfloat r, GLfloat q);
- void glTexCoord4dv(const GLdouble *v);
- void glTexCoord4d(GLdouble s, GLdouble t, GLdouble r, GLdouble q);
- void glTexCoord3sv(const GLshort *v);
- void glTexCoord3s(GLshort s, GLshort t, GLshort r);
- void glTexCoord3iv(const GLint *v);
- void glTexCoord3i(GLint s, GLint t, GLint r);
- void glTexCoord3fv(const GLfloat *v);
- void glTexCoord3f(GLfloat s, GLfloat t, GLfloat r);
- void glTexCoord3dv(const GLdouble *v);
- void glTexCoord3d(GLdouble s, GLdouble t, GLdouble r);
- void glTexCoord2sv(const GLshort *v);
- void glTexCoord2s(GLshort s, GLshort t);
- void glTexCoord2iv(const GLint *v);
- void glTexCoord2i(GLint s, GLint t);
- void glTexCoord2fv(const GLfloat *v);
- void glTexCoord2f(GLfloat s, GLfloat t);
- void glTexCoord2dv(const GLdouble *v);
- void glTexCoord2d(GLdouble s, GLdouble t);
- void glTexCoord1sv(const GLshort *v);
- void glTexCoord1s(GLshort s);
- void glTexCoord1iv(const GLint *v);
- void glTexCoord1i(GLint s);
- void glTexCoord1fv(const GLfloat *v);
- void glTexCoord1f(GLfloat s);
- void glTexCoord1dv(const GLdouble *v);
- void glTexCoord1d(GLdouble s);
- void glRectsv(const GLshort *v1, const GLshort *v2);
- void glRects(GLshort x1, GLshort y1, GLshort x2, GLshort y2);
- void glRectiv(const GLint *v1, const GLint *v2);
- void glRecti(GLint x1, GLint y1, GLint x2, GLint y2);
- void glRectfv(const GLfloat *v1, const GLfloat *v2);
- void glRectf(GLfloat x1, GLfloat y1, GLfloat x2, GLfloat y2);
- void glRectdv(const GLdouble *v1, const GLdouble *v2);
- void glRectd(GLdouble x1, GLdouble y1, GLdouble x2, GLdouble y2);
- void glRasterPos4sv(const GLshort *v);
- void glRasterPos4s(GLshort x, GLshort y, GLshort z, GLshort w);
- void glRasterPos4iv(const GLint *v);
- void glRasterPos4i(GLint x, GLint y, GLint z, GLint w);
- void glRasterPos4fv(const GLfloat *v);
- void glRasterPos4f(GLfloat x, GLfloat y, GLfloat z, GLfloat w);
- void glRasterPos4dv(const GLdouble *v);
- void glRasterPos4d(GLdouble x, GLdouble y, GLdouble z, GLdouble w);
- void glRasterPos3sv(const GLshort *v);
- void glRasterPos3s(GLshort x, GLshort y, GLshort z);
- void glRasterPos3iv(const GLint *v);
- void glRasterPos3i(GLint x, GLint y, GLint z);
- void glRasterPos3fv(const GLfloat *v);
- void glRasterPos3f(GLfloat x, GLfloat y, GLfloat z);
- void glRasterPos3dv(const GLdouble *v);
- void glRasterPos3d(GLdouble x, GLdouble y, GLdouble z);
- void glRasterPos2sv(const GLshort *v);
- void glRasterPos2s(GLshort x, GLshort y);
- void glRasterPos2iv(const GLint *v);
- void glRasterPos2i(GLint x, GLint y);
- void glRasterPos2fv(const GLfloat *v);
- void glRasterPos2f(GLfloat x, GLfloat y);
- void glRasterPos2dv(const GLdouble *v);
- void glRasterPos2d(GLdouble x, GLdouble y);
- void glNormal3sv(const GLshort *v);
- void glNormal3s(GLshort nx, GLshort ny, GLshort nz);
- void glNormal3iv(const GLint *v);
- void glNormal3i(GLint nx, GLint ny, GLint nz);
- void glNormal3fv(const GLfloat *v);
- void glNormal3f(GLfloat nx, GLfloat ny, GLfloat nz);
- void glNormal3dv(const GLdouble *v);
- void glNormal3d(GLdouble nx, GLdouble ny, GLdouble nz);
- void glNormal3bv(const GLbyte *v);
- void glNormal3b(GLbyte nx, GLbyte ny, GLbyte nz);
- void glIndexsv(const GLshort *c);
- void glIndexs(GLshort c);
- void glIndexiv(const GLint *c);
- void glIndexi(GLint c);
- void glIndexfv(const GLfloat *c);
- void glIndexf(GLfloat c);
- void glIndexdv(const GLdouble *c);
- void glIndexd(GLdouble c);
- void glEnd();
- void glEdgeFlagv(const GLboolean *flag);
- void glEdgeFlag(GLboolean flag);
- void glColor4usv(const GLushort *v);
- void glColor4us(GLushort red, GLushort green, GLushort blue, GLushort alpha);
- void glColor4uiv(const GLuint *v);
- void glColor4ui(GLuint red, GLuint green, GLuint blue, GLuint alpha);
- void glColor4ubv(const GLubyte *v);
- void glColor4ub(GLubyte red, GLubyte green, GLubyte blue, GLubyte alpha);
- void glColor4sv(const GLshort *v);
- void glColor4s(GLshort red, GLshort green, GLshort blue, GLshort alpha);
- void glColor4iv(const GLint *v);
- void glColor4i(GLint red, GLint green, GLint blue, GLint alpha);
- void glColor4fv(const GLfloat *v);
- void glColor4f(GLfloat red, GLfloat green, GLfloat blue, GLfloat alpha);
- void glColor4dv(const GLdouble *v);
- void glColor4d(GLdouble red, GLdouble green, GLdouble blue, GLdouble alpha);
- void glColor4bv(const GLbyte *v);
- void glColor4b(GLbyte red, GLbyte green, GLbyte blue, GLbyte alpha);
- void glColor3usv(const GLushort *v);
- void glColor3us(GLushort red, GLushort green, GLushort blue);
- void glColor3uiv(const GLuint *v);
- void glColor3ui(GLuint red, GLuint green, GLuint blue);
- void glColor3ubv(const GLubyte *v);
- void glColor3ub(GLubyte red, GLubyte green, GLubyte blue);
- void glColor3sv(const GLshort *v);
- void glColor3s(GLshort red, GLshort green, GLshort blue);
- void glColor3iv(const GLint *v);
- void glColor3i(GLint red, GLint green, GLint blue);
- void glColor3fv(const GLfloat *v);
- void glColor3f(GLfloat red, GLfloat green, GLfloat blue);
- void glColor3dv(const GLdouble *v);
- void glColor3d(GLdouble red, GLdouble green, GLdouble blue);
- void glColor3bv(const GLbyte *v);
- void glColor3b(GLbyte red, GLbyte green, GLbyte blue);
- void glBitmap(GLsizei width, GLsizei height, GLfloat xorig, GLfloat yorig, GLfloat xmove, GLfloat ymove, const GLubyte *bitmap);
- void glBegin(GLenum mode);
- void glListBase(GLuint base);
- GLuint glGenLists(GLsizei range);
- void glDeleteLists(GLuint list, GLsizei range);
- void glCallLists(GLsizei n, GLenum type, const void *lists);
- void glCallList(GLuint list);
- void glEndList();
- void glNewList(GLuint list, GLenum mode);
-
- // OpenGL 1.1 deprecated functions
- void glPushClientAttrib(GLbitfield mask);
- void glPopClientAttrib();
- void glIndexubv(const GLubyte *c);
- void glIndexub(GLubyte c);
- void glPrioritizeTextures(GLsizei n, const GLuint *textures, const GLfloat *priorities);
- GLboolean glAreTexturesResident(GLsizei n, const GLuint *textures, GLboolean *residences);
- void glVertexPointer(GLint size, GLenum type, GLsizei stride, const void *pointer);
- void glTexCoordPointer(GLint size, GLenum type, GLsizei stride, const void *pointer);
- void glNormalPointer(GLenum type, GLsizei stride, const void *pointer);
- void glInterleavedArrays(GLenum format, GLsizei stride, const void *pointer);
- void glGetPointerv(GLenum pname, void * *params);
- void glIndexPointer(GLenum type, GLsizei stride, const void *pointer);
- void glEnableClientState(GLenum array);
- void glEdgeFlagPointer(GLsizei stride, const void *pointer);
- void glDisableClientState(GLenum array);
- void glColorPointer(GLint size, GLenum type, GLsizei stride, const void *pointer);
- void glArrayElement(GLint i);
-
- // OpenGL 1.2 deprecated functions
- void glColorTable(GLenum target, GLenum internalformat, GLsizei width, GLenum format, GLenum type, const void *table);
- void glColorTableParameterfv(GLenum target, GLenum pname, const GLfloat *params);
- void glColorTableParameteriv(GLenum target, GLenum pname, const GLint *params);
- void glCopyColorTable(GLenum target, GLenum internalformat, GLint x, GLint y, GLsizei width);
- void glGetColorTable(GLenum target, GLenum format, GLenum type, void *table);
- void glGetColorTableParameterfv(GLenum target, GLenum pname, GLfloat *params);
- void glGetColorTableParameteriv(GLenum target, GLenum pname, GLint *params);
- void glColorSubTable(GLenum target, GLsizei start, GLsizei count, GLenum format, GLenum type, const void *data);
- void glCopyColorSubTable(GLenum target, GLsizei start, GLint x, GLint y, GLsizei width);
- void glConvolutionFilter1D(GLenum target, GLenum internalformat, GLsizei width, GLenum format, GLenum type, const void *image);
- void glConvolutionFilter2D(GLenum target, GLenum internalformat, GLsizei width, GLsizei height, GLenum format, GLenum type, const void *image);
- void glConvolutionParameterf(GLenum target, GLenum pname, GLfloat params);
- void glConvolutionParameterfv(GLenum target, GLenum pname, const GLfloat *params);
- void glConvolutionParameteri(GLenum target, GLenum pname, GLint params);
- void glConvolutionParameteriv(GLenum target, GLenum pname, const GLint *params);
- void glCopyConvolutionFilter1D(GLenum target, GLenum internalformat, GLint x, GLint y, GLsizei width);
- void glCopyConvolutionFilter2D(GLenum target, GLenum internalformat, GLint x, GLint y, GLsizei width, GLsizei height);
- void glGetConvolutionFilter(GLenum target, GLenum format, GLenum type, void *image);
- void glGetConvolutionParameterfv(GLenum target, GLenum pname, GLfloat *params);
- void glGetConvolutionParameteriv(GLenum target, GLenum pname, GLint *params);
- void glGetSeparableFilter(GLenum target, GLenum format, GLenum type, void *row, void *column, void *span);
- void glSeparableFilter2D(GLenum target, GLenum internalformat, GLsizei width, GLsizei height, GLenum format, GLenum type, const void *row, const void *column);
- void glGetHistogram(GLenum target, GLboolean reset, GLenum format, GLenum type, void *values);
- void glGetHistogramParameterfv(GLenum target, GLenum pname, GLfloat *params);
- void glGetHistogramParameteriv(GLenum target, GLenum pname, GLint *params);
- void glGetMinmax(GLenum target, GLboolean reset, GLenum format, GLenum type, void *values);
- void glGetMinmaxParameterfv(GLenum target, GLenum pname, GLfloat *params);
- void glGetMinmaxParameteriv(GLenum target, GLenum pname, GLint *params);
- void glHistogram(GLenum target, GLsizei width, GLenum internalformat, GLboolean sink);
- void glMinmax(GLenum target, GLenum internalformat, GLboolean sink);
- void glResetHistogram(GLenum target);
- void glResetMinmax(GLenum target);
-
- // OpenGL 1.3 deprecated functions
- void glMultTransposeMatrixd(const GLdouble *m);
- void glMultTransposeMatrixf(const GLfloat *m);
- void glLoadTransposeMatrixd(const GLdouble *m);
- void glLoadTransposeMatrixf(const GLfloat *m);
- void glMultiTexCoord4sv(GLenum target, const GLshort *v);
- void glMultiTexCoord4s(GLenum target, GLshort s, GLshort t, GLshort r, GLshort q);
- void glMultiTexCoord4iv(GLenum target, const GLint *v);
- void glMultiTexCoord4i(GLenum target, GLint s, GLint t, GLint r, GLint q);
- void glMultiTexCoord4fv(GLenum target, const GLfloat *v);
- void glMultiTexCoord4f(GLenum target, GLfloat s, GLfloat t, GLfloat r, GLfloat q);
- void glMultiTexCoord4dv(GLenum target, const GLdouble *v);
- void glMultiTexCoord4d(GLenum target, GLdouble s, GLdouble t, GLdouble r, GLdouble q);
- void glMultiTexCoord3sv(GLenum target, const GLshort *v);
- void glMultiTexCoord3s(GLenum target, GLshort s, GLshort t, GLshort r);
- void glMultiTexCoord3iv(GLenum target, const GLint *v);
- void glMultiTexCoord3i(GLenum target, GLint s, GLint t, GLint r);
- void glMultiTexCoord3fv(GLenum target, const GLfloat *v);
- void glMultiTexCoord3f(GLenum target, GLfloat s, GLfloat t, GLfloat r);
- void glMultiTexCoord3dv(GLenum target, const GLdouble *v);
- void glMultiTexCoord3d(GLenum target, GLdouble s, GLdouble t, GLdouble r);
- void glMultiTexCoord2sv(GLenum target, const GLshort *v);
- void glMultiTexCoord2s(GLenum target, GLshort s, GLshort t);
- void glMultiTexCoord2iv(GLenum target, const GLint *v);
- void glMultiTexCoord2i(GLenum target, GLint s, GLint t);
- void glMultiTexCoord2fv(GLenum target, const GLfloat *v);
- void glMultiTexCoord2f(GLenum target, GLfloat s, GLfloat t);
- void glMultiTexCoord2dv(GLenum target, const GLdouble *v);
- void glMultiTexCoord2d(GLenum target, GLdouble s, GLdouble t);
- void glMultiTexCoord1sv(GLenum target, const GLshort *v);
- void glMultiTexCoord1s(GLenum target, GLshort s);
- void glMultiTexCoord1iv(GLenum target, const GLint *v);
- void glMultiTexCoord1i(GLenum target, GLint s);
- void glMultiTexCoord1fv(GLenum target, const GLfloat *v);
- void glMultiTexCoord1f(GLenum target, GLfloat s);
- void glMultiTexCoord1dv(GLenum target, const GLdouble *v);
- void glMultiTexCoord1d(GLenum target, GLdouble s);
- void glClientActiveTexture(GLenum texture);
-
- // OpenGL 1.4 deprecated functions
- void glWindowPos3sv(const GLshort *v);
- void glWindowPos3s(GLshort x, GLshort y, GLshort z);
- void glWindowPos3iv(const GLint *v);
- void glWindowPos3i(GLint x, GLint y, GLint z);
- void glWindowPos3fv(const GLfloat *v);
- void glWindowPos3f(GLfloat x, GLfloat y, GLfloat z);
- void glWindowPos3dv(const GLdouble *v);
- void glWindowPos3d(GLdouble x, GLdouble y, GLdouble z);
- void glWindowPos2sv(const GLshort *v);
- void glWindowPos2s(GLshort x, GLshort y);
- void glWindowPos2iv(const GLint *v);
- void glWindowPos2i(GLint x, GLint y);
- void glWindowPos2fv(const GLfloat *v);
- void glWindowPos2f(GLfloat x, GLfloat y);
- void glWindowPos2dv(const GLdouble *v);
- void glWindowPos2d(GLdouble x, GLdouble y);
- void glSecondaryColorPointer(GLint size, GLenum type, GLsizei stride, const void *pointer);
- void glSecondaryColor3usv(const GLushort *v);
- void glSecondaryColor3us(GLushort red, GLushort green, GLushort blue);
- void glSecondaryColor3uiv(const GLuint *v);
- void glSecondaryColor3ui(GLuint red, GLuint green, GLuint blue);
- void glSecondaryColor3ubv(const GLubyte *v);
- void glSecondaryColor3ub(GLubyte red, GLubyte green, GLubyte blue);
- void glSecondaryColor3sv(const GLshort *v);
- void glSecondaryColor3s(GLshort red, GLshort green, GLshort blue);
- void glSecondaryColor3iv(const GLint *v);
- void glSecondaryColor3i(GLint red, GLint green, GLint blue);
- void glSecondaryColor3fv(const GLfloat *v);
- void glSecondaryColor3f(GLfloat red, GLfloat green, GLfloat blue);
- void glSecondaryColor3dv(const GLdouble *v);
- void glSecondaryColor3d(GLdouble red, GLdouble green, GLdouble blue);
- void glSecondaryColor3bv(const GLbyte *v);
- void glSecondaryColor3b(GLbyte red, GLbyte green, GLbyte blue);
- void glFogCoordPointer(GLenum type, GLsizei stride, const void *pointer);
- void glFogCoorddv(const GLdouble *coord);
- void glFogCoordd(GLdouble coord);
- void glFogCoordfv(const GLfloat *coord);
- void glFogCoordf(GLfloat coord);
-
- // OpenGL 1.5 deprecated functions
-
- // OpenGL 2.0 deprecated functions
-
- // OpenGL 2.1 deprecated functions
-
- // OpenGL 3.0 deprecated functions
-
- // OpenGL 3.1 deprecated functions
-
- // OpenGL 3.2 deprecated functions
-
- // OpenGL 3.3 deprecated functions
- void glSecondaryColorP3uiv(GLenum type, const GLuint *color);
- void glSecondaryColorP3ui(GLenum type, GLuint color);
- void glColorP4uiv(GLenum type, const GLuint *color);
- void glColorP4ui(GLenum type, GLuint color);
- void glColorP3uiv(GLenum type, const GLuint *color);
- void glColorP3ui(GLenum type, GLuint color);
- void glNormalP3uiv(GLenum type, const GLuint *coords);
- void glNormalP3ui(GLenum type, GLuint coords);
- void glMultiTexCoordP4uiv(GLenum texture, GLenum type, const GLuint *coords);
- void glMultiTexCoordP4ui(GLenum texture, GLenum type, GLuint coords);
- void glMultiTexCoordP3uiv(GLenum texture, GLenum type, const GLuint *coords);
- void glMultiTexCoordP3ui(GLenum texture, GLenum type, GLuint coords);
- void glMultiTexCoordP2uiv(GLenum texture, GLenum type, const GLuint *coords);
- void glMultiTexCoordP2ui(GLenum texture, GLenum type, GLuint coords);
- void glMultiTexCoordP1uiv(GLenum texture, GLenum type, const GLuint *coords);
- void glMultiTexCoordP1ui(GLenum texture, GLenum type, GLuint coords);
- void glTexCoordP4uiv(GLenum type, const GLuint *coords);
- void glTexCoordP4ui(GLenum type, GLuint coords);
- void glTexCoordP3uiv(GLenum type, const GLuint *coords);
- void glTexCoordP3ui(GLenum type, GLuint coords);
- void glTexCoordP2uiv(GLenum type, const GLuint *coords);
- void glTexCoordP2ui(GLenum type, GLuint coords);
- void glTexCoordP1uiv(GLenum type, const GLuint *coords);
- void glTexCoordP1ui(GLenum type, GLuint coords);
- void glVertexP4uiv(GLenum type, const GLuint *value);
- void glVertexP4ui(GLenum type, GLuint value);
- void glVertexP3uiv(GLenum type, const GLuint *value);
- void glVertexP3ui(GLenum type, GLuint value);
- void glVertexP2uiv(GLenum type, const GLuint *value);
- void glVertexP2ui(GLenum type, GLuint value);
-
- // OpenGL 4.0 deprecated functions
-
- // OpenGL 4.1 deprecated functions
-
- // OpenGL 4.2 deprecated functions
-
- // OpenGL 4.3 deprecated functions
-
- // OpenGL 4.4 deprecated functions
-
- // OpenGL 4.5 deprecated functions
- void glGetnMinmax(GLenum target, GLboolean reset, GLenum format, GLenum type, GLsizei bufSize, void *values);
- void glGetnHistogram(GLenum target, GLboolean reset, GLenum format, GLenum type, GLsizei bufSize, void *values);
- void glGetnSeparableFilter(GLenum target, GLenum format, GLenum type, GLsizei rowBufSize, void *row, GLsizei columnBufSize, void *column, void *span);
- void glGetnConvolutionFilter(GLenum target, GLenum format, GLenum type, GLsizei bufSize, void *image);
- void glGetnColorTable(GLenum target, GLenum format, GLenum type, GLsizei bufSize, void *table);
- void glGetnPolygonStipple(GLsizei bufSize, GLubyte *pattern);
- void glGetnPixelMapusv(GLenum map, GLsizei bufSize, GLushort *values);
- void glGetnPixelMapuiv(GLenum map, GLsizei bufSize, GLuint *values);
- void glGetnPixelMapfv(GLenum map, GLsizei bufSize, GLfloat *values);
- void glGetnMapiv(GLenum target, GLenum query, GLsizei bufSize, GLint *v);
- void glGetnMapfv(GLenum target, GLenum query, GLsizei bufSize, GLfloat *v);
- void glGetnMapdv(GLenum target, GLenum query, GLsizei bufSize, GLdouble *v);
-
-private:
- friend class QOpenGLContext;
-
- static bool isContextCompatible(QOpenGLContext *context);
- static QOpenGLVersionProfile versionProfile();
-
- QOpenGLFunctions_1_0_CoreBackend* d_1_0_Core;
- QOpenGLFunctions_1_1_CoreBackend* d_1_1_Core;
- QOpenGLFunctions_1_2_CoreBackend* d_1_2_Core;
- QOpenGLFunctions_1_3_CoreBackend* d_1_3_Core;
- QOpenGLFunctions_1_4_CoreBackend* d_1_4_Core;
- QOpenGLFunctions_1_5_CoreBackend* d_1_5_Core;
- QOpenGLFunctions_2_0_CoreBackend* d_2_0_Core;
- QOpenGLFunctions_2_1_CoreBackend* d_2_1_Core;
- QOpenGLFunctions_3_0_CoreBackend* d_3_0_Core;
- QOpenGLFunctions_3_1_CoreBackend* d_3_1_Core;
- QOpenGLFunctions_3_2_CoreBackend* d_3_2_Core;
- QOpenGLFunctions_3_3_CoreBackend* d_3_3_Core;
- QOpenGLFunctions_4_0_CoreBackend* d_4_0_Core;
- QOpenGLFunctions_4_1_CoreBackend* d_4_1_Core;
- QOpenGLFunctions_4_2_CoreBackend* d_4_2_Core;
- QOpenGLFunctions_4_3_CoreBackend* d_4_3_Core;
- QOpenGLFunctions_4_4_CoreBackend* d_4_4_Core;
- QOpenGLFunctions_4_5_CoreBackend* d_4_5_Core;
- QOpenGLFunctions_1_0_DeprecatedBackend* d_1_0_Deprecated;
- QOpenGLFunctions_1_1_DeprecatedBackend* d_1_1_Deprecated;
- QOpenGLFunctions_1_2_DeprecatedBackend* d_1_2_Deprecated;
- QOpenGLFunctions_1_3_DeprecatedBackend* d_1_3_Deprecated;
- QOpenGLFunctions_1_4_DeprecatedBackend* d_1_4_Deprecated;
- QOpenGLFunctions_3_3_DeprecatedBackend* d_3_3_Deprecated;
- QOpenGLFunctions_4_5_DeprecatedBackend* d_4_5_Deprecated;
-};
-
-// OpenGL 1.0 core functions
-inline void QOpenGLFunctions_4_5_Compatibility::glViewport(GLint x, GLint y, GLsizei width, GLsizei height)
-{
- d_1_0_Core->f.Viewport(x, y, width, height);
-}
-
-inline void QOpenGLFunctions_4_5_Compatibility::glDepthRange(GLdouble nearVal, GLdouble farVal)
-{
- d_1_0_Core->f.DepthRange(nearVal, farVal);
-}
-
-inline GLboolean QOpenGLFunctions_4_5_Compatibility::glIsEnabled(GLenum cap)
-{
- return d_1_0_Core->f.IsEnabled(cap);
-}
-
-inline void QOpenGLFunctions_4_5_Compatibility::glGetTexLevelParameteriv(GLenum target, GLint level, GLenum pname, GLint *params)
-{
- d_1_0_Core->f.GetTexLevelParameteriv(target, level, pname, params);
-}
-
-inline void QOpenGLFunctions_4_5_Compatibility::glGetTexLevelParameterfv(GLenum target, GLint level, GLenum pname, GLfloat *params)
-{
- d_1_0_Core->f.GetTexLevelParameterfv(target, level, pname, params);
-}
-
-inline void QOpenGLFunctions_4_5_Compatibility::glGetTexParameteriv(GLenum target, GLenum pname, GLint *params)
-{
- d_1_0_Core->f.GetTexParameteriv(target, pname, params);
-}
-
-inline void QOpenGLFunctions_4_5_Compatibility::glGetTexParameterfv(GLenum target, GLenum pname, GLfloat *params)
-{
- d_1_0_Core->f.GetTexParameterfv(target, pname, params);
-}
-
-inline void QOpenGLFunctions_4_5_Compatibility::glGetTexImage(GLenum target, GLint level, GLenum format, GLenum type, void *pixels)
-{
- d_1_0_Core->f.GetTexImage(target, level, format, type, pixels);
-}
-
-inline const GLubyte * QOpenGLFunctions_4_5_Compatibility::glGetString(GLenum name)
-{
- return d_1_0_Core->f.GetString(name);
-}
-
-inline void QOpenGLFunctions_4_5_Compatibility::glGetIntegerv(GLenum pname, GLint *data)
-{
- d_1_0_Core->f.GetIntegerv(pname, data);
-}
-
-inline void QOpenGLFunctions_4_5_Compatibility::glGetFloatv(GLenum pname, GLfloat *data)
-{
- d_1_0_Core->f.GetFloatv(pname, data);
-}
-
-inline GLenum QOpenGLFunctions_4_5_Compatibility::glGetError()
-{
- return d_1_0_Core->f.GetError();
-}
-
-inline void QOpenGLFunctions_4_5_Compatibility::glGetDoublev(GLenum pname, GLdouble *data)
-{
- d_1_0_Core->f.GetDoublev(pname, data);
-}
-
-inline void QOpenGLFunctions_4_5_Compatibility::glGetBooleanv(GLenum pname, GLboolean *data)
-{
- d_1_0_Core->f.GetBooleanv(pname, data);
-}
-
-inline void QOpenGLFunctions_4_5_Compatibility::glReadPixels(GLint x, GLint y, GLsizei width, GLsizei height, GLenum format, GLenum type, void *pixels)
-{
- d_1_0_Core->f.ReadPixels(x, y, width, height, format, type, pixels);
-}
-
-inline void QOpenGLFunctions_4_5_Compatibility::glReadBuffer(GLenum src)
-{
- d_1_0_Core->f.ReadBuffer(src);
-}
-
-inline void QOpenGLFunctions_4_5_Compatibility::glPixelStorei(GLenum pname, GLint param)
-{
- d_1_0_Core->f.PixelStorei(pname, param);
-}
-
-inline void QOpenGLFunctions_4_5_Compatibility::glPixelStoref(GLenum pname, GLfloat param)
-{
- d_1_0_Core->f.PixelStoref(pname, param);
-}
-
-inline void QOpenGLFunctions_4_5_Compatibility::glDepthFunc(GLenum func)
-{
- d_1_0_Core->f.DepthFunc(func);
-}
-
-inline void QOpenGLFunctions_4_5_Compatibility::glStencilOp(GLenum fail, GLenum zfail, GLenum zpass)
-{
- d_1_0_Core->f.StencilOp(fail, zfail, zpass);
-}
-
-inline void QOpenGLFunctions_4_5_Compatibility::glStencilFunc(GLenum func, GLint ref, GLuint mask)
-{
- d_1_0_Core->f.StencilFunc(func, ref, mask);
-}
-
-inline void QOpenGLFunctions_4_5_Compatibility::glLogicOp(GLenum opcode)
-{
- d_1_0_Core->f.LogicOp(opcode);
-}
-
-inline void QOpenGLFunctions_4_5_Compatibility::glBlendFunc(GLenum sfactor, GLenum dfactor)
-{
- d_1_0_Core->f.BlendFunc(sfactor, dfactor);
-}
-
-inline void QOpenGLFunctions_4_5_Compatibility::glFlush()
-{
- d_1_0_Core->f.Flush();
-}
-
-inline void QOpenGLFunctions_4_5_Compatibility::glFinish()
-{
- d_1_0_Core->f.Finish();
-}
-
-inline void QOpenGLFunctions_4_5_Compatibility::glEnable(GLenum cap)
-{
- d_1_0_Core->f.Enable(cap);
-}
-
-inline void QOpenGLFunctions_4_5_Compatibility::glDisable(GLenum cap)
-{
- d_1_0_Core->f.Disable(cap);
-}
-
-inline void QOpenGLFunctions_4_5_Compatibility::glDepthMask(GLboolean flag)
-{
- d_1_0_Core->f.DepthMask(flag);
-}
-
-inline void QOpenGLFunctions_4_5_Compatibility::glColorMask(GLboolean red, GLboolean green, GLboolean blue, GLboolean alpha)
-{
- d_1_0_Core->f.ColorMask(red, green, blue, alpha);
-}
-
-inline void QOpenGLFunctions_4_5_Compatibility::glStencilMask(GLuint mask)
-{
- d_1_0_Core->f.StencilMask(mask);
-}
-
-inline void QOpenGLFunctions_4_5_Compatibility::glClearDepth(GLdouble depth)
-{
- d_1_0_Core->f.ClearDepth(depth);
-}
-
-inline void QOpenGLFunctions_4_5_Compatibility::glClearStencil(GLint s)
-{
- d_1_0_Core->f.ClearStencil(s);
-}
-
-inline void QOpenGLFunctions_4_5_Compatibility::glClearColor(GLfloat red, GLfloat green, GLfloat blue, GLfloat alpha)
-{
- d_1_0_Core->f.ClearColor(red, green, blue, alpha);
-}
-
-inline void QOpenGLFunctions_4_5_Compatibility::glClear(GLbitfield mask)
-{
- d_1_0_Core->f.Clear(mask);
-}
-
-inline void QOpenGLFunctions_4_5_Compatibility::glDrawBuffer(GLenum buf)
-{
- d_1_0_Core->f.DrawBuffer(buf);
-}
-
-inline void QOpenGLFunctions_4_5_Compatibility::glTexImage2D(GLenum target, GLint level, GLint internalformat, GLsizei width, GLsizei height, GLint border, GLenum format, GLenum type, const void *pixels)
-{
- d_1_0_Core->f.TexImage2D(target, level, internalformat, width, height, border, format, type, pixels);
-}
-
-inline void QOpenGLFunctions_4_5_Compatibility::glTexImage1D(GLenum target, GLint level, GLint internalformat, GLsizei width, GLint border, GLenum format, GLenum type, const void *pixels)
-{
- d_1_0_Core->f.TexImage1D(target, level, internalformat, width, border, format, type, pixels);
-}
-
-inline void QOpenGLFunctions_4_5_Compatibility::glTexParameteriv(GLenum target, GLenum pname, const GLint *params)
-{
- d_1_0_Core->f.TexParameteriv(target, pname, params);
-}
-
-inline void QOpenGLFunctions_4_5_Compatibility::glTexParameteri(GLenum target, GLenum pname, GLint param)
-{
- d_1_0_Core->f.TexParameteri(target, pname, param);
-}
-
-inline void QOpenGLFunctions_4_5_Compatibility::glTexParameterfv(GLenum target, GLenum pname, const GLfloat *params)
-{
- d_1_0_Core->f.TexParameterfv(target, pname, params);
-}
-
-inline void QOpenGLFunctions_4_5_Compatibility::glTexParameterf(GLenum target, GLenum pname, GLfloat param)
-{
- d_1_0_Core->f.TexParameterf(target, pname, param);
-}
-
-inline void QOpenGLFunctions_4_5_Compatibility::glScissor(GLint x, GLint y, GLsizei width, GLsizei height)
-{
- d_1_0_Core->f.Scissor(x, y, width, height);
-}
-
-inline void QOpenGLFunctions_4_5_Compatibility::glPolygonMode(GLenum face, GLenum mode)
-{
- d_1_0_Core->f.PolygonMode(face, mode);
-}
-
-inline void QOpenGLFunctions_4_5_Compatibility::glPointSize(GLfloat size)
-{
- d_1_0_Core->f.PointSize(size);
-}
-
-inline void QOpenGLFunctions_4_5_Compatibility::glLineWidth(GLfloat width)
-{
- d_1_0_Core->f.LineWidth(width);
-}
-
-inline void QOpenGLFunctions_4_5_Compatibility::glHint(GLenum target, GLenum mode)
-{
- d_1_0_Core->f.Hint(target, mode);
-}
-
-inline void QOpenGLFunctions_4_5_Compatibility::glFrontFace(GLenum mode)
-{
- d_1_0_Core->f.FrontFace(mode);
-}
-
-inline void QOpenGLFunctions_4_5_Compatibility::glCullFace(GLenum mode)
-{
- d_1_0_Core->f.CullFace(mode);
-}
-
-
-// OpenGL 1.1 core functions
-inline GLboolean QOpenGLFunctions_4_5_Compatibility::glIsTexture(GLuint texture)
-{
- return d_1_1_Core->f.IsTexture(texture);
-}
-
-inline void QOpenGLFunctions_4_5_Compatibility::glGenTextures(GLsizei n, GLuint *textures)
-{
- d_1_1_Core->f.GenTextures(n, textures);
-}
-
-inline void QOpenGLFunctions_4_5_Compatibility::glDeleteTextures(GLsizei n, const GLuint *textures)
-{
- d_1_1_Core->f.DeleteTextures(n, textures);
-}
-
-inline void QOpenGLFunctions_4_5_Compatibility::glBindTexture(GLenum target, GLuint texture)
-{
- d_1_1_Core->f.BindTexture(target, texture);
-}
-
-inline void QOpenGLFunctions_4_5_Compatibility::glTexSubImage2D(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLenum type, const void *pixels)
-{
- d_1_1_Core->f.TexSubImage2D(target, level, xoffset, yoffset, width, height, format, type, pixels);
-}
-
-inline void QOpenGLFunctions_4_5_Compatibility::glTexSubImage1D(GLenum target, GLint level, GLint xoffset, GLsizei width, GLenum format, GLenum type, const void *pixels)
-{
- d_1_1_Core->f.TexSubImage1D(target, level, xoffset, width, format, type, pixels);
-}
-
-inline void QOpenGLFunctions_4_5_Compatibility::glCopyTexSubImage2D(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint x, GLint y, GLsizei width, GLsizei height)
-{
- d_1_1_Core->f.CopyTexSubImage2D(target, level, xoffset, yoffset, x, y, width, height);
-}
-
-inline void QOpenGLFunctions_4_5_Compatibility::glCopyTexSubImage1D(GLenum target, GLint level, GLint xoffset, GLint x, GLint y, GLsizei width)
-{
- d_1_1_Core->f.CopyTexSubImage1D(target, level, xoffset, x, y, width);
-}
-
-inline void QOpenGLFunctions_4_5_Compatibility::glCopyTexImage2D(GLenum target, GLint level, GLenum internalformat, GLint x, GLint y, GLsizei width, GLsizei height, GLint border)
-{
- d_1_1_Core->f.CopyTexImage2D(target, level, internalformat, x, y, width, height, border);
-}
-
-inline void QOpenGLFunctions_4_5_Compatibility::glCopyTexImage1D(GLenum target, GLint level, GLenum internalformat, GLint x, GLint y, GLsizei width, GLint border)
-{
- d_1_1_Core->f.CopyTexImage1D(target, level, internalformat, x, y, width, border);
-}
-
-inline void QOpenGLFunctions_4_5_Compatibility::glPolygonOffset(GLfloat factor, GLfloat units)
-{
- d_1_1_Core->f.PolygonOffset(factor, units);
-}
-
-inline void QOpenGLFunctions_4_5_Compatibility::glDrawElements(GLenum mode, GLsizei count, GLenum type, const void *indices)
-{
- d_1_1_Core->f.DrawElements(mode, count, type, indices);
-}
-
-inline void QOpenGLFunctions_4_5_Compatibility::glDrawArrays(GLenum mode, GLint first, GLsizei count)
-{
- d_1_1_Core->f.DrawArrays(mode, first, count);
-}
-
-
-// OpenGL 1.2 core functions
-inline void QOpenGLFunctions_4_5_Compatibility::glBlendColor(GLfloat red, GLfloat green, GLfloat blue, GLfloat alpha)
-{
- d_1_2_Core->f.BlendColor(red, green, blue, alpha);
-}
-
-inline void QOpenGLFunctions_4_5_Compatibility::glBlendEquation(GLenum mode)
-{
- d_1_2_Core->f.BlendEquation(mode);
-}
-
-inline void QOpenGLFunctions_4_5_Compatibility::glCopyTexSubImage3D(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLint x, GLint y, GLsizei width, GLsizei height)
-{
- d_1_2_Core->f.CopyTexSubImage3D(target, level, xoffset, yoffset, zoffset, x, y, width, height);
-}
-
-inline void QOpenGLFunctions_4_5_Compatibility::glTexSubImage3D(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLenum type, const void *pixels)
-{
- d_1_2_Core->f.TexSubImage3D(target, level, xoffset, yoffset, zoffset, width, height, depth, format, type, pixels);
-}
-
-inline void QOpenGLFunctions_4_5_Compatibility::glTexImage3D(GLenum target, GLint level, GLint internalformat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLenum format, GLenum type, const void *pixels)
-{
- d_1_2_Core->f.TexImage3D(target, level, internalformat, width, height, depth, border, format, type, pixels);
-}
-
-inline void QOpenGLFunctions_4_5_Compatibility::glDrawRangeElements(GLenum mode, GLuint start, GLuint end, GLsizei count, GLenum type, const void *indices)
-{
- d_1_2_Core->f.DrawRangeElements(mode, start, end, count, type, indices);
-}
-
-
-// OpenGL 1.3 core functions
-inline void QOpenGLFunctions_4_5_Compatibility::glGetCompressedTexImage(GLenum target, GLint level, void *img)
-{
- d_1_3_Core->f.GetCompressedTexImage(target, level, img);
-}
-
-inline void QOpenGLFunctions_4_5_Compatibility::glCompressedTexSubImage1D(GLenum target, GLint level, GLint xoffset, GLsizei width, GLenum format, GLsizei imageSize, const void *data)
-{
- d_1_3_Core->f.CompressedTexSubImage1D(target, level, xoffset, width, format, imageSize, data);
-}
-
-inline void QOpenGLFunctions_4_5_Compatibility::glCompressedTexSubImage2D(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLsizei imageSize, const void *data)
-{
- d_1_3_Core->f.CompressedTexSubImage2D(target, level, xoffset, yoffset, width, height, format, imageSize, data);
-}
-
-inline void QOpenGLFunctions_4_5_Compatibility::glCompressedTexSubImage3D(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLsizei imageSize, const void *data)
-{
- d_1_3_Core->f.CompressedTexSubImage3D(target, level, xoffset, yoffset, zoffset, width, height, depth, format, imageSize, data);
-}
-
-inline void QOpenGLFunctions_4_5_Compatibility::glCompressedTexImage1D(GLenum target, GLint level, GLenum internalformat, GLsizei width, GLint border, GLsizei imageSize, const void *data)
-{
- d_1_3_Core->f.CompressedTexImage1D(target, level, internalformat, width, border, imageSize, data);
-}
-
-inline void QOpenGLFunctions_4_5_Compatibility::glCompressedTexImage2D(GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLint border, GLsizei imageSize, const void *data)
-{
- d_1_3_Core->f.CompressedTexImage2D(target, level, internalformat, width, height, border, imageSize, data);
-}
-
-inline void QOpenGLFunctions_4_5_Compatibility::glCompressedTexImage3D(GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLsizei imageSize, const void *data)
-{
- d_1_3_Core->f.CompressedTexImage3D(target, level, internalformat, width, height, depth, border, imageSize, data);
-}
-
-inline void QOpenGLFunctions_4_5_Compatibility::glSampleCoverage(GLfloat value, GLboolean invert)
-{
- d_1_3_Core->f.SampleCoverage(value, invert);
-}
-
-inline void QOpenGLFunctions_4_5_Compatibility::glActiveTexture(GLenum texture)
-{
- d_1_3_Core->f.ActiveTexture(texture);
-}
-
-
-// OpenGL 1.4 core functions
-inline void QOpenGLFunctions_4_5_Compatibility::glPointParameteriv(GLenum pname, const GLint *params)
-{
- d_1_4_Core->f.PointParameteriv(pname, params);
-}
-
-inline void QOpenGLFunctions_4_5_Compatibility::glPointParameteri(GLenum pname, GLint param)
-{
- d_1_4_Core->f.PointParameteri(pname, param);
-}
-
-inline void QOpenGLFunctions_4_5_Compatibility::glPointParameterfv(GLenum pname, const GLfloat *params)
-{
- d_1_4_Core->f.PointParameterfv(pname, params);
-}
-
-inline void QOpenGLFunctions_4_5_Compatibility::glPointParameterf(GLenum pname, GLfloat param)
-{
- d_1_4_Core->f.PointParameterf(pname, param);
-}
-
-inline void QOpenGLFunctions_4_5_Compatibility::glMultiDrawElements(GLenum mode, const GLsizei *count, GLenum type, const void *const *indices, GLsizei drawcount)
-{
- d_1_4_Core->f.MultiDrawElements(mode, count, type, indices, drawcount);
-}
-
-inline void QOpenGLFunctions_4_5_Compatibility::glMultiDrawArrays(GLenum mode, const GLint *first, const GLsizei *count, GLsizei drawcount)
-{
- d_1_4_Core->f.MultiDrawArrays(mode, first, count, drawcount);
-}
-
-inline void QOpenGLFunctions_4_5_Compatibility::glBlendFuncSeparate(GLenum sfactorRGB, GLenum dfactorRGB, GLenum sfactorAlpha, GLenum dfactorAlpha)
-{
- d_1_4_Core->f.BlendFuncSeparate(sfactorRGB, dfactorRGB, sfactorAlpha, dfactorAlpha);
-}
-
-
-// OpenGL 1.5 core functions
-inline void QOpenGLFunctions_4_5_Compatibility::glGetBufferPointerv(GLenum target, GLenum pname, void * *params)
-{
- d_1_5_Core->f.GetBufferPointerv(target, pname, params);
-}
-
-inline void QOpenGLFunctions_4_5_Compatibility::glGetBufferParameteriv(GLenum target, GLenum pname, GLint *params)
-{
- d_1_5_Core->f.GetBufferParameteriv(target, pname, params);
-}
-
-inline GLboolean QOpenGLFunctions_4_5_Compatibility::glUnmapBuffer(GLenum target)
-{
- return d_1_5_Core->f.UnmapBuffer(target);
-}
-
-inline void * QOpenGLFunctions_4_5_Compatibility::glMapBuffer(GLenum target, GLenum access)
-{
- return d_1_5_Core->f.MapBuffer(target, access);
-}
-
-inline void QOpenGLFunctions_4_5_Compatibility::glGetBufferSubData(GLenum target, GLintptr offset, GLsizeiptr size, void *data)
-{
- d_1_5_Core->f.GetBufferSubData(target, offset, size, data);
-}
-
-inline void QOpenGLFunctions_4_5_Compatibility::glBufferSubData(GLenum target, GLintptr offset, GLsizeiptr size, const void *data)
-{
- d_1_5_Core->f.BufferSubData(target, offset, size, data);
-}
-
-inline void QOpenGLFunctions_4_5_Compatibility::glBufferData(GLenum target, GLsizeiptr size, const void *data, GLenum usage)
-{
- d_1_5_Core->f.BufferData(target, size, data, usage);
-}
-
-inline GLboolean QOpenGLFunctions_4_5_Compatibility::glIsBuffer(GLuint buffer)
-{
- return d_1_5_Core->f.IsBuffer(buffer);
-}
-
-inline void QOpenGLFunctions_4_5_Compatibility::glGenBuffers(GLsizei n, GLuint *buffers)
-{
- d_1_5_Core->f.GenBuffers(n, buffers);
-}
-
-inline void QOpenGLFunctions_4_5_Compatibility::glDeleteBuffers(GLsizei n, const GLuint *buffers)
-{
- d_1_5_Core->f.DeleteBuffers(n, buffers);
-}
-
-inline void QOpenGLFunctions_4_5_Compatibility::glBindBuffer(GLenum target, GLuint buffer)
-{
- d_1_5_Core->f.BindBuffer(target, buffer);
-}
-
-inline void QOpenGLFunctions_4_5_Compatibility::glGetQueryObjectuiv(GLuint id, GLenum pname, GLuint *params)
-{
- d_1_5_Core->f.GetQueryObjectuiv(id, pname, params);
-}
-
-inline void QOpenGLFunctions_4_5_Compatibility::glGetQueryObjectiv(GLuint id, GLenum pname, GLint *params)
-{
- d_1_5_Core->f.GetQueryObjectiv(id, pname, params);
-}
-
-inline void QOpenGLFunctions_4_5_Compatibility::glGetQueryiv(GLenum target, GLenum pname, GLint *params)
-{
- d_1_5_Core->f.GetQueryiv(target, pname, params);
-}
-
-inline void QOpenGLFunctions_4_5_Compatibility::glEndQuery(GLenum target)
-{
- d_1_5_Core->f.EndQuery(target);
-}
-
-inline void QOpenGLFunctions_4_5_Compatibility::glBeginQuery(GLenum target, GLuint id)
-{
- d_1_5_Core->f.BeginQuery(target, id);
-}
-
-inline GLboolean QOpenGLFunctions_4_5_Compatibility::glIsQuery(GLuint id)
-{
- return d_1_5_Core->f.IsQuery(id);
-}
-
-inline void QOpenGLFunctions_4_5_Compatibility::glDeleteQueries(GLsizei n, const GLuint *ids)
-{
- d_1_5_Core->f.DeleteQueries(n, ids);
-}
-
-inline void QOpenGLFunctions_4_5_Compatibility::glGenQueries(GLsizei n, GLuint *ids)
-{
- d_1_5_Core->f.GenQueries(n, ids);
-}
-
-
-// OpenGL 2.0 core functions
-inline void QOpenGLFunctions_4_5_Compatibility::glVertexAttribPointer(GLuint index, GLint size, GLenum type, GLboolean normalized, GLsizei stride, const void *pointer)
-{
- d_2_0_Core->f.VertexAttribPointer(index, size, type, normalized, stride, pointer);
-}
-
-inline void QOpenGLFunctions_4_5_Compatibility::glVertexAttrib4usv(GLuint index, const GLushort *v)
-{
- d_2_0_Core->f.VertexAttrib4usv(index, v);
-}
-
-inline void QOpenGLFunctions_4_5_Compatibility::glVertexAttrib4uiv(GLuint index, const GLuint *v)
-{
- d_2_0_Core->f.VertexAttrib4uiv(index, v);
-}
-
-inline void QOpenGLFunctions_4_5_Compatibility::glVertexAttrib4ubv(GLuint index, const GLubyte *v)
-{
- d_2_0_Core->f.VertexAttrib4ubv(index, v);
-}
-
-inline void QOpenGLFunctions_4_5_Compatibility::glVertexAttrib4sv(GLuint index, const GLshort *v)
-{
- d_2_0_Core->f.VertexAttrib4sv(index, v);
-}
-
-inline void QOpenGLFunctions_4_5_Compatibility::glVertexAttrib4s(GLuint index, GLshort x, GLshort y, GLshort z, GLshort w)
-{
- d_2_0_Core->f.VertexAttrib4s(index, x, y, z, w);
-}
-
-inline void QOpenGLFunctions_4_5_Compatibility::glVertexAttrib4iv(GLuint index, const GLint *v)
-{
- d_2_0_Core->f.VertexAttrib4iv(index, v);
-}
-
-inline void QOpenGLFunctions_4_5_Compatibility::glVertexAttrib4fv(GLuint index, const GLfloat *v)
-{
- d_2_0_Core->f.VertexAttrib4fv(index, v);
-}
-
-inline void QOpenGLFunctions_4_5_Compatibility::glVertexAttrib4f(GLuint index, GLfloat x, GLfloat y, GLfloat z, GLfloat w)
-{
- d_2_0_Core->f.VertexAttrib4f(index, x, y, z, w);
-}
-
-inline void QOpenGLFunctions_4_5_Compatibility::glVertexAttrib4dv(GLuint index, const GLdouble *v)
-{
- d_2_0_Core->f.VertexAttrib4dv(index, v);
-}
-
-inline void QOpenGLFunctions_4_5_Compatibility::glVertexAttrib4d(GLuint index, GLdouble x, GLdouble y, GLdouble z, GLdouble w)
-{
- d_2_0_Core->f.VertexAttrib4d(index, x, y, z, w);
-}
-
-inline void QOpenGLFunctions_4_5_Compatibility::glVertexAttrib4bv(GLuint index, const GLbyte *v)
-{
- d_2_0_Core->f.VertexAttrib4bv(index, v);
-}
-
-inline void QOpenGLFunctions_4_5_Compatibility::glVertexAttrib4Nusv(GLuint index, const GLushort *v)
-{
- d_2_0_Core->f.VertexAttrib4Nusv(index, v);
-}
-
-inline void QOpenGLFunctions_4_5_Compatibility::glVertexAttrib4Nuiv(GLuint index, const GLuint *v)
-{
- d_2_0_Core->f.VertexAttrib4Nuiv(index, v);
-}
-
-inline void QOpenGLFunctions_4_5_Compatibility::glVertexAttrib4Nubv(GLuint index, const GLubyte *v)
-{
- d_2_0_Core->f.VertexAttrib4Nubv(index, v);
-}
-
-inline void QOpenGLFunctions_4_5_Compatibility::glVertexAttrib4Nub(GLuint index, GLubyte x, GLubyte y, GLubyte z, GLubyte w)
-{
- d_2_0_Core->f.VertexAttrib4Nub(index, x, y, z, w);
-}
-
-inline void QOpenGLFunctions_4_5_Compatibility::glVertexAttrib4Nsv(GLuint index, const GLshort *v)
-{
- d_2_0_Core->f.VertexAttrib4Nsv(index, v);
-}
-
-inline void QOpenGLFunctions_4_5_Compatibility::glVertexAttrib4Niv(GLuint index, const GLint *v)
-{
- d_2_0_Core->f.VertexAttrib4Niv(index, v);
-}
-
-inline void QOpenGLFunctions_4_5_Compatibility::glVertexAttrib4Nbv(GLuint index, const GLbyte *v)
-{
- d_2_0_Core->f.VertexAttrib4Nbv(index, v);
-}
-
-inline void QOpenGLFunctions_4_5_Compatibility::glVertexAttrib3sv(GLuint index, const GLshort *v)
-{
- d_2_0_Core->f.VertexAttrib3sv(index, v);
-}
-
-inline void QOpenGLFunctions_4_5_Compatibility::glVertexAttrib3s(GLuint index, GLshort x, GLshort y, GLshort z)
-{
- d_2_0_Core->f.VertexAttrib3s(index, x, y, z);
-}
-
-inline void QOpenGLFunctions_4_5_Compatibility::glVertexAttrib3fv(GLuint index, const GLfloat *v)
-{
- d_2_0_Core->f.VertexAttrib3fv(index, v);
-}
-
-inline void QOpenGLFunctions_4_5_Compatibility::glVertexAttrib3f(GLuint index, GLfloat x, GLfloat y, GLfloat z)
-{
- d_2_0_Core->f.VertexAttrib3f(index, x, y, z);
-}
-
-inline void QOpenGLFunctions_4_5_Compatibility::glVertexAttrib3dv(GLuint index, const GLdouble *v)
-{
- d_2_0_Core->f.VertexAttrib3dv(index, v);
-}
-
-inline void QOpenGLFunctions_4_5_Compatibility::glVertexAttrib3d(GLuint index, GLdouble x, GLdouble y, GLdouble z)
-{
- d_2_0_Core->f.VertexAttrib3d(index, x, y, z);
-}
-
-inline void QOpenGLFunctions_4_5_Compatibility::glVertexAttrib2sv(GLuint index, const GLshort *v)
-{
- d_2_0_Core->f.VertexAttrib2sv(index, v);
-}
-
-inline void QOpenGLFunctions_4_5_Compatibility::glVertexAttrib2s(GLuint index, GLshort x, GLshort y)
-{
- d_2_0_Core->f.VertexAttrib2s(index, x, y);
-}
-
-inline void QOpenGLFunctions_4_5_Compatibility::glVertexAttrib2fv(GLuint index, const GLfloat *v)
-{
- d_2_0_Core->f.VertexAttrib2fv(index, v);
-}
-
-inline void QOpenGLFunctions_4_5_Compatibility::glVertexAttrib2f(GLuint index, GLfloat x, GLfloat y)
-{
- d_2_0_Core->f.VertexAttrib2f(index, x, y);
-}
-
-inline void QOpenGLFunctions_4_5_Compatibility::glVertexAttrib2dv(GLuint index, const GLdouble *v)
-{
- d_2_0_Core->f.VertexAttrib2dv(index, v);
-}
-
-inline void QOpenGLFunctions_4_5_Compatibility::glVertexAttrib2d(GLuint index, GLdouble x, GLdouble y)
-{
- d_2_0_Core->f.VertexAttrib2d(index, x, y);
-}
-
-inline void QOpenGLFunctions_4_5_Compatibility::glVertexAttrib1sv(GLuint index, const GLshort *v)
-{
- d_2_0_Core->f.VertexAttrib1sv(index, v);
-}
-
-inline void QOpenGLFunctions_4_5_Compatibility::glVertexAttrib1s(GLuint index, GLshort x)
-{
- d_2_0_Core->f.VertexAttrib1s(index, x);
-}
-
-inline void QOpenGLFunctions_4_5_Compatibility::glVertexAttrib1fv(GLuint index, const GLfloat *v)
-{
- d_2_0_Core->f.VertexAttrib1fv(index, v);
-}
-
-inline void QOpenGLFunctions_4_5_Compatibility::glVertexAttrib1f(GLuint index, GLfloat x)
-{
- d_2_0_Core->f.VertexAttrib1f(index, x);
-}
-
-inline void QOpenGLFunctions_4_5_Compatibility::glVertexAttrib1dv(GLuint index, const GLdouble *v)
-{
- d_2_0_Core->f.VertexAttrib1dv(index, v);
-}
-
-inline void QOpenGLFunctions_4_5_Compatibility::glVertexAttrib1d(GLuint index, GLdouble x)
-{
- d_2_0_Core->f.VertexAttrib1d(index, x);
-}
-
-inline void QOpenGLFunctions_4_5_Compatibility::glValidateProgram(GLuint program)
-{
- d_2_0_Core->f.ValidateProgram(program);
-}
-
-inline void QOpenGLFunctions_4_5_Compatibility::glUniformMatrix4fv(GLint location, GLsizei count, GLboolean transpose, const GLfloat *value)
-{
- d_2_0_Core->f.UniformMatrix4fv(location, count, transpose, value);
-}
-
-inline void QOpenGLFunctions_4_5_Compatibility::glUniformMatrix3fv(GLint location, GLsizei count, GLboolean transpose, const GLfloat *value)
-{
- d_2_0_Core->f.UniformMatrix3fv(location, count, transpose, value);
-}
-
-inline void QOpenGLFunctions_4_5_Compatibility::glUniformMatrix2fv(GLint location, GLsizei count, GLboolean transpose, const GLfloat *value)
-{
- d_2_0_Core->f.UniformMatrix2fv(location, count, transpose, value);
-}
-
-inline void QOpenGLFunctions_4_5_Compatibility::glUniform4iv(GLint location, GLsizei count, const GLint *value)
-{
- d_2_0_Core->f.Uniform4iv(location, count, value);
-}
-
-inline void QOpenGLFunctions_4_5_Compatibility::glUniform3iv(GLint location, GLsizei count, const GLint *value)
-{
- d_2_0_Core->f.Uniform3iv(location, count, value);
-}
-
-inline void QOpenGLFunctions_4_5_Compatibility::glUniform2iv(GLint location, GLsizei count, const GLint *value)
-{
- d_2_0_Core->f.Uniform2iv(location, count, value);
-}
-
-inline void QOpenGLFunctions_4_5_Compatibility::glUniform1iv(GLint location, GLsizei count, const GLint *value)
-{
- d_2_0_Core->f.Uniform1iv(location, count, value);
-}
-
-inline void QOpenGLFunctions_4_5_Compatibility::glUniform4fv(GLint location, GLsizei count, const GLfloat *value)
-{
- d_2_0_Core->f.Uniform4fv(location, count, value);
-}
-
-inline void QOpenGLFunctions_4_5_Compatibility::glUniform3fv(GLint location, GLsizei count, const GLfloat *value)
-{
- d_2_0_Core->f.Uniform3fv(location, count, value);
-}
-
-inline void QOpenGLFunctions_4_5_Compatibility::glUniform2fv(GLint location, GLsizei count, const GLfloat *value)
-{
- d_2_0_Core->f.Uniform2fv(location, count, value);
-}
-
-inline void QOpenGLFunctions_4_5_Compatibility::glUniform1fv(GLint location, GLsizei count, const GLfloat *value)
-{
- d_2_0_Core->f.Uniform1fv(location, count, value);
-}
-
-inline void QOpenGLFunctions_4_5_Compatibility::glUniform4i(GLint location, GLint v0, GLint v1, GLint v2, GLint v3)
-{
- d_2_0_Core->f.Uniform4i(location, v0, v1, v2, v3);
-}
-
-inline void QOpenGLFunctions_4_5_Compatibility::glUniform3i(GLint location, GLint v0, GLint v1, GLint v2)
-{
- d_2_0_Core->f.Uniform3i(location, v0, v1, v2);
-}
-
-inline void QOpenGLFunctions_4_5_Compatibility::glUniform2i(GLint location, GLint v0, GLint v1)
-{
- d_2_0_Core->f.Uniform2i(location, v0, v1);
-}
-
-inline void QOpenGLFunctions_4_5_Compatibility::glUniform1i(GLint location, GLint v0)
-{
- d_2_0_Core->f.Uniform1i(location, v0);
-}
-
-inline void QOpenGLFunctions_4_5_Compatibility::glUniform4f(GLint location, GLfloat v0, GLfloat v1, GLfloat v2, GLfloat v3)
-{
- d_2_0_Core->f.Uniform4f(location, v0, v1, v2, v3);
-}
-
-inline void QOpenGLFunctions_4_5_Compatibility::glUniform3f(GLint location, GLfloat v0, GLfloat v1, GLfloat v2)
-{
- d_2_0_Core->f.Uniform3f(location, v0, v1, v2);
-}
-
-inline void QOpenGLFunctions_4_5_Compatibility::glUniform2f(GLint location, GLfloat v0, GLfloat v1)
-{
- d_2_0_Core->f.Uniform2f(location, v0, v1);
-}
-
-inline void QOpenGLFunctions_4_5_Compatibility::glUniform1f(GLint location, GLfloat v0)
-{
- d_2_0_Core->f.Uniform1f(location, v0);
-}
-
-inline void QOpenGLFunctions_4_5_Compatibility::glUseProgram(GLuint program)
-{
- d_2_0_Core->f.UseProgram(program);
-}
-
-inline void QOpenGLFunctions_4_5_Compatibility::glShaderSource(GLuint shader, GLsizei count, const GLchar *const *string, const GLint *length)
-{
- d_2_0_Core->f.ShaderSource(shader, count, string, length);
-}
-
-inline void QOpenGLFunctions_4_5_Compatibility::glLinkProgram(GLuint program)
-{
- d_2_0_Core->f.LinkProgram(program);
-}
-
-inline GLboolean QOpenGLFunctions_4_5_Compatibility::glIsShader(GLuint shader)
-{
- return d_2_0_Core->f.IsShader(shader);
-}
-
-inline GLboolean QOpenGLFunctions_4_5_Compatibility::glIsProgram(GLuint program)
-{
- return d_2_0_Core->f.IsProgram(program);
-}
-
-inline void QOpenGLFunctions_4_5_Compatibility::glGetVertexAttribPointerv(GLuint index, GLenum pname, void * *pointer)
-{
- d_2_0_Core->f.GetVertexAttribPointerv(index, pname, pointer);
-}
-
-inline void QOpenGLFunctions_4_5_Compatibility::glGetVertexAttribiv(GLuint index, GLenum pname, GLint *params)
-{
- d_2_0_Core->f.GetVertexAttribiv(index, pname, params);
-}
-
-inline void QOpenGLFunctions_4_5_Compatibility::glGetVertexAttribfv(GLuint index, GLenum pname, GLfloat *params)
-{
- d_2_0_Core->f.GetVertexAttribfv(index, pname, params);
-}
-
-inline void QOpenGLFunctions_4_5_Compatibility::glGetVertexAttribdv(GLuint index, GLenum pname, GLdouble *params)
-{
- d_2_0_Core->f.GetVertexAttribdv(index, pname, params);
-}
-
-inline void QOpenGLFunctions_4_5_Compatibility::glGetUniformiv(GLuint program, GLint location, GLint *params)
-{
- d_2_0_Core->f.GetUniformiv(program, location, params);
-}
-
-inline void QOpenGLFunctions_4_5_Compatibility::glGetUniformfv(GLuint program, GLint location, GLfloat *params)
-{
- d_2_0_Core->f.GetUniformfv(program, location, params);
-}
-
-inline GLint QOpenGLFunctions_4_5_Compatibility::glGetUniformLocation(GLuint program, const GLchar *name)
-{
- return d_2_0_Core->f.GetUniformLocation(program, name);
-}
-
-inline void QOpenGLFunctions_4_5_Compatibility::glGetShaderSource(GLuint shader, GLsizei bufSize, GLsizei *length, GLchar *source)
-{
- d_2_0_Core->f.GetShaderSource(shader, bufSize, length, source);
-}
-
-inline void QOpenGLFunctions_4_5_Compatibility::glGetShaderInfoLog(GLuint shader, GLsizei bufSize, GLsizei *length, GLchar *infoLog)
-{
- d_2_0_Core->f.GetShaderInfoLog(shader, bufSize, length, infoLog);
-}
-
-inline void QOpenGLFunctions_4_5_Compatibility::glGetShaderiv(GLuint shader, GLenum pname, GLint *params)
-{
- d_2_0_Core->f.GetShaderiv(shader, pname, params);
-}
-
-inline void QOpenGLFunctions_4_5_Compatibility::glGetProgramInfoLog(GLuint program, GLsizei bufSize, GLsizei *length, GLchar *infoLog)
-{
- d_2_0_Core->f.GetProgramInfoLog(program, bufSize, length, infoLog);
-}
-
-inline void QOpenGLFunctions_4_5_Compatibility::glGetProgramiv(GLuint program, GLenum pname, GLint *params)
-{
- d_2_0_Core->f.GetProgramiv(program, pname, params);
-}
-
-inline GLint QOpenGLFunctions_4_5_Compatibility::glGetAttribLocation(GLuint program, const GLchar *name)
-{
- return d_2_0_Core->f.GetAttribLocation(program, name);
-}
-
-inline void QOpenGLFunctions_4_5_Compatibility::glGetAttachedShaders(GLuint program, GLsizei maxCount, GLsizei *count, GLuint *shaders)
-{
- d_2_0_Core->f.GetAttachedShaders(program, maxCount, count, shaders);
-}
-
-inline void QOpenGLFunctions_4_5_Compatibility::glGetActiveUniform(GLuint program, GLuint index, GLsizei bufSize, GLsizei *length, GLint *size, GLenum *type, GLchar *name)
-{
- d_2_0_Core->f.GetActiveUniform(program, index, bufSize, length, size, type, name);
-}
-
-inline void QOpenGLFunctions_4_5_Compatibility::glGetActiveAttrib(GLuint program, GLuint index, GLsizei bufSize, GLsizei *length, GLint *size, GLenum *type, GLchar *name)
-{
- d_2_0_Core->f.GetActiveAttrib(program, index, bufSize, length, size, type, name);
-}
-
-inline void QOpenGLFunctions_4_5_Compatibility::glEnableVertexAttribArray(GLuint index)
-{
- d_2_0_Core->f.EnableVertexAttribArray(index);
-}
-
-inline void QOpenGLFunctions_4_5_Compatibility::glDisableVertexAttribArray(GLuint index)
-{
- d_2_0_Core->f.DisableVertexAttribArray(index);
-}
-
-inline void QOpenGLFunctions_4_5_Compatibility::glDetachShader(GLuint program, GLuint shader)
-{
- d_2_0_Core->f.DetachShader(program, shader);
-}
-
-inline void QOpenGLFunctions_4_5_Compatibility::glDeleteShader(GLuint shader)
-{
- d_2_0_Core->f.DeleteShader(shader);
-}
-
-inline void QOpenGLFunctions_4_5_Compatibility::glDeleteProgram(GLuint program)
-{
- d_2_0_Core->f.DeleteProgram(program);
-}
-
-inline GLuint QOpenGLFunctions_4_5_Compatibility::glCreateShader(GLenum type)
-{
- return d_2_0_Core->f.CreateShader(type);
-}
-
-inline GLuint QOpenGLFunctions_4_5_Compatibility::glCreateProgram()
-{
- return d_2_0_Core->f.CreateProgram();
-}
-
-inline void QOpenGLFunctions_4_5_Compatibility::glCompileShader(GLuint shader)
-{
- d_2_0_Core->f.CompileShader(shader);
-}
-
-inline void QOpenGLFunctions_4_5_Compatibility::glBindAttribLocation(GLuint program, GLuint index, const GLchar *name)
-{
- d_2_0_Core->f.BindAttribLocation(program, index, name);
-}
-
-inline void QOpenGLFunctions_4_5_Compatibility::glAttachShader(GLuint program, GLuint shader)
-{
- d_2_0_Core->f.AttachShader(program, shader);
-}
-
-inline void QOpenGLFunctions_4_5_Compatibility::glStencilMaskSeparate(GLenum face, GLuint mask)
-{
- d_2_0_Core->f.StencilMaskSeparate(face, mask);
-}
-
-inline void QOpenGLFunctions_4_5_Compatibility::glStencilFuncSeparate(GLenum face, GLenum func, GLint ref, GLuint mask)
-{
- d_2_0_Core->f.StencilFuncSeparate(face, func, ref, mask);
-}
-
-inline void QOpenGLFunctions_4_5_Compatibility::glStencilOpSeparate(GLenum face, GLenum sfail, GLenum dpfail, GLenum dppass)
-{
- d_2_0_Core->f.StencilOpSeparate(face, sfail, dpfail, dppass);
-}
-
-inline void QOpenGLFunctions_4_5_Compatibility::glDrawBuffers(GLsizei n, const GLenum *bufs)
-{
- d_2_0_Core->f.DrawBuffers(n, bufs);
-}
-
-inline void QOpenGLFunctions_4_5_Compatibility::glBlendEquationSeparate(GLenum modeRGB, GLenum modeAlpha)
-{
- d_2_0_Core->f.BlendEquationSeparate(modeRGB, modeAlpha);
-}
-
-
-// OpenGL 2.1 core functions
-inline void QOpenGLFunctions_4_5_Compatibility::glUniformMatrix4x3fv(GLint location, GLsizei count, GLboolean transpose, const GLfloat *value)
-{
- d_2_1_Core->f.UniformMatrix4x3fv(location, count, transpose, value);
-}
-
-inline void QOpenGLFunctions_4_5_Compatibility::glUniformMatrix3x4fv(GLint location, GLsizei count, GLboolean transpose, const GLfloat *value)
-{
- d_2_1_Core->f.UniformMatrix3x4fv(location, count, transpose, value);
-}
-
-inline void QOpenGLFunctions_4_5_Compatibility::glUniformMatrix4x2fv(GLint location, GLsizei count, GLboolean transpose, const GLfloat *value)
-{
- d_2_1_Core->f.UniformMatrix4x2fv(location, count, transpose, value);
-}
-
-inline void QOpenGLFunctions_4_5_Compatibility::glUniformMatrix2x4fv(GLint location, GLsizei count, GLboolean transpose, const GLfloat *value)
-{
- d_2_1_Core->f.UniformMatrix2x4fv(location, count, transpose, value);
-}
-
-inline void QOpenGLFunctions_4_5_Compatibility::glUniformMatrix3x2fv(GLint location, GLsizei count, GLboolean transpose, const GLfloat *value)
-{
- d_2_1_Core->f.UniformMatrix3x2fv(location, count, transpose, value);
-}
-
-inline void QOpenGLFunctions_4_5_Compatibility::glUniformMatrix2x3fv(GLint location, GLsizei count, GLboolean transpose, const GLfloat *value)
-{
- d_2_1_Core->f.UniformMatrix2x3fv(location, count, transpose, value);
-}
-
-
-// OpenGL 3.0 core functions
-inline GLboolean QOpenGLFunctions_4_5_Compatibility::glIsVertexArray(GLuint array)
-{
- return d_3_0_Core->f.IsVertexArray(array);
-}
-
-inline void QOpenGLFunctions_4_5_Compatibility::glGenVertexArrays(GLsizei n, GLuint *arrays)
-{
- d_3_0_Core->f.GenVertexArrays(n, arrays);
-}
-
-inline void QOpenGLFunctions_4_5_Compatibility::glDeleteVertexArrays(GLsizei n, const GLuint *arrays)
-{
- d_3_0_Core->f.DeleteVertexArrays(n, arrays);
-}
-
-inline void QOpenGLFunctions_4_5_Compatibility::glBindVertexArray(GLuint array)
-{
- d_3_0_Core->f.BindVertexArray(array);
-}
-
-inline void QOpenGLFunctions_4_5_Compatibility::glFlushMappedBufferRange(GLenum target, GLintptr offset, GLsizeiptr length)
-{
- d_3_0_Core->f.FlushMappedBufferRange(target, offset, length);
-}
-
-inline void * QOpenGLFunctions_4_5_Compatibility::glMapBufferRange(GLenum target, GLintptr offset, GLsizeiptr length, GLbitfield access)
-{
- return d_3_0_Core->f.MapBufferRange(target, offset, length, access);
-}
-
-inline void QOpenGLFunctions_4_5_Compatibility::glFramebufferTextureLayer(GLenum target, GLenum attachment, GLuint texture, GLint level, GLint layer)
-{
- d_3_0_Core->f.FramebufferTextureLayer(target, attachment, texture, level, layer);
-}
-
-inline void QOpenGLFunctions_4_5_Compatibility::glRenderbufferStorageMultisample(GLenum target, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height)
-{
- d_3_0_Core->f.RenderbufferStorageMultisample(target, samples, internalformat, width, height);
-}
-
-inline void QOpenGLFunctions_4_5_Compatibility::glBlitFramebuffer(GLint srcX0, GLint srcY0, GLint srcX1, GLint srcY1, GLint dstX0, GLint dstY0, GLint dstX1, GLint dstY1, GLbitfield mask, GLenum filter)
-{
- d_3_0_Core->f.BlitFramebuffer(srcX0, srcY0, srcX1, srcY1, dstX0, dstY0, dstX1, dstY1, mask, filter);
-}
-
-inline void QOpenGLFunctions_4_5_Compatibility::glGenerateMipmap(GLenum target)
-{
- d_3_0_Core->f.GenerateMipmap(target);
-}
-
-inline void QOpenGLFunctions_4_5_Compatibility::glGetFramebufferAttachmentParameteriv(GLenum target, GLenum attachment, GLenum pname, GLint *params)
-{
- d_3_0_Core->f.GetFramebufferAttachmentParameteriv(target, attachment, pname, params);
-}
-
-inline void QOpenGLFunctions_4_5_Compatibility::glFramebufferRenderbuffer(GLenum target, GLenum attachment, GLenum renderbuffertarget, GLuint renderbuffer)
-{
- d_3_0_Core->f.FramebufferRenderbuffer(target, attachment, renderbuffertarget, renderbuffer);
-}
-
-inline void QOpenGLFunctions_4_5_Compatibility::glFramebufferTexture3D(GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level, GLint zoffset)
-{
- d_3_0_Core->f.FramebufferTexture3D(target, attachment, textarget, texture, level, zoffset);
-}
-
-inline void QOpenGLFunctions_4_5_Compatibility::glFramebufferTexture2D(GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level)
-{
- d_3_0_Core->f.FramebufferTexture2D(target, attachment, textarget, texture, level);
-}
-
-inline void QOpenGLFunctions_4_5_Compatibility::glFramebufferTexture1D(GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level)
-{
- d_3_0_Core->f.FramebufferTexture1D(target, attachment, textarget, texture, level);
-}
-
-inline GLenum QOpenGLFunctions_4_5_Compatibility::glCheckFramebufferStatus(GLenum target)
-{
- return d_3_0_Core->f.CheckFramebufferStatus(target);
-}
-
-inline void QOpenGLFunctions_4_5_Compatibility::glGenFramebuffers(GLsizei n, GLuint *framebuffers)
-{
- d_3_0_Core->f.GenFramebuffers(n, framebuffers);
-}
-
-inline void QOpenGLFunctions_4_5_Compatibility::glDeleteFramebuffers(GLsizei n, const GLuint *framebuffers)
-{
- d_3_0_Core->f.DeleteFramebuffers(n, framebuffers);
-}
-
-inline void QOpenGLFunctions_4_5_Compatibility::glBindFramebuffer(GLenum target, GLuint framebuffer)
-{
- d_3_0_Core->f.BindFramebuffer(target, framebuffer);
-}
-
-inline GLboolean QOpenGLFunctions_4_5_Compatibility::glIsFramebuffer(GLuint framebuffer)
-{
- return d_3_0_Core->f.IsFramebuffer(framebuffer);
-}
-
-inline void QOpenGLFunctions_4_5_Compatibility::glGetRenderbufferParameteriv(GLenum target, GLenum pname, GLint *params)
-{
- d_3_0_Core->f.GetRenderbufferParameteriv(target, pname, params);
-}
-
-inline void QOpenGLFunctions_4_5_Compatibility::glRenderbufferStorage(GLenum target, GLenum internalformat, GLsizei width, GLsizei height)
-{
- d_3_0_Core->f.RenderbufferStorage(target, internalformat, width, height);
-}
-
-inline void QOpenGLFunctions_4_5_Compatibility::glGenRenderbuffers(GLsizei n, GLuint *renderbuffers)
-{
- d_3_0_Core->f.GenRenderbuffers(n, renderbuffers);
-}
-
-inline void QOpenGLFunctions_4_5_Compatibility::glDeleteRenderbuffers(GLsizei n, const GLuint *renderbuffers)
-{
- d_3_0_Core->f.DeleteRenderbuffers(n, renderbuffers);
-}
-
-inline void QOpenGLFunctions_4_5_Compatibility::glBindRenderbuffer(GLenum target, GLuint renderbuffer)
-{
- d_3_0_Core->f.BindRenderbuffer(target, renderbuffer);
-}
-
-inline GLboolean QOpenGLFunctions_4_5_Compatibility::glIsRenderbuffer(GLuint renderbuffer)
-{
- return d_3_0_Core->f.IsRenderbuffer(renderbuffer);
-}
-
-inline const GLubyte * QOpenGLFunctions_4_5_Compatibility::glGetStringi(GLenum name, GLuint index)
-{
- return d_3_0_Core->f.GetStringi(name, index);
-}
-
-inline void QOpenGLFunctions_4_5_Compatibility::glClearBufferfi(GLenum buffer, GLint drawbuffer, GLfloat depth, GLint stencil)
-{
- d_3_0_Core->f.ClearBufferfi(buffer, drawbuffer, depth, stencil);
-}
-
-inline void QOpenGLFunctions_4_5_Compatibility::glClearBufferfv(GLenum buffer, GLint drawbuffer, const GLfloat *value)
-{
- d_3_0_Core->f.ClearBufferfv(buffer, drawbuffer, value);
-}
-
-inline void QOpenGLFunctions_4_5_Compatibility::glClearBufferuiv(GLenum buffer, GLint drawbuffer, const GLuint *value)
-{
- d_3_0_Core->f.ClearBufferuiv(buffer, drawbuffer, value);
-}
-
-inline void QOpenGLFunctions_4_5_Compatibility::glClearBufferiv(GLenum buffer, GLint drawbuffer, const GLint *value)
-{
- d_3_0_Core->f.ClearBufferiv(buffer, drawbuffer, value);
-}
-
-inline void QOpenGLFunctions_4_5_Compatibility::glGetTexParameterIuiv(GLenum target, GLenum pname, GLuint *params)
-{
- d_3_0_Core->f.GetTexParameterIuiv(target, pname, params);
-}
-
-inline void QOpenGLFunctions_4_5_Compatibility::glGetTexParameterIiv(GLenum target, GLenum pname, GLint *params)
-{
- d_3_0_Core->f.GetTexParameterIiv(target, pname, params);
-}
-
-inline void QOpenGLFunctions_4_5_Compatibility::glTexParameterIuiv(GLenum target, GLenum pname, const GLuint *params)
-{
- d_3_0_Core->f.TexParameterIuiv(target, pname, params);
-}
-
-inline void QOpenGLFunctions_4_5_Compatibility::glTexParameterIiv(GLenum target, GLenum pname, const GLint *params)
-{
- d_3_0_Core->f.TexParameterIiv(target, pname, params);
-}
-
-inline void QOpenGLFunctions_4_5_Compatibility::glUniform4uiv(GLint location, GLsizei count, const GLuint *value)
-{
- d_3_0_Core->f.Uniform4uiv(location, count, value);
-}
-
-inline void QOpenGLFunctions_4_5_Compatibility::glUniform3uiv(GLint location, GLsizei count, const GLuint *value)
-{
- d_3_0_Core->f.Uniform3uiv(location, count, value);
-}
-
-inline void QOpenGLFunctions_4_5_Compatibility::glUniform2uiv(GLint location, GLsizei count, const GLuint *value)
-{
- d_3_0_Core->f.Uniform2uiv(location, count, value);
-}
-
-inline void QOpenGLFunctions_4_5_Compatibility::glUniform1uiv(GLint location, GLsizei count, const GLuint *value)
-{
- d_3_0_Core->f.Uniform1uiv(location, count, value);
-}
-
-inline void QOpenGLFunctions_4_5_Compatibility::glUniform4ui(GLint location, GLuint v0, GLuint v1, GLuint v2, GLuint v3)
-{
- d_3_0_Core->f.Uniform4ui(location, v0, v1, v2, v3);
-}
-
-inline void QOpenGLFunctions_4_5_Compatibility::glUniform3ui(GLint location, GLuint v0, GLuint v1, GLuint v2)
-{
- d_3_0_Core->f.Uniform3ui(location, v0, v1, v2);
-}
-
-inline void QOpenGLFunctions_4_5_Compatibility::glUniform2ui(GLint location, GLuint v0, GLuint v1)
-{
- d_3_0_Core->f.Uniform2ui(location, v0, v1);
-}
-
-inline void QOpenGLFunctions_4_5_Compatibility::glUniform1ui(GLint location, GLuint v0)
-{
- d_3_0_Core->f.Uniform1ui(location, v0);
-}
-
-inline GLint QOpenGLFunctions_4_5_Compatibility::glGetFragDataLocation(GLuint program, const GLchar *name)
-{
- return d_3_0_Core->f.GetFragDataLocation(program, name);
-}
-
-inline void QOpenGLFunctions_4_5_Compatibility::glBindFragDataLocation(GLuint program, GLuint color, const GLchar *name)
-{
- d_3_0_Core->f.BindFragDataLocation(program, color, name);
-}
-
-inline void QOpenGLFunctions_4_5_Compatibility::glGetUniformuiv(GLuint program, GLint location, GLuint *params)
-{
- d_3_0_Core->f.GetUniformuiv(program, location, params);
-}
-
-inline void QOpenGLFunctions_4_5_Compatibility::glVertexAttribI4usv(GLuint index, const GLushort *v)
-{
- d_3_0_Core->f.VertexAttribI4usv(index, v);
-}
-
-inline void QOpenGLFunctions_4_5_Compatibility::glVertexAttribI4ubv(GLuint index, const GLubyte *v)
-{
- d_3_0_Core->f.VertexAttribI4ubv(index, v);
-}
-
-inline void QOpenGLFunctions_4_5_Compatibility::glVertexAttribI4sv(GLuint index, const GLshort *v)
-{
- d_3_0_Core->f.VertexAttribI4sv(index, v);
-}
-
-inline void QOpenGLFunctions_4_5_Compatibility::glVertexAttribI4bv(GLuint index, const GLbyte *v)
-{
- d_3_0_Core->f.VertexAttribI4bv(index, v);
-}
-
-inline void QOpenGLFunctions_4_5_Compatibility::glVertexAttribI4uiv(GLuint index, const GLuint *v)
-{
- d_3_0_Core->f.VertexAttribI4uiv(index, v);
-}
-
-inline void QOpenGLFunctions_4_5_Compatibility::glVertexAttribI3uiv(GLuint index, const GLuint *v)
-{
- d_3_0_Core->f.VertexAttribI3uiv(index, v);
-}
-
-inline void QOpenGLFunctions_4_5_Compatibility::glVertexAttribI2uiv(GLuint index, const GLuint *v)
-{
- d_3_0_Core->f.VertexAttribI2uiv(index, v);
-}
-
-inline void QOpenGLFunctions_4_5_Compatibility::glVertexAttribI1uiv(GLuint index, const GLuint *v)
-{
- d_3_0_Core->f.VertexAttribI1uiv(index, v);
-}
-
-inline void QOpenGLFunctions_4_5_Compatibility::glVertexAttribI4iv(GLuint index, const GLint *v)
-{
- d_3_0_Core->f.VertexAttribI4iv(index, v);
-}
-
-inline void QOpenGLFunctions_4_5_Compatibility::glVertexAttribI3iv(GLuint index, const GLint *v)
-{
- d_3_0_Core->f.VertexAttribI3iv(index, v);
-}
-
-inline void QOpenGLFunctions_4_5_Compatibility::glVertexAttribI2iv(GLuint index, const GLint *v)
-{
- d_3_0_Core->f.VertexAttribI2iv(index, v);
-}
-
-inline void QOpenGLFunctions_4_5_Compatibility::glVertexAttribI1iv(GLuint index, const GLint *v)
-{
- d_3_0_Core->f.VertexAttribI1iv(index, v);
-}
-
-inline void QOpenGLFunctions_4_5_Compatibility::glVertexAttribI4ui(GLuint index, GLuint x, GLuint y, GLuint z, GLuint w)
-{
- d_3_0_Core->f.VertexAttribI4ui(index, x, y, z, w);
-}
-
-inline void QOpenGLFunctions_4_5_Compatibility::glVertexAttribI3ui(GLuint index, GLuint x, GLuint y, GLuint z)
-{
- d_3_0_Core->f.VertexAttribI3ui(index, x, y, z);
-}
-
-inline void QOpenGLFunctions_4_5_Compatibility::glVertexAttribI2ui(GLuint index, GLuint x, GLuint y)
-{
- d_3_0_Core->f.VertexAttribI2ui(index, x, y);
-}
-
-inline void QOpenGLFunctions_4_5_Compatibility::glVertexAttribI1ui(GLuint index, GLuint x)
-{
- d_3_0_Core->f.VertexAttribI1ui(index, x);
-}
-
-inline void QOpenGLFunctions_4_5_Compatibility::glVertexAttribI4i(GLuint index, GLint x, GLint y, GLint z, GLint w)
-{
- d_3_0_Core->f.VertexAttribI4i(index, x, y, z, w);
-}
-
-inline void QOpenGLFunctions_4_5_Compatibility::glVertexAttribI3i(GLuint index, GLint x, GLint y, GLint z)
-{
- d_3_0_Core->f.VertexAttribI3i(index, x, y, z);
-}
-
-inline void QOpenGLFunctions_4_5_Compatibility::glVertexAttribI2i(GLuint index, GLint x, GLint y)
-{
- d_3_0_Core->f.VertexAttribI2i(index, x, y);
-}
-
-inline void QOpenGLFunctions_4_5_Compatibility::glVertexAttribI1i(GLuint index, GLint x)
-{
- d_3_0_Core->f.VertexAttribI1i(index, x);
-}
-
-inline void QOpenGLFunctions_4_5_Compatibility::glGetVertexAttribIuiv(GLuint index, GLenum pname, GLuint *params)
-{
- d_3_0_Core->f.GetVertexAttribIuiv(index, pname, params);
-}
-
-inline void QOpenGLFunctions_4_5_Compatibility::glGetVertexAttribIiv(GLuint index, GLenum pname, GLint *params)
-{
- d_3_0_Core->f.GetVertexAttribIiv(index, pname, params);
-}
-
-inline void QOpenGLFunctions_4_5_Compatibility::glVertexAttribIPointer(GLuint index, GLint size, GLenum type, GLsizei stride, const void *pointer)
-{
- d_3_0_Core->f.VertexAttribIPointer(index, size, type, stride, pointer);
-}
-
-inline void QOpenGLFunctions_4_5_Compatibility::glEndConditionalRender()
-{
- d_3_0_Core->f.EndConditionalRender();
-}
-
-inline void QOpenGLFunctions_4_5_Compatibility::glBeginConditionalRender(GLuint id, GLenum mode)
-{
- d_3_0_Core->f.BeginConditionalRender(id, mode);
-}
-
-inline void QOpenGLFunctions_4_5_Compatibility::glClampColor(GLenum target, GLenum clamp)
-{
- d_3_0_Core->f.ClampColor(target, clamp);
-}
-
-inline void QOpenGLFunctions_4_5_Compatibility::glGetTransformFeedbackVarying(GLuint program, GLuint index, GLsizei bufSize, GLsizei *length, GLsizei *size, GLenum *type, GLchar *name)
-{
- d_3_0_Core->f.GetTransformFeedbackVarying(program, index, bufSize, length, size, type, name);
-}
-
-inline void QOpenGLFunctions_4_5_Compatibility::glTransformFeedbackVaryings(GLuint program, GLsizei count, const GLchar *const *varyings, GLenum bufferMode)
-{
- d_3_0_Core->f.TransformFeedbackVaryings(program, count, varyings, bufferMode);
-}
-
-inline void QOpenGLFunctions_4_5_Compatibility::glBindBufferBase(GLenum target, GLuint index, GLuint buffer)
-{
- d_3_0_Core->f.BindBufferBase(target, index, buffer);
-}
-
-inline void QOpenGLFunctions_4_5_Compatibility::glBindBufferRange(GLenum target, GLuint index, GLuint buffer, GLintptr offset, GLsizeiptr size)
-{
- d_3_0_Core->f.BindBufferRange(target, index, buffer, offset, size);
-}
-
-inline void QOpenGLFunctions_4_5_Compatibility::glEndTransformFeedback()
-{
- d_3_0_Core->f.EndTransformFeedback();
-}
-
-inline void QOpenGLFunctions_4_5_Compatibility::glBeginTransformFeedback(GLenum primitiveMode)
-{
- d_3_0_Core->f.BeginTransformFeedback(primitiveMode);
-}
-
-inline GLboolean QOpenGLFunctions_4_5_Compatibility::glIsEnabledi(GLenum target, GLuint index)
-{
- return d_3_0_Core->f.IsEnabledi(target, index);
-}
-
-inline void QOpenGLFunctions_4_5_Compatibility::glDisablei(GLenum target, GLuint index)
-{
- d_3_0_Core->f.Disablei(target, index);
-}
-
-inline void QOpenGLFunctions_4_5_Compatibility::glEnablei(GLenum target, GLuint index)
-{
- d_3_0_Core->f.Enablei(target, index);
-}
-
-inline void QOpenGLFunctions_4_5_Compatibility::glGetIntegeri_v(GLenum target, GLuint index, GLint *data)
-{
- d_3_0_Core->f.GetIntegeri_v(target, index, data);
-}
-
-inline void QOpenGLFunctions_4_5_Compatibility::glGetBooleani_v(GLenum target, GLuint index, GLboolean *data)
-{
- d_3_0_Core->f.GetBooleani_v(target, index, data);
-}
-
-inline void QOpenGLFunctions_4_5_Compatibility::glColorMaski(GLuint index, GLboolean r, GLboolean g, GLboolean b, GLboolean a)
-{
- d_3_0_Core->f.ColorMaski(index, r, g, b, a);
-}
-
-
-// OpenGL 3.1 core functions
-inline void QOpenGLFunctions_4_5_Compatibility::glUniformBlockBinding(GLuint program, GLuint uniformBlockIndex, GLuint uniformBlockBinding)
-{
- d_3_1_Core->f.UniformBlockBinding(program, uniformBlockIndex, uniformBlockBinding);
-}
-
-inline void QOpenGLFunctions_4_5_Compatibility::glGetActiveUniformBlockName(GLuint program, GLuint uniformBlockIndex, GLsizei bufSize, GLsizei *length, GLchar *uniformBlockName)
-{
- d_3_1_Core->f.GetActiveUniformBlockName(program, uniformBlockIndex, bufSize, length, uniformBlockName);
-}
-
-inline void QOpenGLFunctions_4_5_Compatibility::glGetActiveUniformBlockiv(GLuint program, GLuint uniformBlockIndex, GLenum pname, GLint *params)
-{
- d_3_1_Core->f.GetActiveUniformBlockiv(program, uniformBlockIndex, pname, params);
-}
-
-inline GLuint QOpenGLFunctions_4_5_Compatibility::glGetUniformBlockIndex(GLuint program, const GLchar *uniformBlockName)
-{
- return d_3_1_Core->f.GetUniformBlockIndex(program, uniformBlockName);
-}
-
-inline void QOpenGLFunctions_4_5_Compatibility::glGetActiveUniformName(GLuint program, GLuint uniformIndex, GLsizei bufSize, GLsizei *length, GLchar *uniformName)
-{
- d_3_1_Core->f.GetActiveUniformName(program, uniformIndex, bufSize, length, uniformName);
-}
-
-inline void QOpenGLFunctions_4_5_Compatibility::glGetActiveUniformsiv(GLuint program, GLsizei uniformCount, const GLuint *uniformIndices, GLenum pname, GLint *params)
-{
- d_3_1_Core->f.GetActiveUniformsiv(program, uniformCount, uniformIndices, pname, params);
-}
-
-inline void QOpenGLFunctions_4_5_Compatibility::glGetUniformIndices(GLuint program, GLsizei uniformCount, const GLchar *const *uniformNames, GLuint *uniformIndices)
-{
- d_3_1_Core->f.GetUniformIndices(program, uniformCount, uniformNames, uniformIndices);
-}
-
-inline void QOpenGLFunctions_4_5_Compatibility::glCopyBufferSubData(GLenum readTarget, GLenum writeTarget, GLintptr readOffset, GLintptr writeOffset, GLsizeiptr size)
-{
- d_3_1_Core->f.CopyBufferSubData(readTarget, writeTarget, readOffset, writeOffset, size);
-}
-
-inline void QOpenGLFunctions_4_5_Compatibility::glPrimitiveRestartIndex(GLuint index)
-{
- d_3_1_Core->f.PrimitiveRestartIndex(index);
-}
-
-inline void QOpenGLFunctions_4_5_Compatibility::glTexBuffer(GLenum target, GLenum internalformat, GLuint buffer)
-{
- d_3_1_Core->f.TexBuffer(target, internalformat, buffer);
-}
-
-inline void QOpenGLFunctions_4_5_Compatibility::glDrawElementsInstanced(GLenum mode, GLsizei count, GLenum type, const void *indices, GLsizei instancecount)
-{
- d_3_1_Core->f.DrawElementsInstanced(mode, count, type, indices, instancecount);
-}
-
-inline void QOpenGLFunctions_4_5_Compatibility::glDrawArraysInstanced(GLenum mode, GLint first, GLsizei count, GLsizei instancecount)
-{
- d_3_1_Core->f.DrawArraysInstanced(mode, first, count, instancecount);
-}
-
-
-// OpenGL 3.2 core functions
-inline void QOpenGLFunctions_4_5_Compatibility::glSampleMaski(GLuint maskNumber, GLbitfield mask)
-{
- d_3_2_Core->f.SampleMaski(maskNumber, mask);
-}
-
-inline void QOpenGLFunctions_4_5_Compatibility::glGetMultisamplefv(GLenum pname, GLuint index, GLfloat *val)
-{
- d_3_2_Core->f.GetMultisamplefv(pname, index, val);
-}
-
-inline void QOpenGLFunctions_4_5_Compatibility::glTexImage3DMultisample(GLenum target, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth, GLboolean fixedsamplelocations)
-{
- d_3_2_Core->f.TexImage3DMultisample(target, samples, internalformat, width, height, depth, fixedsamplelocations);
-}
-
-inline void QOpenGLFunctions_4_5_Compatibility::glTexImage2DMultisample(GLenum target, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height, GLboolean fixedsamplelocations)
-{
- d_3_2_Core->f.TexImage2DMultisample(target, samples, internalformat, width, height, fixedsamplelocations);
-}
-
-inline void QOpenGLFunctions_4_5_Compatibility::glFramebufferTexture(GLenum target, GLenum attachment, GLuint texture, GLint level)
-{
- d_3_2_Core->f.FramebufferTexture(target, attachment, texture, level);
-}
-
-inline void QOpenGLFunctions_4_5_Compatibility::glGetBufferParameteri64v(GLenum target, GLenum pname, GLint64 *params)
-{
- d_3_2_Core->f.GetBufferParameteri64v(target, pname, params);
-}
-
-inline void QOpenGLFunctions_4_5_Compatibility::glGetInteger64i_v(GLenum target, GLuint index, GLint64 *data)
-{
- d_3_2_Core->f.GetInteger64i_v(target, index, data);
-}
-
-inline void QOpenGLFunctions_4_5_Compatibility::glGetSynciv(GLsync sync, GLenum pname, GLsizei bufSize, GLsizei *length, GLint *values)
-{
- d_3_2_Core->f.GetSynciv(sync, pname, bufSize, length, values);
-}
-
-inline void QOpenGLFunctions_4_5_Compatibility::glGetInteger64v(GLenum pname, GLint64 *data)
-{
- d_3_2_Core->f.GetInteger64v(pname, data);
-}
-
-inline void QOpenGLFunctions_4_5_Compatibility::glWaitSync(GLsync sync, GLbitfield flags, GLuint64 timeout)
-{
- d_3_2_Core->f.WaitSync(sync, flags, timeout);
-}
-
-inline GLenum QOpenGLFunctions_4_5_Compatibility::glClientWaitSync(GLsync sync, GLbitfield flags, GLuint64 timeout)
-{
- return d_3_2_Core->f.ClientWaitSync(sync, flags, timeout);
-}
-
-inline void QOpenGLFunctions_4_5_Compatibility::glDeleteSync(GLsync sync)
-{
- d_3_2_Core->f.DeleteSync(sync);
-}
-
-inline GLboolean QOpenGLFunctions_4_5_Compatibility::glIsSync(GLsync sync)
-{
- return d_3_2_Core->f.IsSync(sync);
-}
-
-inline GLsync QOpenGLFunctions_4_5_Compatibility::glFenceSync(GLenum condition, GLbitfield flags)
-{
- return d_3_2_Core->f.FenceSync(condition, flags);
-}
-
-inline void QOpenGLFunctions_4_5_Compatibility::glProvokingVertex(GLenum mode)
-{
- d_3_2_Core->f.ProvokingVertex(mode);
-}
-
-inline void QOpenGLFunctions_4_5_Compatibility::glMultiDrawElementsBaseVertex(GLenum mode, const GLsizei *count, GLenum type, const void *const *indices, GLsizei drawcount, const GLint *basevertex)
-{
- d_3_2_Core->f.MultiDrawElementsBaseVertex(mode, count, type, indices, drawcount, basevertex);
-}
-
-inline void QOpenGLFunctions_4_5_Compatibility::glDrawElementsInstancedBaseVertex(GLenum mode, GLsizei count, GLenum type, const void *indices, GLsizei instancecount, GLint basevertex)
-{
- d_3_2_Core->f.DrawElementsInstancedBaseVertex(mode, count, type, indices, instancecount, basevertex);
-}
-
-inline void QOpenGLFunctions_4_5_Compatibility::glDrawRangeElementsBaseVertex(GLenum mode, GLuint start, GLuint end, GLsizei count, GLenum type, const void *indices, GLint basevertex)
-{
- d_3_2_Core->f.DrawRangeElementsBaseVertex(mode, start, end, count, type, indices, basevertex);
-}
-
-inline void QOpenGLFunctions_4_5_Compatibility::glDrawElementsBaseVertex(GLenum mode, GLsizei count, GLenum type, const void *indices, GLint basevertex)
-{
- d_3_2_Core->f.DrawElementsBaseVertex(mode, count, type, indices, basevertex);
-}
-
-
-// OpenGL 3.3 core functions
-inline void QOpenGLFunctions_4_5_Compatibility::glVertexAttribP4uiv(GLuint index, GLenum type, GLboolean normalized, const GLuint *value)
-{
- d_3_3_Core->f.VertexAttribP4uiv(index, type, normalized, value);
-}
-
-inline void QOpenGLFunctions_4_5_Compatibility::glVertexAttribP4ui(GLuint index, GLenum type, GLboolean normalized, GLuint value)
-{
- d_3_3_Core->f.VertexAttribP4ui(index, type, normalized, value);
-}
-
-inline void QOpenGLFunctions_4_5_Compatibility::glVertexAttribP3uiv(GLuint index, GLenum type, GLboolean normalized, const GLuint *value)
-{
- d_3_3_Core->f.VertexAttribP3uiv(index, type, normalized, value);
-}
-
-inline void QOpenGLFunctions_4_5_Compatibility::glVertexAttribP3ui(GLuint index, GLenum type, GLboolean normalized, GLuint value)
-{
- d_3_3_Core->f.VertexAttribP3ui(index, type, normalized, value);
-}
-
-inline void QOpenGLFunctions_4_5_Compatibility::glVertexAttribP2uiv(GLuint index, GLenum type, GLboolean normalized, const GLuint *value)
-{
- d_3_3_Core->f.VertexAttribP2uiv(index, type, normalized, value);
-}
-
-inline void QOpenGLFunctions_4_5_Compatibility::glVertexAttribP2ui(GLuint index, GLenum type, GLboolean normalized, GLuint value)
-{
- d_3_3_Core->f.VertexAttribP2ui(index, type, normalized, value);
-}
-
-inline void QOpenGLFunctions_4_5_Compatibility::glVertexAttribP1uiv(GLuint index, GLenum type, GLboolean normalized, const GLuint *value)
-{
- d_3_3_Core->f.VertexAttribP1uiv(index, type, normalized, value);
-}
-
-inline void QOpenGLFunctions_4_5_Compatibility::glVertexAttribP1ui(GLuint index, GLenum type, GLboolean normalized, GLuint value)
-{
- d_3_3_Core->f.VertexAttribP1ui(index, type, normalized, value);
-}
-
-inline void QOpenGLFunctions_4_5_Compatibility::glVertexAttribDivisor(GLuint index, GLuint divisor)
-{
- d_3_3_Core->f.VertexAttribDivisor(index, divisor);
-}
-
-inline void QOpenGLFunctions_4_5_Compatibility::glGetQueryObjectui64v(GLuint id, GLenum pname, GLuint64 *params)
-{
- d_3_3_Core->f.GetQueryObjectui64v(id, pname, params);
-}
-
-inline void QOpenGLFunctions_4_5_Compatibility::glGetQueryObjecti64v(GLuint id, GLenum pname, GLint64 *params)
-{
- d_3_3_Core->f.GetQueryObjecti64v(id, pname, params);
-}
-
-inline void QOpenGLFunctions_4_5_Compatibility::glQueryCounter(GLuint id, GLenum target)
-{
- d_3_3_Core->f.QueryCounter(id, target);
-}
-
-inline void QOpenGLFunctions_4_5_Compatibility::glGetSamplerParameterIuiv(GLuint sampler, GLenum pname, GLuint *params)
-{
- d_3_3_Core->f.GetSamplerParameterIuiv(sampler, pname, params);
-}
-
-inline void QOpenGLFunctions_4_5_Compatibility::glGetSamplerParameterfv(GLuint sampler, GLenum pname, GLfloat *params)
-{
- d_3_3_Core->f.GetSamplerParameterfv(sampler, pname, params);
-}
-
-inline void QOpenGLFunctions_4_5_Compatibility::glGetSamplerParameterIiv(GLuint sampler, GLenum pname, GLint *params)
-{
- d_3_3_Core->f.GetSamplerParameterIiv(sampler, pname, params);
-}
-
-inline void QOpenGLFunctions_4_5_Compatibility::glGetSamplerParameteriv(GLuint sampler, GLenum pname, GLint *params)
-{
- d_3_3_Core->f.GetSamplerParameteriv(sampler, pname, params);
-}
-
-inline void QOpenGLFunctions_4_5_Compatibility::glSamplerParameterIuiv(GLuint sampler, GLenum pname, const GLuint *param)
-{
- d_3_3_Core->f.SamplerParameterIuiv(sampler, pname, param);
-}
-
-inline void QOpenGLFunctions_4_5_Compatibility::glSamplerParameterIiv(GLuint sampler, GLenum pname, const GLint *param)
-{
- d_3_3_Core->f.SamplerParameterIiv(sampler, pname, param);
-}
-
-inline void QOpenGLFunctions_4_5_Compatibility::glSamplerParameterfv(GLuint sampler, GLenum pname, const GLfloat *param)
-{
- d_3_3_Core->f.SamplerParameterfv(sampler, pname, param);
-}
-
-inline void QOpenGLFunctions_4_5_Compatibility::glSamplerParameterf(GLuint sampler, GLenum pname, GLfloat param)
-{
- d_3_3_Core->f.SamplerParameterf(sampler, pname, param);
-}
-
-inline void QOpenGLFunctions_4_5_Compatibility::glSamplerParameteriv(GLuint sampler, GLenum pname, const GLint *param)
-{
- d_3_3_Core->f.SamplerParameteriv(sampler, pname, param);
-}
-
-inline void QOpenGLFunctions_4_5_Compatibility::glSamplerParameteri(GLuint sampler, GLenum pname, GLint param)
-{
- d_3_3_Core->f.SamplerParameteri(sampler, pname, param);
-}
-
-inline void QOpenGLFunctions_4_5_Compatibility::glBindSampler(GLuint unit, GLuint sampler)
-{
- d_3_3_Core->f.BindSampler(unit, sampler);
-}
-
-inline GLboolean QOpenGLFunctions_4_5_Compatibility::glIsSampler(GLuint sampler)
-{
- return d_3_3_Core->f.IsSampler(sampler);
-}
-
-inline void QOpenGLFunctions_4_5_Compatibility::glDeleteSamplers(GLsizei count, const GLuint *samplers)
-{
- d_3_3_Core->f.DeleteSamplers(count, samplers);
-}
-
-inline void QOpenGLFunctions_4_5_Compatibility::glGenSamplers(GLsizei count, GLuint *samplers)
-{
- d_3_3_Core->f.GenSamplers(count, samplers);
-}
-
-inline GLint QOpenGLFunctions_4_5_Compatibility::glGetFragDataIndex(GLuint program, const GLchar *name)
-{
- return d_3_3_Core->f.GetFragDataIndex(program, name);
-}
-
-inline void QOpenGLFunctions_4_5_Compatibility::glBindFragDataLocationIndexed(GLuint program, GLuint colorNumber, GLuint index, const GLchar *name)
-{
- d_3_3_Core->f.BindFragDataLocationIndexed(program, colorNumber, index, name);
-}
-
-
-// OpenGL 4.0 core functions
-inline void QOpenGLFunctions_4_5_Compatibility::glGetQueryIndexediv(GLenum target, GLuint index, GLenum pname, GLint *params)
-{
- d_4_0_Core->f.GetQueryIndexediv(target, index, pname, params);
-}
-
-inline void QOpenGLFunctions_4_5_Compatibility::glEndQueryIndexed(GLenum target, GLuint index)
-{
- d_4_0_Core->f.EndQueryIndexed(target, index);
-}
-
-inline void QOpenGLFunctions_4_5_Compatibility::glBeginQueryIndexed(GLenum target, GLuint index, GLuint id)
-{
- d_4_0_Core->f.BeginQueryIndexed(target, index, id);
-}
-
-inline void QOpenGLFunctions_4_5_Compatibility::glDrawTransformFeedbackStream(GLenum mode, GLuint id, GLuint stream)
-{
- d_4_0_Core->f.DrawTransformFeedbackStream(mode, id, stream);
-}
-
-inline void QOpenGLFunctions_4_5_Compatibility::glDrawTransformFeedback(GLenum mode, GLuint id)
-{
- d_4_0_Core->f.DrawTransformFeedback(mode, id);
-}
-
-inline void QOpenGLFunctions_4_5_Compatibility::glResumeTransformFeedback()
-{
- d_4_0_Core->f.ResumeTransformFeedback();
-}
-
-inline void QOpenGLFunctions_4_5_Compatibility::glPauseTransformFeedback()
-{
- d_4_0_Core->f.PauseTransformFeedback();
-}
-
-inline GLboolean QOpenGLFunctions_4_5_Compatibility::glIsTransformFeedback(GLuint id)
-{
- return d_4_0_Core->f.IsTransformFeedback(id);
-}
-
-inline void QOpenGLFunctions_4_5_Compatibility::glGenTransformFeedbacks(GLsizei n, GLuint *ids)
-{
- d_4_0_Core->f.GenTransformFeedbacks(n, ids);
-}
-
-inline void QOpenGLFunctions_4_5_Compatibility::glDeleteTransformFeedbacks(GLsizei n, const GLuint *ids)
-{
- d_4_0_Core->f.DeleteTransformFeedbacks(n, ids);
-}
-
-inline void QOpenGLFunctions_4_5_Compatibility::glBindTransformFeedback(GLenum target, GLuint id)
-{
- d_4_0_Core->f.BindTransformFeedback(target, id);
-}
-
-inline void QOpenGLFunctions_4_5_Compatibility::glPatchParameterfv(GLenum pname, const GLfloat *values)
-{
- d_4_0_Core->f.PatchParameterfv(pname, values);
-}
-
-inline void QOpenGLFunctions_4_5_Compatibility::glPatchParameteri(GLenum pname, GLint value)
-{
- d_4_0_Core->f.PatchParameteri(pname, value);
-}
-
-inline void QOpenGLFunctions_4_5_Compatibility::glGetProgramStageiv(GLuint program, GLenum shadertype, GLenum pname, GLint *values)
-{
- d_4_0_Core->f.GetProgramStageiv(program, shadertype, pname, values);
-}
-
-inline void QOpenGLFunctions_4_5_Compatibility::glGetUniformSubroutineuiv(GLenum shadertype, GLint location, GLuint *params)
-{
- d_4_0_Core->f.GetUniformSubroutineuiv(shadertype, location, params);
-}
-
-inline void QOpenGLFunctions_4_5_Compatibility::glUniformSubroutinesuiv(GLenum shadertype, GLsizei count, const GLuint *indices)
-{
- d_4_0_Core->f.UniformSubroutinesuiv(shadertype, count, indices);
-}
-
-inline void QOpenGLFunctions_4_5_Compatibility::glGetActiveSubroutineName(GLuint program, GLenum shadertype, GLuint index, GLsizei bufsize, GLsizei *length, GLchar *name)
-{
- d_4_0_Core->f.GetActiveSubroutineName(program, shadertype, index, bufsize, length, name);
-}
-
-inline void QOpenGLFunctions_4_5_Compatibility::glGetActiveSubroutineUniformName(GLuint program, GLenum shadertype, GLuint index, GLsizei bufsize, GLsizei *length, GLchar *name)
-{
- d_4_0_Core->f.GetActiveSubroutineUniformName(program, shadertype, index, bufsize, length, name);
-}
-
-inline void QOpenGLFunctions_4_5_Compatibility::glGetActiveSubroutineUniformiv(GLuint program, GLenum shadertype, GLuint index, GLenum pname, GLint *values)
-{
- d_4_0_Core->f.GetActiveSubroutineUniformiv(program, shadertype, index, pname, values);
-}
-
-inline GLuint QOpenGLFunctions_4_5_Compatibility::glGetSubroutineIndex(GLuint program, GLenum shadertype, const GLchar *name)
-{
- return d_4_0_Core->f.GetSubroutineIndex(program, shadertype, name);
-}
-
-inline GLint QOpenGLFunctions_4_5_Compatibility::glGetSubroutineUniformLocation(GLuint program, GLenum shadertype, const GLchar *name)
-{
- return d_4_0_Core->f.GetSubroutineUniformLocation(program, shadertype, name);
-}
-
-inline void QOpenGLFunctions_4_5_Compatibility::glGetUniformdv(GLuint program, GLint location, GLdouble *params)
-{
- d_4_0_Core->f.GetUniformdv(program, location, params);
-}
-
-inline void QOpenGLFunctions_4_5_Compatibility::glUniformMatrix4x3dv(GLint location, GLsizei count, GLboolean transpose, const GLdouble *value)
-{
- d_4_0_Core->f.UniformMatrix4x3dv(location, count, transpose, value);
-}
-
-inline void QOpenGLFunctions_4_5_Compatibility::glUniformMatrix4x2dv(GLint location, GLsizei count, GLboolean transpose, const GLdouble *value)
-{
- d_4_0_Core->f.UniformMatrix4x2dv(location, count, transpose, value);
-}
-
-inline void QOpenGLFunctions_4_5_Compatibility::glUniformMatrix3x4dv(GLint location, GLsizei count, GLboolean transpose, const GLdouble *value)
-{
- d_4_0_Core->f.UniformMatrix3x4dv(location, count, transpose, value);
-}
-
-inline void QOpenGLFunctions_4_5_Compatibility::glUniformMatrix3x2dv(GLint location, GLsizei count, GLboolean transpose, const GLdouble *value)
-{
- d_4_0_Core->f.UniformMatrix3x2dv(location, count, transpose, value);
-}
-
-inline void QOpenGLFunctions_4_5_Compatibility::glUniformMatrix2x4dv(GLint location, GLsizei count, GLboolean transpose, const GLdouble *value)
-{
- d_4_0_Core->f.UniformMatrix2x4dv(location, count, transpose, value);
-}
-
-inline void QOpenGLFunctions_4_5_Compatibility::glUniformMatrix2x3dv(GLint location, GLsizei count, GLboolean transpose, const GLdouble *value)
-{
- d_4_0_Core->f.UniformMatrix2x3dv(location, count, transpose, value);
-}
-
-inline void QOpenGLFunctions_4_5_Compatibility::glUniformMatrix4dv(GLint location, GLsizei count, GLboolean transpose, const GLdouble *value)
-{
- d_4_0_Core->f.UniformMatrix4dv(location, count, transpose, value);
-}
-
-inline void QOpenGLFunctions_4_5_Compatibility::glUniformMatrix3dv(GLint location, GLsizei count, GLboolean transpose, const GLdouble *value)
-{
- d_4_0_Core->f.UniformMatrix3dv(location, count, transpose, value);
-}
-
-inline void QOpenGLFunctions_4_5_Compatibility::glUniformMatrix2dv(GLint location, GLsizei count, GLboolean transpose, const GLdouble *value)
-{
- d_4_0_Core->f.UniformMatrix2dv(location, count, transpose, value);
-}
-
-inline void QOpenGLFunctions_4_5_Compatibility::glUniform4dv(GLint location, GLsizei count, const GLdouble *value)
-{
- d_4_0_Core->f.Uniform4dv(location, count, value);
-}
-
-inline void QOpenGLFunctions_4_5_Compatibility::glUniform3dv(GLint location, GLsizei count, const GLdouble *value)
-{
- d_4_0_Core->f.Uniform3dv(location, count, value);
-}
-
-inline void QOpenGLFunctions_4_5_Compatibility::glUniform2dv(GLint location, GLsizei count, const GLdouble *value)
-{
- d_4_0_Core->f.Uniform2dv(location, count, value);
-}
-
-inline void QOpenGLFunctions_4_5_Compatibility::glUniform1dv(GLint location, GLsizei count, const GLdouble *value)
-{
- d_4_0_Core->f.Uniform1dv(location, count, value);
-}
-
-inline void QOpenGLFunctions_4_5_Compatibility::glUniform4d(GLint location, GLdouble x, GLdouble y, GLdouble z, GLdouble w)
-{
- d_4_0_Core->f.Uniform4d(location, x, y, z, w);
-}
-
-inline void QOpenGLFunctions_4_5_Compatibility::glUniform3d(GLint location, GLdouble x, GLdouble y, GLdouble z)
-{
- d_4_0_Core->f.Uniform3d(location, x, y, z);
-}
-
-inline void QOpenGLFunctions_4_5_Compatibility::glUniform2d(GLint location, GLdouble x, GLdouble y)
-{
- d_4_0_Core->f.Uniform2d(location, x, y);
-}
-
-inline void QOpenGLFunctions_4_5_Compatibility::glUniform1d(GLint location, GLdouble x)
-{
- d_4_0_Core->f.Uniform1d(location, x);
-}
-
-inline void QOpenGLFunctions_4_5_Compatibility::glDrawElementsIndirect(GLenum mode, GLenum type, const void *indirect)
-{
- d_4_0_Core->f.DrawElementsIndirect(mode, type, indirect);
-}
-
-inline void QOpenGLFunctions_4_5_Compatibility::glDrawArraysIndirect(GLenum mode, const void *indirect)
-{
- d_4_0_Core->f.DrawArraysIndirect(mode, indirect);
-}
-
-inline void QOpenGLFunctions_4_5_Compatibility::glBlendFuncSeparatei(GLuint buf, GLenum srcRGB, GLenum dstRGB, GLenum srcAlpha, GLenum dstAlpha)
-{
- d_4_0_Core->f.BlendFuncSeparatei(buf, srcRGB, dstRGB, srcAlpha, dstAlpha);
-}
-
-inline void QOpenGLFunctions_4_5_Compatibility::glBlendFunci(GLuint buf, GLenum src, GLenum dst)
-{
- d_4_0_Core->f.BlendFunci(buf, src, dst);
-}
-
-inline void QOpenGLFunctions_4_5_Compatibility::glBlendEquationSeparatei(GLuint buf, GLenum modeRGB, GLenum modeAlpha)
-{
- d_4_0_Core->f.BlendEquationSeparatei(buf, modeRGB, modeAlpha);
-}
-
-inline void QOpenGLFunctions_4_5_Compatibility::glBlendEquationi(GLuint buf, GLenum mode)
-{
- d_4_0_Core->f.BlendEquationi(buf, mode);
-}
-
-inline void QOpenGLFunctions_4_5_Compatibility::glMinSampleShading(GLfloat value)
-{
- d_4_0_Core->f.MinSampleShading(value);
-}
-
-
-// OpenGL 4.1 core functions
-inline void QOpenGLFunctions_4_5_Compatibility::glGetDoublei_v(GLenum target, GLuint index, GLdouble *data)
-{
- d_4_1_Core->f.GetDoublei_v(target, index, data);
-}
-
-inline void QOpenGLFunctions_4_5_Compatibility::glGetFloati_v(GLenum target, GLuint index, GLfloat *data)
-{
- d_4_1_Core->f.GetFloati_v(target, index, data);
-}
-
-inline void QOpenGLFunctions_4_5_Compatibility::glDepthRangeIndexed(GLuint index, GLdouble n, GLdouble f)
-{
- d_4_1_Core->f.DepthRangeIndexed(index, n, f);
-}
-
-inline void QOpenGLFunctions_4_5_Compatibility::glDepthRangeArrayv(GLuint first, GLsizei count, const GLdouble *v)
-{
- d_4_1_Core->f.DepthRangeArrayv(first, count, v);
-}
-
-inline void QOpenGLFunctions_4_5_Compatibility::glScissorIndexedv(GLuint index, const GLint *v)
-{
- d_4_1_Core->f.ScissorIndexedv(index, v);
-}
-
-inline void QOpenGLFunctions_4_5_Compatibility::glScissorIndexed(GLuint index, GLint left, GLint bottom, GLsizei width, GLsizei height)
-{
- d_4_1_Core->f.ScissorIndexed(index, left, bottom, width, height);
-}
-
-inline void QOpenGLFunctions_4_5_Compatibility::glScissorArrayv(GLuint first, GLsizei count, const GLint *v)
-{
- d_4_1_Core->f.ScissorArrayv(first, count, v);
-}
-
-inline void QOpenGLFunctions_4_5_Compatibility::glViewportIndexedfv(GLuint index, const GLfloat *v)
-{
- d_4_1_Core->f.ViewportIndexedfv(index, v);
-}
-
-inline void QOpenGLFunctions_4_5_Compatibility::glViewportIndexedf(GLuint index, GLfloat x, GLfloat y, GLfloat w, GLfloat h)
-{
- d_4_1_Core->f.ViewportIndexedf(index, x, y, w, h);
-}
-
-inline void QOpenGLFunctions_4_5_Compatibility::glViewportArrayv(GLuint first, GLsizei count, const GLfloat *v)
-{
- d_4_1_Core->f.ViewportArrayv(first, count, v);
-}
-
-inline void QOpenGLFunctions_4_5_Compatibility::glGetVertexAttribLdv(GLuint index, GLenum pname, GLdouble *params)
-{
- d_4_1_Core->f.GetVertexAttribLdv(index, pname, params);
-}
-
-inline void QOpenGLFunctions_4_5_Compatibility::glVertexAttribLPointer(GLuint index, GLint size, GLenum type, GLsizei stride, const void *pointer)
-{
- d_4_1_Core->f.VertexAttribLPointer(index, size, type, stride, pointer);
-}
-
-inline void QOpenGLFunctions_4_5_Compatibility::glVertexAttribL4dv(GLuint index, const GLdouble *v)
-{
- d_4_1_Core->f.VertexAttribL4dv(index, v);
-}
-
-inline void QOpenGLFunctions_4_5_Compatibility::glVertexAttribL3dv(GLuint index, const GLdouble *v)
-{
- d_4_1_Core->f.VertexAttribL3dv(index, v);
-}
-
-inline void QOpenGLFunctions_4_5_Compatibility::glVertexAttribL2dv(GLuint index, const GLdouble *v)
-{
- d_4_1_Core->f.VertexAttribL2dv(index, v);
-}
-
-inline void QOpenGLFunctions_4_5_Compatibility::glVertexAttribL1dv(GLuint index, const GLdouble *v)
-{
- d_4_1_Core->f.VertexAttribL1dv(index, v);
-}
-
-inline void QOpenGLFunctions_4_5_Compatibility::glVertexAttribL4d(GLuint index, GLdouble x, GLdouble y, GLdouble z, GLdouble w)
-{
- d_4_1_Core->f.VertexAttribL4d(index, x, y, z, w);
-}
-
-inline void QOpenGLFunctions_4_5_Compatibility::glVertexAttribL3d(GLuint index, GLdouble x, GLdouble y, GLdouble z)
-{
- d_4_1_Core->f.VertexAttribL3d(index, x, y, z);
-}
-
-inline void QOpenGLFunctions_4_5_Compatibility::glVertexAttribL2d(GLuint index, GLdouble x, GLdouble y)
-{
- d_4_1_Core->f.VertexAttribL2d(index, x, y);
-}
-
-inline void QOpenGLFunctions_4_5_Compatibility::glVertexAttribL1d(GLuint index, GLdouble x)
-{
- d_4_1_Core->f.VertexAttribL1d(index, x);
-}
-
-inline void QOpenGLFunctions_4_5_Compatibility::glGetProgramPipelineInfoLog(GLuint pipeline, GLsizei bufSize, GLsizei *length, GLchar *infoLog)
-{
- d_4_1_Core->f.GetProgramPipelineInfoLog(pipeline, bufSize, length, infoLog);
-}
-
-inline void QOpenGLFunctions_4_5_Compatibility::glValidateProgramPipeline(GLuint pipeline)
-{
- d_4_1_Core->f.ValidateProgramPipeline(pipeline);
-}
-
-inline void QOpenGLFunctions_4_5_Compatibility::glProgramUniformMatrix4x3dv(GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLdouble *value)
-{
- d_4_1_Core->f.ProgramUniformMatrix4x3dv(program, location, count, transpose, value);
-}
-
-inline void QOpenGLFunctions_4_5_Compatibility::glProgramUniformMatrix3x4dv(GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLdouble *value)
-{
- d_4_1_Core->f.ProgramUniformMatrix3x4dv(program, location, count, transpose, value);
-}
-
-inline void QOpenGLFunctions_4_5_Compatibility::glProgramUniformMatrix4x2dv(GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLdouble *value)
-{
- d_4_1_Core->f.ProgramUniformMatrix4x2dv(program, location, count, transpose, value);
-}
-
-inline void QOpenGLFunctions_4_5_Compatibility::glProgramUniformMatrix2x4dv(GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLdouble *value)
-{
- d_4_1_Core->f.ProgramUniformMatrix2x4dv(program, location, count, transpose, value);
-}
-
-inline void QOpenGLFunctions_4_5_Compatibility::glProgramUniformMatrix3x2dv(GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLdouble *value)
-{
- d_4_1_Core->f.ProgramUniformMatrix3x2dv(program, location, count, transpose, value);
-}
-
-inline void QOpenGLFunctions_4_5_Compatibility::glProgramUniformMatrix2x3dv(GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLdouble *value)
-{
- d_4_1_Core->f.ProgramUniformMatrix2x3dv(program, location, count, transpose, value);
-}
-
-inline void QOpenGLFunctions_4_5_Compatibility::glProgramUniformMatrix4x3fv(GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value)
-{
- d_4_1_Core->f.ProgramUniformMatrix4x3fv(program, location, count, transpose, value);
-}
-
-inline void QOpenGLFunctions_4_5_Compatibility::glProgramUniformMatrix3x4fv(GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value)
-{
- d_4_1_Core->f.ProgramUniformMatrix3x4fv(program, location, count, transpose, value);
-}
-
-inline void QOpenGLFunctions_4_5_Compatibility::glProgramUniformMatrix4x2fv(GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value)
-{
- d_4_1_Core->f.ProgramUniformMatrix4x2fv(program, location, count, transpose, value);
-}
-
-inline void QOpenGLFunctions_4_5_Compatibility::glProgramUniformMatrix2x4fv(GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value)
-{
- d_4_1_Core->f.ProgramUniformMatrix2x4fv(program, location, count, transpose, value);
-}
-
-inline void QOpenGLFunctions_4_5_Compatibility::glProgramUniformMatrix3x2fv(GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value)
-{
- d_4_1_Core->f.ProgramUniformMatrix3x2fv(program, location, count, transpose, value);
-}
-
-inline void QOpenGLFunctions_4_5_Compatibility::glProgramUniformMatrix2x3fv(GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value)
-{
- d_4_1_Core->f.ProgramUniformMatrix2x3fv(program, location, count, transpose, value);
-}
-
-inline void QOpenGLFunctions_4_5_Compatibility::glProgramUniformMatrix4dv(GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLdouble *value)
-{
- d_4_1_Core->f.ProgramUniformMatrix4dv(program, location, count, transpose, value);
-}
-
-inline void QOpenGLFunctions_4_5_Compatibility::glProgramUniformMatrix3dv(GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLdouble *value)
-{
- d_4_1_Core->f.ProgramUniformMatrix3dv(program, location, count, transpose, value);
-}
-
-inline void QOpenGLFunctions_4_5_Compatibility::glProgramUniformMatrix2dv(GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLdouble *value)
-{
- d_4_1_Core->f.ProgramUniformMatrix2dv(program, location, count, transpose, value);
-}
-
-inline void QOpenGLFunctions_4_5_Compatibility::glProgramUniformMatrix4fv(GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value)
-{
- d_4_1_Core->f.ProgramUniformMatrix4fv(program, location, count, transpose, value);
-}
-
-inline void QOpenGLFunctions_4_5_Compatibility::glProgramUniformMatrix3fv(GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value)
-{
- d_4_1_Core->f.ProgramUniformMatrix3fv(program, location, count, transpose, value);
-}
-
-inline void QOpenGLFunctions_4_5_Compatibility::glProgramUniformMatrix2fv(GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value)
-{
- d_4_1_Core->f.ProgramUniformMatrix2fv(program, location, count, transpose, value);
-}
-
-inline void QOpenGLFunctions_4_5_Compatibility::glProgramUniform4uiv(GLuint program, GLint location, GLsizei count, const GLuint *value)
-{
- d_4_1_Core->f.ProgramUniform4uiv(program, location, count, value);
-}
-
-inline void QOpenGLFunctions_4_5_Compatibility::glProgramUniform4ui(GLuint program, GLint location, GLuint v0, GLuint v1, GLuint v2, GLuint v3)
-{
- d_4_1_Core->f.ProgramUniform4ui(program, location, v0, v1, v2, v3);
-}
-
-inline void QOpenGLFunctions_4_5_Compatibility::glProgramUniform4dv(GLuint program, GLint location, GLsizei count, const GLdouble *value)
-{
- d_4_1_Core->f.ProgramUniform4dv(program, location, count, value);
-}
-
-inline void QOpenGLFunctions_4_5_Compatibility::glProgramUniform4d(GLuint program, GLint location, GLdouble v0, GLdouble v1, GLdouble v2, GLdouble v3)
-{
- d_4_1_Core->f.ProgramUniform4d(program, location, v0, v1, v2, v3);
-}
-
-inline void QOpenGLFunctions_4_5_Compatibility::glProgramUniform4fv(GLuint program, GLint location, GLsizei count, const GLfloat *value)
-{
- d_4_1_Core->f.ProgramUniform4fv(program, location, count, value);
-}
-
-inline void QOpenGLFunctions_4_5_Compatibility::glProgramUniform4f(GLuint program, GLint location, GLfloat v0, GLfloat v1, GLfloat v2, GLfloat v3)
-{
- d_4_1_Core->f.ProgramUniform4f(program, location, v0, v1, v2, v3);
-}
-
-inline void QOpenGLFunctions_4_5_Compatibility::glProgramUniform4iv(GLuint program, GLint location, GLsizei count, const GLint *value)
-{
- d_4_1_Core->f.ProgramUniform4iv(program, location, count, value);
-}
-
-inline void QOpenGLFunctions_4_5_Compatibility::glProgramUniform4i(GLuint program, GLint location, GLint v0, GLint v1, GLint v2, GLint v3)
-{
- d_4_1_Core->f.ProgramUniform4i(program, location, v0, v1, v2, v3);
-}
-
-inline void QOpenGLFunctions_4_5_Compatibility::glProgramUniform3uiv(GLuint program, GLint location, GLsizei count, const GLuint *value)
-{
- d_4_1_Core->f.ProgramUniform3uiv(program, location, count, value);
-}
-
-inline void QOpenGLFunctions_4_5_Compatibility::glProgramUniform3ui(GLuint program, GLint location, GLuint v0, GLuint v1, GLuint v2)
-{
- d_4_1_Core->f.ProgramUniform3ui(program, location, v0, v1, v2);
-}
-
-inline void QOpenGLFunctions_4_5_Compatibility::glProgramUniform3dv(GLuint program, GLint location, GLsizei count, const GLdouble *value)
-{
- d_4_1_Core->f.ProgramUniform3dv(program, location, count, value);
-}
-
-inline void QOpenGLFunctions_4_5_Compatibility::glProgramUniform3d(GLuint program, GLint location, GLdouble v0, GLdouble v1, GLdouble v2)
-{
- d_4_1_Core->f.ProgramUniform3d(program, location, v0, v1, v2);
-}
-
-inline void QOpenGLFunctions_4_5_Compatibility::glProgramUniform3fv(GLuint program, GLint location, GLsizei count, const GLfloat *value)
-{
- d_4_1_Core->f.ProgramUniform3fv(program, location, count, value);
-}
-
-inline void QOpenGLFunctions_4_5_Compatibility::glProgramUniform3f(GLuint program, GLint location, GLfloat v0, GLfloat v1, GLfloat v2)
-{
- d_4_1_Core->f.ProgramUniform3f(program, location, v0, v1, v2);
-}
-
-inline void QOpenGLFunctions_4_5_Compatibility::glProgramUniform3iv(GLuint program, GLint location, GLsizei count, const GLint *value)
-{
- d_4_1_Core->f.ProgramUniform3iv(program, location, count, value);
-}
-
-inline void QOpenGLFunctions_4_5_Compatibility::glProgramUniform3i(GLuint program, GLint location, GLint v0, GLint v1, GLint v2)
-{
- d_4_1_Core->f.ProgramUniform3i(program, location, v0, v1, v2);
-}
-
-inline void QOpenGLFunctions_4_5_Compatibility::glProgramUniform2uiv(GLuint program, GLint location, GLsizei count, const GLuint *value)
-{
- d_4_1_Core->f.ProgramUniform2uiv(program, location, count, value);
-}
-
-inline void QOpenGLFunctions_4_5_Compatibility::glProgramUniform2ui(GLuint program, GLint location, GLuint v0, GLuint v1)
-{
- d_4_1_Core->f.ProgramUniform2ui(program, location, v0, v1);
-}
-
-inline void QOpenGLFunctions_4_5_Compatibility::glProgramUniform2dv(GLuint program, GLint location, GLsizei count, const GLdouble *value)
-{
- d_4_1_Core->f.ProgramUniform2dv(program, location, count, value);
-}
-
-inline void QOpenGLFunctions_4_5_Compatibility::glProgramUniform2d(GLuint program, GLint location, GLdouble v0, GLdouble v1)
-{
- d_4_1_Core->f.ProgramUniform2d(program, location, v0, v1);
-}
-
-inline void QOpenGLFunctions_4_5_Compatibility::glProgramUniform2fv(GLuint program, GLint location, GLsizei count, const GLfloat *value)
-{
- d_4_1_Core->f.ProgramUniform2fv(program, location, count, value);
-}
-
-inline void QOpenGLFunctions_4_5_Compatibility::glProgramUniform2f(GLuint program, GLint location, GLfloat v0, GLfloat v1)
-{
- d_4_1_Core->f.ProgramUniform2f(program, location, v0, v1);
-}
-
-inline void QOpenGLFunctions_4_5_Compatibility::glProgramUniform2iv(GLuint program, GLint location, GLsizei count, const GLint *value)
-{
- d_4_1_Core->f.ProgramUniform2iv(program, location, count, value);
-}
-
-inline void QOpenGLFunctions_4_5_Compatibility::glProgramUniform2i(GLuint program, GLint location, GLint v0, GLint v1)
-{
- d_4_1_Core->f.ProgramUniform2i(program, location, v0, v1);
-}
-
-inline void QOpenGLFunctions_4_5_Compatibility::glProgramUniform1uiv(GLuint program, GLint location, GLsizei count, const GLuint *value)
-{
- d_4_1_Core->f.ProgramUniform1uiv(program, location, count, value);
-}
-
-inline void QOpenGLFunctions_4_5_Compatibility::glProgramUniform1ui(GLuint program, GLint location, GLuint v0)
-{
- d_4_1_Core->f.ProgramUniform1ui(program, location, v0);
-}
-
-inline void QOpenGLFunctions_4_5_Compatibility::glProgramUniform1dv(GLuint program, GLint location, GLsizei count, const GLdouble *value)
-{
- d_4_1_Core->f.ProgramUniform1dv(program, location, count, value);
-}
-
-inline void QOpenGLFunctions_4_5_Compatibility::glProgramUniform1d(GLuint program, GLint location, GLdouble v0)
-{
- d_4_1_Core->f.ProgramUniform1d(program, location, v0);
-}
-
-inline void QOpenGLFunctions_4_5_Compatibility::glProgramUniform1fv(GLuint program, GLint location, GLsizei count, const GLfloat *value)
-{
- d_4_1_Core->f.ProgramUniform1fv(program, location, count, value);
-}
-
-inline void QOpenGLFunctions_4_5_Compatibility::glProgramUniform1f(GLuint program, GLint location, GLfloat v0)
-{
- d_4_1_Core->f.ProgramUniform1f(program, location, v0);
-}
-
-inline void QOpenGLFunctions_4_5_Compatibility::glProgramUniform1iv(GLuint program, GLint location, GLsizei count, const GLint *value)
-{
- d_4_1_Core->f.ProgramUniform1iv(program, location, count, value);
-}
-
-inline void QOpenGLFunctions_4_5_Compatibility::glProgramUniform1i(GLuint program, GLint location, GLint v0)
-{
- d_4_1_Core->f.ProgramUniform1i(program, location, v0);
-}
-
-inline void QOpenGLFunctions_4_5_Compatibility::glGetProgramPipelineiv(GLuint pipeline, GLenum pname, GLint *params)
-{
- d_4_1_Core->f.GetProgramPipelineiv(pipeline, pname, params);
-}
-
-inline GLboolean QOpenGLFunctions_4_5_Compatibility::glIsProgramPipeline(GLuint pipeline)
-{
- return d_4_1_Core->f.IsProgramPipeline(pipeline);
-}
-
-inline void QOpenGLFunctions_4_5_Compatibility::glGenProgramPipelines(GLsizei n, GLuint *pipelines)
-{
- d_4_1_Core->f.GenProgramPipelines(n, pipelines);
-}
-
-inline void QOpenGLFunctions_4_5_Compatibility::glDeleteProgramPipelines(GLsizei n, const GLuint *pipelines)
-{
- d_4_1_Core->f.DeleteProgramPipelines(n, pipelines);
-}
-
-inline void QOpenGLFunctions_4_5_Compatibility::glBindProgramPipeline(GLuint pipeline)
-{
- d_4_1_Core->f.BindProgramPipeline(pipeline);
-}
-
-inline GLuint QOpenGLFunctions_4_5_Compatibility::glCreateShaderProgramv(GLenum type, GLsizei count, const GLchar *const *strings)
-{
- return d_4_1_Core->f.CreateShaderProgramv(type, count, strings);
-}
-
-inline void QOpenGLFunctions_4_5_Compatibility::glActiveShaderProgram(GLuint pipeline, GLuint program)
-{
- d_4_1_Core->f.ActiveShaderProgram(pipeline, program);
-}
-
-inline void QOpenGLFunctions_4_5_Compatibility::glUseProgramStages(GLuint pipeline, GLbitfield stages, GLuint program)
-{
- d_4_1_Core->f.UseProgramStages(pipeline, stages, program);
-}
-
-inline void QOpenGLFunctions_4_5_Compatibility::glProgramParameteri(GLuint program, GLenum pname, GLint value)
-{
- d_4_1_Core->f.ProgramParameteri(program, pname, value);
-}
-
-inline void QOpenGLFunctions_4_5_Compatibility::glProgramBinary(GLuint program, GLenum binaryFormat, const void *binary, GLsizei length)
-{
- d_4_1_Core->f.ProgramBinary(program, binaryFormat, binary, length);
-}
-
-inline void QOpenGLFunctions_4_5_Compatibility::glGetProgramBinary(GLuint program, GLsizei bufSize, GLsizei *length, GLenum *binaryFormat, void *binary)
-{
- d_4_1_Core->f.GetProgramBinary(program, bufSize, length, binaryFormat, binary);
-}
-
-inline void QOpenGLFunctions_4_5_Compatibility::glClearDepthf(GLfloat dd)
-{
- d_4_1_Core->f.ClearDepthf(dd);
-}
-
-inline void QOpenGLFunctions_4_5_Compatibility::glDepthRangef(GLfloat n, GLfloat f)
-{
- d_4_1_Core->f.DepthRangef(n, f);
-}
-
-inline void QOpenGLFunctions_4_5_Compatibility::glGetShaderPrecisionFormat(GLenum shadertype, GLenum precisiontype, GLint *range, GLint *precision)
-{
- d_4_1_Core->f.GetShaderPrecisionFormat(shadertype, precisiontype, range, precision);
-}
-
-inline void QOpenGLFunctions_4_5_Compatibility::glShaderBinary(GLsizei count, const GLuint *shaders, GLenum binaryformat, const void *binary, GLsizei length)
-{
- d_4_1_Core->f.ShaderBinary(count, shaders, binaryformat, binary, length);
-}
-
-inline void QOpenGLFunctions_4_5_Compatibility::glReleaseShaderCompiler()
-{
- d_4_1_Core->f.ReleaseShaderCompiler();
-}
-
-
-// OpenGL 4.2 core functions
-inline void QOpenGLFunctions_4_5_Compatibility::glDrawTransformFeedbackStreamInstanced(GLenum mode, GLuint id, GLuint stream, GLsizei instancecount)
-{
- d_4_2_Core->f.DrawTransformFeedbackStreamInstanced(mode, id, stream, instancecount);
-}
-
-inline void QOpenGLFunctions_4_5_Compatibility::glDrawTransformFeedbackInstanced(GLenum mode, GLuint id, GLsizei instancecount)
-{
- d_4_2_Core->f.DrawTransformFeedbackInstanced(mode, id, instancecount);
-}
-
-inline void QOpenGLFunctions_4_5_Compatibility::glTexStorage3D(GLenum target, GLsizei levels, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth)
-{
- d_4_2_Core->f.TexStorage3D(target, levels, internalformat, width, height, depth);
-}
-
-inline void QOpenGLFunctions_4_5_Compatibility::glTexStorage2D(GLenum target, GLsizei levels, GLenum internalformat, GLsizei width, GLsizei height)
-{
- d_4_2_Core->f.TexStorage2D(target, levels, internalformat, width, height);
-}
-
-inline void QOpenGLFunctions_4_5_Compatibility::glTexStorage1D(GLenum target, GLsizei levels, GLenum internalformat, GLsizei width)
-{
- d_4_2_Core->f.TexStorage1D(target, levels, internalformat, width);
-}
-
-inline void QOpenGLFunctions_4_5_Compatibility::glMemoryBarrier(GLbitfield barriers)
-{
- d_4_2_Core->f.MemoryBarrier(barriers);
-}
-
-inline void QOpenGLFunctions_4_5_Compatibility::glBindImageTexture(GLuint unit, GLuint texture, GLint level, GLboolean layered, GLint layer, GLenum access, GLenum format)
-{
- d_4_2_Core->f.BindImageTexture(unit, texture, level, layered, layer, access, format);
-}
-
-inline void QOpenGLFunctions_4_5_Compatibility::glGetActiveAtomicCounterBufferiv(GLuint program, GLuint bufferIndex, GLenum pname, GLint *params)
-{
- d_4_2_Core->f.GetActiveAtomicCounterBufferiv(program, bufferIndex, pname, params);
-}
-
-inline void QOpenGLFunctions_4_5_Compatibility::glGetInternalformativ(GLenum target, GLenum internalformat, GLenum pname, GLsizei bufSize, GLint *params)
-{
- d_4_2_Core->f.GetInternalformativ(target, internalformat, pname, bufSize, params);
-}
-
-inline void QOpenGLFunctions_4_5_Compatibility::glDrawElementsInstancedBaseVertexBaseInstance(GLenum mode, GLsizei count, GLenum type, const void *indices, GLsizei instancecount, GLint basevertex, GLuint baseinstance)
-{
- d_4_2_Core->f.DrawElementsInstancedBaseVertexBaseInstance(mode, count, type, indices, instancecount, basevertex, baseinstance);
-}
-
-inline void QOpenGLFunctions_4_5_Compatibility::glDrawElementsInstancedBaseInstance(GLenum mode, GLsizei count, GLenum type, const void *indices, GLsizei instancecount, GLuint baseinstance)
-{
- d_4_2_Core->f.DrawElementsInstancedBaseInstance(mode, count, type, indices, instancecount, baseinstance);
-}
-
-inline void QOpenGLFunctions_4_5_Compatibility::glDrawArraysInstancedBaseInstance(GLenum mode, GLint first, GLsizei count, GLsizei instancecount, GLuint baseinstance)
-{
- d_4_2_Core->f.DrawArraysInstancedBaseInstance(mode, first, count, instancecount, baseinstance);
-}
-
-
-// OpenGL 4.3 core functions
-inline void QOpenGLFunctions_4_5_Compatibility::glGetObjectPtrLabel(const void *ptr, GLsizei bufSize, GLsizei *length, GLchar *label)
-{
- d_4_3_Core->f.GetObjectPtrLabel(ptr, bufSize, length, label);
-}
-
-inline void QOpenGLFunctions_4_5_Compatibility::glObjectPtrLabel(const void *ptr, GLsizei length, const GLchar *label)
-{
- d_4_3_Core->f.ObjectPtrLabel(ptr, length, label);
-}
-
-inline void QOpenGLFunctions_4_5_Compatibility::glGetObjectLabel(GLenum identifier, GLuint name, GLsizei bufSize, GLsizei *length, GLchar *label)
-{
- d_4_3_Core->f.GetObjectLabel(identifier, name, bufSize, length, label);
-}
-
-inline void QOpenGLFunctions_4_5_Compatibility::glObjectLabel(GLenum identifier, GLuint name, GLsizei length, const GLchar *label)
-{
- d_4_3_Core->f.ObjectLabel(identifier, name, length, label);
-}
-
-inline void QOpenGLFunctions_4_5_Compatibility::glPopDebugGroup()
-{
- d_4_3_Core->f.PopDebugGroup();
-}
-
-inline void QOpenGLFunctions_4_5_Compatibility::glPushDebugGroup(GLenum source, GLuint id, GLsizei length, const GLchar *message)
-{
- d_4_3_Core->f.PushDebugGroup(source, id, length, message);
-}
-
-inline GLuint QOpenGLFunctions_4_5_Compatibility::glGetDebugMessageLog(GLuint count, GLsizei bufSize, GLenum *sources, GLenum *types, GLuint *ids, GLenum *severities, GLsizei *lengths, GLchar *messageLog)
-{
- return d_4_3_Core->f.GetDebugMessageLog(count, bufSize, sources, types, ids, severities, lengths, messageLog);
-}
-
-inline void QOpenGLFunctions_4_5_Compatibility::glDebugMessageCallback(GLDEBUGPROC callback, const void *userParam)
-{
- d_4_3_Core->f.DebugMessageCallback(callback, userParam);
-}
-
-inline void QOpenGLFunctions_4_5_Compatibility::glDebugMessageInsert(GLenum source, GLenum type, GLuint id, GLenum severity, GLsizei length, const GLchar *buf)
-{
- d_4_3_Core->f.DebugMessageInsert(source, type, id, severity, length, buf);
-}
-
-inline void QOpenGLFunctions_4_5_Compatibility::glDebugMessageControl(GLenum source, GLenum type, GLenum severity, GLsizei count, const GLuint *ids, GLboolean enabled)
-{
- d_4_3_Core->f.DebugMessageControl(source, type, severity, count, ids, enabled);
-}
-
-inline void QOpenGLFunctions_4_5_Compatibility::glVertexBindingDivisor(GLuint bindingindex, GLuint divisor)
-{
- d_4_3_Core->f.VertexBindingDivisor(bindingindex, divisor);
-}
-
-inline void QOpenGLFunctions_4_5_Compatibility::glVertexAttribBinding(GLuint attribindex, GLuint bindingindex)
-{
- d_4_3_Core->f.VertexAttribBinding(attribindex, bindingindex);
-}
-
-inline void QOpenGLFunctions_4_5_Compatibility::glVertexAttribLFormat(GLuint attribindex, GLint size, GLenum type, GLuint relativeoffset)
-{
- d_4_3_Core->f.VertexAttribLFormat(attribindex, size, type, relativeoffset);
-}
-
-inline void QOpenGLFunctions_4_5_Compatibility::glVertexAttribIFormat(GLuint attribindex, GLint size, GLenum type, GLuint relativeoffset)
-{
- d_4_3_Core->f.VertexAttribIFormat(attribindex, size, type, relativeoffset);
-}
-
-inline void QOpenGLFunctions_4_5_Compatibility::glVertexAttribFormat(GLuint attribindex, GLint size, GLenum type, GLboolean normalized, GLuint relativeoffset)
-{
- d_4_3_Core->f.VertexAttribFormat(attribindex, size, type, normalized, relativeoffset);
-}
-
-inline void QOpenGLFunctions_4_5_Compatibility::glBindVertexBuffer(GLuint bindingindex, GLuint buffer, GLintptr offset, GLsizei stride)
-{
- d_4_3_Core->f.BindVertexBuffer(bindingindex, buffer, offset, stride);
-}
-
-inline void QOpenGLFunctions_4_5_Compatibility::glTextureView(GLuint texture, GLenum target, GLuint origtexture, GLenum internalformat, GLuint minlevel, GLuint numlevels, GLuint minlayer, GLuint numlayers)
-{
- d_4_3_Core->f.TextureView(texture, target, origtexture, internalformat, minlevel, numlevels, minlayer, numlayers);
-}
-
-inline void QOpenGLFunctions_4_5_Compatibility::glTexStorage3DMultisample(GLenum target, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth, GLboolean fixedsamplelocations)
-{
- d_4_3_Core->f.TexStorage3DMultisample(target, samples, internalformat, width, height, depth, fixedsamplelocations);
-}
-
-inline void QOpenGLFunctions_4_5_Compatibility::glTexStorage2DMultisample(GLenum target, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height, GLboolean fixedsamplelocations)
-{
- d_4_3_Core->f.TexStorage2DMultisample(target, samples, internalformat, width, height, fixedsamplelocations);
-}
-
-inline void QOpenGLFunctions_4_5_Compatibility::glTexBufferRange(GLenum target, GLenum internalformat, GLuint buffer, GLintptr offset, GLsizeiptr size)
-{
- d_4_3_Core->f.TexBufferRange(target, internalformat, buffer, offset, size);
-}
-
-inline void QOpenGLFunctions_4_5_Compatibility::glShaderStorageBlockBinding(GLuint program, GLuint storageBlockIndex, GLuint storageBlockBinding)
-{
- d_4_3_Core->f.ShaderStorageBlockBinding(program, storageBlockIndex, storageBlockBinding);
-}
-
-inline GLint QOpenGLFunctions_4_5_Compatibility::glGetProgramResourceLocationIndex(GLuint program, GLenum programInterface, const GLchar *name)
-{
- return d_4_3_Core->f.GetProgramResourceLocationIndex(program, programInterface, name);
-}
-
-inline GLint QOpenGLFunctions_4_5_Compatibility::glGetProgramResourceLocation(GLuint program, GLenum programInterface, const GLchar *name)
-{
- return d_4_3_Core->f.GetProgramResourceLocation(program, programInterface, name);
-}
-
-inline void QOpenGLFunctions_4_5_Compatibility::glGetProgramResourceiv(GLuint program, GLenum programInterface, GLuint index, GLsizei propCount, const GLenum *props, GLsizei bufSize, GLsizei *length, GLint *params)
-{
- d_4_3_Core->f.GetProgramResourceiv(program, programInterface, index, propCount, props, bufSize, length, params);
-}
-
-inline void QOpenGLFunctions_4_5_Compatibility::glGetProgramResourceName(GLuint program, GLenum programInterface, GLuint index, GLsizei bufSize, GLsizei *length, GLchar *name)
-{
- d_4_3_Core->f.GetProgramResourceName(program, programInterface, index, bufSize, length, name);
-}
-
-inline GLuint QOpenGLFunctions_4_5_Compatibility::glGetProgramResourceIndex(GLuint program, GLenum programInterface, const GLchar *name)
-{
- return d_4_3_Core->f.GetProgramResourceIndex(program, programInterface, name);
-}
-
-inline void QOpenGLFunctions_4_5_Compatibility::glGetProgramInterfaceiv(GLuint program, GLenum programInterface, GLenum pname, GLint *params)
-{
- d_4_3_Core->f.GetProgramInterfaceiv(program, programInterface, pname, params);
-}
-
-inline void QOpenGLFunctions_4_5_Compatibility::glMultiDrawElementsIndirect(GLenum mode, GLenum type, const void *indirect, GLsizei drawcount, GLsizei stride)
-{
- d_4_3_Core->f.MultiDrawElementsIndirect(mode, type, indirect, drawcount, stride);
-}
-
-inline void QOpenGLFunctions_4_5_Compatibility::glMultiDrawArraysIndirect(GLenum mode, const void *indirect, GLsizei drawcount, GLsizei stride)
-{
- d_4_3_Core->f.MultiDrawArraysIndirect(mode, indirect, drawcount, stride);
-}
-
-inline void QOpenGLFunctions_4_5_Compatibility::glInvalidateSubFramebuffer(GLenum target, GLsizei numAttachments, const GLenum *attachments, GLint x, GLint y, GLsizei width, GLsizei height)
-{
- d_4_3_Core->f.InvalidateSubFramebuffer(target, numAttachments, attachments, x, y, width, height);
-}
-
-inline void QOpenGLFunctions_4_5_Compatibility::glInvalidateFramebuffer(GLenum target, GLsizei numAttachments, const GLenum *attachments)
-{
- d_4_3_Core->f.InvalidateFramebuffer(target, numAttachments, attachments);
-}
-
-inline void QOpenGLFunctions_4_5_Compatibility::glInvalidateBufferData(GLuint buffer)
-{
- d_4_3_Core->f.InvalidateBufferData(buffer);
-}
-
-inline void QOpenGLFunctions_4_5_Compatibility::glInvalidateBufferSubData(GLuint buffer, GLintptr offset, GLsizeiptr length)
-{
- d_4_3_Core->f.InvalidateBufferSubData(buffer, offset, length);
-}
-
-inline void QOpenGLFunctions_4_5_Compatibility::glInvalidateTexImage(GLuint texture, GLint level)
-{
- d_4_3_Core->f.InvalidateTexImage(texture, level);
-}
-
-inline void QOpenGLFunctions_4_5_Compatibility::glInvalidateTexSubImage(GLuint texture, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth)
-{
- d_4_3_Core->f.InvalidateTexSubImage(texture, level, xoffset, yoffset, zoffset, width, height, depth);
-}
-
-inline void QOpenGLFunctions_4_5_Compatibility::glGetInternalformati64v(GLenum target, GLenum internalformat, GLenum pname, GLsizei bufSize, GLint64 *params)
-{
- d_4_3_Core->f.GetInternalformati64v(target, internalformat, pname, bufSize, params);
-}
-
-inline void QOpenGLFunctions_4_5_Compatibility::glGetFramebufferParameteriv(GLenum target, GLenum pname, GLint *params)
-{
- d_4_3_Core->f.GetFramebufferParameteriv(target, pname, params);
-}
-
-inline void QOpenGLFunctions_4_5_Compatibility::glFramebufferParameteri(GLenum target, GLenum pname, GLint param)
-{
- d_4_3_Core->f.FramebufferParameteri(target, pname, param);
-}
-
-inline void QOpenGLFunctions_4_5_Compatibility::glCopyImageSubData(GLuint srcName, GLenum srcTarget, GLint srcLevel, GLint srcX, GLint srcY, GLint srcZ, GLuint dstName, GLenum dstTarget, GLint dstLevel, GLint dstX, GLint dstY, GLint dstZ, GLsizei srcWidth, GLsizei srcHeight, GLsizei srcDepth)
-{
- d_4_3_Core->f.CopyImageSubData(srcName, srcTarget, srcLevel, srcX, srcY, srcZ, dstName, dstTarget, dstLevel, dstX, dstY, dstZ, srcWidth, srcHeight, srcDepth);
-}
-
-inline void QOpenGLFunctions_4_5_Compatibility::glDispatchComputeIndirect(GLintptr indirect)
-{
- d_4_3_Core->f.DispatchComputeIndirect(indirect);
-}
-
-inline void QOpenGLFunctions_4_5_Compatibility::glDispatchCompute(GLuint num_groups_x, GLuint num_groups_y, GLuint num_groups_z)
-{
- d_4_3_Core->f.DispatchCompute(num_groups_x, num_groups_y, num_groups_z);
-}
-
-inline void QOpenGLFunctions_4_5_Compatibility::glClearBufferSubData(GLenum target, GLenum internalformat, GLintptr offset, GLsizeiptr size, GLenum format, GLenum type, const void *data)
-{
- d_4_3_Core->f.ClearBufferSubData(target, internalformat, offset, size, format, type, data);
-}
-
-inline void QOpenGLFunctions_4_5_Compatibility::glClearBufferData(GLenum target, GLenum internalformat, GLenum format, GLenum type, const void *data)
-{
- d_4_3_Core->f.ClearBufferData(target, internalformat, format, type, data);
-}
-
-
-// OpenGL 4.4 core functions
-inline void QOpenGLFunctions_4_5_Compatibility::glBindVertexBuffers(GLuint first, GLsizei count, const GLuint *buffers, const GLintptr *offsets, const GLsizei *strides)
-{
- d_4_4_Core->f.BindVertexBuffers(first, count, buffers, offsets, strides);
-}
-
-inline void QOpenGLFunctions_4_5_Compatibility::glBindImageTextures(GLuint first, GLsizei count, const GLuint *textures)
-{
- d_4_4_Core->f.BindImageTextures(first, count, textures);
-}
-
-inline void QOpenGLFunctions_4_5_Compatibility::glBindSamplers(GLuint first, GLsizei count, const GLuint *samplers)
-{
- d_4_4_Core->f.BindSamplers(first, count, samplers);
-}
-
-inline void QOpenGLFunctions_4_5_Compatibility::glBindTextures(GLuint first, GLsizei count, const GLuint *textures)
-{
- d_4_4_Core->f.BindTextures(first, count, textures);
-}
-
-inline void QOpenGLFunctions_4_5_Compatibility::glBindBuffersRange(GLenum target, GLuint first, GLsizei count, const GLuint *buffers, const GLintptr *offsets, const GLsizeiptr *sizes)
-{
- d_4_4_Core->f.BindBuffersRange(target, first, count, buffers, offsets, sizes);
-}
-
-inline void QOpenGLFunctions_4_5_Compatibility::glBindBuffersBase(GLenum target, GLuint first, GLsizei count, const GLuint *buffers)
-{
- d_4_4_Core->f.BindBuffersBase(target, first, count, buffers);
-}
-
-inline void QOpenGLFunctions_4_5_Compatibility::glClearTexSubImage(GLuint texture, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLenum type, const void *data)
-{
- d_4_4_Core->f.ClearTexSubImage(texture, level, xoffset, yoffset, zoffset, width, height, depth, format, type, data);
-}
-
-inline void QOpenGLFunctions_4_5_Compatibility::glClearTexImage(GLuint texture, GLint level, GLenum format, GLenum type, const void *data)
-{
- d_4_4_Core->f.ClearTexImage(texture, level, format, type, data);
-}
-
-inline void QOpenGLFunctions_4_5_Compatibility::glBufferStorage(GLenum target, GLsizeiptr size, const void *data, GLbitfield flags)
-{
- d_4_4_Core->f.BufferStorage(target, size, data, flags);
-}
-
-
-// OpenGL 4.5 core functions
-inline void QOpenGLFunctions_4_5_Compatibility::glTextureBarrier()
-{
- d_4_5_Core->f.TextureBarrier();
-}
-
-inline void QOpenGLFunctions_4_5_Compatibility::glReadnPixels(GLint x, GLint y, GLsizei width, GLsizei height, GLenum format, GLenum type, GLsizei bufSize, void *data)
-{
- d_4_5_Core->f.ReadnPixels(x, y, width, height, format, type, bufSize, data);
-}
-
-inline void QOpenGLFunctions_4_5_Compatibility::glGetnUniformuiv(GLuint program, GLint location, GLsizei bufSize, GLuint *params)
-{
- d_4_5_Core->f.GetnUniformuiv(program, location, bufSize, params);
-}
-
-inline void QOpenGLFunctions_4_5_Compatibility::glGetnUniformiv(GLuint program, GLint location, GLsizei bufSize, GLint *params)
-{
- d_4_5_Core->f.GetnUniformiv(program, location, bufSize, params);
-}
-
-inline void QOpenGLFunctions_4_5_Compatibility::glGetnUniformfv(GLuint program, GLint location, GLsizei bufSize, GLfloat *params)
-{
- d_4_5_Core->f.GetnUniformfv(program, location, bufSize, params);
-}
-
-inline void QOpenGLFunctions_4_5_Compatibility::glGetnUniformdv(GLuint program, GLint location, GLsizei bufSize, GLdouble *params)
-{
- d_4_5_Core->f.GetnUniformdv(program, location, bufSize, params);
-}
-
-inline void QOpenGLFunctions_4_5_Compatibility::glGetnTexImage(GLenum target, GLint level, GLenum format, GLenum type, GLsizei bufSize, void *pixels)
-{
- d_4_5_Core->f.GetnTexImage(target, level, format, type, bufSize, pixels);
-}
-
-inline void QOpenGLFunctions_4_5_Compatibility::glGetnCompressedTexImage(GLenum target, GLint lod, GLsizei bufSize, void *pixels)
-{
- d_4_5_Core->f.GetnCompressedTexImage(target, lod, bufSize, pixels);
-}
-
-inline GLenum QOpenGLFunctions_4_5_Compatibility::glGetGraphicsResetStatus()
-{
- return d_4_5_Core->f.GetGraphicsResetStatus();
-}
-
-inline void QOpenGLFunctions_4_5_Compatibility::glGetCompressedTextureSubImage(GLuint texture, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLsizei bufSize, void *pixels)
-{
- d_4_5_Core->f.GetCompressedTextureSubImage(texture, level, xoffset, yoffset, zoffset, width, height, depth, bufSize, pixels);
-}
-
-inline void QOpenGLFunctions_4_5_Compatibility::glGetTextureSubImage(GLuint texture, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLenum type, GLsizei bufSize, void *pixels)
-{
- d_4_5_Core->f.GetTextureSubImage(texture, level, xoffset, yoffset, zoffset, width, height, depth, format, type, bufSize, pixels);
-}
-
-inline void QOpenGLFunctions_4_5_Compatibility::glMemoryBarrierByRegion(GLbitfield barriers)
-{
- d_4_5_Core->f.MemoryBarrierByRegion(barriers);
-}
-
-inline void QOpenGLFunctions_4_5_Compatibility::glCreateQueries(GLenum target, GLsizei n, GLuint *ids)
-{
- d_4_5_Core->f.CreateQueries(target, n, ids);
-}
-
-inline void QOpenGLFunctions_4_5_Compatibility::glCreateProgramPipelines(GLsizei n, GLuint *pipelines)
-{
- d_4_5_Core->f.CreateProgramPipelines(n, pipelines);
-}
-
-inline void QOpenGLFunctions_4_5_Compatibility::glCreateSamplers(GLsizei n, GLuint *samplers)
-{
- d_4_5_Core->f.CreateSamplers(n, samplers);
-}
-
-inline void QOpenGLFunctions_4_5_Compatibility::glGetVertexArrayIndexed64iv(GLuint vaobj, GLuint index, GLenum pname, GLint64 *param)
-{
- d_4_5_Core->f.GetVertexArrayIndexed64iv(vaobj, index, pname, param);
-}
-
-inline void QOpenGLFunctions_4_5_Compatibility::glGetVertexArrayIndexediv(GLuint vaobj, GLuint index, GLenum pname, GLint *param)
-{
- d_4_5_Core->f.GetVertexArrayIndexediv(vaobj, index, pname, param);
-}
-
-inline void QOpenGLFunctions_4_5_Compatibility::glGetVertexArrayiv(GLuint vaobj, GLenum pname, GLint *param)
-{
- d_4_5_Core->f.GetVertexArrayiv(vaobj, pname, param);
-}
-
-inline void QOpenGLFunctions_4_5_Compatibility::glVertexArrayBindingDivisor(GLuint vaobj, GLuint bindingindex, GLuint divisor)
-{
- d_4_5_Core->f.VertexArrayBindingDivisor(vaobj, bindingindex, divisor);
-}
-
-inline void QOpenGLFunctions_4_5_Compatibility::glVertexArrayAttribLFormat(GLuint vaobj, GLuint attribindex, GLint size, GLenum type, GLuint relativeoffset)
-{
- d_4_5_Core->f.VertexArrayAttribLFormat(vaobj, attribindex, size, type, relativeoffset);
-}
-
-inline void QOpenGLFunctions_4_5_Compatibility::glVertexArrayAttribIFormat(GLuint vaobj, GLuint attribindex, GLint size, GLenum type, GLuint relativeoffset)
-{
- d_4_5_Core->f.VertexArrayAttribIFormat(vaobj, attribindex, size, type, relativeoffset);
-}
-
-inline void QOpenGLFunctions_4_5_Compatibility::glVertexArrayAttribFormat(GLuint vaobj, GLuint attribindex, GLint size, GLenum type, GLboolean normalized, GLuint relativeoffset)
-{
- d_4_5_Core->f.VertexArrayAttribFormat(vaobj, attribindex, size, type, normalized, relativeoffset);
-}
-
-inline void QOpenGLFunctions_4_5_Compatibility::glVertexArrayAttribBinding(GLuint vaobj, GLuint attribindex, GLuint bindingindex)
-{
- d_4_5_Core->f.VertexArrayAttribBinding(vaobj, attribindex, bindingindex);
-}
-
-inline void QOpenGLFunctions_4_5_Compatibility::glVertexArrayVertexBuffers(GLuint vaobj, GLuint first, GLsizei count, const GLuint *buffers, const GLintptr *offsets, const GLsizei *strides)
-{
- d_4_5_Core->f.VertexArrayVertexBuffers(vaobj, first, count, buffers, offsets, strides);
-}
-
-inline void QOpenGLFunctions_4_5_Compatibility::glVertexArrayVertexBuffer(GLuint vaobj, GLuint bindingindex, GLuint buffer, GLintptr offset, GLsizei stride)
-{
- d_4_5_Core->f.VertexArrayVertexBuffer(vaobj, bindingindex, buffer, offset, stride);
-}
-
-inline void QOpenGLFunctions_4_5_Compatibility::glVertexArrayElementBuffer(GLuint vaobj, GLuint buffer)
-{
- d_4_5_Core->f.VertexArrayElementBuffer(vaobj, buffer);
-}
-
-inline void QOpenGLFunctions_4_5_Compatibility::glEnableVertexArrayAttrib(GLuint vaobj, GLuint index)
-{
- d_4_5_Core->f.EnableVertexArrayAttrib(vaobj, index);
-}
-
-inline void QOpenGLFunctions_4_5_Compatibility::glDisableVertexArrayAttrib(GLuint vaobj, GLuint index)
-{
- d_4_5_Core->f.DisableVertexArrayAttrib(vaobj, index);
-}
-
-inline void QOpenGLFunctions_4_5_Compatibility::glCreateVertexArrays(GLsizei n, GLuint *arrays)
-{
- d_4_5_Core->f.CreateVertexArrays(n, arrays);
-}
-
-inline void QOpenGLFunctions_4_5_Compatibility::glGetTextureParameteriv(GLuint texture, GLenum pname, GLint *params)
-{
- d_4_5_Core->f.GetTextureParameteriv(texture, pname, params);
-}
-
-inline void QOpenGLFunctions_4_5_Compatibility::glGetTextureParameterIuiv(GLuint texture, GLenum pname, GLuint *params)
-{
- d_4_5_Core->f.GetTextureParameterIuiv(texture, pname, params);
-}
-
-inline void QOpenGLFunctions_4_5_Compatibility::glGetTextureParameterIiv(GLuint texture, GLenum pname, GLint *params)
-{
- d_4_5_Core->f.GetTextureParameterIiv(texture, pname, params);
-}
-
-inline void QOpenGLFunctions_4_5_Compatibility::glGetTextureParameterfv(GLuint texture, GLenum pname, GLfloat *params)
-{
- d_4_5_Core->f.GetTextureParameterfv(texture, pname, params);
-}
-
-inline void QOpenGLFunctions_4_5_Compatibility::glGetTextureLevelParameteriv(GLuint texture, GLint level, GLenum pname, GLint *params)
-{
- d_4_5_Core->f.GetTextureLevelParameteriv(texture, level, pname, params);
-}
-
-inline void QOpenGLFunctions_4_5_Compatibility::glGetTextureLevelParameterfv(GLuint texture, GLint level, GLenum pname, GLfloat *params)
-{
- d_4_5_Core->f.GetTextureLevelParameterfv(texture, level, pname, params);
-}
-
-inline void QOpenGLFunctions_4_5_Compatibility::glGetCompressedTextureImage(GLuint texture, GLint level, GLsizei bufSize, void *pixels)
-{
- d_4_5_Core->f.GetCompressedTextureImage(texture, level, bufSize, pixels);
-}
-
-inline void QOpenGLFunctions_4_5_Compatibility::glGetTextureImage(GLuint texture, GLint level, GLenum format, GLenum type, GLsizei bufSize, void *pixels)
-{
- d_4_5_Core->f.GetTextureImage(texture, level, format, type, bufSize, pixels);
-}
-
-inline void QOpenGLFunctions_4_5_Compatibility::glBindTextureUnit(GLuint unit, GLuint texture)
-{
- d_4_5_Core->f.BindTextureUnit(unit, texture);
-}
-
-inline void QOpenGLFunctions_4_5_Compatibility::glGenerateTextureMipmap(GLuint texture)
-{
- d_4_5_Core->f.GenerateTextureMipmap(texture);
-}
-
-inline void QOpenGLFunctions_4_5_Compatibility::glTextureParameteriv(GLuint texture, GLenum pname, const GLint *param)
-{
- d_4_5_Core->f.TextureParameteriv(texture, pname, param);
-}
-
-inline void QOpenGLFunctions_4_5_Compatibility::glTextureParameterIuiv(GLuint texture, GLenum pname, const GLuint *params)
-{
- d_4_5_Core->f.TextureParameterIuiv(texture, pname, params);
-}
-
-inline void QOpenGLFunctions_4_5_Compatibility::glTextureParameterIiv(GLuint texture, GLenum pname, const GLint *params)
-{
- d_4_5_Core->f.TextureParameterIiv(texture, pname, params);
-}
-
-inline void QOpenGLFunctions_4_5_Compatibility::glTextureParameteri(GLuint texture, GLenum pname, GLint param)
-{
- d_4_5_Core->f.TextureParameteri(texture, pname, param);
-}
-
-inline void QOpenGLFunctions_4_5_Compatibility::glTextureParameterfv(GLuint texture, GLenum pname, const GLfloat *param)
-{
- d_4_5_Core->f.TextureParameterfv(texture, pname, param);
-}
-
-inline void QOpenGLFunctions_4_5_Compatibility::glTextureParameterf(GLuint texture, GLenum pname, GLfloat param)
-{
- d_4_5_Core->f.TextureParameterf(texture, pname, param);
-}
-
-inline void QOpenGLFunctions_4_5_Compatibility::glCopyTextureSubImage3D(GLuint texture, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLint x, GLint y, GLsizei width, GLsizei height)
-{
- d_4_5_Core->f.CopyTextureSubImage3D(texture, level, xoffset, yoffset, zoffset, x, y, width, height);
-}
-
-inline void QOpenGLFunctions_4_5_Compatibility::glCopyTextureSubImage2D(GLuint texture, GLint level, GLint xoffset, GLint yoffset, GLint x, GLint y, GLsizei width, GLsizei height)
-{
- d_4_5_Core->f.CopyTextureSubImage2D(texture, level, xoffset, yoffset, x, y, width, height);
-}
-
-inline void QOpenGLFunctions_4_5_Compatibility::glCopyTextureSubImage1D(GLuint texture, GLint level, GLint xoffset, GLint x, GLint y, GLsizei width)
-{
- d_4_5_Core->f.CopyTextureSubImage1D(texture, level, xoffset, x, y, width);
-}
-
-inline void QOpenGLFunctions_4_5_Compatibility::glCompressedTextureSubImage3D(GLuint texture, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLsizei imageSize, const void *data)
-{
- d_4_5_Core->f.CompressedTextureSubImage3D(texture, level, xoffset, yoffset, zoffset, width, height, depth, format, imageSize, data);
-}
-
-inline void QOpenGLFunctions_4_5_Compatibility::glCompressedTextureSubImage2D(GLuint texture, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLsizei imageSize, const void *data)
-{
- d_4_5_Core->f.CompressedTextureSubImage2D(texture, level, xoffset, yoffset, width, height, format, imageSize, data);
-}
-
-inline void QOpenGLFunctions_4_5_Compatibility::glCompressedTextureSubImage1D(GLuint texture, GLint level, GLint xoffset, GLsizei width, GLenum format, GLsizei imageSize, const void *data)
-{
- d_4_5_Core->f.CompressedTextureSubImage1D(texture, level, xoffset, width, format, imageSize, data);
-}
-
-inline void QOpenGLFunctions_4_5_Compatibility::glTextureSubImage3D(GLuint texture, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLenum type, const void *pixels)
-{
- d_4_5_Core->f.TextureSubImage3D(texture, level, xoffset, yoffset, zoffset, width, height, depth, format, type, pixels);
-}
-
-inline void QOpenGLFunctions_4_5_Compatibility::glTextureSubImage2D(GLuint texture, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLenum type, const void *pixels)
-{
- d_4_5_Core->f.TextureSubImage2D(texture, level, xoffset, yoffset, width, height, format, type, pixels);
-}
-
-inline void QOpenGLFunctions_4_5_Compatibility::glTextureSubImage1D(GLuint texture, GLint level, GLint xoffset, GLsizei width, GLenum format, GLenum type, const void *pixels)
-{
- d_4_5_Core->f.TextureSubImage1D(texture, level, xoffset, width, format, type, pixels);
-}
-
-inline void QOpenGLFunctions_4_5_Compatibility::glTextureStorage3DMultisample(GLuint texture, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth, GLboolean fixedsamplelocations)
-{
- d_4_5_Core->f.TextureStorage3DMultisample(texture, samples, internalformat, width, height, depth, fixedsamplelocations);
-}
-
-inline void QOpenGLFunctions_4_5_Compatibility::glTextureStorage2DMultisample(GLuint texture, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height, GLboolean fixedsamplelocations)
-{
- d_4_5_Core->f.TextureStorage2DMultisample(texture, samples, internalformat, width, height, fixedsamplelocations);
-}
-
-inline void QOpenGLFunctions_4_5_Compatibility::glTextureStorage3D(GLuint texture, GLsizei levels, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth)
-{
- d_4_5_Core->f.TextureStorage3D(texture, levels, internalformat, width, height, depth);
-}
-
-inline void QOpenGLFunctions_4_5_Compatibility::glTextureStorage2D(GLuint texture, GLsizei levels, GLenum internalformat, GLsizei width, GLsizei height)
-{
- d_4_5_Core->f.TextureStorage2D(texture, levels, internalformat, width, height);
-}
-
-inline void QOpenGLFunctions_4_5_Compatibility::glTextureStorage1D(GLuint texture, GLsizei levels, GLenum internalformat, GLsizei width)
-{
- d_4_5_Core->f.TextureStorage1D(texture, levels, internalformat, width);
-}
-
-inline void QOpenGLFunctions_4_5_Compatibility::glTextureBufferRange(GLuint texture, GLenum internalformat, GLuint buffer, GLintptr offset, GLsizei size)
-{
- d_4_5_Core->f.TextureBufferRange(texture, internalformat, buffer, offset, size);
-}
-
-inline void QOpenGLFunctions_4_5_Compatibility::glTextureBuffer(GLuint texture, GLenum internalformat, GLuint buffer)
-{
- d_4_5_Core->f.TextureBuffer(texture, internalformat, buffer);
-}
-
-inline void QOpenGLFunctions_4_5_Compatibility::glCreateTextures(GLenum target, GLsizei n, GLuint *textures)
-{
- d_4_5_Core->f.CreateTextures(target, n, textures);
-}
-
-inline void QOpenGLFunctions_4_5_Compatibility::glGetNamedRenderbufferParameteriv(GLuint renderbuffer, GLenum pname, GLint *params)
-{
- d_4_5_Core->f.GetNamedRenderbufferParameteriv(renderbuffer, pname, params);
-}
-
-inline void QOpenGLFunctions_4_5_Compatibility::glNamedRenderbufferStorageMultisample(GLuint renderbuffer, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height)
-{
- d_4_5_Core->f.NamedRenderbufferStorageMultisample(renderbuffer, samples, internalformat, width, height);
-}
-
-inline void QOpenGLFunctions_4_5_Compatibility::glNamedRenderbufferStorage(GLuint renderbuffer, GLenum internalformat, GLsizei width, GLsizei height)
-{
- d_4_5_Core->f.NamedRenderbufferStorage(renderbuffer, internalformat, width, height);
-}
-
-inline void QOpenGLFunctions_4_5_Compatibility::glCreateRenderbuffers(GLsizei n, GLuint *renderbuffers)
-{
- d_4_5_Core->f.CreateRenderbuffers(n, renderbuffers);
-}
-
-inline void QOpenGLFunctions_4_5_Compatibility::glGetNamedFramebufferAttachmentParameteriv(GLuint framebuffer, GLenum attachment, GLenum pname, GLint *params)
-{
- d_4_5_Core->f.GetNamedFramebufferAttachmentParameteriv(framebuffer, attachment, pname, params);
-}
-
-inline void QOpenGLFunctions_4_5_Compatibility::glGetNamedFramebufferParameteriv(GLuint framebuffer, GLenum pname, GLint *param)
-{
- d_4_5_Core->f.GetNamedFramebufferParameteriv(framebuffer, pname, param);
-}
-
-inline GLenum QOpenGLFunctions_4_5_Compatibility::glCheckNamedFramebufferStatus(GLuint framebuffer, GLenum target)
-{
- return d_4_5_Core->f.CheckNamedFramebufferStatus(framebuffer, target);
-}
-
-inline void QOpenGLFunctions_4_5_Compatibility::glBlitNamedFramebuffer(GLuint readFramebuffer, GLuint drawFramebuffer, GLint srcX0, GLint srcY0, GLint srcX1, GLint srcY1, GLint dstX0, GLint dstY0, GLint dstX1, GLint dstY1, GLbitfield mask, GLenum filter)
-{
- d_4_5_Core->f.BlitNamedFramebuffer(readFramebuffer, drawFramebuffer, srcX0, srcY0, srcX1, srcY1, dstX0, dstY0, dstX1, dstY1, mask, filter);
-}
-
-inline void QOpenGLFunctions_4_5_Compatibility::glClearNamedFramebufferfi(GLuint framebuffer, GLenum buffer, GLfloat depth, GLint stencil)
-{
- d_4_5_Core->f.ClearNamedFramebufferfi(framebuffer, buffer, depth, stencil);
-}
-
-inline void QOpenGLFunctions_4_5_Compatibility::glClearNamedFramebufferfv(GLuint framebuffer, GLenum buffer, GLint drawbuffer, const GLfloat *value)
-{
- d_4_5_Core->f.ClearNamedFramebufferfv(framebuffer, buffer, drawbuffer, value);
-}
-
-inline void QOpenGLFunctions_4_5_Compatibility::glClearNamedFramebufferuiv(GLuint framebuffer, GLenum buffer, GLint drawbuffer, const GLuint *value)
-{
- d_4_5_Core->f.ClearNamedFramebufferuiv(framebuffer, buffer, drawbuffer, value);
-}
-
-inline void QOpenGLFunctions_4_5_Compatibility::glClearNamedFramebufferiv(GLuint framebuffer, GLenum buffer, GLint drawbuffer, const GLint *value)
-{
- d_4_5_Core->f.ClearNamedFramebufferiv(framebuffer, buffer, drawbuffer, value);
-}
-
-inline void QOpenGLFunctions_4_5_Compatibility::glInvalidateNamedFramebufferSubData(GLuint framebuffer, GLsizei numAttachments, const GLenum *attachments, GLint x, GLint y, GLsizei width, GLsizei height)
-{
- d_4_5_Core->f.InvalidateNamedFramebufferSubData(framebuffer, numAttachments, attachments, x, y, width, height);
-}
-
-inline void QOpenGLFunctions_4_5_Compatibility::glInvalidateNamedFramebufferData(GLuint framebuffer, GLsizei numAttachments, const GLenum *attachments)
-{
- d_4_5_Core->f.InvalidateNamedFramebufferData(framebuffer, numAttachments, attachments);
-}
-
-inline void QOpenGLFunctions_4_5_Compatibility::glNamedFramebufferReadBuffer(GLuint framebuffer, GLenum src)
-{
- d_4_5_Core->f.NamedFramebufferReadBuffer(framebuffer, src);
-}
-
-inline void QOpenGLFunctions_4_5_Compatibility::glNamedFramebufferDrawBuffers(GLuint framebuffer, GLsizei n, const GLenum *bufs)
-{
- d_4_5_Core->f.NamedFramebufferDrawBuffers(framebuffer, n, bufs);
-}
-
-inline void QOpenGLFunctions_4_5_Compatibility::glNamedFramebufferDrawBuffer(GLuint framebuffer, GLenum buf)
-{
- d_4_5_Core->f.NamedFramebufferDrawBuffer(framebuffer, buf);
-}
-
-inline void QOpenGLFunctions_4_5_Compatibility::glNamedFramebufferTextureLayer(GLuint framebuffer, GLenum attachment, GLuint texture, GLint level, GLint layer)
-{
- d_4_5_Core->f.NamedFramebufferTextureLayer(framebuffer, attachment, texture, level, layer);
-}
-
-inline void QOpenGLFunctions_4_5_Compatibility::glNamedFramebufferTexture(GLuint framebuffer, GLenum attachment, GLuint texture, GLint level)
-{
- d_4_5_Core->f.NamedFramebufferTexture(framebuffer, attachment, texture, level);
-}
-
-inline void QOpenGLFunctions_4_5_Compatibility::glNamedFramebufferParameteri(GLuint framebuffer, GLenum pname, GLint param)
-{
- d_4_5_Core->f.NamedFramebufferParameteri(framebuffer, pname, param);
-}
-
-inline void QOpenGLFunctions_4_5_Compatibility::glNamedFramebufferRenderbuffer(GLuint framebuffer, GLenum attachment, GLenum renderbuffertarget, GLuint renderbuffer)
-{
- d_4_5_Core->f.NamedFramebufferRenderbuffer(framebuffer, attachment, renderbuffertarget, renderbuffer);
-}
-
-inline void QOpenGLFunctions_4_5_Compatibility::glCreateFramebuffers(GLsizei n, GLuint *framebuffers)
-{
- d_4_5_Core->f.CreateFramebuffers(n, framebuffers);
-}
-
-inline void QOpenGLFunctions_4_5_Compatibility::glGetNamedBufferSubData(GLuint buffer, GLintptr offset, GLsizei size, void *data)
-{
- d_4_5_Core->f.GetNamedBufferSubData(buffer, offset, size, data);
-}
-
-inline void QOpenGLFunctions_4_5_Compatibility::glGetNamedBufferPointerv(GLuint buffer, GLenum pname, void * *params)
-{
- d_4_5_Core->f.GetNamedBufferPointerv(buffer, pname, params);
-}
-
-inline void QOpenGLFunctions_4_5_Compatibility::glGetNamedBufferParameteri64v(GLuint buffer, GLenum pname, GLint64 *params)
-{
- d_4_5_Core->f.GetNamedBufferParameteri64v(buffer, pname, params);
-}
-
-inline void QOpenGLFunctions_4_5_Compatibility::glGetNamedBufferParameteriv(GLuint buffer, GLenum pname, GLint *params)
-{
- d_4_5_Core->f.GetNamedBufferParameteriv(buffer, pname, params);
-}
-
-inline void QOpenGLFunctions_4_5_Compatibility::glFlushMappedNamedBufferRange(GLuint buffer, GLintptr offset, GLsizei length)
-{
- d_4_5_Core->f.FlushMappedNamedBufferRange(buffer, offset, length);
-}
-
-inline GLboolean QOpenGLFunctions_4_5_Compatibility::glUnmapNamedBuffer(GLuint buffer)
-{
- return d_4_5_Core->f.UnmapNamedBuffer(buffer);
-}
-
-inline void * QOpenGLFunctions_4_5_Compatibility::glMapNamedBufferRange(GLuint buffer, GLintptr offset, GLsizei length, GLbitfield access)
-{
- return d_4_5_Core->f.MapNamedBufferRange(buffer, offset, length, access);
-}
-
-inline void * QOpenGLFunctions_4_5_Compatibility::glMapNamedBuffer(GLuint buffer, GLenum access)
-{
- return d_4_5_Core->f.MapNamedBuffer(buffer, access);
-}
-
-inline void QOpenGLFunctions_4_5_Compatibility::glClearNamedBufferSubData(GLuint buffer, GLenum internalformat, GLintptr offset, GLsizei size, GLenum format, GLenum type, const void *data)
-{
- d_4_5_Core->f.ClearNamedBufferSubData(buffer, internalformat, offset, size, format, type, data);
-}
-
-inline void QOpenGLFunctions_4_5_Compatibility::glClearNamedBufferData(GLuint buffer, GLenum internalformat, GLenum format, GLenum type, const void *data)
-{
- d_4_5_Core->f.ClearNamedBufferData(buffer, internalformat, format, type, data);
-}
-
-inline void QOpenGLFunctions_4_5_Compatibility::glCopyNamedBufferSubData(GLuint readBuffer, GLuint writeBuffer, GLintptr readOffset, GLintptr writeOffset, GLsizei size)
-{
- d_4_5_Core->f.CopyNamedBufferSubData(readBuffer, writeBuffer, readOffset, writeOffset, size);
-}
-
-inline void QOpenGLFunctions_4_5_Compatibility::glNamedBufferSubData(GLuint buffer, GLintptr offset, GLsizei size, const void *data)
-{
- d_4_5_Core->f.NamedBufferSubData(buffer, offset, size, data);
-}
-
-inline void QOpenGLFunctions_4_5_Compatibility::glNamedBufferData(GLuint buffer, GLsizei size, const void *data, GLenum usage)
-{
- d_4_5_Core->f.NamedBufferData(buffer, size, data, usage);
-}
-
-inline void QOpenGLFunctions_4_5_Compatibility::glNamedBufferStorage(GLuint buffer, GLsizei size, const void *data, GLbitfield flags)
-{
- d_4_5_Core->f.NamedBufferStorage(buffer, size, data, flags);
-}
-
-inline void QOpenGLFunctions_4_5_Compatibility::glCreateBuffers(GLsizei n, GLuint *buffers)
-{
- d_4_5_Core->f.CreateBuffers(n, buffers);
-}
-
-inline void QOpenGLFunctions_4_5_Compatibility::glGetTransformFeedbacki64_v(GLuint xfb, GLenum pname, GLuint index, GLint64 *param)
-{
- d_4_5_Core->f.GetTransformFeedbacki64_v(xfb, pname, index, param);
-}
-
-inline void QOpenGLFunctions_4_5_Compatibility::glGetTransformFeedbacki_v(GLuint xfb, GLenum pname, GLuint index, GLint *param)
-{
- d_4_5_Core->f.GetTransformFeedbacki_v(xfb, pname, index, param);
-}
-
-inline void QOpenGLFunctions_4_5_Compatibility::glGetTransformFeedbackiv(GLuint xfb, GLenum pname, GLint *param)
-{
- d_4_5_Core->f.GetTransformFeedbackiv(xfb, pname, param);
-}
-
-inline void QOpenGLFunctions_4_5_Compatibility::glTransformFeedbackBufferRange(GLuint xfb, GLuint index, GLuint buffer, GLintptr offset, GLsizei size)
-{
- d_4_5_Core->f.TransformFeedbackBufferRange(xfb, index, buffer, offset, size);
-}
-
-inline void QOpenGLFunctions_4_5_Compatibility::glTransformFeedbackBufferBase(GLuint xfb, GLuint index, GLuint buffer)
-{
- d_4_5_Core->f.TransformFeedbackBufferBase(xfb, index, buffer);
-}
-
-inline void QOpenGLFunctions_4_5_Compatibility::glCreateTransformFeedbacks(GLsizei n, GLuint *ids)
-{
- d_4_5_Core->f.CreateTransformFeedbacks(n, ids);
-}
-
-inline void QOpenGLFunctions_4_5_Compatibility::glClipControl(GLenum origin, GLenum depth)
-{
- d_4_5_Core->f.ClipControl(origin, depth);
-}
-
-
-// OpenGL 1.0 deprecated functions
-inline void QOpenGLFunctions_4_5_Compatibility::glTranslatef(GLfloat x, GLfloat y, GLfloat z)
-{
- d_1_0_Deprecated->f.Translatef(x, y, z);
-}
-
-inline void QOpenGLFunctions_4_5_Compatibility::glTranslated(GLdouble x, GLdouble y, GLdouble z)
-{
- d_1_0_Deprecated->f.Translated(x, y, z);
-}
-
-inline void QOpenGLFunctions_4_5_Compatibility::glScalef(GLfloat x, GLfloat y, GLfloat z)
-{
- d_1_0_Deprecated->f.Scalef(x, y, z);
-}
-
-inline void QOpenGLFunctions_4_5_Compatibility::glScaled(GLdouble x, GLdouble y, GLdouble z)
-{
- d_1_0_Deprecated->f.Scaled(x, y, z);
-}
-
-inline void QOpenGLFunctions_4_5_Compatibility::glRotatef(GLfloat angle, GLfloat x, GLfloat y, GLfloat z)
-{
- d_1_0_Deprecated->f.Rotatef(angle, x, y, z);
-}
-
-inline void QOpenGLFunctions_4_5_Compatibility::glRotated(GLdouble angle, GLdouble x, GLdouble y, GLdouble z)
-{
- d_1_0_Deprecated->f.Rotated(angle, x, y, z);
-}
-
-inline void QOpenGLFunctions_4_5_Compatibility::glPushMatrix()
-{
- d_1_0_Deprecated->f.PushMatrix();
-}
-
-inline void QOpenGLFunctions_4_5_Compatibility::glPopMatrix()
-{
- d_1_0_Deprecated->f.PopMatrix();
-}
-
-inline void QOpenGLFunctions_4_5_Compatibility::glOrtho(GLdouble left, GLdouble right, GLdouble bottom, GLdouble top, GLdouble zNear, GLdouble zFar)
-{
- d_1_0_Deprecated->f.Ortho(left, right, bottom, top, zNear, zFar);
-}
-
-inline void QOpenGLFunctions_4_5_Compatibility::glMultMatrixd(const GLdouble *m)
-{
- d_1_0_Deprecated->f.MultMatrixd(m);
-}
-
-inline void QOpenGLFunctions_4_5_Compatibility::glMultMatrixf(const GLfloat *m)
-{
- d_1_0_Deprecated->f.MultMatrixf(m);
-}
-
-inline void QOpenGLFunctions_4_5_Compatibility::glMatrixMode(GLenum mode)
-{
- d_1_0_Deprecated->f.MatrixMode(mode);
-}
-
-inline void QOpenGLFunctions_4_5_Compatibility::glLoadMatrixd(const GLdouble *m)
-{
- d_1_0_Deprecated->f.LoadMatrixd(m);
-}
-
-inline void QOpenGLFunctions_4_5_Compatibility::glLoadMatrixf(const GLfloat *m)
-{
- d_1_0_Deprecated->f.LoadMatrixf(m);
-}
-
-inline void QOpenGLFunctions_4_5_Compatibility::glLoadIdentity()
-{
- d_1_0_Deprecated->f.LoadIdentity();
-}
-
-inline void QOpenGLFunctions_4_5_Compatibility::glFrustum(GLdouble left, GLdouble right, GLdouble bottom, GLdouble top, GLdouble zNear, GLdouble zFar)
-{
- d_1_0_Deprecated->f.Frustum(left, right, bottom, top, zNear, zFar);
-}
-
-inline GLboolean QOpenGLFunctions_4_5_Compatibility::glIsList(GLuint list)
-{
- return d_1_0_Deprecated->f.IsList(list);
-}
-
-inline void QOpenGLFunctions_4_5_Compatibility::glGetTexGeniv(GLenum coord, GLenum pname, GLint *params)
-{
- d_1_0_Deprecated->f.GetTexGeniv(coord, pname, params);
-}
-
-inline void QOpenGLFunctions_4_5_Compatibility::glGetTexGenfv(GLenum coord, GLenum pname, GLfloat *params)
-{
- d_1_0_Deprecated->f.GetTexGenfv(coord, pname, params);
-}
-
-inline void QOpenGLFunctions_4_5_Compatibility::glGetTexGendv(GLenum coord, GLenum pname, GLdouble *params)
-{
- d_1_0_Deprecated->f.GetTexGendv(coord, pname, params);
-}
-
-inline void QOpenGLFunctions_4_5_Compatibility::glGetTexEnviv(GLenum target, GLenum pname, GLint *params)
-{
- d_1_0_Deprecated->f.GetTexEnviv(target, pname, params);
-}
-
-inline void QOpenGLFunctions_4_5_Compatibility::glGetTexEnvfv(GLenum target, GLenum pname, GLfloat *params)
-{
- d_1_0_Deprecated->f.GetTexEnvfv(target, pname, params);
-}
-
-inline void QOpenGLFunctions_4_5_Compatibility::glGetPolygonStipple(GLubyte *mask)
-{
- d_1_0_Deprecated->f.GetPolygonStipple(mask);
-}
-
-inline void QOpenGLFunctions_4_5_Compatibility::glGetPixelMapusv(GLenum map, GLushort *values)
-{
- d_1_0_Deprecated->f.GetPixelMapusv(map, values);
-}
-
-inline void QOpenGLFunctions_4_5_Compatibility::glGetPixelMapuiv(GLenum map, GLuint *values)
-{
- d_1_0_Deprecated->f.GetPixelMapuiv(map, values);
-}
-
-inline void QOpenGLFunctions_4_5_Compatibility::glGetPixelMapfv(GLenum map, GLfloat *values)
-{
- d_1_0_Deprecated->f.GetPixelMapfv(map, values);
-}
-
-inline void QOpenGLFunctions_4_5_Compatibility::glGetMaterialiv(GLenum face, GLenum pname, GLint *params)
-{
- d_1_0_Deprecated->f.GetMaterialiv(face, pname, params);
-}
-
-inline void QOpenGLFunctions_4_5_Compatibility::glGetMaterialfv(GLenum face, GLenum pname, GLfloat *params)
-{
- d_1_0_Deprecated->f.GetMaterialfv(face, pname, params);
-}
-
-inline void QOpenGLFunctions_4_5_Compatibility::glGetMapiv(GLenum target, GLenum query, GLint *v)
-{
- d_1_0_Deprecated->f.GetMapiv(target, query, v);
-}
-
-inline void QOpenGLFunctions_4_5_Compatibility::glGetMapfv(GLenum target, GLenum query, GLfloat *v)
-{
- d_1_0_Deprecated->f.GetMapfv(target, query, v);
-}
-
-inline void QOpenGLFunctions_4_5_Compatibility::glGetMapdv(GLenum target, GLenum query, GLdouble *v)
-{
- d_1_0_Deprecated->f.GetMapdv(target, query, v);
-}
-
-inline void QOpenGLFunctions_4_5_Compatibility::glGetLightiv(GLenum light, GLenum pname, GLint *params)
-{
- d_1_0_Deprecated->f.GetLightiv(light, pname, params);
-}
-
-inline void QOpenGLFunctions_4_5_Compatibility::glGetLightfv(GLenum light, GLenum pname, GLfloat *params)
-{
- d_1_0_Deprecated->f.GetLightfv(light, pname, params);
-}
-
-inline void QOpenGLFunctions_4_5_Compatibility::glGetClipPlane(GLenum plane, GLdouble *equation)
-{
- d_1_0_Deprecated->f.GetClipPlane(plane, equation);
-}
-
-inline void QOpenGLFunctions_4_5_Compatibility::glDrawPixels(GLsizei width, GLsizei height, GLenum format, GLenum type, const void *pixels)
-{
- d_1_0_Deprecated->f.DrawPixels(width, height, format, type, pixels);
-}
-
-inline void QOpenGLFunctions_4_5_Compatibility::glCopyPixels(GLint x, GLint y, GLsizei width, GLsizei height, GLenum type)
-{
- d_1_0_Deprecated->f.CopyPixels(x, y, width, height, type);
-}
-
-inline void QOpenGLFunctions_4_5_Compatibility::glPixelMapusv(GLenum map, GLsizei mapsize, const GLushort *values)
-{
- d_1_0_Deprecated->f.PixelMapusv(map, mapsize, values);
-}
-
-inline void QOpenGLFunctions_4_5_Compatibility::glPixelMapuiv(GLenum map, GLsizei mapsize, const GLuint *values)
-{
- d_1_0_Deprecated->f.PixelMapuiv(map, mapsize, values);
-}
-
-inline void QOpenGLFunctions_4_5_Compatibility::glPixelMapfv(GLenum map, GLsizei mapsize, const GLfloat *values)
-{
- d_1_0_Deprecated->f.PixelMapfv(map, mapsize, values);
-}
-
-inline void QOpenGLFunctions_4_5_Compatibility::glPixelTransferi(GLenum pname, GLint param)
-{
- d_1_0_Deprecated->f.PixelTransferi(pname, param);
-}
-
-inline void QOpenGLFunctions_4_5_Compatibility::glPixelTransferf(GLenum pname, GLfloat param)
-{
- d_1_0_Deprecated->f.PixelTransferf(pname, param);
-}
-
-inline void QOpenGLFunctions_4_5_Compatibility::glPixelZoom(GLfloat xfactor, GLfloat yfactor)
-{
- d_1_0_Deprecated->f.PixelZoom(xfactor, yfactor);
-}
-
-inline void QOpenGLFunctions_4_5_Compatibility::glAlphaFunc(GLenum func, GLfloat ref)
-{
- d_1_0_Deprecated->f.AlphaFunc(func, ref);
-}
-
-inline void QOpenGLFunctions_4_5_Compatibility::glEvalPoint2(GLint i, GLint j)
-{
- d_1_0_Deprecated->f.EvalPoint2(i, j);
-}
-
-inline void QOpenGLFunctions_4_5_Compatibility::glEvalMesh2(GLenum mode, GLint i1, GLint i2, GLint j1, GLint j2)
-{
- d_1_0_Deprecated->f.EvalMesh2(mode, i1, i2, j1, j2);
-}
-
-inline void QOpenGLFunctions_4_5_Compatibility::glEvalPoint1(GLint i)
-{
- d_1_0_Deprecated->f.EvalPoint1(i);
-}
-
-inline void QOpenGLFunctions_4_5_Compatibility::glEvalMesh1(GLenum mode, GLint i1, GLint i2)
-{
- d_1_0_Deprecated->f.EvalMesh1(mode, i1, i2);
-}
-
-inline void QOpenGLFunctions_4_5_Compatibility::glEvalCoord2fv(const GLfloat *u)
-{
- d_1_0_Deprecated->f.EvalCoord2fv(u);
-}
-
-inline void QOpenGLFunctions_4_5_Compatibility::glEvalCoord2f(GLfloat u, GLfloat v)
-{
- d_1_0_Deprecated->f.EvalCoord2f(u, v);
-}
-
-inline void QOpenGLFunctions_4_5_Compatibility::glEvalCoord2dv(const GLdouble *u)
-{
- d_1_0_Deprecated->f.EvalCoord2dv(u);
-}
-
-inline void QOpenGLFunctions_4_5_Compatibility::glEvalCoord2d(GLdouble u, GLdouble v)
-{
- d_1_0_Deprecated->f.EvalCoord2d(u, v);
-}
-
-inline void QOpenGLFunctions_4_5_Compatibility::glEvalCoord1fv(const GLfloat *u)
-{
- d_1_0_Deprecated->f.EvalCoord1fv(u);
-}
-
-inline void QOpenGLFunctions_4_5_Compatibility::glEvalCoord1f(GLfloat u)
-{
- d_1_0_Deprecated->f.EvalCoord1f(u);
-}
-
-inline void QOpenGLFunctions_4_5_Compatibility::glEvalCoord1dv(const GLdouble *u)
-{
- d_1_0_Deprecated->f.EvalCoord1dv(u);
-}
-
-inline void QOpenGLFunctions_4_5_Compatibility::glEvalCoord1d(GLdouble u)
-{
- d_1_0_Deprecated->f.EvalCoord1d(u);
-}
-
-inline void QOpenGLFunctions_4_5_Compatibility::glMapGrid2f(GLint un, GLfloat u1, GLfloat u2, GLint vn, GLfloat v1, GLfloat v2)
-{
- d_1_0_Deprecated->f.MapGrid2f(un, u1, u2, vn, v1, v2);
-}
-
-inline void QOpenGLFunctions_4_5_Compatibility::glMapGrid2d(GLint un, GLdouble u1, GLdouble u2, GLint vn, GLdouble v1, GLdouble v2)
-{
- d_1_0_Deprecated->f.MapGrid2d(un, u1, u2, vn, v1, v2);
-}
-
-inline void QOpenGLFunctions_4_5_Compatibility::glMapGrid1f(GLint un, GLfloat u1, GLfloat u2)
-{
- d_1_0_Deprecated->f.MapGrid1f(un, u1, u2);
-}
-
-inline void QOpenGLFunctions_4_5_Compatibility::glMapGrid1d(GLint un, GLdouble u1, GLdouble u2)
-{
- d_1_0_Deprecated->f.MapGrid1d(un, u1, u2);
-}
-
-inline void QOpenGLFunctions_4_5_Compatibility::glMap2f(GLenum target, GLfloat u1, GLfloat u2, GLint ustride, GLint uorder, GLfloat v1, GLfloat v2, GLint vstride, GLint vorder, const GLfloat *points)
-{
- d_1_0_Deprecated->f.Map2f(target, u1, u2, ustride, uorder, v1, v2, vstride, vorder, points);
-}
-
-inline void QOpenGLFunctions_4_5_Compatibility::glMap2d(GLenum target, GLdouble u1, GLdouble u2, GLint ustride, GLint uorder, GLdouble v1, GLdouble v2, GLint vstride, GLint vorder, const GLdouble *points)
-{
- d_1_0_Deprecated->f.Map2d(target, u1, u2, ustride, uorder, v1, v2, vstride, vorder, points);
-}
-
-inline void QOpenGLFunctions_4_5_Compatibility::glMap1f(GLenum target, GLfloat u1, GLfloat u2, GLint stride, GLint order, const GLfloat *points)
-{
- d_1_0_Deprecated->f.Map1f(target, u1, u2, stride, order, points);
-}
-
-inline void QOpenGLFunctions_4_5_Compatibility::glMap1d(GLenum target, GLdouble u1, GLdouble u2, GLint stride, GLint order, const GLdouble *points)
-{
- d_1_0_Deprecated->f.Map1d(target, u1, u2, stride, order, points);
-}
-
-inline void QOpenGLFunctions_4_5_Compatibility::glPushAttrib(GLbitfield mask)
-{
- d_1_0_Deprecated->f.PushAttrib(mask);
-}
-
-inline void QOpenGLFunctions_4_5_Compatibility::glPopAttrib()
-{
- d_1_0_Deprecated->f.PopAttrib();
-}
-
-inline void QOpenGLFunctions_4_5_Compatibility::glAccum(GLenum op, GLfloat value)
-{
- d_1_0_Deprecated->f.Accum(op, value);
-}
-
-inline void QOpenGLFunctions_4_5_Compatibility::glIndexMask(GLuint mask)
-{
- d_1_0_Deprecated->f.IndexMask(mask);
-}
-
-inline void QOpenGLFunctions_4_5_Compatibility::glClearIndex(GLfloat c)
-{
- d_1_0_Deprecated->f.ClearIndex(c);
-}
-
-inline void QOpenGLFunctions_4_5_Compatibility::glClearAccum(GLfloat red, GLfloat green, GLfloat blue, GLfloat alpha)
-{
- d_1_0_Deprecated->f.ClearAccum(red, green, blue, alpha);
-}
-
-inline void QOpenGLFunctions_4_5_Compatibility::glPushName(GLuint name)
-{
- d_1_0_Deprecated->f.PushName(name);
-}
-
-inline void QOpenGLFunctions_4_5_Compatibility::glPopName()
-{
- d_1_0_Deprecated->f.PopName();
-}
-
-inline void QOpenGLFunctions_4_5_Compatibility::glPassThrough(GLfloat token)
-{
- d_1_0_Deprecated->f.PassThrough(token);
-}
-
-inline void QOpenGLFunctions_4_5_Compatibility::glLoadName(GLuint name)
-{
- d_1_0_Deprecated->f.LoadName(name);
-}
-
-inline void QOpenGLFunctions_4_5_Compatibility::glInitNames()
-{
- d_1_0_Deprecated->f.InitNames();
-}
-
-inline GLint QOpenGLFunctions_4_5_Compatibility::glRenderMode(GLenum mode)
-{
- return d_1_0_Deprecated->f.RenderMode(mode);
-}
-
-inline void QOpenGLFunctions_4_5_Compatibility::glSelectBuffer(GLsizei size, GLuint *buffer)
-{
- d_1_0_Deprecated->f.SelectBuffer(size, buffer);
-}
-
-inline void QOpenGLFunctions_4_5_Compatibility::glFeedbackBuffer(GLsizei size, GLenum type, GLfloat *buffer)
-{
- d_1_0_Deprecated->f.FeedbackBuffer(size, type, buffer);
-}
-
-inline void QOpenGLFunctions_4_5_Compatibility::glTexGeniv(GLenum coord, GLenum pname, const GLint *params)
-{
- d_1_0_Deprecated->f.TexGeniv(coord, pname, params);
-}
-
-inline void QOpenGLFunctions_4_5_Compatibility::glTexGeni(GLenum coord, GLenum pname, GLint param)
-{
- d_1_0_Deprecated->f.TexGeni(coord, pname, param);
-}
-
-inline void QOpenGLFunctions_4_5_Compatibility::glTexGenfv(GLenum coord, GLenum pname, const GLfloat *params)
-{
- d_1_0_Deprecated->f.TexGenfv(coord, pname, params);
-}
-
-inline void QOpenGLFunctions_4_5_Compatibility::glTexGenf(GLenum coord, GLenum pname, GLfloat param)
-{
- d_1_0_Deprecated->f.TexGenf(coord, pname, param);
-}
-
-inline void QOpenGLFunctions_4_5_Compatibility::glTexGendv(GLenum coord, GLenum pname, const GLdouble *params)
-{
- d_1_0_Deprecated->f.TexGendv(coord, pname, params);
-}
-
-inline void QOpenGLFunctions_4_5_Compatibility::glTexGend(GLenum coord, GLenum pname, GLdouble param)
-{
- d_1_0_Deprecated->f.TexGend(coord, pname, param);
-}
-
-inline void QOpenGLFunctions_4_5_Compatibility::glTexEnviv(GLenum target, GLenum pname, const GLint *params)
-{
- d_1_0_Deprecated->f.TexEnviv(target, pname, params);
-}
-
-inline void QOpenGLFunctions_4_5_Compatibility::glTexEnvi(GLenum target, GLenum pname, GLint param)
-{
- d_1_0_Deprecated->f.TexEnvi(target, pname, param);
-}
-
-inline void QOpenGLFunctions_4_5_Compatibility::glTexEnvfv(GLenum target, GLenum pname, const GLfloat *params)
-{
- d_1_0_Deprecated->f.TexEnvfv(target, pname, params);
-}
-
-inline void QOpenGLFunctions_4_5_Compatibility::glTexEnvf(GLenum target, GLenum pname, GLfloat param)
-{
- d_1_0_Deprecated->f.TexEnvf(target, pname, param);
-}
-
-inline void QOpenGLFunctions_4_5_Compatibility::glShadeModel(GLenum mode)
-{
- d_1_0_Deprecated->f.ShadeModel(mode);
-}
-
-inline void QOpenGLFunctions_4_5_Compatibility::glPolygonStipple(const GLubyte *mask)
-{
- d_1_0_Deprecated->f.PolygonStipple(mask);
-}
-
-inline void QOpenGLFunctions_4_5_Compatibility::glMaterialiv(GLenum face, GLenum pname, const GLint *params)
-{
- d_1_0_Deprecated->f.Materialiv(face, pname, params);
-}
-
-inline void QOpenGLFunctions_4_5_Compatibility::glMateriali(GLenum face, GLenum pname, GLint param)
-{
- d_1_0_Deprecated->f.Materiali(face, pname, param);
-}
-
-inline void QOpenGLFunctions_4_5_Compatibility::glMaterialfv(GLenum face, GLenum pname, const GLfloat *params)
-{
- d_1_0_Deprecated->f.Materialfv(face, pname, params);
-}
-
-inline void QOpenGLFunctions_4_5_Compatibility::glMaterialf(GLenum face, GLenum pname, GLfloat param)
-{
- d_1_0_Deprecated->f.Materialf(face, pname, param);
-}
-
-inline void QOpenGLFunctions_4_5_Compatibility::glLineStipple(GLint factor, GLushort pattern)
-{
- d_1_0_Deprecated->f.LineStipple(factor, pattern);
-}
-
-inline void QOpenGLFunctions_4_5_Compatibility::glLightModeliv(GLenum pname, const GLint *params)
-{
- d_1_0_Deprecated->f.LightModeliv(pname, params);
-}
-
-inline void QOpenGLFunctions_4_5_Compatibility::glLightModeli(GLenum pname, GLint param)
-{
- d_1_0_Deprecated->f.LightModeli(pname, param);
-}
-
-inline void QOpenGLFunctions_4_5_Compatibility::glLightModelfv(GLenum pname, const GLfloat *params)
-{
- d_1_0_Deprecated->f.LightModelfv(pname, params);
-}
-
-inline void QOpenGLFunctions_4_5_Compatibility::glLightModelf(GLenum pname, GLfloat param)
-{
- d_1_0_Deprecated->f.LightModelf(pname, param);
-}
-
-inline void QOpenGLFunctions_4_5_Compatibility::glLightiv(GLenum light, GLenum pname, const GLint *params)
-{
- d_1_0_Deprecated->f.Lightiv(light, pname, params);
-}
-
-inline void QOpenGLFunctions_4_5_Compatibility::glLighti(GLenum light, GLenum pname, GLint param)
-{
- d_1_0_Deprecated->f.Lighti(light, pname, param);
-}
-
-inline void QOpenGLFunctions_4_5_Compatibility::glLightfv(GLenum light, GLenum pname, const GLfloat *params)
-{
- d_1_0_Deprecated->f.Lightfv(light, pname, params);
-}
-
-inline void QOpenGLFunctions_4_5_Compatibility::glLightf(GLenum light, GLenum pname, GLfloat param)
-{
- d_1_0_Deprecated->f.Lightf(light, pname, param);
-}
-
-inline void QOpenGLFunctions_4_5_Compatibility::glFogiv(GLenum pname, const GLint *params)
-{
- d_1_0_Deprecated->f.Fogiv(pname, params);
-}
-
-inline void QOpenGLFunctions_4_5_Compatibility::glFogi(GLenum pname, GLint param)
-{
- d_1_0_Deprecated->f.Fogi(pname, param);
-}
-
-inline void QOpenGLFunctions_4_5_Compatibility::glFogfv(GLenum pname, const GLfloat *params)
-{
- d_1_0_Deprecated->f.Fogfv(pname, params);
-}
-
-inline void QOpenGLFunctions_4_5_Compatibility::glFogf(GLenum pname, GLfloat param)
-{
- d_1_0_Deprecated->f.Fogf(pname, param);
-}
-
-inline void QOpenGLFunctions_4_5_Compatibility::glColorMaterial(GLenum face, GLenum mode)
-{
- d_1_0_Deprecated->f.ColorMaterial(face, mode);
-}
-
-inline void QOpenGLFunctions_4_5_Compatibility::glClipPlane(GLenum plane, const GLdouble *equation)
-{
- d_1_0_Deprecated->f.ClipPlane(plane, equation);
-}
-
-inline void QOpenGLFunctions_4_5_Compatibility::glVertex4sv(const GLshort *v)
-{
- d_1_0_Deprecated->f.Vertex4sv(v);
-}
-
-inline void QOpenGLFunctions_4_5_Compatibility::glVertex4s(GLshort x, GLshort y, GLshort z, GLshort w)
-{
- d_1_0_Deprecated->f.Vertex4s(x, y, z, w);
-}
-
-inline void QOpenGLFunctions_4_5_Compatibility::glVertex4iv(const GLint *v)
-{
- d_1_0_Deprecated->f.Vertex4iv(v);
-}
-
-inline void QOpenGLFunctions_4_5_Compatibility::glVertex4i(GLint x, GLint y, GLint z, GLint w)
-{
- d_1_0_Deprecated->f.Vertex4i(x, y, z, w);
-}
-
-inline void QOpenGLFunctions_4_5_Compatibility::glVertex4fv(const GLfloat *v)
-{
- d_1_0_Deprecated->f.Vertex4fv(v);
-}
-
-inline void QOpenGLFunctions_4_5_Compatibility::glVertex4f(GLfloat x, GLfloat y, GLfloat z, GLfloat w)
-{
- d_1_0_Deprecated->f.Vertex4f(x, y, z, w);
-}
-
-inline void QOpenGLFunctions_4_5_Compatibility::glVertex4dv(const GLdouble *v)
-{
- d_1_0_Deprecated->f.Vertex4dv(v);
-}
-
-inline void QOpenGLFunctions_4_5_Compatibility::glVertex4d(GLdouble x, GLdouble y, GLdouble z, GLdouble w)
-{
- d_1_0_Deprecated->f.Vertex4d(x, y, z, w);
-}
-
-inline void QOpenGLFunctions_4_5_Compatibility::glVertex3sv(const GLshort *v)
-{
- d_1_0_Deprecated->f.Vertex3sv(v);
-}
-
-inline void QOpenGLFunctions_4_5_Compatibility::glVertex3s(GLshort x, GLshort y, GLshort z)
-{
- d_1_0_Deprecated->f.Vertex3s(x, y, z);
-}
-
-inline void QOpenGLFunctions_4_5_Compatibility::glVertex3iv(const GLint *v)
-{
- d_1_0_Deprecated->f.Vertex3iv(v);
-}
-
-inline void QOpenGLFunctions_4_5_Compatibility::glVertex3i(GLint x, GLint y, GLint z)
-{
- d_1_0_Deprecated->f.Vertex3i(x, y, z);
-}
-
-inline void QOpenGLFunctions_4_5_Compatibility::glVertex3fv(const GLfloat *v)
-{
- d_1_0_Deprecated->f.Vertex3fv(v);
-}
-
-inline void QOpenGLFunctions_4_5_Compatibility::glVertex3f(GLfloat x, GLfloat y, GLfloat z)
-{
- d_1_0_Deprecated->f.Vertex3f(x, y, z);
-}
-
-inline void QOpenGLFunctions_4_5_Compatibility::glVertex3dv(const GLdouble *v)
-{
- d_1_0_Deprecated->f.Vertex3dv(v);
-}
-
-inline void QOpenGLFunctions_4_5_Compatibility::glVertex3d(GLdouble x, GLdouble y, GLdouble z)
-{
- d_1_0_Deprecated->f.Vertex3d(x, y, z);
-}
-
-inline void QOpenGLFunctions_4_5_Compatibility::glVertex2sv(const GLshort *v)
-{
- d_1_0_Deprecated->f.Vertex2sv(v);
-}
-
-inline void QOpenGLFunctions_4_5_Compatibility::glVertex2s(GLshort x, GLshort y)
-{
- d_1_0_Deprecated->f.Vertex2s(x, y);
-}
-
-inline void QOpenGLFunctions_4_5_Compatibility::glVertex2iv(const GLint *v)
-{
- d_1_0_Deprecated->f.Vertex2iv(v);
-}
-
-inline void QOpenGLFunctions_4_5_Compatibility::glVertex2i(GLint x, GLint y)
-{
- d_1_0_Deprecated->f.Vertex2i(x, y);
-}
-
-inline void QOpenGLFunctions_4_5_Compatibility::glVertex2fv(const GLfloat *v)
-{
- d_1_0_Deprecated->f.Vertex2fv(v);
-}
-
-inline void QOpenGLFunctions_4_5_Compatibility::glVertex2f(GLfloat x, GLfloat y)
-{
- d_1_0_Deprecated->f.Vertex2f(x, y);
-}
-
-inline void QOpenGLFunctions_4_5_Compatibility::glVertex2dv(const GLdouble *v)
-{
- d_1_0_Deprecated->f.Vertex2dv(v);
-}
-
-inline void QOpenGLFunctions_4_5_Compatibility::glVertex2d(GLdouble x, GLdouble y)
-{
- d_1_0_Deprecated->f.Vertex2d(x, y);
-}
-
-inline void QOpenGLFunctions_4_5_Compatibility::glTexCoord4sv(const GLshort *v)
-{
- d_1_0_Deprecated->f.TexCoord4sv(v);
-}
-
-inline void QOpenGLFunctions_4_5_Compatibility::glTexCoord4s(GLshort s, GLshort t, GLshort r, GLshort q)
-{
- d_1_0_Deprecated->f.TexCoord4s(s, t, r, q);
-}
-
-inline void QOpenGLFunctions_4_5_Compatibility::glTexCoord4iv(const GLint *v)
-{
- d_1_0_Deprecated->f.TexCoord4iv(v);
-}
-
-inline void QOpenGLFunctions_4_5_Compatibility::glTexCoord4i(GLint s, GLint t, GLint r, GLint q)
-{
- d_1_0_Deprecated->f.TexCoord4i(s, t, r, q);
-}
-
-inline void QOpenGLFunctions_4_5_Compatibility::glTexCoord4fv(const GLfloat *v)
-{
- d_1_0_Deprecated->f.TexCoord4fv(v);
-}
-
-inline void QOpenGLFunctions_4_5_Compatibility::glTexCoord4f(GLfloat s, GLfloat t, GLfloat r, GLfloat q)
-{
- d_1_0_Deprecated->f.TexCoord4f(s, t, r, q);
-}
-
-inline void QOpenGLFunctions_4_5_Compatibility::glTexCoord4dv(const GLdouble *v)
-{
- d_1_0_Deprecated->f.TexCoord4dv(v);
-}
-
-inline void QOpenGLFunctions_4_5_Compatibility::glTexCoord4d(GLdouble s, GLdouble t, GLdouble r, GLdouble q)
-{
- d_1_0_Deprecated->f.TexCoord4d(s, t, r, q);
-}
-
-inline void QOpenGLFunctions_4_5_Compatibility::glTexCoord3sv(const GLshort *v)
-{
- d_1_0_Deprecated->f.TexCoord3sv(v);
-}
-
-inline void QOpenGLFunctions_4_5_Compatibility::glTexCoord3s(GLshort s, GLshort t, GLshort r)
-{
- d_1_0_Deprecated->f.TexCoord3s(s, t, r);
-}
-
-inline void QOpenGLFunctions_4_5_Compatibility::glTexCoord3iv(const GLint *v)
-{
- d_1_0_Deprecated->f.TexCoord3iv(v);
-}
-
-inline void QOpenGLFunctions_4_5_Compatibility::glTexCoord3i(GLint s, GLint t, GLint r)
-{
- d_1_0_Deprecated->f.TexCoord3i(s, t, r);
-}
-
-inline void QOpenGLFunctions_4_5_Compatibility::glTexCoord3fv(const GLfloat *v)
-{
- d_1_0_Deprecated->f.TexCoord3fv(v);
-}
-
-inline void QOpenGLFunctions_4_5_Compatibility::glTexCoord3f(GLfloat s, GLfloat t, GLfloat r)
-{
- d_1_0_Deprecated->f.TexCoord3f(s, t, r);
-}
-
-inline void QOpenGLFunctions_4_5_Compatibility::glTexCoord3dv(const GLdouble *v)
-{
- d_1_0_Deprecated->f.TexCoord3dv(v);
-}
-
-inline void QOpenGLFunctions_4_5_Compatibility::glTexCoord3d(GLdouble s, GLdouble t, GLdouble r)
-{
- d_1_0_Deprecated->f.TexCoord3d(s, t, r);
-}
-
-inline void QOpenGLFunctions_4_5_Compatibility::glTexCoord2sv(const GLshort *v)
-{
- d_1_0_Deprecated->f.TexCoord2sv(v);
-}
-
-inline void QOpenGLFunctions_4_5_Compatibility::glTexCoord2s(GLshort s, GLshort t)
-{
- d_1_0_Deprecated->f.TexCoord2s(s, t);
-}
-
-inline void QOpenGLFunctions_4_5_Compatibility::glTexCoord2iv(const GLint *v)
-{
- d_1_0_Deprecated->f.TexCoord2iv(v);
-}
-
-inline void QOpenGLFunctions_4_5_Compatibility::glTexCoord2i(GLint s, GLint t)
-{
- d_1_0_Deprecated->f.TexCoord2i(s, t);
-}
-
-inline void QOpenGLFunctions_4_5_Compatibility::glTexCoord2fv(const GLfloat *v)
-{
- d_1_0_Deprecated->f.TexCoord2fv(v);
-}
-
-inline void QOpenGLFunctions_4_5_Compatibility::glTexCoord2f(GLfloat s, GLfloat t)
-{
- d_1_0_Deprecated->f.TexCoord2f(s, t);
-}
-
-inline void QOpenGLFunctions_4_5_Compatibility::glTexCoord2dv(const GLdouble *v)
-{
- d_1_0_Deprecated->f.TexCoord2dv(v);
-}
-
-inline void QOpenGLFunctions_4_5_Compatibility::glTexCoord2d(GLdouble s, GLdouble t)
-{
- d_1_0_Deprecated->f.TexCoord2d(s, t);
-}
-
-inline void QOpenGLFunctions_4_5_Compatibility::glTexCoord1sv(const GLshort *v)
-{
- d_1_0_Deprecated->f.TexCoord1sv(v);
-}
-
-inline void QOpenGLFunctions_4_5_Compatibility::glTexCoord1s(GLshort s)
-{
- d_1_0_Deprecated->f.TexCoord1s(s);
-}
-
-inline void QOpenGLFunctions_4_5_Compatibility::glTexCoord1iv(const GLint *v)
-{
- d_1_0_Deprecated->f.TexCoord1iv(v);
-}
-
-inline void QOpenGLFunctions_4_5_Compatibility::glTexCoord1i(GLint s)
-{
- d_1_0_Deprecated->f.TexCoord1i(s);
-}
-
-inline void QOpenGLFunctions_4_5_Compatibility::glTexCoord1fv(const GLfloat *v)
-{
- d_1_0_Deprecated->f.TexCoord1fv(v);
-}
-
-inline void QOpenGLFunctions_4_5_Compatibility::glTexCoord1f(GLfloat s)
-{
- d_1_0_Deprecated->f.TexCoord1f(s);
-}
-
-inline void QOpenGLFunctions_4_5_Compatibility::glTexCoord1dv(const GLdouble *v)
-{
- d_1_0_Deprecated->f.TexCoord1dv(v);
-}
-
-inline void QOpenGLFunctions_4_5_Compatibility::glTexCoord1d(GLdouble s)
-{
- d_1_0_Deprecated->f.TexCoord1d(s);
-}
-
-inline void QOpenGLFunctions_4_5_Compatibility::glRectsv(const GLshort *v1, const GLshort *v2)
-{
- d_1_0_Deprecated->f.Rectsv(v1, v2);
-}
-
-inline void QOpenGLFunctions_4_5_Compatibility::glRects(GLshort x1, GLshort y1, GLshort x2, GLshort y2)
-{
- d_1_0_Deprecated->f.Rects(x1, y1, x2, y2);
-}
-
-inline void QOpenGLFunctions_4_5_Compatibility::glRectiv(const GLint *v1, const GLint *v2)
-{
- d_1_0_Deprecated->f.Rectiv(v1, v2);
-}
-
-inline void QOpenGLFunctions_4_5_Compatibility::glRecti(GLint x1, GLint y1, GLint x2, GLint y2)
-{
- d_1_0_Deprecated->f.Recti(x1, y1, x2, y2);
-}
-
-inline void QOpenGLFunctions_4_5_Compatibility::glRectfv(const GLfloat *v1, const GLfloat *v2)
-{
- d_1_0_Deprecated->f.Rectfv(v1, v2);
-}
-
-inline void QOpenGLFunctions_4_5_Compatibility::glRectf(GLfloat x1, GLfloat y1, GLfloat x2, GLfloat y2)
-{
- d_1_0_Deprecated->f.Rectf(x1, y1, x2, y2);
-}
-
-inline void QOpenGLFunctions_4_5_Compatibility::glRectdv(const GLdouble *v1, const GLdouble *v2)
-{
- d_1_0_Deprecated->f.Rectdv(v1, v2);
-}
-
-inline void QOpenGLFunctions_4_5_Compatibility::glRectd(GLdouble x1, GLdouble y1, GLdouble x2, GLdouble y2)
-{
- d_1_0_Deprecated->f.Rectd(x1, y1, x2, y2);
-}
-
-inline void QOpenGLFunctions_4_5_Compatibility::glRasterPos4sv(const GLshort *v)
-{
- d_1_0_Deprecated->f.RasterPos4sv(v);
-}
-
-inline void QOpenGLFunctions_4_5_Compatibility::glRasterPos4s(GLshort x, GLshort y, GLshort z, GLshort w)
-{
- d_1_0_Deprecated->f.RasterPos4s(x, y, z, w);
-}
-
-inline void QOpenGLFunctions_4_5_Compatibility::glRasterPos4iv(const GLint *v)
-{
- d_1_0_Deprecated->f.RasterPos4iv(v);
-}
-
-inline void QOpenGLFunctions_4_5_Compatibility::glRasterPos4i(GLint x, GLint y, GLint z, GLint w)
-{
- d_1_0_Deprecated->f.RasterPos4i(x, y, z, w);
-}
-
-inline void QOpenGLFunctions_4_5_Compatibility::glRasterPos4fv(const GLfloat *v)
-{
- d_1_0_Deprecated->f.RasterPos4fv(v);
-}
-
-inline void QOpenGLFunctions_4_5_Compatibility::glRasterPos4f(GLfloat x, GLfloat y, GLfloat z, GLfloat w)
-{
- d_1_0_Deprecated->f.RasterPos4f(x, y, z, w);
-}
-
-inline void QOpenGLFunctions_4_5_Compatibility::glRasterPos4dv(const GLdouble *v)
-{
- d_1_0_Deprecated->f.RasterPos4dv(v);
-}
-
-inline void QOpenGLFunctions_4_5_Compatibility::glRasterPos4d(GLdouble x, GLdouble y, GLdouble z, GLdouble w)
-{
- d_1_0_Deprecated->f.RasterPos4d(x, y, z, w);
-}
-
-inline void QOpenGLFunctions_4_5_Compatibility::glRasterPos3sv(const GLshort *v)
-{
- d_1_0_Deprecated->f.RasterPos3sv(v);
-}
-
-inline void QOpenGLFunctions_4_5_Compatibility::glRasterPos3s(GLshort x, GLshort y, GLshort z)
-{
- d_1_0_Deprecated->f.RasterPos3s(x, y, z);
-}
-
-inline void QOpenGLFunctions_4_5_Compatibility::glRasterPos3iv(const GLint *v)
-{
- d_1_0_Deprecated->f.RasterPos3iv(v);
-}
-
-inline void QOpenGLFunctions_4_5_Compatibility::glRasterPos3i(GLint x, GLint y, GLint z)
-{
- d_1_0_Deprecated->f.RasterPos3i(x, y, z);
-}
-
-inline void QOpenGLFunctions_4_5_Compatibility::glRasterPos3fv(const GLfloat *v)
-{
- d_1_0_Deprecated->f.RasterPos3fv(v);
-}
-
-inline void QOpenGLFunctions_4_5_Compatibility::glRasterPos3f(GLfloat x, GLfloat y, GLfloat z)
-{
- d_1_0_Deprecated->f.RasterPos3f(x, y, z);
-}
-
-inline void QOpenGLFunctions_4_5_Compatibility::glRasterPos3dv(const GLdouble *v)
-{
- d_1_0_Deprecated->f.RasterPos3dv(v);
-}
-
-inline void QOpenGLFunctions_4_5_Compatibility::glRasterPos3d(GLdouble x, GLdouble y, GLdouble z)
-{
- d_1_0_Deprecated->f.RasterPos3d(x, y, z);
-}
-
-inline void QOpenGLFunctions_4_5_Compatibility::glRasterPos2sv(const GLshort *v)
-{
- d_1_0_Deprecated->f.RasterPos2sv(v);
-}
-
-inline void QOpenGLFunctions_4_5_Compatibility::glRasterPos2s(GLshort x, GLshort y)
-{
- d_1_0_Deprecated->f.RasterPos2s(x, y);
-}
-
-inline void QOpenGLFunctions_4_5_Compatibility::glRasterPos2iv(const GLint *v)
-{
- d_1_0_Deprecated->f.RasterPos2iv(v);
-}
-
-inline void QOpenGLFunctions_4_5_Compatibility::glRasterPos2i(GLint x, GLint y)
-{
- d_1_0_Deprecated->f.RasterPos2i(x, y);
-}
-
-inline void QOpenGLFunctions_4_5_Compatibility::glRasterPos2fv(const GLfloat *v)
-{
- d_1_0_Deprecated->f.RasterPos2fv(v);
-}
-
-inline void QOpenGLFunctions_4_5_Compatibility::glRasterPos2f(GLfloat x, GLfloat y)
-{
- d_1_0_Deprecated->f.RasterPos2f(x, y);
-}
-
-inline void QOpenGLFunctions_4_5_Compatibility::glRasterPos2dv(const GLdouble *v)
-{
- d_1_0_Deprecated->f.RasterPos2dv(v);
-}
-
-inline void QOpenGLFunctions_4_5_Compatibility::glRasterPos2d(GLdouble x, GLdouble y)
-{
- d_1_0_Deprecated->f.RasterPos2d(x, y);
-}
-
-inline void QOpenGLFunctions_4_5_Compatibility::glNormal3sv(const GLshort *v)
-{
- d_1_0_Deprecated->f.Normal3sv(v);
-}
-
-inline void QOpenGLFunctions_4_5_Compatibility::glNormal3s(GLshort nx, GLshort ny, GLshort nz)
-{
- d_1_0_Deprecated->f.Normal3s(nx, ny, nz);
-}
-
-inline void QOpenGLFunctions_4_5_Compatibility::glNormal3iv(const GLint *v)
-{
- d_1_0_Deprecated->f.Normal3iv(v);
-}
-
-inline void QOpenGLFunctions_4_5_Compatibility::glNormal3i(GLint nx, GLint ny, GLint nz)
-{
- d_1_0_Deprecated->f.Normal3i(nx, ny, nz);
-}
-
-inline void QOpenGLFunctions_4_5_Compatibility::glNormal3fv(const GLfloat *v)
-{
- d_1_0_Deprecated->f.Normal3fv(v);
-}
-
-inline void QOpenGLFunctions_4_5_Compatibility::glNormal3f(GLfloat nx, GLfloat ny, GLfloat nz)
-{
- d_1_0_Deprecated->f.Normal3f(nx, ny, nz);
-}
-
-inline void QOpenGLFunctions_4_5_Compatibility::glNormal3dv(const GLdouble *v)
-{
- d_1_0_Deprecated->f.Normal3dv(v);
-}
-
-inline void QOpenGLFunctions_4_5_Compatibility::glNormal3d(GLdouble nx, GLdouble ny, GLdouble nz)
-{
- d_1_0_Deprecated->f.Normal3d(nx, ny, nz);
-}
-
-inline void QOpenGLFunctions_4_5_Compatibility::glNormal3bv(const GLbyte *v)
-{
- d_1_0_Deprecated->f.Normal3bv(v);
-}
-
-inline void QOpenGLFunctions_4_5_Compatibility::glNormal3b(GLbyte nx, GLbyte ny, GLbyte nz)
-{
- d_1_0_Deprecated->f.Normal3b(nx, ny, nz);
-}
-
-inline void QOpenGLFunctions_4_5_Compatibility::glIndexsv(const GLshort *c)
-{
- d_1_0_Deprecated->f.Indexsv(c);
-}
-
-inline void QOpenGLFunctions_4_5_Compatibility::glIndexs(GLshort c)
-{
- d_1_0_Deprecated->f.Indexs(c);
-}
-
-inline void QOpenGLFunctions_4_5_Compatibility::glIndexiv(const GLint *c)
-{
- d_1_0_Deprecated->f.Indexiv(c);
-}
-
-inline void QOpenGLFunctions_4_5_Compatibility::glIndexi(GLint c)
-{
- d_1_0_Deprecated->f.Indexi(c);
-}
-
-inline void QOpenGLFunctions_4_5_Compatibility::glIndexfv(const GLfloat *c)
-{
- d_1_0_Deprecated->f.Indexfv(c);
-}
-
-inline void QOpenGLFunctions_4_5_Compatibility::glIndexf(GLfloat c)
-{
- d_1_0_Deprecated->f.Indexf(c);
-}
-
-inline void QOpenGLFunctions_4_5_Compatibility::glIndexdv(const GLdouble *c)
-{
- d_1_0_Deprecated->f.Indexdv(c);
-}
-
-inline void QOpenGLFunctions_4_5_Compatibility::glIndexd(GLdouble c)
-{
- d_1_0_Deprecated->f.Indexd(c);
-}
-
-inline void QOpenGLFunctions_4_5_Compatibility::glEnd()
-{
- d_1_0_Deprecated->f.End();
-}
-
-inline void QOpenGLFunctions_4_5_Compatibility::glEdgeFlagv(const GLboolean *flag)
-{
- d_1_0_Deprecated->f.EdgeFlagv(flag);
-}
-
-inline void QOpenGLFunctions_4_5_Compatibility::glEdgeFlag(GLboolean flag)
-{
- d_1_0_Deprecated->f.EdgeFlag(flag);
-}
-
-inline void QOpenGLFunctions_4_5_Compatibility::glColor4usv(const GLushort *v)
-{
- d_1_0_Deprecated->f.Color4usv(v);
-}
-
-inline void QOpenGLFunctions_4_5_Compatibility::glColor4us(GLushort red, GLushort green, GLushort blue, GLushort alpha)
-{
- d_1_0_Deprecated->f.Color4us(red, green, blue, alpha);
-}
-
-inline void QOpenGLFunctions_4_5_Compatibility::glColor4uiv(const GLuint *v)
-{
- d_1_0_Deprecated->f.Color4uiv(v);
-}
-
-inline void QOpenGLFunctions_4_5_Compatibility::glColor4ui(GLuint red, GLuint green, GLuint blue, GLuint alpha)
-{
- d_1_0_Deprecated->f.Color4ui(red, green, blue, alpha);
-}
-
-inline void QOpenGLFunctions_4_5_Compatibility::glColor4ubv(const GLubyte *v)
-{
- d_1_0_Deprecated->f.Color4ubv(v);
-}
-
-inline void QOpenGLFunctions_4_5_Compatibility::glColor4ub(GLubyte red, GLubyte green, GLubyte blue, GLubyte alpha)
-{
- d_1_0_Deprecated->f.Color4ub(red, green, blue, alpha);
-}
-
-inline void QOpenGLFunctions_4_5_Compatibility::glColor4sv(const GLshort *v)
-{
- d_1_0_Deprecated->f.Color4sv(v);
-}
-
-inline void QOpenGLFunctions_4_5_Compatibility::glColor4s(GLshort red, GLshort green, GLshort blue, GLshort alpha)
-{
- d_1_0_Deprecated->f.Color4s(red, green, blue, alpha);
-}
-
-inline void QOpenGLFunctions_4_5_Compatibility::glColor4iv(const GLint *v)
-{
- d_1_0_Deprecated->f.Color4iv(v);
-}
-
-inline void QOpenGLFunctions_4_5_Compatibility::glColor4i(GLint red, GLint green, GLint blue, GLint alpha)
-{
- d_1_0_Deprecated->f.Color4i(red, green, blue, alpha);
-}
-
-inline void QOpenGLFunctions_4_5_Compatibility::glColor4fv(const GLfloat *v)
-{
- d_1_0_Deprecated->f.Color4fv(v);
-}
-
-inline void QOpenGLFunctions_4_5_Compatibility::glColor4f(GLfloat red, GLfloat green, GLfloat blue, GLfloat alpha)
-{
- d_1_0_Deprecated->f.Color4f(red, green, blue, alpha);
-}
-
-inline void QOpenGLFunctions_4_5_Compatibility::glColor4dv(const GLdouble *v)
-{
- d_1_0_Deprecated->f.Color4dv(v);
-}
-
-inline void QOpenGLFunctions_4_5_Compatibility::glColor4d(GLdouble red, GLdouble green, GLdouble blue, GLdouble alpha)
-{
- d_1_0_Deprecated->f.Color4d(red, green, blue, alpha);
-}
-
-inline void QOpenGLFunctions_4_5_Compatibility::glColor4bv(const GLbyte *v)
-{
- d_1_0_Deprecated->f.Color4bv(v);
-}
-
-inline void QOpenGLFunctions_4_5_Compatibility::glColor4b(GLbyte red, GLbyte green, GLbyte blue, GLbyte alpha)
-{
- d_1_0_Deprecated->f.Color4b(red, green, blue, alpha);
-}
-
-inline void QOpenGLFunctions_4_5_Compatibility::glColor3usv(const GLushort *v)
-{
- d_1_0_Deprecated->f.Color3usv(v);
-}
-
-inline void QOpenGLFunctions_4_5_Compatibility::glColor3us(GLushort red, GLushort green, GLushort blue)
-{
- d_1_0_Deprecated->f.Color3us(red, green, blue);
-}
-
-inline void QOpenGLFunctions_4_5_Compatibility::glColor3uiv(const GLuint *v)
-{
- d_1_0_Deprecated->f.Color3uiv(v);
-}
-
-inline void QOpenGLFunctions_4_5_Compatibility::glColor3ui(GLuint red, GLuint green, GLuint blue)
-{
- d_1_0_Deprecated->f.Color3ui(red, green, blue);
-}
-
-inline void QOpenGLFunctions_4_5_Compatibility::glColor3ubv(const GLubyte *v)
-{
- d_1_0_Deprecated->f.Color3ubv(v);
-}
-
-inline void QOpenGLFunctions_4_5_Compatibility::glColor3ub(GLubyte red, GLubyte green, GLubyte blue)
-{
- d_1_0_Deprecated->f.Color3ub(red, green, blue);
-}
-
-inline void QOpenGLFunctions_4_5_Compatibility::glColor3sv(const GLshort *v)
-{
- d_1_0_Deprecated->f.Color3sv(v);
-}
-
-inline void QOpenGLFunctions_4_5_Compatibility::glColor3s(GLshort red, GLshort green, GLshort blue)
-{
- d_1_0_Deprecated->f.Color3s(red, green, blue);
-}
-
-inline void QOpenGLFunctions_4_5_Compatibility::glColor3iv(const GLint *v)
-{
- d_1_0_Deprecated->f.Color3iv(v);
-}
-
-inline void QOpenGLFunctions_4_5_Compatibility::glColor3i(GLint red, GLint green, GLint blue)
-{
- d_1_0_Deprecated->f.Color3i(red, green, blue);
-}
-
-inline void QOpenGLFunctions_4_5_Compatibility::glColor3fv(const GLfloat *v)
-{
- d_1_0_Deprecated->f.Color3fv(v);
-}
-
-inline void QOpenGLFunctions_4_5_Compatibility::glColor3f(GLfloat red, GLfloat green, GLfloat blue)
-{
- d_1_0_Deprecated->f.Color3f(red, green, blue);
-}
-
-inline void QOpenGLFunctions_4_5_Compatibility::glColor3dv(const GLdouble *v)
-{
- d_1_0_Deprecated->f.Color3dv(v);
-}
-
-inline void QOpenGLFunctions_4_5_Compatibility::glColor3d(GLdouble red, GLdouble green, GLdouble blue)
-{
- d_1_0_Deprecated->f.Color3d(red, green, blue);
-}
-
-inline void QOpenGLFunctions_4_5_Compatibility::glColor3bv(const GLbyte *v)
-{
- d_1_0_Deprecated->f.Color3bv(v);
-}
-
-inline void QOpenGLFunctions_4_5_Compatibility::glColor3b(GLbyte red, GLbyte green, GLbyte blue)
-{
- d_1_0_Deprecated->f.Color3b(red, green, blue);
-}
-
-inline void QOpenGLFunctions_4_5_Compatibility::glBitmap(GLsizei width, GLsizei height, GLfloat xorig, GLfloat yorig, GLfloat xmove, GLfloat ymove, const GLubyte *bitmap)
-{
- d_1_0_Deprecated->f.Bitmap(width, height, xorig, yorig, xmove, ymove, bitmap);
-}
-
-inline void QOpenGLFunctions_4_5_Compatibility::glBegin(GLenum mode)
-{
- d_1_0_Deprecated->f.Begin(mode);
-}
-
-inline void QOpenGLFunctions_4_5_Compatibility::glListBase(GLuint base)
-{
- d_1_0_Deprecated->f.ListBase(base);
-}
-
-inline GLuint QOpenGLFunctions_4_5_Compatibility::glGenLists(GLsizei range)
-{
- return d_1_0_Deprecated->f.GenLists(range);
-}
-
-inline void QOpenGLFunctions_4_5_Compatibility::glDeleteLists(GLuint list, GLsizei range)
-{
- d_1_0_Deprecated->f.DeleteLists(list, range);
-}
-
-inline void QOpenGLFunctions_4_5_Compatibility::glCallLists(GLsizei n, GLenum type, const void *lists)
-{
- d_1_0_Deprecated->f.CallLists(n, type, lists);
-}
-
-inline void QOpenGLFunctions_4_5_Compatibility::glCallList(GLuint list)
-{
- d_1_0_Deprecated->f.CallList(list);
-}
-
-inline void QOpenGLFunctions_4_5_Compatibility::glEndList()
-{
- d_1_0_Deprecated->f.EndList();
-}
-
-inline void QOpenGLFunctions_4_5_Compatibility::glNewList(GLuint list, GLenum mode)
-{
- d_1_0_Deprecated->f.NewList(list, mode);
-}
-
-
-// OpenGL 1.1 deprecated functions
-inline void QOpenGLFunctions_4_5_Compatibility::glPushClientAttrib(GLbitfield mask)
-{
- d_1_1_Deprecated->f.PushClientAttrib(mask);
-}
-
-inline void QOpenGLFunctions_4_5_Compatibility::glPopClientAttrib()
-{
- d_1_1_Deprecated->f.PopClientAttrib();
-}
-
-inline void QOpenGLFunctions_4_5_Compatibility::glIndexubv(const GLubyte *c)
-{
- d_1_1_Deprecated->f.Indexubv(c);
-}
-
-inline void QOpenGLFunctions_4_5_Compatibility::glIndexub(GLubyte c)
-{
- d_1_1_Deprecated->f.Indexub(c);
-}
-
-inline void QOpenGLFunctions_4_5_Compatibility::glPrioritizeTextures(GLsizei n, const GLuint *textures, const GLfloat *priorities)
-{
- d_1_1_Deprecated->f.PrioritizeTextures(n, textures, priorities);
-}
-
-inline GLboolean QOpenGLFunctions_4_5_Compatibility::glAreTexturesResident(GLsizei n, const GLuint *textures, GLboolean *residences)
-{
- return d_1_1_Deprecated->f.AreTexturesResident(n, textures, residences);
-}
-
-inline void QOpenGLFunctions_4_5_Compatibility::glVertexPointer(GLint size, GLenum type, GLsizei stride, const void *pointer)
-{
- d_1_1_Deprecated->f.VertexPointer(size, type, stride, pointer);
-}
-
-inline void QOpenGLFunctions_4_5_Compatibility::glTexCoordPointer(GLint size, GLenum type, GLsizei stride, const void *pointer)
-{
- d_1_1_Deprecated->f.TexCoordPointer(size, type, stride, pointer);
-}
-
-inline void QOpenGLFunctions_4_5_Compatibility::glNormalPointer(GLenum type, GLsizei stride, const void *pointer)
-{
- d_1_1_Deprecated->f.NormalPointer(type, stride, pointer);
-}
-
-inline void QOpenGLFunctions_4_5_Compatibility::glInterleavedArrays(GLenum format, GLsizei stride, const void *pointer)
-{
- d_1_1_Deprecated->f.InterleavedArrays(format, stride, pointer);
-}
-
-inline void QOpenGLFunctions_4_5_Compatibility::glGetPointerv(GLenum pname, void * *params)
-{
- d_1_1_Deprecated->f.GetPointerv(pname, params);
-}
-
-inline void QOpenGLFunctions_4_5_Compatibility::glIndexPointer(GLenum type, GLsizei stride, const void *pointer)
-{
- d_1_1_Deprecated->f.IndexPointer(type, stride, pointer);
-}
-
-inline void QOpenGLFunctions_4_5_Compatibility::glEnableClientState(GLenum array)
-{
- d_1_1_Deprecated->f.EnableClientState(array);
-}
-
-inline void QOpenGLFunctions_4_5_Compatibility::glEdgeFlagPointer(GLsizei stride, const void *pointer)
-{
- d_1_1_Deprecated->f.EdgeFlagPointer(stride, pointer);
-}
-
-inline void QOpenGLFunctions_4_5_Compatibility::glDisableClientState(GLenum array)
-{
- d_1_1_Deprecated->f.DisableClientState(array);
-}
-
-inline void QOpenGLFunctions_4_5_Compatibility::glColorPointer(GLint size, GLenum type, GLsizei stride, const void *pointer)
-{
- d_1_1_Deprecated->f.ColorPointer(size, type, stride, pointer);
-}
-
-inline void QOpenGLFunctions_4_5_Compatibility::glArrayElement(GLint i)
-{
- d_1_1_Deprecated->f.ArrayElement(i);
-}
-
-
-// OpenGL 1.2 deprecated functions
-inline void QOpenGLFunctions_4_5_Compatibility::glColorTable(GLenum target, GLenum internalformat, GLsizei width, GLenum format, GLenum type, const void *table)
-{
- d_1_2_Deprecated->f.ColorTable(target, internalformat, width, format, type, table);
-}
-
-inline void QOpenGLFunctions_4_5_Compatibility::glColorTableParameterfv(GLenum target, GLenum pname, const GLfloat *params)
-{
- d_1_2_Deprecated->f.ColorTableParameterfv(target, pname, params);
-}
-
-inline void QOpenGLFunctions_4_5_Compatibility::glColorTableParameteriv(GLenum target, GLenum pname, const GLint *params)
-{
- d_1_2_Deprecated->f.ColorTableParameteriv(target, pname, params);
-}
-
-inline void QOpenGLFunctions_4_5_Compatibility::glCopyColorTable(GLenum target, GLenum internalformat, GLint x, GLint y, GLsizei width)
-{
- d_1_2_Deprecated->f.CopyColorTable(target, internalformat, x, y, width);
-}
-
-inline void QOpenGLFunctions_4_5_Compatibility::glGetColorTable(GLenum target, GLenum format, GLenum type, void *table)
-{
- d_1_2_Deprecated->f.GetColorTable(target, format, type, table);
-}
-
-inline void QOpenGLFunctions_4_5_Compatibility::glGetColorTableParameterfv(GLenum target, GLenum pname, GLfloat *params)
-{
- d_1_2_Deprecated->f.GetColorTableParameterfv(target, pname, params);
-}
-
-inline void QOpenGLFunctions_4_5_Compatibility::glGetColorTableParameteriv(GLenum target, GLenum pname, GLint *params)
-{
- d_1_2_Deprecated->f.GetColorTableParameteriv(target, pname, params);
-}
-
-inline void QOpenGLFunctions_4_5_Compatibility::glColorSubTable(GLenum target, GLsizei start, GLsizei count, GLenum format, GLenum type, const void *data)
-{
- d_1_2_Deprecated->f.ColorSubTable(target, start, count, format, type, data);
-}
-
-inline void QOpenGLFunctions_4_5_Compatibility::glCopyColorSubTable(GLenum target, GLsizei start, GLint x, GLint y, GLsizei width)
-{
- d_1_2_Deprecated->f.CopyColorSubTable(target, start, x, y, width);
-}
-
-inline void QOpenGLFunctions_4_5_Compatibility::glConvolutionFilter1D(GLenum target, GLenum internalformat, GLsizei width, GLenum format, GLenum type, const void *image)
-{
- d_1_2_Deprecated->f.ConvolutionFilter1D(target, internalformat, width, format, type, image);
-}
-
-inline void QOpenGLFunctions_4_5_Compatibility::glConvolutionFilter2D(GLenum target, GLenum internalformat, GLsizei width, GLsizei height, GLenum format, GLenum type, const void *image)
-{
- d_1_2_Deprecated->f.ConvolutionFilter2D(target, internalformat, width, height, format, type, image);
-}
-
-inline void QOpenGLFunctions_4_5_Compatibility::glConvolutionParameterf(GLenum target, GLenum pname, GLfloat params)
-{
- d_1_2_Deprecated->f.ConvolutionParameterf(target, pname, params);
-}
-
-inline void QOpenGLFunctions_4_5_Compatibility::glConvolutionParameterfv(GLenum target, GLenum pname, const GLfloat *params)
-{
- d_1_2_Deprecated->f.ConvolutionParameterfv(target, pname, params);
-}
-
-inline void QOpenGLFunctions_4_5_Compatibility::glConvolutionParameteri(GLenum target, GLenum pname, GLint params)
-{
- d_1_2_Deprecated->f.ConvolutionParameteri(target, pname, params);
-}
-
-inline void QOpenGLFunctions_4_5_Compatibility::glConvolutionParameteriv(GLenum target, GLenum pname, const GLint *params)
-{
- d_1_2_Deprecated->f.ConvolutionParameteriv(target, pname, params);
-}
-
-inline void QOpenGLFunctions_4_5_Compatibility::glCopyConvolutionFilter1D(GLenum target, GLenum internalformat, GLint x, GLint y, GLsizei width)
-{
- d_1_2_Deprecated->f.CopyConvolutionFilter1D(target, internalformat, x, y, width);
-}
-
-inline void QOpenGLFunctions_4_5_Compatibility::glCopyConvolutionFilter2D(GLenum target, GLenum internalformat, GLint x, GLint y, GLsizei width, GLsizei height)
-{
- d_1_2_Deprecated->f.CopyConvolutionFilter2D(target, internalformat, x, y, width, height);
-}
-
-inline void QOpenGLFunctions_4_5_Compatibility::glGetConvolutionFilter(GLenum target, GLenum format, GLenum type, void *image)
-{
- d_1_2_Deprecated->f.GetConvolutionFilter(target, format, type, image);
-}
-
-inline void QOpenGLFunctions_4_5_Compatibility::glGetConvolutionParameterfv(GLenum target, GLenum pname, GLfloat *params)
-{
- d_1_2_Deprecated->f.GetConvolutionParameterfv(target, pname, params);
-}
-
-inline void QOpenGLFunctions_4_5_Compatibility::glGetConvolutionParameteriv(GLenum target, GLenum pname, GLint *params)
-{
- d_1_2_Deprecated->f.GetConvolutionParameteriv(target, pname, params);
-}
-
-inline void QOpenGLFunctions_4_5_Compatibility::glGetSeparableFilter(GLenum target, GLenum format, GLenum type, void *row, void *column, void *span)
-{
- d_1_2_Deprecated->f.GetSeparableFilter(target, format, type, row, column, span);
-}
-
-inline void QOpenGLFunctions_4_5_Compatibility::glSeparableFilter2D(GLenum target, GLenum internalformat, GLsizei width, GLsizei height, GLenum format, GLenum type, const void *row, const void *column)
-{
- d_1_2_Deprecated->f.SeparableFilter2D(target, internalformat, width, height, format, type, row, column);
-}
-
-inline void QOpenGLFunctions_4_5_Compatibility::glGetHistogram(GLenum target, GLboolean reset, GLenum format, GLenum type, void *values)
-{
- d_1_2_Deprecated->f.GetHistogram(target, reset, format, type, values);
-}
-
-inline void QOpenGLFunctions_4_5_Compatibility::glGetHistogramParameterfv(GLenum target, GLenum pname, GLfloat *params)
-{
- d_1_2_Deprecated->f.GetHistogramParameterfv(target, pname, params);
-}
-
-inline void QOpenGLFunctions_4_5_Compatibility::glGetHistogramParameteriv(GLenum target, GLenum pname, GLint *params)
-{
- d_1_2_Deprecated->f.GetHistogramParameteriv(target, pname, params);
-}
-
-inline void QOpenGLFunctions_4_5_Compatibility::glGetMinmax(GLenum target, GLboolean reset, GLenum format, GLenum type, void *values)
-{
- d_1_2_Deprecated->f.GetMinmax(target, reset, format, type, values);
-}
-
-inline void QOpenGLFunctions_4_5_Compatibility::glGetMinmaxParameterfv(GLenum target, GLenum pname, GLfloat *params)
-{
- d_1_2_Deprecated->f.GetMinmaxParameterfv(target, pname, params);
-}
-
-inline void QOpenGLFunctions_4_5_Compatibility::glGetMinmaxParameteriv(GLenum target, GLenum pname, GLint *params)
-{
- d_1_2_Deprecated->f.GetMinmaxParameteriv(target, pname, params);
-}
-
-inline void QOpenGLFunctions_4_5_Compatibility::glHistogram(GLenum target, GLsizei width, GLenum internalformat, GLboolean sink)
-{
- d_1_2_Deprecated->f.Histogram(target, width, internalformat, sink);
-}
-
-inline void QOpenGLFunctions_4_5_Compatibility::glMinmax(GLenum target, GLenum internalformat, GLboolean sink)
-{
- d_1_2_Deprecated->f.Minmax(target, internalformat, sink);
-}
-
-inline void QOpenGLFunctions_4_5_Compatibility::glResetHistogram(GLenum target)
-{
- d_1_2_Deprecated->f.ResetHistogram(target);
-}
-
-inline void QOpenGLFunctions_4_5_Compatibility::glResetMinmax(GLenum target)
-{
- d_1_2_Deprecated->f.ResetMinmax(target);
-}
-
-
-// OpenGL 1.3 deprecated functions
-inline void QOpenGLFunctions_4_5_Compatibility::glMultTransposeMatrixd(const GLdouble *m)
-{
- d_1_3_Deprecated->f.MultTransposeMatrixd(m);
-}
-
-inline void QOpenGLFunctions_4_5_Compatibility::glMultTransposeMatrixf(const GLfloat *m)
-{
- d_1_3_Deprecated->f.MultTransposeMatrixf(m);
-}
-
-inline void QOpenGLFunctions_4_5_Compatibility::glLoadTransposeMatrixd(const GLdouble *m)
-{
- d_1_3_Deprecated->f.LoadTransposeMatrixd(m);
-}
-
-inline void QOpenGLFunctions_4_5_Compatibility::glLoadTransposeMatrixf(const GLfloat *m)
-{
- d_1_3_Deprecated->f.LoadTransposeMatrixf(m);
-}
-
-inline void QOpenGLFunctions_4_5_Compatibility::glMultiTexCoord4sv(GLenum target, const GLshort *v)
-{
- d_1_3_Deprecated->f.MultiTexCoord4sv(target, v);
-}
-
-inline void QOpenGLFunctions_4_5_Compatibility::glMultiTexCoord4s(GLenum target, GLshort s, GLshort t, GLshort r, GLshort q)
-{
- d_1_3_Deprecated->f.MultiTexCoord4s(target, s, t, r, q);
-}
-
-inline void QOpenGLFunctions_4_5_Compatibility::glMultiTexCoord4iv(GLenum target, const GLint *v)
-{
- d_1_3_Deprecated->f.MultiTexCoord4iv(target, v);
-}
-
-inline void QOpenGLFunctions_4_5_Compatibility::glMultiTexCoord4i(GLenum target, GLint s, GLint t, GLint r, GLint q)
-{
- d_1_3_Deprecated->f.MultiTexCoord4i(target, s, t, r, q);
-}
-
-inline void QOpenGLFunctions_4_5_Compatibility::glMultiTexCoord4fv(GLenum target, const GLfloat *v)
-{
- d_1_3_Deprecated->f.MultiTexCoord4fv(target, v);
-}
-
-inline void QOpenGLFunctions_4_5_Compatibility::glMultiTexCoord4f(GLenum target, GLfloat s, GLfloat t, GLfloat r, GLfloat q)
-{
- d_1_3_Deprecated->f.MultiTexCoord4f(target, s, t, r, q);
-}
-
-inline void QOpenGLFunctions_4_5_Compatibility::glMultiTexCoord4dv(GLenum target, const GLdouble *v)
-{
- d_1_3_Deprecated->f.MultiTexCoord4dv(target, v);
-}
-
-inline void QOpenGLFunctions_4_5_Compatibility::glMultiTexCoord4d(GLenum target, GLdouble s, GLdouble t, GLdouble r, GLdouble q)
-{
- d_1_3_Deprecated->f.MultiTexCoord4d(target, s, t, r, q);
-}
-
-inline void QOpenGLFunctions_4_5_Compatibility::glMultiTexCoord3sv(GLenum target, const GLshort *v)
-{
- d_1_3_Deprecated->f.MultiTexCoord3sv(target, v);
-}
-
-inline void QOpenGLFunctions_4_5_Compatibility::glMultiTexCoord3s(GLenum target, GLshort s, GLshort t, GLshort r)
-{
- d_1_3_Deprecated->f.MultiTexCoord3s(target, s, t, r);
-}
-
-inline void QOpenGLFunctions_4_5_Compatibility::glMultiTexCoord3iv(GLenum target, const GLint *v)
-{
- d_1_3_Deprecated->f.MultiTexCoord3iv(target, v);
-}
-
-inline void QOpenGLFunctions_4_5_Compatibility::glMultiTexCoord3i(GLenum target, GLint s, GLint t, GLint r)
-{
- d_1_3_Deprecated->f.MultiTexCoord3i(target, s, t, r);
-}
-
-inline void QOpenGLFunctions_4_5_Compatibility::glMultiTexCoord3fv(GLenum target, const GLfloat *v)
-{
- d_1_3_Deprecated->f.MultiTexCoord3fv(target, v);
-}
-
-inline void QOpenGLFunctions_4_5_Compatibility::glMultiTexCoord3f(GLenum target, GLfloat s, GLfloat t, GLfloat r)
-{
- d_1_3_Deprecated->f.MultiTexCoord3f(target, s, t, r);
-}
-
-inline void QOpenGLFunctions_4_5_Compatibility::glMultiTexCoord3dv(GLenum target, const GLdouble *v)
-{
- d_1_3_Deprecated->f.MultiTexCoord3dv(target, v);
-}
-
-inline void QOpenGLFunctions_4_5_Compatibility::glMultiTexCoord3d(GLenum target, GLdouble s, GLdouble t, GLdouble r)
-{
- d_1_3_Deprecated->f.MultiTexCoord3d(target, s, t, r);
-}
-
-inline void QOpenGLFunctions_4_5_Compatibility::glMultiTexCoord2sv(GLenum target, const GLshort *v)
-{
- d_1_3_Deprecated->f.MultiTexCoord2sv(target, v);
-}
-
-inline void QOpenGLFunctions_4_5_Compatibility::glMultiTexCoord2s(GLenum target, GLshort s, GLshort t)
-{
- d_1_3_Deprecated->f.MultiTexCoord2s(target, s, t);
-}
-
-inline void QOpenGLFunctions_4_5_Compatibility::glMultiTexCoord2iv(GLenum target, const GLint *v)
-{
- d_1_3_Deprecated->f.MultiTexCoord2iv(target, v);
-}
-
-inline void QOpenGLFunctions_4_5_Compatibility::glMultiTexCoord2i(GLenum target, GLint s, GLint t)
-{
- d_1_3_Deprecated->f.MultiTexCoord2i(target, s, t);
-}
-
-inline void QOpenGLFunctions_4_5_Compatibility::glMultiTexCoord2fv(GLenum target, const GLfloat *v)
-{
- d_1_3_Deprecated->f.MultiTexCoord2fv(target, v);
-}
-
-inline void QOpenGLFunctions_4_5_Compatibility::glMultiTexCoord2f(GLenum target, GLfloat s, GLfloat t)
-{
- d_1_3_Deprecated->f.MultiTexCoord2f(target, s, t);
-}
-
-inline void QOpenGLFunctions_4_5_Compatibility::glMultiTexCoord2dv(GLenum target, const GLdouble *v)
-{
- d_1_3_Deprecated->f.MultiTexCoord2dv(target, v);
-}
-
-inline void QOpenGLFunctions_4_5_Compatibility::glMultiTexCoord2d(GLenum target, GLdouble s, GLdouble t)
-{
- d_1_3_Deprecated->f.MultiTexCoord2d(target, s, t);
-}
-
-inline void QOpenGLFunctions_4_5_Compatibility::glMultiTexCoord1sv(GLenum target, const GLshort *v)
-{
- d_1_3_Deprecated->f.MultiTexCoord1sv(target, v);
-}
-
-inline void QOpenGLFunctions_4_5_Compatibility::glMultiTexCoord1s(GLenum target, GLshort s)
-{
- d_1_3_Deprecated->f.MultiTexCoord1s(target, s);
-}
-
-inline void QOpenGLFunctions_4_5_Compatibility::glMultiTexCoord1iv(GLenum target, const GLint *v)
-{
- d_1_3_Deprecated->f.MultiTexCoord1iv(target, v);
-}
-
-inline void QOpenGLFunctions_4_5_Compatibility::glMultiTexCoord1i(GLenum target, GLint s)
-{
- d_1_3_Deprecated->f.MultiTexCoord1i(target, s);
-}
-
-inline void QOpenGLFunctions_4_5_Compatibility::glMultiTexCoord1fv(GLenum target, const GLfloat *v)
-{
- d_1_3_Deprecated->f.MultiTexCoord1fv(target, v);
-}
-
-inline void QOpenGLFunctions_4_5_Compatibility::glMultiTexCoord1f(GLenum target, GLfloat s)
-{
- d_1_3_Deprecated->f.MultiTexCoord1f(target, s);
-}
-
-inline void QOpenGLFunctions_4_5_Compatibility::glMultiTexCoord1dv(GLenum target, const GLdouble *v)
-{
- d_1_3_Deprecated->f.MultiTexCoord1dv(target, v);
-}
-
-inline void QOpenGLFunctions_4_5_Compatibility::glMultiTexCoord1d(GLenum target, GLdouble s)
-{
- d_1_3_Deprecated->f.MultiTexCoord1d(target, s);
-}
-
-inline void QOpenGLFunctions_4_5_Compatibility::glClientActiveTexture(GLenum texture)
-{
- d_1_3_Deprecated->f.ClientActiveTexture(texture);
-}
-
-
-// OpenGL 1.4 deprecated functions
-inline void QOpenGLFunctions_4_5_Compatibility::glWindowPos3sv(const GLshort *v)
-{
- d_1_4_Deprecated->f.WindowPos3sv(v);
-}
-
-inline void QOpenGLFunctions_4_5_Compatibility::glWindowPos3s(GLshort x, GLshort y, GLshort z)
-{
- d_1_4_Deprecated->f.WindowPos3s(x, y, z);
-}
-
-inline void QOpenGLFunctions_4_5_Compatibility::glWindowPos3iv(const GLint *v)
-{
- d_1_4_Deprecated->f.WindowPos3iv(v);
-}
-
-inline void QOpenGLFunctions_4_5_Compatibility::glWindowPos3i(GLint x, GLint y, GLint z)
-{
- d_1_4_Deprecated->f.WindowPos3i(x, y, z);
-}
-
-inline void QOpenGLFunctions_4_5_Compatibility::glWindowPos3fv(const GLfloat *v)
-{
- d_1_4_Deprecated->f.WindowPos3fv(v);
-}
-
-inline void QOpenGLFunctions_4_5_Compatibility::glWindowPos3f(GLfloat x, GLfloat y, GLfloat z)
-{
- d_1_4_Deprecated->f.WindowPos3f(x, y, z);
-}
-
-inline void QOpenGLFunctions_4_5_Compatibility::glWindowPos3dv(const GLdouble *v)
-{
- d_1_4_Deprecated->f.WindowPos3dv(v);
-}
-
-inline void QOpenGLFunctions_4_5_Compatibility::glWindowPos3d(GLdouble x, GLdouble y, GLdouble z)
-{
- d_1_4_Deprecated->f.WindowPos3d(x, y, z);
-}
-
-inline void QOpenGLFunctions_4_5_Compatibility::glWindowPos2sv(const GLshort *v)
-{
- d_1_4_Deprecated->f.WindowPos2sv(v);
-}
-
-inline void QOpenGLFunctions_4_5_Compatibility::glWindowPos2s(GLshort x, GLshort y)
-{
- d_1_4_Deprecated->f.WindowPos2s(x, y);
-}
-
-inline void QOpenGLFunctions_4_5_Compatibility::glWindowPos2iv(const GLint *v)
-{
- d_1_4_Deprecated->f.WindowPos2iv(v);
-}
-
-inline void QOpenGLFunctions_4_5_Compatibility::glWindowPos2i(GLint x, GLint y)
-{
- d_1_4_Deprecated->f.WindowPos2i(x, y);
-}
-
-inline void QOpenGLFunctions_4_5_Compatibility::glWindowPos2fv(const GLfloat *v)
-{
- d_1_4_Deprecated->f.WindowPos2fv(v);
-}
-
-inline void QOpenGLFunctions_4_5_Compatibility::glWindowPos2f(GLfloat x, GLfloat y)
-{
- d_1_4_Deprecated->f.WindowPos2f(x, y);
-}
-
-inline void QOpenGLFunctions_4_5_Compatibility::glWindowPos2dv(const GLdouble *v)
-{
- d_1_4_Deprecated->f.WindowPos2dv(v);
-}
-
-inline void QOpenGLFunctions_4_5_Compatibility::glWindowPos2d(GLdouble x, GLdouble y)
-{
- d_1_4_Deprecated->f.WindowPos2d(x, y);
-}
-
-inline void QOpenGLFunctions_4_5_Compatibility::glSecondaryColorPointer(GLint size, GLenum type, GLsizei stride, const void *pointer)
-{
- d_1_4_Deprecated->f.SecondaryColorPointer(size, type, stride, pointer);
-}
-
-inline void QOpenGLFunctions_4_5_Compatibility::glSecondaryColor3usv(const GLushort *v)
-{
- d_1_4_Deprecated->f.SecondaryColor3usv(v);
-}
-
-inline void QOpenGLFunctions_4_5_Compatibility::glSecondaryColor3us(GLushort red, GLushort green, GLushort blue)
-{
- d_1_4_Deprecated->f.SecondaryColor3us(red, green, blue);
-}
-
-inline void QOpenGLFunctions_4_5_Compatibility::glSecondaryColor3uiv(const GLuint *v)
-{
- d_1_4_Deprecated->f.SecondaryColor3uiv(v);
-}
-
-inline void QOpenGLFunctions_4_5_Compatibility::glSecondaryColor3ui(GLuint red, GLuint green, GLuint blue)
-{
- d_1_4_Deprecated->f.SecondaryColor3ui(red, green, blue);
-}
-
-inline void QOpenGLFunctions_4_5_Compatibility::glSecondaryColor3ubv(const GLubyte *v)
-{
- d_1_4_Deprecated->f.SecondaryColor3ubv(v);
-}
-
-inline void QOpenGLFunctions_4_5_Compatibility::glSecondaryColor3ub(GLubyte red, GLubyte green, GLubyte blue)
-{
- d_1_4_Deprecated->f.SecondaryColor3ub(red, green, blue);
-}
-
-inline void QOpenGLFunctions_4_5_Compatibility::glSecondaryColor3sv(const GLshort *v)
-{
- d_1_4_Deprecated->f.SecondaryColor3sv(v);
-}
-
-inline void QOpenGLFunctions_4_5_Compatibility::glSecondaryColor3s(GLshort red, GLshort green, GLshort blue)
-{
- d_1_4_Deprecated->f.SecondaryColor3s(red, green, blue);
-}
-
-inline void QOpenGLFunctions_4_5_Compatibility::glSecondaryColor3iv(const GLint *v)
-{
- d_1_4_Deprecated->f.SecondaryColor3iv(v);
-}
-
-inline void QOpenGLFunctions_4_5_Compatibility::glSecondaryColor3i(GLint red, GLint green, GLint blue)
-{
- d_1_4_Deprecated->f.SecondaryColor3i(red, green, blue);
-}
-
-inline void QOpenGLFunctions_4_5_Compatibility::glSecondaryColor3fv(const GLfloat *v)
-{
- d_1_4_Deprecated->f.SecondaryColor3fv(v);
-}
-
-inline void QOpenGLFunctions_4_5_Compatibility::glSecondaryColor3f(GLfloat red, GLfloat green, GLfloat blue)
-{
- d_1_4_Deprecated->f.SecondaryColor3f(red, green, blue);
-}
-
-inline void QOpenGLFunctions_4_5_Compatibility::glSecondaryColor3dv(const GLdouble *v)
-{
- d_1_4_Deprecated->f.SecondaryColor3dv(v);
-}
-
-inline void QOpenGLFunctions_4_5_Compatibility::glSecondaryColor3d(GLdouble red, GLdouble green, GLdouble blue)
-{
- d_1_4_Deprecated->f.SecondaryColor3d(red, green, blue);
-}
-
-inline void QOpenGLFunctions_4_5_Compatibility::glSecondaryColor3bv(const GLbyte *v)
-{
- d_1_4_Deprecated->f.SecondaryColor3bv(v);
-}
-
-inline void QOpenGLFunctions_4_5_Compatibility::glSecondaryColor3b(GLbyte red, GLbyte green, GLbyte blue)
-{
- d_1_4_Deprecated->f.SecondaryColor3b(red, green, blue);
-}
-
-inline void QOpenGLFunctions_4_5_Compatibility::glFogCoordPointer(GLenum type, GLsizei stride, const void *pointer)
-{
- d_1_4_Deprecated->f.FogCoordPointer(type, stride, pointer);
-}
-
-inline void QOpenGLFunctions_4_5_Compatibility::glFogCoorddv(const GLdouble *coord)
-{
- d_1_4_Deprecated->f.FogCoorddv(coord);
-}
-
-inline void QOpenGLFunctions_4_5_Compatibility::glFogCoordd(GLdouble coord)
-{
- d_1_4_Deprecated->f.FogCoordd(coord);
-}
-
-inline void QOpenGLFunctions_4_5_Compatibility::glFogCoordfv(const GLfloat *coord)
-{
- d_1_4_Deprecated->f.FogCoordfv(coord);
-}
-
-inline void QOpenGLFunctions_4_5_Compatibility::glFogCoordf(GLfloat coord)
-{
- d_1_4_Deprecated->f.FogCoordf(coord);
-}
-
-
-// OpenGL 1.5 deprecated functions
-
-// OpenGL 2.0 deprecated functions
-
-// OpenGL 2.1 deprecated functions
-
-// OpenGL 3.0 deprecated functions
-
-// OpenGL 3.1 deprecated functions
-
-// OpenGL 3.2 deprecated functions
-
-// OpenGL 3.3 deprecated functions
-inline void QOpenGLFunctions_4_5_Compatibility::glSecondaryColorP3uiv(GLenum type, const GLuint *color)
-{
- d_3_3_Deprecated->f.SecondaryColorP3uiv(type, color);
-}
-
-inline void QOpenGLFunctions_4_5_Compatibility::glSecondaryColorP3ui(GLenum type, GLuint color)
-{
- d_3_3_Deprecated->f.SecondaryColorP3ui(type, color);
-}
-
-inline void QOpenGLFunctions_4_5_Compatibility::glColorP4uiv(GLenum type, const GLuint *color)
-{
- d_3_3_Deprecated->f.ColorP4uiv(type, color);
-}
-
-inline void QOpenGLFunctions_4_5_Compatibility::glColorP4ui(GLenum type, GLuint color)
-{
- d_3_3_Deprecated->f.ColorP4ui(type, color);
-}
-
-inline void QOpenGLFunctions_4_5_Compatibility::glColorP3uiv(GLenum type, const GLuint *color)
-{
- d_3_3_Deprecated->f.ColorP3uiv(type, color);
-}
-
-inline void QOpenGLFunctions_4_5_Compatibility::glColorP3ui(GLenum type, GLuint color)
-{
- d_3_3_Deprecated->f.ColorP3ui(type, color);
-}
-
-inline void QOpenGLFunctions_4_5_Compatibility::glNormalP3uiv(GLenum type, const GLuint *coords)
-{
- d_3_3_Deprecated->f.NormalP3uiv(type, coords);
-}
-
-inline void QOpenGLFunctions_4_5_Compatibility::glNormalP3ui(GLenum type, GLuint coords)
-{
- d_3_3_Deprecated->f.NormalP3ui(type, coords);
-}
-
-inline void QOpenGLFunctions_4_5_Compatibility::glMultiTexCoordP4uiv(GLenum texture, GLenum type, const GLuint *coords)
-{
- d_3_3_Deprecated->f.MultiTexCoordP4uiv(texture, type, coords);
-}
-
-inline void QOpenGLFunctions_4_5_Compatibility::glMultiTexCoordP4ui(GLenum texture, GLenum type, GLuint coords)
-{
- d_3_3_Deprecated->f.MultiTexCoordP4ui(texture, type, coords);
-}
-
-inline void QOpenGLFunctions_4_5_Compatibility::glMultiTexCoordP3uiv(GLenum texture, GLenum type, const GLuint *coords)
-{
- d_3_3_Deprecated->f.MultiTexCoordP3uiv(texture, type, coords);
-}
-
-inline void QOpenGLFunctions_4_5_Compatibility::glMultiTexCoordP3ui(GLenum texture, GLenum type, GLuint coords)
-{
- d_3_3_Deprecated->f.MultiTexCoordP3ui(texture, type, coords);
-}
-
-inline void QOpenGLFunctions_4_5_Compatibility::glMultiTexCoordP2uiv(GLenum texture, GLenum type, const GLuint *coords)
-{
- d_3_3_Deprecated->f.MultiTexCoordP2uiv(texture, type, coords);
-}
-
-inline void QOpenGLFunctions_4_5_Compatibility::glMultiTexCoordP2ui(GLenum texture, GLenum type, GLuint coords)
-{
- d_3_3_Deprecated->f.MultiTexCoordP2ui(texture, type, coords);
-}
-
-inline void QOpenGLFunctions_4_5_Compatibility::glMultiTexCoordP1uiv(GLenum texture, GLenum type, const GLuint *coords)
-{
- d_3_3_Deprecated->f.MultiTexCoordP1uiv(texture, type, coords);
-}
-
-inline void QOpenGLFunctions_4_5_Compatibility::glMultiTexCoordP1ui(GLenum texture, GLenum type, GLuint coords)
-{
- d_3_3_Deprecated->f.MultiTexCoordP1ui(texture, type, coords);
-}
-
-inline void QOpenGLFunctions_4_5_Compatibility::glTexCoordP4uiv(GLenum type, const GLuint *coords)
-{
- d_3_3_Deprecated->f.TexCoordP4uiv(type, coords);
-}
-
-inline void QOpenGLFunctions_4_5_Compatibility::glTexCoordP4ui(GLenum type, GLuint coords)
-{
- d_3_3_Deprecated->f.TexCoordP4ui(type, coords);
-}
-
-inline void QOpenGLFunctions_4_5_Compatibility::glTexCoordP3uiv(GLenum type, const GLuint *coords)
-{
- d_3_3_Deprecated->f.TexCoordP3uiv(type, coords);
-}
-
-inline void QOpenGLFunctions_4_5_Compatibility::glTexCoordP3ui(GLenum type, GLuint coords)
-{
- d_3_3_Deprecated->f.TexCoordP3ui(type, coords);
-}
-
-inline void QOpenGLFunctions_4_5_Compatibility::glTexCoordP2uiv(GLenum type, const GLuint *coords)
-{
- d_3_3_Deprecated->f.TexCoordP2uiv(type, coords);
-}
-
-inline void QOpenGLFunctions_4_5_Compatibility::glTexCoordP2ui(GLenum type, GLuint coords)
-{
- d_3_3_Deprecated->f.TexCoordP2ui(type, coords);
-}
-
-inline void QOpenGLFunctions_4_5_Compatibility::glTexCoordP1uiv(GLenum type, const GLuint *coords)
-{
- d_3_3_Deprecated->f.TexCoordP1uiv(type, coords);
-}
-
-inline void QOpenGLFunctions_4_5_Compatibility::glTexCoordP1ui(GLenum type, GLuint coords)
-{
- d_3_3_Deprecated->f.TexCoordP1ui(type, coords);
-}
-
-inline void QOpenGLFunctions_4_5_Compatibility::glVertexP4uiv(GLenum type, const GLuint *value)
-{
- d_3_3_Deprecated->f.VertexP4uiv(type, value);
-}
-
-inline void QOpenGLFunctions_4_5_Compatibility::glVertexP4ui(GLenum type, GLuint value)
-{
- d_3_3_Deprecated->f.VertexP4ui(type, value);
-}
-
-inline void QOpenGLFunctions_4_5_Compatibility::glVertexP3uiv(GLenum type, const GLuint *value)
-{
- d_3_3_Deprecated->f.VertexP3uiv(type, value);
-}
-
-inline void QOpenGLFunctions_4_5_Compatibility::glVertexP3ui(GLenum type, GLuint value)
-{
- d_3_3_Deprecated->f.VertexP3ui(type, value);
-}
-
-inline void QOpenGLFunctions_4_5_Compatibility::glVertexP2uiv(GLenum type, const GLuint *value)
-{
- d_3_3_Deprecated->f.VertexP2uiv(type, value);
-}
-
-inline void QOpenGLFunctions_4_5_Compatibility::glVertexP2ui(GLenum type, GLuint value)
-{
- d_3_3_Deprecated->f.VertexP2ui(type, value);
-}
-
-
-// OpenGL 4.0 deprecated functions
-
-// OpenGL 4.1 deprecated functions
-
-// OpenGL 4.2 deprecated functions
-
-// OpenGL 4.3 deprecated functions
-
-// OpenGL 4.4 deprecated functions
-
-// OpenGL 4.5 deprecated functions
-inline void QOpenGLFunctions_4_5_Compatibility::glGetnMinmax(GLenum target, GLboolean reset, GLenum format, GLenum type, GLsizei bufSize, void *values)
-{
- d_4_5_Deprecated->f.GetnMinmax(target, reset, format, type, bufSize, values);
-}
-
-inline void QOpenGLFunctions_4_5_Compatibility::glGetnHistogram(GLenum target, GLboolean reset, GLenum format, GLenum type, GLsizei bufSize, void *values)
-{
- d_4_5_Deprecated->f.GetnHistogram(target, reset, format, type, bufSize, values);
-}
-
-inline void QOpenGLFunctions_4_5_Compatibility::glGetnSeparableFilter(GLenum target, GLenum format, GLenum type, GLsizei rowBufSize, void *row, GLsizei columnBufSize, void *column, void *span)
-{
- d_4_5_Deprecated->f.GetnSeparableFilter(target, format, type, rowBufSize, row, columnBufSize, column, span);
-}
-
-inline void QOpenGLFunctions_4_5_Compatibility::glGetnConvolutionFilter(GLenum target, GLenum format, GLenum type, GLsizei bufSize, void *image)
-{
- d_4_5_Deprecated->f.GetnConvolutionFilter(target, format, type, bufSize, image);
-}
-
-inline void QOpenGLFunctions_4_5_Compatibility::glGetnColorTable(GLenum target, GLenum format, GLenum type, GLsizei bufSize, void *table)
-{
- d_4_5_Deprecated->f.GetnColorTable(target, format, type, bufSize, table);
-}
-
-inline void QOpenGLFunctions_4_5_Compatibility::glGetnPolygonStipple(GLsizei bufSize, GLubyte *pattern)
-{
- d_4_5_Deprecated->f.GetnPolygonStipple(bufSize, pattern);
-}
-
-inline void QOpenGLFunctions_4_5_Compatibility::glGetnPixelMapusv(GLenum map, GLsizei bufSize, GLushort *values)
-{
- d_4_5_Deprecated->f.GetnPixelMapusv(map, bufSize, values);
-}
-
-inline void QOpenGLFunctions_4_5_Compatibility::glGetnPixelMapuiv(GLenum map, GLsizei bufSize, GLuint *values)
-{
- d_4_5_Deprecated->f.GetnPixelMapuiv(map, bufSize, values);
-}
-
-inline void QOpenGLFunctions_4_5_Compatibility::glGetnPixelMapfv(GLenum map, GLsizei bufSize, GLfloat *values)
-{
- d_4_5_Deprecated->f.GetnPixelMapfv(map, bufSize, values);
-}
-
-inline void QOpenGLFunctions_4_5_Compatibility::glGetnMapiv(GLenum target, GLenum query, GLsizei bufSize, GLint *v)
-{
- d_4_5_Deprecated->f.GetnMapiv(target, query, bufSize, v);
-}
-
-inline void QOpenGLFunctions_4_5_Compatibility::glGetnMapfv(GLenum target, GLenum query, GLsizei bufSize, GLfloat *v)
-{
- d_4_5_Deprecated->f.GetnMapfv(target, query, bufSize, v);
-}
-
-inline void QOpenGLFunctions_4_5_Compatibility::glGetnMapdv(GLenum target, GLenum query, GLsizei bufSize, GLdouble *v)
-{
- d_4_5_Deprecated->f.GetnMapdv(target, query, bufSize, v);
-}
-
-
-
-QT_END_NAMESPACE
-
-#ifdef Q_OS_WIN
-#pragma pop_macro("MemoryBarrier")
-#endif
-
-#endif // QT_NO_OPENGL && !QT_OPENGL_ES_2
-
-#endif
diff --git a/src/gui/opengl/qopenglfunctions_4_5_core.cpp b/src/gui/opengl/qopenglfunctions_4_5_core.cpp
deleted file mode 100644
index 9c0369e5f2..0000000000
--- a/src/gui/opengl/qopenglfunctions_4_5_core.cpp
+++ /dev/null
@@ -1,278 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2015 Klaralvdalens Datakonsult AB (KDAB)
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the QtGui module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-**
-** This file was generated by glgen version 0.1
-** Command line was: glgen
-**
-** glgen is Copyright (C) 2013 Klaralvdalens Datakonsult AB (KDAB)
-**
-** This is an auto-generated file.
-** Do not edit! All changes made to it will be lost.
-**
-****************************************************************************/
-
-#include "qopenglfunctions_4_5_core.h"
-#include "qopenglcontext.h"
-
-QT_BEGIN_NAMESPACE
-
-/*!
- \class QOpenGLFunctions_4_5_Core
- \inmodule QtGui
- \since 5.5
- \wrapper
- \brief The QOpenGLFunctions_4_5_Core class provides all functions for OpenGL 4.5 core profile.
-
- This class is a wrapper for functions from OpenGL 4.5 core profile.
- See reference pages on \l {http://www.opengl.org/sdk/docs/}{opengl.org}
- for function documentation.
-
- \sa QAbstractOpenGLFunctions
-*/
-
-QOpenGLFunctions_4_5_Core::QOpenGLFunctions_4_5_Core()
- : QAbstractOpenGLFunctions()
- , d_1_0_Core(nullptr)
- , d_1_1_Core(nullptr)
- , d_1_2_Core(nullptr)
- , d_1_3_Core(nullptr)
- , d_1_4_Core(nullptr)
- , d_1_5_Core(nullptr)
- , d_2_0_Core(nullptr)
- , d_2_1_Core(nullptr)
- , d_3_0_Core(nullptr)
- , d_3_1_Core(nullptr)
- , d_3_2_Core(nullptr)
- , d_3_3_Core(nullptr)
- , d_4_0_Core(nullptr)
- , d_4_1_Core(nullptr)
- , d_4_2_Core(nullptr)
- , d_4_3_Core(nullptr)
- , d_4_4_Core(nullptr)
- , d_4_5_Core(nullptr)
-{
-}
-
-QOpenGLFunctions_4_5_Core::~QOpenGLFunctions_4_5_Core()
-{
- if (d_1_0_Core) {
- d_1_0_Core->refs.deref();
- Q_ASSERT(d_1_0_Core->refs.loadRelaxed());
- }
- if (d_1_1_Core) {
- d_1_1_Core->refs.deref();
- Q_ASSERT(d_1_1_Core->refs.loadRelaxed());
- }
- if (d_1_2_Core) {
- d_1_2_Core->refs.deref();
- Q_ASSERT(d_1_2_Core->refs.loadRelaxed());
- }
- if (d_1_3_Core) {
- d_1_3_Core->refs.deref();
- Q_ASSERT(d_1_3_Core->refs.loadRelaxed());
- }
- if (d_1_4_Core) {
- d_1_4_Core->refs.deref();
- Q_ASSERT(d_1_4_Core->refs.loadRelaxed());
- }
- if (d_1_5_Core) {
- d_1_5_Core->refs.deref();
- Q_ASSERT(d_1_5_Core->refs.loadRelaxed());
- }
- if (d_2_0_Core) {
- d_2_0_Core->refs.deref();
- Q_ASSERT(d_2_0_Core->refs.loadRelaxed());
- }
- if (d_2_1_Core) {
- d_2_1_Core->refs.deref();
- Q_ASSERT(d_2_1_Core->refs.loadRelaxed());
- }
- if (d_3_0_Core) {
- d_3_0_Core->refs.deref();
- Q_ASSERT(d_3_0_Core->refs.loadRelaxed());
- }
- if (d_3_1_Core) {
- d_3_1_Core->refs.deref();
- Q_ASSERT(d_3_1_Core->refs.loadRelaxed());
- }
- if (d_3_2_Core) {
- d_3_2_Core->refs.deref();
- Q_ASSERT(d_3_2_Core->refs.loadRelaxed());
- }
- if (d_3_3_Core) {
- d_3_3_Core->refs.deref();
- Q_ASSERT(d_3_3_Core->refs.loadRelaxed());
- }
- if (d_4_0_Core) {
- d_4_0_Core->refs.deref();
- Q_ASSERT(d_4_0_Core->refs.loadRelaxed());
- }
- if (d_4_1_Core) {
- d_4_1_Core->refs.deref();
- Q_ASSERT(d_4_1_Core->refs.loadRelaxed());
- }
- if (d_4_2_Core) {
- d_4_2_Core->refs.deref();
- Q_ASSERT(d_4_2_Core->refs.loadRelaxed());
- }
- if (d_4_3_Core) {
- d_4_3_Core->refs.deref();
- Q_ASSERT(d_4_3_Core->refs.loadRelaxed());
- }
- if (d_4_4_Core) {
- d_4_4_Core->refs.deref();
- Q_ASSERT(d_4_4_Core->refs.loadRelaxed());
- }
- if (d_4_5_Core) {
- d_4_5_Core->refs.deref();
- Q_ASSERT(d_4_5_Core->refs.loadRelaxed());
- }
-}
-
-bool QOpenGLFunctions_4_5_Core::initializeOpenGLFunctions()
-{
- if ( isInitialized() )
- return true;
-
- QOpenGLContext* context = QOpenGLContext::currentContext();
-
- // If owned by a context object make sure it is current.
- // Also check that current context is capable of resolving all needed functions
- if (((owningContext() && owningContext() == context) || !owningContext())
- && QOpenGLFunctions_4_5_Core::isContextCompatible(context))
- {
- // Associate with private implementation, creating if necessary
- // Function pointers in the backends are resolved at creation time
- QOpenGLVersionFunctionsBackend* d = nullptr;
- d = QAbstractOpenGLFunctionsPrivate::functionsBackend(context, QOpenGLFunctions_1_0_CoreBackend::versionStatus());
- d_1_0_Core = static_cast<QOpenGLFunctions_1_0_CoreBackend*>(d);
- d->refs.ref();
-
- d = QAbstractOpenGLFunctionsPrivate::functionsBackend(context, QOpenGLFunctions_1_1_CoreBackend::versionStatus());
- d_1_1_Core = static_cast<QOpenGLFunctions_1_1_CoreBackend*>(d);
- d->refs.ref();
-
- d = QAbstractOpenGLFunctionsPrivate::functionsBackend(context, QOpenGLFunctions_1_2_CoreBackend::versionStatus());
- d_1_2_Core = static_cast<QOpenGLFunctions_1_2_CoreBackend*>(d);
- d->refs.ref();
-
- d = QAbstractOpenGLFunctionsPrivate::functionsBackend(context, QOpenGLFunctions_1_3_CoreBackend::versionStatus());
- d_1_3_Core = static_cast<QOpenGLFunctions_1_3_CoreBackend*>(d);
- d->refs.ref();
-
- d = QAbstractOpenGLFunctionsPrivate::functionsBackend(context, QOpenGLFunctions_1_4_CoreBackend::versionStatus());
- d_1_4_Core = static_cast<QOpenGLFunctions_1_4_CoreBackend*>(d);
- d->refs.ref();
-
- d = QAbstractOpenGLFunctionsPrivate::functionsBackend(context, QOpenGLFunctions_1_5_CoreBackend::versionStatus());
- d_1_5_Core = static_cast<QOpenGLFunctions_1_5_CoreBackend*>(d);
- d->refs.ref();
-
- d = QAbstractOpenGLFunctionsPrivate::functionsBackend(context, QOpenGLFunctions_2_0_CoreBackend::versionStatus());
- d_2_0_Core = static_cast<QOpenGLFunctions_2_0_CoreBackend*>(d);
- d->refs.ref();
-
- d = QAbstractOpenGLFunctionsPrivate::functionsBackend(context, QOpenGLFunctions_2_1_CoreBackend::versionStatus());
- d_2_1_Core = static_cast<QOpenGLFunctions_2_1_CoreBackend*>(d);
- d->refs.ref();
-
- d = QAbstractOpenGLFunctionsPrivate::functionsBackend(context, QOpenGLFunctions_3_0_CoreBackend::versionStatus());
- d_3_0_Core = static_cast<QOpenGLFunctions_3_0_CoreBackend*>(d);
- d->refs.ref();
-
- d = QAbstractOpenGLFunctionsPrivate::functionsBackend(context, QOpenGLFunctions_3_1_CoreBackend::versionStatus());
- d_3_1_Core = static_cast<QOpenGLFunctions_3_1_CoreBackend*>(d);
- d->refs.ref();
-
- d = QAbstractOpenGLFunctionsPrivate::functionsBackend(context, QOpenGLFunctions_3_2_CoreBackend::versionStatus());
- d_3_2_Core = static_cast<QOpenGLFunctions_3_2_CoreBackend*>(d);
- d->refs.ref();
-
- d = QAbstractOpenGLFunctionsPrivate::functionsBackend(context, QOpenGLFunctions_3_3_CoreBackend::versionStatus());
- d_3_3_Core = static_cast<QOpenGLFunctions_3_3_CoreBackend*>(d);
- d->refs.ref();
-
- d = QAbstractOpenGLFunctionsPrivate::functionsBackend(context, QOpenGLFunctions_4_0_CoreBackend::versionStatus());
- d_4_0_Core = static_cast<QOpenGLFunctions_4_0_CoreBackend*>(d);
- d->refs.ref();
-
- d = QAbstractOpenGLFunctionsPrivate::functionsBackend(context, QOpenGLFunctions_4_1_CoreBackend::versionStatus());
- d_4_1_Core = static_cast<QOpenGLFunctions_4_1_CoreBackend*>(d);
- d->refs.ref();
-
- d = QAbstractOpenGLFunctionsPrivate::functionsBackend(context, QOpenGLFunctions_4_2_CoreBackend::versionStatus());
- d_4_2_Core = static_cast<QOpenGLFunctions_4_2_CoreBackend*>(d);
- d->refs.ref();
-
- d = QAbstractOpenGLFunctionsPrivate::functionsBackend(context, QOpenGLFunctions_4_3_CoreBackend::versionStatus());
- d_4_3_Core = static_cast<QOpenGLFunctions_4_3_CoreBackend*>(d);
- d->refs.ref();
-
- d = QAbstractOpenGLFunctionsPrivate::functionsBackend(context, QOpenGLFunctions_4_4_CoreBackend::versionStatus());
- d_4_4_Core = static_cast<QOpenGLFunctions_4_4_CoreBackend*>(d);
- d->refs.ref();
-
- d = QAbstractOpenGLFunctionsPrivate::functionsBackend(context, QOpenGLFunctions_4_5_CoreBackend::versionStatus());
- d_4_5_Core = static_cast<QOpenGLFunctions_4_5_CoreBackend*>(d);
- d->refs.ref();
-
- QAbstractOpenGLFunctions::initializeOpenGLFunctions();
- }
- return isInitialized();
-}
-
-bool QOpenGLFunctions_4_5_Core::isContextCompatible(QOpenGLContext *context)
-{
- Q_ASSERT(context);
- QSurfaceFormat f = context->format();
- const QPair<int, int> v = qMakePair(f.majorVersion(), f.minorVersion());
- if (v < qMakePair(4, 5))
- return false;
-
- return true;
-}
-
-QOpenGLVersionProfile QOpenGLFunctions_4_5_Core::versionProfile()
-{
- QOpenGLVersionProfile v;
- v.setVersion(4, 5);
- v.setProfile(QSurfaceFormat::CoreProfile);
- return v;
-}
-
-QT_END_NAMESPACE
diff --git a/src/gui/opengl/qopenglfunctions_4_5_core.h b/src/gui/opengl/qopenglfunctions_4_5_core.h
deleted file mode 100644
index bf872c628b..0000000000
--- a/src/gui/opengl/qopenglfunctions_4_5_core.h
+++ /dev/null
@@ -1,4072 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2015 Klaralvdalens Datakonsult AB (KDAB)
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the QtGui module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-**
-** This file was generated by glgen version 0.1
-** Command line was: glgen
-**
-** glgen is Copyright (C) 2013 Klaralvdalens Datakonsult AB (KDAB)
-**
-** This is an auto-generated file.
-** Do not edit! All changes made to it will be lost.
-**
-****************************************************************************/
-
-#ifndef QOPENGLVERSIONFUNCTIONS_4_5_CORE_H
-#define QOPENGLVERSIONFUNCTIONS_4_5_CORE_H
-
-#include <QtGui/qtguiglobal.h>
-
-#if !defined(QT_NO_OPENGL) && !defined(QT_OPENGL_ES_2)
-
-#include <QtGui/QOpenGLVersionFunctions>
-#include <QtGui/qopenglcontext.h>
-
-// MemoryBarrier is a macro on some architectures on Windows
-#ifdef Q_OS_WIN
-#pragma push_macro("MemoryBarrier")
-#undef MemoryBarrier
-#endif
-
-QT_BEGIN_NAMESPACE
-
-class Q_GUI_EXPORT QOpenGLFunctions_4_5_Core : public QAbstractOpenGLFunctions
-{
-public:
- QOpenGLFunctions_4_5_Core();
- ~QOpenGLFunctions_4_5_Core();
-
- bool initializeOpenGLFunctions() override;
-
- // OpenGL 1.0 core functions
- void glViewport(GLint x, GLint y, GLsizei width, GLsizei height);
- void glDepthRange(GLdouble nearVal, GLdouble farVal);
- GLboolean glIsEnabled(GLenum cap);
- void glGetTexLevelParameteriv(GLenum target, GLint level, GLenum pname, GLint *params);
- void glGetTexLevelParameterfv(GLenum target, GLint level, GLenum pname, GLfloat *params);
- void glGetTexParameteriv(GLenum target, GLenum pname, GLint *params);
- void glGetTexParameterfv(GLenum target, GLenum pname, GLfloat *params);
- void glGetTexImage(GLenum target, GLint level, GLenum format, GLenum type, void *pixels);
- const GLubyte * glGetString(GLenum name);
- void glGetIntegerv(GLenum pname, GLint *data);
- void glGetFloatv(GLenum pname, GLfloat *data);
- GLenum glGetError();
- void glGetDoublev(GLenum pname, GLdouble *data);
- void glGetBooleanv(GLenum pname, GLboolean *data);
- void glReadPixels(GLint x, GLint y, GLsizei width, GLsizei height, GLenum format, GLenum type, void *pixels);
- void glReadBuffer(GLenum src);
- void glPixelStorei(GLenum pname, GLint param);
- void glPixelStoref(GLenum pname, GLfloat param);
- void glDepthFunc(GLenum func);
- void glStencilOp(GLenum fail, GLenum zfail, GLenum zpass);
- void glStencilFunc(GLenum func, GLint ref, GLuint mask);
- void glLogicOp(GLenum opcode);
- void glBlendFunc(GLenum sfactor, GLenum dfactor);
- void glFlush();
- void glFinish();
- void glEnable(GLenum cap);
- void glDisable(GLenum cap);
- void glDepthMask(GLboolean flag);
- void glColorMask(GLboolean red, GLboolean green, GLboolean blue, GLboolean alpha);
- void glStencilMask(GLuint mask);
- void glClearDepth(GLdouble depth);
- void glClearStencil(GLint s);
- void glClearColor(GLfloat red, GLfloat green, GLfloat blue, GLfloat alpha);
- void glClear(GLbitfield mask);
- void glDrawBuffer(GLenum buf);
- void glTexImage2D(GLenum target, GLint level, GLint internalformat, GLsizei width, GLsizei height, GLint border, GLenum format, GLenum type, const void *pixels);
- void glTexImage1D(GLenum target, GLint level, GLint internalformat, GLsizei width, GLint border, GLenum format, GLenum type, const void *pixels);
- void glTexParameteriv(GLenum target, GLenum pname, const GLint *params);
- void glTexParameteri(GLenum target, GLenum pname, GLint param);
- void glTexParameterfv(GLenum target, GLenum pname, const GLfloat *params);
- void glTexParameterf(GLenum target, GLenum pname, GLfloat param);
- void glScissor(GLint x, GLint y, GLsizei width, GLsizei height);
- void glPolygonMode(GLenum face, GLenum mode);
- void glPointSize(GLfloat size);
- void glLineWidth(GLfloat width);
- void glHint(GLenum target, GLenum mode);
- void glFrontFace(GLenum mode);
- void glCullFace(GLenum mode);
-
- // OpenGL 1.1 core functions
- GLboolean glIsTexture(GLuint texture);
- void glGenTextures(GLsizei n, GLuint *textures);
- void glDeleteTextures(GLsizei n, const GLuint *textures);
- void glBindTexture(GLenum target, GLuint texture);
- void glTexSubImage2D(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLenum type, const void *pixels);
- void glTexSubImage1D(GLenum target, GLint level, GLint xoffset, GLsizei width, GLenum format, GLenum type, const void *pixels);
- void glCopyTexSubImage2D(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint x, GLint y, GLsizei width, GLsizei height);
- void glCopyTexSubImage1D(GLenum target, GLint level, GLint xoffset, GLint x, GLint y, GLsizei width);
- void glCopyTexImage2D(GLenum target, GLint level, GLenum internalformat, GLint x, GLint y, GLsizei width, GLsizei height, GLint border);
- void glCopyTexImage1D(GLenum target, GLint level, GLenum internalformat, GLint x, GLint y, GLsizei width, GLint border);
- void glPolygonOffset(GLfloat factor, GLfloat units);
- void glDrawElements(GLenum mode, GLsizei count, GLenum type, const void *indices);
- void glDrawArrays(GLenum mode, GLint first, GLsizei count);
-
- // OpenGL 1.2 core functions
- void glBlendColor(GLfloat red, GLfloat green, GLfloat blue, GLfloat alpha);
- void glBlendEquation(GLenum mode);
- void glCopyTexSubImage3D(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLint x, GLint y, GLsizei width, GLsizei height);
- void glTexSubImage3D(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLenum type, const void *pixels);
- void glTexImage3D(GLenum target, GLint level, GLint internalformat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLenum format, GLenum type, const void *pixels);
- void glDrawRangeElements(GLenum mode, GLuint start, GLuint end, GLsizei count, GLenum type, const void *indices);
-
- // OpenGL 1.3 core functions
- void glGetCompressedTexImage(GLenum target, GLint level, void *img);
- void glCompressedTexSubImage1D(GLenum target, GLint level, GLint xoffset, GLsizei width, GLenum format, GLsizei imageSize, const void *data);
- void glCompressedTexSubImage2D(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLsizei imageSize, const void *data);
- void glCompressedTexSubImage3D(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLsizei imageSize, const void *data);
- void glCompressedTexImage1D(GLenum target, GLint level, GLenum internalformat, GLsizei width, GLint border, GLsizei imageSize, const void *data);
- void glCompressedTexImage2D(GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLint border, GLsizei imageSize, const void *data);
- void glCompressedTexImage3D(GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLsizei imageSize, const void *data);
- void glSampleCoverage(GLfloat value, GLboolean invert);
- void glActiveTexture(GLenum texture);
-
- // OpenGL 1.4 core functions
- void glPointParameteriv(GLenum pname, const GLint *params);
- void glPointParameteri(GLenum pname, GLint param);
- void glPointParameterfv(GLenum pname, const GLfloat *params);
- void glPointParameterf(GLenum pname, GLfloat param);
- void glMultiDrawElements(GLenum mode, const GLsizei *count, GLenum type, const void *const *indices, GLsizei drawcount);
- void glMultiDrawArrays(GLenum mode, const GLint *first, const GLsizei *count, GLsizei drawcount);
- void glBlendFuncSeparate(GLenum sfactorRGB, GLenum dfactorRGB, GLenum sfactorAlpha, GLenum dfactorAlpha);
-
- // OpenGL 1.5 core functions
- void glGetBufferPointerv(GLenum target, GLenum pname, void * *params);
- void glGetBufferParameteriv(GLenum target, GLenum pname, GLint *params);
- GLboolean glUnmapBuffer(GLenum target);
- void * glMapBuffer(GLenum target, GLenum access);
- void glGetBufferSubData(GLenum target, GLintptr offset, GLsizeiptr size, void *data);
- void glBufferSubData(GLenum target, GLintptr offset, GLsizeiptr size, const void *data);
- void glBufferData(GLenum target, GLsizeiptr size, const void *data, GLenum usage);
- GLboolean glIsBuffer(GLuint buffer);
- void glGenBuffers(GLsizei n, GLuint *buffers);
- void glDeleteBuffers(GLsizei n, const GLuint *buffers);
- void glBindBuffer(GLenum target, GLuint buffer);
- void glGetQueryObjectuiv(GLuint id, GLenum pname, GLuint *params);
- void glGetQueryObjectiv(GLuint id, GLenum pname, GLint *params);
- void glGetQueryiv(GLenum target, GLenum pname, GLint *params);
- void glEndQuery(GLenum target);
- void glBeginQuery(GLenum target, GLuint id);
- GLboolean glIsQuery(GLuint id);
- void glDeleteQueries(GLsizei n, const GLuint *ids);
- void glGenQueries(GLsizei n, GLuint *ids);
-
- // OpenGL 2.0 core functions
- void glVertexAttribPointer(GLuint index, GLint size, GLenum type, GLboolean normalized, GLsizei stride, const void *pointer);
- void glVertexAttrib4usv(GLuint index, const GLushort *v);
- void glVertexAttrib4uiv(GLuint index, const GLuint *v);
- void glVertexAttrib4ubv(GLuint index, const GLubyte *v);
- void glVertexAttrib4sv(GLuint index, const GLshort *v);
- void glVertexAttrib4s(GLuint index, GLshort x, GLshort y, GLshort z, GLshort w);
- void glVertexAttrib4iv(GLuint index, const GLint *v);
- void glVertexAttrib4fv(GLuint index, const GLfloat *v);
- void glVertexAttrib4f(GLuint index, GLfloat x, GLfloat y, GLfloat z, GLfloat w);
- void glVertexAttrib4dv(GLuint index, const GLdouble *v);
- void glVertexAttrib4d(GLuint index, GLdouble x, GLdouble y, GLdouble z, GLdouble w);
- void glVertexAttrib4bv(GLuint index, const GLbyte *v);
- void glVertexAttrib4Nusv(GLuint index, const GLushort *v);
- void glVertexAttrib4Nuiv(GLuint index, const GLuint *v);
- void glVertexAttrib4Nubv(GLuint index, const GLubyte *v);
- void glVertexAttrib4Nub(GLuint index, GLubyte x, GLubyte y, GLubyte z, GLubyte w);
- void glVertexAttrib4Nsv(GLuint index, const GLshort *v);
- void glVertexAttrib4Niv(GLuint index, const GLint *v);
- void glVertexAttrib4Nbv(GLuint index, const GLbyte *v);
- void glVertexAttrib3sv(GLuint index, const GLshort *v);
- void glVertexAttrib3s(GLuint index, GLshort x, GLshort y, GLshort z);
- void glVertexAttrib3fv(GLuint index, const GLfloat *v);
- void glVertexAttrib3f(GLuint index, GLfloat x, GLfloat y, GLfloat z);
- void glVertexAttrib3dv(GLuint index, const GLdouble *v);
- void glVertexAttrib3d(GLuint index, GLdouble x, GLdouble y, GLdouble z);
- void glVertexAttrib2sv(GLuint index, const GLshort *v);
- void glVertexAttrib2s(GLuint index, GLshort x, GLshort y);
- void glVertexAttrib2fv(GLuint index, const GLfloat *v);
- void glVertexAttrib2f(GLuint index, GLfloat x, GLfloat y);
- void glVertexAttrib2dv(GLuint index, const GLdouble *v);
- void glVertexAttrib2d(GLuint index, GLdouble x, GLdouble y);
- void glVertexAttrib1sv(GLuint index, const GLshort *v);
- void glVertexAttrib1s(GLuint index, GLshort x);
- void glVertexAttrib1fv(GLuint index, const GLfloat *v);
- void glVertexAttrib1f(GLuint index, GLfloat x);
- void glVertexAttrib1dv(GLuint index, const GLdouble *v);
- void glVertexAttrib1d(GLuint index, GLdouble x);
- void glValidateProgram(GLuint program);
- void glUniformMatrix4fv(GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
- void glUniformMatrix3fv(GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
- void glUniformMatrix2fv(GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
- void glUniform4iv(GLint location, GLsizei count, const GLint *value);
- void glUniform3iv(GLint location, GLsizei count, const GLint *value);
- void glUniform2iv(GLint location, GLsizei count, const GLint *value);
- void glUniform1iv(GLint location, GLsizei count, const GLint *value);
- void glUniform4fv(GLint location, GLsizei count, const GLfloat *value);
- void glUniform3fv(GLint location, GLsizei count, const GLfloat *value);
- void glUniform2fv(GLint location, GLsizei count, const GLfloat *value);
- void glUniform1fv(GLint location, GLsizei count, const GLfloat *value);
- void glUniform4i(GLint location, GLint v0, GLint v1, GLint v2, GLint v3);
- void glUniform3i(GLint location, GLint v0, GLint v1, GLint v2);
- void glUniform2i(GLint location, GLint v0, GLint v1);
- void glUniform1i(GLint location, GLint v0);
- void glUniform4f(GLint location, GLfloat v0, GLfloat v1, GLfloat v2, GLfloat v3);
- void glUniform3f(GLint location, GLfloat v0, GLfloat v1, GLfloat v2);
- void glUniform2f(GLint location, GLfloat v0, GLfloat v1);
- void glUniform1f(GLint location, GLfloat v0);
- void glUseProgram(GLuint program);
- void glShaderSource(GLuint shader, GLsizei count, const GLchar* const *string, const GLint *length);
- void glLinkProgram(GLuint program);
- GLboolean glIsShader(GLuint shader);
- GLboolean glIsProgram(GLuint program);
- void glGetVertexAttribPointerv(GLuint index, GLenum pname, void * *pointer);
- void glGetVertexAttribiv(GLuint index, GLenum pname, GLint *params);
- void glGetVertexAttribfv(GLuint index, GLenum pname, GLfloat *params);
- void glGetVertexAttribdv(GLuint index, GLenum pname, GLdouble *params);
- void glGetUniformiv(GLuint program, GLint location, GLint *params);
- void glGetUniformfv(GLuint program, GLint location, GLfloat *params);
- GLint glGetUniformLocation(GLuint program, const GLchar *name);
- void glGetShaderSource(GLuint shader, GLsizei bufSize, GLsizei *length, GLchar *source);
- void glGetShaderInfoLog(GLuint shader, GLsizei bufSize, GLsizei *length, GLchar *infoLog);
- void glGetShaderiv(GLuint shader, GLenum pname, GLint *params);
- void glGetProgramInfoLog(GLuint program, GLsizei bufSize, GLsizei *length, GLchar *infoLog);
- void glGetProgramiv(GLuint program, GLenum pname, GLint *params);
- GLint glGetAttribLocation(GLuint program, const GLchar *name);
- void glGetAttachedShaders(GLuint program, GLsizei maxCount, GLsizei *count, GLuint *shaders);
- void glGetActiveUniform(GLuint program, GLuint index, GLsizei bufSize, GLsizei *length, GLint *size, GLenum *type, GLchar *name);
- void glGetActiveAttrib(GLuint program, GLuint index, GLsizei bufSize, GLsizei *length, GLint *size, GLenum *type, GLchar *name);
- void glEnableVertexAttribArray(GLuint index);
- void glDisableVertexAttribArray(GLuint index);
- void glDetachShader(GLuint program, GLuint shader);
- void glDeleteShader(GLuint shader);
- void glDeleteProgram(GLuint program);
- GLuint glCreateShader(GLenum type);
- GLuint glCreateProgram();
- void glCompileShader(GLuint shader);
- void glBindAttribLocation(GLuint program, GLuint index, const GLchar *name);
- void glAttachShader(GLuint program, GLuint shader);
- void glStencilMaskSeparate(GLenum face, GLuint mask);
- void glStencilFuncSeparate(GLenum face, GLenum func, GLint ref, GLuint mask);
- void glStencilOpSeparate(GLenum face, GLenum sfail, GLenum dpfail, GLenum dppass);
- void glDrawBuffers(GLsizei n, const GLenum *bufs);
- void glBlendEquationSeparate(GLenum modeRGB, GLenum modeAlpha);
-
- // OpenGL 2.1 core functions
- void glUniformMatrix4x3fv(GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
- void glUniformMatrix3x4fv(GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
- void glUniformMatrix4x2fv(GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
- void glUniformMatrix2x4fv(GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
- void glUniformMatrix3x2fv(GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
- void glUniformMatrix2x3fv(GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
-
- // OpenGL 3.0 core functions
- GLboolean glIsVertexArray(GLuint array);
- void glGenVertexArrays(GLsizei n, GLuint *arrays);
- void glDeleteVertexArrays(GLsizei n, const GLuint *arrays);
- void glBindVertexArray(GLuint array);
- void glFlushMappedBufferRange(GLenum target, GLintptr offset, GLsizeiptr length);
- void * glMapBufferRange(GLenum target, GLintptr offset, GLsizeiptr length, GLbitfield access);
- void glFramebufferTextureLayer(GLenum target, GLenum attachment, GLuint texture, GLint level, GLint layer);
- void glRenderbufferStorageMultisample(GLenum target, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height);
- void glBlitFramebuffer(GLint srcX0, GLint srcY0, GLint srcX1, GLint srcY1, GLint dstX0, GLint dstY0, GLint dstX1, GLint dstY1, GLbitfield mask, GLenum filter);
- void glGenerateMipmap(GLenum target);
- void glGetFramebufferAttachmentParameteriv(GLenum target, GLenum attachment, GLenum pname, GLint *params);
- void glFramebufferRenderbuffer(GLenum target, GLenum attachment, GLenum renderbuffertarget, GLuint renderbuffer);
- void glFramebufferTexture3D(GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level, GLint zoffset);
- void glFramebufferTexture2D(GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level);
- void glFramebufferTexture1D(GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level);
- GLenum glCheckFramebufferStatus(GLenum target);
- void glGenFramebuffers(GLsizei n, GLuint *framebuffers);
- void glDeleteFramebuffers(GLsizei n, const GLuint *framebuffers);
- void glBindFramebuffer(GLenum target, GLuint framebuffer);
- GLboolean glIsFramebuffer(GLuint framebuffer);
- void glGetRenderbufferParameteriv(GLenum target, GLenum pname, GLint *params);
- void glRenderbufferStorage(GLenum target, GLenum internalformat, GLsizei width, GLsizei height);
- void glGenRenderbuffers(GLsizei n, GLuint *renderbuffers);
- void glDeleteRenderbuffers(GLsizei n, const GLuint *renderbuffers);
- void glBindRenderbuffer(GLenum target, GLuint renderbuffer);
- GLboolean glIsRenderbuffer(GLuint renderbuffer);
- const GLubyte * glGetStringi(GLenum name, GLuint index);
- void glClearBufferfi(GLenum buffer, GLint drawbuffer, GLfloat depth, GLint stencil);
- void glClearBufferfv(GLenum buffer, GLint drawbuffer, const GLfloat *value);
- void glClearBufferuiv(GLenum buffer, GLint drawbuffer, const GLuint *value);
- void glClearBufferiv(GLenum buffer, GLint drawbuffer, const GLint *value);
- void glGetTexParameterIuiv(GLenum target, GLenum pname, GLuint *params);
- void glGetTexParameterIiv(GLenum target, GLenum pname, GLint *params);
- void glTexParameterIuiv(GLenum target, GLenum pname, const GLuint *params);
- void glTexParameterIiv(GLenum target, GLenum pname, const GLint *params);
- void glUniform4uiv(GLint location, GLsizei count, const GLuint *value);
- void glUniform3uiv(GLint location, GLsizei count, const GLuint *value);
- void glUniform2uiv(GLint location, GLsizei count, const GLuint *value);
- void glUniform1uiv(GLint location, GLsizei count, const GLuint *value);
- void glUniform4ui(GLint location, GLuint v0, GLuint v1, GLuint v2, GLuint v3);
- void glUniform3ui(GLint location, GLuint v0, GLuint v1, GLuint v2);
- void glUniform2ui(GLint location, GLuint v0, GLuint v1);
- void glUniform1ui(GLint location, GLuint v0);
- GLint glGetFragDataLocation(GLuint program, const GLchar *name);
- void glBindFragDataLocation(GLuint program, GLuint color, const GLchar *name);
- void glGetUniformuiv(GLuint program, GLint location, GLuint *params);
- void glVertexAttribI4usv(GLuint index, const GLushort *v);
- void glVertexAttribI4ubv(GLuint index, const GLubyte *v);
- void glVertexAttribI4sv(GLuint index, const GLshort *v);
- void glVertexAttribI4bv(GLuint index, const GLbyte *v);
- void glVertexAttribI4uiv(GLuint index, const GLuint *v);
- void glVertexAttribI3uiv(GLuint index, const GLuint *v);
- void glVertexAttribI2uiv(GLuint index, const GLuint *v);
- void glVertexAttribI1uiv(GLuint index, const GLuint *v);
- void glVertexAttribI4iv(GLuint index, const GLint *v);
- void glVertexAttribI3iv(GLuint index, const GLint *v);
- void glVertexAttribI2iv(GLuint index, const GLint *v);
- void glVertexAttribI1iv(GLuint index, const GLint *v);
- void glVertexAttribI4ui(GLuint index, GLuint x, GLuint y, GLuint z, GLuint w);
- void glVertexAttribI3ui(GLuint index, GLuint x, GLuint y, GLuint z);
- void glVertexAttribI2ui(GLuint index, GLuint x, GLuint y);
- void glVertexAttribI1ui(GLuint index, GLuint x);
- void glVertexAttribI4i(GLuint index, GLint x, GLint y, GLint z, GLint w);
- void glVertexAttribI3i(GLuint index, GLint x, GLint y, GLint z);
- void glVertexAttribI2i(GLuint index, GLint x, GLint y);
- void glVertexAttribI1i(GLuint index, GLint x);
- void glGetVertexAttribIuiv(GLuint index, GLenum pname, GLuint *params);
- void glGetVertexAttribIiv(GLuint index, GLenum pname, GLint *params);
- void glVertexAttribIPointer(GLuint index, GLint size, GLenum type, GLsizei stride, const void *pointer);
- void glEndConditionalRender();
- void glBeginConditionalRender(GLuint id, GLenum mode);
- void glClampColor(GLenum target, GLenum clamp);
- void glGetTransformFeedbackVarying(GLuint program, GLuint index, GLsizei bufSize, GLsizei *length, GLsizei *size, GLenum *type, GLchar *name);
- void glTransformFeedbackVaryings(GLuint program, GLsizei count, const GLchar* const *varyings, GLenum bufferMode);
- void glBindBufferBase(GLenum target, GLuint index, GLuint buffer);
- void glBindBufferRange(GLenum target, GLuint index, GLuint buffer, GLintptr offset, GLsizeiptr size);
- void glEndTransformFeedback();
- void glBeginTransformFeedback(GLenum primitiveMode);
- GLboolean glIsEnabledi(GLenum target, GLuint index);
- void glDisablei(GLenum target, GLuint index);
- void glEnablei(GLenum target, GLuint index);
- void glGetIntegeri_v(GLenum target, GLuint index, GLint *data);
- void glGetBooleani_v(GLenum target, GLuint index, GLboolean *data);
- void glColorMaski(GLuint index, GLboolean r, GLboolean g, GLboolean b, GLboolean a);
-
- // OpenGL 3.1 core functions
- void glUniformBlockBinding(GLuint program, GLuint uniformBlockIndex, GLuint uniformBlockBinding);
- void glGetActiveUniformBlockName(GLuint program, GLuint uniformBlockIndex, GLsizei bufSize, GLsizei *length, GLchar *uniformBlockName);
- void glGetActiveUniformBlockiv(GLuint program, GLuint uniformBlockIndex, GLenum pname, GLint *params);
- GLuint glGetUniformBlockIndex(GLuint program, const GLchar *uniformBlockName);
- void glGetActiveUniformName(GLuint program, GLuint uniformIndex, GLsizei bufSize, GLsizei *length, GLchar *uniformName);
- void glGetActiveUniformsiv(GLuint program, GLsizei uniformCount, const GLuint *uniformIndices, GLenum pname, GLint *params);
- void glGetUniformIndices(GLuint program, GLsizei uniformCount, const GLchar *const *uniformNames, GLuint *uniformIndices);
- void glCopyBufferSubData(GLenum readTarget, GLenum writeTarget, GLintptr readOffset, GLintptr writeOffset, GLsizeiptr size);
- void glPrimitiveRestartIndex(GLuint index);
- void glTexBuffer(GLenum target, GLenum internalformat, GLuint buffer);
- void glDrawElementsInstanced(GLenum mode, GLsizei count, GLenum type, const void *indices, GLsizei instancecount);
- void glDrawArraysInstanced(GLenum mode, GLint first, GLsizei count, GLsizei instancecount);
-
- // OpenGL 3.2 core functions
- void glSampleMaski(GLuint maskNumber, GLbitfield mask);
- void glGetMultisamplefv(GLenum pname, GLuint index, GLfloat *val);
- void glTexImage3DMultisample(GLenum target, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth, GLboolean fixedsamplelocations);
- void glTexImage2DMultisample(GLenum target, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height, GLboolean fixedsamplelocations);
- void glFramebufferTexture(GLenum target, GLenum attachment, GLuint texture, GLint level);
- void glGetBufferParameteri64v(GLenum target, GLenum pname, GLint64 *params);
- void glGetInteger64i_v(GLenum target, GLuint index, GLint64 *data);
- void glGetSynciv(GLsync sync, GLenum pname, GLsizei bufSize, GLsizei *length, GLint *values);
- void glGetInteger64v(GLenum pname, GLint64 *data);
- void glWaitSync(GLsync sync, GLbitfield flags, GLuint64 timeout);
- GLenum glClientWaitSync(GLsync sync, GLbitfield flags, GLuint64 timeout);
- void glDeleteSync(GLsync sync);
- GLboolean glIsSync(GLsync sync);
- GLsync glFenceSync(GLenum condition, GLbitfield flags);
- void glProvokingVertex(GLenum mode);
- void glMultiDrawElementsBaseVertex(GLenum mode, const GLsizei *count, GLenum type, const void *const *indices, GLsizei drawcount, const GLint *basevertex);
- void glDrawElementsInstancedBaseVertex(GLenum mode, GLsizei count, GLenum type, const void *indices, GLsizei instancecount, GLint basevertex);
- void glDrawRangeElementsBaseVertex(GLenum mode, GLuint start, GLuint end, GLsizei count, GLenum type, const void *indices, GLint basevertex);
- void glDrawElementsBaseVertex(GLenum mode, GLsizei count, GLenum type, const void *indices, GLint basevertex);
-
- // OpenGL 3.3 core functions
- void glVertexAttribP4uiv(GLuint index, GLenum type, GLboolean normalized, const GLuint *value);
- void glVertexAttribP4ui(GLuint index, GLenum type, GLboolean normalized, GLuint value);
- void glVertexAttribP3uiv(GLuint index, GLenum type, GLboolean normalized, const GLuint *value);
- void glVertexAttribP3ui(GLuint index, GLenum type, GLboolean normalized, GLuint value);
- void glVertexAttribP2uiv(GLuint index, GLenum type, GLboolean normalized, const GLuint *value);
- void glVertexAttribP2ui(GLuint index, GLenum type, GLboolean normalized, GLuint value);
- void glVertexAttribP1uiv(GLuint index, GLenum type, GLboolean normalized, const GLuint *value);
- void glVertexAttribP1ui(GLuint index, GLenum type, GLboolean normalized, GLuint value);
- void glVertexAttribDivisor(GLuint index, GLuint divisor);
- void glGetQueryObjectui64v(GLuint id, GLenum pname, GLuint64 *params);
- void glGetQueryObjecti64v(GLuint id, GLenum pname, GLint64 *params);
- void glQueryCounter(GLuint id, GLenum target);
- void glGetSamplerParameterIuiv(GLuint sampler, GLenum pname, GLuint *params);
- void glGetSamplerParameterfv(GLuint sampler, GLenum pname, GLfloat *params);
- void glGetSamplerParameterIiv(GLuint sampler, GLenum pname, GLint *params);
- void glGetSamplerParameteriv(GLuint sampler, GLenum pname, GLint *params);
- void glSamplerParameterIuiv(GLuint sampler, GLenum pname, const GLuint *param);
- void glSamplerParameterIiv(GLuint sampler, GLenum pname, const GLint *param);
- void glSamplerParameterfv(GLuint sampler, GLenum pname, const GLfloat *param);
- void glSamplerParameterf(GLuint sampler, GLenum pname, GLfloat param);
- void glSamplerParameteriv(GLuint sampler, GLenum pname, const GLint *param);
- void glSamplerParameteri(GLuint sampler, GLenum pname, GLint param);
- void glBindSampler(GLuint unit, GLuint sampler);
- GLboolean glIsSampler(GLuint sampler);
- void glDeleteSamplers(GLsizei count, const GLuint *samplers);
- void glGenSamplers(GLsizei count, GLuint *samplers);
- GLint glGetFragDataIndex(GLuint program, const GLchar *name);
- void glBindFragDataLocationIndexed(GLuint program, GLuint colorNumber, GLuint index, const GLchar *name);
-
- // OpenGL 4.0 core functions
- void glGetQueryIndexediv(GLenum target, GLuint index, GLenum pname, GLint *params);
- void glEndQueryIndexed(GLenum target, GLuint index);
- void glBeginQueryIndexed(GLenum target, GLuint index, GLuint id);
- void glDrawTransformFeedbackStream(GLenum mode, GLuint id, GLuint stream);
- void glDrawTransformFeedback(GLenum mode, GLuint id);
- void glResumeTransformFeedback();
- void glPauseTransformFeedback();
- GLboolean glIsTransformFeedback(GLuint id);
- void glGenTransformFeedbacks(GLsizei n, GLuint *ids);
- void glDeleteTransformFeedbacks(GLsizei n, const GLuint *ids);
- void glBindTransformFeedback(GLenum target, GLuint id);
- void glPatchParameterfv(GLenum pname, const GLfloat *values);
- void glPatchParameteri(GLenum pname, GLint value);
- void glGetProgramStageiv(GLuint program, GLenum shadertype, GLenum pname, GLint *values);
- void glGetUniformSubroutineuiv(GLenum shadertype, GLint location, GLuint *params);
- void glUniformSubroutinesuiv(GLenum shadertype, GLsizei count, const GLuint *indices);
- void glGetActiveSubroutineName(GLuint program, GLenum shadertype, GLuint index, GLsizei bufsize, GLsizei *length, GLchar *name);
- void glGetActiveSubroutineUniformName(GLuint program, GLenum shadertype, GLuint index, GLsizei bufsize, GLsizei *length, GLchar *name);
- void glGetActiveSubroutineUniformiv(GLuint program, GLenum shadertype, GLuint index, GLenum pname, GLint *values);
- GLuint glGetSubroutineIndex(GLuint program, GLenum shadertype, const GLchar *name);
- GLint glGetSubroutineUniformLocation(GLuint program, GLenum shadertype, const GLchar *name);
- void glGetUniformdv(GLuint program, GLint location, GLdouble *params);
- void glUniformMatrix4x3dv(GLint location, GLsizei count, GLboolean transpose, const GLdouble *value);
- void glUniformMatrix4x2dv(GLint location, GLsizei count, GLboolean transpose, const GLdouble *value);
- void glUniformMatrix3x4dv(GLint location, GLsizei count, GLboolean transpose, const GLdouble *value);
- void glUniformMatrix3x2dv(GLint location, GLsizei count, GLboolean transpose, const GLdouble *value);
- void glUniformMatrix2x4dv(GLint location, GLsizei count, GLboolean transpose, const GLdouble *value);
- void glUniformMatrix2x3dv(GLint location, GLsizei count, GLboolean transpose, const GLdouble *value);
- void glUniformMatrix4dv(GLint location, GLsizei count, GLboolean transpose, const GLdouble *value);
- void glUniformMatrix3dv(GLint location, GLsizei count, GLboolean transpose, const GLdouble *value);
- void glUniformMatrix2dv(GLint location, GLsizei count, GLboolean transpose, const GLdouble *value);
- void glUniform4dv(GLint location, GLsizei count, const GLdouble *value);
- void glUniform3dv(GLint location, GLsizei count, const GLdouble *value);
- void glUniform2dv(GLint location, GLsizei count, const GLdouble *value);
- void glUniform1dv(GLint location, GLsizei count, const GLdouble *value);
- void glUniform4d(GLint location, GLdouble x, GLdouble y, GLdouble z, GLdouble w);
- void glUniform3d(GLint location, GLdouble x, GLdouble y, GLdouble z);
- void glUniform2d(GLint location, GLdouble x, GLdouble y);
- void glUniform1d(GLint location, GLdouble x);
- void glDrawElementsIndirect(GLenum mode, GLenum type, const void *indirect);
- void glDrawArraysIndirect(GLenum mode, const void *indirect);
- void glBlendFuncSeparatei(GLuint buf, GLenum srcRGB, GLenum dstRGB, GLenum srcAlpha, GLenum dstAlpha);
- void glBlendFunci(GLuint buf, GLenum src, GLenum dst);
- void glBlendEquationSeparatei(GLuint buf, GLenum modeRGB, GLenum modeAlpha);
- void glBlendEquationi(GLuint buf, GLenum mode);
- void glMinSampleShading(GLfloat value);
-
- // OpenGL 4.1 core functions
- void glGetDoublei_v(GLenum target, GLuint index, GLdouble *data);
- void glGetFloati_v(GLenum target, GLuint index, GLfloat *data);
- void glDepthRangeIndexed(GLuint index, GLdouble n, GLdouble f);
- void glDepthRangeArrayv(GLuint first, GLsizei count, const GLdouble *v);
- void glScissorIndexedv(GLuint index, const GLint *v);
- void glScissorIndexed(GLuint index, GLint left, GLint bottom, GLsizei width, GLsizei height);
- void glScissorArrayv(GLuint first, GLsizei count, const GLint *v);
- void glViewportIndexedfv(GLuint index, const GLfloat *v);
- void glViewportIndexedf(GLuint index, GLfloat x, GLfloat y, GLfloat w, GLfloat h);
- void glViewportArrayv(GLuint first, GLsizei count, const GLfloat *v);
- void glGetVertexAttribLdv(GLuint index, GLenum pname, GLdouble *params);
- void glVertexAttribLPointer(GLuint index, GLint size, GLenum type, GLsizei stride, const void *pointer);
- void glVertexAttribL4dv(GLuint index, const GLdouble *v);
- void glVertexAttribL3dv(GLuint index, const GLdouble *v);
- void glVertexAttribL2dv(GLuint index, const GLdouble *v);
- void glVertexAttribL1dv(GLuint index, const GLdouble *v);
- void glVertexAttribL4d(GLuint index, GLdouble x, GLdouble y, GLdouble z, GLdouble w);
- void glVertexAttribL3d(GLuint index, GLdouble x, GLdouble y, GLdouble z);
- void glVertexAttribL2d(GLuint index, GLdouble x, GLdouble y);
- void glVertexAttribL1d(GLuint index, GLdouble x);
- void glGetProgramPipelineInfoLog(GLuint pipeline, GLsizei bufSize, GLsizei *length, GLchar *infoLog);
- void glValidateProgramPipeline(GLuint pipeline);
- void glProgramUniformMatrix4x3dv(GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLdouble *value);
- void glProgramUniformMatrix3x4dv(GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLdouble *value);
- void glProgramUniformMatrix4x2dv(GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLdouble *value);
- void glProgramUniformMatrix2x4dv(GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLdouble *value);
- void glProgramUniformMatrix3x2dv(GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLdouble *value);
- void glProgramUniformMatrix2x3dv(GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLdouble *value);
- void glProgramUniformMatrix4x3fv(GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
- void glProgramUniformMatrix3x4fv(GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
- void glProgramUniformMatrix4x2fv(GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
- void glProgramUniformMatrix2x4fv(GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
- void glProgramUniformMatrix3x2fv(GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
- void glProgramUniformMatrix2x3fv(GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
- void glProgramUniformMatrix4dv(GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLdouble *value);
- void glProgramUniformMatrix3dv(GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLdouble *value);
- void glProgramUniformMatrix2dv(GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLdouble *value);
- void glProgramUniformMatrix4fv(GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
- void glProgramUniformMatrix3fv(GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
- void glProgramUniformMatrix2fv(GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
- void glProgramUniform4uiv(GLuint program, GLint location, GLsizei count, const GLuint *value);
- void glProgramUniform4ui(GLuint program, GLint location, GLuint v0, GLuint v1, GLuint v2, GLuint v3);
- void glProgramUniform4dv(GLuint program, GLint location, GLsizei count, const GLdouble *value);
- void glProgramUniform4d(GLuint program, GLint location, GLdouble v0, GLdouble v1, GLdouble v2, GLdouble v3);
- void glProgramUniform4fv(GLuint program, GLint location, GLsizei count, const GLfloat *value);
- void glProgramUniform4f(GLuint program, GLint location, GLfloat v0, GLfloat v1, GLfloat v2, GLfloat v3);
- void glProgramUniform4iv(GLuint program, GLint location, GLsizei count, const GLint *value);
- void glProgramUniform4i(GLuint program, GLint location, GLint v0, GLint v1, GLint v2, GLint v3);
- void glProgramUniform3uiv(GLuint program, GLint location, GLsizei count, const GLuint *value);
- void glProgramUniform3ui(GLuint program, GLint location, GLuint v0, GLuint v1, GLuint v2);
- void glProgramUniform3dv(GLuint program, GLint location, GLsizei count, const GLdouble *value);
- void glProgramUniform3d(GLuint program, GLint location, GLdouble v0, GLdouble v1, GLdouble v2);
- void glProgramUniform3fv(GLuint program, GLint location, GLsizei count, const GLfloat *value);
- void glProgramUniform3f(GLuint program, GLint location, GLfloat v0, GLfloat v1, GLfloat v2);
- void glProgramUniform3iv(GLuint program, GLint location, GLsizei count, const GLint *value);
- void glProgramUniform3i(GLuint program, GLint location, GLint v0, GLint v1, GLint v2);
- void glProgramUniform2uiv(GLuint program, GLint location, GLsizei count, const GLuint *value);
- void glProgramUniform2ui(GLuint program, GLint location, GLuint v0, GLuint v1);
- void glProgramUniform2dv(GLuint program, GLint location, GLsizei count, const GLdouble *value);
- void glProgramUniform2d(GLuint program, GLint location, GLdouble v0, GLdouble v1);
- void glProgramUniform2fv(GLuint program, GLint location, GLsizei count, const GLfloat *value);
- void glProgramUniform2f(GLuint program, GLint location, GLfloat v0, GLfloat v1);
- void glProgramUniform2iv(GLuint program, GLint location, GLsizei count, const GLint *value);
- void glProgramUniform2i(GLuint program, GLint location, GLint v0, GLint v1);
- void glProgramUniform1uiv(GLuint program, GLint location, GLsizei count, const GLuint *value);
- void glProgramUniform1ui(GLuint program, GLint location, GLuint v0);
- void glProgramUniform1dv(GLuint program, GLint location, GLsizei count, const GLdouble *value);
- void glProgramUniform1d(GLuint program, GLint location, GLdouble v0);
- void glProgramUniform1fv(GLuint program, GLint location, GLsizei count, const GLfloat *value);
- void glProgramUniform1f(GLuint program, GLint location, GLfloat v0);
- void glProgramUniform1iv(GLuint program, GLint location, GLsizei count, const GLint *value);
- void glProgramUniform1i(GLuint program, GLint location, GLint v0);
- void glGetProgramPipelineiv(GLuint pipeline, GLenum pname, GLint *params);
- GLboolean glIsProgramPipeline(GLuint pipeline);
- void glGenProgramPipelines(GLsizei n, GLuint *pipelines);
- void glDeleteProgramPipelines(GLsizei n, const GLuint *pipelines);
- void glBindProgramPipeline(GLuint pipeline);
- GLuint glCreateShaderProgramv(GLenum type, GLsizei count, const GLchar* const *strings);
- void glActiveShaderProgram(GLuint pipeline, GLuint program);
- void glUseProgramStages(GLuint pipeline, GLbitfield stages, GLuint program);
- void glProgramParameteri(GLuint program, GLenum pname, GLint value);
- void glProgramBinary(GLuint program, GLenum binaryFormat, const void *binary, GLsizei length);
- void glGetProgramBinary(GLuint program, GLsizei bufSize, GLsizei *length, GLenum *binaryFormat, void *binary);
- void glClearDepthf(GLfloat dd);
- void glDepthRangef(GLfloat n, GLfloat f);
- void glGetShaderPrecisionFormat(GLenum shadertype, GLenum precisiontype, GLint *range, GLint *precision);
- void glShaderBinary(GLsizei count, const GLuint *shaders, GLenum binaryformat, const void *binary, GLsizei length);
- void glReleaseShaderCompiler();
-
- // OpenGL 4.2 core functions
- void glDrawTransformFeedbackStreamInstanced(GLenum mode, GLuint id, GLuint stream, GLsizei instancecount);
- void glDrawTransformFeedbackInstanced(GLenum mode, GLuint id, GLsizei instancecount);
- void glTexStorage3D(GLenum target, GLsizei levels, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth);
- void glTexStorage2D(GLenum target, GLsizei levels, GLenum internalformat, GLsizei width, GLsizei height);
- void glTexStorage1D(GLenum target, GLsizei levels, GLenum internalformat, GLsizei width);
- void glMemoryBarrier(GLbitfield barriers);
- void glBindImageTexture(GLuint unit, GLuint texture, GLint level, GLboolean layered, GLint layer, GLenum access, GLenum format);
- void glGetActiveAtomicCounterBufferiv(GLuint program, GLuint bufferIndex, GLenum pname, GLint *params);
- void glGetInternalformativ(GLenum target, GLenum internalformat, GLenum pname, GLsizei bufSize, GLint *params);
- void glDrawElementsInstancedBaseVertexBaseInstance(GLenum mode, GLsizei count, GLenum type, const void *indices, GLsizei instancecount, GLint basevertex, GLuint baseinstance);
- void glDrawElementsInstancedBaseInstance(GLenum mode, GLsizei count, GLenum type, const void *indices, GLsizei instancecount, GLuint baseinstance);
- void glDrawArraysInstancedBaseInstance(GLenum mode, GLint first, GLsizei count, GLsizei instancecount, GLuint baseinstance);
-
- // OpenGL 4.3 core functions
- void glGetObjectPtrLabel(const void *ptr, GLsizei bufSize, GLsizei *length, GLchar *label);
- void glObjectPtrLabel(const void *ptr, GLsizei length, const GLchar *label);
- void glGetObjectLabel(GLenum identifier, GLuint name, GLsizei bufSize, GLsizei *length, GLchar *label);
- void glObjectLabel(GLenum identifier, GLuint name, GLsizei length, const GLchar *label);
- void glPopDebugGroup();
- void glPushDebugGroup(GLenum source, GLuint id, GLsizei length, const GLchar *message);
- GLuint glGetDebugMessageLog(GLuint count, GLsizei bufSize, GLenum *sources, GLenum *types, GLuint *ids, GLenum *severities, GLsizei *lengths, GLchar *messageLog);
- void glDebugMessageCallback(GLDEBUGPROC callback, const void *userParam);
- void glDebugMessageInsert(GLenum source, GLenum type, GLuint id, GLenum severity, GLsizei length, const GLchar *buf);
- void glDebugMessageControl(GLenum source, GLenum type, GLenum severity, GLsizei count, const GLuint *ids, GLboolean enabled);
- void glVertexBindingDivisor(GLuint bindingindex, GLuint divisor);
- void glVertexAttribBinding(GLuint attribindex, GLuint bindingindex);
- void glVertexAttribLFormat(GLuint attribindex, GLint size, GLenum type, GLuint relativeoffset);
- void glVertexAttribIFormat(GLuint attribindex, GLint size, GLenum type, GLuint relativeoffset);
- void glVertexAttribFormat(GLuint attribindex, GLint size, GLenum type, GLboolean normalized, GLuint relativeoffset);
- void glBindVertexBuffer(GLuint bindingindex, GLuint buffer, GLintptr offset, GLsizei stride);
- void glTextureView(GLuint texture, GLenum target, GLuint origtexture, GLenum internalformat, GLuint minlevel, GLuint numlevels, GLuint minlayer, GLuint numlayers);
- void glTexStorage3DMultisample(GLenum target, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth, GLboolean fixedsamplelocations);
- void glTexStorage2DMultisample(GLenum target, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height, GLboolean fixedsamplelocations);
- void glTexBufferRange(GLenum target, GLenum internalformat, GLuint buffer, GLintptr offset, GLsizeiptr size);
- void glShaderStorageBlockBinding(GLuint program, GLuint storageBlockIndex, GLuint storageBlockBinding);
- GLint glGetProgramResourceLocationIndex(GLuint program, GLenum programInterface, const GLchar *name);
- GLint glGetProgramResourceLocation(GLuint program, GLenum programInterface, const GLchar *name);
- void glGetProgramResourceiv(GLuint program, GLenum programInterface, GLuint index, GLsizei propCount, const GLenum *props, GLsizei bufSize, GLsizei *length, GLint *params);
- void glGetProgramResourceName(GLuint program, GLenum programInterface, GLuint index, GLsizei bufSize, GLsizei *length, GLchar *name);
- GLuint glGetProgramResourceIndex(GLuint program, GLenum programInterface, const GLchar *name);
- void glGetProgramInterfaceiv(GLuint program, GLenum programInterface, GLenum pname, GLint *params);
- void glMultiDrawElementsIndirect(GLenum mode, GLenum type, const void *indirect, GLsizei drawcount, GLsizei stride);
- void glMultiDrawArraysIndirect(GLenum mode, const void *indirect, GLsizei drawcount, GLsizei stride);
- void glInvalidateSubFramebuffer(GLenum target, GLsizei numAttachments, const GLenum *attachments, GLint x, GLint y, GLsizei width, GLsizei height);
- void glInvalidateFramebuffer(GLenum target, GLsizei numAttachments, const GLenum *attachments);
- void glInvalidateBufferData(GLuint buffer);
- void glInvalidateBufferSubData(GLuint buffer, GLintptr offset, GLsizeiptr length);
- void glInvalidateTexImage(GLuint texture, GLint level);
- void glInvalidateTexSubImage(GLuint texture, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth);
- void glGetInternalformati64v(GLenum target, GLenum internalformat, GLenum pname, GLsizei bufSize, GLint64 *params);
- void glGetFramebufferParameteriv(GLenum target, GLenum pname, GLint *params);
- void glFramebufferParameteri(GLenum target, GLenum pname, GLint param);
- void glCopyImageSubData(GLuint srcName, GLenum srcTarget, GLint srcLevel, GLint srcX, GLint srcY, GLint srcZ, GLuint dstName, GLenum dstTarget, GLint dstLevel, GLint dstX, GLint dstY, GLint dstZ, GLsizei srcWidth, GLsizei srcHeight, GLsizei srcDepth);
- void glDispatchComputeIndirect(GLintptr indirect);
- void glDispatchCompute(GLuint num_groups_x, GLuint num_groups_y, GLuint num_groups_z);
- void glClearBufferSubData(GLenum target, GLenum internalformat, GLintptr offset, GLsizeiptr size, GLenum format, GLenum type, const void *data);
- void glClearBufferData(GLenum target, GLenum internalformat, GLenum format, GLenum type, const void *data);
-
- // OpenGL 4.4 core functions
- void glBindVertexBuffers(GLuint first, GLsizei count, const GLuint *buffers, const GLintptr *offsets, const GLsizei *strides);
- void glBindImageTextures(GLuint first, GLsizei count, const GLuint *textures);
- void glBindSamplers(GLuint first, GLsizei count, const GLuint *samplers);
- void glBindTextures(GLuint first, GLsizei count, const GLuint *textures);
- void glBindBuffersRange(GLenum target, GLuint first, GLsizei count, const GLuint *buffers, const GLintptr *offsets, const GLsizeiptr *sizes);
- void glBindBuffersBase(GLenum target, GLuint first, GLsizei count, const GLuint *buffers);
- void glClearTexSubImage(GLuint texture, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLenum type, const void *data);
- void glClearTexImage(GLuint texture, GLint level, GLenum format, GLenum type, const void *data);
- void glBufferStorage(GLenum target, GLsizeiptr size, const void *data, GLbitfield flags);
-
- // OpenGL 4.5 core functions
- void glTextureBarrier();
- void glReadnPixels(GLint x, GLint y, GLsizei width, GLsizei height, GLenum format, GLenum type, GLsizei bufSize, void *data);
- void glGetnUniformuiv(GLuint program, GLint location, GLsizei bufSize, GLuint *params);
- void glGetnUniformiv(GLuint program, GLint location, GLsizei bufSize, GLint *params);
- void glGetnUniformfv(GLuint program, GLint location, GLsizei bufSize, GLfloat *params);
- void glGetnUniformdv(GLuint program, GLint location, GLsizei bufSize, GLdouble *params);
- void glGetnTexImage(GLenum target, GLint level, GLenum format, GLenum type, GLsizei bufSize, void *pixels);
- void glGetnCompressedTexImage(GLenum target, GLint lod, GLsizei bufSize, void *pixels);
- GLenum glGetGraphicsResetStatus();
- void glGetCompressedTextureSubImage(GLuint texture, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLsizei bufSize, void *pixels);
- void glGetTextureSubImage(GLuint texture, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLenum type, GLsizei bufSize, void *pixels);
- void glMemoryBarrierByRegion(GLbitfield barriers);
- void glCreateQueries(GLenum target, GLsizei n, GLuint *ids);
- void glCreateProgramPipelines(GLsizei n, GLuint *pipelines);
- void glCreateSamplers(GLsizei n, GLuint *samplers);
- void glGetVertexArrayIndexed64iv(GLuint vaobj, GLuint index, GLenum pname, GLint64 *param);
- void glGetVertexArrayIndexediv(GLuint vaobj, GLuint index, GLenum pname, GLint *param);
- void glGetVertexArrayiv(GLuint vaobj, GLenum pname, GLint *param);
- void glVertexArrayBindingDivisor(GLuint vaobj, GLuint bindingindex, GLuint divisor);
- void glVertexArrayAttribLFormat(GLuint vaobj, GLuint attribindex, GLint size, GLenum type, GLuint relativeoffset);
- void glVertexArrayAttribIFormat(GLuint vaobj, GLuint attribindex, GLint size, GLenum type, GLuint relativeoffset);
- void glVertexArrayAttribFormat(GLuint vaobj, GLuint attribindex, GLint size, GLenum type, GLboolean normalized, GLuint relativeoffset);
- void glVertexArrayAttribBinding(GLuint vaobj, GLuint attribindex, GLuint bindingindex);
- void glVertexArrayVertexBuffers(GLuint vaobj, GLuint first, GLsizei count, const GLuint *buffers, const GLintptr *offsets, const GLsizei *strides);
- void glVertexArrayVertexBuffer(GLuint vaobj, GLuint bindingindex, GLuint buffer, GLintptr offset, GLsizei stride);
- void glVertexArrayElementBuffer(GLuint vaobj, GLuint buffer);
- void glEnableVertexArrayAttrib(GLuint vaobj, GLuint index);
- void glDisableVertexArrayAttrib(GLuint vaobj, GLuint index);
- void glCreateVertexArrays(GLsizei n, GLuint *arrays);
- void glGetTextureParameteriv(GLuint texture, GLenum pname, GLint *params);
- void glGetTextureParameterIuiv(GLuint texture, GLenum pname, GLuint *params);
- void glGetTextureParameterIiv(GLuint texture, GLenum pname, GLint *params);
- void glGetTextureParameterfv(GLuint texture, GLenum pname, GLfloat *params);
- void glGetTextureLevelParameteriv(GLuint texture, GLint level, GLenum pname, GLint *params);
- void glGetTextureLevelParameterfv(GLuint texture, GLint level, GLenum pname, GLfloat *params);
- void glGetCompressedTextureImage(GLuint texture, GLint level, GLsizei bufSize, void *pixels);
- void glGetTextureImage(GLuint texture, GLint level, GLenum format, GLenum type, GLsizei bufSize, void *pixels);
- void glBindTextureUnit(GLuint unit, GLuint texture);
- void glGenerateTextureMipmap(GLuint texture);
- void glTextureParameteriv(GLuint texture, GLenum pname, const GLint *param);
- void glTextureParameterIuiv(GLuint texture, GLenum pname, const GLuint *params);
- void glTextureParameterIiv(GLuint texture, GLenum pname, const GLint *params);
- void glTextureParameteri(GLuint texture, GLenum pname, GLint param);
- void glTextureParameterfv(GLuint texture, GLenum pname, const GLfloat *param);
- void glTextureParameterf(GLuint texture, GLenum pname, GLfloat param);
- void glCopyTextureSubImage3D(GLuint texture, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLint x, GLint y, GLsizei width, GLsizei height);
- void glCopyTextureSubImage2D(GLuint texture, GLint level, GLint xoffset, GLint yoffset, GLint x, GLint y, GLsizei width, GLsizei height);
- void glCopyTextureSubImage1D(GLuint texture, GLint level, GLint xoffset, GLint x, GLint y, GLsizei width);
- void glCompressedTextureSubImage3D(GLuint texture, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLsizei imageSize, const void *data);
- void glCompressedTextureSubImage2D(GLuint texture, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLsizei imageSize, const void *data);
- void glCompressedTextureSubImage1D(GLuint texture, GLint level, GLint xoffset, GLsizei width, GLenum format, GLsizei imageSize, const void *data);
- void glTextureSubImage3D(GLuint texture, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLenum type, const void *pixels);
- void glTextureSubImage2D(GLuint texture, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLenum type, const void *pixels);
- void glTextureSubImage1D(GLuint texture, GLint level, GLint xoffset, GLsizei width, GLenum format, GLenum type, const void *pixels);
- void glTextureStorage3DMultisample(GLuint texture, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth, GLboolean fixedsamplelocations);
- void glTextureStorage2DMultisample(GLuint texture, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height, GLboolean fixedsamplelocations);
- void glTextureStorage3D(GLuint texture, GLsizei levels, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth);
- void glTextureStorage2D(GLuint texture, GLsizei levels, GLenum internalformat, GLsizei width, GLsizei height);
- void glTextureStorage1D(GLuint texture, GLsizei levels, GLenum internalformat, GLsizei width);
- void glTextureBufferRange(GLuint texture, GLenum internalformat, GLuint buffer, GLintptr offset, GLsizei size);
- void glTextureBuffer(GLuint texture, GLenum internalformat, GLuint buffer);
- void glCreateTextures(GLenum target, GLsizei n, GLuint *textures);
- void glGetNamedRenderbufferParameteriv(GLuint renderbuffer, GLenum pname, GLint *params);
- void glNamedRenderbufferStorageMultisample(GLuint renderbuffer, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height);
- void glNamedRenderbufferStorage(GLuint renderbuffer, GLenum internalformat, GLsizei width, GLsizei height);
- void glCreateRenderbuffers(GLsizei n, GLuint *renderbuffers);
- void glGetNamedFramebufferAttachmentParameteriv(GLuint framebuffer, GLenum attachment, GLenum pname, GLint *params);
- void glGetNamedFramebufferParameteriv(GLuint framebuffer, GLenum pname, GLint *param);
- GLenum glCheckNamedFramebufferStatus(GLuint framebuffer, GLenum target);
- void glBlitNamedFramebuffer(GLuint readFramebuffer, GLuint drawFramebuffer, GLint srcX0, GLint srcY0, GLint srcX1, GLint srcY1, GLint dstX0, GLint dstY0, GLint dstX1, GLint dstY1, GLbitfield mask, GLenum filter);
- void glClearNamedFramebufferfi(GLuint framebuffer, GLenum buffer, GLfloat depth, GLint stencil);
- void glClearNamedFramebufferfv(GLuint framebuffer, GLenum buffer, GLint drawbuffer, const GLfloat *value);
- void glClearNamedFramebufferuiv(GLuint framebuffer, GLenum buffer, GLint drawbuffer, const GLuint *value);
- void glClearNamedFramebufferiv(GLuint framebuffer, GLenum buffer, GLint drawbuffer, const GLint *value);
- void glInvalidateNamedFramebufferSubData(GLuint framebuffer, GLsizei numAttachments, const GLenum *attachments, GLint x, GLint y, GLsizei width, GLsizei height);
- void glInvalidateNamedFramebufferData(GLuint framebuffer, GLsizei numAttachments, const GLenum *attachments);
- void glNamedFramebufferReadBuffer(GLuint framebuffer, GLenum src);
- void glNamedFramebufferDrawBuffers(GLuint framebuffer, GLsizei n, const GLenum *bufs);
- void glNamedFramebufferDrawBuffer(GLuint framebuffer, GLenum buf);
- void glNamedFramebufferTextureLayer(GLuint framebuffer, GLenum attachment, GLuint texture, GLint level, GLint layer);
- void glNamedFramebufferTexture(GLuint framebuffer, GLenum attachment, GLuint texture, GLint level);
- void glNamedFramebufferParameteri(GLuint framebuffer, GLenum pname, GLint param);
- void glNamedFramebufferRenderbuffer(GLuint framebuffer, GLenum attachment, GLenum renderbuffertarget, GLuint renderbuffer);
- void glCreateFramebuffers(GLsizei n, GLuint *framebuffers);
- void glGetNamedBufferSubData(GLuint buffer, GLintptr offset, GLsizei size, void *data);
- void glGetNamedBufferPointerv(GLuint buffer, GLenum pname, void * *params);
- void glGetNamedBufferParameteri64v(GLuint buffer, GLenum pname, GLint64 *params);
- void glGetNamedBufferParameteriv(GLuint buffer, GLenum pname, GLint *params);
- void glFlushMappedNamedBufferRange(GLuint buffer, GLintptr offset, GLsizei length);
- GLboolean glUnmapNamedBuffer(GLuint buffer);
- void * glMapNamedBufferRange(GLuint buffer, GLintptr offset, GLsizei length, GLbitfield access);
- void * glMapNamedBuffer(GLuint buffer, GLenum access);
- void glClearNamedBufferSubData(GLuint buffer, GLenum internalformat, GLintptr offset, GLsizei size, GLenum format, GLenum type, const void *data);
- void glClearNamedBufferData(GLuint buffer, GLenum internalformat, GLenum format, GLenum type, const void *data);
- void glCopyNamedBufferSubData(GLuint readBuffer, GLuint writeBuffer, GLintptr readOffset, GLintptr writeOffset, GLsizei size);
- void glNamedBufferSubData(GLuint buffer, GLintptr offset, GLsizei size, const void *data);
- void glNamedBufferData(GLuint buffer, GLsizei size, const void *data, GLenum usage);
- void glNamedBufferStorage(GLuint buffer, GLsizei size, const void *data, GLbitfield flags);
- void glCreateBuffers(GLsizei n, GLuint *buffers);
- void glGetTransformFeedbacki64_v(GLuint xfb, GLenum pname, GLuint index, GLint64 *param);
- void glGetTransformFeedbacki_v(GLuint xfb, GLenum pname, GLuint index, GLint *param);
- void glGetTransformFeedbackiv(GLuint xfb, GLenum pname, GLint *param);
- void glTransformFeedbackBufferRange(GLuint xfb, GLuint index, GLuint buffer, GLintptr offset, GLsizei size);
- void glTransformFeedbackBufferBase(GLuint xfb, GLuint index, GLuint buffer);
- void glCreateTransformFeedbacks(GLsizei n, GLuint *ids);
- void glClipControl(GLenum origin, GLenum depth);
-
-private:
- friend class QOpenGLContext;
-
- static bool isContextCompatible(QOpenGLContext *context);
- static QOpenGLVersionProfile versionProfile();
-
- QOpenGLFunctions_1_0_CoreBackend* d_1_0_Core;
- QOpenGLFunctions_1_1_CoreBackend* d_1_1_Core;
- QOpenGLFunctions_1_2_CoreBackend* d_1_2_Core;
- QOpenGLFunctions_1_3_CoreBackend* d_1_3_Core;
- QOpenGLFunctions_1_4_CoreBackend* d_1_4_Core;
- QOpenGLFunctions_1_5_CoreBackend* d_1_5_Core;
- QOpenGLFunctions_2_0_CoreBackend* d_2_0_Core;
- QOpenGLFunctions_2_1_CoreBackend* d_2_1_Core;
- QOpenGLFunctions_3_0_CoreBackend* d_3_0_Core;
- QOpenGLFunctions_3_1_CoreBackend* d_3_1_Core;
- QOpenGLFunctions_3_2_CoreBackend* d_3_2_Core;
- QOpenGLFunctions_3_3_CoreBackend* d_3_3_Core;
- QOpenGLFunctions_4_0_CoreBackend* d_4_0_Core;
- QOpenGLFunctions_4_1_CoreBackend* d_4_1_Core;
- QOpenGLFunctions_4_2_CoreBackend* d_4_2_Core;
- QOpenGLFunctions_4_3_CoreBackend* d_4_3_Core;
- QOpenGLFunctions_4_4_CoreBackend* d_4_4_Core;
- QOpenGLFunctions_4_5_CoreBackend* d_4_5_Core;
-};
-
-// OpenGL 1.0 core functions
-inline void QOpenGLFunctions_4_5_Core::glViewport(GLint x, GLint y, GLsizei width, GLsizei height)
-{
- d_1_0_Core->f.Viewport(x, y, width, height);
-}
-
-inline void QOpenGLFunctions_4_5_Core::glDepthRange(GLdouble nearVal, GLdouble farVal)
-{
- d_1_0_Core->f.DepthRange(nearVal, farVal);
-}
-
-inline GLboolean QOpenGLFunctions_4_5_Core::glIsEnabled(GLenum cap)
-{
- return d_1_0_Core->f.IsEnabled(cap);
-}
-
-inline void QOpenGLFunctions_4_5_Core::glGetTexLevelParameteriv(GLenum target, GLint level, GLenum pname, GLint *params)
-{
- d_1_0_Core->f.GetTexLevelParameteriv(target, level, pname, params);
-}
-
-inline void QOpenGLFunctions_4_5_Core::glGetTexLevelParameterfv(GLenum target, GLint level, GLenum pname, GLfloat *params)
-{
- d_1_0_Core->f.GetTexLevelParameterfv(target, level, pname, params);
-}
-
-inline void QOpenGLFunctions_4_5_Core::glGetTexParameteriv(GLenum target, GLenum pname, GLint *params)
-{
- d_1_0_Core->f.GetTexParameteriv(target, pname, params);
-}
-
-inline void QOpenGLFunctions_4_5_Core::glGetTexParameterfv(GLenum target, GLenum pname, GLfloat *params)
-{
- d_1_0_Core->f.GetTexParameterfv(target, pname, params);
-}
-
-inline void QOpenGLFunctions_4_5_Core::glGetTexImage(GLenum target, GLint level, GLenum format, GLenum type, void *pixels)
-{
- d_1_0_Core->f.GetTexImage(target, level, format, type, pixels);
-}
-
-inline const GLubyte * QOpenGLFunctions_4_5_Core::glGetString(GLenum name)
-{
- return d_1_0_Core->f.GetString(name);
-}
-
-inline void QOpenGLFunctions_4_5_Core::glGetIntegerv(GLenum pname, GLint *data)
-{
- d_1_0_Core->f.GetIntegerv(pname, data);
-}
-
-inline void QOpenGLFunctions_4_5_Core::glGetFloatv(GLenum pname, GLfloat *data)
-{
- d_1_0_Core->f.GetFloatv(pname, data);
-}
-
-inline GLenum QOpenGLFunctions_4_5_Core::glGetError()
-{
- return d_1_0_Core->f.GetError();
-}
-
-inline void QOpenGLFunctions_4_5_Core::glGetDoublev(GLenum pname, GLdouble *data)
-{
- d_1_0_Core->f.GetDoublev(pname, data);
-}
-
-inline void QOpenGLFunctions_4_5_Core::glGetBooleanv(GLenum pname, GLboolean *data)
-{
- d_1_0_Core->f.GetBooleanv(pname, data);
-}
-
-inline void QOpenGLFunctions_4_5_Core::glReadPixels(GLint x, GLint y, GLsizei width, GLsizei height, GLenum format, GLenum type, void *pixels)
-{
- d_1_0_Core->f.ReadPixels(x, y, width, height, format, type, pixels);
-}
-
-inline void QOpenGLFunctions_4_5_Core::glReadBuffer(GLenum src)
-{
- d_1_0_Core->f.ReadBuffer(src);
-}
-
-inline void QOpenGLFunctions_4_5_Core::glPixelStorei(GLenum pname, GLint param)
-{
- d_1_0_Core->f.PixelStorei(pname, param);
-}
-
-inline void QOpenGLFunctions_4_5_Core::glPixelStoref(GLenum pname, GLfloat param)
-{
- d_1_0_Core->f.PixelStoref(pname, param);
-}
-
-inline void QOpenGLFunctions_4_5_Core::glDepthFunc(GLenum func)
-{
- d_1_0_Core->f.DepthFunc(func);
-}
-
-inline void QOpenGLFunctions_4_5_Core::glStencilOp(GLenum fail, GLenum zfail, GLenum zpass)
-{
- d_1_0_Core->f.StencilOp(fail, zfail, zpass);
-}
-
-inline void QOpenGLFunctions_4_5_Core::glStencilFunc(GLenum func, GLint ref, GLuint mask)
-{
- d_1_0_Core->f.StencilFunc(func, ref, mask);
-}
-
-inline void QOpenGLFunctions_4_5_Core::glLogicOp(GLenum opcode)
-{
- d_1_0_Core->f.LogicOp(opcode);
-}
-
-inline void QOpenGLFunctions_4_5_Core::glBlendFunc(GLenum sfactor, GLenum dfactor)
-{
- d_1_0_Core->f.BlendFunc(sfactor, dfactor);
-}
-
-inline void QOpenGLFunctions_4_5_Core::glFlush()
-{
- d_1_0_Core->f.Flush();
-}
-
-inline void QOpenGLFunctions_4_5_Core::glFinish()
-{
- d_1_0_Core->f.Finish();
-}
-
-inline void QOpenGLFunctions_4_5_Core::glEnable(GLenum cap)
-{
- d_1_0_Core->f.Enable(cap);
-}
-
-inline void QOpenGLFunctions_4_5_Core::glDisable(GLenum cap)
-{
- d_1_0_Core->f.Disable(cap);
-}
-
-inline void QOpenGLFunctions_4_5_Core::glDepthMask(GLboolean flag)
-{
- d_1_0_Core->f.DepthMask(flag);
-}
-
-inline void QOpenGLFunctions_4_5_Core::glColorMask(GLboolean red, GLboolean green, GLboolean blue, GLboolean alpha)
-{
- d_1_0_Core->f.ColorMask(red, green, blue, alpha);
-}
-
-inline void QOpenGLFunctions_4_5_Core::glStencilMask(GLuint mask)
-{
- d_1_0_Core->f.StencilMask(mask);
-}
-
-inline void QOpenGLFunctions_4_5_Core::glClearDepth(GLdouble depth)
-{
- d_1_0_Core->f.ClearDepth(depth);
-}
-
-inline void QOpenGLFunctions_4_5_Core::glClearStencil(GLint s)
-{
- d_1_0_Core->f.ClearStencil(s);
-}
-
-inline void QOpenGLFunctions_4_5_Core::glClearColor(GLfloat red, GLfloat green, GLfloat blue, GLfloat alpha)
-{
- d_1_0_Core->f.ClearColor(red, green, blue, alpha);
-}
-
-inline void QOpenGLFunctions_4_5_Core::glClear(GLbitfield mask)
-{
- d_1_0_Core->f.Clear(mask);
-}
-
-inline void QOpenGLFunctions_4_5_Core::glDrawBuffer(GLenum buf)
-{
- d_1_0_Core->f.DrawBuffer(buf);
-}
-
-inline void QOpenGLFunctions_4_5_Core::glTexImage2D(GLenum target, GLint level, GLint internalformat, GLsizei width, GLsizei height, GLint border, GLenum format, GLenum type, const void *pixels)
-{
- d_1_0_Core->f.TexImage2D(target, level, internalformat, width, height, border, format, type, pixels);
-}
-
-inline void QOpenGLFunctions_4_5_Core::glTexImage1D(GLenum target, GLint level, GLint internalformat, GLsizei width, GLint border, GLenum format, GLenum type, const void *pixels)
-{
- d_1_0_Core->f.TexImage1D(target, level, internalformat, width, border, format, type, pixels);
-}
-
-inline void QOpenGLFunctions_4_5_Core::glTexParameteriv(GLenum target, GLenum pname, const GLint *params)
-{
- d_1_0_Core->f.TexParameteriv(target, pname, params);
-}
-
-inline void QOpenGLFunctions_4_5_Core::glTexParameteri(GLenum target, GLenum pname, GLint param)
-{
- d_1_0_Core->f.TexParameteri(target, pname, param);
-}
-
-inline void QOpenGLFunctions_4_5_Core::glTexParameterfv(GLenum target, GLenum pname, const GLfloat *params)
-{
- d_1_0_Core->f.TexParameterfv(target, pname, params);
-}
-
-inline void QOpenGLFunctions_4_5_Core::glTexParameterf(GLenum target, GLenum pname, GLfloat param)
-{
- d_1_0_Core->f.TexParameterf(target, pname, param);
-}
-
-inline void QOpenGLFunctions_4_5_Core::glScissor(GLint x, GLint y, GLsizei width, GLsizei height)
-{
- d_1_0_Core->f.Scissor(x, y, width, height);
-}
-
-inline void QOpenGLFunctions_4_5_Core::glPolygonMode(GLenum face, GLenum mode)
-{
- d_1_0_Core->f.PolygonMode(face, mode);
-}
-
-inline void QOpenGLFunctions_4_5_Core::glPointSize(GLfloat size)
-{
- d_1_0_Core->f.PointSize(size);
-}
-
-inline void QOpenGLFunctions_4_5_Core::glLineWidth(GLfloat width)
-{
- d_1_0_Core->f.LineWidth(width);
-}
-
-inline void QOpenGLFunctions_4_5_Core::glHint(GLenum target, GLenum mode)
-{
- d_1_0_Core->f.Hint(target, mode);
-}
-
-inline void QOpenGLFunctions_4_5_Core::glFrontFace(GLenum mode)
-{
- d_1_0_Core->f.FrontFace(mode);
-}
-
-inline void QOpenGLFunctions_4_5_Core::glCullFace(GLenum mode)
-{
- d_1_0_Core->f.CullFace(mode);
-}
-
-
-// OpenGL 1.1 core functions
-inline GLboolean QOpenGLFunctions_4_5_Core::glIsTexture(GLuint texture)
-{
- return d_1_1_Core->f.IsTexture(texture);
-}
-
-inline void QOpenGLFunctions_4_5_Core::glGenTextures(GLsizei n, GLuint *textures)
-{
- d_1_1_Core->f.GenTextures(n, textures);
-}
-
-inline void QOpenGLFunctions_4_5_Core::glDeleteTextures(GLsizei n, const GLuint *textures)
-{
- d_1_1_Core->f.DeleteTextures(n, textures);
-}
-
-inline void QOpenGLFunctions_4_5_Core::glBindTexture(GLenum target, GLuint texture)
-{
- d_1_1_Core->f.BindTexture(target, texture);
-}
-
-inline void QOpenGLFunctions_4_5_Core::glTexSubImage2D(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLenum type, const void *pixels)
-{
- d_1_1_Core->f.TexSubImage2D(target, level, xoffset, yoffset, width, height, format, type, pixels);
-}
-
-inline void QOpenGLFunctions_4_5_Core::glTexSubImage1D(GLenum target, GLint level, GLint xoffset, GLsizei width, GLenum format, GLenum type, const void *pixels)
-{
- d_1_1_Core->f.TexSubImage1D(target, level, xoffset, width, format, type, pixels);
-}
-
-inline void QOpenGLFunctions_4_5_Core::glCopyTexSubImage2D(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint x, GLint y, GLsizei width, GLsizei height)
-{
- d_1_1_Core->f.CopyTexSubImage2D(target, level, xoffset, yoffset, x, y, width, height);
-}
-
-inline void QOpenGLFunctions_4_5_Core::glCopyTexSubImage1D(GLenum target, GLint level, GLint xoffset, GLint x, GLint y, GLsizei width)
-{
- d_1_1_Core->f.CopyTexSubImage1D(target, level, xoffset, x, y, width);
-}
-
-inline void QOpenGLFunctions_4_5_Core::glCopyTexImage2D(GLenum target, GLint level, GLenum internalformat, GLint x, GLint y, GLsizei width, GLsizei height, GLint border)
-{
- d_1_1_Core->f.CopyTexImage2D(target, level, internalformat, x, y, width, height, border);
-}
-
-inline void QOpenGLFunctions_4_5_Core::glCopyTexImage1D(GLenum target, GLint level, GLenum internalformat, GLint x, GLint y, GLsizei width, GLint border)
-{
- d_1_1_Core->f.CopyTexImage1D(target, level, internalformat, x, y, width, border);
-}
-
-inline void QOpenGLFunctions_4_5_Core::glPolygonOffset(GLfloat factor, GLfloat units)
-{
- d_1_1_Core->f.PolygonOffset(factor, units);
-}
-
-inline void QOpenGLFunctions_4_5_Core::glDrawElements(GLenum mode, GLsizei count, GLenum type, const void *indices)
-{
- d_1_1_Core->f.DrawElements(mode, count, type, indices);
-}
-
-inline void QOpenGLFunctions_4_5_Core::glDrawArrays(GLenum mode, GLint first, GLsizei count)
-{
- d_1_1_Core->f.DrawArrays(mode, first, count);
-}
-
-
-// OpenGL 1.2 core functions
-inline void QOpenGLFunctions_4_5_Core::glBlendColor(GLfloat red, GLfloat green, GLfloat blue, GLfloat alpha)
-{
- d_1_2_Core->f.BlendColor(red, green, blue, alpha);
-}
-
-inline void QOpenGLFunctions_4_5_Core::glBlendEquation(GLenum mode)
-{
- d_1_2_Core->f.BlendEquation(mode);
-}
-
-inline void QOpenGLFunctions_4_5_Core::glCopyTexSubImage3D(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLint x, GLint y, GLsizei width, GLsizei height)
-{
- d_1_2_Core->f.CopyTexSubImage3D(target, level, xoffset, yoffset, zoffset, x, y, width, height);
-}
-
-inline void QOpenGLFunctions_4_5_Core::glTexSubImage3D(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLenum type, const void *pixels)
-{
- d_1_2_Core->f.TexSubImage3D(target, level, xoffset, yoffset, zoffset, width, height, depth, format, type, pixels);
-}
-
-inline void QOpenGLFunctions_4_5_Core::glTexImage3D(GLenum target, GLint level, GLint internalformat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLenum format, GLenum type, const void *pixels)
-{
- d_1_2_Core->f.TexImage3D(target, level, internalformat, width, height, depth, border, format, type, pixels);
-}
-
-inline void QOpenGLFunctions_4_5_Core::glDrawRangeElements(GLenum mode, GLuint start, GLuint end, GLsizei count, GLenum type, const void *indices)
-{
- d_1_2_Core->f.DrawRangeElements(mode, start, end, count, type, indices);
-}
-
-
-// OpenGL 1.3 core functions
-inline void QOpenGLFunctions_4_5_Core::glGetCompressedTexImage(GLenum target, GLint level, void *img)
-{
- d_1_3_Core->f.GetCompressedTexImage(target, level, img);
-}
-
-inline void QOpenGLFunctions_4_5_Core::glCompressedTexSubImage1D(GLenum target, GLint level, GLint xoffset, GLsizei width, GLenum format, GLsizei imageSize, const void *data)
-{
- d_1_3_Core->f.CompressedTexSubImage1D(target, level, xoffset, width, format, imageSize, data);
-}
-
-inline void QOpenGLFunctions_4_5_Core::glCompressedTexSubImage2D(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLsizei imageSize, const void *data)
-{
- d_1_3_Core->f.CompressedTexSubImage2D(target, level, xoffset, yoffset, width, height, format, imageSize, data);
-}
-
-inline void QOpenGLFunctions_4_5_Core::glCompressedTexSubImage3D(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLsizei imageSize, const void *data)
-{
- d_1_3_Core->f.CompressedTexSubImage3D(target, level, xoffset, yoffset, zoffset, width, height, depth, format, imageSize, data);
-}
-
-inline void QOpenGLFunctions_4_5_Core::glCompressedTexImage1D(GLenum target, GLint level, GLenum internalformat, GLsizei width, GLint border, GLsizei imageSize, const void *data)
-{
- d_1_3_Core->f.CompressedTexImage1D(target, level, internalformat, width, border, imageSize, data);
-}
-
-inline void QOpenGLFunctions_4_5_Core::glCompressedTexImage2D(GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLint border, GLsizei imageSize, const void *data)
-{
- d_1_3_Core->f.CompressedTexImage2D(target, level, internalformat, width, height, border, imageSize, data);
-}
-
-inline void QOpenGLFunctions_4_5_Core::glCompressedTexImage3D(GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLsizei imageSize, const void *data)
-{
- d_1_3_Core->f.CompressedTexImage3D(target, level, internalformat, width, height, depth, border, imageSize, data);
-}
-
-inline void QOpenGLFunctions_4_5_Core::glSampleCoverage(GLfloat value, GLboolean invert)
-{
- d_1_3_Core->f.SampleCoverage(value, invert);
-}
-
-inline void QOpenGLFunctions_4_5_Core::glActiveTexture(GLenum texture)
-{
- d_1_3_Core->f.ActiveTexture(texture);
-}
-
-
-// OpenGL 1.4 core functions
-inline void QOpenGLFunctions_4_5_Core::glPointParameteriv(GLenum pname, const GLint *params)
-{
- d_1_4_Core->f.PointParameteriv(pname, params);
-}
-
-inline void QOpenGLFunctions_4_5_Core::glPointParameteri(GLenum pname, GLint param)
-{
- d_1_4_Core->f.PointParameteri(pname, param);
-}
-
-inline void QOpenGLFunctions_4_5_Core::glPointParameterfv(GLenum pname, const GLfloat *params)
-{
- d_1_4_Core->f.PointParameterfv(pname, params);
-}
-
-inline void QOpenGLFunctions_4_5_Core::glPointParameterf(GLenum pname, GLfloat param)
-{
- d_1_4_Core->f.PointParameterf(pname, param);
-}
-
-inline void QOpenGLFunctions_4_5_Core::glMultiDrawElements(GLenum mode, const GLsizei *count, GLenum type, const void *const *indices, GLsizei drawcount)
-{
- d_1_4_Core->f.MultiDrawElements(mode, count, type, indices, drawcount);
-}
-
-inline void QOpenGLFunctions_4_5_Core::glMultiDrawArrays(GLenum mode, const GLint *first, const GLsizei *count, GLsizei drawcount)
-{
- d_1_4_Core->f.MultiDrawArrays(mode, first, count, drawcount);
-}
-
-inline void QOpenGLFunctions_4_5_Core::glBlendFuncSeparate(GLenum sfactorRGB, GLenum dfactorRGB, GLenum sfactorAlpha, GLenum dfactorAlpha)
-{
- d_1_4_Core->f.BlendFuncSeparate(sfactorRGB, dfactorRGB, sfactorAlpha, dfactorAlpha);
-}
-
-
-// OpenGL 1.5 core functions
-inline void QOpenGLFunctions_4_5_Core::glGetBufferPointerv(GLenum target, GLenum pname, void * *params)
-{
- d_1_5_Core->f.GetBufferPointerv(target, pname, params);
-}
-
-inline void QOpenGLFunctions_4_5_Core::glGetBufferParameteriv(GLenum target, GLenum pname, GLint *params)
-{
- d_1_5_Core->f.GetBufferParameteriv(target, pname, params);
-}
-
-inline GLboolean QOpenGLFunctions_4_5_Core::glUnmapBuffer(GLenum target)
-{
- return d_1_5_Core->f.UnmapBuffer(target);
-}
-
-inline void * QOpenGLFunctions_4_5_Core::glMapBuffer(GLenum target, GLenum access)
-{
- return d_1_5_Core->f.MapBuffer(target, access);
-}
-
-inline void QOpenGLFunctions_4_5_Core::glGetBufferSubData(GLenum target, GLintptr offset, GLsizeiptr size, void *data)
-{
- d_1_5_Core->f.GetBufferSubData(target, offset, size, data);
-}
-
-inline void QOpenGLFunctions_4_5_Core::glBufferSubData(GLenum target, GLintptr offset, GLsizeiptr size, const void *data)
-{
- d_1_5_Core->f.BufferSubData(target, offset, size, data);
-}
-
-inline void QOpenGLFunctions_4_5_Core::glBufferData(GLenum target, GLsizeiptr size, const void *data, GLenum usage)
-{
- d_1_5_Core->f.BufferData(target, size, data, usage);
-}
-
-inline GLboolean QOpenGLFunctions_4_5_Core::glIsBuffer(GLuint buffer)
-{
- return d_1_5_Core->f.IsBuffer(buffer);
-}
-
-inline void QOpenGLFunctions_4_5_Core::glGenBuffers(GLsizei n, GLuint *buffers)
-{
- d_1_5_Core->f.GenBuffers(n, buffers);
-}
-
-inline void QOpenGLFunctions_4_5_Core::glDeleteBuffers(GLsizei n, const GLuint *buffers)
-{
- d_1_5_Core->f.DeleteBuffers(n, buffers);
-}
-
-inline void QOpenGLFunctions_4_5_Core::glBindBuffer(GLenum target, GLuint buffer)
-{
- d_1_5_Core->f.BindBuffer(target, buffer);
-}
-
-inline void QOpenGLFunctions_4_5_Core::glGetQueryObjectuiv(GLuint id, GLenum pname, GLuint *params)
-{
- d_1_5_Core->f.GetQueryObjectuiv(id, pname, params);
-}
-
-inline void QOpenGLFunctions_4_5_Core::glGetQueryObjectiv(GLuint id, GLenum pname, GLint *params)
-{
- d_1_5_Core->f.GetQueryObjectiv(id, pname, params);
-}
-
-inline void QOpenGLFunctions_4_5_Core::glGetQueryiv(GLenum target, GLenum pname, GLint *params)
-{
- d_1_5_Core->f.GetQueryiv(target, pname, params);
-}
-
-inline void QOpenGLFunctions_4_5_Core::glEndQuery(GLenum target)
-{
- d_1_5_Core->f.EndQuery(target);
-}
-
-inline void QOpenGLFunctions_4_5_Core::glBeginQuery(GLenum target, GLuint id)
-{
- d_1_5_Core->f.BeginQuery(target, id);
-}
-
-inline GLboolean QOpenGLFunctions_4_5_Core::glIsQuery(GLuint id)
-{
- return d_1_5_Core->f.IsQuery(id);
-}
-
-inline void QOpenGLFunctions_4_5_Core::glDeleteQueries(GLsizei n, const GLuint *ids)
-{
- d_1_5_Core->f.DeleteQueries(n, ids);
-}
-
-inline void QOpenGLFunctions_4_5_Core::glGenQueries(GLsizei n, GLuint *ids)
-{
- d_1_5_Core->f.GenQueries(n, ids);
-}
-
-
-// OpenGL 2.0 core functions
-inline void QOpenGLFunctions_4_5_Core::glVertexAttribPointer(GLuint index, GLint size, GLenum type, GLboolean normalized, GLsizei stride, const void *pointer)
-{
- d_2_0_Core->f.VertexAttribPointer(index, size, type, normalized, stride, pointer);
-}
-
-inline void QOpenGLFunctions_4_5_Core::glVertexAttrib4usv(GLuint index, const GLushort *v)
-{
- d_2_0_Core->f.VertexAttrib4usv(index, v);
-}
-
-inline void QOpenGLFunctions_4_5_Core::glVertexAttrib4uiv(GLuint index, const GLuint *v)
-{
- d_2_0_Core->f.VertexAttrib4uiv(index, v);
-}
-
-inline void QOpenGLFunctions_4_5_Core::glVertexAttrib4ubv(GLuint index, const GLubyte *v)
-{
- d_2_0_Core->f.VertexAttrib4ubv(index, v);
-}
-
-inline void QOpenGLFunctions_4_5_Core::glVertexAttrib4sv(GLuint index, const GLshort *v)
-{
- d_2_0_Core->f.VertexAttrib4sv(index, v);
-}
-
-inline void QOpenGLFunctions_4_5_Core::glVertexAttrib4s(GLuint index, GLshort x, GLshort y, GLshort z, GLshort w)
-{
- d_2_0_Core->f.VertexAttrib4s(index, x, y, z, w);
-}
-
-inline void QOpenGLFunctions_4_5_Core::glVertexAttrib4iv(GLuint index, const GLint *v)
-{
- d_2_0_Core->f.VertexAttrib4iv(index, v);
-}
-
-inline void QOpenGLFunctions_4_5_Core::glVertexAttrib4fv(GLuint index, const GLfloat *v)
-{
- d_2_0_Core->f.VertexAttrib4fv(index, v);
-}
-
-inline void QOpenGLFunctions_4_5_Core::glVertexAttrib4f(GLuint index, GLfloat x, GLfloat y, GLfloat z, GLfloat w)
-{
- d_2_0_Core->f.VertexAttrib4f(index, x, y, z, w);
-}
-
-inline void QOpenGLFunctions_4_5_Core::glVertexAttrib4dv(GLuint index, const GLdouble *v)
-{
- d_2_0_Core->f.VertexAttrib4dv(index, v);
-}
-
-inline void QOpenGLFunctions_4_5_Core::glVertexAttrib4d(GLuint index, GLdouble x, GLdouble y, GLdouble z, GLdouble w)
-{
- d_2_0_Core->f.VertexAttrib4d(index, x, y, z, w);
-}
-
-inline void QOpenGLFunctions_4_5_Core::glVertexAttrib4bv(GLuint index, const GLbyte *v)
-{
- d_2_0_Core->f.VertexAttrib4bv(index, v);
-}
-
-inline void QOpenGLFunctions_4_5_Core::glVertexAttrib4Nusv(GLuint index, const GLushort *v)
-{
- d_2_0_Core->f.VertexAttrib4Nusv(index, v);
-}
-
-inline void QOpenGLFunctions_4_5_Core::glVertexAttrib4Nuiv(GLuint index, const GLuint *v)
-{
- d_2_0_Core->f.VertexAttrib4Nuiv(index, v);
-}
-
-inline void QOpenGLFunctions_4_5_Core::glVertexAttrib4Nubv(GLuint index, const GLubyte *v)
-{
- d_2_0_Core->f.VertexAttrib4Nubv(index, v);
-}
-
-inline void QOpenGLFunctions_4_5_Core::glVertexAttrib4Nub(GLuint index, GLubyte x, GLubyte y, GLubyte z, GLubyte w)
-{
- d_2_0_Core->f.VertexAttrib4Nub(index, x, y, z, w);
-}
-
-inline void QOpenGLFunctions_4_5_Core::glVertexAttrib4Nsv(GLuint index, const GLshort *v)
-{
- d_2_0_Core->f.VertexAttrib4Nsv(index, v);
-}
-
-inline void QOpenGLFunctions_4_5_Core::glVertexAttrib4Niv(GLuint index, const GLint *v)
-{
- d_2_0_Core->f.VertexAttrib4Niv(index, v);
-}
-
-inline void QOpenGLFunctions_4_5_Core::glVertexAttrib4Nbv(GLuint index, const GLbyte *v)
-{
- d_2_0_Core->f.VertexAttrib4Nbv(index, v);
-}
-
-inline void QOpenGLFunctions_4_5_Core::glVertexAttrib3sv(GLuint index, const GLshort *v)
-{
- d_2_0_Core->f.VertexAttrib3sv(index, v);
-}
-
-inline void QOpenGLFunctions_4_5_Core::glVertexAttrib3s(GLuint index, GLshort x, GLshort y, GLshort z)
-{
- d_2_0_Core->f.VertexAttrib3s(index, x, y, z);
-}
-
-inline void QOpenGLFunctions_4_5_Core::glVertexAttrib3fv(GLuint index, const GLfloat *v)
-{
- d_2_0_Core->f.VertexAttrib3fv(index, v);
-}
-
-inline void QOpenGLFunctions_4_5_Core::glVertexAttrib3f(GLuint index, GLfloat x, GLfloat y, GLfloat z)
-{
- d_2_0_Core->f.VertexAttrib3f(index, x, y, z);
-}
-
-inline void QOpenGLFunctions_4_5_Core::glVertexAttrib3dv(GLuint index, const GLdouble *v)
-{
- d_2_0_Core->f.VertexAttrib3dv(index, v);
-}
-
-inline void QOpenGLFunctions_4_5_Core::glVertexAttrib3d(GLuint index, GLdouble x, GLdouble y, GLdouble z)
-{
- d_2_0_Core->f.VertexAttrib3d(index, x, y, z);
-}
-
-inline void QOpenGLFunctions_4_5_Core::glVertexAttrib2sv(GLuint index, const GLshort *v)
-{
- d_2_0_Core->f.VertexAttrib2sv(index, v);
-}
-
-inline void QOpenGLFunctions_4_5_Core::glVertexAttrib2s(GLuint index, GLshort x, GLshort y)
-{
- d_2_0_Core->f.VertexAttrib2s(index, x, y);
-}
-
-inline void QOpenGLFunctions_4_5_Core::glVertexAttrib2fv(GLuint index, const GLfloat *v)
-{
- d_2_0_Core->f.VertexAttrib2fv(index, v);
-}
-
-inline void QOpenGLFunctions_4_5_Core::glVertexAttrib2f(GLuint index, GLfloat x, GLfloat y)
-{
- d_2_0_Core->f.VertexAttrib2f(index, x, y);
-}
-
-inline void QOpenGLFunctions_4_5_Core::glVertexAttrib2dv(GLuint index, const GLdouble *v)
-{
- d_2_0_Core->f.VertexAttrib2dv(index, v);
-}
-
-inline void QOpenGLFunctions_4_5_Core::glVertexAttrib2d(GLuint index, GLdouble x, GLdouble y)
-{
- d_2_0_Core->f.VertexAttrib2d(index, x, y);
-}
-
-inline void QOpenGLFunctions_4_5_Core::glVertexAttrib1sv(GLuint index, const GLshort *v)
-{
- d_2_0_Core->f.VertexAttrib1sv(index, v);
-}
-
-inline void QOpenGLFunctions_4_5_Core::glVertexAttrib1s(GLuint index, GLshort x)
-{
- d_2_0_Core->f.VertexAttrib1s(index, x);
-}
-
-inline void QOpenGLFunctions_4_5_Core::glVertexAttrib1fv(GLuint index, const GLfloat *v)
-{
- d_2_0_Core->f.VertexAttrib1fv(index, v);
-}
-
-inline void QOpenGLFunctions_4_5_Core::glVertexAttrib1f(GLuint index, GLfloat x)
-{
- d_2_0_Core->f.VertexAttrib1f(index, x);
-}
-
-inline void QOpenGLFunctions_4_5_Core::glVertexAttrib1dv(GLuint index, const GLdouble *v)
-{
- d_2_0_Core->f.VertexAttrib1dv(index, v);
-}
-
-inline void QOpenGLFunctions_4_5_Core::glVertexAttrib1d(GLuint index, GLdouble x)
-{
- d_2_0_Core->f.VertexAttrib1d(index, x);
-}
-
-inline void QOpenGLFunctions_4_5_Core::glValidateProgram(GLuint program)
-{
- d_2_0_Core->f.ValidateProgram(program);
-}
-
-inline void QOpenGLFunctions_4_5_Core::glUniformMatrix4fv(GLint location, GLsizei count, GLboolean transpose, const GLfloat *value)
-{
- d_2_0_Core->f.UniformMatrix4fv(location, count, transpose, value);
-}
-
-inline void QOpenGLFunctions_4_5_Core::glUniformMatrix3fv(GLint location, GLsizei count, GLboolean transpose, const GLfloat *value)
-{
- d_2_0_Core->f.UniformMatrix3fv(location, count, transpose, value);
-}
-
-inline void QOpenGLFunctions_4_5_Core::glUniformMatrix2fv(GLint location, GLsizei count, GLboolean transpose, const GLfloat *value)
-{
- d_2_0_Core->f.UniformMatrix2fv(location, count, transpose, value);
-}
-
-inline void QOpenGLFunctions_4_5_Core::glUniform4iv(GLint location, GLsizei count, const GLint *value)
-{
- d_2_0_Core->f.Uniform4iv(location, count, value);
-}
-
-inline void QOpenGLFunctions_4_5_Core::glUniform3iv(GLint location, GLsizei count, const GLint *value)
-{
- d_2_0_Core->f.Uniform3iv(location, count, value);
-}
-
-inline void QOpenGLFunctions_4_5_Core::glUniform2iv(GLint location, GLsizei count, const GLint *value)
-{
- d_2_0_Core->f.Uniform2iv(location, count, value);
-}
-
-inline void QOpenGLFunctions_4_5_Core::glUniform1iv(GLint location, GLsizei count, const GLint *value)
-{
- d_2_0_Core->f.Uniform1iv(location, count, value);
-}
-
-inline void QOpenGLFunctions_4_5_Core::glUniform4fv(GLint location, GLsizei count, const GLfloat *value)
-{
- d_2_0_Core->f.Uniform4fv(location, count, value);
-}
-
-inline void QOpenGLFunctions_4_5_Core::glUniform3fv(GLint location, GLsizei count, const GLfloat *value)
-{
- d_2_0_Core->f.Uniform3fv(location, count, value);
-}
-
-inline void QOpenGLFunctions_4_5_Core::glUniform2fv(GLint location, GLsizei count, const GLfloat *value)
-{
- d_2_0_Core->f.Uniform2fv(location, count, value);
-}
-
-inline void QOpenGLFunctions_4_5_Core::glUniform1fv(GLint location, GLsizei count, const GLfloat *value)
-{
- d_2_0_Core->f.Uniform1fv(location, count, value);
-}
-
-inline void QOpenGLFunctions_4_5_Core::glUniform4i(GLint location, GLint v0, GLint v1, GLint v2, GLint v3)
-{
- d_2_0_Core->f.Uniform4i(location, v0, v1, v2, v3);
-}
-
-inline void QOpenGLFunctions_4_5_Core::glUniform3i(GLint location, GLint v0, GLint v1, GLint v2)
-{
- d_2_0_Core->f.Uniform3i(location, v0, v1, v2);
-}
-
-inline void QOpenGLFunctions_4_5_Core::glUniform2i(GLint location, GLint v0, GLint v1)
-{
- d_2_0_Core->f.Uniform2i(location, v0, v1);
-}
-
-inline void QOpenGLFunctions_4_5_Core::glUniform1i(GLint location, GLint v0)
-{
- d_2_0_Core->f.Uniform1i(location, v0);
-}
-
-inline void QOpenGLFunctions_4_5_Core::glUniform4f(GLint location, GLfloat v0, GLfloat v1, GLfloat v2, GLfloat v3)
-{
- d_2_0_Core->f.Uniform4f(location, v0, v1, v2, v3);
-}
-
-inline void QOpenGLFunctions_4_5_Core::glUniform3f(GLint location, GLfloat v0, GLfloat v1, GLfloat v2)
-{
- d_2_0_Core->f.Uniform3f(location, v0, v1, v2);
-}
-
-inline void QOpenGLFunctions_4_5_Core::glUniform2f(GLint location, GLfloat v0, GLfloat v1)
-{
- d_2_0_Core->f.Uniform2f(location, v0, v1);
-}
-
-inline void QOpenGLFunctions_4_5_Core::glUniform1f(GLint location, GLfloat v0)
-{
- d_2_0_Core->f.Uniform1f(location, v0);
-}
-
-inline void QOpenGLFunctions_4_5_Core::glUseProgram(GLuint program)
-{
- d_2_0_Core->f.UseProgram(program);
-}
-
-inline void QOpenGLFunctions_4_5_Core::glShaderSource(GLuint shader, GLsizei count, const GLchar *const *string, const GLint *length)
-{
- d_2_0_Core->f.ShaderSource(shader, count, string, length);
-}
-
-inline void QOpenGLFunctions_4_5_Core::glLinkProgram(GLuint program)
-{
- d_2_0_Core->f.LinkProgram(program);
-}
-
-inline GLboolean QOpenGLFunctions_4_5_Core::glIsShader(GLuint shader)
-{
- return d_2_0_Core->f.IsShader(shader);
-}
-
-inline GLboolean QOpenGLFunctions_4_5_Core::glIsProgram(GLuint program)
-{
- return d_2_0_Core->f.IsProgram(program);
-}
-
-inline void QOpenGLFunctions_4_5_Core::glGetVertexAttribPointerv(GLuint index, GLenum pname, void * *pointer)
-{
- d_2_0_Core->f.GetVertexAttribPointerv(index, pname, pointer);
-}
-
-inline void QOpenGLFunctions_4_5_Core::glGetVertexAttribiv(GLuint index, GLenum pname, GLint *params)
-{
- d_2_0_Core->f.GetVertexAttribiv(index, pname, params);
-}
-
-inline void QOpenGLFunctions_4_5_Core::glGetVertexAttribfv(GLuint index, GLenum pname, GLfloat *params)
-{
- d_2_0_Core->f.GetVertexAttribfv(index, pname, params);
-}
-
-inline void QOpenGLFunctions_4_5_Core::glGetVertexAttribdv(GLuint index, GLenum pname, GLdouble *params)
-{
- d_2_0_Core->f.GetVertexAttribdv(index, pname, params);
-}
-
-inline void QOpenGLFunctions_4_5_Core::glGetUniformiv(GLuint program, GLint location, GLint *params)
-{
- d_2_0_Core->f.GetUniformiv(program, location, params);
-}
-
-inline void QOpenGLFunctions_4_5_Core::glGetUniformfv(GLuint program, GLint location, GLfloat *params)
-{
- d_2_0_Core->f.GetUniformfv(program, location, params);
-}
-
-inline GLint QOpenGLFunctions_4_5_Core::glGetUniformLocation(GLuint program, const GLchar *name)
-{
- return d_2_0_Core->f.GetUniformLocation(program, name);
-}
-
-inline void QOpenGLFunctions_4_5_Core::glGetShaderSource(GLuint shader, GLsizei bufSize, GLsizei *length, GLchar *source)
-{
- d_2_0_Core->f.GetShaderSource(shader, bufSize, length, source);
-}
-
-inline void QOpenGLFunctions_4_5_Core::glGetShaderInfoLog(GLuint shader, GLsizei bufSize, GLsizei *length, GLchar *infoLog)
-{
- d_2_0_Core->f.GetShaderInfoLog(shader, bufSize, length, infoLog);
-}
-
-inline void QOpenGLFunctions_4_5_Core::glGetShaderiv(GLuint shader, GLenum pname, GLint *params)
-{
- d_2_0_Core->f.GetShaderiv(shader, pname, params);
-}
-
-inline void QOpenGLFunctions_4_5_Core::glGetProgramInfoLog(GLuint program, GLsizei bufSize, GLsizei *length, GLchar *infoLog)
-{
- d_2_0_Core->f.GetProgramInfoLog(program, bufSize, length, infoLog);
-}
-
-inline void QOpenGLFunctions_4_5_Core::glGetProgramiv(GLuint program, GLenum pname, GLint *params)
-{
- d_2_0_Core->f.GetProgramiv(program, pname, params);
-}
-
-inline GLint QOpenGLFunctions_4_5_Core::glGetAttribLocation(GLuint program, const GLchar *name)
-{
- return d_2_0_Core->f.GetAttribLocation(program, name);
-}
-
-inline void QOpenGLFunctions_4_5_Core::glGetAttachedShaders(GLuint program, GLsizei maxCount, GLsizei *count, GLuint *shaders)
-{
- d_2_0_Core->f.GetAttachedShaders(program, maxCount, count, shaders);
-}
-
-inline void QOpenGLFunctions_4_5_Core::glGetActiveUniform(GLuint program, GLuint index, GLsizei bufSize, GLsizei *length, GLint *size, GLenum *type, GLchar *name)
-{
- d_2_0_Core->f.GetActiveUniform(program, index, bufSize, length, size, type, name);
-}
-
-inline void QOpenGLFunctions_4_5_Core::glGetActiveAttrib(GLuint program, GLuint index, GLsizei bufSize, GLsizei *length, GLint *size, GLenum *type, GLchar *name)
-{
- d_2_0_Core->f.GetActiveAttrib(program, index, bufSize, length, size, type, name);
-}
-
-inline void QOpenGLFunctions_4_5_Core::glEnableVertexAttribArray(GLuint index)
-{
- d_2_0_Core->f.EnableVertexAttribArray(index);
-}
-
-inline void QOpenGLFunctions_4_5_Core::glDisableVertexAttribArray(GLuint index)
-{
- d_2_0_Core->f.DisableVertexAttribArray(index);
-}
-
-inline void QOpenGLFunctions_4_5_Core::glDetachShader(GLuint program, GLuint shader)
-{
- d_2_0_Core->f.DetachShader(program, shader);
-}
-
-inline void QOpenGLFunctions_4_5_Core::glDeleteShader(GLuint shader)
-{
- d_2_0_Core->f.DeleteShader(shader);
-}
-
-inline void QOpenGLFunctions_4_5_Core::glDeleteProgram(GLuint program)
-{
- d_2_0_Core->f.DeleteProgram(program);
-}
-
-inline GLuint QOpenGLFunctions_4_5_Core::glCreateShader(GLenum type)
-{
- return d_2_0_Core->f.CreateShader(type);
-}
-
-inline GLuint QOpenGLFunctions_4_5_Core::glCreateProgram()
-{
- return d_2_0_Core->f.CreateProgram();
-}
-
-inline void QOpenGLFunctions_4_5_Core::glCompileShader(GLuint shader)
-{
- d_2_0_Core->f.CompileShader(shader);
-}
-
-inline void QOpenGLFunctions_4_5_Core::glBindAttribLocation(GLuint program, GLuint index, const GLchar *name)
-{
- d_2_0_Core->f.BindAttribLocation(program, index, name);
-}
-
-inline void QOpenGLFunctions_4_5_Core::glAttachShader(GLuint program, GLuint shader)
-{
- d_2_0_Core->f.AttachShader(program, shader);
-}
-
-inline void QOpenGLFunctions_4_5_Core::glStencilMaskSeparate(GLenum face, GLuint mask)
-{
- d_2_0_Core->f.StencilMaskSeparate(face, mask);
-}
-
-inline void QOpenGLFunctions_4_5_Core::glStencilFuncSeparate(GLenum face, GLenum func, GLint ref, GLuint mask)
-{
- d_2_0_Core->f.StencilFuncSeparate(face, func, ref, mask);
-}
-
-inline void QOpenGLFunctions_4_5_Core::glStencilOpSeparate(GLenum face, GLenum sfail, GLenum dpfail, GLenum dppass)
-{
- d_2_0_Core->f.StencilOpSeparate(face, sfail, dpfail, dppass);
-}
-
-inline void QOpenGLFunctions_4_5_Core::glDrawBuffers(GLsizei n, const GLenum *bufs)
-{
- d_2_0_Core->f.DrawBuffers(n, bufs);
-}
-
-inline void QOpenGLFunctions_4_5_Core::glBlendEquationSeparate(GLenum modeRGB, GLenum modeAlpha)
-{
- d_2_0_Core->f.BlendEquationSeparate(modeRGB, modeAlpha);
-}
-
-
-// OpenGL 2.1 core functions
-inline void QOpenGLFunctions_4_5_Core::glUniformMatrix4x3fv(GLint location, GLsizei count, GLboolean transpose, const GLfloat *value)
-{
- d_2_1_Core->f.UniformMatrix4x3fv(location, count, transpose, value);
-}
-
-inline void QOpenGLFunctions_4_5_Core::glUniformMatrix3x4fv(GLint location, GLsizei count, GLboolean transpose, const GLfloat *value)
-{
- d_2_1_Core->f.UniformMatrix3x4fv(location, count, transpose, value);
-}
-
-inline void QOpenGLFunctions_4_5_Core::glUniformMatrix4x2fv(GLint location, GLsizei count, GLboolean transpose, const GLfloat *value)
-{
- d_2_1_Core->f.UniformMatrix4x2fv(location, count, transpose, value);
-}
-
-inline void QOpenGLFunctions_4_5_Core::glUniformMatrix2x4fv(GLint location, GLsizei count, GLboolean transpose, const GLfloat *value)
-{
- d_2_1_Core->f.UniformMatrix2x4fv(location, count, transpose, value);
-}
-
-inline void QOpenGLFunctions_4_5_Core::glUniformMatrix3x2fv(GLint location, GLsizei count, GLboolean transpose, const GLfloat *value)
-{
- d_2_1_Core->f.UniformMatrix3x2fv(location, count, transpose, value);
-}
-
-inline void QOpenGLFunctions_4_5_Core::glUniformMatrix2x3fv(GLint location, GLsizei count, GLboolean transpose, const GLfloat *value)
-{
- d_2_1_Core->f.UniformMatrix2x3fv(location, count, transpose, value);
-}
-
-
-// OpenGL 3.0 core functions
-inline GLboolean QOpenGLFunctions_4_5_Core::glIsVertexArray(GLuint array)
-{
- return d_3_0_Core->f.IsVertexArray(array);
-}
-
-inline void QOpenGLFunctions_4_5_Core::glGenVertexArrays(GLsizei n, GLuint *arrays)
-{
- d_3_0_Core->f.GenVertexArrays(n, arrays);
-}
-
-inline void QOpenGLFunctions_4_5_Core::glDeleteVertexArrays(GLsizei n, const GLuint *arrays)
-{
- d_3_0_Core->f.DeleteVertexArrays(n, arrays);
-}
-
-inline void QOpenGLFunctions_4_5_Core::glBindVertexArray(GLuint array)
-{
- d_3_0_Core->f.BindVertexArray(array);
-}
-
-inline void QOpenGLFunctions_4_5_Core::glFlushMappedBufferRange(GLenum target, GLintptr offset, GLsizeiptr length)
-{
- d_3_0_Core->f.FlushMappedBufferRange(target, offset, length);
-}
-
-inline void * QOpenGLFunctions_4_5_Core::glMapBufferRange(GLenum target, GLintptr offset, GLsizeiptr length, GLbitfield access)
-{
- return d_3_0_Core->f.MapBufferRange(target, offset, length, access);
-}
-
-inline void QOpenGLFunctions_4_5_Core::glFramebufferTextureLayer(GLenum target, GLenum attachment, GLuint texture, GLint level, GLint layer)
-{
- d_3_0_Core->f.FramebufferTextureLayer(target, attachment, texture, level, layer);
-}
-
-inline void QOpenGLFunctions_4_5_Core::glRenderbufferStorageMultisample(GLenum target, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height)
-{
- d_3_0_Core->f.RenderbufferStorageMultisample(target, samples, internalformat, width, height);
-}
-
-inline void QOpenGLFunctions_4_5_Core::glBlitFramebuffer(GLint srcX0, GLint srcY0, GLint srcX1, GLint srcY1, GLint dstX0, GLint dstY0, GLint dstX1, GLint dstY1, GLbitfield mask, GLenum filter)
-{
- d_3_0_Core->f.BlitFramebuffer(srcX0, srcY0, srcX1, srcY1, dstX0, dstY0, dstX1, dstY1, mask, filter);
-}
-
-inline void QOpenGLFunctions_4_5_Core::glGenerateMipmap(GLenum target)
-{
- d_3_0_Core->f.GenerateMipmap(target);
-}
-
-inline void QOpenGLFunctions_4_5_Core::glGetFramebufferAttachmentParameteriv(GLenum target, GLenum attachment, GLenum pname, GLint *params)
-{
- d_3_0_Core->f.GetFramebufferAttachmentParameteriv(target, attachment, pname, params);
-}
-
-inline void QOpenGLFunctions_4_5_Core::glFramebufferRenderbuffer(GLenum target, GLenum attachment, GLenum renderbuffertarget, GLuint renderbuffer)
-{
- d_3_0_Core->f.FramebufferRenderbuffer(target, attachment, renderbuffertarget, renderbuffer);
-}
-
-inline void QOpenGLFunctions_4_5_Core::glFramebufferTexture3D(GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level, GLint zoffset)
-{
- d_3_0_Core->f.FramebufferTexture3D(target, attachment, textarget, texture, level, zoffset);
-}
-
-inline void QOpenGLFunctions_4_5_Core::glFramebufferTexture2D(GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level)
-{
- d_3_0_Core->f.FramebufferTexture2D(target, attachment, textarget, texture, level);
-}
-
-inline void QOpenGLFunctions_4_5_Core::glFramebufferTexture1D(GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level)
-{
- d_3_0_Core->f.FramebufferTexture1D(target, attachment, textarget, texture, level);
-}
-
-inline GLenum QOpenGLFunctions_4_5_Core::glCheckFramebufferStatus(GLenum target)
-{
- return d_3_0_Core->f.CheckFramebufferStatus(target);
-}
-
-inline void QOpenGLFunctions_4_5_Core::glGenFramebuffers(GLsizei n, GLuint *framebuffers)
-{
- d_3_0_Core->f.GenFramebuffers(n, framebuffers);
-}
-
-inline void QOpenGLFunctions_4_5_Core::glDeleteFramebuffers(GLsizei n, const GLuint *framebuffers)
-{
- d_3_0_Core->f.DeleteFramebuffers(n, framebuffers);
-}
-
-inline void QOpenGLFunctions_4_5_Core::glBindFramebuffer(GLenum target, GLuint framebuffer)
-{
- d_3_0_Core->f.BindFramebuffer(target, framebuffer);
-}
-
-inline GLboolean QOpenGLFunctions_4_5_Core::glIsFramebuffer(GLuint framebuffer)
-{
- return d_3_0_Core->f.IsFramebuffer(framebuffer);
-}
-
-inline void QOpenGLFunctions_4_5_Core::glGetRenderbufferParameteriv(GLenum target, GLenum pname, GLint *params)
-{
- d_3_0_Core->f.GetRenderbufferParameteriv(target, pname, params);
-}
-
-inline void QOpenGLFunctions_4_5_Core::glRenderbufferStorage(GLenum target, GLenum internalformat, GLsizei width, GLsizei height)
-{
- d_3_0_Core->f.RenderbufferStorage(target, internalformat, width, height);
-}
-
-inline void QOpenGLFunctions_4_5_Core::glGenRenderbuffers(GLsizei n, GLuint *renderbuffers)
-{
- d_3_0_Core->f.GenRenderbuffers(n, renderbuffers);
-}
-
-inline void QOpenGLFunctions_4_5_Core::glDeleteRenderbuffers(GLsizei n, const GLuint *renderbuffers)
-{
- d_3_0_Core->f.DeleteRenderbuffers(n, renderbuffers);
-}
-
-inline void QOpenGLFunctions_4_5_Core::glBindRenderbuffer(GLenum target, GLuint renderbuffer)
-{
- d_3_0_Core->f.BindRenderbuffer(target, renderbuffer);
-}
-
-inline GLboolean QOpenGLFunctions_4_5_Core::glIsRenderbuffer(GLuint renderbuffer)
-{
- return d_3_0_Core->f.IsRenderbuffer(renderbuffer);
-}
-
-inline const GLubyte * QOpenGLFunctions_4_5_Core::glGetStringi(GLenum name, GLuint index)
-{
- return d_3_0_Core->f.GetStringi(name, index);
-}
-
-inline void QOpenGLFunctions_4_5_Core::glClearBufferfi(GLenum buffer, GLint drawbuffer, GLfloat depth, GLint stencil)
-{
- d_3_0_Core->f.ClearBufferfi(buffer, drawbuffer, depth, stencil);
-}
-
-inline void QOpenGLFunctions_4_5_Core::glClearBufferfv(GLenum buffer, GLint drawbuffer, const GLfloat *value)
-{
- d_3_0_Core->f.ClearBufferfv(buffer, drawbuffer, value);
-}
-
-inline void QOpenGLFunctions_4_5_Core::glClearBufferuiv(GLenum buffer, GLint drawbuffer, const GLuint *value)
-{
- d_3_0_Core->f.ClearBufferuiv(buffer, drawbuffer, value);
-}
-
-inline void QOpenGLFunctions_4_5_Core::glClearBufferiv(GLenum buffer, GLint drawbuffer, const GLint *value)
-{
- d_3_0_Core->f.ClearBufferiv(buffer, drawbuffer, value);
-}
-
-inline void QOpenGLFunctions_4_5_Core::glGetTexParameterIuiv(GLenum target, GLenum pname, GLuint *params)
-{
- d_3_0_Core->f.GetTexParameterIuiv(target, pname, params);
-}
-
-inline void QOpenGLFunctions_4_5_Core::glGetTexParameterIiv(GLenum target, GLenum pname, GLint *params)
-{
- d_3_0_Core->f.GetTexParameterIiv(target, pname, params);
-}
-
-inline void QOpenGLFunctions_4_5_Core::glTexParameterIuiv(GLenum target, GLenum pname, const GLuint *params)
-{
- d_3_0_Core->f.TexParameterIuiv(target, pname, params);
-}
-
-inline void QOpenGLFunctions_4_5_Core::glTexParameterIiv(GLenum target, GLenum pname, const GLint *params)
-{
- d_3_0_Core->f.TexParameterIiv(target, pname, params);
-}
-
-inline void QOpenGLFunctions_4_5_Core::glUniform4uiv(GLint location, GLsizei count, const GLuint *value)
-{
- d_3_0_Core->f.Uniform4uiv(location, count, value);
-}
-
-inline void QOpenGLFunctions_4_5_Core::glUniform3uiv(GLint location, GLsizei count, const GLuint *value)
-{
- d_3_0_Core->f.Uniform3uiv(location, count, value);
-}
-
-inline void QOpenGLFunctions_4_5_Core::glUniform2uiv(GLint location, GLsizei count, const GLuint *value)
-{
- d_3_0_Core->f.Uniform2uiv(location, count, value);
-}
-
-inline void QOpenGLFunctions_4_5_Core::glUniform1uiv(GLint location, GLsizei count, const GLuint *value)
-{
- d_3_0_Core->f.Uniform1uiv(location, count, value);
-}
-
-inline void QOpenGLFunctions_4_5_Core::glUniform4ui(GLint location, GLuint v0, GLuint v1, GLuint v2, GLuint v3)
-{
- d_3_0_Core->f.Uniform4ui(location, v0, v1, v2, v3);
-}
-
-inline void QOpenGLFunctions_4_5_Core::glUniform3ui(GLint location, GLuint v0, GLuint v1, GLuint v2)
-{
- d_3_0_Core->f.Uniform3ui(location, v0, v1, v2);
-}
-
-inline void QOpenGLFunctions_4_5_Core::glUniform2ui(GLint location, GLuint v0, GLuint v1)
-{
- d_3_0_Core->f.Uniform2ui(location, v0, v1);
-}
-
-inline void QOpenGLFunctions_4_5_Core::glUniform1ui(GLint location, GLuint v0)
-{
- d_3_0_Core->f.Uniform1ui(location, v0);
-}
-
-inline GLint QOpenGLFunctions_4_5_Core::glGetFragDataLocation(GLuint program, const GLchar *name)
-{
- return d_3_0_Core->f.GetFragDataLocation(program, name);
-}
-
-inline void QOpenGLFunctions_4_5_Core::glBindFragDataLocation(GLuint program, GLuint color, const GLchar *name)
-{
- d_3_0_Core->f.BindFragDataLocation(program, color, name);
-}
-
-inline void QOpenGLFunctions_4_5_Core::glGetUniformuiv(GLuint program, GLint location, GLuint *params)
-{
- d_3_0_Core->f.GetUniformuiv(program, location, params);
-}
-
-inline void QOpenGLFunctions_4_5_Core::glVertexAttribI4usv(GLuint index, const GLushort *v)
-{
- d_3_0_Core->f.VertexAttribI4usv(index, v);
-}
-
-inline void QOpenGLFunctions_4_5_Core::glVertexAttribI4ubv(GLuint index, const GLubyte *v)
-{
- d_3_0_Core->f.VertexAttribI4ubv(index, v);
-}
-
-inline void QOpenGLFunctions_4_5_Core::glVertexAttribI4sv(GLuint index, const GLshort *v)
-{
- d_3_0_Core->f.VertexAttribI4sv(index, v);
-}
-
-inline void QOpenGLFunctions_4_5_Core::glVertexAttribI4bv(GLuint index, const GLbyte *v)
-{
- d_3_0_Core->f.VertexAttribI4bv(index, v);
-}
-
-inline void QOpenGLFunctions_4_5_Core::glVertexAttribI4uiv(GLuint index, const GLuint *v)
-{
- d_3_0_Core->f.VertexAttribI4uiv(index, v);
-}
-
-inline void QOpenGLFunctions_4_5_Core::glVertexAttribI3uiv(GLuint index, const GLuint *v)
-{
- d_3_0_Core->f.VertexAttribI3uiv(index, v);
-}
-
-inline void QOpenGLFunctions_4_5_Core::glVertexAttribI2uiv(GLuint index, const GLuint *v)
-{
- d_3_0_Core->f.VertexAttribI2uiv(index, v);
-}
-
-inline void QOpenGLFunctions_4_5_Core::glVertexAttribI1uiv(GLuint index, const GLuint *v)
-{
- d_3_0_Core->f.VertexAttribI1uiv(index, v);
-}
-
-inline void QOpenGLFunctions_4_5_Core::glVertexAttribI4iv(GLuint index, const GLint *v)
-{
- d_3_0_Core->f.VertexAttribI4iv(index, v);
-}
-
-inline void QOpenGLFunctions_4_5_Core::glVertexAttribI3iv(GLuint index, const GLint *v)
-{
- d_3_0_Core->f.VertexAttribI3iv(index, v);
-}
-
-inline void QOpenGLFunctions_4_5_Core::glVertexAttribI2iv(GLuint index, const GLint *v)
-{
- d_3_0_Core->f.VertexAttribI2iv(index, v);
-}
-
-inline void QOpenGLFunctions_4_5_Core::glVertexAttribI1iv(GLuint index, const GLint *v)
-{
- d_3_0_Core->f.VertexAttribI1iv(index, v);
-}
-
-inline void QOpenGLFunctions_4_5_Core::glVertexAttribI4ui(GLuint index, GLuint x, GLuint y, GLuint z, GLuint w)
-{
- d_3_0_Core->f.VertexAttribI4ui(index, x, y, z, w);
-}
-
-inline void QOpenGLFunctions_4_5_Core::glVertexAttribI3ui(GLuint index, GLuint x, GLuint y, GLuint z)
-{
- d_3_0_Core->f.VertexAttribI3ui(index, x, y, z);
-}
-
-inline void QOpenGLFunctions_4_5_Core::glVertexAttribI2ui(GLuint index, GLuint x, GLuint y)
-{
- d_3_0_Core->f.VertexAttribI2ui(index, x, y);
-}
-
-inline void QOpenGLFunctions_4_5_Core::glVertexAttribI1ui(GLuint index, GLuint x)
-{
- d_3_0_Core->f.VertexAttribI1ui(index, x);
-}
-
-inline void QOpenGLFunctions_4_5_Core::glVertexAttribI4i(GLuint index, GLint x, GLint y, GLint z, GLint w)
-{
- d_3_0_Core->f.VertexAttribI4i(index, x, y, z, w);
-}
-
-inline void QOpenGLFunctions_4_5_Core::glVertexAttribI3i(GLuint index, GLint x, GLint y, GLint z)
-{
- d_3_0_Core->f.VertexAttribI3i(index, x, y, z);
-}
-
-inline void QOpenGLFunctions_4_5_Core::glVertexAttribI2i(GLuint index, GLint x, GLint y)
-{
- d_3_0_Core->f.VertexAttribI2i(index, x, y);
-}
-
-inline void QOpenGLFunctions_4_5_Core::glVertexAttribI1i(GLuint index, GLint x)
-{
- d_3_0_Core->f.VertexAttribI1i(index, x);
-}
-
-inline void QOpenGLFunctions_4_5_Core::glGetVertexAttribIuiv(GLuint index, GLenum pname, GLuint *params)
-{
- d_3_0_Core->f.GetVertexAttribIuiv(index, pname, params);
-}
-
-inline void QOpenGLFunctions_4_5_Core::glGetVertexAttribIiv(GLuint index, GLenum pname, GLint *params)
-{
- d_3_0_Core->f.GetVertexAttribIiv(index, pname, params);
-}
-
-inline void QOpenGLFunctions_4_5_Core::glVertexAttribIPointer(GLuint index, GLint size, GLenum type, GLsizei stride, const void *pointer)
-{
- d_3_0_Core->f.VertexAttribIPointer(index, size, type, stride, pointer);
-}
-
-inline void QOpenGLFunctions_4_5_Core::glEndConditionalRender()
-{
- d_3_0_Core->f.EndConditionalRender();
-}
-
-inline void QOpenGLFunctions_4_5_Core::glBeginConditionalRender(GLuint id, GLenum mode)
-{
- d_3_0_Core->f.BeginConditionalRender(id, mode);
-}
-
-inline void QOpenGLFunctions_4_5_Core::glClampColor(GLenum target, GLenum clamp)
-{
- d_3_0_Core->f.ClampColor(target, clamp);
-}
-
-inline void QOpenGLFunctions_4_5_Core::glGetTransformFeedbackVarying(GLuint program, GLuint index, GLsizei bufSize, GLsizei *length, GLsizei *size, GLenum *type, GLchar *name)
-{
- d_3_0_Core->f.GetTransformFeedbackVarying(program, index, bufSize, length, size, type, name);
-}
-
-inline void QOpenGLFunctions_4_5_Core::glTransformFeedbackVaryings(GLuint program, GLsizei count, const GLchar *const *varyings, GLenum bufferMode)
-{
- d_3_0_Core->f.TransformFeedbackVaryings(program, count, varyings, bufferMode);
-}
-
-inline void QOpenGLFunctions_4_5_Core::glBindBufferBase(GLenum target, GLuint index, GLuint buffer)
-{
- d_3_0_Core->f.BindBufferBase(target, index, buffer);
-}
-
-inline void QOpenGLFunctions_4_5_Core::glBindBufferRange(GLenum target, GLuint index, GLuint buffer, GLintptr offset, GLsizeiptr size)
-{
- d_3_0_Core->f.BindBufferRange(target, index, buffer, offset, size);
-}
-
-inline void QOpenGLFunctions_4_5_Core::glEndTransformFeedback()
-{
- d_3_0_Core->f.EndTransformFeedback();
-}
-
-inline void QOpenGLFunctions_4_5_Core::glBeginTransformFeedback(GLenum primitiveMode)
-{
- d_3_0_Core->f.BeginTransformFeedback(primitiveMode);
-}
-
-inline GLboolean QOpenGLFunctions_4_5_Core::glIsEnabledi(GLenum target, GLuint index)
-{
- return d_3_0_Core->f.IsEnabledi(target, index);
-}
-
-inline void QOpenGLFunctions_4_5_Core::glDisablei(GLenum target, GLuint index)
-{
- d_3_0_Core->f.Disablei(target, index);
-}
-
-inline void QOpenGLFunctions_4_5_Core::glEnablei(GLenum target, GLuint index)
-{
- d_3_0_Core->f.Enablei(target, index);
-}
-
-inline void QOpenGLFunctions_4_5_Core::glGetIntegeri_v(GLenum target, GLuint index, GLint *data)
-{
- d_3_0_Core->f.GetIntegeri_v(target, index, data);
-}
-
-inline void QOpenGLFunctions_4_5_Core::glGetBooleani_v(GLenum target, GLuint index, GLboolean *data)
-{
- d_3_0_Core->f.GetBooleani_v(target, index, data);
-}
-
-inline void QOpenGLFunctions_4_5_Core::glColorMaski(GLuint index, GLboolean r, GLboolean g, GLboolean b, GLboolean a)
-{
- d_3_0_Core->f.ColorMaski(index, r, g, b, a);
-}
-
-
-// OpenGL 3.1 core functions
-inline void QOpenGLFunctions_4_5_Core::glUniformBlockBinding(GLuint program, GLuint uniformBlockIndex, GLuint uniformBlockBinding)
-{
- d_3_1_Core->f.UniformBlockBinding(program, uniformBlockIndex, uniformBlockBinding);
-}
-
-inline void QOpenGLFunctions_4_5_Core::glGetActiveUniformBlockName(GLuint program, GLuint uniformBlockIndex, GLsizei bufSize, GLsizei *length, GLchar *uniformBlockName)
-{
- d_3_1_Core->f.GetActiveUniformBlockName(program, uniformBlockIndex, bufSize, length, uniformBlockName);
-}
-
-inline void QOpenGLFunctions_4_5_Core::glGetActiveUniformBlockiv(GLuint program, GLuint uniformBlockIndex, GLenum pname, GLint *params)
-{
- d_3_1_Core->f.GetActiveUniformBlockiv(program, uniformBlockIndex, pname, params);
-}
-
-inline GLuint QOpenGLFunctions_4_5_Core::glGetUniformBlockIndex(GLuint program, const GLchar *uniformBlockName)
-{
- return d_3_1_Core->f.GetUniformBlockIndex(program, uniformBlockName);
-}
-
-inline void QOpenGLFunctions_4_5_Core::glGetActiveUniformName(GLuint program, GLuint uniformIndex, GLsizei bufSize, GLsizei *length, GLchar *uniformName)
-{
- d_3_1_Core->f.GetActiveUniformName(program, uniformIndex, bufSize, length, uniformName);
-}
-
-inline void QOpenGLFunctions_4_5_Core::glGetActiveUniformsiv(GLuint program, GLsizei uniformCount, const GLuint *uniformIndices, GLenum pname, GLint *params)
-{
- d_3_1_Core->f.GetActiveUniformsiv(program, uniformCount, uniformIndices, pname, params);
-}
-
-inline void QOpenGLFunctions_4_5_Core::glGetUniformIndices(GLuint program, GLsizei uniformCount, const GLchar *const *uniformNames, GLuint *uniformIndices)
-{
- d_3_1_Core->f.GetUniformIndices(program, uniformCount, uniformNames, uniformIndices);
-}
-
-inline void QOpenGLFunctions_4_5_Core::glCopyBufferSubData(GLenum readTarget, GLenum writeTarget, GLintptr readOffset, GLintptr writeOffset, GLsizeiptr size)
-{
- d_3_1_Core->f.CopyBufferSubData(readTarget, writeTarget, readOffset, writeOffset, size);
-}
-
-inline void QOpenGLFunctions_4_5_Core::glPrimitiveRestartIndex(GLuint index)
-{
- d_3_1_Core->f.PrimitiveRestartIndex(index);
-}
-
-inline void QOpenGLFunctions_4_5_Core::glTexBuffer(GLenum target, GLenum internalformat, GLuint buffer)
-{
- d_3_1_Core->f.TexBuffer(target, internalformat, buffer);
-}
-
-inline void QOpenGLFunctions_4_5_Core::glDrawElementsInstanced(GLenum mode, GLsizei count, GLenum type, const void *indices, GLsizei instancecount)
-{
- d_3_1_Core->f.DrawElementsInstanced(mode, count, type, indices, instancecount);
-}
-
-inline void QOpenGLFunctions_4_5_Core::glDrawArraysInstanced(GLenum mode, GLint first, GLsizei count, GLsizei instancecount)
-{
- d_3_1_Core->f.DrawArraysInstanced(mode, first, count, instancecount);
-}
-
-
-// OpenGL 3.2 core functions
-inline void QOpenGLFunctions_4_5_Core::glSampleMaski(GLuint maskNumber, GLbitfield mask)
-{
- d_3_2_Core->f.SampleMaski(maskNumber, mask);
-}
-
-inline void QOpenGLFunctions_4_5_Core::glGetMultisamplefv(GLenum pname, GLuint index, GLfloat *val)
-{
- d_3_2_Core->f.GetMultisamplefv(pname, index, val);
-}
-
-inline void QOpenGLFunctions_4_5_Core::glTexImage3DMultisample(GLenum target, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth, GLboolean fixedsamplelocations)
-{
- d_3_2_Core->f.TexImage3DMultisample(target, samples, internalformat, width, height, depth, fixedsamplelocations);
-}
-
-inline void QOpenGLFunctions_4_5_Core::glTexImage2DMultisample(GLenum target, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height, GLboolean fixedsamplelocations)
-{
- d_3_2_Core->f.TexImage2DMultisample(target, samples, internalformat, width, height, fixedsamplelocations);
-}
-
-inline void QOpenGLFunctions_4_5_Core::glFramebufferTexture(GLenum target, GLenum attachment, GLuint texture, GLint level)
-{
- d_3_2_Core->f.FramebufferTexture(target, attachment, texture, level);
-}
-
-inline void QOpenGLFunctions_4_5_Core::glGetBufferParameteri64v(GLenum target, GLenum pname, GLint64 *params)
-{
- d_3_2_Core->f.GetBufferParameteri64v(target, pname, params);
-}
-
-inline void QOpenGLFunctions_4_5_Core::glGetInteger64i_v(GLenum target, GLuint index, GLint64 *data)
-{
- d_3_2_Core->f.GetInteger64i_v(target, index, data);
-}
-
-inline void QOpenGLFunctions_4_5_Core::glGetSynciv(GLsync sync, GLenum pname, GLsizei bufSize, GLsizei *length, GLint *values)
-{
- d_3_2_Core->f.GetSynciv(sync, pname, bufSize, length, values);
-}
-
-inline void QOpenGLFunctions_4_5_Core::glGetInteger64v(GLenum pname, GLint64 *data)
-{
- d_3_2_Core->f.GetInteger64v(pname, data);
-}
-
-inline void QOpenGLFunctions_4_5_Core::glWaitSync(GLsync sync, GLbitfield flags, GLuint64 timeout)
-{
- d_3_2_Core->f.WaitSync(sync, flags, timeout);
-}
-
-inline GLenum QOpenGLFunctions_4_5_Core::glClientWaitSync(GLsync sync, GLbitfield flags, GLuint64 timeout)
-{
- return d_3_2_Core->f.ClientWaitSync(sync, flags, timeout);
-}
-
-inline void QOpenGLFunctions_4_5_Core::glDeleteSync(GLsync sync)
-{
- d_3_2_Core->f.DeleteSync(sync);
-}
-
-inline GLboolean QOpenGLFunctions_4_5_Core::glIsSync(GLsync sync)
-{
- return d_3_2_Core->f.IsSync(sync);
-}
-
-inline GLsync QOpenGLFunctions_4_5_Core::glFenceSync(GLenum condition, GLbitfield flags)
-{
- return d_3_2_Core->f.FenceSync(condition, flags);
-}
-
-inline void QOpenGLFunctions_4_5_Core::glProvokingVertex(GLenum mode)
-{
- d_3_2_Core->f.ProvokingVertex(mode);
-}
-
-inline void QOpenGLFunctions_4_5_Core::glMultiDrawElementsBaseVertex(GLenum mode, const GLsizei *count, GLenum type, const void *const *indices, GLsizei drawcount, const GLint *basevertex)
-{
- d_3_2_Core->f.MultiDrawElementsBaseVertex(mode, count, type, indices, drawcount, basevertex);
-}
-
-inline void QOpenGLFunctions_4_5_Core::glDrawElementsInstancedBaseVertex(GLenum mode, GLsizei count, GLenum type, const void *indices, GLsizei instancecount, GLint basevertex)
-{
- d_3_2_Core->f.DrawElementsInstancedBaseVertex(mode, count, type, indices, instancecount, basevertex);
-}
-
-inline void QOpenGLFunctions_4_5_Core::glDrawRangeElementsBaseVertex(GLenum mode, GLuint start, GLuint end, GLsizei count, GLenum type, const void *indices, GLint basevertex)
-{
- d_3_2_Core->f.DrawRangeElementsBaseVertex(mode, start, end, count, type, indices, basevertex);
-}
-
-inline void QOpenGLFunctions_4_5_Core::glDrawElementsBaseVertex(GLenum mode, GLsizei count, GLenum type, const void *indices, GLint basevertex)
-{
- d_3_2_Core->f.DrawElementsBaseVertex(mode, count, type, indices, basevertex);
-}
-
-
-// OpenGL 3.3 core functions
-inline void QOpenGLFunctions_4_5_Core::glVertexAttribP4uiv(GLuint index, GLenum type, GLboolean normalized, const GLuint *value)
-{
- d_3_3_Core->f.VertexAttribP4uiv(index, type, normalized, value);
-}
-
-inline void QOpenGLFunctions_4_5_Core::glVertexAttribP4ui(GLuint index, GLenum type, GLboolean normalized, GLuint value)
-{
- d_3_3_Core->f.VertexAttribP4ui(index, type, normalized, value);
-}
-
-inline void QOpenGLFunctions_4_5_Core::glVertexAttribP3uiv(GLuint index, GLenum type, GLboolean normalized, const GLuint *value)
-{
- d_3_3_Core->f.VertexAttribP3uiv(index, type, normalized, value);
-}
-
-inline void QOpenGLFunctions_4_5_Core::glVertexAttribP3ui(GLuint index, GLenum type, GLboolean normalized, GLuint value)
-{
- d_3_3_Core->f.VertexAttribP3ui(index, type, normalized, value);
-}
-
-inline void QOpenGLFunctions_4_5_Core::glVertexAttribP2uiv(GLuint index, GLenum type, GLboolean normalized, const GLuint *value)
-{
- d_3_3_Core->f.VertexAttribP2uiv(index, type, normalized, value);
-}
-
-inline void QOpenGLFunctions_4_5_Core::glVertexAttribP2ui(GLuint index, GLenum type, GLboolean normalized, GLuint value)
-{
- d_3_3_Core->f.VertexAttribP2ui(index, type, normalized, value);
-}
-
-inline void QOpenGLFunctions_4_5_Core::glVertexAttribP1uiv(GLuint index, GLenum type, GLboolean normalized, const GLuint *value)
-{
- d_3_3_Core->f.VertexAttribP1uiv(index, type, normalized, value);
-}
-
-inline void QOpenGLFunctions_4_5_Core::glVertexAttribP1ui(GLuint index, GLenum type, GLboolean normalized, GLuint value)
-{
- d_3_3_Core->f.VertexAttribP1ui(index, type, normalized, value);
-}
-
-inline void QOpenGLFunctions_4_5_Core::glVertexAttribDivisor(GLuint index, GLuint divisor)
-{
- d_3_3_Core->f.VertexAttribDivisor(index, divisor);
-}
-
-inline void QOpenGLFunctions_4_5_Core::glGetQueryObjectui64v(GLuint id, GLenum pname, GLuint64 *params)
-{
- d_3_3_Core->f.GetQueryObjectui64v(id, pname, params);
-}
-
-inline void QOpenGLFunctions_4_5_Core::glGetQueryObjecti64v(GLuint id, GLenum pname, GLint64 *params)
-{
- d_3_3_Core->f.GetQueryObjecti64v(id, pname, params);
-}
-
-inline void QOpenGLFunctions_4_5_Core::glQueryCounter(GLuint id, GLenum target)
-{
- d_3_3_Core->f.QueryCounter(id, target);
-}
-
-inline void QOpenGLFunctions_4_5_Core::glGetSamplerParameterIuiv(GLuint sampler, GLenum pname, GLuint *params)
-{
- d_3_3_Core->f.GetSamplerParameterIuiv(sampler, pname, params);
-}
-
-inline void QOpenGLFunctions_4_5_Core::glGetSamplerParameterfv(GLuint sampler, GLenum pname, GLfloat *params)
-{
- d_3_3_Core->f.GetSamplerParameterfv(sampler, pname, params);
-}
-
-inline void QOpenGLFunctions_4_5_Core::glGetSamplerParameterIiv(GLuint sampler, GLenum pname, GLint *params)
-{
- d_3_3_Core->f.GetSamplerParameterIiv(sampler, pname, params);
-}
-
-inline void QOpenGLFunctions_4_5_Core::glGetSamplerParameteriv(GLuint sampler, GLenum pname, GLint *params)
-{
- d_3_3_Core->f.GetSamplerParameteriv(sampler, pname, params);
-}
-
-inline void QOpenGLFunctions_4_5_Core::glSamplerParameterIuiv(GLuint sampler, GLenum pname, const GLuint *param)
-{
- d_3_3_Core->f.SamplerParameterIuiv(sampler, pname, param);
-}
-
-inline void QOpenGLFunctions_4_5_Core::glSamplerParameterIiv(GLuint sampler, GLenum pname, const GLint *param)
-{
- d_3_3_Core->f.SamplerParameterIiv(sampler, pname, param);
-}
-
-inline void QOpenGLFunctions_4_5_Core::glSamplerParameterfv(GLuint sampler, GLenum pname, const GLfloat *param)
-{
- d_3_3_Core->f.SamplerParameterfv(sampler, pname, param);
-}
-
-inline void QOpenGLFunctions_4_5_Core::glSamplerParameterf(GLuint sampler, GLenum pname, GLfloat param)
-{
- d_3_3_Core->f.SamplerParameterf(sampler, pname, param);
-}
-
-inline void QOpenGLFunctions_4_5_Core::glSamplerParameteriv(GLuint sampler, GLenum pname, const GLint *param)
-{
- d_3_3_Core->f.SamplerParameteriv(sampler, pname, param);
-}
-
-inline void QOpenGLFunctions_4_5_Core::glSamplerParameteri(GLuint sampler, GLenum pname, GLint param)
-{
- d_3_3_Core->f.SamplerParameteri(sampler, pname, param);
-}
-
-inline void QOpenGLFunctions_4_5_Core::glBindSampler(GLuint unit, GLuint sampler)
-{
- d_3_3_Core->f.BindSampler(unit, sampler);
-}
-
-inline GLboolean QOpenGLFunctions_4_5_Core::glIsSampler(GLuint sampler)
-{
- return d_3_3_Core->f.IsSampler(sampler);
-}
-
-inline void QOpenGLFunctions_4_5_Core::glDeleteSamplers(GLsizei count, const GLuint *samplers)
-{
- d_3_3_Core->f.DeleteSamplers(count, samplers);
-}
-
-inline void QOpenGLFunctions_4_5_Core::glGenSamplers(GLsizei count, GLuint *samplers)
-{
- d_3_3_Core->f.GenSamplers(count, samplers);
-}
-
-inline GLint QOpenGLFunctions_4_5_Core::glGetFragDataIndex(GLuint program, const GLchar *name)
-{
- return d_3_3_Core->f.GetFragDataIndex(program, name);
-}
-
-inline void QOpenGLFunctions_4_5_Core::glBindFragDataLocationIndexed(GLuint program, GLuint colorNumber, GLuint index, const GLchar *name)
-{
- d_3_3_Core->f.BindFragDataLocationIndexed(program, colorNumber, index, name);
-}
-
-
-// OpenGL 4.0 core functions
-inline void QOpenGLFunctions_4_5_Core::glGetQueryIndexediv(GLenum target, GLuint index, GLenum pname, GLint *params)
-{
- d_4_0_Core->f.GetQueryIndexediv(target, index, pname, params);
-}
-
-inline void QOpenGLFunctions_4_5_Core::glEndQueryIndexed(GLenum target, GLuint index)
-{
- d_4_0_Core->f.EndQueryIndexed(target, index);
-}
-
-inline void QOpenGLFunctions_4_5_Core::glBeginQueryIndexed(GLenum target, GLuint index, GLuint id)
-{
- d_4_0_Core->f.BeginQueryIndexed(target, index, id);
-}
-
-inline void QOpenGLFunctions_4_5_Core::glDrawTransformFeedbackStream(GLenum mode, GLuint id, GLuint stream)
-{
- d_4_0_Core->f.DrawTransformFeedbackStream(mode, id, stream);
-}
-
-inline void QOpenGLFunctions_4_5_Core::glDrawTransformFeedback(GLenum mode, GLuint id)
-{
- d_4_0_Core->f.DrawTransformFeedback(mode, id);
-}
-
-inline void QOpenGLFunctions_4_5_Core::glResumeTransformFeedback()
-{
- d_4_0_Core->f.ResumeTransformFeedback();
-}
-
-inline void QOpenGLFunctions_4_5_Core::glPauseTransformFeedback()
-{
- d_4_0_Core->f.PauseTransformFeedback();
-}
-
-inline GLboolean QOpenGLFunctions_4_5_Core::glIsTransformFeedback(GLuint id)
-{
- return d_4_0_Core->f.IsTransformFeedback(id);
-}
-
-inline void QOpenGLFunctions_4_5_Core::glGenTransformFeedbacks(GLsizei n, GLuint *ids)
-{
- d_4_0_Core->f.GenTransformFeedbacks(n, ids);
-}
-
-inline void QOpenGLFunctions_4_5_Core::glDeleteTransformFeedbacks(GLsizei n, const GLuint *ids)
-{
- d_4_0_Core->f.DeleteTransformFeedbacks(n, ids);
-}
-
-inline void QOpenGLFunctions_4_5_Core::glBindTransformFeedback(GLenum target, GLuint id)
-{
- d_4_0_Core->f.BindTransformFeedback(target, id);
-}
-
-inline void QOpenGLFunctions_4_5_Core::glPatchParameterfv(GLenum pname, const GLfloat *values)
-{
- d_4_0_Core->f.PatchParameterfv(pname, values);
-}
-
-inline void QOpenGLFunctions_4_5_Core::glPatchParameteri(GLenum pname, GLint value)
-{
- d_4_0_Core->f.PatchParameteri(pname, value);
-}
-
-inline void QOpenGLFunctions_4_5_Core::glGetProgramStageiv(GLuint program, GLenum shadertype, GLenum pname, GLint *values)
-{
- d_4_0_Core->f.GetProgramStageiv(program, shadertype, pname, values);
-}
-
-inline void QOpenGLFunctions_4_5_Core::glGetUniformSubroutineuiv(GLenum shadertype, GLint location, GLuint *params)
-{
- d_4_0_Core->f.GetUniformSubroutineuiv(shadertype, location, params);
-}
-
-inline void QOpenGLFunctions_4_5_Core::glUniformSubroutinesuiv(GLenum shadertype, GLsizei count, const GLuint *indices)
-{
- d_4_0_Core->f.UniformSubroutinesuiv(shadertype, count, indices);
-}
-
-inline void QOpenGLFunctions_4_5_Core::glGetActiveSubroutineName(GLuint program, GLenum shadertype, GLuint index, GLsizei bufsize, GLsizei *length, GLchar *name)
-{
- d_4_0_Core->f.GetActiveSubroutineName(program, shadertype, index, bufsize, length, name);
-}
-
-inline void QOpenGLFunctions_4_5_Core::glGetActiveSubroutineUniformName(GLuint program, GLenum shadertype, GLuint index, GLsizei bufsize, GLsizei *length, GLchar *name)
-{
- d_4_0_Core->f.GetActiveSubroutineUniformName(program, shadertype, index, bufsize, length, name);
-}
-
-inline void QOpenGLFunctions_4_5_Core::glGetActiveSubroutineUniformiv(GLuint program, GLenum shadertype, GLuint index, GLenum pname, GLint *values)
-{
- d_4_0_Core->f.GetActiveSubroutineUniformiv(program, shadertype, index, pname, values);
-}
-
-inline GLuint QOpenGLFunctions_4_5_Core::glGetSubroutineIndex(GLuint program, GLenum shadertype, const GLchar *name)
-{
- return d_4_0_Core->f.GetSubroutineIndex(program, shadertype, name);
-}
-
-inline GLint QOpenGLFunctions_4_5_Core::glGetSubroutineUniformLocation(GLuint program, GLenum shadertype, const GLchar *name)
-{
- return d_4_0_Core->f.GetSubroutineUniformLocation(program, shadertype, name);
-}
-
-inline void QOpenGLFunctions_4_5_Core::glGetUniformdv(GLuint program, GLint location, GLdouble *params)
-{
- d_4_0_Core->f.GetUniformdv(program, location, params);
-}
-
-inline void QOpenGLFunctions_4_5_Core::glUniformMatrix4x3dv(GLint location, GLsizei count, GLboolean transpose, const GLdouble *value)
-{
- d_4_0_Core->f.UniformMatrix4x3dv(location, count, transpose, value);
-}
-
-inline void QOpenGLFunctions_4_5_Core::glUniformMatrix4x2dv(GLint location, GLsizei count, GLboolean transpose, const GLdouble *value)
-{
- d_4_0_Core->f.UniformMatrix4x2dv(location, count, transpose, value);
-}
-
-inline void QOpenGLFunctions_4_5_Core::glUniformMatrix3x4dv(GLint location, GLsizei count, GLboolean transpose, const GLdouble *value)
-{
- d_4_0_Core->f.UniformMatrix3x4dv(location, count, transpose, value);
-}
-
-inline void QOpenGLFunctions_4_5_Core::glUniformMatrix3x2dv(GLint location, GLsizei count, GLboolean transpose, const GLdouble *value)
-{
- d_4_0_Core->f.UniformMatrix3x2dv(location, count, transpose, value);
-}
-
-inline void QOpenGLFunctions_4_5_Core::glUniformMatrix2x4dv(GLint location, GLsizei count, GLboolean transpose, const GLdouble *value)
-{
- d_4_0_Core->f.UniformMatrix2x4dv(location, count, transpose, value);
-}
-
-inline void QOpenGLFunctions_4_5_Core::glUniformMatrix2x3dv(GLint location, GLsizei count, GLboolean transpose, const GLdouble *value)
-{
- d_4_0_Core->f.UniformMatrix2x3dv(location, count, transpose, value);
-}
-
-inline void QOpenGLFunctions_4_5_Core::glUniformMatrix4dv(GLint location, GLsizei count, GLboolean transpose, const GLdouble *value)
-{
- d_4_0_Core->f.UniformMatrix4dv(location, count, transpose, value);
-}
-
-inline void QOpenGLFunctions_4_5_Core::glUniformMatrix3dv(GLint location, GLsizei count, GLboolean transpose, const GLdouble *value)
-{
- d_4_0_Core->f.UniformMatrix3dv(location, count, transpose, value);
-}
-
-inline void QOpenGLFunctions_4_5_Core::glUniformMatrix2dv(GLint location, GLsizei count, GLboolean transpose, const GLdouble *value)
-{
- d_4_0_Core->f.UniformMatrix2dv(location, count, transpose, value);
-}
-
-inline void QOpenGLFunctions_4_5_Core::glUniform4dv(GLint location, GLsizei count, const GLdouble *value)
-{
- d_4_0_Core->f.Uniform4dv(location, count, value);
-}
-
-inline void QOpenGLFunctions_4_5_Core::glUniform3dv(GLint location, GLsizei count, const GLdouble *value)
-{
- d_4_0_Core->f.Uniform3dv(location, count, value);
-}
-
-inline void QOpenGLFunctions_4_5_Core::glUniform2dv(GLint location, GLsizei count, const GLdouble *value)
-{
- d_4_0_Core->f.Uniform2dv(location, count, value);
-}
-
-inline void QOpenGLFunctions_4_5_Core::glUniform1dv(GLint location, GLsizei count, const GLdouble *value)
-{
- d_4_0_Core->f.Uniform1dv(location, count, value);
-}
-
-inline void QOpenGLFunctions_4_5_Core::glUniform4d(GLint location, GLdouble x, GLdouble y, GLdouble z, GLdouble w)
-{
- d_4_0_Core->f.Uniform4d(location, x, y, z, w);
-}
-
-inline void QOpenGLFunctions_4_5_Core::glUniform3d(GLint location, GLdouble x, GLdouble y, GLdouble z)
-{
- d_4_0_Core->f.Uniform3d(location, x, y, z);
-}
-
-inline void QOpenGLFunctions_4_5_Core::glUniform2d(GLint location, GLdouble x, GLdouble y)
-{
- d_4_0_Core->f.Uniform2d(location, x, y);
-}
-
-inline void QOpenGLFunctions_4_5_Core::glUniform1d(GLint location, GLdouble x)
-{
- d_4_0_Core->f.Uniform1d(location, x);
-}
-
-inline void QOpenGLFunctions_4_5_Core::glDrawElementsIndirect(GLenum mode, GLenum type, const void *indirect)
-{
- d_4_0_Core->f.DrawElementsIndirect(mode, type, indirect);
-}
-
-inline void QOpenGLFunctions_4_5_Core::glDrawArraysIndirect(GLenum mode, const void *indirect)
-{
- d_4_0_Core->f.DrawArraysIndirect(mode, indirect);
-}
-
-inline void QOpenGLFunctions_4_5_Core::glBlendFuncSeparatei(GLuint buf, GLenum srcRGB, GLenum dstRGB, GLenum srcAlpha, GLenum dstAlpha)
-{
- d_4_0_Core->f.BlendFuncSeparatei(buf, srcRGB, dstRGB, srcAlpha, dstAlpha);
-}
-
-inline void QOpenGLFunctions_4_5_Core::glBlendFunci(GLuint buf, GLenum src, GLenum dst)
-{
- d_4_0_Core->f.BlendFunci(buf, src, dst);
-}
-
-inline void QOpenGLFunctions_4_5_Core::glBlendEquationSeparatei(GLuint buf, GLenum modeRGB, GLenum modeAlpha)
-{
- d_4_0_Core->f.BlendEquationSeparatei(buf, modeRGB, modeAlpha);
-}
-
-inline void QOpenGLFunctions_4_5_Core::glBlendEquationi(GLuint buf, GLenum mode)
-{
- d_4_0_Core->f.BlendEquationi(buf, mode);
-}
-
-inline void QOpenGLFunctions_4_5_Core::glMinSampleShading(GLfloat value)
-{
- d_4_0_Core->f.MinSampleShading(value);
-}
-
-
-// OpenGL 4.1 core functions
-inline void QOpenGLFunctions_4_5_Core::glGetDoublei_v(GLenum target, GLuint index, GLdouble *data)
-{
- d_4_1_Core->f.GetDoublei_v(target, index, data);
-}
-
-inline void QOpenGLFunctions_4_5_Core::glGetFloati_v(GLenum target, GLuint index, GLfloat *data)
-{
- d_4_1_Core->f.GetFloati_v(target, index, data);
-}
-
-inline void QOpenGLFunctions_4_5_Core::glDepthRangeIndexed(GLuint index, GLdouble n, GLdouble f)
-{
- d_4_1_Core->f.DepthRangeIndexed(index, n, f);
-}
-
-inline void QOpenGLFunctions_4_5_Core::glDepthRangeArrayv(GLuint first, GLsizei count, const GLdouble *v)
-{
- d_4_1_Core->f.DepthRangeArrayv(first, count, v);
-}
-
-inline void QOpenGLFunctions_4_5_Core::glScissorIndexedv(GLuint index, const GLint *v)
-{
- d_4_1_Core->f.ScissorIndexedv(index, v);
-}
-
-inline void QOpenGLFunctions_4_5_Core::glScissorIndexed(GLuint index, GLint left, GLint bottom, GLsizei width, GLsizei height)
-{
- d_4_1_Core->f.ScissorIndexed(index, left, bottom, width, height);
-}
-
-inline void QOpenGLFunctions_4_5_Core::glScissorArrayv(GLuint first, GLsizei count, const GLint *v)
-{
- d_4_1_Core->f.ScissorArrayv(first, count, v);
-}
-
-inline void QOpenGLFunctions_4_5_Core::glViewportIndexedfv(GLuint index, const GLfloat *v)
-{
- d_4_1_Core->f.ViewportIndexedfv(index, v);
-}
-
-inline void QOpenGLFunctions_4_5_Core::glViewportIndexedf(GLuint index, GLfloat x, GLfloat y, GLfloat w, GLfloat h)
-{
- d_4_1_Core->f.ViewportIndexedf(index, x, y, w, h);
-}
-
-inline void QOpenGLFunctions_4_5_Core::glViewportArrayv(GLuint first, GLsizei count, const GLfloat *v)
-{
- d_4_1_Core->f.ViewportArrayv(first, count, v);
-}
-
-inline void QOpenGLFunctions_4_5_Core::glGetVertexAttribLdv(GLuint index, GLenum pname, GLdouble *params)
-{
- d_4_1_Core->f.GetVertexAttribLdv(index, pname, params);
-}
-
-inline void QOpenGLFunctions_4_5_Core::glVertexAttribLPointer(GLuint index, GLint size, GLenum type, GLsizei stride, const void *pointer)
-{
- d_4_1_Core->f.VertexAttribLPointer(index, size, type, stride, pointer);
-}
-
-inline void QOpenGLFunctions_4_5_Core::glVertexAttribL4dv(GLuint index, const GLdouble *v)
-{
- d_4_1_Core->f.VertexAttribL4dv(index, v);
-}
-
-inline void QOpenGLFunctions_4_5_Core::glVertexAttribL3dv(GLuint index, const GLdouble *v)
-{
- d_4_1_Core->f.VertexAttribL3dv(index, v);
-}
-
-inline void QOpenGLFunctions_4_5_Core::glVertexAttribL2dv(GLuint index, const GLdouble *v)
-{
- d_4_1_Core->f.VertexAttribL2dv(index, v);
-}
-
-inline void QOpenGLFunctions_4_5_Core::glVertexAttribL1dv(GLuint index, const GLdouble *v)
-{
- d_4_1_Core->f.VertexAttribL1dv(index, v);
-}
-
-inline void QOpenGLFunctions_4_5_Core::glVertexAttribL4d(GLuint index, GLdouble x, GLdouble y, GLdouble z, GLdouble w)
-{
- d_4_1_Core->f.VertexAttribL4d(index, x, y, z, w);
-}
-
-inline void QOpenGLFunctions_4_5_Core::glVertexAttribL3d(GLuint index, GLdouble x, GLdouble y, GLdouble z)
-{
- d_4_1_Core->f.VertexAttribL3d(index, x, y, z);
-}
-
-inline void QOpenGLFunctions_4_5_Core::glVertexAttribL2d(GLuint index, GLdouble x, GLdouble y)
-{
- d_4_1_Core->f.VertexAttribL2d(index, x, y);
-}
-
-inline void QOpenGLFunctions_4_5_Core::glVertexAttribL1d(GLuint index, GLdouble x)
-{
- d_4_1_Core->f.VertexAttribL1d(index, x);
-}
-
-inline void QOpenGLFunctions_4_5_Core::glGetProgramPipelineInfoLog(GLuint pipeline, GLsizei bufSize, GLsizei *length, GLchar *infoLog)
-{
- d_4_1_Core->f.GetProgramPipelineInfoLog(pipeline, bufSize, length, infoLog);
-}
-
-inline void QOpenGLFunctions_4_5_Core::glValidateProgramPipeline(GLuint pipeline)
-{
- d_4_1_Core->f.ValidateProgramPipeline(pipeline);
-}
-
-inline void QOpenGLFunctions_4_5_Core::glProgramUniformMatrix4x3dv(GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLdouble *value)
-{
- d_4_1_Core->f.ProgramUniformMatrix4x3dv(program, location, count, transpose, value);
-}
-
-inline void QOpenGLFunctions_4_5_Core::glProgramUniformMatrix3x4dv(GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLdouble *value)
-{
- d_4_1_Core->f.ProgramUniformMatrix3x4dv(program, location, count, transpose, value);
-}
-
-inline void QOpenGLFunctions_4_5_Core::glProgramUniformMatrix4x2dv(GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLdouble *value)
-{
- d_4_1_Core->f.ProgramUniformMatrix4x2dv(program, location, count, transpose, value);
-}
-
-inline void QOpenGLFunctions_4_5_Core::glProgramUniformMatrix2x4dv(GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLdouble *value)
-{
- d_4_1_Core->f.ProgramUniformMatrix2x4dv(program, location, count, transpose, value);
-}
-
-inline void QOpenGLFunctions_4_5_Core::glProgramUniformMatrix3x2dv(GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLdouble *value)
-{
- d_4_1_Core->f.ProgramUniformMatrix3x2dv(program, location, count, transpose, value);
-}
-
-inline void QOpenGLFunctions_4_5_Core::glProgramUniformMatrix2x3dv(GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLdouble *value)
-{
- d_4_1_Core->f.ProgramUniformMatrix2x3dv(program, location, count, transpose, value);
-}
-
-inline void QOpenGLFunctions_4_5_Core::glProgramUniformMatrix4x3fv(GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value)
-{
- d_4_1_Core->f.ProgramUniformMatrix4x3fv(program, location, count, transpose, value);
-}
-
-inline void QOpenGLFunctions_4_5_Core::glProgramUniformMatrix3x4fv(GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value)
-{
- d_4_1_Core->f.ProgramUniformMatrix3x4fv(program, location, count, transpose, value);
-}
-
-inline void QOpenGLFunctions_4_5_Core::glProgramUniformMatrix4x2fv(GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value)
-{
- d_4_1_Core->f.ProgramUniformMatrix4x2fv(program, location, count, transpose, value);
-}
-
-inline void QOpenGLFunctions_4_5_Core::glProgramUniformMatrix2x4fv(GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value)
-{
- d_4_1_Core->f.ProgramUniformMatrix2x4fv(program, location, count, transpose, value);
-}
-
-inline void QOpenGLFunctions_4_5_Core::glProgramUniformMatrix3x2fv(GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value)
-{
- d_4_1_Core->f.ProgramUniformMatrix3x2fv(program, location, count, transpose, value);
-}
-
-inline void QOpenGLFunctions_4_5_Core::glProgramUniformMatrix2x3fv(GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value)
-{
- d_4_1_Core->f.ProgramUniformMatrix2x3fv(program, location, count, transpose, value);
-}
-
-inline void QOpenGLFunctions_4_5_Core::glProgramUniformMatrix4dv(GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLdouble *value)
-{
- d_4_1_Core->f.ProgramUniformMatrix4dv(program, location, count, transpose, value);
-}
-
-inline void QOpenGLFunctions_4_5_Core::glProgramUniformMatrix3dv(GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLdouble *value)
-{
- d_4_1_Core->f.ProgramUniformMatrix3dv(program, location, count, transpose, value);
-}
-
-inline void QOpenGLFunctions_4_5_Core::glProgramUniformMatrix2dv(GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLdouble *value)
-{
- d_4_1_Core->f.ProgramUniformMatrix2dv(program, location, count, transpose, value);
-}
-
-inline void QOpenGLFunctions_4_5_Core::glProgramUniformMatrix4fv(GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value)
-{
- d_4_1_Core->f.ProgramUniformMatrix4fv(program, location, count, transpose, value);
-}
-
-inline void QOpenGLFunctions_4_5_Core::glProgramUniformMatrix3fv(GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value)
-{
- d_4_1_Core->f.ProgramUniformMatrix3fv(program, location, count, transpose, value);
-}
-
-inline void QOpenGLFunctions_4_5_Core::glProgramUniformMatrix2fv(GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value)
-{
- d_4_1_Core->f.ProgramUniformMatrix2fv(program, location, count, transpose, value);
-}
-
-inline void QOpenGLFunctions_4_5_Core::glProgramUniform4uiv(GLuint program, GLint location, GLsizei count, const GLuint *value)
-{
- d_4_1_Core->f.ProgramUniform4uiv(program, location, count, value);
-}
-
-inline void QOpenGLFunctions_4_5_Core::glProgramUniform4ui(GLuint program, GLint location, GLuint v0, GLuint v1, GLuint v2, GLuint v3)
-{
- d_4_1_Core->f.ProgramUniform4ui(program, location, v0, v1, v2, v3);
-}
-
-inline void QOpenGLFunctions_4_5_Core::glProgramUniform4dv(GLuint program, GLint location, GLsizei count, const GLdouble *value)
-{
- d_4_1_Core->f.ProgramUniform4dv(program, location, count, value);
-}
-
-inline void QOpenGLFunctions_4_5_Core::glProgramUniform4d(GLuint program, GLint location, GLdouble v0, GLdouble v1, GLdouble v2, GLdouble v3)
-{
- d_4_1_Core->f.ProgramUniform4d(program, location, v0, v1, v2, v3);
-}
-
-inline void QOpenGLFunctions_4_5_Core::glProgramUniform4fv(GLuint program, GLint location, GLsizei count, const GLfloat *value)
-{
- d_4_1_Core->f.ProgramUniform4fv(program, location, count, value);
-}
-
-inline void QOpenGLFunctions_4_5_Core::glProgramUniform4f(GLuint program, GLint location, GLfloat v0, GLfloat v1, GLfloat v2, GLfloat v3)
-{
- d_4_1_Core->f.ProgramUniform4f(program, location, v0, v1, v2, v3);
-}
-
-inline void QOpenGLFunctions_4_5_Core::glProgramUniform4iv(GLuint program, GLint location, GLsizei count, const GLint *value)
-{
- d_4_1_Core->f.ProgramUniform4iv(program, location, count, value);
-}
-
-inline void QOpenGLFunctions_4_5_Core::glProgramUniform4i(GLuint program, GLint location, GLint v0, GLint v1, GLint v2, GLint v3)
-{
- d_4_1_Core->f.ProgramUniform4i(program, location, v0, v1, v2, v3);
-}
-
-inline void QOpenGLFunctions_4_5_Core::glProgramUniform3uiv(GLuint program, GLint location, GLsizei count, const GLuint *value)
-{
- d_4_1_Core->f.ProgramUniform3uiv(program, location, count, value);
-}
-
-inline void QOpenGLFunctions_4_5_Core::glProgramUniform3ui(GLuint program, GLint location, GLuint v0, GLuint v1, GLuint v2)
-{
- d_4_1_Core->f.ProgramUniform3ui(program, location, v0, v1, v2);
-}
-
-inline void QOpenGLFunctions_4_5_Core::glProgramUniform3dv(GLuint program, GLint location, GLsizei count, const GLdouble *value)
-{
- d_4_1_Core->f.ProgramUniform3dv(program, location, count, value);
-}
-
-inline void QOpenGLFunctions_4_5_Core::glProgramUniform3d(GLuint program, GLint location, GLdouble v0, GLdouble v1, GLdouble v2)
-{
- d_4_1_Core->f.ProgramUniform3d(program, location, v0, v1, v2);
-}
-
-inline void QOpenGLFunctions_4_5_Core::glProgramUniform3fv(GLuint program, GLint location, GLsizei count, const GLfloat *value)
-{
- d_4_1_Core->f.ProgramUniform3fv(program, location, count, value);
-}
-
-inline void QOpenGLFunctions_4_5_Core::glProgramUniform3f(GLuint program, GLint location, GLfloat v0, GLfloat v1, GLfloat v2)
-{
- d_4_1_Core->f.ProgramUniform3f(program, location, v0, v1, v2);
-}
-
-inline void QOpenGLFunctions_4_5_Core::glProgramUniform3iv(GLuint program, GLint location, GLsizei count, const GLint *value)
-{
- d_4_1_Core->f.ProgramUniform3iv(program, location, count, value);
-}
-
-inline void QOpenGLFunctions_4_5_Core::glProgramUniform3i(GLuint program, GLint location, GLint v0, GLint v1, GLint v2)
-{
- d_4_1_Core->f.ProgramUniform3i(program, location, v0, v1, v2);
-}
-
-inline void QOpenGLFunctions_4_5_Core::glProgramUniform2uiv(GLuint program, GLint location, GLsizei count, const GLuint *value)
-{
- d_4_1_Core->f.ProgramUniform2uiv(program, location, count, value);
-}
-
-inline void QOpenGLFunctions_4_5_Core::glProgramUniform2ui(GLuint program, GLint location, GLuint v0, GLuint v1)
-{
- d_4_1_Core->f.ProgramUniform2ui(program, location, v0, v1);
-}
-
-inline void QOpenGLFunctions_4_5_Core::glProgramUniform2dv(GLuint program, GLint location, GLsizei count, const GLdouble *value)
-{
- d_4_1_Core->f.ProgramUniform2dv(program, location, count, value);
-}
-
-inline void QOpenGLFunctions_4_5_Core::glProgramUniform2d(GLuint program, GLint location, GLdouble v0, GLdouble v1)
-{
- d_4_1_Core->f.ProgramUniform2d(program, location, v0, v1);
-}
-
-inline void QOpenGLFunctions_4_5_Core::glProgramUniform2fv(GLuint program, GLint location, GLsizei count, const GLfloat *value)
-{
- d_4_1_Core->f.ProgramUniform2fv(program, location, count, value);
-}
-
-inline void QOpenGLFunctions_4_5_Core::glProgramUniform2f(GLuint program, GLint location, GLfloat v0, GLfloat v1)
-{
- d_4_1_Core->f.ProgramUniform2f(program, location, v0, v1);
-}
-
-inline void QOpenGLFunctions_4_5_Core::glProgramUniform2iv(GLuint program, GLint location, GLsizei count, const GLint *value)
-{
- d_4_1_Core->f.ProgramUniform2iv(program, location, count, value);
-}
-
-inline void QOpenGLFunctions_4_5_Core::glProgramUniform2i(GLuint program, GLint location, GLint v0, GLint v1)
-{
- d_4_1_Core->f.ProgramUniform2i(program, location, v0, v1);
-}
-
-inline void QOpenGLFunctions_4_5_Core::glProgramUniform1uiv(GLuint program, GLint location, GLsizei count, const GLuint *value)
-{
- d_4_1_Core->f.ProgramUniform1uiv(program, location, count, value);
-}
-
-inline void QOpenGLFunctions_4_5_Core::glProgramUniform1ui(GLuint program, GLint location, GLuint v0)
-{
- d_4_1_Core->f.ProgramUniform1ui(program, location, v0);
-}
-
-inline void QOpenGLFunctions_4_5_Core::glProgramUniform1dv(GLuint program, GLint location, GLsizei count, const GLdouble *value)
-{
- d_4_1_Core->f.ProgramUniform1dv(program, location, count, value);
-}
-
-inline void QOpenGLFunctions_4_5_Core::glProgramUniform1d(GLuint program, GLint location, GLdouble v0)
-{
- d_4_1_Core->f.ProgramUniform1d(program, location, v0);
-}
-
-inline void QOpenGLFunctions_4_5_Core::glProgramUniform1fv(GLuint program, GLint location, GLsizei count, const GLfloat *value)
-{
- d_4_1_Core->f.ProgramUniform1fv(program, location, count, value);
-}
-
-inline void QOpenGLFunctions_4_5_Core::glProgramUniform1f(GLuint program, GLint location, GLfloat v0)
-{
- d_4_1_Core->f.ProgramUniform1f(program, location, v0);
-}
-
-inline void QOpenGLFunctions_4_5_Core::glProgramUniform1iv(GLuint program, GLint location, GLsizei count, const GLint *value)
-{
- d_4_1_Core->f.ProgramUniform1iv(program, location, count, value);
-}
-
-inline void QOpenGLFunctions_4_5_Core::glProgramUniform1i(GLuint program, GLint location, GLint v0)
-{
- d_4_1_Core->f.ProgramUniform1i(program, location, v0);
-}
-
-inline void QOpenGLFunctions_4_5_Core::glGetProgramPipelineiv(GLuint pipeline, GLenum pname, GLint *params)
-{
- d_4_1_Core->f.GetProgramPipelineiv(pipeline, pname, params);
-}
-
-inline GLboolean QOpenGLFunctions_4_5_Core::glIsProgramPipeline(GLuint pipeline)
-{
- return d_4_1_Core->f.IsProgramPipeline(pipeline);
-}
-
-inline void QOpenGLFunctions_4_5_Core::glGenProgramPipelines(GLsizei n, GLuint *pipelines)
-{
- d_4_1_Core->f.GenProgramPipelines(n, pipelines);
-}
-
-inline void QOpenGLFunctions_4_5_Core::glDeleteProgramPipelines(GLsizei n, const GLuint *pipelines)
-{
- d_4_1_Core->f.DeleteProgramPipelines(n, pipelines);
-}
-
-inline void QOpenGLFunctions_4_5_Core::glBindProgramPipeline(GLuint pipeline)
-{
- d_4_1_Core->f.BindProgramPipeline(pipeline);
-}
-
-inline GLuint QOpenGLFunctions_4_5_Core::glCreateShaderProgramv(GLenum type, GLsizei count, const GLchar *const *strings)
-{
- return d_4_1_Core->f.CreateShaderProgramv(type, count, strings);
-}
-
-inline void QOpenGLFunctions_4_5_Core::glActiveShaderProgram(GLuint pipeline, GLuint program)
-{
- d_4_1_Core->f.ActiveShaderProgram(pipeline, program);
-}
-
-inline void QOpenGLFunctions_4_5_Core::glUseProgramStages(GLuint pipeline, GLbitfield stages, GLuint program)
-{
- d_4_1_Core->f.UseProgramStages(pipeline, stages, program);
-}
-
-inline void QOpenGLFunctions_4_5_Core::glProgramParameteri(GLuint program, GLenum pname, GLint value)
-{
- d_4_1_Core->f.ProgramParameteri(program, pname, value);
-}
-
-inline void QOpenGLFunctions_4_5_Core::glProgramBinary(GLuint program, GLenum binaryFormat, const void *binary, GLsizei length)
-{
- d_4_1_Core->f.ProgramBinary(program, binaryFormat, binary, length);
-}
-
-inline void QOpenGLFunctions_4_5_Core::glGetProgramBinary(GLuint program, GLsizei bufSize, GLsizei *length, GLenum *binaryFormat, void *binary)
-{
- d_4_1_Core->f.GetProgramBinary(program, bufSize, length, binaryFormat, binary);
-}
-
-inline void QOpenGLFunctions_4_5_Core::glClearDepthf(GLfloat dd)
-{
- d_4_1_Core->f.ClearDepthf(dd);
-}
-
-inline void QOpenGLFunctions_4_5_Core::glDepthRangef(GLfloat n, GLfloat f)
-{
- d_4_1_Core->f.DepthRangef(n, f);
-}
-
-inline void QOpenGLFunctions_4_5_Core::glGetShaderPrecisionFormat(GLenum shadertype, GLenum precisiontype, GLint *range, GLint *precision)
-{
- d_4_1_Core->f.GetShaderPrecisionFormat(shadertype, precisiontype, range, precision);
-}
-
-inline void QOpenGLFunctions_4_5_Core::glShaderBinary(GLsizei count, const GLuint *shaders, GLenum binaryformat, const void *binary, GLsizei length)
-{
- d_4_1_Core->f.ShaderBinary(count, shaders, binaryformat, binary, length);
-}
-
-inline void QOpenGLFunctions_4_5_Core::glReleaseShaderCompiler()
-{
- d_4_1_Core->f.ReleaseShaderCompiler();
-}
-
-
-// OpenGL 4.2 core functions
-inline void QOpenGLFunctions_4_5_Core::glDrawTransformFeedbackStreamInstanced(GLenum mode, GLuint id, GLuint stream, GLsizei instancecount)
-{
- d_4_2_Core->f.DrawTransformFeedbackStreamInstanced(mode, id, stream, instancecount);
-}
-
-inline void QOpenGLFunctions_4_5_Core::glDrawTransformFeedbackInstanced(GLenum mode, GLuint id, GLsizei instancecount)
-{
- d_4_2_Core->f.DrawTransformFeedbackInstanced(mode, id, instancecount);
-}
-
-inline void QOpenGLFunctions_4_5_Core::glTexStorage3D(GLenum target, GLsizei levels, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth)
-{
- d_4_2_Core->f.TexStorage3D(target, levels, internalformat, width, height, depth);
-}
-
-inline void QOpenGLFunctions_4_5_Core::glTexStorage2D(GLenum target, GLsizei levels, GLenum internalformat, GLsizei width, GLsizei height)
-{
- d_4_2_Core->f.TexStorage2D(target, levels, internalformat, width, height);
-}
-
-inline void QOpenGLFunctions_4_5_Core::glTexStorage1D(GLenum target, GLsizei levels, GLenum internalformat, GLsizei width)
-{
- d_4_2_Core->f.TexStorage1D(target, levels, internalformat, width);
-}
-
-inline void QOpenGLFunctions_4_5_Core::glMemoryBarrier(GLbitfield barriers)
-{
- d_4_2_Core->f.MemoryBarrier(barriers);
-}
-
-inline void QOpenGLFunctions_4_5_Core::glBindImageTexture(GLuint unit, GLuint texture, GLint level, GLboolean layered, GLint layer, GLenum access, GLenum format)
-{
- d_4_2_Core->f.BindImageTexture(unit, texture, level, layered, layer, access, format);
-}
-
-inline void QOpenGLFunctions_4_5_Core::glGetActiveAtomicCounterBufferiv(GLuint program, GLuint bufferIndex, GLenum pname, GLint *params)
-{
- d_4_2_Core->f.GetActiveAtomicCounterBufferiv(program, bufferIndex, pname, params);
-}
-
-inline void QOpenGLFunctions_4_5_Core::glGetInternalformativ(GLenum target, GLenum internalformat, GLenum pname, GLsizei bufSize, GLint *params)
-{
- d_4_2_Core->f.GetInternalformativ(target, internalformat, pname, bufSize, params);
-}
-
-inline void QOpenGLFunctions_4_5_Core::glDrawElementsInstancedBaseVertexBaseInstance(GLenum mode, GLsizei count, GLenum type, const void *indices, GLsizei instancecount, GLint basevertex, GLuint baseinstance)
-{
- d_4_2_Core->f.DrawElementsInstancedBaseVertexBaseInstance(mode, count, type, indices, instancecount, basevertex, baseinstance);
-}
-
-inline void QOpenGLFunctions_4_5_Core::glDrawElementsInstancedBaseInstance(GLenum mode, GLsizei count, GLenum type, const void *indices, GLsizei instancecount, GLuint baseinstance)
-{
- d_4_2_Core->f.DrawElementsInstancedBaseInstance(mode, count, type, indices, instancecount, baseinstance);
-}
-
-inline void QOpenGLFunctions_4_5_Core::glDrawArraysInstancedBaseInstance(GLenum mode, GLint first, GLsizei count, GLsizei instancecount, GLuint baseinstance)
-{
- d_4_2_Core->f.DrawArraysInstancedBaseInstance(mode, first, count, instancecount, baseinstance);
-}
-
-
-// OpenGL 4.3 core functions
-inline void QOpenGLFunctions_4_5_Core::glGetObjectPtrLabel(const void *ptr, GLsizei bufSize, GLsizei *length, GLchar *label)
-{
- d_4_3_Core->f.GetObjectPtrLabel(ptr, bufSize, length, label);
-}
-
-inline void QOpenGLFunctions_4_5_Core::glObjectPtrLabel(const void *ptr, GLsizei length, const GLchar *label)
-{
- d_4_3_Core->f.ObjectPtrLabel(ptr, length, label);
-}
-
-inline void QOpenGLFunctions_4_5_Core::glGetObjectLabel(GLenum identifier, GLuint name, GLsizei bufSize, GLsizei *length, GLchar *label)
-{
- d_4_3_Core->f.GetObjectLabel(identifier, name, bufSize, length, label);
-}
-
-inline void QOpenGLFunctions_4_5_Core::glObjectLabel(GLenum identifier, GLuint name, GLsizei length, const GLchar *label)
-{
- d_4_3_Core->f.ObjectLabel(identifier, name, length, label);
-}
-
-inline void QOpenGLFunctions_4_5_Core::glPopDebugGroup()
-{
- d_4_3_Core->f.PopDebugGroup();
-}
-
-inline void QOpenGLFunctions_4_5_Core::glPushDebugGroup(GLenum source, GLuint id, GLsizei length, const GLchar *message)
-{
- d_4_3_Core->f.PushDebugGroup(source, id, length, message);
-}
-
-inline GLuint QOpenGLFunctions_4_5_Core::glGetDebugMessageLog(GLuint count, GLsizei bufSize, GLenum *sources, GLenum *types, GLuint *ids, GLenum *severities, GLsizei *lengths, GLchar *messageLog)
-{
- return d_4_3_Core->f.GetDebugMessageLog(count, bufSize, sources, types, ids, severities, lengths, messageLog);
-}
-
-inline void QOpenGLFunctions_4_5_Core::glDebugMessageCallback(GLDEBUGPROC callback, const void *userParam)
-{
- d_4_3_Core->f.DebugMessageCallback(callback, userParam);
-}
-
-inline void QOpenGLFunctions_4_5_Core::glDebugMessageInsert(GLenum source, GLenum type, GLuint id, GLenum severity, GLsizei length, const GLchar *buf)
-{
- d_4_3_Core->f.DebugMessageInsert(source, type, id, severity, length, buf);
-}
-
-inline void QOpenGLFunctions_4_5_Core::glDebugMessageControl(GLenum source, GLenum type, GLenum severity, GLsizei count, const GLuint *ids, GLboolean enabled)
-{
- d_4_3_Core->f.DebugMessageControl(source, type, severity, count, ids, enabled);
-}
-
-inline void QOpenGLFunctions_4_5_Core::glVertexBindingDivisor(GLuint bindingindex, GLuint divisor)
-{
- d_4_3_Core->f.VertexBindingDivisor(bindingindex, divisor);
-}
-
-inline void QOpenGLFunctions_4_5_Core::glVertexAttribBinding(GLuint attribindex, GLuint bindingindex)
-{
- d_4_3_Core->f.VertexAttribBinding(attribindex, bindingindex);
-}
-
-inline void QOpenGLFunctions_4_5_Core::glVertexAttribLFormat(GLuint attribindex, GLint size, GLenum type, GLuint relativeoffset)
-{
- d_4_3_Core->f.VertexAttribLFormat(attribindex, size, type, relativeoffset);
-}
-
-inline void QOpenGLFunctions_4_5_Core::glVertexAttribIFormat(GLuint attribindex, GLint size, GLenum type, GLuint relativeoffset)
-{
- d_4_3_Core->f.VertexAttribIFormat(attribindex, size, type, relativeoffset);
-}
-
-inline void QOpenGLFunctions_4_5_Core::glVertexAttribFormat(GLuint attribindex, GLint size, GLenum type, GLboolean normalized, GLuint relativeoffset)
-{
- d_4_3_Core->f.VertexAttribFormat(attribindex, size, type, normalized, relativeoffset);
-}
-
-inline void QOpenGLFunctions_4_5_Core::glBindVertexBuffer(GLuint bindingindex, GLuint buffer, GLintptr offset, GLsizei stride)
-{
- d_4_3_Core->f.BindVertexBuffer(bindingindex, buffer, offset, stride);
-}
-
-inline void QOpenGLFunctions_4_5_Core::glTextureView(GLuint texture, GLenum target, GLuint origtexture, GLenum internalformat, GLuint minlevel, GLuint numlevels, GLuint minlayer, GLuint numlayers)
-{
- d_4_3_Core->f.TextureView(texture, target, origtexture, internalformat, minlevel, numlevels, minlayer, numlayers);
-}
-
-inline void QOpenGLFunctions_4_5_Core::glTexStorage3DMultisample(GLenum target, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth, GLboolean fixedsamplelocations)
-{
- d_4_3_Core->f.TexStorage3DMultisample(target, samples, internalformat, width, height, depth, fixedsamplelocations);
-}
-
-inline void QOpenGLFunctions_4_5_Core::glTexStorage2DMultisample(GLenum target, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height, GLboolean fixedsamplelocations)
-{
- d_4_3_Core->f.TexStorage2DMultisample(target, samples, internalformat, width, height, fixedsamplelocations);
-}
-
-inline void QOpenGLFunctions_4_5_Core::glTexBufferRange(GLenum target, GLenum internalformat, GLuint buffer, GLintptr offset, GLsizeiptr size)
-{
- d_4_3_Core->f.TexBufferRange(target, internalformat, buffer, offset, size);
-}
-
-inline void QOpenGLFunctions_4_5_Core::glShaderStorageBlockBinding(GLuint program, GLuint storageBlockIndex, GLuint storageBlockBinding)
-{
- d_4_3_Core->f.ShaderStorageBlockBinding(program, storageBlockIndex, storageBlockBinding);
-}
-
-inline GLint QOpenGLFunctions_4_5_Core::glGetProgramResourceLocationIndex(GLuint program, GLenum programInterface, const GLchar *name)
-{
- return d_4_3_Core->f.GetProgramResourceLocationIndex(program, programInterface, name);
-}
-
-inline GLint QOpenGLFunctions_4_5_Core::glGetProgramResourceLocation(GLuint program, GLenum programInterface, const GLchar *name)
-{
- return d_4_3_Core->f.GetProgramResourceLocation(program, programInterface, name);
-}
-
-inline void QOpenGLFunctions_4_5_Core::glGetProgramResourceiv(GLuint program, GLenum programInterface, GLuint index, GLsizei propCount, const GLenum *props, GLsizei bufSize, GLsizei *length, GLint *params)
-{
- d_4_3_Core->f.GetProgramResourceiv(program, programInterface, index, propCount, props, bufSize, length, params);
-}
-
-inline void QOpenGLFunctions_4_5_Core::glGetProgramResourceName(GLuint program, GLenum programInterface, GLuint index, GLsizei bufSize, GLsizei *length, GLchar *name)
-{
- d_4_3_Core->f.GetProgramResourceName(program, programInterface, index, bufSize, length, name);
-}
-
-inline GLuint QOpenGLFunctions_4_5_Core::glGetProgramResourceIndex(GLuint program, GLenum programInterface, const GLchar *name)
-{
- return d_4_3_Core->f.GetProgramResourceIndex(program, programInterface, name);
-}
-
-inline void QOpenGLFunctions_4_5_Core::glGetProgramInterfaceiv(GLuint program, GLenum programInterface, GLenum pname, GLint *params)
-{
- d_4_3_Core->f.GetProgramInterfaceiv(program, programInterface, pname, params);
-}
-
-inline void QOpenGLFunctions_4_5_Core::glMultiDrawElementsIndirect(GLenum mode, GLenum type, const void *indirect, GLsizei drawcount, GLsizei stride)
-{
- d_4_3_Core->f.MultiDrawElementsIndirect(mode, type, indirect, drawcount, stride);
-}
-
-inline void QOpenGLFunctions_4_5_Core::glMultiDrawArraysIndirect(GLenum mode, const void *indirect, GLsizei drawcount, GLsizei stride)
-{
- d_4_3_Core->f.MultiDrawArraysIndirect(mode, indirect, drawcount, stride);
-}
-
-inline void QOpenGLFunctions_4_5_Core::glInvalidateSubFramebuffer(GLenum target, GLsizei numAttachments, const GLenum *attachments, GLint x, GLint y, GLsizei width, GLsizei height)
-{
- d_4_3_Core->f.InvalidateSubFramebuffer(target, numAttachments, attachments, x, y, width, height);
-}
-
-inline void QOpenGLFunctions_4_5_Core::glInvalidateFramebuffer(GLenum target, GLsizei numAttachments, const GLenum *attachments)
-{
- d_4_3_Core->f.InvalidateFramebuffer(target, numAttachments, attachments);
-}
-
-inline void QOpenGLFunctions_4_5_Core::glInvalidateBufferData(GLuint buffer)
-{
- d_4_3_Core->f.InvalidateBufferData(buffer);
-}
-
-inline void QOpenGLFunctions_4_5_Core::glInvalidateBufferSubData(GLuint buffer, GLintptr offset, GLsizeiptr length)
-{
- d_4_3_Core->f.InvalidateBufferSubData(buffer, offset, length);
-}
-
-inline void QOpenGLFunctions_4_5_Core::glInvalidateTexImage(GLuint texture, GLint level)
-{
- d_4_3_Core->f.InvalidateTexImage(texture, level);
-}
-
-inline void QOpenGLFunctions_4_5_Core::glInvalidateTexSubImage(GLuint texture, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth)
-{
- d_4_3_Core->f.InvalidateTexSubImage(texture, level, xoffset, yoffset, zoffset, width, height, depth);
-}
-
-inline void QOpenGLFunctions_4_5_Core::glGetInternalformati64v(GLenum target, GLenum internalformat, GLenum pname, GLsizei bufSize, GLint64 *params)
-{
- d_4_3_Core->f.GetInternalformati64v(target, internalformat, pname, bufSize, params);
-}
-
-inline void QOpenGLFunctions_4_5_Core::glGetFramebufferParameteriv(GLenum target, GLenum pname, GLint *params)
-{
- d_4_3_Core->f.GetFramebufferParameteriv(target, pname, params);
-}
-
-inline void QOpenGLFunctions_4_5_Core::glFramebufferParameteri(GLenum target, GLenum pname, GLint param)
-{
- d_4_3_Core->f.FramebufferParameteri(target, pname, param);
-}
-
-inline void QOpenGLFunctions_4_5_Core::glCopyImageSubData(GLuint srcName, GLenum srcTarget, GLint srcLevel, GLint srcX, GLint srcY, GLint srcZ, GLuint dstName, GLenum dstTarget, GLint dstLevel, GLint dstX, GLint dstY, GLint dstZ, GLsizei srcWidth, GLsizei srcHeight, GLsizei srcDepth)
-{
- d_4_3_Core->f.CopyImageSubData(srcName, srcTarget, srcLevel, srcX, srcY, srcZ, dstName, dstTarget, dstLevel, dstX, dstY, dstZ, srcWidth, srcHeight, srcDepth);
-}
-
-inline void QOpenGLFunctions_4_5_Core::glDispatchComputeIndirect(GLintptr indirect)
-{
- d_4_3_Core->f.DispatchComputeIndirect(indirect);
-}
-
-inline void QOpenGLFunctions_4_5_Core::glDispatchCompute(GLuint num_groups_x, GLuint num_groups_y, GLuint num_groups_z)
-{
- d_4_3_Core->f.DispatchCompute(num_groups_x, num_groups_y, num_groups_z);
-}
-
-inline void QOpenGLFunctions_4_5_Core::glClearBufferSubData(GLenum target, GLenum internalformat, GLintptr offset, GLsizeiptr size, GLenum format, GLenum type, const void *data)
-{
- d_4_3_Core->f.ClearBufferSubData(target, internalformat, offset, size, format, type, data);
-}
-
-inline void QOpenGLFunctions_4_5_Core::glClearBufferData(GLenum target, GLenum internalformat, GLenum format, GLenum type, const void *data)
-{
- d_4_3_Core->f.ClearBufferData(target, internalformat, format, type, data);
-}
-
-
-// OpenGL 4.4 core functions
-inline void QOpenGLFunctions_4_5_Core::glBindVertexBuffers(GLuint first, GLsizei count, const GLuint *buffers, const GLintptr *offsets, const GLsizei *strides)
-{
- d_4_4_Core->f.BindVertexBuffers(first, count, buffers, offsets, strides);
-}
-
-inline void QOpenGLFunctions_4_5_Core::glBindImageTextures(GLuint first, GLsizei count, const GLuint *textures)
-{
- d_4_4_Core->f.BindImageTextures(first, count, textures);
-}
-
-inline void QOpenGLFunctions_4_5_Core::glBindSamplers(GLuint first, GLsizei count, const GLuint *samplers)
-{
- d_4_4_Core->f.BindSamplers(first, count, samplers);
-}
-
-inline void QOpenGLFunctions_4_5_Core::glBindTextures(GLuint first, GLsizei count, const GLuint *textures)
-{
- d_4_4_Core->f.BindTextures(first, count, textures);
-}
-
-inline void QOpenGLFunctions_4_5_Core::glBindBuffersRange(GLenum target, GLuint first, GLsizei count, const GLuint *buffers, const GLintptr *offsets, const GLsizeiptr *sizes)
-{
- d_4_4_Core->f.BindBuffersRange(target, first, count, buffers, offsets, sizes);
-}
-
-inline void QOpenGLFunctions_4_5_Core::glBindBuffersBase(GLenum target, GLuint first, GLsizei count, const GLuint *buffers)
-{
- d_4_4_Core->f.BindBuffersBase(target, first, count, buffers);
-}
-
-inline void QOpenGLFunctions_4_5_Core::glClearTexSubImage(GLuint texture, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLenum type, const void *data)
-{
- d_4_4_Core->f.ClearTexSubImage(texture, level, xoffset, yoffset, zoffset, width, height, depth, format, type, data);
-}
-
-inline void QOpenGLFunctions_4_5_Core::glClearTexImage(GLuint texture, GLint level, GLenum format, GLenum type, const void *data)
-{
- d_4_4_Core->f.ClearTexImage(texture, level, format, type, data);
-}
-
-inline void QOpenGLFunctions_4_5_Core::glBufferStorage(GLenum target, GLsizeiptr size, const void *data, GLbitfield flags)
-{
- d_4_4_Core->f.BufferStorage(target, size, data, flags);
-}
-
-
-// OpenGL 4.5 core functions
-inline void QOpenGLFunctions_4_5_Core::glTextureBarrier()
-{
- d_4_5_Core->f.TextureBarrier();
-}
-
-inline void QOpenGLFunctions_4_5_Core::glReadnPixels(GLint x, GLint y, GLsizei width, GLsizei height, GLenum format, GLenum type, GLsizei bufSize, void *data)
-{
- d_4_5_Core->f.ReadnPixels(x, y, width, height, format, type, bufSize, data);
-}
-
-inline void QOpenGLFunctions_4_5_Core::glGetnUniformuiv(GLuint program, GLint location, GLsizei bufSize, GLuint *params)
-{
- d_4_5_Core->f.GetnUniformuiv(program, location, bufSize, params);
-}
-
-inline void QOpenGLFunctions_4_5_Core::glGetnUniformiv(GLuint program, GLint location, GLsizei bufSize, GLint *params)
-{
- d_4_5_Core->f.GetnUniformiv(program, location, bufSize, params);
-}
-
-inline void QOpenGLFunctions_4_5_Core::glGetnUniformfv(GLuint program, GLint location, GLsizei bufSize, GLfloat *params)
-{
- d_4_5_Core->f.GetnUniformfv(program, location, bufSize, params);
-}
-
-inline void QOpenGLFunctions_4_5_Core::glGetnUniformdv(GLuint program, GLint location, GLsizei bufSize, GLdouble *params)
-{
- d_4_5_Core->f.GetnUniformdv(program, location, bufSize, params);
-}
-
-inline void QOpenGLFunctions_4_5_Core::glGetnTexImage(GLenum target, GLint level, GLenum format, GLenum type, GLsizei bufSize, void *pixels)
-{
- d_4_5_Core->f.GetnTexImage(target, level, format, type, bufSize, pixels);
-}
-
-inline void QOpenGLFunctions_4_5_Core::glGetnCompressedTexImage(GLenum target, GLint lod, GLsizei bufSize, void *pixels)
-{
- d_4_5_Core->f.GetnCompressedTexImage(target, lod, bufSize, pixels);
-}
-
-inline GLenum QOpenGLFunctions_4_5_Core::glGetGraphicsResetStatus()
-{
- return d_4_5_Core->f.GetGraphicsResetStatus();
-}
-
-inline void QOpenGLFunctions_4_5_Core::glGetCompressedTextureSubImage(GLuint texture, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLsizei bufSize, void *pixels)
-{
- d_4_5_Core->f.GetCompressedTextureSubImage(texture, level, xoffset, yoffset, zoffset, width, height, depth, bufSize, pixels);
-}
-
-inline void QOpenGLFunctions_4_5_Core::glGetTextureSubImage(GLuint texture, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLenum type, GLsizei bufSize, void *pixels)
-{
- d_4_5_Core->f.GetTextureSubImage(texture, level, xoffset, yoffset, zoffset, width, height, depth, format, type, bufSize, pixels);
-}
-
-inline void QOpenGLFunctions_4_5_Core::glMemoryBarrierByRegion(GLbitfield barriers)
-{
- d_4_5_Core->f.MemoryBarrierByRegion(barriers);
-}
-
-inline void QOpenGLFunctions_4_5_Core::glCreateQueries(GLenum target, GLsizei n, GLuint *ids)
-{
- d_4_5_Core->f.CreateQueries(target, n, ids);
-}
-
-inline void QOpenGLFunctions_4_5_Core::glCreateProgramPipelines(GLsizei n, GLuint *pipelines)
-{
- d_4_5_Core->f.CreateProgramPipelines(n, pipelines);
-}
-
-inline void QOpenGLFunctions_4_5_Core::glCreateSamplers(GLsizei n, GLuint *samplers)
-{
- d_4_5_Core->f.CreateSamplers(n, samplers);
-}
-
-inline void QOpenGLFunctions_4_5_Core::glGetVertexArrayIndexed64iv(GLuint vaobj, GLuint index, GLenum pname, GLint64 *param)
-{
- d_4_5_Core->f.GetVertexArrayIndexed64iv(vaobj, index, pname, param);
-}
-
-inline void QOpenGLFunctions_4_5_Core::glGetVertexArrayIndexediv(GLuint vaobj, GLuint index, GLenum pname, GLint *param)
-{
- d_4_5_Core->f.GetVertexArrayIndexediv(vaobj, index, pname, param);
-}
-
-inline void QOpenGLFunctions_4_5_Core::glGetVertexArrayiv(GLuint vaobj, GLenum pname, GLint *param)
-{
- d_4_5_Core->f.GetVertexArrayiv(vaobj, pname, param);
-}
-
-inline void QOpenGLFunctions_4_5_Core::glVertexArrayBindingDivisor(GLuint vaobj, GLuint bindingindex, GLuint divisor)
-{
- d_4_5_Core->f.VertexArrayBindingDivisor(vaobj, bindingindex, divisor);
-}
-
-inline void QOpenGLFunctions_4_5_Core::glVertexArrayAttribLFormat(GLuint vaobj, GLuint attribindex, GLint size, GLenum type, GLuint relativeoffset)
-{
- d_4_5_Core->f.VertexArrayAttribLFormat(vaobj, attribindex, size, type, relativeoffset);
-}
-
-inline void QOpenGLFunctions_4_5_Core::glVertexArrayAttribIFormat(GLuint vaobj, GLuint attribindex, GLint size, GLenum type, GLuint relativeoffset)
-{
- d_4_5_Core->f.VertexArrayAttribIFormat(vaobj, attribindex, size, type, relativeoffset);
-}
-
-inline void QOpenGLFunctions_4_5_Core::glVertexArrayAttribFormat(GLuint vaobj, GLuint attribindex, GLint size, GLenum type, GLboolean normalized, GLuint relativeoffset)
-{
- d_4_5_Core->f.VertexArrayAttribFormat(vaobj, attribindex, size, type, normalized, relativeoffset);
-}
-
-inline void QOpenGLFunctions_4_5_Core::glVertexArrayAttribBinding(GLuint vaobj, GLuint attribindex, GLuint bindingindex)
-{
- d_4_5_Core->f.VertexArrayAttribBinding(vaobj, attribindex, bindingindex);
-}
-
-inline void QOpenGLFunctions_4_5_Core::glVertexArrayVertexBuffers(GLuint vaobj, GLuint first, GLsizei count, const GLuint *buffers, const GLintptr *offsets, const GLsizei *strides)
-{
- d_4_5_Core->f.VertexArrayVertexBuffers(vaobj, first, count, buffers, offsets, strides);
-}
-
-inline void QOpenGLFunctions_4_5_Core::glVertexArrayVertexBuffer(GLuint vaobj, GLuint bindingindex, GLuint buffer, GLintptr offset, GLsizei stride)
-{
- d_4_5_Core->f.VertexArrayVertexBuffer(vaobj, bindingindex, buffer, offset, stride);
-}
-
-inline void QOpenGLFunctions_4_5_Core::glVertexArrayElementBuffer(GLuint vaobj, GLuint buffer)
-{
- d_4_5_Core->f.VertexArrayElementBuffer(vaobj, buffer);
-}
-
-inline void QOpenGLFunctions_4_5_Core::glEnableVertexArrayAttrib(GLuint vaobj, GLuint index)
-{
- d_4_5_Core->f.EnableVertexArrayAttrib(vaobj, index);
-}
-
-inline void QOpenGLFunctions_4_5_Core::glDisableVertexArrayAttrib(GLuint vaobj, GLuint index)
-{
- d_4_5_Core->f.DisableVertexArrayAttrib(vaobj, index);
-}
-
-inline void QOpenGLFunctions_4_5_Core::glCreateVertexArrays(GLsizei n, GLuint *arrays)
-{
- d_4_5_Core->f.CreateVertexArrays(n, arrays);
-}
-
-inline void QOpenGLFunctions_4_5_Core::glGetTextureParameteriv(GLuint texture, GLenum pname, GLint *params)
-{
- d_4_5_Core->f.GetTextureParameteriv(texture, pname, params);
-}
-
-inline void QOpenGLFunctions_4_5_Core::glGetTextureParameterIuiv(GLuint texture, GLenum pname, GLuint *params)
-{
- d_4_5_Core->f.GetTextureParameterIuiv(texture, pname, params);
-}
-
-inline void QOpenGLFunctions_4_5_Core::glGetTextureParameterIiv(GLuint texture, GLenum pname, GLint *params)
-{
- d_4_5_Core->f.GetTextureParameterIiv(texture, pname, params);
-}
-
-inline void QOpenGLFunctions_4_5_Core::glGetTextureParameterfv(GLuint texture, GLenum pname, GLfloat *params)
-{
- d_4_5_Core->f.GetTextureParameterfv(texture, pname, params);
-}
-
-inline void QOpenGLFunctions_4_5_Core::glGetTextureLevelParameteriv(GLuint texture, GLint level, GLenum pname, GLint *params)
-{
- d_4_5_Core->f.GetTextureLevelParameteriv(texture, level, pname, params);
-}
-
-inline void QOpenGLFunctions_4_5_Core::glGetTextureLevelParameterfv(GLuint texture, GLint level, GLenum pname, GLfloat *params)
-{
- d_4_5_Core->f.GetTextureLevelParameterfv(texture, level, pname, params);
-}
-
-inline void QOpenGLFunctions_4_5_Core::glGetCompressedTextureImage(GLuint texture, GLint level, GLsizei bufSize, void *pixels)
-{
- d_4_5_Core->f.GetCompressedTextureImage(texture, level, bufSize, pixels);
-}
-
-inline void QOpenGLFunctions_4_5_Core::glGetTextureImage(GLuint texture, GLint level, GLenum format, GLenum type, GLsizei bufSize, void *pixels)
-{
- d_4_5_Core->f.GetTextureImage(texture, level, format, type, bufSize, pixels);
-}
-
-inline void QOpenGLFunctions_4_5_Core::glBindTextureUnit(GLuint unit, GLuint texture)
-{
- d_4_5_Core->f.BindTextureUnit(unit, texture);
-}
-
-inline void QOpenGLFunctions_4_5_Core::glGenerateTextureMipmap(GLuint texture)
-{
- d_4_5_Core->f.GenerateTextureMipmap(texture);
-}
-
-inline void QOpenGLFunctions_4_5_Core::glTextureParameteriv(GLuint texture, GLenum pname, const GLint *param)
-{
- d_4_5_Core->f.TextureParameteriv(texture, pname, param);
-}
-
-inline void QOpenGLFunctions_4_5_Core::glTextureParameterIuiv(GLuint texture, GLenum pname, const GLuint *params)
-{
- d_4_5_Core->f.TextureParameterIuiv(texture, pname, params);
-}
-
-inline void QOpenGLFunctions_4_5_Core::glTextureParameterIiv(GLuint texture, GLenum pname, const GLint *params)
-{
- d_4_5_Core->f.TextureParameterIiv(texture, pname, params);
-}
-
-inline void QOpenGLFunctions_4_5_Core::glTextureParameteri(GLuint texture, GLenum pname, GLint param)
-{
- d_4_5_Core->f.TextureParameteri(texture, pname, param);
-}
-
-inline void QOpenGLFunctions_4_5_Core::glTextureParameterfv(GLuint texture, GLenum pname, const GLfloat *param)
-{
- d_4_5_Core->f.TextureParameterfv(texture, pname, param);
-}
-
-inline void QOpenGLFunctions_4_5_Core::glTextureParameterf(GLuint texture, GLenum pname, GLfloat param)
-{
- d_4_5_Core->f.TextureParameterf(texture, pname, param);
-}
-
-inline void QOpenGLFunctions_4_5_Core::glCopyTextureSubImage3D(GLuint texture, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLint x, GLint y, GLsizei width, GLsizei height)
-{
- d_4_5_Core->f.CopyTextureSubImage3D(texture, level, xoffset, yoffset, zoffset, x, y, width, height);
-}
-
-inline void QOpenGLFunctions_4_5_Core::glCopyTextureSubImage2D(GLuint texture, GLint level, GLint xoffset, GLint yoffset, GLint x, GLint y, GLsizei width, GLsizei height)
-{
- d_4_5_Core->f.CopyTextureSubImage2D(texture, level, xoffset, yoffset, x, y, width, height);
-}
-
-inline void QOpenGLFunctions_4_5_Core::glCopyTextureSubImage1D(GLuint texture, GLint level, GLint xoffset, GLint x, GLint y, GLsizei width)
-{
- d_4_5_Core->f.CopyTextureSubImage1D(texture, level, xoffset, x, y, width);
-}
-
-inline void QOpenGLFunctions_4_5_Core::glCompressedTextureSubImage3D(GLuint texture, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLsizei imageSize, const void *data)
-{
- d_4_5_Core->f.CompressedTextureSubImage3D(texture, level, xoffset, yoffset, zoffset, width, height, depth, format, imageSize, data);
-}
-
-inline void QOpenGLFunctions_4_5_Core::glCompressedTextureSubImage2D(GLuint texture, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLsizei imageSize, const void *data)
-{
- d_4_5_Core->f.CompressedTextureSubImage2D(texture, level, xoffset, yoffset, width, height, format, imageSize, data);
-}
-
-inline void QOpenGLFunctions_4_5_Core::glCompressedTextureSubImage1D(GLuint texture, GLint level, GLint xoffset, GLsizei width, GLenum format, GLsizei imageSize, const void *data)
-{
- d_4_5_Core->f.CompressedTextureSubImage1D(texture, level, xoffset, width, format, imageSize, data);
-}
-
-inline void QOpenGLFunctions_4_5_Core::glTextureSubImage3D(GLuint texture, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLenum type, const void *pixels)
-{
- d_4_5_Core->f.TextureSubImage3D(texture, level, xoffset, yoffset, zoffset, width, height, depth, format, type, pixels);
-}
-
-inline void QOpenGLFunctions_4_5_Core::glTextureSubImage2D(GLuint texture, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLenum type, const void *pixels)
-{
- d_4_5_Core->f.TextureSubImage2D(texture, level, xoffset, yoffset, width, height, format, type, pixels);
-}
-
-inline void QOpenGLFunctions_4_5_Core::glTextureSubImage1D(GLuint texture, GLint level, GLint xoffset, GLsizei width, GLenum format, GLenum type, const void *pixels)
-{
- d_4_5_Core->f.TextureSubImage1D(texture, level, xoffset, width, format, type, pixels);
-}
-
-inline void QOpenGLFunctions_4_5_Core::glTextureStorage3DMultisample(GLuint texture, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth, GLboolean fixedsamplelocations)
-{
- d_4_5_Core->f.TextureStorage3DMultisample(texture, samples, internalformat, width, height, depth, fixedsamplelocations);
-}
-
-inline void QOpenGLFunctions_4_5_Core::glTextureStorage2DMultisample(GLuint texture, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height, GLboolean fixedsamplelocations)
-{
- d_4_5_Core->f.TextureStorage2DMultisample(texture, samples, internalformat, width, height, fixedsamplelocations);
-}
-
-inline void QOpenGLFunctions_4_5_Core::glTextureStorage3D(GLuint texture, GLsizei levels, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth)
-{
- d_4_5_Core->f.TextureStorage3D(texture, levels, internalformat, width, height, depth);
-}
-
-inline void QOpenGLFunctions_4_5_Core::glTextureStorage2D(GLuint texture, GLsizei levels, GLenum internalformat, GLsizei width, GLsizei height)
-{
- d_4_5_Core->f.TextureStorage2D(texture, levels, internalformat, width, height);
-}
-
-inline void QOpenGLFunctions_4_5_Core::glTextureStorage1D(GLuint texture, GLsizei levels, GLenum internalformat, GLsizei width)
-{
- d_4_5_Core->f.TextureStorage1D(texture, levels, internalformat, width);
-}
-
-inline void QOpenGLFunctions_4_5_Core::glTextureBufferRange(GLuint texture, GLenum internalformat, GLuint buffer, GLintptr offset, GLsizei size)
-{
- d_4_5_Core->f.TextureBufferRange(texture, internalformat, buffer, offset, size);
-}
-
-inline void QOpenGLFunctions_4_5_Core::glTextureBuffer(GLuint texture, GLenum internalformat, GLuint buffer)
-{
- d_4_5_Core->f.TextureBuffer(texture, internalformat, buffer);
-}
-
-inline void QOpenGLFunctions_4_5_Core::glCreateTextures(GLenum target, GLsizei n, GLuint *textures)
-{
- d_4_5_Core->f.CreateTextures(target, n, textures);
-}
-
-inline void QOpenGLFunctions_4_5_Core::glGetNamedRenderbufferParameteriv(GLuint renderbuffer, GLenum pname, GLint *params)
-{
- d_4_5_Core->f.GetNamedRenderbufferParameteriv(renderbuffer, pname, params);
-}
-
-inline void QOpenGLFunctions_4_5_Core::glNamedRenderbufferStorageMultisample(GLuint renderbuffer, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height)
-{
- d_4_5_Core->f.NamedRenderbufferStorageMultisample(renderbuffer, samples, internalformat, width, height);
-}
-
-inline void QOpenGLFunctions_4_5_Core::glNamedRenderbufferStorage(GLuint renderbuffer, GLenum internalformat, GLsizei width, GLsizei height)
-{
- d_4_5_Core->f.NamedRenderbufferStorage(renderbuffer, internalformat, width, height);
-}
-
-inline void QOpenGLFunctions_4_5_Core::glCreateRenderbuffers(GLsizei n, GLuint *renderbuffers)
-{
- d_4_5_Core->f.CreateRenderbuffers(n, renderbuffers);
-}
-
-inline void QOpenGLFunctions_4_5_Core::glGetNamedFramebufferAttachmentParameteriv(GLuint framebuffer, GLenum attachment, GLenum pname, GLint *params)
-{
- d_4_5_Core->f.GetNamedFramebufferAttachmentParameteriv(framebuffer, attachment, pname, params);
-}
-
-inline void QOpenGLFunctions_4_5_Core::glGetNamedFramebufferParameteriv(GLuint framebuffer, GLenum pname, GLint *param)
-{
- d_4_5_Core->f.GetNamedFramebufferParameteriv(framebuffer, pname, param);
-}
-
-inline GLenum QOpenGLFunctions_4_5_Core::glCheckNamedFramebufferStatus(GLuint framebuffer, GLenum target)
-{
- return d_4_5_Core->f.CheckNamedFramebufferStatus(framebuffer, target);
-}
-
-inline void QOpenGLFunctions_4_5_Core::glBlitNamedFramebuffer(GLuint readFramebuffer, GLuint drawFramebuffer, GLint srcX0, GLint srcY0, GLint srcX1, GLint srcY1, GLint dstX0, GLint dstY0, GLint dstX1, GLint dstY1, GLbitfield mask, GLenum filter)
-{
- d_4_5_Core->f.BlitNamedFramebuffer(readFramebuffer, drawFramebuffer, srcX0, srcY0, srcX1, srcY1, dstX0, dstY0, dstX1, dstY1, mask, filter);
-}
-
-inline void QOpenGLFunctions_4_5_Core::glClearNamedFramebufferfi(GLuint framebuffer, GLenum buffer, GLfloat depth, GLint stencil)
-{
- d_4_5_Core->f.ClearNamedFramebufferfi(framebuffer, buffer, depth, stencil);
-}
-
-inline void QOpenGLFunctions_4_5_Core::glClearNamedFramebufferfv(GLuint framebuffer, GLenum buffer, GLint drawbuffer, const GLfloat *value)
-{
- d_4_5_Core->f.ClearNamedFramebufferfv(framebuffer, buffer, drawbuffer, value);
-}
-
-inline void QOpenGLFunctions_4_5_Core::glClearNamedFramebufferuiv(GLuint framebuffer, GLenum buffer, GLint drawbuffer, const GLuint *value)
-{
- d_4_5_Core->f.ClearNamedFramebufferuiv(framebuffer, buffer, drawbuffer, value);
-}
-
-inline void QOpenGLFunctions_4_5_Core::glClearNamedFramebufferiv(GLuint framebuffer, GLenum buffer, GLint drawbuffer, const GLint *value)
-{
- d_4_5_Core->f.ClearNamedFramebufferiv(framebuffer, buffer, drawbuffer, value);
-}
-
-inline void QOpenGLFunctions_4_5_Core::glInvalidateNamedFramebufferSubData(GLuint framebuffer, GLsizei numAttachments, const GLenum *attachments, GLint x, GLint y, GLsizei width, GLsizei height)
-{
- d_4_5_Core->f.InvalidateNamedFramebufferSubData(framebuffer, numAttachments, attachments, x, y, width, height);
-}
-
-inline void QOpenGLFunctions_4_5_Core::glInvalidateNamedFramebufferData(GLuint framebuffer, GLsizei numAttachments, const GLenum *attachments)
-{
- d_4_5_Core->f.InvalidateNamedFramebufferData(framebuffer, numAttachments, attachments);
-}
-
-inline void QOpenGLFunctions_4_5_Core::glNamedFramebufferReadBuffer(GLuint framebuffer, GLenum src)
-{
- d_4_5_Core->f.NamedFramebufferReadBuffer(framebuffer, src);
-}
-
-inline void QOpenGLFunctions_4_5_Core::glNamedFramebufferDrawBuffers(GLuint framebuffer, GLsizei n, const GLenum *bufs)
-{
- d_4_5_Core->f.NamedFramebufferDrawBuffers(framebuffer, n, bufs);
-}
-
-inline void QOpenGLFunctions_4_5_Core::glNamedFramebufferDrawBuffer(GLuint framebuffer, GLenum buf)
-{
- d_4_5_Core->f.NamedFramebufferDrawBuffer(framebuffer, buf);
-}
-
-inline void QOpenGLFunctions_4_5_Core::glNamedFramebufferTextureLayer(GLuint framebuffer, GLenum attachment, GLuint texture, GLint level, GLint layer)
-{
- d_4_5_Core->f.NamedFramebufferTextureLayer(framebuffer, attachment, texture, level, layer);
-}
-
-inline void QOpenGLFunctions_4_5_Core::glNamedFramebufferTexture(GLuint framebuffer, GLenum attachment, GLuint texture, GLint level)
-{
- d_4_5_Core->f.NamedFramebufferTexture(framebuffer, attachment, texture, level);
-}
-
-inline void QOpenGLFunctions_4_5_Core::glNamedFramebufferParameteri(GLuint framebuffer, GLenum pname, GLint param)
-{
- d_4_5_Core->f.NamedFramebufferParameteri(framebuffer, pname, param);
-}
-
-inline void QOpenGLFunctions_4_5_Core::glNamedFramebufferRenderbuffer(GLuint framebuffer, GLenum attachment, GLenum renderbuffertarget, GLuint renderbuffer)
-{
- d_4_5_Core->f.NamedFramebufferRenderbuffer(framebuffer, attachment, renderbuffertarget, renderbuffer);
-}
-
-inline void QOpenGLFunctions_4_5_Core::glCreateFramebuffers(GLsizei n, GLuint *framebuffers)
-{
- d_4_5_Core->f.CreateFramebuffers(n, framebuffers);
-}
-
-inline void QOpenGLFunctions_4_5_Core::glGetNamedBufferSubData(GLuint buffer, GLintptr offset, GLsizei size, void *data)
-{
- d_4_5_Core->f.GetNamedBufferSubData(buffer, offset, size, data);
-}
-
-inline void QOpenGLFunctions_4_5_Core::glGetNamedBufferPointerv(GLuint buffer, GLenum pname, void * *params)
-{
- d_4_5_Core->f.GetNamedBufferPointerv(buffer, pname, params);
-}
-
-inline void QOpenGLFunctions_4_5_Core::glGetNamedBufferParameteri64v(GLuint buffer, GLenum pname, GLint64 *params)
-{
- d_4_5_Core->f.GetNamedBufferParameteri64v(buffer, pname, params);
-}
-
-inline void QOpenGLFunctions_4_5_Core::glGetNamedBufferParameteriv(GLuint buffer, GLenum pname, GLint *params)
-{
- d_4_5_Core->f.GetNamedBufferParameteriv(buffer, pname, params);
-}
-
-inline void QOpenGLFunctions_4_5_Core::glFlushMappedNamedBufferRange(GLuint buffer, GLintptr offset, GLsizei length)
-{
- d_4_5_Core->f.FlushMappedNamedBufferRange(buffer, offset, length);
-}
-
-inline GLboolean QOpenGLFunctions_4_5_Core::glUnmapNamedBuffer(GLuint buffer)
-{
- return d_4_5_Core->f.UnmapNamedBuffer(buffer);
-}
-
-inline void * QOpenGLFunctions_4_5_Core::glMapNamedBufferRange(GLuint buffer, GLintptr offset, GLsizei length, GLbitfield access)
-{
- return d_4_5_Core->f.MapNamedBufferRange(buffer, offset, length, access);
-}
-
-inline void * QOpenGLFunctions_4_5_Core::glMapNamedBuffer(GLuint buffer, GLenum access)
-{
- return d_4_5_Core->f.MapNamedBuffer(buffer, access);
-}
-
-inline void QOpenGLFunctions_4_5_Core::glClearNamedBufferSubData(GLuint buffer, GLenum internalformat, GLintptr offset, GLsizei size, GLenum format, GLenum type, const void *data)
-{
- d_4_5_Core->f.ClearNamedBufferSubData(buffer, internalformat, offset, size, format, type, data);
-}
-
-inline void QOpenGLFunctions_4_5_Core::glClearNamedBufferData(GLuint buffer, GLenum internalformat, GLenum format, GLenum type, const void *data)
-{
- d_4_5_Core->f.ClearNamedBufferData(buffer, internalformat, format, type, data);
-}
-
-inline void QOpenGLFunctions_4_5_Core::glCopyNamedBufferSubData(GLuint readBuffer, GLuint writeBuffer, GLintptr readOffset, GLintptr writeOffset, GLsizei size)
-{
- d_4_5_Core->f.CopyNamedBufferSubData(readBuffer, writeBuffer, readOffset, writeOffset, size);
-}
-
-inline void QOpenGLFunctions_4_5_Core::glNamedBufferSubData(GLuint buffer, GLintptr offset, GLsizei size, const void *data)
-{
- d_4_5_Core->f.NamedBufferSubData(buffer, offset, size, data);
-}
-
-inline void QOpenGLFunctions_4_5_Core::glNamedBufferData(GLuint buffer, GLsizei size, const void *data, GLenum usage)
-{
- d_4_5_Core->f.NamedBufferData(buffer, size, data, usage);
-}
-
-inline void QOpenGLFunctions_4_5_Core::glNamedBufferStorage(GLuint buffer, GLsizei size, const void *data, GLbitfield flags)
-{
- d_4_5_Core->f.NamedBufferStorage(buffer, size, data, flags);
-}
-
-inline void QOpenGLFunctions_4_5_Core::glCreateBuffers(GLsizei n, GLuint *buffers)
-{
- d_4_5_Core->f.CreateBuffers(n, buffers);
-}
-
-inline void QOpenGLFunctions_4_5_Core::glGetTransformFeedbacki64_v(GLuint xfb, GLenum pname, GLuint index, GLint64 *param)
-{
- d_4_5_Core->f.GetTransformFeedbacki64_v(xfb, pname, index, param);
-}
-
-inline void QOpenGLFunctions_4_5_Core::glGetTransformFeedbacki_v(GLuint xfb, GLenum pname, GLuint index, GLint *param)
-{
- d_4_5_Core->f.GetTransformFeedbacki_v(xfb, pname, index, param);
-}
-
-inline void QOpenGLFunctions_4_5_Core::glGetTransformFeedbackiv(GLuint xfb, GLenum pname, GLint *param)
-{
- d_4_5_Core->f.GetTransformFeedbackiv(xfb, pname, param);
-}
-
-inline void QOpenGLFunctions_4_5_Core::glTransformFeedbackBufferRange(GLuint xfb, GLuint index, GLuint buffer, GLintptr offset, GLsizei size)
-{
- d_4_5_Core->f.TransformFeedbackBufferRange(xfb, index, buffer, offset, size);
-}
-
-inline void QOpenGLFunctions_4_5_Core::glTransformFeedbackBufferBase(GLuint xfb, GLuint index, GLuint buffer)
-{
- d_4_5_Core->f.TransformFeedbackBufferBase(xfb, index, buffer);
-}
-
-inline void QOpenGLFunctions_4_5_Core::glCreateTransformFeedbacks(GLsizei n, GLuint *ids)
-{
- d_4_5_Core->f.CreateTransformFeedbacks(n, ids);
-}
-
-inline void QOpenGLFunctions_4_5_Core::glClipControl(GLenum origin, GLenum depth)
-{
- d_4_5_Core->f.ClipControl(origin, depth);
-}
-
-
-
-QT_END_NAMESPACE
-
-#ifdef Q_OS_WIN
-#pragma pop_macro("MemoryBarrier")
-#endif
-
-
-#endif // QT_NO_OPENGL && !QT_OPENGL_ES_2
-
-#endif
diff --git a/src/gui/opengl/qopenglfunctions_es2.cpp b/src/gui/opengl/qopenglfunctions_es2.cpp
deleted file mode 100644
index dd2b3af80b..0000000000
--- a/src/gui/opengl/qopenglfunctions_es2.cpp
+++ /dev/null
@@ -1,106 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2013 Klaralvdalens Datakonsult AB (KDAB)
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the QtGui module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "qopenglfunctions_es2.h"
-#include "qopenglcontext.h"
-
-QT_BEGIN_NAMESPACE
-
-/*!
- \class QOpenGLFunctions_ES2
- \inmodule QtGui
- \since 5.1
- \wrapper
- \brief The QOpenGLFunctions_ES2 class provides all functions for OpenGL ES 2.
-
- This class is a wrapper for OpenGL ES 2 functions. See reference pages on
- \l {http://www.khronos.org/opengles/sdk/docs/man/}{khronos.org} for
- function documentation.
-
- \sa QAbstractOpenGLFunctions
-*/
-
-QOpenGLFunctions_ES2::QOpenGLFunctions_ES2()
- : QAbstractOpenGLFunctions()
- , d_es2(0)
-{
-}
-
-QOpenGLFunctions_ES2::~QOpenGLFunctions_ES2()
-{
-}
-
-bool QOpenGLFunctions_ES2::initializeOpenGLFunctions()
-{
- if ( isInitialized() )
- return true;
-
- QOpenGLContext* context = QOpenGLContext::currentContext();
-
- // If owned by a context object make sure it is current.
- // Also check that current context is compatible
- if (((owningContext() && owningContext() == context) || !owningContext())
- && QOpenGLFunctions_ES2::isContextCompatible(context))
- {
- // Nothing to do, just flag that we are initialized
- QAbstractOpenGLFunctions::initializeOpenGLFunctions();
- }
- return isInitialized();
-}
-
-bool QOpenGLFunctions_ES2::isContextCompatible(QOpenGLContext *context)
-{
- Q_ASSERT(context);
- QSurfaceFormat f = context->format();
- const QPair<int, int> v = qMakePair(f.majorVersion(), f.minorVersion());
- if (v < qMakePair(2, 0))
- return false;
- if (f.renderableType() != QSurfaceFormat::OpenGLES)
- return false;
-
- return true;
-}
-
-QOpenGLVersionProfile QOpenGLFunctions_ES2::versionProfile()
-{
- QOpenGLVersionProfile v;
- return v;
-}
-
-QT_END_NAMESPACE
diff --git a/src/gui/opengl/qopenglfunctions_es2.h b/src/gui/opengl/qopenglfunctions_es2.h
deleted file mode 100644
index 851eb5951b..0000000000
--- a/src/gui/opengl/qopenglfunctions_es2.h
+++ /dev/null
@@ -1,931 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2013 Klaralvdalens Datakonsult AB (KDAB)
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the QtGui module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef QOPENGLVERSIONFUNCTIONS_ES2_H
-#define QOPENGLVERSIONFUNCTIONS_ES2_H
-
-#include <QtGui/qtguiglobal.h>
-
-#if defined(QT_OPENGL_ES_2) || defined(Q_QDOC)
-
-#include <QtGui/QOpenGLVersionFunctions>
-#include <QtGui/qopenglcontext.h>
-
-QT_BEGIN_NAMESPACE
-
-class QOpenGLFunctions_ES2Private;
-
-class Q_GUI_EXPORT QOpenGLFunctions_ES2 : public QAbstractOpenGLFunctions
-{
-public:
- QOpenGLFunctions_ES2();
- ~QOpenGLFunctions_ES2();
-
- bool initializeOpenGLFunctions() override;
-
- // OpenGL ES2 core functions
- void glActiveTexture(GLenum texture);
- void glAttachShader(GLuint program, GLuint shader);
- void glBindAttribLocation(GLuint program, GLuint index, const GLchar* name);
- void glBindBuffer(GLenum target, GLuint buffer);
- void glBindFramebuffer(GLenum target, GLuint framebuffer);
- void glBindRenderbuffer(GLenum target, GLuint renderbuffer);
- void glBindTexture(GLenum target, GLuint texture);
- void glBlendColor(GLclampf red, GLclampf green, GLclampf blue, GLclampf alpha);
- void glBlendEquation(GLenum mode);
- void glBlendEquationSeparate(GLenum modeRGB, GLenum modeAlpha);
- void glBlendFunc(GLenum sfactor, GLenum dfactor);
- void glBlendFuncSeparate(GLenum srcRGB, GLenum dstRGB, GLenum srcAlpha, GLenum dstAlpha);
- void glBufferData(GLenum target, GLsizeiptr size, const GLvoid* data, GLenum usage);
- void glBufferSubData(GLenum target, GLintptr offset, GLsizeiptr size, const GLvoid* data);
- GLenum glCheckFramebufferStatus(GLenum target);
- void glClear(GLbitfield mask);
- void glClearColor(GLclampf red, GLclampf green, GLclampf blue, GLclampf alpha);
- void glClearDepthf(GLclampf depth);
- void glClearStencil(GLint s);
- void glColorMask(GLboolean red, GLboolean green, GLboolean blue, GLboolean alpha);
- void glCompileShader(GLuint shader);
- void glCompressedTexImage2D(GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLint border, GLsizei imageSize, const GLvoid* data);
- void glCompressedTexSubImage2D(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLsizei imageSize, const GLvoid* data);
- void glCopyTexImage2D(GLenum target, GLint level, GLenum internalformat, GLint x, GLint y, GLsizei width, GLsizei height, GLint border);
- void glCopyTexSubImage2D(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint x, GLint y, GLsizei width, GLsizei height);
- GLuint glCreateProgram(void);
- GLuint glCreateShader(GLenum type);
- void glCullFace(GLenum mode);
- void glDeleteBuffers(GLsizei n, const GLuint* buffers);
- void glDeleteFramebuffers(GLsizei n, const GLuint* framebuffers);
- void glDeleteProgram(GLuint program);
- void glDeleteRenderbuffers(GLsizei n, const GLuint* renderbuffers);
- void glDeleteShader(GLuint shader);
- void glDeleteTextures(GLsizei n, const GLuint* textures);
- void glDepthFunc(GLenum func);
- void glDepthMask(GLboolean flag);
- void glDepthRangef(GLclampf zNear, GLclampf zFar);
- void glDetachShader(GLuint program, GLuint shader);
- void glDisable(GLenum cap);
- void glDisableVertexAttribArray(GLuint index);
- void glDrawArrays(GLenum mode, GLint first, GLsizei count);
- void glDrawElements(GLenum mode, GLsizei count, GLenum type, const GLvoid* indices);
- void glEnable(GLenum cap);
- void glEnableVertexAttribArray(GLuint index);
- void glFinish(void);
- void glFlush(void);
- void glFramebufferRenderbuffer(GLenum target, GLenum attachment, GLenum renderbuffertarget, GLuint renderbuffer);
- void glFramebufferTexture2D(GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level);
- void glFrontFace(GLenum mode);
- void glGenBuffers(GLsizei n, GLuint* buffers);
- void glGenerateMipmap(GLenum target);
- void glGenFramebuffers(GLsizei n, GLuint* framebuffers);
- void glGenRenderbuffers(GLsizei n, GLuint* renderbuffers);
- void glGenTextures(GLsizei n, GLuint* textures);
- void glGetActiveAttrib(GLuint program, GLuint index, GLsizei bufsize, GLsizei* length, GLint* size, GLenum* type, GLchar* name);
- void glGetActiveUniform(GLuint program, GLuint index, GLsizei bufsize, GLsizei* length, GLint* size, GLenum* type, GLchar* name);
- void glGetAttachedShaders(GLuint program, GLsizei maxcount, GLsizei* count, GLuint* shaders);
- int glGetAttribLocation(GLuint program, const GLchar* name);
- void glGetBooleanv(GLenum pname, GLboolean* params);
- void glGetBufferParameteriv(GLenum target, GLenum pname, GLint* params);
- GLenum glGetError(void);
- void glGetFloatv(GLenum pname, GLfloat* params);
- void glGetFramebufferAttachmentParameteriv(GLenum target, GLenum attachment, GLenum pname, GLint* params);
- void glGetIntegerv(GLenum pname, GLint* params);
- void glGetProgramiv(GLuint program, GLenum pname, GLint* params);
- void glGetProgramInfoLog(GLuint program, GLsizei bufsize, GLsizei* length, GLchar* infolog);
- void glGetRenderbufferParameteriv(GLenum target, GLenum pname, GLint* params);
- void glGetShaderiv(GLuint shader, GLenum pname, GLint* params);
- void glGetShaderInfoLog(GLuint shader, GLsizei bufsize, GLsizei* length, GLchar* infolog);
- void glGetShaderPrecisionFormat(GLenum shadertype, GLenum precisiontype, GLint* range, GLint* precision);
- void glGetShaderSource(GLuint shader, GLsizei bufsize, GLsizei* length, GLchar* source);
- const GLubyte* glGetString(GLenum name);
- void glGetTexParameterfv(GLenum target, GLenum pname, GLfloat* params);
- void glGetTexParameteriv(GLenum target, GLenum pname, GLint* params);
- void glGetUniformfv(GLuint program, GLint location, GLfloat* params);
- void glGetUniformiv(GLuint program, GLint location, GLint* params);
- int glGetUniformLocation(GLuint program, const GLchar* name);
- void glGetVertexAttribfv(GLuint index, GLenum pname, GLfloat* params);
- void glGetVertexAttribiv(GLuint index, GLenum pname, GLint* params);
- void glGetVertexAttribPointerv(GLuint index, GLenum pname, GLvoid** pointer);
- void glHint(GLenum target, GLenum mode);
- GLboolean glIsBuffer(GLuint buffer);
- GLboolean glIsEnabled(GLenum cap);
- GLboolean glIsFramebuffer(GLuint framebuffer);
- GLboolean glIsProgram(GLuint program);
- GLboolean glIsRenderbuffer(GLuint renderbuffer);
- GLboolean glIsShader(GLuint shader);
- GLboolean glIsTexture(GLuint texture);
- void glLineWidth(GLfloat width);
- void glLinkProgram(GLuint program);
- void glPixelStorei(GLenum pname, GLint param);
- void glPolygonOffset(GLfloat factor, GLfloat units);
- void glReadPixels(GLint x, GLint y, GLsizei width, GLsizei height, GLenum format, GLenum type, GLvoid* pixels);
- void glReleaseShaderCompiler(void);
- void glRenderbufferStorage(GLenum target, GLenum internalformat, GLsizei width, GLsizei height);
- void glSampleCoverage(GLclampf value, GLboolean invert);
- void glScissor(GLint x, GLint y, GLsizei width, GLsizei height);
- void glShaderBinary(GLsizei n, const GLuint* shaders, GLenum binaryformat, const GLvoid* binary, GLsizei length);
- void glShaderSource(GLuint shader, GLsizei count, const GLchar* *string, const GLint* length);
- void glStencilFunc(GLenum func, GLint ref, GLuint mask);
- void glStencilFuncSeparate(GLenum face, GLenum func, GLint ref, GLuint mask);
- void glStencilMask(GLuint mask);
- void glStencilMaskSeparate(GLenum face, GLuint mask);
- void glStencilOp(GLenum fail, GLenum zfail, GLenum zpass);
- void glStencilOpSeparate(GLenum face, GLenum fail, GLenum zfail, GLenum zpass);
- void glTexImage2D(GLenum target, GLint level, GLint internalformat, GLsizei width, GLsizei height, GLint border, GLenum format, GLenum type, const GLvoid* pixels);
- void glTexParameterf(GLenum target, GLenum pname, GLfloat param);
- void glTexParameterfv(GLenum target, GLenum pname, const GLfloat* params);
- void glTexParameteri(GLenum target, GLenum pname, GLint param);
- void glTexParameteriv(GLenum target, GLenum pname, const GLint* params);
- void glTexSubImage2D(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLenum type, const GLvoid* pixels);
- void glUniform1f(GLint location, GLfloat x);
- void glUniform1fv(GLint location, GLsizei count, const GLfloat* v);
- void glUniform1i(GLint location, GLint x);
- void glUniform1iv(GLint location, GLsizei count, const GLint* v);
- void glUniform2f(GLint location, GLfloat x, GLfloat y);
- void glUniform2fv(GLint location, GLsizei count, const GLfloat* v);
- void glUniform2i(GLint location, GLint x, GLint y);
- void glUniform2iv(GLint location, GLsizei count, const GLint* v);
- void glUniform3f(GLint location, GLfloat x, GLfloat y, GLfloat z);
- void glUniform3fv(GLint location, GLsizei count, const GLfloat* v);
- void glUniform3i(GLint location, GLint x, GLint y, GLint z);
- void glUniform3iv(GLint location, GLsizei count, const GLint* v);
- void glUniform4f(GLint location, GLfloat x, GLfloat y, GLfloat z, GLfloat w);
- void glUniform4fv(GLint location, GLsizei count, const GLfloat* v);
- void glUniform4i(GLint location, GLint x, GLint y, GLint z, GLint w);
- void glUniform4iv(GLint location, GLsizei count, const GLint* v);
- void glUniformMatrix2fv(GLint location, GLsizei count, GLboolean transpose, const GLfloat* value);
- void glUniformMatrix3fv(GLint location, GLsizei count, GLboolean transpose, const GLfloat* value);
- void glUniformMatrix4fv(GLint location, GLsizei count, GLboolean transpose, const GLfloat* value);
- void glUseProgram(GLuint program);
- void glValidateProgram(GLuint program);
- void glVertexAttrib1f(GLuint indx, GLfloat x);
- void glVertexAttrib1fv(GLuint indx, const GLfloat* values);
- void glVertexAttrib2f(GLuint indx, GLfloat x, GLfloat y);
- void glVertexAttrib2fv(GLuint indx, const GLfloat* values);
- void glVertexAttrib3f(GLuint indx, GLfloat x, GLfloat y, GLfloat z);
- void glVertexAttrib3fv(GLuint indx, const GLfloat* values);
- void glVertexAttrib4f(GLuint indx, GLfloat x, GLfloat y, GLfloat z, GLfloat w);
- void glVertexAttrib4fv(GLuint indx, const GLfloat* values);
- void glVertexAttribPointer(GLuint indx, GLint size, GLenum type, GLboolean normalized, GLsizei stride, const GLvoid* ptr);
- void glViewport(GLint x, GLint y, GLsizei width, GLsizei height);
-
-private:
- friend class QOpenGLContext;
-
- static bool isContextCompatible(QOpenGLContext *context);
- static QOpenGLVersionProfile versionProfile();
-
- // For future expansion - not used
- QOpenGLFunctions_ES2Private* d_es2;
-};
-
-// OpenGL ES2 core functions
-inline void QOpenGLFunctions_ES2::glActiveTexture(GLenum texture)
-{
- ::glActiveTexture(texture);
-}
-
-inline void QOpenGLFunctions_ES2::glAttachShader(GLuint program, GLuint shader)
-{
- ::glAttachShader(program, shader);
-}
-
-inline void QOpenGLFunctions_ES2::glBindAttribLocation(GLuint program, GLuint index, const GLchar* name)
-{
- ::glBindAttribLocation(program, index, name);
-}
-
-inline void QOpenGLFunctions_ES2::glBindBuffer(GLenum target, GLuint buffer)
-{
- ::glBindBuffer(target, buffer);
-}
-
-inline void QOpenGLFunctions_ES2::glBindFramebuffer(GLenum target, GLuint framebuffer)
-{
- ::glBindFramebuffer(target, framebuffer);
-}
-
-inline void QOpenGLFunctions_ES2::glBindRenderbuffer(GLenum target, GLuint renderbuffer)
-{
- ::glBindRenderbuffer(target, renderbuffer);
-}
-
-inline void QOpenGLFunctions_ES2::glBindTexture(GLenum target, GLuint texture)
-{
- ::glBindTexture(target, texture);
-}
-
-inline void QOpenGLFunctions_ES2::glBlendColor(GLclampf red, GLclampf green, GLclampf blue, GLclampf alpha)
-{
- ::glBlendColor(red, green, blue, alpha);
-}
-
-inline void QOpenGLFunctions_ES2::glBlendEquation(GLenum mode)
-{
- ::glBlendEquation(mode);
-}
-
-inline void QOpenGLFunctions_ES2::glBlendEquationSeparate(GLenum modeRGB, GLenum modeAlpha)
-{
- ::glBlendEquationSeparate(modeRGB, modeAlpha);
-}
-
-inline void QOpenGLFunctions_ES2::glBlendFunc(GLenum sfactor, GLenum dfactor)
-{
- ::glBlendFunc(sfactor, dfactor);
-}
-
-inline void QOpenGLFunctions_ES2::glBlendFuncSeparate(GLenum srcRGB, GLenum dstRGB, GLenum srcAlpha, GLenum dstAlpha)
-{
- ::glBlendFuncSeparate(srcRGB, dstRGB, srcAlpha, dstAlpha);
-}
-
-inline void QOpenGLFunctions_ES2::glBufferData(GLenum target, GLsizeiptr size, const GLvoid* data, GLenum usage)
-{
- ::glBufferData(target, size, data, usage);
-}
-
-inline void QOpenGLFunctions_ES2::glBufferSubData(GLenum target, GLintptr offset, GLsizeiptr size, const GLvoid* data)
-{
- ::glBufferSubData(target, offset, size, data);
-}
-
-inline GLenum QOpenGLFunctions_ES2::glCheckFramebufferStatus(GLenum target)
-{
- return ::glCheckFramebufferStatus(target);
-}
-
-inline void QOpenGLFunctions_ES2::glClear(GLbitfield mask)
-{
- ::glClear(mask);
-}
-
-inline void QOpenGLFunctions_ES2::glClearColor(GLclampf red, GLclampf green, GLclampf blue, GLclampf alpha)
-{
- ::glClearColor(red, green, blue, alpha);
-}
-
-inline void QOpenGLFunctions_ES2::glClearDepthf(GLclampf depth)
-{
- ::glClearDepthf(depth);
-}
-
-inline void QOpenGLFunctions_ES2::glClearStencil(GLint s)
-{
- ::glClearStencil(s);
-}
-
-inline void QOpenGLFunctions_ES2::glColorMask(GLboolean red, GLboolean green, GLboolean blue, GLboolean alpha)
-{
- ::glColorMask(red, green, blue, alpha);
-}
-
-inline void QOpenGLFunctions_ES2::glCompileShader(GLuint shader)
-{
- ::glCompileShader(shader);
-}
-
-inline void QOpenGLFunctions_ES2::glCompressedTexImage2D(GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLint border, GLsizei imageSize, const GLvoid* data)
-{
- ::glCompressedTexImage2D(target, level, internalformat, width, height, border, imageSize, data);
-}
-
-inline void QOpenGLFunctions_ES2::glCompressedTexSubImage2D(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLsizei imageSize, const GLvoid* data)
-{
- ::glCompressedTexSubImage2D(target, level, xoffset, yoffset, width, height, format, imageSize, data);
-}
-
-inline void QOpenGLFunctions_ES2::glCopyTexImage2D(GLenum target, GLint level, GLenum internalformat, GLint x, GLint y, GLsizei width, GLsizei height, GLint border)
-{
- ::glCopyTexImage2D(target, level, internalformat, x, y, width, height, border);
-}
-
-inline void QOpenGLFunctions_ES2::glCopyTexSubImage2D(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint x, GLint y, GLsizei width, GLsizei height)
-{
- ::glCopyTexSubImage2D(target, level, xoffset, yoffset, x, y, width, height);
-}
-
-inline GLuint QOpenGLFunctions_ES2::glCreateProgram(void)
-{
- return ::glCreateProgram();
-}
-
-inline GLuint QOpenGLFunctions_ES2::glCreateShader(GLenum type)
-{
- return ::glCreateShader(type);
-}
-
-inline void QOpenGLFunctions_ES2::glCullFace(GLenum mode)
-{
- ::glCullFace(mode);
-}
-
-inline void QOpenGLFunctions_ES2::glDeleteBuffers(GLsizei n, const GLuint* buffers)
-{
- ::glDeleteBuffers(n, buffers);
-}
-
-inline void QOpenGLFunctions_ES2::glDeleteFramebuffers(GLsizei n, const GLuint* framebuffers)
-{
- ::glDeleteFramebuffers(n, framebuffers);
-}
-
-inline void QOpenGLFunctions_ES2::glDeleteProgram(GLuint program)
-{
- ::glDeleteProgram(program);
-}
-
-inline void QOpenGLFunctions_ES2::glDeleteRenderbuffers(GLsizei n, const GLuint* renderbuffers)
-{
- ::glDeleteRenderbuffers(n, renderbuffers);
-}
-
-inline void QOpenGLFunctions_ES2::glDeleteShader(GLuint shader)
-{
- ::glDeleteShader(shader);
-}
-
-inline void QOpenGLFunctions_ES2::glDeleteTextures(GLsizei n, const GLuint* textures)
-{
- ::glDeleteTextures(n, textures);
-}
-
-inline void QOpenGLFunctions_ES2::glDepthFunc(GLenum func)
-{
- ::glDepthFunc(func);
-}
-
-inline void QOpenGLFunctions_ES2::glDepthMask(GLboolean flag)
-{
- ::glDepthMask(flag);
-}
-
-inline void QOpenGLFunctions_ES2::glDepthRangef(GLclampf zNear, GLclampf zFar)
-{
- ::glDepthRangef(zNear, zFar);
-}
-
-inline void QOpenGLFunctions_ES2::glDetachShader(GLuint program, GLuint shader)
-{
- ::glDetachShader(program, shader);
-}
-
-inline void QOpenGLFunctions_ES2::glDisable(GLenum cap)
-{
- ::glDisable(cap);
-}
-
-inline void QOpenGLFunctions_ES2::glDisableVertexAttribArray(GLuint index)
-{
- ::glDisableVertexAttribArray(index);
-}
-
-inline void QOpenGLFunctions_ES2::glDrawArrays(GLenum mode, GLint first, GLsizei count)
-{
- ::glDrawArrays(mode, first, count);
-}
-
-inline void QOpenGLFunctions_ES2::glDrawElements(GLenum mode, GLsizei count, GLenum type, const GLvoid* indices)
-{
- ::glDrawElements(mode, count, type, indices);
-}
-
-inline void QOpenGLFunctions_ES2::glEnable(GLenum cap)
-{
- ::glEnable(cap);
-}
-
-inline void QOpenGLFunctions_ES2::glEnableVertexAttribArray(GLuint index)
-{
- ::glEnableVertexAttribArray(index);
-}
-
-inline void QOpenGLFunctions_ES2::glFinish(void)
-{
- ::glFinish();
-}
-
-inline void QOpenGLFunctions_ES2::glFlush(void)
-{
- ::glFlush();
-}
-
-inline void QOpenGLFunctions_ES2::glFramebufferRenderbuffer(GLenum target, GLenum attachment, GLenum renderbuffertarget, GLuint renderbuffer)
-{
- ::glFramebufferRenderbuffer(target, attachment, renderbuffertarget, renderbuffer);
-}
-
-inline void QOpenGLFunctions_ES2::glFramebufferTexture2D(GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level)
-{
- ::glFramebufferTexture2D(target, attachment, textarget, texture, level);
-}
-
-inline void QOpenGLFunctions_ES2::glFrontFace(GLenum mode)
-{
- ::glFrontFace(mode);
-}
-
-inline void QOpenGLFunctions_ES2::glGenBuffers(GLsizei n, GLuint* buffers)
-{
- ::glGenBuffers(n, buffers);
-}
-
-inline void QOpenGLFunctions_ES2::glGenerateMipmap(GLenum target)
-{
- ::glGenerateMipmap(target);
-}
-
-inline void QOpenGLFunctions_ES2::glGenFramebuffers(GLsizei n, GLuint* framebuffers)
-{
- ::glGenFramebuffers(n, framebuffers);
-}
-
-inline void QOpenGLFunctions_ES2::glGenRenderbuffers(GLsizei n, GLuint* renderbuffers)
-{
- ::glGenRenderbuffers(n, renderbuffers);
-}
-
-inline void QOpenGLFunctions_ES2::glGenTextures(GLsizei n, GLuint* textures)
-{
- ::glGenTextures(n, textures);
-}
-
-inline void QOpenGLFunctions_ES2::glGetActiveAttrib(GLuint program, GLuint index, GLsizei bufsize, GLsizei* length, GLint* size, GLenum* type, GLchar* name)
-{
- ::glGetActiveAttrib(program, index, bufsize, length, size, type, name);
-}
-
-inline void QOpenGLFunctions_ES2::glGetActiveUniform(GLuint program, GLuint index, GLsizei bufsize, GLsizei* length, GLint* size, GLenum* type, GLchar* name)
-{
- ::glGetActiveUniform(program, index, bufsize, length, size, type, name);
-}
-
-inline void QOpenGLFunctions_ES2::glGetAttachedShaders(GLuint program, GLsizei maxcount, GLsizei* count, GLuint* shaders)
-{
- ::glGetAttachedShaders(program, maxcount, count, shaders);
-}
-
-inline int QOpenGLFunctions_ES2::glGetAttribLocation(GLuint program, const GLchar* name)
-{
- return ::glGetAttribLocation(program, name);
-}
-
-inline void QOpenGLFunctions_ES2::glGetBooleanv(GLenum pname, GLboolean* params)
-{
- ::glGetBooleanv(pname, params);
-}
-
-inline void QOpenGLFunctions_ES2::glGetBufferParameteriv(GLenum target, GLenum pname, GLint* params)
-{
- ::glGetBufferParameteriv(target, pname, params);
-}
-
-inline GLenum QOpenGLFunctions_ES2::glGetError(void)
-{
- return ::glGetError();
-}
-
-inline void QOpenGLFunctions_ES2::glGetFloatv(GLenum pname, GLfloat* params)
-{
- ::glGetFloatv(pname, params);
-}
-
-inline void QOpenGLFunctions_ES2::glGetFramebufferAttachmentParameteriv(GLenum target, GLenum attachment, GLenum pname, GLint* params)
-{
- ::glGetFramebufferAttachmentParameteriv(target, attachment, pname, params);
-}
-
-inline void QOpenGLFunctions_ES2::glGetIntegerv(GLenum pname, GLint* params)
-{
- ::glGetIntegerv(pname, params);
-}
-
-inline void QOpenGLFunctions_ES2::glGetProgramiv(GLuint program, GLenum pname, GLint* params)
-{
- ::glGetProgramiv(program, pname, params);
-}
-
-inline void QOpenGLFunctions_ES2::glGetProgramInfoLog(GLuint program, GLsizei bufsize, GLsizei* length, GLchar* infolog)
-{
- ::glGetProgramInfoLog(program, bufsize, length, infolog);
-}
-
-inline void QOpenGLFunctions_ES2::glGetRenderbufferParameteriv(GLenum target, GLenum pname, GLint* params)
-{
- ::glGetRenderbufferParameteriv(target, pname, params);
-}
-
-inline void QOpenGLFunctions_ES2::glGetShaderiv(GLuint shader, GLenum pname, GLint* params)
-{
- ::glGetShaderiv(shader, pname, params);
-}
-
-inline void QOpenGLFunctions_ES2::glGetShaderInfoLog(GLuint shader, GLsizei bufsize, GLsizei* length, GLchar* infolog)
-{
- ::glGetShaderInfoLog(shader, bufsize, length, infolog);
-}
-
-inline void QOpenGLFunctions_ES2::glGetShaderPrecisionFormat(GLenum shadertype, GLenum precisiontype, GLint* range, GLint* precision)
-{
- ::glGetShaderPrecisionFormat(shadertype, precisiontype, range, precision);
-}
-
-inline void QOpenGLFunctions_ES2::glGetShaderSource(GLuint shader, GLsizei bufsize, GLsizei* length, GLchar* source)
-{
- ::glGetShaderSource(shader, bufsize, length, source);
-}
-
-inline const GLubyte* QOpenGLFunctions_ES2::glGetString(GLenum name)
-{
- return ::glGetString(name);
-}
-
-inline void QOpenGLFunctions_ES2::glGetTexParameterfv(GLenum target, GLenum pname, GLfloat* params)
-{
- ::glGetTexParameterfv(target, pname, params);
-}
-
-inline void QOpenGLFunctions_ES2::glGetTexParameteriv(GLenum target, GLenum pname, GLint* params)
-{
- ::glGetTexParameteriv(target, pname, params);
-}
-
-inline void QOpenGLFunctions_ES2::glGetUniformfv(GLuint program, GLint location, GLfloat* params)
-{
- ::glGetUniformfv(program, location, params);
-}
-
-inline void QOpenGLFunctions_ES2::glGetUniformiv(GLuint program, GLint location, GLint* params)
-{
- ::glGetUniformiv(program, location, params);
-}
-
-inline int QOpenGLFunctions_ES2::glGetUniformLocation(GLuint program, const GLchar* name)
-{
- return ::glGetUniformLocation(program, name);
-}
-
-inline void QOpenGLFunctions_ES2::glGetVertexAttribfv(GLuint index, GLenum pname, GLfloat* params)
-{
- ::glGetVertexAttribfv(index, pname, params);
-}
-
-inline void QOpenGLFunctions_ES2::glGetVertexAttribiv(GLuint index, GLenum pname, GLint* params)
-{
- ::glGetVertexAttribiv(index, pname, params);
-}
-
-inline void QOpenGLFunctions_ES2::glGetVertexAttribPointerv(GLuint index, GLenum pname, GLvoid** pointer)
-{
- ::glGetVertexAttribPointerv(index, pname, pointer);
-}
-
-inline void QOpenGLFunctions_ES2::glHint(GLenum target, GLenum mode)
-{
- ::glHint(target, mode);
-}
-
-inline GLboolean QOpenGLFunctions_ES2::glIsBuffer(GLuint buffer)
-{
- return ::glIsBuffer(buffer);
-}
-
-inline GLboolean QOpenGLFunctions_ES2::glIsEnabled(GLenum cap)
-{
- return ::glIsEnabled(cap);
-}
-
-inline GLboolean QOpenGLFunctions_ES2::glIsFramebuffer(GLuint framebuffer)
-{
- return ::glIsFramebuffer(framebuffer);
-}
-
-inline GLboolean QOpenGLFunctions_ES2::glIsProgram(GLuint program)
-{
- return ::glIsProgram(program);
-}
-
-inline GLboolean QOpenGLFunctions_ES2::glIsRenderbuffer(GLuint renderbuffer)
-{
- return ::glIsRenderbuffer(renderbuffer);
-}
-
-inline GLboolean QOpenGLFunctions_ES2::glIsShader(GLuint shader)
-{
- return ::glIsShader(shader);
-}
-
-inline GLboolean QOpenGLFunctions_ES2::glIsTexture(GLuint texture)
-{
- return ::glIsTexture(texture);
-}
-
-inline void QOpenGLFunctions_ES2::glLineWidth(GLfloat width)
-{
- ::glLineWidth(width);
-}
-
-inline void QOpenGLFunctions_ES2::glLinkProgram(GLuint program)
-{
- ::glLinkProgram(program);
-}
-
-inline void QOpenGLFunctions_ES2::glPixelStorei(GLenum pname, GLint param)
-{
- ::glPixelStorei(pname, param);
-}
-
-inline void QOpenGLFunctions_ES2::glPolygonOffset(GLfloat factor, GLfloat units)
-{
- ::glPolygonOffset(factor, units);
-}
-
-inline void QOpenGLFunctions_ES2::glReadPixels(GLint x, GLint y, GLsizei width, GLsizei height, GLenum format, GLenum type, GLvoid* pixels)
-{
- ::glReadPixels(x, y, width, height, format, type, pixels);
-}
-
-inline void QOpenGLFunctions_ES2::glReleaseShaderCompiler(void)
-{
- ::glReleaseShaderCompiler();
-}
-
-inline void QOpenGLFunctions_ES2::glRenderbufferStorage(GLenum target, GLenum internalformat, GLsizei width, GLsizei height)
-{
- ::glRenderbufferStorage(target, internalformat, width, height);
-}
-
-inline void QOpenGLFunctions_ES2::glSampleCoverage(GLclampf value, GLboolean invert)
-{
- ::glSampleCoverage(value, invert);
-}
-
-inline void QOpenGLFunctions_ES2::glScissor(GLint x, GLint y, GLsizei width, GLsizei height)
-{
- ::glScissor(x, y, width, height);
-}
-
-inline void QOpenGLFunctions_ES2::glShaderBinary(GLsizei n, const GLuint* shaders, GLenum binaryformat, const GLvoid* binary, GLsizei length)
-{
- ::glShaderBinary(n, shaders, binaryformat, binary, length);
-}
-
-inline void QOpenGLFunctions_ES2::glShaderSource(GLuint shader, GLsizei count, const GLchar* *string, const GLint* length)
-{
- ::glShaderSource(shader, count, string, length);
-}
-
-inline void QOpenGLFunctions_ES2::glStencilFunc(GLenum func, GLint ref, GLuint mask)
-{
- ::glStencilFunc(func, ref, mask);
-}
-
-inline void QOpenGLFunctions_ES2::glStencilFuncSeparate(GLenum face, GLenum func, GLint ref, GLuint mask)
-{
- ::glStencilFuncSeparate(face, func, ref, mask);
-}
-
-inline void QOpenGLFunctions_ES2::glStencilMask(GLuint mask)
-{
- ::glStencilMask(mask);
-}
-
-inline void QOpenGLFunctions_ES2::glStencilMaskSeparate(GLenum face, GLuint mask)
-{
- ::glStencilMaskSeparate(face, mask);
-}
-
-inline void QOpenGLFunctions_ES2::glStencilOp(GLenum fail, GLenum zfail, GLenum zpass)
-{
- ::glStencilOp(fail, zfail, zpass);
-}
-
-inline void QOpenGLFunctions_ES2::glStencilOpSeparate(GLenum face, GLenum fail, GLenum zfail, GLenum zpass)
-{
- ::glStencilOpSeparate(face, fail, zfail, zpass);
-}
-
-inline void QOpenGLFunctions_ES2::glTexImage2D(GLenum target, GLint level, GLint internalformat, GLsizei width, GLsizei height, GLint border, GLenum format, GLenum type, const GLvoid* pixels)
-{
- ::glTexImage2D(target, level, internalformat, width, height, border, format, type, pixels);
-}
-
-inline void QOpenGLFunctions_ES2::glTexParameterf(GLenum target, GLenum pname, GLfloat param)
-{
- ::glTexParameterf(target, pname, param);
-}
-
-inline void QOpenGLFunctions_ES2::glTexParameterfv(GLenum target, GLenum pname, const GLfloat* params)
-{
- ::glTexParameterfv(target, pname, params);
-}
-
-inline void QOpenGLFunctions_ES2::glTexParameteri(GLenum target, GLenum pname, GLint param)
-{
- ::glTexParameteri(target, pname, param);
-}
-
-inline void QOpenGLFunctions_ES2::glTexParameteriv(GLenum target, GLenum pname, const GLint* params)
-{
- ::glTexParameteriv(target, pname, params);
-}
-
-inline void QOpenGLFunctions_ES2::glTexSubImage2D(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLenum type, const GLvoid* pixels)
-{
- ::glTexSubImage2D(target, level, xoffset, yoffset, width, height, format, type, pixels);
-}
-
-inline void QOpenGLFunctions_ES2::glUniform1f(GLint location, GLfloat x)
-{
- ::glUniform1f(location, x);
-}
-
-inline void QOpenGLFunctions_ES2::glUniform1fv(GLint location, GLsizei count, const GLfloat* v)
-{
- ::glUniform1fv(location, count, v);
-}
-
-inline void QOpenGLFunctions_ES2::glUniform1i(GLint location, GLint x)
-{
- ::glUniform1i(location, x);
-}
-
-inline void QOpenGLFunctions_ES2::glUniform1iv(GLint location, GLsizei count, const GLint* v)
-{
- ::glUniform1iv(location, count, v);
-}
-
-inline void QOpenGLFunctions_ES2::glUniform2f(GLint location, GLfloat x, GLfloat y)
-{
- ::glUniform2f(location, x, y);
-}
-
-inline void QOpenGLFunctions_ES2::glUniform2fv(GLint location, GLsizei count, const GLfloat* v)
-{
- ::glUniform2fv(location, count, v);
-}
-
-inline void QOpenGLFunctions_ES2::glUniform2i(GLint location, GLint x, GLint y)
-{
- ::glUniform2i(location, x, y);
-}
-
-inline void QOpenGLFunctions_ES2::glUniform2iv(GLint location, GLsizei count, const GLint* v)
-{
- ::glUniform2iv(location, count, v);
-}
-
-inline void QOpenGLFunctions_ES2::glUniform3f(GLint location, GLfloat x, GLfloat y, GLfloat z)
-{
- ::glUniform3f(location, x, y, z);
-}
-
-inline void QOpenGLFunctions_ES2::glUniform3fv(GLint location, GLsizei count, const GLfloat* v)
-{
- ::glUniform3fv(location, count, v);
-}
-
-inline void QOpenGLFunctions_ES2::glUniform3i(GLint location, GLint x, GLint y, GLint z)
-{
- ::glUniform3i(location, x, y, z);
-}
-
-inline void QOpenGLFunctions_ES2::glUniform3iv(GLint location, GLsizei count, const GLint* v)
-{
- ::glUniform3iv(location, count, v);
-}
-
-inline void QOpenGLFunctions_ES2::glUniform4f(GLint location, GLfloat x, GLfloat y, GLfloat z, GLfloat w)
-{
- ::glUniform4f(location, x, y, z, w);
-}
-
-inline void QOpenGLFunctions_ES2::glUniform4fv(GLint location, GLsizei count, const GLfloat* v)
-{
- ::glUniform4fv(location, count, v);
-}
-
-inline void QOpenGLFunctions_ES2::glUniform4i(GLint location, GLint x, GLint y, GLint z, GLint w)
-{
- ::glUniform4i(location, x, y, z, w);
-}
-
-inline void QOpenGLFunctions_ES2::glUniform4iv(GLint location, GLsizei count, const GLint* v)
-{
- ::glUniform4iv(location, count, v);
-}
-
-inline void QOpenGLFunctions_ES2::glUniformMatrix2fv(GLint location, GLsizei count, GLboolean transpose, const GLfloat* value)
-{
- ::glUniformMatrix2fv(location, count, transpose, value);
-}
-
-inline void QOpenGLFunctions_ES2::glUniformMatrix3fv(GLint location, GLsizei count, GLboolean transpose, const GLfloat* value)
-{
- ::glUniformMatrix3fv(location, count, transpose, value);
-}
-
-inline void QOpenGLFunctions_ES2::glUniformMatrix4fv(GLint location, GLsizei count, GLboolean transpose, const GLfloat* value)
-{
- ::glUniformMatrix4fv(location, count, transpose, value);
-}
-
-inline void QOpenGLFunctions_ES2::glUseProgram(GLuint program)
-{
- ::glUseProgram(program);
-}
-
-inline void QOpenGLFunctions_ES2::glValidateProgram(GLuint program)
-{
- ::glValidateProgram(program);
-}
-
-inline void QOpenGLFunctions_ES2::glVertexAttrib1f(GLuint indx, GLfloat x)
-{
- ::glVertexAttrib1f(indx, x);
-}
-
-inline void QOpenGLFunctions_ES2::glVertexAttrib1fv(GLuint indx, const GLfloat* values)
-{
- ::glVertexAttrib1fv(indx, values);
-}
-
-inline void QOpenGLFunctions_ES2::glVertexAttrib2f(GLuint indx, GLfloat x, GLfloat y)
-{
- ::glVertexAttrib2f(indx, x, y);
-}
-
-inline void QOpenGLFunctions_ES2::glVertexAttrib2fv(GLuint indx, const GLfloat* values)
-{
- ::glVertexAttrib2fv(indx, values);
-}
-
-inline void QOpenGLFunctions_ES2::glVertexAttrib3f(GLuint indx, GLfloat x, GLfloat y, GLfloat z)
-{
- ::glVertexAttrib3f(indx, x, y, z);
-}
-
-inline void QOpenGLFunctions_ES2::glVertexAttrib3fv(GLuint indx, const GLfloat* values)
-{
- ::glVertexAttrib3fv(indx, values);
-}
-
-inline void QOpenGLFunctions_ES2::glVertexAttrib4f(GLuint indx, GLfloat x, GLfloat y, GLfloat z, GLfloat w)
-{
- ::glVertexAttrib4f(indx, x, y, z, w);
-}
-
-inline void QOpenGLFunctions_ES2::glVertexAttrib4fv(GLuint indx, const GLfloat* values)
-{
- ::glVertexAttrib4fv(indx, values);
-}
-
-inline void QOpenGLFunctions_ES2::glVertexAttribPointer(GLuint indx, GLint size, GLenum type, GLboolean normalized, GLsizei stride, const GLvoid* ptr)
-{
- ::glVertexAttribPointer(indx, size, type, normalized, stride, ptr);
-}
-
-inline void QOpenGLFunctions_ES2::glViewport(GLint x, GLint y, GLsizei width, GLsizei height)
-{
- ::glViewport(x, y, width, height);
-}
-
-QT_END_NAMESPACE
-
-#endif // QT_OPENGL_ES_2
-
-#endif
diff --git a/src/gui/opengl/qopenglgradientcache.cpp b/src/gui/opengl/qopenglgradientcache.cpp
deleted file mode 100644
index 3aa4c0d2e6..0000000000
--- a/src/gui/opengl/qopenglgradientcache.cpp
+++ /dev/null
@@ -1,276 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the QtGui module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "qopenglgradientcache_p.h"
-#include <private/qdrawhelper_p.h>
-#include <private/qopenglcontext_p.h>
-#include <private/qrgba64_p.h>
-#include <QtCore/qmutex.h>
-#include <QtCore/qrandom.h>
-#include "qopenglfunctions.h"
-#include "qopenglextensions_p.h"
-
-#ifndef GL_RGBA16
-#define GL_RGBA16 0x805B
-#endif
-
-QT_BEGIN_NAMESPACE
-
-class QOpenGL2GradientCacheWrapper
-{
-public:
- QOpenGL2GradientCache *cacheForContext(QOpenGLContext *context) {
- QMutexLocker lock(&m_mutex);
- return m_resource.value<QOpenGL2GradientCache>(context);
- }
-
-private:
- QOpenGLMultiGroupSharedResource m_resource;
- QMutex m_mutex;
-};
-
-Q_GLOBAL_STATIC(QOpenGL2GradientCacheWrapper, qt_gradient_caches)
-
-QOpenGL2GradientCache::QOpenGL2GradientCache(QOpenGLContext *ctx)
- : QOpenGLSharedResource(ctx->shareGroup())
-{
-}
-
-QOpenGL2GradientCache::~QOpenGL2GradientCache()
-{
- cache.clear();
-}
-
-QOpenGL2GradientCache *QOpenGL2GradientCache::cacheForContext(QOpenGLContext *context)
-{
- return qt_gradient_caches()->cacheForContext(context);
-}
-
-void QOpenGL2GradientCache::invalidateResource()
-{
- QMutexLocker lock(&m_mutex);
- cache.clear();
-}
-
-void QOpenGL2GradientCache::freeResource(QOpenGLContext *)
-{
- cleanCache();
-}
-
-void QOpenGL2GradientCache::cleanCache()
-{
- QMutexLocker lock(&m_mutex);
- QOpenGLGradientColorTableHash::const_iterator it = cache.constBegin();
- QOpenGLFunctions *funcs = QOpenGLContext::currentContext()->functions();
- for (; it != cache.constEnd(); ++it) {
- const CacheInfo &cache_info = it.value();
- funcs->glDeleteTextures(1, &cache_info.texId);
- }
- cache.clear();
-}
-
-GLuint QOpenGL2GradientCache::getBuffer(const QGradient &gradient, qreal opacity)
-{
- quint64 hash_val = 0;
-
- const QGradientStops stops = gradient.stops();
- for (int i = 0; i < stops.size() && i <= 2; i++)
- hash_val += stops[i].second.rgba();
-
- const QMutexLocker lock(&m_mutex);
- QOpenGLGradientColorTableHash::const_iterator it = cache.constFind(hash_val);
-
- if (it == cache.constEnd())
- return addCacheElement(hash_val, gradient, opacity);
- else {
- do {
- const CacheInfo &cache_info = it.value();
- if (cache_info.stops == stops && cache_info.opacity == opacity
- && cache_info.interpolationMode == gradient.interpolationMode())
- {
- return cache_info.texId;
- }
- ++it;
- } while (it != cache.constEnd() && it.key() == hash_val);
- // an exact match for these stops and opacity was not found, create new cache
- return addCacheElement(hash_val, gradient, opacity);
- }
-}
-
-
-GLuint QOpenGL2GradientCache::addCacheElement(quint64 hash_val, const QGradient &gradient, qreal opacity)
-{
- QOpenGLFunctions *funcs = QOpenGLContext::currentContext()->functions();
- if (cache.size() == maxCacheSize()) {
- int elem_to_remove = QRandomGenerator::global()->bounded(maxCacheSize());
- quint64 key = cache.keys()[elem_to_remove];
-
- // need to call glDeleteTextures on each removed cache entry:
- QOpenGLGradientColorTableHash::const_iterator it = cache.constFind(key);
- do {
- funcs->glDeleteTextures(1, &it.value().texId);
- } while (++it != cache.constEnd() && it.key() == key);
- cache.remove(key); // may remove more than 1, but OK
- }
-
- CacheInfo cache_entry(gradient.stops(), opacity, gradient.interpolationMode());
- funcs->glGenTextures(1, &cache_entry.texId);
- funcs->glBindTexture(GL_TEXTURE_2D, cache_entry.texId);
- if (static_cast<QOpenGLExtensions *>(funcs)->hasOpenGLExtension(QOpenGLExtensions::Sized16Formats)) {
- QRgba64 buffer[1024];
- generateGradientColorTable(gradient, buffer, paletteSize(), opacity);
- funcs->glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA16, paletteSize(), 1,
- 0, GL_RGBA, GL_UNSIGNED_SHORT, buffer);
- } else {
- uint buffer[1024];
- generateGradientColorTable(gradient, buffer, paletteSize(), opacity);
- funcs->glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, paletteSize(), 1,
- 0, GL_RGBA, GL_UNSIGNED_BYTE, buffer);
- }
- return cache.insert(hash_val, cache_entry).value().texId;
-}
-
-
-//TODO: Let GL generate the texture using an FBO
-void QOpenGL2GradientCache::generateGradientColorTable(const QGradient& gradient, QRgba64 *colorTable, int size, qreal opacity) const
-{
- int pos = 0;
- const QGradientStops s = gradient.stops();
-
- bool colorInterpolation = (gradient.interpolationMode() == QGradient::ColorInterpolation);
-
- uint alpha = qRound(opacity * 256);
- QRgba64 current_color = combineAlpha256(s[0].second.rgba64(), alpha);
- qreal incr = 1.0 / qreal(size);
- qreal fpos = 1.5 * incr;
- colorTable[pos++] = qPremultiply(current_color);
-
- while (fpos <= s.first().first) {
- colorTable[pos] = colorTable[pos - 1];
- pos++;
- fpos += incr;
- }
-
- if (colorInterpolation)
- current_color = qPremultiply(current_color);
-
- const int sLast = s.size() - 1;
- for (int i = 0; i < sLast; ++i) {
- qreal delta = 1/(s[i+1].first - s[i].first);
- QRgba64 next_color = combineAlpha256(s[i + 1].second.rgba64(), alpha);
- if (colorInterpolation)
- next_color = qPremultiply(next_color);
-
- while (fpos < s[i+1].first && pos < size) {
- int dist = int(256 * ((fpos - s[i].first) * delta));
- int idist = 256 - dist;
- if (colorInterpolation)
- colorTable[pos] = interpolate256(current_color, idist, next_color, dist);
- else
- colorTable[pos] = qPremultiply(interpolate256(current_color, idist, next_color, dist));
- ++pos;
- fpos += incr;
- }
- current_color = next_color;
- }
-
- Q_ASSERT(s.size() > 0);
-
- QRgba64 last_color = qPremultiply(combineAlpha256(s[sLast].second.rgba64(), alpha));
- for (;pos < size; ++pos)
- colorTable[pos] = last_color;
-
- // Make sure the last color stop is represented at the end of the table
- colorTable[size-1] = last_color;
-}
-
-void QOpenGL2GradientCache::generateGradientColorTable(const QGradient& gradient, uint *colorTable, int size, qreal opacity) const
-{
- int pos = 0;
- const QGradientStops s = gradient.stops();
-
- bool colorInterpolation = (gradient.interpolationMode() == QGradient::ColorInterpolation);
-
- uint alpha = qRound(opacity * 256);
- // Qt LIES! It returns ARGB (on little-endian AND on big-endian)
- uint current_color = ARGB_COMBINE_ALPHA(s[0].second.rgba(), alpha);
- qreal incr = 1.0 / qreal(size);
- qreal fpos = 1.5 * incr;
- colorTable[pos++] = ARGB2RGBA(qPremultiply(current_color));
-
- while (fpos <= s.first().first) {
- colorTable[pos] = colorTable[pos - 1];
- pos++;
- fpos += incr;
- }
-
- if (colorInterpolation)
- current_color = qPremultiply(current_color);
-
- const int sLast = s.size() - 1;
- for (int i = 0; i < sLast; ++i) {
- qreal delta = 1/(s[i+1].first - s[i].first);
- uint next_color = ARGB_COMBINE_ALPHA(s[i + 1].second.rgba(), alpha);
- if (colorInterpolation)
- next_color = qPremultiply(next_color);
-
- while (fpos < s[i+1].first && pos < size) {
- int dist = int(256 * ((fpos - s[i].first) * delta));
- int idist = 256 - dist;
- if (colorInterpolation)
- colorTable[pos] = ARGB2RGBA(INTERPOLATE_PIXEL_256(current_color, idist, next_color, dist));
- else
- colorTable[pos] = ARGB2RGBA(qPremultiply(INTERPOLATE_PIXEL_256(current_color, idist, next_color, dist)));
- ++pos;
- fpos += incr;
- }
- current_color = next_color;
- }
-
- Q_ASSERT(s.size() > 0);
-
- uint last_color = ARGB2RGBA(qPremultiply(ARGB_COMBINE_ALPHA(s[sLast].second.rgba(), alpha)));
- for (;pos < size; ++pos)
- colorTable[pos] = last_color;
-
- // Make sure the last color stop is represented at the end of the table
- colorTable[size-1] = last_color;
-}
-
-QT_END_NAMESPACE
diff --git a/src/gui/opengl/qopenglgradientcache_p.h b/src/gui/opengl/qopenglgradientcache_p.h
deleted file mode 100644
index 1d34223bdd..0000000000
--- a/src/gui/opengl/qopenglgradientcache_p.h
+++ /dev/null
@@ -1,108 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the QtGui module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef QOPENGLGRADIENTCACHE_P_H
-#define QOPENGLGRADIENTCACHE_P_H
-
-//
-// W A R N I N G
-// -------------
-//
-// This file is not part of the Qt API. It exists purely as an
-// implementation detail. This header file may change from version to
-// version without notice, or even be removed.
-//
-// We mean it.
-//
-
-#include <QtGui/private/qtguiglobal_p.h>
-#include <QMultiHash>
-#include <QObject>
-#include <private/qopenglcontext_p.h>
-#include <QtCore/qmutex.h>
-#include <QGradient>
-#include <qrgba64.h>
-
-QT_BEGIN_NAMESPACE
-
-class QOpenGL2GradientCache : public QOpenGLSharedResource
-{
- struct CacheInfo
- {
- inline CacheInfo(QGradientStops s, qreal op, QGradient::InterpolationMode mode) :
- stops(std::move(s)), opacity(op), interpolationMode(mode) {}
-
- GLuint texId;
- QGradientStops stops;
- qreal opacity;
- QGradient::InterpolationMode interpolationMode;
- };
-
- typedef QMultiHash<quint64, CacheInfo> QOpenGLGradientColorTableHash;
-
-public:
- static QOpenGL2GradientCache *cacheForContext(QOpenGLContext *context);
-
- QOpenGL2GradientCache(QOpenGLContext *);
- ~QOpenGL2GradientCache();
-
- GLuint getBuffer(const QGradient &gradient, qreal opacity);
- inline int paletteSize() const { return 1024; }
-
- void invalidateResource() override;
- void freeResource(QOpenGLContext *ctx) override;
-
-private:
- inline int maxCacheSize() const { return 60; }
- inline void generateGradientColorTable(const QGradient& gradient,
- QRgba64 *colorTable,
- int size, qreal opacity) const;
- inline void generateGradientColorTable(const QGradient& gradient,
- uint *colorTable,
- int size, qreal opacity) const;
- GLuint addCacheElement(quint64 hash_val, const QGradient &gradient, qreal opacity);
- void cleanCache();
-
- QOpenGLGradientColorTableHash cache;
- QMutex m_mutex;
-};
-
-QT_END_NAMESPACE
-
-#endif // QOPENGLGRADIENTCACHE_P_H
diff --git a/src/gui/opengl/qopenglpaintdevice.cpp b/src/gui/opengl/qopenglpaintdevice.cpp
deleted file mode 100644
index 3920a10467..0000000000
--- a/src/gui/opengl/qopenglpaintdevice.cpp
+++ /dev/null
@@ -1,372 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the QtGui module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include <qopenglpaintdevice.h>
-#include <qpaintengine.h>
-#include <qthreadstorage.h>
-
-#include <private/qopenglpaintdevice_p.h>
-#include <private/qobject_p.h>
-#include <private/qopenglcontext_p.h>
-#include <private/qopenglframebufferobject_p.h>
-#include <private/qopenglpaintengine_p.h>
-
-// for qt_defaultDpiX/Y
-#include <private/qfont_p.h>
-
-#include <qopenglfunctions.h>
-
-QT_BEGIN_NAMESPACE
-
-/*!
- \class QOpenGLPaintDevice
- \brief The QOpenGLPaintDevice class enables painting to an OpenGL context using QPainter.
- \since 5.0
- \inmodule QtGui
-
- \ingroup painting-3D
-
- The QOpenGLPaintDevice uses the \b current QOpenGL context to render
- QPainter draw commands. The context is captured upon construction. It
- requires support for OpenGL (ES) 2.0 or higher.
-
- \section1 Performance
-
- The QOpenGLPaintDevice is almost always hardware accelerated and
- has the potential of being much faster than software
- rasterization. However, it is more sensitive to state changes, and
- therefore requires the drawing commands to be carefully ordered to
- achieve optimal performance.
-
- \section1 Antialiasing and Quality
-
- Antialiasing in the OpenGL paint engine is done using
- multisampling. Most hardware require significantly more memory to
- do multisampling and the resulting quality is not on par with the
- quality of the software paint engine. The OpenGL paint engine's
- strength lies in its performance, not its visual rendering
- quality.
-
- \section1 State Changes
-
- When painting to a QOpenGLPaintDevice using QPainter, the state of
- the current OpenGL context will be altered by the paint engine to
- reflect its needs. Applications should not rely upon the OpenGL
- state being reset to its original conditions, particularly the
- current shader program, OpenGL viewport, texture units, and
- drawing modes.
-
- \section1 Mixing QPainter and OpenGL
-
- When intermixing QPainter and OpenGL, it is important to notify
- QPainter that the OpenGL state may have been cluttered so it can
- restore its internal state. This is achieved by calling \l
- QPainter::beginNativePainting() before starting the OpenGL
- rendering and calling \l QPainter::endNativePainting() after
- finishing.
-
- \sa {OpenGL Window Example}
-
-*/
-
-/*!
- Constructs a QOpenGLPaintDevice.
-
- The QOpenGLPaintDevice is only valid for the current context.
-
- \sa QOpenGLContext::currentContext()
-*/
-QOpenGLPaintDevice::QOpenGLPaintDevice()
- : d_ptr(new QOpenGLPaintDevicePrivate(QSize()))
-{
-}
-
-/*!
- Constructs a QOpenGLPaintDevice with the given \a size.
-
- The QOpenGLPaintDevice is only valid for the current context.
-
- \sa QOpenGLContext::currentContext()
-*/
-QOpenGLPaintDevice::QOpenGLPaintDevice(const QSize &size)
- : d_ptr(new QOpenGLPaintDevicePrivate(size))
-{
-}
-
-/*!
- Constructs a QOpenGLPaintDevice with the given \a width and \a height.
-
- The QOpenGLPaintDevice is only valid for the current context.
-
- \sa QOpenGLContext::currentContext()
-*/
-QOpenGLPaintDevice::QOpenGLPaintDevice(int width, int height)
- : QOpenGLPaintDevice(QSize(width, height))
-{
-}
-
-/*!
- \internal
- */
-QOpenGLPaintDevice::QOpenGLPaintDevice(QOpenGLPaintDevicePrivate &dd)
- : d_ptr(&dd)
-{
-}
-
-/*!
- Destroys the QOpenGLPaintDevice.
-*/
-
-QOpenGLPaintDevice::~QOpenGLPaintDevice()
-{
- delete d_ptr->engine;
-}
-
-/*!
- \fn int QOpenGLPaintDevice::devType() const
- \internal
- \reimp
-*/
-
-QOpenGLPaintDevicePrivate::QOpenGLPaintDevicePrivate(const QSize &sz)
- : size(sz)
- , ctx(QOpenGLContext::currentContext())
- , dpmx(qt_defaultDpiX() * 100. / 2.54)
- , dpmy(qt_defaultDpiY() * 100. / 2.54)
- , devicePixelRatio(1.0)
- , flipped(false)
- , engine(nullptr)
-{
-}
-
-QOpenGLPaintDevicePrivate::~QOpenGLPaintDevicePrivate()
-{
-}
-
-class QOpenGLEngineThreadStorage
-{
-public:
- QPaintEngine *engine() {
- QPaintEngine *&localEngine = storage.localData();
- if (!localEngine)
- localEngine = new QOpenGL2PaintEngineEx;
- return localEngine;
- }
-
-private:
- QThreadStorage<QPaintEngine *> storage;
-};
-
-Q_GLOBAL_STATIC(QOpenGLEngineThreadStorage, qt_opengl_engine)
-
-/*!
- \reimp
-*/
-
-QPaintEngine *QOpenGLPaintDevice::paintEngine() const
-{
- if (d_ptr->engine)
- return d_ptr->engine;
-
- QPaintEngine *engine = qt_opengl_engine()->engine();
- if (engine->isActive() && engine->paintDevice() != this) {
- d_ptr->engine = new QOpenGL2PaintEngineEx;
- return d_ptr->engine;
- }
-
- return engine;
-}
-
-/*!
- Returns the OpenGL context associated with the paint device.
-*/
-
-QOpenGLContext *QOpenGLPaintDevice::context() const
-{
- return d_ptr->ctx;
-}
-
-/*!
- Returns the pixel size of the paint device.
-
- \sa setSize()
-*/
-
-QSize QOpenGLPaintDevice::size() const
-{
- return d_ptr->size;
-}
-
-/*!
- Sets the pixel size of the paint device to \a size.
-
- \sa size()
-*/
-
-void QOpenGLPaintDevice::setSize(const QSize &size)
-{
- d_ptr->size = size;
-}
-
-/*!
- Sets the device pixel ratio for the paint device to \a devicePixelRatio.
-*/
-void QOpenGLPaintDevice::setDevicePixelRatio(qreal devicePixelRatio)
-{
- d_ptr->devicePixelRatio = devicePixelRatio;
-}
-
-/*!
- \reimp
-*/
-
-int QOpenGLPaintDevice::metric(QPaintDevice::PaintDeviceMetric metric) const
-{
- switch (metric) {
- case PdmWidth:
- return d_ptr->size.width();
- case PdmHeight:
- return d_ptr->size.height();
- case PdmDepth:
- return 32;
- case PdmWidthMM:
- return qRound(d_ptr->size.width() * 1000 / d_ptr->dpmx);
- case PdmHeightMM:
- return qRound(d_ptr->size.height() * 1000 / d_ptr->dpmy);
- case PdmNumColors:
- return 0;
- case PdmDpiX:
- return qRound(d_ptr->dpmx * 0.0254);
- case PdmDpiY:
- return qRound(d_ptr->dpmy * 0.0254);
- case PdmPhysicalDpiX:
- return qRound(d_ptr->dpmx * 0.0254);
- case PdmPhysicalDpiY:
- return qRound(d_ptr->dpmy * 0.0254);
- case PdmDevicePixelRatio:
- return d_ptr->devicePixelRatio;
- case PdmDevicePixelRatioScaled:
- return d_ptr->devicePixelRatio * QPaintDevice::devicePixelRatioFScale();
-
- default:
- qWarning("QOpenGLPaintDevice::metric() - metric %d not known", metric);
- return 0;
- }
-}
-
-/*!
- Returns the number of pixels per meter horizontally.
-
- \sa setDotsPerMeterX()
-*/
-
-qreal QOpenGLPaintDevice::dotsPerMeterX() const
-{
- return d_ptr->dpmx;
-}
-
-/*!
- Returns the number of pixels per meter vertically.
-
- \sa setDotsPerMeterY()
-*/
-
-qreal QOpenGLPaintDevice::dotsPerMeterY() const
-{
- return d_ptr->dpmy;
-}
-
-/*!
- Sets the number of pixels per meter horizontally to \a dpmx.
-
- \sa dotsPerMeterX()
-*/
-
-void QOpenGLPaintDevice::setDotsPerMeterX(qreal dpmx)
-{
- d_ptr->dpmx = dpmx;
-}
-
-/*!
- Sets the number of pixels per meter vertically to \a dpmy.
-
- \sa dotsPerMeterY()
-*/
-
-void QOpenGLPaintDevice::setDotsPerMeterY(qreal dpmy)
-{
- d_ptr->dpmx = dpmy;
-}
-
-/*!
- Sets whether painting should be flipped around the Y-axis or not to \a flipped.
-
- \sa paintFlipped()
-*/
-void QOpenGLPaintDevice::setPaintFlipped(bool flipped)
-{
- d_ptr->flipped = flipped;
-}
-
-/*!
- Returns \c true if painting is flipped around the Y-axis.
-
- \sa setPaintFlipped()
-*/
-
-bool QOpenGLPaintDevice::paintFlipped() const
-{
- return d_ptr->flipped;
-}
-
-/*!
- This virtual method is provided as a callback to allow re-binding a target
- frame buffer object or context when different QOpenGLPaintDevice instances
- are issuing draw calls alternately.
-
- \l{QPainter::beginNativePainting()}{beginNativePainting()} will also trigger
- this method.
-
- The default implementation does nothing.
-*/
-void QOpenGLPaintDevice::ensureActiveTarget()
-{
-}
-
-QT_END_NAMESPACE
diff --git a/src/gui/opengl/qopenglpaintdevice.h b/src/gui/opengl/qopenglpaintdevice.h
deleted file mode 100644
index 54118f2926..0000000000
--- a/src/gui/opengl/qopenglpaintdevice.h
+++ /dev/null
@@ -1,95 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the QtGui module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef QOPENGLPAINTDEVICE_H
-#define QOPENGLPAINTDEVICE_H
-
-#include <QtGui/qtguiglobal.h>
-
-#ifndef QT_NO_OPENGL
-
-#include <QtGui/qpaintdevice.h>
-#include <QtGui/qopengl.h>
-#include <QtGui/qopenglcontext.h>
-
-QT_BEGIN_NAMESPACE
-
-class QOpenGLPaintDevicePrivate;
-
-class Q_GUI_EXPORT QOpenGLPaintDevice : public QPaintDevice
-{
- Q_DECLARE_PRIVATE(QOpenGLPaintDevice)
-public:
- QOpenGLPaintDevice();
- explicit QOpenGLPaintDevice(const QSize &size);
- QOpenGLPaintDevice(int width, int height);
- ~QOpenGLPaintDevice();
-
- int devType() const override { return QInternal::OpenGL; }
- QPaintEngine *paintEngine() const override;
-
- QOpenGLContext *context() const;
- QSize size() const;
- void setSize(const QSize &size);
- void setDevicePixelRatio(qreal devicePixelRatio);
-
- qreal dotsPerMeterX() const;
- qreal dotsPerMeterY() const;
-
- void setDotsPerMeterX(qreal);
- void setDotsPerMeterY(qreal);
-
- void setPaintFlipped(bool flipped);
- bool paintFlipped() const;
-
- virtual void ensureActiveTarget();
-
-protected:
- QOpenGLPaintDevice(QOpenGLPaintDevicePrivate &dd);
- int metric(QPaintDevice::PaintDeviceMetric metric) const override;
-
- Q_DISABLE_COPY(QOpenGLPaintDevice)
- QScopedPointer<QOpenGLPaintDevicePrivate> d_ptr;
-};
-
-QT_END_NAMESPACE
-
-#endif // QT_NO_OPENGL
-
-#endif // QOPENGLPAINTDEVICE_H
diff --git a/src/gui/opengl/qopenglpaintdevice_p.h b/src/gui/opengl/qopenglpaintdevice_p.h
deleted file mode 100644
index 3683ebebac..0000000000
--- a/src/gui/opengl/qopenglpaintdevice_p.h
+++ /dev/null
@@ -1,88 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the QtGui module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef QOPENGL_PAINTDEVICE_P_H
-#define QOPENGL_PAINTDEVICE_P_H
-
-//
-// W A R N I N G
-// -------------
-//
-// This file is not part of the Qt API. It exists for the convenience
-// of the Qt OpenGL classes. This header file may change from
-// version to version without notice, or even be removed.
-//
-// We mean it.
-//
-
-#include <QtGui/private/qtguiglobal_p.h>
-#include <qopenglpaintdevice.h>
-
-QT_BEGIN_NAMESPACE
-
-class QOpenGLContext;
-class QPaintEngine;
-
-class Q_GUI_EXPORT QOpenGLPaintDevicePrivate
-{
-public:
- QOpenGLPaintDevicePrivate(const QSize &size);
- virtual ~QOpenGLPaintDevicePrivate();
-
- static QOpenGLPaintDevicePrivate *get(QOpenGLPaintDevice *dev) { return dev->d_func(); }
-
- virtual void beginPaint() { }
- virtual void endPaint() { }
-
-public:
- QSize size;
- QOpenGLContext *ctx;
-
- qreal dpmx;
- qreal dpmy;
- qreal devicePixelRatio;
-
- bool flipped;
-
- QPaintEngine *engine;
-};
-
-QT_END_NAMESPACE
-
-#endif // QOPENGL_PAINTDEVICE_P_H
diff --git a/src/gui/opengl/qopenglpaintengine.cpp b/src/gui/opengl/qopenglpaintengine.cpp
deleted file mode 100644
index a82edbb073..0000000000
--- a/src/gui/opengl/qopenglpaintengine.cpp
+++ /dev/null
@@ -1,2701 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the QtGui module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-/*
- When the active program changes, we need to update it's uniforms.
- We could track state for each program and only update stale uniforms
- - Could lead to lots of overhead if there's a lot of programs
- We could update all the uniforms when the program changes
- - Could end up updating lots of uniforms which don't need updating
-
- Updating uniforms should be cheap, so the overhead of updating up-to-date
- uniforms should be minimal. It's also less complex.
-
- Things which _may_ cause a different program to be used:
- - Change in brush/pen style
- - Change in painter opacity
- - Change in composition mode
-
- Whenever we set a mode on the shader manager - it needs to tell us if it had
- to switch to a different program.
-
- The shader manager should only switch when we tell it to. E.g. if we set a new
- brush style and then switch to transparent painter, we only want it to compile
- and use the correct program when we really need it.
-*/
-
-// #define QT_OPENGL_CACHE_AS_VBOS
-
-#include "qopenglgradientcache_p.h"
-#include "qopengltexturecache_p.h"
-#include "qopenglpaintengine_p.h"
-#include "qopenglpaintdevice_p.h"
-
-#include <string.h> //for memcpy
-#include <qmath.h>
-
-#include <private/qopengl_p.h>
-#include <private/qopenglcontext_p.h>
-#include <private/qopenglextensions_p.h>
-#include <private/qpaintengineex_p.h>
-#include <QPaintEngine>
-#include <private/qpainter_p.h>
-#include <private/qfontengine_p.h>
-#include <private/qdatabuffer_p.h>
-#include <private/qstatictext_p.h>
-#include <private/qtriangulator_p.h>
-
-#include "qopenglengineshadermanager_p.h"
-#include "qopengl2pexvertexarray_p.h"
-#include "qopengltextureglyphcache_p.h"
-
-#include <QDebug>
-
-#ifndef GL_KHR_blend_equation_advanced
-#define GL_KHR_blend_equation_advanced 1
-#define GL_MULTIPLY_KHR 0x9294
-#define GL_SCREEN_KHR 0x9295
-#define GL_OVERLAY_KHR 0x9296
-#define GL_DARKEN_KHR 0x9297
-#define GL_LIGHTEN_KHR 0x9298
-#define GL_COLORDODGE_KHR 0x9299
-#define GL_COLORBURN_KHR 0x929A
-#define GL_HARDLIGHT_KHR 0x929B
-#define GL_SOFTLIGHT_KHR 0x929C
-#define GL_DIFFERENCE_KHR 0x929E
-#define GL_EXCLUSION_KHR 0x92A0
-#endif /* GL_KHR_blend_equation_advanced */
-
-#ifndef GL_KHR_blend_equation_advanced_coherent
-#define GL_KHR_blend_equation_advanced_coherent 1
-#define GL_BLEND_ADVANCED_COHERENT_KHR 0x9285
-#endif /* GL_KHR_blend_equation_advanced_coherent */
-
-QT_BEGIN_NAMESPACE
-
-
-Q_GUI_EXPORT QImage qt_imageForBrush(int brushStyle, bool invert);
-
-////////////////////////////////// Private Methods //////////////////////////////////////////
-
-QOpenGL2PaintEngineExPrivate::~QOpenGL2PaintEngineExPrivate()
-{
- delete shaderManager;
-
- vertexBuffer.destroy();
- texCoordBuffer.destroy();
- opacityBuffer.destroy();
- indexBuffer.destroy();
- vao.destroy();
-
- if (elementIndicesVBOId != 0) {
- funcs.glDeleteBuffers(1, &elementIndicesVBOId);
- elementIndicesVBOId = 0;
- }
-}
-
-inline QColor qt_premultiplyColor(QColor c, GLfloat opacity)
-{
- qreal alpha = c.alphaF() * opacity;
- c.setAlphaF(alpha);
- c.setRedF(c.redF() * alpha);
- c.setGreenF(c.greenF() * alpha);
- c.setBlueF(c.blueF() * alpha);
- return c;
-}
-
-
-void QOpenGL2PaintEngineExPrivate::setBrush(const QBrush& brush)
-{
- if (qbrush_fast_equals(currentBrush, brush))
- return;
-
- const Qt::BrushStyle newStyle = qbrush_style(brush);
- Q_ASSERT(newStyle != Qt::NoBrush);
-
- currentBrush = brush;
- if (!currentBrushImage.isNull())
- currentBrushImage = QImage();
- brushUniformsDirty = true; // All brushes have at least one uniform
-
- if (newStyle > Qt::SolidPattern)
- brushTextureDirty = true;
-
- if (currentBrush.style() == Qt::TexturePattern
- && qHasPixmapTexture(brush) && brush.texture().isQBitmap())
- {
- shaderManager->setSrcPixelType(QOpenGLEngineShaderManager::TextureSrcWithPattern);
- } else {
- shaderManager->setSrcPixelType(newStyle);
- }
- shaderManager->optimiseForBrushTransform(currentBrush.transform().type());
-}
-
-
-void QOpenGL2PaintEngineExPrivate::useSimpleShader()
-{
- shaderManager->useSimpleProgram();
-
- if (matrixDirty)
- updateMatrix();
-}
-
-/*
- Single entry-point for activating, binding, and setting properties.
-
- Allows keeping track of (caching) the latest texture unit and bound
- texture in a central place, so that we can skip re-binding unless
- needed.
-
- \note Any code or Qt API that internally activates or binds will
- not affect the cache used by this function, which means they will
- lead to inconsisent state. QPainter::beginNativePainting() takes
- care of resetting the cache, so for user–code this is fine, but
- internally in the paint engine care must be taken to not call
- functions that may activate or bind under our feet.
-*/
-template<typename T>
-void QOpenGL2PaintEngineExPrivate::updateTexture(GLenum textureUnit, const T &texture, GLenum wrapMode, GLenum filterMode, TextureUpdateMode updateMode)
-{
- static const GLenum target = GL_TEXTURE_2D;
-
- activateTextureUnit(textureUnit);
-
- GLuint textureId = bindTexture(texture);
-
- if (updateMode == UpdateIfNeeded && textureId == lastTextureUsed)
- return;
-
- lastTextureUsed = textureId;
-
- funcs.glTexParameteri(target, GL_TEXTURE_WRAP_S, wrapMode);
- funcs.glTexParameteri(target, GL_TEXTURE_WRAP_T, wrapMode);
-
- funcs.glTexParameteri(target, GL_TEXTURE_MAG_FILTER, filterMode);
- funcs.glTexParameteri(target, GL_TEXTURE_MIN_FILTER, filterMode);
-}
-
-void QOpenGL2PaintEngineExPrivate::activateTextureUnit(GLenum textureUnit)
-{
- if (textureUnit != lastTextureUnitUsed) {
- funcs.glActiveTexture(GL_TEXTURE0 + textureUnit);
- lastTextureUnitUsed = textureUnit;
-
- // We simplify things by keeping a single cached value of the last
- // texture that was bound, instead of one per texture unit. This
- // means that switching texture units could potentially mean we
- // need a re-bind and corresponding parameter updates.
- lastTextureUsed = GLuint(-1);
- }
-}
-
-template<>
-GLuint QOpenGL2PaintEngineExPrivate::bindTexture(const GLuint &textureId)
-{
- if (textureId != lastTextureUsed)
- funcs.glBindTexture(GL_TEXTURE_2D, textureId);
-
- return textureId;
-}
-
-template<>
-GLuint QOpenGL2PaintEngineExPrivate::bindTexture(const QImage &image)
-{
- return QOpenGLTextureCache::cacheForContext(ctx)->bindTexture(ctx, image);
-}
-
-template<>
-GLuint QOpenGL2PaintEngineExPrivate::bindTexture(const QPixmap &pixmap)
-{
- return QOpenGLTextureCache::cacheForContext(ctx)->bindTexture(ctx, pixmap);
-}
-
-template<>
-GLuint QOpenGL2PaintEngineExPrivate::bindTexture(const QGradient &gradient)
-{
- // We apply global opacity in the fragment shaders, so we always pass 1.0
- // for opacity to the cache.
- GLuint textureId = QOpenGL2GradientCache::cacheForContext(ctx)->getBuffer(gradient, 1.0);
-
- // QOpenGL2GradientCache::getBuffer() may bind and generate a new texture if it
- // hasn't been cached yet, but will otherwise return an unbound texture id. To
- // be sure that the texture is bound, we unfortunately have to bind again,
- // which results in the initial generation of the texture doing two binds.
- return bindTexture(textureId);
-}
-
-struct ImageWithBindOptions
-{
- const QImage &image;
- QOpenGLTextureUploader::BindOptions options;
-};
-
-template<>
-GLuint QOpenGL2PaintEngineExPrivate::bindTexture(const ImageWithBindOptions &imageWithOptions)
-{
- return QOpenGLTextureCache::cacheForContext(ctx)->bindTexture(ctx, imageWithOptions.image, imageWithOptions.options);
-}
-
-inline static bool isPowerOfTwo(int x)
-{
- // Assumption: x >= 1
- return x == (x & -x);
-}
-
-void QOpenGL2PaintEngineExPrivate::updateBrushTexture()
-{
- Q_Q(QOpenGL2PaintEngineEx);
-// qDebug("QOpenGL2PaintEngineExPrivate::updateBrushTexture()");
- Qt::BrushStyle style = currentBrush.style();
-
- bool smoothPixmapTransform = q->state()->renderHints & QPainter::SmoothPixmapTransform;
- GLenum filterMode = smoothPixmapTransform ? GL_LINEAR : GL_NEAREST;
-
- if ( (style >= Qt::Dense1Pattern) && (style <= Qt::DiagCrossPattern) ) {
- // Get the image data for the pattern
- QImage textureImage = qt_imageForBrush(style, false);
-
- updateTexture(QT_BRUSH_TEXTURE_UNIT, textureImage, GL_REPEAT, filterMode, ForceUpdate);
- }
- else if (style >= Qt::LinearGradientPattern && style <= Qt::ConicalGradientPattern) {
- // Gradiant brush: All the gradiants use the same texture
-
- const QGradient *gradient = currentBrush.gradient();
-
- GLenum wrapMode = GL_CLAMP_TO_EDGE;
- if (gradient->spread() == QGradient::RepeatSpread || gradient->type() == QGradient::ConicalGradient)
- wrapMode = GL_REPEAT;
- else if (gradient->spread() == QGradient::ReflectSpread)
- wrapMode = GL_MIRRORED_REPEAT;
-
- updateTexture(QT_BRUSH_TEXTURE_UNIT, *gradient, wrapMode, filterMode, ForceUpdate);
- }
- else if (style == Qt::TexturePattern) {
- currentBrushImage = currentBrush.textureImage();
-
- int max_texture_size = ctx->d_func()->maxTextureSize();
- QSize newSize = currentBrushImage.size();
- newSize = newSize.boundedTo(QSize(max_texture_size, max_texture_size));
- if (!QOpenGLContext::currentContext()->functions()->hasOpenGLFeature(QOpenGLFunctions::NPOTTextureRepeat)) {
- if (!isPowerOfTwo(newSize.width()) || !isPowerOfTwo(newSize.height())) {
- newSize.setHeight(qNextPowerOfTwo(newSize.height() - 1));
- newSize.setWidth(qNextPowerOfTwo(newSize.width() - 1));
- }
- }
- if (currentBrushImage.size() != newSize)
- currentBrushImage = currentBrushImage.scaled(newSize, Qt::IgnoreAspectRatio, Qt::SmoothTransformation);
-
- GLuint wrapMode = GL_REPEAT;
-
- updateTexture(QT_BRUSH_TEXTURE_UNIT, currentBrushImage, wrapMode, filterMode, ForceUpdate);
- }
- brushTextureDirty = false;
-}
-
-
-void QOpenGL2PaintEngineExPrivate::updateBrushUniforms()
-{
-// qDebug("QOpenGL2PaintEngineExPrivate::updateBrushUniforms()");
- Qt::BrushStyle style = currentBrush.style();
-
- if (style == Qt::NoBrush)
- return;
-
- QTransform brushQTransform = currentBrush.transform();
-
- if (style == Qt::SolidPattern) {
- QColor col = qt_premultiplyColor(currentBrush.color(), (GLfloat)q->state()->opacity);
- shaderManager->currentProgram()->setUniformValue(location(QOpenGLEngineShaderManager::FragmentColor), col);
- }
- else {
- // All other brushes have a transform and thus need the translation point:
- QPointF translationPoint;
-
- if (style <= Qt::DiagCrossPattern) {
- QColor col = qt_premultiplyColor(currentBrush.color(), (GLfloat)q->state()->opacity);
-
- shaderManager->currentProgram()->setUniformValue(location(QOpenGLEngineShaderManager::PatternColor), col);
-
- QVector2D halfViewportSize(width*0.5, height*0.5);
- shaderManager->currentProgram()->setUniformValue(location(QOpenGLEngineShaderManager::HalfViewportSize), halfViewportSize);
- }
- else if (style == Qt::LinearGradientPattern) {
- const QLinearGradient *g = static_cast<const QLinearGradient *>(currentBrush.gradient());
-
- QPointF realStart = g->start();
- QPointF realFinal = g->finalStop();
- translationPoint = realStart;
-
- QPointF l = realFinal - realStart;
-
- QVector3D linearData(
- l.x(),
- l.y(),
- 1.0f / (l.x() * l.x() + l.y() * l.y())
- );
-
- shaderManager->currentProgram()->setUniformValue(location(QOpenGLEngineShaderManager::LinearData), linearData);
-
- QVector2D halfViewportSize(width*0.5, height*0.5);
- shaderManager->currentProgram()->setUniformValue(location(QOpenGLEngineShaderManager::HalfViewportSize), halfViewportSize);
- }
- else if (style == Qt::ConicalGradientPattern) {
- const QConicalGradient *g = static_cast<const QConicalGradient *>(currentBrush.gradient());
- translationPoint = g->center();
-
- GLfloat angle = -qDegreesToRadians(g->angle());
-
- shaderManager->currentProgram()->setUniformValue(location(QOpenGLEngineShaderManager::Angle), angle);
-
- QVector2D halfViewportSize(width*0.5, height*0.5);
- shaderManager->currentProgram()->setUniformValue(location(QOpenGLEngineShaderManager::HalfViewportSize), halfViewportSize);
- }
- else if (style == Qt::RadialGradientPattern) {
- const QRadialGradient *g = static_cast<const QRadialGradient *>(currentBrush.gradient());
- QPointF realCenter = g->center();
- QPointF realFocal = g->focalPoint();
- qreal realRadius = g->centerRadius() - g->focalRadius();
- translationPoint = realFocal;
-
- QPointF fmp = realCenter - realFocal;
- shaderManager->currentProgram()->setUniformValue(location(QOpenGLEngineShaderManager::Fmp), fmp);
-
- GLfloat fmp2_m_radius2 = -fmp.x() * fmp.x() - fmp.y() * fmp.y() + realRadius*realRadius;
- shaderManager->currentProgram()->setUniformValue(location(QOpenGLEngineShaderManager::Fmp2MRadius2), fmp2_m_radius2);
- shaderManager->currentProgram()->setUniformValue(location(QOpenGLEngineShaderManager::Inverse2Fmp2MRadius2),
- GLfloat(1.0 / (2.0*fmp2_m_radius2)));
- shaderManager->currentProgram()->setUniformValue(location(QOpenGLEngineShaderManager::SqrFr),
- GLfloat(g->focalRadius() * g->focalRadius()));
- shaderManager->currentProgram()->setUniformValue(location(QOpenGLEngineShaderManager::BRadius),
- GLfloat(2 * (g->centerRadius() - g->focalRadius()) * g->focalRadius()),
- g->focalRadius(),
- g->centerRadius() - g->focalRadius());
-
- QVector2D halfViewportSize(width*0.5, height*0.5);
- shaderManager->currentProgram()->setUniformValue(location(QOpenGLEngineShaderManager::HalfViewportSize), halfViewportSize);
- }
- else if (style == Qt::TexturePattern) {
- const QPixmap& texPixmap = currentBrush.texture();
-
- if (qHasPixmapTexture(currentBrush) && currentBrush.texture().isQBitmap()) {
- QColor col = qt_premultiplyColor(currentBrush.color(), (GLfloat)q->state()->opacity);
- shaderManager->currentProgram()->setUniformValue(location(QOpenGLEngineShaderManager::PatternColor), col);
- }
-
- QSizeF invertedTextureSize(1.0 / texPixmap.width(), 1.0 / texPixmap.height());
- shaderManager->currentProgram()->setUniformValue(location(QOpenGLEngineShaderManager::InvertedTextureSize), invertedTextureSize);
-
- QVector2D halfViewportSize(width*0.5, height*0.5);
- shaderManager->currentProgram()->setUniformValue(location(QOpenGLEngineShaderManager::HalfViewportSize), halfViewportSize);
- }
- else
- qWarning("QOpenGL2PaintEngineEx: Unimplemented fill style");
-
- const QPointF &brushOrigin = q->state()->brushOrigin;
- QTransform matrix = q->state()->matrix;
- matrix.translate(brushOrigin.x(), brushOrigin.y());
-
- QTransform translate(1, 0, 0, 1, -translationPoint.x(), -translationPoint.y());
- qreal m22 = -1;
- qreal dy = height;
- if (device->paintFlipped()) {
- m22 = 1;
- dy = 0;
- }
- QTransform gl_to_qt(1, 0, 0, m22, 0, dy);
- QTransform inv_matrix = gl_to_qt * (brushQTransform * matrix).inverted() * translate;
-
- shaderManager->currentProgram()->setUniformValue(location(QOpenGLEngineShaderManager::BrushTransform), inv_matrix);
- shaderManager->currentProgram()->setUniformValue(location(QOpenGLEngineShaderManager::BrushTexture), QT_BRUSH_TEXTURE_UNIT);
- }
- brushUniformsDirty = false;
-}
-
-
-// This assumes the shader manager has already setup the correct shader program
-void QOpenGL2PaintEngineExPrivate::updateMatrix()
-{
-// qDebug("QOpenGL2PaintEngineExPrivate::updateMatrix()");
-
- const QTransform& transform = q->state()->matrix;
-
- // The projection matrix converts from Qt's coordinate system to GL's coordinate system
- // * GL's viewport is 2x2, Qt's is width x height
- // * GL has +y -> -y going from bottom -> top, Qt is the other way round
- // * GL has [0,0] in the center, Qt has it in the top-left
- //
- // This results in the Projection matrix below, which is multiplied by the painter's
- // transformation matrix, as shown below:
- //
- // Projection Matrix Painter Transform
- // ------------------------------------------------ ------------------------
- // | 2.0 / width | 0.0 | -1.0 | | m11 | m21 | dx |
- // | 0.0 | -2.0 / height | 1.0 | * | m12 | m22 | dy |
- // | 0.0 | 0.0 | 1.0 | | m13 | m23 | m33 |
- // ------------------------------------------------ ------------------------
- //
- // NOTE: The resultant matrix is also transposed, as GL expects column-major matracies
-
- const GLfloat wfactor = 2.0f / width;
- GLfloat hfactor = -2.0f / height;
-
- GLfloat dx = transform.dx();
- GLfloat dy = transform.dy();
-
- if (device->paintFlipped()) {
- hfactor *= -1;
- dy -= height;
- }
-
- // Non-integer translates can have strange effects for some rendering operations such as
- // anti-aliased text rendering. In such cases, we snap the translate to the pixel grid.
- if (snapToPixelGrid && transform.type() == QTransform::TxTranslate) {
- // 0.50 needs to rounded down to 0.0 for consistency with raster engine:
- dx = std::ceil(dx - 0.5f);
- dy = std::ceil(dy - 0.5f);
- }
- pmvMatrix[0][0] = (wfactor * transform.m11()) - transform.m13();
- pmvMatrix[1][0] = (wfactor * transform.m21()) - transform.m23();
- pmvMatrix[2][0] = (wfactor * dx) - transform.m33();
- pmvMatrix[0][1] = (hfactor * transform.m12()) + transform.m13();
- pmvMatrix[1][1] = (hfactor * transform.m22()) + transform.m23();
- pmvMatrix[2][1] = (hfactor * dy) + transform.m33();
- pmvMatrix[0][2] = transform.m13();
- pmvMatrix[1][2] = transform.m23();
- pmvMatrix[2][2] = transform.m33();
-
- // 1/10000 == 0.0001, so we have good enough res to cover curves
- // that span the entire widget...
- inverseScale = qMax(1 / qMax( qMax(qAbs(transform.m11()), qAbs(transform.m22())),
- qMax(qAbs(transform.m12()), qAbs(transform.m21())) ),
- qreal(0.0001));
-
- matrixDirty = false;
- matrixUniformDirty = true;
-
- // Set the PMV matrix attribute. As we use an attributes rather than uniforms, we only
- // need to do this once for every matrix change and persists across all shader programs.
- funcs.glVertexAttrib3fv(QT_PMV_MATRIX_1_ATTR, pmvMatrix[0]);
- funcs.glVertexAttrib3fv(QT_PMV_MATRIX_2_ATTR, pmvMatrix[1]);
- funcs.glVertexAttrib3fv(QT_PMV_MATRIX_3_ATTR, pmvMatrix[2]);
-
- dasher.setInvScale(inverseScale);
- stroker.setInvScale(inverseScale);
-}
-
-
-void QOpenGL2PaintEngineExPrivate::updateCompositionMode()
-{
- // NOTE: The entire paint engine works on pre-multiplied data - which is why some of these
- // composition modes look odd.
-// qDebug() << "QOpenGL2PaintEngineExPrivate::updateCompositionMode() - Setting GL composition mode for " << q->state()->composition_mode;
- if (ctx->functions()->hasOpenGLFeature(QOpenGLFunctions::BlendEquationAdvanced)) {
- if (q->state()->composition_mode <= QPainter::CompositionMode_Plus) {
- funcs.glDisable(GL_BLEND_ADVANCED_COHERENT_KHR);
- funcs.glBlendEquation(GL_FUNC_ADD);
- } else {
- funcs.glEnable(GL_BLEND_ADVANCED_COHERENT_KHR);
- }
- shaderManager->setCompositionMode(q->state()->composition_mode);
- } else {
- if (q->state()->composition_mode > QPainter::CompositionMode_Plus) {
- qWarning("Unsupported composition mode");
- compositionModeDirty = false;
- return;
- }
- }
- switch(q->state()->composition_mode) {
- case QPainter::CompositionMode_SourceOver:
- funcs.glBlendFunc(GL_ONE, GL_ONE_MINUS_SRC_ALPHA);
- break;
- case QPainter::CompositionMode_DestinationOver:
- funcs.glBlendFunc(GL_ONE_MINUS_DST_ALPHA, GL_ONE);
- break;
- case QPainter::CompositionMode_Clear:
- funcs.glBlendFunc(GL_ZERO, GL_ZERO);
- break;
- case QPainter::CompositionMode_Source:
- funcs.glBlendFunc(GL_ONE, GL_ZERO);
- break;
- case QPainter::CompositionMode_Destination:
- funcs.glBlendFunc(GL_ZERO, GL_ONE);
- break;
- case QPainter::CompositionMode_SourceIn:
- funcs.glBlendFunc(GL_DST_ALPHA, GL_ZERO);
- break;
- case QPainter::CompositionMode_DestinationIn:
- funcs.glBlendFunc(GL_ZERO, GL_SRC_ALPHA);
- break;
- case QPainter::CompositionMode_SourceOut:
- funcs.glBlendFunc(GL_ONE_MINUS_DST_ALPHA, GL_ZERO);
- break;
- case QPainter::CompositionMode_DestinationOut:
- funcs.glBlendFunc(GL_ZERO, GL_ONE_MINUS_SRC_ALPHA);
- break;
- case QPainter::CompositionMode_SourceAtop:
- funcs.glBlendFunc(GL_DST_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
- break;
- case QPainter::CompositionMode_DestinationAtop:
- funcs.glBlendFunc(GL_ONE_MINUS_DST_ALPHA, GL_SRC_ALPHA);
- break;
- case QPainter::CompositionMode_Xor:
- funcs.glBlendFunc(GL_ONE_MINUS_DST_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
- break;
- case QPainter::CompositionMode_Plus:
- funcs.glBlendFunc(GL_ONE, GL_ONE);
- break;
- case QPainter::CompositionMode_Multiply:
- funcs.glBlendEquation(GL_MULTIPLY_KHR);
- break;
- case QPainter::CompositionMode_Screen:
- funcs.glBlendEquation(GL_SCREEN_KHR);
- break;
- case QPainter::CompositionMode_Overlay:
- funcs.glBlendEquation(GL_OVERLAY_KHR);
- break;
- case QPainter::CompositionMode_Darken:
- funcs.glBlendEquation(GL_DARKEN_KHR);
- break;
- case QPainter::CompositionMode_Lighten:
- funcs.glBlendEquation(GL_LIGHTEN_KHR);
- break;
- case QPainter::CompositionMode_ColorDodge:
- funcs.glBlendEquation(GL_COLORDODGE_KHR);
- break;
- case QPainter::CompositionMode_ColorBurn:
- funcs.glBlendEquation(GL_COLORBURN_KHR);
- break;
- case QPainter::CompositionMode_HardLight:
- funcs.glBlendEquation(GL_HARDLIGHT_KHR);
- break;
- case QPainter::CompositionMode_SoftLight:
- funcs.glBlendEquation(GL_SOFTLIGHT_KHR);
- break;
- case QPainter::CompositionMode_Difference:
- funcs.glBlendEquation(GL_DIFFERENCE_KHR);
- break;
- case QPainter::CompositionMode_Exclusion:
- funcs.glBlendEquation(GL_EXCLUSION_KHR);
- break;
- default:
- qWarning("Unsupported composition mode");
- break;
- }
-
- compositionModeDirty = false;
-}
-
-static inline void setCoords(GLfloat *coords, const QOpenGLRect &rect)
-{
- coords[0] = rect.left;
- coords[1] = rect.top;
- coords[2] = rect.right;
- coords[3] = rect.top;
- coords[4] = rect.right;
- coords[5] = rect.bottom;
- coords[6] = rect.left;
- coords[7] = rect.bottom;
-}
-
-void QOpenGL2PaintEngineExPrivate::drawTexture(const QOpenGLRect& dest, const QOpenGLRect& src, const QSize &textureSize, bool opaque, bool pattern)
-{
- // Setup for texture drawing
- currentBrush = noBrush;
-
- if (snapToPixelGrid) {
- snapToPixelGrid = false;
- matrixDirty = true;
- }
-
- if (prepareForDraw(opaque))
- shaderManager->currentProgram()->setUniformValue(location(QOpenGLEngineShaderManager::ImageTexture), QT_IMAGE_TEXTURE_UNIT);
-
- if (pattern) {
- QColor col = qt_premultiplyColor(q->state()->pen.color(), (GLfloat)q->state()->opacity);
- shaderManager->currentProgram()->setUniformValue(location(QOpenGLEngineShaderManager::PatternColor), col);
- }
-
- GLfloat dx = 1.0 / textureSize.width();
- GLfloat dy = 1.0 / textureSize.height();
-
- QOpenGLRect srcTextureRect(src.left*dx, src.top*dy, src.right*dx, src.bottom*dy);
-
- setCoords(staticVertexCoordinateArray, dest);
- setCoords(staticTextureCoordinateArray, srcTextureRect);
-
- setVertexAttribArrayEnabled(QT_VERTEX_COORDS_ATTR, true);
- setVertexAttribArrayEnabled(QT_TEXTURE_COORDS_ATTR, true);
-
- uploadData(QT_VERTEX_COORDS_ATTR, staticVertexCoordinateArray, 8);
- uploadData(QT_TEXTURE_COORDS_ATTR, staticTextureCoordinateArray, 8);
-
- funcs.glDrawArrays(GL_TRIANGLE_FAN, 0, 4);
-}
-
-void QOpenGL2PaintEngineEx::beginNativePainting()
-{
- Q_D(QOpenGL2PaintEngineEx);
- ensureActive();
- d->transferMode(BrushDrawingMode);
-
- d->nativePaintingActive = true;
-
- d->funcs.glUseProgram(0);
-
- // Disable all the vertex attribute arrays:
- for (int i = 0; i < QT_GL_VERTEX_ARRAY_TRACKED_COUNT; ++i)
- d->funcs.glDisableVertexAttribArray(i);
-
-#if !defined(QT_OPENGL_ES_2) && !defined(QT_OPENGL_DYNAMIC)
- Q_ASSERT(QOpenGLContext::currentContext());
- const QOpenGLContext *ctx = d->ctx;
- const QSurfaceFormat &fmt = d->device->context()->format();
- if (fmt.majorVersion() < 3 || (fmt.majorVersion() == 3 && fmt.minorVersion() < 1)
- || (fmt.majorVersion() == 3 && fmt.minorVersion() == 1 && ctx->hasExtension(QByteArrayLiteral("GL_ARB_compatibility")))
- || fmt.profile() == QSurfaceFormat::CompatibilityProfile)
- {
- // be nice to people who mix OpenGL 1.x code with QPainter commands
- // by setting modelview and projection matrices to mirror the GL 1
- // paint engine
- const QTransform& mtx = state()->matrix;
-
- float mv_matrix[4][4] =
- {
- { float(mtx.m11()), float(mtx.m12()), 0, float(mtx.m13()) },
- { float(mtx.m21()), float(mtx.m22()), 0, float(mtx.m23()) },
- { 0, 0, 1, 0 },
- { float(mtx.dx()), float(mtx.dy()), 0, float(mtx.m33()) }
- };
-
- const QSize sz = d->device->size();
-
- glMatrixMode(GL_PROJECTION);
- glLoadIdentity();
- glOrtho(0, sz.width(), sz.height(), 0, -999999, 999999);
-
- glMatrixMode(GL_MODELVIEW);
- glLoadMatrixf(&mv_matrix[0][0]);
- }
-#endif // QT_OPENGL_ES_2
-
- d->resetGLState();
-
- // We don't know what texture units and textures the native painting
- // will activate and bind, so we can't assume anything when we return
- // from the native painting.
- d->lastTextureUnitUsed = QT_UNKNOWN_TEXTURE_UNIT;
- d->lastTextureUsed = GLuint(-1);
-
- d->dirtyStencilRegion = QRect(0, 0, d->width, d->height);
-
- d->shaderManager->setDirty();
-
- d->needsSync = true;
-}
-
-void QOpenGL2PaintEngineExPrivate::resetGLState()
-{
- activateTextureUnit(QT_DEFAULT_TEXTURE_UNIT);
-
- funcs.glDisable(GL_BLEND);
- funcs.glDisable(GL_STENCIL_TEST);
- funcs.glDisable(GL_DEPTH_TEST);
- funcs.glDisable(GL_SCISSOR_TEST);
- funcs.glDepthMask(true);
- funcs.glDepthFunc(GL_LESS);
- funcs.glClearDepthf(1);
- funcs.glStencilMask(0xff);
- funcs.glStencilOp(GL_KEEP, GL_KEEP, GL_KEEP);
- funcs.glStencilFunc(GL_ALWAYS, 0, 0xff);
- setVertexAttribArrayEnabled(QT_TEXTURE_COORDS_ATTR, false);
- setVertexAttribArrayEnabled(QT_VERTEX_COORDS_ATTR, false);
- setVertexAttribArrayEnabled(QT_OPACITY_ATTR, false);
- if (!QOpenGLContext::currentContext()->isOpenGLES()) {
- // gl_Color, corresponding to vertex attribute 3, may have been changed
- float color[] = { 1.0f, 1.0f, 1.0f, 1.0f };
- funcs.glVertexAttrib4fv(3, color);
- }
- if (vao.isCreated()) {
- vao.release();
- funcs.glBindBuffer(GL_ARRAY_BUFFER, 0);
- funcs.glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, 0);
- }
-}
-
-void QOpenGL2PaintEngineEx::endNativePainting()
-{
- Q_D(QOpenGL2PaintEngineEx);
- d->needsSync = true;
- d->nativePaintingActive = false;
-}
-
-void QOpenGL2PaintEngineEx::invalidateState()
-{
- Q_D(QOpenGL2PaintEngineEx);
- d->needsSync = true;
-}
-
-bool QOpenGL2PaintEngineEx::isNativePaintingActive() const {
- Q_D(const QOpenGL2PaintEngineEx);
- return d->nativePaintingActive;
-}
-
-void QOpenGL2PaintEngineExPrivate::transferMode(EngineMode newMode)
-{
- if (newMode == mode)
- return;
-
- if (newMode == TextDrawingMode) {
- shaderManager->setHasComplexGeometry(true);
- } else {
- shaderManager->setHasComplexGeometry(false);
- }
-
- if (newMode == ImageDrawingMode) {
- uploadData(QT_VERTEX_COORDS_ATTR, staticVertexCoordinateArray, 8);
- uploadData(QT_TEXTURE_COORDS_ATTR, staticTextureCoordinateArray, 8);
- }
-
- if (newMode == ImageArrayDrawingMode || newMode == ImageOpacityArrayDrawingMode) {
- uploadData(QT_VERTEX_COORDS_ATTR, (GLfloat*)vertexCoordinateArray.data(), vertexCoordinateArray.vertexCount() * 2);
- uploadData(QT_TEXTURE_COORDS_ATTR, (GLfloat*)textureCoordinateArray.data(), textureCoordinateArray.vertexCount() * 2);
-
- if (newMode == ImageOpacityArrayDrawingMode)
- uploadData(QT_OPACITY_ATTR, (GLfloat*)opacityArray.data(), opacityArray.size());
- }
-
- // This needs to change when we implement high-quality anti-aliasing...
- if (newMode != TextDrawingMode)
- shaderManager->setMaskType(QOpenGLEngineShaderManager::NoMask);
-
- mode = newMode;
-}
-
-struct QOpenGL2PEVectorPathCache
-{
-#ifdef QT_OPENGL_CACHE_AS_VBOS
- GLuint vbo;
- GLuint ibo;
-#else
- float *vertices;
- void *indices;
-#endif
- int vertexCount;
- int indexCount;
- GLenum primitiveType;
- qreal iscale;
- QVertexIndexVector::Type indexType;
-};
-
-void QOpenGL2PaintEngineExPrivate::cleanupVectorPath(QPaintEngineEx *engine, void *data)
-{
- QOpenGL2PEVectorPathCache *c = (QOpenGL2PEVectorPathCache *) data;
-#ifdef QT_OPENGL_CACHE_AS_VBOS
- Q_ASSERT(engine->type() == QPaintEngine::OpenGL2);
- static_cast<QOpenGL2PaintEngineEx *>(engine)->d_func()->unusedVBOSToClean << c->vbo;
- if (c->ibo)
- d->unusedIBOSToClean << c->ibo;
-#else
- Q_UNUSED(engine);
- free(c->vertices);
- free(c->indices);
-#endif
- delete c;
-}
-
-// Assumes everything is configured for the brush you want to use
-void QOpenGL2PaintEngineExPrivate::fill(const QVectorPath& path)
-{
- transferMode(BrushDrawingMode);
-
- if (snapToPixelGrid) {
- snapToPixelGrid = false;
- matrixDirty = true;
- }
-
- // Might need to call updateMatrix to re-calculate inverseScale
- if (matrixDirty)
- updateMatrix();
-
- const bool supportsElementIndexUint = funcs.hasOpenGLExtension(QOpenGLExtensions::ElementIndexUint);
-
- const QPointF* const points = reinterpret_cast<const QPointF*>(path.points());
-
- // Check to see if there's any hints
- if (path.shape() == QVectorPath::RectangleHint) {
- QOpenGLRect rect(points[0].x(), points[0].y(), points[2].x(), points[2].y());
- prepareForDraw(currentBrush.isOpaque());
- composite(rect);
- } else if (path.isConvex()) {
-
- if (path.isCacheable()) {
- QVectorPath::CacheEntry *data = path.lookupCacheData(q);
- QOpenGL2PEVectorPathCache *cache;
-
- bool updateCache = false;
-
- if (data) {
- cache = (QOpenGL2PEVectorPathCache *) data->data;
- // Check if scale factor is exceeded and regenerate if so...
- qreal scaleFactor = cache->iscale / inverseScale;
- if (scaleFactor < 0.5 || scaleFactor > 2.0) {
-#ifdef QT_OPENGL_CACHE_AS_VBOS
- glDeleteBuffers(1, &cache->vbo);
- cache->vbo = 0;
- Q_ASSERT(cache->ibo == 0);
-#else
- free(cache->vertices);
- Q_ASSERT(cache->indices == nullptr);
-#endif
- updateCache = true;
- }
- } else {
- cache = new QOpenGL2PEVectorPathCache;
- data = const_cast<QVectorPath &>(path).addCacheData(q, cache, cleanupVectorPath);
- updateCache = true;
- }
-
- // Flatten the path at the current scale factor and fill it into the cache struct.
- if (updateCache) {
- vertexCoordinateArray.clear();
- vertexCoordinateArray.addPath(path, inverseScale, false);
- int vertexCount = vertexCoordinateArray.vertexCount();
- int floatSizeInBytes = vertexCount * 2 * sizeof(float);
- cache->vertexCount = vertexCount;
- cache->indexCount = 0;
- cache->primitiveType = GL_TRIANGLE_FAN;
- cache->iscale = inverseScale;
-#ifdef QT_OPENGL_CACHE_AS_VBOS
- funcs.glGenBuffers(1, &cache->vbo);
- funcs.glBindBuffer(GL_ARRAY_BUFFER, cache->vbo);
- funcs.glBufferData(GL_ARRAY_BUFFER, floatSizeInBytes, vertexCoordinateArray.data(), GL_STATIC_DRAW);
- cache->ibo = 0;
-#else
- cache->vertices = (float *) malloc(floatSizeInBytes);
- memcpy(cache->vertices, vertexCoordinateArray.data(), floatSizeInBytes);
- cache->indices = nullptr;
-#endif
- }
-
- prepareForDraw(currentBrush.isOpaque());
-#ifdef QT_OPENGL_CACHE_AS_VBOS
- funcs.glBindBuffer(GL_ARRAY_BUFFER, cache->vbo);
- uploadData(QT_VERTEX_COORD_ATTR, 0, cache->vertexCount);
- setVertexAttributePointer(QT_VERTEX_COORDS_ATTR, 0);
-#else
- uploadData(QT_VERTEX_COORDS_ATTR, cache->vertices, cache->vertexCount * 2);
-#endif
- funcs.glDrawArrays(cache->primitiveType, 0, cache->vertexCount);
-
- } else {
- // printf(" - Marking path as cachable...\n");
- // Tag it for later so that if the same path is drawn twice, it is assumed to be static and thus cachable
- path.makeCacheable();
- vertexCoordinateArray.clear();
- vertexCoordinateArray.addPath(path, inverseScale, false);
- prepareForDraw(currentBrush.isOpaque());
- drawVertexArrays(vertexCoordinateArray, GL_TRIANGLE_FAN);
- }
-
- } else {
- bool useCache = path.isCacheable();
- if (useCache) {
- QRectF bbox = path.controlPointRect();
- // If the path doesn't fit within these limits, it is possible that the triangulation will fail.
- useCache &= (bbox.left() > -0x8000 * inverseScale)
- && (bbox.right() < 0x8000 * inverseScale)
- && (bbox.top() > -0x8000 * inverseScale)
- && (bbox.bottom() < 0x8000 * inverseScale);
- }
-
- if (useCache) {
- QVectorPath::CacheEntry *data = path.lookupCacheData(q);
- QOpenGL2PEVectorPathCache *cache;
-
- bool updateCache = false;
-
- if (data) {
- cache = (QOpenGL2PEVectorPathCache *) data->data;
- // Check if scale factor is exceeded and regenerate if so...
- qreal scaleFactor = cache->iscale / inverseScale;
- if (scaleFactor < 0.5 || scaleFactor > 2.0) {
-#ifdef QT_OPENGL_CACHE_AS_VBOS
- glDeleteBuffers(1, &cache->vbo);
- glDeleteBuffers(1, &cache->ibo);
-#else
- free(cache->vertices);
- free(cache->indices);
-#endif
- updateCache = true;
- }
- } else {
- cache = new QOpenGL2PEVectorPathCache;
- data = const_cast<QVectorPath &>(path).addCacheData(q, cache, cleanupVectorPath);
- updateCache = true;
- }
-
- // Flatten the path at the current scale factor and fill it into the cache struct.
- if (updateCache) {
- QTriangleSet polys = qTriangulate(path, QTransform().scale(1 / inverseScale, 1 / inverseScale), 1, supportsElementIndexUint);
- cache->vertexCount = polys.vertices.size() / 2;
- cache->indexCount = polys.indices.size();
- cache->primitiveType = GL_TRIANGLES;
- cache->iscale = inverseScale;
- cache->indexType = polys.indices.type();
-#ifdef QT_OPENGL_CACHE_AS_VBOS
- funcs.glGenBuffers(1, &cache->vbo);
- funcs.glGenBuffers(1, &cache->ibo);
- funcs.glBindBuffer(GL_ARRAY_BUFFER, cache->vbo);
- funcs.glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, cache->ibo);
-
- if (polys.indices.type() == QVertexIndexVector::UnsignedInt)
- funcs.glBufferData(GL_ELEMENT_ARRAY_BUFFER, sizeof(quint32) * polys.indices.size(), polys.indices.data(), GL_STATIC_DRAW);
- else
- funcs.glBufferData(GL_ELEMENT_ARRAY_BUFFER, sizeof(quint16) * polys.indices.size(), polys.indices.data(), GL_STATIC_DRAW);
-
- QVarLengthArray<float> vertices(polys.vertices.size());
- for (int i = 0; i < polys.vertices.size(); ++i)
- vertices[i] = float(inverseScale * polys.vertices.at(i));
- funcs.glBufferData(GL_ARRAY_BUFFER, sizeof(float) * vertices.size(), vertices.data(), GL_STATIC_DRAW);
-#else
- cache->vertices = (float *) malloc(sizeof(float) * polys.vertices.size());
- if (polys.indices.type() == QVertexIndexVector::UnsignedInt) {
- cache->indices = (quint32 *) malloc(sizeof(quint32) * polys.indices.size());
- memcpy(cache->indices, polys.indices.data(), sizeof(quint32) * polys.indices.size());
- } else {
- cache->indices = (quint16 *) malloc(sizeof(quint16) * polys.indices.size());
- memcpy(cache->indices, polys.indices.data(), sizeof(quint16) * polys.indices.size());
- }
- for (int i = 0; i < polys.vertices.size(); ++i)
- cache->vertices[i] = float(inverseScale * polys.vertices.at(i));
-#endif
- }
-
- prepareForDraw(currentBrush.isOpaque());
-#ifdef QT_OPENGL_CACHE_AS_VBOS
- funcs.glBindBuffer(GL_ARRAY_BUFFER, cache->vbo);
- funcs.glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, cache->ibo);
- uploadData(QT_VERTEX_COORDS_ATTR, 0, cache->vertexCount);
- setVertexAttributePointer(QT_VERTEX_COORDS_ATTR, 0);
- if (cache->indexType == QVertexIndexVector::UnsignedInt)
- funcs.glDrawElements(cache->primitiveType, cache->indexCount, GL_UNSIGNED_INT, 0);
- else
- funcs.glDrawElements(cache->primitiveType, cache->indexCount, GL_UNSIGNED_SHORT, 0);
- funcs.glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, 0);
- funcs.glBindBuffer(GL_ARRAY_BUFFER, 0);
-#else
- uploadData(QT_VERTEX_COORDS_ATTR, cache->vertices, cache->vertexCount * 2);
- const GLenum indexValueType = cache->indexType == QVertexIndexVector::UnsignedInt ? GL_UNSIGNED_INT : GL_UNSIGNED_SHORT;
- const bool useIndexVbo = uploadIndexData(cache->indices, indexValueType, cache->indexCount);
- funcs.glDrawElements(cache->primitiveType, cache->indexCount, indexValueType, useIndexVbo ? nullptr : cache->indices);
-#endif
-
- } else {
- // printf(" - Marking path as cachable...\n");
- // Tag it for later so that if the same path is drawn twice, it is assumed to be static and thus cachable
- path.makeCacheable();
-
- if (device->context()->format().stencilBufferSize() <= 0) {
- // If there is no stencil buffer, triangulate the path instead.
-
- QRectF bbox = path.controlPointRect();
- // If the path doesn't fit within these limits, it is possible that the triangulation will fail.
- bool withinLimits = (bbox.left() > -0x8000 * inverseScale)
- && (bbox.right() < 0x8000 * inverseScale)
- && (bbox.top() > -0x8000 * inverseScale)
- && (bbox.bottom() < 0x8000 * inverseScale);
- if (withinLimits) {
- QTriangleSet polys = qTriangulate(path, QTransform().scale(1 / inverseScale, 1 / inverseScale), 1, supportsElementIndexUint);
-
- QVarLengthArray<float> vertices(polys.vertices.size());
- for (int i = 0; i < polys.vertices.size(); ++i)
- vertices[i] = float(inverseScale * polys.vertices.at(i));
-
- prepareForDraw(currentBrush.isOpaque());
- uploadData(QT_VERTEX_COORDS_ATTR, vertices.constData(), vertices.size());
- const GLenum indexValueType = funcs.hasOpenGLExtension(QOpenGLExtensions::ElementIndexUint) ? GL_UNSIGNED_INT : GL_UNSIGNED_SHORT;
- const bool useIndexVbo = uploadIndexData(polys.indices.data(), indexValueType, polys.indices.size());
- funcs.glDrawElements(GL_TRIANGLES, polys.indices.size(), indexValueType, useIndexVbo ? nullptr : polys.indices.data());
- } else {
- // We can't handle big, concave painter paths with OpenGL without stencil buffer.
- qWarning("Painter path exceeds +/-32767 pixels.");
- }
- return;
- }
-
- // The path is too complicated & needs the stencil technique
- vertexCoordinateArray.clear();
- vertexCoordinateArray.addPath(path, inverseScale, false);
-
- fillStencilWithVertexArray(vertexCoordinateArray, path.hasWindingFill());
-
- funcs.glStencilMask(0xff);
- funcs.glStencilOp(GL_KEEP, GL_REPLACE, GL_REPLACE);
-
- if (q->state()->clipTestEnabled) {
- // Pass when high bit is set, replace stencil value with current clip
- funcs.glStencilFunc(GL_NOTEQUAL, q->state()->currentClip, GL_STENCIL_HIGH_BIT);
- } else if (path.hasWindingFill()) {
- // Pass when any bit is set, replace stencil value with 0
- funcs.glStencilFunc(GL_NOTEQUAL, 0, 0xff);
- } else {
- // Pass when high bit is set, replace stencil value with 0
- funcs.glStencilFunc(GL_NOTEQUAL, 0, GL_STENCIL_HIGH_BIT);
- }
- prepareForDraw(currentBrush.isOpaque());
-
- // Stencil the brush onto the dest buffer
- composite(vertexCoordinateArray.boundingRect());
- funcs.glStencilMask(0);
- updateClipScissorTest();
- }
- }
-}
-
-
-void QOpenGL2PaintEngineExPrivate::fillStencilWithVertexArray(const float *data,
- int count,
- int *stops,
- int stopCount,
- const QOpenGLRect &bounds,
- StencilFillMode mode)
-{
- Q_ASSERT(count || stops);
-
-// qDebug("QOpenGL2PaintEngineExPrivate::fillStencilWithVertexArray()");
- funcs.glStencilMask(0xff); // Enable stencil writes
-
- if (dirtyStencilRegion.intersects(currentScissorBounds)) {
- const QRegion clearRegion = dirtyStencilRegion.intersected(currentScissorBounds);
- funcs.glClearStencil(0); // Clear to zero
- for (const QRect &rect : clearRegion) {
-#ifndef QT_GL_NO_SCISSOR_TEST
- setScissor(rect);
-#endif
- funcs.glClear(GL_STENCIL_BUFFER_BIT);
- }
-
- dirtyStencilRegion -= currentScissorBounds;
-
-#ifndef QT_GL_NO_SCISSOR_TEST
- updateClipScissorTest();
-#endif
- }
-
- funcs.glColorMask(GL_FALSE, GL_FALSE, GL_FALSE, GL_FALSE); // Disable color writes
- useSimpleShader();
- funcs.glEnable(GL_STENCIL_TEST); // For some reason, this has to happen _after_ the simple shader is use()'d
-
- if (mode == WindingFillMode) {
- Q_ASSERT(stops && !count);
- if (q->state()->clipTestEnabled) {
- // Flatten clip values higher than current clip, and set high bit to match current clip
- funcs.glStencilFunc(GL_LEQUAL, GL_STENCIL_HIGH_BIT | q->state()->currentClip, ~GL_STENCIL_HIGH_BIT);
- funcs.glStencilOp(GL_KEEP, GL_REPLACE, GL_REPLACE);
- composite(bounds);
-
- funcs.glStencilFunc(GL_EQUAL, GL_STENCIL_HIGH_BIT, GL_STENCIL_HIGH_BIT);
- } else if (!stencilClean) {
- // Clear stencil buffer within bounding rect
- funcs.glStencilFunc(GL_ALWAYS, 0, 0xff);
- funcs.glStencilOp(GL_ZERO, GL_ZERO, GL_ZERO);
- composite(bounds);
- }
-
- // Inc. for front-facing triangle
- funcs.glStencilOpSeparate(GL_FRONT, GL_KEEP, GL_INCR_WRAP, GL_INCR_WRAP);
- // Dec. for back-facing "holes"
- funcs.glStencilOpSeparate(GL_BACK, GL_KEEP, GL_DECR_WRAP, GL_DECR_WRAP);
- funcs.glStencilMask(~GL_STENCIL_HIGH_BIT);
- drawVertexArrays(data, stops, stopCount, GL_TRIANGLE_FAN);
-
- if (q->state()->clipTestEnabled) {
- // Clear high bit of stencil outside of path
- funcs.glStencilFunc(GL_EQUAL, q->state()->currentClip, ~GL_STENCIL_HIGH_BIT);
- funcs.glStencilOp(GL_KEEP, GL_REPLACE, GL_REPLACE);
- funcs.glStencilMask(GL_STENCIL_HIGH_BIT);
- composite(bounds);
- }
- } else if (mode == OddEvenFillMode) {
- funcs.glStencilMask(GL_STENCIL_HIGH_BIT);
- funcs.glStencilOp(GL_KEEP, GL_KEEP, GL_INVERT); // Simply invert the stencil bit
- drawVertexArrays(data, stops, stopCount, GL_TRIANGLE_FAN);
-
- } else { // TriStripStrokeFillMode
- Q_ASSERT(count && !stops); // tristrips generated directly, so no vertexArray or stops
- funcs.glStencilMask(GL_STENCIL_HIGH_BIT);
-#if 0
- funcs.glStencilOp(GL_KEEP, GL_KEEP, GL_INVERT); // Simply invert the stencil bit
- setVertexAttributePointer(QT_VERTEX_COORDS_ATTR, data);
- funcs.glDrawArrays(GL_TRIANGLE_STRIP, 0, count);
-#else
-
- funcs.glStencilOp(GL_KEEP, GL_KEEP, GL_REPLACE);
- if (q->state()->clipTestEnabled) {
- funcs.glStencilFunc(GL_LEQUAL, q->state()->currentClip | GL_STENCIL_HIGH_BIT,
- ~GL_STENCIL_HIGH_BIT);
- } else {
- funcs.glStencilFunc(GL_ALWAYS, GL_STENCIL_HIGH_BIT, 0xff);
- }
-
- uploadData(QT_VERTEX_COORDS_ATTR, data, count * 2);
- funcs.glDrawArrays(GL_TRIANGLE_STRIP, 0, count);
-#endif
- }
-
- // Enable color writes & disable stencil writes
- funcs.glColorMask(GL_TRUE, GL_TRUE, GL_TRUE, GL_TRUE);
-}
-
-/*
- If the maximum value in the stencil buffer is GL_STENCIL_HIGH_BIT - 1,
- restore the stencil buffer to a pristine state. The current clip region
- is set to 1, and the rest to 0.
-*/
-void QOpenGL2PaintEngineExPrivate::resetClipIfNeeded()
-{
- if (maxClip != (GL_STENCIL_HIGH_BIT - 1))
- return;
-
- Q_Q(QOpenGL2PaintEngineEx);
-
- useSimpleShader();
- funcs.glEnable(GL_STENCIL_TEST);
- funcs.glColorMask(GL_FALSE, GL_FALSE, GL_FALSE, GL_FALSE);
-
- QRectF bounds = q->state()->matrix.inverted().mapRect(QRectF(0, 0, width, height));
- QOpenGLRect rect(bounds.left(), bounds.top(), bounds.right(), bounds.bottom());
-
- // Set high bit on clip region
- funcs.glStencilFunc(GL_LEQUAL, q->state()->currentClip, 0xff);
- funcs.glStencilOp(GL_KEEP, GL_INVERT, GL_INVERT);
- funcs.glStencilMask(GL_STENCIL_HIGH_BIT);
- composite(rect);
-
- // Reset clipping to 1 and everything else to zero
- funcs.glStencilFunc(GL_NOTEQUAL, 0x01, GL_STENCIL_HIGH_BIT);
- funcs.glStencilOp(GL_ZERO, GL_REPLACE, GL_REPLACE);
- funcs.glStencilMask(0xff);
- composite(rect);
-
- q->state()->currentClip = 1;
- q->state()->canRestoreClip = false;
-
- maxClip = 1;
-
- funcs.glStencilMask(0x0);
- funcs.glColorMask(GL_TRUE, GL_TRUE, GL_TRUE, GL_TRUE);
-}
-
-bool QOpenGL2PaintEngineExPrivate::prepareForCachedGlyphDraw(const QFontEngineGlyphCache &cache)
-{
- Q_Q(QOpenGL2PaintEngineEx);
-
- Q_ASSERT(cache.transform().type() <= QTransform::TxScale);
-
- QTransform &transform = q->state()->matrix;
- transform.scale(1.0 / cache.transform().m11(), 1.0 / cache.transform().m22());
- bool ret = prepareForDraw(false);
- transform.scale(cache.transform().m11(), cache.transform().m22());
-
- return ret;
-}
-
-bool QOpenGL2PaintEngineExPrivate::prepareForDraw(bool srcPixelsAreOpaque)
-{
- if (brushTextureDirty && (mode == TextDrawingMode || mode == BrushDrawingMode))
- updateBrushTexture();
-
- if (compositionModeDirty)
- updateCompositionMode();
-
- if (matrixDirty)
- updateMatrix();
-
- const bool stateHasOpacity = q->state()->opacity < 0.99f;
- if (q->state()->composition_mode == QPainter::CompositionMode_Source
- || (q->state()->composition_mode == QPainter::CompositionMode_SourceOver
- && srcPixelsAreOpaque && !stateHasOpacity))
- {
- funcs.glDisable(GL_BLEND);
- } else {
- funcs.glEnable(GL_BLEND);
- }
-
- QOpenGLEngineShaderManager::OpacityMode opacityMode;
- if (mode == ImageOpacityArrayDrawingMode) {
- opacityMode = QOpenGLEngineShaderManager::AttributeOpacity;
- } else {
- opacityMode = stateHasOpacity ? QOpenGLEngineShaderManager::UniformOpacity
- : QOpenGLEngineShaderManager::NoOpacity;
- if (stateHasOpacity && (mode != ImageDrawingMode && mode != ImageArrayDrawingMode)) {
- // Using a brush
- bool brushIsPattern = (currentBrush.style() >= Qt::Dense1Pattern) &&
- (currentBrush.style() <= Qt::DiagCrossPattern);
-
- if ((currentBrush.style() == Qt::SolidPattern) || brushIsPattern)
- opacityMode = QOpenGLEngineShaderManager::NoOpacity; // Global opacity handled by srcPixel shader
- }
- }
- shaderManager->setOpacityMode(opacityMode);
-
- bool changed = shaderManager->useCorrectShaderProg();
- // If the shader program needs changing, we change it and mark all uniforms as dirty
- if (changed) {
- // The shader program has changed so mark all uniforms as dirty:
- brushUniformsDirty = true;
- opacityUniformDirty = true;
- matrixUniformDirty = true;
- }
-
- if (brushUniformsDirty && (mode == TextDrawingMode || mode == BrushDrawingMode))
- updateBrushUniforms();
-
- if (opacityMode == QOpenGLEngineShaderManager::UniformOpacity && opacityUniformDirty) {
- shaderManager->currentProgram()->setUniformValue(location(QOpenGLEngineShaderManager::GlobalOpacity), (GLfloat)q->state()->opacity);
- opacityUniformDirty = false;
- }
-
- if (matrixUniformDirty && shaderManager->hasComplexGeometry()) {
- shaderManager->currentProgram()->setUniformValue(location(QOpenGLEngineShaderManager::Matrix),
- pmvMatrix);
- matrixUniformDirty = false;
- }
-
- return changed;
-}
-
-void QOpenGL2PaintEngineExPrivate::composite(const QOpenGLRect& boundingRect)
-{
- setCoords(staticVertexCoordinateArray, boundingRect);
-
- uploadData(QT_VERTEX_COORDS_ATTR, staticVertexCoordinateArray, 8);
- funcs.glDrawArrays(GL_TRIANGLE_FAN, 0, 4);
-}
-
-// Draws the vertex array as a set of <vertexArrayStops.size()> triangle fans.
-void QOpenGL2PaintEngineExPrivate::drawVertexArrays(const float *data, int *stops, int stopCount,
- GLenum primitive)
-{
- // Now setup the pointer to the vertex array:
- uploadData(QT_VERTEX_COORDS_ATTR, data, stops[stopCount-1] * 2);
-
- int previousStop = 0;
- for (int i=0; i<stopCount; ++i) {
- int stop = stops[i];
-
- funcs.glDrawArrays(primitive, previousStop, stop - previousStop);
- previousStop = stop;
- }
-}
-
-/////////////////////////////////// Public Methods //////////////////////////////////////////
-
-QOpenGL2PaintEngineEx::QOpenGL2PaintEngineEx()
- : QPaintEngineEx(*(new QOpenGL2PaintEngineExPrivate(this)))
-{
-}
-
-QOpenGL2PaintEngineEx::~QOpenGL2PaintEngineEx()
-{
-}
-
-void QOpenGL2PaintEngineEx::fill(const QVectorPath &path, const QBrush &brush)
-{
- Q_D(QOpenGL2PaintEngineEx);
-
- if (qbrush_style(brush) == Qt::NoBrush)
- return;
- ensureActive();
- d->setBrush(brush);
- d->fill(path);
-}
-
-Q_GUI_EXPORT bool qt_scaleForTransform(const QTransform &transform, qreal *scale); // qtransform.cpp
-
-
-void QOpenGL2PaintEngineEx::stroke(const QVectorPath &path, const QPen &pen)
-{
- Q_D(QOpenGL2PaintEngineEx);
-
- const QBrush &penBrush = qpen_brush(pen);
- if (qpen_style(pen) == Qt::NoPen || qbrush_style(penBrush) == Qt::NoBrush)
- return;
-
- QOpenGL2PaintEngineState *s = state();
- if (qt_pen_is_cosmetic(pen, state()->renderHints) && !qt_scaleForTransform(s->transform(), nullptr)) {
- // QTriangulatingStroker class is not meant to support cosmetically sheared strokes.
- QPaintEngineEx::stroke(path, pen);
- return;
- }
-
- ensureActive();
- d->setBrush(penBrush);
- d->stroke(path, pen);
-}
-
-void QOpenGL2PaintEngineExPrivate::stroke(const QVectorPath &path, const QPen &pen)
-{
- const QOpenGL2PaintEngineState *s = q->state();
- if (snapToPixelGrid) {
- snapToPixelGrid = false;
- matrixDirty = true;
- }
-
- const Qt::PenStyle penStyle = qpen_style(pen);
- const QBrush &penBrush = qpen_brush(pen);
- const bool opaque = penBrush.isOpaque() && s->opacity > 0.99;
-
- transferMode(BrushDrawingMode);
-
- // updateMatrix() is responsible for setting the inverse scale on
- // the strokers, so we need to call it here and not wait for
- // prepareForDraw() down below.
- updateMatrix();
-
- QRectF clip = q->state()->matrix.inverted().mapRect(q->state()->clipEnabled
- ? q->state()->rectangleClip
- : QRectF(0, 0, width, height));
-
- if (penStyle == Qt::SolidLine) {
- stroker.process(path, pen, clip, s->renderHints);
-
- } else { // Some sort of dash
- dasher.process(path, pen, clip, s->renderHints);
-
- QVectorPath dashStroke(dasher.points(),
- dasher.elementCount(),
- dasher.elementTypes());
- stroker.process(dashStroke, pen, clip, s->renderHints);
- }
-
- if (!stroker.vertexCount())
- return;
-
- if (opaque) {
- prepareForDraw(opaque);
-
- uploadData(QT_VERTEX_COORDS_ATTR, stroker.vertices(), stroker.vertexCount());
- funcs.glDrawArrays(GL_TRIANGLE_STRIP, 0, stroker.vertexCount() / 2);
- } else {
- qreal width = qpen_widthf(pen) / 2;
- if (width == 0)
- width = 0.5;
- qreal extra = pen.joinStyle() == Qt::MiterJoin
- ? qMax(pen.miterLimit() * width, width)
- : width;
-
- if (qt_pen_is_cosmetic(pen, q->state()->renderHints))
- extra = extra * inverseScale;
-
- QRectF bounds = path.controlPointRect().adjusted(-extra, -extra, extra, extra);
-
- fillStencilWithVertexArray(stroker.vertices(), stroker.vertexCount() / 2,
- nullptr, 0, bounds, QOpenGL2PaintEngineExPrivate::TriStripStrokeFillMode);
-
- funcs.glStencilOp(GL_KEEP, GL_REPLACE, GL_REPLACE);
-
- // Pass when any bit is set, replace stencil value with 0
- funcs.glStencilFunc(GL_NOTEQUAL, 0, GL_STENCIL_HIGH_BIT);
- prepareForDraw(false);
-
- // Stencil the brush onto the dest buffer
- composite(bounds);
-
- funcs.glStencilMask(0);
-
- updateClipScissorTest();
- }
-}
-
-void QOpenGL2PaintEngineEx::penChanged() { }
-void QOpenGL2PaintEngineEx::brushChanged() { }
-void QOpenGL2PaintEngineEx::brushOriginChanged() { }
-
-void QOpenGL2PaintEngineEx::opacityChanged()
-{
-// qDebug("QOpenGL2PaintEngineEx::opacityChanged()");
- Q_D(QOpenGL2PaintEngineEx);
- state()->opacityChanged = true;
-
- Q_ASSERT(d->shaderManager);
- d->brushUniformsDirty = true;
- d->opacityUniformDirty = true;
-}
-
-void QOpenGL2PaintEngineEx::compositionModeChanged()
-{
-// qDebug("QOpenGL2PaintEngineEx::compositionModeChanged()");
- Q_D(QOpenGL2PaintEngineEx);
- state()->compositionModeChanged = true;
- d->compositionModeDirty = true;
-}
-
-void QOpenGL2PaintEngineEx::renderHintsChanged()
-{
- state()->renderHintsChanged = true;
-
-#ifndef QT_OPENGL_ES_2
- if (!QOpenGLContext::currentContext()->isOpenGLES()) {
- Q_D(QOpenGL2PaintEngineEx);
-QT_WARNING_PUSH
-QT_WARNING_DISABLE_DEPRECATED
- if ((state()->renderHints & QPainter::Antialiasing)
-#if QT_DEPRECATED_SINCE(5, 14)
- || (state()->renderHints & QPainter::HighQualityAntialiasing)
-#endif
- )
- d->funcs.glEnable(GL_MULTISAMPLE);
- else
- d->funcs.glDisable(GL_MULTISAMPLE);
-QT_WARNING_POP
- }
-#endif // QT_OPENGL_ES_2
-
- Q_D(QOpenGL2PaintEngineEx);
-
- // This is a somewhat sneaky way of conceptually making the next call to
- // updateTexture() use FoceUpdate for the TextureUpdateMode. We need this
- // as new render hints may require updating the filter mode.
- d->lastTextureUsed = GLuint(-1);
-
- d->brushTextureDirty = true;
-// qDebug("QOpenGL2PaintEngineEx::renderHintsChanged() not implemented!");
-}
-
-void QOpenGL2PaintEngineEx::transformChanged()
-{
- Q_D(QOpenGL2PaintEngineEx);
- d->matrixDirty = true;
- state()->matrixChanged = true;
-}
-
-
-static const QRectF scaleRect(const QRectF &r, qreal sx, qreal sy)
-{
- return QRectF(r.x() * sx, r.y() * sy, r.width() * sx, r.height() * sy);
-}
-
-void QOpenGL2PaintEngineEx::drawPixmap(const QRectF& dest, const QPixmap & pixmap, const QRectF & src)
-{
- Q_D(QOpenGL2PaintEngineEx);
- QOpenGLContext *ctx = d->ctx;
-
- // Draw pixmaps that are really images as images since drawImage has
- // better handling of non-default image formats.
- if (pixmap.paintEngine()->type() == QPaintEngine::Raster && !pixmap.isQBitmap())
- return drawImage(dest, pixmap.toImage(), src);
-
- int max_texture_size = ctx->d_func()->maxTextureSize();
- if (pixmap.width() > max_texture_size || pixmap.height() > max_texture_size) {
- QPixmap scaled = pixmap.scaled(max_texture_size, max_texture_size, Qt::KeepAspectRatio);
-
- const qreal sx = scaled.width() / qreal(pixmap.width());
- const qreal sy = scaled.height() / qreal(pixmap.height());
-
- drawPixmap(dest, scaled, scaleRect(src, sx, sy));
- return;
- }
-
- ensureActive();
- d->transferMode(ImageDrawingMode);
-
- GLenum filterMode = state()->renderHints & QPainter::SmoothPixmapTransform ? GL_LINEAR : GL_NEAREST;
- d->updateTexture(QT_IMAGE_TEXTURE_UNIT, pixmap, GL_CLAMP_TO_EDGE, filterMode);
-
- bool isBitmap = pixmap.isQBitmap();
- bool isOpaque = !isBitmap && !pixmap.hasAlpha();
-
- d->shaderManager->setSrcPixelType(isBitmap ? QOpenGLEngineShaderManager::PatternSrc : QOpenGLEngineShaderManager::ImageSrc);
-
- QOpenGLRect srcRect(src.left(), src.top(), src.right(), src.bottom());
- d->drawTexture(dest, srcRect, pixmap.size(), isOpaque, isBitmap);
-}
-
-void QOpenGL2PaintEngineEx::drawImage(const QRectF& dest, const QImage& image, const QRectF& src,
- Qt::ImageConversionFlags)
-{
- Q_D(QOpenGL2PaintEngineEx);
- QOpenGLContext *ctx = d->ctx;
-
- int max_texture_size = ctx->d_func()->maxTextureSize();
- if (image.width() > max_texture_size || image.height() > max_texture_size) {
- QImage scaled = image.scaled(max_texture_size, max_texture_size, Qt::KeepAspectRatio);
-
- const qreal sx = scaled.width() / qreal(image.width());
- const qreal sy = scaled.height() / qreal(image.height());
-
- drawImage(dest, scaled, scaleRect(src, sx, sy));
- return;
- }
-
- ensureActive();
- d->transferMode(ImageDrawingMode);
-
- QOpenGLTextureUploader::BindOptions bindOption = QOpenGLTextureUploader::PremultipliedAlphaBindOption;
- // Use specialized bind for formats we have specialized shaders for.
- switch (image.format()) {
- case QImage::Format_RGBA8888:
- case QImage::Format_ARGB32:
- case QImage::Format_RGBA64:
- d->shaderManager->setSrcPixelType(QOpenGLEngineShaderManager::NonPremultipliedImageSrc);
- bindOption = { };
- break;
- case QImage::Format_Alpha8:
- if (ctx->functions()->hasOpenGLFeature(QOpenGLFunctions::TextureRGFormats)) {
- d->shaderManager->setSrcPixelType(QOpenGLEngineShaderManager::AlphaImageSrc);
- bindOption = QOpenGLTextureUploader::UseRedForAlphaAndLuminanceBindOption;
- } else
- d->shaderManager->setSrcPixelType(QOpenGLEngineShaderManager::ImageSrc);
- break;
- case QImage::Format_Grayscale8:
- case QImage::Format_Grayscale16:
- if (ctx->functions()->hasOpenGLFeature(QOpenGLFunctions::TextureRGFormats)) {
- d->shaderManager->setSrcPixelType(QOpenGLEngineShaderManager::GrayscaleImageSrc);
- bindOption = QOpenGLTextureUploader::UseRedForAlphaAndLuminanceBindOption;
- } else
- d->shaderManager->setSrcPixelType(QOpenGLEngineShaderManager::ImageSrc);
- break;
- default:
- d->shaderManager->setSrcPixelType(QOpenGLEngineShaderManager::ImageSrc);
- break;
- }
-
- ImageWithBindOptions imageWithOptions = { image, bindOption };
- GLenum filterMode = state()->renderHints & QPainter::SmoothPixmapTransform ? GL_LINEAR : GL_NEAREST;
- d->updateTexture(QT_IMAGE_TEXTURE_UNIT, imageWithOptions, GL_CLAMP_TO_EDGE, filterMode);
-
- d->drawTexture(dest, src, image.size(), !image.hasAlphaChannel());
-}
-
-void QOpenGL2PaintEngineEx::drawStaticTextItem(QStaticTextItem *textItem)
-{
- Q_D(QOpenGL2PaintEngineEx);
-
- ensureActive();
-
- QPainterState *s = state();
-
- QFontEngine *fontEngine = textItem->fontEngine();
- if (shouldDrawCachedGlyphs(fontEngine, s->matrix)) {
- QFontEngine::GlyphFormat glyphFormat = fontEngine->glyphFormat != QFontEngine::Format_None
- ? fontEngine->glyphFormat : d->glyphCacheFormat;
- if (glyphFormat == QFontEngine::Format_A32) {
- if (d->device->context()->format().alphaBufferSize() > 0 || s->matrix.type() > QTransform::TxTranslate
- || (s->composition_mode != QPainter::CompositionMode_Source
- && s->composition_mode != QPainter::CompositionMode_SourceOver))
- {
- glyphFormat = QFontEngine::Format_A8;
- }
- }
-
- d->drawCachedGlyphs(glyphFormat, textItem);
- } else {
- QPaintEngineEx::drawStaticTextItem(textItem);
- }
-}
-
-bool QOpenGL2PaintEngineEx::drawTexture(const QRectF &dest, GLuint textureId, const QSize &size, const QRectF &src)
-{
- Q_D(QOpenGL2PaintEngineEx);
- if (!d->shaderManager)
- return false;
-
- ensureActive();
- d->transferMode(ImageDrawingMode);
-
- GLenum filterMode = state()->renderHints & QPainter::SmoothPixmapTransform ? GL_LINEAR : GL_NEAREST;
- d->updateTexture(QT_IMAGE_TEXTURE_UNIT, textureId, GL_CLAMP_TO_EDGE, filterMode);
-
- d->shaderManager->setSrcPixelType(QOpenGLEngineShaderManager::ImageSrc);
-
- QOpenGLRect srcRect(src.left(), src.bottom(), src.right(), src.top());
- d->drawTexture(dest, srcRect, size, false);
-
- return true;
-}
-
-void QOpenGL2PaintEngineEx::drawTextItem(const QPointF &p, const QTextItem &textItem)
-{
- Q_D(QOpenGL2PaintEngineEx);
-
- ensureActive();
- QOpenGL2PaintEngineState *s = state();
-
- const QTextItemInt &ti = static_cast<const QTextItemInt &>(textItem);
-
- QTransform::TransformationType txtype = s->matrix.type();
-
- QFontEngine::GlyphFormat glyphFormat = ti.fontEngine->glyphFormat != QFontEngine::Format_None
- ? ti.fontEngine->glyphFormat : d->glyphCacheFormat;
-
- if (glyphFormat == QFontEngine::Format_A32) {
- if (d->device->context()->format().alphaBufferSize() > 0 || txtype > QTransform::TxTranslate
- || (state()->composition_mode != QPainter::CompositionMode_Source
- && state()->composition_mode != QPainter::CompositionMode_SourceOver))
- {
- glyphFormat = QFontEngine::Format_A8;
- }
- }
-
- if (shouldDrawCachedGlyphs(ti.fontEngine, s->matrix)) {
- QVarLengthArray<QFixedPoint> positions;
- QVarLengthArray<glyph_t> glyphs;
- QTransform matrix = QTransform::fromTranslate(p.x(), p.y());
- ti.fontEngine->getGlyphPositions(ti.glyphs, matrix, ti.flags, glyphs, positions);
-
- {
- QStaticTextItem staticTextItem;
- staticTextItem.setFontEngine(ti.fontEngine);
- staticTextItem.glyphs = glyphs.data();
- staticTextItem.numGlyphs = glyphs.size();
- staticTextItem.glyphPositions = positions.data();
-
- d->drawCachedGlyphs(glyphFormat, &staticTextItem);
- }
- return;
- }
-
- QPaintEngineEx::drawTextItem(p, ti);
-}
-
-namespace {
-
- class QOpenGLStaticTextUserData: public QStaticTextUserData
- {
- public:
- QOpenGLStaticTextUserData()
- : QStaticTextUserData(OpenGLUserData), cacheSize(0, 0), cacheSerialNumber(0)
- {
- }
-
- ~QOpenGLStaticTextUserData()
- {
- }
-
- QSize cacheSize;
- QOpenGL2PEXVertexArray vertexCoordinateArray;
- QOpenGL2PEXVertexArray textureCoordinateArray;
- QFontEngine::GlyphFormat glyphFormat;
- int cacheSerialNumber;
- };
-
-}
-
-
-// #define QT_OPENGL_DRAWCACHEDGLYPHS_INDEX_ARRAY_VBO
-
-bool QOpenGL2PaintEngineEx::shouldDrawCachedGlyphs(QFontEngine *fontEngine, const QTransform &t) const
-{
- // The paint engine does not support projected cached glyph drawing
- if (t.type() == QTransform::TxProject)
- return false;
-
- // The font engine might not support filling the glyph cache
- // with the given transform applied, in which case we need to
- // fall back to the QPainterPath code-path.
- if (!fontEngine->supportsTransformation(t)) {
- // Except that drawing paths is slow, so for scales between
- // 0.5 and 2.0 we leave the glyph cache untransformed and deal
- // with the transform ourselves when painting, resulting in
- // drawing 1x cached glyphs with a smooth-scale.
- float det = t.determinant();
- if (det >= 0.25f && det <= 4.f) {
- // Assuming the baseclass still agrees
- return QPaintEngineEx::shouldDrawCachedGlyphs(fontEngine, t);
- }
-
- return false; // Fall back to path-drawing
- }
-
- return QPaintEngineEx::shouldDrawCachedGlyphs(fontEngine, t);
-}
-
-void QOpenGL2PaintEngineExPrivate::drawCachedGlyphs(QFontEngine::GlyphFormat glyphFormat,
- QStaticTextItem *staticTextItem)
-{
- Q_Q(QOpenGL2PaintEngineEx);
-
- QOpenGL2PaintEngineState *s = q->state();
-
- void *cacheKey = ctx; // use context, not the shareGroup() -> the GL glyph cache uses FBOs which may not be shareable
- bool recreateVertexArrays = false;
-
- QTransform glyphCacheTransform;
- QFontEngine *fe = staticTextItem->fontEngine();
- if (fe->supportsTransformation(s->matrix)) {
- // The font-engine supports rendering glyphs with the current transform, so we
- // build a glyph-cache with the scale pre-applied, so that the cache contains
- // glyphs with the appropriate resolution in the case of retina displays.
- glyphCacheTransform = s->matrix.type() < QTransform::TxRotate ?
- QTransform::fromScale(qAbs(s->matrix.m11()), qAbs(s->matrix.m22())) :
- QTransform::fromScale(
- QVector2D(s->matrix.m11(), s->matrix.m12()).length(),
- QVector2D(s->matrix.m21(), s->matrix.m22()).length());
- }
-
- QOpenGLTextureGlyphCache *cache =
- (QOpenGLTextureGlyphCache *) fe->glyphCache(cacheKey, glyphFormat, glyphCacheTransform);
- if (!cache || cache->glyphFormat() != glyphFormat || cache->contextGroup() == nullptr) {
- cache = new QOpenGLTextureGlyphCache(glyphFormat, glyphCacheTransform);
- fe->setGlyphCache(cacheKey, cache);
- recreateVertexArrays = true;
- }
-
- if (staticTextItem->userDataNeedsUpdate) {
- recreateVertexArrays = true;
- } else if (staticTextItem->userData() == nullptr) {
- recreateVertexArrays = true;
- } else if (staticTextItem->userData()->type != QStaticTextUserData::OpenGLUserData) {
- recreateVertexArrays = true;
- } else {
- QOpenGLStaticTextUserData *userData = static_cast<QOpenGLStaticTextUserData *>(staticTextItem->userData());
- if (userData->glyphFormat != glyphFormat) {
- recreateVertexArrays = true;
- } else if (userData->cacheSerialNumber != cache->serialNumber()) {
- recreateVertexArrays = true;
- }
- }
-
- // We only need to update the cache with new glyphs if we are actually going to recreate the vertex arrays.
- // If the cache size has changed, we do need to regenerate the vertices, but we don't need to repopulate the
- // cache so this text is performed before we test if the cache size has changed.
- if (recreateVertexArrays) {
- cache->setPaintEnginePrivate(this);
- if (!cache->populate(fe, staticTextItem->numGlyphs,
- staticTextItem->glyphs, staticTextItem->glyphPositions)) {
- // No space for glyphs in cache. We need to reset it and try again.
- cache->clear();
- cache->populate(fe, staticTextItem->numGlyphs,
- staticTextItem->glyphs, staticTextItem->glyphPositions);
- }
-
- if (cache->hasPendingGlyphs()) {
- // Filling in the glyphs binds and sets parameters, so we need to
- // ensure that the glyph cache doesn't mess with whatever unit
- // is currently active. Note that the glyph cache internally
- // uses the image texture unit for blitting to the cache, while
- // we switch between image and mask units when drawing.
- static const GLenum glypchCacheTextureUnit = QT_IMAGE_TEXTURE_UNIT;
- activateTextureUnit(glypchCacheTextureUnit);
-
- cache->fillInPendingGlyphs();
-
- // We assume the cache can be trusted on which texture was bound
- lastTextureUsed = cache->texture();
-
- // But since the brush and image texture units are possibly shared
- // we may have to re-bind brush textures after filling in the cache.
- brushTextureDirty = (QT_BRUSH_TEXTURE_UNIT == glypchCacheTextureUnit);
- }
- cache->setPaintEnginePrivate(nullptr);
- }
-
- if (cache->width() == 0 || cache->height() == 0)
- return;
-
- if (glyphFormat == QFontEngine::Format_ARGB)
- transferMode(ImageArrayDrawingMode);
- else
- transferMode(TextDrawingMode);
-
- int margin = fe->glyphMargin(glyphFormat);
-
- GLfloat dx = 1.0 / cache->width();
- GLfloat dy = 1.0 / cache->height();
-
- // Use global arrays by default
- QOpenGL2PEXVertexArray *vertexCoordinates = &vertexCoordinateArray;
- QOpenGL2PEXVertexArray *textureCoordinates = &textureCoordinateArray;
-
- if (staticTextItem->useBackendOptimizations) {
- QOpenGLStaticTextUserData *userData = nullptr;
-
- if (staticTextItem->userData() == nullptr
- || staticTextItem->userData()->type != QStaticTextUserData::OpenGLUserData) {
-
- userData = new QOpenGLStaticTextUserData();
- staticTextItem->setUserData(userData);
-
- } else {
- userData = static_cast<QOpenGLStaticTextUserData*>(staticTextItem->userData());
- }
-
- userData->glyphFormat = glyphFormat;
- userData->cacheSerialNumber = cache->serialNumber();
-
- // Use cache if backend optimizations is turned on
- vertexCoordinates = &userData->vertexCoordinateArray;
- textureCoordinates = &userData->textureCoordinateArray;
-
- QSize size(cache->width(), cache->height());
- if (userData->cacheSize != size) {
- recreateVertexArrays = true;
- userData->cacheSize = size;
- }
- }
-
- if (recreateVertexArrays) {
- vertexCoordinates->clear();
- textureCoordinates->clear();
-
- bool supportsSubPixelPositions = fe->supportsSubPixelPositions();
- for (int i=0; i<staticTextItem->numGlyphs; ++i) {
- QFixed subPixelPosition;
- if (supportsSubPixelPositions)
- subPixelPosition = fe->subPixelPositionForX(staticTextItem->glyphPositions[i].x);
-
- QTextureGlyphCache::GlyphAndSubPixelPosition glyph(staticTextItem->glyphs[i], subPixelPosition);
-
- const QTextureGlyphCache::Coord &c = cache->coords[glyph];
- if (c.isNull())
- continue;
-
- int x = qFloor(staticTextItem->glyphPositions[i].x.toReal() * cache->transform().m11()) + c.baseLineX - margin;
- int y = qRound(staticTextItem->glyphPositions[i].y.toReal() * cache->transform().m22()) - c.baseLineY - margin;
-
- vertexCoordinates->addQuad(QRectF(x, y, c.w, c.h));
- textureCoordinates->addQuad(QRectF(c.x*dx, c.y*dy, c.w * dx, c.h * dy));
- }
-
- staticTextItem->userDataNeedsUpdate = false;
- }
-
- int numGlyphs = vertexCoordinates->vertexCount() / 4;
- if (numGlyphs == 0)
- return;
-
- if (elementIndices.size() < numGlyphs*6) {
- Q_ASSERT(elementIndices.size() % 6 == 0);
- int j = elementIndices.size() / 6 * 4;
- while (j < numGlyphs*4) {
- elementIndices.append(j + 0);
- elementIndices.append(j + 0);
- elementIndices.append(j + 1);
- elementIndices.append(j + 2);
- elementIndices.append(j + 3);
- elementIndices.append(j + 3);
-
- j += 4;
- }
-
-#if defined(QT_OPENGL_DRAWCACHEDGLYPHS_INDEX_ARRAY_VBO)
- if (elementIndicesVBOId == 0)
- funcs.glGenBuffers(1, &elementIndicesVBOId);
-
- funcs.glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, elementIndicesVBOId);
- funcs.glBufferData(GL_ELEMENT_ARRAY_BUFFER, elementIndices.size() * sizeof(GLushort),
- elementIndices.constData(), GL_STATIC_DRAW);
-#endif
- } else {
-#if defined(QT_OPENGL_DRAWCACHEDGLYPHS_INDEX_ARRAY_VBO)
- funcs.glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, elementIndicesVBOId);
-#endif
- }
-
- if (glyphFormat != QFontEngine::Format_ARGB || recreateVertexArrays) {
- uploadData(QT_VERTEX_COORDS_ATTR, (GLfloat*)vertexCoordinates->data(), vertexCoordinates->vertexCount() * 2);
- uploadData(QT_TEXTURE_COORDS_ATTR, (GLfloat*)textureCoordinates->data(), textureCoordinates->vertexCount() * 2);
- }
-
- if (!snapToPixelGrid) {
- snapToPixelGrid = true;
- matrixDirty = true;
- }
-
- QBrush pensBrush = q->state()->pen.brush();
- setBrush(pensBrush);
-
- if (glyphFormat == QFontEngine::Format_A32) {
-
- // Subpixel antialiasing without gamma correction
-
- QPainter::CompositionMode compMode = q->state()->composition_mode;
- Q_ASSERT(compMode == QPainter::CompositionMode_Source
- || compMode == QPainter::CompositionMode_SourceOver);
-
- shaderManager->setMaskType(QOpenGLEngineShaderManager::SubPixelMaskPass1);
-
- if (pensBrush.style() == Qt::SolidPattern) {
- // Solid patterns can get away with only one pass.
- QColor c = pensBrush.color();
- qreal oldOpacity = q->state()->opacity;
- if (compMode == QPainter::CompositionMode_Source) {
- c = qt_premultiplyColor(c, q->state()->opacity);
- q->state()->opacity = 1;
- opacityUniformDirty = true;
- }
-
- compositionModeDirty = false; // I can handle this myself, thank you very much
- prepareForCachedGlyphDraw(*cache);
-
- // prepareForCachedGlyphDraw() have set the opacity on the current shader, so the opacity state can now be reset.
- if (compMode == QPainter::CompositionMode_Source) {
- q->state()->opacity = oldOpacity;
- opacityUniformDirty = true;
- }
-
- funcs.glEnable(GL_BLEND);
- funcs.glBlendFunc(GL_CONSTANT_COLOR, GL_ONE_MINUS_SRC_COLOR);
- funcs.glBlendColor(c.redF(), c.greenF(), c.blueF(), c.alphaF());
- } else {
- // Other brush styles need two passes.
-
- qreal oldOpacity = q->state()->opacity;
- if (compMode == QPainter::CompositionMode_Source) {
- q->state()->opacity = 1;
- opacityUniformDirty = true;
- pensBrush = Qt::white;
- setBrush(pensBrush);
- }
-
- compositionModeDirty = false; // I can handle this myself, thank you very much
- prepareForCachedGlyphDraw(*cache);
- funcs.glEnable(GL_BLEND);
- funcs.glBlendFunc(GL_ZERO, GL_ONE_MINUS_SRC_COLOR);
-
- updateTexture(QT_MASK_TEXTURE_UNIT, cache->texture(), GL_REPEAT, GL_NEAREST, ForceUpdate);
-
-#if defined(QT_OPENGL_DRAWCACHEDGLYPHS_INDEX_ARRAY_VBO)
- funcs.glDrawElements(GL_TRIANGLE_STRIP, 6 * numGlyphs, GL_UNSIGNED_SHORT, 0);
-#else
- const bool useIndexVbo = uploadIndexData(elementIndices.data(), GL_UNSIGNED_SHORT, 6 * numGlyphs);
- funcs.glDrawElements(GL_TRIANGLE_STRIP, 6 * numGlyphs, GL_UNSIGNED_SHORT, useIndexVbo ? nullptr : elementIndices.data());
-#endif
-
- shaderManager->setMaskType(QOpenGLEngineShaderManager::SubPixelMaskPass2);
-
- if (compMode == QPainter::CompositionMode_Source) {
- q->state()->opacity = oldOpacity;
- opacityUniformDirty = true;
- pensBrush = q->state()->pen.brush();
- setBrush(pensBrush);
- }
-
- compositionModeDirty = false;
- prepareForCachedGlyphDraw(*cache);
- funcs.glEnable(GL_BLEND);
- funcs.glBlendFunc(GL_ONE, GL_ONE);
- }
- compositionModeDirty = true;
- } else if (glyphFormat == QFontEngine::Format_ARGB) {
- currentBrush = noBrush;
- shaderManager->setSrcPixelType(QOpenGLEngineShaderManager::ImageSrc);
- if (prepareForCachedGlyphDraw(*cache))
- shaderManager->currentProgram()->setUniformValue(location(QOpenGLEngineShaderManager::ImageTexture), QT_IMAGE_TEXTURE_UNIT);
- } else {
- // Grayscale/mono glyphs
-
- shaderManager->setMaskType(QOpenGLEngineShaderManager::PixelMask);
- prepareForCachedGlyphDraw(*cache);
- }
-
- GLenum textureUnit = QT_MASK_TEXTURE_UNIT;
- if (glyphFormat == QFontEngine::Format_ARGB)
- textureUnit = QT_IMAGE_TEXTURE_UNIT;
-
- QOpenGLTextureGlyphCache::FilterMode filterMode = (s->matrix.type() > QTransform::TxTranslate) ?
- QOpenGLTextureGlyphCache::Linear : QOpenGLTextureGlyphCache::Nearest;
-
- GLenum glFilterMode = filterMode == QOpenGLTextureGlyphCache::Linear ? GL_LINEAR : GL_NEAREST;
-
- TextureUpdateMode updateMode = UpdateIfNeeded;
- if (cache->filterMode() != filterMode) {
- updateMode = ForceUpdate;
- cache->setFilterMode(filterMode);
- }
-
- updateTexture(textureUnit, cache->texture(), GL_REPEAT, glFilterMode, updateMode);
-
-#if defined(QT_OPENGL_DRAWCACHEDGLYPHS_INDEX_ARRAY_VBO)
- funcs.glDrawElements(GL_TRIANGLE_STRIP, 6 * numGlyphs, GL_UNSIGNED_SHORT, 0);
- funcs.glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, 0);
-#else
- const bool useIndexVbo = uploadIndexData(elementIndices.data(), GL_UNSIGNED_SHORT, 6 * numGlyphs);
- funcs.glDrawElements(GL_TRIANGLE_STRIP, 6 * numGlyphs, GL_UNSIGNED_SHORT, useIndexVbo ? nullptr : elementIndices.data());
-#endif
-}
-
-void QOpenGL2PaintEngineEx::drawPixmapFragments(const QPainter::PixmapFragment *fragments, int fragmentCount, const QPixmap &pixmap,
- QPainter::PixmapFragmentHints hints)
-{
- Q_D(QOpenGL2PaintEngineEx);
- // Use fallback for extended composition modes.
- if (state()->composition_mode > QPainter::CompositionMode_Plus) {
- QPaintEngineEx::drawPixmapFragments(fragments, fragmentCount, pixmap, hints);
- return;
- }
-
- ensureActive();
- int max_texture_size = d->ctx->d_func()->maxTextureSize();
- if (pixmap.width() > max_texture_size || pixmap.height() > max_texture_size) {
- QPixmap scaled = pixmap.scaled(max_texture_size, max_texture_size, Qt::KeepAspectRatio);
- d->drawPixmapFragments(fragments, fragmentCount, scaled, hints);
- } else {
- d->drawPixmapFragments(fragments, fragmentCount, pixmap, hints);
- }
-}
-
-
-void QOpenGL2PaintEngineExPrivate::drawPixmapFragments(const QPainter::PixmapFragment *fragments,
- int fragmentCount, const QPixmap &pixmap,
- QPainter::PixmapFragmentHints hints)
-{
- GLfloat dx = 1.0f / pixmap.size().width();
- GLfloat dy = 1.0f / pixmap.size().height();
-
- vertexCoordinateArray.clear();
- textureCoordinateArray.clear();
- opacityArray.reset();
-
- if (snapToPixelGrid) {
- snapToPixelGrid = false;
- matrixDirty = true;
- }
-
- bool allOpaque = true;
-
- for (int i = 0; i < fragmentCount; ++i) {
- qreal s = 0;
- qreal c = 1;
- if (fragments[i].rotation != 0) {
- s = qFastSin(qDegreesToRadians(fragments[i].rotation));
- c = qFastCos(qDegreesToRadians(fragments[i].rotation));
- }
-
- qreal right = 0.5 * fragments[i].scaleX * fragments[i].width;
- qreal bottom = 0.5 * fragments[i].scaleY * fragments[i].height;
- QOpenGLPoint bottomRight(right * c - bottom * s, right * s + bottom * c);
- QOpenGLPoint bottomLeft(-right * c - bottom * s, -right * s + bottom * c);
-
- vertexCoordinateArray.addVertex(bottomRight.x + fragments[i].x, bottomRight.y + fragments[i].y);
- vertexCoordinateArray.addVertex(-bottomLeft.x + fragments[i].x, -bottomLeft.y + fragments[i].y);
- vertexCoordinateArray.addVertex(-bottomRight.x + fragments[i].x, -bottomRight.y + fragments[i].y);
- vertexCoordinateArray.addVertex(-bottomRight.x + fragments[i].x, -bottomRight.y + fragments[i].y);
- vertexCoordinateArray.addVertex(bottomLeft.x + fragments[i].x, bottomLeft.y + fragments[i].y);
- vertexCoordinateArray.addVertex(bottomRight.x + fragments[i].x, bottomRight.y + fragments[i].y);
-
- QOpenGLRect src(fragments[i].sourceLeft * dx, fragments[i].sourceTop * dy,
- (fragments[i].sourceLeft + fragments[i].width) * dx,
- (fragments[i].sourceTop + fragments[i].height) * dy);
-
- textureCoordinateArray.addVertex(src.right, src.bottom);
- textureCoordinateArray.addVertex(src.right, src.top);
- textureCoordinateArray.addVertex(src.left, src.top);
- textureCoordinateArray.addVertex(src.left, src.top);
- textureCoordinateArray.addVertex(src.left, src.bottom);
- textureCoordinateArray.addVertex(src.right, src.bottom);
-
- qreal opacity = fragments[i].opacity * q->state()->opacity;
- opacityArray << opacity << opacity << opacity << opacity << opacity << opacity;
- allOpaque &= (opacity >= 0.99f);
- }
-
- transferMode(ImageOpacityArrayDrawingMode);
-
- GLenum filterMode = q->state()->renderHints & QPainter::SmoothPixmapTransform ? GL_LINEAR : GL_NEAREST;
- updateTexture(QT_IMAGE_TEXTURE_UNIT, pixmap, GL_CLAMP_TO_EDGE, filterMode);
-
- bool isBitmap = pixmap.isQBitmap();
- bool isOpaque = !isBitmap && (!pixmap.hasAlpha() || (hints & QPainter::OpaqueHint)) && allOpaque;
-
- // Setup for texture drawing
- currentBrush = noBrush;
- shaderManager->setSrcPixelType(isBitmap ? QOpenGLEngineShaderManager::PatternSrc
- : QOpenGLEngineShaderManager::ImageSrc);
- if (prepareForDraw(isOpaque))
- shaderManager->currentProgram()->setUniformValue(location(QOpenGLEngineShaderManager::ImageTexture), QT_IMAGE_TEXTURE_UNIT);
-
- if (isBitmap) {
- QColor col = qt_premultiplyColor(q->state()->pen.color(), (GLfloat)q->state()->opacity);
- shaderManager->currentProgram()->setUniformValue(location(QOpenGLEngineShaderManager::PatternColor), col);
- }
-
- funcs.glDrawArrays(GL_TRIANGLES, 0, 6 * fragmentCount);
-}
-
-bool QOpenGL2PaintEngineEx::begin(QPaintDevice *pdev)
-{
- Q_D(QOpenGL2PaintEngineEx);
-
- Q_ASSERT(pdev->devType() == QInternal::OpenGL);
- d->device = static_cast<QOpenGLPaintDevice*>(pdev);
-
- if (!d->device)
- return false;
-
- d->device->ensureActiveTarget();
-
- if (d->device->context() != QOpenGLContext::currentContext() || !d->device->context()) {
- qWarning("QPainter::begin(): QOpenGLPaintDevice's context needs to be current");
- return false;
- }
-
- if (d->ctx != QOpenGLContext::currentContext()
- || (d->ctx && QOpenGLContext::currentContext() && d->ctx->format() != QOpenGLContext::currentContext()->format())) {
- d->vertexBuffer.destroy();
- d->texCoordBuffer.destroy();
- d->opacityBuffer.destroy();
- d->indexBuffer.destroy();
- d->vao.destroy();
- }
-
- d->ctx = QOpenGLContext::currentContext();
- d->ctx->d_func()->active_engine = this;
-
- QOpenGLPaintDevicePrivate::get(d->device)->beginPaint();
-
- d->funcs.initializeOpenGLFunctions();
-
- // Generate a new Vertex Array Object if we don't have one already. We can
- // only hit the VAO-based path when using a core profile context. This is
- // because while non-core contexts can support VAOs via extensions, legacy
- // components like the QtOpenGL module do not know about VAOs. There are
- // still tests for QGL-QOpenGL paint engine interoperability, so keep the
- // status quo for now, and avoid introducing a VAO in non-core contexts.
- const bool needsVAO = d->ctx->format().profile() == QSurfaceFormat::CoreProfile
- && d->ctx->format().version() >= qMakePair(3, 2);
- if (needsVAO && !d->vao.isCreated()) {
- bool created = d->vao.create();
-
- // If we managed to create it then we have a profile that supports VAOs
- if (created) {
- d->vao.bind();
-
- // Generate a new Vertex Buffer Object if we don't have one already
- if (!d->vertexBuffer.isCreated()) {
- d->vertexBuffer.create();
- // Set its usage to StreamDraw, we will use this buffer only a few times before refilling it
- d->vertexBuffer.setUsagePattern(QOpenGLBuffer::StreamDraw);
- }
- if (!d->texCoordBuffer.isCreated()) {
- d->texCoordBuffer.create();
- d->texCoordBuffer.setUsagePattern(QOpenGLBuffer::StreamDraw);
- }
- if (!d->opacityBuffer.isCreated()) {
- d->opacityBuffer.create();
- d->opacityBuffer.setUsagePattern(QOpenGLBuffer::StreamDraw);
- }
- if (!d->indexBuffer.isCreated()) {
- d->indexBuffer.create();
- d->indexBuffer.setUsagePattern(QOpenGLBuffer::StreamDraw);
- }
- }
- }
-
- for (int i = 0; i < QT_GL_VERTEX_ARRAY_TRACKED_COUNT; ++i)
- d->vertexAttributeArraysEnabledState[i] = false;
-
- const QSize sz = d->device->size();
- d->width = sz.width();
- d->height = sz.height();
- d->mode = BrushDrawingMode;
- d->brushTextureDirty = true;
- d->brushUniformsDirty = true;
- d->matrixUniformDirty = true;
- d->matrixDirty = true;
- d->compositionModeDirty = true;
- d->opacityUniformDirty = true;
- d->needsSync = true;
- d->useSystemClip = !systemClip().isEmpty();
- d->currentBrush = QBrush();
-
- d->dirtyStencilRegion = QRect(0, 0, d->width, d->height);
- d->stencilClean = true;
-
- d->shaderManager = new QOpenGLEngineShaderManager(d->ctx);
-
- d->funcs.glDisable(GL_STENCIL_TEST);
- d->funcs.glDisable(GL_DEPTH_TEST);
- d->funcs.glDisable(GL_SCISSOR_TEST);
-
- d->glyphCacheFormat = QFontEngine::Format_A8;
-
-#ifndef QT_OPENGL_ES_2
- if (!QOpenGLContext::currentContext()->isOpenGLES()) {
- d->funcs.glDisable(GL_MULTISAMPLE);
- d->glyphCacheFormat = QFontEngine::Format_A32;
- d->multisamplingAlwaysEnabled = false;
- } else
-#endif // QT_OPENGL_ES_2
- {
- // OpenGL ES can't switch MSAA off, so if the gl paint device is
- // multisampled, it's always multisampled.
- d->multisamplingAlwaysEnabled = d->device->context()->format().samples() > 1;
- }
-
- return true;
-}
-
-bool QOpenGL2PaintEngineEx::end()
-{
- Q_D(QOpenGL2PaintEngineEx);
-
- QOpenGLPaintDevicePrivate::get(d->device)->endPaint();
-
- QOpenGLContext *ctx = d->ctx;
- d->funcs.glUseProgram(0);
- d->transferMode(BrushDrawingMode);
-
- ctx->d_func()->active_engine = nullptr;
-
- d->resetGLState();
-
- delete d->shaderManager;
- d->shaderManager = nullptr;
- d->currentBrush = QBrush();
-
-#ifdef QT_OPENGL_CACHE_AS_VBOS
- if (!d->unusedVBOSToClean.isEmpty()) {
- glDeleteBuffers(d->unusedVBOSToClean.size(), d->unusedVBOSToClean.constData());
- d->unusedVBOSToClean.clear();
- }
- if (!d->unusedIBOSToClean.isEmpty()) {
- glDeleteBuffers(d->unusedIBOSToClean.size(), d->unusedIBOSToClean.constData());
- d->unusedIBOSToClean.clear();
- }
-#endif
-
- return false;
-}
-
-void QOpenGL2PaintEngineEx::ensureActive()
-{
- Q_D(QOpenGL2PaintEngineEx);
- QOpenGLContext *ctx = d->ctx;
-
- if (d->vao.isCreated())
- d->vao.bind();
-
- if (isActive() && ctx->d_func()->active_engine != this) {
- ctx->d_func()->active_engine = this;
- d->needsSync = true;
- }
-
- if (d->needsSync) {
- d->device->ensureActiveTarget();
-
- d->transferMode(BrushDrawingMode);
- d->funcs.glViewport(0, 0, d->width, d->height);
- d->needsSync = false;
- d->shaderManager->setDirty();
- d->syncGlState();
- for (int i = 0; i < 3; ++i)
- d->vertexAttribPointers[i] = (GLfloat*)-1; // Assume the pointers are clobbered
- setState(state());
- }
-}
-
-void QOpenGL2PaintEngineExPrivate::updateClipScissorTest()
-{
- Q_Q(QOpenGL2PaintEngineEx);
- if (q->state()->clipTestEnabled) {
- funcs.glEnable(GL_STENCIL_TEST);
- funcs.glStencilFunc(GL_LEQUAL, q->state()->currentClip, ~GL_STENCIL_HIGH_BIT);
- } else {
- funcs.glDisable(GL_STENCIL_TEST);
- funcs.glStencilFunc(GL_ALWAYS, 0, 0xff);
- }
-
-#ifdef QT_GL_NO_SCISSOR_TEST
- currentScissorBounds = QRect(0, 0, width, height);
-#else
- QRect bounds = q->state()->rectangleClip;
- if (!q->state()->clipEnabled) {
- if (useSystemClip)
- bounds = systemClip.boundingRect();
- else
- bounds = QRect(0, 0, width, height);
- } else {
- if (useSystemClip)
- bounds = bounds.intersected(systemClip.boundingRect());
- else
- bounds = bounds.intersected(QRect(0, 0, width, height));
- }
-
- currentScissorBounds = bounds;
-
- if (bounds == QRect(0, 0, width, height)) {
- funcs.glDisable(GL_SCISSOR_TEST);
- } else {
- funcs.glEnable(GL_SCISSOR_TEST);
- setScissor(bounds);
- }
-#endif
-}
-
-void QOpenGL2PaintEngineExPrivate::setScissor(const QRect &rect)
-{
- const int left = rect.left();
- const int width = rect.width();
- int bottom = height - (rect.top() + rect.height());
- if (device->paintFlipped()) {
- bottom = rect.top();
- }
- const int height = rect.height();
-
- funcs.glScissor(left, bottom, width, height);
-}
-
-void QOpenGL2PaintEngineEx::clipEnabledChanged()
-{
- Q_D(QOpenGL2PaintEngineEx);
-
- state()->clipChanged = true;
-
- if (painter()->hasClipping())
- d->regenerateClip();
- else
- d->systemStateChanged();
-}
-
-void QOpenGL2PaintEngineExPrivate::clearClip(uint value)
-{
- dirtyStencilRegion -= currentScissorBounds;
-
- funcs.glStencilMask(0xff);
- funcs.glClearStencil(value);
- funcs.glClear(GL_STENCIL_BUFFER_BIT);
- funcs.glStencilMask(0x0);
-
- q->state()->needsClipBufferClear = false;
-}
-
-void QOpenGL2PaintEngineExPrivate::writeClip(const QVectorPath &path, uint value)
-{
- transferMode(BrushDrawingMode);
-
- if (snapToPixelGrid) {
- snapToPixelGrid = false;
- matrixDirty = true;
- }
-
- if (matrixDirty)
- updateMatrix();
-
- stencilClean = false;
-
- const bool singlePass = !path.hasWindingFill()
- && (((q->state()->currentClip == maxClip - 1) && q->state()->clipTestEnabled)
- || q->state()->needsClipBufferClear);
- const uint referenceClipValue = q->state()->needsClipBufferClear ? 1 : q->state()->currentClip;
-
- if (q->state()->needsClipBufferClear)
- clearClip(1);
-
- if (path.isEmpty()) {
- funcs.glEnable(GL_STENCIL_TEST);
- funcs.glStencilFunc(GL_LEQUAL, value, ~GL_STENCIL_HIGH_BIT);
- return;
- }
-
- if (q->state()->clipTestEnabled)
- funcs.glStencilFunc(GL_LEQUAL, q->state()->currentClip, ~GL_STENCIL_HIGH_BIT);
- else
- funcs.glStencilFunc(GL_ALWAYS, 0, 0xff);
-
- vertexCoordinateArray.clear();
- vertexCoordinateArray.addPath(path, inverseScale, false);
-
- if (!singlePass)
- fillStencilWithVertexArray(vertexCoordinateArray, path.hasWindingFill());
-
- funcs.glColorMask(false, false, false, false);
- funcs.glEnable(GL_STENCIL_TEST);
- useSimpleShader();
-
- if (singlePass) {
- // Under these conditions we can set the new stencil value in a single
- // pass, by using the current value and the "new value" as the toggles
-
- funcs.glStencilFunc(GL_LEQUAL, referenceClipValue, ~GL_STENCIL_HIGH_BIT);
- funcs.glStencilOp(GL_KEEP, GL_INVERT, GL_INVERT);
- funcs.glStencilMask(value ^ referenceClipValue);
-
- drawVertexArrays(vertexCoordinateArray, GL_TRIANGLE_FAN);
- } else {
- funcs.glStencilOp(GL_KEEP, GL_REPLACE, GL_REPLACE);
- funcs.glStencilMask(0xff);
-
- if (!q->state()->clipTestEnabled && path.hasWindingFill()) {
- // Pass when any clip bit is set, set high bit
- funcs.glStencilFunc(GL_NOTEQUAL, GL_STENCIL_HIGH_BIT, ~GL_STENCIL_HIGH_BIT);
- composite(vertexCoordinateArray.boundingRect());
- }
-
- // Pass when high bit is set, replace stencil value with new clip value
- funcs.glStencilFunc(GL_NOTEQUAL, value, GL_STENCIL_HIGH_BIT);
-
- composite(vertexCoordinateArray.boundingRect());
- }
-
- funcs.glStencilFunc(GL_LEQUAL, value, ~GL_STENCIL_HIGH_BIT);
- funcs.glStencilMask(0);
-
- funcs.glColorMask(true, true, true, true);
-}
-
-void QOpenGL2PaintEngineEx::clip(const QVectorPath &path, Qt::ClipOperation op)
-{
-// qDebug("QOpenGL2PaintEngineEx::clip()");
- Q_D(QOpenGL2PaintEngineEx);
-
- state()->clipChanged = true;
-
- ensureActive();
-
- if (op == Qt::ReplaceClip) {
- op = Qt::IntersectClip;
- if (d->hasClipOperations()) {
- d->systemStateChanged();
- state()->canRestoreClip = false;
- }
- }
-
-#ifndef QT_GL_NO_SCISSOR_TEST
- if (!path.isEmpty() && op == Qt::IntersectClip && (path.shape() == QVectorPath::RectangleHint)) {
- const QPointF* const points = reinterpret_cast<const QPointF*>(path.points());
- QRectF rect(points[0], points[2]);
-
- if (state()->matrix.type() <= QTransform::TxScale
- || (state()->matrix.type() == QTransform::TxRotate
- && qFuzzyIsNull(state()->matrix.m11())
- && qFuzzyIsNull(state()->matrix.m22())))
- {
- state()->rectangleClip = state()->rectangleClip.intersected(state()->matrix.mapRect(rect).toRect());
- d->updateClipScissorTest();
- return;
- }
- }
-#endif
-
- const QRect pathRect = state()->matrix.mapRect(path.controlPointRect()).toAlignedRect();
-
- switch (op) {
- case Qt::NoClip:
- if (d->useSystemClip) {
- state()->clipTestEnabled = true;
- state()->currentClip = 1;
- } else {
- state()->clipTestEnabled = false;
- }
- state()->rectangleClip = QRect(0, 0, d->width, d->height);
- state()->canRestoreClip = false;
- d->updateClipScissorTest();
- break;
- case Qt::IntersectClip:
- state()->rectangleClip = state()->rectangleClip.intersected(pathRect);
- d->updateClipScissorTest();
- d->resetClipIfNeeded();
- ++d->maxClip;
- d->writeClip(path, d->maxClip);
- state()->currentClip = d->maxClip;
- state()->clipTestEnabled = true;
- break;
- default:
- break;
- }
-}
-
-void QOpenGL2PaintEngineExPrivate::regenerateClip()
-{
- systemStateChanged();
- replayClipOperations();
-}
-
-void QOpenGL2PaintEngineExPrivate::systemStateChanged()
-{
- Q_Q(QOpenGL2PaintEngineEx);
-
- q->state()->clipChanged = true;
-
- if (systemClip.isEmpty()) {
- useSystemClip = false;
- } else {
- if (q->paintDevice()->devType() == QInternal::Widget && currentClipDevice) {
- //QWidgetPrivate *widgetPrivate = qt_widget_private(static_cast<QWidget *>(currentClipDevice)->window());
- //useSystemClip = widgetPrivate->extra && widgetPrivate->extra->inRenderWithPainter;
- useSystemClip = true;
- } else {
- useSystemClip = true;
- }
- }
-
- q->state()->clipTestEnabled = false;
- q->state()->needsClipBufferClear = true;
-
- q->state()->currentClip = 1;
- maxClip = 1;
-
- q->state()->rectangleClip = useSystemClip ? systemClip.boundingRect() : QRect(0, 0, width, height);
- updateClipScissorTest();
-
- if (systemClip.rectCount() == 1) {
- if (systemClip.boundingRect() == QRect(0, 0, width, height))
- useSystemClip = false;
-#ifndef QT_GL_NO_SCISSOR_TEST
- // scissoring takes care of the system clip
- return;
-#endif
- }
-
- if (useSystemClip) {
- clearClip(0);
-
- QPainterPath path;
- path.addRegion(systemClip);
-
- q->state()->currentClip = 0;
- writeClip(qtVectorPathForPath(q->state()->matrix.inverted().map(path)), 1);
- q->state()->currentClip = 1;
- q->state()->clipTestEnabled = true;
- }
-}
-
-void QOpenGL2PaintEngineEx::setState(QPainterState *new_state)
-{
- // qDebug("QOpenGL2PaintEngineEx::setState()");
-
- Q_D(QOpenGL2PaintEngineEx);
-
- QOpenGL2PaintEngineState *s = static_cast<QOpenGL2PaintEngineState *>(new_state);
- QOpenGL2PaintEngineState *old_state = state();
-
- QPaintEngineEx::setState(s);
-
- if (s->isNew) {
- // Newly created state object. The call to setState()
- // will either be followed by a call to begin(), or we are
- // setting the state as part of a save().
- s->isNew = false;
- return;
- }
-
- // Setting the state as part of a restore().
-
- if (old_state == s || old_state->renderHintsChanged)
- renderHintsChanged();
-
- if (old_state == s || old_state->matrixChanged)
- d->matrixDirty = true;
-
- if (old_state == s || old_state->compositionModeChanged)
- d->compositionModeDirty = true;
-
- if (old_state == s || old_state->opacityChanged)
- d->opacityUniformDirty = true;
-
- if (old_state == s || old_state->clipChanged) {
- if (old_state && old_state != s && old_state->canRestoreClip) {
- d->updateClipScissorTest();
- d->funcs.glDepthFunc(GL_LEQUAL);
- } else {
- d->regenerateClip();
- }
- }
-}
-
-QPainterState *QOpenGL2PaintEngineEx::createState(QPainterState *orig) const
-{
- if (orig)
- const_cast<QOpenGL2PaintEngineEx *>(this)->ensureActive();
-
- QOpenGL2PaintEngineState *s;
- if (!orig)
- s = new QOpenGL2PaintEngineState();
- else
- s = new QOpenGL2PaintEngineState(*static_cast<QOpenGL2PaintEngineState *>(orig));
-
- s->matrixChanged = false;
- s->compositionModeChanged = false;
- s->opacityChanged = false;
- s->renderHintsChanged = false;
- s->clipChanged = false;
-
- return s;
-}
-
-QOpenGL2PaintEngineState::QOpenGL2PaintEngineState(QOpenGL2PaintEngineState &other)
- : QPainterState(other)
-{
- isNew = true;
- needsClipBufferClear = other.needsClipBufferClear;
- clipTestEnabled = other.clipTestEnabled;
- currentClip = other.currentClip;
- canRestoreClip = other.canRestoreClip;
- rectangleClip = other.rectangleClip;
-}
-
-QOpenGL2PaintEngineState::QOpenGL2PaintEngineState()
-{
- isNew = true;
- needsClipBufferClear = true;
- clipTestEnabled = false;
- canRestoreClip = true;
-}
-
-QOpenGL2PaintEngineState::~QOpenGL2PaintEngineState()
-{
-}
-
-void QOpenGL2PaintEngineExPrivate::setVertexAttribArrayEnabled(int arrayIndex, bool enabled)
-{
- Q_ASSERT(arrayIndex < QT_GL_VERTEX_ARRAY_TRACKED_COUNT);
-
- if (vertexAttributeArraysEnabledState[arrayIndex] && !enabled)
- funcs.glDisableVertexAttribArray(arrayIndex);
-
- if (!vertexAttributeArraysEnabledState[arrayIndex] && enabled)
- funcs.glEnableVertexAttribArray(arrayIndex);
-
- vertexAttributeArraysEnabledState[arrayIndex] = enabled;
-}
-
-void QOpenGL2PaintEngineExPrivate::syncGlState()
-{
- for (int i = 0; i < QT_GL_VERTEX_ARRAY_TRACKED_COUNT; ++i) {
- if (vertexAttributeArraysEnabledState[i])
- funcs.glEnableVertexAttribArray(i);
- else
- funcs.glDisableVertexAttribArray(i);
- }
-}
-
-
-QT_END_NAMESPACE
diff --git a/src/gui/opengl/qopenglpaintengine_p.h b/src/gui/opengl/qopenglpaintengine_p.h
deleted file mode 100644
index 81f17572b2..0000000000
--- a/src/gui/opengl/qopenglpaintengine_p.h
+++ /dev/null
@@ -1,396 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the QtGui module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef QOPENGLPAINTENGINE_P_H
-#define QOPENGLPAINTENGINE_P_H
-
-//
-// W A R N I N G
-// -------------
-//
-// This file is not part of the Qt API. It exists purely as an
-// implementation detail. This header file may change from version to
-// version without notice, or even be removed.
-//
-// We mean it.
-//
-
-#include <QtGui/private/qtguiglobal_p.h>
-#include <QDebug>
-
-#include <qopenglpaintdevice.h>
-
-#include <private/qpaintengineex_p.h>
-#include <private/qopenglengineshadermanager_p.h>
-#include <private/qopengl2pexvertexarray_p.h>
-#include <private/qfontengine_p.h>
-#include <private/qdatabuffer_p.h>
-#include <private/qtriangulatingstroker_p.h>
-
-#include <private/qopenglextensions_p.h>
-
-#include <QOpenGLVertexArrayObject>
-#include <QOpenGLBuffer>
-
-enum EngineMode {
- ImageDrawingMode,
- TextDrawingMode,
- BrushDrawingMode,
- ImageArrayDrawingMode,
- ImageOpacityArrayDrawingMode
-};
-
-QT_BEGIN_NAMESPACE
-
-#define GL_STENCIL_HIGH_BIT GLuint(0x80)
-#define QT_UNKNOWN_TEXTURE_UNIT GLuint(-1)
-#define QT_DEFAULT_TEXTURE_UNIT GLuint(0)
-#define QT_BRUSH_TEXTURE_UNIT GLuint(0)
-#define QT_IMAGE_TEXTURE_UNIT GLuint(0) //Can be the same as brush texture unit
-#define QT_MASK_TEXTURE_UNIT GLuint(1)
-#define QT_BACKGROUND_TEXTURE_UNIT GLuint(2)
-
-class QOpenGL2PaintEngineExPrivate;
-
-class QOpenGL2PaintEngineState : public QPainterState
-{
-public:
- QOpenGL2PaintEngineState(QOpenGL2PaintEngineState &other);
- QOpenGL2PaintEngineState();
- ~QOpenGL2PaintEngineState();
-
- uint isNew : 1;
- uint needsClipBufferClear : 1;
- uint clipTestEnabled : 1;
- uint canRestoreClip : 1;
- uint matrixChanged : 1;
- uint compositionModeChanged : 1;
- uint opacityChanged : 1;
- uint renderHintsChanged : 1;
- uint clipChanged : 1;
- uint currentClip : 8;
-
- QRect rectangleClip;
-};
-
-class Q_GUI_EXPORT QOpenGL2PaintEngineEx : public QPaintEngineEx
-{
- Q_DECLARE_PRIVATE(QOpenGL2PaintEngineEx)
-public:
- QOpenGL2PaintEngineEx();
- ~QOpenGL2PaintEngineEx();
-
- bool begin(QPaintDevice *device) override;
- void ensureActive();
- bool end() override;
-
- virtual void clipEnabledChanged() override;
- virtual void penChanged() override;
- virtual void brushChanged() override;
- virtual void brushOriginChanged() override;
- virtual void opacityChanged() override;
- virtual void compositionModeChanged() override;
- virtual void renderHintsChanged() override;
- virtual void transformChanged() override;
-
- virtual void drawPixmap(const QRectF &r, const QPixmap &pm, const QRectF &sr) override;
- virtual void drawPixmapFragments(const QPainter::PixmapFragment *fragments, int fragmentCount, const QPixmap &pixmap,
- QPainter::PixmapFragmentHints hints) override;
- virtual void drawImage(const QRectF &r, const QImage &pm, const QRectF &sr,
- Qt::ImageConversionFlags flags = Qt::AutoColor) override;
- virtual void drawTextItem(const QPointF &p, const QTextItem &textItem) override;
- virtual void fill(const QVectorPath &path, const QBrush &brush) override;
- virtual void stroke(const QVectorPath &path, const QPen &pen) override;
- virtual void clip(const QVectorPath &path, Qt::ClipOperation op) override;
-
- virtual void drawStaticTextItem(QStaticTextItem *textItem) override;
-
- bool drawTexture(const QRectF &r, GLuint textureId, const QSize &size, const QRectF &sr);
-
- Type type() const override { return OpenGL2; }
-
- virtual void setState(QPainterState *s) override;
- virtual QPainterState *createState(QPainterState *orig) const override;
- inline QOpenGL2PaintEngineState *state() {
- return static_cast<QOpenGL2PaintEngineState *>(QPaintEngineEx::state());
- }
- inline const QOpenGL2PaintEngineState *state() const {
- return static_cast<const QOpenGL2PaintEngineState *>(QPaintEngineEx::state());
- }
-
- void beginNativePainting() override;
- void endNativePainting() override;
-
- void invalidateState();
-
- void setRenderTextActive(bool);
-
- bool isNativePaintingActive() const;
- bool requiresPretransformedGlyphPositions(QFontEngine *, const QTransform &) const override { return false; }
- bool shouldDrawCachedGlyphs(QFontEngine *, const QTransform &) const override;
-
-private:
- Q_DISABLE_COPY_MOVE(QOpenGL2PaintEngineEx)
-
- friend class QOpenGLEngineShaderManager;
-};
-
-// This probably needs to grow to GL_MAX_VERTEX_ATTRIBS, but 3 is ok for now as that's
-// all the GL2 engine uses:
-#define QT_GL_VERTEX_ARRAY_TRACKED_COUNT 3
-
-class QOpenGL2PaintEngineExPrivate : public QPaintEngineExPrivate
-{
- Q_DECLARE_PUBLIC(QOpenGL2PaintEngineEx)
-public:
- enum StencilFillMode {
- OddEvenFillMode,
- WindingFillMode,
- TriStripStrokeFillMode
- };
-
- QOpenGL2PaintEngineExPrivate(QOpenGL2PaintEngineEx *q_ptr) :
- q(q_ptr),
- shaderManager(nullptr),
- width(0), height(0),
- ctx(nullptr),
- useSystemClip(true),
- elementIndicesVBOId(0),
- opacityArray(0),
- snapToPixelGrid(false),
- nativePaintingActive(false),
- inverseScale(1),
- lastTextureUnitUsed(QT_UNKNOWN_TEXTURE_UNIT),
- vertexBuffer(QOpenGLBuffer::VertexBuffer),
- texCoordBuffer(QOpenGLBuffer::VertexBuffer),
- opacityBuffer(QOpenGLBuffer::VertexBuffer),
- indexBuffer(QOpenGLBuffer::IndexBuffer)
- { }
-
- ~QOpenGL2PaintEngineExPrivate();
-
- void updateBrushTexture();
- void updateBrushUniforms();
- void updateMatrix();
- void updateCompositionMode();
-
- enum TextureUpdateMode { UpdateIfNeeded, ForceUpdate };
- template<typename T>
- void updateTexture(GLenum textureUnit, const T &texture, GLenum wrapMode, GLenum filterMode, TextureUpdateMode updateMode = UpdateIfNeeded);
- template<typename T>
- GLuint bindTexture(const T &texture);
- void activateTextureUnit(GLenum textureUnit);
-
- void resetGLState();
-
- // fill, stroke, drawTexture, drawPixmaps & drawCachedGlyphs are the main rendering entry-points,
- // however writeClip can also be thought of as en entry point as it does similar things.
- void fill(const QVectorPath &path);
- void stroke(const QVectorPath &path, const QPen &pen);
- void drawTexture(const QOpenGLRect& dest, const QOpenGLRect& src, const QSize &textureSize, bool opaque, bool pattern = false);
- void drawPixmapFragments(const QPainter::PixmapFragment *fragments, int fragmentCount, const QPixmap &pixmap,
- QPainter::PixmapFragmentHints hints);
- void drawCachedGlyphs(QFontEngine::GlyphFormat glyphFormat, QStaticTextItem *staticTextItem);
-
- // Calls glVertexAttributePointer if the pointer has changed
- inline void uploadData(unsigned int arrayIndex, const GLfloat *data, GLuint count);
- inline bool uploadIndexData(const void *data, GLenum indexValueType, GLuint count);
-
- // draws whatever is in the vertex array:
- void drawVertexArrays(const float *data, int *stops, int stopCount, GLenum primitive);
- void drawVertexArrays(QOpenGL2PEXVertexArray &vertexArray, GLenum primitive) {
- drawVertexArrays((const float *) vertexArray.data(), vertexArray.stops(), vertexArray.stopCount(), primitive);
- }
-
- // Composites the bounding rect onto dest buffer:
- void composite(const QOpenGLRect& boundingRect);
-
- // Calls drawVertexArrays to render into stencil buffer:
- void fillStencilWithVertexArray(const float *data, int count, int *stops, int stopCount, const QOpenGLRect &bounds, StencilFillMode mode);
- void fillStencilWithVertexArray(QOpenGL2PEXVertexArray& vertexArray, bool useWindingFill) {
- fillStencilWithVertexArray((const float *) vertexArray.data(), 0, vertexArray.stops(), vertexArray.stopCount(),
- vertexArray.boundingRect(),
- useWindingFill ? WindingFillMode : OddEvenFillMode);
- }
-
- void setBrush(const QBrush& brush);
- void transferMode(EngineMode newMode);
- bool prepareForDraw(bool srcPixelsAreOpaque); // returns true if the program has changed
- bool prepareForCachedGlyphDraw(const QFontEngineGlyphCache &cache);
- inline void useSimpleShader();
- inline GLuint location(const QOpenGLEngineShaderManager::Uniform uniform) {
- return shaderManager->getUniformLocation(uniform);
- }
-
- void clearClip(uint value);
- void writeClip(const QVectorPath &path, uint value);
- void resetClipIfNeeded();
-
- void updateClipScissorTest();
- void setScissor(const QRect &rect);
- void regenerateClip();
- void systemStateChanged() override;
-
- void setVertexAttribArrayEnabled(int arrayIndex, bool enabled = true);
- void syncGlState();
-
- static QOpenGLEngineShaderManager* shaderManagerForEngine(QOpenGL2PaintEngineEx *engine) { return engine->d_func()->shaderManager; }
- static QOpenGL2PaintEngineExPrivate *getData(QOpenGL2PaintEngineEx *engine) { return engine->d_func(); }
- static void cleanupVectorPath(QPaintEngineEx *engine, void *data);
-
- QOpenGLExtensions funcs;
-
- QOpenGL2PaintEngineEx* q;
- QOpenGLEngineShaderManager* shaderManager;
- QOpenGLPaintDevice* device;
- int width, height;
- QOpenGLContext *ctx;
- EngineMode mode;
- QFontEngine::GlyphFormat glyphCacheFormat;
-
- bool vertexAttributeArraysEnabledState[QT_GL_VERTEX_ARRAY_TRACKED_COUNT];
-
- // Dirty flags
- bool matrixDirty; // Implies matrix uniforms are also dirty
- bool compositionModeDirty;
- bool brushTextureDirty;
- bool brushUniformsDirty;
- bool opacityUniformDirty;
- bool matrixUniformDirty;
-
- bool stencilClean; // Has the stencil not been used for clipping so far?
- bool useSystemClip;
- QRegion dirtyStencilRegion;
- QRect currentScissorBounds;
- uint maxClip;
-
- QBrush currentBrush; // May not be the state's brush!
- const QBrush noBrush;
-
- QImage currentBrushImage;
-
- QOpenGL2PEXVertexArray vertexCoordinateArray;
- QOpenGL2PEXVertexArray textureCoordinateArray;
- QVector<GLushort> elementIndices;
- GLuint elementIndicesVBOId;
- QDataBuffer<GLfloat> opacityArray;
- GLfloat staticVertexCoordinateArray[8];
- GLfloat staticTextureCoordinateArray[8];
-
- bool snapToPixelGrid;
- bool nativePaintingActive;
- GLfloat pmvMatrix[3][3];
- GLfloat inverseScale;
-
- GLenum lastTextureUnitUsed;
- GLuint lastTextureUsed;
-
- QOpenGLVertexArrayObject vao;
- QOpenGLBuffer vertexBuffer;
- QOpenGLBuffer texCoordBuffer;
- QOpenGLBuffer opacityBuffer;
- QOpenGLBuffer indexBuffer;
-
- bool needsSync;
- bool multisamplingAlwaysEnabled;
-
- QTriangulatingStroker stroker;
- QDashedStrokeProcessor dasher;
-
- QVector<GLuint> unusedVBOSToClean;
- QVector<GLuint> unusedIBOSToClean;
-
- const GLfloat *vertexAttribPointers[3];
-};
-
-
-void QOpenGL2PaintEngineExPrivate::uploadData(unsigned int arrayIndex, const GLfloat *data, GLuint count)
-{
- Q_ASSERT(arrayIndex < 3);
-
- // If a vertex array object is created we have a profile that supports them
- // and we will upload the data via a QOpenGLBuffer. Otherwise we will use
- // the legacy way of uploading the data via glVertexAttribPointer.
- if (vao.isCreated()) {
- if (arrayIndex == QT_VERTEX_COORDS_ATTR) {
- vertexBuffer.bind();
- vertexBuffer.allocate(data, count * sizeof(float));
- }
- if (arrayIndex == QT_TEXTURE_COORDS_ATTR) {
- texCoordBuffer.bind();
- texCoordBuffer.allocate(data, count * sizeof(float));
- }
- if (arrayIndex == QT_OPACITY_ATTR) {
- opacityBuffer.bind();
- opacityBuffer.allocate(data, count * sizeof(float));
- }
- if (arrayIndex == QT_OPACITY_ATTR)
- funcs.glVertexAttribPointer(arrayIndex, 1, GL_FLOAT, GL_FALSE, 0, nullptr);
- else
- funcs.glVertexAttribPointer(arrayIndex, 2, GL_FLOAT, GL_FALSE, 0, nullptr);
- } else {
- // If we already uploaded the data we don't have to do it again
- if (data == vertexAttribPointers[arrayIndex])
- return;
-
- // Store the data in cache and upload it to the graphics card.
- vertexAttribPointers[arrayIndex] = data;
- if (arrayIndex == QT_OPACITY_ATTR)
- funcs.glVertexAttribPointer(arrayIndex, 1, GL_FLOAT, GL_FALSE, 0, data);
- else
- funcs.glVertexAttribPointer(arrayIndex, 2, GL_FLOAT, GL_FALSE, 0, data);
- }
-}
-
-bool QOpenGL2PaintEngineExPrivate::uploadIndexData(const void *data, GLenum indexValueType, GLuint count)
-{
- // Follow the uploadData() logic: VBOs are used only when VAO support is available.
- // Otherwise the legacy client-side pointer path is used.
- if (vao.isCreated()) {
- Q_ASSERT(indexValueType == GL_UNSIGNED_SHORT || indexValueType == GL_UNSIGNED_INT);
- indexBuffer.bind();
- indexBuffer.allocate(data, count * (indexValueType == GL_UNSIGNED_SHORT ? sizeof(quint16) : sizeof(quint32)));
- return true;
- }
- return false;
-}
-
-QT_END_NAMESPACE
-
-#endif
diff --git a/src/gui/opengl/qopenglpixeltransferoptions.cpp b/src/gui/opengl/qopenglpixeltransferoptions.cpp
deleted file mode 100644
index b0d953d76b..0000000000
--- a/src/gui/opengl/qopenglpixeltransferoptions.cpp
+++ /dev/null
@@ -1,263 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2013 Klaralvdalens Datakonsult AB (KDAB).
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the QtGui module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "qopenglpixeltransferoptions.h"
-#include <QSharedData>
-
-QT_BEGIN_NAMESPACE
-
-/*!
- * \class QOpenGLPixelTransferOptions
- *
- * \brief The QOpenGLPixelTransferOptions class describes the pixel storage
- * modes that affect the unpacking of pixels during texture upload.
- */
-
-/*!
- * \fn QOpenGLPixelTransferOptions & QOpenGLPixelTransferOptions::operator=(QOpenGLPixelTransferOptions &&other)
- * \internal
- */
-
-/*!
- * \fn void QOpenGLPixelTransferOptions::swap(QOpenGLPixelTransferOptions &other)
- * \internal
- */
-
-class QOpenGLPixelTransferOptionsData : public QSharedData
-{
-public:
- QOpenGLPixelTransferOptionsData()
- : alignment(4)
- , skipImages(0)
- , skipRows(0)
- , skipPixels(0)
- , imageHeight(0)
- , rowLength(0)
- , lsbFirst(false)
- , swapBytes(false)
- {}
-
- int alignment;
- int skipImages;
- int skipRows;
- int skipPixels;
- int imageHeight;
- int rowLength;
- bool lsbFirst;
- bool swapBytes;
-};
-
-/*!
- * Constructs a new QOpenGLPixelTransferOptions instance with the default settings.
- */
-QOpenGLPixelTransferOptions::QOpenGLPixelTransferOptions()
- : data(new QOpenGLPixelTransferOptionsData)
-{
-}
-
-/*!
- * \internal
- */
-QOpenGLPixelTransferOptions::QOpenGLPixelTransferOptions(const QOpenGLPixelTransferOptions &rhs)
- : data(rhs.data)
-{
-}
-
-/*!
- * \internal
- */
-QOpenGLPixelTransferOptions &QOpenGLPixelTransferOptions::operator=(const QOpenGLPixelTransferOptions &rhs)
-{
- if (this != &rhs)
- data.operator=(rhs.data);
- return *this;
-}
-
-/*!
- * Destructor.
- */
-QOpenGLPixelTransferOptions::~QOpenGLPixelTransferOptions()
-{
-}
-
-/*!
- * Sets the \a alignment requirements for each pixel row. Corresponds to \c GL_UNPACK_ALIGNMENT.
- * The default value is 4, as specified by OpenGL.
- */
-void QOpenGLPixelTransferOptions::setAlignment(int alignment)
-{
- data->alignment = alignment;
-}
-
-/*!
- * \return the current alignment requirement for each pixel row.
- */
-int QOpenGLPixelTransferOptions::alignment() const
-{
- return data->alignment;
-}
-
-/*!
- * Sets the number of images that are skipped to \a skipImages.
- * Corresponds to \c GL_UNPACK_SKIP_IMAGES. Equivalent to incrementing the pointer
- * passed to QOpenGLTexture::setData(). The default value is 0.
- */
-void QOpenGLPixelTransferOptions::setSkipImages(int skipImages)
-{
- data->skipImages = skipImages;
-}
-
-/*!
- * \return the number of images that are skipped.
- */
-int QOpenGLPixelTransferOptions::skipImages() const
-{
- return data->skipImages;
-}
-
-/*!
- * Sets the number of rows that are skipped to \a skipRows.
- * Corresponds to \c GL_UNPACK_SKIP_ROWS. Equivalent to incrementing the pointer
- * passed to QOpenGLTexture::setData(). The default value is 0.
- */
-void QOpenGLPixelTransferOptions::setSkipRows(int skipRows)
-{
- data->skipRows = skipRows;
-}
-
-/*!
- * \return the number of rows that are skipped.
- */
-int QOpenGLPixelTransferOptions::skipRows() const
-{
- return data->skipRows;
-}
-
-/*!
- * Sets the number of pixels that are skipped to \a skipPixels.
- * Corresponds to \c GL_UNPACK_SKIP_PIXELS. Equivalent to incrementing the pointer
- * passed to QOpenGLTexture::setData(). The default value is 0.
- */
-void QOpenGLPixelTransferOptions::setSkipPixels(int skipPixels)
-{
- data->skipPixels = skipPixels;
-}
-
-/*!
- * \return the number of pixels that are skipped.
- */
-int QOpenGLPixelTransferOptions::skipPixels() const
-{
- return data->skipPixels;
-}
-
-/*!
- * Sets the image height for 3D textures to \a imageHeight.
- * Corresponds to \c GL_UNPACK_IMAGE_HEIGHT.
- * The default value is 0.
- */
-void QOpenGLPixelTransferOptions::setImageHeight(int imageHeight)
-{
- data->imageHeight = imageHeight;
-}
-
-/*!
- * \return the currently set image height.
- */
-int QOpenGLPixelTransferOptions::imageHeight() const
-{
- return data->imageHeight;
-}
-
-/*!
- * Sets the number of pixels in a row to \a rowLength.
- * Corresponds to \c GL_UNPACK_ROW_LENGTH.
- * The default value is 0.
- */
-void QOpenGLPixelTransferOptions::setRowLength(int rowLength)
-{
- data->rowLength = rowLength;
-}
-
-/*!
- * \return the currently set row length.
- */
-int QOpenGLPixelTransferOptions::rowLength() const
-{
- return data->rowLength;
-}
-
-/*!
- * \a lsbFirst specifies if bits within a byte are ordered from least to most significat.
- * The default value is \c false, meaning that the first bit in each byte is the
- * most significant one. This is significant for bitmap data only.
- * Corresponds to \c GL_UNPACK_LSB_FIRST.
- */
-void QOpenGLPixelTransferOptions::setLeastSignificantByteFirst(bool lsbFirst)
-{
- data->lsbFirst = lsbFirst;
-}
-
-/*!
- * \return \c true if bits within a byte are ordered from least to most significant.
- */
-bool QOpenGLPixelTransferOptions::isLeastSignificantBitFirst() const
-{
- return data->lsbFirst;
-}
-
-/*!
- * \a swapBytes specifies if the byte ordering for multibyte components is reversed.
- * The default value is \c false.
- * Corresponds to \c GL_UNPACK_SWAP_BYTES.
- */
-void QOpenGLPixelTransferOptions::setSwapBytesEnabled(bool swapBytes)
-{
- data->swapBytes = swapBytes;
-}
-
-/*!
- * \return \c true if the byte ordering for multibyte components is reversed.
- */
-bool QOpenGLPixelTransferOptions::isSwapBytesEnabled() const
-{
- return data->swapBytes;
-}
-
-QT_END_NAMESPACE
diff --git a/src/gui/opengl/qopenglpixeltransferoptions.h b/src/gui/opengl/qopenglpixeltransferoptions.h
deleted file mode 100644
index 195543ae90..0000000000
--- a/src/gui/opengl/qopenglpixeltransferoptions.h
+++ /dev/null
@@ -1,100 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2013 Klaralvdalens Datakonsult AB (KDAB).
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the QtGui module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef QOPENGLPIXELUPLOADOPTIONS_H
-#define QOPENGLPIXELUPLOADOPTIONS_H
-
-#include <QtGui/qtguiglobal.h>
-
-#if !defined(QT_NO_OPENGL)
-
-#include <QtCore/QSharedDataPointer>
-
-QT_BEGIN_NAMESPACE
-
-class QOpenGLPixelTransferOptionsData;
-
-class Q_GUI_EXPORT QOpenGLPixelTransferOptions
-{
-public:
- QOpenGLPixelTransferOptions();
- QOpenGLPixelTransferOptions(const QOpenGLPixelTransferOptions &);
- QOpenGLPixelTransferOptions &operator=(QOpenGLPixelTransferOptions &&other) noexcept
- { swap(other); return *this; }
- QOpenGLPixelTransferOptions &operator=(const QOpenGLPixelTransferOptions &);
- ~QOpenGLPixelTransferOptions();
-
- void swap(QOpenGLPixelTransferOptions &other) noexcept
- { data.swap(other.data); }
-
- void setAlignment(int alignment);
- int alignment() const;
-
- void setSkipImages(int skipImages);
- int skipImages() const;
-
- void setSkipRows(int skipRows);
- int skipRows() const;
-
- void setSkipPixels(int skipPixels);
- int skipPixels() const;
-
- void setImageHeight(int imageHeight);
- int imageHeight() const;
-
- void setRowLength(int rowLength);
- int rowLength() const;
-
- void setLeastSignificantByteFirst(bool lsbFirst);
- bool isLeastSignificantBitFirst() const;
-
- void setSwapBytesEnabled(bool swapBytes);
- bool isSwapBytesEnabled() const;
-
-private:
- QSharedDataPointer<QOpenGLPixelTransferOptionsData> data;
-};
-
-Q_DECLARE_SHARED(QOpenGLPixelTransferOptions)
-
-QT_END_NAMESPACE
-
-#endif // QT_NO_OPENGL
-
-#endif // QOPENGLPIXELUPLOADOPTIONS_H
diff --git a/src/gui/opengl/qopenglprogrambinarycache.cpp b/src/gui/opengl/qopenglprogrambinarycache.cpp
index 72bdacf43f..28b09b553a 100644
--- a/src/gui/opengl/qopenglprogrambinarycache.cpp
+++ b/src/gui/opengl/qopenglprogrambinarycache.cpp
@@ -1,41 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the QtGui module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#include "qopenglprogrambinarycache_p.h"
#include <QOpenGLContext>
@@ -45,7 +9,6 @@
#include <QDir>
#include <QSaveFile>
#include <QCoreApplication>
-#include <QLoggingCategory>
#include <QCryptographicHash>
#ifdef Q_OS_UNIX
@@ -55,6 +18,8 @@
QT_BEGIN_NAMESPACE
+using namespace Qt::StringLiterals;
+
Q_LOGGING_CATEGORY(lcOpenGLProgramDiskCache, "qt.opengl.diskcache")
#ifndef GL_CONTEXT_LOST
@@ -118,22 +83,26 @@ static inline bool qt_ensureWritableDir(const QString &name)
QOpenGLProgramBinaryCache::QOpenGLProgramBinaryCache()
: m_cacheWritable(false)
{
- const QString subPath = QLatin1String("/qtshadercache-") + QSysInfo::buildAbi() + QLatin1Char('/');
+ const QString subPath = "/qtshadercache-"_L1 + QSysInfo::buildAbi() + u'/';
const QString sharedCachePath = QStandardPaths::writableLocation(QStandardPaths::GenericCacheLocation);
+ m_globalCacheDir = sharedCachePath + subPath;
+ m_localCacheDir = QStandardPaths::writableLocation(QStandardPaths::CacheLocation) + subPath;
+
if (!sharedCachePath.isEmpty()) {
- m_cacheDir = sharedCachePath + subPath;
- m_cacheWritable = qt_ensureWritableDir(m_cacheDir);
+ m_currentCacheDir = m_globalCacheDir;
+ m_cacheWritable = qt_ensureWritableDir(m_currentCacheDir);
}
if (!m_cacheWritable) {
- m_cacheDir = QStandardPaths::writableLocation(QStandardPaths::CacheLocation) + subPath;
- m_cacheWritable = qt_ensureWritableDir(m_cacheDir);
+ m_currentCacheDir = m_localCacheDir;
+ m_cacheWritable = qt_ensureWritableDir(m_currentCacheDir);
}
- qCDebug(lcOpenGLProgramDiskCache, "Cache location '%s' writable = %d", qPrintable(m_cacheDir), m_cacheWritable);
+
+ qCDebug(lcOpenGLProgramDiskCache, "Cache location '%s' writable = %d", qPrintable(m_currentCacheDir), m_cacheWritable);
}
QString QOpenGLProgramBinaryCache::cacheFileName(const QByteArray &cacheKey) const
{
- return m_cacheDir + QString::fromUtf8(cacheKey);
+ return m_currentCacheDir + QString::fromUtf8(cacheKey);
}
#define BASE_HEADER_SIZE (int(4 * sizeof(quint32)))
@@ -191,7 +160,7 @@ bool QOpenGLProgramBinaryCache::setProgramBinary(uint programId, uint blobFormat
if (error == GL_NO_ERROR || error == GL_CONTEXT_LOST)
break;
}
-#if defined(QT_OPENGL_ES_2)
+#if QT_CONFIG(opengles2)
if (context->isOpenGLES() && context->format().majorVersion() < 3) {
initializeProgramBinaryOES(context);
programBinaryOES(programId, blobFormat, p, blobSize);
@@ -362,6 +331,25 @@ static inline void writeStr(uchar **p, const QByteArray &str)
*p += str.size();
}
+static inline bool writeFile(const QString &filename, const QByteArray &data)
+{
+#if QT_CONFIG(temporaryfile)
+ QSaveFile f(filename);
+ if (f.open(QIODevice::WriteOnly | QIODevice::Truncate)) {
+ f.write(data);
+ if (f.commit())
+ return true;
+ }
+#else
+ QFile f(filename);
+ if (f.open(QIODevice::WriteOnly | QIODevice::Truncate)) {
+ if (f.write(data) == data.length())
+ return true;
+ }
+#endif
+ return false;
+}
+
void QOpenGLProgramBinaryCache::save(const QByteArray &cacheKey, uint programId)
{
if (!m_cacheWritable)
@@ -413,7 +401,7 @@ void QOpenGLProgramBinaryCache::save(const QByteArray &cacheKey, uint programId)
*p++ = 0;
GLint outSize = 0;
-#if defined(QT_OPENGL_ES_2)
+#if QT_CONFIG(opengles2)
if (context->isOpenGLES() && context->format().majorVersion() < 3) {
QMutexLocker lock(&m_mutex);
initializeProgramBinaryOES(context);
@@ -428,23 +416,23 @@ void QOpenGLProgramBinaryCache::save(const QByteArray &cacheKey, uint programId)
writeUInt(&blobFormatPtr, blobFormat);
-#if QT_CONFIG(temporaryfile)
- QSaveFile f(cacheFileName(cacheKey));
- if (f.open(QIODevice::WriteOnly | QIODevice::Truncate)) {
- f.write(blob);
- if (!f.commit())
-#else
- QFile f(cacheFileName(cacheKey));
- if (f.open(QIODevice::WriteOnly | QIODevice::Truncate)) {
- if (f.write(blob) < blob.length())
-#endif
- qCDebug(lcOpenGLProgramDiskCache, "Failed to write %s to shader cache", qPrintable(f.fileName()));
- } else {
- qCDebug(lcOpenGLProgramDiskCache, "Failed to create %s in shader cache", qPrintable(f.fileName()));
+ QString filename = cacheFileName(cacheKey);
+ bool ok = writeFile(filename, blob);
+ if (!ok && m_currentCacheDir == m_globalCacheDir) {
+ m_currentCacheDir = m_localCacheDir;
+ m_cacheWritable = qt_ensureWritableDir(m_currentCacheDir);
+ qCDebug(lcOpenGLProgramDiskCache, "Cache location changed to '%s' writable = %d",
+ qPrintable(m_currentCacheDir), m_cacheWritable);
+ if (m_cacheWritable) {
+ filename = cacheFileName(cacheKey);
+ ok = writeFile(filename, blob);
+ }
}
+ if (!ok)
+ qCDebug(lcOpenGLProgramDiskCache, "Failed to write %s to shader cache", qPrintable(filename));
}
-#if defined(QT_OPENGL_ES_2)
+#if QT_CONFIG(opengles2)
void QOpenGLProgramBinaryCache::initializeProgramBinaryOES(QOpenGLContext *context)
{
if (m_programBinaryOESInitialized)
diff --git a/src/gui/opengl/qopenglprogrambinarycache_p.h b/src/gui/opengl/qopenglprogrambinarycache_p.h
index f1cf24cd87..c3850bdee3 100644
--- a/src/gui/opengl/qopenglprogrambinarycache_p.h
+++ b/src/gui/opengl/qopenglprogrambinarycache_p.h
@@ -1,41 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the QtGui module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#ifndef QOPENGLPROGRAMBINARYCACHE_P_H
#define QOPENGLPROGRAMBINARYCACHE_P_H
@@ -54,8 +18,9 @@
#include <QtGui/qtguiglobal.h>
#include <QtCore/qcache.h>
#include <QtCore/qmutex.h>
+#include <QtCore/QLoggingCategory>
#include <QtGui/private/qopenglcontext_p.h>
-#include <QtGui/private/qshader_p.h>
+#include <rhi/qshader.h>
QT_BEGIN_NAMESPACE
@@ -63,10 +28,12 @@ QT_BEGIN_NAMESPACE
// therefore stay independent from QOpenGLShader(Program). Must rely only on
// QOpenGLContext/Functions.
-class QOpenGLProgramBinaryCache
+Q_DECLARE_EXPORTED_LOGGING_CATEGORY(lcOpenGLProgramDiskCache, Q_GUI_EXPORT)
+
+class Q_GUI_EXPORT QOpenGLProgramBinaryCache
{
public:
- struct ShaderDesc {
+ struct Q_GUI_EXPORT ShaderDesc {
ShaderDesc() { }
ShaderDesc(QShader::Stage stage, const QByteArray &source = QByteArray())
: stage(stage), source(source)
@@ -74,8 +41,8 @@ public:
QShader::Stage stage;
QByteArray source;
};
- struct ProgramDesc {
- QVector<ShaderDesc> shaders;
+ struct Q_GUI_EXPORT ProgramDesc {
+ QList<ShaderDesc> shaders;
QByteArray cacheKey() const;
};
@@ -89,7 +56,9 @@ private:
bool verifyHeader(const QByteArray &buf) const;
bool setProgramBinary(uint programId, uint blobFormat, const void *p, uint blobSize);
- QString m_cacheDir;
+ QString m_globalCacheDir;
+ QString m_localCacheDir;
+ QString m_currentCacheDir;
bool m_cacheWritable;
struct MemCacheEntry {
MemCacheEntry(const void *p, int size, uint format)
@@ -100,7 +69,7 @@ private:
uint format;
};
QCache<QByteArray, MemCacheEntry> m_memCache;
-#if defined(QT_OPENGL_ES_2)
+#if QT_CONFIG(opengles2)
void (QOPENGLF_APIENTRYP programBinaryOES)(GLuint program, GLenum binaryFormat, const GLvoid *binary, GLsizei length);
void (QOPENGLF_APIENTRYP getProgramBinaryOES)(GLuint program, GLsizei bufSize, GLsizei *length, GLenum *binaryFormat, GLvoid *binary);
void initializeProgramBinaryOES(QOpenGLContext *context);
@@ -114,7 +83,7 @@ private:
// per-context basis, not just once per process. QOpenGLSharedResource enables this,
// although it's once-per-sharing-context-group, not per-context. Still, this should
// be good enough in practice.
-class QOpenGLProgramBinarySupportCheck : public QOpenGLSharedResource
+class Q_GUI_EXPORT QOpenGLProgramBinarySupportCheck : public QOpenGLSharedResource
{
public:
QOpenGLProgramBinarySupportCheck(QOpenGLContext *context);
diff --git a/src/gui/opengl/qopenglshadercache_p.h b/src/gui/opengl/qopenglshadercache_p.h
deleted file mode 100644
index 0f730602b0..0000000000
--- a/src/gui/opengl/qopenglshadercache_p.h
+++ /dev/null
@@ -1,86 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the QtGui module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-//
-// W A R N I N G
-// -------------
-//
-// This file is not part of the Qt API. It exists purely as an
-// implementation detail. This header file may change from version to
-// version without notice, or even be removed.
-//
-// We mean it.
-//
-
-#ifndef QOPENGLSHADERCACHE_P_H
-#define QOPENGLSHADERCACHE_P_H
-
-#include <QtGui/private/qtguiglobal_p.h>
-
-QT_BEGIN_NAMESPACE
-
-
-class QOpenGLShaderProgram;
-class QOpenGLContext;
-
-class CachedShader
-{
-public:
- inline CachedShader(const QByteArray &, const QByteArray &)
- {}
-
- inline bool isCached()
- {
- return false;
- }
-
- inline bool load(QOpenGLShaderProgram *, QOpenGLContext *)
- {
- return false;
- }
-
- inline bool store(QOpenGLShaderProgram *, QOpenGLContext *)
- {
- return false;
- }
-};
-
-QT_END_NAMESPACE
-
-#endif
diff --git a/src/gui/opengl/qopenglshaderprogram.cpp b/src/gui/opengl/qopenglshaderprogram.cpp
deleted file mode 100644
index 7e89d9c8d4..0000000000
--- a/src/gui/opengl/qopenglshaderprogram.cpp
+++ /dev/null
@@ -1,3812 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the QtGui module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "qopenglshaderprogram.h"
-#include "qopenglprogrambinarycache_p.h"
-#include "qopenglextrafunctions.h"
-#include "private/qopenglcontext_p.h"
-#include <QtCore/private/qobject_p.h>
-#include <QtCore/qdebug.h>
-#include <QtCore/qfile.h>
-#include <QtCore/qvarlengtharray.h>
-#include <QtCore/qvector.h>
-#include <QtCore/qloggingcategory.h>
-#include <QtGui/qtransform.h>
-#include <QtGui/QColor>
-#include <QtGui/QSurfaceFormat>
-
-#if !defined(QT_OPENGL_ES_2)
-#include <QtGui/qopenglfunctions_4_0_core.h>
-#endif
-
-#include <algorithm>
-
-QT_BEGIN_NAMESPACE
-
-/*!
- \class QOpenGLShaderProgram
- \brief The QOpenGLShaderProgram class allows OpenGL shader programs to be linked and used.
- \since 5.0
- \ingroup painting-3D
- \inmodule QtGui
-
- \section1 Introduction
-
- This class supports shader programs written in the OpenGL Shading
- Language (GLSL) and in the OpenGL/ES Shading Language (GLSL/ES).
-
- QOpenGLShader and QOpenGLShaderProgram shelter the programmer from the details of
- compiling and linking vertex and fragment shaders.
-
- The following example creates a vertex shader program using the
- supplied source \c{code}. Once compiled and linked, the shader
- program is activated in the current QOpenGLContext by calling
- QOpenGLShaderProgram::bind():
-
- \snippet code/src_gui_qopenglshaderprogram.cpp 0
-
- \section1 Writing Portable Shaders
-
- Shader programs can be difficult to reuse across OpenGL implementations
- because of varying levels of support for standard vertex attributes and
- uniform variables. In particular, GLSL/ES lacks all of the
- standard variables that are present on desktop OpenGL systems:
- \c{gl_Vertex}, \c{gl_Normal}, \c{gl_Color}, and so on. Desktop OpenGL
- lacks the variable qualifiers \c{highp}, \c{mediump}, and \c{lowp}.
-
- The QOpenGLShaderProgram class makes the process of writing portable shaders
- easier by prefixing all shader programs with the following lines on
- desktop OpenGL:
-
- \code
- #define highp
- #define mediump
- #define lowp
- \endcode
-
- This makes it possible to run most GLSL/ES shader programs
- on desktop systems. The programmer should restrict themselves
- to just features that are present in GLSL/ES, and avoid
- standard variable names that only work on the desktop.
-
- \section1 Simple Shader Example
-
- \snippet code/src_gui_qopenglshaderprogram.cpp 1
-
- With the above shader program active, we can draw a green triangle
- as follows:
-
- \snippet code/src_gui_qopenglshaderprogram.cpp 2
-
- \section1 Binary Shaders and Programs
-
- Binary shaders may be specified using \c{glShaderBinary()} on
- the return value from QOpenGLShader::shaderId(). The QOpenGLShader instance
- containing the binary can then be added to the shader program with
- addShader() and linked in the usual fashion with link().
-
- Binary programs may be specified using \c{glProgramBinaryOES()}
- on the return value from programId(). Then the application should
- call link(), which will notice that the program has already been
- specified and linked, allowing other operations to be performed
- on the shader program. The shader program's id can be explicitly
- created using the create() function.
-
- \section2 Caching Program Binaries
-
- As of Qt 5.9, support for caching program binaries on disk is built in. To
- enable this, switch to using addCacheableShaderFromSourceCode() and
- addCacheableShaderFromSourceFile(). With an OpenGL ES 3.x context or support
- for \c{GL_ARB_get_program_binary}, this will transparently cache program
- binaries under QStandardPaths::GenericCacheLocation or
- QStandardPaths::CacheLocation. When support is not available, calling the
- cacheable function variants is equivalent to the normal ones.
-
- \note Some drivers do not have any binary formats available, even though
- they advertise the extension or offer OpenGL ES 3.0. In this case program
- binary support will be disabled.
-
- \sa QOpenGLShader
-*/
-
-/*!
- \class QOpenGLShader
- \brief The QOpenGLShader class allows OpenGL shaders to be compiled.
- \since 5.0
- \ingroup painting-3D
- \inmodule QtGui
-
- This class supports shaders written in the OpenGL Shading Language (GLSL)
- and in the OpenGL/ES Shading Language (GLSL/ES).
-
- QOpenGLShader and QOpenGLShaderProgram shelter the programmer from the details of
- compiling and linking vertex and fragment shaders.
-
- \sa QOpenGLShaderProgram
-*/
-
-/*!
- \enum QOpenGLShader::ShaderTypeBit
- This enum specifies the type of QOpenGLShader that is being created.
-
- \value Vertex Vertex shader written in the OpenGL Shading Language (GLSL).
- \value Fragment Fragment shader written in the OpenGL Shading Language (GLSL).
- \value Geometry Geometry shaders written in the OpenGL Shading Language (GLSL)
- (requires OpenGL >= 3.2 or OpenGL ES >= 3.2).
- \value TessellationControl Tessellation control shaders written in the OpenGL
- shading language (GLSL) (requires OpenGL >= 4.0 or OpenGL ES >= 3.2).
- \value TessellationEvaluation Tessellation evaluation shaders written in the OpenGL
- shading language (GLSL) (requires OpenGL >= 4.0 or OpenGL ES >= 3.2).
- \value Compute Compute shaders written in the OpenGL shading language (GLSL)
- (requires OpenGL >= 4.3 or OpenGL ES >= 3.1).
-*/
-
-Q_DECLARE_LOGGING_CATEGORY(lcOpenGLProgramDiskCache)
-
-// For GLES 3.1/3.2
-#ifndef GL_GEOMETRY_SHADER
-#define GL_GEOMETRY_SHADER 0x8DD9
-#endif
-#ifndef GL_TESS_CONTROL_SHADER
-#define GL_TESS_CONTROL_SHADER 0x8E88
-#endif
-#ifndef GL_TESS_EVALUATION_SHADER
-#define GL_TESS_EVALUATION_SHADER 0x8E87
-#endif
-#ifndef GL_COMPUTE_SHADER
-#define GL_COMPUTE_SHADER 0x91B9
-#endif
-#ifndef GL_MAX_GEOMETRY_OUTPUT_VERTICES
-#define GL_MAX_GEOMETRY_OUTPUT_VERTICES 0x8DE0
-#endif
-#ifndef GL_MAX_GEOMETRY_TOTAL_OUTPUT_COMPONENTS
-#define GL_MAX_GEOMETRY_TOTAL_OUTPUT_COMPONENTS 0x8DE1
-#endif
-#ifndef GL_PATCH_VERTICES
-#define GL_PATCH_VERTICES 0x8E72
-#endif
-#ifndef GL_PATCH_DEFAULT_OUTER_LEVEL
-#define GL_PATCH_DEFAULT_OUTER_LEVEL 0x8E74
-#endif
-#ifndef GL_PATCH_DEFAULT_INNER_LEVEL
-#define GL_PATCH_DEFAULT_INNER_LEVEL 0x8E73
-#endif
-
-#ifndef QT_OPENGL_ES_2
-static inline bool isFormatGLES(const QSurfaceFormat &f)
-{
- return (f.renderableType() == QSurfaceFormat::OpenGLES);
-}
-#endif
-
-static inline bool supportsGeometry(const QSurfaceFormat &f)
-{
- return f.version() >= qMakePair(3, 2);
-}
-
-static inline bool supportsCompute(const QSurfaceFormat &f)
-{
-#ifndef QT_OPENGL_ES_2
- if (!isFormatGLES(f))
- return f.version() >= qMakePair(4, 3);
- else
- return f.version() >= qMakePair(3, 1);
-#else
- return f.version() >= qMakePair(3, 1);
-#endif
-}
-
-static inline bool supportsTessellation(const QSurfaceFormat &f)
-{
-#ifndef QT_OPENGL_ES_2
- if (!isFormatGLES(f))
- return f.version() >= qMakePair(4, 0);
- else
- return f.version() >= qMakePair(3, 2);
-#else
- return f.version() >= qMakePair(3, 2);
-#endif
-}
-
-class QOpenGLShaderPrivate : public QObjectPrivate
-{
- Q_DECLARE_PUBLIC(QOpenGLShader)
-public:
- QOpenGLShaderPrivate(QOpenGLContext *ctx, QOpenGLShader::ShaderType type)
- : shaderGuard(nullptr)
- , shaderType(type)
- , compiled(false)
- , glfuncs(new QOpenGLExtraFunctions(ctx))
- , supportsGeometryShaders(false)
- , supportsTessellationShaders(false)
- , supportsComputeShaders(false)
- {
- if (shaderType & QOpenGLShader::Geometry)
- supportsGeometryShaders = supportsGeometry(ctx->format());
- else if (shaderType & (QOpenGLShader::TessellationControl | QOpenGLShader::TessellationEvaluation))
- supportsTessellationShaders = supportsTessellation(ctx->format());
- else if (shaderType & QOpenGLShader::Compute)
- supportsComputeShaders = supportsCompute(ctx->format());
- }
- ~QOpenGLShaderPrivate();
-
- QOpenGLSharedResourceGuard *shaderGuard;
- QOpenGLShader::ShaderType shaderType;
- bool compiled;
- QString log;
-
- QOpenGLExtraFunctions *glfuncs;
-
- // Support for geometry shaders
- bool supportsGeometryShaders;
- // Support for tessellation shaders
- bool supportsTessellationShaders;
- // Support for compute shaders
- bool supportsComputeShaders;
-
-
- bool create();
- bool compile(QOpenGLShader *q);
- void deleteShader();
-};
-
-namespace {
- void freeShaderFunc(QOpenGLFunctions *funcs, GLuint id)
- {
- funcs->glDeleteShader(id);
- }
-}
-
-QOpenGLShaderPrivate::~QOpenGLShaderPrivate()
-{
- delete glfuncs;
- if (shaderGuard)
- shaderGuard->free();
-}
-
-bool QOpenGLShaderPrivate::create()
-{
- QOpenGLContext *context = const_cast<QOpenGLContext *>(QOpenGLContext::currentContext());
- if (!context)
- return false;
- GLuint shader = 0;
- if (shaderType == QOpenGLShader::Vertex) {
- shader = glfuncs->glCreateShader(GL_VERTEX_SHADER);
- } else if (shaderType == QOpenGLShader::Geometry && supportsGeometryShaders) {
- shader = glfuncs->glCreateShader(GL_GEOMETRY_SHADER);
- } else if (shaderType == QOpenGLShader::TessellationControl && supportsTessellationShaders) {
- shader = glfuncs->glCreateShader(GL_TESS_CONTROL_SHADER);
- } else if (shaderType == QOpenGLShader::TessellationEvaluation && supportsTessellationShaders) {
- shader = glfuncs->glCreateShader(GL_TESS_EVALUATION_SHADER);
- } else if (shaderType == QOpenGLShader::Compute && supportsComputeShaders) {
- shader = glfuncs->glCreateShader(GL_COMPUTE_SHADER);
- } else if (shaderType == QOpenGLShader::Fragment) {
- shader = glfuncs->glCreateShader(GL_FRAGMENT_SHADER);
- }
- if (!shader) {
- qWarning("QOpenGLShader: could not create shader");
- return false;
- }
- shaderGuard = new QOpenGLSharedResourceGuard(context, shader, freeShaderFunc);
- return true;
-}
-
-bool QOpenGLShaderPrivate::compile(QOpenGLShader *q)
-{
- GLuint shader = shaderGuard ? shaderGuard->id() : 0;
- if (!shader)
- return false;
-
- // Try to compile shader
- glfuncs->glCompileShader(shader);
- GLint value = 0;
-
- // Get compilation status
- glfuncs->glGetShaderiv(shader, GL_COMPILE_STATUS, &value);
- compiled = (value != 0);
-
- if (!compiled) {
- // Compilation failed, try to provide some information about the failure
- QString name = q->objectName();
-
- const char *types[] = {
- "Fragment",
- "Vertex",
- "Geometry",
- "Tessellation Control",
- "Tessellation Evaluation",
- "Compute",
- ""
- };
-
- const char *type = types[6];
- switch (shaderType) {
- case QOpenGLShader::Fragment:
- type = types[0]; break;
- case QOpenGLShader::Vertex:
- type = types[1]; break;
- case QOpenGLShader::Geometry:
- type = types[2]; break;
- case QOpenGLShader::TessellationControl:
- type = types[3]; break;
- case QOpenGLShader::TessellationEvaluation:
- type = types[4]; break;
- case QOpenGLShader::Compute:
- type = types[5]; break;
- }
-
- // Get info and source code lengths
- GLint infoLogLength = 0;
- GLint sourceCodeLength = 0;
- char *logBuffer = nullptr;
- char *sourceCodeBuffer = nullptr;
-
- // Get the compilation info log
- glfuncs->glGetShaderiv(shader, GL_INFO_LOG_LENGTH, &infoLogLength);
-
- if (infoLogLength > 1) {
- GLint temp;
- logBuffer = new char [infoLogLength];
- glfuncs->glGetShaderInfoLog(shader, infoLogLength, &temp, logBuffer);
- }
-
- // Get the source code
- glfuncs->glGetShaderiv(shader, GL_SHADER_SOURCE_LENGTH, &sourceCodeLength);
-
- if (sourceCodeLength > 1) {
- GLint temp;
- sourceCodeBuffer = new char [sourceCodeLength];
- glfuncs->glGetShaderSource(shader, sourceCodeLength, &temp, sourceCodeBuffer);
- }
-
- if (logBuffer)
- log = QString::fromLatin1(logBuffer);
- else
- log = QLatin1String("failed");
-
- if (name.isEmpty())
- qWarning("QOpenGLShader::compile(%s): %s", type, qPrintable(log));
- else
- qWarning("QOpenGLShader::compile(%s)[%s]: %s", type, qPrintable(name), qPrintable(log));
-
- // Dump the source code if we got it
- if (sourceCodeBuffer) {
- qWarning("*** Problematic %s shader source code ***\n"
- "%ls\n"
- "***",
- type, qUtf16Printable(QString::fromLatin1(sourceCodeBuffer)));
- }
-
- // Cleanup
- delete [] logBuffer;
- delete [] sourceCodeBuffer;
- }
-
- return compiled;
-}
-
-void QOpenGLShaderPrivate::deleteShader()
-{
- if (shaderGuard) {
- shaderGuard->free();
- shaderGuard = nullptr;
- }
-}
-
-/*!
- Constructs a new QOpenGLShader object of the specified \a type
- and attaches it to \a parent. If shader programs are not supported,
- QOpenGLShaderProgram::hasOpenGLShaderPrograms() will return false.
-
- This constructor is normally followed by a call to compileSourceCode()
- or compileSourceFile().
-
- The shader will be associated with the current QOpenGLContext.
-
- \sa compileSourceCode(), compileSourceFile()
-*/
-QOpenGLShader::QOpenGLShader(QOpenGLShader::ShaderType type, QObject *parent)
- : QObject(*new QOpenGLShaderPrivate(QOpenGLContext::currentContext(), type), parent)
-{
- Q_D(QOpenGLShader);
- d->create();
-}
-
-/*!
- Deletes this shader. If the shader has been attached to a
- QOpenGLShaderProgram object, then the actual shader will stay around
- until the QOpenGLShaderProgram is destroyed.
-*/
-QOpenGLShader::~QOpenGLShader()
-{
-}
-
-/*!
- Returns the type of this shader.
-*/
-QOpenGLShader::ShaderType QOpenGLShader::shaderType() const
-{
- Q_D(const QOpenGLShader);
- return d->shaderType;
-}
-
-static const char qualifierDefines[] =
- "#define lowp\n"
- "#define mediump\n"
- "#define highp\n";
-
-#if defined(QT_OPENGL_ES) && !defined(QT_OPENGL_FORCE_SHADER_DEFINES)
-// The "highp" qualifier doesn't exist in fragment shaders
-// on all ES platforms. When it doesn't exist, use "mediump".
-#define QOpenGL_REDEFINE_HIGHP 1
-static const char redefineHighp[] =
- "#ifndef GL_FRAGMENT_PRECISION_HIGH\n"
- "#define highp mediump\n"
- "#endif\n";
-#endif
-
-// Boiler-plate header to have the layout attributes available we need later
-static const char blendEquationAdvancedHeader[] =
- "#ifdef GL_KHR_blend_equation_advanced\n"
- "#extension GL_ARB_fragment_coord_conventions : enable\n"
- "#extension GL_KHR_blend_equation_advanced : enable\n"
- "#endif\n";
-
-struct QVersionDirectivePosition
-{
- Q_DECL_CONSTEXPR QVersionDirectivePosition(int position = 0, int line = -1)
- : position(position)
- , line(line)
- {
- }
-
- Q_DECL_CONSTEXPR bool hasPosition() const
- {
- return position > 0;
- }
-
- const int position;
- const int line;
-};
-
-static QVersionDirectivePosition findVersionDirectivePosition(const char *source)
-{
- Q_ASSERT(source);
-
- // According to the GLSL spec the #version directive must not be
- // preceded by anything but whitespace and comments.
- // In order to not get confused by #version directives within a
- // multiline comment, we need to do some minimal comment parsing
- // while searching for the directive.
- enum {
- Normal,
- StartOfLine,
- PreprocessorDirective,
- CommentStarting,
- MultiLineComment,
- SingleLineComment,
- CommentEnding
- } state = StartOfLine;
-
- const char *c = source;
- while (*c) {
- switch (state) {
- case PreprocessorDirective:
- if (*c == ' ' || *c == '\t')
- break;
- if (!strncmp(c, "version", strlen("version"))) {
- // Found version directive
- c += strlen("version");
- while (*c && *c != '\n')
- ++c;
- int splitPosition = c - source + 1;
- int linePosition = int(std::count(source, c, '\n')) + 1;
- return QVersionDirectivePosition(splitPosition, linePosition);
- } else if (*c == '/')
- state = CommentStarting;
- else if (*c == '\n')
- state = StartOfLine;
- else
- state = Normal;
- break;
- case StartOfLine:
- if (*c == ' ' || *c == '\t')
- break;
- else if (*c == '#') {
- state = PreprocessorDirective;
- break;
- }
- state = Normal;
- Q_FALLTHROUGH();
- case Normal:
- if (*c == '/')
- state = CommentStarting;
- else if (*c == '\n')
- state = StartOfLine;
- break;
- case CommentStarting:
- if (*c == '*')
- state = MultiLineComment;
- else if (*c == '/')
- state = SingleLineComment;
- else
- state = Normal;
- break;
- case MultiLineComment:
- if (*c == '*')
- state = CommentEnding;
- break;
- case SingleLineComment:
- if (*c == '\n')
- state = Normal;
- break;
- case CommentEnding:
- if (*c == '/')
- state = Normal;
- else if (*c != QLatin1Char('*'))
- state = MultiLineComment;
- break;
- }
- ++c;
- }
-
- return QVersionDirectivePosition(0, 1);
-}
-
-/*!
- Sets the \a source code for this shader and compiles it.
- Returns \c true if the source was successfully compiled, false otherwise.
-
- \sa compileSourceFile()
-*/
-bool QOpenGLShader::compileSourceCode(const char *source)
-{
- Q_D(QOpenGLShader);
- // This method breaks the shader code into two parts:
- // 1. Up to and including an optional #version directive.
- // 2. The rest.
- // If a #version directive exists, qualifierDefines and redefineHighp
- // are inserted after. Otherwise they are inserted right at the start.
- // In both cases a #line directive is appended in order to compensate
- // for line number changes in case of compiler errors.
-
- if (d->shaderGuard && d->shaderGuard->id() && source) {
- const QVersionDirectivePosition versionDirectivePosition = findVersionDirectivePosition(source);
-
- QVarLengthArray<const char *, 5> sourceChunks;
- QVarLengthArray<GLint, 5> sourceChunkLengths;
- QOpenGLContext *ctx = QOpenGLContext::currentContext();
-
- if (versionDirectivePosition.hasPosition()) {
- // Append source up to and including the #version directive
- sourceChunks.append(source);
- sourceChunkLengths.append(GLint(versionDirectivePosition.position));
- } else {
- // QTBUG-55733: Intel on Windows with Compatibility profile requires a #version always
- if (ctx->format().profile() == QSurfaceFormat::CompatibilityProfile) {
- const char *vendor = reinterpret_cast<const char *>(ctx->functions()->glGetString(GL_VENDOR));
- if (vendor && !strcmp(vendor, "Intel")) {
- static const char version110[] = "#version 110\n";
- sourceChunks.append(version110);
- sourceChunkLengths.append(GLint(sizeof(version110)) - 1);
- }
- }
- }
- if (d->shaderType == Fragment) {
- sourceChunks.append(blendEquationAdvancedHeader);
- sourceChunkLengths.append(GLint(sizeof(blendEquationAdvancedHeader) - 1));
- }
-
- // The precision qualifiers are useful on OpenGL/ES systems,
- // but usually not present on desktop systems.
- const QSurfaceFormat currentSurfaceFormat = ctx->format();
- QOpenGLContextPrivate *ctx_d = QOpenGLContextPrivate::get(QOpenGLContext::currentContext());
- if (currentSurfaceFormat.renderableType() == QSurfaceFormat::OpenGL
- || ctx_d->workaround_missingPrecisionQualifiers
-#ifdef QT_OPENGL_FORCE_SHADER_DEFINES
- || true
-#endif
- ) {
- sourceChunks.append(qualifierDefines);
- sourceChunkLengths.append(GLint(sizeof(qualifierDefines) - 1));
- }
-
-#ifdef QOpenGL_REDEFINE_HIGHP
- if (d->shaderType == Fragment && !ctx_d->workaround_missingPrecisionQualifiers
- && QOpenGLContext::currentContext()->isOpenGLES()) {
- sourceChunks.append(redefineHighp);
- sourceChunkLengths.append(GLint(sizeof(redefineHighp) - 1));
- }
-#endif
-
- QByteArray lineDirective;
- // #line is rejected by some drivers:
- // "2.1 Mesa 8.1-devel (git-48a3d4e)" or "MESA 2.1 Mesa 8.1-devel"
- const char *version = reinterpret_cast<const char *>(ctx->functions()->glGetString(GL_VERSION));
- if (!version || !strstr(version, "2.1 Mesa 8")) {
- // Append #line directive in order to compensate for text insertion
- lineDirective = QStringLiteral("#line %1\n").arg(versionDirectivePosition.line).toUtf8();
- sourceChunks.append(lineDirective.constData());
- sourceChunkLengths.append(GLint(lineDirective.length()));
- }
-
- // Append rest of shader code
- sourceChunks.append(source + versionDirectivePosition.position);
- sourceChunkLengths.append(GLint(qstrlen(source + versionDirectivePosition.position)));
-
- d->glfuncs->glShaderSource(d->shaderGuard->id(), sourceChunks.size(), sourceChunks.data(), sourceChunkLengths.data());
- return d->compile(this);
- } else {
- return false;
- }
-}
-
-/*!
- \overload
-
- Sets the \a source code for this shader and compiles it.
- Returns \c true if the source was successfully compiled, false otherwise.
-
- \sa compileSourceFile()
-*/
-bool QOpenGLShader::compileSourceCode(const QByteArray& source)
-{
- return compileSourceCode(source.constData());
-}
-
-/*!
- \overload
-
- Sets the \a source code for this shader and compiles it.
- Returns \c true if the source was successfully compiled, false otherwise.
-
- \sa compileSourceFile()
-*/
-bool QOpenGLShader::compileSourceCode(const QString& source)
-{
- return compileSourceCode(source.toLatin1().constData());
-}
-
-/*!
- Sets the source code for this shader to the contents of \a fileName
- and compiles it. Returns \c true if the file could be opened and the
- source compiled, false otherwise.
-
- \sa compileSourceCode()
-*/
-bool QOpenGLShader::compileSourceFile(const QString& fileName)
-{
- QFile file(fileName);
- if (!file.open(QFile::ReadOnly)) {
- qWarning() << "QOpenGLShader: Unable to open file" << fileName;
- return false;
- }
-
- QByteArray contents = file.readAll();
- return compileSourceCode(contents.constData());
-}
-
-/*!
- Returns the source code for this shader.
-
- \sa compileSourceCode()
-*/
-QByteArray QOpenGLShader::sourceCode() const
-{
- Q_D(const QOpenGLShader);
- GLuint shader = d->shaderGuard ? d->shaderGuard->id() : 0;
- if (!shader)
- return QByteArray();
- GLint size = 0;
- d->glfuncs->glGetShaderiv(shader, GL_SHADER_SOURCE_LENGTH, &size);
- if (size <= 0)
- return QByteArray();
- GLint len = 0;
- char *source = new char [size];
- d->glfuncs->glGetShaderSource(shader, size, &len, source);
- QByteArray src(source);
- delete [] source;
- return src;
-}
-
-/*!
- Returns \c true if this shader has been compiled; false otherwise.
-
- \sa compileSourceCode(), compileSourceFile()
-*/
-bool QOpenGLShader::isCompiled() const
-{
- Q_D(const QOpenGLShader);
- return d->compiled;
-}
-
-/*!
- Returns the errors and warnings that occurred during the last compile.
-
- \sa compileSourceCode(), compileSourceFile()
-*/
-QString QOpenGLShader::log() const
-{
- Q_D(const QOpenGLShader);
- return d->log;
-}
-
-/*!
- Returns the OpenGL identifier associated with this shader.
-
- \sa QOpenGLShaderProgram::programId()
-*/
-GLuint QOpenGLShader::shaderId() const
-{
- Q_D(const QOpenGLShader);
- return d->shaderGuard ? d->shaderGuard->id() : 0;
-}
-
-class QOpenGLShaderProgramPrivate : public QObjectPrivate
-{
- Q_DECLARE_PUBLIC(QOpenGLShaderProgram)
-public:
- QOpenGLShaderProgramPrivate()
- : programGuard(nullptr)
- , linked(false)
- , inited(false)
- , removingShaders(false)
- , glfuncs(new QOpenGLExtraFunctions)
-#ifndef QT_OPENGL_ES_2
- , tessellationFuncs(nullptr)
-#endif
- , linkBinaryRecursion(false)
- {
- }
- ~QOpenGLShaderProgramPrivate();
-
- QOpenGLSharedResourceGuard *programGuard;
- bool linked;
- bool inited;
- bool removingShaders;
-
- QString log;
- QList<QOpenGLShader *> shaders;
- QList<QOpenGLShader *> anonShaders;
-
- QOpenGLExtraFunctions *glfuncs;
-#ifndef QT_OPENGL_ES_2
- // for tessellation features not in GLES 3.2
- QOpenGLFunctions_4_0_Core *tessellationFuncs;
-#endif
-
- bool hasShader(QOpenGLShader::ShaderType type) const;
-
- QOpenGLProgramBinaryCache::ProgramDesc binaryProgram;
- bool isCacheDisabled() const;
- bool compileCacheable();
- bool linkBinary();
-
- bool linkBinaryRecursion;
-};
-
-namespace {
- void freeProgramFunc(QOpenGLFunctions *funcs, GLuint id)
- {
- funcs->glDeleteProgram(id);
- }
-}
-
-
-QOpenGLShaderProgramPrivate::~QOpenGLShaderProgramPrivate()
-{
- delete glfuncs;
- if (programGuard)
- programGuard->free();
-}
-
-bool QOpenGLShaderProgramPrivate::hasShader(QOpenGLShader::ShaderType type) const
-{
- for (QOpenGLShader *shader : shaders) {
- if (shader->shaderType() == type)
- return true;
- }
- return false;
-}
-
-/*!
- Constructs a new shader program and attaches it to \a parent.
- The program will be invalid until addShader() is called.
-
- The shader program will be associated with the current QOpenGLContext.
-
- \sa addShader()
-*/
-QOpenGLShaderProgram::QOpenGLShaderProgram(QObject *parent)
- : QObject(*new QOpenGLShaderProgramPrivate, parent)
-{
-}
-
-/*!
- Deletes this shader program.
-*/
-QOpenGLShaderProgram::~QOpenGLShaderProgram()
-{
-}
-
-/*!
- Requests the shader program's id to be created immediately. Returns \c true
- if successful; \c false otherwise.
-
- This function is primarily useful when combining QOpenGLShaderProgram
- with other OpenGL functions that operate directly on the shader
- program id, like \c {GL_OES_get_program_binary}.
-
- When the shader program is used normally, the shader program's id will
- be created on demand.
-
- \sa programId()
-
- \since 5.3
- */
-bool QOpenGLShaderProgram::create()
-{
- return init();
-}
-
-bool QOpenGLShaderProgram::init()
-{
- Q_D(QOpenGLShaderProgram);
- if ((d->programGuard && d->programGuard->id()) || d->inited)
- return true;
- d->inited = true;
- QOpenGLContext *context = const_cast<QOpenGLContext *>(QOpenGLContext::currentContext());
- if (!context)
- return false;
- d->glfuncs->initializeOpenGLFunctions();
-
-#ifndef QT_OPENGL_ES_2
- if (!context->isOpenGLES() && context->format().version() >= qMakePair(4, 0)) {
- d->tessellationFuncs = context->versionFunctions<QOpenGLFunctions_4_0_Core>();
- d->tessellationFuncs->initializeOpenGLFunctions();
- }
-#endif
-
- GLuint program = d->glfuncs->glCreateProgram();
- if (!program) {
- qWarning("QOpenGLShaderProgram: could not create shader program");
- return false;
- }
- if (d->programGuard)
- delete d->programGuard;
- d->programGuard = new QOpenGLSharedResourceGuard(context, program, freeProgramFunc);
- return true;
-}
-
-/*!
- Adds a compiled \a shader to this shader program. Returns \c true
- if the shader could be added, or false otherwise.
-
- Ownership of the \a shader object remains with the caller.
- It will not be deleted when this QOpenGLShaderProgram instance
- is deleted. This allows the caller to add the same shader
- to multiple shader programs.
-
- \sa addShaderFromSourceCode(), addShaderFromSourceFile()
- \sa removeShader(), link(), removeAllShaders()
-*/
-bool QOpenGLShaderProgram::addShader(QOpenGLShader *shader)
-{
- Q_D(QOpenGLShaderProgram);
- if (!init())
- return false;
- if (d->shaders.contains(shader))
- return true; // Already added to this shader program.
- if (d->programGuard && d->programGuard->id() && shader) {
- if (!shader->d_func()->shaderGuard || !shader->d_func()->shaderGuard->id())
- return false;
- if (d->programGuard->group() != shader->d_func()->shaderGuard->group()) {
- qWarning("QOpenGLShaderProgram::addShader: Program and shader are not associated with same context.");
- return false;
- }
- d->glfuncs->glAttachShader(d->programGuard->id(), shader->d_func()->shaderGuard->id());
- d->linked = false; // Program needs to be relinked.
- d->shaders.append(shader);
- connect(shader, SIGNAL(destroyed()), this, SLOT(shaderDestroyed()));
- return true;
- } else {
- return false;
- }
-}
-
-/*!
- Compiles \a source as a shader of the specified \a type and
- adds it to this shader program. Returns \c true if compilation
- was successful, false otherwise. The compilation errors
- and warnings will be made available via log().
-
- This function is intended to be a short-cut for quickly
- adding vertex and fragment shaders to a shader program without
- creating an instance of QOpenGLShader first.
-
- \sa addShader(), addShaderFromSourceFile()
- \sa removeShader(), link(), log(), removeAllShaders()
-*/
-bool QOpenGLShaderProgram::addShaderFromSourceCode(QOpenGLShader::ShaderType type, const char *source)
-{
- Q_D(QOpenGLShaderProgram);
- if (!init())
- return false;
- QOpenGLShader *shader = new QOpenGLShader(type, this);
- if (!shader->compileSourceCode(source)) {
- d->log = shader->log();
- delete shader;
- return false;
- }
- d->anonShaders.append(shader);
- return addShader(shader);
-}
-
-/*!
- \overload
-
- Compiles \a source as a shader of the specified \a type and
- adds it to this shader program. Returns \c true if compilation
- was successful, false otherwise. The compilation errors
- and warnings will be made available via log().
-
- This function is intended to be a short-cut for quickly
- adding vertex and fragment shaders to a shader program without
- creating an instance of QOpenGLShader first.
-
- \sa addShader(), addShaderFromSourceFile()
- \sa removeShader(), link(), log(), removeAllShaders()
-*/
-bool QOpenGLShaderProgram::addShaderFromSourceCode(QOpenGLShader::ShaderType type, const QByteArray& source)
-{
- return addShaderFromSourceCode(type, source.constData());
-}
-
-/*!
- \overload
-
- Compiles \a source as a shader of the specified \a type and
- adds it to this shader program. Returns \c true if compilation
- was successful, false otherwise. The compilation errors
- and warnings will be made available via log().
-
- This function is intended to be a short-cut for quickly
- adding vertex and fragment shaders to a shader program without
- creating an instance of QOpenGLShader first.
-
- \sa addShader(), addShaderFromSourceFile()
- \sa removeShader(), link(), log(), removeAllShaders()
-*/
-bool QOpenGLShaderProgram::addShaderFromSourceCode(QOpenGLShader::ShaderType type, const QString& source)
-{
- return addShaderFromSourceCode(type, source.toLatin1().constData());
-}
-
-/*!
- Compiles the contents of \a fileName as a shader of the specified
- \a type and adds it to this shader program. Returns \c true if
- compilation was successful, false otherwise. The compilation errors
- and warnings will be made available via log().
-
- This function is intended to be a short-cut for quickly
- adding vertex and fragment shaders to a shader program without
- creating an instance of QOpenGLShader first.
-
- \sa addShader(), addShaderFromSourceCode()
-*/
-bool QOpenGLShaderProgram::addShaderFromSourceFile
- (QOpenGLShader::ShaderType type, const QString& fileName)
-{
- Q_D(QOpenGLShaderProgram);
- if (!init())
- return false;
- QOpenGLShader *shader = new QOpenGLShader(type, this);
- if (!shader->compileSourceFile(fileName)) {
- d->log = shader->log();
- delete shader;
- return false;
- }
- d->anonShaders.append(shader);
- return addShader(shader);
-}
-
-/*!
- Registers the shader of the specified \a type and \a source to this
- program. Unlike addShaderFromSourceCode(), this function does not perform
- compilation. Compilation is deferred to link(), and may not happen at all,
- because link() may potentially use a program binary from Qt's shader disk
- cache. This will typically lead to a significant increase in performance.
-
- \return true if the shader has been registered or, in the non-cached case,
- compiled successfully; false if there was an error. The compilation error
- messages can be retrieved via log().
-
- When the disk cache is disabled, via Qt::AA_DisableShaderDiskCache for
- example, or the OpenGL context has no support for context binaries, calling
- this function is equivalent to addShaderFromSourceCode().
-
- \since 5.9
- \sa addShaderFromSourceCode(), addCacheableShaderFromSourceFile()
- */
-bool QOpenGLShaderProgram::addCacheableShaderFromSourceCode(QOpenGLShader::ShaderType type, const char *source)
-{
- Q_D(QOpenGLShaderProgram);
- if (!init())
- return false;
- if (d->isCacheDisabled())
- return addShaderFromSourceCode(type, source);
-
- return addCacheableShaderFromSourceCode(type, QByteArray(source));
-}
-
-static inline QShader::Stage qt_shaderTypeToStage(QOpenGLShader::ShaderType type)
-{
- switch (type) {
- case QOpenGLShader::Vertex:
- return QShader::VertexStage;
- case QOpenGLShader::Fragment:
- return QShader::FragmentStage;
- case QOpenGLShader::Geometry:
- return QShader::GeometryStage;
- case QOpenGLShader::TessellationControl:
- return QShader::TessellationControlStage;
- case QOpenGLShader::TessellationEvaluation:
- return QShader::TessellationEvaluationStage;
- case QOpenGLShader::Compute:
- return QShader::ComputeStage;
- }
- return QShader::VertexStage;
-}
-
-static inline QOpenGLShader::ShaderType qt_shaderStageToType(QShader::Stage stage)
-{
- switch (stage) {
- case QShader::VertexStage:
- return QOpenGLShader::Vertex;
- case QShader::TessellationControlStage:
- return QOpenGLShader::TessellationControl;
- case QShader::TessellationEvaluationStage:
- return QOpenGLShader::TessellationEvaluation;
- case QShader::GeometryStage:
- return QOpenGLShader::Geometry;
- case QShader::FragmentStage:
- return QOpenGLShader::Fragment;
- case QShader::ComputeStage:
- return QOpenGLShader::Compute;
- }
- return QOpenGLShader::Vertex;
-}
-
-/*!
- \overload
-
- Registers the shader of the specified \a type and \a source to this
- program. Unlike addShaderFromSourceCode(), this function does not perform
- compilation. Compilation is deferred to link(), and may not happen at all,
- because link() may potentially use a program binary from Qt's shader disk
- cache. This will typically lead to a significant increase in performance.
-
- \return true if the shader has been registered or, in the non-cached case,
- compiled successfully; false if there was an error. The compilation error
- messages can be retrieved via log().
-
- When the disk cache is disabled, via Qt::AA_DisableShaderDiskCache for
- example, or the OpenGL context has no support for context binaries, calling
- this function is equivalent to addShaderFromSourceCode().
-
- \since 5.9
- \sa addShaderFromSourceCode(), addCacheableShaderFromSourceFile()
- */
-bool QOpenGLShaderProgram::addCacheableShaderFromSourceCode(QOpenGLShader::ShaderType type, const QByteArray &source)
-{
- Q_D(QOpenGLShaderProgram);
- if (!init())
- return false;
- if (d->isCacheDisabled())
- return addShaderFromSourceCode(type, source);
-
- d->binaryProgram.shaders.append(QOpenGLProgramBinaryCache::ShaderDesc(qt_shaderTypeToStage(type), source));
- return true;
-}
-
-/*!
- \overload
-
- Registers the shader of the specified \a type and \a source to this
- program. Unlike addShaderFromSourceCode(), this function does not perform
- compilation. Compilation is deferred to link(), and may not happen at all,
- because link() may potentially use a program binary from Qt's shader disk
- cache. This will typically lead to a significant increase in performance.
-
- When the disk cache is disabled, via Qt::AA_DisableShaderDiskCache for
- example, or the OpenGL context has no support for context binaries, calling
- this function is equivalent to addShaderFromSourceCode().
-
- \since 5.9
- \sa addShaderFromSourceCode(), addCacheableShaderFromSourceFile()
- */
-bool QOpenGLShaderProgram::addCacheableShaderFromSourceCode(QOpenGLShader::ShaderType type, const QString &source)
-{
- Q_D(QOpenGLShaderProgram);
- if (!init())
- return false;
- if (d->isCacheDisabled())
- return addShaderFromSourceCode(type, source);
-
- return addCacheableShaderFromSourceCode(type, source.toUtf8().constData());
-}
-
-/*!
- Registers the shader of the specified \a type and \a fileName to this
- program. Unlike addShaderFromSourceFile(), this function does not perform
- compilation. Compilation is deferred to link(), and may not happen at all,
- because link() may potentially use a program binary from Qt's shader disk
- cache. This will typically lead to a significant increase in performance.
-
- \return true if the file has been read successfully, false if the file could
- not be opened or the normal, non-cached compilation of the shader has
- failed. The compilation error messages can be retrieved via log().
-
- When the disk cache is disabled, via Qt::AA_DisableShaderDiskCache for
- example, or the OpenGL context has no support for context binaries, calling
- this function is equivalent to addShaderFromSourceFile().
-
- \since 5.9
- \sa addShaderFromSourceFile(), addCacheableShaderFromSourceCode()
- */
-bool QOpenGLShaderProgram::addCacheableShaderFromSourceFile(QOpenGLShader::ShaderType type, const QString &fileName)
-{
- Q_D(QOpenGLShaderProgram);
- if (!init())
- return false;
- if (d->isCacheDisabled())
- return addShaderFromSourceFile(type, fileName);
-
- QOpenGLProgramBinaryCache::ShaderDesc shader(qt_shaderTypeToStage(type));
- // NB! It could be tempting to defer reading the file contents and just
- // hash the filename as the cache key, perhaps combined with last-modified
- // timestamp checks. However, this would raise a number of issues (no
- // timestamps for files in the resource system; preference for global, not
- // per-application cache items (where filenames may clash); resource-based
- // shaders from libraries like Qt Quick; etc.), so just avoid it.
- QFile f(fileName);
- if (f.open(QIODevice::ReadOnly | QIODevice::Text)) {
- shader.source = f.readAll();
- f.close();
- } else {
- qWarning("QOpenGLShaderProgram: Unable to open file %s", qPrintable(fileName));
- return false;
- }
- d->binaryProgram.shaders.append(shader);
- return true;
-}
-
-/*!
- Removes \a shader from this shader program. The object is not deleted.
-
- The shader program must be valid in the current QOpenGLContext.
-
- \sa addShader(), link(), removeAllShaders()
-*/
-void QOpenGLShaderProgram::removeShader(QOpenGLShader *shader)
-{
- Q_D(QOpenGLShaderProgram);
- if (d->programGuard && d->programGuard->id()
- && shader && shader->d_func()->shaderGuard)
- {
- d->glfuncs->glDetachShader(d->programGuard->id(), shader->d_func()->shaderGuard->id());
- }
- d->linked = false; // Program needs to be relinked.
- if (shader) {
- d->shaders.removeAll(shader);
- d->anonShaders.removeAll(shader);
- disconnect(shader, SIGNAL(destroyed()), this, SLOT(shaderDestroyed()));
- }
-}
-
-/*!
- Returns a list of all shaders that have been added to this shader
- program using addShader().
-
- \sa addShader(), removeShader()
-*/
-QList<QOpenGLShader *> QOpenGLShaderProgram::shaders() const
-{
- Q_D(const QOpenGLShaderProgram);
- return d->shaders;
-}
-
-/*!
- Removes all of the shaders that were added to this program previously.
- The QOpenGLShader objects for the shaders will not be deleted if they
- were constructed externally. QOpenGLShader objects that are constructed
- internally by QOpenGLShaderProgram will be deleted.
-
- \sa addShader(), removeShader()
-*/
-void QOpenGLShaderProgram::removeAllShaders()
-{
- Q_D(QOpenGLShaderProgram);
- d->removingShaders = true;
- for (QOpenGLShader *shader : qAsConst(d->shaders)) {
- if (d->programGuard && d->programGuard->id()
- && shader && shader->d_func()->shaderGuard)
- {
- d->glfuncs->glDetachShader(d->programGuard->id(), shader->d_func()->shaderGuard->id());
- }
- }
- // Delete shader objects that were created anonymously.
- qDeleteAll(d->anonShaders);
- d->shaders.clear();
- d->anonShaders.clear();
- d->binaryProgram = QOpenGLProgramBinaryCache::ProgramDesc();
- d->linked = false; // Program needs to be relinked.
- d->removingShaders = false;
-}
-
-/*!
- Links together the shaders that were added to this program with
- addShader(). Returns \c true if the link was successful or
- false otherwise. If the link failed, the error messages can
- be retrieved with log().
-
- Subclasses can override this function to initialize attributes
- and uniform variables for use in specific shader programs.
-
- If the shader program was already linked, calling this
- function again will force it to be re-linked.
-
- When shaders were added to this program via
- addCacheableShaderFromSourceCode() or addCacheableShaderFromSourceFile(),
- program binaries are supported, and a cached binary is available on disk,
- actual compilation and linking are skipped. Instead, link() will initialize
- the program with the binary blob via glProgramBinary(). If there is no
- cached version of the program or it was generated with a different driver
- version, the shaders will be compiled from source and the program will get
- linked normally. This allows seamless upgrading of the graphics drivers,
- without having to worry about potentially incompatible binary formats.
-
- \sa addShader(), log()
-*/
-bool QOpenGLShaderProgram::link()
-{
- Q_D(QOpenGLShaderProgram);
- GLuint program = d->programGuard ? d->programGuard->id() : 0;
- if (!program)
- return false;
-
- if (!d->linkBinaryRecursion && d->shaders.isEmpty() && !d->binaryProgram.shaders.isEmpty())
- return d->linkBinary();
-
- GLint value;
- if (d->shaders.isEmpty()) {
- // If there are no explicit shaders, then it is possible that the
- // application added a program binary with glProgramBinaryOES(), or
- // otherwise populated the shaders itself. This is also the case when
- // we are recursively called back from linkBinary() after a successful
- // glProgramBinary(). Check to see if the program is already linked and
- // bail out if so.
- value = 0;
- d->glfuncs->glGetProgramiv(program, GL_LINK_STATUS, &value);
- d->linked = (value != 0);
- if (d->linked)
- return true;
- }
-
- d->glfuncs->glLinkProgram(program);
- value = 0;
- d->glfuncs->glGetProgramiv(program, GL_LINK_STATUS, &value);
- d->linked = (value != 0);
- value = 0;
- d->glfuncs->glGetProgramiv(program, GL_INFO_LOG_LENGTH, &value);
- d->log = QString();
- if (value > 1) {
- char *logbuf = new char [value];
- GLint len;
- d->glfuncs->glGetProgramInfoLog(program, value, &len, logbuf);
- d->log = QString::fromLatin1(logbuf);
- if (!d->linked && !d->linkBinaryRecursion) {
- QString name = objectName();
- if (name.isEmpty())
- qWarning("QOpenGLShader::link: %ls", qUtf16Printable(d->log));
- else
- qWarning("QOpenGLShader::link[%ls]: %ls", qUtf16Printable(name), qUtf16Printable(d->log));
- }
- delete [] logbuf;
- }
- return d->linked;
-}
-
-/*!
- Returns \c true if this shader program has been linked; false otherwise.
-
- \sa link()
-*/
-bool QOpenGLShaderProgram::isLinked() const
-{
- Q_D(const QOpenGLShaderProgram);
- return d->linked;
-}
-
-/*!
- Returns the errors and warnings that occurred during the last link()
- or addShader() with explicitly specified source code.
-
- \sa link()
-*/
-QString QOpenGLShaderProgram::log() const
-{
- Q_D(const QOpenGLShaderProgram);
- return d->log;
-}
-
-/*!
- Binds this shader program to the active QOpenGLContext and makes
- it the current shader program. Any previously bound shader program
- is released. This is equivalent to calling \c{glUseProgram()} on
- programId(). Returns \c true if the program was successfully bound;
- false otherwise. If the shader program has not yet been linked,
- or it needs to be re-linked, this function will call link().
-
- \sa link(), release()
-*/
-bool QOpenGLShaderProgram::bind()
-{
- Q_D(QOpenGLShaderProgram);
- GLuint program = d->programGuard ? d->programGuard->id() : 0;
- if (!program)
- return false;
- if (!d->linked && !link())
- return false;
-#ifndef QT_NO_DEBUG
- if (d->programGuard->group() != QOpenGLContextGroup::currentContextGroup()) {
- qWarning("QOpenGLShaderProgram::bind: program is not valid in the current context.");
- return false;
- }
-#endif
- d->glfuncs->glUseProgram(program);
- return true;
-}
-
-/*!
- Releases the active shader program from the current QOpenGLContext.
- This is equivalent to calling \c{glUseProgram(0)}.
-
- \sa bind()
-*/
-void QOpenGLShaderProgram::release()
-{
- Q_D(QOpenGLShaderProgram);
-#ifndef QT_NO_DEBUG
- if (d->programGuard && d->programGuard->group() != QOpenGLContextGroup::currentContextGroup())
- qWarning("QOpenGLShaderProgram::release: program is not valid in the current context.");
-#endif
- d->glfuncs->glUseProgram(0);
-}
-
-/*!
- Returns the OpenGL identifier associated with this shader program.
-
- \sa QOpenGLShader::shaderId()
-*/
-GLuint QOpenGLShaderProgram::programId() const
-{
- Q_D(const QOpenGLShaderProgram);
- GLuint id = d->programGuard ? d->programGuard->id() : 0;
- if (id)
- return id;
-
- // Create the identifier if we don't have one yet. This is for
- // applications that want to create the attached shader configuration
- // themselves, particularly those using program binaries.
- if (!const_cast<QOpenGLShaderProgram *>(this)->init())
- return 0;
- return d->programGuard ? d->programGuard->id() : 0;
-}
-
-/*!
- Binds the attribute \a name to the specified \a location. This
- function can be called before or after the program has been linked.
- Any attributes that have not been explicitly bound when the program
- is linked will be assigned locations automatically.
-
- When this function is called after the program has been linked,
- the program will need to be relinked for the change to take effect.
-
- \sa attributeLocation()
-*/
-void QOpenGLShaderProgram::bindAttributeLocation(const char *name, int location)
-{
- Q_D(QOpenGLShaderProgram);
- if (!init() || !d->programGuard || !d->programGuard->id())
- return;
- d->glfuncs->glBindAttribLocation(d->programGuard->id(), location, name);
- d->linked = false; // Program needs to be relinked.
-}
-
-/*!
- \overload
-
- Binds the attribute \a name to the specified \a location. This
- function can be called before or after the program has been linked.
- Any attributes that have not been explicitly bound when the program
- is linked will be assigned locations automatically.
-
- When this function is called after the program has been linked,
- the program will need to be relinked for the change to take effect.
-
- \sa attributeLocation()
-*/
-void QOpenGLShaderProgram::bindAttributeLocation(const QByteArray& name, int location)
-{
- bindAttributeLocation(name.constData(), location);
-}
-
-/*!
- \overload
-
- Binds the attribute \a name to the specified \a location. This
- function can be called before or after the program has been linked.
- Any attributes that have not been explicitly bound when the program
- is linked will be assigned locations automatically.
-
- When this function is called after the program has been linked,
- the program will need to be relinked for the change to take effect.
-
- \sa attributeLocation()
-*/
-void QOpenGLShaderProgram::bindAttributeLocation(const QString& name, int location)
-{
- bindAttributeLocation(name.toLatin1().constData(), location);
-}
-
-/*!
- Returns the location of the attribute \a name within this shader
- program's parameter list. Returns -1 if \a name is not a valid
- attribute for this shader program.
-
- \sa uniformLocation(), bindAttributeLocation()
-*/
-int QOpenGLShaderProgram::attributeLocation(const char *name) const
-{
- Q_D(const QOpenGLShaderProgram);
- if (d->linked && d->programGuard && d->programGuard->id()) {
- return d->glfuncs->glGetAttribLocation(d->programGuard->id(), name);
- } else {
- qWarning("QOpenGLShaderProgram::attributeLocation(%s): shader program is not linked", name);
- return -1;
- }
-}
-
-/*!
- \overload
-
- Returns the location of the attribute \a name within this shader
- program's parameter list. Returns -1 if \a name is not a valid
- attribute for this shader program.
-
- \sa uniformLocation(), bindAttributeLocation()
-*/
-int QOpenGLShaderProgram::attributeLocation(const QByteArray& name) const
-{
- return attributeLocation(name.constData());
-}
-
-/*!
- \overload
-
- Returns the location of the attribute \a name within this shader
- program's parameter list. Returns -1 if \a name is not a valid
- attribute for this shader program.
-
- \sa uniformLocation(), bindAttributeLocation()
-*/
-int QOpenGLShaderProgram::attributeLocation(const QString& name) const
-{
- return attributeLocation(name.toLatin1().constData());
-}
-
-/*!
- Sets the attribute at \a location in the current context to \a value.
-
- \sa setUniformValue()
-*/
-void QOpenGLShaderProgram::setAttributeValue(int location, GLfloat value)
-{
- Q_D(QOpenGLShaderProgram);
- if (location != -1)
- d->glfuncs->glVertexAttrib1fv(location, &value);
-}
-
-/*!
- \overload
-
- Sets the attribute called \a name in the current context to \a value.
-
- \sa setUniformValue()
-*/
-void QOpenGLShaderProgram::setAttributeValue(const char *name, GLfloat value)
-{
- setAttributeValue(attributeLocation(name), value);
-}
-
-/*!
- Sets the attribute at \a location in the current context to
- the 2D vector (\a x, \a y).
-
- \sa setUniformValue()
-*/
-void QOpenGLShaderProgram::setAttributeValue(int location, GLfloat x, GLfloat y)
-{
- Q_D(QOpenGLShaderProgram);
- if (location != -1) {
- GLfloat values[2] = {x, y};
- d->glfuncs->glVertexAttrib2fv(location, values);
- }
-}
-
-/*!
- \overload
-
- Sets the attribute called \a name in the current context to
- the 2D vector (\a x, \a y).
-
- \sa setUniformValue()
-*/
-void QOpenGLShaderProgram::setAttributeValue(const char *name, GLfloat x, GLfloat y)
-{
- setAttributeValue(attributeLocation(name), x, y);
-}
-
-/*!
- Sets the attribute at \a location in the current context to
- the 3D vector (\a x, \a y, \a z).
-
- \sa setUniformValue()
-*/
-void QOpenGLShaderProgram::setAttributeValue
- (int location, GLfloat x, GLfloat y, GLfloat z)
-{
- Q_D(QOpenGLShaderProgram);
- Q_UNUSED(d);
- if (location != -1) {
- GLfloat values[3] = {x, y, z};
- d->glfuncs->glVertexAttrib3fv(location, values);
- }
-}
-
-/*!
- \overload
-
- Sets the attribute called \a name in the current context to
- the 3D vector (\a x, \a y, \a z).
-
- \sa setUniformValue()
-*/
-void QOpenGLShaderProgram::setAttributeValue
- (const char *name, GLfloat x, GLfloat y, GLfloat z)
-{
- setAttributeValue(attributeLocation(name), x, y, z);
-}
-
-/*!
- Sets the attribute at \a location in the current context to
- the 4D vector (\a x, \a y, \a z, \a w).
-
- \sa setUniformValue()
-*/
-void QOpenGLShaderProgram::setAttributeValue
- (int location, GLfloat x, GLfloat y, GLfloat z, GLfloat w)
-{
- Q_D(QOpenGLShaderProgram);
- if (location != -1) {
- GLfloat values[4] = {x, y, z, w};
- d->glfuncs->glVertexAttrib4fv(location, values);
- }
-}
-
-/*!
- \overload
-
- Sets the attribute called \a name in the current context to
- the 4D vector (\a x, \a y, \a z, \a w).
-
- \sa setUniformValue()
-*/
-void QOpenGLShaderProgram::setAttributeValue
- (const char *name, GLfloat x, GLfloat y, GLfloat z, GLfloat w)
-{
- setAttributeValue(attributeLocation(name), x, y, z, w);
-}
-
-/*!
- Sets the attribute at \a location in the current context to \a value.
-
- \sa setUniformValue()
-*/
-void QOpenGLShaderProgram::setAttributeValue(int location, const QVector2D& value)
-{
- Q_D(QOpenGLShaderProgram);
- if (location != -1)
- d->glfuncs->glVertexAttrib2fv(location, reinterpret_cast<const GLfloat *>(&value));
-}
-
-/*!
- \overload
-
- Sets the attribute called \a name in the current context to \a value.
-
- \sa setUniformValue()
-*/
-void QOpenGLShaderProgram::setAttributeValue(const char *name, const QVector2D& value)
-{
- setAttributeValue(attributeLocation(name), value);
-}
-
-/*!
- Sets the attribute at \a location in the current context to \a value.
-
- \sa setUniformValue()
-*/
-void QOpenGLShaderProgram::setAttributeValue(int location, const QVector3D& value)
-{
- Q_D(QOpenGLShaderProgram);
- Q_UNUSED(d);
- if (location != -1)
- d->glfuncs->glVertexAttrib3fv(location, reinterpret_cast<const GLfloat *>(&value));
-}
-
-/*!
- \overload
-
- Sets the attribute called \a name in the current context to \a value.
-
- \sa setUniformValue()
-*/
-void QOpenGLShaderProgram::setAttributeValue(const char *name, const QVector3D& value)
-{
- setAttributeValue(attributeLocation(name), value);
-}
-
-/*!
- Sets the attribute at \a location in the current context to \a value.
-
- \sa setUniformValue()
-*/
-void QOpenGLShaderProgram::setAttributeValue(int location, const QVector4D& value)
-{
- Q_D(QOpenGLShaderProgram);
- Q_UNUSED(d);
- if (location != -1)
- d->glfuncs->glVertexAttrib4fv(location, reinterpret_cast<const GLfloat *>(&value));
-}
-
-/*!
- \overload
-
- Sets the attribute called \a name in the current context to \a value.
-
- \sa setUniformValue()
-*/
-void QOpenGLShaderProgram::setAttributeValue(const char *name, const QVector4D& value)
-{
- setAttributeValue(attributeLocation(name), value);
-}
-
-/*!
- Sets the attribute at \a location in the current context to \a value.
-
- \sa setUniformValue()
-*/
-void QOpenGLShaderProgram::setAttributeValue(int location, const QColor& value)
-{
- Q_D(QOpenGLShaderProgram);
- Q_UNUSED(d);
- if (location != -1) {
- GLfloat values[4] = {GLfloat(value.redF()), GLfloat(value.greenF()),
- GLfloat(value.blueF()), GLfloat(value.alphaF())};
- d->glfuncs->glVertexAttrib4fv(location, values);
- }
-}
-
-/*!
- \overload
-
- Sets the attribute called \a name in the current context to \a value.
-
- \sa setUniformValue()
-*/
-void QOpenGLShaderProgram::setAttributeValue(const char *name, const QColor& value)
-{
- setAttributeValue(attributeLocation(name), value);
-}
-
-/*!
- Sets the attribute at \a location in the current context to the
- contents of \a values, which contains \a columns elements, each
- consisting of \a rows elements. The \a rows value should be
- 1, 2, 3, or 4. This function is typically used to set matrix
- values and column vectors.
-
- \sa setUniformValue()
-*/
-void QOpenGLShaderProgram::setAttributeValue
- (int location, const GLfloat *values, int columns, int rows)
-{
- Q_D(QOpenGLShaderProgram);
- Q_UNUSED(d);
- if (rows < 1 || rows > 4) {
- qWarning("QOpenGLShaderProgram::setAttributeValue: rows %d not supported", rows);
- return;
- }
- if (location != -1) {
- while (columns-- > 0) {
- if (rows == 1)
- d->glfuncs->glVertexAttrib1fv(location, values);
- else if (rows == 2)
- d->glfuncs->glVertexAttrib2fv(location, values);
- else if (rows == 3)
- d->glfuncs->glVertexAttrib3fv(location, values);
- else
- d->glfuncs->glVertexAttrib4fv(location, values);
- values += rows;
- ++location;
- }
- }
-}
-
-/*!
- \overload
-
- Sets the attribute called \a name in the current context to the
- contents of \a values, which contains \a columns elements, each
- consisting of \a rows elements. The \a rows value should be
- 1, 2, 3, or 4. This function is typically used to set matrix
- values and column vectors.
-
- \sa setUniformValue()
-*/
-void QOpenGLShaderProgram::setAttributeValue
- (const char *name, const GLfloat *values, int columns, int rows)
-{
- setAttributeValue(attributeLocation(name), values, columns, rows);
-}
-
-/*!
- Sets an array of vertex \a values on the attribute at \a location
- in this shader program. The \a tupleSize indicates the number of
- components per vertex (1, 2, 3, or 4), and the \a stride indicates
- the number of bytes between vertices. A default \a stride value
- of zero indicates that the vertices are densely packed in \a values.
-
- The array will become active when enableAttributeArray() is called
- on the \a location. Otherwise the value specified with
- setAttributeValue() for \a location will be used.
-
- \sa setAttributeValue(), setUniformValue(), enableAttributeArray()
- \sa disableAttributeArray()
-*/
-void QOpenGLShaderProgram::setAttributeArray
- (int location, const GLfloat *values, int tupleSize, int stride)
-{
- Q_D(QOpenGLShaderProgram);
- Q_UNUSED(d);
- if (location != -1) {
- d->glfuncs->glVertexAttribPointer(location, tupleSize, GL_FLOAT, GL_FALSE,
- stride, values);
- }
-}
-
-/*!
- Sets an array of 2D vertex \a values on the attribute at \a location
- in this shader program. The \a stride indicates the number of bytes
- between vertices. A default \a stride value of zero indicates that
- the vertices are densely packed in \a values.
-
- The array will become active when enableAttributeArray() is called
- on the \a location. Otherwise the value specified with
- setAttributeValue() for \a location will be used.
-
- \sa setAttributeValue(), setUniformValue(), enableAttributeArray()
- \sa disableAttributeArray()
-*/
-void QOpenGLShaderProgram::setAttributeArray
- (int location, const QVector2D *values, int stride)
-{
- Q_D(QOpenGLShaderProgram);
- Q_UNUSED(d);
- if (location != -1) {
- d->glfuncs->glVertexAttribPointer(location, 2, GL_FLOAT, GL_FALSE,
- stride, values);
- }
-}
-
-/*!
- Sets an array of 3D vertex \a values on the attribute at \a location
- in this shader program. The \a stride indicates the number of bytes
- between vertices. A default \a stride value of zero indicates that
- the vertices are densely packed in \a values.
-
- The array will become active when enableAttributeArray() is called
- on the \a location. Otherwise the value specified with
- setAttributeValue() for \a location will be used.
-
- \sa setAttributeValue(), setUniformValue(), enableAttributeArray()
- \sa disableAttributeArray()
-*/
-void QOpenGLShaderProgram::setAttributeArray
- (int location, const QVector3D *values, int stride)
-{
- Q_D(QOpenGLShaderProgram);
- Q_UNUSED(d);
- if (location != -1) {
- d->glfuncs->glVertexAttribPointer(location, 3, GL_FLOAT, GL_FALSE,
- stride, values);
- }
-}
-
-/*!
- Sets an array of 4D vertex \a values on the attribute at \a location
- in this shader program. The \a stride indicates the number of bytes
- between vertices. A default \a stride value of zero indicates that
- the vertices are densely packed in \a values.
-
- The array will become active when enableAttributeArray() is called
- on the \a location. Otherwise the value specified with
- setAttributeValue() for \a location will be used.
-
- \sa setAttributeValue(), setUniformValue(), enableAttributeArray()
- \sa disableAttributeArray()
-*/
-void QOpenGLShaderProgram::setAttributeArray
- (int location, const QVector4D *values, int stride)
-{
- Q_D(QOpenGLShaderProgram);
- Q_UNUSED(d);
- if (location != -1) {
- d->glfuncs->glVertexAttribPointer(location, 4, GL_FLOAT, GL_FALSE,
- stride, values);
- }
-}
-
-/*!
- Sets an array of vertex \a values on the attribute at \a location
- in this shader program. The \a stride indicates the number of bytes
- between vertices. A default \a stride value of zero indicates that
- the vertices are densely packed in \a values.
-
- The \a type indicates the type of elements in the \a values array,
- usually \c{GL_FLOAT}, \c{GL_UNSIGNED_BYTE}, etc. The \a tupleSize
- indicates the number of components per vertex: 1, 2, 3, or 4.
-
- The array will become active when enableAttributeArray() is called
- on the \a location. Otherwise the value specified with
- setAttributeValue() for \a location will be used.
-
- The setAttributeBuffer() function can be used to set the attribute
- array to an offset within a vertex buffer.
-
- \note Normalization will be enabled. If this is not desired, call
- glVertexAttribPointer directly through QOpenGLFunctions.
-
- \sa setAttributeValue(), setUniformValue(), enableAttributeArray()
- \sa disableAttributeArray(), setAttributeBuffer()
-*/
-void QOpenGLShaderProgram::setAttributeArray
- (int location, GLenum type, const void *values, int tupleSize, int stride)
-{
- Q_D(QOpenGLShaderProgram);
- Q_UNUSED(d);
- if (location != -1) {
- d->glfuncs->glVertexAttribPointer(location, tupleSize, type, GL_TRUE,
- stride, values);
- }
-}
-
-/*!
- \overload
-
- Sets an array of vertex \a values on the attribute called \a name
- in this shader program. The \a tupleSize indicates the number of
- components per vertex (1, 2, 3, or 4), and the \a stride indicates
- the number of bytes between vertices. A default \a stride value
- of zero indicates that the vertices are densely packed in \a values.
-
- The array will become active when enableAttributeArray() is called
- on \a name. Otherwise the value specified with setAttributeValue()
- for \a name will be used.
-
- \sa setAttributeValue(), setUniformValue(), enableAttributeArray()
- \sa disableAttributeArray()
-*/
-void QOpenGLShaderProgram::setAttributeArray
- (const char *name, const GLfloat *values, int tupleSize, int stride)
-{
- setAttributeArray(attributeLocation(name), values, tupleSize, stride);
-}
-
-/*!
- \overload
-
- Sets an array of 2D vertex \a values on the attribute called \a name
- in this shader program. The \a stride indicates the number of bytes
- between vertices. A default \a stride value of zero indicates that
- the vertices are densely packed in \a values.
-
- The array will become active when enableAttributeArray() is called
- on \a name. Otherwise the value specified with setAttributeValue()
- for \a name will be used.
-
- \sa setAttributeValue(), setUniformValue(), enableAttributeArray()
- \sa disableAttributeArray()
-*/
-void QOpenGLShaderProgram::setAttributeArray
- (const char *name, const QVector2D *values, int stride)
-{
- setAttributeArray(attributeLocation(name), values, stride);
-}
-
-/*!
- \overload
-
- Sets an array of 3D vertex \a values on the attribute called \a name
- in this shader program. The \a stride indicates the number of bytes
- between vertices. A default \a stride value of zero indicates that
- the vertices are densely packed in \a values.
-
- The array will become active when enableAttributeArray() is called
- on \a name. Otherwise the value specified with setAttributeValue()
- for \a name will be used.
-
- \sa setAttributeValue(), setUniformValue(), enableAttributeArray()
- \sa disableAttributeArray()
-*/
-void QOpenGLShaderProgram::setAttributeArray
- (const char *name, const QVector3D *values, int stride)
-{
- setAttributeArray(attributeLocation(name), values, stride);
-}
-
-/*!
- \overload
-
- Sets an array of 4D vertex \a values on the attribute called \a name
- in this shader program. The \a stride indicates the number of bytes
- between vertices. A default \a stride value of zero indicates that
- the vertices are densely packed in \a values.
-
- The array will become active when enableAttributeArray() is called
- on \a name. Otherwise the value specified with setAttributeValue()
- for \a name will be used.
-
- \sa setAttributeValue(), setUniformValue(), enableAttributeArray()
- \sa disableAttributeArray()
-*/
-void QOpenGLShaderProgram::setAttributeArray
- (const char *name, const QVector4D *values, int stride)
-{
- setAttributeArray(attributeLocation(name), values, stride);
-}
-
-/*!
- \overload
-
- Sets an array of vertex \a values on the attribute called \a name
- in this shader program. The \a stride indicates the number of bytes
- between vertices. A default \a stride value of zero indicates that
- the vertices are densely packed in \a values.
-
- The \a type indicates the type of elements in the \a values array,
- usually \c{GL_FLOAT}, \c{GL_UNSIGNED_BYTE}, etc. The \a tupleSize
- indicates the number of components per vertex: 1, 2, 3, or 4.
-
- The array will become active when enableAttributeArray() is called
- on the \a name. Otherwise the value specified with
- setAttributeValue() for \a name will be used.
-
- The setAttributeBuffer() function can be used to set the attribute
- array to an offset within a vertex buffer.
-
- \sa setAttributeValue(), setUniformValue(), enableAttributeArray()
- \sa disableAttributeArray(), setAttributeBuffer()
-*/
-void QOpenGLShaderProgram::setAttributeArray
- (const char *name, GLenum type, const void *values, int tupleSize, int stride)
-{
- setAttributeArray(attributeLocation(name), type, values, tupleSize, stride);
-}
-
-/*!
- Sets an array of vertex values on the attribute at \a location in
- this shader program, starting at a specific \a offset in the
- currently bound vertex buffer. The \a stride indicates the number
- of bytes between vertices. A default \a stride value of zero
- indicates that the vertices are densely packed in the value array.
-
- The \a type indicates the type of elements in the vertex value
- array, usually \c{GL_FLOAT}, \c{GL_UNSIGNED_BYTE}, etc. The \a
- tupleSize indicates the number of components per vertex: 1, 2, 3,
- or 4.
-
- The array will become active when enableAttributeArray() is called
- on the \a location. Otherwise the value specified with
- setAttributeValue() for \a location will be used.
-
- \note Normalization will be enabled. If this is not desired, call
- glVertexAttribPointer directly through QOpenGLFunctions.
-
- \sa setAttributeArray()
-*/
-void QOpenGLShaderProgram::setAttributeBuffer
- (int location, GLenum type, int offset, int tupleSize, int stride)
-{
- Q_D(QOpenGLShaderProgram);
- Q_UNUSED(d);
- if (location != -1) {
- d->glfuncs->glVertexAttribPointer(location, tupleSize, type, GL_TRUE, stride,
- reinterpret_cast<const void *>(qintptr(offset)));
- }
-}
-
-/*!
- \overload
-
- Sets an array of vertex values on the attribute called \a name
- in this shader program, starting at a specific \a offset in the
- currently bound vertex buffer. The \a stride indicates the number
- of bytes between vertices. A default \a stride value of zero
- indicates that the vertices are densely packed in the value array.
-
- The \a type indicates the type of elements in the vertex value
- array, usually \c{GL_FLOAT}, \c{GL_UNSIGNED_BYTE}, etc. The \a
- tupleSize indicates the number of components per vertex: 1, 2, 3,
- or 4.
-
- The array will become active when enableAttributeArray() is called
- on the \a name. Otherwise the value specified with
- setAttributeValue() for \a name will be used.
-
- \sa setAttributeArray()
-*/
-void QOpenGLShaderProgram::setAttributeBuffer
- (const char *name, GLenum type, int offset, int tupleSize, int stride)
-{
- setAttributeBuffer(attributeLocation(name), type, offset, tupleSize, stride);
-}
-
-/*!
- Enables the vertex array at \a location in this shader program
- so that the value set by setAttributeArray() on \a location
- will be used by the shader program.
-
- \sa disableAttributeArray(), setAttributeArray(), setAttributeValue()
- \sa setUniformValue()
-*/
-void QOpenGLShaderProgram::enableAttributeArray(int location)
-{
- Q_D(QOpenGLShaderProgram);
- Q_UNUSED(d);
- if (location != -1)
- d->glfuncs->glEnableVertexAttribArray(location);
-}
-
-/*!
- \overload
-
- Enables the vertex array called \a name in this shader program
- so that the value set by setAttributeArray() on \a name
- will be used by the shader program.
-
- \sa disableAttributeArray(), setAttributeArray(), setAttributeValue()
- \sa setUniformValue()
-*/
-void QOpenGLShaderProgram::enableAttributeArray(const char *name)
-{
- enableAttributeArray(attributeLocation(name));
-}
-
-/*!
- Disables the vertex array at \a location in this shader program
- that was enabled by a previous call to enableAttributeArray().
-
- \sa enableAttributeArray(), setAttributeArray(), setAttributeValue()
- \sa setUniformValue()
-*/
-void QOpenGLShaderProgram::disableAttributeArray(int location)
-{
- Q_D(QOpenGLShaderProgram);
- Q_UNUSED(d);
- if (location != -1)
- d->glfuncs->glDisableVertexAttribArray(location);
-}
-
-/*!
- \overload
-
- Disables the vertex array called \a name in this shader program
- that was enabled by a previous call to enableAttributeArray().
-
- \sa enableAttributeArray(), setAttributeArray(), setAttributeValue()
- \sa setUniformValue()
-*/
-void QOpenGLShaderProgram::disableAttributeArray(const char *name)
-{
- disableAttributeArray(attributeLocation(name));
-}
-
-/*!
- Returns the location of the uniform variable \a name within this shader
- program's parameter list. Returns -1 if \a name is not a valid
- uniform variable for this shader program.
-
- \sa attributeLocation()
-*/
-int QOpenGLShaderProgram::uniformLocation(const char *name) const
-{
- Q_D(const QOpenGLShaderProgram);
- Q_UNUSED(d);
- if (d->linked && d->programGuard && d->programGuard->id()) {
- return d->glfuncs->glGetUniformLocation(d->programGuard->id(), name);
- } else {
- qWarning("QOpenGLShaderProgram::uniformLocation(%s): shader program is not linked", name);
- return -1;
- }
-}
-
-/*!
- \overload
-
- Returns the location of the uniform variable \a name within this shader
- program's parameter list. Returns -1 if \a name is not a valid
- uniform variable for this shader program.
-
- \sa attributeLocation()
-*/
-int QOpenGLShaderProgram::uniformLocation(const QByteArray& name) const
-{
- return uniformLocation(name.constData());
-}
-
-/*!
- \overload
-
- Returns the location of the uniform variable \a name within this shader
- program's parameter list. Returns -1 if \a name is not a valid
- uniform variable for this shader program.
-
- \sa attributeLocation()
-*/
-int QOpenGLShaderProgram::uniformLocation(const QString& name) const
-{
- return uniformLocation(name.toLatin1().constData());
-}
-
-/*!
- Sets the uniform variable at \a location in the current context to \a value.
-
- \sa setAttributeValue()
-*/
-void QOpenGLShaderProgram::setUniformValue(int location, GLfloat value)
-{
- Q_D(QOpenGLShaderProgram);
- Q_UNUSED(d);
- if (location != -1)
- d->glfuncs->glUniform1fv(location, 1, &value);
-}
-
-/*!
- \overload
-
- Sets the uniform variable called \a name in the current context
- to \a value.
-
- \sa setAttributeValue()
-*/
-void QOpenGLShaderProgram::setUniformValue(const char *name, GLfloat value)
-{
- setUniformValue(uniformLocation(name), value);
-}
-
-/*!
- Sets the uniform variable at \a location in the current context to \a value.
-
- \sa setAttributeValue()
-*/
-void QOpenGLShaderProgram::setUniformValue(int location, GLint value)
-{
- Q_D(QOpenGLShaderProgram);
- Q_UNUSED(d);
- if (location != -1)
- d->glfuncs->glUniform1i(location, value);
-}
-
-/*!
- \overload
-
- Sets the uniform variable called \a name in the current context
- to \a value.
-
- \sa setAttributeValue()
-*/
-void QOpenGLShaderProgram::setUniformValue(const char *name, GLint value)
-{
- setUniformValue(uniformLocation(name), value);
-}
-
-/*!
- Sets the uniform variable at \a location in the current context to \a value.
- This function should be used when setting sampler values.
-
- \note This function is not aware of unsigned int support in modern OpenGL
- versions and therefore treats \a value as a GLint and calls glUniform1i.
-
- \sa setAttributeValue()
-*/
-void QOpenGLShaderProgram::setUniformValue(int location, GLuint value)
-{
- Q_D(QOpenGLShaderProgram);
- Q_UNUSED(d);
- if (location != -1)
- d->glfuncs->glUniform1i(location, value);
-}
-
-/*!
- \overload
-
- Sets the uniform variable called \a name in the current context
- to \a value. This function should be used when setting sampler values.
-
- \note This function is not aware of unsigned int support in modern OpenGL
- versions and therefore treats \a value as a GLint and calls glUniform1i.
-
- \sa setAttributeValue()
-*/
-void QOpenGLShaderProgram::setUniformValue(const char *name, GLuint value)
-{
- setUniformValue(uniformLocation(name), value);
-}
-
-/*!
- Sets the uniform variable at \a location in the current context to
- the 2D vector (\a x, \a y).
-
- \sa setAttributeValue()
-*/
-void QOpenGLShaderProgram::setUniformValue(int location, GLfloat x, GLfloat y)
-{
- Q_D(QOpenGLShaderProgram);
- Q_UNUSED(d);
- if (location != -1) {
- GLfloat values[2] = {x, y};
- d->glfuncs->glUniform2fv(location, 1, values);
- }
-}
-
-/*!
- \overload
-
- Sets the uniform variable called \a name in the current context to
- the 2D vector (\a x, \a y).
-
- \sa setAttributeValue()
-*/
-void QOpenGLShaderProgram::setUniformValue(const char *name, GLfloat x, GLfloat y)
-{
- setUniformValue(uniformLocation(name), x, y);
-}
-
-/*!
- Sets the uniform variable at \a location in the current context to
- the 3D vector (\a x, \a y, \a z).
-
- \sa setAttributeValue()
-*/
-void QOpenGLShaderProgram::setUniformValue
- (int location, GLfloat x, GLfloat y, GLfloat z)
-{
- Q_D(QOpenGLShaderProgram);
- Q_UNUSED(d);
- if (location != -1) {
- GLfloat values[3] = {x, y, z};
- d->glfuncs->glUniform3fv(location, 1, values);
- }
-}
-
-/*!
- \overload
-
- Sets the uniform variable called \a name in the current context to
- the 3D vector (\a x, \a y, \a z).
-
- \sa setAttributeValue()
-*/
-void QOpenGLShaderProgram::setUniformValue
- (const char *name, GLfloat x, GLfloat y, GLfloat z)
-{
- setUniformValue(uniformLocation(name), x, y, z);
-}
-
-/*!
- Sets the uniform variable at \a location in the current context to
- the 4D vector (\a x, \a y, \a z, \a w).
-
- \sa setAttributeValue()
-*/
-void QOpenGLShaderProgram::setUniformValue
- (int location, GLfloat x, GLfloat y, GLfloat z, GLfloat w)
-{
- Q_D(QOpenGLShaderProgram);
- Q_UNUSED(d);
- if (location != -1) {
- GLfloat values[4] = {x, y, z, w};
- d->glfuncs->glUniform4fv(location, 1, values);
- }
-}
-
-/*!
- \overload
-
- Sets the uniform variable called \a name in the current context to
- the 4D vector (\a x, \a y, \a z, \a w).
-
- \sa setAttributeValue()
-*/
-void QOpenGLShaderProgram::setUniformValue
- (const char *name, GLfloat x, GLfloat y, GLfloat z, GLfloat w)
-{
- setUniformValue(uniformLocation(name), x, y, z, w);
-}
-
-/*!
- Sets the uniform variable at \a location in the current context to \a value.
-
- \sa setAttributeValue()
-*/
-void QOpenGLShaderProgram::setUniformValue(int location, const QVector2D& value)
-{
- Q_D(QOpenGLShaderProgram);
- Q_UNUSED(d);
- if (location != -1)
- d->glfuncs->glUniform2fv(location, 1, reinterpret_cast<const GLfloat *>(&value));
-}
-
-/*!
- \overload
-
- Sets the uniform variable called \a name in the current context
- to \a value.
-
- \sa setAttributeValue()
-*/
-void QOpenGLShaderProgram::setUniformValue(const char *name, const QVector2D& value)
-{
- setUniformValue(uniformLocation(name), value);
-}
-
-/*!
- Sets the uniform variable at \a location in the current context to \a value.
-
- \sa setAttributeValue()
-*/
-void QOpenGLShaderProgram::setUniformValue(int location, const QVector3D& value)
-{
- Q_D(QOpenGLShaderProgram);
- Q_UNUSED(d);
- if (location != -1)
- d->glfuncs->glUniform3fv(location, 1, reinterpret_cast<const GLfloat *>(&value));
-}
-
-/*!
- \overload
-
- Sets the uniform variable called \a name in the current context
- to \a value.
-
- \sa setAttributeValue()
-*/
-void QOpenGLShaderProgram::setUniformValue(const char *name, const QVector3D& value)
-{
- setUniformValue(uniformLocation(name), value);
-}
-
-/*!
- Sets the uniform variable at \a location in the current context to \a value.
-
- \sa setAttributeValue()
-*/
-void QOpenGLShaderProgram::setUniformValue(int location, const QVector4D& value)
-{
- Q_D(QOpenGLShaderProgram);
- Q_UNUSED(d);
- if (location != -1)
- d->glfuncs->glUniform4fv(location, 1, reinterpret_cast<const GLfloat *>(&value));
-}
-
-/*!
- \overload
-
- Sets the uniform variable called \a name in the current context
- to \a value.
-
- \sa setAttributeValue()
-*/
-void QOpenGLShaderProgram::setUniformValue(const char *name, const QVector4D& value)
-{
- setUniformValue(uniformLocation(name), value);
-}
-
-/*!
- Sets the uniform variable at \a location in the current context to
- the red, green, blue, and alpha components of \a color.
-
- \sa setAttributeValue()
-*/
-void QOpenGLShaderProgram::setUniformValue(int location, const QColor& color)
-{
- Q_D(QOpenGLShaderProgram);
- Q_UNUSED(d);
- if (location != -1) {
- GLfloat values[4] = {GLfloat(color.redF()), GLfloat(color.greenF()),
- GLfloat(color.blueF()), GLfloat(color.alphaF())};
- d->glfuncs->glUniform4fv(location, 1, values);
- }
-}
-
-/*!
- \overload
-
- Sets the uniform variable called \a name in the current context to
- the red, green, blue, and alpha components of \a color.
-
- \sa setAttributeValue()
-*/
-void QOpenGLShaderProgram::setUniformValue(const char *name, const QColor& color)
-{
- setUniformValue(uniformLocation(name), color);
-}
-
-/*!
- Sets the uniform variable at \a location in the current context to
- the x and y coordinates of \a point.
-
- \sa setAttributeValue()
-*/
-void QOpenGLShaderProgram::setUniformValue(int location, const QPoint& point)
-{
- Q_D(QOpenGLShaderProgram);
- Q_UNUSED(d);
- if (location != -1) {
- GLfloat values[4] = {GLfloat(point.x()), GLfloat(point.y())};
- d->glfuncs->glUniform2fv(location, 1, values);
- }
-}
-
-/*!
- \overload
-
- Sets the uniform variable associated with \a name in the current
- context to the x and y coordinates of \a point.
-
- \sa setAttributeValue()
-*/
-void QOpenGLShaderProgram::setUniformValue(const char *name, const QPoint& point)
-{
- setUniformValue(uniformLocation(name), point);
-}
-
-/*!
- Sets the uniform variable at \a location in the current context to
- the x and y coordinates of \a point.
-
- \sa setAttributeValue()
-*/
-void QOpenGLShaderProgram::setUniformValue(int location, const QPointF& point)
-{
- Q_D(QOpenGLShaderProgram);
- Q_UNUSED(d);
- if (location != -1) {
- GLfloat values[4] = {GLfloat(point.x()), GLfloat(point.y())};
- d->glfuncs->glUniform2fv(location, 1, values);
- }
-}
-
-/*!
- \overload
-
- Sets the uniform variable associated with \a name in the current
- context to the x and y coordinates of \a point.
-
- \sa setAttributeValue()
-*/
-void QOpenGLShaderProgram::setUniformValue(const char *name, const QPointF& point)
-{
- setUniformValue(uniformLocation(name), point);
-}
-
-/*!
- Sets the uniform variable at \a location in the current context to
- the width and height of the given \a size.
-
- \sa setAttributeValue()
-*/
-void QOpenGLShaderProgram::setUniformValue(int location, const QSize& size)
-{
- Q_D(QOpenGLShaderProgram);
- Q_UNUSED(d);
- if (location != -1) {
- GLfloat values[4] = {GLfloat(size.width()), GLfloat(size.height())};
- d->glfuncs->glUniform2fv(location, 1, values);
- }
-}
-
-/*!
- \overload
-
- Sets the uniform variable associated with \a name in the current
- context to the width and height of the given \a size.
-
- \sa setAttributeValue()
-*/
-void QOpenGLShaderProgram::setUniformValue(const char *name, const QSize& size)
-{
- setUniformValue(uniformLocation(name), size);
-}
-
-/*!
- Sets the uniform variable at \a location in the current context to
- the width and height of the given \a size.
-
- \sa setAttributeValue()
-*/
-void QOpenGLShaderProgram::setUniformValue(int location, const QSizeF& size)
-{
- Q_D(QOpenGLShaderProgram);
- Q_UNUSED(d);
- if (location != -1) {
- GLfloat values[4] = {GLfloat(size.width()), GLfloat(size.height())};
- d->glfuncs->glUniform2fv(location, 1, values);
- }
-}
-
-/*!
- \overload
-
- Sets the uniform variable associated with \a name in the current
- context to the width and height of the given \a size.
-
- \sa setAttributeValue()
-*/
-void QOpenGLShaderProgram::setUniformValue(const char *name, const QSizeF& size)
-{
- setUniformValue(uniformLocation(name), size);
-}
-
-/*!
- Sets the uniform variable at \a location in the current context
- to a 2x2 matrix \a value.
-
- \sa setAttributeValue()
-*/
-void QOpenGLShaderProgram::setUniformValue(int location, const QMatrix2x2& value)
-{
- Q_D(QOpenGLShaderProgram);
- Q_UNUSED(d);
- d->glfuncs->glUniformMatrix2fv(location, 1, GL_FALSE, value.constData());
-}
-
-/*!
- \overload
-
- Sets the uniform variable called \a name in the current context
- to a 2x2 matrix \a value.
-
- \sa setAttributeValue()
-*/
-void QOpenGLShaderProgram::setUniformValue(const char *name, const QMatrix2x2& value)
-{
- setUniformValue(uniformLocation(name), value);
-}
-
-/*!
- Sets the uniform variable at \a location in the current context
- to a 2x3 matrix \a value.
-
- \note This function is not aware of non square matrix support,
- that is, GLSL types like mat2x3, that is present in modern OpenGL
- versions. Instead, it treats the uniform as an array of vec3.
-
- \sa setAttributeValue()
-*/
-void QOpenGLShaderProgram::setUniformValue(int location, const QMatrix2x3& value)
-{
- Q_D(QOpenGLShaderProgram);
- Q_UNUSED(d);
- d->glfuncs->glUniform3fv(location, 2, value.constData());
-}
-
-/*!
- \overload
-
- Sets the uniform variable called \a name in the current context
- to a 2x3 matrix \a value.
-
- \note This function is not aware of non square matrix support,
- that is, GLSL types like mat2x3, that is present in modern OpenGL
- versions. Instead, it treats the uniform as an array of vec3.
-
- \sa setAttributeValue()
-*/
-void QOpenGLShaderProgram::setUniformValue(const char *name, const QMatrix2x3& value)
-{
- setUniformValue(uniformLocation(name), value);
-}
-
-/*!
- Sets the uniform variable at \a location in the current context
- to a 2x4 matrix \a value.
-
- \note This function is not aware of non square matrix support,
- that is, GLSL types like mat2x4, that is present in modern OpenGL
- versions. Instead, it treats the uniform as an array of vec4.
-
- \sa setAttributeValue()
-*/
-void QOpenGLShaderProgram::setUniformValue(int location, const QMatrix2x4& value)
-{
- Q_D(QOpenGLShaderProgram);
- Q_UNUSED(d);
- d->glfuncs->glUniform4fv(location, 2, value.constData());
-}
-
-/*!
- \overload
-
- Sets the uniform variable called \a name in the current context
- to a 2x4 matrix \a value.
-
- \note This function is not aware of non square matrix support,
- that is, GLSL types like mat2x4, that is present in modern OpenGL
- versions. Instead, it treats the uniform as an array of vec4.
-
- \sa setAttributeValue()
-*/
-void QOpenGLShaderProgram::setUniformValue(const char *name, const QMatrix2x4& value)
-{
- setUniformValue(uniformLocation(name), value);
-}
-
-/*!
- Sets the uniform variable at \a location in the current context
- to a 3x2 matrix \a value.
-
- \note This function is not aware of non square matrix support,
- that is, GLSL types like mat3x2, that is present in modern OpenGL
- versions. Instead, it treats the uniform as an array of vec2.
-
- \sa setAttributeValue()
-*/
-void QOpenGLShaderProgram::setUniformValue(int location, const QMatrix3x2& value)
-{
- Q_D(QOpenGLShaderProgram);
- Q_UNUSED(d);
- d->glfuncs->glUniform2fv(location, 3, value.constData());
-}
-
-/*!
- \overload
-
- Sets the uniform variable called \a name in the current context
- to a 3x2 matrix \a value.
-
- \note This function is not aware of non square matrix support,
- that is, GLSL types like mat3x2, that is present in modern OpenGL
- versions. Instead, it treats the uniform as an array of vec2.
-
- \sa setAttributeValue()
-*/
-void QOpenGLShaderProgram::setUniformValue(const char *name, const QMatrix3x2& value)
-{
- setUniformValue(uniformLocation(name), value);
-}
-
-/*!
- Sets the uniform variable at \a location in the current context
- to a 3x3 matrix \a value.
-
- \sa setAttributeValue()
-*/
-void QOpenGLShaderProgram::setUniformValue(int location, const QMatrix3x3& value)
-{
- Q_D(QOpenGLShaderProgram);
- Q_UNUSED(d);
- d->glfuncs->glUniformMatrix3fv(location, 1, GL_FALSE, value.constData());
-}
-
-/*!
- \overload
-
- Sets the uniform variable called \a name in the current context
- to a 3x3 matrix \a value.
-
- \sa setAttributeValue()
-*/
-void QOpenGLShaderProgram::setUniformValue(const char *name, const QMatrix3x3& value)
-{
- setUniformValue(uniformLocation(name), value);
-}
-
-/*!
- Sets the uniform variable at \a location in the current context
- to a 3x4 matrix \a value.
-
- \note This function is not aware of non square matrix support,
- that is, GLSL types like mat3x4, that is present in modern OpenGL
- versions. Instead, it treats the uniform as an array of vec4.
-
- \sa setAttributeValue()
-*/
-void QOpenGLShaderProgram::setUniformValue(int location, const QMatrix3x4& value)
-{
- Q_D(QOpenGLShaderProgram);
- Q_UNUSED(d);
- d->glfuncs->glUniform4fv(location, 3, value.constData());
-}
-
-/*!
- \overload
-
- Sets the uniform variable called \a name in the current context
- to a 3x4 matrix \a value.
-
- \note This function is not aware of non square matrix support,
- that is, GLSL types like mat3x4, that is present in modern OpenGL
- versions. Instead, it treats the uniform as an array of vec4.
-
- \sa setAttributeValue()
-*/
-void QOpenGLShaderProgram::setUniformValue(const char *name, const QMatrix3x4& value)
-{
- setUniformValue(uniformLocation(name), value);
-}
-
-/*!
- Sets the uniform variable at \a location in the current context
- to a 4x2 matrix \a value.
-
- \note This function is not aware of non square matrix support,
- that is, GLSL types like mat4x2, that is present in modern OpenGL
- versions. Instead, it treats the uniform as an array of vec2.
-
- \sa setAttributeValue()
-*/
-void QOpenGLShaderProgram::setUniformValue(int location, const QMatrix4x2& value)
-{
- Q_D(QOpenGLShaderProgram);
- Q_UNUSED(d);
- d->glfuncs->glUniform2fv(location, 4, value.constData());
-}
-
-/*!
- \overload
-
- Sets the uniform variable called \a name in the current context
- to a 4x2 matrix \a value.
-
- \note This function is not aware of non square matrix support,
- that is, GLSL types like mat4x2, that is present in modern OpenGL
- versions. Instead, it treats the uniform as an array of vec2.
-
- \sa setAttributeValue()
-*/
-void QOpenGLShaderProgram::setUniformValue(const char *name, const QMatrix4x2& value)
-{
- setUniformValue(uniformLocation(name), value);
-}
-
-/*!
- Sets the uniform variable at \a location in the current context
- to a 4x3 matrix \a value.
-
- \note This function is not aware of non square matrix support,
- that is, GLSL types like mat4x3, that is present in modern OpenGL
- versions. Instead, it treats the uniform as an array of vec3.
-
- \sa setAttributeValue()
-*/
-void QOpenGLShaderProgram::setUniformValue(int location, const QMatrix4x3& value)
-{
- Q_D(QOpenGLShaderProgram);
- Q_UNUSED(d);
- d->glfuncs->glUniform3fv(location, 4, value.constData());
-}
-
-/*!
- \overload
-
- Sets the uniform variable called \a name in the current context
- to a 4x3 matrix \a value.
-
- \note This function is not aware of non square matrix support,
- that is, GLSL types like mat4x3, that is present in modern OpenGL
- versions. Instead, it treats the uniform as an array of vec3.
-
- \sa setAttributeValue()
-*/
-void QOpenGLShaderProgram::setUniformValue(const char *name, const QMatrix4x3& value)
-{
- setUniformValue(uniformLocation(name), value);
-}
-
-/*!
- Sets the uniform variable at \a location in the current context
- to a 4x4 matrix \a value.
-
- \sa setAttributeValue()
-*/
-void QOpenGLShaderProgram::setUniformValue(int location, const QMatrix4x4& value)
-{
- Q_D(QOpenGLShaderProgram);
- Q_UNUSED(d);
- d->glfuncs->glUniformMatrix4fv(location, 1, GL_FALSE, value.constData());
-}
-
-/*!
- \overload
-
- Sets the uniform variable called \a name in the current context
- to a 4x4 matrix \a value.
-
- \sa setAttributeValue()
-*/
-void QOpenGLShaderProgram::setUniformValue(const char *name, const QMatrix4x4& value)
-{
- setUniformValue(uniformLocation(name), value);
-}
-
-/*!
- \overload
-
- Sets the uniform variable at \a location in the current context
- to a 2x2 matrix \a value. The matrix elements must be specified
- in column-major order.
-
- \sa setAttributeValue()
-*/
-void QOpenGLShaderProgram::setUniformValue(int location, const GLfloat value[2][2])
-{
- Q_D(QOpenGLShaderProgram);
- Q_UNUSED(d);
- if (location != -1)
- d->glfuncs->glUniformMatrix2fv(location, 1, GL_FALSE, value[0]);
-}
-
-/*!
- \overload
-
- Sets the uniform variable at \a location in the current context
- to a 3x3 matrix \a value. The matrix elements must be specified
- in column-major order.
-
- \sa setAttributeValue()
-*/
-void QOpenGLShaderProgram::setUniformValue(int location, const GLfloat value[3][3])
-{
- Q_D(QOpenGLShaderProgram);
- Q_UNUSED(d);
- if (location != -1)
- d->glfuncs->glUniformMatrix3fv(location, 1, GL_FALSE, value[0]);
-}
-
-/*!
- \overload
-
- Sets the uniform variable at \a location in the current context
- to a 4x4 matrix \a value. The matrix elements must be specified
- in column-major order.
-
- \sa setAttributeValue()
-*/
-void QOpenGLShaderProgram::setUniformValue(int location, const GLfloat value[4][4])
-{
- Q_D(QOpenGLShaderProgram);
- Q_UNUSED(d);
- if (location != -1)
- d->glfuncs->glUniformMatrix4fv(location, 1, GL_FALSE, value[0]);
-}
-
-
-/*!
- \overload
-
- Sets the uniform variable called \a name in the current context
- to a 2x2 matrix \a value. The matrix elements must be specified
- in column-major order.
-
- \sa setAttributeValue()
-*/
-void QOpenGLShaderProgram::setUniformValue(const char *name, const GLfloat value[2][2])
-{
- setUniformValue(uniformLocation(name), value);
-}
-
-/*!
- \overload
-
- Sets the uniform variable called \a name in the current context
- to a 3x3 matrix \a value. The matrix elements must be specified
- in column-major order.
-
- \sa setAttributeValue()
-*/
-void QOpenGLShaderProgram::setUniformValue(const char *name, const GLfloat value[3][3])
-{
- setUniformValue(uniformLocation(name), value);
-}
-
-/*!
- \overload
-
- Sets the uniform variable called \a name in the current context
- to a 4x4 matrix \a value. The matrix elements must be specified
- in column-major order.
-
- \sa setAttributeValue()
-*/
-void QOpenGLShaderProgram::setUniformValue(const char *name, const GLfloat value[4][4])
-{
- setUniformValue(uniformLocation(name), value);
-}
-
-/*!
- Sets the uniform variable at \a location in the current context to a
- 3x3 transformation matrix \a value that is specified as a QTransform value.
-
- To set a QTransform value as a 4x4 matrix in a shader, use
- \c{setUniformValue(location, QMatrix4x4(value))}.
-*/
-void QOpenGLShaderProgram::setUniformValue(int location, const QTransform& value)
-{
- Q_D(QOpenGLShaderProgram);
- Q_UNUSED(d);
- if (location != -1) {
- GLfloat mat[3][3] = {
- {GLfloat(value.m11()), GLfloat(value.m12()), GLfloat(value.m13())},
- {GLfloat(value.m21()), GLfloat(value.m22()), GLfloat(value.m23())},
- {GLfloat(value.m31()), GLfloat(value.m32()), GLfloat(value.m33())}
- };
- d->glfuncs->glUniformMatrix3fv(location, 1, GL_FALSE, mat[0]);
- }
-}
-
-/*!
- \overload
-
- Sets the uniform variable called \a name in the current context to a
- 3x3 transformation matrix \a value that is specified as a QTransform value.
-
- To set a QTransform value as a 4x4 matrix in a shader, use
- \c{setUniformValue(name, QMatrix4x4(value))}.
-*/
-void QOpenGLShaderProgram::setUniformValue
- (const char *name, const QTransform& value)
-{
- setUniformValue(uniformLocation(name), value);
-}
-
-/*!
- Sets the uniform variable array at \a location in the current
- context to the \a count elements of \a values.
-
- \sa setAttributeValue()
-*/
-void QOpenGLShaderProgram::setUniformValueArray(int location, const GLint *values, int count)
-{
- Q_D(QOpenGLShaderProgram);
- Q_UNUSED(d);
- if (location != -1)
- d->glfuncs->glUniform1iv(location, count, values);
-}
-
-/*!
- \overload
-
- Sets the uniform variable array called \a name in the current
- context to the \a count elements of \a values.
-
- \sa setAttributeValue()
-*/
-void QOpenGLShaderProgram::setUniformValueArray
- (const char *name, const GLint *values, int count)
-{
- setUniformValueArray(uniformLocation(name), values, count);
-}
-
-/*!
- Sets the uniform variable array at \a location in the current
- context to the \a count elements of \a values. This overload
- should be used when setting an array of sampler values.
-
- \note This function is not aware of unsigned int support in modern OpenGL
- versions and therefore treats \a values as a GLint and calls glUniform1iv.
-
- \sa setAttributeValue()
-*/
-void QOpenGLShaderProgram::setUniformValueArray(int location, const GLuint *values, int count)
-{
- Q_D(QOpenGLShaderProgram);
- Q_UNUSED(d);
- if (location != -1)
- d->glfuncs->glUniform1iv(location, count, reinterpret_cast<const GLint *>(values));
-}
-
-/*!
- \overload
-
- Sets the uniform variable array called \a name in the current
- context to the \a count elements of \a values. This overload
- should be used when setting an array of sampler values.
-
- \sa setAttributeValue()
-*/
-void QOpenGLShaderProgram::setUniformValueArray
- (const char *name, const GLuint *values, int count)
-{
- setUniformValueArray(uniformLocation(name), values, count);
-}
-
-/*!
- Sets the uniform variable array at \a location in the current
- context to the \a count elements of \a values. Each element
- has \a tupleSize components. The \a tupleSize must be 1, 2, 3, or 4.
-
- \sa setAttributeValue()
-*/
-void QOpenGLShaderProgram::setUniformValueArray(int location, const GLfloat *values, int count, int tupleSize)
-{
- Q_D(QOpenGLShaderProgram);
- Q_UNUSED(d);
- if (location != -1) {
- if (tupleSize == 1)
- d->glfuncs->glUniform1fv(location, count, values);
- else if (tupleSize == 2)
- d->glfuncs->glUniform2fv(location, count, values);
- else if (tupleSize == 3)
- d->glfuncs->glUniform3fv(location, count, values);
- else if (tupleSize == 4)
- d->glfuncs->glUniform4fv(location, count, values);
- else
- qWarning("QOpenGLShaderProgram::setUniformValue: size %d not supported", tupleSize);
- }
-}
-
-/*!
- \overload
-
- Sets the uniform variable array called \a name in the current
- context to the \a count elements of \a values. Each element
- has \a tupleSize components. The \a tupleSize must be 1, 2, 3, or 4.
-
- \sa setAttributeValue()
-*/
-void QOpenGLShaderProgram::setUniformValueArray
- (const char *name, const GLfloat *values, int count, int tupleSize)
-{
- setUniformValueArray(uniformLocation(name), values, count, tupleSize);
-}
-
-/*!
- Sets the uniform variable array at \a location in the current
- context to the \a count 2D vector elements of \a values.
-
- \sa setAttributeValue()
-*/
-void QOpenGLShaderProgram::setUniformValueArray(int location, const QVector2D *values, int count)
-{
- Q_D(QOpenGLShaderProgram);
- Q_UNUSED(d);
- if (location != -1)
- d->glfuncs->glUniform2fv(location, count, reinterpret_cast<const GLfloat *>(values));
-}
-
-/*!
- \overload
-
- Sets the uniform variable array called \a name in the current
- context to the \a count 2D vector elements of \a values.
-
- \sa setAttributeValue()
-*/
-void QOpenGLShaderProgram::setUniformValueArray(const char *name, const QVector2D *values, int count)
-{
- setUniformValueArray(uniformLocation(name), values, count);
-}
-
-/*!
- Sets the uniform variable array at \a location in the current
- context to the \a count 3D vector elements of \a values.
-
- \sa setAttributeValue()
-*/
-void QOpenGLShaderProgram::setUniformValueArray(int location, const QVector3D *values, int count)
-{
- Q_D(QOpenGLShaderProgram);
- Q_UNUSED(d);
- if (location != -1)
- d->glfuncs->glUniform3fv(location, count, reinterpret_cast<const GLfloat *>(values));
-}
-
-/*!
- \overload
-
- Sets the uniform variable array called \a name in the current
- context to the \a count 3D vector elements of \a values.
-
- \sa setAttributeValue()
-*/
-void QOpenGLShaderProgram::setUniformValueArray(const char *name, const QVector3D *values, int count)
-{
- setUniformValueArray(uniformLocation(name), values, count);
-}
-
-/*!
- Sets the uniform variable array at \a location in the current
- context to the \a count 4D vector elements of \a values.
-
- \sa setAttributeValue()
-*/
-void QOpenGLShaderProgram::setUniformValueArray(int location, const QVector4D *values, int count)
-{
- Q_D(QOpenGLShaderProgram);
- Q_UNUSED(d);
- if (location != -1)
- d->glfuncs->glUniform4fv(location, count, reinterpret_cast<const GLfloat *>(values));
-}
-
-/*!
- \overload
-
- Sets the uniform variable array called \a name in the current
- context to the \a count 4D vector elements of \a values.
-
- \sa setAttributeValue()
-*/
-void QOpenGLShaderProgram::setUniformValueArray(const char *name, const QVector4D *values, int count)
-{
- setUniformValueArray(uniformLocation(name), values, count);
-}
-
-// We have to repack matrix arrays from qreal to GLfloat.
-#define setUniformMatrixArray(func,location,values,count,type,cols,rows) \
- if (location == -1 || count <= 0) \
- return; \
- if (sizeof(type) == sizeof(GLfloat) * cols * rows) { \
- func(location, count, GL_FALSE, \
- reinterpret_cast<const GLfloat *>(values[0].constData())); \
- } else { \
- QVarLengthArray<GLfloat> temp(cols * rows * count); \
- for (int index = 0; index < count; ++index) { \
- for (int index2 = 0; index2 < (cols * rows); ++index2) { \
- temp.data()[cols * rows * index + index2] = \
- values[index].constData()[index2]; \
- } \
- } \
- func(location, count, GL_FALSE, temp.constData()); \
- }
-#define setUniformGenericMatrixArray(colfunc,location,values,count,type,cols,rows) \
- if (location == -1 || count <= 0) \
- return; \
- if (sizeof(type) == sizeof(GLfloat) * cols * rows) { \
- const GLfloat *data = reinterpret_cast<const GLfloat *> \
- (values[0].constData()); \
- colfunc(location, count * cols, data); \
- } else { \
- QVarLengthArray<GLfloat> temp(cols * rows * count); \
- for (int index = 0; index < count; ++index) { \
- for (int index2 = 0; index2 < (cols * rows); ++index2) { \
- temp.data()[cols * rows * index + index2] = \
- values[index].constData()[index2]; \
- } \
- } \
- colfunc(location, count * cols, temp.constData()); \
- }
-
-/*!
- Sets the uniform variable array at \a location in the current
- context to the \a count 2x2 matrix elements of \a values.
-
- \sa setAttributeValue()
-*/
-void QOpenGLShaderProgram::setUniformValueArray(int location, const QMatrix2x2 *values, int count)
-{
- Q_D(QOpenGLShaderProgram);
- Q_UNUSED(d);
- setUniformMatrixArray
- (d->glfuncs->glUniformMatrix2fv, location, values, count, QMatrix2x2, 2, 2);
-}
-
-/*!
- \overload
-
- Sets the uniform variable array called \a name in the current
- context to the \a count 2x2 matrix elements of \a values.
-
- \sa setAttributeValue()
-*/
-void QOpenGLShaderProgram::setUniformValueArray(const char *name, const QMatrix2x2 *values, int count)
-{
- setUniformValueArray(uniformLocation(name), values, count);
-}
-
-/*!
- Sets the uniform variable array at \a location in the current
- context to the \a count 2x3 matrix elements of \a values.
-
- \sa setAttributeValue()
-*/
-void QOpenGLShaderProgram::setUniformValueArray(int location, const QMatrix2x3 *values, int count)
-{
- Q_D(QOpenGLShaderProgram);
- Q_UNUSED(d);
- setUniformGenericMatrixArray
- (d->glfuncs->glUniform3fv, location, values, count,
- QMatrix2x3, 2, 3);
-}
-
-/*!
- \overload
-
- Sets the uniform variable array called \a name in the current
- context to the \a count 2x3 matrix elements of \a values.
-
- \sa setAttributeValue()
-*/
-void QOpenGLShaderProgram::setUniformValueArray(const char *name, const QMatrix2x3 *values, int count)
-{
- setUniformValueArray(uniformLocation(name), values, count);
-}
-
-/*!
- Sets the uniform variable array at \a location in the current
- context to the \a count 2x4 matrix elements of \a values.
-
- \sa setAttributeValue()
-*/
-void QOpenGLShaderProgram::setUniformValueArray(int location, const QMatrix2x4 *values, int count)
-{
- Q_D(QOpenGLShaderProgram);
- Q_UNUSED(d);
- setUniformGenericMatrixArray
- (d->glfuncs->glUniform4fv, location, values, count,
- QMatrix2x4, 2, 4);
-}
-
-/*!
- \overload
-
- Sets the uniform variable array called \a name in the current
- context to the \a count 2x4 matrix elements of \a values.
-
- \sa setAttributeValue()
-*/
-void QOpenGLShaderProgram::setUniformValueArray(const char *name, const QMatrix2x4 *values, int count)
-{
- setUniformValueArray(uniformLocation(name), values, count);
-}
-
-/*!
- Sets the uniform variable array at \a location in the current
- context to the \a count 3x2 matrix elements of \a values.
-
- \sa setAttributeValue()
-*/
-void QOpenGLShaderProgram::setUniformValueArray(int location, const QMatrix3x2 *values, int count)
-{
- Q_D(QOpenGLShaderProgram);
- Q_UNUSED(d);
- setUniformGenericMatrixArray
- (d->glfuncs->glUniform2fv, location, values, count,
- QMatrix3x2, 3, 2);
-}
-
-/*!
- \overload
-
- Sets the uniform variable array called \a name in the current
- context to the \a count 3x2 matrix elements of \a values.
-
- \sa setAttributeValue()
-*/
-void QOpenGLShaderProgram::setUniformValueArray(const char *name, const QMatrix3x2 *values, int count)
-{
- setUniformValueArray(uniformLocation(name), values, count);
-}
-
-/*!
- Sets the uniform variable array at \a location in the current
- context to the \a count 3x3 matrix elements of \a values.
-
- \sa setAttributeValue()
-*/
-void QOpenGLShaderProgram::setUniformValueArray(int location, const QMatrix3x3 *values, int count)
-{
- Q_D(QOpenGLShaderProgram);
- Q_UNUSED(d);
- setUniformMatrixArray
- (d->glfuncs->glUniformMatrix3fv, location, values, count, QMatrix3x3, 3, 3);
-}
-
-/*!
- \overload
-
- Sets the uniform variable array called \a name in the current
- context to the \a count 3x3 matrix elements of \a values.
-
- \sa setAttributeValue()
-*/
-void QOpenGLShaderProgram::setUniformValueArray(const char *name, const QMatrix3x3 *values, int count)
-{
- setUniformValueArray(uniformLocation(name), values, count);
-}
-
-/*!
- Sets the uniform variable array at \a location in the current
- context to the \a count 3x4 matrix elements of \a values.
-
- \sa setAttributeValue()
-*/
-void QOpenGLShaderProgram::setUniformValueArray(int location, const QMatrix3x4 *values, int count)
-{
- Q_D(QOpenGLShaderProgram);
- Q_UNUSED(d);
- setUniformGenericMatrixArray
- (d->glfuncs->glUniform4fv, location, values, count,
- QMatrix3x4, 3, 4);
-}
-
-/*!
- \overload
-
- Sets the uniform variable array called \a name in the current
- context to the \a count 3x4 matrix elements of \a values.
-
- \sa setAttributeValue()
-*/
-void QOpenGLShaderProgram::setUniformValueArray(const char *name, const QMatrix3x4 *values, int count)
-{
- setUniformValueArray(uniformLocation(name), values, count);
-}
-
-/*!
- Sets the uniform variable array at \a location in the current
- context to the \a count 4x2 matrix elements of \a values.
-
- \sa setAttributeValue()
-*/
-void QOpenGLShaderProgram::setUniformValueArray(int location, const QMatrix4x2 *values, int count)
-{
- Q_D(QOpenGLShaderProgram);
- Q_UNUSED(d);
- setUniformGenericMatrixArray
- (d->glfuncs->glUniform2fv, location, values, count,
- QMatrix4x2, 4, 2);
-}
-
-/*!
- \overload
-
- Sets the uniform variable array called \a name in the current
- context to the \a count 4x2 matrix elements of \a values.
-
- \sa setAttributeValue()
-*/
-void QOpenGLShaderProgram::setUniformValueArray(const char *name, const QMatrix4x2 *values, int count)
-{
- setUniformValueArray(uniformLocation(name), values, count);
-}
-
-/*!
- Sets the uniform variable array at \a location in the current
- context to the \a count 4x3 matrix elements of \a values.
-
- \sa setAttributeValue()
-*/
-void QOpenGLShaderProgram::setUniformValueArray(int location, const QMatrix4x3 *values, int count)
-{
- Q_D(QOpenGLShaderProgram);
- Q_UNUSED(d);
- setUniformGenericMatrixArray
- (d->glfuncs->glUniform3fv, location, values, count,
- QMatrix4x3, 4, 3);
-}
-
-/*!
- \overload
-
- Sets the uniform variable array called \a name in the current
- context to the \a count 4x3 matrix elements of \a values.
-
- \sa setAttributeValue()
-*/
-void QOpenGLShaderProgram::setUniformValueArray(const char *name, const QMatrix4x3 *values, int count)
-{
- setUniformValueArray(uniformLocation(name), values, count);
-}
-
-/*!
- Sets the uniform variable array at \a location in the current
- context to the \a count 4x4 matrix elements of \a values.
-
- \sa setAttributeValue()
-*/
-void QOpenGLShaderProgram::setUniformValueArray(int location, const QMatrix4x4 *values, int count)
-{
- Q_D(QOpenGLShaderProgram);
- Q_UNUSED(d);
- setUniformMatrixArray
- (d->glfuncs->glUniformMatrix4fv, location, values, count, QMatrix4x4, 4, 4);
-}
-
-/*!
- \overload
-
- Sets the uniform variable array called \a name in the current
- context to the \a count 4x4 matrix elements of \a values.
-
- \sa setAttributeValue()
-*/
-void QOpenGLShaderProgram::setUniformValueArray(const char *name, const QMatrix4x4 *values, int count)
-{
- setUniformValueArray(uniformLocation(name), values, count);
-}
-
-/*!
- Returns the hardware limit for how many vertices a geometry shader
- can output.
-*/
-int QOpenGLShaderProgram::maxGeometryOutputVertices() const
-{
- GLint n = 0;
- Q_D(const QOpenGLShaderProgram);
- d->glfuncs->glGetIntegerv(GL_MAX_GEOMETRY_OUTPUT_VERTICES, &n);
- return n;
-}
-
-/*!
- Use this function to specify to OpenGL the number of vertices in
- a patch to \a count. A patch is a custom OpenGL primitive whose interpretation
- is entirely defined by the tessellation shader stages. Therefore, calling
- this function only makes sense when using a QOpenGLShaderProgram
- containing tessellation stage shaders. When using OpenGL tessellation,
- the only primitive that can be rendered with \c{glDraw*()} functions is
- \c{GL_PATCHES}.
-
- This is equivalent to calling glPatchParameteri(GL_PATCH_VERTICES, count).
-
- \note This modifies global OpenGL state and is not specific to this
- QOpenGLShaderProgram instance. You should call this in your render
- function when needed, as QOpenGLShaderProgram will not apply this for
- you. This is purely a convenience function.
-
- \sa patchVertexCount()
-*/
-void QOpenGLShaderProgram::setPatchVertexCount(int count)
-{
- Q_D(QOpenGLShaderProgram);
- d->glfuncs->glPatchParameteri(GL_PATCH_VERTICES, count);
-}
-
-/*!
- Returns the number of vertices per-patch to be used when rendering.
-
- \note This returns the global OpenGL state value. It is not specific to
- this QOpenGLShaderProgram instance.
-
- \sa setPatchVertexCount()
-*/
-int QOpenGLShaderProgram::patchVertexCount() const
-{
- int patchVertices = 0;
- Q_D(const QOpenGLShaderProgram);
- d->glfuncs->glGetIntegerv(GL_PATCH_VERTICES, &patchVertices);
- return patchVertices;
-}
-
-/*!
- Sets the default outer tessellation levels to be used by the tessellation
- primitive generator in the event that the tessellation control shader
- does not output them to \a levels. For more details on OpenGL and Tessellation
- shaders see \l{OpenGL Tessellation Shaders}.
-
- The \a levels argument should be a QVector consisting of 4 floats. Not all
- of the values make sense for all tessellation modes. If you specify a vector with
- fewer than 4 elements, the remaining elements will be given a default value of 1.
-
- \note This modifies global OpenGL state and is not specific to this
- QOpenGLShaderProgram instance. You should call this in your render
- function when needed, as QOpenGLShaderProgram will not apply this for
- you. This is purely a convenience function.
-
- \note This function is only available with OpenGL >= 4.0 and is not supported
- with OpenGL ES 3.2.
-
- \sa defaultOuterTessellationLevels(), setDefaultInnerTessellationLevels()
-*/
-void QOpenGLShaderProgram::setDefaultOuterTessellationLevels(const QVector<float> &levels)
-{
-#ifndef QT_OPENGL_ES_2
- Q_D(QOpenGLShaderProgram);
- if (d->tessellationFuncs) {
- QVector<float> tessLevels = levels;
-
- // Ensure we have the required 4 outer tessellation levels
- // Use default of 1 for missing entries (same as spec)
- const int argCount = 4;
- if (tessLevels.size() < argCount) {
- tessLevels.reserve(argCount);
- for (int i = tessLevels.size(); i < argCount; ++i)
- tessLevels.append(1.0f);
- }
- d->tessellationFuncs->glPatchParameterfv(GL_PATCH_DEFAULT_OUTER_LEVEL, tessLevels.data());
- }
-#else
- Q_UNUSED(levels);
-#endif
-}
-
-/*!
- Returns the default outer tessellation levels to be used by the tessellation
- primitive generator in the event that the tessellation control shader
- does not output them. For more details on OpenGL and Tessellation shaders see
- \l{OpenGL Tessellation Shaders}.
-
- Returns a QVector of floats describing the outer tessellation levels. The vector
- will always have four elements but not all of them make sense for every mode
- of tessellation.
-
- \note This returns the global OpenGL state value. It is not specific to
- this QOpenGLShaderProgram instance.
-
- \note This function is only supported with OpenGL >= 4.0 and will not
- return valid results with OpenGL ES 3.2.
-
- \sa setDefaultOuterTessellationLevels(), defaultInnerTessellationLevels()
-*/
-QVector<float> QOpenGLShaderProgram::defaultOuterTessellationLevels() const
-{
-#ifndef QT_OPENGL_ES_2
- QVector<float> tessLevels(4, 1.0f);
- Q_D(const QOpenGLShaderProgram);
- if (d->tessellationFuncs)
- d->tessellationFuncs->glGetFloatv(GL_PATCH_DEFAULT_OUTER_LEVEL, tessLevels.data());
- return tessLevels;
-#else
- return QVector<float>();
-#endif
-}
-
-/*!
- Sets the default outer tessellation levels to be used by the tessellation
- primitive generator in the event that the tessellation control shader
- does not output them to \a levels. For more details on OpenGL and Tessellation shaders see
- \l{OpenGL Tessellation Shaders}.
-
- The \a levels argument should be a QVector consisting of 2 floats. Not all
- of the values make sense for all tessellation modes. If you specify a vector with
- fewer than 2 elements, the remaining elements will be given a default value of 1.
-
- \note This modifies global OpenGL state and is not specific to this
- QOpenGLShaderProgram instance. You should call this in your render
- function when needed, as QOpenGLShaderProgram will not apply this for
- you. This is purely a convenience function.
-
- \note This function is only available with OpenGL >= 4.0 and is not supported
- with OpenGL ES 3.2.
-
- \sa defaultInnerTessellationLevels(), setDefaultOuterTessellationLevels()
-*/
-void QOpenGLShaderProgram::setDefaultInnerTessellationLevels(const QVector<float> &levels)
-{
-#ifndef QT_OPENGL_ES_2
- Q_D(QOpenGLShaderProgram);
- if (d->tessellationFuncs) {
- QVector<float> tessLevels = levels;
-
- // Ensure we have the required 2 inner tessellation levels
- // Use default of 1 for missing entries (same as spec)
- const int argCount = 2;
- if (tessLevels.size() < argCount) {
- tessLevels.reserve(argCount);
- for (int i = tessLevels.size(); i < argCount; ++i)
- tessLevels.append(1.0f);
- }
- d->tessellationFuncs->glPatchParameterfv(GL_PATCH_DEFAULT_INNER_LEVEL, tessLevels.data());
- }
-#else
- Q_UNUSED(levels);
-#endif
-}
-
-/*!
- Returns the default inner tessellation levels to be used by the tessellation
- primitive generator in the event that the tessellation control shader
- does not output them. For more details on OpenGL and Tessellation shaders see
- \l{OpenGL Tessellation Shaders}.
-
- Returns a QVector of floats describing the inner tessellation levels. The vector
- will always have two elements but not all of them make sense for every mode
- of tessellation.
-
- \note This returns the global OpenGL state value. It is not specific to
- this QOpenGLShaderProgram instance.
-
- \note This function is only supported with OpenGL >= 4.0 and will not
- return valid results with OpenGL ES 3.2.
-
- \sa setDefaultInnerTessellationLevels(), defaultOuterTessellationLevels()
-*/
-QVector<float> QOpenGLShaderProgram::defaultInnerTessellationLevels() const
-{
-#ifndef QT_OPENGL_ES_2
- QVector<float> tessLevels(2, 1.0f);
- Q_D(const QOpenGLShaderProgram);
- if (d->tessellationFuncs)
- d->tessellationFuncs->glGetFloatv(GL_PATCH_DEFAULT_INNER_LEVEL, tessLevels.data());
- return tessLevels;
-#else
- return QVector<float>();
-#endif
-}
-
-
-/*!
- Returns \c true if shader programs written in the OpenGL Shading
- Language (GLSL) are supported on this system; false otherwise.
-
- The \a context is used to resolve the GLSL extensions.
- If \a context is \nullptr, then QOpenGLContext::currentContext()
- is used.
-*/
-bool QOpenGLShaderProgram::hasOpenGLShaderPrograms(QOpenGLContext *context)
-{
- if (!context)
- context = QOpenGLContext::currentContext();
- if (!context)
- return false;
- return QOpenGLFunctions(context).hasOpenGLFeature(QOpenGLFunctions::Shaders);
-}
-
-/*!
- \internal
-*/
-void QOpenGLShaderProgram::shaderDestroyed()
-{
- Q_D(QOpenGLShaderProgram);
- QOpenGLShader *shader = qobject_cast<QOpenGLShader *>(sender());
- if (shader && !d->removingShaders)
- removeShader(shader);
-}
-
-/*!
- Returns \c true if shader programs of type \a type are supported on
- this system; false otherwise.
-
- The \a context is used to resolve the GLSL extensions.
- If \a context is \nullptr, then QOpenGLContext::currentContext()
- is used.
-*/
-bool QOpenGLShader::hasOpenGLShaders(ShaderType type, QOpenGLContext *context)
-{
- if (!context)
- context = QOpenGLContext::currentContext();
- if (!context)
- return false;
-
- if ((type & ~(Geometry | Vertex | Fragment | TessellationControl | TessellationEvaluation | Compute)) || type == 0)
- return false;
-
- if (type & QOpenGLShader::Geometry)
- return supportsGeometry(context->format());
- else if (type & (QOpenGLShader::TessellationControl | QOpenGLShader::TessellationEvaluation))
- return supportsTessellation(context->format());
- else if (type & QOpenGLShader::Compute)
- return supportsCompute(context->format());
-
- // Unconditional support of vertex and fragment shaders implicitly assumes
- // a minimum OpenGL version of 2.0
- return true;
-}
-
-bool QOpenGLShaderProgramPrivate::isCacheDisabled() const
-{
- static QOpenGLProgramBinarySupportCheckWrapper binSupportCheck;
- return !binSupportCheck.get(QOpenGLContext::currentContext())->isSupported();
-}
-
-bool QOpenGLShaderProgramPrivate::compileCacheable()
-{
- Q_Q(QOpenGLShaderProgram);
- for (const QOpenGLProgramBinaryCache::ShaderDesc &shader : qAsConst(binaryProgram.shaders)) {
- QScopedPointer<QOpenGLShader> s(new QOpenGLShader(qt_shaderStageToType(shader.stage), q));
- if (!s->compileSourceCode(shader.source)) {
- log = s->log();
- return false;
- }
- anonShaders.append(s.take());
- if (!q->addShader(anonShaders.last()))
- return false;
- }
- return true;
-}
-
-bool QOpenGLShaderProgramPrivate::linkBinary()
-{
- static QOpenGLProgramBinaryCache binCache;
-
- Q_Q(QOpenGLShaderProgram);
-
- const QByteArray cacheKey = binaryProgram.cacheKey();
- if (lcOpenGLProgramDiskCache().isEnabled(QtDebugMsg))
- qCDebug(lcOpenGLProgramDiskCache, "program with %d shaders, cache key %s",
- binaryProgram.shaders.count(), cacheKey.constData());
-
- bool needsCompile = true;
- if (binCache.load(cacheKey, q->programId())) {
- qCDebug(lcOpenGLProgramDiskCache, "Program binary received from cache");
- needsCompile = false;
- }
-
- bool needsSave = false;
- if (needsCompile) {
- qCDebug(lcOpenGLProgramDiskCache, "Program binary not in cache, compiling");
- if (compileCacheable())
- needsSave = true;
- else
- return false;
- }
-
- linkBinaryRecursion = true;
- bool ok = q->link();
- linkBinaryRecursion = false;
- if (ok && needsSave)
- binCache.save(cacheKey, q->programId());
-
- return ok;
-}
-
-QT_END_NAMESPACE
diff --git a/src/gui/opengl/qopenglshaderprogram.h b/src/gui/opengl/qopenglshaderprogram.h
deleted file mode 100644
index c79101fd4d..0000000000
--- a/src/gui/opengl/qopenglshaderprogram.h
+++ /dev/null
@@ -1,318 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the QtGui module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef QOPENGLSHADERPROGRAM_H
-#define QOPENGLSHADERPROGRAM_H
-
-#include <QtGui/qtguiglobal.h>
-
-#ifndef QT_NO_OPENGL
-
-#include <QtGui/qopengl.h>
-#include <QtGui/qvector2d.h>
-#include <QtGui/qvector3d.h>
-#include <QtGui/qvector4d.h>
-#include <QtGui/qmatrix4x4.h>
-
-QT_BEGIN_NAMESPACE
-
-
-class QOpenGLContext;
-class QOpenGLShaderProgram;
-class QOpenGLShaderPrivate;
-
-class Q_GUI_EXPORT QOpenGLShader : public QObject
-{
- Q_OBJECT
-public:
- enum ShaderTypeBit
- {
- Vertex = 0x0001,
- Fragment = 0x0002,
- Geometry = 0x0004,
- TessellationControl = 0x0008,
- TessellationEvaluation = 0x0010,
- Compute = 0x0020
- };
- Q_DECLARE_FLAGS(ShaderType, ShaderTypeBit)
-
- explicit QOpenGLShader(QOpenGLShader::ShaderType type, QObject *parent = nullptr);
- ~QOpenGLShader();
-
- QOpenGLShader::ShaderType shaderType() const;
-
- bool compileSourceCode(const char *source);
- bool compileSourceCode(const QByteArray& source);
- bool compileSourceCode(const QString& source);
- bool compileSourceFile(const QString& fileName);
-
- QByteArray sourceCode() const;
-
- bool isCompiled() const;
- QString log() const;
-
- GLuint shaderId() const;
-
- static bool hasOpenGLShaders(ShaderType type, QOpenGLContext *context = nullptr);
-
-private:
- friend class QOpenGLShaderProgram;
-
- Q_DISABLE_COPY(QOpenGLShader)
- Q_DECLARE_PRIVATE(QOpenGLShader)
-};
-
-Q_DECLARE_OPERATORS_FOR_FLAGS(QOpenGLShader::ShaderType)
-
-
-class QOpenGLShaderProgramPrivate;
-
-class Q_GUI_EXPORT QOpenGLShaderProgram : public QObject
-{
- Q_OBJECT
-public:
- explicit QOpenGLShaderProgram(QObject *parent = nullptr);
- ~QOpenGLShaderProgram();
-
- bool addShader(QOpenGLShader *shader);
- void removeShader(QOpenGLShader *shader);
- QList<QOpenGLShader *> shaders() const;
-
- bool addShaderFromSourceCode(QOpenGLShader::ShaderType type, const char *source);
- bool addShaderFromSourceCode(QOpenGLShader::ShaderType type, const QByteArray& source);
- bool addShaderFromSourceCode(QOpenGLShader::ShaderType type, const QString& source);
- bool addShaderFromSourceFile(QOpenGLShader::ShaderType type, const QString& fileName);
-
- bool addCacheableShaderFromSourceCode(QOpenGLShader::ShaderType type, const char *source);
- bool addCacheableShaderFromSourceCode(QOpenGLShader::ShaderType type, const QByteArray &source);
- bool addCacheableShaderFromSourceCode(QOpenGLShader::ShaderType type, const QString &source);
- bool addCacheableShaderFromSourceFile(QOpenGLShader::ShaderType type, const QString &fileName);
-
- void removeAllShaders();
-
- virtual bool link();
- bool isLinked() const;
- QString log() const;
-
- bool bind();
- void release();
-
- bool create();
-
- GLuint programId() const;
-
- int maxGeometryOutputVertices() const;
-
- void setPatchVertexCount(int count);
- int patchVertexCount() const;
-
- void setDefaultOuterTessellationLevels(const QVector<float> &levels);
- QVector<float> defaultOuterTessellationLevels() const;
-
- void setDefaultInnerTessellationLevels(const QVector<float> &levels);
- QVector<float> defaultInnerTessellationLevels() const;
-
- void bindAttributeLocation(const char *name, int location);
- void bindAttributeLocation(const QByteArray& name, int location);
- void bindAttributeLocation(const QString& name, int location);
-
- int attributeLocation(const char *name) const;
- int attributeLocation(const QByteArray& name) const;
- int attributeLocation(const QString& name) const;
-
- void setAttributeValue(int location, GLfloat value);
- void setAttributeValue(int location, GLfloat x, GLfloat y);
- void setAttributeValue(int location, GLfloat x, GLfloat y, GLfloat z);
- void setAttributeValue(int location, GLfloat x, GLfloat y, GLfloat z, GLfloat w);
- void setAttributeValue(int location, const QVector2D& value);
- void setAttributeValue(int location, const QVector3D& value);
- void setAttributeValue(int location, const QVector4D& value);
- void setAttributeValue(int location, const QColor& value);
- void setAttributeValue(int location, const GLfloat *values, int columns, int rows);
-
- void setAttributeValue(const char *name, GLfloat value);
- void setAttributeValue(const char *name, GLfloat x, GLfloat y);
- void setAttributeValue(const char *name, GLfloat x, GLfloat y, GLfloat z);
- void setAttributeValue(const char *name, GLfloat x, GLfloat y, GLfloat z, GLfloat w);
- void setAttributeValue(const char *name, const QVector2D& value);
- void setAttributeValue(const char *name, const QVector3D& value);
- void setAttributeValue(const char *name, const QVector4D& value);
- void setAttributeValue(const char *name, const QColor& value);
- void setAttributeValue(const char *name, const GLfloat *values, int columns, int rows);
-
- void setAttributeArray
- (int location, const GLfloat *values, int tupleSize, int stride = 0);
- void setAttributeArray
- (int location, const QVector2D *values, int stride = 0);
- void setAttributeArray
- (int location, const QVector3D *values, int stride = 0);
- void setAttributeArray
- (int location, const QVector4D *values, int stride = 0);
- void setAttributeArray
- (int location, GLenum type, const void *values, int tupleSize, int stride = 0);
- void setAttributeArray
- (const char *name, const GLfloat *values, int tupleSize, int stride = 0);
- void setAttributeArray
- (const char *name, const QVector2D *values, int stride = 0);
- void setAttributeArray
- (const char *name, const QVector3D *values, int stride = 0);
- void setAttributeArray
- (const char *name, const QVector4D *values, int stride = 0);
- void setAttributeArray
- (const char *name, GLenum type, const void *values, int tupleSize, int stride = 0);
-
- void setAttributeBuffer
- (int location, GLenum type, int offset, int tupleSize, int stride = 0);
- void setAttributeBuffer
- (const char *name, GLenum type, int offset, int tupleSize, int stride = 0);
-
- void enableAttributeArray(int location);
- void enableAttributeArray(const char *name);
- void disableAttributeArray(int location);
- void disableAttributeArray(const char *name);
-
- int uniformLocation(const char *name) const;
- int uniformLocation(const QByteArray& name) const;
- int uniformLocation(const QString& name) const;
-
- void setUniformValue(int location, GLfloat value);
- void setUniformValue(int location, GLint value);
- void setUniformValue(int location, GLuint value);
- void setUniformValue(int location, GLfloat x, GLfloat y);
- void setUniformValue(int location, GLfloat x, GLfloat y, GLfloat z);
- void setUniformValue(int location, GLfloat x, GLfloat y, GLfloat z, GLfloat w);
- void setUniformValue(int location, const QVector2D& value);
- void setUniformValue(int location, const QVector3D& value);
- void setUniformValue(int location, const QVector4D& value);
- void setUniformValue(int location, const QColor& color);
- void setUniformValue(int location, const QPoint& point);
- void setUniformValue(int location, const QPointF& point);
- void setUniformValue(int location, const QSize& size);
- void setUniformValue(int location, const QSizeF& size);
- void setUniformValue(int location, const QMatrix2x2& value);
- void setUniformValue(int location, const QMatrix2x3& value);
- void setUniformValue(int location, const QMatrix2x4& value);
- void setUniformValue(int location, const QMatrix3x2& value);
- void setUniformValue(int location, const QMatrix3x3& value);
- void setUniformValue(int location, const QMatrix3x4& value);
- void setUniformValue(int location, const QMatrix4x2& value);
- void setUniformValue(int location, const QMatrix4x3& value);
- void setUniformValue(int location, const QMatrix4x4& value);
- void setUniformValue(int location, const GLfloat value[2][2]);
- void setUniformValue(int location, const GLfloat value[3][3]);
- void setUniformValue(int location, const GLfloat value[4][4]);
- void setUniformValue(int location, const QTransform& value);
-
- void setUniformValue(const char *name, GLfloat value);
- void setUniformValue(const char *name, GLint value);
- void setUniformValue(const char *name, GLuint value);
- void setUniformValue(const char *name, GLfloat x, GLfloat y);
- void setUniformValue(const char *name, GLfloat x, GLfloat y, GLfloat z);
- void setUniformValue(const char *name, GLfloat x, GLfloat y, GLfloat z, GLfloat w);
- void setUniformValue(const char *name, const QVector2D& value);
- void setUniformValue(const char *name, const QVector3D& value);
- void setUniformValue(const char *name, const QVector4D& value);
- void setUniformValue(const char *name, const QColor& color);
- void setUniformValue(const char *name, const QPoint& point);
- void setUniformValue(const char *name, const QPointF& point);
- void setUniformValue(const char *name, const QSize& size);
- void setUniformValue(const char *name, const QSizeF& size);
- void setUniformValue(const char *name, const QMatrix2x2& value);
- void setUniformValue(const char *name, const QMatrix2x3& value);
- void setUniformValue(const char *name, const QMatrix2x4& value);
- void setUniformValue(const char *name, const QMatrix3x2& value);
- void setUniformValue(const char *name, const QMatrix3x3& value);
- void setUniformValue(const char *name, const QMatrix3x4& value);
- void setUniformValue(const char *name, const QMatrix4x2& value);
- void setUniformValue(const char *name, const QMatrix4x3& value);
- void setUniformValue(const char *name, const QMatrix4x4& value);
- void setUniformValue(const char *name, const GLfloat value[2][2]);
- void setUniformValue(const char *name, const GLfloat value[3][3]);
- void setUniformValue(const char *name, const GLfloat value[4][4]);
- void setUniformValue(const char *name, const QTransform& value);
-
- void setUniformValueArray(int location, const GLfloat *values, int count, int tupleSize);
- void setUniformValueArray(int location, const GLint *values, int count);
- void setUniformValueArray(int location, const GLuint *values, int count);
- void setUniformValueArray(int location, const QVector2D *values, int count);
- void setUniformValueArray(int location, const QVector3D *values, int count);
- void setUniformValueArray(int location, const QVector4D *values, int count);
- void setUniformValueArray(int location, const QMatrix2x2 *values, int count);
- void setUniformValueArray(int location, const QMatrix2x3 *values, int count);
- void setUniformValueArray(int location, const QMatrix2x4 *values, int count);
- void setUniformValueArray(int location, const QMatrix3x2 *values, int count);
- void setUniformValueArray(int location, const QMatrix3x3 *values, int count);
- void setUniformValueArray(int location, const QMatrix3x4 *values, int count);
- void setUniformValueArray(int location, const QMatrix4x2 *values, int count);
- void setUniformValueArray(int location, const QMatrix4x3 *values, int count);
- void setUniformValueArray(int location, const QMatrix4x4 *values, int count);
-
- void setUniformValueArray(const char *name, const GLfloat *values, int count, int tupleSize);
- void setUniformValueArray(const char *name, const GLint *values, int count);
- void setUniformValueArray(const char *name, const GLuint *values, int count);
- void setUniformValueArray(const char *name, const QVector2D *values, int count);
- void setUniformValueArray(const char *name, const QVector3D *values, int count);
- void setUniformValueArray(const char *name, const QVector4D *values, int count);
- void setUniformValueArray(const char *name, const QMatrix2x2 *values, int count);
- void setUniformValueArray(const char *name, const QMatrix2x3 *values, int count);
- void setUniformValueArray(const char *name, const QMatrix2x4 *values, int count);
- void setUniformValueArray(const char *name, const QMatrix3x2 *values, int count);
- void setUniformValueArray(const char *name, const QMatrix3x3 *values, int count);
- void setUniformValueArray(const char *name, const QMatrix3x4 *values, int count);
- void setUniformValueArray(const char *name, const QMatrix4x2 *values, int count);
- void setUniformValueArray(const char *name, const QMatrix4x3 *values, int count);
- void setUniformValueArray(const char *name, const QMatrix4x4 *values, int count);
-
- static bool hasOpenGLShaderPrograms(QOpenGLContext *context = nullptr);
-
-private Q_SLOTS:
- void shaderDestroyed();
-
-private:
- Q_DISABLE_COPY(QOpenGLShaderProgram)
- Q_DECLARE_PRIVATE(QOpenGLShaderProgram)
-
- bool init();
-};
-
-QT_END_NAMESPACE
-
-#endif // QT_NO_OPENGL
-
-#endif
diff --git a/src/gui/opengl/qopengltexture.cpp b/src/gui/opengl/qopengltexture.cpp
deleted file mode 100644
index fd282e3ba0..0000000000
--- a/src/gui/opengl/qopengltexture.cpp
+++ /dev/null
@@ -1,4986 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2013 Klaralvdalens Datakonsult AB (KDAB).
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the QtGui module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "qopengltexture.h"
-#include "qopengltexture_p.h"
-#include "qopengltexturehelper_p.h"
-#include "qopenglfunctions.h"
-#include <QtGui/qcolor.h>
-#include <QtGui/qopenglcontext.h>
-#include <QtCore/qdebug.h>
-#include <private/qobject_p.h>
-#include <private/qopenglcontext_p.h>
-
-QT_BEGIN_NAMESPACE
-
-//this is to work around GL_TEXTURE_WRAP_R_OES which also has 0x8072 as value
-#if !defined(GL_TEXTURE_WRAP_R)
- #define GL_TEXTURE_WRAP_R 0x8072
-#endif
-
-QOpenGLTexturePrivate::QOpenGLTexturePrivate(QOpenGLTexture::Target textureTarget,
- QOpenGLTexture *qq)
- : q_ptr(qq),
- context(nullptr),
- target(textureTarget),
- textureId(0),
- format(QOpenGLTexture::NoFormat),
- formatClass(QOpenGLTexture::NoFormatClass),
- requestedMipLevels(1),
- mipLevels(-1),
- layers(1),
- faces(1),
- samples(0),
- fixedSamplePositions(true),
- baseLevel(0),
- maxLevel(1000),
- depthStencilMode(QOpenGLTexture::DepthMode),
- comparisonFunction(QOpenGLTexture::CompareLessEqual),
- comparisonMode(QOpenGLTexture::CompareNone),
- minFilter(QOpenGLTexture::Nearest),
- magFilter(QOpenGLTexture::Nearest),
- maxAnisotropy(1.0f),
- minLevelOfDetail(-1000.0f),
- maxLevelOfDetail(1000.0f),
- levelOfDetailBias(0.0f),
- textureView(false),
- autoGenerateMipMaps(true),
- storageAllocated(false),
- texFuncs(nullptr),
- functions(nullptr)
-{
- dimensions[0] = dimensions[1] = dimensions[2] = 1;
-
- switch (target) {
- case QOpenGLTexture::Target1D:
- bindingTarget = QOpenGLTexture::BindingTarget1D;
- break;
- case QOpenGLTexture::Target1DArray:
- bindingTarget = QOpenGLTexture::BindingTarget1DArray;
- break;
- case QOpenGLTexture::Target2D:
- bindingTarget = QOpenGLTexture::BindingTarget2D;
- break;
- case QOpenGLTexture::Target2DArray:
- bindingTarget = QOpenGLTexture::BindingTarget2DArray;
- break;
- case QOpenGLTexture::Target3D:
- bindingTarget = QOpenGLTexture::BindingTarget3D;
- break;
- case QOpenGLTexture::TargetCubeMap:
- bindingTarget = QOpenGLTexture::BindingTargetCubeMap;
- faces = 6;
- break;
- case QOpenGLTexture::TargetCubeMapArray:
- bindingTarget = QOpenGLTexture::BindingTargetCubeMapArray;
- faces = 6;
- break;
- case QOpenGLTexture::Target2DMultisample:
- bindingTarget = QOpenGLTexture::BindingTarget2DMultisample;
- break;
- case QOpenGLTexture::Target2DMultisampleArray:
- bindingTarget = QOpenGLTexture::BindingTarget2DMultisampleArray;
- break;
- case QOpenGLTexture::TargetRectangle:
- bindingTarget = QOpenGLTexture::BindingTargetRectangle;
- break;
- case QOpenGLTexture::TargetBuffer:
- bindingTarget = QOpenGLTexture::BindingTargetBuffer;
- break;
- }
-
- swizzleMask[0] = QOpenGLTexture::RedValue;
- swizzleMask[1] = QOpenGLTexture::GreenValue;
- swizzleMask[2] = QOpenGLTexture::BlueValue;
- swizzleMask[3] = QOpenGLTexture::AlphaValue;
-
- wrapModes[0] = wrapModes[1] = wrapModes[2] = target == QOpenGLTexture::TargetRectangle
- ? QOpenGLTexture::ClampToEdge : QOpenGLTexture::Repeat;
-}
-
-QOpenGLTexturePrivate::~QOpenGLTexturePrivate()
-{
- destroy();
-}
-
-void QOpenGLTexturePrivate::initializeOpenGLFunctions()
-{
- // If we already have a functions object, there is nothing to do
- if (texFuncs)
- return;
-
- // See if the context already has a suitable resource we can use.
- // If not create a functions object and add it to the context in case
- // others wish to use it too
- texFuncs = context->textureFunctions();
- if (!texFuncs) {
- texFuncs = new QOpenGLTextureHelper(context);
- context->setTextureFunctions(texFuncs);
- }
-}
-
-bool QOpenGLTexturePrivate::create()
-{
- if (textureId != 0)
- return true;
-
- QOpenGLContext *ctx = QOpenGLContext::currentContext();
- if (!ctx) {
- qWarning("Requires a valid current OpenGL context.\n"
- "Texture has not been created");
- return false;
- }
- context = ctx;
- functions = ctx->functions();
-
- // Resolve any functions we will need based upon context version and create the texture
- initializeOpenGLFunctions();
-
- // What features do we have?
- QOpenGLTexture::Feature feature = QOpenGLTexture::ImmutableStorage;
- while (feature != QOpenGLTexture::MaxFeatureFlag) {
- if (QOpenGLTexture::hasFeature(feature))
- features |= feature;
- feature = static_cast<QOpenGLTexture::Feature>(feature << 1);
- }
-
- functions->glGenTextures(1, &textureId);
- return textureId != 0;
-}
-
-void QOpenGLTexturePrivate::destroy()
-{
- if (!textureId) {
- // not created or already destroyed
- return;
- }
- QOpenGLContext *currentContext = QOpenGLContext::currentContext();
- if (!currentContext) {
- qWarning("QOpenGLTexturePrivate::destroy() called without a current context.\n"
- "Texture has not been destroyed");
- return;
- }
- if (!QOpenGLContext::areSharing(currentContext, context)) {
-
- qWarning("QOpenGLTexturePrivate::destroy() called but texture context %p"
- " is not shared with current context %p.\n"
- "Texture has not been destroyed",
- static_cast<const void *>(context),
- static_cast<const void *>(currentContext));
- return;
- }
-
- functions->glDeleteTextures(1, &textureId);
-
- context = nullptr;
- functions = nullptr;
- textureId = 0;
- format = QOpenGLTexture::NoFormat;
- formatClass = QOpenGLTexture::NoFormatClass;
- requestedMipLevels = 1;
- mipLevels = -1;
- layers = 1;
- faces = 1;
- samples = 0;
- fixedSamplePositions = true,
- baseLevel = 0;
- maxLevel = 1000;
- depthStencilMode = QOpenGLTexture::DepthMode;
- minFilter = QOpenGLTexture::Nearest;
- magFilter = QOpenGLTexture::Nearest;
- maxAnisotropy = 1.0f;
- minLevelOfDetail = -1000.0f;
- maxLevelOfDetail = 1000.0f;
- levelOfDetailBias = 0.0f;
- textureView = false;
- autoGenerateMipMaps = true;
- storageAllocated = false;
- texFuncs = nullptr;
-
- swizzleMask[0] = QOpenGLTexture::RedValue;
- swizzleMask[1] = QOpenGLTexture::GreenValue;
- swizzleMask[2] = QOpenGLTexture::BlueValue;
- swizzleMask[3] = QOpenGLTexture::AlphaValue;
-
- wrapModes[0] = wrapModes[1] = wrapModes[2] = target == QOpenGLTexture::TargetRectangle
- ? QOpenGLTexture::ClampToEdge : QOpenGLTexture::Repeat;
-}
-
-void QOpenGLTexturePrivate::bind()
-{
- functions->glBindTexture(target, textureId);
-}
-
-void QOpenGLTexturePrivate::bind(uint unit, QOpenGLTexture::TextureUnitReset reset)
-{
- GLint oldTextureUnit = 0;
- if (reset == QOpenGLTexture::ResetTextureUnit)
- functions->glGetIntegerv(GL_ACTIVE_TEXTURE, &oldTextureUnit);
-
- texFuncs->glActiveTexture(GL_TEXTURE0 + unit);
- functions->glBindTexture(target, textureId);
-
- if (reset == QOpenGLTexture::ResetTextureUnit)
- texFuncs->glActiveTexture(GL_TEXTURE0 + oldTextureUnit);
-}
-
-void QOpenGLTexturePrivate::release()
-{
- functions->glBindTexture(target, 0);
-}
-
-void QOpenGLTexturePrivate::release(uint unit, QOpenGLTexture::TextureUnitReset reset)
-{
- GLint oldTextureUnit = 0;
- if (reset == QOpenGLTexture::ResetTextureUnit)
- functions->glGetIntegerv(GL_ACTIVE_TEXTURE, &oldTextureUnit);
-
- texFuncs->glActiveTexture(GL_TEXTURE0 + unit);
- functions->glBindTexture(target, 0);
-
- if (reset == QOpenGLTexture::ResetTextureUnit)
- texFuncs->glActiveTexture(GL_TEXTURE0 + oldTextureUnit);
-}
-
-bool QOpenGLTexturePrivate::isBound() const
-{
- GLint boundTextureId = 0;
- functions->glGetIntegerv(bindingTarget, &boundTextureId);
- return (static_cast<GLuint>(boundTextureId) == textureId);
-}
-
-bool QOpenGLTexturePrivate::isBound(uint unit) const
-{
- GLint oldTextureUnit = 0;
- functions->glGetIntegerv(GL_ACTIVE_TEXTURE, &oldTextureUnit);
-
- GLint boundTextureId = 0;
- texFuncs->glActiveTexture(GL_TEXTURE0 + unit);
- functions->glGetIntegerv(bindingTarget, &boundTextureId);
- bool result = (static_cast<GLuint>(boundTextureId) == textureId);
-
- texFuncs->glActiveTexture(GL_TEXTURE0 + oldTextureUnit);
- return result;
-}
-
-int QOpenGLTexturePrivate::evaluateMipLevels() const
-{
- switch (target) {
- case QOpenGLTexture::Target1D:
- case QOpenGLTexture::Target1DArray:
- case QOpenGLTexture::Target2D:
- case QOpenGLTexture::Target2DArray:
- case QOpenGLTexture::Target3D:
- case QOpenGLTexture::TargetCubeMap:
- case QOpenGLTexture::TargetCubeMapArray:
- return qMin(maximumMipLevelCount(), qMax(1, requestedMipLevels));
-
- case QOpenGLTexture::TargetRectangle:
- case QOpenGLTexture::Target2DMultisample:
- case QOpenGLTexture::Target2DMultisampleArray:
- case QOpenGLTexture::TargetBuffer:
- default:
- return 1;
- }
-}
-
-static bool isSizedTextureFormat(QOpenGLTexture::TextureFormat internalFormat)
-{
- switch (internalFormat) {
- case QOpenGLTexture::NoFormat:
- return false;
-
- case QOpenGLTexture::R8_UNorm:
- case QOpenGLTexture::RG8_UNorm:
- case QOpenGLTexture::RGB8_UNorm:
- case QOpenGLTexture::RGBA8_UNorm:
- case QOpenGLTexture::R16_UNorm:
- case QOpenGLTexture::RG16_UNorm:
- case QOpenGLTexture::RGB16_UNorm:
- case QOpenGLTexture::RGBA16_UNorm:
- case QOpenGLTexture::R8_SNorm:
- case QOpenGLTexture::RG8_SNorm:
- case QOpenGLTexture::RGB8_SNorm:
- case QOpenGLTexture::RGBA8_SNorm:
- case QOpenGLTexture::R16_SNorm:
- case QOpenGLTexture::RG16_SNorm:
- case QOpenGLTexture::RGB16_SNorm:
- case QOpenGLTexture::RGBA16_SNorm:
- case QOpenGLTexture::R8U:
- case QOpenGLTexture::RG8U:
- case QOpenGLTexture::RGB8U:
- case QOpenGLTexture::RGBA8U:
- case QOpenGLTexture::R16U:
- case QOpenGLTexture::RG16U:
- case QOpenGLTexture::RGB16U:
- case QOpenGLTexture::RGBA16U:
- case QOpenGLTexture::R32U:
- case QOpenGLTexture::RG32U:
- case QOpenGLTexture::RGB32U:
- case QOpenGLTexture::RGBA32U:
- case QOpenGLTexture::R8I:
- case QOpenGLTexture::RG8I:
- case QOpenGLTexture::RGB8I:
- case QOpenGLTexture::RGBA8I:
- case QOpenGLTexture::R16I:
- case QOpenGLTexture::RG16I:
- case QOpenGLTexture::RGB16I:
- case QOpenGLTexture::RGBA16I:
- case QOpenGLTexture::R32I:
- case QOpenGLTexture::RG32I:
- case QOpenGLTexture::RGB32I:
- case QOpenGLTexture::RGBA32I:
- case QOpenGLTexture::R16F:
- case QOpenGLTexture::RG16F:
- case QOpenGLTexture::RGB16F:
- case QOpenGLTexture::RGBA16F:
- case QOpenGLTexture::R32F:
- case QOpenGLTexture::RG32F:
- case QOpenGLTexture::RGB32F:
- case QOpenGLTexture::RGBA32F:
- case QOpenGLTexture::RGB9E5:
- case QOpenGLTexture::RG11B10F:
- case QOpenGLTexture::RG3B2:
- case QOpenGLTexture::R5G6B5:
- case QOpenGLTexture::RGB5A1:
- case QOpenGLTexture::RGBA4:
- case QOpenGLTexture::RGB10A2:
-
- case QOpenGLTexture::D16:
- case QOpenGLTexture::D24:
- case QOpenGLTexture::D32:
- case QOpenGLTexture::D32F:
-
- case QOpenGLTexture::D24S8:
- case QOpenGLTexture::D32FS8X24:
-
- case QOpenGLTexture::S8:
-
- case QOpenGLTexture::RGB_DXT1:
- case QOpenGLTexture::RGBA_DXT1:
- case QOpenGLTexture::RGBA_DXT3:
- case QOpenGLTexture::RGBA_DXT5:
- case QOpenGLTexture::R_ATI1N_UNorm:
- case QOpenGLTexture::R_ATI1N_SNorm:
- case QOpenGLTexture::RG_ATI2N_UNorm:
- case QOpenGLTexture::RG_ATI2N_SNorm:
- case QOpenGLTexture::RGB_BP_UNSIGNED_FLOAT:
- case QOpenGLTexture::RGB_BP_SIGNED_FLOAT:
- case QOpenGLTexture::RGB_BP_UNorm:
- case QOpenGLTexture::SRGB8:
- case QOpenGLTexture::SRGB8_Alpha8:
- case QOpenGLTexture::SRGB_DXT1:
- case QOpenGLTexture::SRGB_Alpha_DXT1:
- case QOpenGLTexture::SRGB_Alpha_DXT3:
- case QOpenGLTexture::SRGB_Alpha_DXT5:
- case QOpenGLTexture::SRGB_BP_UNorm:
- case QOpenGLTexture::R11_EAC_UNorm:
- case QOpenGLTexture::R11_EAC_SNorm:
- case QOpenGLTexture::RG11_EAC_UNorm:
- case QOpenGLTexture::RG11_EAC_SNorm:
- case QOpenGLTexture::RGB8_ETC2:
- case QOpenGLTexture::SRGB8_ETC2:
- case QOpenGLTexture::RGB8_PunchThrough_Alpha1_ETC2:
- case QOpenGLTexture::SRGB8_PunchThrough_Alpha1_ETC2:
- case QOpenGLTexture::RGBA8_ETC2_EAC:
- case QOpenGLTexture::SRGB8_Alpha8_ETC2_EAC:
- case QOpenGLTexture::RGBA_ASTC_4x4:
- case QOpenGLTexture::RGBA_ASTC_5x4:
- case QOpenGLTexture::RGBA_ASTC_5x5:
- case QOpenGLTexture::RGBA_ASTC_6x5:
- case QOpenGLTexture::RGBA_ASTC_6x6:
- case QOpenGLTexture::RGBA_ASTC_8x5:
- case QOpenGLTexture::RGBA_ASTC_8x6:
- case QOpenGLTexture::RGBA_ASTC_8x8:
- case QOpenGLTexture::RGBA_ASTC_10x5:
- case QOpenGLTexture::RGBA_ASTC_10x6:
- case QOpenGLTexture::RGBA_ASTC_10x8:
- case QOpenGLTexture::RGBA_ASTC_10x10:
- case QOpenGLTexture::RGBA_ASTC_12x10:
- case QOpenGLTexture::RGBA_ASTC_12x12:
- case QOpenGLTexture::SRGB8_Alpha8_ASTC_4x4:
- case QOpenGLTexture::SRGB8_Alpha8_ASTC_5x4:
- case QOpenGLTexture::SRGB8_Alpha8_ASTC_5x5:
- case QOpenGLTexture::SRGB8_Alpha8_ASTC_6x5:
- case QOpenGLTexture::SRGB8_Alpha8_ASTC_6x6:
- case QOpenGLTexture::SRGB8_Alpha8_ASTC_8x5:
- case QOpenGLTexture::SRGB8_Alpha8_ASTC_8x6:
- case QOpenGLTexture::SRGB8_Alpha8_ASTC_8x8:
- case QOpenGLTexture::SRGB8_Alpha8_ASTC_10x5:
- case QOpenGLTexture::SRGB8_Alpha8_ASTC_10x6:
- case QOpenGLTexture::SRGB8_Alpha8_ASTC_10x8:
- case QOpenGLTexture::SRGB8_Alpha8_ASTC_10x10:
- case QOpenGLTexture::SRGB8_Alpha8_ASTC_12x10:
- case QOpenGLTexture::SRGB8_Alpha8_ASTC_12x12:
- return true;
-
- case QOpenGLTexture::RGB8_ETC1:
- return false;
-
- case QOpenGLTexture::DepthFormat:
- case QOpenGLTexture::AlphaFormat:
-
- case QOpenGLTexture::RGBFormat:
- case QOpenGLTexture::RGBAFormat:
-
- case QOpenGLTexture::LuminanceFormat:
-
- case QOpenGLTexture::LuminanceAlphaFormat:
- return false;
- }
-
- Q_UNREACHABLE();
- return false;
-}
-
-static bool isTextureTargetMultisample(QOpenGLTexture::Target target)
-{
- switch (target) {
- case QOpenGLTexture::Target1D:
- case QOpenGLTexture::Target1DArray:
- case QOpenGLTexture::Target2D:
- case QOpenGLTexture::Target2DArray:
- case QOpenGLTexture::Target3D:
- case QOpenGLTexture::TargetCubeMap:
- case QOpenGLTexture::TargetCubeMapArray:
- return false;
-
- case QOpenGLTexture::Target2DMultisample:
- case QOpenGLTexture::Target2DMultisampleArray:
- return true;
-
- case QOpenGLTexture::TargetRectangle:
- case QOpenGLTexture::TargetBuffer:
- return false;
- }
-
- Q_UNREACHABLE();
- return false;
-}
-
-bool QOpenGLTexturePrivate::isUsingImmutableStorage() const
-{
- // Use immutable storage whenever possible, falling back to mutable
- // Note that if multisample textures are not supported at all, we'll still fail into
- // the mutable storage allocation
- return isSizedTextureFormat(format)
- && (isTextureTargetMultisample(target)
- ? features.testFlag(QOpenGLTexture::ImmutableMultisampleStorage)
- : features.testFlag(QOpenGLTexture::ImmutableStorage));
-}
-
-void QOpenGLTexturePrivate::allocateStorage(QOpenGLTexture::PixelFormat pixelFormat, QOpenGLTexture::PixelType pixelType)
-{
- // Resolve the actual number of mipmap levels we can use
- mipLevels = evaluateMipLevels();
-
- if (isUsingImmutableStorage())
- allocateImmutableStorage();
- else
- allocateMutableStorage(pixelFormat, pixelType);
-}
-
-static QOpenGLTexture::PixelFormat pixelFormatCompatibleWithInternalFormat(QOpenGLTexture::TextureFormat internalFormat)
-{
- switch (internalFormat) {
- case QOpenGLTexture::NoFormat:
- return QOpenGLTexture::NoSourceFormat;
-
- case QOpenGLTexture::R8_UNorm:
- return QOpenGLTexture::Red;
-
- case QOpenGLTexture::RG8_UNorm:
- return QOpenGLTexture::RG;
-
- case QOpenGLTexture::RGB8_UNorm:
- return QOpenGLTexture::RGB;
-
- case QOpenGLTexture::RGBA8_UNorm:
- return QOpenGLTexture::RGBA;
-
- case QOpenGLTexture::R16_UNorm:
- return QOpenGLTexture::Red;
-
- case QOpenGLTexture::RG16_UNorm:
- return QOpenGLTexture::RG;
-
- case QOpenGLTexture::RGB16_UNorm:
- return QOpenGLTexture::RGB;
-
- case QOpenGLTexture::RGBA16_UNorm:
- return QOpenGLTexture::RGBA;
-
- case QOpenGLTexture::R8_SNorm:
- return QOpenGLTexture::Red;
-
- case QOpenGLTexture::RG8_SNorm:
- return QOpenGLTexture::RG;
-
- case QOpenGLTexture::RGB8_SNorm:
- return QOpenGLTexture::RGB;
-
- case QOpenGLTexture::RGBA8_SNorm:
- return QOpenGLTexture::RGBA;
-
- case QOpenGLTexture::R16_SNorm:
- return QOpenGLTexture::Red;
-
- case QOpenGLTexture::RG16_SNorm:
- return QOpenGLTexture::RG;
-
- case QOpenGLTexture::RGB16_SNorm:
- return QOpenGLTexture::RGB;
-
- case QOpenGLTexture::RGBA16_SNorm:
- return QOpenGLTexture::RGBA;
-
- case QOpenGLTexture::R8U:
- return QOpenGLTexture::Red_Integer;
-
- case QOpenGLTexture::RG8U:
- return QOpenGLTexture::RG_Integer;
-
- case QOpenGLTexture::RGB8U:
- return QOpenGLTexture::RGB_Integer;
-
- case QOpenGLTexture::RGBA8U:
- return QOpenGLTexture::RGBA_Integer;
-
- case QOpenGLTexture::R16U:
- return QOpenGLTexture::Red_Integer;
-
- case QOpenGLTexture::RG16U:
- return QOpenGLTexture::RG_Integer;
-
- case QOpenGLTexture::RGB16U:
- return QOpenGLTexture::RGB_Integer;
-
- case QOpenGLTexture::RGBA16U:
- return QOpenGLTexture::RGBA_Integer;
-
- case QOpenGLTexture::R32U:
- return QOpenGLTexture::Red_Integer;
-
- case QOpenGLTexture::RG32U:
- return QOpenGLTexture::RG_Integer;
-
- case QOpenGLTexture::RGB32U:
- return QOpenGLTexture::RGB_Integer;
-
- case QOpenGLTexture::RGBA32U:
- return QOpenGLTexture::RGBA_Integer;
-
- case QOpenGLTexture::R8I:
- return QOpenGLTexture::Red_Integer;
-
- case QOpenGLTexture::RG8I:
- return QOpenGLTexture::RG_Integer;
-
- case QOpenGLTexture::RGB8I:
- return QOpenGLTexture::RGB_Integer;
-
- case QOpenGLTexture::RGBA8I:
- return QOpenGLTexture::RGBA_Integer;
-
- case QOpenGLTexture::R16I:
- return QOpenGLTexture::Red_Integer;
-
- case QOpenGLTexture::RG16I:
- return QOpenGLTexture::RG_Integer;
-
- case QOpenGLTexture::RGB16I:
- return QOpenGLTexture::RGB_Integer;
-
- case QOpenGLTexture::RGBA16I:
- return QOpenGLTexture::RGBA_Integer;
-
- case QOpenGLTexture::R32I:
- return QOpenGLTexture::Red_Integer;
-
- case QOpenGLTexture::RG32I:
- return QOpenGLTexture::RG_Integer;
-
- case QOpenGLTexture::RGB32I:
- return QOpenGLTexture::RGB_Integer;
-
- case QOpenGLTexture::RGBA32I:
- return QOpenGLTexture::RGBA_Integer;
-
- case QOpenGLTexture::R16F:
- return QOpenGLTexture::Red;
-
- case QOpenGLTexture::RG16F:
- return QOpenGLTexture::RG;
-
- case QOpenGLTexture::RGB16F:
- return QOpenGLTexture::RGB;
-
- case QOpenGLTexture::RGBA16F:
- return QOpenGLTexture::RGBA;
-
- case QOpenGLTexture::R32F:
- return QOpenGLTexture::Red;
-
- case QOpenGLTexture::RG32F:
- return QOpenGLTexture::RG;
-
- case QOpenGLTexture::RGB32F:
- return QOpenGLTexture::RGB;
-
- case QOpenGLTexture::RGBA32F:
- return QOpenGLTexture::RGBA;
-
- case QOpenGLTexture::RGB9E5:
- return QOpenGLTexture::RGB;
-
- case QOpenGLTexture::RG11B10F:
- return QOpenGLTexture::RGB;
-
- case QOpenGLTexture::RG3B2:
- return QOpenGLTexture::RGB;
-
- case QOpenGLTexture::R5G6B5:
- return QOpenGLTexture::RGB;
-
- case QOpenGLTexture::RGB5A1:
- return QOpenGLTexture::RGBA;
-
- case QOpenGLTexture::RGBA4:
- return QOpenGLTexture::RGBA;
-
- case QOpenGLTexture::RGB10A2:
- return QOpenGLTexture::RGBA;
-
- case QOpenGLTexture::D16:
- case QOpenGLTexture::D24:
- case QOpenGLTexture::D32:
- case QOpenGLTexture::D32F:
- return QOpenGLTexture::Depth;
-
- case QOpenGLTexture::D24S8:
- case QOpenGLTexture::D32FS8X24:
- return QOpenGLTexture::DepthStencil;
-
- case QOpenGLTexture::S8:
- return QOpenGLTexture::Stencil;
-
- case QOpenGLTexture::RGB_DXT1:
- case QOpenGLTexture::RGBA_DXT1:
- case QOpenGLTexture::RGBA_DXT3:
- case QOpenGLTexture::RGBA_DXT5:
- case QOpenGLTexture::R_ATI1N_UNorm:
- case QOpenGLTexture::R_ATI1N_SNorm:
- case QOpenGLTexture::RG_ATI2N_UNorm:
- case QOpenGLTexture::RG_ATI2N_SNorm:
- case QOpenGLTexture::RGB_BP_UNSIGNED_FLOAT:
- case QOpenGLTexture::RGB_BP_SIGNED_FLOAT:
- case QOpenGLTexture::RGB_BP_UNorm:
- case QOpenGLTexture::SRGB8:
- case QOpenGLTexture::SRGB8_Alpha8:
- case QOpenGLTexture::SRGB_DXT1:
- case QOpenGLTexture::SRGB_Alpha_DXT1:
- case QOpenGLTexture::SRGB_Alpha_DXT3:
- case QOpenGLTexture::SRGB_Alpha_DXT5:
- case QOpenGLTexture::SRGB_BP_UNorm:
- case QOpenGLTexture::RGB8_ETC1:
- return QOpenGLTexture::RGBA;
-
- case QOpenGLTexture::R11_EAC_UNorm:
- case QOpenGLTexture::R11_EAC_SNorm:
- return QOpenGLTexture::Red;
-
- case QOpenGLTexture::RG11_EAC_UNorm:
- case QOpenGLTexture::RG11_EAC_SNorm:
- return QOpenGLTexture::RG;
-
- case QOpenGLTexture::RGB8_ETC2:
- case QOpenGLTexture::SRGB8_ETC2:
- return QOpenGLTexture::RGB;
-
- case QOpenGLTexture::RGB8_PunchThrough_Alpha1_ETC2:
- case QOpenGLTexture::SRGB8_PunchThrough_Alpha1_ETC2:
- return QOpenGLTexture::RGBA;
-
- case QOpenGLTexture::RGBA8_ETC2_EAC:
- case QOpenGLTexture::SRGB8_Alpha8_ETC2_EAC:
- return QOpenGLTexture::RGBA;
-
- case QOpenGLTexture::RGBA_ASTC_4x4:
- case QOpenGLTexture::RGBA_ASTC_5x4:
- case QOpenGLTexture::RGBA_ASTC_5x5:
- case QOpenGLTexture::RGBA_ASTC_6x5:
- case QOpenGLTexture::RGBA_ASTC_6x6:
- case QOpenGLTexture::RGBA_ASTC_8x5:
- case QOpenGLTexture::RGBA_ASTC_8x6:
- case QOpenGLTexture::RGBA_ASTC_8x8:
- case QOpenGLTexture::RGBA_ASTC_10x5:
- case QOpenGLTexture::RGBA_ASTC_10x6:
- case QOpenGLTexture::RGBA_ASTC_10x8:
- case QOpenGLTexture::RGBA_ASTC_10x10:
- case QOpenGLTexture::RGBA_ASTC_12x10:
- case QOpenGLTexture::RGBA_ASTC_12x12:
- case QOpenGLTexture::SRGB8_Alpha8_ASTC_4x4:
- case QOpenGLTexture::SRGB8_Alpha8_ASTC_5x4:
- case QOpenGLTexture::SRGB8_Alpha8_ASTC_5x5:
- case QOpenGLTexture::SRGB8_Alpha8_ASTC_6x5:
- case QOpenGLTexture::SRGB8_Alpha8_ASTC_6x6:
- case QOpenGLTexture::SRGB8_Alpha8_ASTC_8x5:
- case QOpenGLTexture::SRGB8_Alpha8_ASTC_8x6:
- case QOpenGLTexture::SRGB8_Alpha8_ASTC_8x8:
- case QOpenGLTexture::SRGB8_Alpha8_ASTC_10x5:
- case QOpenGLTexture::SRGB8_Alpha8_ASTC_10x6:
- case QOpenGLTexture::SRGB8_Alpha8_ASTC_10x8:
- case QOpenGLTexture::SRGB8_Alpha8_ASTC_10x10:
- case QOpenGLTexture::SRGB8_Alpha8_ASTC_12x10:
- case QOpenGLTexture::SRGB8_Alpha8_ASTC_12x12:
- return QOpenGLTexture::RGBA;
-
- case QOpenGLTexture::DepthFormat:
- return QOpenGLTexture::Depth;
-
- case QOpenGLTexture::AlphaFormat:
- return QOpenGLTexture::Alpha;
-
- case QOpenGLTexture::RGBFormat:
- return QOpenGLTexture::RGB;
-
- case QOpenGLTexture::RGBAFormat:
- return QOpenGLTexture::RGBA;
-
- case QOpenGLTexture::LuminanceFormat:
- return QOpenGLTexture::Luminance;
-
- case QOpenGLTexture::LuminanceAlphaFormat:
- return QOpenGLTexture::LuminanceAlpha;
- }
-
- Q_UNREACHABLE();
- return QOpenGLTexture::NoSourceFormat;
-}
-
-static QOpenGLTexture::PixelType pixelTypeCompatibleWithInternalFormat(QOpenGLTexture::TextureFormat internalFormat)
-{
- switch (internalFormat) {
- case QOpenGLTexture::NoFormat:
- return QOpenGLTexture::NoPixelType;
-
- case QOpenGLTexture::R8_UNorm:
- case QOpenGLTexture::RG8_UNorm:
- case QOpenGLTexture::RGB8_UNorm:
- case QOpenGLTexture::RGBA8_UNorm:
- case QOpenGLTexture::R16_UNorm:
- case QOpenGLTexture::RG16_UNorm:
- case QOpenGLTexture::RGB16_UNorm:
- case QOpenGLTexture::RGBA16_UNorm:
- return QOpenGLTexture::UInt8;
-
- case QOpenGLTexture::R8_SNorm:
- case QOpenGLTexture::RG8_SNorm:
- case QOpenGLTexture::RGB8_SNorm:
- case QOpenGLTexture::RGBA8_SNorm:
- case QOpenGLTexture::R16_SNorm:
- case QOpenGLTexture::RG16_SNorm:
- case QOpenGLTexture::RGB16_SNorm:
- case QOpenGLTexture::RGBA16_SNorm:
- return QOpenGLTexture::Int8;
-
- case QOpenGLTexture::R8U:
- case QOpenGLTexture::RG8U:
- case QOpenGLTexture::RGB8U:
- case QOpenGLTexture::RGBA8U:
- case QOpenGLTexture::R16U:
- case QOpenGLTexture::RG16U:
- case QOpenGLTexture::RGB16U:
- case QOpenGLTexture::RGBA16U:
- case QOpenGLTexture::R32U:
- case QOpenGLTexture::RG32U:
- case QOpenGLTexture::RGB32U:
- case QOpenGLTexture::RGBA32U:
- return QOpenGLTexture::UInt8;
-
- case QOpenGLTexture::R8I:
- case QOpenGLTexture::RG8I:
- case QOpenGLTexture::RGB8I:
- case QOpenGLTexture::RGBA8I:
- case QOpenGLTexture::R16I:
- case QOpenGLTexture::RG16I:
- case QOpenGLTexture::RGB16I:
- case QOpenGLTexture::RGBA16I:
- case QOpenGLTexture::R32I:
- case QOpenGLTexture::RG32I:
- case QOpenGLTexture::RGB32I:
- case QOpenGLTexture::RGBA32I:
- return QOpenGLTexture::Int8;
-
- case QOpenGLTexture::R16F:
- case QOpenGLTexture::RG16F:
- case QOpenGLTexture::RGB16F:
- case QOpenGLTexture::RGBA16F:
- return QOpenGLTexture::Float16;
-
- case QOpenGLTexture::R32F:
- case QOpenGLTexture::RG32F:
- case QOpenGLTexture::RGB32F:
- case QOpenGLTexture::RGBA32F:
- return QOpenGLTexture::Float32;
-
- case QOpenGLTexture::RGB9E5:
- return QOpenGLTexture::UInt16_RGB5A1_Rev;
-
- case QOpenGLTexture::RG11B10F:
- return QOpenGLTexture::UInt32_RG11B10F;
-
- case QOpenGLTexture::RG3B2:
- return QOpenGLTexture::UInt8_RG3B2;
-
- case QOpenGLTexture::R5G6B5:
- return QOpenGLTexture::UInt16_R5G6B5;
-
- case QOpenGLTexture::RGB5A1:
- return QOpenGLTexture::UInt16_RGB5A1;
-
- case QOpenGLTexture::RGBA4:
- return QOpenGLTexture::UInt16_RGBA4;
-
- case QOpenGLTexture::RGB10A2:
- return QOpenGLTexture::UInt32_RGB10A2;
-
- case QOpenGLTexture::D16:
- return QOpenGLTexture::UInt16;
-
- case QOpenGLTexture::D24:
- case QOpenGLTexture::D32:
- return QOpenGLTexture::UInt32;
-
- case QOpenGLTexture::D32F:
- return QOpenGLTexture::Float32;
-
- case QOpenGLTexture::D24S8:
- return QOpenGLTexture::UInt32_D24S8;
-
- case QOpenGLTexture::D32FS8X24:
- return QOpenGLTexture::Float32_D32_UInt32_S8_X24;
-
- case QOpenGLTexture::S8:
- return QOpenGLTexture::UInt8;
-
- case QOpenGLTexture::RGB_DXT1:
- case QOpenGLTexture::RGBA_DXT1:
- case QOpenGLTexture::RGBA_DXT3:
- case QOpenGLTexture::RGBA_DXT5:
- case QOpenGLTexture::R_ATI1N_UNorm:
- case QOpenGLTexture::R_ATI1N_SNorm:
- case QOpenGLTexture::RG_ATI2N_UNorm:
- case QOpenGLTexture::RG_ATI2N_SNorm:
- case QOpenGLTexture::RGB_BP_UNSIGNED_FLOAT:
- case QOpenGLTexture::RGB_BP_SIGNED_FLOAT:
- case QOpenGLTexture::RGB_BP_UNorm:
- case QOpenGLTexture::SRGB8:
- case QOpenGLTexture::SRGB8_Alpha8:
- case QOpenGLTexture::SRGB_DXT1:
- case QOpenGLTexture::SRGB_Alpha_DXT1:
- case QOpenGLTexture::SRGB_Alpha_DXT3:
- case QOpenGLTexture::SRGB_Alpha_DXT5:
- case QOpenGLTexture::SRGB_BP_UNorm:
- case QOpenGLTexture::R11_EAC_UNorm:
- case QOpenGLTexture::R11_EAC_SNorm:
- case QOpenGLTexture::RG11_EAC_UNorm:
- case QOpenGLTexture::RG11_EAC_SNorm:
- case QOpenGLTexture::RGB8_ETC2:
- case QOpenGLTexture::SRGB8_ETC2:
- case QOpenGLTexture::RGB8_PunchThrough_Alpha1_ETC2:
- case QOpenGLTexture::SRGB8_PunchThrough_Alpha1_ETC2:
- case QOpenGLTexture::RGBA8_ETC2_EAC:
- case QOpenGLTexture::SRGB8_Alpha8_ETC2_EAC:
- case QOpenGLTexture::RGB8_ETC1:
- case QOpenGLTexture::RGBA_ASTC_4x4:
- case QOpenGLTexture::RGBA_ASTC_5x4:
- case QOpenGLTexture::RGBA_ASTC_5x5:
- case QOpenGLTexture::RGBA_ASTC_6x5:
- case QOpenGLTexture::RGBA_ASTC_6x6:
- case QOpenGLTexture::RGBA_ASTC_8x5:
- case QOpenGLTexture::RGBA_ASTC_8x6:
- case QOpenGLTexture::RGBA_ASTC_8x8:
- case QOpenGLTexture::RGBA_ASTC_10x5:
- case QOpenGLTexture::RGBA_ASTC_10x6:
- case QOpenGLTexture::RGBA_ASTC_10x8:
- case QOpenGLTexture::RGBA_ASTC_10x10:
- case QOpenGLTexture::RGBA_ASTC_12x10:
- case QOpenGLTexture::RGBA_ASTC_12x12:
- case QOpenGLTexture::SRGB8_Alpha8_ASTC_4x4:
- case QOpenGLTexture::SRGB8_Alpha8_ASTC_5x4:
- case QOpenGLTexture::SRGB8_Alpha8_ASTC_5x5:
- case QOpenGLTexture::SRGB8_Alpha8_ASTC_6x5:
- case QOpenGLTexture::SRGB8_Alpha8_ASTC_6x6:
- case QOpenGLTexture::SRGB8_Alpha8_ASTC_8x5:
- case QOpenGLTexture::SRGB8_Alpha8_ASTC_8x6:
- case QOpenGLTexture::SRGB8_Alpha8_ASTC_8x8:
- case QOpenGLTexture::SRGB8_Alpha8_ASTC_10x5:
- case QOpenGLTexture::SRGB8_Alpha8_ASTC_10x6:
- case QOpenGLTexture::SRGB8_Alpha8_ASTC_10x8:
- case QOpenGLTexture::SRGB8_Alpha8_ASTC_10x10:
- case QOpenGLTexture::SRGB8_Alpha8_ASTC_12x10:
- case QOpenGLTexture::SRGB8_Alpha8_ASTC_12x12:
- return QOpenGLTexture::UInt8;
-
- case QOpenGLTexture::DepthFormat:
- return QOpenGLTexture::UInt32;
-
- case QOpenGLTexture::AlphaFormat:
- case QOpenGLTexture::RGBFormat:
- case QOpenGLTexture::RGBAFormat:
- case QOpenGLTexture::LuminanceFormat:
- case QOpenGLTexture::LuminanceAlphaFormat:
- return QOpenGLTexture::UInt8;
- }
-
- Q_UNREACHABLE();
- return QOpenGLTexture::NoPixelType;
-}
-
-static bool isCompressedFormat(QOpenGLTexture::TextureFormat internalFormat)
-{
- switch (internalFormat) {
- case QOpenGLTexture::NoFormat:
-
- case QOpenGLTexture::R8_UNorm:
- case QOpenGLTexture::RG8_UNorm:
- case QOpenGLTexture::RGB8_UNorm:
- case QOpenGLTexture::RGBA8_UNorm:
- case QOpenGLTexture::R16_UNorm:
- case QOpenGLTexture::RG16_UNorm:
- case QOpenGLTexture::RGB16_UNorm:
- case QOpenGLTexture::RGBA16_UNorm:
- case QOpenGLTexture::R8_SNorm:
- case QOpenGLTexture::RG8_SNorm:
- case QOpenGLTexture::RGB8_SNorm:
- case QOpenGLTexture::RGBA8_SNorm:
- case QOpenGLTexture::R16_SNorm:
- case QOpenGLTexture::RG16_SNorm:
- case QOpenGLTexture::RGB16_SNorm:
- case QOpenGLTexture::RGBA16_SNorm:
- case QOpenGLTexture::R8U:
- case QOpenGLTexture::RG8U:
- case QOpenGLTexture::RGB8U:
- case QOpenGLTexture::RGBA8U:
- case QOpenGLTexture::R16U:
- case QOpenGLTexture::RG16U:
- case QOpenGLTexture::RGB16U:
- case QOpenGLTexture::RGBA16U:
- case QOpenGLTexture::R32U:
- case QOpenGLTexture::RG32U:
- case QOpenGLTexture::RGB32U:
- case QOpenGLTexture::RGBA32U:
- case QOpenGLTexture::R8I:
- case QOpenGLTexture::RG8I:
- case QOpenGLTexture::RGB8I:
- case QOpenGLTexture::RGBA8I:
- case QOpenGLTexture::R16I:
- case QOpenGLTexture::RG16I:
- case QOpenGLTexture::RGB16I:
- case QOpenGLTexture::RGBA16I:
- case QOpenGLTexture::R32I:
- case QOpenGLTexture::RG32I:
- case QOpenGLTexture::RGB32I:
- case QOpenGLTexture::RGBA32I:
- case QOpenGLTexture::R16F:
- case QOpenGLTexture::RG16F:
- case QOpenGLTexture::RGB16F:
- case QOpenGLTexture::RGBA16F:
- case QOpenGLTexture::R32F:
- case QOpenGLTexture::RG32F:
- case QOpenGLTexture::RGB32F:
- case QOpenGLTexture::RGBA32F:
- case QOpenGLTexture::RGB9E5:
- case QOpenGLTexture::RG11B10F:
- case QOpenGLTexture::RG3B2:
- case QOpenGLTexture::R5G6B5:
- case QOpenGLTexture::RGB5A1:
- case QOpenGLTexture::RGBA4:
- case QOpenGLTexture::RGB10A2:
-
- case QOpenGLTexture::D16:
- case QOpenGLTexture::D24:
- case QOpenGLTexture::D32:
- case QOpenGLTexture::D32F:
-
- case QOpenGLTexture::D24S8:
- case QOpenGLTexture::D32FS8X24:
-
- case QOpenGLTexture::S8:
- return false;
-
- case QOpenGLTexture::RGB_DXT1:
- case QOpenGLTexture::RGBA_DXT1:
- case QOpenGLTexture::RGBA_DXT3:
- case QOpenGLTexture::RGBA_DXT5:
- case QOpenGLTexture::R_ATI1N_UNorm:
- case QOpenGLTexture::R_ATI1N_SNorm:
- case QOpenGLTexture::RG_ATI2N_UNorm:
- case QOpenGLTexture::RG_ATI2N_SNorm:
- case QOpenGLTexture::RGB_BP_UNSIGNED_FLOAT:
- case QOpenGLTexture::RGB_BP_SIGNED_FLOAT:
- case QOpenGLTexture::RGB_BP_UNorm:
- case QOpenGLTexture::SRGB8:
- case QOpenGLTexture::SRGB8_Alpha8:
- case QOpenGLTexture::SRGB_DXT1:
- case QOpenGLTexture::SRGB_Alpha_DXT1:
- case QOpenGLTexture::SRGB_Alpha_DXT3:
- case QOpenGLTexture::SRGB_Alpha_DXT5:
- case QOpenGLTexture::SRGB_BP_UNorm:
- case QOpenGLTexture::R11_EAC_UNorm:
- case QOpenGLTexture::R11_EAC_SNorm:
- case QOpenGLTexture::RG11_EAC_UNorm:
- case QOpenGLTexture::RG11_EAC_SNorm:
- case QOpenGLTexture::RGB8_ETC2:
- case QOpenGLTexture::SRGB8_ETC2:
- case QOpenGLTexture::RGB8_PunchThrough_Alpha1_ETC2:
- case QOpenGLTexture::SRGB8_PunchThrough_Alpha1_ETC2:
- case QOpenGLTexture::RGBA8_ETC2_EAC:
- case QOpenGLTexture::SRGB8_Alpha8_ETC2_EAC:
- case QOpenGLTexture::RGB8_ETC1:
- case QOpenGLTexture::RGBA_ASTC_4x4:
- case QOpenGLTexture::RGBA_ASTC_5x4:
- case QOpenGLTexture::RGBA_ASTC_5x5:
- case QOpenGLTexture::RGBA_ASTC_6x5:
- case QOpenGLTexture::RGBA_ASTC_6x6:
- case QOpenGLTexture::RGBA_ASTC_8x5:
- case QOpenGLTexture::RGBA_ASTC_8x6:
- case QOpenGLTexture::RGBA_ASTC_8x8:
- case QOpenGLTexture::RGBA_ASTC_10x5:
- case QOpenGLTexture::RGBA_ASTC_10x6:
- case QOpenGLTexture::RGBA_ASTC_10x8:
- case QOpenGLTexture::RGBA_ASTC_10x10:
- case QOpenGLTexture::RGBA_ASTC_12x10:
- case QOpenGLTexture::RGBA_ASTC_12x12:
- case QOpenGLTexture::SRGB8_Alpha8_ASTC_4x4:
- case QOpenGLTexture::SRGB8_Alpha8_ASTC_5x4:
- case QOpenGLTexture::SRGB8_Alpha8_ASTC_5x5:
- case QOpenGLTexture::SRGB8_Alpha8_ASTC_6x5:
- case QOpenGLTexture::SRGB8_Alpha8_ASTC_6x6:
- case QOpenGLTexture::SRGB8_Alpha8_ASTC_8x5:
- case QOpenGLTexture::SRGB8_Alpha8_ASTC_8x6:
- case QOpenGLTexture::SRGB8_Alpha8_ASTC_8x8:
- case QOpenGLTexture::SRGB8_Alpha8_ASTC_10x5:
- case QOpenGLTexture::SRGB8_Alpha8_ASTC_10x6:
- case QOpenGLTexture::SRGB8_Alpha8_ASTC_10x8:
- case QOpenGLTexture::SRGB8_Alpha8_ASTC_10x10:
- case QOpenGLTexture::SRGB8_Alpha8_ASTC_12x10:
- case QOpenGLTexture::SRGB8_Alpha8_ASTC_12x12:
- return true;
-
- case QOpenGLTexture::DepthFormat:
- case QOpenGLTexture::AlphaFormat:
- case QOpenGLTexture::RGBFormat:
- case QOpenGLTexture::RGBAFormat:
- case QOpenGLTexture::LuminanceFormat:
- case QOpenGLTexture::LuminanceAlphaFormat:
- return false;
- }
-
- Q_UNREACHABLE();
- return false;
-}
-
-void QOpenGLTexturePrivate::allocateMutableStorage(QOpenGLTexture::PixelFormat pixelFormat, QOpenGLTexture::PixelType pixelType)
-{
- // There is no way to allocate mutable storage for compressed textures in in
- // versions older than OpenGL 3.1 and OpenGL ES 3.0, because the older specs
- // do not mandate accepting null data pointers for glCompressedTexImage*D,
- // unlike glTexImage*D (which in turn does not accept compressed formats).
- if (isCompressedFormat(format)) {
- storageAllocated = true;
- return;
- }
-
- switch (target) {
- case QOpenGLTexture::TargetBuffer:
- // Buffer textures get their storage from an external OpenGL buffer
- qWarning("Buffer textures do not allocate storage");
- return;
-
- case QOpenGLTexture::Target1D:
- if (features.testFlag(QOpenGLTexture::Texture1D)) {
- for (int level = 0; level < mipLevels; ++level)
- texFuncs->glTextureImage1D(textureId, target, bindingTarget, level, format,
- mipLevelSize(level, dimensions[0]),
- 0,
- pixelFormat, pixelType, nullptr);
- } else {
- qWarning("1D textures are not supported");
- return;
- }
- break;
-
- case QOpenGLTexture::Target1DArray:
- if (features.testFlag(QOpenGLTexture::Texture1D)
- && features.testFlag(QOpenGLTexture::TextureArrays)) {
- for (int level = 0; level < mipLevels; ++level)
- texFuncs->glTextureImage2D(textureId, target, bindingTarget, level, format,
- mipLevelSize(level, dimensions[0]),
- layers,
- 0,
- pixelFormat, pixelType, nullptr);
- } else {
- qWarning("1D array textures are not supported");
- return;
- }
- break;
-
- case QOpenGLTexture::Target2D:
- case QOpenGLTexture::TargetRectangle:
- for (int level = 0; level < mipLevels; ++level)
- texFuncs->glTextureImage2D(textureId, target, bindingTarget, level, format,
- mipLevelSize(level, dimensions[0]),
- mipLevelSize(level, dimensions[1]),
- 0,
- pixelFormat, pixelType, nullptr);
- break;
-
- case QOpenGLTexture::TargetCubeMap: {
- // Cubemaps are the odd one out. We have to allocate storage for each
- // face and miplevel using the special cubemap face targets rather than
- // GL_TARGET_CUBEMAP.
- const QOpenGLTexture::CubeMapFace faceTargets[] = {
- QOpenGLTexture::CubeMapPositiveX, QOpenGLTexture::CubeMapNegativeX,
- QOpenGLTexture::CubeMapPositiveY, QOpenGLTexture::CubeMapNegativeY,
- QOpenGLTexture::CubeMapPositiveZ, QOpenGLTexture::CubeMapNegativeZ
- };
-
- for (int faceTarget = 0; faceTarget < 6; ++faceTarget) {
- for (int level = 0; level < mipLevels; ++level) {
- texFuncs->glTextureImage2D(textureId, faceTargets[faceTarget], bindingTarget,
- level, format,
- mipLevelSize(level, dimensions[0]),
- mipLevelSize(level, dimensions[1]),
- 0,
- pixelFormat, pixelType, nullptr);
- }
- }
- break;
- }
-
- case QOpenGLTexture::Target2DArray:
- if (features.testFlag(QOpenGLTexture::TextureArrays)) {
- for (int level = 0; level < mipLevels; ++level)
- texFuncs->glTextureImage3D(textureId, target, bindingTarget, level, format,
- mipLevelSize(level, dimensions[0]),
- mipLevelSize(level, dimensions[1]),
- layers,
- 0,
- pixelFormat, pixelType, nullptr);
- } else {
- qWarning("Array textures are not supported");
- return;
- }
- break;
-
- case QOpenGLTexture::TargetCubeMapArray:
- // Cubemap arrays must specify number of layer-faces (6 * layers) as depth parameter
- if (features.testFlag(QOpenGLTexture::TextureCubeMapArrays)) {
- for (int level = 0; level < mipLevels; ++level)
- texFuncs->glTextureImage3D(textureId, target, bindingTarget, level, format,
- mipLevelSize(level, dimensions[0]),
- mipLevelSize(level, dimensions[1]),
- 6 * layers,
- 0,
- pixelFormat, pixelType, nullptr);
- } else {
- qWarning("Cubemap Array textures are not supported");
- return;
- }
- break;
-
- case QOpenGLTexture::Target3D:
- if (features.testFlag(QOpenGLTexture::Texture3D)) {
- for (int level = 0; level < mipLevels; ++level)
- texFuncs->glTextureImage3D(textureId, target, bindingTarget, level, format,
- mipLevelSize(level, dimensions[0]),
- mipLevelSize(level, dimensions[1]),
- mipLevelSize(level, dimensions[2]),
- 0,
- pixelFormat, pixelType, nullptr);
- } else {
- qWarning("3D textures are not supported");
- return;
- }
- break;
-
- case QOpenGLTexture::Target2DMultisample:
- if (features.testFlag(QOpenGLTexture::TextureMultisample)) {
- texFuncs->glTextureImage2DMultisample(textureId, target, bindingTarget, samples, format,
- dimensions[0], dimensions[1],
- fixedSamplePositions);
- } else {
- qWarning("Multisample textures are not supported");
- return;
- }
- break;
-
- case QOpenGLTexture::Target2DMultisampleArray:
- if (features.testFlag(QOpenGLTexture::TextureMultisample)
- && features.testFlag(QOpenGLTexture::TextureArrays)) {
- texFuncs->glTextureImage3DMultisample(textureId, target, bindingTarget, samples, format,
- dimensions[0], dimensions[1], layers,
- fixedSamplePositions);
- } else {
- qWarning("Multisample array textures are not supported");
- return;
- }
- break;
- }
-
- storageAllocated = true;
-}
-
-void QOpenGLTexturePrivate::allocateImmutableStorage()
-{
- switch (target) {
- case QOpenGLTexture::TargetBuffer:
- // Buffer textures get their storage from an external OpenGL buffer
- qWarning("Buffer textures do not allocate storage");
- return;
-
- case QOpenGLTexture::Target1D:
- if (features.testFlag(QOpenGLTexture::Texture1D)) {
- texFuncs->glTextureStorage1D(textureId, target, bindingTarget, mipLevels, format,
- dimensions[0]);
- } else {
- qWarning("1D textures are not supported");
- return;
- }
- break;
-
- case QOpenGLTexture::Target1DArray:
- if (features.testFlag(QOpenGLTexture::Texture1D)
- && features.testFlag(QOpenGLTexture::TextureArrays)) {
- texFuncs->glTextureStorage2D(textureId, target, bindingTarget, mipLevels, format,
- dimensions[0], layers);
- } else {
- qWarning("1D array textures are not supported");
- return;
- }
- break;
-
- case QOpenGLTexture::Target2D:
- case QOpenGLTexture::TargetCubeMap:
- case QOpenGLTexture::TargetRectangle:
- texFuncs->glTextureStorage2D(textureId, target, bindingTarget, mipLevels, format,
- dimensions[0], dimensions[1]);
- break;
-
- case QOpenGLTexture::Target2DArray:
- if (features.testFlag(QOpenGLTexture::TextureArrays)) {
- texFuncs->glTextureStorage3D(textureId, target, bindingTarget, mipLevels, format,
- dimensions[0], dimensions[1], layers);
- } else {
- qWarning("Array textures are not supported");
- return;
- }
- break;
-
- case QOpenGLTexture::TargetCubeMapArray:
- // Cubemap arrays must specify number of layer-faces (6 * layers) as depth parameter
- if (features.testFlag(QOpenGLTexture::TextureCubeMapArrays)) {
- texFuncs->glTextureStorage3D(textureId, target, bindingTarget, mipLevels, format,
- dimensions[0], dimensions[1], 6 * layers);
- } else {
- qWarning("Cubemap Array textures are not supported");
- return;
- }
- break;
-
- case QOpenGLTexture::Target3D:
- if (features.testFlag(QOpenGLTexture::Texture3D)) {
- texFuncs->glTextureStorage3D(textureId, target, bindingTarget, mipLevels, format,
- dimensions[0], dimensions[1], dimensions[2]);
- } else {
- qWarning("3D textures are not supported");
- return;
- }
- break;
-
- case QOpenGLTexture::Target2DMultisample:
- if (features.testFlag(QOpenGLTexture::ImmutableMultisampleStorage)) {
- texFuncs->glTextureStorage2DMultisample(textureId, target, bindingTarget, samples, format,
- dimensions[0], dimensions[1],
- fixedSamplePositions);
- } else {
- qWarning("Multisample textures are not supported");
- return;
- }
- break;
-
- case QOpenGLTexture::Target2DMultisampleArray:
- if (features.testFlag(QOpenGLTexture::ImmutableMultisampleStorage)
- && features.testFlag(QOpenGLTexture::TextureArrays)) {
- texFuncs->glTextureStorage3DMultisample(textureId, target, bindingTarget, samples, format,
- dimensions[0], dimensions[1], layers,
- fixedSamplePositions);
- } else {
- qWarning("Multisample array textures are not supported");
- return;
- }
- break;
- }
-
- storageAllocated = true;
-}
-
-void QOpenGLTexturePrivate::setData(int mipLevel, int layer, int layerCount, QOpenGLTexture::CubeMapFace cubeFace,
- QOpenGLTexture::PixelFormat sourceFormat, QOpenGLTexture::PixelType sourceType,
- const void *data, const QOpenGLPixelTransferOptions * const options)
-{
- switch (target) {
- case QOpenGLTexture::Target1D:
- Q_UNUSED(layer);
- Q_UNUSED(cubeFace);
- Q_UNUSED(layerCount);
- texFuncs->glTextureSubImage1D(textureId, target, bindingTarget, mipLevel,
- 0, mipLevelSize( mipLevel, dimensions[0] ),
- sourceFormat, sourceType, data, options);
- break;
-
- case QOpenGLTexture::Target1DArray:
- Q_UNUSED(cubeFace);
- texFuncs->glTextureSubImage2D(textureId, target, bindingTarget, mipLevel,
- 0, layer,
- mipLevelSize(mipLevel, dimensions[0]),
- layerCount,
- sourceFormat, sourceType, data, options);
- break;
-
- case QOpenGLTexture::Target2D:
- Q_UNUSED(layer);
- Q_UNUSED(cubeFace);
- Q_UNUSED(layerCount);
- texFuncs->glTextureSubImage2D(textureId, target, bindingTarget, mipLevel,
- 0, 0,
- mipLevelSize(mipLevel, dimensions[0]),
- mipLevelSize(mipLevel, dimensions[1]),
- sourceFormat, sourceType, data, options);
- break;
-
- case QOpenGLTexture::Target2DArray:
- Q_UNUSED(cubeFace);
- texFuncs->glTextureSubImage3D(textureId, target, bindingTarget, mipLevel,
- 0, 0, layer,
- mipLevelSize(mipLevel, dimensions[0]),
- mipLevelSize(mipLevel, dimensions[1]),
- layerCount,
- sourceFormat, sourceType, data, options);
- break;
-
- case QOpenGLTexture::Target3D:
- Q_UNUSED(cubeFace);
- Q_UNUSED(layerCount);
- texFuncs->glTextureSubImage3D(textureId, target, bindingTarget, mipLevel,
- 0, 0, layer,
- mipLevelSize(mipLevel, dimensions[0]),
- mipLevelSize(mipLevel, dimensions[1]),
- mipLevelSize(mipLevel, dimensions[2]),
- sourceFormat, sourceType, data, options);
- break;
-
- case QOpenGLTexture::TargetCubeMap:
- Q_UNUSED(layer);
- Q_UNUSED(layerCount);
- texFuncs->glTextureSubImage2D(textureId, cubeFace, bindingTarget, mipLevel,
- 0, 0,
- mipLevelSize(mipLevel, dimensions[0]),
- mipLevelSize(mipLevel, dimensions[1]),
- sourceFormat, sourceType, data, options);
- break;
-
- case QOpenGLTexture::TargetCubeMapArray: {
- int faceIndex = cubeFace - QOpenGLTexture::CubeMapPositiveX;
- int layerFace = 6 * layer + faceIndex;
- texFuncs->glTextureSubImage3D(textureId, target, bindingTarget, mipLevel,
- 0, 0, layerFace,
- mipLevelSize(mipLevel, dimensions[0]),
- mipLevelSize(mipLevel, dimensions[1]),
- layerCount,
- sourceFormat, sourceType, data, options);
- break;
- }
-
- case QOpenGLTexture::TargetRectangle:
- Q_UNUSED(mipLevel);
- Q_UNUSED(layer);
- Q_UNUSED(cubeFace);
- Q_UNUSED(layerCount);
- texFuncs->glTextureSubImage2D(textureId, target, bindingTarget, 0,
- 0, 0,
- dimensions[0],
- dimensions[1],
- sourceFormat, sourceType, data, options);
- break;
-
- case QOpenGLTexture::Target2DMultisample:
- case QOpenGLTexture::Target2DMultisampleArray:
- case QOpenGLTexture::TargetBuffer:
- // We don't upload pixel data for these targets
- qWarning("QOpenGLTexture::setData(): Texture target does not support pixel data upload");
- break;
- }
-
- // If requested perform automatic mip map generation
- if (mipLevel == 0 && autoGenerateMipMaps && mipLevels > 1) {
- Q_Q(QOpenGLTexture);
- q->generateMipMaps();
- }
-}
-
-void QOpenGLTexturePrivate::setData(int xOffset, int yOffset, int zOffset, int width, int height, int depth,
- int mipLevel, int layer, int layerCount, QOpenGLTexture::CubeMapFace cubeFace,
- QOpenGLTexture::PixelFormat sourceFormat, QOpenGLTexture::PixelType sourceType,
- const void *data, const QOpenGLPixelTransferOptions * const options)
-{
- switch (target) {
- case QOpenGLTexture::Target1D:
- Q_UNUSED(layer);
- Q_UNUSED(cubeFace);
- Q_UNUSED(layerCount);
- Q_UNUSED(yOffset);
- Q_UNUSED(zOffset);
- Q_UNUSED(height);
- Q_UNUSED(depth);
- texFuncs->glTextureSubImage1D(textureId, target, bindingTarget, mipLevel,
- xOffset, width,
- sourceFormat, sourceType, data, options);
- break;
-
- case QOpenGLTexture::Target1DArray:
- Q_UNUSED(cubeFace);
- Q_UNUSED(yOffset);
- Q_UNUSED(zOffset);
- Q_UNUSED(height);
- Q_UNUSED(depth);
- texFuncs->glTextureSubImage2D(textureId, target, bindingTarget, mipLevel,
- xOffset, layer,
- width,
- layerCount,
- sourceFormat, sourceType, data, options);
- break;
-
- case QOpenGLTexture::Target2D:
- Q_UNUSED(layer);
- Q_UNUSED(cubeFace);
- Q_UNUSED(layerCount);
- Q_UNUSED(zOffset);
- Q_UNUSED(depth);
- texFuncs->glTextureSubImage2D(textureId, target, bindingTarget, mipLevel,
- xOffset, yOffset,
- width, height,
- sourceFormat, sourceType, data, options);
- break;
-
- case QOpenGLTexture::Target2DArray:
- Q_UNUSED(cubeFace);
- Q_UNUSED(zOffset);
- Q_UNUSED(depth);
- texFuncs->glTextureSubImage3D(textureId, target, bindingTarget, mipLevel,
- xOffset, yOffset, layer,
- width, height, layerCount,
- sourceFormat, sourceType, data, options);
- break;
-
- case QOpenGLTexture::Target3D:
- Q_UNUSED(cubeFace);
- Q_UNUSED(layerCount);
- texFuncs->glTextureSubImage3D(textureId, target, bindingTarget, mipLevel,
- xOffset, yOffset, zOffset,
- width, height, depth,
- sourceFormat, sourceType, data, options);
- break;
-
- case QOpenGLTexture::TargetCubeMap:
- Q_UNUSED(layer);
- Q_UNUSED(layerCount);
- Q_UNUSED(zOffset);
- Q_UNUSED(depth);
- texFuncs->glTextureSubImage2D(textureId, cubeFace, bindingTarget, mipLevel,
- xOffset, yOffset,
- width, height,
- sourceFormat, sourceType, data, options);
- break;
-
- case QOpenGLTexture::TargetCubeMapArray: {
- Q_UNUSED(zOffset);
- Q_UNUSED(depth);
- int faceIndex = cubeFace - QOpenGLTexture::CubeMapPositiveX;
- int layerFace = 6 * layer + faceIndex;
- texFuncs->glTextureSubImage3D(textureId, target, bindingTarget, mipLevel,
- xOffset, yOffset, layerFace,
- width, height,
- layerCount,
- sourceFormat, sourceType, data, options);
- break;
- }
-
- case QOpenGLTexture::TargetRectangle:
- Q_UNUSED(mipLevel);
- Q_UNUSED(layer);
- Q_UNUSED(cubeFace);
- Q_UNUSED(layerCount);
- Q_UNUSED(zOffset);
- Q_UNUSED(depth);
- texFuncs->glTextureSubImage2D(textureId, target, bindingTarget, 0,
- xOffset, yOffset,
- width, height,
- sourceFormat, sourceType, data, options);
- break;
-
- case QOpenGLTexture::Target2DMultisample:
- case QOpenGLTexture::Target2DMultisampleArray:
- case QOpenGLTexture::TargetBuffer:
- // We don't upload pixel data for these targets
- qWarning("QOpenGLTexture::setData(): Texture target does not support pixel data upload");
- break;
- }
-
- // If requested perform automatic mip map generation
- if (mipLevel == 0 && autoGenerateMipMaps && mipLevels > 1) {
- Q_Q(QOpenGLTexture);
- q->generateMipMaps();
- }
-}
-
-
-void QOpenGLTexturePrivate::setCompressedData(int mipLevel, int layer, int layerCount,
- QOpenGLTexture::CubeMapFace cubeFace,
- int dataSize, const void *data,
- const QOpenGLPixelTransferOptions * const options)
-{
- if (!isCompressedFormat(format)) {
- qWarning("Cannot set compressed data for non-compressed format 0x%x", format);
- return;
- }
-
- const bool needsFullSpec = !isUsingImmutableStorage(); // was allocateStorage() a no-op?
-
- switch (target) {
- case QOpenGLTexture::Target1D:
- Q_UNUSED(layer);
- Q_UNUSED(cubeFace);
- Q_UNUSED(layerCount);
- if (needsFullSpec) {
- texFuncs->glCompressedTextureImage1D(textureId, target, bindingTarget, mipLevel,
- format,
- mipLevelSize(mipLevel, dimensions[0]),
- 0, dataSize, data, options);
- } else {
- texFuncs->glCompressedTextureSubImage1D(textureId, target, bindingTarget, mipLevel,
- 0, mipLevelSize( mipLevel, dimensions[0] ),
- format, dataSize, data, options);
- }
- break;
-
- case QOpenGLTexture::Target1DArray:
- Q_UNUSED(cubeFace);
- if (!needsFullSpec) {
- texFuncs->glCompressedTextureSubImage2D(textureId, target, bindingTarget, mipLevel,
- 0, layer,
- mipLevelSize(mipLevel, dimensions[0]),
- layerCount,
- format, dataSize, data, options);
- }
- break;
-
- case QOpenGLTexture::Target2D:
- Q_UNUSED(layer);
- Q_UNUSED(cubeFace);
- Q_UNUSED(layerCount);
- if (needsFullSpec) {
- texFuncs->glCompressedTextureImage2D(textureId, target, bindingTarget, mipLevel,
- format,
- mipLevelSize(mipLevel, dimensions[0]),
- mipLevelSize(mipLevel, dimensions[1]),
- 0, dataSize, data, options);
- } else {
- texFuncs->glCompressedTextureSubImage2D(textureId, target, bindingTarget, mipLevel,
- 0, 0,
- mipLevelSize(mipLevel, dimensions[0]),
- mipLevelSize(mipLevel, dimensions[1]),
- format, dataSize, data, options);
- }
- break;
-
- case QOpenGLTexture::Target2DArray:
- Q_UNUSED(cubeFace);
- if (!needsFullSpec) {
- texFuncs->glCompressedTextureSubImage3D(textureId, target, bindingTarget, mipLevel,
- 0, 0, layer,
- mipLevelSize(mipLevel, dimensions[0]),
- mipLevelSize(mipLevel, dimensions[1]),
- layerCount,
- format, dataSize, data, options);
- }
- break;
-
- case QOpenGLTexture::Target3D:
- Q_UNUSED(cubeFace);
- Q_UNUSED(layerCount);
- if (needsFullSpec) {
- texFuncs->glCompressedTextureImage3D(textureId, target, bindingTarget, mipLevel,
- format,
- mipLevelSize(mipLevel, dimensions[0]),
- mipLevelSize(mipLevel, dimensions[1]),
- mipLevelSize(mipLevel, dimensions[2]),
- 0, dataSize, data, options);
- } else {
- texFuncs->glCompressedTextureSubImage3D(textureId, target, bindingTarget, mipLevel,
- 0, 0, layer,
- mipLevelSize(mipLevel, dimensions[0]),
- mipLevelSize(mipLevel, dimensions[1]),
- mipLevelSize(mipLevel, dimensions[2]),
- format, dataSize, data, options);
- }
- break;
-
- case QOpenGLTexture::TargetCubeMap:
- Q_UNUSED(layer);
- Q_UNUSED(layerCount);
- if (needsFullSpec) {
- texFuncs->glCompressedTextureImage2D(textureId, cubeFace, bindingTarget, mipLevel,
- format,
- mipLevelSize(mipLevel, dimensions[0]),
- mipLevelSize(mipLevel, dimensions[1]),
- 0, dataSize, data, options);
- } else {
- texFuncs->glCompressedTextureSubImage2D(textureId, cubeFace, bindingTarget, mipLevel,
- 0, 0,
- mipLevelSize(mipLevel, dimensions[0]),
- mipLevelSize(mipLevel, dimensions[1]),
- format, dataSize, data, options);
- }
- break;
-
- case QOpenGLTexture::TargetCubeMapArray: {
- int faceIndex = cubeFace - QOpenGLTexture::CubeMapPositiveX;
- int layerFace = 6 * layer + faceIndex;
- if (!needsFullSpec) {
- texFuncs->glCompressedTextureSubImage3D(textureId, target, bindingTarget, mipLevel,
- 0, 0, layerFace,
- mipLevelSize(mipLevel, dimensions[0]),
- mipLevelSize(mipLevel, dimensions[1]),
- layerCount,
- format, dataSize, data, options);
- }
- break;
- }
-
- case QOpenGLTexture::TargetRectangle:
- case QOpenGLTexture::Target2DMultisample:
- case QOpenGLTexture::Target2DMultisampleArray:
- case QOpenGLTexture::TargetBuffer:
- // We don't upload pixel data for these targets
- qWarning("QOpenGLTexture::setCompressedData(): Texture target does not support pixel data upload");
- break;
- }
-
- // If requested perform automatic mip map generation
- if (mipLevel == 0 && autoGenerateMipMaps && mipLevels > 1) {
- Q_Q(QOpenGLTexture);
- q->generateMipMaps();
- }
-}
-
-void QOpenGLTexturePrivate::setWrapMode(QOpenGLTexture::WrapMode mode)
-{
- switch (target) {
- case QOpenGLTexture::Target1D:
- case QOpenGLTexture::Target1DArray:
- case QOpenGLTexture::TargetBuffer:
- wrapModes[0] = mode;
- texFuncs->glTextureParameteri(textureId, target, bindingTarget, GL_TEXTURE_WRAP_S, mode);
- break;
-
- case QOpenGLTexture::Target2D:
- case QOpenGLTexture::Target2DArray:
- case QOpenGLTexture::TargetCubeMap:
- case QOpenGLTexture::TargetCubeMapArray:
- case QOpenGLTexture::Target2DMultisample:
- case QOpenGLTexture::Target2DMultisampleArray:
- case QOpenGLTexture::TargetRectangle:
- wrapModes[0] = wrapModes[1] = mode;
- texFuncs->glTextureParameteri(textureId, target, bindingTarget, GL_TEXTURE_WRAP_S, mode);
- texFuncs->glTextureParameteri(textureId, target, bindingTarget, GL_TEXTURE_WRAP_T, mode);
- break;
-
- case QOpenGLTexture::Target3D:
- wrapModes[0] = wrapModes[1] = wrapModes[2] = mode;
- texFuncs->glTextureParameteri(textureId, target, bindingTarget, GL_TEXTURE_WRAP_S, mode);
- texFuncs->glTextureParameteri(textureId, target, bindingTarget, GL_TEXTURE_WRAP_T, mode);
- texFuncs->glTextureParameteri(textureId, target, bindingTarget, GL_TEXTURE_WRAP_R, mode);
- break;
- }
-}
-
-void QOpenGLTexturePrivate::setWrapMode(QOpenGLTexture::CoordinateDirection direction, QOpenGLTexture::WrapMode mode)
-{
- switch (target) {
- case QOpenGLTexture::Target1D:
- case QOpenGLTexture::Target1DArray:
- case QOpenGLTexture::TargetBuffer:
- switch (direction) {
- case QOpenGLTexture::DirectionS:
- wrapModes[0] = mode;
- texFuncs->glTextureParameteri(textureId, target, bindingTarget, GL_TEXTURE_WRAP_S, mode);
- break;
-
- case QOpenGLTexture::DirectionT:
- case QOpenGLTexture::DirectionR:
- qWarning("QOpenGLTexture::setWrapMode() direction not valid for this texture target");
- break;
- }
- break;
-
- case QOpenGLTexture::Target2D:
- case QOpenGLTexture::Target2DArray:
- case QOpenGLTexture::TargetCubeMap:
- case QOpenGLTexture::TargetCubeMapArray:
- case QOpenGLTexture::Target2DMultisample:
- case QOpenGLTexture::Target2DMultisampleArray:
- case QOpenGLTexture::TargetRectangle:
- switch (direction) {
- case QOpenGLTexture::DirectionS:
- wrapModes[0] = mode;
- texFuncs->glTextureParameteri(textureId, target, bindingTarget, GL_TEXTURE_WRAP_S, mode);
- break;
-
- case QOpenGLTexture::DirectionT:
- wrapModes[1] = mode;
- texFuncs->glTextureParameteri(textureId, target, bindingTarget, GL_TEXTURE_WRAP_T, mode);
- break;
-
- case QOpenGLTexture::DirectionR:
- qWarning("QOpenGLTexture::setWrapMode() direction not valid for this texture target");
- break;
- }
- break;
-
- case QOpenGLTexture::Target3D:
- switch (direction) {
- case QOpenGLTexture::DirectionS:
- wrapModes[0] = mode;
- texFuncs->glTextureParameteri(textureId, target, bindingTarget, direction, mode);
- break;
-
- case QOpenGLTexture::DirectionT:
- wrapModes[1] = mode;
- texFuncs->glTextureParameteri(textureId, target, bindingTarget, direction, mode);
- break;
-
- case QOpenGLTexture::DirectionR:
- wrapModes[2] = mode;
- texFuncs->glTextureParameteri(textureId, target, bindingTarget, direction, mode);
- break;
- }
- break;
- }
-}
-
-QOpenGLTexture::WrapMode QOpenGLTexturePrivate::wrapMode(QOpenGLTexture::CoordinateDirection direction) const
-{
- switch (target) {
- case QOpenGLTexture::Target1D:
- case QOpenGLTexture::Target1DArray:
- case QOpenGLTexture::TargetBuffer:
- switch (direction) {
- case QOpenGLTexture::DirectionS:
- return wrapModes[0];
-
- case QOpenGLTexture::DirectionT:
- case QOpenGLTexture::DirectionR:
- qWarning("QOpenGLTexture::wrapMode() direction not valid for this texture target");
- return QOpenGLTexture::Repeat;
- }
- break;
-
- case QOpenGLTexture::Target2D:
- case QOpenGLTexture::Target2DArray:
- case QOpenGLTexture::TargetCubeMap:
- case QOpenGLTexture::TargetCubeMapArray:
- case QOpenGLTexture::Target2DMultisample:
- case QOpenGLTexture::Target2DMultisampleArray:
- case QOpenGLTexture::TargetRectangle:
- switch (direction) {
- case QOpenGLTexture::DirectionS:
- return wrapModes[0];
-
- case QOpenGLTexture::DirectionT:
- return wrapModes[1];
-
- case QOpenGLTexture::DirectionR:
- qWarning("QOpenGLTexture::wrapMode() direction not valid for this texture target");
- return QOpenGLTexture::Repeat;
- }
- break;
-
- case QOpenGLTexture::Target3D:
- switch (direction) {
- case QOpenGLTexture::DirectionS:
- return wrapModes[0];
-
- case QOpenGLTexture::DirectionT:
- return wrapModes[1];
-
- case QOpenGLTexture::DirectionR:
- return wrapModes[2];
- }
- break;
- }
- // Should never get here
- Q_ASSERT(false);
- return QOpenGLTexture::Repeat;
-}
-
-QOpenGLTexture *QOpenGLTexturePrivate::createTextureView(QOpenGLTexture::Target viewTarget,
- QOpenGLTexture::TextureFormat viewFormat,
- int minimumMipmapLevel, int maximumMipmapLevel,
- int minimumLayer, int maximumLayer) const
-{
- // Do sanity checks - see http://www.opengl.org/wiki/GLAPI/glTextureView
-
- // Check the targets are compatible
- bool viewTargetCompatible = false;
- switch (target) {
- case QOpenGLTexture::Target1D:
- case QOpenGLTexture::Target1DArray:
- viewTargetCompatible = (viewTarget == QOpenGLTexture::Target1D
- || viewTarget == QOpenGLTexture::Target1DArray);
- break;
-
-
- case QOpenGLTexture::Target2D:
- case QOpenGLTexture::Target2DArray:
- viewTargetCompatible = (viewTarget == QOpenGLTexture::Target2D
- || viewTarget == QOpenGLTexture::Target2DArray);
- break;
-
- case QOpenGLTexture::Target3D:
- viewTargetCompatible = (viewTarget == QOpenGLTexture::Target3D);
- break;
-
- case QOpenGLTexture::TargetCubeMap:
- case QOpenGLTexture::TargetCubeMapArray:
- viewTargetCompatible = (viewTarget == QOpenGLTexture::TargetCubeMap
- || viewTarget == QOpenGLTexture::Target2D
- || viewTarget == QOpenGLTexture::Target2DArray
- || viewTarget == QOpenGLTexture::TargetCubeMapArray);
- break;
-
- case QOpenGLTexture::Target2DMultisample:
- case QOpenGLTexture::Target2DMultisampleArray:
- viewTargetCompatible = (viewTarget == QOpenGLTexture::Target2DMultisample
- || viewTarget == QOpenGLTexture::Target2DMultisampleArray);
- break;
-
- case QOpenGLTexture::TargetRectangle:
- viewTargetCompatible = (viewTarget == QOpenGLTexture::TargetRectangle);
- break;
-
- case QOpenGLTexture::TargetBuffer:
- // Cannot be used with texture views
- break;
- }
-
- if (!viewTargetCompatible) {
- qWarning("QOpenGLTexture::createTextureView(): Incompatible source and view targets");
- return nullptr;
- }
-
- // Check the formats are compatible
- bool viewFormatCompatible = false;
- switch (formatClass) {
- case QOpenGLTexture::NoFormatClass:
- break;
-
- case QOpenGLTexture::FormatClass_128Bit:
- viewFormatCompatible = (viewFormat == QOpenGLTexture::RGBA32F
- || viewFormat == QOpenGLTexture::RGBA32U
- || viewFormat == QOpenGLTexture::RGBA32I);
- break;
-
- case QOpenGLTexture::FormatClass_96Bit:
- viewFormatCompatible = (viewFormat == QOpenGLTexture::RGB32F
- || viewFormat == QOpenGLTexture::RGB32U
- || viewFormat == QOpenGLTexture::RGB32I);
- break;
-
- case QOpenGLTexture::FormatClass_64Bit:
- viewFormatCompatible = (viewFormat == QOpenGLTexture::RGBA16F
- || viewFormat == QOpenGLTexture::RG32F
- || viewFormat == QOpenGLTexture::RGBA16U
- || viewFormat == QOpenGLTexture::RG32U
- || viewFormat == QOpenGLTexture::RGBA16I
- || viewFormat == QOpenGLTexture::RG32I
- || viewFormat == QOpenGLTexture::RGBA16_UNorm
- || viewFormat == QOpenGLTexture::RGBA16_SNorm);
- break;
-
- case QOpenGLTexture::FormatClass_48Bit:
- viewFormatCompatible = (viewFormat == QOpenGLTexture::RGB16_UNorm
- || viewFormat == QOpenGLTexture::RGB16_SNorm
- || viewFormat == QOpenGLTexture::RGB16F
- || viewFormat == QOpenGLTexture::RGB16U
- || viewFormat == QOpenGLTexture::RGB16I);
- break;
-
- case QOpenGLTexture::FormatClass_32Bit:
- viewFormatCompatible = (viewFormat == QOpenGLTexture::RG16F
- || viewFormat == QOpenGLTexture::RG11B10F
- || viewFormat == QOpenGLTexture::R32F
- || viewFormat == QOpenGLTexture::RGB10A2
- || viewFormat == QOpenGLTexture::RGBA8U
- || viewFormat == QOpenGLTexture::RG16U
- || viewFormat == QOpenGLTexture::R32U
- || viewFormat == QOpenGLTexture::RGBA8I
- || viewFormat == QOpenGLTexture::RG16I
- || viewFormat == QOpenGLTexture::R32I
- || viewFormat == QOpenGLTexture::RGBA8_UNorm
- || viewFormat == QOpenGLTexture::RG16_UNorm
- || viewFormat == QOpenGLTexture::RGBA8_SNorm
- || viewFormat == QOpenGLTexture::RG16_SNorm
- || viewFormat == QOpenGLTexture::SRGB8_Alpha8
- || viewFormat == QOpenGLTexture::RGB9E5);
- break;
-
- case QOpenGLTexture::FormatClass_24Bit:
- viewFormatCompatible = (viewFormat == QOpenGLTexture::RGB8_UNorm
- || viewFormat == QOpenGLTexture::RGB8_SNorm
- || viewFormat == QOpenGLTexture::SRGB8
- || viewFormat == QOpenGLTexture::RGB8U
- || viewFormat == QOpenGLTexture::RGB8I);
- break;
-
- case QOpenGLTexture::FormatClass_16Bit:
- viewFormatCompatible = (viewFormat == QOpenGLTexture::R16F
- || viewFormat == QOpenGLTexture::RG8U
- || viewFormat == QOpenGLTexture::R16U
- || viewFormat == QOpenGLTexture::RG8I
- || viewFormat == QOpenGLTexture::R16I
- || viewFormat == QOpenGLTexture::RG8_UNorm
- || viewFormat == QOpenGLTexture::R16_UNorm
- || viewFormat == QOpenGLTexture::RG8_SNorm
- || viewFormat == QOpenGLTexture::R16_SNorm);
- break;
-
- case QOpenGLTexture::FormatClass_8Bit:
- viewFormatCompatible = (viewFormat == QOpenGLTexture::R8U
- || viewFormat == QOpenGLTexture::R8I
- || viewFormat == QOpenGLTexture::R8_UNorm
- || viewFormat == QOpenGLTexture::R8_SNorm);
- break;
-
- case QOpenGLTexture::FormatClass_RGTC1_R:
- viewFormatCompatible = (viewFormat == QOpenGLTexture::R_ATI1N_UNorm
- || viewFormat == QOpenGLTexture::R_ATI1N_SNorm);
- break;
-
- case QOpenGLTexture::FormatClass_RGTC2_RG:
- viewFormatCompatible = (viewFormat == QOpenGLTexture::RG_ATI2N_UNorm
- || viewFormat == QOpenGLTexture::RG_ATI2N_SNorm);
- break;
-
- case QOpenGLTexture::FormatClass_BPTC_Unorm:
- viewFormatCompatible = (viewFormat == QOpenGLTexture::RGB_BP_UNorm
- || viewFormat == QOpenGLTexture::SRGB_BP_UNorm);
- break;
-
- case QOpenGLTexture::FormatClass_BPTC_Float:
- viewFormatCompatible = (viewFormat == QOpenGLTexture::RGB_BP_UNSIGNED_FLOAT
- || viewFormat == QOpenGLTexture::RGB_BP_SIGNED_FLOAT);
- break;
-
- case QOpenGLTexture::FormatClass_S3TC_DXT1_RGB:
- viewFormatCompatible = (viewFormat == QOpenGLTexture::RGB_DXT1
- || viewFormat == QOpenGLTexture::SRGB_DXT1);
- break;
-
- case QOpenGLTexture::FormatClass_S3TC_DXT1_RGBA:
- viewFormatCompatible = (viewFormat == QOpenGLTexture::RGBA_DXT1
- || viewFormat == QOpenGLTexture::SRGB_Alpha_DXT1);
- break;
-
- case QOpenGLTexture::FormatClass_S3TC_DXT3_RGBA:
- viewFormatCompatible = (viewFormat == QOpenGLTexture::RGBA_DXT3
- || viewFormat == QOpenGLTexture::SRGB_Alpha_DXT3);
- break;
-
- case QOpenGLTexture::FormatClass_S3TC_DXT5_RGBA:
- viewFormatCompatible = (viewFormat == QOpenGLTexture::RGBA_DXT5
- || viewFormat == QOpenGLTexture::SRGB_Alpha_DXT5);
- break;
-
- case QOpenGLTexture::FormatClass_Unique:
- viewFormatCompatible = (viewFormat == format);
- break;
- }
-
- if (!viewFormatCompatible) {
- qWarning("QOpenGLTexture::createTextureView(): Incompatible source and view formats");
- return nullptr;
- }
-
-
- // Create a view
- QOpenGLTexture *view = new QOpenGLTexture(viewTarget);
- view->setFormat(viewFormat);
- view->create();
- view->d_ptr->textureView = true;
- texFuncs->glTextureView(view->textureId(), viewTarget, textureId, viewFormat,
- minimumMipmapLevel, maximumMipmapLevel - minimumMipmapLevel + 1,
- minimumLayer, maximumLayer - minimumLayer + 1);
- return view;
-}
-
-
-/*!
- \class QOpenGLTexture
- \inmodule QtGui
- \since 5.2
- \wrapper
- \brief The QOpenGLTexture class encapsulates an OpenGL texture object.
-
- QOpenGLTexture makes it easy to work with OpenGL textures and the myriad features
- and targets that they offer depending upon the capabilities of your OpenGL implementation.
-
- The typical usage pattern for QOpenGLTexture is
- \list
- \li Instantiate the object specifying the texture target type
- \li Set properties that affect the storage requirements e.g. storage format, dimensions
- \li Allocate the server-side storage
- \li Optionally upload pixel data
- \li Optionally set any additional properties e.g. filtering and border options
- \li Render with texture or render to texture
- \endlist
-
- In the common case of simply using a QImage as the source of texture pixel data
- most of the above steps are performed automatically.
-
- \code
- // Prepare texture
- QOpenGLTexture *texture = new QOpenGLTexture(QImage(fileName).mirrored());
- texture->setMinificationFilter(QOpenGLTexture::LinearMipMapLinear);
- texture->setMagnificationFilter(QOpenGLTexture::Linear);
- ...
- // Render with texture
- texture->bind();
- glDrawArrays(...);
- \endcode
-
- Note that the QImage is mirrored vertically to account for the fact that
- OpenGL and QImage use opposite directions for the y axis. Another option
- would be to transform your texture coordinates.
-*/
-
-/*!
- \enum QOpenGLTexture::Filter
- This enum defines the filtering parameters for a QOpenGLTexture object.
- \value Nearest Equivalent to GL_NEAREST
- \value Linear Equivalent to GL_LINEAR
- \value NearestMipMapNearest Equivalent to GL_NEAREST_MIPMAP_NEAREST
- \value NearestMipMapLinear Equivalent to GL_NEAREST_MIPMAP_LINEAR
- \value LinearMipMapNearest Equivalent to GL_LINEAR_MIPMAP_NEAREST
- \value LinearMipMapLinear Equivalent to GL_LINEAR_MIPMAP_LINEAR
-*/
-
-/*!
- \enum QOpenGLTexture::Target
- This enum defines the texture target of a QOpenGLTexture object.
-
- \value Target1D A 1-dimensional texture.
- Equivalent to GL_TEXTURE_1D.
- \value Target1DArray An array of 1-dimensional textures.
- Equivalent to GL_TEXTURE_1D_ARRAY
- \value Target2D A 2-dimensional texture.
- Equivalent to GL_TEXTURE_2D
- \value Target2DArray An array of 1-dimensional textures.
- Equivalent to GL_TEXTURE_2D_ARRAY
- \value Target3D A 3-dimensional texture.
- Equivalent to GL_TEXTURE_3D
- \value TargetCubeMap A cubemap texture.
- Equivalent to GL_TEXTURE_CUBE_MAP
- \value TargetCubeMapArray An array of cubemap textures.
- Equivalent to GL_TEXTURE_CUBE_MAP_ARRAY
- \value Target2DMultisample A 2-dimensional texture with multisample support.
- Equivalent to GL_TEXTURE_2D_MULTISAMPLE
- \value Target2DMultisampleArray An array of 2-dimensional textures with multisample support.
- Equivalent to GL_TEXTURE_2D_MULTISAMPLE_ARRAY
- \value TargetRectangle A rectangular 2-dimensional texture.
- Equivalent to GL_TEXTURE_RECTANGLE
- \value TargetBuffer A texture with data from an OpenGL buffer object.
- Equivalent to GL_TEXTURE_BUFFER
-*/
-
-/*!
- \enum QOpenGLTexture::BindingTarget
- This enum defines the possible binding targets of texture units.
-
- \value BindingTarget1D Equivalent to GL_TEXTURE_BINDING_1D
- \value BindingTarget1DArray Equivalent to GL_TEXTURE_BINDING_1D_ARRAY
- \value BindingTarget2D Equivalent to GL_TEXTURE_BINDING_2D
- \value BindingTarget2DArray Equivalent to GL_TEXTURE_BINDING_2D_ARRAY
- \value BindingTarget3D Equivalent to GL_TEXTURE_BINDING_3D
- \value BindingTargetCubeMap Equivalent to GL_TEXTURE_BINDING_CUBE_MAP
- \value BindingTargetCubeMapArray Equivalent to GL_TEXTURE_BINDING_CUBE_MAP_ARRAY
- \value BindingTarget2DMultisample Equivalent to GL_TEXTURE_BINDING_2D_MULTISAMPLE
- \value BindingTarget2DMultisampleArray Equivalent to GL_TEXTURE_BINDING_2D_MULTISAMPLE_ARRAY
- \value BindingTargetRectangle Equivalent to GL_TEXTURE_BINDING_RECTANGLE
- \value BindingTargetBuffer Equivalent to GL_TEXTURE_BINDING_BUFFER
-*/
-
-/*!
- \enum QOpenGLTexture::MipMapGeneration
- This enum defines the options to control mipmap generation.
-
- \value GenerateMipMaps Mipmaps should be generated
- \value DontGenerateMipMaps Mipmaps should not be generated
-*/
-
-/*!
- \enum QOpenGLTexture::TextureUnitReset
- This enum defines options ot control texture unit activation.
-
- \value ResetTextureUnit The previous active texture unit will be reset
- \value DontResetTextureUnit The previous active texture unit will not be rest
-*/
-
-/*!
- \enum QOpenGLTexture::TextureFormat
- This enum defines the possible texture formats. Depending upon your OpenGL
- implementation only a subset of these may be supported.
-
- \value NoFormat Equivalent to GL_NONE
-
- \value R8_UNorm Equivalent to GL_R8
- \value RG8_UNorm Equivalent to GL_RG8
- \value RGB8_UNorm Equivalent to GL_RGB8
- \value RGBA8_UNorm Equivalent to GL_RGBA8
-
- \value R16_UNorm Equivalent to GL_R16
- \value RG16_UNorm Equivalent to GL_RG16
- \value RGB16_UNorm Equivalent to GL_RGB16
- \value RGBA16_UNorm Equivalent to GL_RGBA16
-
- \value R8_SNorm Equivalent to GL_R8_SNORM
- \value RG8_SNorm Equivalent to GL_RG8_SNORM
- \value RGB8_SNorm Equivalent to GL_RGB8_SNORM
- \value RGBA8_SNorm Equivalent to GL_RGBA8_SNORM
-
- \value R16_SNorm Equivalent to GL_R16_SNORM
- \value RG16_SNorm Equivalent to GL_RG16_SNORM
- \value RGB16_SNorm Equivalent to GL_RGB16_SNORM
- \value RGBA16_SNorm Equivalent to GL_RGBA16_SNORM
-
- \value R8U Equivalent to GL_R8UI
- \value RG8U Equivalent to GL_RG8UI
- \value RGB8U Equivalent to GL_RGB8UI
- \value RGBA8U Equivalent to GL_RGBA8UI
-
- \value R16U Equivalent to GL_R16UI
- \value RG16U Equivalent to GL_RG16UI
- \value RGB16U Equivalent to GL_RGB16UI
- \value RGBA16U Equivalent to GL_RGBA16UI
-
- \value R32U Equivalent to GL_R32UI
- \value RG32U Equivalent to GL_RG32UI
- \value RGB32U Equivalent to GL_RGB32UI
- \value RGBA32U Equivalent to GL_RGBA32UI
-
- \value R8I Equivalent to GL_R8I
- \value RG8I Equivalent to GL_RG8I
- \value RGB8I Equivalent to GL_RGB8I
- \value RGBA8I Equivalent to GL_RGBA8I
-
- \value R16I Equivalent to GL_R16I
- \value RG16I Equivalent to GL_RG16I
- \value RGB16I Equivalent to GL_RGB16I
- \value RGBA16I Equivalent to GL_RGBA16I
-
- \value R32I Equivalent to GL_R32I
- \value RG32I Equivalent to GL_RG32I
- \value RGB32I Equivalent to GL_RGB32I
- \value RGBA32I Equivalent to GL_RGBA32I
-
- \value R16F Equivalent to GL_R16F
- \value RG16F Equivalent to GL_RG16F
- \value RGB16F Equivalent to GL_RGB16F
- \value RGBA16F Equivalent to GL_RGBA16F
-
- \value R32F Equivalent to GL_R32F
- \value RG32F Equivalent to GL_RG32F
- \value RGB32F Equivalent to GL_RGB32F
- \value RGBA32F Equivalent to GL_RGBA32F
-
- \value RGB9E5 Equivalent to GL_RGB9_E5
- \value RG11B10F Equivalent to GL_R11F_G11F_B10F
- \value RG3B2 Equivalent to GL_R3_G3_B2
- \value R5G6B5 Equivalent to GL_RGB565
- \value RGB5A1 Equivalent to GL_RGB5_A1
- \value RGBA4 Equivalent to GL_RGBA4
- \value RGB10A2 Equivalent to GL_RGB10_A2UI
-
- \value D16 Equivalent to GL_DEPTH_COMPONENT16
- \value D24 Equivalent to GL_DEPTH_COMPONENT24
- \value D24S8 Equivalent to GL_DEPTH24_STENCIL8
- \value D32 Equivalent to GL_DEPTH_COMPONENT32
- \value D32F Equivalent to GL_DEPTH_COMPONENT32F
- \value D32FS8X24 Equivalent to GL_DEPTH32F_STENCIL8
- \value S8 Equivalent to GL_STENCIL_INDEX8. Introduced in Qt 5.4
-
- \value RGB_DXT1 Equivalent to GL_COMPRESSED_RGB_S3TC_DXT1_EXT
- \value RGBA_DXT1 Equivalent to GL_COMPRESSED_RGBA_S3TC_DXT1_EXT
- \value RGBA_DXT3 Equivalent to GL_COMPRESSED_RGBA_S3TC_DXT3_EXT
- \value RGBA_DXT5 Equivalent to GL_COMPRESSED_RGBA_S3TC_DXT5_EXT
- \value R_ATI1N_UNorm Equivalent to GL_COMPRESSED_RED_RGTC1
- \value R_ATI1N_SNorm Equivalent to GL_COMPRESSED_SIGNED_RED_RGTC1
- \value RG_ATI2N_UNorm Equivalent to GL_COMPRESSED_RG_RGTC2
- \value RG_ATI2N_SNorm Equivalent to GL_COMPRESSED_SIGNED_RG_RGTC2
- \value RGB_BP_UNSIGNED_FLOAT Equivalent to GL_COMPRESSED_RGB_BPTC_UNSIGNED_FLOAT_ARB
- \value RGB_BP_SIGNED_FLOAT Equivalent to GL_COMPRESSED_RGB_BPTC_SIGNED_FLOAT_ARB
- \value RGB_BP_UNorm Equivalent to GL_COMPRESSED_RGBA_BPTC_UNORM_ARB
- \value R11_EAC_UNorm Equivalent to GL_COMPRESSED_R11_EAC
- \value R11_EAC_SNorm Equivalent to GL_COMPRESSED_SIGNED_R11_EAC
- \value RG11_EAC_UNorm Equivalent to GL_COMPRESSED_RG11_EAC
- \value RG11_EAC_SNorm Equivalent to GL_COMPRESSED_SIGNED_RG11_EAC
- \value RGB8_ETC2 Equivalent to GL_COMPRESSED_RGB8_ETC2
- \value SRGB8_ETC2 Equivalent to GL_COMPRESSED_SRGB8_ETC2
- \value RGB8_PunchThrough_Alpha1_ETC2 Equivalent to GL_COMPRESSED_RGB8_PUNCHTHROUGH_ALPHA1_ETC2
- \value SRGB8_PunchThrough_Alpha1_ETC2 Equivalent to GL_COMPRESSED_SRGB8_PUNCHTHROUGH_ALPHA1_ETC2
- \value RGBA8_ETC2_EAC Equivalent to GL_COMPRESSED_RGBA8_ETC2_EAC
- \value SRGB8_Alpha8_ETC2_EAC Equivalent to GL_COMPRESSED_SRGB8_ALPHA8_ETC2_EAC
- \value RGB8_ETC1 Equivalent to GL_ETC1_RGB8_OES
- \value RGBA_ASTC_4x4 Equivalent to GL_COMPRESSED_RGBA_ASTC_4x4_KHR
- \value RGBA_ASTC_5x4 Equivalent to GL_COMPRESSED_RGBA_ASTC_5x4_KHR
- \value RGBA_ASTC_5x5 Equivalent to GL_COMPRESSED_RGBA_ASTC_5x5_KHR
- \value RGBA_ASTC_6x5 Equivalent to GL_COMPRESSED_RGBA_ASTC_6x5_KHR
- \value RGBA_ASTC_6x6 Equivalent to GL_COMPRESSED_RGBA_ASTC_6x6_KHR
- \value RGBA_ASTC_8x5 Equivalent to GL_COMPRESSED_RGBA_ASTC_8x5_KHR
- \value RGBA_ASTC_8x6 Equivalent to GL_COMPRESSED_RGBA_ASTC_8x6_KHR
- \value RGBA_ASTC_8x8 Equivalent to GL_COMPRESSED_RGBA_ASTC_8x8_KHR
- \value RGBA_ASTC_10x5 Equivalent to GL_COMPRESSED_RGBA_ASTC_10x5_KHR
- \value RGBA_ASTC_10x6 Equivalent to GL_COMPRESSED_RGBA_ASTC_10x6_KHR
- \value RGBA_ASTC_10x8 Equivalent to GL_COMPRESSED_RGBA_ASTC_10x8_KHR
- \value RGBA_ASTC_10x10 Equivalent to GL_COMPRESSED_RGBA_ASTC_10x10_KHR
- \value RGBA_ASTC_12x10 Equivalent to GL_COMPRESSED_RGBA_ASTC_12x10_KHR
- \value RGBA_ASTC_12x12 Equivalent to GL_COMPRESSED_RGBA_ASTC_12x12_KHR
- \value SRGB8_Alpha8_ASTC_4x4 Equivalent to GL_COMPRESSED_SRGB8_ALPHA8_ASTC_4x4_KHR
- \value SRGB8_Alpha8_ASTC_5x4 Equivalent to GL_COMPRESSED_SRGB8_ALPHA8_ASTC_5x4_KHR
- \value SRGB8_Alpha8_ASTC_5x5 Equivalent to GL_COMPRESSED_SRGB8_ALPHA8_ASTC_5x5_KHR
- \value SRGB8_Alpha8_ASTC_6x5 Equivalent to GL_COMPRESSED_SRGB8_ALPHA8_ASTC_6x5_KHR
- \value SRGB8_Alpha8_ASTC_6x6 Equivalent to GL_COMPRESSED_SRGB8_ALPHA8_ASTC_6x6_KHR
- \value SRGB8_Alpha8_ASTC_8x5 Equivalent to GL_COMPRESSED_SRGB8_ALPHA8_ASTC_8x5_KHR
- \value SRGB8_Alpha8_ASTC_8x6 Equivalent to GL_COMPRESSED_SRGB8_ALPHA8_ASTC_8x6_KHR
- \value SRGB8_Alpha8_ASTC_8x8 Equivalent to GL_COMPRESSED_SRGB8_ALPHA8_ASTC_8x8_KHR
- \value SRGB8_Alpha8_ASTC_10x5 Equivalent to GL_COMPRESSED_SRGB8_ALPHA8_ASTC_10x5_KHR
- \value SRGB8_Alpha8_ASTC_10x6 Equivalent to GL_COMPRESSED_SRGB8_ALPHA8_ASTC_10x6_KHR
- \value SRGB8_Alpha8_ASTC_10x8 Equivalent to GL_COMPRESSED_SRGB8_ALPHA8_ASTC_10x8_KHR
- \value SRGB8_Alpha8_ASTC_10x10 Equivalent to GL_COMPRESSED_SRGB8_ALPHA8_ASTC_10x10_KHR
- \value SRGB8_Alpha8_ASTC_12x10 Equivalent to GL_COMPRESSED_SRGB8_ALPHA8_ASTC_12x10_KHR
- \value SRGB8_Alpha8_ASTC_12x12 Equivalent to GL_COMPRESSED_SRGB8_ALPHA8_ASTC_12x12_KHR
-
- \value SRGB8 Equivalent to GL_SRGB8
- \value SRGB8_Alpha8 Equivalent to GL_SRGB8_ALPHA8
- \value SRGB_DXT1 Equivalent to GL_COMPRESSED_SRGB_S3TC_DXT1_EXT
- \value SRGB_Alpha_DXT1 Equivalent to GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT
- \value SRGB_Alpha_DXT3 Equivalent to GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT
- \value SRGB_Alpha_DXT5 Equivalent to GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT
- \value SRGB_BP_UNorm Equivalent to GL_COMPRESSED_SRGB_ALPHA_BPTC_UNORM_ARB
-
- \value DepthFormat Equivalent to GL_DEPTH_COMPONENT (only OpenGL ES 3 or ES 2 with OES_depth_texture)
- \value AlphaFormat Equivalent to GL_ALPHA (OpenGL ES 2 only)
- \value RGBFormat Equivalent to GL_RGB (OpenGL ES 2 only)
- \value RGBAFormat Equivalent to GL_RGBA (OpenGL ES 2 only)
- \value LuminanceFormat Equivalent to GL_LUMINANCE (OpenGL ES 2 only)
- \value LuminanceAlphaFormat Equivalent to GL_LUMINANCE_ALPHA (OpenGL ES 2 only)
-*/
-
-/*!
- \enum QOpenGLTexture::CubeMapFace
- This enum defines the possible CubeMap faces.
-
- \value CubeMapPositiveX Equivalent to GL_TEXTURE_CUBE_MAP_POSITIVE_X
- \value CubeMapNegativeX Equivalent to GL_TEXTURE_CUBE_MAP_NEGATIVE_X
- \value CubeMapPositiveY Equivalent to GL_TEXTURE_CUBE_MAP_POSITIVE_Y
- \value CubeMapNegativeY Equivalent to GL_TEXTURE_CUBE_MAP_NEGATIVE_Y
- \value CubeMapPositiveZ Equivalent to GL_TEXTURE_CUBE_MAP_POSITIVE_Z
- \value CubeMapNegativeZ Equivalent to GL_TEXTURE_CUBE_MAP_NEGATIVE_Z
-*/
-
-/*!
- \enum QOpenGLTexture::PixelFormat
- This enum defines the possible client-side pixel formats for a pixel
- transfer operation.
-
- \value NoSourceFormat Equivalent to GL_NONE
- \value Red Equivalent to GL_RED
- \value RG Equivalent to GL_RG
- \value RGB Equivalent to GL_RGB
- \value BGR Equivalent to GL_BGR
- \value RGBA Equivalent to GL_RGBA
- \value BGRA Equivalent to GL_BGRA
- \value Red_Integer Equivalent to GL_RED_INTEGER
- \value RG_Integer Equivalent to GL_RG_INTEGER
- \value RGB_Integer Equivalent to GL_RGB_INTEGER
- \value BGR_Integer Equivalent to GL_BGR_INTEGER
- \value RGBA_Integer Equivalent to GL_RGBA_INTEGER
- \value BGRA_Integer Equivalent to GL_BGRA_INTEGER
- \value Stencil Equivalent to GL_STENCIL_INDEX. Introduced in Qt 5.4
- \value Depth Equivalent to GL_DEPTH_COMPONENT
- \value DepthStencil Equivalent to GL_DEPTH_STENCIL
- \value Alpha Equivalent to GL_ALPHA (OpenGL ES 2 only)
- \value Luminance Equivalent to GL_LUMINANCE (OpenGL ES 2 only)
- \value LuminanceAlpha Equivalent to GL_LUMINANCE_ALPHA (OpenGL ES 2 only)
-
-*/
-
-/*!
- \enum QOpenGLTexture::PixelType
- This enum defines the possible pixel data types for a pixel transfer operation
-
- \value NoPixelType Equivalent to GL_NONE
- \value Int8 Equivalent to GL_BYTE
- \value UInt8 Equivalent to GL_UNSIGNED_BYTE
- \value Int16 Equivalent to GL_SHORT
- \value UInt16 Equivalent to GL_UNSIGNED_SHORT
- \value Int32 Equivalent to GL_INT
- \value UInt32 Equivalent to GL_UNSIGNED_INT
- \value Float16 Equivalent to GL_HALF_FLOAT
- \value Float16OES Equivalent to GL_HALF_FLOAT_OES
- \value Float32 Equivalent to GL_FLOAT
- \value UInt32_RGB9_E5 Equivalent to GL_UNSIGNED_INT_5_9_9_9_REV
- \value UInt32_RG11B10F Equivalent to GL_UNSIGNED_INT_10F_11F_11F_REV
- \value UInt8_RG3B2 Equivalent to GL_UNSIGNED_BYTE_3_3_2
- \value UInt8_RG3B2_Rev Equivalent to GL_UNSIGNED_BYTE_2_3_3_REV
- \value UInt16_RGB5A1 Equivalent to GL_UNSIGNED_SHORT_5_5_5_1
- \value UInt16_RGB5A1_Rev Equivalent to GL_UNSIGNED_SHORT_1_5_5_5_REV
- \value UInt16_R5G6B5 Equivalent to GL_UNSIGNED_SHORT_5_6_5
- \value UInt16_R5G6B5_Rev Equivalent to GL_UNSIGNED_SHORT_5_6_5_REV
- \value UInt16_RGBA4 Equivalent to GL_UNSIGNED_SHORT_4_4_4_4
- \value UInt16_RGBA4_Rev Equivalent to GL_UNSIGNED_SHORT_4_4_4_4_REV
- \value UInt32_RGBA8 Equivalent to GL_UNSIGNED_INT_8_8_8_8
- \value UInt32_RGBA8_Rev Equivalent to GL_UNSIGNED_INT_8_8_8_8_REV
- \value UInt32_RGB10A2 Equivalent to GL_UNSIGNED_INT_10_10_10_2
- \value UInt32_RGB10A2_Rev Equivalent to GL_UNSIGNED_INT_2_10_10_10_REV
- \value UInt32_D24S8 Equivalent to GL_UNSIGNED_INT_24_8. Introduced in Qt 5.4
- \value Float32_D32_UInt32_S8_X24 Equivalent to GL_FLOAT_32_UNSIGNED_INT_24_8_REV. Introduced in Qt 5.4
-*/
-
-/*!
- \enum QOpenGLTexture::Feature
- This enum defines the OpenGL texture-related features that can be tested for.
-
- \value ImmutableStorage Support for immutable texture storage
- \value ImmutableMultisampleStorage Support for immutable texture storage with
- multisample targets
- \value TextureRectangle Support for the GL_TEXTURE_RECTANGLE target
- \value TextureArrays Support for texture targets with array layers
- \value Texture3D Support for the 3 dimensional texture target
- \value TextureMultisample Support for texture targets that have multisample capabilities
- \value TextureBuffer Support for textures that use OpenGL buffer objects
- as their data source
- \value TextureCubeMapArrays Support for cubemap array texture target
- \value Swizzle Support for texture component swizzle masks
- \value StencilTexturing Support for stencil texturing (i.e. looking up depth or stencil
- components of a combined depth/stencil format texture in GLSL shaders).
- \value AnisotropicFiltering Support for anisotropic texture filtering
- \value NPOTTextures Basic support for non-power-of-two textures
- \value NPOTTextureRepeat Full support for non-power-of-two textures including texture
- repeat modes
- \value Texture1D Support for the 1 dimensional texture target
- \value TextureComparisonOperators Support for texture comparison operators
- \value TextureMipMapLevel Support for setting the base and maximum mipmap levels
-*/
-
-/*!
- \enum QOpenGLTexture::SwizzleComponent
- This enum defines the texture color components that can be assigned a swizzle mask.
-
- \value SwizzleRed The red component. Equivalent to GL_TEXTURE_SWIZZLE_R
- \value SwizzleGreen The green component. Equivalent to GL_TEXTURE_SWIZZLE_G
- \value SwizzleBlue The blue component. Equivalent to GL_TEXTURE_SWIZZLE_B
- \value SwizzleAlpha The alpha component. Equivalent to GL_TEXTURE_SWIZZLE_A
-*/
-
-/*!
- \enum QOpenGLTexture::SwizzleValue
- This enum defines the possible mask values for texture swizzling.
-
- \value RedValue Maps the component to the red channel. Equivalent to GL_RED
- \value GreenValue Maps the component to the green channel. Equivalent to GL_GREEN
- \value BlueValue Maps the component to the blue channel. Equivalent to GL_BLUE
- \value AlphaValue Maps the component to the alpha channel. Equivalent to GL_ALPHA
- \value ZeroValue Maps the component to a fixed value of 0. Equivalent to GL_ZERO
- \value OneValue Maps the component to a fixed value of 1. Equivalent to GL_ONE
-*/
-
-/*!
- \enum QOpenGLTexture::WrapMode
- This enum defines the possible texture coordinate wrapping modes.
-
- \value Repeat Texture coordinate is repeated. Equivalent to GL_REPEAT
- \value MirroredRepeat Texture coordinate is reflected about 0 and 1. Equivalent to GL_MIRRORED_REPEAT
- \value ClampToEdge Clamps the texture coordinates to [0,1]. Equivalent to GL_CLAMP_TO_EDGE
- \value ClampToBorder As for ClampToEdge but also blends samples at 0 and 1 with a
- fixed border color. Equivalent to GL_CLAMP_TO_BORDER
-*/
-
-/*!
- \enum QOpenGLTexture::CoordinateDirection
- This enum defines the possible texture coordinate directions
-
- \value DirectionS The horizontal direction. Equivalent to GL_TEXTURE_WRAP_S
- \value DirectionT The vertical direction. Equivalent to GL_TEXTURE_WRAP_T
- \value DirectionR The depth direction. Equivalent to GL_TEXTURE_WRAP_R
-*/
-
-/*!
- Creates a QOpenGLTexture object that can later be bound to \a target.
-
- This does not create the underlying OpenGL texture object. Therefore,
- construction using this constructor does not require a valid current
- OpenGL context.
-*/
-QOpenGLTexture::QOpenGLTexture(Target target)
- : d_ptr(new QOpenGLTexturePrivate(target, this))
-{
-}
-
-/*!
- Creates a QOpenGLTexture object that can later be bound to the 2D texture
- target and contains the pixel data contained in \a image. If you wish
- to have a chain of mipmaps generated then set \a genMipMaps to \c true (this
- is the default).
-
- This does create the underlying OpenGL texture object. Therefore,
- construction using this constructor does require a valid current
- OpenGL context.
-*/
-QOpenGLTexture::QOpenGLTexture(const QImage& image, MipMapGeneration genMipMaps)
- : QOpenGLTexture(QOpenGLTexture::Target2D)
-{
- setData(image, genMipMaps);
-}
-
-QOpenGLTexture::~QOpenGLTexture()
-{
-}
-
-/*!
- Returns the binding target of this texture.
-
- \since 5.4
-*/
-QOpenGLTexture::Target QOpenGLTexture::target() const
-{
- Q_D(const QOpenGLTexture);
- return d->target;
-}
-
-/*!
- Creates the underlying OpenGL texture object. This requires a current valid
- OpenGL context. If the texture object already exists, this function does
- nothing.
-
- Once the texture object is created you can obtain the object
- name from the textureId() function. This may be useful if you wish to make
- some raw OpenGL calls related to this texture.
-
- Normally it should not be necessary to call this function directly as all
- functions that set properties of the texture object implicitly call create()
- on your behalf.
-
- Returns \c true if the creation succeeded, otherwise returns \c false.
-
- \sa destroy(), isCreated(), textureId()
-*/
-bool QOpenGLTexture::create()
-{
- Q_D(QOpenGLTexture);
- return d->create();
-}
-
-/*!
- Destroys the underlying OpenGL texture object. This requires a current valid
- OpenGL context.
-
- \sa create(), isCreated(), textureId()
-*/
-void QOpenGLTexture::destroy()
-{
- Q_D(QOpenGLTexture);
- return d->destroy();
-}
-
-/*!
- Returns \c true if the underlying OpenGL texture object has been created.
-
- \sa create(), destroy(), textureId()
-*/
-bool QOpenGLTexture::isCreated() const
-{
- Q_D(const QOpenGLTexture);
- return d->textureId != 0;
-}
-
-/*!
- Returns the name of the underlying OpenGL texture object or 0 if it has
- not yet been created.
-
- \sa create(), destroy(), isCreated()
-*/
-GLuint QOpenGLTexture::textureId() const
-{
- Q_D(const QOpenGLTexture);
- return d->textureId;
-}
-
-/*!
- Binds this texture to the currently active texture unit ready for
- rendering. Note that you do not need to bind QOpenGLTexture objects
- in order to modify them as the implementation makes use of the
- EXT_direct_state_access extension where available and simulates it
- where it is not.
-
- \sa release()
-*/
-void QOpenGLTexture::bind()
-{
- Q_D(QOpenGLTexture);
- Q_ASSERT(d->textureId);
- d->bind();
-}
-
-/*!
- Binds this texture to texture unit \a unit ready for
- rendering. Note that you do not need to bind QOpenGLTexture objects
- in order to modify them as the implementation makes use of the
- EXT_direct_state_access extension where available and simulates it
- where it is not.
-
- If parameter \a reset is \c true then this function will restore
- the active unit to the texture unit that was active upon entry.
-
- \sa release()
-*/
-void QOpenGLTexture::bind(uint unit, TextureUnitReset reset)
-{
- Q_D(QOpenGLTexture);
- Q_ASSERT(d->textureId);
- d->bind(unit, reset);
-}
-
-/*!
- Unbinds this texture from the currently active texture unit.
-
- \sa bind()
-*/
-void QOpenGLTexture::release()
-{
- Q_D(QOpenGLTexture);
- d->release();
-}
-
-/*!
- Unbinds this texture from texture unit \a unit.
-
- If parameter \a reset is \c true then this function
- will restore the active unit to the texture unit that was active
- upon entry.
-*/
-void QOpenGLTexture::release(uint unit, TextureUnitReset reset)
-{
- Q_D(QOpenGLTexture);
- d->release(unit, reset);
-}
-
-/*!
- Returns \c true if this texture is bound to the corresponding target
- of the currently active texture unit.
-
- \sa bind(), release()
-*/
-bool QOpenGLTexture::isBound() const
-{
- Q_D(const QOpenGLTexture);
- Q_ASSERT(d->textureId);
- return d->isBound();
-}
-
-/*!
- Returns \c true if this texture is bound to the corresponding target
- of texture unit \a unit.
-
- \sa bind(), release()
-*/
-bool QOpenGLTexture::isBound(uint unit)
-{
- Q_D(const QOpenGLTexture);
- Q_ASSERT(d->textureId);
- return d->isBound(unit);
-}
-
-/*!
- Returns the textureId of the texture that is bound to the \a target
- of the currently active texture unit.
-*/
-GLuint QOpenGLTexture::boundTextureId(BindingTarget target)
-{
- QOpenGLContext *ctx = QOpenGLContext::currentContext();
- if (!ctx) {
- qWarning("QOpenGLTexture::boundTextureId() requires a valid current context");
- return 0;
- }
-
- GLint textureId = 0;
- ctx->functions()->glGetIntegerv(target, &textureId);
- return static_cast<GLuint>(textureId);
-}
-
-/*!
- Returns the textureId of the texture that is bound to the \a target
- of the texture unit \a unit.
-*/
-GLuint QOpenGLTexture::boundTextureId(uint unit, BindingTarget target)
-{
- QOpenGLContext *ctx = QOpenGLContext::currentContext();
- if (!ctx) {
- qWarning("QOpenGLTexture::boundTextureId() requires a valid current context");
- return 0;
- }
-
- QOpenGLFunctions *funcs = ctx->functions();
- funcs->initializeOpenGLFunctions();
-
- GLint oldTextureUnit = 0;
- funcs->glGetIntegerv(GL_ACTIVE_TEXTURE, &oldTextureUnit);
-
- funcs->glActiveTexture(unit);
- GLint textureId = 0;
- funcs->glGetIntegerv(target, &textureId);
- funcs->glActiveTexture(oldTextureUnit);
-
- return static_cast<GLuint>(textureId);
-}
-
-/*!
- Sets the format of this texture object to \a format. This function
- must be called before texture storage is allocated.
-
- Note that all formats may not be supported. The exact set of supported
- formats is dependent upon your OpenGL implementation and version.
-
- \sa format(), allocateStorage()
-*/
-void QOpenGLTexture::setFormat(TextureFormat format)
-{
- Q_D(QOpenGLTexture);
- d->create();
- if (isStorageAllocated()) {
- qWarning("QOpenGLTexture::setFormat(): Cannot change format once storage has been allocated");
- return;
- }
-
- d->format = format;
-
- switch (format) {
- case NoFormat:
- d->formatClass = NoFormatClass;
- break;
-
- case RGBA32F:
- case RGBA32U:
- case RGBA32I:
- d->formatClass = FormatClass_128Bit;
- break;
-
- case RGB32F:
- case RGB32U:
- case RGB32I:
- d->formatClass = FormatClass_96Bit;
- break;
-
- case RGBA16F:
- case RG32F:
- case RGBA16U:
- case RG32U:
- case RGBA16I:
- case RG32I:
- case RGBA16_UNorm:
- case RGBA16_SNorm:
- d->formatClass = FormatClass_64Bit;
- break;
-
- case RGB16_UNorm:
- case RGB16_SNorm:
- case RGB16F:
- case RGB16U:
- case RGB16I:
- d->formatClass = FormatClass_48Bit;
- break;
-
- case RG16F:
- case RG11B10F:
- case R32F:
- case RGB10A2:
- case RGBA8U:
- case RG16U:
- case R32U:
- case RGBA8I:
- case RG16I:
- case R32I:
- case RGBA8_UNorm:
- case RG16_UNorm:
- case RGBA8_SNorm:
- case RG16_SNorm:
- case SRGB8_Alpha8:
- case RGB9E5:
- d->formatClass = FormatClass_32Bit;
- break;
-
- case RGB8_UNorm:
- case RGB8_SNorm:
- case SRGB8:
- case RGB8U:
- case RGB8I:
- d->formatClass = FormatClass_24Bit;
- break;
-
- case R16F:
- case RG8U:
- case R16U:
- case RG8I:
- case R16I:
- case RG8_UNorm:
- case R16_UNorm:
- case RG8_SNorm:
- case R16_SNorm:
- d->formatClass = FormatClass_16Bit;
- break;
-
- case R8U:
- case R8I:
- case R8_UNorm:
- case R8_SNorm:
- d->formatClass = FormatClass_8Bit;
- break;
-
- case R_ATI1N_UNorm:
- case R_ATI1N_SNorm:
- d->formatClass = FormatClass_RGTC1_R;
- break;
-
- case RG_ATI2N_UNorm:
- case RG_ATI2N_SNorm:
- d->formatClass = FormatClass_RGTC2_RG;
- break;
-
- case RGB_BP_UNorm:
- case SRGB_BP_UNorm:
- d->formatClass = FormatClass_BPTC_Unorm;
- break;
-
- case RGB_BP_UNSIGNED_FLOAT:
- case RGB_BP_SIGNED_FLOAT:
- d->formatClass = FormatClass_BPTC_Float;
- break;
-
- case RGB_DXT1:
- case SRGB_DXT1:
- d->formatClass = FormatClass_S3TC_DXT1_RGB;
- break;
-
- case RGBA_DXT1:
- case SRGB_Alpha_DXT1:
- d->formatClass = FormatClass_S3TC_DXT1_RGBA;
- break;
-
- case RGBA_DXT3:
- case SRGB_Alpha_DXT3:
- d->formatClass = FormatClass_S3TC_DXT3_RGBA;
- break;
-
- case RGBA_DXT5:
- case SRGB_Alpha_DXT5:
- d->formatClass = FormatClass_S3TC_DXT5_RGBA;
- break;
-
- case QOpenGLTexture::R11_EAC_UNorm:
- case QOpenGLTexture::R11_EAC_SNorm:
- case QOpenGLTexture::RG11_EAC_UNorm:
- case QOpenGLTexture::RG11_EAC_SNorm:
- case QOpenGLTexture::RGB8_ETC2:
- case QOpenGLTexture::SRGB8_ETC2:
- case QOpenGLTexture::RGB8_PunchThrough_Alpha1_ETC2:
- case QOpenGLTexture::SRGB8_PunchThrough_Alpha1_ETC2:
- case QOpenGLTexture::RGBA8_ETC2_EAC:
- case QOpenGLTexture::SRGB8_Alpha8_ETC2_EAC:
- case QOpenGLTexture::RGB8_ETC1:
- case RG3B2:
- case R5G6B5:
- case RGB5A1:
- case RGBA4:
- case D16:
- case D24:
- case D24S8:
- case D32:
- case D32F:
- case D32FS8X24:
- case S8:
- case DepthFormat:
- case AlphaFormat:
- case RGBFormat:
- case RGBAFormat:
- case LuminanceFormat:
- case LuminanceAlphaFormat:
- case QOpenGLTexture::RGBA_ASTC_4x4:
- case QOpenGLTexture::RGBA_ASTC_5x4:
- case QOpenGLTexture::RGBA_ASTC_5x5:
- case QOpenGLTexture::RGBA_ASTC_6x5:
- case QOpenGLTexture::RGBA_ASTC_6x6:
- case QOpenGLTexture::RGBA_ASTC_8x5:
- case QOpenGLTexture::RGBA_ASTC_8x6:
- case QOpenGLTexture::RGBA_ASTC_8x8:
- case QOpenGLTexture::RGBA_ASTC_10x5:
- case QOpenGLTexture::RGBA_ASTC_10x6:
- case QOpenGLTexture::RGBA_ASTC_10x8:
- case QOpenGLTexture::RGBA_ASTC_10x10:
- case QOpenGLTexture::RGBA_ASTC_12x10:
- case QOpenGLTexture::RGBA_ASTC_12x12:
- case QOpenGLTexture::SRGB8_Alpha8_ASTC_4x4:
- case QOpenGLTexture::SRGB8_Alpha8_ASTC_5x4:
- case QOpenGLTexture::SRGB8_Alpha8_ASTC_5x5:
- case QOpenGLTexture::SRGB8_Alpha8_ASTC_6x5:
- case QOpenGLTexture::SRGB8_Alpha8_ASTC_6x6:
- case QOpenGLTexture::SRGB8_Alpha8_ASTC_8x5:
- case QOpenGLTexture::SRGB8_Alpha8_ASTC_8x6:
- case QOpenGLTexture::SRGB8_Alpha8_ASTC_8x8:
- case QOpenGLTexture::SRGB8_Alpha8_ASTC_10x5:
- case QOpenGLTexture::SRGB8_Alpha8_ASTC_10x6:
- case QOpenGLTexture::SRGB8_Alpha8_ASTC_10x8:
- case QOpenGLTexture::SRGB8_Alpha8_ASTC_10x10:
- case QOpenGLTexture::SRGB8_Alpha8_ASTC_12x10:
- case QOpenGLTexture::SRGB8_Alpha8_ASTC_12x12:
- d->formatClass = FormatClass_Unique;
- break;
- }
-}
-
-/*!
- Returns the format of this texture object.
-
- \sa setFormat()
-*/
-QOpenGLTexture::TextureFormat QOpenGLTexture::format() const
-{
- Q_D(const QOpenGLTexture);
- return d->format;
-}
-
-static bool isNpot(int width, int height = 1, int depth = 1)
-{
- return width & (width-1) || height & (height-1) || depth & (depth-1);
-}
-
-/*!
- Sets the dimensions of this texture object to \a width,
- \a height, and \a depth. The default for each dimension is 1.
- The maximum allowable texture size is dependent upon your OpenGL
- implementation. Allocating storage for a texture less than the
- maximum size can still fail if your system is low on resources.
-
- If a non-power-of-two \a width, \a height or \a depth is provided and your
- OpenGL implementation doesn't have support for repeating non-power-of-two
- textures, then the wrap mode is automatically set to ClampToEdge.
-
- \sa width(), height(), depth()
-*/
-void QOpenGLTexture::setSize(int width, int height, int depth)
-{
- Q_D(QOpenGLTexture);
- d->create();
- if (isStorageAllocated()) {
- qWarning("Cannot resize a texture that already has storage allocated.\n"
- "To do so, destroy() the texture and then create() and setSize()");
- return;
- }
-
- if (isNpot(width, height, depth) && !hasFeature(Feature::NPOTTextureRepeat) && d->target != Target::TargetRectangle)
- d->setWrapMode(WrapMode::ClampToEdge);
-
- switch (d->target) {
- case QOpenGLTexture::Target1D:
- case QOpenGLTexture::Target1DArray:
- case QOpenGLTexture::TargetBuffer:
- d->dimensions[0] = width;
- Q_UNUSED(height);
- Q_UNUSED(depth);
- break;
-
- case QOpenGLTexture::Target2D:
- case QOpenGLTexture::Target2DArray:
- case QOpenGLTexture::TargetRectangle:
- case QOpenGLTexture::Target2DMultisample:
- case QOpenGLTexture::Target2DMultisampleArray:
- d->dimensions[0] = width;
- d->dimensions[1] = height;
- Q_UNUSED(depth);
- break;
-
- case QOpenGLTexture::TargetCubeMap:
- case QOpenGLTexture::TargetCubeMapArray:
- if (width != height)
- qWarning("QAbstractOpenGLTexture::setSize(): Cube map textures must be square");
- d->dimensions[0] = d->dimensions[1] = width;
- Q_UNUSED(depth);
- break;
-
- case QOpenGLTexture::Target3D:
- d->dimensions[0] = width;
- d->dimensions[1] = height;
- d->dimensions[2] = depth;
- break;
- }
-}
-
-/*!
- Returns the width of a 1D, 2D or 3D texture.
-
- \sa height(), depth(), setSize()
-*/
-int QOpenGLTexture::width() const
-{
- Q_D(const QOpenGLTexture);
- return d->dimensions[0];
-}
-
-/*!
- Returns the height of a 2D or 3D texture.
-
- \sa width(), depth(), setSize()
-*/
-int QOpenGLTexture::height() const
-{
- Q_D(const QOpenGLTexture);
- return d->dimensions[1];
-}
-
-/*!
- Returns the depth of a 3D texture.
-
- \sa width(), height(), setSize()
-*/
-int QOpenGLTexture::depth() const
-{
- Q_D(const QOpenGLTexture);
- return d->dimensions[2];
-}
-
-/*!
- For texture targets that support mipmaps, this function
- sets the requested number of mipmap \a levels to allocate storage
- for. This function should be called before storage is allocated
- for the texture.
-
- If the texture target does not support mipmaps this function
- has no effect.
-
- \sa mipLevels(), maximumMipLevels(), isStorageAllocated()
-*/
-void QOpenGLTexture::setMipLevels(int levels)
-{
- Q_D(QOpenGLTexture);
- d->create();
- if (isStorageAllocated()) {
- qWarning("Cannot set mip levels on a texture that already has storage allocated.\n"
- "To do so, destroy() the texture and then create() and setMipLevels()");
- return;
- }
-
- switch (d->target) {
- case QOpenGLTexture::Target1D:
- case QOpenGLTexture::Target1DArray:
- case QOpenGLTexture::Target2D:
- case QOpenGLTexture::Target2DArray:
- case QOpenGLTexture::TargetCubeMap:
- case QOpenGLTexture::TargetCubeMapArray:
- case QOpenGLTexture::Target3D:
- d->requestedMipLevels = levels;
- break;
-
- case QOpenGLTexture::TargetBuffer:
- case QOpenGLTexture::TargetRectangle:
- case QOpenGLTexture::Target2DMultisample:
- case QOpenGLTexture::Target2DMultisampleArray:
- qWarning("QAbstractOpenGLTexture::setMipLevels(): This texture target does not support mipmaps");
- break;
- }
-}
-
-/*!
- Returns the number of mipmap levels for this texture. If storage
- has not yet been allocated for this texture it returns the
- requested number of mipmap levels.
-
- \sa setMipLevels(), maximumMipLevels(), isStorageAllocated()
-*/
-int QOpenGLTexture::mipLevels() const
-{
- Q_D(const QOpenGLTexture);
- return isStorageAllocated() ? d->mipLevels : d->requestedMipLevels;
-}
-
-/*!
- Returns the maximum number of mipmap levels that this texture
- can have given the current dimensions.
-
- \sa setMipLevels(), mipLevels(), setSize()
-*/
-int QOpenGLTexture::maximumMipLevels() const
-{
- Q_D(const QOpenGLTexture);
- return d->maximumMipLevelCount();
-}
-
-/*!
- Sets the number of array \a layers to allocate storage for. This
- function should be called before storage is allocated for the texture.
-
- For targets that do not support array layers this function has
- no effect.
-
- \sa layers(), isStorageAllocated()
-*/
-void QOpenGLTexture::setLayers(int layers)
-{
- Q_D(QOpenGLTexture);
- d->create();
- if (isStorageAllocated()) {
- qWarning("Cannot set layers on a texture that already has storage allocated.\n"
- "To do so, destroy() the texture and then create() and setLayers()");
- return;
- }
-
- switch (d->target) {
- case QOpenGLTexture::Target1DArray:
- case QOpenGLTexture::Target2DArray:
- case QOpenGLTexture::TargetCubeMapArray:
- case QOpenGLTexture::Target2DMultisampleArray:
- d->layers = layers;
- break;
-
- case QOpenGLTexture::Target1D:
- case QOpenGLTexture::Target2D:
- case QOpenGLTexture::Target3D:
- case QOpenGLTexture::TargetCubeMap:
- case QOpenGLTexture::TargetBuffer:
- case QOpenGLTexture::TargetRectangle:
- case QOpenGLTexture::Target2DMultisample:
- qWarning("Texture target does not support array layers");
- break;
- }
-}
-
-/*!
- Returns the number of array layers for this texture. If
- storage has not yet been allocated for this texture then
- this function returns the requested number of array layers.
-
- For texture targets that do not support array layers this
- will return 1.
-
- \sa setLayers(), isStorageAllocated()
-*/
-int QOpenGLTexture::layers() const
-{
- Q_D(const QOpenGLTexture);
- return d->layers;
-}
-
-/*!
- Returns the number of faces for this texture. For cubemap
- and cubemap array type targets this will be 6.
-
- For non-cubemap type targets this will return 1.
-*/
-int QOpenGLTexture::faces() const
-{
- Q_D(const QOpenGLTexture);
- return d->faces;
-}
-
-/*!
- Sets the number of \a samples to allocate storage for when rendering to
- a multisample capable texture target. This function should
- be called before storage is allocated for the texture.
-
- For targets that do not support multisampling this function has
- no effect.
-
- \sa samples(), isStorageAllocated()
-*/
-void QOpenGLTexture::setSamples(int samples)
-{
- Q_D(QOpenGLTexture);
- d->create();
- if (isStorageAllocated()) {
- qWarning("Cannot set sample count on a texture that already has storage allocated.\n"
- "To do so, destroy() the texture and then create() and setSamples()");
- return;
- }
-
- switch (d->target) {
- case QOpenGLTexture::Target2DMultisample:
- case QOpenGLTexture::Target2DMultisampleArray:
- d->samples = samples;
- break;
-
- case QOpenGLTexture::Target1D:
- case QOpenGLTexture::Target2D:
- case QOpenGLTexture::Target3D:
- case QOpenGLTexture::Target1DArray:
- case QOpenGLTexture::Target2DArray:
- case QOpenGLTexture::TargetCubeMap:
- case QOpenGLTexture::TargetCubeMapArray:
- case QOpenGLTexture::TargetBuffer:
- case QOpenGLTexture::TargetRectangle:
-
- qWarning("Texture target does not support multisampling");
- break;
- }
-}
-
-/*!
- Returns the number of multisample sample points for this texture.
- If storage has not yet been allocated for this texture then
- this function returns the requested number of samples.
-
- For texture targets that do not support multisampling this
- will return 0.
-
- \sa setSamples(), isStorageAllocated()
-*/
-int QOpenGLTexture::samples() const
-{
- Q_D(const QOpenGLTexture);
- return d->samples;
-}
-
-/*!
- Sets whether the sample positions and number of samples used with
- a multisample capable texture target to \a fixed. If set to \c true
- the sample positions and number of samples used are the same for
- all texels in the image and will not depend upon the image size or
- internal format. This function should be called before storage is allocated
- for the texture.
-
- For targets that do not support multisampling this function has
- no effect.
-
- The default value is \c true.
-
- \sa isFixedSamplePositions(), isStorageAllocated()
-*/
-void QOpenGLTexture::setFixedSamplePositions(bool fixed)
-{
- Q_D(QOpenGLTexture);
- d->create();
- if (isStorageAllocated()) {
- qWarning("Cannot set sample positions on a texture that already has storage allocated.\n"
- "To do so, destroy() the texture and then create() and setFixedSamplePositions()");
- return;
- }
-
- switch (d->target) {
- case QOpenGLTexture::Target2DMultisample:
- case QOpenGLTexture::Target2DMultisampleArray:
- d->fixedSamplePositions = fixed;
- break;
-
- case QOpenGLTexture::Target1D:
- case QOpenGLTexture::Target2D:
- case QOpenGLTexture::Target3D:
- case QOpenGLTexture::Target1DArray:
- case QOpenGLTexture::Target2DArray:
- case QOpenGLTexture::TargetCubeMap:
- case QOpenGLTexture::TargetCubeMapArray:
- case QOpenGLTexture::TargetBuffer:
- case QOpenGLTexture::TargetRectangle:
-
- qWarning("Texture target does not support multisampling");
- break;
- }
-}
-
-/*!
- Returns whether this texture uses a fixed pattern of multisample
- samples. If storage has not yet been allocated for this texture then
- this function returns the requested fixed sample position setting.
-
- For texture targets that do not support multisampling this
- will return \c true.
-
- \sa setFixedSamplePositions(), isStorageAllocated()
-*/
-bool QOpenGLTexture::isFixedSamplePositions() const
-{
- Q_D(const QOpenGLTexture);
- return d->fixedSamplePositions;
-}
-
-/*!
- Allocates server-side storage for this texture object taking
- into account, the format, dimensions, mipmap levels, array
- layers and cubemap faces.
-
- Once storage has been allocated it is no longer possible to change
- these properties.
-
- If supported QOpenGLTexture makes use of immutable texture
- storage.
-
- Once storage has been allocated for the texture then pixel data
- can be uploaded via one of the setData() overloads.
-
- \note If immutable texture storage is not available,
- then a default pixel format and pixel type will be used to
- create the mutable storage. You can use the other
- allocateStorage() overload to specify exactly the pixel format
- and the pixel type to use when allocating mutable storage;
- this is particulary useful under certain OpenGL ES implementations
- (notably, OpenGL ES 2), where the pixel format and the pixel type
- used at allocation time must perfectly match the format
- and the type passed to any subsequent setData() call.
-
- \sa isStorageAllocated(), setData()
-*/
-void QOpenGLTexture::allocateStorage()
-{
- Q_D(QOpenGLTexture);
- if (d->create()) {
- const QOpenGLTexture::PixelFormat pixelFormat = pixelFormatCompatibleWithInternalFormat(d->format);
- const QOpenGLTexture::PixelType pixelType = pixelTypeCompatibleWithInternalFormat(d->format);
- d->allocateStorage(pixelFormat, pixelType);
- }
-}
-
-/*!
- \since 5.5
-
- Allocates server-side storage for this texture object taking
- into account, the format, dimensions, mipmap levels, array
- layers and cubemap faces.
-
- Once storage has been allocated it is no longer possible to change
- these properties.
-
- If supported QOpenGLTexture makes use of immutable texture
- storage. However, if immutable texture storage is not available,
- then the specified \a pixelFormat and \a pixelType will be used
- to allocate mutable storage; note that in certain OpenGL implementations
- (notably, OpenGL ES 2) they must perfectly match the format
- and the type passed to any subsequent setData() call.
-
- Once storage has been allocated for the texture then pixel data
- can be uploaded via one of the setData() overloads.
-
- \sa isStorageAllocated(), setData()
-*/
-void QOpenGLTexture::allocateStorage(QOpenGLTexture::PixelFormat pixelFormat, QOpenGLTexture::PixelType pixelType)
-{
- Q_D(QOpenGLTexture);
- if (d->create())
- d->allocateStorage(pixelFormat, pixelType);
-}
-
-/*!
- Returns \c true if server-side storage for this texture as been
- allocated.
-
- The texture format, dimensions, mipmap levels and array layers
- cannot be altered once storage ihas been allocated.
-
- \sa allocateStorage(), setSize(), setMipLevels(), setLayers(), setFormat()
-*/
-bool QOpenGLTexture::isStorageAllocated() const
-{
- Q_D(const QOpenGLTexture);
- return d->storageAllocated;
-}
-
-/*!
- Attempts to create a texture view onto this texture. A texture
- view is somewhat analogous to a view in SQL in that it presents
- a restricted or reinterpreted view of the original data. Texture
- views do not allocate any more server-side storage, insted relying
- on the storage buffer of the source texture.
-
- Texture views are only available when using immutable storage. For
- more information on texture views see
- http://www.opengl.org/wiki/Texture_Storage#Texture_views.
-
- The \a target argument specifies the target to use for the view.
- Only some targets can be used depending upon the target of the original
- target. For e.g. a view onto a Target1DArray texture can specify
- either Target1DArray or Target1D but for the latter the number of
- array layers specified with \a minimumLayer and \a maximumLayer must
- be exactly 1.
-
- Simpliar constraints apply for the \a viewFormat. See the above link
- and the specification for more details.
-
- The \a minimumMipmapLevel, \a maximumMipmapLevel, \a minimumLayer,
- and \a maximumLayer arguments serve to restrict the parts of the
- texture accessible by the texture view.
-
- If creation of the texture view fails this function will return
- 0. If the function succeeds it will return a pointer to a new
- QOpenGLTexture object that will return \c true from its isTextureView()
- function.
-
- \sa isTextureView()
-*/
-QOpenGLTexture *QOpenGLTexture::createTextureView(Target target,
- TextureFormat viewFormat,
- int minimumMipmapLevel, int maximumMipmapLevel,
- int minimumLayer, int maximumLayer) const
-{
- Q_D(const QOpenGLTexture);
- if (!isStorageAllocated()) {
- qWarning("Cannot set create a texture view of a texture that does not have storage allocated.");
- return nullptr;
- }
- Q_ASSERT(maximumMipmapLevel >= minimumMipmapLevel);
- Q_ASSERT(maximumLayer >= minimumLayer);
- return d->createTextureView(target, viewFormat,
- minimumMipmapLevel, maximumMipmapLevel,
- minimumLayer, maximumLayer);
-}
-
-/*!
- Returns \c true if this texture object is actually a view onto another
- texture object.
-
- \sa createTextureView()
-*/
-bool QOpenGLTexture::isTextureView() const
-{
- Q_D(const QOpenGLTexture);
- Q_ASSERT(d->textureId);
- return d->textureView;
-}
-
-/*!
- Uploads pixel \a data for this texture object \a mipLevel, array \a layer, and \a cubeFace.
- Storage must have been allocated before uploading pixel data. Some overloads of setData()
- will set appropriate dimensions, mipmap levels, and array layers and then allocate storage
- for you if they have enough information to do so. This will be noted in the function
- documentation.
-
- The structure of the pixel data pointed to by \a data is specified by \a sourceFormat
- and \a sourceType. The pixel data upload can optionally be controlled by \a options.
-
- If using a compressed format() then you should use setCompressedData() instead of this
- function.
-
- \since 5.3
- \sa setCompressedData()
-*/
-void QOpenGLTexture::setData(int mipLevel, int layer, CubeMapFace cubeFace,
- PixelFormat sourceFormat, PixelType sourceType,
- const void *data, const QOpenGLPixelTransferOptions * const options)
-{
- Q_D(QOpenGLTexture);
- Q_ASSERT(d->textureId);
- if (!isStorageAllocated()) {
- qWarning("Cannot set data on a texture that does not have storage allocated.\n"
- "To do so call allocateStorage() before this function");
- return;
- }
- d->setData(mipLevel, layer, 1, cubeFace, sourceFormat, sourceType, data, options);
-}
-
-/*!
- \since 5.9
- \overload
-
- Parameter \a layerCount is the number of layers in a texture array
- that are being uploaded/populated by this call.
-*/
-void QOpenGLTexture::setData(int mipLevel, int layer, int layerCount, QOpenGLTexture::CubeMapFace cubeFace, QOpenGLTexture::PixelFormat sourceFormat, QOpenGLTexture::PixelType sourceType, const void *data, const QOpenGLPixelTransferOptions * const options)
-{
- Q_D(QOpenGLTexture);
- Q_ASSERT(d->textureId);
- if (!isStorageAllocated()) {
- qWarning("Cannot set data on a texture that does not have storage allocated.\n"
- "To do so call allocateStorage() before this function");
- return;
- }
- d->setData(mipLevel, layer, layerCount, cubeFace, sourceFormat, sourceType, data, options);
-}
-
-/*!
- \since 5.3
- \overload
-*/
-void QOpenGLTexture::setData(int mipLevel, int layer,
- PixelFormat sourceFormat, PixelType sourceType,
- const void *data, const QOpenGLPixelTransferOptions * const options)
-{
- Q_D(QOpenGLTexture);
- Q_ASSERT(d->textureId);
- d->setData(mipLevel, layer, 1, QOpenGLTexture::CubeMapPositiveX, sourceFormat, sourceType, data, options);
-}
-
-/*!
- \since 5.3
- \overload
-*/
-void QOpenGLTexture::setData(int mipLevel,
- PixelFormat sourceFormat, PixelType sourceType,
- const void *data, const QOpenGLPixelTransferOptions * const options)
-{
- Q_D(QOpenGLTexture);
- Q_ASSERT(d->textureId);
- d->setData(mipLevel, 0, 1, QOpenGLTexture::CubeMapPositiveX, sourceFormat, sourceType, data, options);
-}
-
-/*!
- \since 5.3
- \overload
-*/
-void QOpenGLTexture::setData(PixelFormat sourceFormat, PixelType sourceType,
- const void *data, const QOpenGLPixelTransferOptions * const options)
-{
- Q_D(QOpenGLTexture);
- Q_ASSERT(d->textureId);
- d->setData(0, 0, 1, QOpenGLTexture::CubeMapPositiveX, sourceFormat, sourceType, data, options);
-}
-
-/*!
- \since 5.14
- \overload
-
- This overload is to be used to update a part of the texture. Parameters \a
- xOffset, \a yOffset, \a zOffset specify the texel offsets within the
- texture. Parameters \a width, \a height and \a depth specify the dimensions
- of the sub image.
-
- The structure of the pixel data pointed to by \a data is specified by \a
- sourceFormat and \a sourceType. The pixel data upload can optionally be
- controlled by \a options.
-*/
-void QOpenGLTexture::setData(int xOffset, int yOffset, int zOffset,
- int width, int height, int depth,
- PixelFormat sourceFormat, PixelType sourceType,
- const void *data, const QOpenGLPixelTransferOptions * const options)
-{
- Q_D(QOpenGLTexture);
- Q_ASSERT(d->textureId);
- d->setData(xOffset, yOffset, zOffset,
- width, height, depth,
- 0, 0, 1,
- QOpenGLTexture::CubeMapPositiveX, sourceFormat,
- sourceType, data, options);
-}
-
-/*!
- \since 5.14
- \overload
-
- This overload is to be used to update a part of the texture. Parameters \a
- xOffset, \a yOffset, \a zOffset specify the texel offsets within the
- texture. Parameters \a width, \a height and \a depth specify the dimensions
- of the sub image. The mip map level the sub image we want to
- update is specified with \a mipLevel.
-
- The structure of the pixel data pointed to by \a data is specified by \a
- sourceFormat and \a sourceType. The pixel data upload can optionally be
- controlled by \a options.
-*/
-void QOpenGLTexture::setData(int xOffset, int yOffset, int zOffset,
- int width, int height, int depth,
- int mipLevel,
- PixelFormat sourceFormat, PixelType sourceType,
- const void *data, const QOpenGLPixelTransferOptions * const options)
-{
- Q_D(QOpenGLTexture);
- Q_ASSERT(d->textureId);
- d->setData(xOffset, yOffset, zOffset,
- width, height, depth,
- mipLevel, 0, 1,
- QOpenGLTexture::CubeMapPositiveX, sourceFormat,
- sourceType, data, options);
-}
-
-/*!
- \since 5.14
- \overload
-
- This overload is to be used to update a part of the texture. Parameters \a
- xOffset, \a yOffset, \a zOffset specify the texel offsets within the
- texture. Parameters \a width, \a height and \a depth specify the dimensions
- of the sub image. The mip map level and layerof the sub image we want to
- update are specified with \a mipLevel and \a layer.
-
- The structure of the pixel data pointed to by \a data is specified by \a
- sourceFormat and \a sourceType. The pixel data upload can optionally be
- controlled by \a options.
-*/
-void QOpenGLTexture::setData(int xOffset, int yOffset, int zOffset,
- int width, int height, int depth,
- int mipLevel, int layer,
- PixelFormat sourceFormat, PixelType sourceType,
- const void *data, const QOpenGLPixelTransferOptions * const options)
-{
- Q_D(QOpenGLTexture);
- Q_ASSERT(d->textureId);
- d->setData(xOffset, yOffset, zOffset,
- width, height, depth,
- mipLevel, layer, 1,
- QOpenGLTexture::CubeMapPositiveX, sourceFormat,
- sourceType, data, options);
-}
-
-/*!
- \since 5.14
- \overload
-
- This overload is to be used to update a part of the texture. Parameters \a
- xOffset, \a yOffset, \a zOffset specify the texel offsets within the
- texture. Parameters \a width, \a height and \a depth specify the dimensions
- of the sub image.The mip map level, layer and cube map face of the sub
- image we want to update are specified with \a mipLevel, \a layer and \a
- face.
-
- The structure of the pixel data pointed to by \a data is specified by \a
- sourceFormat and \a sourceType. The pixel data upload can optionally be
- controlled by \a options.
-*/
-void QOpenGLTexture::setData(int xOffset, int yOffset, int zOffset,
- int width, int height, int depth,
- int mipLevel, int layer,
- CubeMapFace face,
- PixelFormat sourceFormat, PixelType sourceType,
- const void *data, const QOpenGLPixelTransferOptions * const options)
-{
- Q_D(QOpenGLTexture);
- Q_ASSERT(d->textureId);
- d->setData(xOffset, yOffset, zOffset,
- width, height, depth,
- mipLevel, layer, 1,
- face, sourceFormat,
- sourceType, data, options);
-}
-
-/*!
- \since 5.14
- \overload
-
- This overload is to be used to update a part of the texture. Parameters \a
- xOffset, \a yOffset, \a zOffset specify the texel offsets within the
- texture. Parameters \a width, \a height and \a depth specify the dimensions
- of the sub image.The mip map level, starting layer, cube map face and
- number of layers of the sub image we want to update are specified with \a
- mipLevel, \a layer, \a face and \a layerCount.
-
- The structure of the pixel data pointed to by \a data is specified by \a
- sourceFormat and \a sourceType. The pixel data upload can optionally be
- controlled by \a options.
-*/
-void QOpenGLTexture::setData(int xOffset, int yOffset, int zOffset,
- int width, int height, int depth,
- int mipLevel, int layer,
- CubeMapFace face, int layerCount,
- PixelFormat sourceFormat, PixelType sourceType,
- const void *data, const QOpenGLPixelTransferOptions * const options)
-{
- Q_D(QOpenGLTexture);
- Q_ASSERT(d->textureId);
- d->setData(xOffset, yOffset, zOffset,
- width, height, depth,
- mipLevel, layer, layerCount,
- face, sourceFormat,
- sourceType, data, options);
-}
-
-#if QT_DEPRECATED_SINCE(5, 3)
-/*!
- \obsolete
- \overload
-
- \sa setCompressedData()
-*/
-void QOpenGLTexture::setData(int mipLevel, int layer, CubeMapFace cubeFace,
- PixelFormat sourceFormat, PixelType sourceType,
- void *data, const QOpenGLPixelTransferOptions * const options)
-{
- Q_D(QOpenGLTexture);
- Q_ASSERT(d->textureId);
- if (!isStorageAllocated()) {
- qWarning("Cannot set data on a texture that does not have storage allocated.\n"
- "To do so call allocateStorage() before this function");
- return;
- }
- d->setData(mipLevel, layer, 1, cubeFace, sourceFormat, sourceType, data, options);
-}
-
-/*!
- \obsolete
- \overload
-*/
-void QOpenGLTexture::setData(int mipLevel, int layer,
- PixelFormat sourceFormat, PixelType sourceType,
- void *data, const QOpenGLPixelTransferOptions * const options)
-{
- Q_D(QOpenGLTexture);
- Q_ASSERT(d->textureId);
- d->setData(mipLevel, layer, 1, QOpenGLTexture::CubeMapPositiveX, sourceFormat, sourceType, data, options);
-}
-
-/*!
- \obsolete
- \overload
-*/
-void QOpenGLTexture::setData(int mipLevel,
- PixelFormat sourceFormat, PixelType sourceType,
- void *data, const QOpenGLPixelTransferOptions * const options)
-{
- Q_D(QOpenGLTexture);
- Q_ASSERT(d->textureId);
- d->setData(mipLevel, 0, 1, QOpenGLTexture::CubeMapPositiveX, sourceFormat, sourceType, data, options);
-}
-
-/*!
- \obsolete
- \overload
-*/
-void QOpenGLTexture::setData(PixelFormat sourceFormat, PixelType sourceType,
- void *data, const QOpenGLPixelTransferOptions * const options)
-{
- Q_D(QOpenGLTexture);
- Q_ASSERT(d->textureId);
- d->setData(0, 0, 1, QOpenGLTexture::CubeMapPositiveX, sourceFormat, sourceType, data, options);
-}
-#endif
-
-/*!
- This overload of setData() will allocate storage for you.
- The pixel data is contained in \a image. Mipmaps are generated by default.
- Set \a genMipMaps to \l DontGenerateMipMaps to turn off mipmap generation.
-
- \overload
-*/
-void QOpenGLTexture::setData(const QImage& image, MipMapGeneration genMipMaps)
-{
- QOpenGLContext *context = QOpenGLContext::currentContext();
- if (!context) {
- qWarning("QOpenGLTexture::setData() requires a valid current context");
- return;
- }
-
- if (image.isNull()) {
- qWarning("QOpenGLTexture::setData() tried to set a null image");
- return;
- }
-
- if (context->isOpenGLES() && context->format().majorVersion() < 3)
- setFormat(QOpenGLTexture::RGBAFormat);
- else
- setFormat(QOpenGLTexture::RGBA8_UNorm);
-
- setSize(image.width(), image.height());
- setMipLevels(genMipMaps == GenerateMipMaps ? maximumMipLevels() : 1);
- allocateStorage(QOpenGLTexture::RGBA, QOpenGLTexture::UInt8);
-
- // Upload pixel data and generate mipmaps
- QImage glImage = image.convertToFormat(QImage::Format_RGBA8888);
- QOpenGLPixelTransferOptions uploadOptions;
- uploadOptions.setAlignment(1);
- setData(0, QOpenGLTexture::RGBA, QOpenGLTexture::UInt8, glImage.constBits(), &uploadOptions);
-}
-
-/*!
- Uploads compressed pixel \a data to \a mipLevel, array \a layer, and \a cubeFace.
- The pixel transfer can optionally be controlled with \a options. The \a dataSize
- argument should specify the size of the data pointed to by \a data.
-
- If not using a compressed format() then you should use setData() instead of this
- function.
-
- \since 5.3
-*/
-void QOpenGLTexture::setCompressedData(int mipLevel, int layer, CubeMapFace cubeFace,
- int dataSize, const void *data,
- const QOpenGLPixelTransferOptions * const options)
-{
- Q_D(QOpenGLTexture);
- Q_ASSERT(d->textureId);
- if (!isStorageAllocated()) {
- qWarning("Cannot set data on a texture that does not have storage allocated.\n"
- "To do so call allocateStorage() before this function");
- return;
- }
- d->setCompressedData(mipLevel, layer, 1, cubeFace, dataSize, data, options);
-}
-
-/*!
- \since 5.9
- \overload
-
- Parameter \a layerCount is the number of layers in a texture array
- that are being uploaded/populated by this call.
-*/
-void QOpenGLTexture::setCompressedData(int mipLevel, int layer, int layerCount, QOpenGLTexture::CubeMapFace cubeFace, int dataSize, const void *data, const QOpenGLPixelTransferOptions * const options)
-{
- Q_D(QOpenGLTexture);
- Q_ASSERT(d->textureId);
- if (!isStorageAllocated()) {
- qWarning("Cannot set data on a texture that does not have storage allocated.\n"
- "To do so call allocateStorage() before this function");
- return;
- }
- d->setCompressedData(mipLevel, layer, layerCount, cubeFace, dataSize, data, options);
-}
-
-/*!
- \overload
-*/
-void QOpenGLTexture::setCompressedData(int mipLevel, int layer, int dataSize, const void *data,
- const QOpenGLPixelTransferOptions * const options)
-{
- Q_D(QOpenGLTexture);
- Q_ASSERT(d->textureId);
- d->setCompressedData(mipLevel, layer, 1, QOpenGLTexture::CubeMapPositiveX, dataSize, data, options);
-}
-
-/*!
- \overload
-*/
-void QOpenGLTexture::setCompressedData(int mipLevel, int dataSize, const void *data,
- const QOpenGLPixelTransferOptions * const options)
-{
- Q_D(QOpenGLTexture);
- Q_ASSERT(d->textureId);
- d->setCompressedData(mipLevel, 0, 1, QOpenGLTexture::CubeMapPositiveX, dataSize, data, options);
-}
-
-/*!
- \overload
-*/
-void QOpenGLTexture::setCompressedData(int dataSize, const void *data,
- const QOpenGLPixelTransferOptions * const options)
-{
- Q_D(QOpenGLTexture);
- Q_ASSERT(d->textureId);
- d->setCompressedData(0, 0, 1, QOpenGLTexture::CubeMapPositiveX, dataSize, data, options);
-}
-
-#if QT_DEPRECATED_SINCE(5, 3)
-/*!
- \obsolete
- \overload
-*/
-void QOpenGLTexture::setCompressedData(int mipLevel, int layer, CubeMapFace cubeFace,
- int dataSize, void *data,
- const QOpenGLPixelTransferOptions * const options)
-{
- Q_D(QOpenGLTexture);
- Q_ASSERT(d->textureId);
- if (!isStorageAllocated()) {
- qWarning("Cannot set data on a texture that does not have storage allocated.\n"
- "To do so call allocateStorage() before this function");
- return;
- }
- d->setCompressedData(mipLevel, layer, 1, cubeFace, dataSize, data, options);
-}
-
-/*!
- \obsolete
- \overload
-*/
-void QOpenGLTexture::setCompressedData(int mipLevel, int layer, int dataSize, void *data,
- const QOpenGLPixelTransferOptions * const options)
-{
- Q_D(QOpenGLTexture);
- Q_ASSERT(d->textureId);
- d->setCompressedData(mipLevel, layer, 1, QOpenGLTexture::CubeMapPositiveX, dataSize, data, options);
-}
-
-/*!
- \obsolete
- \overload
-*/
-void QOpenGLTexture::setCompressedData(int mipLevel, int dataSize, void *data,
- const QOpenGLPixelTransferOptions * const options)
-{
- Q_D(QOpenGLTexture);
- Q_ASSERT(d->textureId);
- d->setCompressedData(mipLevel, 0, 1, QOpenGLTexture::CubeMapPositiveX, dataSize, data, options);
-}
-
-/*!
- \obsolete
- \overload
-*/
-void QOpenGLTexture::setCompressedData(int dataSize, void *data,
- const QOpenGLPixelTransferOptions * const options)
-{
- Q_D(QOpenGLTexture);
- Q_ASSERT(d->textureId);
- d->setCompressedData(0, 0, 1, QOpenGLTexture::CubeMapPositiveX, dataSize, data, options);
-}
-#endif
-
-/*!
- Returns \c true if your OpenGL implementation and version supports the texture
- feature \a feature.
-*/
-bool QOpenGLTexture::hasFeature(Feature feature)
-{
- QOpenGLContext *ctx = QOpenGLContext::currentContext();
- if (!ctx) {
- qWarning("QOpenGLTexture::hasFeature() requires a valid current context");
- return false;
- }
-
- QSurfaceFormat f = ctx->format();
-
- bool supported = false;
-
-#if !defined(QT_OPENGL_ES_2)
- if (!ctx->isOpenGLES()) {
- switch (feature) {
- case ImmutableMultisampleStorage:
- supported = f.version() >= qMakePair(4, 3)
- || ctx->hasExtension(QByteArrayLiteral("GL_ARB_texture_storage_multisample"));
- break;
-
- case TextureBuffer:
- supported = f.version() >= qMakePair(3, 0)
- || ctx->hasExtension(QByteArrayLiteral("GL_ARB_texture_buffer_object"));
- break;
-
- case StencilTexturing:
- supported = f.version() >= qMakePair(4, 3)
- || ctx->hasExtension(QByteArrayLiteral("GL_ARB_stencil_texturing"));
- break;
-
- case ImmutableStorage:
- supported = f.version() >= qMakePair(4, 2)
- || ctx->hasExtension(QByteArrayLiteral("GL_ARB_texture_storage"))
- || ctx->hasExtension(QByteArrayLiteral("GL_EXT_texture_storage"));
- break;
-
- case TextureCubeMapArrays:
- supported = f.version() >= qMakePair(4, 0)
- || ctx->hasExtension(QByteArrayLiteral("ARB_texture_cube_map_array"));
- break;
-
- case Swizzle:
- supported = f.version() >= qMakePair(3, 3)
- || ctx->hasExtension(QByteArrayLiteral("GL_ARB_texture_swizzle"));
- break;
-
- case TextureMultisample:
- supported = f.version() >= qMakePair(3, 2)
- || ctx->hasExtension(QByteArrayLiteral("GL_ARB_texture_multisample"));
- break;
-
- case TextureArrays:
- supported = f.version() >= qMakePair(3, 0)
- || ctx->hasExtension(QByteArrayLiteral("GL_EXT_texture_array"));
- break;
-
- case TextureRectangle:
- supported = f.version() >= qMakePair(2, 1)
- || ctx->hasExtension(QByteArrayLiteral("ARB_texture_rectangle"));
- break;
-
- case Texture3D:
- supported = f.version() >= qMakePair(1, 3);
- break;
-
- case AnisotropicFiltering:
- supported = ctx->hasExtension(QByteArrayLiteral("GL_EXT_texture_filter_anisotropic"));
- break;
-
- case NPOTTextures:
- case NPOTTextureRepeat:
- supported = ctx->hasExtension(QByteArrayLiteral("GL_ARB_texture_non_power_of_two"));
- break;
-
- case Texture1D:
- supported = f.version() >= qMakePair(1, 1);
- break;
-
- case TextureComparisonOperators:
- // GL 1.4 and GL_ARB_shadow alone support only LEQUAL and GEQUAL;
- // since we're talking about history anyhow avoid to be extra pedantic
- // in the feature set, and simply claim supported if we have the full set of operators
- // (which has been added into 1.5 / GL_EXT_shadow_funcs).
- supported = f.version() >= qMakePair(1, 5)
- || (ctx->hasExtension(QByteArrayLiteral("GL_ARB_shadow"))
- && ctx->hasExtension(QByteArrayLiteral("GL_EXT_shadow_funcs")));
- break;
-
- case TextureMipMapLevel:
- supported = f.version() >= qMakePair(1, 2);
- break;
-
- case MaxFeatureFlag:
- break;
- }
- }
-
- if (ctx->isOpenGLES())
-#endif
- {
- const char *renderer = reinterpret_cast<const char *>(ctx->functions()->glGetString(GL_RENDERER));
- switch (feature) {
- case ImmutableStorage:
- supported = (f.version() >= qMakePair(3, 0) || ctx->hasExtension(QByteArrayLiteral("GL_EXT_texture_storage")))
- && !(renderer && strstr(renderer, "Mali")); // do not use on Mali: QTBUG-45106
- break;
-
- case ImmutableMultisampleStorage:
- supported = f.version() >= qMakePair(3, 1);
- break;
-
- case TextureRectangle:
- break;
-
- case TextureArrays:
- supported = f.version() >= qMakePair(3, 0);
- break;
-
- case Texture3D:
- supported = f.version() >= qMakePair(3, 0)
- || ctx->hasExtension(QByteArrayLiteral("GL_OES_texture_3D"));
- break;
-
- case TextureMultisample:
- supported = f.version() >= qMakePair(3, 1);
- break;
-
- case TextureBuffer:
- break;
-
- case TextureCubeMapArrays:
- break;
-
- case Swizzle:
- supported = f.version() >= qMakePair(3, 0);
- break;
-
- case StencilTexturing:
- break;
-
- case AnisotropicFiltering:
- supported = ctx->hasExtension(QByteArrayLiteral("GL_EXT_texture_filter_anisotropic"));
- break;
-
- case NPOTTextures:
- case NPOTTextureRepeat:
- supported = f.version() >= qMakePair(3,0)
- || ctx->hasExtension(QByteArrayLiteral("GL_OES_texture_npot"))
- || ctx->hasExtension(QByteArrayLiteral("GL_ARB_texture_non_power_of_two"));
- break;
-
- case Texture1D:
- break;
-
- case TextureComparisonOperators:
- supported = f.version() >= qMakePair(3, 0)
- || ctx->hasExtension(QByteArrayLiteral("GL_EXT_shadow_samplers"));
- break;
-
- case TextureMipMapLevel:
- supported = f.version() >= qMakePair(3, 0);
- break;
-
- case MaxFeatureFlag:
- break;
- }
- }
-
- return supported;
-}
-
-/*!
- Sets the base mipmap level used for all texture lookups with this texture to \a baseLevel.
-
- \note This function has no effect on Qt built for OpenGL ES 2.
- \sa mipBaseLevel(), setMipMaxLevel(), setMipLevelRange()
-*/
-void QOpenGLTexture::setMipBaseLevel(int baseLevel)
-{
- Q_D(QOpenGLTexture);
- d->create();
- if (!d->features.testFlag(TextureMipMapLevel)) {
- qWarning("QOpenGLTexture::setMipBaseLevel: requires OpenGL >= 1.2 or OpenGL ES >= 3.0");
- return;
- }
- Q_ASSERT(d->textureId);
- Q_ASSERT(d->texFuncs);
- Q_ASSERT(baseLevel <= d->maxLevel);
- d->baseLevel = baseLevel;
- d->texFuncs->glTextureParameteri(d->textureId, d->target, d->bindingTarget, GL_TEXTURE_BASE_LEVEL, baseLevel);
-}
-
-/*!
- Returns the mipmap base level used for all texture lookups with this texture.
- The default is 0.
-
- \sa setMipBaseLevel(), mipMaxLevel(), mipLevelRange()
-*/
-int QOpenGLTexture::mipBaseLevel() const
-{
- Q_D(const QOpenGLTexture);
- return d->baseLevel;
-}
-
-/*!
- Sets the maximum mipmap level used for all texture lookups with this texture to \a maxLevel.
-
- \note This function has no effect on Qt built for OpenGL ES 2.
- \sa mipMaxLevel(), setMipBaseLevel(), setMipLevelRange()
-*/
-void QOpenGLTexture::setMipMaxLevel(int maxLevel)
-{
- Q_D(QOpenGLTexture);
- d->create();
- if (!d->features.testFlag(TextureMipMapLevel)) {
- qWarning("QOpenGLTexture::setMipMaxLevel: requires OpenGL >= 1.2 or OpenGL ES >= 3.0");
- return;
- }
- Q_ASSERT(d->textureId);
- Q_ASSERT(d->texFuncs);
- Q_ASSERT(d->baseLevel <= maxLevel);
- d->maxLevel = maxLevel;
- d->texFuncs->glTextureParameteri(d->textureId, d->target, d->bindingTarget, GL_TEXTURE_MAX_LEVEL, maxLevel);
-}
-
-/*!
- Returns the mipmap maximum level used for all texture lookups with this texture.
-
- \sa setMipMaxLevel(), mipBaseLevel(), mipLevelRange()
-*/
-int QOpenGLTexture::mipMaxLevel() const
-{
- Q_D(const QOpenGLTexture);
- return d->maxLevel;
-}
-
-/*!
- Sets the range of mipmap levels that can be used for texture lookups with this texture
- to range from \a baseLevel to \a maxLevel.
-
- \note This function has no effect on Qt built for OpenGL ES 2.
- \sa setMipBaseLevel(), setMipMaxLevel(), mipLevelRange()
-*/
-void QOpenGLTexture::setMipLevelRange(int baseLevel, int maxLevel)
-{
- Q_D(QOpenGLTexture);
- d->create();
- if (!d->features.testFlag(TextureMipMapLevel)) {
- qWarning("QOpenGLTexture::setMipLevelRange: requires OpenGL >= 1.2 or OpenGL ES >= 3.0");
- return;
- }
- Q_ASSERT(d->textureId);
- Q_ASSERT(d->texFuncs);
- Q_ASSERT(baseLevel <= maxLevel);
- d->texFuncs->glTextureParameteri(d->textureId, d->target, d->bindingTarget, GL_TEXTURE_BASE_LEVEL, baseLevel);
- d->texFuncs->glTextureParameteri(d->textureId, d->target, d->bindingTarget, GL_TEXTURE_MAX_LEVEL, maxLevel);
-}
-
-/*!
- Returns the range of mipmap levels that can be used for texture lookups with this texture.
-
- \sa mipBaseLevel(), mipMaxLevel()
-*/
-QPair<int, int> QOpenGLTexture::mipLevelRange() const
-{
- Q_D(const QOpenGLTexture);
- return qMakePair(d->baseLevel, d->maxLevel);
-}
-
-/*!
- If \a enabled is \c true, enables automatic mipmap generation for this texture object
- to occur whenever the level 0 mipmap data is set via setData().
-
- The automatic mipmap generation is enabled by default.
-
- \note Mipmap generation is not supported for compressed textures with OpenGL ES 2.0.
-
- \sa isAutoMipMapGenerationEnabled(), generateMipMaps()
-*/
-void QOpenGLTexture::setAutoMipMapGenerationEnabled(bool enabled)
-{
- Q_D(QOpenGLTexture);
- d->autoGenerateMipMaps = enabled;
-}
-
-/*!
- Returns whether auto mipmap generation is enabled for this texture object.
-
- \sa setAutoMipMapGenerationEnabled(), generateMipMaps()
-*/
-bool QOpenGLTexture::isAutoMipMapGenerationEnabled() const
-{
- Q_D(const QOpenGLTexture);
- return d->autoGenerateMipMaps;
-}
-
-/*!
- Generates mipmaps for this texture object from mipmap level 0. If you are
- using a texture target and filtering option that requires mipmaps and you
- have disabled automatic mipmap generation then you need to call this function
- or the overload to create the mipmap chain.
-
- \note Mipmap generation is not supported for compressed textures with OpenGL ES.
-
- \sa setAutoMipMapGenerationEnabled(), setMipLevels(), mipLevels()
-*/
-void QOpenGLTexture::generateMipMaps()
-{
- Q_D(QOpenGLTexture);
- Q_ASSERT(d->texFuncs);
- Q_ASSERT(d->textureId);
- if (isCompressedFormat(d->format)) {
- if (QOpenGLContext *ctx = QOpenGLContext::currentContext())
- if (ctx->isOpenGLES())
- return;
- }
- d->texFuncs->glGenerateTextureMipmap(d->textureId, d->target, d->bindingTarget);
-}
-
-/*!
- Generates mipmaps for this texture object from mipmap level \a baseLevel. If you are
- using a texture target and filtering option that requires mipmaps and you
- have disabled automatic mipmap generation then you need to call this function
- or the overload to create the mipmap chain.
-
- The generation of mipmaps to above \a baseLevel is achieved by setting the mipmap
- base level to \a baseLevel and then generating the mipmap chain. If \a resetBaseLevel
- is \c true, then the baseLevel of the texture will be reset to its previous value.
-
- \sa setAutoMipMapGenerationEnabled(), setMipLevels(), mipLevels()
-*/
-void QOpenGLTexture::generateMipMaps(int baseLevel, bool resetBaseLevel)
-{
- Q_D(QOpenGLTexture);
- Q_ASSERT(d->texFuncs);
- Q_ASSERT(d->textureId);
- if (isCompressedFormat(d->format)) {
- if (QOpenGLContext *ctx = QOpenGLContext::currentContext())
- if (ctx->isOpenGLES())
- return;
- }
- int oldBaseLevel;
- if (resetBaseLevel)
- oldBaseLevel = mipBaseLevel();
- setMipBaseLevel(baseLevel);
- d->texFuncs->glGenerateTextureMipmap(d->textureId, d->target, d->bindingTarget);
- if (resetBaseLevel)
- setMipBaseLevel(oldBaseLevel);
-}
-
-/*!
- GLSL shaders are able to reorder the components of the vec4 returned by texture
- functions. It is also desirable to be able to control this reordering from CPU
- side code. This is made possible by swizzle masks since OpenGL 3.3.
-
- Each component of the texture can be mapped to one of the SwizzleValue options.
-
- This function maps \a component to the output \a value.
-
- \note This function has no effect on Mac and Qt built for OpenGL ES 2.
- \sa swizzleMask()
-*/
-void QOpenGLTexture::setSwizzleMask(SwizzleComponent component, SwizzleValue value)
-{
-#if !defined(Q_OS_MAC) && !defined(QT_OPENGL_ES_2)
- if (!QOpenGLContext::currentContext()->isOpenGLES()) {
- Q_D(QOpenGLTexture);
- d->create();
- Q_ASSERT(d->texFuncs);
- Q_ASSERT(d->textureId);
- if (!d->features.testFlag(Swizzle)) {
- qWarning("QOpenGLTexture::setSwizzleMask() requires OpenGL >= 3.3");
- return;
- }
- d->swizzleMask[component - SwizzleRed] = value;
- d->texFuncs->glTextureParameteri(d->textureId, d->target, d->bindingTarget, component, value);
- return;
- }
-#else
- Q_UNUSED(component);
- Q_UNUSED(value);
-#endif
- qWarning("QOpenGLTexture: Texture swizzling is not supported");
-}
-
-/*!
- Parameters \a {r}, \a {g}, \a {b}, and \a {a} are values used for setting
- the colors red, green, blue, and the alpha value.
- \overload
-*/
-void QOpenGLTexture::setSwizzleMask(SwizzleValue r, SwizzleValue g,
- SwizzleValue b, SwizzleValue a)
-{
-#if !defined(Q_OS_MAC) && !defined(QT_OPENGL_ES_2)
- if (!QOpenGLContext::currentContext()->isOpenGLES()) {
- Q_D(QOpenGLTexture);
- d->create();
- Q_ASSERT(d->texFuncs);
- Q_ASSERT(d->textureId);
- if (!d->features.testFlag(Swizzle)) {
- qWarning("QOpenGLTexture::setSwizzleMask() requires OpenGL >= 3.3");
- return;
- }
- GLint swizzleMask[] = {GLint(r), GLint(g), GLint(b), GLint(a)};
- d->swizzleMask[0] = r;
- d->swizzleMask[1] = g;
- d->swizzleMask[2] = b;
- d->swizzleMask[3] = a;
- d->texFuncs->glTextureParameteriv(d->textureId, d->target, d->bindingTarget, GL_TEXTURE_SWIZZLE_RGBA, swizzleMask);
- return;
- }
-#else
- Q_UNUSED(r);
- Q_UNUSED(g);
- Q_UNUSED(b);
- Q_UNUSED(a);
-#endif
- qWarning("QOpenGLTexture: Texture swizzling is not supported");
-}
-
-/*!
- Returns the swizzle mask for texture \a component.
-*/
-QOpenGLTexture::SwizzleValue QOpenGLTexture::swizzleMask(SwizzleComponent component) const
-{
- Q_D(const QOpenGLTexture);
- return d->swizzleMask[component - SwizzleRed];
-}
-
-/*!
- \enum QOpenGLTexture::DepthStencilMode
- \since 5.4
- This enum specifies which component of a depth/stencil texture is
- accessed when the texture is sampled.
-
- \value DepthMode Equivalent to GL_DEPTH_COMPONENT.
- \value StencilMode Equivalent to GL_STENCIL_INDEX.
-*/
-
-/*!
- If using a texture that has a combined depth/stencil format this function sets
- which component of the texture is accessed to \a mode.
-
- When the parameter is set to DepthMode, then accessing it from the
- shader will access the depth component as a single float, as normal. But when
- the parameter is set to StencilMode, the shader will access the stencil component.
-
- \note This function has no effect on Mac and Qt built for OpenGL ES 2.
- \since 5.4
- \sa depthStencilMode()
-*/
-void QOpenGLTexture::setDepthStencilMode(QOpenGLTexture::DepthStencilMode mode)
-{
-#if !defined(Q_OS_MAC) && !defined(QT_OPENGL_ES_2)
- if (!QOpenGLContext::currentContext()->isOpenGLES()) {
- Q_D(QOpenGLTexture);
- d->create();
- Q_ASSERT(d->texFuncs);
- Q_ASSERT(d->textureId);
- if (!d->features.testFlag(StencilTexturing)) {
- qWarning("QOpenGLTexture::setDepthStencilMode() requires OpenGL >= 4.3 or GL_ARB_stencil_texturing");
- return;
- }
- d->depthStencilMode = mode;
- d->texFuncs->glTextureParameteri(d->textureId, d->target, d->bindingTarget, GL_DEPTH_STENCIL_TEXTURE_MODE, mode);
- return;
- }
-#else
- Q_UNUSED(mode);
-#endif
- qWarning("QOpenGLTexture: DepthStencil Mode is not supported");
-}
-
-/*!
- Returns the depth stencil mode for textures using a combined depth/stencil format.
-
- \since 5.4
- \sa setDepthStencilMode()
-*/
-QOpenGLTexture::DepthStencilMode QOpenGLTexture::depthStencilMode() const
-{
- Q_D(const QOpenGLTexture);
- return d->depthStencilMode;
-}
-
-/*!
- \enum QOpenGLTexture::ComparisonFunction
- \since 5.5
- This enum specifies which comparison operator is used when texture comparison
- is enabled on this texture.
-
- \value CompareLessEqual Equivalent to GL_LEQUAL.
- \value CompareGreaterEqual Equivalent to GL_GEQUAL.
- \value CompareLess Equivalent to GL_LESS.
- \value CompareGreater Equivalent to GL_GREATER.
- \value CompareEqual Equivalent to GL_EQUAL.
- \value CommpareNotEqual Equivalent to GL_NOTEQUAL.
- \value CompareAlways Equivalent to GL_ALWAYS.
- \value CompareNever Equivalent to GL_NEVER.
-
-*/
-
-/*!
- \since 5.5
-
- Sets the texture comparison function on this texture to \a function. The texture
- comparison function is used by shadow samplers when sampling a depth texture.
-
- \sa comparisonFunction()
-*/
-void QOpenGLTexture::setComparisonFunction(QOpenGLTexture::ComparisonFunction function)
-{
- Q_D(QOpenGLTexture);
- d->create();
- if (!d->features.testFlag(TextureComparisonOperators)) {
- qWarning("QOpenGLTexture::setComparisonFunction: requires OpenGL >= 1.5 or OpenGL ES >= 3.0");
- return;
- }
- d->comparisonFunction = function;
- d->texFuncs->glTextureParameteri(d->textureId, d->target, d->bindingTarget, GL_TEXTURE_COMPARE_FUNC, function);
-}
-
-/*!
- \since 5.5
-
- Returns the texture comparison operator set on this texture. By default, a
- texture has a CompareLessEqual comparison function.
-
- \sa setComparisonFunction()
-*/
-QOpenGLTexture::ComparisonFunction QOpenGLTexture::comparisonFunction() const
-{
- Q_D(const QOpenGLTexture);
- return d->comparisonFunction;
-}
-
-/*!
- \enum QOpenGLTexture::ComparisonMode
- \since 5.5
- This enum specifies which comparison mode is used when sampling this texture.
-
- \value CompareRefToTexture Equivalent to GL_COMPARE_REF_TO_TEXTURE.
- \value CompareNone Equivalent to GL_NONE.
-*/
-
-/*!
- \since 5.5
-
- Sets the texture comparison mode on this texture to \a mode. The texture
- comparison mode is used by shadow samplers when sampling a depth texture.
-
- \sa comparisonMode()
-*/
-void QOpenGLTexture::setComparisonMode(QOpenGLTexture::ComparisonMode mode)
-{
- Q_D(QOpenGLTexture);
- d->create();
- if (!d->features.testFlag(TextureComparisonOperators)) {
- qWarning("QOpenGLTexture::setComparisonMode: requires OpenGL >= 1.5 or OpenGL ES >= 3.0");
- return;
- }
- d->comparisonMode = mode;
- d->texFuncs->glTextureParameteri(d->textureId, d->target, d->bindingTarget, GL_TEXTURE_COMPARE_MODE, mode);
-}
-
-/*!
- \since 5.5
-
- Returns the texture comparison mode set on this texture. By default, a
- texture has a CompareNone comparison mode (i.e. comparisons are disabled).
-
- \sa setComparisonMode()
-*/
-QOpenGLTexture::ComparisonMode QOpenGLTexture::comparisonMode() const
-{
- Q_D(const QOpenGLTexture);
- return d->comparisonMode;
-}
-
-/*!
- Sets the filter used for minification to \a filter.
-
- \sa minificationFilter(), setMagnificationFilter(), setMinMagFilters()
-*/
-void QOpenGLTexture::setMinificationFilter(QOpenGLTexture::Filter filter)
-{
- Q_D(QOpenGLTexture);
- d->create();
- Q_ASSERT(d->texFuncs);
- Q_ASSERT(d->textureId);
- d->minFilter = filter;
- d->texFuncs->glTextureParameteri(d->textureId, d->target, d->bindingTarget, GL_TEXTURE_MIN_FILTER, filter);
-}
-
-/*!
- Returns the minification filter.
-
- \sa setMinificationFilter()
-*/
-QOpenGLTexture::Filter QOpenGLTexture::minificationFilter() const
-{
- Q_D(const QOpenGLTexture);
- return d->minFilter;
-}
-
-/*!
- Sets the magnification filter to \a filter.
-
- \sa magnificationFilter(), setMinificationFilter(), setMinMagFilters()
-*/
-void QOpenGLTexture::setMagnificationFilter(QOpenGLTexture::Filter filter)
-{
- Q_D(QOpenGLTexture);
- d->create();
- Q_ASSERT(d->texFuncs);
- Q_ASSERT(d->textureId);
- d->magFilter = filter;
- d->texFuncs->glTextureParameteri(d->textureId, d->target, d->bindingTarget, GL_TEXTURE_MAG_FILTER, filter);
-}
-
-/*!
- Returns the magnification filter.
-
- \sa setMagnificationFilter()
-*/
-QOpenGLTexture::Filter QOpenGLTexture::magnificationFilter() const
-{
- Q_D(const QOpenGLTexture);
- return d->magFilter;
-}
-
-/*!
- Sets the minification filter to \a minificationFilter and the magnification filter
- to \a magnificationFilter.
-
- \sa minMagFilters(), setMinificationFilter(), setMagnificationFilter()
-*/
-void QOpenGLTexture::setMinMagFilters(QOpenGLTexture::Filter minificationFilter,
- QOpenGLTexture::Filter magnificationFilter)
-{
- Q_D(QOpenGLTexture);
- d->create();
- Q_ASSERT(d->texFuncs);
- Q_ASSERT(d->textureId);
- d->minFilter = minificationFilter;
- d->magFilter = magnificationFilter;
- d->texFuncs->glTextureParameteri(d->textureId, d->target, d->bindingTarget, GL_TEXTURE_MIN_FILTER, minificationFilter);
- d->texFuncs->glTextureParameteri(d->textureId, d->target, d->bindingTarget, GL_TEXTURE_MAG_FILTER, magnificationFilter);
-}
-
-/*!
- Returns the current minification and magnification filters.
-
- \sa setMinMagFilters()
-*/
-QPair<QOpenGLTexture::Filter, QOpenGLTexture::Filter> QOpenGLTexture::minMagFilters() const
-{
- Q_D(const QOpenGLTexture);
- return QPair<QOpenGLTexture::Filter, QOpenGLTexture::Filter>(d->minFilter, d->magFilter);
-}
-
-/*!
- If your OpenGL implementation supports the GL_EXT_texture_filter_anisotropic extension
- this function sets the maximum anisotropy level to \a anisotropy.
-
- \sa maximumAnisotropy()
-*/
-void QOpenGLTexture::setMaximumAnisotropy(float anisotropy)
-{
- Q_D(QOpenGLTexture);
- d->create();
- Q_ASSERT(d->texFuncs);
- Q_ASSERT(d->textureId);
- if (!d->features.testFlag(AnisotropicFiltering)) {
- qWarning("QOpenGLTexture::setMaximumAnisotropy() requires GL_EXT_texture_filter_anisotropic");
- return;
- }
- d->maxAnisotropy = anisotropy;
- d->texFuncs->glTextureParameteri(d->textureId, d->target, d->bindingTarget, GL_TEXTURE_MAX_ANISOTROPY_EXT, anisotropy);
-}
-
-/*!
- Returns the maximum level of anisotropy to be accounted for when performing texture lookups.
- This requires the GL_EXT_texture_filter_anisotropic extension.
-
- \sa setMaximumAnisotropy()
-*/
-float QOpenGLTexture::maximumAnisotropy() const
-{
- Q_D(const QOpenGLTexture);
- return d->maxAnisotropy;
-}
-
-/*!
- Sets the wrap (or repeat mode) for all texture dimentions to \a mode.
-
- \sa wrapMode()
-*/
-void QOpenGLTexture::setWrapMode(QOpenGLTexture::WrapMode mode)
-{
- Q_D(QOpenGLTexture);
- d->create();
- Q_ASSERT(d->texFuncs);
- Q_ASSERT(d->textureId);
- d->setWrapMode(mode);
-}
-
-/*!
- Holds the texture dimension \a direction.
- \overload
-*/
-void QOpenGLTexture::setWrapMode(QOpenGLTexture::CoordinateDirection direction, QOpenGLTexture::WrapMode mode)
-{
- Q_D(QOpenGLTexture);
- d->create();
- Q_ASSERT(d->texFuncs);
- Q_ASSERT(d->textureId);
- d->setWrapMode(direction, mode);
-}
-
-/*!
- Returns the wrap mode for the texture dimension \a direction.
-
- \sa setWrapMode()
-*/
-QOpenGLTexture::WrapMode QOpenGLTexture::wrapMode(QOpenGLTexture::CoordinateDirection direction) const
-{
- Q_D(const QOpenGLTexture);
- return d->wrapMode(direction);
-}
-
-/*!
- Sets the border color of the texture to \a color.
-
- \note This function has no effect on Mac and Qt built for OpenGL ES 2.
- \sa borderColor()
-*/
-void QOpenGLTexture::setBorderColor(const QColor &color)
-{
- setBorderColor(static_cast<float>(color.redF()), static_cast<float>(color.greenF()),
- static_cast<float>(color.blueF()), static_cast<float>(color.alphaF()));
-}
-
-/*!
- Sets the color red to \a {r}, green to \a {g}, blue to \a {b}, and \a {a} to the
- alpha value.
- \overload
-*/
-void QOpenGLTexture::setBorderColor(float r, float g, float b, float a)
-{
-#if !defined(QT_OPENGL_ES_2)
- if (!QOpenGLContext::currentContext()->isOpenGLES()) {
- Q_D(QOpenGLTexture);
- d->create();
- Q_ASSERT(d->texFuncs);
- Q_ASSERT(d->textureId);
- float values[4];
- values[0] = r;
- values[1] = g;
- values[2] = b;
- values[3] = a;
- d->borderColor.clear();
- for (int i = 0; i < 4; ++i)
- d->borderColor.append(QVariant(values[i]));
- d->texFuncs->glTextureParameterfv(d->textureId, d->target, d->bindingTarget, GL_TEXTURE_BORDER_COLOR, values);
- return;
- }
-#else
- Q_UNUSED(r);
- Q_UNUSED(g);
- Q_UNUSED(b);
- Q_UNUSED(a);
-#endif
- qWarning("QOpenGLTexture: Border color is not supported");
-}
-
-/*!
- Sets the color red to \a {r}, green to \a {g}, blue to \a {b}, and the alpha
- value to \a {a}.
- \overload
-*/
-void QOpenGLTexture::setBorderColor(int r, int g, int b, int a)
-{
-#if !defined(QT_OPENGL_ES_2)
- if (!QOpenGLContext::currentContext()->isOpenGLES()) {
- Q_D(QOpenGLTexture);
- d->create();
- Q_ASSERT(d->texFuncs);
- Q_ASSERT(d->textureId);
- int values[4];
- values[0] = r;
- values[1] = g;
- values[2] = b;
- values[3] = a;
- d->borderColor.clear();
- for (int i = 0; i < 4; ++i)
- d->borderColor.append(QVariant(values[i]));
- d->texFuncs->glTextureParameteriv(d->textureId, d->target, d->bindingTarget, GL_TEXTURE_BORDER_COLOR, values);
- return;
- }
-#else
- Q_UNUSED(r);
- Q_UNUSED(g);
- Q_UNUSED(b);
- Q_UNUSED(a);
-#endif
- qWarning("QOpenGLTexture: Border color is not supported");
-
- // TODO Handle case of using glTextureParameterIiv() based on format
-}
-
-/*!
- Sets the color red to \a {r}, green to \a {g}, blue to \a {b}, and the alpha
- value to \a {a}.
- \overload
-*/
-void QOpenGLTexture::setBorderColor(uint r, uint g, uint b, uint a)
-{
-#if !defined(QT_OPENGL_ES_2)
- if (!QOpenGLContext::currentContext()->isOpenGLES()) {
- Q_D(QOpenGLTexture);
- d->create();
- Q_ASSERT(d->texFuncs);
- Q_ASSERT(d->textureId);
- int values[4];
- values[0] = int(r);
- values[1] = int(g);
- values[2] = int(b);
- values[3] = int(a);
- d->borderColor.clear();
- for (int i = 0; i < 4; ++i)
- d->borderColor.append(QVariant(values[i]));
- d->texFuncs->glTextureParameteriv(d->textureId, d->target, d->bindingTarget, GL_TEXTURE_BORDER_COLOR, values);
- return;
- }
-#else
- Q_UNUSED(r);
- Q_UNUSED(g);
- Q_UNUSED(b);
- Q_UNUSED(a);
-#endif
- qWarning("QOpenGLTexture: Border color is not supported");
-
- // TODO Handle case of using glTextureParameterIuiv() based on format
-}
-
-/*!
- Returns the borderColor of this texture.
-
- \sa setBorderColor()
-*/
-QColor QOpenGLTexture::borderColor() const
-{
- Q_D(const QOpenGLTexture);
- QColor c(0.0f, 0.0f, 0.0f, 0.0f);
- if (!d->borderColor.isEmpty()) {
- c.setRedF(d->borderColor.at(0).toFloat());
- c.setGreenF(d->borderColor.at(1).toFloat());
- c.setBlueF(d->borderColor.at(2).toFloat());
- c.setAlphaF(d->borderColor.at(3).toFloat());
- }
- return c;
-}
-
-/*!
- Writes the texture border color into the first four elements
- of the array pointed to by \a border.
-
- \sa setBorderColor()
-*/
-void QOpenGLTexture::borderColor(float *border) const
-{
- Q_D(const QOpenGLTexture);
- Q_ASSERT(border);
- if (d->borderColor.isEmpty()) {
- for (int i = 0; i < 4; ++i)
- border[i] = 0.0f;
- } else {
- for (int i = 0; i < 4; ++i)
- border[i] = d->borderColor.at(i).toFloat();
- }
-}
-
-/*!
- Writes the texture border color into the first four elements
- of the array pointed to by \a border.
-
- \overload
-*/
-void QOpenGLTexture::borderColor(int *border) const
-{
- Q_D(const QOpenGLTexture);
- Q_ASSERT(border);
- if (d->borderColor.isEmpty()) {
- for (int i = 0; i < 4; ++i)
- border[i] = 0;
- } else {
- for (int i = 0; i < 4; ++i)
- border[i] = d->borderColor.at(i).toInt();
- }
-}
-
-/*!
- Writes the texture border color into the first four elements
- of the array pointed to by \a border.
-
- \overload
-*/
-void QOpenGLTexture::borderColor(unsigned int *border) const
-{
- Q_D(const QOpenGLTexture);
- Q_ASSERT(border);
- if (d->borderColor.isEmpty()) {
- for (int i = 0; i < 4; ++i)
- border[i] = 0;
- } else {
- for (int i = 0; i < 4; ++i)
- border[i] = d->borderColor.at(i).toUInt();
- }
-}
-
-/*!
- Sets the minimum level of detail to \a value. This limits the selection of highest
- resolution mipmap (lowest mipmap level). The default value is -1000.
-
- \note This function has no effect on Qt built for OpenGL ES 2.
- \sa minimumLevelOfDetail(), setMaximumLevelOfDetail(), setLevelOfDetailRange()
-*/
-void QOpenGLTexture::setMinimumLevelOfDetail(float value)
-{
-#if !defined(QT_OPENGL_ES_2)
- if (!QOpenGLContext::currentContext()->isOpenGLES()) {
- Q_D(QOpenGLTexture);
- d->create();
- Q_ASSERT(d->texFuncs);
- Q_ASSERT(d->textureId);
- Q_ASSERT(value < d->maxLevelOfDetail);
- d->minLevelOfDetail = value;
- d->texFuncs->glTextureParameterf(d->textureId, d->target, d->bindingTarget, GL_TEXTURE_MIN_LOD, value);
- return;
- }
-#else
- Q_UNUSED(value);
-#endif
- qWarning("QOpenGLTexture: Detail level is not supported");
-}
-
-/*!
- Returns the minimum level of detail parameter.
-
- \sa setMinimumLevelOfDetail(), maximumLevelOfDetail(), levelOfDetailRange()
-*/
-float QOpenGLTexture::minimumLevelOfDetail() const
-{
- Q_D(const QOpenGLTexture);
- return d->minLevelOfDetail;
-}
-
-/*!
- Sets the maximum level of detail to \a value. This limits the selection of lowest
- resolution mipmap (highest mipmap level). The default value is 1000.
-
- \note This function has no effect on Qt built for OpenGL ES 2.
- \sa maximumLevelOfDetail(), setMinimumLevelOfDetail(), setLevelOfDetailRange()
-*/
-void QOpenGLTexture::setMaximumLevelOfDetail(float value)
-{
-#if !defined(QT_OPENGL_ES_2)
- if (!QOpenGLContext::currentContext()->isOpenGLES()) {
- Q_D(QOpenGLTexture);
- d->create();
- Q_ASSERT(d->texFuncs);
- Q_ASSERT(d->textureId);
- Q_ASSERT(value > d->minLevelOfDetail);
- d->maxLevelOfDetail = value;
- d->texFuncs->glTextureParameterf(d->textureId, d->target, d->bindingTarget, GL_TEXTURE_MAX_LOD, value);
- return;
- }
-#else
- Q_UNUSED(value);
-#endif
- qWarning("QOpenGLTexture: Detail level is not supported");
-}
-
-/*!
- Returns the maximum level of detail parameter.
-
- \sa setMaximumLevelOfDetail(), minimumLevelOfDetail(), levelOfDetailRange()
-*/
-float QOpenGLTexture::maximumLevelOfDetail() const
-{
- Q_D(const QOpenGLTexture);
- return d->maxLevelOfDetail;
-}
-
-/*!
- Sets the minimum level of detail parameters to \a min and the maximum level
- to \a max.
- \note This function has no effect on Qt built for OpenGL ES 2.
- \sa levelOfDetailRange(), setMinimumLevelOfDetail(), setMaximumLevelOfDetail()
-*/
-void QOpenGLTexture::setLevelOfDetailRange(float min, float max)
-{
-#if !defined(QT_OPENGL_ES_2)
- if (!QOpenGLContext::currentContext()->isOpenGLES()) {
- Q_D(QOpenGLTexture);
- d->create();
- Q_ASSERT(d->texFuncs);
- Q_ASSERT(d->textureId);
- Q_ASSERT(min < max);
- d->minLevelOfDetail = min;
- d->maxLevelOfDetail = max;
- d->texFuncs->glTextureParameterf(d->textureId, d->target, d->bindingTarget, GL_TEXTURE_MIN_LOD, min);
- d->texFuncs->glTextureParameterf(d->textureId, d->target, d->bindingTarget, GL_TEXTURE_MAX_LOD, max);
- return;
- }
-#else
- Q_UNUSED(min);
- Q_UNUSED(max);
-#endif
- qWarning("QOpenGLTexture: Detail level is not supported");
-}
-
-/*!
- Returns the minimum and maximum level of detail parameters.
-
- \sa setLevelOfDetailRange(), minimumLevelOfDetail(), maximumLevelOfDetail()
-*/
-QPair<float, float> QOpenGLTexture::levelOfDetailRange() const
-{
- Q_D(const QOpenGLTexture);
- return qMakePair(d->minLevelOfDetail, d->maxLevelOfDetail);
-}
-
-/*!
- Sets the level of detail bias to \a bias.
- Level of detail bias affects the point at which mipmapping levels change.
- Increasing values for level of detail bias makes the overall images blurrier
- or smoother. Decreasing values make the overall images sharper.
-
- \note This function has no effect on Qt built for OpenGL ES 2.
- \sa levelofDetailBias()
-*/
-void QOpenGLTexture::setLevelofDetailBias(float bias)
-{
-#if !defined(QT_OPENGL_ES_2)
- if (!QOpenGLContext::currentContext()->isOpenGLES()) {
- Q_D(QOpenGLTexture);
- d->create();
- Q_ASSERT(d->texFuncs);
- Q_ASSERT(d->textureId);
- d->levelOfDetailBias = bias;
- d->texFuncs->glTextureParameterf(d->textureId, d->target, d->bindingTarget, GL_TEXTURE_LOD_BIAS, bias);
- return;
- }
-#else
- Q_UNUSED(bias);
-#endif
- qWarning("QOpenGLTexture: Detail level is not supported");
-}
-
-/*!
- Returns the level of detail bias parameter.
-
- \sa setLevelofDetailBias()
-*/
-float QOpenGLTexture::levelofDetailBias() const
-{
- Q_D(const QOpenGLTexture);
- return d->levelOfDetailBias;
-}
-
-#ifndef QT_NO_DEBUG_STREAM
-QDebug operator<<(QDebug debug, const QOpenGLTexture *t)
-{
- QDebugStateSaver saver(debug);
- debug.nospace();
- debug << "QOpenGLTexture(";
- if (t) {
- const QOpenGLTexturePrivate *d = t->d_ptr.data();
- debug << d->target << ", bindingTarget=" << d->bindingTarget
- << ", size=[" << d->dimensions[0]
- << ", " << d->dimensions[1];
- if (d->target == QOpenGLTexture::Target3D)
- debug << ", " << d->dimensions[2];
- debug << "], format=" << d->format << ", formatClass=" << d->formatClass;
- if (t->isCreated())
- debug << ", textureId=" << d->textureId;
- if (t->isBound())
- debug << ", [bound]";
- if (t->isTextureView())
- debug << ", [view]";
- if (d->fixedSamplePositions)
- debug << ", [fixedSamplePositions]";
- debug << ", mipLevels=" << d->requestedMipLevels << ", layers=" << d->layers
- << ", faces=" << d->faces << ", samples=" << d->samples
- << ", depthStencilMode=" << d->depthStencilMode << ", comparisonFunction="
- << d->comparisonFunction << ", comparisonMode=" << d->comparisonMode
- << ", features=" << d->features << ", minificationFilter=" << d->minFilter
- << ", magnificationFilter=" << d->magFilter << ", wrapMode=" << d->wrapModes[0];
- } else {
- debug << '0';
- }
- debug << ')';
- return debug;
-}
-#endif // QT_NO_DEBUG_STREAM
-
-QT_END_NAMESPACE
diff --git a/src/gui/opengl/qopengltexture.h b/src/gui/opengl/qopengltexture.h
deleted file mode 100644
index 539b6aa7b2..0000000000
--- a/src/gui/opengl/qopengltexture.h
+++ /dev/null
@@ -1,663 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2013 Klaralvdalens Datakonsult AB (KDAB).
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the QtGui module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef QOPENGLABSTRACTTEXTURE_H
-#define QOPENGLABSTRACTTEXTURE_H
-
-#include <QtGui/qtguiglobal.h>
-
-#ifndef QT_NO_OPENGL
-
-#include <QtGui/qopengl.h>
-#include <QtGui/qimage.h>
-#include <QtCore/QScopedPointer>
-
-QT_BEGIN_NAMESPACE
-
-class QDebug;
-class QOpenGLTexturePrivate;
-class QOpenGLPixelTransferOptions;
-
-class Q_GUI_EXPORT QOpenGLTexture
-{
- Q_GADGET
-public:
- enum Target {
- Target1D = 0x0DE0, // GL_TEXTURE_1D
- Target1DArray = 0x8C18, // GL_TEXTURE_1D_ARRAY
- Target2D = 0x0DE1, // GL_TEXTURE_2D
- Target2DArray = 0x8C1A, // GL_TEXTURE_2D_ARRAY
- Target3D = 0x806F, // GL_TEXTURE_3D
- TargetCubeMap = 0x8513, // GL_TEXTURE_CUBE_MAP
- TargetCubeMapArray = 0x9009, // GL_TEXTURE_CUBE_MAP_ARRAY
- Target2DMultisample = 0x9100, // GL_TEXTURE_2D_MULTISAMPLE
- Target2DMultisampleArray = 0x9102, // GL_TEXTURE_2D_MULTISAMPLE_ARRAY
- TargetRectangle = 0x84F5, // GL_TEXTURE_RECTANGLE
- TargetBuffer = 0x8C2A // GL_TEXTURE_BUFFER
- };
- Q_ENUM(Target)
-
- enum BindingTarget {
- BindingTarget1D = 0x8068, // GL_TEXTURE_BINDING_1D
- BindingTarget1DArray = 0x8C1C, // GL_TEXTURE_BINDING_1D_ARRAY
- BindingTarget2D = 0x8069, // GL_TEXTURE_BINDING_2D
- BindingTarget2DArray = 0x8C1D, // GL_TEXTURE_BINDING_2D_ARRAY
- BindingTarget3D = 0x806A, // GL_TEXTURE_BINDING_3D
- BindingTargetCubeMap = 0x8514, // GL_TEXTURE_BINDING_CUBE_MAP
- BindingTargetCubeMapArray = 0x900A, // GL_TEXTURE_BINDING_CUBE_MAP_ARRAY
- BindingTarget2DMultisample = 0x9104, // GL_TEXTURE_BINDING_2D_MULTISAMPLE
- BindingTarget2DMultisampleArray = 0x9105, // GL_TEXTURE_BINDING_2D_MULTISAMPLE_ARRAY
- BindingTargetRectangle = 0x84F6, // GL_TEXTURE_BINDING_RECTANGLE
- BindingTargetBuffer = 0x8C2C // GL_TEXTURE_BINDING_BUFFER
- };
- Q_ENUM(BindingTarget)
-
- enum MipMapGeneration {
- GenerateMipMaps,
- DontGenerateMipMaps
- };
- Q_ENUM(MipMapGeneration)
-
- enum TextureUnitReset {
- ResetTextureUnit,
- DontResetTextureUnit
- };
- Q_ENUM(TextureUnitReset)
-
- enum TextureFormat {
- NoFormat = 0, // GL_NONE
-
- // Unsigned normalized formats
- R8_UNorm = 0x8229, // GL_R8
- RG8_UNorm = 0x822B, // GL_RG8
- RGB8_UNorm = 0x8051, // GL_RGB8
- RGBA8_UNorm = 0x8058, // GL_RGBA8
-
- R16_UNorm = 0x822A, // GL_R16
- RG16_UNorm = 0x822C, // GL_RG16
- RGB16_UNorm = 0x8054, // GL_RGB16
- RGBA16_UNorm = 0x805B, // GL_RGBA16
-
- // Signed normalized formats
- R8_SNorm = 0x8F94, // GL_R8_SNORM
- RG8_SNorm = 0x8F95, // GL_RG8_SNORM
- RGB8_SNorm = 0x8F96, // GL_RGB8_SNORM
- RGBA8_SNorm = 0x8F97, // GL_RGBA8_SNORM
-
- R16_SNorm = 0x8F98, // GL_R16_SNORM
- RG16_SNorm = 0x8F99, // GL_RG16_SNORM
- RGB16_SNorm = 0x8F9A, // GL_RGB16_SNORM
- RGBA16_SNorm = 0x8F9B, // GL_RGBA16_SNORM
-
- // Unsigned integer formats
- R8U = 0x8232, // GL_R8UI
- RG8U = 0x8238, // GL_RG8UI
- RGB8U = 0x8D7D, // GL_RGB8UI
- RGBA8U = 0x8D7C, // GL_RGBA8UI
-
- R16U = 0x8234, // GL_R16UI
- RG16U = 0x823A, // GL_RG16UI
- RGB16U = 0x8D77, // GL_RGB16UI
- RGBA16U = 0x8D76, // GL_RGBA16UI
-
- R32U = 0x8236, // GL_R32UI
- RG32U = 0x823C, // GL_RG32UI
- RGB32U = 0x8D71, // GL_RGB32UI
- RGBA32U = 0x8D70, // GL_RGBA32UI
-
- // Signed integer formats
- R8I = 0x8231, // GL_R8I
- RG8I = 0x8237, // GL_RG8I
- RGB8I = 0x8D8F, // GL_RGB8I
- RGBA8I = 0x8D8E, // GL_RGBA8I
-
- R16I = 0x8233, // GL_R16I
- RG16I = 0x8239, // GL_RG16I
- RGB16I = 0x8D89, // GL_RGB16I
- RGBA16I = 0x8D88, // GL_RGBA16I
-
- R32I = 0x8235, // GL_R32I
- RG32I = 0x823B, // GL_RG32I
- RGB32I = 0x8D83, // GL_RGB32I
- RGBA32I = 0x8D82, // GL_RGBA32I
-
- // Floating point formats
- R16F = 0x822D, // GL_R16F
- RG16F = 0x822F, // GL_RG16F
- RGB16F = 0x881B, // GL_RGB16F
- RGBA16F = 0x881A, // GL_RGBA16F
-
- R32F = 0x822E, // GL_R32F
- RG32F = 0x8230, // GL_RG32F
- RGB32F = 0x8815, // GL_RGB32F
- RGBA32F = 0x8814, // GL_RGBA32F
-
- // Packed formats
- RGB9E5 = 0x8C3D, // GL_RGB9_E5
- RG11B10F = 0x8C3A, // GL_R11F_G11F_B10F
- RG3B2 = 0x2A10, // GL_R3_G3_B2
- R5G6B5 = 0x8D62, // GL_RGB565
- RGB5A1 = 0x8057, // GL_RGB5_A1
- RGBA4 = 0x8056, // GL_RGBA4
- RGB10A2 = 0x906F, // GL_RGB10_A2UI
-
- // Depth formats
- D16 = 0x81A5, // GL_DEPTH_COMPONENT16
- D24 = 0x81A6, // GL_DEPTH_COMPONENT24
- D24S8 = 0x88F0, // GL_DEPTH24_STENCIL8
- D32 = 0x81A7, // GL_DEPTH_COMPONENT32
- D32F = 0x8CAC, // GL_DEPTH_COMPONENT32F
- D32FS8X24 = 0x8CAD, // GL_DEPTH32F_STENCIL8
- S8 = 0x8D48, // GL_STENCIL_INDEX8
-
- // Compressed formats
- RGB_DXT1 = 0x83F0, // GL_COMPRESSED_RGB_S3TC_DXT1_EXT
- RGBA_DXT1 = 0x83F1, // GL_COMPRESSED_RGBA_S3TC_DXT1_EXT
- RGBA_DXT3 = 0x83F2, // GL_COMPRESSED_RGBA_S3TC_DXT3_EXT
- RGBA_DXT5 = 0x83F3, // GL_COMPRESSED_RGBA_S3TC_DXT5_EXT
- R_ATI1N_UNorm = 0x8DBB, // GL_COMPRESSED_RED_RGTC1
- R_ATI1N_SNorm = 0x8DBC, // GL_COMPRESSED_SIGNED_RED_RGTC1
- RG_ATI2N_UNorm = 0x8DBD, // GL_COMPRESSED_RG_RGTC2
- RG_ATI2N_SNorm = 0x8DBE, // GL_COMPRESSED_SIGNED_RG_RGTC2
- RGB_BP_UNSIGNED_FLOAT = 0x8E8F, // GL_COMPRESSED_RGB_BPTC_UNSIGNED_FLOAT_ARB
- RGB_BP_SIGNED_FLOAT = 0x8E8E, // GL_COMPRESSED_RGB_BPTC_SIGNED_FLOAT_ARB
- RGB_BP_UNorm = 0x8E8C, // GL_COMPRESSED_RGBA_BPTC_UNORM_ARB
- R11_EAC_UNorm = 0x9270, // GL_COMPRESSED_R11_EAC
- R11_EAC_SNorm = 0x9271, // GL_COMPRESSED_SIGNED_R11_EAC
- RG11_EAC_UNorm = 0x9272, // GL_COMPRESSED_RG11_EAC
- RG11_EAC_SNorm = 0x9273, // GL_COMPRESSED_SIGNED_RG11_EAC
- RGB8_ETC2 = 0x9274, // GL_COMPRESSED_RGB8_ETC2
- SRGB8_ETC2 = 0x9275, // GL_COMPRESSED_SRGB8_ETC2
- RGB8_PunchThrough_Alpha1_ETC2 = 0x9276, // GL_COMPRESSED_RGB8_PUNCHTHROUGH_ALPHA1_ETC2
- SRGB8_PunchThrough_Alpha1_ETC2 = 0x9277, // GL_COMPRESSED_SRGB8_PUNCHTHROUGH_ALPHA1_ETC2
- RGBA8_ETC2_EAC = 0x9278, // GL_COMPRESSED_RGBA8_ETC2_EAC
- SRGB8_Alpha8_ETC2_EAC = 0x9279, // GL_COMPRESSED_SRGB8_ALPHA8_ETC2_EAC
- RGB8_ETC1 = 0x8D64, // GL_ETC1_RGB8_OES
- RGBA_ASTC_4x4 = 0x93B0, // GL_COMPRESSED_RGBA_ASTC_4x4_KHR
- RGBA_ASTC_5x4 = 0x93B1, // GL_COMPRESSED_RGBA_ASTC_5x4_KHR
- RGBA_ASTC_5x5 = 0x93B2, // GL_COMPRESSED_RGBA_ASTC_5x5_KHR
- RGBA_ASTC_6x5 = 0x93B3, // GL_COMPRESSED_RGBA_ASTC_6x5_KHR
- RGBA_ASTC_6x6 = 0x93B4, // GL_COMPRESSED_RGBA_ASTC_6x6_KHR
- RGBA_ASTC_8x5 = 0x93B5, // GL_COMPRESSED_RGBA_ASTC_8x5_KHR
- RGBA_ASTC_8x6 = 0x93B6, // GL_COMPRESSED_RGBA_ASTC_8x6_KHR
- RGBA_ASTC_8x8 = 0x93B7, // GL_COMPRESSED_RGBA_ASTC_8x8_KHR
- RGBA_ASTC_10x5 = 0x93B8, // GL_COMPRESSED_RGBA_ASTC_10x5_KHR
- RGBA_ASTC_10x6 = 0x93B9, // GL_COMPRESSED_RGBA_ASTC_10x6_KHR
- RGBA_ASTC_10x8 = 0x93BA, // GL_COMPRESSED_RGBA_ASTC_10x8_KHR
- RGBA_ASTC_10x10 = 0x93BB, // GL_COMPRESSED_RGBA_ASTC_10x10_KHR
- RGBA_ASTC_12x10 = 0x93BC, // GL_COMPRESSED_RGBA_ASTC_12x10_KHR
- RGBA_ASTC_12x12 = 0x93BD, // GL_COMPRESSED_RGBA_ASTC_12x12_KHR
- SRGB8_Alpha8_ASTC_4x4 = 0x93D0, // GL_COMPRESSED_SRGB8_ALPHA8_ASTC_4x4_KHR
- SRGB8_Alpha8_ASTC_5x4 = 0x93D1, // GL_COMPRESSED_SRGB8_ALPHA8_ASTC_5x4_KHR
- SRGB8_Alpha8_ASTC_5x5 = 0x93D2, // GL_COMPRESSED_SRGB8_ALPHA8_ASTC_5x5_KHR
- SRGB8_Alpha8_ASTC_6x5 = 0x93D3, // GL_COMPRESSED_SRGB8_ALPHA8_ASTC_6x5_KHR
- SRGB8_Alpha8_ASTC_6x6 = 0x93D4, // GL_COMPRESSED_SRGB8_ALPHA8_ASTC_6x6_KHR
- SRGB8_Alpha8_ASTC_8x5 = 0x93D5, // GL_COMPRESSED_SRGB8_ALPHA8_ASTC_8x5_KHR
- SRGB8_Alpha8_ASTC_8x6 = 0x93D6, // GL_COMPRESSED_SRGB8_ALPHA8_ASTC_8x6_KHR
- SRGB8_Alpha8_ASTC_8x8 = 0x93D7, // GL_COMPRESSED_SRGB8_ALPHA8_ASTC_8x8_KHR
- SRGB8_Alpha8_ASTC_10x5 = 0x93D8, // GL_COMPRESSED_SRGB8_ALPHA8_ASTC_10x5_KHR
- SRGB8_Alpha8_ASTC_10x6 = 0x93D9, // GL_COMPRESSED_SRGB8_ALPHA8_ASTC_10x6_KHR
- SRGB8_Alpha8_ASTC_10x8 = 0x93DA, // GL_COMPRESSED_SRGB8_ALPHA8_ASTC_10x8_KHR
- SRGB8_Alpha8_ASTC_10x10 = 0x93DB, // GL_COMPRESSED_SRGB8_ALPHA8_ASTC_10x10_KHR
- SRGB8_Alpha8_ASTC_12x10 = 0x93DC, // GL_COMPRESSED_SRGB8_ALPHA8_ASTC_12x10_KHR
- SRGB8_Alpha8_ASTC_12x12 = 0x93DD, // GL_COMPRESSED_SRGB8_ALPHA8_ASTC_12x12_KHR
-
- // sRGB formats
- SRGB8 = 0x8C41, // GL_SRGB8
- SRGB8_Alpha8 = 0x8C43, // GL_SRGB8_ALPHA8
- SRGB_DXT1 = 0x8C4C, // GL_COMPRESSED_SRGB_S3TC_DXT1_EXT
- SRGB_Alpha_DXT1 = 0x8C4D, // GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT
- SRGB_Alpha_DXT3 = 0x8C4E, // GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT
- SRGB_Alpha_DXT5 = 0x8C4F, // GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT
- SRGB_BP_UNorm = 0x8E8D, // GL_COMPRESSED_SRGB_ALPHA_BPTC_UNORM_ARB
-
- // ES 2 formats
- DepthFormat = 0x1902, // GL_DEPTH_COMPONENT
- AlphaFormat = 0x1906, // GL_ALPHA
- RGBFormat = 0x1907, // GL_RGB
- RGBAFormat = 0x1908, // GL_RGBA
- LuminanceFormat = 0x1909, // GL_LUMINANCE
- LuminanceAlphaFormat = 0x190A
-
- };
- Q_ENUM(TextureFormat)
-
- // This is not used externally yet but is reserved to allow checking of
- // compatibility between texture formats
-#ifndef Q_QDOC
- enum TextureFormatClass {
- NoFormatClass,
- FormatClass_128Bit,
- FormatClass_96Bit,
- FormatClass_64Bit,
- FormatClass_48Bit,
- FormatClass_32Bit,
- FormatClass_24Bit,
- FormatClass_16Bit,
- FormatClass_8Bit,
- FormatClass_RGTC1_R,
- FormatClass_RGTC2_RG,
- FormatClass_BPTC_Unorm,
- FormatClass_BPTC_Float,
- FormatClass_S3TC_DXT1_RGB,
- FormatClass_S3TC_DXT1_RGBA,
- FormatClass_S3TC_DXT3_RGBA,
- FormatClass_S3TC_DXT5_RGBA,
- FormatClass_Unique
- };
-#endif
-
- enum CubeMapFace {
- CubeMapPositiveX = 0x8515, // GL_TEXTURE_CUBE_MAP_POSITIVE_X
- CubeMapNegativeX = 0x8516, // GL_TEXTURE_CUBE_MAP_NEGATIVE_X
- CubeMapPositiveY = 0x8517, // GL_TEXTURE_CUBE_MAP_POSITIVE_Y
- CubeMapNegativeY = 0x8518, // GL_TEXTURE_CUBE_MAP_NEGATIVE_Y
- CubeMapPositiveZ = 0x8519, // GL_TEXTURE_CUBE_MAP_POSITIVE_Z
- CubeMapNegativeZ = 0x851A // GL_TEXTURE_CUBE_MAP_NEGATIVE_Z
- };
- Q_ENUM(CubeMapFace)
-
- enum PixelFormat {
- NoSourceFormat = 0, // GL_NONE
- Red = 0x1903, // GL_RED
- RG = 0x8227, // GL_RG
- RGB = 0x1907, // GL_RGB
- BGR = 0x80E0, // GL_BGR
- RGBA = 0x1908, // GL_RGBA
- BGRA = 0x80E1, // GL_BGRA
- Red_Integer = 0x8D94, // GL_RED_INTEGER
- RG_Integer = 0x8228, // GL_RG_INTEGER
- RGB_Integer = 0x8D98, // GL_RGB_INTEGER
- BGR_Integer = 0x8D9A, // GL_BGR_INTEGER
- RGBA_Integer = 0x8D99, // GL_RGBA_INTEGER
- BGRA_Integer = 0x8D9B, // GL_BGRA_INTEGER
- Stencil = 0x1901, // GL_STENCIL_INDEX
- Depth = 0x1902, // GL_DEPTH_COMPONENT
- DepthStencil = 0x84F9, // GL_DEPTH_STENCIL
- Alpha = 0x1906, // GL_ALPHA
- Luminance = 0x1909, // GL_LUMINANCE
- LuminanceAlpha = 0x190A // GL_LUMINANCE_ALPHA
- };
- Q_ENUM(PixelFormat)
-
- enum PixelType {
- NoPixelType = 0, // GL_NONE
- Int8 = 0x1400, // GL_BYTE
- UInt8 = 0x1401, // GL_UNSIGNED_BYTE
- Int16 = 0x1402, // GL_SHORT
- UInt16 = 0x1403, // GL_UNSIGNED_SHORT
- Int32 = 0x1404, // GL_INT
- UInt32 = 0x1405, // GL_UNSIGNED_INT
- Float16 = 0x140B, // GL_HALF_FLOAT
- Float16OES = 0x8D61, // GL_HALF_FLOAT_OES
- Float32 = 0x1406, // GL_FLOAT
- UInt32_RGB9_E5 = 0x8C3E, // GL_UNSIGNED_INT_5_9_9_9_REV
- UInt32_RG11B10F = 0x8C3B, // GL_UNSIGNED_INT_10F_11F_11F_REV
- UInt8_RG3B2 = 0x8032, // GL_UNSIGNED_BYTE_3_3_2
- UInt8_RG3B2_Rev = 0x8362, // GL_UNSIGNED_BYTE_2_3_3_REV
- UInt16_RGB5A1 = 0x8034, // GL_UNSIGNED_SHORT_5_5_5_1
- UInt16_RGB5A1_Rev = 0x8366, // GL_UNSIGNED_SHORT_1_5_5_5_REV
- UInt16_R5G6B5 = 0x8363, // GL_UNSIGNED_SHORT_5_6_5
- UInt16_R5G6B5_Rev = 0x8364, // GL_UNSIGNED_SHORT_5_6_5_REV
- UInt16_RGBA4 = 0x8033, // GL_UNSIGNED_SHORT_4_4_4_4
- UInt16_RGBA4_Rev = 0x8365, // GL_UNSIGNED_SHORT_4_4_4_4_REV
- UInt32_RGBA8 = 0x8035, // GL_UNSIGNED_INT_8_8_8_8
- UInt32_RGBA8_Rev = 0x8367, // GL_UNSIGNED_INT_8_8_8_8_REV
- UInt32_RGB10A2 = 0x8036, // GL_UNSIGNED_INT_10_10_10_2
- UInt32_RGB10A2_Rev = 0x8368, // GL_UNSIGNED_INT_2_10_10_10_REV
- UInt32_D24S8 = 0x84FA, // GL_UNSIGNED_INT_24_8
- Float32_D32_UInt32_S8_X24 = 0x8DAD // GL_FLOAT_32_UNSIGNED_INT_24_8_REV
- };
- Q_ENUM(PixelType)
-
- enum SwizzleComponent {
- SwizzleRed = 0x8E42, // GL_TEXTURE_SWIZZLE_R
- SwizzleGreen = 0x8E43, // GL_TEXTURE_SWIZZLE_G
- SwizzleBlue = 0x8E44, // GL_TEXTURE_SWIZZLE_B
- SwizzleAlpha = 0x8E45 // GL_TEXTURE_SWIZZLE_A
- };
- Q_ENUM(SwizzleComponent)
-
- enum SwizzleValue {
- RedValue = 0x1903, // GL_RED
- GreenValue = 0x1904, // GL_GREEN
- BlueValue = 0x1905, // GL_BLUE
- AlphaValue = 0x1906, // GL_ALPHA
- ZeroValue = 0, // GL_ZERO
- OneValue = 1 // GL_ONE
- };
- Q_ENUM(SwizzleValue)
-
- enum WrapMode {
- Repeat = 0x2901, // GL_REPEAT
- MirroredRepeat = 0x8370, // GL_MIRRORED_REPEAT
- ClampToEdge = 0x812F, // GL_CLAMP_TO_EDGE
- ClampToBorder = 0x812D // GL_CLAMP_TO_BORDER
- };
- Q_ENUM(WrapMode)
-
- enum CoordinateDirection {
- DirectionS = 0x2802, // GL_TEXTURE_WRAP_S
- DirectionT = 0x2803, // GL_TEXTURE_WRAP_T
- DirectionR = 0x8072 // GL_TEXTURE_WRAP_R
- };
- Q_ENUM(CoordinateDirection)
-
- // Features
- enum Feature {
- ImmutableStorage = 0x00000001,
- ImmutableMultisampleStorage = 0x00000002,
- TextureRectangle = 0x00000004,
- TextureArrays = 0x00000008,
- Texture3D = 0x00000010,
- TextureMultisample = 0x00000020,
- TextureBuffer = 0x00000040,
- TextureCubeMapArrays = 0x00000080,
- Swizzle = 0x00000100,
- StencilTexturing = 0x00000200,
- AnisotropicFiltering = 0x00000400,
- NPOTTextures = 0x00000800,
- NPOTTextureRepeat = 0x00001000,
- Texture1D = 0x00002000,
- TextureComparisonOperators = 0x00004000,
- TextureMipMapLevel = 0x00008000,
-#ifndef Q_QDOC
- MaxFeatureFlag = 0x00010000
-#endif
- };
- Q_DECLARE_FLAGS(Features, Feature)
- Q_ENUM(Feature)
-
- explicit QOpenGLTexture(Target target);
- explicit QOpenGLTexture(const QImage& image, MipMapGeneration genMipMaps = GenerateMipMaps);
- ~QOpenGLTexture();
-
- Target target() const;
-
- // Creation and destruction
- bool create();
- void destroy();
- bool isCreated() const;
- GLuint textureId() const;
-
- // Binding and releasing
- void bind();
- void bind(uint unit, TextureUnitReset reset = DontResetTextureUnit);
- void release();
- void release(uint unit, TextureUnitReset reset = DontResetTextureUnit);
-
- bool isBound() const;
- bool isBound(uint unit);
- static GLuint boundTextureId(BindingTarget target);
- static GLuint boundTextureId(uint unit, BindingTarget target);
-
- // Storage allocation
- void setFormat(TextureFormat format);
- TextureFormat format() const;
- void setSize(int width, int height = 1, int depth = 1);
- int width() const;
- int height() const;
- int depth() const;
- void setMipLevels(int levels);
- int mipLevels() const;
- int maximumMipLevels() const;
- void setLayers(int layers);
- int layers() const;
- int faces() const;
- void setSamples(int samples);
- int samples() const;
- void setFixedSamplePositions(bool fixed);
- bool isFixedSamplePositions() const;
- void allocateStorage();
- void allocateStorage(PixelFormat pixelFormat, PixelType pixelType);
- bool isStorageAllocated() const;
-
- QOpenGLTexture *createTextureView(Target target,
- TextureFormat viewFormat,
- int minimumMipmapLevel, int maximumMipmapLevel,
- int minimumLayer, int maximumLayer) const;
- bool isTextureView() const;
-
- // Pixel transfer
- // ### Qt 6: remove the non-const void * overloads
-#if QT_DEPRECATED_SINCE(5, 3)
- QT_DEPRECATED void setData(int mipLevel, int layer, CubeMapFace cubeFace,
- PixelFormat sourceFormat, PixelType sourceType,
- void *data, const QOpenGLPixelTransferOptions * const options = nullptr);
- QT_DEPRECATED void setData(int mipLevel, int layer,
- PixelFormat sourceFormat, PixelType sourceType,
- void *data, const QOpenGLPixelTransferOptions * const options = nullptr);
- QT_DEPRECATED void setData(int mipLevel,
- PixelFormat sourceFormat, PixelType sourceType,
- void *data, const QOpenGLPixelTransferOptions * const options = nullptr);
- QT_DEPRECATED void setData(PixelFormat sourceFormat, PixelType sourceType,
- void *data, const QOpenGLPixelTransferOptions * const options = nullptr);
-#endif // QT_DEPRECATED_SINCE(5, 3)
-
- void setData(int mipLevel, int layer, CubeMapFace cubeFace,
- PixelFormat sourceFormat, PixelType sourceType,
- const void *data, const QOpenGLPixelTransferOptions * const options = nullptr);
- void setData(int mipLevel, int layer, int layerCount, CubeMapFace cubeFace,
- PixelFormat sourceFormat, PixelType sourceType,
- const void *data, const QOpenGLPixelTransferOptions * const options = nullptr);
- void setData(int mipLevel, int layer,
- PixelFormat sourceFormat, PixelType sourceType,
- const void *data, const QOpenGLPixelTransferOptions * const options = nullptr);
- void setData(int mipLevel,
- PixelFormat sourceFormat, PixelType sourceType,
- const void *data, const QOpenGLPixelTransferOptions * const options = nullptr);
- void setData(PixelFormat sourceFormat, PixelType sourceType,
- const void *data, const QOpenGLPixelTransferOptions * const options = nullptr);
-
- void setData(int xOffset, int yOffset, int zOffset,
- int width, int height, int depth,
- PixelFormat sourceFormat, PixelType sourceType,
- const void *data, const QOpenGLPixelTransferOptions * const options = nullptr);
- void setData(int xOffset, int yOffset, int zOffset,
- int width, int height, int depth, int mipLevel,
- PixelFormat sourceFormat, PixelType sourceType,
- const void *data, const QOpenGLPixelTransferOptions * const options = nullptr);
- void setData(int xOffset, int yOffset, int zOffset,
- int width, int height, int depth,
- int mipLevel, int layer,
- PixelFormat sourceFormat, PixelType sourceType,
- const void *data, const QOpenGLPixelTransferOptions * const options = nullptr);
- void setData(int xOffset, int yOffset, int zOffset,
- int width, int height, int depth,
- int mipLevel, int layer,
- CubeMapFace cubeFace,
- PixelFormat sourceFormat, PixelType sourceType,
- const void *data, const QOpenGLPixelTransferOptions * const options = nullptr);
- void setData(int xOffset, int yOffset, int zOffset,
- int width, int height, int depth,
- int mipLevel, int layer,
- CubeMapFace cubeFace, int layerCount,
- PixelFormat sourceFormat, PixelType sourceType,
- const void *data, const QOpenGLPixelTransferOptions * const options = nullptr);
-
- // Compressed data upload
- // ### Qt 6: remove the non-const void * overloads
-#if QT_DEPRECATED_SINCE(5, 3)
- QT_DEPRECATED void setCompressedData(int mipLevel, int layer, CubeMapFace cubeFace,
- int dataSize, void *data,
- const QOpenGLPixelTransferOptions * const options = nullptr);
- QT_DEPRECATED void setCompressedData(int mipLevel, int layer,
- int dataSize, void *data,
- const QOpenGLPixelTransferOptions * const options = nullptr);
- QT_DEPRECATED void setCompressedData(int mipLevel, int dataSize, void *data,
- const QOpenGLPixelTransferOptions * const options = nullptr);
- QT_DEPRECATED void setCompressedData(int dataSize, void *data,
- const QOpenGLPixelTransferOptions * const options = nullptr);
-#endif // QT_DEPRECATED_SINCE(5, 3)
-
- void setCompressedData(int mipLevel, int layer, CubeMapFace cubeFace,
- int dataSize, const void *data,
- const QOpenGLPixelTransferOptions * const options = nullptr);
- void setCompressedData(int mipLevel, int layer, int layerCount, CubeMapFace cubeFace,
- int dataSize, const void *data,
- const QOpenGLPixelTransferOptions * const options = nullptr);
- void setCompressedData(int mipLevel, int layer,
- int dataSize, const void *data,
- const QOpenGLPixelTransferOptions * const options = nullptr);
- void setCompressedData(int mipLevel, int dataSize, const void *data,
- const QOpenGLPixelTransferOptions * const options = nullptr);
- void setCompressedData(int dataSize, const void *data,
- const QOpenGLPixelTransferOptions * const options = nullptr);
-
- // Helpful overloads for setData
- void setData(const QImage& image, MipMapGeneration genMipMaps = GenerateMipMaps);
-
- static bool hasFeature(Feature feature);
-
- // Texture Parameters
- void setMipBaseLevel(int baseLevel);
- int mipBaseLevel() const;
- void setMipMaxLevel(int maxLevel);
- int mipMaxLevel() const;
- void setMipLevelRange(int baseLevel, int maxLevel);
- QPair<int, int> mipLevelRange() const;
-
- void setAutoMipMapGenerationEnabled(bool enabled);
- bool isAutoMipMapGenerationEnabled() const;
-
- void generateMipMaps();
- void generateMipMaps(int baseLevel, bool resetBaseLevel = true);
-
- void setSwizzleMask(SwizzleComponent component, SwizzleValue value);
- void setSwizzleMask(SwizzleValue r, SwizzleValue g,
- SwizzleValue b, SwizzleValue a);
- SwizzleValue swizzleMask(SwizzleComponent component) const;
-
- enum DepthStencilMode {
- DepthMode = 0x1902, // GL_DEPTH_COMPONENT
- StencilMode = 0x1901 // GL_STENCIL_INDEX
- };
- Q_ENUM(DepthStencilMode)
-
- void setDepthStencilMode(DepthStencilMode mode);
- DepthStencilMode depthStencilMode() const;
-
- enum ComparisonFunction {
- CompareLessEqual = 0x0203, // GL_LEQUAL
- CompareGreaterEqual = 0x0206, // GL_GEQUAL
- CompareLess = 0x0201, // GL_LESS
- CompareGreater = 0x0204, // GL_GREATER
- CompareEqual = 0x0202, // GL_EQUAL
- CommpareNotEqual = 0x0205, // GL_NOTEQUAL
- CompareAlways = 0x0207, // GL_ALWAYS
- CompareNever = 0x0200 // GL_NEVER
- };
- Q_ENUM(ComparisonFunction)
-
- void setComparisonFunction(ComparisonFunction function);
- ComparisonFunction comparisonFunction() const;
-
- enum ComparisonMode {
- CompareRefToTexture = 0x884E, // GL_COMPARE_REF_TO_TEXTURE
- CompareNone = 0x0000 // GL_NONE
- };
-
- void setComparisonMode(ComparisonMode mode);
- ComparisonMode comparisonMode() const;
-
- // Sampling Parameters
- enum Filter {
- Nearest = 0x2600, // GL_NEAREST
- Linear = 0x2601, // GL_LINEAR
- NearestMipMapNearest = 0x2700, // GL_NEAREST_MIPMAP_NEAREST
- NearestMipMapLinear = 0x2702, // GL_NEAREST_MIPMAP_LINEAR
- LinearMipMapNearest = 0x2701, // GL_LINEAR_MIPMAP_NEAREST
- LinearMipMapLinear = 0x2703 // GL_LINEAR_MIPMAP_LINEAR
- };
- Q_ENUM(Filter)
-
- void setMinificationFilter(Filter filter);
- Filter minificationFilter() const;
- void setMagnificationFilter(Filter filter);
- Filter magnificationFilter() const;
- void setMinMagFilters(Filter minificationFilter,
- Filter magnificationFilter);
- QPair<Filter, Filter> minMagFilters() const;
- void setMaximumAnisotropy(float anisotropy);
- float maximumAnisotropy() const;
-
- void setWrapMode(WrapMode mode);
- void setWrapMode(CoordinateDirection direction, WrapMode mode);
- WrapMode wrapMode(CoordinateDirection direction) const;
-
- void setBorderColor(const QColor &color);
- void setBorderColor(float r, float g, float b, float a);
- void setBorderColor(int r, int g, int b, int a);
- void setBorderColor(uint r, uint g, uint b, uint a);
-
- QColor borderColor() const;
- void borderColor(float *border) const;
- void borderColor(int *border) const;
- void borderColor(unsigned int *border) const;
-
- void setMinimumLevelOfDetail(float value);
- float minimumLevelOfDetail() const;
- void setMaximumLevelOfDetail(float value);
- float maximumLevelOfDetail() const;
- void setLevelOfDetailRange(float min, float max);
- QPair<float, float> levelOfDetailRange() const;
- void setLevelofDetailBias(float bias);
- float levelofDetailBias() const;
-
-#ifndef QT_NO_DEBUG_STREAM
- friend Q_GUI_EXPORT QDebug operator<<(QDebug dbg, const QOpenGLTexture *t);
-#endif
-
-private:
- Q_DISABLE_COPY(QOpenGLTexture)
- Q_DECLARE_PRIVATE(QOpenGLTexture)
- QScopedPointer<QOpenGLTexturePrivate> d_ptr;
-};
-
-Q_DECLARE_OPERATORS_FOR_FLAGS(QOpenGLTexture::Features)
-
-#ifndef QT_NO_DEBUG_STREAM
-Q_GUI_EXPORT QDebug operator<<(QDebug debug, const QOpenGLTexture *t);
-#endif
-
-QT_END_NAMESPACE
-
-#endif // QT_NO_OPENGL
-
-#endif // QOPENGLABSTRACTTEXTURE_H
diff --git a/src/gui/opengl/qopengltexture_p.h b/src/gui/opengl/qopengltexture_p.h
deleted file mode 100644
index 9f3457ad0a..0000000000
--- a/src/gui/opengl/qopengltexture_p.h
+++ /dev/null
@@ -1,184 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2013 Klaralvdalens Datakonsult AB (KDAB).
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the QtGui module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef QABSTRACTOPENGLTEXTURE_P_H
-#define QABSTRACTOPENGLTEXTURE_P_H
-
-//
-// W A R N I N G
-// -------------
-//
-// This file is not part of the Qt API. It exists purely as an
-// implementation detail. This header file may change from version to
-// version without notice, or even be removed.
-//
-// We mean it.
-//
-
-#ifndef QT_NO_OPENGL
-
-#include <QtGui/private/qtguiglobal_p.h>
-#include "private/qobject_p.h"
-#include "qopengltexture.h"
-#include "qopengl.h"
-
-#include <cmath>
-
-namespace {
-inline double qLog2(const double x)
-{
- return std::log(x) / std::log(2.0);
-}
-}
-
-QT_BEGIN_NAMESPACE
-
-class QOpenGLContext;
-class QOpenGLTextureHelper;
-class QOpenGLFunctions;
-
-class QOpenGLTexturePrivate
-{
-public:
- QOpenGLTexturePrivate(QOpenGLTexture::Target textureTarget,
- QOpenGLTexture *qq);
- ~QOpenGLTexturePrivate();
-
- Q_DECLARE_PUBLIC(QOpenGLTexture)
-
- void resetFuncs(QOpenGLTextureHelper *funcs);
- void initializeOpenGLFunctions();
-
- bool create();
- void destroy();
-
- void bind();
- void bind(uint unit, QOpenGLTexture::TextureUnitReset reset = QOpenGLTexture::DontResetTextureUnit);
- void release();
- void release(uint unit, QOpenGLTexture::TextureUnitReset reset = QOpenGLTexture::DontResetTextureUnit);
- bool isBound() const;
- bool isBound(uint unit) const;
-
- void allocateStorage(QOpenGLTexture::PixelFormat pixelFormat, QOpenGLTexture::PixelType pixelType);
- void allocateMutableStorage(QOpenGLTexture::PixelFormat pixelFormat, QOpenGLTexture::PixelType pixelType);
- void allocateImmutableStorage();
- void setData(int mipLevel, int layer, int layerCount, QOpenGLTexture::CubeMapFace cubeFace,
- QOpenGLTexture::PixelFormat sourceFormat, QOpenGLTexture::PixelType sourceType,
- const void *data, const QOpenGLPixelTransferOptions * const options);
- void setData(int xOffset, int yOffset, int zOffset, int width, int height, int depth,
- int mipLevel, int layer, int layerCount, QOpenGLTexture::CubeMapFace cubeFace,
- QOpenGLTexture::PixelFormat sourceFormat, QOpenGLTexture::PixelType sourceType,
- const void *data, const QOpenGLPixelTransferOptions * const options);
- void setCompressedData(int mipLevel, int layer, int layerCount, QOpenGLTexture::CubeMapFace cubeFace,
- int dataSize, const void *data,
- const QOpenGLPixelTransferOptions * const options);
-
-
- void setWrapMode(QOpenGLTexture::WrapMode mode);
- void setWrapMode(QOpenGLTexture::CoordinateDirection direction, QOpenGLTexture::WrapMode mode);
- QOpenGLTexture::WrapMode wrapMode(QOpenGLTexture::CoordinateDirection direction) const;
-
- QOpenGLTexture *createTextureView(QOpenGLTexture::Target target, QOpenGLTexture::TextureFormat viewFormat,
- int minimumMipmapLevel, int maximumMipmapLevel,
- int minimumLayer, int maximumLayer) const;
-
- int evaluateMipLevels() const;
-
- inline int maximumMipLevelCount() const
- {
- return 1 + std::floor(qLog2(qMax(dimensions[0], qMax(dimensions[1], dimensions[2]))));
- }
-
- static inline int mipLevelSize(int mipLevel, int baseLevelSize)
- {
- return std::floor(double(qMax(1, baseLevelSize >> mipLevel)));
- }
-
- bool isUsingImmutableStorage() const;
-
- QOpenGLTexture *q_ptr;
- QOpenGLContext *context;
- QOpenGLTexture::Target target;
- QOpenGLTexture::BindingTarget bindingTarget;
- GLuint textureId;
- QOpenGLTexture::TextureFormat format;
- QOpenGLTexture::TextureFormatClass formatClass;
- int dimensions[3];
- int requestedMipLevels;
- int mipLevels;
- int layers;
- int faces;
-
- int samples;
- bool fixedSamplePositions;
-
- int baseLevel;
- int maxLevel;
-
- QOpenGLTexture::SwizzleValue swizzleMask[4];
- QOpenGLTexture::DepthStencilMode depthStencilMode;
- QOpenGLTexture::ComparisonFunction comparisonFunction;
- QOpenGLTexture::ComparisonMode comparisonMode;
-
- QOpenGLTexture::Filter minFilter;
- QOpenGLTexture::Filter magFilter;
- float maxAnisotropy;
- QOpenGLTexture::WrapMode wrapModes[3];
- QVariantList borderColor;
- float minLevelOfDetail;
- float maxLevelOfDetail;
- float levelOfDetailBias;
-
- bool textureView;
- bool autoGenerateMipMaps;
- bool storageAllocated;
-
- QOpenGLTextureHelper *texFuncs;
- QOpenGLFunctions *functions;
-
- QOpenGLTexture::Features features;
-};
-
-QT_END_NAMESPACE
-
-#undef Q_CALL_MEMBER_FUNCTION
-
-#endif // QT_NO_OPENGL
-
-#endif // QABSTRACTOPENGLTEXTURE_P_H
diff --git a/src/gui/opengl/qopengltextureblitter.cpp b/src/gui/opengl/qopengltextureblitter.cpp
deleted file mode 100644
index b709f2f639..0000000000
--- a/src/gui/opengl/qopengltextureblitter.cpp
+++ /dev/null
@@ -1,682 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the QtGui module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "qopengltextureblitter.h"
-
-#include <QtGui/QOpenGLBuffer>
-#include <QtGui/QOpenGLShaderProgram>
-#include <QtGui/QOpenGLVertexArrayObject>
-#include <QtGui/QOpenGLContext>
-#include <QtGui/QOpenGLFunctions>
-
-#ifndef GL_TEXTURE_EXTERNAL_OES
-#define GL_TEXTURE_EXTERNAL_OES 0x8D65
-#endif
-
-QT_BEGIN_NAMESPACE
-
-/*!
- \class QOpenGLTextureBlitter
- \brief The QOpenGLTextureBlitter class provides a convenient way to draw textured quads via OpenGL.
- \since 5.8
- \ingroup painting-3D
- \inmodule QtGui
-
- Drawing textured quads, in order to get the contents of a texture
- onto the screen, is a common operation when developing 2D user
- interfaces. QOpenGLTextureBlitter provides a convenience class to
- avoid repeating vertex data, shader sources, buffer and program
- management and matrix calculations.
-
- For example, a QOpenGLWidget subclass can do the following to draw
- the contents rendered into a framebuffer at the pixel position \c{(x, y)}:
-
- \code
- void OpenGLWidget::initializeGL()
- {
- m_blitter.create();
- m_fbo = new QOpenGLFramebufferObject(size);
- }
-
- void OpenGLWidget::paintGL()
- {
- m_fbo->bind();
- // update offscreen content
- m_fbo->release();
-
- m_blitter.bind();
- const QRect targetRect(QPoint(x, y), m_fbo->size());
- const QMatrix4x4 target = QOpenGLTextureBlitter::targetTransform(targetRect, QRect(QPoint(0, 0), m_fbo->size()));
- m_blitter.blit(m_fbo->texture(), target, QOpenGLTextureBlitter::OriginBottomLeft);
- m_blitter.release();
- }
- \endcode
-
- The blitter implements GLSL shaders both for GLSL 1.00 (suitable
- for OpenGL (ES) 2.x and compatibility profiles of newer OpenGL
- versions) and version 150 (suitable for core profile contexts with
- OpenGL 3.2 and newer).
- */
-
-static const char vertex_shader150[] =
- "#version 150 core\n"
- "in vec3 vertexCoord;"
- "in vec2 textureCoord;"
- "out vec2 uv;"
- "uniform mat4 vertexTransform;"
- "uniform mat3 textureTransform;"
- "void main() {"
- " uv = (textureTransform * vec3(textureCoord,1.0)).xy;"
- " gl_Position = vertexTransform * vec4(vertexCoord,1.0);"
- "}";
-
-static const char fragment_shader150[] =
- "#version 150 core\n"
- "in vec2 uv;"
- "out vec4 fragcolor;"
- "uniform sampler2D textureSampler;"
- "uniform bool swizzle;"
- "uniform float opacity;"
- "void main() {"
- " vec4 tmpFragColor = texture(textureSampler, uv);"
- " tmpFragColor.a *= opacity;"
- " fragcolor = swizzle ? tmpFragColor.bgra : tmpFragColor;"
- "}";
-
-static const char vertex_shader[] =
- "attribute highp vec3 vertexCoord;"
- "attribute highp vec2 textureCoord;"
- "varying highp vec2 uv;"
- "uniform highp mat4 vertexTransform;"
- "uniform highp mat3 textureTransform;"
- "void main() {"
- " uv = (textureTransform * vec3(textureCoord,1.0)).xy;"
- " gl_Position = vertexTransform * vec4(vertexCoord,1.0);"
- "}";
-
-static const char fragment_shader[] =
- "varying highp vec2 uv;"
- "uniform sampler2D textureSampler;"
- "uniform bool swizzle;"
- "uniform highp float opacity;"
- "void main() {"
- " highp vec4 tmpFragColor = texture2D(textureSampler,uv);"
- " tmpFragColor.a *= opacity;"
- " gl_FragColor = swizzle ? tmpFragColor.bgra : tmpFragColor;"
- "}";
-
-static const char fragment_shader_external_oes[] =
- "#extension GL_OES_EGL_image_external : require\n"
- "varying highp vec2 uv;"
- "uniform samplerExternalOES textureSampler;\n"
- "uniform bool swizzle;"
- "uniform highp float opacity;"
- "void main() {"
- " highp vec4 tmpFragColor = texture2D(textureSampler, uv);"
- " tmpFragColor.a *= opacity;"
- " gl_FragColor = swizzle ? tmpFragColor.bgra : tmpFragColor;"
- "}";
-
-static const GLfloat vertex_buffer_data[] = {
- -1,-1, 0,
- -1, 1, 0,
- 1,-1, 0,
- -1, 1, 0,
- 1,-1, 0,
- 1, 1, 0
-};
-
-static const GLfloat texture_buffer_data[] = {
- 0, 0,
- 0, 1,
- 1, 0,
- 0, 1,
- 1, 0,
- 1, 1
-};
-
-class TextureBinder
-{
-public:
- TextureBinder(GLenum target, GLuint textureId) : m_target(target)
- {
- QOpenGLContext::currentContext()->functions()->glBindTexture(m_target, textureId);
- }
- ~TextureBinder()
- {
- QOpenGLContext::currentContext()->functions()->glBindTexture(m_target, 0);
- }
-
-private:
- GLenum m_target;
-};
-
-class QOpenGLTextureBlitterPrivate
-{
-public:
- enum TextureMatrixUniform {
- User,
- Identity,
- IdentityFlipped
- };
-
- enum ProgramIndex {
- TEXTURE_2D,
- TEXTURE_EXTERNAL_OES
- };
-
- QOpenGLTextureBlitterPrivate() :
- swizzle(false),
- opacity(1.0f),
- vao(new QOpenGLVertexArrayObject),
- currentTarget(TEXTURE_2D)
- { }
-
- bool buildProgram(ProgramIndex idx, const char *vs, const char *fs);
-
- void blit(GLuint texture, const QMatrix4x4 &vertexTransform, const QMatrix3x3 &textureTransform);
- void blit(GLuint texture, const QMatrix4x4 &vertexTransform, QOpenGLTextureBlitter::Origin origin);
-
- void prepareProgram(const QMatrix4x4 &vertexTransform);
-
- QOpenGLBuffer vertexBuffer;
- QOpenGLBuffer textureBuffer;
- struct Program {
- Program() :
- vertexCoordAttribPos(0),
- vertexTransformUniformPos(0),
- textureCoordAttribPos(0),
- textureTransformUniformPos(0),
- swizzleUniformPos(0),
- opacityUniformPos(0),
- swizzle(false),
- opacity(0.0f),
- textureMatrixUniformState(User)
- { }
- QScopedPointer<QOpenGLShaderProgram> glProgram;
- GLuint vertexCoordAttribPos;
- GLuint vertexTransformUniformPos;
- GLuint textureCoordAttribPos;
- GLuint textureTransformUniformPos;
- GLuint swizzleUniformPos;
- GLuint opacityUniformPos;
- bool swizzle;
- float opacity;
- TextureMatrixUniform textureMatrixUniformState;
- } programs[2];
- bool swizzle;
- float opacity;
- QScopedPointer<QOpenGLVertexArrayObject> vao;
- GLenum currentTarget;
-};
-
-static inline QOpenGLTextureBlitterPrivate::ProgramIndex targetToProgramIndex(GLenum target)
-{
- switch (target) {
- case GL_TEXTURE_2D:
- return QOpenGLTextureBlitterPrivate::TEXTURE_2D;
- case GL_TEXTURE_EXTERNAL_OES:
- return QOpenGLTextureBlitterPrivate::TEXTURE_EXTERNAL_OES;
- default:
- qWarning("Unsupported texture target 0x%x", target);
- return QOpenGLTextureBlitterPrivate::TEXTURE_2D;
- }
-}
-
-void QOpenGLTextureBlitterPrivate::prepareProgram(const QMatrix4x4 &vertexTransform)
-{
- Program *program = &programs[targetToProgramIndex(currentTarget)];
-
- vertexBuffer.bind();
- program->glProgram->setAttributeBuffer(program->vertexCoordAttribPos, GL_FLOAT, 0, 3, 0);
- program->glProgram->enableAttributeArray(program->vertexCoordAttribPos);
- vertexBuffer.release();
-
- program->glProgram->setUniformValue(program->vertexTransformUniformPos, vertexTransform);
-
- textureBuffer.bind();
- program->glProgram->setAttributeBuffer(program->textureCoordAttribPos, GL_FLOAT, 0, 2, 0);
- program->glProgram->enableAttributeArray(program->textureCoordAttribPos);
- textureBuffer.release();
-
- if (swizzle != program->swizzle) {
- program->glProgram->setUniformValue(program->swizzleUniformPos, swizzle);
- program->swizzle = swizzle;
- }
-
- if (opacity != program->opacity) {
- program->glProgram->setUniformValue(program->opacityUniformPos, opacity);
- program->opacity = opacity;
- }
-}
-
-void QOpenGLTextureBlitterPrivate::blit(GLuint texture,
- const QMatrix4x4 &vertexTransform,
- const QMatrix3x3 &textureTransform)
-{
- TextureBinder binder(currentTarget, texture);
- prepareProgram(vertexTransform);
-
- Program *program = &programs[targetToProgramIndex(currentTarget)];
- program->glProgram->setUniformValue(program->textureTransformUniformPos, textureTransform);
- program->textureMatrixUniformState = User;
-
- QOpenGLContext::currentContext()->functions()->glDrawArrays(GL_TRIANGLES, 0, 6);
-}
-
-void QOpenGLTextureBlitterPrivate::blit(GLuint texture,
- const QMatrix4x4 &vertexTransform,
- QOpenGLTextureBlitter::Origin origin)
-{
- TextureBinder binder(currentTarget, texture);
- prepareProgram(vertexTransform);
-
- Program *program = &programs[targetToProgramIndex(currentTarget)];
- if (origin == QOpenGLTextureBlitter::OriginTopLeft) {
- if (program->textureMatrixUniformState != IdentityFlipped) {
- QMatrix3x3 flipped;
- flipped(1,1) = -1;
- flipped(1,2) = 1;
- program->glProgram->setUniformValue(program->textureTransformUniformPos, flipped);
- program->textureMatrixUniformState = IdentityFlipped;
- }
- } else if (program->textureMatrixUniformState != Identity) {
- program->glProgram->setUniformValue(program->textureTransformUniformPos, QMatrix3x3());
- program->textureMatrixUniformState = Identity;
- }
-
- QOpenGLContext::currentContext()->functions()->glDrawArrays(GL_TRIANGLES, 0, 6);
-}
-
-bool QOpenGLTextureBlitterPrivate::buildProgram(ProgramIndex idx, const char *vs, const char *fs)
-{
- Program *p = &programs[idx];
-
- p->glProgram.reset(new QOpenGLShaderProgram);
-
- p->glProgram->addCacheableShaderFromSourceCode(QOpenGLShader::Vertex, vs);
- p->glProgram->addCacheableShaderFromSourceCode(QOpenGLShader::Fragment, fs);
- p->glProgram->link();
- if (!p->glProgram->isLinked()) {
- qWarning() << "Could not link shader program:\n" << p->glProgram->log();
- return false;
- }
-
- p->glProgram->bind();
-
- p->vertexCoordAttribPos = p->glProgram->attributeLocation("vertexCoord");
- p->vertexTransformUniformPos = p->glProgram->uniformLocation("vertexTransform");
- p->textureCoordAttribPos = p->glProgram->attributeLocation("textureCoord");
- p->textureTransformUniformPos = p->glProgram->uniformLocation("textureTransform");
- p->swizzleUniformPos = p->glProgram->uniformLocation("swizzle");
- p->opacityUniformPos = p->glProgram->uniformLocation("opacity");
-
- p->glProgram->setUniformValue(p->swizzleUniformPos, false);
-
- // minmize state left set after a create()
- p->glProgram->release();
-
- return true;
-}
-
-/*!
- Constructs a new QOpenGLTextureBlitter instance.
-
- \note no graphics resources are initialized in the
- constructor. This makes it safe to place plain
- QOpenGLTextureBlitter members into classes because the actual
- initialization that depends on the OpenGL context happens only in
- create().
- */
-QOpenGLTextureBlitter::QOpenGLTextureBlitter()
- : d_ptr(new QOpenGLTextureBlitterPrivate)
-{
-}
-
-/*!
- Destructs the instance.
-
- \note When the OpenGL context - or a context sharing resources
- with it - that was current when calling create() is not current,
- graphics resources will not be released. Therefore, it is
- recommended to call destroy() manually instead of relying on the
- destructor to perform OpenGL resource cleanup.
- */
-QOpenGLTextureBlitter::~QOpenGLTextureBlitter()
-{
- destroy();
-}
-
-/*!
- Initializes the graphics resources used by the blitter.
-
- \return \c true if successful, \c false if there was a
- failure. Failures can occur when there is no OpenGL context
- current on the current thread, or when shader compilation fails
- for some reason.
-
- \sa isCreated(), destroy()
- */
-bool QOpenGLTextureBlitter::create()
-{
- QOpenGLContext *currentContext = QOpenGLContext::currentContext();
- if (!currentContext)
- return false;
-
- Q_D(QOpenGLTextureBlitter);
-
- if (d->programs[QOpenGLTextureBlitterPrivate::TEXTURE_2D].glProgram)
- return true;
-
- QSurfaceFormat format = currentContext->format();
- if (format.profile() == QSurfaceFormat::CoreProfile && format.version() >= qMakePair(3,2)) {
- if (!d->buildProgram(QOpenGLTextureBlitterPrivate::TEXTURE_2D, vertex_shader150, fragment_shader150))
- return false;
- } else {
- if (!d->buildProgram(QOpenGLTextureBlitterPrivate::TEXTURE_2D, vertex_shader, fragment_shader))
- return false;
- if (supportsExternalOESTarget())
- if (!d->buildProgram(QOpenGLTextureBlitterPrivate::TEXTURE_EXTERNAL_OES, vertex_shader, fragment_shader_external_oes))
- return false;
- }
-
- // Create and bind the VAO, if supported.
- QOpenGLVertexArrayObject::Binder vaoBinder(d->vao.data());
-
- d->vertexBuffer.create();
- d->vertexBuffer.bind();
- d->vertexBuffer.allocate(vertex_buffer_data, sizeof(vertex_buffer_data));
- d->vertexBuffer.release();
-
- d->textureBuffer.create();
- d->textureBuffer.bind();
- d->textureBuffer.allocate(texture_buffer_data, sizeof(texture_buffer_data));
- d->textureBuffer.release();
-
- return true;
-}
-
-/*!
- \return \c true if create() was called and succeeded. \c false otherwise.
-
- \sa create(), destroy()
- */
-bool QOpenGLTextureBlitter::isCreated() const
-{
- Q_D(const QOpenGLTextureBlitter);
- return d->programs[QOpenGLTextureBlitterPrivate::TEXTURE_2D].glProgram;
-}
-
-/*!
- Frees all graphics resources held by the blitter. Assumes that
- the OpenGL context, or another context sharing resources with it,
- that was current on the thread when invoking create() is current.
-
- The function has no effect when the blitter is not in created state.
-
- \sa create()
- */
-void QOpenGLTextureBlitter::destroy()
-{
- if (!isCreated())
- return;
- Q_D(QOpenGLTextureBlitter);
- d->programs[QOpenGLTextureBlitterPrivate::TEXTURE_2D].glProgram.reset();
- d->programs[QOpenGLTextureBlitterPrivate::TEXTURE_EXTERNAL_OES].glProgram.reset();
- d->vertexBuffer.destroy();
- d->textureBuffer.destroy();
- d->vao.reset();
-}
-
-/*!
- \return \c true when bind() accepts \c GL_TEXTURE_EXTERNAL_OES as
- its target argument.
-
- \sa bind(), blit()
- */
-bool QOpenGLTextureBlitter::supportsExternalOESTarget() const
-{
- QOpenGLContext *ctx = QOpenGLContext::currentContext();
- return ctx && ctx->isOpenGLES() && ctx->hasExtension("GL_OES_EGL_image_external");
-}
-
-/*!
- Binds the graphics resources used by the blitter. This must be
- called before calling blit(). Code modifying the OpenGL state
- should be avoided between the call to bind() and blit() because
- otherwise conflicts may arise.
-
- \a target is the texture target for the source texture and must be
- either \c GL_TEXTURE_2D or \c GL_OES_EGL_image_external.
-
- \sa release(), blit()
- */
-void QOpenGLTextureBlitter::bind(GLenum target)
-{
- Q_D(QOpenGLTextureBlitter);
-
- if (d->vao->isCreated())
- d->vao->bind();
-
- d->currentTarget = target;
- QOpenGLTextureBlitterPrivate::Program *p = &d->programs[targetToProgramIndex(target)];
- p->glProgram->bind();
-
- d->vertexBuffer.bind();
- p->glProgram->setAttributeBuffer(p->vertexCoordAttribPos, GL_FLOAT, 0, 3, 0);
- p->glProgram->enableAttributeArray(p->vertexCoordAttribPos);
- d->vertexBuffer.release();
-
- d->textureBuffer.bind();
- p->glProgram->setAttributeBuffer(p->textureCoordAttribPos, GL_FLOAT, 0, 2, 0);
- p->glProgram->enableAttributeArray(p->textureCoordAttribPos);
- d->textureBuffer.release();
-}
-
-/*!
- Unbinds the graphics resources used by the blitter.
-
- \sa bind()
- */
-void QOpenGLTextureBlitter::release()
-{
- Q_D(QOpenGLTextureBlitter);
- d->programs[targetToProgramIndex(d->currentTarget)].glProgram->release();
- if (d->vao->isCreated())
- d->vao->release();
-}
-
-/*!
- Sets whether swizzling is enabled for the red and blue color channels to
- \a swizzle. An BGRA to RGBA conversion (occurring in the shader on
- the GPU, instead of a slow CPU-side transformation) can be useful
- when the source texture contains data from a QImage with a format
- like QImage::Format_ARGB32 which maps to BGRA on little endian
- systems.
-
- By default the red-blue swizzle is disabled since this is what a
- texture attached to an framebuffer object or a texture based on a
- byte ordered QImage format (like QImage::Format_RGBA8888) needs.
- */
-void QOpenGLTextureBlitter::setRedBlueSwizzle(bool swizzle)
-{
- Q_D(QOpenGLTextureBlitter);
- d->swizzle = swizzle;
-}
-
-/*!
- Changes the opacity to \a opacity. The default opacity is 1.0.
-
- \note the blitter does not alter the blend state. It is up to the
- caller of blit() to ensure the correct blend settings are active.
-
- */
-void QOpenGLTextureBlitter::setOpacity(float opacity)
-{
- Q_D(QOpenGLTextureBlitter);
- d->opacity = opacity;
-}
-
-/*!
- \enum QOpenGLTextureBlitter::Origin
-
- \value OriginBottomLeft Indicates that the data in the texture
- follows the OpenGL convention of coordinate systems, meaning Y is
- running from bottom to top.
-
- \value OriginTopLeft Indicates that the data in the texture has Y
- running from top to bottom, which is typical with regular,
- unflipped image data.
-
- \sa blit()
- */
-
-/*!
- Performs the blit with the source texture \a texture.
-
- \a targetTransform specifies the transformation applied. This is
- usually generated by the targetTransform() helper function.
-
- \a sourceOrigin specifies if the image data needs flipping. When
- \a texture corresponds to a texture attached to an FBO pass
- OriginBottomLeft. On the other hand, when \a texture is based on
- unflipped image data, pass OriginTopLeft. This is more efficient
- than using QImage::mirrored().
-
- \sa targetTransform(), Origin, bind()
- */
-void QOpenGLTextureBlitter::blit(GLuint texture,
- const QMatrix4x4 &targetTransform,
- Origin sourceOrigin)
-{
- Q_D(QOpenGLTextureBlitter);
- d->blit(texture,targetTransform, sourceOrigin);
-}
-
-/*!
- Performs the blit with the source texture \a texture.
-
- \a targetTransform specifies the transformation applied. This is
- usually generated by the targetTransform() helper function.
-
- \a sourceTransform specifies the transformation applied to the
- source. This allows using only a sub-rect of the source
- texture. This is usually generated by the sourceTransform() helper
- function.
-
- \sa sourceTransform(), targetTransform(), Origin, bind()
- */
-void QOpenGLTextureBlitter::blit(GLuint texture,
- const QMatrix4x4 &targetTransform,
- const QMatrix3x3 &sourceTransform)
-{
- Q_D(QOpenGLTextureBlitter);
- d->blit(texture, targetTransform, sourceTransform);
-}
-
-/*!
- Calculates a target transform suitable for blit().
-
- \a target is the target rectangle in pixels. \a viewport describes
- the source dimensions and will in most cases be set to (0, 0,
- image width, image height).
-
- For unscaled output the size of \a target and \a viewport should
- match.
-
- \sa blit()
- */
-QMatrix4x4 QOpenGLTextureBlitter::targetTransform(const QRectF &target,
- const QRect &viewport)
-{
- qreal x_scale = target.width() / viewport.width();
- qreal y_scale = target.height() / viewport.height();
-
- const QPointF relative_to_viewport = target.topLeft() - viewport.topLeft();
- qreal x_translate = x_scale - 1 + ((relative_to_viewport.x() / viewport.width()) * 2);
- qreal y_translate = -y_scale + 1 - ((relative_to_viewport.y() / viewport.height()) * 2);
-
- QMatrix4x4 matrix;
- matrix(0,3) = x_translate;
- matrix(1,3) = y_translate;
-
- matrix(0,0) = x_scale;
- matrix(1,1) = y_scale;
-
- return matrix;
-}
-
-/*!
- Calculates a 3x3 matrix suitable as the input to blit(). This is
- used when only a part of the texture is to be used in the blit.
-
- \a subTexture is the desired source rectangle in pixels, \a
- textureSize is the full width and height of the texture data. \a
- origin specifies the orientation of the image data when it comes
- to the Y axis.
-
- \sa blit(), Origin
- */
-QMatrix3x3 QOpenGLTextureBlitter::sourceTransform(const QRectF &subTexture,
- const QSize &textureSize,
- Origin origin)
-{
- qreal x_scale = subTexture.width() / textureSize.width();
- qreal y_scale = subTexture.height() / textureSize.height();
-
- const QPointF topLeft = subTexture.topLeft();
- qreal x_translate = topLeft.x() / textureSize.width();
- qreal y_translate = topLeft.y() / textureSize.height();
-
- if (origin == OriginTopLeft) {
- y_scale = -y_scale;
- y_translate = 1 - y_translate;
- }
-
- QMatrix3x3 matrix;
- matrix(0,2) = x_translate;
- matrix(1,2) = y_translate;
-
- matrix(0,0) = x_scale;
- matrix(1,1) = y_scale;
-
- return matrix;
-}
-
-QT_END_NAMESPACE
diff --git a/src/gui/opengl/qopengltextureblitter.h b/src/gui/opengl/qopengltextureblitter.h
deleted file mode 100644
index 2f7c6b1a0a..0000000000
--- a/src/gui/opengl/qopengltextureblitter.h
+++ /dev/null
@@ -1,94 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the QtGui module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef QOPENGLTEXTUREBLITTER_H
-#define QOPENGLTEXTUREBLITTER_H
-
-#include <QtGui/qtguiglobal.h>
-
-#ifndef QT_NO_OPENGL
-
-#include <QtGui/qopengl.h>
-#include <QtGui/QMatrix3x3>
-#include <QtGui/QMatrix4x4>
-
-QT_BEGIN_NAMESPACE
-
-class QOpenGLTextureBlitterPrivate;
-
-class Q_GUI_EXPORT QOpenGLTextureBlitter
-{
-public:
- QOpenGLTextureBlitter();
- ~QOpenGLTextureBlitter();
-
- enum Origin {
- OriginBottomLeft,
- OriginTopLeft
- };
-
- bool create();
- bool isCreated() const;
- void destroy();
-
- bool supportsExternalOESTarget() const;
-
- void bind(GLenum target = GL_TEXTURE_2D);
- void release();
-
- void setRedBlueSwizzle(bool swizzle);
- void setOpacity(float opacity);
-
- void blit(GLuint texture, const QMatrix4x4 &targetTransform, Origin sourceOrigin);
- void blit(GLuint texture, const QMatrix4x4 &targetTransform, const QMatrix3x3 &sourceTransform);
-
- static QMatrix4x4 targetTransform(const QRectF &target, const QRect &viewport);
- static QMatrix3x3 sourceTransform(const QRectF &subTexture, const QSize &textureSize, Origin origin);
-
-private:
- Q_DISABLE_COPY(QOpenGLTextureBlitter)
- Q_DECLARE_PRIVATE(QOpenGLTextureBlitter)
- QScopedPointer<QOpenGLTextureBlitterPrivate> d_ptr;
-};
-
-QT_END_NAMESPACE
-
-#endif
-
-#endif //QOPENGLTEXTUREBLITTER_H
diff --git a/src/gui/opengl/qopengltexturecache.cpp b/src/gui/opengl/qopengltexturecache.cpp
deleted file mode 100644
index ef07dbe109..0000000000
--- a/src/gui/opengl/qopengltexturecache.cpp
+++ /dev/null
@@ -1,198 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the QtGui module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "qopengltexturecache_p.h"
-#include "qopengltextureuploader_p.h"
-#include <qmath.h>
-#include <qopenglfunctions.h>
-#include <private/qimagepixmapcleanuphooks_p.h>
-#include <qpa/qplatformpixmap.h>
-
-QT_BEGIN_NAMESPACE
-
-class QOpenGLTextureCacheWrapper
-{
-public:
- QOpenGLTextureCacheWrapper()
- {
- QImagePixmapCleanupHooks::instance()->addPlatformPixmapModificationHook(cleanupTexturesForPixmapData);
- QImagePixmapCleanupHooks::instance()->addPlatformPixmapDestructionHook(cleanupTexturesForPixmapData);
- QImagePixmapCleanupHooks::instance()->addImageHook(cleanupTexturesForCacheKey);
- }
-
- ~QOpenGLTextureCacheWrapper()
- {
- QImagePixmapCleanupHooks::instance()->removePlatformPixmapModificationHook(cleanupTexturesForPixmapData);
- QImagePixmapCleanupHooks::instance()->removePlatformPixmapDestructionHook(cleanupTexturesForPixmapData);
- QImagePixmapCleanupHooks::instance()->removeImageHook(cleanupTexturesForCacheKey);
- }
-
- QOpenGLTextureCache *cacheForContext(QOpenGLContext *context) {
- QMutexLocker lock(&m_mutex);
- return m_resource.value<QOpenGLTextureCache>(context);
- }
-
- static void cleanupTexturesForCacheKey(qint64 key);
- static void cleanupTexturesForPixmapData(QPlatformPixmap *pmd);
-
-private:
- QOpenGLMultiGroupSharedResource m_resource;
- QMutex m_mutex;
-};
-
-Q_GLOBAL_STATIC(QOpenGLTextureCacheWrapper, qt_texture_caches)
-
-QOpenGLTextureCache *QOpenGLTextureCache::cacheForContext(QOpenGLContext *context)
-{
- return qt_texture_caches()->cacheForContext(context);
-}
-
-void QOpenGLTextureCacheWrapper::cleanupTexturesForCacheKey(qint64 key)
-{
- QList<QOpenGLSharedResource *> resources = qt_texture_caches()->m_resource.resources();
- for (QList<QOpenGLSharedResource *>::iterator it = resources.begin(); it != resources.end(); ++it)
- static_cast<QOpenGLTextureCache *>(*it)->invalidate(key);
-}
-
-void QOpenGLTextureCacheWrapper::cleanupTexturesForPixmapData(QPlatformPixmap *pmd)
-{
- cleanupTexturesForCacheKey(pmd->cacheKey());
-}
-
-QOpenGLTextureCache::QOpenGLTextureCache(QOpenGLContext *ctx)
- : QOpenGLSharedResource(ctx->shareGroup())
- , m_cache(256 * 1024) // 256 MB cache
-{
-}
-
-QOpenGLTextureCache::~QOpenGLTextureCache()
-{
-}
-
-GLuint QOpenGLTextureCache::bindTexture(QOpenGLContext *context, const QPixmap &pixmap, QOpenGLTextureUploader::BindOptions options)
-{
- if (pixmap.isNull())
- return 0;
- QMutexLocker locker(&m_mutex);
- qint64 key = pixmap.cacheKey();
-
- // A QPainter is active on the image - take the safe route and replace the texture.
- if (!pixmap.paintingActive()) {
- QOpenGLCachedTexture *entry = m_cache.object(key);
- if (entry && entry->options() == options) {
- context->functions()->glBindTexture(GL_TEXTURE_2D, entry->id());
- return entry->id();
- }
- }
-
- GLuint id = bindTexture(context, key, pixmap.toImage(), options);
- if (id > 0)
- QImagePixmapCleanupHooks::enableCleanupHooks(pixmap);
-
- return id;
-}
-
-GLuint QOpenGLTextureCache::bindTexture(QOpenGLContext *context, const QImage &image, QOpenGLTextureUploader::BindOptions options)
-{
- if (image.isNull())
- return 0;
- QMutexLocker locker(&m_mutex);
- qint64 key = image.cacheKey();
-
- // A QPainter is active on the image - take the safe route and replace the texture.
- if (!image.paintingActive()) {
- QOpenGLCachedTexture *entry = m_cache.object(key);
- if (entry && entry->options() == options) {
- context->functions()->glBindTexture(GL_TEXTURE_2D, entry->id());
- return entry->id();
- }
- }
-
- QImage img = image;
- if (!context->functions()->hasOpenGLFeature(QOpenGLFunctions::NPOTTextures))
- options |= QOpenGLTextureUploader::PowerOfTwoBindOption;
-
- GLuint id = bindTexture(context, key, img, options);
- if (id > 0)
- QImagePixmapCleanupHooks::enableCleanupHooks(image);
-
- return id;
-}
-
-GLuint QOpenGLTextureCache::bindTexture(QOpenGLContext *context, qint64 key, const QImage &image, QOpenGLTextureUploader::BindOptions options)
-{
- GLuint id;
- QOpenGLFunctions *funcs = context->functions();
- funcs->glGenTextures(1, &id);
- funcs->glBindTexture(GL_TEXTURE_2D, id);
-
- int cost = QOpenGLTextureUploader::textureImage(GL_TEXTURE_2D, image, options);
-
- m_cache.insert(key, new QOpenGLCachedTexture(id, options, context), cost / 1024);
-
- return id;
-}
-
-void QOpenGLTextureCache::invalidate(qint64 key)
-{
- QMutexLocker locker(&m_mutex);
- m_cache.remove(key);
-}
-
-void QOpenGLTextureCache::invalidateResource()
-{
- m_cache.clear();
-}
-
-void QOpenGLTextureCache::freeResource(QOpenGLContext *)
-{
- Q_ASSERT(false); // the texture cache lives until the context group disappears
-}
-
-static void freeTexture(QOpenGLFunctions *funcs, GLuint id)
-{
- funcs->glDeleteTextures(1, &id);
-}
-
-QOpenGLCachedTexture::QOpenGLCachedTexture(GLuint id, QOpenGLTextureUploader::BindOptions options, QOpenGLContext *context) : m_options(options)
-{
- m_resource = new QOpenGLSharedResourceGuard(context, id, freeTexture);
-}
-
-QT_END_NAMESPACE
diff --git a/src/gui/opengl/qopengltexturecache_p.h b/src/gui/opengl/qopengltexturecache_p.h
deleted file mode 100644
index 88ef06e744..0000000000
--- a/src/gui/opengl/qopengltexturecache_p.h
+++ /dev/null
@@ -1,108 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the QtGui module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-//
-// W A R N I N G
-// -------------
-//
-// This file is not part of the Qt API. It exists purely as an
-// implementation detail. This header file may change from version to
-// version without notice, or even be removed.
-//
-// We mean it.
-//
-
-#ifndef QOPENGLTEXTURECACHE_P_H
-#define QOPENGLTEXTURECACHE_P_H
-
-#include <QtGui/private/qtguiglobal_p.h>
-#include <QHash>
-#include <QObject>
-#include <QCache>
-#include <private/qopenglcontext_p.h>
-#include <private/qopengltextureuploader_p.h>
-#include <QtCore/qmutex.h>
-
-QT_BEGIN_NAMESPACE
-
-class QOpenGLCachedTexture;
-
-class Q_GUI_EXPORT QOpenGLTextureCache : public QOpenGLSharedResource
-{
-public:
- static QOpenGLTextureCache *cacheForContext(QOpenGLContext *context);
-
- QOpenGLTextureCache(QOpenGLContext *);
- ~QOpenGLTextureCache();
-
- GLuint bindTexture(QOpenGLContext *context, const QPixmap &pixmap,
- QOpenGLTextureUploader::BindOptions options = QOpenGLTextureUploader::PremultipliedAlphaBindOption);
- GLuint bindTexture(QOpenGLContext *context, const QImage &image,
- QOpenGLTextureUploader::BindOptions options = QOpenGLTextureUploader::PremultipliedAlphaBindOption);
-
- void invalidate(qint64 key);
-
- void invalidateResource() override;
- void freeResource(QOpenGLContext *ctx) override;
-
-private:
- GLuint bindTexture(QOpenGLContext *context, qint64 key, const QImage &image, QOpenGLTextureUploader::BindOptions options);
-
- QMutex m_mutex;
- QCache<quint64, QOpenGLCachedTexture> m_cache;
-};
-
-class QOpenGLCachedTexture
-{
-public:
- QOpenGLCachedTexture(GLuint id, QOpenGLTextureUploader::BindOptions options, QOpenGLContext *context);
- ~QOpenGLCachedTexture() { m_resource->free(); }
-
- GLuint id() const { return m_resource->id(); }
- QOpenGLTextureUploader::BindOptions options() const { return m_options; }
-
-private:
- QOpenGLSharedResourceGuard *m_resource;
- QOpenGLTextureUploader::BindOptions m_options;
-};
-
-QT_END_NAMESPACE
-
-#endif
-
diff --git a/src/gui/opengl/qopengltextureglyphcache.cpp b/src/gui/opengl/qopengltextureglyphcache.cpp
deleted file mode 100644
index 41027d26e0..0000000000
--- a/src/gui/opengl/qopengltextureglyphcache.cpp
+++ /dev/null
@@ -1,485 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the QtGui module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "qopengltextureglyphcache_p.h"
-#include "qopenglpaintengine_p.h"
-#include "private/qopenglengineshadersource_p.h"
-#include "qopenglextensions_p.h"
-#include <qrgb.h>
-#include <private/qdrawhelper_p.h>
-
-QT_BEGIN_NAMESPACE
-
-
-static int next_qopengltextureglyphcache_serial_number()
-{
- static QBasicAtomicInt serial = Q_BASIC_ATOMIC_INITIALIZER(0);
- return 1 + serial.fetchAndAddRelaxed(1);
-}
-
-QOpenGLTextureGlyphCache::QOpenGLTextureGlyphCache(QFontEngine::GlyphFormat format, const QTransform &matrix, const QColor &color)
- : QImageTextureGlyphCache(format, matrix, color)
- , m_textureResource(nullptr)
- , pex(nullptr)
- , m_blitProgram(nullptr)
- , m_filterMode(Nearest)
- , m_serialNumber(next_qopengltextureglyphcache_serial_number())
- , m_buffer(QOpenGLBuffer::VertexBuffer)
-{
-#ifdef QT_GL_TEXTURE_GLYPH_CACHE_DEBUG
- qDebug(" -> QOpenGLTextureGlyphCache() %p for context %p.", this, QOpenGLContext::currentContext());
-#endif
- m_vertexCoordinateArray[0] = -1.0f;
- m_vertexCoordinateArray[1] = -1.0f;
- m_vertexCoordinateArray[2] = 1.0f;
- m_vertexCoordinateArray[3] = -1.0f;
- m_vertexCoordinateArray[4] = 1.0f;
- m_vertexCoordinateArray[5] = 1.0f;
- m_vertexCoordinateArray[6] = -1.0f;
- m_vertexCoordinateArray[7] = 1.0f;
-
- m_textureCoordinateArray[0] = 0.0f;
- m_textureCoordinateArray[1] = 0.0f;
- m_textureCoordinateArray[2] = 1.0f;
- m_textureCoordinateArray[3] = 0.0f;
- m_textureCoordinateArray[4] = 1.0f;
- m_textureCoordinateArray[5] = 1.0f;
- m_textureCoordinateArray[6] = 0.0f;
- m_textureCoordinateArray[7] = 1.0f;
-}
-
-QOpenGLTextureGlyphCache::~QOpenGLTextureGlyphCache()
-{
-#ifdef QT_GL_TEXTURE_GLYPH_CACHE_DEBUG
- qDebug(" -> ~QOpenGLTextureGlyphCache() %p.", this);
-#endif
- clear();
-}
-
-#if !defined(QT_OPENGL_ES_2)
-static inline bool isCoreProfile()
-{
- return QOpenGLContext::currentContext()->format().profile() == QSurfaceFormat::CoreProfile;
-}
-#endif
-
-void QOpenGLTextureGlyphCache::createTextureData(int width, int height)
-{
- QOpenGLContext *ctx = const_cast<QOpenGLContext *>(QOpenGLContext::currentContext());
- if (ctx == nullptr) {
- qWarning("QOpenGLTextureGlyphCache::createTextureData: Called with no context");
- return;
- }
-
- // create in QImageTextureGlyphCache baseclass is meant to be called
- // only to create the initial image and does not preserve the content,
- // so we don't call when this function is called from resize.
- if (ctx->d_func()->workaround_brokenFBOReadBack && image().isNull())
- QImageTextureGlyphCache::createTextureData(width, height);
-
- // Make the lower glyph texture size 16 x 16.
- if (width < 16)
- width = 16;
- if (height < 16)
- height = 16;
-
- if (m_textureResource && !m_textureResource->m_texture) {
- delete m_textureResource;
- m_textureResource = nullptr;
- }
-
- if (!m_textureResource)
- m_textureResource = new QOpenGLGlyphTexture(ctx);
-
- QOpenGLFunctions *funcs = ctx->functions();
- funcs->glGenTextures(1, &m_textureResource->m_texture);
- funcs->glBindTexture(GL_TEXTURE_2D, m_textureResource->m_texture);
-
- m_textureResource->m_width = width;
- m_textureResource->m_height = height;
-
- if (m_format == QFontEngine::Format_A32 || m_format == QFontEngine::Format_ARGB) {
- QVarLengthArray<uchar> data(width * height * 4);
- for (int i = 0; i < data.size(); ++i)
- data[i] = 0;
- funcs->glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, width, height, 0, GL_RGBA, GL_UNSIGNED_BYTE, &data[0]);
- } else {
- QVarLengthArray<uchar> data(width * height);
- for (int i = 0; i < data.size(); ++i)
- data[i] = 0;
-#if !defined(QT_OPENGL_ES_2)
- const GLint internalFormat = isCoreProfile() ? GL_R8 : GL_ALPHA;
- const GLenum format = isCoreProfile() ? GL_RED : GL_ALPHA;
-#else
- const GLint internalFormat = GL_ALPHA;
- const GLenum format = GL_ALPHA;
-#endif
- funcs->glTexImage2D(GL_TEXTURE_2D, 0, internalFormat, width, height, 0, format, GL_UNSIGNED_BYTE, &data[0]);
- }
-
- funcs->glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
- funcs->glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
- funcs->glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);
- funcs->glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);
- m_filterMode = Nearest;
-
- if (!m_buffer.isCreated()) {
- m_buffer.create();
- m_buffer.bind();
- static GLfloat buf[sizeof(m_vertexCoordinateArray) + sizeof(m_textureCoordinateArray)];
- memcpy(buf, m_vertexCoordinateArray, sizeof(m_vertexCoordinateArray));
- memcpy(buf + (sizeof(m_vertexCoordinateArray) / sizeof(GLfloat)),
- m_textureCoordinateArray,
- sizeof(m_textureCoordinateArray));
- m_buffer.allocate(buf, sizeof(buf));
- m_buffer.release();
- }
-
- if (!m_vao.isCreated())
- m_vao.create();
-}
-
-void QOpenGLTextureGlyphCache::setupVertexAttribs()
-{
- m_buffer.bind();
- m_blitProgram->setAttributeBuffer(int(QT_VERTEX_COORDS_ATTR), GL_FLOAT, 0, 2);
- m_blitProgram->setAttributeBuffer(int(QT_TEXTURE_COORDS_ATTR), GL_FLOAT, sizeof(m_vertexCoordinateArray), 2);
- m_blitProgram->enableAttributeArray(int(QT_VERTEX_COORDS_ATTR));
- m_blitProgram->enableAttributeArray(int(QT_TEXTURE_COORDS_ATTR));
- m_buffer.release();
-}
-
-static void load_glyph_image_to_texture(QOpenGLContext *ctx,
- QImage &img,
- GLuint texture,
- int tx, int ty)
-{
- QOpenGLFunctions *funcs = ctx->functions();
-
- const int imgWidth = img.width();
- const int imgHeight = img.height();
-
- if (img.format() == QImage::Format_Mono) {
- img = img.convertToFormat(QImage::Format_Grayscale8);
- } else if (img.depth() == 32) {
- if (img.format() == QImage::Format_RGB32
- // We need to make the alpha component equal to the average of the RGB values.
- // This is needed when drawing sub-pixel antialiased text on translucent targets.
-#if Q_BYTE_ORDER == Q_BIG_ENDIAN
- || img.format() == QImage::Format_ARGB32_Premultiplied
-#else
- || (img.format() == QImage::Format_ARGB32_Premultiplied
- && ctx->isOpenGLES())
-#endif
- ) {
- for (int y = 0; y < imgHeight; ++y) {
- QRgb *src = (QRgb *) img.scanLine(y);
- for (int x = 0; x < imgWidth; ++x) {
- int r = qRed(src[x]);
- int g = qGreen(src[x]);
- int b = qBlue(src[x]);
- int avg;
- if (img.format() == QImage::Format_RGB32)
- avg = (r + g + b + 1) / 3; // "+1" for rounding.
- else // Format_ARGB_Premultiplied
- avg = qAlpha(src[x]);
-
- src[x] = qRgba(r, g, b, avg);
- // swizzle the bits to accommodate for the GL_RGBA upload.
-#if Q_BYTE_ORDER != Q_BIG_ENDIAN
- if (ctx->isOpenGLES())
-#endif
- src[x] = ARGB2RGBA(src[x]);
- }
- }
- }
- }
-
- funcs->glBindTexture(GL_TEXTURE_2D, texture);
- if (img.depth() == 32) {
-#ifdef QT_OPENGL_ES_2
- GLenum fmt = GL_RGBA;
-#else
- GLenum fmt = ctx->isOpenGLES() ? GL_RGBA : GL_BGRA;
-#endif // QT_OPENGL_ES_2
-
-#if Q_BYTE_ORDER == Q_BIG_ENDIAN
- fmt = GL_RGBA;
-#endif
- funcs->glTexSubImage2D(GL_TEXTURE_2D, 0, tx, ty, imgWidth, imgHeight, fmt, GL_UNSIGNED_BYTE, img.constBits());
- } else {
- // The scanlines in image are 32-bit aligned, even for mono or 8-bit formats. This
- // is good because it matches the default of 4 bytes for GL_UNPACK_ALIGNMENT.
-#if !defined(QT_OPENGL_ES_2)
- const GLenum format = isCoreProfile() ? GL_RED : GL_ALPHA;
-#else
- const GLenum format = GL_ALPHA;
-#endif
- funcs->glTexSubImage2D(GL_TEXTURE_2D, 0, tx, ty, imgWidth, imgHeight, format, GL_UNSIGNED_BYTE, img.constBits());
- }
-}
-
-static void load_glyph_image_region_to_texture(QOpenGLContext *ctx,
- const QImage &srcImg,
- int x, int y,
- int w, int h,
- GLuint texture,
- int tx, int ty)
-{
- Q_ASSERT(x + w <= srcImg.width() && y + h <= srcImg.height());
-
- QImage img;
- if (x != 0 || y != 0 || w != srcImg.width() || h != srcImg.height())
- img = srcImg.copy(x, y, w, h);
- else
- img = srcImg;
-
- load_glyph_image_to_texture(ctx, img, texture, tx, ty);
-}
-
-void QOpenGLTextureGlyphCache::resizeTextureData(int width, int height)
-{
- QOpenGLContext *ctx = QOpenGLContext::currentContext();
- if (ctx == nullptr) {
- qWarning("QOpenGLTextureGlyphCache::resizeTextureData: Called with no context");
- return;
- }
-
- QOpenGLFunctions *funcs = ctx->functions();
- GLint oldFbo;
- funcs->glGetIntegerv(GL_FRAMEBUFFER_BINDING, &oldFbo);
-
- int oldWidth = m_textureResource->m_width;
- int oldHeight = m_textureResource->m_height;
-
- // Make the lower glyph texture size 16 x 16.
- if (width < 16)
- width = 16;
- if (height < 16)
- height = 16;
-
- GLuint oldTexture = m_textureResource->m_texture;
- createTextureData(width, height);
-
- if (ctx->d_func()->workaround_brokenFBOReadBack) {
- QImageTextureGlyphCache::resizeTextureData(width, height);
- load_glyph_image_region_to_texture(ctx, image(), 0, 0, qMin(oldWidth, width), qMin(oldHeight, height),
- m_textureResource->m_texture, 0, 0);
- return;
- }
-
- // ### the QTextureGlyphCache API needs to be reworked to allow
- // ### resizeTextureData to fail
-
- funcs->glBindFramebuffer(GL_FRAMEBUFFER, m_textureResource->m_fbo);
-
- GLuint tmp_texture;
- funcs->glGenTextures(1, &tmp_texture);
- funcs->glBindTexture(GL_TEXTURE_2D, tmp_texture);
- funcs->glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, oldWidth, oldHeight, 0,
- GL_RGBA, GL_UNSIGNED_BYTE, nullptr);
- funcs->glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
- funcs->glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
- funcs->glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);
- funcs->glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);
- m_filterMode = Nearest;
- funcs->glBindTexture(GL_TEXTURE_2D, 0);
- funcs->glFramebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0,
- GL_TEXTURE_2D, tmp_texture, 0);
-
- funcs->glActiveTexture(GL_TEXTURE0 + QT_IMAGE_TEXTURE_UNIT);
- funcs->glBindTexture(GL_TEXTURE_2D, oldTexture);
-
- if (pex != nullptr)
- pex->transferMode(BrushDrawingMode);
-
- funcs->glDisable(GL_STENCIL_TEST);
- funcs->glDisable(GL_DEPTH_TEST);
- funcs->glDisable(GL_SCISSOR_TEST);
- funcs->glDisable(GL_BLEND);
-
- funcs->glViewport(0, 0, oldWidth, oldHeight);
-
- QOpenGLShaderProgram *blitProgram = nullptr;
- if (pex == nullptr) {
- if (m_blitProgram == nullptr) {
- m_blitProgram = new QOpenGLShaderProgram;
- const bool isCoreProfile = ctx->format().profile() == QSurfaceFormat::CoreProfile;
-
- {
- QString source;
-#ifdef Q_OS_WASM
- source.append(QLatin1String(isCoreProfile ? qopenglslUntransformedPositionVertexShader_core : qopenglslUntransformedPositionVertexShader));
- source.append(QLatin1String(isCoreProfile ? qopenglslMainWithTexCoordsVertexShader_core : qopenglslMainWithTexCoordsVertexShader));
-#else
- source.append(QLatin1String(isCoreProfile ? qopenglslMainWithTexCoordsVertexShader_core : qopenglslMainWithTexCoordsVertexShader));
- source.append(QLatin1String(isCoreProfile ? qopenglslUntransformedPositionVertexShader_core : qopenglslUntransformedPositionVertexShader));
-#endif
- m_blitProgram->addCacheableShaderFromSourceCode(QOpenGLShader::Vertex, source);
- }
-
- {
- QString source;
-#ifdef Q_OS_WASM
- source.append(QLatin1String(isCoreProfile ? qopenglslImageSrcFragmentShader_core : qopenglslImageSrcFragmentShader));
- source.append(QLatin1String(isCoreProfile ? qopenglslMainFragmentShader_core : qopenglslMainFragmentShader));
-#else
- source.append(QLatin1String(isCoreProfile ? qopenglslMainFragmentShader_core : qopenglslMainFragmentShader));
- source.append(QLatin1String(isCoreProfile ? qopenglslImageSrcFragmentShader_core : qopenglslImageSrcFragmentShader));
-#endif
- m_blitProgram->addCacheableShaderFromSourceCode(QOpenGLShader::Fragment, source);
- }
-
- m_blitProgram->bindAttributeLocation("vertexCoordsArray", QT_VERTEX_COORDS_ATTR);
- m_blitProgram->bindAttributeLocation("textureCoordArray", QT_TEXTURE_COORDS_ATTR);
-
- m_blitProgram->link();
-
- if (m_vao.isCreated()) {
- m_vao.bind();
- setupVertexAttribs();
- }
- }
-
- if (m_vao.isCreated())
- m_vao.bind();
- else
- setupVertexAttribs();
-
- m_blitProgram->bind();
- blitProgram = m_blitProgram;
-
- } else {
- pex->uploadData(QT_VERTEX_COORDS_ATTR, m_vertexCoordinateArray, 8);
- pex->uploadData(QT_TEXTURE_COORDS_ATTR, m_textureCoordinateArray, 8);
-
- pex->shaderManager->useBlitProgram();
- blitProgram = pex->shaderManager->blitProgram();
- }
-
- blitProgram->setUniformValue("imageTexture", QT_IMAGE_TEXTURE_UNIT);
-
- funcs->glDrawArrays(GL_TRIANGLE_FAN, 0, 4);
-
- funcs->glBindTexture(GL_TEXTURE_2D, m_textureResource->m_texture);
-
- funcs->glCopyTexSubImage2D(GL_TEXTURE_2D, 0, 0, 0, 0, 0, oldWidth, oldHeight);
-
- funcs->glFramebufferRenderbuffer(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0,
- GL_RENDERBUFFER, 0);
- funcs->glDeleteTextures(1, &tmp_texture);
- funcs->glDeleteTextures(1, &oldTexture);
-
- funcs->glBindFramebuffer(GL_FRAMEBUFFER, (GLuint)oldFbo);
-
- if (pex != nullptr) {
- funcs->glViewport(0, 0, pex->width, pex->height);
- pex->updateClipScissorTest();
- } else {
- if (m_vao.isCreated()) {
- m_vao.release();
- } else {
- m_blitProgram->disableAttributeArray(int(QT_VERTEX_COORDS_ATTR));
- m_blitProgram->disableAttributeArray(int(QT_TEXTURE_COORDS_ATTR));
- }
- }
-}
-
-void QOpenGLTextureGlyphCache::fillTexture(const Coord &c, glyph_t glyph, QFixed subPixelPosition)
-{
- QOpenGLContext *ctx = QOpenGLContext::currentContext();
- if (ctx == nullptr) {
- qWarning("QOpenGLTextureGlyphCache::fillTexture: Called with no context");
- return;
- }
-
- if (ctx->d_func()->workaround_brokenFBOReadBack) {
- QImageTextureGlyphCache::fillTexture(c, glyph, subPixelPosition);
- load_glyph_image_region_to_texture(ctx, image(), c.x, c.y, c.w, c.h, m_textureResource->m_texture, c.x, c.y);
- return;
- }
-
- QImage mask = textureMapForGlyph(glyph, subPixelPosition);
- load_glyph_image_to_texture(ctx, mask, m_textureResource->m_texture, c.x, c.y);
-}
-
-int QOpenGLTextureGlyphCache::glyphPadding() const
-{
- return 1;
-}
-
-int QOpenGLTextureGlyphCache::maxTextureWidth() const
-{
- QOpenGLContext *ctx = const_cast<QOpenGLContext *>(QOpenGLContext::currentContext());
- if (ctx == nullptr)
- return QImageTextureGlyphCache::maxTextureWidth();
- else
- return ctx->d_func()->maxTextureSize();
-}
-
-int QOpenGLTextureGlyphCache::maxTextureHeight() const
-{
- QOpenGLContext *ctx = const_cast<QOpenGLContext *>(QOpenGLContext::currentContext());
- if (ctx == nullptr)
- return QImageTextureGlyphCache::maxTextureHeight();
-
- if (ctx->d_func()->workaround_brokenTexSubImage)
- return qMin(1024, ctx->d_func()->maxTextureSize());
- else
- return ctx->d_func()->maxTextureSize();
-}
-
-void QOpenGLTextureGlyphCache::clear()
-{
- if (m_textureResource)
- m_textureResource->free();
- m_textureResource = nullptr;
-
- delete m_blitProgram;
- m_blitProgram = nullptr;
-
- m_w = 0;
- m_h = 0;
- m_cx = 0;
- m_cy = 0;
- m_currentRowHeight = 0;
- coords.clear();
-}
-
-QT_END_NAMESPACE
diff --git a/src/gui/opengl/qopengltextureglyphcache_p.h b/src/gui/opengl/qopengltextureglyphcache_p.h
deleted file mode 100644
index 4bea4a463a..0000000000
--- a/src/gui/opengl/qopengltextureglyphcache_p.h
+++ /dev/null
@@ -1,181 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the QtGui module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef QOPENGLTEXTUREGLYPHCACHE_P_H
-#define QOPENGLTEXTUREGLYPHCACHE_P_H
-
-//
-// W A R N I N G
-// -------------
-//
-// This file is not part of the Qt API. It exists purely as an
-// implementation detail. This header file may change from version to
-// version without notice, or even be removed.
-//
-// We mean it.
-//
-
-#include <QtGui/private/qtguiglobal_p.h>
-#include <private/qtextureglyphcache_p.h>
-#include <private/qopenglcontext_p.h>
-#include <qopenglshaderprogram.h>
-#include <qopenglfunctions.h>
-#include <qopenglbuffer.h>
-#include <qopenglvertexarrayobject.h>
-
-// #define QT_GL_TEXTURE_GLYPH_CACHE_DEBUG
-
-QT_BEGIN_NAMESPACE
-
-class QOpenGL2PaintEngineExPrivate;
-
-class QOpenGLGlyphTexture : public QOpenGLSharedResource
-{
-public:
- explicit QOpenGLGlyphTexture(QOpenGLContext *ctx)
- : QOpenGLSharedResource(ctx->shareGroup())
- , m_width(0)
- , m_height(0)
- {
- if (!ctx->d_func()->workaround_brokenFBOReadBack)
- QOpenGLFunctions(ctx).glGenFramebuffers(1, &m_fbo);
-
-#ifdef QT_GL_TEXTURE_GLYPH_CACHE_DEBUG
- qDebug(" -> QOpenGLGlyphTexture() %p for context %p.", this, ctx);
-#endif
- }
-
- void freeResource(QOpenGLContext *context) override
- {
- QOpenGLContext *ctx = context;
-#ifdef QT_GL_TEXTURE_GLYPH_CACHE_DEBUG
- qDebug("~QOpenGLGlyphTexture() %p for context %p.", this, ctx);
-#endif
- if (!ctx->d_func()->workaround_brokenFBOReadBack)
- ctx->functions()->glDeleteFramebuffers(1, &m_fbo);
- if (m_width || m_height)
- ctx->functions()->glDeleteTextures(1, &m_texture);
- }
-
- void invalidateResource() override
- {
- m_texture = 0;
- m_fbo = 0;
- m_width = 0;
- m_height = 0;
- }
-
- GLuint m_texture;
- GLuint m_fbo;
- int m_width;
- int m_height;
-};
-
-class Q_GUI_EXPORT QOpenGLTextureGlyphCache : public QImageTextureGlyphCache
-{
-public:
- QOpenGLTextureGlyphCache(QFontEngine::GlyphFormat glyphFormat, const QTransform &matrix, const QColor &color = QColor());
- ~QOpenGLTextureGlyphCache();
-
- virtual void createTextureData(int width, int height) override;
- virtual void resizeTextureData(int width, int height) override;
- virtual void fillTexture(const Coord &c, glyph_t glyph, QFixed subPixelPosition) override;
- virtual int glyphPadding() const override;
- virtual int maxTextureWidth() const override;
- virtual int maxTextureHeight() const override;
-
- inline GLuint texture() const {
- QOpenGLTextureGlyphCache *that = const_cast<QOpenGLTextureGlyphCache *>(this);
- QOpenGLGlyphTexture *glyphTexture = that->m_textureResource;
- return glyphTexture ? glyphTexture->m_texture : 0;
- }
-
- inline int width() const {
- QOpenGLTextureGlyphCache *that = const_cast<QOpenGLTextureGlyphCache *>(this);
- QOpenGLGlyphTexture *glyphTexture = that->m_textureResource;
- return glyphTexture ? glyphTexture->m_width : 0;
- }
- inline int height() const {
- QOpenGLTextureGlyphCache *that = const_cast<QOpenGLTextureGlyphCache *>(this);
- QOpenGLGlyphTexture *glyphTexture = that->m_textureResource;
- return glyphTexture ? glyphTexture->m_height : 0;
- }
-
- inline void setPaintEnginePrivate(QOpenGL2PaintEngineExPrivate *p) { pex = p; }
-
- inline const QOpenGLContextGroup *contextGroup() const { return m_textureResource ? m_textureResource->group() : nullptr; }
-
- inline int serialNumber() const { return m_serialNumber; }
-
- enum FilterMode {
- Nearest,
- Linear
- };
- FilterMode filterMode() const { return m_filterMode; }
- void setFilterMode(FilterMode m) { m_filterMode = m; }
-
- void clear();
-
- QOpenGL2PaintEngineExPrivate *paintEnginePrivate() const
- {
- return pex;
- }
-
-private:
- void setupVertexAttribs();
-
- QOpenGLGlyphTexture *m_textureResource;
-
- QOpenGL2PaintEngineExPrivate *pex;
- QOpenGLShaderProgram *m_blitProgram;
- FilterMode m_filterMode;
-
- GLfloat m_vertexCoordinateArray[8];
- GLfloat m_textureCoordinateArray[8];
-
- int m_serialNumber;
-
- QOpenGLBuffer m_buffer;
- QOpenGLVertexArrayObject m_vao;
-};
-
-QT_END_NAMESPACE
-
-#endif // QOPENGLTEXTUREGLYPHCACHE_P_H
-
diff --git a/src/gui/opengl/qopengltexturehelper.cpp b/src/gui/opengl/qopengltexturehelper.cpp
deleted file mode 100644
index 6709edc4e2..0000000000
--- a/src/gui/opengl/qopengltexturehelper.cpp
+++ /dev/null
@@ -1,589 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2013 Klaralvdalens Datakonsult AB (KDAB).
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the QtGui module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "qopengltexturehelper_p.h"
-
-#include <QOpenGLContext>
-#include <private/qopenglextensions_p.h>
-
-QT_BEGIN_NAMESPACE
-
-QOpenGLTextureHelper::QOpenGLTextureHelper(QOpenGLContext *context)
-{
- functions = context->functions();
- // Resolve EXT_direct_state_access entry points if present.
-
- // However, disable it on some systems where DSA is known to be unreliable.
- bool allowDSA = true;
- const char *renderer = reinterpret_cast<const char *>(context->functions()->glGetString(GL_RENDERER));
- // QTBUG-40653, QTBUG-44988
- if (renderer && strstr(renderer, "AMD Radeon HD"))
- allowDSA = false;
-
- if (allowDSA && !context->isOpenGLES()
- && context->hasExtension(QByteArrayLiteral("GL_EXT_direct_state_access"))) {
- TextureParameteriEXT = reinterpret_cast<void (QOPENGLF_APIENTRYP)(GLuint , GLenum , GLenum , GLint )>(context->getProcAddress("glTextureParameteriEXT"));
- TextureParameterivEXT = reinterpret_cast<void (QOPENGLF_APIENTRYP)(GLuint , GLenum , GLenum , const GLint *)>(context->getProcAddress("glTextureParameterivEXT"));
- TextureParameterfEXT = reinterpret_cast<void (QOPENGLF_APIENTRYP)(GLuint , GLenum , GLenum , GLfloat )>(context->getProcAddress("glTextureParameterfEXT"));
- TextureParameterfvEXT = reinterpret_cast<void (QOPENGLF_APIENTRYP)(GLuint , GLenum , GLenum , const GLfloat *)>(context->getProcAddress("glTextureParameterfvEXT"));
- GenerateTextureMipmapEXT = reinterpret_cast<void (QOPENGLF_APIENTRYP)(GLuint , GLenum )>(context->getProcAddress("glGenerateTextureMipmapEXT"));
- TextureStorage3DEXT = reinterpret_cast<void (QOPENGLF_APIENTRYP)(GLuint , GLenum , GLsizei , GLenum , GLsizei , GLsizei , GLsizei )>(context->getProcAddress("glTextureStorage3DEXT"));
- TextureStorage2DEXT = reinterpret_cast<void (QOPENGLF_APIENTRYP)(GLuint , GLenum , GLsizei , GLenum , GLsizei , GLsizei )>(context->getProcAddress("glTextureStorage2DEXT"));
- TextureStorage1DEXT = reinterpret_cast<void (QOPENGLF_APIENTRYP)(GLuint , GLenum , GLsizei , GLenum , GLsizei )>(context->getProcAddress("glTextureStorage1DEXT"));
- TextureStorage3DMultisampleEXT = reinterpret_cast<void (QOPENGLF_APIENTRYP)(GLuint , GLenum , GLsizei , GLenum , GLsizei , GLsizei , GLsizei , GLboolean )>(context->getProcAddress("glTextureStorage3DMultisampleEXT"));
- TextureStorage2DMultisampleEXT = reinterpret_cast<void (QOPENGLF_APIENTRYP)(GLuint , GLenum , GLsizei , GLenum , GLsizei , GLsizei , GLboolean )>(context->getProcAddress("glTextureStorage2DMultisampleEXT"));
- TextureImage3DEXT = reinterpret_cast<void (QOPENGLF_APIENTRYP)(GLuint , GLenum , GLint , GLenum , GLsizei , GLsizei , GLsizei , GLint , GLenum , GLenum , const GLvoid *)>(context->getProcAddress("glTextureImage3DEXT"));
- TextureImage2DEXT = reinterpret_cast<void (QOPENGLF_APIENTRYP)(GLuint , GLenum , GLint , GLenum , GLsizei , GLsizei , GLint , GLenum , GLenum , const GLvoid *)>(context->getProcAddress("glTextureImage2DEXT"));
- TextureImage1DEXT = reinterpret_cast<void (QOPENGLF_APIENTRYP)(GLuint , GLenum , GLint , GLenum , GLsizei , GLint , GLenum , GLenum , const GLvoid *)>(context->getProcAddress("glTextureImage1DEXT"));
- TextureSubImage3DEXT = reinterpret_cast<void (QOPENGLF_APIENTRYP)(GLuint , GLenum , GLint , GLint , GLint , GLint , GLsizei , GLsizei , GLsizei , GLenum , GLenum , const GLvoid *)>(context->getProcAddress("glTextureSubImage3DEXT"));
- TextureSubImage2DEXT = reinterpret_cast<void (QOPENGLF_APIENTRYP)(GLuint , GLenum , GLint , GLint , GLint , GLsizei , GLsizei , GLenum , GLenum , const GLvoid *)>(context->getProcAddress("glTextureSubImage2DEXT"));
- TextureSubImage1DEXT = reinterpret_cast<void (QOPENGLF_APIENTRYP)(GLuint , GLenum , GLint , GLint , GLsizei , GLenum , GLenum , const GLvoid *)>(context->getProcAddress("glTextureSubImage1DEXT"));
- CompressedTextureSubImage1DEXT = reinterpret_cast<void (QOPENGLF_APIENTRYP)(GLuint , GLenum , GLint , GLint , GLsizei , GLenum , GLsizei , const GLvoid *)>(context->getProcAddress("glCompressedTextureSubImage1DEXT"));
- CompressedTextureSubImage2DEXT = reinterpret_cast<void (QOPENGLF_APIENTRYP)(GLuint , GLenum , GLint , GLint , GLint , GLsizei , GLsizei , GLenum , GLsizei , const GLvoid *)>(context->getProcAddress("glCompressedTextureSubImage2DEXT"));
- CompressedTextureSubImage3DEXT = reinterpret_cast<void (QOPENGLF_APIENTRYP)(GLuint , GLenum , GLint , GLint , GLint , GLint , GLsizei , GLsizei , GLsizei , GLenum , GLsizei , const GLvoid *)>(context->getProcAddress("glCompressedTextureSubImage3DEXT"));
- CompressedTextureImage1DEXT = reinterpret_cast<void (QOPENGLF_APIENTRYP)(GLuint , GLenum , GLint , GLenum , GLsizei , GLint , GLsizei , const GLvoid *)>(context->getProcAddress("glCompressedTextureImage1DEXT"));
- CompressedTextureImage2DEXT = reinterpret_cast<void (QOPENGLF_APIENTRYP)(GLuint , GLenum , GLint , GLenum , GLsizei , GLsizei , GLint , GLsizei , const GLvoid *)>(context->getProcAddress("glCompressedTextureImage2DEXT"));
- CompressedTextureImage3DEXT = reinterpret_cast<void (QOPENGLF_APIENTRYP)(GLuint , GLenum , GLint , GLenum , GLsizei , GLsizei , GLsizei , GLint , GLsizei , const GLvoid *)>(context->getProcAddress("glCompressedTextureImage3DEXT"));
-
- // Use the real DSA functions
- TextureParameteri = &QOpenGLTextureHelper::dsa_TextureParameteri;
- TextureParameteriv = &QOpenGLTextureHelper::dsa_TextureParameteriv;
- TextureParameterf = &QOpenGLTextureHelper::dsa_TextureParameterf;
- TextureParameterfv = &QOpenGLTextureHelper::dsa_TextureParameterfv;
- GenerateTextureMipmap = &QOpenGLTextureHelper::dsa_GenerateTextureMipmap;
- TextureStorage3D = &QOpenGLTextureHelper::dsa_TextureStorage3D;
- TextureStorage2D = &QOpenGLTextureHelper::dsa_TextureStorage2D;
- TextureStorage1D = &QOpenGLTextureHelper::dsa_TextureStorage1D;
- TextureStorage3DMultisample = &QOpenGLTextureHelper::dsa_TextureStorage3DMultisample;
- TextureStorage2DMultisample = &QOpenGLTextureHelper::dsa_TextureStorage2DMultisample;
- TextureImage3D = &QOpenGLTextureHelper::dsa_TextureImage3D;
- TextureImage2D = &QOpenGLTextureHelper::dsa_TextureImage2D;
- TextureImage1D = &QOpenGLTextureHelper::dsa_TextureImage1D;
- TextureSubImage3D = &QOpenGLTextureHelper::dsa_TextureSubImage3D;
- TextureSubImage2D = &QOpenGLTextureHelper::dsa_TextureSubImage2D;
- TextureSubImage1D = &QOpenGLTextureHelper::dsa_TextureSubImage1D;
- CompressedTextureSubImage1D = &QOpenGLTextureHelper::dsa_CompressedTextureSubImage1D;
- CompressedTextureSubImage2D = &QOpenGLTextureHelper::dsa_CompressedTextureSubImage2D;
- CompressedTextureSubImage3D = &QOpenGLTextureHelper::dsa_CompressedTextureSubImage3D;
- CompressedTextureImage1D = &QOpenGLTextureHelper::dsa_CompressedTextureImage1D;
- CompressedTextureImage2D = &QOpenGLTextureHelper::dsa_CompressedTextureImage2D;
- CompressedTextureImage3D = &QOpenGLTextureHelper::dsa_CompressedTextureImage3D;
- } else {
- // Use our own DSA emulation
- TextureParameteri = &QOpenGLTextureHelper::qt_TextureParameteri;
- TextureParameteriv = &QOpenGLTextureHelper::qt_TextureParameteriv;
- TextureParameterf = &QOpenGLTextureHelper::qt_TextureParameterf;
- TextureParameterfv = &QOpenGLTextureHelper::qt_TextureParameterfv;
- GenerateTextureMipmap = &QOpenGLTextureHelper::qt_GenerateTextureMipmap;
- TextureStorage3D = &QOpenGLTextureHelper::qt_TextureStorage3D;
- TextureStorage2D = &QOpenGLTextureHelper::qt_TextureStorage2D;
- TextureStorage1D = &QOpenGLTextureHelper::qt_TextureStorage1D;
- TextureStorage3DMultisample = &QOpenGLTextureHelper::qt_TextureStorage3DMultisample;
- TextureStorage2DMultisample = &QOpenGLTextureHelper::qt_TextureStorage2DMultisample;
- TextureImage3D = &QOpenGLTextureHelper::qt_TextureImage3D;
- TextureImage2D = &QOpenGLTextureHelper::qt_TextureImage2D;
- TextureImage1D = &QOpenGLTextureHelper::qt_TextureImage1D;
- TextureSubImage3D = &QOpenGLTextureHelper::qt_TextureSubImage3D;
- TextureSubImage2D = &QOpenGLTextureHelper::qt_TextureSubImage2D;
- TextureSubImage1D = &QOpenGLTextureHelper::qt_TextureSubImage1D;
- CompressedTextureSubImage1D = &QOpenGLTextureHelper::qt_CompressedTextureSubImage1D;
- CompressedTextureSubImage2D = &QOpenGLTextureHelper::qt_CompressedTextureSubImage2D;
- CompressedTextureSubImage3D = &QOpenGLTextureHelper::qt_CompressedTextureSubImage3D;
- CompressedTextureImage1D = &QOpenGLTextureHelper::qt_CompressedTextureImage1D;
- CompressedTextureImage2D = &QOpenGLTextureHelper::qt_CompressedTextureImage2D;
- CompressedTextureImage3D = &QOpenGLTextureHelper::qt_CompressedTextureImage3D;
- }
-
- // Some DSA functions are part of NV_texture_multisample instead
- if (!context->isOpenGLES()
- && context->hasExtension(QByteArrayLiteral("GL_NV_texture_multisample"))) {
- TextureImage3DMultisampleNV = reinterpret_cast<void (QOPENGLF_APIENTRYP)(GLuint , GLenum , GLsizei , GLint , GLsizei , GLsizei , GLsizei , GLboolean )>(context->getProcAddress("glTextureImage3DMultisampleNV"));
- TextureImage2DMultisampleNV = reinterpret_cast<void (QOPENGLF_APIENTRYP)(GLuint , GLenum , GLsizei , GLint , GLsizei , GLsizei , GLboolean )>(context->getProcAddress("glTextureImage2DMultisampleNV"));
-
- TextureImage3DMultisample = &QOpenGLTextureHelper::dsa_TextureImage3DMultisample;
- TextureImage2DMultisample = &QOpenGLTextureHelper::dsa_TextureImage2DMultisample;
- } else {
- TextureImage3DMultisample = &QOpenGLTextureHelper::qt_TextureImage3DMultisample;
- TextureImage2DMultisample = &QOpenGLTextureHelper::qt_TextureImage2DMultisample;
- }
-
-#if defined(QT_OPENGL_ES_2)
- // Here we are targeting OpenGL ES 2.0+ only. This is likely using EGL, where,
- // similarly to WGL, non-extension functions (i.e. any function that is part of the
- // GLES spec) *may* not be queried via eglGetProcAddress.
-
- // OpenGL 1.0
- TexImage1D = 0;
-
- // OpenGL 1.1
- TexSubImage1D = 0;
-
- // OpenGL 1.3
- GetCompressedTexImage = 0;
- CompressedTexSubImage1D = 0;
- CompressedTexSubImage2D = ::glCompressedTexSubImage2D;
- CompressedTexImage1D = 0;
- CompressedTexImage2D = ::glCompressedTexImage2D;
- ActiveTexture = ::glActiveTexture;
-
- // OpenGL 3.0
- GenerateMipmap = ::glGenerateMipmap;
-
- // OpenGL 3.2
- TexImage3DMultisample = 0;
- TexImage2DMultisample = 0;
-
- // OpenGL 4.2
- QOpenGLContext *ctx = QOpenGLContext::currentContext();
- if (ctx->format().majorVersion() >= 3) {
- // OpenGL ES 3.0+ has immutable storage for 2D and 3D at least.
- QOpenGLExtraFunctionsPrivate *extra = static_cast<QOpenGLExtensions *>(context->extraFunctions())->d();
- TexStorage3D = extra->f.TexStorage3D;
- TexStorage2D = extra->f.TexStorage2D;
- } else {
- TexStorage3D = 0;
- TexStorage2D = 0;
- }
- TexStorage1D = 0;
-
- // OpenGL 4.3
- TexStorage3DMultisample = 0;
- TexStorage2DMultisample = 0;
- TexBufferRange = 0;
- TextureView = 0;
-
- // OpenGL ES 3.1+ has TexStorage2DMultisample
- if (ctx->format().version() >= qMakePair(3, 1)) {
- QOpenGLExtraFunctionsPrivate *extra = static_cast<QOpenGLExtensions *>(context->extraFunctions())->d();
- TexStorage2DMultisample = extra->f.TexStorage2DMultisample;
- }
-
-#endif
-
- if (context->isOpenGLES() && context->hasExtension(QByteArrayLiteral("GL_OES_texture_3D"))) {
- TexImage3D = reinterpret_cast<void (QOPENGLF_APIENTRYP)(GLenum, GLint, GLint, GLsizei, GLsizei, GLsizei, GLint, GLenum, GLenum, const GLvoid*)>(context->getProcAddress("glTexImage3DOES"));
- TexSubImage3D = reinterpret_cast<void (QOPENGLF_APIENTRYP)(GLenum, GLint, GLint, GLint, GLint, GLsizei, GLsizei, GLsizei, GLenum, GLenum, const GLvoid*)>(context->getProcAddress("glTexSubImage3DOES"));
- CompressedTexImage3D = reinterpret_cast<void (QOPENGLF_APIENTRYP)(GLenum, GLint, GLenum, GLsizei, GLsizei, GLsizei, GLint, GLsizei, const GLvoid*)>(context->getProcAddress("glCompressedTexImage3DOES"));
- CompressedTexSubImage3D = reinterpret_cast<void (QOPENGLF_APIENTRYP)(GLenum, GLint, GLint, GLint, GLint, GLsizei, GLsizei, GLsizei, GLenum, GLsizei, const GLvoid*)>(context->getProcAddress("glCompressedTexSubImage3DOES"));
- } else {
- QOpenGLContext *ctx = QOpenGLContext::currentContext();
- if (ctx->isOpenGLES() && ctx->format().majorVersion() >= 3) {
- // OpenGL ES 3.0+ has glTexImage3D.
- QOpenGLExtraFunctionsPrivate *extra = static_cast<QOpenGLExtensions *>(context->extraFunctions())->d();
- TexImage3D = extra->f.TexImage3D;
- TexSubImage3D = extra->f.TexSubImage3D;
- CompressedTexImage3D = extra->f.CompressedTexImage3D;
- CompressedTexSubImage3D = extra->f.CompressedTexSubImage3D;
- } else {
- // OpenGL 1.2
- TexImage3D = reinterpret_cast<void (QOPENGLF_APIENTRYP)(GLenum , GLint , GLint , GLsizei , GLsizei , GLsizei , GLint , GLenum , GLenum , const GLvoid *)>(context->getProcAddress("glTexImage3D"));
- TexSubImage3D = reinterpret_cast<void (QOPENGLF_APIENTRYP)(GLenum , GLint , GLint , GLint , GLint , GLsizei , GLsizei , GLsizei , GLenum , GLenum , const GLvoid *)>(context->getProcAddress("glTexSubImage3D"));
-
- // OpenGL 1.3
- CompressedTexImage3D = reinterpret_cast<void (QOPENGLF_APIENTRYP)(GLenum , GLint , GLenum , GLsizei , GLsizei , GLsizei , GLint , GLsizei , const GLvoid *)>(context->getProcAddress("glCompressedTexImage3D"));
- CompressedTexSubImage3D = reinterpret_cast<void (QOPENGLF_APIENTRYP)(GLenum , GLint , GLint , GLint , GLint , GLsizei , GLsizei , GLsizei , GLenum , GLsizei , const GLvoid *)>(context->getProcAddress("glCompressedTexSubImage3D"));
- }
- }
-
-#ifndef QT_OPENGL_ES_2
- // OpenGL 1.0 and 1.1
- TexImage1D = reinterpret_cast<void (QOPENGLF_APIENTRYP)(GLenum , GLint , GLint , GLsizei , GLint , GLenum , GLenum , const GLvoid *)>(context->getProcAddress("glTexImage1D"));
- TexSubImage1D = reinterpret_cast<void (QOPENGLF_APIENTRYP)(GLenum , GLint , GLint , GLsizei , GLenum , GLenum , const GLvoid *)>(context->getProcAddress("glTexSubImage1D"));\
-
- // OpenGL 1.3
- GetCompressedTexImage = reinterpret_cast<void (QOPENGLF_APIENTRYP)(GLenum , GLint , GLvoid *)>(context->getProcAddress("glGetCompressedTexImage"));
- CompressedTexSubImage1D = reinterpret_cast<void (QOPENGLF_APIENTRYP)(GLenum , GLint , GLint , GLsizei , GLenum , GLsizei , const GLvoid *)>(context->getProcAddress("glCompressedTexSubImage1D"));
- CompressedTexSubImage2D = reinterpret_cast<void (QOPENGLF_APIENTRYP)(GLenum , GLint , GLint , GLint , GLsizei , GLsizei , GLenum , GLsizei , const GLvoid *)>(context->getProcAddress("glCompressedTexSubImage2D"));
- CompressedTexImage1D = reinterpret_cast<void (QOPENGLF_APIENTRYP)(GLenum , GLint , GLenum , GLsizei , GLint , GLsizei , const GLvoid *)>(context->getProcAddress("glCompressedTexImage1D"));
- CompressedTexImage2D = reinterpret_cast<void (QOPENGLF_APIENTRYP)(GLenum , GLint , GLenum , GLsizei , GLsizei , GLint , GLsizei , const GLvoid *)>(context->getProcAddress("glCompressedTexImage2D"));
- ActiveTexture = reinterpret_cast<void (QOPENGLF_APIENTRYP)(GLenum )>(context->getProcAddress("glActiveTexture"));
-
- // OpenGL 3.0
- GenerateMipmap = reinterpret_cast<void (QOPENGLF_APIENTRYP)(GLenum )>(context->getProcAddress("glGenerateMipmap"));
-
- // OpenGL 3.2
- TexImage3DMultisample = reinterpret_cast<void (QOPENGLF_APIENTRYP)(GLenum , GLsizei , GLint , GLsizei , GLsizei , GLsizei , GLboolean )>(context->getProcAddress("glTexImage3DMultisample"));
- TexImage2DMultisample = reinterpret_cast<void (QOPENGLF_APIENTRYP)(GLenum , GLsizei , GLint , GLsizei , GLsizei , GLboolean )>(context->getProcAddress("glTexImage2DMultisample"));
-
- // OpenGL 4.2
- TexStorage3D = reinterpret_cast<void (QOPENGLF_APIENTRYP)(GLenum , GLsizei , GLenum , GLsizei , GLsizei , GLsizei )>(context->getProcAddress("glTexStorage3D"));
- TexStorage2D = reinterpret_cast<void (QOPENGLF_APIENTRYP)(GLenum , GLsizei , GLenum , GLsizei , GLsizei )>(context->getProcAddress("glTexStorage2D"));
- TexStorage1D = reinterpret_cast<void (QOPENGLF_APIENTRYP)(GLenum , GLsizei , GLenum , GLsizei )>(context->getProcAddress("glTexStorage1D"));
-
- // OpenGL 4.3
- TexStorage3DMultisample = reinterpret_cast<void (QOPENGLF_APIENTRYP)(GLenum , GLsizei , GLenum , GLsizei , GLsizei , GLsizei , GLboolean )>(context->getProcAddress("glTexStorage3DMultisample"));
- TexStorage2DMultisample = reinterpret_cast<void (QOPENGLF_APIENTRYP)(GLenum , GLsizei , GLenum , GLsizei , GLsizei , GLboolean )>(context->getProcAddress("glTexStorage2DMultisample"));
- TexBufferRange = reinterpret_cast<void (QOPENGLF_APIENTRYP)(GLenum , GLenum , GLuint , GLintptr , GLsizeiptr )>(context->getProcAddress("glTexBufferRange"));
- TextureView = reinterpret_cast<void (QOPENGLF_APIENTRYP)(GLuint , GLenum , GLuint , GLenum , GLuint , GLuint , GLuint , GLuint )>(context->getProcAddress("glTextureView"));
-#endif
-}
-
-void QOpenGLTextureHelper::dsa_TextureParameteri(GLuint texture, GLenum target, GLenum bindingTarget, GLenum pname, GLint param)
-{
- Q_UNUSED(bindingTarget);
- TextureParameteriEXT(texture, target, pname, param);
-}
-
-void QOpenGLTextureHelper::dsa_TextureParameteriv(GLuint texture, GLenum target, GLenum bindingTarget, GLenum pname, const GLint *params)
-{
- Q_UNUSED(bindingTarget);
- TextureParameterivEXT(texture, target, pname, params);
-}
-
-void QOpenGLTextureHelper::dsa_TextureParameterf(GLuint texture, GLenum target, GLenum bindingTarget, GLenum pname, GLfloat param)
-{
- Q_UNUSED(bindingTarget);
- TextureParameterfEXT(texture, target, pname, param);
-}
-
-void QOpenGLTextureHelper::dsa_TextureParameterfv(GLuint texture, GLenum target, GLenum bindingTarget, GLenum pname, const GLfloat *params)
-{
- Q_UNUSED(bindingTarget);
- TextureParameterfvEXT(texture, target, pname, params);
-}
-
-void QOpenGLTextureHelper::dsa_GenerateTextureMipmap(GLuint texture, GLenum target, GLenum bindingTarget)
-{
- Q_UNUSED(bindingTarget);
- GenerateTextureMipmapEXT(texture, target);
-}
-
-void QOpenGLTextureHelper::dsa_TextureStorage3D(GLuint texture, GLenum target, GLenum bindingTarget, GLsizei levels, GLenum internalFormat, GLsizei width, GLsizei height, GLsizei depth)
-{
- Q_UNUSED(bindingTarget);
- TextureStorage3DEXT(texture, target, levels, internalFormat, width, height, depth);
-}
-
-void QOpenGLTextureHelper::dsa_TextureStorage2D(GLuint texture, GLenum target, GLenum bindingTarget, GLsizei levels, GLenum internalFormat, GLsizei width, GLsizei height)
-{
- Q_UNUSED(bindingTarget);
- TextureStorage2DEXT(texture, target, levels, internalFormat, width, height);
-}
-
-void QOpenGLTextureHelper::dsa_TextureStorage1D(GLuint texture, GLenum target, GLenum bindingTarget, GLsizei levels, GLenum internalFormat, GLsizei width)
-{
- Q_UNUSED(bindingTarget);
- TextureStorage1DEXT(texture, target, levels, internalFormat, width);
-}
-
-void QOpenGLTextureHelper::dsa_TextureStorage3DMultisample(GLuint texture, GLenum target, GLenum bindingTarget, GLsizei samples, GLenum internalFormat, GLsizei width, GLsizei height, GLsizei depth, GLboolean fixedSampleLocations)
-{
- Q_UNUSED(bindingTarget);
- TextureStorage3DMultisampleEXT(texture, target, samples, internalFormat, width, height, depth, fixedSampleLocations);
-}
-
-void QOpenGLTextureHelper::dsa_TextureStorage2DMultisample(GLuint texture, GLenum target, GLenum bindingTarget, GLsizei samples, GLenum internalFormat, GLsizei width, GLsizei height, GLboolean fixedSampleLocations)
-{
- Q_UNUSED(bindingTarget);
- TextureStorage2DMultisampleEXT(texture, target, samples, internalFormat, width, height, fixedSampleLocations);
-}
-
-void QOpenGLTextureHelper::dsa_TextureImage3D(GLuint texture, GLenum target, GLenum bindingTarget, GLint level, GLenum internalFormat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLenum format, GLenum type, const GLvoid *pixels)
-{
- Q_UNUSED(bindingTarget);
- TextureImage3DEXT(texture, target, level, internalFormat, width, height, depth, border, format, type, pixels);
-}
-
-void QOpenGLTextureHelper::dsa_TextureImage2D(GLuint texture, GLenum target, GLenum bindingTarget, GLint level, GLenum internalFormat, GLsizei width, GLsizei height, GLint border, GLenum format, GLenum type, const GLvoid *pixels)
-{
- Q_UNUSED(bindingTarget);
- TextureImage2DEXT(texture, target, level, internalFormat, width, height, border, format, type, pixels);
-}
-
-void QOpenGLTextureHelper::dsa_TextureImage1D(GLuint texture, GLenum target, GLenum bindingTarget, GLint level, GLenum internalFormat, GLsizei width, GLint border, GLenum format, GLenum type, const GLvoid *pixels)
-{
- Q_UNUSED(bindingTarget);
- TextureImage1DEXT(texture, target, level, internalFormat, width, border, format, type, pixels);
-}
-
-void QOpenGLTextureHelper::dsa_TextureSubImage3D(GLuint texture, GLenum target, GLenum bindingTarget, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLenum type, const GLvoid *pixels)
-{
- Q_UNUSED(bindingTarget);
- TextureSubImage3DEXT(texture, target, level, xoffset, yoffset, zoffset, width, height, depth, format, type, pixels);
-}
-
-void QOpenGLTextureHelper::dsa_TextureSubImage2D(GLuint texture, GLenum target, GLenum bindingTarget, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLenum type, const GLvoid *pixels)
-{
- Q_UNUSED(bindingTarget);
- TextureSubImage2DEXT(texture, target, level, xoffset, yoffset, width, height, format, type, pixels);
-}
-
-void QOpenGLTextureHelper::dsa_TextureSubImage1D(GLuint texture, GLenum target, GLenum bindingTarget, GLint level, GLint xoffset, GLsizei width, GLenum format, GLenum type, const GLvoid *pixels)
-{
- Q_UNUSED(bindingTarget);
- TextureSubImage1DEXT(texture, target, level, xoffset, width, format, type, pixels);
-}
-
-void QOpenGLTextureHelper::dsa_TextureImage3DMultisample(GLuint texture, GLenum target, GLenum bindingTarget, GLsizei samples, GLint internalFormat, GLsizei width, GLsizei height, GLsizei depth, GLboolean fixedSampleLocations)
-{
- Q_UNUSED(bindingTarget);
- TextureImage3DMultisampleNV(texture, target, samples, internalFormat, width, height, depth, fixedSampleLocations);
-}
-
-void QOpenGLTextureHelper::dsa_TextureImage2DMultisample(GLuint texture, GLenum target, GLenum bindingTarget, GLsizei samples, GLint internalFormat, GLsizei width, GLsizei height, GLboolean fixedSampleLocations)
-{
- Q_UNUSED(bindingTarget);
- TextureImage2DMultisampleNV(texture, target, samples, internalFormat, width, height, fixedSampleLocations);
-}
-
-void QOpenGLTextureHelper::dsa_CompressedTextureSubImage1D(GLuint texture, GLenum target, GLenum bindingTarget, GLint level, GLint xoffset, GLsizei width, GLenum format, GLsizei imageSize, const GLvoid *bits)
-{
- Q_UNUSED(bindingTarget);
- CompressedTextureSubImage1DEXT(texture, target, level, xoffset, width, format, imageSize, bits);
-}
-
-void QOpenGLTextureHelper::dsa_CompressedTextureSubImage2D(GLuint texture, GLenum target, GLenum bindingTarget, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLsizei imageSize, const GLvoid *bits)
-{
- Q_UNUSED(bindingTarget);
- CompressedTextureSubImage2DEXT(texture, target, level, xoffset, yoffset, width, height, format, imageSize, bits);
-}
-
-void QOpenGLTextureHelper::dsa_CompressedTextureSubImage3D(GLuint texture, GLenum target, GLenum bindingTarget, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLsizei imageSize, const GLvoid *bits)
-{
- Q_UNUSED(bindingTarget);
- CompressedTextureSubImage3DEXT(texture, target, level, xoffset, yoffset, zoffset, width, height, depth, format, imageSize, bits);
-}
-
-void QOpenGLTextureHelper::dsa_CompressedTextureImage1D(GLuint texture, GLenum target, GLenum bindingTarget, GLint level, GLenum internalFormat, GLsizei width, GLint border, GLsizei imageSize, const GLvoid *bits)
-{
- Q_UNUSED(bindingTarget);
- CompressedTextureImage1DEXT(texture, target, level, internalFormat, width, border, imageSize, bits);
-}
-
-void QOpenGLTextureHelper::dsa_CompressedTextureImage2D(GLuint texture, GLenum target, GLenum bindingTarget, GLint level, GLenum internalFormat, GLsizei width, GLsizei height, GLint border, GLsizei imageSize, const GLvoid *bits)
-{
- Q_UNUSED(bindingTarget);
- CompressedTextureImage2DEXT(texture, target, level, internalFormat, width, height, border, imageSize, bits);
-}
-
-void QOpenGLTextureHelper::dsa_CompressedTextureImage3D(GLuint texture, GLenum target, GLenum bindingTarget, GLint level, GLenum internalFormat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLsizei imageSize, const GLvoid *bits)
-{
- Q_UNUSED(bindingTarget);
- CompressedTextureImage3DEXT(texture, target, level, internalFormat, width, height, depth, border, imageSize, bits);
-}
-
-namespace {
-
-class TextureBinder
-{
-public:
- TextureBinder(QOpenGLFunctions *functions, GLuint texture, GLenum target, GLenum bindingTarget)
- : m_functions(functions)
- {
- // For cubemaps we can't use the standard DSA emulation as it is illegal to
- // try to bind a texture to one of the cubemap face targets. So we force the
- // target and binding target to the cubemap values in this case.
- switch (target) {
- case GL_TEXTURE_CUBE_MAP_NEGATIVE_X:
- case GL_TEXTURE_CUBE_MAP_POSITIVE_X:
- case GL_TEXTURE_CUBE_MAP_NEGATIVE_Y:
- case GL_TEXTURE_CUBE_MAP_POSITIVE_Y:
- case GL_TEXTURE_CUBE_MAP_NEGATIVE_Z:
- case GL_TEXTURE_CUBE_MAP_POSITIVE_Z:
- bindingTarget = GL_TEXTURE_BINDING_CUBE_MAP;
- m_target = GL_TEXTURE_CUBE_MAP;
- break;
-
- default:
- m_target = target;
- break;
- }
-
- m_functions->glGetIntegerv(bindingTarget, &m_oldTexture);
- m_functions->glBindTexture(m_target, texture);
- }
-
- ~TextureBinder()
- {
- m_functions->glBindTexture(m_target, m_oldTexture);
- }
-
-private:
- QOpenGLFunctions *m_functions;
- GLenum m_target;
- GLint m_oldTexture;
-};
-
-} // namespace
-
-void QOpenGLTextureHelper::qt_TextureParameteri(GLuint texture, GLenum target, GLenum bindingTarget, GLenum pname, GLint param)
-{
- TextureBinder binder(functions, texture, target, bindingTarget);
- functions->glTexParameteri(target, pname, param);
-}
-
-void QOpenGLTextureHelper::qt_TextureParameteriv(GLuint texture, GLenum target, GLenum bindingTarget, GLenum pname, const GLint *params)
-{
- TextureBinder binder(functions, texture, target, bindingTarget);
- functions->glTexParameteriv(target, pname, params);
-}
-
-void QOpenGLTextureHelper::qt_TextureParameterf(GLuint texture, GLenum target, GLenum bindingTarget, GLenum pname, GLfloat param)
-{
- TextureBinder binder(functions, texture, target, bindingTarget);
- functions->glTexParameterf(target, pname, param);
-}
-
-void QOpenGLTextureHelper::qt_TextureParameterfv(GLuint texture, GLenum target, GLenum bindingTarget, GLenum pname, const GLfloat *params)
-{
- TextureBinder binder(functions, texture, target, bindingTarget);
- functions->glTexParameterfv(target, pname, params);
-}
-
-void QOpenGLTextureHelper::qt_GenerateTextureMipmap(GLuint texture, GLenum target, GLenum bindingTarget)
-{
- TextureBinder binder(functions, texture, target, bindingTarget);
- functions->glGenerateMipmap(target);
-}
-
-void QOpenGLTextureHelper::qt_TextureStorage3D(GLuint texture, GLenum target, GLenum bindingTarget, GLsizei levels, GLenum internalFormat, GLsizei width, GLsizei height, GLsizei depth)
-{
- TextureBinder binder(functions, texture, target, bindingTarget);
- glTexStorage3D(target, levels, internalFormat, width, height, depth);
-}
-
-void QOpenGLTextureHelper::qt_TextureStorage2D(GLuint texture, GLenum target, GLenum bindingTarget, GLsizei levels, GLenum internalFormat, GLsizei width, GLsizei height)
-{
- TextureBinder binder(functions, texture, target, bindingTarget);
- glTexStorage2D(target, levels, internalFormat, width, height);
-}
-
-void QOpenGLTextureHelper::qt_TextureStorage1D(GLuint texture, GLenum target, GLenum bindingTarget, GLsizei levels, GLenum internalFormat, GLsizei width)
-{
- TextureBinder binder(functions, texture, target, bindingTarget);
- glTexStorage1D(target, levels, internalFormat, width);
-}
-
-void QOpenGLTextureHelper::qt_TextureStorage3DMultisample(GLuint texture, GLenum target, GLenum bindingTarget, GLsizei samples, GLenum internalFormat, GLsizei width, GLsizei height, GLsizei depth, GLboolean fixedSampleLocations)
-{
- TextureBinder binder(functions, texture, target, bindingTarget);
- glTexStorage3DMultisample(target, samples, internalFormat, width, height, depth, fixedSampleLocations);
-}
-
-void QOpenGLTextureHelper::qt_TextureStorage2DMultisample(GLuint texture, GLenum target, GLenum bindingTarget, GLsizei samples, GLenum internalFormat, GLsizei width, GLsizei height, GLboolean fixedSampleLocations)
-{
- TextureBinder binder(functions, texture, target, bindingTarget);
- glTexStorage2DMultisample(target, samples, internalFormat, width, height, fixedSampleLocations);
-}
-
-void QOpenGLTextureHelper::qt_TextureImage3D(GLuint texture, GLenum target, GLenum bindingTarget, GLint level, GLenum internalFormat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLenum format, GLenum type, const GLvoid *pixels)
-{
- TextureBinder binder(functions, texture, target, bindingTarget);
- glTexImage3D(target, level, internalFormat, width, height, depth, border, format, type, pixels);
-}
-
-void QOpenGLTextureHelper::qt_TextureImage2D(GLuint texture, GLenum target, GLenum bindingTarget, GLint level, GLenum internalFormat, GLsizei width, GLsizei height, GLint border, GLenum format, GLenum type, const GLvoid *pixels)
-{
- TextureBinder binder(functions, texture, target, bindingTarget);
- functions->glTexImage2D(target, level, internalFormat, width, height, border, format, type, pixels);
-}
-
-void QOpenGLTextureHelper::qt_TextureImage1D(GLuint texture, GLenum target, GLenum bindingTarget, GLint level, GLenum internalFormat, GLsizei width, GLint border, GLenum format, GLenum type, const GLvoid *pixels)
-{
- TextureBinder binder(functions, texture, target, bindingTarget);
- glTexImage1D(target, level, internalFormat, width, border, format, type, pixels);
-}
-
-void QOpenGLTextureHelper::qt_TextureSubImage3D(GLuint texture, GLenum target, GLenum bindingTarget, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLenum type, const GLvoid *pixels)
-{
- TextureBinder binder(functions, texture, target, bindingTarget);
- glTexSubImage3D(target, level, xoffset, yoffset, zoffset, width, height, depth, format, type, pixels);
-}
-
-void QOpenGLTextureHelper::qt_TextureSubImage2D(GLuint texture, GLenum target, GLenum bindingTarget, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLenum type, const GLvoid *pixels)
-{
- TextureBinder binder(functions, texture, target, bindingTarget);
- functions->glTexSubImage2D(target, level, xoffset, yoffset, width, height, format, type, pixels);
-}
-
-void QOpenGLTextureHelper::qt_TextureSubImage1D(GLuint texture, GLenum target, GLenum bindingTarget, GLint level, GLint xoffset, GLsizei width, GLenum format, GLenum type, const GLvoid *pixels)
-{
- TextureBinder binder(functions, texture, target, bindingTarget);
- glTexSubImage1D(target, level, xoffset, width, format, type, pixels);
-}
-
-void QOpenGLTextureHelper::qt_TextureImage3DMultisample(GLuint texture, GLenum target, GLenum bindingTarget, GLsizei samples, GLint internalFormat, GLsizei width, GLsizei height, GLsizei depth, GLboolean fixedSampleLocations)
-{
- TextureBinder binder(functions, texture, target, bindingTarget);
- glTexImage3DMultisample(target, samples, internalFormat, width, height, depth, fixedSampleLocations);
-}
-
-void QOpenGLTextureHelper::qt_TextureImage2DMultisample(GLuint texture, GLenum target, GLenum bindingTarget, GLsizei samples, GLint internalFormat, GLsizei width, GLsizei height, GLboolean fixedSampleLocations)
-{
- TextureBinder binder(functions, texture, target, bindingTarget);
- glTexImage2DMultisample(target, samples, internalFormat, width, height, fixedSampleLocations);
-}
-
-void QOpenGLTextureHelper::qt_CompressedTextureSubImage1D(GLuint texture, GLenum target, GLenum bindingTarget, GLint level, GLint xoffset, GLsizei width, GLenum format, GLsizei imageSize, const GLvoid *bits)
-{
- TextureBinder binder(functions, texture, target, bindingTarget);
- glCompressedTexSubImage1D(target, level, xoffset, width, format, imageSize, bits);
-}
-
-void QOpenGLTextureHelper::qt_CompressedTextureSubImage2D(GLuint texture, GLenum target, GLenum bindingTarget, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLsizei imageSize, const GLvoid *bits)
-{
- TextureBinder binder(functions, texture, target, bindingTarget);
- glCompressedTexSubImage2D(target, level, xoffset, yoffset, width, height, format, imageSize, bits);
-}
-
-void QOpenGLTextureHelper::qt_CompressedTextureSubImage3D(GLuint texture, GLenum target, GLenum bindingTarget, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLsizei imageSize, const GLvoid *bits)
-{
- TextureBinder binder(functions, texture, target, bindingTarget);
- glCompressedTexSubImage3D(target, level, xoffset, yoffset, zoffset, width, height, depth, format, imageSize, bits);
-}
-
-void QOpenGLTextureHelper::qt_CompressedTextureImage1D(GLuint texture, GLenum target, GLenum bindingTarget, GLint level, GLenum internalFormat, GLsizei width, GLint border, GLsizei imageSize, const GLvoid *bits)
-{
- TextureBinder binder(functions, texture, target, bindingTarget);
- glCompressedTexImage1D(target, level, internalFormat, width, border, imageSize, bits);
-}
-
-void QOpenGLTextureHelper::qt_CompressedTextureImage2D(GLuint texture, GLenum target, GLenum bindingTarget, GLint level, GLenum internalFormat, GLsizei width, GLsizei height, GLint border, GLsizei imageSize, const GLvoid *bits)
-{
- TextureBinder binder(functions, texture, target, bindingTarget);
- glCompressedTexImage2D(target, level, internalFormat, width, height, border, imageSize, bits);
-}
-
-void QOpenGLTextureHelper::qt_CompressedTextureImage3D(GLuint texture, GLenum target, GLenum bindingTarget, GLint level, GLenum internalFormat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLsizei imageSize, const GLvoid *bits)
-{
- TextureBinder binder(functions, texture, target, bindingTarget);
- glCompressedTexImage3D(target, level, internalFormat, width, height, depth, border, imageSize, bits);
-}
-
-QT_END_NAMESPACE
diff --git a/src/gui/opengl/qopengltexturehelper_p.h b/src/gui/opengl/qopengltexturehelper_p.h
deleted file mode 100644
index 62d0125daf..0000000000
--- a/src/gui/opengl/qopengltexturehelper_p.h
+++ /dev/null
@@ -1,797 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2013 Klaralvdalens Datakonsult AB (KDAB).
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the QtGui module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef QOPENGLTEXTUREHELPER_P_H
-#define QOPENGLTEXTUREHELPER_P_H
-
-//
-// W A R N I N G
-// -------------
-//
-// This file is not part of the Qt API. It exists purely as an
-// implementation detail. This header file may change from version to
-// version without notice, or even be removed.
-//
-// We mean it.
-//
-
-#include <QtGui/private/qtguiglobal_p.h>
-
-#ifndef QT_NO_OPENGL
-
-#include "qopengl.h"
-#include "qopenglpixeltransferoptions.h"
-#include "qopengltexture.h"
-#include "qopenglfunctions.h"
-
-QT_BEGIN_NAMESPACE
-
-// Constants for OpenGL and OpenGL ES 3.0+ which are not available with OpenGL ES 2.0.
-#ifndef GL_TEXTURE_BASE_LEVEL
-#define GL_TEXTURE_BASE_LEVEL 0x813C
-#endif
-#ifndef GL_TEXTURE_MAX_LEVEL
-#define GL_TEXTURE_MAX_LEVEL 0x813D
-#endif
-#ifndef GL_TEXTURE_COMPARE_MODE
-#define GL_TEXTURE_COMPARE_MODE 0x884C
-#endif
-#ifndef GL_TEXTURE_COMPARE_FUNC
-#define GL_TEXTURE_COMPARE_FUNC 0x884D
-#endif
-
-// use GL_APICALL only on Android + __clang__
-#if !defined(Q_OS_ANDROID) || !defined(__clang__)
-# undef GL_APICALL
-# define GL_APICALL
-#elif !defined(GL_APICALL)
-# define GL_APICALL
-#endif
-
-class QOpenGLContext;
-
-class QOpenGLTextureHelper
-{
-public:
- QOpenGLTextureHelper(QOpenGLContext *context);
-
- // DSA-like API. Will either use real DSA or our emulation
- inline void glTextureParameteri(GLuint texture, GLenum target, GLenum bindingTarget, GLenum pname, GLint param)
- {
- (this->*TextureParameteri)(texture, target, bindingTarget, pname, param);
- }
-
- inline void glTextureParameteriv(GLuint texture, GLenum target, GLenum bindingTarget, GLenum pname, const GLint *params)
- {
- (this->*TextureParameteriv)(texture, target, bindingTarget, pname, params);
- }
-
- inline void glTextureParameterf(GLuint texture, GLenum target, GLenum bindingTarget, GLenum pname, GLfloat param)
- {
- (this->*TextureParameterf)(texture, target, bindingTarget, pname, param);
- }
-
- inline void glTextureParameterfv(GLuint texture, GLenum target, GLenum bindingTarget, GLenum pname, const GLfloat *params)
- {
- (this->*TextureParameterfv)(texture, target, bindingTarget, pname, params);
- }
-
- inline void glGenerateTextureMipmap(GLuint texture, GLenum target, GLenum bindingTarget)
- {
- (this->*GenerateTextureMipmap)(texture, target, bindingTarget);
- }
-
- inline void glTextureStorage3D(GLuint texture, GLenum target, GLenum bindingTarget, GLsizei levels, GLenum internalFormat,
- GLsizei width, GLsizei height, GLsizei depth)
- {
- (this->*TextureStorage3D)(texture, target, bindingTarget, levels, internalFormat, width, height, depth);
- }
-
- inline void glTextureStorage2D(GLuint texture, GLenum target, GLenum bindingTarget, GLsizei levels, GLenum internalFormat,
- GLsizei width, GLsizei height)
- {
- (this->*TextureStorage2D)(texture, target, bindingTarget, levels, internalFormat, width, height);
- }
-
- inline void glTextureStorage1D(GLuint texture, GLenum target, GLenum bindingTarget, GLsizei levels, GLenum internalFormat,
- GLsizei width)
- {
- (this->*TextureStorage1D)(texture, target, bindingTarget, levels, internalFormat, width);
- }
-
- inline void glTextureStorage3DMultisample(GLuint texture, GLenum target, GLenum bindingTarget, GLsizei samples, GLenum internalFormat,
- GLsizei width, GLsizei height, GLsizei depth, GLboolean fixedSampleLocations)
- {
- (this->*TextureStorage3DMultisample)(texture, target, bindingTarget, samples, internalFormat, width, height, depth, fixedSampleLocations);
- }
-
- inline void glTextureStorage2DMultisample(GLuint texture, GLenum target, GLenum bindingTarget, GLsizei samples, GLenum internalFormat,
- GLsizei width, GLsizei height, GLboolean fixedSampleLocations)
- {
- (this->*TextureStorage2DMultisample)(texture, target, bindingTarget, samples, internalFormat, width, height, fixedSampleLocations);
- }
-
- inline void glTextureImage3D(GLuint texture, GLenum target, GLenum bindingTarget, GLint level, GLenum internalFormat,
- GLsizei width, GLsizei height, GLsizei depth, GLint border, GLenum format, GLenum type, const GLvoid *pixels)
- {
- (this->*TextureImage3D)(texture, target, bindingTarget, level, internalFormat, width, height, depth, border, format, type, pixels);
- }
-
- inline void glTextureImage2D(GLuint texture, GLenum target, GLenum bindingTarget, GLint level, GLenum internalFormat,
- GLsizei width, GLsizei height, GLint border, GLenum format, GLenum type, const GLvoid *pixels)
- {
- (this->*TextureImage2D)(texture, target, bindingTarget, level, internalFormat, width, height, border, format, type, pixels);
- }
-
- inline void glTextureImage1D(GLuint texture, GLenum target, GLenum bindingTarget, GLint level, GLenum internalFormat,
- GLsizei width, GLint border, GLenum format, GLenum type, const GLvoid *pixels)
- {
- (this->*TextureImage1D)(texture, target, bindingTarget, level, internalFormat, width, border, format, type, pixels);
- }
-
- inline void glTextureSubImage3D(GLuint texture, GLenum target, GLenum bindingTarget, GLint level, GLint xoffset, GLint yoffset, GLint zoffset,
- GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLenum type,
- const GLvoid *pixels, const QOpenGLPixelTransferOptions * const options = nullptr)
- {
- if (options) {
- QOpenGLPixelTransferOptions oldOptions = savePixelUploadOptions();
- setPixelUploadOptions(*options);
- (this->*TextureSubImage3D)(texture, target, bindingTarget, level, xoffset, yoffset, zoffset, width, height, depth, format, type, pixels);
- setPixelUploadOptions(oldOptions);
- } else {
- (this->*TextureSubImage3D)(texture, target, bindingTarget, level, xoffset, yoffset, zoffset, width, height, depth, format, type, pixels);
- }
- }
-
- inline void glTextureSubImage2D(GLuint texture, GLenum target, GLenum bindingTarget, GLint level, GLint xoffset, GLint yoffset,
- GLsizei width, GLsizei height, GLenum format, GLenum type,
- const GLvoid *pixels, const QOpenGLPixelTransferOptions * const options = nullptr)
- {
- if (options) {
- QOpenGLPixelTransferOptions oldOptions = savePixelUploadOptions();
- setPixelUploadOptions(*options);
- (this->*TextureSubImage2D)(texture, target, bindingTarget, level, xoffset, yoffset, width, height, format, type, pixels);
- setPixelUploadOptions(oldOptions);
- } else {
- (this->*TextureSubImage2D)(texture, target, bindingTarget, level, xoffset, yoffset, width, height, format, type, pixels);
- }
- }
-
- inline void glTextureSubImage1D(GLuint texture, GLenum target, GLenum bindingTarget, GLint level, GLint xoffset,
- GLsizei width, GLenum format, GLenum type,
- const GLvoid *pixels, const QOpenGLPixelTransferOptions * const options = nullptr)
- {
- if (options) {
- QOpenGLPixelTransferOptions oldOptions = savePixelUploadOptions();
- setPixelUploadOptions(*options);
- (this->*TextureSubImage1D)(texture, target, bindingTarget, level, xoffset, width, format, type, pixels);
- setPixelUploadOptions(oldOptions);
- } else {
- (this->*TextureSubImage1D)(texture, target, bindingTarget, level, xoffset, width, format, type, pixels);
- }
- }
-
- inline void glTextureImage3DMultisample(GLuint texture, GLenum target, GLenum bindingTarget, GLsizei samples, GLint internalFormat,
- GLsizei width, GLsizei height, GLsizei depth, GLboolean fixedSampleLocations)
- {
- (this->*TextureImage3DMultisample)(texture, target, bindingTarget, samples, internalFormat, width, height, depth, fixedSampleLocations);
- }
-
- inline void glTextureImage2DMultisample(GLuint texture, GLenum target, GLenum bindingTarget, GLsizei samples, GLint internalFormat,
- GLsizei width, GLsizei height, GLboolean fixedSampleLocations)
- {
- (this->*TextureImage2DMultisample)(texture, target, bindingTarget, samples, internalFormat, width, height, fixedSampleLocations);
- }
-
- inline void glCompressedTextureSubImage1D(GLuint texture, GLenum target, GLenum bindingTarget, GLint level,
- GLint xoffset, GLsizei width,
- GLenum format, GLsizei imageSize, const GLvoid *bits,
- const QOpenGLPixelTransferOptions * const options = nullptr)
- {
- if (options) {
- QOpenGLPixelTransferOptions oldOptions = savePixelUploadOptions();
- setPixelUploadOptions(*options);
- (this->*CompressedTextureSubImage1D)(texture, target, bindingTarget, level, xoffset, width, format, imageSize, bits);
- setPixelUploadOptions(oldOptions);
- } else {
- (this->*CompressedTextureSubImage1D)(texture, target, bindingTarget, level, xoffset, width, format, imageSize, bits);
- }
- }
-
- inline void glCompressedTextureSubImage2D(GLuint texture, GLenum target, GLenum bindingTarget, GLint level,
- GLint xoffset, GLint yoffset,
- GLsizei width, GLsizei height,
- GLenum format, GLsizei imageSize, const GLvoid *bits,
- const QOpenGLPixelTransferOptions * const options = nullptr)
- {
- if (options) {
- QOpenGLPixelTransferOptions oldOptions = savePixelUploadOptions();
- setPixelUploadOptions(*options);
- (this->*CompressedTextureSubImage2D)(texture, target, bindingTarget, level, xoffset, yoffset, width, height, format, imageSize, bits);
- setPixelUploadOptions(oldOptions);
- } else {
- (this->*CompressedTextureSubImage2D)(texture, target, bindingTarget, level, xoffset, yoffset, width, height, format, imageSize, bits);
- }
- }
-
- inline void glCompressedTextureSubImage3D(GLuint texture, GLenum target, GLenum bindingTarget, GLint level,
- GLint xoffset, GLint yoffset, GLint zoffset,
- GLsizei width, GLsizei height, GLsizei depth,
- GLenum format, GLsizei imageSize, const GLvoid *bits,
- const QOpenGLPixelTransferOptions * const options = nullptr)
- {
- if (options) {
- QOpenGLPixelTransferOptions oldOptions = savePixelUploadOptions();
- setPixelUploadOptions(*options);
- (this->*CompressedTextureSubImage3D)(texture, target, bindingTarget, level, xoffset, yoffset, zoffset, width, height, depth, format, imageSize, bits);
- setPixelUploadOptions(oldOptions);
- } else {
- (this->*CompressedTextureSubImage3D)(texture, target, bindingTarget, level, xoffset, yoffset, zoffset, width, height, depth, format, imageSize, bits);
- }
- }
-
- inline void glCompressedTextureImage1D(GLuint texture, GLenum target, GLenum bindingTarget, GLint level,
- GLenum internalFormat, GLsizei width,
- GLint border, GLsizei imageSize, const GLvoid *bits,
- const QOpenGLPixelTransferOptions * const options = nullptr)
- {
- if (options) {
- QOpenGLPixelTransferOptions oldOptions = savePixelUploadOptions();
- setPixelUploadOptions(*options);
- (this->*CompressedTextureImage1D)(texture, target, bindingTarget, level, internalFormat, width, border, imageSize, bits);
- setPixelUploadOptions(oldOptions);
- } else {
- (this->*CompressedTextureImage1D)(texture, target, bindingTarget, level, internalFormat, width, border, imageSize, bits);
- }
- }
-
- inline void glCompressedTextureImage2D(GLuint texture, GLenum target, GLenum bindingTarget, GLint level,
- GLenum internalFormat, GLsizei width, GLsizei height,
- GLint border, GLsizei imageSize, const GLvoid *bits,
- const QOpenGLPixelTransferOptions * const options = nullptr)
-
- {
- if (options) {
- QOpenGLPixelTransferOptions oldOptions = savePixelUploadOptions();
- setPixelUploadOptions(*options);
- (this->*CompressedTextureImage2D)(texture, target, bindingTarget, level, internalFormat, width, height, border, imageSize, bits);
- setPixelUploadOptions(oldOptions);
- } else {
- (this->*CompressedTextureImage2D)(texture, target, bindingTarget, level, internalFormat, width, height, border, imageSize, bits);
- }
- }
-
- inline void glCompressedTextureImage3D(GLuint texture, GLenum target, GLenum bindingTarget, GLint level,
- GLenum internalFormat, GLsizei width, GLsizei height, GLsizei depth,
- GLint border, GLsizei imageSize, const GLvoid *bits,
- const QOpenGLPixelTransferOptions * const options = nullptr)
- {
- if (options) {
- QOpenGLPixelTransferOptions oldOptions = savePixelUploadOptions();
- setPixelUploadOptions(*options);
- (this->*CompressedTextureImage3D)(texture, target, bindingTarget, level, internalFormat, width, height, depth, border, imageSize, bits);
- setPixelUploadOptions(oldOptions);
- } else {
- (this->*CompressedTextureImage3D)(texture, target, bindingTarget, level, internalFormat, width, height, depth, border, imageSize, bits);
- }
- }
-
-private:
- // DSA wrapper (so we can use pointer to member function as switch)
- void dsa_TextureParameteri(GLuint texture, GLenum target, GLenum bindingTarget, GLenum pname, GLint param);
-
- void dsa_TextureParameteriv(GLuint texture, GLenum target, GLenum bindingTarget, GLenum pname, const GLint *params);
-
- void dsa_TextureParameterf(GLuint texture, GLenum target, GLenum bindingTarget, GLenum pname, GLfloat param);
-
- void dsa_TextureParameterfv(GLuint texture, GLenum target, GLenum bindingTarget, GLenum pname, const GLfloat *params);
-
- void dsa_GenerateTextureMipmap(GLuint texture, GLenum target, GLenum bindingTarget);
-
- void dsa_TextureStorage3D(GLuint texture, GLenum target, GLenum bindingTarget, GLsizei levels, GLenum internalFormat,
- GLsizei width, GLsizei height, GLsizei depth);
-
- void dsa_TextureStorage2D(GLuint texture, GLenum target, GLenum bindingTarget, GLsizei levels, GLenum internalFormat,
- GLsizei width, GLsizei height);
-
- void dsa_TextureStorage1D(GLuint texture, GLenum target, GLenum bindingTarget, GLsizei levels, GLenum internalFormat,
- GLsizei width);
-
- void dsa_TextureStorage3DMultisample(GLuint texture, GLenum target, GLenum bindingTarget, GLsizei samples, GLenum internalFormat,
- GLsizei width, GLsizei height, GLsizei depth, GLboolean fixedSampleLocations);
-
- void dsa_TextureStorage2DMultisample(GLuint texture, GLenum target, GLenum bindingTarget, GLsizei samples, GLenum internalFormat,
- GLsizei width, GLsizei height, GLboolean fixedSampleLocations);
-
- void dsa_TextureImage3D(GLuint texture, GLenum target, GLenum bindingTarget, GLint level, GLenum internalFormat,
- GLsizei width, GLsizei height, GLsizei depth, GLint border, GLenum format, GLenum type, const GLvoid *pixels);
-
- void dsa_TextureImage2D(GLuint texture, GLenum target, GLenum bindingTarget, GLint level, GLenum internalFormat,
- GLsizei width, GLsizei height, GLint border, GLenum format, GLenum type, const GLvoid *pixels);
-
- void dsa_TextureImage1D(GLuint texture, GLenum target, GLenum bindingTarget, GLint level, GLenum internalFormat,
- GLsizei width, GLint border, GLenum format, GLenum type, const GLvoid *pixels);
-
- void dsa_TextureSubImage3D(GLuint texture, GLenum target, GLenum bindingTarget, GLint level, GLint xoffset, GLint yoffset, GLint zoffset,
- GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLenum type, const GLvoid *pixels);
-
- void dsa_TextureSubImage2D(GLuint texture, GLenum target, GLenum bindingTarget, GLint level, GLint xoffset, GLint yoffset,
- GLsizei width, GLsizei height, GLenum format, GLenum type, const GLvoid *pixels);
-
- void dsa_TextureSubImage1D(GLuint texture, GLenum target, GLenum bindingTarget, GLint level, GLint xoffset,
- GLsizei width, GLenum format, GLenum type, const GLvoid *pixels);
-
- void dsa_TextureImage3DMultisample(GLuint texture, GLenum target, GLenum bindingTarget, GLsizei samples, GLint internalFormat,
- GLsizei width, GLsizei height, GLsizei depth, GLboolean fixedSampleLocations);
-
- void dsa_TextureImage2DMultisample(GLuint texture, GLenum target, GLenum bindingTarget, GLsizei samples, GLint internalFormat,
- GLsizei width, GLsizei height, GLboolean fixedSampleLocations);
-
- void dsa_CompressedTextureSubImage1D(GLuint texture, GLenum target, GLenum bindingTarget, GLint level,
- GLint xoffset, GLsizei width,
- GLenum format, GLsizei imageSize, const GLvoid *bits);
-
- void dsa_CompressedTextureSubImage2D(GLuint texture, GLenum target, GLenum bindingTarget, GLint level,
- GLint xoffset, GLint yoffset,
- GLsizei width, GLsizei height,
- GLenum format, GLsizei imageSize, const GLvoid *bits);
-
- void dsa_CompressedTextureSubImage3D(GLuint texture, GLenum target, GLenum bindingTarget, GLint level,
- GLint xoffset, GLint yoffset, GLint zoffset,
- GLsizei width, GLsizei height, GLsizei depth,
- GLenum format, GLsizei imageSize, const GLvoid *bits);
-
- void dsa_CompressedTextureImage1D(GLuint texture, GLenum target, GLenum bindingTarget, GLint level,
- GLenum internalFormat, GLsizei width,
- GLint border, GLsizei imageSize, const GLvoid *bits);
-
- void dsa_CompressedTextureImage2D(GLuint texture, GLenum target, GLenum bindingTarget, GLint level,
- GLenum internalFormat, GLsizei width, GLsizei height,
- GLint border, GLsizei imageSize, const GLvoid *bits);
-
- void dsa_CompressedTextureImage3D(GLuint texture, GLenum target, GLenum bindingTarget, GLint level,
- GLenum internalFormat, GLsizei width, GLsizei height, GLsizei depth,
- GLint border, GLsizei imageSize, const GLvoid *bits);
-
- // DSA emulation API
- void qt_TextureParameteri(GLuint texture, GLenum target, GLenum bindingTarget, GLenum pname, GLint param);
-
- void qt_TextureParameteriv(GLuint texture, GLenum target, GLenum bindingTarget, GLenum pname, const GLint *params);
-
- void qt_TextureParameterf(GLuint texture, GLenum target, GLenum bindingTarget, GLenum pname, GLfloat param);
-
- void qt_TextureParameterfv(GLuint texture, GLenum target, GLenum bindingTarget, GLenum pname, const GLfloat *params);
-
- void qt_GenerateTextureMipmap(GLuint texture, GLenum target, GLenum bindingTarget);
-
- void qt_TextureStorage3D(GLuint texture, GLenum target, GLenum bindingTarget, GLsizei levels,
- GLenum internalFormat, GLsizei width, GLsizei height, GLsizei depth);
-
- void qt_TextureStorage2D(GLuint texture, GLenum target, GLenum bindingTarget, GLsizei levels,
- GLenum internalFormat, GLsizei width, GLsizei height);
-
- void qt_TextureStorage1D(GLuint texture, GLenum target, GLenum bindingTarget, GLsizei levels,
- GLenum internalFormat, GLsizei width);
-
- void qt_TextureStorage3DMultisample(GLuint texture, GLenum target, GLenum bindingTarget, GLsizei samples,
- GLenum internalFormat, GLsizei width, GLsizei height,
- GLsizei depth, GLboolean fixedSampleLocations);
-
- void qt_TextureStorage2DMultisample(GLuint texture, GLenum target, GLenum bindingTarget, GLsizei samples,
- GLenum internalFormat, GLsizei width, GLsizei height,
- GLboolean fixedSampleLocations);
-
- void qt_TextureImage3D(GLuint texture, GLenum target, GLenum bindingTarget, GLint level, GLenum internalFormat,
- GLsizei width, GLsizei height, GLsizei depth,
- GLint border, GLenum format, GLenum type,
- const GLvoid *pixels);
-
- void qt_TextureImage2D(GLuint texture, GLenum target, GLenum bindingTarget, GLint level, GLenum internalFormat,
- GLsizei width, GLsizei height,
- GLint border, GLenum format, GLenum type,
- const GLvoid *pixels);
-
- void qt_TextureImage1D(GLuint texture, GLenum target, GLenum bindingTarget, GLint level, GLenum internalFormat,
- GLsizei width, GLint border, GLenum format, GLenum type,
- const GLvoid *pixels);
-
- void qt_TextureSubImage3D(GLuint texture, GLenum target, GLenum bindingTarget, GLint level,
- GLint xoffset, GLint yoffset, GLint zoffset,
- GLsizei width, GLsizei height, GLsizei depth,
- GLenum format, GLenum type, const GLvoid *pixels);
-
- void qt_TextureSubImage2D(GLuint texture, GLenum target, GLenum bindingTarget, GLint level,
- GLint xoffset, GLint yoffset,
- GLsizei width, GLsizei height,
- GLenum format, GLenum type, const GLvoid *pixels);
-
- void qt_TextureSubImage1D(GLuint texture, GLenum target, GLenum bindingTarget, GLint level,
- GLint xoffset, GLsizei width,
- GLenum format, GLenum type, const GLvoid *pixels);
-
- void qt_TextureImage3DMultisample(GLuint texture, GLenum target, GLenum bindingTarget, GLsizei samples,
- GLint internalFormat, GLsizei width, GLsizei height, GLsizei depth,
- GLboolean fixedSampleLocations);
-
- void qt_TextureImage2DMultisample(GLuint texture, GLenum target, GLenum bindingTarget, GLsizei samples,
- GLint internalFormat, GLsizei width, GLsizei height,
- GLboolean fixedSampleLocations);
-
- void qt_CompressedTextureSubImage1D(GLuint texture, GLenum target, GLenum bindingTarget, GLint level,
- GLint xoffset, GLsizei width, GLenum format,
- GLsizei imageSize, const GLvoid *bits);
-
- void qt_CompressedTextureSubImage2D(GLuint texture, GLenum target, GLenum bindingTarget, GLint level,
- GLint xoffset, GLint yoffset,
- GLsizei width, GLsizei height,
- GLenum format, GLsizei imageSize, const GLvoid *bits);
-
- void qt_CompressedTextureSubImage3D(GLuint texture, GLenum target, GLenum bindingTarget, GLint level,
- GLint xoffset, GLint yoffset, GLint zoffset,
- GLsizei width, GLsizei height, GLsizei depth,
- GLenum format, GLsizei imageSize, const GLvoid *bits);
-
- void qt_CompressedTextureImage1D(GLuint texture, GLenum target, GLenum bindingTarget, GLint level, GLenum internalFormat,
- GLsizei width, GLint border,
- GLsizei imageSize, const GLvoid *bits);
-
- void qt_CompressedTextureImage2D(GLuint texture, GLenum target, GLenum bindingTarget, GLint level, GLenum internalFormat,
- GLsizei width, GLsizei height, GLint border,
- GLsizei imageSize, const GLvoid *bits);
-
- void qt_CompressedTextureImage3D(GLuint texture, GLenum target, GLenum bindingTarget, GLint level, GLenum internalFormat,
- GLsizei width, GLsizei height, GLsizei depth, GLint border,
- GLsizei imageSize, const GLvoid *bits);
-
-public:
- // Raw OpenGL functions, resolved and used by our DSA-like static functions if no EXT_direct_state_access is available
-
- // OpenGL 1.0
- inline void glTexImage1D(GLenum target, GLint level, GLint internalFormat,
- GLsizei width, GLint border,
- GLenum format, GLenum type, const GLvoid *pixels)
- {
- TexImage1D(target, level, internalFormat, width, border, format, type, pixels);
- }
-
- // OpenGL 1.1
- inline void glTexSubImage1D(GLenum target, GLint level, GLint xoffset, GLsizei width,
- GLenum format, GLenum type, const GLvoid *pixels)
- {
- TexSubImage1D(target, level, xoffset, width, format, type, pixels);
- }
-
- // OpenGL 1.2
- inline void glTexImage3D(GLenum target, GLint level, GLint internalFormat,
- GLsizei width, GLsizei height, GLsizei depth, GLint border,
- GLenum format, GLenum type, const GLvoid *pixels)
- {
- TexImage3D(target, level, internalFormat, width, height, depth, border, format, type, pixels);
- }
-
- inline void glTexSubImage3D(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset,
- GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLenum type, const GLvoid *pixels)
- {
- TexSubImage3D(target, level, xoffset, yoffset, zoffset, width, height, depth, format, type, pixels);
- }
-
- // OpenGL 1.3
- inline void glGetCompressedTexImage(GLenum target, GLint level, GLvoid *img)
- {
- GetCompressedTexImage(target, level, img);
- }
-
- inline void glCompressedTexSubImage1D(GLenum target, GLint level, GLint xoffset, GLsizei width,
- GLenum format, GLsizei imageSize, const GLvoid *data)
- {
- CompressedTexSubImage1D(target, level, xoffset, width, format, imageSize, data);
- }
-
- inline void glCompressedTexSubImage2D(GLenum target, GLint level, GLint xoffset, GLint yoffset,
- GLsizei width, GLsizei height, GLenum format, GLsizei imageSize, const GLvoid *data)
- {
- CompressedTexSubImage2D(target, level, xoffset, yoffset, width, height, format, imageSize, data);
- }
-
- inline void glCompressedTexSubImage3D(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset,
- GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLsizei imageSize, const GLvoid *data)
- {
- CompressedTexSubImage3D(target, level, xoffset, yoffset, zoffset, width, height, depth, format, imageSize, data);
- }
-
- inline void glCompressedTexImage1D(GLenum target, GLint level, GLenum internalFormat, GLsizei width,
- GLint border, GLsizei imageSize, const GLvoid *data)
- {
- CompressedTexImage1D(target, level, internalFormat, width, border, imageSize, data);
- }
-
- inline void glCompressedTexImage2D(GLenum target, GLint level, GLenum internalFormat, GLsizei width, GLsizei height,
- GLint border, GLsizei imageSize, const GLvoid *data)
- {
- CompressedTexImage2D(target, level, internalFormat, width, height, border, imageSize, data);
- }
-
- inline void glCompressedTexImage3D(GLenum target, GLint level, GLenum internalFormat,
- GLsizei width, GLsizei height, GLsizei depth,
- GLint border, GLsizei imageSize, const GLvoid *data)
- {
- CompressedTexImage3D(target, level, internalFormat, width, height, depth, border, imageSize, data);
- }
-
- inline void glActiveTexture(GLenum texture)
- {
- ActiveTexture(texture);
- }
-
- // OpenGL 3.0
- inline void glGenerateMipmap(GLenum target)
- {
- GenerateMipmap(target);
- }
-
- // OpenGL 3.2
- inline void glTexImage3DMultisample(GLenum target, GLsizei samples, GLint internalFormat,
- GLsizei width, GLsizei height, GLsizei depth,
- GLboolean fixedSampleLocations)
- {
- TexImage3DMultisample(target, samples, internalFormat, width, height, depth, fixedSampleLocations);
- }
-
- inline void glTexImage2DMultisample(GLenum target, GLsizei samples, GLint internalFormat,
- GLsizei width, GLsizei height,
- GLboolean fixedSampleLocations)
- {
- TexImage2DMultisample(target, samples, internalFormat, width, height, fixedSampleLocations);
- }
-
- // OpenGL 4.2
- inline void glTexStorage3D(GLenum target, GLsizei levels, GLenum internalFormat, GLsizei width, GLsizei height, GLsizei depth)
- {
- TexStorage3D(target, levels, internalFormat, width, height, depth);
- }
-
- inline void glTexStorage2D(GLenum target, GLsizei levels, GLenum internalFormat, GLsizei width, GLsizei height)
- {
- TexStorage2D(target, levels, internalFormat, width, height);
- }
-
- inline void glTexStorage1D(GLenum target, GLsizei levels, GLenum internalFormat, GLsizei width)
- {
- TexStorage1D(target, levels, internalFormat, width);
- }
-
- // OpenGL 4.3
- inline void glTexStorage3DMultisample(GLenum target, GLsizei samples, GLenum internalFormat,
- GLsizei width, GLsizei height, GLsizei depth, GLboolean fixedSampleLocations)
- {
- TexStorage3DMultisample(target, samples, internalFormat, width, height, depth, fixedSampleLocations);
- }
-
- inline void glTexStorage2DMultisample(GLenum target, GLsizei samples, GLenum internalFormat,
- GLsizei width, GLsizei height, GLboolean fixedSampleLocations)
- {
- TexStorage2DMultisample(target, samples, internalFormat, width, height, fixedSampleLocations);
- }
-
- inline void glTexBufferRange(GLenum target, GLenum internalFormat, GLuint buffer,
- GLintptr offset, GLsizeiptr size)
- {
- TexBufferRange(target, internalFormat, buffer, offset, size);
- }
-
- inline void glTextureView(GLuint texture, GLenum target, GLuint origTexture, GLenum internalFormat,
- GLuint minLevel, GLuint numLevels, GLuint minLayer, GLuint numLayers)
- {
- TextureView(texture, target, origTexture, internalFormat, minLevel, numLevels, minLayer, numLayers);
- }
-
- // Helper functions
- inline QOpenGLPixelTransferOptions savePixelUploadOptions()
- {
- QOpenGLPixelTransferOptions options;
- int val = 0;
- functions->glGetIntegerv(GL_UNPACK_ALIGNMENT, &val);
- options.setAlignment(val);
-#if !defined(QT_OPENGL_ES_2)
- functions->glGetIntegerv(GL_UNPACK_SKIP_IMAGES, &val);
- options.setSkipImages(val);
- functions->glGetIntegerv(GL_UNPACK_SKIP_ROWS, &val);
- options.setSkipRows(val);
- functions->glGetIntegerv(GL_UNPACK_SKIP_PIXELS, &val);
- options.setSkipPixels(val);
- functions->glGetIntegerv(GL_UNPACK_IMAGE_HEIGHT, &val);
- options.setImageHeight(val);
- functions->glGetIntegerv(GL_UNPACK_ROW_LENGTH, &val);
- options.setRowLength(val);
- GLboolean b = GL_FALSE;
- functions->glGetBooleanv(GL_UNPACK_LSB_FIRST, &b);
- options.setLeastSignificantByteFirst(b);
- functions->glGetBooleanv(GL_UNPACK_SWAP_BYTES, &b);
- options.setSwapBytesEnabled(b);
-#endif
- return options;
- }
-
- inline void setPixelUploadOptions(const QOpenGLPixelTransferOptions &options)
- {
- functions->glPixelStorei(GL_UNPACK_ALIGNMENT, options.alignment());
-#if !defined(QT_OPENGL_ES_2)
- functions->glPixelStorei(GL_UNPACK_SKIP_IMAGES, options.skipImages());
- functions->glPixelStorei(GL_UNPACK_SKIP_ROWS, options.skipRows());
- functions->glPixelStorei(GL_UNPACK_SKIP_PIXELS, options.skipPixels());
- functions->glPixelStorei(GL_UNPACK_IMAGE_HEIGHT, options.imageHeight());
- functions->glPixelStorei(GL_UNPACK_ROW_LENGTH, options.rowLength());
- functions->glPixelStorei(GL_UNPACK_LSB_FIRST, options.isLeastSignificantBitFirst());
- functions->glPixelStorei(GL_UNPACK_SWAP_BYTES, options.isSwapBytesEnabled());
-#endif
- }
-
- QOpenGLFunctions *functions;
-private:
- // Typedefs and pointers to member functions used to switch between EXT_direct_state_access and our own emulated DSA.
- // The argument match the corresponding GL function, but there's an extra "GLenum bindingTarget" which gets used with
- // the DSA emulation -- it contains the right GL_BINDING_TEXTURE_X to use.
- typedef void (QOpenGLTextureHelper::*TextureParameteriMemberFunc)(GLuint texture, GLenum target, GLenum bindingTarget, GLenum pname, GLint param);
- typedef void (QOpenGLTextureHelper::*TextureParameterivMemberFunc)(GLuint texture, GLenum target, GLenum bindingTarget, GLenum pname, const GLint *params);
- typedef void (QOpenGLTextureHelper::*TextureParameterfMemberFunc)(GLuint texture, GLenum target, GLenum bindingTarget, GLenum pname, GLfloat param);
- typedef void (QOpenGLTextureHelper::*TextureParameterfvMemberFunc)(GLuint texture, GLenum target, GLenum bindingTarget, GLenum pname, const GLfloat *params);
- typedef void (QOpenGLTextureHelper::*GenerateTextureMipmapMemberFunc)(GLuint texture, GLenum target, GLenum bindingTarget);
- typedef void (QOpenGLTextureHelper::*TextureStorage3DMemberFunc)(GLuint texture, GLenum target, GLenum bindingTarget, GLsizei levels, GLenum internalFormat, GLsizei width, GLsizei height, GLsizei depth);
- typedef void (QOpenGLTextureHelper::*TextureStorage2DMemberFunc)(GLuint texture, GLenum target, GLenum bindingTarget, GLsizei levels, GLenum internalFormat, GLsizei width, GLsizei height);
- typedef void (QOpenGLTextureHelper::*TextureStorage1DMemberFunc)(GLuint texture, GLenum target, GLenum bindingTarget, GLsizei levels, GLenum internalFormat, GLsizei width);
- typedef void (QOpenGLTextureHelper::*TextureStorage3DMultisampleMemberFunc)(GLuint texture, GLenum target, GLenum bindingTarget, GLsizei samples, GLenum internalFormat, GLsizei width, GLsizei height, GLsizei depth, GLboolean fixedSampleLocations);
- typedef void (QOpenGLTextureHelper::*TextureStorage2DMultisampleMemberFunc)(GLuint texture, GLenum target, GLenum bindingTarget, GLsizei samples, GLenum internalFormat, GLsizei width, GLsizei height, GLboolean fixedSampleLocations);
- typedef void (QOpenGLTextureHelper::*TextureImage3DMemberFunc)(GLuint texture, GLenum target, GLenum bindingTarget, GLint level, GLenum internalFormat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLenum format, GLenum type, const GLvoid *pixels);
- typedef void (QOpenGLTextureHelper::*TextureImage2DMemberFunc)(GLuint texture, GLenum target, GLenum bindingTarget, GLint level, GLenum internalFormat, GLsizei width, GLsizei height, GLint border, GLenum format, GLenum type, const GLvoid *pixels);
- typedef void (QOpenGLTextureHelper::*TextureImage1DMemberFunc)(GLuint texture, GLenum target, GLenum bindingTarget, GLint level, GLenum internalFormat, GLsizei width, GLint border, GLenum format, GLenum type, const GLvoid *pixels);
- typedef void (QOpenGLTextureHelper::*TextureSubImage3DMemberFunc)(GLuint texture, GLenum target, GLenum bindingTarget, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLenum type, const GLvoid *pixels);
- typedef void (QOpenGLTextureHelper::*TextureSubImage2DMemberFunc)(GLuint texture, GLenum target, GLenum bindingTarget, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLenum type, const GLvoid *pixels);
- typedef void (QOpenGLTextureHelper::*TextureSubImage1DMemberFunc)(GLuint texture, GLenum target, GLenum bindingTarget, GLint level, GLint xoffset, GLsizei width, GLenum format, GLenum type, const GLvoid *pixels);
- typedef void (QOpenGLTextureHelper::*TextureImage3DMultisampleMemberFunc)(GLuint texture, GLenum target, GLenum bindingTarget, GLsizei samples, GLint internalFormat, GLsizei width, GLsizei height, GLsizei depth, GLboolean fixedSampleLocations);
- typedef void (QOpenGLTextureHelper::*TextureImage2DMultisampleMemberFunc)(GLuint texture, GLenum target, GLenum bindingTarget, GLsizei samples, GLint internalFormat, GLsizei width, GLsizei height, GLboolean fixedSampleLocations);
- typedef void (QOpenGLTextureHelper::*CompressedTextureSubImage1DMemberFunc)(GLuint texture, GLenum target, GLenum bindingTarget, GLint level, GLint xoffset, GLsizei width, GLenum format, GLsizei imageSize, const GLvoid *bits);
- typedef void (QOpenGLTextureHelper::*CompressedTextureSubImage2DMemberFunc)(GLuint texture, GLenum target, GLenum bindingTarget, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLsizei imageSize, const GLvoid *bits);
- typedef void (QOpenGLTextureHelper::*CompressedTextureSubImage3DMemberFunc)(GLuint texture, GLenum target, GLenum bindingTarget, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLsizei imageSize, const GLvoid *bits);
- typedef void (QOpenGLTextureHelper::*CompressedTextureImage1DMemberFunc)(GLuint texture, GLenum target, GLenum bindingTarget, GLint level, GLenum internalformat, GLsizei width, GLint border, GLsizei imageSize, const GLvoid *bits);
- typedef void (QOpenGLTextureHelper::*CompressedTextureImage2DMemberFunc)(GLuint texture, GLenum target, GLenum bindingTarget, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLint border, GLsizei imageSize, const GLvoid *bits);
- typedef void (QOpenGLTextureHelper::*CompressedTextureImage3DMemberFunc)(GLuint texture, GLenum target, GLenum bindingTarget, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLsizei imageSize, const GLvoid *bits);
-
-
- TextureParameteriMemberFunc TextureParameteri;
- TextureParameterivMemberFunc TextureParameteriv;
- TextureParameterfMemberFunc TextureParameterf;
- TextureParameterfvMemberFunc TextureParameterfv;
- GenerateTextureMipmapMemberFunc GenerateTextureMipmap;
- TextureStorage3DMemberFunc TextureStorage3D;
- TextureStorage2DMemberFunc TextureStorage2D;
- TextureStorage1DMemberFunc TextureStorage1D;
- TextureStorage3DMultisampleMemberFunc TextureStorage3DMultisample;
- TextureStorage2DMultisampleMemberFunc TextureStorage2DMultisample;
- TextureImage3DMemberFunc TextureImage3D;
- TextureImage2DMemberFunc TextureImage2D;
- TextureImage1DMemberFunc TextureImage1D;
- TextureSubImage3DMemberFunc TextureSubImage3D;
- TextureSubImage2DMemberFunc TextureSubImage2D;
- TextureSubImage1DMemberFunc TextureSubImage1D;
- TextureImage3DMultisampleMemberFunc TextureImage3DMultisample;
- TextureImage2DMultisampleMemberFunc TextureImage2DMultisample;
- CompressedTextureSubImage1DMemberFunc CompressedTextureSubImage1D;
- CompressedTextureSubImage2DMemberFunc CompressedTextureSubImage2D;
- CompressedTextureSubImage3DMemberFunc CompressedTextureSubImage3D;
- CompressedTextureImage1DMemberFunc CompressedTextureImage1D;
- CompressedTextureImage2DMemberFunc CompressedTextureImage2D;
- CompressedTextureImage3DMemberFunc CompressedTextureImage3D;
-
- // Raw function pointers for core and DSA functions
-
- // EXT_direct_state_access used when DSA is available
- void (QOPENGLF_APIENTRYP TextureParameteriEXT)(GLuint texture, GLenum target, GLenum pname, GLint param);
- void (QOPENGLF_APIENTRYP TextureParameterivEXT)(GLuint texture, GLenum target, GLenum pname, const GLint *params);
- void (QOPENGLF_APIENTRYP TextureParameterfEXT)(GLuint texture, GLenum target, GLenum pname, GLfloat param);
- void (QOPENGLF_APIENTRYP TextureParameterfvEXT)(GLuint texture, GLenum target, GLenum pname, const GLfloat *params);
- void (QOPENGLF_APIENTRYP GenerateTextureMipmapEXT)(GLuint texture, GLenum target);
- void (QOPENGLF_APIENTRYP TextureStorage3DEXT)(GLuint texture, GLenum target, GLsizei levels, GLenum internalFormat, GLsizei width, GLsizei height, GLsizei depth);
- void (QOPENGLF_APIENTRYP TextureStorage2DEXT)(GLuint texture, GLenum target, GLsizei levels, GLenum internalFormat, GLsizei width, GLsizei height);
- void (QOPENGLF_APIENTRYP TextureStorage1DEXT)(GLuint texture, GLenum target, GLsizei levels, GLenum internalFormat, GLsizei width);
- void (QOPENGLF_APIENTRYP TextureStorage3DMultisampleEXT)(GLuint texture, GLenum target, GLsizei samples, GLenum internalFormat, GLsizei width, GLsizei height, GLsizei depth, GLboolean fixedSampleLocations);
- void (QOPENGLF_APIENTRYP TextureStorage2DMultisampleEXT)(GLuint texture, GLenum target, GLsizei samples, GLenum internalFormat, GLsizei width, GLsizei height, GLboolean fixedSampleLocations);
- void (QOPENGLF_APIENTRYP TextureImage3DEXT)(GLuint texture, GLenum target, GLint level, GLenum internalFormat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLenum format, GLenum type, const GLvoid *pixels);
- void (QOPENGLF_APIENTRYP TextureImage2DEXT)(GLuint texture, GLenum target, GLint level, GLenum internalFormat, GLsizei width, GLsizei height, GLint border, GLenum format, GLenum type, const GLvoid *pixels);
- void (QOPENGLF_APIENTRYP TextureImage1DEXT)(GLuint texture, GLenum target, GLint level, GLenum internalFormat, GLsizei width, GLint border, GLenum format, GLenum type, const GLvoid *pixels);
- void (QOPENGLF_APIENTRYP TextureSubImage3DEXT)(GLuint texture, GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLenum type, const GLvoid *pixels);
- void (QOPENGLF_APIENTRYP TextureSubImage2DEXT)(GLuint texture, GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLenum type, const GLvoid *pixels);
- void (QOPENGLF_APIENTRYP TextureSubImage1DEXT)(GLuint texture, GLenum target, GLint level, GLint xoffset, GLsizei width, GLenum format, GLenum type, const GLvoid *pixels);
- void (QOPENGLF_APIENTRYP CompressedTextureSubImage1DEXT)(GLuint texture, GLenum target, GLint level, GLint xoffset, GLsizei width, GLenum format, GLsizei imageSize, const GLvoid *bits);
- void (QOPENGLF_APIENTRYP CompressedTextureSubImage2DEXT)(GLuint texture, GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLsizei imageSize, const GLvoid *bits);
- void (QOPENGLF_APIENTRYP CompressedTextureSubImage3DEXT)(GLuint texture, GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLsizei imageSize, const GLvoid *bits);
- void (QOPENGLF_APIENTRYP CompressedTextureImage1DEXT)(GLuint texture, GLenum target, GLint level, GLenum internalformat, GLsizei width, GLint border, GLsizei imageSize, const GLvoid *bits);
- void (QOPENGLF_APIENTRYP CompressedTextureImage2DEXT)(GLuint texture, GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLint border, GLsizei imageSize, const GLvoid *bits);
- void (QOPENGLF_APIENTRYP CompressedTextureImage3DEXT)(GLuint texture, GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLsizei imageSize, const GLvoid *bits);
-
-
- // Plus some missing ones that are in the NV_texture_multisample extension instead
- void (QOPENGLF_APIENTRYP TextureImage3DMultisampleNV)(GLuint texture, GLenum target, GLsizei samples, GLint internalFormat, GLsizei width, GLsizei height, GLsizei depth, GLboolean fixedSampleLocations);
- void (QOPENGLF_APIENTRYP TextureImage2DMultisampleNV)(GLuint texture, GLenum target, GLsizei samples, GLint internalFormat, GLsizei width, GLsizei height, GLboolean fixedSampleLocations);
-
- // OpenGL 1.0
- void (QOPENGLF_APIENTRYP TexImage1D)(GLenum target, GLint level, GLint internalFormat, GLsizei width, GLint border, GLenum format, GLenum type, const GLvoid *pixels);
-
- // OpenGL 1.1
- void (QOPENGLF_APIENTRYP TexSubImage1D)(GLenum target, GLint level, GLint xoffset, GLsizei width, GLenum format, GLenum type, const GLvoid *pixels);
-
- // OpenGL 1.2
- void (QOPENGLF_APIENTRYP TexImage3D)(GLenum target, GLint level, GLint internalFormat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLenum format, GLenum type, const GLvoid *pixels);
- void (QOPENGLF_APIENTRYP TexSubImage3D)(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLenum type, const GLvoid *pixels);
-
- // OpenGL 1.3
- void (QOPENGLF_APIENTRYP GetCompressedTexImage)(GLenum target, GLint level, GLvoid *img);
- void (QOPENGLF_APIENTRYP CompressedTexSubImage1D)(GLenum target, GLint level, GLint xoffset, GLsizei width, GLenum format, GLsizei imageSize, const GLvoid *data);
- GL_APICALL void (QOPENGLF_APIENTRYP CompressedTexSubImage2D)(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLsizei imageSize, const GLvoid *data);
- void (QOPENGLF_APIENTRYP CompressedTexSubImage3D)(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLsizei imageSize, const GLvoid *data);
- void (QOPENGLF_APIENTRYP CompressedTexImage1D)(GLenum target, GLint level, GLenum internalFormat, GLsizei width, GLint border, GLsizei imageSize, const GLvoid *data);
- GL_APICALL void (QOPENGLF_APIENTRYP CompressedTexImage2D)(GLenum target, GLint level, GLenum internalFormat, GLsizei width, GLsizei height, GLint border, GLsizei imageSize, const GLvoid *data);
- void (QOPENGLF_APIENTRYP CompressedTexImage3D)(GLenum target, GLint level, GLenum internalFormat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLsizei imageSize, const GLvoid *data);
- GL_APICALL void (QOPENGLF_APIENTRYP ActiveTexture)(GLenum texture);
-
- // OpenGL 3.0
- GL_APICALL void (QOPENGLF_APIENTRYP GenerateMipmap)(GLenum target);
-
- // OpenGL 3.2
- void (QOPENGLF_APIENTRYP TexImage3DMultisample)(GLenum target, GLsizei samples, GLint internalFormat, GLsizei width, GLsizei height, GLsizei depth, GLboolean fixedSampleLocations);
- void (QOPENGLF_APIENTRYP TexImage2DMultisample)(GLenum target, GLsizei samples, GLint internalFormat, GLsizei width, GLsizei height, GLboolean fixedSampleLocations);
-
- // OpenGL 4.2
- void (QOPENGLF_APIENTRYP TexStorage3D)(GLenum target, GLsizei levels, GLenum internalFormat, GLsizei width, GLsizei height, GLsizei depth);
- void (QOPENGLF_APIENTRYP TexStorage2D)(GLenum target, GLsizei levels, GLenum internalFormat, GLsizei width, GLsizei height);
- void (QOPENGLF_APIENTRYP TexStorage1D)(GLenum target, GLsizei levels, GLenum internalFormat, GLsizei width);
-
- // OpenGL 4.3
- void (QOPENGLF_APIENTRYP TexStorage3DMultisample)(GLenum target, GLsizei samples, GLenum internalFormat, GLsizei width, GLsizei height, GLsizei depth, GLboolean fixedSampleLocations);
- void (QOPENGLF_APIENTRYP TexStorage2DMultisample)(GLenum target, GLsizei samples, GLenum internalFormat, GLsizei width, GLsizei height, GLboolean fixedSampleLocations);
- void (QOPENGLF_APIENTRYP TexBufferRange)(GLenum target, GLenum internalFormat, GLuint buffer, GLintptr offset, GLsizeiptr size);
- void (QOPENGLF_APIENTRYP TextureView)(GLuint texture, GLenum target, GLuint origtexture, GLenum internalformat, GLuint minlevel, GLuint numlevels, GLuint minlayer, GLuint numlayers);
-};
-
-QT_END_NAMESPACE
-
-#undef Q_CALL_MEMBER_FUNCTION
-
-#endif // QT_NO_OPENGL
-
-#endif // QOPENGLTEXTUREHELPER_P_H
diff --git a/src/gui/opengl/qopengltextureuploader.cpp b/src/gui/opengl/qopengltextureuploader.cpp
deleted file mode 100644
index 9e393bc47a..0000000000
--- a/src/gui/opengl/qopengltextureuploader.cpp
+++ /dev/null
@@ -1,381 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2018 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the QtGui module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "qopengltextureuploader_p.h"
-
-#include <qimage.h>
-#include <qmath.h>
-#include <qopenglfunctions.h>
-#include <private/qopenglcontext_p.h>
-#include <private/qopenglextensions_p.h>
-
-#ifndef GL_RED
-#define GL_RED 0x1903
-#endif
-
-#ifndef GL_GREEN
-#define GL_GREEN 0x1904
-#endif
-
-#ifndef GL_BLUE
-#define GL_BLUE 0x1905
-#endif
-
-#ifndef GL_RGB10_A2
-#define GL_RGB10_A2 0x8059
-#endif
-
-#ifndef GL_RGBA16
-#define GL_RGBA16 0x805B
-#endif
-
-#ifndef GL_BGR
-#define GL_BGR 0x80E0
-#endif
-
-#ifndef GL_BGRA
-#define GL_BGRA 0x80E1
-#endif
-
-#ifndef GL_UNSIGNED_INT_8_8_8_8_REV
-#define GL_UNSIGNED_INT_8_8_8_8_REV 0x8367
-#endif
-
-#ifndef GL_UNSIGNED_INT_2_10_10_10_REV
-#define GL_UNSIGNED_INT_2_10_10_10_REV 0x8368
-#endif
-
-#ifndef GL_TEXTURE_SWIZZLE_R
-#define GL_TEXTURE_SWIZZLE_R 0x8E42
-#endif
-
-#ifndef GL_TEXTURE_SWIZZLE_G
-#define GL_TEXTURE_SWIZZLE_G 0x8E43
-#endif
-
-#ifndef GL_TEXTURE_SWIZZLE_B
-#define GL_TEXTURE_SWIZZLE_B 0x8E44
-#endif
-
-#ifndef GL_TEXTURE_SWIZZLE_A
-#define GL_TEXTURE_SWIZZLE_A 0x8E45
-#endif
-
-#ifndef GL_SRGB
-#define GL_SRGB 0x8C40
-#endif
-#ifndef GL_SRGB_ALPHA
-#define GL_SRGB_ALPHA 0x8C42
-#endif
-
-QT_BEGIN_NAMESPACE
-
-qsizetype QOpenGLTextureUploader::textureImage(GLenum target, const QImage &image, QOpenGLTextureUploader::BindOptions options, QSize maxSize)
-{
- QOpenGLContext *context = QOpenGLContext::currentContext();
- QOpenGLExtensions *funcs = static_cast<QOpenGLExtensions*>(context->functions());
-
- QImage tx;
- GLenum externalFormat;
- GLenum internalFormat;
- GLuint pixelType;
- QImage::Format targetFormat = QImage::Format_Invalid;
- const bool isOpenGL12orBetter = !context->isOpenGLES() && (context->format().majorVersion() >= 2 || context->format().minorVersion() >= 2);
- const bool isOpenGLES3orBetter = context->isOpenGLES() && context->format().majorVersion() >= 3;
- const bool sRgbBinding = (options & SRgbBindOption);
- Q_ASSERT(isOpenGL12orBetter || context->isOpenGLES());
- Q_ASSERT((options & (SRgbBindOption | UseRedForAlphaAndLuminanceBindOption)) != (SRgbBindOption | UseRedForAlphaAndLuminanceBindOption));
-
- switch (image.format()) {
- case QImage::Format_RGB32:
- case QImage::Format_ARGB32:
- case QImage::Format_ARGB32_Premultiplied:
- if (isOpenGL12orBetter) {
- externalFormat = GL_BGRA;
- internalFormat = GL_RGBA;
- pixelType = GL_UNSIGNED_INT_8_8_8_8_REV;
-#if Q_BYTE_ORDER == Q_LITTLE_ENDIAN
- // Without GL_UNSIGNED_INT_8_8_8_8_REV, BGRA only matches ARGB on little endian:
- } else if (funcs->hasOpenGLExtension(QOpenGLExtensions::BGRATextureFormat) && !sRgbBinding) {
- // The GL_EXT_texture_format_BGRA8888 extension requires the internal format to match the external.
- externalFormat = internalFormat = GL_BGRA;
- pixelType = GL_UNSIGNED_BYTE;
- } else if (context->isOpenGLES() && context->hasExtension(QByteArrayLiteral("GL_APPLE_texture_format_BGRA8888"))) {
- // Is only allowed as an external format like OpenGL.
- externalFormat = GL_BGRA;
- internalFormat = GL_RGBA;
- pixelType = GL_UNSIGNED_BYTE;
-#endif
- } else if (funcs->hasOpenGLExtension(QOpenGLExtensions::TextureSwizzle)) {
-#if Q_BYTE_ORDER == Q_LITTLE_ENDIAN
- funcs->glTexParameteri(target, GL_TEXTURE_SWIZZLE_R, GL_BLUE);
- funcs->glTexParameteri(target, GL_TEXTURE_SWIZZLE_B, GL_RED);
-#else
- funcs->glTexParameteri(target, GL_TEXTURE_SWIZZLE_R, GL_GREEN);
- funcs->glTexParameteri(target, GL_TEXTURE_SWIZZLE_G, GL_BLUE);
- funcs->glTexParameteri(target, GL_TEXTURE_SWIZZLE_B, GL_ALPHA);
- funcs->glTexParameteri(target, GL_TEXTURE_SWIZZLE_A, GL_RED);
-#endif
- externalFormat = internalFormat = GL_RGBA;
- pixelType = GL_UNSIGNED_BYTE;
- } else {
- // No support for direct ARGB32 upload.
- break;
- }
- targetFormat = image.format();
- break;
- case QImage::Format_BGR30:
- case QImage::Format_A2BGR30_Premultiplied:
- if (sRgbBinding) {
- // Always needs conversion
- break;
- } else if (isOpenGL12orBetter || isOpenGLES3orBetter) {
- pixelType = GL_UNSIGNED_INT_2_10_10_10_REV;
- externalFormat = GL_RGBA;
- internalFormat = GL_RGB10_A2;
- targetFormat = image.format();
- }
- break;
- case QImage::Format_RGB30:
- case QImage::Format_A2RGB30_Premultiplied:
- if (sRgbBinding) {
- // Always needs conversion
- break;
- } else if (isOpenGL12orBetter) {
- pixelType = GL_UNSIGNED_INT_2_10_10_10_REV;
- externalFormat = GL_BGRA;
- internalFormat = GL_RGB10_A2;
- targetFormat = image.format();
- } else if (funcs->hasOpenGLExtension(QOpenGLExtensions::TextureSwizzle)) {
- funcs->glTexParameteri(target, GL_TEXTURE_SWIZZLE_B, GL_RED);
- funcs->glTexParameteri(target, GL_TEXTURE_SWIZZLE_R, GL_BLUE);
- pixelType = GL_UNSIGNED_INT_2_10_10_10_REV;
- externalFormat = GL_RGBA;
- internalFormat = GL_RGB10_A2;
- targetFormat = image.format();
- }
- break;
- case QImage::Format_RGB444:
- case QImage::Format_RGB555:
- case QImage::Format_RGB16:
- if (isOpenGL12orBetter || context->isOpenGLES()) {
- externalFormat = internalFormat = GL_RGB;
- pixelType = GL_UNSIGNED_SHORT_5_6_5;
- targetFormat = QImage::Format_RGB16;
- }
- break;
- case QImage::Format_RGB666:
- case QImage::Format_RGB888:
- externalFormat = internalFormat = GL_RGB;
- pixelType = GL_UNSIGNED_BYTE;
- targetFormat = QImage::Format_RGB888;
- break;
- case QImage::Format_BGR888:
- if (isOpenGL12orBetter) {
- externalFormat = GL_BGR;
- internalFormat = GL_RGB;
- pixelType = GL_UNSIGNED_BYTE;
- targetFormat = QImage::Format_BGR888;
- } else if (funcs->hasOpenGLExtension(QOpenGLExtensions::TextureSwizzle)) {
- funcs->glTexParameteri(target, GL_TEXTURE_SWIZZLE_B, GL_RED);
- funcs->glTexParameteri(target, GL_TEXTURE_SWIZZLE_R, GL_BLUE);
- externalFormat = internalFormat = GL_RGB;
- pixelType = GL_UNSIGNED_BYTE;
- targetFormat = QImage::Format_BGR888;
- }
- break;
- case QImage::Format_RGBX8888:
- case QImage::Format_RGBA8888:
- case QImage::Format_RGBA8888_Premultiplied:
- externalFormat = internalFormat = GL_RGBA;
- pixelType = GL_UNSIGNED_BYTE;
- targetFormat = image.format();
- break;
- case QImage::Format_RGBX64:
- case QImage::Format_RGBA64:
- case QImage::Format_RGBA64_Premultiplied:
- externalFormat = internalFormat = GL_RGBA;
- if (isOpenGL12orBetter || (context->isOpenGLES() && context->format().majorVersion() >= 3))
- internalFormat = GL_RGBA16;
- pixelType = GL_UNSIGNED_SHORT;
- targetFormat = image.format();
- break;
- case QImage::Format_Indexed8:
- if (sRgbBinding) {
- // Always needs conversion
- break;
- } else if (options & UseRedForAlphaAndLuminanceBindOption) {
- externalFormat = internalFormat = GL_RED;
- pixelType = GL_UNSIGNED_BYTE;
- targetFormat = image.format();
- }
- break;
- case QImage::Format_Alpha8:
- if (sRgbBinding) {
- // Always needs conversion
- break;
- } else if (options & UseRedForAlphaAndLuminanceBindOption) {
- externalFormat = internalFormat = GL_RED;
- pixelType = GL_UNSIGNED_BYTE;
- targetFormat = image.format();
- } else if (context->isOpenGLES() || context->format().profile() != QSurfaceFormat::CoreProfile) {
- externalFormat = internalFormat = GL_ALPHA;
- pixelType = GL_UNSIGNED_BYTE;
- targetFormat = image.format();
- } else if (funcs->hasOpenGLExtension(QOpenGLExtensions::TextureSwizzle)) {
- funcs->glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_SWIZZLE_R, GL_ALPHA);
- funcs->glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_SWIZZLE_G, GL_ZERO);
- funcs->glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_SWIZZLE_B, GL_ZERO);
- funcs->glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_SWIZZLE_A, GL_ZERO);
- externalFormat = internalFormat = GL_RED;
- pixelType = GL_UNSIGNED_BYTE;
- targetFormat = image.format();
- }
- break;
- case QImage::Format_Grayscale8:
- if (sRgbBinding) {
- // Always needs conversion
- break;
- } else if (options & UseRedForAlphaAndLuminanceBindOption) {
- externalFormat = internalFormat = GL_RED;
- pixelType = GL_UNSIGNED_BYTE;
- targetFormat = image.format();
- } else if (context->isOpenGLES() || context->format().profile() != QSurfaceFormat::CoreProfile) {
- externalFormat = internalFormat = GL_LUMINANCE;
- pixelType = GL_UNSIGNED_BYTE;
- targetFormat = image.format();
- } else if (funcs->hasOpenGLExtension(QOpenGLExtensions::TextureSwizzle)) {
- funcs->glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_SWIZZLE_R, GL_RED);
- funcs->glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_SWIZZLE_G, GL_RED);
- funcs->glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_SWIZZLE_B, GL_RED);
- funcs->glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_SWIZZLE_A, GL_ONE);
- externalFormat = internalFormat = GL_RED;
- pixelType = GL_UNSIGNED_BYTE;
- targetFormat = image.format();
- }
- break;
- case QImage::Format_Grayscale16:
- if (sRgbBinding) {
- // Always needs conversion
- break;
- } else if (options & UseRedForAlphaAndLuminanceBindOption) {
- externalFormat = internalFormat = GL_RED;
- pixelType = GL_UNSIGNED_SHORT;
- targetFormat = image.format();
- } else if (context->isOpenGLES() || context->format().profile() != QSurfaceFormat::CoreProfile) {
- externalFormat = internalFormat = GL_LUMINANCE;
- pixelType = GL_UNSIGNED_SHORT;
- targetFormat = image.format();
- } else if (funcs->hasOpenGLExtension(QOpenGLExtensions::TextureSwizzle)) {
- funcs->glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_SWIZZLE_R, GL_RED);
- funcs->glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_SWIZZLE_G, GL_RED);
- funcs->glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_SWIZZLE_B, GL_RED);
- funcs->glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_SWIZZLE_A, GL_ONE);
- externalFormat = internalFormat = GL_RED;
- pixelType = GL_UNSIGNED_SHORT;
- targetFormat = image.format();
- }
- break;
- default:
- break;
- }
-
- // If no direct upload was detected above, convert to RGBA8888 and upload that
- if (targetFormat == QImage::Format_Invalid) {
- externalFormat = internalFormat = GL_RGBA;
- pixelType = GL_UNSIGNED_BYTE;
- if (!image.hasAlphaChannel())
- targetFormat = QImage::Format_RGBX8888;
- else
- targetFormat = QImage::Format_RGBA8888;
- }
-
- if (options & PremultipliedAlphaBindOption) {
- if (targetFormat == QImage::Format_ARGB32)
- targetFormat = QImage::Format_ARGB32_Premultiplied;
- else if (targetFormat == QImage::Format_RGBA8888)
- targetFormat = QImage::Format_RGBA8888_Premultiplied;
- else if (targetFormat == QImage::Format_RGBA64)
- targetFormat = QImage::Format_RGBA64_Premultiplied;
- } else {
- if (targetFormat == QImage::Format_ARGB32_Premultiplied)
- targetFormat = QImage::Format_ARGB32;
- else if (targetFormat == QImage::Format_RGBA8888_Premultiplied)
- targetFormat = QImage::Format_RGBA8888;
- else if (targetFormat == QImage::Format_RGBA64_Premultiplied)
- targetFormat = QImage::Format_RGBA64;
- }
-
- if (sRgbBinding) {
- Q_ASSERT(internalFormat == GL_RGBA || internalFormat == GL_RGB);
- if (image.hasAlphaChannel())
- internalFormat = GL_SRGB_ALPHA;
- else
- internalFormat = GL_SRGB;
- }
-
- if (image.format() != targetFormat)
- tx = image.convertToFormat(targetFormat);
- else
- tx = image;
-
- QSize newSize = tx.size();
- if (!maxSize.isEmpty())
- newSize = newSize.boundedTo(maxSize);
- if (options & PowerOfTwoBindOption) {
- newSize.setWidth(qNextPowerOfTwo(newSize.width() - 1));
- newSize.setHeight(qNextPowerOfTwo(newSize.height() - 1));
- }
-
- if (newSize != tx.size())
- tx = tx.scaled(newSize, Qt::IgnoreAspectRatio, Qt::SmoothTransformation);
-
- // Handle cases where the QImage is actually a sub image of its image data:
- qsizetype naturalBpl = ((qsizetype(tx.width()) * tx.depth() + 31) >> 5) << 2;
- if (tx.bytesPerLine() != naturalBpl)
- tx = tx.copy(tx.rect());
-
- funcs->glTexImage2D(target, 0, internalFormat, tx.width(), tx.height(), 0, externalFormat, pixelType, tx.constBits());
-
- qsizetype cost = qint64(tx.width()) * tx.height() * tx.depth() / 8;
-
- return cost;
-}
-
-QT_END_NAMESPACE
diff --git a/src/gui/opengl/qopengltextureuploader_p.h b/src/gui/opengl/qopengltextureuploader_p.h
deleted file mode 100644
index 0dcf709d7e..0000000000
--- a/src/gui/opengl/qopengltextureuploader_p.h
+++ /dev/null
@@ -1,84 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2018 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the QtGui module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-//
-// W A R N I N G
-// -------------
-//
-// This file is not part of the Qt API. It exists purely as an
-// implementation detail. This header file may change from version to
-// version without notice, or even be removed.
-//
-// We mean it.
-//
-
-#ifndef QOPENGLTEXTUREUPLOADER_P_H
-#define QOPENGLTEXTUREUPLOADER_P_H
-
-#include <QtCore/qsize.h>
-#include <QtGui/private/qtguiglobal_p.h>
-#include <QtGui/private/qopenglcontext_p.h>
-
-QT_BEGIN_NAMESPACE
-
-class QImage;
-
-class Q_GUI_EXPORT QOpenGLTextureUploader
-{
-public:
- enum BindOption {
- NoBindOption = 0x0000,
- PremultipliedAlphaBindOption = 0x0001,
- UseRedForAlphaAndLuminanceBindOption = 0x0002,
- SRgbBindOption = 0x0004,
- PowerOfTwoBindOption = 0x0008
- };
- Q_DECLARE_FLAGS(BindOptions, BindOption)
- Q_FLAGS(BindOptions)
-
- static qsizetype textureImage(GLenum target, const QImage &image, BindOptions options, QSize maxSize = QSize());
-
-};
-
-Q_DECLARE_OPERATORS_FOR_FLAGS(QOpenGLTextureUploader::BindOptions)
-
-QT_END_NAMESPACE
-
-#endif
-
diff --git a/src/gui/opengl/qopenglversionfunctions.cpp b/src/gui/opengl/qopenglversionfunctions.cpp
deleted file mode 100644
index 5a108335a9..0000000000
--- a/src/gui/opengl/qopenglversionfunctions.cpp
+++ /dev/null
@@ -1,353 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2013 Klaralvdalens Datakonsult AB (KDAB)
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the QtGui module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-**
-** This file was generated by glgen version 0.1
-** Command line was: glgen
-**
-** glgen is Copyright (C) 2013 Klaralvdalens Datakonsult AB (KDAB)
-**
-** This is an auto-generated file.
-** Do not edit! All changes made to it will be lost.
-**
-****************************************************************************/
-
-#include "qopenglversionfunctions.h"
-#include "qopenglcontext.h"
-#include "qdebug.h"
-
-QT_BEGIN_NAMESPACE
-
-#define QT_OPENGL_COUNT_FUNCTIONS(ret, name, args) +1
-#define QT_OPENGL_FUNCTION_NAMES(ret, name, args) \
- "gl"#name"\0"
-#define QT_OPENGL_IMPLEMENT(CLASS, FUNCTIONS) \
-void CLASS::init() \
-{ \
- const char *names = FUNCTIONS(QT_OPENGL_FUNCTION_NAMES); \
- const char *name = names; \
- for (int i = 0; i < FUNCTIONS(QT_OPENGL_COUNT_FUNCTIONS); ++i) { \
- functions[i] = context->getProcAddress(name); \
- name += strlen(name) + 1; \
- } \
-}
-
-QOpenGLVersionFunctionsStorage::QOpenGLVersionFunctionsStorage()
- : backends(nullptr)
-{
-}
-
-QOpenGLVersionFunctionsStorage::~QOpenGLVersionFunctionsStorage()
-{
-#ifndef QT_OPENGL_ES
- if (backends) {
-
- int i = 0;
-
-#define DELETE_BACKEND(X) \
- if (backends[i] && !--backends[i]->refs) \
- delete static_cast<QOpenGLFunctions_##X##Backend*>(backends[i]); \
- ++i;
-
- QT_OPENGL_VERSIONS(DELETE_BACKEND)
-#undef DELETE_BACKEND
- delete[] backends;
- }
-#endif
-}
-
-QOpenGLVersionFunctionsBackend *QOpenGLVersionFunctionsStorage::backend(QOpenGLContext *context, QOpenGLVersionFunctionsBackend::Version v)
-{
-#ifdef QT_OPENGL_ES
- Q_UNUSED(context);
- Q_UNUSED(v);
- return 0;
-#else
- if (!backends) {
- backends = new QOpenGLVersionFunctionsBackend *[QOpenGLVersionFunctionsBackend::OpenGLVersionBackendCount];
- memset(backends, 0, sizeof(QOpenGLVersionFunctionsBackend *)*QOpenGLVersionFunctionsBackend::OpenGLVersionBackendCount);
- }
- if (backends[v])
- return backends[v];
-
- switch(v) {
-#define VERSION_ENUM(X) QOpenGLVersionFunctionsBackend::OpenGL_##X
-#define CREATE_BACKEND(X) \
- case VERSION_ENUM(X): \
- backends[VERSION_ENUM(X)] = new QOpenGLFunctions_##X##Backend(context); \
- break;
- QT_OPENGL_VERSIONS(CREATE_BACKEND)
- case QOpenGLVersionFunctionsBackend::OpenGLVersionBackendCount:
- Q_UNREACHABLE();
- }
- // the storage keeps one ref
- ++backends[v]->refs;
- return backends[v];
-#endif
-}
-
-QOpenGLVersionFunctionsBackend *QAbstractOpenGLFunctionsPrivate::functionsBackend(QOpenGLContext *context, QOpenGLVersionFunctionsBackend::Version v)
-{
- Q_ASSERT(context);
- QOpenGLVersionFunctionsStorage *storage = context->functionsBackendStorage();
- return storage->backend(context, v);
-}
-
-void QAbstractOpenGLFunctionsPrivate::insertExternalFunctions(QOpenGLContext *context, QAbstractOpenGLFunctions *f)
-{
- Q_ASSERT(context);
- context->insertExternalFunctions(f);
-}
-
-void QAbstractOpenGLFunctionsPrivate::removeExternalFunctions(QOpenGLContext *context, QAbstractOpenGLFunctions *f)
-{
- Q_ASSERT(context);
- context->removeExternalFunctions(f);
-}
-
-/*!
- \class QAbstractOpenGLFunctions
- \inmodule QtGui
- \since 5.1
- \brief The QAbstractOpenGLFunctions class is the base class of a family of
- classes that expose all functions for each OpenGL version and
- profile.
-
- OpenGL implementations on different platforms are able to link to a variable
- number of OpenGL functions depending upon the OpenGL ABI on that platform.
- For example, on Microsoft Windows only functions up to those in OpenGL 1.1
- can be linked to at build time. All other functions must be resolved at
- runtime. The traditional solution to this has been to use either
- QOpenGLContext::getProcAddress() or QOpenGLFunctions. The former is tedious
- and error prone and means dealing directly with function pointers. The
- latter only exposes those functions common to OpenGL ES 2 and desktop
- OpenGL. There is however much new OpenGL functionality that is useful when
- writing real world OpenGL applications.
-
- Qt now provides a family of classes which all inherit from
- QAbstractOpenGLFunctions which expose every core OpenGL function by way of a
- corresponding member function. There is a class for every valid combination
- of OpenGL version and profile. Each class follows the naming convention:
- \badcode
- QOpenGLFunctions_<MAJOR VERSION>_<MINOR VERSION>[_PROFILE]
- \endcode
-
- For OpenGL versions 1.0 through to 3.0 there are no profiles, leading to the
- classes:
-
- \list
- \li QOpenGLFunctions_1_0
- \li QOpenGLFunctions_1_1
- \li QOpenGLFunctions_1_2
- \li QOpenGLFunctions_1_3
- \li QOpenGLFunctions_1_4
- \li QOpenGLFunctions_1_5
- \li QOpenGLFunctions_2_0
- \li QOpenGLFunctions_2_1
- \li QOpenGLFunctions_3_0
- \endlist
-
- where each class inherits from QAbstractOpenGLFunctions.
-
- OpenGL version 3.1 removed many deprecated functions leading to a much
- simpler and generic API.
-
- With OpenGL 3.2 the concept of profiles was introduced. Two profiles are
- currently defined for OpenGL: Core and Compatibility.
-
- The Core profile does not include any of the functions that were removed
- in OpenGL 3.1. The Compatibility profile contains all functions in the
- Core profile of the same version plus all of the functions that were
- removed in OpenGL 3.1. In this way the Compatibility profile classes allow
- use of newer OpenGL functionality but also allows you to keep using your
- legacy OpenGL code. For new OpenGL code the Core profile should be
- preferred.
-
- Please note that some vendors, notably Apple, do not implement the
- Compatibility profile. Therefore if you wish to target new OpenGL features
- on \macos then you should ensure that you request a Core profile context via
- QSurfaceFormat::setProfile().
-
- Qt provides classes for all version and Core and Compatibility profile
- combinations. The classes for OpenGL versions 3.1 through to 4.3 are:
-
- \list
- \li QOpenGLFunctions_3_1
- \li QOpenGLFunctions_3_2_Core
- \li QOpenGLFunctions_3_2_Compatibility
- \li QOpenGLFunctions_3_3_Core
- \li QOpenGLFunctions_3_3_Compatibility
- \li QOpenGLFunctions_4_0_Core
- \li QOpenGLFunctions_4_0_Compatibility
- \li QOpenGLFunctions_4_1_Core
- \li QOpenGLFunctions_4_1_Compatibility
- \li QOpenGLFunctions_4_2_Core
- \li QOpenGLFunctions_4_2_Compatibility
- \li QOpenGLFunctions_4_3_Core
- \li QOpenGLFunctions_4_3_Compatibility
- \endlist
-
- where each class inherits from QAbstractOpenGLFunctions.
-
- A pointer to an object of the class corresponding to the version and
- profile of OpenGL in use can be obtained from
- QOpenGLContext::versionFunctions(). If obtained in this way, note that
- the QOpenGLContext retains ownership of the object. This is so that only
- one instance need be created.
-
- Before calling any of the exposed OpenGL functions you must ensure that the
- object has resolved the function pointers to the OpenGL functions. This
- only needs to be done once per instance with initializeOpenGLFunctions().
- Once initialized, the object can be used to call any OpenGL function for
- the corresponding version and profile. Note that initializeOpenGLFunctions()
- can fail in some circumstances so check the return value. Situations in
- which initialization can fail are if you have a functions object for a version
- or profile that contains functions that are not part of the context being
- used to resolve the function pointers.
-
- If you exclusively use function objects then you will get compile time
- errors if you attempt to use a function not included in that version and
- profile. This is obviously a lot easier to debug than undefined behavior
- at run time.
-
- \sa QOpenGLContext::versionFunctions()
-*/
-/*!
- Constructs a QAbstractOpenGLFunctions object.
-*/
-QAbstractOpenGLFunctions::QAbstractOpenGLFunctions()
- : d_ptr(new QAbstractOpenGLFunctionsPrivate)
-{
-}
-
-/*!
- Destroys a QAbstractOpenGLFunctions object.
-*/
-QAbstractOpenGLFunctions::~QAbstractOpenGLFunctions()
-{
- Q_D(QAbstractOpenGLFunctions);
- if (d->owningContext)
- d->removeExternalFunctions(d->owningContext, this);
- delete d_ptr;
-}
-
-/*! \internal
- */
-bool QAbstractOpenGLFunctions::initializeOpenGLFunctions()
-{
- Q_D(QAbstractOpenGLFunctions);
- d->initialized = true;
-
- // For a subclass whose instance is not created via
- // QOpenGLContext::versionFunctions() owningContext is not set. Set it now
- // and register such instances to the context as external ones. These are
- // not owned by the context but still need certain cleanup when the context
- // is destroyed.
- if (!d->owningContext) {
- d->owningContext = QOpenGLContext::currentContext();
- if (d->owningContext)
- d->insertExternalFunctions(d->owningContext, this);
- }
-
- return true;
-}
-
-/*! \internal
- */
-bool QAbstractOpenGLFunctions::isInitialized() const
-{
- Q_D(const QAbstractOpenGLFunctions);
- return d->initialized;
-}
-
-/*! \internal
- */
-void QAbstractOpenGLFunctions::setOwningContext(const QOpenGLContext *context)
-{
- Q_D(QAbstractOpenGLFunctions);
- d->owningContext = const_cast<QOpenGLContext*>(context);
-}
-
-/*! \internal
- */
-QOpenGLContext *QAbstractOpenGLFunctions::owningContext() const
-{
- Q_D(const QAbstractOpenGLFunctions);
- return d->owningContext;
-}
-
-#if !defined(QT_OPENGL_ES_2)
-
-QT_OPENGL_IMPLEMENT(QOpenGLFunctions_1_0_CoreBackend, QT_OPENGL_1_0_FUNCTIONS)
-QT_OPENGL_IMPLEMENT(QOpenGLFunctions_1_1_CoreBackend, QT_OPENGL_1_1_FUNCTIONS)
-
-QT_OPENGL_IMPLEMENT(QOpenGLFunctions_1_2_CoreBackend, QT_OPENGL_1_2_FUNCTIONS)
-QT_OPENGL_IMPLEMENT(QOpenGLFunctions_1_3_CoreBackend, QT_OPENGL_1_3_FUNCTIONS)
-QT_OPENGL_IMPLEMENT(QOpenGLFunctions_1_4_CoreBackend, QT_OPENGL_1_4_FUNCTIONS)
-QT_OPENGL_IMPLEMENT(QOpenGLFunctions_1_5_CoreBackend, QT_OPENGL_1_5_FUNCTIONS)
-QT_OPENGL_IMPLEMENT(QOpenGLFunctions_2_0_CoreBackend, QT_OPENGL_2_0_FUNCTIONS)
-QT_OPENGL_IMPLEMENT(QOpenGLFunctions_2_1_CoreBackend, QT_OPENGL_2_1_FUNCTIONS)
-QT_OPENGL_IMPLEMENT(QOpenGLFunctions_3_0_CoreBackend, QT_OPENGL_3_0_FUNCTIONS)
-QT_OPENGL_IMPLEMENT(QOpenGLFunctions_3_1_CoreBackend, QT_OPENGL_3_1_FUNCTIONS)
-QT_OPENGL_IMPLEMENT(QOpenGLFunctions_3_2_CoreBackend, QT_OPENGL_3_2_FUNCTIONS)
-QT_OPENGL_IMPLEMENT(QOpenGLFunctions_3_3_CoreBackend, QT_OPENGL_3_3_FUNCTIONS)
-QT_OPENGL_IMPLEMENT(QOpenGLFunctions_4_0_CoreBackend, QT_OPENGL_4_0_FUNCTIONS)
-QT_OPENGL_IMPLEMENT(QOpenGLFunctions_4_1_CoreBackend, QT_OPENGL_4_1_FUNCTIONS)
-QT_OPENGL_IMPLEMENT(QOpenGLFunctions_4_2_CoreBackend, QT_OPENGL_4_2_FUNCTIONS)
-QT_OPENGL_IMPLEMENT(QOpenGLFunctions_4_3_CoreBackend, QT_OPENGL_4_3_FUNCTIONS)
-QT_OPENGL_IMPLEMENT(QOpenGLFunctions_4_4_CoreBackend, QT_OPENGL_4_4_FUNCTIONS)
-QT_OPENGL_IMPLEMENT(QOpenGLFunctions_4_5_CoreBackend, QT_OPENGL_4_5_FUNCTIONS)
-
-QT_OPENGL_IMPLEMENT(QOpenGLFunctions_1_0_DeprecatedBackend, QT_OPENGL_1_0_DEPRECATED_FUNCTIONS)
-QT_OPENGL_IMPLEMENT(QOpenGLFunctions_1_1_DeprecatedBackend, QT_OPENGL_1_1_DEPRECATED_FUNCTIONS)
-
-QT_OPENGL_IMPLEMENT(QOpenGLFunctions_1_2_DeprecatedBackend, QT_OPENGL_1_2_DEPRECATED_FUNCTIONS)
-QT_OPENGL_IMPLEMENT(QOpenGLFunctions_1_3_DeprecatedBackend, QT_OPENGL_1_3_DEPRECATED_FUNCTIONS)
-QT_OPENGL_IMPLEMENT(QOpenGLFunctions_1_4_DeprecatedBackend, QT_OPENGL_1_4_DEPRECATED_FUNCTIONS)
-QT_OPENGL_IMPLEMENT(QOpenGLFunctions_2_0_DeprecatedBackend, QT_OPENGL_2_0_DEPRECATED_FUNCTIONS)
-QT_OPENGL_IMPLEMENT(QOpenGLFunctions_3_0_DeprecatedBackend, QT_OPENGL_3_0_DEPRECATED_FUNCTIONS)
-QT_OPENGL_IMPLEMENT(QOpenGLFunctions_3_3_DeprecatedBackend, QT_OPENGL_3_3_DEPRECATED_FUNCTIONS)
-QT_OPENGL_IMPLEMENT(QOpenGLFunctions_4_5_DeprecatedBackend, QT_OPENGL_4_5_DEPRECATED_FUNCTIONS)
-
-#else
-
-// No backends for OpenGL ES 2
-
-#endif // !QT_OPENGL_ES_2
-
-QT_END_NAMESPACE
diff --git a/src/gui/opengl/qopenglversionfunctions.h b/src/gui/opengl/qopenglversionfunctions.h
deleted file mode 100644
index 4835ea4871..0000000000
--- a/src/gui/opengl/qopenglversionfunctions.h
+++ /dev/null
@@ -1,1912 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2013 Klaralvdalens Datakonsult AB (KDAB)
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the QtGui module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-**
-** This file was generated by glgen version 0.1
-** Command line was: glgen
-**
-** glgen is Copyright (C) 2013 Klaralvdalens Datakonsult AB (KDAB)
-**
-** This is an auto-generated file.
-** Do not edit! All changes made to it will be lost.
-**
-****************************************************************************/
-
-#ifndef QOPENGLVERSIONFUNCTIONS_H
-#define QOPENGLVERSIONFUNCTIONS_H
-
-#include <QtGui/qtguiglobal.h>
-
-#ifndef QT_NO_OPENGL
-
-#if QT_DEPRECATED_SINCE(5, 6)
-#include <QtCore/qhash.h>
-#endif
-#include <QtCore/qhashfunctions.h>
-#include <QtCore/qpair.h>
-#include <QtGui/qopengl.h>
-
-// MemoryBarrier is a macro on some architectures on Windows
-#ifdef Q_OS_WIN
-#pragma push_macro("MemoryBarrier")
-#undef MemoryBarrier
-#endif
-
-QT_BEGIN_NAMESPACE
-
-class QOpenGLContext;
-
-#if 0
-// silence syncqt warnings
-#pragma qt_class(QOpenGLVersionFunctions)
-#pragma qt_sync_stop_processing
-#endif
-
-#define QOPENGL_DEPRECATEDFUNCTION \
- qFatal("This function was erroneously included in previous versions of Qt and is here only for binary compatibility. " \
- "If you need to use this function, please use a legacy OpenGL version or a Compatibility profile.")
-
-struct QOpenGLVersionStatus
-{
- enum OpenGLStatus {
- CoreStatus,
- DeprecatedStatus,
- InvalidStatus
- };
-
- Q_DECL_CONSTEXPR QOpenGLVersionStatus()
- : version(0, 0),
- status(InvalidStatus)
- {}
-
- Q_DECL_CONSTEXPR QOpenGLVersionStatus(int majorVersion, int minorVersion, QOpenGLVersionStatus::OpenGLStatus functionStatus)
- : version(majorVersion, minorVersion),
- status(functionStatus)
- {}
-
- QPair<int, int> version;
- OpenGLStatus status;
-};
-
-inline uint qHash(const QOpenGLVersionStatus &v, uint seed = 0) noexcept
-{
- return qHash(static_cast<int>(v.status * 1000)
- + v.version.first * 100 + v.version.second * 10, seed);
-}
-
-Q_DECL_CONSTEXPR inline bool operator==(const QOpenGLVersionStatus &lhs, const QOpenGLVersionStatus &rhs)
-{
- return lhs.status == rhs.status && lhs.version == rhs.version;
-}
-
-Q_DECL_CONSTEXPR inline bool operator!=(const QOpenGLVersionStatus &lhs, const QOpenGLVersionStatus &rhs)
-{
- return !operator==(lhs, rhs);
-}
-
-#define QT_OPENGL_DECLARE_FUNCTIONS(ret, name, args) \
- ret (QOPENGLF_APIENTRYP name)args;
-#define QT_OPENGL_COUNT_FUNCTIONS(ret, name, args) +1
-
-#define QT_OPENGL_DECLARE(FUNCTIONS) \
-public: \
- struct Functions { \
- FUNCTIONS(QT_OPENGL_DECLARE_FUNCTIONS) \
- }; \
- union { \
- QFunctionPointer functions[FUNCTIONS(QT_OPENGL_COUNT_FUNCTIONS)]; \
- Functions f; \
- }; \
-private: \
- void init()
-
-class QOpenGLVersionFunctionsBackend
-{
-public:
-#define QT_OPENGL_VERSIONS(F) \
- F(1_0_Core) \
- F(1_1_Core) \
- F(1_2_Core) \
- F(1_3_Core) \
- F(1_4_Core) \
- F(1_5_Core) \
- F(2_0_Core) \
- F(2_1_Core) \
- F(3_0_Core) \
- F(3_1_Core) \
- F(3_2_Core) \
- F(3_3_Core) \
- F(4_0_Core) \
- F(4_1_Core) \
- F(4_2_Core) \
- F(4_3_Core) \
- F(4_4_Core) \
- F(4_5_Core) \
- F(1_0_Deprecated) \
- F(1_1_Deprecated) \
- F(1_2_Deprecated) \
- F(1_3_Deprecated) \
- F(1_4_Deprecated) \
- F(2_0_Deprecated) \
- F(3_0_Deprecated) \
- F(3_3_Deprecated) \
- F(4_5_Deprecated) \
-
-#define VERSION_ENUM(X) OpenGL_##X,
- enum Version {
- QT_OPENGL_VERSIONS(VERSION_ENUM)
- OpenGLVersionBackendCount
- };
-#undef VERSION_ENUM
-
- QOpenGLVersionFunctionsBackend(QOpenGLContext *ctx)
- : context(ctx)
- {}
-
- QOpenGLContext *context;
- QAtomicInt refs;
-};
-
-class QOpenGLVersionFunctionsStorage
-{
-public:
- QOpenGLVersionFunctionsStorage();
- ~QOpenGLVersionFunctionsStorage();
-
- QOpenGLVersionFunctionsBackend *backend(QOpenGLContext *context, QOpenGLVersionFunctionsBackend::Version v);
-
- QOpenGLVersionFunctionsBackend **backends;
-};
-
-class QAbstractOpenGLFunctions;
-
-class QAbstractOpenGLFunctionsPrivate
-{
-public:
- QAbstractOpenGLFunctionsPrivate()
- : owningContext(nullptr),
- initialized(false)
- {}
-
- static QOpenGLVersionFunctionsBackend *functionsBackend(QOpenGLContext *context, QOpenGLVersionFunctionsBackend::Version v);
- static void insertExternalFunctions(QOpenGLContext *context, QAbstractOpenGLFunctions *f);
- static void removeExternalFunctions(QOpenGLContext *context, QAbstractOpenGLFunctions *f);
-
- static QAbstractOpenGLFunctionsPrivate *get(QAbstractOpenGLFunctions *q);
-
- QOpenGLContext *owningContext;
- bool initialized;
-};
-
-class Q_GUI_EXPORT QAbstractOpenGLFunctions
-{
-public:
- virtual ~QAbstractOpenGLFunctions();
-
- virtual bool initializeOpenGLFunctions();
-
- Q_DISABLE_COPY(QAbstractOpenGLFunctions)
- Q_DECLARE_PRIVATE(QAbstractOpenGLFunctions)
-
-protected:
- QAbstractOpenGLFunctions();
- QAbstractOpenGLFunctionsPrivate *d_ptr;
-
- bool isInitialized() const;
-
- void setOwningContext(const QOpenGLContext *context);
- QOpenGLContext *owningContext() const;
-
- friend class QOpenGLContext;
-};
-
-inline QAbstractOpenGLFunctionsPrivate *QAbstractOpenGLFunctionsPrivate::get(QAbstractOpenGLFunctions *q)
-{
- return q->d_func();
-}
-
-#if !defined(QT_OPENGL_ES_2)
-
-class QOpenGLFunctions_1_0_CoreBackend : public QOpenGLVersionFunctionsBackend
-{
-public:
- QOpenGLFunctions_1_0_CoreBackend(QOpenGLContext *c)
- : QOpenGLVersionFunctionsBackend(c)
- {
- init();
- }
-
- Q_DECL_CONSTEXPR static Version versionStatus()
- { return OpenGL_1_0_Core; }
-
- // OpenGL 1.0 core functions
-#define QT_OPENGL_1_0_FUNCTIONS(F) \
- F(void, Viewport, (GLint x, GLint y, GLsizei width, GLsizei height)) \
- F(void, DepthRange, (GLdouble nearVal, GLdouble farVal)) \
- F(GLboolean, IsEnabled, (GLenum cap)) \
- F(void, GetTexLevelParameteriv, (GLenum target, GLint level, GLenum pname, GLint *params)) \
- F(void, GetTexLevelParameterfv, (GLenum target, GLint level, GLenum pname, GLfloat *params)) \
- F(void, GetTexParameteriv, (GLenum target, GLenum pname, GLint *params)) \
- F(void, GetTexParameterfv, (GLenum target, GLenum pname, GLfloat *params)) \
- F(void, GetTexImage, (GLenum target, GLint level, GLenum format, GLenum type, GLvoid *pixels)) \
- F(const GLubyte *, GetString, (GLenum name)) \
- F(void, GetIntegerv, (GLenum pname, GLint *data)) \
- F(void, GetFloatv, (GLenum pname, GLfloat *data)) \
- F(GLenum, GetError, ()) \
- F(void, GetDoublev, (GLenum pname, GLdouble *data)) \
- F(void, GetBooleanv, (GLenum pname, GLboolean *data)) \
- F(void, ReadPixels, (GLint x, GLint y, GLsizei width, GLsizei height, GLenum format, GLenum type, GLvoid *pixels)) \
- F(void, ReadBuffer, (GLenum src)) \
- F(void, PixelStorei, (GLenum pname, GLint param)) \
- F(void, PixelStoref, (GLenum pname, GLfloat param)) \
- F(void, DepthFunc, (GLenum func)) \
- F(void, StencilOp, (GLenum fail, GLenum zfail, GLenum zpass)) \
- F(void, StencilFunc, (GLenum func, GLint ref, GLuint mask)) \
- F(void, LogicOp, (GLenum opcode)) \
- F(void, BlendFunc, (GLenum sfactor, GLenum dfactor)) \
- F(void, Flush, ()) \
- F(void, Finish, ()) \
- F(void, Enable, (GLenum cap)) \
- F(void, Disable, (GLenum cap)) \
- F(void, DepthMask, (GLboolean flag)) \
- F(void, ColorMask, (GLboolean red, GLboolean green, GLboolean blue, GLboolean alpha)) \
- F(void, StencilMask, (GLuint mask)) \
- F(void, ClearDepth, (GLdouble depth)) \
- F(void, ClearStencil, (GLint s)) \
- F(void, ClearColor, (GLfloat red, GLfloat green, GLfloat blue, GLfloat alpha)) \
- F(void, Clear, (GLbitfield mask)) \
- F(void, DrawBuffer, (GLenum buf)) \
- F(void, TexImage2D, (GLenum target, GLint level, GLint internalformat, GLsizei width, GLsizei height, GLint border, GLenum format, GLenum type, const GLvoid *pixels)) \
- F(void, TexImage1D, (GLenum target, GLint level, GLint internalformat, GLsizei width, GLint border, GLenum format, GLenum type, const GLvoid *pixels)) \
- F(void, TexParameteriv, (GLenum target, GLenum pname, const GLint *params)) \
- F(void, TexParameteri, (GLenum target, GLenum pname, GLint param)) \
- F(void, TexParameterfv, (GLenum target, GLenum pname, const GLfloat *params)) \
- F(void, TexParameterf, (GLenum target, GLenum pname, GLfloat param)) \
- F(void, Scissor, (GLint x, GLint y, GLsizei width, GLsizei height)) \
- F(void, PolygonMode, (GLenum face, GLenum mode)) \
- F(void, PointSize, (GLfloat size)) \
- F(void, LineWidth, (GLfloat width)) \
- F(void, Hint, (GLenum target, GLenum mode)) \
- F(void, FrontFace, (GLenum mode)) \
- F(void, CullFace, (GLenum mode)) \
-
- QT_OPENGL_DECLARE(QT_OPENGL_1_0_FUNCTIONS);
-};
-
-class QOpenGLFunctions_1_1_CoreBackend : public QOpenGLVersionFunctionsBackend
-{
-public:
- QOpenGLFunctions_1_1_CoreBackend(QOpenGLContext *c)
- : QOpenGLVersionFunctionsBackend(c)
- {
- init();
- }
-
- Q_DECL_CONSTEXPR static Version versionStatus()
- { return OpenGL_1_1_Core; }
-
- // OpenGL 1.1 core functions
-#define QT_OPENGL_1_1_FUNCTIONS(F) \
- F(void, Indexubv, (const GLubyte *c)) \
- F(void, Indexub, (GLubyte c)) \
- F(GLboolean, IsTexture, (GLuint texture)) \
- F(void, GenTextures, (GLsizei n, GLuint *textures)) \
- F(void, DeleteTextures, (GLsizei n, const GLuint *textures)) \
- F(void, BindTexture, (GLenum target, GLuint texture)) \
- F(void, TexSubImage2D, (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLenum type, const GLvoid *pixels)) \
- F(void, TexSubImage1D, (GLenum target, GLint level, GLint xoffset, GLsizei width, GLenum format, GLenum type, const GLvoid *pixels)) \
- F(void, CopyTexSubImage2D, (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint x, GLint y, GLsizei width, GLsizei height)) \
- F(void, CopyTexSubImage1D, (GLenum target, GLint level, GLint xoffset, GLint x, GLint y, GLsizei width)) \
- F(void, CopyTexImage2D, (GLenum target, GLint level, GLenum internalformat, GLint x, GLint y, GLsizei width, GLsizei height, GLint border)) \
- F(void, CopyTexImage1D, (GLenum target, GLint level, GLenum internalformat, GLint x, GLint y, GLsizei width, GLint border)) \
- F(void, PolygonOffset, (GLfloat factor, GLfloat units)) \
- F(void, GetPointerv, (GLenum pname, GLvoid* *params)) \
- F(void, DrawElements, (GLenum mode, GLsizei count, GLenum type, const GLvoid *indices)) \
- F(void, DrawArrays, (GLenum mode, GLint first, GLsizei count)) \
-
- QT_OPENGL_DECLARE(QT_OPENGL_1_1_FUNCTIONS);
-};
-
-class QOpenGLFunctions_1_2_CoreBackend : public QOpenGLVersionFunctionsBackend
-{
-public:
- QOpenGLFunctions_1_2_CoreBackend(QOpenGLContext *c)
- : QOpenGLVersionFunctionsBackend(c)
- {
- init();
- }
-
- Q_DECL_CONSTEXPR static Version versionStatus()
- { return OpenGL_1_2_Core; }
-
- // OpenGL 1.2 core functions
-#define QT_OPENGL_1_2_FUNCTIONS(F) \
- F(void, CopyTexSubImage3D, (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLint x, GLint y, GLsizei width, GLsizei height)) \
- F(void, TexSubImage3D, (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLenum type, const GLvoid *pixels)) \
- F(void, TexImage3D, (GLenum target, GLint level, GLint internalformat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLenum format, GLenum type, const GLvoid *pixels)) \
- F(void, DrawRangeElements, (GLenum mode, GLuint start, GLuint end, GLsizei count, GLenum type, const GLvoid *indices)) \
- F(void, BlendEquation, (GLenum mode)) \
- F(void, BlendColor, (GLfloat red, GLfloat green, GLfloat blue, GLfloat alpha)) \
-
- QT_OPENGL_DECLARE(QT_OPENGL_1_2_FUNCTIONS);
-};
-
-class QOpenGLFunctions_1_3_CoreBackend : public QOpenGLVersionFunctionsBackend
-{
-public:
- QOpenGLFunctions_1_3_CoreBackend(QOpenGLContext *c)
- : QOpenGLVersionFunctionsBackend(c)
- {
- init();
- }
-
- Q_DECL_CONSTEXPR static Version versionStatus()
- { return OpenGL_1_3_Core; }
-
- // OpenGL 1.3 core functions
-#define QT_OPENGL_1_3_FUNCTIONS(F) \
- F(void, GetCompressedTexImage, (GLenum target, GLint level, GLvoid *img)) \
- F(void, CompressedTexSubImage1D, (GLenum target, GLint level, GLint xoffset, GLsizei width, GLenum format, GLsizei imageSize, const GLvoid *data)) \
- F(void, CompressedTexSubImage2D, (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLsizei imageSize, const GLvoid *data)) \
- F(void, CompressedTexSubImage3D, (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLsizei imageSize, const GLvoid *data)) \
- F(void, CompressedTexImage1D, (GLenum target, GLint level, GLenum internalformat, GLsizei width, GLint border, GLsizei imageSize, const GLvoid *data)) \
- F(void, CompressedTexImage2D, (GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLint border, GLsizei imageSize, const GLvoid *data)) \
- F(void, CompressedTexImage3D, (GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLsizei imageSize, const GLvoid *data)) \
- F(void, SampleCoverage, (GLfloat value, GLboolean invert)) \
- F(void, ActiveTexture, (GLenum texture)) \
-
- QT_OPENGL_DECLARE(QT_OPENGL_1_3_FUNCTIONS);
-};
-
-class QOpenGLFunctions_1_4_CoreBackend : public QOpenGLVersionFunctionsBackend
-{
-public:
- QOpenGLFunctions_1_4_CoreBackend(QOpenGLContext *c)
- : QOpenGLVersionFunctionsBackend(c)
- {
- init();
- }
-
- Q_DECL_CONSTEXPR static Version versionStatus()
- { return OpenGL_1_4_Core; }
-
- // OpenGL 1.4 core functions
-#define QT_OPENGL_1_4_FUNCTIONS(F) \
- F(void, PointParameteriv, (GLenum pname, const GLint *params)) \
- F(void, PointParameteri, (GLenum pname, GLint param)) \
- F(void, PointParameterfv, (GLenum pname, const GLfloat *params)) \
- F(void, PointParameterf, (GLenum pname, GLfloat param)) \
- F(void, MultiDrawElements, (GLenum mode, const GLsizei *count, GLenum type, const GLvoid* const *indices, GLsizei drawcount)) \
- F(void, MultiDrawArrays, (GLenum mode, const GLint *first, const GLsizei *count, GLsizei drawcount)) \
- F(void, BlendFuncSeparate, (GLenum sfactorRGB, GLenum dfactorRGB, GLenum sfactorAlpha, GLenum dfactorAlpha)) \
-
- QT_OPENGL_DECLARE(QT_OPENGL_1_4_FUNCTIONS);
-};
-
-class QOpenGLFunctions_1_5_CoreBackend : public QOpenGLVersionFunctionsBackend
-{
-public:
- QOpenGLFunctions_1_5_CoreBackend(QOpenGLContext *c)
- : QOpenGLVersionFunctionsBackend(c)
- {
- init();
- }
-
- Q_DECL_CONSTEXPR static Version versionStatus()
- { return OpenGL_1_5_Core; }
-
- // OpenGL 1.5 core functions
-#define QT_OPENGL_1_5_FUNCTIONS(F) \
- F(void, GetBufferPointerv, (GLenum target, GLenum pname, GLvoid* *params)) \
- F(void, GetBufferParameteriv, (GLenum target, GLenum pname, GLint *params)) \
- F(GLboolean, UnmapBuffer, (GLenum target)) \
- F(GLvoid*, MapBuffer, (GLenum target, GLenum access)) \
- F(void, GetBufferSubData, (GLenum target, GLintptr offset, GLsizeiptr size, GLvoid *data)) \
- F(void, BufferSubData, (GLenum target, GLintptr offset, GLsizeiptr size, const GLvoid *data)) \
- F(void, BufferData, (GLenum target, GLsizeiptr size, const GLvoid *data, GLenum usage)) \
- F(GLboolean, IsBuffer, (GLuint buffer)) \
- F(void, GenBuffers, (GLsizei n, GLuint *buffers)) \
- F(void, DeleteBuffers, (GLsizei n, const GLuint *buffers)) \
- F(void, BindBuffer, (GLenum target, GLuint buffer)) \
- F(void, GetQueryObjectuiv, (GLuint id, GLenum pname, GLuint *params)) \
- F(void, GetQueryObjectiv, (GLuint id, GLenum pname, GLint *params)) \
- F(void, GetQueryiv, (GLenum target, GLenum pname, GLint *params)) \
- F(void, EndQuery, (GLenum target)) \
- F(void, BeginQuery, (GLenum target, GLuint id)) \
- F(GLboolean, IsQuery, (GLuint id)) \
- F(void, DeleteQueries, (GLsizei n, const GLuint *ids)) \
- F(void, GenQueries, (GLsizei n, GLuint *ids)) \
-
- QT_OPENGL_DECLARE(QT_OPENGL_1_5_FUNCTIONS);
-};
-
-class QOpenGLFunctions_2_0_CoreBackend : public QOpenGLVersionFunctionsBackend
-{
-public:
- QOpenGLFunctions_2_0_CoreBackend(QOpenGLContext *c)
- : QOpenGLVersionFunctionsBackend(c)
- {
- init();
- }
-
- Q_DECL_CONSTEXPR static Version versionStatus()
- { return OpenGL_2_0_Core; }
-
- // OpenGL 2.0 core functions
-#define QT_OPENGL_2_0_FUNCTIONS(F) \
- F(void, VertexAttribPointer, (GLuint index, GLint size, GLenum type, GLboolean normalized, GLsizei stride, const GLvoid *pointer)) \
- F(void, ValidateProgram, (GLuint program)) \
- F(void, UniformMatrix4fv, (GLint location, GLsizei count, GLboolean transpose, const GLfloat *value)) \
- F(void, UniformMatrix3fv, (GLint location, GLsizei count, GLboolean transpose, const GLfloat *value)) \
- F(void, UniformMatrix2fv, (GLint location, GLsizei count, GLboolean transpose, const GLfloat *value)) \
- F(void, Uniform4iv, (GLint location, GLsizei count, const GLint *value)) \
- F(void, Uniform3iv, (GLint location, GLsizei count, const GLint *value)) \
- F(void, Uniform2iv, (GLint location, GLsizei count, const GLint *value)) \
- F(void, Uniform1iv, (GLint location, GLsizei count, const GLint *value)) \
- F(void, Uniform4fv, (GLint location, GLsizei count, const GLfloat *value)) \
- F(void, Uniform3fv, (GLint location, GLsizei count, const GLfloat *value)) \
- F(void, Uniform2fv, (GLint location, GLsizei count, const GLfloat *value)) \
- F(void, Uniform1fv, (GLint location, GLsizei count, const GLfloat *value)) \
- F(void, Uniform4i, (GLint location, GLint v0, GLint v1, GLint v2, GLint v3)) \
- F(void, Uniform3i, (GLint location, GLint v0, GLint v1, GLint v2)) \
- F(void, Uniform2i, (GLint location, GLint v0, GLint v1)) \
- F(void, Uniform1i, (GLint location, GLint v0)) \
- F(void, Uniform4f, (GLint location, GLfloat v0, GLfloat v1, GLfloat v2, GLfloat v3)) \
- F(void, Uniform3f, (GLint location, GLfloat v0, GLfloat v1, GLfloat v2)) \
- F(void, Uniform2f, (GLint location, GLfloat v0, GLfloat v1)) \
- F(void, Uniform1f, (GLint location, GLfloat v0)) \
- F(void, UseProgram, (GLuint program)) \
- F(void, ShaderSource, (GLuint shader, GLsizei count, const GLchar* const *string, const GLint *length)) \
- F(void, LinkProgram, (GLuint program)) \
- F(GLboolean, IsShader, (GLuint shader)) \
- F(GLboolean, IsProgram, (GLuint program)) \
- F(void, GetVertexAttribPointerv, (GLuint index, GLenum pname, GLvoid* *pointer)) \
- F(void, GetVertexAttribiv, (GLuint index, GLenum pname, GLint *params)) \
- F(void, GetVertexAttribfv, (GLuint index, GLenum pname, GLfloat *params)) \
- F(void, GetVertexAttribdv, (GLuint index, GLenum pname, GLdouble *params)) \
- F(void, GetUniformiv, (GLuint program, GLint location, GLint *params)) \
- F(void, GetUniformfv, (GLuint program, GLint location, GLfloat *params)) \
- F(GLint, GetUniformLocation, (GLuint program, const GLchar *name)) \
- F(void, GetShaderSource, (GLuint shader, GLsizei bufSize, GLsizei *length, GLchar *source)) \
- F(void, GetShaderInfoLog, (GLuint shader, GLsizei bufSize, GLsizei *length, GLchar *infoLog)) \
- F(void, GetShaderiv, (GLuint shader, GLenum pname, GLint *params)) \
- F(void, GetProgramInfoLog, (GLuint program, GLsizei bufSize, GLsizei *length, GLchar *infoLog)) \
- F(void, GetProgramiv, (GLuint program, GLenum pname, GLint *params)) \
- F(GLint, GetAttribLocation, (GLuint program, const GLchar *name)) \
- F(void, GetAttachedShaders, (GLuint program, GLsizei maxCount, GLsizei *count, GLuint *shaders)) \
- F(void, GetActiveUniform, (GLuint program, GLuint index, GLsizei bufSize, GLsizei *length, GLint *size, GLenum *type, GLchar *name)) \
- F(void, GetActiveAttrib, (GLuint program, GLuint index, GLsizei bufSize, GLsizei *length, GLint *size, GLenum *type, GLchar *name)) \
- F(void, EnableVertexAttribArray, (GLuint index)) \
- F(void, DisableVertexAttribArray, (GLuint index)) \
- F(void, DetachShader, (GLuint program, GLuint shader)) \
- F(void, DeleteShader, (GLuint shader)) \
- F(void, DeleteProgram, (GLuint program)) \
- F(GLuint, CreateShader, (GLenum type)) \
- F(GLuint, CreateProgram, ()) \
- F(void, CompileShader, (GLuint shader)) \
- F(void, BindAttribLocation, (GLuint program, GLuint index, const GLchar *name)) \
- F(void, AttachShader, (GLuint program, GLuint shader)) \
- F(void, StencilMaskSeparate, (GLenum face, GLuint mask)) \
- F(void, StencilFuncSeparate, (GLenum face, GLenum func, GLint ref, GLuint mask)) \
- F(void, StencilOpSeparate, (GLenum face, GLenum sfail, GLenum dpfail, GLenum dppass)) \
- F(void, DrawBuffers, (GLsizei n, const GLenum *bufs)) \
- F(void, BlendEquationSeparate, (GLenum modeRGB, GLenum modeAlpha)) \
- F(void, VertexAttrib4usv, (GLuint index, const GLushort *v)) \
- F(void, VertexAttrib4uiv, (GLuint index, const GLuint *v)) \
- F(void, VertexAttrib4ubv, (GLuint index, const GLubyte *v)) \
- F(void, VertexAttrib4sv, (GLuint index, const GLshort *v)) \
- F(void, VertexAttrib4s, (GLuint index, GLshort x, GLshort y, GLshort z, GLshort w)) \
- F(void, VertexAttrib4iv, (GLuint index, const GLint *v)) \
- F(void, VertexAttrib4fv, (GLuint index, const GLfloat *v)) \
- F(void, VertexAttrib4f, (GLuint index, GLfloat x, GLfloat y, GLfloat z, GLfloat w)) \
- F(void, VertexAttrib4dv, (GLuint index, const GLdouble *v)) \
- F(void, VertexAttrib4d, (GLuint index, GLdouble x, GLdouble y, GLdouble z, GLdouble w)) \
- F(void, VertexAttrib4bv, (GLuint index, const GLbyte *v)) \
- F(void, VertexAttrib4Nusv, (GLuint index, const GLushort *v)) \
- F(void, VertexAttrib4Nuiv, (GLuint index, const GLuint *v)) \
- F(void, VertexAttrib4Nubv, (GLuint index, const GLubyte *v)) \
- F(void, VertexAttrib4Nub, (GLuint index, GLubyte x, GLubyte y, GLubyte z, GLubyte w)) \
- F(void, VertexAttrib4Nsv, (GLuint index, const GLshort *v)) \
- F(void, VertexAttrib4Niv, (GLuint index, const GLint *v)) \
- F(void, VertexAttrib4Nbv, (GLuint index, const GLbyte *v)) \
- F(void, VertexAttrib3sv, (GLuint index, const GLshort *v)) \
- F(void, VertexAttrib3s, (GLuint index, GLshort x, GLshort y, GLshort z)) \
- F(void, VertexAttrib3fv, (GLuint index, const GLfloat *v)) \
- F(void, VertexAttrib3f, (GLuint index, GLfloat x, GLfloat y, GLfloat z)) \
- F(void, VertexAttrib3dv, (GLuint index, const GLdouble *v)) \
- F(void, VertexAttrib3d, (GLuint index, GLdouble x, GLdouble y, GLdouble z)) \
- F(void, VertexAttrib2sv, (GLuint index, const GLshort *v)) \
- F(void, VertexAttrib2s, (GLuint index, GLshort x, GLshort y)) \
- F(void, VertexAttrib2fv, (GLuint index, const GLfloat *v)) \
- F(void, VertexAttrib2f, (GLuint index, GLfloat x, GLfloat y)) \
- F(void, VertexAttrib2dv, (GLuint index, const GLdouble *v)) \
- F(void, VertexAttrib2d, (GLuint index, GLdouble x, GLdouble y)) \
- F(void, VertexAttrib1sv, (GLuint index, const GLshort *v)) \
- F(void, VertexAttrib1s, (GLuint index, GLshort x)) \
- F(void, VertexAttrib1fv, (GLuint index, const GLfloat *v)) \
- F(void, VertexAttrib1f, (GLuint index, GLfloat x)) \
- F(void, VertexAttrib1dv, (GLuint index, const GLdouble *v)) \
- F(void, VertexAttrib1d, (GLuint index, GLdouble x)) \
-
- QT_OPENGL_DECLARE(QT_OPENGL_2_0_FUNCTIONS);
-};
-
-class QOpenGLFunctions_2_1_CoreBackend : public QOpenGLVersionFunctionsBackend
-{
-public:
- QOpenGLFunctions_2_1_CoreBackend(QOpenGLContext *c)
- : QOpenGLVersionFunctionsBackend(c)
- {
- init();
- }
-
- Q_DECL_CONSTEXPR static Version versionStatus()
- { return OpenGL_2_1_Core; }
-
- // OpenGL 2.1 core functions
-#define QT_OPENGL_2_1_FUNCTIONS(F) \
- F(void, UniformMatrix4x3fv, (GLint location, GLsizei count, GLboolean transpose, const GLfloat *value)) \
- F(void, UniformMatrix3x4fv, (GLint location, GLsizei count, GLboolean transpose, const GLfloat *value)) \
- F(void, UniformMatrix4x2fv, (GLint location, GLsizei count, GLboolean transpose, const GLfloat *value)) \
- F(void, UniformMatrix2x4fv, (GLint location, GLsizei count, GLboolean transpose, const GLfloat *value)) \
- F(void, UniformMatrix3x2fv, (GLint location, GLsizei count, GLboolean transpose, const GLfloat *value)) \
- F(void, UniformMatrix2x3fv, (GLint location, GLsizei count, GLboolean transpose, const GLfloat *value)) \
-
- QT_OPENGL_DECLARE(QT_OPENGL_2_1_FUNCTIONS);
-};
-
-class QOpenGLFunctions_3_0_CoreBackend : public QOpenGLVersionFunctionsBackend
-{
-public:
- QOpenGLFunctions_3_0_CoreBackend(QOpenGLContext *c)
- : QOpenGLVersionFunctionsBackend(c)
- {
- init();
- }
-
- Q_DECL_CONSTEXPR static Version versionStatus()
- { return OpenGL_3_0_Core; }
-
- // OpenGL 3.0 core functions
-#define QT_OPENGL_3_0_FUNCTIONS(F) \
- F(GLboolean, IsVertexArray, (GLuint array)) \
- F(void, GenVertexArrays, (GLsizei n, GLuint *arrays)) \
- F(void, DeleteVertexArrays, (GLsizei n, const GLuint *arrays)) \
- F(void, BindVertexArray, (GLuint array)) \
- F(void, FlushMappedBufferRange, (GLenum target, GLintptr offset, GLsizeiptr length)) \
- F(GLvoid *, MapBufferRange, (GLenum target, GLintptr offset, GLsizeiptr length, GLbitfield access)) \
- F(void, FramebufferTextureLayer, (GLenum target, GLenum attachment, GLuint texture, GLint level, GLint layer)) \
- F(void, RenderbufferStorageMultisample, (GLenum target, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height)) \
- F(void, BlitFramebuffer, (GLint srcX0, GLint srcY0, GLint srcX1, GLint srcY1, GLint dstX0, GLint dstY0, GLint dstX1, GLint dstY1, GLbitfield mask, GLenum filter)) \
- F(void, GenerateMipmap, (GLenum target)) \
- F(void, GetFramebufferAttachmentParameteriv, (GLenum target, GLenum attachment, GLenum pname, GLint *params)) \
- F(void, FramebufferRenderbuffer, (GLenum target, GLenum attachment, GLenum renderbuffertarget, GLuint renderbuffer)) \
- F(void, FramebufferTexture3D, (GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level, GLint zoffset)) \
- F(void, FramebufferTexture2D, (GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level)) \
- F(void, FramebufferTexture1D, (GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level)) \
- F(GLenum, CheckFramebufferStatus, (GLenum target)) \
- F(void, GenFramebuffers, (GLsizei n, GLuint *framebuffers)) \
- F(void, DeleteFramebuffers, (GLsizei n, const GLuint *framebuffers)) \
- F(void, BindFramebuffer, (GLenum target, GLuint framebuffer)) \
- F(GLboolean, IsFramebuffer, (GLuint framebuffer)) \
- F(void, GetRenderbufferParameteriv, (GLenum target, GLenum pname, GLint *params)) \
- F(void, RenderbufferStorage, (GLenum target, GLenum internalformat, GLsizei width, GLsizei height)) \
- F(void, GenRenderbuffers, (GLsizei n, GLuint *renderbuffers)) \
- F(void, DeleteRenderbuffers, (GLsizei n, const GLuint *renderbuffers)) \
- F(void, BindRenderbuffer, (GLenum target, GLuint renderbuffer)) \
- F(GLboolean, IsRenderbuffer, (GLuint renderbuffer)) \
- F(const GLubyte *, GetStringi, (GLenum name, GLuint index)) \
- F(void, ClearBufferfi, (GLenum buffer, GLint drawbuffer, GLfloat depth, GLint stencil)) \
- F(void, ClearBufferfv, (GLenum buffer, GLint drawbuffer, const GLfloat *value)) \
- F(void, ClearBufferuiv, (GLenum buffer, GLint drawbuffer, const GLuint *value)) \
- F(void, ClearBufferiv, (GLenum buffer, GLint drawbuffer, const GLint *value)) \
- F(void, GetTexParameterIuiv, (GLenum target, GLenum pname, GLuint *params)) \
- F(void, GetTexParameterIiv, (GLenum target, GLenum pname, GLint *params)) \
- F(void, TexParameterIuiv, (GLenum target, GLenum pname, const GLuint *params)) \
- F(void, TexParameterIiv, (GLenum target, GLenum pname, const GLint *params)) \
- F(void, Uniform4uiv, (GLint location, GLsizei count, const GLuint *value)) \
- F(void, Uniform3uiv, (GLint location, GLsizei count, const GLuint *value)) \
- F(void, Uniform2uiv, (GLint location, GLsizei count, const GLuint *value)) \
- F(void, Uniform1uiv, (GLint location, GLsizei count, const GLuint *value)) \
- F(void, Uniform4ui, (GLint location, GLuint v0, GLuint v1, GLuint v2, GLuint v3)) \
- F(void, Uniform3ui, (GLint location, GLuint v0, GLuint v1, GLuint v2)) \
- F(void, Uniform2ui, (GLint location, GLuint v0, GLuint v1)) \
- F(void, Uniform1ui, (GLint location, GLuint v0)) \
- F(GLint, GetFragDataLocation, (GLuint program, const GLchar *name)) \
- F(void, BindFragDataLocation, (GLuint program, GLuint color, const GLchar *name)) \
- F(void, GetUniformuiv, (GLuint program, GLint location, GLuint *params)) \
- F(void, GetVertexAttribIuiv, (GLuint index, GLenum pname, GLuint *params)) \
- F(void, GetVertexAttribIiv, (GLuint index, GLenum pname, GLint *params)) \
- F(void, VertexAttribIPointer, (GLuint index, GLint size, GLenum type, GLsizei stride, const GLvoid *pointer)) \
- F(void, EndConditionalRender, ()) \
- F(void, BeginConditionalRender, (GLuint id, GLenum mode)) \
- F(void, ClampColor, (GLenum target, GLenum clamp)) \
- F(void, GetTransformFeedbackVarying, (GLuint program, GLuint index, GLsizei bufSize, GLsizei *length, GLsizei *size, GLenum *type, GLchar *name)) \
- F(void, TransformFeedbackVaryings, (GLuint program, GLsizei count, const GLchar* const *varyings, GLenum bufferMode)) \
- F(void, BindBufferBase, (GLenum target, GLuint index, GLuint buffer)) \
- F(void, BindBufferRange, (GLenum target, GLuint index, GLuint buffer, GLintptr offset, GLsizeiptr size)) \
- F(void, EndTransformFeedback, ()) \
- F(void, BeginTransformFeedback, (GLenum primitiveMode)) \
- F(GLboolean, IsEnabledi, (GLenum target, GLuint index)) \
- F(void, Disablei, (GLenum target, GLuint index)) \
- F(void, Enablei, (GLenum target, GLuint index)) \
- F(void, GetIntegeri_v,(GLenum target, GLuint index, GLint *data)) \
- F(void, GetBooleani_v,(GLenum target, GLuint index, GLboolean *data)) \
- F(void, ColorMaski, (GLuint index, GLboolean r, GLboolean g, GLboolean b, GLboolean a)) \
- F(void, VertexAttribI4usv, (GLuint index, const GLushort *v)) \
- F(void, VertexAttribI4ubv, (GLuint index, const GLubyte *v)) \
- F(void, VertexAttribI4sv, (GLuint index, const GLshort *v)) \
- F(void, VertexAttribI4bv, (GLuint index, const GLbyte *v)) \
- F(void, VertexAttribI4uiv, (GLuint index, const GLuint *v)) \
- F(void, VertexAttribI3uiv, (GLuint index, const GLuint *v)) \
- F(void, VertexAttribI2uiv, (GLuint index, const GLuint *v)) \
- F(void, VertexAttribI1uiv, (GLuint index, const GLuint *v)) \
- F(void, VertexAttribI4iv, (GLuint index, const GLint *v)) \
- F(void, VertexAttribI3iv, (GLuint index, const GLint *v)) \
- F(void, VertexAttribI2iv, (GLuint index, const GLint *v)) \
- F(void, VertexAttribI1iv, (GLuint index, const GLint *v)) \
- F(void, VertexAttribI4ui, (GLuint index, GLuint x, GLuint y, GLuint z, GLuint w)) \
- F(void, VertexAttribI3ui, (GLuint index, GLuint x, GLuint y, GLuint z)) \
- F(void, VertexAttribI2ui, (GLuint index, GLuint x, GLuint y)) \
- F(void, VertexAttribI1ui, (GLuint index, GLuint x)) \
- F(void, VertexAttribI4i, (GLuint index, GLint x, GLint y, GLint z, GLint w)) \
- F(void, VertexAttribI3i, (GLuint index, GLint x, GLint y, GLint z)) \
- F(void, VertexAttribI2i, (GLuint index, GLint x, GLint y)) \
- F(void, VertexAttribI1i, (GLuint index, GLint x)) \
-
- QT_OPENGL_DECLARE(QT_OPENGL_3_0_FUNCTIONS);
-};
-
-class QOpenGLFunctions_3_1_CoreBackend : public QOpenGLVersionFunctionsBackend
-{
-public:
- QOpenGLFunctions_3_1_CoreBackend(QOpenGLContext *c)
- : QOpenGLVersionFunctionsBackend(c)
- {
- init();
- }
-
- Q_DECL_CONSTEXPR static Version versionStatus()
- { return OpenGL_3_1_Core; }
-
- // OpenGL 3.1 core functions
-#define QT_OPENGL_3_1_FUNCTIONS(F) \
- F(void, CopyBufferSubData, (GLenum readTarget, GLenum writeTarget, GLintptr readOffset, GLintptr writeOffset, GLsizeiptr size)) \
- F(void, UniformBlockBinding, (GLuint program, GLuint uniformBlockIndex, GLuint uniformBlockBinding)) \
- F(void, GetActiveUniformBlockName, (GLuint program, GLuint uniformBlockIndex, GLsizei bufSize, GLsizei *length, GLchar *uniformBlockName)) \
- F(void, GetActiveUniformBlockiv, (GLuint program, GLuint uniformBlockIndex, GLenum pname, GLint *params)) \
- F(GLuint, GetUniformBlockIndex, (GLuint program, const GLchar *uniformBlockName)) \
- F(void, GetActiveUniformName, (GLuint program, GLuint uniformIndex, GLsizei bufSize, GLsizei *length, GLchar *uniformName)) \
- F(void, GetActiveUniformsiv, (GLuint program, GLsizei uniformCount, const GLuint *uniformIndices, GLenum pname, GLint *params)) \
- F(void, GetUniformIndices, (GLuint program, GLsizei uniformCount, const GLchar* const *uniformNames, GLuint *uniformIndices)) \
- F(void, PrimitiveRestartIndex, (GLuint index)) \
- F(void, TexBuffer, (GLenum target, GLenum internalformat, GLuint buffer)) \
- F(void, DrawElementsInstanced, (GLenum mode, GLsizei count, GLenum type, const GLvoid *indices, GLsizei instancecount)) \
- F(void, DrawArraysInstanced, (GLenum mode, GLint first, GLsizei count, GLsizei instancecount)) \
-
- QT_OPENGL_DECLARE(QT_OPENGL_3_1_FUNCTIONS);
-};
-
-class QOpenGLFunctions_3_2_CoreBackend : public QOpenGLVersionFunctionsBackend
-{
-public:
- QOpenGLFunctions_3_2_CoreBackend(QOpenGLContext *c)
- : QOpenGLVersionFunctionsBackend(c)
- {
- init();
- }
-
- Q_DECL_CONSTEXPR static Version versionStatus()
- { return OpenGL_3_2_Core; }
-
- // OpenGL 3.2 core functions
-#define QT_OPENGL_3_2_FUNCTIONS(F) \
- F(void, SampleMaski, (GLuint maskNumber, GLbitfield mask)) \
- F(void, GetMultisamplefv, (GLenum pname, GLuint index, GLfloat *val)) \
- F(void, TexImage3DMultisample, (GLenum target, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth, GLboolean fixedsamplelocations)) \
- F(void, TexImage2DMultisample, (GLenum target, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height, GLboolean fixedsamplelocations)) \
- F(void, GetSynciv, (GLsync sync, GLenum pname, GLsizei bufSize, GLsizei *length, GLint *values)) \
- F(void, GetInteger64v, (GLenum pname, GLint64 *data)) \
- F(void, WaitSync, (GLsync sync, GLbitfield flags, GLuint64 timeout)) \
- F(GLenum, ClientWaitSync, (GLsync sync, GLbitfield flags, GLuint64 timeout)) \
- F(void, DeleteSync, (GLsync sync)) \
- F(GLboolean, IsSync, (GLsync sync)) \
- F(GLsync, FenceSync, (GLenum condition, GLbitfield flags)) \
- F(void, ProvokingVertex, (GLenum mode)) \
- F(void, MultiDrawElementsBaseVertex, (GLenum mode, const GLsizei *count, GLenum type, const GLvoid* const *indices, GLsizei drawcount, const GLint *basevertex)) \
- F(void, DrawElementsInstancedBaseVertex, (GLenum mode, GLsizei count, GLenum type, const GLvoid *indices, GLsizei instancecount, GLint basevertex)) \
- F(void, DrawRangeElementsBaseVertex, (GLenum mode, GLuint start, GLuint end, GLsizei count, GLenum type, const GLvoid *indices, GLint basevertex)) \
- F(void, DrawElementsBaseVertex, (GLenum mode, GLsizei count, GLenum type, const GLvoid *indices, GLint basevertex)) \
- F(void, FramebufferTexture, (GLenum target, GLenum attachment, GLuint texture, GLint level)) \
- F(void, GetBufferParameteri64v, (GLenum target, GLenum pname, GLint64 *params)) \
- F(void, GetInteger64i_v,(GLenum target, GLuint index, GLint64 *data))
-
- QT_OPENGL_DECLARE(QT_OPENGL_3_2_FUNCTIONS);
-};
-
-class QOpenGLFunctions_3_3_CoreBackend : public QOpenGLVersionFunctionsBackend
-{
-public:
- QOpenGLFunctions_3_3_CoreBackend(QOpenGLContext *c)
- : QOpenGLVersionFunctionsBackend(c)
- {
- init();
- }
-
- Q_DECL_CONSTEXPR static Version versionStatus()
- { return OpenGL_3_3_Core; }
-
- // OpenGL 3.3 core functions
-#define QT_OPENGL_3_3_FUNCTIONS(F) \
- F(void, VertexAttribP4uiv, (GLuint index, GLenum type, GLboolean normalized, const GLuint *value)) \
- F(void, VertexAttribP4ui, (GLuint index, GLenum type, GLboolean normalized, GLuint value)) \
- F(void, VertexAttribP3uiv, (GLuint index, GLenum type, GLboolean normalized, const GLuint *value)) \
- F(void, VertexAttribP3ui, (GLuint index, GLenum type, GLboolean normalized, GLuint value)) \
- F(void, VertexAttribP2uiv, (GLuint index, GLenum type, GLboolean normalized, const GLuint *value)) \
- F(void, VertexAttribP2ui, (GLuint index, GLenum type, GLboolean normalized, GLuint value)) \
- F(void, VertexAttribP1uiv, (GLuint index, GLenum type, GLboolean normalized, const GLuint *value)) \
- F(void, VertexAttribP1ui, (GLuint index, GLenum type, GLboolean normalized, GLuint value)) \
- F(void, SecondaryColorP3uiv, (GLenum type, const GLuint *color)) \
- F(void, SecondaryColorP3ui, (GLenum type, GLuint color)) \
- F(void, ColorP4uiv, (GLenum type, const GLuint *color)) \
- F(void, ColorP4ui, (GLenum type, GLuint color)) \
- F(void, ColorP3uiv, (GLenum type, const GLuint *color)) \
- F(void, ColorP3ui, (GLenum type, GLuint color)) \
- F(void, NormalP3uiv, (GLenum type, const GLuint *coords)) \
- F(void, NormalP3ui, (GLenum type, GLuint coords)) \
- F(void, MultiTexCoordP4uiv, (GLenum texture, GLenum type, const GLuint *coords)) \
- F(void, MultiTexCoordP4ui, (GLenum texture, GLenum type, GLuint coords)) \
- F(void, MultiTexCoordP3uiv, (GLenum texture, GLenum type, const GLuint *coords)) \
- F(void, MultiTexCoordP3ui, (GLenum texture, GLenum type, GLuint coords)) \
- F(void, MultiTexCoordP2uiv, (GLenum texture, GLenum type, const GLuint *coords)) \
- F(void, MultiTexCoordP2ui, (GLenum texture, GLenum type, GLuint coords)) \
- F(void, MultiTexCoordP1uiv, (GLenum texture, GLenum type, const GLuint *coords)) \
- F(void, MultiTexCoordP1ui, (GLenum texture, GLenum type, GLuint coords)) \
- F(void, TexCoordP4uiv, (GLenum type, const GLuint *coords)) \
- F(void, TexCoordP4ui, (GLenum type, GLuint coords)) \
- F(void, TexCoordP3uiv, (GLenum type, const GLuint *coords)) \
- F(void, TexCoordP3ui, (GLenum type, GLuint coords)) \
- F(void, TexCoordP2uiv, (GLenum type, const GLuint *coords)) \
- F(void, TexCoordP2ui, (GLenum type, GLuint coords)) \
- F(void, TexCoordP1uiv, (GLenum type, const GLuint *coords)) \
- F(void, TexCoordP1ui, (GLenum type, GLuint coords)) \
- F(void, VertexP4uiv, (GLenum type, const GLuint *value)) \
- F(void, VertexP4ui, (GLenum type, GLuint value)) \
- F(void, VertexP3uiv, (GLenum type, const GLuint *value)) \
- F(void, VertexP3ui, (GLenum type, GLuint value)) \
- F(void, VertexP2uiv, (GLenum type, const GLuint *value)) \
- F(void, VertexP2ui, (GLenum type, GLuint value)) \
- F(void, GetQueryObjectui64v, (GLuint id, GLenum pname, GLuint64 *params)) \
- F(void, GetQueryObjecti64v, (GLuint id, GLenum pname, GLint64 *params)) \
- F(void, QueryCounter, (GLuint id, GLenum target)) \
- F(void, GetSamplerParameterIuiv, (GLuint sampler, GLenum pname, GLuint *params)) \
- F(void, GetSamplerParameterfv, (GLuint sampler, GLenum pname, GLfloat *params)) \
- F(void, GetSamplerParameterIiv, (GLuint sampler, GLenum pname, GLint *params)) \
- F(void, GetSamplerParameteriv, (GLuint sampler, GLenum pname, GLint *params)) \
- F(void, SamplerParameterIuiv, (GLuint sampler, GLenum pname, const GLuint *param)) \
- F(void, SamplerParameterIiv, (GLuint sampler, GLenum pname, const GLint *param)) \
- F(void, SamplerParameterfv, (GLuint sampler, GLenum pname, const GLfloat *param)) \
- F(void, SamplerParameterf, (GLuint sampler, GLenum pname, GLfloat param)) \
- F(void, SamplerParameteriv, (GLuint sampler, GLenum pname, const GLint *param)) \
- F(void, SamplerParameteri, (GLuint sampler, GLenum pname, GLint param)) \
- F(void, BindSampler, (GLuint unit, GLuint sampler)) \
- F(GLboolean, IsSampler, (GLuint sampler)) \
- F(void, DeleteSamplers, (GLsizei count, const GLuint *samplers)) \
- F(void, GenSamplers, (GLsizei count, GLuint *samplers)) \
- F(GLint, GetFragDataIndex, (GLuint program, const GLchar *name)) \
- F(void, BindFragDataLocationIndexed, (GLuint program, GLuint colorNumber, GLuint index, const GLchar *name)) \
- F(void, VertexAttribDivisor, (GLuint index, GLuint divisor)) \
-
- QT_OPENGL_DECLARE(QT_OPENGL_3_3_FUNCTIONS);
-};
-
-class QOpenGLFunctions_4_0_CoreBackend : public QOpenGLVersionFunctionsBackend
-{
-public:
- QOpenGLFunctions_4_0_CoreBackend(QOpenGLContext *c)
- : QOpenGLVersionFunctionsBackend(c)
- {
- init();
- }
-
- Q_DECL_CONSTEXPR static Version versionStatus()
- { return OpenGL_4_0_Core; }
-
- // OpenGL 4.0 core functions
-#define QT_OPENGL_4_0_FUNCTIONS(F) \
- F(void, GetQueryIndexediv, (GLenum target, GLuint index, GLenum pname, GLint *params)) \
- F(void, EndQueryIndexed, (GLenum target, GLuint index)) \
- F(void, BeginQueryIndexed, (GLenum target, GLuint index, GLuint id)) \
- F(void, DrawTransformFeedbackStream, (GLenum mode, GLuint id, GLuint stream)) \
- F(void, DrawTransformFeedback, (GLenum mode, GLuint id)) \
- F(void, ResumeTransformFeedback, ()) \
- F(void, PauseTransformFeedback, ()) \
- F(GLboolean, IsTransformFeedback, (GLuint id)) \
- F(void, GenTransformFeedbacks, (GLsizei n, GLuint *ids)) \
- F(void, DeleteTransformFeedbacks, (GLsizei n, const GLuint *ids)) \
- F(void, BindTransformFeedback, (GLenum target, GLuint id)) \
- F(void, PatchParameterfv, (GLenum pname, const GLfloat *values)) \
- F(void, PatchParameteri, (GLenum pname, GLint value)) \
- F(void, GetProgramStageiv, (GLuint program, GLenum shadertype, GLenum pname, GLint *values)) \
- F(void, GetUniformSubroutineuiv, (GLenum shadertype, GLint location, GLuint *params)) \
- F(void, UniformSubroutinesuiv, (GLenum shadertype, GLsizei count, const GLuint *indices)) \
- F(void, GetActiveSubroutineName, (GLuint program, GLenum shadertype, GLuint index, GLsizei bufsize, GLsizei *length, GLchar *name)) \
- F(void, GetActiveSubroutineUniformName, (GLuint program, GLenum shadertype, GLuint index, GLsizei bufsize, GLsizei *length, GLchar *name)) \
- F(void, GetActiveSubroutineUniformiv, (GLuint program, GLenum shadertype, GLuint index, GLenum pname, GLint *values)) \
- F(GLuint, GetSubroutineIndex, (GLuint program, GLenum shadertype, const GLchar *name)) \
- F(GLint, GetSubroutineUniformLocation, (GLuint program, GLenum shadertype, const GLchar *name)) \
- F(void, GetUniformdv, (GLuint program, GLint location, GLdouble *params)) \
- F(void, UniformMatrix4x3dv, (GLint location, GLsizei count, GLboolean transpose, const GLdouble *value)) \
- F(void, UniformMatrix4x2dv, (GLint location, GLsizei count, GLboolean transpose, const GLdouble *value)) \
- F(void, UniformMatrix3x4dv, (GLint location, GLsizei count, GLboolean transpose, const GLdouble *value)) \
- F(void, UniformMatrix3x2dv, (GLint location, GLsizei count, GLboolean transpose, const GLdouble *value)) \
- F(void, UniformMatrix2x4dv, (GLint location, GLsizei count, GLboolean transpose, const GLdouble *value)) \
- F(void, UniformMatrix2x3dv, (GLint location, GLsizei count, GLboolean transpose, const GLdouble *value)) \
- F(void, UniformMatrix4dv, (GLint location, GLsizei count, GLboolean transpose, const GLdouble *value)) \
- F(void, UniformMatrix3dv, (GLint location, GLsizei count, GLboolean transpose, const GLdouble *value)) \
- F(void, UniformMatrix2dv, (GLint location, GLsizei count, GLboolean transpose, const GLdouble *value)) \
- F(void, Uniform4dv, (GLint location, GLsizei count, const GLdouble *value)) \
- F(void, Uniform3dv, (GLint location, GLsizei count, const GLdouble *value)) \
- F(void, Uniform2dv, (GLint location, GLsizei count, const GLdouble *value)) \
- F(void, Uniform1dv, (GLint location, GLsizei count, const GLdouble *value)) \
- F(void, Uniform4d, (GLint location, GLdouble x, GLdouble y, GLdouble z, GLdouble w)) \
- F(void, Uniform3d, (GLint location, GLdouble x, GLdouble y, GLdouble z)) \
- F(void, Uniform2d, (GLint location, GLdouble x, GLdouble y)) \
- F(void, Uniform1d, (GLint location, GLdouble x)) \
- F(void, DrawElementsIndirect, (GLenum mode, GLenum type, const GLvoid *indirect)) \
- F(void, DrawArraysIndirect, (GLenum mode, const GLvoid *indirect)) \
- F(void, BlendFuncSeparatei, (GLuint buf, GLenum srcRGB, GLenum dstRGB, GLenum srcAlpha, GLenum dstAlpha)) \
- F(void, BlendFunci, (GLuint buf, GLenum src, GLenum dst)) \
- F(void, BlendEquationSeparatei, (GLuint buf, GLenum modeRGB, GLenum modeAlpha)) \
- F(void, BlendEquationi, (GLuint buf, GLenum mode)) \
- F(void, MinSampleShading, (GLfloat value)) \
-
- QT_OPENGL_DECLARE(QT_OPENGL_4_0_FUNCTIONS);
-};
-
-class QOpenGLFunctions_4_1_CoreBackend : public QOpenGLVersionFunctionsBackend
-{
-public:
- QOpenGLFunctions_4_1_CoreBackend(QOpenGLContext *c)
- : QOpenGLVersionFunctionsBackend(c)
- {
- init();
- }
-
- Q_DECL_CONSTEXPR static Version versionStatus()
- { return OpenGL_4_1_Core; }
-
- // OpenGL 4.1 core functions
-#define QT_OPENGL_4_1_FUNCTIONS(F) \
- F(void, GetDoublei_v, (GLenum target, GLuint index, GLdouble *data)) \
- F(void, GetFloati_v,(GLenum target, GLuint index, GLfloat *data)) \
- F(void, DepthRangeIndexed, (GLuint index, GLdouble n, GLdouble f)) \
- F(void, DepthRangeArrayv, (GLuint first, GLsizei count, const GLdouble *v)) \
- F(void, ScissorIndexedv, (GLuint index, const GLint *v)) \
- F(void, ScissorIndexed, (GLuint index, GLint left, GLint bottom, GLsizei width, GLsizei height)) \
- F(void, ScissorArrayv, (GLuint first, GLsizei count, const GLint *v)) \
- F(void, ViewportIndexedfv, (GLuint index, const GLfloat *v)) \
- F(void, ViewportIndexedf, (GLuint index, GLfloat x, GLfloat y, GLfloat w, GLfloat h)) \
- F(void, ViewportArrayv, (GLuint first, GLsizei count, const GLfloat *v)) \
- F(void, GetVertexAttribLdv, (GLuint index, GLenum pname, GLdouble *params)) \
- F(void, VertexAttribLPointer, (GLuint index, GLint size, GLenum type, GLsizei stride, const GLvoid *pointer)) \
- F(void, VertexAttribL4dv, (GLuint index, const GLdouble *v)) \
- F(void, VertexAttribL3dv, (GLuint index, const GLdouble *v)) \
- F(void, VertexAttribL2dv, (GLuint index, const GLdouble *v)) \
- F(void, VertexAttribL1dv, (GLuint index, const GLdouble *v)) \
- F(void, VertexAttribL4d, (GLuint index, GLdouble x, GLdouble y, GLdouble z, GLdouble w)) \
- F(void, VertexAttribL3d, (GLuint index, GLdouble x, GLdouble y, GLdouble z)) \
- F(void, VertexAttribL2d, (GLuint index, GLdouble x, GLdouble y)) \
- F(void, VertexAttribL1d, (GLuint index, GLdouble x)) \
- F(void, GetProgramPipelineInfoLog, (GLuint pipeline, GLsizei bufSize, GLsizei *length, GLchar *infoLog)) \
- F(void, ValidateProgramPipeline, (GLuint pipeline)) \
- F(void, ProgramUniformMatrix4x3dv, (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLdouble *value)) \
- F(void, ProgramUniformMatrix3x4dv, (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLdouble *value)) \
- F(void, ProgramUniformMatrix4x2dv, (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLdouble *value)) \
- F(void, ProgramUniformMatrix2x4dv, (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLdouble *value)) \
- F(void, ProgramUniformMatrix3x2dv, (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLdouble *value)) \
- F(void, ProgramUniformMatrix2x3dv, (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLdouble *value)) \
- F(void, ProgramUniformMatrix4x3fv, (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value)) \
- F(void, ProgramUniformMatrix3x4fv, (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value)) \
- F(void, ProgramUniformMatrix4x2fv, (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value)) \
- F(void, ProgramUniformMatrix2x4fv, (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value)) \
- F(void, ProgramUniformMatrix3x2fv, (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value)) \
- F(void, ProgramUniformMatrix2x3fv, (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value)) \
- F(void, ProgramUniformMatrix4dv, (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLdouble *value)) \
- F(void, ProgramUniformMatrix3dv, (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLdouble *value)) \
- F(void, ProgramUniformMatrix2dv, (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLdouble *value)) \
- F(void, ProgramUniformMatrix4fv, (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value)) \
- F(void, ProgramUniformMatrix3fv, (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value)) \
- F(void, ProgramUniformMatrix2fv, (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value)) \
- F(void, ProgramUniform4uiv, (GLuint program, GLint location, GLsizei count, const GLuint *value)) \
- F(void, ProgramUniform4ui, (GLuint program, GLint location, GLuint v0, GLuint v1, GLuint v2, GLuint v3)) \
- F(void, ProgramUniform4dv, (GLuint program, GLint location, GLsizei count, const GLdouble *value)) \
- F(void, ProgramUniform4d, (GLuint program, GLint location, GLdouble v0, GLdouble v1, GLdouble v2, GLdouble v3)) \
- F(void, ProgramUniform4fv, (GLuint program, GLint location, GLsizei count, const GLfloat *value)) \
- F(void, ProgramUniform4f, (GLuint program, GLint location, GLfloat v0, GLfloat v1, GLfloat v2, GLfloat v3)) \
- F(void, ProgramUniform4iv, (GLuint program, GLint location, GLsizei count, const GLint *value)) \
- F(void, ProgramUniform4i, (GLuint program, GLint location, GLint v0, GLint v1, GLint v2, GLint v3)) \
- F(void, ProgramUniform3uiv, (GLuint program, GLint location, GLsizei count, const GLuint *value)) \
- F(void, ProgramUniform3ui, (GLuint program, GLint location, GLuint v0, GLuint v1, GLuint v2)) \
- F(void, ProgramUniform3dv, (GLuint program, GLint location, GLsizei count, const GLdouble *value)) \
- F(void, ProgramUniform3d, (GLuint program, GLint location, GLdouble v0, GLdouble v1, GLdouble v2)) \
- F(void, ProgramUniform3fv, (GLuint program, GLint location, GLsizei count, const GLfloat *value)) \
- F(void, ProgramUniform3f, (GLuint program, GLint location, GLfloat v0, GLfloat v1, GLfloat v2)) \
- F(void, ProgramUniform3iv, (GLuint program, GLint location, GLsizei count, const GLint *value)) \
- F(void, ProgramUniform3i, (GLuint program, GLint location, GLint v0, GLint v1, GLint v2)) \
- F(void, ProgramUniform2uiv, (GLuint program, GLint location, GLsizei count, const GLuint *value)) \
- F(void, ProgramUniform2ui, (GLuint program, GLint location, GLuint v0, GLuint v1)) \
- F(void, ProgramUniform2dv, (GLuint program, GLint location, GLsizei count, const GLdouble *value)) \
- F(void, ProgramUniform2d, (GLuint program, GLint location, GLdouble v0, GLdouble v1)) \
- F(void, ProgramUniform2fv, (GLuint program, GLint location, GLsizei count, const GLfloat *value)) \
- F(void, ProgramUniform2f, (GLuint program, GLint location, GLfloat v0, GLfloat v1)) \
- F(void, ProgramUniform2iv, (GLuint program, GLint location, GLsizei count, const GLint *value)) \
- F(void, ProgramUniform2i, (GLuint program, GLint location, GLint v0, GLint v1)) \
- F(void, ProgramUniform1uiv, (GLuint program, GLint location, GLsizei count, const GLuint *value)) \
- F(void, ProgramUniform1ui, (GLuint program, GLint location, GLuint v0)) \
- F(void, ProgramUniform1dv, (GLuint program, GLint location, GLsizei count, const GLdouble *value)) \
- F(void, ProgramUniform1d, (GLuint program, GLint location, GLdouble v0)) \
- F(void, ProgramUniform1fv, (GLuint program, GLint location, GLsizei count, const GLfloat *value)) \
- F(void, ProgramUniform1f, (GLuint program, GLint location, GLfloat v0)) \
- F(void, ProgramUniform1iv, (GLuint program, GLint location, GLsizei count, const GLint *value)) \
- F(void, ProgramUniform1i, (GLuint program, GLint location, GLint v0)) \
- F(void, GetProgramPipelineiv, (GLuint pipeline, GLenum pname, GLint *params)) \
- F(GLboolean, IsProgramPipeline, (GLuint pipeline)) \
- F(void, GenProgramPipelines, (GLsizei n, GLuint *pipelines)) \
- F(void, DeleteProgramPipelines, (GLsizei n, const GLuint *pipelines)) \
- F(void, BindProgramPipeline, (GLuint pipeline)) \
- F(GLuint, CreateShaderProgramv, (GLenum type, GLsizei count, const GLchar* const *strings)) \
- F(void, ActiveShaderProgram, (GLuint pipeline, GLuint program)) \
- F(void, UseProgramStages, (GLuint pipeline, GLbitfield stages, GLuint program)) \
- F(void, ProgramParameteri, (GLuint program, GLenum pname, GLint value)) \
- F(void, ProgramBinary, (GLuint program, GLenum binaryFormat, const GLvoid *binary, GLsizei length)) \
- F(void, GetProgramBinary, (GLuint program, GLsizei bufSize, GLsizei *length, GLenum *binaryFormat, GLvoid *binary)) \
- F(void, ClearDepthf, (GLfloat dd)) \
- F(void, DepthRangef, (GLfloat n, GLfloat f)) \
- F(void, GetShaderPrecisionFormat, (GLenum shadertype, GLenum precisiontype, GLint *range, GLint *precision)) \
- F(void, ShaderBinary, (GLsizei count, const GLuint *shaders, GLenum binaryformat, const GLvoid *binary, GLsizei length)) \
- F(void, ReleaseShaderCompiler, ()) \
-
- QT_OPENGL_DECLARE(QT_OPENGL_4_1_FUNCTIONS);
-};
-
-class QOpenGLFunctions_4_2_CoreBackend : public QOpenGLVersionFunctionsBackend
-{
-public:
- QOpenGLFunctions_4_2_CoreBackend(QOpenGLContext *c)
- : QOpenGLVersionFunctionsBackend(c)
- {
- init();
- }
-
- Q_DECL_CONSTEXPR static Version versionStatus()
- { return OpenGL_4_2_Core; }
-
- // OpenGL 4.2 core functions
-#define QT_OPENGL_4_2_FUNCTIONS(F) \
- F(void, TexStorage3D, (GLenum target, GLsizei levels, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth)) \
- F(void, TexStorage2D, (GLenum target, GLsizei levels, GLenum internalformat, GLsizei width, GLsizei height)) \
- F(void, TexStorage1D, (GLenum target, GLsizei levels, GLenum internalformat, GLsizei width)) \
- F(void, MemoryBarrier, (GLbitfield barriers)) \
- F(void, BindImageTexture, (GLuint unit, GLuint texture, GLint level, GLboolean layered, GLint layer, GLenum access, GLenum format)) \
- F(void, GetActiveAtomicCounterBufferiv, (GLuint program, GLuint bufferIndex, GLenum pname, GLint *params)) \
- F(void, GetInternalformativ, (GLenum target, GLenum internalformat, GLenum pname, GLsizei bufSize, GLint *params)) \
- F(void, DrawTransformFeedbackStreamInstanced, (GLenum mode, GLuint id, GLuint stream, GLsizei instancecount)) \
- F(void, DrawTransformFeedbackInstanced, (GLenum mode, GLuint id, GLsizei instancecount)) \
- F(void, DrawElementsInstancedBaseVertexBaseInstance, (GLenum mode, GLsizei count, GLenum type, const void *indices, GLsizei instancecount, GLint basevertex, GLuint baseinstance)) \
- F(void, DrawElementsInstancedBaseInstance, (GLenum mode, GLsizei count, GLenum type, const void *indices, GLsizei instancecount, GLuint baseinstance)) \
- F(void, DrawArraysInstancedBaseInstance, (GLenum mode, GLint first, GLsizei count, GLsizei instancecount, GLuint baseinstance)) \
-
- QT_OPENGL_DECLARE(QT_OPENGL_4_2_FUNCTIONS);
-};
-
-class QOpenGLFunctions_4_3_CoreBackend : public QOpenGLVersionFunctionsBackend
-{
-public:
- QOpenGLFunctions_4_3_CoreBackend(QOpenGLContext *c)
- : QOpenGLVersionFunctionsBackend(c)
- {
- init();
- }
-
- Q_DECL_CONSTEXPR static Version versionStatus()
- { return OpenGL_4_3_Core; }
-
- // OpenGL 4.3 core functions
-#define QT_OPENGL_4_3_FUNCTIONS(F) \
- F(void, TexStorage3DMultisample, (GLenum target, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth, GLboolean fixedsamplelocations)) \
- F(void, TexStorage2DMultisample, (GLenum target, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height, GLboolean fixedsamplelocations)) \
- F(void, TexBufferRange, (GLenum target, GLenum internalformat, GLuint buffer, GLintptr offset, GLsizeiptr size)) \
- F(void, ShaderStorageBlockBinding, (GLuint program, GLuint storageBlockIndex, GLuint storageBlockBinding)) \
- F(GLint, GetProgramResourceLocationIndex, (GLuint program, GLenum programInterface, const GLchar *name)) \
- F(GLint, GetProgramResourceLocation, (GLuint program, GLenum programInterface, const GLchar *name)) \
- F(void, GetProgramResourceiv, (GLuint program, GLenum programInterface, GLuint index, GLsizei propCount, const GLenum *props, GLsizei bufSize, GLsizei *length, GLint *params)) \
- F(void, GetProgramResourceName, (GLuint program, GLenum programInterface, GLuint index, GLsizei bufSize, GLsizei *length, GLchar *name)) \
- F(GLuint, GetProgramResourceIndex, (GLuint program, GLenum programInterface, const GLchar *name)) \
- F(void, GetProgramInterfaceiv, (GLuint program, GLenum programInterface, GLenum pname, GLint *params)) \
- F(void, MultiDrawElementsIndirect, (GLenum mode, GLenum type, const void *indirect, GLsizei drawcount, GLsizei stride)) \
- F(void, MultiDrawArraysIndirect, (GLenum mode, const void *indirect, GLsizei drawcount, GLsizei stride)) \
- F(void, InvalidateSubFramebuffer, (GLenum target, GLsizei numAttachments, const GLenum *attachments, GLint x, GLint y, GLsizei width, GLsizei height)) \
- F(void, InvalidateFramebuffer, (GLenum target, GLsizei numAttachments, const GLenum *attachments)) \
- F(void, InvalidateBufferData, (GLuint buffer)) \
- F(void, InvalidateBufferSubData, (GLuint buffer, GLintptr offset, GLsizeiptr length)) \
- F(void, InvalidateTexImage, (GLuint texture, GLint level)) \
- F(void, InvalidateTexSubImage, (GLuint texture, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth)) \
- F(void, GetInternalformati64v, (GLenum target, GLenum internalformat, GLenum pname, GLsizei bufSize, GLint64 *params)) \
- F(void, GetFramebufferParameteriv, (GLenum target, GLenum pname, GLint *params)) \
- F(void, FramebufferParameteri, (GLenum target, GLenum pname, GLint param)) \
- F(void, VertexBindingDivisor, (GLuint bindingindex, GLuint divisor)) \
- F(void, VertexAttribBinding, (GLuint attribindex, GLuint bindingindex)) \
- F(void, VertexAttribLFormat, (GLuint attribindex, GLint size, GLenum type, GLuint relativeoffset)) \
- F(void, VertexAttribIFormat, (GLuint attribindex, GLint size, GLenum type, GLuint relativeoffset)) \
- F(void, VertexAttribFormat, (GLuint attribindex, GLint size, GLenum type, GLboolean normalized, GLuint relativeoffset)) \
- F(void, BindVertexBuffer, (GLuint bindingindex, GLuint buffer, GLintptr offset, GLsizei stride)) \
- F(void, TextureView, (GLuint texture, GLenum target, GLuint origtexture, GLenum internalformat, GLuint minlevel, GLuint numlevels, GLuint minlayer, GLuint numlayers)) \
- F(void, CopyImageSubData, (GLuint srcName, GLenum srcTarget, GLint srcLevel, GLint srcX, GLint srcY, GLint srcZ, GLuint dstName, GLenum dstTarget, GLint dstLevel, GLint dstX, GLint dstY, GLint dstZ, GLsizei srcWidth, GLsizei srcHeight, GLsizei srcDepth)) \
- F(void, DispatchComputeIndirect, (GLintptr indirect)) \
- F(void, DispatchCompute, (GLuint num_groups_x, GLuint num_groups_y, GLuint num_groups_z)) \
- F(void, ClearBufferSubData, (GLenum target, GLenum internalformat, GLintptr offset, GLsizeiptr size, GLenum format, GLenum type, const void *data)) \
- F(void, ClearBufferData, (GLenum target, GLenum internalformat, GLenum format, GLenum type, const void *data)) \
- F(void, GetObjectPtrLabel, (const GLvoid *ptr, GLsizei bufSize, GLsizei *length, GLchar *label)) \
- F(void, ObjectPtrLabel, (const GLvoid *ptr, GLsizei length, const GLchar *label)) \
- F(void, GetObjectLabel, (GLenum identifier, GLuint name, GLsizei bufSize, GLsizei *length, GLchar *label)) \
- F(void, ObjectLabel, (GLenum identifier, GLuint name, GLsizei length, const GLchar *label)) \
- F(void, PopDebugGroup, ()) \
- F(void, PushDebugGroup, (GLenum source, GLuint id, GLsizei length, const GLchar *message)) \
- F(GLuint, GetDebugMessageLog, (GLuint count, GLsizei bufSize, GLenum *sources, GLenum *types, GLuint *ids, GLenum *severities, GLsizei *lengths, GLchar *messageLog)) \
- F(void, DebugMessageCallback, (GLDEBUGPROC callback, const GLvoid *userParam)) \
- F(void, DebugMessageInsert, (GLenum source, GLenum type, GLuint id, GLenum severity, GLsizei length, const GLchar *buf)) \
- F(void, DebugMessageControl, (GLenum source, GLenum type, GLenum severity, GLsizei count, const GLuint *ids, GLboolean enabled)) \
-
- QT_OPENGL_DECLARE(QT_OPENGL_4_3_FUNCTIONS);
-};
-
-class QOpenGLFunctions_4_4_CoreBackend : public QOpenGLVersionFunctionsBackend
-{
-public:
- QOpenGLFunctions_4_4_CoreBackend(QOpenGLContext *c)
- : QOpenGLVersionFunctionsBackend(c)
- {
- init();
- }
-
- Q_DECL_CONSTEXPR static Version versionStatus()
- { return OpenGL_4_4_Core; }
-
- // OpenGL 4.4 core functions
-#define QT_OPENGL_4_4_FUNCTIONS(F) \
- F(void, BindVertexBuffers, (GLuint first, GLsizei count, const GLuint *buffers, const GLintptr *offsets, const GLsizei *strides)) \
- F(void, BindImageTextures, (GLuint first, GLsizei count, const GLuint *textures)) \
- F(void, BindSamplers, (GLuint first, GLsizei count, const GLuint *samplers)) \
- F(void, BindTextures, (GLuint first, GLsizei count, const GLuint *textures)) \
- F(void, BindBuffersRange, (GLenum target, GLuint first, GLsizei count, const GLuint *buffers, const GLintptr *offsets, const GLsizeiptr *sizes)) \
- F(void, BindBuffersBase, (GLenum target, GLuint first, GLsizei count, const GLuint *buffers)) \
- F(void, ClearTexSubImage, (GLuint texture, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLenum type, const void *data)) \
- F(void, ClearTexImage, (GLuint texture, GLint level, GLenum format, GLenum type, const void *data)) \
- F(void, BufferStorage, (GLenum target, GLsizeiptr size, const void *data, GLbitfield flags)) \
-
- QT_OPENGL_DECLARE(QT_OPENGL_4_4_FUNCTIONS);
-};
-
-class QOpenGLFunctions_4_5_CoreBackend : public QOpenGLVersionFunctionsBackend
-{
-public:
- QOpenGLFunctions_4_5_CoreBackend(QOpenGLContext *c)
- : QOpenGLVersionFunctionsBackend(c)
- {
- init();
- }
-
- Q_DECL_CONSTEXPR static Version versionStatus()
- { return OpenGL_4_5_Core; }
-
- // OpenGL 4.5 core functions
-#define QT_OPENGL_4_5_FUNCTIONS(F) \
- F(void, TextureBarrier, ()) \
- F(void, ReadnPixels, (GLint x, GLint y, GLsizei width, GLsizei height, GLenum format, GLenum type, GLsizei bufSize, void *data)) \
- F(void, GetnUniformuiv, (GLuint program, GLint location, GLsizei bufSize, GLuint *params)) \
- F(void, GetnUniformiv, (GLuint program, GLint location, GLsizei bufSize, GLint *params)) \
- F(void, GetnUniformfv, (GLuint program, GLint location, GLsizei bufSize, GLfloat *params)) \
- F(void, GetnUniformdv, (GLuint program, GLint location, GLsizei bufSize, GLdouble *params)) \
- F(void, GetnTexImage, (GLenum target, GLint level, GLenum format, GLenum type, GLsizei bufSize, void *pixels)) \
- F(void, GetnCompressedTexImage, (GLenum target, GLint lod, GLsizei bufSize, void *pixels)) \
- F(GLenum, GetGraphicsResetStatus, ()) \
- F(void, GetCompressedTextureSubImage, (GLuint texture, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLsizei bufSize, void *pixels)) \
- F(void, GetTextureSubImage, (GLuint texture, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLenum type, GLsizei bufSize, void *pixels)) \
- F(void, MemoryBarrierByRegion, (GLbitfield barriers)) \
- F(void, CreateQueries, (GLenum target, GLsizei n, GLuint *ids)) \
- F(void, CreateProgramPipelines, (GLsizei n, GLuint *pipelines)) \
- F(void, CreateSamplers, (GLsizei n, GLuint *samplers)) \
- F(void, GetVertexArrayIndexed64iv, (GLuint vaobj, GLuint index, GLenum pname, GLint64 *param)) \
- F(void, GetVertexArrayIndexediv, (GLuint vaobj, GLuint index, GLenum pname, GLint *param)) \
- F(void, GetVertexArrayiv, (GLuint vaobj, GLenum pname, GLint *param)) \
- F(void, VertexArrayBindingDivisor, (GLuint vaobj, GLuint bindingindex, GLuint divisor)) \
- F(void, VertexArrayAttribLFormat, (GLuint vaobj, GLuint attribindex, GLint size, GLenum type, GLuint relativeoffset)) \
- F(void, VertexArrayAttribIFormat, (GLuint vaobj, GLuint attribindex, GLint size, GLenum type, GLuint relativeoffset)) \
- F(void, VertexArrayAttribFormat, (GLuint vaobj, GLuint attribindex, GLint size, GLenum type, GLboolean normalized, GLuint relativeoffset)) \
- F(void, VertexArrayAttribBinding, (GLuint vaobj, GLuint attribindex, GLuint bindingindex)) \
- F(void, VertexArrayVertexBuffers, (GLuint vaobj, GLuint first, GLsizei count, const GLuint *buffers, const GLintptr *offsets, const GLsizei *strides)) \
- F(void, VertexArrayVertexBuffer, (GLuint vaobj, GLuint bindingindex, GLuint buffer, GLintptr offset, GLsizei stride)) \
- F(void, VertexArrayElementBuffer, (GLuint vaobj, GLuint buffer)) \
- F(void, EnableVertexArrayAttrib, (GLuint vaobj, GLuint index)) \
- F(void, DisableVertexArrayAttrib, (GLuint vaobj, GLuint index)) \
- F(void, CreateVertexArrays, (GLsizei n, GLuint *arrays)) \
- F(void, GetTextureParameteriv, (GLuint texture, GLenum pname, GLint *params)) \
- F(void, GetTextureParameterIuiv, (GLuint texture, GLenum pname, GLuint *params)) \
- F(void, GetTextureParameterIiv, (GLuint texture, GLenum pname, GLint *params)) \
- F(void, GetTextureParameterfv, (GLuint texture, GLenum pname, GLfloat *params)) \
- F(void, GetTextureLevelParameteriv, (GLuint texture, GLint level, GLenum pname, GLint *params)) \
- F(void, GetTextureLevelParameterfv, (GLuint texture, GLint level, GLenum pname, GLfloat *params)) \
- F(void, GetCompressedTextureImage, (GLuint texture, GLint level, GLsizei bufSize, void *pixels)) \
- F(void, GetTextureImage, (GLuint texture, GLint level, GLenum format, GLenum type, GLsizei bufSize, void *pixels)) \
- F(void, BindTextureUnit, (GLuint unit, GLuint texture)) \
- F(void, GenerateTextureMipmap, (GLuint texture)) \
- F(void, TextureParameteriv, (GLuint texture, GLenum pname, const GLint *param)) \
- F(void, TextureParameterIuiv, (GLuint texture, GLenum pname, const GLuint *params)) \
- F(void, TextureParameterIiv, (GLuint texture, GLenum pname, const GLint *params)) \
- F(void, TextureParameteri, (GLuint texture, GLenum pname, GLint param)) \
- F(void, TextureParameterfv, (GLuint texture, GLenum pname, const GLfloat *param)) \
- F(void, TextureParameterf, (GLuint texture, GLenum pname, GLfloat param)) \
- F(void, CopyTextureSubImage3D, (GLuint texture, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLint x, GLint y, GLsizei width, GLsizei height)) \
- F(void, CopyTextureSubImage2D, (GLuint texture, GLint level, GLint xoffset, GLint yoffset, GLint x, GLint y, GLsizei width, GLsizei height)) \
- F(void, CopyTextureSubImage1D, (GLuint texture, GLint level, GLint xoffset, GLint x, GLint y, GLsizei width)) \
- F(void, CompressedTextureSubImage3D, (GLuint texture, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLsizei imageSize, const void *data)) \
- F(void, CompressedTextureSubImage2D, (GLuint texture, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLsizei imageSize, const void *data)) \
- F(void, CompressedTextureSubImage1D, (GLuint texture, GLint level, GLint xoffset, GLsizei width, GLenum format, GLsizei imageSize, const void *data)) \
- F(void, TextureSubImage3D, (GLuint texture, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLenum type, const void *pixels)) \
- F(void, TextureSubImage2D, (GLuint texture, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLenum type, const void *pixels)) \
- F(void, TextureSubImage1D, (GLuint texture, GLint level, GLint xoffset, GLsizei width, GLenum format, GLenum type, const void *pixels)) \
- F(void, TextureStorage3DMultisample, (GLuint texture, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth, GLboolean fixedsamplelocations)) \
- F(void, TextureStorage2DMultisample, (GLuint texture, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height, GLboolean fixedsamplelocations)) \
- F(void, TextureStorage3D, (GLuint texture, GLsizei levels, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth)) \
- F(void, TextureStorage2D, (GLuint texture, GLsizei levels, GLenum internalformat, GLsizei width, GLsizei height)) \
- F(void, TextureStorage1D, (GLuint texture, GLsizei levels, GLenum internalformat, GLsizei width)) \
- F(void, TextureBufferRange, (GLuint texture, GLenum internalformat, GLuint buffer, GLintptr offset, GLsizei size)) \
- F(void, TextureBuffer, (GLuint texture, GLenum internalformat, GLuint buffer)) \
- F(void, CreateTextures, (GLenum target, GLsizei n, GLuint *textures)) \
- F(void, GetNamedRenderbufferParameteriv, (GLuint renderbuffer, GLenum pname, GLint *params)) \
- F(void, NamedRenderbufferStorageMultisample, (GLuint renderbuffer, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height)) \
- F(void, NamedRenderbufferStorage, (GLuint renderbuffer, GLenum internalformat, GLsizei width, GLsizei height)) \
- F(void, CreateRenderbuffers, (GLsizei n, GLuint *renderbuffers)) \
- F(void, GetNamedFramebufferAttachmentParameteriv, (GLuint framebuffer, GLenum attachment, GLenum pname, GLint *params)) \
- F(void, GetNamedFramebufferParameteriv, (GLuint framebuffer, GLenum pname, GLint *param)) \
- F(GLenum, CheckNamedFramebufferStatus, (GLuint framebuffer, GLenum target)) \
- F(void, BlitNamedFramebuffer, (GLuint readFramebuffer, GLuint drawFramebuffer, GLint srcX0, GLint srcY0, GLint srcX1, GLint srcY1, GLint dstX0, GLint dstY0, GLint dstX1, GLint dstY1, GLbitfield mask, GLenum filter)) \
- F(void, ClearNamedFramebufferfi, (GLuint framebuffer, GLenum buffer, GLfloat depth, GLint stencil)) \
- F(void, ClearNamedFramebufferfv, (GLuint framebuffer, GLenum buffer, GLint drawbuffer, const GLfloat *value)) \
- F(void, ClearNamedFramebufferuiv, (GLuint framebuffer, GLenum buffer, GLint drawbuffer, const GLuint *value)) \
- F(void, ClearNamedFramebufferiv, (GLuint framebuffer, GLenum buffer, GLint drawbuffer, const GLint *value)) \
- F(void, InvalidateNamedFramebufferSubData, (GLuint framebuffer, GLsizei numAttachments, const GLenum *attachments, GLint x, GLint y, GLsizei width, GLsizei height)) \
- F(void, InvalidateNamedFramebufferData, (GLuint framebuffer, GLsizei numAttachments, const GLenum *attachments)) \
- F(void, NamedFramebufferReadBuffer, (GLuint framebuffer, GLenum src)) \
- F(void, NamedFramebufferDrawBuffers, (GLuint framebuffer, GLsizei n, const GLenum *bufs)) \
- F(void, NamedFramebufferDrawBuffer, (GLuint framebuffer, GLenum buf)) \
- F(void, NamedFramebufferTextureLayer, (GLuint framebuffer, GLenum attachment, GLuint texture, GLint level, GLint layer)) \
- F(void, NamedFramebufferTexture, (GLuint framebuffer, GLenum attachment, GLuint texture, GLint level)) \
- F(void, NamedFramebufferParameteri, (GLuint framebuffer, GLenum pname, GLint param)) \
- F(void, NamedFramebufferRenderbuffer, (GLuint framebuffer, GLenum attachment, GLenum renderbuffertarget, GLuint renderbuffer)) \
- F(void, CreateFramebuffers, (GLsizei n, GLuint *framebuffers)) \
- F(void, GetNamedBufferSubData, (GLuint buffer, GLintptr offset, GLsizei size, void *data)) \
- F(void, GetNamedBufferPointerv, (GLuint buffer, GLenum pname, GLvoid* *params)) \
- F(void, GetNamedBufferParameteri64v, (GLuint buffer, GLenum pname, GLint64 *params)) \
- F(void, GetNamedBufferParameteriv, (GLuint buffer, GLenum pname, GLint *params)) \
- F(void, FlushMappedNamedBufferRange, (GLuint buffer, GLintptr offset, GLsizei length)) \
- F(GLboolean, UnmapNamedBuffer, (GLuint buffer)) \
- F(GLvoid *, MapNamedBufferRange, (GLuint buffer, GLintptr offset, GLsizei length, GLbitfield access)) \
- F(GLvoid *, MapNamedBuffer, (GLuint buffer, GLenum access)) \
- F(void, ClearNamedBufferSubData, (GLuint buffer, GLenum internalformat, GLintptr offset, GLsizei size, GLenum format, GLenum type, const void *data)) \
- F(void, ClearNamedBufferData, (GLuint buffer, GLenum internalformat, GLenum format, GLenum type, const void *data)) \
- F(void, CopyNamedBufferSubData, (GLuint readBuffer, GLuint writeBuffer, GLintptr readOffset, GLintptr writeOffset, GLsizei size)) \
- F(void, NamedBufferSubData, (GLuint buffer, GLintptr offset, GLsizei size, const void *data)) \
- F(void, NamedBufferData, (GLuint buffer, GLsizei size, const void *data, GLenum usage)) \
- F(void, NamedBufferStorage, (GLuint buffer, GLsizei size, const void *data, GLbitfield flags)) \
- F(void, CreateBuffers, (GLsizei n, GLuint *buffers)) \
- F(void, GetTransformFeedbacki64_v,(GLuint xfb, GLenum pname, GLuint index, GLint64 *param)) \
- F(void, GetTransformFeedbacki_v,(GLuint xfb, GLenum pname, GLuint index, GLint *param)) \
- F(void, GetTransformFeedbackiv, (GLuint xfb, GLenum pname, GLint *param)) \
- F(void, TransformFeedbackBufferRange, (GLuint xfb, GLuint index, GLuint buffer, GLintptr offset, GLsizei size)) \
- F(void, TransformFeedbackBufferBase, (GLuint xfb, GLuint index, GLuint buffer)) \
- F(void, CreateTransformFeedbacks, (GLsizei n, GLuint *ids)) \
- F(void, ClipControl, (GLenum origin, GLenum depth)) \
-
- QT_OPENGL_DECLARE(QT_OPENGL_4_5_FUNCTIONS);
-};
-
-class QOpenGLFunctions_1_0_DeprecatedBackend : public QOpenGLVersionFunctionsBackend
-{
-public:
- QOpenGLFunctions_1_0_DeprecatedBackend(QOpenGLContext *c)
- : QOpenGLVersionFunctionsBackend(c)
- {
- init();
- }
-
- Q_DECL_CONSTEXPR static Version versionStatus()
- { return OpenGL_1_0_Deprecated; }
-
- // OpenGL 1.0 deprecated functions
-#define QT_OPENGL_1_0_DEPRECATED_FUNCTIONS(F) \
- F(void, Translatef, (GLfloat x, GLfloat y, GLfloat z)) \
- F(void, Translated, (GLdouble x, GLdouble y, GLdouble z)) \
- F(void, Scalef, (GLfloat x, GLfloat y, GLfloat z)) \
- F(void, Scaled, (GLdouble x, GLdouble y, GLdouble z)) \
- F(void, Rotatef, (GLfloat angle, GLfloat x, GLfloat y, GLfloat z)) \
- F(void, Rotated, (GLdouble angle, GLdouble x, GLdouble y, GLdouble z)) \
- F(void, PushMatrix, ()) \
- F(void, PopMatrix, ()) \
- F(void, Ortho, (GLdouble left, GLdouble right, GLdouble bottom, GLdouble top, GLdouble zNear, GLdouble zFar)) \
- F(void, MultMatrixd, (const GLdouble *m)) \
- F(void, MultMatrixf, (const GLfloat *m)) \
- F(void, MatrixMode, (GLenum mode)) \
- F(void, LoadMatrixd, (const GLdouble *m)) \
- F(void, LoadMatrixf, (const GLfloat *m)) \
- F(void, LoadIdentity, ()) \
- F(void, Frustum, (GLdouble left, GLdouble right, GLdouble bottom, GLdouble top, GLdouble zNear, GLdouble zFar)) \
- F(GLboolean, IsList, (GLuint list)) \
- F(void, GetTexGeniv, (GLenum coord, GLenum pname, GLint *params)) \
- F(void, GetTexGenfv, (GLenum coord, GLenum pname, GLfloat *params)) \
- F(void, GetTexGendv, (GLenum coord, GLenum pname, GLdouble *params)) \
- F(void, GetTexEnviv, (GLenum target, GLenum pname, GLint *params)) \
- F(void, GetTexEnvfv, (GLenum target, GLenum pname, GLfloat *params)) \
- F(void, GetPolygonStipple, (GLubyte *mask)) \
- F(void, GetPixelMapusv, (GLenum map, GLushort *values)) \
- F(void, GetPixelMapuiv, (GLenum map, GLuint *values)) \
- F(void, GetPixelMapfv, (GLenum map, GLfloat *values)) \
- F(void, GetMaterialiv, (GLenum face, GLenum pname, GLint *params)) \
- F(void, GetMaterialfv, (GLenum face, GLenum pname, GLfloat *params)) \
- F(void, GetMapiv, (GLenum target, GLenum query, GLint *v)) \
- F(void, GetMapfv, (GLenum target, GLenum query, GLfloat *v)) \
- F(void, GetMapdv, (GLenum target, GLenum query, GLdouble *v)) \
- F(void, GetLightiv, (GLenum light, GLenum pname, GLint *params)) \
- F(void, GetLightfv, (GLenum light, GLenum pname, GLfloat *params)) \
- F(void, GetClipPlane, (GLenum plane, GLdouble *equation)) \
- F(void, DrawPixels, (GLsizei width, GLsizei height, GLenum format, GLenum type, const GLvoid *pixels)) \
- F(void, CopyPixels, (GLint x, GLint y, GLsizei width, GLsizei height, GLenum type)) \
- F(void, PixelMapusv, (GLenum map, GLsizei mapsize, const GLushort *values)) \
- F(void, PixelMapuiv, (GLenum map, GLsizei mapsize, const GLuint *values)) \
- F(void, PixelMapfv, (GLenum map, GLsizei mapsize, const GLfloat *values)) \
- F(void, PixelTransferi, (GLenum pname, GLint param)) \
- F(void, PixelTransferf, (GLenum pname, GLfloat param)) \
- F(void, PixelZoom, (GLfloat xfactor, GLfloat yfactor)) \
- F(void, AlphaFunc, (GLenum func, GLfloat ref)) \
- F(void, EvalPoint2, (GLint i, GLint j)) \
- F(void, EvalMesh2, (GLenum mode, GLint i1, GLint i2, GLint j1, GLint j2)) \
- F(void, EvalPoint1, (GLint i)) \
- F(void, EvalMesh1, (GLenum mode, GLint i1, GLint i2)) \
- F(void, EvalCoord2fv, (const GLfloat *u)) \
- F(void, EvalCoord2f, (GLfloat u, GLfloat v)) \
- F(void, EvalCoord2dv, (const GLdouble *u)) \
- F(void, EvalCoord2d, (GLdouble u, GLdouble v)) \
- F(void, EvalCoord1fv, (const GLfloat *u)) \
- F(void, EvalCoord1f, (GLfloat u)) \
- F(void, EvalCoord1dv, (const GLdouble *u)) \
- F(void, EvalCoord1d, (GLdouble u)) \
- F(void, MapGrid2f, (GLint un, GLfloat u1, GLfloat u2, GLint vn, GLfloat v1, GLfloat v2)) \
- F(void, MapGrid2d, (GLint un, GLdouble u1, GLdouble u2, GLint vn, GLdouble v1, GLdouble v2)) \
- F(void, MapGrid1f, (GLint un, GLfloat u1, GLfloat u2)) \
- F(void, MapGrid1d, (GLint un, GLdouble u1, GLdouble u2)) \
- F(void, Map2f, (GLenum target, GLfloat u1, GLfloat u2, GLint ustride, GLint uorder, GLfloat v1, GLfloat v2, GLint vstride, GLint vorder, const GLfloat *points)) \
- F(void, Map2d, (GLenum target, GLdouble u1, GLdouble u2, GLint ustride, GLint uorder, GLdouble v1, GLdouble v2, GLint vstride, GLint vorder, const GLdouble *points)) \
- F(void, Map1f, (GLenum target, GLfloat u1, GLfloat u2, GLint stride, GLint order, const GLfloat *points)) \
- F(void, Map1d, (GLenum target, GLdouble u1, GLdouble u2, GLint stride, GLint order, const GLdouble *points)) \
- F(void, PushAttrib, (GLbitfield mask)) \
- F(void, PopAttrib, ()) \
- F(void, Accum, (GLenum op, GLfloat value)) \
- F(void, IndexMask, (GLuint mask)) \
- F(void, ClearIndex, (GLfloat c)) \
- F(void, ClearAccum, (GLfloat red, GLfloat green, GLfloat blue, GLfloat alpha)) \
- F(void, PushName, (GLuint name)) \
- F(void, PopName, ()) \
- F(void, PassThrough, (GLfloat token)) \
- F(void, LoadName, (GLuint name)) \
- F(void, InitNames, ()) \
- F(GLint, RenderMode, (GLenum mode)) \
- F(void, SelectBuffer, (GLsizei size, GLuint *buffer)) \
- F(void, FeedbackBuffer, (GLsizei size, GLenum type, GLfloat *buffer)) \
- F(void, TexGeniv, (GLenum coord, GLenum pname, const GLint *params)) \
- F(void, TexGeni, (GLenum coord, GLenum pname, GLint param)) \
- F(void, TexGenfv, (GLenum coord, GLenum pname, const GLfloat *params)) \
- F(void, TexGenf, (GLenum coord, GLenum pname, GLfloat param)) \
- F(void, TexGendv, (GLenum coord, GLenum pname, const GLdouble *params)) \
- F(void, TexGend, (GLenum coord, GLenum pname, GLdouble param)) \
- F(void, TexEnviv, (GLenum target, GLenum pname, const GLint *params)) \
- F(void, TexEnvi, (GLenum target, GLenum pname, GLint param)) \
- F(void, TexEnvfv, (GLenum target, GLenum pname, const GLfloat *params)) \
- F(void, TexEnvf, (GLenum target, GLenum pname, GLfloat param)) \
- F(void, ShadeModel, (GLenum mode)) \
- F(void, PolygonStipple, (const GLubyte *mask)) \
- F(void, Materialiv, (GLenum face, GLenum pname, const GLint *params)) \
- F(void, Materiali, (GLenum face, GLenum pname, GLint param)) \
- F(void, Materialfv, (GLenum face, GLenum pname, const GLfloat *params)) \
- F(void, Materialf, (GLenum face, GLenum pname, GLfloat param)) \
- F(void, LineStipple, (GLint factor, GLushort pattern)) \
- F(void, LightModeliv, (GLenum pname, const GLint *params)) \
- F(void, LightModeli, (GLenum pname, GLint param)) \
- F(void, LightModelfv, (GLenum pname, const GLfloat *params)) \
- F(void, LightModelf, (GLenum pname, GLfloat param)) \
- F(void, Lightiv, (GLenum light, GLenum pname, const GLint *params)) \
- F(void, Lighti, (GLenum light, GLenum pname, GLint param)) \
- F(void, Lightfv, (GLenum light, GLenum pname, const GLfloat *params)) \
- F(void, Lightf, (GLenum light, GLenum pname, GLfloat param)) \
- F(void, Fogiv, (GLenum pname, const GLint *params)) \
- F(void, Fogi, (GLenum pname, GLint param)) \
- F(void, Fogfv, (GLenum pname, const GLfloat *params)) \
- F(void, Fogf, (GLenum pname, GLfloat param)) \
- F(void, ColorMaterial, (GLenum face, GLenum mode)) \
- F(void, ClipPlane, (GLenum plane, const GLdouble *equation)) \
- F(void, Vertex4sv, (const GLshort *v)) \
- F(void, Vertex4s, (GLshort x, GLshort y, GLshort z, GLshort w)) \
- F(void, Vertex4iv, (const GLint *v)) \
- F(void, Vertex4i, (GLint x, GLint y, GLint z, GLint w)) \
- F(void, Vertex4fv, (const GLfloat *v)) \
- F(void, Vertex4f, (GLfloat x, GLfloat y, GLfloat z, GLfloat w)) \
- F(void, Vertex4dv, (const GLdouble *v)) \
- F(void, Vertex4d, (GLdouble x, GLdouble y, GLdouble z, GLdouble w)) \
- F(void, Vertex3sv, (const GLshort *v)) \
- F(void, Vertex3s, (GLshort x, GLshort y, GLshort z)) \
- F(void, Vertex3iv, (const GLint *v)) \
- F(void, Vertex3i, (GLint x, GLint y, GLint z)) \
- F(void, Vertex3fv, (const GLfloat *v)) \
- F(void, Vertex3f, (GLfloat x, GLfloat y, GLfloat z)) \
- F(void, Vertex3dv, (const GLdouble *v)) \
- F(void, Vertex3d, (GLdouble x, GLdouble y, GLdouble z)) \
- F(void, Vertex2sv, (const GLshort *v)) \
- F(void, Vertex2s, (GLshort x, GLshort y)) \
- F(void, Vertex2iv, (const GLint *v)) \
- F(void, Vertex2i, (GLint x, GLint y)) \
- F(void, Vertex2fv, (const GLfloat *v)) \
- F(void, Vertex2f, (GLfloat x, GLfloat y)) \
- F(void, Vertex2dv, (const GLdouble *v)) \
- F(void, Vertex2d, (GLdouble x, GLdouble y)) \
- F(void, TexCoord4sv, (const GLshort *v)) \
- F(void, TexCoord4s, (GLshort s, GLshort t, GLshort r, GLshort q)) \
- F(void, TexCoord4iv, (const GLint *v)) \
- F(void, TexCoord4i, (GLint s, GLint t, GLint r, GLint q)) \
- F(void, TexCoord4fv, (const GLfloat *v)) \
- F(void, TexCoord4f, (GLfloat s, GLfloat t, GLfloat r, GLfloat q)) \
- F(void, TexCoord4dv, (const GLdouble *v)) \
- F(void, TexCoord4d, (GLdouble s, GLdouble t, GLdouble r, GLdouble q)) \
- F(void, TexCoord3sv, (const GLshort *v)) \
- F(void, TexCoord3s, (GLshort s, GLshort t, GLshort r)) \
- F(void, TexCoord3iv, (const GLint *v)) \
- F(void, TexCoord3i, (GLint s, GLint t, GLint r)) \
- F(void, TexCoord3fv, (const GLfloat *v)) \
- F(void, TexCoord3f, (GLfloat s, GLfloat t, GLfloat r)) \
- F(void, TexCoord3dv, (const GLdouble *v)) \
- F(void, TexCoord3d, (GLdouble s, GLdouble t, GLdouble r)) \
- F(void, TexCoord2sv, (const GLshort *v)) \
- F(void, TexCoord2s, (GLshort s, GLshort t)) \
- F(void, TexCoord2iv, (const GLint *v)) \
- F(void, TexCoord2i, (GLint s, GLint t)) \
- F(void, TexCoord2fv, (const GLfloat *v)) \
- F(void, TexCoord2f, (GLfloat s, GLfloat t)) \
- F(void, TexCoord2dv, (const GLdouble *v)) \
- F(void, TexCoord2d, (GLdouble s, GLdouble t)) \
- F(void, TexCoord1sv, (const GLshort *v)) \
- F(void, TexCoord1s, (GLshort s)) \
- F(void, TexCoord1iv, (const GLint *v)) \
- F(void, TexCoord1i, (GLint s)) \
- F(void, TexCoord1fv, (const GLfloat *v)) \
- F(void, TexCoord1f, (GLfloat s)) \
- F(void, TexCoord1dv, (const GLdouble *v)) \
- F(void, TexCoord1d, (GLdouble s)) \
- F(void, Rectsv, (const GLshort *v1, const GLshort *v2)) \
- F(void, Rects, (GLshort x1, GLshort y1, GLshort x2, GLshort y2)) \
- F(void, Rectiv, (const GLint *v1, const GLint *v2)) \
- F(void, Recti, (GLint x1, GLint y1, GLint x2, GLint y2)) \
- F(void, Rectfv, (const GLfloat *v1, const GLfloat *v2)) \
- F(void, Rectf, (GLfloat x1, GLfloat y1, GLfloat x2, GLfloat y2)) \
- F(void, Rectdv, (const GLdouble *v1, const GLdouble *v2)) \
- F(void, Rectd, (GLdouble x1, GLdouble y1, GLdouble x2, GLdouble y2)) \
- F(void, RasterPos4sv, (const GLshort *v)) \
- F(void, RasterPos4s, (GLshort x, GLshort y, GLshort z, GLshort w)) \
- F(void, RasterPos4iv, (const GLint *v)) \
- F(void, RasterPos4i, (GLint x, GLint y, GLint z, GLint w)) \
- F(void, RasterPos4fv, (const GLfloat *v)) \
- F(void, RasterPos4f, (GLfloat x, GLfloat y, GLfloat z, GLfloat w)) \
- F(void, RasterPos4dv, (const GLdouble *v)) \
- F(void, RasterPos4d, (GLdouble x, GLdouble y, GLdouble z, GLdouble w)) \
- F(void, RasterPos3sv, (const GLshort *v)) \
- F(void, RasterPos3s, (GLshort x, GLshort y, GLshort z)) \
- F(void, RasterPos3iv, (const GLint *v)) \
- F(void, RasterPos3i, (GLint x, GLint y, GLint z)) \
- F(void, RasterPos3fv, (const GLfloat *v)) \
- F(void, RasterPos3f, (GLfloat x, GLfloat y, GLfloat z)) \
- F(void, RasterPos3dv, (const GLdouble *v)) \
- F(void, RasterPos3d, (GLdouble x, GLdouble y, GLdouble z)) \
- F(void, RasterPos2sv, (const GLshort *v)) \
- F(void, RasterPos2s, (GLshort x, GLshort y)) \
- F(void, RasterPos2iv, (const GLint *v)) \
- F(void, RasterPos2i, (GLint x, GLint y)) \
- F(void, RasterPos2fv, (const GLfloat *v)) \
- F(void, RasterPos2f, (GLfloat x, GLfloat y)) \
- F(void, RasterPos2dv, (const GLdouble *v)) \
- F(void, RasterPos2d, (GLdouble x, GLdouble y)) \
- F(void, Normal3sv, (const GLshort *v)) \
- F(void, Normal3s, (GLshort nx, GLshort ny, GLshort nz)) \
- F(void, Normal3iv, (const GLint *v)) \
- F(void, Normal3i, (GLint nx, GLint ny, GLint nz)) \
- F(void, Normal3fv, (const GLfloat *v)) \
- F(void, Normal3f, (GLfloat nx, GLfloat ny, GLfloat nz)) \
- F(void, Normal3dv, (const GLdouble *v)) \
- F(void, Normal3d, (GLdouble nx, GLdouble ny, GLdouble nz)) \
- F(void, Normal3bv, (const GLbyte *v)) \
- F(void, Normal3b, (GLbyte nx, GLbyte ny, GLbyte nz)) \
- F(void, Indexsv, (const GLshort *c)) \
- F(void, Indexs, (GLshort c)) \
- F(void, Indexiv, (const GLint *c)) \
- F(void, Indexi, (GLint c)) \
- F(void, Indexfv, (const GLfloat *c)) \
- F(void, Indexf, (GLfloat c)) \
- F(void, Indexdv, (const GLdouble *c)) \
- F(void, Indexd, (GLdouble c)) \
- F(void, End, ()) \
- F(void, EdgeFlagv, (const GLboolean *flag)) \
- F(void, EdgeFlag, (GLboolean flag)) \
- F(void, Color4usv, (const GLushort *v)) \
- F(void, Color4us, (GLushort red, GLushort green, GLushort blue, GLushort alpha)) \
- F(void, Color4uiv, (const GLuint *v)) \
- F(void, Color4ui, (GLuint red, GLuint green, GLuint blue, GLuint alpha)) \
- F(void, Color4ubv, (const GLubyte *v)) \
- F(void, Color4ub, (GLubyte red, GLubyte green, GLubyte blue, GLubyte alpha)) \
- F(void, Color4sv, (const GLshort *v)) \
- F(void, Color4s, (GLshort red, GLshort green, GLshort blue, GLshort alpha)) \
- F(void, Color4iv, (const GLint *v)) \
- F(void, Color4i, (GLint red, GLint green, GLint blue, GLint alpha)) \
- F(void, Color4fv, (const GLfloat *v)) \
- F(void, Color4f, (GLfloat red, GLfloat green, GLfloat blue, GLfloat alpha)) \
- F(void, Color4dv, (const GLdouble *v)) \
- F(void, Color4d, (GLdouble red, GLdouble green, GLdouble blue, GLdouble alpha)) \
- F(void, Color4bv, (const GLbyte *v)) \
- F(void, Color4b, (GLbyte red, GLbyte green, GLbyte blue, GLbyte alpha)) \
- F(void, Color3usv, (const GLushort *v)) \
- F(void, Color3us, (GLushort red, GLushort green, GLushort blue)) \
- F(void, Color3uiv, (const GLuint *v)) \
- F(void, Color3ui, (GLuint red, GLuint green, GLuint blue)) \
- F(void, Color3ubv, (const GLubyte *v)) \
- F(void, Color3ub, (GLubyte red, GLubyte green, GLubyte blue)) \
- F(void, Color3sv, (const GLshort *v)) \
- F(void, Color3s, (GLshort red, GLshort green, GLshort blue)) \
- F(void, Color3iv, (const GLint *v)) \
- F(void, Color3i, (GLint red, GLint green, GLint blue)) \
- F(void, Color3fv, (const GLfloat *v)) \
- F(void, Color3f, (GLfloat red, GLfloat green, GLfloat blue)) \
- F(void, Color3dv, (const GLdouble *v)) \
- F(void, Color3d, (GLdouble red, GLdouble green, GLdouble blue)) \
- F(void, Color3bv, (const GLbyte *v)) \
- F(void, Color3b, (GLbyte red, GLbyte green, GLbyte blue)) \
- F(void, Bitmap, (GLsizei width, GLsizei height, GLfloat xorig, GLfloat yorig, GLfloat xmove, GLfloat ymove, const GLubyte *bitmap)) \
- F(void, Begin, (GLenum mode)) \
- F(void, ListBase, (GLuint base)) \
- F(GLuint, GenLists, (GLsizei range)) \
- F(void, DeleteLists, (GLuint list, GLsizei range)) \
- F(void, CallLists, (GLsizei n, GLenum type, const GLvoid *lists)) \
- F(void, CallList, (GLuint list)) \
- F(void, EndList, ()) \
- F(void, NewList, (GLuint list, GLenum mode)) \
-
- QT_OPENGL_DECLARE(QT_OPENGL_1_0_DEPRECATED_FUNCTIONS);
-};
-
-class QOpenGLFunctions_1_1_DeprecatedBackend : public QOpenGLVersionFunctionsBackend
-{
-public:
- QOpenGLFunctions_1_1_DeprecatedBackend(QOpenGLContext *c)
- : QOpenGLVersionFunctionsBackend(c)
- {
- init();
- }
-
- Q_DECL_CONSTEXPR static Version versionStatus()
- { return OpenGL_1_1_Deprecated; }
-
- // OpenGL 1.1 deprecated functions
-#define QT_OPENGL_1_1_DEPRECATED_FUNCTIONS(F) \
- F(void, PushClientAttrib, (GLbitfield mask)) \
- F(void, PopClientAttrib, ()) \
- F(void, PrioritizeTextures, (GLsizei n, const GLuint *textures, const GLfloat *priorities)) \
- F(GLboolean, AreTexturesResident, (GLsizei n, const GLuint *textures, GLboolean *residences)) \
- F(void, VertexPointer, (GLint size, GLenum type, GLsizei stride, const GLvoid *pointer)) \
- F(void, TexCoordPointer, (GLint size, GLenum type, GLsizei stride, const GLvoid *pointer)) \
- F(void, NormalPointer, (GLenum type, GLsizei stride, const GLvoid *pointer)) \
- F(void, InterleavedArrays, (GLenum format, GLsizei stride, const GLvoid *pointer)) \
- F(void, IndexPointer, (GLenum type, GLsizei stride, const GLvoid *pointer)) \
- F(void, EnableClientState, (GLenum array)) \
- F(void, EdgeFlagPointer, (GLsizei stride, const GLvoid *pointer)) \
- F(void, DisableClientState, (GLenum array)) \
- F(void, ColorPointer, (GLint size, GLenum type, GLsizei stride, const GLvoid *pointer)) \
- F(void, ArrayElement, (GLint i)) \
- F(void, Indexubv, (const GLubyte *c)) \
- F(void, Indexub, (GLubyte c)) \
- F(void, GetPointerv, (GLenum pname, GLvoid* *params)) \
-
- QT_OPENGL_DECLARE(QT_OPENGL_1_1_DEPRECATED_FUNCTIONS);
-};
-
-class QOpenGLFunctions_1_2_DeprecatedBackend : public QOpenGLVersionFunctionsBackend
-{
-public:
- QOpenGLFunctions_1_2_DeprecatedBackend(QOpenGLContext *c)
- : QOpenGLVersionFunctionsBackend(c)
- {
- init();
- }
-
- Q_DECL_CONSTEXPR static Version versionStatus()
- { return OpenGL_1_2_Deprecated; }
-
- // OpenGL 1.2 deprecated functions
-#define QT_OPENGL_1_2_DEPRECATED_FUNCTIONS(F) \
- F(void, ColorTableParameterfv, (GLenum target, GLenum pname, const GLfloat *params)) \
- F(void, ColorTableParameteriv, (GLenum target, GLenum pname, const GLint *params)) \
- F(void, CopyColorTable, (GLenum target, GLenum internalformat, GLint x, GLint y, GLsizei width)) \
- F(void, GetColorTable, (GLenum target, GLenum format, GLenum type, GLvoid *table)) \
- F(void, GetColorTableParameterfv, (GLenum target, GLenum pname, GLfloat *params)) \
- F(void, GetColorTableParameteriv, (GLenum target, GLenum pname, GLint *params)) \
- F(void, ColorSubTable, (GLenum target, GLsizei start, GLsizei count, GLenum format, GLenum type, const GLvoid *data)) \
- F(void, CopyColorSubTable, (GLenum target, GLsizei start, GLint x, GLint y, GLsizei width)) \
- F(void, ConvolutionFilter1D, (GLenum target, GLenum internalformat, GLsizei width, GLenum format, GLenum type, const GLvoid *image)) \
- F(void, ConvolutionFilter2D, (GLenum target, GLenum internalformat, GLsizei width, GLsizei height, GLenum format, GLenum type, const GLvoid *image)) \
- F(void, ConvolutionParameterf, (GLenum target, GLenum pname, GLfloat params)) \
- F(void, ConvolutionParameterfv, (GLenum target, GLenum pname, const GLfloat *params)) \
- F(void, ConvolutionParameteri, (GLenum target, GLenum pname, GLint params)) \
- F(void, ConvolutionParameteriv, (GLenum target, GLenum pname, const GLint *params)) \
- F(void, CopyConvolutionFilter1D, (GLenum target, GLenum internalformat, GLint x, GLint y, GLsizei width)) \
- F(void, CopyConvolutionFilter2D, (GLenum target, GLenum internalformat, GLint x, GLint y, GLsizei width, GLsizei height)) \
- F(void, GetConvolutionFilter, (GLenum target, GLenum format, GLenum type, GLvoid *image)) \
- F(void, GetConvolutionParameterfv, (GLenum target, GLenum pname, GLfloat *params)) \
- F(void, GetConvolutionParameteriv, (GLenum target, GLenum pname, GLint *params)) \
- F(void, GetSeparableFilter, (GLenum target, GLenum format, GLenum type, GLvoid *row, GLvoid *column, GLvoid *span)) \
- F(void, SeparableFilter2D, (GLenum target, GLenum internalformat, GLsizei width, GLsizei height, GLenum format, GLenum type, const GLvoid *row, const GLvoid *column)) \
- F(void, GetHistogram, (GLenum target, GLboolean reset, GLenum format, GLenum type, GLvoid *values)) \
- F(void, GetHistogramParameterfv, (GLenum target, GLenum pname, GLfloat *params)) \
- F(void, GetHistogramParameteriv, (GLenum target, GLenum pname, GLint *params)) \
- F(void, GetMinmax, (GLenum target, GLboolean reset, GLenum format, GLenum type, GLvoid *values)) \
- F(void, GetMinmaxParameterfv, (GLenum target, GLenum pname, GLfloat *params)) \
- F(void, GetMinmaxParameteriv, (GLenum target, GLenum pname, GLint *params)) \
- F(void, Histogram, (GLenum target, GLsizei width, GLenum internalformat, GLboolean sink)) \
- F(void, Minmax, (GLenum target, GLenum internalformat, GLboolean sink)) \
- F(void, ResetHistogram, (GLenum target)) \
- F(void, ResetMinmax, (GLenum target)) \
- F(void, ColorTable, (GLenum target, GLenum internalformat, GLsizei width, GLenum format, GLenum type, const GLvoid *table)) \
-
- QT_OPENGL_DECLARE(QT_OPENGL_1_2_DEPRECATED_FUNCTIONS);
-};
-
-class QOpenGLFunctions_1_3_DeprecatedBackend : public QOpenGLVersionFunctionsBackend
-{
-public:
- QOpenGLFunctions_1_3_DeprecatedBackend(QOpenGLContext *c)
- : QOpenGLVersionFunctionsBackend(c)
- {
- init();
- }
-
- Q_DECL_CONSTEXPR static Version versionStatus()
- { return OpenGL_1_3_Deprecated; }
-
- // OpenGL 1.3 deprecated functions
-#define QT_OPENGL_1_3_DEPRECATED_FUNCTIONS(F) \
- F(void, MultTransposeMatrixd, (const GLdouble *m)) \
- F(void, MultTransposeMatrixf, (const GLfloat *m)) \
- F(void, LoadTransposeMatrixd, (const GLdouble *m)) \
- F(void, LoadTransposeMatrixf, (const GLfloat *m)) \
- F(void, MultiTexCoord4sv, (GLenum target, const GLshort *v)) \
- F(void, MultiTexCoord4s, (GLenum target, GLshort s, GLshort t, GLshort r, GLshort q)) \
- F(void, MultiTexCoord4iv, (GLenum target, const GLint *v)) \
- F(void, MultiTexCoord4i, (GLenum target, GLint s, GLint t, GLint r, GLint q)) \
- F(void, MultiTexCoord4fv, (GLenum target, const GLfloat *v)) \
- F(void, MultiTexCoord4f, (GLenum target, GLfloat s, GLfloat t, GLfloat r, GLfloat q)) \
- F(void, MultiTexCoord4dv, (GLenum target, const GLdouble *v)) \
- F(void, MultiTexCoord4d, (GLenum target, GLdouble s, GLdouble t, GLdouble r, GLdouble q)) \
- F(void, MultiTexCoord3sv, (GLenum target, const GLshort *v)) \
- F(void, MultiTexCoord3s, (GLenum target, GLshort s, GLshort t, GLshort r)) \
- F(void, MultiTexCoord3iv, (GLenum target, const GLint *v)) \
- F(void, MultiTexCoord3i, (GLenum target, GLint s, GLint t, GLint r)) \
- F(void, MultiTexCoord3fv, (GLenum target, const GLfloat *v)) \
- F(void, MultiTexCoord3f, (GLenum target, GLfloat s, GLfloat t, GLfloat r)) \
- F(void, MultiTexCoord3dv, (GLenum target, const GLdouble *v)) \
- F(void, MultiTexCoord3d, (GLenum target, GLdouble s, GLdouble t, GLdouble r)) \
- F(void, MultiTexCoord2sv, (GLenum target, const GLshort *v)) \
- F(void, MultiTexCoord2s, (GLenum target, GLshort s, GLshort t)) \
- F(void, MultiTexCoord2iv, (GLenum target, const GLint *v)) \
- F(void, MultiTexCoord2i, (GLenum target, GLint s, GLint t)) \
- F(void, MultiTexCoord2fv, (GLenum target, const GLfloat *v)) \
- F(void, MultiTexCoord2f, (GLenum target, GLfloat s, GLfloat t)) \
- F(void, MultiTexCoord2dv, (GLenum target, const GLdouble *v)) \
- F(void, MultiTexCoord2d, (GLenum target, GLdouble s, GLdouble t)) \
- F(void, MultiTexCoord1sv, (GLenum target, const GLshort *v)) \
- F(void, MultiTexCoord1s, (GLenum target, GLshort s)) \
- F(void, MultiTexCoord1iv, (GLenum target, const GLint *v)) \
- F(void, MultiTexCoord1i, (GLenum target, GLint s)) \
- F(void, MultiTexCoord1fv, (GLenum target, const GLfloat *v)) \
- F(void, MultiTexCoord1f, (GLenum target, GLfloat s)) \
- F(void, MultiTexCoord1dv, (GLenum target, const GLdouble *v)) \
- F(void, MultiTexCoord1d, (GLenum target, GLdouble s)) \
- F(void, ClientActiveTexture, (GLenum texture)) \
-
- QT_OPENGL_DECLARE(QT_OPENGL_1_3_DEPRECATED_FUNCTIONS);
-};
-
-class QOpenGLFunctions_1_4_DeprecatedBackend : public QOpenGLVersionFunctionsBackend
-{
-public:
- QOpenGLFunctions_1_4_DeprecatedBackend(QOpenGLContext *c)
- : QOpenGLVersionFunctionsBackend(c)
- {
- init();
- }
-
- Q_DECL_CONSTEXPR static Version versionStatus()
- { return OpenGL_1_4_Deprecated; }
-
- // OpenGL 1.4 deprecated functions
-#define QT_OPENGL_1_4_DEPRECATED_FUNCTIONS(F) \
- F(void, WindowPos3sv, (const GLshort *v)) \
- F(void, WindowPos3s, (GLshort x, GLshort y, GLshort z)) \
- F(void, WindowPos3iv, (const GLint *v)) \
- F(void, WindowPos3i, (GLint x, GLint y, GLint z)) \
- F(void, WindowPos3fv, (const GLfloat *v)) \
- F(void, WindowPos3f, (GLfloat x, GLfloat y, GLfloat z)) \
- F(void, WindowPos3dv, (const GLdouble *v)) \
- F(void, WindowPos3d, (GLdouble x, GLdouble y, GLdouble z)) \
- F(void, WindowPos2sv, (const GLshort *v)) \
- F(void, WindowPos2s, (GLshort x, GLshort y)) \
- F(void, WindowPos2iv, (const GLint *v)) \
- F(void, WindowPos2i, (GLint x, GLint y)) \
- F(void, WindowPos2fv, (const GLfloat *v)) \
- F(void, WindowPos2f, (GLfloat x, GLfloat y)) \
- F(void, WindowPos2dv, (const GLdouble *v)) \
- F(void, WindowPos2d, (GLdouble x, GLdouble y)) \
- F(void, SecondaryColorPointer, (GLint size, GLenum type, GLsizei stride, const GLvoid *pointer)) \
- F(void, SecondaryColor3usv, (const GLushort *v)) \
- F(void, SecondaryColor3us, (GLushort red, GLushort green, GLushort blue)) \
- F(void, SecondaryColor3uiv, (const GLuint *v)) \
- F(void, SecondaryColor3ui, (GLuint red, GLuint green, GLuint blue)) \
- F(void, SecondaryColor3ubv, (const GLubyte *v)) \
- F(void, SecondaryColor3ub, (GLubyte red, GLubyte green, GLubyte blue)) \
- F(void, SecondaryColor3sv, (const GLshort *v)) \
- F(void, SecondaryColor3s, (GLshort red, GLshort green, GLshort blue)) \
- F(void, SecondaryColor3iv, (const GLint *v)) \
- F(void, SecondaryColor3i, (GLint red, GLint green, GLint blue)) \
- F(void, SecondaryColor3fv, (const GLfloat *v)) \
- F(void, SecondaryColor3f, (GLfloat red, GLfloat green, GLfloat blue)) \
- F(void, SecondaryColor3dv, (const GLdouble *v)) \
- F(void, SecondaryColor3d, (GLdouble red, GLdouble green, GLdouble blue)) \
- F(void, SecondaryColor3bv, (const GLbyte *v)) \
- F(void, SecondaryColor3b, (GLbyte red, GLbyte green, GLbyte blue)) \
- F(void, FogCoordPointer, (GLenum type, GLsizei stride, const GLvoid *pointer)) \
- F(void, FogCoorddv, (const GLdouble *coord)) \
- F(void, FogCoordd, (GLdouble coord)) \
- F(void, FogCoordfv, (const GLfloat *coord)) \
- F(void, FogCoordf, (GLfloat coord)) \
-
- QT_OPENGL_DECLARE(QT_OPENGL_1_4_DEPRECATED_FUNCTIONS);
-};
-
-class QOpenGLFunctions_2_0_DeprecatedBackend : public QOpenGLVersionFunctionsBackend
-{
-public:
- QOpenGLFunctions_2_0_DeprecatedBackend(QOpenGLContext *c)
- : QOpenGLVersionFunctionsBackend(c)
- {
- init();
- }
-
- Q_DECL_CONSTEXPR static Version versionStatus()
- { return OpenGL_2_0_Deprecated; }
-
- // OpenGL 2.0 deprecated functions
-#define QT_OPENGL_2_0_DEPRECATED_FUNCTIONS(F) \
- F(void, VertexAttrib4usv, (GLuint index, const GLushort *v)) \
- F(void, VertexAttrib4uiv, (GLuint index, const GLuint *v)) \
- F(void, VertexAttrib4ubv, (GLuint index, const GLubyte *v)) \
- F(void, VertexAttrib4sv, (GLuint index, const GLshort *v)) \
- F(void, VertexAttrib4s, (GLuint index, GLshort x, GLshort y, GLshort z, GLshort w)) \
- F(void, VertexAttrib4iv, (GLuint index, const GLint *v)) \
- F(void, VertexAttrib4fv, (GLuint index, const GLfloat *v)) \
- F(void, VertexAttrib4f, (GLuint index, GLfloat x, GLfloat y, GLfloat z, GLfloat w)) \
- F(void, VertexAttrib4dv, (GLuint index, const GLdouble *v)) \
- F(void, VertexAttrib4d, (GLuint index, GLdouble x, GLdouble y, GLdouble z, GLdouble w)) \
- F(void, VertexAttrib4bv, (GLuint index, const GLbyte *v)) \
- F(void, VertexAttrib4Nusv, (GLuint index, const GLushort *v)) \
- F(void, VertexAttrib4Nuiv, (GLuint index, const GLuint *v)) \
- F(void, VertexAttrib4Nubv, (GLuint index, const GLubyte *v)) \
- F(void, VertexAttrib4Nub, (GLuint index, GLubyte x, GLubyte y, GLubyte z, GLubyte w)) \
- F(void, VertexAttrib4Nsv, (GLuint index, const GLshort *v)) \
- F(void, VertexAttrib4Niv, (GLuint index, const GLint *v)) \
- F(void, VertexAttrib4Nbv, (GLuint index, const GLbyte *v)) \
- F(void, VertexAttrib3sv, (GLuint index, const GLshort *v)) \
- F(void, VertexAttrib3s, (GLuint index, GLshort x, GLshort y, GLshort z)) \
- F(void, VertexAttrib3fv, (GLuint index, const GLfloat *v)) \
- F(void, VertexAttrib3f, (GLuint index, GLfloat x, GLfloat y, GLfloat z)) \
- F(void, VertexAttrib3dv, (GLuint index, const GLdouble *v)) \
- F(void, VertexAttrib3d, (GLuint index, GLdouble x, GLdouble y, GLdouble z)) \
- F(void, VertexAttrib2sv, (GLuint index, const GLshort *v)) \
- F(void, VertexAttrib2s, (GLuint index, GLshort x, GLshort y)) \
- F(void, VertexAttrib2fv, (GLuint index, const GLfloat *v)) \
- F(void, VertexAttrib2f, (GLuint index, GLfloat x, GLfloat y)) \
- F(void, VertexAttrib2dv, (GLuint index, const GLdouble *v)) \
- F(void, VertexAttrib2d, (GLuint index, GLdouble x, GLdouble y)) \
- F(void, VertexAttrib1sv, (GLuint index, const GLshort *v)) \
- F(void, VertexAttrib1s, (GLuint index, GLshort x)) \
- F(void, VertexAttrib1fv, (GLuint index, const GLfloat *v)) \
- F(void, VertexAttrib1f, (GLuint index, GLfloat x)) \
- F(void, VertexAttrib1dv, (GLuint index, const GLdouble *v)) \
- F(void, VertexAttrib1d, (GLuint index, GLdouble x)) \
-
- QT_OPENGL_DECLARE(QT_OPENGL_2_0_DEPRECATED_FUNCTIONS);
-};
-
-class QOpenGLFunctions_3_0_DeprecatedBackend : public QOpenGLVersionFunctionsBackend
-{
-public:
- QOpenGLFunctions_3_0_DeprecatedBackend(QOpenGLContext *c)
- : QOpenGLVersionFunctionsBackend(c)
- {
- init();
- }
-
- Q_DECL_CONSTEXPR static Version versionStatus()
- { return OpenGL_3_0_Deprecated; }
-
- // OpenGL 3.0 deprecated functions
-#define QT_OPENGL_3_0_DEPRECATED_FUNCTIONS(F) \
- F(void, VertexAttribI4usv, (GLuint index, const GLushort *v)) \
- F(void, VertexAttribI4ubv, (GLuint index, const GLubyte *v)) \
- F(void, VertexAttribI4sv, (GLuint index, const GLshort *v)) \
- F(void, VertexAttribI4bv, (GLuint index, const GLbyte *v)) \
- F(void, VertexAttribI4uiv, (GLuint index, const GLuint *v)) \
- F(void, VertexAttribI3uiv, (GLuint index, const GLuint *v)) \
- F(void, VertexAttribI2uiv, (GLuint index, const GLuint *v)) \
- F(void, VertexAttribI1uiv, (GLuint index, const GLuint *v)) \
- F(void, VertexAttribI4iv, (GLuint index, const GLint *v)) \
- F(void, VertexAttribI3iv, (GLuint index, const GLint *v)) \
- F(void, VertexAttribI2iv, (GLuint index, const GLint *v)) \
- F(void, VertexAttribI1iv, (GLuint index, const GLint *v)) \
- F(void, VertexAttribI4ui, (GLuint index, GLuint x, GLuint y, GLuint z, GLuint w)) \
- F(void, VertexAttribI3ui, (GLuint index, GLuint x, GLuint y, GLuint z)) \
- F(void, VertexAttribI2ui, (GLuint index, GLuint x, GLuint y)) \
- F(void, VertexAttribI1ui, (GLuint index, GLuint x)) \
- F(void, VertexAttribI4i, (GLuint index, GLint x, GLint y, GLint z, GLint w)) \
- F(void, VertexAttribI3i, (GLuint index, GLint x, GLint y, GLint z)) \
- F(void, VertexAttribI2i, (GLuint index, GLint x, GLint y)) \
- F(void, VertexAttribI1i, (GLuint index, GLint x)) \
-
- QT_OPENGL_DECLARE(QT_OPENGL_3_0_DEPRECATED_FUNCTIONS);
-};
-
-class QOpenGLFunctions_3_3_DeprecatedBackend : public QOpenGLVersionFunctionsBackend
-{
-public:
- QOpenGLFunctions_3_3_DeprecatedBackend(QOpenGLContext *c)
- : QOpenGLVersionFunctionsBackend(c)
- {
- init();
- }
-
- Q_DECL_CONSTEXPR static Version versionStatus()
- { return OpenGL_3_3_Deprecated; }
-
- // OpenGL 3.3 deprecated functions
-#define QT_OPENGL_3_3_DEPRECATED_FUNCTIONS(F) \
- F(void, SecondaryColorP3uiv, (GLenum type, const GLuint *color)) \
- F(void, SecondaryColorP3ui, (GLenum type, GLuint color)) \
- F(void, ColorP4uiv, (GLenum type, const GLuint *color)) \
- F(void, ColorP4ui, (GLenum type, GLuint color)) \
- F(void, ColorP3uiv, (GLenum type, const GLuint *color)) \
- F(void, ColorP3ui, (GLenum type, GLuint color)) \
- F(void, NormalP3uiv, (GLenum type, const GLuint *coords)) \
- F(void, NormalP3ui, (GLenum type, GLuint coords)) \
- F(void, MultiTexCoordP4uiv, (GLenum texture, GLenum type, const GLuint *coords)) \
- F(void, MultiTexCoordP4ui, (GLenum texture, GLenum type, GLuint coords)) \
- F(void, MultiTexCoordP3uiv, (GLenum texture, GLenum type, const GLuint *coords)) \
- F(void, MultiTexCoordP3ui, (GLenum texture, GLenum type, GLuint coords)) \
- F(void, MultiTexCoordP2uiv, (GLenum texture, GLenum type, const GLuint *coords)) \
- F(void, MultiTexCoordP2ui, (GLenum texture, GLenum type, GLuint coords)) \
- F(void, MultiTexCoordP1uiv, (GLenum texture, GLenum type, const GLuint *coords)) \
- F(void, MultiTexCoordP1ui, (GLenum texture, GLenum type, GLuint coords)) \
- F(void, TexCoordP4uiv, (GLenum type, const GLuint *coords)) \
- F(void, TexCoordP4ui, (GLenum type, GLuint coords)) \
- F(void, TexCoordP3uiv, (GLenum type, const GLuint *coords)) \
- F(void, TexCoordP3ui, (GLenum type, GLuint coords)) \
- F(void, TexCoordP2uiv, (GLenum type, const GLuint *coords)) \
- F(void, TexCoordP2ui, (GLenum type, GLuint coords)) \
- F(void, TexCoordP1uiv, (GLenum type, const GLuint *coords)) \
- F(void, TexCoordP1ui, (GLenum type, GLuint coords)) \
- F(void, VertexP4uiv, (GLenum type, const GLuint *value)) \
- F(void, VertexP4ui, (GLenum type, GLuint value)) \
- F(void, VertexP3uiv, (GLenum type, const GLuint *value)) \
- F(void, VertexP3ui, (GLenum type, GLuint value)) \
- F(void, VertexP2uiv, (GLenum type, const GLuint *value)) \
- F(void, VertexP2ui, (GLenum type, GLuint value)) \
-
- QT_OPENGL_DECLARE(QT_OPENGL_3_3_DEPRECATED_FUNCTIONS);
-};
-
-class QOpenGLFunctions_4_5_DeprecatedBackend : public QOpenGLVersionFunctionsBackend
-{
-public:
- QOpenGLFunctions_4_5_DeprecatedBackend(QOpenGLContext *c)
- : QOpenGLVersionFunctionsBackend(c)
- {
- init();
- }
-
- Q_DECL_CONSTEXPR static Version versionStatus()
- { return OpenGL_4_5_Deprecated; }
-
- // OpenGL 4.5 deprecated functions
-#define QT_OPENGL_4_5_DEPRECATED_FUNCTIONS(F) \
- F(void, GetnMinmax, (GLenum target, GLboolean reset, GLenum format, GLenum type, GLsizei bufSize, GLvoid *values)) \
- F(void, GetnHistogram, (GLenum target, GLboolean reset, GLenum format, GLenum type, GLsizei bufSize, GLvoid *values)) \
- F(void, GetnSeparableFilter, (GLenum target, GLenum format, GLenum type, GLsizei rowBufSize, GLvoid *row, GLsizei columnBufSize, GLvoid *column, GLvoid *span)) \
- F(void, GetnConvolutionFilter, (GLenum target, GLenum format, GLenum type, GLsizei bufSize, GLvoid *image)) \
- F(void, GetnColorTable, (GLenum target, GLenum format, GLenum type, GLsizei bufSize, GLvoid *table)) \
- F(void, GetnPolygonStipple, (GLsizei bufSize, GLubyte *pattern)) \
- F(void, GetnPixelMapusv, (GLenum map, GLsizei bufSize, GLushort *values)) \
- F(void, GetnPixelMapuiv, (GLenum map, GLsizei bufSize, GLuint *values)) \
- F(void, GetnPixelMapfv, (GLenum map, GLsizei bufSize, GLfloat *values)) \
- F(void, GetnMapiv, (GLenum target, GLenum query, GLsizei bufSize, GLint *v)) \
- F(void, GetnMapfv, (GLenum target, GLenum query, GLsizei bufSize, GLfloat *v)) \
- F(void, GetnMapdv, (GLenum target, GLenum query, GLsizei bufSize, GLdouble *v)) \
-
- QT_OPENGL_DECLARE(QT_OPENGL_4_5_DEPRECATED_FUNCTIONS);
-};
-
-#else
-
-// No need for backend classes with function pointers with ES2.
-// All function addresses are independent of context and display.
-
-#endif // !QT_OPENGL_ES_2
-
-#undef QT_OPENGL_DECLARE_FUNCTIONS
-#undef QT_OPENGL_COUNT_FUNCTIONS
-#undef QT_OPENGL_DECLARE
-
-
-QT_END_NAMESPACE
-
-#ifdef Q_OS_WIN
-#pragma pop_macro("MemoryBarrier")
-#endif
-
-#endif // QT_NO_OPENGL
-
-#endif
diff --git a/src/gui/opengl/qopenglversionfunctionsfactory.cpp b/src/gui/opengl/qopenglversionfunctionsfactory.cpp
deleted file mode 100644
index ca7daedf34..0000000000
--- a/src/gui/opengl/qopenglversionfunctionsfactory.cpp
+++ /dev/null
@@ -1,163 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2013 Klaralvdalens Datakonsult AB (KDAB)
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the QtGui module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-**
-** This file was generated by glgen version 0.1
-** Command line was: glgen
-**
-** glgen is Copyright (C) 2013 Klaralvdalens Datakonsult AB (KDAB)
-**
-** This is an auto-generated file.
-** Do not edit! All changes made to it will be lost.
-**
-****************************************************************************/
-
-#include "qopenglversionfunctionsfactory_p.h"
-
-#if !defined(QT_OPENGL_ES_2)
-#include "qopenglfunctions_4_5_core.h"
-#include "qopenglfunctions_4_5_compatibility.h"
-#include "qopenglfunctions_4_4_core.h"
-#include "qopenglfunctions_4_4_compatibility.h"
-#include "qopenglfunctions_4_3_core.h"
-#include "qopenglfunctions_4_3_compatibility.h"
-#include "qopenglfunctions_4_2_core.h"
-#include "qopenglfunctions_4_2_compatibility.h"
-#include "qopenglfunctions_4_1_core.h"
-#include "qopenglfunctions_4_1_compatibility.h"
-#include "qopenglfunctions_4_0_core.h"
-#include "qopenglfunctions_4_0_compatibility.h"
-#include "qopenglfunctions_3_3_core.h"
-#include "qopenglfunctions_3_3_compatibility.h"
-#include "qopenglfunctions_3_2_core.h"
-#include "qopenglfunctions_3_2_compatibility.h"
-#include "qopenglfunctions_3_1.h"
-#include "qopenglfunctions_3_0.h"
-#include "qopenglfunctions_2_1.h"
-#include "qopenglfunctions_2_0.h"
-#include "qopenglfunctions_1_5.h"
-#include "qopenglfunctions_1_4.h"
-#include "qopenglfunctions_1_3.h"
-#include "qopenglfunctions_1_2.h"
-#include "qopenglfunctions_1_1.h"
-#include "qopenglfunctions_1_0.h"
-#else
-#include "qopenglfunctions_es2.h"
-#endif
-
-QT_BEGIN_NAMESPACE
-
-QAbstractOpenGLFunctions *QOpenGLVersionFunctionsFactory::create(const QOpenGLVersionProfile &versionProfile)
-{
-#if !defined(QT_OPENGL_ES_2)
- const int major = versionProfile.version().first;
- const int minor = versionProfile.version().second;
-
- if (versionProfile.hasProfiles()) {
- switch (versionProfile.profile()) {
- case QSurfaceFormat::CoreProfile:
- if (major == 4 && minor == 5)
- return new QOpenGLFunctions_4_5_Core;
- else if (major == 4 && minor == 4)
- return new QOpenGLFunctions_4_4_Core;
- else if (major == 4 && minor == 3)
- return new QOpenGLFunctions_4_3_Core;
- else if (major == 4 && minor == 2)
- return new QOpenGLFunctions_4_2_Core;
- else if (major == 4 && minor == 1)
- return new QOpenGLFunctions_4_1_Core;
- else if (major == 4 && minor == 0)
- return new QOpenGLFunctions_4_0_Core;
- else if (major == 3 && minor == 3)
- return new QOpenGLFunctions_3_3_Core;
- else if (major == 3 && minor == 2)
- return new QOpenGLFunctions_3_2_Core;
- break;
-
- case QSurfaceFormat::CompatibilityProfile:
- if (major == 4 && minor == 5)
- return new QOpenGLFunctions_4_5_Compatibility;
- else if (major == 4 && minor == 4)
- return new QOpenGLFunctions_4_4_Compatibility;
- else if (major == 4 && minor == 3)
- return new QOpenGLFunctions_4_3_Compatibility;
- else if (major == 4 && minor == 2)
- return new QOpenGLFunctions_4_2_Compatibility;
- else if (major == 4 && minor == 1)
- return new QOpenGLFunctions_4_1_Compatibility;
- else if (major == 4 && minor == 0)
- return new QOpenGLFunctions_4_0_Compatibility;
- else if (major == 3 && minor == 3)
- return new QOpenGLFunctions_3_3_Compatibility;
- else if (major == 3 && minor == 2)
- return new QOpenGLFunctions_3_2_Compatibility;
- break;
-
- case QSurfaceFormat::NoProfile:
- default:
- break;
- };
- } else {
- if (major == 3 && minor == 1)
- return new QOpenGLFunctions_3_1;
- else if (major == 3 && minor == 0)
- return new QOpenGLFunctions_3_0;
- else if (major == 2 && minor == 1)
- return new QOpenGLFunctions_2_1;
- else if (major == 2 && minor == 0)
- return new QOpenGLFunctions_2_0;
- else if (major == 1 && minor == 5)
- return new QOpenGLFunctions_1_5;
- else if (major == 1 && minor == 4)
- return new QOpenGLFunctions_1_4;
- else if (major == 1 && minor == 3)
- return new QOpenGLFunctions_1_3;
- else if (major == 1 && minor == 2)
- return new QOpenGLFunctions_1_2;
- else if (major == 1 && minor == 1)
- return new QOpenGLFunctions_1_1;
- else if (major == 1 && minor == 0)
- return new QOpenGLFunctions_1_0;
- }
- return nullptr;
-#else
- Q_UNUSED(versionProfile);
- return new QOpenGLFunctions_ES2;
-#endif
-}
-
-QT_END_NAMESPACE
diff --git a/src/gui/opengl/qopenglversionfunctionsfactory_p.h b/src/gui/opengl/qopenglversionfunctionsfactory_p.h
deleted file mode 100644
index 469a9cc624..0000000000
--- a/src/gui/opengl/qopenglversionfunctionsfactory_p.h
+++ /dev/null
@@ -1,83 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2013 Klaralvdalens Datakonsult AB (KDAB)
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the QtGui module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-**
-** This file was generated by glgen version 0.1
-** Command line was: glgen
-**
-** glgen is Copyright (C) 2012 Klaralvdalens Datakonsult AB (KDAB)
-**
-** This is an auto-generated file.
-** Do not edit! All changes made to it will be lost.
-**
-****************************************************************************/
-
-#ifndef QOPENGLVERSIONFUNCTIONFACTORY_P_H
-#define QOPENGLVERSIONFUNCTIONFACTORY_P_H
-
-//
-// W A R N I N G
-// -------------
-//
-// This file is not part of the Qt API. It exists purely as an
-// implementation detail. This header file may change from version to
-// version without notice, or even be removed.
-//
-// We mean it.
-//
-
-#include <QtGui/private/qtguiglobal_p.h>
-
-#ifndef QT_NO_OPENGL
-
-#include <QtGui/qopenglcontext.h>
-
-QT_BEGIN_NAMESPACE
-
-class QAbstractOpenGLFunctions;
-
-class QOpenGLVersionFunctionsFactory
-{
-public:
- static QAbstractOpenGLFunctions *create(const QOpenGLVersionProfile &versionProfile);
-};
-
-QT_END_NAMESPACE
-
-#endif // QT_NO_OPENGL
-
-#endif
diff --git a/src/gui/opengl/qopenglvertexarrayobject.cpp b/src/gui/opengl/qopenglvertexarrayobject.cpp
deleted file mode 100644
index f15fe06ee8..0000000000
--- a/src/gui/opengl/qopenglvertexarrayobject.cpp
+++ /dev/null
@@ -1,531 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2014 Klarälvdalens Datakonsult AB, a KDAB Group company, info@kdab.com, author Sean Harmer <sean.harmer@kdab.com>
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the QtGui module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "qopenglvertexarrayobject.h"
-
-#include <QtCore/private/qobject_p.h>
-#include <QtCore/qthread.h>
-#include <QtGui/qopenglcontext.h>
-#include <QtGui/qoffscreensurface.h>
-#include <QtGui/qguiapplication.h>
-
-#include <QtGui/qopenglfunctions_3_0.h>
-#include <QtGui/qopenglfunctions_3_2_core.h>
-
-#include <private/qopenglextensions_p.h>
-#include <private/qopenglvertexarrayobject_p.h>
-
-QT_BEGIN_NAMESPACE
-
-class QOpenGLFunctions_3_0;
-class QOpenGLFunctions_3_2_Core;
-
-void qtInitializeVertexArrayObjectHelper(QOpenGLVertexArrayObjectHelper *helper, QOpenGLContext *context)
-{
- Q_ASSERT(helper);
- Q_ASSERT(context);
-
- bool tryARB = true;
-
- if (context->isOpenGLES()) {
- if (context->format().majorVersion() >= 3) {
- QOpenGLExtraFunctionsPrivate *extra = static_cast<QOpenGLExtensions *>(context->extraFunctions())->d();
- helper->GenVertexArrays = extra->f.GenVertexArrays;
- helper->DeleteVertexArrays = extra->f.DeleteVertexArrays;
- helper->BindVertexArray = extra->f.BindVertexArray;
- helper->IsVertexArray = extra->f.IsVertexArray;
- tryARB = false;
- } else if (context->hasExtension(QByteArrayLiteral("GL_OES_vertex_array_object"))) {
- helper->GenVertexArrays = reinterpret_cast<QOpenGLVertexArrayObjectHelper::qt_GenVertexArrays_t>(context->getProcAddress("glGenVertexArraysOES"));
- helper->DeleteVertexArrays = reinterpret_cast<QOpenGLVertexArrayObjectHelper::qt_DeleteVertexArrays_t>(context->getProcAddress("glDeleteVertexArraysOES"));
- helper->BindVertexArray = reinterpret_cast<QOpenGLVertexArrayObjectHelper::qt_BindVertexArray_t>(context->getProcAddress("glBindVertexArrayOES"));
- helper->IsVertexArray = reinterpret_cast<QOpenGLVertexArrayObjectHelper::qt_IsVertexArray_t>(context->getProcAddress("glIsVertexArrayOES"));
- tryARB = false;
- }
- } else if (context->hasExtension(QByteArrayLiteral("GL_APPLE_vertex_array_object")) &&
- !context->hasExtension(QByteArrayLiteral("GL_ARB_vertex_array_object"))) {
- helper->GenVertexArrays = reinterpret_cast<QOpenGLVertexArrayObjectHelper::qt_GenVertexArrays_t>(context->getProcAddress("glGenVertexArraysAPPLE"));
- helper->DeleteVertexArrays = reinterpret_cast<QOpenGLVertexArrayObjectHelper::qt_DeleteVertexArrays_t>(context->getProcAddress("glDeleteVertexArraysAPPLE"));
- helper->BindVertexArray = reinterpret_cast<QOpenGLVertexArrayObjectHelper::qt_BindVertexArray_t>(context->getProcAddress("glBindVertexArrayAPPLE"));
- helper->IsVertexArray = reinterpret_cast<QOpenGLVertexArrayObjectHelper::qt_IsVertexArray_t>(context->getProcAddress("glIsVertexArrayAPPLE"));
- tryARB = false;
- }
-
- if (tryARB && context->hasExtension(QByteArrayLiteral("GL_ARB_vertex_array_object"))) {
- helper->GenVertexArrays = reinterpret_cast<QOpenGLVertexArrayObjectHelper::qt_GenVertexArrays_t>(context->getProcAddress("glGenVertexArrays"));
- helper->DeleteVertexArrays = reinterpret_cast<QOpenGLVertexArrayObjectHelper::qt_DeleteVertexArrays_t>(context->getProcAddress("glDeleteVertexArrays"));
- helper->BindVertexArray = reinterpret_cast<QOpenGLVertexArrayObjectHelper::qt_BindVertexArray_t>(context->getProcAddress("glBindVertexArray"));
- helper->IsVertexArray = reinterpret_cast<QOpenGLVertexArrayObjectHelper::qt_IsVertexArray_t>(context->getProcAddress("glIsVertexArray"));
- }
-}
-
-class QOpenGLVertexArrayObjectPrivate : public QObjectPrivate
-{
-public:
- QOpenGLVertexArrayObjectPrivate()
- : vao(0)
- , vaoFuncsType(NotSupported)
- , context(nullptr)
- {
- }
-
- ~QOpenGLVertexArrayObjectPrivate()
- {
- if (vaoFuncsType == ARB || vaoFuncsType == APPLE || vaoFuncsType == OES)
- delete vaoFuncs.helper;
- }
-
- bool create();
- void destroy();
- void bind();
- void release();
- void _q_contextAboutToBeDestroyed();
-
- Q_DECLARE_PUBLIC(QOpenGLVertexArrayObject)
-
- GLuint vao;
-
- union {
- QOpenGLFunctions_3_0 *core_3_0;
- QOpenGLFunctions_3_2_Core *core_3_2;
- QOpenGLVertexArrayObjectHelper *helper;
- } vaoFuncs;
- enum {
- NotSupported,
- Core_3_0,
- Core_3_2,
- ARB,
- APPLE,
- OES
- } vaoFuncsType;
-
- QOpenGLContext *context;
-};
-
-bool QOpenGLVertexArrayObjectPrivate::create()
-{
- if (vao) {
- qWarning("QOpenGLVertexArrayObject::create() VAO is already created");
- return false;
- }
-
- Q_Q(QOpenGLVertexArrayObject);
-
- QOpenGLContext *ctx = QOpenGLContext::currentContext();
- if (!ctx) {
- qWarning("QOpenGLVertexArrayObject::create() requires a valid current OpenGL context");
- return false;
- }
-
- //Fail early, if context is the same as ctx, it means we have tried to initialize for this context and failed
- if (ctx == context)
- return false;
-
- context = ctx;
- QObject::connect(context, SIGNAL(aboutToBeDestroyed()), q, SLOT(_q_contextAboutToBeDestroyed()));
-
- if (ctx->isOpenGLES()) {
- if (ctx->format().majorVersion() >= 3 || ctx->hasExtension(QByteArrayLiteral("GL_OES_vertex_array_object"))) {
- vaoFuncs.helper = new QOpenGLVertexArrayObjectHelper(ctx);
- vaoFuncsType = OES;
- vaoFuncs.helper->glGenVertexArrays(1, &vao);
- }
- } else {
- vaoFuncs.core_3_0 = nullptr;
- vaoFuncsType = NotSupported;
- QSurfaceFormat format = ctx->format();
-#ifndef QT_OPENGL_ES_2
- if (format.version() >= qMakePair<int, int>(3,2)) {
- vaoFuncs.core_3_2 = ctx->versionFunctions<QOpenGLFunctions_3_2_Core>();
- vaoFuncsType = Core_3_2;
- vaoFuncs.core_3_2->glGenVertexArrays(1, &vao);
- } else if (format.majorVersion() >= 3) {
- vaoFuncs.core_3_0 = ctx->versionFunctions<QOpenGLFunctions_3_0>();
- vaoFuncsType = Core_3_0;
- vaoFuncs.core_3_0->glGenVertexArrays(1, &vao);
- } else
-#endif
- if (ctx->hasExtension(QByteArrayLiteral("GL_ARB_vertex_array_object"))) {
- vaoFuncs.helper = new QOpenGLVertexArrayObjectHelper(ctx);
- vaoFuncsType = ARB;
- vaoFuncs.helper->glGenVertexArrays(1, &vao);
- } else if (ctx->hasExtension(QByteArrayLiteral("GL_APPLE_vertex_array_object"))) {
- vaoFuncs.helper = new QOpenGLVertexArrayObjectHelper(ctx);
- vaoFuncsType = APPLE;
- vaoFuncs.helper->glGenVertexArrays(1, &vao);
- }
- }
-
- return (vao != 0);
-}
-
-void QOpenGLVertexArrayObjectPrivate::destroy()
-{
- Q_Q(QOpenGLVertexArrayObject);
-
- QOpenGLContext *ctx = QOpenGLContext::currentContext();
- QOpenGLContext *oldContext = nullptr;
- QSurface *oldContextSurface = nullptr;
- QScopedPointer<QOffscreenSurface> offscreenSurface;
- if (context && context != ctx) {
- oldContext = ctx;
- oldContextSurface = ctx ? ctx->surface() : nullptr;
- // Before going through the effort of creating an offscreen surface
- // check that we are on the GUI thread because otherwise many platforms
- // will not able to create that offscreen surface.
- if (QThread::currentThread() != qGuiApp->thread()) {
- ctx = nullptr;
- } else {
- // Cannot just make the current surface current again with another context.
- // The format may be incompatible and some platforms (iOS) may impose
- // restrictions on using a window with different contexts. Create an
- // offscreen surface (a pbuffer or a hidden window) instead to be safe.
- offscreenSurface.reset(new QOffscreenSurface);
- offscreenSurface->setFormat(context->format());
- offscreenSurface->create();
- if (context->makeCurrent(offscreenSurface.data())) {
- ctx = context;
- } else {
- qWarning("QOpenGLVertexArrayObject::destroy() failed to make VAO's context current");
- ctx = nullptr;
- }
- }
- }
-
- if (context) {
- QObject::disconnect(context, SIGNAL(aboutToBeDestroyed()), q, SLOT(_q_contextAboutToBeDestroyed()));
- context = nullptr;
- }
-
- if (vao && ctx) {
- switch (vaoFuncsType) {
-#ifndef QT_OPENGL_ES_2
- case Core_3_2:
- vaoFuncs.core_3_2->glDeleteVertexArrays(1, &vao);
- break;
- case Core_3_0:
- vaoFuncs.core_3_0->glDeleteVertexArrays(1, &vao);
- break;
-#endif
- case ARB:
- case APPLE:
- case OES:
- vaoFuncs.helper->glDeleteVertexArrays(1, &vao);
- break;
- default:
- break;
- }
-
- vao = 0;
- }
-
- if (oldContext && oldContextSurface) {
- if (!oldContext->makeCurrent(oldContextSurface))
- qWarning("QOpenGLVertexArrayObject::destroy() failed to restore current context");
- }
-}
-
-/*!
- \internal
-*/
-void QOpenGLVertexArrayObjectPrivate::_q_contextAboutToBeDestroyed()
-{
- destroy();
-}
-
-void QOpenGLVertexArrayObjectPrivate::bind()
-{
- switch (vaoFuncsType) {
-#ifndef QT_OPENGL_ES_2
- case Core_3_2:
- vaoFuncs.core_3_2->glBindVertexArray(vao);
- break;
- case Core_3_0:
- vaoFuncs.core_3_0->glBindVertexArray(vao);
- break;
-#endif
- case ARB:
- case APPLE:
- case OES:
- vaoFuncs.helper->glBindVertexArray(vao);
- break;
- default:
- break;
- }
-}
-
-void QOpenGLVertexArrayObjectPrivate::release()
-{
- switch (vaoFuncsType) {
-#ifndef QT_OPENGL_ES_2
- case Core_3_2:
- vaoFuncs.core_3_2->glBindVertexArray(0);
- break;
- case Core_3_0:
- vaoFuncs.core_3_0->glBindVertexArray(0);
- break;
-#endif
- case ARB:
- case APPLE:
- case OES:
- vaoFuncs.helper->glBindVertexArray(0);
- break;
- default:
- break;
- }
-}
-
-
-/*!
- \class QOpenGLVertexArrayObject
- \brief The QOpenGLVertexArrayObject class wraps an OpenGL Vertex Array Object.
- \inmodule QtGui
- \since 5.1
- \ingroup painting-3D
-
- A Vertex Array Object (VAO) is an OpenGL container object that encapsulates
- the state needed to specify per-vertex attribute data to the OpenGL pipeline.
- To put it another way, a VAO remembers the states of buffer objects (see
- QOpenGLBuffer) and their associated state (e.g. vertex attribute divisors).
- This allows a very easy and efficient method of switching between OpenGL buffer
- states for rendering different "objects" in a scene. The QOpenGLVertexArrayObject
- class is a thin wrapper around an OpenGL VAO.
-
- For the desktop, VAOs are supported as a core feature in OpenGL 3.0 or newer and by the
- GL_ARB_vertex_array_object for older versions. On OpenGL ES 2, VAOs are provided by
- the optional GL_OES_vertex_array_object extension. You can check the version of
- OpenGL with QOpenGLContext::surfaceFormat() and check for the presence of extensions
- with QOpenGLContext::hasExtension().
-
- As with the other Qt OpenGL classes, QOpenGLVertexArrayObject has a create()
- function to create the underlying OpenGL object. This is to allow the developer to
- ensure that there is a valid current OpenGL context at the time.
-
- Once you have successfully created a VAO the typical usage pattern is:
-
- \list
- \li In scene initialization function, for each visual object:
- \list
- \li Bind the VAO
- \li Set vertex data state for this visual object (vertices, normals, texture coordinates etc.)
- \li Unbind (release()) the VAO
- \endlist
- \li In render function, for each visual object:
- \list
- \li Bind the VAO (and shader program if needed)
- \li Call a glDraw*() function
- \li Unbind (release()) the VAO
- \endlist
- \endlist
-
- The act of binding the VAO in the render function has the effect of restoring
- all of the vertex data state setup in the initialization phase. In this way we can
- set a great deal of state when setting up a VAO and efficiently switch between
- state sets of objects to be rendered. Using VAOs also allows the OpenGL driver
- to amortise the validation checks of the vertex data.
-
- \note Vertex Array Objects, like all other OpenGL container objects, are specific
- to the context for which they were created and cannot be shared amongst a
- context group.
-
- \sa QOpenGLVertexArrayObject::Binder, QOpenGLBuffer
-*/
-
-/*!
- Creates a QOpenGLVertexArrayObject with the given \a parent. You must call create()
- with a valid OpenGL context before using.
-*/
-QOpenGLVertexArrayObject::QOpenGLVertexArrayObject(QObject* parent)
- : QObject(*new QOpenGLVertexArrayObjectPrivate, parent)
-{
-}
-
-/*!
- \internal
-*/
-QOpenGLVertexArrayObject::QOpenGLVertexArrayObject(QOpenGLVertexArrayObjectPrivate &dd)
- : QObject(dd)
-{
-}
-
-/*!
- Destroys the QOpenGLVertexArrayObject and the underlying OpenGL resource.
-*/
-QOpenGLVertexArrayObject::~QOpenGLVertexArrayObject()
-{
- destroy();
-}
-
-/*!
- Creates the underlying OpenGL vertex array object. There must be a valid OpenGL context
- that supports vertex array objects current for this function to succeed.
-
- Returns \c true if the OpenGL vertex array object was successfully created.
-
- When the return value is \c false, vertex array object support is not available. This
- is not an error: on systems with OpenGL 2.x or OpenGL ES 2.0 vertex array objects may
- not be supported. The application is free to continue execution in this case, but it
- then has to be prepared to operate in a VAO-less manner too. This means that instead
- of merely calling bind(), the value of isCreated() must be checked and the vertex
- arrays has to be initialized in the traditional way when there is no vertex array
- object present.
-
- \sa isCreated()
-*/
-bool QOpenGLVertexArrayObject::create()
-{
- Q_D(QOpenGLVertexArrayObject);
- return d->create();
-}
-
-/*!
- Destroys the underlying OpenGL vertex array object. There must be a valid OpenGL context
- that supports vertex array objects current for this function to succeed.
-*/
-void QOpenGLVertexArrayObject::destroy()
-{
- Q_D(QOpenGLVertexArrayObject);
- d->destroy();
-}
-
-/*!
- Returns \c true is the underlying OpenGL vertex array object has been created. If this
- returns \c true and the associated OpenGL context is current, then you are able to bind()
- this object.
-*/
-bool QOpenGLVertexArrayObject::isCreated() const
-{
- Q_D(const QOpenGLVertexArrayObject);
- return (d->vao != 0);
-}
-
-/*!
- Returns the id of the underlying OpenGL vertex array object.
-*/
-GLuint QOpenGLVertexArrayObject::objectId() const
-{
- Q_D(const QOpenGLVertexArrayObject);
- return d->vao;
-}
-
-/*!
- Binds this vertex array object to the OpenGL binding point. From this point on
- and until release() is called or another vertex array object is bound, any
- modifications made to vertex data state are stored inside this vertex array object.
-
- If another vertex array object is then bound you can later restore the set of
- state associated with this object by calling bind() on this object once again.
- This allows efficient changes between vertex data states in rendering functions.
-*/
-void QOpenGLVertexArrayObject::bind()
-{
- Q_D(QOpenGLVertexArrayObject);
- d->bind();
-}
-
-/*!
- Unbinds this vertex array object by binding the default vertex array object (id = 0).
-*/
-void QOpenGLVertexArrayObject::release()
-{
- Q_D(QOpenGLVertexArrayObject);
- d->release();
-}
-
-
-/*!
- \class QOpenGLVertexArrayObject::Binder
- \brief The QOpenGLVertexArrayObject::Binder class is a convenience class to help
- with the binding and releasing of OpenGL Vertex Array Objects.
- \inmodule QtGui
- \reentrant
- \since 5.1
- \ingroup painting-3D
-
- QOpenGLVertexArrayObject::Binder is a simple convenience class that can be used
- to assist with the binding and releasing of QOpenGLVertexArrayObject instances.
- This class is to QOpenGLVertexArrayObject as QMutexLocker is to QMutex.
-
- This class implements the RAII principle which helps to ensure behavior in
- complex code or in the presence of exceptions.
-
- The constructor of this class accepts a QOpenGLVertexArrayObject (VAO) as an
- argument and attempts to bind the VAO, calling QOpenGLVertexArrayObject::create()
- if necessary. The destructor of this class calls QOpenGLVertexArrayObject::release()
- which unbinds the VAO.
-
- If needed the VAO can be temporarily unbound with the release() function and bound
- once more with rebind().
-
- \sa QOpenGLVertexArrayObject
-*/
-
-/*!
- \fn QOpenGLVertexArrayObject::Binder::Binder(QOpenGLVertexArrayObject *v)
-
- Creates a QOpenGLVertexArrayObject::Binder object and binds \a v by calling
- QOpenGLVertexArrayObject::bind(). If necessary it first calls
- QOpenGLVertexArrayObject::create().
-*/
-
-/*!
- \fn QOpenGLVertexArrayObject::Binder::~Binder()
-
- Destroys the QOpenGLVertexArrayObject::Binder and releases the associated vertex array object.
-*/
-
-/*!
- \fn QOpenGLVertexArrayObject::Binder::release()
-
- Can be used to temporarily release the associated vertex array object.
-
- \sa rebind()
-*/
-
-/*!
- \fn QOpenGLVertexArrayObject::Binder::rebind()
-
- Can be used to rebind the associated vertex array object.
-
- \sa release()
-*/
-
-QT_END_NAMESPACE
-
-#include "moc_qopenglvertexarrayobject.cpp"
diff --git a/src/gui/opengl/qopenglvertexarrayobject.h b/src/gui/opengl/qopenglvertexarrayobject.h
deleted file mode 100644
index b81ae6a2a9..0000000000
--- a/src/gui/opengl/qopenglvertexarrayobject.h
+++ /dev/null
@@ -1,111 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2014 Klarälvdalens Datakonsult AB, a KDAB Group company, info@kdab.com, author Sean Harmer <sean.harmer@kdab.com>
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the QtGui module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef QOPENGLVERTEXARRAYOBJECT_H
-#define QOPENGLVERTEXARRAYOBJECT_H
-
-#include <QtGui/qtguiglobal.h>
-
-#ifndef QT_NO_OPENGL
-
-#include <QtCore/QObject>
-#include <QtGui/qopengl.h>
-
-QT_BEGIN_NAMESPACE
-
-class QOpenGLVertexArrayObjectPrivate;
-
-class Q_GUI_EXPORT QOpenGLVertexArrayObject : public QObject
-{
- Q_OBJECT
-
-public:
- explicit QOpenGLVertexArrayObject(QObject* parent = nullptr);
- ~QOpenGLVertexArrayObject();
-
- bool create();
- void destroy();
- bool isCreated() const;
- GLuint objectId() const;
- void bind();
- void release();
-
- class Q_GUI_EXPORT Binder
- {
- public:
- inline Binder(QOpenGLVertexArrayObject *v)
- : vao(v)
- {
- Q_ASSERT(v);
- if (vao->isCreated() || vao->create())
- vao->bind();
- }
-
- inline ~Binder()
- {
- release();
- }
-
- inline void release()
- {
- vao->release();
- }
-
- inline void rebind()
- {
- vao->bind();
- }
-
- private:
- Q_DISABLE_COPY(Binder)
- QOpenGLVertexArrayObject *vao;
- };
-
-private:
- Q_DISABLE_COPY(QOpenGLVertexArrayObject)
- Q_DECLARE_PRIVATE(QOpenGLVertexArrayObject)
- Q_PRIVATE_SLOT(d_func(), void _q_contextAboutToBeDestroyed())
- QOpenGLVertexArrayObject(QOpenGLVertexArrayObjectPrivate &dd);
-};
-
-QT_END_NAMESPACE
-
-#endif
-
-#endif // QOPENGLVERTEXARRAYOBJECT_H
diff --git a/src/gui/opengl/qopenglvertexarrayobject_p.h b/src/gui/opengl/qopenglvertexarrayobject_p.h
deleted file mode 100644
index fd3a6f0f89..0000000000
--- a/src/gui/opengl/qopenglvertexarrayobject_p.h
+++ /dev/null
@@ -1,125 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2014 Klarälvdalens Datakonsult AB, a KDAB Group company, info@kdab.com, author Sean Harmer <sean.harmer@kdab.com>
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the QtGui module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef QOPENGLVERTEXARRAYOBJECT_P_H
-#define QOPENGLVERTEXARRAYOBJECT_P_H
-
-//
-// W A R N I N G
-// -------------
-//
-// This file is not part of the Qt API. It exists for the convenience
-// of the Qt OpenGL classes. This header file may change from
-// version to version without notice, or even be removed.
-//
-// We mean it.
-//
-
-#include <QtCore/qglobal.h>
-
-#ifndef QT_NO_OPENGL
-
-#include <QtGui/qopengl.h>
-
-QT_BEGIN_NAMESPACE
-
-class QOpenGLVertexArrayObjectHelper;
-class QOpenGLContext;
-
-void Q_GUI_EXPORT qtInitializeVertexArrayObjectHelper(QOpenGLVertexArrayObjectHelper *helper, QOpenGLContext *context);
-
-class QOpenGLVertexArrayObjectHelper
-{
- Q_DISABLE_COPY(QOpenGLVertexArrayObjectHelper)
-
-public:
- explicit inline QOpenGLVertexArrayObjectHelper(QOpenGLContext *context)
- : GenVertexArrays(nullptr)
- , DeleteVertexArrays(nullptr)
- , BindVertexArray(nullptr)
- , IsVertexArray(nullptr)
- {
- qtInitializeVertexArrayObjectHelper(this, context);
- }
-
- inline bool isValid() const
- {
- return GenVertexArrays && DeleteVertexArrays && BindVertexArray && IsVertexArray;
- }
-
- inline void glGenVertexArrays(GLsizei n, GLuint *arrays) const
- {
- GenVertexArrays(n, arrays);
- }
-
- inline void glDeleteVertexArrays(GLsizei n, const GLuint *arrays) const
- {
- DeleteVertexArrays(n, arrays);
- }
-
- inline void glBindVertexArray(GLuint array) const
- {
- BindVertexArray(array);
- }
-
- inline GLboolean glIsVertexArray(GLuint array) const
- {
- return IsVertexArray(array);
- }
-
-private:
- friend void Q_GUI_EXPORT qtInitializeVertexArrayObjectHelper(QOpenGLVertexArrayObjectHelper *helper, QOpenGLContext *context);
-
- // Function signatures are equivalent between desktop core, ARB, APPLE, ES 3 and ES 2 extensions
- typedef void (QOPENGLF_APIENTRYP qt_GenVertexArrays_t)(GLsizei n, GLuint *arrays);
- typedef void (QOPENGLF_APIENTRYP qt_DeleteVertexArrays_t)(GLsizei n, const GLuint *arrays);
- typedef void (QOPENGLF_APIENTRYP qt_BindVertexArray_t)(GLuint array);
- typedef GLboolean (QOPENGLF_APIENTRYP qt_IsVertexArray_t)(GLuint array);
-
- qt_GenVertexArrays_t GenVertexArrays;
- qt_DeleteVertexArrays_t DeleteVertexArrays;
- qt_BindVertexArray_t BindVertexArray;
- qt_IsVertexArray_t IsVertexArray;
-};
-
-QT_END_NAMESPACE
-
-#endif // QT_NO_OPENGL
-
-#endif // QOPENGLVERTEXARRAYOBJECT_P_H
diff --git a/src/gui/opengl/qt_attribution.json b/src/gui/opengl/qt_attribution.json
index d3ff10d803..44310980e2 100644
--- a/src/gui/opengl/qt_attribution.json
+++ b/src/gui/opengl/qt_attribution.json
@@ -5,7 +5,7 @@
"QDocModule": "qtgui",
"Description": "OpenGL header generated from the Khronos OpenGL / OpenGL ES XML API Registry.",
"QtUsage": "Used on Windows and Linux in the OpenGL related headers of Qt GUI.",
- "Path": "qopenglext.h",
+ "Files": "qopenglext.h",
"Homepage": "https://www.khronos.org/",
"Version": "Revision 27684",
@@ -20,7 +20,7 @@
"QDocModule": "qtgui",
"Description": "OpenGL ES 2 header generated from the Khronos OpenGL / OpenGL ES XML API Registry.",
"QtUsage": "Used on Windows and Linux in the OpenGL related headers of Qt GUI.",
- "Path": "qopengles2ext.h",
+ "Files": "qopengles2ext.h",
"Homepage": "https://www.khronos.org/",
"Version": "Revision 27673",
diff --git a/src/gui/painting/painting.pri b/src/gui/painting/painting.pri
deleted file mode 100644
index fcf6488edd..0000000000
--- a/src/gui/painting/painting.pri
+++ /dev/null
@@ -1,175 +0,0 @@
-# Qt gui library, paint module
-
-HEADERS += \
- painting/qbackingstore.h \
- painting/qbezier_p.h \
- painting/qblendfunctions_p.h \
- painting/qblittable_p.h \
- painting/qbrush.h \
- painting/qcolor.h \
- painting/qcolor_p.h \
- painting/qcolormatrix_p.h \
- painting/qcolorspace.h \
- painting/qcolorspace_p.h \
- painting/qcolortransferfunction_p.h \
- painting/qcolortransfertable_p.h \
- painting/qcolortransform.h \
- painting/qcolortransform_p.h \
- painting/qcolortrc_p.h \
- painting/qcolortrclut_p.h \
- painting/qcosmeticstroker_p.h \
- painting/qdatabuffer_p.h \
- painting/qdrawhelper_p.h \
- painting/qdrawhelper_x86_p.h \
- painting/qdrawingprimitive_sse2_p.h \
- painting/qemulationpaintengine_p.h \
- painting/qfixed_p.h \
- painting/qgrayraster_p.h \
- painting/qicc_p.h \
- painting/qmatrix.h \
- painting/qmemrotate_p.h \
- painting/qoutlinemapper_p.h \
- painting/qpagedpaintdevice.h \
- painting/qpagedpaintdevice_p.h \
- painting/qpagelayout.h \
- painting/qpagesize.h \
- painting/qpaintdevice.h \
- painting/qpaintengine.h \
- painting/qpaintengine_p.h \
- painting/qpaintengineex_p.h \
- painting/qpaintengine_blitter_p.h \
- painting/qpaintengine_raster_p.h \
- painting/qpainter.h \
- painting/qpainter_p.h \
- painting/qpainterpath.h \
- painting/qpainterpath_p.h \
- painting/qvectorpath_p.h \
- painting/qpathclipper_p.h \
- painting/qpdf_p.h \
- painting/qpdfwriter.h \
- painting/qpen.h \
- painting/qpolygon.h \
- painting/qpolygonclipper_p.h \
- painting/qrasterdefs_p.h \
- painting/qrasterizer_p.h \
- painting/qrbtree_p.h \
- painting/qregion.h \
- painting/qrgb.h \
- painting/qrgba64.h \
- painting/qrgba64_p.h \
- painting/qstroker_p.h \
- painting/qtextureglyphcache_p.h \
- painting/qtransform.h \
- painting/qtriangulatingstroker_p.h \
- painting/qtriangulator_p.h \
- painting/qplatformbackingstore.h \
- painting/qpathsimplifier_p.h
-
-
-SOURCES += \
- painting/qbackingstore.cpp \
- painting/qbezier.cpp \
- painting/qblendfunctions.cpp \
- painting/qblittable.cpp \
- painting/qbrush.cpp \
- painting/qcolor.cpp \
- painting/qcolorspace.cpp \
- painting/qcolortransform.cpp \
- painting/qcolortrclut.cpp \
- painting/qcompositionfunctions.cpp \
- painting/qcosmeticstroker.cpp \
- painting/qdrawhelper.cpp \
- painting/qemulationpaintengine.cpp \
- painting/qgrayraster.c \
- painting/qicc.cpp \
- painting/qimagescale.cpp \
- painting/qmatrix.cpp \
- painting/qmemrotate.cpp \
- painting/qoutlinemapper.cpp \
- painting/qpagedpaintdevice.cpp \
- painting/qpagelayout.cpp \
- painting/qpagesize.cpp \
- painting/qpaintdevice.cpp \
- painting/qpaintengine.cpp \
- painting/qpaintengineex.cpp \
- painting/qpaintengine_blitter.cpp \
- painting/qpaintengine_raster.cpp \
- painting/qpainter.cpp \
- painting/qpainterpath.cpp \
- painting/qpathclipper.cpp \
- painting/qpdf.cpp \
- painting/qpdfwriter.cpp \
- painting/qpen.cpp \
- painting/qpolygon.cpp \
- painting/qrasterizer.cpp \
- painting/qregion.cpp \
- painting/qstroker.cpp \
- painting/qtextureglyphcache.cpp \
- painting/qtransform.cpp \
- painting/qtriangulatingstroker.cpp \
- painting/qtriangulator.cpp \
- painting/qplatformbackingstore.cpp \
- painting/qpathsimplifier.cpp
-
-webgradients.files = painting/webgradients.binaryjson
-webgradients.prefix = qgradient
-webgradients.base = painting
-
-RESOURCES += \
- painting/qpdf.qrc \
- webgradients
-
-darwin {
- HEADERS += painting/qcoregraphics_p.h
- SOURCES += painting/qcoregraphics.mm
-}
-
-qtConfig(cssparser) {
- SOURCES += \
- painting/qcssutil.cpp
-}
-
-# Causes internal compiler errors with at least GCC 5.3.1:
-gcc:equals(QT_GCC_MAJOR_VERSION, 5) {
- SOURCES -= painting/qdrawhelper.cpp
- NO_PCH_SOURCES += painting/qdrawhelper.cpp
-}
-
-!android {
- SSE2_SOURCES += painting/qdrawhelper_sse2.cpp
- SSSE3_SOURCES += painting/qdrawhelper_ssse3.cpp
- SSE4_1_SOURCES += painting/qdrawhelper_sse4.cpp \
- painting/qimagescale_sse4.cpp
- ARCH_HASWELL_SOURCES += painting/qdrawhelper_avx2.cpp
-
- NEON_SOURCES += painting/qdrawhelper_neon.cpp painting/qimagescale_neon.cpp
- NEON_HEADERS += painting/qdrawhelper_neon_p.h
-}
-!uikit:!win32:contains(QT_ARCH, "arm"): CONFIG += no_clang_integrated_as
-!android:!uikit:!win32:!integrity:!contains(QT_ARCH, "arm64") {
- NEON_ASM += ../3rdparty/pixman/pixman-arm-neon-asm.S painting/qdrawhelper_neon_asm.S
- DEFINES += ENABLE_PIXMAN_DRAWHELPERS
-}
-
-!android {
- MIPS_DSP_SOURCES += painting/qdrawhelper_mips_dsp.cpp
- MIPS_DSP_HEADERS += painting/qdrawhelper_mips_dsp_p.h painting/qt_mips_asm_dsp_p.h
- MIPS_DSP_ASM += painting/qdrawhelper_mips_dsp_asm.S
- MIPS_DSPR2_ASM += painting/qdrawhelper_mips_dspr2_asm.S
-} else {
- # see https://developer.android.com/ndk/guides/abis
- x86 | x86_64 {
- DEFINES += QT_COMPILER_SUPPORTS_SSE2 QT_COMPILER_SUPPORTS_SSE3 QT_COMPILER_SUPPORTS_SSSE3
- SOURCES += painting/qdrawhelper_sse2.cpp painting/qdrawhelper_ssse3.cpp
- }
- x86_64 {
- DEFINES += QT_COMPILER_SUPPORTS_SSE4_1 QT_COMPILER_SUPPORTS_SSE4_2
- SOURCES += painting/qdrawhelper_sse4.cpp painting/qimagescale_sse4.cpp
- }
- arm64-v8a {
- SOURCES += painting/qdrawhelper_neon.cpp painting/qimagescale_neon.cpp
- HEADERS += painting/qdrawhelper_neon_p.h
- }
-}
-
-include($$PWD/../../3rdparty/zlib_dependency.pri)
diff --git a/src/gui/painting/qbackingstore.cpp b/src/gui/painting/qbackingstore.cpp
index b0393aff95..2304ee2256 100644
--- a/src/gui/painting/qbackingstore.cpp
+++ b/src/gui/painting/qbackingstore.cpp
@@ -1,41 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the QtGui module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#include <qbackingstore.h>
#include <qwindow.h>
@@ -61,11 +25,32 @@ public:
{
}
+ // Returns the DPR for the backing store. This is the DPR for the QWindow,
+ // possibly rounded up to the nearest integer.
+ qreal backingStoreDevicePixelRatio() const
+ {
+ // Note: keep in sync with QWidget::metric()!
+ qreal windowDpr = window->devicePixelRatio();
+ return downscale ? std::ceil(windowDpr) : windowDpr;
+ }
+
+ // Returns the factor used for converting from device independent to native
+ // backing store sizes. Normally this is just the gui scale factor, however
+ // if the backing store rounds the DPR up to the nearest integer then we also
+ // need to account for the factor introduced by that rounding.
+ qreal deviceIndependentToNativeFactor() const
+ {
+ const qreal roundingFactor = backingStoreDevicePixelRatio() / window->devicePixelRatio();
+ const qreal guiFactor = QHighDpiScaling::factor(window);
+ return roundingFactor * guiFactor;
+ }
+
QWindow *window;
QPlatformBackingStore *platformBackingStore = nullptr;
QScopedPointer<QImage> highDpiBackingstore;
QRegion staticContents;
QSize size;
+ bool downscale = qEnvironmentVariableIntValue("QT_WIDGETS_HIGHDPI_DOWNSCALE") > 0;
};
/*!
@@ -130,12 +115,14 @@ QWindow* QBackingStore::window() const
void QBackingStore::beginPaint(const QRegion &region)
{
+ const qreal dpr = d_ptr->backingStoreDevicePixelRatio();
+
if (d_ptr->highDpiBackingstore &&
- d_ptr->highDpiBackingstore->devicePixelRatio() != d_ptr->window->devicePixelRatio())
+ d_ptr->highDpiBackingstore->devicePixelRatio() != dpr)
resize(size());
QPlatformBackingStore *platformBackingStore = handle();
- platformBackingStore->beginPaint(QHighDpi::toNativeLocalRegion(region, d_ptr->window));
+ platformBackingStore->beginPaint(QHighDpi::scale(region, d_ptr->deviceIndependentToNativeFactor()));
// When QtGui is applying a high-dpi scale factor the backing store
// creates a "large" backing store image. This image needs to be
@@ -151,15 +138,10 @@ void QBackingStore::beginPaint(const QRegion &region)
|| source->size() != d_ptr->highDpiBackingstore->size()
|| source->devicePixelRatio() != d_ptr->highDpiBackingstore->devicePixelRatio();
if (needsNewImage) {
- qCDebug(lcScaling) << "QBackingStore::beginPaint new backingstore for" << d_ptr->window;
- qCDebug(lcScaling) << " source size" << source->size() << "dpr" << source->devicePixelRatio();
d_ptr->highDpiBackingstore.reset(
new QImage(source->bits(), source->width(), source->height(), source->bytesPerLine(), source->format()));
- qreal targetDevicePixelRatio = d_ptr->window->devicePixelRatio();
- d_ptr->highDpiBackingstore->setDevicePixelRatio(targetDevicePixelRatio);
- qCDebug(lcScaling) <<" destination size" << d_ptr->highDpiBackingstore->size()
- << "dpr" << targetDevicePixelRatio;
+ d_ptr->highDpiBackingstore->setDevicePixelRatio(dpr);
}
}
}
@@ -196,17 +178,6 @@ void QBackingStore::endPaint()
handle()->endPaint();
}
-static bool isRasterSurface(QWindow *window)
-{
- switch (window->surfaceType()) {
- case QSurface::RasterSurface:
- case QSurface::RasterGLSurface:
- return true;
- default:
- return false;
- };
-}
-
/*!
Flushes the given \a region from the specified \a window onto the
screen.
@@ -220,8 +191,6 @@ static bool isRasterSurface(QWindow *window)
to the backingstore's top level window.
You should call this function after ending painting with endPaint().
-
- \sa QWindow::transientParent()
*/
void QBackingStore::flush(const QRegion &region, QWindow *window, const QPoint &offset)
{
@@ -235,24 +204,22 @@ void QBackingStore::flush(const QRegion &region, QWindow *window, const QPoint &
return;
}
- if (!isRasterSurface(window)) {
- qWarning() << "Attempted flush to non-raster surface" << window << "of type" << window->surfaceType()
- << (window->inherits("QWidgetWindow") ? "(consider using Qt::WA_PaintOnScreen to exclude "
- "from backingstore sync)" : "");
- return;
- }
-
-#ifdef QBACKINGSTORE_DEBUG
- if (window && window->isTopLevel() && !qt_window_private(window)->receivedExpose) {
- qWarning().nospace() << "QBackingStore::flush() called with non-exposed window "
- << window << ", behavior is undefined";
- }
-#endif
-
Q_ASSERT(window == topLevelWindow || topLevelWindow->isAncestorOf(window, QWindow::ExcludeTransients));
- handle()->flush(window, QHighDpi::toNativeLocalRegion(region, window),
- QHighDpi::toNativeLocalPosition(offset, window));
+ const qreal toNativeFactor = d_ptr->deviceIndependentToNativeFactor();
+
+ QRegion nativeRegion = QHighDpi::scale(region, toNativeFactor);
+ QPoint nativeOffset;
+ if (!offset.isNull()) {
+ nativeOffset = QHighDpi::scale(offset, toNativeFactor);
+ // Under fractional DPR, rounding of region and offset may accumulate to an off-by-one
+ QPoint topLeft = region.boundingRect().topLeft() + offset;
+ QPoint nativeTopLeft = QHighDpi::scale(topLeft, toNativeFactor);
+ QPoint diff = nativeTopLeft - (nativeRegion.boundingRect().topLeft() + nativeOffset);
+ Q_ASSERT(qMax(qAbs(diff.x()), qAbs(diff.y())) <= 1);
+ nativeRegion.translate(diff);
+ }
+ handle()->flush(window, nativeRegion, nativeOffset);
}
/*!
@@ -263,7 +230,8 @@ void QBackingStore::flush(const QRegion &region, QWindow *window, const QPoint &
void QBackingStore::resize(const QSize &size)
{
d_ptr->size = size;
- handle()->resize(QHighDpi::toNativePixels(size, d_ptr->window), d_ptr->staticContents);
+ const qreal factor = d_ptr->deviceIndependentToNativeFactor();
+ handle()->resize(QHighDpi::scale(size, factor), QHighDpi::scale(d_ptr->staticContents, factor));
}
/*!
@@ -283,15 +251,15 @@ QSize QBackingStore::size() const
bool QBackingStore::scroll(const QRegion &area, int dx, int dy)
{
// Disable scrolling for non-integer scroll deltas. For this case
- // the the existing rendered pixels can't be re-used, and we return
+ // the existing rendered pixels can't be re-used, and we return
// false to signal that a repaint is needed.
- const qreal nativeDx = QHighDpi::toNativePixels(qreal(dx), d_ptr->window);
- const qreal nativeDy = QHighDpi::toNativePixels(qreal(dy), d_ptr->window);
+ const qreal toNativeFactor = d_ptr->deviceIndependentToNativeFactor();
+ const qreal nativeDx = QHighDpi::scale(qreal(dx), toNativeFactor);
+ const qreal nativeDy = QHighDpi::scale(qreal(dy), toNativeFactor);
if (qFloor(nativeDx) != nativeDx || qFloor(nativeDy) != nativeDy)
return false;
- return handle()->scroll(QHighDpi::toNativeLocalRegion(area, d_ptr->window),
- nativeDx, nativeDy);
+ return handle()->scroll(QHighDpi::scale(area, toNativeFactor), nativeDx, nativeDy);
}
/*!
@@ -299,6 +267,13 @@ bool QBackingStore::scroll(const QRegion &area, int dx, int dy)
*/
void QBackingStore::setStaticContents(const QRegion &region)
{
+ [[maybe_unused]] static const bool didCheckPlatformSupport = []{
+ const auto *integration = QGuiApplicationPrivate::platformIntegration();
+ if (!integration->hasCapability(QPlatformIntegration::BackingStoreStaticContents))
+ qWarning("QBackingStore::setStaticContents(): Platform does not support static contents");
+ return true;
+ }();
+
d_ptr->staticContents = region;
}
@@ -322,32 +297,34 @@ bool QBackingStore::hasStaticContents() const
void Q_GUI_EXPORT qt_scrollRectInImage(QImage &img, const QRect &rect, const QPoint &offset)
{
// make sure we don't detach
- uchar *mem = const_cast<uchar*>(const_cast<const QImage &>(img).bits());
+ uchar *mem = const_cast<uchar*>(img.constBits());
- int lineskip = img.bytesPerLine();
+ qsizetype lineskip = img.bytesPerLine();
int depth = img.depth() >> 3;
const QRect imageRect(0, 0, img.width(), img.height());
- const QRect r = rect & imageRect & imageRect.translated(-offset);
- const QPoint p = rect.topLeft() + offset;
-
- if (r.isEmpty())
+ const QRect sourceRect = rect.intersected(imageRect).intersected(imageRect.translated(-offset));
+ if (sourceRect.isEmpty())
return;
+ const QRect destRect = sourceRect.translated(offset);
+ Q_ASSERT_X(imageRect.contains(destRect), "qt_scrollRectInImage",
+ "The sourceRect should already account for clipping, both pre and post scroll");
+
const uchar *src;
uchar *dest;
- if (r.top() < p.y()) {
- src = mem + r.bottom() * lineskip + r.left() * depth;
- dest = mem + (p.y() + r.height() - 1) * lineskip + p.x() * depth;
+ if (sourceRect.top() < destRect.top()) {
+ src = mem + sourceRect.bottom() * lineskip + sourceRect.left() * depth;
+ dest = mem + (destRect.top() + sourceRect.height() - 1) * lineskip + destRect.left() * depth;
lineskip = -lineskip;
} else {
- src = mem + r.top() * lineskip + r.left() * depth;
- dest = mem + p.y() * lineskip + p.x() * depth;
+ src = mem + sourceRect.top() * lineskip + sourceRect.left() * depth;
+ dest = mem + destRect.top() * lineskip + destRect.left() * depth;
}
- const int w = r.width();
- int h = r.height();
+ const int w = sourceRect.width();
+ int h = sourceRect.height();
const int bytes = w * depth;
// overlapping segments?
diff --git a/src/gui/painting/qbackingstore.h b/src/gui/painting/qbackingstore.h
index ed37e11a5b..3673d66a0f 100644
--- a/src/gui/painting/qbackingstore.h
+++ b/src/gui/painting/qbackingstore.h
@@ -1,41 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the QtGui module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#ifndef QBACKINGSTORE_H
#define QBACKINGSTORE_H
diff --git a/src/gui/painting/qbackingstoredefaultcompositor.cpp b/src/gui/painting/qbackingstoredefaultcompositor.cpp
new file mode 100644
index 0000000000..c1452ca768
--- /dev/null
+++ b/src/gui/painting/qbackingstoredefaultcompositor.cpp
@@ -0,0 +1,676 @@
+// Copyright (C) 2021 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
+
+#include "qbackingstoredefaultcompositor_p.h"
+#include <QtGui/private/qwindow_p.h>
+#include <qpa/qplatformgraphicsbuffer.h>
+#include <QtCore/qfile.h>
+
+QT_BEGIN_NAMESPACE
+
+using namespace Qt::StringLiterals;
+
+QBackingStoreDefaultCompositor::~QBackingStoreDefaultCompositor()
+{
+ reset();
+}
+
+void QBackingStoreDefaultCompositor::reset()
+{
+ m_rhi = nullptr;
+ m_psNoBlend.reset();
+ m_psBlend.reset();
+ m_psPremulBlend.reset();
+ m_samplerNearest.reset();
+ m_samplerLinear.reset();
+ m_vbuf.reset();
+ m_texture.reset();
+ m_widgetQuadData.reset();
+ for (PerQuadData &d : m_textureQuadData)
+ d.reset();
+}
+
+QRhiTexture *QBackingStoreDefaultCompositor::toTexture(const QPlatformBackingStore *backingStore,
+ QRhi *rhi,
+ QRhiResourceUpdateBatch *resourceUpdates,
+ const QRegion &dirtyRegion,
+ QPlatformBackingStore::TextureFlags *flags) const
+{
+ return toTexture(backingStore->toImage(), rhi, resourceUpdates, dirtyRegion, flags);
+}
+
+QRhiTexture *QBackingStoreDefaultCompositor::toTexture(const QImage &sourceImage,
+ QRhi *rhi,
+ QRhiResourceUpdateBatch *resourceUpdates,
+ const QRegion &dirtyRegion,
+ QPlatformBackingStore::TextureFlags *flags) const
+{
+ Q_ASSERT(rhi);
+ Q_ASSERT(resourceUpdates);
+ Q_ASSERT(flags);
+
+ if (!m_rhi) {
+ m_rhi = rhi;
+ } else if (m_rhi != rhi) {
+ qWarning("QBackingStoreDefaultCompositor: the QRhi has changed unexpectedly, this should not happen");
+ return nullptr;
+ }
+
+ QImage image = sourceImage;
+
+ bool needsConversion = false;
+ *flags = {};
+
+ switch (image.format()) {
+ case QImage::Format_ARGB32_Premultiplied:
+ *flags |= QPlatformBackingStore::TexturePremultiplied;
+ Q_FALLTHROUGH();
+ case QImage::Format_RGB32:
+ case QImage::Format_ARGB32:
+ *flags |= QPlatformBackingStore::TextureSwizzle;
+ break;
+ case QImage::Format_RGBA8888_Premultiplied:
+ *flags |= QPlatformBackingStore::TexturePremultiplied;
+ Q_FALLTHROUGH();
+ case QImage::Format_RGBX8888:
+ case QImage::Format_RGBA8888:
+ break;
+ case QImage::Format_BGR30:
+ case QImage::Format_A2BGR30_Premultiplied:
+ // no fast path atm
+ needsConversion = true;
+ break;
+ case QImage::Format_RGB30:
+ case QImage::Format_A2RGB30_Premultiplied:
+ // no fast path atm
+ needsConversion = true;
+ break;
+ default:
+ needsConversion = true;
+ break;
+ }
+
+ if (image.size().isEmpty())
+ return nullptr;
+
+ const bool resized = !m_texture || m_texture->pixelSize() != image.size();
+ if (dirtyRegion.isEmpty() && !resized)
+ return m_texture.get();
+
+ if (needsConversion)
+ image = image.convertToFormat(QImage::Format_RGBA8888);
+ else
+ image.detach(); // if it was just wrapping data, that's no good, we need ownership, so detach
+
+ if (resized) {
+ if (!m_texture)
+ m_texture.reset(rhi->newTexture(QRhiTexture::RGBA8, image.size()));
+ else
+ m_texture->setPixelSize(image.size());
+ m_texture->create();
+ resourceUpdates->uploadTexture(m_texture.get(), image);
+ } else {
+ QRect imageRect = image.rect();
+ QRect rect = dirtyRegion.boundingRect() & imageRect;
+ QRhiTextureSubresourceUploadDescription subresDesc(image);
+ subresDesc.setSourceTopLeft(rect.topLeft());
+ subresDesc.setSourceSize(rect.size());
+ subresDesc.setDestinationTopLeft(rect.topLeft());
+ QRhiTextureUploadDescription uploadDesc(QRhiTextureUploadEntry(0, 0, subresDesc));
+ resourceUpdates->uploadTexture(m_texture.get(), uploadDesc);
+ }
+
+ return m_texture.get();
+}
+
+static inline QRect scaledRect(const QRect &rect, qreal factor)
+{
+ return QRect(rect.topLeft() * factor, rect.size() * factor);
+}
+
+static inline QPoint scaledOffset(const QPoint &pt, qreal factor)
+{
+ return pt * factor;
+}
+
+static QRegion scaledRegion(const QRegion &region, qreal factor, const QPoint &offset)
+{
+ if (offset.isNull() && factor <= 1)
+ return region;
+
+ QVarLengthArray<QRect, 4> rects;
+ rects.reserve(region.rectCount());
+ for (const QRect &rect : region)
+ rects.append(scaledRect(rect.translated(offset), factor));
+
+ QRegion deviceRegion;
+ deviceRegion.setRects(rects.constData(), rects.size());
+ return deviceRegion;
+}
+
+static QMatrix4x4 targetTransform(const QRectF &target, const QRect &viewport, bool invertY)
+{
+ qreal x_scale = target.width() / viewport.width();
+ qreal y_scale = target.height() / viewport.height();
+
+ const QPointF relative_to_viewport = target.topLeft() - viewport.topLeft();
+ qreal x_translate = x_scale - 1 + ((relative_to_viewport.x() / viewport.width()) * 2);
+ qreal y_translate;
+ if (invertY)
+ y_translate = y_scale - 1 + ((relative_to_viewport.y() / viewport.height()) * 2);
+ else
+ y_translate = -y_scale + 1 - ((relative_to_viewport.y() / viewport.height()) * 2);
+
+ QMatrix4x4 matrix;
+ matrix(0,3) = x_translate;
+ matrix(1,3) = y_translate;
+
+ matrix(0,0) = x_scale;
+ matrix(1,1) = (invertY ? -1.0 : 1.0) * y_scale;
+
+ return matrix;
+}
+
+enum class SourceTransformOrigin {
+ BottomLeft,
+ TopLeft
+};
+
+static QMatrix3x3 sourceTransform(const QRectF &subTexture,
+ const QSize &textureSize,
+ SourceTransformOrigin origin)
+{
+ qreal x_scale = subTexture.width() / textureSize.width();
+ qreal y_scale = subTexture.height() / textureSize.height();
+
+ const QPointF topLeft = subTexture.topLeft();
+ qreal x_translate = topLeft.x() / textureSize.width();
+ qreal y_translate = topLeft.y() / textureSize.height();
+
+ if (origin == SourceTransformOrigin::TopLeft) {
+ y_scale = -y_scale;
+ y_translate = 1 - y_translate;
+ }
+
+ QMatrix3x3 matrix;
+ matrix(0,2) = x_translate;
+ matrix(1,2) = y_translate;
+
+ matrix(0,0) = x_scale;
+ matrix(1,1) = y_scale;
+
+ return matrix;
+}
+
+static inline QRect toBottomLeftRect(const QRect &topLeftRect, int windowHeight)
+{
+ return QRect(topLeftRect.x(), windowHeight - topLeftRect.bottomRight().y() - 1,
+ topLeftRect.width(), topLeftRect.height());
+}
+
+static bool prepareDrawForRenderToTextureWidget(const QPlatformTextureList *textures,
+ int idx,
+ QWindow *window,
+ const QRect &deviceWindowRect,
+ const QPoint &offset,
+ bool invertTargetY,
+ bool invertSource,
+ QMatrix4x4 *target,
+ QMatrix3x3 *source)
+{
+ const QRect clipRect = textures->clipRect(idx);
+ if (clipRect.isEmpty())
+ return false;
+
+ QRect rectInWindow = textures->geometry(idx);
+ // relative to the TLW, not necessarily our window (if the flush is for a native child widget), have to adjust
+ rectInWindow.translate(-offset);
+
+ const QRect clippedRectInWindow = rectInWindow & clipRect.translated(rectInWindow.topLeft());
+ const QRect srcRect = toBottomLeftRect(clipRect, rectInWindow.height());
+
+ *target = targetTransform(scaledRect(clippedRectInWindow, window->devicePixelRatio()),
+ deviceWindowRect,
+ invertTargetY);
+
+ *source = sourceTransform(scaledRect(srcRect, window->devicePixelRatio()),
+ scaledRect(rectInWindow, window->devicePixelRatio()).size(),
+ invertSource ? SourceTransformOrigin::TopLeft : SourceTransformOrigin::BottomLeft);
+
+ return true;
+}
+
+static QShader getShader(const QString &name)
+{
+ QFile f(name);
+ if (f.open(QIODevice::ReadOnly))
+ return QShader::fromSerialized(f.readAll());
+
+ qWarning("QBackingStoreDefaultCompositor: Could not find built-in shader %s "
+ "(is something wrong with QtGui library resources?)",
+ qPrintable(name));
+ return QShader();
+}
+
+static void updateMatrix3x3(QRhiResourceUpdateBatch *resourceUpdates, QRhiBuffer *ubuf, const QMatrix3x3 &m)
+{
+ // mat3 is still 4 floats per column in the uniform buffer (but there is no
+ // 4th column), so 48 bytes altogether, not 36 or 64.
+
+ float f[12];
+ const float *src = static_cast<const float *>(m.constData());
+ float *dst = f;
+ memcpy(dst, src, 3 * sizeof(float));
+ memcpy(dst + 4, src + 3, 3 * sizeof(float));
+ memcpy(dst + 8, src + 6, 3 * sizeof(float));
+
+ resourceUpdates->updateDynamicBuffer(ubuf, 64, 48, f);
+}
+
+enum class PipelineBlend {
+ None,
+ Alpha,
+ PremulAlpha
+};
+
+static QRhiGraphicsPipeline *createGraphicsPipeline(QRhi *rhi,
+ QRhiShaderResourceBindings *srb,
+ QRhiRenderPassDescriptor *rpDesc,
+ PipelineBlend blend)
+{
+ QRhiGraphicsPipeline *ps = rhi->newGraphicsPipeline();
+
+ switch (blend) {
+ case PipelineBlend::Alpha:
+ {
+ QRhiGraphicsPipeline::TargetBlend blend;
+ blend.enable = true;
+ blend.srcColor = QRhiGraphicsPipeline::SrcAlpha;
+ blend.dstColor = QRhiGraphicsPipeline::OneMinusSrcAlpha;
+ blend.srcAlpha = QRhiGraphicsPipeline::One;
+ blend.dstAlpha = QRhiGraphicsPipeline::One;
+ ps->setTargetBlends({ blend });
+ }
+ break;
+ case PipelineBlend::PremulAlpha:
+ {
+ QRhiGraphicsPipeline::TargetBlend blend;
+ blend.enable = true;
+ blend.srcColor = QRhiGraphicsPipeline::One;
+ blend.dstColor = QRhiGraphicsPipeline::OneMinusSrcAlpha;
+ blend.srcAlpha = QRhiGraphicsPipeline::One;
+ blend.dstAlpha = QRhiGraphicsPipeline::One;
+ ps->setTargetBlends({ blend });
+ }
+ break;
+ default:
+ break;
+ }
+
+ ps->setShaderStages({
+ { QRhiShaderStage::Vertex, getShader(":/qt-project.org/gui/painting/shaders/backingstorecompose.vert.qsb"_L1) },
+ { QRhiShaderStage::Fragment, getShader(":/qt-project.org/gui/painting/shaders/backingstorecompose.frag.qsb"_L1) }
+ });
+ QRhiVertexInputLayout inputLayout;
+ inputLayout.setBindings({ { 5 * sizeof(float) } });
+ inputLayout.setAttributes({
+ { 0, 0, QRhiVertexInputAttribute::Float3, 0 },
+ { 0, 1, QRhiVertexInputAttribute::Float2, quint32(3 * sizeof(float)) }
+ });
+ ps->setVertexInputLayout(inputLayout);
+ ps->setShaderResourceBindings(srb);
+ ps->setRenderPassDescriptor(rpDesc);
+
+ if (!ps->create()) {
+ qWarning("QBackingStoreDefaultCompositor: Failed to build graphics pipeline");
+ delete ps;
+ return nullptr;
+ }
+ return ps;
+}
+
+static const int UBUF_SIZE = 120;
+
+QBackingStoreDefaultCompositor::PerQuadData QBackingStoreDefaultCompositor::createPerQuadData(QRhiTexture *texture, QRhiTexture *textureExtra)
+{
+ PerQuadData d;
+
+ d.ubuf = m_rhi->newBuffer(QRhiBuffer::Dynamic, QRhiBuffer::UniformBuffer, UBUF_SIZE);
+ if (!d.ubuf->create())
+ qWarning("QBackingStoreDefaultCompositor: Failed to create uniform buffer");
+
+ d.srb = m_rhi->newShaderResourceBindings();
+ d.srb->setBindings({
+ QRhiShaderResourceBinding::uniformBuffer(0, QRhiShaderResourceBinding::VertexStage | QRhiShaderResourceBinding::FragmentStage, d.ubuf, 0, UBUF_SIZE),
+ QRhiShaderResourceBinding::sampledTexture(1, QRhiShaderResourceBinding::FragmentStage, texture, m_samplerNearest.get())
+ });
+ if (!d.srb->create())
+ qWarning("QBackingStoreDefaultCompositor: Failed to create srb");
+ d.lastUsedTexture = texture;
+
+ if (textureExtra) {
+ d.srbExtra = m_rhi->newShaderResourceBindings();
+ d.srbExtra->setBindings({
+ QRhiShaderResourceBinding::uniformBuffer(0, QRhiShaderResourceBinding::VertexStage | QRhiShaderResourceBinding::FragmentStage, d.ubuf, 0, UBUF_SIZE),
+ QRhiShaderResourceBinding::sampledTexture(1, QRhiShaderResourceBinding::FragmentStage, textureExtra, m_samplerNearest.get())
+ });
+ if (!d.srbExtra->create())
+ qWarning("QBackingStoreDefaultCompositor: Failed to create srb");
+ }
+
+ d.lastUsedTextureExtra = textureExtra;
+
+ return d;
+}
+
+void QBackingStoreDefaultCompositor::updatePerQuadData(PerQuadData *d, QRhiTexture *texture, QRhiTexture *textureExtra,
+ UpdateQuadDataOptions options)
+{
+ // This whole check-if-texture-ptr-is-different is needed because there is
+ // nothing saying a QPlatformTextureList cannot return a different
+ // QRhiTexture* from the same index in a subsequent flush.
+
+ const QRhiSampler::Filter filter = options.testFlag(NeedsLinearFiltering) ? QRhiSampler::Linear : QRhiSampler::Nearest;
+ if ((d->lastUsedTexture == texture && d->lastUsedFilter == filter) || !d->srb)
+ return;
+
+ QRhiSampler *sampler = filter == QRhiSampler::Linear ? m_samplerLinear.get() : m_samplerNearest.get();
+ d->srb->setBindings({
+ QRhiShaderResourceBinding::uniformBuffer(0, QRhiShaderResourceBinding::VertexStage | QRhiShaderResourceBinding::FragmentStage, d->ubuf, 0, UBUF_SIZE),
+ QRhiShaderResourceBinding::sampledTexture(1, QRhiShaderResourceBinding::FragmentStage, texture, sampler)
+ });
+
+ d->srb->updateResources(QRhiShaderResourceBindings::BindingsAreSorted);
+ d->lastUsedTexture = texture;
+ d->lastUsedFilter = filter;
+
+ if (textureExtra) {
+ d->srbExtra->setBindings({
+ QRhiShaderResourceBinding::uniformBuffer(0, QRhiShaderResourceBinding::VertexStage | QRhiShaderResourceBinding::FragmentStage, d->ubuf, 0, UBUF_SIZE),
+ QRhiShaderResourceBinding::sampledTexture(1, QRhiShaderResourceBinding::FragmentStage, textureExtra, sampler)
+ });
+
+ d->srbExtra->updateResources(QRhiShaderResourceBindings::BindingsAreSorted);
+ d->lastUsedTextureExtra = textureExtra;
+ }
+}
+
+void QBackingStoreDefaultCompositor::updateUniforms(PerQuadData *d, QRhiResourceUpdateBatch *resourceUpdates,
+ const QMatrix4x4 &target, const QMatrix3x3 &source,
+ UpdateUniformOptions options)
+{
+ resourceUpdates->updateDynamicBuffer(d->ubuf, 0, 64, target.constData());
+ updateMatrix3x3(resourceUpdates, d->ubuf, source);
+ float opacity = 1.0f;
+ resourceUpdates->updateDynamicBuffer(d->ubuf, 112, 4, &opacity);
+ qint32 textureSwizzle = options;
+ resourceUpdates->updateDynamicBuffer(d->ubuf, 116, 4, &textureSwizzle);
+}
+
+void QBackingStoreDefaultCompositor::ensureResources(QRhiResourceUpdateBatch *resourceUpdates, QRhiRenderPassDescriptor *rpDesc)
+{
+ static const float vertexData[] = {
+ -1, -1, 0, 0, 0,
+ -1, 1, 0, 0, 1,
+ 1, -1, 0, 1, 0,
+ -1, 1, 0, 0, 1,
+ 1, -1, 0, 1, 0,
+ 1, 1, 0, 1, 1
+ };
+
+ if (!m_vbuf) {
+ m_vbuf.reset(m_rhi->newBuffer(QRhiBuffer::Immutable, QRhiBuffer::VertexBuffer, sizeof(vertexData)));
+ if (m_vbuf->create())
+ resourceUpdates->uploadStaticBuffer(m_vbuf.get(), vertexData);
+ else
+ qWarning("QBackingStoreDefaultCompositor: Failed to create vertex buffer");
+ }
+
+ if (!m_samplerNearest) {
+ m_samplerNearest.reset(m_rhi->newSampler(QRhiSampler::Nearest, QRhiSampler::Nearest, QRhiSampler::None,
+ QRhiSampler::ClampToEdge, QRhiSampler::ClampToEdge));
+ if (!m_samplerNearest->create())
+ qWarning("QBackingStoreDefaultCompositor: Failed to create sampler (Nearest filtering)");
+ }
+
+ if (!m_samplerLinear) {
+ m_samplerLinear.reset(m_rhi->newSampler(QRhiSampler::Linear, QRhiSampler::Linear, QRhiSampler::None,
+ QRhiSampler::ClampToEdge, QRhiSampler::ClampToEdge));
+ if (!m_samplerLinear->create())
+ qWarning("QBackingStoreDefaultCompositor: Failed to create sampler (Linear filtering)");
+ }
+
+ if (!m_widgetQuadData.isValid())
+ m_widgetQuadData = createPerQuadData(m_texture.get());
+
+ QRhiShaderResourceBindings *srb = m_widgetQuadData.srb; // just for the layout
+ if (!m_psNoBlend)
+ m_psNoBlend.reset(createGraphicsPipeline(m_rhi, srb, rpDesc, PipelineBlend::None));
+ if (!m_psBlend)
+ m_psBlend.reset(createGraphicsPipeline(m_rhi, srb, rpDesc, PipelineBlend::Alpha));
+ if (!m_psPremulBlend)
+ m_psPremulBlend.reset(createGraphicsPipeline(m_rhi, srb, rpDesc, PipelineBlend::PremulAlpha));
+}
+
+QPlatformBackingStore::FlushResult QBackingStoreDefaultCompositor::flush(QPlatformBackingStore *backingStore,
+ QRhi *rhi,
+ QRhiSwapChain *swapchain,
+ QWindow *window,
+ qreal sourceDevicePixelRatio,
+ const QRegion &region,
+ const QPoint &offset,
+ QPlatformTextureList *textures,
+ bool translucentBackground)
+{
+ if (!rhi)
+ return QPlatformBackingStore::FlushFailed;
+
+ Q_ASSERT(textures); // may be empty if there are no render-to-texture widgets at all, but null it cannot be
+
+ if (!m_rhi) {
+ m_rhi = rhi;
+ } else if (m_rhi != rhi) {
+ qWarning("QBackingStoreDefaultCompositor: the QRhi has changed unexpectedly, this should not happen");
+ return QPlatformBackingStore::FlushFailed;
+ }
+
+ if (!qt_window_private(window)->receivedExpose)
+ return QPlatformBackingStore::FlushSuccess;
+
+ qCDebug(lcQpaBackingStore) << "Composing and flushing" << region << "of" << window
+ << "at offset" << offset << "with" << textures->count() << "texture(s) in" << textures
+ << "via swapchain" << swapchain;
+
+ QWindowPrivate::get(window)->lastComposeTime.start();
+
+ if (swapchain->currentPixelSize() != swapchain->surfacePixelSize())
+ swapchain->createOrResize();
+
+ // Start recording a new frame.
+ QRhi::FrameOpResult frameResult = rhi->beginFrame(swapchain);
+ if (frameResult == QRhi::FrameOpSwapChainOutOfDate) {
+ if (!swapchain->createOrResize())
+ return QPlatformBackingStore::FlushFailed;
+ frameResult = rhi->beginFrame(swapchain);
+ }
+ if (frameResult == QRhi::FrameOpDeviceLost)
+ return QPlatformBackingStore::FlushFailedDueToLostDevice;
+ if (frameResult != QRhi::FrameOpSuccess)
+ return QPlatformBackingStore::FlushFailed;
+
+ // Prepare resource updates.
+ QRhiResourceUpdateBatch *resourceUpdates = rhi->nextResourceUpdateBatch();
+ QPlatformBackingStore::TextureFlags flags;
+
+ bool gotTextureFromGraphicsBuffer = false;
+ if (QPlatformGraphicsBuffer *graphicsBuffer = backingStore->graphicsBuffer()) {
+ if (graphicsBuffer->lock(QPlatformGraphicsBuffer::SWReadAccess)) {
+ const QImage::Format format = QImage::toImageFormat(graphicsBuffer->format());
+ const QSize size = graphicsBuffer->size();
+ QImage wrapperImage(graphicsBuffer->data(), size.width(), size.height(), graphicsBuffer->bytesPerLine(), format);
+ toTexture(wrapperImage, rhi, resourceUpdates, scaledRegion(region, sourceDevicePixelRatio, offset), &flags);
+ gotTextureFromGraphicsBuffer = true;
+ graphicsBuffer->unlock();
+ if (graphicsBuffer->origin() == QPlatformGraphicsBuffer::OriginBottomLeft)
+ flags |= QPlatformBackingStore::TextureFlip;
+ }
+ }
+ if (!gotTextureFromGraphicsBuffer)
+ toTexture(backingStore, rhi, resourceUpdates, scaledRegion(region, sourceDevicePixelRatio, offset), &flags);
+
+ ensureResources(resourceUpdates, swapchain->renderPassDescriptor());
+
+ UpdateUniformOptions uniformOptions;
+#if Q_BYTE_ORDER == Q_LITTLE_ENDIAN
+ if (flags & QPlatformBackingStore::TextureSwizzle)
+ uniformOptions |= NeedsRedBlueSwap;
+#else
+ if (flags & QPlatformBackingStore::TextureSwizzle)
+ uniformOptions |= NeedsAlphaRotate;
+#endif
+ const bool premultiplied = (flags & QPlatformBackingStore::TexturePremultiplied) != 0;
+ SourceTransformOrigin origin = SourceTransformOrigin::TopLeft;
+ if (flags & QPlatformBackingStore::TextureFlip)
+ origin = SourceTransformOrigin::BottomLeft;
+
+ const qreal dpr = window->devicePixelRatio();
+ const QRect deviceWindowRect = scaledRect(QRect(QPoint(), window->size()), dpr);
+ const QRect sourceWindowRect = scaledRect(QRect(QPoint(), window->size()), sourceDevicePixelRatio);
+ // If sourceWindowRect is larger than deviceWindowRect, we are doing high
+ // DPI downscaling. In that case Linear filtering is a must, whereas for the
+ // 1:1 case Nearest must be used for Qt 5 visual compatibility.
+ const bool needsLinearSampler = sourceWindowRect.width() > deviceWindowRect.width()
+ && sourceWindowRect.height() > deviceWindowRect.height();
+
+ const bool invertTargetY = !rhi->isYUpInNDC();
+ const bool invertSource = !rhi->isYUpInFramebuffer();
+
+ if (m_texture) {
+ // The backingstore is for the entire tlw. In case of native children, offset tells the position
+ // relative to the tlw. The window rect is scaled by the source device pixel ratio to get
+ // the source rect.
+ const QPoint sourceWindowOffset = scaledOffset(offset, sourceDevicePixelRatio);
+ const QRect srcRect = toBottomLeftRect(sourceWindowRect.translated(sourceWindowOffset), m_texture->pixelSize().height());
+ const QMatrix3x3 source = sourceTransform(srcRect, m_texture->pixelSize(), origin);
+ QMatrix4x4 target; // identity
+ if (invertTargetY)
+ target.data()[5] = -1.0f;
+ updateUniforms(&m_widgetQuadData, resourceUpdates, target, source, uniformOptions);
+ if (needsLinearSampler)
+ updatePerQuadData(&m_widgetQuadData, m_texture.get(), nullptr, NeedsLinearFiltering);
+ }
+
+ const int textureWidgetCount = textures->count();
+ const int oldTextureQuadDataCount = m_textureQuadData.size();
+ if (oldTextureQuadDataCount != textureWidgetCount) {
+ for (int i = textureWidgetCount; i < oldTextureQuadDataCount; ++i)
+ m_textureQuadData[i].reset();
+ m_textureQuadData.resize(textureWidgetCount);
+ }
+
+ for (int i = 0; i < textureWidgetCount; ++i) {
+ const bool invertSourceForTextureWidget = textures->flags(i).testFlag(QPlatformTextureList::MirrorVertically)
+ ? !invertSource : invertSource;
+ QMatrix4x4 target;
+ QMatrix3x3 source;
+ if (!prepareDrawForRenderToTextureWidget(textures, i, window, deviceWindowRect,
+ offset, invertTargetY, invertSourceForTextureWidget,
+ &target, &source))
+ {
+ m_textureQuadData[i].reset();
+ continue;
+ }
+ QRhiTexture *t = textures->texture(i);
+ QRhiTexture *tExtra = textures->textureExtra(i);
+ if (t) {
+ if (!m_textureQuadData[i].isValid())
+ m_textureQuadData[i] = createPerQuadData(t, tExtra);
+ else
+ updatePerQuadData(&m_textureQuadData[i], t, tExtra);
+ updateUniforms(&m_textureQuadData[i], resourceUpdates, target, source);
+ if (needsLinearSampler)
+ updatePerQuadData(&m_textureQuadData[i], t, tExtra, NeedsLinearFiltering);
+ } else {
+ m_textureQuadData[i].reset();
+ }
+ }
+
+ // Record the render pass (with committing the resource updates).
+ QRhiCommandBuffer *cb = swapchain->currentFrameCommandBuffer();
+ const QSize outputSizeInPixels = swapchain->currentPixelSize();
+ QColor clearColor = translucentBackground ? Qt::transparent : Qt::black;
+
+ cb->resourceUpdate(resourceUpdates);
+
+ auto render = [&](std::optional<QRhiSwapChain::StereoTargetBuffer> buffer = std::nullopt) {
+ QRhiRenderTarget* target = nullptr;
+ if (buffer.has_value())
+ target = swapchain->currentFrameRenderTarget(buffer.value());
+ else
+ target = swapchain->currentFrameRenderTarget();
+
+ cb->beginPass(target, clearColor, { 1.0f, 0 });
+
+ cb->setGraphicsPipeline(m_psNoBlend.get());
+ cb->setViewport({ 0, 0, float(outputSizeInPixels.width()), float(outputSizeInPixels.height()) });
+ QRhiCommandBuffer::VertexInput vbufBinding(m_vbuf.get(), 0);
+ cb->setVertexInput(0, 1, &vbufBinding);
+
+ // Textures for renderToTexture widgets.
+ for (int i = 0; i < textureWidgetCount; ++i) {
+ if (!textures->flags(i).testFlag(QPlatformTextureList::StacksOnTop)) {
+ if (m_textureQuadData[i].isValid()) {
+
+ QRhiShaderResourceBindings* srb = m_textureQuadData[i].srb;
+ if (buffer == QRhiSwapChain::RightBuffer && m_textureQuadData[i].srbExtra)
+ srb = m_textureQuadData[i].srbExtra;
+
+ cb->setShaderResources(srb);
+ cb->draw(6);
+ }
+ }
+ }
+
+ cb->setGraphicsPipeline(premultiplied ? m_psPremulBlend.get() : m_psBlend.get());
+
+ // Backingstore texture with the normal widgets.
+ if (m_texture) {
+ cb->setShaderResources(m_widgetQuadData.srb);
+ cb->draw(6);
+ }
+
+ // Textures for renderToTexture widgets that have WA_AlwaysStackOnTop set.
+ for (int i = 0; i < textureWidgetCount; ++i) {
+ const QPlatformTextureList::Flags flags = textures->flags(i);
+ if (flags.testFlag(QPlatformTextureList::StacksOnTop)) {
+ if (m_textureQuadData[i].isValid()) {
+ if (flags.testFlag(QPlatformTextureList::NeedsPremultipliedAlphaBlending))
+ cb->setGraphicsPipeline(m_psPremulBlend.get());
+ else
+ cb->setGraphicsPipeline(m_psBlend.get());
+
+ QRhiShaderResourceBindings* srb = m_textureQuadData[i].srb;
+ if (buffer == QRhiSwapChain::RightBuffer && m_textureQuadData[i].srbExtra)
+ srb = m_textureQuadData[i].srbExtra;
+
+ cb->setShaderResources(srb);
+ cb->draw(6);
+ }
+ }
+ }
+
+ cb->endPass();
+ };
+
+ if (swapchain->window()->format().stereo()) {
+ render(QRhiSwapChain::LeftBuffer);
+ render(QRhiSwapChain::RightBuffer);
+ } else
+ render();
+
+ rhi->endFrame(swapchain);
+
+ return QPlatformBackingStore::FlushSuccess;
+}
+
+QT_END_NAMESPACE
diff --git a/src/gui/painting/qbackingstoredefaultcompositor_p.h b/src/gui/painting/qbackingstoredefaultcompositor_p.h
new file mode 100644
index 0000000000..c5a8ffd328
--- /dev/null
+++ b/src/gui/painting/qbackingstoredefaultcompositor_p.h
@@ -0,0 +1,110 @@
+// Copyright (C) 2021 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
+
+#ifndef QBACKINGSTOREDEFAULTCOMPOSITOR_P_H
+#define QBACKINGSTOREDEFAULTCOMPOSITOR_P_H
+
+//
+// W A R N I N G
+// -------------
+//
+// This file is not part of the Qt API. It exists purely as an
+// implementation detail. This header file may change from version to
+// version without notice, or even be removed.
+//
+// We mean it.
+//
+
+#include <qpa/qplatformbackingstore.h>
+#include <rhi/qrhi.h>
+
+QT_BEGIN_NAMESPACE
+
+class QBackingStoreDefaultCompositor
+{
+public:
+ ~QBackingStoreDefaultCompositor();
+
+ void reset();
+
+ QRhiTexture *toTexture(const QPlatformBackingStore *backingStore,
+ QRhi *rhi,
+ QRhiResourceUpdateBatch *resourceUpdates,
+ const QRegion &dirtyRegion,
+ QPlatformBackingStore::TextureFlags *flags) const;
+
+ QPlatformBackingStore::FlushResult flush(QPlatformBackingStore *backingStore,
+ QRhi *rhi,
+ QRhiSwapChain *swapchain,
+ QWindow *window,
+ qreal sourceDevicePixelRatio,
+ const QRegion &region,
+ const QPoint &offset,
+ QPlatformTextureList *textures,
+ bool translucentBackground);
+
+private:
+ enum UpdateUniformOption {
+ NeedsRedBlueSwap = 1 << 0,
+ NeedsAlphaRotate = 1 << 1
+ };
+ Q_DECLARE_FLAGS(UpdateUniformOptions, UpdateUniformOption)
+ enum UpdateQuadDataOption {
+ NeedsLinearFiltering = 1 << 0
+ };
+ Q_DECLARE_FLAGS(UpdateQuadDataOptions, UpdateQuadDataOption)
+
+ void ensureResources(QRhiResourceUpdateBatch *resourceUpdates, QRhiRenderPassDescriptor *rpDesc);
+ QRhiTexture *toTexture(const QImage &image,
+ QRhi *rhi,
+ QRhiResourceUpdateBatch *resourceUpdates,
+ const QRegion &dirtyRegion,
+ QPlatformBackingStore::TextureFlags *flags) const;
+
+ mutable QRhi *m_rhi = nullptr;
+ mutable std::unique_ptr<QRhiTexture> m_texture;
+
+ std::unique_ptr<QRhiBuffer> m_vbuf;
+ std::unique_ptr<QRhiSampler> m_samplerNearest;
+ std::unique_ptr<QRhiSampler> m_samplerLinear;
+ std::unique_ptr<QRhiGraphicsPipeline> m_psNoBlend;
+ std::unique_ptr<QRhiGraphicsPipeline> m_psBlend;
+ std::unique_ptr<QRhiGraphicsPipeline> m_psPremulBlend;
+
+ struct PerQuadData {
+ QRhiBuffer *ubuf = nullptr;
+ // All srbs are layout-compatible.
+ QRhiShaderResourceBindings *srb = nullptr;
+ QRhiShaderResourceBindings *srbExtra = nullptr; // may be null (used for stereo)
+ QRhiTexture *lastUsedTexture = nullptr;
+ QRhiTexture *lastUsedTextureExtra = nullptr; // may be null (used for stereo)
+ QRhiSampler::Filter lastUsedFilter = QRhiSampler::None;
+ bool isValid() const { return ubuf && srb; }
+ void reset() {
+ delete ubuf;
+ ubuf = nullptr;
+ delete srb;
+ srb = nullptr;
+ if (srbExtra) {
+ delete srbExtra;
+ srbExtra = nullptr;
+ }
+ lastUsedTexture = nullptr;
+ lastUsedTextureExtra = nullptr;
+ lastUsedFilter = QRhiSampler::None;
+ }
+ };
+ PerQuadData m_widgetQuadData;
+ QVarLengthArray<PerQuadData, 8> m_textureQuadData;
+
+ PerQuadData createPerQuadData(QRhiTexture *texture, QRhiTexture *textureExtra = nullptr);
+ void updatePerQuadData(PerQuadData *d, QRhiTexture *texture, QRhiTexture *textureExtra = nullptr,
+ UpdateQuadDataOptions options = {});
+ void updateUniforms(PerQuadData *d, QRhiResourceUpdateBatch *resourceUpdates,
+ const QMatrix4x4 &target, const QMatrix3x3 &source,
+ UpdateUniformOptions options = {});
+};
+
+QT_END_NAMESPACE
+
+#endif // QBACKINGSTOREDEFAULTCOMPOSITOR_P_H
diff --git a/src/gui/painting/qbackingstorerhisupport.cpp b/src/gui/painting/qbackingstorerhisupport.cpp
new file mode 100644
index 0000000000..fe5589dc2d
--- /dev/null
+++ b/src/gui/painting/qbackingstorerhisupport.cpp
@@ -0,0 +1,327 @@
+// Copyright (C) 2021 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
+
+#include "qbackingstorerhisupport_p.h"
+#include <qpa/qplatformintegration.h>
+#include <private/qguiapplication_p.h>
+
+#if QT_CONFIG(opengl)
+#include <QtGui/qoffscreensurface.h>
+#include <QtGui/private/qopenglcontext_p.h>
+#endif
+
+#if QT_CONFIG(vulkan)
+#include <QtGui/private/qvulkandefaultinstance_p.h>
+#endif
+
+QT_BEGIN_NAMESPACE
+
+Q_DECLARE_LOGGING_CATEGORY(lcQpaBackingStore)
+
+QBackingStoreRhiSupport::~QBackingStoreRhiSupport()
+{
+ reset();
+}
+
+void QBackingStoreRhiSupport::SwapchainData::reset()
+{
+ delete swapchain;
+ delete renderPassDescriptor;
+ delete windowWatcher;
+ *this = {};
+}
+
+void QBackingStoreRhiSupport::reset()
+{
+ for (SwapchainData &d : m_swapchains)
+ d.reset();
+
+ m_swapchains.clear();
+
+ delete m_rhi;
+ m_rhi = nullptr;
+
+ delete m_openGLFallbackSurface;
+ m_openGLFallbackSurface = nullptr;
+}
+
+bool QBackingStoreRhiSupport::create()
+{
+ if (!QGuiApplicationPrivate::platformIntegration()->hasCapability(QPlatformIntegration::RhiBasedRendering))
+ return false;
+
+ // note: m_window may be null (special case for fully offscreen rendering)
+
+ QRhi *rhi = nullptr;
+ QOffscreenSurface *surface = nullptr;
+ QRhi::Flags flags;
+
+ // These must be the same env.vars Qt Quick uses (as documented), in order
+ // to ensure symmetry in the behavior between a QQuickWindow and a
+ // (QRhi-based) widget top-level window.
+ if (qEnvironmentVariableIntValue("QSG_RHI_PREFER_SOFTWARE_RENDERER"))
+ flags |= QRhi::PreferSoftwareRenderer;
+ if (qEnvironmentVariableIntValue("QSG_RHI_PROFILE"))
+ flags |= QRhi::EnableDebugMarkers | QRhi::EnableTimestamps;
+
+ if (m_config.api() == QPlatformBackingStoreRhiConfig::Null) {
+ QRhiNullInitParams params;
+ rhi = QRhi::create(QRhi::Null, &params, flags);
+ }
+
+#if QT_CONFIG(opengl)
+ if (!rhi && m_config.api() == QPlatformBackingStoreRhiConfig::OpenGL) {
+ surface = QRhiGles2InitParams::newFallbackSurface(m_format);
+ QRhiGles2InitParams params;
+ params.fallbackSurface = surface;
+ params.window = m_window;
+ params.format = m_format;
+ params.shareContext = qt_gl_global_share_context();
+ rhi = QRhi::create(QRhi::OpenGLES2, &params, flags);
+ }
+#endif
+
+#ifdef Q_OS_WIN
+ if (!rhi) {
+ if (m_config.api() == QPlatformBackingStoreRhiConfig::D3D11) {
+ QRhiD3D11InitParams params;
+ params.enableDebugLayer = m_config.isDebugLayerEnabled();
+ rhi = QRhi::create(QRhi::D3D11, &params, flags);
+ if (!rhi && !flags.testFlag(QRhi::PreferSoftwareRenderer)) {
+ qCDebug(lcQpaBackingStore, "Failed to create a D3D11 device with default settings; "
+ "attempting to get a software rasterizer backed device instead");
+ flags |= QRhi::PreferSoftwareRenderer;
+ rhi = QRhi::create(QRhi::D3D11, &params, flags);
+ }
+ } else if (m_config.api() == QPlatformBackingStoreRhiConfig::D3D12) {
+ QRhiD3D12InitParams params;
+ params.enableDebugLayer = m_config.isDebugLayerEnabled();
+ rhi = QRhi::create(QRhi::D3D12, &params, flags);
+ if (!rhi && !flags.testFlag(QRhi::PreferSoftwareRenderer)) {
+ qCDebug(lcQpaBackingStore, "Failed to create a D3D12 device with default settings; "
+ "attempting to get a software rasterizer backed device instead");
+ flags |= QRhi::PreferSoftwareRenderer;
+ rhi = QRhi::create(QRhi::D3D12, &params, flags);
+ }
+ }
+ }
+#endif
+
+#if QT_CONFIG(metal)
+ if (!rhi && m_config.api() == QPlatformBackingStoreRhiConfig::Metal) {
+ QRhiMetalInitParams params;
+ // For parity with Qt Quick, fall back to OpenGL when there is no Metal (f.ex. in macOS virtual machines).
+ if (QRhi::probe(QRhi::Metal, &params)) {
+ rhi = QRhi::create(QRhi::Metal, &params, flags);
+ } else {
+ qCDebug(lcQpaBackingStore, "Metal does not seem to be supported. Falling back to OpenGL.");
+ rhi = QRhi::create(QRhi::OpenGLES2, &params, flags);
+ }
+ }
+#endif
+
+#if QT_CONFIG(vulkan)
+ if (!rhi && m_config.api() == QPlatformBackingStoreRhiConfig::Vulkan) {
+ if (m_config.isDebugLayerEnabled())
+ QVulkanDefaultInstance::setFlag(QVulkanDefaultInstance::EnableValidation);
+ QRhiVulkanInitParams params;
+ if (m_window) {
+ if (!m_window->vulkanInstance())
+ m_window->setVulkanInstance(QVulkanDefaultInstance::instance());
+ params.inst = m_window->vulkanInstance();
+ } else {
+ params.inst = QVulkanDefaultInstance::instance();
+ }
+ if (!params.inst) {
+ qWarning("No QVulkanInstance set for the top-level window, this is wrong.");
+ return false;
+ }
+ params.window = m_window;
+ rhi = QRhi::create(QRhi::Vulkan, &params, flags);
+ }
+#endif
+
+ if (!rhi) {
+ qWarning("Failed to create QRhi for QBackingStoreRhiSupport");
+ delete surface;
+ return false;
+ }
+
+ m_rhi = rhi;
+ m_openGLFallbackSurface = surface;
+ return true;
+}
+
+QRhiSwapChain *QBackingStoreRhiSupport::swapChainForWindow(QWindow *window)
+{
+ auto it = m_swapchains.constFind(window);
+ if (it != m_swapchains.constEnd())
+ return it.value().swapchain;
+
+ QRhiSwapChain *swapchain = nullptr;
+ QRhiRenderPassDescriptor *rp = nullptr;
+ if (window && m_rhi) {
+ QRhiSwapChain::Flags flags;
+ const QSurfaceFormat format = window->requestedFormat();
+ if (format.swapInterval() == 0)
+ flags |= QRhiSwapChain::NoVSync;
+ if (format.alphaBufferSize() > 0)
+ flags |= QRhiSwapChain::SurfaceHasNonPreMulAlpha;
+#if QT_CONFIG(vulkan)
+ if (m_config.api() == QPlatformBackingStoreRhiConfig::Vulkan && !window->vulkanInstance())
+ window->setVulkanInstance(QVulkanDefaultInstance::instance());
+#endif
+ qCDebug(lcQpaBackingStore) << "Creating swapchain for window" << window;
+ swapchain = m_rhi->newSwapChain();
+ swapchain->setWindow(window);
+ swapchain->setFlags(flags);
+ rp = swapchain->newCompatibleRenderPassDescriptor();
+ swapchain->setRenderPassDescriptor(rp);
+ if (!swapchain->createOrResize()) {
+ qWarning("Failed to create swapchain for window flushed with an RHI-enabled backingstore");
+ delete rp;
+ return nullptr;
+ }
+ }
+ if (swapchain) {
+ SwapchainData d;
+ d.swapchain = swapchain;
+ d.renderPassDescriptor = rp;
+ d.windowWatcher = new QBackingStoreRhiSupportWindowWatcher(this);
+ m_swapchains.insert(window, d);
+ window->installEventFilter(d.windowWatcher);
+ }
+ return swapchain;
+}
+
+bool QBackingStoreRhiSupportWindowWatcher::eventFilter(QObject *obj, QEvent *event)
+{
+ if (event->type() == QEvent::WindowAboutToChangeInternal
+ || (event->type() == QEvent::PlatformSurface
+ && static_cast<QPlatformSurfaceEvent *>(event)->surfaceEventType() == QPlatformSurfaceEvent::SurfaceAboutToBeDestroyed))
+ {
+ QWindow *window = qobject_cast<QWindow *>(obj);
+ auto it = m_rhiSupport->m_swapchains.find(window);
+ if (it != m_rhiSupport->m_swapchains.end()) {
+ qCDebug(lcQpaBackingStore) << event << "received for" << window << "- cleaning up swapchain";
+ auto data = *it;
+ m_rhiSupport->m_swapchains.erase(it);
+ data.reset(); // deletes 'this'
+ }
+ }
+ return false;
+}
+
+QSurface::SurfaceType QBackingStoreRhiSupport::surfaceTypeForConfig(const QPlatformBackingStoreRhiConfig &config)
+{
+ QSurface::SurfaceType type = QSurface::RasterSurface;
+ switch (config.api()) {
+ case QPlatformBackingStoreRhiConfig::D3D11:
+ case QPlatformBackingStoreRhiConfig::D3D12:
+ type = QSurface::Direct3DSurface;
+ break;
+ case QPlatformBackingStoreRhiConfig::Vulkan:
+ type = QSurface::VulkanSurface;
+ break;
+ case QPlatformBackingStoreRhiConfig::Metal:
+ type = QSurface::MetalSurface;
+ break;
+ case QPlatformBackingStoreRhiConfig::OpenGL:
+ type = QSurface::OpenGLSurface;
+ break;
+ default:
+ break;
+ }
+ return type;
+}
+
+QRhi::Implementation QBackingStoreRhiSupport::apiToRhiBackend(QPlatformBackingStoreRhiConfig::Api api)
+{
+ switch (api) {
+ case QPlatformBackingStoreRhiConfig::OpenGL:
+ return QRhi::OpenGLES2;
+ case QPlatformBackingStoreRhiConfig::Metal:
+ return QRhi::Metal;
+ case QPlatformBackingStoreRhiConfig::Vulkan:
+ return QRhi::Vulkan;
+ case QPlatformBackingStoreRhiConfig::D3D11:
+ return QRhi::D3D11;
+ case QPlatformBackingStoreRhiConfig::D3D12:
+ return QRhi::D3D12;
+ case QPlatformBackingStoreRhiConfig::Null:
+ return QRhi::Null;
+ default:
+ break;
+ }
+ return QRhi::Null;
+}
+
+bool QBackingStoreRhiSupport::checkForceRhi(QPlatformBackingStoreRhiConfig *outConfig, QSurface::SurfaceType *outType)
+{
+ static QPlatformBackingStoreRhiConfig config;
+ static bool checked = false;
+
+ if (!checked) {
+ checked = true;
+
+ const bool alwaysRhi = qEnvironmentVariableIntValue("QT_WIDGETS_RHI");
+ if (alwaysRhi)
+ config.setEnabled(true);
+
+ // if enabled, choose an api
+ if (config.isEnabled()) {
+#if defined(Q_OS_WIN)
+ config.setApi(QPlatformBackingStoreRhiConfig::D3D11);
+#elif QT_CONFIG(metal)
+ config.setApi(QPlatformBackingStoreRhiConfig::Metal);
+#elif QT_CONFIG(opengl)
+ config.setApi(QPlatformBackingStoreRhiConfig::OpenGL);
+#elif QT_CONFIG(vulkan)
+ config.setApi(QPlatformBackingStoreRhiConfig::Vulkan);
+#else
+ qWarning("QT_WIDGETS_RHI is set but no backend is available; ignoring");
+ return false;
+#endif
+
+ // the env.var. will always override
+ if (qEnvironmentVariableIsSet("QT_WIDGETS_RHI_BACKEND")) {
+ const QString backend = qEnvironmentVariable("QT_WIDGETS_RHI_BACKEND");
+#ifdef Q_OS_WIN
+ if (backend == QStringLiteral("d3d11") || backend == QStringLiteral("d3d"))
+ config.setApi(QPlatformBackingStoreRhiConfig::D3D11);
+ if (backend == QStringLiteral("d3d12"))
+ config.setApi(QPlatformBackingStoreRhiConfig::D3D12);
+#endif
+#if QT_CONFIG(metal)
+ if (backend == QStringLiteral("metal"))
+ config.setApi(QPlatformBackingStoreRhiConfig::Metal);
+#endif
+#if QT_CONFIG(opengl)
+ if (backend == QStringLiteral("opengl") || backend == QStringLiteral("gl"))
+ config.setApi(QPlatformBackingStoreRhiConfig::OpenGL);
+#endif
+#if QT_CONFIG(vulkan)
+ if (backend == QStringLiteral("vulkan"))
+ config.setApi(QPlatformBackingStoreRhiConfig::Vulkan);
+#endif
+ }
+
+ if (qEnvironmentVariableIntValue("QT_WIDGETS_RHI_DEBUG_LAYER"))
+ config.setDebugLayer(true);
+ }
+
+ qCDebug(lcQpaBackingStore) << "Check for forced use of QRhi resulted in enable"
+ << config.isEnabled() << "with api" << QRhi::backendName(apiToRhiBackend(config.api()));
+ }
+
+ if (config.isEnabled()) {
+ if (outConfig)
+ *outConfig = config;
+ if (outType)
+ *outType = surfaceTypeForConfig(config);
+ return true;
+ }
+ return false;
+}
+
+QT_END_NAMESPACE
diff --git a/src/gui/painting/qbackingstorerhisupport_p.h b/src/gui/painting/qbackingstorerhisupport_p.h
new file mode 100644
index 0000000000..39ce36c680
--- /dev/null
+++ b/src/gui/painting/qbackingstorerhisupport_p.h
@@ -0,0 +1,77 @@
+// Copyright (C) 2021 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
+
+#ifndef QBACKINGSTORERHISUPPORT_P_H
+#define QBACKINGSTORERHISUPPORT_P_H
+
+//
+// W A R N I N G
+// -------------
+//
+// This file is not part of the Qt API. It exists purely as an
+// implementation detail. This header file may change from version to
+// version without notice, or even be removed.
+//
+// We mean it.
+//
+
+#include <QtGui/private/qtguiglobal_p.h>
+#include <QtGui/qwindow.h>
+#include <QtGui/qsurfaceformat.h>
+#include <QtGui/qoffscreensurface.h>
+#include <rhi/qrhi.h>
+#include <qpa/qplatformbackingstore.h>
+
+QT_BEGIN_NAMESPACE
+
+class Q_GUI_EXPORT QBackingStoreRhiSupport
+{
+public:
+ ~QBackingStoreRhiSupport();
+
+ void reset();
+
+ void setFormat(const QSurfaceFormat &format) { m_format = format; }
+ void setWindow(QWindow *window) { m_window = window; }
+ void setConfig(const QPlatformBackingStoreRhiConfig &config) { m_config = config; }
+
+ bool create();
+
+ QRhiSwapChain *swapChainForWindow(QWindow *window);
+
+ static QSurface::SurfaceType surfaceTypeForConfig(const QPlatformBackingStoreRhiConfig &config);
+
+ static bool checkForceRhi(QPlatformBackingStoreRhiConfig *outConfig, QSurface::SurfaceType *outType);
+
+ static QRhi::Implementation apiToRhiBackend(QPlatformBackingStoreRhiConfig::Api api);
+
+ QRhi *rhi() const { return m_rhi; }
+
+private:
+ QSurfaceFormat m_format;
+ QWindow *m_window = nullptr;
+ QPlatformBackingStoreRhiConfig m_config;
+ QRhi *m_rhi = nullptr;
+ QOffscreenSurface *m_openGLFallbackSurface = nullptr;
+ struct SwapchainData {
+ QRhiSwapChain *swapchain = nullptr;
+ QRhiRenderPassDescriptor *renderPassDescriptor = nullptr;
+ QObject *windowWatcher = nullptr;
+ void reset();
+ };
+ QHash<QWindow *, SwapchainData> m_swapchains;
+ friend class QBackingStoreRhiSupportWindowWatcher;
+};
+
+class QBackingStoreRhiSupportWindowWatcher : public QObject
+{
+public:
+ QBackingStoreRhiSupportWindowWatcher(QBackingStoreRhiSupport *rhiSupport) : m_rhiSupport(rhiSupport) { }
+ bool eventFilter(QObject *obj, QEvent *ev) override;
+private:
+ QBackingStoreRhiSupport *m_rhiSupport;
+};
+
+QT_END_NAMESPACE
+
+#endif // QBACKINGSTORERHISUPPORT_P_H
diff --git a/src/gui/painting/qbezier.cpp b/src/gui/painting/qbezier.cpp
index 7622262da9..5b2a962661 100644
--- a/src/gui/painting/qbezier.cpp
+++ b/src/gui/painting/qbezier.cpp
@@ -1,49 +1,11 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the QtGui module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#include "qbezier_p.h"
#include <qdebug.h>
#include <qline.h>
-#include <qpolygon.h>
-#include <qvector.h>
-#include <qlist.h>
#include <qmath.h>
+#include <qpolygon.h>
#include <private/qnumeric_p.h>
@@ -219,15 +181,17 @@ static ShiftResult good_offset(const QBezier *b1, const QBezier *b2, qreal offse
const qreal o2 = offset*offset;
const qreal max_dist_line = threshold*offset*offset;
const qreal max_dist_normal = threshold*offset;
- const qreal spacing = qreal(0.25);
- for (qreal i = spacing; i < qreal(0.99); i += spacing) {
- QPointF p1 = b1->pointAt(i);
- QPointF p2 = b2->pointAt(i);
+ const int divisions = 4;
+ const qreal spacing = qreal(1.0) / divisions;
+ qreal t = spacing;
+ for (int i = 1; i < divisions; ++i, t += spacing) {
+ QPointF p1 = b1->pointAt(t);
+ QPointF p2 = b2->pointAt(t);
qreal d = (p1.x() - p2.x())*(p1.x() - p2.x()) + (p1.y() - p2.y())*(p1.y() - p2.y());
if (qAbs(d - o2) > max_dist_line)
return Split;
- QPointF normalPoint = b1->normalVector(i);
+ QPointF normalPoint = b1->normalVector(t);
qreal l = qAbs(normalPoint.x()) + qAbs(normalPoint.y());
if (l != qreal(0.0)) {
d = qAbs( normalPoint.x()*(p1.y() - p2.y()) - normalPoint.y()*(p1.x() - p2.x()) ) / l;
@@ -238,6 +202,8 @@ static ShiftResult good_offset(const QBezier *b1, const QBezier *b2, qreal offse
return Ok;
}
+QT_WARNING_DISABLE_FLOAT_COMPARE
+
static ShiftResult shift(const QBezier *orig, QBezier *shifted, qreal offset, qreal threshold)
{
int map[4];
@@ -285,6 +251,8 @@ static ShiftResult shift(const QBezier *orig, QBezier *shifted, qreal offset, qr
QPointF points_shifted[4];
QLineF prev = QLineF(QPointF(), points[1] - points[0]);
+ if (!prev.length())
+ return Discard;
QPointF prev_normal = prev.normalVector().unitVector().p2();
points_shifted[0] = points[0] + offset * prev_normal;
@@ -471,7 +439,7 @@ void QBezier::addIfClose(qreal *length, qreal error) const
chord = QLineF(QPointF(x1, y1),QPointF(x4, y4)).length();
- if((len-chord) > error) {
+ if ((len-chord) > error) {
const auto halves = split(); /* split in two */
halves.first.addIfClose(length, error); /* try left side */
halves.second.addIfClose(length, error); /* try right side */
diff --git a/src/gui/painting/qbezier_p.h b/src/gui/painting/qbezier_p.h
index 1c49f82416..6c39dd55f9 100644
--- a/src/gui/painting/qbezier_p.h
+++ b/src/gui/painting/qbezier_p.h
@@ -1,41 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the QtGui module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#ifndef QBEZIER_P_H
#define QBEZIER_P_H
@@ -52,12 +16,10 @@
//
#include <QtGui/private/qtguiglobal_p.h>
-#include "QtCore/qpoint.h"
#include "QtCore/qline.h"
-#include "QtCore/qrect.h"
-#include "QtCore/qvector.h"
#include "QtCore/qlist.h"
-#include "QtCore/qpair.h"
+#include "QtCore/qpoint.h"
+#include "QtCore/qrect.h"
#include "QtGui/qtransform.h"
#include <private/qdatabuffer_p.h>
diff --git a/src/gui/painting/qblendfunctions.cpp b/src/gui/painting/qblendfunctions.cpp
index 348eceb47f..fa9f89262c 100644
--- a/src/gui/painting/qblendfunctions.cpp
+++ b/src/gui/painting/qblendfunctions.cpp
@@ -1,41 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the QtGui module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#include <qmath.h>
#include "qblendfunctions_p.h"
@@ -96,7 +60,7 @@ struct Blend_ARGB32_on_RGB16_SourceAlpha {
const quint8 alpha = qAlpha(src);
if (alpha) {
quint16 s = qConvertRgb32To16(src);
- if(alpha < 255)
+ if (alpha < 255)
s += BYTE_MUL_RGB16(*dst, 255 - alpha);
*dst = s;
}
@@ -113,9 +77,9 @@ struct Blend_ARGB32_on_RGB16_SourceAndConstAlpha {
inline void write(quint16 *dst, quint32 src) {
src = BYTE_MUL(src, m_alpha);
const quint8 alpha = qAlpha(src);
- if(alpha) {
+ if (alpha) {
quint16 s = qConvertRgb32To16(src);
- if(alpha < 255)
+ if (alpha < 255)
s += BYTE_MUL_RGB16(*dst, 255 - alpha);
*dst = s;
}
@@ -188,7 +152,7 @@ void qt_blend_rgb16_on_rgb16(uchar *dst, int dbpl,
if (const_alpha == 256) {
int length = w << 1;
- while (h--) {
+ while (--h >= 0) {
memcpy(dst, src, length);
dst += dbpl;
src += sbpl;
@@ -198,7 +162,7 @@ void qt_blend_rgb16_on_rgb16(uchar *dst, int dbpl,
const quint16 *s = (const quint16 *) src;
quint8 a = (255 * const_alpha) >> 8;
quint8 ia = 255 - a;
- while (h--) {
+ while (--h >= 0) {
for (int x=0; x<w; ++x) {
d[x] = BYTE_MUL_RGB16(s[x], a) + BYTE_MUL_RGB16(d[x], ia);
}
diff --git a/src/gui/painting/qblendfunctions_p.h b/src/gui/painting/qblendfunctions_p.h
index 080da98ec4..2f5ed36c73 100644
--- a/src/gui/painting/qblendfunctions_p.h
+++ b/src/gui/painting/qblendfunctions_p.h
@@ -1,41 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the QtGui module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#ifndef QBLENDFUNCTIONS_P_H
#define QBLENDFUNCTIONS_P_H
@@ -125,7 +89,7 @@ void qt_scale_image_16bit(uchar *destPixels, int dbpl,
if (xend < 0 || xend >= (int)(sbpl/sizeof(SRC)))
--w;
- while (h--) {
+ while (--h >= 0) {
const SRC *src = (const SRC *) (srcPixels + (srcy >> 16) * sbpl);
quint32 srcx = basex;
int x = 0;
@@ -216,7 +180,7 @@ template <typename T> void qt_scale_image_32bit(uchar *destPixels, int dbpl,
if (xend < 0 || xend >= (int)(sbpl/sizeof(quint32)))
--w;
- while (h--) {
+ while (--h >= 0) {
const uint *src = (const quint32 *) (srcPixels + (srcy >> 16) * sbpl);
quint32 srcx = basex;
int x = 0;
@@ -246,25 +210,32 @@ void qt_transform_image_rasterize(DestT *destPixels, int dbpl,
int dudx, int dvdx, int dudy, int dvdy, int u0, int v0,
Blender blender)
{
- int fromY = qMax(qRound(topY), clip.top());
- int toY = qMin(qRound(bottomY), clip.top() + clip.height());
+ qint64 fromY = qMax(qRound(topY), clip.top());
+ qint64 toY = qMin(qRound(bottomY), clip.top() + clip.height());
if (fromY >= toY)
return;
qreal leftSlope = (bottomLeft.x - topLeft.x) / (bottomLeft.y - topLeft.y);
qreal rightSlope = (bottomRight.x - topRight.x) / (bottomRight.y - topRight.y);
- int dx_l = int(leftSlope * 0x10000);
- int dx_r = int(rightSlope * 0x10000);
- int x_l = int((topLeft.x + (qreal(0.5) + fromY - topLeft.y) * leftSlope + qreal(0.5)) * 0x10000);
- int x_r = int((topRight.x + (qreal(0.5) + fromY - topRight.y) * rightSlope + qreal(0.5)) * 0x10000);
-
- int fromX, toX, x1, x2, u, v, i, ii;
+ qint64 dx_l = qint64(leftSlope * 0x10000);
+ qint64 dx_r = qint64(rightSlope * 0x10000);
+ qint64 x_l = qint64((topLeft.x + (qreal(0.5) + fromY - topLeft.y) * leftSlope + qreal(0.5)) * 0x10000);
+ qint64 x_r = qint64((topRight.x + (qreal(0.5) + fromY - topRight.y) * rightSlope + qreal(0.5)) * 0x10000);
+
+ qint64 sourceRectTop = qint64(sourceRect.top());
+ qint64 sourceRectLeft = qint64(sourceRect.left());
+ qint64 sourceRectWidth = qint64(sourceRect.width());
+ qint64 sourceRectHeight = qint64(sourceRect.height());
+ qint64 clipLeft = qint64(clip.left());
+ qint64 clipWidth = qint64(clip.width());
+
+ qint64 fromX, toX, x1, x2, u, v, i, ii;
DestT *line;
- for (int y = fromY; y < toY; ++y) {
+ for (qint64 y = fromY; y < toY; ++y) {
line = reinterpret_cast<DestT *>(reinterpret_cast<uchar *>(destPixels) + y * dbpl);
- fromX = qMax(x_l >> 16, clip.left());
- toX = qMin(x_r >> 16, clip.left() + clip.width());
+ fromX = qMax(x_l >> 16, clipLeft);
+ toX = qMin(x_r >> 16, clipLeft + clipWidth);
if (fromX < toX) {
// Because of rounding, we can get source coordinates outside the source image.
// Clamp these coordinates to the source rect to avoid segmentation fault and
@@ -275,10 +246,10 @@ void qt_transform_image_rasterize(DestT *destPixels, int dbpl,
u = x1 * dudx + y * dudy + u0;
v = x1 * dvdx + y * dvdy + v0;
for (; x1 < toX; ++x1) {
- int uu = u >> 16;
- int vv = v >> 16;
- if (uu >= sourceRect.left() && uu < sourceRect.left() + sourceRect.width()
- && vv >= sourceRect.top() && vv < sourceRect.top() + sourceRect.height()) {
+ qint64 uu = u >> 16;
+ qint64 vv = v >> 16;
+ if (uu >= sourceRectLeft && uu < sourceRectLeft + sourceRectWidth
+ && vv >= sourceRectTop && vv < sourceRectTop + sourceRectHeight) {
break;
}
u += dudx;
@@ -290,10 +261,10 @@ void qt_transform_image_rasterize(DestT *destPixels, int dbpl,
u = (x2 - 1) * dudx + y * dudy + u0;
v = (x2 - 1) * dvdx + y * dvdy + v0;
for (; x2 > x1; --x2) {
- int uu = u >> 16;
- int vv = v >> 16;
- if (uu >= sourceRect.left() && uu < sourceRect.left() + sourceRect.width()
- && vv >= sourceRect.top() && vv < sourceRect.top() + sourceRect.height()) {
+ qint64 uu = u >> 16;
+ qint64 vv = v >> 16;
+ if (uu >= sourceRectLeft && uu < sourceRectLeft + sourceRectWidth
+ && vv >= sourceRectTop && vv < sourceRectTop + sourceRectHeight) {
break;
}
u -= dudx;
@@ -308,8 +279,8 @@ void qt_transform_image_rasterize(DestT *destPixels, int dbpl,
// Beginning of the scan line, with per-pixel checks.
i = x1 - fromX;
while (i) {
- int uu = qBound(sourceRect.left(), u >> 16, sourceRect.left() + sourceRect.width() - 1);
- int vv = qBound(sourceRect.top(), v >> 16, sourceRect.top() + sourceRect.height() - 1);
+ qint64 uu = qBound(sourceRectLeft, u >> 16, sourceRectLeft + sourceRectWidth - 1);
+ qint64 vv = qBound(sourceRectTop, v >> 16, sourceRectTop + sourceRectHeight - 1);
blender.write(line, reinterpret_cast<const SrcT *>(reinterpret_cast<const uchar *>(srcPixels) + vv * sbpl)[uu]);
u += dudx;
v += dvdx;
@@ -348,8 +319,8 @@ void qt_transform_image_rasterize(DestT *destPixels, int dbpl,
// End of the scan line, with per-pixel checks.
i = toX - x2;
while (i) {
- int uu = qBound(sourceRect.left(), u >> 16, sourceRect.left() + sourceRect.width() - 1);
- int vv = qBound(sourceRect.top(), v >> 16, sourceRect.top() + sourceRect.height() - 1);
+ qint64 uu = qBound(sourceRectLeft, u >> 16, sourceRectLeft + sourceRectWidth - 1);
+ qint64 vv = qBound(sourceRectTop, v >> 16, sourceRectTop + sourceRectHeight - 1);
blender.write(line, reinterpret_cast<const SrcT *>(reinterpret_cast<const uchar *>(srcPixels) + vv * sbpl)[uu]);
u += dudx;
v += dvdx;
diff --git a/src/gui/painting/qblittable.cpp b/src/gui/painting/qblittable.cpp
index 494104251f..75141537a9 100644
--- a/src/gui/painting/qblittable.cpp
+++ b/src/gui/painting/qblittable.cpp
@@ -1,41 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the QtGui module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#include "qblittable_p.h"
diff --git a/src/gui/painting/qblittable_p.h b/src/gui/painting/qblittable_p.h
index 24440c3c61..55c66e1535 100644
--- a/src/gui/painting/qblittable_p.h
+++ b/src/gui/painting/qblittable_p.h
@@ -1,41 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the QtGui module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#ifndef QBLITTABLE_P_H
#define QBLITTABLE_P_H
diff --git a/src/gui/painting/qbrush.cpp b/src/gui/painting/qbrush.cpp
index b23fb45952..b053896233 100644
--- a/src/gui/painting/qbrush.cpp
+++ b/src/gui/painting/qbrush.cpp
@@ -1,41 +1,6 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the QtGui module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// Copyright (C) 2019 Klarälvdalens Datakonsult AB, a KDAB Group company, info@kdab.com, author Giuseppe D'Angelo <giuseppe.dangelo@kdab.com>
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#include "qbrush.h"
#include "qpixmap.h"
@@ -53,9 +18,17 @@
#include <QtCore/qnumeric.h>
#include <QtCore/qfile.h>
#include <QtCore/qmutex.h>
+#include <QtCore/private/qoffsetstringarray_p.h>
QT_BEGIN_NAMESPACE
+using namespace Qt::StringLiterals;
+
+#if QT_VERSION < QT_VERSION_CHECK(7, 0, 0)
+// Avoid an ABI break due to the QScopedPointer->std::unique_ptr change
+static_assert(sizeof(QBrush::DataPtr) == sizeof(QScopedPointer<QBrushData, QBrushDataPointerDeleter>));
+#endif
+
const uchar *qt_patternForBrush(int brushStyle, bool invert)
{
Q_ASSERT(brushStyle > Qt::SolidPattern && brushStyle < Qt::LinearGradientPattern);
@@ -108,7 +81,7 @@ Q_GUI_EXPORT QPixmap qt_pixmapForBrush(int brushStyle, bool invert)
{
QPixmap pm;
- QString key = QLatin1String("$qt-brush$")
+ QString key = "$qt-brush$"_L1
% HexString<uint>(brushStyle)
% QLatin1Char(invert ? '1' : '0');
if (!QPixmapCache::find(key, &pm)) {
@@ -230,7 +203,7 @@ bool Q_GUI_EXPORT qHasPixmapTexture(const QBrush& brush)
{
if (brush.style() != Qt::TexturePattern)
return false;
- QTexturedBrushData *tx_data = static_cast<QTexturedBrushData *>(brush.d.data());
+ QTexturedBrushData *tx_data = static_cast<QTexturedBrushData *>(brush.d.get());
return tx_data->m_has_pixmap_texture;
}
@@ -239,31 +212,27 @@ struct QGradientBrushData : public QBrushData
QGradient gradient;
};
-struct QBrushDataPointerDeleter
+static void deleteData(QBrushData *d)
{
- static inline void deleteData(QBrushData *d)
- {
- switch (d->style) {
- case Qt::TexturePattern:
- delete static_cast<QTexturedBrushData*>(d);
- break;
- case Qt::LinearGradientPattern:
- case Qt::RadialGradientPattern:
- case Qt::ConicalGradientPattern:
- delete static_cast<QGradientBrushData*>(d);
- break;
- default:
- delete d;
- }
+ switch (d->style) {
+ case Qt::TexturePattern:
+ delete static_cast<QTexturedBrushData*>(d);
+ break;
+ case Qt::LinearGradientPattern:
+ case Qt::RadialGradientPattern:
+ case Qt::ConicalGradientPattern:
+ delete static_cast<QGradientBrushData*>(d);
+ break;
+ default:
+ delete d;
}
+}
- static inline void cleanup(QBrushData *d)
- {
- if (d && !d->ref.deref()) {
- deleteData(d);
- }
- }
-};
+void QBrushDataPointerDeleter::operator()(QBrushData *d) const noexcept
+{
+ if (d && !d->ref.deref())
+ deleteData(d);
+}
/*!
\class QBrush
@@ -531,7 +500,7 @@ QBrush::QBrush(Qt::GlobalColor color, const QPixmap &pixmap)
*/
QBrush::QBrush(const QBrush &other)
- : d(other.d.data())
+ : d(other.d.get())
{
d->ref.ref();
}
@@ -558,7 +527,7 @@ QBrush::QBrush(const QGradient &gradient)
};
init(QColor(), enum_table[gradient.type()]);
- QGradientBrushData *grad = static_cast<QGradientBrushData *>(d.data());
+ QGradientBrushData *grad = static_cast<QGradientBrushData *>(d.get());
grad->gradient = gradient;
}
@@ -570,12 +539,7 @@ QBrush::~QBrush()
{
}
-void QBrush::cleanUp(QBrushData *x)
-{
- QBrushDataPointerDeleter::deleteData(x);
-}
-
-static Q_DECL_CONSTEXPR inline bool use_same_brushdata(Qt::BrushStyle lhs, Qt::BrushStyle rhs)
+static constexpr inline bool use_same_brushdata(Qt::BrushStyle lhs, Qt::BrushStyle rhs)
{
return lhs == rhs // includes Qt::TexturePattern
|| (lhs >= Qt::NoBrush && lhs <= Qt::DiagCrossPattern && rhs >= Qt::NoBrush && rhs <= Qt::DiagCrossPattern)
@@ -590,12 +554,12 @@ void QBrush::detach(Qt::BrushStyle newStyle)
return;
}
- QScopedPointer<QBrushData, QBrushDataPointerDeleter> x;
+ DataPtr x;
switch(newStyle) {
case Qt::TexturePattern: {
QTexturedBrushData *tbd = new QTexturedBrushData;
if (d->style == Qt::TexturePattern) {
- QTexturedBrushData *data = static_cast<QTexturedBrushData *>(d.data());
+ QTexturedBrushData *data = static_cast<QTexturedBrushData *>(d.get());
if (data->m_has_pixmap_texture)
tbd->setPixmap(data->pixmap());
else
@@ -613,7 +577,7 @@ void QBrush::detach(Qt::BrushStyle newStyle)
case Qt::RadialGradientPattern:
case Qt::ConicalGradientPattern:
gbd->gradient =
- static_cast<QGradientBrushData *>(d.data())->gradient;
+ static_cast<QGradientBrushData *>(d.get())->gradient;
break;
default:
break;
@@ -646,7 +610,7 @@ QBrush &QBrush::operator=(const QBrush &b)
return *this;
b.d->ref.ref();
- d.reset(b.d.data());
+ d.reset(b.d.get());
return *this;
}
@@ -671,7 +635,7 @@ QBrush &QBrush::operator=(const QBrush &b)
*/
QBrush::operator QVariant() const
{
- return QVariant(QVariant::Brush, this);
+ return QVariant::fromValue(*this);
}
/*!
@@ -747,7 +711,7 @@ void QBrush::setColor(const QColor &c)
QPixmap QBrush::texture() const
{
return d->style == Qt::TexturePattern
- ? (static_cast<QTexturedBrushData *>(d.data()))->pixmap()
+ ? (static_cast<QTexturedBrushData *>(d.get()))->pixmap()
: QPixmap();
}
@@ -765,7 +729,7 @@ void QBrush::setTexture(const QPixmap &pixmap)
{
if (!pixmap.isNull()) {
detach(Qt::TexturePattern);
- QTexturedBrushData *data = static_cast<QTexturedBrushData *>(d.data());
+ QTexturedBrushData *data = static_cast<QTexturedBrushData *>(d.get());
data->setPixmap(pixmap);
} else {
detach(Qt::NoBrush);
@@ -788,7 +752,7 @@ void QBrush::setTexture(const QPixmap &pixmap)
QImage QBrush::textureImage() const
{
return d->style == Qt::TexturePattern
- ? (static_cast<QTexturedBrushData *>(d.data()))->image()
+ ? (static_cast<QTexturedBrushData *>(d.get()))->image()
: QImage();
}
@@ -813,7 +777,7 @@ void QBrush::setTextureImage(const QImage &image)
{
if (!image.isNull()) {
detach(Qt::TexturePattern);
- QTexturedBrushData *data = static_cast<QTexturedBrushData *>(d.data());
+ QTexturedBrushData *data = static_cast<QTexturedBrushData *>(d.get());
data->setImage(image);
} else {
detach(Qt::NoBrush);
@@ -829,7 +793,7 @@ const QGradient *QBrush::gradient() const
if (d->style == Qt::LinearGradientPattern
|| d->style == Qt::RadialGradientPattern
|| d->style == Qt::ConicalGradientPattern) {
- return &static_cast<const QGradientBrushData *>(d.data())->gradient;
+ return &static_cast<const QGradientBrushData *>(d.get())->gradient;
}
return nullptr;
}
@@ -865,7 +829,7 @@ Q_GUI_EXPORT bool qt_isExtendedRadialGradient(const QBrush &brush)
bool QBrush::isOpaque() const
{
- bool opaqueColor = d->color.alpha() == 255;
+ bool opaqueColor = d->color.alphaF() >= 1.0f;
// Test awfully simple case first
if (d->style == Qt::SolidPattern)
@@ -879,7 +843,7 @@ bool QBrush::isOpaque() const
|| d->style == Qt::ConicalGradientPattern) {
QGradientStops stops = gradient()->stops();
for (int i=0; i<stops.size(); ++i)
- if (stops.at(i).second.alpha() != 255)
+ if (stops.at(i).second.alphaF() < 1.0f)
return false;
return true;
} else if (d->style == Qt::TexturePattern) {
@@ -891,21 +855,6 @@ bool QBrush::isOpaque() const
return false;
}
-
-/*!
- \since 4.2
-
- Sets \a matrix as an explicit transformation matrix on the
- current brush. The brush transformation matrix is merged with
- QPainter transformation matrix to produce the final result.
-
- \sa matrix()
-*/
-void QBrush::setMatrix(const QMatrix &matrix)
-{
- setTransform(QTransform(matrix));
-}
-
/*!
\since 4.3
@@ -923,15 +872,6 @@ void QBrush::setTransform(const QTransform &matrix)
/*!
- \fn void QBrush::matrix() const
- \since 4.2
-
- Returns the current transformation matrix for the brush.
-
- \sa setMatrix()
-*/
-
-/*!
\fn bool QBrush::operator!=(const QBrush &brush) const
Returns \c true if the brush is different from the given \a brush;
@@ -971,16 +911,16 @@ bool QBrush::operator==(const QBrush &b) const
const QPixmap *us = nullptr, *them = nullptr;
qint64 cacheKey1, cacheKey2;
if (qHasPixmapTexture(*this)) {
- us = (static_cast<QTexturedBrushData *>(d.data()))->m_pixmap;
+ us = (static_cast<QTexturedBrushData *>(d.get()))->m_pixmap;
cacheKey1 = us->cacheKey();
} else
- cacheKey1 = (static_cast<QTexturedBrushData *>(d.data()))->image().cacheKey();
+ cacheKey1 = (static_cast<QTexturedBrushData *>(d.get()))->image().cacheKey();
if (qHasPixmapTexture(b)) {
- them = (static_cast<QTexturedBrushData *>(b.d.data()))->m_pixmap;
+ them = (static_cast<QTexturedBrushData *>(b.d.get()))->m_pixmap;
cacheKey2 = them->cacheKey();
} else
- cacheKey2 = (static_cast<QTexturedBrushData *>(b.d.data()))->image().cacheKey();
+ cacheKey2 = (static_cast<QTexturedBrushData *>(b.d.get()))->image().cacheKey();
if (cacheKey1 != cacheKey2)
return false;
@@ -997,8 +937,8 @@ bool QBrush::operator==(const QBrush &b) const
case Qt::RadialGradientPattern:
case Qt::ConicalGradientPattern:
{
- const QGradientBrushData *d1 = static_cast<QGradientBrushData *>(d.data());
- const QGradientBrushData *d2 = static_cast<QGradientBrushData *>(b.d.data());
+ const QGradientBrushData *d1 = static_cast<QGradientBrushData *>(d.get());
+ const QGradientBrushData *d2 = static_cast<QGradientBrushData *>(b.d.get());
return d1->gradient == d2->gradient;
}
default:
@@ -1012,7 +952,7 @@ bool QBrush::operator==(const QBrush &b) const
*/
QDebug operator<<(QDebug dbg, const QBrush &b)
{
- static const char BRUSH_STYLES[][24] = {
+ static constexpr auto BRUSH_STYLES = qOffsetStringArray(
"NoBrush",
"SolidPattern",
"Dense1Pattern",
@@ -1033,7 +973,7 @@ QDebug operator<<(QDebug dbg, const QBrush &b)
"ConicalGradientPattern",
"", "", "", "", "", "",
"TexturePattern" // 24
- };
+ );
QDebugStateSaver saver(dbg);
dbg.nospace() << "QBrush(" << b.color() << ',' << BRUSH_STYLES[b.style()] << ')';
@@ -1094,7 +1034,7 @@ QDataStream &operator<<(QDataStream &s, const QBrush &b)
// ensure that we write doubles here instead of streaming the stops
// directly; otherwise, platforms that redefine qreal might generate
// data that cannot be read on other platforms.
- QVector<QGradientStop> stops = gradient->stops();
+ QList<QGradientStop> stops = gradient->stops();
s << quint32(stops.size());
for (int i = 0; i < stops.size(); ++i) {
const QGradientStop &stop = stops.at(i);
@@ -1109,6 +1049,8 @@ QDataStream &operator<<(QDataStream &s, const QBrush &b)
s << static_cast<const QRadialGradient *>(gradient)->center();
s << static_cast<const QRadialGradient *>(gradient)->focalPoint();
s << (double) static_cast<const QRadialGradient *>(gradient)->radius();
+ if (s.version() >= QDataStream::Qt_6_0)
+ s << (double) static_cast<const QRadialGradient *>(gradient)->focalRadius();
} else { // type == Conical
s << static_cast<const QConicalGradient *>(gradient)->center();
s << (double) static_cast<const QConicalGradient *>(gradient)->angle();
@@ -1199,6 +1141,7 @@ QDataStream &operator>>(QDataStream &s, QBrush &b)
} else if (type == QGradient::RadialGradient) {
QPointF center, focal;
double radius;
+ double focalRadius = 0;
s >> center;
s >> focal;
s >> radius;
@@ -1207,6 +1150,9 @@ QDataStream &operator>>(QDataStream &s, QBrush &b)
rg.setSpread(spread);
rg.setCoordinateMode(cmode);
rg.setInterpolationMode(imode);
+ if (s.version() >= QDataStream::Qt_6_0)
+ s >> focalRadius;
+ rg.setFocalRadius(focalRadius);
b = QBrush(rg);
} else { // type == QGradient::ConicalGradient
QPointF center;
@@ -1294,7 +1240,7 @@ QDataStream &operator>>(QDataStream &s, QBrush &b)
\snippet brush/brush.cpp 1
It is possible to repeat or reflect the gradient outside its area
- by specifiying the \l {QGradient::Spread}{spread method} using the
+ by specifying the \l {QGradient::Spread}{spread method} using the
setSpread() function. The default is to pad the outside area with
the color at the closest stop point. The currently set \l
{QGradient::Spread}{spread method} can be retrieved using the
@@ -1335,7 +1281,7 @@ QDataStream &operator>>(QDataStream &s, QBrush &b)
\internal
*/
QGradient::QGradient()
- : m_type(NoGradient), dummy(nullptr)
+ : m_type(NoGradient)
{
}
@@ -1344,8 +1290,179 @@ QGradient::QGradient()
\since 5.12
This enum specifies a set of predefined presets for QGradient,
- based on the gradients from https://webgradients.com/.
-*/
+ based on the gradients from \l {https://webgradients.com/}.
+
+ \value WarmFlame
+ \value NightFade
+ \value SpringWarmth
+ \value JuicyPeach
+ \value YoungPassion
+ \value LadyLips
+ \value SunnyMorning
+ \value RainyAshville
+ \value FrozenDreams
+ \value WinterNeva
+ \value DustyGrass
+ \value TemptingAzure
+ \value HeavyRain
+ \value AmyCrisp
+ \value MeanFruit
+ \value DeepBlue
+ \value RipeMalinka
+ \value CloudyKnoxville
+ \value MalibuBeach
+ \value NewLife
+ \value TrueSunset
+ \value MorpheusDen
+ \value RareWind
+ \value NearMoon
+ \value WildApple
+ \value SaintPetersburg
+ \value PlumPlate
+ \value EverlastingSky
+ \value HappyFisher
+ \value Blessing
+ \value SharpeyeEagle
+ \value LadogaBottom
+ \value LemonGate
+ \value ItmeoBranding
+ \value ZeusMiracle
+ \value OldHat
+ \value StarWine
+ \value HappyAcid
+ \value AwesomePine
+ \value NewYork
+ \value ShyRainbow
+ \value MixedHopes
+ \value FlyHigh
+ \value StrongBliss
+ \value FreshMilk
+ \value SnowAgain
+ \value FebruaryInk
+ \value KindSteel
+ \value SoftGrass
+ \value GrownEarly
+ \value SharpBlues
+ \value ShadyWater
+ \value DirtyBeauty
+ \value GreatWhale
+ \value TeenNotebook
+ \value PoliteRumors
+ \value SweetPeriod
+ \value WideMatrix
+ \value SoftCherish
+ \value RedSalvation
+ \value BurningSpring
+ \value NightParty
+ \value SkyGlider
+ \value HeavenPeach
+ \value PurpleDivision
+ \value AquaSplash
+ \value SpikyNaga
+ \value LoveKiss
+ \value CleanMirror
+ \value PremiumDark
+ \value ColdEvening
+ \value CochitiLake
+ \value SummerGames
+ \value PassionateBed
+ \value MountainRock
+ \value DesertHump
+ \value JungleDay
+ \value PhoenixStart
+ \value OctoberSilence
+ \value FarawayRiver
+ \value AlchemistLab
+ \value OverSun
+ \value PremiumWhite
+ \value MarsParty
+ \value EternalConstance
+ \value JapanBlush
+ \value SmilingRain
+ \value CloudyApple
+ \value BigMango
+ \value HealthyWater
+ \value AmourAmour
+ \value RiskyConcrete
+ \value StrongStick
+ \value ViciousStance
+ \value PaloAlto
+ \value HappyMemories
+ \value MidnightBloom
+ \value Crystalline
+ \value PartyBliss
+ \value ConfidentCloud
+ \value LeCocktail
+ \value RiverCity
+ \value FrozenBerry
+ \value ChildCare
+ \value FlyingLemon
+ \value NewRetrowave
+ \value HiddenJaguar
+ \value AboveTheSky
+ \value Nega
+ \value DenseWater
+ \value Seashore
+ \value MarbleWall
+ \value CheerfulCaramel
+ \value NightSky
+ \value MagicLake
+ \value YoungGrass
+ \value ColorfulPeach
+ \value GentleCare
+ \value PlumBath
+ \value HappyUnicorn
+ \value AfricanField
+ \value SolidStone
+ \value OrangeJuice
+ \value GlassWater
+ \value NorthMiracle
+ \value FruitBlend
+ \value MillenniumPine
+ \value HighFlight
+ \value MoleHall
+ \value SpaceShift
+ \value ForestInei
+ \value RoyalGarden
+ \value RichMetal
+ \value JuicyCake
+ \value SmartIndigo
+ \value SandStrike
+ \value NorseBeauty
+ \value AquaGuidance
+ \value SunVeggie
+ \value SeaLord
+ \value BlackSea
+ \value GrassShampoo
+ \value LandingAircraft
+ \value WitchDance
+ \value SleeplessNight
+ \value AngelCare
+ \value CrystalRiver
+ \value SoftLipstick
+ \value SaltMountain
+ \value PerfectWhite
+ \value FreshOasis
+ \value StrictNovember
+ \value MorningSalad
+ \value DeepRelief
+ \value SeaStrike
+ \value NightCall
+ \value SupremeSky
+ \value LightBlue
+ \value MindCrawl
+ \value LilyMeadow
+ \value SugarLollipop
+ \value SweetDessert
+ \value MagicRay
+ \value TeenParty
+ \value FrozenHeat
+ \value GagarinView
+ \value FabledSunset
+ \value PerfectBlue
+*/
+
+#include "webgradients.cpp"
/*!
\fn QGradient::QGradient(QGradient::Preset preset)
@@ -1358,47 +1475,11 @@ QGradient::QGradient()
to be applied to arbitrary object sizes.
*/
QGradient::QGradient(Preset preset)
- : QGradient()
-{
- static QHash<int, QGradient> cachedPresets;
- static QMutex cacheMutex;
- QMutexLocker locker(&cacheMutex);
- if (cachedPresets.contains(preset)) {
- const QGradient &cachedPreset = cachedPresets.value(preset);
- m_type = cachedPreset.m_type;
- m_data = cachedPreset.m_data;
- m_stops = cachedPreset.m_stops;
- m_spread = cachedPreset.m_spread;
- dummy = cachedPreset.dummy;
- } else {
- static QJsonDocument jsonPresets = []() {
- QFile webGradients(QLatin1String(":/qgradient/webgradients.binaryjson"));
- webGradients.open(QFile::ReadOnly);
- return QJsonDocument::fromBinaryData(webGradients.readAll());
- }();
-
- const QJsonValue presetData = jsonPresets[preset - 1];
- if (!presetData.isObject())
- return;
-
- m_type = LinearGradient;
- setCoordinateMode(ObjectMode);
- setSpread(PadSpread);
-
- const QJsonValue start = presetData[QLatin1String("start")];
- const QJsonValue end = presetData[QLatin1String("end")];
- m_data.linear.x1 = start[QLatin1String("x")].toDouble();
- m_data.linear.y1 = start[QLatin1String("y")].toDouble();
- m_data.linear.x2 = end[QLatin1String("x")].toDouble();
- m_data.linear.y2 = end[QLatin1String("y")].toDouble();
-
- for (const QJsonValue &stop : presetData[QLatin1String("stops")].toArray()) {
- setColorAt(stop[QLatin1String("position")].toDouble(),
- QColor(QRgb(stop[QLatin1String("color")].toInt())));
- }
-
- cachedPresets.insert(preset, *this);
- }
+ : m_type(LinearGradient)
+ , m_stops(qt_preset_gradient_stops(preset))
+ , m_data(qt_preset_gradient_data[preset - 1])
+ , m_coordinateMode(ObjectMode)
+{
}
/*!
@@ -1408,11 +1489,6 @@ QGradient::~QGradient()
{
}
-QT_END_NAMESPACE
-static void initGradientPresets() { Q_INIT_RESOURCE(qmake_webgradients); }
-Q_CONSTRUCTOR_FUNCTION(initGradientPresets);
-QT_BEGIN_NAMESPACE
-
/*!
\enum QGradient::Type
@@ -1531,7 +1607,6 @@ static inline bool ok(const QGradientStops &stops)
*/
void QGradient::setStops(const QGradientStops &stops)
{
- // ## Qt 6: consider taking \a stops by value, so we can move into m_stops
if (Q_LIKELY(ok(stops))) {
// fast path for the common case: if everything is ok with the stops, just copy them
m_stops = stops;
@@ -1556,15 +1631,14 @@ void QGradient::setStops(const QGradientStops &stops)
QGradientStops QGradient::stops() const
{
if (m_stops.isEmpty()) {
- QGradientStops tmp;
- tmp << QGradientStop(0, Qt::black) << QGradientStop(1, Qt::white);
- return tmp;
+ static constexpr QGradientStop blackAndWhite[] = {
+ {0, QColorConstants::Black}, {1, QColorConstants::White},
+ };
+ return QGradientStops::fromReadOnlyData(blackAndWhite);
}
return m_stops;
}
-#define Q_DUMMY_ACCESSOR union {void *p; uint i;}; p = dummy;
-
/*!
\enum QGradient::CoordinateMode
\since 4.4
@@ -1597,8 +1671,7 @@ QGradientStops QGradient::stops() const
*/
QGradient::CoordinateMode QGradient::coordinateMode() const
{
- Q_DUMMY_ACCESSOR
- return CoordinateMode(i & 0x03);
+ return m_coordinateMode;
}
/*!
@@ -1609,10 +1682,7 @@ QGradient::CoordinateMode QGradient::coordinateMode() const
*/
void QGradient::setCoordinateMode(CoordinateMode mode)
{
- Q_DUMMY_ACCESSOR
- i &= ~0x03;
- i |= uint(mode);
- dummy = p;
+ m_coordinateMode = mode;
}
/*!
@@ -1635,8 +1705,7 @@ void QGradient::setCoordinateMode(CoordinateMode mode)
*/
QGradient::InterpolationMode QGradient::interpolationMode() const
{
- Q_DUMMY_ACCESSOR
- return InterpolationMode((i >> 2) & 0x01);
+ return m_interpolationMode;
}
/*!
@@ -1648,10 +1717,7 @@ QGradient::InterpolationMode QGradient::interpolationMode() const
*/
void QGradient::setInterpolationMode(InterpolationMode mode)
{
- Q_DUMMY_ACCESSOR
- i &= ~(1 << 2);
- i |= (uint(mode) << 2);
- dummy = p;
+ m_interpolationMode = mode;
}
/*!
@@ -1674,7 +1740,8 @@ bool QGradient::operator==(const QGradient &gradient) const
{
if (gradient.m_type != m_type
|| gradient.m_spread != m_spread
- || gradient.dummy != dummy) return false;
+ || gradient.m_coordinateMode != m_coordinateMode
+ || gradient.m_interpolationMode != m_interpolationMode) return false;
if (m_type == LinearGradient) {
if (m_data.linear.x1 != gradient.m_data.linear.x1
@@ -1687,7 +1754,8 @@ bool QGradient::operator==(const QGradient &gradient) const
|| m_data.radial.cy != gradient.m_data.radial.cy
|| m_data.radial.fx != gradient.m_data.radial.fx
|| m_data.radial.fy != gradient.m_data.radial.fy
- || m_data.radial.cradius != gradient.m_data.radial.cradius)
+ || m_data.radial.cradius != gradient.m_data.radial.cradius
+ || m_data.radial.fradius != gradient.m_data.radial.fradius)
return false;
} else { // m_type == ConicalGradient
if (m_data.conical.cx != gradient.m_data.conical.cx
@@ -1961,6 +2029,7 @@ QRadialGradient::QRadialGradient(const QPointF &center, qreal radius, const QPoi
m_data.radial.cx = center.x();
m_data.radial.cy = center.y();
m_data.radial.cradius = radius;
+ m_data.radial.fradius = 0;
QPointF adapted_focal = qt_radial_gradient_adapt_focal_point(center, radius, focalPoint);
m_data.radial.fx = adapted_focal.x();
@@ -1980,6 +2049,7 @@ QRadialGradient::QRadialGradient(const QPointF &center, qreal radius)
m_data.radial.cx = center.x();
m_data.radial.cy = center.y();
m_data.radial.cradius = radius;
+ m_data.radial.fradius = 0;
m_data.radial.fx = center.x();
m_data.radial.fy = center.y();
}
@@ -2025,6 +2095,7 @@ QRadialGradient::QRadialGradient()
m_data.radial.cx = 0;
m_data.radial.cy = 0;
m_data.radial.cradius = 1;
+ m_data.radial.fradius = 0;
m_data.radial.fx = 0;
m_data.radial.fy = 0;
}
@@ -2042,6 +2113,7 @@ QRadialGradient::QRadialGradient(const QPointF &center, qreal centerRadius, cons
m_data.radial.cx = center.x();
m_data.radial.cy = center.y();
m_data.radial.cradius = centerRadius;
+ m_data.radial.fradius = 0;
m_data.radial.fx = focalPoint.x();
m_data.radial.fy = focalPoint.y();
@@ -2062,6 +2134,7 @@ QRadialGradient::QRadialGradient(qreal cx, qreal cy, qreal centerRadius, qreal f
m_data.radial.cx = cx;
m_data.radial.cy = cy;
m_data.radial.cradius = centerRadius;
+ m_data.radial.fradius = 0;
m_data.radial.fx = fx;
m_data.radial.fy = fy;
@@ -2181,12 +2254,7 @@ void QRadialGradient::setCenterRadius(qreal radius)
qreal QRadialGradient::focalRadius() const
{
Q_ASSERT(m_type == RadialGradient);
- Q_DUMMY_ACCESSOR
-
- // mask away low three bits
- union { float f; quint32 i; } u;
- u.i = i & ~0x07;
- return u.f;
+ return m_data.radial.fradius;
}
/*!
@@ -2198,17 +2266,7 @@ qreal QRadialGradient::focalRadius() const
void QRadialGradient::setFocalRadius(qreal radius)
{
Q_ASSERT(m_type == RadialGradient);
- Q_DUMMY_ACCESSOR
-
- // Since there's no QGradientData, we only have the dummy void * to
- // store additional data in. The three lowest bits are already
- // taken, thus we cut the three lowest bits from the significand
- // and store the radius as a float.
- union { float f; quint32 i; } u;
- u.f = float(radius);
- // add 0x04 to round up when we drop the three lowest bits
- i |= (u.i + 0x04) & ~0x07;
- dummy = p;
+ m_data.radial.fradius = radius;
}
/*!
@@ -2425,7 +2483,7 @@ void QConicalGradient::setAngle(qreal angle)
\typedef QGradientStops
\relates QGradient
- Typedef for QVector<QGradientStop>.
+ Typedef for QList<QGradientStop>.
*/
/*!
@@ -2453,6 +2511,6 @@ void QConicalGradient::setAngle(qreal angle)
\sa setTransform()
*/
-#undef Q_DUMMY_ACCESSOR
-
QT_END_NAMESPACE
+
+#include "moc_qbrush.cpp"
diff --git a/src/gui/painting/qbrush.h b/src/gui/painting/qbrush.h
index 6a4ffab1c5..ca8112ff31 100644
--- a/src/gui/painting/qbrush.h
+++ b/src/gui/painting/qbrush.h
@@ -1,55 +1,18 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the QtGui module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#ifndef QBRUSH_H
#define QBRUSH_H
#include <QtGui/qtguiglobal.h>
+#include <QtCore/qlist.h>
#include <QtCore/qpair.h>
#include <QtCore/qpoint.h>
-#include <QtCore/qvector.h>
#include <QtCore/qscopedpointer.h>
#include <QtGui/qcolor.h>
-#include <QtGui/qmatrix.h>
-#include <QtGui/qtransform.h>
#include <QtGui/qimage.h>
#include <QtGui/qpixmap.h>
+#include <QtGui/qtransform.h>
QT_BEGIN_NAMESPACE
@@ -58,7 +21,10 @@ struct QBrushData;
class QPixmap;
class QGradient;
class QVariant;
-struct QBrushDataPointerDeleter;
+struct QBrushDataPointerDeleter
+{
+ void operator()(QBrushData *d) const noexcept;
+};
class Q_GUI_EXPORT QBrush
{
@@ -79,19 +45,15 @@ public:
~QBrush();
QBrush &operator=(const QBrush &brush);
- inline QBrush &operator=(QBrush &&other) noexcept
- { qSwap(d, other.d); return *this; }
+ QT_MOVE_ASSIGNMENT_OPERATOR_IMPL_VIA_PURE_SWAP(QBrush)
inline void swap(QBrush &other) noexcept
- { qSwap(d, other.d); }
+ { d.swap(other.d); }
operator QVariant() const;
inline Qt::BrushStyle style() const;
void setStyle(Qt::BrushStyle);
- inline const QMatrix &matrix() const;
- void setMatrix(const QMatrix &mat);
-
inline QTransform transform() const;
void setTransform(const QTransform &);
@@ -112,6 +74,8 @@ public:
bool operator==(const QBrush &b) const;
inline bool operator!=(const QBrush &b) const { return !(operator==(b)); }
+ using DataPtr = std::unique_ptr<QBrushData, QBrushDataPointerDeleter>;
+
private:
friend class QRasterPaintEngine;
friend class QRasterPaintEnginePrivate;
@@ -120,12 +84,10 @@ private:
friend bool Q_GUI_EXPORT qHasPixmapTexture(const QBrush& brush);
void detach(Qt::BrushStyle newStyle);
void init(const QColor &color, Qt::BrushStyle bs);
- QScopedPointer<QBrushData, QBrushDataPointerDeleter> d;
- void cleanUp(QBrushData *x);
+ DataPtr d;
public:
inline bool isDetached() const;
- typedef QScopedPointer<QBrushData, QBrushDataPointerDeleter> DataPtr;
inline DataPtr &data_ptr() { return d; }
};
@@ -157,7 +119,6 @@ struct QBrushData
inline Qt::BrushStyle QBrush::style() const { return d->style; }
inline const QColor &QBrush::color() const { return d->color; }
-inline const QMatrix &QBrush::matrix() const { return d->transform.toAffine(); }
inline QTransform QBrush::transform() const { return d->transform; }
inline bool QBrush::isDetached() const { return d->ref.loadRelaxed() == 1; }
@@ -168,7 +129,7 @@ inline bool QBrush::isDetached() const { return d->ref.loadRelaxed() == 1; }
class QGradientPrivate;
typedef QPair<qreal, QColor> QGradientStop;
-typedef QVector<QGradientStop> QGradientStops;
+typedef QList<QGradientStop> QGradientStops;
class Q_GUI_EXPORT QGradient
{
@@ -400,27 +361,30 @@ public:
inline bool operator!=(const QGradient &other) const
{ return !operator==(other); }
-private:
- friend class QLinearGradient;
- friend class QRadialGradient;
- friend class QConicalGradient;
- friend class QBrush;
-
- Type m_type;
- Spread m_spread;
- QGradientStops m_stops;
- union {
+ union QGradientData {
struct {
qreal x1, y1, x2, y2;
} linear;
struct {
- qreal cx, cy, fx, fy, cradius;
+ qreal cx, cy, fx, fy, cradius, fradius;
} radial;
struct {
qreal cx, cy, angle;
} conical;
- } m_data;
- void *dummy; // ### Qt 6: replace with actual content (CoordinateMode, InterpolationMode, ...)
+ };
+
+private:
+ friend class QLinearGradient;
+ friend class QRadialGradient;
+ friend class QConicalGradient;
+ friend class QBrush;
+
+ Type m_type = NoGradient;
+ Spread m_spread = PadSpread;
+ QGradientStops m_stops;
+ QGradientData m_data;
+ CoordinateMode m_coordinateMode = LogicalMode;
+ InterpolationMode m_interpolationMode = ColorInterpolation;
};
inline void QGradient::setSpread(Spread aspread)
diff --git a/src/gui/painting/qcmyk_p.h b/src/gui/painting/qcmyk_p.h
new file mode 100644
index 0000000000..d00a4b5a6e
--- /dev/null
+++ b/src/gui/painting/qcmyk_p.h
@@ -0,0 +1,88 @@
+// Copyright (C) 2023 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
+
+#ifndef QCMYK_P_H
+#define QCMYK_P_H
+
+//
+// W A R N I N G
+// -------------
+//
+// This file is not part of the Qt API. It exists purely as an
+// implementation detail. This header file may change from version to
+// version without notice, or even be removed.
+//
+// We mean it.
+//
+
+#include <QtGui/private/qtguiglobal_p.h>
+#include <QtGui/qcolor.h>
+
+QT_BEGIN_NAMESPACE
+
+class QCmyk32
+{
+private:
+ uint m_cmyk = 0;
+
+public:
+ QCmyk32() = default;
+
+ constexpr QCmyk32(int cyan, int magenta, int yellow, int black) :
+#if QT_BYTE_ORDER == Q_BIG_ENDIAN
+ m_cmyk(cyan << 24 | magenta << 16 | yellow << 8 | black)
+#else
+ m_cmyk(cyan | magenta << 8 | yellow << 16 | black << 24)
+#endif
+ {
+ }
+
+#if QT_BYTE_ORDER == Q_BIG_ENDIAN
+ constexpr int cyan() const noexcept { return (m_cmyk >> 24) & 0xff; }
+ constexpr int magenta() const noexcept { return (m_cmyk >> 16) & 0xff; }
+ constexpr int yellow() const noexcept { return (m_cmyk >> 8) & 0xff; }
+ constexpr int black() const noexcept { return (m_cmyk ) & 0xff; }
+#else
+ constexpr int cyan() const noexcept { return (m_cmyk ) & 0xff; }
+ constexpr int magenta() const noexcept { return (m_cmyk >> 8) & 0xff; }
+ constexpr int yellow() const noexcept { return (m_cmyk >> 16) & 0xff; }
+ constexpr int black() const noexcept { return (m_cmyk >> 24) & 0xff; }
+#endif
+
+ QColor toColor() const noexcept
+ {
+ return QColor::fromCmyk(cyan(), magenta(), yellow(), black());
+ }
+
+ constexpr uint toUint() const noexcept
+ {
+ return m_cmyk;
+ }
+
+ constexpr static QCmyk32 fromCmyk32(uint cmyk) noexcept
+ {
+ QCmyk32 result;
+ result.m_cmyk = cmyk;
+ return result;
+ }
+
+ static QCmyk32 fromRgba(QRgb rgba) noexcept
+ {
+ const QColor c = QColor(rgba).toCmyk();
+ return QCmyk32(c.cyan(), c.magenta(), c.yellow(), c.black());
+ }
+
+ static QCmyk32 fromColor(const QColor &color) noexcept
+ {
+ QColor c = color.toCmyk();
+ return QCmyk32(c.cyan(), c.magenta(), c.yellow(), c.black());
+ }
+};
+
+static_assert(sizeof(QCmyk32) == sizeof(int));
+static_assert(alignof(QCmyk32) == alignof(int));
+static_assert(std::is_standard_layout_v<QCmyk32>);
+
+QT_END_NAMESPACE
+
+#endif // QCMYK_P_H
diff --git a/src/gui/painting/qcolor.cpp b/src/gui/painting/qcolor.cpp
index c567b25468..2af2e8cb6b 100644
--- a/src/gui/painting/qcolor.cpp
+++ b/src/gui/painting/qcolor.cpp
@@ -1,44 +1,9 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the QtGui module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2022 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#include "qcolor.h"
#include "qcolor_p.h"
+#include "qdrawhelper_p.h"
#include "qfloat16.h"
#include "qnamespace.h"
#include "qdatastream.h"
@@ -47,12 +12,19 @@
#include "private/qtools_p.h"
#include <algorithm>
+#include <optional>
#include <stdio.h>
#include <limits.h>
QT_BEGIN_NAMESPACE
+// QColor fits into QVariant's internal storage on 64bit systems.
+// It could also fit on 32bit systems, but we cannot make it happen in Qt6, due to BC.
+#if QT_VERSION >= QT_VERSION_CHECK(7,0,0) || QT_POINTER_SIZE > 4
+static_assert(sizeof(QColor) <= QVariant::Private::MaxInternalSize);
+#endif
+
/*!
\internal
If s[0..n] is a valid hex number, returns its integer value,
@@ -73,10 +45,10 @@ static inline int hex2int(const char *s, int n)
return result;
}
-static bool get_hex_rgb(const char *name, size_t len, QRgba64 *rgb)
+static std::optional<QRgba64> get_hex_rgb(const char *name, size_t len)
{
if (name[0] != '#')
- return false;
+ return std::nullopt;
name++;
--len;
int a, r, g, b;
@@ -89,6 +61,8 @@ static bool get_hex_rgb(const char *name, size_t len, QRgba64 *rgb)
r = hex2int(name + 0, 3);
g = hex2int(name + 3, 3);
b = hex2int(name + 6, 3);
+ if (r == -1 || g == -1 || b == -1)
+ return std::nullopt;
r = (r << 4) | (r >> 8);
g = (g << 4) | (g >> 8);
b = (b << 4) | (b >> 8);
@@ -108,32 +82,34 @@ static bool get_hex_rgb(const char *name, size_t len, QRgba64 *rgb)
} else {
r = g = b = -1;
}
- if ((uint)r > 65535 || (uint)g > 65535 || (uint)b > 65535 || (uint)a > 65535) {
- *rgb = 0;
- return false;
- }
- *rgb = qRgba64(r, g ,b, a);
- return true;
+ if (uint(r) > 65535 || uint(g) > 65535 || uint(b) > 65535 || uint(a) > 65535)
+ return std::nullopt;
+ return qRgba64(r, g ,b, a);
}
-bool qt_get_hex_rgb(const char *name, QRgb *rgb)
+std::optional<QRgb> qt_get_hex_rgb(const char *name)
{
- QRgba64 rgba64;
- if (!get_hex_rgb(name, qstrlen(name), &rgba64))
- return false;
- *rgb = rgba64.toArgb32();
- return true;
+ if (std::optional<QRgba64> rgba64 = get_hex_rgb(name, qstrlen(name)))
+ return rgba64->toArgb32();
+ return std::nullopt;
}
-static bool get_hex_rgb(const QChar *str, size_t len, QRgba64 *rgb)
+static std::optional<QRgba64> get_hex_rgb(const QChar *str, size_t len)
{
if (len > 13)
- return false;
+ return std::nullopt;
char tmp[16];
for (size_t i = 0; i < len; ++i)
tmp[i] = str[i].toLatin1();
tmp[len] = 0;
- return get_hex_rgb(tmp, len, rgb);
+ return get_hex_rgb(tmp, len);
+}
+
+static std::optional<QRgba64> get_hex_rgb(QAnyStringView name)
+{
+ return name.visit([] (auto name) {
+ return get_hex_rgb(name.data(), name.size());
+ });
}
#ifndef QT_NO_COLORNAMES
@@ -148,7 +124,7 @@ static bool get_hex_rgb(const QChar *str, size_t len, QRgba64 *rgb)
#define rgb(r,g,b) (0xff000000 | (r << 16) | (g << 8) | b)
// keep this is in sync with QColorConstants
-static const struct RGBData {
+static constexpr struct RGBData {
const char name[21];
uint value;
} rgbTbl[] = {
@@ -304,6 +280,16 @@ static const struct RGBData {
static const int rgbTblSize = sizeof(rgbTbl) / sizeof(RGBData);
+static_assert([] {
+ for (auto e : rgbTbl) {
+ for (auto it = e.name; *it ; ++it) {
+ if (uchar(*it) > 127)
+ return false;
+ }
+ }
+ return true;
+ }(), "the lookup code expects color names to be US-ASCII-only");
+
#undef rgb
inline bool operator<(const char *name, const RGBData &data)
@@ -311,43 +297,35 @@ inline bool operator<(const char *name, const RGBData &data)
inline bool operator<(const RGBData &data, const char *name)
{ return qstrcmp(data.name, name) < 0; }
-static bool get_named_rgb_no_space(const char *name_no_space, QRgb *rgb)
+static std::optional<QRgb> get_named_rgb_no_space(const char *name_no_space)
{
const RGBData *r = std::lower_bound(rgbTbl, rgbTbl + rgbTblSize, name_no_space);
- if ((r != rgbTbl + rgbTblSize) && !(name_no_space < *r)) {
- *rgb = r->value;
- return true;
- }
- return false;
+ if ((r != rgbTbl + rgbTblSize) && !(name_no_space < *r))
+ return r->value;
+ return std::nullopt;
}
-static bool get_named_rgb(const char *name, int len, QRgb* rgb)
-{
- if (len > 255)
- return false;
- char name_no_space[256];
- int pos = 0;
- for (int i = 0; i < len; i++) {
- if (name[i] != '\t' && name[i] != ' ')
- name_no_space[pos++] = QChar::toLower(name[i]);
- }
- name_no_space[pos] = 0;
-
- return get_named_rgb_no_space(name_no_space, rgb);
+namespace {
+// named colors are US-ASCII (enforced by static_assert above):
+static char to_char(char ch) noexcept { return ch; }
+static char to_char(QChar ch) noexcept { return ch.toLatin1(); }
}
-static bool get_named_rgb(const QChar *name, int len, QRgb *rgb)
+static std::optional<QRgb> get_named_rgb(QAnyStringView name)
{
- if (len > 255)
- return false;
+ if (name.size() > 255)
+ return std::nullopt;
char name_no_space[256];
int pos = 0;
- for (int i = 0; i < len; i++) {
- if (name[i] != QLatin1Char('\t') && name[i] != QLatin1Char(' '))
- name_no_space[pos++] = name[i].toLower().toLatin1();
- }
+ name.visit([&pos, &name_no_space] (auto name) {
+ for (auto c : name) {
+ if (c != u'\t' && c != u' ')
+ name_no_space[pos++] = QtMiscUtils::toAsciiLower(to_char(c));
+ }
+ });
name_no_space[pos] = 0;
- return get_named_rgb_no_space(name_no_space, rgb);
+
+ return get_named_rgb_no_space(name_no_space);
}
#endif // QT_NO_COLORNAMES
@@ -358,7 +336,7 @@ static QStringList get_colornames()
#ifndef QT_NO_COLORNAMES
lst.reserve(rgbTblSize);
for (int i = 0; i < rgbTblSize; i++)
- lst << QLatin1String(rgbTbl[i].name);
+ lst << QLatin1StringView(rgbTbl[i].name);
#endif
return lst;
}
@@ -402,7 +380,7 @@ static QStringList get_colornames()
A color can be set by passing an RGB string (such as "#112233"),
or an ARGB string (such as "#ff112233") or a color name (such as "blue"),
- to the setNamedColor() function.
+ to the fromString() function.
The color names are taken from the SVG 1.0 color names. The name()
function returns the name of the color in the format
"#RRGGBB". Colors can also be set using setRgb(), setHsv() and
@@ -469,7 +447,7 @@ static QStringList get_colornames()
The alpha channel of a color can be retrieved and set using the
alpha() and setAlpha() functions if its value is an integer, and
- alphaF() and setAlphaF() if its value is qreal (double). By
+ alphaF() and setAlphaF() if its value is float. By
default, the alpha-channel is set to 255 (opaque). To retrieve and
set \e all the RGB color components (including the alpha-channel)
in one go, use the rgba() and setRgba() functions.
@@ -610,9 +588,9 @@ static QStringList get_colornames()
#define QCOLOR_REAL_RANGE_CHECK(fn, var) \
do { \
- if (var < qreal(0.0) || var > qreal(1.0)) { \
+ if (var < 0.0f || var > 1.0f) { \
qWarning(#fn": invalid value %g", var); \
- var = qMax(qreal(0.0), qMin(var, qreal(1.0))); \
+ var = qMax(0.0f, qMin(var, 1.0f)); \
} \
} while (0)
@@ -777,7 +755,7 @@ QColor::QColor(QRgba64 rgba64) noexcept
Constructs a color with the given \a spec.
- This function is primarly present to avoid that QColor::Invalid
+ This function is primarily present to avoid that QColor::Invalid
becomes a valid color by accident.
*/
@@ -806,6 +784,7 @@ QColor::QColor(Spec spec) noexcept
}
}
+// ### Qt 7: remove those after deprecating them for the last Qt 6 LTS release
/*!
\fn QColor::QColor(const QString &name)
@@ -828,7 +807,7 @@ QColor::QColor(Spec spec) noexcept
*/
/*!
- \fn QColor::QColor(QLatin1String name)
+ \fn QColor::QColor(QLatin1StringView name)
Constructs a named color in the same way as setNamedColor() using
the given \a name.
@@ -838,16 +817,6 @@ QColor::QColor(Spec spec) noexcept
\sa setNamedColor(), name(), isValid()
*/
-#if QT_VERSION < QT_VERSION_CHECK(6,0,0)
-/*!
- \fn QColor::QColor(const QColor &color)
-
- Constructs a color that is a copy of \a color.
-
- \sa isValid()
-*/
-#endif
-
/*!
\fn bool QColor::isValid() const
@@ -859,23 +828,25 @@ QColor::QColor(Spec spec) noexcept
Returns the name of the color in the specified \a format.
- \sa setNamedColor(), NameFormat
+ \sa fromString(), NameFormat
*/
QString QColor::name(NameFormat format) const
{
switch (format) {
case HexRgb:
- return QLatin1Char('#') + QString::number(rgba() | 0x1000000, 16).rightRef(6);
+ return u'#' + QStringView{QString::number(rgba() | 0x1000000, 16)}.right(6);
case HexArgb:
// it's called rgba() but it does return AARRGGBB
- return QLatin1Char('#') + QString::number(rgba() | Q_INT64_C(0x100000000), 16).rightRef(8);
+ return u'#' + QStringView{QString::number(rgba() | Q_INT64_C(0x100000000), 16)}.right(8);
}
return QString();
}
-#if QT_STRINGVIEW_LEVEL < 2
+#if QT_DEPRECATED_SINCE(6, 6)
/*!
+ \deprecated [6.6] Use fromString() instead.
+
Sets the RGB value of this QColor to \a name, which may be in one
of these formats:
@@ -901,34 +872,36 @@ QString QColor::name(NameFormat format) const
void QColor::setNamedColor(const QString &name)
{
- setColorFromString(qToStringViewIgnoringNull(name));
+ *this = fromString(qToAnyStringViewIgnoringNull(name));
}
-#endif
/*!
\overload
\since 5.10
+ \deprecated [6.6] Use fromString() instead.
*/
void QColor::setNamedColor(QStringView name)
{
- setColorFromString(name);
+ *this = fromString(name);
}
/*!
\overload
\since 5.8
+ \deprecated [6.6] Use fromString() instead.
*/
-void QColor::setNamedColor(QLatin1String name)
+void QColor::setNamedColor(QLatin1StringView name)
{
- setColorFromString(name);
+ *this = fromString(name);
}
-#if QT_STRINGVIEW_LEVEL < 2
/*!
\since 4.7
+ \deprecated [6.6] Use isValidColorName() instead.
+
Returns \c true if the \a name is a valid color name and can
be used to construct a valid QColor object, otherwise returns
false.
@@ -939,58 +912,86 @@ void QColor::setNamedColor(QLatin1String name)
*/
bool QColor::isValidColor(const QString &name)
{
- return isValidColor(qToStringViewIgnoringNull(name));
+ return isValidColorName(qToAnyStringViewIgnoringNull(name));
}
-#endif
/*!
\overload
\since 5.10
+ \deprecated [6.6] Use isValidColorName() instead.
*/
bool QColor::isValidColor(QStringView name) noexcept
{
- return name.size() && QColor().setColorFromString(name);
+ return isValidColorName(name);
}
/*!
\overload
\since 5.8
+ \deprecated [6.6] Use isValidColorName() instead.
*/
-bool QColor::isValidColor(QLatin1String name) noexcept
+bool QColor::isValidColor(QLatin1StringView name) noexcept
{
- return name.size() && QColor().setColorFromString(name);
+ return isValidColorName(name);
}
+#endif // QT_DEPRECATED_SINCE(6, 6)
-template <typename String>
-bool QColor::setColorFromString(String name)
+/*!
+ \since 6.4
+
+ Returns \c true if the \a name is a valid color name and can
+ be used to construct a valid QColor object, otherwise returns
+ false.
+
+ It uses the same algorithm used in fromString().
+
+ \sa fromString()
+*/
+bool QColor::isValidColorName(QAnyStringView name) noexcept
{
- if (!name.size()) {
- invalidate();
- return true;
- }
+ return fromString(name).isValid();
+}
- if (name[0] == QLatin1Char('#')) {
- QRgba64 rgba;
- if (get_hex_rgb(name.data(), name.size(), &rgba)) {
- setRgba64(rgba);
- return true;
- } else {
- invalidate();
- return false;
- }
- }
+/*!
+ \since 6.4
+
+ Returns an RGB QColor parsed from \a name, which may be in one
+ of these formats:
+ \list
+ \li #RGB (each of R, G, and B is a single hex digit)
+ \li #RRGGBB
+ \li #AARRGGBB (Since 5.2)
+ \li #RRRGGGBBB
+ \li #RRRRGGGGBBBB
+ \li A name from the list of colors defined in the list of
+ \l{https://www.w3.org/TR/SVG11/types.html#ColorKeywords}{SVG color keyword names}
+ provided by the World Wide Web Consortium; for example, "steelblue" or "gainsboro".
+ These color names work on all platforms. Note that these color names are \e not the
+ same as defined by the Qt::GlobalColor enums, e.g. "green" and Qt::green does not
+ refer to the same color.
+ \li \c transparent - representing the absence of a color.
+ \endlist
+
+ Returns an invalid color if \a name cannot be parsed.
+
+ \sa isValidColorName()
+*/
+QColor QColor::fromString(QAnyStringView name) noexcept
+{
+ if (!name.size())
+ return {};
+
+ if (name.front() == u'#') {
+ if (std::optional<QRgba64> r = get_hex_rgb(name))
+ return QColor::fromRgba64(*r);
#ifndef QT_NO_COLORNAMES
- QRgb rgb;
- if (get_named_rgb(name.data(), name.size(), &rgb)) {
- setRgba(rgb);
- return true;
- } else
+ } else if (std::optional<QRgb> r = get_named_rgb(name)) {
+ return QColor::fromRgba(*r);
#endif
- {
- invalidate();
- return false;
}
+
+ return {};
}
/*!
@@ -1013,7 +1014,7 @@ QStringList QColor::colorNames()
\sa setHsv(), {QColor#The HSV Color Model}{The HSV Color Model}
*/
-void QColor::getHsvF(qreal *h, qreal *s, qreal *v, qreal *a) const
+void QColor::getHsvF(float *h, float *s, float *v, float *a) const
{
if (!h || !s || !v)
return;
@@ -1023,12 +1024,12 @@ void QColor::getHsvF(qreal *h, qreal *s, qreal *v, qreal *a) const
return;
}
- *h = ct.ahsv.hue == USHRT_MAX ? qreal(-1.0) : ct.ahsv.hue / qreal(36000.0);
- *s = ct.ahsv.saturation / qreal(USHRT_MAX);
- *v = ct.ahsv.value / qreal(USHRT_MAX);
+ *h = ct.ahsv.hue == USHRT_MAX ? -1.0f : ct.ahsv.hue / 36000.0f;
+ *s = ct.ahsv.saturation / float(USHRT_MAX);
+ *v = ct.ahsv.value / float(USHRT_MAX);
if (a)
- *a = ct.ahsv.alpha / qreal(USHRT_MAX);
+ *a = ct.ahsv.alpha / float(USHRT_MAX);
}
/*!
@@ -1052,11 +1053,11 @@ void QColor::getHsv(int *h, int *s, int *v, int *a) const
}
*h = ct.ahsv.hue == USHRT_MAX ? -1 : ct.ahsv.hue / 100;
- *s = ct.ahsv.saturation >> 8;
- *v = ct.ahsv.value >> 8;
+ *s = qt_div_257(ct.ahsv.saturation);
+ *v = qt_div_257(ct.ahsv.value);
if (a)
- *a = ct.ahsv.alpha >> 8;
+ *a = qt_div_257(ct.ahsv.alpha);
}
/*!
@@ -1067,12 +1068,12 @@ void QColor::getHsv(int *h, int *s, int *v, int *a) const
\sa getHsvF(), setHsv(), {QColor#The HSV Color Model}{The HSV Color Model}
*/
-void QColor::setHsvF(qreal h, qreal s, qreal v, qreal a)
+void QColor::setHsvF(float h, float s, float v, float a)
{
- if (((h < qreal(0.0) || h > qreal(1.0)) && h != qreal(-1.0))
- || (s < qreal(0.0) || s > qreal(1.0))
- || (v < qreal(0.0) || v > qreal(1.0))
- || (a < qreal(0.0) || a > qreal(1.0))) {
+ if (((h < 0.0f || h > 1.0f) && h != -1.0f)
+ || (s < 0.0f || s > 1.0f)
+ || (v < 0.0f || v > 1.0f)
+ || (a < 0.0f || a > 1.0f)) {
qWarning("QColor::setHsvF: HSV parameters out of range");
invalidate();
return;
@@ -1080,7 +1081,7 @@ void QColor::setHsvF(qreal h, qreal s, qreal v, qreal a)
cspec = Hsv;
ct.ahsv.alpha = qRound(a * USHRT_MAX);
- ct.ahsv.hue = h == qreal(-1.0) ? USHRT_MAX : qRound(h * 36000);
+ ct.ahsv.hue = h == -1.0f ? USHRT_MAX : qRound(h * 36000.0f);
ct.ahsv.saturation = qRound(s * USHRT_MAX);
ct.ahsv.value = qRound(v * USHRT_MAX);
ct.ahsv.pad = 0;
@@ -1123,7 +1124,7 @@ void QColor::setHsv(int h, int s, int v, int a)
\sa getHsl(), setHslF(), {QColor#The HSL Color Model}{The HSL Color Model}
*/
-void QColor::getHslF(qreal *h, qreal *s, qreal *l, qreal *a) const
+void QColor::getHslF(float *h, float *s, float *l, float *a) const
{
if (!h || !s || !l)
return;
@@ -1133,12 +1134,12 @@ void QColor::getHslF(qreal *h, qreal *s, qreal *l, qreal *a) const
return;
}
- *h = ct.ahsl.hue == USHRT_MAX ? qreal(-1.0) : ct.ahsl.hue / qreal(36000.0);
- *s = ct.ahsl.saturation / qreal(USHRT_MAX);
- *l = ct.ahsl.lightness / qreal(USHRT_MAX);
+ *h = ct.ahsl.hue == USHRT_MAX ? -1.0f : ct.ahsl.hue / 36000.0f;
+ *s = ct.ahsl.saturation / float(USHRT_MAX);
+ *l = ct.ahsl.lightness / float(USHRT_MAX);
if (a)
- *a = ct.ahsl.alpha / qreal(USHRT_MAX);
+ *a = ct.ahsl.alpha / float(USHRT_MAX);
}
/*!
@@ -1164,11 +1165,11 @@ void QColor::getHsl(int *h, int *s, int *l, int *a) const
}
*h = ct.ahsl.hue == USHRT_MAX ? -1 : ct.ahsl.hue / 100;
- *s = ct.ahsl.saturation >> 8;
- *l = ct.ahsl.lightness >> 8;
+ *s = qt_div_257(ct.ahsl.saturation);
+ *l = qt_div_257(ct.ahsl.lightness);
if (a)
- *a = ct.ahsl.alpha >> 8;
+ *a = qt_div_257(ct.ahsl.alpha);
}
/*!
@@ -1181,12 +1182,12 @@ void QColor::getHsl(int *h, int *s, int *l, int *a) const
\sa getHslF(), setHsl()
*/
-void QColor::setHslF(qreal h, qreal s, qreal l, qreal a)
+void QColor::setHslF(float h, float s, float l, float a)
{
- if (((h < qreal(0.0) || h > qreal(1.0)) && h != qreal(-1.0))
- || (s < qreal(0.0) || s > qreal(1.0))
- || (l < qreal(0.0) || l > qreal(1.0))
- || (a < qreal(0.0) || a > qreal(1.0))) {
+ if (((h < 0.0f || h > 1.0f) && h != -1.0f)
+ || (s < 0.0f || s > 1.0f)
+ || (l < 0.0f || l > 1.0f)
+ || (a < 0.0f || a > 1.0f)) {
qWarning("QColor::setHslF: HSL parameters out of range");
invalidate();
return;
@@ -1194,7 +1195,7 @@ void QColor::setHslF(qreal h, qreal s, qreal l, qreal a)
cspec = Hsl;
ct.ahsl.alpha = qRound(a * USHRT_MAX);
- ct.ahsl.hue = h == qreal(-1.0) ? USHRT_MAX : qRound(h * 36000);
+ ct.ahsl.hue = h == -1.0f ? USHRT_MAX : qRound(h * 36000.0f);
ct.ahsl.saturation = qRound(s * USHRT_MAX);
ct.ahsl.lightness = qRound(l * USHRT_MAX);
ct.ahsl.pad = 0;
@@ -1248,25 +1249,22 @@ static inline const qfloat16 &castF16(const quint16 &v)
\sa rgb(), setRgb()
*/
-void QColor::getRgbF(qreal *r, qreal *g, qreal *b, qreal *a) const
+void QColor::getRgbF(float *r, float *g, float *b, float *a) const
{
if (!r || !g || !b)
return;
- if (cspec == Invalid)
- return;
-
- if (cspec != Rgb && cspec != ExtendedRgb) {
+ if (cspec != Invalid && cspec != Rgb && cspec != ExtendedRgb) {
toRgb().getRgbF(r, g, b, a);
return;
}
- if (cspec == Rgb) {
- *r = ct.argb.red / qreal(USHRT_MAX);
- *g = ct.argb.green / qreal(USHRT_MAX);
- *b = ct.argb.blue / qreal(USHRT_MAX);
+ if (cspec == Rgb || cspec == Invalid) {
+ *r = ct.argb.red / float(USHRT_MAX);
+ *g = ct.argb.green / float(USHRT_MAX);
+ *b = ct.argb.blue / float(USHRT_MAX);
if (a)
- *a = ct.argb.alpha / qreal(USHRT_MAX);
+ *a = ct.argb.alpha / float(USHRT_MAX);
} else {
*r = castF16(ct.argbExtended.redF16);
*g = castF16(ct.argbExtended.greenF16);
@@ -1296,16 +1294,16 @@ void QColor::getRgb(int *r, int *g, int *b, int *a) const
return;
}
- *r = ct.argb.red >> 8;
- *g = ct.argb.green >> 8;
- *b = ct.argb.blue >> 8;
+ *r = qt_div_257(ct.argb.red);
+ *g = qt_div_257(ct.argb.green);
+ *b = qt_div_257(ct.argb.blue);
if (a)
- *a = ct.argb.alpha >> 8;
+ *a = qt_div_257(ct.argb.alpha);
}
/*!
- \fn void QColor::setRgbF(qreal r, qreal g, qreal b, qreal a)
+ \fn void QColor::setRgbF(float r, float g, float b, float a)
Sets the color channels of this color to \a r (red), \a g (green),
\a b (blue) and \a a (alpha, transparency).
@@ -1316,16 +1314,16 @@ void QColor::getRgb(int *r, int *g, int *b, int *a) const
\sa rgb(), getRgbF(), setRgb()
*/
-void QColor::setRgbF(qreal r, qreal g, qreal b, qreal a)
+void QColor::setRgbF(float r, float g, float b, float a)
{
- if (a < qreal(0.0) || a > qreal(1.0)) {
+ if (a < 0.0f || a > 1.0f) {
qWarning("QColor::setRgbF: Alpha parameter is out of range");
invalidate();
return;
}
- if (r < qreal(0.0) || r > qreal(1.0) ||
- g < qreal(0.0) || g > qreal(1.0) ||
- b < qreal(0.0) || b > qreal(1.0) || cspec == ExtendedRgb) {
+ if (r < 0.0f || r > 1.0f ||
+ g < 0.0f || g > 1.0f ||
+ b < 0.0f || b > 1.0f || cspec == ExtendedRgb) {
cspec = ExtendedRgb;
castF16(ct.argbExtended.redF16) = qfloat16(r);
castF16(ct.argbExtended.greenF16) = qfloat16(g);
@@ -1379,7 +1377,7 @@ QRgb QColor::rgba() const noexcept
{
if (cspec != Invalid && cspec != Rgb)
return toRgb().rgba();
- return qRgba(ct.argb.red >> 8, ct.argb.green >> 8, ct.argb.blue >> 8, ct.argb.alpha >> 8);
+ return qRgba(qt_div_257(ct.argb.red), qt_div_257(ct.argb.green), qt_div_257(ct.argb.blue), qt_div_257(ct.argb.alpha));
}
/*!
@@ -1442,7 +1440,7 @@ QRgb QColor::rgb() const noexcept
{
if (cspec != Invalid && cspec != Rgb)
return toRgb().rgb();
- return qRgb(ct.argb.red >> 8, ct.argb.green >> 8, ct.argb.blue >> 8);
+ return qRgb(qt_div_257(ct.argb.red), qt_div_257(ct.argb.green), qt_div_257(ct.argb.blue));
}
/*!
@@ -1468,8 +1466,8 @@ void QColor::setRgb(QRgb rgb) noexcept
int QColor::alpha() const noexcept
{
if (cspec == ExtendedRgb)
- return qRound(qreal(castF16(ct.argbExtended.alphaF16)) * 255);
- return ct.argb.alpha >> 8;
+ return qRound(float(castF16(ct.argbExtended.alphaF16)) * 255);
+ return qt_div_257(ct.argb.alpha);
}
@@ -1484,8 +1482,8 @@ void QColor::setAlpha(int alpha)
{
QCOLOR_INT_RANGE_CHECK("QColor::setAlpha", alpha);
if (cspec == ExtendedRgb) {
- constexpr qreal f = qreal(1.0) / 255;
- castF16(ct.argbExtended.alphaF16) = alpha * f;
+ constexpr float f = 1.0f / 255;
+ castF16(ct.argbExtended.alphaF16) = qfloat16(alpha * f);
return;
}
ct.argb.alpha = alpha * 0x101;
@@ -1496,28 +1494,28 @@ void QColor::setAlpha(int alpha)
\sa setAlphaF(), alpha(), {QColor#Alpha-Blended Drawing}{Alpha-Blended Drawing}
*/
-qreal QColor::alphaF() const noexcept
+float QColor::alphaF() const noexcept
{
if (cspec == ExtendedRgb)
return castF16(ct.argbExtended.alphaF16);
- return ct.argb.alpha / qreal(USHRT_MAX);
+ return ct.argb.alpha / float(USHRT_MAX);
}
/*!
- Sets the alpha of this color to \a alpha. qreal alpha is specified in the
+ Sets the alpha of this color to \a alpha. float alpha is specified in the
range 0.0-1.0.
\sa alphaF(), alpha(), {QColor#Alpha-Blended Drawing}{Alpha-Blended Drawing}
*/
-void QColor::setAlphaF(qreal alpha)
+void QColor::setAlphaF(float alpha)
{
QCOLOR_REAL_RANGE_CHECK("QColor::setAlphaF", alpha);
if (cspec == ExtendedRgb) {
- castF16(ct.argbExtended.alphaF16) = alpha;
+ castF16(ct.argbExtended.alphaF16) = qfloat16(alpha);
return;
}
- qreal tmp = alpha * USHRT_MAX;
+ float tmp = alpha * USHRT_MAX;
ct.argb.alpha = qRound(tmp);
}
@@ -1531,7 +1529,7 @@ int QColor::red() const noexcept
{
if (cspec != Invalid && cspec != Rgb)
return toRgb().red();
- return ct.argb.red >> 8;
+ return qt_div_257(ct.argb.red);
}
/*!
@@ -1558,7 +1556,7 @@ int QColor::green() const noexcept
{
if (cspec != Invalid && cspec != Rgb)
return toRgb().green();
- return ct.argb.green >> 8;
+ return qt_div_257(ct.argb.green);
}
/*!
@@ -1586,7 +1584,7 @@ int QColor::blue() const noexcept
{
if (cspec != Invalid && cspec != Rgb)
return toRgb().blue();
- return ct.argb.blue >> 8;
+ return qt_div_257(ct.argb.blue);
}
@@ -1610,10 +1608,10 @@ void QColor::setBlue(int blue)
\sa setRedF(), red(), getRgbF()
*/
-qreal QColor::redF() const noexcept
+float QColor::redF() const noexcept
{
if (cspec == Rgb || cspec == Invalid)
- return ct.argb.red / qreal(USHRT_MAX);
+ return ct.argb.red / float(USHRT_MAX);
if (cspec == ExtendedRgb)
return castF16(ct.argbExtended.redF16);
@@ -1627,12 +1625,12 @@ qreal QColor::redF() const noexcept
\sa redF(), red(), setRgbF()
*/
-void QColor::setRedF(qreal red)
+void QColor::setRedF(float red)
{
- if (cspec == Rgb && red >= qreal(0.0) && red <= qreal(1.0))
+ if (cspec == Rgb && red >= 0.0f && red <= 1.0f)
ct.argb.red = qRound(red * USHRT_MAX);
else if (cspec == ExtendedRgb)
- castF16(ct.argbExtended.redF16) = red;
+ castF16(ct.argbExtended.redF16) = qfloat16(red);
else
setRgbF(red, greenF(), blueF(), alphaF());
}
@@ -1642,10 +1640,10 @@ void QColor::setRedF(qreal red)
\sa setGreenF(), green(), getRgbF()
*/
-qreal QColor::greenF() const noexcept
+float QColor::greenF() const noexcept
{
if (cspec == Rgb || cspec == Invalid)
- return ct.argb.green / qreal(USHRT_MAX);
+ return ct.argb.green / float(USHRT_MAX);
if (cspec == ExtendedRgb)
return castF16(ct.argbExtended.greenF16);
@@ -1659,12 +1657,12 @@ qreal QColor::greenF() const noexcept
\sa greenF(), green(), setRgbF()
*/
-void QColor::setGreenF(qreal green)
+void QColor::setGreenF(float green)
{
- if (cspec == Rgb && green >= qreal(0.0) && green <= qreal(1.0))
+ if (cspec == Rgb && green >= 0.0f && green <= 1.0f)
ct.argb.green = qRound(green * USHRT_MAX);
else if (cspec == ExtendedRgb)
- castF16(ct.argbExtended.greenF16) = green;
+ castF16(ct.argbExtended.greenF16) = qfloat16(green);
else
setRgbF(redF(), green, blueF(), alphaF());
}
@@ -1674,10 +1672,10 @@ void QColor::setGreenF(qreal green)
\sa setBlueF(), blue(), getRgbF()
*/
-qreal QColor::blueF() const noexcept
+float QColor::blueF() const noexcept
{
if (cspec == Rgb || cspec == Invalid)
- return ct.argb.blue / qreal(USHRT_MAX);
+ return ct.argb.blue / float(USHRT_MAX);
if (cspec == ExtendedRgb)
return castF16(ct.argbExtended.blueF16);
@@ -1689,12 +1687,12 @@ qreal QColor::blueF() const noexcept
the 0.0-1.0 range, the color model will be changed to \c ExtendedRgb.
\sa blueF(), blue(), setRgbF()
*/
-void QColor::setBlueF(qreal blue)
+void QColor::setBlueF(float blue)
{
- if (cspec == Rgb && blue >= qreal(0.0) && blue <= qreal(1.0))
+ if (cspec == Rgb && blue >= 0.0f && blue <= 1.0f)
ct.argb.blue = qRound(blue * USHRT_MAX);
else if (cspec == ExtendedRgb)
- castF16(ct.argbExtended.blueF16) = blue;
+ castF16(ct.argbExtended.blueF16) = qfloat16(blue);
else
setRgbF(redF(), greenF(), blue, alphaF());
}
@@ -1747,7 +1745,7 @@ int QColor::hsvSaturation() const noexcept
{
if (cspec != Invalid && cspec != Hsv)
return toHsv().saturation();
- return ct.ahsv.saturation >> 8;
+ return qt_div_257(ct.ahsv.saturation);
}
/*!
@@ -1759,7 +1757,7 @@ int QColor::value() const noexcept
{
if (cspec != Invalid && cspec != Hsv)
return toHsv().value();
- return ct.ahsv.value >> 8;
+ return qt_div_257(ct.ahsv.value);
}
/*!
@@ -1769,7 +1767,7 @@ int QColor::value() const noexcept
\sa hsvHueF(), hslHueF(), hue(), getHsvF(), {QColor#The HSV Color Model}{The HSV Color Model}
*/
-qreal QColor::hueF() const noexcept
+float QColor::hueF() const noexcept
{
return hsvHueF();
}
@@ -1780,11 +1778,11 @@ qreal QColor::hueF() const noexcept
\sa hue(), hslHueF(), getHsvF(), {QColor#The HSV Color Model}{The HSV Color
Model}
*/
-qreal QColor::hsvHueF() const noexcept
+float QColor::hsvHueF() const noexcept
{
if (cspec != Invalid && cspec != Hsv)
return toHsv().hueF();
- return ct.ahsv.hue == USHRT_MAX ? qreal(-1.0) : ct.ahsv.hue / qreal(36000.0);
+ return ct.ahsv.hue == USHRT_MAX ? -1.0f : ct.ahsv.hue / 36000.0f;
}
/*!
@@ -1795,7 +1793,7 @@ qreal QColor::hsvHueF() const noexcept
\sa hsvSaturationF(), hslSaturationF(), saturation(), getHsvF(), {QColor#The HSV Color Model}{The HSV Color
Model}
*/
-qreal QColor::saturationF() const noexcept
+float QColor::saturationF() const noexcept
{
return hsvSaturationF();
}
@@ -1805,11 +1803,11 @@ qreal QColor::saturationF() const noexcept
\sa saturation(), hslSaturationF(), getHsvF(), {QColor#The HSV Color Model}{The HSV Color Model}
*/
-qreal QColor::hsvSaturationF() const noexcept
+float QColor::hsvSaturationF() const noexcept
{
if (cspec != Invalid && cspec != Hsv)
return toHsv().saturationF();
- return ct.ahsv.saturation / qreal(USHRT_MAX);
+ return ct.ahsv.saturation / float(USHRT_MAX);
}
/*!
@@ -1817,11 +1815,11 @@ qreal QColor::hsvSaturationF() const noexcept
\sa value(), getHsvF(), {QColor#The HSV Color Model}{The HSV Color Model}
*/
-qreal QColor::valueF() const noexcept
+float QColor::valueF() const noexcept
{
if (cspec != Invalid && cspec != Hsv)
return toHsv().valueF();
- return ct.ahsv.value / qreal(USHRT_MAX);
+ return ct.ahsv.value / float(USHRT_MAX);
}
/*!
@@ -1849,7 +1847,7 @@ int QColor::hslSaturation() const noexcept
{
if (cspec != Invalid && cspec != Hsl)
return toHsl().hslSaturation();
- return ct.ahsl.saturation >> 8;
+ return qt_div_257(ct.ahsl.saturation);
}
/*!
@@ -1863,7 +1861,7 @@ int QColor::lightness() const noexcept
{
if (cspec != Invalid && cspec != Hsl)
return toHsl().lightness();
- return ct.ahsl.lightness >> 8;
+ return qt_div_257(ct.ahsl.lightness);
}
/*!
@@ -1873,11 +1871,11 @@ int QColor::lightness() const noexcept
\sa hslHue(), hsvHueF(), getHslF()
*/
-qreal QColor::hslHueF() const noexcept
+float QColor::hslHueF() const noexcept
{
if (cspec != Invalid && cspec != Hsl)
return toHsl().hslHueF();
- return ct.ahsl.hue == USHRT_MAX ? qreal(-1.0) : ct.ahsl.hue / qreal(36000.0);
+ return ct.ahsl.hue == USHRT_MAX ? -1.0f : ct.ahsl.hue / 36000.0f;
}
/*!
@@ -1887,11 +1885,11 @@ qreal QColor::hslHueF() const noexcept
\sa hslSaturation(), hsvSaturationF(), getHslF(), {QColor#The HSL Color Model}{The HSL Color Model}
*/
-qreal QColor::hslSaturationF() const noexcept
+float QColor::hslSaturationF() const noexcept
{
if (cspec != Invalid && cspec != Hsl)
return toHsl().hslSaturationF();
- return ct.ahsl.saturation / qreal(USHRT_MAX);
+ return ct.ahsl.saturation / float(USHRT_MAX);
}
/*!
@@ -1901,11 +1899,11 @@ qreal QColor::hslSaturationF() const noexcept
\sa value(), getHslF()
*/
-qreal QColor::lightnessF() const noexcept
+float QColor::lightnessF() const noexcept
{
if (cspec != Invalid && cspec != Hsl)
return toHsl().lightnessF();
- return ct.ahsl.lightness / qreal(USHRT_MAX);
+ return ct.ahsl.lightness / float(USHRT_MAX);
}
/*!
@@ -1917,7 +1915,7 @@ int QColor::cyan() const noexcept
{
if (cspec != Invalid && cspec != Cmyk)
return toCmyk().cyan();
- return ct.acmyk.cyan >> 8;
+ return qt_div_257(ct.acmyk.cyan);
}
/*!
@@ -1929,7 +1927,7 @@ int QColor::magenta() const noexcept
{
if (cspec != Invalid && cspec != Cmyk)
return toCmyk().magenta();
- return ct.acmyk.magenta >> 8;
+ return qt_div_257(ct.acmyk.magenta);
}
/*!
@@ -1941,7 +1939,7 @@ int QColor::yellow() const noexcept
{
if (cspec != Invalid && cspec != Cmyk)
return toCmyk().yellow();
- return ct.acmyk.yellow >> 8;
+ return qt_div_257(ct.acmyk.yellow);
}
/*!
@@ -1954,7 +1952,7 @@ int QColor::black() const noexcept
{
if (cspec != Invalid && cspec != Cmyk)
return toCmyk().black();
- return ct.acmyk.black >> 8;
+ return qt_div_257(ct.acmyk.black);
}
/*!
@@ -1962,11 +1960,11 @@ int QColor::black() const noexcept
\sa cyan(), getCmykF(), {QColor#The CMYK Color Model}{The CMYK Color Model}
*/
-qreal QColor::cyanF() const noexcept
+float QColor::cyanF() const noexcept
{
if (cspec != Invalid && cspec != Cmyk)
return toCmyk().cyanF();
- return ct.acmyk.cyan / qreal(USHRT_MAX);
+ return ct.acmyk.cyan / float(USHRT_MAX);
}
/*!
@@ -1974,11 +1972,11 @@ qreal QColor::cyanF() const noexcept
\sa magenta(), getCmykF(), {QColor#The CMYK Color Model}{The CMYK Color Model}
*/
-qreal QColor::magentaF() const noexcept
+float QColor::magentaF() const noexcept
{
if (cspec != Invalid && cspec != Cmyk)
return toCmyk().magentaF();
- return ct.acmyk.magenta / qreal(USHRT_MAX);
+ return ct.acmyk.magenta / float(USHRT_MAX);
}
/*!
@@ -1986,11 +1984,11 @@ qreal QColor::magentaF() const noexcept
\sa yellow(), getCmykF(), {QColor#The CMYK Color Model}{The CMYK Color Model}
*/
-qreal QColor::yellowF() const noexcept
+float QColor::yellowF() const noexcept
{
if (cspec != Invalid && cspec != Cmyk)
return toCmyk().yellowF();
- return ct.acmyk.yellow / qreal(USHRT_MAX);
+ return ct.acmyk.yellow / float(USHRT_MAX);
}
/*!
@@ -1998,11 +1996,11 @@ qreal QColor::yellowF() const noexcept
\sa black(), getCmykF(), {QColor#The CMYK Color Model}{The CMYK Color Model}
*/
-qreal QColor::blackF() const noexcept
+float QColor::blackF() const noexcept
{
if (cspec != Invalid && cspec != Cmyk)
return toCmyk().blackF();
- return ct.acmyk.black / qreal(USHRT_MAX);
+ return ct.acmyk.black / float(USHRT_MAX);
}
/*!
@@ -2018,7 +2016,7 @@ QColor QColor::toExtendedRgb() const noexcept
if (cspec != Rgb)
return toRgb().toExtendedRgb();
- constexpr qreal f = qreal(1.0) / USHRT_MAX;
+ constexpr float f = 1.0f / USHRT_MAX;
QColor color;
color.cspec = ExtendedRgb;
castF16(color.ct.argbExtended.alphaF16) = qfloat16(ct.argb.alpha * f);
@@ -2055,15 +2053,15 @@ QColor QColor::toRgb() const noexcept
}
// chromatic case
- const qreal h = ct.ahsv.hue == 36000 ? 0 : ct.ahsv.hue / 6000.;
- const qreal s = ct.ahsv.saturation / qreal(USHRT_MAX);
- const qreal v = ct.ahsv.value / qreal(USHRT_MAX);
+ const float h = ct.ahsv.hue == 36000 ? 0.0f : ct.ahsv.hue / 6000.0f;
+ const float s = ct.ahsv.saturation / float(USHRT_MAX);
+ const float v = ct.ahsv.value / float(USHRT_MAX);
const int i = int(h);
- const qreal f = h - i;
- const qreal p = v * (qreal(1.0) - s);
+ const float f = h - i;
+ const float p = v * (1.0f - s);
if (i & 1) {
- const qreal q = v * (qreal(1.0) - (s * f));
+ const float q = v * (1.0f - (s * f));
switch (i) {
case 1:
@@ -2083,7 +2081,7 @@ QColor QColor::toRgb() const noexcept
break;
}
} else {
- const qreal t = v * (qreal(1.0) - (s * (qreal(1.0) - f)));
+ const float t = v * (1.0f - (s * (1.0f - f)));
switch (i) {
case 0:
@@ -2115,34 +2113,34 @@ QColor QColor::toRgb() const noexcept
color.ct.argb.red = color.ct.argb.green = color.ct.argb.blue = 0;
} else {
// chromatic case
- const qreal h = ct.ahsl.hue == 36000 ? 0 : ct.ahsl.hue / 36000.;
- const qreal s = ct.ahsl.saturation / qreal(USHRT_MAX);
- const qreal l = ct.ahsl.lightness / qreal(USHRT_MAX);
+ const float h = ct.ahsl.hue == 36000 ? 0.0f : ct.ahsl.hue / 36000.0f;
+ const float s = ct.ahsl.saturation / float(USHRT_MAX);
+ const float l = ct.ahsl.lightness / float(USHRT_MAX);
- qreal temp2;
- if (l < qreal(0.5))
- temp2 = l * (qreal(1.0) + s);
+ float temp2;
+ if (l < 0.5f)
+ temp2 = l * (1.0f + s);
else
temp2 = l + s - (l * s);
- const qreal temp1 = (qreal(2.0) * l) - temp2;
- qreal temp3[3] = { h + (qreal(1.0) / qreal(3.0)),
+ const float temp1 = (2.0f * l) - temp2;
+ float temp3[3] = { h + (1.0f / 3.0f),
h,
- h - (qreal(1.0) / qreal(3.0)) };
+ h - (1.0f / 3.0f) };
for (int i = 0; i != 3; ++i) {
- if (temp3[i] < qreal(0.0))
- temp3[i] += qreal(1.0);
- else if (temp3[i] > qreal(1.0))
- temp3[i] -= qreal(1.0);
+ if (temp3[i] < 0.0f)
+ temp3[i] += 1.0f;
+ else if (temp3[i] > 1.0f)
+ temp3[i] -= 1.0f;
- const qreal sixtemp3 = temp3[i] * qreal(6.0);
- if (sixtemp3 < qreal(1.0))
+ const float sixtemp3 = temp3[i] * 6.0f;
+ if (sixtemp3 < 1.0f)
color.ct.array[i+1] = qRound((temp1 + (temp2 - temp1) * sixtemp3) * USHRT_MAX);
- else if ((temp3[i] * qreal(2.0)) < qreal(1.0))
+ else if ((temp3[i] * 2.0f) < 1.0f)
color.ct.array[i+1] = qRound(temp2 * USHRT_MAX);
- else if ((temp3[i] * qreal(3.0)) < qreal(2.0))
- color.ct.array[i+1] = qRound((temp1 + (temp2 -temp1) * (qreal(2.0) /qreal(3.0) - temp3[i]) * qreal(6.0)) * USHRT_MAX);
+ else if ((temp3[i] * 3.0f) < 2.0f)
+ color.ct.array[i+1] = qRound((temp1 + (temp2 -temp1) * (2.0f /3.0f - temp3[i]) * 6.0f) * USHRT_MAX);
else
color.ct.array[i+1] = qRound(temp1 * USHRT_MAX);
}
@@ -2154,21 +2152,21 @@ QColor QColor::toRgb() const noexcept
}
case Cmyk:
{
- const qreal c = ct.acmyk.cyan / qreal(USHRT_MAX);
- const qreal m = ct.acmyk.magenta / qreal(USHRT_MAX);
- const qreal y = ct.acmyk.yellow / qreal(USHRT_MAX);
- const qreal k = ct.acmyk.black / qreal(USHRT_MAX);
-
- color.ct.argb.red = qRound((qreal(1.0) - (c * (qreal(1.0) - k) + k)) * USHRT_MAX);
- color.ct.argb.green = qRound((qreal(1.0) - (m * (qreal(1.0) - k) + k)) * USHRT_MAX);
- color.ct.argb.blue = qRound((qreal(1.0) - (y * (qreal(1.0) - k) + k)) * USHRT_MAX);
+ const float c = ct.acmyk.cyan / float(USHRT_MAX);
+ const float m = ct.acmyk.magenta / float(USHRT_MAX);
+ const float y = ct.acmyk.yellow / float(USHRT_MAX);
+ const float k = ct.acmyk.black / float(USHRT_MAX);
+
+ color.ct.argb.red = qRound((1.0f - (c * (1.0f - k) + k)) * USHRT_MAX);
+ color.ct.argb.green = qRound((1.0f - (m * (1.0f - k) + k)) * USHRT_MAX);
+ color.ct.argb.blue = qRound((1.0f - (y * (1.0f - k) + k)) * USHRT_MAX);
break;
}
case ExtendedRgb:
- color.ct.argb.alpha = qRound(USHRT_MAX * qreal(castF16(ct.argbExtended.alphaF16)));
- color.ct.argb.red = qRound(USHRT_MAX * qBound(qreal(0.0), qreal(castF16(ct.argbExtended.redF16)), qreal(1.0)));
- color.ct.argb.green = qRound(USHRT_MAX * qBound(qreal(0.0), qreal(castF16(ct.argbExtended.greenF16)), qreal(1.0)));
- color.ct.argb.blue = qRound(USHRT_MAX * qBound(qreal(0.0), qreal(castF16(ct.argbExtended.blueF16)), qreal(1.0)));
+ color.ct.argb.alpha = qRound(USHRT_MAX * float(castF16(ct.argbExtended.alphaF16)));
+ color.ct.argb.red = qRound(USHRT_MAX * qBound(0.0f, float(castF16(ct.argbExtended.redF16)), 1.0f));
+ color.ct.argb.green = qRound(USHRT_MAX * qBound(0.0f, float(castF16(ct.argbExtended.greenF16)), 1.0f));
+ color.ct.argb.blue = qRound(USHRT_MAX * qBound(0.0f, float(castF16(ct.argbExtended.blueF16)), 1.0f));
break;
default:
break;
@@ -2200,12 +2198,12 @@ QColor QColor::toHsv() const noexcept
color.ct.ahsv.alpha = ct.argb.alpha;
color.ct.ahsv.pad = 0;
- const qreal r = ct.argb.red / qreal(USHRT_MAX);
- const qreal g = ct.argb.green / qreal(USHRT_MAX);
- const qreal b = ct.argb.blue / qreal(USHRT_MAX);
- const qreal max = Q_MAX_3(r, g, b);
- const qreal min = Q_MIN_3(r, g, b);
- const qreal delta = max - min;
+ const float r = ct.argb.red / float(USHRT_MAX);
+ const float g = ct.argb.green / float(USHRT_MAX);
+ const float b = ct.argb.blue / float(USHRT_MAX);
+ const float max = Q_MAX_3(r, g, b);
+ const float min = Q_MIN_3(r, g, b);
+ const float delta = max - min;
color.ct.ahsv.value = qRound(max * USHRT_MAX);
if (qFuzzyIsNull(delta)) {
// achromatic case, hue is undefined
@@ -2213,21 +2211,21 @@ QColor QColor::toHsv() const noexcept
color.ct.ahsv.saturation = 0;
} else {
// chromatic case
- qreal hue = 0;
+ float hue = 0;
color.ct.ahsv.saturation = qRound((delta / max) * USHRT_MAX);
if (qFuzzyCompare(r, max)) {
hue = ((g - b) /delta);
} else if (qFuzzyCompare(g, max)) {
- hue = (qreal(2.0) + (b - r) / delta);
+ hue = (2.0f + (b - r) / delta);
} else if (qFuzzyCompare(b, max)) {
- hue = (qreal(4.0) + (r - g) / delta);
+ hue = (4.0f + (r - g) / delta);
} else {
Q_ASSERT_X(false, "QColor::toHsv", "internal error");
}
- hue *= qreal(60.0);
- if (hue < qreal(0.0))
- hue += qreal(360.0);
- color.ct.ahsv.hue = qRound(hue * 100);
+ hue *= 60.0f;
+ if (hue < 0.0f)
+ hue += 360.0f;
+ color.ct.ahsv.hue = qRound(hue * 100.0f);
}
return color;
@@ -2251,14 +2249,14 @@ QColor QColor::toHsl() const noexcept
color.ct.ahsl.alpha = ct.argb.alpha;
color.ct.ahsl.pad = 0;
- const qreal r = ct.argb.red / qreal(USHRT_MAX);
- const qreal g = ct.argb.green / qreal(USHRT_MAX);
- const qreal b = ct.argb.blue / qreal(USHRT_MAX);
- const qreal max = Q_MAX_3(r, g, b);
- const qreal min = Q_MIN_3(r, g, b);
- const qreal delta = max - min;
- const qreal delta2 = max + min;
- const qreal lightness = qreal(0.5) * delta2;
+ const float r = ct.argb.red / float(USHRT_MAX);
+ const float g = ct.argb.green / float(USHRT_MAX);
+ const float b = ct.argb.blue / float(USHRT_MAX);
+ const float max = Q_MAX_3(r, g, b);
+ const float min = Q_MIN_3(r, g, b);
+ const float delta = max - min;
+ const float delta2 = max + min;
+ const float lightness = 0.5f * delta2;
color.ct.ahsl.lightness = qRound(lightness * USHRT_MAX);
if (qFuzzyIsNull(delta)) {
// achromatic case, hue is undefined
@@ -2266,24 +2264,24 @@ QColor QColor::toHsl() const noexcept
color.ct.ahsl.saturation = 0;
} else {
// chromatic case
- qreal hue = 0;
- if (lightness < qreal(0.5))
+ float hue = 0;
+ if (lightness < 0.5f)
color.ct.ahsl.saturation = qRound((delta / delta2) * USHRT_MAX);
else
- color.ct.ahsl.saturation = qRound((delta / (qreal(2.0) - delta2)) * USHRT_MAX);
+ color.ct.ahsl.saturation = qRound((delta / (2.0f - delta2)) * USHRT_MAX);
if (qFuzzyCompare(r, max)) {
hue = ((g - b) /delta);
} else if (qFuzzyCompare(g, max)) {
- hue = (qreal(2.0) + (b - r) / delta);
+ hue = (2.0f + (b - r) / delta);
} else if (qFuzzyCompare(b, max)) {
- hue = (qreal(4.0) + (r - g) / delta);
+ hue = (4.0f + (r - g) / delta);
} else {
Q_ASSERT_X(false, "QColor::toHsv", "internal error");
}
- hue *= qreal(60.0);
- if (hue < qreal(0.0))
- hue += qreal(360.0);
- color.ct.ahsl.hue = qRound(hue * 100);
+ hue *= 60.0f;
+ if (hue < 0.0f)
+ hue += 360.0f;
+ color.ct.ahsl.hue = qRound(hue * 100.0f);
}
return color;
@@ -2313,18 +2311,18 @@ QColor QColor::toCmyk() const noexcept
color.ct.acmyk.black = USHRT_MAX;
} else {
// rgb -> cmy
- const qreal r = ct.argb.red / qreal(USHRT_MAX);
- const qreal g = ct.argb.green / qreal(USHRT_MAX);
- const qreal b = ct.argb.blue / qreal(USHRT_MAX);
- qreal c = qreal(1.0) - r;
- qreal m = qreal(1.0) - g;
- qreal y = qreal(1.0) - b;
+ const float r = ct.argb.red / float(USHRT_MAX);
+ const float g = ct.argb.green / float(USHRT_MAX);
+ const float b = ct.argb.blue / float(USHRT_MAX);
+ float c = 1.0f - r;
+ float m = 1.0f - g;
+ float y = 1.0f - b;
// cmy -> cmyk
- const qreal k = qMin(c, qMin(m, y));
- c = (c - k) / (qreal(1.0) - k);
- m = (m - k) / (qreal(1.0) - k);
- y = (y - k) / (qreal(1.0) - k);
+ const float k = qMin(c, qMin(m, y));
+ c = (c - k) / (1.0f - k);
+ m = (m - k) / (1.0f - k);
+ y = (y - k) / (1.0f - k);
color.ct.acmyk.cyan = qRound(c * USHRT_MAX);
color.ct.acmyk.magenta = qRound(m * USHRT_MAX);
@@ -2426,16 +2424,16 @@ QColor QColor::fromRgb(int r, int g, int b, int a)
\sa fromRgb(), fromRgba64(), toRgb(), isValid()
*/
-QColor QColor::fromRgbF(qreal r, qreal g, qreal b, qreal a)
+QColor QColor::fromRgbF(float r, float g, float b, float a)
{
- if (a < qreal(0.0) || a > qreal(1.0)) {
+ if (a < 0.0f || a > 1.0f) {
qWarning("QColor::fromRgbF: Alpha parameter out of range");
return QColor();
}
- if (r < qreal(0.0) || r > qreal(1.0)
- || g < qreal(0.0) || g > qreal(1.0)
- || b < qreal(0.0) || b > qreal(1.0)) {
+ if (r < 0.0f || r > 1.0f
+ || g < 0.0f || g > 1.0f
+ || b < 0.0f || b > 1.0f) {
QColor color;
color.cspec = ExtendedRgb;
castF16(color.ct.argbExtended.alphaF16) = qfloat16(a);
@@ -2529,12 +2527,12 @@ QColor QColor::fromHsv(int h, int s, int v, int a)
\sa toHsv(), fromHsv(), isValid(), {QColor#The HSV Color Model}{The HSV Color Model}
*/
-QColor QColor::fromHsvF(qreal h, qreal s, qreal v, qreal a)
+QColor QColor::fromHsvF(float h, float s, float v, float a)
{
- if (((h < qreal(0.0) || h > qreal(1.0)) && h != qreal(-1.0))
- || (s < qreal(0.0) || s > qreal(1.0))
- || (v < qreal(0.0) || v > qreal(1.0))
- || (a < qreal(0.0) || a > qreal(1.0))) {
+ if (((h < 0.0f || h > 1.0f) && h != -1.0f)
+ || (s < 0.0f || s > 1.0f)
+ || (v < 0.0f || v > 1.0f)
+ || (a < 0.0f || a > 1.0f)) {
qWarning("QColor::fromHsvF: HSV parameters out of range");
return QColor();
}
@@ -2542,7 +2540,7 @@ QColor QColor::fromHsvF(qreal h, qreal s, qreal v, qreal a)
QColor color;
color.cspec = Hsv;
color.ct.ahsv.alpha = qRound(a * USHRT_MAX);
- color.ct.ahsv.hue = h == qreal(-1.0) ? USHRT_MAX : qRound(h * 36000);
+ color.ct.ahsv.hue = h == -1.0f ? USHRT_MAX : qRound(h * 36000.0f);
color.ct.ahsv.saturation = qRound(s * USHRT_MAX);
color.ct.ahsv.value = qRound(v * USHRT_MAX);
color.ct.ahsv.pad = 0;
@@ -2593,12 +2591,12 @@ QColor QColor::fromHsl(int h, int s, int l, int a)
\sa toHsl(), fromHsl(), isValid(), {QColor#The HSL Color Model}{The HSL Color Model}
*/
-QColor QColor::fromHslF(qreal h, qreal s, qreal l, qreal a)
+QColor QColor::fromHslF(float h, float s, float l, float a)
{
- if (((h < qreal(0.0) || h > qreal(1.0)) && h != qreal(-1.0))
- || (s < qreal(0.0) || s > qreal(1.0))
- || (l < qreal(0.0) || l > qreal(1.0))
- || (a < qreal(0.0) || a > qreal(1.0))) {
+ if (((h < 0.0f || h > 1.0f) && h != -1.0f)
+ || (s < 0.0f || s > 1.0f)
+ || (l < 0.0f || l > 1.0f)
+ || (a < 0.0f || a > 1.0f)) {
qWarning("QColor::fromHslF: HSL parameters out of range");
return QColor();
}
@@ -2606,7 +2604,7 @@ QColor QColor::fromHslF(qreal h, qreal s, qreal l, qreal a)
QColor color;
color.cspec = Hsl;
color.ct.ahsl.alpha = qRound(a * USHRT_MAX);
- color.ct.ahsl.hue = (h == qreal(-1.0)) ? USHRT_MAX : qRound(h * 36000);
+ color.ct.ahsl.hue = (h == -1.0f) ? USHRT_MAX : qRound(h * 36000.0f);
if (color.ct.ahsl.hue == 36000)
color.ct.ahsl.hue = 0;
color.ct.ahsl.saturation = qRound(s * USHRT_MAX);
@@ -2635,13 +2633,13 @@ void QColor::getCmyk(int *c, int *m, int *y, int *k, int *a) const
return;
}
- *c = ct.acmyk.cyan >> 8;
- *m = ct.acmyk.magenta >> 8;
- *y = ct.acmyk.yellow >> 8;
- *k = ct.acmyk.black >> 8;
+ *c = qt_div_257(ct.acmyk.cyan);
+ *m = qt_div_257(ct.acmyk.magenta);
+ *y = qt_div_257(ct.acmyk.yellow);
+ *k = qt_div_257(ct.acmyk.black);
if (a)
- *a = ct.acmyk.alpha >> 8;
+ *a = qt_div_257(ct.acmyk.alpha);
}
/*!
@@ -2654,7 +2652,7 @@ void QColor::getCmyk(int *c, int *m, int *y, int *k, int *a) const
\sa setCmykF(), {QColor#The CMYK Color Model}{The CMYK Color Model}
*/
-void QColor::getCmykF(qreal *c, qreal *m, qreal *y, qreal *k, qreal *a) const
+void QColor::getCmykF(float *c, float *m, float *y, float *k, float *a) const
{
if (!c || !m || !y || !k)
return;
@@ -2664,13 +2662,13 @@ void QColor::getCmykF(qreal *c, qreal *m, qreal *y, qreal *k, qreal *a) const
return;
}
- *c = ct.acmyk.cyan / qreal(USHRT_MAX);
- *m = ct.acmyk.magenta / qreal(USHRT_MAX);
- *y = ct.acmyk.yellow / qreal(USHRT_MAX);
- *k = ct.acmyk.black / qreal(USHRT_MAX);
+ *c = ct.acmyk.cyan / float(USHRT_MAX);
+ *m = ct.acmyk.magenta / float(USHRT_MAX);
+ *y = ct.acmyk.yellow / float(USHRT_MAX);
+ *k = ct.acmyk.black / float(USHRT_MAX);
if (a)
- *a = ct.acmyk.alpha / qreal(USHRT_MAX);
+ *a = ct.acmyk.alpha / float(USHRT_MAX);
}
/*!
@@ -2711,13 +2709,13 @@ void QColor::setCmyk(int c, int m, int y, int k, int a)
\sa getCmykF(), setCmyk(), {QColor#The CMYK Color Model}{The CMYK Color Model}
*/
-void QColor::setCmykF(qreal c, qreal m, qreal y, qreal k, qreal a)
+void QColor::setCmykF(float c, float m, float y, float k, float a)
{
- if (c < qreal(0.0) || c > qreal(1.0)
- || m < qreal(0.0) || m > qreal(1.0)
- || y < qreal(0.0) || y > qreal(1.0)
- || k < qreal(0.0) || k > qreal(1.0)
- || a < qreal(0.0) || a > qreal(1.0)) {
+ if (c < 0.0f || c > 1.0f
+ || m < 0.0f || m > 1.0f
+ || y < 0.0f || y > 1.0f
+ || k < 0.0f || k > 1.0f
+ || a < 0.0f || a > 1.0f) {
qWarning("QColor::setCmykF: CMYK parameters out of range");
invalidate();
return;
@@ -2772,13 +2770,13 @@ QColor QColor::fromCmyk(int c, int m, int y, int k, int a)
\sa toCmyk(), fromCmyk(), isValid(), {QColor#The CMYK Color Model}{The CMYK Color Model}
*/
-QColor QColor::fromCmykF(qreal c, qreal m, qreal y, qreal k, qreal a)
+QColor QColor::fromCmykF(float c, float m, float y, float k, float a)
{
- if (c < qreal(0.0) || c > qreal(1.0)
- || m < qreal(0.0) || m > qreal(1.0)
- || y < qreal(0.0) || y > qreal(1.0)
- || k < qreal(0.0) || k > qreal(1.0)
- || a < qreal(0.0) || a > qreal(1.0)) {
+ if (c < 0.0f || c > 1.0f
+ || m < 0.0f || m > 1.0f
+ || y < 0.0f || y > 1.0f
+ || k < 0.0f || k > 1.0f
+ || a < 0.0f || a > 1.0f) {
qWarning("QColor::fromCmykF: CMYK parameters out of range");
return QColor();
}
@@ -2870,28 +2868,6 @@ QColor QColor::darker(int factor) const noexcept
return hsv.convertTo(cspec);
}
-#if QT_DEPRECATED_SINCE(5, 13)
-/*!
- \obsolete
-
- Use lighter(\a factor) instead.
-*/
-QColor QColor::light(int factor) const noexcept
-{
- return lighter(factor);
-}
-
-/*!
- \obsolete
-
- Use darker(\a factor) instead.
-*/
-QColor QColor::dark(int factor) const noexcept
-{
- return darker(factor);
-}
-#endif
-
/*! \overload
Assigns a copy of \a color and returns a reference to this color.
*/
@@ -2901,26 +2877,27 @@ QColor &QColor::operator=(Qt::GlobalColor color) noexcept
}
/*!
- Returns \c true if this color has the same RGB and alpha values as \a color;
+ Returns \c true if this color has the same color specification and component values as \a color;
otherwise returns \c false.
+
+ ExtendedRgb and Rgb specifications are considered matching in this context.
+
+ \sa spec()
*/
bool QColor::operator==(const QColor &color) const noexcept
{
- if (cspec == Hsl && cspec == color.cspec) {
- return (ct.argb.alpha == color.ct.argb.alpha
- && ct.ahsl.hue % 36000 == color.ct.ahsl.hue % 36000
- && (qAbs(ct.ahsl.saturation - color.ct.ahsl.saturation) < 50
- || ct.ahsl.lightness == 0
- || color.ct.ahsl.lightness == 0
- || ct.ahsl.lightness == USHRT_MAX
- || color.ct.ahsl.lightness == USHRT_MAX)
- && (qAbs(ct.ahsl.lightness - color.ct.ahsl.lightness)) < 50);
+ if ((cspec == ExtendedRgb || color.cspec == ExtendedRgb) &&
+ (cspec == color.cspec || cspec == Rgb || color.cspec == Rgb)) {
+ return qFuzzyCompare(alphaF(), color.alphaF())
+ && qFuzzyCompare(redF(), color.redF())
+ && qFuzzyCompare(greenF(), color.greenF())
+ && qFuzzyCompare(blueF(), color.blueF());
} else {
return (cspec == color.cspec
&& ct.argb.alpha == color.ct.argb.alpha
- && (((cspec == QColor::Hsv)
+ && (((cspec == QColor::Hsv || cspec == QColor::Hsl)
&& ((ct.ahsv.hue % 36000) == (color.ct.ahsv.hue % 36000)))
- || (ct.ahsv.hue == color.ct.ahsv.hue))
+ || (ct.argb.red == color.ct.argb.red))
&& ct.argb.green == color.ct.argb.green
&& ct.argb.blue == color.ct.argb.blue
&& ct.argb.pad == color.ct.argb.pad);
@@ -2928,8 +2905,12 @@ bool QColor::operator==(const QColor &color) const noexcept
}
/*!
- Returns \c true if this color has a different RGB and alpha values from
+ Returns \c true if this color has different color specification or component values from
\a color; otherwise returns \c false.
+
+ ExtendedRgb and Rgb specifications are considered matching in this context.
+
+ \sa spec()
*/
bool QColor::operator!=(const QColor &color) const noexcept
{ return !operator==(color); }
@@ -2940,7 +2921,7 @@ bool QColor::operator!=(const QColor &color) const noexcept
*/
QColor::operator QVariant() const
{
- return QVariant(QVariant::Color, this);
+ return QVariant::fromValue(*this);
}
/*! \internal
@@ -3146,7 +3127,7 @@ const uint qt_inv_premul_factor[256] = {
Returns the ARGB quadruplet (255, \a{r}, \a{g}, \a{b}).
- \sa qRgba(), qRed(), qGreen(), qBlue()
+ \sa qRgba(), qRed(), qGreen(), qBlue(), qAlpha()
*/
/*!
@@ -3155,7 +3136,7 @@ const uint qt_inv_premul_factor[256] = {
Returns the ARGB quadruplet (\a{a}, \a{r}, \a{g}, \a{b}).
- \sa qRgb(), qRed(), qGreen(), qBlue()
+ \sa qRgb(), qRed(), qGreen(), qBlue(), qAlpha()
*/
/*!
@@ -3218,12 +3199,17 @@ const uint qt_inv_premul_factor[256] = {
channel is \c ff, i.e opaque. For more information, see the
\l{QColor#Alpha-Blended Drawing}{Alpha-Blended Drawing} section.
- \sa QColor::rgb(), QColor::rgba()
+ Here are some examples of how QRgb values can be created:
+
+ \snippet code/src_gui_painting_qcolor.cpp QRgb
+
+ \sa qRgb(), qRgba(), QColor::rgb(), QColor::rgba()
*/
/*!
\namespace QColorConstants
\inmodule QtGui
+ \since 5.14
\brief The QColorConstants namespace contains QColor predefined constants.
diff --git a/src/gui/painting/qcolor.h b/src/gui/painting/qcolor.h
index 423a0ac50f..2d6db1a14c 100644
--- a/src/gui/painting/qcolor.h
+++ b/src/gui/painting/qcolor.h
@@ -1,41 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the QtGui module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2020 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#ifndef QCOLOR_H
#define QCOLOR_H
@@ -66,40 +30,45 @@ Q_GUI_EXPORT QDataStream &operator>>(QDataStream &, QColor &);
class Q_GUI_EXPORT QColor
{
public:
+ // ### Qt7: make this "enum Spec: quint8 {...}" and reorder the members below for tighter
+ // struct packing. QColor could fit into the inline storage of a QVariant on 32bit.
enum Spec { Invalid, Rgb, Hsv, Cmyk, Hsl, ExtendedRgb };
enum NameFormat { HexRgb, HexArgb };
- Q_DECL_CONSTEXPR QColor() noexcept
+ constexpr QColor() noexcept
: cspec(Invalid), ct(USHRT_MAX, 0, 0, 0, 0) {}
QColor(Qt::GlobalColor color) noexcept;
- Q_DECL_CONSTEXPR QColor(int r, int g, int b, int a = 255) noexcept
+ constexpr QColor(int r, int g, int b, int a = 255) noexcept
: cspec(isRgbaValid(r, g, b, a) ? Rgb : Invalid),
- ct(cspec == Rgb ? a * 0x0101 : 0,
- cspec == Rgb ? r * 0x0101 : 0,
- cspec == Rgb ? g * 0x0101 : 0,
- cspec == Rgb ? b * 0x0101 : 0,
+ ct(ushort(cspec == Rgb ? a * 0x0101 : 0),
+ ushort(cspec == Rgb ? r * 0x0101 : 0),
+ ushort(cspec == Rgb ? g * 0x0101 : 0),
+ ushort(cspec == Rgb ? b * 0x0101 : 0),
0) {}
QColor(QRgb rgb) noexcept;
QColor(QRgba64 rgba64) noexcept;
-#if QT_STRINGVIEW_LEVEL < 2
inline QColor(const QString& name);
-#endif
explicit inline QColor(QStringView name);
- inline QColor(const char *aname) : QColor(QLatin1String(aname)) {}
- inline QColor(QLatin1String name);
+ inline QColor(const char *aname);
+ inline QColor(QLatin1StringView name);
QColor(Spec spec) noexcept;
+ static QColor fromString(QAnyStringView name) noexcept;
+
QColor &operator=(Qt::GlobalColor color) noexcept;
bool isValid() const noexcept;
QString name(NameFormat format = HexRgb) const;
-#if QT_STRINGVIEW_LEVEL < 2
+#if QT_DEPRECATED_SINCE(6, 6)
+ QT_DEPRECATED_VERSION_X_6_6("Use fromString() instead.")
void setNamedColor(const QString& name);
-#endif
+ QT_DEPRECATED_VERSION_X_6_6("Use fromString() instead.")
void setNamedColor(QStringView name);
- void setNamedColor(QLatin1String name);
+ QT_DEPRECATED_VERSION_X_6_6("Use fromString() instead.")
+ void setNamedColor(QLatin1StringView name);
+#endif
static QStringList colorNames();
@@ -109,8 +78,8 @@ public:
int alpha() const noexcept;
void setAlpha(int alpha);
- qreal alphaF() const noexcept;
- void setAlphaF(qreal alpha);
+ float alphaF() const noexcept;
+ void setAlphaF(float alpha);
int red() const noexcept;
int green() const noexcept;
@@ -119,18 +88,18 @@ public:
void setGreen(int green);
void setBlue(int blue);
- qreal redF() const noexcept;
- qreal greenF() const noexcept;
- qreal blueF() const noexcept;
- void setRedF(qreal red);
- void setGreenF(qreal green);
- void setBlueF(qreal blue);
+ float redF() const noexcept;
+ float greenF() const noexcept;
+ float blueF() const noexcept;
+ void setRedF(float red);
+ void setGreenF(float green);
+ void setBlueF(float blue);
void getRgb(int *r, int *g, int *b, int *a = nullptr) const;
void setRgb(int r, int g, int b, int a = 255);
- void getRgbF(qreal *r, qreal *g, qreal *b, qreal *a = nullptr) const;
- void setRgbF(qreal r, qreal g, qreal b, qreal a = 1.0);
+ void getRgbF(float *r, float *g, float *b, float *a = nullptr) const;
+ void setRgbF(float r, float g, float b, float a = 1.0);
QRgba64 rgba64() const noexcept;
void setRgba64(QRgba64 rgba) noexcept;
@@ -147,47 +116,47 @@ public:
int hsvSaturation() const noexcept;
int value() const noexcept;
- qreal hueF() const noexcept; // 0.0 <= hueF < 360.0
- qreal saturationF() const noexcept;
- qreal hsvHueF() const noexcept; // 0.0 <= hueF < 360.0
- qreal hsvSaturationF() const noexcept;
- qreal valueF() const noexcept;
+ float hueF() const noexcept; // 0.0 <= hueF < 360.0
+ float saturationF() const noexcept;
+ float hsvHueF() const noexcept; // 0.0 <= hueF < 360.0
+ float hsvSaturationF() const noexcept;
+ float valueF() const noexcept;
void getHsv(int *h, int *s, int *v, int *a = nullptr) const;
void setHsv(int h, int s, int v, int a = 255);
- void getHsvF(qreal *h, qreal *s, qreal *v, qreal *a = nullptr) const;
- void setHsvF(qreal h, qreal s, qreal v, qreal a = 1.0);
+ void getHsvF(float *h, float *s, float *v, float *a = nullptr) const;
+ void setHsvF(float h, float s, float v, float a = 1.0);
int cyan() const noexcept;
int magenta() const noexcept;
int yellow() const noexcept;
int black() const noexcept;
- qreal cyanF() const noexcept;
- qreal magentaF() const noexcept;
- qreal yellowF() const noexcept;
- qreal blackF() const noexcept;
+ float cyanF() const noexcept;
+ float magentaF() const noexcept;
+ float yellowF() const noexcept;
+ float blackF() const noexcept;
void getCmyk(int *c, int *m, int *y, int *k, int *a = nullptr) const;
void setCmyk(int c, int m, int y, int k, int a = 255);
- void getCmykF(qreal *c, qreal *m, qreal *y, qreal *k, qreal *a = nullptr) const;
- void setCmykF(qreal c, qreal m, qreal y, qreal k, qreal a = 1.0);
+ void getCmykF(float *c, float *m, float *y, float *k, float *a = nullptr) const;
+ void setCmykF(float c, float m, float y, float k, float a = 1.0);
int hslHue() const noexcept; // 0 <= hue < 360
int hslSaturation() const noexcept;
int lightness() const noexcept;
- qreal hslHueF() const noexcept; // 0.0 <= hueF < 360.0
- qreal hslSaturationF() const noexcept;
- qreal lightnessF() const noexcept;
+ float hslHueF() const noexcept; // 0.0 <= hueF < 360.0
+ float hslSaturationF() const noexcept;
+ float lightnessF() const noexcept;
void getHsl(int *h, int *s, int *l, int *a = nullptr) const;
void setHsl(int h, int s, int l, int a = 255);
- void getHslF(qreal *h, qreal *s, qreal *l, qreal *a = nullptr) const;
- void setHslF(qreal h, qreal s, qreal l, qreal a = 1.0);
+ void getHslF(float *h, float *s, float *l, float *a = nullptr) const;
+ void setHslF(float h, float s, float l, float a = 1.0);
QColor toRgb() const noexcept;
QColor toHsv() const noexcept;
@@ -195,53 +164,49 @@ public:
QColor toHsl() const noexcept;
QColor toExtendedRgb() const noexcept;
- Q_REQUIRED_RESULT QColor convertTo(Spec colorSpec) const noexcept;
+ [[nodiscard]] QColor convertTo(Spec colorSpec) const noexcept;
static QColor fromRgb(QRgb rgb) noexcept;
static QColor fromRgba(QRgb rgba) noexcept;
static QColor fromRgb(int r, int g, int b, int a = 255);
- static QColor fromRgbF(qreal r, qreal g, qreal b, qreal a = 1.0);
+ static QColor fromRgbF(float r, float g, float b, float a = 1.0);
static QColor fromRgba64(ushort r, ushort g, ushort b, ushort a = USHRT_MAX) noexcept;
static QColor fromRgba64(QRgba64 rgba) noexcept;
static QColor fromHsv(int h, int s, int v, int a = 255);
- static QColor fromHsvF(qreal h, qreal s, qreal v, qreal a = 1.0);
+ static QColor fromHsvF(float h, float s, float v, float a = 1.0);
static QColor fromCmyk(int c, int m, int y, int k, int a = 255);
- static QColor fromCmykF(qreal c, qreal m, qreal y, qreal k, qreal a = 1.0);
+ static QColor fromCmykF(float c, float m, float y, float k, float a = 1.0);
static QColor fromHsl(int h, int s, int l, int a = 255);
- static QColor fromHslF(qreal h, qreal s, qreal l, qreal a = 1.0);
+ static QColor fromHslF(float h, float s, float l, float a = 1.0);
-#if QT_DEPRECATED_SINCE(5, 13)
- QT_DEPRECATED_X("Use QColor::lighter() instead")
- Q_REQUIRED_RESULT QColor light(int f = 150) const noexcept;
- QT_DEPRECATED_X("Use QColor::darker() instead")
- Q_REQUIRED_RESULT QColor dark(int f = 200) const noexcept;
-#endif
- Q_REQUIRED_RESULT QColor lighter(int f = 150) const noexcept;
- Q_REQUIRED_RESULT QColor darker(int f = 200) const noexcept;
+ [[nodiscard]] QColor lighter(int f = 150) const noexcept;
+ [[nodiscard]] QColor darker(int f = 200) const noexcept;
bool operator==(const QColor &c) const noexcept;
bool operator!=(const QColor &c) const noexcept;
operator QVariant() const;
-#if QT_STRINGVIEW_LEVEL < 2
+#if QT_DEPRECATED_SINCE(6, 6)
+ QT_DEPRECATED_VERSION_X_6_6("Use isValidColorName() instead.")
static bool isValidColor(const QString &name);
-#endif
+ QT_DEPRECATED_VERSION_X_6_6("Use isValidColorName() instead.")
static bool isValidColor(QStringView) noexcept;
- static bool isValidColor(QLatin1String) noexcept;
+ QT_DEPRECATED_VERSION_X_6_6("Use isValidColorName() instead.")
+ static bool isValidColor(QLatin1StringView) noexcept;
+#endif
+ static bool isValidColorName(QAnyStringView) noexcept;
private:
void invalidate() noexcept;
- template <typename String>
- bool setColorFromString(String name);
- static Q_DECL_CONSTEXPR bool isRgbaValid(int r, int g, int b, int a = 255) noexcept Q_DECL_CONST_FUNCTION
+ static constexpr bool isRgbaValid(int r, int g, int b, int a = 255) noexcept Q_DECL_CONST_FUNCTION
{
return uint(r) <= 255 && uint(g) <= 255 && uint(b) <= 255 && uint(a) <= 255;
}
@@ -250,7 +215,7 @@ private:
union CT {
#ifdef Q_COMPILER_UNIFORM_INIT
CT() {} // doesn't init anything, thus can't be constexpr
- Q_DECL_CONSTEXPR explicit CT(ushort a1, ushort a2, ushort a3, ushort a4, ushort a5) noexcept
+ constexpr explicit CT(ushort a1, ushort a2, ushort a3, ushort a4, ushort a5) noexcept
: array{a1, a2, a3, a4, a5} {}
#endif
struct {
@@ -299,205 +264,201 @@ private:
#ifdef Q_COMPILER_UNIFORM_INIT
public: // can't give friendship to a namespace, so it needs to be public
- Q_DECL_CONSTEXPR explicit QColor(Spec spec, ushort a1, ushort a2, ushort a3, ushort a4, ushort a5=0) noexcept
+ constexpr explicit QColor(Spec spec, ushort a1, ushort a2, ushort a3, ushort a4, ushort a5=0) noexcept
: cspec(spec), ct(a1, a2, a3, a4, a5) {}
#endif // Q_COMPILER_UNIFORM_INIT
};
-Q_DECLARE_TYPEINFO(QColor, QT_VERSION >= QT_VERSION_CHECK(6,0,0) ? Q_MOVABLE_TYPE : Q_RELOCATABLE_TYPE);
+Q_DECLARE_TYPEINFO(QColor, Q_RELOCATABLE_TYPE);
-inline QColor::QColor(QLatin1String aname)
-{ setNamedColor(aname); }
+inline QColor::QColor(QLatin1StringView aname)
+ : QColor(fromString(aname)) {}
inline QColor::QColor(QStringView aname)
-{ setNamedColor(aname); }
+ : QColor(fromString(aname)) {}
-#if QT_STRINGVIEW_LEVEL < 2
inline QColor::QColor(const QString& aname)
-{ setNamedColor(aname); }
-#endif
+ : QColor(fromString(aname)) {}
+
+inline QColor::QColor(const char *aname)
+ : QColor(fromString(aname)) {}
inline bool QColor::isValid() const noexcept
{ return cspec != Invalid; }
-// define these namespaces even if the contents are ifdef'd out
namespace QColorConstants
{
-namespace Svg {}
-
-#if defined(Q_COMPILER_CONSTEXPR) & defined(Q_COMPILER_UNIFORM_INIT)
// Qt::GlobalColor names
- constexpr Q_DECL_UNUSED QColor Color0 {QColor::Rgb, 0xff * 0x101, 0x00 * 0x101, 0x00 * 0x101, 0x00 * 0x101};
- constexpr Q_DECL_UNUSED QColor Color1 {QColor::Rgb, 0xff * 0x101, 0xff * 0x101, 0xff * 0x101, 0xff * 0x101};
- constexpr Q_DECL_UNUSED QColor Black {QColor::Rgb, 0xff * 0x101, 0x00 * 0x101, 0x00 * 0x101, 0x00 * 0x101};
- constexpr Q_DECL_UNUSED QColor White {QColor::Rgb, 0xff * 0x101, 0xff * 0x101, 0xff * 0x101, 0xff * 0x101};
- constexpr Q_DECL_UNUSED QColor DarkGray {QColor::Rgb, 0xff * 0x101, 0x80 * 0x101, 0x80 * 0x101, 0x80 * 0x101};
- constexpr Q_DECL_UNUSED QColor Gray {QColor::Rgb, 0xff * 0x101, 0xa0 * 0x101, 0xa0 * 0x101, 0xa4 * 0x101};
- constexpr Q_DECL_UNUSED QColor LightGray {QColor::Rgb, 0xff * 0x101, 0xc0 * 0x101, 0xc0 * 0x101, 0xc0 * 0x101};
- constexpr Q_DECL_UNUSED QColor Red {QColor::Rgb, 0xff * 0x101, 0xff * 0x101, 0x00 * 0x101, 0x00 * 0x101};
- constexpr Q_DECL_UNUSED QColor Green {QColor::Rgb, 0xff * 0x101, 0x00 * 0x101, 0xff * 0x101, 0x00 * 0x101};
- constexpr Q_DECL_UNUSED QColor Blue {QColor::Rgb, 0xff * 0x101, 0x00 * 0x101, 0x00 * 0x101, 0xff * 0x101};
- constexpr Q_DECL_UNUSED QColor Cyan {QColor::Rgb, 0xff * 0x101, 0x00 * 0x101, 0xff * 0x101, 0xff * 0x101};
- constexpr Q_DECL_UNUSED QColor Magenta {QColor::Rgb, 0xff * 0x101, 0xff * 0x101, 0x00 * 0x101, 0xff * 0x101};
- constexpr Q_DECL_UNUSED QColor Yellow {QColor::Rgb, 0xff * 0x101, 0xff * 0x101, 0xff * 0x101, 0x00 * 0x101};
- constexpr Q_DECL_UNUSED QColor DarkRed {QColor::Rgb, 0xff * 0x101, 0x80 * 0x101, 0x00 * 0x101, 0x00 * 0x101};
- constexpr Q_DECL_UNUSED QColor DarkGreen {QColor::Rgb, 0xff * 0x101, 0x00 * 0x101, 0x80 * 0x101, 0x00 * 0x101};
- constexpr Q_DECL_UNUSED QColor DarkBlue {QColor::Rgb, 0xff * 0x101, 0x00 * 0x101, 0x00 * 0x101, 0x80 * 0x101};
- constexpr Q_DECL_UNUSED QColor DarkCyan {QColor::Rgb, 0xff * 0x101, 0x00 * 0x101, 0x80 * 0x101, 0x80 * 0x101};
- constexpr Q_DECL_UNUSED QColor DarkMagenta {QColor::Rgb, 0xff * 0x101, 0x80 * 0x101, 0x00 * 0x101, 0x80 * 0x101};
- constexpr Q_DECL_UNUSED QColor DarkYellow {QColor::Rgb, 0xff * 0x101, 0x80 * 0x101, 0x80 * 0x101, 0x00 * 0x101};
- constexpr Q_DECL_UNUSED QColor Transparent {QColor::Rgb, 0x00 * 0x101, 0x00 * 0x101, 0x00 * 0x101, 0x00 * 0x101};
+ constexpr inline QColor Color0 {QColor::Rgb, 0xff * 0x101, 0x00 * 0x101, 0x00 * 0x101, 0x00 * 0x101};
+ constexpr inline QColor Color1 {QColor::Rgb, 0xff * 0x101, 0xff * 0x101, 0xff * 0x101, 0xff * 0x101};
+ constexpr inline QColor Black {QColor::Rgb, 0xff * 0x101, 0x00 * 0x101, 0x00 * 0x101, 0x00 * 0x101};
+ constexpr inline QColor White {QColor::Rgb, 0xff * 0x101, 0xff * 0x101, 0xff * 0x101, 0xff * 0x101};
+ constexpr inline QColor DarkGray {QColor::Rgb, 0xff * 0x101, 0x80 * 0x101, 0x80 * 0x101, 0x80 * 0x101};
+ constexpr inline QColor Gray {QColor::Rgb, 0xff * 0x101, 0xa0 * 0x101, 0xa0 * 0x101, 0xa4 * 0x101};
+ constexpr inline QColor LightGray {QColor::Rgb, 0xff * 0x101, 0xc0 * 0x101, 0xc0 * 0x101, 0xc0 * 0x101};
+ constexpr inline QColor Red {QColor::Rgb, 0xff * 0x101, 0xff * 0x101, 0x00 * 0x101, 0x00 * 0x101};
+ constexpr inline QColor Green {QColor::Rgb, 0xff * 0x101, 0x00 * 0x101, 0xff * 0x101, 0x00 * 0x101};
+ constexpr inline QColor Blue {QColor::Rgb, 0xff * 0x101, 0x00 * 0x101, 0x00 * 0x101, 0xff * 0x101};
+ constexpr inline QColor Cyan {QColor::Rgb, 0xff * 0x101, 0x00 * 0x101, 0xff * 0x101, 0xff * 0x101};
+ constexpr inline QColor Magenta {QColor::Rgb, 0xff * 0x101, 0xff * 0x101, 0x00 * 0x101, 0xff * 0x101};
+ constexpr inline QColor Yellow {QColor::Rgb, 0xff * 0x101, 0xff * 0x101, 0xff * 0x101, 0x00 * 0x101};
+ constexpr inline QColor DarkRed {QColor::Rgb, 0xff * 0x101, 0x80 * 0x101, 0x00 * 0x101, 0x00 * 0x101};
+ constexpr inline QColor DarkGreen {QColor::Rgb, 0xff * 0x101, 0x00 * 0x101, 0x80 * 0x101, 0x00 * 0x101};
+ constexpr inline QColor DarkBlue {QColor::Rgb, 0xff * 0x101, 0x00 * 0x101, 0x00 * 0x101, 0x80 * 0x101};
+ constexpr inline QColor DarkCyan {QColor::Rgb, 0xff * 0x101, 0x00 * 0x101, 0x80 * 0x101, 0x80 * 0x101};
+ constexpr inline QColor DarkMagenta {QColor::Rgb, 0xff * 0x101, 0x80 * 0x101, 0x00 * 0x101, 0x80 * 0x101};
+ constexpr inline QColor DarkYellow {QColor::Rgb, 0xff * 0x101, 0x80 * 0x101, 0x80 * 0x101, 0x00 * 0x101};
+ constexpr inline QColor Transparent {QColor::Rgb, 0x00 * 0x101, 0x00 * 0x101, 0x00 * 0x101, 0x00 * 0x101};
// SVG names supported by QColor (see qcolor.cpp).
namespace Svg {
- constexpr Q_DECL_UNUSED QColor aliceblue {QColor::Rgb, 0xff * 0x101, 0xf0 * 0x101, 0xf8 * 0x101, 0xff * 0x101};
- constexpr Q_DECL_UNUSED QColor antiquewhite {QColor::Rgb, 0xff * 0x101, 0xfa * 0x101, 0xeb * 0x101, 0xd7 * 0x101};
- constexpr Q_DECL_UNUSED QColor aqua {QColor::Rgb, 0xff * 0x101, 0x00 * 0x101, 0xff * 0x101, 0xff * 0x101};
- constexpr Q_DECL_UNUSED QColor aquamarine {QColor::Rgb, 0xff * 0x101, 0x7f * 0x101, 0xff * 0x101, 0xd4 * 0x101};
- constexpr Q_DECL_UNUSED QColor azure {QColor::Rgb, 0xff * 0x101, 0xf0 * 0x101, 0xff * 0x101, 0xff * 0x101};
- constexpr Q_DECL_UNUSED QColor beige {QColor::Rgb, 0xff * 0x101, 0xf5 * 0x101, 0xf5 * 0x101, 0xdc * 0x101};
- constexpr Q_DECL_UNUSED QColor bisque {QColor::Rgb, 0xff * 0x101, 0xff * 0x101, 0xe4 * 0x101, 0xc4 * 0x101};
- constexpr Q_DECL_UNUSED QColor black {QColor::Rgb, 0xff * 0x101, 0x00 * 0x101, 0x00 * 0x101, 0x00 * 0x101};
- constexpr Q_DECL_UNUSED QColor blanchedalmond {QColor::Rgb, 0xff * 0x101, 0xff * 0x101, 0xeb * 0x101, 0xcd * 0x101};
- constexpr Q_DECL_UNUSED QColor blue {QColor::Rgb, 0xff * 0x101, 0x00 * 0x101, 0x00 * 0x101, 0xff * 0x101};
- constexpr Q_DECL_UNUSED QColor blueviolet {QColor::Rgb, 0xff * 0x101, 0x8a * 0x101, 0x2b * 0x101, 0xe2 * 0x101};
- constexpr Q_DECL_UNUSED QColor brown {QColor::Rgb, 0xff * 0x101, 0xa5 * 0x101, 0x2a * 0x101, 0x2a * 0x101};
- constexpr Q_DECL_UNUSED QColor burlywood {QColor::Rgb, 0xff * 0x101, 0xde * 0x101, 0xb8 * 0x101, 0x87 * 0x101};
- constexpr Q_DECL_UNUSED QColor cadetblue {QColor::Rgb, 0xff * 0x101, 0x5f * 0x101, 0x9e * 0x101, 0xa0 * 0x101};
- constexpr Q_DECL_UNUSED QColor chartreuse {QColor::Rgb, 0xff * 0x101, 0x7f * 0x101, 0xff * 0x101, 0x00 * 0x101};
- constexpr Q_DECL_UNUSED QColor chocolate {QColor::Rgb, 0xff * 0x101, 0xd2 * 0x101, 0x69 * 0x101, 0x1e * 0x101};
- constexpr Q_DECL_UNUSED QColor coral {QColor::Rgb, 0xff * 0x101, 0xff * 0x101, 0x7f * 0x101, 0x50 * 0x101};
- constexpr Q_DECL_UNUSED QColor cornflowerblue {QColor::Rgb, 0xff * 0x101, 0x64 * 0x101, 0x95 * 0x101, 0xed * 0x101};
- constexpr Q_DECL_UNUSED QColor cornsilk {QColor::Rgb, 0xff * 0x101, 0xff * 0x101, 0xf8 * 0x101, 0xdc * 0x101};
- constexpr Q_DECL_UNUSED QColor crimson {QColor::Rgb, 0xff * 0x101, 0xdc * 0x101, 0x14 * 0x101, 0x3c * 0x101};
- constexpr Q_DECL_UNUSED QColor cyan {QColor::Rgb, 0xff * 0x101, 0x00 * 0x101, 0xff * 0x101, 0xff * 0x101};
- constexpr Q_DECL_UNUSED QColor darkblue {QColor::Rgb, 0xff * 0x101, 0x00 * 0x101, 0x00 * 0x101, 0x8b * 0x101};
- constexpr Q_DECL_UNUSED QColor darkcyan {QColor::Rgb, 0xff * 0x101, 0x00 * 0x101, 0x8b * 0x101, 0x8b * 0x101};
- constexpr Q_DECL_UNUSED QColor darkgoldenrod {QColor::Rgb, 0xff * 0x101, 0xb8 * 0x101, 0x86 * 0x101, 0x0b * 0x101};
- constexpr Q_DECL_UNUSED QColor darkgray {QColor::Rgb, 0xff * 0x101, 0xa9 * 0x101, 0xa9 * 0x101, 0xa9 * 0x101};
- constexpr Q_DECL_UNUSED QColor darkgreen {QColor::Rgb, 0xff * 0x101, 0x00 * 0x101, 0x64 * 0x101, 0x00 * 0x101};
- constexpr Q_DECL_UNUSED QColor darkgrey {QColor::Rgb, 0xff * 0x101, 0xa9 * 0x101, 0xa9 * 0x101, 0xa9 * 0x101};
- constexpr Q_DECL_UNUSED QColor darkkhaki {QColor::Rgb, 0xff * 0x101, 0xbd * 0x101, 0xb7 * 0x101, 0x6b * 0x101};
- constexpr Q_DECL_UNUSED QColor darkmagenta {QColor::Rgb, 0xff * 0x101, 0x8b * 0x101, 0x00 * 0x101, 0x8b * 0x101};
- constexpr Q_DECL_UNUSED QColor darkolivegreen {QColor::Rgb, 0xff * 0x101, 0x55 * 0x101, 0x6b * 0x101, 0x2f * 0x101};
- constexpr Q_DECL_UNUSED QColor darkorange {QColor::Rgb, 0xff * 0x101, 0xff * 0x101, 0x8c * 0x101, 0x00 * 0x101};
- constexpr Q_DECL_UNUSED QColor darkorchid {QColor::Rgb, 0xff * 0x101, 0x99 * 0x101, 0x32 * 0x101, 0xcc * 0x101};
- constexpr Q_DECL_UNUSED QColor darkred {QColor::Rgb, 0xff * 0x101, 0x8b * 0x101, 0x00 * 0x101, 0x00 * 0x101};
- constexpr Q_DECL_UNUSED QColor darksalmon {QColor::Rgb, 0xff * 0x101, 0xe9 * 0x101, 0x96 * 0x101, 0x7a * 0x101};
- constexpr Q_DECL_UNUSED QColor darkseagreen {QColor::Rgb, 0xff * 0x101, 0x8f * 0x101, 0xbc * 0x101, 0x8f * 0x101};
- constexpr Q_DECL_UNUSED QColor darkslateblue {QColor::Rgb, 0xff * 0x101, 0x48 * 0x101, 0x3d * 0x101, 0x8b * 0x101};
- constexpr Q_DECL_UNUSED QColor darkslategray {QColor::Rgb, 0xff * 0x101, 0x2f * 0x101, 0x4f * 0x101, 0x4f * 0x101};
- constexpr Q_DECL_UNUSED QColor darkslategrey {QColor::Rgb, 0xff * 0x101, 0x2f * 0x101, 0x4f * 0x101, 0x4f * 0x101};
- constexpr Q_DECL_UNUSED QColor darkturquoise {QColor::Rgb, 0xff * 0x101, 0x00 * 0x101, 0xce * 0x101, 0xd1 * 0x101};
- constexpr Q_DECL_UNUSED QColor darkviolet {QColor::Rgb, 0xff * 0x101, 0x94 * 0x101, 0x00 * 0x101, 0xd3 * 0x101};
- constexpr Q_DECL_UNUSED QColor deeppink {QColor::Rgb, 0xff * 0x101, 0xff * 0x101, 0x14 * 0x101, 0x93 * 0x101};
- constexpr Q_DECL_UNUSED QColor deepskyblue {QColor::Rgb, 0xff * 0x101, 0x00 * 0x101, 0xbf * 0x101, 0xff * 0x101};
- constexpr Q_DECL_UNUSED QColor dimgray {QColor::Rgb, 0xff * 0x101, 0x69 * 0x101, 0x69 * 0x101, 0x69 * 0x101};
- constexpr Q_DECL_UNUSED QColor dimgrey {QColor::Rgb, 0xff * 0x101, 0x69 * 0x101, 0x69 * 0x101, 0x69 * 0x101};
- constexpr Q_DECL_UNUSED QColor dodgerblue {QColor::Rgb, 0xff * 0x101, 0x1e * 0x101, 0x90 * 0x101, 0xff * 0x101};
- constexpr Q_DECL_UNUSED QColor firebrick {QColor::Rgb, 0xff * 0x101, 0xb2 * 0x101, 0x22 * 0x101, 0x22 * 0x101};
- constexpr Q_DECL_UNUSED QColor floralwhite {QColor::Rgb, 0xff * 0x101, 0xff * 0x101, 0xfa * 0x101, 0xf0 * 0x101};
- constexpr Q_DECL_UNUSED QColor forestgreen {QColor::Rgb, 0xff * 0x101, 0x22 * 0x101, 0x8b * 0x101, 0x22 * 0x101};
- constexpr Q_DECL_UNUSED QColor fuchsia {QColor::Rgb, 0xff * 0x101, 0xff * 0x101, 0x00 * 0x101, 0xff * 0x101};
- constexpr Q_DECL_UNUSED QColor gainsboro {QColor::Rgb, 0xff * 0x101, 0xdc * 0x101, 0xdc * 0x101, 0xdc * 0x101};
- constexpr Q_DECL_UNUSED QColor ghostwhite {QColor::Rgb, 0xff * 0x101, 0xf8 * 0x101, 0xf8 * 0x101, 0xff * 0x101};
- constexpr Q_DECL_UNUSED QColor gold {QColor::Rgb, 0xff * 0x101, 0xff * 0x101, 0xd7 * 0x101, 0x00 * 0x101};
- constexpr Q_DECL_UNUSED QColor goldenrod {QColor::Rgb, 0xff * 0x101, 0xda * 0x101, 0xa5 * 0x101, 0x20 * 0x101};
- constexpr Q_DECL_UNUSED QColor gray {QColor::Rgb, 0xff * 0x101, 0x80 * 0x101, 0x80 * 0x101, 0x80 * 0x101};
- constexpr Q_DECL_UNUSED QColor green {QColor::Rgb, 0xff * 0x101, 0x00 * 0x101, 0x80 * 0x101, 0x00 * 0x101};
- constexpr Q_DECL_UNUSED QColor greenyellow {QColor::Rgb, 0xff * 0x101, 0xad * 0x101, 0xff * 0x101, 0x2f * 0x101};
- constexpr Q_DECL_UNUSED QColor grey {QColor::Rgb, 0xff * 0x101, 0x80 * 0x101, 0x80 * 0x101, 0x80 * 0x101};
- constexpr Q_DECL_UNUSED QColor honeydew {QColor::Rgb, 0xff * 0x101, 0xf0 * 0x101, 0xff * 0x101, 0xf0 * 0x101};
- constexpr Q_DECL_UNUSED QColor hotpink {QColor::Rgb, 0xff * 0x101, 0xff * 0x101, 0x69 * 0x101, 0xb4 * 0x101};
- constexpr Q_DECL_UNUSED QColor indianred {QColor::Rgb, 0xff * 0x101, 0xcd * 0x101, 0x5c * 0x101, 0x5c * 0x101};
- constexpr Q_DECL_UNUSED QColor indigo {QColor::Rgb, 0xff * 0x101, 0x4b * 0x101, 0x00 * 0x101, 0x82 * 0x101};
- constexpr Q_DECL_UNUSED QColor ivory {QColor::Rgb, 0xff * 0x101, 0xff * 0x101, 0xff * 0x101, 0xf0 * 0x101};
- constexpr Q_DECL_UNUSED QColor khaki {QColor::Rgb, 0xff * 0x101, 0xf0 * 0x101, 0xe6 * 0x101, 0x8c * 0x101};
- constexpr Q_DECL_UNUSED QColor lavender {QColor::Rgb, 0xff * 0x101, 0xe6 * 0x101, 0xe6 * 0x101, 0xfa * 0x101};
- constexpr Q_DECL_UNUSED QColor lavenderblush {QColor::Rgb, 0xff * 0x101, 0xff * 0x101, 0xf0 * 0x101, 0xf5 * 0x101};
- constexpr Q_DECL_UNUSED QColor lawngreen {QColor::Rgb, 0xff * 0x101, 0x7c * 0x101, 0xfc * 0x101, 0x00 * 0x101};
- constexpr Q_DECL_UNUSED QColor lemonchiffon {QColor::Rgb, 0xff * 0x101, 0xff * 0x101, 0xfa * 0x101, 0xcd * 0x101};
- constexpr Q_DECL_UNUSED QColor lightblue {QColor::Rgb, 0xff * 0x101, 0xad * 0x101, 0xd8 * 0x101, 0xe6 * 0x101};
- constexpr Q_DECL_UNUSED QColor lightcoral {QColor::Rgb, 0xff * 0x101, 0xf0 * 0x101, 0x80 * 0x101, 0x80 * 0x101};
- constexpr Q_DECL_UNUSED QColor lightcyan {QColor::Rgb, 0xff * 0x101, 0xe0 * 0x101, 0xff * 0x101, 0xff * 0x101};
- constexpr Q_DECL_UNUSED QColor lightgoldenrodyellow {QColor::Rgb, 0xff * 0x101, 0xfa * 0x101, 0xfa * 0x101, 0xd2 * 0x101};
- constexpr Q_DECL_UNUSED QColor lightgray {QColor::Rgb, 0xff * 0x101, 0xd3 * 0x101, 0xd3 * 0x101, 0xd3 * 0x101};
- constexpr Q_DECL_UNUSED QColor lightgreen {QColor::Rgb, 0xff * 0x101, 0x90 * 0x101, 0xee * 0x101, 0x90 * 0x101};
- constexpr Q_DECL_UNUSED QColor lightgrey {QColor::Rgb, 0xff * 0x101, 0xd3 * 0x101, 0xd3 * 0x101, 0xd3 * 0x101};
- constexpr Q_DECL_UNUSED QColor lightpink {QColor::Rgb, 0xff * 0x101, 0xff * 0x101, 0xb6 * 0x101, 0xc1 * 0x101};
- constexpr Q_DECL_UNUSED QColor lightsalmon {QColor::Rgb, 0xff * 0x101, 0xff * 0x101, 0xa0 * 0x101, 0x7a * 0x101};
- constexpr Q_DECL_UNUSED QColor lightseagreen {QColor::Rgb, 0xff * 0x101, 0x20 * 0x101, 0xb2 * 0x101, 0xaa * 0x101};
- constexpr Q_DECL_UNUSED QColor lightskyblue {QColor::Rgb, 0xff * 0x101, 0x87 * 0x101, 0xce * 0x101, 0xfa * 0x101};
- constexpr Q_DECL_UNUSED QColor lightslategray {QColor::Rgb, 0xff * 0x101, 0x77 * 0x101, 0x88 * 0x101, 0x99 * 0x101};
- constexpr Q_DECL_UNUSED QColor lightslategrey {QColor::Rgb, 0xff * 0x101, 0x77 * 0x101, 0x88 * 0x101, 0x99 * 0x101};
- constexpr Q_DECL_UNUSED QColor lightsteelblue {QColor::Rgb, 0xff * 0x101, 0xb0 * 0x101, 0xc4 * 0x101, 0xde * 0x101};
- constexpr Q_DECL_UNUSED QColor lightyellow {QColor::Rgb, 0xff * 0x101, 0xff * 0x101, 0xff * 0x101, 0xe0 * 0x101};
- constexpr Q_DECL_UNUSED QColor lime {QColor::Rgb, 0xff * 0x101, 0x00 * 0x101, 0xff * 0x101, 0x00 * 0x101};
- constexpr Q_DECL_UNUSED QColor limegreen {QColor::Rgb, 0xff * 0x101, 0x32 * 0x101, 0xcd * 0x101, 0x32 * 0x101};
- constexpr Q_DECL_UNUSED QColor linen {QColor::Rgb, 0xff * 0x101, 0xfa * 0x101, 0xf0 * 0x101, 0xe6 * 0x101};
- constexpr Q_DECL_UNUSED QColor magenta {QColor::Rgb, 0xff * 0x101, 0xff * 0x101, 0x00 * 0x101, 0xff * 0x101};
- constexpr Q_DECL_UNUSED QColor maroon {QColor::Rgb, 0xff * 0x101, 0x80 * 0x101, 0x00 * 0x101, 0x00 * 0x101};
- constexpr Q_DECL_UNUSED QColor mediumaquamarine {QColor::Rgb, 0xff * 0x101, 0x66 * 0x101, 0xcd * 0x101, 0xaa * 0x101};
- constexpr Q_DECL_UNUSED QColor mediumblue {QColor::Rgb, 0xff * 0x101, 0x00 * 0x101, 0x00 * 0x101, 0xcd * 0x101};
- constexpr Q_DECL_UNUSED QColor mediumorchid {QColor::Rgb, 0xff * 0x101, 0xba * 0x101, 0x55 * 0x101, 0xd3 * 0x101};
- constexpr Q_DECL_UNUSED QColor mediumpurple {QColor::Rgb, 0xff * 0x101, 0x93 * 0x101, 0x70 * 0x101, 0xdb * 0x101};
- constexpr Q_DECL_UNUSED QColor mediumseagreen {QColor::Rgb, 0xff * 0x101, 0x3c * 0x101, 0xb3 * 0x101, 0x71 * 0x101};
- constexpr Q_DECL_UNUSED QColor mediumslateblue {QColor::Rgb, 0xff * 0x101, 0x7b * 0x101, 0x68 * 0x101, 0xee * 0x101};
- constexpr Q_DECL_UNUSED QColor mediumspringgreen {QColor::Rgb, 0xff * 0x101, 0x00 * 0x101, 0xfa * 0x101, 0x9a * 0x101};
- constexpr Q_DECL_UNUSED QColor mediumturquoise {QColor::Rgb, 0xff * 0x101, 0x48 * 0x101, 0xd1 * 0x101, 0xcc * 0x101};
- constexpr Q_DECL_UNUSED QColor mediumvioletred {QColor::Rgb, 0xff * 0x101, 0xc7 * 0x101, 0x15 * 0x101, 0x85 * 0x101};
- constexpr Q_DECL_UNUSED QColor midnightblue {QColor::Rgb, 0xff * 0x101, 0x19 * 0x101, 0x19 * 0x101, 0x70 * 0x101};
- constexpr Q_DECL_UNUSED QColor mintcream {QColor::Rgb, 0xff * 0x101, 0xf5 * 0x101, 0xff * 0x101, 0xfa * 0x101};
- constexpr Q_DECL_UNUSED QColor mistyrose {QColor::Rgb, 0xff * 0x101, 0xff * 0x101, 0xe4 * 0x101, 0xe1 * 0x101};
- constexpr Q_DECL_UNUSED QColor moccasin {QColor::Rgb, 0xff * 0x101, 0xff * 0x101, 0xe4 * 0x101, 0xb5 * 0x101};
- constexpr Q_DECL_UNUSED QColor navajowhite {QColor::Rgb, 0xff * 0x101, 0xff * 0x101, 0xde * 0x101, 0xad * 0x101};
- constexpr Q_DECL_UNUSED QColor navy {QColor::Rgb, 0xff * 0x101, 0x00 * 0x101, 0x00 * 0x101, 0x80 * 0x101};
- constexpr Q_DECL_UNUSED QColor oldlace {QColor::Rgb, 0xff * 0x101, 0xfd * 0x101, 0xf5 * 0x101, 0xe6 * 0x101};
- constexpr Q_DECL_UNUSED QColor olive {QColor::Rgb, 0xff * 0x101, 0x80 * 0x101, 0x80 * 0x101, 0x00 * 0x101};
- constexpr Q_DECL_UNUSED QColor olivedrab {QColor::Rgb, 0xff * 0x101, 0x6b * 0x101, 0x8e * 0x101, 0x23 * 0x101};
- constexpr Q_DECL_UNUSED QColor orange {QColor::Rgb, 0xff * 0x101, 0xff * 0x101, 0xa5 * 0x101, 0x00 * 0x101};
- constexpr Q_DECL_UNUSED QColor orangered {QColor::Rgb, 0xff * 0x101, 0xff * 0x101, 0x45 * 0x101, 0x00 * 0x101};
- constexpr Q_DECL_UNUSED QColor orchid {QColor::Rgb, 0xff * 0x101, 0xda * 0x101, 0x70 * 0x101, 0xd6 * 0x101};
- constexpr Q_DECL_UNUSED QColor palegoldenrod {QColor::Rgb, 0xff * 0x101, 0xee * 0x101, 0xe8 * 0x101, 0xaa * 0x101};
- constexpr Q_DECL_UNUSED QColor palegreen {QColor::Rgb, 0xff * 0x101, 0x98 * 0x101, 0xfb * 0x101, 0x98 * 0x101};
- constexpr Q_DECL_UNUSED QColor paleturquoise {QColor::Rgb, 0xff * 0x101, 0xaf * 0x101, 0xee * 0x101, 0xee * 0x101};
- constexpr Q_DECL_UNUSED QColor palevioletred {QColor::Rgb, 0xff * 0x101, 0xdb * 0x101, 0x70 * 0x101, 0x93 * 0x101};
- constexpr Q_DECL_UNUSED QColor papayawhip {QColor::Rgb, 0xff * 0x101, 0xff * 0x101, 0xef * 0x101, 0xd5 * 0x101};
- constexpr Q_DECL_UNUSED QColor peachpuff {QColor::Rgb, 0xff * 0x101, 0xff * 0x101, 0xda * 0x101, 0xb9 * 0x101};
- constexpr Q_DECL_UNUSED QColor peru {QColor::Rgb, 0xff * 0x101, 0xcd * 0x101, 0x85 * 0x101, 0x3f * 0x101};
- constexpr Q_DECL_UNUSED QColor pink {QColor::Rgb, 0xff * 0x101, 0xff * 0x101, 0xc0 * 0x101, 0xcb * 0x101};
- constexpr Q_DECL_UNUSED QColor plum {QColor::Rgb, 0xff * 0x101, 0xdd * 0x101, 0xa0 * 0x101, 0xdd * 0x101};
- constexpr Q_DECL_UNUSED QColor powderblue {QColor::Rgb, 0xff * 0x101, 0xb0 * 0x101, 0xe0 * 0x101, 0xe6 * 0x101};
- constexpr Q_DECL_UNUSED QColor purple {QColor::Rgb, 0xff * 0x101, 0x80 * 0x101, 0x00 * 0x101, 0x80 * 0x101};
- constexpr Q_DECL_UNUSED QColor red {QColor::Rgb, 0xff * 0x101, 0xff * 0x101, 0x00 * 0x101, 0x00 * 0x101};
- constexpr Q_DECL_UNUSED QColor rosybrown {QColor::Rgb, 0xff * 0x101, 0xbc * 0x101, 0x8f * 0x101, 0x8f * 0x101};
- constexpr Q_DECL_UNUSED QColor royalblue {QColor::Rgb, 0xff * 0x101, 0x41 * 0x101, 0x69 * 0x101, 0xe1 * 0x101};
- constexpr Q_DECL_UNUSED QColor saddlebrown {QColor::Rgb, 0xff * 0x101, 0x8b * 0x101, 0x45 * 0x101, 0x13 * 0x101};
- constexpr Q_DECL_UNUSED QColor salmon {QColor::Rgb, 0xff * 0x101, 0xfa * 0x101, 0x80 * 0x101, 0x72 * 0x101};
- constexpr Q_DECL_UNUSED QColor sandybrown {QColor::Rgb, 0xff * 0x101, 0xf4 * 0x101, 0xa4 * 0x101, 0x60 * 0x101};
- constexpr Q_DECL_UNUSED QColor seagreen {QColor::Rgb, 0xff * 0x101, 0x2e * 0x101, 0x8b * 0x101, 0x57 * 0x101};
- constexpr Q_DECL_UNUSED QColor seashell {QColor::Rgb, 0xff * 0x101, 0xff * 0x101, 0xf5 * 0x101, 0xee * 0x101};
- constexpr Q_DECL_UNUSED QColor sienna {QColor::Rgb, 0xff * 0x101, 0xa0 * 0x101, 0x52 * 0x101, 0x2d * 0x101};
- constexpr Q_DECL_UNUSED QColor silver {QColor::Rgb, 0xff * 0x101, 0xc0 * 0x101, 0xc0 * 0x101, 0xc0 * 0x101};
- constexpr Q_DECL_UNUSED QColor skyblue {QColor::Rgb, 0xff * 0x101, 0x87 * 0x101, 0xce * 0x101, 0xeb * 0x101};
- constexpr Q_DECL_UNUSED QColor slateblue {QColor::Rgb, 0xff * 0x101, 0x6a * 0x101, 0x5a * 0x101, 0xcd * 0x101};
- constexpr Q_DECL_UNUSED QColor slategray {QColor::Rgb, 0xff * 0x101, 0x70 * 0x101, 0x80 * 0x101, 0x90 * 0x101};
- constexpr Q_DECL_UNUSED QColor slategrey {QColor::Rgb, 0xff * 0x101, 0x70 * 0x101, 0x80 * 0x101, 0x90 * 0x101};
- constexpr Q_DECL_UNUSED QColor snow {QColor::Rgb, 0xff * 0x101, 0xff * 0x101, 0xfa * 0x101, 0xfa * 0x101};
- constexpr Q_DECL_UNUSED QColor springgreen {QColor::Rgb, 0xff * 0x101, 0x00 * 0x101, 0xff * 0x101, 0x7f * 0x101};
- constexpr Q_DECL_UNUSED QColor steelblue {QColor::Rgb, 0xff * 0x101, 0x46 * 0x101, 0x82 * 0x101, 0xb4 * 0x101};
- constexpr Q_DECL_UNUSED QColor tan {QColor::Rgb, 0xff * 0x101, 0xd2 * 0x101, 0xb4 * 0x101, 0x8c * 0x101};
- constexpr Q_DECL_UNUSED QColor teal {QColor::Rgb, 0xff * 0x101, 0x00 * 0x101, 0x80 * 0x101, 0x80 * 0x101};
- constexpr Q_DECL_UNUSED QColor thistle {QColor::Rgb, 0xff * 0x101, 0xd8 * 0x101, 0xbf * 0x101, 0xd8 * 0x101};
- constexpr Q_DECL_UNUSED QColor tomato {QColor::Rgb, 0xff * 0x101, 0xff * 0x101, 0x63 * 0x101, 0x47 * 0x101};
- constexpr Q_DECL_UNUSED QColor turquoise {QColor::Rgb, 0xff * 0x101, 0x40 * 0x101, 0xe0 * 0x101, 0xd0 * 0x101};
- constexpr Q_DECL_UNUSED QColor violet {QColor::Rgb, 0xff * 0x101, 0xee * 0x101, 0x82 * 0x101, 0xee * 0x101};
- constexpr Q_DECL_UNUSED QColor wheat {QColor::Rgb, 0xff * 0x101, 0xf5 * 0x101, 0xde * 0x101, 0xb3 * 0x101};
- constexpr Q_DECL_UNUSED QColor white {QColor::Rgb, 0xff * 0x101, 0xff * 0x101, 0xff * 0x101, 0xff * 0x101};
- constexpr Q_DECL_UNUSED QColor whitesmoke {QColor::Rgb, 0xff * 0x101, 0xf5 * 0x101, 0xf5 * 0x101, 0xf5 * 0x101};
- constexpr Q_DECL_UNUSED QColor yellow {QColor::Rgb, 0xff * 0x101, 0xff * 0x101, 0xff * 0x101, 0x00 * 0x101};
- constexpr Q_DECL_UNUSED QColor yellowgreen {QColor::Rgb, 0xff * 0x101, 0x9a * 0x101, 0xcd * 0x101, 0x32 * 0x101};
+ constexpr inline QColor aliceblue {QColor::Rgb, 0xff * 0x101, 0xf0 * 0x101, 0xf8 * 0x101, 0xff * 0x101};
+ constexpr inline QColor antiquewhite {QColor::Rgb, 0xff * 0x101, 0xfa * 0x101, 0xeb * 0x101, 0xd7 * 0x101};
+ constexpr inline QColor aqua {QColor::Rgb, 0xff * 0x101, 0x00 * 0x101, 0xff * 0x101, 0xff * 0x101};
+ constexpr inline QColor aquamarine {QColor::Rgb, 0xff * 0x101, 0x7f * 0x101, 0xff * 0x101, 0xd4 * 0x101};
+ constexpr inline QColor azure {QColor::Rgb, 0xff * 0x101, 0xf0 * 0x101, 0xff * 0x101, 0xff * 0x101};
+ constexpr inline QColor beige {QColor::Rgb, 0xff * 0x101, 0xf5 * 0x101, 0xf5 * 0x101, 0xdc * 0x101};
+ constexpr inline QColor bisque {QColor::Rgb, 0xff * 0x101, 0xff * 0x101, 0xe4 * 0x101, 0xc4 * 0x101};
+ constexpr inline QColor black {QColor::Rgb, 0xff * 0x101, 0x00 * 0x101, 0x00 * 0x101, 0x00 * 0x101};
+ constexpr inline QColor blanchedalmond {QColor::Rgb, 0xff * 0x101, 0xff * 0x101, 0xeb * 0x101, 0xcd * 0x101};
+ constexpr inline QColor blue {QColor::Rgb, 0xff * 0x101, 0x00 * 0x101, 0x00 * 0x101, 0xff * 0x101};
+ constexpr inline QColor blueviolet {QColor::Rgb, 0xff * 0x101, 0x8a * 0x101, 0x2b * 0x101, 0xe2 * 0x101};
+ constexpr inline QColor brown {QColor::Rgb, 0xff * 0x101, 0xa5 * 0x101, 0x2a * 0x101, 0x2a * 0x101};
+ constexpr inline QColor burlywood {QColor::Rgb, 0xff * 0x101, 0xde * 0x101, 0xb8 * 0x101, 0x87 * 0x101};
+ constexpr inline QColor cadetblue {QColor::Rgb, 0xff * 0x101, 0x5f * 0x101, 0x9e * 0x101, 0xa0 * 0x101};
+ constexpr inline QColor chartreuse {QColor::Rgb, 0xff * 0x101, 0x7f * 0x101, 0xff * 0x101, 0x00 * 0x101};
+ constexpr inline QColor chocolate {QColor::Rgb, 0xff * 0x101, 0xd2 * 0x101, 0x69 * 0x101, 0x1e * 0x101};
+ constexpr inline QColor coral {QColor::Rgb, 0xff * 0x101, 0xff * 0x101, 0x7f * 0x101, 0x50 * 0x101};
+ constexpr inline QColor cornflowerblue {QColor::Rgb, 0xff * 0x101, 0x64 * 0x101, 0x95 * 0x101, 0xed * 0x101};
+ constexpr inline QColor cornsilk {QColor::Rgb, 0xff * 0x101, 0xff * 0x101, 0xf8 * 0x101, 0xdc * 0x101};
+ constexpr inline QColor crimson {QColor::Rgb, 0xff * 0x101, 0xdc * 0x101, 0x14 * 0x101, 0x3c * 0x101};
+ constexpr inline QColor cyan {QColor::Rgb, 0xff * 0x101, 0x00 * 0x101, 0xff * 0x101, 0xff * 0x101};
+ constexpr inline QColor darkblue {QColor::Rgb, 0xff * 0x101, 0x00 * 0x101, 0x00 * 0x101, 0x8b * 0x101};
+ constexpr inline QColor darkcyan {QColor::Rgb, 0xff * 0x101, 0x00 * 0x101, 0x8b * 0x101, 0x8b * 0x101};
+ constexpr inline QColor darkgoldenrod {QColor::Rgb, 0xff * 0x101, 0xb8 * 0x101, 0x86 * 0x101, 0x0b * 0x101};
+ constexpr inline QColor darkgray {QColor::Rgb, 0xff * 0x101, 0xa9 * 0x101, 0xa9 * 0x101, 0xa9 * 0x101};
+ constexpr inline QColor darkgreen {QColor::Rgb, 0xff * 0x101, 0x00 * 0x101, 0x64 * 0x101, 0x00 * 0x101};
+ constexpr inline QColor darkgrey {QColor::Rgb, 0xff * 0x101, 0xa9 * 0x101, 0xa9 * 0x101, 0xa9 * 0x101};
+ constexpr inline QColor darkkhaki {QColor::Rgb, 0xff * 0x101, 0xbd * 0x101, 0xb7 * 0x101, 0x6b * 0x101};
+ constexpr inline QColor darkmagenta {QColor::Rgb, 0xff * 0x101, 0x8b * 0x101, 0x00 * 0x101, 0x8b * 0x101};
+ constexpr inline QColor darkolivegreen {QColor::Rgb, 0xff * 0x101, 0x55 * 0x101, 0x6b * 0x101, 0x2f * 0x101};
+ constexpr inline QColor darkorange {QColor::Rgb, 0xff * 0x101, 0xff * 0x101, 0x8c * 0x101, 0x00 * 0x101};
+ constexpr inline QColor darkorchid {QColor::Rgb, 0xff * 0x101, 0x99 * 0x101, 0x32 * 0x101, 0xcc * 0x101};
+ constexpr inline QColor darkred {QColor::Rgb, 0xff * 0x101, 0x8b * 0x101, 0x00 * 0x101, 0x00 * 0x101};
+ constexpr inline QColor darksalmon {QColor::Rgb, 0xff * 0x101, 0xe9 * 0x101, 0x96 * 0x101, 0x7a * 0x101};
+ constexpr inline QColor darkseagreen {QColor::Rgb, 0xff * 0x101, 0x8f * 0x101, 0xbc * 0x101, 0x8f * 0x101};
+ constexpr inline QColor darkslateblue {QColor::Rgb, 0xff * 0x101, 0x48 * 0x101, 0x3d * 0x101, 0x8b * 0x101};
+ constexpr inline QColor darkslategray {QColor::Rgb, 0xff * 0x101, 0x2f * 0x101, 0x4f * 0x101, 0x4f * 0x101};
+ constexpr inline QColor darkslategrey {QColor::Rgb, 0xff * 0x101, 0x2f * 0x101, 0x4f * 0x101, 0x4f * 0x101};
+ constexpr inline QColor darkturquoise {QColor::Rgb, 0xff * 0x101, 0x00 * 0x101, 0xce * 0x101, 0xd1 * 0x101};
+ constexpr inline QColor darkviolet {QColor::Rgb, 0xff * 0x101, 0x94 * 0x101, 0x00 * 0x101, 0xd3 * 0x101};
+ constexpr inline QColor deeppink {QColor::Rgb, 0xff * 0x101, 0xff * 0x101, 0x14 * 0x101, 0x93 * 0x101};
+ constexpr inline QColor deepskyblue {QColor::Rgb, 0xff * 0x101, 0x00 * 0x101, 0xbf * 0x101, 0xff * 0x101};
+ constexpr inline QColor dimgray {QColor::Rgb, 0xff * 0x101, 0x69 * 0x101, 0x69 * 0x101, 0x69 * 0x101};
+ constexpr inline QColor dimgrey {QColor::Rgb, 0xff * 0x101, 0x69 * 0x101, 0x69 * 0x101, 0x69 * 0x101};
+ constexpr inline QColor dodgerblue {QColor::Rgb, 0xff * 0x101, 0x1e * 0x101, 0x90 * 0x101, 0xff * 0x101};
+ constexpr inline QColor firebrick {QColor::Rgb, 0xff * 0x101, 0xb2 * 0x101, 0x22 * 0x101, 0x22 * 0x101};
+ constexpr inline QColor floralwhite {QColor::Rgb, 0xff * 0x101, 0xff * 0x101, 0xfa * 0x101, 0xf0 * 0x101};
+ constexpr inline QColor forestgreen {QColor::Rgb, 0xff * 0x101, 0x22 * 0x101, 0x8b * 0x101, 0x22 * 0x101};
+ constexpr inline QColor fuchsia {QColor::Rgb, 0xff * 0x101, 0xff * 0x101, 0x00 * 0x101, 0xff * 0x101};
+ constexpr inline QColor gainsboro {QColor::Rgb, 0xff * 0x101, 0xdc * 0x101, 0xdc * 0x101, 0xdc * 0x101};
+ constexpr inline QColor ghostwhite {QColor::Rgb, 0xff * 0x101, 0xf8 * 0x101, 0xf8 * 0x101, 0xff * 0x101};
+ constexpr inline QColor gold {QColor::Rgb, 0xff * 0x101, 0xff * 0x101, 0xd7 * 0x101, 0x00 * 0x101};
+ constexpr inline QColor goldenrod {QColor::Rgb, 0xff * 0x101, 0xda * 0x101, 0xa5 * 0x101, 0x20 * 0x101};
+ constexpr inline QColor gray {QColor::Rgb, 0xff * 0x101, 0x80 * 0x101, 0x80 * 0x101, 0x80 * 0x101};
+ constexpr inline QColor green {QColor::Rgb, 0xff * 0x101, 0x00 * 0x101, 0x80 * 0x101, 0x00 * 0x101};
+ constexpr inline QColor greenyellow {QColor::Rgb, 0xff * 0x101, 0xad * 0x101, 0xff * 0x101, 0x2f * 0x101};
+ constexpr inline QColor grey {QColor::Rgb, 0xff * 0x101, 0x80 * 0x101, 0x80 * 0x101, 0x80 * 0x101};
+ constexpr inline QColor honeydew {QColor::Rgb, 0xff * 0x101, 0xf0 * 0x101, 0xff * 0x101, 0xf0 * 0x101};
+ constexpr inline QColor hotpink {QColor::Rgb, 0xff * 0x101, 0xff * 0x101, 0x69 * 0x101, 0xb4 * 0x101};
+ constexpr inline QColor indianred {QColor::Rgb, 0xff * 0x101, 0xcd * 0x101, 0x5c * 0x101, 0x5c * 0x101};
+ constexpr inline QColor indigo {QColor::Rgb, 0xff * 0x101, 0x4b * 0x101, 0x00 * 0x101, 0x82 * 0x101};
+ constexpr inline QColor ivory {QColor::Rgb, 0xff * 0x101, 0xff * 0x101, 0xff * 0x101, 0xf0 * 0x101};
+ constexpr inline QColor khaki {QColor::Rgb, 0xff * 0x101, 0xf0 * 0x101, 0xe6 * 0x101, 0x8c * 0x101};
+ constexpr inline QColor lavender {QColor::Rgb, 0xff * 0x101, 0xe6 * 0x101, 0xe6 * 0x101, 0xfa * 0x101};
+ constexpr inline QColor lavenderblush {QColor::Rgb, 0xff * 0x101, 0xff * 0x101, 0xf0 * 0x101, 0xf5 * 0x101};
+ constexpr inline QColor lawngreen {QColor::Rgb, 0xff * 0x101, 0x7c * 0x101, 0xfc * 0x101, 0x00 * 0x101};
+ constexpr inline QColor lemonchiffon {QColor::Rgb, 0xff * 0x101, 0xff * 0x101, 0xfa * 0x101, 0xcd * 0x101};
+ constexpr inline QColor lightblue {QColor::Rgb, 0xff * 0x101, 0xad * 0x101, 0xd8 * 0x101, 0xe6 * 0x101};
+ constexpr inline QColor lightcoral {QColor::Rgb, 0xff * 0x101, 0xf0 * 0x101, 0x80 * 0x101, 0x80 * 0x101};
+ constexpr inline QColor lightcyan {QColor::Rgb, 0xff * 0x101, 0xe0 * 0x101, 0xff * 0x101, 0xff * 0x101};
+ constexpr inline QColor lightgoldenrodyellow {QColor::Rgb, 0xff * 0x101, 0xfa * 0x101, 0xfa * 0x101, 0xd2 * 0x101};
+ constexpr inline QColor lightgray {QColor::Rgb, 0xff * 0x101, 0xd3 * 0x101, 0xd3 * 0x101, 0xd3 * 0x101};
+ constexpr inline QColor lightgreen {QColor::Rgb, 0xff * 0x101, 0x90 * 0x101, 0xee * 0x101, 0x90 * 0x101};
+ constexpr inline QColor lightgrey {QColor::Rgb, 0xff * 0x101, 0xd3 * 0x101, 0xd3 * 0x101, 0xd3 * 0x101};
+ constexpr inline QColor lightpink {QColor::Rgb, 0xff * 0x101, 0xff * 0x101, 0xb6 * 0x101, 0xc1 * 0x101};
+ constexpr inline QColor lightsalmon {QColor::Rgb, 0xff * 0x101, 0xff * 0x101, 0xa0 * 0x101, 0x7a * 0x101};
+ constexpr inline QColor lightseagreen {QColor::Rgb, 0xff * 0x101, 0x20 * 0x101, 0xb2 * 0x101, 0xaa * 0x101};
+ constexpr inline QColor lightskyblue {QColor::Rgb, 0xff * 0x101, 0x87 * 0x101, 0xce * 0x101, 0xfa * 0x101};
+ constexpr inline QColor lightslategray {QColor::Rgb, 0xff * 0x101, 0x77 * 0x101, 0x88 * 0x101, 0x99 * 0x101};
+ constexpr inline QColor lightslategrey {QColor::Rgb, 0xff * 0x101, 0x77 * 0x101, 0x88 * 0x101, 0x99 * 0x101};
+ constexpr inline QColor lightsteelblue {QColor::Rgb, 0xff * 0x101, 0xb0 * 0x101, 0xc4 * 0x101, 0xde * 0x101};
+ constexpr inline QColor lightyellow {QColor::Rgb, 0xff * 0x101, 0xff * 0x101, 0xff * 0x101, 0xe0 * 0x101};
+ constexpr inline QColor lime {QColor::Rgb, 0xff * 0x101, 0x00 * 0x101, 0xff * 0x101, 0x00 * 0x101};
+ constexpr inline QColor limegreen {QColor::Rgb, 0xff * 0x101, 0x32 * 0x101, 0xcd * 0x101, 0x32 * 0x101};
+ constexpr inline QColor linen {QColor::Rgb, 0xff * 0x101, 0xfa * 0x101, 0xf0 * 0x101, 0xe6 * 0x101};
+ constexpr inline QColor magenta {QColor::Rgb, 0xff * 0x101, 0xff * 0x101, 0x00 * 0x101, 0xff * 0x101};
+ constexpr inline QColor maroon {QColor::Rgb, 0xff * 0x101, 0x80 * 0x101, 0x00 * 0x101, 0x00 * 0x101};
+ constexpr inline QColor mediumaquamarine {QColor::Rgb, 0xff * 0x101, 0x66 * 0x101, 0xcd * 0x101, 0xaa * 0x101};
+ constexpr inline QColor mediumblue {QColor::Rgb, 0xff * 0x101, 0x00 * 0x101, 0x00 * 0x101, 0xcd * 0x101};
+ constexpr inline QColor mediumorchid {QColor::Rgb, 0xff * 0x101, 0xba * 0x101, 0x55 * 0x101, 0xd3 * 0x101};
+ constexpr inline QColor mediumpurple {QColor::Rgb, 0xff * 0x101, 0x93 * 0x101, 0x70 * 0x101, 0xdb * 0x101};
+ constexpr inline QColor mediumseagreen {QColor::Rgb, 0xff * 0x101, 0x3c * 0x101, 0xb3 * 0x101, 0x71 * 0x101};
+ constexpr inline QColor mediumslateblue {QColor::Rgb, 0xff * 0x101, 0x7b * 0x101, 0x68 * 0x101, 0xee * 0x101};
+ constexpr inline QColor mediumspringgreen {QColor::Rgb, 0xff * 0x101, 0x00 * 0x101, 0xfa * 0x101, 0x9a * 0x101};
+ constexpr inline QColor mediumturquoise {QColor::Rgb, 0xff * 0x101, 0x48 * 0x101, 0xd1 * 0x101, 0xcc * 0x101};
+ constexpr inline QColor mediumvioletred {QColor::Rgb, 0xff * 0x101, 0xc7 * 0x101, 0x15 * 0x101, 0x85 * 0x101};
+ constexpr inline QColor midnightblue {QColor::Rgb, 0xff * 0x101, 0x19 * 0x101, 0x19 * 0x101, 0x70 * 0x101};
+ constexpr inline QColor mintcream {QColor::Rgb, 0xff * 0x101, 0xf5 * 0x101, 0xff * 0x101, 0xfa * 0x101};
+ constexpr inline QColor mistyrose {QColor::Rgb, 0xff * 0x101, 0xff * 0x101, 0xe4 * 0x101, 0xe1 * 0x101};
+ constexpr inline QColor moccasin {QColor::Rgb, 0xff * 0x101, 0xff * 0x101, 0xe4 * 0x101, 0xb5 * 0x101};
+ constexpr inline QColor navajowhite {QColor::Rgb, 0xff * 0x101, 0xff * 0x101, 0xde * 0x101, 0xad * 0x101};
+ constexpr inline QColor navy {QColor::Rgb, 0xff * 0x101, 0x00 * 0x101, 0x00 * 0x101, 0x80 * 0x101};
+ constexpr inline QColor oldlace {QColor::Rgb, 0xff * 0x101, 0xfd * 0x101, 0xf5 * 0x101, 0xe6 * 0x101};
+ constexpr inline QColor olive {QColor::Rgb, 0xff * 0x101, 0x80 * 0x101, 0x80 * 0x101, 0x00 * 0x101};
+ constexpr inline QColor olivedrab {QColor::Rgb, 0xff * 0x101, 0x6b * 0x101, 0x8e * 0x101, 0x23 * 0x101};
+ constexpr inline QColor orange {QColor::Rgb, 0xff * 0x101, 0xff * 0x101, 0xa5 * 0x101, 0x00 * 0x101};
+ constexpr inline QColor orangered {QColor::Rgb, 0xff * 0x101, 0xff * 0x101, 0x45 * 0x101, 0x00 * 0x101};
+ constexpr inline QColor orchid {QColor::Rgb, 0xff * 0x101, 0xda * 0x101, 0x70 * 0x101, 0xd6 * 0x101};
+ constexpr inline QColor palegoldenrod {QColor::Rgb, 0xff * 0x101, 0xee * 0x101, 0xe8 * 0x101, 0xaa * 0x101};
+ constexpr inline QColor palegreen {QColor::Rgb, 0xff * 0x101, 0x98 * 0x101, 0xfb * 0x101, 0x98 * 0x101};
+ constexpr inline QColor paleturquoise {QColor::Rgb, 0xff * 0x101, 0xaf * 0x101, 0xee * 0x101, 0xee * 0x101};
+ constexpr inline QColor palevioletred {QColor::Rgb, 0xff * 0x101, 0xdb * 0x101, 0x70 * 0x101, 0x93 * 0x101};
+ constexpr inline QColor papayawhip {QColor::Rgb, 0xff * 0x101, 0xff * 0x101, 0xef * 0x101, 0xd5 * 0x101};
+ constexpr inline QColor peachpuff {QColor::Rgb, 0xff * 0x101, 0xff * 0x101, 0xda * 0x101, 0xb9 * 0x101};
+ constexpr inline QColor peru {QColor::Rgb, 0xff * 0x101, 0xcd * 0x101, 0x85 * 0x101, 0x3f * 0x101};
+ constexpr inline QColor pink {QColor::Rgb, 0xff * 0x101, 0xff * 0x101, 0xc0 * 0x101, 0xcb * 0x101};
+ constexpr inline QColor plum {QColor::Rgb, 0xff * 0x101, 0xdd * 0x101, 0xa0 * 0x101, 0xdd * 0x101};
+ constexpr inline QColor powderblue {QColor::Rgb, 0xff * 0x101, 0xb0 * 0x101, 0xe0 * 0x101, 0xe6 * 0x101};
+ constexpr inline QColor purple {QColor::Rgb, 0xff * 0x101, 0x80 * 0x101, 0x00 * 0x101, 0x80 * 0x101};
+ constexpr inline QColor red {QColor::Rgb, 0xff * 0x101, 0xff * 0x101, 0x00 * 0x101, 0x00 * 0x101};
+ constexpr inline QColor rosybrown {QColor::Rgb, 0xff * 0x101, 0xbc * 0x101, 0x8f * 0x101, 0x8f * 0x101};
+ constexpr inline QColor royalblue {QColor::Rgb, 0xff * 0x101, 0x41 * 0x101, 0x69 * 0x101, 0xe1 * 0x101};
+ constexpr inline QColor saddlebrown {QColor::Rgb, 0xff * 0x101, 0x8b * 0x101, 0x45 * 0x101, 0x13 * 0x101};
+ constexpr inline QColor salmon {QColor::Rgb, 0xff * 0x101, 0xfa * 0x101, 0x80 * 0x101, 0x72 * 0x101};
+ constexpr inline QColor sandybrown {QColor::Rgb, 0xff * 0x101, 0xf4 * 0x101, 0xa4 * 0x101, 0x60 * 0x101};
+ constexpr inline QColor seagreen {QColor::Rgb, 0xff * 0x101, 0x2e * 0x101, 0x8b * 0x101, 0x57 * 0x101};
+ constexpr inline QColor seashell {QColor::Rgb, 0xff * 0x101, 0xff * 0x101, 0xf5 * 0x101, 0xee * 0x101};
+ constexpr inline QColor sienna {QColor::Rgb, 0xff * 0x101, 0xa0 * 0x101, 0x52 * 0x101, 0x2d * 0x101};
+ constexpr inline QColor silver {QColor::Rgb, 0xff * 0x101, 0xc0 * 0x101, 0xc0 * 0x101, 0xc0 * 0x101};
+ constexpr inline QColor skyblue {QColor::Rgb, 0xff * 0x101, 0x87 * 0x101, 0xce * 0x101, 0xeb * 0x101};
+ constexpr inline QColor slateblue {QColor::Rgb, 0xff * 0x101, 0x6a * 0x101, 0x5a * 0x101, 0xcd * 0x101};
+ constexpr inline QColor slategray {QColor::Rgb, 0xff * 0x101, 0x70 * 0x101, 0x80 * 0x101, 0x90 * 0x101};
+ constexpr inline QColor slategrey {QColor::Rgb, 0xff * 0x101, 0x70 * 0x101, 0x80 * 0x101, 0x90 * 0x101};
+ constexpr inline QColor snow {QColor::Rgb, 0xff * 0x101, 0xff * 0x101, 0xfa * 0x101, 0xfa * 0x101};
+ constexpr inline QColor springgreen {QColor::Rgb, 0xff * 0x101, 0x00 * 0x101, 0xff * 0x101, 0x7f * 0x101};
+ constexpr inline QColor steelblue {QColor::Rgb, 0xff * 0x101, 0x46 * 0x101, 0x82 * 0x101, 0xb4 * 0x101};
+ constexpr inline QColor tan {QColor::Rgb, 0xff * 0x101, 0xd2 * 0x101, 0xb4 * 0x101, 0x8c * 0x101};
+ constexpr inline QColor teal {QColor::Rgb, 0xff * 0x101, 0x00 * 0x101, 0x80 * 0x101, 0x80 * 0x101};
+ constexpr inline QColor thistle {QColor::Rgb, 0xff * 0x101, 0xd8 * 0x101, 0xbf * 0x101, 0xd8 * 0x101};
+ constexpr inline QColor tomato {QColor::Rgb, 0xff * 0x101, 0xff * 0x101, 0x63 * 0x101, 0x47 * 0x101};
+ constexpr inline QColor turquoise {QColor::Rgb, 0xff * 0x101, 0x40 * 0x101, 0xe0 * 0x101, 0xd0 * 0x101};
+ constexpr inline QColor violet {QColor::Rgb, 0xff * 0x101, 0xee * 0x101, 0x82 * 0x101, 0xee * 0x101};
+ constexpr inline QColor wheat {QColor::Rgb, 0xff * 0x101, 0xf5 * 0x101, 0xde * 0x101, 0xb3 * 0x101};
+ constexpr inline QColor white {QColor::Rgb, 0xff * 0x101, 0xff * 0x101, 0xff * 0x101, 0xff * 0x101};
+ constexpr inline QColor whitesmoke {QColor::Rgb, 0xff * 0x101, 0xf5 * 0x101, 0xf5 * 0x101, 0xf5 * 0x101};
+ constexpr inline QColor yellow {QColor::Rgb, 0xff * 0x101, 0xff * 0x101, 0xff * 0x101, 0x00 * 0x101};
+ constexpr inline QColor yellowgreen {QColor::Rgb, 0xff * 0x101, 0x9a * 0x101, 0xcd * 0x101, 0x32 * 0x101};
} // namespace Svg
-#endif // Q_COMPILER_CONSTEXPR && Q_COMPILER_UNIFORM_INIT
} // namespace QColorLiterals
QT_END_NAMESPACE
diff --git a/src/gui/painting/qcolor_p.h b/src/gui/painting/qcolor_p.h
index b44f2b163a..89a31f66a4 100644
--- a/src/gui/painting/qcolor_p.h
+++ b/src/gui/painting/qcolor_p.h
@@ -1,41 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the QtGui module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#ifndef QCOLOR_P_H
#define QCOLOR_P_H
@@ -54,9 +18,11 @@
#include <QtGui/private/qtguiglobal_p.h>
#include "QtGui/qrgb.h"
+#include <optional>
+
QT_BEGIN_NAMESPACE
-bool qt_get_hex_rgb(const char *, QRgb *);
+std::optional<QRgb> qt_get_hex_rgb(const char *) Q_DECL_PURE_FUNCTION;
QT_END_NAMESPACE
diff --git a/src/gui/painting/qcolorclut_p.h b/src/gui/painting/qcolorclut_p.h
new file mode 100644
index 0000000000..d95e9701b7
--- /dev/null
+++ b/src/gui/painting/qcolorclut_p.h
@@ -0,0 +1,127 @@
+// Copyright (C) 2024 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
+
+#ifndef QCOLORCLUT_H
+#define QCOLORCLUT_H
+
+//
+// W A R N I N G
+// -------------
+//
+// This file is not part of the Qt API. It exists purely as an
+// implementation detail. This header file may change from version to
+// version without notice, or even be removed.
+//
+// We mean it.
+//
+
+#include <QtCore/qlist.h>
+#include <QtGui/private/qcolormatrix_p.h>
+
+QT_BEGIN_NAMESPACE
+
+// A 3/4-dimensional lookup table compatible with ICC lut8, lut16, mAB, and mBA formats.
+class QColorCLUT
+{
+ inline static QColorVector interpolate(const QColorVector &a, const QColorVector &b, float t)
+ {
+ return a + (b - a) * t; // faster than std::lerp by assuming no super large or non-number floats
+ }
+ inline static void interpolateIn(QColorVector &a, const QColorVector &b, float t)
+ {
+ a += (b - a) * t;
+ }
+public:
+ uint32_t gridPointsX = 0;
+ uint32_t gridPointsY = 0;
+ uint32_t gridPointsZ = 0;
+ uint32_t gridPointsW = 1;
+ QList<QColorVector> table;
+
+ bool isEmpty() const { return table.isEmpty(); }
+
+ QColorVector apply(const QColorVector &v) const
+ {
+ Q_ASSERT(table.size() == gridPointsX * gridPointsY * gridPointsZ * gridPointsW);
+ QColorVector frac;
+ const float x = std::clamp(v.x, 0.0f, 1.0f) * (gridPointsX - 1);
+ const float y = std::clamp(v.y, 0.0f, 1.0f) * (gridPointsY - 1);
+ const float z = std::clamp(v.z, 0.0f, 1.0f) * (gridPointsZ - 1);
+ const float w = std::clamp(v.w, 0.0f, 1.0f) * (gridPointsW - 1);
+ const uint32_t lox = static_cast<uint32_t>(std::floor(x));
+ const uint32_t hix = std::min(lox + 1, gridPointsX - 1);
+ const uint32_t loy = static_cast<uint32_t>(std::floor(y));
+ const uint32_t hiy = std::min(loy + 1, gridPointsY - 1);
+ const uint32_t loz = static_cast<uint32_t>(std::floor(z));
+ const uint32_t hiz = std::min(loz + 1, gridPointsZ - 1);
+ const uint32_t low = static_cast<uint32_t>(std::floor(w));
+ const uint32_t hiw = std::min(low + 1, gridPointsW - 1);
+ frac.x = x - static_cast<float>(lox);
+ frac.y = y - static_cast<float>(loy);
+ frac.z = z - static_cast<float>(loz);
+ frac.w = w - static_cast<float>(low);
+ if (gridPointsW > 1) {
+ auto index = [&](qsizetype x, qsizetype y, qsizetype z, qsizetype w) -> qsizetype {
+ return x * gridPointsW * gridPointsZ * gridPointsY
+ + y * gridPointsW * gridPointsZ
+ + z * gridPointsW
+ + w;
+ };
+ QColorVector tmp[8];
+ // interpolate over w
+ tmp[0] = interpolate(table[index(lox, loy, loz, low)],
+ table[index(lox, loy, loz, hiw)], frac.w);
+ tmp[1] = interpolate(table[index(lox, loy, hiz, low)],
+ table[index(lox, loy, hiz, hiw)], frac.w);
+ tmp[2] = interpolate(table[index(lox, hiy, loz, low)],
+ table[index(lox, hiy, loz, hiw)], frac.w);
+ tmp[3] = interpolate(table[index(lox, hiy, hiz, low)],
+ table[index(lox, hiy, hiz, hiw)], frac.w);
+ tmp[4] = interpolate(table[index(hix, loy, loz, low)],
+ table[index(hix, loy, loz, hiw)], frac.w);
+ tmp[5] = interpolate(table[index(hix, loy, hiz, low)],
+ table[index(hix, loy, hiz, hiw)], frac.w);
+ tmp[6] = interpolate(table[index(hix, hiy, loz, low)],
+ table[index(hix, hiy, loz, hiw)], frac.w);
+ tmp[7] = interpolate(table[index(hix, hiy, hiz, low)],
+ table[index(hix, hiy, hiz, hiw)], frac.w);
+ // interpolate over z
+ for (int i = 0; i < 4; ++i)
+ interpolateIn(tmp[i * 2], tmp[i * 2 + 1], frac.z);
+ // interpolate over y
+ for (int i = 0; i < 2; ++i)
+ interpolateIn(tmp[i * 4], tmp[i * 4 + 2], frac.y);
+ // interpolate over x
+ interpolateIn(tmp[0], tmp[4], frac.x);
+ return tmp[0];
+ }
+ auto index = [&](qsizetype x, qsizetype y, qsizetype z) -> qsizetype {
+ return x * gridPointsZ * gridPointsY
+ + y * gridPointsZ
+ + z;
+ };
+ QColorVector tmp[8] = {
+ table[index(lox, loy, loz)],
+ table[index(lox, loy, hiz)],
+ table[index(lox, hiy, loz)],
+ table[index(lox, hiy, hiz)],
+ table[index(hix, loy, loz)],
+ table[index(hix, loy, hiz)],
+ table[index(hix, hiy, loz)],
+ table[index(hix, hiy, hiz)]
+ };
+ // interpolate over z
+ for (int i = 0; i < 4; ++i)
+ interpolateIn(tmp[i * 2], tmp[i * 2 + 1], frac.z);
+ // interpolate over y
+ for (int i = 0; i < 2; ++i)
+ interpolateIn(tmp[i * 4], tmp[i * 4 + 2], frac.y);
+ // interpolate over x
+ interpolateIn(tmp[0], tmp[4], frac.x);
+ return tmp[0];
+ }
+};
+
+QT_END_NAMESPACE
+
+#endif // QCOLORCLUT_H
diff --git a/src/gui/painting/qcolormatrix_p.h b/src/gui/painting/qcolormatrix_p.h
index edb2d32258..6a9b9f4f9a 100644
--- a/src/gui/painting/qcolormatrix_p.h
+++ b/src/gui/painting/qcolormatrix_p.h
@@ -1,41 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2018 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the QtGui module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2024 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#ifndef QCOLORMATRIX_H
#define QCOLORMATRIX_H
@@ -53,6 +17,8 @@
#include <QtGui/qtguiglobal.h>
#include <QtCore/qpoint.h>
+#include <QtCore/private/qglobal_p.h>
+#include <QtCore/private/qsimd_p.h>
#include <cmath>
QT_BEGIN_NAMESPACE
@@ -62,25 +28,24 @@ class QColorVector
{
public:
QColorVector() = default;
- Q_DECL_CONSTEXPR QColorVector(float x, float y, float z) : x(x), y(y), z(z) { }
- explicit Q_DECL_CONSTEXPR QColorVector(const QPointF &chr) // from XY chromaticity
- : x(chr.x() / chr.y())
- , y(1.0f)
- , z((1.0 - chr.x() - chr.y()) / chr.y())
- { }
- float x = 0.0f; // X, x or red
- float y = 0.0f; // Y, y or green
- float z = 0.0f; // Z, Y or blue
- float _unused = 0.0f;
+ constexpr QColorVector(float x, float y, float z, float w = 0.0f) noexcept : x(x), y(y), z(z), w(w) { }
+ static constexpr QColorVector fromXYChromaticity(QPointF chr)
+ { return {float(chr.x() / chr.y()), 1.0f, float((1.0f - chr.x() - chr.y()) / chr.y())}; }
+ float x = 0.0f; // X, x, L, or red/cyan
+ float y = 0.0f; // Y, y, a, or green/magenta
+ float z = 0.0f; // Z, Y, b, or blue/yellow
+ float w = 0.0f; // unused, or black
- friend inline bool operator==(const QColorVector &v1, const QColorVector &v2);
- friend inline bool operator!=(const QColorVector &v1, const QColorVector &v2);
- bool isNull() const
+ constexpr bool isNull() const noexcept
{
- return !x && !y && !z;
+ return !x && !y && !z && !w;
+ }
+ bool isValid() const noexcept
+ {
+ return std::isfinite(x) && std::isfinite(y) && std::isfinite(z);
}
- static bool isValidChromaticity(const QPointF &chr)
+ static constexpr bool isValidChromaticity(const QPointF &chr)
{
if (chr.x() < qreal(0.0) || chr.x() > qreal(1.0))
return false;
@@ -91,28 +56,151 @@ public:
return true;
}
+ constexpr QColorVector operator*(float f) const { return QColorVector(x * f, y * f, z * f, w * f); }
+ constexpr QColorVector operator+(const QColorVector &v) const { return QColorVector(x + v.x, y + v.y, z + v.z, w + v.w); }
+ constexpr QColorVector operator-(const QColorVector &v) const { return QColorVector(x - v.x, y - v.y, z - v.z, w - v.w); }
+ void operator+=(const QColorVector &v) { x += v.x; y += v.y; z += v.z; w += v.w; }
+
+ QPointF toChromaticity() const
+ {
+ if (isNull())
+ return QPointF();
+ float mag = 1.0f / (x + y + z);
+ return QPointF(x * mag, y * mag);
+ }
+
// Common whitepoints:
- static Q_DECL_CONSTEXPR QPointF D50Chromaticity() { return QPointF(0.34567, 0.35850); }
- static Q_DECL_CONSTEXPR QPointF D65Chromaticity() { return QPointF(0.31271, 0.32902); }
- static Q_DECL_CONSTEXPR QColorVector D50() { return QColorVector(D50Chromaticity()); }
- static Q_DECL_CONSTEXPR QColorVector D65() { return QColorVector(D65Chromaticity()); }
+ static constexpr QPointF D50Chromaticity() { return QPointF(0.34567, 0.35850); }
+ static constexpr QPointF D65Chromaticity() { return QPointF(0.31271, 0.32902); }
+ static constexpr QColorVector D50() { return fromXYChromaticity(D50Chromaticity()); }
+ static constexpr QColorVector D65() { return fromXYChromaticity(D65Chromaticity()); }
+
+ QColorVector xyzToLab() const
+ {
+ constexpr QColorVector ref = D50();
+ constexpr float eps = 0.008856f;
+ constexpr float kap = 903.3f;
+#if defined(__SSE2__)
+ const __m128 iref = _mm_setr_ps(1.f / ref.x, 1.f / ref.y, 1.f / ref.z, 0.f);
+ __m128 v = _mm_loadu_ps(&x);
+ v = _mm_mul_ps(v, iref);
+
+ const __m128 f3 = _mm_set1_ps(3.f);
+ __m128 est = _mm_add_ps(_mm_set1_ps(0.25f), _mm_mul_ps(v, _mm_set1_ps(0.75f))); // float est = 0.25f + (x * 0.75f);
+ __m128 estsq = _mm_mul_ps(est, est);
+ est = _mm_sub_ps(est, _mm_mul_ps(_mm_sub_ps(_mm_mul_ps(estsq, est), v),
+ _mm_rcp_ps(_mm_mul_ps(estsq, f3)))); // est -= ((est * est * est) - x) / (3.f * (est * est));
+ estsq = _mm_mul_ps(est, est);
+ est = _mm_sub_ps(est, _mm_mul_ps(_mm_sub_ps(_mm_mul_ps(estsq, est), v),
+ _mm_rcp_ps(_mm_mul_ps(estsq, f3)))); // est -= ((est * est * est) - x) / (3.f * (est * est));
+ estsq = _mm_mul_ps(est, est);
+ est = _mm_sub_ps(est, _mm_mul_ps(_mm_sub_ps(_mm_mul_ps(estsq, est), v),
+ _mm_rcp_ps(_mm_mul_ps(estsq, f3)))); // est -= ((est * est * est) - x) / (3.f * (est * est));
+ estsq = _mm_mul_ps(est, est);
+ est = _mm_sub_ps(est, _mm_mul_ps(_mm_sub_ps(_mm_mul_ps(estsq, est), v),
+ _mm_rcp_ps(_mm_mul_ps(estsq, f3)))); // est -= ((est * est * est) - x) / (3.f * (est * est));
+
+ __m128 kapmul = _mm_mul_ps(_mm_add_ps(_mm_mul_ps(v, _mm_set1_ps(kap)), _mm_set1_ps(16.f)),
+ _mm_set1_ps(1.f / 116.f)); // f_ = (kap * f_ + 16.f) * (1.f / 116.f);
+ __m128 cmpgt = _mm_cmpgt_ps(v, _mm_set1_ps(eps)); // if (f_ > eps)
+#if defined(__SSE4_1__)
+ v = _mm_blendv_ps(kapmul, est, cmpgt); // if (..) f_ =.. else f_ =..
+#else
+ v = _mm_or_ps(_mm_and_ps(cmpgt, est), _mm_andnot_ps(cmpgt, kapmul));
+#endif
+ alignas(16) float out[4];
+ _mm_store_ps(out, v);
+ const float L = 116.f * out[1] - 16.f;
+ const float a = 500.f * (out[0] - out[1]);
+ const float b = 200.f * (out[1] - out[2]);
+#else
+ float xr = x * (1.f / ref.x);
+ float yr = y * (1.f / ref.y);
+ float zr = z * (1.f / ref.z);
+
+ float fx, fy, fz;
+ if (xr > eps)
+ fx = fastCbrt(xr);
+ else
+ fx = (kap * xr + 16.f) * (1.f / 116.f);
+ if (yr > eps)
+ fy = fastCbrt(yr);
+ else
+ fy = (kap * yr + 16.f) * (1.f / 116.f);
+ if (zr > eps)
+ fz = fastCbrt(zr);
+ else
+ fz = (kap * zr + 16.f) * (1.f / 116.f);
+
+ const float L = 116.f * fy - 16.f;
+ const float a = 500.f * (fx - fy);
+ const float b = 200.f * (fy - fz);
+#endif
+ // We output Lab values that has been scaled to 0.0->1.0 values, see also labToXyz.
+ return QColorVector(L * (1.f / 100.f), (a + 128.f) * (1.f / 255.f), (b + 128.f) * (1.f / 255.f));
+ }
+
+ QColorVector labToXyz() const
+ {
+ constexpr QColorVector ref = D50();
+ constexpr float eps = 0.008856f;
+ constexpr float kap = 903.3f;
+ // This transform has been guessed from the ICC spec, but it is not stated
+ // anywhere to be the one to use to map to and from 0.0->1.0 values:
+ const float L = x * 100.f;
+ const float a = (y * 255.f) - 128.f;
+ const float b = (z * 255.f) - 128.f;
+ // From here is official Lab->XYZ conversion:
+ float fy = (L + 16.f) * (1.f / 116.f);
+ float fx = fy + (a * (1.f / 500.f));
+ float fz = fy - (b * (1.f / 200.f));
+
+ float xr, yr, zr;
+ if (fx * fx * fx > eps)
+ xr = fx * fx * fx;
+ else
+ xr = (116.f * fx - 16) * (1.f / kap);
+ if (L > (kap * eps))
+ yr = fy * fy * fy;
+ else
+ yr = L * (1.f / kap);
+ if (fz * fz * fz > eps)
+ zr = fz * fz * fz;
+ else
+ zr = (116.f * fz - 16) * (1.f / kap);
+
+ xr = xr * ref.x;
+ yr = yr * ref.y;
+ zr = zr * ref.z;
+ return QColorVector(xr, yr, zr);
+ }
+ friend inline bool comparesEqual(const QColorVector &lhs, const QColorVector &rhs);
+ Q_DECLARE_EQUALITY_COMPARABLE(QColorVector);
+
+private:
+ static float fastCbrt(float x)
+ {
+ // This gives us cube root within the precision we need.
+ float est = 0.25f + (x * 0.75f); // guessing a cube-root of numbers between 0.01 and 1.
+ est -= ((est * est * est) - x) / (3.f * (est * est));
+ est -= ((est * est * est) - x) / (3.f * (est * est));
+ est -= ((est * est * est) - x) / (3.f * (est * est));
+ est -= ((est * est * est) - x) / (3.f * (est * est));
+ // Q_ASSERT(qAbs(est - std::cbrt(x)) < 0.0001f);
+ return est;
+ }
};
-inline bool operator==(const QColorVector &v1, const QColorVector &v2)
+inline bool comparesEqual(const QColorVector &v1, const QColorVector &v2)
{
return (std::abs(v1.x - v2.x) < (1.0f / 2048.0f))
&& (std::abs(v1.y - v2.y) < (1.0f / 2048.0f))
- && (std::abs(v1.z - v2.z) < (1.0f / 2048.0f));
-}
-
-inline bool operator!=(const QColorVector &v1, const QColorVector &v2)
-{
- return !(v1 == v2);
+ && (std::abs(v1.z - v2.z) < (1.0f / 2048.0f))
+ && (std::abs(v1.w - v2.w) < (1.0f / 2048.0f));
}
-
// A matrix mapping 3 value colors.
-// Not using QMatrix because only floats are needed and performance is critical.
+// Not using QTransform because only floats are needed and performance is critical.
class QColorMatrix
{
public:
@@ -121,27 +209,29 @@ public:
QColorVector g;
QColorVector b;
- friend inline bool operator==(const QColorMatrix &m1, const QColorMatrix &m2);
- friend inline bool operator!=(const QColorMatrix &m1, const QColorMatrix &m2);
-
- bool isNull() const
+ constexpr bool isNull() const
{
return r.isNull() && g.isNull() && b.isNull();
}
+ constexpr float determinant() const
+ {
+ return r.x * (b.z * g.y - g.z * b.y) -
+ r.y * (b.z * g.x - g.z * b.x) +
+ r.z * (b.y * g.x - g.y * b.x);
+ }
bool isValid() const
{
// A color matrix must be invertible
- float det = r.x * (b.z * g.y - g.z * b.y) -
- r.y * (b.z * g.x - g.z * b.x) +
- r.z * (b.y * g.x - g.y * b.x);
- return !qFuzzyIsNull(det);
+ return std::isnormal(determinant());
+ }
+ bool isIdentity() const noexcept
+ {
+ return *this == identity();
}
QColorMatrix inverted() const
{
- float det = r.x * (b.z * g.y - g.z * b.y) -
- r.y * (b.z * g.x - g.z * b.x) +
- r.z * (b.y * g.x - g.y * b.x);
+ float det = determinant();
det = 1.0f / det;
QColorMatrix inv;
inv.r.x = (g.y * b.z - b.y * g.z) * det;
@@ -155,20 +245,20 @@ public:
inv.b.z = (r.x * g.y - g.x * r.y) * det;
return inv;
}
- QColorMatrix operator*(const QColorMatrix &o) const
+ friend inline constexpr QColorMatrix operator*(const QColorMatrix &a, const QColorMatrix &o)
{
QColorMatrix comb;
- comb.r.x = r.x * o.r.x + g.x * o.r.y + b.x * o.r.z;
- comb.g.x = r.x * o.g.x + g.x * o.g.y + b.x * o.g.z;
- comb.b.x = r.x * o.b.x + g.x * o.b.y + b.x * o.b.z;
+ comb.r.x = a.r.x * o.r.x + a.g.x * o.r.y + a.b.x * o.r.z;
+ comb.g.x = a.r.x * o.g.x + a.g.x * o.g.y + a.b.x * o.g.z;
+ comb.b.x = a.r.x * o.b.x + a.g.x * o.b.y + a.b.x * o.b.z;
- comb.r.y = r.y * o.r.x + g.y * o.r.y + b.y * o.r.z;
- comb.g.y = r.y * o.g.x + g.y * o.g.y + b.y * o.g.z;
- comb.b.y = r.y * o.b.x + g.y * o.b.y + b.y * o.b.z;
+ comb.r.y = a.r.y * o.r.x + a.g.y * o.r.y + a.b.y * o.r.z;
+ comb.g.y = a.r.y * o.g.x + a.g.y * o.g.y + a.b.y * o.g.z;
+ comb.b.y = a.r.y * o.b.x + a.g.y * o.b.y + a.b.y * o.b.z;
- comb.r.z = r.z * o.r.x + g.z * o.r.y + b.z * o.r.z;
- comb.g.z = r.z * o.g.x + g.z * o.g.y + b.z * o.g.z;
- comb.b.z = r.z * o.b.x + g.z * o.b.y + b.z * o.b.z;
+ comb.r.z = a.r.z * o.r.x + a.g.z * o.r.y + a.b.z * o.r.z;
+ comb.g.z = a.r.z * o.g.x + a.g.z * o.g.y + a.b.z * o.g.z;
+ comb.b.z = a.r.z * o.b.x + a.g.z * o.b.y + a.b.z * o.b.z;
return comb;
}
@@ -195,6 +285,32 @@ public:
{ 0.0f, v.y, 0.0f },
{ 0.0f, 0.0f, v.z } };
}
+ static QColorMatrix chromaticAdaptation(const QColorVector &whitePoint)
+ {
+ constexpr QColorVector whitePointD50 = QColorVector::D50();
+ if (whitePoint != whitePointD50) {
+ // A chromatic adaptation to map a white point to XYZ D50.
+
+ // The Bradford method chromatic adaptation matrix:
+ const QColorMatrix abrad = { { 0.8951f, -0.7502f, 0.0389f },
+ { 0.2664f, 1.7135f, -0.0685f },
+ { -0.1614f, 0.0367f, 1.0296f } };
+ const QColorMatrix abradinv = { { 0.9869929f, 0.4323053f, -0.0085287f },
+ { -0.1470543f, 0.5183603f, 0.0400428f },
+ { 0.1599627f, 0.0492912f, 0.9684867f } };
+
+ const QColorVector srcCone = abrad.map(whitePoint);
+ if (srcCone.x && srcCone.y && srcCone.z) {
+ const QColorVector dstCone = abrad.map(whitePointD50);
+ const QColorMatrix wToD50 = { { dstCone.x / srcCone.x, 0, 0 },
+ { 0, dstCone.y / srcCone.y, 0 },
+ { 0, 0, dstCone.z / srcCone.z } };
+ return abradinv * (wToD50 * abrad);
+ }
+ }
+ return QColorMatrix::identity();
+ }
+
// These are used to recognize matrices from ICC profiles:
static QColorMatrix toXyzFromSRgb()
{
@@ -220,18 +336,15 @@ public:
{ 0.1351922452f, 0.7118769884f, 0.0000000000f },
{ 0.0313525312f, 0.0000856627f, 0.8251883388f } };
}
+ friend inline bool comparesEqual(const QColorMatrix &lhs, const QColorMatrix &rhs);
+ Q_DECLARE_EQUALITY_COMPARABLE(QColorMatrix);
};
-inline bool operator==(const QColorMatrix &m1, const QColorMatrix &m2)
+inline bool comparesEqual(const QColorMatrix &m1, const QColorMatrix &m2)
{
return (m1.r == m2.r) && (m1.g == m2.g) && (m1.b == m2.b);
}
-inline bool operator!=(const QColorMatrix &m1, const QColorMatrix &m2)
-{
- return !(m1 == m2);
-}
-
QT_END_NAMESPACE
#endif // QCOLORMATRIX_P_H
diff --git a/src/gui/painting/qcolorspace.cpp b/src/gui/painting/qcolorspace.cpp
index 9631fdb416..7a1d34a408 100644
--- a/src/gui/painting/qcolorspace.cpp
+++ b/src/gui/painting/qcolorspace.cpp
@@ -1,51 +1,17 @@
-/****************************************************************************
-**
-** Copyright (C) 2018 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the QtGui module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2020 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#include "qcolorspace.h"
#include "qcolorspace_p.h"
#include "qcolortransform.h"
+#include "qcolorclut_p.h"
#include "qcolormatrix_p.h"
#include "qcolortransferfunction_p.h"
#include "qcolortransform_p.h"
#include "qicc_p.h"
+#include <qatomic.h>
#include <qmath.h>
#include <qtransform.h>
@@ -53,7 +19,19 @@
QT_BEGIN_NAMESPACE
-QBasicMutex QColorSpacePrivate::s_lutWriteLock;
+Q_CONSTINIT QBasicMutex QColorSpacePrivate::s_lutWriteLock;
+
+Q_CONSTINIT static QAtomicPointer<QColorSpacePrivate> s_predefinedColorspacePrivates[QColorSpace::ProPhotoRgb] = {};
+static void cleanupPredefinedColorspaces()
+{
+ for (QAtomicPointer<QColorSpacePrivate> &ptr : s_predefinedColorspacePrivates) {
+ QColorSpacePrivate *prv = ptr.fetchAndStoreAcquire(nullptr);
+ if (prv && !prv->ref.deref())
+ delete prv;
+ }
+}
+
+Q_DESTRUCTOR_FUNCTION(cleanupPredefinedColorspaces)
QColorSpacePrimaries::QColorSpacePrimaries(QColorSpace::Primaries primaries)
{
@@ -103,45 +81,19 @@ bool QColorSpacePrimaries::areValid() const
QColorMatrix QColorSpacePrimaries::toXyzMatrix() const
{
// This converts to XYZ in some undefined scale.
- QColorMatrix toXyz = { QColorVector(redPoint),
- QColorVector(greenPoint),
- QColorVector(bluePoint) };
+ QColorMatrix toXyz = { QColorVector::fromXYChromaticity(redPoint),
+ QColorVector::fromXYChromaticity(greenPoint),
+ QColorVector::fromXYChromaticity(bluePoint) };
// Since the white point should be (1.0, 1.0, 1.0) in the
// input, we can figure out the scale by using the
// inverse conversion on the white point.
- QColorVector wXyz(whitePoint);
+ const auto wXyz = QColorVector::fromXYChromaticity(whitePoint);
QColorVector whiteScale = toXyz.inverted().map(wXyz);
// Now we have scaled conversion to XYZ relative to the given whitepoint
toXyz = toXyz * QColorMatrix::fromScale(whiteScale);
- // But we want a conversion to XYZ relative to D50
- QColorVector wXyzD50 = QColorVector::D50();
-
- if (wXyz != wXyzD50) {
- // Do chromatic adaptation to map our white point to XYZ D50.
-
- // The Bradford method chromatic adaptation matrix:
- QColorMatrix abrad = { { 0.8951f, -0.7502f, 0.0389f },
- { 0.2664f, 1.7135f, -0.0685f },
- { -0.1614f, 0.0367f, 1.0296f } };
- QColorMatrix abradinv = { { 0.9869929f, 0.4323053f, -0.0085287f },
- { -0.1470543f, 0.5183603f, 0.0400428f },
- { 0.1599627f, 0.0492912f, 0.9684867f } };
-
- QColorVector srcCone = abrad.map(wXyz);
- QColorVector dstCone = abrad.map(wXyzD50);
-
- QColorMatrix wToD50 = { { dstCone.x / srcCone.x, 0, 0 },
- { 0, dstCone.y / srcCone.y, 0 },
- { 0, 0, dstCone.z / srcCone.z } };
-
-
- QColorMatrix chromaticAdaptation = abradinv * (wToD50 * abrad);
- toXyz = chromaticAdaptation * toXyz;
- }
-
return toXyz;
}
@@ -151,6 +103,7 @@ QColorSpacePrivate::QColorSpacePrivate()
QColorSpacePrivate::QColorSpacePrivate(QColorSpace::NamedColorSpace namedColorSpace)
: namedColorSpace(namedColorSpace)
+ , colorModel(QColorSpace::ColorModel::Rgb)
{
switch (namedColorSpace) {
case QColorSpace::SRgb:
@@ -185,9 +138,10 @@ QColorSpacePrivate::QColorSpacePrivate(QColorSpace::NamedColorSpace namedColorSp
initialize();
}
-QColorSpacePrivate::QColorSpacePrivate(QColorSpace::Primaries primaries, QColorSpace::TransferFunction fun, float gamma)
+QColorSpacePrivate::QColorSpacePrivate(QColorSpace::Primaries primaries, QColorSpace::TransferFunction transferFunction, float gamma)
: primaries(primaries)
- , transferFunction(fun)
+ , transferFunction(transferFunction)
+ , colorModel(QColorSpace::ColorModel::Rgb)
, gamma(gamma)
{
identifyColorSpace();
@@ -195,19 +149,97 @@ QColorSpacePrivate::QColorSpacePrivate(QColorSpace::Primaries primaries, QColorS
}
QColorSpacePrivate::QColorSpacePrivate(const QColorSpacePrimaries &primaries,
- QColorSpace::TransferFunction fun,
+ QColorSpace::TransferFunction transferFunction,
float gamma)
: primaries(QColorSpace::Primaries::Custom)
- , transferFunction(fun)
+ , transferFunction(transferFunction)
+ , colorModel(QColorSpace::ColorModel::Rgb)
, gamma(gamma)
+ , whitePoint(QColorVector::fromXYChromaticity(primaries.whitePoint))
{
Q_ASSERT(primaries.areValid());
toXyz = primaries.toXyzMatrix();
- whitePoint = QColorVector(primaries.whitePoint);
+ chad = QColorMatrix::chromaticAdaptation(whitePoint);
+ toXyz = chad * toXyz;
+
identifyColorSpace();
setTransferFunction();
}
+QColorSpacePrivate::QColorSpacePrivate(const QPointF &whitePoint,
+ QColorSpace::TransferFunction transferFunction,
+ float gamma)
+ : primaries(QColorSpace::Primaries::Custom)
+ , transferFunction(transferFunction)
+ , colorModel(QColorSpace::ColorModel::Gray)
+ , gamma(gamma)
+ , whitePoint(QColorVector::fromXYChromaticity(whitePoint))
+{
+ chad = QColorMatrix::chromaticAdaptation(this->whitePoint);
+ toXyz = chad;
+ setTransferFunction();
+}
+
+QColorSpacePrivate::QColorSpacePrivate(const QPointF &whitePoint, const QList<uint16_t> &transferFunctionTable)
+ : primaries(QColorSpace::Primaries::Custom)
+ , transferFunction(QColorSpace::TransferFunction::Custom)
+ , colorModel(QColorSpace::ColorModel::Gray)
+ , gamma(0)
+ , whitePoint(QColorVector::fromXYChromaticity(whitePoint))
+{
+ chad = QColorMatrix::chromaticAdaptation(this->whitePoint);
+ toXyz = chad;
+ setTransferFunctionTable(transferFunctionTable);
+ setTransferFunction();
+}
+
+QColorSpacePrivate::QColorSpacePrivate(QColorSpace::Primaries primaries, const QList<uint16_t> &transferFunctionTable)
+ : primaries(primaries)
+ , transferFunction(QColorSpace::TransferFunction::Custom)
+ , colorModel(QColorSpace::ColorModel::Rgb)
+ , gamma(0)
+{
+ setTransferFunctionTable(transferFunctionTable);
+ identifyColorSpace();
+ initialize();
+}
+
+QColorSpacePrivate::QColorSpacePrivate(const QColorSpacePrimaries &primaries, const QList<uint16_t> &transferFunctionTable)
+ : primaries(QColorSpace::Primaries::Custom)
+ , transferFunction(QColorSpace::TransferFunction::Custom)
+ , colorModel(QColorSpace::ColorModel::Rgb)
+ , gamma(0)
+ , whitePoint(QColorVector::fromXYChromaticity(primaries.whitePoint))
+{
+ Q_ASSERT(primaries.areValid());
+ toXyz = primaries.toXyzMatrix();
+ chad = QColorMatrix::chromaticAdaptation(whitePoint);
+ toXyz = chad * toXyz;
+ setTransferFunctionTable(transferFunctionTable);
+ identifyColorSpace();
+ initialize();
+}
+
+QColorSpacePrivate::QColorSpacePrivate(const QColorSpacePrimaries &primaries,
+ const QList<uint16_t> &redTransferFunctionTable,
+ const QList<uint16_t> &greenTransferFunctionTable,
+ const QList<uint16_t> &blueTransferFunctionTable)
+ : primaries(QColorSpace::Primaries::Custom)
+ , transferFunction(QColorSpace::TransferFunction::Custom)
+ , colorModel(QColorSpace::ColorModel::Rgb)
+ , gamma(0)
+{
+ Q_ASSERT(primaries.areValid());
+ toXyz = primaries.toXyzMatrix();
+ whitePoint = QColorVector::fromXYChromaticity(primaries.whitePoint);
+ chad = QColorMatrix::chromaticAdaptation(whitePoint);
+ toXyz = chad * toXyz;
+ setTransferFunctionTables(redTransferFunctionTable,
+ greenTransferFunctionTable,
+ blueTransferFunctionTable);
+ identifyColorSpace();
+}
+
void QColorSpacePrivate::identifyColorSpace()
{
switch (primaries) {
@@ -282,7 +314,76 @@ void QColorSpacePrivate::setToXyzMatrix()
}
QColorSpacePrimaries colorSpacePrimaries(primaries);
toXyz = colorSpacePrimaries.toXyzMatrix();
- whitePoint = QColorVector(colorSpacePrimaries.whitePoint);
+ whitePoint = QColorVector::fromXYChromaticity(colorSpacePrimaries.whitePoint);
+ chad = QColorMatrix::chromaticAdaptation(whitePoint);
+ toXyz = chad * toXyz;
+}
+
+void QColorSpacePrivate::setTransferFunctionTable(const QList<uint16_t> &transferFunctionTable)
+{
+ QColorTransferTable table(transferFunctionTable.size(), transferFunctionTable);
+ if (!table.isEmpty() && !table.checkValidity()) {
+ qWarning() << "Invalid transfer function table given to QColorSpace";
+ trc[0].m_type = QColorTrc::Type::Uninitialized;
+ return;
+ }
+ transferFunction = QColorSpace::TransferFunction::Custom;
+ QColorTransferFunction curve;
+ if (table.asColorTransferFunction(&curve)) {
+ // Table recognized as a specific curve
+ if (curve.isIdentity()) {
+ transferFunction = QColorSpace::TransferFunction::Linear;
+ gamma = 1.0f;
+ } else if (curve.isSRgb()) {
+ transferFunction = QColorSpace::TransferFunction::SRgb;
+ }
+ trc[0].m_type = QColorTrc::Type::Function;
+ trc[0].m_fun = curve;
+ } else {
+ trc[0].m_type = QColorTrc::Type::Table;
+ trc[0].m_table = table;
+ }
+}
+
+void QColorSpacePrivate::setTransferFunctionTables(const QList<uint16_t> &redTransferFunctionTable,
+ const QList<uint16_t> &greenTransferFunctionTable,
+ const QList<uint16_t> &blueTransferFunctionTable)
+{
+ QColorTransferTable redTable(redTransferFunctionTable.size(), redTransferFunctionTable);
+ QColorTransferTable greenTable(greenTransferFunctionTable.size(), greenTransferFunctionTable);
+ QColorTransferTable blueTable(blueTransferFunctionTable.size(), blueTransferFunctionTable);
+ if (!redTable.isEmpty() && !greenTable.isEmpty() && !blueTable.isEmpty() &&
+ !redTable.checkValidity() && !greenTable.checkValidity() && !blueTable.checkValidity()) {
+ qWarning() << "Invalid transfer function table given to QColorSpace";
+ trc[0].m_type = QColorTrc::Type::Uninitialized;
+ trc[1].m_type = QColorTrc::Type::Uninitialized;
+ trc[2].m_type = QColorTrc::Type::Uninitialized;
+ return;
+ }
+ transferFunction = QColorSpace::TransferFunction::Custom;
+ QColorTransferFunction curve;
+ if (redTable.asColorTransferFunction(&curve)) {
+ trc[0].m_type = QColorTrc::Type::Function;
+ trc[0].m_fun = curve;
+ } else {
+ trc[0].m_type = QColorTrc::Type::Table;
+ trc[0].m_table = redTable;
+ }
+ if (greenTable.asColorTransferFunction(&curve)) {
+ trc[1].m_type = QColorTrc::Type::Function;
+ trc[1].m_fun = curve;
+ } else {
+ trc[1].m_type = QColorTrc::Type::Table;
+ trc[1].m_table = greenTable;
+ }
+ if (blueTable.asColorTransferFunction(&curve)) {
+ trc[2].m_type = QColorTrc::Type::Function;
+ trc[2].m_fun = curve;
+ } else {
+ trc[2].m_type = QColorTrc::Type::Table;
+ trc[2].m_table = blueTable;
+ }
+ lut.generated.storeRelease(0);
}
void QColorSpacePrivate::setTransferFunction()
@@ -318,6 +419,7 @@ void QColorSpacePrivate::setTransferFunction()
}
trc[1] = trc[0];
trc[2] = trc[0];
+ lut.generated.storeRelease(0);
}
QColorTransform QColorSpacePrivate::transformationToColorSpace(const QColorSpacePrivate *out) const
@@ -326,13 +428,52 @@ QColorTransform QColorSpacePrivate::transformationToColorSpace(const QColorSpace
QColorTransform combined;
auto ptr = new QColorTransformPrivate;
combined.d = ptr;
- combined.d->ref.ref();
ptr->colorSpaceIn = this;
ptr->colorSpaceOut = out;
- ptr->colorMatrix = out->toXyz.inverted() * toXyz;
+ if (isThreeComponentMatrix())
+ ptr->colorMatrix = toXyz;
+ else
+ ptr->colorMatrix = QColorMatrix::identity();
+ if (out->isThreeComponentMatrix())
+ ptr->colorMatrix = out->toXyz.inverted() * ptr->colorMatrix;
+ if (ptr->isIdentity())
+ return QColorTransform();
return combined;
}
+QColorTransform QColorSpacePrivate::transformationToXYZ() const
+{
+ QColorTransform transform;
+ auto ptr = new QColorTransformPrivate;
+ transform.d = ptr;
+ ptr->colorSpaceIn = this;
+ ptr->colorSpaceOut = this;
+ // Convert to XYZ relative to our white point, not the regular D50 white point.
+ if (isThreeComponentMatrix())
+ ptr->colorMatrix = QColorMatrix::chromaticAdaptation(whitePoint).inverted() * toXyz;
+ else
+ ptr->colorMatrix = QColorMatrix::identity();
+ return transform;
+}
+
+bool QColorSpacePrivate::isThreeComponentMatrix() const
+{
+ return transformModel == QColorSpace::TransformModel::ThreeComponentMatrix;
+}
+
+void QColorSpacePrivate::clearElementListProcessingForEdit()
+{
+ Q_ASSERT(transformModel == QColorSpace::TransformModel::ElementListProcessing);
+ Q_ASSERT(primaries == QColorSpace::Primaries::Custom);
+ Q_ASSERT(transferFunction == QColorSpace::TransferFunction::Custom);
+
+ transformModel = QColorSpace::TransformModel::ThreeComponentMatrix;
+ colorModel = QColorSpace::ColorModel::Rgb;
+ isPcsLab = false;
+ mAB.clear();
+ mBA.clear();
+}
+
/*!
\class QColorSpace
\brief The QColorSpace class provides a color space abstraction.
@@ -355,9 +496,10 @@ QColorTransform QColorSpacePrivate::transformationToColorSpace(const QColorSpace
A color space can generally speaking be conceived as a combination of set of primary
colors and a transfer function. The primaries defines the axes of the color space, and
the transfer function how values are mapped on the axes.
- The primaries are defined by three primary colors that represent exactly how red, green,
- and blue look in this particular color space, and a white color that represents where
- and how bright pure white is. The range of colors expressable by the primary colors is
+ The primaries are for ColorModel::Rgb color spaces defined by three primary colors that
+ represent exactly how red, green, and blue look in this particular color space, and a white
+ color that represents where and how bright pure white is. For grayscale color spaces, only
+ a single white primary is needed. The range of colors expressible by the primary colors is
called the gamut, and a color space that can represent a wider range of colors is also
known as a wide-gamut color space.
@@ -411,35 +553,71 @@ QColorTransform QColorSpacePrivate::transformationToColorSpace(const QColorSpace
*/
/*!
+ \enum QColorSpace::TransformModel
+ \since 6.8
+
+ Defines the processing model used for color space transforms.
+
+ \value ThreeComponentMatrix The transform consist of a matrix calculated from primaries and set of transfer functions
+ for each color channel. This is very fast and used by all predefined color spaces. Any color space on this form is
+ reversible and always both valid sources and targets.
+ \value ElementListProcessing The transforms are one or two lists of processing elements that can do many things,
+ each list only process either to the connection color space or from it. This is very flexible, but rather
+ slow, and can only be set by reading ICC profiles (See \l fromIccProfile()). Since the two lists are
+ separate a color space on this form can be a valid source, but not necessarily also a valid target. When changing
+ either primaries or transfer function on a color space on this type it will reset to an empty ThreeComponentMatrix form.
+*/
+
+/*!
+ \enum QColorSpace::ColorModel
+ \since 6.8
+
+ Defines the color model used by the color space data.
+
+ \value Undefined No color model
+ \value Rgb An RGB color model with red, green, and blue colors. Can apply to RGB and grayscale data.
+ \value Gray A gray scale color model. Can only apply to grayscale data.
+ \value Cmyk Can only represent color data defined with cyan, magenta, yellow, and black colors.
+ In effect only QImage::Format_CMYK32. Note Cmyk color spaces will be TransformModel::ElementListProcessing.
+*/
+
+/*!
+ \fn QColorSpace::QColorSpace()
+
Creates a new colorspace object that represents an undefined and invalid colorspace.
*/
-QColorSpace::QColorSpace()
-{
-}
/*!
Creates a new colorspace object that represents a \a namedColorSpace.
*/
QColorSpace::QColorSpace(NamedColorSpace namedColorSpace)
{
- static QColorSpacePrivate *predefinedColorspacePrivates[QColorSpace::ProPhotoRgb + 1];
- if (!predefinedColorspacePrivates[namedColorSpace]) {
- predefinedColorspacePrivates[namedColorSpace] = new QColorSpacePrivate(namedColorSpace);
- predefinedColorspacePrivates[namedColorSpace]->ref.ref();
+ if (namedColorSpace < QColorSpace::SRgb || namedColorSpace > QColorSpace::ProPhotoRgb) {
+ qWarning() << "QColorSpace attempted constructed from invalid QColorSpace::NamedColorSpace: " << int(namedColorSpace);
+ return;
+ }
+ // The defined namespaces start at 1:
+ auto &atomicRef = s_predefinedColorspacePrivates[static_cast<int>(namedColorSpace) - 1];
+ QColorSpacePrivate *cspriv = atomicRef.loadAcquire();
+ if (!cspriv) {
+ auto *tmp = new QColorSpacePrivate(namedColorSpace);
+ tmp->ref.ref();
+ if (atomicRef.testAndSetOrdered(nullptr, tmp, cspriv))
+ cspriv = tmp;
+ else
+ delete tmp;
}
- d_ptr = predefinedColorspacePrivates[namedColorSpace];
- d_ptr->ref.ref();
+ d_ptr = cspriv;
Q_ASSERT(isValid());
}
/*!
- Creates a custom color space with the primaries \a primaries, using the transfer function \a fun and
+ Creates a custom color space with the primaries \a primaries, using the transfer function \a transferFunction and
optionally \a gamma.
*/
-QColorSpace::QColorSpace(QColorSpace::Primaries primaries, QColorSpace::TransferFunction fun, float gamma)
- : d_ptr(new QColorSpacePrivate(primaries, fun, gamma))
+QColorSpace::QColorSpace(QColorSpace::Primaries primaries, QColorSpace::TransferFunction transferFunction, float gamma)
+ : d_ptr(new QColorSpacePrivate(primaries, transferFunction, gamma))
{
- d_ptr->ref.ref();
}
/*!
@@ -449,51 +627,99 @@ QColorSpace::QColorSpace(QColorSpace::Primaries primaries, QColorSpace::Transfer
QColorSpace::QColorSpace(QColorSpace::Primaries primaries, float gamma)
: d_ptr(new QColorSpacePrivate(primaries, TransferFunction::Gamma, gamma))
{
- d_ptr->ref.ref();
+}
+
+/*!
+ Creates a custom color space with the primaries \a gamut, using a custom transfer function
+ described by \a transferFunctionTable.
+
+ The table should contain at least 2 values, and contain an monotonically increasing list
+ of values from 0 to 65535.
+
+ \since 6.1
+ */
+QColorSpace::QColorSpace(QColorSpace::Primaries gamut, const QList<uint16_t> &transferFunctionTable)
+ : d_ptr(new QColorSpacePrivate(gamut, transferFunctionTable))
+{
+}
+
+/*!
+ Creates a custom grayscale color space with the white point \a whitePoint, using the transfer function \a transferFunction and
+ optionally \a gamma.
+
+ \since 6.8
+*/
+QColorSpace::QColorSpace(const QPointF &whitePoint, TransferFunction transferFunction, float gamma)
+ : d_ptr(new QColorSpacePrivate(whitePoint, transferFunction, gamma))
+{
+}
+
+/*!
+ Creates a custom grayscale color space with white point \a whitePoint, and using the custom transfer function described by
+ \a transferFunctionTable.
+
+ \since 6.8
+*/
+QColorSpace::QColorSpace(const QPointF &whitePoint, const QList<uint16_t> &transferFunctionTable)
+ : d_ptr(new QColorSpacePrivate(whitePoint, transferFunctionTable))
+{
}
/*!
Creates a custom colorspace with a primaries based on the chromaticities of the primary colors \a whitePoint,
- \a redPoint, \a greenPoint and \a bluePoint, and using the transfer function \a fun and optionally \a gamma.
+ \a redPoint, \a greenPoint and \a bluePoint, and using the transfer function \a transferFunction and optionally \a gamma.
*/
QColorSpace::QColorSpace(const QPointF &whitePoint, const QPointF &redPoint,
const QPointF &greenPoint, const QPointF &bluePoint,
- QColorSpace::TransferFunction fun, float gamma)
+ QColorSpace::TransferFunction transferFunction, float gamma)
{
QColorSpacePrimaries primaries(whitePoint, redPoint, greenPoint, bluePoint);
if (!primaries.areValid()) {
qWarning() << "QColorSpace attempted constructed from invalid primaries:" << whitePoint << redPoint << greenPoint << bluePoint;
- d_ptr = nullptr;
return;
}
- d_ptr = new QColorSpacePrivate(primaries, fun, gamma);
- d_ptr->ref.ref();
+ d_ptr = new QColorSpacePrivate(primaries, transferFunction, gamma);
}
-QColorSpace::~QColorSpace()
-{
- if (d_ptr && !d_ptr->ref.deref())
- delete d_ptr;
-}
+/*!
+ Creates a custom color space with primaries based on the chromaticities of the primary colors \a whitePoint,
+ \a redPoint, \a greenPoint and \a bluePoint, and using the custom transfer function described by
+ \a transferFunctionTable.
-QColorSpace::QColorSpace(const QColorSpace &colorSpace)
- : d_ptr(colorSpace.d_ptr)
+ \since 6.1
+ */
+QColorSpace::QColorSpace(const QPointF &whitePoint, const QPointF &redPoint,
+ const QPointF &greenPoint, const QPointF &bluePoint,
+ const QList<uint16_t> &transferFunctionTable)
+ : d_ptr(new QColorSpacePrivate({whitePoint, redPoint, greenPoint, bluePoint}, transferFunctionTable))
{
- if (d_ptr)
- d_ptr->ref.ref();
}
-QColorSpace &QColorSpace::operator=(const QColorSpace &colorSpace)
+/*!
+ Creates a custom color space with primaries based on the chromaticities of the primary colors \a whitePoint,
+ \a redPoint, \a greenPoint and \a bluePoint, and using the custom transfer functions described by
+ \a redTransferFunctionTable, \a greenTransferFunctionTable, and \a blueTransferFunctionTable.
+
+ \since 6.1
+ */
+QColorSpace::QColorSpace(const QPointF &whitePoint, const QPointF &redPoint,
+ const QPointF &greenPoint, const QPointF &bluePoint,
+ const QList<uint16_t> &redTransferFunctionTable,
+ const QList<uint16_t> &greenTransferFunctionTable,
+ const QList<uint16_t> &blueTransferFunctionTable)
+ : d_ptr(new QColorSpacePrivate({whitePoint, redPoint, greenPoint, bluePoint},
+ redTransferFunctionTable,
+ greenTransferFunctionTable,
+ blueTransferFunctionTable))
{
- QColorSpacePrivate *oldD = d_ptr;
- d_ptr = colorSpace.d_ptr;
- if (d_ptr)
- d_ptr->ref.ref();
- if (oldD && !oldD->ref.deref())
- delete oldD;
- return *this;
}
+QColorSpace::~QColorSpace() = default;
+
+QT_DEFINE_QESDP_SPECIALIZATION_DTOR(QColorSpacePrivate)
+
+QColorSpace::QColorSpace(const QColorSpace &colorSpace) noexcept = default;
+
/*! \fn void QColorSpace::swap(QColorSpace &other)
Swaps color space \a other with this color space. This operation is very fast and
@@ -545,12 +771,19 @@ float QColorSpace::gamma() const noexcept
*/
void QColorSpace::setTransferFunction(QColorSpace::TransferFunction transferFunction, float gamma)
{
- if (!isValid() || transferFunction == QColorSpace::TransferFunction::Custom)
+ if (transferFunction == TransferFunction::Custom)
return;
+ if (!d_ptr) {
+ d_ptr = new QColorSpacePrivate(Primaries::Custom, transferFunction, gamma);
+ return;
+ }
if (d_ptr->transferFunction == transferFunction && d_ptr->gamma == gamma)
return;
- QColorSpacePrivate::getWritable(*this); // detach
- d_ptr->description.clear();
+ detach();
+ if (d_ptr->transformModel == TransformModel::ElementListProcessing)
+ d_ptr->clearElementListProcessingForEdit();
+ d_ptr->iccProfile = {};
+ d_ptr->description = QString();
d_ptr->transferFunction = transferFunction;
d_ptr->gamma = gamma;
d_ptr->identifyColorSpace();
@@ -558,6 +791,61 @@ void QColorSpace::setTransferFunction(QColorSpace::TransferFunction transferFunc
}
/*!
+ Sets the transfer function to \a transferFunctionTable.
+
+ \since 6.1
+ \sa withTransferFunction()
+*/
+void QColorSpace::setTransferFunction(const QList<uint16_t> &transferFunctionTable)
+{
+ if (!d_ptr) {
+ d_ptr = new QColorSpacePrivate(Primaries::Custom, transferFunctionTable);
+ d_ptr->ref.ref();
+ return;
+ }
+ detach();
+ if (d_ptr->transformModel == TransformModel::ElementListProcessing)
+ d_ptr->clearElementListProcessingForEdit();
+ d_ptr->iccProfile = {};
+ d_ptr->description = QString();
+ d_ptr->setTransferFunctionTable(transferFunctionTable);
+ d_ptr->gamma = 0;
+ d_ptr->identifyColorSpace();
+ d_ptr->setTransferFunction();
+}
+
+/*!
+ Sets the transfer functions to \a redTransferFunctionTable,
+ \a greenTransferFunctionTable and \a blueTransferFunctionTable.
+
+ \since 6.1
+ \sa withTransferFunctions()
+*/
+void QColorSpace::setTransferFunctions(const QList<uint16_t> &redTransferFunctionTable,
+ const QList<uint16_t> &greenTransferFunctionTable,
+ const QList<uint16_t> &blueTransferFunctionTable)
+{
+ if (!d_ptr) {
+ d_ptr = new QColorSpacePrivate();
+ d_ptr->setTransferFunctionTables(redTransferFunctionTable,
+ greenTransferFunctionTable,
+ blueTransferFunctionTable);
+ d_ptr->ref.ref();
+ return;
+ }
+ detach();
+ if (d_ptr->transformModel == TransformModel::ElementListProcessing)
+ d_ptr->clearElementListProcessingForEdit();
+ d_ptr->iccProfile = {};
+ d_ptr->description = QString();
+ d_ptr->setTransferFunctionTables(redTransferFunctionTable,
+ greenTransferFunctionTable,
+ blueTransferFunctionTable);
+ d_ptr->gamma = 0;
+ d_ptr->identifyColorSpace();
+}
+
+/*!
Returns a copy of this color space, except using the transfer function
\a transferFunction and \a gamma.
@@ -565,7 +853,7 @@ void QColorSpace::setTransferFunction(QColorSpace::TransferFunction transferFunc
*/
QColorSpace QColorSpace::withTransferFunction(QColorSpace::TransferFunction transferFunction, float gamma) const
{
- if (!isValid() || transferFunction == QColorSpace::TransferFunction::Custom)
+ if (!isValid() || transferFunction == TransferFunction::Custom)
return *this;
if (d_ptr->transferFunction == transferFunction && d_ptr->gamma == gamma)
return *this;
@@ -575,19 +863,62 @@ QColorSpace QColorSpace::withTransferFunction(QColorSpace::TransferFunction tran
}
/*!
+ Returns a copy of this color space, except using the transfer function
+ described by \a transferFunctionTable.
+
+ \since 6.1
+ \sa transferFunction(), setTransferFunction()
+*/
+QColorSpace QColorSpace::withTransferFunction(const QList<uint16_t> &transferFunctionTable) const
+{
+ if (!isValid())
+ return *this;
+ QColorSpace out(*this);
+ out.setTransferFunction(transferFunctionTable);
+ return out;
+}
+
+/*!
+ Returns a copy of this color space, except using the transfer functions
+ described by \a redTransferFunctionTable, \a greenTransferFunctionTable and
+ \a blueTransferFunctionTable.
+
+ \since 6.1
+ \sa setTransferFunctions()
+*/
+QColorSpace QColorSpace::withTransferFunctions(const QList<uint16_t> &redTransferFunctionTable,
+ const QList<uint16_t> &greenTransferFunctionTable,
+ const QList<uint16_t> &blueTransferFunctionTable) const
+{
+ if (!isValid())
+ return *this;
+ QColorSpace out(*this);
+ out.setTransferFunctions(redTransferFunctionTable, greenTransferFunctionTable, blueTransferFunctionTable);
+ return out;
+}
+
+/*!
Sets the primaries to those of the \a primariesId set.
\sa primaries()
*/
void QColorSpace::setPrimaries(QColorSpace::Primaries primariesId)
{
- if (!isValid() || primariesId == QColorSpace::Primaries::Custom)
+ if (primariesId == Primaries::Custom)
+ return;
+ if (!d_ptr) {
+ d_ptr = new QColorSpacePrivate(primariesId, TransferFunction::Custom, 0.0f);
return;
+ }
if (d_ptr->primaries == primariesId)
return;
- QColorSpacePrivate::getWritable(*this); // detach
- d_ptr->description.clear();
+ detach();
+ if (d_ptr->transformModel == TransformModel::ElementListProcessing)
+ d_ptr->clearElementListProcessingForEdit();
+ d_ptr->iccProfile = {};
+ d_ptr->description = QString();
d_ptr->primaries = primariesId;
+ d_ptr->colorModel = QColorSpace::ColorModel::Rgb;
d_ptr->identifyColorSpace();
d_ptr->setToXyzMatrix();
}
@@ -601,23 +932,119 @@ void QColorSpace::setPrimaries(QColorSpace::Primaries primariesId)
void QColorSpace::setPrimaries(const QPointF &whitePoint, const QPointF &redPoint,
const QPointF &greenPoint, const QPointF &bluePoint)
{
- if (!isValid())
- return;
QColorSpacePrimaries primaries(whitePoint, redPoint, greenPoint, bluePoint);
if (!primaries.areValid())
return;
+ if (!d_ptr) {
+ d_ptr = new QColorSpacePrivate(primaries, TransferFunction::Custom, 0.0f);
+ return;
+ }
QColorMatrix toXyz = primaries.toXyzMatrix();
- if (QColorVector(primaries.whitePoint) == d_ptr->whitePoint && toXyz == d_ptr->toXyz)
+ QColorMatrix chad = QColorMatrix::chromaticAdaptation(QColorVector::fromXYChromaticity(whitePoint));
+ toXyz = chad * toXyz;
+ if (QColorVector::fromXYChromaticity(primaries.whitePoint) == d_ptr->whitePoint
+ && toXyz == d_ptr->toXyz && chad == d_ptr->chad)
return;
- QColorSpacePrivate::getWritable(*this); // detach
- d_ptr->description.clear();
+ detach();
+ if (d_ptr->transformModel == TransformModel::ElementListProcessing)
+ d_ptr->clearElementListProcessingForEdit();
+ d_ptr->iccProfile = {};
+ d_ptr->description = QString();
d_ptr->primaries = QColorSpace::Primaries::Custom;
+ d_ptr->colorModel = QColorSpace::ColorModel::Rgb;
d_ptr->toXyz = toXyz;
- d_ptr->whitePoint = QColorVector(primaries.whitePoint);
+ d_ptr->chad = chad;
+ d_ptr->whitePoint = QColorVector::fromXYChromaticity(primaries.whitePoint);
d_ptr->identifyColorSpace();
}
/*!
+ Returns the white point used for this color space. Returns a null QPointF if not defined.
+
+ \since 6.8
+*/
+QPointF QColorSpace::whitePoint() const
+{
+ if (Q_UNLIKELY(!d_ptr))
+ return QPointF();
+ return d_ptr->whitePoint.toChromaticity();
+}
+
+/*!
+ Sets the white point to used for this color space to \a whitePoint.
+
+ \since 6.8
+*/
+void QColorSpace::setWhitePoint(const QPointF &whitePoint)
+{
+ if (Q_UNLIKELY(!d_ptr)) {
+ d_ptr = new QColorSpacePrivate(whitePoint, TransferFunction::Custom, 0.0f);
+ return;
+ }
+ if (QColorVector::fromXYChromaticity(whitePoint) == d_ptr->whitePoint)
+ return;
+ detach();
+ if (d_ptr->transformModel == TransformModel::ElementListProcessing)
+ d_ptr->clearElementListProcessingForEdit();
+ d_ptr->iccProfile = {};
+ d_ptr->description = QString();
+ d_ptr->primaries = QColorSpace::Primaries::Custom;
+ // An RGB color model stays RGB, a gray stays gray, but an undefined one can now be considered gray
+ if (d_ptr->colorModel == QColorSpace::ColorModel::Undefined)
+ d_ptr->colorModel = QColorSpace::ColorModel::Gray;
+ QColorVector wXyz(QColorVector::fromXYChromaticity(whitePoint));
+ if (d_ptr->transformModel == QColorSpace::TransformModel::ThreeComponentMatrix) {
+ if (d_ptr->colorModel == QColorSpace::ColorModel::Rgb) {
+ // Rescale toXyz to new whitepoint
+ QColorMatrix rawToXyz = d_ptr->chad.inverted() * d_ptr->toXyz;
+ QColorVector whiteScale = rawToXyz.inverted().map(wXyz);
+ rawToXyz = rawToXyz * QColorMatrix::fromScale(whiteScale);
+ d_ptr->chad = QColorMatrix::chromaticAdaptation(wXyz);
+ d_ptr->toXyz = d_ptr->chad * rawToXyz;
+ } else if (d_ptr->colorModel == QColorSpace::ColorModel::Gray) {
+ d_ptr->chad = d_ptr->toXyz = QColorMatrix::chromaticAdaptation(wXyz);
+ }
+ }
+ d_ptr->whitePoint = wXyz;
+ d_ptr->identifyColorSpace();
+}
+
+/*!
+ Returns the transfrom processing model used for this color space.
+
+ \since 6.8
+*/
+QColorSpace::TransformModel QColorSpace::transformModel() const noexcept
+{
+ if (Q_UNLIKELY(!d_ptr))
+ return QColorSpace::TransformModel::ThreeComponentMatrix;
+ return d_ptr->transformModel;
+}
+
+/*!
+ Returns the color model this color space can represent
+
+ \since 6.8
+*/
+QColorSpace::ColorModel QColorSpace::colorModel() const noexcept
+{
+ if (Q_UNLIKELY(!d_ptr))
+ return QColorSpace::ColorModel::Undefined;
+ return d_ptr->colorModel;
+}
+
+/*!
+ \internal
+*/
+void QColorSpace::detach()
+{
+ if (d_ptr)
+ d_ptr.detach();
+ else
+ d_ptr = new QColorSpacePrivate;
+}
+
+/*!
Returns an ICC profile representing the color space.
If the color space was generated from an ICC profile, that profile
@@ -644,7 +1071,7 @@ QByteArray QColorSpace::iccProfile() const
Creates a QColorSpace from ICC profile \a iccProfile.
\note Not all ICC profiles are supported. QColorSpace only supports
- RGB-XYZ ICC profiles that are three-component matrix-based.
+ RGB or Gray ICC profiles.
If the ICC profile is not supported an invalid QColorSpace is returned
where you can still read the original ICC profile using iccProfile().
@@ -656,88 +1083,271 @@ QColorSpace QColorSpace::fromIccProfile(const QByteArray &iccProfile)
QColorSpace colorSpace;
if (QIcc::fromIccProfile(iccProfile, &colorSpace))
return colorSpace;
- QColorSpacePrivate *d = QColorSpacePrivate::getWritable(colorSpace);
- d->iccProfile = iccProfile;
+ colorSpace.detach();
+ colorSpace.d_ptr->iccProfile = iccProfile;
return colorSpace;
}
/*!
- Returns \c true if the color space is valid.
+ Returns \c true if the color space is valid. For a color space with \c TransformModel::ThreeComponentMatrix
+ that means both primaries and transfer functions set, and implies isValidTarget().
+ For a color space with \c TransformModel::ElementListProcessing it means it has a valid source transform, to
+ check if it also a valid target color space use isValidTarget().
+
+ \sa isValidTarget()
*/
bool QColorSpace::isValid() const noexcept
{
- return d_ptr
- && d_ptr->toXyz.isValid()
- && d_ptr->trc[0].isValid() && d_ptr->trc[1].isValid() && d_ptr->trc[2].isValid();
+ if (!d_ptr)
+ return false;
+ return d_ptr->isValid();
}
/*!
- \relates QColorSpace
+ \since 6.8
+
+ Returns \c true if the color space is a valid target color space.
+*/
+bool QColorSpace::isValidTarget() const noexcept
+{
+ if (!d_ptr)
+ return false;
+ if (!d_ptr->isThreeComponentMatrix())
+ return !d_ptr->mBA.isEmpty();
+ return d_ptr->isValid();
+}
+
+/*!
+ \internal
+*/
+bool QColorSpacePrivate::isValid() const noexcept
+{
+ if (!isThreeComponentMatrix())
+ return !mAB.isEmpty();
+ if (!toXyz.isValid())
+ return false;
+ if (colorModel == QColorSpace::ColorModel::Gray) {
+ if (!trc[0].isValid())
+ return false;
+ } else {
+ if (!trc[0].isValid() || !trc[1].isValid() || !trc[2].isValid())
+ return false;
+ }
+ return true;
+}
+
+/*!
+ \fn bool QColorSpace::operator==(const QColorSpace &colorSpace1, const QColorSpace &colorSpace2)
+
Returns \c true if colorspace \a colorSpace1 is equal to colorspace \a colorSpace2;
otherwise returns \c false
*/
-bool operator==(const QColorSpace &colorSpace1, const QColorSpace &colorSpace2)
+
+/*!
+ \fn bool QColorSpace::operator!=(const QColorSpace &colorSpace1, const QColorSpace &colorSpace2)
+
+ Returns \c true if colorspace \a colorSpace1 is not equal to colorspace \a colorSpace2;
+ otherwise returns \c false
+*/
+
+static bool compareElement(const QColorSpacePrivate::TransferElement &element,
+ const QColorSpacePrivate::TransferElement &other)
+{
+ return element.trc[0] == other.trc[0]
+ && element.trc[1] == other.trc[1]
+ && element.trc[2] == other.trc[2]
+ && element.trc[3] == other.trc[3];
+}
+
+static bool compareElement(const QColorMatrix &element,
+ const QColorMatrix &other)
+{
+ return element == other;
+}
+
+static bool compareElement(const QColorVector &element,
+ const QColorVector &other)
+{
+ return element == other;
+}
+
+static bool compareElement(const QColorCLUT &element,
+ const QColorCLUT &other)
+{
+ if (element.gridPointsX != other.gridPointsX)
+ return false;
+ if (element.gridPointsY != other.gridPointsY)
+ return false;
+ if (element.gridPointsZ != other.gridPointsZ)
+ return false;
+ if (element.gridPointsW != other.gridPointsW)
+ return false;
+ if (element.table.size() != other.table.size())
+ return false;
+ for (qsizetype i = 0; i < element.table.size(); ++i) {
+ if (element.table[i] != other.table[i])
+ return false;
+ }
+ return true;
+}
+
+template<typename T>
+static bool compareElements(const T &element, const QColorSpacePrivate::Element &other)
+{
+ return compareElement(element, std::get<T>(other));
+}
+
+/*!
+ \internal
+*/
+bool QColorSpace::equals(const QColorSpace &other) const
{
- if (colorSpace1.d_ptr == colorSpace2.d_ptr)
+ if (d_ptr == other.d_ptr)
return true;
- if (!colorSpace1.d_ptr || !colorSpace2.d_ptr)
+ if (!d_ptr)
return false;
+ return d_ptr->equals(other.d_ptr.constData());
+}
- if (colorSpace1.d_ptr->namedColorSpace && colorSpace2.d_ptr->namedColorSpace)
- return colorSpace1.d_ptr->namedColorSpace == colorSpace2.d_ptr->namedColorSpace;
+/*!
+ \internal
+*/
+bool QColorSpacePrivate::equals(const QColorSpacePrivate *other) const
+{
+ if (!other)
+ return false;
+
+ if (namedColorSpace && other->namedColorSpace)
+ return namedColorSpace == other->namedColorSpace;
- const bool valid1 = colorSpace1.isValid();
- const bool valid2 = colorSpace2.isValid();
- if (!valid1 && !valid2)
- return colorSpace1.d_ptr->iccProfile == colorSpace2.d_ptr->iccProfile;
- else if (!valid1 || !valid2)
+ const bool valid1 = isValid();
+ const bool valid2 = other->isValid();
+ if (valid1 != valid2)
+ return false;
+ if (!valid1 && !valid2) {
+ if (!iccProfile.isEmpty() || !other->iccProfile.isEmpty())
+ return iccProfile == other->iccProfile;
return false;
+ }
+
+ // At this point one or both color spaces are unknown, and must be compared in detail instead
- // At this point one or both color spaces are unknown but valid, and must be compared in detail instead
+ if (transformModel != other->transformModel)
+ return false;
- if (colorSpace1.primaries() != QColorSpace::Primaries::Custom && colorSpace2.primaries() != QColorSpace::Primaries::Custom) {
- if (colorSpace1.primaries() != colorSpace2.primaries())
+ if (!isThreeComponentMatrix()) {
+ if (isPcsLab != other->isPcsLab)
+ return false;
+ if (colorModel != other->colorModel)
+ return false;
+ if (mAB.count() != other->mAB.count())
+ return false;
+ if (mBA.count() != other->mBA.count())
+ return false;
+
+ // Compare element types
+ for (qsizetype i = 0; i < mAB.count(); ++i) {
+ if (mAB[i].index() != other->mAB[i].index())
+ return false;
+ }
+ for (qsizetype i = 0; i < mBA.count(); ++i) {
+ if (mBA[i].index() != other->mBA[i].index())
+ return false;
+ }
+
+ // Compare element contents
+ for (qsizetype i = 0; i < mAB.count(); ++i) {
+ if (!std::visit([&](auto &&elm) { return compareElements(elm, other->mAB[i]); }, mAB[i]))
+ return false;
+ }
+ for (qsizetype i = 0; i < mBA.count(); ++i) {
+ if (!std::visit([&](auto &&elm) { return compareElements(elm, other->mBA[i]); }, mBA[i]))
+ return false;
+ }
+
+ return true;
+ }
+
+ if (primaries != QColorSpace::Primaries::Custom && other->primaries != QColorSpace::Primaries::Custom) {
+ if (primaries != other->primaries)
return false;
} else {
- if (colorSpace1.d_ptr->toXyz != colorSpace2.d_ptr->toXyz)
+ if (toXyz != other->toXyz)
return false;
}
- if (colorSpace1.transferFunction() != QColorSpace::TransferFunction::Custom &&
- colorSpace2.transferFunction() != QColorSpace::TransferFunction::Custom) {
- if (colorSpace1.transferFunction() != colorSpace2.transferFunction())
+ if (transferFunction != QColorSpace::TransferFunction::Custom && other->transferFunction != QColorSpace::TransferFunction::Custom) {
+ if (transferFunction != other->transferFunction)
return false;
- if (colorSpace1.transferFunction() == QColorSpace::TransferFunction::Gamma)
- return (qAbs(colorSpace1.gamma() - colorSpace2.gamma()) <= (1.0f / 512.0f));
+ if (transferFunction == QColorSpace::TransferFunction::Gamma)
+ return (qAbs(gamma - other->gamma) <= (1.0f / 512.0f));
return true;
}
- if (colorSpace1.d_ptr->trc[0] != colorSpace2.d_ptr->trc[0] ||
- colorSpace1.d_ptr->trc[1] != colorSpace2.d_ptr->trc[1] ||
- colorSpace1.d_ptr->trc[2] != colorSpace2.d_ptr->trc[2])
+ if (trc[0] != other->trc[0] ||
+ trc[1] != other->trc[1] ||
+ trc[2] != other->trc[2])
return false;
return true;
}
/*!
- \fn bool operator!=(const QColorSpace &colorSpace1, const QColorSpace &colorSpace2)
- \relates QColorSpace
-
- Returns \c true if colorspace \a colorSpace1 is not equal to colorspace \a colorSpace2;
- otherwise returns \c false
-*/
-
-/*!
Generates and returns a color space transformation from this color space to
\a colorspace.
*/
QColorTransform QColorSpace::transformationToColorSpace(const QColorSpace &colorspace) const
{
- if (!isValid() || !colorspace.isValid())
+ if (!isValid())
+ return QColorTransform();
+
+ if (*this == colorspace)
return QColorTransform();
+ if (!colorspace.isValidTarget()) {
+ qWarning() << "QColorSpace::transformationToColorSpace: colorspace not a valid target";
+ return QColorTransform();
+ }
- return d_ptr->transformationToColorSpace(colorspace.d_ptr);
+ return d_ptr->transformationToColorSpace(colorspace.d_ptr.get());
+}
+
+/*!
+ Returns the color space as a QVariant.
+ \since 5.15
+*/
+QColorSpace::operator QVariant() const
+{
+ return QVariant::fromValue(*this);
+}
+
+/*!
+ Returns the name or short description. If a description hasn't been given
+ in setDescription(), the original name of the profile is returned if the
+ profile is unmodified, a guessed name is returned if the profile has been
+ recognized as a known color space, otherwise an empty string is returned.
+
+ \since 6.2
+*/
+QString QColorSpace::description() const noexcept
+{
+ if (d_ptr)
+ return d_ptr->userDescription.isEmpty() ? d_ptr->description : d_ptr->userDescription;
+ return QString();
+}
+
+/*!
+ Sets the name or short description of the color space to \a description.
+
+ If set to empty description() will return original or guessed descriptions
+ instead.
+
+ \since 6.2
+*/
+void QColorSpace::setDescription(const QString &description)
+{
+ detach();
+ d_ptr->iccProfile = {};
+ d_ptr->userDescription = description;
}
/*****************************************************************************
@@ -779,6 +1389,28 @@ QDataStream &operator>>(QDataStream &s, QColorSpace &colorSpace)
#endif // QT_NO_DATASTREAM
#ifndef QT_NO_DEBUG_STREAM
+QDebug operator<<(QDebug dbg, const QColorSpacePrivate::TransferElement &)
+{
+ return dbg << ":Transfer";
+}
+QDebug operator<<(QDebug dbg, const QColorMatrix &)
+{
+ return dbg << ":Matrix";
+}
+QDebug operator<<(QDebug dbg, const QColorVector &)
+{
+ return dbg << ":Offset";
+}
+QDebug operator<<(QDebug dbg, const QColorCLUT &)
+{
+ return dbg << ":CLUT";
+}
+QDebug operator<<(QDebug dbg, const QList<QColorSpacePrivate::Element> &elements)
+{
+ for (auto &&element : elements)
+ std::visit([&](auto &&elm) { dbg << elm; }, element);
+ return dbg;
+}
QDebug operator<<(QDebug dbg, const QColorSpace &colorSpace)
{
QDebugStateSaver saver(dbg);
@@ -787,8 +1419,22 @@ QDebug operator<<(QDebug dbg, const QColorSpace &colorSpace)
if (colorSpace.d_ptr) {
if (colorSpace.d_ptr->namedColorSpace)
dbg << colorSpace.d_ptr->namedColorSpace << ", ";
- dbg << colorSpace.primaries() << ", " << colorSpace.transferFunction();
- dbg << ", gamma=" << colorSpace.gamma();
+ if (!colorSpace.isValid()) {
+ dbg << "Invalid";
+ if (!colorSpace.d_ptr->iccProfile.isEmpty())
+ dbg << " with profile data";
+ } else if (colorSpace.d_ptr->isThreeComponentMatrix()) {
+ dbg << colorSpace.primaries() << ", " << colorSpace.transferFunction();
+ dbg << ", gamma=" << colorSpace.gamma();
+ } else {
+ if (colorSpace.d_ptr->isPcsLab)
+ dbg << "PCSLab, ";
+ else
+ dbg << "PCSXYZ, ";
+ dbg << "A2B" << colorSpace.d_ptr->mAB;
+ if (!colorSpace.d_ptr->mBA.isEmpty())
+ dbg << ", B2A" << colorSpace.d_ptr->mBA;
+ }
}
dbg << ')';
return dbg;
@@ -796,3 +1442,5 @@ QDebug operator<<(QDebug dbg, const QColorSpace &colorSpace)
#endif
QT_END_NAMESPACE
+
+#include "moc_qcolorspace.cpp"
diff --git a/src/gui/painting/qcolorspace.h b/src/gui/painting/qcolorspace.h
index e6bc62d58a..488cbd6a53 100644
--- a/src/gui/painting/qcolorspace.h
+++ b/src/gui/painting/qcolorspace.h
@@ -1,41 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2018 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the QtGui module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2018 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#ifndef QCOLORSPACE_H
#define QCOLORSPACE_H
@@ -44,12 +8,15 @@
#include <QtGui/qcolortransform.h>
#include <QtCore/qobjectdefs.h>
#include <QtCore/qshareddata.h>
+#include <QtCore/qvariant.h>
QT_BEGIN_NAMESPACE
class QColorSpacePrivate;
class QPointF;
+QT_DECLARE_QESDP_SPECIALIZATION_DTOR_WITH_EXPORT(QColorSpacePrivate, Q_GUI_EXPORT)
+
class Q_GUI_EXPORT QColorSpace
{
Q_GADGET
@@ -78,69 +45,106 @@ public:
ProPhotoRgb
};
Q_ENUM(TransferFunction)
+ enum class TransformModel : uint8_t {
+ ThreeComponentMatrix = 0,
+ ElementListProcessing,
+ };
+ Q_ENUM(TransformModel)
+ enum class ColorModel : uint8_t {
+ Undefined = 0,
+ Rgb = 1,
+ Gray = 2,
+ Cmyk = 3,
+ };
+ Q_ENUM(ColorModel)
- QColorSpace();
+ QColorSpace() noexcept = default;
QColorSpace(NamedColorSpace namedColorSpace);
- QColorSpace(Primaries primaries, TransferFunction fun, float gamma = 0.0f);
+ QColorSpace(const QPointF &whitePoint, TransferFunction transferFunction, float gamma = 0.0f);
+ QColorSpace(const QPointF &whitePoint, const QList<uint16_t> &transferFunctionTable);
+ QColorSpace(Primaries primaries, TransferFunction transferFunction, float gamma = 0.0f);
QColorSpace(Primaries primaries, float gamma);
+ QColorSpace(Primaries primaries, const QList<uint16_t> &transferFunctionTable);
+ QColorSpace(const QPointF &whitePoint, const QPointF &redPoint,
+ const QPointF &greenPoint, const QPointF &bluePoint,
+ TransferFunction transferFunction, float gamma = 0.0f);
+ QColorSpace(const QPointF &whitePoint, const QPointF &redPoint,
+ const QPointF &greenPoint, const QPointF &bluePoint,
+ const QList<uint16_t> &transferFunctionTable);
QColorSpace(const QPointF &whitePoint, const QPointF &redPoint,
const QPointF &greenPoint, const QPointF &bluePoint,
- TransferFunction fun, float gamma = 0.0f);
+ const QList<uint16_t> &redTransferFunctionTable,
+ const QList<uint16_t> &greenTransferFunctionTable,
+ const QList<uint16_t> &blueTransferFunctionTable);
~QColorSpace();
- QColorSpace(const QColorSpace &colorSpace);
- QColorSpace &operator=(const QColorSpace &colorSpace);
-
- QColorSpace(QColorSpace &&colorSpace) noexcept
- : d_ptr(qExchange(colorSpace.d_ptr, nullptr))
- { }
- QColorSpace &operator=(QColorSpace &&colorSpace) noexcept
+ QColorSpace(const QColorSpace &colorSpace) noexcept;
+ QColorSpace &operator=(const QColorSpace &colorSpace) noexcept
{
- // Make the deallocation of this->d_ptr happen in ~QColorSpace()
- QColorSpace(std::move(colorSpace)).swap(*this);
+ QColorSpace copy(colorSpace);
+ swap(copy);
return *this;
}
+ QColorSpace(QColorSpace &&colorSpace) noexcept = default;
+ QT_MOVE_ASSIGNMENT_OPERATOR_IMPL_VIA_MOVE_AND_SWAP(QColorSpace)
+
void swap(QColorSpace &colorSpace) noexcept
- { qSwap(d_ptr, colorSpace.d_ptr); }
+ { d_ptr.swap(colorSpace.d_ptr); }
Primaries primaries() const noexcept;
TransferFunction transferFunction() const noexcept;
float gamma() const noexcept;
+ QString description() const noexcept;
+ void setDescription(const QString &description);
+
void setTransferFunction(TransferFunction transferFunction, float gamma = 0.0f);
+ void setTransferFunction(const QList<uint16_t> &transferFunctionTable);
+ void setTransferFunctions(const QList<uint16_t> &redTransferFunctionTable,
+ const QList<uint16_t> &greenTransferFunctionTable,
+ const QList<uint16_t> &blueTransferFunctionTable);
QColorSpace withTransferFunction(TransferFunction transferFunction, float gamma = 0.0f) const;
+ QColorSpace withTransferFunction(const QList<uint16_t> &transferFunctionTable) const;
+ QColorSpace withTransferFunctions(const QList<uint16_t> &redTransferFunctionTable,
+ const QList<uint16_t> &greenTransferFunctionTable,
+ const QList<uint16_t> &blueTransferFunctionTable) const;
void setPrimaries(Primaries primariesId);
void setPrimaries(const QPointF &whitePoint, const QPointF &redPoint,
const QPointF &greenPoint, const QPointF &bluePoint);
+ void setWhitePoint(const QPointF &whitePoint);
+ QPointF whitePoint() const;
+ TransformModel transformModel() const noexcept;
+ ColorModel colorModel() const noexcept;
+ void detach();
bool isValid() const noexcept;
+ bool isValidTarget() const noexcept;
- friend Q_GUI_EXPORT bool operator==(const QColorSpace &colorSpace1, const QColorSpace &colorSpace2);
- friend inline bool operator!=(const QColorSpace &colorSpace1, const QColorSpace &colorSpace2);
+ friend inline bool operator==(const QColorSpace &colorSpace1, const QColorSpace &colorSpace2)
+ { return colorSpace1.equals(colorSpace2); }
+ friend inline bool operator!=(const QColorSpace &colorSpace1, const QColorSpace &colorSpace2)
+ { return !(colorSpace1 == colorSpace2); }
static QColorSpace fromIccProfile(const QByteArray &iccProfile);
QByteArray iccProfile() const;
QColorTransform transformationToColorSpace(const QColorSpace &colorspace) const;
+ operator QVariant() const;
private:
- Q_DECLARE_PRIVATE(QColorSpace)
- QColorSpacePrivate *d_ptr = nullptr;
+ friend class QColorSpacePrivate;
+ bool equals(const QColorSpace &other) const;
+
+ QExplicitlySharedDataPointer<QColorSpacePrivate> d_ptr;
#ifndef QT_NO_DEBUG_STREAM
friend Q_GUI_EXPORT QDebug operator<<(QDebug dbg, const QColorSpace &colorSpace);
#endif
};
-bool Q_GUI_EXPORT operator==(const QColorSpace &colorSpace1, const QColorSpace &colorSpace2);
-inline bool operator!=(const QColorSpace &colorSpace1, const QColorSpace &colorSpace2)
-{
- return !(colorSpace1 == colorSpace2);
-}
-
Q_DECLARE_SHARED(QColorSpace)
// QColorSpace stream functions
diff --git a/src/gui/painting/qcolorspace_p.h b/src/gui/painting/qcolorspace_p.h
index e7add19ed3..4ec801b16b 100644
--- a/src/gui/painting/qcolorspace_p.h
+++ b/src/gui/painting/qcolorspace_p.h
@@ -1,41 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2018 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the QtGui module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2024 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#ifndef QCOLORSPACE_P_H
#define QCOLORSPACE_P_H
@@ -52,6 +16,7 @@
//
#include "qcolorspace.h"
+#include "qcolorclut_p.h"
#include "qcolormatrix_p.h"
#include "qcolortrc_p.h"
#include "qcolortrclut_p.h"
@@ -60,6 +25,8 @@
#include <QtCore/qpoint.h>
#include <QtCore/qshareddata.h>
+#include <memory>
+
QT_BEGIN_NAMESPACE
class Q_AUTOTEST_EXPORT QColorSpacePrimaries
@@ -91,51 +58,76 @@ class QColorSpacePrivate : public QSharedData
public:
QColorSpacePrivate();
QColorSpacePrivate(QColorSpace::NamedColorSpace namedColorSpace);
- QColorSpacePrivate(QColorSpace::Primaries primaries, QColorSpace::TransferFunction fun, float gamma);
- QColorSpacePrivate(const QColorSpacePrimaries &primaries, QColorSpace::TransferFunction fun, float gamma);
+ QColorSpacePrivate(QColorSpace::Primaries primaries, QColorSpace::TransferFunction transferFunction, float gamma);
+ QColorSpacePrivate(QColorSpace::Primaries primaries, const QList<uint16_t> &transferFunctionTable);
+ QColorSpacePrivate(const QColorSpacePrimaries &primaries, QColorSpace::TransferFunction transferFunction, float gamma);
+ QColorSpacePrivate(const QColorSpacePrimaries &primaries, const QList<uint16_t> &transferFunctionTable);
+ QColorSpacePrivate(const QColorSpacePrimaries &primaries,
+ const QList<uint16_t> &redTransferFunctionTable,
+ const QList<uint16_t> &greenTransferFunctionTable,
+ const QList<uint16_t> &blueRransferFunctionTable);
+ QColorSpacePrivate(const QPointF &whitePoint, QColorSpace::TransferFunction transferFunction, float gamma);
+ QColorSpacePrivate(const QPointF &whitePoint, const QList<uint16_t> &transferFunctionTable);
QColorSpacePrivate(const QColorSpacePrivate &other) = default;
- // named different from get to avoid accidental detachs
- static QColorSpacePrivate *getWritable(QColorSpace &colorSpace)
+ static const QColorSpacePrivate *get(const QColorSpace &colorSpace)
{
- if (!colorSpace.d_ptr) {
- colorSpace.d_ptr = new QColorSpacePrivate;
- colorSpace.d_ptr->ref.ref();
- } else if (colorSpace.d_ptr->ref.loadRelaxed() != 1) {
- colorSpace.d_ptr->ref.deref();
- colorSpace.d_ptr = new QColorSpacePrivate(*colorSpace.d_ptr);
- colorSpace.d_ptr->ref.ref();
- }
- Q_ASSERT(colorSpace.d_ptr->ref.loadRelaxed() == 1);
- return colorSpace.d_ptr;
+ return colorSpace.d_ptr.get();
}
- static const QColorSpacePrivate *get(const QColorSpace &colorSpace)
+ static QColorSpacePrivate *get(QColorSpace &colorSpace)
{
- return colorSpace.d_ptr;
+ return colorSpace.d_ptr.get();
}
+ bool equals(const QColorSpacePrivate *other) const;
+ bool isValid() const noexcept;
+
void initialize();
void setToXyzMatrix();
void setTransferFunction();
void identifyColorSpace();
+ void setTransferFunctionTable(const QList<uint16_t> &transferFunctionTable);
+ void setTransferFunctionTables(const QList<uint16_t> &redTransferFunctionTable,
+ const QList<uint16_t> &greenTransferFunctionTable,
+ const QList<uint16_t> &blueTransferFunctionTable);
QColorTransform transformationToColorSpace(const QColorSpacePrivate *out) const;
+ QColorTransform transformationToXYZ() const;
+
+ bool isThreeComponentMatrix() const;
+ void clearElementListProcessingForEdit();
static constexpr QColorSpace::NamedColorSpace Unknown = QColorSpace::NamedColorSpace(0);
QColorSpace::NamedColorSpace namedColorSpace = Unknown;
QColorSpace::Primaries primaries = QColorSpace::Primaries::Custom;
QColorSpace::TransferFunction transferFunction = QColorSpace::TransferFunction::Custom;
+ QColorSpace::TransformModel transformModel = QColorSpace::TransformModel::ThreeComponentMatrix;
+ QColorSpace::ColorModel colorModel = QColorSpace::ColorModel::Undefined;
float gamma = 0.0f;
QColorVector whitePoint;
+ // Three component matrix data:
QColorTrc trc[3];
QColorMatrix toXyz;
-
+ QColorMatrix chad;
+
+ // Element list processing data:
+ struct TransferElement {
+ QColorTrc trc[4];
+ };
+ using Element = std::variant<TransferElement, QColorMatrix, QColorVector, QColorCLUT>;
+ bool isPcsLab = false;
+ // A = device, B = PCS
+ QList<Element> mAB, mBA;
+
+ // Metadata
QString description;
+ QString userDescription;
QByteArray iccProfile;
- static QBasicMutex s_lutWriteLock;
+ // Cached tables for three component matrix transform:
+ Q_CONSTINIT static QBasicMutex s_lutWriteLock;
struct LUT {
LUT() = default;
~LUT() = default;
@@ -148,9 +140,9 @@ public:
generated.storeRelaxed(1);
}
}
- QSharedPointer<QColorTrcLut> &operator[](int i) { return table[i]; }
- const QSharedPointer<QColorTrcLut> &operator[](int i) const { return table[i]; }
- QSharedPointer<QColorTrcLut> table[3];
+ std::shared_ptr<QColorTrcLut> &operator[](int i) { return table[i]; }
+ const std::shared_ptr<QColorTrcLut> &operator[](int i) const { return table[i]; }
+ std::shared_ptr<QColorTrcLut> table[3];
QAtomicInt generated;
} mutable lut;
};
diff --git a/src/gui/painting/qcolortransferfunction_p.h b/src/gui/painting/qcolortransferfunction_p.h
index 0575dbd888..484cc69114 100644
--- a/src/gui/painting/qcolortransferfunction_p.h
+++ b/src/gui/painting/qcolortransferfunction_p.h
@@ -1,41 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2018 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the QtGui module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2018 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#ifndef QCOLORTRANSFERFUNCTION_P_H
#define QCOLORTRANSFERFUNCTION_P_H
@@ -52,44 +16,52 @@
//
#include <QtGui/private/qtguiglobal_p.h>
+#include <QtCore/QFlags>
#include <cmath>
QT_BEGIN_NAMESPACE
// Defines a ICC parametric curve type 4
-class Q_GUI_EXPORT QColorTransferFunction
+class QColorTransferFunction
{
public:
QColorTransferFunction() noexcept
- : m_a(1.0f), m_b(0.0f), m_c(1.0f), m_d(0.0f), m_e(0.0f), m_f(0.0f), m_g(1.0f), m_flags(0)
+ : m_a(1.0f), m_b(0.0f), m_c(1.0f), m_d(0.0f), m_e(0.0f), m_f(0.0f), m_g(1.0f)
+ , m_flags(Hints(Hint::Calculated) | Hint::IsGamma | Hint::IsIdentity)
{ }
+
QColorTransferFunction(float a, float b, float c, float d, float e, float f, float g) noexcept
- : m_a(a), m_b(b), m_c(c), m_d(d), m_e(e), m_f(f), m_g(g), m_flags(0)
+ : m_a(a), m_b(b), m_c(c), m_d(d), m_e(e), m_f(f), m_g(g), m_flags()
{ }
bool isGamma() const
{
updateHints();
- return m_flags & quint32(Hints::IsGamma);
+ return m_flags & Hint::IsGamma;
}
- bool isLinear() const
+ bool isIdentity() const
{
updateHints();
- return m_flags & quint32(Hints::IsLinear);
+ return m_flags & Hint::IsIdentity;
}
bool isSRgb() const
{
updateHints();
- return m_flags & quint32(Hints::IsSRgb);
+ return m_flags & Hint::IsSRgb;
}
float apply(float x) const
{
if (x < m_d)
return m_c * x + m_f;
+ float t = std::pow(m_a * x + m_b, m_g);
+ if (std::isfinite(t))
+ return t + m_e;
+ if (t > 0.f)
+ return 1.f;
else
- return std::pow(m_a * x + m_b, m_g) + m_e;
+ return 0.f;
}
QColorTransferFunction inverted() const
@@ -98,7 +70,7 @@ public:
d = m_c * m_d + m_f;
- if (!qFuzzyIsNull(m_c)) {
+ if (std::isnormal(m_c)) {
c = 1.0f / m_c;
f = -m_f / m_c;
} else {
@@ -106,8 +78,12 @@ public:
f = 0.0f;
}
- if (!qFuzzyIsNull(m_a) && !qFuzzyIsNull(m_g)) {
+ bool valid_abeg = std::isnormal(m_a) && std::isnormal(m_g);
+ if (valid_abeg)
a = std::pow(1.0f / m_a, m_g);
+ if (valid_abeg && !std::isfinite(a))
+ valid_abeg = false;
+ if (valid_abeg) {
b = -a * m_e;
e = -m_b / m_a;
g = 1.0f / m_g;
@@ -124,15 +100,19 @@ public:
// A few predefined curves:
static QColorTransferFunction fromGamma(float gamma)
{
- return QColorTransferFunction(1.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, gamma);
+ return QColorTransferFunction(1.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, gamma,
+ Hints(Hint::Calculated) | Hint::IsGamma |
+ (paramCompare(gamma, 1.0f) ? Hint::IsIdentity : Hint::NoHint));
}
static QColorTransferFunction fromSRgb()
{
- return QColorTransferFunction(1.0f / 1.055f, 0.055f / 1.055f, 1.0f / 12.92f, 0.04045f, 0.0f, 0.0f, 2.4f);
+ return QColorTransferFunction(1.0f / 1.055f, 0.055f / 1.055f, 1.0f / 12.92f, 0.04045f, 0.0f, 0.0f, 2.4f,
+ Hints(Hint::Calculated) | Hint::IsSRgb);
}
static QColorTransferFunction fromProPhotoRgb()
{
- return QColorTransferFunction(1.0f, 0.0f, 1.0f / 16.0f, 16.0f / 512.0f, 0.0f, 0.0f, 1.8f);
+ return QColorTransferFunction(1.0f, 0.0f, 1.0f / 16.0f, 16.0f / 512.0f, 0.0f, 0.0f, 1.8f,
+ Hints(Hint::Calculated));
}
bool matches(const QColorTransferFunction &o) const
{
@@ -152,7 +132,20 @@ public:
float m_f;
float m_g;
+ enum class Hint : quint32 {
+ NoHint = 0,
+ Calculated = 1,
+ IsGamma = 2,
+ IsIdentity = 4,
+ IsSRgb = 8
+ };
+
+ Q_DECLARE_FLAGS(Hints, Hint);
+
private:
+ QColorTransferFunction(float a, float b, float c, float d, float e, float f, float g, Hints flags) noexcept
+ : m_a(a), m_b(b), m_c(c), m_d(d), m_e(e), m_f(f), m_g(g), m_flags(flags)
+ { }
static inline bool paramCompare(float p1, float p2)
{
// Much fuzzier than fuzzy compare.
@@ -163,7 +156,7 @@ private:
void updateHints() const
{
- if (m_flags & quint32(Hints::Calculated))
+ if (m_flags & Hint::Calculated)
return;
// We do not consider the case with m_d = 1.0f linear or simple,
// since it wouldn't be linear for applyExtended().
@@ -171,24 +164,21 @@ private:
&& paramCompare(m_d, 0.0f)
&& paramCompare(m_e, 0.0f);
if (simple) {
- m_flags |= quint32(Hints::IsGamma);
+ m_flags |= Hint::IsGamma;
if (qFuzzyCompare(m_g, 1.0f))
- m_flags |= quint32(Hints::IsLinear);
+ m_flags |= Hint::IsIdentity;
} else {
if (*this == fromSRgb())
- m_flags |= quint32(Hints::IsSRgb);
+ m_flags |= Hint::IsSRgb;
}
- m_flags |= quint32(Hints::Calculated);
+ m_flags |= Hint::Calculated;
}
- enum class Hints : quint32 {
- Calculated = 1,
- IsGamma = 2,
- IsLinear = 4,
- IsSRgb = 8
- };
- mutable quint32 m_flags;
+
+ mutable Hints m_flags;
};
+Q_DECLARE_OPERATORS_FOR_FLAGS(QColorTransferFunction::Hints);
+
inline bool operator==(const QColorTransferFunction &f1, const QColorTransferFunction &f2)
{
return f1.matches(f2);
diff --git a/src/gui/painting/qcolortransfertable_p.h b/src/gui/painting/qcolortransfertable_p.h
index c8b2f7bd92..ce6ad0c4b2 100644
--- a/src/gui/painting/qcolortransfertable_p.h
+++ b/src/gui/painting/qcolortransfertable_p.h
@@ -1,41 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2018 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the QtGui module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2018 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#ifndef QCOLORTRANSFERTABLE_P_H
#define QCOLORTRANSFERTABLE_P_H
@@ -54,7 +18,9 @@
#include <QtGui/private/qtguiglobal_p.h>
#include "qcolortransferfunction_p.h"
-#include <QVector>
+#include <QList>
+
+#include <algorithm>
#include <cmath>
QT_BEGIN_NAMESPACE
@@ -63,54 +29,85 @@ QT_BEGIN_NAMESPACE
class Q_GUI_EXPORT QColorTransferTable
{
public:
- QColorTransferTable() noexcept
- : m_tableSize(0)
- { }
- QColorTransferTable(uint32_t size, const QVector<uint8_t> &table) noexcept
- : m_tableSize(size)
- , m_table8(table)
- { }
- QColorTransferTable(uint32_t size, const QVector<uint16_t> &table) noexcept
- : m_tableSize(size)
- , m_table16(table)
- { }
-
- bool isValid() const
+ enum Type : uint8_t {
+ TwoWay = 0,
+ OneWay,
+ };
+ QColorTransferTable() noexcept = default;
+ QColorTransferTable(uint32_t size, const QList<uint8_t> &table, Type type = TwoWay) noexcept
+ : m_type(type), m_tableSize(size), m_table8(table)
{
- if (m_tableSize < 2)
+ Q_ASSERT(qsizetype(size) <= table.size());
+ }
+ QColorTransferTable(uint32_t size, const QList<uint16_t> &table, Type type = TwoWay) noexcept
+ : m_type(type), m_tableSize(size), m_table16(table)
+ {
+ Q_ASSERT(qsizetype(size) <= table.size());
+ }
+
+ bool isEmpty() const noexcept
+ {
+ return m_tableSize == 0;
+ }
+
+ bool isIdentity() const
+ {
+ if (isEmpty())
+ return true;
+ if (m_tableSize != 2)
return false;
+ if (!m_table8.isEmpty())
+ return m_table8[0] == 0 && m_table8[1] == 255;
+ return m_table16[0] == 0 && m_table16[1] == 65535;
+ }
-#if !defined(QT_NO_DEBUG)
- // The table must describe an injective curve:
+ bool checkValidity() const
+ {
+ if (isEmpty())
+ return true;
+ // Only one table can be set
+ if (!m_table8.isEmpty() && !m_table16.isEmpty())
+ return false;
+ // At least 2 elements
+ if (m_tableSize < 2)
+ return false;
+ return (m_type == OneWay) || checkInvertibility();
+ }
+ bool checkInvertibility() const
+ {
+ // The two-way tables must describe an injective curve:
if (!m_table8.isEmpty()) {
uint8_t val = 0;
for (uint i = 0; i < m_tableSize; ++i) {
- Q_ASSERT(m_table8[i] >= val);
+ if (m_table8[i] < val)
+ return false;
val = m_table8[i];
}
}
if (!m_table16.isEmpty()) {
uint16_t val = 0;
for (uint i = 0; i < m_tableSize; ++i) {
- Q_ASSERT(m_table16[i] >= val);
+ if (m_table16[i] < val)
+ return false;
val = m_table16[i];
}
}
-#endif
- return !m_table8.isEmpty() || !m_table16.isEmpty();
+ return true;
}
float apply(float x) const
{
- x = std::min(std::max(x, 0.0f), 1.0f);
+ if (isEmpty())
+ return x;
+ x = std::clamp(x, 0.0f, 1.0f);
x *= m_tableSize - 1;
- uint32_t lo = (int)std::floor(x);
- uint32_t hi = std::min(lo + 1, m_tableSize);
- float frac = x - lo;
+ const uint32_t lo = static_cast<uint32_t>(x);
+ const uint32_t hi = std::min(lo + 1, m_tableSize - 1);
+ const float frac = x - lo;
if (!m_table16.isEmpty())
- return (m_table16[lo] * (1.0f - frac) + m_table16[hi] * frac) * (1.0f/65535.0f);
+ return (m_table16[lo] + (m_table16[hi] - m_table16[lo]) * frac) * (1.0f/65535.0f);
if (!m_table8.isEmpty())
- return (m_table8[lo] * (1.0f - frac) + m_table8[hi] * frac) * (1.0f/255.0f);
+ return (m_table8[lo] + (m_table8[hi] - m_table8[lo]) * frac) * (1.0f/255.0f);
return x;
}
@@ -118,48 +115,27 @@ public:
float applyInverse(float x, float resultLargerThan = 0.0f) const
{
Q_ASSERT(resultLargerThan >= 0.0f && resultLargerThan <= 1.0f);
+ Q_ASSERT(m_type == TwoWay);
if (x <= 0.0f)
return 0.0f;
if (x >= 1.0f)
return 1.0f;
- if (!m_table16.isEmpty()) {
- float v = x * 65535.0f;
- uint i = std::floor(resultLargerThan * (m_tableSize - 1)) + 1;
- for ( ; i < m_tableSize; ++i) {
- if (m_table16[i] > v)
- break;
- }
- if (i >= m_tableSize - 1)
- return 1.0f;
- float y1 = m_table16[i - 1];
- float y2 = m_table16[i];
- Q_ASSERT(x >= y1 && x < y2);
- float fr = (v - y1) / (y2 - y1);
- return (i + fr) * (1.0f / (m_tableSize - 1));
-
- }
- if (!m_table8.isEmpty()) {
- float v = x * 255.0f;
- uint i = std::floor(resultLargerThan * (m_tableSize - 1)) + 1;
- for ( ; i < m_tableSize; ++i) {
- if (m_table8[i] > v)
- break;
- }
- if (i >= m_tableSize - 1)
- return 1.0f;
- float y1 = m_table8[i - 1];
- float y2 = m_table8[i];
- Q_ASSERT(x >= y1 && x < y2);
- float fr = (v - y1) / (y2 - y1);
- return (i + fr) * (1.0f / (m_tableSize - 1));
- }
+ if (!m_table16.isEmpty())
+ return inverseLookup(x * 65535.0f, resultLargerThan, m_table16, m_tableSize - 1);
+ if (!m_table8.isEmpty())
+ return inverseLookup(x * 255.0f, resultLargerThan, m_table8, m_tableSize - 1);
return x;
}
bool asColorTransferFunction(QColorTransferFunction *transferFn)
{
- Q_ASSERT(isValid());
Q_ASSERT(transferFn);
+ if (isEmpty()) {
+ *transferFn = QColorTransferFunction();
+ return true;
+ }
+ if (m_tableSize < 2)
+ return false;
if (!m_table8.isEmpty() && (m_table8[0] != 0 || m_table8[m_tableSize - 1] != 255))
return false;
if (!m_table16.isEmpty() && (m_table16[0] != 0 || m_table16[m_tableSize - 1] != 65535))
@@ -207,27 +183,48 @@ public:
friend inline bool operator!=(const QColorTransferTable &t1, const QColorTransferTable &t2);
friend inline bool operator==(const QColorTransferTable &t1, const QColorTransferTable &t2);
- uint32_t m_tableSize;
- QVector<uint8_t> m_table8;
- QVector<uint16_t> m_table16;
+ Type m_type = TwoWay;
+ uint32_t m_tableSize = 0;
+ QList<uint8_t> m_table8;
+ QList<uint16_t> m_table16;
+private:
+ template<typename T>
+ static float inverseLookup(float needle, float resultLargerThan, const QList<T> &table, quint32 tableMax)
+ {
+ uint32_t i = static_cast<uint32_t>(resultLargerThan * tableMax);
+ auto it = std::lower_bound(table.cbegin() + i, table.cend(), needle);
+ i = it - table.cbegin();
+ if (i == 0)
+ return 0.0f;
+ if (i >= tableMax)
+ return 1.0f;
+ const float y1 = table[i - 1];
+ const float y2 = table[i];
+ Q_ASSERT(needle >= y1 && needle <= y2);
+ const float fr = (needle - y1) / (y2 - y1);
+ return (i + fr) * (1.0f / tableMax);
+ }
+
};
inline bool operator!=(const QColorTransferTable &t1, const QColorTransferTable &t2)
{
if (t1.m_tableSize != t2.m_tableSize)
return true;
+ if (t1.m_type != t2.m_type)
+ return true;
if (t1.m_table8.isEmpty() != t2.m_table8.isEmpty())
return true;
if (t1.m_table16.isEmpty() != t2.m_table16.isEmpty())
return true;
if (!t1.m_table8.isEmpty()) {
- for (quint32 i = 0; i < t1.m_tableSize; ++i) {
+ for (uint32_t i = 0; i < t1.m_tableSize; ++i) {
if (t1.m_table8[i] != t2.m_table8[i])
return true;
}
}
if (!t1.m_table16.isEmpty()) {
- for (quint32 i = 0; i < t1.m_tableSize; ++i) {
+ for (uint32_t i = 0; i < t1.m_tableSize; ++i) {
if (t1.m_table16[i] != t2.m_table16[i])
return true;
}
diff --git a/src/gui/painting/qcolortransform.cpp b/src/gui/painting/qcolortransform.cpp
index 10ccefed74..aac07bdc09 100644
--- a/src/gui/painting/qcolortransform.cpp
+++ b/src/gui/painting/qcolortransform.cpp
@@ -1,46 +1,11 @@
-/****************************************************************************
-**
-** Copyright (C) 2018 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the QtGui module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
+// Copyright (C) 2024 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#include "qcolortransform.h"
#include "qcolortransform_p.h"
+#include "qcmyk_p.h"
+#include "qcolorclut_p.h"
#include "qcolormatrix_p.h"
#include "qcolorspace_p.h"
#include "qcolortrc_p.h"
@@ -49,6 +14,7 @@
#include <QtCore/qatomic.h>
#include <QtCore/qmath.h>
#include <QtGui/qcolor.h>
+#include <QtGui/qimage.h>
#include <QtGui/qtransform.h>
#include <QtCore/private/qsimd_p.h>
@@ -56,7 +22,7 @@
QT_BEGIN_NAMESPACE
-QColorTrcLut *lutFromTrc(const QColorTrc &trc)
+std::shared_ptr<QColorTrcLut> lutFromTrc(const QColorTrc &trc)
{
if (trc.m_type == QColorTrc::Type::Table)
return QColorTrcLut::fromTransferTable(trc.m_table);
@@ -80,12 +46,12 @@ void QColorTransformPrivate::updateLutsIn() const
}
if (colorSpaceIn->trc[0] == colorSpaceIn->trc[1] && colorSpaceIn->trc[0] == colorSpaceIn->trc[2]) {
- colorSpaceIn->lut[0].reset(lutFromTrc(colorSpaceIn->trc[0]));
+ colorSpaceIn->lut[0] = lutFromTrc(colorSpaceIn->trc[0]);
colorSpaceIn->lut[1] = colorSpaceIn->lut[0];
colorSpaceIn->lut[2] = colorSpaceIn->lut[0];
} else {
for (int i = 0; i < 3; ++i)
- colorSpaceIn->lut[i].reset(lutFromTrc(colorSpaceIn->trc[i]));
+ colorSpaceIn->lut[i] = lutFromTrc(colorSpaceIn->trc[i]);
}
colorSpaceIn->lut.generated.storeRelease(1);
@@ -104,12 +70,12 @@ void QColorTransformPrivate::updateLutsOut() const
}
if (colorSpaceOut->trc[0] == colorSpaceOut->trc[1] && colorSpaceOut->trc[0] == colorSpaceOut->trc[2]) {
- colorSpaceOut->lut[0].reset(lutFromTrc(colorSpaceOut->trc[0]));
+ colorSpaceOut->lut[0] = lutFromTrc(colorSpaceOut->trc[0]);
colorSpaceOut->lut[1] = colorSpaceOut->lut[0];
colorSpaceOut->lut[2] = colorSpaceOut->lut[0];
} else {
for (int i = 0; i < 3; ++i)
- colorSpaceOut->lut[i].reset(lutFromTrc(colorSpaceOut->trc[i]));
+ colorSpaceOut->lut[i] = lutFromTrc(colorSpaceOut->trc[i]);
}
colorSpaceOut->lut.generated.storeRelease(1);
@@ -134,18 +100,74 @@ void QColorTransformPrivate::updateLutsOut() const
*/
-QColorTransform::QColorTransform(const QColorTransform &colorTransform) noexcept
- : d(colorTransform.d)
+QColorTransform::QColorTransform(const QColorTransform &colorTransform) noexcept = default;
+
+QColorTransform::~QColorTransform() = default;
+
+QT_DEFINE_QESDP_SPECIALIZATION_DTOR(QColorTransformPrivate)
+
+/*!
+ \since 6.4
+ Returns true if the color transform is the identity transform.
+*/
+bool QColorTransform::isIdentity() const noexcept
{
- if (d)
- d->ref.ref();
+ return !d || d->isIdentity();
}
+/*!
+ \fn bool QColorTransform::operator==(const QColorTransform &ct1, const QColorTransform &ct2)
+ \since 6.4
+ Returns true if \a ct1 defines the same color transformation as \a ct2.
+*/
+
+/*!
+ \fn bool QColorTransform::operator!=(const QColorTransform &ct1, const QColorTransform &ct2)
+ \since 6.4
+ Returns true if \a ct1 does not define the same transformation as \a ct2.
+*/
-QColorTransform::~QColorTransform()
+/*! \internal
+*/
+bool QColorTransform::compare(const QColorTransform &other) const
{
- if (d && !d->ref.deref())
- delete d;
+ if (d == other.d)
+ return true;
+ if (bool(d) != bool(other.d))
+ return d ? d->isIdentity() : other.d->isIdentity();
+ if (d->colorMatrix != other.d->colorMatrix)
+ return false;
+ if (bool(d->colorSpaceIn) != bool(other.d->colorSpaceIn))
+ return false;
+ if (bool(d->colorSpaceOut) != bool(other.d->colorSpaceOut))
+ return false;
+ if (d->colorSpaceIn) {
+ if (d->colorSpaceIn->transformModel != other.d->colorSpaceIn->transformModel)
+ return false;
+ if (d->colorSpaceIn->isThreeComponentMatrix()) {
+ for (int i = 0; i < 3; ++i) {
+ if (d->colorSpaceIn && d->colorSpaceIn->trc[i] != other.d->colorSpaceIn->trc[i])
+ return false;
+ }
+ } else {
+ if (!d->colorSpaceIn->equals(other.d->colorSpaceIn.constData()))
+ return false;
+ }
+ }
+ if (d->colorSpaceOut) {
+ if (d->colorSpaceOut->transformModel != other.d->colorSpaceOut->transformModel)
+ return false;
+ if (d->colorSpaceOut->isThreeComponentMatrix()) {
+ for (int i = 0; i < 3; ++i) {
+ if (d->colorSpaceOut && d->colorSpaceOut->trc[i] != other.d->colorSpaceOut->trc[i])
+ return false;
+ }
+ } else {
+ if (!d->colorSpaceOut->equals(other.d->colorSpaceOut.constData()))
+ return false;
+ }
+ }
+ return true;
}
/*!
@@ -159,23 +181,7 @@ QRgb QColorTransform::map(QRgb argb) const
return argb;
constexpr float f = 1.0f / 255.0f;
QColorVector c = { qRed(argb) * f, qGreen(argb) * f, qBlue(argb) * f };
- c.x = d->colorSpaceIn->trc[0].apply(c.x);
- c.y = d->colorSpaceIn->trc[1].apply(c.y);
- c.z = d->colorSpaceIn->trc[2].apply(c.z);
- c = d->colorMatrix.map(c);
- c.x = std::max(0.0f, std::min(1.0f, c.x));
- c.y = std::max(0.0f, std::min(1.0f, c.y));
- c.z = std::max(0.0f, std::min(1.0f, c.z));
- if (d->colorSpaceOut->lut.generated.loadAcquire()) {
- c.x = d->colorSpaceOut->lut[0]->fromLinear(c.x);
- c.y = d->colorSpaceOut->lut[1]->fromLinear(c.y);
- c.z = d->colorSpaceOut->lut[2]->fromLinear(c.z);
- } else {
- c.x = d->colorSpaceOut->trc[0].applyInverse(c.x);
- c.y = d->colorSpaceOut->trc[1].applyInverse(c.y);
- c.z = d->colorSpaceOut->trc[2].applyInverse(c.z);
- }
-
+ c = d->map(c);
return qRgba(c.x * 255 + 0.5f, c.y * 255 + 0.5f, c.z * 255 + 0.5f, qAlpha(argb));
}
@@ -190,24 +196,44 @@ QRgba64 QColorTransform::map(QRgba64 rgba64) const
return rgba64;
constexpr float f = 1.0f / 65535.0f;
QColorVector c = { rgba64.red() * f, rgba64.green() * f, rgba64.blue() * f };
- c.x = d->colorSpaceIn->trc[0].apply(c.x);
- c.y = d->colorSpaceIn->trc[1].apply(c.y);
- c.z = d->colorSpaceIn->trc[2].apply(c.z);
- c = d->colorMatrix.map(c);
- c.x = std::max(0.0f, std::min(1.0f, c.x));
- c.y = std::max(0.0f, std::min(1.0f, c.y));
- c.z = std::max(0.0f, std::min(1.0f, c.z));
- if (d->colorSpaceOut->lut.generated.loadAcquire()) {
- c.x = d->colorSpaceOut->lut[0]->fromLinear(c.x);
- c.y = d->colorSpaceOut->lut[1]->fromLinear(c.y);
- c.z = d->colorSpaceOut->lut[2]->fromLinear(c.z);
- } else {
- c.x = d->colorSpaceOut->trc[0].applyInverse(c.x);
- c.y = d->colorSpaceOut->trc[1].applyInverse(c.y);
- c.z = d->colorSpaceOut->trc[2].applyInverse(c.z);
- }
+ c = d->map(c);
+ return QRgba64::fromRgba64(c.x * 65535.f + 0.5f, c.y * 65535.f + 0.5f, c.z * 65535.f + 0.5f, rgba64.alpha());
+}
+
+/*!
+ Applies the color transformation on the QRgbaFloat16 value \a rgbafp16.
+
+ The input should be opaque or unpremultiplied.
+ \since 6.4
+*/
+QRgbaFloat16 QColorTransform::map(QRgbaFloat16 rgbafp16) const
+{
+ if (!d)
+ return rgbafp16;
+ QColorVector c(rgbafp16.r, rgbafp16.g, rgbafp16.b);
+ c = d->mapExtended(c);
+ rgbafp16.r = qfloat16(c.x);
+ rgbafp16.g = qfloat16(c.y);
+ rgbafp16.b = qfloat16(c.z);
+ return rgbafp16;
+}
- return QRgba64::fromRgba64(c.x * 65535, c.y * 65535, c.z * 65535, rgba64.alpha());
+/*!
+ Applies the color transformation on the QRgbaFloat32 value \a rgbafp32.
+
+ The input should be opaque or unpremultiplied.
+ \since 6.4
+*/
+QRgbaFloat32 QColorTransform::map(QRgbaFloat32 rgbafp32) const
+{
+ if (!d)
+ return rgbafp32;
+ QColorVector c(rgbafp32.r, rgbafp32.g, rgbafp32.b);
+ c = d->mapExtended(c);
+ rgbafp32.r = c.x;
+ rgbafp32.g = c.y;
+ rgbafp32.b = c.z;
+ return rgbafp32;
}
/*!
@@ -219,43 +245,42 @@ QColor QColorTransform::map(const QColor &color) const
if (!d)
return color;
QColor clr = color;
- if (color.spec() != QColor::ExtendedRgb || color.spec() != QColor::Rgb)
- clr = clr.toRgb();
-
- QColorVector c = { (float)clr.redF(), (float)clr.greenF(), (float)clr.blueF() };
- if (clr.spec() == QColor::ExtendedRgb) {
- c.x = d->colorSpaceIn->trc[0].applyExtended(c.x);
- c.y = d->colorSpaceIn->trc[1].applyExtended(c.y);
- c.z = d->colorSpaceIn->trc[2].applyExtended(c.z);
- } else {
- c.x = d->colorSpaceIn->trc[0].apply(c.x);
- c.y = d->colorSpaceIn->trc[1].apply(c.y);
- c.z = d->colorSpaceIn->trc[2].apply(c.z);
- }
- c = d->colorMatrix.map(c);
- bool inGamut = c.x >= 0.0f && c.x <= 1.0f && c.y >= 0.0f && c.y <= 1.0f && c.z >= 0.0f && c.z <= 1.0f;
- if (inGamut) {
- if (d->colorSpaceOut->lut.generated.loadAcquire()) {
- c.x = d->colorSpaceOut->lut[0]->fromLinear(c.x);
- c.y = d->colorSpaceOut->lut[1]->fromLinear(c.y);
- c.z = d->colorSpaceOut->lut[2]->fromLinear(c.z);
- } else {
- c.x = d->colorSpaceOut->trc[0].applyInverse(c.x);
- c.y = d->colorSpaceOut->trc[1].applyInverse(c.y);
- c.z = d->colorSpaceOut->trc[2].applyInverse(c.z);
- }
- } else {
- c.x = d->colorSpaceOut->trc[0].applyInverseExtended(c.x);
- c.y = d->colorSpaceOut->trc[1].applyInverseExtended(c.y);
- c.z = d->colorSpaceOut->trc[2].applyInverseExtended(c.z);
+ if (d->colorSpaceIn->colorModel == QColorSpace::ColorModel::Rgb) {
+ if (color.spec() != QColor::ExtendedRgb && color.spec() != QColor::Rgb)
+ clr = clr.toRgb();
+ } else if (d->colorSpaceIn->colorModel == QColorSpace::ColorModel::Cmyk) {
+ if (color.spec() != QColor::Cmyk)
+ clr = clr.toCmyk();
}
+
+ QColorVector c =
+ (clr.spec() == QColor::Cmyk)
+ ? QColorVector(clr.cyanF(), clr.magentaF(), clr.yellowF(), clr.blackF())
+ : QColorVector(clr.redF(), clr.greenF(), clr.blueF());
+
+ c = d->mapExtended(c);
+
QColor out;
- out.setRgbF(c.x, c.y, c.z, color.alphaF());
+ if (d->colorSpaceOut->colorModel == QColorSpace::ColorModel::Cmyk) {
+ c.x = std::clamp(c.x, 0.f, 1.f);
+ c.y = std::clamp(c.y, 0.f, 1.f);
+ c.z = std::clamp(c.z, 0.f, 1.f);
+ c.w = std::clamp(c.w, 0.f, 1.f);
+ out.setCmykF(c.x, c.y, c.z, c.w, color.alphaF());
+ } else {
+ out.setRgbF(c.x, c.y, c.z, color.alphaF());
+ }
return out;
}
// Optimized sub-routines for fast block based conversion:
+enum ApplyMatrixForm {
+ DoNotClamp = 0,
+ DoClamp = 1
+};
+
+template<ApplyMatrixForm doClamp = DoClamp>
static void applyMatrix(QColorVector *buffer, const qsizetype len, const QColorMatrix &colorMatrix)
{
#if defined(__SSE2__)
@@ -275,20 +300,117 @@ static void applyMatrix(QColorVector *buffer, const qsizetype len, const QColorM
cx = _mm_add_ps(cx, cy);
cx = _mm_add_ps(cx, cz);
// Clamp:
- cx = _mm_min_ps(cx, maxV);
- cx = _mm_max_ps(cx, minV);
+ if (doClamp) {
+ cx = _mm_min_ps(cx, maxV);
+ cx = _mm_max_ps(cx, minV);
+ }
_mm_storeu_ps(&buffer[j].x, cx);
}
+#elif defined(__ARM_NEON__)
+ const float32x4_t minV = vdupq_n_f32(0.0f);
+ const float32x4_t maxV = vdupq_n_f32(1.0f);
+ const float32x4_t xMat = vld1q_f32(&colorMatrix.r.x);
+ const float32x4_t yMat = vld1q_f32(&colorMatrix.g.x);
+ const float32x4_t zMat = vld1q_f32(&colorMatrix.b.x);
+ for (qsizetype j = 0; j < len; ++j) {
+ float32x4_t c = vld1q_f32(&buffer[j].x);
+ float32x4_t cx = vmulq_n_f32(xMat, vgetq_lane_f32(c, 0));
+ float32x4_t cy = vmulq_n_f32(yMat, vgetq_lane_f32(c, 1));
+ float32x4_t cz = vmulq_n_f32(zMat, vgetq_lane_f32(c, 2));
+ cx = vaddq_f32(cx, cy);
+ cx = vaddq_f32(cx, cz);
+ // Clamp:
+ if (doClamp) {
+ cx = vminq_f32(cx, maxV);
+ cx = vmaxq_f32(cx, minV);
+ }
+ vst1q_f32(&buffer[j].x, cx);
+ }
#else
- for (int j = 0; j < len; ++j) {
+ for (qsizetype j = 0; j < len; ++j) {
const QColorVector cv = colorMatrix.map(buffer[j]);
- buffer[j].x = std::max(0.0f, std::min(1.0f, cv.x));
- buffer[j].y = std::max(0.0f, std::min(1.0f, cv.y));
- buffer[j].z = std::max(0.0f, std::min(1.0f, cv.z));
+ if (doClamp) {
+ buffer[j].x = std::clamp(cv.x, 0.f, 1.f);
+ buffer[j].y = std::clamp(cv.y, 0.f, 1.f);
+ buffer[j].z = std::clamp(cv.z, 0.f, 1.f);
+ } else {
+ buffer[j] = cv;
+ }
}
#endif
}
+template<ApplyMatrixForm doClamp = DoClamp>
+static void clampIfNeeded(QColorVector *buffer, const qsizetype len)
+{
+ if constexpr (doClamp != DoClamp)
+ return;
+#if defined(__SSE2__)
+ const __m128 minV = _mm_set1_ps(0.0f);
+ const __m128 maxV = _mm_set1_ps(1.0f);
+ for (qsizetype j = 0; j < len; ++j) {
+ __m128 c = _mm_loadu_ps(&buffer[j].x);
+ c = _mm_min_ps(c, maxV);
+ c = _mm_max_ps(c, minV);
+ _mm_storeu_ps(&buffer[j].x, c);
+ }
+#elif defined(__ARM_NEON__)
+ const float32x4_t minV = vdupq_n_f32(0.0f);
+ const float32x4_t maxV = vdupq_n_f32(1.0f);
+ for (qsizetype j = 0; j < len; ++j) {
+ float32x4_t c = vld1q_f32(&buffer[j].x);
+ c = vminq_f32(c, maxV);
+ c = vmaxq_f32(c, minV);
+ vst1q_f32(&buffer[j].x, c);
+ }
+#else
+ for (qsizetype j = 0; j < len; ++j) {
+ const QColorVector cv = buffer[j];
+ buffer[j].x = std::clamp(cv.x, 0.f, 1.f);
+ buffer[j].y = std::clamp(cv.y, 0.f, 1.f);
+ buffer[j].z = std::clamp(cv.z, 0.f, 1.f);
+ }
+#endif
+}
+
+#if defined(__SSE2__) || defined(__ARM_NEON__)
+template<typename T>
+static constexpr inline bool isArgb();
+template<>
+constexpr inline bool isArgb<QRgb>() { return true; }
+template<>
+constexpr inline bool isArgb<QRgba64>() { return false; }
+
+template<typename T>
+static inline int getAlpha(const T &p);
+template<>
+inline int getAlpha<QRgb>(const QRgb &p)
+{ return qAlpha(p); }
+template<>
+inline int getAlpha<QRgba64>(const QRgba64 &p)
+{ return p.alpha(); }
+
+#endif
+
+template<typename T>
+static float getAlphaF(const T &);
+template<> float getAlphaF(const QRgb &r)
+{
+ return qAlpha(r) * (1.f / 255.f);
+}
+template<> float getAlphaF(const QCmyk32 &)
+{
+ return 1.f;
+}
+template<> float getAlphaF(const QRgba64 &r)
+{
+ return r.alpha() * (1.f / 65535.f);
+}
+template<> float getAlphaF(const QRgbaFloat32 &r)
+{
+ return r.a;
+}
+
template<typename T>
static void loadPremultiplied(QColorVector *buffer, const T *src, const qsizetype len, const QColorTransformPrivate *d_ptr);
template<typename T>
@@ -320,15 +442,14 @@ inline void loadP<QRgba64>(const QRgba64 &p, __m128i &v)
#else
v = _mm_unpacklo_epi16(v, _mm_setzero_si128());
#endif
- // Shuffle to ARGB as the template below expects it
- v = _mm_shuffle_epi32(v, _MM_SHUFFLE(3, 0, 1, 2));
}
template<typename T>
static void loadPremultiplied(QColorVector *buffer, const T *src, const qsizetype len, const QColorTransformPrivate *d_ptr)
{
- const __m128 v4080 = _mm_set1_ps(4080.f);
+ const __m128 vTrcRes = _mm_set1_ps(float(QColorTrcLut::Resolution));
const __m128 iFF00 = _mm_set1_ps(1.0f / (255 * 256));
+ constexpr bool isARGB = isArgb<T>();
for (qsizetype i = 0; i < len; ++i) {
__m128i v;
loadP<T>(src[i], v);
@@ -345,10 +466,10 @@ static void loadPremultiplied(QColorVector *buffer, const T *src, const qsizetyp
vf = _mm_andnot_ps(vAlphaMask, vf);
// LUT
- v = _mm_cvtps_epi32(_mm_mul_ps(vf, v4080));
- const int ridx = _mm_extract_epi16(v, 4);
+ v = _mm_cvtps_epi32(_mm_mul_ps(vf, vTrcRes));
+ const int ridx = isARGB ? _mm_extract_epi16(v, 4) : _mm_extract_epi16(v, 0);
const int gidx = _mm_extract_epi16(v, 2);
- const int bidx = _mm_extract_epi16(v, 0);
+ const int bidx = isARGB ? _mm_extract_epi16(v, 0) : _mm_extract_epi16(v, 4);
v = _mm_insert_epi16(v, d_ptr->colorSpaceIn->lut[0]->m_toLinear[ridx], 0);
v = _mm_insert_epi16(v, d_ptr->colorSpaceIn->lut[1]->m_toLinear[gidx], 2);
v = _mm_insert_epi16(v, d_ptr->colorSpaceIn->lut[2]->m_toLinear[bidx], 4);
@@ -358,7 +479,51 @@ static void loadPremultiplied(QColorVector *buffer, const T *src, const qsizetyp
}
}
-// Load to [0-4080] in 4x32 SIMD
+template<>
+void loadPremultiplied<QRgbaFloat32>(QColorVector *buffer, const QRgbaFloat32 *src, const qsizetype len, const QColorTransformPrivate *d_ptr)
+{
+ const __m128 vTrcRes = _mm_set1_ps(float(QColorTrcLut::Resolution));
+ const __m128 viFF00 = _mm_set1_ps(1.0f / (255 * 256));
+ const __m128 vZero = _mm_set1_ps(0.0f);
+ const __m128 vOne = _mm_set1_ps(1.0f);
+ for (qsizetype i = 0; i < len; ++i) {
+ __m128 vf = _mm_loadu_ps(&src[i].r);
+ // Approximate 1/a:
+ __m128 va = _mm_shuffle_ps(vf, vf, _MM_SHUFFLE(3, 3, 3, 3));
+ __m128 via = _mm_rcp_ps(va);
+ via = _mm_sub_ps(_mm_add_ps(via, via), _mm_mul_ps(via, _mm_mul_ps(via, va)));
+ // v * (1/a)
+ vf = _mm_mul_ps(vf, via);
+
+ // Handle zero alpha
+ __m128 vAlphaMask = _mm_cmpeq_ps(va, vZero);
+ vf = _mm_andnot_ps(vAlphaMask, vf);
+
+ // LUT
+ const __m128 under = _mm_cmplt_ps(vf, vZero);
+ const __m128 over = _mm_cmpgt_ps(vf, vOne);
+ if (_mm_movemask_ps(_mm_or_ps(under, over)) == 0) {
+ // Within gamut
+ __m128i v = _mm_cvtps_epi32(_mm_mul_ps(vf, vTrcRes));
+ const int ridx = _mm_extract_epi16(v, 0);
+ const int gidx = _mm_extract_epi16(v, 2);
+ const int bidx = _mm_extract_epi16(v, 4);
+ v = _mm_insert_epi16(v, d_ptr->colorSpaceIn->lut[0]->m_toLinear[ridx], 0);
+ v = _mm_insert_epi16(v, d_ptr->colorSpaceIn->lut[1]->m_toLinear[gidx], 2);
+ v = _mm_insert_epi16(v, d_ptr->colorSpaceIn->lut[2]->m_toLinear[bidx], 4);
+ vf = _mm_mul_ps(_mm_cvtepi32_ps(v), viFF00);
+ _mm_storeu_ps(&buffer[i].x, vf);
+ } else {
+ // Outside 0.0->1.0 gamut
+ _mm_storeu_ps(&buffer[i].x, vf);
+ buffer[i].x = d_ptr->colorSpaceIn->trc[0].applyExtended(buffer[i].x);
+ buffer[i].y = d_ptr->colorSpaceIn->trc[1].applyExtended(buffer[i].y);
+ buffer[i].z = d_ptr->colorSpaceIn->trc[2].applyExtended(buffer[i].z);
+ }
+ }
+}
+
+// Load to [0->TrcResolution] in 4x32 SIMD
template<typename T>
static inline void loadPU(const T &p, __m128i &v);
@@ -372,7 +537,7 @@ inline void loadPU<QRgb>(const QRgb &p, __m128i &v)
v = _mm_unpacklo_epi8(v, _mm_setzero_si128());
v = _mm_unpacklo_epi16(v, _mm_setzero_si128());
#endif
- v = _mm_slli_epi32(v, 4);
+ v = _mm_slli_epi32(v, QColorTrcLut::ShiftUp);
}
template<>
@@ -385,21 +550,20 @@ inline void loadPU<QRgba64>(const QRgba64 &p, __m128i &v)
#else
v = _mm_unpacklo_epi16(v, _mm_setzero_si128());
#endif
- v = _mm_srli_epi32(v, 4);
- // Shuffle to ARGB as the template below expects it
- v = _mm_shuffle_epi32(v, _MM_SHUFFLE(3, 0, 1, 2));
+ v = _mm_srli_epi32(v, QColorTrcLut::ShiftDown);
}
template<typename T>
void loadUnpremultiplied(QColorVector *buffer, const T *src, const qsizetype len, const QColorTransformPrivate *d_ptr)
{
+ constexpr bool isARGB = isArgb<T>();
const __m128 iFF00 = _mm_set1_ps(1.0f / (255 * 256));
for (qsizetype i = 0; i < len; ++i) {
__m128i v;
loadPU<T>(src[i], v);
- const int ridx = _mm_extract_epi16(v, 4);
+ const int ridx = isARGB ? _mm_extract_epi16(v, 4) : _mm_extract_epi16(v, 0);
const int gidx = _mm_extract_epi16(v, 2);
- const int bidx = _mm_extract_epi16(v, 0);
+ const int bidx = isARGB ? _mm_extract_epi16(v, 0) : _mm_extract_epi16(v, 4);
v = _mm_insert_epi16(v, d_ptr->colorSpaceIn->lut[0]->m_toLinear[ridx], 0);
v = _mm_insert_epi16(v, d_ptr->colorSpaceIn->lut[1]->m_toLinear[gidx], 2);
v = _mm_insert_epi16(v, d_ptr->colorSpaceIn->lut[2]->m_toLinear[bidx], 4);
@@ -408,6 +572,131 @@ void loadUnpremultiplied(QColorVector *buffer, const T *src, const qsizetype len
}
}
+template<>
+void loadUnpremultiplied<QRgbaFloat32>(QColorVector *buffer, const QRgbaFloat32 *src, const qsizetype len, const QColorTransformPrivate *d_ptr)
+{
+ const __m128 vTrcRes = _mm_set1_ps(float(QColorTrcLut::Resolution));
+ const __m128 iFF00 = _mm_set1_ps(1.0f / (255 * 256));
+ const __m128 vZero = _mm_set1_ps(0.0f);
+ const __m128 vOne = _mm_set1_ps(1.0f);
+ for (qsizetype i = 0; i < len; ++i) {
+ __m128 vf = _mm_loadu_ps(&src[i].r);
+ const __m128 under = _mm_cmplt_ps(vf, vZero);
+ const __m128 over = _mm_cmpgt_ps(vf, vOne);
+ if (_mm_movemask_ps(_mm_or_ps(under, over)) == 0) {
+ // Within gamut
+ __m128i v = _mm_cvtps_epi32(_mm_mul_ps(vf, vTrcRes));
+ const int ridx = _mm_extract_epi16(v, 0);
+ const int gidx = _mm_extract_epi16(v, 2);
+ const int bidx = _mm_extract_epi16(v, 4);
+ v = _mm_insert_epi16(v, d_ptr->colorSpaceIn->lut[0]->m_toLinear[ridx], 0);
+ v = _mm_insert_epi16(v, d_ptr->colorSpaceIn->lut[1]->m_toLinear[gidx], 2);
+ v = _mm_insert_epi16(v, d_ptr->colorSpaceIn->lut[2]->m_toLinear[bidx], 4);
+ vf = _mm_mul_ps(_mm_cvtepi32_ps(v), iFF00);
+ _mm_storeu_ps(&buffer[i].x, vf);
+ } else {
+ // Outside 0.0->1.0 gamut
+ buffer[i].x = d_ptr->colorSpaceIn->trc[0].applyExtended(src[i].r);
+ buffer[i].y = d_ptr->colorSpaceIn->trc[1].applyExtended(src[i].g);
+ buffer[i].z = d_ptr->colorSpaceIn->trc[2].applyExtended(src[i].b);
+ }
+ }
+}
+
+#elif defined(__ARM_NEON__)
+// Load to [0-alpha] in 4x32 SIMD
+template<typename T>
+static inline void loadP(const T &p, uint32x4_t &v);
+
+template<>
+inline void loadP<QRgb>(const QRgb &p, uint32x4_t &v)
+{
+ v = vmovl_u16(vget_low_u16(vmovl_u8(vreinterpret_u8_u32(vmov_n_u32(p)))));
+}
+
+template<>
+inline void loadP<QRgba64>(const QRgba64 &p, uint32x4_t &v)
+{
+ v = vmovl_u16(vreinterpret_u16_u64(vld1_u64(reinterpret_cast<const uint64_t *>(&p))));
+}
+
+template<typename T>
+static void loadPremultiplied(QColorVector *buffer, const T *src, const qsizetype len, const QColorTransformPrivate *d_ptr)
+{
+ constexpr bool isARGB = isArgb<T>();
+ const float iFF00 = 1.0f / (255 * 256);
+ for (qsizetype i = 0; i < len; ++i) {
+ uint32x4_t v;
+ loadP<T>(src[i], v);
+ float32x4_t vf = vcvtq_f32_u32(v);
+ // Approximate 1/a:
+ float32x4_t va = vdupq_n_f32(vgetq_lane_f32(vf, 3));
+ float32x4_t via = vrecpeq_f32(va); // estimate 1/a
+ via = vmulq_f32(vrecpsq_f32(va, via), via);
+
+ // v * (1/a)
+ vf = vmulq_f32(vf, via);
+
+ // Handle zero alpha
+#if defined(Q_PROCESSOR_ARM_64)
+ uint32x4_t vAlphaMask = vceqzq_f32(va);
+#else
+ uint32x4_t vAlphaMask = vceqq_f32(va, vdupq_n_f32(0.0));
+#endif
+ vf = vreinterpretq_f32_u32(vbicq_u32(vreinterpretq_u32_f32(vf), vAlphaMask));
+
+ // LUT
+ v = vcvtq_u32_f32(vaddq_f32(vmulq_n_f32(vf, float(QColorTrcLut::Resolution)), vdupq_n_f32(0.5f)));
+ const int ridx = isARGB ? vgetq_lane_u32(v, 2) : vgetq_lane_u32(v, 0);
+ const int gidx = vgetq_lane_u32(v, 1);
+ const int bidx = isARGB ? vgetq_lane_u32(v, 0) : vgetq_lane_u32(v, 2);
+ v = vsetq_lane_u32(d_ptr->colorSpaceIn->lut[0]->m_toLinear[ridx], v, 0);
+ v = vsetq_lane_u32(d_ptr->colorSpaceIn->lut[1]->m_toLinear[gidx], v, 1);
+ v = vsetq_lane_u32(d_ptr->colorSpaceIn->lut[2]->m_toLinear[bidx], v, 2);
+ vf = vmulq_n_f32(vcvtq_f32_u32(v), iFF00);
+
+ vst1q_f32(&buffer[i].x, vf);
+ }
+}
+
+// Load to [0->TrcResultion] in 4x32 SIMD
+template<typename T>
+static inline void loadPU(const T &p, uint32x4_t &v);
+
+template<>
+inline void loadPU<QRgb>(const QRgb &p, uint32x4_t &v)
+{
+ v = vmovl_u16(vget_low_u16(vmovl_u8(vreinterpret_u8_u32(vmov_n_u32(p)))));
+ v = vshlq_n_u32(v, QColorTrcLut::ShiftUp);
+}
+
+template<>
+inline void loadPU<QRgba64>(const QRgba64 &p, uint32x4_t &v)
+{
+ uint16x4_t v16 = vreinterpret_u16_u64(vld1_u64(reinterpret_cast<const uint64_t *>(&p)));
+ v16 = vsub_u16(v16, vshr_n_u16(v16, 8));
+ v = vmovl_u16(v16);
+ v = vshrq_n_u32(v, QColorTrcLut::ShiftDown);
+}
+
+template<typename T>
+void loadUnpremultiplied(QColorVector *buffer, const T *src, const qsizetype len, const QColorTransformPrivate *d_ptr)
+{
+ constexpr bool isARGB = isArgb<T>();
+ const float iFF00 = 1.0f / (255 * 256);
+ for (qsizetype i = 0; i < len; ++i) {
+ uint32x4_t v;
+ loadPU<T>(src[i], v);
+ const int ridx = isARGB ? vgetq_lane_u32(v, 2) : vgetq_lane_u32(v, 0);
+ const int gidx = vgetq_lane_u32(v, 1);
+ const int bidx = isARGB ? vgetq_lane_u32(v, 0) : vgetq_lane_u32(v, 2);
+ v = vsetq_lane_u32(d_ptr->colorSpaceIn->lut[0]->m_toLinear[ridx], v, 0);
+ v = vsetq_lane_u32(d_ptr->colorSpaceIn->lut[1]->m_toLinear[gidx], v, 1);
+ v = vsetq_lane_u32(d_ptr->colorSpaceIn->lut[2]->m_toLinear[bidx], v, 2);
+ float32x4_t vf = vmulq_n_f32(vcvtq_f32_u32(v), iFF00);
+ vst1q_f32(&buffer[i].x, vf);
+ }
+}
#else
template<>
void loadPremultiplied<QRgb>(QColorVector *buffer, const QRgb *src, const qsizetype len, const QColorTransformPrivate *d_ptr)
@@ -416,7 +705,7 @@ void loadPremultiplied<QRgb>(QColorVector *buffer, const QRgb *src, const qsizet
const uint p = src[i];
const int a = qAlpha(p);
if (a) {
- const float ia = 4080.0f / a;
+ const float ia = float(QColorTrcLut::Resolution) / a;
const int ridx = int(qRed(p) * ia + 0.5f);
const int gidx = int(qGreen(p) * ia + 0.5f);
const int bidx = int(qBlue(p) * ia + 0.5f);
@@ -436,7 +725,7 @@ void loadPremultiplied<QRgba64>(QColorVector *buffer, const QRgba64 *src, const
const QRgba64 &p = src[i];
const int a = p.alpha();
if (a) {
- const float ia = 4080.0f / a;
+ const float ia = float(QColorTrcLut::Resolution) / a;
const int ridx = int(p.red() * ia + 0.5f);
const int gidx = int(p.green() * ia + 0.5f);
const int bidx = int(p.blue() * ia + 0.5f);
@@ -471,137 +760,416 @@ void loadUnpremultiplied<QRgba64>(QColorVector *buffer, const QRgba64 *src, cons
}
}
#endif
+#if !defined(__SSE2__)
+template<>
+void loadPremultiplied<QRgbaFloat32>(QColorVector *buffer, const QRgbaFloat32 *src, const qsizetype len, const QColorTransformPrivate *d_ptr)
+{
+ for (qsizetype i = 0; i < len; ++i) {
+ const QRgbaFloat32 &p = src[i];
+ const float a = p.a;
+ if (a) {
+ const float ia = 1.0f / a;
+ buffer[i].x = d_ptr->colorSpaceIn->trc[0].applyExtended(p.r * ia);
+ buffer[i].y = d_ptr->colorSpaceIn->trc[1].applyExtended(p.g * ia);
+ buffer[i].z = d_ptr->colorSpaceIn->trc[2].applyExtended(p.b * ia);
+ } else {
+ buffer[i].x = buffer[i].y = buffer[i].z = 0.0f;
+ }
+ }
+}
-static void storePremultiplied(QRgb *dst, const QRgb *src, const QColorVector *buffer, const qsizetype len,
- const QColorTransformPrivate *d_ptr)
+template<>
+void loadUnpremultiplied<QRgbaFloat32>(QColorVector *buffer, const QRgbaFloat32 *src, const qsizetype len, const QColorTransformPrivate *d_ptr)
{
+ for (qsizetype i = 0; i < len; ++i) {
+ const QRgbaFloat32 &p = src[i];
+ buffer[i].x = d_ptr->colorSpaceIn->trc[0].applyExtended(p.r);
+ buffer[i].y = d_ptr->colorSpaceIn->trc[1].applyExtended(p.g);
+ buffer[i].z = d_ptr->colorSpaceIn->trc[2].applyExtended(p.b);
+ }
+}
+#endif
+
#if defined(__SSE2__)
- const __m128 v4080 = _mm_set1_ps(4080.f);
+template<typename T>
+static inline void storeP(T &p, __m128i &v, int a);
+template<>
+inline void storeP<QRgb>(QRgb &p, __m128i &v, int a)
+{
+ v = _mm_packs_epi32(v, v);
+ v = _mm_insert_epi16(v, a, 3);
+ p = _mm_cvtsi128_si32(_mm_packus_epi16(v, v));
+}
+template<>
+inline void storeP<QRgba64>(QRgba64 &p, __m128i &v, int a)
+{
+#if defined(__SSE4_1__)
+ v = _mm_packus_epi32(v, v);
+ v = _mm_insert_epi16(v, a, 3);
+ _mm_storel_epi64((__m128i *)&p, v);
+#else
+ const int r = _mm_extract_epi16(v, 0);
+ const int g = _mm_extract_epi16(v, 2);
+ const int b = _mm_extract_epi16(v, 4);
+ p = qRgba64(r, g, b, a);
+#endif
+}
+
+template<typename D, typename S,
+ typename = std::enable_if_t<!std::is_same_v<D, QRgbaFloat32>, void>>
+static void storePremultiplied(D *dst, const S *src, const QColorVector *buffer, const qsizetype len,
+ const QColorTransformPrivate *d_ptr)
+{
+ const __m128 vTrcRes = _mm_set1_ps(float(QColorTrcLut::Resolution));
const __m128 iFF00 = _mm_set1_ps(1.0f / (255 * 256));
+ constexpr bool isARGB = isArgb<D>();
for (qsizetype i = 0; i < len; ++i) {
- const int a = qAlpha(src[i]);
+ const int a = getAlpha<S>(src[i]);
__m128 vf = _mm_loadu_ps(&buffer[i].x);
- __m128i v = _mm_cvtps_epi32(_mm_mul_ps(vf, v4080));
- __m128 va = _mm_set1_ps(a);
- va = _mm_mul_ps(va, iFF00);
+ __m128i v = _mm_cvtps_epi32(_mm_mul_ps(vf, vTrcRes));
+ __m128 va = _mm_mul_ps(_mm_set1_ps(a), iFF00);
const int ridx = _mm_extract_epi16(v, 0);
const int gidx = _mm_extract_epi16(v, 2);
const int bidx = _mm_extract_epi16(v, 4);
- v = _mm_insert_epi16(v, d_ptr->colorSpaceOut->lut[0]->m_fromLinear[ridx], 4);
+ v = _mm_insert_epi16(v, d_ptr->colorSpaceOut->lut[0]->m_fromLinear[ridx], isARGB ? 4 : 0);
v = _mm_insert_epi16(v, d_ptr->colorSpaceOut->lut[1]->m_fromLinear[gidx], 2);
- v = _mm_insert_epi16(v, d_ptr->colorSpaceOut->lut[2]->m_fromLinear[bidx], 0);
+ v = _mm_insert_epi16(v, d_ptr->colorSpaceOut->lut[2]->m_fromLinear[bidx], isARGB ? 0 : 4);
vf = _mm_cvtepi32_ps(v);
vf = _mm_mul_ps(vf, va);
v = _mm_cvtps_epi32(vf);
- v = _mm_packs_epi32(v, v);
- v = _mm_insert_epi16(v, a, 3);
- v = _mm_packus_epi16(v, v);
- dst[i] = _mm_cvtsi128_si32(v);
+ storeP<D>(dst[i], v, a);
}
-#else
+}
+
+template<typename S>
+static void storePremultiplied(QRgbaFloat32 *dst, const S *src,
+ const QColorVector *buffer, const qsizetype len,
+ const QColorTransformPrivate *d_ptr)
+{
+ const __m128 vTrcRes = _mm_set1_ps(float(QColorTrcLut::Resolution));
+ const __m128 vZero = _mm_set1_ps(0.0f);
+ const __m128 vOne = _mm_set1_ps(1.0f);
+ const __m128 viFF00 = _mm_set1_ps(1.0f / (255 * 256));
for (qsizetype i = 0; i < len; ++i) {
- const int a = qAlpha(src[i]);
- const float fa = a / (255.0f * 256.0f);
- const float r = d_ptr->colorSpaceOut->lut[0]->m_fromLinear[int(buffer[i].x * 4080.0f + 0.5f)];
- const float g = d_ptr->colorSpaceOut->lut[1]->m_fromLinear[int(buffer[i].y * 4080.0f + 0.5f)];
- const float b = d_ptr->colorSpaceOut->lut[2]->m_fromLinear[int(buffer[i].z * 4080.0f + 0.5f)];
- dst[i] = qRgba(r * fa + 0.5f, g * fa + 0.5f, b * fa + 0.5f, a);
+ const float a = getAlphaF<S>(src[i]);
+ __m128 va = _mm_set1_ps(a);
+ __m128 vf = _mm_loadu_ps(&buffer[i].x);
+ const __m128 under = _mm_cmplt_ps(vf, vZero);
+ const __m128 over = _mm_cmpgt_ps(vf, vOne);
+ if (_mm_movemask_ps(_mm_or_ps(under, over)) == 0) {
+ // Within gamut
+ va = _mm_mul_ps(va, viFF00);
+ __m128i v = _mm_cvtps_epi32(_mm_mul_ps(vf, vTrcRes));
+ const int ridx = _mm_extract_epi16(v, 0);
+ const int gidx = _mm_extract_epi16(v, 2);
+ const int bidx = _mm_extract_epi16(v, 4);
+ v = _mm_setzero_si128();
+ v = _mm_insert_epi16(v, d_ptr->colorSpaceOut->lut[0]->m_fromLinear[ridx], 0);
+ v = _mm_insert_epi16(v, d_ptr->colorSpaceOut->lut[1]->m_fromLinear[gidx], 2);
+ v = _mm_insert_epi16(v, d_ptr->colorSpaceOut->lut[2]->m_fromLinear[bidx], 4);
+ vf = _mm_mul_ps(_mm_cvtepi32_ps(v), va);
+ _mm_store_ps(&dst[i].r, vf);
+ } else {
+ dst[i].r = d_ptr->colorSpaceOut->trc[0].applyInverseExtended(buffer[i].x);
+ dst[i].g = d_ptr->colorSpaceOut->trc[1].applyInverseExtended(buffer[i].y);
+ dst[i].b = d_ptr->colorSpaceOut->trc[2].applyInverseExtended(buffer[i].z);
+ vf = _mm_mul_ps(_mm_load_ps(&dst[i].r), va);
+ _mm_store_ps(&dst[i].r, vf);
+ }
+ dst[i].a = a;
}
-#endif
}
-static void storeUnpremultiplied(QRgb *dst, const QRgb *src, const QColorVector *buffer, const qsizetype len,
+template<typename T>
+static inline void storePU(T &p, __m128i &v, int a);
+template<>
+inline void storePU<QRgb>(QRgb &p, __m128i &v, int a)
+{
+ v = _mm_add_epi16(v, _mm_set1_epi16(0x80));
+ v = _mm_srli_epi16(v, 8);
+ v = _mm_insert_epi16(v, a, 3);
+ p = _mm_cvtsi128_si32(_mm_packus_epi16(v, v));
+}
+template<>
+inline void storePU<QRgba64>(QRgba64 &p, __m128i &v, int a)
+{
+ v = _mm_add_epi16(v, _mm_srli_epi16(v, 8));
+ v = _mm_insert_epi16(v, a, 3);
+ _mm_storel_epi64((__m128i *)&p, v);
+}
+
+template<typename D, typename S,
+ typename = std::enable_if_t<!std::is_same_v<D, QRgbaFloat32>, void>>
+static void storeUnpremultiplied(D *dst, const S *src, const QColorVector *buffer, const qsizetype len,
const QColorTransformPrivate *d_ptr)
{
-#if defined(__SSE2__)
- const __m128 v4080 = _mm_set1_ps(4080.f);
+ const __m128 vTrcRes = _mm_set1_ps(float(QColorTrcLut::Resolution));
+ constexpr bool isARGB = isArgb<D>();
for (qsizetype i = 0; i < len; ++i) {
- const int a = qAlpha(src[i]);
+ const int a = getAlpha<S>(src[i]);
__m128 vf = _mm_loadu_ps(&buffer[i].x);
- __m128i v = _mm_cvtps_epi32(_mm_mul_ps(vf, v4080));
+ __m128i v = _mm_cvtps_epi32(_mm_mul_ps(vf, vTrcRes));
const int ridx = _mm_extract_epi16(v, 0);
const int gidx = _mm_extract_epi16(v, 2);
const int bidx = _mm_extract_epi16(v, 4);
v = _mm_setzero_si128();
- v = _mm_insert_epi16(v, d_ptr->colorSpaceOut->lut[0]->m_fromLinear[ridx], 2);
+ v = _mm_insert_epi16(v, d_ptr->colorSpaceOut->lut[0]->m_fromLinear[ridx], isARGB ? 2 : 0);
v = _mm_insert_epi16(v, d_ptr->colorSpaceOut->lut[1]->m_fromLinear[gidx], 1);
- v = _mm_insert_epi16(v, d_ptr->colorSpaceOut->lut[2]->m_fromLinear[bidx], 0);
- v = _mm_add_epi16(v, _mm_set1_epi16(0x80));
- v = _mm_srli_epi16(v, 8);
- v = _mm_insert_epi16(v, a, 3);
- v = _mm_packus_epi16(v, v);
- dst[i] = _mm_cvtsi128_si32(v);
+ v = _mm_insert_epi16(v, d_ptr->colorSpaceOut->lut[2]->m_fromLinear[bidx], isARGB ? 0 : 2);
+ storePU<D>(dst[i], v, a);
}
-#else
+}
+
+template<typename S>
+void storeUnpremultiplied(QRgbaFloat32 *dst, const S *src,
+ const QColorVector *buffer, const qsizetype len,
+ const QColorTransformPrivate *d_ptr)
+{
+ const __m128 vTrcRes = _mm_set1_ps(float(QColorTrcLut::Resolution));
+ const __m128 vZero = _mm_set1_ps(0.0f);
+ const __m128 vOne = _mm_set1_ps(1.0f);
+ const __m128 viFF00 = _mm_set1_ps(1.0f / (255 * 256));
for (qsizetype i = 0; i < len; ++i) {
- const int r = d_ptr->colorSpaceOut->lut[0]->u8FromLinearF32(buffer[i].x);
- const int g = d_ptr->colorSpaceOut->lut[1]->u8FromLinearF32(buffer[i].y);
- const int b = d_ptr->colorSpaceOut->lut[2]->u8FromLinearF32(buffer[i].z);
- dst[i] = (src[i] & 0xff000000) | (r << 16) | (g << 8) | (b << 0);
+ const float a = getAlphaF<S>(src[i]);
+ __m128 vf = _mm_loadu_ps(&buffer[i].x);
+ const __m128 under = _mm_cmplt_ps(vf, vZero);
+ const __m128 over = _mm_cmpgt_ps(vf, vOne);
+ if (_mm_movemask_ps(_mm_or_ps(under, over)) == 0) {
+ // Within gamut
+ __m128i v = _mm_cvtps_epi32(_mm_mul_ps(vf, vTrcRes));
+ const int ridx = _mm_extract_epi16(v, 0);
+ const int gidx = _mm_extract_epi16(v, 2);
+ const int bidx = _mm_extract_epi16(v, 4);
+ v = _mm_setzero_si128();
+ v = _mm_insert_epi16(v, d_ptr->colorSpaceOut->lut[0]->m_fromLinear[ridx], 0);
+ v = _mm_insert_epi16(v, d_ptr->colorSpaceOut->lut[1]->m_fromLinear[gidx], 2);
+ v = _mm_insert_epi16(v, d_ptr->colorSpaceOut->lut[2]->m_fromLinear[bidx], 4);
+ vf = _mm_mul_ps(_mm_cvtepi32_ps(v), viFF00);
+ _mm_storeu_ps(&dst[i].r, vf);
+ } else {
+ dst[i].r = d_ptr->colorSpaceOut->trc[0].applyInverseExtended(buffer[i].x);
+ dst[i].g = d_ptr->colorSpaceOut->trc[1].applyInverseExtended(buffer[i].y);
+ dst[i].b = d_ptr->colorSpaceOut->trc[2].applyInverseExtended(buffer[i].z);
+ }
+ dst[i].a = a;
}
-#endif
}
-static void storeOpaque(QRgb *dst, const QRgb *src, const QColorVector *buffer, const qsizetype len,
+template<typename T>
+static void storeOpaque(T *dst, const QColorVector *buffer, const qsizetype len,
const QColorTransformPrivate *d_ptr)
{
- Q_UNUSED(src);
-#if defined(__SSE2__)
- const __m128 v4080 = _mm_set1_ps(4080.f);
+ const __m128 vTrcRes = _mm_set1_ps(float(QColorTrcLut::Resolution));
+ constexpr bool isARGB = isArgb<T>();
for (qsizetype i = 0; i < len; ++i) {
__m128 vf = _mm_loadu_ps(&buffer[i].x);
- __m128i v = _mm_cvtps_epi32(_mm_mul_ps(vf, v4080));
+ __m128i v = _mm_cvtps_epi32(_mm_mul_ps(vf, vTrcRes));
const int ridx = _mm_extract_epi16(v, 0);
const int gidx = _mm_extract_epi16(v, 2);
const int bidx = _mm_extract_epi16(v, 4);
v = _mm_setzero_si128();
- v = _mm_insert_epi16(v, d_ptr->colorSpaceOut->lut[0]->m_fromLinear[ridx], 2);
+ v = _mm_insert_epi16(v, d_ptr->colorSpaceOut->lut[0]->m_fromLinear[ridx], isARGB ? 2 : 0);
v = _mm_insert_epi16(v, d_ptr->colorSpaceOut->lut[1]->m_fromLinear[gidx], 1);
- v = _mm_insert_epi16(v, d_ptr->colorSpaceOut->lut[2]->m_fromLinear[bidx], 0);
- v = _mm_add_epi16(v, _mm_set1_epi16(0x80));
- v = _mm_srli_epi16(v, 8);
- v = _mm_insert_epi16(v, 255, 3);
- v = _mm_packus_epi16(v, v);
- dst[i] = _mm_cvtsi128_si32(v);
+ v = _mm_insert_epi16(v, d_ptr->colorSpaceOut->lut[2]->m_fromLinear[bidx], isARGB ? 0 : 2);
+ storePU<T>(dst[i], v, isARGB ? 255 : 0xffff);
}
+}
+
+template<>
+void storeOpaque(QRgbaFloat32 *dst, const QColorVector *buffer, const qsizetype len,
+ const QColorTransformPrivate *d_ptr)
+{
+ const __m128 vTrcRes = _mm_set1_ps(float(QColorTrcLut::Resolution));
+ const __m128 vZero = _mm_set1_ps(0.0f);
+ const __m128 vOne = _mm_set1_ps(1.0f);
+ const __m128 viFF00 = _mm_set1_ps(1.0f / (255 * 256));
+ for (qsizetype i = 0; i < len; ++i) {
+ __m128 vf = _mm_loadu_ps(&buffer[i].x);
+ const __m128 under = _mm_cmplt_ps(vf, vZero);
+ const __m128 over = _mm_cmpgt_ps(vf, vOne);
+ if (_mm_movemask_ps(_mm_or_ps(under, over)) == 0) {
+ // Within gamut
+ __m128i v = _mm_cvtps_epi32(_mm_mul_ps(vf, vTrcRes));
+ const int ridx = _mm_extract_epi16(v, 0);
+ const int gidx = _mm_extract_epi16(v, 2);
+ const int bidx = _mm_extract_epi16(v, 4);
+ v = _mm_setzero_si128();
+ v = _mm_insert_epi16(v, d_ptr->colorSpaceOut->lut[0]->m_fromLinear[ridx], 0);
+ v = _mm_insert_epi16(v, d_ptr->colorSpaceOut->lut[1]->m_fromLinear[gidx], 2);
+ v = _mm_insert_epi16(v, d_ptr->colorSpaceOut->lut[2]->m_fromLinear[bidx], 4);
+ vf = _mm_mul_ps(_mm_cvtepi32_ps(v), viFF00);
+ _mm_store_ps(&dst[i].r, vf);
+ } else {
+ dst[i].r = d_ptr->colorSpaceOut->trc[0].applyInverseExtended(buffer[i].x);
+ dst[i].g = d_ptr->colorSpaceOut->trc[1].applyInverseExtended(buffer[i].y);
+ dst[i].b = d_ptr->colorSpaceOut->trc[2].applyInverseExtended(buffer[i].z);
+ }
+ dst[i].a = 1.0f;
+ }
+}
+
+#elif defined(__ARM_NEON__)
+template<typename T>
+static inline void storeP(T &p, const uint16x4_t &v);
+template<>
+inline void storeP<QRgb>(QRgb &p, const uint16x4_t &v)
+{
+ p = vget_lane_u32(vreinterpret_u32_u8(vmovn_u16(vcombine_u16(v, v))), 0);
+}
+template<>
+inline void storeP<QRgba64>(QRgba64 &p, const uint16x4_t &v)
+{
+ vst1_u16((uint16_t *)&p, v);
+}
+
+template<typename D, typename S,
+ typename = std::enable_if_t<!std::is_same_v<D, QRgbaFloat32>, void>>
+static void storePremultiplied(D *dst, const S *src, const QColorVector *buffer, const qsizetype len,
+ const QColorTransformPrivate *d_ptr)
+{
+ const float iFF00 = 1.0f / (255 * 256);
+ constexpr bool isARGB = isArgb<D>();
+ for (qsizetype i = 0; i < len; ++i) {
+ const int a = getAlpha<S>(src[i]);
+ float32x4_t vf = vld1q_f32(&buffer[i].x);
+ uint32x4_t v = vcvtq_u32_f32(vaddq_f32(vmulq_n_f32(vf, float(QColorTrcLut::Resolution)), vdupq_n_f32(0.5f)));
+ const int ridx = vgetq_lane_u32(v, 0);
+ const int gidx = vgetq_lane_u32(v, 1);
+ const int bidx = vgetq_lane_u32(v, 2);
+ v = vsetq_lane_u32(d_ptr->colorSpaceOut->lut[0]->m_fromLinear[ridx], v, isARGB ? 2 : 0);
+ v = vsetq_lane_u32(d_ptr->colorSpaceOut->lut[1]->m_fromLinear[gidx], v, 1);
+ v = vsetq_lane_u32(d_ptr->colorSpaceOut->lut[2]->m_fromLinear[bidx], v, isARGB ? 0 : 2);
+ vf = vcvtq_f32_u32(v);
+ vf = vmulq_n_f32(vf, a * iFF00);
+ vf = vaddq_f32(vf, vdupq_n_f32(0.5f));
+ v = vcvtq_u32_f32(vf);
+ uint16x4_t v16 = vmovn_u32(v);
+ v16 = vset_lane_u16(a, v16, 3);
+ storeP<D>(dst[i], v16);
+ }
+}
+
+template<typename T>
+static inline void storePU(T &p, uint16x4_t &v, int a);
+template<>
+inline void storePU<QRgb>(QRgb &p, uint16x4_t &v, int a)
+{
+ v = vadd_u16(v, vdup_n_u16(0x80));
+ v = vshr_n_u16(v, 8);
+ v = vset_lane_u16(a, v, 3);
+ p = vget_lane_u32(vreinterpret_u32_u8(vmovn_u16(vcombine_u16(v, v))), 0);
+}
+template<>
+inline void storePU<QRgba64>(QRgba64 &p, uint16x4_t &v, int a)
+{
+ v = vadd_u16(v, vshr_n_u16(v, 8));
+ v = vset_lane_u16(a, v, 3);
+ vst1_u16((uint16_t *)&p, v);
+}
+
+template<typename D, typename S,
+ typename = std::enable_if_t<!std::is_same_v<D, QRgbaFloat32>, void>>
+static void storeUnpremultiplied(D *dst, const S *src, const QColorVector *buffer, const qsizetype len,
+ const QColorTransformPrivate *d_ptr)
+{
+ constexpr bool isARGB = isArgb<D>();
+ for (qsizetype i = 0; i < len; ++i) {
+ const int a = getAlpha<S>(src[i]);
+ float32x4_t vf = vld1q_f32(&buffer[i].x);
+ uint16x4_t v = vmovn_u32(vcvtq_u32_f32(vaddq_f32(vmulq_n_f32(vf, float(QColorTrcLut::Resolution)), vdupq_n_f32(0.5f))));
+ const int ridx = vget_lane_u16(v, 0);
+ const int gidx = vget_lane_u16(v, 1);
+ const int bidx = vget_lane_u16(v, 2);
+ v = vset_lane_u16(d_ptr->colorSpaceOut->lut[0]->m_fromLinear[ridx], v, isARGB ? 2 : 0);
+ v = vset_lane_u16(d_ptr->colorSpaceOut->lut[1]->m_fromLinear[gidx], v, 1);
+ v = vset_lane_u16(d_ptr->colorSpaceOut->lut[2]->m_fromLinear[bidx], v, isARGB ? 0 : 2);
+ storePU<D>(dst[i], v, a);
+ }
+}
+
+template<typename T>
+static void storeOpaque(T *dst, const QColorVector *buffer, const qsizetype len,
+ const QColorTransformPrivate *d_ptr)
+{
+ constexpr bool isARGB = isArgb<T>();
+ for (qsizetype i = 0; i < len; ++i) {
+ float32x4_t vf = vld1q_f32(&buffer[i].x);
+ uint16x4_t v = vmovn_u32(vcvtq_u32_f32(vaddq_f32(vmulq_n_f32(vf, float(QColorTrcLut::Resolution)), vdupq_n_f32(0.5f))));
+ const int ridx = vget_lane_u16(v, 0);
+ const int gidx = vget_lane_u16(v, 1);
+ const int bidx = vget_lane_u16(v, 2);
+ v = vset_lane_u16(d_ptr->colorSpaceOut->lut[0]->m_fromLinear[ridx], v, isARGB ? 2 : 0);
+ v = vset_lane_u16(d_ptr->colorSpaceOut->lut[1]->m_fromLinear[gidx], v, 1);
+ v = vset_lane_u16(d_ptr->colorSpaceOut->lut[2]->m_fromLinear[bidx], v, isARGB ? 0 : 2);
+ storePU<T>(dst[i], v, isARGB ? 255 : 0xffff);
+ }
+}
#else
+static void storePremultiplied(QRgb *dst, const QRgb *src, const QColorVector *buffer, const qsizetype len,
+ const QColorTransformPrivate *d_ptr)
+{
+ for (qsizetype i = 0; i < len; ++i) {
+ const int a = qAlpha(src[i]);
+ const float fa = a / (255.0f * 256.0f);
+ const float r = d_ptr->colorSpaceOut->lut[0]->m_fromLinear[int(buffer[i].x * float(QColorTrcLut::Resolution) + 0.5f)];
+ const float g = d_ptr->colorSpaceOut->lut[1]->m_fromLinear[int(buffer[i].y * float(QColorTrcLut::Resolution) + 0.5f)];
+ const float b = d_ptr->colorSpaceOut->lut[2]->m_fromLinear[int(buffer[i].z * float(QColorTrcLut::Resolution) + 0.5f)];
+ dst[i] = qRgba(r * fa + 0.5f, g * fa + 0.5f, b * fa + 0.5f, a);
+ }
+}
+
+static void storeUnpremultiplied(QRgb *dst, const QRgb *src, const QColorVector *buffer, const qsizetype len,
+ const QColorTransformPrivate *d_ptr)
+{
+ for (qsizetype i = 0; i < len; ++i) {
+ const int r = d_ptr->colorSpaceOut->lut[0]->u8FromLinearF32(buffer[i].x);
+ const int g = d_ptr->colorSpaceOut->lut[1]->u8FromLinearF32(buffer[i].y);
+ const int b = d_ptr->colorSpaceOut->lut[2]->u8FromLinearF32(buffer[i].z);
+ dst[i] = (src[i] & 0xff000000) | (r << 16) | (g << 8) | (b << 0);
+ }
+}
+
+static void storeOpaque(QRgb *dst, const QColorVector *buffer, const qsizetype len,
+ const QColorTransformPrivate *d_ptr)
+{
for (qsizetype i = 0; i < len; ++i) {
const int r = d_ptr->colorSpaceOut->lut[0]->u8FromLinearF32(buffer[i].x);
const int g = d_ptr->colorSpaceOut->lut[1]->u8FromLinearF32(buffer[i].y);
const int b = d_ptr->colorSpaceOut->lut[2]->u8FromLinearF32(buffer[i].z);
dst[i] = 0xff000000 | (r << 16) | (g << 8) | (b << 0);
}
-#endif
}
-static void storePremultiplied(QRgba64 *dst, const QRgba64 *src, const QColorVector *buffer, const qsizetype len,
+template<typename S>
+static void storePremultiplied(QRgba64 *dst, const S *src, const QColorVector *buffer, const qsizetype len,
const QColorTransformPrivate *d_ptr)
{
for (qsizetype i = 0; i < len; ++i) {
- const int a = src[i].alpha();
+ const int a = getAlphaF(src[i]) * 65535.f;
const float fa = a / (255.0f * 256.0f);
- const float r = d_ptr->colorSpaceOut->lut[0]->m_fromLinear[int(buffer[i].x * 4080.0f + 0.5f)];
- const float g = d_ptr->colorSpaceOut->lut[1]->m_fromLinear[int(buffer[i].y * 4080.0f + 0.5f)];
- const float b = d_ptr->colorSpaceOut->lut[2]->m_fromLinear[int(buffer[i].z * 4080.0f + 0.5f)];
+ const float r = d_ptr->colorSpaceOut->lut[0]->m_fromLinear[int(buffer[i].x * float(QColorTrcLut::Resolution) + 0.5f)];
+ const float g = d_ptr->colorSpaceOut->lut[1]->m_fromLinear[int(buffer[i].y * float(QColorTrcLut::Resolution) + 0.5f)];
+ const float b = d_ptr->colorSpaceOut->lut[2]->m_fromLinear[int(buffer[i].z * float(QColorTrcLut::Resolution) + 0.5f)];
dst[i] = qRgba64(r * fa + 0.5f, g * fa + 0.5f, b * fa + 0.5f, a);
}
}
-static void storeUnpremultiplied(QRgba64 *dst, const QRgba64 *src, const QColorVector *buffer, const qsizetype len,
+template<typename S>
+static void storeUnpremultiplied(QRgba64 *dst, const S *src, const QColorVector *buffer, const qsizetype len,
const QColorTransformPrivate *d_ptr)
{
for (qsizetype i = 0; i < len; ++i) {
+ const int a = getAlphaF(src[i]) * 65535.f;
const int r = d_ptr->colorSpaceOut->lut[0]->u16FromLinearF32(buffer[i].x);
const int g = d_ptr->colorSpaceOut->lut[1]->u16FromLinearF32(buffer[i].y);
const int b = d_ptr->colorSpaceOut->lut[2]->u16FromLinearF32(buffer[i].z);
- dst[i] = qRgba64(r, g, b, src[i].alpha());
+ dst[i] = qRgba64(r, g, b, a);
}
}
-static void storeOpaque(QRgba64 *dst, const QRgba64 *src, const QColorVector *buffer, const qsizetype len,
+static void storeOpaque(QRgba64 *dst, const QColorVector *buffer, const qsizetype len,
const QColorTransformPrivate *d_ptr)
{
- Q_UNUSED(src);
for (qsizetype i = 0; i < len; ++i) {
const int r = d_ptr->colorSpaceOut->lut[0]->u16FromLinearF32(buffer[i].x);
const int g = d_ptr->colorSpaceOut->lut[1]->u16FromLinearF32(buffer[i].y);
@@ -609,6 +1177,75 @@ static void storeOpaque(QRgba64 *dst, const QRgba64 *src, const QColorVector *bu
dst[i] = qRgba64(r, g, b, 0xFFFF);
}
}
+#endif
+#if !defined(__SSE2__)
+template<typename S>
+static void storePremultiplied(QRgbaFloat32 *dst, const S *src, const QColorVector *buffer,
+ const qsizetype len, const QColorTransformPrivate *d_ptr)
+{
+ for (qsizetype i = 0; i < len; ++i) {
+ const float a = getAlphaF(src[i]);
+ dst[i].r = d_ptr->colorSpaceOut->trc[0].applyInverseExtended(buffer[i].x) * a;
+ dst[i].g = d_ptr->colorSpaceOut->trc[1].applyInverseExtended(buffer[i].y) * a;
+ dst[i].b = d_ptr->colorSpaceOut->trc[2].applyInverseExtended(buffer[i].z) * a;
+ dst[i].a = a;
+ }
+}
+
+template<typename S>
+static void storeUnpremultiplied(QRgbaFloat32 *dst, const S *src, const QColorVector *buffer,
+ const qsizetype len, const QColorTransformPrivate *d_ptr)
+{
+ for (qsizetype i = 0; i < len; ++i) {
+ const float a = getAlphaF(src[i]);
+ dst[i].r = d_ptr->colorSpaceOut->trc[0].applyInverseExtended(buffer[i].x);
+ dst[i].g = d_ptr->colorSpaceOut->trc[1].applyInverseExtended(buffer[i].y);
+ dst[i].b = d_ptr->colorSpaceOut->trc[2].applyInverseExtended(buffer[i].z);
+ dst[i].a = a;
+ }
+}
+
+static void storeOpaque(QRgbaFloat32 *dst, const QColorVector *buffer, const qsizetype len,
+ const QColorTransformPrivate *d_ptr)
+{
+ for (qsizetype i = 0; i < len; ++i) {
+ dst[i].r = d_ptr->colorSpaceOut->trc[0].applyInverseExtended(buffer[i].x);
+ dst[i].g = d_ptr->colorSpaceOut->trc[1].applyInverseExtended(buffer[i].y);
+ dst[i].b = d_ptr->colorSpaceOut->trc[2].applyInverseExtended(buffer[i].z);
+ dst[i].a = 1.0f;
+ }
+}
+#endif
+
+static void loadGray(QColorVector *buffer, const quint8 *src, const qsizetype len, const QColorTransformPrivate *d_ptr)
+{
+ for (qsizetype i = 0; i < len; ++i) {
+ const float y = d_ptr->colorSpaceIn->lut[0]->u8ToLinearF32(src[i]);
+ buffer[i] = d_ptr->colorSpaceIn->whitePoint * y;
+ }
+}
+
+static void loadGray(QColorVector *buffer, const quint16 *src, const qsizetype len, const QColorTransformPrivate *d_ptr)
+{
+ for (qsizetype i = 0; i < len; ++i) {
+ const float y = d_ptr->colorSpaceIn->lut[0]->u16ToLinearF32(src[i]);
+ buffer[i] = d_ptr->colorSpaceIn->whitePoint * y;
+ }
+}
+
+static void storeOpaque(quint8 *dst, const QColorVector *buffer, const qsizetype len,
+ const QColorTransformPrivate *d_ptr)
+{
+ for (qsizetype i = 0; i < len; ++i)
+ dst[i] = d_ptr->colorSpaceOut->lut[0]->u8FromLinearF32(buffer[i].y);
+}
+
+static void storeOpaque(quint16 *dst, const QColorVector *buffer, const qsizetype len,
+ const QColorTransformPrivate *d_ptr)
+{
+ for (qsizetype i = 0; i < len; ++i)
+ dst[i] = d_ptr->colorSpaceOut->lut[0]->u16FromLinearF32(buffer[i].y);
+}
static constexpr qsizetype WorkBlockSize = 256;
@@ -621,19 +1258,493 @@ private:
alignas(T) char data[sizeof(T) * Count];
};
+void loadUnpremultipliedLUT(QColorVector *buffer, const QRgb *src, const qsizetype len)
+{
+ const float f = 1.0f / 255.f;
+ for (qsizetype i = 0; i < len; ++i) {
+ const uint p = src[i];
+ buffer[i].x = qRed(p) * f;
+ buffer[i].y = qGreen(p) * f;
+ buffer[i].z = qBlue(p) * f;
+ }
+}
+
+void loadUnpremultipliedLUT(QColorVector *buffer, const QCmyk32 *src, const qsizetype len)
+{
+ const float f = 1.0f / 255.f;
+ for (qsizetype i = 0; i < len; ++i) {
+ const QCmyk32 p = src[i];
+ buffer[i].x = (p.cyan() * f);
+ buffer[i].y = (p.magenta() * f);
+ buffer[i].z = (p.yellow() * f);
+ buffer[i].w = (p.black() * f);
+ }
+}
+
+void loadUnpremultipliedLUT(QColorVector *buffer, const QRgba64 *src, const qsizetype len)
+{
+ const float f = 1.0f / 65535.f;
+ for (qsizetype i = 0; i < len; ++i) {
+ buffer[i].x = src[i].red() * f;
+ buffer[i].y = src[i].green() * f;
+ buffer[i].z = src[i].blue() * f;
+ }
+}
+
+void loadUnpremultipliedLUT(QColorVector *buffer, const QRgbaFloat32 *src, const qsizetype len)
+{
+ for (qsizetype i = 0; i < len; ++i) {
+ buffer[i].x = src[i].r;
+ buffer[i].y = src[i].g;
+ buffer[i].z = src[i].b;
+ }
+}
+
+void loadPremultipliedLUT(QColorVector *buffer, const QRgb *src, const qsizetype len)
+{
+ for (qsizetype i = 0; i < len; ++i) {
+ const uint p = src[i];
+ const float f = 1.0f / qAlpha(p);
+ buffer[i].x = (qRed(p) * f);
+ buffer[i].y = (qGreen(p) * f);
+ buffer[i].z = (qBlue(p) * f);
+ }
+}
+
+void loadPremultipliedLUT(QColorVector *, const QCmyk32 *, const qsizetype)
+{
+ Q_UNREACHABLE();
+}
+
+void loadPremultipliedLUT(QColorVector *buffer, const QRgba64 *src, const qsizetype len)
+{
+ for (qsizetype i = 0; i < len; ++i) {
+ const float f = 1.0f / src[i].alpha();
+ buffer[i].x = (src[i].red() * f);
+ buffer[i].y = (src[i].green() * f);
+ buffer[i].z = (src[i].blue() * f);
+ }
+}
+
+void loadPremultipliedLUT(QColorVector *buffer, const QRgbaFloat32 *src, const qsizetype len)
+{
+ for (qsizetype i = 0; i < len; ++i) {
+ const float f = 1.0f / src[i].a;
+ buffer[i].x = src[i].r * f;
+ buffer[i].y = src[i].g * f;
+ buffer[i].z = src[i].b * f;
+ }
+}
+template<typename T>
+static void storeUnpremultipliedLUT(QRgb *dst, const T *, const QColorVector *buffer, const qsizetype len)
+{
+ for (qsizetype i = 0; i < len; ++i) {
+ const int r = buffer[i].x * 255.f;
+ const int g = buffer[i].y * 255.f;
+ const int b = buffer[i].z * 255.f;
+ dst[i] = 0xff000000 | (r << 16) | (g << 8) | (b << 0);
+ }
+}
+
+template<>
+void storeUnpremultipliedLUT(QRgb *dst, const QRgb *src, const QColorVector *buffer, const qsizetype len)
+{
+ for (qsizetype i = 0; i < len; ++i) {
+ const int r = buffer[i].x * 255.f;
+ const int g = buffer[i].y * 255.f;
+ const int b = buffer[i].z * 255.f;
+ dst[i] = (src[i] & 0xff000000) | (r << 16) | (g << 8) | (b << 0);
+ }
+}
+
+
+template<typename T>
+void storeUnpremultipliedLUT(QCmyk32 *dst, const T *, const QColorVector *buffer, const qsizetype len)
+{
+ for (qsizetype i = 0; i < len; ++i) {
+ const int c = buffer[i].x * 255.f;
+ const int m = buffer[i].y * 255.f;
+ const int y = buffer[i].z * 255.f;
+ const int k = buffer[i].w * 255.f;
+ dst[i] = QCmyk32(c, m, y, k);
+ }
+}
+
+template<typename T>
+static void storeUnpremultipliedLUT(QRgba64 *dst, const T *,
+ const QColorVector *buffer, const qsizetype len)
+{
+ for (qsizetype i = 0; i < len; ++i) {
+ const int r = buffer[i].x * 65535.f;
+ const int g = buffer[i].y * 65535.f;
+ const int b = buffer[i].z * 65535.f;
+ dst[i] = qRgba64(r, g, b, 65535);
+ }
+}
+
+template<>
+void storeUnpremultipliedLUT(QRgba64 *dst, const QRgb *src,
+ const QColorVector *buffer, const qsizetype len)
+{
+ for (qsizetype i = 0; i < len; ++i) {
+ const int a = qAlpha(src[i]) * 257;
+ const int r = buffer[i].x * 65535.f;
+ const int g = buffer[i].y * 65535.f;
+ const int b = buffer[i].z * 65535.f;
+ dst[i] = qRgba64(r, g, b, a);
+ }
+}
+
+template<>
+void storeUnpremultipliedLUT(QRgba64 *dst, const QRgba64 *src,
+ const QColorVector *buffer, const qsizetype len)
+{
+ for (qsizetype i = 0; i < len; ++i) {
+ const int r = buffer[i].x * 65535.f;
+ const int g = buffer[i].y * 65535.f;
+ const int b = buffer[i].z * 65535.f;
+ dst[i] = qRgba64(r, g, b, src[i].alpha());
+ }
+}
+
+template<typename T>
+static void storeUnpremultipliedLUT(QRgbaFloat32 *dst, const T *src,
+ const QColorVector *buffer, const qsizetype len)
+{
+ for (qsizetype i = 0; i < len; ++i) {
+ const float r = buffer[i].x;
+ const float g = buffer[i].y;
+ const float b = buffer[i].z;
+ dst[i] = QRgbaFloat32{r, g, b, getAlphaF(src[i])};
+ }
+}
+
template<typename T>
-void QColorTransformPrivate::apply(T *dst, const T *src, qsizetype count, TransformFlags flags) const
+static void storePremultipliedLUT(QRgb *, const T *, const QColorVector *, const qsizetype);
+
+template<>
+void storePremultipliedLUT(QRgb *dst, const QRgb *src, const QColorVector *buffer, const qsizetype len)
{
+ for (qsizetype i = 0; i < len; ++i) {
+ const int a = qAlpha(src[i]);
+ const int r = buffer[i].x * a;
+ const int g = buffer[i].y * a;
+ const int b = buffer[i].z * a;
+ dst[i] = (src[i] & 0xff000000) | (r << 16) | (g << 8) | (b << 0);
+ }
+}
+
+template<>
+void storePremultipliedLUT(QRgb *dst, const QCmyk32 *, const QColorVector *buffer, const qsizetype len)
+{
+ for (qsizetype i = 0; i < len; ++i) {
+ const int r = buffer[i].x * 255.f;
+ const int g = buffer[i].y * 255.f;
+ const int b = buffer[i].z * 255.f;
+ dst[i] = 0xff000000 | (r << 16) | (g << 8) | (b << 0);
+ }
+}
+
+
+template<typename T>
+static void storePremultipliedLUT(QCmyk32 *dst, const T *src, const QColorVector *buffer, const qsizetype len)
+{
+ storeUnpremultipliedLUT(dst, src, buffer, len);
+}
+
+template<typename T>
+static void storePremultipliedLUT(QRgba64 *, const T *, const QColorVector *, const qsizetype);
+
+template<>
+void storePremultipliedLUT(QRgba64 *dst, const QRgb *src, const QColorVector *buffer, const qsizetype len)
+{
+ for (qsizetype i = 0; i < len; ++i) {
+ const int a = qAlpha(src[i]) * 257;
+ const int r = buffer[i].x * a;
+ const int g = buffer[i].y * a;
+ const int b = buffer[i].z * a;
+ dst[i] = qRgba64(r, g, b, a);
+ }
+}
+
+template<>
+void storePremultipliedLUT(QRgba64 *dst, const QCmyk32 *, const QColorVector *buffer, const qsizetype len)
+{
+ for (qsizetype i = 0; i < len; ++i) {
+ const int r = buffer[i].x * 65535.f;
+ const int g = buffer[i].y * 65535.f;
+ const int b = buffer[i].z * 65535.f;
+ dst[i] = qRgba64(r, g, b, 65535);
+ }
+}
+
+template<>
+void storePremultipliedLUT(QRgba64 *dst, const QRgba64 *src, const QColorVector *buffer, const qsizetype len)
+{
+ for (qsizetype i = 0; i < len; ++i) {
+ const int a = src[i].alpha();
+ const int r = buffer[i].x * a;
+ const int g = buffer[i].y * a;
+ const int b = buffer[i].z * a;
+ dst[i] = qRgba64(r, g, b, a);
+ }
+}
+
+template<typename T>
+static void storePremultipliedLUT(QRgbaFloat32 *dst, const T *src, const QColorVector *buffer, const qsizetype len)
+{
+ for (qsizetype i = 0; i < len; ++i) {
+ const float a = getAlphaF(src[i]);
+ const float r = buffer[i].x * a;
+ const float g = buffer[i].y * a;
+ const float b = buffer[i].z * a;
+ dst[i] = QRgbaFloat32{r, g, b, a};
+ }
+}
+
+static void visitElement(const QColorSpacePrivate::TransferElement &element, QColorVector *buffer, const qsizetype len)
+{
+ const bool doW = element.trc[3].isValid();
+ for (qsizetype i = 0; i < len; ++i) {
+ buffer[i].x = element.trc[0].apply(buffer[i].x);
+ buffer[i].y = element.trc[1].apply(buffer[i].y);
+ buffer[i].z = element.trc[2].apply(buffer[i].z);
+ if (doW)
+ buffer[i].w = element.trc[3].apply(buffer[i].w);
+ }
+}
+
+static void visitElement(const QColorMatrix &element, QColorVector *buffer, const qsizetype len)
+{
+ for (qsizetype i = 0; i < len; ++i)
+ buffer[i] = element.map(buffer[i]);
+}
+
+static void visitElement(const QColorVector &offset, QColorVector *buffer, const qsizetype len)
+{
+ for (qsizetype i = 0; i < len; ++i)
+ buffer[i] += offset;
+}
+
+static void visitElement(const QColorCLUT &element, QColorVector *buffer, const qsizetype len)
+{
+ if (element.isEmpty())
+ return;
+ for (qsizetype i = 0; i < len; ++i)
+ buffer[i] = element.apply(buffer[i]);
+}
+
+/*!
+ \internal
+*/
+QColorVector QColorTransformPrivate::map(QColorVector c) const
+{
+ if (colorSpaceIn->isThreeComponentMatrix()) {
+ if (colorSpaceIn->lut.generated.loadAcquire()) {
+ c.x = colorSpaceIn->lut[0]->toLinear(c.x);
+ c.y = colorSpaceIn->lut[1]->toLinear(c.y);
+ c.z = colorSpaceIn->lut[2]->toLinear(c.z);
+ } else {
+ c.x = colorSpaceIn->trc[0].apply(c.x);
+ c.y = colorSpaceIn->trc[1].apply(c.y);
+ c.z = colorSpaceIn->trc[2].apply(c.z);
+ }
+ c = colorMatrix.map(c);
+ } else {
+ // Do element based conversion
+ for (auto &&element : colorSpaceIn->mAB)
+ std::visit([&c](auto &&elm) { visitElement(elm, &c, 1); }, element);
+ }
+ c.x = std::clamp(c.x, 0.0f, 1.0f);
+ c.y = std::clamp(c.y, 0.0f, 1.0f);
+ c.z = std::clamp(c.z, 0.0f, 1.0f);
+
+ // Match Profile Connection Spaces (PCS):
+ if (colorSpaceOut->isPcsLab && !colorSpaceIn->isPcsLab)
+ c = c.xyzToLab();
+ else if (colorSpaceIn->isPcsLab && !colorSpaceOut->isPcsLab)
+ c = c.labToXyz();
+
+ if (colorSpaceOut->isThreeComponentMatrix()) {
+ if (!colorSpaceIn->isThreeComponentMatrix()) {
+ c = colorMatrix.map(c);
+ c.x = std::clamp(c.x, 0.0f, 1.0f);
+ c.y = std::clamp(c.y, 0.0f, 1.0f);
+ c.z = std::clamp(c.z, 0.0f, 1.0f);
+ }
+ if (colorSpaceOut->lut.generated.loadAcquire()) {
+ c.x = colorSpaceOut->lut[0]->fromLinear(c.x);
+ c.y = colorSpaceOut->lut[1]->fromLinear(c.y);
+ c.z = colorSpaceOut->lut[2]->fromLinear(c.z);
+ } else {
+ c.x = colorSpaceOut->trc[0].applyInverse(c.x);
+ c.y = colorSpaceOut->trc[1].applyInverse(c.y);
+ c.z = colorSpaceOut->trc[2].applyInverse(c.z);
+ }
+ } else {
+ // Do element based conversion
+ for (auto &&element : colorSpaceOut->mBA)
+ std::visit([&c](auto &&elm) { visitElement(elm, &c, 1); }, element);
+ c.x = std::clamp(c.x, 0.0f, 1.0f);
+ c.y = std::clamp(c.y, 0.0f, 1.0f);
+ c.z = std::clamp(c.z, 0.0f, 1.0f);
+ }
+ return c;
+}
+
+/*!
+ \internal
+*/
+QColorVector QColorTransformPrivate::mapExtended(QColorVector c) const
+{
+ if (colorSpaceIn->isThreeComponentMatrix()) {
+ c.x = colorSpaceIn->trc[0].applyExtended(c.x);
+ c.y = colorSpaceIn->trc[1].applyExtended(c.y);
+ c.z = colorSpaceIn->trc[2].applyExtended(c.z);
+ c = colorMatrix.map(c);
+ } else {
+ // Do element based conversion
+ for (auto &&element : colorSpaceIn->mAB)
+ std::visit([&c](auto &&elm) { visitElement(elm, &c, 1); }, element);
+ }
+
+ // Match Profile Connection Spaces (PCS):
+ if (colorSpaceOut->isPcsLab && !colorSpaceIn->isPcsLab)
+ c = c.xyzToLab();
+ else if (colorSpaceIn->isPcsLab && !colorSpaceOut->isPcsLab)
+ c = c.labToXyz();
+
+ if (colorSpaceOut->isThreeComponentMatrix()) {
+ if (!colorSpaceIn->isThreeComponentMatrix())
+ c = colorMatrix.map(c);
+ c.x = colorSpaceOut->trc[0].applyInverseExtended(c.x);
+ c.y = colorSpaceOut->trc[1].applyInverseExtended(c.y);
+ c.z = colorSpaceOut->trc[2].applyInverseExtended(c.z);
+ } else {
+ // Do element based conversion
+ for (auto &&element : colorSpaceOut->mBA)
+ std::visit([&c](auto &&elm) { visitElement(elm, &c, 1); }, element);
+ }
+ return c;
+}
+
+template<typename S>
+void QColorTransformPrivate::applyConvertIn(const S *src, QColorVector *buffer, qsizetype len, TransformFlags flags) const
+{
+ // Avoid compiling this part for S=QCmyk32:
+ if constexpr (!std::is_same_v<S, QCmyk32>) {
+ if (colorSpaceIn->isThreeComponentMatrix()) {
+ if (flags & InputPremultiplied)
+ loadPremultiplied(buffer, src, len, this);
+ else
+ loadUnpremultiplied(buffer, src, len, this);
+
+ if (!colorSpaceOut->isThreeComponentMatrix())
+ applyMatrix<DoClamp>(buffer, len, colorMatrix); // colorMatrix should have the first half only.
+ return;
+ }
+ }
+ Q_ASSERT(!colorSpaceIn->isThreeComponentMatrix());
+
+ if (flags & InputPremultiplied)
+ loadPremultipliedLUT(buffer, src, len);
+ else
+ loadUnpremultipliedLUT(buffer, src, len);
+
+ if constexpr (std::is_same_v<S, QRgbaFloat16> || std::is_same_v<S, QRgbaFloat32>)
+ clampIfNeeded<DoClamp>(buffer, len);
+
+ // Do element based conversion
+ for (auto &&element : colorSpaceIn->mAB)
+ std::visit([&buffer, len](auto &&elm) { visitElement(elm, buffer, len); }, element);
+}
+
+template<typename D, typename S>
+void QColorTransformPrivate::applyConvertOut(D *dst, const S *src, QColorVector *buffer, qsizetype len, TransformFlags flags) const
+{
+ constexpr ApplyMatrixForm doClamp = (std::is_same_v<D, QRgbaFloat16> || std::is_same_v<D, QRgbaFloat32>) ? DoNotClamp : DoClamp;
+ // Avoid compiling this part for D=QCmyk32:
+ if constexpr (!std::is_same_v<D, QCmyk32>) {
+ if (colorSpaceOut->isThreeComponentMatrix()) {
+ applyMatrix<doClamp>(buffer, len, colorMatrix); // colorMatrix should have the latter half only.
+
+ if constexpr (std::is_same_v<S, QCmyk32>) {
+ storeOpaque(dst, buffer, len, this);
+ } else {
+ if (flags & InputOpaque)
+ storeOpaque(dst, buffer, len, this);
+ else if (flags & OutputPremultiplied)
+ storePremultiplied(dst, src, buffer, len, this);
+ else
+ storeUnpremultiplied(dst, src, buffer, len, this);
+ }
+ return;
+ }
+ }
+ Q_ASSERT(!colorSpaceOut->isThreeComponentMatrix());
+
+ // Do element based conversion
+ for (auto &&element : colorSpaceOut->mBA)
+ std::visit([&buffer, len](auto &&elm) { visitElement(elm, buffer, len); }, element);
+
+ clampIfNeeded<doClamp>(buffer, len);
+
+ if (flags & OutputPremultiplied)
+ storePremultipliedLUT(dst, src, buffer, len);
+ else
+ storeUnpremultipliedLUT(dst, src, buffer, len);
+}
+
+template<typename D, typename S>
+void QColorTransformPrivate::applyElementListTransform(D *dst, const S *src, qsizetype count, TransformFlags flags) const
+{
+ Q_ASSERT(!colorSpaceIn->isThreeComponentMatrix() || !colorSpaceOut->isThreeComponentMatrix());
+
+ if (!colorMatrix.isValid())
+ return;
+
+ if (colorSpaceIn->isThreeComponentMatrix())
+ updateLutsIn();
+ if (colorSpaceOut->isThreeComponentMatrix())
+ updateLutsOut();
+
+ QUninitialized<QColorVector, WorkBlockSize> buffer;
+ qsizetype i = 0;
+ while (i < count) {
+ const qsizetype len = qMin(count - i, WorkBlockSize);
+
+ applyConvertIn(src + i, buffer, len, flags);
+
+ // Match Profile Connection Spaces (PCS):
+ if (colorSpaceOut->isPcsLab && !colorSpaceIn->isPcsLab) {
+ for (qsizetype j = 0; j < len; ++j)
+ buffer[j] = buffer[j].xyzToLab();
+ } else if (colorSpaceIn->isPcsLab && !colorSpaceOut->isPcsLab) {
+ for (qsizetype j = 0; j < len; ++j)
+ buffer[j] = buffer[j].labToXyz();
+ }
+
+ applyConvertOut(dst + i, src + i, buffer, len, flags);
+
+ i += len;
+ }
+}
+
+template<typename D, typename S>
+void QColorTransformPrivate::applyThreeComponentMatrix(D *dst, const S *src, qsizetype count, TransformFlags flags) const
+{
+ Q_ASSERT(colorSpaceIn->isThreeComponentMatrix() && colorSpaceOut->isThreeComponentMatrix());
+
if (!colorMatrix.isValid())
return;
updateLutsIn();
updateLutsOut();
- bool doApplyMatrix = (colorMatrix != QColorMatrix::identity());
+ bool doApplyMatrix = !colorMatrix.isIdentity();
+ constexpr ApplyMatrixForm doClamp = (std::is_same_v<D, QRgbaFloat16> || std::is_same_v<D, QRgbaFloat32>) ? DoNotClamp : DoClamp;
QUninitialized<QColorVector, WorkBlockSize> buffer;
-
qsizetype i = 0;
while (i < count) {
const qsizetype len = qMin(count - i, WorkBlockSize);
@@ -643,10 +1754,12 @@ void QColorTransformPrivate::apply(T *dst, const T *src, qsizetype count, Transf
loadUnpremultiplied(buffer, src + i, len, this);
if (doApplyMatrix)
- applyMatrix(buffer, len, colorMatrix);
+ applyMatrix<doClamp>(buffer, len, colorMatrix);
+ else
+ clampIfNeeded<doClamp>(buffer, len);
if (flags & InputOpaque)
- storeOpaque(dst + i, src + i, buffer, len, this);
+ storeOpaque(dst + i, buffer, len, this);
else if (flags & OutputPremultiplied)
storePremultiplied(dst + i, src + i, buffer, len, this);
else
@@ -658,9 +1771,155 @@ void QColorTransformPrivate::apply(T *dst, const T *src, qsizetype count, Transf
/*!
\internal
+ Applies the color transformation on \a count S pixels starting from
+ \a src and stores the result in \a dst as D pixels .
+
+ Assumes unpremultiplied data by default. Set \a flags to change defaults.
+
+ \sa prepare()
+*/
+template<typename D, typename S>
+void QColorTransformPrivate::apply(D *dst, const S *src, qsizetype count, TransformFlags flags) const
+{
+ if constexpr (!std::is_same_v<D, QCmyk32> && !std::is_same_v<S, QCmyk32>) {
+ if (isThreeComponentMatrix())
+ return applyThreeComponentMatrix<D, S>(dst, src, count, flags);
+ }
+ applyElementListTransform<D, S>(dst, src, count, flags);
+}
+
+/*!
+ \internal
+ Is to be called on a color-transform to XYZ, returns only luminance values.
+
+ */
+template<typename D, typename S>
+void QColorTransformPrivate::applyReturnGray(D *dst, const S *src, qsizetype count, TransformFlags flags) const
+{
+ Q_ASSERT(colorSpaceOut->isThreeComponentMatrix());
+ updateLutsOut();
+ if (!colorSpaceIn->isThreeComponentMatrix()) {
+ QUninitialized<QColorVector, WorkBlockSize> buffer;
+
+ qsizetype i = 0;
+ while (i < count) {
+ const qsizetype len = qMin(count - i, WorkBlockSize);
+
+ applyConvertIn(src, buffer, len, flags);
+
+ // Match Profile Connection Spaces (PCS):
+ if (colorSpaceOut->isPcsLab && !colorSpaceIn->isPcsLab) {
+ for (qsizetype j = 0; j < len; ++j)
+ buffer[j] = buffer[j].xyzToLab();
+ } else if (colorSpaceIn->isPcsLab && !colorSpaceOut->isPcsLab) {
+ for (qsizetype j = 0; j < len; ++j)
+ buffer[j] = buffer[j].labToXyz();
+ }
+
+ applyMatrix<DoClamp>(buffer, len, colorMatrix);
+ storeOpaque(dst + i, buffer, len, this);
+
+ i += len;
+ }
+ return;
+ }
+ if constexpr (!std::is_same_v<S, QCmyk32>) {
+ if (!colorMatrix.isValid())
+ return;
+
+ updateLutsIn();
+
+ QUninitialized<QColorVector, WorkBlockSize> buffer;
+
+ qsizetype i = 0;
+ while (i < count) {
+ const qsizetype len = qMin(count - i, WorkBlockSize);
+ if (flags & InputPremultiplied)
+ loadPremultiplied(buffer, src + i, len, this);
+ else
+ loadUnpremultiplied(buffer, src + i, len, this);
+
+ applyMatrix<DoClamp>(buffer, len, colorMatrix);
+
+ storeOpaque(dst + i, buffer, len, this);
+
+ i += len;
+ }
+ } else {
+ Q_UNREACHABLE();
+ }
+}
+
+/*!
+ \internal
+*/
+template<typename D, typename S>
+void QColorTransformPrivate::applyGray(D *dst, const S *src, qsizetype count, TransformFlags) const
+{
+ Q_ASSERT(colorSpaceIn->isThreeComponentMatrix());
+ updateLutsIn();
+ if constexpr (std::is_same_v<D, QRgb> || std::is_same_v<D, QRgba64> || std::is_same_v<D, QRgbaFloat32> || std::is_same_v<D, QCmyk32>) {
+ if (!colorSpaceOut->isThreeComponentMatrix()) {
+ QUninitialized<QColorVector, WorkBlockSize> buffer;
+
+ qsizetype i = 0;
+ while (i < count) {
+ const qsizetype len = qMin(count - i, WorkBlockSize);
+ loadGray(buffer, src + i, len, this);
+
+ applyMatrix<DoClamp>(buffer, len, colorMatrix);
+
+ // Match Profile Connection Spaces (PCS):
+ if (colorSpaceOut->isPcsLab && !colorSpaceIn->isPcsLab) {
+ for (qsizetype j = 0; j < len; ++j)
+ buffer[j] = buffer[j].xyzToLab();
+ } else if (colorSpaceIn->isPcsLab && !colorSpaceOut->isPcsLab) {
+ for (qsizetype j = 0; j < len; ++j)
+ buffer[j] = buffer[j].labToXyz();
+ }
+
+ // Do element based conversion
+ for (auto &&element : colorSpaceOut->mBA)
+ std::visit([&buffer, len](auto &&elm) { visitElement(elm, buffer, len); }, element);
+
+ clampIfNeeded<DoClamp>(buffer, len);
+
+ storeUnpremultipliedLUT(dst, src, buffer, len); // input is always opaque
+
+ i += len;
+ }
+ return;
+ }
+ }
+ Q_ASSERT(colorSpaceOut->isThreeComponentMatrix());
+ if constexpr (!std::is_same_v<D, QCmyk32>) {
+ if (!colorMatrix.isValid())
+ return;
+
+ updateLutsOut();
+
+ QUninitialized<QColorVector, WorkBlockSize> buffer;
+
+ qsizetype i = 0;
+ while (i < count) {
+ const qsizetype len = qMin(count - i, WorkBlockSize);
+ loadGray(buffer, src + i, len, this);
+
+ applyMatrix<DoClamp>(buffer, len, colorMatrix);
+
+ storeOpaque(dst + i, buffer, len, this);
+ i += len;
+ }
+ } else {
+ Q_UNREACHABLE();
+ }
+}
+
+/*!
+ \internal
\enum QColorTransformPrivate::TransformFlag
- Defines how the transform is to be applied.
+ Defines how the transform should handle alpha values.
\value Unpremultiplied The input and output should both be unpremultiplied.
\value InputOpaque The input is guaranteed to be opaque.
@@ -684,37 +1943,72 @@ void QColorTransformPrivate::prepare()
updateLutsOut();
}
-/*!
- \internal
- Applies the color transformation on \a count QRgb pixels starting from
- \a src and stores the result in \a dst.
-
- Thread-safe if prepare() has been called first.
-
- Assumes unpremultiplied data by default. Set \a flags to change defaults.
-
- \sa prepare()
-*/
-void QColorTransformPrivate::apply(QRgb *dst, const QRgb *src, qsizetype count, TransformFlags flags) const
+// Only allow versions increasing precision
+template void QColorTransformPrivate::applyReturnGray<quint8, QRgb>(quint8 *dst, const QRgb *src, qsizetype count, TransformFlags flags) const;
+template void QColorTransformPrivate::applyReturnGray<quint8, QCmyk32>(quint8 *dst, const QCmyk32 *src, qsizetype count, TransformFlags flags) const;
+template void QColorTransformPrivate::applyReturnGray<quint16, QCmyk32>(quint16 *dst, const QCmyk32 *src, qsizetype count, TransformFlags flags) const;
+template void QColorTransformPrivate::applyReturnGray<quint16, QRgba64>(quint16 *dst, const QRgba64 *src, qsizetype count, TransformFlags flags) const;
+template void QColorTransformPrivate::applyGray<quint8, quint8>(quint8 *dst, const quint8 *src, qsizetype count, TransformFlags flags) const;
+template void QColorTransformPrivate::applyGray<quint16, quint8>(quint16 *dst, const quint8 *src, qsizetype count, TransformFlags flags) const;
+template void QColorTransformPrivate::applyGray<quint16, quint16>(quint16 *dst, const quint16 *src, qsizetype count, TransformFlags flags) const;
+template void QColorTransformPrivate::applyGray<QRgb, quint8>(QRgb *dst, const quint8 *src, qsizetype count, TransformFlags flags) const;
+template void QColorTransformPrivate::applyGray<QCmyk32, quint8>(QCmyk32 *dst, const quint8 *src, qsizetype count, TransformFlags flags) const;
+template void QColorTransformPrivate::applyGray<QCmyk32, quint16>(QCmyk32 *dst, const quint16 *src, qsizetype count, TransformFlags flags) const;
+template void QColorTransformPrivate::applyGray<QRgba64, quint16>(QRgba64 *dst, const quint16 *src, qsizetype count, TransformFlags flags) const;
+
+template void QColorTransformPrivate::apply<QRgb, QRgb>(QRgb *dst, const QRgb *src, qsizetype count, TransformFlags flags) const;
+template void QColorTransformPrivate::apply<QRgb, QCmyk32>(QRgb *dst, const QCmyk32 *src, qsizetype count, TransformFlags flags) const;
+template void QColorTransformPrivate::apply<QCmyk32, QRgb>(QCmyk32 *dst, const QRgb *src, qsizetype count, TransformFlags flags) const;
+template void QColorTransformPrivate::apply<QCmyk32, QCmyk32>(QCmyk32 *dst, const QCmyk32 *src, qsizetype count, TransformFlags flags) const;
+template void QColorTransformPrivate::apply<QCmyk32, QRgba64>(QCmyk32 *dst, const QRgba64 *src, qsizetype count, TransformFlags flags) const;
+template void QColorTransformPrivate::apply<QCmyk32, QRgbaFloat32>(QCmyk32 *dst, const QRgbaFloat32 *src, qsizetype count, TransformFlags flags) const;
+template void QColorTransformPrivate::apply<QRgba64, QRgb>(QRgba64 *dst, const QRgb *src, qsizetype count, TransformFlags flags) const;
+template void QColorTransformPrivate::apply<QRgba64, QCmyk32>(QRgba64 *dst, const QCmyk32 *src, qsizetype count, TransformFlags flags) const;
+template void QColorTransformPrivate::apply<QRgba64, QRgba64>(QRgba64 *dst, const QRgba64 *src, qsizetype count, TransformFlags flags) const;
+template void QColorTransformPrivate::apply<QRgbaFloat32, QRgb>(QRgbaFloat32 *dst, const QRgb *src, qsizetype count, TransformFlags flags) const;
+template void QColorTransformPrivate::apply<QRgbaFloat32, QCmyk32>(QRgbaFloat32 *dst, const QCmyk32 *src, qsizetype count, TransformFlags flags) const;
+template void QColorTransformPrivate::apply<QRgbaFloat32, QRgba64>(QRgbaFloat32 *dst, const QRgba64 *src, qsizetype count, TransformFlags flags) const;
+template void QColorTransformPrivate::apply<QRgbaFloat32, QRgbaFloat32>(QRgbaFloat32 *dst, const QRgbaFloat32 *src, qsizetype count, TransformFlags flags) const;
+
+bool QColorTransformPrivate::isThreeComponentMatrix() const
{
- apply<QRgb>(dst, src, count, flags);
+ if (colorSpaceIn && !colorSpaceIn->isThreeComponentMatrix())
+ return false;
+ if (colorSpaceOut && !colorSpaceOut->isThreeComponentMatrix())
+ return false;
+ return true;
}
/*!
\internal
- Applies the color transformation on \a count QRgba64 pixels starting from
- \a src and stores the result in \a dst.
-
- Thread-safe if prepare() has been called first.
-
- Assumes unpremultiplied data by default. Set \a flags to change defaults.
-
- \sa prepare()
*/
-void QColorTransformPrivate::apply(QRgba64 *dst, const QRgba64 *src, qsizetype count, TransformFlags flags) const
+bool QColorTransformPrivate::isIdentity() const
{
- apply<QRgba64>(dst, src, count, flags);
+ if (colorSpaceIn == colorSpaceOut)
+ return true;
+ if (!colorMatrix.isIdentity())
+ return false;
+ if (colorSpaceIn && colorSpaceOut) {
+ if (colorSpaceIn->equals(colorSpaceOut.constData()))
+ return true;
+ if (!isThreeComponentMatrix())
+ return false;
+ if (colorSpaceIn->transferFunction != colorSpaceOut->transferFunction)
+ return false;
+ if (colorSpaceIn->transferFunction == QColorSpace::TransferFunction::Custom) {
+ return colorSpaceIn->trc[0] == colorSpaceOut->trc[0]
+ && colorSpaceIn->trc[1] == colorSpaceOut->trc[1]
+ && colorSpaceIn->trc[2] == colorSpaceOut->trc[2];
+ }
+ } else {
+ if (!isThreeComponentMatrix())
+ return false;
+ if (colorSpaceIn && colorSpaceIn->transferFunction != QColorSpace::TransferFunction::Linear)
+ return false;
+ if (colorSpaceOut && colorSpaceOut->transferFunction != QColorSpace::TransferFunction::Linear)
+ return false;
+ }
+ return true;
}
-
QT_END_NAMESPACE
diff --git a/src/gui/painting/qcolortransform.h b/src/gui/painting/qcolortransform.h
index 94b6b3a385..02f15ee89f 100644
--- a/src/gui/painting/qcolortransform.h
+++ b/src/gui/painting/qcolortransform.h
@@ -1,47 +1,12 @@
-/****************************************************************************
-**
-** Copyright (C) 2018 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the QtGui module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2018 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#ifndef QCOLORTRANSFORM_H
#define QCOLORTRANSFORM_H
#include <QtGui/qtguiglobal.h>
#include <QtGui/qrgb.h>
+#include <QtCore/qshareddata.h>
QT_BEGIN_NAMESPACE
@@ -49,39 +14,48 @@ class QColor;
class QRgba64;
class QColorSpacePrivate;
class QColorTransformPrivate;
+class qfloat16;
+template<typename T>
+class QRgbaFloat;
+typedef QRgbaFloat<qfloat16> QRgbaFloat16;
+typedef QRgbaFloat<float> QRgbaFloat32;
+
+QT_DECLARE_QESDP_SPECIALIZATION_DTOR_WITH_EXPORT(QColorTransformPrivate, Q_GUI_EXPORT)
class QColorTransform
{
public:
- QColorTransform() noexcept : d(nullptr) { }
+ QColorTransform() noexcept = default;
Q_GUI_EXPORT ~QColorTransform();
Q_GUI_EXPORT QColorTransform(const QColorTransform &colorTransform) noexcept;
- QColorTransform(QColorTransform &&colorTransform) noexcept
- : d{qExchange(colorTransform.d, nullptr)}
- { }
+ QColorTransform(QColorTransform &&colorTransform) = default;
QColorTransform &operator=(const QColorTransform &other) noexcept
{
QColorTransform{other}.swap(*this);
return *this;
}
- QColorTransform &operator=(QColorTransform &&other) noexcept
- {
- QColorTransform{std::move(other)}.swap(*this);
- return *this;
- }
+ QT_MOVE_ASSIGNMENT_OPERATOR_IMPL_VIA_MOVE_AND_SWAP(QColorTransform)
- void swap(QColorTransform &other) noexcept { qSwap(d, other.d); }
+ void swap(QColorTransform &other) noexcept { d.swap(other.d); }
+ Q_GUI_EXPORT bool isIdentity() const noexcept;
Q_GUI_EXPORT QRgb map(QRgb argb) const;
Q_GUI_EXPORT QRgba64 map(QRgba64 rgba64) const;
+ Q_GUI_EXPORT QRgbaFloat16 map(QRgbaFloat16 rgbafp16) const;
+ Q_GUI_EXPORT QRgbaFloat32 map(QRgbaFloat32 rgbafp32) const;
Q_GUI_EXPORT QColor map(const QColor &color) const;
+ friend bool operator==(const QColorTransform &ct1, const QColorTransform &ct2)
+ { return ct1.compare(ct2); }
+ friend bool operator!=(const QColorTransform &ct1, const QColorTransform &ct2)
+ { return !ct1.compare(ct2); }
+
private:
- friend class QColorSpace;
friend class QColorSpacePrivate;
- friend class QImage;
+ friend class QColorTransformPrivate;
+ Q_GUI_EXPORT bool compare(const QColorTransform &other) const;
- const QColorTransformPrivate *d;
+ QExplicitlySharedDataPointer<QColorTransformPrivate> d;
};
Q_DECLARE_SHARED(QColorTransform)
diff --git a/src/gui/painting/qcolortransform_p.h b/src/gui/painting/qcolortransform_p.h
index 5d7116248d..59ea6a2405 100644
--- a/src/gui/painting/qcolortransform_p.h
+++ b/src/gui/painting/qcolortransform_p.h
@@ -1,41 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2019 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the QtGui module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2019 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#ifndef QCOLORTRANSFORM_P_H
#define QCOLORTRANSFORM_P_H
@@ -55,8 +19,10 @@
#include "qcolorspace_p.h"
#include <QtCore/qshareddata.h>
+#include <QtGui/qrgbafloat.h>
QT_BEGIN_NAMESPACE
+class QCmyk32;
class QColorTransformPrivate : public QSharedData
{
@@ -65,11 +31,15 @@ public:
QExplicitlySharedDataPointer<const QColorSpacePrivate> colorSpaceIn;
QExplicitlySharedDataPointer<const QColorSpacePrivate> colorSpaceOut;
+ static QColorTransformPrivate *get(const QColorTransform &q)
+ { return q.d.data(); }
+
void updateLutsIn() const;
void updateLutsOut() const;
- bool simpleGammaCorrection() const;
+ bool isIdentity() const;
+ bool isThreeComponentMatrix() const;
- void prepare();
+ Q_GUI_EXPORT void prepare();
enum TransformFlag {
Unpremultiplied = 0,
InputOpaque = 1,
@@ -79,11 +49,25 @@ public:
};
Q_DECLARE_FLAGS(TransformFlags, TransformFlag)
- void apply(QRgb *dst, const QRgb *src, qsizetype count, TransformFlags flags = Unpremultiplied) const;
- void apply(QRgba64 *dst, const QRgba64 *src, qsizetype count, TransformFlags flags = Unpremultiplied) const;
+ QColorVector map(QColorVector color) const;
+ QColorVector mapExtended(QColorVector color) const;
+
+ template<typename D, typename S>
+ void apply(D *dst, const S *src, qsizetype count, TransformFlags flags) const;
+ template<typename D, typename S>
+ void applyGray(D *dst, const S *src, qsizetype count, TransformFlags flags) const;
+ template<typename D, typename S>
+ void applyReturnGray(D *dst, const S *src, qsizetype count, TransformFlags flags) const;
- template<typename T>
- void apply(T *dst, const T *src, qsizetype count, TransformFlags flags) const;
+private:
+ template<typename S>
+ void applyConvertIn(const S *src, QColorVector *buffer, qsizetype len, TransformFlags flags) const;
+ template<typename D, typename S>
+ void applyConvertOut(D *dst, const S *src, QColorVector *buffer, qsizetype len, TransformFlags flags) const;
+ template<typename D, typename S>
+ void applyElementListTransform(D *dst, const S *src, qsizetype count, TransformFlags flags) const;
+ template<typename D, typename S>
+ void applyThreeComponentMatrix(D *dst, const S *src, qsizetype count, TransformFlags flags) const;
};
QT_END_NAMESPACE
diff --git a/src/gui/painting/qcolortrc_p.h b/src/gui/painting/qcolortrc_p.h
index 3ef9d442fc..d1ad1987df 100644
--- a/src/gui/painting/qcolortrc_p.h
+++ b/src/gui/painting/qcolortrc_p.h
@@ -1,41 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2018 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the QtGui module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2018 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#ifndef QCOLORTRC_P_H
#define QCOLORTRC_P_H
@@ -57,17 +21,15 @@
QT_BEGIN_NAMESPACE
-
-// Defines an ICC TRC (Tone Reproduction Curve)
+// Defines a TRC (Tone Reproduction Curve)
class Q_GUI_EXPORT QColorTrc
{
public:
- QColorTrc() noexcept : m_type(Type::Uninitialized)
- { }
- QColorTrc(const QColorTransferFunction &fun) : m_type(Type::Function), m_fun(fun)
- { }
- QColorTrc(const QColorTransferTable &table) : m_type(Type::Table), m_table(table)
- { }
+ QColorTrc() noexcept : m_type(Type::Uninitialized) { }
+ QColorTrc(const QColorTransferFunction &fun) : m_type(Type::Function), m_fun(fun) { }
+ QColorTrc(const QColorTransferTable &table) : m_type(Type::Table), m_table(table) { }
+ QColorTrc(QColorTransferFunction &&fun) noexcept : m_type(Type::Function), m_fun(std::move(fun)) { }
+ QColorTrc(QColorTransferTable &&table) noexcept : m_type(Type::Table), m_table(std::move(table)) { }
enum class Type {
Uninitialized,
@@ -75,9 +37,10 @@ public:
Table
};
- bool isLinear() const
+ bool isIdentity() const
{
- return m_type == Type::Uninitialized || (m_type == Type::Function && m_fun.isLinear());
+ return (m_type == Type::Function && m_fun.isIdentity())
+ || (m_type == Type::Table && m_table.isIdentity());
}
bool isValid() const
{
@@ -114,7 +77,7 @@ public:
if (x >= 0.0f && x <= 1.0f)
return applyInverse(x);
if (m_type == Type::Function)
- return std::copysign(applyInverse(x), x);
+ return std::copysign(applyInverse(std::abs(x)), x);
if (m_type == Type::Table)
return x < 0.0f ? 0.0f : 1.0f;
return x;
diff --git a/src/gui/painting/qcolortrclut.cpp b/src/gui/painting/qcolortrclut.cpp
index 268d7252b4..8a7673bc00 100644
--- a/src/gui/painting/qcolortrclut.cpp
+++ b/src/gui/painting/qcolortrclut.cpp
@@ -1,41 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the QtGui module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#include "qcolortrclut_p.h"
#include "qcolortransferfunction_p.h"
@@ -43,44 +7,86 @@
#include <qmath.h>
QT_BEGIN_NAMESPACE
-
-QColorTrcLut *QColorTrcLut::fromGamma(qreal gamma)
+std::shared_ptr<QColorTrcLut> QColorTrcLut::create()
{
- QColorTrcLut *cp = new QColorTrcLut;
+ struct Access : QColorTrcLut {};
+ return std::make_shared<Access>();
+}
- for (int i = 0; i <= (255 * 16); ++i) {
- cp->m_toLinear[i] = ushort(qRound(qPow(i / qreal(255 * 16), gamma) * (255 * 256)));
- cp->m_fromLinear[i] = ushort(qRound(qPow(i / qreal(255 * 16), qreal(1) / gamma) * (255 * 256)));
- }
+std::shared_ptr<QColorTrcLut> QColorTrcLut::fromGamma(qreal gamma, Direction dir)
+{
+ auto cp = create();
+ cp->setFromGamma(gamma, dir);
+ return cp;
+}
+std::shared_ptr<QColorTrcLut> QColorTrcLut::fromTransferFunction(const QColorTransferFunction &fun, Direction dir)
+{
+ auto cp = create();
+ cp->setFromTransferFunction(fun, dir);
return cp;
}
-QColorTrcLut *QColorTrcLut::fromTransferFunction(const QColorTransferFunction &fun)
+std::shared_ptr<QColorTrcLut> QColorTrcLut::fromTransferTable(const QColorTransferTable &table, Direction dir)
{
- QColorTrcLut *cp = new QColorTrcLut;
- QColorTransferFunction inv = fun.inverted();
+ auto cp = create();
+ cp->setFromTransferTable(table, dir);
+ return cp;
+}
- for (int i = 0; i <= (255 * 16); ++i) {
- cp->m_toLinear[i] = ushort(qRound(fun.apply(i / qreal(255 * 16)) * (255 * 256)));
- cp->m_fromLinear[i] = ushort(qRound(inv.apply(i / qreal(255 * 16)) * (255 * 256)));
+void QColorTrcLut::setFromGamma(qreal gamma, Direction dir)
+{
+ if (dir & ToLinear) {
+ if (!m_toLinear)
+ m_toLinear.reset(new ushort[Resolution + 1]);
+ for (int i = 0; i <= Resolution; ++i)
+ m_toLinear[i] = ushort(qRound(qPow(i / qreal(Resolution), gamma) * (255 * 256)));
}
- return cp;
+ if (dir & FromLinear) {
+ if (!m_fromLinear)
+ m_fromLinear.reset(new ushort[Resolution + 1]);
+ for (int i = 0; i <= Resolution; ++i)
+ m_fromLinear[i] = ushort(qRound(qPow(i / qreal(Resolution), qreal(1) / gamma) * (255 * 256)));
+ }
}
-QColorTrcLut *QColorTrcLut::fromTransferTable(const QColorTransferTable &table)
+void QColorTrcLut::setFromTransferFunction(const QColorTransferFunction &fun, Direction dir)
{
- QColorTrcLut *cp = new QColorTrcLut;
+ if (dir & ToLinear) {
+ if (!m_toLinear)
+ m_toLinear.reset(new ushort[Resolution + 1]);
+ for (int i = 0; i <= Resolution; ++i)
+ m_toLinear[i] = ushort(qRound(fun.apply(i / qreal(Resolution)) * (255 * 256)));
+ }
- float minInverse = 0.0f;
- for (int i = 0; i <= (255 * 16); ++i) {
- cp->m_toLinear[i] = ushort(qBound(0, qRound(table.apply(i / qreal(255 * 16)) * (255 * 256)), 65280));
- minInverse = table.applyInverse(i / qreal(255 * 16), minInverse);
- cp->m_fromLinear[i] = ushort(qBound(0, qRound(minInverse * (255 * 256)), 65280));
+ if (dir & FromLinear) {
+ if (!m_fromLinear)
+ m_fromLinear.reset(new ushort[Resolution + 1]);
+ QColorTransferFunction inv = fun.inverted();
+ for (int i = 0; i <= Resolution; ++i)
+ m_fromLinear[i] = ushort(qRound(inv.apply(i / qreal(Resolution)) * (255 * 256)));
}
+}
- return cp;
+void QColorTrcLut::setFromTransferTable(const QColorTransferTable &table, Direction dir)
+{
+ if (dir & ToLinear) {
+ if (!m_toLinear)
+ m_toLinear.reset(new ushort[Resolution + 1]);
+ for (int i = 0; i <= Resolution; ++i)
+ m_toLinear[i] = ushort(qBound(0, qRound(table.apply(i / qreal(Resolution)) * (255 * 256)), 65280));
+ }
+
+ if (dir & FromLinear) {
+ if (!m_fromLinear)
+ m_fromLinear.reset(new ushort[Resolution + 1]);
+ float minInverse = 0.0f;
+ for (int i = 0; i <= Resolution; ++i) {
+ minInverse = table.applyInverse(i / qreal(Resolution), minInverse);
+ m_fromLinear[i] = ushort(qBound(0, qRound(minInverse * (255 * 256)), 65280));
+ }
+ }
}
QT_END_NAMESPACE
diff --git a/src/gui/painting/qcolortrclut_p.h b/src/gui/painting/qcolortrclut_p.h
index 76a6a60803..3ebab42809 100644
--- a/src/gui/painting/qcolortrclut_p.h
+++ b/src/gui/painting/qcolortrclut_p.h
@@ -1,41 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the QtGui module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#ifndef QCOLORTRCLUT_P_H
#define QCOLORTRCLUT_P_H
@@ -52,11 +16,11 @@
//
#include <QtGui/private/qtguiglobal_p.h>
-#include <QtCore/qsharedpointer.h>
#include <QtGui/qrgb.h>
#include <QtGui/qrgba64.h>
#include <cmath>
+#include <memory>
#if defined(__SSE2__)
#include <emmintrin.h>
@@ -69,12 +33,25 @@ QT_BEGIN_NAMESPACE
class QColorTransferFunction;
class QColorTransferTable;
-class Q_GUI_EXPORT QColorTrcLut : public QEnableSharedFromThis<QColorTrcLut>
+class Q_GUI_EXPORT QColorTrcLut
{
public:
- static QColorTrcLut *fromGamma(qreal gamma);
- static QColorTrcLut *fromTransferFunction(const QColorTransferFunction &transfn);
- static QColorTrcLut *fromTransferTable(const QColorTransferTable &transTable);
+ static constexpr uint32_t ShiftUp = 4; // Amount to shift up from 1->255
+ static constexpr uint32_t ShiftDown = (8 - ShiftUp); // Amount to shift down from 1->65280
+ static constexpr qsizetype Resolution = (1 << ShiftUp) * 255; // Number of entries in table
+
+ enum Direction {
+ ToLinear = 1,
+ FromLinear = 2,
+ BiLinear = ToLinear | FromLinear
+ };
+
+ static std::shared_ptr<QColorTrcLut> fromGamma(qreal gamma, Direction dir = BiLinear);
+ static std::shared_ptr<QColorTrcLut> fromTransferFunction(const QColorTransferFunction &transFn, Direction dir = BiLinear);
+ static std::shared_ptr<QColorTrcLut> fromTransferTable(const QColorTransferTable &transTable, Direction dir = BiLinear);
+ void setFromGamma(qreal gamma, Direction dir = BiLinear);
+ void setFromTransferFunction(const QColorTransferFunction &transFn, Direction dir = BiLinear);
+ void setFromTransferTable(const QColorTransferTable &transTable, Direction dir = BiLinear);
// The following methods all convert opaque or unpremultiplied colors:
@@ -83,7 +60,7 @@ public:
#if defined(__SSE2__)
__m128i v = _mm_cvtsi32_si128(rgb32);
v = _mm_unpacklo_epi8(v, _mm_setzero_si128());
- const __m128i vidx = _mm_slli_epi16(v, 4);
+ const __m128i vidx = _mm_slli_epi16(v, ShiftUp);
const int ridx = _mm_extract_epi16(vidx, 2);
const int gidx = _mm_extract_epi16(vidx, 1);
const int bidx = _mm_extract_epi16(vidx, 0);
@@ -98,7 +75,7 @@ public:
#elif (defined(__ARM_NEON__) || defined(__ARM_NEON)) && Q_BYTE_ORDER == Q_LITTLE_ENDIAN
uint8x8_t v8 = vreinterpret_u8_u32(vmov_n_u32(rgb32));
uint16x4_t v16 = vget_low_u16(vmovl_u8(v8));
- const uint16x4_t vidx = vshl_n_u16(v16, 4);
+ const uint16x4_t vidx = vshl_n_u16(v16, ShiftUp);
const int ridx = vget_lane_u16(vidx, 2);
const int gidx = vget_lane_u16(vidx, 1);
const int bidx = vget_lane_u16(vidx, 0);
@@ -109,42 +86,43 @@ public:
v16 = vadd_u16(v16, vshr_n_u16(v16, 8));
return QRgba64::fromRgba64(vget_lane_u64(vreinterpret_u64_u16(v16), 0));
#else
- uint r = m_toLinear[qRed(rgb32) << 4];
- uint g = m_toLinear[qGreen(rgb32) << 4];
- uint b = m_toLinear[qBlue(rgb32) << 4];
+ uint r = m_toLinear[qRed(rgb32) << ShiftUp];
+ uint g = m_toLinear[qGreen(rgb32) << ShiftUp];
+ uint b = m_toLinear[qBlue(rgb32) << ShiftUp];
r = r + (r >> 8);
g = g + (g >> 8);
b = b + (b >> 8);
return QRgba64::fromRgba64(r, g, b, qAlpha(rgb32) * 257);
#endif
}
+ QRgba64 toLinear64(QRgba64) const = delete;
QRgb toLinear(QRgb rgb32) const
{
- return convertWithTable(rgb32, m_toLinear);
+ return convertWithTable(rgb32, m_toLinear.get());
}
QRgba64 toLinear(QRgba64 rgb64) const
{
- return convertWithTable(rgb64, m_toLinear);
+ return convertWithTable(rgb64, m_toLinear.get());
}
float u8ToLinearF32(int c) const
{
- ushort v = m_toLinear[c << 4];
+ ushort v = m_toLinear[c << ShiftUp];
return v * (1.0f / (255*256));
}
float u16ToLinearF32(int c) const
{
c -= (c >> 8);
- ushort v = m_toLinear[c >> 4];
+ ushort v = m_toLinear[c >> ShiftDown];
return v * (1.0f / (255*256));
}
float toLinear(float f) const
{
- ushort v = m_toLinear[(int)(f * (255 * 16) + 0.5f)];
+ ushort v = m_toLinear[(int)(f * Resolution + 0.5f)];
return v * (1.0f / (255*256));
}
@@ -153,7 +131,7 @@ public:
#if defined(__SSE2__)
__m128i v = _mm_loadl_epi64(reinterpret_cast<const __m128i *>(&rgb64));
v = _mm_sub_epi16(v, _mm_srli_epi16(v, 8));
- const __m128i vidx = _mm_srli_epi16(v, 4);
+ const __m128i vidx = _mm_srli_epi16(v, ShiftDown);
const int ridx = _mm_extract_epi16(vidx, 0);
const int gidx = _mm_extract_epi16(vidx, 1);
const int bidx = _mm_extract_epi16(vidx, 2);
@@ -167,7 +145,7 @@ public:
#elif (defined(__ARM_NEON__) || defined(__ARM_NEON)) && Q_BYTE_ORDER == Q_LITTLE_ENDIAN
uint16x4_t v = vreinterpret_u16_u64(vmov_n_u64(rgb64));
v = vsub_u16(v, vshr_n_u16(v, 8));
- const uint16x4_t vidx = vshr_n_u16(v, 4);
+ const uint16x4_t vidx = vshr_n_u16(v, ShiftDown);
const int ridx = vget_lane_u16(vidx, 0);
const int gidx = vget_lane_u16(vidx, 1);
const int bidx = vget_lane_u16(vidx, 2);
@@ -186,54 +164,56 @@ public:
g = g - (g >> 8);
b = b - (b >> 8);
a = (a + 0x80) >> 8;
- r = (m_fromLinear[r >> 4] + 0x80) >> 8;
- g = (m_fromLinear[g >> 4] + 0x80) >> 8;
- b = (m_fromLinear[b >> 4] + 0x80) >> 8;
+ r = (m_fromLinear[r >> ShiftDown] + 0x80) >> 8;
+ g = (m_fromLinear[g >> ShiftDown] + 0x80) >> 8;
+ b = (m_fromLinear[b >> ShiftDown] + 0x80) >> 8;
return (a << 24) | (r << 16) | (g << 8) | b;
#endif
}
QRgb fromLinear(QRgb rgb32) const
{
- return convertWithTable(rgb32, m_fromLinear);
+ return convertWithTable(rgb32, m_fromLinear.get());
}
QRgba64 fromLinear(QRgba64 rgb64) const
{
- return convertWithTable(rgb64, m_fromLinear);
+ return convertWithTable(rgb64, m_fromLinear.get());
}
int u8FromLinearF32(float f) const
{
- ushort v = m_fromLinear[(int)(f * (255 * 16) + 0.5f)];
+ ushort v = m_fromLinear[(int)(f * Resolution + 0.5f)];
return (v + 0x80) >> 8;
}
int u16FromLinearF32(float f) const
{
- ushort v = m_fromLinear[(int)(f * (255 * 16) + 0.5f)];
+ ushort v = m_fromLinear[(int)(f * Resolution + 0.5f)];
return v + (v >> 8);
}
float fromLinear(float f) const
{
- ushort v = m_fromLinear[(int)(f * (255 * 16) + 0.5f)];
+ ushort v = m_fromLinear[(int)(f * Resolution + 0.5f)];
return v * (1.0f / (255*256));
}
// We translate to 0-65280 (255*256) instead to 0-65535 to make simple
// shifting an accurate conversion.
- // We translate from 0-4080 (255*16) for the same speed up, and to keep
- // the tables small enough to fit in most inner caches.
- ushort m_toLinear[(255 * 16) + 1]; // [0-4080] -> [0-65280]
- ushort m_fromLinear[(255 * 16) + 1]; // [0-4080] -> [0-65280]
+ // We translate from 0->Resolution (4080 = 255*16) for the same speed up,
+ // and to keep the tables small enough to fit in most inner caches.
+ std::unique_ptr<ushort[]> m_toLinear; // [0->Resolution] -> [0-65280]
+ std::unique_ptr<ushort[]> m_fromLinear; // [0->Resolution] -> [0-65280]
private:
- QColorTrcLut() { }
+ QColorTrcLut() = default;
+
+ static std::shared_ptr<QColorTrcLut> create();
Q_ALWAYS_INLINE static QRgb convertWithTable(QRgb rgb32, const ushort *table)
{
- const int r = (table[qRed(rgb32) << 4] + 0x80) >> 8;
- const int g = (table[qGreen(rgb32) << 4] + 0x80) >> 8;
- const int b = (table[qBlue(rgb32) << 4] + 0x80) >> 8;
+ const int r = (table[qRed(rgb32) << ShiftUp] + 0x80) >> 8;
+ const int g = (table[qGreen(rgb32) << ShiftUp] + 0x80) >> 8;
+ const int b = (table[qBlue(rgb32) << ShiftUp] + 0x80) >> 8;
return (rgb32 & 0xff000000) | (r << 16) | (g << 8) | b;
}
Q_ALWAYS_INLINE static QRgba64 convertWithTable(QRgba64 rgb64, const ushort *table)
@@ -241,7 +221,7 @@ private:
#if defined(__SSE2__)
__m128i v = _mm_loadl_epi64(reinterpret_cast<const __m128i *>(&rgb64));
v = _mm_sub_epi16(v, _mm_srli_epi16(v, 8));
- const __m128i vidx = _mm_srli_epi16(v, 4);
+ const __m128i vidx = _mm_srli_epi16(v, ShiftDown);
const int ridx = _mm_extract_epi16(vidx, 2);
const int gidx = _mm_extract_epi16(vidx, 1);
const int bidx = _mm_extract_epi16(vidx, 0);
@@ -255,7 +235,7 @@ private:
#elif (defined(__ARM_NEON__) || defined(__ARM_NEON)) && Q_BYTE_ORDER == Q_LITTLE_ENDIAN
uint16x4_t v = vreinterpret_u16_u64(vmov_n_u64(rgb64));
v = vsub_u16(v, vshr_n_u16(v, 8));
- const uint16x4_t vidx = vshr_n_u16(v, 4);
+ const uint16x4_t vidx = vshr_n_u16(v, ShiftDown);
const int ridx = vget_lane_u16(vidx, 2);
const int gidx = vget_lane_u16(vidx, 1);
const int bidx = vget_lane_u16(vidx, 0);
@@ -271,9 +251,9 @@ private:
r = r - (r >> 8);
g = g - (g >> 8);
b = b - (b >> 8);
- r = table[r >> 4];
- g = table[g >> 4];
- b = table[b >> 4];
+ r = table[r >> ShiftDown];
+ g = table[g >> ShiftDown];
+ b = table[b >> ShiftDown];
r = r + (r >> 8);
g = g + (g >> 8);
b = b + (b >> 8);
diff --git a/src/gui/painting/qcompositionfunctions.cpp b/src/gui/painting/qcompositionfunctions.cpp
index ced213e36d..00fd749fe6 100644
--- a/src/gui/painting/qcompositionfunctions.cpp
+++ b/src/gui/painting/qcompositionfunctions.cpp
@@ -1,45 +1,11 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the QtGui module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#include <qglobal.h>
+
#include "qdrawhelper_p.h"
#include "qrgba64_p.h"
+#include "qrgbafloat.h"
QT_BEGIN_NAMESPACE
@@ -117,6 +83,8 @@ struct Argb32OperationsC
const Argb32OperationsC::Type Argb32OperationsC::clear = 0;
+typedef Argb32OperationsC Argb32Operations;
+
struct Rgba64OperationsBase
{
typedef QRgba64 Type;
@@ -319,9 +287,188 @@ typedef Rgba64OperationsNEON Rgba64Operations;
#else
typedef Rgba64OperationsC Rgba64Operations;
#endif
+
#endif // QT_CONFIG(raster_64bit)
-typedef Argb32OperationsC Argb32Operations;
+#if QT_CONFIG(raster_fp)
+
+static inline QRgbaFloat32 qRgbaFloat32(float r, float g, float b, float a)
+{
+ return QRgbaFloat32{r, g, b, a};
+}
+
+struct RgbaFPOperationsBase
+{
+ typedef QRgbaFloat32 Type;
+ typedef float Scalar;
+
+ static inline constexpr Type clear = { 0, 0, 0, 0 };
+
+ static bool isOpaque(Type val)
+ { return val.a >= 1.0f; }
+ static bool isTransparent(Type val)
+ { return val.a <= 0.0f; }
+ static Scalar scalarFrom8bit(uint8_t a)
+ { return a * (1.0f / 255.0f); }
+
+ static void memfill(Type *ptr, Type value, qsizetype len)
+ {
+ for (qsizetype i = 0; i < len; ++i)
+ ptr[i] = value;
+ }
+ static void memcpy(Type *Q_DECL_RESTRICT dest, const Type *Q_DECL_RESTRICT src, qsizetype len)
+ { ::memcpy(dest, src, len * sizeof(Type)); }
+};
+
+struct RgbaFPOperationsC : RgbaFPOperationsBase
+{
+ typedef QRgbaFloat32 OptimalType;
+ typedef float OptimalScalar;
+
+ static OptimalType load(const Type *ptr)
+ {
+ return QRgbaFloat32 { ptr->r, ptr->g, ptr->b, ptr->a };
+ }
+ static OptimalType convert(const Type &val)
+ {
+ return QRgbaFloat32 { val.r, val.g, val.b, val.a };
+ }
+ static void store(Type *ptr, OptimalType value)
+ {
+ ptr->r = value.r;
+ ptr->g = value.g;
+ ptr->b = value.b;
+ ptr->a = value.a;
+ }
+ static OptimalType add(OptimalType a, OptimalType b)
+ {
+ a.r += b.r;
+ a.g += b.g;
+ a.b += b.b;
+ a.a += b.a;
+ return a;
+ }
+ static OptimalScalar add(OptimalScalar a, OptimalScalar b)
+ { return a + b; }
+ static OptimalType plus(OptimalType a, OptimalType b)
+ {
+ a = add(a, b); // no saturation on color values
+ if (a.a < 0.0f) a.a = 0.0f;
+ else if (a.a > 1.0f) a.a = 1.0f;
+ return a;
+ }
+ static OptimalScalar alpha(OptimalType val)
+ { return val.a; }
+ static OptimalScalar invAlpha(OptimalScalar c)
+ { return 1.0f - c; }
+ static OptimalScalar invAlpha(OptimalType val)
+ { return 1.0f - val.a; }
+ static OptimalScalar scalar(Scalar v)
+ { return v; }
+ static OptimalType multiplyAlpha(OptimalType val, OptimalScalar a)
+ {
+ val.r *= a;
+ val.g *= a;
+ val.b *= a;
+ val.a *= a;
+ return val;
+ }
+ static OptimalScalar multiplyAlpha8bit(OptimalScalar val, uint8_t a)
+ {
+ return val * a * (1.0f / 255.0f);
+ }
+ static OptimalType interpolate(OptimalType x, OptimalScalar a1, OptimalType y, OptimalScalar a2)
+ {
+ return add(multiplyAlpha(x, a1), multiplyAlpha(y, a2));
+ }
+ static OptimalType multiplyAlpha8bit(OptimalType val, uint8_t a)
+ {
+ return multiplyAlpha(val, a * (1.0f / 255.0f));
+ }
+ static OptimalType interpolate8bit(OptimalType x, uint8_t a1, OptimalType y, uint8_t a2)
+ {
+ return add(multiplyAlpha8bit(x, a1), multiplyAlpha8bit(y, a2));
+ }
+};
+
+#if defined(__SSE2__)
+struct RgbaFPOperationsSSE2 : public RgbaFPOperationsBase
+{
+ typedef __m128 OptimalType;
+ typedef __m128 OptimalScalar;
+
+ static OptimalType Q_DECL_VECTORCALL load(const Type *ptr)
+ {
+ return _mm_loadu_ps(reinterpret_cast<const float *>(ptr));
+ }
+ static OptimalType Q_DECL_VECTORCALL convert(const Type &value)
+ {
+ return load(&value);
+ }
+ static void Q_DECL_VECTORCALL store(Type *ptr, OptimalType value)
+ {
+ _mm_storeu_ps(reinterpret_cast<float *>(ptr), value);
+ }
+ static OptimalType Q_DECL_VECTORCALL add(OptimalType a, OptimalType b)
+ {
+ return _mm_add_ps(a, b);
+ }
+// same as above:
+// static OptimalScalar add(OptimalScalar a, OptimalScalar b)
+ static OptimalType Q_DECL_VECTORCALL plus(OptimalType a, OptimalType b)
+ {
+ a = _mm_add_ps(a, b);
+ __m128 aa = _mm_min_ps(a, _mm_set1_ps(1.0f));
+ aa = _mm_max_ps(aa, _mm_set1_ps(0.0f));
+ // An indirect insert using only SSE2:
+ aa = _mm_shuffle_ps(aa, a, _MM_SHUFFLE(2, 2, 3, 3));
+ a = _mm_shuffle_ps(a, aa, _MM_SHUFFLE(0, 2, 1, 0));
+ return a;
+ }
+ static OptimalScalar Q_DECL_VECTORCALL alpha(OptimalType c)
+ {
+ return _mm_shuffle_ps(c, c, _MM_SHUFFLE(3, 3, 3, 3));
+ }
+ static OptimalScalar Q_DECL_VECTORCALL invAlpha(Scalar c)
+ {
+ return _mm_set1_ps(1.0f - float(c));
+ }
+ static OptimalScalar Q_DECL_VECTORCALL invAlpha(OptimalType c)
+ {
+ return _mm_sub_ps(_mm_set1_ps(1.0f), alpha(c));
+ }
+ static OptimalScalar Q_DECL_VECTORCALL scalar(Scalar n)
+ {
+ return _mm_set1_ps(float(n));
+ }
+ static OptimalType Q_DECL_VECTORCALL multiplyAlpha(OptimalType val, OptimalScalar a)
+ {
+ return _mm_mul_ps(val, a);
+ }
+ static OptimalType Q_DECL_VECTORCALL interpolate(OptimalType x, OptimalScalar a1, OptimalType y, OptimalScalar a2)
+ {
+ return add(multiplyAlpha(x, a1), multiplyAlpha(y, a2));
+ }
+ static OptimalType Q_DECL_VECTORCALL multiplyAlpha8bit(OptimalType val, uint8_t a)
+ {
+ return multiplyAlpha(val, _mm_set1_ps(a * (1.0f / 255.0f)));
+ }
+// same as above:
+// static OptimalScalar multiplyAlpha8bit(OptimalScalar a, uint8_t a)
+ static OptimalType Q_DECL_VECTORCALL interpolate8bit(OptimalType x, uint8_t a1, OptimalType y, uint8_t a2)
+ {
+ return add(multiplyAlpha8bit(x, a1), multiplyAlpha8bit(y, a2));
+ }
+};
+#endif
+
+#if defined(__SSE2__)
+typedef RgbaFPOperationsSSE2 RgbaFPOperations;
+#else
+typedef RgbaFPOperationsC RgbaFPOperations;
+#endif
+
+#endif // QT_CONFIG(raster_fp)
/*
result = 0
@@ -362,6 +509,17 @@ void QT_FASTCALL comp_func_Clear_rgb64(QRgba64 *dest, const QRgba64 *, int lengt
}
#endif
+#if QT_CONFIG(raster_fp)
+void QT_FASTCALL comp_func_solid_Clear_rgbafp(QRgbaFloat32 *dest, int length, QRgbaFloat32, uint const_alpha)
+{
+ comp_func_Clear_template<RgbaFPOperations>(dest, length, const_alpha);
+}
+
+void QT_FASTCALL comp_func_Clear_rgbafp(QRgbaFloat32 *dest, const QRgbaFloat32 *, int length, uint const_alpha)
+{
+ comp_func_Clear_template<RgbaFPOperations>(dest, length, const_alpha);
+}
+#endif
/*
result = s
@@ -421,6 +579,18 @@ void QT_FASTCALL comp_func_Source_rgb64(QRgba64 *Q_DECL_RESTRICT dest, const QRg
}
#endif
+#if QT_CONFIG(raster_fp)
+void QT_FASTCALL comp_func_solid_Source_rgbafp(QRgbaFloat32 *dest, int length, QRgbaFloat32 color, uint const_alpha)
+{
+ comp_func_solid_Source_template<RgbaFPOperations>(dest, length, color, const_alpha);
+}
+
+void QT_FASTCALL comp_func_Source_rgbafp(QRgbaFloat32 *Q_DECL_RESTRICT dest, const QRgbaFloat32 *Q_DECL_RESTRICT src, int length, uint const_alpha)
+{
+ comp_func_Source_template<RgbaFPOperations>(dest, src, length, const_alpha);
+}
+#endif
+
void QT_FASTCALL comp_func_solid_Destination(uint *, int, uint, uint)
{
}
@@ -439,6 +609,16 @@ void QT_FASTCALL comp_func_Destination_rgb64(QRgba64 *, const QRgba64 *, int, ui
}
#endif
+#if QT_CONFIG(raster_fp)
+void QT_FASTCALL comp_func_solid_Destination_rgbafp(QRgbaFloat32 *, int, QRgbaFloat32, uint)
+{
+}
+
+void QT_FASTCALL comp_func_Destination_rgbafp(QRgbaFloat32 *, const QRgbaFloat32 *, int, uint)
+{
+}
+#endif
+
/*
result = s + d * sia
dest = (s + d * sia) * ca + d * cia
@@ -509,6 +689,19 @@ void QT_FASTCALL comp_func_SourceOver_rgb64(QRgba64 *Q_DECL_RESTRICT dest, const
}
#endif
+#if QT_CONFIG(raster_fp)
+void QT_FASTCALL comp_func_solid_SourceOver_rgbafp(QRgbaFloat32 *dest, int length, QRgbaFloat32 color, uint const_alpha)
+{
+ comp_func_solid_SourceOver_template<RgbaFPOperations>(dest, length, color, const_alpha);
+}
+
+
+void QT_FASTCALL comp_func_SourceOver_rgbafp(QRgbaFloat32 *Q_DECL_RESTRICT dest, const QRgbaFloat32 *Q_DECL_RESTRICT src, int length, uint const_alpha)
+{
+ comp_func_SourceOver_template<RgbaFPOperations>(dest, src, length, const_alpha);
+}
+#endif
+
/*
result = d + s * dia
dest = (d + s * dia) * ca + d * cia
@@ -570,6 +763,18 @@ void QT_FASTCALL comp_func_DestinationOver_rgb64(QRgba64 *Q_DECL_RESTRICT dest,
}
#endif
+#if QT_CONFIG(raster_fp)
+void QT_FASTCALL comp_func_solid_DestinationOver_rgbafp(QRgbaFloat32 *dest, int length, QRgbaFloat32 color, uint const_alpha)
+{
+ comp_func_solid_DestinationOver_template<RgbaFPOperations>(dest, length, color, const_alpha);
+}
+
+void QT_FASTCALL comp_func_DestinationOver_rgbafp(QRgbaFloat32 *Q_DECL_RESTRICT dest, const QRgbaFloat32 *Q_DECL_RESTRICT src, int length, uint const_alpha)
+{
+ comp_func_DestinationOver_template<RgbaFPOperations>(dest, src, length, const_alpha);
+}
+#endif
+
/*
result = s * da
dest = s * da * ca + d * cia
@@ -636,6 +841,18 @@ void QT_FASTCALL comp_func_SourceIn_rgb64(QRgba64 *Q_DECL_RESTRICT dest, const Q
}
#endif
+#if QT_CONFIG(raster_fp)
+void QT_FASTCALL comp_func_solid_SourceIn_rgbafp(QRgbaFloat32 *dest, int length, QRgbaFloat32 color, uint const_alpha)
+{
+ comp_func_solid_SourceIn_template<RgbaFPOperations>(dest, length, color, const_alpha);
+}
+
+void QT_FASTCALL comp_func_SourceIn_rgbafp(QRgbaFloat32 *Q_DECL_RESTRICT dest, const QRgbaFloat32 *Q_DECL_RESTRICT src, int length, uint const_alpha)
+{
+ comp_func_SourceIn_template<RgbaFPOperations>(dest, src, length, const_alpha);
+}
+#endif
+
/*
result = d * sa
dest = d * sa * ca + d * cia
@@ -697,6 +914,18 @@ void QT_FASTCALL comp_func_DestinationIn_rgb64(QRgba64 *Q_DECL_RESTRICT dest, co
}
#endif
+#if QT_CONFIG(raster_fp)
+void QT_FASTCALL comp_func_solid_DestinationIn_rgbafp(QRgbaFloat32 *dest, int length, QRgbaFloat32 color, uint const_alpha)
+{
+ comp_func_solid_DestinationIn_template<RgbaFPOperations>(dest, length, color, const_alpha);
+}
+
+void QT_FASTCALL comp_func_DestinationIn_rgbafp(QRgbaFloat32 *Q_DECL_RESTRICT dest, const QRgbaFloat32 *Q_DECL_RESTRICT src, int length, uint const_alpha)
+{
+ comp_func_DestinationIn_template<RgbaFPOperations>(dest, src, length, const_alpha);
+}
+#endif
+
/*
result = s * dia
dest = s * dia * ca + d * cia
@@ -761,6 +990,18 @@ void QT_FASTCALL comp_func_SourceOut_rgb64(QRgba64 *Q_DECL_RESTRICT dest, const
}
#endif
+#if QT_CONFIG(raster_fp)
+void QT_FASTCALL comp_func_solid_SourceOut_rgbafp(QRgbaFloat32 *dest, int length, QRgbaFloat32 color, uint const_alpha)
+{
+ comp_func_solid_SourceOut_template<RgbaFPOperations>(dest, length, color, const_alpha);
+}
+
+void QT_FASTCALL comp_func_SourceOut_rgbafp(QRgbaFloat32 *Q_DECL_RESTRICT dest, const QRgbaFloat32 *Q_DECL_RESTRICT src, int length, uint const_alpha)
+{
+ comp_func_SourceOut_template<RgbaFPOperations>(dest, src, length, const_alpha);
+}
+#endif
+
/*
result = d * sia
dest = d * sia * ca + d * cia
@@ -822,6 +1063,18 @@ void QT_FASTCALL comp_func_DestinationOut_rgb64(QRgba64 *Q_DECL_RESTRICT dest, c
}
#endif
+#if QT_CONFIG(raster_fp)
+void QT_FASTCALL comp_func_solid_DestinationOut_rgbafp(QRgbaFloat32 *dest, int length, QRgbaFloat32 color, uint const_alpha)
+{
+ comp_func_solid_DestinationOut_template<RgbaFPOperations>(dest, length, color, const_alpha);
+}
+
+void QT_FASTCALL comp_func_DestinationOut_rgbafp(QRgbaFloat32 *Q_DECL_RESTRICT dest, const QRgbaFloat32 *Q_DECL_RESTRICT src, int length, uint const_alpha)
+{
+ comp_func_DestinationOut_template<RgbaFPOperations>(dest, src, length, const_alpha);
+}
+#endif
+
/*
result = s*da + d*sia
dest = s*da*ca + d*sia*ca + d *cia
@@ -883,6 +1136,18 @@ void QT_FASTCALL comp_func_SourceAtop_rgb64(QRgba64 *Q_DECL_RESTRICT dest, const
}
#endif
+#if QT_CONFIG(raster_fp)
+void QT_FASTCALL comp_func_solid_SourceAtop_rgbafp(QRgbaFloat32 *dest, int length, QRgbaFloat32 color, uint const_alpha)
+{
+ comp_func_solid_SourceAtop_template<RgbaFPOperations>(dest, length, color, const_alpha);
+}
+
+void QT_FASTCALL comp_func_SourceAtop_rgbafp(QRgbaFloat32 *Q_DECL_RESTRICT dest, const QRgbaFloat32 *Q_DECL_RESTRICT src, int length, uint const_alpha)
+{
+ comp_func_SourceAtop_template<RgbaFPOperations>(dest, src, length, const_alpha);
+}
+#endif
+
/*
result = d*sa + s*dia
dest = d*sa*ca + s*dia*ca + d *cia
@@ -949,6 +1214,18 @@ void QT_FASTCALL comp_func_DestinationAtop_rgb64(QRgba64 *Q_DECL_RESTRICT dest,
}
#endif
+#if QT_CONFIG(raster_fp)
+void QT_FASTCALL comp_func_solid_DestinationAtop_rgbafp(QRgbaFloat32 *dest, int length, QRgbaFloat32 color, uint const_alpha)
+{
+ comp_func_solid_DestinationAtop_template<RgbaFPOperations>(dest, length, color, const_alpha);
+}
+
+void QT_FASTCALL comp_func_DestinationAtop_rgbafp(QRgbaFloat32 *Q_DECL_RESTRICT dest, const QRgbaFloat32 *Q_DECL_RESTRICT src, int length, uint const_alpha)
+{
+ comp_func_DestinationAtop_template<RgbaFPOperations>(dest, src, length, const_alpha);
+}
+#endif
+
/*
result = d*sia + s*dia
dest = d*sia*ca + s*dia*ca + d *cia
@@ -1011,15 +1288,35 @@ void QT_FASTCALL comp_func_XOR_rgb64(QRgba64 *Q_DECL_RESTRICT dest, const QRgba6
}
#endif
+#if QT_CONFIG(raster_fp)
+void QT_FASTCALL comp_func_solid_XOR_rgbafp(QRgbaFloat32 *dest, int length, QRgbaFloat32 color, uint const_alpha)
+{
+ comp_func_solid_XOR_template<RgbaFPOperations>(dest, length, color, const_alpha);
+}
+
+void QT_FASTCALL comp_func_XOR_rgbafp(QRgbaFloat32 *Q_DECL_RESTRICT dest, const QRgbaFloat32 *Q_DECL_RESTRICT src, int length, uint const_alpha)
+{
+ comp_func_XOR_template<RgbaFPOperations>(dest, src, length, const_alpha);
+}
+#endif
+
struct QFullCoverage {
inline void store(uint *dest, const uint src) const
{
*dest = src;
}
+#if QT_CONFIG(raster_64bit)
inline void store(QRgba64 *dest, const QRgba64 src) const
{
*dest = src;
}
+#endif
+#if QT_CONFIG(raster_fp)
+ inline void store(QRgbaFloat32 *dest, const QRgbaFloat32 src) const
+ {
+ *dest = src;
+ }
+#endif
};
struct QPartialCoverage {
@@ -1029,14 +1326,27 @@ struct QPartialCoverage {
{
}
+ template<typename Op>
+ inline void store_template(typename Op::Type *dest, const typename Op::Type src) const
+ {
+ Op::store(dest, Op::interpolate8bit(Op::convert(src), ca, Op::load(dest), ica));
+ }
inline void store(uint *dest, const uint src) const
{
- *dest = INTERPOLATE_PIXEL_255(src, ca, *dest, ica);
+ store_template<Argb32Operations>(dest, src);
}
+#if QT_CONFIG(raster_64bit)
inline void store(QRgba64 *dest, const QRgba64 src) const
{
- *dest = interpolate255(src, ca, *dest, ica);
+ store_template<Rgba64Operations>(dest, src);
+ }
+#endif
+#if QT_CONFIG(raster_fp)
+ inline void store(QRgbaFloat32 *dest, const QRgbaFloat32 src) const
+ {
+ store_template<RgbaFPOperations>(dest, src);
}
+#endif
private:
const uint ca;
@@ -1045,13 +1355,22 @@ private:
static inline int mix_alpha(int da, int sa)
{
- return 255 - ((255 - sa) * (255 - da) >> 8);
+ return 255 - qt_div_255((255 - sa) * (255 - da));
}
+#if QT_CONFIG(raster_64bit)
static inline uint mix_alpha_rgb64(uint da, uint sa)
{
- return 65535 - ((65535 - sa) * (65535 - da) >> 16);
+ return 65535U - qt_div_65535((65535U - sa) * (65535U - da));
+}
+#endif
+
+#if QT_CONFIG(raster_fp)
+static inline float mix_alpha_rgbafp(float da, float sa)
+{
+ return 1.0f - (1.0f - sa) * (1.0f - da);
}
+#endif
/*
Dca' = Sca.Da + Dca.Sa + Sca.(1 - Da) + Dca.(1 - Sa)
@@ -1122,6 +1441,18 @@ void QT_FASTCALL comp_func_Plus_rgb64(QRgba64 *Q_DECL_RESTRICT dest, const QRgba
}
#endif
+#if QT_CONFIG(raster_fp)
+void QT_FASTCALL comp_func_solid_Plus_rgbafp(QRgbaFloat32 *dest, int length, QRgbaFloat32 color, uint const_alpha)
+{
+ comp_func_solid_Plus_template<RgbaFPOperations>(dest, length, color, const_alpha);
+}
+
+void QT_FASTCALL comp_func_Plus_rgbafp(QRgbaFloat32 *Q_DECL_RESTRICT dest, const QRgbaFloat32 *Q_DECL_RESTRICT src, int length, uint const_alpha)
+{
+ comp_func_Plus_template<RgbaFPOperations>(dest, src, length, const_alpha);
+}
+#endif
+
/*
Dca' = Sca.Dca + Sca.(1 - Da) + Dca.(1 - Sa)
*/
@@ -1164,7 +1495,7 @@ void QT_FASTCALL comp_func_solid_Multiply(uint *dest, int length, uint color, ui
#if QT_CONFIG(raster_64bit)
static inline uint multiply_op_rgb64(uint dst, uint src, uint da, uint sa)
{
- return qt_div_65535(src * dst + src * (65535 - da) + dst * (65535 - sa));
+ return qt_div_65535(src * dst + src * (65535U - da) + dst * (65535U - sa));
}
template <typename T>
@@ -1199,6 +1530,45 @@ void QT_FASTCALL comp_func_solid_Multiply_rgb64(QRgba64 *dest, int length, QRgba
}
#endif
+#if QT_CONFIG(raster_fp)
+static inline float multiply_op_rgbafp(float dst, float src, float da, float sa)
+{
+ return src * dst + src * (1.0f - da) + dst * (1.0f - sa);
+}
+
+template <typename T>
+static inline void comp_func_solid_Multiply_impl(QRgbaFloat32 *dest, int length, QRgbaFloat32 color, const T &coverage)
+{
+ float sa = color.alpha();
+ float sr = color.red();
+ float sg = color.green();
+ float sb = color.blue();
+
+ for (int i = 0; i < length; ++i) {
+ QRgbaFloat32 d = dest[i];
+ float da = d.alpha();
+
+#define OP(a, b) multiply_op_rgbafp(a, b, da, sa)
+ float r = OP( d.red(), sr);
+ float b = OP( d.blue(), sb);
+ float g = OP(d.green(), sg);
+ float a = mix_alpha_rgbafp(da, sa);
+#undef OP
+
+ coverage.store(&dest[i], qRgbaFloat32(r, g, b, a));
+ }
+}
+
+void QT_FASTCALL comp_func_solid_Multiply_rgbafp(QRgbaFloat32 *dest, int length, QRgbaFloat32 color, uint const_alpha)
+{
+ if (const_alpha == 255)
+ comp_func_solid_Multiply_impl(dest, length, color, QFullCoverage());
+ else
+ comp_func_solid_Multiply_impl(dest, length, color, QPartialCoverage(const_alpha));
+}
+#endif
+
+
template <typename T>
static inline void comp_func_Multiply_impl(uint *Q_DECL_RESTRICT dest, const uint *Q_DECL_RESTRICT src, int length, const T &coverage)
{
@@ -1259,6 +1629,37 @@ void QT_FASTCALL comp_func_Multiply_rgb64(QRgba64 *Q_DECL_RESTRICT dest, const Q
}
#endif
+#if QT_CONFIG(raster_fp)
+template <typename T>
+static inline void comp_func_Multiply_impl(QRgbaFloat32 *Q_DECL_RESTRICT dest, const QRgbaFloat32 *Q_DECL_RESTRICT src, int length, const T &coverage)
+{
+ for (int i = 0; i < length; ++i) {
+ QRgbaFloat32 d = dest[i];
+ QRgbaFloat32 s = src[i];
+
+ float da = d.alpha();
+ float sa = s.alpha();
+
+#define OP(a, b) multiply_op_rgbafp(a, b, da, sa)
+ float r = OP( d.red(), s.red());
+ float b = OP( d.blue(), s.blue());
+ float g = OP(d.green(), s.green());
+ float a = mix_alpha_rgbafp(da, sa);
+#undef OP
+
+ coverage.store(&dest[i], qRgbaFloat32(r, g, b, a));
+ }
+}
+
+void QT_FASTCALL comp_func_Multiply_rgbafp(QRgbaFloat32 *Q_DECL_RESTRICT dest, const QRgbaFloat32 *Q_DECL_RESTRICT src, int length, uint const_alpha)
+{
+ if (const_alpha == 255)
+ comp_func_Multiply_impl(dest, src, length, QFullCoverage());
+ else
+ comp_func_Multiply_impl(dest, src, length, QPartialCoverage(const_alpha));
+}
+#endif
+
/*
Dca' = (Sca.Da + Dca.Sa - Sca.Dca) + Sca.(1 - Da) + Dca.(1 - Sa)
= Sca + Dca - Sca.Dca
@@ -1307,7 +1708,7 @@ static inline void comp_func_solid_Screen_impl(QRgba64 *dest, int length, QRgba6
QRgba64 d = dest[i];
uint da = d.alpha();
-#define OP(a, b) 65535 - qt_div_65535((65535-a) * (65535-b))
+#define OP(a, b) 65535 - qt_div_65535((65535U-a) * (65535U-b))
uint r = OP( d.red(), sr);
uint b = OP( d.blue(), sb);
uint g = OP(d.green(), sg);
@@ -1327,6 +1728,39 @@ void QT_FASTCALL comp_func_solid_Screen_rgb64(QRgba64 *dest, int length, QRgba64
}
#endif
+#if QT_CONFIG(raster_fp)
+template <typename T>
+static inline void comp_func_solid_Screen_impl(QRgbaFloat32 *dest, int length, QRgbaFloat32 color, const T &coverage)
+{
+ float sa = color.alpha();
+ float sr = color.red();
+ float sg = color.green();
+ float sb = color.blue();
+
+ for (int i = 0; i < length; ++i) {
+ QRgbaFloat32 d = dest[i];
+ float da = d.alpha();
+
+#define OP(a, b) (1.0f - ((1.0f - a) * (1.0f - b)))
+ float r = OP( d.red(), sr);
+ float b = OP( d.blue(), sb);
+ float g = OP(d.green(), sg);
+ float a = mix_alpha_rgbafp(da, sa);
+#undef OP
+
+ coverage.store(&dest[i], qRgbaFloat32(r, g, b, a));
+ }
+}
+
+void QT_FASTCALL comp_func_solid_Screen_rgbafp(QRgbaFloat32 *dest, int length, QRgbaFloat32 color, uint const_alpha)
+{
+ if (const_alpha == 255)
+ comp_func_solid_Screen_impl(dest, length, color, QFullCoverage());
+ else
+ comp_func_solid_Screen_impl(dest, length, color, QPartialCoverage(const_alpha));
+}
+#endif
+
template <typename T>
static inline void comp_func_Screen_impl(uint *Q_DECL_RESTRICT dest, const uint *Q_DECL_RESTRICT src, int length, const T &coverage)
{
@@ -1337,7 +1771,7 @@ static inline void comp_func_Screen_impl(uint *Q_DECL_RESTRICT dest, const uint
int da = qAlpha(d);
int sa = qAlpha(s);
-#define OP(a, b) 255 - (((255-a) * (255-b)) >> 8)
+#define OP(a, b) 255 - qt_div_255((255-a) * (255-b))
int r = OP( qRed(d), qRed(s));
int b = OP( qBlue(d), qBlue(s));
int g = OP(qGreen(d), qGreen(s));
@@ -1367,7 +1801,7 @@ static inline void comp_func_Screen_impl(QRgba64 *Q_DECL_RESTRICT dest, const QR
uint da = d.alpha();
uint sa = s.alpha();
-#define OP(a, b) 65535 - (((65535-a) * (65535-b)) >> 16)
+#define OP(a, b) 65535U - qt_div_65535((65535U-a) * (65535U-b))
uint r = OP( d.red(), s.red());
uint b = OP( d.blue(), s.blue());
uint g = OP(d.green(), s.green());
@@ -1387,6 +1821,37 @@ void QT_FASTCALL comp_func_Screen_rgb64(QRgba64 *dest, const QRgba64 *src, int l
}
#endif
+#if QT_CONFIG(raster_fp)
+template <typename T>
+static inline void comp_func_Screen_impl(QRgbaFloat32 *Q_DECL_RESTRICT dest, const QRgbaFloat32 *Q_DECL_RESTRICT src, int length, const T &coverage)
+{
+ for (int i = 0; i < length; ++i) {
+ QRgbaFloat32 d = dest[i];
+ QRgbaFloat32 s = src[i];
+
+ float da = d.alpha();
+ float sa = s.alpha();
+
+#define OP(a, b) (1.0f - ((1.0f - a) * (1.0f - b)))
+ float r = OP( d.red(), s.red());
+ float b = OP( d.blue(), s.blue());
+ float g = OP(d.green(), s.green());
+ float a = mix_alpha_rgbafp(da, sa);
+#undef OP
+
+ coverage.store(&dest[i], qRgbaFloat32(r, g, b, a));
+ }
+}
+
+void QT_FASTCALL comp_func_Screen_rgbafp(QRgbaFloat32 *dest, const QRgbaFloat32 *src, int length, uint const_alpha)
+{
+ if (const_alpha == 255)
+ comp_func_Screen_impl(dest, src, length, QFullCoverage());
+ else
+ comp_func_Screen_impl(dest, src, length, QPartialCoverage(const_alpha));
+}
+#endif
+
/*
if 2.Dca < Da
Dca' = 2.Sca.Dca + Sca.(1 - Da) + Dca.(1 - Sa)
@@ -1436,7 +1901,7 @@ void QT_FASTCALL comp_func_solid_Overlay(uint *dest, int length, uint color, uin
#if QT_CONFIG(raster_64bit)
static inline uint overlay_op_rgb64(uint dst, uint src, uint da, uint sa)
{
- const uint temp = src * (65535 - da) + dst * (65535 - sa);
+ const uint temp = src * (65535U - da) + dst * (65535U - sa);
if (2 * dst < da)
return qt_div_65535(2 * src * dst + temp);
else
@@ -1475,6 +1940,48 @@ void QT_FASTCALL comp_func_solid_Overlay_rgb64(QRgba64 *dest, int length, QRgba6
}
#endif
+#if QT_CONFIG(raster_fp)
+static inline float overlay_op_rgbafp(float dst, float src, float da, float sa)
+{
+ const float temp = src * (1.0f - da) + dst * (1.0f - sa);
+ if (2 * dst < da)
+ return 2 * src * dst + temp;
+ else
+ return sa * da - 2 * (da - dst) * (sa - src) + temp;
+}
+
+template <typename T>
+static inline void comp_func_solid_Overlay_impl(QRgbaFloat32 *dest, int length, QRgbaFloat32 color, const T &coverage)
+{
+ float sa = color.alpha();
+ float sr = color.red();
+ float sg = color.green();
+ float sb = color.blue();
+
+ for (int i = 0; i < length; ++i) {
+ QRgbaFloat32 d = dest[i];
+ float da = d.alpha();
+
+#define OP(a, b) overlay_op_rgbafp(a, b, da, sa)
+ float r = OP( d.red(), sr);
+ float b = OP( d.blue(), sb);
+ float g = OP(d.green(), sg);
+ float a = mix_alpha_rgbafp(da, sa);
+#undef OP
+
+ coverage.store(&dest[i], qRgbaFloat32(r, g, b, a));
+ }
+}
+
+void QT_FASTCALL comp_func_solid_Overlay_rgbafp(QRgbaFloat32 *dest, int length, QRgbaFloat32 color, uint const_alpha)
+{
+ if (const_alpha == 255)
+ comp_func_solid_Overlay_impl(dest, length, color, QFullCoverage());
+ else
+ comp_func_solid_Overlay_impl(dest, length, color, QPartialCoverage(const_alpha));
+}
+#endif
+
template <typename T>
static inline void comp_func_Overlay_impl(uint *Q_DECL_RESTRICT dest, const uint *Q_DECL_RESTRICT src, int length, const T &coverage)
{
@@ -1535,6 +2042,37 @@ void QT_FASTCALL comp_func_Overlay_rgb64(QRgba64 *Q_DECL_RESTRICT dest, const QR
}
#endif
+#if QT_CONFIG(raster_fp)
+template <typename T>
+static inline void comp_func_Overlay_impl(QRgbaFloat32 *Q_DECL_RESTRICT dest, const QRgbaFloat32 *Q_DECL_RESTRICT src, int length, const T &coverage)
+{
+ for (int i = 0; i < length; ++i) {
+ QRgbaFloat32 d = dest[i];
+ QRgbaFloat32 s = src[i];
+
+ float da = d.alpha();
+ float sa = s.alpha();
+
+#define OP(a, b) overlay_op_rgbafp(a, b, da, sa)
+ float r = OP( d.red(), s.red());
+ float b = OP( d.blue(), s.blue());
+ float g = OP(d.green(), s.green());
+ float a = mix_alpha_rgbafp(da, sa);
+#undef OP
+
+ coverage.store(&dest[i], qRgbaFloat32(r, g, b, a));
+ }
+}
+
+void QT_FASTCALL comp_func_Overlay_rgbafp(QRgbaFloat32 *Q_DECL_RESTRICT dest, const QRgbaFloat32 *Q_DECL_RESTRICT src, int length, uint const_alpha)
+{
+ if (const_alpha == 255)
+ comp_func_Overlay_impl(dest, src, length, QFullCoverage());
+ else
+ comp_func_Overlay_impl(dest, src, length, QPartialCoverage(const_alpha));
+}
+#endif
+
/*
Dca' = min(Sca.Da, Dca.Sa) + Sca.(1 - Da) + Dca.(1 - Sa)
Da' = Sa + Da - Sa.Da
@@ -1578,7 +2116,7 @@ void QT_FASTCALL comp_func_solid_Darken(uint *dest, int length, uint color, uint
#if QT_CONFIG(raster_64bit)
static inline uint darken_op_rgb64(uint dst, uint src, uint da, uint sa)
{
- return qt_div_65535(qMin(src * da, dst * sa) + src * (65535 - da) + dst * (65535 - sa));
+ return qt_div_65535(qMin(src * da, dst * sa) + src * (65535U - da) + dst * (65535U - sa));
}
template <typename T>
@@ -1613,6 +2151,44 @@ void QT_FASTCALL comp_func_solid_Darken_rgb64(QRgba64 *dest, int length, QRgba64
}
#endif
+#if QT_CONFIG(raster_fp)
+static inline float darken_op_rgbafp(float dst, float src, float da, float sa)
+{
+ return qMin(src * da, dst * sa) + src * (1.0f - da) + dst * (1.0f - sa);
+}
+
+template <typename T>
+static inline void comp_func_solid_Darken_impl(QRgbaFloat32 *dest, int length, QRgbaFloat32 color, const T &coverage)
+{
+ float sa = color.alpha();
+ float sr = color.red();
+ float sg = color.green();
+ float sb = color.blue();
+
+ for (int i = 0; i < length; ++i) {
+ QRgbaFloat32 d = dest[i];
+ float da = d.alpha();
+
+#define OP(a, b) darken_op_rgbafp(a, b, da, sa)
+ float r = OP( d.red(), sr);
+ float b = OP( d.blue(), sb);
+ float g = OP(d.green(), sg);
+ float a = mix_alpha_rgbafp(da, sa);
+#undef OP
+
+ coverage.store(&dest[i], qRgbaFloat32(r, g, b, a));
+ }
+}
+
+void QT_FASTCALL comp_func_solid_Darken_rgbafp(QRgbaFloat32 *dest, int length, QRgbaFloat32 color, uint const_alpha)
+{
+ if (const_alpha == 255)
+ comp_func_solid_Darken_impl(dest, length, color, QFullCoverage());
+ else
+ comp_func_solid_Darken_impl(dest, length, color, QPartialCoverage(const_alpha));
+}
+#endif
+
template <typename T>
static inline void comp_func_Darken_impl(uint *Q_DECL_RESTRICT dest, const uint *Q_DECL_RESTRICT src, int length, const T &coverage)
{
@@ -1673,6 +2249,37 @@ void QT_FASTCALL comp_func_Darken_rgb64(QRgba64 *Q_DECL_RESTRICT dest, const QRg
}
#endif
+#if QT_CONFIG(raster_fp)
+template <typename T>
+static inline void comp_func_Darken_impl(QRgbaFloat32 *Q_DECL_RESTRICT dest, const QRgbaFloat32 *Q_DECL_RESTRICT src, int length, const T &coverage)
+{
+ for (int i = 0; i < length; ++i) {
+ QRgbaFloat32 d = dest[i];
+ QRgbaFloat32 s = src[i];
+
+ float da = d.alpha();
+ float sa = s.alpha();
+
+#define OP(a, b) darken_op_rgbafp(a, b, da, sa)
+ float r = OP( d.red(), s.red());
+ float b = OP( d.blue(), s.blue());
+ float g = OP(d.green(), s.green());
+ float a = mix_alpha_rgbafp(da, sa);
+#undef OP
+
+ coverage.store(&dest[i], qRgbaFloat32(r, g, b, a));
+ }
+}
+
+void QT_FASTCALL comp_func_Darken_rgbafp(QRgbaFloat32 *Q_DECL_RESTRICT dest, const QRgbaFloat32 *Q_DECL_RESTRICT src, int length, uint const_alpha)
+{
+ if (const_alpha == 255)
+ comp_func_Darken_impl(dest, src, length, QFullCoverage());
+ else
+ comp_func_Darken_impl(dest, src, length, QPartialCoverage(const_alpha));
+}
+#endif
+
/*
Dca' = max(Sca.Da, Dca.Sa) + Sca.(1 - Da) + Dca.(1 - Sa)
Da' = Sa + Da - Sa.Da
@@ -1717,7 +2324,7 @@ void QT_FASTCALL comp_func_solid_Lighten(uint *dest, int length, uint color, uin
#if QT_CONFIG(raster_64bit)
static inline uint lighten_op_rgb64(uint dst, uint src, uint da, uint sa)
{
- return qt_div_65535(qMax(src * da, dst * sa) + src * (65535 - da) + dst * (65535 - sa));
+ return qt_div_65535(qMax(src * da, dst * sa) + src * (65535U - da) + dst * (65535U - sa));
}
template <typename T>
@@ -1752,6 +2359,44 @@ void QT_FASTCALL comp_func_solid_Lighten_rgb64(QRgba64 *dest, int length, QRgba6
}
#endif
+#if QT_CONFIG(raster_fp)
+static inline float lighten_op_rgbafp(float dst, float src, float da, float sa)
+{
+ return qMax(src * da, dst * sa) + src * (1.0f - da) + dst * (1.0f - sa);
+}
+
+template <typename T>
+static inline void comp_func_solid_Lighten_impl(QRgbaFloat32 *dest, int length, QRgbaFloat32 color, const T &coverage)
+{
+ float sa = color.alpha();
+ float sr = color.red();
+ float sg = color.green();
+ float sb = color.blue();
+
+ for (int i = 0; i < length; ++i) {
+ QRgbaFloat32 d = dest[i];
+ float da = d.alpha();
+
+#define OP(a, b) lighten_op_rgbafp(a, b, da, sa)
+ float r = OP( d.red(), sr);
+ float b = OP( d.blue(), sb);
+ float g = OP(d.green(), sg);
+ float a = mix_alpha_rgbafp(da, sa);
+#undef OP
+
+ coverage.store(&dest[i], qRgbaFloat32(r, g, b, a));
+ }
+}
+
+void QT_FASTCALL comp_func_solid_Lighten_rgbafp(QRgbaFloat32 *dest, int length, QRgbaFloat32 color, uint const_alpha)
+{
+ if (const_alpha == 255)
+ comp_func_solid_Lighten_impl(dest, length, color, QFullCoverage());
+ else
+ comp_func_solid_Lighten_impl(dest, length, color, QPartialCoverage(const_alpha));
+}
+#endif
+
template <typename T>
static inline void comp_func_Lighten_impl(uint *Q_DECL_RESTRICT dest, const uint *Q_DECL_RESTRICT src, int length, const T &coverage)
{
@@ -1812,6 +2457,37 @@ void QT_FASTCALL comp_func_Lighten_rgb64(QRgba64 *Q_DECL_RESTRICT dest, const QR
}
#endif
+#if QT_CONFIG(raster_fp)
+template <typename T>
+static inline void comp_func_Lighten_impl(QRgbaFloat32 *Q_DECL_RESTRICT dest, const QRgbaFloat32 *Q_DECL_RESTRICT src, int length, const T &coverage)
+{
+ for (int i = 0; i < length; ++i) {
+ QRgbaFloat32 d = dest[i];
+ QRgbaFloat32 s = src[i];
+
+ float da = d.alpha();
+ float sa = s.alpha();
+
+#define OP(a, b) lighten_op_rgbafp(a, b, da, sa)
+ float r = OP( d.red(), s.red());
+ float b = OP( d.blue(), s.blue());
+ float g = OP(d.green(), s.green());
+ float a = mix_alpha_rgbafp(da, sa);
+#undef OP
+
+ coverage.store(&dest[i], qRgbaFloat32(r, g, b, a));
+ }
+}
+
+void QT_FASTCALL comp_func_Lighten_rgbafp(QRgbaFloat32 *Q_DECL_RESTRICT dest, const QRgbaFloat32 *Q_DECL_RESTRICT src, int length, uint const_alpha)
+{
+ if (const_alpha == 255)
+ comp_func_Lighten_impl(dest, src, length, QFullCoverage());
+ else
+ comp_func_Lighten_impl(dest, src, length, QPartialCoverage(const_alpha));
+}
+#endif
+
/*
if Sca.Da + Dca.Sa > Sa.Da
Dca' = Sa.Da + Sca.(1 - Da) + Dca.(1 - Sa)
@@ -1873,13 +2549,13 @@ static inline uint color_dodge_op_rgb64(qint64 dst, qint64 src, qint64 da, qint6
const qint64 dst_sa = dst * sa;
const qint64 src_da = src * da;
- const qint64 temp = src * (65535 - da) + dst * (65535 - sa);
+ const qint64 temp = src * (65535U - da) + dst * (65535U - sa);
if (src_da + dst_sa > sa_da)
return qt_div_65535(sa_da + temp);
else if (src == sa || sa == 0)
return qt_div_65535(temp);
else
- return qt_div_65535(65535 * dst_sa / (65535 - 65535 * src / sa) + temp);
+ return qt_div_65535(65535U * dst_sa / (65535U - 65535U * src / sa) + temp);
}
template <typename T>
@@ -1914,6 +2590,54 @@ void QT_FASTCALL comp_func_solid_ColorDodge_rgb64(QRgba64 *dest, int length, QRg
}
#endif
+#if QT_CONFIG(raster_fp)
+static inline float color_dodge_op_rgbafp(float dst, float src, float da, float sa)
+{
+ const float sa_da = sa * da;
+ const float dst_sa = dst * sa;
+ const float src_da = src * da;
+
+ const float temp = src * (1.0f - da) + dst * (1.0f - sa);
+ if (src_da + dst_sa > sa_da)
+ return sa_da + temp;
+ else if (src == sa || sa == 0.0f)
+ return temp;
+ else
+ return dst_sa / (1.0f - src / sa) + temp;
+}
+
+template <typename T>
+static inline void comp_func_solid_ColorDodge_impl(QRgbaFloat32 *dest, int length, QRgbaFloat32 color, const T &coverage)
+{
+ float sa = color.alpha();
+ float sr = color.red();
+ float sg = color.green();
+ float sb = color.blue();
+
+ for (int i = 0; i < length; ++i) {
+ QRgbaFloat32 d = dest[i];
+ float da = d.alpha();
+
+#define OP(a,b) color_dodge_op_rgbafp(a, b, da, sa)
+ float r = OP( d.red(), sr);
+ float b = OP( d.blue(), sb);
+ float g = OP(d.green(), sg);
+ float a = mix_alpha_rgbafp(da, sa);
+#undef OP
+
+ coverage.store(&dest[i], qRgbaFloat32(r, g, b, a));
+ }
+}
+
+void QT_FASTCALL comp_func_solid_ColorDodge_rgbafp(QRgbaFloat32 *dest, int length, QRgbaFloat32 color, uint const_alpha)
+{
+ if (const_alpha == 255)
+ comp_func_solid_ColorDodge_impl(dest, length, color, QFullCoverage());
+ else
+ comp_func_solid_ColorDodge_impl(dest, length, color, QPartialCoverage(const_alpha));
+}
+#endif
+
template <typename T>
static inline void comp_func_ColorDodge_impl(uint *Q_DECL_RESTRICT dest, const uint *Q_DECL_RESTRICT src, int length, const T &coverage)
{
@@ -1974,6 +2698,37 @@ void QT_FASTCALL comp_func_ColorDodge_rgb64(QRgba64 *Q_DECL_RESTRICT dest, const
}
#endif
+#if QT_CONFIG(raster_fp)
+template <typename T>
+static inline void comp_func_ColorDodge_impl(QRgbaFloat32 *Q_DECL_RESTRICT dest, const QRgbaFloat32 *Q_DECL_RESTRICT src, int length, const T &coverage)
+{
+ for (int i = 0; i < length; ++i) {
+ QRgbaFloat32 d = dest[i];
+ QRgbaFloat32 s = src[i];
+
+ float da = d.alpha();
+ float sa = s.alpha();
+
+#define OP(a, b) color_dodge_op_rgbafp(a, b, da, sa)
+ float r = OP( d.red(), s.red());
+ float b = OP( d.blue(), s.blue());
+ float g = OP(d.green(), s.green());
+ float a = mix_alpha_rgbafp(da, sa);
+#undef OP
+
+ coverage.store(&dest[i], qRgbaFloat32(r, g, b, a));
+ }
+}
+
+void QT_FASTCALL comp_func_ColorDodge_rgbafp(QRgbaFloat32 *Q_DECL_RESTRICT dest, const QRgbaFloat32 *Q_DECL_RESTRICT src, int length, uint const_alpha)
+{
+ if (const_alpha == 255)
+ comp_func_ColorDodge_impl(dest, src, length, QFullCoverage());
+ else
+ comp_func_ColorDodge_impl(dest, src, length, QPartialCoverage(const_alpha));
+}
+#endif
+
/*
if Sca.Da + Dca.Sa < Sa.Da
Dca' = Sca.(1 - Da) + Dca.(1 - Sa)
@@ -2035,7 +2790,7 @@ static inline uint color_burn_op_rgb64(qint64 dst, qint64 src, qint64 da, qint64
const qint64 dst_sa = dst * sa;
const qint64 sa_da = sa * da;
- const qint64 temp = src * (65535 - da) + dst * (65535 - sa);
+ const qint64 temp = src * (65535U - da) + dst * (65535U - sa);
if (src_da + dst_sa < sa_da)
return qt_div_65535(temp);
@@ -2076,6 +2831,54 @@ void QT_FASTCALL comp_func_solid_ColorBurn_rgb64(QRgba64 *dest, int length, QRgb
}
#endif
+#if QT_CONFIG(raster_fp)
+static inline float color_burn_op_rgbafp(float dst, float src, float da, float sa)
+{
+ const float src_da = src * da;
+ const float dst_sa = dst * sa;
+ const float sa_da = sa * da;
+
+ const float temp = src * (1.0f - da) + dst * (1.0f - sa);
+
+ if (src_da + dst_sa < sa_da)
+ return temp;
+ else if (src == 0)
+ return dst_sa + temp;
+ return sa * (src_da + dst_sa - sa_da) / src + temp;
+}
+
+template <typename T>
+static inline void comp_func_solid_ColorBurn_impl(QRgbaFloat32 *dest, int length, QRgbaFloat32 color, const T &coverage)
+{
+ float sa = color.alpha();
+ float sr = color.red();
+ float sg = color.green();
+ float sb = color.blue();
+
+ for (int i = 0; i < length; ++i) {
+ QRgbaFloat32 d = dest[i];
+ float da = d.alpha();
+
+#define OP(a, b) color_burn_op_rgbafp(a, b, da, sa)
+ float r = OP( d.red(), sr);
+ float b = OP( d.blue(), sb);
+ float g = OP(d.green(), sg);
+ float a = mix_alpha_rgbafp(da, sa);
+#undef OP
+
+ coverage.store(&dest[i], qRgbaFloat32(r, g, b, a));
+ }
+}
+
+void QT_FASTCALL comp_func_solid_ColorBurn_rgbafp(QRgbaFloat32 *dest, int length, QRgbaFloat32 color, uint const_alpha)
+{
+ if (const_alpha == 255)
+ comp_func_solid_ColorBurn_impl(dest, length, color, QFullCoverage());
+ else
+ comp_func_solid_ColorBurn_impl(dest, length, color, QPartialCoverage(const_alpha));
+}
+#endif
+
template <typename T>
static inline void comp_func_ColorBurn_impl(uint *Q_DECL_RESTRICT dest, const uint *Q_DECL_RESTRICT src, int length, const T &coverage)
{
@@ -2136,6 +2939,37 @@ void QT_FASTCALL comp_func_ColorBurn_rgb64(QRgba64 *Q_DECL_RESTRICT dest, const
}
#endif
+#if QT_CONFIG(raster_fp)
+template <typename T>
+static inline void comp_func_ColorBurn_impl(QRgbaFloat32 *Q_DECL_RESTRICT dest, const QRgbaFloat32 *Q_DECL_RESTRICT src, int length, const T &coverage)
+{
+ for (int i = 0; i < length; ++i) {
+ QRgbaFloat32 d = dest[i];
+ QRgbaFloat32 s = src[i];
+
+ float da = d.alpha();
+ float sa = s.alpha();
+
+#define OP(a, b) color_burn_op_rgbafp(a, b, da, sa)
+ float r = OP( d.red(), s.red());
+ float b = OP( d.blue(), s.blue());
+ float g = OP(d.green(), s.green());
+ float a = mix_alpha_rgbafp(da, sa);
+#undef OP
+
+ coverage.store(&dest[i], qRgbaFloat32(r, g, b, a));
+ }
+}
+
+void QT_FASTCALL comp_func_ColorBurn_rgbafp(QRgbaFloat32 *Q_DECL_RESTRICT dest, const QRgbaFloat32 *Q_DECL_RESTRICT src, int length, uint const_alpha)
+{
+ if (const_alpha == 255)
+ comp_func_ColorBurn_impl(dest, src, length, QFullCoverage());
+ else
+ comp_func_ColorBurn_impl(dest, src, length, QPartialCoverage(const_alpha));
+}
+#endif
+
/*
if 2.Sca < Sa
Dca' = 2.Sca.Dca + Sca.(1 - Da) + Dca.(1 - Sa)
@@ -2186,7 +3020,7 @@ void QT_FASTCALL comp_func_solid_HardLight(uint *dest, int length, uint color, u
#if QT_CONFIG(raster_64bit)
static inline uint hardlight_op_rgb64(uint dst, uint src, uint da, uint sa)
{
- const uint temp = src * (65535 - da) + dst * (65535 - sa);
+ const uint temp = src * (65535U - da) + dst * (65535U - sa);
if (2 * src < sa)
return qt_div_65535(2 * src * dst + temp);
@@ -2226,6 +3060,49 @@ void QT_FASTCALL comp_func_solid_HardLight_rgb64(QRgba64 *dest, int length, QRgb
}
#endif
+#if QT_CONFIG(raster_fp)
+static inline float hardlight_op_rgbafp(float dst, float src, float da, float sa)
+{
+ const float temp = src * (1.0f - da) + dst * (1.0f - sa);
+
+ if (2 * src < sa)
+ return 2 * src * dst + temp;
+ else
+ return sa * da - 2 * (da - dst) * (sa - src) + temp;
+}
+
+template <typename T>
+static inline void comp_func_solid_HardLight_impl(QRgbaFloat32 *dest, int length, QRgbaFloat32 color, const T &coverage)
+{
+ float sa = color.alpha();
+ float sr = color.red();
+ float sg = color.green();
+ float sb = color.blue();
+
+ for (int i = 0; i < length; ++i) {
+ QRgbaFloat32 d = dest[i];
+ float da = d.alpha();
+
+#define OP(a, b) hardlight_op_rgbafp(a, b, da, sa)
+ float r = OP( d.red(), sr);
+ float b = OP( d.blue(), sb);
+ float g = OP(d.green(), sg);
+ float a = mix_alpha_rgbafp(da, sa);
+#undef OP
+
+ coverage.store(&dest[i], qRgbaFloat32(r, g, b, a));
+ }
+}
+
+void QT_FASTCALL comp_func_solid_HardLight_rgbafp(QRgbaFloat32 *dest, int length, QRgbaFloat32 color, uint const_alpha)
+{
+ if (const_alpha == 255)
+ comp_func_solid_HardLight_impl(dest, length, color, QFullCoverage());
+ else
+ comp_func_solid_HardLight_impl(dest, length, color, QPartialCoverage(const_alpha));
+}
+#endif
+
template <typename T>
static inline void comp_func_HardLight_impl(uint *Q_DECL_RESTRICT dest, const uint *Q_DECL_RESTRICT src, int length, const T &coverage)
{
@@ -2286,6 +3163,37 @@ void QT_FASTCALL comp_func_HardLight_rgb64(QRgba64 *Q_DECL_RESTRICT dest, const
}
#endif
+#if QT_CONFIG(raster_fp)
+template <typename T>
+static inline void comp_func_HardLight_impl(QRgbaFloat32 *Q_DECL_RESTRICT dest, const QRgbaFloat32 *Q_DECL_RESTRICT src, int length, const T &coverage)
+{
+ for (int i = 0; i < length; ++i) {
+ QRgbaFloat32 d = dest[i];
+ QRgbaFloat32 s = src[i];
+
+ float da = d.alpha();
+ float sa = s.alpha();
+
+#define OP(a, b) hardlight_op_rgbafp(a, b, da, sa)
+ float r = OP( d.red(), s.red());
+ float b = OP( d.blue(), s.blue());
+ float g = OP(d.green(), s.green());
+ float a = mix_alpha_rgbafp(da, sa);
+#undef OP
+
+ coverage.store(&dest[i], qRgbaFloat32(r, g, b, a));
+ }
+}
+
+void QT_FASTCALL comp_func_HardLight_rgbafp(QRgbaFloat32 *Q_DECL_RESTRICT dest, const QRgbaFloat32 *Q_DECL_RESTRICT src, int length, uint const_alpha)
+{
+ if (const_alpha == 255)
+ comp_func_HardLight_impl(dest, src, length, QFullCoverage());
+ else
+ comp_func_HardLight_impl(dest, src, length, QPartialCoverage(const_alpha));
+}
+#endif
+
/*
if 2.Sca <= Sa
Dca' = Dca.(Sa + (2.Sca - Sa).(1 - Dca/Da)) + Sca.(1 - Da) + Dca.(1 - Sa)
@@ -2332,20 +3240,28 @@ static inline void comp_func_solid_SoftLight_impl(uint *dest, int length, uint c
}
}
+void QT_FASTCALL comp_func_solid_SoftLight(uint *dest, int length, uint color, uint const_alpha)
+{
+ if (const_alpha == 255)
+ comp_func_solid_SoftLight_impl(dest, length, color, QFullCoverage());
+ else
+ comp_func_solid_SoftLight_impl(dest, length, color, QPartialCoverage(const_alpha));
+}
+
#if QT_CONFIG(raster_64bit)
static inline uint soft_light_op_rgb64(qint64 dst, qint64 src, qint64 da, qint64 sa)
{
const qint64 src2 = src << 1;
- const qint64 dst_np = da != 0 ? (65535 * dst) / da : 0;
- const qint64 temp = (src * (65535 - da) + dst * (65535 - sa)) * 65535;
- const qint64 factor = qint64(65535) * 65535;
+ const qint64 dst_np = da != 0 ? (65535U * dst) / da : 0;
+ const qint64 temp = (src * (65535U - da) + dst * (65535U - sa)) * 65535U;
+ const qint64 factor = Q_UINT64_C(65535) * 65535U;
if (src2 < sa)
- return (dst * (sa * 65535 + (src2 - sa) * (65535 - dst_np)) + temp) / factor;
+ return (dst * (sa * 65535U + (src2 - sa) * (65535U - dst_np)) + temp) / factor;
else if (4 * dst <= da)
- return (dst * sa * 65535 + da * (src2 - sa) * ((((16 * dst_np - 12 * 65535) * dst_np + 3 * factor) * dst_np) / factor) + temp) / factor;
+ return (dst * sa * 65535U + da * (src2 - sa) * ((((16 * dst_np - 12 * 65535U) * dst_np + 3 * factor) * dst_np) / factor) + temp) / factor;
else {
- return (dst * sa * 65535 + da * (src2 - sa) * (int(qSqrt(qreal(dst_np * 65535))) - dst_np) + temp) / factor;
+ return (dst * sa * 65535U + da * (src2 - sa) * (int(qSqrt(qreal(dst_np * 65535U))) - dst_np) + temp) / factor;
}
}
@@ -2371,15 +3287,64 @@ static inline void comp_func_solid_SoftLight_impl(QRgba64 *dest, int length, QRg
coverage.store(&dest[i], qRgba64(r, g, b, a));
}
}
+
+void QT_FASTCALL comp_func_solid_SoftLight_rgb64(QRgba64 *dest, int length, QRgba64 color, uint const_alpha)
+{
+ if (const_alpha == 255)
+ comp_func_solid_SoftLight_impl(dest, length, color, QFullCoverage());
+ else
+ comp_func_solid_SoftLight_impl(dest, length, color, QPartialCoverage(const_alpha));
+}
+
#endif
-void QT_FASTCALL comp_func_solid_SoftLight(uint *dest, int length, uint color, uint const_alpha)
+#if QT_CONFIG(raster_fp)
+static inline float soft_light_op_rgbafp(float dst, float src, float da, float sa)
+{
+ const float src2 = src * 2;
+ const float dst_np = da != 0.0f ? (dst / da) : 0.0f;
+ const float temp = src * (1.0f - da) + dst * (1.0f - sa);
+
+ if (src2 < sa)
+ return dst * (sa + (src2 - sa) * (1.0f - dst_np)) + temp;
+ else if (4 * dst <= da)
+ return dst * sa + da * (src2 - sa) * (((16 * dst_np - 12) * dst_np + 3) * dst_np) + temp;
+ else {
+ return dst * sa + da * (src2 - sa) * (qSqrt(qreal(dst_np)) - dst_np) + temp;
+ }
+}
+
+template <typename T>
+static inline void comp_func_solid_SoftLight_impl(QRgbaFloat32 *dest, int length, QRgbaFloat32 color, const T &coverage)
+{
+ float sa = color.alpha();
+ float sr = color.red();
+ float sg = color.green();
+ float sb = color.blue();
+
+ for (int i = 0; i < length; ++i) {
+ QRgbaFloat32 d = dest[i];
+ float da = d.alpha();
+
+#define OP(a, b) soft_light_op_rgbafp(a, b, da, sa)
+ float r = OP( d.red(), sr);
+ float b = OP( d.blue(), sb);
+ float g = OP(d.green(), sg);
+ float a = mix_alpha_rgbafp(da, sa);
+#undef OP
+
+ coverage.store(&dest[i], qRgbaFloat32(r, g, b, a));
+ }
+}
+
+void QT_FASTCALL comp_func_solid_SoftLight_rgbafp(QRgbaFloat32 *dest, int length, QRgbaFloat32 color, uint const_alpha)
{
if (const_alpha == 255)
comp_func_solid_SoftLight_impl(dest, length, color, QFullCoverage());
else
comp_func_solid_SoftLight_impl(dest, length, color, QPartialCoverage(const_alpha));
}
+#endif
template <typename T>
static inline void comp_func_SoftLight_impl(uint *Q_DECL_RESTRICT dest, const uint *Q_DECL_RESTRICT src, int length, const T &coverage)
@@ -2411,14 +3376,6 @@ void QT_FASTCALL comp_func_SoftLight(uint *Q_DECL_RESTRICT dest, const uint *Q_D
}
#if QT_CONFIG(raster_64bit)
-void QT_FASTCALL comp_func_solid_SoftLight_rgb64(QRgba64 *dest, int length, QRgba64 color, uint const_alpha)
-{
- if (const_alpha == 255)
- comp_func_solid_SoftLight_impl(dest, length, color, QFullCoverage());
- else
- comp_func_solid_SoftLight_impl(dest, length, color, QPartialCoverage(const_alpha));
-}
-
template <typename T>
static inline void comp_func_SoftLight_impl(QRgba64 *Q_DECL_RESTRICT dest, const QRgba64 *Q_DECL_RESTRICT src, int length, const T &coverage)
{
@@ -2449,6 +3406,37 @@ void QT_FASTCALL comp_func_SoftLight_rgb64(QRgba64 *Q_DECL_RESTRICT dest, const
}
#endif
+#if QT_CONFIG(raster_fp)
+template <typename T>
+static inline void comp_func_SoftLight_impl(QRgbaFloat32 *Q_DECL_RESTRICT dest, const QRgbaFloat32 *Q_DECL_RESTRICT src, int length, const T &coverage)
+{
+ for (int i = 0; i < length; ++i) {
+ QRgbaFloat32 d = dest[i];
+ QRgbaFloat32 s = src[i];
+
+ float da = d.alpha();
+ float sa = s.alpha();
+
+#define OP(a, b) soft_light_op_rgbafp(a, b, da, sa)
+ float r = OP( d.red(), s.red());
+ float b = OP( d.blue(), s.blue());
+ float g = OP(d.green(), s.green());
+ float a = mix_alpha_rgbafp(da, sa);
+#undef OP
+
+ coverage.store(&dest[i], qRgbaFloat32(r, g, b, a));
+ }
+}
+
+void QT_FASTCALL comp_func_SoftLight_rgbafp(QRgbaFloat32 *Q_DECL_RESTRICT dest, const QRgbaFloat32 *Q_DECL_RESTRICT src, int length, uint const_alpha)
+{
+ if (const_alpha == 255)
+ comp_func_SoftLight_impl(dest, src, length, QFullCoverage());
+ else
+ comp_func_SoftLight_impl(dest, src, length, QPartialCoverage(const_alpha));
+}
+#endif
+
/*
Dca' = abs(Dca.Sa - Sca.Da) + Sca.(1 - Da) + Dca.(1 - Sa)
= Sca + Dca - 2.min(Sca.Da, Dca.Sa)
@@ -2527,6 +3515,44 @@ void QT_FASTCALL comp_func_solid_Difference_rgb64(QRgba64 *dest, int length, QRg
}
#endif
+#if QT_CONFIG(raster_fp)
+static inline float difference_op_rgbafp(float dst, float src, float da, float sa)
+{
+ return src + dst - (2 * qMin(src * da, dst * sa));
+}
+
+template <typename T>
+static inline void comp_func_solid_Difference_impl(QRgbaFloat32 *dest, int length, QRgbaFloat32 color, const T &coverage)
+{
+ float sa = color.alpha();
+ float sr = color.red();
+ float sg = color.green();
+ float sb = color.blue();
+
+ for (int i = 0; i < length; ++i) {
+ QRgbaFloat32 d = dest[i];
+ float da = d.alpha();
+
+#define OP(a, b) difference_op_rgbafp(a, b, da, sa)
+ float r = OP( d.red(), sr);
+ float b = OP( d.blue(), sb);
+ float g = OP(d.green(), sg);
+ float a = mix_alpha_rgbafp(da, sa);
+#undef OP
+
+ coverage.store(&dest[i], qRgbaFloat32(r, g, b, a));
+ }
+}
+
+void QT_FASTCALL comp_func_solid_Difference_rgbafp(QRgbaFloat32 *dest, int length, QRgbaFloat32 color, uint const_alpha)
+{
+ if (const_alpha == 255)
+ comp_func_solid_Difference_impl(dest, length, color, QFullCoverage());
+ else
+ comp_func_solid_Difference_impl(dest, length, color, QPartialCoverage(const_alpha));
+}
+#endif
+
template <typename T>
static inline void comp_func_Difference_impl(uint *Q_DECL_RESTRICT dest, const uint *Q_DECL_RESTRICT src, int length, const T &coverage)
{
@@ -2587,6 +3613,37 @@ void QT_FASTCALL comp_func_Difference_rgb64(QRgba64 *Q_DECL_RESTRICT dest, const
}
#endif
+#if QT_CONFIG(raster_fp)
+template <typename T>
+static inline void comp_func_Difference_impl(QRgbaFloat32 *Q_DECL_RESTRICT dest, const QRgbaFloat32 *Q_DECL_RESTRICT src, int length, const T &coverage)
+{
+ for (int i = 0; i < length; ++i) {
+ QRgbaFloat32 d = dest[i];
+ QRgbaFloat32 s = src[i];
+
+ float da = d.alpha();
+ float sa = s.alpha();
+
+#define OP(a, b) difference_op_rgbafp(a, b, da, sa)
+ float r = OP( d.red(), s.red());
+ float b = OP( d.blue(), s.blue());
+ float g = OP(d.green(), s.green());
+ float a = mix_alpha_rgbafp(da, sa);
+#undef OP
+
+ coverage.store(&dest[i], qRgbaFloat32(r, g, b, a));
+ }
+}
+
+void QT_FASTCALL comp_func_Difference_rgbafp(QRgbaFloat32 *Q_DECL_RESTRICT dest, const QRgbaFloat32 *Q_DECL_RESTRICT src, int length, uint const_alpha)
+{
+ if (const_alpha == 255)
+ comp_func_Difference_impl(dest, src, length, QFullCoverage());
+ else
+ comp_func_Difference_impl(dest, src, length, QPartialCoverage(const_alpha));
+}
+#endif
+
/*
Dca' = (Sca.Da + Dca.Sa - 2.Sca.Dca) + Sca.(1 - Da) + Dca.(1 - Sa)
*/
@@ -2645,7 +3702,6 @@ static inline void QT_FASTCALL comp_func_solid_Exclusion_impl(QRgba64 *dest, int
}
}
-
void QT_FASTCALL comp_func_solid_Exclusion_rgb64(QRgba64 *dest, int length, QRgba64 color, uint const_alpha)
{
if (const_alpha == 255)
@@ -2655,6 +3711,39 @@ void QT_FASTCALL comp_func_solid_Exclusion_rgb64(QRgba64 *dest, int length, QRgb
}
#endif
+#if QT_CONFIG(raster_fp)
+template <typename T>
+static inline void QT_FASTCALL comp_func_solid_Exclusion_impl(QRgbaFloat32 *dest, int length, QRgbaFloat32 color, const T &coverage)
+{
+ float sa = color.alpha();
+ float sr = color.red();
+ float sg = color.green();
+ float sb = color.blue();
+
+ for (int i = 0; i < length; ++i) {
+ QRgbaFloat32 d = dest[i];
+ float da = d.alpha();
+
+#define OP(a, b) (a + b - (2.0f * a * b))
+ float r = OP( d.red(), sr);
+ float b = OP( d.blue(), sb);
+ float g = OP(d.green(), sg);
+ float a = mix_alpha_rgbafp(da, sa);
+#undef OP
+
+ coverage.store(&dest[i], qRgbaFloat32(r, g, b, a));
+ }
+}
+
+void QT_FASTCALL comp_func_solid_Exclusion_rgbafp(QRgbaFloat32 *dest, int length, QRgbaFloat32 color, uint const_alpha)
+{
+ if (const_alpha == 255)
+ comp_func_solid_Exclusion_impl(dest, length, color, QFullCoverage());
+ else
+ comp_func_solid_Exclusion_impl(dest, length, color, QPartialCoverage(const_alpha));
+}
+#endif
+
template <typename T>
static inline void comp_func_Exclusion_impl(uint *Q_DECL_RESTRICT dest, const uint *Q_DECL_RESTRICT src, int length, const T &coverage)
{
@@ -2715,6 +3804,37 @@ void QT_FASTCALL comp_func_Exclusion_rgb64(QRgba64 *Q_DECL_RESTRICT dest, const
}
#endif
+#if QT_CONFIG(raster_fp)
+template <typename T>
+static inline void comp_func_Exclusion_impl(QRgbaFloat32 *Q_DECL_RESTRICT dest, const QRgbaFloat32 *Q_DECL_RESTRICT src, int length, const T &coverage)
+{
+ for (int i = 0; i < length; ++i) {
+ QRgbaFloat32 d = dest[i];
+ QRgbaFloat32 s = src[i];
+
+ float da = d.alpha();
+ float sa = s.alpha();
+
+#define OP(a, b) (a + b - (2.0f * a * b))
+ float r = OP( d.red(), s.red());
+ float b = OP( d.blue(), s.blue());
+ float g = OP(d.green(), s.green());
+ float a = mix_alpha_rgbafp(da, sa);
+#undef OP
+
+ coverage.store(&dest[i], qRgbaFloat32(r, g, b, a));
+ }
+}
+
+void QT_FASTCALL comp_func_Exclusion_rgbafp(QRgbaFloat32 *Q_DECL_RESTRICT dest, const QRgbaFloat32 *Q_DECL_RESTRICT src, int length, uint const_alpha)
+{
+ if (const_alpha == 255)
+ comp_func_Exclusion_impl(dest, src, length, QFullCoverage());
+ else
+ comp_func_Exclusion_impl(dest, src, length, QPartialCoverage(const_alpha));
+}
+#endif
+
void QT_FASTCALL rasterop_solid_SourceOrDestination(uint *dest,
int length,
uint color,
@@ -3089,6 +4209,41 @@ CompositionFunctionSolid64 qt_functionForModeSolid64_C[] = {
comp_func_solid_Difference_rgb64,
comp_func_solid_Exclusion_rgb64,
#else
+ nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr,
+ nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr,
+ nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr,
+#endif
+ nullptr, nullptr, nullptr, nullptr, nullptr, nullptr,
+ nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr
+};
+
+CompositionFunctionSolidFP qt_functionForModeSolidFP_C[] = {
+#if QT_CONFIG(raster_fp)
+ comp_func_solid_SourceOver_rgbafp,
+ comp_func_solid_DestinationOver_rgbafp,
+ comp_func_solid_Clear_rgbafp,
+ comp_func_solid_Source_rgbafp,
+ comp_func_solid_Destination_rgbafp,
+ comp_func_solid_SourceIn_rgbafp,
+ comp_func_solid_DestinationIn_rgbafp,
+ comp_func_solid_SourceOut_rgbafp,
+ comp_func_solid_DestinationOut_rgbafp,
+ comp_func_solid_SourceAtop_rgbafp,
+ comp_func_solid_DestinationAtop_rgbafp,
+ comp_func_solid_XOR_rgbafp,
+ comp_func_solid_Plus_rgbafp,
+ comp_func_solid_Multiply_rgbafp,
+ comp_func_solid_Screen_rgbafp,
+ comp_func_solid_Overlay_rgbafp,
+ comp_func_solid_Darken_rgbafp,
+ comp_func_solid_Lighten_rgbafp,
+ comp_func_solid_ColorDodge_rgbafp,
+ comp_func_solid_ColorBurn_rgbafp,
+ comp_func_solid_HardLight_rgbafp,
+ comp_func_solid_SoftLight_rgbafp,
+ comp_func_solid_Difference_rgbafp,
+ comp_func_solid_Exclusion_rgbafp,
+#else
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
#endif
@@ -3164,6 +4319,41 @@ CompositionFunction64 qt_functionForMode64_C[] = {
comp_func_Difference_rgb64,
comp_func_Exclusion_rgb64,
#else
+ nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr,
+ nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr,
+ nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr,
+#endif
+ nullptr, nullptr, nullptr, nullptr, nullptr, nullptr,
+ nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr
+};
+
+CompositionFunctionFP qt_functionForModeFP_C[] = {
+#if QT_CONFIG(raster_fp)
+ comp_func_SourceOver_rgbafp,
+ comp_func_DestinationOver_rgbafp,
+ comp_func_Clear_rgbafp,
+ comp_func_Source_rgbafp,
+ comp_func_Destination_rgbafp,
+ comp_func_SourceIn_rgbafp,
+ comp_func_DestinationIn_rgbafp,
+ comp_func_SourceOut_rgbafp,
+ comp_func_DestinationOut_rgbafp,
+ comp_func_SourceAtop_rgbafp,
+ comp_func_DestinationAtop_rgbafp,
+ comp_func_XOR_rgbafp,
+ comp_func_Plus_rgbafp,
+ comp_func_Multiply_rgbafp,
+ comp_func_Screen_rgbafp,
+ comp_func_Overlay_rgbafp,
+ comp_func_Darken_rgbafp,
+ comp_func_Lighten_rgbafp,
+ comp_func_ColorDodge_rgbafp,
+ comp_func_ColorBurn_rgbafp,
+ comp_func_HardLight_rgbafp,
+ comp_func_SoftLight_rgbafp,
+ comp_func_Difference_rgbafp,
+ comp_func_Exclusion_rgbafp,
+#else
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
#endif
diff --git a/src/gui/painting/qcoregraphics.mm b/src/gui/painting/qcoregraphics.mm
index e2497eaadb..27b46202f5 100644
--- a/src/gui/painting/qcoregraphics.mm
+++ b/src/gui/painting/qcoregraphics.mm
@@ -1,41 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2017 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the QtGui module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2017 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#include "qcoregraphics_p.h"
@@ -47,6 +11,8 @@
#include <QtCore/qcoreapplication.h>
#include <QtCore/qoperatingsystemversion.h>
+QT_USE_NAMESPACE
+
QT_BEGIN_NAMESPACE
// ---------------------- Images ----------------------
@@ -56,22 +22,22 @@ CGBitmapInfo qt_mac_bitmapInfoForImage(const QImage &image)
CGBitmapInfo bitmapInfo = kCGImageAlphaNone;
switch (image.format()) {
case QImage::Format_ARGB32:
- bitmapInfo = kCGImageAlphaFirst | kCGBitmapByteOrder32Host;
+ bitmapInfo = CGBitmapInfo(kCGImageAlphaFirst) | kCGBitmapByteOrder32Host;
break;
case QImage::Format_RGB32:
- bitmapInfo = kCGImageAlphaNoneSkipFirst | kCGBitmapByteOrder32Host;
+ bitmapInfo = CGBitmapInfo(kCGImageAlphaNoneSkipFirst) | kCGBitmapByteOrder32Host;
break;
case QImage::Format_RGBA8888_Premultiplied:
- bitmapInfo = kCGImageAlphaPremultipliedLast | kCGBitmapByteOrder32Big;
+ bitmapInfo = CGBitmapInfo(kCGImageAlphaPremultipliedLast) | kCGBitmapByteOrder32Big;
break;
case QImage::Format_RGBA8888:
- bitmapInfo = kCGImageAlphaLast | kCGBitmapByteOrder32Big;
+ bitmapInfo = CGBitmapInfo(kCGImageAlphaLast) | kCGBitmapByteOrder32Big;
break;
case QImage::Format_RGBX8888:
- bitmapInfo = kCGImageAlphaNoneSkipLast | kCGBitmapByteOrder32Big;
+ bitmapInfo = CGBitmapInfo(kCGImageAlphaNoneSkipLast) | kCGBitmapByteOrder32Big;
break;
case QImage::Format_ARGB32_Premultiplied:
- bitmapInfo = kCGImageAlphaPremultipliedFirst | kCGBitmapByteOrder32Host;
+ bitmapInfo = CGBitmapInfo(kCGImageAlphaPremultipliedFirst) | kCGBitmapByteOrder32Host;
break;
default: break;
}
@@ -124,49 +90,81 @@ QImage qt_mac_toQImage(CGImageRef image)
#ifdef Q_OS_MACOS
-static NSImage *qt_mac_cgimage_to_nsimage(CGImageRef image)
+QT_END_NAMESPACE
+
+@implementation NSImage (QtExtras)
++ (instancetype)imageFromQImage:(const QImage &)image
{
- NSImage *newImage = [[NSImage alloc] initWithCGImage:image size:NSZeroSize];
- return newImage;
+ if (image.isNull())
+ return nil;
+
+ QCFType<CGImageRef> cgImage = image.toCGImage();
+ if (!cgImage)
+ return nil;
+
+ // We set up the NSImage using an explicit NSBitmapImageRep, instead of
+ // [NSImage initWithCGImage:size:], as the former allows us to correctly
+ // set the size of the representation to account for the device pixel
+ // ratio of the original image, which in turn will be reflected by the
+ // NSImage.
+ auto nsImage = [[NSImage alloc] initWithSize:NSZeroSize];
+ auto *imageRep = [[NSBitmapImageRep alloc] initWithCGImage:cgImage];
+ imageRep.size = image.deviceIndependentSize().toCGSize();
+ [nsImage addRepresentation:[imageRep autorelease]];
+ Q_ASSERT(CGSizeEqualToSize(nsImage.size, imageRep.size));
+
+ return [nsImage autorelease];
}
-NSImage *qt_mac_create_nsimage(const QPixmap &pm)
++ (instancetype)imageFromQIcon:(const QIcon &)icon
{
- if (pm.isNull())
- return 0;
- QImage image = pm.toImage();
- CGImageRef cgImage = qt_mac_toCGImage(image);
- NSImage *nsImage = qt_mac_cgimage_to_nsimage(cgImage);
- nsImage.size = (pm.size() / pm.devicePixelRatioF()).toCGSize();
- CGImageRelease(cgImage);
- return nsImage;
+ return [NSImage imageFromQIcon:icon withSize:0];
}
-NSImage *qt_mac_create_nsimage(const QIcon &icon, int defaultSize)
++ (instancetype)imageFromQIcon:(const QIcon &)icon withSize:(int)size
{
if (icon.isNull())
return nil;
- NSImage *nsImage = [[NSImage alloc] init];
- QList<QSize> availableSizes = icon.availableSizes();
- if (availableSizes.isEmpty() && defaultSize > 0)
- availableSizes << QSize(defaultSize, defaultSize);
- for (QSize size : qAsConst(availableSizes)) {
- QPixmap pm = icon.pixmap(size);
- if (pm.isNull())
+ auto availableSizes = icon.availableSizes();
+ if (availableSizes.isEmpty() && size > 0)
+ availableSizes << QSize(size, size);
+
+ auto nsImage = [[[NSImage alloc] initWithSize:NSZeroSize] autorelease];
+
+ for (QSize size : std::as_const(availableSizes)) {
+ QImage image = icon.pixmap(size).toImage();
+ if (image.isNull())
continue;
- QImage image = pm.toImage();
- CGImageRef cgImage = qt_mac_toCGImage(image);
- NSBitmapImageRep *imageRep = [[NSBitmapImageRep alloc] initWithCGImage:cgImage];
- [nsImage addRepresentation:imageRep];
- [imageRep release];
- CGImageRelease(cgImage);
+
+ QCFType<CGImageRef> cgImage = image.toCGImage();
+ if (!cgImage)
+ continue;
+
+ auto *imageRep = [[NSBitmapImageRep alloc] initWithCGImage:cgImage];
+ imageRep.size = image.deviceIndependentSize().toCGSize();
+ [nsImage addRepresentation:[imageRep autorelease]];
}
+
+ if (!nsImage.representations.count)
+ return nil;
+
+ [nsImage setTemplate:icon.isMask()];
+
+ if (size)
+ nsImage.size = CGSizeMake(size, size);
+
return nsImage;
}
+@end
+
+QT_BEGIN_NAMESPACE
QPixmap qt_mac_toQPixmap(const NSImage *image, const QSizeF &size)
{
+ // ### TODO: add parameter so that we can decide whether to maintain the aspect
+ // ratio of the image (positioning the image inside the pixmap of size \a size),
+ // or whether we want to fill the resulting pixmap by stretching the image.
const NSSize pixmapSize = NSMakeSize(size.width(), size.height());
QPixmap pixmap(pixmapSize.width, pixmapSize.height);
pixmap.fill(Qt::transparent);
@@ -187,6 +185,25 @@ QPixmap qt_mac_toQPixmap(const NSImage *image, const QSizeF &size)
#endif // Q_OS_MACOS
+#ifdef QT_PLATFORM_UIKIT
+
+QImage qt_mac_toQImage(const UIImage *image, QSizeF size)
+{
+ // ### TODO: same as above
+ QImage ret(size.width(), size.height(), QImage::Format_ARGB32_Premultiplied);
+ ret.fill(Qt::transparent);
+ QMacCGContext ctx(&ret);
+ if (!ctx)
+ return QImage();
+ UIGraphicsPushContext(ctx);
+ const CGRect rect = CGRectMake(0, 0, size.width(), size.height());
+ [image drawInRect:rect];
+ UIGraphicsPopContext();
+ return ret;
+}
+
+#endif // QT_PLATFORM_UIKIT
+
// ---------------------- Colors and Brushes ----------------------
QColor qt_mac_toQColor(CGColorRef color)
@@ -212,18 +229,33 @@ QColor qt_mac_toQColor(CGColorRef color)
QColor qt_mac_toQColor(const NSColor *color)
{
QColor qtColor;
- NSString *colorSpace = [color colorSpaceName];
- if (colorSpace == NSDeviceCMYKColorSpace) {
- CGFloat cyan, magenta, yellow, black, alpha;
- [color getCyan:&cyan magenta:&magenta yellow:&yellow black:&black alpha:&alpha];
- qtColor.setCmykF(cyan, magenta, yellow, black, alpha);
- } else {
- NSColor *tmpColor;
- tmpColor = [color colorUsingColorSpaceName:NSDeviceRGBColorSpace];
- CGFloat red, green, blue, alpha;
+ switch (color.type) {
+ case NSColorTypeComponentBased: {
+ const NSColorSpace *colorSpace = [color colorSpace];
+ if (colorSpace == NSColorSpace.genericRGBColorSpace
+ && color.numberOfComponents == 4) { // rbga
+ CGFloat components[4];
+ [color getComponents:components];
+ qtColor.setRgbF(components[0], components[1], components[2], components[3]);
+ break;
+ } else if (colorSpace == NSColorSpace.genericCMYKColorSpace
+ && color.numberOfComponents == 5) { // cmyk + alpha
+ CGFloat components[5];
+ [color getComponents:components];
+ qtColor.setCmykF(components[0], components[1], components[2], components[3], components[4]);
+ break;
+ }
+ }
+ Q_FALLTHROUGH();
+ default: {
+ const NSColor *tmpColor = [color colorUsingColorSpace:NSColorSpace.genericRGBColorSpace];
+ CGFloat red = 0, green = 0, blue = 0, alpha = 0;
[tmpColor getRed:&red green:&green blue:&blue alpha:&alpha];
qtColor.setRgbF(red, green, blue, alpha);
+ break;
+ }
}
+
return qtColor;
}
#endif
@@ -249,9 +281,9 @@ static bool qt_mac_isSystemColorOrInstance(const NSColor *color, NSString *color
// We specifically do not want isKindOfClass: here
if ([color.className isEqualToString:className]) // NSPatternColorSpace
return true;
- if ([color.catalogNameComponent isEqualToString:@"System"] &&
- [color.colorNameComponent isEqualToString:colorNameComponent] &&
- [color.colorSpaceName isEqualToString:NSNamedColorSpace])
+ if (color.type == NSColorTypeCatalog &&
+ [color.catalogNameComponent isEqualToString:@"System"] &&
+ [color.colorNameComponent isEqualToString:colorNameComponent])
return true;
return false;
}
@@ -307,8 +339,8 @@ QBrush qt_mac_toQBrush(const NSColor *color, QPalette::ColorGroup colorGroup)
return qtBrush;
}
- if (NSColor *patternColor = [color colorUsingColorSpaceName:NSPatternColorSpace]) {
- NSImage *patternImage = patternColor.patternImage;
+ if (color.type == NSColorTypePattern) {
+ NSImage *patternImage = color.patternImage;
const QSizeF sz(patternImage.size.width, patternImage.size.height);
// FIXME: QBrush is not resolution independent (QTBUG-49774)
qtBrush.setTexture(qt_mac_toQPixmap(patternImage, sz));
@@ -376,11 +408,14 @@ void QMacCGContext::initialize(QPaintDevice *paintDevice)
// Find the underlying QImage of the paint device
switch (int deviceType = paintDevice->devType()) {
case QInternal::Pixmap: {
- auto *platformPixmap = static_cast<QPixmap*>(paintDevice)->handle();
- if (platformPixmap && platformPixmap->classId() == QPlatformPixmap::RasterClass)
- initialize(platformPixmap->buffer());
- else
- qWarning() << "QMacCGContext: Unsupported pixmap class" << platformPixmap->classId();
+ if (auto *platformPixmap = static_cast<QPixmap*>(paintDevice)->handle()) {
+ if (platformPixmap->classId() == QPlatformPixmap::RasterClass)
+ initialize(platformPixmap->buffer());
+ else
+ qWarning() << "QMacCGContext: Unsupported pixmap class" << platformPixmap->classId();
+ } else {
+ qWarning() << "QMacCGContext: Empty platformPixmap";
+ }
break;
}
case QInternal::Image:
@@ -464,7 +499,7 @@ void QMacCGContext::initialize(const QImage *image, QPainter *painter)
clip &= painterClip;
}
- qt_mac_clip_cg(context, clip, 0);
+ qt_mac_clip_cg(context, clip, nullptr);
CGContextTranslateCTM(context, deviceTransform.dx(), deviceTransform.dy());
}
diff --git a/src/gui/painting/qcoregraphics_p.h b/src/gui/painting/qcoregraphics_p.h
index ba2cde8325..a35f27a730 100644
--- a/src/gui/painting/qcoregraphics_p.h
+++ b/src/gui/painting/qcoregraphics_p.h
@@ -1,41 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2017 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the QtGui module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2017 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#ifndef QCOREGRAPHICS_P_H
#define QCOREGRAPHICS_P_H
@@ -59,19 +23,38 @@
#include <CoreGraphics/CoreGraphics.h>
-#if defined(__OBJC__) && defined(Q_OS_MACOS)
-#include <AppKit/AppKit.h>
-#define HAVE_APPKIT
+#if defined(__OBJC__)
+# if defined(Q_OS_MACOS)
+# include <AppKit/AppKit.h>
+# elif defined(QT_PLATFORM_UIKIT)
+# include <UIKit/UIKit.h>
+# endif
#endif
QT_BEGIN_NAMESPACE
Q_GUI_EXPORT CGBitmapInfo qt_mac_bitmapInfoForImage(const QImage &image);
-#ifdef HAVE_APPKIT
-Q_GUI_EXPORT NSImage *qt_mac_create_nsimage(const QPixmap &pm);
-Q_GUI_EXPORT NSImage *qt_mac_create_nsimage(const QIcon &icon, int defaultSize = 0);
+#ifdef QT_PLATFORM_UIKIT
+Q_GUI_EXPORT QImage qt_mac_toQImage(const UIImage *image, QSizeF size);
+#endif
+
+#ifdef Q_OS_MACOS
Q_GUI_EXPORT QPixmap qt_mac_toQPixmap(const NSImage *image, const QSizeF &size);
+
+QT_END_NAMESPACE
+
+// @compatibility_alias doesn't work with categories or their methods
+#define imageFromQImage QT_MANGLE_NAMESPACE(imageFromQImage)
+#define imageFromQIcon QT_MANGLE_NAMESPACE(imageFromQIcon)
+
+@interface NSImage (QtExtras)
++ (instancetype)imageFromQImage:(const QT_PREPEND_NAMESPACE(QImage) &)image;
++ (instancetype)imageFromQIcon:(const QT_PREPEND_NAMESPACE(QIcon) &)icon;
++ (instancetype)imageFromQIcon:(const QT_PREPEND_NAMESPACE(QIcon) &)icon withSize:(int)size;
+@end
+QT_BEGIN_NAMESPACE
+
#endif
Q_GUI_EXPORT CGImageRef qt_mac_toCGImage(const QImage &qImage);
Q_GUI_EXPORT CGImageRef qt_mac_toCGImageMask(const QImage &qImage);
@@ -81,7 +64,7 @@ Q_GUI_EXPORT void qt_mac_drawCGImage(CGContextRef inContext, const CGRect *inBou
Q_GUI_EXPORT void qt_mac_clip_cg(CGContextRef hd, const QRegion &rgn, CGAffineTransform *orig_xform);
-#ifdef HAVE_APPKIT
+#ifdef Q_OS_MACOS
Q_GUI_EXPORT QColor qt_mac_toQColor(const NSColor *color);
Q_GUI_EXPORT QBrush qt_mac_toQBrush(const NSColor *color, QPalette::ColorGroup colorGroup = QPalette::Normal);
#endif
@@ -105,6 +88,4 @@ private:
QT_END_NAMESPACE
-#undef HAVE_APPKIT
-
#endif // QCOREGRAPHICS_P_H
diff --git a/src/gui/painting/qcosmeticstroker.cpp b/src/gui/painting/qcosmeticstroker.cpp
index bece814a6f..a0eddf65d9 100644
--- a/src/gui/painting/qcosmeticstroker.cpp
+++ b/src/gui/painting/qcosmeticstroker.cpp
@@ -1,41 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the QtGui module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#include "qcosmeticstroker_p.h"
#include "private/qpainterpath_p.h"
@@ -58,18 +22,28 @@ inline QString capString(int caps)
}
#endif
-#define toF26Dot6(x) ((int)((x)*64.))
+#if Q_PROCESSOR_WORDSIZE == 8
+typedef qint64 FDot16;
+#else
+typedef int FDot16;
+#endif
+
+#define toF26Dot6(x) static_cast<int>((x) * 64.)
static inline uint sourceOver(uint d, uint color)
{
return color + BYTE_MUL(d, qAlpha(~color));
}
-inline static int F16Dot16FixedDiv(int x, int y)
+inline static FDot16 FDot16FixedDiv(int x, int y)
{
+#if Q_PROCESSOR_WORDSIZE == 8
+ return FDot16(x) * (1<<16) / y;
+#else
if (qAbs(x) > 0x7fff)
- return qlonglong(x) * (1<<16) / y;
+ return static_cast<qlonglong>(x) * (1<<16) / y;
return x * (1<<16) / y;
+#endif
}
typedef void (*DrawPixel)(QCosmeticStroker *stroker, int x, int y, int coverage);
@@ -101,7 +75,7 @@ struct Dasher {
offset += stroker->patternLength;
dashIndex = 0;
- while (offset>= pattern[dashIndex])
+ while (dashIndex < stroker->patternSize - 1 && offset>= pattern[dashIndex])
++dashIndex;
// qDebug() << " dasher" << offset/64. << reverse << dashIndex;
@@ -157,7 +131,7 @@ inline void drawPixel(QCosmeticStroker *stroker, int x, int y, int coverage)
}
}
- stroker->spans[stroker->current_span].x = ushort(x);
+ stroker->spans[stroker->current_span].x = x;
stroker->spans[stroker->current_span].len = 1;
stroker->spans[stroker->current_span].y = y;
stroker->spans[stroker->current_span].coverage = coverage*stroker->opacity >> 8;
@@ -249,26 +223,26 @@ void QCosmeticStroker::setup()
if (state->renderHints & QPainter::Antialiasing)
strokeSelection |= AntiAliased;
- const QVector<qreal> &penPattern = state->lastPen.dashPattern();
- if (penPattern.isEmpty()) {
+ const QList<qreal> &penPattern = state->lastPen.dashPattern();
+ if (penPattern.isEmpty() || penPattern.size() > 1024) {
Q_ASSERT(!pattern && !reversePattern);
pattern = nullptr;
reversePattern = nullptr;
patternLength = 0;
patternSize = 0;
} else {
- pattern = (int *)malloc(penPattern.size()*sizeof(int));
- reversePattern = (int *)malloc(penPattern.size()*sizeof(int));
+ pattern = static_cast<int *>(malloc(penPattern.size() * sizeof(int)));
+ reversePattern = static_cast<int *>(malloc(penPattern.size() * sizeof(int)));
patternSize = penPattern.size();
patternLength = 0;
for (int i = 0; i < patternSize; ++i) {
- patternLength += (int) qMax(1. , penPattern.at(i)*64.);
+ patternLength += static_cast<int>(qBound(1., penPattern.at(i) * 64, 65536.));
pattern[i] = patternLength;
}
patternLength = 0;
for (int i = 0; i < patternSize; ++i) {
- patternLength += (int) qMax(1., penPattern.at(patternSize - 1 - i)*64.);
+ patternLength += static_cast<int>(qBound(1., penPattern.at(patternSize - 1 - i) * 64, 65536.));
reversePattern[i] = patternLength;
}
strokeSelection |= Dashed;
@@ -280,18 +254,18 @@ void QCosmeticStroker::setup()
qreal width = state->lastPen.widthF();
if (width == 0)
opacity = 256;
- else if (qt_pen_is_cosmetic(state->lastPen, state->renderHints))
- opacity = (int) 256*width;
+ else if (state->lastPen.isCosmetic())
+ opacity = static_cast<int>(256 * width);
else
- opacity = (int) 256*width*state->txscale;
+ opacity = static_cast<int>(256 * width * state->txscale);
opacity = qBound(0, opacity, 256);
drawCaps = state->lastPen.capStyle() != Qt::FlatCap;
if (strokeSelection & FastDraw) {
- color = multiplyAlpha256(state->penData.solidColor, opacity).toArgb32();
+ color = multiplyAlpha256(state->penData.solidColor.rgba64(), opacity).toArgb32();
QRasterBuffer *buffer = state->penData.rasterBuffer;
- pixels = (uint *)buffer->buffer();
+ pixels = reinterpret_cast<uint *>(buffer->buffer());
ppl = buffer->stride<quint32>();
}
@@ -311,6 +285,8 @@ void QCosmeticStroker::setup()
// returns true if the whole line gets clipped away
bool QCosmeticStroker::clipLine(qreal &x1, qreal &y1, qreal &x2, qreal &y2)
{
+ if (!qIsFinite(x1) || !qIsFinite(y1) || !qIsFinite(x2) || !qIsFinite(y2))
+ return true;
// basic/rough clipping is done in floating point coordinates to avoid
// integer overflow problems.
if (x1 < xmin) {
@@ -365,16 +341,17 @@ bool QCosmeticStroker::clipLine(qreal &x1, qreal &y1, qreal &x2, qreal &y2)
void QCosmeticStroker::drawLine(const QPointF &p1, const QPointF &p2)
{
- if (p1 == p2) {
+ QPointF start = p1 * state->matrix;
+ QPointF end = p2 * state->matrix;
+
+ if (start == end) {
drawPoints(&p1, 1);
return;
}
- QPointF start = p1 * state->matrix;
- QPointF end = p2 * state->matrix;
-
patternOffset = state->lastPen.dashOffset()*64;
lastPixel.x = INT_MIN;
+ lastPixel.y = INT_MIN;
stroke(this, start.x(), start.y(), end.x(), end.y(), drawCaps ? CapBegin|CapEnd : 0);
@@ -387,7 +364,7 @@ void QCosmeticStroker::drawPoints(const QPoint *points, int num)
const QPoint *end = points + num;
while (points < end) {
QPointF p = QPointF(*points) * state->matrix;
- drawPixel(this, qRound(p.x()), qRound(p.y()), 255);
+ drawPixel(this, std::floor(p.x()), std::floor(p.y()), 255);
++points;
}
@@ -400,7 +377,7 @@ void QCosmeticStroker::drawPoints(const QPointF *points, int num)
const QPointF *end = points + num;
while (points < end) {
QPointF p = (*points) * state->matrix;
- drawPixel(this, qRound(p.x()), qRound(p.y()), 255);
+ drawPixel(this, std::floor(p.x()), std::floor(p.y()), 255);
++points;
}
@@ -423,11 +400,10 @@ void QCosmeticStroker::calculateLastPoint(qreal rx1, qreal ry1, qreal rx2, qreal
if (clipLine(rx1, ry1, rx2, ry2))
return;
- const int half = legacyRounding ? 31 : 0;
- int x1 = toF26Dot6(rx1) + half;
- int y1 = toF26Dot6(ry1) + half;
- int x2 = toF26Dot6(rx2) + half;
- int y2 = toF26Dot6(ry2) + half;
+ int x1 = toF26Dot6(rx1);
+ int y1 = toF26Dot6(ry1);
+ int x2 = toF26Dot6(rx2);
+ int y2 = toF26Dot6(ry2);
int dx = qAbs(x2 - x1);
int dy = qAbs(y2 - y1);
@@ -440,8 +416,8 @@ void QCosmeticStroker::calculateLastPoint(qreal rx1, qreal ry1, qreal rx2, qreal
qSwap(y1, y2);
qSwap(x1, x2);
}
- int xinc = F16Dot16FixedDiv(x2 - x1, y2 - y1);
- int x = x1 * (1<<10);
+ FDot16 xinc = FDot16FixedDiv(x2 - x1, y2 - y1);
+ FDot16 x = FDot16(x1) * (1<<10);
int y = (y1 + 32) >> 6;
int ys = (y2 + 32) >> 6;
@@ -472,8 +448,8 @@ void QCosmeticStroker::calculateLastPoint(qreal rx1, qreal ry1, qreal rx2, qreal
qSwap(x1, x2);
qSwap(y1, y2);
}
- int yinc = F16Dot16FixedDiv(y2 - y1, x2 - x1);
- int y = y1 << 10;
+ FDot16 yinc = FDot16FixedDiv(y2 - y1, x2 - x1);
+ FDot16 y = FDot16(y1) * (1 << 10);
int x = (x1 + 32) >> 6;
int xs = (x2 + 32) >> 6;
@@ -691,7 +667,7 @@ void QCosmeticStroker::renderCubicSubdivision(QCosmeticStroker::PointF *points,
if (level) {
qreal dx = points[3].x - points[0].x;
qreal dy = points[3].y - points[0].y;
- qreal len = ((qreal).25) * (qAbs(dx) + qAbs(dy));
+ qreal len = static_cast<qreal>(.25) * (qAbs(dx) + qAbs(dy));
if (qAbs(dx * (points[0].y - points[2].y) - dy * (points[0].x - points[2].x)) >= len ||
qAbs(dx * (points[0].y - points[1].y) - dy * (points[0].x - points[1].x)) >= len) {
@@ -714,7 +690,7 @@ static inline int swapCaps(int caps)
}
// adjust line by half a pixel
-static inline void capAdjust(int caps, int &x1, int &x2, int &y, int yinc)
+static inline void capAdjust(int caps, int &x1, int &x2, FDot16 &y, FDot16 yinc)
{
if (caps & QCosmeticStroker::CapBegin) {
x1 -= 32;
@@ -737,11 +713,10 @@ static bool drawLine(QCosmeticStroker *stroker, qreal rx1, qreal ry1, qreal rx2,
if (stroker->clipLine(rx1, ry1, rx2, ry2))
return true;
- const int half = stroker->legacyRounding ? 31 : 0;
- int x1 = toF26Dot6(rx1) + half;
- int y1 = toF26Dot6(ry1) + half;
- int x2 = toF26Dot6(rx2) + half;
- int y2 = toF26Dot6(ry2) + half;
+ int x1 = toF26Dot6(rx1);
+ int y1 = toF26Dot6(ry1);
+ int x2 = toF26Dot6(rx2);
+ int y2 = toF26Dot6(ry2);
int dx = qAbs(x2 - x1);
int dy = qAbs(y2 - y1);
@@ -762,8 +737,8 @@ static bool drawLine(QCosmeticStroker *stroker, qreal rx1, qreal ry1, qreal rx2,
caps = swapCaps(caps);
dir = QCosmeticStroker::BottomToTop;
}
- int xinc = F16Dot16FixedDiv(x2 - x1, y2 - y1);
- int x = x1 * (1<<10);
+ FDot16 xinc = FDot16FixedDiv(x2 - x1, y2 - y1);
+ FDot16 x = FDot16(x1) * (1<<10);
if ((stroker->lastDir ^ QCosmeticStroker::VerticalMask) == dir)
caps |= swapped ? QCosmeticStroker::CapEnd : QCosmeticStroker::CapBegin;
@@ -852,8 +827,8 @@ static bool drawLine(QCosmeticStroker *stroker, qreal rx1, qreal ry1, qreal rx2,
caps = swapCaps(caps);
dir = QCosmeticStroker::RightToLeft;
}
- int yinc = F16Dot16FixedDiv(y2 - y1, x2 - x1);
- int y = y1 * (1<<10);
+ FDot16 yinc = FDot16FixedDiv(y2 - y1, x2 - x1);
+ FDot16 y = FDot16(y1) * (1<<10);
if ((stroker->lastDir ^ QCosmeticStroker::HorizontalMask) == dir)
caps |= swapped ? QCosmeticStroker::CapEnd : QCosmeticStroker::CapBegin;
@@ -949,7 +924,7 @@ static bool drawLineAA(QCosmeticStroker *stroker, qreal rx1, qreal ry1, qreal rx
if (qAbs(dx) < qAbs(dy)) {
// vertical
- int xinc = F16Dot16FixedDiv(dx, dy);
+ FDot16 xinc = FDot16FixedDiv(dx, dy);
bool swapped = false;
if (y1 > y2) {
@@ -959,7 +934,7 @@ static bool drawLineAA(QCosmeticStroker *stroker, qreal rx1, qreal ry1, qreal rx
caps = swapCaps(caps);
}
- int x = (x1 - 32) * (1<<10);
+ FDot16 x = FDot16(x1 - 32) * (1<<10);
x -= ( ((y1 & 63) - 32) * xinc ) >> 6;
capAdjust(caps, y1, y2, x, xinc);
@@ -983,7 +958,7 @@ static bool drawLineAA(QCosmeticStroker *stroker, qreal rx1, qreal ry1, qreal rx
// draw first pixel
if (dasher.on()) {
- uint alpha = (quint8)(x >> 8);
+ uint alpha = static_cast<quint8>(x >> 8);
drawPixel(stroker, x>>16, y, (255-alpha) * alphaStart >> 6);
drawPixel(stroker, (x>>16) + 1, y, alpha * alphaStart >> 6);
}
@@ -993,7 +968,7 @@ static bool drawLineAA(QCosmeticStroker *stroker, qreal rx1, qreal ry1, qreal rx
if (y < ys) {
do {
if (dasher.on()) {
- uint alpha = (quint8)(x >> 8);
+ uint alpha = static_cast<quint8>(x >> 8);
drawPixel(stroker, x>>16, y, (255-alpha));
drawPixel(stroker, (x>>16) + 1, y, alpha);
}
@@ -1003,7 +978,7 @@ static bool drawLineAA(QCosmeticStroker *stroker, qreal rx1, qreal ry1, qreal rx
}
// draw last pixel
if (alphaEnd && dasher.on()) {
- uint alpha = (quint8)(x >> 8);
+ uint alpha = static_cast<quint8>(x >> 8);
drawPixel(stroker, x>>16, y, (255-alpha) * alphaEnd >> 6);
drawPixel(stroker, (x>>16) + 1, y, alpha * alphaEnd >> 6);
}
@@ -1012,7 +987,7 @@ static bool drawLineAA(QCosmeticStroker *stroker, qreal rx1, qreal ry1, qreal rx
if (!dx)
return true;
- int yinc = F16Dot16FixedDiv(dy, dx);
+ FDot16 yinc = FDot16FixedDiv(dy, dx);
bool swapped = false;
if (x1 > x2) {
@@ -1022,7 +997,7 @@ static bool drawLineAA(QCosmeticStroker *stroker, qreal rx1, qreal ry1, qreal rx
caps = swapCaps(caps);
}
- int y = (y1 - 32) * (1<<10);
+ FDot16 y = FDot16(y1 - 32) * (1<<10);
y -= ( ((x1 & 63) - 32) * yinc ) >> 6;
capAdjust(caps, x1, x2, y, yinc);
@@ -1046,7 +1021,7 @@ static bool drawLineAA(QCosmeticStroker *stroker, qreal rx1, qreal ry1, qreal rx
// draw first pixel
if (dasher.on()) {
- uint alpha = (quint8)(y >> 8);
+ uint alpha = static_cast<quint8>(y >> 8);
drawPixel(stroker, x, y>>16, (255-alpha) * alphaStart >> 6);
drawPixel(stroker, x, (y>>16) + 1, alpha * alphaStart >> 6);
}
@@ -1057,7 +1032,7 @@ static bool drawLineAA(QCosmeticStroker *stroker, qreal rx1, qreal ry1, qreal rx
if (x < xs) {
do {
if (dasher.on()) {
- uint alpha = (quint8)(y >> 8);
+ uint alpha = static_cast<quint8>(y >> 8);
drawPixel(stroker, x, y>>16, (255-alpha));
drawPixel(stroker, x, (y>>16) + 1, alpha);
}
@@ -1067,7 +1042,7 @@ static bool drawLineAA(QCosmeticStroker *stroker, qreal rx1, qreal ry1, qreal rx
}
// draw last pixel
if (alphaEnd && dasher.on()) {
- uint alpha = (quint8)(y >> 8);
+ uint alpha = static_cast<quint8>(y >> 8);
drawPixel(stroker, x, y>>16, (255-alpha) * alphaEnd >> 6);
drawPixel(stroker, x, (y>>16) + 1, alpha * alphaEnd >> 6);
}
diff --git a/src/gui/painting/qcosmeticstroker_p.h b/src/gui/painting/qcosmeticstroker_p.h
index 8571b0476a..cb31ae4b71 100644
--- a/src/gui/painting/qcosmeticstroker_p.h
+++ b/src/gui/painting/qcosmeticstroker_p.h
@@ -1,41 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the QtGui module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#ifndef QCOSMETICSTROKER_P_H
#define QCOSMETICSTROKER_P_H
@@ -103,7 +67,6 @@ public:
patternSize(0),
patternLength(0),
patternOffset(0),
- legacyRounding(false),
current_span(0),
lastDir(NoDirection),
lastAxisAligned(false)
@@ -111,8 +74,6 @@ public:
~QCosmeticStroker() { free(pattern); free(reversePattern); }
- void setLegacyRoundingEnabled(bool legacyRoundingEnabled) { legacyRounding = legacyRoundingEnabled; }
-
void drawLine(const QPointF &p1, const QPointF &p2);
void drawPath(const QVectorPath &path);
void drawPoints(const QPoint *points, int num);
@@ -135,8 +96,6 @@ public:
int patternLength;
int patternOffset;
- bool legacyRounding;
-
enum { NSPANS = 255 };
QT_FT_Span spans[NSPANS];
int current_span;
diff --git a/src/gui/painting/qcssutil.cpp b/src/gui/painting/qcssutil.cpp
index 2d514e14e0..caface7d1a 100644
--- a/src/gui/painting/qcssutil.cpp
+++ b/src/gui/painting/qcssutil.cpp
@@ -1,41 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the QtGui module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#include "qcssutil_p.h"
#include "private/qcssparser_p.h"
@@ -204,28 +168,28 @@ void qDrawEdge(QPainter *p, qreal x1, qreal y1, qreal x2, qreal y2, qreal dw1, q
if (width == 1 || (dw1 == 0 && dw2 == 0)) {
p->drawRect(QRectF(x1, y1, x2-x1, y2-y1));
} else { // draw trapezoid
- QPolygonF quad;
+ std::array<QPointF, 4> quad;
switch (edge) {
case TopEdge:
- quad << QPointF(x1, y1) << QPointF(x1 + dw1, y2)
- << QPointF(x2 - dw2, y2) << QPointF(x2, y1);
+ quad = {QPointF(x1, y1), QPointF(x1 + dw1, y2),
+ QPointF(x2 - dw2, y2), QPointF(x2, y1)};
break;
case BottomEdge:
- quad << QPointF(x1 + dw1, y1) << QPointF(x1, y2)
- << QPointF(x2, y2) << QPointF(x2 - dw2, y1);
+ quad = {QPointF(x1 + dw1, y1), QPointF(x1, y2),
+ QPointF(x2, y2), QPointF(x2 - dw2, y1)};
break;
case LeftEdge:
- quad << QPointF(x1, y1) << QPointF(x1, y2)
- << QPointF(x2, y2 - dw2) << QPointF(x2, y1 + dw1);
+ quad = {QPointF(x1, y1), QPointF(x1, y2),
+ QPointF(x2, y2 - dw2), QPointF(x2, y1 + dw1)};
break;
case RightEdge:
- quad << QPointF(x1, y1 + dw1) << QPointF(x1, y2 - dw2)
- << QPointF(x2, y2) << QPointF(x2, y1);
+ quad = {QPointF(x1, y1 + dw1), QPointF(x1, y2 - dw2),
+ QPointF(x2, y2), QPointF(x2, y1)};
break;
default:
break;
}
- p->drawConvexPolygon(quad);
+ p->drawConvexPolygon(quad.data(), static_cast<int>(quad.size()));
}
break;
}
@@ -304,6 +268,7 @@ void qDrawEdge(QPainter *p, qreal x1, qreal y1, qreal x2, qreal y2, qreal dw1, q
default:
break;
}
+ break;
}
default:
break;
@@ -328,7 +293,7 @@ void qNormalizeRadii(const QRect &br, const QSize *radii,
*trr = *brr = QSize(0, 0);
}
-// Determines if Edge e1 draws over Edge e2. Depending on this trapezoids or rectanges are drawn
+// Determines if Edge e1 draws over Edge e2. Depending on this trapezoids or rectangles are drawn
static bool paintsOver(const QCss::BorderStyle *styles, const QBrush *colors, QCss::Edge e1, QCss::Edge e2)
{
QCss::BorderStyle s1 = styles[e1];
@@ -352,7 +317,7 @@ void qDrawBorder(QPainter *p, const QRect &rect, const QCss::BorderStyle *styles
QSize tlr, trr, blr, brr;
qNormalizeRadii(rect, radii, &tlr, &trr, &blr, &brr);
- // Drawn in increasing order of precendence
+ // Drawn in increasing order of precedence
if (styles[BottomEdge] != BorderStyle_None && borders[BottomEdge] > 0) {
qreal dw1 = (blr.width() || paintsOver(styles, colors, BottomEdge, LeftEdge)) ? 0 : borders[LeftEdge];
qreal dw2 = (brr.width() || paintsOver(styles, colors, BottomEdge, RightEdge)) ? 0 : borders[RightEdge];
diff --git a/src/gui/painting/qcssutil_p.h b/src/gui/painting/qcssutil_p.h
index 3184b7fa22..34cb5170c1 100644
--- a/src/gui/painting/qcssutil_p.h
+++ b/src/gui/painting/qcssutil_p.h
@@ -1,41 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the QtGui module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#ifndef QCSSUTIL_P_H
#define QCSSUTIL_P_H
diff --git a/src/gui/painting/qdatabuffer_p.h b/src/gui/painting/qdatabuffer_p.h
index 181d19da0b..8f467afe4e 100644
--- a/src/gui/painting/qdatabuffer_p.h
+++ b/src/gui/painting/qdatabuffer_p.h
@@ -1,41 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the QtGui module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#ifndef QDATABUFFER_P_H
#define QDATABUFFER_P_H
@@ -62,11 +26,14 @@ template <typename Type> class QDataBuffer
{
Q_DISABLE_COPY_MOVE(QDataBuffer)
public:
- QDataBuffer(int res)
+ explicit QDataBuffer(qsizetype res)
{
capacity = res;
if (res) {
+ QT_WARNING_PUSH
+ QT_WARNING_DISABLE_GCC("-Walloc-size-larger-than=")
buffer = (Type*) malloc(capacity * sizeof(Type));
+ QT_WARNING_POP
Q_CHECK_PTR(buffer);
} else {
buffer = nullptr;
@@ -84,11 +51,11 @@ public:
inline bool isEmpty() const { return siz==0; }
- inline int size() const { return siz; }
+ qsizetype size() const { return siz; }
inline Type *data() const { return buffer; }
- inline Type &at(int i) { Q_ASSERT(i >= 0 && i < siz); return buffer[i]; }
- inline const Type &at(int i) const { Q_ASSERT(i >= 0 && i < siz); return buffer[i]; }
+ Type &at(qsizetype i) { Q_ASSERT(i >= 0 && i < siz); return buffer[i]; }
+ const Type &at(qsizetype i) const { Q_ASSERT(i >= 0 && i < siz); return buffer[i]; }
inline Type &last() { Q_ASSERT(!isEmpty()); return buffer[siz-1]; }
inline const Type &last() const { Q_ASSERT(!isEmpty()); return buffer[siz-1]; }
inline Type &first() { Q_ASSERT(!isEmpty()); return buffer[0]; }
@@ -105,30 +72,33 @@ public:
--siz;
}
- inline void resize(int size) {
+ void resize(qsizetype size) {
reserve(size);
siz = size;
}
- inline void reserve(int size) {
+ void reserve(qsizetype size) {
if (size > capacity) {
if (capacity == 0)
capacity = 1;
while (capacity < size)
capacity *= 2;
- buffer = (Type*) realloc(buffer, capacity * sizeof(Type));
+ buffer = (Type*) realloc(static_cast<void*>(buffer), capacity * sizeof(Type));
Q_CHECK_PTR(buffer);
}
}
- inline void shrink(int size) {
+ void shrink(qsizetype size) {
+ Q_ASSERT(capacity >= size);
capacity = size;
if (size) {
- buffer = (Type*) realloc(buffer, capacity * sizeof(Type));
+ buffer = (Type*) realloc(static_cast<void*>(buffer), capacity * sizeof(Type));
Q_CHECK_PTR(buffer);
+ siz = std::min(siz, size);
} else {
free(buffer);
buffer = nullptr;
+ siz = 0;
}
}
@@ -141,8 +111,8 @@ public:
inline QDataBuffer &operator<<(const Type &t) { add(t); return *this; }
private:
- int capacity;
- int siz;
+ qsizetype capacity;
+ qsizetype siz;
Type *buffer;
};
diff --git a/src/gui/painting/qdrawhelper.cpp b/src/gui/painting/qdrawhelper.cpp
index 6819545bda..b7a943be38 100644
--- a/src/gui/painting/qdrawhelper.cpp
+++ b/src/gui/painting/qdrawhelper.cpp
@@ -1,52 +1,15 @@
-/****************************************************************************
-**
-** Copyright (C) 2018 The Qt Company Ltd.
-** Copyright (C) 2018 Intel Corporation.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the QtGui module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include <qglobal.h>
+// Copyright (C) 2022 The Qt Company Ltd.
+// Copyright (C) 2018 Intel Corporation.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
+
+#include "qdrawhelper_p.h"
#include <qstylehints.h>
#include <qguiapplication.h>
#include <qatomic.h>
+#include <private/qcolortransform_p.h>
#include <private/qcolortrclut_p.h>
#include <private/qdrawhelper_p.h>
-#include <private/qpaintengine_raster_p.h>
-#include <private/qpainter_p.h>
#include <private/qdrawhelper_x86_p.h>
#include <private/qdrawingprimitive_sse2_p.h>
#include <private/qdrawhelper_neon_p.h>
@@ -54,11 +17,24 @@
#include <private/qdrawhelper_mips_dsp_p.h>
#endif
#include <private/qguiapplication_p.h>
+#include <private/qpaintengine_raster_p.h>
+#include <private/qpainter_p.h>
+#include <private/qpixellayout_p.h>
#include <private/qrgba64_p.h>
#include <qendian.h>
#include <qloggingcategory.h>
#include <qmath.h>
+#if QT_CONFIG(thread) && !defined(Q_OS_WASM)
+#define QT_USE_THREAD_PARALLEL_FILLS
+#endif
+
+#if defined(QT_USE_THREAD_PARALLEL_FILLS)
+#include <qsemaphore.h>
+#include <qthreadpool.h>
+#include <private/qthreadpool_p.h>
+#endif
+
QT_BEGIN_NAMESPACE
Q_LOGGING_CATEGORY(lcQtGuiDrawHelper, "qt.gui.drawhelper")
@@ -69,1592 +45,264 @@ Q_LOGGING_CATEGORY(lcQtGuiDrawHelper, "qt.gui.drawhelper")
constants and structures
*/
-enum {
- fixed_scale = 1 << 16,
- half_point = 1 << 15
-};
-
-template<QImage::Format> Q_DECL_CONSTEXPR uint redWidth();
-template<QImage::Format> Q_DECL_CONSTEXPR uint redShift();
-template<QImage::Format> Q_DECL_CONSTEXPR uint greenWidth();
-template<QImage::Format> Q_DECL_CONSTEXPR uint greenShift();
-template<QImage::Format> Q_DECL_CONSTEXPR uint blueWidth();
-template<QImage::Format> Q_DECL_CONSTEXPR uint blueShift();
-template<QImage::Format> Q_DECL_CONSTEXPR uint alphaWidth();
-template<QImage::Format> Q_DECL_CONSTEXPR uint alphaShift();
-
-template<> Q_DECL_CONSTEXPR uint redWidth<QImage::Format_RGB16>() { return 5; }
-template<> Q_DECL_CONSTEXPR uint redWidth<QImage::Format_RGB444>() { return 4; }
-template<> Q_DECL_CONSTEXPR uint redWidth<QImage::Format_RGB555>() { return 5; }
-template<> Q_DECL_CONSTEXPR uint redWidth<QImage::Format_RGB666>() { return 6; }
-template<> Q_DECL_CONSTEXPR uint redWidth<QImage::Format_RGB888>() { return 8; }
-template<> Q_DECL_CONSTEXPR uint redWidth<QImage::Format_BGR888>() { return 8; }
-template<> Q_DECL_CONSTEXPR uint redWidth<QImage::Format_ARGB4444_Premultiplied>() { return 4; }
-template<> Q_DECL_CONSTEXPR uint redWidth<QImage::Format_ARGB8555_Premultiplied>() { return 5; }
-template<> Q_DECL_CONSTEXPR uint redWidth<QImage::Format_ARGB8565_Premultiplied>() { return 5; }
-template<> Q_DECL_CONSTEXPR uint redWidth<QImage::Format_ARGB6666_Premultiplied>() { return 6; }
-template<> Q_DECL_CONSTEXPR uint redWidth<QImage::Format_RGBX8888>() { return 8; }
-template<> Q_DECL_CONSTEXPR uint redWidth<QImage::Format_RGBA8888>() { return 8; }
-template<> Q_DECL_CONSTEXPR uint redWidth<QImage::Format_RGBA8888_Premultiplied>() { return 8; }
-
-template<> Q_DECL_CONSTEXPR uint redShift<QImage::Format_RGB16>() { return 11; }
-template<> Q_DECL_CONSTEXPR uint redShift<QImage::Format_RGB444>() { return 8; }
-template<> Q_DECL_CONSTEXPR uint redShift<QImage::Format_RGB555>() { return 10; }
-template<> Q_DECL_CONSTEXPR uint redShift<QImage::Format_RGB666>() { return 12; }
-template<> Q_DECL_CONSTEXPR uint redShift<QImage::Format_RGB888>() { return 16; }
-template<> Q_DECL_CONSTEXPR uint redShift<QImage::Format_BGR888>() { return 0; }
-template<> Q_DECL_CONSTEXPR uint redShift<QImage::Format_ARGB4444_Premultiplied>() { return 8; }
-template<> Q_DECL_CONSTEXPR uint redShift<QImage::Format_ARGB8555_Premultiplied>() { return 18; }
-template<> Q_DECL_CONSTEXPR uint redShift<QImage::Format_ARGB8565_Premultiplied>() { return 19; }
-template<> Q_DECL_CONSTEXPR uint redShift<QImage::Format_ARGB6666_Premultiplied>() { return 12; }
-#if Q_BYTE_ORDER == Q_BIG_ENDIAN
-template<> Q_DECL_CONSTEXPR uint redShift<QImage::Format_RGBX8888>() { return 24; }
-template<> Q_DECL_CONSTEXPR uint redShift<QImage::Format_RGBA8888>() { return 24; }
-template<> Q_DECL_CONSTEXPR uint redShift<QImage::Format_RGBA8888_Premultiplied>() { return 24; }
-#else
-template<> Q_DECL_CONSTEXPR uint redShift<QImage::Format_RGBX8888>() { return 0; }
-template<> Q_DECL_CONSTEXPR uint redShift<QImage::Format_RGBA8888>() { return 0; }
-template<> Q_DECL_CONSTEXPR uint redShift<QImage::Format_RGBA8888_Premultiplied>() { return 0; }
-#endif
-template<> Q_DECL_CONSTEXPR uint greenWidth<QImage::Format_RGB16>() { return 6; }
-template<> Q_DECL_CONSTEXPR uint greenWidth<QImage::Format_RGB444>() { return 4; }
-template<> Q_DECL_CONSTEXPR uint greenWidth<QImage::Format_RGB555>() { return 5; }
-template<> Q_DECL_CONSTEXPR uint greenWidth<QImage::Format_RGB666>() { return 6; }
-template<> Q_DECL_CONSTEXPR uint greenWidth<QImage::Format_RGB888>() { return 8; }
-template<> Q_DECL_CONSTEXPR uint greenWidth<QImage::Format_BGR888>() { return 8; }
-template<> Q_DECL_CONSTEXPR uint greenWidth<QImage::Format_ARGB4444_Premultiplied>() { return 4; }
-template<> Q_DECL_CONSTEXPR uint greenWidth<QImage::Format_ARGB8555_Premultiplied>() { return 5; }
-template<> Q_DECL_CONSTEXPR uint greenWidth<QImage::Format_ARGB8565_Premultiplied>() { return 6; }
-template<> Q_DECL_CONSTEXPR uint greenWidth<QImage::Format_ARGB6666_Premultiplied>() { return 6; }
-template<> Q_DECL_CONSTEXPR uint greenWidth<QImage::Format_RGBX8888>() { return 8; }
-template<> Q_DECL_CONSTEXPR uint greenWidth<QImage::Format_RGBA8888>() { return 8; }
-template<> Q_DECL_CONSTEXPR uint greenWidth<QImage::Format_RGBA8888_Premultiplied>() { return 8; }
-
-template<> Q_DECL_CONSTEXPR uint greenShift<QImage::Format_RGB16>() { return 5; }
-template<> Q_DECL_CONSTEXPR uint greenShift<QImage::Format_RGB444>() { return 4; }
-template<> Q_DECL_CONSTEXPR uint greenShift<QImage::Format_RGB555>() { return 5; }
-template<> Q_DECL_CONSTEXPR uint greenShift<QImage::Format_RGB666>() { return 6; }
-template<> Q_DECL_CONSTEXPR uint greenShift<QImage::Format_RGB888>() { return 8; }
-template<> Q_DECL_CONSTEXPR uint greenShift<QImage::Format_BGR888>() { return 8; }
-template<> Q_DECL_CONSTEXPR uint greenShift<QImage::Format_ARGB4444_Premultiplied>() { return 4; }
-template<> Q_DECL_CONSTEXPR uint greenShift<QImage::Format_ARGB8555_Premultiplied>() { return 13; }
-template<> Q_DECL_CONSTEXPR uint greenShift<QImage::Format_ARGB8565_Premultiplied>() { return 13; }
-template<> Q_DECL_CONSTEXPR uint greenShift<QImage::Format_ARGB6666_Premultiplied>() { return 6; }
-#if Q_BYTE_ORDER == Q_BIG_ENDIAN
-template<> Q_DECL_CONSTEXPR uint greenShift<QImage::Format_RGBX8888>() { return 16; }
-template<> Q_DECL_CONSTEXPR uint greenShift<QImage::Format_RGBA8888>() { return 16; }
-template<> Q_DECL_CONSTEXPR uint greenShift<QImage::Format_RGBA8888_Premultiplied>() { return 16; }
-#else
-template<> Q_DECL_CONSTEXPR uint greenShift<QImage::Format_RGBX8888>() { return 8; }
-template<> Q_DECL_CONSTEXPR uint greenShift<QImage::Format_RGBA8888>() { return 8; }
-template<> Q_DECL_CONSTEXPR uint greenShift<QImage::Format_RGBA8888_Premultiplied>() { return 8; }
-#endif
-template<> Q_DECL_CONSTEXPR uint blueWidth<QImage::Format_RGB16>() { return 5; }
-template<> Q_DECL_CONSTEXPR uint blueWidth<QImage::Format_RGB444>() { return 4; }
-template<> Q_DECL_CONSTEXPR uint blueWidth<QImage::Format_RGB555>() { return 5; }
-template<> Q_DECL_CONSTEXPR uint blueWidth<QImage::Format_RGB666>() { return 6; }
-template<> Q_DECL_CONSTEXPR uint blueWidth<QImage::Format_RGB888>() { return 8; }
-template<> Q_DECL_CONSTEXPR uint blueWidth<QImage::Format_BGR888>() { return 8; }
-template<> Q_DECL_CONSTEXPR uint blueWidth<QImage::Format_ARGB4444_Premultiplied>() { return 4; }
-template<> Q_DECL_CONSTEXPR uint blueWidth<QImage::Format_ARGB8555_Premultiplied>() { return 5; }
-template<> Q_DECL_CONSTEXPR uint blueWidth<QImage::Format_ARGB8565_Premultiplied>() { return 5; }
-template<> Q_DECL_CONSTEXPR uint blueWidth<QImage::Format_ARGB6666_Premultiplied>() { return 6; }
-template<> Q_DECL_CONSTEXPR uint blueWidth<QImage::Format_RGBX8888>() { return 8; }
-template<> Q_DECL_CONSTEXPR uint blueWidth<QImage::Format_RGBA8888>() { return 8; }
-template<> Q_DECL_CONSTEXPR uint blueWidth<QImage::Format_RGBA8888_Premultiplied>() { return 8; }
-
-template<> Q_DECL_CONSTEXPR uint blueShift<QImage::Format_RGB16>() { return 0; }
-template<> Q_DECL_CONSTEXPR uint blueShift<QImage::Format_RGB444>() { return 0; }
-template<> Q_DECL_CONSTEXPR uint blueShift<QImage::Format_RGB555>() { return 0; }
-template<> Q_DECL_CONSTEXPR uint blueShift<QImage::Format_RGB666>() { return 0; }
-template<> Q_DECL_CONSTEXPR uint blueShift<QImage::Format_RGB888>() { return 0; }
-template<> Q_DECL_CONSTEXPR uint blueShift<QImage::Format_BGR888>() { return 16; }
-template<> Q_DECL_CONSTEXPR uint blueShift<QImage::Format_ARGB4444_Premultiplied>() { return 0; }
-template<> Q_DECL_CONSTEXPR uint blueShift<QImage::Format_ARGB8555_Premultiplied>() { return 8; }
-template<> Q_DECL_CONSTEXPR uint blueShift<QImage::Format_ARGB8565_Premultiplied>() { return 8; }
-template<> Q_DECL_CONSTEXPR uint blueShift<QImage::Format_ARGB6666_Premultiplied>() { return 0; }
-#if Q_BYTE_ORDER == Q_BIG_ENDIAN
-template<> Q_DECL_CONSTEXPR uint blueShift<QImage::Format_RGBX8888>() { return 8; }
-template<> Q_DECL_CONSTEXPR uint blueShift<QImage::Format_RGBA8888>() { return 8; }
-template<> Q_DECL_CONSTEXPR uint blueShift<QImage::Format_RGBA8888_Premultiplied>() { return 8; }
-#else
-template<> Q_DECL_CONSTEXPR uint blueShift<QImage::Format_RGBX8888>() { return 16; }
-template<> Q_DECL_CONSTEXPR uint blueShift<QImage::Format_RGBA8888>() { return 16; }
-template<> Q_DECL_CONSTEXPR uint blueShift<QImage::Format_RGBA8888_Premultiplied>() { return 16; }
-#endif
-template<> Q_DECL_CONSTEXPR uint alphaWidth<QImage::Format_RGB16>() { return 0; }
-template<> Q_DECL_CONSTEXPR uint alphaWidth<QImage::Format_RGB444>() { return 0; }
-template<> Q_DECL_CONSTEXPR uint alphaWidth<QImage::Format_RGB555>() { return 0; }
-template<> Q_DECL_CONSTEXPR uint alphaWidth<QImage::Format_RGB666>() { return 0; }
-template<> Q_DECL_CONSTEXPR uint alphaWidth<QImage::Format_RGB888>() { return 0; }
-template<> Q_DECL_CONSTEXPR uint alphaWidth<QImage::Format_BGR888>() { return 0; }
-template<> Q_DECL_CONSTEXPR uint alphaWidth<QImage::Format_ARGB4444_Premultiplied>() { return 4; }
-template<> Q_DECL_CONSTEXPR uint alphaWidth<QImage::Format_ARGB8555_Premultiplied>() { return 8; }
-template<> Q_DECL_CONSTEXPR uint alphaWidth<QImage::Format_ARGB8565_Premultiplied>() { return 8; }
-template<> Q_DECL_CONSTEXPR uint alphaWidth<QImage::Format_ARGB6666_Premultiplied>() { return 6; }
-template<> Q_DECL_CONSTEXPR uint alphaWidth<QImage::Format_RGBX8888>() { return 0; }
-template<> Q_DECL_CONSTEXPR uint alphaWidth<QImage::Format_RGBA8888>() { return 8; }
-template<> Q_DECL_CONSTEXPR uint alphaWidth<QImage::Format_RGBA8888_Premultiplied>() { return 8; }
-
-template<> Q_DECL_CONSTEXPR uint alphaShift<QImage::Format_RGB16>() { return 0; }
-template<> Q_DECL_CONSTEXPR uint alphaShift<QImage::Format_RGB444>() { return 0; }
-template<> Q_DECL_CONSTEXPR uint alphaShift<QImage::Format_RGB555>() { return 0; }
-template<> Q_DECL_CONSTEXPR uint alphaShift<QImage::Format_RGB666>() { return 0; }
-template<> Q_DECL_CONSTEXPR uint alphaShift<QImage::Format_RGB888>() { return 0; }
-template<> Q_DECL_CONSTEXPR uint alphaShift<QImage::Format_BGR888>() { return 0; }
-template<> Q_DECL_CONSTEXPR uint alphaShift<QImage::Format_ARGB4444_Premultiplied>() { return 12; }
-template<> Q_DECL_CONSTEXPR uint alphaShift<QImage::Format_ARGB8555_Premultiplied>() { return 0; }
-template<> Q_DECL_CONSTEXPR uint alphaShift<QImage::Format_ARGB8565_Premultiplied>() { return 0; }
-template<> Q_DECL_CONSTEXPR uint alphaShift<QImage::Format_ARGB6666_Premultiplied>() { return 18; }
-#if Q_BYTE_ORDER == Q_BIG_ENDIAN
-template<> Q_DECL_CONSTEXPR uint alphaShift<QImage::Format_RGBX8888>() { return 0; }
-template<> Q_DECL_CONSTEXPR uint alphaShift<QImage::Format_RGBA8888>() { return 0; }
-template<> Q_DECL_CONSTEXPR uint alphaShift<QImage::Format_RGBA8888_Premultiplied>() { return 0; }
-#else
-template<> Q_DECL_CONSTEXPR uint alphaShift<QImage::Format_RGBX8888>() { return 24; }
-template<> Q_DECL_CONSTEXPR uint alphaShift<QImage::Format_RGBA8888>() { return 24; }
-template<> Q_DECL_CONSTEXPR uint alphaShift<QImage::Format_RGBA8888_Premultiplied>() { return 24; }
-#endif
-
-template<QImage::Format> constexpr QPixelLayout::BPP bitsPerPixel();
-template<> constexpr QPixelLayout::BPP bitsPerPixel<QImage::Format_RGB16>() { return QPixelLayout::BPP16; }
-template<> constexpr QPixelLayout::BPP bitsPerPixel<QImage::Format_RGB444>() { return QPixelLayout::BPP16; }
-template<> constexpr QPixelLayout::BPP bitsPerPixel<QImage::Format_RGB555>() { return QPixelLayout::BPP16; }
-template<> constexpr QPixelLayout::BPP bitsPerPixel<QImage::Format_RGB666>() { return QPixelLayout::BPP24; }
-template<> constexpr QPixelLayout::BPP bitsPerPixel<QImage::Format_RGB888>() { return QPixelLayout::BPP24; }
-template<> constexpr QPixelLayout::BPP bitsPerPixel<QImage::Format_BGR888>() { return QPixelLayout::BPP24; }
-template<> constexpr QPixelLayout::BPP bitsPerPixel<QImage::Format_ARGB4444_Premultiplied>() { return QPixelLayout::BPP16; }
-template<> constexpr QPixelLayout::BPP bitsPerPixel<QImage::Format_ARGB8555_Premultiplied>() { return QPixelLayout::BPP24; }
-template<> constexpr QPixelLayout::BPP bitsPerPixel<QImage::Format_ARGB8565_Premultiplied>() { return QPixelLayout::BPP24; }
-template<> constexpr QPixelLayout::BPP bitsPerPixel<QImage::Format_ARGB6666_Premultiplied>() { return QPixelLayout::BPP24; }
-template<> constexpr QPixelLayout::BPP bitsPerPixel<QImage::Format_RGBX8888>() { return QPixelLayout::BPP32; }
-template<> constexpr QPixelLayout::BPP bitsPerPixel<QImage::Format_RGBA8888>() { return QPixelLayout::BPP32; }
-template<> constexpr QPixelLayout::BPP bitsPerPixel<QImage::Format_RGBA8888_Premultiplied>() { return QPixelLayout::BPP32; }
-
-
-typedef const uint *(QT_FASTCALL *FetchPixelsFunc)(uint *buffer, const uchar *src, int index, int count);
+constexpr int fixed_scale = 1 << 16;
+constexpr int half_point = 1 << 15;
template <QPixelLayout::BPP bpp> static
-uint QT_FASTCALL fetchPixel(const uchar *, int)
+inline uint QT_FASTCALL fetch1Pixel(const uchar *, int)
{
- Q_UNREACHABLE();
- return 0;
+ Q_UNREACHABLE_RETURN(0);
}
template <>
-inline uint QT_FASTCALL fetchPixel<QPixelLayout::BPP1LSB>(const uchar *src, int index)
+inline uint QT_FASTCALL fetch1Pixel<QPixelLayout::BPP1LSB>(const uchar *src, int index)
{
return (src[index >> 3] >> (index & 7)) & 1;
}
template <>
-inline uint QT_FASTCALL fetchPixel<QPixelLayout::BPP1MSB>(const uchar *src, int index)
+inline uint QT_FASTCALL fetch1Pixel<QPixelLayout::BPP1MSB>(const uchar *src, int index)
{
return (src[index >> 3] >> (~index & 7)) & 1;
}
template <>
-inline uint QT_FASTCALL fetchPixel<QPixelLayout::BPP8>(const uchar *src, int index)
+inline uint QT_FASTCALL fetch1Pixel<QPixelLayout::BPP8>(const uchar *src, int index)
{
return src[index];
}
template <>
-inline uint QT_FASTCALL fetchPixel<QPixelLayout::BPP16>(const uchar *src, int index)
+inline uint QT_FASTCALL fetch1Pixel<QPixelLayout::BPP16>(const uchar *src, int index)
{
return reinterpret_cast<const quint16 *>(src)[index];
}
template <>
-inline uint QT_FASTCALL fetchPixel<QPixelLayout::BPP24>(const uchar *src, int index)
+inline uint QT_FASTCALL fetch1Pixel<QPixelLayout::BPP24>(const uchar *src, int index)
{
return reinterpret_cast<const quint24 *>(src)[index];
}
template <>
-inline uint QT_FASTCALL fetchPixel<QPixelLayout::BPP32>(const uchar *src, int index)
+inline uint QT_FASTCALL fetch1Pixel<QPixelLayout::BPP32>(const uchar *src, int index)
{
return reinterpret_cast<const uint *>(src)[index];
}
template <>
-inline uint QT_FASTCALL fetchPixel<QPixelLayout::BPP64>(const uchar *src, int index)
+inline uint QT_FASTCALL fetch1Pixel<QPixelLayout::BPP64>(const uchar *src, int index)
{
// We have to do the conversion in fetch to fit into a 32bit uint
QRgba64 c = reinterpret_cast<const QRgba64 *>(src)[index];
return c.toArgb32();
}
-template <QPixelLayout::BPP bpp>
-static quint64 QT_FASTCALL fetchPixel64(const uchar *src, int index)
-{
- Q_STATIC_ASSERT(bpp != QPixelLayout::BPP64);
- return fetchPixel<bpp>(src, index);
-}
-
-template <QPixelLayout::BPP width> static
-void QT_FASTCALL storePixel(uchar *dest, int index, uint pixel);
-
template <>
-inline void QT_FASTCALL storePixel<QPixelLayout::BPP16>(uchar *dest, int index, uint pixel)
+inline uint QT_FASTCALL fetch1Pixel<QPixelLayout::BPP16FPx4>(const uchar *src, int index)
{
- reinterpret_cast<quint16 *>(dest)[index] = quint16(pixel);
+ // We have to do the conversion in fetch to fit into a 32bit uint
+ QRgbaFloat16 c = reinterpret_cast<const QRgbaFloat16 *>(src)[index];
+ return c.toArgb32();
}
template <>
-inline void QT_FASTCALL storePixel<QPixelLayout::BPP24>(uchar *dest, int index, uint pixel)
+inline uint QT_FASTCALL fetch1Pixel<QPixelLayout::BPP32FPx4>(const uchar *src, int index)
{
- reinterpret_cast<quint24 *>(dest)[index] = quint24(pixel);
+ // We have to do the conversion in fetch to fit into a 32bit uint
+ QRgbaFloat32 c = reinterpret_cast<const QRgbaFloat32 *>(src)[index];
+ return c.toArgb32();
}
-typedef uint (QT_FASTCALL *FetchPixelFunc)(const uchar *src, int index);
+typedef uint (QT_FASTCALL *Fetch1PixelFunc)(const uchar *src, int index);
-static const FetchPixelFunc qFetchPixel[QPixelLayout::BPPCount] = {
+constexpr Fetch1PixelFunc fetch1PixelTable[QPixelLayout::BPPCount] = {
nullptr, // BPPNone
- fetchPixel<QPixelLayout::BPP1MSB>, // BPP1MSB
- fetchPixel<QPixelLayout::BPP1LSB>, // BPP1LSB
- fetchPixel<QPixelLayout::BPP8>, // BPP8
- fetchPixel<QPixelLayout::BPP16>, // BPP16
- fetchPixel<QPixelLayout::BPP24>, // BPP24
- fetchPixel<QPixelLayout::BPP32>, // BPP32
- fetchPixel<QPixelLayout::BPP64> // BPP64
+ fetch1Pixel<QPixelLayout::BPP1MSB>,
+ fetch1Pixel<QPixelLayout::BPP1LSB>,
+ fetch1Pixel<QPixelLayout::BPP8>,
+ fetch1Pixel<QPixelLayout::BPP16>,
+ fetch1Pixel<QPixelLayout::BPP24>,
+ fetch1Pixel<QPixelLayout::BPP32>,
+ fetch1Pixel<QPixelLayout::BPP64>,
+ fetch1Pixel<QPixelLayout::BPP16FPx4>,
+ fetch1Pixel<QPixelLayout::BPP32FPx4>,
};
-template<QImage::Format Format>
-static Q_ALWAYS_INLINE uint convertPixelToRGB32(uint s)
-{
- Q_CONSTEXPR uint redMask = ((1 << redWidth<Format>()) - 1);
- Q_CONSTEXPR uint greenMask = ((1 << greenWidth<Format>()) - 1);
- Q_CONSTEXPR uint blueMask = ((1 << blueWidth<Format>()) - 1);
-
- Q_CONSTEXPR uchar redLeftShift = 8 - redWidth<Format>();
- Q_CONSTEXPR uchar greenLeftShift = 8 - greenWidth<Format>();
- Q_CONSTEXPR uchar blueLeftShift = 8 - blueWidth<Format>();
-
- Q_CONSTEXPR uchar redRightShift = 2 * redWidth<Format>() - 8;
- Q_CONSTEXPR uchar greenRightShift = 2 * greenWidth<Format>() - 8;
- Q_CONSTEXPR uchar blueRightShift = 2 * blueWidth<Format>() - 8;
-
- uint red = (s >> redShift<Format>()) & redMask;
- uint green = (s >> greenShift<Format>()) & greenMask;
- uint blue = (s >> blueShift<Format>()) & blueMask;
-
- red = ((red << redLeftShift) | (red >> redRightShift)) << 16;
- green = ((green << greenLeftShift) | (green >> greenRightShift)) << 8;
- blue = (blue << blueLeftShift) | (blue >> blueRightShift);
- return 0xff000000 | red | green | blue;
-}
-
-template<QImage::Format Format>
-static void QT_FASTCALL convertToRGB32(uint *buffer, int count, const QVector<QRgb> *)
-{
- for (int i = 0; i < count; ++i)
- buffer[i] = convertPixelToRGB32<Format>(buffer[i]);
-}
-
-#if defined(__SSE2__) && !defined(__SSSE3__) && QT_COMPILER_SUPPORTS_SSSE3
-extern const uint * QT_FASTCALL fetchPixelsBPP24_ssse3(uint *dest, const uchar*src, int index, int count);
-#endif
-
-template<QImage::Format Format>
-static const uint *QT_FASTCALL fetchRGBToRGB32(uint *buffer, const uchar *src, int index, int count,
- const QVector<QRgb> *, QDitherInfo *)
-{
- constexpr QPixelLayout::BPP BPP = bitsPerPixel<Format>();
-#if defined(__SSE2__) && !defined(__SSSE3__) && QT_COMPILER_SUPPORTS_SSSE3
- if (BPP == QPixelLayout::BPP24 && qCpuHasFeature(SSSE3)) {
- // With SSE2 can convertToRGB32 be vectorized, but it takes SSSE3
- // to vectorize the deforested version below.
- fetchPixelsBPP24_ssse3(buffer, src, index, count);
- convertToRGB32<Format>(buffer, count, nullptr);
- return buffer;
- }
-#endif
- for (int i = 0; i < count; ++i)
- buffer[i] = convertPixelToRGB32<Format>(fetchPixel<BPP>(src, index + i));
- return buffer;
-}
-
-template<QImage::Format Format>
-static Q_ALWAYS_INLINE QRgba64 convertPixelToRGB64(uint s)
-{
- return QRgba64::fromArgb32(convertPixelToRGB32<Format>(s));
-}
-
-template<QImage::Format Format>
-static const QRgba64 *QT_FASTCALL convertToRGB64(QRgba64 *buffer, const uint *src, int count,
- const QVector<QRgb> *, QDitherInfo *)
-{
- for (int i = 0; i < count; ++i)
- buffer[i] = convertPixelToRGB64<Format>(src[i]);
- return buffer;
-}
-
-template<QImage::Format Format>
-static const QRgba64 *QT_FASTCALL fetchRGBToRGB64(QRgba64 *buffer, const uchar *src, int index, int count,
- const QVector<QRgb> *, QDitherInfo *)
-{
- for (int i = 0; i < count; ++i)
- buffer[i] = convertPixelToRGB64<Format>(fetchPixel<bitsPerPixel<Format>()>(src, index + i));
- return buffer;
-}
-
-template<QImage::Format Format>
-static Q_ALWAYS_INLINE uint convertPixelToARGB32PM(uint s)
-{
- Q_CONSTEXPR uint alphaMask = ((1 << alphaWidth<Format>()) - 1);
- Q_CONSTEXPR uint redMask = ((1 << redWidth<Format>()) - 1);
- Q_CONSTEXPR uint greenMask = ((1 << greenWidth<Format>()) - 1);
- Q_CONSTEXPR uint blueMask = ((1 << blueWidth<Format>()) - 1);
-
- Q_CONSTEXPR uchar alphaLeftShift = 8 - alphaWidth<Format>();
- Q_CONSTEXPR uchar redLeftShift = 8 - redWidth<Format>();
- Q_CONSTEXPR uchar greenLeftShift = 8 - greenWidth<Format>();
- Q_CONSTEXPR uchar blueLeftShift = 8 - blueWidth<Format>();
-
- Q_CONSTEXPR uchar alphaRightShift = 2 * alphaWidth<Format>() - 8;
- Q_CONSTEXPR uchar redRightShift = 2 * redWidth<Format>() - 8;
- Q_CONSTEXPR uchar greenRightShift = 2 * greenWidth<Format>() - 8;
- Q_CONSTEXPR uchar blueRightShift = 2 * blueWidth<Format>() - 8;
-
- Q_CONSTEXPR bool mustMin = (alphaWidth<Format>() != redWidth<Format>()) ||
- (alphaWidth<Format>() != greenWidth<Format>()) ||
- (alphaWidth<Format>() != blueWidth<Format>());
-
- uint alpha = (s >> alphaShift<Format>()) & alphaMask;
- uint red = (s >> redShift<Format>()) & redMask;
- uint green = (s >> greenShift<Format>()) & greenMask;
- uint blue = (s >> blueShift<Format>()) & blueMask;
-
- alpha = (alpha << alphaLeftShift) | (alpha >> alphaRightShift);
- red = (red << redLeftShift) | (red >> redRightShift);
- green = (green << greenLeftShift) | (green >> greenRightShift);
- blue = (blue << blueLeftShift) | (blue >> blueRightShift);
-
- if (mustMin) {
- red = qMin(alpha, red);
- green = qMin(alpha, green);
- blue = qMin(alpha, blue);
- }
-
- return (alpha << 24) | (red << 16) | (green << 8) | blue;
-}
-
-template<QImage::Format Format>
-static void QT_FASTCALL convertARGBPMToARGB32PM(uint *buffer, int count, const QVector<QRgb> *)
-{
- for (int i = 0; i < count; ++i)
- buffer[i] = convertPixelToARGB32PM<Format>(buffer[i]);
-}
-
-template<QImage::Format Format>
-static const uint *QT_FASTCALL fetchARGBPMToARGB32PM(uint *buffer, const uchar *src, int index, int count,
- const QVector<QRgb> *, QDitherInfo *)
-{
- constexpr QPixelLayout::BPP BPP = bitsPerPixel<Format>();
-#if defined(__SSE2__) && !defined(__SSSE3__) && QT_COMPILER_SUPPORTS_SSSE3
- if (BPP == QPixelLayout::BPP24 && qCpuHasFeature(SSSE3)) {
- // With SSE2 can convertToRGB32 be vectorized, but it takes SSSE3
- // to vectorize the deforested version below.
- fetchPixelsBPP24_ssse3(buffer, src, index, count);
- convertARGBPMToARGB32PM<Format>(buffer, count, nullptr);
- return buffer;
- }
-#endif
- for (int i = 0; i < count; ++i)
- buffer[i] = convertPixelToARGB32PM<Format>(fetchPixel<BPP>(src, index + i));
- return buffer;
-}
-
-template<QImage::Format Format>
-static Q_ALWAYS_INLINE QRgba64 convertPixelToRGBA64PM(uint s)
-{
- return QRgba64::fromArgb32(convertPixelToARGB32PM<Format>(s));
-}
-
-template<QImage::Format Format>
-static const QRgba64 *QT_FASTCALL convertARGBPMToRGBA64PM(QRgba64 *buffer, const uint *src, int count,
- const QVector<QRgb> *, QDitherInfo *)
-{
- for (int i = 0; i < count; ++i)
- buffer[i] = convertPixelToRGB64<Format>(src[i]);
- return buffer;
-}
-
-template<QImage::Format Format>
-static const QRgba64 *QT_FASTCALL fetchARGBPMToRGBA64PM(QRgba64 *buffer, const uchar *src, int index, int count,
- const QVector<QRgb> *, QDitherInfo *)
+#if QT_CONFIG(raster_64bit)
+static void QT_FASTCALL convertRGBA64ToRGBA64PM(QRgba64 *buffer, int count)
{
- constexpr QPixelLayout::BPP bpp = bitsPerPixel<Format>();
for (int i = 0; i < count; ++i)
- buffer[i] = convertPixelToRGBA64PM<Format>(fetchPixel<bpp>(src, index + i));
- return buffer;
-}
-
-template<QImage::Format Format, bool fromRGB>
-static void QT_FASTCALL storeRGBFromARGB32PM(uchar *dest, const uint *src, int index, int count,
- const QVector<QRgb> *, QDitherInfo *dither)
-{
- Q_CONSTEXPR uchar rWidth = redWidth<Format>();
- Q_CONSTEXPR uchar gWidth = greenWidth<Format>();
- Q_CONSTEXPR uchar bWidth = blueWidth<Format>();
- constexpr QPixelLayout::BPP BPP = bitsPerPixel<Format>();
-
- // RGB32 -> RGB888 is not a precision loss.
- if (!dither || (rWidth == 8 && gWidth == 8 && bWidth == 8)) {
- Q_CONSTEXPR uint rMask = (1 << redWidth<Format>()) - 1;
- Q_CONSTEXPR uint gMask = (1 << greenWidth<Format>()) - 1;
- Q_CONSTEXPR uint bMask = (1 << blueWidth<Format>()) - 1;
- Q_CONSTEXPR uchar rRightShift = 24 - redWidth<Format>();
- Q_CONSTEXPR uchar gRightShift = 16 - greenWidth<Format>();
- Q_CONSTEXPR uchar bRightShift = 8 - blueWidth<Format>();
-
- for (int i = 0; i < count; ++i) {
- const uint c = fromRGB ? src[i] : qUnpremultiply(src[i]);
- const uint r = ((c >> rRightShift) & rMask) << redShift<Format>();
- const uint g = ((c >> gRightShift) & gMask) << greenShift<Format>();
- const uint b = ((c >> bRightShift) & bMask) << blueShift<Format>();
- storePixel<BPP>(dest, index + i, r | g | b);
- };
- } else {
- // We do ordered dither by using a rounding conversion, but instead of
- // adding half of input precision, we add the adjusted result from the
- // bayer matrix before narrowing.
- // Note: Rounding conversion in itself is different from the naive
- // conversion we do above for non-dithering.
- const uint *bayer_line = qt_bayer_matrix[dither->y & 15];
- for (int i = 0; i < count; ++i) {
- const uint c = fromRGB ? src[i] : qUnpremultiply(src[i]);
- const int d = bayer_line[(dither->x + i) & 15];
- const int dr = d - ((d + 1) >> rWidth);
- const int dg = d - ((d + 1) >> gWidth);
- const int db = d - ((d + 1) >> bWidth);
- int r = qRed(c);
- int g = qGreen(c);
- int b = qBlue(c);
- r = (r + ((dr - r) >> rWidth) + 1) >> (8 - rWidth);
- g = (g + ((dg - g) >> gWidth) + 1) >> (8 - gWidth);
- b = (b + ((db - b) >> bWidth) + 1) >> (8 - bWidth);
- const uint s = (r << redShift<Format>())
- | (g << greenShift<Format>())
- | (b << blueShift<Format>());
- storePixel<BPP>(dest, index + i, s);
- }
- }
-}
-
-template<QImage::Format Format, bool fromRGB>
-static void QT_FASTCALL storeARGBPMFromARGB32PM(uchar *dest, const uint *src, int index, int count,
- const QVector<QRgb> *, QDitherInfo *dither)
-{
- constexpr QPixelLayout::BPP BPP = bitsPerPixel<Format>();
- if (!dither) {
- Q_CONSTEXPR uint aMask = (1 << alphaWidth<Format>()) - 1;
- Q_CONSTEXPR uint rMask = (1 << redWidth<Format>()) - 1;
- Q_CONSTEXPR uint gMask = (1 << greenWidth<Format>()) - 1;
- Q_CONSTEXPR uint bMask = (1 << blueWidth<Format>()) - 1;
-
- Q_CONSTEXPR uchar aRightShift = 32 - alphaWidth<Format>();
- Q_CONSTEXPR uchar rRightShift = 24 - redWidth<Format>();
- Q_CONSTEXPR uchar gRightShift = 16 - greenWidth<Format>();
- Q_CONSTEXPR uchar bRightShift = 8 - blueWidth<Format>();
-
- Q_CONSTEXPR uint aOpaque = aMask << alphaShift<Format>();
- for (int i = 0; i < count; ++i) {
- const uint c = src[i];
- const uint a = fromRGB ? aOpaque : (((c >> aRightShift) & aMask) << alphaShift<Format>());
- const uint r = ((c >> rRightShift) & rMask) << redShift<Format>();
- const uint g = ((c >> gRightShift) & gMask) << greenShift<Format>();
- const uint b = ((c >> bRightShift) & bMask) << blueShift<Format>();
- storePixel<BPP>(dest, index + i, a | r | g | b);
- };
- } else {
- Q_CONSTEXPR uchar aWidth = alphaWidth<Format>();
- Q_CONSTEXPR uchar rWidth = redWidth<Format>();
- Q_CONSTEXPR uchar gWidth = greenWidth<Format>();
- Q_CONSTEXPR uchar bWidth = blueWidth<Format>();
-
- const uint *bayer_line = qt_bayer_matrix[dither->y & 15];
- for (int i = 0; i < count; ++i) {
- const uint c = src[i];
- const int d = bayer_line[(dither->x + i) & 15];
- const int da = d - ((d + 1) >> aWidth);
- const int dr = d - ((d + 1) >> rWidth);
- const int dg = d - ((d + 1) >> gWidth);
- const int db = d - ((d + 1) >> bWidth);
- int a = qAlpha(c);
- int r = qRed(c);
- int g = qGreen(c);
- int b = qBlue(c);
- if (fromRGB)
- a = (1 << aWidth) - 1;
- else
- a = (a + ((da - a) >> aWidth) + 1) >> (8 - aWidth);
- r = (r + ((dr - r) >> rWidth) + 1) >> (8 - rWidth);
- g = (g + ((dg - g) >> gWidth) + 1) >> (8 - gWidth);
- b = (b + ((db - b) >> bWidth) + 1) >> (8 - bWidth);
- uint s = (a << alphaShift<Format>())
- | (r << redShift<Format>())
- | (g << greenShift<Format>())
- | (b << blueShift<Format>());
- storePixel<BPP>(dest, index + i, s);
- }
- }
-}
-
-template<QImage::Format Format>
-static void QT_FASTCALL rbSwap(uchar *dst, const uchar *src, int count)
-{
- Q_CONSTEXPR uchar aWidth = alphaWidth<Format>();
- Q_CONSTEXPR uchar aShift = alphaShift<Format>();
- Q_CONSTEXPR uchar rWidth = redWidth<Format>();
- Q_CONSTEXPR uchar rShift = redShift<Format>();
- Q_CONSTEXPR uchar gWidth = greenWidth<Format>();
- Q_CONSTEXPR uchar gShift = greenShift<Format>();
- Q_CONSTEXPR uchar bWidth = blueWidth<Format>();
- Q_CONSTEXPR uchar bShift = blueShift<Format>();
-#ifdef Q_COMPILER_CONSTEXPR
- Q_STATIC_ASSERT(rWidth == bWidth);
-#endif
- Q_CONSTEXPR uint redBlueMask = (1 << rWidth) - 1;
- Q_CONSTEXPR uint alphaGreenMask = (((1 << aWidth) - 1) << aShift)
- | (((1 << gWidth) - 1) << gShift);
- constexpr QPixelLayout::BPP bpp = bitsPerPixel<Format>();
-
- for (int i = 0; i < count; ++i) {
- const uint c = fetchPixel<bpp>(src, i);
- const uint r = (c >> rShift) & redBlueMask;
- const uint b = (c >> bShift) & redBlueMask;
- const uint t = (c & alphaGreenMask)
- | (r << bShift)
- | (b << rShift);
- storePixel<bpp>(dst, i, t);
- }
-}
-
-static void QT_FASTCALL rbSwap_rgb32(uchar *d, const uchar *s, int count)
-{
- const uint *src = reinterpret_cast<const uint *>(s);
- uint *dest = reinterpret_cast<uint *>(d);
- for (int i = 0; i < count; ++i) {
- const uint c = src[i];
- const uint ag = c & 0xff00ff00;
- const uint rb = c & 0x00ff00ff;
- dest[i] = ag | (rb << 16) | (rb >> 16);
- }
-}
-
-#if Q_BYTE_ORDER == Q_LITTLE_ENDIAN
-template<>
-void QT_FASTCALL rbSwap<QImage::Format_RGBA8888>(uchar *d, const uchar *s, int count)
-{
- return rbSwap_rgb32(d, s, count);
-}
-#else
-template<>
-void QT_FASTCALL rbSwap<QImage::Format_RGBA8888>(uchar *d, const uchar *s, int count)
-{
- const uint *src = reinterpret_cast<const uint *>(s);
- uint *dest = reinterpret_cast<uint *>(d);
- for (int i = 0; i < count; ++i) {
- const uint c = src[i];
- const uint rb = c & 0xff00ff00;
- const uint ga = c & 0x00ff00ff;
- dest[i] = ga | (rb << 16) | (rb >> 16);
- }
-}
-#endif
-
-static void QT_FASTCALL rbSwap_rgb30(uchar *d, const uchar *s, int count)
-{
- const uint *src = reinterpret_cast<const uint *>(s);
- uint *dest = reinterpret_cast<uint *>(d);
- UNALIASED_CONVERSION_LOOP(dest, src, count, qRgbSwapRgb30);
-}
-
-template<QImage::Format Format> Q_DECL_CONSTEXPR static inline QPixelLayout pixelLayoutRGB()
-{
- return QPixelLayout{
- false,
- false,
- bitsPerPixel<Format>(),
- rbSwap<Format>,
- convertToRGB32<Format>,
- convertToRGB64<Format>,
- fetchRGBToRGB32<Format>,
- fetchRGBToRGB64<Format>,
- storeRGBFromARGB32PM<Format, false>,
- storeRGBFromARGB32PM<Format, true>
- };
-}
-
-template<QImage::Format Format> Q_DECL_CONSTEXPR static inline QPixelLayout pixelLayoutARGBPM()
-{
- return QPixelLayout{
- true,
- true,
- bitsPerPixel<Format>(),
- rbSwap<Format>,
- convertARGBPMToARGB32PM<Format>,
- convertARGBPMToRGBA64PM<Format>,
- fetchARGBPMToARGB32PM<Format>,
- fetchARGBPMToRGBA64PM<Format>,
- storeARGBPMFromARGB32PM<Format, false>,
- storeARGBPMFromARGB32PM<Format, true>
- };
+ buffer[i] = buffer[i].premultiplied();
}
-static void QT_FASTCALL convertIndexedToARGB32PM(uint *buffer, int count, const QVector<QRgb> *clut)
+static void QT_FASTCALL convertRGBA64PMToRGBA64PM(QRgba64 *, int)
{
- for (int i = 0; i < count; ++i)
- buffer[i] = qPremultiply(clut->at(buffer[i]));
}
-template<QPixelLayout::BPP BPP>
-static const uint *QT_FASTCALL fetchIndexedToARGB32PM(uint *buffer, const uchar *src, int index, int count,
- const QVector<QRgb> *clut, QDitherInfo *)
+static void QT_FASTCALL convertRGBA16FToRGBA64PM(QRgba64 *buffer, int count)
{
+ const QRgbaFloat16 *in = reinterpret_cast<const QRgbaFloat16 *>(buffer);
for (int i = 0; i < count; ++i) {
- const uint s = fetchPixel<BPP>(src, index + i);
- buffer[i] = qPremultiply(clut->at(s));
+ QRgbaFloat16 c = in[i];
+ buffer[i] = QRgba64::fromRgba64(c.red16(), c.green16(), c.blue16(), c.alpha16()).premultiplied();
}
- return buffer;
}
-template<QPixelLayout::BPP BPP>
-static const QRgba64 *QT_FASTCALL fetchIndexedToRGBA64PM(QRgba64 *buffer, const uchar *src, int index, int count,
- const QVector<QRgb> *clut, QDitherInfo *)
+static void QT_FASTCALL convertRGBA16FPMToRGBA64PM(QRgba64 *buffer, int count)
{
+ const QRgbaFloat16 *in = reinterpret_cast<const QRgbaFloat16 *>(buffer);
for (int i = 0; i < count; ++i) {
- const uint s = fetchPixel<BPP>(src, index + i);
- buffer[i] = QRgba64::fromArgb32(clut->at(s)).premultiplied();
+ QRgbaFloat16 c = in[i];
+ buffer[i] = QRgba64::fromRgba64(c.red16(), c.green16(), c.blue16(), c.alpha16());
}
- return buffer;
-}
-
-static const QRgba64 *QT_FASTCALL convertIndexedToRGBA64PM(QRgba64 *buffer, const uint *src, int count,
- const QVector<QRgb> *clut, QDitherInfo *)
-{
- for (int i = 0; i < count; ++i)
- buffer[i] = QRgba64::fromArgb32(clut->at(src[i])).premultiplied();
- return buffer;
-}
-
-static void QT_FASTCALL convertPassThrough(uint *, int, const QVector<QRgb> *)
-{
-}
-
-static const uint *QT_FASTCALL fetchPassThrough(uint *, const uchar *src, int index, int,
- const QVector<QRgb> *, QDitherInfo *)
-{
- return reinterpret_cast<const uint *>(src) + index;
-}
-
-static const QRgba64 *QT_FASTCALL fetchPassThrough64(QRgba64 *, const uchar *src, int index, int,
- const QVector<QRgb> *, QDitherInfo *)
-{
- return reinterpret_cast<const QRgba64 *>(src) + index;
-}
-
-static void QT_FASTCALL storePassThrough(uchar *dest, const uint *src, int index, int count,
- const QVector<QRgb> *, QDitherInfo *)
-{
- uint *d = reinterpret_cast<uint *>(dest) + index;
- if (d != src)
- memcpy(d, src, count * sizeof(uint));
-}
-
-static void QT_FASTCALL convertARGB32ToARGB32PM(uint *buffer, int count, const QVector<QRgb> *)
-{
- qt_convertARGB32ToARGB32PM(buffer, buffer, count);
-}
-
-static const uint *QT_FASTCALL fetchARGB32ToARGB32PM(uint *buffer, const uchar *src, int index, int count,
- const QVector<QRgb> *, QDitherInfo *)
-{
- return qt_convertARGB32ToARGB32PM(buffer, reinterpret_cast<const uint *>(src) + index, count);
-}
-
-static void QT_FASTCALL convertRGBA8888PMToARGB32PM(uint *buffer, int count, const QVector<QRgb> *)
-{
- for (int i = 0; i < count; ++i)
- buffer[i] = RGBA2ARGB(buffer[i]);
-}
-
-static const uint *QT_FASTCALL fetchRGBA8888PMToARGB32PM(uint *buffer, const uchar *src, int index, int count,
- const QVector<QRgb> *, QDitherInfo *)
-{
- const uint *s = reinterpret_cast<const uint *>(src) + index;
- UNALIASED_CONVERSION_LOOP(buffer, s, count, RGBA2ARGB);
- return buffer;
-}
-
-static void QT_FASTCALL convertRGBA8888ToARGB32PM(uint *buffer, int count, const QVector<QRgb> *)
-{
- qt_convertRGBA8888ToARGB32PM(buffer, buffer, count);
-}
-
-static const uint *QT_FASTCALL fetchRGBA8888ToARGB32PM(uint *buffer, const uchar *src, int index, int count,
- const QVector<QRgb> *, QDitherInfo *)
-{
- return qt_convertRGBA8888ToARGB32PM(buffer, reinterpret_cast<const uint *>(src) + index, count);
-}
-
-static void QT_FASTCALL convertAlpha8ToRGB32(uint *buffer, int count, const QVector<QRgb> *)
-{
- for (int i = 0; i < count; ++i)
- buffer[i] = qRgba(0, 0, 0, buffer[i]);
}
-static const uint *QT_FASTCALL fetchAlpha8ToRGB32(uint *buffer, const uchar *src, int index, int count,
- const QVector<QRgb> *, QDitherInfo *)
-{
- for (int i = 0; i < count; ++i)
- buffer[i] = qRgba(0, 0, 0, src[index + i]);
- return buffer;
-}
-
-static const QRgba64 *QT_FASTCALL convertAlpha8ToRGB64(QRgba64 *buffer, const uint *src, int count,
- const QVector<QRgb> *, QDitherInfo *)
-{
- for (int i = 0; i < count; ++i)
- buffer[i] = QRgba64::fromRgba(0, 0, 0, src[i]);
- return buffer;
-}
-static const QRgba64 *QT_FASTCALL fetchAlpha8ToRGB64(QRgba64 *buffer, const uchar *src, int index, int count,
- const QVector<QRgb> *, QDitherInfo *)
-{
- for (int i = 0; i < count; ++i)
- buffer[i] = QRgba64::fromRgba(0, 0, 0, src[index + i]);
- return buffer;
-}
-
-static void QT_FASTCALL convertGrayscale8ToRGB32(uint *buffer, int count, const QVector<QRgb> *)
+static void QT_FASTCALL convertRGBA32FToRGBA64PM(QRgba64 *buffer, int count)
{
+ const QRgbaFloat32 *in = reinterpret_cast<const QRgbaFloat32 *>(buffer);
for (int i = 0; i < count; ++i) {
- const uint s = buffer[i];
- buffer[i] = qRgb(s, s, s);
+ QRgbaFloat32 c = in[i];
+ buffer[i] = QRgba64::fromRgba64(c.red16(), c.green16(), c.blue16(), c.alpha16()).premultiplied();
}
}
-static const uint *QT_FASTCALL fetchGrayscale8ToRGB32(uint *buffer, const uchar *src, int index, int count,
- const QVector<QRgb> *, QDitherInfo *)
+static void QT_FASTCALL convertRGBA32FPMToRGBA64PM(QRgba64 *buffer, int count)
{
+ const QRgbaFloat32 *in = reinterpret_cast<const QRgbaFloat32 *>(buffer);
for (int i = 0; i < count; ++i) {
- const uint s = src[index + i];
- buffer[i] = qRgb(s, s, s);
+ QRgbaFloat32 c = in[i];
+ buffer[i] = QRgba64::fromRgba64(c.red16(), c.green16(), c.blue16(), c.alpha16());
}
- return buffer;
}
-static const QRgba64 *QT_FASTCALL convertGrayscale8ToRGB64(QRgba64 *buffer, const uint *src, int count,
- const QVector<QRgb> *, QDitherInfo *)
-{
- for (int i = 0; i < count; ++i)
- buffer[i] = QRgba64::fromRgba(src[i], src[i], src[i], 255);
- return buffer;
-}
-
-static const QRgba64 *QT_FASTCALL fetchGrayscale8ToRGB64(QRgba64 *buffer, const uchar *src, int index, int count,
- const QVector<QRgb> *, QDitherInfo *)
-{
- for (int i = 0; i < count; ++i) {
- const uint s = src[index + i];
- buffer[i] = QRgba64::fromRgba(s, s, s, 255);
- }
- return buffer;
-}
+static Convert64Func convert64ToRGBA64PM[] = {
+ nullptr,
+ nullptr,
+ nullptr,
+ nullptr,
+ nullptr,
+ nullptr,
+ nullptr,
+ nullptr,
+ nullptr,
+ nullptr,
+ nullptr,
+ nullptr,
+ nullptr,
+ nullptr,
+ nullptr,
+ nullptr,
+ nullptr,
+ nullptr,
+ nullptr,
+ nullptr,
+ nullptr,
+ nullptr,
+ nullptr,
+ nullptr,
+ nullptr,
+ convertRGBA64PMToRGBA64PM,
+ convertRGBA64ToRGBA64PM,
+ convertRGBA64PMToRGBA64PM,
+ nullptr,
+ nullptr,
+ convertRGBA16FPMToRGBA64PM,
+ convertRGBA16FToRGBA64PM,
+ convertRGBA16FPMToRGBA64PM,
+ convertRGBA32FPMToRGBA64PM,
+ convertRGBA32FToRGBA64PM,
+ convertRGBA32FPMToRGBA64PM,
+ nullptr,
+};
-static void QT_FASTCALL convertGrayscale16ToRGB32(uint *buffer, int count, const QVector<QRgb> *)
-{
- for (int i = 0; i < count; ++i) {
- const uint x = qt_div_257(buffer[i]);
- buffer[i] = qRgb(x, x, x);
- }
-}
+static_assert(std::size(convert64ToRGBA64PM) == QImage::NImageFormats);
+#endif
-static const uint *QT_FASTCALL fetchGrayscale16ToRGB32(uint *buffer, const uchar *src, int index, int count,
- const QVector<QRgb> *, QDitherInfo *)
+#if QT_CONFIG(raster_fp)
+static void QT_FASTCALL convertRGBA64PMToRGBA32F(QRgbaFloat32 *buffer, const quint64 *src, int count)
{
- const unsigned short *s = reinterpret_cast<const unsigned short *>(src) + index;
+ const auto *in = reinterpret_cast<const QRgba64 *>(src);
for (int i = 0; i < count; ++i) {
- const uint x = qt_div_257(s[i]);
- buffer[i] = qRgb(x, x, x);
+ auto c = in[i];
+ buffer[i] = QRgbaFloat32::fromRgba64(c.red(), c.green(), c.blue(), c.alpha()).premultiplied();
}
- return buffer;
}
-static const QRgba64 *QT_FASTCALL convertGrayscale16ToRGBA64(QRgba64 *buffer, const uint *src, int count,
- const QVector<QRgb> *, QDitherInfo *)
+static void QT_FASTCALL convertRGBA64ToRGBA32F(QRgbaFloat32 *buffer, const quint64 *src, int count)
{
- const unsigned short *s = reinterpret_cast<const unsigned short *>(src);
- for (int i = 0; i < count; ++i)
- buffer[i] = QRgba64::fromRgba64(s[i], s[i], s[i], 65535);
- return buffer;
-}
-
-static const QRgba64 *QT_FASTCALL fetchGrayscale16ToRGBA64(QRgba64 *buffer, const uchar *src, int index, int count,
- const QVector<QRgb> *, QDitherInfo *)
-{
- const unsigned short *s = reinterpret_cast<const unsigned short *>(src) + index;
+ const auto *in = reinterpret_cast<const QRgba64 *>(src);
for (int i = 0; i < count; ++i) {
- buffer[i] = QRgba64::fromRgba64(s[i], s[i], s[i], 65535);
- }
- return buffer;
-}
-
-static void QT_FASTCALL storeARGB32FromARGB32PM(uchar *dest, const uint *src, int index, int count,
- const QVector<QRgb> *, QDitherInfo *)
-{
- uint *d = reinterpret_cast<uint *>(dest) + index;
- UNALIASED_CONVERSION_LOOP(d, src, count, [](uint c) { return qUnpremultiply(c); });
-}
-
-static void QT_FASTCALL storeRGBA8888PMFromARGB32PM(uchar *dest, const uint *src, int index, int count,
- const QVector<QRgb> *, QDitherInfo *)
-{
- uint *d = reinterpret_cast<uint *>(dest) + index;
- UNALIASED_CONVERSION_LOOP(d, src, count, ARGB2RGBA);
-}
-
-#ifdef __SSE2__
-template<bool RGBA, bool maskAlpha>
-static inline void qConvertARGB32PMToRGBA64PM_sse2(QRgba64 *buffer, const uint *src, int count)
-{
- if (count <= 0)
- return;
-
- const __m128i amask = _mm_set1_epi32(0xff000000);
- int i = 0;
- for (; ((uintptr_t)buffer & 0xf) && i < count; ++i) {
- uint s = *src++;
- if (maskAlpha)
- s = s | 0xff000000;
- if (RGBA)
- s = RGBA2ARGB(s);
- *buffer++ = QRgba64::fromArgb32(s);
- }
- for (; i < count-3; i += 4) {
- __m128i vs = _mm_loadu_si128((const __m128i*)src);
- if (maskAlpha)
- vs = _mm_or_si128(vs, amask);
- src += 4;
- __m128i v1 = _mm_unpacklo_epi8(vs, vs);
- __m128i v2 = _mm_unpackhi_epi8(vs, vs);
- if (!RGBA) {
- v1 = _mm_shufflelo_epi16(v1, _MM_SHUFFLE(3, 0, 1, 2));
- v2 = _mm_shufflelo_epi16(v2, _MM_SHUFFLE(3, 0, 1, 2));
- v1 = _mm_shufflehi_epi16(v1, _MM_SHUFFLE(3, 0, 1, 2));
- v2 = _mm_shufflehi_epi16(v2, _MM_SHUFFLE(3, 0, 1, 2));
- }
- _mm_store_si128((__m128i*)(buffer), v1);
- buffer += 2;
- _mm_store_si128((__m128i*)(buffer), v2);
- buffer += 2;
- }
-
- SIMD_EPILOGUE(i, count, 3) {
- uint s = *src++;
- if (maskAlpha)
- s = s | 0xff000000;
- if (RGBA)
- s = RGBA2ARGB(s);
- *buffer++ = QRgba64::fromArgb32(s);
+ auto c = in[i];
+ buffer[i] = QRgbaFloat32::fromRgba64(c.red(), c.green(), c.blue(), c.alpha());
}
}
-template<QtPixelOrder PixelOrder>
-static inline void qConvertRGBA64PMToA2RGB30PM_sse2(uint *dest, const QRgba64 *buffer, int count)
-{
- const __m128i gmask = _mm_set1_epi32(0x000ffc00);
- const __m128i cmask = _mm_set1_epi32(0x000003ff);
- int i = 0;
- __m128i vr, vg, vb, va;
- for (; i < count && uintptr_t(buffer) & 0xF; ++i) {
- *dest++ = qConvertRgb64ToRgb30<PixelOrder>(*buffer++);
- }
-
- for (; i < count-15; i += 16) {
- // Repremultiplying is really expensive and hard to do in SIMD without AVX2,
- // so we try to avoid it by checking if it is needed 16 samples at a time.
- __m128i vOr = _mm_set1_epi32(0);
- __m128i vAnd = _mm_set1_epi32(0xffffffff);
- for (int j = 0; j < 16; j += 2) {
- __m128i vs = _mm_load_si128((const __m128i*)(buffer + j));
- vOr = _mm_or_si128(vOr, vs);
- vAnd = _mm_and_si128(vAnd, vs);
- }
- const quint16 orAlpha = ((uint)_mm_extract_epi16(vOr, 3)) | ((uint)_mm_extract_epi16(vOr, 7));
- const quint16 andAlpha = ((uint)_mm_extract_epi16(vAnd, 3)) & ((uint)_mm_extract_epi16(vAnd, 7));
-
- if (andAlpha == 0xffff) {
- for (int j = 0; j < 16; j += 2) {
- __m128i vs = _mm_load_si128((const __m128i*)buffer);
- buffer += 2;
- vr = _mm_srli_epi64(vs, 6);
- vg = _mm_srli_epi64(vs, 16 + 6 - 10);
- vb = _mm_srli_epi64(vs, 32 + 6);
- vr = _mm_and_si128(vr, cmask);
- vg = _mm_and_si128(vg, gmask);
- vb = _mm_and_si128(vb, cmask);
- va = _mm_srli_epi64(vs, 48 + 14);
- if (PixelOrder == PixelOrderRGB)
- vr = _mm_slli_epi32(vr, 20);
- else
- vb = _mm_slli_epi32(vb, 20);
- va = _mm_slli_epi32(va, 30);
- __m128i vd = _mm_or_si128(_mm_or_si128(vr, vg), _mm_or_si128(vb, va));
- vd = _mm_shuffle_epi32(vd, _MM_SHUFFLE(3, 1, 2, 0));
- _mm_storel_epi64((__m128i*)dest, vd);
- dest += 2;
- }
- } else if (orAlpha == 0) {
- for (int j = 0; j < 16; ++j) {
- *dest++ = 0;
- buffer++;
- }
- } else {
- for (int j = 0; j < 16; ++j)
- *dest++ = qConvertRgb64ToRgb30<PixelOrder>(*buffer++);
- }
- }
-
- SIMD_EPILOGUE(i, count, 15)
- *dest++ = qConvertRgb64ToRgb30<PixelOrder>(*buffer++);
-}
-#elif defined(__ARM_NEON__)
-template<bool RGBA, bool maskAlpha>
-static inline void qConvertARGB32PMToRGBA64PM_neon(QRgba64 *buffer, const uint *src, int count)
-{
- if (count <= 0)
- return;
-
- const uint32x4_t amask = vdupq_n_u32(0xff000000);
-#if defined(Q_PROCESSOR_ARM_64)
- const uint8x16_t rgbaMask = { 2, 1, 0, 3, 6, 5, 4, 7, 10, 9, 8, 11, 14, 13, 12, 15};
-#else
- const uint8x8_t rgbaMask = { 2, 1, 0, 3, 6, 5, 4, 7 };
-#endif
- int i = 0;
- for (; i < count-3; i += 4) {
- uint32x4_t vs32 = vld1q_u32(src);
- src += 4;
- if (maskAlpha)
- vs32 = vorrq_u32(vs32, amask);
- uint8x16_t vs8 = vreinterpretq_u8_u32(vs32);
- if (!RGBA) {
-#if defined(Q_PROCESSOR_ARM_64)
- vs8 = vqtbl1q_u8(vs8, rgbaMask);
-#else
- // no vqtbl1q_u8
- const uint8x8_t vlo = vtbl1_u8(vget_low_u8(vs8), rgbaMask);
- const uint8x8_t vhi = vtbl1_u8(vget_high_u8(vs8), rgbaMask);
- vs8 = vcombine_u8(vlo, vhi);
-#endif
- }
- uint8x16x2_t v = vzipq_u8(vs8, vs8);
-
- vst1q_u16((uint16_t *)buffer, vreinterpretq_u16_u8(v.val[0]));
- buffer += 2;
- vst1q_u16((uint16_t *)buffer, vreinterpretq_u16_u8(v.val[1]));
- buffer += 2;
- }
-
- SIMD_EPILOGUE(i, count, 3) {
- uint s = *src++;
- if (maskAlpha)
- s = s | 0xff000000;
- if (RGBA)
- s = RGBA2ARGB(s);
- *buffer++ = QRgba64::fromArgb32(s);
- }
-}
-#endif
-
-static const QRgba64 *QT_FASTCALL convertRGB32ToRGB64(QRgba64 *buffer, const uint *src, int count,
- const QVector<QRgb> *, QDitherInfo *)
-{
-#ifdef __SSE2__
- qConvertARGB32PMToRGBA64PM_sse2<false, true>(buffer, src, count);
-#elif defined(__ARM_NEON__)
- qConvertARGB32PMToRGBA64PM_neon<false, true>(buffer, src, count);
-#else
- for (int i = 0; i < count; ++i)
- buffer[i] = QRgba64::fromArgb32(0xff000000 | src[i]);
-#endif
- return buffer;
-}
-
-static const QRgba64 *QT_FASTCALL fetchRGB32ToRGB64(QRgba64 *buffer, const uchar *src, int index, int count,
- const QVector<QRgb> *, QDitherInfo *)
-{
- return convertRGB32ToRGB64(buffer, reinterpret_cast<const uint *>(src) + index, count, nullptr, nullptr);
-}
-
-static const QRgba64 *QT_FASTCALL convertARGB32ToRGBA64PM(QRgba64 *buffer, const uint *src, int count,
- const QVector<QRgb> *, QDitherInfo *)
-{
- for (int i = 0; i < count; ++i)
- buffer[i] = QRgba64::fromArgb32(src[i]).premultiplied();
- return buffer;
-}
-
-static const QRgba64 *QT_FASTCALL fetchARGB32ToRGBA64PM(QRgba64 *buffer, const uchar *src, int index, int count,
- const QVector<QRgb> *, QDitherInfo *)
-{
- return convertARGB32ToRGBA64PM(buffer, reinterpret_cast<const uint *>(src) + index, count, nullptr, nullptr);
-}
-
-static const QRgba64 *QT_FASTCALL convertARGB32PMToRGBA64PM(QRgba64 *buffer, const uint *src, int count,
- const QVector<QRgb> *, QDitherInfo *)
-{
-#ifdef __SSE2__
- qConvertARGB32PMToRGBA64PM_sse2<false, false>(buffer, src, count);
-#elif defined(__ARM_NEON__)
- qConvertARGB32PMToRGBA64PM_neon<false, false>(buffer, src, count);
-#else
- for (int i = 0; i < count; ++i)
- buffer[i] = QRgba64::fromArgb32(src[i]);
-#endif
- return buffer;
-}
-
-static const QRgba64 *QT_FASTCALL fetchARGB32PMToRGBA64PM(QRgba64 *buffer, const uchar *src, int index, int count,
- const QVector<QRgb> *, QDitherInfo *)
-{
- return convertARGB32PMToRGBA64PM(buffer, reinterpret_cast<const uint *>(src) + index, count, nullptr, nullptr);
-}
-
-#if QT_CONFIG(raster_64bit)
-static void convertRGBA64ToRGBA64PM(QRgba64 *buffer, int count)
+static void QT_FASTCALL convertRGBA16FPMToRGBA32F(QRgbaFloat32 *buffer, const quint64 *src, int count)
{
+ qFloatFromFloat16((float *)buffer, (const qfloat16 *)src, count * 4);
for (int i = 0; i < count; ++i)
buffer[i] = buffer[i].premultiplied();
}
-static void convertRGBA64PMToRGBA64PM(QRgba64 *, int)
-{
-}
-#endif
-
-static const QRgba64 *QT_FASTCALL fetchRGBA64ToRGBA64PM(QRgba64 *buffer, const uchar *src, int index, int count,
- const QVector<QRgb> *, QDitherInfo *)
-{
- const QRgba64 *s = reinterpret_cast<const QRgba64 *>(src) + index;
- for (int i = 0; i < count; ++i)
- buffer[i] = QRgba64::fromRgba64(s[i]).premultiplied();
- return buffer;
-}
-
-static const QRgba64 *QT_FASTCALL convertRGBA8888ToRGBA64PM(QRgba64 *buffer, const uint *src, int count,
- const QVector<QRgb> *, QDitherInfo *)
-{
- for (int i = 0; i < count; ++i)
- buffer[i] = QRgba64::fromArgb32(RGBA2ARGB(src[i])).premultiplied();
- return buffer;
-}
-
-static const QRgba64 *QT_FASTCALL fetchRGBA8888ToRGBA64PM(QRgba64 *buffer, const uchar *src, int index, int count,
- const QVector<QRgb> *, QDitherInfo *)
-{
- return convertRGBA8888ToRGBA64PM(buffer, reinterpret_cast<const uint *>(src) + index, count, nullptr, nullptr);
-}
-
-static const QRgba64 *QT_FASTCALL convertRGBA8888PMToRGBA64PM(QRgba64 *buffer, const uint *src, int count,
- const QVector<QRgb> *, QDitherInfo *)
-{
-#ifdef __SSE2__
- qConvertARGB32PMToRGBA64PM_sse2<true, false>(buffer, src, count);
-#elif defined(__ARM_NEON__)
- qConvertARGB32PMToRGBA64PM_neon<true, false>(buffer, src, count);
-#else
- for (int i = 0; i < count; ++i)
- buffer[i] = QRgba64::fromArgb32(RGBA2ARGB(src[i]));
-#endif
- return buffer;
-}
-
-static const QRgba64 *QT_FASTCALL fetchRGBA8888PMToRGBA64PM(QRgba64 *buffer, const uchar *src, int index, int count,
- const QVector<QRgb> *, QDitherInfo *)
-{
- return convertRGBA8888PMToRGBA64PM(buffer, reinterpret_cast<const uint *>(src) + index, count, nullptr, nullptr);
-}
-
-static void QT_FASTCALL storeRGBA8888FromARGB32PM(uchar *dest, const uint *src, int index, int count,
- const QVector<QRgb> *, QDitherInfo *)
-{
- uint *d = reinterpret_cast<uint *>(dest) + index;
- UNALIASED_CONVERSION_LOOP(d, src, count, [](uint c) { return ARGB2RGBA(qUnpremultiply(c)); });
-}
-
-static void QT_FASTCALL storeRGBXFromRGB32(uchar *dest, const uint *src, int index, int count,
- const QVector<QRgb> *, QDitherInfo *)
-{
- uint *d = reinterpret_cast<uint *>(dest) + index;
- UNALIASED_CONVERSION_LOOP(d, src, count, [](uint c) { return ARGB2RGBA(0xff000000 | c); });
-}
-
-static void QT_FASTCALL storeRGBXFromARGB32PM(uchar *dest, const uint *src, int index, int count,
- const QVector<QRgb> *, QDitherInfo *)
-{
- uint *d = reinterpret_cast<uint *>(dest) + index;
- UNALIASED_CONVERSION_LOOP(d, src, count, [](uint c) { return ARGB2RGBA(0xff000000 | qUnpremultiply(c)); });
-}
-
-template<QtPixelOrder PixelOrder>
-static void QT_FASTCALL convertA2RGB30PMToARGB32PM(uint *buffer, int count, const QVector<QRgb> *)
-{
- for (int i = 0; i < count; ++i)
- buffer[i] = qConvertA2rgb30ToArgb32<PixelOrder>(buffer[i]);
-}
-
-template<QtPixelOrder PixelOrder>
-static const uint *QT_FASTCALL fetchA2RGB30PMToARGB32PM(uint *buffer, const uchar *s, int index, int count,
- const QVector<QRgb> *, QDitherInfo *dither)
-{
- const uint *src = reinterpret_cast<const uint *>(s) + index;
- if (!dither) {
- UNALIASED_CONVERSION_LOOP(buffer, src, count, qConvertA2rgb30ToArgb32<PixelOrder>);
- } else {
- for (int i = 0; i < count; ++i) {
- const uint c = src[i];
- short d10 = (qt_bayer_matrix[dither->y & 15][(dither->x + i) & 15] << 2);
- short a10 = (c >> 30) * 0x155;
- short r10 = ((c >> 20) & 0x3ff);
- short g10 = ((c >> 10) & 0x3ff);
- short b10 = (c & 0x3ff);
- if (PixelOrder == PixelOrderBGR)
- std::swap(r10, b10);
- short a8 = (a10 + ((d10 - a10) >> 8)) >> 2;
- short r8 = (r10 + ((d10 - r10) >> 8)) >> 2;
- short g8 = (g10 + ((d10 - g10) >> 8)) >> 2;
- short b8 = (b10 + ((d10 - b10) >> 8)) >> 2;
- buffer[i] = qRgba(r8, g8, b8, a8);
- }
- }
- return buffer;
-}
-
-#ifdef __SSE2__
-template<QtPixelOrder PixelOrder>
-static inline void qConvertA2RGB30PMToRGBA64PM_sse2(QRgba64 *buffer, const uint *src, int count)
-{
- if (count <= 0)
- return;
-
- const __m128i rmask = _mm_set1_epi32(0x3ff00000);
- const __m128i gmask = _mm_set1_epi32(0x000ffc00);
- const __m128i bmask = _mm_set1_epi32(0x000003ff);
- const __m128i afactor = _mm_set1_epi16(0x5555);
- int i = 0;
-
- for (; ((uintptr_t)buffer & 0xf) && i < count; ++i)
- *buffer++ = qConvertA2rgb30ToRgb64<PixelOrder>(*src++);
-
- for (; i < count-3; i += 4) {
- __m128i vs = _mm_loadu_si128((const __m128i*)src);
- src += 4;
- __m128i va = _mm_srli_epi32(vs, 30);
- __m128i vr = _mm_and_si128(vs, rmask);
- __m128i vb = _mm_and_si128(vs, bmask);
- __m128i vg = _mm_and_si128(vs, gmask);
- va = _mm_mullo_epi16(va, afactor);
- vr = _mm_or_si128(_mm_srli_epi32(vr, 14), _mm_srli_epi32(vr, 24));
- vg = _mm_or_si128(_mm_srli_epi32(vg, 4), _mm_srli_epi32(vg, 14));
- vb = _mm_or_si128(_mm_slli_epi32(vb, 6), _mm_srli_epi32(vb, 4));
- __m128i vrb;
- if (PixelOrder == PixelOrderRGB)
- vrb = _mm_or_si128(vr, _mm_slli_si128(vb, 2));
- else
- vrb = _mm_or_si128(vb, _mm_slli_si128(vr, 2));
- __m128i vga = _mm_or_si128(vg, _mm_slli_si128(va, 2));
- _mm_store_si128((__m128i*)(buffer), _mm_unpacklo_epi16(vrb, vga));
- buffer += 2;
- _mm_store_si128((__m128i*)(buffer), _mm_unpackhi_epi16(vrb, vga));
- buffer += 2;
- }
-
- SIMD_EPILOGUE(i, count, 3)
- *buffer++ = qConvertA2rgb30ToRgb64<PixelOrder>(*src++);
-}
-#endif
-
-template<QtPixelOrder PixelOrder>
-static const QRgba64 *QT_FASTCALL convertA2RGB30PMToRGBA64PM(QRgba64 *buffer, const uint *src, int count,
- const QVector<QRgb> *, QDitherInfo *)
-{
-#ifdef __SSE2__
- qConvertA2RGB30PMToRGBA64PM_sse2<PixelOrder>(buffer, src, count);
-#else
- for (int i = 0; i < count; ++i)
- buffer[i] = qConvertA2rgb30ToRgb64<PixelOrder>(src[i]);
-#endif
- return buffer;
-}
-
-template<QtPixelOrder PixelOrder>
-static const QRgba64 *QT_FASTCALL fetchA2RGB30PMToRGBA64PM(QRgba64 *buffer, const uchar *src, int index, int count,
- const QVector<QRgb> *, QDitherInfo *)
-{
- return convertA2RGB30PMToRGBA64PM<PixelOrder>(buffer, reinterpret_cast<const uint *>(src) + index, count, nullptr, nullptr);
-}
-
-template<QtPixelOrder PixelOrder>
-static void QT_FASTCALL storeA2RGB30PMFromARGB32PM(uchar *dest, const uint *src, int index, int count,
- const QVector<QRgb> *, QDitherInfo *)
-{
- uint *d = reinterpret_cast<uint *>(dest) + index;
- UNALIASED_CONVERSION_LOOP(d, src, count, qConvertArgb32ToA2rgb30<PixelOrder>);
-}
-
-template<QtPixelOrder PixelOrder>
-static void QT_FASTCALL storeRGB30FromRGB32(uchar *dest, const uint *src, int index, int count,
- const QVector<QRgb> *, QDitherInfo *)
-{
- uint *d = reinterpret_cast<uint *>(dest) + index;
- UNALIASED_CONVERSION_LOOP(d, src, count, qConvertRgb32ToRgb30<PixelOrder>);
-}
-
-template<QtPixelOrder PixelOrder>
-static void QT_FASTCALL storeRGB30FromARGB32PM(uchar *dest, const uint *src, int index, int count,
- const QVector<QRgb> *, QDitherInfo *)
-{
- uint *d = reinterpret_cast<uint *>(dest) + index;
- UNALIASED_CONVERSION_LOOP(d, src, count, qConvertRgb32ToRgb30<PixelOrder>);
-}
-
-template<bool RGBA>
-void qt_convertRGBA64ToARGB32(uint *dst, const QRgba64 *src, int count)
-{
- int i = 0;
-#ifdef __SSE2__
- if (((uintptr_t)dst & 0x7) && count > 0) {
- uint s = (*src++).toArgb32();
- if (RGBA)
- s = ARGB2RGBA(s);
- *dst++ = s;
- i++;
- }
- const __m128i vhalf = _mm_set1_epi32(0x80);
- const __m128i vzero = _mm_setzero_si128();
- for (; i < count-1; i += 2) {
- __m128i vs = _mm_loadu_si128((const __m128i*)src);
- src += 2;
- if (!RGBA) {
- vs = _mm_shufflelo_epi16(vs, _MM_SHUFFLE(3, 0, 1, 2));
- vs = _mm_shufflehi_epi16(vs, _MM_SHUFFLE(3, 0, 1, 2));
- }
- __m128i v1 = _mm_unpacklo_epi16(vs, vzero);
- __m128i v2 = _mm_unpackhi_epi16(vs, vzero);
- v1 = _mm_add_epi32(v1, vhalf);
- v2 = _mm_add_epi32(v2, vhalf);
- v1 = _mm_sub_epi32(v1, _mm_srli_epi32(v1, 8));
- v2 = _mm_sub_epi32(v2, _mm_srli_epi32(v2, 8));
- v1 = _mm_srli_epi32(v1, 8);
- v2 = _mm_srli_epi32(v2, 8);
- v1 = _mm_packs_epi32(v1, v2);
- v1 = _mm_packus_epi16(v1, vzero);
- _mm_storel_epi64((__m128i*)(dst), v1);
- dst += 2;
- }
-#endif
- for (; i < count; i++) {
- uint s = (*src++).toArgb32();
- if (RGBA)
- s = ARGB2RGBA(s);
- *dst++ = s;
- }
-}
-template void qt_convertRGBA64ToARGB32<false>(uint *dst, const QRgba64 *src, int count);
-template void qt_convertRGBA64ToARGB32<true>(uint *dst, const QRgba64 *src, int count);
-
-
-static void QT_FASTCALL storeAlpha8FromARGB32PM(uchar *dest, const uint *src, int index, int count,
- const QVector<QRgb> *, QDitherInfo *)
-{
- for (int i = 0; i < count; ++i)
- dest[index + i] = qAlpha(src[i]);
-}
-
-static void QT_FASTCALL storeGrayscale8FromRGB32(uchar *dest, const uint *src, int index, int count,
- const QVector<QRgb> *, QDitherInfo *)
-{
- for (int i = 0; i < count; ++i)
- dest[index + i] = qGray(src[i]);
-}
-
-static void QT_FASTCALL storeGrayscale8FromARGB32PM(uchar *dest, const uint *src, int index, int count,
- const QVector<QRgb> *, QDitherInfo *)
-{
- for (int i = 0; i < count; ++i)
- dest[index + i] = qGray(qUnpremultiply(src[i]));
-}
-
-static void QT_FASTCALL storeGrayscale16FromRGB32(uchar *dest, const uint *src, int index, int count,
- const QVector<QRgb> *, QDitherInfo *)
-{
- unsigned short *d = reinterpret_cast<unsigned short *>(dest) + index;
- for (int i = 0; i < count; ++i)
- d[i] = qGray(src[i]) * 257;
-}
-
-static void QT_FASTCALL storeGrayscale16FromARGB32PM(uchar *dest, const uint *src, int index, int count,
- const QVector<QRgb> *, QDitherInfo *)
-{
- unsigned short *d = reinterpret_cast<unsigned short *>(dest) + index;
- for (int i = 0; i < count; ++i)
- d[i] = qGray(qUnpremultiply(src[i])) * 257;
-}
-
-static const uint *QT_FASTCALL fetchRGB64ToRGB32(uint *buffer, const uchar *src, int index, int count,
- const QVector<QRgb> *, QDitherInfo *)
-{
- const QRgba64 *s = reinterpret_cast<const QRgba64 *>(src) + index;
- for (int i = 0; i < count; ++i)
- buffer[i] = toArgb32(s[i]);
- return buffer;
-}
-
-static void QT_FASTCALL storeRGB64FromRGB32(uchar *dest, const uint *src, int index, int count,
- const QVector<QRgb> *, QDitherInfo *)
+static void QT_FASTCALL convertRGBA16FToRGBA32F(QRgbaFloat32 *buffer, const quint64 *src, int count)
{
- QRgba64 *d = reinterpret_cast<QRgba64 *>(dest) + index;
- for (int i = 0; i < count; ++i)
- d[i] = QRgba64::fromArgb32(src[i]);
-}
-
-static const uint *QT_FASTCALL fetchRGBA64ToARGB32PM(uint *buffer, const uchar *src, int index, int count,
- const QVector<QRgb> *, QDitherInfo *)
-{
- const QRgba64 *s = reinterpret_cast<const QRgba64 *>(src) + index;
- for (int i = 0; i < count; ++i)
- buffer[i] = toArgb32(s[i].premultiplied());
- return buffer;
+ qFloatFromFloat16((float *)buffer, (const qfloat16 *)src, count * 4);
}
-static void QT_FASTCALL storeRGBA64FromARGB32PM(uchar *dest, const uint *src, int index, int count,
- const QVector<QRgb> *, QDitherInfo *)
-{
- QRgba64 *d = reinterpret_cast<QRgba64 *>(dest) + index;
- for (int i = 0; i < count; ++i)
- d[i] = QRgba64::fromArgb32(src[i]).unpremultiplied();
-}
-
-// Note:
-// convertToArgb32() assumes that no color channel is less than 4 bits.
-// storeRGBFromARGB32PM() assumes that no color channel is more than 8 bits.
-// QImage::rgbSwapped() assumes that the red and blue color channels have the same number of bits.
-QPixelLayout qPixelLayouts[QImage::NImageFormats] = {
- { false, false, QPixelLayout::BPPNone, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr }, // Format_Invalid
- { false, false, QPixelLayout::BPP1MSB, nullptr,
- convertIndexedToARGB32PM, convertIndexedToRGBA64PM,
- fetchIndexedToARGB32PM<QPixelLayout::BPP1MSB>, fetchIndexedToRGBA64PM<QPixelLayout::BPP1MSB>,
- nullptr, nullptr }, // Format_Mono
- { false, false, QPixelLayout::BPP1LSB, nullptr,
- convertIndexedToARGB32PM, convertIndexedToRGBA64PM,
- fetchIndexedToARGB32PM<QPixelLayout::BPP1LSB>, fetchIndexedToRGBA64PM<QPixelLayout::BPP1LSB>,
- nullptr, nullptr }, // Format_MonoLSB
- { false, false, QPixelLayout::BPP8, nullptr,
- convertIndexedToARGB32PM, convertIndexedToRGBA64PM,
- fetchIndexedToARGB32PM<QPixelLayout::BPP8>, fetchIndexedToRGBA64PM<QPixelLayout::BPP8>,
- nullptr, nullptr }, // Format_Indexed8
- // Technically using convertPassThrough to convert from ARGB32PM to RGB32 is wrong,
- // but everywhere this generic conversion would be wrong is currently overloaded.
- { false, false, QPixelLayout::BPP32, rbSwap_rgb32, convertPassThrough,
- convertRGB32ToRGB64, fetchPassThrough, fetchRGB32ToRGB64, storePassThrough, storePassThrough }, // Format_RGB32
- { true, false, QPixelLayout::BPP32, rbSwap_rgb32, convertARGB32ToARGB32PM,
- convertARGB32ToRGBA64PM, fetchARGB32ToARGB32PM, fetchARGB32ToRGBA64PM, storeARGB32FromARGB32PM, storePassThrough }, // Format_ARGB32
- { true, true, QPixelLayout::BPP32, rbSwap_rgb32, convertPassThrough,
- convertARGB32PMToRGBA64PM, fetchPassThrough, fetchARGB32PMToRGBA64PM, storePassThrough, storePassThrough }, // Format_ARGB32_Premultiplied
- pixelLayoutRGB<QImage::Format_RGB16>(),
- pixelLayoutARGBPM<QImage::Format_ARGB8565_Premultiplied>(),
- pixelLayoutRGB<QImage::Format_RGB666>(),
- pixelLayoutARGBPM<QImage::Format_ARGB6666_Premultiplied>(),
- pixelLayoutRGB<QImage::Format_RGB555>(),
- pixelLayoutARGBPM<QImage::Format_ARGB8555_Premultiplied>(),
- pixelLayoutRGB<QImage::Format_RGB888>(),
- pixelLayoutRGB<QImage::Format_RGB444>(),
- pixelLayoutARGBPM<QImage::Format_ARGB4444_Premultiplied>(),
- { false, false, QPixelLayout::BPP32, rbSwap<QImage::Format_RGBA8888>, convertRGBA8888PMToARGB32PM,
- convertRGBA8888PMToRGBA64PM, fetchRGBA8888PMToARGB32PM, fetchRGBA8888PMToRGBA64PM, storeRGBXFromARGB32PM, storeRGBXFromRGB32 }, // Format_RGBX8888
- { true, false, QPixelLayout::BPP32, rbSwap<QImage::Format_RGBA8888>, convertRGBA8888ToARGB32PM,
- convertRGBA8888ToRGBA64PM, fetchRGBA8888ToARGB32PM, fetchRGBA8888ToRGBA64PM, storeRGBA8888FromARGB32PM, storeRGBXFromRGB32 }, // Format_RGBA8888
- { true, true, QPixelLayout::BPP32, rbSwap<QImage::Format_RGBA8888>, convertRGBA8888PMToARGB32PM,
- convertRGBA8888PMToRGBA64PM, fetchRGBA8888PMToARGB32PM, fetchRGBA8888PMToRGBA64PM, storeRGBA8888PMFromARGB32PM, storeRGBXFromRGB32 }, // Format_RGBA8888_Premultiplied
- { false, false, QPixelLayout::BPP32, rbSwap_rgb30,
- convertA2RGB30PMToARGB32PM<PixelOrderBGR>,
- convertA2RGB30PMToRGBA64PM<PixelOrderBGR>,
- fetchA2RGB30PMToARGB32PM<PixelOrderBGR>,
- fetchA2RGB30PMToRGBA64PM<PixelOrderBGR>,
- storeRGB30FromARGB32PM<PixelOrderBGR>,
- storeRGB30FromRGB32<PixelOrderBGR>
- }, // Format_BGR30
- { true, true, QPixelLayout::BPP32, rbSwap_rgb30,
- convertA2RGB30PMToARGB32PM<PixelOrderBGR>,
- convertA2RGB30PMToRGBA64PM<PixelOrderBGR>,
- fetchA2RGB30PMToARGB32PM<PixelOrderBGR>,
- fetchA2RGB30PMToRGBA64PM<PixelOrderBGR>,
- storeA2RGB30PMFromARGB32PM<PixelOrderBGR>,
- storeRGB30FromRGB32<PixelOrderBGR>
- }, // Format_A2BGR30_Premultiplied
- { false, false, QPixelLayout::BPP32, rbSwap_rgb30,
- convertA2RGB30PMToARGB32PM<PixelOrderRGB>,
- convertA2RGB30PMToRGBA64PM<PixelOrderRGB>,
- fetchA2RGB30PMToARGB32PM<PixelOrderRGB>,
- fetchA2RGB30PMToRGBA64PM<PixelOrderRGB>,
- storeRGB30FromARGB32PM<PixelOrderRGB>,
- storeRGB30FromRGB32<PixelOrderRGB>
- }, // Format_RGB30
- { true, true, QPixelLayout::BPP32, rbSwap_rgb30,
- convertA2RGB30PMToARGB32PM<PixelOrderRGB>,
- convertA2RGB30PMToRGBA64PM<PixelOrderRGB>,
- fetchA2RGB30PMToARGB32PM<PixelOrderRGB>,
- fetchA2RGB30PMToRGBA64PM<PixelOrderRGB>,
- storeA2RGB30PMFromARGB32PM<PixelOrderRGB>,
- storeRGB30FromRGB32<PixelOrderRGB>
- }, // Format_A2RGB30_Premultiplied
- { true, true, QPixelLayout::BPP8, nullptr,
- convertAlpha8ToRGB32, convertAlpha8ToRGB64,
- fetchAlpha8ToRGB32, fetchAlpha8ToRGB64,
- storeAlpha8FromARGB32PM, nullptr }, // Format_Alpha8
- { false, false, QPixelLayout::BPP8, nullptr,
- convertGrayscale8ToRGB32, convertGrayscale8ToRGB64,
- fetchGrayscale8ToRGB32, fetchGrayscale8ToRGB64,
- storeGrayscale8FromARGB32PM, storeGrayscale8FromRGB32 }, // Format_Grayscale8
- { false, false, QPixelLayout::BPP64, nullptr,
- convertPassThrough, nullptr,
- fetchRGB64ToRGB32, fetchPassThrough64,
- storeRGB64FromRGB32, storeRGB64FromRGB32 }, // Format_RGBX64
- { true, false, QPixelLayout::BPP64, nullptr,
- convertARGB32ToARGB32PM, nullptr,
- fetchRGBA64ToARGB32PM, fetchRGBA64ToRGBA64PM,
- storeRGBA64FromARGB32PM, storeRGB64FromRGB32 }, // Format_RGBA64
- { true, true, QPixelLayout::BPP64, nullptr,
- convertPassThrough, nullptr,
- fetchRGB64ToRGB32, fetchPassThrough64,
- storeRGB64FromRGB32, storeRGB64FromRGB32 }, // Format_RGBA64_Premultiplied
- { false, false, QPixelLayout::BPP16, nullptr,
- convertGrayscale16ToRGB32, convertGrayscale16ToRGBA64,
- fetchGrayscale16ToRGB32, fetchGrayscale16ToRGBA64,
- storeGrayscale16FromARGB32PM, storeGrayscale16FromRGB32 }, // Format_Grayscale16
- pixelLayoutRGB<QImage::Format_BGR888>(),
+static Convert64ToFPFunc convert64ToRGBA32F[] = {
+ nullptr,
+ nullptr,
+ nullptr,
+ nullptr,
+ nullptr,
+ nullptr,
+ nullptr,
+ nullptr,
+ nullptr,
+ nullptr,
+ nullptr,
+ nullptr,
+ nullptr,
+ nullptr,
+ nullptr,
+ nullptr,
+ nullptr,
+ nullptr,
+ nullptr,
+ nullptr,
+ nullptr,
+ nullptr,
+ nullptr,
+ nullptr,
+ nullptr,
+ convertRGBA64ToRGBA32F,
+ convertRGBA64PMToRGBA32F,
+ convertRGBA64ToRGBA32F,
+ nullptr,
+ nullptr,
+ convertRGBA16FToRGBA32F,
+ convertRGBA16FPMToRGBA32F,
+ convertRGBA16FToRGBA32F,
+ nullptr,
+ nullptr,
+ nullptr,
+ nullptr,
};
-Q_STATIC_ASSERT(sizeof(qPixelLayouts) / sizeof(*qPixelLayouts) == QImage::NImageFormats);
-
-static void QT_FASTCALL convertFromRgb64(uint *dest, const QRgba64 *src, int length)
-{
- for (int i = 0; i < length; ++i) {
- dest[i] = toArgb32(src[i]);
- }
-}
-
-template<QImage::Format format>
-static void QT_FASTCALL storeGenericFromRGBA64PM(uchar *dest, const QRgba64 *src, int index, int count,
- const QVector<QRgb> *clut, QDitherInfo *dither)
-{
- uint buffer[BufferSize];
- convertFromRgb64(buffer, src, count);
- qPixelLayouts[format].storeFromARGB32PM(dest, buffer, index, count, clut, dither);
-}
+static_assert(std::size(convert64ToRGBA32F) == QImage::NImageFormats);
-static void QT_FASTCALL storeARGB32FromRGBA64PM(uchar *dest, const QRgba64 *src, int index, int count,
- const QVector<QRgb> *, QDitherInfo *)
+static void convertRGBA32FToRGBA32FPM(QRgbaFloat32 *buffer, int count)
{
- uint *d = (uint*)dest + index;
for (int i = 0; i < count; ++i)
- d[i] = toArgb32(src[i].unpremultiplied());
+ buffer[i] = buffer[i].premultiplied();
}
-static void QT_FASTCALL storeRGBA8888FromRGBA64PM(uchar *dest, const QRgba64 *src, int index, int count,
- const QVector<QRgb> *, QDitherInfo *)
+static void convertRGBA32FToRGBA32F(QRgbaFloat32 *, int)
{
- uint *d = (uint*)dest + index;
- for (int i = 0; i < count; ++i)
- d[i] = toRgba8888(src[i].unpremultiplied());
}
-template<QtPixelOrder PixelOrder>
-static void QT_FASTCALL storeRGB30FromRGBA64PM(uchar *dest, const QRgba64 *src, int index, int count,
- const QVector<QRgb> *, QDitherInfo *)
-{
- uint *d = (uint*)dest + index;
-#ifdef __SSE2__
- qConvertRGBA64PMToA2RGB30PM_sse2<PixelOrder>(d, src, count);
-#else
- for (int i = 0; i < count; ++i)
- d[i] = qConvertRgb64ToRgb30<PixelOrder>(src[i]);
#endif
-}
-
-static void QT_FASTCALL storeRGBX64FromRGBA64PM(uchar *dest, const QRgba64 *src, int index, int count,
- const QVector<QRgb> *, QDitherInfo *)
-{
- QRgba64 *d = reinterpret_cast<QRgba64*>(dest) + index;
- for (int i = 0; i < count; ++i) {
- d[i] = src[i].unpremultiplied();
- d[i].setAlpha(65535);
- }
-}
-
-static void QT_FASTCALL storeRGBA64FromRGBA64PM(uchar *dest, const QRgba64 *src, int index, int count,
- const QVector<QRgb> *, QDitherInfo *)
-{
- QRgba64 *d = reinterpret_cast<QRgba64*>(dest) + index;
- for (int i = 0; i < count; ++i)
- d[i] = src[i].unpremultiplied();
-}
-
-static void QT_FASTCALL storeRGBA64PMFromRGBA64PM(uchar *dest, const QRgba64 *src, int index, int count,
- const QVector<QRgb> *, QDitherInfo *)
-{
- QRgba64 *d = reinterpret_cast<QRgba64*>(dest) + index;
- if (d != src)
- memcpy(d, src, count * sizeof(QRgba64));
-}
-
-static void QT_FASTCALL storeGray16FromRGBA64PM(uchar *dest, const QRgba64 *src, int index, int count,
- const QVector<QRgb> *, QDitherInfo *)
-{
- quint16 *d = reinterpret_cast<quint16*>(dest) + index;
- for (int i = 0; i < count; ++i) {
- QRgba64 s = src[i].unpremultiplied();
- d[i] = qGray(s.red(), s.green(), s.blue());
- }
-}
-
-ConvertAndStorePixelsFunc64 qStoreFromRGBA64PM[QImage::NImageFormats] = {
- nullptr,
- nullptr,
- nullptr,
- nullptr,
- storeGenericFromRGBA64PM<QImage::Format_RGB32>,
- storeARGB32FromRGBA64PM,
- storeGenericFromRGBA64PM<QImage::Format_ARGB32_Premultiplied>,
- storeGenericFromRGBA64PM<QImage::Format_RGB16>,
- storeGenericFromRGBA64PM<QImage::Format_ARGB8565_Premultiplied>,
- storeGenericFromRGBA64PM<QImage::Format_RGB666>,
- storeGenericFromRGBA64PM<QImage::Format_ARGB6666_Premultiplied>,
- storeGenericFromRGBA64PM<QImage::Format_RGB555>,
- storeGenericFromRGBA64PM<QImage::Format_ARGB8555_Premultiplied>,
- storeGenericFromRGBA64PM<QImage::Format_RGB888>,
- storeGenericFromRGBA64PM<QImage::Format_RGB444>,
- storeGenericFromRGBA64PM<QImage::Format_ARGB4444_Premultiplied>,
- storeGenericFromRGBA64PM<QImage::Format_RGBX8888>,
- storeRGBA8888FromRGBA64PM,
- storeGenericFromRGBA64PM<QImage::Format_RGBA8888_Premultiplied>,
- storeRGB30FromRGBA64PM<PixelOrderBGR>,
- storeRGB30FromRGBA64PM<PixelOrderBGR>,
- storeRGB30FromRGBA64PM<PixelOrderRGB>,
- storeRGB30FromRGBA64PM<PixelOrderRGB>,
- storeGenericFromRGBA64PM<QImage::Format_Alpha8>,
- storeGenericFromRGBA64PM<QImage::Format_Grayscale8>,
- storeRGBX64FromRGBA64PM,
- storeRGBA64FromRGBA64PM,
- storeRGBA64PMFromRGBA64PM,
- storeGray16FromRGBA64PM,
- storeGenericFromRGBA64PM<QImage::Format_BGR888>,
-};
/*
Destination fetch. This is simple as we don't have to do bounds checks or
@@ -1711,7 +359,7 @@ static uint *QT_FASTCALL destFetchUndefined(uint *buffer, QRasterBuffer *, int,
return buffer;
}
-static DestFetchProc destFetchProc[QImage::NImageFormats] =
+static DestFetchProc destFetchProc[] =
{
nullptr, // Format_Invalid
destFetchMono, // Format_Mono,
@@ -1743,8 +391,17 @@ static DestFetchProc destFetchProc[QImage::NImageFormats] =
destFetch, // Format_RGBA64_Premultiplied
destFetch, // Format_Grayscale16
destFetch, // Format_BGR888
+ destFetch, // Format_RGBX16FPx4
+ destFetch, // Format_RGBA16FPx4
+ destFetch, // Format_RGBA16FPx4_Premultiplied
+ destFetch, // Format_RGBX32FPx4
+ destFetch, // Format_RGBA32FPx4
+ destFetch, // Format_RGBA32FPx4_Premultiplied
+ destFetch, // Format_CMYK8888
};
+static_assert(std::size(destFetchProc) == QImage::NImageFormats);
+
#if QT_CONFIG(raster_64bit)
static QRgba64 *QT_FASTCALL destFetch64(QRgba64 *buffer, QRasterBuffer *rasterBuffer, int x, int y, int length)
{
@@ -1762,7 +419,7 @@ static QRgba64 * QT_FASTCALL destFetch64Undefined(QRgba64 *buffer, QRasterBuffer
return buffer;
}
-static DestFetchProc64 destFetchProc64[QImage::NImageFormats] =
+static DestFetchProc64 destFetchProc64[] =
{
nullptr, // Format_Invalid
nullptr, // Format_Mono,
@@ -1794,7 +451,75 @@ static DestFetchProc64 destFetchProc64[QImage::NImageFormats] =
destFetchRGB64, // Format_RGBA64_Premultiplied
destFetch64, // Format_Grayscale16
destFetch64, // Format_BGR888
+ destFetch64, // Format_RGBX16FPx4
+ destFetch64, // Format_RGBA16FPx4
+ destFetch64, // Format_RGBA16FPx4_Premultiplied
+ destFetch64, // Format_RGBX32FPx4
+ destFetch64, // Format_RGBA32FPx4
+ destFetch64, // Format_RGBA32FPx4_Premultiplied
+ destFetch64, // Format_CMYK8888
+};
+
+static_assert(std::size(destFetchProc64) == QImage::NImageFormats);
+#endif
+
+#if QT_CONFIG(raster_fp)
+static QRgbaFloat32 *QT_FASTCALL destFetchFP(QRgbaFloat32 *buffer, QRasterBuffer *rasterBuffer, int x, int y, int length)
+{
+ return const_cast<QRgbaFloat32 *>(qFetchToRGBA32F[rasterBuffer->format](buffer, rasterBuffer->scanLine(y), x, length, nullptr, nullptr));
+}
+
+static QRgbaFloat32 *QT_FASTCALL destFetchRGBFP(QRgbaFloat32 *, QRasterBuffer *rasterBuffer, int x, int y, int)
+{
+ return reinterpret_cast<QRgbaFloat32 *>(rasterBuffer->scanLine(y)) + x;
+}
+
+static QRgbaFloat32 *QT_FASTCALL destFetchFPUndefined(QRgbaFloat32 *buffer, QRasterBuffer *, int, int, int)
+{
+ return buffer;
+}
+static DestFetchProcFP destFetchProcFP[] =
+{
+ nullptr, // Format_Invalid
+ nullptr, // Format_Mono,
+ nullptr, // Format_MonoLSB
+ nullptr, // Format_Indexed8
+ destFetchFP, // Format_RGB32
+ destFetchFP, // Format_ARGB32,
+ destFetchFP, // Format_ARGB32_Premultiplied
+ destFetchFP, // Format_RGB16
+ destFetchFP, // Format_ARGB8565_Premultiplied
+ destFetchFP, // Format_RGB666
+ destFetchFP, // Format_ARGB6666_Premultiplied
+ destFetchFP, // Format_RGB555
+ destFetchFP, // Format_ARGB8555_Premultiplied
+ destFetchFP, // Format_RGB888
+ destFetchFP, // Format_RGB444
+ destFetchFP, // Format_ARGB4444_Premultiplied
+ destFetchFP, // Format_RGBX8888
+ destFetchFP, // Format_RGBA8888
+ destFetchFP, // Format_RGBA8888_Premultiplied
+ destFetchFP, // Format_BGR30
+ destFetchFP, // Format_A2BGR30_Premultiplied
+ destFetchFP, // Format_RGB30
+ destFetchFP, // Format_A2RGB30_Premultiplied
+ destFetchFP, // Format_Alpha8
+ destFetchFP, // Format_Grayscale8
+ destFetchFP, // Format_RGBX64
+ destFetchFP, // Format_RGBA64
+ destFetchFP, // Format_RGBA64_Premultiplied
+ destFetchFP, // Format_Grayscale16
+ destFetchFP, // Format_BGR888
+ destFetchFP, // Format_RGBX16FPx4
+ destFetchFP, // Format_RGBA16FPx4
+ destFetchFP, // Format_RGBA16FPx4_Premultiplied
+ destFetchRGBFP, // Format_RGBX32FPx4
+ destFetchFP, // Format_RGBA32FPx4
+ destFetchRGBFP, // Format_RGBA32FPx4_Premultiplied
+ destFetchFP, // Format_CMYK8888
};
+
+static_assert(std::size(destFetchProcFP) == QImage::NImageFormats);
#endif
/*
@@ -1803,9 +528,8 @@ static DestFetchProc64 destFetchProc64[QImage::NImageFormats] =
*/
static inline QRgb findNearestColor(QRgb color, QRasterBuffer *rbuf)
{
- QRgb color_0 = qPremultiply(rbuf->destColor0);
- QRgb color_1 = qPremultiply(rbuf->destColor1);
- color = qPremultiply(color);
+ const QRgb color_0 = rbuf->destColor0;
+ const QRgb color_1 = rbuf->destColor1;
int r = qRed(color);
int g = qGreen(color);
@@ -1903,7 +627,52 @@ static void QT_FASTCALL destStore(QRasterBuffer *rasterBuffer, int x, int y, con
store(dest, buffer, x, length, nullptr, nullptr);
}
-static DestStoreProc destStoreProc[QImage::NImageFormats] =
+static void QT_FASTCALL destStoreGray8(QRasterBuffer *rasterBuffer, int x, int y, const uint *buffer, int length)
+{
+ uchar *data = rasterBuffer->scanLine(y) + x;
+
+ bool failed = false;
+ for (int k = 0; k < length; ++k) {
+ if (!qIsGray(buffer[k])) {
+ failed = true;
+ break;
+ }
+ data[k] = qRed(buffer[k]);
+ }
+ if (failed) { // Non-gray colors
+ QColorSpace fromCS = rasterBuffer->colorSpace.isValid() ? rasterBuffer->colorSpace : QColorSpace::SRgb;
+ QColorTransform tf = QColorSpacePrivate::get(fromCS)->transformationToXYZ();
+ QColorTransformPrivate *tfd = QColorTransformPrivate::get(tf);
+
+ tfd->applyReturnGray(data, buffer, length, QColorTransformPrivate::InputPremultiplied);
+ }
+}
+
+static void QT_FASTCALL destStoreGray16(QRasterBuffer *rasterBuffer, int x, int y, const uint *buffer, int length)
+{
+ quint16 *data = reinterpret_cast<quint16 *>(rasterBuffer->scanLine(y)) + x;
+
+ bool failed = false;
+ for (int k = 0; k < length; ++k) {
+ if (!qIsGray(buffer[k])) {
+ failed = true;
+ break;
+ }
+ data[k] = qRed(buffer[k]) * 257;
+ }
+ if (failed) { // Non-gray colors
+ QColorSpace fromCS = rasterBuffer->colorSpace.isValid() ? rasterBuffer->colorSpace : QColorSpace::SRgb;
+ QColorTransform tf = QColorSpacePrivate::get(fromCS)->transformationToXYZ();
+ QColorTransformPrivate *tfd = QColorTransformPrivate::get(tf);
+
+ QRgba64 tmp_line[BufferSize];
+ for (int k = 0; k < length; ++k)
+ tmp_line[k] = QRgba64::fromArgb32(buffer[k]);
+ tfd->applyReturnGray(data, tmp_line, length, QColorTransformPrivate::InputPremultiplied);
+ }
+}
+
+static DestStoreProc destStoreProc[] =
{
nullptr, // Format_Invalid
destStoreMono, // Format_Mono,
@@ -1929,14 +698,23 @@ static DestStoreProc destStoreProc[QImage::NImageFormats] =
destStore, // Format_RGB30
destStore, // Format_A2RGB30_Premultiplied
destStore, // Format_Alpha8
- destStore, // Format_Grayscale8
+ destStoreGray8, // Format_Grayscale8
destStore, // Format_RGBX64
destStore, // Format_RGBA64
destStore, // Format_RGBA64_Premultiplied
- destStore, // Format_Grayscale16
+ destStoreGray16, // Format_Grayscale16
destStore, // Format_BGR888
+ destStore, // Format_RGBX16FPx4
+ destStore, // Format_RGBA16FPx4
+ destStore, // Format_RGBA16FPx4_Premultiplied
+ destStore, // Format_RGBX32FPx4
+ destStore, // Format_RGBA32FPx4
+ destStore, // Format_RGBA32FPx4_Premultiplied
+ destStore, // Format_CMYK8888
};
+static_assert(std::size(destStoreProc) == QImage::NImageFormats);
+
#if QT_CONFIG(raster_64bit)
static void QT_FASTCALL destStore64(QRasterBuffer *rasterBuffer, int x, int y, const QRgba64 *buffer, int length)
{
@@ -1953,7 +731,51 @@ static void QT_FASTCALL destStore64RGBA64(QRasterBuffer *rasterBuffer, int x, in
}
}
-static DestStoreProc64 destStoreProc64[QImage::NImageFormats] =
+static void QT_FASTCALL destStore64Gray8(QRasterBuffer *rasterBuffer, int x, int y, const QRgba64 *buffer, int length)
+{
+ uchar *data = rasterBuffer->scanLine(y) + x;
+
+ bool failed = false;
+ for (int k = 0; k < length; ++k) {
+ if (buffer[k].red() != buffer[k].green() || buffer[k].red() != buffer[k].blue()) {
+ failed = true;
+ break;
+ }
+ data[k] = buffer[k].red8();
+ }
+ if (failed) { // Non-gray colors
+ QColorSpace fromCS = rasterBuffer->colorSpace.isValid() ? rasterBuffer->colorSpace : QColorSpace::SRgb;
+ QColorTransform tf = QColorSpacePrivate::get(fromCS)->transformationToXYZ();
+ QColorTransformPrivate *tfd = QColorTransformPrivate::get(tf);
+
+ quint16 gray_line[BufferSize];
+ tfd->applyReturnGray(gray_line, buffer, length, QColorTransformPrivate::InputPremultiplied);
+ for (int k = 0; k < length; ++k)
+ data[k] = qt_div_257(gray_line[k]);
+ }
+}
+
+static void QT_FASTCALL destStore64Gray16(QRasterBuffer *rasterBuffer, int x, int y, const QRgba64 *buffer, int length)
+{
+ quint16 *data = reinterpret_cast<quint16 *>(rasterBuffer->scanLine(y)) + x;
+
+ bool failed = false;
+ for (int k = 0; k < length; ++k) {
+ if (buffer[k].red() != buffer[k].green() || buffer[k].red() != buffer[k].blue()) {
+ failed = true;
+ break;
+ }
+ data[k] = buffer[k].red();
+ }
+ if (failed) { // Non-gray colors
+ QColorSpace fromCS = rasterBuffer->colorSpace.isValid() ? rasterBuffer->colorSpace : QColorSpace::SRgb;
+ QColorTransform tf = QColorSpacePrivate::get(fromCS)->transformationToXYZ();
+ QColorTransformPrivate *tfd = QColorTransformPrivate::get(tf);
+ tfd->applyReturnGray(data, buffer, length, QColorTransformPrivate::InputPremultiplied);
+ }
+}
+
+static DestStoreProc64 destStoreProc64[] =
{
nullptr, // Format_Invalid
nullptr, // Format_Mono,
@@ -1979,13 +801,31 @@ static DestStoreProc64 destStoreProc64[QImage::NImageFormats] =
destStore64, // Format_RGB30
destStore64, // Format_A2RGB30_Premultiplied
destStore64, // Format_Alpha8
- destStore64, // Format_Grayscale8
+ destStore64Gray8, // Format_Grayscale8
nullptr, // Format_RGBX64
destStore64RGBA64, // Format_RGBA64
nullptr, // Format_RGBA64_Premultiplied
- destStore64, // Format_Grayscale16
+ destStore64Gray16, // Format_Grayscale16
destStore64, // Format_BGR888
+ destStore64, // Format_RGBX16FPx4
+ destStore64, // Format_RGBA16FPx4
+ destStore64, // Format_RGBA16FPx4_Premultiplied
+ destStore64, // Format_RGBX32FPx4
+ destStore64, // Format_RGBA32FPx4
+ destStore64, // Format_RGBA32FPx4_Premultiplied
+ destStore64, // Format_CMYK8888
};
+
+static_assert(std::size(destStoreProc64) == QImage::NImageFormats);
+#endif
+
+#if QT_CONFIG(raster_fp)
+static void QT_FASTCALL destStoreFP(QRasterBuffer *rasterBuffer, int x, int y, const QRgbaFloat32 *buffer, int length)
+{
+ auto store = qStoreFromRGBA32F[rasterBuffer->format];
+ uchar *dest = rasterBuffer->scanLine(y);
+ store(dest, buffer, x, length, nullptr, nullptr);
+}
#endif
/*
@@ -2053,10 +893,19 @@ static const QRgba64 *QT_FASTCALL fetchUntransformedRGBA64PM(QRgba64 *, const Op
}
#endif
+#if QT_CONFIG(raster_fp)
+static const QRgbaFloat32 *QT_FASTCALL fetchUntransformedFP(QRgbaFloat32 *buffer, const Operator *,
+ const QSpanData *data, int y, int x, int length)
+{
+ const auto fetch = qFetchToRGBA32F[data->texture.format];
+ return fetch(buffer, data->texture.scanLine(y), x, length, data->texture.colorTable, nullptr);
+}
+#endif
+
template<TextureBlendType blendType>
inline void fetchTransformed_pixelBounds(int max, int l1, int l2, int &v)
{
- Q_STATIC_ASSERT(blendType == BlendTransformed || blendType == BlendTransformedTiled);
+ static_assert(blendType == BlendTransformed || blendType == BlendTransformedTiled);
if (blendType == BlendTransformedTiled) {
if (v < 0 || v >= max) {
v %= max;
@@ -2088,7 +937,7 @@ template<TextureBlendType blendType, QPixelLayout::BPP bpp, typename T>
static void QT_FASTCALL fetchTransformed_fetcher(T *buffer, const QSpanData *data,
int y, int x, int length)
{
- Q_STATIC_ASSERT(blendType == BlendTransformed || blendType == BlendTransformedTiled);
+ static_assert(blendType == BlendTransformed || blendType == BlendTransformedTiled);
const QTextureData &image = data->texture;
const qreal cx = x + qreal(0.5);
@@ -2097,9 +946,9 @@ static void QT_FASTCALL fetchTransformed_fetcher(T *buffer, const QSpanData *dat
constexpr bool useFetch = (bpp < QPixelLayout::BPP32) && sizeof(T) == sizeof(uint);
const QPixelLayout *layout = &qPixelLayouts[data->texture.format];
if (!useFetch)
- Q_ASSERT(layout->bpp == bpp);
+ Q_ASSERT(layout->bpp == bpp || (layout->bpp == QPixelLayout::BPP16FPx4 && bpp == QPixelLayout::BPP64));
// When templated 'fetch' should be inlined at compile time:
- const FetchPixelFunc fetch = (bpp == QPixelLayout::BPPNone) ? qFetchPixel[layout->bpp] : FetchPixelFunc(fetchPixel<bpp>);
+ const Fetch1PixelFunc fetch1 = (bpp == QPixelLayout::BPPNone) ? fetch1PixelTable[layout->bpp] : Fetch1PixelFunc(fetch1Pixel<bpp>);
if (canUseFastMatrixPath(cx, cy, length, data)) {
// The increment pr x in the scanline
@@ -2130,8 +979,8 @@ static void QT_FASTCALL fetchTransformed_fetcher(T *buffer, const QSpanData *dat
fetchTransformed_pixelBounds<blendType>(image.width, image.x1, image.x2 - 1, x1);
if (x1 == x2)
break;
- if (useFetch)
- buffer[i] = fetch(src, x1);
+ if constexpr (useFetch)
+ buffer[i] = fetch1(src, x1);
else
buffer[i] = reinterpret_cast<const T*>(src)[x1];
fx += fdx;
@@ -2139,8 +988,8 @@ static void QT_FASTCALL fetchTransformed_fetcher(T *buffer, const QSpanData *dat
for (; i < fastLen; ++i) {
int px = (fx >> 16);
- if (useFetch)
- buffer[i] = fetch(src, px);
+ if constexpr (useFetch)
+ buffer[i] = fetch1(src, px);
else
buffer[i] = reinterpret_cast<const T*>(src)[px];
fx += fdx;
@@ -2150,8 +999,8 @@ static void QT_FASTCALL fetchTransformed_fetcher(T *buffer, const QSpanData *dat
for (; i < length; ++i) {
int px = (fx >> 16);
fetchTransformed_pixelBounds<blendType>(image.width, image.x1, image.x2 - 1, px);
- if (useFetch)
- buffer[i] = fetch(src, px);
+ if constexpr (useFetch)
+ buffer[i] = fetch1(src, px);
else
buffer[i] = reinterpret_cast<const T*>(src)[px];
fx += fdx;
@@ -2178,8 +1027,8 @@ static void QT_FASTCALL fetchTransformed_fetcher(T *buffer, const QSpanData *dat
fetchTransformed_pixelBounds<blendType>(image.height, image.y1, image.y2 - 1, y1);
if (x1 == x2 && y1 == y2)
break;
- if (useFetch)
- buffer[i] = fetch(image.scanLine(y1), x1);
+ if constexpr (useFetch)
+ buffer[i] = fetch1(image.scanLine(y1), x1);
else
buffer[i] = reinterpret_cast<const T*>(image.scanLine(y1))[x1];
fx += fdx;
@@ -2189,8 +1038,8 @@ static void QT_FASTCALL fetchTransformed_fetcher(T *buffer, const QSpanData *dat
for (; i < fastLen; ++i) {
int px = (fx >> 16);
int py = (fy >> 16);
- if (useFetch)
- buffer[i] = fetch(image.scanLine(py), px);
+ if constexpr (useFetch)
+ buffer[i] = fetch1(image.scanLine(py), px);
else
buffer[i] = reinterpret_cast<const T*>(image.scanLine(py))[px];
fx += fdx;
@@ -2203,8 +1052,8 @@ static void QT_FASTCALL fetchTransformed_fetcher(T *buffer, const QSpanData *dat
int py = (fy >> 16);
fetchTransformed_pixelBounds<blendType>(image.width, image.x1, image.x2 - 1, px);
fetchTransformed_pixelBounds<blendType>(image.height, image.y1, image.y2 - 1, py);
- if (useFetch)
- buffer[i] = fetch(image.scanLine(py), px);
+ if constexpr (useFetch)
+ buffer[i] = fetch1(image.scanLine(py), px);
else
buffer[i] = reinterpret_cast<const T*>(image.scanLine(py))[px];
fx += fdx;
@@ -2231,8 +1080,8 @@ static void QT_FASTCALL fetchTransformed_fetcher(T *buffer, const QSpanData *dat
fetchTransformed_pixelBounds<blendType>(image.height, image.y1, image.y2 - 1, py);
fetchTransformed_pixelBounds<blendType>(image.width, image.x1, image.x2 - 1, px);
- if (useFetch)
- *b = fetch(image.scanLine(py), px);
+ if constexpr (useFetch)
+ *b = fetch1(image.scanLine(py), px);
else
*b = reinterpret_cast<const T*>(image.scanLine(py))[px];
@@ -2252,7 +1101,7 @@ template<TextureBlendType blendType, QPixelLayout::BPP bpp>
static const uint *QT_FASTCALL fetchTransformed(uint *buffer, const Operator *, const QSpanData *data,
int y, int x, int length)
{
- Q_STATIC_ASSERT(blendType == BlendTransformed || blendType == BlendTransformedTiled);
+ static_assert(blendType == BlendTransformed || blendType == BlendTransformedTiled);
const QPixelLayout *layout = &qPixelLayouts[data->texture.format];
fetchTransformed_fetcher<blendType, bpp, uint>(buffer, data, y, x, length);
layout->convertToARGB32PM(buffer, length, data->texture.colorTable);
@@ -2265,7 +1114,7 @@ static const QRgba64 *QT_FASTCALL fetchTransformed64(QRgba64 *buffer, const Oper
int y, int x, int length)
{
const QPixelLayout *layout = &qPixelLayouts[data->texture.format];
- if (layout->bpp != QPixelLayout::BPP64) {
+ if (layout->bpp < QPixelLayout::BPP64) {
uint buffer32[BufferSize];
Q_ASSERT(length <= BufferSize);
if (layout->bpp == QPixelLayout::BPP32)
@@ -2275,9 +1124,37 @@ static const QRgba64 *QT_FASTCALL fetchTransformed64(QRgba64 *buffer, const Oper
return layout->convertToRGBA64PM(buffer, buffer32, length, data->texture.colorTable, nullptr);
}
- fetchTransformed_fetcher<blendType, QPixelLayout::BPP64, QRgba64>(buffer, data, y, x, length);
- if (data->texture.format == QImage::Format_RGBA64)
- convertRGBA64ToRGBA64PM(buffer, length);
+ fetchTransformed_fetcher<blendType, QPixelLayout::BPP64, quint64>(reinterpret_cast<quint64*>(buffer), data, y, x, length);
+ if (auto convert = convert64ToRGBA64PM[data->texture.format])
+ convert(buffer, length);
+ return buffer;
+}
+#endif
+
+#if QT_CONFIG(raster_fp)
+template<TextureBlendType blendType> /* either BlendTransformed or BlendTransformedTiled */
+static const QRgbaFloat32 *QT_FASTCALL fetchTransformedFP(QRgbaFloat32 *buffer, const Operator *, const QSpanData *data,
+ int y, int x, int length)
+{
+ const QPixelLayout *layout = &qPixelLayouts[data->texture.format];
+ if (layout->bpp < QPixelLayout::BPP64) {
+ uint buffer32[BufferSize];
+ Q_ASSERT(length <= BufferSize);
+ if (layout->bpp == QPixelLayout::BPP32)
+ fetchTransformed_fetcher<blendType, QPixelLayout::BPP32, uint>(buffer32, data, y, x, length);
+ else
+ fetchTransformed_fetcher<blendType, QPixelLayout::BPPNone, uint>(buffer32, data, y, x, length);
+ qConvertToRGBA32F[data->texture.format](buffer, buffer32, length, data->texture.colorTable, nullptr);
+ } else if (layout->bpp < QPixelLayout::BPP32FPx4) {
+ quint64 buffer64[BufferSize];
+ fetchTransformed_fetcher<blendType, QPixelLayout::BPP64, quint64>(buffer64, data, y, x, length);
+ convert64ToRGBA32F[data->texture.format](buffer, buffer64, length);
+ } else {
+ fetchTransformed_fetcher<blendType, QPixelLayout::BPP32FPx4, QRgbaFloat32>(buffer, data, y, x, length);
+ if (data->texture.format == QImage::Format_RGBA32FPx4)
+ convertRGBA32FToRGBA32FPM(buffer, length);
+ return buffer;
+ }
return buffer;
}
#endif
@@ -2416,7 +1293,7 @@ static void QT_FASTCALL intermediate_adder(uint *b, uint *end, const Intermediat
{
#if defined(QT_COMPILER_SUPPORTS_AVX2)
extern void QT_FASTCALL intermediate_adder_avx2(uint *b, uint *end, const IntermediateBuffer &intermediate, int offset, int &fx, int fdx);
- if (qCpuHasFeature(AVX2))
+ if (qCpuHasFeature(ArchHaswell))
return intermediate_adder_avx2(b, end, intermediate, offset, fx, fdx);
#endif
@@ -2842,15 +1719,15 @@ static void QT_FASTCALL fetchTransformedBilinearARGB32PM_fast_rotate_helper(uint
fy += fdy;
++b;
}
- uint *boundedEnd = end; \
- if (fdx > 0) \
- boundedEnd = qMin(boundedEnd, b + (max_fx - fx) / fdx); \
- else if (fdx < 0) \
- boundedEnd = qMin(boundedEnd, b + (min_fx - fx) / fdx); \
- if (fdy > 0) \
- boundedEnd = qMin(boundedEnd, b + (max_fy - fy) / fdy); \
- else if (fdy < 0) \
- boundedEnd = qMin(boundedEnd, b + (min_fy - fy) / fdy); \
+ uint *boundedEnd = end;
+ if (fdx > 0)
+ boundedEnd = qMin(boundedEnd, b + (max_fx - fx) / fdx);
+ else if (fdx < 0)
+ boundedEnd = qMin(boundedEnd, b + (min_fx - fx) / fdx);
+ if (fdy > 0)
+ boundedEnd = qMin(boundedEnd, b + (max_fy - fy) / fdy);
+ else if (fdy < 0)
+ boundedEnd = qMin(boundedEnd, b + (min_fy - fy) / fdy);
// until boundedEnd we can now have a fast middle part without boundary checks
#if defined(__SSE2__)
@@ -2906,7 +1783,7 @@ static void QT_FASTCALL fetchTransformedBilinearARGB32PM_fast_rotate_helper(uint
int32x4_t v_fdy = vdupq_n_s32(fdy * 4);
const uchar *textureData = image.imageData;
- const int bytesPerLine = image.bytesPerLine;
+ const qsizetype bytesPerLine = image.bytesPerLine;
int32x4_t v_fx = vmovq_n_s32(fx);
int32x4_t v_fy = vmovq_n_s32(fy);
@@ -3053,7 +1930,7 @@ static const uint * QT_FASTCALL fetchTransformedBilinearARGB32PM(uint *buffer, c
{
const qreal cx = x + qreal(0.5);
const qreal cy = y + qreal(0.5);
- Q_CONSTEXPR int tiled = (blendType == BlendTransformedBilinearTiled) ? 1 : 0;
+ constexpr int tiled = (blendType == BlendTransformedBilinearTiled) ? 1 : 0;
uint *end = buffer + length;
uint *b = buffer;
@@ -3152,7 +2029,7 @@ static void QT_FASTCALL fetchTransformedBilinear_simple_scale_helper(uint *b, ui
int &fx, int &fy, int fdx, int /*fdy*/)
{
const QPixelLayout *layout = &qPixelLayouts[image.format];
- const QVector<QRgb> *clut = image.colorTable;
+ const QList<QRgb> *clut = image.colorTable;
const FetchAndConvertPixelsFunc fetch = layout->fetchToARGB32PM;
int y1 = (fy >> 16);
@@ -3250,8 +2127,8 @@ static void QT_FASTCALL fetchTransformedBilinear_fetcher(T *buf1, T *buf2, const
if (useFetch)
Q_ASSERT(sizeof(T) == sizeof(uint));
else
- Q_ASSERT(layout.bpp == bpp);
- const FetchPixelFunc fetch1 = (bpp == QPixelLayout::BPPNone) ? qFetchPixel[layout.bpp] : fetchPixel<bpp>;
+ Q_ASSERT(layout.bpp == bpp || (layout.bpp == QPixelLayout::BPP16FPx4 && bpp == QPixelLayout::BPP64));
+ const Fetch1PixelFunc fetch1 = (bpp == QPixelLayout::BPPNone) ? fetch1PixelTable[layout.bpp] : fetch1Pixel<bpp>;
if (fdy == 0) {
int y1 = (fy >> 16);
int y2;
@@ -3267,7 +2144,7 @@ static void QT_FASTCALL fetchTransformedBilinear_fetcher(T *buf1, T *buf2, const
fetchTransformedBilinear_pixelBounds<blendType>(image.width, image.x1, image.x2 - 1, x1, x2);
if (x1 != x2)
break;
- if (useFetch) {
+ if constexpr (useFetch) {
buf1[i * 2 + 0] = buf1[i * 2 + 1] = fetch1(s1, x1);
buf2[i * 2 + 0] = buf2[i * 2 + 1] = fetch1(s2, x1);
} else {
@@ -3284,7 +2161,7 @@ static void QT_FASTCALL fetchTransformedBilinear_fetcher(T *buf1, T *buf2, const
for (; i < fastLen; ++i) {
int x = (fx >> 16);
- if (useFetch) {
+ if constexpr (useFetch) {
buf1[i * 2 + 0] = fetch1(s1, x);
buf1[i * 2 + 1] = fetch1(s1, x + 1);
buf2[i * 2 + 0] = fetch1(s2, x);
@@ -3303,7 +2180,7 @@ static void QT_FASTCALL fetchTransformedBilinear_fetcher(T *buf1, T *buf2, const
int x1 = (fx >> 16);
int x2;
fetchTransformedBilinear_pixelBounds<blendType>(image.width, image.x1, image.x2 - 1, x1, x2);
- if (useFetch) {
+ if constexpr (useFetch) {
buf1[i * 2 + 0] = fetch1(s1, x1);
buf1[i * 2 + 1] = fetch1(s1, x2);
buf2[i * 2 + 0] = fetch1(s2, x1);
@@ -3330,7 +2207,7 @@ static void QT_FASTCALL fetchTransformedBilinear_fetcher(T *buf1, T *buf2, const
break;
const uchar *s1 = image.scanLine(y1);
const uchar *s2 = image.scanLine(y2);
- if (useFetch) {
+ if constexpr (useFetch) {
buf1[i * 2 + 0] = fetch1(s1, x1);
buf1[i * 2 + 1] = fetch1(s1, x2);
buf2[i * 2 + 0] = fetch1(s2, x1);
@@ -3359,7 +2236,7 @@ static void QT_FASTCALL fetchTransformedBilinear_fetcher(T *buf1, T *buf2, const
int y = (fy >> 16);
const uchar *s1 = image.scanLine(y);
const uchar *s2 = s1 + image.bytesPerLine;
- if (useFetch) {
+ if constexpr (useFetch) {
buf1[i * 2 + 0] = fetch1(s1, x);
buf1[i * 2 + 1] = fetch1(s1, x + 1);
buf2[i * 2 + 0] = fetch1(s2, x);
@@ -3385,7 +2262,7 @@ static void QT_FASTCALL fetchTransformedBilinear_fetcher(T *buf1, T *buf2, const
const uchar *s1 = image.scanLine(y1);
const uchar *s2 = image.scanLine(y2);
- if (useFetch) {
+ if constexpr (useFetch) {
buf1[i * 2 + 0] = fetch1(s1, x1);
buf1[i * 2 + 1] = fetch1(s1, x2);
buf2[i * 2 + 0] = fetch1(s2, x1);
@@ -3402,13 +2279,64 @@ static void QT_FASTCALL fetchTransformedBilinear_fetcher(T *buf1, T *buf2, const
}
}
+template<TextureBlendType blendType, QPixelLayout::BPP bpp, typename T>
+static void QT_FASTCALL fetchTransformedBilinear_slow_fetcher(T *buf1, T *buf2, ushort *distxs, ushort *distys,
+ const int len, const QTextureData &image,
+ qreal &fx, qreal &fy, qreal &fw,
+ const qreal fdx, const qreal fdy, const qreal fdw)
+{
+ const QPixelLayout &layout = qPixelLayouts[image.format];
+ constexpr bool useFetch = (bpp < QPixelLayout::BPP32);
+ if (useFetch)
+ Q_ASSERT(sizeof(T) == sizeof(uint));
+ else
+ Q_ASSERT(layout.bpp == bpp);
+
+ const Fetch1PixelFunc fetch1 = (bpp == QPixelLayout::BPPNone) ? fetch1PixelTable[layout.bpp] : fetch1Pixel<bpp>;
+
+ for (int i = 0; i < len; ++i) {
+ const qreal iw = fw == 0 ? 16384 : 1 / fw;
+ const qreal px = fx * iw - qreal(0.5);
+ const qreal py = fy * iw - qreal(0.5);
+
+ int x1 = qFloor(px);
+ int x2;
+ int y1 = qFloor(py);
+ int y2;
+
+ distxs[i] = ushort((px - x1) * (1<<16));
+ distys[i] = ushort((py - y1) * (1<<16));
+
+ fetchTransformedBilinear_pixelBounds<blendType>(image.width, image.x1, image.x2 - 1, x1, x2);
+ fetchTransformedBilinear_pixelBounds<blendType>(image.height, image.y1, image.y2 - 1, y1, y2);
+
+ const uchar *s1 = image.scanLine(y1);
+ const uchar *s2 = image.scanLine(y2);
+ if constexpr (useFetch) {
+ buf1[i * 2 + 0] = fetch1(s1, x1);
+ buf1[i * 2 + 1] = fetch1(s1, x2);
+ buf2[i * 2 + 0] = fetch1(s2, x1);
+ buf2[i * 2 + 1] = fetch1(s2, x2);
+ } else {
+ buf1[i * 2 + 0] = reinterpret_cast<const T *>(s1)[x1];
+ buf1[i * 2 + 1] = reinterpret_cast<const T *>(s1)[x2];
+ buf2[i * 2 + 0] = reinterpret_cast<const T *>(s2)[x1];
+ buf2[i * 2 + 1] = reinterpret_cast<const T *>(s2)[x2];
+ }
+
+ fx += fdx;
+ fy += fdy;
+ fw += fdw;
+ }
+}
+
// blendType = BlendTransformedBilinear or BlendTransformedBilinearTiled
template<TextureBlendType blendType, QPixelLayout::BPP bpp>
static const uint *QT_FASTCALL fetchTransformedBilinear(uint *buffer, const Operator *,
const QSpanData *data, int y, int x, int length)
{
const QPixelLayout *layout = &qPixelLayouts[data->texture.format];
- const QVector<QRgb> *clut = data->texture.colorTable;
+ const QList<QRgb> *clut = data->texture.colorTable;
Q_ASSERT(bpp == QPixelLayout::BPPNone || layout->bpp == bpp);
const qreal cx = x + qreal(0.5);
@@ -3512,10 +2440,7 @@ static const uint *QT_FASTCALL fetchTransformedBilinear(uint *buffer, const Oper
}
}
} else {
- // When templated 'fetch' should be inlined at compile time:
- const FetchPixelFunc fetch1 = (bpp == QPixelLayout::BPPNone) ? qFetchPixel[layout->bpp] : fetchPixel<bpp>;
-
- const QTextureData &image = data->texture;
+ const auto fetcher = fetchTransformedBilinear_slow_fetcher<blendType,bpp,uint>;
const qreal fdx = data->m11;
const qreal fdy = data->m12;
@@ -3529,48 +2454,19 @@ static const uint *QT_FASTCALL fetchTransformedBilinear(uint *buffer, const Oper
uint buf2[BufferSize];
uint *b = buffer;
- int distxs[BufferSize / 2];
- int distys[BufferSize / 2];
+ ushort distxs[BufferSize / 2];
+ ushort distys[BufferSize / 2];
while (length) {
- int len = qMin(length, BufferSize / 2);
- for (int i = 0; i < len; ++i) {
- const qreal iw = fw == 0 ? 1 : 1 / fw;
- const qreal px = fx * iw - qreal(0.5);
- const qreal py = fy * iw - qreal(0.5);
-
- int x1 = int(px) - (px < 0);
- int x2;
- int y1 = int(py) - (py < 0);
- int y2;
-
- distxs[i] = int((px - x1) * 256);
- distys[i] = int((py - y1) * 256);
-
- fetchTransformedBilinear_pixelBounds<blendType>(image.width, image.x1, image.x2 - 1, x1, x2);
- fetchTransformedBilinear_pixelBounds<blendType>(image.height, image.y1, image.y2 - 1, y1, y2);
-
- const uchar *s1 = data->texture.scanLine(y1);
- const uchar *s2 = data->texture.scanLine(y2);
- buf1[i * 2 + 0] = fetch1(s1, x1);
- buf1[i * 2 + 1] = fetch1(s1, x2);
- buf2[i * 2 + 0] = fetch1(s2, x1);
- buf2[i * 2 + 1] = fetch1(s2, x2);
-
- fx += fdx;
- fy += fdy;
- fw += fdw;
- //force increment to avoid /0
- if (!fw)
- fw += fdw;
- }
+ const int len = qMin(length, BufferSize / 2);
+ fetcher(buf1, buf2, distxs, distys, len, data->texture, fx, fy, fw, fdx, fdy, fdw);
layout->convertToARGB32PM(buf1, len * 2, clut);
layout->convertToARGB32PM(buf2, len * 2, clut);
for (int i = 0; i < len; ++i) {
- int distx = distxs[i];
- int disty = distys[i];
+ const int distx = distxs[i] >> 8;
+ const int disty = distys[i] >> 8;
b[i] = interpolate_4_pixels(buf1 + i * 2, buf2 + i * 2, distx, disty);
}
@@ -3587,9 +2483,9 @@ template<TextureBlendType blendType>
static const QRgba64 *QT_FASTCALL fetchTransformedBilinear64_uint32(QRgba64 *buffer, const QSpanData *data,
int y, int x, int length)
{
- const QTextureData &texture = data->texture;
- const QPixelLayout *layout = &qPixelLayouts[texture.format];
- const QVector<QRgb> *clut = data->texture.colorTable;
+ const QPixelLayout *layout = &qPixelLayouts[data->texture.format];
+ const auto *clut = data->texture.colorTable;
+ const auto convert = layout->convertToRGBA64PM;
const qreal cx = x + qreal(0.5);
const qreal cy = y + qreal(0.5);
@@ -3598,7 +2494,6 @@ static const QRgba64 *QT_FASTCALL fetchTransformedBilinear64_uint32(QRgba64 *buf
uint sbuf2[BufferSize];
alignas(8) QRgba64 buf1[BufferSize];
alignas(8) QRgba64 buf2[BufferSize];
- QRgba64 *end = buffer + length;
QRgba64 *b = buffer;
if (canUseFastMatrixPath(cx, cy, length, data)) {
@@ -3619,20 +2514,20 @@ static const QRgba64 *QT_FASTCALL fetchTransformedBilinear64_uint32(QRgba64 *buf
if (fdy == 0) { //simple scale, no rotation
while (length) {
- int len = qMin(length, BufferSize / 2);
- int disty = (fy & 0x0000ffff);
+ const int len = qMin(length, BufferSize / 2);
+ const int disty = (fy & 0x0000ffff);
#if defined(__SSE2__)
const __m128i vdy = _mm_set1_epi16(disty);
const __m128i vidy = _mm_set1_epi16(0x10000 - disty);
#endif
fetcher(sbuf1, sbuf2, len, data->texture, fx, fy, fdx, fdy);
- layout->convertToRGBA64PM(buf1, sbuf1, len * 2, clut, nullptr);
+ convert(buf1, sbuf1, len * 2, clut, nullptr);
if (disty)
- layout->convertToRGBA64PM(buf2, sbuf2, len * 2, clut, nullptr);
+ convert(buf2, sbuf2, len * 2, clut, nullptr);
for (int i = 0; i < len; ++i) {
- int distx = (fx & 0x0000ffff);
+ const int distx = (fx & 0x0000ffff);
#if defined(__SSE2__)
__m128i vt = _mm_loadu_si128((const __m128i*)(buf1 + i*2));
if (disty) {
@@ -3657,17 +2552,17 @@ static const QRgba64 *QT_FASTCALL fetchTransformedBilinear64_uint32(QRgba64 *buf
b += len;
}
} else { // rotation or shear
- while (b < end) {
- int len = qMin(length, BufferSize / 2);
+ while (length) {
+ const int len = qMin(length, BufferSize / 2);
fetcher(sbuf1, sbuf2, len, data->texture, fx, fy, fdx, fdy);
- layout->convertToRGBA64PM(buf1, sbuf1, len * 2, clut, nullptr);
- layout->convertToRGBA64PM(buf2, sbuf2, len * 2, clut, nullptr);
+ convert(buf1, sbuf1, len * 2, clut, nullptr);
+ convert(buf2, sbuf2, len * 2, clut, nullptr);
for (int i = 0; i < len; ++i) {
- int distx = (fx & 0x0000ffff);
- int disty = (fy & 0x0000ffff);
+ const int distx = (fx & 0x0000ffff);
+ const int disty = (fy & 0x0000ffff);
b[i] = interpolate_4_pixels_rgb64(buf1 + i*2, buf2 + i*2, distx, disty);
fx += fdx;
fy += fdy;
@@ -3678,7 +2573,10 @@ static const QRgba64 *QT_FASTCALL fetchTransformedBilinear64_uint32(QRgba64 *buf
}
}
} else { // !(data->fast_matrix)
- const QTextureData &image = data->texture;
+ const auto fetcher =
+ (layout->bpp == QPixelLayout::BPP32)
+ ? fetchTransformedBilinear_slow_fetcher<blendType, QPixelLayout::BPP32, uint>
+ : fetchTransformedBilinear_slow_fetcher<blendType, QPixelLayout::BPPNone, uint>;
const qreal fdx = data->m11;
const qreal fdy = data->m12;
@@ -3688,51 +2586,19 @@ static const QRgba64 *QT_FASTCALL fetchTransformedBilinear64_uint32(QRgba64 *buf
qreal fy = data->m22 * cy + data->m12 * cx + data->dy;
qreal fw = data->m23 * cy + data->m13 * cx + data->m33;
- FetchPixelFunc fetch = qFetchPixel[layout->bpp];
-
- int distxs[BufferSize / 2];
- int distys[BufferSize / 2];
-
- while (b < end) {
- int len = qMin(length, BufferSize / 2);
- for (int i = 0; i < len; ++i) {
- const qreal iw = fw == 0 ? 1 : 1 / fw;
- const qreal px = fx * iw - qreal(0.5);
- const qreal py = fy * iw - qreal(0.5);
-
- int x1 = qFloor(px);
- int x2;
- int y1 = qFloor(py);
- int y2;
-
- distxs[i] = int((px - x1) * (1<<16));
- distys[i] = int((py - y1) * (1<<16));
-
- fetchTransformedBilinear_pixelBounds<blendType>(image.width, image.x1, image.x2 - 1, x1, x2);
- fetchTransformedBilinear_pixelBounds<blendType>(image.height, image.y1, image.y2 - 1, y1, y2);
+ ushort distxs[BufferSize / 2];
+ ushort distys[BufferSize / 2];
- const uchar *s1 = texture.scanLine(y1);
- const uchar *s2 = texture.scanLine(y2);
-
- sbuf1[i * 2 + 0] = fetch(s1, x1);
- sbuf1[i * 2 + 1] = fetch(s1, x2);
- sbuf2[i * 2 + 0] = fetch(s2, x1);
- sbuf2[i * 2 + 1] = fetch(s2, x2);
-
- fx += fdx;
- fy += fdy;
- fw += fdw;
- //force increment to avoid /0
- if (!fw)
- fw += fdw;
- }
+ while (length) {
+ const int len = qMin(length, BufferSize / 2);
+ fetcher(sbuf1, sbuf2, distxs, distys, len, data->texture, fx, fy, fw, fdx, fdy, fdw);
- layout->convertToRGBA64PM(buf1, sbuf1, len * 2, clut, nullptr);
- layout->convertToRGBA64PM(buf2, sbuf2, len * 2, clut, nullptr);
+ convert(buf1, sbuf1, len * 2, clut, nullptr);
+ convert(buf2, sbuf2, len * 2, clut, nullptr);
for (int i = 0; i < len; ++i) {
- int distx = distxs[i];
- int disty = distys[i];
+ const int distx = distxs[i];
+ const int disty = distys[i];
b[i] = interpolate_4_pixels_rgb64(buf1 + i*2, buf2 + i*2, distx, disty);
}
@@ -3747,9 +2613,7 @@ template<TextureBlendType blendType>
static const QRgba64 *QT_FASTCALL fetchTransformedBilinear64_uint64(QRgba64 *buffer, const QSpanData *data,
int y, int x, int length)
{
- const QTextureData &texture = data->texture;
- Q_ASSERT(qPixelLayouts[texture.format].bpp == QPixelLayout::BPP64);
- const auto convert = (data->texture.format == QImage::Format_RGBA64) ? convertRGBA64ToRGBA64PM : convertRGBA64PMToRGBA64PM;
+ const auto convert = convert64ToRGBA64PM[data->texture.format];
const qreal cx = x + qreal(0.5);
const qreal cy = y + qreal(0.5);
@@ -3832,7 +2696,7 @@ static const QRgba64 *QT_FASTCALL fetchTransformedBilinear64_uint64(QRgba64 *buf
}
}
} else { // !(data->fast_matrix)
- const QTextureData &image = data->texture;
+ const auto fetcher = fetchTransformedBilinear_slow_fetcher<blendType, QPixelLayout::BPP64, QRgba64>;
const qreal fdx = data->m11;
const qreal fdy = data->m12;
@@ -3842,49 +2706,104 @@ static const QRgba64 *QT_FASTCALL fetchTransformedBilinear64_uint64(QRgba64 *buf
qreal fy = data->m22 * cy + data->m12 * cx + data->dy;
qreal fw = data->m23 * cy + data->m13 * cx + data->m33;
- int distxs[BufferSize / 2];
- int distys[BufferSize / 2];
+ ushort distxs[BufferSize / 2];
+ ushort distys[BufferSize / 2];
+
+ while (length) {
+ const int len = qMin(length, BufferSize / 2);
+ fetcher(buf1, buf2, distxs, distys, len, data->texture, fx, fy, fw, fdx, fdy, fdw);
+
+ convert(buf1, len * 2);
+ convert(buf2, len * 2);
- while (b < end) {
- int len = qMin(length, BufferSize / 2);
for (int i = 0; i < len; ++i) {
- const qreal iw = fw == 0 ? 1 : 1 / fw;
- const qreal px = fx * iw - qreal(0.5);
- const qreal py = fy * iw - qreal(0.5);
+ const int distx = distxs[i];
+ const int disty = distys[i];
+ b[i] = interpolate_4_pixels_rgb64(buf1 + i*2, buf2 + i*2, distx, disty);
+ }
- int x1 = int(px) - (px < 0);
- int x2;
- int y1 = int(py) - (py < 0);
- int y2;
+ length -= len;
+ b += len;
+ }
+ }
+ return buffer;
+}
- distxs[i] = int((px - x1) * (1<<16));
- distys[i] = int((py - y1) * (1<<16));
+template<TextureBlendType blendType>
+static const QRgba64 *QT_FASTCALL fetchTransformedBilinear64_f32x4(QRgba64 *buffer, const QSpanData *data,
+ int y, int x, int length)
+{
+ const QPixelLayout *layout = &qPixelLayouts[data->texture.format];
+ const auto *clut = data->texture.colorTable;
+ const auto convert = layout->fetchToRGBA64PM;
- fetchTransformedBilinear_pixelBounds<blendType>(image.width, image.x1, image.x2 - 1, x1, x2);
- fetchTransformedBilinear_pixelBounds<blendType>(image.height, image.y1, image.y2 - 1, y1, y2);
+ const qreal cx = x + qreal(0.5);
+ const qreal cy = y + qreal(0.5);
+
+ QRgbaFloat32 sbuf1[BufferSize];
+ QRgbaFloat32 sbuf2[BufferSize];
+ alignas(8) QRgba64 buf1[BufferSize];
+ alignas(8) QRgba64 buf2[BufferSize];
+ QRgba64 *b = buffer;
+
+ if (canUseFastMatrixPath(cx, cy, length, data)) {
+ // The increment pr x in the scanline
+ const int fdx = (int)(data->m11 * fixed_scale);
+ const int fdy = (int)(data->m12 * fixed_scale);
- const uchar *s1 = texture.scanLine(y1);
- const uchar *s2 = texture.scanLine(y2);
+ int fx = int((data->m21 * cy + data->m11 * cx + data->dx) * fixed_scale);
+ int fy = int((data->m22 * cy + data->m12 * cx + data->dy) * fixed_scale);
- buf1[i * 2 + 0] = reinterpret_cast<const QRgba64 *>(s1)[x1];
- buf1[i * 2 + 1] = reinterpret_cast<const QRgba64 *>(s1)[x2];
- buf2[i * 2 + 0] = reinterpret_cast<const QRgba64 *>(s2)[x1];
- buf2[i * 2 + 1] = reinterpret_cast<const QRgba64 *>(s2)[x2];
+ fx -= half_point;
+ fy -= half_point;
+ const auto fetcher = fetchTransformedBilinear_fetcher<blendType, QPixelLayout::BPP32FPx4, QRgbaFloat32>;
+
+ const bool skipsecond = (fdy == 0) && ((fy & 0x0000ffff) == 0);
+ while (length) {
+ const int len = qMin(length, BufferSize / 2);
+
+ fetcher(sbuf1, sbuf2, len, data->texture, fx, fy, fdx, fdy);
+
+ convert(buf1, (const uchar *)sbuf1, 0, len * 2, clut, nullptr);
+ if (!skipsecond)
+ convert(buf2, (const uchar *)sbuf2, 0, len * 2, clut, nullptr);
+
+ for (int i = 0; i < len; ++i) {
+ const int distx = (fx & 0x0000ffff);
+ const int disty = (fy & 0x0000ffff);
+ b[i] = interpolate_4_pixels_rgb64(buf1 + i*2, buf2 + i*2, distx, disty);
fx += fdx;
fy += fdy;
- fw += fdw;
- //force increment to avoid /0
- if (!fw)
- fw += fdw;
}
- convert(buf1, len * 2);
- convert(buf2, len * 2);
+ length -= len;
+ b += len;
+ }
+ } else { // !(data->fast_matrix)
+ const auto fetcher = fetchTransformedBilinear_slow_fetcher<blendType, QPixelLayout::BPP32FPx4, QRgbaFloat32>;
+
+ const qreal fdx = data->m11;
+ const qreal fdy = data->m12;
+ const qreal fdw = data->m13;
+
+ qreal fx = data->m21 * cy + data->m11 * cx + data->dx;
+ qreal fy = data->m22 * cy + data->m12 * cx + data->dy;
+ qreal fw = data->m23 * cy + data->m13 * cx + data->m33;
+
+ ushort distxs[BufferSize / 2];
+ ushort distys[BufferSize / 2];
+
+ while (length) {
+ const int len = qMin(length, BufferSize / 2);
+ fetcher(sbuf1, sbuf2, distxs, distys, len, data->texture, fx, fy, fw, fdx, fdy, fdw);
+
+ convert(buf1, (const uchar *)sbuf1, 0, len * 2, clut, nullptr);
+ convert(buf2, (const uchar *)sbuf2, 0, len * 2, clut, nullptr);
for (int i = 0; i < len; ++i) {
- int distx = distxs[i];
- int disty = distys[i];
+ const int distx = distxs[i];
+ const int disty = distys[i];
b[i] = interpolate_4_pixels_rgb64(buf1 + i*2, buf2 + i*2, distx, disty);
}
@@ -3899,14 +2818,280 @@ template<TextureBlendType blendType>
static const QRgba64 *QT_FASTCALL fetchTransformedBilinear64(QRgba64 *buffer, const Operator *,
const QSpanData *data, int y, int x, int length)
{
- if (qPixelLayouts[data->texture.format].bpp == QPixelLayout::BPP64)
+ switch (qPixelLayouts[data->texture.format].bpp) {
+ case QPixelLayout::BPP64:
+ case QPixelLayout::BPP16FPx4:
return fetchTransformedBilinear64_uint64<blendType>(buffer, data, y, x, length);
- return fetchTransformedBilinear64_uint32<blendType>(buffer, data, y, x, length);
+ case QPixelLayout::BPP32FPx4:
+ return fetchTransformedBilinear64_f32x4<blendType>(buffer, data, y, x, length);
+ default:
+ return fetchTransformedBilinear64_uint32<blendType>(buffer, data, y, x, length);
+ }
}
#endif
+#if QT_CONFIG(raster_fp)
+static void interpolate_simple_rgba32f(QRgbaFloat32 *b, const QRgbaFloat32 *buf1, const QRgbaFloat32 *buf2, int len,
+ int &fx, int fdx,
+ int &fy, int fdy)
+{
+ for (int i = 0; i < len; ++i) {
+ const int distx = (fx & 0x0000ffff);
+ const int disty = (fy & 0x0000ffff);
+ b[i] = interpolate_4_pixels_rgba32f(buf1 + i*2, buf2 + i*2, distx, disty);
+ fx += fdx;
+ fy += fdy;
+ }
+}
+
+static void interpolate_perspective_rgba32f(QRgbaFloat32 *b, const QRgbaFloat32 *buf1, const QRgbaFloat32 *buf2, int len,
+ unsigned short *distxs,
+ unsigned short *distys)
+{
+ for (int i = 0; i < len; ++i) {
+ const int dx = distxs[i];
+ const int dy = distys[i];
+ b[i] = interpolate_4_pixels_rgba32f(buf1 + i*2, buf2 + i*2, dx, dy);
+ }
+}
+
+template<TextureBlendType blendType>
+static const QRgbaFloat32 *QT_FASTCALL fetchTransformedBilinearFP_uint32(QRgbaFloat32 *buffer, const QSpanData *data,
+ int y, int x, int length)
+{
+ const QPixelLayout *layout = &qPixelLayouts[data->texture.format];
+ const auto *clut = data->texture.colorTable;
+ const auto convert = qConvertToRGBA32F[data->texture.format];
+
+ const qreal cx = x + qreal(0.5);
+ const qreal cy = y + qreal(0.5);
+
+ uint sbuf1[BufferSize];
+ uint sbuf2[BufferSize];
+ QRgbaFloat32 buf1[BufferSize];
+ QRgbaFloat32 buf2[BufferSize];
+ QRgbaFloat32 *b = buffer;
+
+ if (canUseFastMatrixPath(cx, cy, length, data)) {
+ // The increment pr x in the scanline
+ const int fdx = (int)(data->m11 * fixed_scale);
+ const int fdy = (int)(data->m12 * fixed_scale);
+
+ int fx = int((data->m21 * cy + data->m11 * cx + data->dx) * fixed_scale);
+ int fy = int((data->m22 * cy + data->m12 * cx + data->dy) * fixed_scale);
+
+ fx -= half_point;
+ fy -= half_point;
+
+ const auto fetcher =
+ (layout->bpp == QPixelLayout::BPP32)
+ ? fetchTransformedBilinear_fetcher<blendType, QPixelLayout::BPP32, uint>
+ : fetchTransformedBilinear_fetcher<blendType, QPixelLayout::BPPNone, uint>;
+
+ const bool skipsecond = (fdy == 0) && ((fy & 0x0000ffff) == 0);
+ while (length) {
+ const int len = qMin(length, BufferSize / 2);
+ fetcher(sbuf1, sbuf2, len, data->texture, fx, fy, fdx, fdy);
+
+ convert(buf1, sbuf1, len * 2, clut, nullptr);
+ if (!skipsecond)
+ convert(buf2, sbuf2, len * 2, clut, nullptr);
+
+ interpolate_simple_rgba32f(b, buf1, buf2, len, fx, fdx, fy, fdy);
+
+ length -= len;
+ b += len;
+ }
+ } else { // !(data->fast_matrix)
+ const auto fetcher =
+ (layout->bpp == QPixelLayout::BPP32)
+ ? fetchTransformedBilinear_slow_fetcher<blendType, QPixelLayout::BPP32, uint>
+ : fetchTransformedBilinear_slow_fetcher<blendType, QPixelLayout::BPPNone, uint>;
+
+ const qreal fdx = data->m11;
+ const qreal fdy = data->m12;
+ const qreal fdw = data->m13;
+ qreal fx = data->m21 * cy + data->m11 * cx + data->dx;
+ qreal fy = data->m22 * cy + data->m12 * cx + data->dy;
+ qreal fw = data->m23 * cy + data->m13 * cx + data->m33;
+ ushort distxs[BufferSize / 2];
+ ushort distys[BufferSize / 2];
+
+ while (length) {
+ const int len = qMin(length, BufferSize / 2);
+ fetcher(sbuf1, sbuf2, distxs, distys, len, data->texture, fx, fy, fw, fdx, fdy, fdw);
+
+ convert(buf1, sbuf1, len * 2, clut, nullptr);
+ convert(buf2, sbuf2, len * 2, clut, nullptr);
+
+ interpolate_perspective_rgba32f(b, buf1, buf2, len, distxs, distys);
+
+ length -= len;
+ b += len;
+ }
+ }
+ return buffer;
+}
+
+template<TextureBlendType blendType>
+static const QRgbaFloat32 *QT_FASTCALL fetchTransformedBilinearFP_uint64(QRgbaFloat32 *buffer, const QSpanData *data,
+ int y, int x, int length)
+{
+ const auto convert = convert64ToRGBA32F[data->texture.format];
+
+ const qreal cx = x + qreal(0.5);
+ const qreal cy = y + qreal(0.5);
+
+ quint64 sbuf1[BufferSize];
+ quint64 sbuf2[BufferSize];
+ QRgbaFloat32 buf1[BufferSize];
+ QRgbaFloat32 buf2[BufferSize];
+ QRgbaFloat32 *b = buffer;
+
+ if (canUseFastMatrixPath(cx, cy, length, data)) {
+ // The increment pr x in the scanline
+ const int fdx = (int)(data->m11 * fixed_scale);
+ const int fdy = (int)(data->m12 * fixed_scale);
+
+ int fx = int((data->m21 * cy + data->m11 * cx + data->dx) * fixed_scale);
+ int fy = int((data->m22 * cy + data->m12 * cx + data->dy) * fixed_scale);
+
+ fx -= half_point;
+ fy -= half_point;
+ const auto fetcher = fetchTransformedBilinear_fetcher<blendType, QPixelLayout::BPP64, quint64>;
+
+ const bool skipsecond = (fdy == 0) && ((fy & 0x0000ffff) == 0);
+ while (length) {
+ const int len = qMin(length, BufferSize / 2);
+ fetcher(sbuf1, sbuf2, len, data->texture, fx, fy, fdx, fdy);
+
+ convert(buf1, sbuf1, len * 2);
+ if (!skipsecond)
+ convert(buf2, sbuf2, len * 2);
+
+ interpolate_simple_rgba32f(b, buf1, buf2, len, fx, fdx, fy, fdy);
+
+ length -= len;
+ b += len;
+ }
+ } else { // !(data->fast_matrix)
+ const auto fetcher = fetchTransformedBilinear_slow_fetcher<blendType, QPixelLayout::BPP64, quint64>;
+
+ const qreal fdx = data->m11;
+ const qreal fdy = data->m12;
+ const qreal fdw = data->m13;
+
+ qreal fx = data->m21 * cy + data->m11 * cx + data->dx;
+ qreal fy = data->m22 * cy + data->m12 * cx + data->dy;
+ qreal fw = data->m23 * cy + data->m13 * cx + data->m33;
+
+ ushort distxs[BufferSize / 2];
+ ushort distys[BufferSize / 2];
+
+ while (length) {
+ const int len = qMin(length, BufferSize / 2);
+ fetcher(sbuf1, sbuf2, distxs, distys, len, data->texture, fx, fy, fw, fdx, fdy, fdw);
+
+ convert(buf1, sbuf1, len * 2);
+ convert(buf2, sbuf2, len * 2);
+
+ interpolate_perspective_rgba32f(b, buf1, buf2, len, distxs, distys);
+
+ length -= len;
+ b += len;
+ }
+ }
+ return buffer;
+}
+
+template<TextureBlendType blendType>
+static const QRgbaFloat32 *QT_FASTCALL fetchTransformedBilinearFP(QRgbaFloat32 *buffer, const QSpanData *data,
+ int y, int x, int length)
+{
+ const auto convert = data->rasterBuffer->format == QImage::Format_RGBA32FPx4 ? convertRGBA32FToRGBA32FPM
+ : convertRGBA32FToRGBA32F;
+
+ const qreal cx = x + qreal(0.5);
+ const qreal cy = y + qreal(0.5);
+
+ QRgbaFloat32 buf1[BufferSize];
+ QRgbaFloat32 buf2[BufferSize];
+ QRgbaFloat32 *b = buffer;
+
+ if (canUseFastMatrixPath(cx, cy, length, data)) {
+ // The increment pr x in the scanline
+ const int fdx = (int)(data->m11 * fixed_scale);
+ const int fdy = (int)(data->m12 * fixed_scale);
+
+ int fx = int((data->m21 * cy + data->m11 * cx + data->dx) * fixed_scale);
+ int fy = int((data->m22 * cy + data->m12 * cx + data->dy) * fixed_scale);
+
+ fx -= half_point;
+ fy -= half_point;
+ const auto fetcher = fetchTransformedBilinear_fetcher<blendType, QPixelLayout::BPP32FPx4, QRgbaFloat32>;
+
+ const bool skipsecond = (fdy == 0) && ((fy & 0x0000ffff) == 0);
+ while (length) {
+ const int len = qMin(length, BufferSize / 2);
+ fetcher(buf1, buf2, len, data->texture, fx, fy, fdx, fdy);
+
+ convert(buf1, len * 2);
+ if (!skipsecond)
+ convert(buf2, len * 2);
+
+ interpolate_simple_rgba32f(b, buf1, buf2, len, fx, fdx, fy, fdy);
+
+ length -= len;
+ b += len;
+ }
+ } else { // !(data->fast_matrix)
+ const auto fetcher = fetchTransformedBilinear_slow_fetcher<blendType, QPixelLayout::BPP32FPx4, QRgbaFloat32>;
+
+ const qreal fdx = data->m11;
+ const qreal fdy = data->m12;
+ const qreal fdw = data->m13;
+
+ qreal fx = data->m21 * cy + data->m11 * cx + data->dx;
+ qreal fy = data->m22 * cy + data->m12 * cx + data->dy;
+ qreal fw = data->m23 * cy + data->m13 * cx + data->m33;
+
+ ushort distxs[BufferSize / 2];
+ ushort distys[BufferSize / 2];
+
+ while (length) {
+ const int len = qMin(length, BufferSize / 2);
+ fetcher(buf1, buf2, distxs, distys, len, data->texture, fx, fy, fw, fdx, fdy, fdw);
+
+ convert(buf1, len * 2);
+ convert(buf2, len * 2);
+
+ interpolate_perspective_rgba32f(b, buf1, buf2, len, distxs, distys);
+
+ length -= len;
+ b += len;
+ }
+ }
+ return buffer;
+}
+
+template<TextureBlendType blendType>
+static const QRgbaFloat32 *QT_FASTCALL fetchTransformedBilinearFP(QRgbaFloat32 *buffer, const Operator *,
+ const QSpanData *data, int y, int x, int length)
+{
+ switch (qPixelLayouts[data->texture.format].bpp) {
+ case QPixelLayout::BPP64:
+ case QPixelLayout::BPP16FPx4:
+ return fetchTransformedBilinearFP_uint64<blendType>(buffer, data, y, x, length);
+ case QPixelLayout::BPP32FPx4:
+ return fetchTransformedBilinearFP<blendType>(buffer, data, y, x, length);
+ default:
+ return fetchTransformedBilinearFP_uint32<blendType>(buffer, data, y, x, length);
+ }
+}
+#endif // QT_CONFIG(raster_fp)
+
// FetchUntransformed can have more specialized methods added depending on SIMD features.
-static SourceFetchProc sourceFetchUntransformed[QImage::NImageFormats] = {
+static SourceFetchProc sourceFetchUntransformed[] = {
nullptr, // Invalid
fetchUntransformed, // Mono
fetchUntransformed, // MonoLsb
@@ -3937,9 +3122,18 @@ static SourceFetchProc sourceFetchUntransformed[QImage::NImageFormats] = {
fetchUntransformed, // RGBA64_Premultiplied
fetchUntransformed, // Grayscale16
fetchUntransformed, // BGR888
+ fetchUntransformed, // RGBX16FPx4
+ fetchUntransformed, // RGBA16FPx4
+ fetchUntransformed, // RGBA16FPx4_Premultiplied
+ fetchUntransformed, // RGBX32Px4
+ fetchUntransformed, // RGBA32FPx4
+ fetchUntransformed, // RGBA32FPx4_Premultiplied
+ fetchUntransformed, // CMYK8888
};
-static const SourceFetchProc sourceFetchGeneric[NBlendTypes] = {
+static_assert(std::size(sourceFetchUntransformed) == QImage::NImageFormats);
+
+static const SourceFetchProc sourceFetchGeneric[] = {
fetchUntransformed, // Untransformed
fetchUntransformed, // Tiled
fetchTransformed<BlendTransformed, QPixelLayout::BPPNone>, // Transformed
@@ -3948,7 +3142,9 @@ static const SourceFetchProc sourceFetchGeneric[NBlendTypes] = {
fetchTransformedBilinear<BlendTransformedBilinearTiled, QPixelLayout::BPPNone> // TransformedBilinearTiled
};
-static SourceFetchProc sourceFetchARGB32PM[NBlendTypes] = {
+static_assert(std::size(sourceFetchGeneric) == NBlendTypes);
+
+static SourceFetchProc sourceFetchARGB32PM[] = {
fetchUntransformedARGB32PM, // Untransformed
fetchUntransformedARGB32PM, // Tiled
fetchTransformed<BlendTransformed, QPixelLayout::BPP32>, // Transformed
@@ -3957,7 +3153,9 @@ static SourceFetchProc sourceFetchARGB32PM[NBlendTypes] = {
fetchTransformedBilinearARGB32PM<BlendTransformedBilinearTiled> // BilinearTiled
};
-static SourceFetchProc sourceFetchAny16[NBlendTypes] = {
+static_assert(std::size(sourceFetchARGB32PM) == NBlendTypes);
+
+static SourceFetchProc sourceFetchAny16[] = {
fetchUntransformed, // Untransformed
fetchUntransformed, // Tiled
fetchTransformed<BlendTransformed, QPixelLayout::BPP16>, // Transformed
@@ -3966,7 +3164,9 @@ static SourceFetchProc sourceFetchAny16[NBlendTypes] = {
fetchTransformedBilinear<BlendTransformedBilinearTiled, QPixelLayout::BPP16> // TransformedBilinearTiled
};
-static SourceFetchProc sourceFetchAny32[NBlendTypes] = {
+static_assert(std::size(sourceFetchAny16) == NBlendTypes);
+
+static SourceFetchProc sourceFetchAny32[] = {
fetchUntransformed, // Untransformed
fetchUntransformed, // Tiled
fetchTransformed<BlendTransformed, QPixelLayout::BPP32>, // Transformed
@@ -3975,6 +3175,8 @@ static SourceFetchProc sourceFetchAny32[NBlendTypes] = {
fetchTransformedBilinear<BlendTransformedBilinearTiled, QPixelLayout::BPP32> // TransformedBilinearTiled
};
+static_assert(std::size(sourceFetchAny32) == NBlendTypes);
+
static inline SourceFetchProc getSourceFetch(TextureBlendType blendType, QImage::Format format)
{
if (format == QImage::Format_RGB32 || format == QImage::Format_ARGB32_Premultiplied)
@@ -3989,7 +3191,7 @@ static inline SourceFetchProc getSourceFetch(TextureBlendType blendType, QImage:
}
#if QT_CONFIG(raster_64bit)
-static const SourceFetchProc64 sourceFetchGeneric64[NBlendTypes] = {
+static const SourceFetchProc64 sourceFetchGeneric64[] = {
fetchUntransformed64, // Untransformed
fetchUntransformed64, // Tiled
fetchTransformed64<BlendTransformed>, // Transformed
@@ -3998,7 +3200,9 @@ static const SourceFetchProc64 sourceFetchGeneric64[NBlendTypes] = {
fetchTransformedBilinear64<BlendTransformedBilinearTiled> // BilinearTiled
};
-static const SourceFetchProc64 sourceFetchRGBA64PM[NBlendTypes] = {
+static_assert(std::size(sourceFetchGeneric64) == NBlendTypes);
+
+static const SourceFetchProc64 sourceFetchRGBA64PM[] = {
fetchUntransformedRGBA64PM, // Untransformed
fetchUntransformedRGBA64PM, // Tiled
fetchTransformed64<BlendTransformed>, // Transformed
@@ -4007,6 +3211,8 @@ static const SourceFetchProc64 sourceFetchRGBA64PM[NBlendTypes] = {
fetchTransformedBilinear64<BlendTransformedBilinearTiled> // BilinearTiled
};
+static_assert(std::size(sourceFetchRGBA64PM) == NBlendTypes);
+
static inline SourceFetchProc64 getSourceFetch64(TextureBlendType blendType, QImage::Format format)
{
if (format == QImage::Format_RGBX64 || format == QImage::Format_RGBA64_Premultiplied)
@@ -4015,9 +3221,27 @@ static inline SourceFetchProc64 getSourceFetch64(TextureBlendType blendType, QIm
}
#endif
+#if QT_CONFIG(raster_fp)
+static const SourceFetchProcFP sourceFetchGenericFP[] = {
+ fetchUntransformedFP, // Untransformed
+ fetchUntransformedFP, // Tiled
+ fetchTransformedFP<BlendTransformed>, // Transformed
+ fetchTransformedFP<BlendTransformedTiled>, // TransformedTiled
+ fetchTransformedBilinearFP<BlendTransformedBilinear>, // Bilinear
+ fetchTransformedBilinearFP<BlendTransformedBilinearTiled> // BilinearTiled
+};
+
+static_assert(std::size(sourceFetchGenericFP) == NBlendTypes);
+
+static inline SourceFetchProcFP getSourceFetchFP(TextureBlendType blendType, QImage::Format /*format*/)
+{
+ return sourceFetchGenericFP[blendType];
+}
+#endif
#define FIXPT_BITS 8
#define FIXPT_SIZE (1<<FIXPT_BITS)
+#define FIXPT_MAX (INT_MAX >> (FIXPT_BITS + 1))
static uint qt_gradient_pixel_fixed(const QGradientData *data, int fixed_pos)
{
@@ -4033,6 +3257,22 @@ static const QRgba64& qt_gradient_pixel64_fixed(const QGradientData *data, int f
}
#endif
+#if QT_CONFIG(raster_fp)
+static inline QRgbaFloat32 qt_gradient_pixelFP(const QGradientData *data, qreal pos)
+{
+ int ipos = int(pos * (GRADIENT_STOPTABLE_SIZE - 1) + qreal(0.5));
+ QRgba64 rgb64 = data->colorTable64[qt_gradient_clamp(data, ipos)];
+ return QRgbaFloat32::fromRgba64(rgb64.red(),rgb64.green(), rgb64.blue(), rgb64.alpha());
+}
+
+static inline QRgbaFloat32 qt_gradient_pixelFP_fixed(const QGradientData *data, int fixed_pos)
+{
+ int ipos = (fixed_pos + (FIXPT_SIZE / 2)) >> FIXPT_BITS;
+ QRgba64 rgb64 = data->colorTable64[qt_gradient_clamp(data, ipos)];
+ return QRgbaFloat32::fromRgba64(rgb64.red(), rgb64.green(), rgb64.blue(), rgb64.alpha());
+}
+#endif
+
static void QT_FASTCALL getLinearGradientValues(LinearGradientValues *v, const QSpanData *data)
{
v->dx = data->gradient.linear.end.x - data->gradient.linear.origin.x;
@@ -4053,6 +3293,7 @@ public:
static Type null() { return 0; }
static Type fetchSingle(const QGradientData& gradient, qreal v)
{
+ Q_ASSERT(std::isfinite(v));
return qt_gradient_pixel(&gradient, v);
}
static Type fetchSingle(const QGradientData& gradient, int v)
@@ -4073,6 +3314,7 @@ public:
static Type null() { return QRgba64::fromRgba64(0); }
static Type fetchSingle(const QGradientData& gradient, qreal v)
{
+ Q_ASSERT(std::isfinite(v));
return qt_gradient_pixel64(&gradient, v);
}
static Type fetchSingle(const QGradientData& gradient, int v)
@@ -4086,6 +3328,30 @@ public:
};
#endif
+#if QT_CONFIG(raster_fp)
+class GradientBaseFP
+{
+public:
+ typedef QRgbaFloat32 Type;
+ static Type null() { return QRgbaFloat32::fromRgba64(0,0,0,0); }
+ static Type fetchSingle(const QGradientData& gradient, qreal v)
+ {
+ Q_ASSERT(std::isfinite(v));
+ return qt_gradient_pixelFP(&gradient, v);
+ }
+ static Type fetchSingle(const QGradientData& gradient, int v)
+ {
+ return qt_gradient_pixelFP_fixed(&gradient, v);
+ }
+ static void memfill(Type *buffer, Type fill, int length)
+ {
+ quint64 fillCopy;
+ memcpy(&fillCopy, &fill, sizeof(quint64));
+ qt_memfill64((quint64*)buffer, fillCopy, length);
+ }
+};
+#endif
+
template<class GradientBase, typename BlendType>
static inline const BlendType * QT_FASTCALL qt_fetch_linear_gradient_template(
BlendType *buffer, const Operator *op, const QSpanData *data,
@@ -4114,10 +3380,12 @@ static inline const BlendType * QT_FASTCALL qt_fetch_linear_gradient_template(
const BlendType *end = buffer + length;
if (affine) {
if (inc > qreal(-1e-5) && inc < qreal(1e-5)) {
- GradientBase::memfill(buffer, GradientBase::fetchSingle(data->gradient, int(t * FIXPT_SIZE)), length);
+ if (std::abs(t) < FIXPT_MAX)
+ GradientBase::memfill(buffer, GradientBase::fetchSingle(data->gradient, int(t * FIXPT_SIZE)), length);
+ else
+ GradientBase::memfill(buffer, GradientBase::fetchSingle(data->gradient, t / GRADIENT_STOPTABLE_SIZE), length);
} else {
- if (t+inc*length < qreal(INT_MAX >> (FIXPT_BITS + 1)) &&
- t+inc*length > qreal(INT_MIN >> (FIXPT_BITS + 1))) {
+ if (std::abs(t) < FIXPT_MAX && std::abs(inc) < FIXPT_MAX && std::abs(t + inc * length) < FIXPT_MAX) {
// we can use fixed point math
int t_fixed = int(t * FIXPT_SIZE);
int inc_fixed = int(inc * FIXPT_SIZE);
@@ -4169,6 +3437,13 @@ static const QRgba64 * QT_FASTCALL qt_fetch_linear_gradient_rgb64(QRgba64 *buffe
return qt_fetch_linear_gradient_template<GradientBase64, QRgba64>(buffer, op, data, y, x, length);
}
#endif
+#if QT_CONFIG(raster_fp)
+static const QRgbaFloat32 * QT_FASTCALL qt_fetch_linear_gradient_rgbfp(QRgbaFloat32 *buffer, const Operator *op, const QSpanData *data,
+ int y, int x, int length)
+{
+ return qt_fetch_linear_gradient_template<GradientBaseFP, QRgbaFloat32>(buffer, op, data, y, x, length);
+}
+#endif
static void QT_FASTCALL getRadialGradientValues(RadialGradientValues *v, const QSpanData *data)
{
@@ -4179,7 +3454,6 @@ static void QT_FASTCALL getRadialGradientValues(RadialGradientValues *v, const Q
v->sqrfr = data->gradient.radial.focal.radius * data->gradient.radial.focal.radius;
v->a = v->dr * v->dr - v->dx*v->dx - v->dy*v->dy;
- v->inv2a = 1 / (2 * v->a);
v->extended = !qFuzzyIsNull(data->gradient.radial.focal.radius) || v->a <= 0;
}
@@ -4212,7 +3486,13 @@ public:
}
} else {
while (buffer < end) {
- *buffer++ = GradientBase::fetchSingle(data->gradient, qSqrt(det) - b);
+ BlendType result = GradientBase::null();
+ if (det >= 0) {
+ qreal w = qSqrt(det) - b;
+ result = GradientBase::fetchSingle(data->gradient, w);
+ }
+
+ *buffer++ = result;
det += delta_det;
delta_det += delta_delta_det;
@@ -4238,6 +3518,14 @@ const QRgba64 * QT_FASTCALL qt_fetch_radial_gradient_rgb64(QRgba64 *buffer, cons
}
#endif
+#if QT_CONFIG(raster_fp)
+static const QRgbaFloat32 * QT_FASTCALL qt_fetch_radial_gradient_rgbfp(QRgbaFloat32 *buffer, const Operator *op, const QSpanData *data,
+ int y, int x, int length)
+{
+ return qt_fetch_radial_gradient_template<RadialFetchPlain<GradientBaseFP>, QRgbaFloat32>(buffer, op, data, y, x, length);
+}
+#endif
+
template <class GradientBase, typename BlendType>
static inline const BlendType * QT_FASTCALL qt_fetch_conical_gradient_template(
BlendType *buffer, const QSpanData *data,
@@ -4303,26 +3591,44 @@ static const QRgba64 * QT_FASTCALL qt_fetch_conical_gradient_rgb64(QRgba64 *buff
}
#endif
+#if QT_CONFIG(raster_fp)
+static const QRgbaFloat32 * QT_FASTCALL qt_fetch_conical_gradient_rgbfp(QRgbaFloat32 *buffer, const Operator *, const QSpanData *data,
+ int y, int x, int length)
+{
+ return qt_fetch_conical_gradient_template<GradientBaseFP, QRgbaFloat32>(buffer, data, y, x, length);
+}
+#endif
+
extern CompositionFunctionSolid qt_functionForModeSolid_C[];
extern CompositionFunctionSolid64 qt_functionForModeSolid64_C[];
+extern CompositionFunctionSolidFP qt_functionForModeSolidFP_C[];
static const CompositionFunctionSolid *functionForModeSolid = qt_functionForModeSolid_C;
#if QT_CONFIG(raster_64bit)
static const CompositionFunctionSolid64 *functionForModeSolid64 = qt_functionForModeSolid64_C;
#endif
+#if QT_CONFIG(raster_fp)
+static const CompositionFunctionSolidFP *functionForModeSolidFP = qt_functionForModeSolidFP_C;
+#endif
extern CompositionFunction qt_functionForMode_C[];
extern CompositionFunction64 qt_functionForMode64_C[];
+extern CompositionFunctionFP qt_functionForModeFP_C[];
static const CompositionFunction *functionForMode = qt_functionForMode_C;
#if QT_CONFIG(raster_64bit)
static const CompositionFunction64 *functionForMode64 = qt_functionForMode64_C;
#endif
+#if QT_CONFIG(raster_fp)
+static const CompositionFunctionFP *functionForModeFP = qt_functionForModeFP_C;
+#endif
static TextureBlendType getBlendType(const QSpanData *data)
{
TextureBlendType ft;
- if (data->txop <= QTransform::TxTranslate)
+ if (data->texture.type == QTextureData::Pattern)
+ ft = BlendTiled;
+ else if (data->txop <= QTransform::TxTranslate)
if (data->texture.type == QTextureData::Tiled)
ft = BlendTiled;
else
@@ -4340,18 +3646,16 @@ static TextureBlendType getBlendType(const QSpanData *data)
return ft;
}
-static inline Operator getOperator(const QSpanData *data, const QSpan *spans, int spanCount)
+static inline Operator getOperator(const QSpanData *data, const QT_FT_Span *spans, int spanCount)
{
Operator op;
bool solidSource = false;
-
switch(data->type) {
case QSpanData::Solid:
- solidSource = data->solidColor.isOpaque();
+ solidSource = data->solidColor.alphaF() >= 1.0f;
op.srcFetch = nullptr;
-#if QT_CONFIG(raster_64bit)
op.srcFetch64 = nullptr;
-#endif
+ op.srcFetchFP = nullptr;
break;
case QSpanData::LinearGradient:
solidSource = !data->gradient.alphaColor;
@@ -4360,6 +3664,9 @@ static inline Operator getOperator(const QSpanData *data, const QSpan *spans, in
#if QT_CONFIG(raster_64bit)
op.srcFetch64 = qt_fetch_linear_gradient_rgb64;
#endif
+#if QT_CONFIG(raster_fp)
+ op.srcFetchFP = qt_fetch_linear_gradient_rgbfp;
+#endif
break;
case QSpanData::RadialGradient:
solidSource = !data->gradient.alphaColor;
@@ -4368,6 +3675,9 @@ static inline Operator getOperator(const QSpanData *data, const QSpan *spans, in
#if QT_CONFIG(raster_64bit)
op.srcFetch64 = qt_fetch_radial_gradient_rgb64;
#endif
+#if QT_CONFIG(raster_fp)
+ op.srcFetchFP = qt_fetch_radial_gradient_rgbfp;
+#endif
break;
case QSpanData::ConicalGradient:
solidSource = !data->gradient.alphaColor;
@@ -4375,12 +3685,18 @@ static inline Operator getOperator(const QSpanData *data, const QSpan *spans, in
#if QT_CONFIG(raster_64bit)
op.srcFetch64 = qt_fetch_conical_gradient_rgb64;
#endif
+#if QT_CONFIG(raster_fp)
+ op.srcFetchFP = qt_fetch_conical_gradient_rgbfp;
+#endif
break;
case QSpanData::Texture:
solidSource = !data->texture.hasAlpha;
op.srcFetch = getSourceFetch(getBlendType(data), data->texture.format);
#if QT_CONFIG(raster_64bit)
- op.srcFetch64 = getSourceFetch64(getBlendType(data), data->texture.format);;
+ op.srcFetch64 = getSourceFetch64(getBlendType(data), data->texture.format);
+#endif
+#if QT_CONFIG(raster_fp)
+ op.srcFetchFP = getSourceFetchFP(getBlendType(data), data->texture.format);
#endif
break;
default:
@@ -4388,7 +3704,10 @@ static inline Operator getOperator(const QSpanData *data, const QSpan *spans, in
break;
}
#if !QT_CONFIG(raster_64bit)
- op.srcFetch64 = 0;
+ op.srcFetch64 = nullptr;
+#endif
+#if !QT_CONFIG(raster_fp)
+ op.srcFetchFP = nullptr;
#endif
op.mode = data->rasterBuffer->compositionMode;
@@ -4399,11 +3718,16 @@ static inline Operator getOperator(const QSpanData *data, const QSpan *spans, in
#if QT_CONFIG(raster_64bit)
op.destFetch64 = destFetchProc64[data->rasterBuffer->format];
#else
- op.destFetch64 = 0;
+ op.destFetch64 = nullptr;
+#endif
+#if QT_CONFIG(raster_fp)
+ op.destFetchFP = destFetchProcFP[data->rasterBuffer->format];
+#else
+ op.destFetchFP = nullptr;
#endif
if (op.mode == QPainter::CompositionMode_Source &&
(data->type != QSpanData::Texture || data->texture.const_alpha == 256)) {
- const QSpan *lastSpan = spans + spanCount;
+ const QT_FT_Span *lastSpan = spans + spanCount;
bool alphaSpans = false;
while (spans < lastSpan) {
if (spans->coverage != 255) {
@@ -4421,6 +3745,10 @@ static inline Operator getOperator(const QSpanData *data, const QSpan *spans, in
if (op.destFetch64 != destFetchRGB64)
op.destFetch64 = destFetch64Undefined;
#endif
+#if QT_CONFIG(raster_fp)
+ if (op.destFetchFP != destFetchRGBFP)
+ op.destFetchFP = destFetchFPUndefined;
+#endif
}
}
@@ -4432,9 +3760,18 @@ static inline Operator getOperator(const QSpanData *data, const QSpan *spans, in
op.funcSolid64 = functionForModeSolid64[op.mode];
op.func64 = functionForMode64[op.mode];
#else
- op.destStore64 = 0;
- op.funcSolid64 = 0;
- op.func64 = 0;
+ op.destStore64 = nullptr;
+ op.funcSolid64 = nullptr;
+ op.func64 = nullptr;
+#endif
+#if QT_CONFIG(raster_fp)
+ op.destStoreFP = destStoreFP;
+ op.funcSolidFP = functionForModeSolidFP[op.mode];
+ op.funcFP = functionForModeFP[op.mode];
+#else
+ op.destStoreFP = nullptr;
+ op.funcSolidFP = nullptr;
+ op.funcFP = nullptr;
#endif
return op;
@@ -4443,6 +3780,12 @@ static inline Operator getOperator(const QSpanData *data, const QSpan *spans, in
static void spanfill_from_first(QRasterBuffer *rasterBuffer, QPixelLayout::BPP bpp, int x, int y, int length)
{
switch (bpp) {
+ case QPixelLayout::BPP32FPx4: {
+ QRgbaFloat32 *dest = reinterpret_cast<QRgbaFloat32 *>(rasterBuffer->scanLine(y)) + x;
+ qt_memfill_template(dest + 1, dest[0], length - 1);
+ break;
+ }
+ case QPixelLayout::BPP16FPx4:
case QPixelLayout::BPP64: {
quint64 *dest = reinterpret_cast<quint64 *>(rasterBuffer->scanLine(y)) + x;
qt_memfill_template(dest + 1, dest[0], length - 1);
@@ -4476,45 +3819,69 @@ static void spanfill_from_first(QRasterBuffer *rasterBuffer, QPixelLayout::BPP b
// -------------------- blend methods ---------------------
-static void blend_color_generic(int count, const QSpan *spans, void *userData)
+#if defined(QT_USE_THREAD_PARALLEL_FILLS)
+#define QT_THREAD_PARALLEL_FILLS(function) \
+ const int segments = (count + 32) / 64; \
+ QThreadPool *threadPool = QThreadPoolPrivate::qtGuiInstance(); \
+ if (segments > 1 && qPixelLayouts[data->rasterBuffer->format].bpp >= QPixelLayout::BPP8 \
+ && threadPool && !threadPool->contains(QThread::currentThread())) { \
+ QSemaphore semaphore; \
+ int c = 0; \
+ for (int i = 0; i < segments; ++i) { \
+ int cn = (count - c) / (segments - i); \
+ threadPool->start([&, c, cn]() { \
+ function(c, c + cn); \
+ semaphore.release(1); \
+ }, 1); \
+ c += cn; \
+ } \
+ semaphore.acquire(segments); \
+ } else \
+ function(0, count)
+#else
+#define QT_THREAD_PARALLEL_FILLS(function) function(0, count)
+#endif
+
+static void blend_color_generic(int count, const QT_FT_Span *spans, void *userData)
{
QSpanData *data = reinterpret_cast<QSpanData *>(userData);
- uint buffer[BufferSize];
- Operator op = getOperator(data, nullptr, 0);
- const uint color = data->solidColor.toArgb32();
- bool solidFill = data->rasterBuffer->compositionMode == QPainter::CompositionMode_Source
- || (data->rasterBuffer->compositionMode == QPainter::CompositionMode_SourceOver && qAlpha(color) == 255);
- QPixelLayout::BPP bpp = qPixelLayouts[data->rasterBuffer->format].bpp;
-
- while (count--) {
- int x = spans->x;
- int length = spans->len;
- if (solidFill && bpp >= QPixelLayout::BPP8 && spans->coverage == 255 && length) {
- // If dest doesn't matter we don't need to bother with blending or converting all the identical pixels
- op.destStore(data->rasterBuffer, x, spans->y, &color, 1);
- spanfill_from_first(data->rasterBuffer, bpp, x, spans->y, length);
- length = 0;
- }
+ const Operator op = getOperator(data, nullptr, 0);
+ const uint color = data->solidColor.rgba();
+ const bool solidFill = op.mode == QPainter::CompositionMode_Source;
+ const QPixelLayout::BPP bpp = qPixelLayouts[data->rasterBuffer->format].bpp;
+
+ auto function = [=] (int cStart, int cEnd) {
+ alignas(16) uint buffer[BufferSize];
+ for (int c = cStart; c < cEnd; ++c) {
+ int x = spans[c].x;
+ int length = spans[c].len;
+ if (solidFill && bpp >= QPixelLayout::BPP8 && spans[c].coverage == 255 && length && op.destStore) {
+ // If dest doesn't matter we don't need to bother with blending or converting all the identical pixels
+ op.destStore(data->rasterBuffer, x, spans[c].y, &color, 1);
+ spanfill_from_first(data->rasterBuffer, bpp, x, spans[c].y, length);
+ length = 0;
+ }
- while (length) {
- int l = qMin(BufferSize, length);
- uint *dest = op.destFetch(buffer, data->rasterBuffer, x, spans->y, l);
- op.funcSolid(dest, l, color, spans->coverage);
- if (op.destStore)
- op.destStore(data->rasterBuffer, x, spans->y, dest, l);
- length -= l;
- x += l;
+ while (length) {
+ int l = qMin(BufferSize, length);
+ uint *dest = op.destFetch(buffer, data->rasterBuffer, x, spans[c].y, l);
+ op.funcSolid(dest, l, color, spans[c].coverage);
+ if (op.destStore)
+ op.destStore(data->rasterBuffer, x, spans[c].y, dest, l);
+ length -= l;
+ x += l;
+ }
}
- ++spans;
- }
+ };
+ QT_THREAD_PARALLEL_FILLS(function);
}
-static void blend_color_argb(int count, const QSpan *spans, void *userData)
+static void blend_color_argb(int count, const QT_FT_Span *spans, void *userData)
{
QSpanData *data = reinterpret_cast<QSpanData *>(userData);
const Operator op = getOperator(data, nullptr, 0);
- const uint color = data->solidColor.toArgb32();
+ const uint color = data->solidColor.rgba();
if (op.mode == QPainter::CompositionMode_Source) {
// inline for performance
@@ -4522,6 +3889,10 @@ static void blend_color_argb(int count, const QSpan *spans, void *userData)
uint *target = ((uint *)data->rasterBuffer->scanLine(spans->y)) + spans->x;
if (spans->coverage == 255) {
qt_memfill(target, color, spans->len);
+#ifdef __SSE2__
+ } else if (spans->len > 16) {
+ op.funcSolid(target, spans->len, color, spans->coverage);
+#endif
} else {
uint c = BYTE_MUL(color, spans->coverage);
int ialpha = 255 - spans->coverage;
@@ -4532,219 +3903,186 @@ static void blend_color_argb(int count, const QSpan *spans, void *userData)
}
return;
}
-
- while (count--) {
- uint *target = ((uint *)data->rasterBuffer->scanLine(spans->y)) + spans->x;
- op.funcSolid(target, spans->len, color, spans->coverage);
- ++spans;
- }
+ const auto funcSolid = op.funcSolid;
+ auto function = [=] (int cStart, int cEnd) {
+ for (int c = cStart; c < cEnd; ++c) {
+ uint *target = ((uint *)data->rasterBuffer->scanLine(spans[c].y)) + spans[c].x;
+ funcSolid(target, spans[c].len, color, spans[c].coverage);
+ }
+ };
+ QT_THREAD_PARALLEL_FILLS(function);
}
-void blend_color_generic_rgb64(int count, const QSpan *spans, void *userData)
+static void blend_color_generic_rgb64(int count, const QT_FT_Span *spans, void *userData)
{
#if QT_CONFIG(raster_64bit)
QSpanData *data = reinterpret_cast<QSpanData *>(userData);
- Operator op = getOperator(data, nullptr, 0);
+ const Operator op = getOperator(data, nullptr, 0);
if (!op.funcSolid64) {
qCDebug(lcQtGuiDrawHelper, "blend_color_generic_rgb64: unsupported 64bit blend attempted, falling back to 32-bit");
return blend_color_generic(count, spans, userData);
}
- alignas(8) QRgba64 buffer[BufferSize];
- const QRgba64 color = data->solidColor;
- bool solidFill = data->rasterBuffer->compositionMode == QPainter::CompositionMode_Source
- || (data->rasterBuffer->compositionMode == QPainter::CompositionMode_SourceOver && color.isOpaque());
- QPixelLayout::BPP bpp = qPixelLayouts[data->rasterBuffer->format].bpp;
+ const QRgba64 color = data->solidColor.rgba64();
+ const bool solidFill = op.mode == QPainter::CompositionMode_Source;
+ const QPixelLayout::BPP bpp = qPixelLayouts[data->rasterBuffer->format].bpp;
- while (count--) {
- int x = spans->x;
- int length = spans->len;
- if (solidFill && bpp >= QPixelLayout::BPP8 && spans->coverage == 255 && length && op.destStore64) {
- // If dest doesn't matter we don't need to bother with blending or converting all the identical pixels
- op.destStore64(data->rasterBuffer, x, spans->y, &color, 1);
- spanfill_from_first(data->rasterBuffer, bpp, x, spans->y, length);
- length = 0;
- }
+ auto function = [=, &op] (int cStart, int cEnd)
+ {
+ alignas(16) QRgba64 buffer[BufferSize];
+ for (int c = cStart; c < cEnd; ++c) {
+ int x = spans[c].x;
+ int length = spans[c].len;
+ if (solidFill && bpp >= QPixelLayout::BPP8 && spans[c].coverage == 255 && length && op.destStore64) {
+ // If dest doesn't matter we don't need to bother with blending or converting all the identical pixels
+ op.destStore64(data->rasterBuffer, x, spans[c].y, &color, 1);
+ spanfill_from_first(data->rasterBuffer, bpp, x, spans[c].y, length);
+ length = 0;
+ }
- while (length) {
- int l = qMin(BufferSize, length);
- QRgba64 *dest = op.destFetch64(buffer, data->rasterBuffer, x, spans->y, l);
- op.funcSolid64(dest, l, color, spans->coverage);
- if (op.destStore64)
- op.destStore64(data->rasterBuffer, x, spans->y, dest, l);
- length -= l;
- x += l;
+ while (length) {
+ int l = qMin(BufferSize, length);
+ QRgba64 *dest = op.destFetch64(buffer, data->rasterBuffer, x, spans[c].y, l);
+ op.funcSolid64(dest, l, color, spans[c].coverage);
+ if (op.destStore64)
+ op.destStore64(data->rasterBuffer, x, spans[c].y, dest, l);
+ length -= l;
+ x += l;
+ }
}
- ++spans;
- }
+ };
+ QT_THREAD_PARALLEL_FILLS(function);
#else
blend_color_generic(count, spans, userData);
#endif
}
-static void blend_color_rgb16(int count, const QSpan *spans, void *userData)
+static void blend_color_generic_fp(int count, const QT_FT_Span *spans, void *userData)
{
+#if QT_CONFIG(raster_fp)
QSpanData *data = reinterpret_cast<QSpanData *>(userData);
+ const Operator op = getOperator(data, nullptr, 0);
+ if (!op.funcSolidFP || !op.destFetchFP) {
+ qCDebug(lcQtGuiDrawHelper, "blend_color_generic_fp: unsupported 4xF16 blend attempted, falling back to 32-bit");
+ return blend_color_generic(count, spans, userData);
+ }
- /*
- We duplicate a little logic from getOperator() and calculate the
- composition mode directly. This allows blend_color_rgb16 to be used
- from qt_gradient_quint16 with minimal overhead.
- */
- QPainter::CompositionMode mode = data->rasterBuffer->compositionMode;
- if (mode == QPainter::CompositionMode_SourceOver && data->solidColor.isOpaque())
- mode = QPainter::CompositionMode_Source;
+ float r, g, b, a;
+ data->solidColor.getRgbF(&r, &g, &b, &a);
+ const QRgbaFloat32 color{r, g, b, a};
+ const bool solidFill = op.mode == QPainter::CompositionMode_Source;
+ QPixelLayout::BPP bpp = qPixelLayouts[data->rasterBuffer->format].bpp;
- if (mode == QPainter::CompositionMode_Source) {
- // inline for performance
- ushort c = data->solidColor.toRgb16();
- for (; count--; spans++) {
- if (!spans->len)
- continue;
- ushort *target = ((ushort *)data->rasterBuffer->scanLine(spans->y)) + spans->x;
- if (spans->coverage == 255) {
- qt_memfill(target, c, spans->len);
- } else {
- ushort color = BYTE_MUL_RGB16(c, spans->coverage);
- int ialpha = 255 - spans->coverage;
- const ushort *end = target + spans->len;
- while (target < end) {
- *target = color + BYTE_MUL_RGB16(*target, ialpha);
- ++target;
- }
+ auto function = [=, &op] (int cStart, int cEnd)
+ {
+ alignas(16) QRgbaFloat32 buffer[BufferSize];
+ for (int c = cStart; c < cEnd; ++c) {
+ int x = spans[c].x;
+ int length = spans[c].len;
+ if (solidFill && bpp >= QPixelLayout::BPP8 && spans[c].coverage == 255 && length && op.destStoreFP) {
+ // If dest doesn't matter we don't need to bother with blending or converting all the identical pixels
+ op.destStoreFP(data->rasterBuffer, x, spans[c].y, &color, 1);
+ spanfill_from_first(data->rasterBuffer, bpp, x, spans[c].y, length);
+ length = 0;
}
- }
- return;
- }
- if (mode == QPainter::CompositionMode_SourceOver) {
- for (; count--; spans++) {
- if (!spans->len)
- continue;
- uint color = BYTE_MUL(data->solidColor.toArgb32(), spans->coverage);
- int ialpha = qAlpha(~color);
- ushort c = qConvertRgb32To16(color);
- ushort *target = ((ushort *)data->rasterBuffer->scanLine(spans->y)) + spans->x;
- int len = spans->len;
- bool pre = (((quintptr)target) & 0x3) != 0;
- bool post = false;
- if (pre) {
- // skip to word boundary
- *target = c + BYTE_MUL_RGB16(*target, ialpha);
- ++target;
- --len;
- }
- if (len & 0x1) {
- post = true;
- --len;
- }
- uint *target32 = (uint*)target;
- uint c32 = c | (c<<16);
- len >>= 1;
- uint salpha = (ialpha+1) >> 3; // calculate here rather than in loop
- while (len--) {
- // blend full words
- *target32 = c32 + BYTE_MUL_RGB16_32(*target32, salpha);
- ++target32;
- target += 2;
- }
- if (post) {
- // one last pixel beyond a full word
- *target = c + BYTE_MUL_RGB16(*target, ialpha);
+ while (length) {
+ int l = qMin(BufferSize, length);
+ QRgbaFloat32 *dest = op.destFetchFP(buffer, data->rasterBuffer, x, spans[c].y, l);
+ op.funcSolidFP(dest, l, color, spans[c].coverage);
+ if (op.destStoreFP)
+ op.destStoreFP(data->rasterBuffer, x, spans[c].y, dest, l);
+ length -= l;
+ x += l;
}
}
- return;
- }
-
+ };
+ QT_THREAD_PARALLEL_FILLS(function);
+#else
blend_color_generic(count, spans, userData);
+#endif
}
template <typename T>
-void handleSpans(int count, const QSpan *spans, const QSpanData *data, T &handler)
+void handleSpans(int count, const QT_FT_Span *spans, const QSpanData *data, const Operator &op)
{
- uint const_alpha = 256;
- if (data->type == QSpanData::Texture)
- const_alpha = data->texture.const_alpha;
+ const int const_alpha = (data->type == QSpanData::Texture) ? data->texture.const_alpha : 256;
+ const bool solidSource = op.mode == QPainter::CompositionMode_Source && const_alpha == 256;
- int coverage = 0;
- while (count) {
- if (!spans->len) {
- ++spans;
- --count;
- continue;
- }
- int x = spans->x;
- const int y = spans->y;
- int right = x + spans->len;
+ auto function = [=, &op] (int cStart, int cEnd)
+ {
+ T handler(data, op);
+ int coverage = 0;
+ for (int c = cStart; c < cEnd;) {
+ if (!spans[c].len) {
+ ++c;
+ continue;
+ }
+ int x = spans[c].x;
+ const int y = spans[c].y;
+ int right = x + spans[c].len;
+ const bool fetchDest = !solidSource || spans[c].coverage < 255;
- // compute length of adjacent spans
- for (int i = 1; i < count && spans[i].y == y && spans[i].x == right; ++i)
- right += spans[i].len;
- int length = right - x;
+ // compute length of adjacent spans
+ for (int i = c + 1; i < cEnd && spans[i].y == y && spans[i].x == right && fetchDest == (!solidSource || spans[i].coverage < 255); ++i)
+ right += spans[i].len;
+ int length = right - x;
- while (length) {
- int l = qMin(BufferSize, length);
- length -= l;
+ while (length) {
+ int l = qMin(BufferSize, length);
+ length -= l;
- int process_length = l;
- int process_x = x;
+ int process_length = l;
+ int process_x = x;
- const typename T::BlendType *src = handler.fetch(process_x, y, process_length);
- int offset = 0;
- while (l > 0) {
- if (x == spans->x) // new span?
- coverage = (spans->coverage * const_alpha) >> 8;
+ const auto *src = handler.fetch(process_x, y, process_length, fetchDest);
+ int offset = 0;
+ while (l > 0) {
+ if (x == spans[c].x) // new span?
+ coverage = (spans[c].coverage * const_alpha) >> 8;
- int right = spans->x + spans->len;
- int len = qMin(l, right - x);
+ int right = spans[c].x + spans[c].len;
+ int len = qMin(l, right - x);
- handler.process(x, y, len, coverage, src, offset);
+ handler.process(x, y, len, coverage, src, offset);
- l -= len;
- x += len;
- offset += len;
+ l -= len;
+ x += len;
+ offset += len;
- if (x == right) { // done with current span?
- ++spans;
- --count;
+ if (x == right) // done with current span?
+ ++c;
}
+ handler.store(process_x, y, process_length);
}
- handler.store(process_x, y, process_length);
}
- }
+ };
+ QT_THREAD_PARALLEL_FILLS(function);
}
-template<typename T>
struct QBlendBase
{
- typedef T BlendType;
- QBlendBase(QSpanData *d, const Operator &o)
- : data(d)
- , op(o)
- , dest(nullptr)
- {
- }
-
- QSpanData *data;
- Operator op;
-
- BlendType *dest;
-
- alignas(8) BlendType buffer[BufferSize];
- alignas(8) BlendType src_buffer[BufferSize];
+ const QSpanData *data;
+ const Operator &op;
};
-class BlendSrcGeneric : public QBlendBase<uint>
+class BlendSrcGeneric : public QBlendBase
{
public:
- BlendSrcGeneric(QSpanData *d, const Operator &o)
- : QBlendBase<uint>(d, o)
+ uint *dest = nullptr;
+ alignas(16) uint buffer[BufferSize];
+ alignas(16) uint src_buffer[BufferSize];
+ BlendSrcGeneric(const QSpanData *d, const Operator &o)
+ : QBlendBase{d, o}
{
}
- const uint *fetch(int x, int y, int len)
+ const uint *fetch(int x, int y, int len, bool fetchDest)
{
- dest = op.destFetch(buffer, data->rasterBuffer, x, y, len);
+ if (fetchDest || op.destFetch == destFetchARGB32P)
+ dest = op.destFetch(buffer, data->rasterBuffer, x, y, len);
+ else
+ dest = buffer;
return op.srcFetch(src_buffer, &op, data, y, x, len);
}
@@ -4761,11 +4099,14 @@ public:
};
#if QT_CONFIG(raster_64bit)
-class BlendSrcGenericRGB64 : public QBlendBase<QRgba64>
+class BlendSrcGenericRGB64 : public QBlendBase
{
public:
- BlendSrcGenericRGB64(QSpanData *d, const Operator &o)
- : QBlendBase<QRgba64>(d, o)
+ QRgba64 *dest = nullptr;
+ alignas(16) QRgba64 buffer[BufferSize];
+ alignas(16) QRgba64 src_buffer[BufferSize];
+ BlendSrcGenericRGB64(const QSpanData *d, const Operator &o)
+ : QBlendBase{d, o}
{
}
@@ -4774,9 +4115,12 @@ public:
return op.func64 && op.destFetch64;
}
- const QRgba64 *fetch(int x, int y, int len)
+ const QRgba64 *fetch(int x, int y, int len, bool fetchDest)
{
- dest = op.destFetch64(buffer, data->rasterBuffer, x, y, len);
+ if (fetchDest || op.destFetch64 == destFetchRGB64)
+ dest = op.destFetch64(buffer, data->rasterBuffer, x, y, len);
+ else
+ dest = buffer;
return op.srcFetch64(src_buffer, &op, data, y, x, len);
}
@@ -4793,128 +4137,251 @@ public:
};
#endif
-static void blend_src_generic(int count, const QSpan *spans, void *userData)
+#if QT_CONFIG(raster_fp)
+class BlendSrcGenericRGBFP : public QBlendBase
+{
+public:
+ QRgbaFloat32 *dest = nullptr;
+ alignas(16) QRgbaFloat32 buffer[BufferSize];
+ alignas(16) QRgbaFloat32 src_buffer[BufferSize];
+ BlendSrcGenericRGBFP(const QSpanData *d, const Operator &o)
+ : QBlendBase{d, o}
+ {
+ }
+
+ bool isSupported() const
+ {
+ return op.funcFP && op.destFetchFP && op.srcFetchFP;
+ }
+
+ const QRgbaFloat32 *fetch(int x, int y, int len, bool fetchDest)
+ {
+ if (fetchDest || op.destFetchFP == destFetchRGBFP)
+ dest = op.destFetchFP(buffer, data->rasterBuffer, x, y, len);
+ else
+ dest = buffer;
+ return op.srcFetchFP(src_buffer, &op, data, y, x, len);
+ }
+
+ void process(int, int, int len, int coverage, const QRgbaFloat32 *src, int offset)
+ {
+ op.funcFP(dest + offset, src + offset, len, coverage);
+ }
+
+ void store(int x, int y, int len)
+ {
+ if (op.destStoreFP)
+ op.destStoreFP(data->rasterBuffer, x, y, dest, len);
+ }
+};
+#endif
+
+static void blend_src_generic(int count, const QT_FT_Span *spans, void *userData)
{
QSpanData *data = reinterpret_cast<QSpanData *>(userData);
- BlendSrcGeneric blend(data, getOperator(data, spans, count));
- handleSpans(count, spans, data, blend);
+ const Operator op = getOperator(data, nullptr, 0);
+ handleSpans<BlendSrcGeneric>(count, spans, data, op);
}
#if QT_CONFIG(raster_64bit)
-static void blend_src_generic_rgb64(int count, const QSpan *spans, void *userData)
+static void blend_src_generic_rgb64(int count, const QT_FT_Span *spans, void *userData)
{
QSpanData *data = reinterpret_cast<QSpanData *>(userData);
- Operator op = getOperator(data, spans, count);
- BlendSrcGenericRGB64 blend64(data, op);
- if (blend64.isSupported())
- handleSpans(count, spans, data, blend64);
- else {
+ const Operator op = getOperator(data, nullptr, 0);
+ if (op.func64 && op.destFetch64) {
+ handleSpans<BlendSrcGenericRGB64>(count, spans, data, op);
+ } else {
qCDebug(lcQtGuiDrawHelper, "blend_src_generic_rgb64: unsupported 64-bit blend attempted, falling back to 32-bit");
- BlendSrcGeneric blend32(data, op);
- handleSpans(count, spans, data, blend32);
+ handleSpans<BlendSrcGeneric>(count, spans, data, op);
+ }
+}
+#endif
+
+#if QT_CONFIG(raster_fp)
+static void blend_src_generic_fp(int count, const QT_FT_Span *spans, void *userData)
+{
+ QSpanData *data = reinterpret_cast<QSpanData *>(userData);
+ const Operator op = getOperator(data, spans, count);
+ if (op.funcFP && op.destFetchFP && op.srcFetchFP) {
+ handleSpans<BlendSrcGenericRGBFP>(count, spans, data, op);
+ } else {
+ qCDebug(lcQtGuiDrawHelper, "blend_src_generic_fp: unsupported 4xFP blend attempted, falling back to 32-bit");
+ handleSpans<BlendSrcGeneric>(count, spans, data, op);
}
}
#endif
-static void blend_untransformed_generic(int count, const QSpan *spans, void *userData)
+static void blend_untransformed_generic(int count, const QT_FT_Span *spans, void *userData)
{
QSpanData *data = reinterpret_cast<QSpanData *>(userData);
- uint buffer[BufferSize];
- uint src_buffer[BufferSize];
- Operator op = getOperator(data, spans, count);
+ const Operator op = getOperator(data, spans, count);
const int image_width = data->texture.width;
const int image_height = data->texture.height;
- int xoff = -qRound(-data->dx);
- int yoff = -qRound(-data->dy);
+ const int const_alpha = data->texture.const_alpha;
+ const int xoff = -qRound(-data->dx);
+ const int yoff = -qRound(-data->dy);
+ const bool solidSource = op.mode == QPainter::CompositionMode_Source && const_alpha == 256 && op.destFetch != destFetchARGB32P;
- for (; count--; spans++) {
- if (!spans->len)
- continue;
- int x = spans->x;
- int length = spans->len;
- int sx = xoff + x;
- int sy = yoff + spans->y;
- if (sy >= 0 && sy < image_height && sx < image_width) {
- if (sx < 0) {
- x -= sx;
- length += sx;
- sx = 0;
- }
- if (sx + length > image_width)
- length = image_width - sx;
- if (length > 0) {
- const int coverage = (spans->coverage * data->texture.const_alpha) >> 8;
- while (length) {
- int l = qMin(BufferSize, length);
- const uint *src = op.srcFetch(src_buffer, &op, data, sy, sx, l);
- uint *dest = op.destFetch(buffer, data->rasterBuffer, x, spans->y, l);
- op.func(dest, src, l, coverage);
- if (op.destStore)
- op.destStore(data->rasterBuffer, x, spans->y, dest, l);
- x += l;
- sx += l;
- length -= l;
+ auto function = [=, &op] (int cStart, int cEnd)
+ {
+ alignas(16) uint buffer[BufferSize];
+ alignas(16) uint src_buffer[BufferSize];
+ for (int c = cStart; c < cEnd; ++c) {
+ if (!spans[c].len)
+ continue;
+ int x = spans[c].x;
+ int length = spans[c].len;
+ int sx = xoff + x;
+ int sy = yoff + spans[c].y;
+ const bool fetchDest = !solidSource || spans[c].coverage < 255;
+ if (sy >= 0 && sy < image_height && sx < image_width) {
+ if (sx < 0) {
+ x -= sx;
+ length += sx;
+ sx = 0;
+ }
+ if (sx + length > image_width)
+ length = image_width - sx;
+ if (length > 0) {
+ const int coverage = (spans[c].coverage * const_alpha) >> 8;
+ while (length) {
+ int l = qMin(BufferSize, length);
+ const uint *src = op.srcFetch(src_buffer, &op, data, sy, sx, l);
+ uint *dest = fetchDest ? op.destFetch(buffer, data->rasterBuffer, x, spans[c].y, l) : buffer;
+ op.func(dest, src, l, coverage);
+ if (op.destStore)
+ op.destStore(data->rasterBuffer, x, spans[c].y, dest, l);
+ x += l;
+ sx += l;
+ length -= l;
+ }
}
}
}
- }
+ };
+ QT_THREAD_PARALLEL_FILLS(function);
}
#if QT_CONFIG(raster_64bit)
-static void blend_untransformed_generic_rgb64(int count, const QSpan *spans, void *userData)
+static void blend_untransformed_generic_rgb64(int count, const QT_FT_Span *spans, void *userData)
{
QSpanData *data = reinterpret_cast<QSpanData *>(userData);
- Operator op = getOperator(data, spans, count);
+ const Operator op = getOperator(data, spans, count);
if (!op.func64) {
qCDebug(lcQtGuiDrawHelper, "blend_untransformed_generic_rgb64: unsupported 64-bit blend attempted, falling back to 32-bit");
return blend_untransformed_generic(count, spans, userData);
}
- alignas(8) QRgba64 buffer[BufferSize];
- alignas(8) QRgba64 src_buffer[BufferSize];
const int image_width = data->texture.width;
const int image_height = data->texture.height;
- int xoff = -qRound(-data->dx);
- int yoff = -qRound(-data->dy);
+ const int const_alpha = data->texture.const_alpha;
+ const int xoff = -qRound(-data->dx);
+ const int yoff = -qRound(-data->dy);
+ const bool solidSource = op.mode == QPainter::CompositionMode_Source && const_alpha == 256 && op.destFetch64 != destFetchRGB64;
- for (; count--; spans++) {
- if (!spans->len)
- continue;
- int x = spans->x;
- int length = spans->len;
- int sx = xoff + x;
- int sy = yoff + spans->y;
- if (sy >= 0 && sy < image_height && sx < image_width) {
- if (sx < 0) {
- x -= sx;
- length += sx;
- sx = 0;
- }
- if (sx + length > image_width)
- length = image_width - sx;
- if (length > 0) {
- const int coverage = (spans->coverage * data->texture.const_alpha) >> 8;
- while (length) {
- int l = qMin(BufferSize, length);
- const QRgba64 *src = op.srcFetch64(src_buffer, &op, data, sy, sx, l);
- QRgba64 *dest = op.destFetch64(buffer, data->rasterBuffer, x, spans->y, l);
- op.func64(dest, src, l, coverage);
- if (op.destStore64)
- op.destStore64(data->rasterBuffer, x, spans->y, dest, l);
- x += l;
- sx += l;
- length -= l;
+ auto function = [=, &op] (int cStart, int cEnd)
+ {
+ alignas(16) QRgba64 buffer[BufferSize];
+ alignas(16) QRgba64 src_buffer[BufferSize];
+ for (int c = cStart; c < cEnd; ++c) {
+ if (!spans[c].len)
+ continue;
+ int x = spans[c].x;
+ int length = spans[c].len;
+ int sx = xoff + x;
+ int sy = yoff + spans[c].y;
+ const bool fetchDest = !solidSource || spans[c].coverage < 255;
+ if (sy >= 0 && sy < image_height && sx < image_width) {
+ if (sx < 0) {
+ x -= sx;
+ length += sx;
+ sx = 0;
+ }
+ if (sx + length > image_width)
+ length = image_width - sx;
+ if (length > 0) {
+ const int coverage = (spans[c].coverage * const_alpha) >> 8;
+ while (length) {
+ int l = qMin(BufferSize, length);
+ const QRgba64 *src = op.srcFetch64(src_buffer, &op, data, sy, sx, l);
+ QRgba64 *dest = fetchDest ? op.destFetch64(buffer, data->rasterBuffer, x, spans[c].y, l) : buffer;
+ op.func64(dest, src, l, coverage);
+ if (op.destStore64)
+ op.destStore64(data->rasterBuffer, x, spans[c].y, dest, l);
+ x += l;
+ sx += l;
+ length -= l;
+ }
}
}
}
+ };
+ QT_THREAD_PARALLEL_FILLS(function);
+}
+#endif
+
+#if QT_CONFIG(raster_fp)
+static void blend_untransformed_generic_fp(int count, const QT_FT_Span *spans, void *userData)
+{
+ QSpanData *data = reinterpret_cast<QSpanData *>(userData);
+
+ const Operator op = getOperator(data, spans, count);
+ if (!op.funcFP) {
+ qCDebug(lcQtGuiDrawHelper, "blend_untransformed_generic_rgbaf16: unsupported 4xFP16 blend attempted, falling back to 32-bit");
+ return blend_untransformed_generic(count, spans, userData);
}
+
+ const int image_width = data->texture.width;
+ const int image_height = data->texture.height;
+ const int xoff = -qRound(-data->dx);
+ const int yoff = -qRound(-data->dy);
+ const bool solidSource = op.mode == QPainter::CompositionMode_Source && data->texture.const_alpha == 256 && op.destFetchFP != destFetchRGBFP;
+
+ auto function = [=, &op] (int cStart, int cEnd)
+ {
+ alignas(16) QRgbaFloat32 buffer[BufferSize];
+ alignas(16) QRgbaFloat32 src_buffer[BufferSize];
+ for (int c = cStart; c < cEnd; ++c) {
+ if (!spans[c].len)
+ continue;
+ int x = spans[c].x;
+ int length = spans[c].len;
+ int sx = xoff + x;
+ int sy = yoff + spans[c].y;
+ const bool fetchDest = !solidSource || spans[c].coverage < 255;
+ if (sy >= 0 && sy < image_height && sx < image_width) {
+ if (sx < 0) {
+ x -= sx;
+ length += sx;
+ sx = 0;
+ }
+ if (sx + length > image_width)
+ length = image_width - sx;
+ if (length > 0) {
+ const int coverage = (spans[c].coverage * data->texture.const_alpha) >> 8;
+ while (length) {
+ int l = qMin(BufferSize, length);
+ const QRgbaFloat32 *src = op.srcFetchFP(src_buffer, &op, data, sy, sx, l);
+ QRgbaFloat32 *dest = fetchDest ? op.destFetchFP(buffer, data->rasterBuffer, x, spans[c].y, l) : buffer;
+ op.funcFP(dest, src, l, coverage);
+ if (op.destStoreFP)
+ op.destStoreFP(data->rasterBuffer, x, spans[c].y, dest, l);
+ x += l;
+ sx += l;
+ length -= l;
+ }
+ }
+ }
+ }
+ };
+ QT_THREAD_PARALLEL_FILLS(function);
}
#endif
-static void blend_untransformed_argb(int count, const QSpan *spans, void *userData)
+static void blend_untransformed_argb(int count, const QT_FT_Span *spans, void *userData)
{
QSpanData *data = reinterpret_cast<QSpanData *>(userData);
if (data->texture.format != QImage::Format_ARGB32_Premultiplied
@@ -4923,36 +4390,41 @@ static void blend_untransformed_argb(int count, const QSpan *spans, void *userDa
return;
}
- Operator op = getOperator(data, spans, count);
+ const Operator op = getOperator(data, spans, count);
const int image_width = data->texture.width;
const int image_height = data->texture.height;
- int xoff = -qRound(-data->dx);
- int yoff = -qRound(-data->dy);
+ const int const_alpha = data->texture.const_alpha;
+ const int xoff = -qRound(-data->dx);
+ const int yoff = -qRound(-data->dy);
- for (; count--; spans++) {
- if (!spans->len)
- continue;
- int x = spans->x;
- int length = spans->len;
- int sx = xoff + x;
- int sy = yoff + spans->y;
- if (sy >= 0 && sy < image_height && sx < image_width) {
- if (sx < 0) {
- x -= sx;
- length += sx;
- sx = 0;
- }
- if (sx + length > image_width)
- length = image_width - sx;
- if (length > 0) {
- const int coverage = (spans->coverage * data->texture.const_alpha) >> 8;
- const uint *src = (const uint *)data->texture.scanLine(sy) + sx;
- uint *dest = ((uint *)data->rasterBuffer->scanLine(spans->y)) + x;
- op.func(dest, src, length, coverage);
+ auto function = [=, &op] (int cStart, int cEnd)
+ {
+ for (int c = cStart; c < cEnd; ++c) {
+ if (!spans[c].len)
+ continue;
+ int x = spans[c].x;
+ int length = spans[c].len;
+ int sx = xoff + x;
+ int sy = yoff + spans[c].y;
+ if (sy >= 0 && sy < image_height && sx < image_width) {
+ if (sx < 0) {
+ x -= sx;
+ length += sx;
+ sx = 0;
+ }
+ if (sx + length > image_width)
+ length = image_width - sx;
+ if (length > 0) {
+ const int coverage = (spans[c].coverage * const_alpha) >> 8;
+ const uint *src = (const uint *)data->texture.scanLine(sy) + sx;
+ uint *dest = ((uint *)data->rasterBuffer->scanLine(spans[c].y)) + x;
+ op.func(dest, src, length, coverage);
+ }
}
}
- }
+ };
+ QT_THREAD_PARALLEL_FILLS(function);
}
static inline quint16 interpolate_pixel_rgb16_255(quint16 x, quint8 a,
@@ -5006,7 +4478,7 @@ static inline void blend_sourceOver_rgb16_rgb16(quint16 *Q_DECL_RESTRICT dest,
}
}
-static void blend_untransformed_rgb565(int count, const QSpan *spans, void *userData)
+static void blend_untransformed_rgb565(int count, const QT_FT_Span *spans, void *userData)
{
QSpanData *data = reinterpret_cast<QSpanData*>(userData);
QPainter::CompositionMode mode = data->rasterBuffer->compositionMode;
@@ -5024,57 +4496,54 @@ static void blend_untransformed_rgb565(int count, const QSpan *spans, void *user
int xoff = -qRound(-data->dx);
int yoff = -qRound(-data->dy);
- const QSpan *end = spans + count;
- while (spans < end) {
- if (!spans->len) {
- ++spans;
- continue;
- }
- const quint8 coverage = (data->texture.const_alpha * spans->coverage) >> 8;
- if (coverage == 0) {
- ++spans;
- continue;
- }
+ auto function = [=](int cStart, int cEnd)
+ {
+ for (int c = cStart; c < cEnd; ++c) {
+ if (!spans[c].len)
+ continue;
+ const quint8 coverage = (data->texture.const_alpha * spans[c].coverage) >> 8;
+ if (coverage == 0)
+ continue;
- int x = spans->x;
- int length = spans->len;
- int sx = xoff + x;
- int sy = yoff + spans->y;
- if (sy >= 0 && sy < image_height && sx < image_width) {
- if (sx < 0) {
- x -= sx;
- length += sx;
- sx = 0;
- }
- if (sx + length > image_width)
- length = image_width - sx;
- if (length > 0) {
- quint16 *dest = (quint16 *)data->rasterBuffer->scanLine(spans->y) + x;
- const quint16 *src = (const quint16 *)data->texture.scanLine(sy) + sx;
- if (coverage == 255) {
- memcpy(dest, src, length * sizeof(quint16));
- } else {
- const quint8 alpha = (coverage + 1) >> 3;
- const quint8 ialpha = 0x20 - alpha;
- if (alpha > 0)
- blend_sourceOver_rgb16_rgb16(dest, src, length, alpha, ialpha);
+ int x = spans[c].x;
+ int length = spans[c].len;
+ int sx = xoff + x;
+ int sy = yoff + spans[c].y;
+ if (sy >= 0 && sy < image_height && sx < image_width) {
+ if (sx < 0) {
+ x -= sx;
+ length += sx;
+ sx = 0;
+ }
+ if (sx + length > image_width)
+ length = image_width - sx;
+ if (length > 0) {
+ quint16 *dest = (quint16 *)data->rasterBuffer->scanLine(spans[c].y) + x;
+ const quint16 *src = (const quint16 *)data->texture.scanLine(sy) + sx;
+ if (coverage == 255) {
+ memcpy(dest, src, length * sizeof(quint16));
+ } else {
+ const quint8 alpha = (coverage + 1) >> 3;
+ const quint8 ialpha = 0x20 - alpha;
+ if (alpha > 0)
+ blend_sourceOver_rgb16_rgb16(dest, src, length, alpha, ialpha);
+ }
}
}
}
- ++spans;
- }
+ };
+ QT_THREAD_PARALLEL_FILLS(function);
}
-static void blend_tiled_generic(int count, const QSpan *spans, void *userData)
+static void blend_tiled_generic(int count, const QT_FT_Span *spans, void *userData)
{
QSpanData *data = reinterpret_cast<QSpanData *>(userData);
- uint buffer[BufferSize];
- uint src_buffer[BufferSize];
- Operator op = getOperator(data, spans, count);
+ const Operator op = getOperator(data, spans, count);
const int image_width = data->texture.width;
const int image_height = data->texture.height;
+ const int const_alpha = data->texture.const_alpha;
int xoff = -qRound(-data->dx) % image_width;
int yoff = -qRound(-data->dy) % image_height;
@@ -5083,48 +4552,51 @@ static void blend_tiled_generic(int count, const QSpan *spans, void *userData)
if (yoff < 0)
yoff += image_height;
- while (count--) {
- int x = spans->x;
- int length = spans->len;
- int sx = (xoff + spans->x) % image_width;
- int sy = (spans->y + yoff) % image_height;
- if (sx < 0)
- sx += image_width;
- if (sy < 0)
- sy += image_height;
-
- const int coverage = (spans->coverage * data->texture.const_alpha) >> 8;
- while (length) {
- int l = qMin(image_width - sx, length);
- if (BufferSize < l)
- l = BufferSize;
- const uint *src = op.srcFetch(src_buffer, &op, data, sy, sx, l);
- uint *dest = op.destFetch(buffer, data->rasterBuffer, x, spans->y, l);
- op.func(dest, src, l, coverage);
- if (op.destStore)
- op.destStore(data->rasterBuffer, x, spans->y, dest, l);
- x += l;
- sx += l;
- length -= l;
- if (sx >= image_width)
- sx = 0;
+ auto function = [=, &op](int cStart, int cEnd)
+ {
+ alignas(16) uint buffer[BufferSize];
+ alignas(16) uint src_buffer[BufferSize];
+ for (int c = cStart; c < cEnd; ++c) {
+ int x = spans[c].x;
+ int length = spans[c].len;
+ int sx = (xoff + spans[c].x) % image_width;
+ int sy = (spans[c].y + yoff) % image_height;
+ if (sx < 0)
+ sx += image_width;
+ if (sy < 0)
+ sy += image_height;
+
+ const int coverage = (spans[c].coverage * const_alpha) >> 8;
+ while (length) {
+ int l = qMin(image_width - sx, length);
+ if (BufferSize < l)
+ l = BufferSize;
+ const uint *src = op.srcFetch(src_buffer, &op, data, sy, sx, l);
+ uint *dest = op.destFetch(buffer, data->rasterBuffer, x, spans[c].y, l);
+ op.func(dest, src, l, coverage);
+ if (op.destStore)
+ op.destStore(data->rasterBuffer, x, spans[c].y, dest, l);
+ x += l;
+ sx += l;
+ length -= l;
+ if (sx >= image_width)
+ sx = 0;
+ }
}
- ++spans;
- }
+ };
+ QT_THREAD_PARALLEL_FILLS(function);
}
#if QT_CONFIG(raster_64bit)
-static void blend_tiled_generic_rgb64(int count, const QSpan *spans, void *userData)
+static void blend_tiled_generic_rgb64(int count, const QT_FT_Span *spans, void *userData)
{
QSpanData *data = reinterpret_cast<QSpanData *>(userData);
- Operator op = getOperator(data, spans, count);
+ const Operator op = getOperator(data, spans, count);
if (!op.func64) {
qCDebug(lcQtGuiDrawHelper, "blend_tiled_generic_rgb64: unsupported 64-bit blend attempted, falling back to 32-bit");
return blend_tiled_generic(count, spans, userData);
}
- alignas(8) QRgba64 buffer[BufferSize];
- alignas(8) QRgba64 src_buffer[BufferSize];
const int image_width = data->texture.width;
const int image_height = data->texture.height;
@@ -5137,7 +4609,9 @@ static void blend_tiled_generic_rgb64(int count, const QSpan *spans, void *userD
yoff += image_height;
bool isBpp32 = qPixelLayouts[data->rasterBuffer->format].bpp == QPixelLayout::BPP32;
- if (op.destFetch64 == destFetch64Undefined && image_width <= BufferSize && isBpp32) {
+ bool isBpp64 = qPixelLayouts[data->rasterBuffer->format].bpp == QPixelLayout::BPP64;
+ if (op.destFetch64 == destFetch64Undefined && image_width <= BufferSize && (isBpp32 || isBpp64)) {
+ alignas(16) QRgba64 src_buffer[BufferSize];
// If destination isn't blended into the result, we can do the tiling directly on destination pixels.
while (count--) {
int x = spans->x;
@@ -5171,47 +4645,116 @@ static void blend_tiled_generic_rgb64(int count, const QSpan *spans, void *userD
if (sx >= image_width)
sx = 0;
}
- uint *dest = (uint*)data->rasterBuffer->scanLine(y) + x - image_width;
- for (int i = image_width; i < length; ++i) {
- dest[i] = dest[i - image_width];
+ if (isBpp32) {
+ uint *dest = reinterpret_cast<uint *>(data->rasterBuffer->scanLine(y)) + x - image_width;
+ for (int i = image_width; i < length; ++i)
+ dest[i] = dest[i - image_width];
+ } else {
+ quint64 *dest = reinterpret_cast<quint64 *>(data->rasterBuffer->scanLine(y)) + x - image_width;
+ for (int i = image_width; i < length; ++i)
+ dest[i] = dest[i - image_width];
}
++spans;
}
return;
}
- while (count--) {
- int x = spans->x;
- int length = spans->len;
- int sx = (xoff + spans->x) % image_width;
- int sy = (spans->y + yoff) % image_height;
- if (sx < 0)
- sx += image_width;
- if (sy < 0)
- sy += image_height;
-
- const int coverage = (spans->coverage * data->texture.const_alpha) >> 8;
- while (length) {
- int l = qMin(image_width - sx, length);
- if (BufferSize < l)
- l = BufferSize;
- const QRgba64 *src = op.srcFetch64(src_buffer, &op, data, sy, sx, l);
- QRgba64 *dest = op.destFetch64(buffer, data->rasterBuffer, x, spans->y, l);
- op.func64(dest, src, l, coverage);
- if (op.destStore64)
- op.destStore64(data->rasterBuffer, x, spans->y, dest, l);
- x += l;
- sx += l;
- length -= l;
- if (sx >= image_width)
- sx = 0;
+ auto function = [=, &op](int cStart, int cEnd)
+ {
+ alignas(16) QRgba64 buffer[BufferSize];
+ alignas(16) QRgba64 src_buffer[BufferSize];
+ for (int c = cStart; c < cEnd; ++c) {
+ int x = spans[c].x;
+ int length = spans[c].len;
+ int sx = (xoff + spans[c].x) % image_width;
+ int sy = (spans[c].y + yoff) % image_height;
+ if (sx < 0)
+ sx += image_width;
+ if (sy < 0)
+ sy += image_height;
+
+ const int coverage = (spans[c].coverage * data->texture.const_alpha) >> 8;
+ while (length) {
+ int l = qMin(image_width - sx, length);
+ if (BufferSize < l)
+ l = BufferSize;
+ const QRgba64 *src = op.srcFetch64(src_buffer, &op, data, sy, sx, l);
+ QRgba64 *dest = op.destFetch64(buffer, data->rasterBuffer, x, spans[c].y, l);
+ op.func64(dest, src, l, coverage);
+ if (op.destStore64)
+ op.destStore64(data->rasterBuffer, x, spans[c].y, dest, l);
+ x += l;
+ sx += l;
+ length -= l;
+ if (sx >= image_width)
+ sx = 0;
+ }
}
- ++spans;
+ };
+ QT_THREAD_PARALLEL_FILLS(function);
+}
+#endif
+
+#if QT_CONFIG(raster_fp)
+static void blend_tiled_generic_fp(int count, const QT_FT_Span *spans, void *userData)
+{
+ QSpanData *data = reinterpret_cast<QSpanData *>(userData);
+
+ const Operator op = getOperator(data, spans, count);
+ if (!op.funcFP) {
+ qCDebug(lcQtGuiDrawHelper, "blend_tiled_generic_fp: unsupported 4xFP blend attempted, falling back to 32-bit");
+ return blend_tiled_generic(count, spans, userData);
}
+
+ const int image_width = data->texture.width;
+ const int image_height = data->texture.height;
+ int xoff = -qRound(-data->dx) % image_width;
+ int yoff = -qRound(-data->dy) % image_height;
+
+ if (xoff < 0)
+ xoff += image_width;
+ if (yoff < 0)
+ yoff += image_height;
+
+ // Consider tiling optimizing like the other versions.
+
+ auto function = [=, &op](int cStart, int cEnd)
+ {
+ alignas(16) QRgbaFloat32 buffer[BufferSize];
+ alignas(16) QRgbaFloat32 src_buffer[BufferSize];
+ for (int c = cStart; c < cEnd; ++c) {
+ int x = spans[c].x;
+ int length = spans[c].len;
+ int sx = (xoff + spans[c].x) % image_width;
+ int sy = (spans[c].y + yoff) % image_height;
+ if (sx < 0)
+ sx += image_width;
+ if (sy < 0)
+ sy += image_height;
+
+ const int coverage = (spans[c].coverage * data->texture.const_alpha) >> 8;
+ while (length) {
+ int l = qMin(image_width - sx, length);
+ if (BufferSize < l)
+ l = BufferSize;
+ const QRgbaFloat32 *src = op.srcFetchFP(src_buffer, &op, data, sy, sx, l);
+ QRgbaFloat32 *dest = op.destFetchFP(buffer, data->rasterBuffer, x, spans[c].y, l);
+ op.funcFP(dest, src, l, coverage);
+ if (op.destStoreFP)
+ op.destStoreFP(data->rasterBuffer, x, spans[c].y, dest, l);
+ x += l;
+ sx += l;
+ length -= l;
+ if (sx >= image_width)
+ sx = 0;
+ }
+ }
+ };
+ QT_THREAD_PARALLEL_FILLS(function);
}
#endif
-static void blend_tiled_argb(int count, const QSpan *spans, void *userData)
+static void blend_tiled_argb(int count, const QT_FT_Span *spans, void *userData)
{
QSpanData *data = reinterpret_cast<QSpanData *>(userData);
if (data->texture.format != QImage::Format_ARGB32_Premultiplied
@@ -5220,10 +4763,10 @@ static void blend_tiled_argb(int count, const QSpan *spans, void *userData)
return;
}
- Operator op = getOperator(data, spans, count);
+ const Operator op = getOperator(data, spans, count);
- int image_width = data->texture.width;
- int image_height = data->texture.height;
+ const int image_width = data->texture.width;
+ const int image_height = data->texture.height;
int xoff = -qRound(-data->dx) % image_width;
int yoff = -qRound(-data->dy) % image_height;
@@ -5231,36 +4774,40 @@ static void blend_tiled_argb(int count, const QSpan *spans, void *userData)
xoff += image_width;
if (yoff < 0)
yoff += image_height;
+ const auto func = op.func;
+ const int const_alpha = data->texture.const_alpha;
+
+ auto function = [=] (int cStart, int cEnd) {
+ for (int c = cStart; c < cEnd; ++c) {
+ int x = spans[c].x;
+ int length = spans[c].len;
+ int sx = (xoff + spans[c].x) % image_width;
+ int sy = (spans[c].y + yoff) % image_height;
+ if (sx < 0)
+ sx += image_width;
+ if (sy < 0)
+ sy += image_height;
- while (count--) {
- int x = spans->x;
- int length = spans->len;
- int sx = (xoff + spans->x) % image_width;
- int sy = (spans->y + yoff) % image_height;
- if (sx < 0)
- sx += image_width;
- if (sy < 0)
- sy += image_height;
-
- const int coverage = (spans->coverage * data->texture.const_alpha) >> 8;
- while (length) {
- int l = qMin(image_width - sx, length);
- if (BufferSize < l)
- l = BufferSize;
- const uint *src = (const uint *)data->texture.scanLine(sy) + sx;
- uint *dest = ((uint *)data->rasterBuffer->scanLine(spans->y)) + x;
- op.func(dest, src, l, coverage);
- x += l;
- sx += l;
- length -= l;
- if (sx >= image_width)
- sx = 0;
+ const int coverage = (spans[c].coverage * const_alpha) >> 8;
+ while (length) {
+ int l = qMin(image_width - sx, length);
+ if (BufferSize < l)
+ l = BufferSize;
+ const uint *src = (const uint *)data->texture.scanLine(sy) + sx;
+ uint *dest = ((uint *)data->rasterBuffer->scanLine(spans[c].y)) + x;
+ func(dest, src, l, coverage);
+ x += l;
+ sx += l;
+ length -= l;
+ if (sx >= image_width)
+ sx = 0;
+ }
}
- ++spans;
- }
+ };
+ QT_THREAD_PARALLEL_FILLS(function);
}
-static void blend_tiled_rgb565(int count, const QSpan *spans, void *userData)
+static void blend_tiled_rgb565(int count, const QT_FT_Span *spans, void *userData)
{
QSpanData *data = reinterpret_cast<QSpanData*>(userData);
QPainter::CompositionMode mode = data->rasterBuffer->compositionMode;
@@ -5283,79 +4830,80 @@ static void blend_tiled_rgb565(int count, const QSpan *spans, void *userData)
if (yoff < 0)
yoff += image_height;
- while (count--) {
- const quint8 coverage = (data->texture.const_alpha * spans->coverage) >> 8;
- if (coverage == 0) {
- ++spans;
- continue;
- }
+ const int const_alpha = data->texture.const_alpha;
+ auto function = [=] (int cStart, int cEnd) {
+ for (int c = cStart; c < cEnd; ++c) {
+ const quint8 coverage = (const_alpha * spans[c].coverage) >> 8;
+ if (coverage == 0)
+ continue;
- int x = spans->x;
- int length = spans->len;
- int sx = (xoff + spans->x) % image_width;
- int sy = (spans->y + yoff) % image_height;
- if (sx < 0)
- sx += image_width;
- if (sy < 0)
- sy += image_height;
-
- if (coverage == 255) {
- // Copy the first texture block
- length = qMin(image_width,length);
- int tx = x;
- while (length) {
- int l = qMin(image_width - sx, length);
- if (BufferSize < l)
- l = BufferSize;
- quint16 *dest = ((quint16 *)data->rasterBuffer->scanLine(spans->y)) + tx;
- const quint16 *src = (const quint16 *)data->texture.scanLine(sy) + sx;
- memcpy(dest, src, l * sizeof(quint16));
- length -= l;
- tx += l;
- sx += l;
- if (sx >= image_width)
- sx = 0;
- }
+ int x = spans[c].x;
+ int length = spans[c].len;
+ int sx = (xoff + spans[c].x) % image_width;
+ int sy = (spans[c].y + yoff) % image_height;
+ if (sx < 0)
+ sx += image_width;
+ if (sy < 0)
+ sy += image_height;
- // Now use the rasterBuffer as the source of the texture,
- // We can now progressively copy larger blocks
- // - Less cpu time in code figuring out what to copy
- // We are dealing with one block of data
- // - More likely to fit in the cache
- // - can use memcpy
- int copy_image_width = qMin(image_width, int(spans->len));
- length = spans->len - copy_image_width;
- quint16 *src = ((quint16 *)data->rasterBuffer->scanLine(spans->y)) + x;
- quint16 *dest = src + copy_image_width;
- while (copy_image_width < length) {
- memcpy(dest, src, copy_image_width * sizeof(quint16));
- dest += copy_image_width;
- length -= copy_image_width;
- copy_image_width *= 2;
- }
- if (length > 0)
- memcpy(dest, src, length * sizeof(quint16));
- } else {
- const quint8 alpha = (coverage + 1) >> 3;
- const quint8 ialpha = 0x20 - alpha;
- if (alpha > 0) {
+ if (coverage == 255) {
+ // Copy the first texture block
+ length = qMin(image_width,length);
+ int tx = x;
while (length) {
int l = qMin(image_width - sx, length);
if (BufferSize < l)
l = BufferSize;
- quint16 *dest = ((quint16 *)data->rasterBuffer->scanLine(spans->y)) + x;
+ quint16 *dest = ((quint16 *)data->rasterBuffer->scanLine(spans[c].y)) + tx;
const quint16 *src = (const quint16 *)data->texture.scanLine(sy) + sx;
- blend_sourceOver_rgb16_rgb16(dest, src, l, alpha, ialpha);
- x += l;
- sx += l;
+ memcpy(dest, src, l * sizeof(quint16));
length -= l;
+ tx += l;
+ sx += l;
if (sx >= image_width)
sx = 0;
}
+
+ // Now use the rasterBuffer as the source of the texture,
+ // We can now progressively copy larger blocks
+ // - Less cpu time in code figuring out what to copy
+ // We are dealing with one block of data
+ // - More likely to fit in the cache
+ // - can use memcpy
+ int copy_image_width = qMin(image_width, int(spans[c].len));
+ length = spans[c].len - copy_image_width;
+ quint16 *src = ((quint16 *)data->rasterBuffer->scanLine(spans[c].y)) + x;
+ quint16 *dest = src + copy_image_width;
+ while (copy_image_width < length) {
+ memcpy(dest, src, copy_image_width * sizeof(quint16));
+ dest += copy_image_width;
+ length -= copy_image_width;
+ copy_image_width *= 2;
+ }
+ if (length > 0)
+ memcpy(dest, src, length * sizeof(quint16));
+ } else {
+ const quint8 alpha = (coverage + 1) >> 3;
+ const quint8 ialpha = 0x20 - alpha;
+ if (alpha > 0) {
+ while (length) {
+ int l = qMin(image_width - sx, length);
+ if (BufferSize < l)
+ l = BufferSize;
+ quint16 *dest = ((quint16 *)data->rasterBuffer->scanLine(spans[c].y)) + x;
+ const quint16 *src = (const quint16 *)data->texture.scanLine(sy) + sx;
+ blend_sourceOver_rgb16_rgb16(dest, src, l, alpha, ialpha);
+ x += l;
+ sx += l;
+ length -= l;
+ if (sx >= image_width)
+ sx = 0;
+ }
+ }
}
}
- ++spans;
- }
+ };
+ QT_THREAD_PARALLEL_FILLS(function);
}
/* Image formats here are target formats */
@@ -5397,19 +4945,30 @@ static const ProcessSpans processTextureSpansGeneric64[NBlendTypes] = {
};
#endif
-void qBlendTexture(int count, const QSpan *spans, void *userData)
+#if QT_CONFIG(raster_fp)
+static const ProcessSpans processTextureSpansGenericFP[NBlendTypes] = {
+ blend_untransformed_generic_fp, // Untransformed
+ blend_tiled_generic_fp, // Tiled
+ blend_src_generic_fp, // Transformed
+ blend_src_generic_fp, // TransformedTiled
+ blend_src_generic_fp, // TransformedBilinear
+ blend_src_generic_fp // TransformedBilinearTiled
+};
+#endif
+void qBlendTexture(int count, const QT_FT_Span *spans, void *userData)
{
QSpanData *data = reinterpret_cast<QSpanData *>(userData);
TextureBlendType blendType = getBlendType(data);
ProcessSpans proc;
switch (data->rasterBuffer->format) {
+ case QImage::Format_Invalid:
+ Q_UNREACHABLE_RETURN();
case QImage::Format_ARGB32_Premultiplied:
proc = processTextureSpansARGB32PM[blendType];
break;
case QImage::Format_RGB16:
proc = processTextureSpansRGB16[blendType];
break;
-#if QT_CONFIG(raster_64bit)
#if defined(__SSE2__) || defined(__ARM_NEON__) || (Q_PROCESSOR_WORDSIZE == 8)
case QImage::Format_ARGB32:
case QImage::Format_RGBA8888:
@@ -5422,12 +4981,28 @@ void qBlendTexture(int count, const QSpan *spans, void *userData)
case QImage::Format_RGBA64:
case QImage::Format_RGBA64_Premultiplied:
case QImage::Format_Grayscale16:
+#if !QT_CONFIG(raster_fp)
+ case QImage::Format_RGBX16FPx4:
+ case QImage::Format_RGBA16FPx4:
+ case QImage::Format_RGBA16FPx4_Premultiplied:
+ case QImage::Format_RGBX32FPx4:
+ case QImage::Format_RGBA32FPx4:
+ case QImage::Format_RGBA32FPx4_Premultiplied:
+#endif
+#if QT_CONFIG(raster_64bit)
proc = processTextureSpansGeneric64[blendType];
break;
#endif // QT_CONFIG(raster_64bit)
- case QImage::Format_Invalid:
- Q_UNREACHABLE();
- return;
+#if QT_CONFIG(raster_fp)
+ case QImage::Format_RGBX16FPx4:
+ case QImage::Format_RGBA16FPx4:
+ case QImage::Format_RGBA16FPx4_Premultiplied:
+ case QImage::Format_RGBX32FPx4:
+ case QImage::Format_RGBA32FPx4:
+ case QImage::Format_RGBA32FPx4_Premultiplied:
+ proc = processTextureSpansGenericFP[blendType];
+ break;
+#endif
default:
proc = processTextureSpansGeneric[blendType];
break;
@@ -5435,16 +5010,11 @@ void qBlendTexture(int count, const QSpan *spans, void *userData)
proc(count, spans, userData);
}
-static void blend_vertical_gradient_argb(int count, const QSpan *spans, void *userData)
+static inline bool calculate_fixed_gradient_factors(int count, const QT_FT_Span *spans,
+ const QSpanData *data,
+ const LinearGradientValues &linear,
+ int *pyinc, int *poff)
{
- QSpanData *data = reinterpret_cast<QSpanData *>(userData);
-
- LinearGradientValues linear;
- getLinearGradientValues(&linear, data);
-
- CompositionFunctionSolid funcSolid =
- functionForModeSolid[data->rasterBuffer->compositionMode];
-
/*
The logic for vertical gradient calculations is a mathematically
reduced copy of that in fetchLinearGradient() - which is basically:
@@ -5459,8 +5029,32 @@ static void blend_vertical_gradient_argb(int count, const QSpan *spans, void *us
This has then been converted to fixed point to improve performance.
*/
const int gss = GRADIENT_STOPTABLE_SIZE - 1;
- int yinc = int((linear.dy * data->m22 * gss) * FIXPT_SIZE);
- int off = int((((linear.dy * (data->m22 * qreal(0.5) + data->dy) + linear.off) * gss) * FIXPT_SIZE));
+ qreal ryinc = linear.dy * data->m22 * gss * FIXPT_SIZE;
+ qreal roff = (linear.dy * (data->m22 * qreal(0.5) + data->dy) + linear.off) * gss * FIXPT_SIZE;
+ const int limit = std::numeric_limits<int>::max() - FIXPT_SIZE;
+ if (count && (std::fabs(ryinc) < limit) && (std::fabs(roff) < limit)
+ && (std::fabs(ryinc * spans->y + roff) < limit)
+ && (std::fabs(ryinc * (spans + count - 1)->y + roff) < limit)) {
+ *pyinc = int(ryinc);
+ *poff = int(roff);
+ return true;
+ }
+ return false;
+}
+
+static bool blend_vertical_gradient_argb(int count, const QT_FT_Span *spans, void *userData)
+{
+ QSpanData *data = reinterpret_cast<QSpanData *>(userData);
+
+ LinearGradientValues linear;
+ getLinearGradientValues(&linear, data);
+
+ CompositionFunctionSolid funcSolid =
+ functionForModeSolid[data->rasterBuffer->compositionMode];
+
+ int yinc(0), off(0);
+ if (!calculate_fixed_gradient_factors(count, spans, data, linear, &yinc, &off))
+ return false;
while (count--) {
int y = spans->y;
@@ -5473,21 +5067,20 @@ static void blend_vertical_gradient_argb(int count, const QSpan *spans, void *us
funcSolid(dst, spans->len, color, spans->coverage);
++spans;
}
+ return true;
}
template<ProcessSpans blend_color>
-static void blend_vertical_gradient(int count, const QSpan *spans, void *userData)
+static bool blend_vertical_gradient(int count, const QT_FT_Span *spans, void *userData)
{
QSpanData *data = reinterpret_cast<QSpanData *>(userData);
LinearGradientValues linear;
getLinearGradientValues(&linear, data);
- // Based on the same logic as blend_vertical_gradient_argb.
-
- const int gss = GRADIENT_STOPTABLE_SIZE - 1;
- int yinc = int((linear.dy * data->m22 * gss) * FIXPT_SIZE);
- int off = int((((linear.dy * (data->m22 * qreal(0.5) + data->dy) + linear.off) * gss) * FIXPT_SIZE));
+ int yinc(0), off(0);
+ if (!calculate_fixed_gradient_factors(count, spans, data, linear, &yinc, &off))
+ return false;
while (count--) {
int y = spans->y;
@@ -5495,14 +5088,15 @@ static void blend_vertical_gradient(int count, const QSpan *spans, void *userDat
#if QT_CONFIG(raster_64bit)
data->solidColor = qt_gradient_pixel64_fixed(&data->gradient, yinc * y + off);
#else
- data->solidColor = QRgba64::fromArgb32(qt_gradient_pixel_fixed(&data->gradient, yinc * y + off));
+ data->solidColor = qt_gradient_pixel_fixed(&data->gradient, yinc * y + off);
#endif
blend_color(1, spans, userData);
++spans;
}
+ return true;
}
-void qBlendGradient(int count, const QSpan *spans, void *userData)
+void qBlendGradient(int count, const QT_FT_Span *spans, void *userData)
{
QSpanData *data = reinterpret_cast<QSpanData *>(userData);
bool isVerticalGradient =
@@ -5510,16 +5104,13 @@ void qBlendGradient(int count, const QSpan *spans, void *userData)
data->type == QSpanData::LinearGradient &&
data->gradient.linear.end.x == data->gradient.linear.origin.x;
switch (data->rasterBuffer->format) {
- case QImage::Format_RGB16:
- if (isVerticalGradient)
- return blend_vertical_gradient<blend_color_rgb16>(count, spans, userData);
- return blend_src_generic(count, spans, userData);
+ case QImage::Format_Invalid:
+ break;
case QImage::Format_RGB32:
case QImage::Format_ARGB32_Premultiplied:
- if (isVerticalGradient)
- return blend_vertical_gradient_argb(count, spans, userData);
+ if (isVerticalGradient && blend_vertical_gradient_argb(count, spans, userData))
+ return;
return blend_src_generic(count, spans, userData);
-#if QT_CONFIG(raster_64bit)
#if defined(__SSE2__) || defined(__ARM_NEON__) || (Q_PROCESSOR_WORDSIZE == 8)
case QImage::Format_ARGB32:
case QImage::Format_RGBA8888:
@@ -5531,15 +5122,33 @@ void qBlendGradient(int count, const QSpan *spans, void *userData)
case QImage::Format_RGBX64:
case QImage::Format_RGBA64:
case QImage::Format_RGBA64_Premultiplied:
- if (isVerticalGradient)
- return blend_vertical_gradient<blend_color_generic_rgb64>(count, spans, userData);
+#if !QT_CONFIG(raster_fp)
+ case QImage::Format_RGBX16FPx4:
+ case QImage::Format_RGBA16FPx4:
+ case QImage::Format_RGBA16FPx4_Premultiplied:
+ case QImage::Format_RGBX32FPx4:
+ case QImage::Format_RGBA32FPx4:
+ case QImage::Format_RGBA32FPx4_Premultiplied:
+#endif
+#if QT_CONFIG(raster_64bit)
+ if (isVerticalGradient && blend_vertical_gradient<blend_color_generic_rgb64>(count, spans, userData))
+ return;
return blend_src_generic_rgb64(count, spans, userData);
#endif // QT_CONFIG(raster_64bit)
- case QImage::Format_Invalid:
- break;
+#if QT_CONFIG(raster_fp)
+ case QImage::Format_RGBX16FPx4:
+ case QImage::Format_RGBA16FPx4:
+ case QImage::Format_RGBA16FPx4_Premultiplied:
+ case QImage::Format_RGBX32FPx4:
+ case QImage::Format_RGBA32FPx4:
+ case QImage::Format_RGBA32FPx4_Premultiplied:
+ if (isVerticalGradient && blend_vertical_gradient<blend_color_generic_fp>(count, spans, userData))
+ return;
+ return blend_src_generic_fp(count, spans, userData);
+#endif
default:
- if (isVerticalGradient)
- return blend_vertical_gradient<blend_color_generic>(count, spans, userData);
+ if (isVerticalGradient && blend_vertical_gradient<blend_color_generic>(count, spans, userData))
+ return;
return blend_src_generic(count, spans, userData);
}
Q_UNREACHABLE();
@@ -5555,7 +5164,7 @@ inline void qt_bitmapblit_template(QRasterBuffer *rasterBuffer,
const int destStride = rasterBuffer->stride<DST>();
if (mapWidth > 8) {
- while (mapHeight--) {
+ while (--mapHeight >= 0) {
int x0 = 0;
int n = 0;
for (int x = 0; x < mapWidth; x += 8) {
@@ -5585,7 +5194,7 @@ inline void qt_bitmapblit_template(QRasterBuffer *rasterBuffer,
map += mapStride;
}
} else {
- while (mapHeight--) {
+ while (--mapHeight >= 0) {
int x0 = 0;
int n = 0;
for (uchar s = *map; s; s <<= 1) {
@@ -5769,7 +5378,7 @@ static void qt_alphamapblit_generic(QRasterBuffer *rasterBuffer,
const QClipData::ClipLine &line = clip->m_clipLines[yp];
for (int i=0; i<line.count; ++i) {
- const QSpan &clip = line.spans[i];
+ const QT_FT_Span &clip = line.spans[i];
int start = qMax<int>(x, clip.x);
int end = qMin<int>(x + mapWidth, clip.x + clip.len);
@@ -5843,7 +5452,7 @@ static void qt_alphamapblit_generic(QRasterBuffer *rasterBuffer,
const QClipData::ClipLine &line = clip->m_clipLines[yp];
for (int i=0; i<line.count; ++i) {
- const QSpan &clip = line.spans[i];
+ const QT_FT_Span &clip = line.spans[i];
int start = qMax<int>(x, clip.x);
int end = qMin<int>(x + mapWidth, clip.x + clip.len);
@@ -5893,7 +5502,7 @@ void qt_alphamapblit_quint16(QRasterBuffer *rasterBuffer,
if (!clip) {
quint16 *dest = reinterpret_cast<quint16*>(rasterBuffer->scanLine(y)) + x;
const int destStride = rasterBuffer->stride<quint16>();
- while (mapHeight--) {
+ while (--mapHeight >= 0) {
for (int i = 0; i < mapWidth; ++i)
alphamapblend_quint16(map[i], dest, i, c);
dest += destStride;
@@ -5911,7 +5520,7 @@ void qt_alphamapblit_quint16(QRasterBuffer *rasterBuffer,
quint16 *dest = reinterpret_cast<quint16*>(rasterBuffer->scanLine(yp));
for (int i=0; i<line.count; ++i) {
- const QSpan &clip = line.spans[i];
+ const QT_FT_Span &clip = line.spans[i];
int start = qMax<int>(x, clip.x);
int end = qMin<int>(x + mapWidth, clip.x + clip.len);
@@ -5947,7 +5556,7 @@ static void qt_alphamapblit_argb32(QRasterBuffer *rasterBuffer,
if (!clip) {
quint32 *dest = reinterpret_cast<quint32*>(rasterBuffer->scanLine(y)) + x;
- while (mapHeight--) {
+ while (--mapHeight >= 0) {
for (int i = 0; i < mapWidth; ++i) {
const int coverage = map[i];
alphamapblend_argb32(dest + i, coverage, srcColor, c, colorProfile);
@@ -5968,7 +5577,7 @@ static void qt_alphamapblit_argb32(QRasterBuffer *rasterBuffer,
quint32 *dest = reinterpret_cast<quint32 *>(rasterBuffer->scanLine(yp));
for (int i=0; i<line.count; ++i) {
- const QSpan &clip = line.spans[i];
+ const QT_FT_Span &clip = line.spans[i];
int start = qMax<int>(x, clip.x);
int end = qMin<int>(x + mapWidth, clip.x + clip.len);
@@ -6048,7 +5657,11 @@ static inline void alphargbblend_argb32(quint32 *dst, uint coverage, const QRgba
// Give up and do a naive gray alphablend. Needed to deal with ARGB32 and invalid ARGB32_premultiplied, see QTBUG-60571
blend_pixel(*dst, src, qRgbAvg(coverage));
} else if (!colorProfile) {
- *dst = rgbBlend(*dst, src, coverage);
+ // First do naive blend with text-color
+ QRgb s = *dst;
+ blend_pixel(s, src);
+ // Then a naive blend with glyph shape
+ *dst = rgbBlend(*dst, s, coverage);
} else if (srcLinear.isOpaque()) {
rgbBlendPixel(dst, coverage, srcLinear, colorProfile);
} else {
@@ -6065,7 +5678,7 @@ static inline void alphargbblend_argb32(quint32 *dst, uint coverage, const QRgba
static inline void rgbBlendPixel(QRgba64 &dst, int coverage, QRgba64 slinear, const QColorTrcLut *colorProfile)
{
// Do a gammacorrected RGB alphablend...
- const QRgba64 dlinear = colorProfile ? colorProfile->toLinear64(dst) : dst;
+ const QRgba64 dlinear = colorProfile ? colorProfile->toLinear(dst) : dst;
QRgba64 blend = rgbBlend(dlinear, slinear, coverage);
@@ -6144,7 +5757,7 @@ static void qt_alphargbblit_generic(QRasterBuffer *rasterBuffer,
const QClipData::ClipLine &line = clip->m_clipLines[yp];
for (int i=0; i<line.count; ++i) {
- const QSpan &clip = line.spans[i];
+ const QT_FT_Span &clip = line.spans[i];
int start = qMax<int>(x, clip.x);
int end = qMin<int>(x + mapWidth, clip.x + clip.len);
@@ -6217,7 +5830,7 @@ static void qt_alphargbblit_generic(QRasterBuffer *rasterBuffer,
const QClipData::ClipLine &line = clip->m_clipLines[yp];
for (int i=0; i<line.count; ++i) {
- const QSpan &clip = line.spans[i];
+ const QT_FT_Span &clip = line.spans[i];
int start = qMax<int>(x, clip.x);
int end = qMin<int>(x + mapWidth, clip.x + clip.len);
@@ -6261,7 +5874,7 @@ static void qt_alphargbblit_argb32(QRasterBuffer *rasterBuffer,
if (!clip) {
quint32 *dst = reinterpret_cast<quint32*>(rasterBuffer->scanLine(y)) + x;
const int destStride = rasterBuffer->stride<quint32>();
- while (mapHeight--) {
+ while (--mapHeight >= 0) {
for (int i = 0; i < mapWidth; ++i) {
const uint coverage = src[i];
alphargbblend_argb32(dst + i, coverage, srcColor, c, colorProfile);
@@ -6283,7 +5896,7 @@ static void qt_alphargbblit_argb32(QRasterBuffer *rasterBuffer,
quint32 *dst = reinterpret_cast<quint32 *>(rasterBuffer->scanLine(yp));
for (int i=0; i<line.count; ++i) {
- const QSpan &clip = line.spans[i];
+ const QT_FT_Span &clip = line.spans[i];
int start = qMax<int>(x, clip.x);
int end = qMin<int>(x + mapWidth, clip.x + clip.len);
@@ -6391,10 +6004,21 @@ static void qt_rectfill_quint64(QRasterBuffer *rasterBuffer,
c64, x, y, width, height, rasterBuffer->bytesPerLine());
}
+static void qt_rectfill_fp32x4(QRasterBuffer *rasterBuffer,
+ int x, int y, int width, int height,
+ const QRgba64 &color)
+{
+ const auto store = qStoreFromRGBA64PM[rasterBuffer->format];
+ QRgbaFloat32 c;
+ store(reinterpret_cast<uchar *>(&c), &color, 0, 1, nullptr, nullptr);
+ qt_rectfill<QRgbaFloat32>(reinterpret_cast<QRgbaFloat32 *>(rasterBuffer->buffer()),
+ c, x, y, width, height, rasterBuffer->bytesPerLine());
+}
+
// Map table for destination image format. Contains function pointers
// for blends of various types unto the destination
-DrawHelper qDrawHelper[QImage::NImageFormats] =
+DrawHelper qDrawHelper[] =
{
// Format_Invalid,
{ nullptr, nullptr, nullptr, nullptr, nullptr },
@@ -6439,7 +6063,7 @@ DrawHelper qDrawHelper[QImage::NImageFormats] =
},
// Format_RGB16
{
- blend_color_rgb16,
+ blend_color_generic,
qt_bitmapblit_quint16,
qt_alphamapblit_quint16,
qt_alphargbblit_generic,
@@ -6621,16 +6245,66 @@ DrawHelper qDrawHelper[QImage::NImageFormats] =
qt_alphargbblit_generic,
qt_rectfill_quint24
},
+ // Format_RGBX16FPx4
+ {
+ blend_color_generic_fp,
+ nullptr,
+ qt_alphamapblit_generic,
+ qt_alphargbblit_generic,
+ qt_rectfill_quint64
+ },
+ // Format_RGBA16FPx4
+ {
+ blend_color_generic_fp,
+ nullptr,
+ qt_alphamapblit_generic,
+ qt_alphargbblit_generic,
+ qt_rectfill_quint64
+ },
+ // Format_RGBA16FPx4_Premultiplied
+ {
+ blend_color_generic_fp,
+ nullptr,
+ qt_alphamapblit_generic,
+ qt_alphargbblit_generic,
+ qt_rectfill_quint64
+ },
+ // Format_RGBX32FPx4
+ {
+ blend_color_generic_fp,
+ nullptr,
+ qt_alphamapblit_generic,
+ qt_alphargbblit_generic,
+ qt_rectfill_fp32x4
+ },
+ // Format_RGBA32FPx4
+ {
+ blend_color_generic_fp,
+ nullptr,
+ qt_alphamapblit_generic,
+ qt_alphargbblit_generic,
+ qt_rectfill_fp32x4
+ },
+ // Format_RGBA32FPx4_Premultiplied
+ {
+ blend_color_generic_fp,
+ nullptr,
+ qt_alphamapblit_generic,
+ qt_alphargbblit_generic,
+ qt_rectfill_fp32x4
+ },
};
-#if !defined(__SSE2__)
+static_assert(std::size(qDrawHelper) == QImage::NImageFormats);
+
+#if !defined(Q_PROCESSOR_X86)
void qt_memfill64(quint64 *dest, quint64 color, qsizetype count)
{
qt_memfill_template<quint64>(dest, color, count);
}
#endif
-#if defined(QT_COMPILER_SUPPORTS_SSSE3) && defined(Q_CC_GNU) && !defined(Q_CC_INTEL) && !defined(Q_CC_CLANG)
+#if defined(QT_COMPILER_SUPPORTS_SSSE3) && defined(Q_CC_GNU) && !defined(Q_CC_CLANG)
__attribute__((optimize("no-tree-vectorize")))
#endif
void qt_memfill24(quint24 *dest, quint24 color, qsizetype count)
@@ -6690,19 +6364,18 @@ void qt_memfill16(quint16 *dest, quint16 value, qsizetype count)
qt_memfill32(reinterpret_cast<quint32*>(dest), value32, count / 2);
}
-#if !defined(__SSE2__) && !defined(__ARM_NEON__) && !defined(__MIPS_DSP__)
+#if defined(Q_PROCESSOR_X86)
+void (*qt_memfill32)(quint32 *dest, quint32 value, qsizetype count) = nullptr;
+void (*qt_memfill64)(quint64 *dest, quint64 value, qsizetype count) = nullptr;
+#elif !defined(__ARM_NEON__) && !defined(__MIPS_DSP__)
void qt_memfill32(quint32 *dest, quint32 color, qsizetype count)
{
qt_memfill_template<quint32>(dest, color, count);
}
#endif
-#ifdef __SSE2__
-decltype(qt_memfill32_sse2) *qt_memfill32 = nullptr;
-decltype(qt_memfill64_sse2) *qt_memfill64 = nullptr;
-#endif
#ifdef QT_COMPILER_SUPPORTS_SSE4_1
-template<QtPixelOrder> void QT_FASTCALL storeA2RGB30PMFromARGB32PM_sse4(uchar *dest, const uint *src, int index, int count, const QVector<QRgb> *, QDitherInfo *);
+template<QtPixelOrder> void QT_FASTCALL storeA2RGB30PMFromARGB32PM_sse4(uchar *dest, const uint *src, int index, int count, const QList<QRgb> *, QDitherInfo *);
#endif
extern void qInitBlendFunctions();
@@ -6712,8 +6385,11 @@ static void qInitDrawhelperFunctions()
// Set up basic blend function tables.
qInitBlendFunctions();
-#ifdef __SSE2__
-# ifndef __AVX2__
+#if defined(Q_PROCESSOR_X86) && !defined(__SSE2__)
+ qt_memfill32 = qt_memfill_template<quint32>;
+ qt_memfill64 = qt_memfill_template<quint64>;
+#elif defined(__SSE2__)
+# ifndef __haswell__
qt_memfill32 = qt_memfill32_sse2;
qt_memfill64 = qt_memfill64_sse2;
# endif
@@ -6762,10 +6438,12 @@ static void qInitDrawhelperFunctions()
extern void QT_FASTCALL comp_func_SourceOver_sse2(uint *destPixels, const uint *srcPixels, int length, uint const_alpha);
extern void QT_FASTCALL comp_func_solid_SourceOver_sse2(uint *destPixels, int length, uint color, uint const_alpha);
extern void QT_FASTCALL comp_func_Source_sse2(uint *destPixels, const uint *srcPixels, int length, uint const_alpha);
+ extern void QT_FASTCALL comp_func_solid_Source_sse2(uint *destPixels, int length, uint color, uint const_alpha);
extern void QT_FASTCALL comp_func_Plus_sse2(uint *destPixels, const uint *srcPixels, int length, uint const_alpha);
qt_functionForMode_C[QPainter::CompositionMode_SourceOver] = comp_func_SourceOver_sse2;
qt_functionForModeSolid_C[QPainter::CompositionMode_SourceOver] = comp_func_solid_SourceOver_sse2;
qt_functionForMode_C[QPainter::CompositionMode_Source] = comp_func_Source_sse2;
+ qt_functionForModeSolid_C[QPainter::CompositionMode_Source] = comp_func_solid_Source_sse2;
qt_functionForMode_C[QPainter::CompositionMode_Plus] = comp_func_Plus_sse2;
#ifdef QT_COMPILER_SUPPORTS_SSSE3
@@ -6790,33 +6468,35 @@ static void qInitDrawhelperFunctions()
#if defined(QT_COMPILER_SUPPORTS_SSE4_1)
if (qCpuHasFeature(SSE4_1)) {
- extern void QT_FASTCALL convertARGB32ToARGB32PM_sse4(uint *buffer, int count, const QVector<QRgb> *);
- extern void QT_FASTCALL convertRGBA8888ToARGB32PM_sse4(uint *buffer, int count, const QVector<QRgb> *);
+ extern void QT_FASTCALL convertARGB32ToARGB32PM_sse4(uint *buffer, int count, const QList<QRgb> *);
+ extern void QT_FASTCALL convertRGBA8888ToARGB32PM_sse4(uint *buffer, int count, const QList<QRgb> *);
extern const uint *QT_FASTCALL fetchARGB32ToARGB32PM_sse4(uint *buffer, const uchar *src, int index, int count,
- const QVector<QRgb> *, QDitherInfo *);
+ const QList<QRgb> *, QDitherInfo *);
extern const uint *QT_FASTCALL fetchRGBA8888ToARGB32PM_sse4(uint *buffer, const uchar *src, int index, int count,
- const QVector<QRgb> *, QDitherInfo *);
+ const QList<QRgb> *, QDitherInfo *);
extern const QRgba64 * QT_FASTCALL convertARGB32ToRGBA64PM_sse4(QRgba64 *buffer, const uint *src, int count,
- const QVector<QRgb> *, QDitherInfo *);
+ const QList<QRgb> *, QDitherInfo *);
extern const QRgba64 * QT_FASTCALL convertRGBA8888ToRGBA64PM_sse4(QRgba64 *buffer, const uint *src, int count,
- const QVector<QRgb> *, QDitherInfo *);
+ const QList<QRgb> *, QDitherInfo *);
extern const QRgba64 *QT_FASTCALL fetchARGB32ToRGBA64PM_sse4(QRgba64 *buffer, const uchar *src, int index, int count,
- const QVector<QRgb> *, QDitherInfo *);
+ const QList<QRgb> *, QDitherInfo *);
extern const QRgba64 *QT_FASTCALL fetchRGBA8888ToRGBA64PM_sse4(QRgba64 *buffer, const uchar *src, int index, int count,
- const QVector<QRgb> *, QDitherInfo *);
+ const QList<QRgb> *, QDitherInfo *);
extern void QT_FASTCALL storeARGB32FromARGB32PM_sse4(uchar *dest, const uint *src, int index, int count,
- const QVector<QRgb> *, QDitherInfo *);
+ const QList<QRgb> *, QDitherInfo *);
extern void QT_FASTCALL storeRGBA8888FromARGB32PM_sse4(uchar *dest, const uint *src, int index, int count,
- const QVector<QRgb> *, QDitherInfo *);
+ const QList<QRgb> *, QDitherInfo *);
extern void QT_FASTCALL storeRGBXFromARGB32PM_sse4(uchar *dest, const uint *src, int index, int count,
- const QVector<QRgb> *, QDitherInfo *);
+ const QList<QRgb> *, QDitherInfo *);
extern void QT_FASTCALL storeARGB32FromRGBA64PM_sse4(uchar *dest, const QRgba64 *src, int index, int count,
- const QVector<QRgb> *, QDitherInfo *);
+ const QList<QRgb> *, QDitherInfo *);
extern void QT_FASTCALL storeRGBA8888FromRGBA64PM_sse4(uchar *dest, const QRgba64 *src, int index, int count,
- const QVector<QRgb> *, QDitherInfo *);
+ const QList<QRgb> *, QDitherInfo *);
+ extern void QT_FASTCALL storeRGBA64FromRGBA64PM_sse4(uchar *, const QRgba64 *, int, int, const QList<QRgb> *, QDitherInfo *);
+ extern void QT_FASTCALL storeRGBx64FromRGBA64PM_sse4(uchar *, const QRgba64 *, int, int, const QList<QRgb> *, QDitherInfo *);
extern void QT_FASTCALL destStore64ARGB32_sse4(QRasterBuffer *rasterBuffer, int x, int y, const QRgba64 *buffer, int length);
extern void QT_FASTCALL destStore64RGBA8888_sse4(QRasterBuffer *rasterBuffer, int x, int y, const QRgba64 *buffer, int length);
-# ifndef __AVX2__
+# ifndef __haswell__
qPixelLayouts[QImage::Format_ARGB32].fetchToARGB32PM = fetchARGB32ToARGB32PM_sse4;
qPixelLayouts[QImage::Format_ARGB32].convertToARGB32PM = convertARGB32ToARGB32PM_sse4;
qPixelLayouts[QImage::Format_RGBA8888].fetchToARGB32PM = fetchRGBA8888ToARGB32PM_sse4;
@@ -6835,10 +6515,20 @@ static void qInitDrawhelperFunctions()
qPixelLayouts[QImage::Format_A2RGB30_Premultiplied].storeFromARGB32PM = storeA2RGB30PMFromARGB32PM_sse4<PixelOrderRGB>;
qStoreFromRGBA64PM[QImage::Format_ARGB32] = storeARGB32FromRGBA64PM_sse4;
qStoreFromRGBA64PM[QImage::Format_RGBA8888] = storeRGBA8888FromRGBA64PM_sse4;
+ qStoreFromRGBA64PM[QImage::Format_RGBX64] = storeRGBx64FromRGBA64PM_sse4;
+ qStoreFromRGBA64PM[QImage::Format_RGBA64] = storeRGBA64FromRGBA64PM_sse4;
#if QT_CONFIG(raster_64bit)
destStoreProc64[QImage::Format_ARGB32] = destStore64ARGB32_sse4;
destStoreProc64[QImage::Format_RGBA8888] = destStore64RGBA8888_sse4;
#endif
+#if QT_CONFIG(raster_fp)
+ extern const QRgbaFloat32 *QT_FASTCALL fetchRGBA32FToRGBA32F_sse4(QRgbaFloat32 *buffer, const uchar *src, int index, int count, const QList<QRgb> *, QDitherInfo *);
+ extern void QT_FASTCALL storeRGBX32FFromRGBA32F_sse4(uchar *dest, const QRgbaFloat32 *src, int index, int count, const QList<QRgb> *, QDitherInfo *);
+ extern void QT_FASTCALL storeRGBA32FFromRGBA32F_sse4(uchar *dest, const QRgbaFloat32 *src, int index, int count, const QList<QRgb> *, QDitherInfo *);
+ qFetchToRGBA32F[QImage::Format_RGBA32FPx4] = fetchRGBA32FToRGBA32F_sse4;
+ qStoreFromRGBA32F[QImage::Format_RGBX32FPx4] = storeRGBX32FFromRGBA32F_sse4;
+ qStoreFromRGBA32F[QImage::Format_RGBA32FPx4] = storeRGBA32FFromRGBA32F_sse4;
+#endif // QT_CONFIG(raster_fp)
}
#endif
@@ -6875,6 +6565,16 @@ static void qInitDrawhelperFunctions()
qt_functionForMode64_C[QPainter::CompositionMode_SourceOver] = comp_func_SourceOver_rgb64_avx2;
qt_functionForModeSolid64_C[QPainter::CompositionMode_SourceOver] = comp_func_solid_SourceOver_rgb64_avx2;
#endif
+#if QT_CONFIG(raster_fp)
+ extern void QT_FASTCALL comp_func_Source_rgbafp_avx2(QRgbaFloat32 *destPixels, const QRgbaFloat32 *srcPixels, int length, uint const_alpha);
+ extern void QT_FASTCALL comp_func_SourceOver_rgbafp_avx2(QRgbaFloat32 *destPixels, const QRgbaFloat32 *srcPixels, int length, uint const_alpha);
+ extern void QT_FASTCALL comp_func_solid_Source_rgbafp_avx2(QRgbaFloat32 *destPixels, int length, QRgbaFloat32 color, uint const_alpha);
+ extern void QT_FASTCALL comp_func_solid_SourceOver_rgbafp_avx2(QRgbaFloat32 *destPixels, int length, QRgbaFloat32 color, uint const_alpha);
+ qt_functionForModeFP_C[QPainter::CompositionMode_Source] = comp_func_Source_rgbafp_avx2;
+ qt_functionForModeFP_C[QPainter::CompositionMode_SourceOver] = comp_func_SourceOver_rgbafp_avx2;
+ qt_functionForModeSolidFP_C[QPainter::CompositionMode_Source] = comp_func_solid_Source_rgbafp_avx2;
+ qt_functionForModeSolidFP_C[QPainter::CompositionMode_SourceOver] = comp_func_solid_SourceOver_rgbafp_avx2;
+#endif
extern void QT_FASTCALL fetchTransformedBilinearARGB32PM_simple_scale_helper_avx2(uint *b, uint *end, const QTextureData &image,
int &fx, int &fy, int fdx, int /*fdy*/);
@@ -6887,28 +6587,56 @@ static void qInitDrawhelperFunctions()
bilinearFastTransformHelperARGB32PM[0][DownscaleTransform] = fetchTransformedBilinearARGB32PM_downscale_helper_avx2;
bilinearFastTransformHelperARGB32PM[0][FastRotateTransform] = fetchTransformedBilinearARGB32PM_fast_rotate_helper_avx2;
- extern void QT_FASTCALL convertARGB32ToARGB32PM_avx2(uint *buffer, int count, const QVector<QRgb> *);
- extern void QT_FASTCALL convertRGBA8888ToARGB32PM_avx2(uint *buffer, int count, const QVector<QRgb> *);
+ extern void QT_FASTCALL convertARGB32ToARGB32PM_avx2(uint *buffer, int count, const QList<QRgb> *);
+ extern void QT_FASTCALL convertRGBA8888ToARGB32PM_avx2(uint *buffer, int count, const QList<QRgb> *);
extern const uint *QT_FASTCALL fetchARGB32ToARGB32PM_avx2(uint *buffer, const uchar *src, int index, int count,
- const QVector<QRgb> *, QDitherInfo *);
+ const QList<QRgb> *, QDitherInfo *);
extern const uint *QT_FASTCALL fetchRGBA8888ToARGB32PM_avx2(uint *buffer, const uchar *src, int index, int count,
- const QVector<QRgb> *, QDitherInfo *);
+ const QList<QRgb> *, QDitherInfo *);
qPixelLayouts[QImage::Format_ARGB32].fetchToARGB32PM = fetchARGB32ToARGB32PM_avx2;
qPixelLayouts[QImage::Format_ARGB32].convertToARGB32PM = convertARGB32ToARGB32PM_avx2;
qPixelLayouts[QImage::Format_RGBA8888].fetchToARGB32PM = fetchRGBA8888ToARGB32PM_avx2;
qPixelLayouts[QImage::Format_RGBA8888].convertToARGB32PM = convertRGBA8888ToARGB32PM_avx2;
-#if QT_CONFIG(raster_64bit)
- extern const QRgba64 * QT_FASTCALL convertARGB32ToRGBA64PM_avx2(QRgba64 *, const uint *, int, const QVector<QRgb> *, QDitherInfo *);
- extern const QRgba64 * QT_FASTCALL convertRGBA8888ToRGBA64PM_avx2(QRgba64 *, const uint *, int count, const QVector<QRgb> *, QDitherInfo *);
- extern const QRgba64 *QT_FASTCALL fetchARGB32ToRGBA64PM_avx2(QRgba64 *, const uchar *, int, int, const QVector<QRgb> *, QDitherInfo *);
- extern const QRgba64 *QT_FASTCALL fetchRGBA8888ToRGBA64PM_avx2(QRgba64 *, const uchar *, int, int, const QVector<QRgb> *, QDitherInfo *);
+ extern const QRgba64 *QT_FASTCALL convertARGB32ToRGBA64PM_avx2(QRgba64 *, const uint *, int, const QList<QRgb> *, QDitherInfo *);
+ extern const QRgba64 *QT_FASTCALL convertRGBA8888ToRGBA64PM_avx2(QRgba64 *, const uint *, int count, const QList<QRgb> *, QDitherInfo *);
+ extern const QRgba64 *QT_FASTCALL fetchARGB32ToRGBA64PM_avx2(QRgba64 *, const uchar *, int, int, const QList<QRgb> *, QDitherInfo *);
+ extern const QRgba64 *QT_FASTCALL fetchRGBA8888ToRGBA64PM_avx2(QRgba64 *, const uchar *, int, int, const QList<QRgb> *, QDitherInfo *);
+ extern const QRgba64 *QT_FASTCALL fetchRGBA64ToRGBA64PM_avx2(QRgba64 *buffer, const uchar *src, int index, int count, const QList<QRgb> *, QDitherInfo *);
qPixelLayouts[QImage::Format_ARGB32].convertToRGBA64PM = convertARGB32ToRGBA64PM_avx2;
qPixelLayouts[QImage::Format_RGBX8888].convertToRGBA64PM = convertRGBA8888ToRGBA64PM_avx2;
qPixelLayouts[QImage::Format_ARGB32].fetchToRGBA64PM = fetchARGB32ToRGBA64PM_avx2;
qPixelLayouts[QImage::Format_RGBX8888].fetchToRGBA64PM = fetchRGBA8888ToRGBA64PM_avx2;
-#endif
+ qPixelLayouts[QImage::Format_RGBA64].fetchToRGBA64PM = fetchRGBA64ToRGBA64PM_avx2;
+
+ extern const uint *QT_FASTCALL fetchRGB16FToRGB32_avx2(uint *buffer, const uchar *src, int index, int count, const QList<QRgb> *, QDitherInfo *);
+ extern const uint *QT_FASTCALL fetchRGBA16FToARGB32PM_avx2(uint *buffer, const uchar *src, int index, int count, const QList<QRgb> *, QDitherInfo *);
+ extern const QRgba64 *QT_FASTCALL fetchRGBA16FPMToRGBA64PM_avx2(QRgba64 *buffer, const uchar *src, int index, int count, const QList<QRgb> *, QDitherInfo *);
+ extern const QRgba64 *QT_FASTCALL fetchRGBA16FToRGBA64PM_avx2(QRgba64 *buffer, const uchar *src, int index, int count, const QList<QRgb> *, QDitherInfo *);
+ extern void QT_FASTCALL storeRGB16FFromRGB32_avx2(uchar *dest, const uint *src, int index, int count, const QList<QRgb> *, QDitherInfo *);
+ extern void QT_FASTCALL storeRGBA16FFromARGB32PM_avx2(uchar *dest, const uint *src, int index, int count, const QList<QRgb> *, QDitherInfo *);
+ qPixelLayouts[QImage::Format_RGBX16FPx4].fetchToARGB32PM = fetchRGB16FToRGB32_avx2;
+ qPixelLayouts[QImage::Format_RGBX16FPx4].fetchToRGBA64PM = fetchRGBA16FPMToRGBA64PM_avx2;
+ qPixelLayouts[QImage::Format_RGBX16FPx4].storeFromARGB32PM = storeRGB16FFromRGB32_avx2;
+ qPixelLayouts[QImage::Format_RGBX16FPx4].storeFromRGB32 = storeRGB16FFromRGB32_avx2;
+ qPixelLayouts[QImage::Format_RGBA16FPx4].fetchToARGB32PM = fetchRGBA16FToARGB32PM_avx2;
+ qPixelLayouts[QImage::Format_RGBA16FPx4].fetchToRGBA64PM = fetchRGBA16FToRGBA64PM_avx2;
+ qPixelLayouts[QImage::Format_RGBA16FPx4].storeFromARGB32PM = storeRGBA16FFromARGB32PM_avx2;
+ qPixelLayouts[QImage::Format_RGBA16FPx4].storeFromRGB32 = storeRGB16FFromRGB32_avx2;
+ qPixelLayouts[QImage::Format_RGBA16FPx4_Premultiplied].fetchToARGB32PM = fetchRGB16FToRGB32_avx2;
+ qPixelLayouts[QImage::Format_RGBA16FPx4_Premultiplied].fetchToRGBA64PM = fetchRGBA16FPMToRGBA64PM_avx2;
+ qPixelLayouts[QImage::Format_RGBA16FPx4_Premultiplied].storeFromARGB32PM = storeRGB16FFromRGB32_avx2;
+ qPixelLayouts[QImage::Format_RGBA16FPx4_Premultiplied].storeFromRGB32 = storeRGB16FFromRGB32_avx2;
+#if QT_CONFIG(raster_fp)
+ extern const QRgbaFloat32 *QT_FASTCALL fetchRGBA16FToRGBA32F_avx2(QRgbaFloat32 *buffer, const uchar *src, int index, int count, const QList<QRgb> *, QDitherInfo *);
+ extern void QT_FASTCALL storeRGBX16FFromRGBA32F_avx2(uchar *dest, const QRgbaFloat32 *src, int index, int count, const QList<QRgb> *, QDitherInfo *);
+ extern void QT_FASTCALL storeRGBA16FFromRGBA32F_avx2(uchar *dest, const QRgbaFloat32 *src, int index, int count, const QList<QRgb> *, QDitherInfo *);
+ qFetchToRGBA32F[QImage::Format_RGBA16FPx4] = fetchRGBA16FToRGBA32F_avx2;
+ qStoreFromRGBA32F[QImage::Format_RGBX16FPx4] = storeRGBX16FFromRGBA32F_avx2;
+ qStoreFromRGBA32F[QImage::Format_RGBA16FPx4] = storeRGBA16FFromRGBA32F_avx2;
+#endif // QT_CONFIG(raster_fp)
}
+
#endif
#endif // SSE2
@@ -6937,26 +6665,26 @@ static void qInitDrawhelperFunctions()
sourceFetchUntransformed[QImage::Format_RGB888] = qt_fetchUntransformed_888_neon;
#if Q_BYTE_ORDER == Q_LITTLE_ENDIAN
- extern void QT_FASTCALL convertARGB32ToARGB32PM_neon(uint *buffer, int count, const QVector<QRgb> *);
- extern void QT_FASTCALL convertRGBA8888ToARGB32PM_neon(uint *buffer, int count, const QVector<QRgb> *);
+ extern void QT_FASTCALL convertARGB32ToARGB32PM_neon(uint *buffer, int count, const QList<QRgb> *);
+ extern void QT_FASTCALL convertRGBA8888ToARGB32PM_neon(uint *buffer, int count, const QList<QRgb> *);
extern const uint *QT_FASTCALL fetchARGB32ToARGB32PM_neon(uint *buffer, const uchar *src, int index, int count,
- const QVector<QRgb> *, QDitherInfo *);
+ const QList<QRgb> *, QDitherInfo *);
extern const uint *QT_FASTCALL fetchRGBA8888ToARGB32PM_neon(uint *buffer, const uchar *src, int index, int count,
- const QVector<QRgb> *, QDitherInfo *);
+ const QList<QRgb> *, QDitherInfo *);
extern const QRgba64 * QT_FASTCALL convertARGB32ToRGBA64PM_neon(QRgba64 *buffer, const uint *src, int count,
- const QVector<QRgb> *, QDitherInfo *);
+ const QList<QRgb> *, QDitherInfo *);
extern const QRgba64 * QT_FASTCALL convertRGBA8888ToRGBA64PM_neon(QRgba64 *buffer, const uint *src, int count,
- const QVector<QRgb> *, QDitherInfo *);
+ const QList<QRgb> *, QDitherInfo *);
extern const QRgba64 *QT_FASTCALL fetchARGB32ToRGBA64PM_neon(QRgba64 *buffer, const uchar *src, int index, int count,
- const QVector<QRgb> *, QDitherInfo *);
+ const QList<QRgb> *, QDitherInfo *);
extern const QRgba64 *QT_FASTCALL fetchRGBA8888ToRGBA64PM_neon(QRgba64 *buffer, const uchar *src, int index, int count,
- const QVector<QRgb> *, QDitherInfo *);
+ const QList<QRgb> *, QDitherInfo *);
extern void QT_FASTCALL storeARGB32FromARGB32PM_neon(uchar *dest, const uint *src, int index, int count,
- const QVector<QRgb> *, QDitherInfo *);
+ const QList<QRgb> *, QDitherInfo *);
extern void QT_FASTCALL storeRGBA8888FromARGB32PM_neon(uchar *dest, const uint *src, int index, int count,
- const QVector<QRgb> *, QDitherInfo *);
+ const QList<QRgb> *, QDitherInfo *);
extern void QT_FASTCALL storeRGBXFromARGB32PM_neon(uchar *dest, const uint *src, int index, int count,
- const QVector<QRgb> *, QDitherInfo *);
+ const QList<QRgb> *, QDitherInfo *);
qPixelLayouts[QImage::Format_ARGB32].fetchToARGB32PM = fetchARGB32ToARGB32PM_neon;
qPixelLayouts[QImage::Format_ARGB32].convertToARGB32PM = convertARGB32ToARGB32PM_neon;
qPixelLayouts[QImage::Format_ARGB32].storeFromARGB32PM = storeARGB32FromARGB32PM_neon;
diff --git a/src/gui/painting/qdrawhelper_avx2.cpp b/src/gui/painting/qdrawhelper_avx2.cpp
index fb50cb6a50..34de69ecf4 100644
--- a/src/gui/painting/qdrawhelper_avx2.cpp
+++ b/src/gui/painting/qdrawhelper_avx2.cpp
@@ -1,46 +1,11 @@
-/****************************************************************************
-**
-** Copyright (C) 2018 The Qt Company Ltd.
-** Copyright (C) 2018 Intel Corporation.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the QtGui module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2018 The Qt Company Ltd.
+// Copyright (C) 2018 Intel Corporation.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#include "qdrawhelper_p.h"
#include "qdrawhelper_x86_p.h"
#include "qdrawingprimitive_sse2_p.h"
+#include "qpixellayout_p.h"
#include "qrgba64_p.h"
#if defined(QT_COMPILER_SUPPORTS_AVX2)
@@ -142,7 +107,6 @@ INTERPOLATE_PIXEL_RGB64_AVX2(__m256i srcVector, __m256i &dstVector, __m256i alph
dstVector = _mm256_or_si256(finalAG, finalRB);
}
-
// See BLEND_SOURCE_OVER_ARGB32_SSE2 for details.
inline static void Q_DECL_VECTORCALL BLEND_SOURCE_OVER_ARGB32_AVX2(quint32 *dst, const quint32 *src, const int length)
{
@@ -359,7 +323,7 @@ void Q_DECL_VECTORCALL qt_memfillXX_avx2(uchar *dest, __m256i value256, qsizetyp
void qt_memfill64_avx2(quint64 *dest, quint64 value, qsizetype count)
{
-#if defined(Q_CC_GNU) && !defined(Q_CC_CLANG) && !defined(Q_CC_INTEL)
+#if defined(Q_CC_GNU) && !defined(Q_CC_CLANG)
// work around https://gcc.gnu.org/bugzilla/show_bug.cgi?id=80820
__m128i value64 = _mm_set_epi64x(0, value); // _mm_cvtsi64_si128(value);
# ifdef Q_PROCESSOR_X86_64
@@ -456,6 +420,40 @@ void QT_FASTCALL comp_func_SourceOver_rgb64_avx2(QRgba64 *dst, const QRgba64 *sr
}
#endif
+#if QT_CONFIG(raster_fp)
+void QT_FASTCALL comp_func_SourceOver_rgbafp_avx2(QRgbaFloat32 *dst, const QRgbaFloat32 *src, int length, uint const_alpha)
+{
+ Q_ASSERT(const_alpha < 256); // const_alpha is in [0-255]
+
+ const float a = const_alpha / 255.0f;
+ const __m128 one = _mm_set1_ps(1.0f);
+ const __m128 constAlphaVector = _mm_set1_ps(a);
+ const __m256 one256 = _mm256_set1_ps(1.0f);
+ const __m256 constAlphaVector256 = _mm256_set1_ps(a);
+ int x = 0;
+ for (; x < length - 1; x += 2) {
+ __m256 srcVector = _mm256_loadu_ps((const float *)&src[x]);
+ __m256 dstVector = _mm256_loadu_ps((const float *)&dst[x]);
+ srcVector = _mm256_mul_ps(srcVector, constAlphaVector256);
+ __m256 alphaChannel = _mm256_permute_ps(srcVector, _MM_SHUFFLE(3, 3, 3, 3));
+ alphaChannel = _mm256_sub_ps(one256, alphaChannel);
+ dstVector = _mm256_mul_ps(dstVector, alphaChannel);
+ dstVector = _mm256_add_ps(dstVector, srcVector);
+ _mm256_storeu_ps((float *)(dst + x), dstVector);
+ }
+ if (x < length) {
+ __m128 srcVector = _mm_loadu_ps((const float *)&src[x]);
+ __m128 dstVector = _mm_loadu_ps((const float *)&dst[x]);
+ srcVector = _mm_mul_ps(srcVector, constAlphaVector);
+ __m128 alphaChannel = _mm_permute_ps(srcVector, _MM_SHUFFLE(3, 3, 3, 3));
+ alphaChannel = _mm_sub_ps(one, alphaChannel);
+ dstVector = _mm_mul_ps(dstVector, alphaChannel);
+ dstVector = _mm_add_ps(dstVector, srcVector);
+ _mm_storeu_ps((float *)(dst + x), dstVector);
+ }
+}
+#endif
+
void QT_FASTCALL comp_func_Source_avx2(uint *dst, const uint *src, int length, uint const_alpha)
{
if (const_alpha == 255) {
@@ -522,6 +520,41 @@ void QT_FASTCALL comp_func_Source_rgb64_avx2(QRgba64 *dst, const QRgba64 *src, i
}
#endif
+#if QT_CONFIG(raster_fp)
+void QT_FASTCALL comp_func_Source_rgbafp_avx2(QRgbaFloat32 *dst, const QRgbaFloat32 *src, int length, uint const_alpha)
+{
+ Q_ASSERT(const_alpha < 256); // const_alpha is in [0-255]
+ if (const_alpha == 255) {
+ ::memcpy(dst, src, length * sizeof(QRgbaFloat32));
+ } else {
+ const float ca = const_alpha / 255.f;
+ const float cia = 1.0f - ca;
+
+ const __m128 constAlphaVector = _mm_set1_ps(ca);
+ const __m128 oneMinusConstAlpha = _mm_set1_ps(cia);
+ const __m256 constAlphaVector256 = _mm256_set1_ps(ca);
+ const __m256 oneMinusConstAlpha256 = _mm256_set1_ps(cia);
+ int x = 0;
+ for (; x < length - 1; x += 2) {
+ __m256 srcVector = _mm256_loadu_ps((const float *)&src[x]);
+ __m256 dstVector = _mm256_loadu_ps((const float *)&dst[x]);
+ srcVector = _mm256_mul_ps(srcVector, constAlphaVector256);
+ dstVector = _mm256_mul_ps(dstVector, oneMinusConstAlpha256);
+ dstVector = _mm256_add_ps(dstVector, srcVector);
+ _mm256_storeu_ps((float *)&dst[x], dstVector);
+ }
+ if (x < length) {
+ __m128 srcVector = _mm_loadu_ps((const float *)&src[x]);
+ __m128 dstVector = _mm_loadu_ps((const float *)&dst[x]);
+ srcVector = _mm_mul_ps(srcVector, constAlphaVector);
+ dstVector = _mm_mul_ps(dstVector, oneMinusConstAlpha);
+ dstVector = _mm_add_ps(dstVector, srcVector);
+ _mm_storeu_ps((float *)&dst[x], dstVector);
+ }
+ }
+}
+#endif
+
void QT_FASTCALL comp_func_solid_SourceOver_avx2(uint *destPixels, int length, uint color, uint const_alpha)
{
if ((const_alpha & qAlpha(color)) == 255) {
@@ -586,6 +619,69 @@ void QT_FASTCALL comp_func_solid_SourceOver_rgb64_avx2(QRgba64 *destPixels, int
}
#endif
+#if QT_CONFIG(raster_fp)
+void QT_FASTCALL comp_func_solid_Source_rgbafp_avx2(QRgbaFloat32 *dst, int length, QRgbaFloat32 color, uint const_alpha)
+{
+ Q_ASSERT(const_alpha < 256); // const_alpha is in [0-255]
+ if (const_alpha == 255) {
+ for (int i = 0; i < length; ++i)
+ dst[i] = color;
+ } else {
+ const float a = const_alpha / 255.0f;
+ const __m128 alphaVector = _mm_set1_ps(a);
+ const __m128 minusAlphaVector = _mm_set1_ps(1.0f - a);
+ __m128 colorVector = _mm_loadu_ps((const float *)&color);
+ colorVector = _mm_mul_ps(colorVector, alphaVector);
+ const __m256 colorVector256 = _mm256_insertf128_ps(_mm256_castps128_ps256(colorVector), colorVector, 1);
+ const __m256 minusAlphaVector256 = _mm256_set1_ps(1.0f - a);
+ int x = 0;
+ for (; x < length - 1; x += 2) {
+ __m256 dstVector = _mm256_loadu_ps((const float *)&dst[x]);
+ dstVector = _mm256_mul_ps(dstVector, minusAlphaVector256);
+ dstVector = _mm256_add_ps(dstVector, colorVector256);
+ _mm256_storeu_ps((float *)&dst[x], dstVector);
+ }
+ if (x < length) {
+ __m128 dstVector = _mm_loadu_ps((const float *)&dst[x]);
+ dstVector = _mm_mul_ps(dstVector, minusAlphaVector);
+ dstVector = _mm_add_ps(dstVector, colorVector);
+ _mm_storeu_ps((float *)&dst[x], dstVector);
+ }
+ }
+}
+
+void QT_FASTCALL comp_func_solid_SourceOver_rgbafp_avx2(QRgbaFloat32 *dst, int length, QRgbaFloat32 color, uint const_alpha)
+{
+ Q_ASSERT(const_alpha < 256); // const_alpha is in [0-255]
+ if (const_alpha == 255 && color.a >= 1.0f) {
+ for (int i = 0; i < length; ++i)
+ dst[i] = color;
+ } else {
+ __m128 colorVector = _mm_loadu_ps((const float *)&color);
+ if (const_alpha != 255)
+ colorVector = _mm_mul_ps(colorVector, _mm_set1_ps(const_alpha / 255.f));
+ __m128 minusAlphaOfColorVector =
+ _mm_sub_ps(_mm_set1_ps(1.0f), _mm_permute_ps(colorVector, _MM_SHUFFLE(3, 3, 3, 3)));
+ const __m256 colorVector256 = _mm256_insertf128_ps(_mm256_castps128_ps256(colorVector), colorVector, 1);
+ const __m256 minusAlphaVector256 = _mm256_insertf128_ps(_mm256_castps128_ps256(minusAlphaOfColorVector),
+ minusAlphaOfColorVector, 1);
+ int x = 0;
+ for (; x < length - 1; x += 2) {
+ __m256 dstVector = _mm256_loadu_ps((const float *)&dst[x]);
+ dstVector = _mm256_mul_ps(dstVector, minusAlphaVector256);
+ dstVector = _mm256_add_ps(dstVector, colorVector256);
+ _mm256_storeu_ps((float *)&dst[x], dstVector);
+ }
+ if (x < length) {
+ __m128 dstVector = _mm_loadu_ps((const float *)&dst[x]);
+ dstVector = _mm_mul_ps(dstVector, minusAlphaOfColorVector);
+ dstVector = _mm_add_ps(dstVector, colorVector);
+ _mm_storeu_ps((float *)&dst[x], dstVector);
+ }
+ }
+}
+#endif
+
#define interpolate_4_pixels_16_avx2(tlr1, tlr2, blr1, blr2, distx, disty, colorMask, v_256, b) \
{ \
/* Correct for later unpack */ \
@@ -1088,25 +1184,25 @@ static void convertARGBToARGB32PM_avx2(uint *buffer, const uint *src, qsizetype
}
}
-void QT_FASTCALL convertARGB32ToARGB32PM_avx2(uint *buffer, int count, const QVector<QRgb> *)
+void QT_FASTCALL convertARGB32ToARGB32PM_avx2(uint *buffer, int count, const QList<QRgb> *)
{
convertARGBToARGB32PM_avx2<false>(buffer, buffer, count);
}
-void QT_FASTCALL convertRGBA8888ToARGB32PM_avx2(uint *buffer, int count, const QVector<QRgb> *)
+void QT_FASTCALL convertRGBA8888ToARGB32PM_avx2(uint *buffer, int count, const QList<QRgb> *)
{
convertARGBToARGB32PM_avx2<true>(buffer, buffer, count);
}
const uint *QT_FASTCALL fetchARGB32ToARGB32PM_avx2(uint *buffer, const uchar *src, int index, int count,
- const QVector<QRgb> *, QDitherInfo *)
+ const QList<QRgb> *, QDitherInfo *)
{
convertARGBToARGB32PM_avx2<false>(buffer, reinterpret_cast<const uint *>(src) + index, count);
return buffer;
}
const uint *QT_FASTCALL fetchRGBA8888ToARGB32PM_avx2(uint *buffer, const uchar *src, int index, int count,
- const QVector<QRgb> *, QDitherInfo *)
+ const QList<QRgb> *, QDitherInfo *)
{
convertARGBToARGB32PM_avx2<true>(buffer, reinterpret_cast<const uint *>(src) + index, count);
return buffer;
@@ -1201,33 +1297,320 @@ static void convertARGBToRGBA64PM_avx2(QRgba64 *buffer, const uint *src, qsizety
}
const QRgba64 * QT_FASTCALL convertARGB32ToRGBA64PM_avx2(QRgba64 *buffer, const uint *src, int count,
- const QVector<QRgb> *, QDitherInfo *)
+ const QList<QRgb> *, QDitherInfo *)
{
convertARGBToRGBA64PM_avx2<false>(buffer, src, count);
return buffer;
}
const QRgba64 * QT_FASTCALL convertRGBA8888ToRGBA64PM_avx2(QRgba64 *buffer, const uint *src, int count,
- const QVector<QRgb> *, QDitherInfo *)
+ const QList<QRgb> *, QDitherInfo *)
{
convertARGBToRGBA64PM_avx2<true>(buffer, src, count);
return buffer;
}
const QRgba64 *QT_FASTCALL fetchARGB32ToRGBA64PM_avx2(QRgba64 *buffer, const uchar *src, int index, int count,
- const QVector<QRgb> *, QDitherInfo *)
+ const QList<QRgb> *, QDitherInfo *)
{
convertARGBToRGBA64PM_avx2<false>(buffer, reinterpret_cast<const uint *>(src) + index, count);
return buffer;
}
const QRgba64 *QT_FASTCALL fetchRGBA8888ToRGBA64PM_avx2(QRgba64 *buffer, const uchar *src, int index, int count,
- const QVector<QRgb> *, QDitherInfo *)
+ const QList<QRgb> *, QDitherInfo *)
{
convertARGBToRGBA64PM_avx2<true>(buffer, reinterpret_cast<const uint *>(src) + index, count);
return buffer;
}
+const QRgba64 *QT_FASTCALL fetchRGBA64ToRGBA64PM_avx2(QRgba64 *buffer, const uchar *src, int index, int count,
+ const QList<QRgb> *, QDitherInfo *)
+{
+ const QRgba64 *s = reinterpret_cast<const QRgba64 *>(src) + index;
+ int i = 0;
+ const __m256i vh = _mm256_set1_epi32(0x8000);
+ for (; i < count - 3; i += 4) {
+ __m256i vs256 = _mm256_loadu_si256((const __m256i *)(s + i));
+ __m256i va256 = _mm256_shufflelo_epi16(vs256, _MM_SHUFFLE(3, 3, 3, 3));
+ va256 = _mm256_shufflehi_epi16(va256, _MM_SHUFFLE(3, 3, 3, 3));
+ const __m256i vmullo = _mm256_mullo_epi16(vs256, va256);
+ const __m256i vmulhi = _mm256_mulhi_epu16(vs256, va256);
+ __m256i vslo = _mm256_unpacklo_epi16(vmullo, vmulhi);
+ __m256i vshi = _mm256_unpackhi_epi16(vmullo, vmulhi);
+ vslo = _mm256_add_epi32(vslo, _mm256_srli_epi32(vslo, 16));
+ vshi = _mm256_add_epi32(vshi, _mm256_srli_epi32(vshi, 16));
+ vslo = _mm256_add_epi32(vslo, vh);
+ vshi = _mm256_add_epi32(vshi, vh);
+ vslo = _mm256_srli_epi32(vslo, 16);
+ vshi = _mm256_srli_epi32(vshi, 16);
+ vs256 = _mm256_packus_epi32(vslo, vshi);
+ vs256 = _mm256_blend_epi16(vs256, va256, 0x88);
+ _mm256_storeu_si256((__m256i *)(buffer + i), vs256);
+ }
+ for (; i < count; ++i) {
+ const auto a = s[i].alpha();
+ __m128i vs = _mm_loadl_epi64((const __m128i *)(s + i));
+ __m128i va = _mm_shufflelo_epi16(vs, _MM_SHUFFLE(3, 3, 3, 3));
+ vs = multiplyAlpha65535(vs, va);
+ _mm_storel_epi64((__m128i *)(buffer + i), vs);
+ buffer[i].setAlpha(a);
+ }
+ return buffer;
+}
+
+const uint *QT_FASTCALL fetchRGB16FToRGB32_avx2(uint *buffer, const uchar *src, int index, int count,
+ const QList<QRgb> *, QDitherInfo *)
+{
+ const quint64 *s = reinterpret_cast<const quint64 *>(src) + index;
+ const __m256 vf = _mm256_set1_ps(255.0f);
+ const __m256 vh = _mm256_set1_ps(0.5f);
+ int i = 0;
+ for (; i + 1 < count; i += 2) {
+ __m256 vsf = _mm256_cvtph_ps(_mm_loadu_si128((const __m128i *)(s + i)));
+ vsf = _mm256_mul_ps(vsf, vf);
+ vsf = _mm256_add_ps(vsf, vh);
+ __m256i vsi = _mm256_cvttps_epi32(vsf);
+ vsi = _mm256_packs_epi32(vsi, vsi);
+ vsi = _mm256_shufflelo_epi16(vsi, _MM_SHUFFLE(3, 0, 1, 2));
+ vsi = _mm256_permute4x64_epi64(vsi, _MM_SHUFFLE(3, 1, 2, 0));
+ __m128i vsi128 = _mm256_castsi256_si128(vsi);
+ vsi128 = _mm_packus_epi16(vsi128, vsi128);
+ _mm_storel_epi64((__m128i *)(buffer + i), vsi128);
+ }
+ if (i < count) {
+ __m128 vsf = _mm_cvtph_ps(_mm_loadl_epi64((const __m128i *)(s + i)));
+ vsf = _mm_mul_ps(vsf, _mm_set1_ps(255.0f));
+ vsf = _mm_add_ps(vsf, _mm_set1_ps(0.5f));
+ __m128i vsi = _mm_cvttps_epi32(vsf);
+ vsi = _mm_packs_epi32(vsi, vsi);
+ vsi = _mm_shufflelo_epi16(vsi, _MM_SHUFFLE(3, 0, 1, 2));
+ vsi = _mm_packus_epi16(vsi, vsi);
+ buffer[i] = _mm_cvtsi128_si32(vsi);
+ }
+ return buffer;
+}
+
+const uint *QT_FASTCALL fetchRGBA16FToARGB32PM_avx2(uint *buffer, const uchar *src, int index, int count,
+ const QList<QRgb> *, QDitherInfo *)
+{
+ const quint64 *s = reinterpret_cast<const quint64 *>(src) + index;
+ const __m256 vf = _mm256_set1_ps(255.0f);
+ const __m256 vh = _mm256_set1_ps(0.5f);
+ int i = 0;
+ for (; i + 1 < count; i += 2) {
+ __m256 vsf = _mm256_cvtph_ps(_mm_loadu_si128((const __m128i *)(s + i)));
+ __m256 vsa = _mm256_permute_ps(vsf, _MM_SHUFFLE(3, 3, 3, 3));
+ vsf = _mm256_mul_ps(vsf, vsa);
+ vsf = _mm256_blend_ps(vsf, vsa, 0x88);
+ vsf = _mm256_mul_ps(vsf, vf);
+ vsf = _mm256_add_ps(vsf, vh);
+ __m256i vsi = _mm256_cvttps_epi32(vsf);
+ vsi = _mm256_packus_epi32(vsi, vsi);
+ vsi = _mm256_shufflelo_epi16(vsi, _MM_SHUFFLE(3, 0, 1, 2));
+ vsi = _mm256_permute4x64_epi64(vsi, _MM_SHUFFLE(3, 1, 2, 0));
+ __m128i vsi128 = _mm256_castsi256_si128(vsi);
+ vsi128 = _mm_packus_epi16(vsi128, vsi128);
+ _mm_storel_epi64((__m128i *)(buffer + i), vsi128);
+ }
+ if (i < count) {
+ __m128 vsf = _mm_cvtph_ps(_mm_loadl_epi64((const __m128i *)(s + i)));
+ __m128 vsa = _mm_permute_ps(vsf, _MM_SHUFFLE(3, 3, 3, 3));
+ vsf = _mm_mul_ps(vsf, vsa);
+ vsf = _mm_insert_ps(vsf, vsa, 0x30);
+ vsf = _mm_mul_ps(vsf, _mm_set1_ps(255.0f));
+ vsf = _mm_add_ps(vsf, _mm_set1_ps(0.5f));
+ __m128i vsi = _mm_cvttps_epi32(vsf);
+ vsi = _mm_packus_epi32(vsi, vsi);
+ vsi = _mm_shufflelo_epi16(vsi, _MM_SHUFFLE(3, 0, 1, 2));
+ vsi = _mm_packus_epi16(vsi, vsi);
+ buffer[i] = _mm_cvtsi128_si32(vsi);
+ }
+ return buffer;
+}
+
+const QRgba64 *QT_FASTCALL fetchRGBA16FPMToRGBA64PM_avx2(QRgba64 *buffer, const uchar *src, int index, int count,
+ const QList<QRgb> *, QDitherInfo *)
+{
+ const quint64 *s = reinterpret_cast<const quint64 *>(src) + index;
+ const __m256 vf = _mm256_set1_ps(65535.0f);
+ const __m256 vh = _mm256_set1_ps(0.5f);
+ int i = 0;
+ for (; i + 1 < count; i += 2) {
+ __m256 vsf = _mm256_cvtph_ps(_mm_loadu_si128((const __m128i *)(s + i)));
+ vsf = _mm256_mul_ps(vsf, vf);
+ vsf = _mm256_add_ps(vsf, vh);
+ __m256i vsi = _mm256_cvttps_epi32(vsf);
+ vsi = _mm256_packus_epi32(vsi, vsi);
+ vsi = _mm256_permute4x64_epi64(vsi, _MM_SHUFFLE(3, 1, 2, 0));
+ _mm_storeu_si128((__m128i *)(buffer + i), _mm256_castsi256_si128(vsi));
+ }
+ if (i < count) {
+ __m128 vsf = _mm_cvtph_ps(_mm_loadl_epi64((const __m128i *)(s + i)));
+ vsf = _mm_mul_ps(vsf, _mm_set1_ps(65535.0f));
+ vsf = _mm_add_ps(vsf, _mm_set1_ps(0.5f));
+ __m128i vsi = _mm_cvttps_epi32(vsf);
+ vsi = _mm_packus_epi32(vsi, vsi);
+ _mm_storel_epi64((__m128i *)(buffer + i), vsi);
+ }
+ return buffer;
+}
+
+const QRgba64 *QT_FASTCALL fetchRGBA16FToRGBA64PM_avx2(QRgba64 *buffer, const uchar *src, int index, int count,
+ const QList<QRgb> *, QDitherInfo *)
+{
+ const quint64 *s = reinterpret_cast<const quint64 *>(src) + index;
+ const __m256 vf = _mm256_set1_ps(65535.0f);
+ const __m256 vh = _mm256_set1_ps(0.5f);
+ int i = 0;
+ for (; i + 1 < count; i += 2) {
+ __m256 vsf = _mm256_cvtph_ps(_mm_loadu_si128((const __m128i *)(s + i)));
+ __m256 vsa = _mm256_shuffle_ps(vsf, vsf, _MM_SHUFFLE(3, 3, 3, 3));
+ vsf = _mm256_mul_ps(vsf, vsa);
+ vsf = _mm256_blend_ps(vsf, vsa, 0x88);
+ vsf = _mm256_mul_ps(vsf, vf);
+ vsf = _mm256_add_ps(vsf, vh);
+ __m256i vsi = _mm256_cvttps_epi32(vsf);
+ vsi = _mm256_packus_epi32(vsi, vsi);
+ vsi = _mm256_permute4x64_epi64(vsi, _MM_SHUFFLE(3, 1, 2, 0));
+ _mm_storeu_si128((__m128i *)(buffer + i), _mm256_castsi256_si128(vsi));
+ }
+ if (i < count) {
+ __m128 vsf = _mm_cvtph_ps(_mm_loadl_epi64((const __m128i *)(s + i)));
+ __m128 vsa = _mm_shuffle_ps(vsf, vsf, _MM_SHUFFLE(3, 3, 3, 3));
+ vsf = _mm_mul_ps(vsf, vsa);
+ vsf = _mm_insert_ps(vsf, vsa, 0x30);
+ vsf = _mm_mul_ps(vsf, _mm_set1_ps(65535.0f));
+ vsf = _mm_add_ps(vsf, _mm_set1_ps(0.5f));
+ __m128i vsi = _mm_cvttps_epi32(vsf);
+ vsi = _mm_packus_epi32(vsi, vsi);
+ _mm_storel_epi64((__m128i *)(buffer + i), vsi);
+ }
+ return buffer;
+}
+
+void QT_FASTCALL storeRGB16FFromRGB32_avx2(uchar *dest, const uint *src, int index, int count,
+ const QList<QRgb> *, QDitherInfo *)
+{
+ quint64 *d = reinterpret_cast<quint64 *>(dest) + index;
+ const __m256 vf = _mm256_set1_ps(1.0f / 255.0f);
+ int i = 0;
+ for (; i + 1 < count; i += 2) {
+ __m256i vsi = _mm256_cvtepu8_epi32(_mm_loadl_epi64((const __m128i *)(src + i)));
+ vsi = _mm256_shuffle_epi32(vsi, _MM_SHUFFLE(3, 0, 1, 2));
+ __m256 vsf = _mm256_cvtepi32_ps(vsi);
+ vsf = _mm256_mul_ps(vsf, vf);
+ _mm_storeu_si128((__m128i *)(d + i), _mm256_cvtps_ph(vsf, 0));
+ }
+ if (i < count) {
+ __m128i vsi = _mm_cvtsi32_si128(src[i]);
+ vsi = _mm_cvtepu8_epi32(vsi);
+ vsi = _mm_shuffle_epi32(vsi, _MM_SHUFFLE(3, 0, 1, 2));
+ __m128 vsf = _mm_cvtepi32_ps(vsi);
+ vsf = _mm_mul_ps(vsf, _mm_set1_ps(1.0f / 255.0f));
+ _mm_storel_epi64((__m128i *)(d + i), _mm_cvtps_ph(vsf, 0));
+ }
+}
+
+void QT_FASTCALL storeRGBA16FFromARGB32PM_avx2(uchar *dest, const uint *src, int index, int count,
+ const QList<QRgb> *, QDitherInfo *)
+{
+ quint64 *d = reinterpret_cast<quint64 *>(dest) + index;
+ const __m128 vf = _mm_set1_ps(1.0f / 255.0f);
+ for (int i = 0; i < count; ++i) {
+ const uint s = src[i];
+ __m128i vsi = _mm_cvtsi32_si128(s);
+ vsi = _mm_cvtepu8_epi32(vsi);
+ vsi = _mm_shuffle_epi32(vsi, _MM_SHUFFLE(3, 0, 1, 2));
+ __m128 vsf = _mm_cvtepi32_ps(vsi);
+ const uint8_t a = (s >> 24);
+ if (a == 255)
+ vsf = _mm_mul_ps(vsf, vf);
+ else if (a == 0)
+ vsf = _mm_set1_ps(0.0f);
+ else {
+ const __m128 vsa = _mm_permute_ps(vsf, _MM_SHUFFLE(3, 3, 3, 3));
+ __m128 vsr = _mm_rcp_ps(vsa);
+ vsr = _mm_sub_ps(_mm_add_ps(vsr, vsr), _mm_mul_ps(vsr, _mm_mul_ps(vsr, vsa)));
+ vsr = _mm_insert_ps(vsr, _mm_set_ss(1.0f), 0x30);
+ vsf = _mm_mul_ps(vsf, vsr);
+ }
+ _mm_storel_epi64((__m128i *)(d + i), _mm_cvtps_ph(vsf, 0));
+ }
+}
+
+#if QT_CONFIG(raster_fp)
+const QRgbaFloat32 *QT_FASTCALL fetchRGBA16FToRGBA32F_avx2(QRgbaFloat32 *buffer, const uchar *src, int index, int count,
+ const QList<QRgb> *, QDitherInfo *)
+{
+ const quint64 *s = reinterpret_cast<const quint64 *>(src) + index;
+ int i = 0;
+ for (; i + 1 < count; i += 2) {
+ __m256 vsf = _mm256_cvtph_ps(_mm_loadu_si128((const __m128i *)(s + i)));
+ __m256 vsa = _mm256_permute_ps(vsf, _MM_SHUFFLE(3, 3, 3, 3));
+ vsf = _mm256_mul_ps(vsf, vsa);
+ vsf = _mm256_blend_ps(vsf, vsa, 0x88);
+ _mm256_storeu_ps((float *)(buffer + i), vsf);
+ }
+ if (i < count) {
+ __m128 vsf = _mm_cvtph_ps(_mm_loadl_epi64((const __m128i *)(s + i)));
+ __m128 vsa = _mm_permute_ps(vsf, _MM_SHUFFLE(3, 3, 3, 3));
+ vsf = _mm_mul_ps(vsf, vsa);
+ vsf = _mm_insert_ps(vsf, vsa, 0x30);
+ _mm_storeu_ps((float *)(buffer + i), vsf);
+ }
+ return buffer;
+}
+
+void QT_FASTCALL storeRGBX16FFromRGBA32F_avx2(uchar *dest, const QRgbaFloat32 *src, int index, int count,
+ const QList<QRgb> *, QDitherInfo *)
+{
+ quint64 *d = reinterpret_cast<quint64 *>(dest) + index;
+ const __m128 *s = reinterpret_cast<const __m128 *>(src);
+ const __m128 zero = _mm_set_ps(1.0f, 0.0f, 0.0f, 0.0f);
+ for (int i = 0; i < count; ++i) {
+ __m128 vsf = _mm_loadu_ps(reinterpret_cast<const float *>(s + i));
+ const __m128 vsa = _mm_permute_ps(vsf, _MM_SHUFFLE(3, 3, 3, 3));
+ const float a = _mm_cvtss_f32(vsa);
+ if (a == 1.0f)
+ { }
+ else if (a == 0.0f)
+ vsf = zero;
+ else {
+ __m128 vsr = _mm_rcp_ps(vsa);
+ vsr = _mm_sub_ps(_mm_add_ps(vsr, vsr), _mm_mul_ps(vsr, _mm_mul_ps(vsr, vsa)));
+ vsf = _mm_mul_ps(vsf, vsr);
+ vsf = _mm_insert_ps(vsf, _mm_set_ss(1.0f), 0x30);
+ }
+ _mm_storel_epi64((__m128i *)(d + i), _mm_cvtps_ph(vsf, 0));
+ }
+}
+
+void QT_FASTCALL storeRGBA16FFromRGBA32F_avx2(uchar *dest, const QRgbaFloat32 *src, int index, int count,
+ const QList<QRgb> *, QDitherInfo *)
+{
+ quint64 *d = reinterpret_cast<quint64 *>(dest) + index;
+ const __m128 *s = reinterpret_cast<const __m128 *>(src);
+ const __m128 zero = _mm_set1_ps(0.0f);
+ for (int i = 0; i < count; ++i) {
+ __m128 vsf = _mm_loadu_ps(reinterpret_cast<const float *>(s + i));
+ const __m128 vsa = _mm_permute_ps(vsf, _MM_SHUFFLE(3, 3, 3, 3));
+ const float a = _mm_cvtss_f32(vsa);
+ if (a == 1.0f)
+ { }
+ else if (a == 0.0f)
+ vsf = zero;
+ else {
+ __m128 vsr = _mm_rcp_ps(vsa);
+ vsr = _mm_sub_ps(_mm_add_ps(vsr, vsr), _mm_mul_ps(vsr, _mm_mul_ps(vsr, vsa)));
+ vsr = _mm_insert_ps(vsr, _mm_set_ss(1.0f), 0x30);
+ vsf = _mm_mul_ps(vsf, vsr);
+ }
+ _mm_storel_epi64((__m128i *)(d + i), _mm_cvtps_ph(vsf, 0));
+ }
+}
+#endif
+
QT_END_NAMESPACE
#endif
diff --git a/src/gui/painting/qdrawhelper_mips_dsp.cpp b/src/gui/painting/qdrawhelper_mips_dsp.cpp
index 17597deb1d..86dcde2b58 100644
--- a/src/gui/painting/qdrawhelper_mips_dsp.cpp
+++ b/src/gui/painting/qdrawhelper_mips_dsp.cpp
@@ -1,41 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2013 Imagination Technologies Limited, www.imgtec.com
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the QtGui module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2013 Imagination Technologies Limited, www.imgtec.com
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#include <private/qdrawhelper_p.h>
#include <private/qdrawhelper_mips_dsp_p.h>
@@ -131,7 +95,7 @@ void qt_blend_rgb16_on_rgb16_mips_dspr2(uchar *destPixels, int dbpl,
}
else {
int length = w << 1;
- while (h--) {
+ while (--h >= 0) {
memcpy(destPixels, srcPixels, length);
destPixels += dbpl;
srcPixels += sbpl;
@@ -166,7 +130,7 @@ void qt_blend_rgb16_on_rgb16_mips_dsp(uchar *destPixels, int dbpl,
}
else {
int length = w << 1;
- while (h--) {
+ while (--h >= 0) {
memcpy(destPixels, srcPixels, length);
destPixels += dbpl;
srcPixels += sbpl;
diff --git a/src/gui/painting/qdrawhelper_mips_dsp_asm.S b/src/gui/painting/qdrawhelper_mips_dsp_asm.S
index c6b34293b6..8e0530aa9d 100644
--- a/src/gui/painting/qdrawhelper_mips_dsp_asm.S
+++ b/src/gui/painting/qdrawhelper_mips_dsp_asm.S
@@ -1,41 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2013 Imagination Technologies Limited, www.imgtec.com
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the QtGui module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2013 Imagination Technologies Limited, www.imgtec.com
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#include "qt_mips_asm_dsp_p.h"
@@ -1970,7 +1934,7 @@ LEAF_MIPS_DSP(fetchUntransformed_444_asm_mips_dsp)
2:
andi t0, a1, 0x3
beqz t0, 3f /* memory is word aligned */
- andi a3, a2, 0x1 /* set the a3 register as the comparation
+ andi a3, a2, 0x1 /* set the a3 register as the comparison
* for ending the unrolled loop
* (1 if odd, 0 if even) */
b 1b /* not word aligned,
diff --git a/src/gui/painting/qdrawhelper_mips_dsp_p.h b/src/gui/painting/qdrawhelper_mips_dsp_p.h
index a3d0410274..2a371b3b46 100644
--- a/src/gui/painting/qdrawhelper_mips_dsp_p.h
+++ b/src/gui/painting/qdrawhelper_mips_dsp_p.h
@@ -1,41 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2013 Imagination Technologies Limited, www.imgtec.com
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the QtGui module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2013 Imagination Technologies Limited, www.imgtec.com
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#ifndef QDRAWHELPER_MIPS_DSP_P_H
#define QDRAWHELPER_MIPS_DSP_P_H
diff --git a/src/gui/painting/qdrawhelper_mips_dspr2_asm.S b/src/gui/painting/qdrawhelper_mips_dspr2_asm.S
index 4921365e36..edcaa5d0a9 100644
--- a/src/gui/painting/qdrawhelper_mips_dspr2_asm.S
+++ b/src/gui/painting/qdrawhelper_mips_dspr2_asm.S
@@ -1,41 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2013 Imagination Technologies Limited, www.imgtec.com
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the QtGui module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2013 Imagination Technologies Limited, www.imgtec.com
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#include "qt_mips_asm_dsp_p.h"
diff --git a/src/gui/painting/qdrawhelper_neon.cpp b/src/gui/painting/qdrawhelper_neon.cpp
index 8196a87b24..1fceb83710 100644
--- a/src/gui/painting/qdrawhelper_neon.cpp
+++ b/src/gui/painting/qdrawhelper_neon.cpp
@@ -1,45 +1,10 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the QtGui module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#include <private/qdrawhelper_neon_p.h>
#include <private/qblendfunctions_p.h>
#include <private/qmath_p.h>
+#include <private/qpixellayout_p.h>
#ifdef __ARM_NEON__
@@ -220,7 +185,7 @@ void qt_blend_rgb16_on_argb32_neon(uchar *destPixels, int dbpl,
quint8 a = (255 * const_alpha) >> 8;
quint8 ia = 255 - a;
- while (h--) {
+ while (--h >= 0) {
for (int x=0; x<w; ++x)
dst[x] = INTERPOLATE_PIXEL_255(qConvertRgb16To32(src[x]), a, dst[x], ia);
dst += dbpl;
@@ -263,7 +228,7 @@ static inline void blockBlit16(quint16 *dst, quint16 *src, int dstride, int sstr
u.pointer = dst;
if (u.address & 2) {
- while (h--) {
+ while (--h >= 0) {
// align dst
dst[0] = src[0];
if (Width > 1)
@@ -272,7 +237,7 @@ static inline void blockBlit16(quint16 *dst, quint16 *src, int dstride, int sstr
src += sstride;
}
} else {
- while (h--) {
+ while (--h >= 0) {
scanLineBlit16<Width>(dst, src, dstride);
dst += dstride;
@@ -1311,81 +1276,81 @@ static inline void convertARGBFromARGB32PM_neon(uint *buffer, const uint *src, i
}
}
-void QT_FASTCALL convertARGB32ToARGB32PM_neon(uint *buffer, int count, const QVector<QRgb> *)
+void QT_FASTCALL convertARGB32ToARGB32PM_neon(uint *buffer, int count, const QList<QRgb> *)
{
convertARGBToARGB32PM_neon<false>(buffer, buffer, count);
}
-void QT_FASTCALL convertRGBA8888ToARGB32PM_neon(uint *buffer, int count, const QVector<QRgb> *)
+void QT_FASTCALL convertRGBA8888ToARGB32PM_neon(uint *buffer, int count, const QList<QRgb> *)
{
convertARGBToARGB32PM_neon<true>(buffer, buffer, count);
}
const uint *QT_FASTCALL fetchARGB32ToARGB32PM_neon(uint *buffer, const uchar *src, int index, int count,
- const QVector<QRgb> *, QDitherInfo *)
+ const QList<QRgb> *, QDitherInfo *)
{
convertARGBToARGB32PM_neon<false>(buffer, reinterpret_cast<const uint *>(src) + index, count);
return buffer;
}
const uint *QT_FASTCALL fetchRGBA8888ToARGB32PM_neon(uint *buffer, const uchar *src, int index, int count,
- const QVector<QRgb> *, QDitherInfo *)
+ const QList<QRgb> *, QDitherInfo *)
{
convertARGBToARGB32PM_neon<true>(buffer, reinterpret_cast<const uint *>(src) + index, count);
return buffer;
}
const QRgba64 * QT_FASTCALL convertARGB32ToRGBA64PM_neon(QRgba64 *buffer, const uint *src, int count,
- const QVector<QRgb> *, QDitherInfo *)
+ const QList<QRgb> *, QDitherInfo *)
{
convertARGB32ToRGBA64PM_neon<false>(buffer, src, count);
return buffer;
}
const QRgba64 * QT_FASTCALL convertRGBA8888ToRGBA64PM_neon(QRgba64 *buffer, const uint *src, int count,
- const QVector<QRgb> *, QDitherInfo *)
+ const QList<QRgb> *, QDitherInfo *)
{
convertARGB32ToRGBA64PM_neon<true>(buffer, src, count);
return buffer;
}
const QRgba64 *QT_FASTCALL fetchARGB32ToRGBA64PM_neon(QRgba64 *buffer, const uchar *src, int index, int count,
- const QVector<QRgb> *, QDitherInfo *)
+ const QList<QRgb> *, QDitherInfo *)
{
convertARGB32ToRGBA64PM_neon<false>(buffer, reinterpret_cast<const uint *>(src) + index, count);
return buffer;
}
const QRgba64 *QT_FASTCALL fetchRGBA8888ToRGBA64PM_neon(QRgba64 *buffer, const uchar *src, int index, int count,
- const QVector<QRgb> *, QDitherInfo *)
+ const QList<QRgb> *, QDitherInfo *)
{
convertARGB32ToRGBA64PM_neon<true>(buffer, reinterpret_cast<const uint *>(src) + index, count);
return buffer;
}
void QT_FASTCALL storeRGB32FromARGB32PM_neon(uchar *dest, const uint *src, int index, int count,
- const QVector<QRgb> *, QDitherInfo *)
+ const QList<QRgb> *, QDitherInfo *)
{
uint *d = reinterpret_cast<uint *>(dest) + index;
convertARGBFromARGB32PM_neon<false,true>(d, src, count);
}
void QT_FASTCALL storeARGB32FromARGB32PM_neon(uchar *dest, const uint *src, int index, int count,
- const QVector<QRgb> *, QDitherInfo *)
+ const QList<QRgb> *, QDitherInfo *)
{
uint *d = reinterpret_cast<uint *>(dest) + index;
convertARGBFromARGB32PM_neon<false,false>(d, src, count);
}
void QT_FASTCALL storeRGBA8888FromARGB32PM_neon(uchar *dest, const uint *src, int index, int count,
- const QVector<QRgb> *, QDitherInfo *)
+ const QList<QRgb> *, QDitherInfo *)
{
uint *d = reinterpret_cast<uint *>(dest) + index;
convertARGBFromARGB32PM_neon<true,false>(d, src, count);
}
void QT_FASTCALL storeRGBXFromARGB32PM_neon(uchar *dest, const uint *src, int index, int count,
- const QVector<QRgb> *, QDitherInfo *)
+ const QList<QRgb> *, QDitherInfo *)
{
uint *d = reinterpret_cast<uint *>(dest) + index;
convertARGBFromARGB32PM_neon<true,true>(d, src, count);
diff --git a/src/gui/painting/qdrawhelper_neon_asm.S b/src/gui/painting/qdrawhelper_neon_asm.S
index 1830fd2fc0..3b6568403f 100644
--- a/src/gui/painting/qdrawhelper_neon_asm.S
+++ b/src/gui/painting/qdrawhelper_neon_asm.S
@@ -1,41 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the QtGui module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#if defined(ENABLE_PIXMAN_DRAWHELPERS)
@@ -296,4 +260,4 @@ qt_rotate90_16_neon:
.endfunc
-#endif \ No newline at end of file
+#endif
diff --git a/src/gui/painting/qdrawhelper_neon_p.h b/src/gui/painting/qdrawhelper_neon_p.h
index 19e1f21a3b..193499f223 100644
--- a/src/gui/painting/qdrawhelper_neon_p.h
+++ b/src/gui/painting/qdrawhelper_neon_p.h
@@ -1,41 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the QtGui module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#ifndef QDRAWHELPER_NEON_P_H
#define QDRAWHELPER_NEON_P_H
diff --git a/src/gui/painting/qdrawhelper_p.h b/src/gui/painting/qdrawhelper_p.h
index dd42b96d79..833ddd7b16 100644
--- a/src/gui/painting/qdrawhelper_p.h
+++ b/src/gui/painting/qdrawhelper_p.h
@@ -1,41 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the QtGui module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#ifndef QDRAWHELPER_P_H
#define QDRAWHELPER_P_H
@@ -61,16 +25,17 @@
#define QT_FT_BEGIN_HEADER
#define QT_FT_END_HEADER
#endif
+#include "private/qpixellayout_p.h"
#include "private/qrasterdefs_p.h"
#include <private/qsimd_p.h>
-#include <QtCore/qsharedpointer.h>
+#include <memory>
QT_BEGIN_NAMESPACE
#if defined(Q_CC_GNU)
# define Q_DECL_RESTRICT __restrict__
-# if defined(Q_PROCESSOR_X86_32) && defined(Q_CC_GNU) && !defined(Q_CC_CLANG) && !defined(Q_CC_INTEL)
+# if defined(Q_PROCESSOR_X86_32) && defined(Q_CC_GNU) && !defined(Q_CC_CLANG)
# define Q_DECL_VECTORCALL __attribute__((sseregparm,regparm(3)))
# else
# define Q_DECL_VECTORCALL
@@ -88,13 +53,6 @@ static const uint RMASK = 0x00ff0000;
static const uint GMASK = 0x0000ff00;
static const uint BMASK = 0x000000ff;
-/*******************************************************************************
- * QSpan
- *
- * duplicate definition of FT_Span
- */
-typedef QT_FT_Span QSpan;
-
struct QSolidData;
struct QTextureData;
struct QGradientData;
@@ -107,6 +65,9 @@ class QRasterBuffer;
class QClipData;
class QRasterPaintEngineState;
+template<typename F> class QRgbaFloat;
+typedef QRgbaFloat<float> QRgbaFloat32;
+
typedef QT_FT_SpanFunc ProcessSpans;
typedef void (*BitmapBlitFunc)(QRasterBuffer *rasterBuffer,
int x, int y, const QRgba64 &color,
@@ -149,8 +110,6 @@ typedef void (*SrcOverTransformFunc)(uchar *destPixels, int dbpl,
const QTransform &targetRectTransform,
int const_alpha);
-typedef void (*MemRotateFunc)(const uchar *srcPixels, int w, int h, int sbpl, uchar *destPixels, int dbpl);
-
struct DrawHelper {
ProcessSpans blendColor;
BitmapBlitFunc bitmapBlit;
@@ -181,9 +140,9 @@ struct quint24 {
uchar data[3];
};
-void qBlendGradient(int count, const QSpan *spans, void *userData);
-void qBlendTexture(int count, const QSpan *spans, void *userData);
-#ifdef __SSE2__
+void qBlendGradient(int count, const QT_FT_Span *spans, void *userData);
+void qBlendTexture(int count, const QT_FT_Span *spans, void *userData);
+#ifdef Q_PROCESSOR_X86
extern void (*qt_memfill64)(quint64 *dest, quint64 value, qsizetype count);
extern void (*qt_memfill32)(quint32 *dest, quint32 value, qsizetype count);
#else
@@ -195,8 +154,10 @@ extern void qt_memfill16(quint16 *dest, quint16 value, qsizetype count);
typedef void (QT_FASTCALL *CompositionFunction)(uint *Q_DECL_RESTRICT dest, const uint *Q_DECL_RESTRICT src, int length, uint const_alpha);
typedef void (QT_FASTCALL *CompositionFunction64)(QRgba64 *Q_DECL_RESTRICT dest, const QRgba64 *Q_DECL_RESTRICT src, int length, uint const_alpha);
+typedef void (QT_FASTCALL *CompositionFunctionFP)(QRgbaFloat32 *Q_DECL_RESTRICT dest, const QRgbaFloat32 *Q_DECL_RESTRICT src, int length, uint const_alpha);
typedef void (QT_FASTCALL *CompositionFunctionSolid)(uint *dest, int length, uint color, uint const_alpha);
typedef void (QT_FASTCALL *CompositionFunctionSolid64)(QRgba64 *dest, int length, QRgba64 color, uint const_alpha);
+typedef void (QT_FASTCALL *CompositionFunctionSolidFP)(QRgbaFloat32 *dest, int length, QRgbaFloat32 color, uint const_alpha);
struct LinearGradientValues
{
@@ -213,17 +174,19 @@ struct RadialGradientValues
qreal dr;
qreal sqrfr;
qreal a;
- qreal inv2a;
bool extended;
};
struct Operator;
typedef uint* (QT_FASTCALL *DestFetchProc)(uint *buffer, QRasterBuffer *rasterBuffer, int x, int y, int length);
typedef QRgba64* (QT_FASTCALL *DestFetchProc64)(QRgba64 *buffer, QRasterBuffer *rasterBuffer, int x, int y, int length);
+typedef QRgbaFloat32* (QT_FASTCALL *DestFetchProcFP)(QRgbaFloat32 *buffer, QRasterBuffer *rasterBuffer, int x, int y, int length);
typedef void (QT_FASTCALL *DestStoreProc)(QRasterBuffer *rasterBuffer, int x, int y, const uint *buffer, int length);
typedef void (QT_FASTCALL *DestStoreProc64)(QRasterBuffer *rasterBuffer, int x, int y, const QRgba64 *buffer, int length);
+typedef void (QT_FASTCALL *DestStoreProcFP)(QRasterBuffer *rasterBuffer, int x, int y, const QRgbaFloat32 *buffer, int length);
typedef const uint* (QT_FASTCALL *SourceFetchProc)(uint *buffer, const Operator *o, const QSpanData *data, int y, int x, int length);
typedef const QRgba64* (QT_FASTCALL *SourceFetchProc64)(QRgba64 *buffer, const Operator *o, const QSpanData *data, int y, int x, int length);
+typedef const QRgbaFloat32* (QT_FASTCALL *SourceFetchProcFP)(QRgbaFloat32 *buffer, const Operator *o, const QSpanData *data, int y, int x, int length);
struct Operator
{
@@ -240,6 +203,12 @@ struct Operator
CompositionFunctionSolid64 funcSolid64;
CompositionFunction64 func64;
+ DestFetchProcFP destFetchFP;
+ DestStoreProcFP destStoreFP;
+ SourceFetchProcFP srcFetchFP;
+ CompositionFunctionSolidFP funcSolidFP;
+ CompositionFunctionFP funcFP;
+
union {
LinearGradientValues linear;
RadialGradientValues radial;
@@ -296,7 +265,7 @@ struct QGradientData
#define GRADIENT_STOPTABLE_SIZE 1024
#define GRADIENT_STOPTABLE_SIZE_SHIFT 10
-#if QT_CONFIG(raster_64bit)
+#if QT_CONFIG(raster_64bit) || QT_CONFIG(raster_fp)
const QRgba64 *colorTable64; //[GRADIENT_STOPTABLE_SIZE];
#endif
const QRgb *colorTable32; //[GRADIENT_STOPTABLE_SIZE];
@@ -318,11 +287,12 @@ struct QTextureData
int y2;
qsizetype bytesPerLine;
QImage::Format format;
- const QVector<QRgb> *colorTable;
+ const QList<QRgb> *colorTable;
bool hasAlpha;
enum Type {
Plain,
- Tiled
+ Tiled,
+ Pattern
};
Type type;
int const_alpha;
@@ -350,24 +320,20 @@ struct QSpanData
ConicalGradient,
Texture
} type : 8;
- int txop : 8;
- int fast_matrix : 1;
+ signed int txop : 8;
+ uint fast_matrix : 1;
bool bilinear;
QImage *tempImage;
- QRgba64 solidColor;
+ QColor solidColor;
union {
QGradientData gradient;
QTextureData texture;
};
- class Pinnable {
- protected:
- ~Pinnable() {}
- }; // QSharedPointer<const void> is not supported
- QSharedPointer<const Pinnable> cachedGradient;
+ std::shared_ptr<const void> cachedGradient;
void init(QRasterBuffer *rb, const QRasterPaintEngine *pe);
- void setup(const QBrush &brush, int alpha, QPainter::CompositionMode compositionMode);
+ void setup(const QBrush &brush, int alpha, QPainter::CompositionMode compositionMode, bool isCosmetic);
void setupMatrix(const QTransform &matrix, int bilinear);
void initTexture(const QImage *image, int alpha, QTextureData::Type = QTextureData::Plain, const QRect &sourceRect = QRect());
void adjustSpanMethods();
@@ -435,12 +401,12 @@ const BlendType * QT_FASTCALL qt_fetch_radial_gradient_template(BlendType *buffe
bool affine = !data->m13 && !data->m23;
BlendType *end = buffer + length;
+ qreal inv_a = 1 / qreal(2 * op->radial.a);
+
if (affine) {
rx -= data->gradient.radial.focal.x;
ry -= data->gradient.radial.focal.y;
- qreal inv_a = 1 / qreal(2 * op->radial.a);
-
const qreal delta_rx = data->m11;
const qreal delta_ry = data->m12;
@@ -473,7 +439,7 @@ const BlendType * QT_FASTCALL qt_fetch_radial_gradient_template(BlendType *buffe
while (buffer < end) {
if (rw == 0) {
- *buffer = 0;
+ *buffer = RadialFetchFunc::null();
} else {
qreal invRw = 1 / rw;
qreal gx = rx * invRw - data->gradient.radial.focal.x;
@@ -485,8 +451,8 @@ const BlendType * QT_FASTCALL qt_fetch_radial_gradient_template(BlendType *buffe
if (det >= 0) {
qreal detSqrt = qSqrt(det);
- qreal s0 = (-b - detSqrt) * op->radial.inv2a;
- qreal s1 = (-b + detSqrt) * op->radial.inv2a;
+ qreal s0 = (-b - detSqrt) * inv_a;
+ qreal s1 = (-b + detSqrt) * inv_a;
qreal s = qMax(s0, s1);
@@ -601,12 +567,12 @@ public:
FETCH_RADIAL_LOOP(FETCH_RADIAL_LOOP_CLAMP_PAD)
break;
default:
- Q_ASSERT(false);
+ Q_UNREACHABLE();
}
}
};
-static Q_ALWAYS_INLINE uint INTERPOLATE_PIXEL_255(uint x, uint a, uint y, uint b) {
+static inline uint INTERPOLATE_PIXEL_255(uint x, uint a, uint y, uint b) {
uint t = (x & 0xff00ff) * a + (y & 0xff00ff) * b;
t = (t + ((t >> 8) & 0xff00ff) + 0x800080) >> 8;
t &= 0xff00ff;
@@ -620,7 +586,7 @@ static Q_ALWAYS_INLINE uint INTERPOLATE_PIXEL_255(uint x, uint a, uint y, uint b
#if Q_PROCESSOR_WORDSIZE == 8 // 64-bit versions
-static Q_ALWAYS_INLINE uint INTERPOLATE_PIXEL_256(uint x, uint a, uint y, uint b) {
+static inline uint INTERPOLATE_PIXEL_256(uint x, uint a, uint y, uint b) {
quint64 t = (((quint64(x)) | ((quint64(x)) << 24)) & 0x00ff00ff00ff00ff) * a;
t += (((quint64(y)) | ((quint64(y)) << 24)) & 0x00ff00ff00ff00ff) * b;
t >>= 8;
@@ -628,7 +594,7 @@ static Q_ALWAYS_INLINE uint INTERPOLATE_PIXEL_256(uint x, uint a, uint y, uint b
return (uint(t)) | (uint(t >> 24));
}
-static Q_ALWAYS_INLINE uint BYTE_MUL(uint x, uint a) {
+static inline uint BYTE_MUL(uint x, uint a) {
quint64 t = (((quint64(x)) | ((quint64(x)) << 24)) & 0x00ff00ff00ff00ff) * a;
t = (t + ((t >> 8) & 0xff00ff00ff00ff) + 0x80008000800080) >> 8;
t &= 0x00ff00ff00ff00ff;
@@ -637,7 +603,7 @@ static Q_ALWAYS_INLINE uint BYTE_MUL(uint x, uint a) {
#else // 32-bit versions
-static Q_ALWAYS_INLINE uint INTERPOLATE_PIXEL_256(uint x, uint a, uint y, uint b) {
+static inline uint INTERPOLATE_PIXEL_256(uint x, uint a, uint y, uint b) {
uint t = (x & 0xff00ff) * a + (y & 0xff00ff) * b;
t >>= 8;
t &= 0xff00ff;
@@ -648,7 +614,7 @@ static Q_ALWAYS_INLINE uint INTERPOLATE_PIXEL_256(uint x, uint a, uint y, uint b
return x;
}
-static Q_ALWAYS_INLINE uint BYTE_MUL(uint x, uint a) {
+static inline uint BYTE_MUL(uint x, uint a) {
uint t = (x & 0xff00ff) * a;
t = (t + ((t >> 8) & 0xff00ff) + 0x800080) >> 8;
t &= 0xff00ff;
@@ -661,7 +627,7 @@ static Q_ALWAYS_INLINE uint BYTE_MUL(uint x, uint a) {
}
#endif
-static Q_ALWAYS_INLINE void blend_pixel(quint32 &dst, const quint32 src)
+static inline void blend_pixel(quint32 &dst, const quint32 src)
{
if (src >= 0xff000000)
dst = src;
@@ -669,7 +635,7 @@ static Q_ALWAYS_INLINE void blend_pixel(quint32 &dst, const quint32 src)
dst = src + BYTE_MUL(dst, qAlpha(~src));
}
-static Q_ALWAYS_INLINE void blend_pixel(quint32 &dst, const quint32 src, const int const_alpha)
+static inline void blend_pixel(quint32 &dst, const quint32 src, const int const_alpha)
{
if (const_alpha == 255)
return blend_pixel(dst, src);
@@ -680,7 +646,7 @@ static Q_ALWAYS_INLINE void blend_pixel(quint32 &dst, const quint32 src, const i
}
#if defined(__SSE2__)
-static Q_ALWAYS_INLINE uint interpolate_4_pixels_sse2(__m128i vt, __m128i vb, uint distx, uint disty)
+static inline uint Q_DECL_VECTORCALL interpolate_4_pixels_sse2(__m128i vt, __m128i vb, uint distx, uint disty)
{
// First interpolate top and bottom pixels in parallel.
vt = _mm_unpacklo_epi8(vt, _mm_setzero_si128());
@@ -721,7 +687,7 @@ static inline uint interpolate_4_pixels(const uint t[], const uint b[], uint dis
static constexpr inline bool hasFastInterpolate4() { return true; }
#elif defined(__ARM_NEON__)
-static Q_ALWAYS_INLINE uint interpolate_4_pixels_neon(uint32x2_t vt32, uint32x2_t vb32, uint distx, uint disty)
+static inline uint interpolate_4_pixels_neon(uint32x2_t vt32, uint32x2_t vb32, uint distx, uint disty)
{
uint16x8_t vt16 = vmovl_u8(vreinterpret_u8_u32(vt32));
uint16x8_t vb16 = vmovl_u8(vreinterpret_u8_u32(vb32));
@@ -845,57 +811,75 @@ static inline QRgba64 interpolate_4_pixels_rgb64(const QRgba64 t[], const QRgba6
}
#endif // __SSE2__
-#if Q_BYTE_ORDER == Q_BIG_ENDIAN
-static Q_ALWAYS_INLINE quint32 RGBA2ARGB(quint32 x) {
- quint32 rgb = x >> 8;
- quint32 a = x << 24;
- return a | rgb;
+#if QT_CONFIG(raster_fp)
+static inline QRgbaFloat32 multiplyAlpha_rgba32f(QRgbaFloat32 c, float a)
+{
+ return QRgbaFloat32 { c.r * a, c.g * a, c.b * a, c.a * a };
}
-static Q_ALWAYS_INLINE quint32 ARGB2RGBA(quint32 x) {
- quint32 rgb = x << 8;
- quint32 a = x >> 24;
- return a | rgb;
+static inline QRgbaFloat32 interpolate_rgba32f(QRgbaFloat32 x, float alpha1, QRgbaFloat32 y, float alpha2)
+{
+ x = multiplyAlpha_rgba32f(x, alpha1);
+ y = multiplyAlpha_rgba32f(y, alpha2);
+ return QRgbaFloat32 { x.r + y.r, x.g + y.g, x.b + y.b, x.a + y.a };
}
-#else
-static Q_ALWAYS_INLINE quint32 RGBA2ARGB(quint32 x) {
- // RGBA8888 is ABGR32 on little endian.
- quint32 ag = x & 0xff00ff00;
- quint32 rg = x & 0x00ff00ff;
- return ag | (rg << 16) | (rg >> 16);
+#ifdef __SSE2__
+static inline __m128 Q_DECL_VECTORCALL interpolate_rgba32f(__m128 x, __m128 alpha1, __m128 y, __m128 alpha2)
+{
+ return _mm_add_ps(_mm_mul_ps(x, alpha1), _mm_mul_ps(y, alpha2));
}
+#endif
-static Q_ALWAYS_INLINE quint32 ARGB2RGBA(quint32 x) {
- return RGBA2ARGB(x);
-}
+static inline QRgbaFloat32 interpolate_4_pixels_rgba32f(const QRgbaFloat32 t[], const QRgbaFloat32 b[], uint distx, uint disty)
+{
+ constexpr float f = 1.0f / 65536.0f;
+ const float dx = distx * f;
+ const float dy = disty * f;
+ const float idx = 1.0f - dx;
+ const float idy = 1.0f - dy;
+#ifdef __SSE2__
+ const __m128 vtl = _mm_load_ps((const float *)&t[0]);
+ const __m128 vtr = _mm_load_ps((const float *)&t[1]);
+ const __m128 vbl = _mm_load_ps((const float *)&b[0]);
+ const __m128 vbr = _mm_load_ps((const float *)&b[1]);
+
+ const __m128 vdx = _mm_set1_ps(dx);
+ const __m128 vidx = _mm_set1_ps(idx);
+ __m128 vt = interpolate_rgba32f(vtl, vidx, vtr, vdx);
+ __m128 vb = interpolate_rgba32f(vbl, vidx, vbr, vdx);
+ const __m128 vdy = _mm_set1_ps(dy);
+ const __m128 vidy = _mm_set1_ps(idy);
+ vt = interpolate_rgba32f(vt, vidy, vb, vdy);
+ QRgbaFloat32 res;
+ _mm_store_ps((float*)&res, vt);
+ return res;
+#else
+ QRgbaFloat32 xtop = interpolate_rgba32f(t[0], idx, t[1], dx);
+ QRgbaFloat32 xbot = interpolate_rgba32f(b[0], idx, b[1], dx);
+ xtop = interpolate_rgba32f(xtop, idy, xbot, dy);
+ return xtop;
#endif
+}
+#endif // QT_CONFIG(raster_fp)
-static Q_ALWAYS_INLINE uint BYTE_MUL_RGB16(uint x, uint a) {
+static inline uint BYTE_MUL_RGB16(uint x, uint a) {
a += 1;
uint t = (((x & 0x07e0)*a) >> 8) & 0x07e0;
t |= (((x & 0xf81f)*(a>>2)) >> 6) & 0xf81f;
return t;
}
-static Q_ALWAYS_INLINE uint BYTE_MUL_RGB16_32(uint x, uint a) {
+static inline uint BYTE_MUL_RGB16_32(uint x, uint a) {
uint t = (((x & 0xf81f07e0) >> 5)*a) & 0xf81f07e0;
t |= (((x & 0x07e0f81f)*a) >> 5) & 0x07e0f81f;
return t;
}
// qt_div_255 is a fast rounded division by 255 using an approximation that is accurate for all positive 16-bit integers
-static Q_DECL_CONSTEXPR Q_ALWAYS_INLINE int qt_div_255(int x) { return (x + (x>>8) + 0x80) >> 8; }
-static Q_DECL_CONSTEXPR Q_ALWAYS_INLINE uint qt_div_257_floor(uint x) { return (x - (x >> 8)) >> 8; }
-static Q_DECL_CONSTEXPR Q_ALWAYS_INLINE uint qt_div_257(uint x) { return qt_div_257_floor(x + 128); }
-static Q_DECL_CONSTEXPR Q_ALWAYS_INLINE uint qt_div_65535(uint x) { return (x + (x>>16) + 0x8000U) >> 16; }
-
-static Q_ALWAYS_INLINE uint qAlphaRgb30(uint c)
-{
- uint a = c >> 30;
- a |= a << 2;
- a |= a << 4;
- return a;
-}
+static constexpr inline int qt_div_255(int x) { return (x + (x>>8) + 0x80) >> 8; }
+static constexpr inline uint qt_div_257_floor(uint x) { return (x - (x >> 8)) >> 8; }
+static constexpr inline uint qt_div_257(uint x) { return qt_div_257_floor(x + 128); }
+static constexpr inline uint qt_div_65535(uint x) { return (x + (x>>16) + 0x8000U) >> 16; }
template <class T> inline void qt_memfill_template(T *dest, T color, qsizetype count)
{
@@ -978,214 +962,6 @@ inline QRgb qConvertRgb16To32(uint c)
| ((((c) << 8) & 0xf80000) | (((c) << 3) & 0x70000));
}
-enum QtPixelOrder {
- PixelOrderRGB,
- PixelOrderBGR
-};
-
-template<enum QtPixelOrder> inline uint qConvertArgb32ToA2rgb30(QRgb);
-
-template<enum QtPixelOrder> inline uint qConvertRgb32ToRgb30(QRgb);
-
-template<enum QtPixelOrder> inline QRgb qConvertA2rgb30ToArgb32(uint c);
-
-// A combined unpremultiply and premultiply with new simplified alpha.
-// Needed when alpha loses precision relative to other colors during conversion (ARGB32 -> A2RGB30).
-template<unsigned int Shift>
-inline QRgb qRepremultiply(QRgb p)
-{
- const uint alpha = qAlpha(p);
- if (alpha == 255 || alpha == 0)
- return p;
- p = qUnpremultiply(p);
- Q_CONSTEXPR uint mult = 255 / (255 >> Shift);
- const uint newAlpha = mult * (alpha >> Shift);
- p = (p & ~0xff000000) | (newAlpha<<24);
- return qPremultiply(p);
-}
-
-template<unsigned int Shift>
-inline QRgba64 qRepremultiply(QRgba64 p)
-{
- const uint alpha = p.alpha();
- if (alpha == 65535 || alpha == 0)
- return p;
- p = p.unpremultiplied();
- Q_CONSTEXPR uint mult = 65535 / (65535 >> Shift);
- p.setAlpha(mult * (alpha >> Shift));
- return p.premultiplied();
-}
-
-template<>
-inline uint qConvertArgb32ToA2rgb30<PixelOrderBGR>(QRgb c)
-{
- c = qRepremultiply<6>(c);
- return (c & 0xc0000000)
- | (((c << 22) & 0x3fc00000) | ((c << 14) & 0x00300000))
- | (((c << 4) & 0x000ff000) | ((c >> 4) & 0x00000c00))
- | (((c >> 14) & 0x000003fc) | ((c >> 22) & 0x00000003));
-}
-
-template<>
-inline uint qConvertArgb32ToA2rgb30<PixelOrderRGB>(QRgb c)
-{
- c = qRepremultiply<6>(c);
- return (c & 0xc0000000)
- | (((c << 6) & 0x3fc00000) | ((c >> 2) & 0x00300000))
- | (((c << 4) & 0x000ff000) | ((c >> 4) & 0x00000c00))
- | (((c << 2) & 0x000003fc) | ((c >> 6) & 0x00000003));
-}
-
-template<>
-inline uint qConvertRgb32ToRgb30<PixelOrderBGR>(QRgb c)
-{
- return 0xc0000000
- | (((c << 22) & 0x3fc00000) | ((c << 14) & 0x00300000))
- | (((c << 4) & 0x000ff000) | ((c >> 4) & 0x00000c00))
- | (((c >> 14) & 0x000003fc) | ((c >> 22) & 0x00000003));
-}
-
-template<>
-inline uint qConvertRgb32ToRgb30<PixelOrderRGB>(QRgb c)
-{
- return 0xc0000000
- | (((c << 6) & 0x3fc00000) | ((c >> 2) & 0x00300000))
- | (((c << 4) & 0x000ff000) | ((c >> 4) & 0x00000c00))
- | (((c << 2) & 0x000003fc) | ((c >> 6) & 0x00000003));
-}
-
-template<>
-inline QRgb qConvertA2rgb30ToArgb32<PixelOrderBGR>(uint c)
-{
- uint a = c >> 30;
- a |= a << 2;
- a |= a << 4;
- return (a << 24)
- | ((c << 14) & 0x00ff0000)
- | ((c >> 4) & 0x0000ff00)
- | ((c >> 22) & 0x000000ff);
-}
-
-template<>
-inline QRgb qConvertA2rgb30ToArgb32<PixelOrderRGB>(uint c)
-{
- uint a = c >> 30;
- a |= a << 2;
- a |= a << 4;
- return (a << 24)
- | ((c >> 6) & 0x00ff0000)
- | ((c >> 4) & 0x0000ff00)
- | ((c >> 2) & 0x000000ff);
-}
-
-template<enum QtPixelOrder> inline QRgba64 qConvertA2rgb30ToRgb64(uint rgb);
-
-template<>
-inline QRgba64 qConvertA2rgb30ToRgb64<PixelOrderBGR>(uint rgb)
-{
- quint16 alpha = rgb >> 30;
- quint16 blue = (rgb >> 20) & 0x3ff;
- quint16 green = (rgb >> 10) & 0x3ff;
- quint16 red = rgb & 0x3ff;
- // Expand the range.
- alpha |= (alpha << 2);
- alpha |= (alpha << 4);
- alpha |= (alpha << 8);
- red = (red << 6) | (red >> 4);
- green = (green << 6) | (green >> 4);
- blue = (blue << 6) | (blue >> 4);
- return qRgba64(red, green, blue, alpha);
-}
-
-template<>
-inline QRgba64 qConvertA2rgb30ToRgb64<PixelOrderRGB>(uint rgb)
-{
- quint16 alpha = rgb >> 30;
- quint16 red = (rgb >> 20) & 0x3ff;
- quint16 green = (rgb >> 10) & 0x3ff;
- quint16 blue = rgb & 0x3ff;
- // Expand the range.
- alpha |= (alpha << 2);
- alpha |= (alpha << 4);
- alpha |= (alpha << 8);
- red = (red << 6) | (red >> 4);
- green = (green << 6) | (green >> 4);
- blue = (blue << 6) | (blue >> 4);
- return qRgba64(red, green, blue, alpha);
-}
-
-template<enum QtPixelOrder> inline unsigned int qConvertRgb64ToRgb30(QRgba64);
-
-template<>
-inline unsigned int qConvertRgb64ToRgb30<PixelOrderBGR>(QRgba64 c)
-{
- c = qRepremultiply<14>(c);
- const uint a = c.alpha() >> 14;
- const uint r = c.red() >> 6;
- const uint g = c.green() >> 6;
- const uint b = c.blue() >> 6;
- return (a << 30) | (b << 20) | (g << 10) | r;
-}
-
-template<>
-inline unsigned int qConvertRgb64ToRgb30<PixelOrderRGB>(QRgba64 c)
-{
- c = qRepremultiply<14>(c);
- const uint a = c.alpha() >> 14;
- const uint r = c.red() >> 6;
- const uint g = c.green() >> 6;
- const uint b = c.blue() >> 6;
- return (a << 30) | (r << 20) | (g << 10) | b;
-}
-
-inline uint qRgbSwapRgb30(uint c)
-{
- const uint ag = c & 0xc00ffc00;
- const uint rb = c & 0x3ff003ff;
- return ag | (rb << 20) | (rb >> 20);
-}
-
-inline int qRed565(quint16 rgb) {
- const int r = (rgb & 0xf800);
- return (r >> 8) | (r >> 13);
-}
-
-inline int qGreen565(quint16 rgb) {
- const int g = (rgb & 0x07e0);
- return (g >> 3) | (g >> 9);
-}
-
-inline int qBlue565(quint16 rgb) {
- const int b = (rgb & 0x001f);
- return (b << 3) | (b >> 2);
-}
-
-// We manually unalias the variables to make sure the compiler
-// fully optimizes both aliased and unaliased cases.
-#define UNALIASED_CONVERSION_LOOP(buffer, src, count, conversion) \
- if (src == buffer) { \
- for (int i = 0; i < count; ++i) \
- buffer[i] = conversion(buffer[i]); \
- } else { \
- for (int i = 0; i < count; ++i) \
- buffer[i] = conversion(src[i]); \
- }
-
-
-static Q_ALWAYS_INLINE const uint *qt_convertARGB32ToARGB32PM(uint *buffer, const uint *src, int count)
-{
- UNALIASED_CONVERSION_LOOP(buffer, src, count, qPremultiply);
- return buffer;
-}
-
-static Q_ALWAYS_INLINE const uint *qt_convertRGBA8888ToARGB32PM(uint *buffer, const uint *src, int count)
-{
- UNALIASED_CONVERSION_LOOP(buffer, src, count, [](uint s) { return qPremultiply(RGBA2ARGB(s));});
- return buffer;
-}
-
-template<bool RGBA> void qt_convertRGBA64ToARGB32(uint *dst, const QRgba64 *src, int count);
-
const uint qt_bayer_matrix[16][16] = {
{ 0x1, 0xc0, 0x30, 0xf0, 0xc, 0xcc, 0x3c, 0xfc,
0x3, 0xc3, 0x33, 0xf3, 0xf, 0xcf, 0x3f, 0xff},
@@ -1250,7 +1026,7 @@ inline uint comp_func_Plus_one_pixel(uint d, const uint s)
#undef AMIX
// must be multiple of 4 for easier SIMD implementations
-static Q_CONSTEXPR int BufferSize = 2048;
+static constexpr int BufferSize = 2048;
// A buffer of intermediate results used by simple bilinear scaling.
struct IntermediateBuffer
@@ -1265,61 +1041,6 @@ struct IntermediateBuffer
quint32 buffer_ag[BufferSize+2];
};
-struct QDitherInfo {
- int x;
- int y;
-};
-
-typedef const uint *(QT_FASTCALL *FetchAndConvertPixelsFunc)(uint *buffer, const uchar *src, int index, int count,
- const QVector<QRgb> *clut, QDitherInfo *dither);
-typedef void (QT_FASTCALL *ConvertAndStorePixelsFunc)(uchar *dest, const uint *src, int index, int count,
- const QVector<QRgb> *clut, QDitherInfo *dither);
-
-typedef const QRgba64 *(QT_FASTCALL *FetchAndConvertPixelsFunc64)(QRgba64 *buffer, const uchar *src, int index, int count,
- const QVector<QRgb> *clut, QDitherInfo *dither);
-typedef void (QT_FASTCALL *ConvertAndStorePixelsFunc64)(uchar *dest, const QRgba64 *src, int index, int count,
- const QVector<QRgb> *clut, QDitherInfo *dither);
-
-typedef void (QT_FASTCALL *ConvertFunc)(uint *buffer, int count, const QVector<QRgb> *clut);
-typedef void (QT_FASTCALL *Convert64Func)(quint64 *buffer, int count, const QVector<QRgb> *clut);
-typedef const QRgba64 *(QT_FASTCALL *ConvertTo64Func)(QRgba64 *buffer, const uint *src, int count,
- const QVector<QRgb> *clut, QDitherInfo *dither);
-typedef void (QT_FASTCALL *RbSwapFunc)(uchar *dst, const uchar *src, int count);
-
-
-struct QPixelLayout
-{
- // Bits per pixel
- enum BPP {
- BPPNone,
- BPP1MSB,
- BPP1LSB,
- BPP8,
- BPP16,
- BPP24,
- BPP32,
- BPP64,
- BPPCount
- };
-
- bool hasAlphaChannel;
- bool premultiplied;
- BPP bpp;
- RbSwapFunc rbSwap;
- ConvertFunc convertToARGB32PM;
- ConvertTo64Func convertToRGBA64PM;
- FetchAndConvertPixelsFunc fetchToARGB32PM;
- FetchAndConvertPixelsFunc64 fetchToRGBA64PM;
- ConvertAndStorePixelsFunc storeFromARGB32PM;
- ConvertAndStorePixelsFunc storeFromRGB32;
-};
-
-extern ConvertAndStorePixelsFunc64 qStoreFromRGBA64PM[QImage::NImageFormats];
-
-extern QPixelLayout qPixelLayouts[QImage::NImageFormats];
-
-extern MemRotateFunc qMemRotateFunctions[QPixelLayout::BPPCount][3];
-
QT_END_NAMESPACE
#endif // QDRAWHELPER_P_H
diff --git a/src/gui/painting/qdrawhelper_sse2.cpp b/src/gui/painting/qdrawhelper_sse2.cpp
index c82f41ec88..79590534f3 100644
--- a/src/gui/painting/qdrawhelper_sse2.cpp
+++ b/src/gui/painting/qdrawhelper_sse2.cpp
@@ -1,42 +1,6 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Copyright (C) 2016 Intel Corporation.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the QtGui module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// Copyright (C) 2016 Intel Corporation.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#include <private/qdrawhelper_x86_p.h>
@@ -233,7 +197,7 @@ void QT_FASTCALL comp_func_Source_sse2(uint *dst, const uint *src, int length, u
}
}
-#ifndef __AVX2__
+#ifndef __haswell__
static Q_NEVER_INLINE
void Q_DECL_VECTORCALL qt_memfillXX_aligned(void *dest, __m128i value128, quintptr bytecount)
{
@@ -317,7 +281,36 @@ void qt_memfill32_sse2(quint32 *dest, quint32 value, qsizetype count)
qt_memfillXX_aligned(dest, _mm_set1_epi32(value), count * sizeof(quint32));
}
-#endif // !__AVX2__
+#endif // !__haswell__
+
+void QT_FASTCALL comp_func_solid_Source_sse2(uint *destPixels, int length, uint color, uint const_alpha)
+{
+ if (const_alpha == 255) {
+ qt_memfill32(destPixels, color, length);
+ } else {
+ const quint32 ialpha = 255 - const_alpha;
+ color = BYTE_MUL(color, const_alpha);
+ int x = 0;
+
+ quint32 *dst = (quint32 *) destPixels;
+ const __m128i colorVector = _mm_set1_epi32(color);
+ const __m128i colorMask = _mm_set1_epi32(0x00ff00ff);
+ const __m128i half = _mm_set1_epi16(0x80);
+ const __m128i iAlphaVector = _mm_set1_epi16(ialpha);
+
+ ALIGNMENT_PROLOGUE_16BYTES(dst, x, length)
+ destPixels[x] = color + BYTE_MUL(destPixels[x], ialpha);
+
+ for (; x < length-3; x += 4) {
+ __m128i dstVector = _mm_load_si128((__m128i *)&dst[x]);
+ BYTE_MUL_SSE2(dstVector, dstVector, iAlphaVector, colorMask, half);
+ dstVector = _mm_add_epi8(colorVector, dstVector);
+ _mm_store_si128((__m128i *)&dst[x], dstVector);
+ }
+ SIMD_EPILOGUE(x, length, 3)
+ destPixels[x] = color + BYTE_MUL(destPixels[x], ialpha);
+ }
+}
void QT_FASTCALL comp_func_solid_SourceOver_sse2(uint *destPixels, int length, uint color, uint const_alpha)
{
@@ -368,7 +361,7 @@ void qt_bitmapblit32_sse2_base(QRasterBuffer *rasterBuffer, int x, int y,
0x04040404, 0x08080808);
const __m128i maskadd2 = _mm_set_epi32(0x7f7f7f7f, 0x7e7e7e7e,
0x7c7c7c7c, 0x78787878);
- while (height--) {
+ while (--height >= 0) {
for (int x = 0; x < width; x += 8) {
const quint8 s = src[x >> 3];
if (!s)
@@ -387,7 +380,7 @@ void qt_bitmapblit32_sse2_base(QRasterBuffer *rasterBuffer, int x, int y,
src += stride;
}
} else {
- while (height--) {
+ while (--height >= 0) {
const quint8 s = *src;
if (s) {
__m128i mask1 = _mm_set1_epi8(s);
@@ -430,7 +423,7 @@ QT_WARNING_DISABLE_MSVC(4309) // truncation of constant value
const __m128i maskadd = _mm_set_epi16(0x7f7f, 0x7e7e, 0x7c7c, 0x7878,
0x7070, 0x6060, 0x4040, 0x0000);
- while (height--) {
+ while (--height >= 0) {
for (int x = 0; x < width; x += 8) {
const quint8 s = src[x >> 3];
if (!s)
@@ -504,66 +497,42 @@ void qt_scale_image_argb32_on_argb32_sse2(uchar *destPixels, int dbpl,
return qt_scale_image_argb32_on_argb32(destPixels, dbpl, srcPixels, sbpl, srch, targetRect, sourceRect, clip, const_alpha);
}
- qreal sx = targetRect.width() / (qreal) sourceRect.width();
- qreal sy = targetRect.height() / (qreal) sourceRect.height();
-
- int ix = 0x00010000 / sx;
- int iy = 0x00010000 / sy;
+ qreal sx = sourceRect.width() / (qreal)targetRect.width();
+ qreal sy = sourceRect.height() / (qreal)targetRect.height();
- int cx1 = clip.x();
- int cx2 = clip.x() + clip.width();
- int cy1 = clip.top();
- int cy2 = clip.y() + clip.height();
+ const int ix = 0x00010000 * sx;
+ const int iy = 0x00010000 * sy;
- int tx1 = qRound(targetRect.left());
- int tx2 = qRound(targetRect.right());
- int ty1 = qRound(targetRect.top());
- int ty2 = qRound(targetRect.bottom());
-
- if (tx2 < tx1)
- qSwap(tx2, tx1);
- if (ty2 < ty1)
- qSwap(ty2, ty1);
-
- if (tx1 < cx1)
- tx1 = cx1;
- if (tx2 >= cx2)
- tx2 = cx2;
-
- if (tx1 >= tx2)
+ QRect tr = targetRect.normalized().toRect();
+ tr = tr.intersected(clip);
+ if (tr.isEmpty())
return;
-
- if (ty1 < cy1)
- ty1 = cy1;
- if (ty2 >= cy2)
- ty2 = cy2;
- if (ty1 >= ty2)
- return;
-
- int h = ty2 - ty1;
- int w = tx2 - tx1;
+ const int tx1 = tr.left();
+ const int ty1 = tr.top();
+ int h = tr.height();
+ int w = tr.width();
quint32 basex;
quint32 srcy;
if (sx < 0) {
- int dstx = qFloor((tx1 + qreal(0.5) - targetRect.right()) * ix) + 1;
+ int dstx = qFloor((tx1 + qreal(0.5) - targetRect.right()) * sx * 65536) + 1;
basex = quint32(sourceRect.right() * 65536) + dstx;
} else {
- int dstx = qCeil((tx1 + qreal(0.5) - targetRect.left()) * ix) - 1;
+ int dstx = qCeil((tx1 + qreal(0.5) - targetRect.left()) * sx * 65536) - 1;
basex = quint32(sourceRect.left() * 65536) + dstx;
}
if (sy < 0) {
- int dsty = qFloor((ty1 + qreal(0.5) - targetRect.bottom()) * iy) + 1;
+ int dsty = qFloor((ty1 + qreal(0.5) - targetRect.bottom()) * sy * 65536) + 1;
srcy = quint32(sourceRect.bottom() * 65536) + dsty;
} else {
- int dsty = qCeil((ty1 + qreal(0.5) - targetRect.top()) * iy) - 1;
+ int dsty = qCeil((ty1 + qreal(0.5) - targetRect.top()) * sy * 65536) - 1;
srcy = quint32(sourceRect.top() * 65536) + dsty;
}
quint32 *dst = ((quint32 *) (destPixels + ty1 * dbpl)) + tx1;
- const __m128i nullVector = _mm_set1_epi32(0);
+ const __m128i nullVector = _mm_setzero_si128();
const __m128i half = _mm_set1_epi16(0x80);
const __m128i one = _mm_set1_epi16(0xff);
const __m128i colorMask = _mm_set1_epi32(0x00ff00ff);
@@ -589,7 +558,7 @@ void qt_scale_image_argb32_on_argb32_sse2(uchar *destPixels, int dbpl,
if (xend < 0 || xend >= (int)(sbpl/sizeof(quint32)))
--w;
- while (h--) {
+ while (--h >= 0) {
const uint *src = (const quint32 *) (srcPixels + (srcy >> 16) * sbpl);
int srcx = basex;
int x = 0;
@@ -602,13 +571,14 @@ void qt_scale_image_argb32_on_argb32_sse2(uchar *destPixels, int dbpl,
__m128i srcxVector = _mm_set_epi32(srcx, srcx + ix, srcx + ix + ix, srcx + ix + ix + ix);
- for (; x<w - 3; x += 4) {
- union Vect_buffer { __m128i vect; quint32 i[4]; };
- Vect_buffer addr;
- addr.vect = _mm_srli_epi32(srcxVector, 16);
+ for (; x < (w - 3); x += 4) {
+ const int idx0 = _mm_extract_epi16(srcxVector, 1);
+ const int idx1 = _mm_extract_epi16(srcxVector, 3);
+ const int idx2 = _mm_extract_epi16(srcxVector, 5);
+ const int idx3 = _mm_extract_epi16(srcxVector, 7);
srcxVector = _mm_add_epi32(srcxVector, ixVector);
- const __m128i srcVector = _mm_set_epi32(src[addr.i[0]], src[addr.i[1]], src[addr.i[2]], src[addr.i[3]]);
+ const __m128i srcVector = _mm_set_epi32(src[idx0], src[idx1], src[idx2], src[idx3]);
BLEND_SOURCE_OVER_ARGB32_SSE2_helper(dst, srcVector, nullVector, half, one, colorMask, alphaMask);
}
diff --git a/src/gui/painting/qdrawhelper_sse4.cpp b/src/gui/painting/qdrawhelper_sse4.cpp
index 68d887ae6d..a7b4e6ba76 100644
--- a/src/gui/painting/qdrawhelper_sse4.cpp
+++ b/src/gui/painting/qdrawhelper_sse4.cpp
@@ -1,51 +1,16 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the QtGui module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#include <private/qdrawhelper_p.h>
#include <private/qdrawingprimitive_sse2_p.h>
#include <private/qpaintengine_raster_p.h>
+#include <private/qpixellayout_p.h>
#if defined(QT_COMPILER_SUPPORTS_SSE4_1)
QT_BEGIN_NAMESPACE
-#ifndef __AVX2__
+#ifndef __haswell__
template<bool RGBA>
static void convertARGBToARGB32PM_sse4(uint *buffer, const uint *src, int count)
{
@@ -141,7 +106,7 @@ static void convertARGBToRGBA64PM_sse4(QRgba64 *buffer, const uint *src, int cou
buffer[i] = QRgba64::fromArgb32(s).premultiplied();
}
}
-#endif // __AVX2__
+#endif // __haswell__
static inline __m128 Q_DECL_VECTORCALL reciprocal_mul_ps(__m128 a, float mul)
{
@@ -326,83 +291,167 @@ static inline void convertARGBFromRGBA64PM_sse4(uint *buffer, const QRgba64 *src
}
}
-#ifndef __AVX2__
-void QT_FASTCALL convertARGB32ToARGB32PM_sse4(uint *buffer, int count, const QVector<QRgb> *)
+template<bool mask>
+static inline void convertRGBA64FromRGBA64PM_sse4(QRgba64 *buffer, const QRgba64 *src, int count)
+{
+ int i = 0;
+ if ((_MM_GET_EXCEPTION_MASK() & _MM_MASK_INVALID) == 0) {
+ for (; i < count; ++i) {
+ QRgba64 v = src[i].unpremultiplied();
+ if (mask)
+ v.setAlpha(65535);
+ buffer[i] = v;
+ }
+ return;
+ }
+ const __m128i alphaMask = _mm_set1_epi64x(qint64(Q_UINT64_C(0xffff) << 48));
+ const __m128i zero = _mm_setzero_si128();
+
+ for (; i < count - 3; i += 4) {
+ __m128i srcVector1 = _mm_loadu_si128((const __m128i *)&src[i + 0]);
+ __m128i srcVector2 = _mm_loadu_si128((const __m128i *)&src[i + 2]);
+ bool transparent1 = _mm_testz_si128(srcVector1, alphaMask);
+ bool opaque1 = _mm_testc_si128(srcVector1, alphaMask);
+ bool transparent2 = _mm_testz_si128(srcVector2, alphaMask);
+ bool opaque2 = _mm_testc_si128(srcVector2, alphaMask);
+
+ if (!(transparent1 && transparent2)) {
+ if (!(opaque1 && opaque2)) {
+ __m128i srcVector1Alpha = _mm_srli_epi64(srcVector1, 48);
+ __m128i srcVector2Alpha = _mm_srli_epi64(srcVector2, 48);
+ __m128i srcVectorAlpha = _mm_packus_epi32(srcVector1Alpha, srcVector2Alpha);
+ const __m128 a = _mm_cvtepi32_ps(srcVectorAlpha);
+ const __m128 ia = reciprocal_mul_ps(a, 65535.0f);
+ __m128i src1 = _mm_unpacklo_epi16(srcVector1, zero);
+ __m128i src2 = _mm_unpackhi_epi16(srcVector1, zero);
+ __m128i src3 = _mm_unpacklo_epi16(srcVector2, zero);
+ __m128i src4 = _mm_unpackhi_epi16(srcVector2, zero);
+ __m128 ia1 = _mm_shuffle_ps(ia, ia, _MM_SHUFFLE(0, 0, 0, 0));
+ __m128 ia2 = _mm_shuffle_ps(ia, ia, _MM_SHUFFLE(1, 1, 1, 1));
+ __m128 ia3 = _mm_shuffle_ps(ia, ia, _MM_SHUFFLE(2, 2, 2, 2));
+ __m128 ia4 = _mm_shuffle_ps(ia, ia, _MM_SHUFFLE(3, 3, 3, 3));
+ src1 = _mm_cvtps_epi32(_mm_mul_ps(_mm_cvtepi32_ps(src1), ia1));
+ src2 = _mm_cvtps_epi32(_mm_mul_ps(_mm_cvtepi32_ps(src2), ia2));
+ src3 = _mm_cvtps_epi32(_mm_mul_ps(_mm_cvtepi32_ps(src3), ia3));
+ src4 = _mm_cvtps_epi32(_mm_mul_ps(_mm_cvtepi32_ps(src4), ia4));
+ src1 = _mm_packus_epi32(src1, src2);
+ src3 = _mm_packus_epi32(src3, src4);
+ // Handle potential alpha == 0 values:
+ __m128i srcVector1AlphaMask = _mm_cmpeq_epi64(srcVector1Alpha, zero);
+ __m128i srcVector2AlphaMask = _mm_cmpeq_epi64(srcVector2Alpha, zero);
+ src1 = _mm_andnot_si128(srcVector1AlphaMask, src1);
+ src3 = _mm_andnot_si128(srcVector2AlphaMask, src3);
+ // Fixup alpha values:
+ if (mask) {
+ src1 = _mm_or_si128(src1, alphaMask);
+ src3 = _mm_or_si128(src3, alphaMask);
+ } else {
+ src1 = _mm_blendv_epi8(src1, srcVector1, alphaMask);
+ src3 = _mm_blendv_epi8(src3, srcVector2, alphaMask);
+ }
+ _mm_storeu_si128((__m128i *)&buffer[i + 0], src1);
+ _mm_storeu_si128((__m128i *)&buffer[i + 2], src3);
+ } else {
+ if (mask) {
+ srcVector1 = _mm_or_si128(srcVector1, alphaMask);
+ srcVector2 = _mm_or_si128(srcVector2, alphaMask);
+ }
+ if (mask || src != buffer) {
+ _mm_storeu_si128((__m128i *)&buffer[i + 0], srcVector1);
+ _mm_storeu_si128((__m128i *)&buffer[i + 2], srcVector2);
+ }
+ }
+ } else {
+ _mm_storeu_si128((__m128i *)&buffer[i + 0], zero);
+ _mm_storeu_si128((__m128i *)&buffer[i + 2], zero);
+ }
+ }
+
+ SIMD_EPILOGUE(i, count, 3) {
+ QRgba64 v = src[i].unpremultiplied();
+ if (mask)
+ v.setAlpha(65535);
+ buffer[i] = v;
+ }
+}
+
+#ifndef __haswell__
+void QT_FASTCALL convertARGB32ToARGB32PM_sse4(uint *buffer, int count, const QList<QRgb> *)
{
convertARGBToARGB32PM_sse4<false>(buffer, buffer, count);
}
-void QT_FASTCALL convertRGBA8888ToARGB32PM_sse4(uint *buffer, int count, const QVector<QRgb> *)
+void QT_FASTCALL convertRGBA8888ToARGB32PM_sse4(uint *buffer, int count, const QList<QRgb> *)
{
convertARGBToARGB32PM_sse4<true>(buffer, buffer, count);
}
const QRgba64 * QT_FASTCALL convertARGB32ToRGBA64PM_sse4(QRgba64 *buffer, const uint *src, int count,
- const QVector<QRgb> *, QDitherInfo *)
+ const QList<QRgb> *, QDitherInfo *)
{
convertARGBToRGBA64PM_sse4<false>(buffer, src, count);
return buffer;
}
const QRgba64 * QT_FASTCALL convertRGBA8888ToRGBA64PM_sse4(QRgba64 *buffer, const uint *src, int count,
- const QVector<QRgb> *, QDitherInfo *)
+ const QList<QRgb> *, QDitherInfo *)
{
convertARGBToRGBA64PM_sse4<true>(buffer, src, count);
return buffer;
}
const uint *QT_FASTCALL fetchARGB32ToARGB32PM_sse4(uint *buffer, const uchar *src, int index, int count,
- const QVector<QRgb> *, QDitherInfo *)
+ const QList<QRgb> *, QDitherInfo *)
{
convertARGBToARGB32PM_sse4<false>(buffer, reinterpret_cast<const uint *>(src) + index, count);
return buffer;
}
const uint *QT_FASTCALL fetchRGBA8888ToARGB32PM_sse4(uint *buffer, const uchar *src, int index, int count,
- const QVector<QRgb> *, QDitherInfo *)
+ const QList<QRgb> *, QDitherInfo *)
{
convertARGBToARGB32PM_sse4<true>(buffer, reinterpret_cast<const uint *>(src) + index, count);
return buffer;
}
const QRgba64 *QT_FASTCALL fetchARGB32ToRGBA64PM_sse4(QRgba64 *buffer, const uchar *src, int index, int count,
- const QVector<QRgb> *, QDitherInfo *)
+ const QList<QRgb> *, QDitherInfo *)
{
convertARGBToRGBA64PM_sse4<false>(buffer, reinterpret_cast<const uint *>(src) + index, count);
return buffer;
}
const QRgba64 *QT_FASTCALL fetchRGBA8888ToRGBA64PM_sse4(QRgba64 *buffer, const uchar *src, int index, int count,
- const QVector<QRgb> *, QDitherInfo *)
+ const QList<QRgb> *, QDitherInfo *)
{
convertARGBToRGBA64PM_sse4<true>(buffer, reinterpret_cast<const uint *>(src) + index, count);
return buffer;
}
-#endif // __AVX2__
+#endif // __haswell__
void QT_FASTCALL storeRGB32FromARGB32PM_sse4(uchar *dest, const uint *src, int index, int count,
- const QVector<QRgb> *, QDitherInfo *)
+ const QList<QRgb> *, QDitherInfo *)
{
uint *d = reinterpret_cast<uint *>(dest) + index;
convertARGBFromARGB32PM_sse4<false,true>(d, src, count);
}
void QT_FASTCALL storeARGB32FromARGB32PM_sse4(uchar *dest, const uint *src, int index, int count,
- const QVector<QRgb> *, QDitherInfo *)
+ const QList<QRgb> *, QDitherInfo *)
{
uint *d = reinterpret_cast<uint *>(dest) + index;
convertARGBFromARGB32PM_sse4<false,false>(d, src, count);
}
void QT_FASTCALL storeRGBA8888FromARGB32PM_sse4(uchar *dest, const uint *src, int index, int count,
- const QVector<QRgb> *, QDitherInfo *)
+ const QList<QRgb> *, QDitherInfo *)
{
uint *d = reinterpret_cast<uint *>(dest) + index;
convertARGBFromARGB32PM_sse4<true,false>(d, src, count);
}
void QT_FASTCALL storeRGBXFromARGB32PM_sse4(uchar *dest, const uint *src, int index, int count,
- const QVector<QRgb> *, QDitherInfo *)
+ const QList<QRgb> *, QDitherInfo *)
{
uint *d = reinterpret_cast<uint *>(dest) + index;
convertARGBFromARGB32PM_sse4<true,true>(d, src, count);
@@ -410,13 +459,20 @@ void QT_FASTCALL storeRGBXFromARGB32PM_sse4(uchar *dest, const uint *src, int in
template<QtPixelOrder PixelOrder>
void QT_FASTCALL storeA2RGB30PMFromARGB32PM_sse4(uchar *dest, const uint *src, int index, int count,
- const QVector<QRgb> *, QDitherInfo *)
+ const QList<QRgb> *, QDitherInfo *)
{
uint *d = reinterpret_cast<uint *>(dest) + index;
for (int i = 0; i < count; ++i)
d[i] = qConvertArgb32ToA2rgb30_sse4<PixelOrder>(src[i]);
}
+template
+void QT_FASTCALL storeA2RGB30PMFromARGB32PM_sse4<PixelOrderBGR>(uchar *dest, const uint *src, int index, int count,
+ const QList<QRgb> *, QDitherInfo *);
+template
+void QT_FASTCALL storeA2RGB30PMFromARGB32PM_sse4<PixelOrderRGB>(uchar *dest, const uint *src, int index, int count,
+ const QList<QRgb> *, QDitherInfo *);
+
#if QT_CONFIG(raster_64bit)
void QT_FASTCALL destStore64ARGB32_sse4(QRasterBuffer *rasterBuffer, int x, int y, const QRgba64 *buffer, int length)
{
@@ -432,25 +488,95 @@ void QT_FASTCALL destStore64RGBA8888_sse4(QRasterBuffer *rasterBuffer, int x, in
#endif
void QT_FASTCALL storeARGB32FromRGBA64PM_sse4(uchar *dest, const QRgba64 *src, int index, int count,
- const QVector<QRgb> *, QDitherInfo *)
+ const QList<QRgb> *, QDitherInfo *)
{
uint *d = (uint*)dest + index;
convertARGBFromRGBA64PM_sse4<false>(d, src, count);
}
void QT_FASTCALL storeRGBA8888FromRGBA64PM_sse4(uchar *dest, const QRgba64 *src, int index, int count,
- const QVector<QRgb> *, QDitherInfo *)
+ const QList<QRgb> *, QDitherInfo *)
{
uint *d = (uint*)dest + index;
convertARGBFromRGBA64PM_sse4<true>(d, src, count);
}
-template
-void QT_FASTCALL storeA2RGB30PMFromARGB32PM_sse4<PixelOrderBGR>(uchar *dest, const uint *src, int index, int count,
- const QVector<QRgb> *, QDitherInfo *);
-template
-void QT_FASTCALL storeA2RGB30PMFromARGB32PM_sse4<PixelOrderRGB>(uchar *dest, const uint *src, int index, int count,
- const QVector<QRgb> *, QDitherInfo *);
+void QT_FASTCALL storeRGBA64FromRGBA64PM_sse4(uchar *dest, const QRgba64 *src, int index, int count,
+ const QList<QRgb> *, QDitherInfo *)
+{
+ QRgba64 *d = (QRgba64 *)dest + index;
+ convertRGBA64FromRGBA64PM_sse4<false>(d, src, count);
+}
+
+void QT_FASTCALL storeRGBx64FromRGBA64PM_sse4(uchar *dest, const QRgba64 *src, int index, int count,
+ const QList<QRgb> *, QDitherInfo *)
+{
+ QRgba64 *d = (QRgba64 *)dest + index;
+ convertRGBA64FromRGBA64PM_sse4<true>(d, src, count);
+}
+
+#if QT_CONFIG(raster_fp)
+const QRgbaFloat32 *QT_FASTCALL fetchRGBA32FToRGBA32F_sse4(QRgbaFloat32 *buffer, const uchar *src, int index, int count,
+ const QList<QRgb> *, QDitherInfo *)
+{
+ const QRgbaFloat32 *s = reinterpret_cast<const QRgbaFloat32 *>(src) + index;
+ for (int i = 0; i < count; ++i) {
+ __m128 vsf = _mm_load_ps(reinterpret_cast<const float *>(s + i));
+ __m128 vsa = _mm_shuffle_ps(vsf, vsf, _MM_SHUFFLE(3, 3, 3, 3));
+ vsf = _mm_mul_ps(vsf, vsa);
+ vsf = _mm_insert_ps(vsf, vsa, 0x30);
+ _mm_store_ps(reinterpret_cast<float *>(buffer + i), vsf);
+ }
+ return buffer;
+}
+
+void QT_FASTCALL storeRGBX32FFromRGBA32F_sse4(uchar *dest, const QRgbaFloat32 *src, int index, int count,
+ const QList<QRgb> *, QDitherInfo *)
+{
+ QRgbaFloat32 *d = reinterpret_cast<QRgbaFloat32 *>(dest) + index;
+ const __m128 zero = _mm_set_ps(1.0f, 0.0f, 0.0f, 0.0f);
+ for (int i = 0; i < count; ++i) {
+ __m128 vsf = _mm_load_ps(reinterpret_cast<const float *>(src + i));
+ const __m128 vsa = _mm_shuffle_ps(vsf, vsf, _MM_SHUFFLE(3, 3, 3, 3));
+ const float a = _mm_cvtss_f32(vsa);
+ if (a == 1.0f)
+ { }
+ else if (a == 0.0f)
+ vsf = zero;
+ else {
+ __m128 vsr = _mm_rcp_ps(vsa);
+ vsr = _mm_sub_ps(_mm_add_ps(vsr, vsr), _mm_mul_ps(vsr, _mm_mul_ps(vsr, vsa)));
+ vsf = _mm_mul_ps(vsf, vsr);
+ vsf = _mm_insert_ps(vsf, _mm_set_ss(1.0f), 0x30);
+ }
+ _mm_store_ps(reinterpret_cast<float *>(d + i), vsf);
+ }
+}
+
+void QT_FASTCALL storeRGBA32FFromRGBA32F_sse4(uchar *dest, const QRgbaFloat32 *src, int index, int count,
+ const QList<QRgb> *, QDitherInfo *)
+{
+ QRgbaFloat32 *d = reinterpret_cast<QRgbaFloat32 *>(dest) + index;
+ const __m128 zero = _mm_set1_ps(0.0f);
+ for (int i = 0; i < count; ++i) {
+ __m128 vsf = _mm_load_ps(reinterpret_cast<const float *>(src + i));
+ const __m128 vsa = _mm_shuffle_ps(vsf, vsf, _MM_SHUFFLE(3, 3, 3, 3));
+ const float a = _mm_cvtss_f32(vsa);
+ if (a == 1.0f)
+ { }
+ else if (a == 0.0f)
+ vsf = zero;
+ else {
+ __m128 vsr = _mm_rcp_ps(vsa);
+ vsr = _mm_sub_ps(_mm_add_ps(vsr, vsr), _mm_mul_ps(vsr, _mm_mul_ps(vsr, vsa)));
+ vsr = _mm_insert_ps(vsr, _mm_set_ss(1.0f), 0x30);
+ vsf = _mm_mul_ps(vsf, vsr);
+ }
+ _mm_store_ps(reinterpret_cast<float *>(d + i), vsf);
+ }
+}
+#endif
+
QT_END_NAMESPACE
diff --git a/src/gui/painting/qdrawhelper_ssse3.cpp b/src/gui/painting/qdrawhelper_ssse3.cpp
index a175b591dd..6e905c7f84 100644
--- a/src/gui/painting/qdrawhelper_ssse3.cpp
+++ b/src/gui/painting/qdrawhelper_ssse3.cpp
@@ -1,42 +1,6 @@
-/****************************************************************************
-**
-** Copyright (C) 2018 The Qt Company Ltd.
-** Copyright (C) 2018 Intel Corporation.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the QtGui module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2018 The Qt Company Ltd.
+// Copyright (C) 2018 Intel Corporation.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#include <private/qdrawhelper_x86_p.h>
@@ -47,7 +11,7 @@
QT_BEGIN_NAMESPACE
/* The instruction palignr uses direct arguments, so we have to generate the code fo the different
- shift (4, 8, 12). Checking the alignment inside the loop is unfortunatelly way too slow.
+ shift (4, 8, 12). Checking the alignment inside the loop is unfortunately way too slow.
*/
#define BLENDING_LOOP(palignrOffset, length)\
for (; x-minusOffsetToAlignSrcOn16Bytes < length-7; x += 4) { \
diff --git a/src/gui/painting/qdrawhelper_x86_p.h b/src/gui/painting/qdrawhelper_x86_p.h
index 5749d8c9fb..15773fe014 100644
--- a/src/gui/painting/qdrawhelper_x86_p.h
+++ b/src/gui/painting/qdrawhelper_x86_p.h
@@ -1,41 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the QtGui module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#ifndef QDRAWHELPER_X86_P_H
#define QDRAWHELPER_X86_P_H
@@ -77,9 +41,6 @@ void qt_blend_rgb32_on_rgb32_sse2(uchar *destPixels, int dbpl,
int w, int h,
int const_alpha);
-extern CompositionFunction qt_functionForMode_SSE2[];
-extern CompositionFunctionSolid qt_functionForModeSolid_SSE2[];
-
void qt_memfill64_avx2(quint64 *dest, quint64 value, qsizetype count);
void qt_memfill32_avx2(quint32 *dest, quint32 value, qsizetype count);
#endif // __SSE2__
diff --git a/src/gui/painting/qdrawingprimitive_sse2_p.h b/src/gui/painting/qdrawingprimitive_sse2_p.h
index cc8d230fa8..2233b73e56 100644
--- a/src/gui/painting/qdrawingprimitive_sse2_p.h
+++ b/src/gui/painting/qdrawingprimitive_sse2_p.h
@@ -1,41 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the QtGui module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#ifndef QDRAWINGPRIMITIVE_SSE2_P_H
#define QDRAWINGPRIMITIVE_SSE2_P_H
@@ -64,7 +28,7 @@ QT_BEGIN_NAMESPACE
* Multiply the components of pixelVector by alphaChannel
* Each 32bits components of alphaChannel must be in the form 0x00AA00AA
* colorMask must have 0x00ff00ff on each 32 bits component
- * half must have the value 128 (0x80) for each 32 bits compnent
+ * half must have the value 128 (0x80) for each 32 bits component
*/
#define BYTE_MUL_SSE2(result, pixelVector, alphaChannel, colorMask, half) \
{ \
@@ -102,7 +66,7 @@ QT_BEGIN_NAMESPACE
* Each 32bits components of alphaChannel must be in the form 0x00AA00AA
* oneMinusAlphaChannel must be 255 - alpha for each 32 bits component
* colorMask must have 0x00ff00ff on each 32 bits component
- * half must have the value 128 (0x80) for each 32 bits compnent
+ * half must have the value 128 (0x80) for each 32 bits component
*/
#define INTERPOLATE_PIXEL_255_SSE2(result, srcVector, dstVector, alphaChannel, oneMinusAlphaChannel, colorMask, half) { \
/* interpolate AG */\
@@ -232,7 +196,7 @@ QT_END_NAMESPACE
QT_BEGIN_NAMESPACE
#if QT_COMPILER_SUPPORTS_HERE(SSE4_1)
QT_FUNCTION_TARGET(SSE2)
-Q_ALWAYS_INLINE void Q_DECL_VECTORCALL reciprocal_mul_ss(__m128 &ia, const __m128 a, float mul)
+static inline void Q_DECL_VECTORCALL reciprocal_mul_ss(__m128 &ia, const __m128 a, float mul)
{
ia = _mm_rcp_ss(a); // Approximate 1/a
// Improve precision of ia using Newton-Raphson
@@ -242,7 +206,7 @@ Q_ALWAYS_INLINE void Q_DECL_VECTORCALL reciprocal_mul_ss(__m128 &ia, const __m12
}
QT_FUNCTION_TARGET(SSE4_1)
-inline QRgb qUnpremultiply_sse4(QRgb p)
+static inline QRgb qUnpremultiply_sse4(QRgb p)
{
const uint alpha = qAlpha(p);
if (alpha == 255)
@@ -262,14 +226,14 @@ inline QRgb qUnpremultiply_sse4(QRgb p)
template<enum QtPixelOrder PixelOrder>
QT_FUNCTION_TARGET(SSE4_1)
-inline uint qConvertArgb32ToA2rgb30_sse4(QRgb p)
+static inline uint qConvertArgb32ToA2rgb30_sse4(QRgb p)
{
const uint alpha = qAlpha(p);
if (alpha == 255)
return qConvertRgb32ToRgb30<PixelOrder>(p);
if (alpha == 0)
return 0;
- Q_CONSTEXPR float mult = 1023.0f / (255 >> 6);
+ constexpr float mult = 1023.0f / (255 >> 6);
const uint newalpha = (alpha >> 6);
const __m128 va = _mm_set1_ps(alpha);
__m128 via;
@@ -292,7 +256,7 @@ inline uint qConvertArgb32ToA2rgb30_sse4(QRgb p)
template<enum QtPixelOrder PixelOrder>
QT_FUNCTION_TARGET(SSE4_1)
-inline uint qConvertRgba64ToRgb32_sse4(QRgba64 p)
+static inline uint qConvertRgba64ToRgb32_sse4(QRgba64 p)
{
if (p.isTransparent())
return 0;
diff --git a/src/gui/painting/qemulationpaintengine.cpp b/src/gui/painting/qemulationpaintengine.cpp
index 7cd700a84a..8e871238cc 100644
--- a/src/gui/painting/qemulationpaintengine.cpp
+++ b/src/gui/painting/qemulationpaintengine.cpp
@@ -1,41 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the QtGui module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#include <private/qemulationpaintengine_p.h>
#include <private/qpainter_p.h>
@@ -103,8 +67,8 @@ void QEmulationPaintEngine::fill(const QVectorPath &path, const QBrush &brush)
return;
}
} else if (style == Qt::TexturePattern) {
- qreal dpr = qHasPixmapTexture(brush) ? brush.texture().devicePixelRatioF() : brush.textureImage().devicePixelRatioF();
- if (!qFuzzyCompare(dpr, 1.0)) {
+ qreal dpr = qHasPixmapTexture(brush) ? brush.texture().devicePixelRatio() : brush.textureImage().devicePixelRatio();
+ if (!qFuzzyCompare(dpr, qreal(1.0))) {
QBrush copy = brush;
combineXForm(&copy, QRectF(0, 0, 1.0/dpr, 1.0/dpr));
real_engine->fill(path, copy);
diff --git a/src/gui/painting/qemulationpaintengine_p.h b/src/gui/painting/qemulationpaintengine_p.h
index a2eb9b008c..cabb8485cb 100644
--- a/src/gui/painting/qemulationpaintengine_p.h
+++ b/src/gui/painting/qemulationpaintengine_p.h
@@ -1,41 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the QtGui module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#ifndef QEMULATIONPAINTENGINE_P_H
#define QEMULATIONPAINTENGINE_P_H
diff --git a/src/gui/painting/qfixed_p.h b/src/gui/painting/qfixed_p.h
index 846592881c..c0a13d057f 100644
--- a/src/gui/painting/qfixed_p.h
+++ b/src/gui/painting/qfixed_p.h
@@ -1,41 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the QtGui module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#ifndef QFIXED_P_H
#define QFIXED_P_H
@@ -54,58 +18,63 @@
#include <QtGui/private/qtguiglobal_p.h>
#include "QtCore/qdebug.h"
#include "QtCore/qpoint.h"
+#include "QtCore/qnumeric.h"
#include "QtCore/qsize.h"
QT_BEGIN_NAMESPACE
struct QFixed {
private:
- Q_DECL_CONSTEXPR QFixed(int val, int) : val(val) {} // 2nd int is just a dummy for disambiguation
+ constexpr QFixed(int val, int) : val(val) {} // 2nd int is just a dummy for disambiguation
public:
- Q_DECL_CONSTEXPR QFixed() : val(0) {}
- Q_DECL_CONSTEXPR QFixed(int i) : val(i * 64) {}
- Q_DECL_CONSTEXPR QFixed(long i) : val(i * 64) {}
- QFixed &operator=(int i) { val = i * 64; return *this; }
- QFixed &operator=(long i) { val = i * 64; return *this; }
+ constexpr QFixed() : val(0) {}
+ constexpr QFixed(int i) : val(i * 64) {}
+ constexpr QFixed(long i) : val(i * 64) {}
+ constexpr QFixed(long long i) : val(i * 64) {}
- Q_DECL_CONSTEXPR static QFixed fromReal(qreal r) { return fromFixed((int)(r*qreal(64))); }
- Q_DECL_CONSTEXPR static QFixed fromFixed(int fixed) { return QFixed(fixed,0); } // uses private ctor
+ constexpr static QFixed fromReal(qreal r) { return fromFixed((int)(r*qreal(64))); }
+ constexpr static QFixed fromFixed(int fixed) { return QFixed(fixed,0); } // uses private ctor
- Q_DECL_CONSTEXPR inline int value() const { return val; }
+ constexpr inline int value() const { return val; }
inline void setValue(int value) { val = value; }
- Q_DECL_CONSTEXPR inline int toInt() const { return (((val)+32) & -64)>>6; }
- Q_DECL_CONSTEXPR inline qreal toReal() const { return ((qreal)val)/(qreal)64; }
+ constexpr inline int toInt() const { return (((val)+32) & -64)>>6; }
+ constexpr inline qreal toReal() const { return ((qreal)val)/(qreal)64; }
- Q_DECL_CONSTEXPR inline int truncate() const { return val>>6; }
- Q_DECL_CONSTEXPR inline QFixed round() const { return fromFixed(((val)+32) & -64); }
- Q_DECL_CONSTEXPR inline QFixed floor() const { return fromFixed((val) & -64); }
- Q_DECL_CONSTEXPR inline QFixed ceil() const { return fromFixed((val+63) & -64); }
+ constexpr inline int truncate() const { return val>>6; }
+ constexpr inline QFixed round() const { return fromFixed(((val)+32) & -64); }
+ constexpr inline QFixed floor() const { return fromFixed((val) & -64); }
+ constexpr inline QFixed ceil() const { return fromFixed((val+63) & -64); }
- Q_DECL_CONSTEXPR inline QFixed operator+(int i) const { return fromFixed(val + i * 64); }
- Q_DECL_CONSTEXPR inline QFixed operator+(uint i) const { return fromFixed((val + (i<<6))); }
- Q_DECL_CONSTEXPR inline QFixed operator+(const QFixed &other) const { return fromFixed((val + other.val)); }
+ constexpr inline QFixed operator+(int i) const { return fromFixed(val + i * 64); }
+ constexpr inline QFixed operator+(uint i) const { return fromFixed((val + (i<<6))); }
+ constexpr inline QFixed operator+(QFixed other) const { return fromFixed((val + other.val)); }
inline QFixed &operator+=(int i) { val += i * 64; return *this; }
inline QFixed &operator+=(uint i) { val += (i<<6); return *this; }
- inline QFixed &operator+=(const QFixed &other) { val += other.val; return *this; }
- Q_DECL_CONSTEXPR inline QFixed operator-(int i) const { return fromFixed(val - i * 64); }
- Q_DECL_CONSTEXPR inline QFixed operator-(uint i) const { return fromFixed((val - (i<<6))); }
- Q_DECL_CONSTEXPR inline QFixed operator-(const QFixed &other) const { return fromFixed((val - other.val)); }
+ inline QFixed &operator+=(QFixed other) { val += other.val; return *this; }
+ constexpr inline QFixed operator-(int i) const { return fromFixed(val - i * 64); }
+ constexpr inline QFixed operator-(uint i) const { return fromFixed((val - (i<<6))); }
+ constexpr inline QFixed operator-(QFixed other) const { return fromFixed((val - other.val)); }
inline QFixed &operator-=(int i) { val -= i * 64; return *this; }
inline QFixed &operator-=(uint i) { val -= (i<<6); return *this; }
- inline QFixed &operator-=(const QFixed &other) { val -= other.val; return *this; }
- Q_DECL_CONSTEXPR inline QFixed operator-() const { return fromFixed(-val); }
-
- Q_DECL_CONSTEXPR inline bool operator==(const QFixed &other) const { return val == other.val; }
- Q_DECL_CONSTEXPR inline bool operator!=(const QFixed &other) const { return val != other.val; }
- Q_DECL_CONSTEXPR inline bool operator<(const QFixed &other) const { return val < other.val; }
- Q_DECL_CONSTEXPR inline bool operator>(const QFixed &other) const { return val > other.val; }
- Q_DECL_CONSTEXPR inline bool operator<=(const QFixed &other) const { return val <= other.val; }
- Q_DECL_CONSTEXPR inline bool operator>=(const QFixed &other) const { return val >= other.val; }
- Q_DECL_CONSTEXPR inline bool operator!() const { return !val; }
+ inline QFixed &operator-=(QFixed other) { val -= other.val; return *this; }
+ constexpr inline QFixed operator-() const { return fromFixed(-val); }
+
+#define REL_OP(op) \
+ friend constexpr bool operator op(QFixed lhs, QFixed rhs) noexcept \
+ { return lhs.val op rhs.val; }
+ REL_OP(==)
+ REL_OP(!=)
+ REL_OP(< )
+ REL_OP(> )
+ REL_OP(<=)
+ REL_OP(>=)
+#undef REL_OP
+
+ constexpr inline bool operator!() const { return !val; }
inline QFixed &operator/=(int x) { val /= x; return *this; }
- inline QFixed &operator/=(const QFixed &o) {
+ inline QFixed &operator/=(QFixed o) {
if (o.val == 0) {
val = 0x7FFFFFFFL;
} else {
@@ -121,12 +90,12 @@ public:
}
return *this;
}
- Q_DECL_CONSTEXPR inline QFixed operator/(int d) const { return fromFixed(val/d); }
+ constexpr inline QFixed operator/(int d) const { return fromFixed(val/d); }
inline QFixed operator/(QFixed b) const { QFixed f = *this; return (f /= b); }
inline QFixed operator>>(int d) const { QFixed f = *this; f.val >>= d; return f; }
inline QFixed &operator*=(int i) { val *= i; return *this; }
inline QFixed &operator*=(uint i) { val *= i; return *this; }
- inline QFixed &operator*=(const QFixed &o) {
+ inline QFixed &operator*=(QFixed o) {
bool neg = false;
qint64 a = val;
qint64 b = o.val;
@@ -137,80 +106,86 @@ public:
val = neg ? -res : res;
return *this;
}
- Q_DECL_CONSTEXPR inline QFixed operator*(int i) const { return fromFixed(val * i); }
- Q_DECL_CONSTEXPR inline QFixed operator*(uint i) const { return fromFixed(val * i); }
- inline QFixed operator*(const QFixed &o) const { QFixed f = *this; return (f *= o); }
+ constexpr inline QFixed operator*(int i) const { return fromFixed(val * i); }
+ constexpr inline QFixed operator*(uint i) const { return fromFixed(val * i); }
+ inline QFixed operator*(QFixed o) const { QFixed f = *this; return (f *= o); }
private:
- Q_DECL_CONSTEXPR QFixed(qreal i) : val((int)(i*qreal(64))) {}
- QFixed &operator=(qreal i) { val = (int)(i*qreal(64)); return *this; }
- Q_DECL_CONSTEXPR inline QFixed operator+(qreal i) const { return fromFixed((val + (int)(i*qreal(64)))); }
+ constexpr QFixed(qreal i) : val((int)(i*qreal(64))) {}
+ constexpr inline QFixed operator+(qreal i) const { return fromFixed((val + (int)(i*qreal(64)))); }
inline QFixed &operator+=(qreal i) { val += (int)(i*64); return *this; }
- Q_DECL_CONSTEXPR inline QFixed operator-(qreal i) const { return fromFixed((val - (int)(i*qreal(64)))); }
+ constexpr inline QFixed operator-(qreal i) const { return fromFixed((val - (int)(i*qreal(64)))); }
inline QFixed &operator-=(qreal i) { val -= (int)(i*64); return *this; }
inline QFixed &operator/=(qreal r) { val = (int)(val/r); return *this; }
- Q_DECL_CONSTEXPR inline QFixed operator/(qreal d) const { return fromFixed((int)(val/d)); }
+ constexpr inline QFixed operator/(qreal d) const { return fromFixed((int)(val/d)); }
inline QFixed &operator*=(qreal d) { val = (int) (val*d); return *this; }
- Q_DECL_CONSTEXPR inline QFixed operator*(qreal d) const { return fromFixed((int) (val*d)); }
+ constexpr inline QFixed operator*(qreal d) const { return fromFixed((int) (val*d)); }
int val;
};
Q_DECLARE_TYPEINFO(QFixed, Q_PRIMITIVE_TYPE);
#define QFIXED_MAX (INT_MAX/256)
-Q_DECL_CONSTEXPR inline int qRound(const QFixed &f) { return f.toInt(); }
-Q_DECL_CONSTEXPR inline int qFloor(const QFixed &f) { return f.floor().truncate(); }
-
-Q_DECL_CONSTEXPR inline QFixed operator*(int i, const QFixed &d) { return d*i; }
-Q_DECL_CONSTEXPR inline QFixed operator+(int i, const QFixed &d) { return d+i; }
-Q_DECL_CONSTEXPR inline QFixed operator-(int i, const QFixed &d) { return -(d-i); }
-Q_DECL_CONSTEXPR inline QFixed operator*(uint i, const QFixed &d) { return d*i; }
-Q_DECL_CONSTEXPR inline QFixed operator+(uint i, const QFixed &d) { return d+i; }
-Q_DECL_CONSTEXPR inline QFixed operator-(uint i, const QFixed &d) { return -(d-i); }
-// Q_DECL_CONSTEXPR inline QFixed operator*(qreal d, const QFixed &d2) { return d2*d; }
-
-Q_DECL_CONSTEXPR inline bool operator==(const QFixed &f, int i) { return f.value() == i * 64; }
-Q_DECL_CONSTEXPR inline bool operator==(int i, const QFixed &f) { return f.value() == i * 64; }
-Q_DECL_CONSTEXPR inline bool operator!=(const QFixed &f, int i) { return f.value() != i * 64; }
-Q_DECL_CONSTEXPR inline bool operator!=(int i, const QFixed &f) { return f.value() != i * 64; }
-Q_DECL_CONSTEXPR inline bool operator<=(const QFixed &f, int i) { return f.value() <= i * 64; }
-Q_DECL_CONSTEXPR inline bool operator<=(int i, const QFixed &f) { return i * 64 <= f.value(); }
-Q_DECL_CONSTEXPR inline bool operator>=(const QFixed &f, int i) { return f.value() >= i * 64; }
-Q_DECL_CONSTEXPR inline bool operator>=(int i, const QFixed &f) { return i * 64 >= f.value(); }
-Q_DECL_CONSTEXPR inline bool operator<(const QFixed &f, int i) { return f.value() < i * 64; }
-Q_DECL_CONSTEXPR inline bool operator<(int i, const QFixed &f) { return i * 64 < f.value(); }
-Q_DECL_CONSTEXPR inline bool operator>(const QFixed &f, int i) { return f.value() > i * 64; }
-Q_DECL_CONSTEXPR inline bool operator>(int i, const QFixed &f) { return i * 64 > f.value(); }
+constexpr inline int qRound(QFixed f) { return f.toInt(); }
+constexpr inline int qFloor(QFixed f) { return f.floor().truncate(); }
+
+constexpr inline QFixed operator*(int i, QFixed d) { return d*i; }
+constexpr inline QFixed operator+(int i, QFixed d) { return d+i; }
+constexpr inline QFixed operator-(int i, QFixed d) { return -(d-i); }
+constexpr inline QFixed operator*(uint i, QFixed d) { return d*i; }
+constexpr inline QFixed operator+(uint i, QFixed d) { return d+i; }
+constexpr inline QFixed operator-(uint i, QFixed d) { return -(d-i); }
+// constexpr inline QFixed operator*(qreal d, QFixed d2) { return d2*d; }
+
+inline bool qAddOverflow(QFixed v1, QFixed v2, QFixed *r)
+{
+ int val;
+ bool result = qAddOverflow(v1.value(), v2.value(), &val);
+ r->setValue(val);
+ return result;
+}
+
+inline bool qMulOverflow(QFixed v1, QFixed v2, QFixed *r)
+{
+ int val;
+ bool result = qMulOverflow(v1.value(), v2.value(), &val);
+ r->setValue(val);
+ return result;
+}
#ifndef QT_NO_DEBUG_STREAM
-inline QDebug &operator<<(QDebug &dbg, const QFixed &f)
+inline QDebug &operator<<(QDebug &dbg, QFixed f)
{ return dbg << f.toReal(); }
#endif
struct QFixedPoint {
QFixed x;
QFixed y;
- Q_DECL_CONSTEXPR inline QFixedPoint() {}
- Q_DECL_CONSTEXPR inline QFixedPoint(const QFixed &_x, const QFixed &_y) : x(_x), y(_y) {}
- Q_DECL_CONSTEXPR QPointF toPointF() const { return QPointF(x.toReal(), y.toReal()); }
- Q_DECL_CONSTEXPR static QFixedPoint fromPointF(const QPointF &p) {
+ constexpr inline QFixedPoint() {}
+ constexpr inline QFixedPoint(QFixed _x, QFixed _y) : x(_x), y(_y) {}
+ constexpr QPointF toPointF() const { return QPointF(x.toReal(), y.toReal()); }
+ constexpr static QFixedPoint fromPointF(const QPointF &p) {
return QFixedPoint(QFixed::fromReal(p.x()), QFixed::fromReal(p.y()));
}
+ constexpr inline bool operator==(const QFixedPoint &other) const
+ {
+ return x == other.x && y == other.y;
+ }
};
Q_DECLARE_TYPEINFO(QFixedPoint, Q_PRIMITIVE_TYPE);
-Q_DECL_CONSTEXPR inline QFixedPoint operator-(const QFixedPoint &p1, const QFixedPoint &p2)
+constexpr inline QFixedPoint operator-(const QFixedPoint &p1, const QFixedPoint &p2)
{ return QFixedPoint(p1.x - p2.x, p1.y - p2.y); }
-Q_DECL_CONSTEXPR inline QFixedPoint operator+(const QFixedPoint &p1, const QFixedPoint &p2)
+constexpr inline QFixedPoint operator+(const QFixedPoint &p1, const QFixedPoint &p2)
{ return QFixedPoint(p1.x + p2.x, p1.y + p2.y); }
struct QFixedSize {
QFixed width;
QFixed height;
- Q_DECL_CONSTEXPR QFixedSize() {}
- Q_DECL_CONSTEXPR QFixedSize(QFixed _width, QFixed _height) : width(_width), height(_height) {}
- Q_DECL_CONSTEXPR QSizeF toSizeF() const { return QSizeF(width.toReal(), height.toReal()); }
- Q_DECL_CONSTEXPR static QFixedSize fromSizeF(const QSizeF &s) {
+ constexpr QFixedSize() {}
+ constexpr QFixedSize(QFixed _width, QFixed _height) : width(_width), height(_height) {}
+ constexpr QSizeF toSizeF() const { return QSizeF(width.toReal(), height.toReal()); }
+ constexpr static QFixedSize fromSizeF(const QSizeF &s) {
return QFixedSize(QFixed::fromReal(s.width()), QFixed::fromReal(s.height()));
}
};
diff --git a/src/gui/painting/qgrayraster.c b/src/gui/painting/qgrayraster.c
index 0143e9b602..3c222c49e1 100644
--- a/src/gui/painting/qgrayraster.c
+++ b/src/gui/painting/qgrayraster.c
@@ -1,41 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the QtGui module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
/***************************************************************************/
/* */
@@ -187,6 +151,7 @@ typedef ptrdiff_t QT_FT_PtrDist;
#include <stdlib.h>
#include <stdio.h>
+#include <assert.h>
#define QT_FT_UNUSED( x ) (void) x
@@ -216,11 +181,8 @@ typedef ptrdiff_t QT_FT_PtrDist;
#define PIXEL_BITS 8
#define ONE_PIXEL ( 1L << PIXEL_BITS )
-#define TRUNC( x ) ( (TCoord)( (x) >> PIXEL_BITS ) )
-#define SUBPIXELS( x ) ( (TPos)(x) * ONE_PIXEL )
-#define FLOOR( x ) ( (x) & -ONE_PIXEL )
-#define CEILING( x ) ( ( (x) + ONE_PIXEL - 1 ) & -ONE_PIXEL )
-#define ROUND( x ) ( ( (x) + ONE_PIXEL / 2 ) & -ONE_PIXEL )
+#define TRUNC( x ) (TCoord)( (x) >> PIXEL_BITS )
+#define FRACT( x ) (TCoord)( (x) & ( ONE_PIXEL - 1 ) )
#if PIXEL_BITS >= 6
#define UPSCALE( x ) ( (x) * ( ONE_PIXEL >> 6 ) )
@@ -548,17 +510,13 @@ QT_FT_END_STMNT
TPos x2,
TCoord y2 )
{
- TCoord ex1, ex2, fx1, fx2, delta, mod;
- int p, first, dx;
+ TCoord ex1, ex2, fx1, fx2, first, dy, delta, mod;
+ TPos p, dx;
int incr;
- dx = x2 - x1;
-
ex1 = TRUNC( x1 );
ex2 = TRUNC( x2 );
- fx1 = (TCoord)( x1 - SUBPIXELS( ex1 ) );
- fx2 = (TCoord)( x2 - SUBPIXELS( ex2 ) );
/* trivial case. Happens often */
if ( y1 == y2 )
@@ -567,26 +525,27 @@ QT_FT_END_STMNT
return;
}
+ fx1 = FRACT( x1 );
+ fx2 = FRACT( x2 );
+
/* everything is located in a single cell. That is easy! */
/* */
if ( ex1 == ex2 )
- {
- delta = y2 - y1;
- ras.area += (TArea)( fx1 + fx2 ) * delta;
- ras.cover += delta;
- return;
- }
+ goto End;
/* ok, we'll have to render a run of adjacent cells on the same */
/* scanline... */
/* */
- p = ( ONE_PIXEL - fx1 ) * ( y2 - y1 );
- first = ONE_PIXEL;
- incr = 1;
+ dx = x2 - x1;
+ dy = y2 - y1;
- if ( dx < 0 )
+ if ( dx > 0 )
{
- p = fx1 * ( y2 - y1 );
+ p = ( ONE_PIXEL - fx1 ) * dy;
+ first = ONE_PIXEL;
+ incr = 1;
+ } else {
+ p = fx1 * dy;
first = 0;
incr = -1;
dx = -dx;
@@ -596,42 +555,42 @@ QT_FT_END_STMNT
ras.area += (TArea)( fx1 + first ) * delta;
ras.cover += delta;
-
- ex1 += incr;
+ y1 += delta;
+ ex1 += incr;
gray_set_cell( RAS_VAR_ ex1, ey );
- y1 += delta;
if ( ex1 != ex2 )
{
TCoord lift, rem;
- p = ONE_PIXEL * ( y2 - y1 + delta );
+ p = ONE_PIXEL * dy;
QT_FT_DIV_MOD( TCoord, p, dx, lift, rem );
- mod -= (int)dx;
-
- while ( ex1 != ex2 )
+ do
{
delta = lift;
mod += rem;
- if ( mod >= 0 )
+ if ( mod >= (TCoord)dx )
{
mod -= (TCoord)dx;
delta++;
}
- ras.area += (TArea)ONE_PIXEL * delta;
+ ras.area += (TArea)( ONE_PIXEL * delta );
ras.cover += delta;
y1 += delta;
ex1 += incr;
gray_set_cell( RAS_VAR_ ex1, ey );
- }
+ } while ( ex1 != ex2 );
}
+ fx1 = ONE_PIXEL - first;
- delta = y2 - y1;
- ras.area += (TArea)( fx2 + ONE_PIXEL - first ) * delta;
- ras.cover += delta;
+ End:
+ dy = y2 - y1;
+
+ ras.area += (TArea)( ( fx1 + fx2 ) * dy );
+ ras.cover += dy;
}
@@ -643,25 +602,21 @@ QT_FT_END_STMNT
gray_render_line( RAS_ARG_ TPos to_x,
TPos to_y )
{
- TCoord ey1, ey2, fy1, fy2, mod;
- TPos dx, dy, x, x2;
- int p, first;
- int delta, rem, lift, incr;
-
+ TCoord ey1, ey2, fy1, fy2, first, delta, mod;
+ TPos p, dx, dy, x, x2;
+ int incr;
ey1 = TRUNC( ras.y );
ey2 = TRUNC( to_y ); /* if (ey2 >= ras.max_ey) ey2 = ras.max_ey-1; */
- fy1 = (TCoord)( ras.y - SUBPIXELS( ey1 ) );
- fy2 = (TCoord)( to_y - SUBPIXELS( ey2 ) );
-
- dx = to_x - ras.x;
- dy = to_y - ras.y;
/* perform vertical clipping */
if ( ( ey1 >= ras.max_ey && ey2 >= ras.max_ey ) ||
( ey1 < ras.min_ey && ey2 < ras.min_ey ) )
goto End;
+ fy1 = FRACT( ras.y );
+ fy2 = FRACT( to_y );
+
/* everything is on a single scanline */
if ( ey1 == ey2 )
{
@@ -669,23 +624,31 @@ QT_FT_END_STMNT
goto End;
}
+ dx = to_x - ras.x;
+ dy = to_y - ras.y;
+
/* vertical line - avoid calling gray_render_scanline */
if ( dx == 0 )
{
TCoord ex = TRUNC( ras.x );
- TCoord two_fx = (TCoord)( ( ras.x - SUBPIXELS( ex ) ) << 1 );
+ TCoord two_fx = FRACT( ras.x ) << 1;
TPos area, max_ey1;
- first = ONE_PIXEL;
- if ( dy < 0 )
+ if ( dy > 0)
+ {
+ first = ONE_PIXEL;
+ }
+ else
+ {
first = 0;
+ }
- delta = (int)( first - fy1 );
+ delta = first - fy1;
ras.area += (TArea)two_fx * delta;
ras.cover += delta;
- delta = (int)( first + first - ONE_PIXEL );
+ delta = first + first - ONE_PIXEL;
area = (TArea)two_fx * delta;
max_ey1 = ras.count_ey + ras.min_ey;
if (dy < 0) {
@@ -738,11 +701,13 @@ QT_FT_END_STMNT
}
/* ok, we have to render several scanlines */
- p = ( ONE_PIXEL - fy1 ) * dx;
- first = ONE_PIXEL;
- incr = 1;
-
- if ( dy < 0 )
+ if ( dy > 0)
+ {
+ p = ( ONE_PIXEL - fy1 ) * dx;
+ first = ONE_PIXEL;
+ incr = 1;
+ }
+ else
{
p = fy1 * dx;
first = 0;
@@ -750,13 +715,9 @@ QT_FT_END_STMNT
dy = -dy;
}
- delta = (int)( p / dy );
- mod = (int)( p % dy );
- if ( mod < 0 )
- {
- delta--;
- mod += (TCoord)dy;
- }
+ /* the fractional part of x-delta is mod/dy. It is essential to */
+ /* keep track of its accumulation for accurate rendering. */
+ QT_FT_DIV_MOD( TCoord, p, dy, delta, mod );
x = ras.x + delta;
gray_render_scanline( RAS_VAR_ ey1, ras.x, fy1, x, (TCoord)first );
@@ -766,34 +727,36 @@ QT_FT_END_STMNT
if ( ey1 != ey2 )
{
- p = ONE_PIXEL * dx;
- QT_FT_DIV_MOD( int, p, dy, lift, rem );
- mod -= (int)dy;
+ TCoord lift, rem;
- while ( ey1 != ey2 )
+
+ p = ONE_PIXEL * dx;
+ QT_FT_DIV_MOD( TCoord, p, dy, lift, rem );
+
+ do
{
delta = lift;
mod += rem;
- if ( mod >= 0 )
+ if ( mod >= (TCoord)dy )
{
- mod -= (int)dy;
+ mod -= (TCoord)dy;
delta++;
}
x2 = x + delta;
- gray_render_scanline( RAS_VAR_ ey1, x,
- (TCoord)( ONE_PIXEL - first ), x2,
- (TCoord)first );
+ gray_render_scanline( RAS_VAR_ ey1,
+ x, ONE_PIXEL - first,
+ x2, first );
x = x2;
ey1 += incr;
gray_set_cell( RAS_VAR_ TRUNC( x ), ey1 );
- }
+ } while ( ey1 != ey2 );
}
- gray_render_scanline( RAS_VAR_ ey1, x,
- (TCoord)( ONE_PIXEL - first ), to_x,
- fy2 );
+ gray_render_scanline( RAS_VAR_ ey1,
+ x, ONE_PIXEL - first,
+ to_x, fy2 );
End:
ras.x = to_x;
@@ -828,8 +791,8 @@ QT_FT_END_STMNT
dx = to_x - ras.x;
dy = to_y - ras.y;
- fx1 = ras.x - SUBPIXELS( ex1 );
- fy1 = ras.y - SUBPIXELS( ey1 );
+ fx1 = FRACT( ras.x );
+ fy1 = FRACT( ras.y );
if ( ex1 == ex2 && ey1 == ey2 ) /* inside one cell */
;
@@ -926,8 +889,8 @@ QT_FT_END_STMNT
} while ( ex1 != ex2 || ey1 != ey2 );
}
- fx2 = to_x - SUBPIXELS( ex2 );
- fy2 = to_y - SUBPIXELS( ey2 );
+ fx2 = FRACT( to_x );
+ fy2 = FRACT( to_y );
ras.cover += ( fy2 - fy1 );
ras.area += ( fy2 - fy1 ) * ( fx1 + fx2 );
@@ -1103,7 +1066,7 @@ QT_FT_END_STMNT
L = QT_FT_HYPOT( dx_, dy_ );
/* Avoid possible arithmetic overflow below by splitting. */
- if ( L > 32767 )
+ if ( L >= (1 << 23) )
goto Split;
/* Max deviation may be as much as (s/L) * 3/4 (if Hain's v = 1). */
@@ -1253,13 +1216,13 @@ QT_FT_END_STMNT
y += (TCoord)ras.min_ey;
x += (TCoord)ras.min_ex;
- /* QT_FT_Span.x is a 16-bit short, so limit our coordinates appropriately */
- if ( x >= 32767 )
- x = 32767;
+ /* QT_FT_Span.x is an int, so limit our coordinates appropriately */
+ if ( x >= (1 << 23) )
+ x = (1 << 23) - 1;
- /* QT_FT_Span.y is a 16-bit short, so limit our coordinates appropriately */
- if ( y >= 32767 )
- y = 32767;
+ /* QT_FT_Span.y is an int, so limit our coordinates appropriately */
+ if ( y >= (1 << 23) )
+ y = (1 << 23) - 1;
if ( coverage )
{
@@ -1273,10 +1236,10 @@ QT_FT_END_STMNT
span = ras.gray_spans + count - 1;
if ( count > 0 &&
span->y == y &&
- (int)span->x + span->len == (int)x &&
+ span->x + span->len == x &&
span->coverage == coverage )
{
- span->len = (unsigned short)( span->len + acount );
+ span->len = span->len + acount;
return;
}
@@ -1319,9 +1282,9 @@ QT_FT_END_STMNT
span++;
/* add a gray span to the current list */
- span->x = (short)x;
- span->len = (unsigned short)acount;
- span->y = (short)y;
+ span->x = x;
+ span->len = acount;
+ span->y = y;
span->coverage = (unsigned char)coverage;
ras.num_gray_spans++;
@@ -1839,8 +1802,11 @@ QT_FT_END_STMNT
if ( !raster || !raster->buffer || !raster->buffer_size )
return ErrRaster_Invalid_Argument;
- if ( raster->worker )
- raster->worker->skip_spans = params->skip_spans;
+ /* Should always be non-null, it is set by raster_reset() which is always */
+ /* called with a non-null pool, and a pool_size >= MINIMUM_POOL_SIZE. */
+ assert(raster->worker);
+
+ raster->worker->skip_spans = params->skip_spans;
/* If raster object and raster buffer are allocated, but */
/* raster size isn't of the minimum size, indicate out of */
@@ -1897,10 +1863,10 @@ QT_FT_END_STMNT
}
else
{
- ras.clip_box.xMin = -32768L;
- ras.clip_box.yMin = -32768L;
- ras.clip_box.xMax = 32767L;
- ras.clip_box.yMax = 32767L;
+ ras.clip_box.xMin = -(1 << 23);
+ ras.clip_box.yMin = -(1 << 23);
+ ras.clip_box.xMax = (1 << 23) - 1;
+ ras.clip_box.yMax = (1 << 23) - 1;
}
gray_init_cells( worker, raster->buffer, raster->buffer_size );
diff --git a/src/gui/painting/qgrayraster_p.h b/src/gui/painting/qgrayraster_p.h
index 86d54d4379..f9aae18e9d 100644
--- a/src/gui/painting/qgrayraster_p.h
+++ b/src/gui/painting/qgrayraster_p.h
@@ -1,41 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the QtGui module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
/***************************************************************************/
/* */
diff --git a/src/gui/painting/qicc.cpp b/src/gui/painting/qicc.cpp
index 18f212f8e9..c01fa433ea 100644
--- a/src/gui/painting/qicc.cpp
+++ b/src/gui/painting/qicc.cpp
@@ -1,56 +1,28 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the QtGui module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2024 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#include "qicc_p.h"
#include <qbuffer.h>
#include <qbytearray.h>
+#include <qvarlengtharray.h>
+#include <qhash.h>
#include <qdatastream.h>
#include <qendian.h>
#include <qloggingcategory.h>
#include <qstring.h>
+#include "qcolorclut_p.h"
+#include "qcolormatrix_p.h"
#include "qcolorspace_p.h"
#include "qcolortrc_p.h"
+#include <array>
+
QT_BEGIN_NAMESPACE
-Q_LOGGING_CATEGORY(lcIcc, "qt.gui.icc")
+Q_LOGGING_CATEGORY(lcIcc, "qt.gui.icc", QtWarningMsg)
+
+namespace QIcc {
struct ICCProfileHeader
{
@@ -87,16 +59,26 @@ constexpr quint32 IccTag(uchar a, uchar b, uchar c, uchar d)
return (a << 24) | (b << 16) | (c << 8) | d;
}
+enum class ColorSpaceType : quint32 {
+ Rgb = IccTag('R', 'G', 'B', ' '),
+ Gray = IccTag('G', 'R', 'A', 'Y'),
+ Cmyk = IccTag('C', 'M', 'Y', 'K'),
+};
+
enum class ProfileClass : quint32 {
- Input = IccTag('s', 'c', 'r', 'n'),
+ Input = IccTag('s', 'c', 'n', 'r'),
Display = IccTag('m', 'n', 't', 'r'),
- // Not supported:
Output = IccTag('p', 'r', 't', 'r'),
ColorSpace = IccTag('s', 'p', 'a', 'c'),
+ // Not supported:
+ DeviceLink = IccTag('l', 'i', 'n', 'k'),
+ Abstract = IccTag('a', 'b', 's', 't'),
+ NamedColor = IccTag('n', 'm', 'c', 'l'),
};
enum class Tag : quint32 {
acsp = IccTag('a', 'c', 's', 'p'),
+ Lab_ = IccTag('L', 'a', 'b', ' '),
RGB_ = IccTag('R', 'G', 'B', ' '),
XYZ_ = IccTag('X', 'Y', 'Z', ' '),
rXYZ = IccTag('r', 'X', 'Y', 'Z'),
@@ -105,10 +87,21 @@ enum class Tag : quint32 {
rTRC = IccTag('r', 'T', 'R', 'C'),
gTRC = IccTag('g', 'T', 'R', 'C'),
bTRC = IccTag('b', 'T', 'R', 'C'),
+ kTRC = IccTag('k', 'T', 'R', 'C'),
A2B0 = IccTag('A', '2', 'B', '0'),
A2B1 = IccTag('A', '2', 'B', '1'),
+ A2B2 = IccTag('A', '2', 'B', '2'),
B2A0 = IccTag('B', '2', 'A', '0'),
B2A1 = IccTag('B', '2', 'A', '1'),
+ B2A2 = IccTag('B', '2', 'A', '2'),
+ B2D0 = IccTag('B', '2', 'D', '0'),
+ B2D1 = IccTag('B', '2', 'D', '1'),
+ B2D2 = IccTag('B', '2', 'D', '2'),
+ B2D3 = IccTag('B', '2', 'D', '3'),
+ D2B0 = IccTag('D', '2', 'B', '0'),
+ D2B1 = IccTag('D', '2', 'B', '1'),
+ D2B2 = IccTag('D', '2', 'B', '2'),
+ D2B3 = IccTag('D', '2', 'B', '3'),
desc = IccTag('d', 'e', 's', 'c'),
text = IccTag('t', 'e', 'x', 't'),
cprt = IccTag('c', 'p', 'r', 't'),
@@ -119,9 +112,11 @@ enum class Tag : quint32 {
mft1 = IccTag('m', 'f', 't', '1'),
mft2 = IccTag('m', 'f', 't', '2'),
mluc = IccTag('m', 'l', 'u', 'c'),
+ mpet = IccTag('m', 'p', 'e', 't'),
mAB_ = IccTag('m', 'A', 'B', ' '),
mBA_ = IccTag('m', 'B', 'A', ' '),
chad = IccTag('c', 'h', 'a', 'd'),
+ gamt = IccTag('g', 'a', 'm', 't'),
sf32 = IccTag('s', 'f', '3', '2'),
// Apple extensions for ICCv2:
@@ -130,7 +125,9 @@ enum class Tag : quint32 {
aabg = IccTag('a', 'a', 'b', 'g'),
};
-inline uint qHash(const Tag &key, uint seed = 0)
+} // namespace QIcc
+
+inline size_t qHash(const QIcc::Tag &key, size_t seed = 0)
{
return qHash(quint32(key), seed);
}
@@ -157,18 +154,18 @@ struct XYZTagData : GenericTagData {
struct CurvTagData : GenericTagData {
quint32_be valueCount;
- quint16_be value[1];
+ // followed by curv values: quint16_be[]
};
struct ParaTagData : GenericTagData {
quint16_be curveType;
quint16_be null2;
- quint32_be parameter[1];
+ // followed by parameter values: quint32_be[1-7];
};
struct DescTagData : GenericTagData {
quint32_be asciiDescriptionLength;
- char asciiDescription[1];
+ // followed by ascii description: char[]
// .. we ignore the rest
};
@@ -185,6 +182,46 @@ struct MlucTagData : GenericTagData {
MlucTagRecord records[1];
};
+struct Lut8TagData : GenericTagData {
+ quint8 inputChannels;
+ quint8 outputChannels;
+ quint8 clutGridPoints;
+ quint8 padding;
+ qint32_be e1;
+ qint32_be e2;
+ qint32_be e3;
+ qint32_be e4;
+ qint32_be e5;
+ qint32_be e6;
+ qint32_be e7;
+ qint32_be e8;
+ qint32_be e9;
+ // followed by parameter values: quint8[inputChannels * 256];
+ // followed by parameter values: quint8[outputChannels * clutGridPoints^inputChannels];
+ // followed by parameter values: quint8[outputChannels * 256];
+};
+
+struct Lut16TagData : GenericTagData {
+ quint8 inputChannels;
+ quint8 outputChannels;
+ quint8 clutGridPoints;
+ quint8 padding;
+ qint32_be e1;
+ qint32_be e2;
+ qint32_be e3;
+ qint32_be e4;
+ qint32_be e5;
+ qint32_be e6;
+ qint32_be e7;
+ qint32_be e8;
+ qint32_be e9;
+ quint16_be inputTableEntries;
+ quint16_be outputTableEntries;
+ // followed by parameter values: quint16_be[inputChannels * inputTableEntries];
+ // followed by parameter values: quint16_be[outputChannels * clutGridPoints^inputChannels];
+ // followed by parameter values: quint16_be[outputChannels * outputTableEntries];
+};
+
// For both mAB and mBA
struct mABTagData : GenericTagData {
quint8 inputChannels;
@@ -195,10 +232,34 @@ struct mABTagData : GenericTagData {
quint32_be mCurvesOffset;
quint32_be clutOffset;
quint32_be aCurvesOffset;
+ // followed by embedded data for the offsets above
+};
+
+struct mpetTagData : GenericTagData {
+ quint16_be inputChannels;
+ quint16_be outputChannels;
+ quint32_be processingElements;
+ // element offset table
+ // element data
};
struct Sf32TagData : GenericTagData {
- quint32_be value[1];
+ quint32_be value[9];
+};
+
+struct MatrixElement {
+ qint32_be e0;
+ qint32_be e1;
+ qint32_be e2;
+ qint32_be e3;
+ qint32_be e4;
+ qint32_be e5;
+ qint32_be e6;
+ qint32_be e7;
+ qint32_be e8;
+ qint32_be e9;
+ qint32_be e10;
+ qint32_be e11;
};
static int toFixedS1516(float x)
@@ -219,25 +280,30 @@ static bool isValidIccProfile(const ICCProfileHeader &header)
}
// Don't overflow 32bit integers:
- if (header.tagCount >= INT32_MAX / sizeof(TagTableEntry))
+ if (header.tagCount >= (INT32_MAX - sizeof(ICCProfileHeader)) / sizeof(TagTableEntry)) {
+ qCWarning(lcIcc, "Failed tag count sanity");
return false;
+ }
if (header.profileSize - sizeof(ICCProfileHeader) < header.tagCount * sizeof(TagTableEntry)) {
qCWarning(lcIcc, "Failed basic size sanity");
return false;
}
if (header.profileClass != uint(ProfileClass::Input)
- && header.profileClass != uint(ProfileClass::Display)) {
- qCWarning(lcIcc, "Unsupported ICC profile class %x", quint32(header.profileClass));
+ && header.profileClass != uint(ProfileClass::Display)
+ && header.profileClass != uint(ProfileClass::Output)
+ && header.profileClass != uint(ProfileClass::ColorSpace)) {
+ qCInfo(lcIcc, "Unsupported ICC profile class 0x%x", quint32(header.profileClass));
return false;
}
- if (header.inputColorSpace != 0x52474220 /* 'RGB '*/) {
- qCWarning(lcIcc, "Unsupported ICC input color space %x", quint32(header.inputColorSpace));
+ if (header.inputColorSpace != uint(ColorSpaceType::Rgb)
+ && header.inputColorSpace != uint(ColorSpaceType::Gray)
+ && header.inputColorSpace != uint(ColorSpaceType::Cmyk)) {
+ qCInfo(lcIcc, "Unsupported ICC input color space 0x%x", quint32(header.inputColorSpace));
return false;
}
- if (header.pcs != 0x58595a20 /* 'XYZ '*/) {
- // ### support PCSLAB
- qCWarning(lcIcc, "Unsupported ICC profile connection space %x", quint32(header.pcs));
+ if (header.pcs != uint(Tag::XYZ_) && header.pcs != uint(Tag::Lab_)) {
+ qCInfo(lcIcc, "Invalid ICC profile connection space 0x%x", quint32(header.pcs));
return false;
}
@@ -255,7 +321,7 @@ static bool isValidIccProfile(const ICCProfileHeader &header)
static int writeColorTrc(QDataStream &stream, const QColorTrc &trc)
{
- if (trc.isLinear()) {
+ if (trc.isIdentity()) {
stream << uint(Tag::curv) << uint(0);
stream << uint(0);
return 12;
@@ -295,6 +361,10 @@ static int writeColorTrc(QDataStream &stream, const QColorTrc &trc)
stream << ushort(trc.m_table.m_table8[i] * 257U);
}
}
+ if (trc.m_table.m_tableSize & 1) {
+ stream << ushort(0);
+ return 12 + 2 * trc.m_table.m_tableSize + 2;
+ }
return 12 + 2 * trc.m_table.m_tableSize;
}
@@ -304,10 +374,21 @@ QByteArray toIccProfile(const QColorSpace &space)
return QByteArray();
const QColorSpacePrivate *spaceDPtr = QColorSpacePrivate::get(space);
+ // This should catch anything not three component matrix based as we can only get that from parsed ICC
+ if (!spaceDPtr->iccProfile.isEmpty())
+ return spaceDPtr->iccProfile;
+ Q_ASSERT(spaceDPtr->isThreeComponentMatrix());
+
+ int fixedLengthTagCount = 5;
+ bool writeChad = false;
+ if (!spaceDPtr->whitePoint.isNull() && spaceDPtr->whitePoint != QColorVector::D50()) {
+ writeChad = true;
+ fixedLengthTagCount++;
+ }
- constexpr int tagCount = 9;
- constexpr uint profileDataOffset = 128 + 4 + 12 * tagCount;
- constexpr uint variableTagTableOffsets = 128 + 4 + 12 * 5;
+ const int tagCount = fixedLengthTagCount + 4;
+ const uint profileDataOffset = 128 + 4 + 12 * tagCount;
+ const uint variableTagTableOffsets = 128 + 4 + 12 * fixedLengthTagCount;
uint currentOffset = 0;
uint rTrcOffset, gTrcOffset, bTrcOffset;
uint rTrcSize, gTrcSize, bTrcSize;
@@ -320,10 +401,10 @@ QByteArray toIccProfile(const QColorSpace &space)
// Profile header:
stream << uint(0); // Size, we will update this later
stream << uint(0);
- stream << uint(0x02400000); // Version 2.4 (note we use 'para' from version 4)
+ stream << uint(0x04400000); // Version 4.4
stream << uint(ProfileClass::Display);
stream << uint(Tag::RGB_);
- stream << uint(Tag::XYZ_);
+ stream << (spaceDPtr->isPcsLab ? uint(Tag::Lab_) : uint(Tag::XYZ_));
stream << uint(0) << uint(0) << uint(0);
stream << uint(Tag::acsp);
stream << uint(0) << uint(0) << uint(0);
@@ -337,19 +418,23 @@ QByteArray toIccProfile(const QColorSpace &space)
stream << uint(0) << uint(0) << uint(0) << uint(0) << uint(0) << uint(0) << uint(0);
// Tag table:
+ currentOffset = profileDataOffset;
stream << uint(tagCount);
stream << uint(Tag::rXYZ) << uint(profileDataOffset + 00) << uint(20);
stream << uint(Tag::gXYZ) << uint(profileDataOffset + 20) << uint(20);
stream << uint(Tag::bXYZ) << uint(profileDataOffset + 40) << uint(20);
stream << uint(Tag::wtpt) << uint(profileDataOffset + 60) << uint(20);
- stream << uint(Tag::cprt) << uint(profileDataOffset + 80) << uint(12);
+ stream << uint(Tag::cprt) << uint(profileDataOffset + 80) << uint(34);
+ currentOffset += 20 + 20 + 20 + 20 + 34 + 2;
+ if (writeChad) {
+ stream << uint(Tag::chad) << uint(currentOffset) << uint(44);
+ currentOffset += 44;
+ }
// From here the offset and size will be updated later:
stream << uint(Tag::rTRC) << uint(0) << uint(0);
stream << uint(Tag::gTRC) << uint(0) << uint(0);
stream << uint(Tag::bTRC) << uint(0) << uint(0);
stream << uint(Tag::desc) << uint(0) << uint(0);
- // TODO: consider adding 'chad' tag (required in ICC >=4 when we have non-D50 whitepoint)
- currentOffset = profileDataOffset;
// Tag data:
stream << uint(Tag::XYZ_) << uint(0);
@@ -368,9 +453,25 @@ QByteArray toIccProfile(const QColorSpace &space)
stream << toFixedS1516(spaceDPtr->whitePoint.x);
stream << toFixedS1516(spaceDPtr->whitePoint.y);
stream << toFixedS1516(spaceDPtr->whitePoint.z);
- stream << uint(Tag::text) << uint(0);
- stream << uint(IccTag('N', '/', 'A', '\0'));
- currentOffset += 92;
+ stream << uint(Tag::mluc) << uint(0);
+ stream << uint(1) << uint(12);
+ stream << uchar('e') << uchar('n') << uchar('U') << uchar('S');
+ stream << uint(6) << uint(28);
+ stream << ushort('N') << ushort('/') << ushort('A');
+ stream << ushort(0); // 4-byte alignment
+ if (writeChad) {
+ QColorMatrix chad = QColorMatrix::chromaticAdaptation(spaceDPtr->whitePoint);
+ stream << uint(Tag::sf32) << uint(0);
+ stream << toFixedS1516(chad.r.x);
+ stream << toFixedS1516(chad.g.x);
+ stream << toFixedS1516(chad.b.x);
+ stream << toFixedS1516(chad.r.y);
+ stream << toFixedS1516(chad.g.y);
+ stream << toFixedS1516(chad.b.y);
+ stream << toFixedS1516(chad.r.z);
+ stream << toFixedS1516(chad.g.z);
+ stream << toFixedS1516(chad.b.z);
+ }
// From now on the data is variable sized:
rTrcOffset = currentOffset;
@@ -393,16 +494,20 @@ QByteArray toIccProfile(const QColorSpace &space)
currentOffset += bTrcSize;
}
+ // Writing description
descOffset = currentOffset;
- QByteArray description = spaceDPtr->description.toUtf8();
- stream << uint(Tag::desc) << uint(0);
- stream << uint(description.size() + 1);
- stream.writeRawData(description.constData(), description.size() + 1);
- stream << uint(0) << uint(0);
- stream << ushort(0) << uchar(0);
- QByteArray macdesc(67, '\0');
- stream.writeRawData(macdesc.constData(), 67);
- descSize = 90 + description.size() + 1;
+ const QString description = space.description();
+ stream << uint(Tag::mluc) << uint(0);
+ stream << uint(1) << uint(12);
+ stream << uchar('e') << uchar('n') << uchar('U') << uchar('S');
+ stream << uint(description.size() * 2) << uint(28);
+ for (QChar ch : description)
+ stream << ushort(ch.unicode());
+ descSize = 28 + description.size() * 2;
+ if (description.size() & 1) {
+ stream << ushort(0);
+ currentOffset += 2;
+ }
currentOffset += descSize;
buffer.close();
@@ -433,49 +538,55 @@ struct TagEntry {
quint32 size;
};
-bool parseXyzData(const QByteArray &data, const TagEntry &tagEntry, QColorVector &colorVector)
+static bool parseXyzData(const QByteArray &data, const TagEntry &tagEntry, QColorVector &colorVector)
{
if (tagEntry.size < sizeof(XYZTagData)) {
qCWarning(lcIcc) << "Undersized XYZ tag";
return false;
}
- const XYZTagData *xyz = reinterpret_cast<const XYZTagData *>(data.constData() + tagEntry.offset);
- if (xyz->type != quint32(Tag::XYZ_)) {
+ const XYZTagData xyz = qFromUnaligned<XYZTagData>(data.constData() + tagEntry.offset);
+ if (xyz.type != quint32(Tag::XYZ_)) {
qCWarning(lcIcc) << "Bad XYZ content type";
return false;
}
- const float x = fromFixedS1516(xyz->fixedX);
- const float y = fromFixedS1516(xyz->fixedY);
- const float z = fromFixedS1516(xyz->fixedZ);
+ const float x = fromFixedS1516(xyz.fixedX);
+ const float y = fromFixedS1516(xyz.fixedY);
+ const float z = fromFixedS1516(xyz.fixedZ);
colorVector = QColorVector(x, y, z);
return true;
}
-bool parseTRC(const QByteArray &data, const TagEntry &tagEntry, QColorTrc &gamma)
+static quint32 parseTRC(const QByteArrayView &tagData, QColorTrc &gamma, QColorTransferTable::Type type = QColorTransferTable::TwoWay)
{
- const GenericTagData *trcData = reinterpret_cast<const GenericTagData *>(data.constData() + tagEntry.offset);
- if (trcData->type == quint32(Tag::curv)) {
- const CurvTagData *curv = static_cast<const CurvTagData *>(trcData);
- if (curv->valueCount > (1 << 16))
- return false;
- if (tagEntry.size - 12 < 2 * curv->valueCount)
- return false;
- if (curv->valueCount == 0) {
+ const GenericTagData trcData = qFromUnaligned<GenericTagData>(tagData.constData());
+ if (trcData.type == quint32(Tag::curv)) {
+ Q_STATIC_ASSERT(sizeof(CurvTagData) == 12);
+ const CurvTagData curv = qFromUnaligned<CurvTagData>(tagData.constData());
+ if (curv.valueCount > (1 << 16))
+ return 0;
+ if (tagData.size() < qsizetype(12 + 2 * curv.valueCount))
+ return 0;
+ const auto valueOffset = sizeof(CurvTagData);
+ if (curv.valueCount == 0) {
gamma.m_type = QColorTrc::Type::Function;
gamma.m_fun = QColorTransferFunction(); // Linear
- } else if (curv->valueCount == 1) {
- float g = curv->value[0] * (1.0f / 256.0f);
+ } else if (curv.valueCount == 1) {
+ const quint16 v = qFromBigEndian<quint16>(tagData.constData() + valueOffset);
gamma.m_type = QColorTrc::Type::Function;
- gamma.m_fun = QColorTransferFunction::fromGamma(g);
+ gamma.m_fun = QColorTransferFunction::fromGamma(v * (1.0f / 256.0f));
} else {
- QVector<quint16> tabl;
- tabl.resize(curv->valueCount);
- for (uint i = 0; i < curv->valueCount; ++i)
- tabl[i] = curv->value[i];
- QColorTransferTable table = QColorTransferTable(curv->valueCount, std::move(tabl));
+ QList<quint16> tabl;
+ tabl.resize(curv.valueCount);
+ static_assert(sizeof(GenericTagData) == 2 * sizeof(quint32_be),
+ "GenericTagData has padding. The following code is a subject to UB.");
+ qFromBigEndian<quint16>(tagData.constData() + valueOffset, curv.valueCount, tabl.data());
+ QColorTransferTable table(curv.valueCount, tabl, type);
QColorTransferFunction curve;
- if (!table.asColorTransferFunction(&curve)) {
+ if (!table.checkValidity()) {
+ qCWarning(lcIcc) << "Invalid curv table";
+ return 0;
+ } else if (!table.asColorTransferFunction(&curve)) {
gamma.m_type = QColorTrc::Type::Table;
gamma.m_table = table;
} else {
@@ -484,189 +595,521 @@ bool parseTRC(const QByteArray &data, const TagEntry &tagEntry, QColorTrc &gamma
gamma.m_fun = curve;
}
}
- return true;
+ return 12 + 2 * curv.valueCount;
}
- if (trcData->type == quint32(Tag::para)) {
- if (tagEntry.size < sizeof(ParaTagData))
- return false;
- const ParaTagData *para = static_cast<const ParaTagData *>(trcData);
- switch (para->curveType) {
+ if (trcData.type == quint32(Tag::para)) {
+ Q_STATIC_ASSERT(sizeof(ParaTagData) == 12);
+ const ParaTagData para = qFromUnaligned<ParaTagData>(tagData.constData());
+ const auto parametersOffset = sizeof(ParaTagData);
+ quint32 parameters[7];
+ switch (para.curveType) {
case 0: {
- float g = fromFixedS1516(para->parameter[0]);
+ if (tagData.size() < 12 + 1 * 4)
+ return 0;
+ qFromBigEndian<quint32>(tagData.constData() + parametersOffset, 1, parameters);
+ float g = fromFixedS1516(parameters[0]);
gamma.m_type = QColorTrc::Type::Function;
gamma.m_fun = QColorTransferFunction::fromGamma(g);
- break;
+ return 12 + 1 * 4;
}
case 1: {
- if (tagEntry.size < sizeof(ParaTagData) + 2 * 4)
- return false;
- float g = fromFixedS1516(para->parameter[0]);
- float a = fromFixedS1516(para->parameter[1]);
- float b = fromFixedS1516(para->parameter[2]);
+ if (tagData.size() < 12 + 3 * 4)
+ return 0;
+ qFromBigEndian<quint32>(tagData.constData() + parametersOffset, 3, parameters);
+ if (parameters[1] == 0)
+ return 0;
+ float g = fromFixedS1516(parameters[0]);
+ float a = fromFixedS1516(parameters[1]);
+ float b = fromFixedS1516(parameters[2]);
float d = -b / a;
gamma.m_type = QColorTrc::Type::Function;
gamma.m_fun = QColorTransferFunction(a, b, 0.0f, d, 0.0f, 0.0f, g);
- break;
+ return 12 + 3 * 4;
}
case 2: {
- if (tagEntry.size < sizeof(ParaTagData) + 3 * 4)
- return false;
- float g = fromFixedS1516(para->parameter[0]);
- float a = fromFixedS1516(para->parameter[1]);
- float b = fromFixedS1516(para->parameter[2]);
- float c = fromFixedS1516(para->parameter[3]);
+ if (tagData.size() < 12 + 4 * 4)
+ return 0;
+ qFromBigEndian<quint32>(tagData.constData() + parametersOffset, 4, parameters);
+ if (parameters[1] == 0)
+ return 0;
+ float g = fromFixedS1516(parameters[0]);
+ float a = fromFixedS1516(parameters[1]);
+ float b = fromFixedS1516(parameters[2]);
+ float c = fromFixedS1516(parameters[3]);
float d = -b / a;
gamma.m_type = QColorTrc::Type::Function;
gamma.m_fun = QColorTransferFunction(a, b, 0.0f, d, c, c, g);
- break;
+ return 12 + 4 * 4;
}
case 3: {
- if (tagEntry.size < sizeof(ParaTagData) + 4 * 4)
- return false;
- float g = fromFixedS1516(para->parameter[0]);
- float a = fromFixedS1516(para->parameter[1]);
- float b = fromFixedS1516(para->parameter[2]);
- float c = fromFixedS1516(para->parameter[3]);
- float d = fromFixedS1516(para->parameter[4]);
+ if (tagData.size() < 12 + 5 * 4)
+ return 0;
+ qFromBigEndian<quint32>(tagData.constData() + parametersOffset, 5, parameters);
+ float g = fromFixedS1516(parameters[0]);
+ float a = fromFixedS1516(parameters[1]);
+ float b = fromFixedS1516(parameters[2]);
+ float c = fromFixedS1516(parameters[3]);
+ float d = fromFixedS1516(parameters[4]);
gamma.m_type = QColorTrc::Type::Function;
gamma.m_fun = QColorTransferFunction(a, b, c, d, 0.0f, 0.0f, g);
- break;
+ return 12 + 5 * 4;
}
case 4: {
- if (tagEntry.size < sizeof(ParaTagData) + 6 * 4)
- return false;
- float g = fromFixedS1516(para->parameter[0]);
- float a = fromFixedS1516(para->parameter[1]);
- float b = fromFixedS1516(para->parameter[2]);
- float c = fromFixedS1516(para->parameter[3]);
- float d = fromFixedS1516(para->parameter[4]);
- float e = fromFixedS1516(para->parameter[5]);
- float f = fromFixedS1516(para->parameter[6]);
+ if (tagData.size() < 12 + 7 * 4)
+ return 0;
+ qFromBigEndian<quint32>(tagData.constData() + parametersOffset, 7, parameters);
+ float g = fromFixedS1516(parameters[0]);
+ float a = fromFixedS1516(parameters[1]);
+ float b = fromFixedS1516(parameters[2]);
+ float c = fromFixedS1516(parameters[3]);
+ float d = fromFixedS1516(parameters[4]);
+ float e = fromFixedS1516(parameters[5]);
+ float f = fromFixedS1516(parameters[6]);
gamma.m_type = QColorTrc::Type::Function;
gamma.m_fun = QColorTransferFunction(a, b, c, d, e, f, g);
- break;
+ return 12 + 7 * 4;
}
default:
- qCWarning(lcIcc) << "Unknown para type" << uint(para->curveType);
- return false;
+ qCWarning(lcIcc) << "Unknown para type" << uint(para.curveType);
+ return 0;
}
return true;
}
- qCWarning(lcIcc) << "Invalid TRC data type";
- return false;
+ qCWarning(lcIcc) << "Invalid TRC data type" << Qt::hex << trcData.type;
+ return 0;
}
-bool parseDesc(const QByteArray &data, const TagEntry &tagEntry, QString &descName)
+template<typename T>
+static void parseCLUT(const T *tableData, const float f, QColorCLUT *clut, uchar outputChannels)
{
- const GenericTagData *tag = (const GenericTagData *)(data.constData() + tagEntry.offset);
+ if (outputChannels == 4) {
+ for (qsizetype index = 0; index < clut->table.size(); ++index) {
+ QColorVector v(tableData[index * 4 + 0] * f,
+ tableData[index * 4 + 1] * f,
+ tableData[index * 4 + 2] * f,
+ tableData[index * 4 + 3] * f);
+ clut->table[index] = v;
+ };
+ } else {
+ for (qsizetype index = 0; index < clut->table.size(); ++index) {
+ QColorVector v(tableData[index * 3 + 0] * f,
+ tableData[index * 3 + 1] * f,
+ tableData[index * 3 + 2] * f);
+ clut->table[index] = v;
+ };
+ }
+}
- // Either 'desc' (ICCv2) or 'mluc' (ICCv4)
- if (tag->type == quint32(Tag::desc)) {
- if (tagEntry.size < sizeof(DescTagData))
- return false;
- const DescTagData *desc = (const DescTagData *)(data.constData() + tagEntry.offset);
- const quint32 len = desc->asciiDescriptionLength;
- if (len < 1)
+// very simple version for small values (<=4) of exp.
+static constexpr qsizetype intPow(qsizetype x, qsizetype exp)
+{
+ return (exp <= 1) ? x : x * intPow(x, exp - 1);
+}
+
+// Parses lut8 and lut16 type elements
+template<typename T>
+static bool parseLutData(const QByteArray &data, const TagEntry &tagEntry, QColorSpacePrivate *colorSpacePrivate, bool isAb)
+{
+ if (tagEntry.size < sizeof(T)) {
+ qCWarning(lcIcc) << "Undersized lut8/lut16 tag";
+ return false;
+ }
+ if (qsizetype(tagEntry.size) > data.size()) {
+ qCWarning(lcIcc) << "Truncated lut8/lut16 tag";
+ return false;
+ }
+ using S = std::conditional_t<std::is_same_v<T, Lut8TagData>, uint8_t, uint16_t>;
+ const T lut = qFromUnaligned<T>(data.constData() + tagEntry.offset);
+ int inputTableEntries, outputTableEntries, precision;
+ if constexpr (std::is_same_v<T, Lut8TagData>) {
+ Q_ASSERT(lut.type == quint32(Tag::mft1));
+ if (!colorSpacePrivate->isPcsLab && isAb) {
+ qCWarning(lcIcc) << "Lut8 can not output XYZ values";
return false;
- if (tagEntry.size - 12 < len)
+ }
+ inputTableEntries = 256;
+ outputTableEntries = 256;
+ precision = 1;
+ } else {
+ Q_ASSERT(lut.type == quint32(Tag::mft2));
+ inputTableEntries = lut.inputTableEntries;
+ outputTableEntries = lut.outputTableEntries;
+ if (inputTableEntries < 2 || inputTableEntries > 4096)
return false;
- if (desc->asciiDescription[len - 1] != '\0')
+ if (outputTableEntries < 2 || outputTableEntries > 4096)
return false;
- descName = QString::fromLatin1(desc->asciiDescription, len - 1);
- return true;
+ precision = 2;
}
- if (tag->type != quint32(Tag::mluc))
- return false;
- if (tagEntry.size < sizeof(MlucTagData))
+ bool inTableIsLinear = true, outTableIsLinear = true;
+ QColorSpacePrivate::TransferElement inTableElement;
+ QColorSpacePrivate::TransferElement outTableElement;
+ QColorCLUT clutElement;
+ QColorMatrix matrixElement;
+
+ matrixElement.r.x = fromFixedS1516(lut.e1);
+ matrixElement.g.x = fromFixedS1516(lut.e2);
+ matrixElement.b.x = fromFixedS1516(lut.e3);
+ matrixElement.r.y = fromFixedS1516(lut.e4);
+ matrixElement.g.y = fromFixedS1516(lut.e5);
+ matrixElement.b.y = fromFixedS1516(lut.e6);
+ matrixElement.r.z = fromFixedS1516(lut.e7);
+ matrixElement.g.z = fromFixedS1516(lut.e8);
+ matrixElement.b.z = fromFixedS1516(lut.e9);
+ if (!colorSpacePrivate->isPcsLab && !isAb && !matrixElement.isValid()) {
+ qCWarning(lcIcc) << "Invalid matrix values in lut8/lut16";
return false;
- const MlucTagData *mluc = (const MlucTagData *)(data.constData() + tagEntry.offset);
- if (mluc->recordCount < 1)
+ }
+
+ if (lut.inputChannels != 3 && !(isAb && colorSpacePrivate->colorModel == QColorSpace::ColorModel::Cmyk && lut.inputChannels == 4)) {
+ qCWarning(lcIcc) << "Unsupported lut8/lut16 input channel count" << lut.inputChannels;
return false;
- if (mluc->recordSize < 12)
+ }
+
+ if (lut.outputChannels != 3 && !(!isAb && colorSpacePrivate->colorModel == QColorSpace::ColorModel::Cmyk && lut.outputChannels == 4)) {
+ qCWarning(lcIcc) << "Unsupported lut8/lut16 output channel count" << lut.outputChannels;
return false;
- // We just use the primary record regardless of language or country.
- const quint32 stringOffset = mluc->records[0].offset;
- const quint32 stringSize = mluc->records[0].size;
- if (tagEntry.size < stringOffset || tagEntry.size - stringOffset < stringSize )
+ }
+
+ const qsizetype clutTableSize = intPow(lut.clutGridPoints, lut.inputChannels);
+ if (tagEntry.size < (sizeof(T) + precision * lut.inputChannels * inputTableEntries
+ + precision * lut.outputChannels * outputTableEntries
+ + precision * lut.outputChannels * clutTableSize)) {
+ qCWarning(lcIcc) << "Undersized lut8/lut16 tag, no room for tables";
return false;
- if ((stringSize | stringOffset) & 1)
+ }
+ if (colorSpacePrivate->colorModel == QColorSpace::ColorModel::Cmyk && clutTableSize == 0) {
+ qCWarning(lcIcc) << "Cmyk conversion must have a CLUT";
return false;
- quint32 stringLen = stringSize / 2;
- const ushort *unicodeString = (const ushort *)(data.constData() + tagEntry.offset + stringOffset);
- // The given length shouldn't include 0-termination, but might.
- if (stringLen > 1 && unicodeString[stringLen - 1] == 0)
- --stringLen;
- QVarLengthArray<quint16> utf16hostendian(stringLen);
- qFromBigEndian<ushort>(unicodeString, stringLen, utf16hostendian.data());
- descName = QString::fromUtf16(utf16hostendian.data(), stringLen);
+ }
+
+ const uint8_t *tableData = reinterpret_cast<const uint8_t *>(data.constData() + tagEntry.offset + sizeof(T));
+
+ for (int j = 0; j < lut.inputChannels; ++j) {
+ QList<S> input(inputTableEntries);
+ qFromBigEndian<S>(tableData, inputTableEntries, input.data());
+ QColorTransferTable table(inputTableEntries, input, QColorTransferTable::OneWay);
+ if (!table.checkValidity()) {
+ qCWarning(lcIcc) << "Bad input table in lut8/lut16";
+ return false;
+ }
+ if (!table.isIdentity())
+ inTableIsLinear = false;
+ inTableElement.trc[j] = std::move(table);
+ tableData += inputTableEntries * precision;
+ }
+
+ clutElement.table.resize(clutTableSize);
+ clutElement.gridPointsX = clutElement.gridPointsY = clutElement.gridPointsZ = lut.clutGridPoints;
+ if (lut.inputChannels == 4)
+ clutElement.gridPointsW = lut.clutGridPoints;
+
+ if constexpr (std::is_same_v<T, Lut8TagData>) {
+ parseCLUT(tableData, 1.f / 255.f, &clutElement, lut.outputChannels);
+ } else {
+ float f = 1.0f / 65535.f;
+ if (colorSpacePrivate->isPcsLab && isAb) // Legacy lut16 conversion to Lab
+ f = 1.0f / 65280.f;
+ QList<S> clutTable(clutTableSize * lut.outputChannels);
+ qFromBigEndian<S>(tableData, clutTable.size(), clutTable.data());
+ parseCLUT(clutTable.constData(), f, &clutElement, lut.outputChannels);
+ }
+ tableData += clutTableSize * lut.outputChannels * precision;
+
+ for (int j = 0; j < lut.outputChannels; ++j) {
+ QList<S> output(outputTableEntries);
+ qFromBigEndian<S>(tableData, outputTableEntries, output.data());
+ QColorTransferTable table(outputTableEntries, output, QColorTransferTable::OneWay);
+ if (!table.checkValidity()) {
+ qCWarning(lcIcc) << "Bad output table in lut8/lut16";
+ return false;
+ }
+ if (!table.isIdentity())
+ outTableIsLinear = false;
+ outTableElement.trc[j] = std::move(table);
+ tableData += outputTableEntries * precision;
+ }
+
+ if (isAb) {
+ if (!inTableIsLinear)
+ colorSpacePrivate->mAB.append(inTableElement);
+ if (!clutElement.isEmpty())
+ colorSpacePrivate->mAB.append(clutElement);
+ if (!outTableIsLinear || colorSpacePrivate->mAB.isEmpty())
+ colorSpacePrivate->mAB.append(outTableElement);
+ } else {
+ // The matrix is only to be applied if the input color-space is XYZ
+ if (!colorSpacePrivate->isPcsLab && !matrixElement.isIdentity())
+ colorSpacePrivate->mBA.append(matrixElement);
+ if (!inTableIsLinear)
+ colorSpacePrivate->mBA.append(inTableElement);
+ if (!clutElement.isEmpty())
+ colorSpacePrivate->mBA.append(clutElement);
+ if (!outTableIsLinear || colorSpacePrivate->mBA.isEmpty())
+ colorSpacePrivate->mBA.append(outTableElement);
+ }
return true;
}
-bool fromIccProfile(const QByteArray &data, QColorSpace *colorSpace)
+// Parses mAB and mBA type elements
+static bool parseMabData(const QByteArray &data, const TagEntry &tagEntry, QColorSpacePrivate *colorSpacePrivate, bool isAb)
{
- if (data.size() < qsizetype(sizeof(ICCProfileHeader))) {
- qCWarning(lcIcc) << "fromIccProfile: failed size sanity 1";
+ if (tagEntry.size < sizeof(mABTagData)) {
+ qCWarning(lcIcc) << "Undersized mAB/mBA tag";
return false;
}
- const ICCProfileHeader *header = (const ICCProfileHeader *)data.constData();
- if (!isValidIccProfile(*header)) {
- qCWarning(lcIcc) << "fromIccProfile: failed general sanity check";
+ if (qsizetype(tagEntry.size) > data.size()) {
+ qCWarning(lcIcc) << "Truncated mAB/mBA tag";
return false;
}
- if (qsizetype(header->profileSize) > data.size()) {
- qCWarning(lcIcc) << "fromIccProfile: failed size sanity 2";
+ const mABTagData mab = qFromUnaligned<mABTagData>(data.constData() + tagEntry.offset);
+ if ((mab.type != quint32(Tag::mAB_) && isAb) || (mab.type != quint32(Tag::mBA_) && !isAb)){
+ qCWarning(lcIcc) << "Bad mAB/mBA content type";
return false;
}
- // Read tag index
- const TagTableEntry *tagTable = (const TagTableEntry *)(data.constData() + sizeof(ICCProfileHeader));
- const qsizetype offsetToData = sizeof(ICCProfileHeader) + header->tagCount * sizeof(TagTableEntry);
- if (offsetToData > data.size()) {
- qCWarning(lcIcc) << "fromIccProfile: failed index size sanity";
+ if (mab.inputChannels != 3 && !(isAb && colorSpacePrivate->colorModel == QColorSpace::ColorModel::Cmyk && mab.inputChannels == 4)) {
+ qCWarning(lcIcc) << "Unsupported mAB/mBA input channel count" << mab.inputChannels;
return false;
}
- QHash<Tag, TagEntry> tagIndex;
- for (uint i = 0; i < header->tagCount; ++i) {
- // Sanity check tag sizes and offsets:
- if (qsizetype(tagTable[i].offset) < offsetToData) {
- qCWarning(lcIcc) << "fromIccProfile: failed tag offset sanity 1";
+ if (mab.outputChannels != 3 && !(!isAb && colorSpacePrivate->colorModel == QColorSpace::ColorModel::Cmyk && mab.outputChannels == 4)) {
+ qCWarning(lcIcc) << "Unsupported mAB/mBA output channel count" << mab.outputChannels;
+ return false;
+ }
+
+ // These combinations are legal: B, M + Matrix + B, A + Clut + B, A + Clut + M + Matrix + B
+ if (!mab.bCurvesOffset) {
+ qCWarning(lcIcc) << "Illegal mAB/mBA without B table";
+ return false;
+ }
+ if (((bool)mab.matrixOffset != (bool)mab.mCurvesOffset) ||
+ ((bool)mab.aCurvesOffset != (bool)mab.clutOffset)) {
+ qCWarning(lcIcc) << "Illegal mAB/mBA element combination";
+ return false;
+ }
+
+ if (mab.aCurvesOffset > (tagEntry.size - 3 * sizeof(GenericTagData)) ||
+ mab.bCurvesOffset > (tagEntry.size - 3 * sizeof(GenericTagData)) ||
+ mab.mCurvesOffset > (tagEntry.size - 3 * sizeof(GenericTagData)) ||
+ mab.matrixOffset > (tagEntry.size - 4 * 12) ||
+ mab.clutOffset > (tagEntry.size - 20)) {
+ qCWarning(lcIcc) << "Illegal mAB/mBA element offset";
+ return false;
+ }
+
+ QColorSpacePrivate::TransferElement bTableElement;
+ QColorSpacePrivate::TransferElement aTableElement;
+ QColorCLUT clutElement;
+ QColorSpacePrivate::TransferElement mTableElement;
+ QColorMatrix matrixElement;
+ QColorVector offsetElement;
+
+ auto parseCurves = [&data, &tagEntry] (uint curvesOffset, QColorTrc *table, int channels) {
+ for (int i = 0; i < channels; ++i) {
+ if (qsizetype(tagEntry.offset + curvesOffset + 12) > data.size() || curvesOffset + 12 > tagEntry.size) {
+ qCWarning(lcIcc) << "Space missing for channel curves in mAB/mBA";
+ return false;
+ }
+ auto size = parseTRC(QByteArrayView(data).sliced(tagEntry.offset + curvesOffset, tagEntry.size - curvesOffset), table[i], QColorTransferTable::OneWay);
+ if (!size)
+ return false;
+ if (size & 2) size += 2; // possible padding
+ curvesOffset += size;
+ }
+ return true;
+ };
+
+ bool bCurvesAreLinear = true, aCurvesAreLinear = true, mCurvesAreLinear = true;
+
+ // B Curves
+ if (!parseCurves(mab.bCurvesOffset, bTableElement.trc, isAb ? mab.outputChannels : mab.inputChannels)) {
+ qCWarning(lcIcc) << "Invalid B curves";
+ return false;
+ } else {
+ bCurvesAreLinear = bTableElement.trc[0].isIdentity() && bTableElement.trc[1].isIdentity() && bTableElement.trc[2].isIdentity();
+ }
+
+ // A Curves
+ if (mab.aCurvesOffset) {
+ if (!parseCurves(mab.aCurvesOffset, aTableElement.trc, isAb ? mab.inputChannels : mab.outputChannels)) {
+ qCWarning(lcIcc) << "Invalid A curves";
return false;
+ } else {
+ aCurvesAreLinear = aTableElement.trc[0].isIdentity() && aTableElement.trc[1].isIdentity() && aTableElement.trc[2].isIdentity();
}
- // Checked separately from (+ size) to handle overflow.
- if (tagTable[i].offset > header->profileSize) {
- qCWarning(lcIcc) << "fromIccProfile: failed tag offset sanity 2";
+ }
+
+ // M Curves
+ if (mab.mCurvesOffset) {
+ if (!parseCurves(mab.mCurvesOffset, mTableElement.trc, 3)) {
+ qCWarning(lcIcc) << "Invalid M curves";
return false;
+ } else {
+ mCurvesAreLinear = mTableElement.trc[0].isIdentity() && mTableElement.trc[1].isIdentity() && mTableElement.trc[2].isIdentity();
}
- if (tagTable[i].size < 12) {
- qCWarning(lcIcc) << "fromIccProfile: failed minimal tag size sanity";
+ }
+
+ // Matrix
+ if (mab.matrixOffset) {
+ const MatrixElement matrix = qFromUnaligned<MatrixElement>(data.constData() + tagEntry.offset + mab.matrixOffset);
+ matrixElement.r.x = fromFixedS1516(matrix.e0);
+ matrixElement.g.x = fromFixedS1516(matrix.e1);
+ matrixElement.b.x = fromFixedS1516(matrix.e2);
+ matrixElement.r.y = fromFixedS1516(matrix.e3);
+ matrixElement.g.y = fromFixedS1516(matrix.e4);
+ matrixElement.b.y = fromFixedS1516(matrix.e5);
+ matrixElement.r.z = fromFixedS1516(matrix.e6);
+ matrixElement.g.z = fromFixedS1516(matrix.e7);
+ matrixElement.b.z = fromFixedS1516(matrix.e8);
+ offsetElement.x = fromFixedS1516(matrix.e9);
+ offsetElement.y = fromFixedS1516(matrix.e10);
+ offsetElement.z = fromFixedS1516(matrix.e11);
+ if (!matrixElement.isValid() || !offsetElement.isValid()) {
+ qCWarning(lcIcc) << "Invalid matrix values in mAB/mBA element";
return false;
}
- if (tagTable[i].size > header->profileSize - tagTable[i].offset) {
- qCWarning(lcIcc) << "fromIccProfile: failed tag offset + size sanity";
+ }
+
+ // CLUT
+ if (mab.clutOffset) {
+ clutElement.gridPointsX = uint8_t(data[tagEntry.offset + mab.clutOffset]);
+ clutElement.gridPointsY = uint8_t(data[tagEntry.offset + mab.clutOffset + 1]);
+ clutElement.gridPointsZ = uint8_t(data[tagEntry.offset + mab.clutOffset + 2]);
+ clutElement.gridPointsW = std::max(uint8_t(data[tagEntry.offset + mab.clutOffset + 3]), uint8_t(1));
+ const uchar precision = data[tagEntry.offset + mab.clutOffset + 16];
+ if (precision > 2 || precision < 1) {
+ qCWarning(lcIcc) << "Invalid mAB/mBA element CLUT precision";
return false;
}
- if (tagTable[i].offset & 0x03) {
- qCWarning(lcIcc) << "fromIccProfile: invalid tag offset alignment";
+ if (clutElement.gridPointsX < 2 || clutElement.gridPointsY < 2 || clutElement.gridPointsZ < 2) {
+ qCWarning(lcIcc) << "Empty CLUT";
+ return false;
+ }
+ const qsizetype clutTableSize = clutElement.gridPointsX * clutElement.gridPointsY * clutElement.gridPointsZ * clutElement.gridPointsW;
+ if ((mab.clutOffset + 20 + clutTableSize * mab.outputChannels * precision) > tagEntry.size) {
+ qCWarning(lcIcc) << "CLUT oversized for tag";
return false;
}
-// printf("'%4s' %d %d\n", (const char *)&tagTable[i].signature,
-// quint32(tagTable[i].offset),
-// quint32(tagTable[i].size));
- tagIndex.insert(Tag(quint32(tagTable[i].signature)), { tagTable[i].offset, tagTable[i].size });
- }
- // Check the profile is three-component matrix based (what we currently support):
- if (!tagIndex.contains(Tag::rXYZ) || !tagIndex.contains(Tag::gXYZ) || !tagIndex.contains(Tag::bXYZ) ||
- !tagIndex.contains(Tag::rTRC) || !tagIndex.contains(Tag::gTRC) || !tagIndex.contains(Tag::bTRC) ||
- !tagIndex.contains(Tag::wtpt)) {
- qCWarning(lcIcc) << "fromIccProfile: Unsupported ICC profile - not three component matrix based";
+ clutElement.table.resize(clutTableSize);
+ if (precision == 2) {
+ QList<uint16_t> clutTable(clutTableSize * mab.outputChannels);
+ qFromBigEndian<uint16_t>(data.constData() + tagEntry.offset + mab.clutOffset + 20, clutTable.size(), clutTable.data());
+ parseCLUT(clutTable.constData(), (1.f/65535.f), &clutElement, mab.outputChannels);
+ } else {
+ const uint8_t *clutTable = reinterpret_cast<const uint8_t *>(data.constData() + tagEntry.offset + mab.clutOffset + 20);
+ parseCLUT(clutTable, (1.f/255.f), &clutElement, mab.outputChannels);
+ }
+ } else if (colorSpacePrivate->colorModel == QColorSpace::ColorModel::Cmyk) {
+ qCWarning(lcIcc) << "Cmyk conversion must have a CLUT";
return false;
}
- QColorSpacePrivate *colorspaceDPtr = QColorSpacePrivate::getWritable(*colorSpace);
+ if (isAb) {
+ if (mab.aCurvesOffset) {
+ if (!aCurvesAreLinear)
+ colorSpacePrivate->mAB.append(std::move(aTableElement));
+ if (!clutElement.isEmpty())
+ colorSpacePrivate->mAB.append(std::move(clutElement));
+ }
+ if (mab.mCurvesOffset && mab.outputChannels == 3) {
+ if (!mCurvesAreLinear)
+ colorSpacePrivate->mAB.append(std::move(mTableElement));
+ if (!matrixElement.isIdentity())
+ colorSpacePrivate->mAB.append(std::move(matrixElement));
+ if (!offsetElement.isNull())
+ colorSpacePrivate->mAB.append(std::move(offsetElement));
+ }
+ if (!bCurvesAreLinear|| colorSpacePrivate->mAB.isEmpty())
+ colorSpacePrivate->mAB.append(std::move(bTableElement));
+ } else {
+ if (!bCurvesAreLinear)
+ colorSpacePrivate->mBA.append(std::move(bTableElement));
+ if (mab.mCurvesOffset && mab.inputChannels == 3) {
+ if (!matrixElement.isIdentity())
+ colorSpacePrivate->mBA.append(std::move(matrixElement));
+ if (!offsetElement.isNull())
+ colorSpacePrivate->mBA.append(std::move(offsetElement));
+ if (!mCurvesAreLinear)
+ colorSpacePrivate->mBA.append(std::move(mTableElement));
+ }
+ if (mab.aCurvesOffset) {
+ if (!clutElement.isEmpty())
+ colorSpacePrivate->mBA.append(std::move(clutElement));
+ if (!aCurvesAreLinear)
+ colorSpacePrivate->mBA.append(std::move(aTableElement));
+ }
+ if (colorSpacePrivate->mBA.isEmpty()) // Ensure non-empty to indicate valid empty transform
+ colorSpacePrivate->mBA.append(std::move(bTableElement));
+ }
+
+ return true;
+}
+static bool parseA2B(const QByteArray &data, const TagEntry &tagEntry, QColorSpacePrivate *privat, bool isAb)
+{
+ const GenericTagData a2bData = qFromUnaligned<GenericTagData>(data.constData() + tagEntry.offset);
+ if (a2bData.type == quint32(Tag::mft1))
+ return parseLutData<Lut8TagData>(data, tagEntry, privat, isAb);
+ else if (a2bData.type == quint32(Tag::mft2))
+ return parseLutData<Lut16TagData>(data, tagEntry, privat, isAb);
+ else if (a2bData.type == quint32(Tag::mAB_) || a2bData.type == quint32(Tag::mBA_))
+ return parseMabData(data, tagEntry, privat, isAb);
+
+ qCWarning(lcIcc) << "fromIccProfile: Unknown A2B/B2A data type";
+ return false;
+}
+
+static bool parseDesc(const QByteArray &data, const TagEntry &tagEntry, QString &descName)
+{
+ const GenericTagData tag = qFromUnaligned<GenericTagData>(data.constData() + tagEntry.offset);
+
+ // Either 'desc' (ICCv2) or 'mluc' (ICCv4)
+ if (tag.type == quint32(Tag::desc)) {
+ Q_STATIC_ASSERT(sizeof(DescTagData) == 12);
+ const DescTagData desc = qFromUnaligned<DescTagData>(data.constData() + tagEntry.offset);
+ const quint32 len = desc.asciiDescriptionLength;
+ if (len < 1)
+ return false;
+ if (tagEntry.size - 12 < len)
+ return false;
+ const char *asciiDescription = data.constData() + tagEntry.offset + sizeof(DescTagData);
+ if (asciiDescription[len - 1] != '\0')
+ return false;
+ descName = QString::fromLatin1(asciiDescription, len - 1);
+ return true;
+ }
+ if (tag.type != quint32(Tag::mluc))
+ return false;
+
+ if (tagEntry.size < sizeof(MlucTagData))
+ return false;
+ const MlucTagData mluc = qFromUnaligned<MlucTagData>(data.constData() + tagEntry.offset);
+ if (mluc.recordCount < 1)
+ return false;
+ if (mluc.recordSize != 12)
+ return false;
+ // We just use the primary record regardless of language or country.
+ const quint32 stringOffset = mluc.records[0].offset;
+ const quint32 stringSize = mluc.records[0].size;
+ if (tagEntry.size < stringOffset || tagEntry.size - stringOffset < stringSize )
+ return false;
+ if ((stringSize | stringOffset) & 1)
+ return false;
+ quint32 stringLen = stringSize / 2;
+ QVarLengthArray<char16_t> utf16hostendian(stringLen);
+ qFromBigEndian<char16_t>(data.constData() + tagEntry.offset + stringOffset, stringLen,
+ utf16hostendian.data());
+ // The given length shouldn't include 0-termination, but might.
+ if (stringLen > 1 && utf16hostendian[stringLen - 1] == 0)
+ --stringLen;
+ descName = QString::fromUtf16(utf16hostendian.data(), stringLen);
+ return true;
+}
+
+static bool parseRgbMatrix(const QByteArray &data, const QHash<Tag, TagEntry> &tagIndex, QColorSpacePrivate *colorspaceDPtr)
+{
// Parse XYZ tags
if (!parseXyzData(data, tagIndex[Tag::rXYZ], colorspaceDPtr->toXyz.r))
return false;
@@ -676,6 +1119,10 @@ bool fromIccProfile(const QByteArray &data, QColorSpace *colorSpace)
return false;
if (!parseXyzData(data, tagIndex[Tag::wtpt], colorspaceDPtr->whitePoint))
return false;
+ if (!colorspaceDPtr->toXyz.isValid() || !colorspaceDPtr->whitePoint.isValid() || colorspaceDPtr->whitePoint.isNull()) {
+ qCWarning(lcIcc) << "Invalid XYZ values in RGB matrix";
+ return false;
+ }
colorspaceDPtr->primaries = QColorSpace::Primaries::Custom;
if (colorspaceDPtr->toXyz == QColorMatrix::toXyzFromSRgb()) {
@@ -692,15 +1139,61 @@ bool fromIccProfile(const QByteArray &data, QColorSpace *colorSpace)
qCDebug(lcIcc) << "fromIccProfile: ProPhoto RGB primaries detected";
colorspaceDPtr->primaries = QColorSpace::Primaries::ProPhotoRgb;
}
- // Reset the matrix to our canonical values:
- if (colorspaceDPtr->primaries != QColorSpace::Primaries::Custom)
- colorspaceDPtr->setToXyzMatrix();
+ return true;
+}
+
+static bool parseGrayMatrix(const QByteArray &data, const QHash<Tag, TagEntry> &tagIndex, QColorSpacePrivate *colorspaceDPtr)
+{
+ QColorVector whitePoint;
+ if (!parseXyzData(data, tagIndex[Tag::wtpt], whitePoint))
+ return false;
+ if (!whitePoint.isValid() || !qFuzzyCompare(whitePoint.y, 1.0f) || (1.0f + whitePoint.z + whitePoint.x) == 0.0f) {
+ qCWarning(lcIcc) << "fromIccProfile: Invalid ICC profile - gray white-point not normalized";
+ return false;
+ }
+ colorspaceDPtr->primaries = QColorSpace::Primaries::Custom;
+ colorspaceDPtr->whitePoint = whitePoint;
+ return true;
+}
- // Parse TRC tags
+static bool parseChad(const QByteArray &data, const TagEntry &tagEntry, QColorSpacePrivate *colorspaceDPtr)
+{
+ if (tagEntry.size < sizeof(Sf32TagData) || qsizetype(tagEntry.size) > data.size())
+ return false;
+ const Sf32TagData chadtag = qFromUnaligned<Sf32TagData>(data.constData() + tagEntry.offset);
+ if (chadtag.type != uint32_t(Tag::sf32)) {
+ qCWarning(lcIcc, "fromIccProfile: bad chad data type");
+ return false;
+ }
+ QColorMatrix chad;
+ chad.r.x = fromFixedS1516(chadtag.value[0]);
+ chad.g.x = fromFixedS1516(chadtag.value[1]);
+ chad.b.x = fromFixedS1516(chadtag.value[2]);
+ chad.r.y = fromFixedS1516(chadtag.value[3]);
+ chad.g.y = fromFixedS1516(chadtag.value[4]);
+ chad.b.y = fromFixedS1516(chadtag.value[5]);
+ chad.r.z = fromFixedS1516(chadtag.value[6]);
+ chad.g.z = fromFixedS1516(chadtag.value[7]);
+ chad.b.z = fromFixedS1516(chadtag.value[8]);
+
+ if (!chad.isValid()) {
+ qCWarning(lcIcc, "fromIccProfile: invalid chad matrix");
+ return false;
+ }
+ colorspaceDPtr->chad = chad;
+ return true;
+}
+
+static bool parseTRCs(const QByteArray &data, const QHash<Tag, TagEntry> &tagIndex, QColorSpacePrivate *colorspaceDPtr, bool isColorSpaceTypeGray)
+{
TagEntry rTrc;
TagEntry gTrc;
TagEntry bTrc;
- if (tagIndex.contains(Tag::aarg) && tagIndex.contains(Tag::aagg) && tagIndex.contains(Tag::aabg)) {
+ if (isColorSpaceTypeGray) {
+ rTrc = tagIndex[Tag::kTRC];
+ gTrc = tagIndex[Tag::kTRC];
+ bTrc = tagIndex[Tag::kTRC];
+ } else if (tagIndex.contains(Tag::aarg) && tagIndex.contains(Tag::aagg) && tagIndex.contains(Tag::aabg)) {
// Apple extension for parametric version of TRCs in ICCv2:
rTrc = tagIndex[Tag::aarg];
gTrc = tagIndex[Tag::aagg];
@@ -714,30 +1207,30 @@ bool fromIccProfile(const QByteArray &data, QColorSpace *colorSpace)
QColorTrc rCurve;
QColorTrc gCurve;
QColorTrc bCurve;
- if (!parseTRC(data, rTrc, rCurve)) {
+ if (!parseTRC(QByteArrayView(data).sliced(rTrc.offset, rTrc.size), rCurve, QColorTransferTable::TwoWay)) {
qCWarning(lcIcc) << "fromIccProfile: Invalid rTRC";
return false;
}
- if (!parseTRC(data, gTrc, gCurve)) {
+ if (!parseTRC(QByteArrayView(data).sliced(gTrc.offset, gTrc.size), gCurve, QColorTransferTable::TwoWay)) {
qCWarning(lcIcc) << "fromIccProfile: Invalid gTRC";
return false;
}
- if (!parseTRC(data, bTrc, bCurve)) {
+ if (!parseTRC(QByteArrayView(data).sliced(bTrc.offset, bTrc.size), bCurve, QColorTransferTable::TwoWay)) {
qCWarning(lcIcc) << "fromIccProfile: Invalid bTRC";
return false;
}
- if (rCurve == gCurve && gCurve == bCurve && rCurve.m_type == QColorTrc::Type::Function) {
- if (rCurve.m_fun.isLinear()) {
+ if (rCurve == gCurve && gCurve == bCurve) {
+ if (rCurve.isIdentity()) {
qCDebug(lcIcc) << "fromIccProfile: Linear gamma detected";
colorspaceDPtr->trc[0] = QColorTransferFunction();
colorspaceDPtr->transferFunction = QColorSpace::TransferFunction::Linear;
colorspaceDPtr->gamma = 1.0f;
- } else if (rCurve.m_fun.isGamma()) {
+ } else if (rCurve.m_type == QColorTrc::Type::Function && rCurve.m_fun.isGamma()) {
qCDebug(lcIcc) << "fromIccProfile: Simple gamma detected";
colorspaceDPtr->trc[0] = QColorTransferFunction::fromGamma(rCurve.m_fun.m_g);
colorspaceDPtr->transferFunction = QColorSpace::TransferFunction::Gamma;
colorspaceDPtr->gamma = rCurve.m_fun.m_g;
- } else if (rCurve.m_fun.isSRgb()) {
+ } else if (rCurve.m_type == QColorTrc::Type::Function && rCurve.m_fun.isSRgb()) {
qCDebug(lcIcc) << "fromIccProfile: sRGB gamma detected";
colorspaceDPtr->trc[0] = QColorTransferFunction::fromSRgb();
colorspaceDPtr->transferFunction = QColorSpace::TransferFunction::SRgb;
@@ -745,7 +1238,6 @@ bool fromIccProfile(const QByteArray &data, QColorSpace *colorSpace)
colorspaceDPtr->trc[0] = rCurve;
colorspaceDPtr->transferFunction = QColorSpace::TransferFunction::Custom;
}
-
colorspaceDPtr->trc[1] = colorspaceDPtr->trc[0];
colorspaceDPtr->trc[2] = colorspaceDPtr->trc[0];
} else {
@@ -754,9 +1246,151 @@ bool fromIccProfile(const QByteArray &data, QColorSpace *colorSpace)
colorspaceDPtr->trc[2] = bCurve;
colorspaceDPtr->transferFunction = QColorSpace::TransferFunction::Custom;
}
+ return true;
+}
+
+bool fromIccProfile(const QByteArray &data, QColorSpace *colorSpace)
+{
+ if (data.size() < qsizetype(sizeof(ICCProfileHeader))) {
+ qCWarning(lcIcc) << "fromIccProfile: failed size sanity 1";
+ return false;
+ }
+ const ICCProfileHeader header = qFromUnaligned<ICCProfileHeader>(data.constData());
+ if (!isValidIccProfile(header))
+ return false; // if failed we already printing a warning
+ if (qsizetype(header.profileSize) > data.size() || qsizetype(header.profileSize) < qsizetype(sizeof(ICCProfileHeader))) {
+ qCWarning(lcIcc) << "fromIccProfile: failed size sanity 2";
+ return false;
+ }
+
+ const qsizetype offsetToData = sizeof(ICCProfileHeader) + header.tagCount * sizeof(TagTableEntry);
+ Q_ASSERT(offsetToData > 0);
+ if (offsetToData > data.size()) {
+ qCWarning(lcIcc) << "fromIccProfile: failed index size sanity";
+ return false;
+ }
+
+ QHash<Tag, TagEntry> tagIndex;
+ for (uint i = 0; i < header.tagCount; ++i) {
+ // Read tag index
+ const qsizetype tableOffset = sizeof(ICCProfileHeader) + i * sizeof(TagTableEntry);
+ const TagTableEntry tagTable = qFromUnaligned<TagTableEntry>(data.constData()
+ + tableOffset);
+
+ // Sanity check tag sizes and offsets:
+ if (qsizetype(tagTable.offset) < offsetToData) {
+ qCWarning(lcIcc) << "fromIccProfile: failed tag offset sanity 1";
+ return false;
+ }
+ // Checked separately from (+ size) to handle overflow.
+ if (tagTable.offset > header.profileSize) {
+ qCWarning(lcIcc) << "fromIccProfile: failed tag offset sanity 2";
+ return false;
+ }
+ if (tagTable.size < 12) {
+ qCWarning(lcIcc) << "fromIccProfile: failed minimal tag size sanity";
+ return false;
+ }
+ if (tagTable.size > header.profileSize - tagTable.offset) {
+ qCWarning(lcIcc) << "fromIccProfile: failed tag offset + size sanity";
+ return false;
+ }
+ if (tagTable.offset & 0x03) {
+ qCWarning(lcIcc) << "fromIccProfile: invalid tag offset alignment";
+ return false;
+ }
+// printf("'%4s' %d %d\n", (const char *)&tagTable.signature,
+// quint32(tagTable.offset),
+// quint32(tagTable.size));
+ tagIndex.insert(Tag(quint32(tagTable.signature)), { tagTable.offset, tagTable.size });
+ }
+
+ bool threeComponentMatrix = true;
+
+ if (header.inputColorSpace == uint(ColorSpaceType::Rgb)) {
+ // Check the profile is three-component matrix based:
+ if (!tagIndex.contains(Tag::rXYZ) || !tagIndex.contains(Tag::gXYZ) || !tagIndex.contains(Tag::bXYZ) ||
+ !tagIndex.contains(Tag::rTRC) || !tagIndex.contains(Tag::gTRC) || !tagIndex.contains(Tag::bTRC) ||
+ !tagIndex.contains(Tag::wtpt) || header.pcs == uint(Tag::Lab_)) {
+ threeComponentMatrix = false;
+ // Check if the profile is valid n-LUT based:
+ if (!tagIndex.contains(Tag::A2B0)) {
+ qCWarning(lcIcc) << "fromIccProfile: Invalid ICC profile - neither valid three component nor n-LUT";
+ return false;
+ }
+ }
+ } else if (header.inputColorSpace == uint(ColorSpaceType::Gray)) {
+ if (!tagIndex.contains(Tag::kTRC) || !tagIndex.contains(Tag::wtpt)) {
+ qCWarning(lcIcc) << "fromIccProfile: Invalid ICC profile - not valid gray scale based";
+ return false;
+ }
+ } else if (header.inputColorSpace == uint(ColorSpaceType::Cmyk)) {
+ threeComponentMatrix = false;
+ if (!tagIndex.contains(Tag::A2B0)) {
+ qCWarning(lcIcc) << "fromIccProfile: Invalid ICC profile - CMYK, not n-LUT";
+ return false;
+ }
+ } else {
+ Q_UNREACHABLE();
+ }
+
+ colorSpace->detach();
+ QColorSpacePrivate *colorspaceDPtr = QColorSpacePrivate::get(*colorSpace);
+
+ if (threeComponentMatrix) {
+ colorspaceDPtr->isPcsLab = false;
+ colorspaceDPtr->transformModel = QColorSpace::TransformModel::ThreeComponentMatrix;
+
+ if (header.inputColorSpace == uint(ColorSpaceType::Rgb)) {
+ if (!parseRgbMatrix(data, tagIndex, colorspaceDPtr))
+ return false;
+ colorspaceDPtr->colorModel = QColorSpace::ColorModel::Rgb;
+ } else if (header.inputColorSpace == uint(ColorSpaceType::Gray)) {
+ if (!parseGrayMatrix(data, tagIndex, colorspaceDPtr))
+ return false;
+ colorspaceDPtr->colorModel = QColorSpace::ColorModel::Gray;
+ } else {
+ Q_UNREACHABLE();
+ }
+ if (auto it = tagIndex.constFind(Tag::chad); it != tagIndex.constEnd()) {
+ if (!parseChad(data, it.value(), colorspaceDPtr))
+ return false;
+ } else {
+ colorspaceDPtr->chad = QColorMatrix::chromaticAdaptation(colorspaceDPtr->whitePoint);
+ }
+ if (colorspaceDPtr->colorModel == QColorSpace::ColorModel::Gray)
+ colorspaceDPtr->toXyz = colorspaceDPtr->chad;
+
+ // Reset the matrix to our canonical values:
+ if (colorspaceDPtr->primaries != QColorSpace::Primaries::Custom)
+ colorspaceDPtr->setToXyzMatrix();
+
+ if (!parseTRCs(data, tagIndex, colorspaceDPtr, header.inputColorSpace == uint(ColorSpaceType::Gray)))
+ return false;
+ } else {
+ colorspaceDPtr->isPcsLab = (header.pcs == uint(Tag::Lab_));
+ colorspaceDPtr->transformModel = QColorSpace::TransformModel::ElementListProcessing;
+ if (header.inputColorSpace == uint(ColorSpaceType::Cmyk))
+ colorspaceDPtr->colorModel = QColorSpace::ColorModel::Cmyk;
+ else
+ colorspaceDPtr->colorModel = QColorSpace::ColorModel::Rgb;
+
+ // Only parse the default perceptual transform for now
+ if (!parseA2B(data, tagIndex[Tag::A2B0], colorspaceDPtr, true))
+ return false;
+ if (auto it = tagIndex.constFind(Tag::B2A0); it != tagIndex.constEnd()) {
+ if (!parseA2B(data, it.value(), colorspaceDPtr, false))
+ return false;
+ }
+
+ if (auto it = tagIndex.constFind(Tag::wtpt); it != tagIndex.constEnd()) {
+ if (!parseXyzData(data, it.value(), colorspaceDPtr->whitePoint))
+ return false;
+ }
+ }
- if (tagIndex.contains(Tag::desc)) {
- if (!parseDesc(data, tagIndex[Tag::desc], colorspaceDPtr->description))
+ if (auto it = tagIndex.constFind(Tag::desc); it != tagIndex.constEnd()) {
+ if (!parseDesc(data, it.value(), colorspaceDPtr->description))
qCWarning(lcIcc) << "fromIccProfile: Failed to parse description";
else
qCDebug(lcIcc) << "fromIccProfile: Description" << colorspaceDPtr->description;
@@ -768,6 +1402,7 @@ bool fromIccProfile(const QByteArray &data, QColorSpace *colorSpace)
colorspaceDPtr->iccProfile = data;
+ Q_ASSERT(colorspaceDPtr->isValid());
return true;
}
diff --git a/src/gui/painting/qicc_p.h b/src/gui/painting/qicc_p.h
index 2a4658b84b..fd9b53b045 100644
--- a/src/gui/painting/qicc_p.h
+++ b/src/gui/painting/qicc_p.h
@@ -1,41 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2018 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the QtGui module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2018 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#ifndef QICC_P_H
#define QICC_P_H
@@ -53,6 +17,7 @@
#include <QtCore/qbytearray.h>
#include <QtGui/qtguiglobal.h>
+#include <QtCore/private/qglobal_p.h>
QT_BEGIN_NAMESPACE
diff --git a/src/gui/painting/qimageeffects.cpp b/src/gui/painting/qimageeffects.cpp
new file mode 100644
index 0000000000..7c2b947e08
--- /dev/null
+++ b/src/gui/painting/qimageeffects.cpp
@@ -0,0 +1,327 @@
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
+
+#include "qmath.h"
+#include "qdrawhelper_p.h"
+#include "qmemrotate_p.h"
+#include "qpainter.h"
+
+#include <memory>
+
+QT_BEGIN_NAMESPACE
+
+namespace {
+
+template <int shift>
+inline int qt_static_shift(int value)
+{
+ if (shift == 0)
+ return value;
+ else if (shift > 0)
+ return value << (uint(shift) & 0x1f);
+ else
+ return value >> (uint(-shift) & 0x1f);
+}
+
+template<int aprec, int zprec>
+inline void qt_blurinner(uchar *bptr, int &zR, int &zG, int &zB, int &zA, int alpha)
+{
+ QRgb *pixel = (QRgb *)bptr;
+
+#define Z_MASK (0xff << zprec)
+ const int A_zprec = qt_static_shift<zprec - 24>(*pixel) & Z_MASK;
+ const int R_zprec = qt_static_shift<zprec - 16>(*pixel) & Z_MASK;
+ const int G_zprec = qt_static_shift<zprec - 8>(*pixel) & Z_MASK;
+ const int B_zprec = qt_static_shift<zprec>(*pixel) & Z_MASK;
+#undef Z_MASK
+
+ const int zR_zprec = zR >> aprec;
+ const int zG_zprec = zG >> aprec;
+ const int zB_zprec = zB >> aprec;
+ const int zA_zprec = zA >> aprec;
+
+ zR += alpha * (R_zprec - zR_zprec);
+ zG += alpha * (G_zprec - zG_zprec);
+ zB += alpha * (B_zprec - zB_zprec);
+ zA += alpha * (A_zprec - zA_zprec);
+
+#define ZA_MASK (0xff << (zprec + aprec))
+ *pixel =
+ qt_static_shift<24 - zprec - aprec>(zA & ZA_MASK)
+ | qt_static_shift<16 - zprec - aprec>(zR & ZA_MASK)
+ | qt_static_shift<8 - zprec - aprec>(zG & ZA_MASK)
+ | qt_static_shift<-zprec - aprec>(zB & ZA_MASK);
+#undef ZA_MASK
+}
+
+const int alphaIndex = (QSysInfo::ByteOrder == QSysInfo::BigEndian ? 0 : 3);
+
+template<int aprec, int zprec>
+inline void qt_blurinner_alphaOnly(uchar *bptr, int &z, int alpha)
+{
+ const int A_zprec = int(*(bptr)) << zprec;
+ const int z_zprec = z >> aprec;
+ z += alpha * (A_zprec - z_zprec);
+ *(bptr) = z >> (zprec + aprec);
+}
+
+template<int aprec, int zprec, bool alphaOnly>
+inline void qt_blurrow(QImage & im, int line, int alpha)
+{
+ uchar *bptr = im.scanLine(line);
+
+ int zR = 0, zG = 0, zB = 0, zA = 0;
+
+ if (alphaOnly && im.format() != QImage::Format_Indexed8)
+ bptr += alphaIndex;
+
+ const int stride = im.depth() >> 3;
+ const int im_width = im.width();
+ for (int index = 0; index < im_width; ++index) {
+ if (alphaOnly)
+ qt_blurinner_alphaOnly<aprec, zprec>(bptr, zA, alpha);
+ else
+ qt_blurinner<aprec, zprec>(bptr, zR, zG, zB, zA, alpha);
+ bptr += stride;
+ }
+
+ bptr -= stride;
+
+ for (int index = im_width - 2; index >= 0; --index) {
+ bptr -= stride;
+ if (alphaOnly)
+ qt_blurinner_alphaOnly<aprec, zprec>(bptr, zA, alpha);
+ else
+ qt_blurinner<aprec, zprec>(bptr, zR, zG, zB, zA, alpha);
+ }
+}
+
+/*
+* expblur(QImage &img, int radius)
+*
+* Based on exponential blur algorithm by Jani Huhtanen
+*
+* In-place blur of image 'img' with kernel
+* of approximate radius 'radius'.
+*
+* Blurs with two sided exponential impulse
+* response.
+*
+* aprec = precision of alpha parameter
+* in fixed-point format 0.aprec
+*
+* zprec = precision of state parameters
+* zR,zG,zB and zA in fp format 8.zprec
+*/
+template <int aprec, int zprec, bool alphaOnly>
+void expblur(QImage &img, qreal radius, bool improvedQuality = false, int transposed = 0)
+{
+ // halve the radius if we're using two passes
+ if (improvedQuality)
+ radius *= qreal(0.5);
+
+ Q_ASSERT(img.format() == QImage::Format_ARGB32_Premultiplied
+ || img.format() == QImage::Format_RGB32
+ || img.format() == QImage::Format_Indexed8
+ || img.format() == QImage::Format_Grayscale8);
+
+ // choose the alpha such that pixels at radius distance from a fully
+ // saturated pixel will have an alpha component of no greater than
+ // the cutOffIntensity
+ const qreal cutOffIntensity = 2;
+ int alpha = radius <= qreal(1e-5)
+ ? ((1 << aprec)-1)
+ : qRound((1<<aprec)*(1 - qPow(cutOffIntensity * (1 / qreal(255)), 1 / radius)));
+
+ int img_height = img.height();
+ for (int row = 0; row < img_height; ++row) {
+ for (int i = 0; i <= int(improvedQuality); ++i)
+ qt_blurrow<aprec, zprec, alphaOnly>(img, row, alpha);
+ }
+
+ QImage temp(img.height(), img.width(), img.format());
+ temp.setDevicePixelRatio(img.devicePixelRatio());
+ if (transposed >= 0) {
+ if (img.depth() == 8) {
+ qt_memrotate270(reinterpret_cast<const quint8*>(img.bits()),
+ img.width(), img.height(), img.bytesPerLine(),
+ reinterpret_cast<quint8*>(temp.bits()),
+ temp.bytesPerLine());
+ } else {
+ qt_memrotate270(reinterpret_cast<const quint32*>(img.bits()),
+ img.width(), img.height(), img.bytesPerLine(),
+ reinterpret_cast<quint32*>(temp.bits()),
+ temp.bytesPerLine());
+ }
+ } else {
+ if (img.depth() == 8) {
+ qt_memrotate90(reinterpret_cast<const quint8*>(img.bits()),
+ img.width(), img.height(), img.bytesPerLine(),
+ reinterpret_cast<quint8*>(temp.bits()),
+ temp.bytesPerLine());
+ } else {
+ qt_memrotate90(reinterpret_cast<const quint32*>(img.bits()),
+ img.width(), img.height(), img.bytesPerLine(),
+ reinterpret_cast<quint32*>(temp.bits()),
+ temp.bytesPerLine());
+ }
+ }
+
+ img_height = temp.height();
+ for (int row = 0; row < img_height; ++row) {
+ for (int i = 0; i <= int(improvedQuality); ++i)
+ qt_blurrow<aprec, zprec, alphaOnly>(temp, row, alpha);
+ }
+
+ if (transposed == 0) {
+ if (img.depth() == 8) {
+ qt_memrotate90(reinterpret_cast<const quint8*>(temp.bits()),
+ temp.width(), temp.height(), temp.bytesPerLine(),
+ reinterpret_cast<quint8*>(img.bits()),
+ img.bytesPerLine());
+ } else {
+ qt_memrotate90(reinterpret_cast<const quint32*>(temp.bits()),
+ temp.width(), temp.height(), temp.bytesPerLine(),
+ reinterpret_cast<quint32*>(img.bits()),
+ img.bytesPerLine());
+ }
+ } else {
+ img = temp;
+ }
+}
+
+} // namespace
+
+#define AVG(a,b) ( ((((a)^(b)) & 0xfefefefeUL) >> 1) + ((a)&(b)) )
+#define AVG16(a,b) ( ((((a)^(b)) & 0xf7deUL) >> 1) + ((a)&(b)) )
+
+QImage qt_halfScaled(const QImage &source)
+{
+ if (source.width() < 2 || source.height() < 2)
+ return QImage();
+
+ QImage srcImage = source;
+
+ if (source.format() == QImage::Format_Indexed8 || source.format() == QImage::Format_Grayscale8) {
+ // assumes grayscale
+ QImage dest(source.width() / 2, source.height() / 2, srcImage.format());
+ dest.setDevicePixelRatio(source.devicePixelRatio());
+
+ const uchar *src = reinterpret_cast<const uchar*>(const_cast<const QImage &>(srcImage).bits());
+ qsizetype sx = srcImage.bytesPerLine();
+ qsizetype sx2 = sx << 1;
+
+ uchar *dst = reinterpret_cast<uchar*>(dest.bits());
+ qsizetype dx = dest.bytesPerLine();
+ int ww = dest.width();
+ int hh = dest.height();
+
+ for (int y = hh; y; --y, dst += dx, src += sx2) {
+ const uchar *p1 = src;
+ const uchar *p2 = src + sx;
+ uchar *q = dst;
+ for (int x = ww; x; --x, ++q, p1 += 2, p2 += 2)
+ *q = ((int(p1[0]) + int(p1[1]) + int(p2[0]) + int(p2[1])) + 2) >> 2;
+ }
+
+ return dest;
+ } else if (source.format() == QImage::Format_ARGB8565_Premultiplied) {
+ QImage dest(source.width() / 2, source.height() / 2, srcImage.format());
+ dest.setDevicePixelRatio(source.devicePixelRatio());
+
+ const uchar *src = reinterpret_cast<const uchar*>(const_cast<const QImage &>(srcImage).bits());
+ qsizetype sx = srcImage.bytesPerLine();
+ qsizetype sx2 = sx << 1;
+
+ uchar *dst = reinterpret_cast<uchar*>(dest.bits());
+ qsizetype dx = dest.bytesPerLine();
+ int ww = dest.width();
+ int hh = dest.height();
+
+ for (int y = hh; y; --y, dst += dx, src += sx2) {
+ const uchar *p1 = src;
+ const uchar *p2 = src + sx;
+ uchar *q = dst;
+ for (int x = ww; x; --x, q += 3, p1 += 6, p2 += 6) {
+ // alpha
+ q[0] = AVG(AVG(p1[0], p1[3]), AVG(p2[0], p2[3]));
+ // rgb
+ const quint16 p16_1 = (p1[2] << 8) | p1[1];
+ const quint16 p16_2 = (p1[5] << 8) | p1[4];
+ const quint16 p16_3 = (p2[2] << 8) | p2[1];
+ const quint16 p16_4 = (p2[5] << 8) | p2[4];
+ const quint16 result = AVG16(AVG16(p16_1, p16_2), AVG16(p16_3, p16_4));
+ q[1] = result & 0xff;
+ q[2] = result >> 8;
+ }
+ }
+
+ return dest;
+ } else if (source.format() != QImage::Format_ARGB32_Premultiplied
+ && source.format() != QImage::Format_RGB32)
+ {
+ srcImage = source.convertToFormat(QImage::Format_ARGB32_Premultiplied);
+ }
+
+ QImage dest(source.width() / 2, source.height() / 2, srcImage.format());
+ dest.setDevicePixelRatio(source.devicePixelRatio());
+
+ const quint32 *src = reinterpret_cast<const quint32*>(const_cast<const QImage &>(srcImage).bits());
+ qsizetype sx = srcImage.bytesPerLine() >> 2;
+ qsizetype sx2 = sx << 1;
+
+ quint32 *dst = reinterpret_cast<quint32*>(dest.bits());
+ qsizetype dx = dest.bytesPerLine() >> 2;
+ int ww = dest.width();
+ int hh = dest.height();
+
+ for (int y = hh; y; --y, dst += dx, src += sx2) {
+ const quint32 *p1 = src;
+ const quint32 *p2 = src + sx;
+ quint32 *q = dst;
+ for (int x = ww; x; --x, q++, p1 += 2, p2 += 2)
+ *q = AVG(AVG(p1[0], p1[1]), AVG(p2[0], p2[1]));
+ }
+
+ return dest;
+}
+
+#undef AVG
+#undef AVG16
+
+Q_GUI_EXPORT void qt_blurImage(QPainter *p, QImage &blurImage, qreal radius, bool quality, bool alphaOnly, int transposed = 0)
+{
+ if (blurImage.format() != QImage::Format_ARGB32_Premultiplied
+ && blurImage.format() != QImage::Format_RGB32)
+ {
+ blurImage = std::move(blurImage).convertToFormat(QImage::Format_ARGB32_Premultiplied);
+ }
+
+ qreal scale = 1;
+ if (radius >= 4 && blurImage.width() >= 2 && blurImage.height() >= 2) {
+ blurImage = qt_halfScaled(blurImage);
+ scale = 2;
+ radius *= qreal(0.5);
+ }
+
+ if (alphaOnly)
+ expblur<12, 10, true>(blurImage, radius, quality, transposed);
+ else
+ expblur<12, 10, false>(blurImage, radius, quality, transposed);
+
+ if (p) {
+ p->scale(scale, scale);
+ p->setRenderHint(QPainter::SmoothPixmapTransform);
+ p->drawImage(QRect(QPoint(0, 0), blurImage.deviceIndependentSize().toSize()), blurImage);
+ }
+}
+
+Q_GUI_EXPORT void qt_blurImage(QImage &blurImage, qreal radius, bool quality, int transposed = 0)
+{
+ if (blurImage.format() == QImage::Format_Indexed8 || blurImage.format() == QImage::Format_Grayscale8)
+ expblur<12, 10, true>(blurImage, radius, quality, transposed);
+ else
+ expblur<12, 10, false>(blurImage, radius, quality, transposed);
+}
+
+QT_END_NAMESPACE
diff --git a/src/gui/painting/qimagescale.cpp b/src/gui/painting/qimagescale.cpp
index 2e2f65b483..a636635fd5 100644
--- a/src/gui/painting/qimagescale.cpp
+++ b/src/gui/painting/qimagescale.cpp
@@ -1,47 +1,19 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the QtGui module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#include <private/qimagescale_p.h>
#include <private/qdrawhelper_p.h>
+#include <private/qimage_p.h>
#include "qimage.h"
#include "qcolor.h"
#include "qrgba64_p.h"
+#include "qrgbafloat.h"
+
+#if QT_CONFIG(thread) && !defined(Q_OS_WASM)
+#include <qsemaphore.h>
+#include <qthreadpool.h>
+#include <private/qthreadpool_p.h>
+#endif
QT_BEGIN_NAMESPACE
@@ -239,6 +211,8 @@ static QImageScaleInfo* QImageScale::qimageCalcScaleInfo(const QImage &img,
isi = new QImageScaleInfo;
if (!isi)
return nullptr;
+ isi->sh = sh;
+ isi->sw = sw;
isi->xup_yup = (qAbs(dw) >= sw) + ((qAbs(dh) >= sh) << 1);
@@ -294,6 +268,33 @@ void qt_qimageScaleAARGBA_down_xy_neon(QImageScaleInfo *isi, unsigned int *dest,
int dw, int dh, int dow, int sow);
#endif
+template<typename T>
+static inline void multithread_pixels_function(QImageScaleInfo *isi, int dh, const T &scaleSection)
+{
+#if QT_CONFIG(thread) && !defined(Q_OS_WASM)
+ int segments = (qsizetype(isi->sh) * isi->sw) / (1<<16);
+ segments = std::min(segments, dh);
+ QThreadPool *threadPool = QThreadPoolPrivate::qtGuiInstance();
+ if (segments > 1 && threadPool && !threadPool->contains(QThread::currentThread())) {
+ QSemaphore semaphore;
+ int y = 0;
+ for (int i = 0; i < segments; ++i) {
+ int yn = (dh - y) / (segments - i);
+ threadPool->start([&, y, yn]() {
+ scaleSection(y, y + yn);
+ semaphore.release(1);
+ });
+ y += yn;
+ }
+ semaphore.acquire(segments);
+ return;
+ }
+#else
+ Q_UNUSED(isi);
+#endif
+ scaleSection(0, dh);
+}
+
static void qt_qimageScaleAARGBA_up_xy(QImageScaleInfo *isi, unsigned int *dest,
int dw, int dh, int dow, int sow)
{
@@ -303,33 +304,36 @@ static void qt_qimageScaleAARGBA_up_xy(QImageScaleInfo *isi, unsigned int *dest,
int *yapoints = isi->yapoints;
/* go through every scanline in the output buffer */
- for (int y = 0; y < dh; y++) {
- /* calculate the source line we'll scan from */
- const unsigned int *sptr = ypoints[y];
- unsigned int *dptr = dest + (y * dow);
- const int yap = yapoints[y];
- if (yap > 0) {
- for (int x = 0; x < dw; x++) {
- const unsigned int *pix = sptr + xpoints[x];
- const int xap = xapoints[x];
- if (xap > 0)
- *dptr = interpolate_4_pixels(pix, pix + sow, xap, yap);
- else
- *dptr = INTERPOLATE_PIXEL_256(pix[0], 256 - yap, pix[sow], yap);
- dptr++;
- }
- } else {
- for (int x = 0; x < dw; x++) {
- const unsigned int *pix = sptr + xpoints[x];
- const int xap = xapoints[x];
- if (xap > 0)
- *dptr = INTERPOLATE_PIXEL_256(pix[0], 256 - xap, pix[1], xap);
- else
- *dptr = pix[0];
- dptr++;
+ auto scaleSection = [&] (int yStart, int yEnd) {
+ for (int y = yStart; y < yEnd; ++y) {
+ /* calculate the source line we'll scan from */
+ const unsigned int *sptr = ypoints[y];
+ unsigned int *dptr = dest + (y * dow);
+ const int yap = yapoints[y];
+ if (yap > 0) {
+ for (int x = 0; x < dw; x++) {
+ const unsigned int *pix = sptr + xpoints[x];
+ const int xap = xapoints[x];
+ if (xap > 0)
+ *dptr = interpolate_4_pixels(pix, pix + sow, xap, yap);
+ else
+ *dptr = INTERPOLATE_PIXEL_256(pix[0], 256 - yap, pix[sow], yap);
+ dptr++;
+ }
+ } else {
+ for (int x = 0; x < dw; x++) {
+ const unsigned int *pix = sptr + xpoints[x];
+ const int xap = xapoints[x];
+ if (xap > 0)
+ *dptr = INTERPOLATE_PIXEL_256(pix[0], 256 - xap, pix[1], xap);
+ else
+ *dptr = pix[0];
+ dptr++;
+ }
}
}
- }
+ };
+ multithread_pixels_function(isi, dh, scaleSection);
}
/* scale by area sampling - with alpha */
@@ -411,33 +415,36 @@ static void qt_qimageScaleAARGBA_up_x_down_y(QImageScaleInfo *isi, unsigned int
int *yapoints = isi->yapoints;
/* go through every scanline in the output buffer */
- for (int y = 0; y < dh; y++) {
- int Cy = yapoints[y] >> 16;
- int yap = yapoints[y] & 0xffff;
-
- unsigned int *dptr = dest + (y * dow);
- for (int x = 0; x < dw; x++) {
- const unsigned int *sptr = ypoints[y] + xpoints[x];
- int r, g, b, a;
- qt_qimageScaleAARGBA_helper(sptr, yap, Cy, sow, r, g, b, a);
-
- int xap = xapoints[x];
- if (xap > 0) {
- int rr, gg, bb, aa;
- qt_qimageScaleAARGBA_helper(sptr + 1, yap, Cy, sow, rr, gg, bb, aa);
-
- r = r * (256 - xap);
- g = g * (256 - xap);
- b = b * (256 - xap);
- a = a * (256 - xap);
- r = (r + (rr * xap)) >> 8;
- g = (g + (gg * xap)) >> 8;
- b = (b + (bb * xap)) >> 8;
- a = (a + (aa * xap)) >> 8;
+ auto scaleSection = [&] (int yStart, int yEnd) {
+ for (int y = yStart; y < yEnd; ++y) {
+ int Cy = yapoints[y] >> 16;
+ int yap = yapoints[y] & 0xffff;
+
+ unsigned int *dptr = dest + (y * dow);
+ for (int x = 0; x < dw; x++) {
+ const unsigned int *sptr = ypoints[y] + xpoints[x];
+ int r, g, b, a;
+ qt_qimageScaleAARGBA_helper(sptr, yap, Cy, sow, r, g, b, a);
+
+ int xap = xapoints[x];
+ if (xap > 0) {
+ int rr, gg, bb, aa;
+ qt_qimageScaleAARGBA_helper(sptr + 1, yap, Cy, sow, rr, gg, bb, aa);
+
+ r = r * (256 - xap);
+ g = g * (256 - xap);
+ b = b * (256 - xap);
+ a = a * (256 - xap);
+ r = (r + (rr * xap)) >> 8;
+ g = (g + (gg * xap)) >> 8;
+ b = (b + (bb * xap)) >> 8;
+ a = (a + (aa * xap)) >> 8;
+ }
+ *dptr++ = qRgba(r >> 14, g >> 14, b >> 14, a >> 14);
}
- *dptr++ = qRgba(r >> 14, g >> 14, b >> 14, a >> 14);
}
- }
+ };
+ multithread_pixels_function(isi, dh, scaleSection);
}
static void qt_qimageScaleAARGBA_down_x_up_y(QImageScaleInfo *isi, unsigned int *dest,
@@ -449,34 +456,37 @@ static void qt_qimageScaleAARGBA_down_x_up_y(QImageScaleInfo *isi, unsigned int
int *yapoints = isi->yapoints;
/* go through every scanline in the output buffer */
- for (int y = 0; y < dh; y++) {
- unsigned int *dptr = dest + (y * dow);
- for (int x = 0; x < dw; x++) {
- int Cx = xapoints[x] >> 16;
- int xap = xapoints[x] & 0xffff;
-
- const unsigned int *sptr = ypoints[y] + xpoints[x];
- int r, g, b, a;
- qt_qimageScaleAARGBA_helper(sptr, xap, Cx, 1, r, g, b, a);
-
- int yap = yapoints[y];
- if (yap > 0) {
- int rr, gg, bb, aa;
- qt_qimageScaleAARGBA_helper(sptr + sow, xap, Cx, 1, rr, gg, bb, aa);
-
- r = r * (256 - yap);
- g = g * (256 - yap);
- b = b * (256 - yap);
- a = a * (256 - yap);
- r = (r + (rr * yap)) >> 8;
- g = (g + (gg * yap)) >> 8;
- b = (b + (bb * yap)) >> 8;
- a = (a + (aa * yap)) >> 8;
+ auto scaleSection = [&] (int yStart, int yEnd) {
+ for (int y = yStart; y < yEnd; ++y) {
+ unsigned int *dptr = dest + (y * dow);
+ for (int x = 0; x < dw; x++) {
+ int Cx = xapoints[x] >> 16;
+ int xap = xapoints[x] & 0xffff;
+
+ const unsigned int *sptr = ypoints[y] + xpoints[x];
+ int r, g, b, a;
+ qt_qimageScaleAARGBA_helper(sptr, xap, Cx, 1, r, g, b, a);
+
+ int yap = yapoints[y];
+ if (yap > 0) {
+ int rr, gg, bb, aa;
+ qt_qimageScaleAARGBA_helper(sptr + sow, xap, Cx, 1, rr, gg, bb, aa);
+
+ r = r * (256 - yap);
+ g = g * (256 - yap);
+ b = b * (256 - yap);
+ a = a * (256 - yap);
+ r = (r + (rr * yap)) >> 8;
+ g = (g + (gg * yap)) >> 8;
+ b = (b + (bb * yap)) >> 8;
+ a = (a + (aa * yap)) >> 8;
+ }
+ *dptr = qRgba(r >> 14, g >> 14, b >> 14, a >> 14);
+ dptr++;
}
- *dptr = qRgba(r >> 14, g >> 14, b >> 14, a >> 14);
- dptr++;
}
- }
+ };
+ multithread_pixels_function(isi, dh, scaleSection);
}
static void qt_qimageScaleAARGBA_down_xy(QImageScaleInfo *isi, unsigned int *dest,
@@ -487,45 +497,48 @@ static void qt_qimageScaleAARGBA_down_xy(QImageScaleInfo *isi, unsigned int *des
int *xapoints = isi->xapoints;
int *yapoints = isi->yapoints;
- for (int y = 0; y < dh; y++) {
- int Cy = (yapoints[y]) >> 16;
- int yap = (yapoints[y]) & 0xffff;
-
- unsigned int *dptr = dest + (y * dow);
- for (int x = 0; x < dw; x++) {
- int Cx = xapoints[x] >> 16;
- int xap = xapoints[x] & 0xffff;
+ auto scaleSection = [&] (int yStart, int yEnd) {
+ for (int y = yStart; y < yEnd; ++y) {
+ int Cy = (yapoints[y]) >> 16;
+ int yap = (yapoints[y]) & 0xffff;
- const unsigned int *sptr = ypoints[y] + xpoints[x];
- int rx, gx, bx, ax;
- qt_qimageScaleAARGBA_helper(sptr, xap, Cx, 1, rx, gx, bx, ax);
+ unsigned int *dptr = dest + (y * dow);
+ for (int x = 0; x < dw; x++) {
+ int Cx = xapoints[x] >> 16;
+ int xap = xapoints[x] & 0xffff;
- int r = ((rx>>4) * yap);
- int g = ((gx>>4) * yap);
- int b = ((bx>>4) * yap);
- int a = ((ax>>4) * yap);
+ const unsigned int *sptr = ypoints[y] + xpoints[x];
+ int rx, gx, bx, ax;
+ qt_qimageScaleAARGBA_helper(sptr, xap, Cx, 1, rx, gx, bx, ax);
- int j;
- for (j = (1 << 14) - yap; j > Cy; j -= Cy) {
+ int r = ((rx>>4) * yap);
+ int g = ((gx>>4) * yap);
+ int b = ((bx>>4) * yap);
+ int a = ((ax>>4) * yap);
+
+ int j;
+ for (j = (1 << 14) - yap; j > Cy; j -= Cy) {
+ sptr += sow;
+ qt_qimageScaleAARGBA_helper(sptr, xap, Cx, 1, rx, gx, bx, ax);
+ r += ((rx>>4) * Cy);
+ g += ((gx>>4) * Cy);
+ b += ((bx>>4) * Cy);
+ a += ((ax>>4) * Cy);
+ }
sptr += sow;
qt_qimageScaleAARGBA_helper(sptr, xap, Cx, 1, rx, gx, bx, ax);
- r += ((rx>>4) * Cy);
- g += ((gx>>4) * Cy);
- b += ((bx>>4) * Cy);
- a += ((ax>>4) * Cy);
- }
- sptr += sow;
- qt_qimageScaleAARGBA_helper(sptr, xap, Cx, 1, rx, gx, bx, ax);
- r += ((rx>>4) * j);
- g += ((gx>>4) * j);
- b += ((bx>>4) * j);
- a += ((ax>>4) * j);
+ r += ((rx>>4) * j);
+ g += ((gx>>4) * j);
+ b += ((bx>>4) * j);
+ a += ((ax>>4) * j);
- *dptr = qRgba(r >> 24, g >> 24, b >> 24, a >> 24);
- dptr++;
+ *dptr = qRgba(r >> 24, g >> 24, b >> 24, a >> 24);
+ dptr++;
+ }
}
- }
+ };
+ multithread_pixels_function(isi, dh, scaleSection);
}
#if QT_CONFIG(raster_64bit)
@@ -546,32 +559,35 @@ static void qt_qimageScaleRgba64_up_xy(QImageScaleInfo *isi, QRgba64 *dest,
int *xapoints = isi->xapoints;
int *yapoints = isi->yapoints;
- for (int y = 0; y < dh; y++) {
- const QRgba64 *sptr = ypoints[y];
- QRgba64 *dptr = dest + (y * dow);
- const int yap = yapoints[y];
- if (yap > 0) {
- for (int x = 0; x < dw; x++) {
- const QRgba64 *pix = sptr + xpoints[x];
- const int xap = xapoints[x];
- if (xap > 0)
- *dptr = interpolate_4_pixels_rgb64(pix, pix + sow, xap * 256, yap * 256);
- else
- *dptr = interpolate256(pix[0], 256 - yap, pix[sow], yap);
- dptr++;
- }
- } else {
- for (int x = 0; x < dw; x++) {
- const QRgba64 *pix = sptr + xpoints[x];
- const int xap = xapoints[x];
- if (xap > 0)
- *dptr = interpolate256(pix[0], 256 - xap, pix[1], xap);
- else
- *dptr = pix[0];
- dptr++;
+ auto scaleSection = [&] (int yStart, int yEnd) {
+ for (int y = yStart; y < yEnd; ++y) {
+ const QRgba64 *sptr = ypoints[y];
+ QRgba64 *dptr = dest + (y * dow);
+ const int yap = yapoints[y];
+ if (yap > 0) {
+ for (int x = 0; x < dw; x++) {
+ const QRgba64 *pix = sptr + xpoints[x];
+ const int xap = xapoints[x];
+ if (xap > 0)
+ *dptr = interpolate_4_pixels_rgb64(pix, pix + sow, xap * 256, yap * 256);
+ else
+ *dptr = interpolate256(pix[0], 256 - yap, pix[sow], yap);
+ dptr++;
+ }
+ } else {
+ for (int x = 0; x < dw; x++) {
+ const QRgba64 *pix = sptr + xpoints[x];
+ const int xap = xapoints[x];
+ if (xap > 0)
+ *dptr = interpolate256(pix[0], 256 - xap, pix[1], xap);
+ else
+ *dptr = pix[0];
+ dptr++;
+ }
}
}
- }
+ };
+ multithread_pixels_function(isi, dh, scaleSection);
}
void qt_qimageScaleRgba64(QImageScaleInfo *isi, QRgba64 *dest,
@@ -616,33 +632,36 @@ static void qt_qimageScaleRgba64_up_x_down_y(QImageScaleInfo *isi, QRgba64 *dest
int *xapoints = isi->xapoints;
int *yapoints = isi->yapoints;
- for (int y = 0; y < dh; y++) {
- int Cy = (yapoints[y]) >> 16;
- int yap = (yapoints[y]) & 0xffff;
-
- QRgba64 *dptr = dest + (y * dow);
- for (int x = 0; x < dw; x++) {
- const QRgba64 *sptr = ypoints[y] + xpoints[x];
- qint64 r, g, b, a;
- qt_qimageScaleRgba64_helper(sptr, yap, Cy, sow, r, g, b, a);
-
- int xap = xapoints[x];
- if (xap > 0) {
- qint64 rr, gg, bb, aa;
- qt_qimageScaleRgba64_helper(sptr + 1, yap, Cy, sow, rr, gg, bb, aa);
-
- r = r * (256 - xap);
- g = g * (256 - xap);
- b = b * (256 - xap);
- a = a * (256 - xap);
- r = (r + (rr * xap)) >> 8;
- g = (g + (gg * xap)) >> 8;
- b = (b + (bb * xap)) >> 8;
- a = (a + (aa * xap)) >> 8;
+ auto scaleSection = [&] (int yStart, int yEnd) {
+ for (int y = yStart; y < yEnd; ++y) {
+ int Cy = (yapoints[y]) >> 16;
+ int yap = (yapoints[y]) & 0xffff;
+
+ QRgba64 *dptr = dest + (y * dow);
+ for (int x = 0; x < dw; x++) {
+ const QRgba64 *sptr = ypoints[y] + xpoints[x];
+ qint64 r, g, b, a;
+ qt_qimageScaleRgba64_helper(sptr, yap, Cy, sow, r, g, b, a);
+
+ int xap = xapoints[x];
+ if (xap > 0) {
+ qint64 rr, gg, bb, aa;
+ qt_qimageScaleRgba64_helper(sptr + 1, yap, Cy, sow, rr, gg, bb, aa);
+
+ r = r * (256 - xap);
+ g = g * (256 - xap);
+ b = b * (256 - xap);
+ a = a * (256 - xap);
+ r = (r + (rr * xap)) >> 8;
+ g = (g + (gg * xap)) >> 8;
+ b = (b + (bb * xap)) >> 8;
+ a = (a + (aa * xap)) >> 8;
+ }
+ *dptr++ = qRgba64(r >> 14, g >> 14, b >> 14, a >> 14);
}
- *dptr++ = qRgba64(r >> 14, g >> 14, b >> 14, a >> 14);
}
- }
+ };
+ multithread_pixels_function(isi, dh, scaleSection);
}
static void qt_qimageScaleRgba64_down_x_up_y(QImageScaleInfo *isi, QRgba64 *dest,
@@ -653,34 +672,37 @@ static void qt_qimageScaleRgba64_down_x_up_y(QImageScaleInfo *isi, QRgba64 *dest
int *xapoints = isi->xapoints;
int *yapoints = isi->yapoints;
- for (int y = 0; y < dh; y++) {
- QRgba64 *dptr = dest + (y * dow);
- for (int x = 0; x < dw; x++) {
- int Cx = xapoints[x] >> 16;
- int xap = xapoints[x] & 0xffff;
-
- const QRgba64 *sptr = ypoints[y] + xpoints[x];
- qint64 r, g, b, a;
- qt_qimageScaleRgba64_helper(sptr, xap, Cx, 1, r, g, b, a);
-
- int yap = yapoints[y];
- if (yap > 0) {
- qint64 rr, gg, bb, aa;
- qt_qimageScaleRgba64_helper(sptr + sow, xap, Cx, 1, rr, gg, bb, aa);
-
- r = r * (256 - yap);
- g = g * (256 - yap);
- b = b * (256 - yap);
- a = a * (256 - yap);
- r = (r + (rr * yap)) >> 8;
- g = (g + (gg * yap)) >> 8;
- b = (b + (bb * yap)) >> 8;
- a = (a + (aa * yap)) >> 8;
+ auto scaleSection = [&] (int yStart, int yEnd) {
+ for (int y = yStart; y < yEnd; ++y) {
+ QRgba64 *dptr = dest + (y * dow);
+ for (int x = 0; x < dw; x++) {
+ int Cx = xapoints[x] >> 16;
+ int xap = xapoints[x] & 0xffff;
+
+ const QRgba64 *sptr = ypoints[y] + xpoints[x];
+ qint64 r, g, b, a;
+ qt_qimageScaleRgba64_helper(sptr, xap, Cx, 1, r, g, b, a);
+
+ int yap = yapoints[y];
+ if (yap > 0) {
+ qint64 rr, gg, bb, aa;
+ qt_qimageScaleRgba64_helper(sptr + sow, xap, Cx, 1, rr, gg, bb, aa);
+
+ r = r * (256 - yap);
+ g = g * (256 - yap);
+ b = b * (256 - yap);
+ a = a * (256 - yap);
+ r = (r + (rr * yap)) >> 8;
+ g = (g + (gg * yap)) >> 8;
+ b = (b + (bb * yap)) >> 8;
+ a = (a + (aa * yap)) >> 8;
+ }
+ *dptr = qRgba64(r >> 14, g >> 14, b >> 14, a >> 14);
+ dptr++;
}
- *dptr = qRgba64(r >> 14, g >> 14, b >> 14, a >> 14);
- dptr++;
}
- }
+ };
+ multithread_pixels_function(isi, dh, scaleSection);
}
static void qt_qimageScaleRgba64_down_xy(QImageScaleInfo *isi, QRgba64 *dest,
@@ -691,43 +713,261 @@ static void qt_qimageScaleRgba64_down_xy(QImageScaleInfo *isi, QRgba64 *dest,
int *xapoints = isi->xapoints;
int *yapoints = isi->yapoints;
- for (int y = 0; y < dh; y++) {
- int Cy = (yapoints[y]) >> 16;
- int yap = (yapoints[y]) & 0xffff;
-
- QRgba64 *dptr = dest + (y * dow);
- for (int x = 0; x < dw; x++) {
- int Cx = xapoints[x] >> 16;
- int xap = xapoints[x] & 0xffff;
-
- const QRgba64 *sptr = ypoints[y] + xpoints[x];
- qint64 rx, gx, bx, ax;
- qt_qimageScaleRgba64_helper(sptr, xap, Cx, 1, rx, gx, bx, ax);
-
- qint64 r = rx * yap;
- qint64 g = gx * yap;
- qint64 b = bx * yap;
- qint64 a = ax * yap;
- int j;
- for (j = (1 << 14) - yap; j > Cy; j -= Cy) {
+ auto scaleSection = [&] (int yStart, int yEnd) {
+ for (int y = yStart; y < yEnd; ++y) {
+ int Cy = (yapoints[y]) >> 16;
+ int yap = (yapoints[y]) & 0xffff;
+
+ QRgba64 *dptr = dest + (y * dow);
+ for (int x = 0; x < dw; x++) {
+ int Cx = xapoints[x] >> 16;
+ int xap = xapoints[x] & 0xffff;
+
+ const QRgba64 *sptr = ypoints[y] + xpoints[x];
+ qint64 rx, gx, bx, ax;
+ qt_qimageScaleRgba64_helper(sptr, xap, Cx, 1, rx, gx, bx, ax);
+
+ qint64 r = rx * yap;
+ qint64 g = gx * yap;
+ qint64 b = bx * yap;
+ qint64 a = ax * yap;
+ int j;
+ for (j = (1 << 14) - yap; j > Cy; j -= Cy) {
+ sptr += sow;
+ qt_qimageScaleRgba64_helper(sptr, xap, Cx, 1, rx, gx, bx, ax);
+ r += rx * Cy;
+ g += gx * Cy;
+ b += bx * Cy;
+ a += ax * Cy;
+ }
sptr += sow;
qt_qimageScaleRgba64_helper(sptr, xap, Cx, 1, rx, gx, bx, ax);
- r += rx * Cy;
- g += gx * Cy;
- b += bx * Cy;
- a += ax * Cy;
+ r += rx * j;
+ g += gx * j;
+ b += bx * j;
+ a += ax * j;
+
+ *dptr = qRgba64(r >> 28, g >> 28, b >> 28, a >> 28);
+ dptr++;
}
- sptr += sow;
- qt_qimageScaleRgba64_helper(sptr, xap, Cx, 1, rx, gx, bx, ax);
- r += rx * j;
- g += gx * j;
- b += bx * j;
- a += ax * j;
-
- *dptr = qRgba64(r >> 28, g >> 28, b >> 28, a >> 28);
- dptr++;
}
+ };
+ multithread_pixels_function(isi, dh, scaleSection);
+}
+#endif
+
+#if QT_CONFIG(raster_fp)
+static void qt_qimageScaleRgbaFP_up_x_down_y(QImageScaleInfo *isi, QRgbaFloat32 *dest,
+ int dw, int dh, int dow, int sow);
+
+static void qt_qimageScaleRgbaFP_down_x_up_y(QImageScaleInfo *isi, QRgbaFloat32 *dest,
+ int dw, int dh, int dow, int sow);
+
+static void qt_qimageScaleRgbaFP_down_xy(QImageScaleInfo *isi, QRgbaFloat32 *dest,
+ int dw, int dh, int dow, int sow);
+
+static void qt_qimageScaleRgbaFP_up_xy(QImageScaleInfo *isi, QRgbaFloat32 *dest,
+ int dw, int dh, int dow, int sow)
+{
+ const QRgbaFloat32 **ypoints = (const QRgbaFloat32 **)isi->ypoints;
+ int *xpoints = isi->xpoints;
+ int *xapoints = isi->xapoints;
+ int *yapoints = isi->yapoints;
+
+ auto scaleSection = [&] (int yStart, int yEnd) {
+ for (int y = yStart; y < yEnd; ++y) {
+ const QRgbaFloat32 *sptr = ypoints[y];
+ QRgbaFloat32 *dptr = dest + (y * dow);
+ const int yap = yapoints[y];
+ if (yap > 0) {
+ for (int x = 0; x < dw; x++) {
+ const QRgbaFloat32 *pix = sptr + xpoints[x];
+ const int xap = xapoints[x];
+ if (xap > 0)
+ *dptr = interpolate_4_pixels_rgba32f(pix, pix + sow, xap * 256, yap * 256);
+ else
+ *dptr = interpolate_rgba32f(pix[0], 256 - yap, pix[sow], yap);
+ dptr++;
+ }
+ } else {
+ for (int x = 0; x < dw; x++) {
+ const QRgbaFloat32 *pix = sptr + xpoints[x];
+ const int xap = xapoints[x];
+ if (xap > 0)
+ *dptr = interpolate_rgba32f(pix[0], 256 - xap, pix[1], xap);
+ else
+ *dptr = pix[0];
+ dptr++;
+ }
+ }
+ }
+ };
+ multithread_pixels_function(isi, dh, scaleSection);
+}
+
+void qt_qimageScaleRgbaFP(QImageScaleInfo *isi, QRgbaFloat32 *dest,
+ int dw, int dh, int dow, int sow)
+{
+ if (isi->xup_yup == 3)
+ qt_qimageScaleRgbaFP_up_xy(isi, dest, dw, dh, dow, sow);
+ else if (isi->xup_yup == 1)
+ qt_qimageScaleRgbaFP_up_x_down_y(isi, dest, dw, dh, dow, sow);
+ else if (isi->xup_yup == 2)
+ qt_qimageScaleRgbaFP_down_x_up_y(isi, dest, dw, dh, dow, sow);
+ else
+ qt_qimageScaleRgbaFP_down_xy(isi, dest, dw, dh, dow, sow);
+}
+
+inline static void qt_qimageScaleRgbaFP_helper(const QRgbaFloat32 *pix, int xyap, int Cxy, int step, float &r, float &g, float &b, float &a)
+{
+ constexpr float f = (1.0f / float(1<<14));
+ const float xyapf = xyap * f;
+ const float Cxyf = Cxy * f;
+ r = pix->red() * xyapf;
+ g = pix->green() * xyapf;
+ b = pix->blue() * xyapf;
+ a = pix->alpha() * xyapf;
+ int j;
+ for (j = (1 << 14) - xyap; j > Cxy; j -= Cxy ){
+ pix += step;
+ r += pix->red() * Cxyf;
+ g += pix->green() * Cxyf;
+ b += pix->blue() * Cxyf;
+ a += pix->alpha() * Cxyf;
}
+ pix += step;
+ const float jf = j * f;
+ r += pix->red() * jf;
+ g += pix->green() * jf;
+ b += pix->blue() * jf;
+ a += pix->alpha() * jf;
+}
+
+static void qt_qimageScaleRgbaFP_up_x_down_y(QImageScaleInfo *isi, QRgbaFloat32 *dest,
+ int dw, int dh, int dow, int sow)
+{
+ const QRgbaFloat32 **ypoints = (const QRgbaFloat32 **)isi->ypoints;
+ int *xpoints = isi->xpoints;
+ int *xapoints = isi->xapoints;
+ int *yapoints = isi->yapoints;
+
+ auto scaleSection = [&] (int yStart, int yEnd) {
+ for (int y = yStart; y < yEnd; ++y) {
+ int Cy = (yapoints[y]) >> 16;
+ int yap = (yapoints[y]) & 0xffff;
+
+ QRgbaFloat32 *dptr = dest + (y * dow);
+ for (int x = 0; x < dw; x++) {
+ const QRgbaFloat32 *sptr = ypoints[y] + xpoints[x];
+ float r, g, b, a;
+ qt_qimageScaleRgbaFP_helper(sptr, yap, Cy, sow, r, g, b, a);
+
+ int xap = xapoints[x];
+ float xapf = xap * (1.f / 256.f);
+ if (xap > 0) {
+ float rr, gg, bb, aa;
+ qt_qimageScaleRgbaFP_helper(sptr + 1, yap, Cy, sow, rr, gg, bb, aa);
+
+ r = (r * (1.0f - xapf) + (rr * xapf));
+ g = (g * (1.0f - xapf) + (gg * xapf));
+ b = (b * (1.0f - xapf) + (bb * xapf));
+ a = (a * (1.0f - xapf) + (aa * xapf));
+ }
+ *dptr++ = QRgbaFloat32{r, g, b, a};
+ }
+ }
+ };
+ multithread_pixels_function(isi, dh, scaleSection);
+}
+
+static void qt_qimageScaleRgbaFP_down_x_up_y(QImageScaleInfo *isi, QRgbaFloat32 *dest,
+ int dw, int dh, int dow, int sow)
+{
+ const QRgbaFloat32 **ypoints = (const QRgbaFloat32 **)isi->ypoints;
+ int *xpoints = isi->xpoints;
+ int *xapoints = isi->xapoints;
+ int *yapoints = isi->yapoints;
+
+ auto scaleSection = [&] (int yStart, int yEnd) {
+ for (int y = yStart; y < yEnd; ++y) {
+ QRgbaFloat32 *dptr = dest + (y * dow);
+ for (int x = 0; x < dw; x++) {
+ int Cx = xapoints[x] >> 16;
+ int xap = xapoints[x] & 0xffff;
+
+ const QRgbaFloat32 *sptr = ypoints[y] + xpoints[x];
+ float r, g, b, a;
+ qt_qimageScaleRgbaFP_helper(sptr, xap, Cx, 1, r, g, b, a);
+
+ int yap = yapoints[y];
+ float yapf = yap * (1.f / 256.f);
+ if (yap > 0) {
+ float rr, gg, bb, aa;
+ qt_qimageScaleRgbaFP_helper(sptr + sow, xap, Cx, 1, rr, gg, bb, aa);
+
+ r = (r * (1.0f - yapf) + (rr * yapf));
+ g = (g * (1.0f - yapf) + (gg * yapf));
+ b = (b * (1.0f - yapf) + (bb * yapf));
+ a = (a * (1.0f - yapf) + (aa * yapf));
+ }
+ *dptr++ = QRgbaFloat32{r, g, b, a};
+ }
+ }
+ };
+ multithread_pixels_function(isi, dh, scaleSection);
+}
+
+static void qt_qimageScaleRgbaFP_down_xy(QImageScaleInfo *isi, QRgbaFloat32 *dest,
+ int dw, int dh, int dow, int sow)
+{
+ const QRgbaFloat32 **ypoints = (const QRgbaFloat32 **)isi->ypoints;
+ int *xpoints = isi->xpoints;
+ int *xapoints = isi->xapoints;
+ int *yapoints = isi->yapoints;
+
+ auto scaleSection = [&] (int yStart, int yEnd) {
+ constexpr float f = 1.f / float(1 << 14);
+ for (int y = yStart; y < yEnd; ++y) {
+ int Cy = (yapoints[y]) >> 16;
+ int yap = (yapoints[y]) & 0xffff;
+
+ QRgbaFloat32 *dptr = dest + (y * dow);
+ for (int x = 0; x < dw; x++) {
+ int Cx = xapoints[x] >> 16;
+ int xap = xapoints[x] & 0xffff;
+
+ const QRgbaFloat32 *sptr = ypoints[y] + xpoints[x];
+ float rx, gx, bx, ax;
+ qt_qimageScaleRgbaFP_helper(sptr, xap, Cx, 1, rx, gx, bx, ax);
+
+ const float yapf = yap * f;
+ const float Cyf = Cy * f;
+ float r = rx * yapf;
+ float g = gx * yapf;
+ float b = bx * yapf;
+ float a = ax * yapf;
+ int j;
+ for (j = (1 << 14) - yap; j > Cy; j -= Cy) {
+ sptr += sow;
+ qt_qimageScaleRgbaFP_helper(sptr, xap, Cx, 1, rx, gx, bx, ax);
+ r += rx * Cyf;
+ g += gx * Cyf;
+ b += bx * Cyf;
+ a += ax * Cyf;
+ }
+ sptr += sow;
+ qt_qimageScaleRgbaFP_helper(sptr, xap, Cx, 1, rx, gx, bx, ax);
+ const float jf = j * f;
+ r += rx * jf;
+ g += gx * jf;
+ b += bx * jf;
+ a += ax * jf;
+
+ *dptr++ = QRgbaFloat32{r, g, b, a};
+ }
+ }
+ };
+ multithread_pixels_function(isi, dh, scaleSection);
}
#endif
@@ -817,31 +1057,34 @@ static void qt_qimageScaleAARGB_up_x_down_y(QImageScaleInfo *isi, unsigned int *
int *yapoints = isi->yapoints;
/* go through every scanline in the output buffer */
- for (int y = 0; y < dh; y++) {
- int Cy = yapoints[y] >> 16;
- int yap = yapoints[y] & 0xffff;
-
- unsigned int *dptr = dest + (y * dow);
- for (int x = 0; x < dw; x++) {
- const unsigned int *sptr = ypoints[y] + xpoints[x];
- int r, g, b;
- qt_qimageScaleAARGB_helper(sptr, yap, Cy, sow, r, g, b);
-
- int xap = xapoints[x];
- if (xap > 0) {
- int rr, bb, gg;
- qt_qimageScaleAARGB_helper(sptr + 1, yap, Cy, sow, rr, gg, bb);
-
- r = r * (256 - xap);
- g = g * (256 - xap);
- b = b * (256 - xap);
- r = (r + (rr * xap)) >> 8;
- g = (g + (gg * xap)) >> 8;
- b = (b + (bb * xap)) >> 8;
+ auto scaleSection = [&] (int yStart, int yEnd) {
+ for (int y = yStart; y < yEnd; ++y) {
+ int Cy = yapoints[y] >> 16;
+ int yap = yapoints[y] & 0xffff;
+
+ unsigned int *dptr = dest + (y * dow);
+ for (int x = 0; x < dw; x++) {
+ const unsigned int *sptr = ypoints[y] + xpoints[x];
+ int r, g, b;
+ qt_qimageScaleAARGB_helper(sptr, yap, Cy, sow, r, g, b);
+
+ int xap = xapoints[x];
+ if (xap > 0) {
+ int rr, bb, gg;
+ qt_qimageScaleAARGB_helper(sptr + 1, yap, Cy, sow, rr, gg, bb);
+
+ r = r * (256 - xap);
+ g = g * (256 - xap);
+ b = b * (256 - xap);
+ r = (r + (rr * xap)) >> 8;
+ g = (g + (gg * xap)) >> 8;
+ b = (b + (bb * xap)) >> 8;
+ }
+ *dptr++ = qRgb(r >> 14, g >> 14, b >> 14);
}
- *dptr++ = qRgb(r >> 14, g >> 14, b >> 14);
}
- }
+ };
+ multithread_pixels_function(isi, dh, scaleSection);
}
static void qt_qimageScaleAARGB_down_x_up_y(QImageScaleInfo *isi, unsigned int *dest,
@@ -853,31 +1096,34 @@ static void qt_qimageScaleAARGB_down_x_up_y(QImageScaleInfo *isi, unsigned int *
int *yapoints = isi->yapoints;
/* go through every scanline in the output buffer */
- for (int y = 0; y < dh; y++) {
- unsigned int *dptr = dest + (y * dow);
- for (int x = 0; x < dw; x++) {
- int Cx = xapoints[x] >> 16;
- int xap = xapoints[x] & 0xffff;
-
- const unsigned int *sptr = ypoints[y] + xpoints[x];
- int r, g, b;
- qt_qimageScaleAARGB_helper(sptr, xap, Cx, 1, r, g, b);
-
- int yap = yapoints[y];
- if (yap > 0) {
- int rr, bb, gg;
- qt_qimageScaleAARGB_helper(sptr + sow, xap, Cx, 1, rr, gg, bb);
-
- r = r * (256 - yap);
- g = g * (256 - yap);
- b = b * (256 - yap);
- r = (r + (rr * yap)) >> 8;
- g = (g + (gg * yap)) >> 8;
- b = (b + (bb * yap)) >> 8;
+ auto scaleSection = [&] (int yStart, int yEnd) {
+ for (int y = yStart; y < yEnd; ++y) {
+ unsigned int *dptr = dest + (y * dow);
+ for (int x = 0; x < dw; x++) {
+ int Cx = xapoints[x] >> 16;
+ int xap = xapoints[x] & 0xffff;
+
+ const unsigned int *sptr = ypoints[y] + xpoints[x];
+ int r, g, b;
+ qt_qimageScaleAARGB_helper(sptr, xap, Cx, 1, r, g, b);
+
+ int yap = yapoints[y];
+ if (yap > 0) {
+ int rr, bb, gg;
+ qt_qimageScaleAARGB_helper(sptr + sow, xap, Cx, 1, rr, gg, bb);
+
+ r = r * (256 - yap);
+ g = g * (256 - yap);
+ b = b * (256 - yap);
+ r = (r + (rr * yap)) >> 8;
+ g = (g + (gg * yap)) >> 8;
+ b = (b + (bb * yap)) >> 8;
+ }
+ *dptr++ = qRgb(r >> 14, g >> 14, b >> 14);
}
- *dptr++ = qRgb(r >> 14, g >> 14, b >> 14);
}
- }
+ };
+ multithread_pixels_function(isi, dh, scaleSection);
}
static void qt_qimageScaleAARGB_down_xy(QImageScaleInfo *isi, unsigned int *dest,
@@ -888,43 +1134,46 @@ static void qt_qimageScaleAARGB_down_xy(QImageScaleInfo *isi, unsigned int *dest
int *xapoints = isi->xapoints;
int *yapoints = isi->yapoints;
- for (int y = 0; y < dh; y++) {
- int Cy = yapoints[y] >> 16;
- int yap = yapoints[y] & 0xffff;
+ auto scaleSection = [&] (int yStart, int yEnd) {
+ for (int y = yStart; y < yEnd; ++y) {
+ int Cy = yapoints[y] >> 16;
+ int yap = yapoints[y] & 0xffff;
- unsigned int *dptr = dest + (y * dow);
- for (int x = 0; x < dw; x++) {
- int Cx = xapoints[x] >> 16;
- int xap = xapoints[x] & 0xffff;
+ unsigned int *dptr = dest + (y * dow);
+ for (int x = 0; x < dw; x++) {
+ int Cx = xapoints[x] >> 16;
+ int xap = xapoints[x] & 0xffff;
- const unsigned int *sptr = ypoints[y] + xpoints[x];
- int rx, gx, bx;
- qt_qimageScaleAARGB_helper(sptr, xap, Cx, 1, rx, gx, bx);
+ const unsigned int *sptr = ypoints[y] + xpoints[x];
+ int rx, gx, bx;
+ qt_qimageScaleAARGB_helper(sptr, xap, Cx, 1, rx, gx, bx);
- int r = (rx >> 4) * yap;
- int g = (gx >> 4) * yap;
- int b = (bx >> 4) * yap;
+ int r = (rx >> 4) * yap;
+ int g = (gx >> 4) * yap;
+ int b = (bx >> 4) * yap;
- int j;
- for (j = (1 << 14) - yap; j > Cy; j -= Cy) {
+ int j;
+ for (j = (1 << 14) - yap; j > Cy; j -= Cy) {
+ sptr += sow;
+ qt_qimageScaleAARGB_helper(sptr, xap, Cx, 1, rx, gx, bx);
+
+ r += (rx >> 4) * Cy;
+ g += (gx >> 4) * Cy;
+ b += (bx >> 4) * Cy;
+ }
sptr += sow;
qt_qimageScaleAARGB_helper(sptr, xap, Cx, 1, rx, gx, bx);
- r += (rx >> 4) * Cy;
- g += (gx >> 4) * Cy;
- b += (bx >> 4) * Cy;
- }
- sptr += sow;
- qt_qimageScaleAARGB_helper(sptr, xap, Cx, 1, rx, gx, bx);
-
- r += (rx >> 4) * j;
- g += (gx >> 4) * j;
- b += (bx >> 4) * j;
+ r += (rx >> 4) * j;
+ g += (gx >> 4) * j;
+ b += (bx >> 4) * j;
- *dptr = qRgb(r >> 24, g >> 24, b >> 24);
- dptr++;
+ *dptr = qRgb(r >> 24, g >> 24, b >> 24);
+ dptr++;
+ }
}
- }
+ };
+ multithread_pixels_function(isi, dh, scaleSection);
}
QImage qSmoothScaleImage(const QImage &src, int dw, int dh)
@@ -947,6 +1196,12 @@ QImage qSmoothScaleImage(const QImage &src, int dw, int dh)
return QImage();
}
+#if QT_CONFIG(raster_fp)
+ if (qt_fpColorPrecision(src.format()))
+ qt_qimageScaleRgbaFP(scaleinfo, (QRgbaFloat32 *)buffer.scanLine(0),
+ dw, dh, dw, src.bytesPerLine() / 16);
+ else
+#endif
#if QT_CONFIG(raster_64bit)
if (src.depth() > 32)
qt_qimageScaleRgba64(scaleinfo, (QRgba64 *)buffer.scanLine(0),
diff --git a/src/gui/painting/qimagescale_neon.cpp b/src/gui/painting/qimagescale_neon.cpp
index 4ae113b002..074b819862 100644
--- a/src/gui/painting/qimagescale_neon.cpp
+++ b/src/gui/painting/qimagescale_neon.cpp
@@ -1,52 +1,47 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the QtGui module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#include "qimagescale_p.h"
#include "qimage.h"
#include <private/qsimd_p.h>
+#if QT_CONFIG(thread) && !defined(Q_OS_WASM)
+#include <qsemaphore.h>
+#include <qthreadpool.h>
+#include <private/qthreadpool_p.h>
+#endif
+
#if defined(__ARM_NEON__)
QT_BEGIN_NAMESPACE
using namespace QImageScale;
+template<typename T>
+static inline void multithread_pixels_function(QImageScaleInfo *isi, int dh, const T &scaleSection)
+{
+#if QT_CONFIG(thread) && !defined(Q_OS_WASM)
+ int segments = (qsizetype(isi->sh) * isi->sw) / (1<<16);
+ segments = std::min(segments, dh);
+ QThreadPool *threadPool = QThreadPoolPrivate::qtGuiInstance();
+ if (segments > 1 && threadPool && !threadPool->contains(QThread::currentThread())) {
+ QSemaphore semaphore;
+ int y = 0;
+ for (int i = 0; i < segments; ++i) {
+ int yn = (dh - y) / (segments - i);
+ threadPool->start([&, y, yn]() {
+ scaleSection(y, y + yn);
+ semaphore.release(1);
+ });
+ y += yn;
+ }
+ semaphore.acquire(segments);
+ return;
+ }
+#endif
+ scaleSection(0, dh);
+}
+
inline static uint32x4_t qt_qimageScaleAARGBA_helper(const unsigned int *pix, int xyap, int Cxy, int step)
{
uint32x2_t vpix32 = vmov_n_u32(*pix);
@@ -76,33 +71,36 @@ void qt_qimageScaleAARGBA_up_x_down_y_neon(QImageScaleInfo *isi, unsigned int *d
int *yapoints = isi->yapoints;
/* go through every scanline in the output buffer */
- for (int y = 0; y < dh; y++) {
- int Cy = yapoints[y] >> 16;
- int yap = yapoints[y] & 0xffff;
-
- unsigned int *dptr = dest + (y * dow);
- for (int x = 0; x < dw; x++) {
- const unsigned int *sptr = ypoints[y] + xpoints[x];
- uint32x4_t vx = qt_qimageScaleAARGBA_helper(sptr, yap, Cy, sow);
-
- int xap = xapoints[x];
- if (xap > 0) {
- uint32x4_t vr = qt_qimageScaleAARGBA_helper(sptr + 1, yap, Cy, sow);
-
- vx = vmulq_n_u32(vx, 256 - xap);
- vr = vmulq_n_u32(vr, xap);
- vx = vaddq_u32(vx, vr);
- vx = vshrq_n_u32(vx, 8);
+ auto scaleSection = [&] (int yStart, int yEnd) {
+ for (int y = yStart; y < yEnd; ++y) {
+ int Cy = yapoints[y] >> 16;
+ int yap = yapoints[y] & 0xffff;
+
+ unsigned int *dptr = dest + (y * dow);
+ for (int x = 0; x < dw; x++) {
+ const unsigned int *sptr = ypoints[y] + xpoints[x];
+ uint32x4_t vx = qt_qimageScaleAARGBA_helper(sptr, yap, Cy, sow);
+
+ int xap = xapoints[x];
+ if (xap > 0) {
+ uint32x4_t vr = qt_qimageScaleAARGBA_helper(sptr + 1, yap, Cy, sow);
+
+ vx = vmulq_n_u32(vx, 256 - xap);
+ vr = vmulq_n_u32(vr, xap);
+ vx = vaddq_u32(vx, vr);
+ vx = vshrq_n_u32(vx, 8);
+ }
+ vx = vshrq_n_u32(vx, 14);
+ const uint16x4_t vx16 = vmovn_u32(vx);
+ const uint8x8_t vx8 = vmovn_u16(vcombine_u16(vx16, vx16));
+ *dptr = vget_lane_u32(vreinterpret_u32_u8(vx8), 0);
+ if (RGB)
+ *dptr |= 0xff000000;
+ dptr++;
}
- vx = vshrq_n_u32(vx, 14);
- const uint16x4_t vx16 = vmovn_u32(vx);
- const uint8x8_t vx8 = vmovn_u16(vcombine_u16(vx16, vx16));
- *dptr = vget_lane_u32(vreinterpret_u32_u8(vx8), 0);
- if (RGB)
- *dptr |= 0xff000000;
- dptr++;
}
- }
+ };
+ multithread_pixels_function(isi, dh, scaleSection);
}
template<bool RGB>
@@ -115,33 +113,36 @@ void qt_qimageScaleAARGBA_down_x_up_y_neon(QImageScaleInfo *isi, unsigned int *d
int *yapoints = isi->yapoints;
/* go through every scanline in the output buffer */
- for (int y = 0; y < dh; y++) {
- unsigned int *dptr = dest + (y * dow);
- for (int x = 0; x < dw; x++) {
- int Cx = xapoints[x] >> 16;
- int xap = xapoints[x] & 0xffff;
-
- const unsigned int *sptr = ypoints[y] + xpoints[x];
- uint32x4_t vx = qt_qimageScaleAARGBA_helper(sptr, xap, Cx, 1);
-
- int yap = yapoints[y];
- if (yap > 0) {
- uint32x4_t vr = qt_qimageScaleAARGBA_helper(sptr + sow, xap, Cx, 1);
-
- vx = vmulq_n_u32(vx, 256 - yap);
- vr = vmulq_n_u32(vr, yap);
- vx = vaddq_u32(vx, vr);
- vx = vshrq_n_u32(vx, 8);
+ auto scaleSection = [&] (int yStart, int yEnd) {
+ for (int y = yStart; y < yEnd; ++y) {
+ unsigned int *dptr = dest + (y * dow);
+ for (int x = 0; x < dw; x++) {
+ int Cx = xapoints[x] >> 16;
+ int xap = xapoints[x] & 0xffff;
+
+ const unsigned int *sptr = ypoints[y] + xpoints[x];
+ uint32x4_t vx = qt_qimageScaleAARGBA_helper(sptr, xap, Cx, 1);
+
+ int yap = yapoints[y];
+ if (yap > 0) {
+ uint32x4_t vr = qt_qimageScaleAARGBA_helper(sptr + sow, xap, Cx, 1);
+
+ vx = vmulq_n_u32(vx, 256 - yap);
+ vr = vmulq_n_u32(vr, yap);
+ vx = vaddq_u32(vx, vr);
+ vx = vshrq_n_u32(vx, 8);
+ }
+ vx = vshrq_n_u32(vx, 14);
+ const uint16x4_t vx16 = vmovn_u32(vx);
+ const uint8x8_t vx8 = vmovn_u16(vcombine_u16(vx16, vx16));
+ *dptr = vget_lane_u32(vreinterpret_u32_u8(vx8), 0);
+ if (RGB)
+ *dptr |= 0xff000000;
+ dptr++;
}
- vx = vshrq_n_u32(vx, 14);
- const uint16x4_t vx16 = vmovn_u32(vx);
- const uint8x8_t vx8 = vmovn_u16(vcombine_u16(vx16, vx16));
- *dptr = vget_lane_u32(vreinterpret_u32_u8(vx8), 0);
- if (RGB)
- *dptr |= 0xff000000;
- dptr++;
}
- }
+ };
+ multithread_pixels_function(isi, dh, scaleSection);
}
template<bool RGB>
@@ -153,43 +154,46 @@ void qt_qimageScaleAARGBA_down_xy_neon(QImageScaleInfo *isi, unsigned int *dest,
int *xapoints = isi->xapoints;
int *yapoints = isi->yapoints;
- for (int y = 0; y < dh; y++) {
- int Cy = yapoints[y] >> 16;
- int yap = yapoints[y] & 0xffff;
-
- unsigned int *dptr = dest + (y * dow);
- for (int x = 0; x < dw; x++) {
- const int Cx = xapoints[x] >> 16;
- const int xap = xapoints[x] & 0xffff;
+ auto scaleSection = [&] (int yStart, int yEnd) {
+ for (int y = yStart; y < yEnd; ++y) {
+ int Cy = yapoints[y] >> 16;
+ int yap = yapoints[y] & 0xffff;
- const unsigned int *sptr = ypoints[y] + xpoints[x];
- uint32x4_t vx = qt_qimageScaleAARGBA_helper(sptr, xap, Cx, 1);
- vx = vshrq_n_u32(vx, 4);
- uint32x4_t vr = vmulq_n_u32(vx, yap);
+ unsigned int *dptr = dest + (y * dow);
+ for (int x = 0; x < dw; x++) {
+ const int Cx = xapoints[x] >> 16;
+ const int xap = xapoints[x] & 0xffff;
- int j;
- for (j = (1 << 14) - yap; j > Cy; j -= Cy) {
+ const unsigned int *sptr = ypoints[y] + xpoints[x];
+ uint32x4_t vx = qt_qimageScaleAARGBA_helper(sptr, xap, Cx, 1);
+ vx = vshrq_n_u32(vx, 4);
+ uint32x4_t vr = vmulq_n_u32(vx, yap);
+
+ int j;
+ for (j = (1 << 14) - yap; j > Cy; j -= Cy) {
+ sptr += sow;
+ vx = qt_qimageScaleAARGBA_helper(sptr, xap, Cx, 1);
+ vx = vshrq_n_u32(vx, 4);
+ vx = vmulq_n_u32(vx, Cy);
+ vr = vaddq_u32(vr, vx);
+ }
sptr += sow;
vx = qt_qimageScaleAARGBA_helper(sptr, xap, Cx, 1);
vx = vshrq_n_u32(vx, 4);
- vx = vmulq_n_u32(vx, Cy);
+ vx = vmulq_n_u32(vx, j);
vr = vaddq_u32(vr, vx);
+
+ vx = vshrq_n_u32(vr, 24);
+ const uint16x4_t vx16 = vmovn_u32(vx);
+ const uint8x8_t vx8 = vmovn_u16(vcombine_u16(vx16, vx16));
+ *dptr = vget_lane_u32(vreinterpret_u32_u8(vx8), 0);
+ if (RGB)
+ *dptr |= 0xff000000;
+ dptr++;
}
- sptr += sow;
- vx = qt_qimageScaleAARGBA_helper(sptr, xap, Cx, 1);
- vx = vshrq_n_u32(vx, 4);
- vx = vmulq_n_u32(vx, j);
- vr = vaddq_u32(vr, vx);
-
- vx = vshrq_n_u32(vr, 24);
- const uint16x4_t vx16 = vmovn_u32(vx);
- const uint8x8_t vx8 = vmovn_u16(vcombine_u16(vx16, vx16));
- *dptr = vget_lane_u32(vreinterpret_u32_u8(vx8), 0);
- if (RGB)
- *dptr |= 0xff000000;
- dptr++;
}
- }
+ };
+ multithread_pixels_function(isi, dh, scaleSection);
}
template void qt_qimageScaleAARGBA_up_x_down_y_neon<false>(QImageScaleInfo *isi, unsigned int *dest,
diff --git a/src/gui/painting/qimagescale_p.h b/src/gui/painting/qimagescale_p.h
index 244d681718..d297443091 100644
--- a/src/gui/painting/qimagescale_p.h
+++ b/src/gui/painting/qimagescale_p.h
@@ -1,41 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the QtGui module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2019 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#ifndef QIMAGESCALE_P_H
#define QIMAGESCALE_P_H
@@ -51,6 +15,7 @@
//
#include <qimage.h>
+#include <private/qglobal_p.h>
QT_BEGIN_NAMESPACE
@@ -66,6 +31,8 @@ namespace QImageScale {
int *xapoints{nullptr};
int *yapoints{nullptr};
int xup_yup{0};
+ int sh = 0;
+ int sw = 0;
};
}
diff --git a/src/gui/painting/qimagescale_sse4.cpp b/src/gui/painting/qimagescale_sse4.cpp
index 5861a2e2ff..982e533a32 100644
--- a/src/gui/painting/qimagescale_sse4.cpp
+++ b/src/gui/painting/qimagescale_sse4.cpp
@@ -1,53 +1,48 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the QtGui module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#include "qimagescale_p.h"
#include "qimage.h"
#include <private/qdrawhelper_x86_p.h>
#include <private/qsimd_p.h>
+#if QT_CONFIG(thread) && !defined(Q_OS_WASM)
+#include <qsemaphore.h>
+#include <qthreadpool.h>
+#include <private/qthreadpool_p.h>
+#endif
+
#if defined(QT_COMPILER_SUPPORTS_SSE4_1)
QT_BEGIN_NAMESPACE
using namespace QImageScale;
+template<typename T>
+static inline void multithread_pixels_function(QImageScaleInfo *isi, int dh, const T &scaleSection)
+{
+#if QT_CONFIG(thread) && !defined(Q_OS_WASM)
+ int segments = (qsizetype(isi->sh) * isi->sw) / (1<<16);
+ segments = std::min(segments, dh);
+ QThreadPool *threadPool = QThreadPoolPrivate::qtGuiInstance();
+ if (segments > 1 && threadPool && !threadPool->contains(QThread::currentThread())) {
+ QSemaphore semaphore;
+ int y = 0;
+ for (int i = 0; i < segments; ++i) {
+ int yn = (dh - y) / (segments - i);
+ threadPool->start([&, y, yn]() {
+ scaleSection(y, y + yn);
+ semaphore.release(1);
+ });
+ y += yn;
+ }
+ semaphore.acquire(segments);
+ return;
+ }
+#endif
+ scaleSection(0, dh);
+}
+
inline static __m128i Q_DECL_VECTORCALL
qt_qimageScaleAARGBA_helper(const unsigned int *pix, int xyap, int Cxy, int step, const __m128i vxyap, const __m128i vCxy)
{
@@ -70,44 +65,47 @@ void qt_qimageScaleAARGBA_up_x_down_y_sse4(QImageScaleInfo *isi, unsigned int *d
int dw, int dh, int dow, int sow)
{
const unsigned int **ypoints = isi->ypoints;
- int *xpoints = isi->xpoints;
- int *xapoints = isi->xapoints;
- int *yapoints = isi->yapoints;
+ const int *xpoints = isi->xpoints;
+ const int *xapoints = isi->xapoints;
+ const int *yapoints = isi->yapoints;
const __m128i v256 = _mm_set1_epi32(256);
/* go through every scanline in the output buffer */
- for (int y = 0; y < dh; y++) {
- int Cy = yapoints[y] >> 16;
- int yap = yapoints[y] & 0xffff;
- const __m128i vCy = _mm_set1_epi32(Cy);
- const __m128i vyap = _mm_set1_epi32(yap);
-
- unsigned int *dptr = dest + (y * dow);
- for (int x = 0; x < dw; x++) {
- const unsigned int *sptr = ypoints[y] + xpoints[x];
- __m128i vx = qt_qimageScaleAARGBA_helper(sptr, yap, Cy, sow, vyap, vCy);
-
- int xap = xapoints[x];
- if (xap > 0) {
- const __m128i vxap = _mm_set1_epi32(xap);
- const __m128i vinvxap = _mm_sub_epi32(v256, vxap);
- __m128i vr = qt_qimageScaleAARGBA_helper(sptr + 1, yap, Cy, sow, vyap, vCy);
-
- vx = _mm_mullo_epi32(vx, vinvxap);
- vr = _mm_mullo_epi32(vr, vxap);
- vx = _mm_add_epi32(vx, vr);
- vx = _mm_srli_epi32(vx, 8);
+ auto scaleSection = [&] (int yStart, int yEnd) {
+ for (int y = yStart; y < yEnd; ++y) {
+ const int Cy = yapoints[y] >> 16;
+ const int yap = yapoints[y] & 0xffff;
+ const __m128i vCy = _mm_set1_epi32(Cy);
+ const __m128i vyap = _mm_set1_epi32(yap);
+
+ unsigned int *dptr = dest + (y * dow);
+ for (int x = 0; x < dw; x++) {
+ const unsigned int *sptr = ypoints[y] + xpoints[x];
+ __m128i vx = qt_qimageScaleAARGBA_helper(sptr, yap, Cy, sow, vyap, vCy);
+
+ const int xap = xapoints[x];
+ if (xap > 0) {
+ const __m128i vxap = _mm_set1_epi32(xap);
+ const __m128i vinvxap = _mm_sub_epi32(v256, vxap);
+ __m128i vr = qt_qimageScaleAARGBA_helper(sptr + 1, yap, Cy, sow, vyap, vCy);
+
+ vx = _mm_mullo_epi32(vx, vinvxap);
+ vr = _mm_mullo_epi32(vr, vxap);
+ vx = _mm_add_epi32(vx, vr);
+ vx = _mm_srli_epi32(vx, 8);
+ }
+ vx = _mm_srli_epi32(vx, 14);
+ vx = _mm_packus_epi32(vx, vx);
+ vx = _mm_packus_epi16(vx, vx);
+ *dptr = _mm_cvtsi128_si32(vx);
+ if (RGB)
+ *dptr |= 0xff000000;
+ dptr++;
}
- vx = _mm_srli_epi32(vx, 14);
- vx = _mm_packus_epi32(vx, _mm_setzero_si128());
- vx = _mm_packus_epi16(vx, _mm_setzero_si128());
- *dptr = _mm_cvtsi128_si32(vx);
- if (RGB)
- *dptr |= 0xff000000;
- dptr++;
}
- }
+ };
+ multithread_pixels_function(isi, dh, scaleSection);
}
template<bool RGB>
@@ -122,37 +120,40 @@ void qt_qimageScaleAARGBA_down_x_up_y_sse4(QImageScaleInfo *isi, unsigned int *d
const __m128i v256 = _mm_set1_epi32(256);
/* go through every scanline in the output buffer */
- for (int y = 0; y < dh; y++) {
- unsigned int *dptr = dest + (y * dow);
- for (int x = 0; x < dw; x++) {
- int Cx = xapoints[x] >> 16;
- int xap = xapoints[x] & 0xffff;
- const __m128i vCx = _mm_set1_epi32(Cx);
- const __m128i vxap = _mm_set1_epi32(xap);
-
- const unsigned int *sptr = ypoints[y] + xpoints[x];
- __m128i vx = qt_qimageScaleAARGBA_helper(sptr, xap, Cx, 1, vxap, vCx);
-
- int yap = yapoints[y];
- if (yap > 0) {
- const __m128i vyap = _mm_set1_epi32(yap);
- const __m128i vinvyap = _mm_sub_epi32(v256, vyap);
- __m128i vr = qt_qimageScaleAARGBA_helper(sptr + sow, xap, Cx, 1, vxap, vCx);
-
- vx = _mm_mullo_epi32(vx, vinvyap);
- vr = _mm_mullo_epi32(vr, vyap);
- vx = _mm_add_epi32(vx, vr);
- vx = _mm_srli_epi32(vx, 8);
+ auto scaleSection = [&] (int yStart, int yEnd) {
+ for (int y = yStart; y < yEnd; ++y) {
+ unsigned int *dptr = dest + (y * dow);
+ for (int x = 0; x < dw; x++) {
+ int Cx = xapoints[x] >> 16;
+ int xap = xapoints[x] & 0xffff;
+ const __m128i vCx = _mm_set1_epi32(Cx);
+ const __m128i vxap = _mm_set1_epi32(xap);
+
+ const unsigned int *sptr = ypoints[y] + xpoints[x];
+ __m128i vx = qt_qimageScaleAARGBA_helper(sptr, xap, Cx, 1, vxap, vCx);
+
+ int yap = yapoints[y];
+ if (yap > 0) {
+ const __m128i vyap = _mm_set1_epi32(yap);
+ const __m128i vinvyap = _mm_sub_epi32(v256, vyap);
+ __m128i vr = qt_qimageScaleAARGBA_helper(sptr + sow, xap, Cx, 1, vxap, vCx);
+
+ vx = _mm_mullo_epi32(vx, vinvyap);
+ vr = _mm_mullo_epi32(vr, vyap);
+ vx = _mm_add_epi32(vx, vr);
+ vx = _mm_srli_epi32(vx, 8);
+ }
+ vx = _mm_srli_epi32(vx, 14);
+ vx = _mm_packus_epi32(vx, vx);
+ vx = _mm_packus_epi16(vx, vx);
+ *dptr = _mm_cvtsi128_si32(vx);
+ if (RGB)
+ *dptr |= 0xff000000;
+ dptr++;
}
- vx = _mm_srli_epi32(vx, 14);
- vx = _mm_packus_epi32(vx, _mm_setzero_si128());
- vx = _mm_packus_epi16(vx, _mm_setzero_si128());
- *dptr = _mm_cvtsi128_si32(vx);
- if (RGB)
- *dptr |= 0xff000000;
- dptr++;
}
- }
+ };
+ multithread_pixels_function(isi, dh, scaleSection);
}
template<bool RGB>
@@ -164,42 +165,45 @@ void qt_qimageScaleAARGBA_down_xy_sse4(QImageScaleInfo *isi, unsigned int *dest,
int *xapoints = isi->xapoints;
int *yapoints = isi->yapoints;
- for (int y = 0; y < dh; y++) {
- int Cy = yapoints[y] >> 16;
- int yap = yapoints[y] & 0xffff;
- const __m128i vCy = _mm_set1_epi32(Cy);
- const __m128i vyap = _mm_set1_epi32(yap);
-
- unsigned int *dptr = dest + (y * dow);
- for (int x = 0; x < dw; x++) {
- const int Cx = xapoints[x] >> 16;
- const int xap = xapoints[x] & 0xffff;
- const __m128i vCx = _mm_set1_epi32(Cx);
- const __m128i vxap = _mm_set1_epi32(xap);
-
- const unsigned int *sptr = ypoints[y] + xpoints[x];
- __m128i vx = qt_qimageScaleAARGBA_helper(sptr, xap, Cx, 1, vxap, vCx);
- __m128i vr = _mm_mullo_epi32(_mm_srli_epi32(vx, 4), vyap);
-
- int j;
- for (j = (1 << 14) - yap; j > Cy; j -= Cy) {
+ auto scaleSection = [&] (int yStart, int yEnd) {
+ for (int y = yStart; y < yEnd; ++y) {
+ int Cy = yapoints[y] >> 16;
+ int yap = yapoints[y] & 0xffff;
+ const __m128i vCy = _mm_set1_epi32(Cy);
+ const __m128i vyap = _mm_set1_epi32(yap);
+
+ unsigned int *dptr = dest + (y * dow);
+ for (int x = 0; x < dw; x++) {
+ const int Cx = xapoints[x] >> 16;
+ const int xap = xapoints[x] & 0xffff;
+ const __m128i vCx = _mm_set1_epi32(Cx);
+ const __m128i vxap = _mm_set1_epi32(xap);
+
+ const unsigned int *sptr = ypoints[y] + xpoints[x];
+ __m128i vx = qt_qimageScaleAARGBA_helper(sptr, xap, Cx, 1, vxap, vCx);
+ __m128i vr = _mm_mullo_epi32(_mm_srli_epi32(vx, 4), vyap);
+
+ int j;
+ for (j = (1 << 14) - yap; j > Cy; j -= Cy) {
+ sptr += sow;
+ vx = qt_qimageScaleAARGBA_helper(sptr, xap, Cx, 1, vxap, vCx);
+ vr = _mm_add_epi32(vr, _mm_mullo_epi32(_mm_srli_epi32(vx, 4), vCy));
+ }
sptr += sow;
vx = qt_qimageScaleAARGBA_helper(sptr, xap, Cx, 1, vxap, vCx);
- vr = _mm_add_epi32(vr, _mm_mullo_epi32(_mm_srli_epi32(vx, 4), vCy));
+ vr = _mm_add_epi32(vr, _mm_mullo_epi32(_mm_srli_epi32(vx, 4), _mm_set1_epi32(j)));
+
+ vr = _mm_srli_epi32(vr, 24);
+ vr = _mm_packus_epi32(vr, _mm_setzero_si128());
+ vr = _mm_packus_epi16(vr, _mm_setzero_si128());
+ *dptr = _mm_cvtsi128_si32(vr);
+ if (RGB)
+ *dptr |= 0xff000000;
+ dptr++;
}
- sptr += sow;
- vx = qt_qimageScaleAARGBA_helper(sptr, xap, Cx, 1, vxap, vCx);
- vr = _mm_add_epi32(vr, _mm_mullo_epi32(_mm_srli_epi32(vx, 4), _mm_set1_epi32(j)));
-
- vr = _mm_srli_epi32(vr, 24);
- vr = _mm_packus_epi32(vr, _mm_setzero_si128());
- vr = _mm_packus_epi16(vr, _mm_setzero_si128());
- *dptr = _mm_cvtsi128_si32(vr);
- if (RGB)
- *dptr |= 0xff000000;
- dptr++;
}
- }
+ };
+ multithread_pixels_function(isi, dh, scaleSection);
}
template void qt_qimageScaleAARGBA_up_x_down_y_sse4<false>(QImageScaleInfo *isi, unsigned int *dest,
diff --git a/src/gui/painting/qmath_p.h b/src/gui/painting/qmath_p.h
index 7cc3612113..d4e5be8339 100644
--- a/src/gui/painting/qmath_p.h
+++ b/src/gui/painting/qmath_p.h
@@ -1,41 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the QtGui module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#ifndef QMATH_P_H
#define QMATH_P_H
@@ -52,12 +16,28 @@
//
#include <qmath.h>
+#include <private/qglobal_p.h>
+#include <qtransform.h>
QT_BEGIN_NAMESPACE
static const qreal Q_PI = qreal(M_PI); // pi
static const qreal Q_MM_PER_INCH = 25.4;
+inline QRect qt_mapFillRect(const QRectF &rect, const QTransform &xf)
+{
+ // Only for xf <= scaling or 90 degree rotations
+ Q_ASSERT(xf.type() <= QTransform::TxScale
+ || (xf.type() == QTransform::TxRotate && qFuzzyIsNull(xf.m11()) && qFuzzyIsNull(xf.m22())));
+ // Transform the corners instead of the rect to avoid hitting numerical accuracy limit
+ // when transforming topleft and size separately and adding afterwards,
+ // as that can sometimes be slightly off around the .5 point, leading to wrong rounding
+ QPoint pt1 = xf.map(rect.topLeft()).toPoint();
+ QPoint pt2 = xf.map(rect.bottomRight()).toPoint();
+ // Normalize and adjust for the QRect vs. QRectF bottomright
+ return QRect::span(pt1, pt2).adjusted(0, 0, -1, -1);
+}
+
QT_END_NAMESPACE
#endif // QMATH_P_H
diff --git a/src/gui/painting/qmatrix.cpp b/src/gui/painting/qmatrix.cpp
deleted file mode 100644
index b1f01332b6..0000000000
--- a/src/gui/painting/qmatrix.cpp
+++ /dev/null
@@ -1,1190 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the QtGui module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "qmatrix.h"
-
-#include "qdatastream.h"
-#include "qdebug.h"
-#include "qhashfunctions.h"
-#include "qregion.h"
-#include "qpainterpath.h"
-#include "qpainterpath_p.h"
-#include "qvariant.h"
-#include <qmath.h>
-
-#include <limits.h>
-
-QT_BEGIN_NAMESPACE
-
-/*!
- \class QMatrix
- \brief The QMatrix class specifies 2D transformations of a
- coordinate system.
- \obsolete
-
- \ingroup painting
- \inmodule QtGui
-
- A matrix specifies how to translate, scale, shear or rotate the
- coordinate system, and is typically used when rendering graphics.
- QMatrix, in contrast to QTransform, does not allow perspective
- transformations. QTransform is the recommended transformation
- class in Qt.
-
- A QMatrix object can be built using the setMatrix(), scale(),
- rotate(), translate() and shear() functions. Alternatively, it
- can be built by applying \l {QMatrix#Basic Matrix
- Operations}{basic matrix operations}. The matrix can also be
- defined when constructed, and it can be reset to the identity
- matrix (the default) using the reset() function.
-
- The QMatrix class supports mapping of graphic primitives: A given
- point, line, polygon, region, or painter path can be mapped to the
- coordinate system defined by \e this matrix using the map()
- function. In case of a rectangle, its coordinates can be
- transformed using the mapRect() function. A rectangle can also be
- transformed into a \e polygon (mapped to the coordinate system
- defined by \e this matrix), using the mapToPolygon() function.
-
- QMatrix provides the isIdentity() function which returns \c true if
- the matrix is the identity matrix, and the isInvertible() function
- which returns \c true if the matrix is non-singular (i.e. AB = BA =
- I). The inverted() function returns an inverted copy of \e this
- matrix if it is invertible (otherwise it returns the identity
- matrix). In addition, QMatrix provides the determinant() function
- returning the matrix's determinant.
-
- Finally, the QMatrix class supports matrix multiplication, and
- objects of the class can be streamed as well as compared.
-
- \tableofcontents
-
- \section1 Rendering Graphics
-
- When rendering graphics, the matrix defines the transformations
- but the actual transformation is performed by the drawing routines
- in QPainter.
-
- By default, QPainter operates on the associated device's own
- coordinate system. The standard coordinate system of a
- QPaintDevice has its origin located at the top-left position. The
- \e x values increase to the right; \e y values increase
- downward. For a complete description, see the \l {Coordinate
- System}{coordinate system} documentation.
-
- QPainter has functions to translate, scale, shear and rotate the
- coordinate system without using a QMatrix. For example:
-
- \table 100%
- \row
- \li \inlineimage qmatrix-simpletransformation.png
- \li
- \snippet matrix/matrix.cpp 0
- \endtable
-
- Although these functions are very convenient, it can be more
- efficient to build a QMatrix and call QPainter::setMatrix() if you
- want to perform more than a single transform operation. For
- example:
-
- \table 100%
- \row
- \li \inlineimage qmatrix-combinedtransformation.png
- \li
- \snippet matrix/matrix.cpp 1
- \endtable
-
- \section1 Basic Matrix Operations
-
- \image qmatrix-representation.png
-
- A QMatrix object contains a 3 x 3 matrix. The \c dx and \c dy
- elements specify horizontal and vertical translation. The \c m11
- and \c m22 elements specify horizontal and vertical scaling. And
- finally, the \c m21 and \c m12 elements specify horizontal and
- vertical \e shearing.
-
- QMatrix transforms a point in the plane to another point using the
- following formulas:
-
- \snippet code/src_gui_painting_qmatrix.cpp 0
-
- The point \e (x, y) is the original point, and \e (x', y') is the
- transformed point. \e (x', y') can be transformed back to \e (x,
- y) by performing the same operation on the inverted() matrix.
-
- The various matrix elements can be set when constructing the
- matrix, or by using the setMatrix() function later on. They can also
- be manipulated using the translate(), rotate(), scale() and
- shear() convenience functions, The currently set values can be
- retrieved using the m11(), m12(), m21(), m22(), dx() and dy()
- functions.
-
- Translation is the simplest transformation. Setting \c dx and \c
- dy will move the coordinate system \c dx units along the X axis
- and \c dy units along the Y axis. Scaling can be done by setting
- \c m11 and \c m22. For example, setting \c m11 to 2 and \c m22 to
- 1.5 will double the height and increase the width by 50%. The
- identity matrix has \c m11 and \c m22 set to 1 (all others are set
- to 0) mapping a point to itself. Shearing is controlled by \c m12
- and \c m21. Setting these elements to values different from zero
- will twist the coordinate system. Rotation is achieved by
- carefully setting both the shearing factors and the scaling
- factors.
-
- Here's the combined transformations example using basic matrix
- operations:
-
- \table 100%
- \row
- \li \inlineimage qmatrix-combinedtransformation.png
- \li
- \snippet matrix/matrix.cpp 2
- \endtable
-
- \sa QPainter, QTransform, {Coordinate System},
- {painting/affine}{Affine Transformations Example}, {Transformations Example}
-*/
-
-
-// some defines to inline some code
-#define MAPDOUBLE(x, y, nx, ny) \
-{ \
- qreal fx = x; \
- qreal fy = y; \
- nx = _m11*fx + _m21*fy + _dx; \
- ny = _m12*fx + _m22*fy + _dy; \
-}
-
-#define MAPINT(x, y, nx, ny) \
-{ \
- qreal fx = x; \
- qreal fy = y; \
- nx = qRound(_m11*fx + _m21*fy + _dx); \
- ny = qRound(_m12*fx + _m22*fy + _dy); \
-}
-
-/*****************************************************************************
- QMatrix member functions
- *****************************************************************************/
-/*!
- \fn QMatrix::QMatrix(Qt::Initialization)
- \internal
-*/
-
-/*!
- Constructs an identity matrix.
-
- All elements are set to zero except \c m11 and \c m22 (specifying
- the scale), which are set to 1.
-
- \sa reset()
-*/
-
-QMatrix::QMatrix()
- : _m11(1.)
- , _m12(0.)
- , _m21(0.)
- , _m22(1.)
- , _dx(0.)
- , _dy(0.)
-{
-}
-
-/*!
- Constructs a matrix with the elements, \a m11, \a m12, \a m21, \a
- m22, \a dx and \a dy.
-
- \sa setMatrix()
-*/
-
-QMatrix::QMatrix(qreal m11, qreal m12, qreal m21, qreal m22, qreal dx, qreal dy)
- : _m11(m11)
- , _m12(m12)
- , _m21(m21)
- , _m22(m22)
- , _dx(dx)
- , _dy(dy)
-{
-}
-
-#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
-/*!
- Constructs a matrix that is a copy of the given \a matrix.
- */
-QMatrix::QMatrix(const QMatrix &matrix) noexcept
- : _m11(matrix._m11)
- , _m12(matrix._m12)
- , _m21(matrix._m21)
- , _m22(matrix._m22)
- , _dx(matrix._dx)
- , _dy(matrix._dy)
-{
-}
-#endif
-
-/*!
- Sets the matrix elements to the specified values, \a m11, \a m12,
- \a m21, \a m22, \a dx and \a dy.
-
- Note that this function replaces the previous values. QMatrix
- provide the translate(), rotate(), scale() and shear() convenience
- functions to manipulate the various matrix elements based on the
- currently defined coordinate system.
-
- \sa QMatrix()
-*/
-
-void QMatrix::setMatrix(qreal m11, qreal m12, qreal m21, qreal m22, qreal dx, qreal dy)
-{
- _m11 = m11;
- _m12 = m12;
- _m21 = m21;
- _m22 = m22;
- _dx = dx;
- _dy = dy;
-}
-
-
-/*!
- \fn qreal QMatrix::m11() const
-
- Returns the horizontal scaling factor.
-
- \sa scale(), {QMatrix#Basic Matrix Operations}{Basic Matrix
- Operations}
-*/
-
-/*!
- \fn qreal QMatrix::m12() const
-
- Returns the vertical shearing factor.
-
- \sa shear(), {QMatrix#Basic Matrix Operations}{Basic Matrix
- Operations}
-*/
-
-/*!
- \fn qreal QMatrix::m21() const
-
- Returns the horizontal shearing factor.
-
- \sa shear(), {QMatrix#Basic Matrix Operations}{Basic Matrix
- Operations}
-*/
-
-/*!
- \fn qreal QMatrix::m22() const
-
- Returns the vertical scaling factor.
-
- \sa scale(), {QMatrix#Basic Matrix Operations}{Basic Matrix
- Operations}
-*/
-
-/*!
- \fn qreal QMatrix::dx() const
-
- Returns the horizontal translation factor.
-
- \sa translate(), {QMatrix#Basic Matrix Operations}{Basic Matrix
- Operations}
-*/
-
-/*!
- \fn qreal QMatrix::dy() const
-
- Returns the vertical translation factor.
-
- \sa translate(), {QMatrix#Basic Matrix Operations}{Basic Matrix
- Operations}
-*/
-
-
-/*!
- Maps the given coordinates \a x and \a y into the coordinate
- system defined by this matrix. The resulting values are put in *\a
- tx and *\a ty, respectively.
-
- The coordinates are transformed using the following formulas:
-
- \snippet code/src_gui_painting_qmatrix.cpp 1
-
- The point (x, y) is the original point, and (x', y') is the
- transformed point.
-
- \sa {QMatrix#Basic Matrix Operations}{Basic Matrix Operations}
-*/
-
-void QMatrix::map(qreal x, qreal y, qreal *tx, qreal *ty) const
-{
- MAPDOUBLE(x, y, *tx, *ty);
-}
-
-
-
-/*!
- \overload
-
- Maps the given coordinates \a x and \a y into the coordinate
- system defined by this matrix. The resulting values are put in *\a
- tx and *\a ty, respectively. Note that the transformed coordinates
- are rounded to the nearest integer.
-*/
-
-void QMatrix::map(int x, int y, int *tx, int *ty) const
-{
- MAPINT(x, y, *tx, *ty);
-}
-
-QRect QMatrix::mapRect(const QRect &rect) const
-{
- QRect result;
- if (_m12 == 0.0F && _m21 == 0.0F) {
- int x = qRound(_m11*rect.x() + _dx);
- int y = qRound(_m22*rect.y() + _dy);
- int w = qRound(_m11*rect.width());
- int h = qRound(_m22*rect.height());
- if (w < 0) {
- w = -w;
- x -= w;
- }
- if (h < 0) {
- h = -h;
- y -= h;
- }
- result = QRect(x, y, w, h);
- } else {
- // see mapToPolygon for explanations of the algorithm.
- qreal x0, y0;
- qreal x, y;
- MAPDOUBLE(rect.left(), rect.top(), x0, y0);
- qreal xmin = x0;
- qreal ymin = y0;
- qreal xmax = x0;
- qreal ymax = y0;
- MAPDOUBLE(rect.right() + 1, rect.top(), x, y);
- xmin = qMin(xmin, x);
- ymin = qMin(ymin, y);
- xmax = qMax(xmax, x);
- ymax = qMax(ymax, y);
- MAPDOUBLE(rect.right() + 1, rect.bottom() + 1, x, y);
- xmin = qMin(xmin, x);
- ymin = qMin(ymin, y);
- xmax = qMax(xmax, x);
- ymax = qMax(ymax, y);
- MAPDOUBLE(rect.left(), rect.bottom() + 1, x, y);
- xmin = qMin(xmin, x);
- ymin = qMin(ymin, y);
- xmax = qMax(xmax, x);
- ymax = qMax(ymax, y);
- result = QRect(qRound(xmin), qRound(ymin), qRound(xmax)-qRound(xmin), qRound(ymax)-qRound(ymin));
- }
- return result;
-}
-
-/*!
- \fn QRectF QMatrix::mapRect(const QRectF &rectangle) const
-
- Creates and returns a QRectF object that is a copy of the given \a
- rectangle, mapped into the coordinate system defined by this
- matrix.
-
- The rectangle's coordinates are transformed using the following
- formulas:
-
- \snippet code/src_gui_painting_qmatrix.cpp 2
-
- If rotation or shearing has been specified, this function returns
- the \e bounding rectangle. To retrieve the exact region the given
- \a rectangle maps to, use the mapToPolygon() function instead.
-
- \sa mapToPolygon(), {QMatrix#Basic Matrix Operations}{Basic Matrix
- Operations}
-*/
-QRectF QMatrix::mapRect(const QRectF &rect) const
-{
- QRectF result;
- if (_m12 == 0.0F && _m21 == 0.0F) {
- qreal x = _m11*rect.x() + _dx;
- qreal y = _m22*rect.y() + _dy;
- qreal w = _m11*rect.width();
- qreal h = _m22*rect.height();
- if (w < 0) {
- w = -w;
- x -= w;
- }
- if (h < 0) {
- h = -h;
- y -= h;
- }
- result = QRectF(x, y, w, h);
- } else {
- qreal x0, y0;
- qreal x, y;
- MAPDOUBLE(rect.x(), rect.y(), x0, y0);
- qreal xmin = x0;
- qreal ymin = y0;
- qreal xmax = x0;
- qreal ymax = y0;
- MAPDOUBLE(rect.x() + rect.width(), rect.y(), x, y);
- xmin = qMin(xmin, x);
- ymin = qMin(ymin, y);
- xmax = qMax(xmax, x);
- ymax = qMax(ymax, y);
- MAPDOUBLE(rect.x() + rect.width(), rect.y() + rect.height(), x, y);
- xmin = qMin(xmin, x);
- ymin = qMin(ymin, y);
- xmax = qMax(xmax, x);
- ymax = qMax(ymax, y);
- MAPDOUBLE(rect.x(), rect.y() + rect.height(), x, y);
- xmin = qMin(xmin, x);
- ymin = qMin(ymin, y);
- xmax = qMax(xmax, x);
- ymax = qMax(ymax, y);
- result = QRectF(xmin, ymin, xmax-xmin, ymax - ymin);
- }
- return result;
-}
-
-/*!
- \fn QRect QMatrix::mapRect(const QRect &rectangle) const
- \overload
-
- Creates and returns a QRect object that is a copy of the given \a
- rectangle, mapped into the coordinate system defined by this
- matrix. Note that the transformed coordinates are rounded to the
- nearest integer.
-*/
-
-
-/*!
- \fn QPoint operator*(const QPoint &point, const QMatrix &matrix)
- \relates QMatrix
-
- This is the same as \a{matrix}.map(\a{point}).
-
- \sa QMatrix::map()
-*/
-
-QPoint QMatrix::map(const QPoint &p) const
-{
- qreal fx = p.x();
- qreal fy = p.y();
- return QPoint(qRound(_m11*fx + _m21*fy + _dx),
- qRound(_m12*fx + _m22*fy + _dy));
-}
-
-/*!
- \fn QPointF operator*(const QPointF &point, const QMatrix &matrix)
- \relates QMatrix
-
- Same as \a{matrix}.map(\a{point}).
-
- \sa QMatrix::map()
-*/
-
-/*!
- \overload
-
- Creates and returns a QPointF object that is a copy of the given
- \a point, mapped into the coordinate system defined by this
- matrix.
-*/
-QPointF QMatrix::map(const QPointF &point) const
-{
- qreal fx = point.x();
- qreal fy = point.y();
- return QPointF(_m11*fx + _m21*fy + _dx, _m12*fx + _m22*fy + _dy);
-}
-
-/*!
- \fn QPoint QMatrix::map(const QPoint &point) const
- \overload
-
- Creates and returns a QPoint object that is a copy of the given \a
- point, mapped into the coordinate system defined by this
- matrix. Note that the transformed coordinates are rounded to the
- nearest integer.
-*/
-
-/*!
- \fn QLineF operator*(const QLineF &line, const QMatrix &matrix)
- \relates QMatrix
-
- This is the same as \a{matrix}.map(\a{line}).
-
- \sa QMatrix::map()
-*/
-
-/*!
- \fn QLine operator*(const QLine &line, const QMatrix &matrix)
- \relates QMatrix
-
- This is the same as \a{matrix}.map(\a{line}).
-
- \sa QMatrix::map()
-*/
-
-/*!
- \overload
-
- Creates and returns a QLineF object that is a copy of the given \a
- line, mapped into the coordinate system defined by this matrix.
-*/
-QLineF QMatrix::map(const QLineF &line) const
-{
- return QLineF(map(line.p1()), map(line.p2()));
-}
-
-/*!
- \overload
-
- Creates and returns a QLine object that is a copy of the given \a
- line, mapped into the coordinate system defined by this matrix.
- Note that the transformed coordinates are rounded to the nearest
- integer.
-*/
-QLine QMatrix::map(const QLine &line) const
-{
- return QLine(map(line.p1()), map(line.p2()));
-}
-
-/*!
- \fn QPolygonF operator *(const QPolygonF &polygon, const QMatrix &matrix)
- \relates QMatrix
-
- This is the same as \a{matrix}.map(\a{polygon}).
-
- \sa QMatrix::map()
-*/
-
-/*!
- \fn QPolygon operator*(const QPolygon &polygon, const QMatrix &matrix)
- \relates QMatrix
-
- This is the same as \a{matrix}.map(\a{polygon}).
-
- \sa QMatrix::map()
-*/
-
-QPolygon QMatrix::map(const QPolygon &a) const
-{
- int size = a.size();
- int i;
- QPolygon p(size);
- const QPoint *da = a.constData();
- QPoint *dp = p.data();
- for(i = 0; i < size; i++) {
- MAPINT(da[i].x(), da[i].y(), dp[i].rx(), dp[i].ry());
- }
- return p;
-}
-
-/*!
- \fn QPolygonF QMatrix::map(const QPolygonF &polygon) const
- \overload
-
- Creates and returns a QPolygonF object that is a copy of the given
- \a polygon, mapped into the coordinate system defined by this
- matrix.
-*/
-QPolygonF QMatrix::map(const QPolygonF &a) const
-{
- int size = a.size();
- int i;
- QPolygonF p(size);
- const QPointF *da = a.constData();
- QPointF *dp = p.data();
- for(i = 0; i < size; i++) {
- MAPDOUBLE(da[i].xp, da[i].yp, dp[i].xp, dp[i].yp);
- }
- return p;
-}
-
-/*!
- \fn QPolygon QMatrix::map(const QPolygon &polygon) const
- \overload
-
- Creates and returns a QPolygon object that is a copy of the given
- \a polygon, mapped into the coordinate system defined by this
- matrix. Note that the transformed coordinates are rounded to the
- nearest integer.
-*/
-
-/*!
- \fn QRegion operator*(const QRegion &region, const QMatrix &matrix)
- \relates QMatrix
-
- This is the same as \a{matrix}.map(\a{region}).
-
- \sa QMatrix::map()
-*/
-
-extern QPainterPath qt_regionToPath(const QRegion &region);
-
-/*!
- \fn QRegion QMatrix::map(const QRegion &region) const
- \overload
-
- Creates and returns a QRegion object that is a copy of the given
- \a region, mapped into the coordinate system defined by this matrix.
-
- Calling this method can be rather expensive if rotations or
- shearing are used.
-*/
-QRegion QMatrix::map(const QRegion &r) const
-{
- if (_m11 == 1.0 && _m22 == 1.0 && _m12 == 0.0 && _m21 == 0.0) { // translate or identity
- if (_dx == 0.0 && _dy == 0.0) // Identity
- return r;
- QRegion copy(r);
- copy.translate(qRound(_dx), qRound(_dy));
- return copy;
- }
-
- QPainterPath p = map(qt_regionToPath(r));
- return p.toFillPolygon().toPolygon();
-}
-
-/*!
- \fn QPainterPath operator *(const QPainterPath &path, const QMatrix &matrix)
- \relates QMatrix
-
- This is the same as \a{matrix}.map(\a{path}).
-
- \sa QMatrix::map()
-*/
-
-/*!
- \overload
-
- Creates and returns a QPainterPath object that is a copy of the
- given \a path, mapped into the coordinate system defined by this
- matrix.
-*/
-QPainterPath QMatrix::map(const QPainterPath &path) const
-{
- if (path.isEmpty())
- return QPainterPath();
-
- QPainterPath copy = path;
-
- // Translate or identity
- if (_m11 == 1.0 && _m22 == 1.0 && _m12 == 0.0 && _m21 == 0.0) {
-
- // Translate
- if (_dx != 0.0 || _dy != 0.0) {
- copy.detach();
- for (int i=0; i<path.elementCount(); ++i) {
- QPainterPath::Element &e = copy.d_ptr->elements[i];
- e.x += _dx;
- e.y += _dy;
- }
- }
-
- // Full xform
- } else {
- copy.detach();
- for (int i=0; i<path.elementCount(); ++i) {
- QPainterPath::Element &e = copy.d_ptr->elements[i];
- qreal fx = e.x, fy = e.y;
- e.x = _m11*fx + _m21*fy + _dx;
- e.y = _m12*fx + _m22*fy + _dy;
- }
- }
-
- return copy;
-}
-
-/*!
- \fn QPolygon QMatrix::mapToPolygon(const QRect &rectangle) const
-
- Creates and returns a QPolygon representation of the given \a
- rectangle, mapped into the coordinate system defined by this
- matrix.
-
- The rectangle's coordinates are transformed using the following
- formulas:
-
- \snippet code/src_gui_painting_qmatrix.cpp 3
-
- Polygons and rectangles behave slightly differently when
- transformed (due to integer rounding), so
- \c{matrix.map(QPolygon(rectangle))} is not always the same as
- \c{matrix.mapToPolygon(rectangle)}.
-
- \sa mapRect(), {QMatrix#Basic Matrix Operations}{Basic Matrix
- Operations}
-*/
-QPolygon QMatrix::mapToPolygon(const QRect &rect) const
-{
- QPolygon a(4);
- qreal x[4], y[4];
- if (_m12 == 0.0F && _m21 == 0.0F) {
- x[0] = _m11*rect.x() + _dx;
- y[0] = _m22*rect.y() + _dy;
- qreal w = _m11*rect.width();
- qreal h = _m22*rect.height();
- if (w < 0) {
- w = -w;
- x[0] -= w;
- }
- if (h < 0) {
- h = -h;
- y[0] -= h;
- }
- x[1] = x[0]+w;
- x[2] = x[1];
- x[3] = x[0];
- y[1] = y[0];
- y[2] = y[0]+h;
- y[3] = y[2];
- } else {
- qreal right = rect.x() + rect.width();
- qreal bottom = rect.y() + rect.height();
- MAPDOUBLE(rect.x(), rect.y(), x[0], y[0]);
- MAPDOUBLE(right, rect.y(), x[1], y[1]);
- MAPDOUBLE(right, bottom, x[2], y[2]);
- MAPDOUBLE(rect.x(), bottom, x[3], y[3]);
- }
-#if 0
- int i;
- for(i = 0; i< 4; i++)
- qDebug("coords(%d) = (%f/%f) (%d/%d)", i, x[i], y[i], qRound(x[i]), qRound(y[i]));
- qDebug("width=%f, height=%f", qSqrt((x[1]-x[0])*(x[1]-x[0]) + (y[1]-y[0])*(y[1]-y[0])),
- qSqrt((x[0]-x[3])*(x[0]-x[3]) + (y[0]-y[3])*(y[0]-y[3])));
-#endif
- // all coordinates are correctly, tranform to a pointarray
- // (rounding to the next integer)
- a.setPoints(4, qRound(x[0]), qRound(y[0]),
- qRound(x[1]), qRound(y[1]),
- qRound(x[2]), qRound(y[2]),
- qRound(x[3]), qRound(y[3]));
- return a;
-}
-
-/*!
- Resets the matrix to an identity matrix, i.e. all elements are set
- to zero, except \c m11 and \c m22 (specifying the scale) which are
- set to 1.
-
- \sa QMatrix(), isIdentity(), {QMatrix#Basic Matrix
- Operations}{Basic Matrix Operations}
-*/
-
-void QMatrix::reset()
-{
- _m11 = _m22 = 1.0;
- _m12 = _m21 = _dx = _dy = 0.0;
-}
-
-/*!
- \fn bool QMatrix::isIdentity() const
-
- Returns \c true if the matrix is the identity matrix, otherwise
- returns \c false.
-
- \sa reset()
-*/
-
-/*!
- Moves the coordinate system \a dx along the x axis and \a dy along
- the y axis, and returns a reference to the matrix.
-
- \sa setMatrix()
-*/
-
-QMatrix &QMatrix::translate(qreal dx, qreal dy)
-{
- _dx += dx*_m11 + dy*_m21;
- _dy += dy*_m22 + dx*_m12;
- return *this;
-}
-
-/*!
- \fn QMatrix &QMatrix::scale(qreal sx, qreal sy)
-
- Scales the coordinate system by \a sx horizontally and \a sy
- vertically, and returns a reference to the matrix.
-
- \sa setMatrix()
-*/
-
-QMatrix &QMatrix::scale(qreal sx, qreal sy)
-{
- _m11 *= sx;
- _m12 *= sx;
- _m21 *= sy;
- _m22 *= sy;
- return *this;
-}
-
-/*!
- Shears the coordinate system by \a sh horizontally and \a sv
- vertically, and returns a reference to the matrix.
-
- \sa setMatrix()
-*/
-
-QMatrix &QMatrix::shear(qreal sh, qreal sv)
-{
- qreal tm11 = sv*_m21;
- qreal tm12 = sv*_m22;
- qreal tm21 = sh*_m11;
- qreal tm22 = sh*_m12;
- _m11 += tm11;
- _m12 += tm12;
- _m21 += tm21;
- _m22 += tm22;
- return *this;
-}
-
-const qreal deg2rad = qreal(0.017453292519943295769); // pi/180
-
-/*!
- \fn QMatrix &QMatrix::rotate(qreal degrees)
-
- Rotates the coordinate system the given \a degrees
- counterclockwise.
-
- Note that if you apply a QMatrix to a point defined in widget
- coordinates, the direction of the rotation will be clockwise
- because the y-axis points downwards.
-
- Returns a reference to the matrix.
-
- \sa setMatrix()
-*/
-
-QMatrix &QMatrix::rotate(qreal a)
-{
- qreal sina = 0;
- qreal cosa = 0;
- if (a == 90. || a == -270.)
- sina = 1.;
- else if (a == 270. || a == -90.)
- sina = -1.;
- else if (a == 180.)
- cosa = -1.;
- else{
- qreal b = deg2rad*a; // convert to radians
- sina = qSin(b); // fast and convenient
- cosa = qCos(b);
- }
- qreal tm11 = cosa*_m11 + sina*_m21;
- qreal tm12 = cosa*_m12 + sina*_m22;
- qreal tm21 = -sina*_m11 + cosa*_m21;
- qreal tm22 = -sina*_m12 + cosa*_m22;
- _m11 = tm11; _m12 = tm12;
- _m21 = tm21; _m22 = tm22;
- return *this;
-}
-
-/*!
- \fn bool QMatrix::isInvertible() const
-
- Returns \c true if the matrix is invertible, otherwise returns \c false.
-
- \sa inverted()
-*/
-
-/*!
- \since 4.6
- \fn qreal QMatrix::determinant() const
-
- Returns the matrix's determinant.
-*/
-
-/*!
- Returns an inverted copy of this matrix.
-
- If the matrix is singular (not invertible), the returned matrix is
- the identity matrix. If \a invertible is valid (i.e. not 0), its
- value is set to true if the matrix is invertible, otherwise it is
- set to false.
-
- \sa isInvertible()
-*/
-
-QMatrix QMatrix::inverted(bool *invertible) const
-{
- qreal dtr = determinant();
- if (dtr == 0.0) {
- if (invertible)
- *invertible = false; // singular matrix
- return QMatrix(true);
- }
- else { // invertible matrix
- if (invertible)
- *invertible = true;
- qreal dinv = 1.0/dtr;
- return QMatrix((_m22*dinv), (-_m12*dinv),
- (-_m21*dinv), (_m11*dinv),
- ((_m21*_dy - _m22*_dx)*dinv),
- ((_m12*_dx - _m11*_dy)*dinv),
- true);
- }
-}
-
-
-/*!
- \fn bool QMatrix::operator==(const QMatrix &matrix) const
-
- Returns \c true if this matrix is equal to the given \a matrix,
- otherwise returns \c false.
-*/
-
-bool QMatrix::operator==(const QMatrix &m) const
-{
- return _m11 == m._m11 &&
- _m12 == m._m12 &&
- _m21 == m._m21 &&
- _m22 == m._m22 &&
- _dx == m._dx &&
- _dy == m._dy;
-}
-
-
-/*!
- \since 5.6
- \relates QMatrix
-
- Returns the hash value for \a key, using
- \a seed to seed the calculation.
-*/
-uint qHash(const QMatrix &key, uint seed) noexcept
-{
- QtPrivate::QHashCombine hash;
- seed = hash(seed, key.m11());
- seed = hash(seed, key.m12());
- seed = hash(seed, key.m21());
- seed = hash(seed, key.m22());
- seed = hash(seed, key.dx());
- seed = hash(seed, key.dy());
- return seed;
-}
-
-/*!
- \fn bool QMatrix::operator!=(const QMatrix &matrix) const
-
- Returns \c true if this matrix is not equal to the given \a matrix,
- otherwise returns \c false.
-*/
-
-bool QMatrix::operator!=(const QMatrix &m) const
-{
- return _m11 != m._m11 ||
- _m12 != m._m12 ||
- _m21 != m._m21 ||
- _m22 != m._m22 ||
- _dx != m._dx ||
- _dy != m._dy;
-}
-
-/*!
- \fn QMatrix &QMatrix::operator *=(const QMatrix &matrix)
- \overload
-
- Returns the result of multiplying this matrix by the given \a
- matrix.
-*/
-
-QMatrix &QMatrix::operator *=(const QMatrix &m)
-{
- qreal tm11 = _m11*m._m11 + _m12*m._m21;
- qreal tm12 = _m11*m._m12 + _m12*m._m22;
- qreal tm21 = _m21*m._m11 + _m22*m._m21;
- qreal tm22 = _m21*m._m12 + _m22*m._m22;
-
- qreal tdx = _dx*m._m11 + _dy*m._m21 + m._dx;
- qreal tdy = _dx*m._m12 + _dy*m._m22 + m._dy;
-
- _m11 = tm11; _m12 = tm12;
- _m21 = tm21; _m22 = tm22;
- _dx = tdx; _dy = tdy;
- return *this;
-}
-
-/*!
- \fn QMatrix QMatrix::operator *(const QMatrix &matrix) const
-
- Returns the result of multiplying this matrix by the given \a
- matrix.
-
- Note that matrix multiplication is not commutative, i.e. a*b !=
- b*a.
-*/
-
-QMatrix QMatrix::operator *(const QMatrix &m) const
-{
- qreal tm11 = _m11*m._m11 + _m12*m._m21;
- qreal tm12 = _m11*m._m12 + _m12*m._m22;
- qreal tm21 = _m21*m._m11 + _m22*m._m21;
- qreal tm22 = _m21*m._m12 + _m22*m._m22;
-
- qreal tdx = _dx*m._m11 + _dy*m._m21 + m._dx;
- qreal tdy = _dx*m._m12 + _dy*m._m22 + m._dy;
- return QMatrix(tm11, tm12, tm21, tm22, tdx, tdy, true);
-}
-
-#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
-/*!
- Assigns the given \a matrix's values to this matrix.
-*/
-QMatrix &QMatrix::operator=(const QMatrix &matrix) noexcept
-{
- _m11 = matrix._m11;
- _m12 = matrix._m12;
- _m21 = matrix._m21;
- _m22 = matrix._m22;
- _dx = matrix._dx;
- _dy = matrix._dy;
- return *this;
-}
-#endif
-
-/*!
- \since 4.2
-
- Returns the matrix as a QVariant.
-*/
-QMatrix::operator QVariant() const
-{
- return QVariant(QVariant::Matrix, this);
-}
-
-Q_GUI_EXPORT QPainterPath operator *(const QPainterPath &p, const QMatrix &m)
-{
- return m.map(p);
-}
-
-
-/*****************************************************************************
- QMatrix stream functions
- *****************************************************************************/
-#ifndef QT_NO_DATASTREAM
-/*!
- \fn QDataStream &operator<<(QDataStream &stream, const QMatrix &matrix)
- \relates QMatrix
-
- Writes the given \a matrix to the given \a stream and returns a
- reference to the stream.
-
- \sa {Serializing Qt Data Types}
-*/
-
-QDataStream &operator<<(QDataStream &s, const QMatrix &m)
-{
- if (s.version() == 1) {
- s << (float)m.m11() << (float)m.m12() << (float)m.m21()
- << (float)m.m22() << (float)m.dx() << (float)m.dy();
- } else {
- s << double(m.m11())
- << double(m.m12())
- << double(m.m21())
- << double(m.m22())
- << double(m.dx())
- << double(m.dy());
- }
- return s;
-}
-
-/*!
- \fn QDataStream &operator>>(QDataStream &stream, QMatrix &matrix)
- \relates QMatrix
-
- Reads the given \a matrix from the given \a stream and returns a
- reference to the stream.
-
- \sa {Serializing Qt Data Types}
-*/
-
-QDataStream &operator>>(QDataStream &s, QMatrix &m)
-{
- if (s.version() == 1) {
- float m11, m12, m21, m22, dx, dy;
- s >> m11; s >> m12; s >> m21; s >> m22;
- s >> dx; s >> dy;
- m.setMatrix(m11, m12, m21, m22, dx, dy);
- }
- else {
- double m11, m12, m21, m22, dx, dy;
- s >> m11;
- s >> m12;
- s >> m21;
- s >> m22;
- s >> dx;
- s >> dy;
- m.setMatrix(m11, m12, m21, m22, dx, dy);
- }
- return s;
-}
-#endif // QT_NO_DATASTREAM
-
-#ifndef QT_NO_DEBUG_STREAM
-QDebug operator<<(QDebug dbg, const QMatrix &m)
-{
- QDebugStateSaver saver(dbg);
- dbg.nospace() << "QMatrix("
- << "11=" << m.m11()
- << " 12=" << m.m12()
- << " 21=" << m.m21()
- << " 22=" << m.m22()
- << " dx=" << m.dx()
- << " dy=" << m.dy()
- << ')';
- return dbg;
-}
-#endif
-
-/*!
- \fn bool qFuzzyCompare(const QMatrix& m1, const QMatrix& m2)
-
- \relates QMatrix
- \since 4.6
-
- \brief The qFuzzyCompare function is for comparing two matrices
- using a fuzziness factor.
-
- Returns \c true if \a m1 and \a m2 are equal, allowing for a small
- fuzziness factor for floating-point comparisons; false otherwise.
-*/
-
-QT_END_NAMESPACE
diff --git a/src/gui/painting/qmatrix.h b/src/gui/painting/qmatrix.h
deleted file mode 100644
index a167260ade..0000000000
--- a/src/gui/painting/qmatrix.h
+++ /dev/null
@@ -1,194 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the QtGui module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef QMATRIX_H
-#define QMATRIX_H
-
-#include <QtGui/qtguiglobal.h>
-#include <QtGui/qpolygon.h>
-#include <QtGui/qregion.h>
-#include <QtGui/qwindowdefs.h>
-#include <QtCore/qline.h>
-#include <QtCore/qpoint.h>
-#include <QtCore/qrect.h>
-
-QT_BEGIN_NAMESPACE
-
-
-class QPainterPath;
-class QVariant;
-
-class Q_GUI_EXPORT QMatrix // 2D transform matrix
-{
-public:
- inline explicit QMatrix(Qt::Initialization) {}
- QMatrix();
- QMatrix(qreal m11, qreal m12, qreal m21, qreal m22,
- qreal dx, qreal dy);
-
-#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
- // ### Qt 6: remove; the compiler-generated ones are fine!
- QMatrix &operator=(QMatrix &&other) noexcept // = default
- { memcpy(static_cast<void *>(this), static_cast<void *>(&other), sizeof(QMatrix)); return *this; }
- QMatrix &operator=(const QMatrix &) noexcept; // = default
- QMatrix(QMatrix &&other) noexcept // = default
- { memcpy(static_cast<void *>(this), static_cast<void *>(&other), sizeof(QMatrix)); }
- QMatrix(const QMatrix &other) noexcept; // = default
-#endif
-
- void setMatrix(qreal m11, qreal m12, qreal m21, qreal m22,
- qreal dx, qreal dy);
-
- qreal m11() const { return _m11; }
- qreal m12() const { return _m12; }
- qreal m21() const { return _m21; }
- qreal m22() const { return _m22; }
- qreal dx() const { return _dx; }
- qreal dy() const { return _dy; }
-
- void map(int x, int y, int *tx, int *ty) const;
- void map(qreal x, qreal y, qreal *tx, qreal *ty) const;
- QRect mapRect(const QRect &) const;
- QRectF mapRect(const QRectF &) const;
-
- QPoint map(const QPoint &p) const;
- QPointF map(const QPointF&p) const;
- QLine map(const QLine &l) const;
- QLineF map(const QLineF &l) const;
- QPolygonF map(const QPolygonF &a) const;
- QPolygon map(const QPolygon &a) const;
- QRegion map(const QRegion &r) const;
- QPainterPath map(const QPainterPath &p) const;
- QPolygon mapToPolygon(const QRect &r) const;
-
- void reset();
- inline bool isIdentity() const;
-
- QMatrix &translate(qreal dx, qreal dy);
- QMatrix &scale(qreal sx, qreal sy);
- QMatrix &shear(qreal sh, qreal sv);
- QMatrix &rotate(qreal a);
-
- bool isInvertible() const { return !qFuzzyIsNull(_m11*_m22 - _m12*_m21); }
- qreal determinant() const { return _m11*_m22 - _m12*_m21; }
-
- Q_REQUIRED_RESULT QMatrix inverted(bool *invertible = nullptr) const;
-
- bool operator==(const QMatrix &) const;
- bool operator!=(const QMatrix &) const;
-
- QMatrix &operator*=(const QMatrix &);
- QMatrix operator*(const QMatrix &o) const;
-
- operator QVariant() const;
-
-private:
- inline QMatrix(bool)
- : _m11(1.)
- , _m12(0.)
- , _m21(0.)
- , _m22(1.)
- , _dx(0.)
- , _dy(0.) {}
- inline QMatrix(qreal am11, qreal am12, qreal am21, qreal am22, qreal adx, qreal ady, bool)
- : _m11(am11)
- , _m12(am12)
- , _m21(am21)
- , _m22(am22)
- , _dx(adx)
- , _dy(ady) {}
- friend class QTransform;
- qreal _m11, _m12;
- qreal _m21, _m22;
- qreal _dx, _dy;
-};
-Q_DECLARE_TYPEINFO(QMatrix, Q_MOVABLE_TYPE);
-
-Q_GUI_EXPORT Q_DECL_CONST_FUNCTION uint qHash(const QMatrix &key, uint seed = 0) noexcept;
-
-// mathematical semantics
-inline QPoint operator*(const QPoint &p, const QMatrix &m)
-{ return m.map(p); }
-inline QPointF operator*(const QPointF &p, const QMatrix &m)
-{ return m.map(p); }
-inline QLineF operator*(const QLineF &l, const QMatrix &m)
-{ return m.map(l); }
-inline QLine operator*(const QLine &l, const QMatrix &m)
-{ return m.map(l); }
-inline QPolygon operator *(const QPolygon &a, const QMatrix &m)
-{ return m.map(a); }
-inline QPolygonF operator *(const QPolygonF &a, const QMatrix &m)
-{ return m.map(a); }
-inline QRegion operator *(const QRegion &r, const QMatrix &m)
-{ return m.map(r); }
-Q_GUI_EXPORT QPainterPath operator *(const QPainterPath &p, const QMatrix &m);
-
-inline bool QMatrix::isIdentity() const
-{
- return qFuzzyIsNull(_m11 - 1) && qFuzzyIsNull(_m22 - 1) && qFuzzyIsNull(_m12)
- && qFuzzyIsNull(_m21) && qFuzzyIsNull(_dx) && qFuzzyIsNull(_dy);
-}
-
-inline bool qFuzzyCompare(const QMatrix& m1, const QMatrix& m2)
-{
- return qFuzzyCompare(m1.m11(), m2.m11())
- && qFuzzyCompare(m1.m12(), m2.m12())
- && qFuzzyCompare(m1.m21(), m2.m21())
- && qFuzzyCompare(m1.m22(), m2.m22())
- && qFuzzyCompare(m1.dx(), m2.dx())
- && qFuzzyCompare(m1.dy(), m2.dy());
-}
-
-
-/*****************************************************************************
- QMatrix stream functions
- *****************************************************************************/
-
-#ifndef QT_NO_DATASTREAM
-Q_GUI_EXPORT QDataStream &operator<<(QDataStream &, const QMatrix &);
-Q_GUI_EXPORT QDataStream &operator>>(QDataStream &, QMatrix &);
-#endif
-
-#ifndef QT_NO_DEBUG_STREAM
-Q_GUI_EXPORT QDebug operator<<(QDebug, const QMatrix &);
-#endif
-
-QT_END_NAMESPACE
-
-#endif // QMATRIX_H
diff --git a/src/gui/painting/qmemrotate.cpp b/src/gui/painting/qmemrotate.cpp
index 685fbbb37a..9752069931 100644
--- a/src/gui/painting/qmemrotate.cpp
+++ b/src/gui/painting/qmemrotate.cpp
@@ -1,54 +1,18 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the QtGui module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "private/qmemrotate_p.h"
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
+
+#include "qmemrotate_p.h"
+#include "qpixellayout_p.h"
QT_BEGIN_NAMESPACE
static const int tileSize = 32;
-template <class T>
-static
-inline void qt_memrotate90_tiled(const T *src, int w, int h, int sstride, T *dest, int dstride)
+template<class T>
+static inline void qt_memrotate90_tiled(const T *src, int w, int h, int isstride, T *dest, int idstride)
{
- sstride /= sizeof(T);
- dstride /= sizeof(T);
+ const qsizetype sstride = isstride / sizeof(T);
+ const qsizetype dstride = idstride / sizeof(T);
const int pack = sizeof(quint32) / sizeof(T);
const int unaligned =
@@ -102,11 +66,11 @@ inline void qt_memrotate90_tiled(const T *src, int w, int h, int sstride, T *des
}
}
-template <class T>
-static
-inline void qt_memrotate90_tiled_unpacked(const T *src, int w, int h, int sstride, T *dest,
- int dstride)
+template<class T>
+static inline void qt_memrotate90_tiled_unpacked(const T *src, int w, int h, int isstride, T *dest, int idstride)
{
+ const qsizetype sstride = isstride;
+ const qsizetype dstride = idstride;
const int numTilesX = (w + tileSize - 1) / tileSize;
const int numTilesY = (h + tileSize - 1) / tileSize;
@@ -130,12 +94,11 @@ inline void qt_memrotate90_tiled_unpacked(const T *src, int w, int h, int sstrid
}
}
-template <class T>
-static
-inline void qt_memrotate270_tiled(const T *src, int w, int h, int sstride, T *dest, int dstride)
+template<class T>
+static inline void qt_memrotate270_tiled(const T *src, int w, int h, int isstride, T *dest, int idstride)
{
- sstride /= sizeof(T);
- dstride /= sizeof(T);
+ const qsizetype sstride = isstride / sizeof(T);
+ const qsizetype dstride = idstride / sizeof(T);
const int pack = sizeof(quint32) / sizeof(T);
const int unaligned =
@@ -189,11 +152,11 @@ inline void qt_memrotate270_tiled(const T *src, int w, int h, int sstride, T *de
}
}
-template <class T>
-static
-inline void qt_memrotate270_tiled_unpacked(const T *src, int w, int h, int sstride, T *dest,
- int dstride)
+template<class T>
+static inline void qt_memrotate270_tiled_unpacked(const T *src, int w, int h, int isstride, T *dest, int idstride)
{
+ const qsizetype sstride = isstride;
+ const qsizetype dstride = idstride;
const int numTilesX = (w + tileSize - 1) / tileSize;
const int numTilesY = (h + tileSize - 1) / tileSize;
@@ -225,30 +188,19 @@ inline void qt_memrotate90_template(const T *src, int srcWidth, int srcHeight, i
{
#if Q_BYTE_ORDER == Q_LITTLE_ENDIAN
// packed algorithm assumes little endian and that sizeof(quint32)/sizeof(T) is an integer
- if (sizeof(quint32) % sizeof(T) == 0)
- qt_memrotate90_tiled<T>(src, srcWidth, srcHeight, srcStride, dest, dstStride);
- else
-#endif
+ static_assert(sizeof(quint32) % sizeof(T) == 0);
+ qt_memrotate90_tiled<T>(src, srcWidth, srcHeight, srcStride, dest, dstStride);
+#else
qt_memrotate90_tiled_unpacked<T>(src, srcWidth, srcHeight, srcStride, dest, dstStride);
+#endif
}
-template <>
-inline void qt_memrotate90_template<quint32>(const quint32 *src, int w, int h, int sstride, quint32 *dest, int dstride)
+template<class T>
+static inline void qt_memrotate180_template(const T *src, int w, int h, int isstride, T *dest, int idstride)
{
- // packed algorithm doesn't have any benefit for quint32
- qt_memrotate90_tiled_unpacked(src, w, h, sstride, dest, dstride);
-}
+ const qsizetype sstride = isstride;
+ const qsizetype dstride = idstride;
-template <>
-inline void qt_memrotate90_template<quint64>(const quint64 *src, int w, int h, int sstride, quint64 *dest, int dstride)
-{
- qt_memrotate90_tiled_unpacked(src, w, h, sstride, dest, dstride);
-}
-
-template <class T>
-static
-inline void qt_memrotate180_template(const T *src, int w, int h, int sstride, T *dest, int dstride)
-{
const char *s = (const char*)(src) + (h - 1) * sstride;
for (int dy = 0; dy < h; ++dy) {
T *d = reinterpret_cast<T*>((char *)(dest) + dy * dstride);
@@ -267,24 +219,11 @@ inline void qt_memrotate270_template(const T *src, int srcWidth, int srcHeight,
{
#if Q_BYTE_ORDER == Q_LITTLE_ENDIAN
// packed algorithm assumes little endian and that sizeof(quint32)/sizeof(T) is an integer
- if (sizeof(quint32) % sizeof(T) == 0)
- qt_memrotate270_tiled<T>(src, srcWidth, srcHeight, srcStride, dest, dstStride);
- else
-#endif
+ static_assert(sizeof(quint32) % sizeof(T) == 0);
+ qt_memrotate270_tiled<T>(src, srcWidth, srcHeight, srcStride, dest, dstStride);
+#else
qt_memrotate270_tiled_unpacked<T>(src, srcWidth, srcHeight, srcStride, dest, dstStride);
-}
-
-template <>
-inline void qt_memrotate270_template<quint32>(const quint32 *src, int w, int h, int sstride, quint32 *dest, int dstride)
-{
- // packed algorithm doesn't have any benefit for quint32
- qt_memrotate270_tiled_unpacked(src, w, h, sstride, dest, dstride);
-}
-
-template <>
-inline void qt_memrotate270_template<quint64>(const quint64 *src, int w, int h, int sstride, quint64 *dest, int dstride)
-{
- qt_memrotate270_tiled_unpacked(src, w, h, sstride, dest, dstride);
+#endif
}
#define QT_IMPL_MEMROTATE(type) \
@@ -321,10 +260,11 @@ Q_GUI_EXPORT void qt_memrotate270(const type *src, int w, int h, int sstride, \
qt_memrotate270_tiled_unpacked(src, w, h, sstride, dest, dstride); \
}
-QT_IMPL_MEMROTATE(quint64)
-QT_IMPL_MEMROTATE(quint32)
+QT_IMPL_SIMPLE_MEMROTATE(QRgbaFloat32)
+QT_IMPL_SIMPLE_MEMROTATE(quint64)
+QT_IMPL_SIMPLE_MEMROTATE(quint32)
+QT_IMPL_SIMPLE_MEMROTATE(quint24)
QT_IMPL_MEMROTATE(quint16)
-QT_IMPL_MEMROTATE(quint24)
QT_IMPL_MEMROTATE(quint8)
void qt_memrotate90_8(const uchar *srcPixels, int w, int h, int sbpl, uchar *destPixels, int dbpl)
@@ -403,6 +343,21 @@ void qt_memrotate270_64(const uchar *srcPixels, int w, int h, int sbpl, uchar *d
qt_memrotate270((const quint64 *)srcPixels, w, h, sbpl, (quint64 *)destPixels, dbpl);
}
+void qt_memrotate90_128(const uchar *srcPixels, int w, int h, int sbpl, uchar *destPixels, int dbpl)
+{
+ qt_memrotate90((const QRgbaFloat32 *)srcPixels, w, h, sbpl, (QRgbaFloat32 *)destPixels, dbpl);
+}
+
+void qt_memrotate180_128(const uchar *srcPixels, int w, int h, int sbpl, uchar *destPixels, int dbpl)
+{
+ qt_memrotate180((const QRgbaFloat32 *)srcPixels, w, h, sbpl, (QRgbaFloat32 *)destPixels, dbpl);
+}
+
+void qt_memrotate270_128(const uchar *srcPixels, int w, int h, int sbpl, uchar *destPixels, int dbpl)
+{
+ qt_memrotate270((const QRgbaFloat32 *)srcPixels, w, h, sbpl, (QRgbaFloat32 *)destPixels, dbpl);
+}
+
MemRotateFunc qMemRotateFunctions[QPixelLayout::BPPCount][3] =
// 90, 180, 270
{
@@ -414,6 +369,8 @@ MemRotateFunc qMemRotateFunctions[QPixelLayout::BPPCount][3] =
{ qt_memrotate90_24, qt_memrotate180_24, qt_memrotate270_24 }, // BPP24
{ qt_memrotate90_32, qt_memrotate180_32, qt_memrotate270_32 }, // BPP32
{ qt_memrotate90_64, qt_memrotate180_64, qt_memrotate270_64 }, // BPP64
+ { qt_memrotate90_64, qt_memrotate180_64, qt_memrotate270_64 }, // BPP16FPx4
+ { qt_memrotate90_128, qt_memrotate180_128, qt_memrotate270_128 }, // BPP32FPx4
};
QT_END_NAMESPACE
diff --git a/src/gui/painting/qmemrotate_p.h b/src/gui/painting/qmemrotate_p.h
index 677fd57af9..70711223d1 100644
--- a/src/gui/painting/qmemrotate_p.h
+++ b/src/gui/painting/qmemrotate_p.h
@@ -1,41 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the QtGui module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#ifndef QMEMROTATE_P_H
#define QMEMROTATE_P_H
@@ -52,7 +16,7 @@
//
#include <QtGui/private/qtguiglobal_p.h>
-#include "private/qdrawhelper_p.h"
+#include <QtGui/private/qdrawhelper_p.h>
QT_BEGIN_NAMESPACE
diff --git a/src/gui/painting/qoutlinemapper.cpp b/src/gui/painting/qoutlinemapper.cpp
index 67e450986d..2f87ff43b7 100644
--- a/src/gui/painting/qoutlinemapper.cpp
+++ b/src/gui/painting/qoutlinemapper.cpp
@@ -1,41 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the QtGui module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#include "qoutlinemapper_p.h"
@@ -73,11 +37,31 @@ static const QRectF boundingRect(const QPointF *points, int pointCount)
return QRectF(QPointF(minx, miny), QPointF(maxx, maxy));
}
+void QOutlineMapper::setClipRect(QRect clipRect)
+{
+ auto limitCoords = [](QRect r) {
+ const QRect limitRect(QPoint(-QT_RASTER_COORD_LIMIT, -QT_RASTER_COORD_LIMIT),
+ QPoint(QT_RASTER_COORD_LIMIT, QT_RASTER_COORD_LIMIT));
+ r &= limitRect;
+ r.setWidth(qMin(r.width(), QT_RASTER_COORD_LIMIT));
+ r.setHeight(qMin(r.height(), QT_RASTER_COORD_LIMIT));
+ return r;
+ };
+
+ if (clipRect != m_clip_rect) {
+ m_clip_rect = limitCoords(clipRect);
+ const int mw = 1 << 10; // margin width. No need to trigger clipping for slight overshooting
+ m_clip_trigger_rect = QRectF(limitCoords(m_clip_rect.adjusted(-mw, -mw, mw, mw)));
+ }
+}
+
void QOutlineMapper::curveTo(const QPointF &cp1, const QPointF &cp2, const QPointF &ep) {
#ifdef QT_DEBUG_CONVERT
printf("QOutlineMapper::curveTo() (%f, %f)\n", ep.x(), ep.y());
#endif
+ if (!m_elements.size())
+ return;
QBezier bezier = QBezier::fromPoints(m_elements.last(), cp1, cp2, ep);
bool outsideClip = false;
@@ -234,16 +218,8 @@ void QOutlineMapper::endOutline()
m_clip_rect.x(), m_clip_rect.y(), m_clip_rect.width(), m_clip_rect.height());
#endif
-
- // Check for out of dev bounds...
- const bool do_clip = !m_in_clip_elements && ((controlPointRect.left() < -QT_RASTER_COORD_LIMIT
- || controlPointRect.right() > QT_RASTER_COORD_LIMIT
- || controlPointRect.top() < -QT_RASTER_COORD_LIMIT
- || controlPointRect.bottom() > QT_RASTER_COORD_LIMIT
- || controlPointRect.width() > QT_RASTER_COORD_LIMIT
- || controlPointRect.height() > QT_RASTER_COORD_LIMIT));
-
- if (do_clip) {
+ // Avoid rasterizing outside cliprect: faster, and ensures coords < QT_RASTER_COORD_LIMIT
+ if (!m_in_clip_elements && !m_clip_trigger_rect.contains(controlPointRect)) {
clipElements(elements, elementTypes(), m_elements.size());
} else {
convertElements(elements, elementTypes(), m_elements.size());
@@ -352,7 +328,7 @@ void QOutlineMapper::clipElements(const QPointF *elements,
int element_count)
{
// We could save a bit of time by actually implementing them fully
- // instead of going through convenience functionallity, but since
+ // instead of going through convenience functionality, but since
// this part of code hardly every used, it shouldn't matter.
QScopedValueRollback<bool> in_clip_elements(m_in_clip_elements, true);
diff --git a/src/gui/painting/qoutlinemapper_p.h b/src/gui/painting/qoutlinemapper_p.h
index 04a68797c2..ff2fff6bac 100644
--- a/src/gui/painting/qoutlinemapper_p.h
+++ b/src/gui/painting/qoutlinemapper_p.h
@@ -1,41 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the QtGui module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#ifndef QOUTLINEMAPPER_P_H
#define QOUTLINEMAPPER_P_H
@@ -66,10 +30,13 @@
QT_BEGIN_NAMESPACE
-// This limitations comes from qgrayraster.c. Any higher and
-// rasterization of shapes will produce incorrect results.
-const int QT_RASTER_COORD_LIMIT = 32767;
-
+// These limitations comes from qrasterizer.cpp, qcosmeticstroker.cpp, and qgrayraster.c.
+// Any higher and rasterization of shapes will produce incorrect results.
+#if Q_PROCESSOR_WORDSIZE == 8
+constexpr int QT_RASTER_COORD_LIMIT = ((1<<23) - 1); // F24dot8 in qgrayraster.c
+#else
+constexpr int QT_RASTER_COORD_LIMIT = ((1<<15) - 1); // F16dot16 in qrasterizer.cpp and qcosmeticstroker.cpp
+#endif
//#define QT_DEBUG_CONVERT
Q_GUI_EXPORT bool qt_scaleForTransform(const QTransform &transform, qreal *scale);
@@ -78,7 +45,7 @@ Q_GUI_EXPORT bool qt_scaleForTransform(const QTransform &transform, qreal *scale
* class QOutlineMapper
*
* Used to map between QPainterPath and the QT_FT_Outline structure used by the
- * freetype scanconvertor.
+ * freetype scanconverter.
*
* The outline mapper uses a path iterator to get points from the path,
* so that it is possible to transform the points as they are converted. The
@@ -112,6 +79,8 @@ public:
m_curve_threshold = scale == 0 ? qreal(0.25) : (qreal(0.25) / scale);
}
+ void setClipRect(QRect clipRect);
+
void beginOutline(Qt::FillRule fillRule)
{
#ifdef QT_DEBUG_CONVERT
@@ -196,6 +165,7 @@ public:
QDataBuffer<int> m_contours;
QRect m_clip_rect;
+ QRectF m_clip_trigger_rect;
QRectF controlPointRect; // only valid after endOutline()
QT_FT_Outline m_outline;
diff --git a/src/gui/painting/qpagedpaintdevice.cpp b/src/gui/painting/qpagedpaintdevice.cpp
index 3fdd0206b7..4dc5f035e6 100644
--- a/src/gui/painting/qpagedpaintdevice.cpp
+++ b/src/gui/painting/qpagedpaintdevice.cpp
@@ -1,86 +1,13 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the QtGui module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2020 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#include "qpagedpaintdevice_p.h"
#include <qpagedpaintdevice.h>
QT_BEGIN_NAMESPACE
-// ### Qt 6: remove when the deprecated constructor is removed
-class QDummyPagedPaintDevicePrivate : public QPagedPaintDevicePrivate
-{
- bool setPageLayout(const QPageLayout &newPageLayout) override
- {
- m_pageLayout = newPageLayout;
- return m_pageLayout.isEquivalentTo(newPageLayout);
- }
-
- bool setPageSize(const QPageSize &pageSize) override
- {
- m_pageLayout.setPageSize(pageSize);
- return m_pageLayout.pageSize().isEquivalentTo(pageSize);
- }
-
- bool setPageOrientation(QPageLayout::Orientation orientation) override
- {
- m_pageLayout.setOrientation(orientation);
- return m_pageLayout.orientation() == orientation;
- }
-
- bool setPageMargins(const QMarginsF &margins, QPageLayout::Unit units) override
- {
- m_pageLayout.setUnits(units);
- m_pageLayout.setMargins(margins);
- return m_pageLayout.margins() == margins && m_pageLayout.units() == units;
- }
-
- QPageLayout pageLayout() const override
- {
- return m_pageLayout;
- }
-
- QPageLayout m_pageLayout;
-};
-
-QPagedPaintDevicePrivate::~QPagedPaintDevicePrivate()
-{
-}
+
+QPagedPaintDevicePrivate::~QPagedPaintDevicePrivate() = default;
/*!
\class QPagedPaintDevice
@@ -95,15 +22,6 @@ QPagedPaintDevicePrivate::~QPagedPaintDevicePrivate()
QPdfWriter and QPrinter inherit from it.
*/
-/*!
- Constructs a new paged paint device.
-
- \deprecated
- */
-QPagedPaintDevice::QPagedPaintDevice()
- : d(new QDummyPagedPaintDevicePrivate)
-{
-}
/*!
\internal
@@ -132,150 +50,6 @@ QPagedPaintDevicePrivate *QPagedPaintDevice::dd()
}
/*!
- \enum QPagedPaintDevice::PageSize
-
- This enum type lists the available page sizes as defined in the Postscript
- PPD standard. These values are duplicated in QPageSize and QPrinter.
-
- The defined sizes are:
-
- \value A0 841 x 1189 mm
- \value A1 594 x 841 mm
- \value A2 420 x 594 mm
- \value A3 297 x 420 mm
- \value A4 210 x 297 mm, 8.26 x 11.69 inches
- \value A5 148 x 210 mm
- \value A6 105 x 148 mm
- \value A7 74 x 105 mm
- \value A8 52 x 74 mm
- \value A9 37 x 52 mm
- \value B0 1000 x 1414 mm
- \value B1 707 x 1000 mm
- \value B2 500 x 707 mm
- \value B3 353 x 500 mm
- \value B4 250 x 353 mm
- \value B5 176 x 250 mm, 6.93 x 9.84 inches
- \value B6 125 x 176 mm
- \value B7 88 x 125 mm
- \value B8 62 x 88 mm
- \value B9 33 x 62 mm
- \value B10 31 x 44 mm
- \value C5E 163 x 229 mm
- \value Comm10E 105 x 241 mm, U.S. Common 10 Envelope
- \value DLE 110 x 220 mm
- \value Executive 7.5 x 10 inches, 190.5 x 254 mm
- \value Folio 210 x 330 mm
- \value Ledger 431.8 x 279.4 mm
- \value Legal 8.5 x 14 inches, 215.9 x 355.6 mm
- \value Letter 8.5 x 11 inches, 215.9 x 279.4 mm
- \value Tabloid 279.4 x 431.8 mm
- \value Custom Unknown, or a user defined size.
- \value A10
- \value A3Extra
- \value A4Extra
- \value A4Plus
- \value A4Small
- \value A5Extra
- \value B5Extra
- \value JisB0
- \value JisB1
- \value JisB2
- \value JisB3
- \value JisB4
- \value JisB5
- \value JisB6,
- \value JisB7
- \value JisB8
- \value JisB9
- \value JisB10
- \value AnsiA = Letter
- \value AnsiB = Ledger
- \value AnsiC
- \value AnsiD
- \value AnsiE
- \value LegalExtra
- \value LetterExtra
- \value LetterPlus
- \value LetterSmall
- \value TabloidExtra
- \value ArchA
- \value ArchB
- \value ArchC
- \value ArchD
- \value ArchE
- \value Imperial7x9
- \value Imperial8x10
- \value Imperial9x11
- \value Imperial9x12
- \value Imperial10x11
- \value Imperial10x13
- \value Imperial10x14
- \value Imperial12x11
- \value Imperial15x11
- \value ExecutiveStandard
- \value Note
- \value Quarto
- \value Statement
- \value SuperA
- \value SuperB
- \value Postcard
- \value DoublePostcard
- \value Prc16K
- \value Prc32K
- \value Prc32KBig
- \value FanFoldUS
- \value FanFoldGerman
- \value FanFoldGermanLegal
- \value EnvelopeB4
- \value EnvelopeB5
- \value EnvelopeB6
- \value EnvelopeC0
- \value EnvelopeC1
- \value EnvelopeC2
- \value EnvelopeC3
- \value EnvelopeC4
- \value EnvelopeC5 = C5E
- \value EnvelopeC6
- \value EnvelopeC65
- \value EnvelopeC7
- \value EnvelopeDL = DLE
- \value Envelope9
- \value Envelope10 = Comm10E
- \value Envelope11
- \value Envelope12
- \value Envelope14
- \value EnvelopeMonarch
- \value EnvelopePersonal
- \value EnvelopeChou3
- \value EnvelopeChou4
- \value EnvelopeInvite
- \value EnvelopeItalian
- \value EnvelopeKaku2
- \value EnvelopeKaku3
- \value EnvelopePrc1
- \value EnvelopePrc2
- \value EnvelopePrc3
- \value EnvelopePrc4
- \value EnvelopePrc5
- \value EnvelopePrc6
- \value EnvelopePrc7
- \value EnvelopePrc8
- \value EnvelopePrc9
- \value EnvelopePrc10
- \value EnvelopeYou4
- \value LastPageSize = EnvelopeYou4
- \omitvalue NPageSize
- \omitvalue NPaperSize
-
- Due to historic reasons QPageSize::Executive is not the same as the standard
- Postscript and Windows Executive size, use QPageSize::ExecutiveStandard instead.
-
- The Postscript standard size QPageSize::Folio is different to the Windows
- DMPAPER_FOLIO size, use the Postscript standard size QPageSize::FanFoldGermanLegal
- if needed.
-*/
-
-/*!
\fn bool QPagedPaintDevice::newPage()
Starts a new page. Returns \c true on success.
@@ -296,76 +70,6 @@ QPagedPaintDevicePrivate *QPagedPaintDevice::dd()
*/
/*!
- Sets the size of the a page to \a size.
-
- \sa setPageSizeMM()
- */
-void QPagedPaintDevice::setPageSize(PageSize size)
-{
- d->setPageSize(QPageSize(QPageSize::PageSizeId(size)));
-}
-
-/*!
- Returns the currently used page size.
- */
-QPagedPaintDevice::PageSize QPagedPaintDevice::pageSize() const
-{
- return PageSize(d->pageLayout().pageSize().id());
-}
-
-/*!
- Sets the page size to \a size. \a size is specified in millimeters.
-
- If the size matches a standard QPagedPaintDevice::PageSize then that page
- size will be used, otherwise QPagedPaintDevice::Custom will be set.
-*/
-void QPagedPaintDevice::setPageSizeMM(const QSizeF &size)
-{
- d->setPageSize(QPageSize(size, QPageSize::Millimeter));
-}
-
-/*!
- Returns the page size in millimeters.
- */
-QSizeF QPagedPaintDevice::pageSizeMM() const
-{
- return d->pageLayout().pageSize().size(QPageSize::Millimeter);
-}
-
-/*!
- Sets the margins to be used to \a margins.
-
- Margins are specified in millimeters.
-
- The margins are purely a hint to the drawing method. They don't affect the
- coordinate system or clipping.
-
- \sa margins()
- */
-void QPagedPaintDevice::setMargins(const Margins &margins)
-{
- d->setPageMargins(QMarginsF(margins.left, margins.top, margins.right, margins.bottom), QPageLayout::Millimeter);
-}
-
-/*!
- Returns the current margins of the paint device. The default is 0.
-
- Margins are specified in millimeters.
-
- \sa setMargins()
- */
-QPagedPaintDevice::Margins QPagedPaintDevice::margins() const
-{
- QMarginsF margins = d->pageLayout().margins(QPageLayout::Millimeter);
- Margins result;
- result.left = margins.left();
- result.top = margins.top();
- result.right = margins.right();
- result.bottom = margins.bottom();
- return result;
-}
-
-/*!
\since 5.3
Sets the page layout to \a newPageLayout.
@@ -420,7 +124,7 @@ bool QPagedPaintDevice::setPageSize(const QPageSize &pageSize)
You should not call any painting methods between a call to setPageOrientation()
and newPage() as the wrong paint metrics may be used.
- To get the current QPageLayout::Orientation use pageLayout().pageOrientation().
+ To get the current QPageLayout::Orientation use pageLayout().orientation().
Returns true if the page orientation was successfully set to \a orientation.
@@ -435,28 +139,6 @@ bool QPagedPaintDevice::setPageOrientation(QPageLayout::Orientation orientation)
/*!
\since 5.3
- Set the page \a margins in the current page layout units.
-
- You should call this before calling QPainter::begin(), or immediately
- before calling newPage() to apply the new margins to a new page.
- You should not call any painting methods between a call to setPageMargins()
- and newPage() as the wrong paint metrics may be used.
-
- To get the current page margins use pageLayout().pageMargins().
-
- Returns true if the page margins were successfully set to \a margins.
-
- \sa pageLayout()
-*/
-
-bool QPagedPaintDevice::setPageMargins(const QMarginsF &margins)
-{
- return setPageMargins(margins, pageLayout().units());
-}
-
-/*!
- \since 5.3
-
Set the page \a margins defined in the given \a units.
You should call this before calling QPainter::begin(), or immediately
@@ -464,7 +146,7 @@ bool QPagedPaintDevice::setPageMargins(const QMarginsF &margins)
You should not call any painting methods between a call to setPageMargins()
and newPage() as the wrong paint metrics may be used.
- To get the current page margins use pageLayout().pageMargins().
+ To get the current page margins use pageLayout().margins().
Returns true if the page margins were successfully set to \a margins.
@@ -494,32 +176,25 @@ QPageLayout QPagedPaintDevice::pageLayout() const
}
/*!
- \internal
+ \since 6.0
- \deprecated
+ Returns the page ranges associated with this device.
- Returns the internal device page layout.
+ \sa QPageRanges, QPrinter::fromPage(), QPrinter::toPage()
*/
-
-QPageLayout QPagedPaintDevice::devicePageLayout() const
+QPageRanges QPagedPaintDevice::pageRanges() const
{
- qWarning("QPagedPaintDevice::devicePageLayout() is deprecated, just use QPagedPaintDevice::pageLayout()");
- return d->pageLayout();
+ return d->pageRanges;
}
/*!
- \internal
+ \since 6.0
- \deprecated
-
- Returns the internal device page layout.
+ Sets the page ranges for this device to \a ranges.
*/
-
-QPageLayout &QPagedPaintDevice::devicePageLayout()
+void QPagedPaintDevice::setPageRanges(const QPageRanges &ranges)
{
- qWarning("QPagedPaintDevice::devicePageLayout() is deprecated, you shouldn't be using this at all.");
- static QPageLayout dummy;
- return dummy;
+ d->pageRanges = ranges;
}
QT_END_NAMESPACE
diff --git a/src/gui/painting/qpagedpaintdevice.h b/src/gui/painting/qpagedpaintdevice.h
index 21e23e0eb4..ffe82f6555 100644
--- a/src/gui/painting/qpagedpaintdevice.h
+++ b/src/gui/painting/qpagedpaintdevice.h
@@ -1,41 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the QtGui module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2020 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#ifndef QPAGEDPAINTDEVICE_H
#define QPAGEDPAINTDEVICE_H
@@ -43,6 +7,7 @@
#include <QtGui/qtguiglobal.h>
#include <QtGui/qpaintdevice.h>
#include <QtGui/qpagelayout.h>
+#include <QtGui/qpageranges.h>
QT_BEGIN_NAMESPACE
@@ -55,197 +20,25 @@ class QPagedPaintDevicePrivate;
class Q_GUI_EXPORT QPagedPaintDevice : public QPaintDevice
{
public:
- QT_DEPRECATED QPagedPaintDevice();
~QPagedPaintDevice();
virtual bool newPage() = 0;
- // ### Qt6 Remove in favor of QPage::PageSize
- // NOTE: Must keep in sync with QPageSize and QPrinter
- enum PageSize {
- // Existing Qt sizes
- A4,
- B5,
- Letter,
- Legal,
- Executive,
- A0,
- A1,
- A2,
- A3,
- A5,
- A6,
- A7,
- A8,
- A9,
- B0,
- B1,
- B10,
- B2,
- B3,
- B4,
- B6,
- B7,
- B8,
- B9,
- C5E,
- Comm10E,
- DLE,
- Folio,
- Ledger,
- Tabloid,
- Custom,
-
- // New values derived from PPD standard
- A10,
- A3Extra,
- A4Extra,
- A4Plus,
- A4Small,
- A5Extra,
- B5Extra,
-
- JisB0,
- JisB1,
- JisB2,
- JisB3,
- JisB4,
- JisB5,
- JisB6,
- JisB7,
- JisB8,
- JisB9,
- JisB10,
-
- // AnsiA = Letter,
- // AnsiB = Ledger,
- AnsiC,
- AnsiD,
- AnsiE,
- LegalExtra,
- LetterExtra,
- LetterPlus,
- LetterSmall,
- TabloidExtra,
-
- ArchA,
- ArchB,
- ArchC,
- ArchD,
- ArchE,
-
- Imperial7x9,
- Imperial8x10,
- Imperial9x11,
- Imperial9x12,
- Imperial10x11,
- Imperial10x13,
- Imperial10x14,
- Imperial12x11,
- Imperial15x11,
-
- ExecutiveStandard,
- Note,
- Quarto,
- Statement,
- SuperA,
- SuperB,
- Postcard,
- DoublePostcard,
- Prc16K,
- Prc32K,
- Prc32KBig,
-
- FanFoldUS,
- FanFoldGerman,
- FanFoldGermanLegal,
-
- EnvelopeB4,
- EnvelopeB5,
- EnvelopeB6,
- EnvelopeC0,
- EnvelopeC1,
- EnvelopeC2,
- EnvelopeC3,
- EnvelopeC4,
- // EnvelopeC5 = C5E,
- EnvelopeC6,
- EnvelopeC65,
- EnvelopeC7,
- // EnvelopeDL = DLE,
-
- Envelope9,
- // Envelope10 = Comm10E,
- Envelope11,
- Envelope12,
- Envelope14,
- EnvelopeMonarch,
- EnvelopePersonal,
-
- EnvelopeChou3,
- EnvelopeChou4,
- EnvelopeInvite,
- EnvelopeItalian,
- EnvelopeKaku2,
- EnvelopeKaku3,
- EnvelopePrc1,
- EnvelopePrc2,
- EnvelopePrc3,
- EnvelopePrc4,
- EnvelopePrc5,
- EnvelopePrc6,
- EnvelopePrc7,
- EnvelopePrc8,
- EnvelopePrc9,
- EnvelopePrc10,
- EnvelopeYou4,
-
- // Last item, with commonly used synynoms from QPagedPrintEngine / QPrinter
- LastPageSize = EnvelopeYou4,
- NPageSize = LastPageSize,
- NPaperSize = LastPageSize,
-
- // Convenience overloads for naming consistency
- AnsiA = Letter,
- AnsiB = Ledger,
- EnvelopeC5 = C5E,
- EnvelopeDL = DLE,
- Envelope10 = Comm10E
- };
-
// keep in sync with QPdfEngine::PdfVersion!
enum PdfVersion { PdfVersion_1_4, PdfVersion_A1b, PdfVersion_1_6 };
- // ### Qt6 Make these virtual
- bool setPageLayout(const QPageLayout &pageLayout);
- bool setPageSize(const QPageSize &pageSize);
- bool setPageOrientation(QPageLayout::Orientation orientation);
- bool setPageMargins(const QMarginsF &margins);
- bool setPageMargins(const QMarginsF &margins, QPageLayout::Unit units);
+ virtual bool setPageLayout(const QPageLayout &pageLayout);
+ virtual bool setPageSize(const QPageSize &pageSize);
+ virtual bool setPageOrientation(QPageLayout::Orientation orientation);
+ virtual bool setPageMargins(const QMarginsF &margins, QPageLayout::Unit units = QPageLayout::Millimeter);
QPageLayout pageLayout() const;
- virtual void setPageSize(PageSize size);
- PageSize pageSize() const;
-
- virtual void setPageSizeMM(const QSizeF &size);
- QSizeF pageSizeMM() const;
-
- // ### Qt6 Remove in favor of QMarginsF
- struct Margins {
- qreal left;
- qreal right;
- qreal top;
- qreal bottom;
- };
-
- virtual void setMargins(const Margins &margins);
- Margins margins() const;
+ virtual void setPageRanges(const QPageRanges &ranges);
+ QPageRanges pageRanges() const;
protected:
QPagedPaintDevice(QPagedPaintDevicePrivate *dd);
QPagedPaintDevicePrivate *dd();
- QT_DEPRECATED QPageLayout devicePageLayout() const;
- QT_DEPRECATED QPageLayout &devicePageLayout();
friend class QPagedPaintDevicePrivate;
QPagedPaintDevicePrivate *d;
};
diff --git a/src/gui/painting/qpagedpaintdevice_p.h b/src/gui/painting/qpagedpaintdevice_p.h
index 3a43bd7828..8e2205344e 100644
--- a/src/gui/painting/qpagedpaintdevice_p.h
+++ b/src/gui/painting/qpagedpaintdevice_p.h
@@ -1,41 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the QtGui module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#ifndef QPAGEDPAINTDEVICE_P_H
#define QPAGEDPAINTDEVICE_P_H
@@ -60,9 +24,7 @@ class Q_GUI_EXPORT QPagedPaintDevicePrivate
{
public:
QPagedPaintDevicePrivate()
- : fromPage(0),
- toPage(0),
- pageOrderAscending(true),
+ : pageOrderAscending(true),
printSelectionOnly(false)
{
}
@@ -83,8 +45,7 @@ public:
static inline QPagedPaintDevicePrivate *get(QPagedPaintDevice *pd) { return pd->d; }
// These are currently required to keep QPrinter functionality working in QTextDocument::print()
- int fromPage;
- int toPage;
+ QPageRanges pageRanges;
bool pageOrderAscending;
bool printSelectionOnly;
};
diff --git a/src/gui/painting/qpagelayout.cpp b/src/gui/painting/qpagelayout.cpp
index 2634a448a5..e60f464d6e 100644
--- a/src/gui/painting/qpagelayout.cpp
+++ b/src/gui/painting/qpagelayout.cpp
@@ -1,41 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2014 John Layt <jlayt@kde.org>
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the QtGui module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2014 John Layt <jlayt@kde.org>
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#include "qpagelayout.h"
@@ -48,6 +12,10 @@
QT_BEGIN_NAMESPACE
+QT_IMPL_METATYPE_EXTERN(QPageLayout)
+QT_IMPL_METATYPE_EXTERN_TAGGED(QPageLayout::Unit, QPageLayout__Unit)
+QT_IMPL_METATYPE_EXTERN_TAGGED(QPageLayout::Orientation, QPageLayout__Orientation)
+
// Multiplier for converting units to points.
Q_GUI_EXPORT qreal qt_pointMultiplier(QPageLayout::Unit unit)
{
@@ -71,41 +39,19 @@ Q_GUI_EXPORT qreal qt_pointMultiplier(QPageLayout::Unit unit)
// Multiplier for converting pixels to points.
extern qreal qt_pixelMultiplier(int resolution);
-QPointF qt_convertPoint(const QPointF &xy, QPageLayout::Unit fromUnits, QPageLayout::Unit toUnits)
-{
- // If the size have the same units, or are all 0, then don't need to convert
- if (fromUnits == toUnits || xy.isNull())
- return xy;
-
- // If converting to points then convert and round to 0 decimal places
- if (toUnits == QPageLayout::Point) {
- const qreal multiplier = qt_pointMultiplier(fromUnits);
- return QPointF(qRound(xy.x() * multiplier),
- qRound(xy.y() * multiplier));
- }
-
- // If converting to other units, need to convert to unrounded points first
- QPointF pointXy = (fromUnits == QPageLayout::Point) ? xy : xy * qt_pointMultiplier(fromUnits);
-
- // Then convert from points to required units rounded to 2 decimal places
- const qreal multiplier = qt_pointMultiplier(toUnits);
- return QPointF(qRound(pointXy.x() * 100 / multiplier) / 100.0,
- qRound(pointXy.y() * 100 / multiplier) / 100.0);
-}
-
Q_GUI_EXPORT QMarginsF qt_convertMargins(const QMarginsF &margins, QPageLayout::Unit fromUnits, QPageLayout::Unit toUnits)
{
// If the margins have the same units, or are all 0, then don't need to convert
if (fromUnits == toUnits || margins.isNull())
return margins;
- // If converting to points then convert and round to 0 decimal places
+ // If converting to points then convert and round up to 2 decimal places
if (toUnits == QPageLayout::Point) {
- const qreal multiplier = qt_pointMultiplier(fromUnits);
- return QMarginsF(qRound(margins.left() * multiplier),
- qRound(margins.top() * multiplier),
- qRound(margins.right() * multiplier),
- qRound(margins.bottom() * multiplier));
+ const qreal multiplierX100 = qt_pointMultiplier(fromUnits) * 100;
+ return QMarginsF(qCeil(margins.left() * multiplierX100) / 100.0,
+ qCeil(margins.top() * multiplierX100) / 100.0,
+ qCeil(margins.right() * multiplierX100) / 100.0,
+ qCeil(margins.bottom() * multiplierX100) / 100.0);
}
// If converting to other units, need to convert to unrounded points first
@@ -133,10 +79,10 @@ public:
bool isValid() const;
- void clampMargins(const QMarginsF &margins);
+ QMarginsF clampMargins(const QMarginsF &margins) const;
QMarginsF margins(QPageLayout::Unit units) const;
- QMargins marginsPoints() const;
+ QMarginsF marginsPoints() const;
QMargins marginsPixels(int resolution) const;
void setDefaultMargins(const QMarginsF &minMargins);
@@ -205,12 +151,12 @@ bool QPageLayoutPrivate::isValid() const
return m_pageSize.isValid();
}
-void QPageLayoutPrivate::clampMargins(const QMarginsF &margins)
+QMarginsF QPageLayoutPrivate::clampMargins(const QMarginsF &margins) const
{
- m_margins = QMarginsF(qBound(m_minMargins.left(), margins.left(), m_maxMargins.left()),
- qBound(m_minMargins.top(), margins.top(), m_maxMargins.top()),
- qBound(m_minMargins.right(), margins.right(), m_maxMargins.right()),
- qBound(m_minMargins.bottom(), margins.bottom(), m_maxMargins.bottom()));
+ return QMarginsF(qBound(m_minMargins.left(), margins.left(), m_maxMargins.left()),
+ qBound(m_minMargins.top(), margins.top(), m_maxMargins.top()),
+ qBound(m_minMargins.right(), margins.right(), m_maxMargins.right()),
+ qBound(m_minMargins.bottom(), margins.bottom(), m_maxMargins.bottom()));
}
QMarginsF QPageLayoutPrivate::margins(QPageLayout::Unit units) const
@@ -218,25 +164,25 @@ QMarginsF QPageLayoutPrivate::margins(QPageLayout::Unit units) const
return qt_convertMargins(m_margins, m_units, units);
}
-QMargins QPageLayoutPrivate::marginsPoints() const
+QMarginsF QPageLayoutPrivate::marginsPoints() const
{
- return qt_convertMargins(m_margins, m_units, QPageLayout::Point).toMargins();
+ return qt_convertMargins(m_margins, m_units, QPageLayout::Point);
}
QMargins QPageLayoutPrivate::marginsPixels(int resolution) const
{
- return marginsPoints() / qt_pixelMultiplier(resolution);
+ return QMarginsF(marginsPoints() / qt_pixelMultiplier(resolution)).toMargins();
}
void QPageLayoutPrivate::setDefaultMargins(const QMarginsF &minMargins)
{
m_minMargins = minMargins;
- m_maxMargins = QMarginsF(m_fullSize.width() - m_minMargins.right(),
- m_fullSize.height() - m_minMargins.bottom(),
- m_fullSize.width() - m_minMargins.left(),
- m_fullSize.height() - m_minMargins.top());
+ m_maxMargins = QMarginsF(qMax(m_fullSize.width() - m_minMargins.right(), qreal(0)),
+ qMax(m_fullSize.height() - m_minMargins.bottom(), qreal(0)),
+ qMax(m_fullSize.width() - m_minMargins.left(), qreal(0)),
+ qMax(m_fullSize.height() - m_minMargins.top(), qreal(0)));
if (m_mode == QPageLayout::StandardMode)
- clampMargins(m_margins);
+ m_margins = clampMargins(m_margins);
}
QSizeF QPageLayoutPrivate::fullSizeUnits(QPageLayout::Unit units) const
@@ -342,6 +288,27 @@ QRectF QPageLayoutPrivate::paintRect() const
\value StandardMode Paint Rect includes margins, margins must fall between the minimum and maximum.
\value FullPageMode Paint Rect excludes margins, margins can be any value and must be managed manually.
+
+ In StandardMode, when setting margins, use \l{QPageLayout::OutOfBoundsPolicy::}{Clamp} to
+ automatically clamp the margins to fall between the minimum and maximum
+ allowed values.
+
+ \sa OutOfBoundsPolicy
+*/
+
+/*!
+ \enum QPageLayout::OutOfBoundsPolicy
+ \since 6.8
+
+ Defines the policy for margins that are out of bounds
+
+ \value Reject The margins must fall within the minimum and maximum values,
+ otherwise they will be rejected.
+ \value Clamp The margins are clamped between the minimum and maximum
+ values to ensure they are valid.
+
+ \note The policy has no effect in \l{QPageLayout::Mode}{FullPageMode},
+ where all margins are accepted.
*/
/*!
@@ -415,7 +382,7 @@ QPageLayout &QPageLayout::operator=(const QPageLayout &other)
*/
/*!
- \relates QPageLayout
+ \fn bool QPageLayout::operator==(const QPageLayout &lhs, const QPageLayout &rhs)
Returns \c true if page layout \a lhs is equal to page layout \a rhs,
i.e. if all the attributes are exactly equal.
@@ -427,14 +394,8 @@ QPageLayout &QPageLayout::operator=(const QPageLayout &other)
\sa QPageLayout::isEquivalentTo()
*/
-bool operator==(const QPageLayout &lhs, const QPageLayout &rhs)
-{
- return lhs.d == rhs.d || *lhs.d == *rhs.d;
-}
-
/*!
- \fn bool operator!=(const QPageLayout &lhs, const QPageLayout &rhs)
- \relates QPageLayout
+ \fn bool QPageLayout::operator!=(const QPageLayout &lhs, const QPageLayout &rhs)
Returns \c true if page layout \a lhs is not equal to page layout \a rhs,
i.e. if any of the attributes differ.
@@ -447,6 +408,15 @@ bool operator==(const QPageLayout &lhs, const QPageLayout &rhs)
*/
/*!
+ \internal
+*/
+bool QPageLayout::equals(const QPageLayout &other) const
+{
+ return d == other.d || *d == *other.d;
+}
+
+
+/*!
Returns \c true if this page layout is equivalent to the \a other page layout,
i.e. if the page has the same size, margins and orientation.
*/
@@ -576,39 +546,52 @@ QPageLayout::Unit QPageLayout::units() const
}
/*!
- Sets the page margins of the page layout to \a margins
+ Sets the page margins of the page layout to \a margins.
Returns true if the margins were successfully set.
The units used are those currently defined for the layout. To use different
units then call setUnits() first.
- If in the default StandardMode then all the new margins must fall between the
- minimum margins set and the maximum margins allowed by the page size,
- otherwise the margins will not be set.
-
- If in FullPageMode then any margin values will be accepted.
+ Since Qt 6.8, the optional \a outOfBoundsPolicy can be used to specify how
+ margins that are out of bounds are handled.
\sa margins(), units()
*/
-bool QPageLayout::setMargins(const QMarginsF &margins)
+bool QPageLayout::setMargins(const QMarginsF &margins, OutOfBoundsPolicy outOfBoundsPolicy)
{
if (d->m_mode == FullPageMode) {
- d.detach();
- d->m_margins = margins;
+ if (margins != d->m_margins) {
+ d.detach();
+ d->m_margins = margins;
+ }
return true;
- } else if (margins.left() >= d->m_minMargins.left()
- && margins.right() >= d->m_minMargins.right()
- && margins.top() >= d->m_minMargins.top()
- && margins.bottom() >= d->m_minMargins.bottom()
- && margins.left() <= d->m_maxMargins.left()
- && margins.right() <= d->m_maxMargins.right()
- && margins.top() <= d->m_maxMargins.top()
- && margins.bottom() <= d->m_maxMargins.bottom()) {
- d.detach();
- d->m_margins = margins;
+ }
+
+ if (outOfBoundsPolicy == OutOfBoundsPolicy::Clamp) {
+ const QMarginsF clampedMargins = d->clampMargins(margins);
+ if (clampedMargins != d->m_margins) {
+ d.detach();
+ d->m_margins = clampedMargins;
+ }
return true;
}
+
+ if (margins.left() >= d->m_minMargins.left()
+ && margins.right() >= d->m_minMargins.right()
+ && margins.top() >= d->m_minMargins.top()
+ && margins.bottom() >= d->m_minMargins.bottom()
+ && margins.left() <= d->m_maxMargins.left()
+ && margins.right() <= d->m_maxMargins.right()
+ && margins.top() <= d->m_maxMargins.top()
+ && margins.bottom() <= d->m_maxMargins.bottom()) {
+ if (margins != d->m_margins) {
+ d.detach();
+ d->m_margins = margins;
+ }
+ return true;
+ }
+
return false;
}
@@ -619,23 +602,27 @@ bool QPageLayout::setMargins(const QMarginsF &margins)
The units used are those currently defined for the layout. To use different
units call setUnits() first.
- If in the default StandardMode then the new margin must fall between the
- minimum margin set and the maximum margin allowed by the page size,
- otherwise the margin will not be set.
-
- If in FullPageMode then any margin values will be accepted.
+ Since Qt 6.8, the optional \a outOfBoundsPolicy can be used to specify how
+ margins that are out of bounds are handled.
\sa setMargins(), margins()
*/
-bool QPageLayout::setLeftMargin(qreal leftMargin)
+bool QPageLayout::setLeftMargin(qreal leftMargin, OutOfBoundsPolicy outOfBoundsPolicy)
{
+ if (d->m_mode == StandardMode && outOfBoundsPolicy == OutOfBoundsPolicy::Clamp)
+ leftMargin = qBound(d->m_minMargins.left(), leftMargin, d->m_maxMargins.left());
+
+ if (qFuzzyCompare(leftMargin, d->m_margins.left()))
+ return true;
+
if (d->m_mode == FullPageMode
|| (leftMargin >= d->m_minMargins.left() && leftMargin <= d->m_maxMargins.left())) {
d.detach();
d->m_margins.setLeft(leftMargin);
return true;
}
+
return false;
}
@@ -646,23 +633,27 @@ bool QPageLayout::setLeftMargin(qreal leftMargin)
The units used are those currently defined for the layout. To use different
units call setUnits() first.
- If in the default StandardMode then the new margin must fall between the
- minimum margin set and the maximum margin allowed by the page size,
- otherwise the margin will not be set.
-
- If in FullPageMode then any margin values will be accepted.
+ Since Qt 6.8, the optional \a outOfBoundsPolicy can be used to specify how
+ margins that are out of bounds are handled.
\sa setMargins(), margins()
*/
-bool QPageLayout::setRightMargin(qreal rightMargin)
+bool QPageLayout::setRightMargin(qreal rightMargin, OutOfBoundsPolicy outOfBoundsPolicy)
{
+ if (d->m_mode == StandardMode && outOfBoundsPolicy == OutOfBoundsPolicy::Clamp)
+ rightMargin = qBound(d->m_minMargins.right(), rightMargin, d->m_maxMargins.right());
+
+ if (qFuzzyCompare(rightMargin, d->m_margins.right()))
+ return true;
+
if (d->m_mode == FullPageMode
|| (rightMargin >= d->m_minMargins.right() && rightMargin <= d->m_maxMargins.right())) {
d.detach();
d->m_margins.setRight(rightMargin);
return true;
}
+
return false;
}
@@ -673,23 +664,27 @@ bool QPageLayout::setRightMargin(qreal rightMargin)
The units used are those currently defined for the layout. To use different
units call setUnits() first.
- If in the default StandardMode then the new margin must fall between the
- minimum margin set and the maximum margin allowed by the page size,
- otherwise the margin will not be set.
-
- If in FullPageMode then any margin values will be accepted.
+ Since Qt 6.8, the optional \a outOfBoundsPolicy can be used to specify how
+ margins that are out of bounds are handled.
\sa setMargins(), margins()
*/
-bool QPageLayout::setTopMargin(qreal topMargin)
+bool QPageLayout::setTopMargin(qreal topMargin, OutOfBoundsPolicy outOfBoundsPolicy)
{
+ if (d->m_mode == StandardMode && outOfBoundsPolicy == OutOfBoundsPolicy::Clamp)
+ topMargin = qBound(d->m_minMargins.top(), topMargin, d->m_maxMargins.top());
+
+ if (qFuzzyCompare(topMargin, d->m_margins.top()))
+ return true;
+
if (d->m_mode == FullPageMode
|| (topMargin >= d->m_minMargins.top() && topMargin <= d->m_maxMargins.top())) {
d.detach();
d->m_margins.setTop(topMargin);
return true;
}
+
return false;
}
@@ -700,23 +695,27 @@ bool QPageLayout::setTopMargin(qreal topMargin)
The units used are those currently defined for the layout. To use different
units call setUnits() first.
- If in the default StandardMode then the new margin must fall between the
- minimum margin set and the maximum margin allowed by the page size,
- otherwise the margin will not be set.
-
- If in FullPageMode then any margin values will be accepted.
+ Since Qt 6.8, the optional \a outOfBoundsPolicy can be used to specify how
+ margins that are out of bounds are handled.
\sa setMargins(), margins()
*/
-bool QPageLayout::setBottomMargin(qreal bottomMargin)
+bool QPageLayout::setBottomMargin(qreal bottomMargin, OutOfBoundsPolicy outOfBoundsPolicy)
{
+ if (d->m_mode == StandardMode && outOfBoundsPolicy == OutOfBoundsPolicy::Clamp)
+ bottomMargin = qBound(d->m_minMargins.bottom(), bottomMargin, d->m_maxMargins.bottom());
+
+ if (qFuzzyCompare(bottomMargin, d->m_margins.bottom()))
+ return true;
+
if (d->m_mode == FullPageMode
|| (bottomMargin >= d->m_minMargins.bottom() && bottomMargin <= d->m_maxMargins.bottom())) {
d.detach();
d->m_margins.setBottom(bottomMargin);
return true;
}
+
return false;
}
@@ -750,7 +749,7 @@ QMarginsF QPageLayout::margins(Unit units) const
QMargins QPageLayout::marginsPoints() const
{
- return d->marginsPoints();
+ return d->marginsPoints().toMargins();
}
/*!
@@ -917,7 +916,7 @@ QRect QPageLayout::paintRectPoints() const
if (!isValid())
return QRect();
return d->m_mode == FullPageMode ? d->fullRectPoints()
- : d->fullRectPoints() - d->marginsPoints();
+ : d->fullRectPoints() - d->marginsPoints().toMargins();
}
/*!
diff --git a/src/gui/painting/qpagelayout.h b/src/gui/painting/qpagelayout.h
index 7ee0ce7a76..1e340b6d75 100644
--- a/src/gui/painting/qpagelayout.h
+++ b/src/gui/painting/qpagelayout.h
@@ -1,47 +1,11 @@
-/****************************************************************************
-**
-** Copyright (C) 2014 John Layt <jlayt@kde.org>
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the QtGui module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2014 John Layt <jlayt@kde.org>
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#ifndef QPAGELAYOUT_H
#define QPAGELAYOUT_H
#include <QtGui/qtguiglobal.h>
-#include <QtCore/qsharedpointer.h>
+#include <QtCore/qshareddata.h>
#include <QtCore/qstring.h>
#include <QtCore/qmargins.h>
@@ -66,7 +30,6 @@ public:
Cicero
};
- // NOTE: Must keep in sync with QPrinter::Orientation
enum Orientation {
Portrait,
Landscape
@@ -77,18 +40,22 @@ public:
FullPageMode // Paint Rect excludes margins
};
+ enum class OutOfBoundsPolicy {
+ Reject,
+ Clamp
+ };
+
QPageLayout();
QPageLayout(const QPageSize &pageSize, Orientation orientation,
const QMarginsF &margins, Unit units = Point,
const QMarginsF &minMargins = QMarginsF(0, 0, 0, 0));
QPageLayout(const QPageLayout &other);
- QPageLayout &operator=(QPageLayout &&other) noexcept { swap(other); return *this; }
+ QT_MOVE_ASSIGNMENT_OPERATOR_IMPL_VIA_PURE_SWAP(QPageLayout)
QPageLayout &operator=(const QPageLayout &other);
~QPageLayout();
- void swap(QPageLayout &other) noexcept { qSwap(d, other.d); }
+ void swap(QPageLayout &other) noexcept { d.swap(other.d); }
- friend Q_GUI_EXPORT bool operator==(const QPageLayout &lhs, const QPageLayout &rhs);
bool isEquivalentTo(const QPageLayout &other) const;
bool isValid() const;
@@ -106,11 +73,19 @@ public:
void setUnits(Unit units);
Unit units() const;
+#if QT_GUI_REMOVED_SINCE(6, 8)
bool setMargins(const QMarginsF &margins);
bool setLeftMargin(qreal leftMargin);
bool setRightMargin(qreal rightMargin);
bool setTopMargin(qreal topMargin);
bool setBottomMargin(qreal bottomMargin);
+#endif
+
+ bool setMargins(const QMarginsF &margins, OutOfBoundsPolicy outOfBoundsPolicy = OutOfBoundsPolicy::Reject);
+ bool setLeftMargin(qreal leftMargin, OutOfBoundsPolicy outOfBoundsPolicy = OutOfBoundsPolicy::Reject);
+ bool setRightMargin(qreal rightMargin, OutOfBoundsPolicy outOfBoundsPolicy = OutOfBoundsPolicy::Reject);
+ bool setTopMargin(qreal topMargin, OutOfBoundsPolicy outOfBoundsPolicy = OutOfBoundsPolicy::Reject);
+ bool setBottomMargin(qreal bottomMargin, OutOfBoundsPolicy outOfBoundsPolicy = OutOfBoundsPolicy::Reject);
QMarginsF margins() const;
QMarginsF margins(Unit units) const;
@@ -133,23 +108,26 @@ public:
private:
friend class QPageLayoutPrivate;
+ bool equals(const QPageLayout &other) const;
+
+ friend inline bool operator==(const QPageLayout &lhs, const QPageLayout &rhs)
+ { return lhs.equals(rhs); }
+ friend inline bool operator!=(const QPageLayout &lhs, const QPageLayout &rhs)
+ { return !lhs.equals(rhs); }
+
QExplicitlySharedDataPointer<QPageLayoutPrivate> d;
};
Q_DECLARE_SHARED(QPageLayout)
-Q_GUI_EXPORT bool operator==(const QPageLayout &lhs, const QPageLayout &rhs);
-inline bool operator!=(const QPageLayout &lhs, const QPageLayout &rhs)
-{ return !operator==(lhs, rhs); }
-
#ifndef QT_NO_DEBUG_STREAM
Q_GUI_EXPORT QDebug operator<<(QDebug dbg, const QPageLayout &pageLayout);
#endif
QT_END_NAMESPACE
-Q_DECLARE_METATYPE(QPageLayout)
-Q_DECLARE_METATYPE(QPageLayout::Unit)
-Q_DECLARE_METATYPE(QPageLayout::Orientation)
+QT_DECL_METATYPE_EXTERN(QPageLayout, Q_GUI_EXPORT)
+QT_DECL_METATYPE_EXTERN_TAGGED(QPageLayout::Unit, QPageLayout__Unit, Q_GUI_EXPORT)
+QT_DECL_METATYPE_EXTERN_TAGGED(QPageLayout::Orientation, QPageLayout__Orientation, Q_GUI_EXPORT)
#endif // QPAGELAYOUT_H
diff --git a/src/gui/painting/qpageranges.cpp b/src/gui/painting/qpageranges.cpp
new file mode 100644
index 0000000000..99a0009883
--- /dev/null
+++ b/src/gui/painting/qpageranges.cpp
@@ -0,0 +1,367 @@
+// Copyright (C) 2020 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
+
+#include "qpageranges.h"
+#include "qpageranges_p.h"
+
+#include <QtCore/qstack.h>
+#include <QtCore/qdebug.h>
+#include <QtCore/qdatastream.h>
+
+QT_BEGIN_NAMESPACE
+
+QT_IMPL_METATYPE_EXTERN(QPageRanges)
+
+void QPageRangesPrivate::mergeIntervals()
+{
+ const int count = intervals.size();
+
+ if (count <= 1)
+ return;
+
+ std::sort(intervals.begin(), intervals.end());
+
+ QStack<QPageRanges::Range> stack;
+ stack.push(intervals[0]);
+
+ for (int i = 1; i < count; ++i) {
+ QPageRanges::Range &top = stack.top();
+
+ if (top.to < intervals[i].from - 1)
+ stack.push(intervals[i]);
+ else if (top.to < intervals[i].to)
+ top.to = intervals[i].to;
+ }
+
+ intervals = stack;
+}
+
+QT_DEFINE_QESDP_SPECIALIZATION_DTOR(QPageRangesPrivate)
+
+/*!
+ \class QPageRanges
+ \brief The QPageRanges class represents a collection of page ranges.
+ \inmodule QtGui
+ \ingroup painting
+ \ingroup printing
+ \ingroup shared
+ \since 6.0
+
+ Use QPagedPaintDevice::pageRanges() to access the collection of page ranges
+ associated with a paged device.
+*/
+
+/*!
+ Constructs an empty QPageRanges object.
+*/
+QPageRanges::QPageRanges() = default;
+
+/*!
+ Constructs a QPageRanges object by copying \a other.
+*/
+QPageRanges::QPageRanges(const QPageRanges &other) noexcept = default;
+
+/*!
+ \fn QPageRanges::QPageRanges(QPageRanges &&other)
+
+ Constructs a QPageRanges object by moving from \a other.
+*/
+
+/*!
+ Destroys the page ranges.
+*/
+QPageRanges::~QPageRanges() = default;
+
+/*!
+ Assigns \a other to this QPageRanges object.
+*/
+QPageRanges &QPageRanges::operator=(const QPageRanges &other) noexcept = default;
+
+/*!
+ \fn QPageRanges &QPageRanges::operator=(QPageRanges &&other)
+ Moves \a other into this QPageRanges object.
+*/
+
+/*!
+ Adds the single page \a pageNumber to the ranges.
+
+ \note Page numbers start with 1. Attempts to add page numbers
+ smaller than 1 will be ignored with a warning.
+*/
+void QPageRanges::addPage(int pageNumber)
+{
+ if (pageNumber <= 0) {
+ qWarning("QPageRanges::addPage: 'pageNumber' must be greater than 0");
+ return;
+ }
+
+ detach();
+ d->intervals.append({ pageNumber, pageNumber });
+ d->mergeIntervals();
+}
+
+/*!
+ Adds the range specified with \a from and \a to to the ranges.
+
+ \note Page numbers start with 1. Attempts to add page numbers
+ smaller than 1 will be ignored with a warning.
+*/
+void QPageRanges::addRange(int from, int to)
+{
+ if (from <= 0 || to <= 0) {
+ qWarning("QPageRanges::addRange: 'from' and 'to' must be greater than 0");
+ return;
+ }
+ if (to < from)
+ std::swap(from, to);
+
+ detach();
+ d->intervals.append({from, to});
+ d->mergeIntervals();
+}
+
+/*!
+ Returns a list with the values of the ranges.
+*/
+QList<QPageRanges::Range> QPageRanges::toRangeList() const
+{
+ if (d)
+ return d->intervals;
+ return QList<QPageRanges::Range>{};
+}
+
+/*!
+ Removes all page ranges.
+*/
+void QPageRanges::clear()
+{
+ d.reset();
+}
+
+/*!
+ Constructs and returns a QPageRanges object populated with the
+ \a ranges from the string representation.
+
+ \code
+ QPrinter printer;
+ QPageRanges ranges = QPageRanges::fromString("1-3,6-7");
+ printer.setPageRanges(ranges);
+ \endcode
+
+ In case of parsing error, returns an empty QPageRanges object.
+
+ \sa isEmpty()
+*/
+QPageRanges QPageRanges::fromString(const QString &ranges)
+{
+ QList<Range> intervals;
+ const QStringList items = ranges.split(u',');
+ for (const QString &item : items) {
+ if (item.isEmpty())
+ return QPageRanges();
+
+ if (item.contains(u'-')) {
+ const QStringList rangeItems = item.split(u'-');
+ if (rangeItems.size() != 2)
+ return QPageRanges();
+
+ bool ok;
+ const int number1 = rangeItems[0].toInt(&ok);
+ if (!ok)
+ return QPageRanges();
+
+ const int number2 = rangeItems[1].toInt(&ok);
+ if (!ok)
+ return QPageRanges();
+
+ if (number1 < 1 || number2 < 1 || number2 < number1)
+ return QPageRanges();
+
+ intervals.append({number1, number2});
+
+ } else {
+ bool ok;
+ const int number = item.toInt(&ok);
+ if (!ok)
+ return QPageRanges();
+
+ if (number < 1)
+ return QPageRanges();
+
+ intervals.append({number, number});
+ }
+ }
+
+ QPageRanges newRanges;
+ newRanges.d.reset(new QPageRangesPrivate);
+ newRanges.d->intervals = intervals;
+ newRanges.d->mergeIntervals();
+ return newRanges;
+}
+
+/*!
+ Returns the string representation of the page ranges.
+*/
+QString QPageRanges::toString() const
+{
+ if (!d)
+ return QString();
+
+ QString result;
+ for (const Range &range : d->intervals) {
+ if (!result.isEmpty())
+ result += u',';
+
+ if (range.from == range.to)
+ result += QString::number(range.from);
+ else
+ result += QStringLiteral("%1-%2").arg(range.from).arg(range.to);
+ }
+
+ return result;
+}
+
+/*!
+ \fn bool QPageRanges::contains(int pageNumber) const
+
+ Returns \c true if the ranges include the page \a pageNumber;
+ otherwise returns \c false.
+*/
+bool QPageRanges::contains(int pageNumber) const
+{
+ if (!d)
+ return false;
+
+ for (const Range &range : d->intervals) {
+ if (range.from <= pageNumber && range.to >= pageNumber)
+ return true;
+ }
+ return false;
+}
+
+/*!
+ Returns \c true if the ranges are empty; otherwise returns \c false.
+*/
+bool QPageRanges::isEmpty() const
+{
+ return !d || d->intervals.isEmpty();
+}
+
+/*!
+ Returns the index of the first page covered by the page ranges,
+ or 0 if the page ranges are empty.
+*/
+int QPageRanges::firstPage() const
+{
+ if (isEmpty())
+ return 0;
+ return d->intervals.constFirst().from;
+}
+
+/*!
+ Returns the index of the last page covered by the page ranges,
+ or 0 if the page ranges are empty.
+*/
+int QPageRanges::lastPage() const
+{
+ if (isEmpty())
+ return 0;
+ return d->intervals.constLast().to;
+}
+
+/*!
+ \internal
+*/
+bool QPageRanges::isEqual(const QPageRanges &other) const noexcept
+{
+ if (d == other.d)
+ return true;
+ if (!d || !other.d)
+ return false;
+ return d->intervals == other.d->intervals;
+}
+
+/*!
+ \internal
+*/
+void QPageRanges::detach()
+{
+ if (d)
+ d.detach();
+ else
+ d.reset(new QPageRangesPrivate);
+}
+
+#if !defined(QT_NO_DATASTREAM)
+/*!
+ \fn QDataStream &operator<<(QDataStream &stream, const QPageRanges &pageRanges)
+ \relates QPageRanges
+
+ Writes \a pageRanges to \a stream as a range string.
+
+ \sa QPageRanges::toString
+*/
+
+QDataStream &operator<<(QDataStream &s, const QPageRanges &pageRanges)
+{
+ s << pageRanges.toString();
+ return s;
+}
+
+/*!
+ \fn QDataStream &operator>>(QDataStream &stream, QPageRanges &pageRanges)
+ \relates QPageRanges
+
+ Reads a page ranges string from \a stream and stores it in \a pageRanges.
+
+ \sa QPageRanges::fromString
+*/
+
+QDataStream &operator>>(QDataStream &s, QPageRanges &pageRanges)
+{
+ QString rangesString;
+ s >> rangesString;
+ pageRanges = QPageRanges::fromString(rangesString);
+ return s;
+}
+#endif // QT_NO_DATASTREAM
+
+#ifndef QT_NO_DEBUG_STREAM
+QDebug operator<<(QDebug dbg, const QPageRanges &pageRanges)
+{
+ QDebugStateSaver saver(dbg);
+ dbg.nospace();
+ dbg.noquote();
+ dbg << "QPageRanges(" << pageRanges.toString() << ")";
+
+ return dbg;
+}
+#endif
+
+/*!
+ \struct QPageRanges::Range
+ \inmodule QtGui
+ \brief The QPageRanges::Range struct holds the \c from and \c to endpoints of a range.
+
+ \sa QPageRanges::toRangeList()
+*/
+
+/*!
+ \variable QPageRanges::Range::from
+ \brief the lower endpoint of the range
+*/
+
+/*!
+ \variable QPageRanges::Range::to
+ \brief the upper endpoint of the range
+*/
+
+/*!
+ \fn bool QPageRanges::Range::contains(int pageNumber) const
+
+ Returns \c true if \a pageNumber is within the interval \c{[from, to]};
+ otherwise returns \c false.
+*/
+
+
+QT_END_NAMESPACE
diff --git a/src/gui/painting/qpageranges.h b/src/gui/painting/qpageranges.h
new file mode 100644
index 0000000000..d0e282fbf2
--- /dev/null
+++ b/src/gui/painting/qpageranges.h
@@ -0,0 +1,89 @@
+// Copyright (C) 2020 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
+
+#ifndef QPAGERANGES_H
+#define QPAGERANGES_H
+
+#include <QtGui/qtguiglobal.h>
+#include <QtCore/qstring.h>
+#include <QtCore/qlist.h>
+#include <QtCore/qshareddata.h>
+#include <QtCore/qmetatype.h>
+
+QT_BEGIN_NAMESPACE
+
+class QDebug;
+class QDataStream;
+class QPageRangesPrivate;
+QT_DECLARE_QESDP_SPECIALIZATION_DTOR_WITH_EXPORT(QPageRangesPrivate, Q_GUI_EXPORT)
+
+class Q_GUI_EXPORT QPageRanges
+{
+public:
+ QPageRanges();
+ ~QPageRanges();
+
+ QPageRanges(const QPageRanges &other) noexcept;
+ QPageRanges &operator=(const QPageRanges &other) noexcept;
+
+ QPageRanges(QPageRanges &&other) noexcept = default;
+ QT_MOVE_ASSIGNMENT_OPERATOR_IMPL_VIA_PURE_SWAP(QPageRanges)
+ void swap(QPageRanges &other) noexcept
+ { d.swap(other.d); }
+
+ friend bool operator==(const QPageRanges &lhs, const QPageRanges &rhs) noexcept
+ { return lhs.isEqual(rhs); }
+ friend bool operator!=(const QPageRanges &lhs, const QPageRanges &rhs) noexcept
+ { return !lhs.isEqual(rhs); }
+
+ struct Range {
+ int from = -1;
+ int to = -1;
+ bool contains(int pageNumber) const noexcept
+ { return from <= pageNumber && to >= pageNumber; }
+ friend bool operator==(Range lhs, Range rhs) noexcept
+ { return lhs.from == rhs.from && lhs.to == rhs.to; }
+ friend bool operator!=(Range lhs, Range rhs) noexcept
+ { return !(lhs == rhs); }
+ friend bool operator<(Range lhs, Range rhs) noexcept
+ { return lhs.from < rhs.from || (!(rhs.from < lhs.from) && lhs.to < rhs.to); }
+ };
+
+ void addPage(int pageNumber);
+ void addRange(int from, int to);
+ QList<Range> toRangeList() const;
+ void clear();
+
+ QString toString() const;
+ static QPageRanges fromString(const QString &ranges);
+
+ bool contains(int pageNumber) const;
+ bool isEmpty() const;
+ int firstPage() const;
+ int lastPage() const;
+
+ void detach();
+
+private:
+ bool isEqual(const QPageRanges &other) const noexcept;
+
+ QExplicitlySharedDataPointer<QPageRangesPrivate> d;
+};
+
+#ifndef QT_NO_DATASTREAM
+Q_GUI_EXPORT QDataStream &operator<<(QDataStream &, const QPageRanges &);
+Q_GUI_EXPORT QDataStream &operator>>(QDataStream &, QPageRanges &);
+#endif
+
+#ifndef QT_NO_DEBUG_STREAM
+Q_GUI_EXPORT QDebug operator<<(QDebug dbg, const QPageRanges &pageRanges);
+#endif
+
+Q_DECLARE_SHARED(QPageRanges)
+Q_DECLARE_TYPEINFO(QPageRanges::Range, Q_RELOCATABLE_TYPE);
+
+QT_END_NAMESPACE
+
+QT_DECL_METATYPE_EXTERN(QPageRanges, Q_GUI_EXPORT)
+
+#endif // QPAGERANGES_H
diff --git a/src/gui/painting/qpageranges_p.h b/src/gui/painting/qpageranges_p.h
new file mode 100644
index 0000000000..37f41a1e11
--- /dev/null
+++ b/src/gui/painting/qpageranges_p.h
@@ -0,0 +1,33 @@
+// Copyright (C) 2020 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
+
+#ifndef QPAGERANGES_P_H
+#define QPAGERANGES_P_H
+
+//
+// W A R N I N G
+// -------------
+//
+// This file is not part of the Qt API. It exists purely as an
+// implementation detail. This header file may change from version to
+// version without notice, or even be removed.
+//
+// We mean it.
+//
+
+
+#include <QtGui/private/qtguiglobal_p.h>
+
+QT_BEGIN_NAMESPACE
+
+class QPageRangesPrivate : public QSharedData
+{
+public:
+ void mergeIntervals();
+
+ QList<QPageRanges::Range> intervals;
+};
+
+QT_END_NAMESPACE
+
+#endif // QPAGERANGES_P_H
diff --git a/src/gui/painting/qpagesize.cpp b/src/gui/painting/qpagesize.cpp
index d73a66b790..37f66fe63d 100644
--- a/src/gui/painting/qpagesize.cpp
+++ b/src/gui/painting/qpagesize.cpp
@@ -1,41 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2014 John Layt <jlayt@kde.org>
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the QtGui module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2014 John Layt <jlayt@kde.org>
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#include "qpagesize.h"
@@ -48,6 +12,12 @@
QT_BEGIN_NAMESPACE
+using namespace Qt::StringLiterals;
+
+QT_IMPL_METATYPE_EXTERN(QPageSize)
+QT_IMPL_METATYPE_EXTERN_TAGGED(QPageSize::PageSizeId, QPageSize__PageSizeId)
+QT_IMPL_METATYPE_EXTERN_TAGGED(QPageSize::Unit, QPageSize__Unit)
+
// Define the Windows DMPAPER sizes for use in the look-up table
// See http://msdn.microsoft.com/en-us/library/windows/desktop/dd319099.aspx
@@ -224,16 +194,16 @@ static const int qt_windowsConversion[][2] = {
// Standard sizes data
struct StandardPageSize {
- QPageSize::PageSizeId id;
- int windowsId; // Windows DMPAPER value
- QPageSize::Unit definitionUnits; // Standard definition size, e.g. ISO uses mm, ANSI uses inches
- int widthPoints;
- int heightPoints;
+ QPageSize::PageSizeId id : 8;
+ int windowsId : 16; // Windows DMPAPER value
+ QPageSize::Unit definitionUnits : 8; // Standard definition size, e.g. ISO uses mm, ANSI uses inches
+ int widthPoints : 16;
+ int heightPoints : 16;
qreal widthMillimeters;
qreal heightMillimeters;
qreal widthInches;
qreal heightInches;
- const char *mediaOption; // PPD standard mediaOption ID
+ const char mediaOption[20]; // PPD standard mediaOption ID
};
// Standard page sizes taken from the Postscript PPD Standard v4.3
@@ -242,9 +212,7 @@ struct StandardPageSize {
// NB! This table needs to be in sync with QPageSize::PageSizeId
static const StandardPageSize qt_pageSizes[] = {
- // Existing Qt sizes including ISO, US, ANSI and other standards
- {QPageSize::A4 , DMPAPER_A4 , QPageSize::Millimeter, 595, 842, 210 , 297 , 8.27, 11.69, "A4"},
- {QPageSize::B5 , DMPAPER_NONE , QPageSize::Millimeter, 499, 709, 176 , 250 , 6.9 , 9.8 , "ISOB5"},
+ // Old Qt sizes including ISO, US, ANSI and other standards
{QPageSize::Letter , DMPAPER_LETTER , QPageSize::Inch , 612, 792, 215.9, 279.4, 8.5 , 11 , "Letter"},
{QPageSize::Legal , DMPAPER_LEGAL , QPageSize::Inch , 612, 1008, 215.9, 355.6, 8.5 , 14 , "Legal"},
{QPageSize::Executive , DMPAPER_NONE , QPageSize::Inch , 540, 720, 190.5, 254 , 7.5 , 10 , "Executive.7.5x10in"}, // Qt size differs from Postscript / Windows
@@ -252,21 +220,24 @@ static const StandardPageSize qt_pageSizes[] = {
{QPageSize::A1 , DMPAPER_NONE , QPageSize::Millimeter, 1684, 2384, 594 , 841 , 23.39, 33.11, "A1"},
{QPageSize::A2 , DMPAPER_A2 , QPageSize::Millimeter, 1191, 1684, 420 , 594 , 16.54, 23.39, "A2"},
{QPageSize::A3 , DMPAPER_A3 , QPageSize::Millimeter, 842, 1191, 297 , 420 , 11.69, 16.54, "A3"},
+ {QPageSize::A4 , DMPAPER_A4 , QPageSize::Millimeter, 595, 842, 210 , 297 , 8.27, 11.69, "A4"},
{QPageSize::A5 , DMPAPER_A5 , QPageSize::Millimeter, 420, 595, 148 , 210 , 5.83, 8.27, "A5"},
{QPageSize::A6 , DMPAPER_A6 , QPageSize::Millimeter, 297, 420, 105 , 148 , 4.13, 5.83, "A6"},
{QPageSize::A7 , DMPAPER_NONE , QPageSize::Millimeter, 210, 297, 74 , 105 , 2.91, 4.13, "A7"},
{QPageSize::A8 , DMPAPER_NONE , QPageSize::Millimeter, 148, 210, 52 , 74 , 2.05, 2.91, "A8"},
{QPageSize::A9 , DMPAPER_NONE , QPageSize::Millimeter, 105, 148, 37 , 52 , 1.46, 2.05, "A9"},
+ {QPageSize::A10 , DMPAPER_NONE , QPageSize::Millimeter, 73, 105, 26 , 37 , 1.02, 1.46, "A10"},
{QPageSize::B0 , DMPAPER_NONE , QPageSize::Millimeter, 2835, 4008, 1000 , 1414 , 39.37, 55.67, "ISOB0"},
{QPageSize::B1 , DMPAPER_NONE , QPageSize::Millimeter, 2004, 2835, 707 , 1000 , 27.83, 39.37, "ISOB1"},
- {QPageSize::B10 , DMPAPER_NONE , QPageSize::Millimeter, 88, 125, 31 , 44 , 1.22, 1.73, "ISOB10"},
{QPageSize::B2 , DMPAPER_NONE , QPageSize::Millimeter, 1417, 2004, 500 , 707 , 19.68, 27.83, "ISOB2"},
{QPageSize::B3 , DMPAPER_NONE , QPageSize::Millimeter, 1001, 1417, 353 , 500 , 13.9 , 19.68, "ISOB3"},
{QPageSize::B4 , DMPAPER_ISO_B4 , QPageSize::Millimeter, 709, 1001, 250 , 353 , 9.84, 13.9 , "ISOB4"},
+ {QPageSize::B5 , DMPAPER_NONE , QPageSize::Millimeter, 499, 709, 176 , 250 , 6.9 , 9.8 , "ISOB5"},
{QPageSize::B6 , DMPAPER_NONE , QPageSize::Millimeter, 354, 499, 125 , 176 , 4.92, 6.93, "ISOB6"},
{QPageSize::B7 , DMPAPER_NONE , QPageSize::Millimeter, 249, 354, 88 , 125 , 3.46, 4.92, "ISOB7"},
{QPageSize::B8 , DMPAPER_NONE , QPageSize::Millimeter, 176, 249, 62 , 88 , 2.44, 3.46, "ISOB8"},
{QPageSize::B9 , DMPAPER_NONE , QPageSize::Millimeter, 125, 176, 44 , 62 , 1.73, 2.44, "ISOB9"},
+ {QPageSize::B10 , DMPAPER_NONE , QPageSize::Millimeter, 88, 125, 31 , 44 , 1.22, 1.73, "ISOB10"},
{QPageSize::C5E , DMPAPER_ENV_C5 , QPageSize::Millimeter, 459, 649, 162 , 229 , 6.38, 9.02, "EnvC5"},
{QPageSize::Comm10E , DMPAPER_ENV_10 , QPageSize::Inch , 297, 684, 104.8, 241.3, 4.12, 9.5 , "Env10"},
{QPageSize::DLE , DMPAPER_ENV_DL , QPageSize::Millimeter, 312, 624, 110 , 220 , 4.33, 8.66, "EnvDL"},
@@ -276,7 +247,6 @@ static const StandardPageSize qt_pageSizes[] = {
{QPageSize::Custom , DMPAPER_USER , QPageSize::Millimeter, -1, -1, -1. , -1 , -1 , -1 , "Custom"}, // Special case to keep in sync with QPageSize::PageSizeId
// ISO Standard Sizes
- {QPageSize::A10 , DMPAPER_NONE , QPageSize::Millimeter, 73, 105, 26 , 37 , 1.02, 1.46, "A10"},
{QPageSize::A3Extra , DMPAPER_A3_EXTRA , QPageSize::Millimeter, 913, 1262, 322 , 445 , 12.67, 17.52, "A3Extra"},
{QPageSize::A4Extra , DMPAPER_A4_EXTRA , QPageSize::Millimeter, 667, 914, 235.5, 322.3, 9.27, 12.69, "A4Extra"},
{QPageSize::A4Plus , DMPAPER_A4_PLUS , QPageSize::Millimeter, 595, 936, 210 , 330 , 8.27, 13 , "A4Plus"},
@@ -385,7 +355,8 @@ static const StandardPageSize qt_pageSizes[] = {
};
static const int pageSizesCount = int(sizeof(qt_pageSizes) / sizeof(qt_pageSizes[0]));
-Q_STATIC_ASSERT(pageSizesCount == QPageSize::LastPageSize + 1);
+static_assert(pageSizesCount == QPageSize::LastPageSize + 1);
+static_assert(QPageSize::LastPageSize < 256);
// Return key name for PageSize
static QString qt_keyForPageSizeId(QPageSize::PageSizeId id)
@@ -398,14 +369,14 @@ static QPageSize::PageSizeId qt_idForPpdKey(const QString &ppdKey, QSize *match
{
if (ppdKey.isEmpty())
return QPageSize::Custom;
- QStringRef key(&ppdKey);
+ QStringView key(ppdKey);
// Remove any Rotated or Tranverse modifiers
- if (key.endsWith(QLatin1String("Rotated")))
+ if (key.endsWith("Rotated"_L1))
key.chop(7);
- else if (key.endsWith(QLatin1String(".Transverse")))
+ else if (key.endsWith(".Transverse"_L1))
key.chop(11);
for (int i = 0; i <= int(QPageSize::LastPageSize); ++i) {
- if (QLatin1String(qt_pageSizes[i].mediaOption) == key) {
+ if (QLatin1StringView(qt_pageSizes[i].mediaOption) == key) {
if (match)
*match = QSize(qt_pageSizes[i].widthPoints, qt_pageSizes[i].heightPoints);
return qt_pageSizes[i].id;
@@ -572,7 +543,7 @@ static QSize qt_convertPointsToPixels(const QSize &size, int resolution)
if (!size.isValid() || resolution <= 0)
return QSize();
const qreal multiplier = qt_pixelMultiplier(resolution);
- return QSize(qRound(size.width() / multiplier), qRound(size.height() / multiplier));
+ return QSize(qFloor(size.width() / multiplier), qFloor(size.height() / multiplier));
}
static QSizeF qt_convertPointsToUnits(const QSize &size, QPageSize::Unit units)
@@ -898,7 +869,7 @@ QSizeF QPageSizePrivate::size(QPageSize::Unit units) const
QSize QPageSizePrivate::sizePixels(int resolution) const
{
- return qt_convertPointsToPixels(m_pointSize, resolution);;
+ return qt_convertPointsToPixels(m_pointSize, resolution);
}
@@ -1079,8 +1050,6 @@ QSize QPageSizePrivate::sizePixels(int resolution) const
\value EnvelopePrc10
\value EnvelopeYou4
\value LastPageSize = EnvelopeYou4
- \omitvalue NPageSize
- \omitvalue NPaperSize
Due to historic reasons QPageSize::Executive is not the same as the standard
Postscript and Windows Executive size, use QPageSize::ExecutiveStandard instead.
@@ -1251,20 +1220,15 @@ QPageSize &QPageSize::operator=(const QPageSize &other)
*/
/*!
- \relates QPageSize
+ \fn bool QPageSize::operator==(const QPageSize &lhs, const QPageSize &rhs)
Returns \c true if page size \a lhs is equal to page size \a rhs,
i.e. if the page sizes have the same attributes. Current
attributes are size and name.
*/
-bool operator==(const QPageSize &lhs, const QPageSize &rhs)
-{
- return lhs.d == rhs.d || *lhs.d == *rhs.d;
-}
/*!
- \fn bool operator!=(const QPageSize &lhs, const QPageSize &rhs)
- \relates QPageSize
+ \fn bool QPageSize::operator!=(const QPageSize &lhs, const QPageSize &rhs)
Returns \c true if page size \a lhs is unequal to page size \a
rhs, i.e. if the page size has different attributes. Current
@@ -1272,6 +1236,15 @@ bool operator==(const QPageSize &lhs, const QPageSize &rhs)
*/
/*!
+ \internal
+*/
+bool QPageSize::equals(const QPageSize &other) const
+{
+ return d == other.d || *d == *other.d;
+}
+
+
+/*!
Returns \c true if this page is equivalent to the \a other page, i.e. if the
page has the same size regardless of other attributes like name.
*/
diff --git a/src/gui/painting/qpagesize.h b/src/gui/painting/qpagesize.h
index 133274760f..221863aad7 100644
--- a/src/gui/painting/qpagesize.h
+++ b/src/gui/painting/qpagesize.h
@@ -1,41 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2014 John Layt <jlayt@kde.org>
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the QtGui module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2014 John Layt <jlayt@kde.org>
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#ifndef QPAGESIZE_H
#define QPAGESIZE_H
@@ -58,12 +22,8 @@ class Q_GUI_EXPORT QPageSize
{
public:
- // ### Qt6 Re-order and remove duplicates
- // NOTE: Must keep in sync with QPagedPrintEngine and QPrinter
enum PageSizeId {
- // Existing Qt sizes
- A4,
- B5,
+ // Old Qt sizes
Letter,
Legal,
Executive,
@@ -71,21 +31,24 @@ public:
A1,
A2,
A3,
+ A4,
A5,
A6,
A7,
A8,
A9,
+ A10,
B0,
B1,
- B10,
B2,
B3,
B4,
+ B5,
B6,
B7,
B8,
B9,
+ B10,
C5E,
Comm10E,
DLE,
@@ -95,7 +58,6 @@ public:
Custom,
// New values derived from PPD standard
- A10,
A3Extra,
A4Extra,
A4Plus,
@@ -198,10 +160,8 @@ public:
EnvelopePrc10,
EnvelopeYou4,
- // Last item, with commonly used synynoms from QPagedPrintEngine / QPrinter
+ // Last item
LastPageSize = EnvelopeYou4,
- NPageSize = LastPageSize,
- NPaperSize = LastPageSize,
// Convenience overloads for naming consistency
AnsiA = Letter,
@@ -228,7 +188,7 @@ public:
};
QPageSize();
- explicit QPageSize(PageSizeId pageSizeId);
+ Q_IMPLICIT QPageSize(PageSizeId pageSizeId);
explicit QPageSize(const QSize &pointSize,
const QString &name = QString(),
SizeMatchPolicy matchPolicy = FuzzyMatch);
@@ -236,14 +196,16 @@ public:
const QString &name = QString(),
SizeMatchPolicy matchPolicy = FuzzyMatch);
QPageSize(const QPageSize &other);
- QPageSize &operator=(QPageSize &&other) noexcept { swap(other); return *this; }
+ QT_MOVE_ASSIGNMENT_OPERATOR_IMPL_VIA_PURE_SWAP(QPageSize)
QPageSize &operator=(const QPageSize &other);
~QPageSize();
- void swap(QPageSize &other) noexcept { qSwap(d, other.d); }
+ void swap(QPageSize &other) noexcept { d.swap(other.d); }
+#if QT_GUI_REMOVED_SINCE(6, 4)
friend Q_GUI_EXPORT bool operator==(const QPageSize &lhs, const QPageSize &rhs);
+#endif
bool isEquivalentTo(const QPageSize &other) const;
bool isValid() const;
@@ -287,6 +249,13 @@ public:
private:
friend class QPageSizePrivate;
friend class QPlatformPrintDevice;
+
+ bool equals(const QPageSize &other) const;
+ friend inline bool operator==(const QPageSize &lhs, const QPageSize &rhs)
+ { return lhs.equals(rhs); }
+ friend inline bool operator!=(const QPageSize &lhs, const QPageSize &rhs)
+ { return !(lhs == rhs); }
+
QPageSize(const QString &key, const QSize &pointSize, const QString &name);
QPageSize(int windowsId, const QSize &pointSize, const QString &name);
QPageSize(QPageSizePrivate &dd);
@@ -295,18 +264,14 @@ private:
Q_DECLARE_SHARED(QPageSize)
-Q_GUI_EXPORT bool operator==(const QPageSize &lhs, const QPageSize &rhs);
-inline bool operator!=(const QPageSize &lhs, const QPageSize &rhs)
-{ return !operator==(lhs, rhs); }
-
#ifndef QT_NO_DEBUG_STREAM
Q_GUI_EXPORT QDebug operator<<(QDebug dbg, const QPageSize &pageSize);
#endif
QT_END_NAMESPACE
-Q_DECLARE_METATYPE(QPageSize)
-Q_DECLARE_METATYPE(QPageSize::PageSizeId)
-Q_DECLARE_METATYPE(QPageSize::Unit)
+QT_DECL_METATYPE_EXTERN(QPageSize, Q_GUI_EXPORT)
+QT_DECL_METATYPE_EXTERN_TAGGED(QPageSize::PageSizeId, QPageSize__PageSizeId, Q_GUI_EXPORT)
+QT_DECL_METATYPE_EXTERN_TAGGED(QPageSize::Unit, QPageSize__Unit, Q_GUI_EXPORT)
#endif // QPAGESIZE_H
diff --git a/src/gui/painting/qpaintdevice.cpp b/src/gui/painting/qpaintdevice.cpp
index 4afb89b52e..14e2d7cd8e 100644
--- a/src/gui/painting/qpaintdevice.cpp
+++ b/src/gui/painting/qpaintdevice.cpp
@@ -1,41 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the QtGui module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#include "qpaintdevice.h"
@@ -43,7 +7,6 @@ QT_BEGIN_NAMESPACE
QPaintDevice::QPaintDevice() noexcept
{
- reserved = nullptr;
painters = 0;
}
diff --git a/src/gui/painting/qpaintdevice.h b/src/gui/painting/qpaintdevice.h
index 5f8dad205d..ceccac5e7e 100644
--- a/src/gui/painting/qpaintdevice.h
+++ b/src/gui/painting/qpaintdevice.h
@@ -1,41 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the QtGui module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#ifndef QPAINTDEVICE_H
#define QPAINTDEVICE_H
@@ -49,7 +13,6 @@ QT_BEGIN_NAMESPACE
class QPaintEngine;
-class QPaintDevicePrivate;
class Q_GUI_EXPORT QPaintDevice // device for QPainter
{
@@ -83,8 +46,8 @@ public:
int logicalDpiY() const { return metric(PdmDpiY); }
int physicalDpiX() const { return metric(PdmPhysicalDpiX); }
int physicalDpiY() const { return metric(PdmPhysicalDpiY); }
- int devicePixelRatio() const { return metric(PdmDevicePixelRatio); }
- qreal devicePixelRatioF() const { return metric(PdmDevicePixelRatioScaled) / devicePixelRatioFScale(); }
+ qreal devicePixelRatio() const { return metric(PdmDevicePixelRatioScaled) / devicePixelRatioFScale(); }
+ qreal devicePixelRatioF() const { return devicePixelRatio(); }
int colorCount() const { return metric(PdmNumColors); }
int depth() const { return metric(PdmDepth); }
@@ -100,8 +63,6 @@ protected:
private:
Q_DISABLE_COPY(QPaintDevice)
- QPaintDevicePrivate *reserved;
-
friend class QPainter;
friend class QPainterPrivate;
friend class QFontEngineMac;
diff --git a/src/gui/painting/qpaintdevice.qdoc b/src/gui/painting/qpaintdevice.qdoc
index 0cba864523..d63fdcb92b 100644
--- a/src/gui/painting/qpaintdevice.qdoc
+++ b/src/gui/painting/qpaintdevice.qdoc
@@ -1,29 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the documentation of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:FDL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Free Documentation License Usage
-** Alternatively, this file may be used under the terms of the GNU Free
-** Documentation License version 1.3 as published by the Free Software
-** Foundation and appearing in the file included in the packaging of
-** this file. Please review the following information to ensure
-** the GNU Free Documentation License version 1.3 requirements
-** will be met: https://www.gnu.org/licenses/fdl-1.3.html.
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GFDL-1.3-no-invariants-only
/*!
\class QPaintDevice
@@ -39,8 +15,7 @@
right and Y increases downwards. The unit is one pixel.
The drawing capabilities of QPaintDevice are currently implemented
- by the QWidget, QImage, QPixmap, QGLPixelBuffer, QPicture, and
- QPrinter subclasses.
+ by the QWidget, QImage, QPixmap, QPicture, and QPrinter subclasses.
To implement support for a new backend, you must derive from
QPaintDevice and reimplement the virtual paintEngine() function to
@@ -124,7 +99,7 @@
The constant scaling factor used is devicePixelRatioFScale(). This enum value
has been introduced in Qt 5.6.
- \sa metric(), devicePixelRatioF()
+ \sa metric(), devicePixelRatio()
*/
/*!
@@ -285,7 +260,7 @@
*/
/*!
- \fn int QPaintDevice::devicePixelRatio() const
+ \fn qreal QPaintDevice::devicePixelRatio() const
Returns the device pixel ratio for device.
diff --git a/src/gui/painting/qpaintengine.cpp b/src/gui/painting/qpaintengine.cpp
index 1785fcd12d..aface3744d 100644
--- a/src/gui/painting/qpaintengine.cpp
+++ b/src/gui/painting/qpaintengine.cpp
@@ -1,41 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the QtGui module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#include "qpaintengine.h"
#include "qpaintengine_p.h"
#include "qpainter_p.h"
@@ -44,11 +8,15 @@
#include <qdebug.h>
#include <qmath.h>
#include <qguiapplication.h>
-#include <private/qtextengine_p.h>
#include <qvarlengtharray.h>
+#include <qpa/qplatformintegration.h>
+#include <qpa/qplatformpixmap.h>
#include <private/qfontengine_p.h>
+#include <private/qguiapplication_p.h>
#include <private/qpaintengineex_p.h>
+#include <private/qtextengine_p.h>
+#include <memory>
QT_BEGIN_NAMESPACE
@@ -158,7 +126,7 @@ QFont QTextItem::font() const
X11 and \macos, it is the backend for painting on QImage and it is
used as a fallback for paint engines that do not support a certain
capability. In addition we provide QPaintEngine implementations for
- OpenGL (accessible through QGLWidget) and printing (which allows using
+ OpenGL (accessible through QOpenGLWidget) and printing (which allows using
QPainter to draw on a QPrinter object).
If one wants to use QPainter to draw to a different backend,
@@ -182,7 +150,7 @@ QFont QTextItem::font() const
emulated results. Some features cannot be emulated: AlphaBlend and PorterDuff.
\value AlphaBlend The engine can alpha blend primitives.
- \value Antialiasing The engine can use antialising to improve the appearance
+ \value Antialiasing The engine can use antialiasing to improve the appearance
of rendered primitives.
\value BlendModes The engine supports blending modes.
\value BrushStroke The engine supports drawing strokes that
@@ -375,7 +343,6 @@ void QPaintEngine::drawPolygon(const QPoint *points, int pointCount, PolygonDraw
\value CoreGraphics \macos's Quartz2D (CoreGraphics)
\value QuickDraw \macos's QuickDraw
\value QWindowSystem Qt for Embedded Linux
- \value PostScript (No longer supported)
\value OpenGL
\value Picture QPicture format
\value SVG Scalable Vector Graphics XML format
@@ -447,7 +414,7 @@ void QPaintEngine::drawPoints(const QPointF *points, int pointCount)
p->save();
QTransform transform;
- if (qt_pen_is_cosmetic(p->pen(), p->renderHints())) {
+ if (p->pen().isCosmetic()) {
transform = p->transform();
p->setTransform(QTransform());
}
@@ -514,6 +481,8 @@ void QPaintEngine::drawEllipse(const QRectF &rect)
}
/*!
+ \overload
+
The default implementation of this function calls the floating
point version of this function
*/
@@ -764,7 +733,7 @@ void QPaintEngine::drawTextItem(const QPointF &p, const QTextItem &textItem)
bool((painter()->renderHints() & QPainter::TextAntialiasing)
&& !(painter()->font().styleStrategy() & QFont::NoAntialias)));
for (int i = 0; i < ti.glyphs.numGlyphs; ++i) {
- QImage glyph = ti.fontEngine->bitmapForGlyph(glyphs[i], QFixed(), QTransform());
+ QImage glyph = ti.fontEngine->bitmapForGlyph(glyphs[i], QFixedPoint(), QTransform());
painter()->drawImage(positions[i].x.toReal(), positions[i].y.toReal(), glyph);
}
painter()->restore();
@@ -995,6 +964,43 @@ QRect QPaintEngine::systemRect() const
return d_func()->systemRect;
}
+/*!
+ \internal
+
+ Creates a QPixmap optimized for this paint engine and device.
+*/
+QPixmap QPaintEngine::createPixmap(QSize size)
+{
+ if (Q_UNLIKELY(!qobject_cast<QGuiApplication *>(QCoreApplication::instance()))) {
+ qWarning("QPaintEngine::createPixmap: QPixmap cannot be created without a QGuiApplication");
+ return QPixmap();
+ }
+
+ std::unique_ptr<QPlatformPixmap> data(QGuiApplicationPrivate::platformIntegration()->createPlatformPixmap(QPlatformPixmap::PixmapType));
+ data->resize(size.width(), size.height());
+ return QPixmap(data.release());
+}
+
+/*!
+ \internal
+
+ Creates a QPixmap optimized for this paint engine and device.
+*/
+QPixmap QPaintEngine::createPixmapFromImage(QImage image, Qt::ImageConversionFlags flags)
+{
+ if (Q_UNLIKELY(!qobject_cast<QGuiApplication *>(QCoreApplication::instance()))) {
+ qWarning("QPaintEngine::createPixmapFromImage: QPixmap cannot be created without a QGuiApplication");
+ return QPixmap();
+ }
+
+ std::unique_ptr<QPlatformPixmap> data(QGuiApplicationPrivate::platformIntegration()->createPlatformPixmap(QPlatformPixmap::PixmapType));
+ if (image.isDetached())
+ data->fromImageInPlace(image, flags);
+ else
+ data->fromImage(image, flags);
+ return QPixmap(data.release());
+}
+
QPaintEnginePrivate::~QPaintEnginePrivate()
{
}
diff --git a/src/gui/painting/qpaintengine.h b/src/gui/painting/qpaintengine.h
index 9fb67e253e..f624dda5c7 100644
--- a/src/gui/painting/qpaintengine.h
+++ b/src/gui/painting/qpaintengine.h
@@ -1,41 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the QtGui module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#ifndef QPAINTENGINE_H
#define QPAINTENGINE_H
@@ -195,7 +159,6 @@ public:
Windows,
QuickDraw, CoreGraphics, MacPrinter,
QWindowSystem,
- PostScript, // ### Qt 6: Remove, update documentation
OpenGL,
Picture,
SVG,
@@ -219,13 +182,16 @@ public:
inline void setDirty(DirtyFlags df);
inline void clearDirty(DirtyFlags df);
- bool hasFeature(PaintEngineFeatures feature) const { return gccaps & feature; }
+ bool hasFeature(PaintEngineFeatures feature) const { return bool(gccaps & feature); }
QPainter *painter() const;
void syncState();
inline bool isExtended() const { return extended; }
+ virtual QPixmap createPixmap(QSize size);
+ virtual QPixmap createPixmapFromImage(QImage image, Qt::ImageConversionFlags flags = Qt::AutoColor);
+
protected:
QPaintEngine(QPaintEnginePrivate &data, PaintEngineFeatures devcaps=PaintEngineFeatures());
@@ -273,7 +239,6 @@ public:
QBrush backgroundBrush() const;
Qt::BGMode backgroundMode() const;
QFont font() const;
- QMatrix matrix() const;
QTransform transform() const;
Qt::ClipOperation clipOperation() const;
@@ -319,7 +284,7 @@ inline void QPaintEngine::fix_neg_rect(int *x, int *y, int *w, int *h)
inline bool QPaintEngine::testDirty(DirtyFlags df) {
Q_ASSERT(state);
- return state->dirtyFlags & df;
+ return bool(state->dirtyFlags & df);
}
inline void QPaintEngine::setDirty(DirtyFlags df) {
@@ -330,7 +295,7 @@ inline void QPaintEngine::setDirty(DirtyFlags df) {
inline void QPaintEngine::clearDirty(DirtyFlags df)
{
Q_ASSERT(state);
- state->dirtyFlags &= ~static_cast<uint>(df);
+ state->dirtyFlags &= ~df;
}
Q_DECLARE_OPERATORS_FOR_FLAGS(QTextItem::RenderFlags)
diff --git a/src/gui/painting/qpaintengine_blitter.cpp b/src/gui/painting/qpaintengine_blitter.cpp
index a50d1dfd73..4e6931de09 100644
--- a/src/gui/painting/qpaintengine_blitter.cpp
+++ b/src/gui/painting/qpaintengine_blitter.cpp
@@ -1,41 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the QtGui module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#include "private/qpaintengine_blitter_p.h"
diff --git a/src/gui/painting/qpaintengine_blitter_p.h b/src/gui/painting/qpaintengine_blitter_p.h
index fb5dfe2318..0eb8703b08 100644
--- a/src/gui/painting/qpaintengine_blitter_p.h
+++ b/src/gui/painting/qpaintengine_blitter_p.h
@@ -1,41 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the QtGui module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#ifndef QPAINTENGINE_BLITTER_P_H
#define QPAINTENGINE_BLITTER_P_H
diff --git a/src/gui/painting/qpaintengine_p.h b/src/gui/painting/qpaintengine_p.h
index 40b9474165..210e577950 100644
--- a/src/gui/painting/qpaintengine_p.h
+++ b/src/gui/painting/qpaintengine_p.h
@@ -1,41 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the QtGui module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#ifndef QPAINTENGINE_P_H
#define QPAINTENGINE_P_H
diff --git a/src/gui/painting/qpaintengine_raster.cpp b/src/gui/painting/qpaintengine_raster.cpp
index bc65ed56e3..f62373d4ef 100644
--- a/src/gui/painting/qpaintengine_raster.cpp
+++ b/src/gui/painting/qpaintengine_raster.cpp
@@ -1,41 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the QtGui module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2021 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#include <QtCore/qglobal.h>
#include <QtCore/qmutex.h>
@@ -49,7 +13,7 @@
#include <qpainterpath.h>
#include <qdebug.h>
#include <qbitmap.h>
-#include <qmath.h>
+#include "qmath_p.h"
#include <qrandom.h>
// #include <private/qdatabuffer_p.h>
@@ -57,13 +21,14 @@
#include <private/qtextengine_p.h>
#include <private/qfontengine_p.h>
#include <private/qpixmap_raster_p.h>
-// #include <private/qpolygonclipper_p.h>
// #include <private/qrasterizer_p.h>
#include <private/qimage_p.h>
#include <private/qstatictext_p.h>
#include <private/qcosmeticstroker_p.h>
-#include "qmemrotate_p.h"
-#include "qrgba64_p.h"
+#include <private/qdrawhelper_p.h>
+#include <private/qmemrotate_p.h>
+#include <private/qpixellayout_p.h>
+#include <private/qrgba64_p.h>
#include "qpaintengine_raster_p.h"
// #include "qbezier_p.h"
@@ -133,7 +98,6 @@ public:
Q_GUI_EXPORT extern bool qt_scaleForTransform(const QTransform &transform, qreal *scale); // qtransform.cpp
-#define qreal_to_fixed_26_6(f) (int(f * 64))
#define qt_swap_int(x, y) { int tmp = (x); (x) = (y); (y) = tmp; }
#define qt_swap_qreal(x, y) { qreal tmp = (x); (x) = (y); (y) = tmp; }
@@ -150,15 +114,10 @@ void dumpClip(int width, int height, const QClipData *clip);
// 4 pixels.
#define int_dim(pos, dim) (int(pos+dim) - int(pos))
-static const qreal aliasedCoordinateDelta = 0.5 - 0.015625;
-
#ifdef Q_OS_WIN
static inline bool winClearTypeFontsEnabled()
{
-#ifdef Q_OS_WINRT
- return false;
-#else // Q_OS_WINRT
UINT result = 0;
#if !defined(SPI_GETFONTSMOOTHINGTYPE) // MinGW
# define SPI_GETFONTSMOOTHINGTYPE 0x200A
@@ -166,7 +125,6 @@ static inline bool winClearTypeFontsEnabled()
#endif
SystemParametersInfo(SPI_GETFONTSMOOTHINGTYPE, 0, &result, 0);
return result == FE_FONTSMOOTHINGCLEARTYPE;
-#endif // !Q_OS_WINRT
}
/*!
@@ -185,9 +143,9 @@ bool QRasterPaintEngine::clearTypeFontsEnabled()
/********************************************************************************
* Span functions
*/
-static void qt_span_fill_clipRect(int count, const QSpan *spans, void *userData);
-static void qt_span_fill_clipped(int count, const QSpan *spans, void *userData);
-static void qt_span_clip(int count, const QSpan *spans, void *userData);
+static void qt_span_fill_clipRect(int count, const QT_FT_Span *spans, void *userData);
+static void qt_span_fill_clipped(int count, const QT_FT_Span *spans, void *userData);
+static void qt_span_clip(int count, const QT_FT_Span *spans, void *userData);
struct ClipData
{
@@ -273,35 +231,6 @@ static void qt_debug_path(const QPainterPath &path)
}
#endif
-// QRect::normalized() will change the width/height of the rectangle due to
-// its incusive-integer definition of left/right vs width. This is not
-// something we want to change in QRect as that would potentially introduce
-// regressions all over the place, so we implement a straightforward
-// normalized here. QRectF already does this, so QRectF::normalized() is ok to
-// use.
-static QRect qrect_normalized(const QRect &rect)
-{
- int x, y, w, h;
- if (Q_UNLIKELY(rect.width() < 0)) {
- x = rect.x() + rect.width();
- w = -rect.width();
- } else {
- x = rect.x();
- w = rect.width();
- }
-
- if (Q_UNLIKELY(rect.height() < 0)) {
- y = rect.y() + rect.height();
- h = -rect.height();
- } else {
- y = rect.y();
- h = rect.height();
- }
-
- return QRect(x, y, w, h);
-}
-
-
QRasterPaintEnginePrivate::QRasterPaintEnginePrivate() :
QPaintEngineExPrivate(),
cachedLines(0)
@@ -311,8 +240,7 @@ QRasterPaintEnginePrivate::QRasterPaintEnginePrivate() :
/*!
\class QRasterPaintEngine
- \preliminary
- \ingroup qws
+ \internal
\inmodule QtGui
\since 4.2
@@ -341,21 +269,12 @@ QRasterPaintEnginePrivate::QRasterPaintEnginePrivate() :
\sa QPaintEngine
*/
-/*!
- \fn Type QRasterPaintEngine::type() const
+/*
+ \fn QPaintEngine::Type QRasterPaintEngine::type() const
\reimp
*/
/*!
- \typedef QSpan
- \relates QRasterPaintEngine
-
- A struct equivalent to QT_FT_Span, containing a position (x,
- y), the span's length in pixels and its color/coverage (a value
- ranging from 0 to 255).
-*/
-
-/*!
\since 4.5
Creates a raster based paint engine for operating on the given
@@ -486,22 +405,16 @@ bool QRasterPaintEngine::begin(QPaintDevice *device)
QRasterPaintEngineState *s = state();
ensureOutlineMapper();
- d->outlineMapper->m_clip_rect = d->deviceRect;
-
- if (d->outlineMapper->m_clip_rect.width() > QT_RASTER_COORD_LIMIT)
- d->outlineMapper->m_clip_rect.setWidth(QT_RASTER_COORD_LIMIT);
- if (d->outlineMapper->m_clip_rect.height() > QT_RASTER_COORD_LIMIT)
- d->outlineMapper->m_clip_rect.setHeight(QT_RASTER_COORD_LIMIT);
-
+ d->outlineMapper->setClipRect(d->deviceRect);
d->rasterizer->setClipRect(d->deviceRect);
s->penData.init(d->rasterBuffer.data(), this);
- s->penData.setup(s->pen.brush(), s->intOpacity, s->composition_mode);
+ s->penData.setup(s->pen.brush(), s->intOpacity, s->composition_mode, s->flags.cosmetic_brush);
s->stroker = &d->basicStroker;
d->basicStroker.setClipRect(d->deviceRect);
s->brushData.init(d->rasterBuffer.data(), this);
- s->brushData.setup(s->brush, s->intOpacity, s->composition_mode);
+ s->brushData.setup(s->brush, s->intOpacity, s->composition_mode, s->flags.cosmetic_brush);
d->rasterBuffer->compositionMode = QPainter::CompositionMode_SourceOver;
@@ -560,31 +473,6 @@ void QRasterPaintEngine::updateMatrix(const QTransform &matrix)
QRasterPaintEngineState *s = state();
// FALCON: get rid of this line, see drawImage call below.
s->matrix = matrix;
- QTransform::TransformationType txop = s->matrix.type();
-
- switch (txop) {
-
- case QTransform::TxNone:
- s->flags.int_xform = true;
- break;
-
- case QTransform::TxTranslate:
- s->flags.int_xform = qreal(int(s->matrix.dx())) == s->matrix.dx()
- && qreal(int(s->matrix.dy())) == s->matrix.dy();
- break;
-
- case QTransform::TxScale:
- s->flags.int_xform = qreal(int(s->matrix.dx())) == s->matrix.dx()
- && qreal(int(s->matrix.dy())) == s->matrix.dy()
- && qreal(int(s->matrix.m11())) == s->matrix.m11()
- && qreal(int(s->matrix.m22())) == s->matrix.m22();
- break;
-
- default: // shear / perspective...
- s->flags.int_xform = false;
- break;
- }
-
s->flags.tx_noshear = qt_scaleForTransform(s->matrix, &s->txscale);
ensureOutlineMapper();
@@ -611,15 +499,15 @@ QRasterPaintEngineState::QRasterPaintEngineState()
txscale = 1.;
+ flag_bits = 0;
flags.fast_pen = true;
flags.non_complex_pen = false;
flags.antialiased = false;
flags.bilinear = false;
- flags.legacy_rounding = false;
flags.fast_text = true;
- flags.int_xform = true;
flags.tx_noshear = true;
flags.fast_images = true;
+ flags.cosmetic_brush = true;
clip = nullptr;
flags.has_clip_ownership = false;
@@ -718,7 +606,8 @@ void QRasterPaintEngine::updatePen(const QPen &pen)
s->strokeFlags = 0;
s->penData.clip = d->clip();
- s->penData.setup(pen_style == Qt::NoPen ? QBrush() : pen.brush(), s->intOpacity, s->composition_mode);
+ s->penData.setup(pen_style == Qt::NoPen ? QBrush() : pen.brush(), s->intOpacity,
+ s->composition_mode, s->flags.cosmetic_brush);
if (s->strokeFlags & QRasterPaintEngine::DirtyTransform
|| pen.brush().transform().type() >= QTransform::TxNone) {
@@ -743,12 +632,12 @@ void QRasterPaintEngine::updatePen(const QPen &pen)
else
d->basicStroker.setStrokeWidth(penWidth);
- if(pen_style == Qt::SolidLine) {
+ if (pen_style == Qt::SolidLine) {
s->stroker = &d->basicStroker;
} else if (pen_style != Qt::NoPen) {
if (!d->dashStroker)
d->dashStroker.reset(new QDashStroker(&d->basicStroker));
- if (qt_pen_is_cosmetic(pen, s->renderHints)) {
+ if (pen.isCosmetic()) {
d->dashStroker->setClipRect(d->deviceRect);
} else {
// ### I've seen this inverted devrect multiple places now...
@@ -763,7 +652,7 @@ void QRasterPaintEngine::updatePen(const QPen &pen)
}
ensureRasterState(); // needed because of tx_noshear...
- bool cosmetic = qt_pen_is_cosmetic(pen, s->renderHints);
+ bool cosmetic = pen.isCosmetic();
s->flags.fast_pen = pen_style > Qt::NoPen
&& s->penData.blend
&& ((cosmetic && penWidth <= 1)
@@ -817,7 +706,7 @@ void QRasterPaintEngine::updateBrush(const QBrush &brush)
QRasterPaintEngineState *s = state();
// must set clip prior to setup, as setup uses it...
s->brushData.clip = d->clip();
- s->brushData.setup(brush, s->intOpacity, s->composition_mode);
+ s->brushData.setup(brush, s->intOpacity, s->composition_mode, s->flags.cosmetic_brush);
if (s->fillFlags & DirtyTransform
|| brush.transform().type() >= QTransform::TxNone)
d_func()->updateMatrixData(&s->brushData, brush, d->brushMatrix());
@@ -844,7 +733,8 @@ void QRasterPaintEngine::updateRasterState()
&& s->intOpacity == 256
&& (mode == QPainter::CompositionMode_SourceOver
|| (mode == QPainter::CompositionMode_Source
- && s->penData.solidColor.isOpaque()));
+ && (s->penData.solidColor.spec() != QColor::ExtendedRgb &&
+ s->penData.solidColor.alphaF() >= 1.0f)));
}
s->dirty = 0;
@@ -903,28 +793,25 @@ void QRasterPaintEngine::renderHintsChanged()
bool was_aa = s->flags.antialiased;
bool was_bilinear = s->flags.bilinear;
+ bool was_cosmetic_brush = s->flags.cosmetic_brush;
s->flags.antialiased = bool(s->renderHints & QPainter::Antialiasing);
-#if QT_DEPRECATED_SINCE(5, 14)
-QT_WARNING_PUSH
-QT_WARNING_DISABLE_DEPRECATED
- if (s->renderHints & QPainter::HighQualityAntialiasing)
- s->flags.antialiased = true;
-QT_WARNING_POP
-#endif
s->flags.bilinear = bool(s->renderHints & QPainter::SmoothPixmapTransform);
- s->flags.legacy_rounding = !bool(s->renderHints & QPainter::Antialiasing) && bool(s->renderHints & QPainter::Qt4CompatiblePainting);
+ s->flags.cosmetic_brush = !bool(s->renderHints & QPainter::NonCosmeticBrushPatterns);
if (was_aa != s->flags.antialiased)
s->strokeFlags |= DirtyHints;
- if (was_bilinear != s->flags.bilinear) {
+ if (was_bilinear != s->flags.bilinear || was_cosmetic_brush != s->flags.cosmetic_brush) {
s->strokeFlags |= DirtyPen;
s->fillFlags |= DirtyBrush;
}
Q_D(QRasterPaintEngine);
d->recalculateFastImages();
+
+ if (was_aa != s->flags.antialiased)
+ d->updateClipping();
}
/*!
@@ -1012,7 +899,7 @@ void QRasterPaintEnginePrivate::drawImage(const QPointF &pt,
if (iw <= 0)
return;
- // adapt the y paremeters...
+ // adapt the y parameters...
int cy1 = clip.y();
int cy2 = clip.y() + clip.height();
int y = qRound(pt.y());
@@ -1082,7 +969,7 @@ void QRasterPaintEnginePrivate::blitImage(const QPointF &pt,
if (iw <= 0)
return;
- // adapt the y paremeters...
+ // adapt the y parameters...
int cy1 = clip.y();
int cy2 = clip.y() + clip.height();
int y = qRound(pt.y());
@@ -1260,7 +1147,7 @@ void QRasterPaintEngine::clip(const QVectorPath &path, Qt::ClipOperation op)
#endif
const qreal *points = path.points();
QRectF r(points[0], points[1], points[4]-points[0], points[5]-points[1]);
- if (setClipRectInDeviceCoords(s->matrix.mapRect(r).toRect(), op))
+ if (setClipRectInDeviceCoords(qt_mapFillRect(r, s->matrix), op))
return;
}
}
@@ -1319,7 +1206,7 @@ void QRasterPaintEngine::clip(const QRect &rect, Qt::ClipOperation op)
QPaintEngineEx::clip(rect, op);
return;
- } else if (!setClipRectInDeviceCoords(s->matrix.mapRect(QRectF(rect)).toRect(), op)) {
+ } else if (!setClipRectInDeviceCoords(qt_mapFillRect(rect, s->matrix), op)) {
QPaintEngineEx::clip(rect, op);
return;
}
@@ -1329,9 +1216,7 @@ void QRasterPaintEngine::clip(const QRect &rect, Qt::ClipOperation op)
bool QRasterPaintEngine::setClipRectInDeviceCoords(const QRect &r, Qt::ClipOperation op)
{
Q_D(QRasterPaintEngine);
- // normalize before using the & operator which uses QRect::normalize()
- // internally which will give us the wrong values.
- QRect clipRect = qrect_normalized(r) & d->deviceRect;
+ QRect clipRect = r & d->deviceRect;
QRasterPaintEngineState *s = state();
if (op == Qt::ReplaceClip || s->clip == nullptr) {
@@ -1514,16 +1399,17 @@ static void fillRect_normalized(const QRect &r, QSpanData *data,
if (data->fillRect && (mode == QPainter::CompositionMode_Source
|| (mode == QPainter::CompositionMode_SourceOver
- && data->solidColor.isOpaque())))
+ && (data->solidColor.spec() != QColor::ExtendedRgb &&
+ data->solidColor.alphaF() >= 1.0f))))
{
- data->fillRect(data->rasterBuffer, x1, y1, width, height, data->solidColor);
+ data->fillRect(data->rasterBuffer, x1, y1, width, height, data->solidColor.rgba64());
return;
}
}
ProcessSpans blend = isUnclipped ? data->unclipped_blend : data->blend;
- const int nspans = 256;
+ const int nspans = 512;
QT_FT_Span spans[nspans];
Q_ASSERT(data->blend);
@@ -1566,7 +1452,7 @@ void QRasterPaintEngine::drawRects(const QRect *rects, int rectCount)
int offset_x = int(s->matrix.dx());
int offset_y = int(s->matrix.dy());
while (r < lastRect) {
- QRect rect = qrect_normalized(*r);
+ QRect rect = r->normalized();
QRect rr = rect.translated(offset_x, offset_y);
fillRect_normalized(rr, &s->brushData, d);
++r;
@@ -1585,7 +1471,6 @@ void QRasterPaintEngine::drawRects(const QRect *rects, int rectCount)
QRectVectorPath path;
if (s->flags.fast_pen) {
QCosmeticStroker stroker(s, d->deviceRect, d->deviceRectUnclipped);
- stroker.setLegacyRoundingEnabled(s->flags.legacy_rounding);
for (int i = 0; i < rectCount; ++i) {
path.set(rects[i]);
stroker.drawPath(path);
@@ -1632,7 +1517,6 @@ void QRasterPaintEngine::drawRects(const QRectF *rects, int rectCount)
QRectVectorPath path;
if (s->flags.fast_pen) {
QCosmeticStroker stroker(s, d->deviceRect, d->deviceRectUnclipped);
- stroker.setLegacyRoundingEnabled(s->flags.legacy_rounding);
for (int i = 0; i < rectCount; ++i) {
path.set(rects[i]);
stroker.drawPath(path);
@@ -1666,23 +1550,23 @@ void QRasterPaintEngine::stroke(const QVectorPath &path, const QPen &pen)
if (s->flags.fast_pen) {
QCosmeticStroker stroker(s, d->deviceRect, d->deviceRectUnclipped);
- stroker.setLegacyRoundingEnabled(s->flags.legacy_rounding);
stroker.drawPath(path);
} else if (s->flags.non_complex_pen && path.shape() == QVectorPath::LinesHint) {
- qreal width = qt_pen_is_cosmetic(s->lastPen, s->renderHints)
+ qreal width = s->lastPen.isCosmetic()
? (qpen_widthf(s->lastPen) == 0 ? 1 : qpen_widthf(s->lastPen))
: qpen_widthf(s->lastPen) * s->txscale;
int dashIndex = 0;
qreal dashOffset = s->lastPen.dashOffset();
bool inDash = true;
qreal patternLength = 0;
- const QVector<qreal> pattern = s->lastPen.dashPattern();
+ const QList<qreal> pattern = s->lastPen.dashPattern();
for (int i = 0; i < pattern.size(); ++i)
patternLength += pattern.at(i);
if (patternLength > 0) {
- int n = qFloor(dashOffset / patternLength);
- dashOffset -= n * patternLength;
+ dashOffset = std::fmod(dashOffset, patternLength);
+ if (dashOffset < 0)
+ dashOffset += patternLength;
while (dashOffset >= pattern.at(dashIndex)) {
dashOffset -= pattern.at(dashIndex);
if (++dashIndex >= pattern.size())
@@ -1697,24 +1581,28 @@ void QRasterPaintEngine::stroke(const QVectorPath &path, const QPen &pen)
const QLineF *lines = reinterpret_cast<const QLineF *>(path.points());
for (int i = 0; i < lineCount; ++i) {
- if (lines[i].p1() == lines[i].p2()) {
+ const QLineF line = s->matrix.map(lines[i]);
+ if (line.p1() == line.p2()) {
if (s->lastPen.capStyle() != Qt::FlatCap) {
QPointF p = lines[i].p1();
- QLineF line = s->matrix.map(QLineF(QPointF(p.x() - width*0.5, p.y()),
+ QLineF mappedline = s->matrix.map(QLineF(QPointF(p.x() - width*0.5, p.y()),
QPointF(p.x() + width*0.5, p.y())));
- d->rasterizer->rasterizeLine(line.p1(), line.p2(), width / line.length());
+ d->rasterizer->rasterizeLine(mappedline.p1(), mappedline.p2(),
+ width / mappedline.length());
}
continue;
}
- const QLineF line = s->matrix.map(lines[i]);
if (qpen_style(s->lastPen) == Qt::SolidLine) {
d->rasterizer->rasterizeLine(line.p1(), line.p2(),
width / line.length(),
s->lastPen.capStyle() == Qt::SquareCap);
} else {
- d->rasterizeLine_dashed(line, width,
- &dashIndex, &dashOffset, &inDash);
+ // LinesHint means each line is distinct, so restart dashing
+ int dIndex = dashIndex;
+ qreal dOffset = dashOffset;
+ bool inD = inDash;
+ d->rasterizeLine_dashed(line, width, &dIndex, &dOffset, &inD);
}
}
}
@@ -1724,14 +1612,10 @@ void QRasterPaintEngine::stroke(const QVectorPath &path, const QPen &pen)
QRect QRasterPaintEngine::toNormalizedFillRect(const QRectF &rect)
{
- QRasterPaintEngineState *s = state();
-
- qreal delta = s->flags.legacy_rounding ? aliasedCoordinateDelta : qreal(0);
-
- int x1 = qRound(rect.x() + delta);
- int y1 = qRound(rect.y() + delta);
- int x2 = qRound(rect.right() + delta);
- int y2 = qRound(rect.bottom() + delta);
+ int x1 = qRound(rect.x());
+ int y1 = qRound(rect.y());
+ int x2 = qRound(rect.right());
+ int y2 = qRound(rect.bottom());
if (x2 < x1)
qSwap(x1, x2);
@@ -1788,9 +1672,9 @@ void QRasterPaintEngine::fill(const QVectorPath &path, const QBrush &brush)
// ### Optimize for non transformed ellipses and rectangles...
QRectF cpRect = path.controlPointRect();
- const QRect pathDeviceRect = s->matrix.mapRect(cpRect).toRect();
+ const QRectF pathDeviceRect = s->matrix.mapRect(cpRect);
// Skip paths that by conservative estimates are completely outside the paint device.
- if (!pathDeviceRect.intersects(d->deviceRect))
+ if (!pathDeviceRect.intersects(QRectF(d->deviceRect)) || !pathDeviceRect.isValid())
return;
ProcessSpans blend = d->getBrushFunc(pathDeviceRect, &s->brushData);
@@ -1867,6 +1751,19 @@ void QRasterPaintEngine::fillRect(const QRectF &r, const QBrush &brush)
fillRect(r, &s->brushData);
}
+static QColor qPremultiplyWithExtraAlpha(const QColor &c, int alpha)
+{
+ if (alpha == 0)
+ return Qt::transparent;
+ if (c.spec() == QColor::ExtendedRgb) {
+ float r, g, b, a;
+ c.getRgbF(&r, &g, &b, &a);
+ a = a * alpha * (1.f / 256.f);
+ return QColor::fromRgbF(r * a, g * a, b * a, a);
+ }
+ return qPremultiply(combineAlpha256(c.rgba64(), alpha));
+}
+
/*!
\reimp
*/
@@ -1878,9 +1775,9 @@ void QRasterPaintEngine::fillRect(const QRectF &r, const QColor &color)
Q_D(QRasterPaintEngine);
QRasterPaintEngineState *s = state();
- d->solid_color_filler.solidColor = qPremultiply(combineAlpha256(color.rgba64(), s->intOpacity));
+ d->solid_color_filler.solidColor = qPremultiplyWithExtraAlpha(color, s->intOpacity);
- if (d->solid_color_filler.solidColor.isTransparent()
+ if (d->solid_color_filler.solidColor.alphaF() <= 0.0f
&& s->composition_mode == QPainter::CompositionMode_SourceOver) {
return;
}
@@ -1894,14 +1791,14 @@ static inline bool isAbove(const QPointF *a, const QPointF *b)
return a->y() < b->y();
}
-static bool splitPolygon(const QPointF *points, int pointCount, QVector<QPointF> *upper, QVector<QPointF> *lower)
+static bool splitPolygon(const QPointF *points, int pointCount, QList<QPointF> *upper, QList<QPointF> *lower)
{
Q_ASSERT(upper);
Q_ASSERT(lower);
Q_ASSERT(pointCount >= 2);
- QVector<const QPointF *> sorted;
+ QList<const QPointF *> sorted;
sorted.reserve(pointCount);
upper->reserve(pointCount * 3 / 4);
@@ -1917,7 +1814,7 @@ static bool splitPolygon(const QPointF *points, int pointCount, QVector<QPointF>
const QPointF *end = points + pointCount;
const QPointF *last = end - 1;
- QVector<QPointF> *bin[2] = { upper, lower };
+ QList<QPointF> *bin[2] = { upper, lower };
for (const QPointF *p = points; p < end; ++p) {
int side = p->y() < splitY;
@@ -1958,7 +1855,7 @@ void QRasterPaintEngine::fillPolygon(const QPointF *points, int pointCount, Poly
// max amount of points that raster engine can reliably handle
if (pointCount > maxPoints) {
- QVector<QPointF> upper, lower;
+ QList<QPointF> upper, lower;
if (splitPolygon(points, pointCount, &upper, &lower)) {
fillPolygon(upper.constData(), upper.size(), mode);
@@ -2014,7 +1911,6 @@ void QRasterPaintEngine::drawPolygon(const QPointF *points, int pointCount, Poly
QVectorPath vp((const qreal *) points, pointCount, nullptr, QVectorPath::polygonFlags(mode));
if (s->flags.fast_pen) {
QCosmeticStroker stroker(s, d->deviceRect, d->deviceRectUnclipped);
- stroker.setLegacyRoundingEnabled(s->flags.legacy_rounding);
stroker.drawPath(vp);
} else {
QPaintEngineEx::stroke(vp, s->lastPen);
@@ -2079,7 +1975,6 @@ void QRasterPaintEngine::drawPolygon(const QPoint *points, int pointCount, Polyg
if (s->flags.fast_pen) {
QCosmeticStroker stroker(s, d->deviceRect, d->deviceRectUnclipped);
- stroker.setLegacyRoundingEnabled(s->flags.legacy_rounding);
stroker.drawPath(vp);
} else {
QPaintEngineEx::stroke(vp, s->lastPen);
@@ -2324,9 +2219,6 @@ void QRasterPaintEngine::drawImage(const QRectF &r, const QImage &img, const QRe
// subtract it here as we don't use it for image drawing
QTransform old = s->matrix;
- if (s->flags.legacy_rounding)
- s->matrix = s->matrix * QTransform::fromTranslate(-aliasedCoordinateDelta, -aliasedCoordinateDelta);
-
// Do whatever fillRect() does, but without premultiplying the color if it's already premultiplied.
QRgb color = img.pixel(sr_l, sr_t);
switch (img.format()) {
@@ -2346,7 +2238,7 @@ void QRasterPaintEngine::drawImage(const QRectF &r, const QImage &img, const QRe
break;
}
- if (d->solid_color_filler.solidColor.isTransparent() && s->composition_mode == QPainter::CompositionMode_SourceOver)
+ if (d->solid_color_filler.solidColor.alphaF() <= 0.0f && s->composition_mode == QPainter::CompositionMode_SourceOver)
return;
d->solid_color_filler.clip = d->clip();
@@ -2369,6 +2261,7 @@ void QRasterPaintEngine::drawImage(const QRectF &r, const QImage &img, const QRe
|| d->rasterBuffer->compositionMode == QPainter::CompositionMode_Source))
{
RotationType rotationType = qRotationType(s->matrix);
+ Q_ASSERT(d->rasterBuffer->format < QImage::NImageFormats);
const QPixelLayout::BPP plBpp = qPixelLayouts[d->rasterBuffer->format].bpp;
if (rotationType != NoRotation && qMemRotateFunctions[plBpp][rotationType] && img.rect().contains(sr.toAlignedRect())) {
@@ -2411,15 +2304,20 @@ void QRasterPaintEngine::drawImage(const QRectF &r, const QImage &img, const QRe
QRectF targetBounds = s->matrix.mapRect(r);
bool exceedsPrecision = r.width() > 0x7fff
|| r.height() > 0x7fff
+ || targetBounds.left() < -0x7fff
+ || targetBounds.top() < -0x7fff
+ || targetBounds.right() > 0x7fff
+ || targetBounds.bottom() > 0x7fff
|| targetBounds.width() > 0x7fff
|| targetBounds.height() > 0x7fff
|| s->matrix.m11() >= 512
|| s->matrix.m22() >= 512;
-
if (!exceedsPrecision && d->canUseFastImageBlending(d->rasterBuffer->compositionMode, img)) {
if (s->matrix.type() > QTransform::TxScale) {
SrcOverTransformFunc func = qTransformFunctions[d->rasterBuffer->format][img.format()];
- if (func && (!clip || clip->hasRectClip)) {
+ // The fast transform methods doesn't really work on small targets, see QTBUG-93475
+ // And it can't antialias the edges
+ if (func && (!clip || clip->hasRectClip) && !s->flags.antialiased && targetBounds.width() >= 16 && targetBounds.height() >= 16) {
func(d->rasterBuffer->buffer(), d->rasterBuffer->bytesPerLine(), img.bits(),
img.bytesPerLine(), r, sr, !clip ? d->deviceRect : clip->clipRect,
s->matrix, s->intOpacity);
@@ -2444,9 +2342,16 @@ void QRasterPaintEngine::drawImage(const QRectF &r, const QImage &img, const QRe
}
SrcOverScaleFunc func = qScaleFunctions[d->rasterBuffer->format][img.format()];
if (func && (!clip || clip->hasRectClip)) {
+ QRectF tr = qt_mapRect_non_normalizing(r, s->matrix);
+ if (!s->flags.antialiased) {
+ tr.setX(qRound(tr.x()));
+ tr.setY(qRound(tr.y()));
+ tr.setWidth(qRound(tr.width()));
+ tr.setHeight(qRound(tr.height()));
+ }
func(d->rasterBuffer->buffer(), d->rasterBuffer->bytesPerLine(),
img.bits(), img.bytesPerLine(), img.height(),
- qt_mapRect_non_normalizing(r, s->matrix), sr,
+ tr, sr,
!clip ? d->deviceRect : clip->clipRect,
s->intOpacity);
return;
@@ -2483,13 +2388,10 @@ void QRasterPaintEngine::drawImage(const QRectF &r, const QImage &img, const QRe
if (s->flags.tx_noshear || s->matrix.type() == QTransform::TxScale) {
d->initializeRasterizer(&d->image_filler_xform);
d->rasterizer->setAntialiased(s->flags.antialiased);
- d->rasterizer->setLegacyRoundingEnabled(s->flags.legacy_rounding);
-
- const QPointF offs = s->flags.legacy_rounding ? QPointF(aliasedCoordinateDelta, aliasedCoordinateDelta) : QPointF();
const QRectF &rect = r.normalized();
- const QPointF a = s->matrix.map((rect.topLeft() + rect.bottomLeft()) * 0.5f) - offs;
- const QPointF b = s->matrix.map((rect.topRight() + rect.bottomRight()) * 0.5f) - offs;
+ const QPointF a = s->matrix.map((rect.topLeft() + rect.bottomLeft()) * 0.5f);
+ const QPointF b = s->matrix.map((rect.topRight() + rect.bottomRight()) * 0.5f);
if (s->flags.tx_noshear)
d->rasterizer->rasterizeLine(a, b, rect.height() / rect.width());
@@ -2498,13 +2400,12 @@ void QRasterPaintEngine::drawImage(const QRectF &r, const QImage &img, const QRe
return;
}
#endif
- const qreal offs = s->flags.legacy_rounding ? aliasedCoordinateDelta : qreal(0);
QPainterPath path;
path.addRect(r);
QTransform m = s->matrix;
s->matrix = QTransform(m.m11(), m.m12(), m.m13(),
m.m21(), m.m22(), m.m23(),
- m.m31() - offs, m.m32() - offs, m.m33());
+ m.m31(), m.m32(), m.m33());
fillPath(path, &d->image_filler_xform);
s->matrix = m;
} else {
@@ -2591,7 +2492,6 @@ void QRasterPaintEngine::drawTiledPixmap(const QRectF &r, const QPixmap &pixmap,
if (s->flags.tx_noshear || s->matrix.type() == QTransform::TxScale) {
d->initializeRasterizer(&d->image_filler_xform);
d->rasterizer->setAntialiased(s->flags.antialiased);
- d->rasterizer->setLegacyRoundingEnabled(s->flags.legacy_rounding);
const QRectF &rect = r.normalized();
const QPointF a = s->matrix.map((rect.topLeft() + rect.bottomLeft()) * 0.5f);
@@ -2649,6 +2549,8 @@ void QRasterPaintEngine::alphaPenBlt(const void* src, int bpl, int depth, int rx
return;
QRasterBuffer *rb = d->rasterBuffer.data();
+ if (rb->colorSpace.transferFunction() == QColorSpace::TransferFunction::Linear)
+ useGammaCorrection = false;
const QRect rect(rx, ry, w, h);
const QClipData *clip = d->clip();
@@ -2688,20 +2590,20 @@ void QRasterPaintEngine::alphaPenBlt(const void* src, int bpl, int depth, int rx
if (unclipped) {
if (depth == 1) {
if (s->penData.bitmapBlit) {
- s->penData.bitmapBlit(rb, rx, ry, s->penData.solidColor,
+ s->penData.bitmapBlit(rb, rx, ry, s->penData.solidColor.rgba64(),
scanline, w, h, bpl);
return;
}
} else if (depth == 8) {
if (s->penData.alphamapBlit) {
- s->penData.alphamapBlit(rb, rx, ry, s->penData.solidColor,
+ s->penData.alphamapBlit(rb, rx, ry, s->penData.solidColor.rgba64(),
scanline, w, h, bpl, nullptr, useGammaCorrection);
return;
}
} else if (depth == 32) {
// (A)RGB Alpha mask where the alpha component is not used.
if (s->penData.alphaRGBBlit) {
- s->penData.alphaRGBBlit(rb, rx, ry, s->penData.solidColor,
+ s->penData.alphaRGBBlit(rb, rx, ry, s->penData.solidColor.rgba64(),
(const uint *) scanline, w, h, bpl / 4, nullptr, useGammaCorrection);
return;
}
@@ -2730,10 +2632,10 @@ void QRasterPaintEngine::alphaPenBlt(const void* src, int bpl, int depth, int rx
ry = ny;
}
if (depth == 8)
- s->penData.alphamapBlit(rb, rx, ry, s->penData.solidColor,
+ s->penData.alphamapBlit(rb, rx, ry, s->penData.solidColor.rgba64(),
scanline, w, h, bpl, clip, useGammaCorrection);
else if (depth == 32)
- s->penData.alphaRGBBlit(rb, rx, ry, s->penData.solidColor,
+ s->penData.alphaRGBBlit(rb, rx, ry, s->penData.solidColor.rgba64(),
(const uint *) scanline, w, h, bpl / 4, clip, useGammaCorrection);
return;
}
@@ -2758,8 +2660,8 @@ void QRasterPaintEngine::alphaPenBlt(const void* src, int bpl, int depth, int rx
if (w <= 0 || h <= 0)
return;
- const int NSPANS = 256;
- QSpan spans[NSPANS];
+ const int NSPANS = 512;
+ QT_FT_Span spans[NSPANS];
int current = 0;
const int x1 = x0 + w;
@@ -2871,6 +2773,9 @@ bool QRasterPaintEngine::drawCachedGlyphs(int numGlyphs, const glyph_t *glyphs,
Q_D(QRasterPaintEngine);
QRasterPaintEngineState *s = state();
+ bool verticalSubPixelPositions = fontEngine->supportsVerticalSubPixelPositions()
+ && (s->renderHints & QPainter::VerticalSubpixelPositioning) != 0;
+
if (fontEngine->hasInternalCaching()) {
QFontEngine::GlyphFormat neededFormat =
painter()->device()->devType() == QInternal::Widget
@@ -2881,7 +2786,9 @@ bool QRasterPaintEngine::drawCachedGlyphs(int numGlyphs, const glyph_t *glyphs,
neededFormat = QFontEngine::Format_Mono;
for (int i = 0; i < numGlyphs; i++) {
- QFixed spp = fontEngine->subPixelPositionForX(positions[i].x);
+ QFixedPoint spp = fontEngine->subPixelPositionFor(positions[i]);
+ if (!verticalSubPixelPositions)
+ spp.y = 0;
const QFontEngine::Glyph *alphaMap = fontEngine->glyphData(glyphs[i], spp, neededFormat, s->matrix);
if (!alphaMap)
@@ -2906,9 +2813,13 @@ bool QRasterPaintEngine::drawCachedGlyphs(int numGlyphs, const glyph_t *glyphs,
Q_UNREACHABLE();
};
+ QFixed y = verticalSubPixelPositions
+ ? qFloor(positions[i].y)
+ : qRound(positions[i].y);
+
alphaPenBlt(alphaMap->data, bytesPerLine, depth,
qFloor(positions[i].x) + alphaMap->x,
- qRound(positions[i].y) - alphaMap->y,
+ qFloor(y) - alphaMap->y,
alphaMap->width, alphaMap->height,
fontEngine->expectsGammaCorrectedBlending());
}
@@ -2917,13 +2828,13 @@ bool QRasterPaintEngine::drawCachedGlyphs(int numGlyphs, const glyph_t *glyphs,
QFontEngine::GlyphFormat glyphFormat = fontEngine->glyphFormat != QFontEngine::Format_None ? fontEngine->glyphFormat : d->glyphCacheFormat;
QImageTextureGlyphCache *cache =
- static_cast<QImageTextureGlyphCache *>(fontEngine->glyphCache(nullptr, glyphFormat, s->matrix, QColor(s->penData.solidColor)));
+ static_cast<QImageTextureGlyphCache *>(fontEngine->glyphCache(nullptr, glyphFormat, s->matrix, s->penData.solidColor));
if (!cache) {
- cache = new QImageTextureGlyphCache(glyphFormat, s->matrix, QColor(s->penData.solidColor));
+ cache = new QImageTextureGlyphCache(glyphFormat, s->matrix, s->penData.solidColor);
fontEngine->setGlyphCache(nullptr, cache);
}
- cache->populate(fontEngine, numGlyphs, glyphs, positions);
+ cache->populate(fontEngine, numGlyphs, glyphs, positions, s->renderHints);
cache->fillInPendingGlyphs();
const QImage &image = cache->image();
@@ -2940,15 +2851,20 @@ bool QRasterPaintEngine::drawCachedGlyphs(int numGlyphs, const glyph_t *glyphs,
int margin = fontEngine->glyphMargin(glyphFormat);
const uchar *bits = image.bits();
for (int i=0; i<numGlyphs; ++i) {
+ QFixedPoint subPixelPosition = fontEngine->subPixelPositionFor(positions[i]);
+ if (!verticalSubPixelPositions)
+ subPixelPosition.y = 0;
- QFixed subPixelPosition = fontEngine->subPixelPositionForX(positions[i].x);
QTextureGlyphCache::GlyphAndSubPixelPosition glyph(glyphs[i], subPixelPosition);
const QTextureGlyphCache::Coord &c = cache->coords[glyph];
if (c.isNull())
continue;
int x = qFloor(positions[i].x) + c.baseLineX - margin;
- int y = qRound(positions[i].y) - c.baseLineY - margin;
+ int y = (verticalSubPixelPositions
+ ? qFloor(positions[i].y)
+ : qRound(positions[i].y));
+ y -= c.baseLineY + margin;
// printf("drawing [%d %d %d %d] baseline [%d %d], glyph: %d, to: %d %d, pos: %d %d\n",
// c.x, c.y,
@@ -3012,8 +2928,8 @@ bool QRasterPaintEnginePrivate::isUnclipped(const QRect &rect,
Q_Q(const QRasterPaintEngine);
const QRasterPaintEngineState *s = q->state();
const QClipData *cl = clip();
+ QRect r = rect.normalized();
if (!cl) {
- QRect r = qrect_normalized(rect);
// inline contains() for performance (we know the rects are normalized)
const QRect &r1 = deviceRect;
return (r.left() >= r1.left() && r.right() <= r1.right()
@@ -3028,7 +2944,6 @@ bool QRasterPaintEnginePrivate::isUnclipped(const QRect &rect,
if (s->flags.antialiased)
++penWidth;
- QRect r = qrect_normalized(rect);
if (penWidth > 0) {
r.setX(r.x() - penWidth);
r.setY(r.y() - penWidth);
@@ -3049,7 +2964,12 @@ bool QRasterPaintEnginePrivate::isUnclipped(const QRect &rect,
inline bool QRasterPaintEnginePrivate::isUnclipped(const QRectF &rect,
int penWidth) const
{
- return isUnclipped(rect.normalized().toAlignedRect(), penWidth);
+ const QRectF norm = rect.normalized();
+ if (norm.left() <= INT_MIN || norm.top() <= INT_MIN
+ || norm.right() > INT_MAX || norm.bottom() > INT_MAX
+ || norm.width() > INT_MAX || norm.height() > INT_MAX)
+ return false;
+ return isUnclipped(norm.toAlignedRect(), penWidth);
}
inline ProcessSpans
@@ -3079,13 +2999,19 @@ QRasterPaintEnginePrivate::getPenFunc(const QRectF &rect,
return isUnclipped(rect, penWidth) ? data->unclipped_blend : data->blend;
}
-static QPair<int, int> visibleGlyphRange(const QRectF &clip, QFontEngine *fontEngine,
- glyph_t *glyphs, QFixedPoint *positions, int numGlyphs)
+struct VisibleGlyphRange
{
- QFixed clipLeft = QFixed::fromReal(clip.left());
- QFixed clipRight = QFixed::fromReal(clip.right());
- QFixed clipTop = QFixed::fromReal(clip.top());
- QFixed clipBottom = QFixed::fromReal(clip.bottom());
+ int begin;
+ int end;
+};
+
+static VisibleGlyphRange visibleGlyphRange(const QRectF &clip, QFontEngine *fontEngine,
+ glyph_t *glyphs, QFixedPoint *positions, int numGlyphs)
+{
+ QFixed clipLeft = QFixed::fromReal(clip.left() - 1);
+ QFixed clipRight = QFixed::fromReal(clip.right() + 1);
+ QFixed clipTop = QFixed::fromReal(clip.top() - 1);
+ QFixed clipBottom = QFixed::fromReal(clip.bottom() + 1);
int first = 0;
while (first < numGlyphs) {
@@ -3109,7 +3035,7 @@ static QPair<int, int> visibleGlyphRange(const QRectF &clip, QFontEngine *fontEn
break;
--last;
}
- return QPair<int, int>(first, last + 1);
+ return {first, last + 1};
}
/*!
@@ -3135,13 +3061,13 @@ void QRasterPaintEngine::drawStaticTextItem(QStaticTextItem *textItem)
if (!invertible)
return;
- QPair<int, int> range = visibleGlyphRange(invMat.mapRect(clipBoundingRect()),
- textItem->fontEngine(), textItem->glyphs,
- textItem->glyphPositions, textItem->numGlyphs);
+ const auto range = visibleGlyphRange(invMat.mapRect(clipBoundingRect()),
+ textItem->fontEngine(), textItem->glyphs,
+ textItem->glyphPositions, textItem->numGlyphs);
QStaticTextItem copy = *textItem;
- copy.glyphs += range.first;
- copy.glyphPositions += range.first;
- copy.numGlyphs = range.second - range.first;
+ copy.glyphs += range.begin;
+ copy.glyphPositions += range.begin;
+ copy.numGlyphs = range.end - range.begin;
QPaintEngineEx::drawStaticTextItem(&copy);
} else {
QPaintEngineEx::drawStaticTextItem(textItem);
@@ -3158,7 +3084,7 @@ void QRasterPaintEngine::drawTextItem(const QPointF &p, const QTextItem &textIte
#ifdef QT_DEBUG_DRAW
Q_D(QRasterPaintEngine);
fprintf(stderr," - QRasterPaintEngine::drawTextItem(), (%.2f,%.2f), string=%s ct=%d\n",
- p.x(), p.y(), QString::fromRawData(ti.chars, ti.num_chars).toLatin1().data(),
+ p.x(), p.y(), QStringView(ti.chars, ti.num_chars).toLatin1().data(),
d->glyphCacheFormat);
#endif
@@ -3190,20 +3116,20 @@ void QRasterPaintEngine::drawTextItem(const QPointF &p, const QTextItem &textIte
ti.fontEngine->getGlyphPositions(ti.glyphs, QTransform::fromTranslate(p.x(), p.y()),
ti.flags, glyphs, positions);
- QPair<int, int> range = visibleGlyphRange(invMat.mapRect(clipBoundingRect()),
- ti.fontEngine, glyphs.data(), positions.data(),
- glyphs.size());
+ const auto range = visibleGlyphRange(invMat.mapRect(clipBoundingRect()),
+ ti.fontEngine, glyphs.data(), positions.data(),
+ glyphs.size());
- if (range.first >= range.second)
+ if (range.begin >= range.end)
return;
QStaticTextItem staticTextItem;
staticTextItem.color = s->pen.color();
staticTextItem.font = s->font;
staticTextItem.setFontEngine(ti.fontEngine);
- staticTextItem.numGlyphs = range.second - range.first;
- staticTextItem.glyphs = glyphs.data() + range.first;
- staticTextItem.glyphPositions = positions.data() + range.first;
+ staticTextItem.numGlyphs = range.end - range.begin;
+ staticTextItem.glyphs = glyphs.data() + range.begin;
+ staticTextItem.glyphPositions = positions.data() + range.begin;
QPaintEngineEx::drawStaticTextItem(&staticTextItem);
} else {
QPaintEngineEx::drawTextItem(p, ti);
@@ -3228,7 +3154,6 @@ void QRasterPaintEngine::drawPoints(const QPointF *points, int pointCount)
}
QCosmeticStroker stroker(s, d->deviceRect, d->deviceRectUnclipped);
- stroker.setLegacyRoundingEnabled(s->flags.legacy_rounding);
stroker.drawPoints(points, pointCount);
}
@@ -3248,7 +3173,6 @@ void QRasterPaintEngine::drawPoints(const QPoint *points, int pointCount)
}
QCosmeticStroker stroker(s, d->deviceRect, d->deviceRectUnclipped);
- stroker.setLegacyRoundingEnabled(s->flags.legacy_rounding);
stroker.drawPoints(points, pointCount);
}
@@ -3269,7 +3193,6 @@ void QRasterPaintEngine::drawLines(const QLine *lines, int lineCount)
if (s->flags.fast_pen) {
QCosmeticStroker stroker(s, d->deviceRect, d->deviceRectUnclipped);
- stroker.setLegacyRoundingEnabled(s->flags.legacy_rounding);
for (int i=0; i<lineCount; ++i) {
const QLine &l = lines[i];
stroker.drawLine(l.p1(), l.p2());
@@ -3290,7 +3213,7 @@ void QRasterPaintEnginePrivate::rasterizeLine_dashed(QLineF line,
const QPen &pen = s->lastPen;
const bool squareCap = (pen.capStyle() == Qt::SquareCap);
- const QVector<qreal> pattern = pen.dashPattern();
+ const QList<qreal> pattern = pen.dashPattern();
qreal patternLength = 0;
for (int i = 0; i < pattern.size(); ++i)
@@ -3301,6 +3224,11 @@ void QRasterPaintEnginePrivate::rasterizeLine_dashed(QLineF line,
qreal length = line.length();
Q_ASSERT(length > 0);
+ if (length / (patternLength * width) > QDashStroker::repetitionLimit()) {
+ rasterizer->rasterizeLine(line.p1(), line.p2(), width / length, squareCap);
+ return;
+ }
+
while (length > 0) {
const bool rasterize = *inDash;
qreal dash = (pattern.at(*dashIndex) - *dashOffset) * width;
@@ -3341,7 +3269,6 @@ void QRasterPaintEngine::drawLines(const QLineF *lines, int lineCount)
return;
if (s->flags.fast_pen) {
QCosmeticStroker stroker(s, d->deviceRect, d->deviceRectUnclipped);
- stroker.setLegacyRoundingEnabled(s->flags.legacy_rounding);
for (int i=0; i<lineCount; ++i) {
QLineF line = lines[i];
stroker.drawLine(line.p1(), line.p2());
@@ -3463,23 +3390,25 @@ void QRasterPaintEngine::drawBitmap(const QPointF &pos, const QImage &image, QSp
Q_ASSERT(image.depth() == 1);
- const int spanCount = 256;
+ const int spanCount = 512;
QT_FT_Span spans[spanCount];
int n = 0;
// Boundaries
int w = image.width();
int h = image.height();
- int ymax = qMin(qRound(pos.y() + h), d->rasterBuffer->height());
- int ymin = qMax(qRound(pos.y()), 0);
- int xmax = qMin(qRound(pos.x() + w), d->rasterBuffer->width());
- int xmin = qMax(qRound(pos.x()), 0);
+ int px = qRound(pos.x());
+ int py = qRound(pos.y());
+ int ymax = qMin(py + h, d->rasterBuffer->height());
+ int ymin = qMax(py, 0);
+ int xmax = qMin(px + w, d->rasterBuffer->width());
+ int xmin = qMax(px, 0);
- int x_offset = xmin - qRound(pos.x());
+ int x_offset = xmin - px;
QImage::Format format = image.format();
for (int y = ymin; y < ymax; ++y) {
- const uchar *src = image.scanLine(y - qRound(pos.y()));
+ const uchar *src = image.scanLine(y - py);
if (format == QImage::Format_MonoLSB) {
for (int x = 0; x < xmax - xmin; ++x) {
int src_x = x + x_offset;
@@ -3567,7 +3496,7 @@ QRasterPaintEngine::ClipType QRasterPaintEngine::clipType() const
\internal
Returns the bounding rect of the currently set clip.
*/
-QRect QRasterPaintEngine::clipBoundingRect() const
+QRectF QRasterPaintEngine::clipBoundingRect() const
{
Q_D(const QRasterPaintEngine);
@@ -3579,7 +3508,7 @@ QRect QRasterPaintEngine::clipBoundingRect() const
if (clip->hasRectClip)
return clip->clipRect;
- return QRect(clip->xmin, clip->ymin, clip->xmax - clip->xmin, clip->ymax - clip->ymin);
+ return QRectF(clip->xmin, clip->ymin, clip->xmax - clip->xmin, clip->ymax - clip->ymin);
}
void QRasterPaintEnginePrivate::initializeRasterizer(QSpanData *data)
@@ -3588,7 +3517,6 @@ void QRasterPaintEnginePrivate::initializeRasterizer(QSpanData *data)
QRasterPaintEngineState *s = q->state();
rasterizer->setAntialiased(s->flags.antialiased);
- rasterizer->setLegacyRoundingEnabled(s->flags.legacy_rounding);
QRect clipRect(deviceRect);
ProcessSpans blend;
@@ -3653,7 +3581,6 @@ void QRasterPaintEnginePrivate::rasterize(QT_FT_Outline *outline,
if (!s->flags.antialiased) {
rasterizer->setAntialiased(s->flags.antialiased);
- rasterizer->setLegacyRoundingEnabled(s->flags.legacy_rounding);
rasterizer->setClipRect(deviceRect);
rasterizer->initialize(callback, userData);
@@ -3734,6 +3661,18 @@ void QRasterPaintEnginePrivate::rasterize(QT_FT_Outline *outline,
free(rasterPoolOnHeap);
}
+void QRasterPaintEnginePrivate::updateClipping()
+{
+ Q_Q(QRasterPaintEngine);
+ QRasterPaintEngineState *s = q->state();
+
+ if (!s->clipEnabled)
+ return;
+
+ qrasterpaintengine_state_setNoClip(s);
+ replayClipOperations();
+}
+
void QRasterPaintEnginePrivate::recalculateFastImages()
{
Q_Q(QRasterPaintEngine);
@@ -3774,15 +3713,9 @@ bool QRasterPaintEnginePrivate::canUseImageBlitting(QPainter::CompositionMode mo
QImage::Format dFormat = rasterBuffer->format;
QImage::Format sFormat = image.format();
- // Formats must match or source format must be a subset of destination format
- if (dFormat != sFormat && image.pixelFormat().alphaUsage() == QPixelFormat::IgnoresAlpha) {
- if ((sFormat == QImage::Format_RGB32 && dFormat == QImage::Format_ARGB32)
- || (sFormat == QImage::Format_RGBX8888 && dFormat == QImage::Format_RGBA8888)
- || (sFormat == QImage::Format_RGBX64 && dFormat == QImage::Format_RGBA64))
- sFormat = dFormat;
- else
- sFormat = qt_maybeAlphaVersionWithSameDepth(sFormat); // this returns premul formats
- }
+ // Formats must match or source format must be an opaque version of destination format
+ if (dFormat != sFormat && image.pixelFormat().alphaUsage() == QPixelFormat::IgnoresAlpha)
+ dFormat = qt_maybeDataCompatibleOpaqueVersion(dFormat);
return (dFormat == sFormat);
}
@@ -3792,6 +3725,8 @@ QImage QRasterBuffer::colorizeBitmap(const QImage &image, const QColor &color)
const QImage sourceImage = image.convertToFormat(QImage::Format_MonoLSB);
QImage dest = QImage(sourceImage.size(), QImage::Format_ARGB32_Premultiplied);
+ if (sourceImage.isNull() || dest.isNull())
+ return image; // we must have run out of memory
QRgb fg = qPremultiply(color.rgba());
QRgb bg = 0;
@@ -3801,8 +3736,6 @@ QImage QRasterBuffer::colorizeBitmap(const QImage &image, const QColor &color)
for (int y=0; y<height; ++y) {
const uchar *source = sourceImage.constScanLine(y);
QRgb *target = reinterpret_cast<QRgb *>(dest.scanLine(y));
- if (!source || !target)
- QT_THROW(std::bad_alloc()); // we must have run out of memory
for (int x=0; x < width; ++x)
target[x] = (source[x>>3] >> (x&7)) & 1 ? fg : bg;
}
@@ -3830,9 +3763,10 @@ QImage::Format QRasterBuffer::prepare(QImage *image)
bytes_per_line = image->bytesPerLine();
format = image->format();
+ colorSpace = image->colorSpace();
if (image->depth() == 1 && image->colorTable().size() == 2) {
monoDestinationWithClut = true;
- const QVector<QRgb> colorTable = image->colorTable();
+ const QList<QRgb> colorTable = image->colorTable();
destColor0 = qPremultiply(colorTable[0]);
destColor1 = qPremultiply(colorTable[1]);
}
@@ -3868,23 +3802,23 @@ void QClipData::initialize()
return;
if (!m_clipLines)
- m_clipLines = (ClipLine *)calloc(sizeof(ClipLine), clipSpanHeight);
+ m_clipLines = (ClipLine *)calloc(clipSpanHeight, sizeof(ClipLine));
Q_CHECK_PTR(m_clipLines);
QT_TRY {
allocated = clipSpanHeight;
+ count = 0;
QT_TRY {
if (hasRegionClip) {
const auto rects = clipRegion.begin();
const int numRects = clipRegion.rectCount();
const int maxSpans = (ymax - ymin) * numRects;
allocated = qMax(allocated, maxSpans);
- m_spans = (QSpan *)malloc(allocated * sizeof(QSpan));
+ m_spans = (QT_FT_Span *)malloc(allocated * sizeof(QT_FT_Span));
Q_CHECK_PTR(m_spans);
int y = 0;
int firstInBand = 0;
- count = 0;
while (firstInBand < numRects) {
const int currMinY = rects[firstInBand].y();
const int currMaxY = currMinY + rects[firstInBand].height();
@@ -3906,7 +3840,7 @@ void QClipData::initialize()
for (int r = firstInBand; r <= lastInBand; ++r) {
const QRect &currRect = rects[r];
- QSpan *span = m_spans + count;
+ QT_FT_Span *span = m_spans + count;
span->x = currRect.x();
span->len = currRect.width();
span->y = y;
@@ -3930,7 +3864,7 @@ void QClipData::initialize()
return;
}
- m_spans = (QSpan *)malloc(allocated * sizeof(QSpan));
+ m_spans = (QT_FT_Span *)malloc(allocated * sizeof(QT_FT_Span));
Q_CHECK_PTR(m_spans);
if (hasRectClip) {
@@ -3942,9 +3876,8 @@ void QClipData::initialize()
}
const int len = clipRect.width();
- count = 0;
while (y < ymax) {
- QSpan *span = m_spans + count;
+ QT_FT_Span *span = m_spans + count;
span->x = xmin;
span->len = len;
span->y = y;
@@ -4083,16 +4016,16 @@ void QClipData::setClipRegion(const QRegion &region)
\internal
spans must be sorted on y
*/
-static const QSpan *qt_intersect_spans(const QClipData *clip, int *currentClip,
- const QSpan *spans, const QSpan *end,
- QSpan **outSpans, int available)
+static const QT_FT_Span *qt_intersect_spans(const QClipData *clip, int *currentClip,
+ const QT_FT_Span *spans, const QT_FT_Span *end,
+ QT_FT_Span **outSpans, int available)
{
const_cast<QClipData *>(clip)->initialize();
- QSpan *out = *outSpans;
+ QT_FT_Span *out = *outSpans;
- const QSpan *clipSpans = clip->m_spans + *currentClip;
- const QSpan *clipEnd = clip->m_spans + clip->count;
+ const QT_FT_Span *clipSpans = clip->m_spans + *currentClip;
+ const QT_FT_Span *clipEnd = clip->m_spans + clip->count;
while (available && spans < end ) {
if (clipSpans >= clipEnd) {
@@ -4146,19 +4079,19 @@ static const QSpan *qt_intersect_spans(const QClipData *clip, int *currentClip,
return spans;
}
-static void qt_span_fill_clipped(int spanCount, const QSpan *spans, void *userData)
+static void qt_span_fill_clipped(int spanCount, const QT_FT_Span *spans, void *userData)
{
// qDebug() << "qt_span_fill_clipped" << spanCount;
QSpanData *fillData = reinterpret_cast<QSpanData *>(userData);
Q_ASSERT(fillData->blend && fillData->unclipped_blend);
- const int NSPANS = 256;
- QSpan cspans[NSPANS];
+ const int NSPANS = 512;
+ QT_FT_Span cspans[NSPANS];
int currentClip = 0;
- const QSpan *end = spans + spanCount;
+ const QT_FT_Span *end = spans + spanCount;
while (spans < end) {
- QSpan *clipped = cspans;
+ QT_FT_Span *clipped = cspans;
spans = qt_intersect_spans(fillData->clip, &currentClip, spans, end, &clipped, NSPANS);
// qDebug() << "processed " << spanCount - (end - spans) << "clipped" << clipped-cspans
// << "span:" << cspans->x << cspans->y << cspans->len << spans->coverage;
@@ -4176,10 +4109,10 @@ static void qt_span_fill_clipped(int spanCount, const QSpan *spans, void *userDa
static int qt_intersect_spans(QT_FT_Span *&spans, int numSpans,
const QRect &clip)
{
- const short minx = clip.left();
- const short miny = clip.top();
- const short maxx = clip.right();
- const short maxy = clip.bottom();
+ const int minx = clip.left();
+ const int miny = clip.top();
+ const int maxx = clip.right();
+ const int maxy = clip.bottom();
QT_FT_Span *end = spans + numSpans;
while (spans < end) {
@@ -4201,7 +4134,7 @@ static int qt_intersect_spans(QT_FT_Span *&spans, int numSpans,
s->len = qMin(s->len - (minx - s->x), maxx - minx + 1);
s->x = minx;
} else {
- s->len = qMin(s->len, ushort(maxx - s->x + 1));
+ s->len = qMin(s->len, (maxx - s->x + 1));
}
++s;
}
@@ -4210,7 +4143,7 @@ static int qt_intersect_spans(QT_FT_Span *&spans, int numSpans,
}
-static void qt_span_fill_clipRect(int count, const QSpan *spans,
+static void qt_span_fill_clipRect(int count, const QT_FT_Span *spans,
void *userData)
{
QSpanData *fillData = reinterpret_cast<QSpanData *>(userData);
@@ -4219,7 +4152,7 @@ static void qt_span_fill_clipRect(int count, const QSpan *spans,
Q_ASSERT(fillData->clip);
Q_ASSERT(!fillData->clip->clipRect.isEmpty());
- QSpan *s = const_cast<QSpan *>(spans);
+ QT_FT_Span *s = const_cast<QT_FT_Span *>(spans);
// hw: check if this const_cast<> is safe!!!
count = qt_intersect_spans(s, count,
fillData->clip->clipRect);
@@ -4227,7 +4160,7 @@ static void qt_span_fill_clipRect(int count, const QSpan *spans,
fillData->unclipped_blend(count, s, fillData);
}
-static void qt_span_clip(int count, const QSpan *spans, void *userData)
+static void qt_span_clip(int count, const QT_FT_Span *spans, void *userData)
{
ClipData *clipData = reinterpret_cast<ClipData *>(userData);
@@ -4244,14 +4177,14 @@ static void qt_span_clip(int count, const QSpan *spans, void *userData)
newClip->initialize();
int currentClip = 0;
- const QSpan *end = spans + count;
+ const QT_FT_Span *end = spans + count;
while (spans < end) {
- QSpan *newspans = newClip->m_spans + newClip->count;
+ QT_FT_Span *newspans = newClip->m_spans + newClip->count;
spans = qt_intersect_spans(clipData->oldClip, &currentClip, spans, end,
&newspans, newClip->allocated - newClip->count);
newClip->count = newspans - newClip->m_spans;
if (spans < end) {
- newClip->m_spans = q_check_ptr((QSpan *)realloc(newClip->m_spans, newClip->allocated*2*sizeof(QSpan)));
+ newClip->m_spans = q_check_ptr((QT_FT_Span *)realloc(newClip->m_spans, newClip->allocated * 2 * sizeof(QT_FT_Span)));
newClip->allocated *= 2;
}
}
@@ -4269,7 +4202,7 @@ static void qt_span_clip(int count, const QSpan *spans, void *userData)
class QGradientCache
{
public:
- struct CacheInfo : QSpanData::Pinnable
+ struct CacheInfo
{
inline CacheInfo(QGradientStops s, int op, QGradient::InterpolationMode mode) :
stops(std::move(s)), opacity(op), interpolationMode(mode) {}
@@ -4280,9 +4213,9 @@ public:
QGradient::InterpolationMode interpolationMode;
};
- typedef QMultiHash<quint64, QSharedPointer<const CacheInfo>> QGradientColorTableHash;
+ using QGradientColorTableHash = QMultiHash<quint64, std::shared_ptr<const CacheInfo>>;
- inline QSharedPointer<const CacheInfo> getBuffer(const QGradient &gradient, int opacity) {
+ std::shared_ptr<const CacheInfo> getBuffer(const QGradient &gradient, int opacity) {
quint64 hash_val = 0;
const QGradientStops stops = gradient.stops();
@@ -4312,16 +4245,16 @@ protected:
inline void generateGradientColorTable(const QGradient& g,
QRgba64 *colorTable,
int size, int opacity) const;
- QSharedPointer<const CacheInfo> addCacheElement(quint64 hash_val, const QGradient &gradient, int opacity) {
+ std::shared_ptr<const CacheInfo> addCacheElement(quint64 hash_val, const QGradient &gradient, int opacity) {
if (cache.size() == maxCacheSize()) {
// may remove more than 1, but OK
cache.erase(std::next(cache.begin(), QRandomGenerator::global()->bounded(maxCacheSize())));
}
- auto cache_entry = QSharedPointer<CacheInfo>::create(gradient.stops(), opacity, gradient.interpolationMode());
+ auto cache_entry = std::make_shared<CacheInfo>(gradient.stops(), opacity, gradient.interpolationMode());
generateGradientColorTable(gradient, cache_entry->buffer64, paletteSize(), opacity);
for (int i = 0; i < GRADIENT_STOPTABLE_SIZE; ++i)
cache_entry->buffer32[i] = cache_entry->buffer64[i].toArgb32();
- return cache.insert(hash_val, cache_entry).value();
+ return cache.insert(hash_val, std::move(cache_entry)).value();
}
QGradientColorTableHash cache;
@@ -4331,7 +4264,7 @@ protected:
void QGradientCache::generateGradientColorTable(const QGradient& gradient, QRgba64 *colorTable, int size, int opacity) const
{
const QGradientStops stops = gradient.stops();
- int stopCount = stops.count();
+ int stopCount = stops.size();
Q_ASSERT(stopCount > 0);
bool colorInterpolation = (gradient.interpolationMode() == QGradient::ColorInterpolation);
@@ -4537,7 +4470,8 @@ void QSpanData::init(QRasterBuffer *rb, const QRasterPaintEngine *pe)
Q_GUI_EXPORT extern QImage qt_imageForBrush(int brushStyle, bool invert);
-void QSpanData::setup(const QBrush &brush, int alpha, QPainter::CompositionMode compositionMode)
+void QSpanData::setup(const QBrush &brush, int alpha, QPainter::CompositionMode compositionMode,
+ bool isCosmetic)
{
Qt::BrushStyle brushStyle = qbrush_style(brush);
cachedGradient.reset();
@@ -4545,8 +4479,8 @@ void QSpanData::setup(const QBrush &brush, int alpha, QPainter::CompositionMode
case Qt::SolidPattern: {
type = Solid;
QColor c = qbrush_color(brush);
- solidColor = qPremultiply(combineAlpha256(c.rgba64(), alpha));
- if (solidColor.isTransparent() && compositionMode == QPainter::CompositionMode_SourceOver)
+ solidColor = qPremultiplyWithExtraAlpha(c, alpha);
+ if (solidColor.alphaF() <= 0.0f && compositionMode == QPainter::CompositionMode_SourceOver)
type = None;
break;
}
@@ -4559,7 +4493,7 @@ void QSpanData::setup(const QBrush &brush, int alpha, QPainter::CompositionMode
auto cacheInfo = qt_gradient_cache()->getBuffer(*g, alpha);
gradient.colorTable32 = cacheInfo->buffer32;
-#if QT_CONFIG(raster_64bit)
+#if QT_CONFIG(raster_64bit) || QT_CONFIG(raster_fp)
gradient.colorTable64 = cacheInfo->buffer64;
#endif
cachedGradient = std::move(cacheInfo);
@@ -4583,7 +4517,7 @@ void QSpanData::setup(const QBrush &brush, int alpha, QPainter::CompositionMode
auto cacheInfo = qt_gradient_cache()->getBuffer(*g, alpha);
gradient.colorTable32 = cacheInfo->buffer32;
-#if QT_CONFIG(raster_64bit)
+#if QT_CONFIG(raster_64bit) || QT_CONFIG(raster_fp)
gradient.colorTable64 = cacheInfo->buffer64;
#endif
cachedGradient = std::move(cacheInfo);
@@ -4611,7 +4545,7 @@ void QSpanData::setup(const QBrush &brush, int alpha, QPainter::CompositionMode
auto cacheInfo = qt_gradient_cache()->getBuffer(*g, alpha);
gradient.colorTable32 = cacheInfo->buffer32;
-#if QT_CONFIG(raster_64bit)
+#if QT_CONFIG(raster_64bit) || QT_CONFIG(raster_fp)
gradient.colorTable64 = cacheInfo->buffer64;
#endif
cachedGradient = std::move(cacheInfo);
@@ -4644,7 +4578,7 @@ void QSpanData::setup(const QBrush &brush, int alpha, QPainter::CompositionMode
if (!tempImage)
tempImage = new QImage();
*tempImage = rasterBuffer->colorizeBitmap(qt_imageForBrush(brushStyle, true), brush.color());
- initTexture(tempImage, alpha, QTextureData::Tiled);
+ initTexture(tempImage, alpha, isCosmetic ? QTextureData::Pattern : QTextureData::Tiled);
break;
case Qt::TexturePattern:
type = Texture;
@@ -4910,7 +4844,7 @@ static void drawEllipse_midpoint_i(const QRect &rect, const QRect &clip,
}
}
-/*!
+/*
\fn void QRasterPaintEngine::drawPoints(const QPoint *points, int pointCount)
\overload
\reimp
@@ -4931,7 +4865,7 @@ void dumpClip(int width, int height, const QClipData *clip)
((QClipData *) clip)->spans(); // Force allocation of the spans structure...
for (int i = 0; i < clip->count; ++i) {
- const QSpan *span = ((QClipData *) clip)->spans() + i;
+ const QT_FT_Span *span = ((QClipData *) clip)->spans() + i;
for (int j = 0; j < span->len; ++j)
clipImg.setPixel(span->x + j, span->y, 0xffffff00);
x0 = qMin(x0, int(span->x));
diff --git a/src/gui/painting/qpaintengine_raster_p.h b/src/gui/painting/qpaintengine_raster_p.h
index 089aadc3f7..ab0048af52 100644
--- a/src/gui/painting/qpaintengine_raster_p.h
+++ b/src/gui/painting/qpaintengine_raster_p.h
@@ -1,41 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the QtGui module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#ifndef QPAINTENGINE_RASTER_P_H
#define QPAINTENGINE_RASTER_P_H
@@ -109,11 +73,10 @@ public:
uint non_complex_pen : 1; // can use rasterizer, rather than stroker
uint antialiased : 1;
uint bilinear : 1;
- uint legacy_rounding : 1;
uint fast_text : 1;
- uint int_xform : 1;
uint tx_noshear : 1;
uint fast_images : 1;
+ uint cosmetic_brush : 1;
};
union {
@@ -206,7 +169,7 @@ public:
ComplexClip
};
ClipType clipType() const;
- QRect clipBoundingRect() const;
+ QRectF clipBoundingRect() const;
#ifdef Q_OS_WIN
void setDC(HDC hdc);
@@ -277,6 +240,7 @@ public:
void rasterize(QT_FT_Outline *outline, ProcessSpans callback, QSpanData *spanData, QRasterBuffer *rasterBuffer);
void rasterize(QT_FT_Outline *outline, ProcessSpans callback, void *userData, QRasterBuffer *rasterBuffer);
void updateMatrixData(QSpanData *spanData, const QBrush &brush, const QTransform &brushMatrix);
+ void updateClipping();
void systemStateChanged() override;
@@ -351,7 +315,7 @@ public:
int clipSpanHeight;
struct ClipLine {
int count;
- QSpan *spans;
+ QT_FT_Span *spans;
} *m_clipLines;
void initialize();
@@ -362,7 +326,7 @@ public:
return m_clipLines;
}
- inline QSpan *spans() {
+ inline QT_FT_Span *spans() {
if (!m_spans)
initialize();
return m_spans;
@@ -370,7 +334,7 @@ public:
int allocated;
int count;
- QSpan *m_spans;
+ QT_FT_Span *m_spans;
int xmin, xmax, ymin, ymax;
QRect clipRect;
@@ -381,7 +345,7 @@ public:
uint hasRegionClip : 1;
void appendSpan(int x, int length, int y, int coverage);
- void appendSpans(const QSpan *s, int num);
+ void appendSpans(const QT_FT_Span *s, int num);
// ### Should optimize and actually kill the QSpans if the rect is
// ### a subset of The current region. Thus the "fast" clipspan
@@ -397,7 +361,7 @@ inline void QClipData::appendSpan(int x, int length, int y, int coverage)
if (count == allocated) {
allocated *= 2;
- m_spans = (QSpan *)realloc(m_spans, allocated*sizeof(QSpan));
+ m_spans = (QT_FT_Span *)realloc(m_spans, allocated*sizeof(QT_FT_Span));
}
m_spans[count].x = x;
m_spans[count].len = length;
@@ -406,7 +370,7 @@ inline void QClipData::appendSpan(int x, int length, int y, int coverage)
++count;
}
-inline void QClipData::appendSpans(const QSpan *s, int num)
+inline void QClipData::appendSpans(const QT_FT_Span *s, int num)
{
Q_ASSERT(m_spans);
@@ -414,9 +378,9 @@ inline void QClipData::appendSpans(const QSpan *s, int num)
do {
allocated *= 2;
} while (count + num > allocated);
- m_spans = (QSpan *)realloc(m_spans, allocated*sizeof(QSpan));
+ m_spans = (QT_FT_Span *)realloc(m_spans, allocated*sizeof(QT_FT_Span));
}
- memcpy(m_spans+count, s, num*sizeof(QSpan));
+ memcpy(m_spans+count, s, num*sizeof(QT_FT_Span));
count += num;
}
@@ -434,14 +398,14 @@ public:
QImage::Format prepare(QImage *image);
- uchar *scanLine(int y) { Q_ASSERT(y>=0); Q_ASSERT(y<m_height); return m_buffer + y * qsizetype(bytes_per_line); }
+ uchar *scanLine(int y) { Q_ASSERT(y>=0); Q_ASSERT(y<m_height); return m_buffer + y * bytes_per_line; }
int width() const { return m_width; }
int height() const { return m_height; }
- int bytesPerLine() const { return bytes_per_line; }
+ qsizetype bytesPerLine() const { return bytes_per_line; }
int bytesPerPixel() const { return bytes_per_pixel; }
template<typename T>
- int stride() { return bytes_per_line / sizeof(T); }
+ int stride() { return static_cast<int>(bytes_per_line / sizeof(T)); }
uchar *buffer() const { return m_buffer; }
@@ -451,12 +415,13 @@ public:
QPainter::CompositionMode compositionMode;
QImage::Format format;
+ QColorSpace colorSpace;
QImage colorizeBitmap(const QImage &image, const QColor &color);
private:
int m_width;
int m_height;
- int bytes_per_line;
+ qsizetype bytes_per_line;
int bytes_per_pixel;
uchar *m_buffer;
};
diff --git a/src/gui/painting/qpaintengineex.cpp b/src/gui/painting/qpaintengineex.cpp
index 5d8f89eadd..9468876c23 100644
--- a/src/gui/painting/qpaintengineex.cpp
+++ b/src/gui/painting/qpaintengineex.cpp
@@ -1,41 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the QtGui module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#include "qpaintengineex_p.h"
#include "qpainter_p.h"
@@ -183,7 +147,7 @@ void QPaintEngineExPrivate::replayClipOperations()
if (!p || !p->d_ptr)
return;
- const QVector<QPainterClipInfo> &clipInfo = p->d_ptr->state->clipInfo;
+ const QList<QPainterClipInfo> &clipInfo = p->d_ptr->state->clipInfo;
QTransform transform = q->state()->matrix;
@@ -385,10 +349,10 @@ QPainterState *QPaintEngineEx::createState(QPainterState *orig) const
Q_GUI_EXPORT extern bool qt_scaleForTransform(const QTransform &transform, qreal *scale); // qtransform.cpp
-void QPaintEngineEx::stroke(const QVectorPath &path, const QPen &pen)
+void QPaintEngineEx::stroke(const QVectorPath &path, const QPen &inPen)
{
#ifdef QT_DEBUG_DRAW
- qDebug() << "QPaintEngineEx::stroke()" << pen;
+ qDebug() << "QPaintEngineEx::stroke()" << inPen;
#endif
Q_D(QPaintEngineEx);
@@ -403,6 +367,38 @@ void QPaintEngineEx::stroke(const QVectorPath &path, const QPen &pen)
d->stroker.setCubicToHook(qpaintengineex_cubicTo);
}
+ QRectF clipRect;
+ QPen pen = inPen;
+ if (pen.style() > Qt::SolidLine) {
+ QRectF cpRect = path.controlPointRect();
+ const QTransform &xf = state()->matrix;
+ if (pen.isCosmetic()) {
+ clipRect = d->exDeviceRect;
+ cpRect.translate(xf.dx(), xf.dy());
+ } else {
+ clipRect = xf.inverted().mapRect(QRectF(d->exDeviceRect));
+ }
+ // Check to avoid generating unwieldy amount of dashes that will not be visible anyway
+ qreal pw = pen.widthF() ? pen.widthF() : 1;
+ QRectF extentRect = cpRect.adjusted(-pw, -pw, pw, pw) & clipRect;
+ qreal extent = qMax(extentRect.width(), extentRect.height());
+ qreal patternLength = 0;
+ const QList<qreal> pattern = pen.dashPattern();
+ const int patternSize = qMin(pattern.size(), 32);
+ for (int i = 0; i < patternSize; i++)
+ patternLength += qMax(pattern.at(i), qreal(0));
+ patternLength *= pw;
+ if (qFuzzyIsNull(patternLength)) {
+ pen.setStyle(Qt::NoPen);
+ } else if (extent / patternLength > QDashStroker::repetitionLimit()) {
+ // approximate stream of tiny dashes with semi-transparent solid line
+ pen.setStyle(Qt::SolidLine);
+ QColor color(pen.color());
+ color.setAlpha(color.alpha() / 2);
+ pen.setColor(color);
+ }
+ }
+
if (!qpen_fast_equals(pen, d->strokerPen)) {
d->strokerPen = pen;
d->stroker.setJoinStyle(pen.joinStyle());
@@ -430,14 +426,8 @@ void QPaintEngineEx::stroke(const QVectorPath &path, const QPen &pen)
return;
}
- if (pen.style() > Qt::SolidLine) {
- if (qt_pen_is_cosmetic(pen, state()->renderHints)){
- d->activeStroker->setClipRect(d->exDeviceRect);
- } else {
- QRectF clipRect = state()->matrix.inverted().mapRect(QRectF(d->exDeviceRect));
- d->activeStroker->setClipRect(clipRect);
- }
- }
+ if (!clipRect.isNull())
+ d->activeStroker->setClipRect(clipRect);
if (d->activeStroker == &d->stroker)
d->stroker.setForceOpen(path.hasExplicitOpen());
@@ -461,7 +451,7 @@ void QPaintEngineEx::stroke(const QVectorPath &path, const QPen &pen)
flags |= QVectorPath::CurvedShapeMask;
// ### Perspective Xforms are currently not supported...
- if (!qt_pen_is_cosmetic(pen, state()->renderHints)) {
+ if (!pen.isCosmetic()) {
// We include cosmetic pens in this case to avoid having to
// change the current transform. Normal transformed,
// non-cosmetic pens will be transformed as part of fill
@@ -912,6 +902,7 @@ void QPaintEngineEx::drawPoints(const QPoint *points, int pointCount)
void QPaintEngineEx::drawPolygon(const QPointF *points, int pointCount, PolygonDrawMode mode)
{
+ Q_ASSERT(pointCount >= 2);
QVectorPath path((const qreal *) points, pointCount, nullptr, QVectorPath::polygonFlags(mode));
if (mode == PolylineMode)
@@ -922,6 +913,7 @@ void QPaintEngineEx::drawPolygon(const QPointF *points, int pointCount, PolygonD
void QPaintEngineEx::drawPolygon(const QPoint *points, int pointCount, PolygonDrawMode mode)
{
+ Q_ASSERT(pointCount >= 2);
int count = pointCount<<1;
QVarLengthArray<qreal> pts(count);
@@ -939,20 +931,20 @@ void QPaintEngineEx::drawPolygon(const QPoint *points, int pointCount, PolygonDr
void QPaintEngineEx::drawPixmap(const QPointF &pos, const QPixmap &pm)
{
- drawPixmap(QRectF(pos, pm.size() / pm.devicePixelRatio()), pm, pm.rect());
+ drawPixmap(QRectF(pos, pm.deviceIndependentSize()), pm, pm.rect());
}
void QPaintEngineEx::drawImage(const QPointF &pos, const QImage &image)
{
- drawImage(QRectF(pos, image.size() / image.devicePixelRatio()), image, image.rect());
+ drawImage(QRectF(pos, image.deviceIndependentSize()), image, image.rect());
}
void QPaintEngineEx::drawTiledPixmap(const QRectF &r, const QPixmap &pixmap, const QPointF &s)
{
QBrush brush(state()->pen.color(), pixmap);
QTransform xform = QTransform::fromTranslate(r.x() - s.x(), r.y() - s.y());
- if (!qFuzzyCompare(pixmap.devicePixelRatioF(), 1.0))
- xform.scale(1.0/pixmap.devicePixelRatioF(), 1.0/pixmap.devicePixelRatioF());
+ if (!qFuzzyCompare(pixmap.devicePixelRatio(), qreal(1.0)))
+ xform.scale(1.0/pixmap.devicePixelRatio(), 1.0/pixmap.devicePixelRatio());
brush.setTransform(xform);
qreal pts[] = { r.x(), r.y(),
diff --git a/src/gui/painting/qpaintengineex_p.h b/src/gui/painting/qpaintengineex_p.h
index b2f8b64029..d2a5a9ceab 100644
--- a/src/gui/painting/qpaintengineex_p.h
+++ b/src/gui/painting/qpaintengineex_p.h
@@ -1,41 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the QtGui module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#ifndef QPAINTENGINEEX_P_H
#define QPAINTENGINEEX_P_H
diff --git a/src/gui/painting/qpainter.cpp b/src/gui/painting/qpainter.cpp
index f70bbbd7d2..f4b9741eed 100644
--- a/src/gui/painting/qpainter.cpp
+++ b/src/gui/painting/qpainter.cpp
@@ -1,43 +1,8 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the QtGui module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
// QtCore
+#include <memory>
#include <qdebug.h>
#include <qmath.h>
#include <qmutex.h>
@@ -74,9 +39,15 @@
#include <private/qhexstring_p.h>
#include <private/qguiapplication_p.h>
#include <private/qrawfont_p.h>
+#include <private/qfont_p.h>
QT_BEGIN_NAMESPACE
+using namespace Qt::StringLiterals;
+
+// We changed the type from QScopedPointer to unique_ptr, make sure it's binary compatible:
+static_assert(sizeof(QScopedPointer<QPainterPrivate>) == sizeof(std::unique_ptr<QPainterPrivate>));
+
#define QGradient_StretchToDevice 0x10000000
#define QPaintEngine_OpaqueBackground 0x40000000
@@ -96,10 +67,15 @@ static void drawTextItemDecoration(QPainter *painter, const QPointF &pos, const
QTextItem::RenderFlags flags, qreal width,
const QTextCharFormat &charFormat);
// Helper function to calculate left most position, width and flags for decoration drawing
-Q_GUI_EXPORT void qt_draw_decoration_for_glyphs(QPainter *painter, const glyph_t *glyphArray,
- const QFixedPoint *positions, int glyphCount,
- QFontEngine *fontEngine, const QFont &font,
- const QTextCharFormat &charFormat);
+static void qt_draw_decoration_for_glyphs(QPainter *painter,
+ const QPointF &decorationPosition,
+ const glyph_t *glyphArray,
+ const QFixedPoint *positions,
+ int glyphCount,
+ QFontEngine *fontEngine,
+ bool underline,
+ bool overline,
+ bool strikeOut);
static inline QGradient::CoordinateMode coordinateMode(const QBrush &brush)
{
@@ -175,6 +151,23 @@ static bool qt_painter_thread_test(int devType, int engineType, const char *what
}
#endif
+static bool needsEmulation(const QBrush &brush)
+{
+ bool res = false;
+
+ const QGradient *bg = brush.gradient();
+ if (bg) {
+ res = (bg->coordinateMode() > QGradient::LogicalMode);
+ } else if (brush.style() == Qt::TexturePattern) {
+ if (qHasPixmapTexture(brush))
+ res = !qFuzzyCompare(brush.texture().devicePixelRatio(), qreal(1.0));
+ else
+ res = !qFuzzyCompare(brush.textureImage().devicePixelRatio(), qreal(1.0));
+ }
+
+ return res;
+}
+
void QPainterPrivate::checkEmulation()
{
Q_ASSERT(extended);
@@ -182,44 +175,34 @@ void QPainterPrivate::checkEmulation()
if (state->bgMode == Qt::OpaqueMode)
doEmulation = true;
- const QGradient *bg = state->brush.gradient();
- if (bg && bg->coordinateMode() > QGradient::LogicalMode)
+ if (needsEmulation(state->brush))
doEmulation = true;
- const QGradient *pg = qpen_brush(state->pen).gradient();
- if (pg && pg->coordinateMode() > QGradient::LogicalMode)
+ if (needsEmulation(qpen_brush(state->pen)))
doEmulation = true;
- if (state->brush.style() == Qt::TexturePattern) {
- if (qHasPixmapTexture(state->brush))
- doEmulation |= !qFuzzyCompare(state->brush.texture().devicePixelRatioF(), 1.0);
- else
- doEmulation |= !qFuzzyCompare(state->brush.textureImage().devicePixelRatioF(), 1.0);
- }
-
if (doEmulation && extended->flags() & QPaintEngineEx::DoNotEmulate)
return;
if (doEmulation) {
- if (extended != emulationEngine) {
+ if (extended != emulationEngine.get()) {
if (!emulationEngine)
- emulationEngine = new QEmulationPaintEngine(extended);
- extended = emulationEngine;
- extended->setState(state);
+ emulationEngine = std::make_unique<QEmulationPaintEngine>(extended);
+ extended = emulationEngine.get();
+ extended->setState(state.get());
}
- } else if (emulationEngine == extended) {
+ } else if (emulationEngine.get() == extended) {
extended = emulationEngine->real_engine;
}
}
-
-QPainterPrivate::~QPainterPrivate()
+QPainterPrivate::QPainterPrivate(QPainter *painter)
+ : q_ptr(painter), txinv(0), inDestructor(false)
{
- delete emulationEngine;
- qDeleteAll(states);
- delete dummyState;
}
+QPainterPrivate::~QPainterPrivate()
+ = default;
QTransform QPainterPrivate::viewTransform() const
{
@@ -238,7 +221,7 @@ qreal QPainterPrivate::effectiveDevicePixelRatio() const
if (device->devType() == QInternal::Printer)
return qreal(1);
- return qMax(qreal(1), device->devicePixelRatioF());
+ return device->devicePixelRatio();
}
QTransform QPainterPrivate::hidpiScaleTransform() const
@@ -263,22 +246,10 @@ bool QPainterPrivate::attachPainterPrivate(QPainter *q, QPaintDevice *pdev)
// Save the current state of the shared painter and assign
// the current d_ptr to the shared painter's d_ptr.
sp->save();
- if (!sp->d_ptr->d_ptrs) {
- // Allocate space for 4 d-pointers (enough for up to 4 sub-sequent
- // redirections within the same paintEvent(), which should be enough
- // in 99% of all cases). E.g: A renders B which renders C which renders D.
- sp->d_ptr->d_ptrs_size = 4;
- sp->d_ptr->d_ptrs = (QPainterPrivate **)malloc(4 * sizeof(QPainterPrivate *));
- Q_CHECK_PTR(sp->d_ptr->d_ptrs);
- } else if (sp->d_ptr->refcount - 1 == sp->d_ptr->d_ptrs_size) {
- // However, to support corner cases we grow the array dynamically if needed.
- sp->d_ptr->d_ptrs_size <<= 1;
- const int newSize = sp->d_ptr->d_ptrs_size * sizeof(QPainterPrivate *);
- sp->d_ptr->d_ptrs = q_check_ptr((QPainterPrivate **)realloc(sp->d_ptr->d_ptrs, newSize));
- }
- sp->d_ptr->d_ptrs[++sp->d_ptr->refcount - 2] = q->d_ptr.data();
- q->d_ptr.take();
- q->d_ptr.reset(sp->d_ptr.data());
+ ++sp->d_ptr->refcount;
+ sp->d_ptr->d_ptrs.push_back(q->d_ptr.get());
+ Q_UNUSED(q->d_ptr.release());
+ q->d_ptr.reset(sp->d_ptr.get());
Q_ASSERT(q->d_ptr->state);
@@ -321,7 +292,9 @@ void QPainterPrivate::detachPainterPrivate(QPainter *q)
Q_ASSERT(refcount > 1);
Q_ASSERT(q);
- QPainterPrivate *original = d_ptrs[--refcount - 1];
+ --refcount;
+ QPainterPrivate *original = d_ptrs.back();
+ d_ptrs.pop_back();
if (inDestructor) {
inDestructor = false;
if (original)
@@ -330,14 +303,12 @@ void QPainterPrivate::detachPainterPrivate(QPainter *q)
original = new QPainterPrivate(q);
}
- d_ptrs[refcount - 1] = nullptr;
q->restore();
- q->d_ptr.take();
+ Q_UNUSED(q->d_ptr.release());
q->d_ptr.reset(original);
if (emulationEngine) {
extended = emulationEngine->real_engine;
- delete emulationEngine;
emulationEngine = nullptr;
}
}
@@ -410,7 +381,7 @@ void QPainterPrivate::draw_helper(const QPainterPath &originalPath, DrawOperatio
if (q->hasClipping()) {
bool hasPerspectiveTransform = false;
- for (const QPainterClipInfo &info : qAsConst(state->clipInfo)) {
+ for (const QPainterClipInfo &info : std::as_const(state->clipInfo)) {
if (info.matrix.type() == QTransform::TxProject) {
hasPerspectiveTransform = true;
break;
@@ -1154,24 +1125,22 @@ void QPainterPrivate::updateState(QPainterState *newState)
The QPainter class also provides a means of controlling the
rendering quality through its RenderHint enum and the support for
floating point precision: All the functions for drawing primitives
- has a floating point version. These are often used in combination
+ have floating point versions.
+
+ \snippet code/src_gui_painting_qpainter.cpp floatBased
+
+ These are often used in combination
with the \l {RenderHint}{QPainter::Antialiasing} render hint.
+ \snippet code/src_gui_painting_qpainter.cpp renderHint
+
\table 100%
\row
+ \li Comparing concentric circles with int and float, and with or without
+ anti-aliased rendering. Using the floating point precision versions
+ produces evenly spaced rings. Anti-aliased rendering results in
+ smooth circles.
\li \inlineimage qpainter-concentriccircles.png
- \li
- \b {Concentric Circles Example}
-
- The \l {painting/concentriccircles}{Concentric Circles} example
- shows the improved rendering quality that can be obtained using
- floating point precision and anti-aliasing when drawing custom
- widgets.
-
- The application's main window displays several widgets which are
- drawn using the various combinations of precision and
- anti-aliasing.
-
\endtable
The RenderHint enum specifies flags to QPainter that may or may
@@ -1231,7 +1200,7 @@ void QPainterPrivate::updateState(QPainterState *newState)
\li \inlineimage qpainter-affinetransformations.png
\endtable
- All the tranformation operations operate on the transformation
+ All the transformation operations operate on the transformation
worldTransform(). A matrix transforms a point in the plane to another
point. For more information about the transformation matrix, see
the \l {Coordinate System} and QTransform documentation.
@@ -1404,8 +1373,7 @@ void QPainterPrivate::updateState(QPainterState *newState)
cases where expensive operations are ok to use, for instance when
the result is cached in a QPixmap.
- \sa QPaintDevice, QPaintEngine, {Qt SVG}, {Basic Drawing Example},
- {Drawing Utility Functions}
+ \sa QPaintDevice, QPaintEngine, {Qt SVG}, {Basic Drawing Example}, {<qdrawutil.h>}{Drawing Utility Functions}
*/
/*!
@@ -1426,16 +1394,15 @@ void QPainterPrivate::updateState(QPainterState *newState)
a smooth pixmap transformation algorithm (such as bilinear) rather
than nearest neighbor.
- \value HighQualityAntialiasing This value is obsolete and will be ignored,
- use the Antialiasing render hint instead.
-
- \value NonCosmeticDefaultPen This value is obsolete, the default for QPen
- is now non-cosmetic.
-
- \value Qt4CompatiblePainting Compatibility hint telling the engine to use the
- same X11 based fill rules as in Qt 4, where aliased rendering is offset
- by slightly less than half a pixel. Also will treat default constructed pens
- as cosmetic. Potentially useful when porting a Qt 4 application to Qt 5.
+ \value VerticalSubpixelPositioning Allow text to be positioned at fractions
+ of pixels vertically as well as horizontally, if this is supported by the
+ font engine. This is currently supported by Freetype on all platforms when
+ the hinting preference is QFont::PreferNoHinting, and also on macOS. For
+ most use cases this will not improve visual quality, but may increase memory
+ consumption and some reduction in text rendering performance. Therefore, enabling
+ this is not recommended unless the use case requires it. One such use case could
+ be aligning glyphs with other visual primitives.
+ This value was added in Qt 6.1.
\value LosslessImageRendering Use a lossless image rendering, whenever possible.
Currently, this hint is only used when QPainter is employed to output a PDF
@@ -1444,8 +1411,14 @@ void QPainterPrivate::updateState(QPainterState *newState)
JPEG compression.
This value was added in Qt 5.13.
+ \value NonCosmeticBrushPatterns When painting with a brush with one of the predefined pattern
+ styles, transform the pattern too, along with the object being painted. The default is to treat
+ the pattern as cosmetic, so that the pattern pixels will map directly to device pixels,
+ independently of any active transformations.
+ This value was added in Qt 6.4.
+
\sa renderHints(), setRenderHint(), {QPainter#Rendering
- Quality}{Rendering Quality}, {Concentric Circles Example}
+ Quality}{Rendering Quality}
*/
@@ -1514,8 +1487,6 @@ QPainter::~QPainter()
Q_ASSERT(d_ptr->inDestructor);
d_ptr->inDestructor = false;
Q_ASSERT(d_ptr->refcount == 1);
- if (d_ptr->d_ptrs)
- free(d_ptr->d_ptrs);
}
}
@@ -1544,25 +1515,8 @@ QPaintDevice *QPainter::device() const
bool QPainter::isActive() const
{
Q_D(const QPainter);
- return d->engine;
-}
-
-#if QT_DEPRECATED_SINCE(5, 13)
-/*!
- Initializes the painters pen, background and font to the same as
- the given \a device.
-
- \obsolete
-
- \sa begin(), {QPainter#Settings}{Settings}
-*/
-void QPainter::initFrom(const QPaintDevice *device)
-{
- Q_ASSERT_X(device, "QPainter::initFrom(const QPaintDevice *device)", "QPaintDevice cannot be 0");
- Q_D(QPainter);
- d->initFrom(device);
+ return d->engine != nullptr;
}
-#endif
void QPainterPrivate::initFrom(const QPaintDevice *device)
{
@@ -1603,15 +1557,19 @@ void QPainter::save()
return;
}
+ std::unique_ptr<QPainterState> prev;
if (d->extended) {
- d->state = d->extended->createState(d->states.back());
- d->extended->setState(d->state);
+ // separate the creation of a new state from the update of d->state, since some
+ // engines access d->state directly (not via createState()'s argument)
+ std::unique_ptr<QPainterState> next(d->extended->createState(d->state.get()));
+ prev = std::exchange(d->state, std::move(next));
+ d->extended->setState(d->state.get());
} else {
d->updateState(d->state);
- d->state = new QPainterState(d->states.back());
- d->engine->state = d->state;
+ prev = std::exchange(d->state, std::make_unique<QPainterState>(d->state.get()));
+ d->engine->state = d->state.get();
}
- d->states.push_back(d->state);
+ d->savedStates.push(std::move(prev));
}
/*!
@@ -1628,7 +1586,7 @@ void QPainter::restore()
printf("QPainter::restore()\n");
#endif
Q_D(QPainter);
- if (d->states.size()<=1) {
+ if (d->savedStates.empty()) {
qWarning("QPainter::restore: Unbalanced save/restore");
return;
} else if (!d->engine) {
@@ -1636,15 +1594,13 @@ void QPainter::restore()
return;
}
- QPainterState *tmp = d->state;
- d->states.pop_back();
- d->state = d->states.back();
+ const auto tmp = std::exchange(d->state, std::move(d->savedStates.top()));
+ d->savedStates.pop();
d->txinv = false;
if (d->extended) {
d->checkEmulation();
- d->extended->setState(d->state);
- delete tmp;
+ d->extended->setState(d->state.get());
return;
}
@@ -1658,9 +1614,8 @@ void QPainter::restore()
tmp->clipPath = QPainterPath();
d->engine->updateState(*tmp);
// replay the list of clip states,
- for (const QPainterClipInfo &info : qAsConst(d->state->clipInfo)) {
+ for (const QPainterClipInfo &info : std::as_const(d->state->clipInfo)) {
tmp->matrix = info.matrix;
- tmp->matrix *= d->state->redirectionMatrix;
tmp->clipOperation = info.operation;
if (info.clipType == QPainterClipInfo::RectClip) {
tmp->dirtyFlags = QPaintEngine::DirtyClipRegion | QPaintEngine::DirtyTransform;
@@ -1682,8 +1637,7 @@ void QPainter::restore()
tmp->changeFlags |= QPaintEngine::DirtyTransform;
}
- d->updateState(d->state);
- delete tmp;
+ d->updateState(d->state.get());
}
@@ -1716,8 +1670,7 @@ void QPainter::restore()
static inline void qt_cleanup_painter_state(QPainterPrivate *d)
{
- qDeleteAll(d->states);
- d->states.clear();
+ d->savedStates.clear();
d->state = nullptr;
d->engine = nullptr;
d->device = nullptr;
@@ -1760,7 +1713,7 @@ bool QPainter::begin(QPaintDevice *pd)
else if (pd->devType() == QInternal::Image)
static_cast<QImage *>(pd)->detach();
- d->engine = pd->paintEngine();
+ d->engine.reset(pd->paintEngine());
if (!d->engine) {
qWarning("QPainter::begin: Paint device returned engine == 0, type: %d", pd->devType());
@@ -1769,24 +1722,23 @@ bool QPainter::begin(QPaintDevice *pd)
d->device = pd;
- d->extended = d->engine->isExtended() ? static_cast<QPaintEngineEx *>(d->engine) : nullptr;
+ d->extended = d->engine->isExtended() ? static_cast<QPaintEngineEx *>(d->engine.get()) : nullptr;
if (d->emulationEngine)
d->emulationEngine->real_engine = d->extended;
// Setup new state...
Q_ASSERT(!d->state);
- d->state = d->extended ? d->extended->createState(nullptr) : new QPainterState;
+ d->state.reset(d->extended ? d->extended->createState(nullptr) : new QPainterState);
d->state->painter = this;
- d->states.push_back(d->state);
d->state->redirectionMatrix.translate(-redirectionOffset.x(), -redirectionOffset.y());
d->state->brushOrigin = QPointF();
// Slip a painter state into the engine before we do any other operations
if (d->extended)
- d->extended->setState(d->state);
+ d->extended->setState(d->state.get());
else
- d->engine->state = d->state;
+ d->engine->state = d->state.get();
switch (pd->devType()) {
case QInternal::Pixmap:
@@ -1813,9 +1765,12 @@ bool QPainter::begin(QPaintDevice *pd)
qWarning("QPainter::begin: Cannot paint on a null image");
qt_cleanup_painter_state(d);
return false;
- } else if (img->format() == QImage::Format_Indexed8) {
- // Painting on indexed8 images is not supported.
- qWarning("QPainter::begin: Cannot paint on an image with the QImage::Format_Indexed8 format");
+ } else if (img->format() == QImage::Format_Indexed8 ||
+ img->format() == QImage::Format_CMYK8888) {
+ // Painting on these formats is not supported.
+ qWarning() << "QPainter::begin: Cannot paint on an image with the"
+ << img->format()
+ << "format";
qt_cleanup_painter_state(d);
return false;
}
@@ -1870,7 +1825,7 @@ bool QPainter::begin(QPaintDevice *pd)
Q_ASSERT(d->engine->isActive());
- if (!d->state->redirectionMatrix.isIdentity() || d->effectiveDevicePixelRatio() > 1)
+ if (!d->state->redirectionMatrix.isIdentity() || !qFuzzyCompare(d->effectiveDevicePixelRatio(), qreal(1.0)))
d->updateMatrix();
Q_ASSERT(d->engine->isActive());
@@ -1924,23 +1879,13 @@ bool QPainter::end()
}
}
- if (d->states.size() > 1) {
- qWarning("QPainter::end: Painter ended with %d saved states",
- d->states.size());
- }
-
- if (d->engine->autoDestruct()) {
- delete d->engine;
- }
-
- if (d->emulationEngine) {
- delete d->emulationEngine;
- d->emulationEngine = nullptr;
+ if (d->savedStates.size() > 0) {
+ qWarning("QPainter::end: Painter ended with %d saved states", int(d->savedStates.size()));
}
- if (d->extended) {
- d->extended = nullptr;
- }
+ d->engine.reset();
+ d->emulationEngine = nullptr;
+ d->extended = nullptr;
qt_cleanup_painter_state(d);
@@ -1957,7 +1902,7 @@ bool QPainter::end()
QPaintEngine *QPainter::paintEngine() const
{
Q_D(const QPainter);
- return d->engine;
+ return d->engine.get();
}
/*!
@@ -2533,7 +2478,7 @@ QRegion QPainter::clipRegion() const
const_cast<QPainter *>(this)->d_ptr->updateInvMatrix();
// ### Falcon: Use QPainterPath
- for (const QPainterClipInfo &info : qAsConst(d->state->clipInfo)) {
+ for (const QPainterClipInfo &info : std::as_const(d->state->clipInfo)) {
switch (info.clipType) {
case QPainterClipInfo::RegionClip: {
@@ -2700,7 +2645,7 @@ QRectF QPainter::clipBoundingRect() const
// fast.
QRectF bounds;
bool first = true;
- for (const QPainterClipInfo &info : qAsConst(d->state->clipInfo)) {
+ for (const QPainterClipInfo &info : std::as_const(d->state->clipInfo)) {
QRectF r;
if (info.clipType == QPainterClipInfo::RectClip)
@@ -2892,175 +2837,6 @@ void QPainter::setClipRegion(const QRegion &r, Qt::ClipOperation op)
d->updateState(d->state);
}
-#if QT_DEPRECATED_SINCE(5, 13)
-/*!
- \since 4.2
- \obsolete
-
- Sets the transformation matrix to \a matrix and enables transformations.
-
- \note It is advisable to use setWorldTransform() instead of this function to
- preserve the properties of perspective transformations.
-
- If \a combine is true, then \a matrix is combined with the current
- transformation matrix; otherwise \a matrix replaces the current
- transformation matrix.
-
- If \a matrix is the identity matrix and \a combine is false, this
- function calls setWorldMatrixEnabled(false). (The identity matrix is the
- matrix where QMatrix::m11() and QMatrix::m22() are 1.0 and the
- rest are 0.0.)
-
- The following functions can transform the coordinate system without using
- a QMatrix:
- \list
- \li translate()
- \li scale()
- \li shear()
- \li rotate()
- \endlist
-
- They operate on the painter's worldMatrix() and are implemented like this:
-
- \snippet code/src_gui_painting_qpainter.cpp 4
-
- Note that when using setWorldMatrix() function you should always have
- \a combine be true when you are drawing into a QPicture. Otherwise
- it may not be possible to replay the picture with additional
- transformations; using the translate(), scale(), etc. convenience
- functions is safe.
-
- For more information about the coordinate system, transformations
- and window-viewport conversion, see \l {Coordinate System}.
-
- \sa setWorldTransform(), QTransform
-*/
-
-void QPainter::setWorldMatrix(const QMatrix &matrix, bool combine)
-{
- setWorldTransform(QTransform(matrix), combine);
-}
-
-/*!
- \since 4.2
- \obsolete
-
- Returns the world transformation matrix.
-
- It is advisable to use worldTransform() because worldMatrix() does not
- preserve the properties of perspective transformations.
-
- \sa {QPainter#Coordinate Transformations}{Coordinate Transformations},
- {Coordinate System}
-*/
-
-const QMatrix &QPainter::worldMatrix() const
-{
- Q_D(const QPainter);
- if (!d->engine) {
- qWarning("QPainter::worldMatrix: Painter not active");
- return d->fakeState()->transform.toAffine();
- }
- return d->state->worldMatrix.toAffine();
-}
-
-/*!
- \obsolete
-
- Use setWorldTransform() instead.
-
- \sa setWorldTransform()
-*/
-
-void QPainter::setMatrix(const QMatrix &matrix, bool combine)
-{
- setWorldTransform(QTransform(matrix), combine);
-}
-
-/*!
- \obsolete
-
- Use worldTransform() instead.
-
- \sa worldTransform()
-*/
-
-const QMatrix &QPainter::matrix() const
-{
-QT_WARNING_PUSH
-QT_WARNING_DISABLE_DEPRECATED
- return worldMatrix();
-QT_WARNING_POP
-}
-
-
-/*!
- \since 4.2
- \obsolete
-
- Returns the transformation matrix combining the current
- window/viewport and world transformation.
-
- It is advisable to use combinedTransform() instead of this
- function to preserve the properties of perspective transformations.
-
- \sa setWorldTransform(), setWindow(), setViewport()
-*/
-QMatrix QPainter::combinedMatrix() const
-{
- return combinedTransform().toAffine();
-}
-
-
-/*!
- \obsolete
-
- Returns the matrix that transforms from logical coordinates to
- device coordinates of the platform dependent paint device.
-
- \note It is advisable to use deviceTransform() instead of this
- function to preserve the properties of perspective transformations.
-
- This function is \e only needed when using platform painting
- commands on the platform dependent handle (Qt::HANDLE), and the
- platform does not do transformations nativly.
-
- The QPaintEngine::PaintEngineFeature enum can be queried to
- determine whether the platform performs the transformations or
- not.
-
- \sa worldMatrix(), QPaintEngine::hasFeature(),
-*/
-const QMatrix &QPainter::deviceMatrix() const
-{
- Q_D(const QPainter);
- if (!d->engine) {
- qWarning("QPainter::deviceMatrix: Painter not active");
- return d->fakeState()->transform.toAffine();
- }
- return d->state->matrix.toAffine();
-}
-
-/*!
- \obsolete
-
- Resets any transformations that were made using translate(), scale(),
- shear(), rotate(), setWorldMatrix(), setViewport() and
- setWindow().
-
- It is advisable to use resetTransform() instead of this function
- to preserve the properties of perspective transformations.
-
- \sa {QPainter#Coordinate Transformations}{Coordinate
- Transformations}
-*/
-
-void QPainter::resetMatrix()
-{
- resetTransform();
-}
-#endif
-
/*!
\since 4.2
@@ -3110,34 +2886,6 @@ bool QPainter::worldMatrixEnabled() const
return d->state->WxF;
}
-#if QT_DEPRECATED_SINCE(5, 13)
-/*!
- \obsolete
-
- Use setWorldMatrixEnabled() instead.
-
- \sa setWorldMatrixEnabled()
-*/
-
-void QPainter::setMatrixEnabled(bool enable)
-{
- setWorldMatrixEnabled(enable);
-}
-
-/*!
- \obsolete
-
- Use worldMatrixEnabled() instead
-
- \sa worldMatrixEnabled()
-*/
-
-bool QPainter::matrixEnabled() const
-{
- return worldMatrixEnabled();
-}
-#endif
-
/*!
Scales the coordinate system by (\a{sx}, \a{sy}).
@@ -3276,7 +3024,8 @@ void QPainter::setClipPath(const QPainterPath &path, Qt::ClipOperation op)
return;
}
- if ((!d->state->clipEnabled && op != Qt::NoClip))
+ bool simplifyClipOp = (paintEngine()->type() != QPaintEngine::Picture);
+ if (simplifyClipOp && (!d->state->clipEnabled && op != Qt::NoClip))
op = Qt::ReplaceClip;
if (d->extended) {
@@ -3289,7 +3038,7 @@ void QPainter::setClipPath(const QPainterPath &path, Qt::ClipOperation op)
return;
}
- if (d->state->clipOperation == Qt::NoClip && op == Qt::IntersectClip)
+ if (simplifyClipOp && d->state->clipOperation == Qt::NoClip && op == Qt::IntersectClip)
op = Qt::ReplaceClip;
d->state->clipPath = path;
@@ -3320,12 +3069,9 @@ void QPainter::strokePath(const QPainterPath &path, const QPen &pen)
if (path.isEmpty())
return;
- if (d->extended) {
- const QGradient *g = qpen_brush(pen).gradient();
- if (!g || g->coordinateMode() == QGradient::LogicalMode) {
- d->extended->stroke(qtVectorPathForPath(path), pen);
- return;
- }
+ if (d->extended && !needsEmulation(pen.brush())) {
+ d->extended->stroke(qtVectorPathForPath(path), pen);
+ return;
}
QBrush oldBrush = d->state->brush;
@@ -3363,12 +3109,9 @@ void QPainter::fillPath(const QPainterPath &path, const QBrush &brush)
if (path.isEmpty())
return;
- if (d->extended) {
- const QGradient *g = brush.gradient();
- if (!g || g->coordinateMode() == QGradient::LogicalMode) {
- d->extended->fill(qtVectorPathForPath(path), brush);
- return;
- }
+ if (d->extended && !needsEmulation(brush)) {
+ d->extended->fill(qtVectorPathForPath(path), brush);
+ return;
}
QBrush oldBrush = d->state->brush;
@@ -3630,14 +3373,14 @@ void QPainter::drawRects(const QRect *rects, int rectCount)
}
/*!
- \fn void QPainter::drawRects(const QVector<QRectF> &rectangles)
+ \fn void QPainter::drawRects(const QList<QRectF> &rectangles)
\overload
Draws the given \a rectangles using the current pen and brush.
*/
/*!
- \fn void QPainter::drawRects(const QVector<QRect> &rectangles)
+ \fn void QPainter::drawRects(const QList<QRect> &rectangles)
\overload
@@ -3796,7 +3539,7 @@ void QPainter::drawPoints(const QPoint *points, int pointCount)
\overload
- Draws the points in the vector \a points.
+ Draws the points in the vector \a points.
*/
/*!
@@ -3804,7 +3547,7 @@ void QPainter::drawPoints(const QPoint *points, int pointCount)
\overload
- Draws the points in the vector \a points.
+ Draws the points in the vector \a points.
*/
/*!
@@ -4099,7 +3842,7 @@ void QPainter::setFont(const QFont &font)
#ifdef QT_DEBUG_DRAW
if (qt_show_painter_debug_output)
- printf("QPainter::setFont(), family=%s, pointSize=%d\n", font.family().toLatin1().constData(), font.pointSize());
+ printf("QPainter::setFont(), family=%s, pointSize=%d\n", font.families().first().toLatin1().constData(), font.pointSize());
#endif
if (!d->engine) {
@@ -4159,8 +3902,10 @@ void QPainter::drawRoundedRect(const QRectF &rect, qreal xRadius, qreal yRadius,
#endif
Q_D(QPainter);
- if (!d->engine)
+ if (!d->engine) {
+ qWarning("QPainter::drawRoundedRect: Painter not active");
return;
+ }
if (xRadius <= 0 || yRadius <= 0) { // draw normal rectangle
drawRect(rect);
@@ -4195,54 +3940,6 @@ void QPainter::drawRoundedRect(const QRectF &rect, qreal xRadius, qreal yRadius,
Draws the given rectangle \a x, \a y, \a w, \a h with rounded corners.
*/
-#if QT_DEPRECATED_SINCE(5, 13)
-/*!
- \obsolete
-
- Draws a rectangle \a r with rounded corners.
-
- The \a xRnd and \a yRnd arguments specify how rounded the corners
- should be. 0 is angled corners, 99 is maximum roundedness.
-
- A filled rectangle has a size of r.size(). A stroked rectangle
- has a size of r.size() plus the pen width.
-
- \sa drawRoundedRect()
-*/
-void QPainter::drawRoundRect(const QRectF &r, int xRnd, int yRnd)
-{
- drawRoundedRect(r, xRnd, yRnd, Qt::RelativeSize);
-}
-
-
-/*!
- \fn void QPainter::drawRoundRect(const QRect &r, int xRnd = 25, int yRnd = 25)
-
- \overload
- \obsolete
-
- Draws the rectangle \a r with rounded corners.
-*/
-void QPainter::drawRoundRect(const QRect &rect, int xRnd, int yRnd)
-{
- drawRoundedRect(QRectF(rect), xRnd, yRnd, Qt::RelativeSize);
-}
-
-/*!
- \obsolete
-
- \fn QPainter::drawRoundRect(int x, int y, int w, int h, int xRnd, int yRnd)
-
- \overload
-
- Draws the rectangle \a x, \a y, \a w, \a h with rounded corners.
-*/
-void QPainter::drawRoundRect(int x, int y, int w, int h, int xRnd, int yRnd)
-{
- drawRoundedRect(QRectF(x, y, w, h), xRnd, yRnd, Qt::RelativeSize);
-}
-#endif
-
/*!
\fn void QPainter::drawEllipse(const QRectF &rectangle)
@@ -4269,8 +3966,10 @@ void QPainter::drawEllipse(const QRectF &r)
#endif
Q_D(QPainter);
- if (!d->engine)
+ if (!d->engine) {
+ qWarning("QPainter::drawEllipse: Painter not active");
return;
+ }
QRectF rect(r.normalized());
@@ -4310,8 +4009,10 @@ void QPainter::drawEllipse(const QRect &r)
#endif
Q_D(QPainter);
- if (!d->engine)
+ if (!d->engine) {
+ qWarning("QPainter::drawEllipse: Painter not active");
return;
+ }
QRect rect(r.normalized());
@@ -4397,8 +4098,10 @@ void QPainter::drawArc(const QRectF &r, int a, int alen)
#endif
Q_D(QPainter);
- if (!d->engine)
+ if (!d->engine) {
+ qWarning("QPainter::drawArc: Painter not active");
return;
+ }
QRectF rect = r.normalized();
@@ -4459,8 +4162,10 @@ void QPainter::drawPie(const QRectF &r, int a, int alen)
#endif
Q_D(QPainter);
- if (!d->engine)
+ if (!d->engine) {
+ qWarning("QPainter::drawPie: Painter not active");
return;
+ }
if (a > (360*16)) {
a = a % (360*16);
@@ -4528,8 +4233,10 @@ void QPainter::drawChord(const QRectF &r, int a, int alen)
#endif
Q_D(QPainter);
- if (!d->engine)
+ if (!d->engine) {
+ qWarning("QPainter::drawChord: Painter not active");
return;
+ }
QRectF rect = r.normalized();
@@ -4687,7 +4394,7 @@ void QPainter::drawLines(const QPoint *pointPairs, int lineCount)
/*!
- \fn void QPainter::drawLines(const QVector<QPointF> &pointPairs)
+ \fn void QPainter::drawLines(const QList<QPointF> &pointPairs)
\overload
Draws a line for each pair of points in the vector \a pointPairs
@@ -4696,7 +4403,7 @@ void QPainter::drawLines(const QPoint *pointPairs, int lineCount)
*/
/*!
- \fn void QPainter::drawLines(const QVector<QPoint> &pointPairs)
+ \fn void QPainter::drawLines(const QList<QPoint> &pointPairs)
\overload
Draws a line for each pair of points in the vector \a pointPairs
@@ -4704,7 +4411,7 @@ void QPainter::drawLines(const QPoint *pointPairs, int lineCount)
*/
/*!
- \fn void QPainter::drawLines(const QVector<QLineF> &lines)
+ \fn void QPainter::drawLines(const QList<QLineF> &lines)
\overload
Draws the set of lines defined by the list \a lines using the
@@ -4712,7 +4419,7 @@ void QPainter::drawLines(const QPoint *pointPairs, int lineCount)
*/
/*!
- \fn void QPainter::drawLines(const QVector<QLine> &lines)
+ \fn void QPainter::drawLines(const QList<QLine> &lines)
\overload
Draws the set of lines defined by the list \a lines using the
@@ -5608,40 +5315,31 @@ void QPainter::drawGlyphRun(const QPointF &position, const QGlyphRun &glyphRun)
fixedPointPositions[i] = QFixedPoint::fromPointF(processedPosition);
}
- d->drawGlyphs(glyphIndexes, fixedPointPositions.data(), count, fontD->fontEngine,
- glyphRun.overline(), glyphRun.underline(), glyphRun.strikeOut());
+ d->drawGlyphs(engineRequiresPretransformedGlyphPositions
+ ? d->state->transform().map(position)
+ : position,
+ glyphIndexes,
+ fixedPointPositions.data(),
+ count,
+ fontD->fontEngine,
+ glyphRun.overline(),
+ glyphRun.underline(),
+ glyphRun.strikeOut());
}
-void QPainterPrivate::drawGlyphs(const quint32 *glyphArray, QFixedPoint *positions,
+void QPainterPrivate::drawGlyphs(const QPointF &decorationPosition,
+ const quint32 *glyphArray,
+ QFixedPoint *positions,
int glyphCount,
- QFontEngine *fontEngine, bool overline, bool underline,
+ QFontEngine *fontEngine,
+ bool overline,
+ bool underline,
bool strikeOut)
{
Q_Q(QPainter);
updateState(state);
- QFixed leftMost;
- QFixed rightMost;
- QFixed baseLine;
- for (int i=0; i<glyphCount; ++i) {
- glyph_metrics_t gm = fontEngine->boundingBox(glyphArray[i]);
- if (i == 0 || leftMost > positions[i].x)
- leftMost = positions[i].x;
-
- // We don't support glyphs that do not share a common baseline. If this turns out to
- // be a relevant use case, then we need to find clusters of glyphs that share a baseline
- // and do a drawTextItemDecorations call per cluster.
- if (i == 0 || baseLine < positions[i].y)
- baseLine = positions[i].y;
-
- // We use the advance rather than the actual bounds to match the algorithm in drawText()
- if (i == 0 || rightMost < positions[i].x + gm.xoff)
- rightMost = positions[i].x + gm.xoff;
- }
-
- QFixed width = rightMost - leftMost;
-
if (extended != nullptr && state->matrix.isAffine()) {
QStaticTextItem staticTextItem;
staticTextItem.color = state->pen.color();
@@ -5675,21 +5373,15 @@ void QPainterPrivate::drawGlyphs(const quint32 *glyphArray, QFixedPoint *positio
engine->drawTextItem(QPointF(0, 0), textItem);
}
- QTextItemInt::RenderFlags flags;
- if (underline)
- flags |= QTextItemInt::Underline;
- if (overline)
- flags |= QTextItemInt::Overline;
- if (strikeOut)
- flags |= QTextItemInt::StrikeOut;
-
- drawTextItemDecoration(q, QPointF(leftMost.toReal(), baseLine.toReal()),
- fontEngine,
- nullptr, // textEngine
- (underline
- ? QTextCharFormat::SingleUnderline
- : QTextCharFormat::NoUnderline),
- flags, width.toReal(), QTextCharFormat());
+ qt_draw_decoration_for_glyphs(q,
+ decorationPosition,
+ glyphArray,
+ positions,
+ glyphCount,
+ fontEngine,
+ underline,
+ overline,
+ strikeOut);
}
#endif // QT_NO_RAWFONT
@@ -5769,9 +5461,13 @@ void QPainter::drawStaticText(const QPointF &topLeftPosition, const QStaticText
QStaticTextPrivate *staticText_d =
const_cast<QStaticTextPrivate *>(QStaticTextPrivate::get(&staticText));
- if (font() != staticText_d->font) {
+ QFontPrivate *fp = QFontPrivate::get(font());
+ QFontPrivate *stfp = QFontPrivate::get(staticText_d->font);
+ if (font() != staticText_d->font || fp == nullptr || stfp == nullptr || fp->dpi != stfp->dpi) {
staticText_d->font = font();
staticText_d->needsRelayout = true;
+ } else if (stfp->engineData == nullptr || stfp->engineData->fontCacheId != QFontCache::instance()->id()) {
+ staticText_d->needsRelayout = true;
}
QFontEngine *fe = staticText_d->font.d->engineForScript(QChar::Script_Common);
@@ -5869,9 +5565,15 @@ void QPainter::drawStaticText(const QPointF &topLeftPosition, const QStaticText
}
d->extended->drawStaticTextItem(item);
- qt_draw_decoration_for_glyphs(this, item->glyphs, item->glyphPositions,
- item->numGlyphs, item->fontEngine(), staticText_d->font,
- QTextCharFormat());
+ qt_draw_decoration_for_glyphs(this,
+ topLeftPosition,
+ item->glyphs,
+ item->glyphPositions,
+ item->numGlyphs,
+ item->fontEngine(),
+ staticText_d->font.underline(),
+ staticText_d->font.overline(),
+ staticText_d->font.strikeOut());
}
if (currentColor != oldPen.color())
setPen(oldPen);
@@ -5895,22 +5597,6 @@ void QPainter::drawText(const QPointF &p, const QString &str, int tf, int justif
if (!d->engine || str.isEmpty() || pen().style() == Qt::NoPen)
return;
-#if QT_DEPRECATED_SINCE(5, 11) && QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
- if (tf & Qt::TextBypassShaping) {
- // Skip complex shaping, shape using glyph advances only
- int len = str.length();
- int numGlyphs = len;
- QVarLengthGlyphLayoutArray glyphs(len);
- QFontEngine *fontEngine = d->state->font.d->engineForScript(QChar::Script_Common);
- if (!fontEngine->stringToCMap(str.data(), len, &glyphs, &numGlyphs, { }))
- Q_UNREACHABLE();
-
- QTextItemInt gf(glyphs, &d->state->font, str.data(), len, fontEngine);
- drawTextItem(p, gf);
- return;
- }
-#endif
-
QStackTextEngine engine(str, d->state->font);
engine.option.setTextDirection(d->state->layoutDirection);
if (tf & (Qt::TextForceLeftToRight|Qt::TextForceRightToLeft)) {
@@ -5919,7 +5605,7 @@ void QPainter::drawText(const QPointF &p, const QString &str, int tf, int justif
}
engine.itemize();
QScriptLine line;
- line.length = str.length();
+ line.length = str.size();
engine.shapeLine(line);
int nItems = engine.layoutData->items.size();
@@ -5974,7 +5660,7 @@ void QPainter::drawText(const QRect &r, int flags, const QString &str, QRect *br
Q_D(QPainter);
- if (!d->engine || str.length() == 0 || pen().style() == Qt::NoPen)
+ if (!d->engine || str.size() == 0 || pen().style() == Qt::NoPen)
return;
if (!d->extended)
@@ -6061,7 +5747,7 @@ void QPainter::drawText(const QRectF &r, int flags, const QString &str, QRectF *
Q_D(QPainter);
- if (!d->engine || str.length() == 0 || pen().style() == Qt::NoPen)
+ if (!d->engine || str.size() == 0 || pen().style() == Qt::NoPen)
return;
if (!d->extended)
@@ -6161,7 +5847,8 @@ void QPainter::drawText(const QRectF &r, int flags, const QString &str, QRectF *
\overload
Draws the given \a text in the \a rectangle specified using the \a option
- to control its positioning and orientation.
+ to control its positioning, direction, and orientation. The options given
+ in \a option override those set on the QPainter object itself.
By default, QPainter draws text anti-aliased.
@@ -6179,7 +5866,7 @@ void QPainter::drawText(const QRectF &r, const QString &text, const QTextOption
Q_D(QPainter);
- if (!d->engine || text.length() == 0 || pen().style() == Qt::NoPen)
+ if (!d->engine || text.size() == 0 || pen().style() == Qt::NoPen)
return;
if (!d->extended)
@@ -6219,7 +5906,7 @@ void QPainter::drawText(const QRectF &r, const QString &text, const QTextOption
It ignores the font set on the painter as the text item has one of its own.
The underline and strikeout parameters of the text items font are
- ignored aswell. You'll need to pass in the correct flags to get
+ ignored as well. You'll need to pass in the correct flags to get
underlining and strikeout.
*/
@@ -6227,7 +5914,7 @@ static QPixmap generateWavyPixmap(qreal maxRadius, const QPen &pen)
{
const qreal radiusBase = qMax(qreal(1), maxRadius);
- QString key = QLatin1String("WaveUnderline-")
+ QString key = "WaveUnderline-"_L1
% pen.color().name()
% HexString<qreal>(radiusBase)
% HexString<qreal>(pen.widthF());
@@ -6294,12 +5981,6 @@ static void drawTextItemDecoration(QPainter *painter, const QPointF &pos, const
QLineF line(qFloor(pos.x()), pos.y(), qFloor(pos.x() + width), pos.y());
- bool wasCompatiblePainting = painter->renderHints()
- & QPainter::Qt4CompatiblePainting;
-
- if (wasCompatiblePainting)
- painter->setRenderHint(QPainter::Qt4CompatiblePainting, false);
-
const qreal underlineOffset = fe->underlinePosition().toReal();
if (underlineStyle == QTextCharFormat::SpellCheckUnderline) {
@@ -6352,6 +6033,9 @@ static void drawTextItemDecoration(QPainter *painter, const QPointF &pos, const
if (flags & QTextItem::StrikeOut) {
QLineF strikeOutLine = line;
strikeOutLine.translate(0., - fe->ascent().toReal() / 3.);
+ QColor uc = charFormat.underlineColor();
+ if (uc.isValid())
+ pen.setColor(uc);
painter->setPen(pen);
if (textEngine)
textEngine->addStrikeOut(painter, strikeOutLine);
@@ -6362,6 +6046,9 @@ static void drawTextItemDecoration(QPainter *painter, const QPointF &pos, const
if (flags & QTextItem::Overline) {
QLineF overline = line;
overline.translate(0., - fe->ascent().toReal());
+ QColor uc = charFormat.underlineColor();
+ if (uc.isValid())
+ pen.setColor(uc);
painter->setPen(pen);
if (textEngine)
textEngine->addOverline(painter, overline);
@@ -6371,54 +6058,46 @@ static void drawTextItemDecoration(QPainter *painter, const QPointF &pos, const
painter->setPen(oldPen);
painter->setBrush(oldBrush);
-
- if (wasCompatiblePainting)
- painter->setRenderHint(QPainter::Qt4CompatiblePainting);
}
-Q_GUI_EXPORT void qt_draw_decoration_for_glyphs(QPainter *painter, const glyph_t *glyphArray,
- const QFixedPoint *positions, int glyphCount,
- QFontEngine *fontEngine, const QFont &font,
- const QTextCharFormat &charFormat)
+static void qt_draw_decoration_for_glyphs(QPainter *painter,
+ const QPointF &decorationPosition,
+ const glyph_t *glyphArray,
+ const QFixedPoint *positions,
+ int glyphCount,
+ QFontEngine *fontEngine,
+ bool underline,
+ bool overline,
+ bool strikeOut)
{
- if (!(font.underline() || font.strikeOut() || font.overline()))
+ if (!underline && !overline && !strikeOut)
return;
- QFixed leftMost;
- QFixed rightMost;
- QFixed baseLine;
- for (int i=0; i<glyphCount; ++i) {
- glyph_metrics_t gm = fontEngine->boundingBox(glyphArray[i]);
- if (i == 0 || leftMost > positions[i].x)
- leftMost = positions[i].x;
-
- // We don't support glyphs that do not share a common baseline. If this turns out to
- // be a relevant use case, then we need to find clusters of glyphs that share a baseline
- // and do a drawTextItemDecoration call per cluster.
- if (i == 0 || baseLine < positions[i].y)
- baseLine = positions[i].y;
-
- // We use the advance rather than the actual bounds to match the algorithm in drawText()
- if (i == 0 || rightMost < positions[i].x + gm.xoff)
- rightMost = positions[i].x + gm.xoff;
- }
-
- QFixed width = rightMost - leftMost;
QTextItem::RenderFlags flags;
-
- if (font.underline())
+ if (underline)
flags |= QTextItem::Underline;
- if (font.overline())
+ if (overline)
flags |= QTextItem::Overline;
- if (font.strikeOut())
+ if (strikeOut)
flags |= QTextItem::StrikeOut;
- drawTextItemDecoration(painter, QPointF(leftMost.toReal(), baseLine.toReal()),
+ bool rtl = positions[glyphCount - 1].x < positions[0].x;
+ QFixed baseline = positions[0].y;
+ glyph_metrics_t gm = fontEngine->boundingBox(glyphArray[rtl ? 0 : glyphCount - 1]);
+
+ qreal width = rtl
+ ? (positions[0].x + gm.xoff - positions[glyphCount - 1].x).toReal()
+ : (positions[glyphCount - 1].x + gm.xoff - positions[0].x).toReal();
+
+ drawTextItemDecoration(painter,
+ QPointF(decorationPosition.x(), baseline.toReal()),
fontEngine,
nullptr, // textEngine
- font.underline() ? QTextCharFormat::SingleUnderline
- : QTextCharFormat::NoUnderline, flags,
- width.toReal(), charFormat);
+ underline ? QTextCharFormat::SingleUnderline
+ : QTextCharFormat::NoUnderline,
+ flags,
+ width,
+ QTextCharFormat());
}
void QPainter::drawTextItem(const QPointF &p, const QTextItem &ti)
@@ -6678,7 +6357,7 @@ QRectF QPainter::boundingRect(const QRectF &r, const QString &text, const QTextO
{
Q_D(QPainter);
- if (!d->engine || text.length() == 0)
+ if (!d->engine || text.size() == 0)
return QRectF(r.x(),r.y(), 0,0);
QRectF br;
@@ -6826,7 +6505,9 @@ void QPainter::drawTiledPixmap(const QRectF &r, const QPixmap &pixmap, const QPo
painted on a widget or pixmap can also be stored in a picture.
This function does exactly the same as QPicture::play() when
- called with \a point = QPoint(0, 0).
+ called with \a point = QPointF(0, 0).
+
+ \note The state of the painter is preserved by this function.
\table 100%
\row
@@ -6841,8 +6522,10 @@ void QPainter::drawPicture(const QPointF &p, const QPicture &picture)
{
Q_D(QPainter);
- if (!d->engine)
+ if (!d->engine) {
+ qWarning("QPainter::drawPicture: Painter not active");
return;
+ }
if (!d->extended)
d->updateState(d->state);
@@ -6953,15 +6636,14 @@ void QPainter::fillRect(const QRectF &r, const QBrush &brush)
{
Q_D(QPainter);
- if (!d->engine)
+ if (!d->engine) {
+ qWarning("QPainter::fillRect: Painter not active");
return;
+ }
- if (d->extended) {
- const QGradient *g = brush.gradient();
- if (!g || g->coordinateMode() == QGradient::LogicalMode) {
- d->extended->fillRect(r, brush);
- return;
- }
+ if (d->extended && !needsEmulation(brush)) {
+ d->extended->fillRect(r, brush);
+ return;
}
QPen oldPen = pen();
@@ -6991,15 +6673,14 @@ void QPainter::fillRect(const QRect &r, const QBrush &brush)
{
Q_D(QPainter);
- if (!d->engine)
+ if (!d->engine) {
+ qWarning("QPainter::fillRect: Painter not active");
return;
+ }
- if (d->extended) {
- const QGradient *g = brush.gradient();
- if (!g || g->coordinateMode() == QGradient::LogicalMode) {
- d->extended->fillRect(r, brush);
- return;
- }
+ if (d->extended && !needsEmulation(brush)) {
+ d->extended->fillRect(r, brush);
+ return;
}
QPen oldPen = pen();
@@ -7032,8 +6713,10 @@ void QPainter::fillRect(const QRect &r, const QColor &color)
{
Q_D(QPainter);
- if (!d->engine)
+ if (!d->engine) {
+ qWarning("QPainter::fillRect: Painter not active");
return;
+ }
if (d->extended) {
d->extended->fillRect(r, color);
@@ -7401,89 +7084,6 @@ void QPainter::setViewTransformEnabled(bool enable)
d->updateMatrix();
}
-#if QT_DEPRECATED_SINCE(5, 13)
-/*!
- \threadsafe
-
- \obsolete
-
- Please use QWidget::render() instead.
-
- Redirects all paint commands for the given paint \a device, to the
- \a replacement device. The optional point \a offset defines an
- offset within the source device.
-
- The redirection will not be effective until the begin() function
- has been called; make sure to call end() for the given \a
- device's painter (if any) before redirecting. Call
- restoreRedirected() to restore the previous redirection.
-
- \warning Making use of redirections in the QPainter API implies
- that QPainter::begin() and QPaintDevice destructors need to hold
- a mutex for a short period. This can impact performance. Use of
- QWidget::render is strongly encouraged.
-
- \sa redirected(), restoreRedirected()
-*/
-void QPainter::setRedirected(const QPaintDevice *device,
- QPaintDevice *replacement,
- const QPoint &offset)
-{
- Q_ASSERT(device != nullptr);
- Q_UNUSED(device)
- Q_UNUSED(replacement)
- Q_UNUSED(offset)
- qWarning("QPainter::setRedirected(): ignoring call to deprecated function, use QWidget::render() instead");
-}
-
-/*!
- \threadsafe
-
- \obsolete
-
- Using QWidget::render() obsoletes the use of this function.
-
- Restores the previous redirection for the given \a device after a
- call to setRedirected().
-
- \warning Making use of redirections in the QPainter API implies
- that QPainter::begin() and QPaintDevice destructors need to hold
- a mutex for a short period. This can impact performance. Use of
- QWidget::render is strongly encouraged.
-
- \sa redirected()
- */
-void QPainter::restoreRedirected(const QPaintDevice *device)
-{
- Q_UNUSED(device)
- qWarning("QPainter::restoreRedirected(): ignoring call to deprecated function, use QWidget::render() instead");
-}
-
-/*!
- \threadsafe
-
- \obsolete
-
- Using QWidget::render() obsoletes the use of this function.
-
- Returns the replacement for given \a device. The optional out
- parameter \a offset returns the offset within the replaced device.
-
- \warning Making use of redirections in the QPainter API implies
- that QPainter::begin() and QPaintDevice destructors need to hold
- a mutex for a short period. This can impact performance. Use of
- QWidget::render is strongly encouraged.
-
- \sa setRedirected(), restoreRedirected()
-*/
-QPaintDevice *QPainter::redirected(const QPaintDevice *device, QPoint *offset)
-{
- Q_UNUSED(device)
- Q_UNUSED(offset)
- return nullptr;
-}
-#endif
-
void qt_format_text(const QFont &fnt, const QRectF &_r,
int tf, const QString& str, QRectF *brect,
int tabstops, int *ta, int tabarraylen,
@@ -7555,28 +7155,28 @@ start_lengthVariant:
// compatible behaviour to the old implementation. Replace
// tabs by spaces
int old_offset = offset;
- for (; offset < text.length(); offset++) {
+ for (; offset < text.size(); offset++) {
QChar chr = text.at(offset);
- if (chr == QLatin1Char('\r') || (singleline && chr == QLatin1Char('\n'))) {
- text[offset] = QLatin1Char(' ');
- } else if (chr == QLatin1Char('\n')) {
+ if (chr == u'\r' || (singleline && chr == u'\n')) {
+ text[offset] = u' ';
+ } else if (chr == u'\n') {
text[offset] = QChar::LineSeparator;
- } else if (chr == QLatin1Char('&')) {
+ } else if (chr == u'&') {
++maxUnderlines;
- } else if (chr == QLatin1Char('\t')) {
+ } else if (chr == u'\t') {
if (!expandtabs) {
- text[offset] = QLatin1Char(' ');
+ text[offset] = u' ';
} else if (!tabarraylen && !tabstops) {
- tabstops = qRound(fm.horizontalAdvance(QLatin1Char('x'))*8);
+ tabstops = qRound(fm.horizontalAdvance(u'x')*8);
}
- } else if (chr == QChar(ushort(0x9c))) {
+ } else if (chr == u'\x9c') {
// string with multiple length variants
hasMoreLengthVariants = true;
break;
}
}
- QVector<QTextLayout::FormatRange> underlineFormats;
+ QList<QTextLayout::FormatRange> underlineFormats;
int length = offset - old_offset;
if ((hidemnmemonic || showmnemonic) && maxUnderlines > 0) {
QChar *cout = text.data() + old_offset;
@@ -7584,13 +7184,13 @@ start_lengthVariant:
QChar *cin = cout;
int l = length;
while (l) {
- if (*cin == QLatin1Char('&')) {
+ if (*cin == u'&') {
++cin;
--length;
--l;
if (!l)
break;
- if (*cin != QLatin1Char('&') && !hidemnmemonic && !(tf & Qt::TextDontPrint)) {
+ if (*cin != u'&' && !hidemnmemonic && !(tf & Qt::TextDontPrint)) {
QTextLayout::FormatRange range;
range.start = cout - cout0;
range.length = 1;
@@ -7598,9 +7198,9 @@ start_lengthVariant:
underlineFormats.append(range);
}
#ifdef Q_OS_MAC
- } else if (hidemnmemonic && *cin == QLatin1Char('(') && l >= 4 &&
- cin[1] == QLatin1Char('&') && cin[2] != QLatin1Char('&') &&
- cin[3] == QLatin1Char(')')) {
+ } else if (hidemnmemonic && *cin == u'(' && l >= 4 &&
+ cin[1] == u'&' && cin[2] != u'&' &&
+ cin[3] == u')') {
int n = 0;
while ((cout - n) > cout0 && (cout - n - 1)->isSpace())
++n;
@@ -7661,7 +7261,7 @@ start_lengthVariant:
qreal lineWidth = 0x01000000;
if (wordwrap || (tf & Qt::TextJustificationForced))
lineWidth = qMax<qreal>(0, r.width());
- if(!wordwrap)
+ if (!wordwrap)
tf |= Qt::TextIncludeTrailingSpaces;
textLayout.beginLayout();
@@ -8085,31 +7685,6 @@ QFont QPaintEngineState::font() const
return static_cast<const QPainterState *>(this)->font;
}
-#if QT_DEPRECATED_SINCE(5, 13)
-/*!
- \since 4.2
- \obsolete
-
- Returns the matrix in the current paint engine
- state.
-
- \note It is advisable to use transform() instead of this function to
- preserve the properties of perspective transformations.
-
- This variable should only be used when the state() returns a
- combination which includes the QPaintEngine::DirtyTransform flag.
-
- \sa state(), QPaintEngine::updateState()
-*/
-
-QMatrix QPaintEngineState::matrix() const
-{
- const QPainterState *st = static_cast<const QPainterState *>(this);
-
- return st->matrix.toAffine();
-}
-#endif
-
/*!
\since 4.3
@@ -8590,3 +8165,5 @@ void qt_draw_helper(QPainterPrivate *p, const QPainterPath &path, QPainterPrivat
}
QT_END_NAMESPACE
+
+#include "moc_qpainter.cpp"
diff --git a/src/gui/painting/qpainter.h b/src/gui/painting/qpainter.h
index 3394da63c7..7bcacb4bca 100644
--- a/src/gui/painting/qpainter.h
+++ b/src/gui/painting/qpainter.h
@@ -1,41 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the QtGui module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#ifndef QPAINTER_H
#define QPAINTER_H
@@ -48,12 +12,12 @@
#include <QtGui/qpixmap.h>
#include <QtGui/qimage.h>
#include <QtGui/qtextoption.h>
+#include <memory>
#ifndef QT_INCLUDE_COMPAT
#include <QtGui/qpolygon.h>
#include <QtGui/qpen.h>
#include <QtGui/qbrush.h>
-#include <QtGui/qmatrix.h>
#include <QtGui/qtransform.h>
#include <QtGui/qfontinfo.h>
#include <QtGui/qfontmetrics.h>
@@ -72,7 +36,6 @@ class QPen;
class QPolygon;
class QTextItem;
class QTextEngine;
-class QMatrix;
class QTransform;
class QStaticText;
class QGlyphRun;
@@ -89,14 +52,11 @@ public:
Antialiasing = 0x01,
TextAntialiasing = 0x02,
SmoothPixmapTransform = 0x04,
-#if QT_DEPRECATED_SINCE(5, 14)
- HighQualityAntialiasing Q_DECL_ENUMERATOR_DEPRECATED_X("Use Antialiasing instead") = 0x08,
- NonCosmeticDefaultPen Q_DECL_ENUMERATOR_DEPRECATED_X("Default pen is non-cosmetic now") = 0x10,
-#endif
- Qt4CompatiblePainting = 0x20,
+ VerticalSubpixelPositioning = 0x08,
LosslessImageRendering = 0x40,
+ NonCosmeticBrushPatterns = 0x80
};
- Q_FLAG(RenderHint)
+ Q_ENUM(RenderHint)
Q_DECLARE_FLAGS(RenderHints, RenderHint)
Q_FLAG(RenderHints)
@@ -134,11 +94,6 @@ public:
bool end();
bool isActive() const;
-#if QT_DEPRECATED_SINCE(5, 13)
- QT_DEPRECATED_X("Use begin(QPaintDevice*) instead")
- void initFrom(const QPaintDevice *device);
-#endif
-
enum CompositionMode {
CompositionMode_SourceOver,
CompositionMode_DestinationOver,
@@ -237,35 +192,11 @@ public:
void restore();
// XForm functions
-#if QT_DEPRECATED_SINCE(5, 13)
- QT_DEPRECATED_X("Use setTransform() instead")
- void setMatrix(const QMatrix &matrix, bool combine = false);
- QT_DEPRECATED_X("Use transform() instead")
- const QMatrix &matrix() const;
- QT_DEPRECATED_X("Use deviceTransform() instead")
- const QMatrix &deviceMatrix() const;
- QT_DEPRECATED_X("Use resetTransform() instead")
- void resetMatrix();
-#endif
-
void setTransform(const QTransform &transform, bool combine = false);
const QTransform &transform() const;
const QTransform &deviceTransform() const;
void resetTransform();
-#if QT_DEPRECATED_SINCE(5, 13)
- QT_DEPRECATED_X("Use setWorldTransform() instead")
- void setWorldMatrix(const QMatrix &matrix, bool combine = false);
- QT_DEPRECATED_X("Use worldTransform() instead")
- const QMatrix &worldMatrix() const;
- QT_DEPRECATED_X("Use combinedTransform() instead")
- QMatrix combinedMatrix() const;
- QT_DEPRECATED_X("Use setWorldMatrixEnabled() instead")
- void setMatrixEnabled(bool enabled);
- QT_DEPRECATED_X("Use worldMatrixEnabled() instead")
- bool matrixEnabled() const;
-#endif
-
void setWorldTransform(const QTransform &matrix, bool combine = false);
const QTransform &worldTransform() const;
@@ -314,22 +245,22 @@ public:
inline void drawLine(const QPointF &p1, const QPointF &p2);
void drawLines(const QLineF *lines, int lineCount);
- inline void drawLines(const QVector<QLineF> &lines);
+ inline void drawLines(const QList<QLineF> &lines);
void drawLines(const QPointF *pointPairs, int lineCount);
- inline void drawLines(const QVector<QPointF> &pointPairs);
+ inline void drawLines(const QList<QPointF> &pointPairs);
void drawLines(const QLine *lines, int lineCount);
- inline void drawLines(const QVector<QLine> &lines);
+ inline void drawLines(const QList<QLine> &lines);
void drawLines(const QPoint *pointPairs, int lineCount);
- inline void drawLines(const QVector<QPoint> &pointPairs);
+ inline void drawLines(const QList<QPoint> &pointPairs);
inline void drawRect(const QRectF &rect);
inline void drawRect(int x1, int y1, int w, int h);
inline void drawRect(const QRect &rect);
void drawRects(const QRectF *rects, int rectCount);
- inline void drawRects(const QVector<QRectF> &rectangles);
+ inline void drawRects(const QList<QRectF> &rectangles);
void drawRects(const QRect *rects, int rectCount);
- inline void drawRects(const QVector<QRect> &rectangles);
+ inline void drawRects(const QList<QRect> &rectangles);
void drawEllipse(const QRectF &r);
void drawEllipse(const QRect &r);
@@ -372,15 +303,6 @@ public:
inline void drawRoundedRect(const QRect &rect, qreal xRadius, qreal yRadius,
Qt::SizeMode mode = Qt::AbsoluteSize);
-#if QT_DEPRECATED_SINCE(5, 13)
- QT_DEPRECATED_X("Use drawRoundedRect(..., Qt::RelativeSize) instead")
- void drawRoundRect(const QRectF &r, int xround = 25, int yround = 25);
- QT_DEPRECATED_X("Use drawRoundedRect(..., Qt::RelativeSize) instead")
- void drawRoundRect(int x, int y, int w, int h, int = 25, int = 25);
- QT_DEPRECATED_X("Use drawRoundedRect(..., Qt::RelativeSize) instead")
- void drawRoundRect(const QRect &r, int xround = 25, int yround = 25);
-#endif
-
void drawTiledPixmap(const QRectF &rect, const QPixmap &pm, const QPointF &offset = QPointF());
inline void drawTiledPixmap(int x, int y, int w, int h, const QPixmap &, int sx=0, int sy=0);
inline void drawTiledPixmap(const QRect &, const QPixmap &, const QPoint & = QPoint());
@@ -482,27 +404,17 @@ public:
void setRenderHint(RenderHint hint, bool on = true);
void setRenderHints(RenderHints hints, bool on = true);
RenderHints renderHints() const;
- inline bool testRenderHint(RenderHint hint) const { return renderHints() & hint; }
+ inline bool testRenderHint(RenderHint hint) const { return bool(renderHints() & hint); }
QPaintEngine *paintEngine() const;
-#if QT_DEPRECATED_SINCE(5, 13)
- QT_DEPRECATED_X("Use QWidget::render() instead")
- static void setRedirected(const QPaintDevice *device, QPaintDevice *replacement,
- const QPoint& offset = QPoint());
- QT_DEPRECATED_X("Use QWidget::render() instead")
- static QPaintDevice *redirected(const QPaintDevice *device, QPoint *offset = nullptr);
- QT_DEPRECATED_X("Use QWidget::render() instead")
- static void restoreRedirected(const QPaintDevice *device);
-#endif
-
void beginNativePainting();
void endNativePainting();
private:
Q_DISABLE_COPY(QPainter)
- QScopedPointer<QPainterPrivate> d_ptr;
+ std::unique_ptr<QPainterPrivate> d_ptr;
friend class QWidget;
friend class QFontEngine;
@@ -554,54 +466,54 @@ inline void QPainter::drawLine(const QPointF &p1, const QPointF &p2)
drawLine(QLineF(p1, p2));
}
-inline void QPainter::drawLines(const QVector<QLineF> &lines)
+inline void QPainter::drawLines(const QList<QLineF> &lines)
{
- drawLines(lines.constData(), lines.size());
+ drawLines(lines.constData(), int(lines.size()));
}
-inline void QPainter::drawLines(const QVector<QLine> &lines)
+inline void QPainter::drawLines(const QList<QLine> &lines)
{
- drawLines(lines.constData(), lines.size());
+ drawLines(lines.constData(), int(lines.size()));
}
-inline void QPainter::drawLines(const QVector<QPointF> &pointPairs)
+inline void QPainter::drawLines(const QList<QPointF> &pointPairs)
{
- drawLines(pointPairs.constData(), pointPairs.size() / 2);
+ drawLines(pointPairs.constData(), int(pointPairs.size() / 2));
}
-inline void QPainter::drawLines(const QVector<QPoint> &pointPairs)
+inline void QPainter::drawLines(const QList<QPoint> &pointPairs)
{
- drawLines(pointPairs.constData(), pointPairs.size() / 2);
+ drawLines(pointPairs.constData(), int(pointPairs.size() / 2));
}
inline void QPainter::drawPolyline(const QPolygonF &polyline)
{
- drawPolyline(polyline.constData(), polyline.size());
+ drawPolyline(polyline.constData(), int(polyline.size()));
}
inline void QPainter::drawPolyline(const QPolygon &polyline)
{
- drawPolyline(polyline.constData(), polyline.size());
+ drawPolyline(polyline.constData(), int(polyline.size()));
}
inline void QPainter::drawPolygon(const QPolygonF &polygon, Qt::FillRule fillRule)
{
- drawPolygon(polygon.constData(), polygon.size(), fillRule);
+ drawPolygon(polygon.constData(), int(polygon.size()), fillRule);
}
inline void QPainter::drawPolygon(const QPolygon &polygon, Qt::FillRule fillRule)
{
- drawPolygon(polygon.constData(), polygon.size(), fillRule);
+ drawPolygon(polygon.constData(), int(polygon.size()), fillRule);
}
inline void QPainter::drawConvexPolygon(const QPolygonF &poly)
{
- drawConvexPolygon(poly.constData(), poly.size());
+ drawConvexPolygon(poly.constData(), int(poly.size()));
}
inline void QPainter::drawConvexPolygon(const QPolygon &poly)
{
- drawConvexPolygon(poly.constData(), poly.size());
+ drawConvexPolygon(poly.constData(), int(poly.size()));
}
inline void QPainter::drawRect(const QRectF &rect)
@@ -620,14 +532,14 @@ inline void QPainter::drawRect(const QRect &r)
drawRects(&r, 1);
}
-inline void QPainter::drawRects(const QVector<QRectF> &rects)
+inline void QPainter::drawRects(const QList<QRectF> &rects)
{
- drawRects(rects.constData(), rects.size());
+ drawRects(rects.constData(), int(rects.size()));
}
-inline void QPainter::drawRects(const QVector<QRect> &rects)
+inline void QPainter::drawRects(const QList<QRect> &rects)
{
- drawRects(rects.constData(), rects.size());
+ drawRects(rects.constData(), int(rects.size()));
}
inline void QPainter::drawPoint(const QPointF &p)
@@ -648,12 +560,12 @@ inline void QPainter::drawPoint(const QPoint &p)
inline void QPainter::drawPoints(const QPolygonF &points)
{
- drawPoints(points.constData(), points.size());
+ drawPoints(points.constData(), int(points.size()));
}
inline void QPainter::drawPoints(const QPolygon &points)
{
- drawPoints(points.constData(), points.size());
+ drawPoints(points.constData(), int(points.size()));
}
inline void QPainter::drawRoundedRect(int x, int y, int w, int h, qreal xRadius, qreal yRadius,
diff --git a/src/gui/painting/qpainter_p.h b/src/gui/painting/qpainter_p.h
index 285bd90502..0ddd78fb2a 100644
--- a/src/gui/painting/qpainter_p.h
+++ b/src/gui/painting/qpainter_p.h
@@ -1,41 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the QtGui module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#ifndef QPAINTER_P_H
#define QPAINTER_P_H
@@ -59,13 +23,15 @@
#include "QtGui/qfont.h"
#include "QtGui/qpen.h"
#include "QtGui/qregion.h"
-#include "QtGui/qmatrix.h"
#include "QtGui/qpainter.h"
#include "QtGui/qpainterpath.h"
#include "QtGui/qpaintengine.h"
#include <private/qpen_p.h>
+#include <memory>
+#include <stack>
+
QT_BEGIN_NAMESPACE
class QPaintEngine;
@@ -101,7 +67,7 @@ inline bool qbrush_has_transform(const QBrush &b) { return data_ptr(b)->transfor
class QPainterClipInfo
{
public:
- QPainterClipInfo() {} // for QVector, don't use
+ QPainterClipInfo() { } // for QList, don't use
enum ClipType { RegionClip, PathClip, RectClip, RectFClip };
QPainterClipInfo(const QPainterPath &p, Qt::ClipOperation op, const QTransform &m) :
@@ -139,7 +105,7 @@ public:
};
-Q_DECLARE_TYPEINFO(QPainterClipInfo, Q_MOVABLE_TYPE);
+Q_DECLARE_TYPEINFO(QPainterClipInfo, Q_RELOCATABLE_TYPE);
class Q_GUI_EXPORT QPainterState : public QPaintEngineState
{
@@ -159,7 +125,7 @@ public:
QPainterPath clipPath;
Qt::ClipOperation clipOperation = Qt::NoClip;
QPainter::RenderHints renderHints;
- QVector<QPainterClipInfo> clipInfo; // ### Make me smaller and faster to copy around...
+ QList<QPainterClipInfo> clipInfo; // ### Make me smaller and faster to copy around...
QTransform worldMatrix; // World transformation matrix, not window and viewport
QTransform matrix; // Complete transformation matrix,
QTransform redirectionMatrix;
@@ -192,28 +158,29 @@ class QPainterPrivate
{
Q_DECLARE_PUBLIC(QPainter)
public:
- QPainterPrivate(QPainter *painter)
- : q_ptr(painter), d_ptrs(nullptr), state(nullptr), dummyState(nullptr), txinv(0), inDestructor(false), d_ptrs_size(0),
- refcount(1), device(nullptr), original_device(nullptr), helper_device(nullptr), engine(nullptr), emulationEngine(nullptr),
- extended(nullptr)
- {
- }
-
+ explicit QPainterPrivate(QPainter *painter);
~QPainterPrivate();
QPainter *q_ptr;
- QPainterPrivate **d_ptrs;
-
- QPainterState *state;
- QVarLengthArray<QPainterState *, 8> states;
+ // Allocate space for 4 d-pointers (enough for up to 4 sub-sequent
+ // redirections within the same paintEvent(), which should be enough
+ // in 99% of all cases). E.g: A renders B which renders C which renders D.
+ static constexpr qsizetype NDPtrs = 4;
+ QVarLengthArray<QPainterPrivate*, NDPtrs> d_ptrs;
+
+ std::unique_ptr<QPainterState> state;
+ template <typename T, std::size_t N = 8>
+ struct SmallStack : std::stack<T, QVarLengthArray<T, N>> {
+ void clear() { this->c.clear(); }
+ };
+ SmallStack<std::unique_ptr<QPainterState>> savedStates;
- mutable QPainterDummyState *dummyState;
+ mutable std::unique_ptr<QPainterDummyState> dummyState;
QTransform invMatrix;
uint txinv:1;
uint inDestructor : 1;
- uint d_ptrs_size;
- uint refcount;
+ uint refcount = 1;
enum DrawOperation { StrokeDraw = 0x1,
FillDraw = 0x2,
@@ -222,13 +189,14 @@ public:
QPainterDummyState *fakeState() const {
if (!dummyState)
- dummyState = new QPainterDummyState();
- return dummyState;
+ dummyState = std::make_unique<QPainterDummyState>();
+ return dummyState.get();
}
void updateEmulationSpecifier(QPainterState *s);
void updateStateImpl(QPainterState *state);
void updateState(QPainterState *state);
+ void updateState(std::unique_ptr<QPainterState> &state) { updateState(state.get()); }
void draw_helper(const QPainterPath &path, DrawOperation operation = StrokeAndFillDraw);
void drawStretchedGradient(const QPainterPath &path, DrawOperation operation);
@@ -236,7 +204,7 @@ public:
void drawTextItem(const QPointF &p, const QTextItem &_ti, QTextEngine *textEngine);
#if !defined(QT_NO_RAWFONT)
- void drawGlyphs(const quint32 *glyphArray, QFixedPoint *positionArray, int glyphCount,
+ void drawGlyphs(const QPointF &decorationPosition, const quint32 *glyphArray, QFixedPoint *positionArray, int glyphCount,
QFontEngine *fontEngine, bool overline = false, bool underline = false,
bool strikeOut = false);
#endif
@@ -248,7 +216,7 @@ public:
static QPainterPrivate *get(QPainter *painter)
{
- return painter->d_ptr.data();
+ return painter->d_ptr.get();
}
QTransform viewTransform() const;
@@ -258,12 +226,21 @@ public:
void detachPainterPrivate(QPainter *q);
void initFrom(const QPaintDevice *device);
- QPaintDevice *device;
- QPaintDevice *original_device;
- QPaintDevice *helper_device;
- QPaintEngine *engine;
- QEmulationPaintEngine *emulationEngine;
- QPaintEngineEx *extended;
+ QPaintDevice *device = nullptr;
+ QPaintDevice *original_device = nullptr;
+ QPaintDevice *helper_device = nullptr;
+
+ struct QPaintEngineDestructor {
+ void operator()(QPaintEngine *pe) const noexcept
+ {
+ if (pe && pe->autoDestruct())
+ delete pe;
+ }
+ };
+ std::unique_ptr<QPaintEngine, QPaintEngineDestructor> engine;
+
+ std::unique_ptr<QEmulationPaintEngine> emulationEngine;
+ QPaintEngineEx *extended = nullptr;
QBrush colorBrush; // for fill with solid color
};
@@ -271,10 +248,6 @@ Q_GUI_EXPORT void qt_draw_helper(QPainterPrivate *p, const QPainterPath &path, Q
QString qt_generate_brush_key(const QBrush &brush);
-inline bool qt_pen_is_cosmetic(const QPen &pen, QPainter::RenderHints hints)
-{
- return pen.isCosmetic() || (const_cast<QPen &>(pen).data_ptr()->defaultWidth && (hints & QPainter::Qt4CompatiblePainting));
-}
QT_END_NAMESPACE
diff --git a/src/gui/painting/qpainterpath.cpp b/src/gui/painting/qpainterpath.cpp
index 17d8b863ab..8d23d167b0 100644
--- a/src/gui/painting/qpainterpath.cpp
+++ b/src/gui/painting/qpainterpath.cpp
@@ -1,41 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the QtGui module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#include "qpainterpath.h"
#include "qpainterpath_p.h"
@@ -44,7 +8,6 @@
#include <qdebug.h>
#include <qiodevice.h>
#include <qlist.h>
-#include <qmatrix.h>
#include <qpen.h>
#include <qpolygon.h>
#include <qtextlayout.h>
@@ -89,17 +52,6 @@ static bool hasValidCoords(QRectF r)
return isValidCoord(r.x()) && isValidCoord(r.y()) && isValidCoord(r.width()) && isValidCoord(r.height());
}
-struct QPainterPathPrivateDeleter
-{
- static inline void cleanup(QPainterPathPrivate *d)
- {
- // note - we must downcast to QPainterPathData since QPainterPathPrivate
- // has a non-virtual destructor!
- if (d && !d->ref.deref())
- delete static_cast<QPainterPathData *>(d);
- }
-};
-
// This value is used to determine the length of control point vectors
// when approximating arc segments as curves. The factor is multiplied
// with the radius of the circle.
@@ -557,12 +509,7 @@ QPainterPath::QPainterPath() noexcept
\sa operator=()
*/
-QPainterPath::QPainterPath(const QPainterPath &other)
- : d_ptr(other.d_ptr.data())
-{
- if (d_ptr)
- d_ptr->ref.ref();
-}
+QPainterPath::QPainterPath(const QPainterPath &other) = default;
/*!
Creates a QPainterPath object with the given \a startPoint as its
@@ -570,34 +517,22 @@ QPainterPath::QPainterPath(const QPainterPath &other)
*/
QPainterPath::QPainterPath(const QPointF &startPoint)
- : d_ptr(new QPainterPathData)
+ : d_ptr(new QPainterPathPrivate(startPoint))
{
- Element e = { startPoint.x(), startPoint.y(), MoveToElement };
- d_func()->elements << e;
}
void QPainterPath::detach()
{
- if (d_ptr->ref.loadRelaxed() != 1)
- detach_helper();
+ d_ptr.detach();
setDirty(true);
}
/*!
\internal
*/
-void QPainterPath::detach_helper()
-{
- QPainterPathPrivate *data = new QPainterPathData(*d_func());
- d_ptr.reset(data);
-}
-
-/*!
- \internal
-*/
void QPainterPath::ensureData_helper()
{
- QPainterPathPrivate *data = new QPainterPathData;
+ QPainterPathPrivate *data = new QPainterPathPrivate;
data->elements.reserve(16);
QPainterPath::Element e = { 0, 0, QPainterPath::MoveToElement };
data->elements << e;
@@ -614,12 +549,8 @@ void QPainterPath::ensureData_helper()
*/
QPainterPath &QPainterPath::operator=(const QPainterPath &other)
{
- if (other.d_func() != d_func()) {
- QPainterPathPrivate *data = other.d_func();
- if (data)
- data->ref.ref();
- d_ptr.reset(data);
- }
+ QPainterPath copy(other);
+ swap(copy);
return *this;
}
@@ -669,7 +600,7 @@ void QPainterPath::clear()
Attempts to allocate memory for at least \a size elements.
- \sa clear(), capacity(), QVector::reserve()
+ \sa clear(), capacity(), QList::reserve()
\since 5.13
*/
void QPainterPath::reserve(int size)
@@ -754,7 +685,7 @@ void QPainterPath::moveTo(const QPointF &p)
ensureData();
detach();
- QPainterPathData *d = d_func();
+ QPainterPathPrivate *d = d_func();
Q_ASSERT(!d->elements.isEmpty());
d->require_moveTo = false;
@@ -804,7 +735,7 @@ void QPainterPath::lineTo(const QPointF &p)
ensureData();
detach();
- QPainterPathData *d = d_func();
+ QPainterPathPrivate *d = d_func();
Q_ASSERT(!d->elements.isEmpty());
d->maybeMoveTo();
if (p == QPointF(d->elements.constLast()))
@@ -863,7 +794,7 @@ void QPainterPath::cubicTo(const QPointF &c1, const QPointF &c2, const QPointF &
ensureData();
detach();
- QPainterPathData *d = d_func();
+ QPainterPathPrivate *d = d_func();
Q_ASSERT(!d->elements.isEmpty());
@@ -1202,6 +1133,9 @@ void QPainterPath::addEllipse(const QRectF &boundingRect)
that the left end of the text's baseline lies at the specified \a
point.
+ Some fonts may yield overlapping subpaths and will require the
+ \c Qt::WindingFill fill rule for correct rendering.
+
\table 100%
\row
\li \inlineimage qpainterpath-addtext.png
@@ -1210,7 +1144,7 @@ void QPainterPath::addEllipse(const QRectF &boundingRect)
\endtable
\sa QPainter::drawText(), {QPainterPath#Composing a
- QPainterPath}{Composing a QPainterPath}
+ QPainterPath}{Composing a QPainterPath}, setFillRule()
*/
void QPainterPath::addText(const QPointF &point, const QFont &f, const QString &text)
{
@@ -1222,6 +1156,11 @@ void QPainterPath::addText(const QPointF &point, const QFont &f, const QString &
QTextLayout layout(text, f);
layout.setCacheEnabled(true);
+
+ QTextOption opt = layout.textOption();
+ opt.setUseDesignMetrics(true);
+ layout.setTextOption(opt);
+
QTextEngine *eng = layout.engine();
layout.beginLayout();
QTextLine line = layout.createLine();
@@ -1248,7 +1187,7 @@ void QPainterPath::addText(const QPointF &point, const QFont &f, const QString &
if (si.analysis.flags < QScriptAnalysis::TabOrObject) {
QGlyphLayout glyphs = eng->shapedGlyphs(&si);
- QFontEngine *fe = f.d->engineForScript(si.analysis.script);
+ QFontEngine *fe = eng->fontEngine(si);
Q_ASSERT(fe);
fe->addOutlineToPath(x, y, glyphs, this,
si.analysis.bidiLevel % 2
@@ -1289,7 +1228,7 @@ void QPainterPath::addPath(const QPainterPath &other)
ensureData();
detach();
- QPainterPathData *d = reinterpret_cast<QPainterPathData *>(d_func());
+ QPainterPathPrivate *d = d_func();
// Remove last moveto so we don't get multiple moveto's
if (d->elements.constLast().type == MoveToElement)
d->elements.remove(d->elements.size()-1);
@@ -1320,7 +1259,7 @@ void QPainterPath::connectPath(const QPainterPath &other)
ensureData();
detach();
- QPainterPathData *d = reinterpret_cast<QPainterPathData *>(d_func());
+ QPainterPathPrivate *d = d_func();
// Remove last moveto so we don't get multiple moveto's
if (d->elements.constLast().type == MoveToElement)
d->elements.remove(d->elements.size()-1);
@@ -1367,7 +1306,7 @@ void QPainterPath::addRegion(const QRegion &region)
*/
Qt::FillRule QPainterPath::fillRule() const
{
- return isEmpty() ? Qt::OddEvenFill : d_func()->fillRule;
+ return !d_func() ? Qt::OddEvenFill : d_func()->fillRule;
}
/*!
@@ -1510,7 +1449,7 @@ QRectF QPainterPath::boundingRect() const
{
if (!d_ptr)
return QRectF();
- QPainterPathData *d = d_func();
+ QPainterPathPrivate *d = d_func();
if (d->dirtyBounds)
computeBoundingRect();
@@ -1531,7 +1470,7 @@ QRectF QPainterPath::controlPointRect() const
{
if (!d_ptr)
return QRectF();
- QPainterPathData *d = d_func();
+ QPainterPathPrivate *d = d_func();
if (d->dirtyControlBounds)
computeControlPointRect();
@@ -1550,7 +1489,7 @@ QRectF QPainterPath::controlPointRect() const
bool QPainterPath::isEmpty() const
{
- return !d_ptr || (d_ptr->elements.size() == 1 && d_ptr->elements.first().type == MoveToElement);
+ return !d_ptr || (d_ptr->elements.size() == 1 && d_ptr->elements.constFirst().type == MoveToElement);
}
/*!
@@ -1661,14 +1600,6 @@ QList<QPolygonF> QPainterPath::toSubpathPolygons(const QTransform &matrix) const
}
/*!
- \overload
- */
-QList<QPolygonF> QPainterPath::toSubpathPolygons(const QMatrix &matrix) const
-{
- return toSubpathPolygons(QTransform(matrix));
-}
-
-/*!
Converts the path into a list of polygons using the
QTransform \a matrix, and returns the list.
@@ -1701,7 +1632,7 @@ QList<QPolygonF> QPainterPath::toFillPolygons(const QTransform &matrix) const
if (count == 0)
return polys;
- QVector<QRectF> bounds;
+ QList<QRectF> bounds;
bounds.reserve(count);
for (int i=0; i<count; ++i)
bounds += subpaths.at(i).boundingRect();
@@ -1712,7 +1643,7 @@ QList<QPolygonF> QPainterPath::toFillPolygons(const QTransform &matrix) const
qDebug() << " bounds" << i << bounds.at(i);
#endif
- QVector< QVector<int> > isects;
+ QList< QList<int> > isects;
isects.resize(count);
// find all intersections
@@ -1740,12 +1671,12 @@ QList<QPolygonF> QPainterPath::toFillPolygons(const QTransform &matrix) const
// flatten the sets of intersections
for (int i=0; i<count; ++i) {
- const QVector<int> &current_isects = isects.at(i);
+ const QList<int> &current_isects = isects.at(i);
for (int j=0; j<current_isects.size(); ++j) {
int isect_j = current_isects.at(j);
if (isect_j == i)
continue;
- const QVector<int> &isects_j = isects.at(isect_j);
+ const QList<int> &isects_j = isects.at(isect_j);
for (int k = 0, size = isects_j.size(); k < size; ++k) {
int isect_k = isects_j.at(k);
if (isect_k != i && !isects.at(i).contains(isect_k)) {
@@ -1769,7 +1700,7 @@ QList<QPolygonF> QPainterPath::toFillPolygons(const QTransform &matrix) const
// Join the intersected subpaths as rewinded polygons
for (int i=0; i<count; ++i) {
- const QVector<int> &subpath_list = isects.at(i);
+ const QList<int> &subpath_list = isects.at(i);
if (!subpath_list.isEmpty()) {
QPolygonF buildUp;
for (int j=0; j<subpath_list.size(); ++j) {
@@ -1787,14 +1718,6 @@ QList<QPolygonF> QPainterPath::toFillPolygons(const QTransform &matrix) const
return polys;
}
-/*!
- \overload
- */
-QList<QPolygonF> QPainterPath::toFillPolygons(const QMatrix &matrix) const
-{
- return toFillPolygons(QTransform(matrix));
-}
-
//same as qt_polygon_isect_line in qpolygon.cpp
static void qt_painterpath_isect_line(const QPointF &p1,
const QPointF &p2,
@@ -1874,7 +1797,7 @@ bool QPainterPath::contains(const QPointF &pt) const
if (isEmpty() || !controlPointRect().contains(pt))
return false;
- QPainterPathData *d = d_func();
+ QPainterPathPrivate *d = d_func();
int winding_number = 0;
@@ -2168,7 +2091,7 @@ bool QPainterPath::intersects(const QRectF &rect) const
Q_D(QPainterPath);
- // Check if the rectangle surounds any subpath...
+ // Check if the rectangle surrounds any subpath...
for (int i=0; i<d->elements.size(); ++i) {
const Element &e = d->elements.at(i);
if (e.type == QPainterPath::MoveToElement && rect.contains(e))
@@ -2333,8 +2256,8 @@ static inline bool epsilonCompare(const QPointF &a, const QPointF &b, const QSiz
bool QPainterPath::operator==(const QPainterPath &path) const
{
- QPainterPathData *d = reinterpret_cast<QPainterPathData *>(d_func());
- QPainterPathData *other_d = path.d_func();
+ QPainterPathPrivate *d = d_func();
+ QPainterPathPrivate *other_d = path.d_func();
if (other_d == d) {
return true;
} else if (!d || !other_d) {
@@ -2519,14 +2442,14 @@ QDataStream &operator>>(QDataStream &s, QPainterPath &p)
int size;
s >> size;
- if (size == 0)
+ if (size == 0) {
+ p = {};
return s;
+ }
p.ensureData(); // in case if p.d_func() == 0
- if (p.d_func()->elements.size() == 1) {
- Q_ASSERT(p.d_func()->elements.at(0).type == QPainterPath::MoveToElement);
- p.d_func()->elements.clear();
- }
+ p.detach();
+ p.d_func()->elements.clear();
for (int i=0; i<size; ++i) {
int type;
double x, y;
@@ -2549,9 +2472,7 @@ QDataStream &operator>>(QDataStream &s, QPainterPath &p)
s >> fillRule;
Q_ASSERT(fillRule == Qt::OddEvenFill || fillRule == Qt::WindingFill);
p.d_func()->fillRule = Qt::FillRule(fillRule);
- p.d_func()->dirtyBounds = true;
- p.d_func()->dirtyControlBounds = true;
- if (errorDetected)
+ if (errorDetected || p.d_func()->elements.isEmpty())
p = QPainterPath(); // Better than to return path with possibly corrupt datastructure, which would likely cause crash
return s;
}
@@ -2609,7 +2530,7 @@ void qt_path_stroke_cubic_to(qfixed c1x, qfixed c1y,
\endlist
The setDashPattern() function accepts both a Qt::PenStyle object
- and a vector representation of the pattern as argument.
+ and a list representation of the pattern as argument.
In addition you can specify a curve's threshold, controlling the
granularity with which a curve is drawn, using the
@@ -2828,16 +2749,16 @@ void QPainterPathStroker::setDashPattern(Qt::PenStyle style)
dashPattern. This function makes it possible to specify custom
dash patterns.
- Each element in the vector contains the lengths of the dashes and spaces
+ Each element in the list contains the lengths of the dashes and spaces
in the stroke, beginning with the first dash in the first element, the
first space in the second element, and alternating between dashes and
spaces for each following pair of elements.
- The vector can contain an odd number of elements, in which case the last
+ The list can contain an odd number of elements, in which case the last
element will be extended by the length of the first element when the
pattern repeats.
*/
-void QPainterPathStroker::setDashPattern(const QVector<qreal> &dashPattern)
+void QPainterPathStroker::setDashPattern(const QList<qreal> &dashPattern)
{
d_func()->dashPattern.clear();
for (int i=0; i<dashPattern.size(); ++i)
@@ -2847,7 +2768,7 @@ void QPainterPathStroker::setDashPattern(const QVector<qreal> &dashPattern)
/*!
Returns the dash pattern for the generated outlines.
*/
-QVector<qreal> QPainterPathStroker::dashPattern() const
+QList<qreal> QPainterPathStroker::dashPattern() const
{
return d_func()->dashPattern;
}
@@ -2888,7 +2809,6 @@ void QPainterPathStroker::setDashOffset(qreal offset)
*/
QPolygonF QPainterPath::toFillPolygon(const QTransform &matrix) const
{
-
const QList<QPolygonF> flats = toSubpathPolygons(matrix);
QPolygonF polygon;
if (flats.isEmpty())
@@ -2904,15 +2824,6 @@ QPolygonF QPainterPath::toFillPolygon(const QTransform &matrix) const
return polygon;
}
-/*!
- \overload
-*/
-QPolygonF QPainterPath::toFillPolygon(const QMatrix &matrix) const
-{
- return toFillPolygon(QTransform(matrix));
-}
-
-
//derivative of the equation
static inline qreal slopeAt(qreal t, qreal a, qreal b, qreal c, qreal d)
{
@@ -3260,131 +3171,6 @@ void QPainterPath::addRoundedRect(const QRectF &rect, qreal xRadius, qreal yRadi
Adds the given rectangle \a x, \a y, \a w, \a h with rounded corners to the path.
*/
-#if QT_DEPRECATED_SINCE(5, 13)
-/*!
- \obsolete
-
- Adds a rectangle \a r with rounded corners to the path.
-
- The \a xRnd and \a yRnd arguments specify how rounded the corners
- should be. 0 is angled corners, 99 is maximum roundedness.
-
- \sa addRoundedRect()
-*/
-void QPainterPath::addRoundRect(const QRectF &r, int xRnd, int yRnd)
-{
- if(xRnd >= 100) // fix ranges
- xRnd = 99;
- if(yRnd >= 100)
- yRnd = 99;
- if(xRnd <= 0 || yRnd <= 0) { // add normal rectangle
- addRect(r);
- return;
- }
-
- QRectF rect = r.normalized();
-
- if (rect.isNull())
- return;
-
- qreal x = rect.x();
- qreal y = rect.y();
- qreal w = rect.width();
- qreal h = rect.height();
- qreal rxx2 = w*xRnd/100;
- qreal ryy2 = h*yRnd/100;
-
- ensureData();
- detach();
-
- bool first = d_func()->elements.size() < 2;
-
- arcMoveTo(x, y, rxx2, ryy2, 180);
- arcTo(x, y, rxx2, ryy2, 180, -90);
- arcTo(x+w-rxx2, y, rxx2, ryy2, 90, -90);
- arcTo(x+w-rxx2, y+h-ryy2, rxx2, ryy2, 0, -90);
- arcTo(x, y+h-ryy2, rxx2, ryy2, 270, -90);
- closeSubpath();
-
- d_func()->require_moveTo = true;
- d_func()->convex = first;
-}
-
-/*!
- \obsolete
-
- \fn bool QPainterPath::addRoundRect(const QRectF &rect, int roundness);
- \since 4.3
- \overload
-
- Adds a rounded rectangle, \a rect, to the path.
-
- The \a roundness argument specifies uniform roundness for the
- rectangle. Vertical and horizontal roundness factors will be
- adjusted accordingly to act uniformly around both axes. Use this
- method if you want a rectangle equally rounded across both the X and
- Y axis.
-
- \sa addRoundedRect()
-*/
-void QPainterPath::addRoundRect(const QRectF &rect,
- int roundness)
-{
- int xRnd = roundness;
- int yRnd = roundness;
- if (rect.width() > rect.height())
- xRnd = int(roundness * rect.height()/rect.width());
- else
- yRnd = int(roundness * rect.width()/rect.height());
- addRoundedRect(rect, xRnd, yRnd, Qt::RelativeSize);
-}
-
-/*!
- \obsolete
-
- \fn void QPainterPath::addRoundRect(qreal x, qreal y, qreal w, qreal h, int xRnd, int yRnd);
- \overload
-
- Adds a rectangle with rounded corners to the path. The rectangle
- is constructed from \a x, \a y, and the width and height \a w
- and \a h.
-
- The \a xRnd and \a yRnd arguments specify how rounded the corners
- should be. 0 is angled corners, 99 is maximum roundedness.
-
- \sa addRoundedRect()
- */
-void QPainterPath::addRoundRect(qreal x, qreal y, qreal w, qreal h,
- int xRnd, int yRnd)
-{
- addRoundedRect(QRectF(x, y, w, h), xRnd, yRnd, Qt::RelativeSize);
-}
-
-/*!
- \obsolete
-
- \fn bool QPainterPath::addRoundRect(qreal x, qreal y, qreal width, qreal height, int roundness);
- \since 4.3
- \overload
-
- Adds a rounded rectangle to the path, defined by the coordinates \a
- x and \a y with the specified \a width and \a height.
-
- The \a roundness argument specifies uniform roundness for the
- rectangle. Vertical and horizontal roundness factors will be
- adjusted accordingly to act uniformly around both axes. Use this
- method if you want a rectangle equally rounded across both the X and
- Y axis.
-
- \sa addRoundedRect()
-*/
-void QPainterPath::addRoundRect(qreal x, qreal y, qreal w, qreal h,
- int roundness)
-{
- addRoundedRect(QRectF(x, y, w, h), roundness, Qt::RelativeSize);
-}
-#endif
-
/*!
\since 4.3
@@ -3438,21 +3224,6 @@ QPainterPath QPainterPath::subtracted(const QPainterPath &p) const
return clipper.clip(QPathClipper::BoolSub);
}
-#if QT_DEPRECATED_SINCE(5, 13)
-/*!
- \since 4.3
- \obsolete
-
- Use subtracted() instead.
-
- \sa subtracted()
-*/
-QPainterPath QPainterPath::subtractedInverted(const QPainterPath &p) const
-{
- return p.subtracted(*this);
-}
-#endif
-
/*!
\since 4.4
@@ -3464,7 +3235,7 @@ QPainterPath QPainterPath::subtractedInverted(const QPainterPath &p) const
*/
QPainterPath QPainterPath::simplified() const
{
- if(isEmpty())
+ if (isEmpty())
return *this;
QPathClipper clipper(*this, QPainterPath());
return clipper.clip(QPathClipper::Simplify);
@@ -3523,7 +3294,7 @@ void QPainterPath::setDirty(bool dirty)
void QPainterPath::computeBoundingRect() const
{
- QPainterPathData *d = d_func();
+ QPainterPathPrivate *d = d_func();
d->dirtyBounds = false;
if (!d_ptr) {
d->bounds = QRect();
@@ -3570,7 +3341,7 @@ void QPainterPath::computeBoundingRect() const
void QPainterPath::computeControlPointRect() const
{
- QPainterPathData *d = d_func();
+ QPainterPathPrivate *d = d_func();
d->dirtyControlBounds = false;
if (!d_ptr) {
d->controlBounds = QRect();
diff --git a/src/gui/painting/qpainterpath.h b/src/gui/painting/qpainterpath.h
index ed5be667b7..4caf1aa5c0 100644
--- a/src/gui/painting/qpainterpath.h
+++ b/src/gui/painting/qpainterpath.h
@@ -1,52 +1,16 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the QtGui module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#ifndef QPAINTERPATH_H
#define QPAINTERPATH_H
#include <QtGui/qtguiglobal.h>
-#include <QtGui/qmatrix.h>
+#include <QtGui/qtransform.h>
#include <QtCore/qglobal.h>
-#include <QtCore/qrect.h>
#include <QtCore/qline.h>
-#include <QtCore/qvector.h>
-#include <QtCore/qscopedpointer.h>
+#include <QtCore/qlist.h>
+#include <QtCore/qrect.h>
+#include <QtCore/qshareddata.h>
QT_BEGIN_NAMESPACE
@@ -54,11 +18,11 @@ QT_BEGIN_NAMESPACE
class QFont;
class QPainterPathPrivate;
struct QPainterPathPrivateDeleter;
-class QPainterPathData;
class QPainterPathStrokerPrivate;
class QPen;
class QPolygonF;
class QRegion;
+class QTransform;
class QVectorPath;
class Q_GUI_EXPORT QPainterPath
@@ -92,8 +56,7 @@ public:
explicit QPainterPath(const QPointF &startPoint);
QPainterPath(const QPainterPath &other);
QPainterPath &operator=(const QPainterPath &other);
- inline QPainterPath &operator=(QPainterPath &&other) noexcept
- { qSwap(d_ptr, other.d_ptr); return *this; }
+ QT_MOVE_ASSIGNMENT_OPERATOR_IMPL_VIA_PURE_SWAP(QPainterPath)
~QPainterPath();
inline void swap(QPainterPath &other) noexcept { d_ptr.swap(other.d_ptr); }
@@ -141,19 +104,6 @@ public:
qreal xRadius, qreal yRadius,
Qt::SizeMode mode = Qt::AbsoluteSize);
-#if QT_DEPRECATED_SINCE(5, 13)
- QT_DEPRECATED_X("Use addRoundedRect(..., Qt::RelativeSize) instead")
- void addRoundRect(const QRectF &rect, int xRnd, int yRnd);
- QT_DEPRECATED_X("Use addRoundedRect(..., Qt::RelativeSize) instead")
- void addRoundRect(qreal x, qreal y, qreal w, qreal h,
- int xRnd, int yRnd);
- QT_DEPRECATED_X("Use addRoundedRect(..., Qt::RelativeSize) instead")
- void addRoundRect(const QRectF &rect, int roundness);
- QT_DEPRECATED_X("Use addRoundedRect(..., Qt::RelativeSize) instead")
- void addRoundRect(qreal x, qreal y, qreal w, qreal h,
- int roundness);
-#endif
-
void connectPath(const QPainterPath &path);
bool contains(const QPointF &pt) const;
@@ -163,8 +113,8 @@ public:
void translate(qreal dx, qreal dy);
inline void translate(const QPointF &offset);
- Q_REQUIRED_RESULT QPainterPath translated(qreal dx, qreal dy) const;
- Q_REQUIRED_RESULT inline QPainterPath translated(const QPointF &offset) const;
+ [[nodiscard]] QPainterPath translated(qreal dx, qreal dy) const;
+ [[nodiscard]] inline QPainterPath translated(const QPointF &offset) const;
QRectF boundingRect() const;
QRectF controlPointRect() const;
@@ -174,13 +124,11 @@ public:
bool isEmpty() const;
- Q_REQUIRED_RESULT QPainterPath toReversed() const;
- QList<QPolygonF> toSubpathPolygons(const QMatrix &matrix = QMatrix()) const;
- QList<QPolygonF> toFillPolygons(const QMatrix &matrix = QMatrix()) const;
- QPolygonF toFillPolygon(const QMatrix &matrix = QMatrix()) const;
- QList<QPolygonF> toSubpathPolygons(const QTransform &matrix) const;
- QList<QPolygonF> toFillPolygons(const QTransform &matrix) const;
- QPolygonF toFillPolygon(const QTransform &matrix) const;
+ [[nodiscard]] QPainterPath toReversed() const;
+
+ QList<QPolygonF> toSubpathPolygons(const QTransform &matrix = QTransform()) const;
+ QList<QPolygonF> toFillPolygons(const QTransform &matrix = QTransform()) const;
+ QPolygonF toFillPolygon(const QTransform &matrix = QTransform()) const;
int elementCount() const;
QPainterPath::Element elementAt(int i) const;
@@ -194,15 +142,11 @@ public:
bool intersects(const QPainterPath &p) const;
bool contains(const QPainterPath &p) const;
- Q_REQUIRED_RESULT QPainterPath united(const QPainterPath &r) const;
- Q_REQUIRED_RESULT QPainterPath intersected(const QPainterPath &r) const;
- Q_REQUIRED_RESULT QPainterPath subtracted(const QPainterPath &r) const;
-#if QT_DEPRECATED_SINCE(5, 13)
- QT_DEPRECATED_X("Use r.subtracted() instead")
- Q_REQUIRED_RESULT QPainterPath subtractedInverted(const QPainterPath &r) const;
-#endif
+ [[nodiscard]] QPainterPath united(const QPainterPath &r) const;
+ [[nodiscard]] QPainterPath intersected(const QPainterPath &r) const;
+ [[nodiscard]] QPainterPath subtracted(const QPainterPath &r) const;
- Q_REQUIRED_RESULT QPainterPath simplified() const;
+ [[nodiscard]] QPainterPath simplified() const;
bool operator==(const QPainterPath &other) const;
bool operator!=(const QPainterPath &other) const;
@@ -217,22 +161,19 @@ public:
QPainterPath &operator-=(const QPainterPath &other);
private:
- QScopedPointer<QPainterPathPrivate, QPainterPathPrivateDeleter> d_ptr;
+ QExplicitlySharedDataPointer<QPainterPathPrivate> d_ptr;
inline void ensureData() { if (!d_ptr) ensureData_helper(); }
void ensureData_helper();
void detach();
- void detach_helper();
void setDirty(bool);
void computeBoundingRect() const;
void computeControlPointRect() const;
- QPainterPathData *d_func() const { return reinterpret_cast<QPainterPathData *>(d_ptr.data()); }
+ QPainterPathPrivate *d_func() const { return d_ptr.data(); }
- friend class QPainterPathData;
friend class QPainterPathStroker;
friend class QPainterPathStrokerPrivate;
- friend class QMatrix;
friend class QTransform;
friend class QVectorPath;
friend Q_GUI_EXPORT const QVectorPath &qtVectorPathForPath(const QPainterPath &);
@@ -243,7 +184,7 @@ private:
#endif
};
-Q_DECLARE_SHARED_NOT_MOVABLE_UNTIL_QT6(QPainterPath)
+Q_DECLARE_SHARED(QPainterPath)
Q_DECLARE_TYPEINFO(QPainterPath::Element, Q_PRIMITIVE_TYPE);
#ifndef QT_NO_DATASTREAM
@@ -275,8 +216,8 @@ public:
qreal curveThreshold() const;
void setDashPattern(Qt::PenStyle);
- void setDashPattern(const QVector<qreal> &dashPattern);
- QVector<qreal> dashPattern() const;
+ void setDashPattern(const QList<qreal> &dashPattern);
+ QList<qreal> dashPattern() const;
void setDashOffset(qreal offset);
qreal dashOffset() const;
@@ -356,6 +297,8 @@ inline void QPainterPath::translate(const QPointF &offset)
inline QPainterPath QPainterPath::translated(const QPointF &offset) const
{ return translated(offset.x(), offset.y()); }
+inline QPainterPath operator *(const QPainterPath &p, const QTransform &m)
+{ return m.map(p); }
#ifndef QT_NO_DEBUG_STREAM
Q_GUI_EXPORT QDebug operator<<(QDebug, const QPainterPath &);
diff --git a/src/gui/painting/qpainterpath_p.h b/src/gui/painting/qpainterpath_p.h
index a420e0b3d9..a07b6cca37 100644
--- a/src/gui/painting/qpainterpath_p.h
+++ b/src/gui/painting/qpainterpath_p.h
@@ -1,41 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the QtGui module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#ifndef QPAINTERPATH_P_H
#define QPAINTERPATH_P_H
@@ -55,6 +19,7 @@
#include "QtGui/qpainterpath.h"
#include "QtGui/qregion.h"
#include "QtCore/qlist.h"
+#include "QtCore/qshareddata.h"
#include "QtCore/qvarlengtharray.h"
#include <qdebug.h>
@@ -66,72 +31,25 @@
QT_BEGIN_NAMESPACE
-// ### Qt 6: merge with QPainterPathData
-class QPainterPathPrivate
-{
-public:
- friend class QPainterPath;
- friend class QPainterPathData;
- friend class QPainterPathStroker;
- friend class QPainterPathStrokerPrivate;
- friend class QMatrix;
- friend class QTransform;
- friend class QVectorPath;
- friend struct QPainterPathPrivateDeleter;
-#ifndef QT_NO_DATASTREAM
- friend Q_GUI_EXPORT QDataStream &operator<<(QDataStream &, const QPainterPath &);
- friend Q_GUI_EXPORT QDataStream &operator>>(QDataStream &, QPainterPath &);
-#endif
-
- QPainterPathPrivate() noexcept
- : ref(1)
- {
- }
-
- QPainterPathPrivate(const QPainterPathPrivate &other) noexcept
- : ref(1),
- elements(other.elements)
- {
- }
-
- QPainterPathPrivate &operator=(const QPainterPathPrivate &) = delete;
- ~QPainterPathPrivate() = default;
-
-private:
- QAtomicInt ref;
- QVector<QPainterPath::Element> elements;
-};
-
-class QPainterPathStrokerPrivate
-{
-public:
- QPainterPathStrokerPrivate();
-
- QStroker stroker;
- QVector<qfixed> dashPattern;
- qreal dashOffset;
-};
-
class QPolygonF;
class QVectorPathConverter;
class QVectorPathConverter
{
public:
- QVectorPathConverter(const QVector<QPainterPath::Element> &path, uint fillRule, bool convex)
+ QVectorPathConverter(const QList<QPainterPath::Element> &path, uint fillRule, bool convex)
: pathData(path, fillRule, convex),
- path(pathData.points.data(), path.size(),
- pathData.elements.data(), pathData.flags) {}
+ path(pathData.points.data(), path.size(), pathData.elements.data(), pathData.flags)
+ {
+ }
const QVectorPath &vectorPath() {
return path;
}
struct QVectorPathData {
- QVectorPathData(const QVector<QPainterPath::Element> &path, uint fillRule, bool convex)
- : elements(path.size()),
- points(path.size() * 2),
- flags(0)
+ QVectorPathData(const QList<QPainterPath::Element> &path, uint fillRule, bool convex)
+ : elements(path.size()), points(path.size() * 2), flags(0)
{
int ptsPos = 0;
bool isLines = true;
@@ -175,36 +93,64 @@ private:
Q_DISABLE_COPY_MOVE(QVectorPathConverter)
};
-class QPainterPathData : public QPainterPathPrivate
+class QPainterPathPrivate : public QSharedData
{
public:
- QPainterPathData() :
- cStart(0),
- fillRule(Qt::OddEvenFill),
- require_moveTo(false),
- dirtyBounds(false),
- dirtyControlBounds(false),
- convex(false),
- pathConverter(nullptr)
+ friend class QPainterPath;
+ friend class QPainterPathStroker;
+ friend class QPainterPathStrokerPrivate;
+ friend class QTransform;
+ friend class QVectorPath;
+ friend struct QPainterPathPrivateDeleter;
+#ifndef QT_NO_DATASTREAM
+ friend Q_GUI_EXPORT QDataStream &operator<<(QDataStream &, const QPainterPath &);
+ friend Q_GUI_EXPORT QDataStream &operator>>(QDataStream &, QPainterPath &);
+#endif
+
+ QPainterPathPrivate() noexcept
+ : QSharedData(),
+ cStart(0),
+ fillRule(Qt::OddEvenFill),
+ require_moveTo(false),
+ dirtyBounds(false),
+ dirtyControlBounds(false),
+ convex(false),
+ pathConverter(nullptr)
{
}
- QPainterPathData(const QPainterPathData &other) :
- QPainterPathPrivate(other),
- cStart(other.cStart),
- fillRule(other.fillRule),
- bounds(other.bounds),
- controlBounds(other.controlBounds),
- require_moveTo(false),
- dirtyBounds(other.dirtyBounds),
- dirtyControlBounds(other.dirtyControlBounds),
- convex(other.convex),
- pathConverter(nullptr)
+ QPainterPathPrivate(QPointF startPoint)
+ : QSharedData(),
+ elements{ { startPoint.x(), startPoint.y(), QPainterPath::MoveToElement } },
+ cStart(0),
+ fillRule(Qt::OddEvenFill),
+ bounds(startPoint, QSizeF(0, 0)),
+ controlBounds(startPoint, QSizeF(0, 0)),
+ require_moveTo(false),
+ dirtyBounds(false),
+ dirtyControlBounds(false),
+ convex(false),
+ pathConverter(nullptr)
{
}
- QPainterPathData &operator=(const QPainterPathData &) = delete;
- ~QPainterPathData() = default;
+ QPainterPathPrivate(const QPainterPathPrivate &other) noexcept
+ : QSharedData(other),
+ elements(other.elements),
+ cStart(other.cStart),
+ fillRule(other.fillRule),
+ bounds(other.bounds),
+ controlBounds(other.controlBounds),
+ require_moveTo(false),
+ dirtyBounds(other.dirtyBounds),
+ dirtyControlBounds(other.dirtyControlBounds),
+ convex(other.convex),
+ pathConverter(nullptr)
+ {
+ }
+
+ QPainterPathPrivate &operator=(const QPainterPathPrivate &) = delete;
+ ~QPainterPathPrivate() = default;
inline bool isClosed() const;
inline void close();
@@ -217,6 +163,9 @@ public:
return pathConverter->path;
}
+private:
+ QList<QPainterPath::Element> elements;
+
int cStart;
Qt::FillRule fillRule;
@@ -231,12 +180,21 @@ public:
std::unique_ptr<QVectorPathConverter> pathConverter;
};
+class QPainterPathStrokerPrivate
+{
+public:
+ QPainterPathStrokerPrivate();
+
+ QStroker stroker;
+ QList<qfixed> dashPattern;
+ qreal dashOffset;
+};
inline const QPainterPath QVectorPath::convertToPainterPath() const
{
QPainterPath path;
path.ensureData();
- QPainterPathData *data = path.d_func();
+ QPainterPathPrivate *data = path.d_func();
data->elements.reserve(m_count);
int index = 0;
data->elements[0].x = m_points[index++];
@@ -272,14 +230,14 @@ inline const QPainterPath QVectorPath::convertToPainterPath() const
void Q_GUI_EXPORT qt_find_ellipse_coords(const QRectF &r, qreal angle, qreal length,
QPointF* startPoint, QPointF *endPoint);
-inline bool QPainterPathData::isClosed() const
+inline bool QPainterPathPrivate::isClosed() const
{
const QPainterPath::Element &first = elements.at(cStart);
const QPainterPath::Element &last = elements.last();
return first.x == last.x && first.y == last.y;
}
-inline void QPainterPathData::close()
+inline void QPainterPathPrivate::close()
{
Q_ASSERT(ref.loadRelaxed() == 1);
require_moveTo = true;
@@ -296,7 +254,7 @@ inline void QPainterPathData::close()
}
}
-inline void QPainterPathData::maybeMoveTo()
+inline void QPainterPathPrivate::maybeMoveTo()
{
if (require_moveTo) {
QPainterPath::Element e = elements.last();
@@ -306,14 +264,13 @@ inline void QPainterPathData::maybeMoveTo()
}
}
-inline void QPainterPathData::clear()
+inline void QPainterPathPrivate::clear()
{
Q_ASSERT(ref.loadRelaxed() == 1);
elements.clear();
cStart = 0;
- fillRule = Qt::OddEvenFill;
bounds = {};
controlBounds = {};
diff --git a/src/gui/painting/qpathclipper.cpp b/src/gui/painting/qpathclipper.cpp
index 1a1b2d76e2..10a0639b53 100644
--- a/src/gui/painting/qpathclipper.cpp
+++ b/src/gui/painting/qpathclipper.cpp
@@ -1,41 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the QtGui module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#include "qpathclipper_p.h"
@@ -99,6 +63,7 @@ struct QIntersection
QPointF pos;
};
+Q_DECLARE_TYPEINFO(QIntersection, Q_PRIMITIVE_TYPE);
class QIntersectionFinder
{
@@ -268,11 +233,11 @@ private:
void intersectLines(const QLineF &a, const QLineF &b, QDataBuffer<QIntersection> &intersections);
QPathSegments &m_segments;
- QVector<int> m_index;
+ QList<int> m_index;
RectF m_bounds;
- QVector<TreeNode> m_tree;
+ QList<TreeNode> m_tree;
QDataBuffer<QIntersection> m_intersections;
};
@@ -316,7 +281,7 @@ static inline qreal coordinate(const QPointF &pos, int axis)
TreeNode SegmentTree::buildTree(int first, int last, int depth, const RectF &bounds)
{
if (depth >= 24 || (last - first) <= 10) {
- TreeNode node;
+ TreeNode node = {};
node.leaf = true;
node.index.interval.first = first;
node.index.interval.last = last;
@@ -685,7 +650,8 @@ int QKdPointTree::build(int begin, int end, int depth)
}
}
- qSwap(m_nodes.at(last), m_nodes.at(begin));
+ if (last != begin)
+ qSwap(m_nodes.at(last), m_nodes.at(begin));
if (last > begin)
m_nodes.at(last).left = &m_nodes.at(build(begin, last, depth + 1));
@@ -1618,7 +1584,7 @@ QPainterPath QPathClipper::clip(Operation operation)
bool QPathClipper::doClip(QWingedEdge &list, ClipperMode mode)
{
- QVector<qreal> y_coords;
+ QList<qreal> y_coords;
y_coords.reserve(list.vertexCount());
for (int i = 0; i < list.vertexCount(); ++i)
y_coords << list.vertex(i)->y;
@@ -1778,9 +1744,9 @@ bool QWingedEdge::isInside(qreal x, qreal y) const
return winding & 1;
}
-static QVector<QCrossingEdge> findCrossings(const QWingedEdge &list, qreal y)
+static QList<QCrossingEdge> findCrossings(const QWingedEdge &list, qreal y)
{
- QVector<QCrossingEdge> crossings;
+ QList<QCrossingEdge> crossings;
for (int i = 0; i < list.edgeCount(); ++i) {
const QPathEdge *edge = list.edge(i);
QPointF a = *list.vertex(edge->first);
@@ -1797,7 +1763,7 @@ static QVector<QCrossingEdge> findCrossings(const QWingedEdge &list, qreal y)
bool QPathClipper::handleCrossingEdges(QWingedEdge &list, qreal y, ClipperMode mode)
{
- QVector<QCrossingEdge> crossings = findCrossings(list, y);
+ QList<QCrossingEdge> crossings = findCrossings(list, y);
Q_ASSERT(!crossings.isEmpty());
std::sort(crossings.begin(), crossings.end());
@@ -1869,10 +1835,10 @@ bool QPathClipper::handleCrossingEdges(QWingedEdge &list, qreal y, ClipperMode m
namespace {
-QVector<QPainterPath> toSubpaths(const QPainterPath &path)
+QList<QPainterPath> toSubpaths(const QPainterPath &path)
{
- QVector<QPainterPath> subpaths;
+ QList<QPainterPath> subpaths;
if (path.isEmpty())
return subpaths;
@@ -1965,7 +1931,7 @@ void clipLine(const QPointF &a, const QPointF &b, qreal t, QPainterPath &result)
if (outA)
addLine(result, QLineF(intersectLine<edge>(a, b, t), b));
- else if(outB)
+ else if (outB)
addLine(result, QLineF(a, intersectLine<edge>(a, b, t)));
else
addLine(result, QLineF(a, b));
@@ -2072,7 +2038,7 @@ QPainterPath clip(const QPainterPath &path, qreal t)
QPainterPath intersectPath(const QPainterPath &path, const QRectF &rect)
{
- QVector<QPainterPath> subpaths = toSubpaths(path);
+ QList<QPainterPath> subpaths = toSubpaths(path);
QPainterPath result;
result.setFillRule(path.fillRule());
diff --git a/src/gui/painting/qpathclipper_p.h b/src/gui/painting/qpathclipper_p.h
index 9444a87b71..f13b96e0ef 100644
--- a/src/gui/painting/qpathclipper_p.h
+++ b/src/gui/painting/qpathclipper_p.h
@@ -1,41 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the QtGui module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#ifndef QPATHCLIPPER_P_H
#define QPATHCLIPPER_P_H
@@ -115,6 +79,7 @@ public:
qreal x;
qreal y;
};
+Q_DECLARE_TYPEINFO(QPathVertex, Q_PRIMITIVE_TYPE);
class QPathEdge
{
@@ -156,8 +121,9 @@ public:
int vertex(Direction direction) const;
private:
- int m_next[2][2];
+ int m_next[2][2] = { { -1, -1 }, { -1, -1 } };
};
+Q_DECLARE_TYPEINFO(QPathEdge, Q_PRIMITIVE_TYPE);
class QPathSegments
{
@@ -171,6 +137,7 @@ public:
return t < o.t;
}
};
+ friend class QTypeInfo<Intersection>;
struct Segment {
Segment(int pathId, int vertexA, int vertexB)
@@ -192,6 +159,7 @@ public:
QRectF bounds;
};
+ friend class QTypeInfo<Segment>;
QPathSegments(int reserve);
@@ -223,6 +191,8 @@ private:
int m_pathId;
};
+Q_DECLARE_TYPEINFO(QPathSegments::Intersection, Q_PRIMITIVE_TYPE);
+Q_DECLARE_TYPEINFO(QPathSegments::Segment, Q_PRIMITIVE_TYPE);
class Q_AUTOTEST_EXPORT QWingedEdge
{
@@ -282,7 +252,7 @@ private:
QDataBuffer<QPathEdge> m_edges;
QDataBuffer<QPathVertex> m_vertices;
- QVector<qreal> m_splitPoints;
+ QList<qreal> m_splitPoints;
QPathSegments m_segments;
};
@@ -296,10 +266,6 @@ inline QPathEdge::QPathEdge(int a, int b)
, angle(0)
, invAngle(0)
{
- m_next[0][0] = -1;
- m_next[1][0] = -1;
- m_next[0][0] = -1;
- m_next[1][0] = -1;
}
inline int QPathEdge::next(Traversal traversal, Direction direction) const
diff --git a/src/gui/painting/qpathsimplifier.cpp b/src/gui/painting/qpathsimplifier.cpp
index 256a2fefe7..969308f0bb 100644
--- a/src/gui/painting/qpathsimplifier.cpp
+++ b/src/gui/painting/qpathsimplifier.cpp
@@ -1,41 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the QtGui module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#include "qpathsimplifier_p.h"
@@ -44,7 +8,9 @@
#include <QtCore/qpoint.h>
#include <QtCore/qalgorithms.h>
-#include <private/qopengl_p.h>
+#if QT_CONFIG(opengl)
+# include <private/qopengl_p.h>
+#endif
#include <private/qrbtree_p.h>
QT_BEGIN_NAMESPACE
@@ -339,6 +305,7 @@ private:
Type type;
Element *element;
};
+ friend class QTypeInfo<Event>;
typedef QRBTree<Element *>::Node RBNode;
typedef BoundingVolumeHierarchy::Node BVHNode;
@@ -377,6 +344,10 @@ private:
uint m_hints;
};
+} // unnamed namespace
+
+Q_DECLARE_TYPEINFO(PathSimplifier::Event, Q_PRIMITIVE_TYPE);
+
inline PathSimplifier::BoundingVolumeHierarchy::BoundingVolumeHierarchy()
: root(nullptr)
, nodeBlock(nullptr)
@@ -880,9 +851,9 @@ void PathSimplifier::connectElements()
#ifndef QT_NO_DEBUG
for (int i = 0; i < m_elements.size(); ++i) {
const Element *element = m_elements.at(i);
- Q_ASSERT(element->next == 0 || element->next->previous == element);
- Q_ASSERT(element->previous == 0 || element->previous->next == element);
- Q_ASSERT((element->next == 0) == (element->previous == 0));
+ Q_ASSERT(element->next == nullptr || element->next->previous == element);
+ Q_ASSERT(element->previous == nullptr || element->previous->next == element);
+ Q_ASSERT((element->next == nullptr) == (element->previous == nullptr));
}
#endif
}
@@ -1442,7 +1413,7 @@ bool PathSimplifier::elementIsLeftOf(const Element *left, const Element *right)
QPair<PathSimplifier::RBNode *, PathSimplifier::RBNode *> PathSimplifier::outerBounds(const QPoint &point)
{
RBNode *current = m_elementList.root;
- QPair<RBNode *, RBNode *> result(0, 0);
+ QPair<RBNode *, RBNode *> result(nullptr, nullptr);
while (current) {
const Element *element = current->data;
@@ -1650,9 +1621,6 @@ void PathSimplifier::sortEvents(Event *events, int count)
}
}
-} // end anonymous namespace
-
-
void qSimplifyPath(const QVectorPath &path, QDataBuffer<QPoint> &vertices,
QDataBuffer<quint32> &indices, const QTransform &matrix)
{
@@ -1667,3 +1635,5 @@ void qSimplifyPath(const QPainterPath &path, QDataBuffer<QPoint> &vertices,
QT_END_NAMESPACE
+
+#undef Q_FIXED_POINT_SCALE
diff --git a/src/gui/painting/qpathsimplifier_p.h b/src/gui/painting/qpathsimplifier_p.h
index 6c0062c592..b20b6370b3 100644
--- a/src/gui/painting/qpathsimplifier_p.h
+++ b/src/gui/painting/qpathsimplifier_p.h
@@ -1,41 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the QtGui module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#ifndef QPATHSIMPLIFIER_P_H
#define QPATHSIMPLIFIER_P_H
diff --git a/src/gui/painting/qpdf.cpp b/src/gui/painting/qpdf.cpp
index 932c3e6f5a..38f2a9b803 100644
--- a/src/gui/painting/qpdf.cpp
+++ b/src/gui/painting/qpdf.cpp
@@ -1,41 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the QtGui module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#include "qpdf_p.h"
@@ -43,6 +7,7 @@
#include "qplatformdefs.h"
+#include <private/qcmyk_p.h>
#include <private/qfont_p.h>
#include <private/qmath_p.h>
#include <private/qpainter_p.h>
@@ -78,7 +43,9 @@ static void initResources()
QT_BEGIN_NAMESPACE
-inline QPaintEngine::PaintEngineFeatures qt_pdf_decide_features()
+using namespace Qt::StringLiterals;
+
+constexpr QPaintEngine::PaintEngineFeatures qt_pdf_decide_features()
{
QPaintEngine::PaintEngineFeatures f = QPaintEngine::AllFeatures;
f &= ~(QPaintEngine::PorterDuff
@@ -133,7 +100,7 @@ static void removeTransparencyFromBrush(QBrush &brush)
const char *qt_real_to_string(qreal val, char *buf) {
const char *ret = buf;
- if (qIsNaN(val)) {
+ if (!qIsFinite(val) || std::abs(val) > std::numeric_limits<quint32>::max()) {
*(buf++) = '0';
*(buf++) = ' ';
*buf = 0;
@@ -144,8 +111,8 @@ const char *qt_real_to_string(qreal val, char *buf) {
*(buf++) = '-';
val = -val;
}
- unsigned int ival = (unsigned int) val;
- qreal frac = val - (qreal)ival;
+ qreal frac = std::modf(val, &val);
+ quint32 ival(val);
int ifrac = (int)(frac * 1000000000);
if (ifrac == 1000000000) {
@@ -304,13 +271,6 @@ namespace QPdf {
dev->open(QIODevice::ReadWrite | QIODevice::Truncate);
}
- void ByteStream::constructor_helper(QByteArray *ba)
- {
- delete dev;
- dev = new QBuffer(ba);
- dev->open(QIODevice::ReadWrite);
- }
-
void ByteStream::prepareBuffer()
{
Q_ASSERT(!dev->isSequential());
@@ -319,16 +279,17 @@ namespace QPdf {
&& size > maxMemorySize()) {
// Switch to file backing.
QTemporaryFile *newFile = new QTemporaryFile;
- newFile->open();
- dev->reset();
- while (!dev->atEnd()) {
- QByteArray buf = dev->read(chunkSize());
- newFile->write(buf);
+ if (newFile->open()) {
+ dev->reset();
+ while (!dev->atEnd()) {
+ QByteArray buf = dev->read(chunkSize());
+ newFile->write(buf);
+ }
+ delete dev;
+ dev = newFile;
+ ba.clear();
+ fileBackingActive = true;
}
- delete dev;
- dev = newFile;
- ba.clear();
- fileBackingActive = true;
}
if (dev->pos() != size) {
dev->seek(size);
@@ -421,7 +382,7 @@ QByteArray QPdf::generateDashes(const QPen &pen)
ByteStream s(&result);
s << '[';
- QVector<qreal> dasharray = pen.dashPattern();
+ QList<qreal> dasharray = pen.dashPattern();
qreal w = pen.widthF();
if (w < 0.001)
w = 1;
@@ -649,7 +610,7 @@ QPdf::Stroker::Stroker()
basicStroker.setStrokeWidth(.1);
}
-void QPdf::Stroker::setPen(const QPen &pen, QPainter::RenderHints hints)
+void QPdf::Stroker::setPen(const QPen &pen, QPainter::RenderHints)
{
if (pen.style() == Qt::NoPen) {
stroker = nullptr;
@@ -657,7 +618,7 @@ void QPdf::Stroker::setPen(const QPen &pen, QPainter::RenderHints hints)
}
qreal w = pen.widthF();
bool zeroWidth = w < 0.0001;
- cosmeticPen = qt_pen_is_cosmetic(pen, hints);
+ cosmeticPen = pen.isCosmetic();
if (zeroWidth)
w = .1;
@@ -666,7 +627,7 @@ void QPdf::Stroker::setPen(const QPen &pen, QPainter::RenderHints hints)
basicStroker.setJoinStyle(pen.joinStyle());
basicStroker.setMiterLimit(pen.miterLimit());
- QVector<qreal> dashpattern = pen.dashPattern();
+ QList<qreal> dashpattern = pen.dashPattern();
if (zeroWidth) {
for (int i = 0; i < dashpattern.size(); ++i)
dashpattern[i] *= 10.;
@@ -784,7 +745,7 @@ QPdfPage::QPdfPage()
{
}
-void QPdfPage::streamImage(int w, int h, int object)
+void QPdfPage::streamImage(int w, int h, uint object)
{
*this << w << "0 0 " << -h << "0 " << h << "cm /Im" << object << " Do\n";
if (!images.contains(object))
@@ -856,14 +817,14 @@ void QPdfEngine::drawRects (const QRectF *rects, int rectCount)
if (!d->hasPen && !d->hasBrush)
return;
- if (d->simplePen || !d->hasPen) {
- // draw strokes natively in this case for better output
- if(!d->simplePen && !d->stroker.matrix.isIdentity())
+ if ((d->simplePen && !d->needsTransform) || !d->hasPen) {
+ // draw natively in this case for better output
+ if (!d->hasPen && d->needsTransform) // i.e. this is just a fillrect
*d->currentPage << "q\n" << QPdf::generateMatrix(d->stroker.matrix);
for (int i = 0; i < rectCount; ++i)
*d->currentPage << rects[i].x() << rects[i].y() << rects[i].width() << rects[i].height() << "re\n";
*d->currentPage << (d->hasPen ? (d->hasBrush ? "B\n" : "S\n") : "f\n");
- if(!d->simplePen && !d->stroker.matrix.isIdentity())
+ if (!d->hasPen && d->needsTransform)
*d->currentPage << "Q\n";
} else {
QPainterPath p;
@@ -920,7 +881,8 @@ void QPdfEngine::drawPath (const QPainterPath &p)
if (d->simplePen) {
// draw strokes natively in this case for better output
- *d->currentPage << QPdf::generatePath(p, QTransform(), d->hasBrush ? QPdf::FillAndStrokePath : QPdf::StrokePath);
+ *d->currentPage << QPdf::generatePath(p, d->needsTransform ? d->stroker.matrix : QTransform(),
+ d->hasBrush ? QPdf::FillAndStrokePath : QPdf::StrokePath);
} else {
if (d->hasBrush)
*d->currentPage << QPdf::generatePath(p, d->stroker.matrix, QPdf::FillPath);
@@ -967,7 +929,7 @@ void QPdfEngine::drawPixmap (const QRectF &rectangle, const QPixmap &pixmap, con
*d->currentPage
<< QPdf::generateMatrix(QTransform(rectangle.width() / sr.width(), 0, 0, rectangle.height() / sr.height(),
- rectangle.x(), rectangle.y()) * (d->simplePen ? QTransform() : d->stroker.matrix));
+ rectangle.x(), rectangle.y()) * (!d->needsTransform ? QTransform() : d->stroker.matrix));
if (bitmap) {
// set current pen as d->brush
d->brush = d->pen.brush();
@@ -1007,7 +969,7 @@ void QPdfEngine::drawImage(const QRectF &rectangle, const QImage &image, const Q
*d->currentPage
<< QPdf::generateMatrix(QTransform(rectangle.width() / sr.width(), 0, 0, rectangle.height() / sr.height(),
- rectangle.x(), rectangle.y()) * (d->simplePen ? QTransform() : d->stroker.matrix));
+ rectangle.x(), rectangle.y()) * (!d->needsTransform ? QTransform() : d->stroker.matrix));
setBrush();
d->currentPage->streamImage(im.width(), im.height(), object);
*d->currentPage << "Q\n";
@@ -1056,7 +1018,7 @@ void QPdfEngine::drawTextItem(const QPointF &p, const QTextItem &textItem)
}
*d->currentPage << "q\n";
- if(!d->simplePen)
+ if (d->needsTransform)
*d->currentPage << QPdf::generateMatrix(d->stroker.matrix);
bool hp = d->hasPen;
@@ -1114,6 +1076,9 @@ void QPdfEngine::updateState(const QPaintEngineState &state)
QPaintEngine::DirtyFlags flags = state.state();
+ if (flags & DirtyHints)
+ flags |= DirtyBrush;
+
if (flags & DirtyTransform)
d->stroker.matrix = state.transform();
@@ -1135,12 +1100,12 @@ void QPdfEngine::updateState(const QPaintEngineState &state)
d->pen = state.pen();
}
d->hasPen = d->pen.style() != Qt::NoPen;
+ bool oldCosmetic = d->stroker.cosmeticPen;
d->stroker.setPen(d->pen, state.renderHints());
QBrush penBrush = d->pen.brush();
- bool cosmeticPen = qt_pen_is_cosmetic(d->pen, state.renderHints());
bool oldSimple = d->simplePen;
- d->simplePen = (d->hasPen && !cosmeticPen && (penBrush.style() == Qt::SolidPattern) && penBrush.isOpaque() && d->opacity == 1.0);
- if (oldSimple != d->simplePen)
+ d->simplePen = (d->hasPen && (penBrush.style() == Qt::SolidPattern) && penBrush.isOpaque() && d->opacity == 1.0);
+ if (oldSimple != d->simplePen || oldCosmetic != d->stroker.cosmeticPen)
flags |= DirtyTransform;
} else if (flags & DirtyHints) {
d->stroker.setPen(d->pen, state.renderHints());
@@ -1224,8 +1189,13 @@ void QPdfEngine::setupGraphicsState(QPaintEngine::DirtyFlags flags)
if (flags & DirtyTransform) {
*d->currentPage << "q\n";
- if (d->simplePen && !d->stroker.matrix.isIdentity())
- *d->currentPage << QPdf::generateMatrix(d->stroker.matrix);
+ d->needsTransform = false;
+ if (!d->stroker.matrix.isIdentity()) {
+ if (d->simplePen && !d->stroker.cosmeticPen)
+ *d->currentPage << QPdf::generateMatrix(d->stroker.matrix);
+ else
+ d->needsTransform = true; // I.e. page-wide xf not set, local xf needed
+ }
}
if (flags & DirtyBrush)
setBrush();
@@ -1241,20 +1211,18 @@ void QPdfEngine::updateClipPath(const QPainterPath &p, Qt::ClipOperation op)
QPainterPath path = d->stroker.matrix.map(p);
//qDebug() << "updateClipPath: " << d->stroker.matrix << p.boundingRect() << path.boundingRect() << op;
- if (op == Qt::NoClip) {
+ switch (op) {
+ case Qt::NoClip:
d->clipEnabled = false;
d->clips.clear();
- } else if (op == Qt::ReplaceClip) {
+ break;
+ case Qt::ReplaceClip:
d->clips.clear();
d->clips.append(path);
- } else if (op == Qt::IntersectClip) {
- d->clips.append(path);
- } else { // UniteClip
- // ask the painter for the current clipping path. that's the easiest solution
- path = painter()->clipPath();
- path = d->stroker.matrix.map(path);
- d->clips.clear();
+ break;
+ case Qt::IntersectClip:
d->clips.append(path);
+ break;
}
}
@@ -1266,17 +1234,8 @@ void QPdfEngine::setPen()
QBrush b = d->pen.brush();
Q_ASSERT(b.style() == Qt::SolidPattern && b.isOpaque());
- QColor rgba = b.color();
- if (d->grayscale) {
- qreal gray = qGray(rgba.rgba())/255.;
- *d->currentPage << gray << gray << gray;
- } else {
- *d->currentPage << rgba.redF()
- << rgba.greenF()
- << rgba.blueF();
- }
+ d->writeColor(QPdfEnginePrivate::ColorDomain::Stroking, b.color());
*d->currentPage << "SCN\n";
-
*d->currentPage << d->pen.widthF() << "w ";
int pdfCapStyle = 0;
@@ -1330,18 +1289,9 @@ void QPdfEngine::setBrush()
if (!patternObject && !specifyColor)
return;
- *d->currentPage << (patternObject ? "/PCSp cs " : "/CSp cs ");
- if (specifyColor) {
- QColor rgba = d->brush.color();
- if (d->grayscale) {
- qreal gray = qGray(rgba.rgba())/255.;
- *d->currentPage << gray << gray << gray;
- } else {
- *d->currentPage << rgba.redF()
- << rgba.greenF()
- << rgba.blueF();
- }
- }
+ const auto domain = patternObject ? QPdfEnginePrivate::ColorDomain::NonStrokingPattern
+ : QPdfEnginePrivate::ColorDomain::NonStroking;
+ d->writeColor(domain, specifyColor ? d->brush.color() : QColor());
if (patternObject)
*d->currentPage << "/Pat" << patternObject;
*d->currentPage << "scn\n";
@@ -1390,6 +1340,18 @@ void QPdfEngine::setPdfVersion(PdfVersion version)
d->pdfVersion = version;
}
+void QPdfEngine::setDocumentXmpMetadata(const QByteArray &xmpMetadata)
+{
+ Q_D(QPdfEngine);
+ d->xmpDocumentMetadata = xmpMetadata;
+}
+
+QByteArray QPdfEngine::documentXmpMetadata() const
+{
+ Q_D(const QPdfEngine);
+ return d->xmpDocumentMetadata;
+}
+
void QPdfEngine::setPageLayout(const QPageLayout &pageLayout)
{
Q_D(QPdfEngine);
@@ -1468,10 +1430,10 @@ int QPdfEngine::metric(QPaintDevice::PaintDeviceMetric metricType) const
QPdfEnginePrivate::QPdfEnginePrivate()
: clipEnabled(false), allClipped(false), hasPen(true), hasBrush(false), simplePen(false),
- pdfVersion(QPdfEngine::Version_1_4),
+ needsTransform(false), pdfVersion(QPdfEngine::Version_1_4),
+ colorModel(QPdfEngine::ColorModel::Auto),
outDevice(nullptr), ownsDevice(false),
embedFonts(true),
- grayscale(false),
m_pageLayout(QPageSize(QPageSize::A4), QPageLayout::Portrait, QMarginsF(10, 10, 10, 10))
{
initResources();
@@ -1520,11 +1482,17 @@ bool QPdfEngine::begin(QPaintDevice *pdev)
d->xrefPositions.clear();
d->pageRoot = 0;
+ d->namesRoot = 0;
+ d->destsRoot = 0;
+ d->attachmentsRoot = 0;
d->catalog = 0;
d->info = 0;
d->graphicsState = 0;
- d->patternColorSpace = 0;
+ d->patternColorSpaceRGB = 0;
+ d->patternColorSpaceGrayscale = 0;
+ d->patternColorSpaceCMYK = 0;
d->simplePen = false;
+ d->needsTransform = false;
d->pages.clear();
d->imageCache.clear();
@@ -1555,10 +1523,19 @@ bool QPdfEngine::end()
d->outDevice = nullptr;
}
+ d->destCache.clear();
+ d->fileCache.clear();
+
setActive(false);
return true;
}
+void QPdfEngine::addFileAttachment(const QString &fileName, const QByteArray &data, const QString &mimeType)
+{
+ Q_D(QPdfEngine);
+ d->fileCache.push_back({fileName, data, mimeType});
+}
+
QPdfEnginePrivate::~QPdfEnginePrivate()
{
qDeleteAll(fonts);
@@ -1586,13 +1563,16 @@ void QPdfEnginePrivate::writeHeader()
int metaDataObj = -1;
int outputIntentObj = -1;
+ if (pdfVersion == QPdfEngine::Version_A1b || !xmpDocumentMetadata.isEmpty()) {
+ metaDataObj = writeXmpDcumentMetaData();
+ }
if (pdfVersion == QPdfEngine::Version_A1b) {
- metaDataObj = writeXmpMetaData();
outputIntentObj = writeOutputIntent();
}
catalog = addXrefEntry(-1);
pageRoot = requestObject();
+ namesRoot = requestObject();
// catalog
{
@@ -1600,12 +1580,14 @@ void QPdfEnginePrivate::writeHeader()
QPdf::ByteStream s(&catalog);
s << "<<\n"
<< "/Type /Catalog\n"
- << "/Pages " << pageRoot << "0 R\n";
+ << "/Pages " << pageRoot << "0 R\n"
+ << "/Names " << namesRoot << "0 R\n";
- if (pdfVersion == QPdfEngine::Version_A1b) {
- s << "/OutputIntents [" << outputIntentObj << "0 R]\n";
+ if (pdfVersion == QPdfEngine::Version_A1b || !xmpDocumentMetadata.isEmpty())
s << "/Metadata " << metaDataObj << "0 R\n";
- }
+
+ if (pdfVersion == QPdfEngine::Version_A1b)
+ s << "/OutputIntents [" << outputIntentObj << "0 R]\n";
s << ">>\n"
<< "endobj\n";
@@ -1626,10 +1608,108 @@ void QPdfEnginePrivate::writeHeader()
">>\n"
"endobj\n");
- // color space for pattern
- patternColorSpace = addXrefEntry(-1);
+ // color spaces for pattern
+ patternColorSpaceRGB = addXrefEntry(-1);
xprintf("[/Pattern /DeviceRGB]\n"
"endobj\n");
+ patternColorSpaceGrayscale = addXrefEntry(-1);
+ xprintf("[/Pattern /DeviceGray]\n"
+ "endobj\n");
+ patternColorSpaceCMYK = addXrefEntry(-1);
+ xprintf("[/Pattern /DeviceCMYK]\n"
+ "endobj\n");
+}
+
+QPdfEngine::ColorModel QPdfEnginePrivate::colorModelForColor(const QColor &color) const
+{
+ switch (colorModel) {
+ case QPdfEngine::ColorModel::RGB:
+ case QPdfEngine::ColorModel::Grayscale:
+ case QPdfEngine::ColorModel::CMYK:
+ return colorModel;
+ case QPdfEngine::ColorModel::Auto:
+ switch (color.spec()) {
+ case QColor::Invalid:
+ case QColor::Rgb:
+ case QColor::Hsv:
+ case QColor::Hsl:
+ case QColor::ExtendedRgb:
+ return QPdfEngine::ColorModel::RGB;
+ case QColor::Cmyk:
+ return QPdfEngine::ColorModel::CMYK;
+ }
+
+ break;
+ }
+
+ Q_UNREACHABLE_RETURN(QPdfEngine::ColorModel::RGB);
+}
+
+void QPdfEnginePrivate::writeColor(ColorDomain domain, const QColor &color)
+{
+ // Switch to the right colorspace.
+ // For simplicity: do it even if it redundant (= already in that colorspace)
+ const QPdfEngine::ColorModel actualColorModel = colorModelForColor(color);
+
+ switch (actualColorModel) {
+ case QPdfEngine::ColorModel::RGB:
+ switch (domain) {
+ case ColorDomain::Stroking:
+ *currentPage << "/CSp CS\n"; break;
+ case ColorDomain::NonStroking:
+ *currentPage << "/CSp cs\n"; break;
+ case ColorDomain::NonStrokingPattern:
+ *currentPage << "/PCSp cs\n"; break;
+ }
+ break;
+ case QPdfEngine::ColorModel::Grayscale:
+ switch (domain) {
+ case ColorDomain::Stroking:
+ *currentPage << "/CSpg CS\n"; break;
+ case ColorDomain::NonStroking:
+ *currentPage << "/CSpg cs\n"; break;
+ case ColorDomain::NonStrokingPattern:
+ *currentPage << "/PCSpg cs\n"; break;
+ }
+ break;
+ case QPdfEngine::ColorModel::CMYK:
+ switch (domain) {
+ case ColorDomain::Stroking:
+ *currentPage << "/CSpcmyk CS\n"; break;
+ case ColorDomain::NonStroking:
+ *currentPage << "/CSpcmyk cs\n"; break;
+ case ColorDomain::NonStrokingPattern:
+ *currentPage << "/PCSpcmyk cs\n"; break;
+ }
+ break;
+ case QPdfEngine::ColorModel::Auto:
+ Q_UNREACHABLE_RETURN();
+ }
+
+ // If we also have a color specified, write it out.
+ if (!color.isValid())
+ return;
+
+ switch (actualColorModel) {
+ case QPdfEngine::ColorModel::RGB:
+ *currentPage << color.redF()
+ << color.greenF()
+ << color.blueF();
+ break;
+ case QPdfEngine::ColorModel::Grayscale: {
+ const qreal gray = qGray(color.rgba()) / 255.;
+ *currentPage << gray;
+ break;
+ }
+ case QPdfEngine::ColorModel::CMYK:
+ *currentPage << color.cyanF()
+ << color.magentaF()
+ << color.yellowF()
+ << color.blackF();
+ break;
+ case QPdfEngine::ColorModel::Auto:
+ Q_UNREACHABLE_RETURN();
+ }
}
void QPdfEnginePrivate::writeInfo()
@@ -1664,39 +1744,46 @@ void QPdfEnginePrivate::writeInfo()
"endobj\n");
}
-int QPdfEnginePrivate::writeXmpMetaData()
+int QPdfEnginePrivate::writeXmpDcumentMetaData()
{
const int metaDataObj = addXrefEntry(-1);
+ QByteArray metaDataContent;
+
+ if (xmpDocumentMetadata.isEmpty()) {
+ const QString producer(QString::fromLatin1("Qt " QT_VERSION_STR));
+
+ const QDateTime now = QDateTime::currentDateTime();
+ const QDate date = now.date();
+ const QTime time = now.time();
+ const QString timeStr =
+ QString::asprintf("%d-%02d-%02dT%02d:%02d:%02d",
+ date.year(), date.month(), date.day(),
+ time.hour(), time.minute(), time.second());
+
+ const int offset = now.offsetFromUtc();
+ const int hours = (offset / 60) / 60;
+ const int mins = (offset / 60) % 60;
+ QString tzStr;
+ if (offset < 0)
+ tzStr = QString::asprintf("-%02d:%02d", -hours, -mins);
+ else if (offset > 0)
+ tzStr = QString::asprintf("+%02d:%02d", hours , mins);
+ else
+ tzStr = "Z"_L1;
- const QString producer(QString::fromLatin1("Qt " QT_VERSION_STR));
-
- const QDateTime now = QDateTime::currentDateTime();
- const QDate date = now.date();
- const QTime time = now.time();
- const QString timeStr =
- QString::asprintf("%d-%02d-%02dT%02d:%02d:%02d",
- date.year(), date.month(), date.day(),
- time.hour(), time.minute(), time.second());
+ const QString metaDataDate = timeStr + tzStr;
- const int offset = now.offsetFromUtc();
- const int hours = (offset / 60) / 60;
- const int mins = (offset / 60) % 60;
- QString tzStr;
- if (offset < 0)
- tzStr = QString::asprintf("-%02d:%02d", -hours, -mins);
- else if (offset > 0)
- tzStr = QString::asprintf("+%02d:%02d", hours , mins);
+ QFile metaDataFile(":/qpdf/qpdfa_metadata.xml"_L1);
+ bool ok = metaDataFile.open(QIODevice::ReadOnly);
+ Q_ASSERT(ok);
+ metaDataContent = QString::fromUtf8(metaDataFile.readAll()).arg(producer.toHtmlEscaped(),
+ title.toHtmlEscaped(),
+ creator.toHtmlEscaped(),
+ metaDataDate).toUtf8();
+ }
else
- tzStr = QLatin1String("Z");
-
- const QString metaDataDate = timeStr + tzStr;
+ metaDataContent = xmpDocumentMetadata;
- QFile metaDataFile(QLatin1String(":/qpdf/qpdfa_metadata.xml"));
- metaDataFile.open(QIODevice::ReadOnly);
- const QByteArray metaDataContent = QString::fromUtf8(metaDataFile.readAll()).arg(producer.toHtmlEscaped(),
- title.toHtmlEscaped(),
- creator.toHtmlEscaped(),
- metaDataDate).toUtf8();
xprintf("<<\n"
"/Type /Metadata /Subtype /XML\n"
"/Length %d\n"
@@ -1713,8 +1800,9 @@ int QPdfEnginePrivate::writeOutputIntent()
{
const int colorProfile = addXrefEntry(-1);
{
- QFile colorProfileFile(QLatin1String(":/qpdf/sRGB2014.icc"));
- colorProfileFile.open(QIODevice::ReadOnly);
+ QFile colorProfileFile(":/qpdf/sRGB2014.icc"_L1);
+ bool ok = colorProfileFile.open(QIODevice::ReadOnly);
+ Q_ASSERT(ok);
const QByteArray colorProfileData = colorProfileFile.readAll();
QByteArray data;
@@ -1774,6 +1862,103 @@ void QPdfEnginePrivate::writePageRoot()
"endobj\n");
}
+void QPdfEnginePrivate::writeDestsRoot()
+{
+ if (destCache.isEmpty())
+ return;
+
+ QHash<QString, int> destObjects;
+ QByteArray xs, ys;
+ for (const DestInfo &destInfo : std::as_const(destCache)) {
+ int destObj = addXrefEntry(-1);
+ xs.setNum(static_cast<double>(destInfo.coords.x()), 'f');
+ ys.setNum(static_cast<double>(destInfo.coords.y()), 'f');
+ xprintf("[%d 0 R /XYZ %s %s 0]\n", destInfo.pageObj, xs.constData(), ys.constData());
+ xprintf("endobj\n");
+ destObjects.insert(destInfo.anchor, destObj);
+ }
+
+ // names
+ destsRoot = addXrefEntry(-1);
+ QStringList anchors = destObjects.keys();
+ anchors.sort();
+ xprintf("<<\n/Limits [");
+ printString(anchors.constFirst());
+ xprintf(" ");
+ printString(anchors.constLast());
+ xprintf("]\n/Names [\n");
+ for (const QString &anchor : std::as_const(anchors)) {
+ printString(anchor);
+ xprintf(" %d 0 R\n", destObjects[anchor]);
+ }
+ xprintf("]\n>>\n"
+ "endobj\n");
+}
+
+void QPdfEnginePrivate::writeAttachmentRoot()
+{
+ if (fileCache.isEmpty())
+ return;
+
+ QList<int> attachments;
+ const int size = fileCache.size();
+ for (int i = 0; i < size; ++i) {
+ auto attachment = fileCache.at(i);
+ const int attachmentID = addXrefEntry(-1);
+ xprintf("<<\n");
+ if (do_compress)
+ xprintf("/Filter /FlateDecode\n");
+
+ const int lenobj = requestObject();
+ xprintf("/Length %d 0 R\n", lenobj);
+ int len = 0;
+ xprintf(">>\nstream\n");
+ len = writeCompressed(attachment.data);
+ xprintf("\nendstream\n"
+ "endobj\n");
+ addXrefEntry(lenobj);
+ xprintf("%d\n"
+ "endobj\n", len);
+
+ attachments.push_back(addXrefEntry(-1));
+ xprintf("<<\n"
+ "/F (%s)", attachment.fileName.toLatin1().constData());
+
+ xprintf("\n/EF <</F %d 0 R>>\n"
+ "/Type/Filespec\n"
+ , attachmentID);
+ if (!attachment.mimeType.isEmpty())
+ xprintf("/Subtype/%s\n",
+ attachment.mimeType.replace("/"_L1, "#2F"_L1).toLatin1().constData());
+ xprintf(">>\nendobj\n");
+ }
+
+ // names
+ attachmentsRoot = addXrefEntry(-1);
+ xprintf("<</Names[");
+ for (int i = 0; i < size; ++i) {
+ auto attachment = fileCache.at(i);
+ printString(attachment.fileName);
+ xprintf("%d 0 R\n", attachments.at(i));
+ }
+ xprintf("]>>\n"
+ "endobj\n");
+}
+
+void QPdfEnginePrivate::writeNamesRoot()
+{
+ addXrefEntry(namesRoot);
+ xprintf("<<\n");
+
+ if (attachmentsRoot)
+ xprintf("/EmbeddedFiles %d 0 R\n", attachmentsRoot);
+
+ if (destsRoot)
+ xprintf("/Dests %d 0 R\n", destsRoot);
+
+ xprintf(">>\n");
+ xprintf("endobj\n");
+}
void QPdfEnginePrivate::embedFont(QFontSubset *font)
{
@@ -1868,7 +2053,7 @@ void QPdfEnginePrivate::embedFont(QFontSubset *font)
addXrefEntry(toUnicode);
QByteArray touc = font->createToUnicodeMap();
xprintf("<< /Length %d >>\n"
- "stream\n", touc.length());
+ "stream\n", touc.size());
write(touc);
write("\nendstream\n"
"endobj\n");
@@ -1891,7 +2076,7 @@ void QPdfEnginePrivate::embedFont(QFontSubset *font)
QByteArray cidSetStream(font->nGlyphs() / 8 + 1, 0);
int byteCounter = 0;
int bitCounter = 0;
- for (int i = 0; i < font->nGlyphs(); ++i) {
+ for (qsizetype i = 0; i < font->nGlyphs(); ++i) {
cidSetStream.data()[byteCounter] |= (1 << (7 - bitCounter));
bitCounter++;
@@ -1972,12 +2157,18 @@ void QPdfEnginePrivate::writePage()
xprintf("<<\n"
"/ColorSpace <<\n"
"/PCSp %d 0 R\n"
+ "/PCSpg %d 0 R\n"
+ "/PCSpcmyk %d 0 R\n"
"/CSp /DeviceRGB\n"
"/CSpg /DeviceGray\n"
+ "/CSpcmyk /DeviceCMYK\n"
">>\n"
"/ExtGState <<\n"
"/GSa %d 0 R\n",
- patternColorSpace, graphicsState);
+ patternColorSpaceRGB,
+ patternColorSpaceGrayscale,
+ patternColorSpaceCMYK,
+ graphicsState);
for (int i = 0; i < currentPage->graphicStates.size(); ++i)
xprintf("/GState%d %d 0 R\n", currentPage->graphicStates.at(i), currentPage->graphicStates.at(i));
@@ -2031,6 +2222,10 @@ void QPdfEnginePrivate::writeTail()
writePage();
writeFonts();
writePageRoot();
+ writeDestsRoot();
+ writeAttachmentRoot();
+ writeNamesRoot();
+
addXrefEntry(xrefPositions.size(),false);
xprintf("xref\n"
"0 %d\n"
@@ -2078,7 +2273,7 @@ int QPdfEnginePrivate::addXrefEntry(int object, bool printostr)
return object;
}
-void QPdfEnginePrivate::printString(const QString &string)
+void QPdfEnginePrivate::printString(QStringView string)
{
if (string.isEmpty()) {
write("()");
@@ -2089,9 +2284,9 @@ void QPdfEnginePrivate::printString(const QString &string)
// Unicode UTF-16 with a Unicode byte order mark as the first character
// (0xfeff), with the high-order byte first.
QByteArray array("(\xfe\xff");
- const ushort *utf16 = string.utf16();
+ const char16_t *utf16 = string.utf16();
- for (int i=0; i < string.size(); ++i) {
+ for (qsizetype i = 0; i < string.size(); ++i) {
char part[2] = {char((*(utf16 + i)) >> 8), char((*(utf16 + i)) & 0xff)};
for(int j=0; j < 2; ++j) {
if (part[j] == '(' || part[j] == ')' || part[j] == '\\')
@@ -2207,17 +2402,16 @@ int QPdfEnginePrivate::writeCompressed(QIODevice *dev)
int QPdfEnginePrivate::writeCompressed(const char *src, int len)
{
#ifndef QT_NO_COMPRESS
- if(do_compress) {
- uLongf destLen = len + len/100 + 13; // zlib requirement
- Bytef* dest = new Bytef[destLen];
- if (Z_OK == ::compress(dest, &destLen, (const Bytef*) src, (uLongf)len)) {
- stream->writeRawData((const char*)dest, destLen);
+ if (do_compress) {
+ const QByteArray data = qCompress(reinterpret_cast<const uchar *>(src), len);
+ constexpr qsizetype HeaderSize = 4;
+ if (!data.isNull()) {
+ stream->writeRawData(data.data() + HeaderSize, data.size() - HeaderSize);
+ len = data.size() - HeaderSize;
} else {
qWarning("QPdfStream::writeCompressed: Error in compress()");
- destLen = 0;
+ len = 0;
}
- delete [] dest;
- len = destLen;
} else
#endif
{
@@ -2227,7 +2421,7 @@ int QPdfEnginePrivate::writeCompressed(const char *src, int len)
return len;
}
-int QPdfEnginePrivate::writeImage(const QByteArray &data, int width, int height, int depth,
+int QPdfEnginePrivate::writeImage(const QByteArray &data, int width, int height, WriteImageOption option,
int maskObject, int softMaskObject, bool dct, bool isMono)
{
int image = addXrefEntry(-1);
@@ -2237,7 +2431,8 @@ int QPdfEnginePrivate::writeImage(const QByteArray &data, int width, int height,
"/Width %d\n"
"/Height %d\n", width, height);
- if (depth == 1) {
+ switch (option) {
+ case WriteImageOption::Monochrome:
if (!isMono) {
xprintf("/ImageMask true\n"
"/Decode [1 0]\n");
@@ -2245,10 +2440,21 @@ int QPdfEnginePrivate::writeImage(const QByteArray &data, int width, int height,
xprintf("/BitsPerComponent 1\n"
"/ColorSpace /DeviceGray\n");
}
- } else {
+ break;
+ case WriteImageOption::Grayscale:
xprintf("/BitsPerComponent 8\n"
- "/ColorSpace %s\n", (depth == 32) ? "/DeviceRGB" : "/DeviceGray");
+ "/ColorSpace /DeviceGray\n");
+ break;
+ case WriteImageOption::RGB:
+ xprintf("/BitsPerComponent 8\n"
+ "/ColorSpace /DeviceRGB\n");
+ break;
+ case WriteImageOption::CMYK:
+ xprintf("/BitsPerComponent 8\n"
+ "/ColorSpace /DeviceCMYK\n");
+ break;
}
+
if (maskObject > 0)
xprintf("/Mask %d 0 R\n", maskObject);
if (softMaskObject > 0)
@@ -2263,7 +2469,7 @@ int QPdfEnginePrivate::writeImage(const QByteArray &data, int width, int height,
//qDebug("DCT");
xprintf("/Filter /DCTDecode\n>>\nstream\n");
write(data);
- len = data.length();
+ len = data.size();
} else {
if (do_compress)
xprintf("/Filter /FlateDecode\n>>\nstream\n");
@@ -2287,7 +2493,23 @@ struct QGradientBound {
};
Q_DECLARE_TYPEINFO(QGradientBound, Q_PRIMITIVE_TYPE);
-int QPdfEnginePrivate::createShadingFunction(const QGradient *gradient, int from, int to, bool reflect, bool alpha)
+void QPdfEnginePrivate::ShadingFunctionResult::writeColorSpace(QPdf::ByteStream *stream) const
+{
+ *stream << "/ColorSpace ";
+ switch (colorModel) {
+ case QPdfEngine::ColorModel::RGB:
+ *stream << "/DeviceRGB\n"; break;
+ case QPdfEngine::ColorModel::Grayscale:
+ *stream << "/DeviceGray\n"; break;
+ case QPdfEngine::ColorModel::CMYK:
+ *stream << "/DeviceCMYK\n"; break;
+ case QPdfEngine::ColorModel::Auto:
+ Q_UNREACHABLE(); break;
+ }
+}
+
+QPdfEnginePrivate::ShadingFunctionResult
+QPdfEnginePrivate::createShadingFunction(const QGradient *gradient, int from, int to, bool reflect, bool alpha)
{
QGradientStops stops = gradient->stops();
if (stops.isEmpty()) {
@@ -2299,7 +2521,36 @@ int QPdfEnginePrivate::createShadingFunction(const QGradient *gradient, int from
if (stops.at(stops.size() - 1).first < 1)
stops.append(QGradientStop(1, stops.at(stops.size() - 1).second));
- QVector<int> functions;
+ // Color to use which colorspace to use
+ const QColor referenceColor = stops.constFirst().second;
+
+ switch (colorModel) {
+ case QPdfEngine::ColorModel::RGB:
+ case QPdfEngine::ColorModel::Grayscale:
+ case QPdfEngine::ColorModel::CMYK:
+ break;
+ case QPdfEngine::ColorModel::Auto: {
+ // Make sure that all the stops have the same color spec
+ // (we don't support anything else)
+ const QColor::Spec referenceSpec = referenceColor.spec();
+ bool warned = false;
+ for (QGradientStop &stop : stops) {
+ if (stop.second.spec() != referenceSpec) {
+ if (!warned) {
+ qWarning("QPdfEngine: unable to create a gradient between colors of different spec");
+ warned = true;
+ }
+ stop.second = stop.second.convertTo(referenceSpec);
+ }
+ }
+ break;
+ }
+ }
+
+ ShadingFunctionResult result;
+ result.colorModel = colorModelForColor(referenceColor);
+
+ QList<int> functions;
const int numStops = stops.size();
functions.reserve(numStops - 1);
for (int i = 0; i < numStops - 1; ++i) {
@@ -2314,8 +2565,31 @@ int QPdfEnginePrivate::createShadingFunction(const QGradient *gradient, int from
s << "/C0 [" << stops.at(i).second.alphaF() << "]\n"
"/C1 [" << stops.at(i + 1).second.alphaF() << "]\n";
} else {
- s << "/C0 [" << stops.at(i).second.redF() << stops.at(i).second.greenF() << stops.at(i).second.blueF() << "]\n"
- "/C1 [" << stops.at(i + 1).second.redF() << stops.at(i + 1).second.greenF() << stops.at(i + 1).second.blueF() << "]\n";
+ switch (result.colorModel) {
+ case QPdfEngine::ColorModel::RGB:
+ s << "/C0 [" << stops.at(i).second.redF() << stops.at(i).second.greenF() << stops.at(i).second.blueF() << "]\n"
+ "/C1 [" << stops.at(i + 1).second.redF() << stops.at(i + 1).second.greenF() << stops.at(i + 1).second.blueF() << "]\n";
+ break;
+ case QPdfEngine::ColorModel::Grayscale:
+ s << "/C0 [" << (qGray(stops.at(i).second.rgba()) / 255.) << "]\n"
+ "/C1 [" << (qGray(stops.at(i + 1).second.rgba()) / 255.) << "]\n";
+ break;
+ case QPdfEngine::ColorModel::CMYK:
+ s << "/C0 [" << stops.at(i).second.cyanF()
+ << stops.at(i).second.magentaF()
+ << stops.at(i).second.yellowF()
+ << stops.at(i).second.blackF() << "]\n"
+ "/C1 [" << stops.at(i + 1).second.cyanF()
+ << stops.at(i + 1).second.magentaF()
+ << stops.at(i + 1).second.yellowF()
+ << stops.at(i + 1).second.blackF() << "]\n";
+ break;
+
+ case QPdfEngine::ColorModel::Auto:
+ Q_UNREACHABLE();
+ break;
+ }
+
}
s << ">>\n"
"endobj\n";
@@ -2323,7 +2597,7 @@ int QPdfEnginePrivate::createShadingFunction(const QGradient *gradient, int from
functions << f;
}
- QVector<QGradientBound> gradientBounds;
+ QList<QGradientBound> gradientBounds;
gradientBounds.reserve((to - from) * (numStops - 1));
for (int step = from; step < to; ++step) {
@@ -2383,7 +2657,8 @@ int QPdfEnginePrivate::createShadingFunction(const QGradient *gradient, int from
} else {
function = functions.at(0);
}
- return function;
+ result.function = function;
+ return result;
}
int QPdfEnginePrivate::generateLinearGradientShader(const QLinearGradient *gradient, const QTransform &matrix, bool alpha)
@@ -2429,17 +2704,22 @@ int QPdfEnginePrivate::generateLinearGradientShader(const QLinearGradient *gradi
}
}
- int function = createShadingFunction(gradient, from, to, reflect, alpha);
+ const auto shadingFunctionResult = createShadingFunction(gradient, from, to, reflect, alpha);
QByteArray shader;
QPdf::ByteStream s(&shader);
s << "<<\n"
- "/ShadingType 2\n"
- "/ColorSpace " << (alpha ? "/DeviceGray\n" : "/DeviceRGB\n") <<
- "/AntiAlias true\n"
+ "/ShadingType 2\n";
+
+ if (alpha)
+ s << "/ColorSpace /DeviceGray\n";
+ else
+ shadingFunctionResult.writeColorSpace(&s);
+
+ s << "/AntiAlias true\n"
"/Coords [" << start.x() << start.y() << stop.x() << stop.y() << "]\n"
"/Extend [true true]\n"
- "/Function " << function << "0 R\n"
+ "/Function " << shadingFunctionResult.function << "0 R\n"
">>\n"
"endobj\n";
int shaderObject = addXrefEntry(-1);
@@ -2497,18 +2777,23 @@ int QPdfEnginePrivate::generateRadialGradientShader(const QRadialGradient *gradi
}
}
- int function = createShadingFunction(gradient, from, to, reflect, alpha);
+ const auto shadingFunctionResult = createShadingFunction(gradient, from, to, reflect, alpha);
QByteArray shader;
QPdf::ByteStream s(&shader);
s << "<<\n"
- "/ShadingType 3\n"
- "/ColorSpace " << (alpha ? "/DeviceGray\n" : "/DeviceRGB\n") <<
- "/AntiAlias true\n"
+ "/ShadingType 3\n";
+
+ if (alpha)
+ s << "/ColorSpace /DeviceGray\n";
+ else
+ shadingFunctionResult.writeColorSpace(&s);
+
+ s << "/AntiAlias true\n"
"/Domain [0 1]\n"
"/Coords [" << p0.x() << p0.y() << r0 << p1.x() << p1.y() << r1 << "]\n"
"/Extend [true true]\n"
- "/Function " << function << "0 R\n"
+ "/Function " << shadingFunctionResult.function << "0 R\n"
">>\n"
"endobj\n";
int shaderObject = addXrefEntry(-1);
@@ -2594,7 +2879,7 @@ int QPdfEnginePrivate::gradientBrush(const QBrush &b, const QTransform &matrix,
"/Shading << /Shader" << alphaShaderObject << alphaShaderObject << "0 R >>\n"
">>\n";
- f << "/Length " << content.length() << "\n"
+ f << "/Length " << content.size() << "\n"
">>\n"
"stream\n"
<< content
@@ -2617,7 +2902,7 @@ int QPdfEnginePrivate::addConstantAlphaObject(int brushAlpha, int penAlpha)
{
if (brushAlpha == 255 && penAlpha == 255)
return 0;
- int object = alphaCache.value(QPair<uint, uint>(brushAlpha, penAlpha), 0);
+ uint object = alphaCache.value(QPair<uint, uint>(brushAlpha, penAlpha), 0);
if (!object) {
object = addXrefEntry(-1);
QByteArray alphaDef;
@@ -2645,17 +2930,23 @@ int QPdfEnginePrivate::addBrushPattern(const QTransform &m, bool *specifyColor,
*specifyColor = true;
*gStateObject = 0;
- QTransform matrix = m;
+ const Qt::BrushStyle style = brush.style();
+ const bool isCosmetic = style >= Qt::Dense1Pattern && style <= Qt::DiagCrossPattern
+ && !q->painter()->testRenderHint(QPainter::NonCosmeticBrushPatterns);
+ QTransform matrix;
+ if (!isCosmetic)
+ matrix = m;
matrix.translate(brushOrigin.x(), brushOrigin.y());
matrix = matrix * pageMatrix();
- //qDebug() << brushOrigin << matrix;
- Qt::BrushStyle style = brush.style();
if (style == Qt::LinearGradientPattern || style == Qt::RadialGradientPattern) {// && style <= Qt::ConicalGradientPattern) {
*specifyColor = false;
return gradientBrush(brush, matrix, gStateObject);
}
+ if (!isCosmetic)
+ matrix = brush.transform() * matrix;
+
if ((!brush.isOpaque() && brush.style() < Qt::LinearGradientPattern) || opacity != 1.0)
*gStateObject = addConstantAlphaObject(qRound(brush.color().alpha() * opacity),
qRound(pen.color().alpha() * opacity));
@@ -2706,7 +2997,7 @@ int QPdfEnginePrivate::addBrushPattern(const QTransform &m, bool *specifyColor,
s << "/XObject << /Im" << imageObject << ' ' << imageObject << "0 R >> ";
}
s << ">>\n"
- "/Length " << pattern.length() << "\n"
+ "/Length " << pattern.size() << "\n"
">>\n"
"stream\n"
<< pattern
@@ -2719,7 +3010,7 @@ int QPdfEnginePrivate::addBrushPattern(const QTransform &m, bool *specifyColor,
return patternObj;
}
-static inline bool is_monochrome(const QVector<QRgb> &colorTable)
+static inline bool is_monochrome(const QList<QRgb> &colorTable)
{
return colorTable.size() == 2
&& colorTable.at(0) == QColor(Qt::black).rgba()
@@ -2736,11 +3027,12 @@ int QPdfEnginePrivate::addImage(const QImage &img, bool *bitmap, bool lossless,
return -1;
int object = imageCache.value(serial_no);
- if(object)
+ if (object)
return object;
QImage image = img;
QImage::Format format = image.format();
+ const bool grayscale = (colorModel == QPdfEngine::ColorModel::Grayscale);
if (pdfVersion == QPdfEngine::Version_A1b) {
if (image.hasAlphaChannel()) {
@@ -2764,7 +3056,7 @@ int QPdfEnginePrivate::addImage(const QImage &img, bool *bitmap, bool lossless,
format = QImage::Format_Mono;
} else {
*bitmap = false;
- if (format != QImage::Format_RGB32 && format != QImage::Format_ARGB32) {
+ if (format != QImage::Format_RGB32 && format != QImage::Format_ARGB32 && format != QImage::Format_CMYK8888) {
image = image.convertToFormat(QImage::Format_ARGB32);
format = QImage::Format_ARGB32;
}
@@ -2772,7 +3064,6 @@ int QPdfEnginePrivate::addImage(const QImage &img, bool *bitmap, bool lossless,
int w = image.width();
int h = image.height();
- int d = image.depth();
if (format == QImage::Format_Mono) {
int bytesPerLine = (w + 7) >> 3;
@@ -2783,7 +3074,7 @@ int QPdfEnginePrivate::addImage(const QImage &img, bool *bitmap, bool lossless,
memcpy(rawdata, image.constScanLine(y), bytesPerLine);
rawdata += bytesPerLine;
}
- object = writeImage(data, w, h, d, 0, 0, false, is_monochrome(img.colorTable()));
+ object = writeImage(data, w, h, WriteImageOption::Monochrome, 0, 0, false, is_monochrome(img.colorTable()));
} else {
QByteArray softMaskData;
bool dct = false;
@@ -2795,10 +3086,14 @@ int QPdfEnginePrivate::addImage(const QImage &img, bool *bitmap, bool lossless,
QBuffer buffer(&imageData);
QImageWriter writer(&buffer, "jpeg");
writer.setQuality(94);
+ if (format == QImage::Format_CMYK8888) {
+ // PDFs require CMYK colors not to be inverted in the JPEG encoding
+ writer.setSubType("CMYK");
+ }
writer.write(image);
dct = true;
- if (format != QImage::Format_RGB32) {
+ if (format != QImage::Format_RGB32 && format != QImage::Format_CMYK8888) {
softMaskData.resize(w * h);
uchar *sdata = (uchar *)softMaskData.data();
for (int y = 0; y < h; ++y) {
@@ -2813,41 +3108,59 @@ int QPdfEnginePrivate::addImage(const QImage &img, bool *bitmap, bool lossless,
}
}
} else {
- imageData.resize(grayscale ? w * h : 3 * w * h);
- uchar *data = (uchar *)imageData.data();
- softMaskData.resize(w * h);
- uchar *sdata = (uchar *)softMaskData.data();
- for (int y = 0; y < h; ++y) {
- const QRgb *rgb = (const QRgb *)image.constScanLine(y);
+ if (format == QImage::Format_CMYK8888) {
+ imageData.resize(grayscale ? w * h : w * h * 4);
+ uchar *data = (uchar *)imageData.data();
+ const qsizetype bytesPerLine = image.bytesPerLine();
if (grayscale) {
- for (int x = 0; x < w; ++x) {
- *(data++) = qGray(*rgb);
- uchar alpha = qAlpha(*rgb);
- *sdata++ = alpha;
- hasMask |= (alpha < 255);
- hasAlpha |= (alpha != 0 && alpha != 255);
- ++rgb;
+ for (int y = 0; y < h; ++y) {
+ const uint *cmyk = (const uint *)image.constScanLine(y);
+ for (int x = 0; x < w; ++x)
+ *data++ = qGray(QCmyk32::fromCmyk32(*cmyk++).toColor().rgba());
}
} else {
- for (int x = 0; x < w; ++x) {
- *(data++) = qRed(*rgb);
- *(data++) = qGreen(*rgb);
- *(data++) = qBlue(*rgb);
- uchar alpha = qAlpha(*rgb);
- *sdata++ = alpha;
- hasMask |= (alpha < 255);
- hasAlpha |= (alpha != 0 && alpha != 255);
- ++rgb;
+ for (int y = 0; y < h; ++y) {
+ uchar *start = data + y * w * 4;
+ memcpy(start, image.constScanLine(y), bytesPerLine);
+ }
+ }
+ } else {
+ imageData.resize(grayscale ? w * h : 3 * w * h);
+ uchar *data = (uchar *)imageData.data();
+ softMaskData.resize(w * h);
+ uchar *sdata = (uchar *)softMaskData.data();
+ for (int y = 0; y < h; ++y) {
+ const QRgb *rgb = (const QRgb *)image.constScanLine(y);
+ if (grayscale) {
+ for (int x = 0; x < w; ++x) {
+ *(data++) = qGray(*rgb);
+ uchar alpha = qAlpha(*rgb);
+ *sdata++ = alpha;
+ hasMask |= (alpha < 255);
+ hasAlpha |= (alpha != 0 && alpha != 255);
+ ++rgb;
+ }
+ } else {
+ for (int x = 0; x < w; ++x) {
+ *(data++) = qRed(*rgb);
+ *(data++) = qGreen(*rgb);
+ *(data++) = qBlue(*rgb);
+ uchar alpha = qAlpha(*rgb);
+ *sdata++ = alpha;
+ hasMask |= (alpha < 255);
+ hasAlpha |= (alpha != 0 && alpha != 255);
+ ++rgb;
+ }
}
}
}
- if (format == QImage::Format_RGB32)
+ if (format == QImage::Format_RGB32 || format == QImage::Format_CMYK8888)
hasAlpha = hasMask = false;
}
int maskObject = 0;
int softMaskObject = 0;
if (hasAlpha) {
- softMaskObject = writeImage(softMaskData, w, h, 8, 0, 0);
+ softMaskObject = writeImage(softMaskData, w, h, WriteImageOption::Grayscale, 0, 0);
} else if (hasMask) {
// dither the soft mask to 1bit and add it. This also helps PDF viewers
// without transparency support
@@ -2863,9 +3176,18 @@ int QPdfEnginePrivate::addImage(const QImage &img, bool *bitmap, bool lossless,
}
mdata += bytesPerLine;
}
- maskObject = writeImage(mask, w, h, 1, 0, 0);
+ maskObject = writeImage(mask, w, h, WriteImageOption::Monochrome, 0, 0);
}
- object = writeImage(imageData, w, h, grayscale ? 8 : 32,
+
+ const WriteImageOption option = [&]() {
+ if (grayscale)
+ return WriteImageOption::Grayscale;
+ if (format == QImage::Format_CMYK8888)
+ return WriteImageOption::CMYK;
+ return WriteImageOption::RGB;
+ }();
+
+ object = writeImage(imageData, w, h, option,
maskObject, softMaskObject, dct);
}
imageCache.insert(serial_no, object);
@@ -2876,7 +3198,9 @@ void QPdfEnginePrivate::drawTextItem(const QPointF &p, const QTextItemInt &ti)
{
Q_Q(QPdfEngine);
- if (ti.charFormat.isAnchor()) {
+ const bool isLink = ti.charFormat.hasProperty(QTextFormat::AnchorHref);
+ const bool isAnchor = ti.charFormat.hasProperty(QTextFormat::AnchorName);
+ if (isLink || isAnchor) {
qreal size = ti.fontEngine->fontDef.pixelSize;
int synthesized = ti.fontEngine->synthesized();
qreal stretch = synthesized & QFontEngine::SynthesizedStretch ? ti.fontEngine->fontDef.stretch/100. : 1.;
@@ -2896,32 +3220,47 @@ void QPdfEnginePrivate::drawTextItem(const QPointF &p, const QTextItemInt &ti)
trans.map(0, 0, &x1, &y1);
trans.map(ti.width.toReal()/size, (ti.ascent.toReal()-ti.descent.toReal())/size, &x2, &y2);
- uint annot = addXrefEntry(-1);
- QByteArray x1s, y1s, x2s, y2s;
- x1s.setNum(static_cast<double>(x1), 'f');
- y1s.setNum(static_cast<double>(y1), 'f');
- x2s.setNum(static_cast<double>(x2), 'f');
- y2s.setNum(static_cast<double>(y2), 'f');
- QByteArray rectData = x1s + ' ' + y1s + ' ' + x2s + ' ' + y2s;
- xprintf("<<\n/Type /Annot\n/Subtype /Link\n");
-
- if (pdfVersion == QPdfEngine::Version_A1b)
- xprintf("/F 4\n"); // enable print flag, disable all other
-
- xprintf("/Rect [");
- xprintf(rectData.constData());
+ if (isLink) {
+ uint annot = addXrefEntry(-1);
+ QByteArray x1s, y1s, x2s, y2s;
+ x1s.setNum(static_cast<double>(x1), 'f');
+ y1s.setNum(static_cast<double>(y1), 'f');
+ x2s.setNum(static_cast<double>(x2), 'f');
+ y2s.setNum(static_cast<double>(y2), 'f');
+ QByteArray rectData = x1s + ' ' + y1s + ' ' + x2s + ' ' + y2s;
+ xprintf("<<\n/Type /Annot\n/Subtype /Link\n");
+
+ if (pdfVersion == QPdfEngine::Version_A1b)
+ xprintf("/F 4\n"); // enable print flag, disable all other
+
+ xprintf("/Rect [");
+ xprintf(rectData.constData());
#ifdef Q_DEBUG_PDF_LINKS
- xprintf("]\n/Border [16 16 1]\n/A <<\n");
+ xprintf("]\n/Border [16 16 1]\n");
#else
- xprintf("]\n/Border [0 0 0]\n/A <<\n");
+ xprintf("]\n/Border [0 0 0]\n");
#endif
- xprintf("/Type /Action\n/S /URI\n/URI (%s)\n",
- ti.charFormat.anchorHref().toLatin1().constData());
- xprintf(">>\n>>\n");
- xprintf("endobj\n");
+ const QString link = ti.charFormat.anchorHref();
+ const bool isInternal = link.startsWith(QLatin1Char('#'));
+ if (!isInternal) {
+ xprintf("/A <<\n");
+ xprintf("/Type /Action\n/S /URI\n/URI (%s)\n", link.toLatin1().constData());
+ xprintf(">>\n");
+ } else {
+ xprintf("/Dest ");
+ printString(link.sliced(1));
+ xprintf("\n");
+ }
+ xprintf(">>\n");
+ xprintf("endobj\n");
- if (!currentPage->annotations.contains(annot)) {
- currentPage->annotations.append(annot);
+ if (!currentPage->annotations.contains(annot)) {
+ currentPage->annotations.append(annot);
+ }
+ } else {
+ const QString anchor = ti.charFormat.anchorNames().constFirst();
+ const uint curPage = pages.last();
+ destCache.append(DestInfo({ anchor, curPage, QPointF(x1, y2) }));
}
}
@@ -2941,7 +3280,7 @@ void QPdfEnginePrivate::drawTextItem(const QPointF &p, const QTextItemInt &ti)
noEmbed = true;
}
- QFontSubset *font = fonts.value(face_id, 0);
+ QFontSubset *font = fonts.value(face_id, nullptr);
if (!font) {
font = new QFontSubset(fe, requestObject());
font->noEmbed = noEmbed;
@@ -3003,7 +3342,7 @@ void QPdfEnginePrivate::drawTextItem(const QPointF &p, const QTextItemInt &ti)
x += .3*y;
x /= stretch;
char buf[5];
- int g = font->addGlyph(glyphs[i]);
+ qsizetype g = font->addGlyph(glyphs[i]);
*currentPage << x - last_x << last_y - y << "Td <"
<< QPdf::toHex((ushort)g, buf) << "> Tj\n";
last_x = x;
@@ -3023,7 +3362,7 @@ void QPdfEnginePrivate::drawTextItem(const QPointF &p, const QTextItemInt &ti)
x += .3*y;
x /= stretch;
char buf[5];
- int g = font->addGlyph(glyphs[i]);
+ qsizetype g = font->addGlyph(glyphs[i]);
*currentPage << x - last_x << last_y - y << "Td <"
<< QPdf::toHex((ushort)g, buf) << "> Tj\n";
last_x = x;
diff --git a/src/gui/painting/qpdf.qrc b/src/gui/painting/qpdf.qrc
deleted file mode 100644
index 56359c775b..0000000000
--- a/src/gui/painting/qpdf.qrc
+++ /dev/null
@@ -1,7 +0,0 @@
-<!DOCTYPE RCC>
-<RCC version="1.0">
- <qresource prefix="qpdf/">
- <file>qpdfa_metadata.xml</file>
- <file alias="sRGB2014.icc">../../3rdparty/icc/sRGB2014.icc</file>
- </qresource>
-</RCC>
diff --git a/src/gui/painting/qpdf_p.h b/src/gui/painting/qpdf_p.h
index 89e549614a..3c34e0bd7a 100644
--- a/src/gui/painting/qpdf_p.h
+++ b/src/gui/painting/qpdf_p.h
@@ -1,41 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the QtGui module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#ifndef QPDF_P_H
#define QPDF_P_H
@@ -55,13 +19,12 @@
#ifndef QT_NO_PDF
-#include "QtGui/qmatrix.h"
+#include "QtCore/qlist.h"
#include "QtCore/qstring.h"
-#include "QtCore/qvector.h"
-#include "private/qstroker_p.h"
-#include "private/qpaintengine_p.h"
#include "private/qfontengine_p.h"
#include "private/qfontsubset_p.h"
+#include "private/qpaintengine_p.h"
+#include "private/qstroker_p.h"
#include "qpagelayout.h"
QT_BEGIN_NAMESPACE
@@ -87,6 +50,8 @@ namespace QPdf {
ByteStream &operator <<(const ByteStream &src);
ByteStream &operator <<(qreal val);
ByteStream &operator <<(int val);
+ ByteStream &operator <<(uint val) { return (*this << int(val)); }
+ ByteStream &operator <<(qint64 val) { return (*this << int(val)); }
ByteStream &operator <<(const QPointF &p);
// Note that the stream may be invalidated by calls that insert data.
QIODevice *stream();
@@ -95,10 +60,6 @@ namespace QPdf {
static inline int maxMemorySize() { return 100000000; }
static inline int chunkSize() { return 10000000; }
- protected:
- void constructor_helper(QIODevice *dev);
- void constructor_helper(QByteArray *ba);
-
private:
void prepareBuffer();
@@ -148,13 +109,13 @@ class QPdfPage : public QPdf::ByteStream
public:
QPdfPage();
- QVector<uint> images;
- QVector<uint> graphicStates;
- QVector<uint> patterns;
- QVector<uint> fonts;
- QVector<uint> annotations;
+ QList<uint> images;
+ QList<uint> graphicStates;
+ QList<uint> patterns;
+ QList<uint> fonts;
+ QList<uint> annotations;
- void streamImage(int w, int h, int object);
+ void streamImage(int w, int h, uint object);
QSize pageSize;
private:
@@ -177,7 +138,7 @@ public:
};
QPdfEngine();
- QPdfEngine(QPdfEnginePrivate &d);
+ explicit QPdfEngine(QPdfEnginePrivate &d);
~QPdfEngine() {}
void setOutputFilename(const QString &filename);
@@ -187,6 +148,23 @@ public:
void setPdfVersion(PdfVersion version);
+ void setDocumentXmpMetadata(const QByteArray &xmpMetadata);
+ QByteArray documentXmpMetadata() const;
+
+ void addFileAttachment(const QString &fileName, const QByteArray &data, const QString &mimeType);
+
+ // keep in sync with QPdfWriter
+ enum class ColorModel
+ {
+ RGB,
+ Grayscale,
+ CMYK,
+ Auto,
+ };
+
+ ColorModel colorModel() const;
+ void setColorModel(ColorModel model);
+
// reimplementations QPaintEngine
bool begin(QPaintDevice *pdev) override;
bool end() override;
@@ -261,14 +239,16 @@ public:
QPointF brushOrigin;
QBrush brush;
QPen pen;
- QVector<QPainterPath> clips;
+ QList<QPainterPath> clips;
bool clipEnabled;
bool allClipped;
bool hasPen;
bool hasBrush;
bool simplePen;
+ bool needsTransform;
qreal opacity;
QPdfEngine::PdfVersion pdfVersion;
+ QPdfEngine::ColorModel colorModel;
QHash<QFontEngine::FaceId, QFontSubset *> fonts;
@@ -284,7 +264,6 @@ public:
QString creator;
bool embedFonts;
int resolution;
- bool grayscale;
// Page layout: size, orientation and margins
QPageLayout m_pageLayout;
@@ -294,26 +273,51 @@ private:
int generateGradientShader(const QGradient *gradient, const QTransform &matrix, bool alpha = false);
int generateLinearGradientShader(const QLinearGradient *lg, const QTransform &matrix, bool alpha);
int generateRadialGradientShader(const QRadialGradient *gradient, const QTransform &matrix, bool alpha);
- int createShadingFunction(const QGradient *gradient, int from, int to, bool reflect, bool alpha);
+ struct ShadingFunctionResult
+ {
+ int function;
+ QPdfEngine::ColorModel colorModel;
+ void writeColorSpace(QPdf::ByteStream *stream) const;
+ };
+ ShadingFunctionResult createShadingFunction(const QGradient *gradient, int from, int to, bool reflect, bool alpha);
+
+ enum class ColorDomain {
+ Stroking,
+ NonStroking,
+ NonStrokingPattern,
+ };
+ QPdfEngine::ColorModel colorModelForColor(const QColor &color) const;
+ void writeColor(ColorDomain domain, const QColor &color);
void writeInfo();
- int writeXmpMetaData();
+ int writeXmpDcumentMetaData();
int writeOutputIntent();
void writePageRoot();
+ void writeDestsRoot();
+ void writeAttachmentRoot();
+ void writeNamesRoot();
void writeFonts();
void embedFont(QFontSubset *font);
qreal calcUserUnit() const;
- QVector<int> xrefPositions;
+ QList<int> xrefPositions;
QDataStream* stream;
int streampos;
- int writeImage(const QByteArray &data, int width, int height, int depth,
+ enum class WriteImageOption
+ {
+ Monochrome,
+ Grayscale,
+ RGB,
+ CMYK,
+ };
+
+ int writeImage(const QByteArray &data, int width, int height, WriteImageOption option,
int maskObject, int softMaskObject, bool dct = false, bool isMono = false);
void writePage();
int addXrefEntry(int object, bool printostr = true);
- void printString(const QString &string);
+ void printString(QStringView string);
void xprintf(const char* fmt, ...);
inline void write(const QByteArray &data) {
stream->writeRawData(data.constData(), data.size());
@@ -321,14 +325,37 @@ private:
}
int writeCompressed(const char *src, int len);
- inline int writeCompressed(const QByteArray &data) { return writeCompressed(data.constData(), data.length()); }
+ inline int writeCompressed(const QByteArray &data) { return writeCompressed(data.constData(), data.size()); }
int writeCompressed(QIODevice *dev);
+ struct AttachmentInfo
+ {
+ AttachmentInfo (const QString &fileName, const QByteArray &data, const QString &mimeType)
+ : fileName(fileName), data(data), mimeType(mimeType) {}
+ QString fileName;
+ QByteArray data;
+ QString mimeType;
+ };
+
+ struct DestInfo
+ {
+ QString anchor;
+ uint pageObj;
+ QPointF coords;
+ };
+
// various PDF objects
- int pageRoot, catalog, info, graphicsState, patternColorSpace;
- QVector<uint> pages;
+ int pageRoot, namesRoot, destsRoot, attachmentsRoot, catalog, info;
+ int graphicsState;
+ int patternColorSpaceRGB;
+ int patternColorSpaceGrayscale;
+ int patternColorSpaceCMYK;
+ QList<uint> pages;
QHash<qint64, uint> imageCache;
QHash<QPair<uint, uint>, uint > alphaCache;
+ QList<DestInfo> destCache;
+ QList<AttachmentInfo> fileCache;
+ QByteArray xmpDocumentMetadata;
};
QT_END_NAMESPACE
diff --git a/src/gui/painting/qpdfwriter.cpp b/src/gui/painting/qpdfwriter.cpp
index 35814d146c..bce65927ab 100644
--- a/src/gui/painting/qpdfwriter.cpp
+++ b/src/gui/painting/qpdfwriter.cpp
@@ -1,41 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the QtGui module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#include <qpdfwriter.h>
@@ -266,143 +230,49 @@ int QPdfWriter::resolution() const
return d->engine->resolution();
}
-// Defined in QPagedPaintDevice but non-virtual, add QPdfWriter specific doc here
-#ifdef Q_QDOC
/*!
- \fn bool QPdfWriter::setPageLayout(const QPageLayout &newPageLayout)
- \since 5.3
-
- Sets the PDF page layout to \a newPageLayout.
-
- You should call this before calling QPainter::begin(), or immediately
- before calling newPage() to apply the new page layout to a new page.
- You should not call any painting methods between a call to setPageLayout()
- and newPage() as the wrong paint metrics may be used.
-
- Returns true if the page layout was successfully set to \a newPageLayout.
-
- \sa pageLayout()
-*/
-
-/*!
- \fn bool QPdfWriter::setPageSize(const QPageSize &pageSize)
- \since 5.3
-
- Sets the PDF page size to \a pageSize.
-
- To get the current QPageSize use pageLayout().pageSize().
-
- You should call this before calling QPainter::begin(), or immediately
- before calling newPage() to apply the new page size to a new page.
- You should not call any painting methods between a call to setPageSize()
- and newPage() as the wrong paint metrics may be used.
-
- Returns true if the page size was successfully set to \a pageSize.
-
- \sa pageLayout()
-*/
-
-/*!
- \fn bool QPdfWriter::setPageOrientation(QPageLayout::Orientation orientation)
- \since 5.3
-
- Sets the PDF page \a orientation.
-
- The page orientation is used to define the orientation of the
- page size when obtaining the page rect.
-
- You should call this before calling QPainter::begin(), or immediately
- before calling newPage() to apply the new orientation to a new page.
- You should not call any painting methods between a call to setPageOrientation()
- and newPage() as the wrong paint metrics may be used.
-
- To get the current QPageLayout::Orientation use pageLayout().pageOrientation().
-
- Returns true if the page orientation was successfully set to \a orientation.
-
- \sa pageLayout()
-*/
-
-/*!
- \fn bool QPdfWriter::setPageMargins(const QMarginsF &margins)
- \since 5.3
-
- Set the PDF page \a margins in the current page layout units.
-
- You should call this before calling QPainter::begin(), or immediately
- before calling newPage() to apply the new margins to a new page.
- You should not call any painting methods between a call to setPageMargins()
- and newPage() as the wrong paint metrics may be used.
-
- To get the current page margins use pageLayout().pageMargins().
-
- Returns true if the page margins were successfully set to \a margins.
-
- \sa pageLayout()
-*/
-
-/*!
- \fn bool QPdfWriter::setPageMargins(const QMarginsF &margins, QPageLayout::Unit units)
- \since 5.3
-
- Set the PDF page \a margins defined in the given \a units.
-
- You should call this before calling QPainter::begin(), or immediately
- before calling newPage() to apply the new margins to a new page.
- You should not call any painting methods between a call to setPageMargins()
- and newPage() as the wrong paint metrics may be used.
-
- To get the current page margins use pageLayout().pageMargins().
+ \since 5.15
- Returns true if the page margins were successfully set to \a margins.
+ Sets the document metadata. This metadata is not influenced by the setTitle / setCreator methods,
+ so is up to the user to keep it consistent.
+ \a xmpMetadata contains XML formatted metadata to embed into the PDF file.
- \sa pageLayout()
+ \sa documentXmpMetadata()
*/
-/*!
- \fn QPageLayout QPdfWriter::pageLayout() const
- \since 5.3
-
- Returns the current page layout. Use this method to access the current
- QPageSize, QPageLayout::Orientation, QMarginsF, fullRect() and paintRect().
-
- Note that you cannot use the setters on the returned object, you must either
- call the individual QPdfWriter methods or use setPageLayout().
-
- \sa setPageLayout(), setPageSize(), setPageOrientation(), setPageMargins()
-*/
-#endif
+void QPdfWriter::setDocumentXmpMetadata(const QByteArray &xmpMetadata)
+{
+ Q_D(const QPdfWriter);
+ d->engine->setDocumentXmpMetadata(xmpMetadata);
+}
-#if QT_DEPRECATED_SINCE(5, 14)
-QT_WARNING_PUSH
-QT_WARNING_DISABLE_DEPRECATED
/*!
- \reimp
+ \since 5.15
- \obsolete Use setPageSize(QPageSize(id)) instead
+ Gets the document metadata, as it was provided with a call to setDocumentXmpMetadata. It will not
+ return the default metadata.
- \sa setPageSize()
+ \sa setDocumentXmpMetadata()
*/
-void QPdfWriter::setPageSize(PageSize size)
+QByteArray QPdfWriter::documentXmpMetadata() const
{
- setPageSize(QPageSize(QPageSize::PageSizeId(size)));
+ Q_D(const QPdfWriter);
+ return d->engine->documentXmpMetadata();
}
/*!
- \reimp
-
- \obsolete Use setPageSize(QPageSize(size, QPageSize::Millimeter)) instead
+ \since 5.15
- \sa setPageSize()
+ Adds \a fileName attachment to the PDF with (optional) \a mimeType.
+ \a data contains the raw file data to embed into the PDF file.
*/
-void QPdfWriter::setPageSizeMM(const QSizeF &size)
+void QPdfWriter::addFileAttachment(const QString &fileName, const QByteArray &data, const QString &mimeType)
{
- setPageSize(QPageSize(size, QPageSize::Millimeter));
+ Q_D(QPdfWriter);
+ d->engine->addFileAttachment(fileName, data, mimeType);
}
-QT_WARNING_POP
-#endif
/*!
\internal
@@ -425,24 +295,55 @@ bool QPdfWriter::newPage()
return d->engine->newPage();
}
+/*!
+ \enum QPdfWriter::ColorModel
+ \since 6.8
+
+ This enumeration describes the way in which the PDF engine interprets
+ stroking and filling colors, set as a QPainter's pen or brush (via
+ QPen and QBrush).
+
+ \value RGB All colors are converted to RGB and saved as such in the
+ PDF.
+
+ \value Grayscale All colors are converted to grayscale. For backwards
+ compatibility, they are emitted in the PDF output as RGB colors, with
+ identical quantities of red, green and blue.
+
+ \value CMYK All colors are converted to CMYK and saved as such.
+
+ \value Auto RGB colors are emitted as RGB; CMYK colors are emitted as
+ CMYK. Colors of any other color spec are converted to RGB.
+ This is the default since Qt 6.8.
+
+ \sa QColor, QGradient
+*/
-#if QT_DEPRECATED_SINCE(5, 14)
-QT_WARNING_PUSH
-QT_WARNING_DISABLE_DEPRECATED
/*!
- \reimp
+ \since 6.8
- \obsolete Use setPageMargins(QMarginsF(l, t, r, b), QPageLayout::Millimeter) instead
+ Returns the color model used by this PDF writer.
+ The default is QPdfWriter::ColorModel::Auto.
+*/
+QPdfWriter::ColorModel QPdfWriter::colorModel() const
+{
+ Q_D(const QPdfWriter);
+ return static_cast<ColorModel>(d->engine->d_func()->colorModel);
+}
- \sa setPageMargins()
- */
-void QPdfWriter::setMargins(const Margins &m)
+/*!
+ \since 6.8
+
+ Sets the color model used by this PDF writer to \a model.
+*/
+void QPdfWriter::setColorModel(ColorModel model)
{
- setPageMargins(QMarginsF(m.left, m.top, m.right, m.bottom), QPageLayout::Millimeter);
+ Q_D(QPdfWriter);
+ d->engine->d_func()->colorModel = static_cast<QPdfEngine::ColorModel>(model);
}
-QT_WARNING_POP
-#endif
QT_END_NAMESPACE
+#include "moc_qpdfwriter.cpp"
+
#endif // QT_NO_PDF
diff --git a/src/gui/painting/qpdfwriter.h b/src/gui/painting/qpdfwriter.h
index 668081e008..1a4b607b66 100644
--- a/src/gui/painting/qpdfwriter.h
+++ b/src/gui/painting/qpdfwriter.h
@@ -1,41 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the QtGui module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#ifndef QPDFWRITER_H
#define QPDFWRITER_H
@@ -75,25 +39,22 @@ public:
void setResolution(int resolution);
int resolution() const;
-#ifdef Q_QDOC
- bool setPageLayout(const QPageLayout &pageLayout);
- bool setPageSize(const QPageSize &pageSize);
- bool setPageOrientation(QPageLayout::Orientation orientation);
- bool setPageMargins(const QMarginsF &margins);
- bool setPageMargins(const QMarginsF &margins, QPageLayout::Unit units);
- QPageLayout pageLayout() const;
-#else
- using QPagedPaintDevice::setPageSize;
-#endif
+ void setDocumentXmpMetadata(const QByteArray &xmpMetadata);
+ QByteArray documentXmpMetadata() const;
-#if QT_DEPRECATED_SINCE(5, 14)
- QT_DEPRECATED_X("Use setPageSize(QPageSize(id)) instead")
- void setPageSize(PageSize size) override;
- QT_DEPRECATED_X("Use setPageSize(QPageSize(size, QPageSize::Millimeter)) instead")
- void setPageSizeMM(const QSizeF &size) override;
- QT_DEPRECATED_X("Use setPageMargins(QMarginsF(l, t, r, b), QPageLayout::Millimeter) instead")
- void setMargins(const Margins &m) override;
-#endif
+ void addFileAttachment(const QString &fileName, const QByteArray &data, const QString &mimeType = QString());
+
+ enum class ColorModel
+ {
+ RGB,
+ Grayscale,
+ CMYK,
+ Auto,
+ };
+ Q_ENUM(ColorModel)
+
+ ColorModel colorModel() const;
+ void setColorModel(ColorModel model);
protected:
QPaintEngine *paintEngine() const override;
diff --git a/src/gui/painting/qpen.cpp b/src/gui/painting/qpen.cpp
index 1a940443d1..d37beda6b6 100644
--- a/src/gui/painting/qpen.cpp
+++ b/src/gui/painting/qpen.cpp
@@ -1,41 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the QtGui module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#include "qpen.h"
#include "qpen_p.h"
#include "qdatastream.h"
@@ -46,8 +10,6 @@
QT_BEGIN_NAMESPACE
-typedef QPenPrivate QPenData;
-
/*!
\class QPen
\inmodule QtGui
@@ -129,7 +91,7 @@ typedef QPenPrivate QPenData;
Since Qt 4.1 it is also possible to specify a custom dash pattern
using the setDashPattern() function which implicitly converts the
style of the pen to Qt::CustomDashLine. The pattern argument, a
- QVector, must be specified as an even number of \l qreal entries
+ QList, must be specified as an even number of \l qreal entries
where the entries 1, 3, 5... are the dashes and 2, 4, 6... are the
spaces. For example, the custom pattern shown above is created
using the following code:
@@ -227,10 +189,10 @@ typedef QPenPrivate QPenData;
/*!
\internal
*/
-inline QPenPrivate::QPenPrivate(const QBrush &_brush, qreal _width, Qt::PenStyle penStyle,
- Qt::PenCapStyle _capStyle, Qt::PenJoinStyle _joinStyle, bool _defaultWidth)
- : ref(1), dashOffset(0), miterLimit(2),
- cosmetic(false), defaultWidth(_defaultWidth)
+QPenPrivate::QPenPrivate(const QBrush &_brush, qreal _width, Qt::PenStyle penStyle,
+ Qt::PenCapStyle _capStyle, Qt::PenJoinStyle _joinStyle)
+ : dashOffset(0), miterLimit(2),
+ cosmetic(false)
{
width = _width;
brush = _brush;
@@ -245,17 +207,13 @@ static const Qt::PenJoinStyle qpen_default_join = Qt::BevelJoin;
class QPenDataHolder
{
public:
- QPenData *pen;
+ QPen::DataPtr pen;
QPenDataHolder(const QBrush &brush, qreal width, Qt::PenStyle penStyle,
Qt::PenCapStyle penCapStyle, Qt::PenJoinStyle _joinStyle)
- : pen(new QPenData(brush, width, penStyle, penCapStyle, _joinStyle))
+ : pen(new QPenPrivate(brush, width, penStyle, penCapStyle, _joinStyle))
{ }
- ~QPenDataHolder()
- {
- if (!pen->ref.deref())
- delete pen;
- pen = nullptr;
- }
+ ~QPenDataHolder() = default;
+ Q_DISABLE_COPY_MOVE(QPenDataHolder)
};
Q_GLOBAL_STATIC_WITH_ARGS(QPenDataHolder, defaultPenInstance,
@@ -270,7 +228,6 @@ Q_GLOBAL_STATIC_WITH_ARGS(QPenDataHolder, nullPenInstance,
QPen::QPen()
{
d = defaultPenInstance()->pen;
- d->ref.ref();
}
/*!
@@ -283,9 +240,8 @@ QPen::QPen(Qt::PenStyle style)
{
if (style == Qt::NoPen) {
d = nullPenInstance()->pen;
- d->ref.ref();
} else {
- d = new QPenData(Qt::black, 1, style, qpen_default_cap, qpen_default_join);
+ d = new QPenPrivate(Qt::black, 1, style, qpen_default_cap, qpen_default_join);
}
}
@@ -298,7 +254,7 @@ QPen::QPen(Qt::PenStyle style)
QPen::QPen(const QColor &color)
{
- d = new QPenData(color, 1, Qt::SolidLine, qpen_default_cap, qpen_default_join);
+ d = new QPenPrivate(color, 1, Qt::SolidLine, qpen_default_cap, qpen_default_join);
}
@@ -313,7 +269,7 @@ QPen::QPen(const QColor &color)
QPen::QPen(const QBrush &brush, qreal width, Qt::PenStyle s, Qt::PenCapStyle c, Qt::PenJoinStyle j)
{
- d = new QPenData(brush, width, s, c, j, false);
+ d = new QPenPrivate(brush, width, s, c, j);
}
/*!
@@ -323,10 +279,8 @@ QPen::QPen(const QBrush &brush, qreal width, Qt::PenStyle s, Qt::PenCapStyle c,
*/
QPen::QPen(const QPen &p) noexcept
+ : d(p.d)
{
- d = p.d;
- if (d)
- d->ref.ref();
}
@@ -345,11 +299,9 @@ QPen::QPen(const QPen &p) noexcept
Destroys the pen.
*/
-QPen::~QPen()
-{
- if (d && !d->ref.deref())
- delete d;
-}
+QPen::~QPen() = default;
+
+QT_DEFINE_QESDP_SPECIALIZATION_DTOR(QPenPrivate)
/*!
\fn void QPen::detach()
@@ -363,14 +315,7 @@ QPen::~QPen()
void QPen::detach()
{
- if (d->ref.loadRelaxed() == 1)
- return;
-
- QPenData *x = new QPenData(*static_cast<QPenData *>(d));
- if (!d->ref.deref())
- delete d;
- x->ref.storeRelaxed(1);
- d = x;
+ d.detach();
}
@@ -408,7 +353,7 @@ QPen &QPen::operator=(const QPen &p) noexcept
*/
QPen::operator QVariant() const
{
- return QVariant(QVariant::Pen, this);
+ return QVariant::fromValue(*this);
}
/*!
@@ -443,9 +388,8 @@ void QPen::setStyle(Qt::PenStyle s)
return;
detach();
d->style = s;
- QPenData *dd = static_cast<QPenData *>(d);
- dd->dashPattern.clear();
- dd->dashOffset = 0;
+ d->dashPattern.clear();
+ d->dashOffset = 0;
}
/*!
@@ -453,38 +397,37 @@ void QPen::setStyle(Qt::PenStyle s)
\sa style(), isSolid()
*/
-QVector<qreal> QPen::dashPattern() const
+QList<qreal> QPen::dashPattern() const
{
- QPenData *dd = static_cast<QPenData *>(d);
if (d->style == Qt::SolidLine || d->style == Qt::NoPen) {
- return QVector<qreal>();
- } else if (dd->dashPattern.isEmpty()) {
+ return QList<qreal>();
+ } else if (d->dashPattern.isEmpty()) {
const qreal space = 2;
const qreal dot = 1;
const qreal dash = 4;
switch (d->style) {
case Qt::DashLine:
- dd->dashPattern.reserve(2);
- dd->dashPattern << dash << space;
+ d->dashPattern.reserve(2);
+ d->dashPattern << dash << space;
break;
case Qt::DotLine:
- dd->dashPattern.reserve(2);
- dd->dashPattern << dot << space;
+ d->dashPattern.reserve(2);
+ d->dashPattern << dot << space;
break;
case Qt::DashDotLine:
- dd->dashPattern.reserve(4);
- dd->dashPattern << dash << space << dot << space;
+ d->dashPattern.reserve(4);
+ d->dashPattern << dash << space << dot << space;
break;
case Qt::DashDotDotLine:
- dd->dashPattern.reserve(6);
- dd->dashPattern << dash << space << dot << space << dot << space;
+ d->dashPattern.reserve(6);
+ d->dashPattern << dash << space << dot << space << dot << space;
break;
default:
break;
}
}
- return dd->dashPattern;
+ return d->dashPattern;
}
/*!
@@ -517,19 +460,18 @@ QVector<qreal> QPen::dashPattern() const
\sa setStyle(), dashPattern(), setCapStyle(), setCosmetic()
*/
-void QPen::setDashPattern(const QVector<qreal> &pattern)
+void QPen::setDashPattern(const QList<qreal> &pattern)
{
if (pattern.isEmpty())
return;
detach();
- QPenData *dd = static_cast<QPenData *>(d);
- dd->dashPattern = pattern;
+ d->dashPattern = pattern;
d->style = Qt::CustomDashLine;
- if ((dd->dashPattern.size() % 2) == 1) {
+ if ((d->dashPattern.size() % 2) == 1) {
qWarning("QPen::setDashPattern: Pattern not of even length");
- dd->dashPattern << 1;
+ d->dashPattern << 1;
}
}
@@ -541,8 +483,7 @@ void QPen::setDashPattern(const QVector<qreal> &pattern)
*/
qreal QPen::dashOffset() const
{
- QPenData *dd = static_cast<QPenData *>(d);
- return dd->dashOffset;
+ return d->dashOffset;
}
/*!
Sets the dash offset (the starting point on the dash pattern) for this pen
@@ -564,13 +505,12 @@ qreal QPen::dashOffset() const
*/
void QPen::setDashOffset(qreal offset)
{
- if (qFuzzyCompare(offset, static_cast<QPenData *>(d)->dashOffset))
+ if (qFuzzyCompare(offset, d->dashOffset))
return;
detach();
- QPenData *dd = static_cast<QPenData *>(d);
- dd->dashOffset = offset;
+ d->dashOffset = offset;
if (d->style != Qt::CustomDashLine) {
- dd->dashPattern = dashPattern();
+ d->dashPattern = dashPattern();
d->style = Qt::CustomDashLine;
}
}
@@ -583,8 +523,7 @@ void QPen::setDashOffset(qreal offset)
*/
qreal QPen::miterLimit() const
{
- const QPenData *dd = static_cast<QPenData *>(d);
- return dd->miterLimit;
+ return d->miterLimit;
}
/*!
@@ -606,8 +545,7 @@ qreal QPen::miterLimit() const
void QPen::setMiterLimit(qreal limit)
{
detach();
- QPenData *dd = static_cast<QPenData *>(d);
- dd->miterLimit = limit;
+ d->miterLimit = limit;
}
@@ -653,8 +591,10 @@ qreal QPen::widthF() const
*/
void QPen::setWidth(int width)
{
- if (width < 0)
- qWarning("QPen::setWidth: Setting a pen width with a negative value is not defined");
+ if (width < 0 || width >= (1 << 15)) {
+ qWarning("QPen::setWidth: Setting a pen width that is out of range");
+ return;
+ }
if ((qreal)width == d->width)
return;
detach();
@@ -677,15 +617,14 @@ void QPen::setWidth(int width)
void QPen::setWidthF(qreal width)
{
- if (width < 0.f) {
- qWarning("QPen::setWidthF: Setting a pen width with a negative value is not defined");
+ if (width < 0.f || width >= (1 << 15)) {
+ qWarning("QPen::setWidthF: Setting a pen width that is out of range");
return;
}
if (qAbs(d->width - width) < 0.00000001f)
return;
detach();
d->width = width;
- d->defaultWidth = false;
}
@@ -817,8 +756,7 @@ bool QPen::isSolid() const
bool QPen::isCosmetic() const
{
- QPenData *dd = static_cast<QPenData *>(d);
- return (dd->cosmetic == true) || d->width == 0;
+ return (d->cosmetic == true) || d->width == 0;
}
@@ -832,8 +770,7 @@ bool QPen::isCosmetic() const
void QPen::setCosmetic(bool cosmetic)
{
detach();
- QPenData *dd = static_cast<QPenData *>(d);
- dd->cosmetic = cosmetic;
+ d->cosmetic = cosmetic;
}
@@ -860,20 +797,17 @@ void QPen::setCosmetic(bool cosmetic)
bool QPen::operator==(const QPen &p) const
{
- QPenData *dd = static_cast<QPenData *>(d);
- QPenData *pdd = static_cast<QPenData *>(p.d);
return (p.d == d)
|| (p.d->style == d->style
&& p.d->capStyle == d->capStyle
&& p.d->joinStyle == d->joinStyle
&& p.d->width == d->width
- && pdd->miterLimit == dd->miterLimit
+ && p.d->miterLimit == d->miterLimit
&& (d->style != Qt::CustomDashLine
- || (qFuzzyCompare(pdd->dashOffset, dd->dashOffset) &&
- pdd->dashPattern == dd->dashPattern))
+ || (qFuzzyCompare(p.d->dashOffset, d->dashOffset) &&
+ p.d->dashPattern == d->dashPattern))
&& p.d->brush == d->brush
- && pdd->cosmetic == dd->cosmetic
- && pdd->defaultWidth == dd->defaultWidth);
+ && p.d->cosmetic == d->cosmetic);
}
@@ -905,14 +839,13 @@ bool QPen::isDetached()
QDataStream &operator<<(QDataStream &s, const QPen &p)
{
- QPenData *dd = static_cast<QPenData *>(p.d);
if (s.version() < 3) {
s << (quint8)p.style();
} else if (s.version() < QDataStream::Qt_4_3) {
- s << (quint8)(p.style() | p.capStyle() | p.joinStyle());
+ s << (quint8)(uint(p.style()) | uint(p.capStyle()) | uint(p.joinStyle()));
} else {
- s << (quint16)(p.style() | p.capStyle() | p.joinStyle());
- s << (bool)(dd->cosmetic);
+ s << (quint16)(uint(p.style()) | uint(p.capStyle()) | uint(p.joinStyle()));
+ s << (bool)(p.d->cosmetic);
}
if (s.version() < 7) {
@@ -928,7 +861,7 @@ QDataStream &operator<<(QDataStream &s, const QPen &p)
// ensure that we write doubles here instead of streaming the pattern
// directly; otherwise, platforms that redefine qreal might generate
// data that cannot be read on other platforms.
- QVector<qreal> pattern = p.dashPattern();
+ QList<qreal> pattern = p.dashPattern();
s << quint32(pattern.size());
for (int i = 0; i < pattern.size(); ++i)
s << double(pattern.at(i));
@@ -936,7 +869,7 @@ QDataStream &operator<<(QDataStream &s, const QPen &p)
if (s.version() >= 9)
s << double(p.dashOffset());
if (s.version() >= QDataStream::Qt_5_0)
- s << bool(dd->defaultWidth);
+ s << bool(qFuzzyIsNull(p.widthF()));
}
return s;
}
@@ -959,10 +892,10 @@ QDataStream &operator>>(QDataStream &s, QPen &p)
QColor color;
QBrush brush;
double miterLimit = 2;
- QVector<qreal> dashPattern;
+ QList<qreal> dashPattern;
double dashOffset = 0;
bool cosmetic = false;
- bool defaultWidth = false;
+ bool defaultWidth;
if (s.version() < QDataStream::Qt_4_3) {
quint8 style8;
s >> style8;
@@ -998,23 +931,18 @@ QDataStream &operator>>(QDataStream &s, QPen &p)
if (s.version() >= QDataStream::Qt_5_0) {
s >> defaultWidth;
- } else {
- // best we can do for legacy pens
- defaultWidth = qFuzzyIsNull(width);
}
p.detach();
- QPenData *dd = static_cast<QPenData *>(p.d);
- dd->width = width;
- dd->brush = brush;
- dd->style = Qt::PenStyle(style & Qt::MPenStyle);
- dd->capStyle = Qt::PenCapStyle(style & Qt::MPenCapStyle);
- dd->joinStyle = Qt::PenJoinStyle(style & Qt::MPenJoinStyle);
- dd->dashPattern = dashPattern;
- dd->miterLimit = miterLimit;
- dd->dashOffset = dashOffset;
- dd->cosmetic = cosmetic;
- dd->defaultWidth = defaultWidth;
+ p.d->width = width;
+ p.d->brush = brush;
+ p.d->style = Qt::PenStyle(style & Qt::MPenStyle);
+ p.d->capStyle = Qt::PenCapStyle(style & Qt::MPenCapStyle);
+ p.d->joinStyle = Qt::PenJoinStyle(style & Qt::MPenJoinStyle);
+ p.d->dashPattern = dashPattern;
+ p.d->miterLimit = miterLimit;
+ p.d->dashOffset = dashOffset;
+ p.d->cosmetic = cosmetic;
return s;
}
diff --git a/src/gui/painting/qpen.h b/src/gui/painting/qpen.h
index 10b11d1d85..3367b96c35 100644
--- a/src/gui/painting/qpen.h
+++ b/src/gui/painting/qpen.h
@@ -1,45 +1,10 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the QtGui module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#ifndef QPEN_H
#define QPEN_H
+#include <QtCore/qshareddata.h>
#include <QtGui/qtguiglobal.h>
#include <QtGui/qcolor.h>
#include <QtGui/qbrush.h>
@@ -57,6 +22,8 @@ Q_GUI_EXPORT QDataStream &operator<<(QDataStream &, const QPen &);
Q_GUI_EXPORT QDataStream &operator>>(QDataStream &, QPen &);
#endif
+QT_DECLARE_QESDP_SPECIALIZATION_DTOR_WITH_EXPORT(QPenPrivate, Q_GUI_EXPORT)
+
class Q_GUI_EXPORT QPen
{
public:
@@ -70,17 +37,15 @@ public:
~QPen();
QPen &operator=(const QPen &pen) noexcept;
- QPen(QPen &&other) noexcept
- : d(other.d) { other.d = nullptr; }
- QPen &operator=(QPen &&other) noexcept
- { qSwap(d, other.d); return *this; }
- void swap(QPen &other) noexcept { qSwap(d, other.d); }
+ QPen(QPen &&other) noexcept = default;
+ QT_MOVE_ASSIGNMENT_OPERATOR_IMPL_VIA_PURE_SWAP(QPen)
+ void swap(QPen &other) noexcept { d.swap(other.d); }
Qt::PenStyle style() const;
void setStyle(Qt::PenStyle);
- QVector<qreal> dashPattern() const;
- void setDashPattern(const QVector<qreal> &pattern);
+ QList<qreal> dashPattern() const;
+ void setDashPattern(const QList<qreal> &pattern);
qreal dashOffset() const;
void setDashOffset(qreal doffset);
@@ -116,15 +81,19 @@ public:
operator QVariant() const;
bool isDetached();
+
private:
friend Q_GUI_EXPORT QDataStream &operator>>(QDataStream &, QPen &);
friend Q_GUI_EXPORT QDataStream &operator<<(QDataStream &, const QPen &);
+public:
+ using DataPtr = QExplicitlySharedDataPointer<QPenPrivate>;
+
+private:
void detach();
- class QPenPrivate *d;
+ DataPtr d;
public:
- typedef QPenPrivate * DataPtr;
inline DataPtr &data_ptr() { return d; }
};
diff --git a/src/gui/painting/qpen_p.h b/src/gui/painting/qpen_p.h
index 2098be5a53..a939c5e4f6 100644
--- a/src/gui/painting/qpen_p.h
+++ b/src/gui/painting/qpen_p.h
@@ -1,41 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the QtGui module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2020 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#ifndef QPEN_P_H
#define QPEN_P_H
@@ -51,25 +15,25 @@
// We mean it.
//
-#include <QtCore/qglobal.h>
+#include <QtCore/private/qglobal_p.h>
+#include <QtCore/qshareddata.h>
QT_BEGIN_NAMESPACE
-class QPenPrivate {
+class QPenPrivate : public QSharedData
+{
public:
QPenPrivate(const QBrush &brush, qreal width, Qt::PenStyle, Qt::PenCapStyle,
- Qt::PenJoinStyle _joinStyle, bool defaultWidth = true);
- QAtomicInt ref;
+ Qt::PenJoinStyle _joinStyle);
qreal width;
QBrush brush;
Qt::PenStyle style;
Qt::PenCapStyle capStyle;
Qt::PenJoinStyle joinStyle;
- mutable QVector<qreal> dashPattern;
+ mutable QList<qreal> dashPattern;
qreal dashOffset;
qreal miterLimit;
uint cosmetic : 1;
- uint defaultWidth : 1; // default-constructed width? used for cosmetic pen compatibility
};
QT_END_NAMESPACE
diff --git a/src/gui/painting/qpixellayout.cpp b/src/gui/painting/qpixellayout.cpp
new file mode 100644
index 0000000000..4f2f0ae13a
--- /dev/null
+++ b/src/gui/painting/qpixellayout.cpp
@@ -0,0 +1,2436 @@
+// Copyright (C) 2021 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
+
+#include <qglobal.h>
+
+#include "qdrawhelper_p.h"
+#include "qpixellayout_p.h"
+#include "qrgba64_p.h"
+#include <QtCore/private/qsimd_p.h>
+#include <QtGui/private/qcmyk_p.h>
+
+QT_BEGIN_NAMESPACE
+
+template<QImage::Format> constexpr uint redWidth();
+template<QImage::Format> constexpr uint redShift();
+template<QImage::Format> constexpr uint greenWidth();
+template<QImage::Format> constexpr uint greenShift();
+template<QImage::Format> constexpr uint blueWidth();
+template<QImage::Format> constexpr uint blueShift();
+template<QImage::Format> constexpr uint alphaWidth();
+template<QImage::Format> constexpr uint alphaShift();
+
+template<> constexpr uint redWidth<QImage::Format_RGB32>() { return 8; }
+template<> constexpr uint redWidth<QImage::Format_ARGB32>() { return 8; }
+template<> constexpr uint redWidth<QImage::Format_ARGB32_Premultiplied>() { return 8; }
+template<> constexpr uint redWidth<QImage::Format_RGB16>() { return 5; }
+template<> constexpr uint redWidth<QImage::Format_RGB444>() { return 4; }
+template<> constexpr uint redWidth<QImage::Format_RGB555>() { return 5; }
+template<> constexpr uint redWidth<QImage::Format_RGB666>() { return 6; }
+template<> constexpr uint redWidth<QImage::Format_RGB888>() { return 8; }
+template<> constexpr uint redWidth<QImage::Format_BGR888>() { return 8; }
+template<> constexpr uint redWidth<QImage::Format_ARGB4444_Premultiplied>() { return 4; }
+template<> constexpr uint redWidth<QImage::Format_ARGB8555_Premultiplied>() { return 5; }
+template<> constexpr uint redWidth<QImage::Format_ARGB8565_Premultiplied>() { return 5; }
+template<> constexpr uint redWidth<QImage::Format_ARGB6666_Premultiplied>() { return 6; }
+template<> constexpr uint redWidth<QImage::Format_RGBX8888>() { return 8; }
+template<> constexpr uint redWidth<QImage::Format_RGBA8888>() { return 8; }
+template<> constexpr uint redWidth<QImage::Format_RGBA8888_Premultiplied>() { return 8; }
+
+template<> constexpr uint redShift<QImage::Format_RGB32>() { return 16; }
+template<> constexpr uint redShift<QImage::Format_ARGB32>() { return 16; }
+template<> constexpr uint redShift<QImage::Format_ARGB32_Premultiplied>() { return 16; }
+template<> constexpr uint redShift<QImage::Format_RGB16>() { return 11; }
+template<> constexpr uint redShift<QImage::Format_RGB444>() { return 8; }
+template<> constexpr uint redShift<QImage::Format_RGB555>() { return 10; }
+template<> constexpr uint redShift<QImage::Format_RGB666>() { return 12; }
+template<> constexpr uint redShift<QImage::Format_RGB888>() { return 16; }
+template<> constexpr uint redShift<QImage::Format_BGR888>() { return 0; }
+template<> constexpr uint redShift<QImage::Format_ARGB4444_Premultiplied>() { return 8; }
+template<> constexpr uint redShift<QImage::Format_ARGB8555_Premultiplied>() { return 18; }
+template<> constexpr uint redShift<QImage::Format_ARGB8565_Premultiplied>() { return 19; }
+template<> constexpr uint redShift<QImage::Format_ARGB6666_Premultiplied>() { return 12; }
+#if Q_BYTE_ORDER == Q_BIG_ENDIAN
+template<> constexpr uint redShift<QImage::Format_RGBX8888>() { return 24; }
+template<> constexpr uint redShift<QImage::Format_RGBA8888>() { return 24; }
+template<> constexpr uint redShift<QImage::Format_RGBA8888_Premultiplied>() { return 24; }
+#else
+template<> constexpr uint redShift<QImage::Format_RGBX8888>() { return 0; }
+template<> constexpr uint redShift<QImage::Format_RGBA8888>() { return 0; }
+template<> constexpr uint redShift<QImage::Format_RGBA8888_Premultiplied>() { return 0; }
+#endif
+template<> constexpr uint greenWidth<QImage::Format_RGB32>() { return 8; }
+template<> constexpr uint greenWidth<QImage::Format_ARGB32>() { return 8; }
+template<> constexpr uint greenWidth<QImage::Format_ARGB32_Premultiplied>() { return 8; }
+template<> constexpr uint greenWidth<QImage::Format_RGB16>() { return 6; }
+template<> constexpr uint greenWidth<QImage::Format_RGB444>() { return 4; }
+template<> constexpr uint greenWidth<QImage::Format_RGB555>() { return 5; }
+template<> constexpr uint greenWidth<QImage::Format_RGB666>() { return 6; }
+template<> constexpr uint greenWidth<QImage::Format_RGB888>() { return 8; }
+template<> constexpr uint greenWidth<QImage::Format_BGR888>() { return 8; }
+template<> constexpr uint greenWidth<QImage::Format_ARGB4444_Premultiplied>() { return 4; }
+template<> constexpr uint greenWidth<QImage::Format_ARGB8555_Premultiplied>() { return 5; }
+template<> constexpr uint greenWidth<QImage::Format_ARGB8565_Premultiplied>() { return 6; }
+template<> constexpr uint greenWidth<QImage::Format_ARGB6666_Premultiplied>() { return 6; }
+template<> constexpr uint greenWidth<QImage::Format_RGBX8888>() { return 8; }
+template<> constexpr uint greenWidth<QImage::Format_RGBA8888>() { return 8; }
+template<> constexpr uint greenWidth<QImage::Format_RGBA8888_Premultiplied>() { return 8; }
+
+template<> constexpr uint greenShift<QImage::Format_RGB32>() { return 8; }
+template<> constexpr uint greenShift<QImage::Format_ARGB32>() { return 8; }
+template<> constexpr uint greenShift<QImage::Format_ARGB32_Premultiplied>() { return 8; }
+template<> constexpr uint greenShift<QImage::Format_RGB16>() { return 5; }
+template<> constexpr uint greenShift<QImage::Format_RGB444>() { return 4; }
+template<> constexpr uint greenShift<QImage::Format_RGB555>() { return 5; }
+template<> constexpr uint greenShift<QImage::Format_RGB666>() { return 6; }
+template<> constexpr uint greenShift<QImage::Format_RGB888>() { return 8; }
+template<> constexpr uint greenShift<QImage::Format_BGR888>() { return 8; }
+template<> constexpr uint greenShift<QImage::Format_ARGB4444_Premultiplied>() { return 4; }
+template<> constexpr uint greenShift<QImage::Format_ARGB8555_Premultiplied>() { return 13; }
+template<> constexpr uint greenShift<QImage::Format_ARGB8565_Premultiplied>() { return 13; }
+template<> constexpr uint greenShift<QImage::Format_ARGB6666_Premultiplied>() { return 6; }
+#if Q_BYTE_ORDER == Q_BIG_ENDIAN
+template<> constexpr uint greenShift<QImage::Format_RGBX8888>() { return 16; }
+template<> constexpr uint greenShift<QImage::Format_RGBA8888>() { return 16; }
+template<> constexpr uint greenShift<QImage::Format_RGBA8888_Premultiplied>() { return 16; }
+#else
+template<> constexpr uint greenShift<QImage::Format_RGBX8888>() { return 8; }
+template<> constexpr uint greenShift<QImage::Format_RGBA8888>() { return 8; }
+template<> constexpr uint greenShift<QImage::Format_RGBA8888_Premultiplied>() { return 8; }
+#endif
+template<> constexpr uint blueWidth<QImage::Format_RGB32>() { return 8; }
+template<> constexpr uint blueWidth<QImage::Format_ARGB32>() { return 8; }
+template<> constexpr uint blueWidth<QImage::Format_ARGB32_Premultiplied>() { return 8; }
+template<> constexpr uint blueWidth<QImage::Format_RGB16>() { return 5; }
+template<> constexpr uint blueWidth<QImage::Format_RGB444>() { return 4; }
+template<> constexpr uint blueWidth<QImage::Format_RGB555>() { return 5; }
+template<> constexpr uint blueWidth<QImage::Format_RGB666>() { return 6; }
+template<> constexpr uint blueWidth<QImage::Format_RGB888>() { return 8; }
+template<> constexpr uint blueWidth<QImage::Format_BGR888>() { return 8; }
+template<> constexpr uint blueWidth<QImage::Format_ARGB4444_Premultiplied>() { return 4; }
+template<> constexpr uint blueWidth<QImage::Format_ARGB8555_Premultiplied>() { return 5; }
+template<> constexpr uint blueWidth<QImage::Format_ARGB8565_Premultiplied>() { return 5; }
+template<> constexpr uint blueWidth<QImage::Format_ARGB6666_Premultiplied>() { return 6; }
+template<> constexpr uint blueWidth<QImage::Format_RGBX8888>() { return 8; }
+template<> constexpr uint blueWidth<QImage::Format_RGBA8888>() { return 8; }
+template<> constexpr uint blueWidth<QImage::Format_RGBA8888_Premultiplied>() { return 8; }
+
+template<> constexpr uint blueShift<QImage::Format_RGB32>() { return 0; }
+template<> constexpr uint blueShift<QImage::Format_ARGB32>() { return 0; }
+template<> constexpr uint blueShift<QImage::Format_ARGB32_Premultiplied>() { return 0; }
+template<> constexpr uint blueShift<QImage::Format_RGB16>() { return 0; }
+template<> constexpr uint blueShift<QImage::Format_RGB444>() { return 0; }
+template<> constexpr uint blueShift<QImage::Format_RGB555>() { return 0; }
+template<> constexpr uint blueShift<QImage::Format_RGB666>() { return 0; }
+template<> constexpr uint blueShift<QImage::Format_RGB888>() { return 0; }
+template<> constexpr uint blueShift<QImage::Format_BGR888>() { return 16; }
+template<> constexpr uint blueShift<QImage::Format_ARGB4444_Premultiplied>() { return 0; }
+template<> constexpr uint blueShift<QImage::Format_ARGB8555_Premultiplied>() { return 8; }
+template<> constexpr uint blueShift<QImage::Format_ARGB8565_Premultiplied>() { return 8; }
+template<> constexpr uint blueShift<QImage::Format_ARGB6666_Premultiplied>() { return 0; }
+#if Q_BYTE_ORDER == Q_BIG_ENDIAN
+template<> constexpr uint blueShift<QImage::Format_RGBX8888>() { return 8; }
+template<> constexpr uint blueShift<QImage::Format_RGBA8888>() { return 8; }
+template<> constexpr uint blueShift<QImage::Format_RGBA8888_Premultiplied>() { return 8; }
+#else
+template<> constexpr uint blueShift<QImage::Format_RGBX8888>() { return 16; }
+template<> constexpr uint blueShift<QImage::Format_RGBA8888>() { return 16; }
+template<> constexpr uint blueShift<QImage::Format_RGBA8888_Premultiplied>() { return 16; }
+#endif
+template<> constexpr uint alphaWidth<QImage::Format_RGB32>() { return 0; }
+template<> constexpr uint alphaWidth<QImage::Format_ARGB32>() { return 8; }
+template<> constexpr uint alphaWidth<QImage::Format_ARGB32_Premultiplied>() { return 8; }
+template<> constexpr uint alphaWidth<QImage::Format_RGB16>() { return 0; }
+template<> constexpr uint alphaWidth<QImage::Format_RGB444>() { return 0; }
+template<> constexpr uint alphaWidth<QImage::Format_RGB555>() { return 0; }
+template<> constexpr uint alphaWidth<QImage::Format_RGB666>() { return 0; }
+template<> constexpr uint alphaWidth<QImage::Format_RGB888>() { return 0; }
+template<> constexpr uint alphaWidth<QImage::Format_BGR888>() { return 0; }
+template<> constexpr uint alphaWidth<QImage::Format_ARGB4444_Premultiplied>() { return 4; }
+template<> constexpr uint alphaWidth<QImage::Format_ARGB8555_Premultiplied>() { return 8; }
+template<> constexpr uint alphaWidth<QImage::Format_ARGB8565_Premultiplied>() { return 8; }
+template<> constexpr uint alphaWidth<QImage::Format_ARGB6666_Premultiplied>() { return 6; }
+template<> constexpr uint alphaWidth<QImage::Format_RGBX8888>() { return 0; }
+template<> constexpr uint alphaWidth<QImage::Format_RGBA8888>() { return 8; }
+template<> constexpr uint alphaWidth<QImage::Format_RGBA8888_Premultiplied>() { return 8; }
+
+template<> constexpr uint alphaShift<QImage::Format_RGB32>() { return 24; }
+template<> constexpr uint alphaShift<QImage::Format_ARGB32>() { return 24; }
+template<> constexpr uint alphaShift<QImage::Format_ARGB32_Premultiplied>() { return 24; }
+template<> constexpr uint alphaShift<QImage::Format_RGB16>() { return 0; }
+template<> constexpr uint alphaShift<QImage::Format_RGB444>() { return 0; }
+template<> constexpr uint alphaShift<QImage::Format_RGB555>() { return 0; }
+template<> constexpr uint alphaShift<QImage::Format_RGB666>() { return 0; }
+template<> constexpr uint alphaShift<QImage::Format_RGB888>() { return 0; }
+template<> constexpr uint alphaShift<QImage::Format_BGR888>() { return 0; }
+template<> constexpr uint alphaShift<QImage::Format_ARGB4444_Premultiplied>() { return 12; }
+template<> constexpr uint alphaShift<QImage::Format_ARGB8555_Premultiplied>() { return 0; }
+template<> constexpr uint alphaShift<QImage::Format_ARGB8565_Premultiplied>() { return 0; }
+template<> constexpr uint alphaShift<QImage::Format_ARGB6666_Premultiplied>() { return 18; }
+#if Q_BYTE_ORDER == Q_BIG_ENDIAN
+template<> constexpr uint alphaShift<QImage::Format_RGBX8888>() { return 0; }
+template<> constexpr uint alphaShift<QImage::Format_RGBA8888>() { return 0; }
+template<> constexpr uint alphaShift<QImage::Format_RGBA8888_Premultiplied>() { return 0; }
+#else
+template<> constexpr uint alphaShift<QImage::Format_RGBX8888>() { return 24; }
+template<> constexpr uint alphaShift<QImage::Format_RGBA8888>() { return 24; }
+template<> constexpr uint alphaShift<QImage::Format_RGBA8888_Premultiplied>() { return 24; }
+#endif
+
+template<QImage::Format> constexpr QPixelLayout::BPP bitsPerPixel();
+template<> constexpr QPixelLayout::BPP bitsPerPixel<QImage::Format_RGB32>() { return QPixelLayout::BPP32; }
+template<> constexpr QPixelLayout::BPP bitsPerPixel<QImage::Format_ARGB32>() { return QPixelLayout::BPP32; }
+template<> constexpr QPixelLayout::BPP bitsPerPixel<QImage::Format_ARGB32_Premultiplied>() { return QPixelLayout::BPP32; }
+template<> constexpr QPixelLayout::BPP bitsPerPixel<QImage::Format_RGB16>() { return QPixelLayout::BPP16; }
+template<> constexpr QPixelLayout::BPP bitsPerPixel<QImage::Format_RGB444>() { return QPixelLayout::BPP16; }
+template<> constexpr QPixelLayout::BPP bitsPerPixel<QImage::Format_RGB555>() { return QPixelLayout::BPP16; }
+template<> constexpr QPixelLayout::BPP bitsPerPixel<QImage::Format_RGB666>() { return QPixelLayout::BPP24; }
+template<> constexpr QPixelLayout::BPP bitsPerPixel<QImage::Format_RGB888>() { return QPixelLayout::BPP24; }
+template<> constexpr QPixelLayout::BPP bitsPerPixel<QImage::Format_BGR888>() { return QPixelLayout::BPP24; }
+template<> constexpr QPixelLayout::BPP bitsPerPixel<QImage::Format_ARGB4444_Premultiplied>() { return QPixelLayout::BPP16; }
+template<> constexpr QPixelLayout::BPP bitsPerPixel<QImage::Format_ARGB8555_Premultiplied>() { return QPixelLayout::BPP24; }
+template<> constexpr QPixelLayout::BPP bitsPerPixel<QImage::Format_ARGB8565_Premultiplied>() { return QPixelLayout::BPP24; }
+template<> constexpr QPixelLayout::BPP bitsPerPixel<QImage::Format_ARGB6666_Premultiplied>() { return QPixelLayout::BPP24; }
+template<> constexpr QPixelLayout::BPP bitsPerPixel<QImage::Format_RGBX8888>() { return QPixelLayout::BPP32; }
+template<> constexpr QPixelLayout::BPP bitsPerPixel<QImage::Format_RGBA8888>() { return QPixelLayout::BPP32; }
+template<> constexpr QPixelLayout::BPP bitsPerPixel<QImage::Format_RGBA8888_Premultiplied>() { return QPixelLayout::BPP32; }
+
+template <QPixelLayout::BPP width> static
+void QT_FASTCALL storePixel(uchar *dest, int index, uint pixel);
+
+template <>
+inline void QT_FASTCALL storePixel<QPixelLayout::BPP16>(uchar *dest, int index, uint pixel)
+{
+ reinterpret_cast<quint16 *>(dest)[index] = quint16(pixel);
+}
+
+template <>
+inline void QT_FASTCALL storePixel<QPixelLayout::BPP24>(uchar *dest, int index, uint pixel)
+{
+ reinterpret_cast<quint24 *>(dest)[index] = quint24(pixel);
+}
+
+template <QPixelLayout::BPP bpp> static
+inline uint QT_FASTCALL fetchPixel(const uchar *, int)
+{
+ Q_UNREACHABLE_RETURN(0);
+}
+
+template <>
+inline uint QT_FASTCALL fetchPixel<QPixelLayout::BPP1LSB>(const uchar *src, int index)
+{
+ return (src[index >> 3] >> (index & 7)) & 1;
+}
+
+template <>
+inline uint QT_FASTCALL fetchPixel<QPixelLayout::BPP1MSB>(const uchar *src, int index)
+{
+ return (src[index >> 3] >> (~index & 7)) & 1;
+}
+
+template <>
+inline uint QT_FASTCALL fetchPixel<QPixelLayout::BPP8>(const uchar *src, int index)
+{
+ return src[index];
+}
+
+template <>
+inline uint QT_FASTCALL fetchPixel<QPixelLayout::BPP16>(const uchar *src, int index)
+{
+ return reinterpret_cast<const quint16 *>(src)[index];
+}
+
+template <>
+inline uint QT_FASTCALL fetchPixel<QPixelLayout::BPP24>(const uchar *src, int index)
+{
+ return reinterpret_cast<const quint24 *>(src)[index];
+}
+
+template <>
+inline uint QT_FASTCALL fetchPixel<QPixelLayout::BPP32>(const uchar *src, int index)
+{
+ return reinterpret_cast<const uint *>(src)[index];
+}
+
+template <>
+[[maybe_unused]]
+inline uint QT_FASTCALL fetchPixel<QPixelLayout::BPP64>(const uchar *src, int index)
+{
+ // We have to do the conversion in fetch to fit into a 32bit uint
+ QRgba64 c = reinterpret_cast<const QRgba64 *>(src)[index];
+ return c.toArgb32();
+}
+
+template <>
+[[maybe_unused]]
+inline uint QT_FASTCALL fetchPixel<QPixelLayout::BPP16FPx4>(const uchar *src, int index)
+{
+ // We have to do the conversion in fetch to fit into a 32bit uint
+ QRgbaFloat16 c = reinterpret_cast<const QRgbaFloat16 *>(src)[index];
+ return c.toArgb32();
+}
+
+template <>
+[[maybe_unused]]
+inline uint QT_FASTCALL fetchPixel<QPixelLayout::BPP32FPx4>(const uchar *src, int index)
+{
+ // We have to do the conversion in fetch to fit into a 32bit uint
+ QRgbaFloat32 c = reinterpret_cast<const QRgbaFloat32 *>(src)[index];
+ return c.toArgb32();
+}
+
+template<QImage::Format Format>
+static inline uint convertPixelToRGB32(uint s)
+{
+ constexpr uint redMask = ((1 << redWidth<Format>()) - 1);
+ constexpr uint greenMask = ((1 << greenWidth<Format>()) - 1);
+ constexpr uint blueMask = ((1 << blueWidth<Format>()) - 1);
+
+ constexpr uchar redLeftShift = 8 - redWidth<Format>();
+ constexpr uchar greenLeftShift = 8 - greenWidth<Format>();
+ constexpr uchar blueLeftShift = 8 - blueWidth<Format>();
+
+ constexpr uchar redRightShift = 2 * redWidth<Format>() - 8;
+ constexpr uchar greenRightShift = 2 * greenWidth<Format>() - 8;
+ constexpr uchar blueRightShift = 2 * blueWidth<Format>() - 8;
+
+ uint red = (s >> redShift<Format>()) & redMask;
+ uint green = (s >> greenShift<Format>()) & greenMask;
+ uint blue = (s >> blueShift<Format>()) & blueMask;
+
+ red = ((red << redLeftShift) | (red >> redRightShift)) << 16;
+ green = ((green << greenLeftShift) | (green >> greenRightShift)) << 8;
+ blue = (blue << blueLeftShift) | (blue >> blueRightShift);
+ return 0xff000000 | red | green | blue;
+}
+
+template<QImage::Format Format>
+static void QT_FASTCALL convertToRGB32(uint *buffer, int count, const QList<QRgb> *)
+{
+ for (int i = 0; i < count; ++i)
+ buffer[i] = convertPixelToRGB32<Format>(buffer[i]);
+}
+
+#if defined(__SSE2__) && !defined(__SSSE3__) && QT_COMPILER_SUPPORTS_SSSE3
+extern const uint * QT_FASTCALL fetchPixelsBPP24_ssse3(uint *dest, const uchar*src, int index, int count);
+#endif
+
+template<QImage::Format Format>
+static const uint *QT_FASTCALL fetchRGBToRGB32(uint *buffer, const uchar *src, int index, int count,
+ const QList<QRgb> *, QDitherInfo *)
+{
+ constexpr QPixelLayout::BPP BPP = bitsPerPixel<Format>();
+#if defined(__SSE2__) && !defined(__SSSE3__) && QT_COMPILER_SUPPORTS_SSSE3
+ if (BPP == QPixelLayout::BPP24 && qCpuHasFeature(SSSE3)) {
+ // With SSE2 can convertToRGB32 be vectorized, but it takes SSSE3
+ // to vectorize the deforested version below.
+ fetchPixelsBPP24_ssse3(buffer, src, index, count);
+ convertToRGB32<Format>(buffer, count, nullptr);
+ return buffer;
+ }
+#endif
+ for (int i = 0; i < count; ++i)
+ buffer[i] = convertPixelToRGB32<Format>(fetchPixel<BPP>(src, index + i));
+ return buffer;
+}
+
+template<QImage::Format Format>
+static inline QRgba64 convertPixelToRGB64(uint s)
+{
+ return QRgba64::fromArgb32(convertPixelToRGB32<Format>(s));
+}
+
+template<QImage::Format Format>
+static const QRgba64 *QT_FASTCALL convertToRGB64(QRgba64 *buffer, const uint *src, int count,
+ const QList<QRgb> *, QDitherInfo *)
+{
+ for (int i = 0; i < count; ++i)
+ buffer[i] = convertPixelToRGB64<Format>(src[i]);
+ return buffer;
+}
+
+template<QImage::Format Format>
+static const QRgba64 *QT_FASTCALL fetchRGBToRGB64(QRgba64 *buffer, const uchar *src, int index, int count,
+ const QList<QRgb> *, QDitherInfo *)
+{
+ for (int i = 0; i < count; ++i)
+ buffer[i] = convertPixelToRGB64<Format>(fetchPixel<bitsPerPixel<Format>()>(src, index + i));
+ return buffer;
+}
+
+template<QImage::Format Format>
+static Q_ALWAYS_INLINE QRgbaFloat32 convertPixelToRGB32F(uint s)
+{
+ return QRgbaFloat32::fromArgb32(convertPixelToRGB32<Format>(s));
+}
+
+template<QImage::Format Format>
+static const QRgbaFloat32 *QT_FASTCALL fetchRGBToRGB32F(QRgbaFloat32 *buffer, const uchar *src, int index, int count,
+ const QList<QRgb> *, QDitherInfo *)
+{
+ for (int i = 0; i < count; ++i)
+ buffer[i] = convertPixelToRGB32F<Format>(fetchPixel<bitsPerPixel<Format>()>(src, index + i));
+ return buffer;
+}
+
+template<QImage::Format Format>
+static inline uint convertPixelToARGB32PM(uint s)
+{
+ constexpr uint alphaMask = ((1 << alphaWidth<Format>()) - 1);
+ constexpr uint redMask = ((1 << redWidth<Format>()) - 1);
+ constexpr uint greenMask = ((1 << greenWidth<Format>()) - 1);
+ constexpr uint blueMask = ((1 << blueWidth<Format>()) - 1);
+
+ constexpr uchar alphaLeftShift = 8 - alphaWidth<Format>();
+ constexpr uchar redLeftShift = 8 - redWidth<Format>();
+ constexpr uchar greenLeftShift = 8 - greenWidth<Format>();
+ constexpr uchar blueLeftShift = 8 - blueWidth<Format>();
+
+ constexpr uchar alphaRightShift = 2 * alphaWidth<Format>() - 8;
+ constexpr uchar redRightShift = 2 * redWidth<Format>() - 8;
+ constexpr uchar greenRightShift = 2 * greenWidth<Format>() - 8;
+ constexpr uchar blueRightShift = 2 * blueWidth<Format>() - 8;
+
+ constexpr bool mustMin = (alphaWidth<Format>() != redWidth<Format>()) ||
+ (alphaWidth<Format>() != greenWidth<Format>()) ||
+ (alphaWidth<Format>() != blueWidth<Format>());
+
+ uint alpha = (s >> alphaShift<Format>()) & alphaMask;
+ uint red = (s >> redShift<Format>()) & redMask;
+ uint green = (s >> greenShift<Format>()) & greenMask;
+ uint blue = (s >> blueShift<Format>()) & blueMask;
+
+ alpha = (alpha << alphaLeftShift) | (alpha >> alphaRightShift);
+ red = (red << redLeftShift) | (red >> redRightShift);
+ green = (green << greenLeftShift) | (green >> greenRightShift);
+ blue = (blue << blueLeftShift) | (blue >> blueRightShift);
+
+ if (mustMin) {
+ red = qMin(alpha, red);
+ green = qMin(alpha, green);
+ blue = qMin(alpha, blue);
+ }
+
+ return (alpha << 24) | (red << 16) | (green << 8) | blue;
+}
+
+template<QImage::Format Format>
+static void QT_FASTCALL convertARGBPMToARGB32PM(uint *buffer, int count, const QList<QRgb> *)
+{
+ for (int i = 0; i < count; ++i)
+ buffer[i] = convertPixelToARGB32PM<Format>(buffer[i]);
+}
+
+template<QImage::Format Format>
+static const uint *QT_FASTCALL fetchARGBPMToARGB32PM(uint *buffer, const uchar *src, int index, int count,
+ const QList<QRgb> *, QDitherInfo *)
+{
+ constexpr QPixelLayout::BPP BPP = bitsPerPixel<Format>();
+#if defined(__SSE2__) && !defined(__SSSE3__) && QT_COMPILER_SUPPORTS_SSSE3
+ if (BPP == QPixelLayout::BPP24 && qCpuHasFeature(SSSE3)) {
+ // With SSE2 can convertToRGB32 be vectorized, but it takes SSSE3
+ // to vectorize the deforested version below.
+ fetchPixelsBPP24_ssse3(buffer, src, index, count);
+ convertARGBPMToARGB32PM<Format>(buffer, count, nullptr);
+ return buffer;
+ }
+#endif
+ for (int i = 0; i < count; ++i)
+ buffer[i] = convertPixelToARGB32PM<Format>(fetchPixel<BPP>(src, index + i));
+ return buffer;
+}
+
+template<QImage::Format Format>
+static inline QRgba64 convertPixelToRGBA64PM(uint s)
+{
+ return QRgba64::fromArgb32(convertPixelToARGB32PM<Format>(s));
+}
+
+template<QImage::Format Format>
+static const QRgba64 *QT_FASTCALL convertARGBPMToRGBA64PM(QRgba64 *buffer, const uint *src, int count,
+ const QList<QRgb> *, QDitherInfo *)
+{
+ for (int i = 0; i < count; ++i)
+ buffer[i] = convertPixelToRGB64<Format>(src[i]);
+ return buffer;
+}
+
+template<QImage::Format Format>
+static const QRgba64 *QT_FASTCALL fetchARGBPMToRGBA64PM(QRgba64 *buffer, const uchar *src, int index, int count,
+ const QList<QRgb> *, QDitherInfo *)
+{
+ constexpr QPixelLayout::BPP bpp = bitsPerPixel<Format>();
+ for (int i = 0; i < count; ++i)
+ buffer[i] = convertPixelToRGBA64PM<Format>(fetchPixel<bpp>(src, index + i));
+ return buffer;
+}
+
+template<QImage::Format Format>
+static Q_ALWAYS_INLINE QRgbaFloat32 convertPixelToRGBA32F(uint s)
+{
+ return QRgbaFloat32::fromArgb32(convertPixelToARGB32PM<Format>(s));
+}
+
+template<QImage::Format Format>
+static const QRgbaFloat32 *QT_FASTCALL fetchARGBPMToRGBA32F(QRgbaFloat32 *buffer, const uchar *src, int index, int count,
+ const QList<QRgb> *, QDitherInfo *)
+{
+ constexpr QPixelLayout::BPP bpp = bitsPerPixel<Format>();
+ for (int i = 0; i < count; ++i)
+ buffer[i] = convertPixelToRGBA32F<Format>(fetchPixel<bpp>(src, index + i));
+ return buffer;
+}
+
+template<QImage::Format Format>
+static const QRgbaFloat32 *QT_FASTCALL fetchARGBToRGBA32F(QRgbaFloat32 *buffer, const uchar *src, int index, int count,
+ const QList<QRgb> *, QDitherInfo *)
+{
+ constexpr QPixelLayout::BPP bpp = bitsPerPixel<Format>();
+ for (int i = 0; i < count; ++i)
+ buffer[i] = convertPixelToRGBA32F<Format>(fetchPixel<bpp>(src, index + i)).premultiplied();
+ return buffer;
+}
+
+template<QImage::Format Format, bool fromRGB>
+static void QT_FASTCALL storeRGBFromARGB32PM(uchar *dest, const uint *src, int index, int count,
+ const QList<QRgb> *, QDitherInfo *dither)
+{
+ constexpr uchar rWidth = redWidth<Format>();
+ constexpr uchar gWidth = greenWidth<Format>();
+ constexpr uchar bWidth = blueWidth<Format>();
+ constexpr QPixelLayout::BPP BPP = bitsPerPixel<Format>();
+
+ // RGB32 -> RGB888 is not a precision loss.
+ if (!dither || (rWidth == 8 && gWidth == 8 && bWidth == 8)) {
+ constexpr uint rMask = (1 << redWidth<Format>()) - 1;
+ constexpr uint gMask = (1 << greenWidth<Format>()) - 1;
+ constexpr uint bMask = (1 << blueWidth<Format>()) - 1;
+ constexpr uchar rRightShift = 24 - redWidth<Format>();
+ constexpr uchar gRightShift = 16 - greenWidth<Format>();
+ constexpr uchar bRightShift = 8 - blueWidth<Format>();
+
+ for (int i = 0; i < count; ++i) {
+ const uint c = fromRGB ? src[i] : qUnpremultiply(src[i]);
+ const uint r = ((c >> rRightShift) & rMask) << redShift<Format>();
+ const uint g = ((c >> gRightShift) & gMask) << greenShift<Format>();
+ const uint b = ((c >> bRightShift) & bMask) << blueShift<Format>();
+ storePixel<BPP>(dest, index + i, r | g | b);
+ };
+ } else {
+ // We do ordered dither by using a rounding conversion, but instead of
+ // adding half of input precision, we add the adjusted result from the
+ // bayer matrix before narrowing.
+ // Note: Rounding conversion in itself is different from the naive
+ // conversion we do above for non-dithering.
+ const uint *bayer_line = qt_bayer_matrix[dither->y & 15];
+ for (int i = 0; i < count; ++i) {
+ const uint c = fromRGB ? src[i] : qUnpremultiply(src[i]);
+ const int d = bayer_line[(dither->x + i) & 15];
+ const int dr = d - ((d + 1) >> rWidth);
+ const int dg = d - ((d + 1) >> gWidth);
+ const int db = d - ((d + 1) >> bWidth);
+ int r = qRed(c);
+ int g = qGreen(c);
+ int b = qBlue(c);
+ r = (r + ((dr - r) >> rWidth) + 1) >> (8 - rWidth);
+ g = (g + ((dg - g) >> gWidth) + 1) >> (8 - gWidth);
+ b = (b + ((db - b) >> bWidth) + 1) >> (8 - bWidth);
+ const uint s = (r << redShift<Format>())
+ | (g << greenShift<Format>())
+ | (b << blueShift<Format>());
+ storePixel<BPP>(dest, index + i, s);
+ }
+ }
+}
+
+template<QImage::Format Format, bool fromRGB>
+static void QT_FASTCALL storeARGBPMFromARGB32PM(uchar *dest, const uint *src, int index, int count,
+ const QList<QRgb> *, QDitherInfo *dither)
+{
+ constexpr QPixelLayout::BPP BPP = bitsPerPixel<Format>();
+ if (!dither) {
+ constexpr uint aMask = (1 << alphaWidth<Format>()) - 1;
+ constexpr uint rMask = (1 << redWidth<Format>()) - 1;
+ constexpr uint gMask = (1 << greenWidth<Format>()) - 1;
+ constexpr uint bMask = (1 << blueWidth<Format>()) - 1;
+
+ constexpr uchar aRightShift = 32 - alphaWidth<Format>();
+ constexpr uchar rRightShift = 24 - redWidth<Format>();
+ constexpr uchar gRightShift = 16 - greenWidth<Format>();
+ constexpr uchar bRightShift = 8 - blueWidth<Format>();
+
+ constexpr uint aOpaque = aMask << alphaShift<Format>();
+ for (int i = 0; i < count; ++i) {
+ const uint c = src[i];
+ const uint a = fromRGB ? aOpaque : (((c >> aRightShift) & aMask) << alphaShift<Format>());
+ const uint r = ((c >> rRightShift) & rMask) << redShift<Format>();
+ const uint g = ((c >> gRightShift) & gMask) << greenShift<Format>();
+ const uint b = ((c >> bRightShift) & bMask) << blueShift<Format>();
+ storePixel<BPP>(dest, index + i, a | r | g | b);
+ };
+ } else {
+ constexpr uchar aWidth = alphaWidth<Format>();
+ constexpr uchar rWidth = redWidth<Format>();
+ constexpr uchar gWidth = greenWidth<Format>();
+ constexpr uchar bWidth = blueWidth<Format>();
+
+ const uint *bayer_line = qt_bayer_matrix[dither->y & 15];
+ for (int i = 0; i < count; ++i) {
+ const uint c = src[i];
+ const int d = bayer_line[(dither->x + i) & 15];
+ const int da = d - ((d + 1) >> aWidth);
+ const int dr = d - ((d + 1) >> rWidth);
+ const int dg = d - ((d + 1) >> gWidth);
+ const int db = d - ((d + 1) >> bWidth);
+ int a = qAlpha(c);
+ int r = qRed(c);
+ int g = qGreen(c);
+ int b = qBlue(c);
+ if (fromRGB)
+ a = (1 << aWidth) - 1;
+ else
+ a = (a + ((da - a) >> aWidth) + 1) >> (8 - aWidth);
+ r = (r + ((dr - r) >> rWidth) + 1) >> (8 - rWidth);
+ g = (g + ((dg - g) >> gWidth) + 1) >> (8 - gWidth);
+ b = (b + ((db - b) >> bWidth) + 1) >> (8 - bWidth);
+ uint s = (a << alphaShift<Format>())
+ | (r << redShift<Format>())
+ | (g << greenShift<Format>())
+ | (b << blueShift<Format>());
+ storePixel<BPP>(dest, index + i, s);
+ }
+ }
+}
+
+template<QImage::Format Format>
+static void QT_FASTCALL rbSwap(uchar *dst, const uchar *src, int count)
+{
+ constexpr uchar aWidth = alphaWidth<Format>();
+ constexpr uchar aShift = alphaShift<Format>();
+ constexpr uchar rWidth = redWidth<Format>();
+ constexpr uchar rShift = redShift<Format>();
+ constexpr uchar gWidth = greenWidth<Format>();
+ constexpr uchar gShift = greenShift<Format>();
+ constexpr uchar bWidth = blueWidth<Format>();
+ constexpr uchar bShift = blueShift<Format>();
+ static_assert(rWidth == bWidth);
+ constexpr uint redBlueMask = (1 << rWidth) - 1;
+ constexpr uint alphaGreenMask = (((1 << aWidth) - 1) << aShift)
+ | (((1 << gWidth) - 1) << gShift);
+ constexpr QPixelLayout::BPP bpp = bitsPerPixel<Format>();
+
+ for (int i = 0; i < count; ++i) {
+ const uint c = fetchPixel<bpp>(src, i);
+ const uint r = (c >> rShift) & redBlueMask;
+ const uint b = (c >> bShift) & redBlueMask;
+ const uint t = (c & alphaGreenMask)
+ | (r << bShift)
+ | (b << rShift);
+ storePixel<bpp>(dst, i, t);
+ }
+}
+
+static void QT_FASTCALL rbSwap_rgb32(uchar *d, const uchar *s, int count)
+{
+ const uint *src = reinterpret_cast<const uint *>(s);
+ uint *dest = reinterpret_cast<uint *>(d);
+ for (int i = 0; i < count; ++i) {
+ const uint c = src[i];
+ const uint ag = c & 0xff00ff00;
+ const uint rb = c & 0x00ff00ff;
+ dest[i] = ag | (rb << 16) | (rb >> 16);
+ }
+}
+
+#if Q_BYTE_ORDER == Q_LITTLE_ENDIAN
+template<>
+void QT_FASTCALL rbSwap<QImage::Format_RGBA8888>(uchar *d, const uchar *s, int count)
+{
+ return rbSwap_rgb32(d, s, count);
+}
+#else
+template<>
+void QT_FASTCALL rbSwap<QImage::Format_RGBA8888>(uchar *d, const uchar *s, int count)
+{
+ const uint *src = reinterpret_cast<const uint *>(s);
+ uint *dest = reinterpret_cast<uint *>(d);
+ for (int i = 0; i < count; ++i) {
+ const uint c = src[i];
+ const uint rb = c & 0xff00ff00;
+ const uint ga = c & 0x00ff00ff;
+ dest[i] = ga | (rb << 16) | (rb >> 16);
+ }
+}
+#endif
+
+static void QT_FASTCALL rbSwap_rgb30(uchar *d, const uchar *s, int count)
+{
+ const uint *src = reinterpret_cast<const uint *>(s);
+ uint *dest = reinterpret_cast<uint *>(d);
+ UNALIASED_CONVERSION_LOOP(dest, src, count, qRgbSwapRgb30);
+}
+
+static void QT_FASTCALL rbSwap_4x16(uchar *d, const uchar *s, int count)
+{
+ const ushort *src = reinterpret_cast<const ushort *>(s);
+ ushort *dest = reinterpret_cast<ushort *>(d);
+ if (src != dest) {
+ for (int i = 0; i < count; ++i) {
+ dest[i * 4 + 0] = src[i * 4 + 2];
+ dest[i * 4 + 1] = src[i * 4 + 1];
+ dest[i * 4 + 2] = src[i * 4 + 0];
+ dest[i * 4 + 3] = src[i * 4 + 3];
+ }
+ } else {
+ for (int i = 0; i < count; ++i) {
+ const ushort r = src[i * 4 + 0];
+ const ushort b = src[i * 4 + 2];
+ dest[i * 4 + 0] = b;
+ dest[i * 4 + 2] = r;
+ }
+ }
+}
+
+static void QT_FASTCALL rbSwap_4x32(uchar *d, const uchar *s, int count)
+{
+ const uint *src = reinterpret_cast<const uint *>(s);
+ uint *dest = reinterpret_cast<uint *>(d);
+ if (src != dest) {
+ for (int i = 0; i < count; ++i) {
+ dest[i * 4 + 0] = src[i * 4 + 2];
+ dest[i * 4 + 1] = src[i * 4 + 1];
+ dest[i * 4 + 2] = src[i * 4 + 0];
+ dest[i * 4 + 3] = src[i * 4 + 3];
+ }
+ } else {
+ for (int i = 0; i < count; ++i) {
+ const uint r = src[i * 4 + 0];
+ const uint b = src[i * 4 + 2];
+ dest[i * 4 + 0] = b;
+ dest[i * 4 + 2] = r;
+ }
+ }
+}
+
+template<QImage::Format Format> constexpr static inline QPixelLayout pixelLayoutRGB()
+{
+ return QPixelLayout{
+ false,
+ false,
+ bitsPerPixel<Format>(),
+ rbSwap<Format>,
+ convertToRGB32<Format>,
+ convertToRGB64<Format>,
+ fetchRGBToRGB32<Format>,
+ fetchRGBToRGB64<Format>,
+ storeRGBFromARGB32PM<Format, false>,
+ storeRGBFromARGB32PM<Format, true>
+ };
+}
+
+template<QImage::Format Format> constexpr static inline QPixelLayout pixelLayoutARGBPM()
+{
+ return QPixelLayout{
+ true,
+ true,
+ bitsPerPixel<Format>(),
+ rbSwap<Format>,
+ convertARGBPMToARGB32PM<Format>,
+ convertARGBPMToRGBA64PM<Format>,
+ fetchARGBPMToARGB32PM<Format>,
+ fetchARGBPMToRGBA64PM<Format>,
+ storeARGBPMFromARGB32PM<Format, false>,
+ storeARGBPMFromARGB32PM<Format, true>
+ };
+}
+
+static void QT_FASTCALL convertIndexedToARGB32PM(uint *buffer, int count, const QList<QRgb> *clut)
+{
+ for (int i = 0; i < count; ++i)
+ buffer[i] = qPremultiply(clut->at(buffer[i]));
+}
+
+template<QPixelLayout::BPP BPP>
+static const uint *QT_FASTCALL fetchIndexedToARGB32PM(uint *buffer, const uchar *src, int index, int count,
+ const QList<QRgb> *clut, QDitherInfo *)
+{
+ for (int i = 0; i < count; ++i) {
+ const uint s = fetchPixel<BPP>(src, index + i);
+ buffer[i] = qPremultiply(clut->at(s));
+ }
+ return buffer;
+}
+
+template<QPixelLayout::BPP BPP>
+static const QRgba64 *QT_FASTCALL fetchIndexedToRGBA64PM(QRgba64 *buffer, const uchar *src, int index, int count,
+ const QList<QRgb> *clut, QDitherInfo *)
+{
+ for (int i = 0; i < count; ++i) {
+ const uint s = fetchPixel<BPP>(src, index + i);
+ buffer[i] = QRgba64::fromArgb32(clut->at(s)).premultiplied();
+ }
+ return buffer;
+}
+
+template<QPixelLayout::BPP BPP>
+static const QRgbaFloat32 *QT_FASTCALL fetchIndexedToRGBA32F(QRgbaFloat32 *buffer, const uchar *src, int index, int count,
+ const QList<QRgb> *clut, QDitherInfo *)
+{
+ for (int i = 0; i < count; ++i) {
+ const uint s = fetchPixel<BPP>(src, index + i);
+ buffer[i] = QRgbaFloat32::fromArgb32(clut->at(s)).premultiplied();
+ }
+ return buffer;
+}
+
+template<typename QRgba>
+static const QRgba *QT_FASTCALL convertIndexedTo(QRgba *buffer, const uint *src, int count,
+ const QList<QRgb> *clut, QDitherInfo *)
+{
+ for (int i = 0; i < count; ++i)
+ buffer[i] = QRgba::fromArgb32(clut->at(src[i])).premultiplied();
+ return buffer;
+}
+
+static void QT_FASTCALL convertPassThrough(uint *, int, const QList<QRgb> *)
+{
+}
+
+static const uint *QT_FASTCALL fetchPassThrough(uint *, const uchar *src, int index, int,
+ const QList<QRgb> *, QDitherInfo *)
+{
+ return reinterpret_cast<const uint *>(src) + index;
+}
+
+static const QRgba64 *QT_FASTCALL fetchPassThrough64(QRgba64 *, const uchar *src, int index, int,
+ const QList<QRgb> *, QDitherInfo *)
+{
+ return reinterpret_cast<const QRgba64 *>(src) + index;
+}
+
+static void QT_FASTCALL storePassThrough(uchar *dest, const uint *src, int index, int count,
+ const QList<QRgb> *, QDitherInfo *)
+{
+ uint *d = reinterpret_cast<uint *>(dest) + index;
+ if (d != src)
+ memcpy(d, src, count * sizeof(uint));
+}
+
+static void QT_FASTCALL convertARGB32ToARGB32PM(uint *buffer, int count, const QList<QRgb> *)
+{
+ qt_convertARGB32ToARGB32PM(buffer, buffer, count);
+}
+
+static const uint *QT_FASTCALL fetchARGB32ToARGB32PM(uint *buffer, const uchar *src, int index, int count,
+ const QList<QRgb> *, QDitherInfo *)
+{
+ return qt_convertARGB32ToARGB32PM(buffer, reinterpret_cast<const uint *>(src) + index, count);
+}
+
+static void QT_FASTCALL convertRGBA8888PMToARGB32PM(uint *buffer, int count, const QList<QRgb> *)
+{
+ for (int i = 0; i < count; ++i)
+ buffer[i] = RGBA2ARGB(buffer[i]);
+}
+
+static const uint *QT_FASTCALL fetchRGBA8888PMToARGB32PM(uint *buffer, const uchar *src, int index, int count,
+ const QList<QRgb> *, QDitherInfo *)
+{
+ const uint *s = reinterpret_cast<const uint *>(src) + index;
+ UNALIASED_CONVERSION_LOOP(buffer, s, count, RGBA2ARGB);
+ return buffer;
+}
+
+static void QT_FASTCALL convertRGBA8888ToARGB32PM(uint *buffer, int count, const QList<QRgb> *)
+{
+ qt_convertRGBA8888ToARGB32PM(buffer, buffer, count);
+}
+
+static const uint *QT_FASTCALL fetchRGBA8888ToARGB32PM(uint *buffer, const uchar *src, int index, int count,
+ const QList<QRgb> *, QDitherInfo *)
+{
+ return qt_convertRGBA8888ToARGB32PM(buffer, reinterpret_cast<const uint *>(src) + index, count);
+}
+
+static void QT_FASTCALL convertAlpha8ToRGB32(uint *buffer, int count, const QList<QRgb> *)
+{
+ for (int i = 0; i < count; ++i)
+ buffer[i] = qRgba(0, 0, 0, buffer[i]);
+}
+
+static const uint *QT_FASTCALL fetchAlpha8ToRGB32(uint *buffer, const uchar *src, int index, int count,
+ const QList<QRgb> *, QDitherInfo *)
+{
+ for (int i = 0; i < count; ++i)
+ buffer[i] = qRgba(0, 0, 0, src[index + i]);
+ return buffer;
+}
+
+template<typename QRgba>
+static const QRgba *QT_FASTCALL convertAlpha8To(QRgba *buffer, const uint *src, int count,
+ const QList<QRgb> *, QDitherInfo *)
+{
+ for (int i = 0; i < count; ++i)
+ buffer[i] = QRgba::fromRgba(0, 0, 0, src[i]);
+ return buffer;
+}
+
+template<typename QRgba>
+static const QRgba *QT_FASTCALL fetchAlpha8To(QRgba *buffer, const uchar *src, int index, int count,
+ const QList<QRgb> *, QDitherInfo *)
+{
+ for (int i = 0; i < count; ++i)
+ buffer[i] = QRgba::fromRgba(0, 0, 0, src[index + i]);
+ return buffer;
+}
+
+static void QT_FASTCALL convertGrayscale8ToRGB32(uint *buffer, int count, const QList<QRgb> *)
+{
+ for (int i = 0; i < count; ++i) {
+ const uint s = buffer[i];
+ buffer[i] = qRgb(s, s, s);
+ }
+}
+
+static const uint *QT_FASTCALL fetchGrayscale8ToRGB32(uint *buffer, const uchar *src, int index, int count,
+ const QList<QRgb> *, QDitherInfo *)
+{
+ for (int i = 0; i < count; ++i) {
+ const uint s = src[index + i];
+ buffer[i] = qRgb(s, s, s);
+ }
+ return buffer;
+}
+
+template<typename QRgba>
+static const QRgba *QT_FASTCALL convertGrayscale8To(QRgba *buffer, const uint *src, int count,
+ const QList<QRgb> *, QDitherInfo *)
+{
+ for (int i = 0; i < count; ++i)
+ buffer[i] = QRgba::fromRgba(src[i], src[i], src[i], 255);
+ return buffer;
+}
+
+template<typename QRgba>
+static const QRgba *QT_FASTCALL fetchGrayscale8To(QRgba *buffer, const uchar *src, int index, int count,
+ const QList<QRgb> *, QDitherInfo *)
+{
+ for (int i = 0; i < count; ++i) {
+ const uint s = src[index + i];
+ buffer[i] = QRgba::fromRgba(s, s, s, 255);
+ }
+ return buffer;
+}
+
+static void QT_FASTCALL convertGrayscale16ToRGB32(uint *buffer, int count, const QList<QRgb> *)
+{
+ for (int i = 0; i < count; ++i) {
+ const uint x = qt_div_257(buffer[i]);
+ buffer[i] = qRgb(x, x, x);
+ }
+}
+static const uint *QT_FASTCALL fetchGrayscale16ToRGB32(uint *buffer, const uchar *src, int index, int count,
+ const QList<QRgb> *, QDitherInfo *)
+{
+ const unsigned short *s = reinterpret_cast<const unsigned short *>(src) + index;
+ for (int i = 0; i < count; ++i) {
+ const uint x = qt_div_257(s[i]);
+ buffer[i] = qRgb(x, x, x);
+ }
+ return buffer;
+}
+
+template<typename QRgba>
+static const QRgba *QT_FASTCALL convertGrayscale16To(QRgba *buffer, const uint *src, int count,
+ const QList<QRgb> *, QDitherInfo *)
+{
+ for (int i = 0; i < count; ++i)
+ buffer[i] = QRgba::fromRgba64(src[i], src[i], src[i], 65535);
+ return buffer;
+}
+
+template<typename QRgba>
+static const QRgba *QT_FASTCALL fetchGrayscale16To(QRgba *buffer, const uchar *src, int index, int count,
+ const QList<QRgb> *, QDitherInfo *)
+{
+ const unsigned short *s = reinterpret_cast<const unsigned short *>(src) + index;
+ for (int i = 0; i < count; ++i) {
+ buffer[i] = QRgba::fromRgba64(s[i], s[i], s[i], 65535);
+ }
+ return buffer;
+}
+
+static void QT_FASTCALL storeARGB32FromARGB32PM(uchar *dest, const uint *src, int index, int count,
+ const QList<QRgb> *, QDitherInfo *)
+{
+ uint *d = reinterpret_cast<uint *>(dest) + index;
+ UNALIASED_CONVERSION_LOOP(d, src, count, [](uint c) { return qUnpremultiply(c); });
+}
+
+static void QT_FASTCALL storeRGBA8888PMFromARGB32PM(uchar *dest, const uint *src, int index, int count,
+ const QList<QRgb> *, QDitherInfo *)
+{
+ uint *d = reinterpret_cast<uint *>(dest) + index;
+ UNALIASED_CONVERSION_LOOP(d, src, count, ARGB2RGBA);
+}
+
+#ifdef __SSE2__
+template<bool RGBA, bool maskAlpha>
+static inline void qConvertARGB32PMToRGBA64PM_sse2(QRgba64 *buffer, const uint *src, int count)
+{
+ if (count <= 0)
+ return;
+
+ const __m128i amask = _mm_set1_epi32(0xff000000);
+ int i = 0;
+ for (; ((uintptr_t)buffer & 0xf) && i < count; ++i) {
+ uint s = *src++;
+ if (maskAlpha)
+ s = s | 0xff000000;
+ if (RGBA)
+ s = RGBA2ARGB(s);
+ *buffer++ = QRgba64::fromArgb32(s);
+ }
+ for (; i < count-3; i += 4) {
+ __m128i vs = _mm_loadu_si128((const __m128i*)src);
+ if (maskAlpha)
+ vs = _mm_or_si128(vs, amask);
+ src += 4;
+ __m128i v1 = _mm_unpacklo_epi8(vs, vs);
+ __m128i v2 = _mm_unpackhi_epi8(vs, vs);
+ if (!RGBA) {
+ v1 = _mm_shufflelo_epi16(v1, _MM_SHUFFLE(3, 0, 1, 2));
+ v2 = _mm_shufflelo_epi16(v2, _MM_SHUFFLE(3, 0, 1, 2));
+ v1 = _mm_shufflehi_epi16(v1, _MM_SHUFFLE(3, 0, 1, 2));
+ v2 = _mm_shufflehi_epi16(v2, _MM_SHUFFLE(3, 0, 1, 2));
+ }
+ _mm_store_si128((__m128i*)(buffer), v1);
+ buffer += 2;
+ _mm_store_si128((__m128i*)(buffer), v2);
+ buffer += 2;
+ }
+
+ SIMD_EPILOGUE(i, count, 3) {
+ uint s = *src++;
+ if (maskAlpha)
+ s = s | 0xff000000;
+ if (RGBA)
+ s = RGBA2ARGB(s);
+ *buffer++ = QRgba64::fromArgb32(s);
+ }
+}
+
+template<QtPixelOrder PixelOrder>
+static inline void qConvertRGBA64PMToA2RGB30PM_sse2(uint *dest, const QRgba64 *buffer, int count)
+{
+ const __m128i gmask = _mm_set1_epi32(0x000ffc00);
+ const __m128i cmask = _mm_set1_epi32(0x000003ff);
+ int i = 0;
+ __m128i vr, vg, vb, va;
+ for (; i < count && uintptr_t(buffer) & 0xF; ++i) {
+ *dest++ = qConvertRgb64ToRgb30<PixelOrder>(*buffer++);
+ }
+
+ for (; i < count-15; i += 16) {
+ // Repremultiplying is really expensive and hard to do in SIMD without AVX2,
+ // so we try to avoid it by checking if it is needed 16 samples at a time.
+ __m128i vOr = _mm_set1_epi32(0);
+ __m128i vAnd = _mm_set1_epi32(0xffffffff);
+ for (int j = 0; j < 16; j += 2) {
+ __m128i vs = _mm_load_si128((const __m128i*)(buffer + j));
+ vOr = _mm_or_si128(vOr, vs);
+ vAnd = _mm_and_si128(vAnd, vs);
+ }
+ const quint16 orAlpha = ((uint)_mm_extract_epi16(vOr, 3)) | ((uint)_mm_extract_epi16(vOr, 7));
+ const quint16 andAlpha = ((uint)_mm_extract_epi16(vAnd, 3)) & ((uint)_mm_extract_epi16(vAnd, 7));
+
+ if (andAlpha == 0xffff) {
+ for (int j = 0; j < 16; j += 2) {
+ __m128i vs = _mm_load_si128((const __m128i*)buffer);
+ buffer += 2;
+ vr = _mm_srli_epi64(vs, 6);
+ vg = _mm_srli_epi64(vs, 16 + 6 - 10);
+ vb = _mm_srli_epi64(vs, 32 + 6);
+ vr = _mm_and_si128(vr, cmask);
+ vg = _mm_and_si128(vg, gmask);
+ vb = _mm_and_si128(vb, cmask);
+ va = _mm_srli_epi64(vs, 48 + 14);
+ if (PixelOrder == PixelOrderRGB)
+ vr = _mm_slli_epi32(vr, 20);
+ else
+ vb = _mm_slli_epi32(vb, 20);
+ va = _mm_slli_epi32(va, 30);
+ __m128i vd = _mm_or_si128(_mm_or_si128(vr, vg), _mm_or_si128(vb, va));
+ vd = _mm_shuffle_epi32(vd, _MM_SHUFFLE(3, 1, 2, 0));
+ _mm_storel_epi64((__m128i*)dest, vd);
+ dest += 2;
+ }
+ } else if (orAlpha == 0) {
+ for (int j = 0; j < 16; ++j) {
+ *dest++ = 0;
+ buffer++;
+ }
+ } else {
+ for (int j = 0; j < 16; ++j)
+ *dest++ = qConvertRgb64ToRgb30<PixelOrder>(*buffer++);
+ }
+ }
+
+ SIMD_EPILOGUE(i, count, 15)
+ *dest++ = qConvertRgb64ToRgb30<PixelOrder>(*buffer++);
+}
+#elif defined(__ARM_NEON__)
+template<bool RGBA, bool maskAlpha>
+static inline void qConvertARGB32PMToRGBA64PM_neon(QRgba64 *buffer, const uint *src, int count)
+{
+ if (count <= 0)
+ return;
+
+ const uint32x4_t amask = vdupq_n_u32(0xff000000);
+#if defined(Q_PROCESSOR_ARM_64)
+ const uint8x16_t rgbaMask = { 2, 1, 0, 3, 6, 5, 4, 7, 10, 9, 8, 11, 14, 13, 12, 15};
+#else
+ const uint8x8_t rgbaMask = { 2, 1, 0, 3, 6, 5, 4, 7 };
+#endif
+ int i = 0;
+ for (; i < count-3; i += 4) {
+ uint32x4_t vs32 = vld1q_u32(src);
+ src += 4;
+ if (maskAlpha)
+ vs32 = vorrq_u32(vs32, amask);
+ uint8x16_t vs8 = vreinterpretq_u8_u32(vs32);
+ if (!RGBA) {
+#if defined(Q_PROCESSOR_ARM_64)
+ vs8 = vqtbl1q_u8(vs8, rgbaMask);
+#else
+ // no vqtbl1q_u8
+ const uint8x8_t vlo = vtbl1_u8(vget_low_u8(vs8), rgbaMask);
+ const uint8x8_t vhi = vtbl1_u8(vget_high_u8(vs8), rgbaMask);
+ vs8 = vcombine_u8(vlo, vhi);
+#endif
+ }
+ uint8x16x2_t v = vzipq_u8(vs8, vs8);
+
+ vst1q_u16((uint16_t *)buffer, vreinterpretq_u16_u8(v.val[0]));
+ buffer += 2;
+ vst1q_u16((uint16_t *)buffer, vreinterpretq_u16_u8(v.val[1]));
+ buffer += 2;
+ }
+
+ SIMD_EPILOGUE(i, count, 3) {
+ uint s = *src++;
+ if (maskAlpha)
+ s = s | 0xff000000;
+ if (RGBA)
+ s = RGBA2ARGB(s);
+ *buffer++ = QRgba64::fromArgb32(s);
+ }
+}
+#endif
+
+static const QRgba64 *QT_FASTCALL convertRGB32ToRGB64(QRgba64 *buffer, const uint *src, int count,
+ const QList<QRgb> *, QDitherInfo *)
+{
+#ifdef __SSE2__
+ qConvertARGB32PMToRGBA64PM_sse2<false, true>(buffer, src, count);
+#elif defined(__ARM_NEON__)
+ qConvertARGB32PMToRGBA64PM_neon<false, true>(buffer, src, count);
+#else
+ for (int i = 0; i < count; ++i)
+ buffer[i] = QRgba64::fromArgb32(0xff000000 | src[i]);
+#endif
+ return buffer;
+}
+
+static const QRgba64 *QT_FASTCALL fetchRGB32ToRGB64(QRgba64 *buffer, const uchar *src, int index, int count,
+ const QList<QRgb> *, QDitherInfo *)
+{
+ return convertRGB32ToRGB64(buffer, reinterpret_cast<const uint *>(src) + index, count, nullptr, nullptr);
+}
+
+static const QRgba64 *QT_FASTCALL convertARGB32ToRGBA64PM(QRgba64 *buffer, const uint *src, int count,
+ const QList<QRgb> *, QDitherInfo *)
+{
+ for (int i = 0; i < count; ++i)
+ buffer[i] = QRgba64::fromArgb32(src[i]).premultiplied();
+ return buffer;
+}
+
+static const QRgba64 *QT_FASTCALL fetchARGB32ToRGBA64PM(QRgba64 *buffer, const uchar *src, int index, int count,
+ const QList<QRgb> *, QDitherInfo *)
+{
+ return convertARGB32ToRGBA64PM(buffer, reinterpret_cast<const uint *>(src) + index, count, nullptr, nullptr);
+}
+
+static const QRgba64 *QT_FASTCALL convertARGB32PMToRGBA64PM(QRgba64 *buffer, const uint *src, int count,
+ const QList<QRgb> *, QDitherInfo *)
+{
+#ifdef __SSE2__
+ qConvertARGB32PMToRGBA64PM_sse2<false, false>(buffer, src, count);
+#elif defined(__ARM_NEON__)
+ qConvertARGB32PMToRGBA64PM_neon<false, false>(buffer, src, count);
+#else
+ for (int i = 0; i < count; ++i)
+ buffer[i] = QRgba64::fromArgb32(src[i]);
+#endif
+ return buffer;
+}
+
+static const QRgba64 *QT_FASTCALL fetchARGB32PMToRGBA64PM(QRgba64 *buffer, const uchar *src, int index, int count,
+ const QList<QRgb> *, QDitherInfo *)
+{
+ return convertARGB32PMToRGBA64PM(buffer, reinterpret_cast<const uint *>(src) + index, count, nullptr, nullptr);
+}
+
+static const QRgba64 *QT_FASTCALL fetchRGBA64ToRGBA64PM(QRgba64 *buffer, const uchar *src, int index, int count,
+ const QList<QRgb> *, QDitherInfo *)
+{
+ const QRgba64 *s = reinterpret_cast<const QRgba64 *>(src) + index;
+#ifdef __SSE2__
+ for (int i = 0; i < count; ++i) {
+ const auto a = s[i].alpha();
+ __m128i vs = _mm_loadl_epi64((const __m128i *)(s + i));
+ __m128i va = _mm_shufflelo_epi16(vs, _MM_SHUFFLE(3, 3, 3, 3));
+ vs = multiplyAlpha65535(vs, va);
+ _mm_storel_epi64((__m128i *)(buffer + i), vs);
+ buffer[i].setAlpha(a);
+ }
+#else
+ for (int i = 0; i < count; ++i)
+ buffer[i] = QRgba64::fromRgba64(s[i]).premultiplied();
+#endif
+ return buffer;
+}
+
+static const QRgba64 *QT_FASTCALL convertRGBA8888ToRGBA64PM(QRgba64 *buffer, const uint *src, int count,
+ const QList<QRgb> *, QDitherInfo *)
+{
+ for (int i = 0; i < count; ++i)
+ buffer[i] = QRgba64::fromArgb32(RGBA2ARGB(src[i])).premultiplied();
+ return buffer;
+}
+
+static const QRgba64 *QT_FASTCALL fetchRGBA8888ToRGBA64PM(QRgba64 *buffer, const uchar *src, int index, int count,
+ const QList<QRgb> *, QDitherInfo *)
+{
+ return convertRGBA8888ToRGBA64PM(buffer, reinterpret_cast<const uint *>(src) + index, count, nullptr, nullptr);
+}
+
+static const QRgba64 *QT_FASTCALL convertRGBA8888PMToRGBA64PM(QRgba64 *buffer, const uint *src, int count,
+ const QList<QRgb> *, QDitherInfo *)
+{
+#ifdef __SSE2__
+ qConvertARGB32PMToRGBA64PM_sse2<true, false>(buffer, src, count);
+#elif defined(__ARM_NEON__)
+ qConvertARGB32PMToRGBA64PM_neon<true, false>(buffer, src, count);
+#else
+ for (int i = 0; i < count; ++i)
+ buffer[i] = QRgba64::fromArgb32(RGBA2ARGB(src[i]));
+#endif
+ return buffer;
+}
+
+static const QRgba64 *QT_FASTCALL fetchRGBA8888PMToRGBA64PM(QRgba64 *buffer, const uchar *src, int index, int count,
+ const QList<QRgb> *, QDitherInfo *)
+{
+ return convertRGBA8888PMToRGBA64PM(buffer, reinterpret_cast<const uint *>(src) + index, count, nullptr, nullptr);
+}
+
+static void QT_FASTCALL storeRGBA8888FromARGB32PM(uchar *dest, const uint *src, int index, int count,
+ const QList<QRgb> *, QDitherInfo *)
+{
+ uint *d = reinterpret_cast<uint *>(dest) + index;
+ UNALIASED_CONVERSION_LOOP(d, src, count, [](uint c) { return ARGB2RGBA(qUnpremultiply(c)); });
+}
+
+static void QT_FASTCALL storeRGBXFromRGB32(uchar *dest, const uint *src, int index, int count,
+ const QList<QRgb> *, QDitherInfo *)
+{
+ uint *d = reinterpret_cast<uint *>(dest) + index;
+ UNALIASED_CONVERSION_LOOP(d, src, count, [](uint c) { return ARGB2RGBA(0xff000000 | c); });
+}
+
+static void QT_FASTCALL storeRGBXFromARGB32PM(uchar *dest, const uint *src, int index, int count,
+ const QList<QRgb> *, QDitherInfo *)
+{
+ uint *d = reinterpret_cast<uint *>(dest) + index;
+ UNALIASED_CONVERSION_LOOP(d, src, count, [](uint c) { return ARGB2RGBA(0xff000000 | qUnpremultiply(c)); });
+}
+
+template<QtPixelOrder PixelOrder>
+static void QT_FASTCALL convertA2RGB30PMToARGB32PM(uint *buffer, int count, const QList<QRgb> *)
+{
+ for (int i = 0; i < count; ++i)
+ buffer[i] = qConvertA2rgb30ToArgb32<PixelOrder>(buffer[i]);
+}
+
+template<QtPixelOrder PixelOrder>
+static const uint *QT_FASTCALL fetchA2RGB30PMToARGB32PM(uint *buffer, const uchar *s, int index, int count,
+ const QList<QRgb> *, QDitherInfo *dither)
+{
+ const uint *src = reinterpret_cast<const uint *>(s) + index;
+ if (!dither) {
+ UNALIASED_CONVERSION_LOOP(buffer, src, count, qConvertA2rgb30ToArgb32<PixelOrder>);
+ } else {
+ for (int i = 0; i < count; ++i) {
+ const uint c = src[i];
+ short d10 = (qt_bayer_matrix[dither->y & 15][(dither->x + i) & 15] << 2);
+ short a10 = (c >> 30) * 0x155;
+ short r10 = ((c >> 20) & 0x3ff);
+ short g10 = ((c >> 10) & 0x3ff);
+ short b10 = (c & 0x3ff);
+ if (PixelOrder == PixelOrderBGR)
+ std::swap(r10, b10);
+ short a8 = (a10 + ((d10 - a10) >> 8)) >> 2;
+ short r8 = (r10 + ((d10 - r10) >> 8)) >> 2;
+ short g8 = (g10 + ((d10 - g10) >> 8)) >> 2;
+ short b8 = (b10 + ((d10 - b10) >> 8)) >> 2;
+ buffer[i] = qRgba(r8, g8, b8, a8);
+ }
+ }
+ return buffer;
+}
+
+#ifdef __SSE2__
+template<QtPixelOrder PixelOrder>
+static inline void qConvertA2RGB30PMToRGBA64PM_sse2(QRgba64 *buffer, const uint *src, int count)
+{
+ if (count <= 0)
+ return;
+
+ const __m128i rmask = _mm_set1_epi32(0x3ff00000);
+ const __m128i gmask = _mm_set1_epi32(0x000ffc00);
+ const __m128i bmask = _mm_set1_epi32(0x000003ff);
+ const __m128i afactor = _mm_set1_epi16(0x5555);
+ int i = 0;
+
+ for (; ((uintptr_t)buffer & 0xf) && i < count; ++i)
+ *buffer++ = qConvertA2rgb30ToRgb64<PixelOrder>(*src++);
+
+ for (; i < count-3; i += 4) {
+ __m128i vs = _mm_loadu_si128((const __m128i*)src);
+ src += 4;
+ __m128i va = _mm_srli_epi32(vs, 30);
+ __m128i vr = _mm_and_si128(vs, rmask);
+ __m128i vb = _mm_and_si128(vs, bmask);
+ __m128i vg = _mm_and_si128(vs, gmask);
+ va = _mm_mullo_epi16(va, afactor);
+ vr = _mm_or_si128(_mm_srli_epi32(vr, 14), _mm_srli_epi32(vr, 24));
+ vg = _mm_or_si128(_mm_srli_epi32(vg, 4), _mm_srli_epi32(vg, 14));
+ vb = _mm_or_si128(_mm_slli_epi32(vb, 6), _mm_srli_epi32(vb, 4));
+ __m128i vrb;
+ if (PixelOrder == PixelOrderRGB)
+ vrb = _mm_or_si128(vr, _mm_slli_si128(vb, 2));
+ else
+ vrb = _mm_or_si128(vb, _mm_slli_si128(vr, 2));
+ __m128i vga = _mm_or_si128(vg, _mm_slli_si128(va, 2));
+ _mm_store_si128((__m128i*)(buffer), _mm_unpacklo_epi16(vrb, vga));
+ buffer += 2;
+ _mm_store_si128((__m128i*)(buffer), _mm_unpackhi_epi16(vrb, vga));
+ buffer += 2;
+ }
+
+ SIMD_EPILOGUE(i, count, 3)
+ *buffer++ = qConvertA2rgb30ToRgb64<PixelOrder>(*src++);
+}
+#endif
+
+template<QtPixelOrder PixelOrder>
+static const QRgba64 *QT_FASTCALL convertA2RGB30PMToRGBA64PM(QRgba64 *buffer, const uint *src, int count,
+ const QList<QRgb> *, QDitherInfo *)
+{
+#ifdef __SSE2__
+ qConvertA2RGB30PMToRGBA64PM_sse2<PixelOrder>(buffer, src, count);
+#else
+ for (int i = 0; i < count; ++i)
+ buffer[i] = qConvertA2rgb30ToRgb64<PixelOrder>(src[i]);
+#endif
+ return buffer;
+}
+
+template<QtPixelOrder PixelOrder>
+static const QRgba64 *QT_FASTCALL fetchA2RGB30PMToRGBA64PM(QRgba64 *buffer, const uchar *src, int index, int count,
+ const QList<QRgb> *, QDitherInfo *)
+{
+ return convertA2RGB30PMToRGBA64PM<PixelOrder>(buffer, reinterpret_cast<const uint *>(src) + index, count, nullptr, nullptr);
+}
+
+template<enum QtPixelOrder> inline QRgbaFloat32 qConvertA2rgb30ToRgbaFP(uint rgb);
+
+template<>
+inline QRgbaFloat32 qConvertA2rgb30ToRgbaFP<PixelOrderBGR>(uint rgb)
+{
+ float alpha = (rgb >> 30) * (1.f/3.f);
+ float blue = ((rgb >> 20) & 0x3ff) * (1.f/1023.f);
+ float green = ((rgb >> 10) & 0x3ff) * (1.f/1023.f);
+ float red = (rgb & 0x3ff) * (1.f/1023.f);
+ return QRgbaFloat32{ red, green, blue, alpha };
+}
+
+template<>
+inline QRgbaFloat32 qConvertA2rgb30ToRgbaFP<PixelOrderRGB>(uint rgb)
+{
+ float alpha = (rgb >> 30) * (1.f/3.f);
+ float red = ((rgb >> 20) & 0x3ff) * (1.f/1023.f);
+ float green = ((rgb >> 10) & 0x3ff) * (1.f/1023.f);
+ float blue = (rgb & 0x3ff) * (1.f/1023.f);
+ return QRgbaFloat32{ red, green, blue, alpha };
+}
+
+template<QtPixelOrder PixelOrder>
+static const QRgbaFloat32 *QT_FASTCALL convertA2RGB30PMToRGBA32F(QRgbaFloat32 *buffer, const uint *src, int count,
+ const QList<QRgb> *, QDitherInfo *)
+{
+ for (int i = 0; i < count; ++i)
+ buffer[i] = qConvertA2rgb30ToRgbaFP<PixelOrder>(src[i]);
+ return buffer;
+}
+
+template<QtPixelOrder PixelOrder>
+static const QRgbaFloat32 *QT_FASTCALL fetchRGB30ToRGBA32F(QRgbaFloat32 *buffer, const uchar *src, int index, int count,
+ const QList<QRgb> *, QDitherInfo *)
+{
+ return convertA2RGB30PMToRGBA32F<PixelOrder>(buffer, reinterpret_cast<const uint *>(src) + index, count, nullptr, nullptr);
+}
+
+template<QtPixelOrder PixelOrder>
+static void QT_FASTCALL storeA2RGB30PMFromARGB32PM(uchar *dest, const uint *src, int index, int count,
+ const QList<QRgb> *, QDitherInfo *)
+{
+ uint *d = reinterpret_cast<uint *>(dest) + index;
+ UNALIASED_CONVERSION_LOOP(d, src, count, qConvertArgb32ToA2rgb30<PixelOrder>);
+}
+
+template<QtPixelOrder PixelOrder>
+static void QT_FASTCALL storeRGB30FromRGB32(uchar *dest, const uint *src, int index, int count,
+ const QList<QRgb> *, QDitherInfo *)
+{
+ uint *d = reinterpret_cast<uint *>(dest) + index;
+ UNALIASED_CONVERSION_LOOP(d, src, count, qConvertRgb32ToRgb30<PixelOrder>);
+}
+
+template<QtPixelOrder PixelOrder>
+static void QT_FASTCALL storeRGB30FromARGB32PM(uchar *dest, const uint *src, int index, int count,
+ const QList<QRgb> *, QDitherInfo *)
+{
+ uint *d = reinterpret_cast<uint *>(dest) + index;
+ UNALIASED_CONVERSION_LOOP(d, src, count, qConvertRgb32ToRgb30<PixelOrder>);
+}
+
+template<bool RGBA>
+void qt_convertRGBA64ToARGB32(uint *dst, const QRgba64 *src, int count)
+{
+ int i = 0;
+#ifdef __SSE2__
+ if (((uintptr_t)dst & 0x7) && count > 0) {
+ uint s = (*src++).toArgb32();
+ if (RGBA)
+ s = ARGB2RGBA(s);
+ *dst++ = s;
+ i++;
+ }
+ const __m128i vhalf = _mm_set1_epi32(0x80);
+ const __m128i vzero = _mm_setzero_si128();
+ for (; i < count-1; i += 2) {
+ __m128i vs = _mm_loadu_si128((const __m128i*)src);
+ src += 2;
+ if (!RGBA) {
+ vs = _mm_shufflelo_epi16(vs, _MM_SHUFFLE(3, 0, 1, 2));
+ vs = _mm_shufflehi_epi16(vs, _MM_SHUFFLE(3, 0, 1, 2));
+ }
+ __m128i v1 = _mm_unpacklo_epi16(vs, vzero);
+ __m128i v2 = _mm_unpackhi_epi16(vs, vzero);
+ v1 = _mm_add_epi32(v1, vhalf);
+ v2 = _mm_add_epi32(v2, vhalf);
+ v1 = _mm_sub_epi32(v1, _mm_srli_epi32(v1, 8));
+ v2 = _mm_sub_epi32(v2, _mm_srli_epi32(v2, 8));
+ v1 = _mm_srli_epi32(v1, 8);
+ v2 = _mm_srli_epi32(v2, 8);
+ v1 = _mm_packs_epi32(v1, v2);
+ v1 = _mm_packus_epi16(v1, vzero);
+ _mm_storel_epi64((__m128i*)(dst), v1);
+ dst += 2;
+ }
+#endif
+ for (; i < count; i++) {
+ uint s = (*src++).toArgb32();
+ if (RGBA)
+ s = ARGB2RGBA(s);
+ *dst++ = s;
+ }
+}
+template void qt_convertRGBA64ToARGB32<false>(uint *dst, const QRgba64 *src, int count);
+template void qt_convertRGBA64ToARGB32<true>(uint *dst, const QRgba64 *src, int count);
+
+
+static void QT_FASTCALL storeAlpha8FromARGB32PM(uchar *dest, const uint *src, int index, int count,
+ const QList<QRgb> *, QDitherInfo *)
+{
+ for (int i = 0; i < count; ++i)
+ dest[index + i] = qAlpha(src[i]);
+}
+
+static void QT_FASTCALL storeGrayscale8FromRGB32(uchar *dest, const uint *src, int index, int count,
+ const QList<QRgb> *, QDitherInfo *)
+{
+ for (int i = 0; i < count; ++i)
+ dest[index + i] = qGray(src[i]);
+}
+
+static void QT_FASTCALL storeGrayscale8FromARGB32PM(uchar *dest, const uint *src, int index, int count,
+ const QList<QRgb> *, QDitherInfo *)
+{
+ for (int i = 0; i < count; ++i)
+ dest[index + i] = qGray(qUnpremultiply(src[i]));
+}
+
+static void QT_FASTCALL storeGrayscale16FromRGB32(uchar *dest, const uint *src, int index, int count,
+ const QList<QRgb> *, QDitherInfo *)
+{
+ unsigned short *d = reinterpret_cast<unsigned short *>(dest) + index;
+ for (int i = 0; i < count; ++i)
+ d[i] = qGray(src[i]) * 257;
+}
+
+static void QT_FASTCALL storeGrayscale16FromARGB32PM(uchar *dest, const uint *src, int index, int count,
+ const QList<QRgb> *, QDitherInfo *)
+{
+ unsigned short *d = reinterpret_cast<unsigned short *>(dest) + index;
+ for (int i = 0; i < count; ++i)
+ d[i] = qGray(qUnpremultiply(src[i])) * 257;
+}
+
+static const uint *QT_FASTCALL fetchRGB64ToRGB32(uint *buffer, const uchar *src, int index, int count,
+ const QList<QRgb> *, QDitherInfo *)
+{
+ const QRgba64 *s = reinterpret_cast<const QRgba64 *>(src) + index;
+ for (int i = 0; i < count; ++i)
+ buffer[i] = toArgb32(s[i]);
+ return buffer;
+}
+
+static void QT_FASTCALL storeRGB64FromRGB32(uchar *dest, const uint *src, int index, int count,
+ const QList<QRgb> *, QDitherInfo *)
+{
+ QRgba64 *d = reinterpret_cast<QRgba64 *>(dest) + index;
+ for (int i = 0; i < count; ++i)
+ d[i] = QRgba64::fromArgb32(src[i] | 0xff000000);
+}
+
+static const uint *QT_FASTCALL fetchRGBA64ToARGB32PM(uint *buffer, const uchar *src, int index, int count,
+ const QList<QRgb> *, QDitherInfo *)
+{
+ const QRgba64 *s = reinterpret_cast<const QRgba64 *>(src) + index;
+ for (int i = 0; i < count; ++i)
+ buffer[i] = toArgb32(s[i].premultiplied());
+ return buffer;
+}
+
+template<bool Mask>
+static void QT_FASTCALL storeRGBA64FromARGB32PM(uchar *dest, const uint *src, int index, int count,
+ const QList<QRgb> *, QDitherInfo *)
+{
+ QRgba64 *d = reinterpret_cast<QRgba64 *>(dest) + index;
+ for (int i = 0; i < count; ++i) {
+ d[i] = QRgba64::fromArgb32(src[i]).unpremultiplied();
+ if (Mask)
+ d[i].setAlpha(65535);
+ }
+}
+
+static void QT_FASTCALL storeRGBA64FromARGB32(uchar *dest, const uint *src, int index, int count,
+ const QList<QRgb> *, QDitherInfo *)
+{
+ QRgba64 *d = reinterpret_cast<QRgba64 *>(dest) + index;
+ for (int i = 0; i < count; ++i)
+ d[i] = QRgba64::fromArgb32(src[i]);
+}
+
+static const uint *QT_FASTCALL fetchRGB16FToRGB32(uint *buffer, const uchar *src, int index, int count,
+ const QList<QRgb> *, QDitherInfo *)
+{
+ const QRgbaFloat16 *s = reinterpret_cast<const QRgbaFloat16 *>(src) + index;
+ for (int i = 0; i < count; ++i)
+ buffer[i] = s[i].toArgb32();
+ return buffer;
+}
+
+static void QT_FASTCALL storeRGB16FFromRGB32(uchar *dest, const uint *src, int index, int count,
+ const QList<QRgb> *, QDitherInfo *)
+{
+ QRgbaFloat16 *d = reinterpret_cast<QRgbaFloat16 *>(dest) + index;
+ for (int i = 0; i < count; ++i)
+ d[i] = QRgbaFloat16::fromArgb32(src[i]);
+}
+
+static const uint *QT_FASTCALL fetchRGBA16FToARGB32PM(uint *buffer, const uchar *src, int index, int count,
+ const QList<QRgb> *, QDitherInfo *)
+{
+ const QRgbaFloat16 *s = reinterpret_cast<const QRgbaFloat16 *>(src) + index;
+ for (int i = 0; i < count; ++i)
+ buffer[i] = s[i].premultiplied().toArgb32();
+ return buffer;
+}
+
+static const QRgba64 *QT_FASTCALL fetchRGBA16FToRGBA64PM(QRgba64 *buffer, const uchar *src, int index, int count,
+ const QList<QRgb> *, QDitherInfo *)
+{
+ const QRgbaFloat16 *s = reinterpret_cast<const QRgbaFloat16 *>(src) + index;
+ for (int i = 0; i < count; ++i) {
+ QRgbaFloat16 c = s[i].premultiplied();
+ buffer[i] = QRgba64::fromRgba64(c.red16(), c.green16(), c.blue16(), c.alpha16());
+ }
+ return buffer;
+}
+
+static void QT_FASTCALL storeRGBA16FFromARGB32PM(uchar *dest, const uint *src, int index, int count,
+ const QList<QRgb> *, QDitherInfo *)
+{
+ QRgbaFloat16 *d = reinterpret_cast<QRgbaFloat16 *>(dest) + index;
+ for (int i = 0; i < count; ++i)
+ d[i] = QRgbaFloat16::fromArgb32(src[i]).unpremultiplied();
+}
+
+static const QRgba64 *QT_FASTCALL fetchRGBA16FPMToRGBA64PM(QRgba64 *buffer, const uchar *src, int index, int count,
+ const QList<QRgb> *, QDitherInfo *)
+{
+ const QRgbaFloat16 *s = reinterpret_cast<const QRgbaFloat16 *>(src) + index;
+ for (int i = 0; i < count; ++i) {
+ QRgbaFloat16 c = s[i];
+ buffer[i] = QRgba64::fromRgba64(c.red16(), c.green16(), c.blue16(), c.alpha16());
+ }
+ return buffer;
+}
+
+static const uint *QT_FASTCALL fetchRGB32FToRGB32(uint *buffer, const uchar *src, int index, int count,
+ const QList<QRgb> *, QDitherInfo *)
+{
+ const QRgbaFloat32 *s = reinterpret_cast<const QRgbaFloat32 *>(src) + index;
+ for (int i = 0; i < count; ++i)
+ buffer[i] = s[i].toArgb32();
+ return buffer;
+}
+
+static void QT_FASTCALL storeRGB32FFromRGB32(uchar *dest, const uint *src, int index, int count,
+ const QList<QRgb> *, QDitherInfo *)
+{
+ QRgbaFloat32 *d = reinterpret_cast<QRgbaFloat32 *>(dest) + index;
+ for (int i = 0; i < count; ++i)
+ d[i] = QRgbaFloat32::fromArgb32(src[i]);
+}
+
+static const uint *QT_FASTCALL fetchRGBA32FToARGB32PM(uint *buffer, const uchar *src, int index, int count,
+ const QList<QRgb> *, QDitherInfo *)
+{
+ const QRgbaFloat32 *s = reinterpret_cast<const QRgbaFloat32 *>(src) + index;
+ for (int i = 0; i < count; ++i)
+ buffer[i] = s[i].premultiplied().toArgb32();
+ return buffer;
+}
+
+static const QRgba64 *QT_FASTCALL fetchRGBA32FToRGBA64PM(QRgba64 *buffer, const uchar *src, int index, int count,
+ const QList<QRgb> *, QDitherInfo *)
+{
+ const QRgbaFloat32 *s = reinterpret_cast<const QRgbaFloat32 *>(src) + index;
+ for (int i = 0; i < count; ++i) {
+ QRgbaFloat32 c = s[i].premultiplied();
+ buffer[i] = QRgba64::fromRgba64(c.red16(), c.green16(), c.blue16(), c.alpha16());
+ }
+ return buffer;
+}
+
+static void QT_FASTCALL storeRGBA32FFromARGB32PM(uchar *dest, const uint *src, int index, int count,
+ const QList<QRgb> *, QDitherInfo *)
+{
+ QRgbaFloat32 *d = reinterpret_cast<QRgbaFloat32 *>(dest) + index;
+ for (int i = 0; i < count; ++i)
+ d[i] = QRgbaFloat32::fromArgb32(src[i]).unpremultiplied();
+}
+
+static const QRgba64 *QT_FASTCALL fetchRGBA32FPMToRGBA64PM(QRgba64 *buffer, const uchar *src, int index, int count,
+ const QList<QRgb> *, QDitherInfo *)
+{
+ const QRgbaFloat32 *s = reinterpret_cast<const QRgbaFloat32 *>(src) + index;
+ for (int i = 0; i < count; ++i) {
+ QRgbaFloat32 c = s[i];
+ buffer[i] = QRgba64::fromRgba64(c.red16(), c.green16(), c.blue16(), c.alpha16());
+ }
+ return buffer;
+}
+
+inline const uint *qt_convertCMYK8888ToARGB32PM(uint *buffer, const uint *src, int count)
+{
+ UNALIASED_CONVERSION_LOOP(buffer, src, count, [](uint s) {
+ const QColor color = QCmyk32::fromCmyk32(s).toColor();
+ return color.rgba();
+ });
+ return buffer;
+}
+
+static void QT_FASTCALL convertCMYK8888ToARGB32PM(uint *buffer, int count, const QList<QRgb> *)
+{
+ qt_convertCMYK8888ToARGB32PM(buffer, buffer, count);
+}
+
+static const QRgba64 *QT_FASTCALL convertCMYK8888ToToRGBA64PM(QRgba64 *buffer, const uint *src, int count,
+ const QList<QRgb> *, QDitherInfo *)
+{
+ for (int i = 0; i < count; ++i)
+ buffer[i] = QCmyk32::fromCmyk32(src[i]).toColor().rgba64();
+ return buffer;
+}
+
+static const uint *QT_FASTCALL fetchCMYK8888ToARGB32PM(uint *buffer, const uchar *src, int index, int count,
+ const QList<QRgb> *, QDitherInfo *)
+{
+ const uint *s = reinterpret_cast<const uint *>(src) + index;
+ for (int i = 0; i < count; ++i)
+ buffer[i] = QCmyk32::fromCmyk32(s[i]).toColor().rgba();
+ return buffer;
+}
+
+static const QRgba64 *QT_FASTCALL fetchCMYK8888ToRGBA64PM(QRgba64 *buffer, const uchar *src, int index, int count,
+ const QList<QRgb> *, QDitherInfo *)
+{
+ const uint *s = reinterpret_cast<const uint *>(src) + index;
+ for (int i = 0; i < count; ++i)
+ buffer[i] = QCmyk32::fromCmyk32(s[i]).toColor().rgba64();
+ return buffer;
+}
+
+static void QT_FASTCALL storeCMYK8888FromARGB32PM(uchar *dest, const uint *src, int index, int count,
+ const QList<QRgb> *, QDitherInfo *)
+{
+ uint *d = reinterpret_cast<uint *>(dest) + index;
+ for (int i = 0; i < count; ++i) {
+ QColor c = qUnpremultiply(src[i]);
+ d[i] = QCmyk32::fromColor(c).toUint();
+ }
+}
+
+static void QT_FASTCALL storeCMYK8888FromRGB32(uchar *dest, const uint *src, int index, int count,
+ const QList<QRgb> *, QDitherInfo *)
+{
+ uint *d = reinterpret_cast<uint *>(dest) + index;
+ for (int i = 0; i < count; ++i) {
+ QColor c = src[i];
+ d[i] = QCmyk32::fromColor(c).toUint();
+ }
+}
+
+// Note:
+// convertToArgb32() assumes that no color channel is less than 4 bits.
+// storeRGBFromARGB32PM() assumes that no color channel is more than 8 bits.
+// QImage::rgbSwapped() assumes that the red and blue color channels have the same number of bits.
+QPixelLayout qPixelLayouts[] = {
+ { false, false, QPixelLayout::BPPNone, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr }, // Format_Invalid
+ { false, false, QPixelLayout::BPP1MSB, nullptr,
+ convertIndexedToARGB32PM, convertIndexedTo<QRgba64>,
+ fetchIndexedToARGB32PM<QPixelLayout::BPP1MSB>, fetchIndexedToRGBA64PM<QPixelLayout::BPP1MSB>,
+ nullptr, nullptr }, // Format_Mono
+ { false, false, QPixelLayout::BPP1LSB, nullptr,
+ convertIndexedToARGB32PM, convertIndexedTo<QRgba64>,
+ fetchIndexedToARGB32PM<QPixelLayout::BPP1LSB>, fetchIndexedToRGBA64PM<QPixelLayout::BPP1LSB>,
+ nullptr, nullptr }, // Format_MonoLSB
+ { false, false, QPixelLayout::BPP8, nullptr,
+ convertIndexedToARGB32PM, convertIndexedTo<QRgba64>,
+ fetchIndexedToARGB32PM<QPixelLayout::BPP8>, fetchIndexedToRGBA64PM<QPixelLayout::BPP8>,
+ nullptr, nullptr }, // Format_Indexed8
+ // Technically using convertPassThrough to convert from ARGB32PM to RGB32 is wrong,
+ // but everywhere this generic conversion would be wrong is currently overloaded.
+ { false, false, QPixelLayout::BPP32, rbSwap_rgb32, convertPassThrough,
+ convertRGB32ToRGB64, fetchPassThrough, fetchRGB32ToRGB64, storePassThrough, storePassThrough }, // Format_RGB32
+ { true, false, QPixelLayout::BPP32, rbSwap_rgb32, convertARGB32ToARGB32PM,
+ convertARGB32ToRGBA64PM, fetchARGB32ToARGB32PM, fetchARGB32ToRGBA64PM, storeARGB32FromARGB32PM, storePassThrough }, // Format_ARGB32
+ { true, true, QPixelLayout::BPP32, rbSwap_rgb32, convertPassThrough,
+ convertARGB32PMToRGBA64PM, fetchPassThrough, fetchARGB32PMToRGBA64PM, storePassThrough, storePassThrough }, // Format_ARGB32_Premultiplied
+ pixelLayoutRGB<QImage::Format_RGB16>(),
+ pixelLayoutARGBPM<QImage::Format_ARGB8565_Premultiplied>(),
+ pixelLayoutRGB<QImage::Format_RGB666>(),
+ pixelLayoutARGBPM<QImage::Format_ARGB6666_Premultiplied>(),
+ pixelLayoutRGB<QImage::Format_RGB555>(),
+ pixelLayoutARGBPM<QImage::Format_ARGB8555_Premultiplied>(),
+ pixelLayoutRGB<QImage::Format_RGB888>(),
+ pixelLayoutRGB<QImage::Format_RGB444>(),
+ pixelLayoutARGBPM<QImage::Format_ARGB4444_Premultiplied>(),
+ { false, false, QPixelLayout::BPP32, rbSwap<QImage::Format_RGBA8888>, convertRGBA8888PMToARGB32PM,
+ convertRGBA8888PMToRGBA64PM, fetchRGBA8888PMToARGB32PM, fetchRGBA8888PMToRGBA64PM, storeRGBXFromARGB32PM, storeRGBXFromRGB32 }, // Format_RGBX8888
+ { true, false, QPixelLayout::BPP32, rbSwap<QImage::Format_RGBA8888>, convertRGBA8888ToARGB32PM,
+ convertRGBA8888ToRGBA64PM, fetchRGBA8888ToARGB32PM, fetchRGBA8888ToRGBA64PM, storeRGBA8888FromARGB32PM, storeRGBXFromRGB32 }, // Format_RGBA8888
+ { true, true, QPixelLayout::BPP32, rbSwap<QImage::Format_RGBA8888>, convertRGBA8888PMToARGB32PM,
+ convertRGBA8888PMToRGBA64PM, fetchRGBA8888PMToARGB32PM, fetchRGBA8888PMToRGBA64PM, storeRGBA8888PMFromARGB32PM, storeRGBXFromRGB32 }, // Format_RGBA8888_Premultiplied
+ { false, false, QPixelLayout::BPP32, rbSwap_rgb30,
+ convertA2RGB30PMToARGB32PM<PixelOrderBGR>,
+ convertA2RGB30PMToRGBA64PM<PixelOrderBGR>,
+ fetchA2RGB30PMToARGB32PM<PixelOrderBGR>,
+ fetchA2RGB30PMToRGBA64PM<PixelOrderBGR>,
+ storeRGB30FromARGB32PM<PixelOrderBGR>,
+ storeRGB30FromRGB32<PixelOrderBGR>
+ }, // Format_BGR30
+ { true, true, QPixelLayout::BPP32, rbSwap_rgb30,
+ convertA2RGB30PMToARGB32PM<PixelOrderBGR>,
+ convertA2RGB30PMToRGBA64PM<PixelOrderBGR>,
+ fetchA2RGB30PMToARGB32PM<PixelOrderBGR>,
+ fetchA2RGB30PMToRGBA64PM<PixelOrderBGR>,
+ storeA2RGB30PMFromARGB32PM<PixelOrderBGR>,
+ storeRGB30FromRGB32<PixelOrderBGR>
+ }, // Format_A2BGR30_Premultiplied
+ { false, false, QPixelLayout::BPP32, rbSwap_rgb30,
+ convertA2RGB30PMToARGB32PM<PixelOrderRGB>,
+ convertA2RGB30PMToRGBA64PM<PixelOrderRGB>,
+ fetchA2RGB30PMToARGB32PM<PixelOrderRGB>,
+ fetchA2RGB30PMToRGBA64PM<PixelOrderRGB>,
+ storeRGB30FromARGB32PM<PixelOrderRGB>,
+ storeRGB30FromRGB32<PixelOrderRGB>
+ }, // Format_RGB30
+ { true, true, QPixelLayout::BPP32, rbSwap_rgb30,
+ convertA2RGB30PMToARGB32PM<PixelOrderRGB>,
+ convertA2RGB30PMToRGBA64PM<PixelOrderRGB>,
+ fetchA2RGB30PMToARGB32PM<PixelOrderRGB>,
+ fetchA2RGB30PMToRGBA64PM<PixelOrderRGB>,
+ storeA2RGB30PMFromARGB32PM<PixelOrderRGB>,
+ storeRGB30FromRGB32<PixelOrderRGB>
+ }, // Format_A2RGB30_Premultiplied
+ { true, true, QPixelLayout::BPP8, nullptr,
+ convertAlpha8ToRGB32, convertAlpha8To<QRgba64>,
+ fetchAlpha8ToRGB32, fetchAlpha8To<QRgba64>,
+ storeAlpha8FromARGB32PM, nullptr }, // Format_Alpha8
+ { false, false, QPixelLayout::BPP8, nullptr,
+ convertGrayscale8ToRGB32, convertGrayscale8To<QRgba64>,
+ fetchGrayscale8ToRGB32, fetchGrayscale8To<QRgba64>,
+ storeGrayscale8FromARGB32PM, storeGrayscale8FromRGB32 }, // Format_Grayscale8
+ { false, false, QPixelLayout::BPP64, rbSwap_4x16,
+ convertPassThrough, nullptr,
+ fetchRGB64ToRGB32, fetchPassThrough64,
+ storeRGBA64FromARGB32PM<true>, storeRGB64FromRGB32 }, // Format_RGBX64
+ { true, false, QPixelLayout::BPP64, rbSwap_4x16,
+ convertARGB32ToARGB32PM, nullptr,
+ fetchRGBA64ToARGB32PM, fetchRGBA64ToRGBA64PM,
+ storeRGBA64FromARGB32PM<false>, storeRGB64FromRGB32 }, // Format_RGBA64
+ { true, true, QPixelLayout::BPP64, rbSwap_4x16,
+ convertPassThrough, nullptr,
+ fetchRGB64ToRGB32, fetchPassThrough64,
+ storeRGBA64FromARGB32, storeRGB64FromRGB32 }, // Format_RGBA64_Premultiplied
+ { false, false, QPixelLayout::BPP16, nullptr,
+ convertGrayscale16ToRGB32, convertGrayscale16To<QRgba64>,
+ fetchGrayscale16ToRGB32, fetchGrayscale16To<QRgba64>,
+ storeGrayscale16FromARGB32PM, storeGrayscale16FromRGB32 }, // Format_Grayscale16
+ pixelLayoutRGB<QImage::Format_BGR888>(),
+ { false, false, QPixelLayout::BPP16FPx4, rbSwap_4x16,
+ convertPassThrough, nullptr,
+ fetchRGB16FToRGB32, fetchRGBA16FPMToRGBA64PM,
+ storeRGB16FFromRGB32, storeRGB16FFromRGB32 }, // Format_RGBX16FPx4
+ { true, false, QPixelLayout::BPP16FPx4, rbSwap_4x16,
+ convertARGB32ToARGB32PM, nullptr,
+ fetchRGBA16FToARGB32PM, fetchRGBA16FToRGBA64PM,
+ storeRGBA16FFromARGB32PM, storeRGB16FFromRGB32 }, // Format_RGBA16FPx4
+ { true, true, QPixelLayout::BPP16FPx4, rbSwap_4x16,
+ convertPassThrough, nullptr,
+ fetchRGB16FToRGB32, fetchRGBA16FPMToRGBA64PM,
+ storeRGB16FFromRGB32, storeRGB16FFromRGB32 }, // Format_RGBA16FPx4_Premultiplied
+ { false, false, QPixelLayout::BPP32FPx4, rbSwap_4x32,
+ convertPassThrough, nullptr,
+ fetchRGB32FToRGB32, fetchRGBA32FPMToRGBA64PM,
+ storeRGB32FFromRGB32, storeRGB32FFromRGB32 }, // Format_RGBX32FPx4
+ { true, false, QPixelLayout::BPP32FPx4, rbSwap_4x32,
+ convertARGB32ToARGB32PM, nullptr,
+ fetchRGBA32FToARGB32PM, fetchRGBA32FToRGBA64PM,
+ storeRGBA32FFromARGB32PM, storeRGB32FFromRGB32 }, // Format_RGBA32FPx4
+ { true, true, QPixelLayout::BPP32FPx4, rbSwap_4x32,
+ convertPassThrough, nullptr,
+ fetchRGB32FToRGB32, fetchRGBA32FPMToRGBA64PM,
+ storeRGB32FFromRGB32, storeRGB32FFromRGB32 }, // Format_RGBA32FPx4_Premultiplied
+ { false, false, QPixelLayout::BPP32, nullptr,
+ convertCMYK8888ToARGB32PM, convertCMYK8888ToToRGBA64PM,
+ fetchCMYK8888ToARGB32PM, fetchCMYK8888ToRGBA64PM,
+ storeCMYK8888FromARGB32PM, storeCMYK8888FromRGB32 }, // Format_CMYK8888
+};
+
+static_assert(std::size(qPixelLayouts) == QImage::NImageFormats);
+
+static void QT_FASTCALL convertFromRgb64(uint *dest, const QRgba64 *src, int length)
+{
+ for (int i = 0; i < length; ++i) {
+ dest[i] = toArgb32(src[i]);
+ }
+}
+
+template<QImage::Format format>
+static void QT_FASTCALL storeGenericFromRGBA64PM(uchar *dest, const QRgba64 *src, int index, int count,
+ const QList<QRgb> *clut, QDitherInfo *dither)
+{
+ uint buffer[BufferSize];
+ convertFromRgb64(buffer, src, count);
+ qPixelLayouts[format].storeFromARGB32PM(dest, buffer, index, count, clut, dither);
+}
+
+static void QT_FASTCALL storeARGB32FromRGBA64PM(uchar *dest, const QRgba64 *src, int index, int count,
+ const QList<QRgb> *, QDitherInfo *)
+{
+ uint *d = (uint*)dest + index;
+ for (int i = 0; i < count; ++i)
+ d[i] = toArgb32(src[i].unpremultiplied());
+}
+
+static void QT_FASTCALL storeRGBA8888FromRGBA64PM(uchar *dest, const QRgba64 *src, int index, int count,
+ const QList<QRgb> *, QDitherInfo *)
+{
+ uint *d = (uint*)dest + index;
+ for (int i = 0; i < count; ++i)
+ d[i] = toRgba8888(src[i].unpremultiplied());
+}
+
+template<QtPixelOrder PixelOrder>
+static void QT_FASTCALL storeRGB30FromRGBA64PM(uchar *dest, const QRgba64 *src, int index, int count,
+ const QList<QRgb> *, QDitherInfo *)
+{
+ uint *d = (uint*)dest + index;
+#ifdef __SSE2__
+ qConvertRGBA64PMToA2RGB30PM_sse2<PixelOrder>(d, src, count);
+#else
+ for (int i = 0; i < count; ++i)
+ d[i] = qConvertRgb64ToRgb30<PixelOrder>(src[i]);
+#endif
+}
+
+static void QT_FASTCALL storeRGBX64FromRGBA64PM(uchar *dest, const QRgba64 *src, int index, int count,
+ const QList<QRgb> *, QDitherInfo *)
+{
+ QRgba64 *d = reinterpret_cast<QRgba64*>(dest) + index;
+ for (int i = 0; i < count; ++i) {
+ d[i] = src[i].unpremultiplied();
+ d[i].setAlpha(65535);
+ }
+}
+
+static void QT_FASTCALL storeRGBA64FromRGBA64PM(uchar *dest, const QRgba64 *src, int index, int count,
+ const QList<QRgb> *, QDitherInfo *)
+{
+ QRgba64 *d = reinterpret_cast<QRgba64*>(dest) + index;
+ for (int i = 0; i < count; ++i)
+ d[i] = src[i].unpremultiplied();
+}
+
+static void QT_FASTCALL storeRGBA64PMFromRGBA64PM(uchar *dest, const QRgba64 *src, int index, int count,
+ const QList<QRgb> *, QDitherInfo *)
+{
+ QRgba64 *d = reinterpret_cast<QRgba64*>(dest) + index;
+ if (d != src)
+ memcpy(d, src, count * sizeof(QRgba64));
+}
+
+static void QT_FASTCALL storeGray16FromRGBA64PM(uchar *dest, const QRgba64 *src, int index, int count,
+ const QList<QRgb> *, QDitherInfo *)
+{
+ quint16 *d = reinterpret_cast<quint16*>(dest) + index;
+ for (int i = 0; i < count; ++i) {
+ QRgba64 s = src[i].unpremultiplied();
+ d[i] = qGray(s.red(), s.green(), s.blue());
+ }
+}
+
+static void QT_FASTCALL storeRGBX16FFromRGBA64PM(uchar *dest, const QRgba64 *src, int index, int count,
+ const QList<QRgb> *, QDitherInfo *)
+{
+ QRgbaFloat16 *d = reinterpret_cast<QRgbaFloat16 *>(dest) + index;
+ for (int i = 0; i < count; ++i) {
+ d[i] = qConvertRgb64ToRgbaF16(src[i]).unpremultiplied();
+ d[i].setAlpha(1.0);
+ }
+}
+
+static void QT_FASTCALL storeRGBA16FFromRGBA64PM(uchar *dest, const QRgba64 *src, int index, int count,
+ const QList<QRgb> *, QDitherInfo *)
+{
+ QRgbaFloat16 *d = reinterpret_cast<QRgbaFloat16 *>(dest) + index;
+ for (int i = 0; i < count; ++i)
+ d[i] = qConvertRgb64ToRgbaF16(src[i]).unpremultiplied();
+}
+
+static void QT_FASTCALL storeRGBA16FPMFromRGBA64PM(uchar *dest, const QRgba64 *src, int index, int count,
+ const QList<QRgb> *, QDitherInfo *)
+{
+ QRgbaFloat16 *d = reinterpret_cast<QRgbaFloat16 *>(dest) + index;
+ for (int i = 0; i < count; ++i)
+ d[i] = qConvertRgb64ToRgbaF16(src[i]);
+}
+
+static void QT_FASTCALL storeRGBX32FFromRGBA64PM(uchar *dest, const QRgba64 *src, int index, int count,
+ const QList<QRgb> *, QDitherInfo *)
+{
+ QRgbaFloat32 *d = reinterpret_cast<QRgbaFloat32 *>(dest) + index;
+ for (int i = 0; i < count; ++i) {
+ d[i] = qConvertRgb64ToRgbaF32(src[i]).unpremultiplied();
+ d[i].setAlpha(1.0);
+ }
+}
+
+static void QT_FASTCALL storeRGBA32FFromRGBA64PM(uchar *dest, const QRgba64 *src, int index, int count,
+ const QList<QRgb> *, QDitherInfo *)
+{
+ QRgbaFloat32 *d = reinterpret_cast<QRgbaFloat32 *>(dest) + index;
+ for (int i = 0; i < count; ++i)
+ d[i] = qConvertRgb64ToRgbaF32(src[i]).unpremultiplied();
+}
+
+static void QT_FASTCALL storeRGBA32FPMFromRGBA64PM(uchar *dest, const QRgba64 *src, int index, int count,
+ const QList<QRgb> *, QDitherInfo *)
+{
+ QRgbaFloat32 *d = reinterpret_cast<QRgbaFloat32 *>(dest) + index;
+ for (int i = 0; i < count; ++i)
+ d[i] = qConvertRgb64ToRgbaF32(src[i]);
+}
+
+static void QT_FASTCALL storeCMYKFromRGBA64PM(uchar *dest, const QRgba64 *src, int index, int count,
+ const QList<QRgb> *, QDitherInfo *)
+{
+ uint *d = reinterpret_cast<uint *>(dest) + index;
+ for (int i = 0; i < count; ++i)
+ d[i] = QCmyk32::fromColor(QColor(src[i])).toUint();
+}
+
+ConvertAndStorePixelsFunc64 qStoreFromRGBA64PM[] = {
+ nullptr,
+ nullptr,
+ nullptr,
+ nullptr,
+ storeGenericFromRGBA64PM<QImage::Format_RGB32>,
+ storeARGB32FromRGBA64PM,
+ storeGenericFromRGBA64PM<QImage::Format_ARGB32_Premultiplied>,
+ storeGenericFromRGBA64PM<QImage::Format_RGB16>,
+ storeGenericFromRGBA64PM<QImage::Format_ARGB8565_Premultiplied>,
+ storeGenericFromRGBA64PM<QImage::Format_RGB666>,
+ storeGenericFromRGBA64PM<QImage::Format_ARGB6666_Premultiplied>,
+ storeGenericFromRGBA64PM<QImage::Format_RGB555>,
+ storeGenericFromRGBA64PM<QImage::Format_ARGB8555_Premultiplied>,
+ storeGenericFromRGBA64PM<QImage::Format_RGB888>,
+ storeGenericFromRGBA64PM<QImage::Format_RGB444>,
+ storeGenericFromRGBA64PM<QImage::Format_ARGB4444_Premultiplied>,
+ storeGenericFromRGBA64PM<QImage::Format_RGBX8888>,
+ storeRGBA8888FromRGBA64PM,
+ storeGenericFromRGBA64PM<QImage::Format_RGBA8888_Premultiplied>,
+ storeRGB30FromRGBA64PM<PixelOrderBGR>,
+ storeRGB30FromRGBA64PM<PixelOrderBGR>,
+ storeRGB30FromRGBA64PM<PixelOrderRGB>,
+ storeRGB30FromRGBA64PM<PixelOrderRGB>,
+ storeGenericFromRGBA64PM<QImage::Format_Alpha8>,
+ storeGenericFromRGBA64PM<QImage::Format_Grayscale8>,
+ storeRGBX64FromRGBA64PM,
+ storeRGBA64FromRGBA64PM,
+ storeRGBA64PMFromRGBA64PM,
+ storeGray16FromRGBA64PM,
+ storeGenericFromRGBA64PM<QImage::Format_BGR888>,
+ storeRGBX16FFromRGBA64PM,
+ storeRGBA16FFromRGBA64PM,
+ storeRGBA16FPMFromRGBA64PM,
+ storeRGBX32FFromRGBA64PM,
+ storeRGBA32FFromRGBA64PM,
+ storeRGBA32FPMFromRGBA64PM,
+ storeCMYKFromRGBA64PM,
+};
+
+static_assert(std::size(qStoreFromRGBA64PM) == QImage::NImageFormats);
+
+#if QT_CONFIG(raster_fp)
+static void QT_FASTCALL convertToRgbaF32(QRgbaFloat32 *dest, const uint *src, int length)
+{
+ for (int i = 0; i < length; ++i)
+ dest[i] = QRgbaFloat32::fromArgb32(src[i]);
+}
+
+template<QImage::Format format>
+static const QRgbaFloat32 * QT_FASTCALL convertGenericToRGBA32F(QRgbaFloat32 *buffer, const uint *src, int count,
+ const QList<QRgb> *clut, QDitherInfo *)
+{
+ uint buffer32[BufferSize];
+ memcpy(buffer32, src, count * sizeof(uint));
+ qPixelLayouts[format].convertToARGB32PM(buffer32, count, clut);
+ convertToRgbaF32(buffer, buffer32, count);
+ return buffer;
+}
+
+static const QRgbaFloat32 * QT_FASTCALL convertARGB32ToRGBA32F(QRgbaFloat32 *buffer, const uint *src, int count,
+ const QList<QRgb> *, QDitherInfo *)
+{
+ for (int i = 0; i < count; ++i)
+ buffer[i] = QRgbaFloat32::fromArgb32(src[i]).premultiplied();
+ return buffer;
+}
+
+static const QRgbaFloat32 * QT_FASTCALL convertRGBA8888ToRGBA32F(QRgbaFloat32 *buffer, const uint *src, int count,
+ const QList<QRgb> *, QDitherInfo *)
+{
+ for (int i = 0; i < count; ++i)
+ buffer[i] = QRgbaFloat32::fromArgb32(RGBA2ARGB(src[i])).premultiplied();
+ return buffer;
+}
+
+template<QtPixelOrder PixelOrder>
+static const QRgbaFloat32 * QT_FASTCALL convertRGB30ToRGBA32F(QRgbaFloat32 *buffer, const uint *src, int count,
+ const QList<QRgb> *, QDitherInfo *)
+{
+ for (int i = 0; i < count; ++i) {
+ QRgba64 s = qConvertA2rgb30ToRgb64<PixelOrder>(src[i]);
+ buffer[i] = QRgbaFloat32::fromRgba64(s.red(), s.green(), s.blue(), s.alpha());
+ }
+ return buffer;
+}
+
+static const QRgbaFloat32 * QT_FASTCALL convertCMYKToRGBA32F(QRgbaFloat32 *buffer, const uint *src, int count,
+ const QList<QRgb> *, QDitherInfo *)
+{
+ for (int i = 0; i < count; ++i)
+ buffer[i] = QRgbaFloat32::fromArgb32(QCmyk32::fromCmyk32(src[i]).toColor().rgba());
+
+ return buffer;
+}
+
+ConvertToFPFunc qConvertToRGBA32F[] = {
+ nullptr,
+ convertIndexedTo<QRgbaFloat32>,
+ convertIndexedTo<QRgbaFloat32>,
+ convertIndexedTo<QRgbaFloat32>,
+ convertGenericToRGBA32F<QImage::Format_RGB32>,
+ convertARGB32ToRGBA32F,
+ convertGenericToRGBA32F<QImage::Format_ARGB32_Premultiplied>,
+ convertGenericToRGBA32F<QImage::Format_RGB16>,
+ convertGenericToRGBA32F<QImage::Format_ARGB8565_Premultiplied>,
+ convertGenericToRGBA32F<QImage::Format_RGB666>,
+ convertGenericToRGBA32F<QImage::Format_ARGB6666_Premultiplied>,
+ convertGenericToRGBA32F<QImage::Format_RGB555>,
+ convertGenericToRGBA32F<QImage::Format_ARGB8555_Premultiplied>,
+ convertGenericToRGBA32F<QImage::Format_RGB888>,
+ convertGenericToRGBA32F<QImage::Format_RGB444>,
+ convertGenericToRGBA32F<QImage::Format_ARGB4444_Premultiplied>,
+ convertGenericToRGBA32F<QImage::Format_RGBX8888>,
+ convertRGBA8888ToRGBA32F,
+ convertGenericToRGBA32F<QImage::Format_RGBA8888_Premultiplied>,
+ convertRGB30ToRGBA32F<PixelOrderBGR>,
+ convertRGB30ToRGBA32F<PixelOrderBGR>,
+ convertRGB30ToRGBA32F<PixelOrderRGB>,
+ convertRGB30ToRGBA32F<PixelOrderRGB>,
+ convertAlpha8To<QRgbaFloat32>,
+ convertGrayscale8To<QRgbaFloat32>,
+ nullptr,
+ nullptr,
+ nullptr,
+ convertGrayscale16To<QRgbaFloat32>,
+ convertGenericToRGBA32F<QImage::Format_BGR888>,
+ nullptr,
+ nullptr,
+ nullptr,
+ nullptr,
+ nullptr,
+ nullptr,
+ convertCMYKToRGBA32F,
+};
+
+static_assert(std::size(qConvertToRGBA32F) == QImage::NImageFormats);
+
+static const QRgbaFloat32 *QT_FASTCALL fetchRGBX64ToRGBA32F(QRgbaFloat32 *buffer, const uchar *src, int index, int count,
+ const QList<QRgb> *, QDitherInfo *)
+{
+ const QRgba64 *s = reinterpret_cast<const QRgba64 *>(src) + index;
+ for (int i = 0; i < count; ++i) {
+ QRgba64 c = s[i];
+ buffer[i] = QRgbaFloat32::fromRgba64(c.red(), c.green(), c.blue(), 65535);
+ }
+ return buffer;
+}
+
+static const QRgbaFloat32 *QT_FASTCALL fetchRGBA64ToRGBA32F(QRgbaFloat32 *buffer, const uchar *src, int index, int count,
+ const QList<QRgb> *, QDitherInfo *)
+{
+ const QRgba64 *s = reinterpret_cast<const QRgba64 *>(src) + index;
+ for (int i = 0; i < count; ++i)
+ buffer[i] = qConvertRgb64ToRgbaF32(s[i]).premultiplied();
+ return buffer;
+}
+
+static const QRgbaFloat32 *QT_FASTCALL fetchRGBA64PMToRGBA32F(QRgbaFloat32 *buffer, const uchar *src, int index, int count,
+ const QList<QRgb> *, QDitherInfo *)
+{
+ const QRgba64 *s = reinterpret_cast<const QRgba64 *>(src) + index;
+ for (int i = 0; i < count; ++i)
+ buffer[i] = qConvertRgb64ToRgbaF32(s[i]);
+ return buffer;
+}
+
+static const QRgbaFloat32 *QT_FASTCALL fetchRGBA16FToRGBA32F(QRgbaFloat32 *buffer, const uchar *src, int index, int count,
+ const QList<QRgb> *, QDitherInfo *)
+{
+ const QRgbaFloat16 *s = reinterpret_cast<const QRgbaFloat16 *>(src) + index;
+ for (int i = 0; i < count; ++i) {
+ auto c = s[i].premultiplied();
+ buffer[i] = QRgbaFloat32 { c.r, c.g, c.b, c.a};
+ }
+ return buffer;
+}
+
+static const QRgbaFloat32 *QT_FASTCALL fetchRGBA16F(QRgbaFloat32 *buffer, const uchar *src, int index, int count,
+ const QList<QRgb> *, QDitherInfo *)
+{
+ const QRgbaFloat16 *s = reinterpret_cast<const QRgbaFloat16 *>(src) + index;
+ qFloatFromFloat16((float *)buffer, (const qfloat16 *)s, count * 4);
+ return buffer;
+}
+
+static const QRgbaFloat32 *QT_FASTCALL fetchRGBA32FToRGBA32F(QRgbaFloat32 *buffer, const uchar *src, int index, int count,
+ const QList<QRgb> *, QDitherInfo *)
+{
+ const QRgbaFloat32 *s = reinterpret_cast<const QRgbaFloat32 *>(src) + index;
+ for (int i = 0; i < count; ++i)
+ buffer[i] = s[i].premultiplied();
+ return buffer;
+}
+
+static const QRgbaFloat32 *QT_FASTCALL fetchRGBA32F(QRgbaFloat32 *, const uchar *src, int index, int,
+ const QList<QRgb> *, QDitherInfo *)
+{
+ const QRgbaFloat32 *s = reinterpret_cast<const QRgbaFloat32 *>(src) + index;
+ return s;
+}
+
+static const QRgbaFloat32 *QT_FASTCALL fetchCMYKToRGBA32F(QRgbaFloat32 *buffer, const uchar *src, int index, int count,
+ const QList<QRgb> *, QDitherInfo *)
+{
+ const uint *s = reinterpret_cast<const uint *>(src) + index;
+ for (int i = 0; i < count; ++i)
+ buffer[i] = QRgbaFloat32::fromArgb32(QCmyk32::fromCmyk32(s[i]).toColor().rgba());
+
+ return buffer;
+}
+
+FetchAndConvertPixelsFuncFP qFetchToRGBA32F[] = {
+ nullptr,
+ fetchIndexedToRGBA32F<QPixelLayout::BPP1MSB>,
+ fetchIndexedToRGBA32F<QPixelLayout::BPP1LSB>,
+ fetchIndexedToRGBA32F<QPixelLayout::BPP8>,
+ fetchRGBToRGB32F<QImage::Format_RGB32>,
+ fetchARGBToRGBA32F<QImage::Format_ARGB32>,
+ fetchARGBPMToRGBA32F<QImage::Format_ARGB32_Premultiplied>,
+ fetchRGBToRGB32F<QImage::Format_RGB16>,
+ fetchARGBToRGBA32F<QImage::Format_ARGB8565_Premultiplied>,
+ fetchRGBToRGB32F<QImage::Format_RGB666>,
+ fetchARGBToRGBA32F<QImage::Format_ARGB6666_Premultiplied>,
+ fetchRGBToRGB32F<QImage::Format_RGB555>,
+ fetchARGBToRGBA32F<QImage::Format_ARGB8555_Premultiplied>,
+ fetchRGBToRGB32F<QImage::Format_RGB888>,
+ fetchRGBToRGB32F<QImage::Format_RGB444>,
+ fetchARGBToRGBA32F<QImage::Format_ARGB4444_Premultiplied>,
+ fetchRGBToRGB32F<QImage::Format_RGBX8888>,
+ fetchARGBToRGBA32F<QImage::Format_RGBA8888>,
+ fetchARGBPMToRGBA32F<QImage::Format_RGBA8888_Premultiplied>,
+ fetchRGB30ToRGBA32F<PixelOrderBGR>,
+ fetchRGB30ToRGBA32F<PixelOrderBGR>,
+ fetchRGB30ToRGBA32F<PixelOrderRGB>,
+ fetchRGB30ToRGBA32F<PixelOrderRGB>,
+ fetchAlpha8To<QRgbaFloat32>,
+ fetchGrayscale8To<QRgbaFloat32>,
+ fetchRGBX64ToRGBA32F,
+ fetchRGBA64ToRGBA32F,
+ fetchRGBA64PMToRGBA32F,
+ fetchGrayscale16To<QRgbaFloat32>,
+ fetchRGBToRGB32F<QImage::Format_BGR888>,
+ fetchRGBA16F,
+ fetchRGBA16FToRGBA32F,
+ fetchRGBA16F,
+ fetchRGBA32F,
+ fetchRGBA32FToRGBA32F,
+ fetchRGBA32F,
+ fetchCMYKToRGBA32F,
+};
+
+static_assert(std::size(qFetchToRGBA32F) == QImage::NImageFormats);
+
+static void QT_FASTCALL convertFromRgba32f(uint *dest, const QRgbaFloat32 *src, int length)
+{
+ for (int i = 0; i < length; ++i)
+ dest[i] = src[i].toArgb32();
+}
+
+template<QImage::Format format>
+static void QT_FASTCALL storeGenericFromRGBA32F(uchar *dest, const QRgbaFloat32 *src, int index, int count,
+ const QList<QRgb> *clut, QDitherInfo *dither)
+{
+ uint buffer[BufferSize];
+ convertFromRgba32f(buffer, src, count);
+ qPixelLayouts[format].storeFromARGB32PM(dest, buffer, index, count, clut, dither);
+}
+
+static void QT_FASTCALL storeARGB32FromRGBA32F(uchar *dest, const QRgbaFloat32 *src, int index, int count,
+ const QList<QRgb> *, QDitherInfo *)
+{
+ uint *d = (uint*)dest + index;
+ for (int i = 0; i < count; ++i)
+ d[i] = src[i].unpremultiplied().toArgb32();
+}
+
+static void QT_FASTCALL storeRGBA8888FromRGBA32F(uchar *dest, const QRgbaFloat32 *src, int index, int count,
+ const QList<QRgb> *, QDitherInfo *)
+{
+ uint *d = (uint*)dest + index;
+ for (int i = 0; i < count; ++i)
+ d[i] = ARGB2RGBA(src[i].unpremultiplied().toArgb32());
+}
+
+template<QtPixelOrder PixelOrder>
+static void QT_FASTCALL storeRGB30FromRGBA32F(uchar *dest, const QRgbaFloat32 *src, int index, int count,
+ const QList<QRgb> *, QDitherInfo *)
+{
+ uint *d = (uint*)dest + index;
+ for (int i = 0; i < count; ++i) {
+ const auto s = src[i];
+ d[i] = qConvertRgb64ToRgb30<PixelOrder>(QRgba64::fromRgba64(s.red16(), s.green16(), s.blue16(), s.alpha16()));
+ }
+}
+
+static void QT_FASTCALL storeRGBX64FromRGBA32F(uchar *dest, const QRgbaFloat32 *src, int index, int count,
+ const QList<QRgb> *, QDitherInfo *)
+{
+ QRgba64 *d = reinterpret_cast<QRgba64 *>(dest) + index;
+ for (int i = 0; i < count; ++i) {
+ const auto s = src[i].unpremultiplied();
+ d[i] = QRgba64::fromRgba64(s.red16(), s.green16(), s.blue16(), 65535);
+ }
+}
+
+static void QT_FASTCALL storeRGBA64FromRGBA32F(uchar *dest, const QRgbaFloat32 *src, int index, int count,
+ const QList<QRgb> *, QDitherInfo *)
+{
+ QRgba64 *d = reinterpret_cast<QRgba64 *>(dest) + index;
+ for (int i = 0; i < count; ++i) {
+ const auto s = src[i].unpremultiplied();
+ d[i] = QRgba64::fromRgba64(s.red16(), s.green16(), s.blue16(), s.alpha16());
+ }
+}
+
+static void QT_FASTCALL storeRGBA64PMFromRGBA32F(uchar *dest, const QRgbaFloat32 *src, int index, int count,
+ const QList<QRgb> *, QDitherInfo *)
+{
+ QRgba64 *d = reinterpret_cast<QRgba64 *>(dest) + index;
+ for (int i = 0; i < count; ++i)
+ d[i] = QRgba64::fromRgba64(src[i].red16(), src[i].green16(), src[i].blue16(), src[i].alpha16());
+}
+
+static void QT_FASTCALL storeGray16FromRGBA32F(uchar *dest, const QRgbaFloat32 *src, int index, int count,
+ const QList<QRgb> *, QDitherInfo *)
+{
+ quint16 *d = reinterpret_cast<quint16 *>(dest) + index;
+ for (int i = 0; i < count; ++i) {
+ auto s = src[i].unpremultiplied();
+ d[i] = qGray(s.red16(), s.green16(), s.blue16());
+ }
+}
+
+static void QT_FASTCALL storeRGBX16FFromRGBA32F(uchar *dest, const QRgbaFloat32 *src, int index, int count,
+ const QList<QRgb> *, QDitherInfo *)
+{
+ QRgbaFloat16 *d = reinterpret_cast<QRgbaFloat16 *>(dest) + index;
+ for (int i = 0; i < count; ++i) {
+ auto s = src[i].unpremultiplied();
+ d[i] = QRgbaFloat16{ qfloat16(s.r), qfloat16(s.g), qfloat16(s.b), qfloat16(1.0f) };
+ }
+}
+
+static void QT_FASTCALL storeRGBA16FFromRGBA32F(uchar *dest, const QRgbaFloat32 *src, int index, int count,
+ const QList<QRgb> *, QDitherInfo *)
+{
+ QRgbaFloat16 *d = reinterpret_cast<QRgbaFloat16 *>(dest) + index;
+ for (int i = 0; i < count; ++i) {
+ auto s = src[i].unpremultiplied();
+ d[i] = QRgbaFloat16{ qfloat16(s.r), qfloat16(s.g), qfloat16(s.b), qfloat16(s.a) };
+ }
+}
+
+static void QT_FASTCALL storeRGBA16FPMFromRGBA32F(uchar *dest, const QRgbaFloat32 *src, int index, int count,
+ const QList<QRgb> *, QDitherInfo *)
+{
+ QRgbaFloat16 *d = reinterpret_cast<QRgbaFloat16 *>(dest) + index;
+ qFloatToFloat16((qfloat16 *)d, (const float *)src, count * 4);
+}
+
+static void QT_FASTCALL storeRGBX32FFromRGBA32F(uchar *dest, const QRgbaFloat32 *src, int index, int count,
+ const QList<QRgb> *, QDitherInfo *)
+{
+ QRgbaFloat32 *d = reinterpret_cast<QRgbaFloat32 *>(dest) + index;
+ for (int i = 0; i < count; ++i) {
+ auto s = src[i].unpremultiplied();
+ s.a = 1.0f;
+ d[i] = s;
+ }
+}
+
+static void QT_FASTCALL storeRGBA32FFromRGBA32F(uchar *dest, const QRgbaFloat32 *src, int index, int count,
+ const QList<QRgb> *, QDitherInfo *)
+{
+ QRgbaFloat32 *d = reinterpret_cast<QRgbaFloat32 *>(dest) + index;
+ for (int i = 0; i < count; ++i)
+ d[i] = src[i].unpremultiplied();
+}
+
+static void QT_FASTCALL storeRGBA32FPMFromRGBA32F(uchar *dest, const QRgbaFloat32 *src, int index, int count,
+ const QList<QRgb> *, QDitherInfo *)
+{
+ QRgbaFloat32 *d = reinterpret_cast<QRgbaFloat32 *>(dest) + index;
+ if (d != src) {
+ for (int i = 0; i < count; ++i)
+ d[i] = src[i];
+ }
+}
+
+static void QT_FASTCALL storeCMYKFromRGBA32F(uchar *dest, const QRgbaFloat32 *src, int index, int count,
+ const QList<QRgb> *, QDitherInfo *)
+{
+ uint *d = reinterpret_cast<uint *>(dest) + index;
+ for (int i = 0; i < count; ++i) {
+ // Yikes, this really needs enablers in QColor and friends
+ d[i] = QCmyk32::fromColor(QColor(src[i].toArgb32())).toUint();
+ }
+}
+
+ConvertAndStorePixelsFuncFP qStoreFromRGBA32F[] = {
+ nullptr,
+ nullptr,
+ nullptr,
+ nullptr,
+ storeGenericFromRGBA32F<QImage::Format_RGB32>,
+ storeARGB32FromRGBA32F,
+ storeGenericFromRGBA32F<QImage::Format_ARGB32_Premultiplied>,
+ storeGenericFromRGBA32F<QImage::Format_RGB16>,
+ storeGenericFromRGBA32F<QImage::Format_ARGB8565_Premultiplied>,
+ storeGenericFromRGBA32F<QImage::Format_RGB666>,
+ storeGenericFromRGBA32F<QImage::Format_ARGB6666_Premultiplied>,
+ storeGenericFromRGBA32F<QImage::Format_RGB555>,
+ storeGenericFromRGBA32F<QImage::Format_ARGB8555_Premultiplied>,
+ storeGenericFromRGBA32F<QImage::Format_RGB888>,
+ storeGenericFromRGBA32F<QImage::Format_RGB444>,
+ storeGenericFromRGBA32F<QImage::Format_ARGB4444_Premultiplied>,
+ storeGenericFromRGBA32F<QImage::Format_RGBX8888>,
+ storeRGBA8888FromRGBA32F,
+ storeGenericFromRGBA32F<QImage::Format_RGBA8888_Premultiplied>,
+ storeRGB30FromRGBA32F<PixelOrderBGR>,
+ storeRGB30FromRGBA32F<PixelOrderBGR>,
+ storeRGB30FromRGBA32F<PixelOrderRGB>,
+ storeRGB30FromRGBA32F<PixelOrderRGB>,
+ storeGenericFromRGBA32F<QImage::Format_Alpha8>,
+ storeGenericFromRGBA32F<QImage::Format_Grayscale8>,
+ storeRGBX64FromRGBA32F,
+ storeRGBA64FromRGBA32F,
+ storeRGBA64PMFromRGBA32F,
+ storeGray16FromRGBA32F,
+ storeGenericFromRGBA32F<QImage::Format_BGR888>,
+ storeRGBX16FFromRGBA32F,
+ storeRGBA16FFromRGBA32F,
+ storeRGBA16FPMFromRGBA32F,
+ storeRGBX32FFromRGBA32F,
+ storeRGBA32FFromRGBA32F,
+ storeRGBA32FPMFromRGBA32F,
+ storeCMYKFromRGBA32F,
+};
+
+static_assert(std::size(qStoreFromRGBA32F) == QImage::NImageFormats);
+
+#endif // QT_CONFIG(raster_fp)
+
+QT_END_NAMESPACE
diff --git a/src/gui/painting/qpixellayout_p.h b/src/gui/painting/qpixellayout_p.h
new file mode 100644
index 0000000000..14f19f4e74
--- /dev/null
+++ b/src/gui/painting/qpixellayout_p.h
@@ -0,0 +1,335 @@
+// Copyright (C) 2020 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
+
+#ifndef QPIXELLAYOUT_P_H
+#define QPIXELLAYOUT_P_H
+
+//
+// W A R N I N G
+// -------------
+//
+// This file is not part of the Qt API. It exists purely as an
+// implementation detail. This header file may change from version to
+// version without notice, or even be removed.
+//
+// We mean it.
+//
+
+#include <QtCore/qlist.h>
+#include <QtGui/qimage.h>
+#include <QtGui/qrgba64.h>
+#include <QtGui/qrgbafloat.h>
+#include <QtCore/private/qglobal_p.h>
+
+QT_BEGIN_NAMESPACE
+
+enum QtPixelOrder {
+ PixelOrderRGB,
+ PixelOrderBGR
+};
+
+template<enum QtPixelOrder> inline uint qConvertArgb32ToA2rgb30(QRgb);
+
+template<enum QtPixelOrder> inline uint qConvertRgb32ToRgb30(QRgb);
+
+template<enum QtPixelOrder> inline QRgb qConvertA2rgb30ToArgb32(uint c);
+
+// A combined unpremultiply and premultiply with new simplified alpha.
+// Needed when alpha loses precision relative to other colors during conversion (ARGB32 -> A2RGB30).
+template<unsigned int Shift>
+inline QRgb qRepremultiply(QRgb p)
+{
+ const uint alpha = qAlpha(p);
+ if (alpha == 255 || alpha == 0)
+ return p;
+ p = qUnpremultiply(p);
+ constexpr uint mult = 255 / (255 >> Shift);
+ const uint newAlpha = mult * (alpha >> Shift);
+ p = (p & ~0xff000000) | (newAlpha<<24);
+ return qPremultiply(p);
+}
+
+template<unsigned int Shift>
+inline QRgba64 qRepremultiply(QRgba64 p)
+{
+ const uint alpha = p.alpha();
+ if (alpha == 65535 || alpha == 0)
+ return p;
+ p = p.unpremultiplied();
+ constexpr uint mult = 65535 / (65535 >> Shift);
+ p.setAlpha(mult * (alpha >> Shift));
+ return p.premultiplied();
+}
+
+template<>
+inline uint qConvertArgb32ToA2rgb30<PixelOrderBGR>(QRgb c)
+{
+ c = qRepremultiply<6>(c);
+ return (c & 0xc0000000)
+ | (((c << 22) & 0x3fc00000) | ((c << 14) & 0x00300000))
+ | (((c << 4) & 0x000ff000) | ((c >> 4) & 0x00000c00))
+ | (((c >> 14) & 0x000003fc) | ((c >> 22) & 0x00000003));
+}
+
+template<>
+inline uint qConvertArgb32ToA2rgb30<PixelOrderRGB>(QRgb c)
+{
+ c = qRepremultiply<6>(c);
+ return (c & 0xc0000000)
+ | (((c << 6) & 0x3fc00000) | ((c >> 2) & 0x00300000))
+ | (((c << 4) & 0x000ff000) | ((c >> 4) & 0x00000c00))
+ | (((c << 2) & 0x000003fc) | ((c >> 6) & 0x00000003));
+}
+
+template<>
+inline uint qConvertRgb32ToRgb30<PixelOrderBGR>(QRgb c)
+{
+ return 0xc0000000
+ | (((c << 22) & 0x3fc00000) | ((c << 14) & 0x00300000))
+ | (((c << 4) & 0x000ff000) | ((c >> 4) & 0x00000c00))
+ | (((c >> 14) & 0x000003fc) | ((c >> 22) & 0x00000003));
+}
+
+template<>
+inline uint qConvertRgb32ToRgb30<PixelOrderRGB>(QRgb c)
+{
+ return 0xc0000000
+ | (((c << 6) & 0x3fc00000) | ((c >> 2) & 0x00300000))
+ | (((c << 4) & 0x000ff000) | ((c >> 4) & 0x00000c00))
+ | (((c << 2) & 0x000003fc) | ((c >> 6) & 0x00000003));
+}
+
+template<>
+inline QRgb qConvertA2rgb30ToArgb32<PixelOrderBGR>(uint c)
+{
+ uint a = c >> 30;
+ a |= a << 2;
+ a |= a << 4;
+ return (a << 24)
+ | ((c << 14) & 0x00ff0000)
+ | ((c >> 4) & 0x0000ff00)
+ | ((c >> 22) & 0x000000ff);
+}
+
+template<>
+inline QRgb qConvertA2rgb30ToArgb32<PixelOrderRGB>(uint c)
+{
+ uint a = c >> 30;
+ a |= a << 2;
+ a |= a << 4;
+ return (a << 24)
+ | ((c >> 6) & 0x00ff0000)
+ | ((c >> 4) & 0x0000ff00)
+ | ((c >> 2) & 0x000000ff);
+}
+
+template<enum QtPixelOrder> inline QRgba64 qConvertA2rgb30ToRgb64(uint rgb);
+
+template<>
+inline QRgba64 qConvertA2rgb30ToRgb64<PixelOrderBGR>(uint rgb)
+{
+ quint16 alpha = rgb >> 30;
+ quint16 blue = (rgb >> 20) & 0x3ff;
+ quint16 green = (rgb >> 10) & 0x3ff;
+ quint16 red = rgb & 0x3ff;
+ // Expand the range.
+ alpha |= (alpha << 2);
+ alpha |= (alpha << 4);
+ alpha |= (alpha << 8);
+ red = (red << 6) | (red >> 4);
+ green = (green << 6) | (green >> 4);
+ blue = (blue << 6) | (blue >> 4);
+ return qRgba64(red, green, blue, alpha);
+}
+
+template<>
+inline QRgba64 qConvertA2rgb30ToRgb64<PixelOrderRGB>(uint rgb)
+{
+ quint16 alpha = rgb >> 30;
+ quint16 red = (rgb >> 20) & 0x3ff;
+ quint16 green = (rgb >> 10) & 0x3ff;
+ quint16 blue = rgb & 0x3ff;
+ // Expand the range.
+ alpha |= (alpha << 2);
+ alpha |= (alpha << 4);
+ alpha |= (alpha << 8);
+ red = (red << 6) | (red >> 4);
+ green = (green << 6) | (green >> 4);
+ blue = (blue << 6) | (blue >> 4);
+ return qRgba64(red, green, blue, alpha);
+}
+
+template<enum QtPixelOrder> inline unsigned int qConvertRgb64ToRgb30(QRgba64);
+
+template<>
+inline unsigned int qConvertRgb64ToRgb30<PixelOrderBGR>(QRgba64 c)
+{
+ c = qRepremultiply<14>(c);
+ const uint a = c.alpha() >> 14;
+ const uint r = c.red() >> 6;
+ const uint g = c.green() >> 6;
+ const uint b = c.blue() >> 6;
+ return (a << 30) | (b << 20) | (g << 10) | r;
+}
+
+template<>
+inline unsigned int qConvertRgb64ToRgb30<PixelOrderRGB>(QRgba64 c)
+{
+ c = qRepremultiply<14>(c);
+ const uint a = c.alpha() >> 14;
+ const uint r = c.red() >> 6;
+ const uint g = c.green() >> 6;
+ const uint b = c.blue() >> 6;
+ return (a << 30) | (r << 20) | (g << 10) | b;
+}
+
+inline constexpr QRgbaFloat16 qConvertRgb64ToRgbaF16(QRgba64 c)
+{
+ return QRgbaFloat16::fromRgba64(c.red(), c.green(), c.blue(), c.alpha());
+}
+
+inline constexpr QRgbaFloat32 qConvertRgb64ToRgbaF32(QRgba64 c)
+{
+ return QRgbaFloat32::fromRgba64(c.red(), c.green(), c.blue(), c.alpha());
+}
+
+inline uint qRgbSwapRgb30(uint c)
+{
+ const uint ag = c & 0xc00ffc00;
+ const uint rb = c & 0x3ff003ff;
+ return ag | (rb << 20) | (rb >> 20);
+}
+
+#if Q_BYTE_ORDER == Q_BIG_ENDIAN
+static inline quint32 RGBA2ARGB(quint32 x) {
+ quint32 rgb = x >> 8;
+ quint32 a = x << 24;
+ return a | rgb;
+}
+
+static inline quint32 ARGB2RGBA(quint32 x) {
+ quint32 rgb = x << 8;
+ quint32 a = x >> 24;
+ return a | rgb;
+}
+#else
+static inline quint32 RGBA2ARGB(quint32 x) {
+ // RGBA8888 is ABGR32 on little endian.
+ quint32 ag = x & 0xff00ff00;
+ quint32 rg = x & 0x00ff00ff;
+ return ag | (rg << 16) | (rg >> 16);
+}
+
+static inline quint32 ARGB2RGBA(quint32 x) {
+ return RGBA2ARGB(x);
+}
+#endif
+
+// We manually unalias the variables to make sure the compiler
+// fully optimizes both aliased and unaliased cases.
+#define UNALIASED_CONVERSION_LOOP(buffer, src, count, conversion) \
+ if (src == buffer) { \
+ for (int i = 0; i < count; ++i) \
+ buffer[i] = conversion(buffer[i]); \
+ } else { \
+ for (int i = 0; i < count; ++i) \
+ buffer[i] = conversion(src[i]); \
+ }
+
+
+inline const uint *qt_convertARGB32ToARGB32PM(uint *buffer, const uint *src, int count)
+{
+ UNALIASED_CONVERSION_LOOP(buffer, src, count, qPremultiply);
+ return buffer;
+}
+
+inline const uint *qt_convertRGBA8888ToARGB32PM(uint *buffer, const uint *src, int count)
+{
+ UNALIASED_CONVERSION_LOOP(buffer, src, count, [](uint s) { return qPremultiply(RGBA2ARGB(s));});
+ return buffer;
+}
+
+template<bool RGBA> void qt_convertRGBA64ToARGB32(uint *dst, const QRgba64 *src, int count);
+
+struct QDitherInfo {
+ int x;
+ int y;
+};
+
+typedef const uint *(QT_FASTCALL *FetchAndConvertPixelsFunc)(uint *buffer, const uchar *src,
+ int index, int count,
+ const QList<QRgb> *clut,
+ QDitherInfo *dither);
+typedef void(QT_FASTCALL *ConvertAndStorePixelsFunc)(uchar *dest, const uint *src, int index,
+ int count, const QList<QRgb> *clut,
+ QDitherInfo *dither);
+
+typedef const QRgba64 *(QT_FASTCALL *FetchAndConvertPixelsFunc64)(QRgba64 *buffer, const uchar *src,
+ int index, int count,
+ const QList<QRgb> *clut,
+ QDitherInfo *dither);
+typedef void(QT_FASTCALL *ConvertAndStorePixelsFunc64)(uchar *dest, const QRgba64 *src, int index,
+ int count, const QList<QRgb> *clut,
+ QDitherInfo *dither);
+
+typedef const QRgbaFloat32 *(QT_FASTCALL *FetchAndConvertPixelsFuncFP)(QRgbaFloat32 *buffer, const uchar *src, int index, int count,
+ const QList<QRgb> *clut, QDitherInfo *dither);
+typedef void (QT_FASTCALL *ConvertAndStorePixelsFuncFP)(uchar *dest, const QRgbaFloat32 *src, int index, int count,
+ const QList<QRgb> *clut, QDitherInfo *dither);
+typedef void (QT_FASTCALL *ConvertFunc)(uint *buffer, int count, const QList<QRgb> *clut);
+typedef void (QT_FASTCALL *Convert64Func)(QRgba64 *buffer, int count);
+typedef void (QT_FASTCALL *ConvertFPFunc)(QRgbaFloat32 *buffer, int count);
+typedef void (QT_FASTCALL *Convert64ToFPFunc)(QRgbaFloat32 *buffer, const quint64 *src, int count);
+
+typedef const QRgba64 *(QT_FASTCALL *ConvertTo64Func)(QRgba64 *buffer, const uint *src, int count,
+ const QList<QRgb> *clut, QDitherInfo *dither);
+typedef const QRgbaFloat32 *(QT_FASTCALL *ConvertToFPFunc)(QRgbaFloat32 *buffer, const uint *src, int count,
+ const QList<QRgb> *clut, QDitherInfo *dither);
+typedef void (QT_FASTCALL *RbSwapFunc)(uchar *dst, const uchar *src, int count);
+
+typedef void (*MemRotateFunc)(const uchar *srcPixels, int w, int h, int sbpl, uchar *destPixels, int dbpl);
+
+struct QPixelLayout
+{
+ // Bits per pixel
+ enum BPP {
+ BPPNone,
+ BPP1MSB,
+ BPP1LSB,
+ BPP8,
+ BPP16,
+ BPP24,
+ BPP32,
+ BPP64,
+ BPP16FPx4,
+ BPP32FPx4,
+ BPPCount
+ };
+
+ bool hasAlphaChannel;
+ bool premultiplied;
+ BPP bpp;
+ RbSwapFunc rbSwap;
+ ConvertFunc convertToARGB32PM;
+ ConvertTo64Func convertToRGBA64PM;
+ FetchAndConvertPixelsFunc fetchToARGB32PM;
+ FetchAndConvertPixelsFunc64 fetchToRGBA64PM;
+ ConvertAndStorePixelsFunc storeFromARGB32PM;
+ ConvertAndStorePixelsFunc storeFromRGB32;
+};
+
+extern ConvertAndStorePixelsFunc64 qStoreFromRGBA64PM[QImage::NImageFormats];
+
+#if QT_CONFIG(raster_fp)
+extern ConvertToFPFunc qConvertToRGBA32F[];
+extern FetchAndConvertPixelsFuncFP qFetchToRGBA32F[];
+extern ConvertAndStorePixelsFuncFP qStoreFromRGBA32F[];
+#endif
+
+extern QPixelLayout qPixelLayouts[];
+
+extern MemRotateFunc qMemRotateFunctions[QPixelLayout::BPPCount][3];
+
+QT_END_NAMESPACE
+
+#endif // QPIXELLAYOUT_P_H
diff --git a/src/gui/painting/qplatformbackingstore.cpp b/src/gui/painting/qplatformbackingstore.cpp
index c092a7153f..f7c4df40c8 100644
--- a/src/gui/painting/qplatformbackingstore.cpp
+++ b/src/gui/painting/qplatformbackingstore.cpp
@@ -1,82 +1,14 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the QtGui module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#include "qplatformbackingstore.h"
#include <qwindow.h>
#include <qpixmap.h>
+#include <private/qbackingstorerhisupport_p.h>
+#include <private/qbackingstoredefaultcompositor_p.h>
#include <private/qwindow_p.h>
-#include <qopengl.h>
-#include <qopenglcontext.h>
-#include <QtGui/QMatrix4x4>
-#include <QtGui/QOpenGLShaderProgram>
-#include <QtGui/QOpenGLContext>
-#include <QtGui/QOpenGLFunctions>
-#ifndef QT_NO_OPENGL
-#include <QtGui/qopengltextureblitter.h>
-#include <QtGui/qoffscreensurface.h>
-#endif
-#include <qpa/qplatformgraphicsbuffer.h>
-#include <qpa/qplatformgraphicsbufferhelper.h>
-
-#ifndef GL_TEXTURE_BASE_LEVEL
-#define GL_TEXTURE_BASE_LEVEL 0x813C
-#endif
-#ifndef GL_TEXTURE_MAX_LEVEL
-#define GL_TEXTURE_MAX_LEVEL 0x813D
-#endif
-#ifndef GL_UNPACK_ROW_LENGTH
-#define GL_UNPACK_ROW_LENGTH 0x0CF2
-#endif
-#ifndef GL_RGB10_A2
-#define GL_RGB10_A2 0x8059
-#endif
-#ifndef GL_UNSIGNED_INT_2_10_10_10_REV
-#define GL_UNSIGNED_INT_2_10_10_10_REV 0x8368
-#endif
-
-#ifndef GL_FRAMEBUFFER_SRGB
-#define GL_FRAMEBUFFER_SRGB 0x8DB9
-#endif
-#ifndef GL_FRAMEBUFFER_SRGB_CAPABLE
-#define GL_FRAMEBUFFER_SRGB_CAPABLE 0x8DBA
-#endif
+#include <QtCore/private/qobject_p.h>
QT_BEGIN_NAMESPACE
@@ -88,53 +20,30 @@ public:
QPlatformBackingStorePrivate(QWindow *w)
: window(w)
, backingStore(nullptr)
-#ifndef QT_NO_OPENGL
- , textureId(0)
- , blitter(nullptr)
-#endif
{
}
- ~QPlatformBackingStorePrivate()
- {
-#ifndef QT_NO_OPENGL
- if (context) {
- QOffscreenSurface offscreenSurface;
- offscreenSurface.setFormat(context->format());
- offscreenSurface.create();
- context->makeCurrent(&offscreenSurface);
- if (textureId)
- context->functions()->glDeleteTextures(1, &textureId);
- if (blitter)
- blitter->destroy();
- }
- delete blitter;
-#endif
- }
QWindow *window;
QBackingStore *backingStore;
-#ifndef QT_NO_OPENGL
- QScopedPointer<QOpenGLContext> context;
- mutable GLuint textureId;
- mutable QSize textureSize;
- mutable bool needsSwizzle;
- mutable bool premultiplied;
- QOpenGLTextureBlitter *blitter;
-#endif
-};
-#ifndef QT_NO_OPENGL
+ // The order matters. if it needs to be rearranged in the future, call
+ // reset() explicitly from the dtor in the correct order.
+ // (first the compositor, then the rhiSupport)
+ QBackingStoreRhiSupport rhiSupport;
+ QBackingStoreDefaultCompositor compositor;
+};
struct QBackingstoreTextureInfo
{
void *source; // may be null
- GLuint textureId;
+ QRhiTexture *texture;
+ QRhiTexture *textureExtra;
QRect rect;
QRect clipRect;
QPlatformTextureList::Flags flags;
};
-Q_DECLARE_TYPEINFO(QBackingstoreTextureInfo, Q_MOVABLE_TYPE);
+Q_DECLARE_TYPEINFO(QBackingstoreTextureInfo, Q_RELOCATABLE_TYPE);
class QPlatformTextureListPrivate : public QObjectPrivate
{
@@ -144,7 +53,7 @@ public:
{
}
- QVector<QBackingstoreTextureInfo> textures;
+ QList<QBackingstoreTextureInfo> textures;
bool locked;
};
@@ -160,13 +69,19 @@ QPlatformTextureList::~QPlatformTextureList()
int QPlatformTextureList::count() const
{
Q_D(const QPlatformTextureList);
- return d->textures.count();
+ return d->textures.size();
+}
+
+QRhiTexture *QPlatformTextureList::texture(int index) const
+{
+ Q_D(const QPlatformTextureList);
+ return d->textures.at(index).texture;
}
-GLuint QPlatformTextureList::textureId(int index) const
+QRhiTexture *QPlatformTextureList::textureExtra(int index) const
{
Q_D(const QPlatformTextureList);
- return d->textures.at(index).textureId;
+ return d->textures.at(index).textureExtra;
}
void *QPlatformTextureList::source(int index)
@@ -208,13 +123,29 @@ bool QPlatformTextureList::isLocked() const
return d->locked;
}
-void QPlatformTextureList::appendTexture(void *source, GLuint textureId, const QRect &geometry,
+void QPlatformTextureList::appendTexture(void *source, QRhiTexture *texture, const QRect &geometry,
const QRect &clipRect, Flags flags)
{
Q_D(QPlatformTextureList);
QBackingstoreTextureInfo bi;
bi.source = source;
- bi.textureId = textureId;
+ bi.texture = texture;
+ bi.textureExtra = nullptr;
+ bi.rect = geometry;
+ bi.clipRect = clipRect;
+ bi.flags = flags;
+ d->textures.append(bi);
+}
+
+void QPlatformTextureList::appendTexture(void *source, QRhiTexture *textureLeft, QRhiTexture *textureRight, const QRect &geometry,
+ const QRect &clipRect, Flags flags)
+{
+ Q_D(QPlatformTextureList);
+
+ QBackingstoreTextureInfo bi;
+ bi.source = source;
+ bi.texture = textureLeft;
+ bi.textureExtra = textureRight;
bi.rect = geometry;
bi.clipRect = clipRect;
bi.flags = flags;
@@ -226,7 +157,6 @@ void QPlatformTextureList::clear()
Q_D(QPlatformTextureList);
d->textures.clear();
}
-#endif // QT_NO_OPENGL
/*!
\class QPlatformBackingStore
@@ -239,275 +169,81 @@ void QPlatformTextureList::clear()
windows.
*/
-#ifndef QT_NO_OPENGL
-
-static inline QRect deviceRect(const QRect &rect, QWindow *window)
-{
- QRect deviceRect(rect.topLeft() * window->devicePixelRatio(),
- rect.size() * window->devicePixelRatio());
- return deviceRect;
-}
-
-static inline QPoint deviceOffset(const QPoint &pt, QWindow *window)
-{
- return pt * window->devicePixelRatio();
-}
-
-static QRegion deviceRegion(const QRegion &region, QWindow *window, const QPoint &offset)
-{
- if (offset.isNull() && window->devicePixelRatio() <= 1)
- return region;
+/*!
+ Flushes the given \a region from the specified \a window.
- QVector<QRect> rects;
- rects.reserve(region.rectCount());
- for (const QRect &rect : region)
- rects.append(deviceRect(rect.translated(offset), window));
+ \note \a region is relative to the window which may not be top-level in case
+ \a window corresponds to a native child widget. \a offset is the position of
+ the native child relative to the top-level window.
- QRegion deviceRegion;
- deviceRegion.setRects(rects.constData(), rects.count());
- return deviceRegion;
-}
+ Unlike rhiFlush(), this function's default implementation does nothing. It
+ is expected that subclasses provide a platform-specific (non-QRhi-based)
+ implementation, if applicable on the given platform.
-static inline QRect toBottomLeftRect(const QRect &topLeftRect, int windowHeight)
-{
- return QRect(topLeftRect.x(), windowHeight - topLeftRect.bottomRight().y() - 1,
- topLeftRect.width(), topLeftRect.height());
-}
-
-static void blitTextureForWidget(const QPlatformTextureList *textures, int idx, QWindow *window, const QRect &deviceWindowRect,
- QOpenGLTextureBlitter *blitter, const QPoint &offset, bool canUseSrgb)
+ \sa rhiFlush()
+ */
+void QPlatformBackingStore::flush(QWindow *window, const QRegion &region, const QPoint &offset)
{
- const QRect clipRect = textures->clipRect(idx);
- if (clipRect.isEmpty())
- return;
-
- QRect rectInWindow = textures->geometry(idx);
- // relative to the TLW, not necessarily our window (if the flush is for a native child widget), have to adjust
- rectInWindow.translate(-offset);
-
- const QRect clippedRectInWindow = rectInWindow & clipRect.translated(rectInWindow.topLeft());
- const QRect srcRect = toBottomLeftRect(clipRect, rectInWindow.height());
-
- const QMatrix4x4 target = QOpenGLTextureBlitter::targetTransform(deviceRect(clippedRectInWindow, window),
- deviceWindowRect);
-
- const QMatrix3x3 source = QOpenGLTextureBlitter::sourceTransform(deviceRect(srcRect, window),
- deviceRect(rectInWindow, window).size(),
- QOpenGLTextureBlitter::OriginBottomLeft);
-
- QOpenGLFunctions *funcs = QOpenGLContext::currentContext()->functions();
- const bool srgb = textures->flags(idx).testFlag(QPlatformTextureList::TextureIsSrgb);
- if (srgb && canUseSrgb)
- funcs->glEnable(GL_FRAMEBUFFER_SRGB);
-
- blitter->blit(textures->textureId(idx), target, source);
-
- if (srgb && canUseSrgb)
- funcs->glDisable(GL_FRAMEBUFFER_SRGB);
+ Q_UNUSED(window);
+ Q_UNUSED(region);
+ Q_UNUSED(offset);
}
/*!
- Flushes the given \a region from the specified \a window onto the
- screen, and composes it with the specified \a textures.
+ Flushes the given \a region from the specified \a window, and compositing
+ it with the specified \a textures list.
- The default implementation retrieves the contents using toTexture()
- and composes using OpenGL. May be reimplemented in subclasses if there
- is a more efficient native way to do it.
+ The default implementation retrieves the contents using toTexture() and
+ composes using QRhi with OpenGL, Metal, Vulkan, or Direct 3D underneath.
+ May be reimplemented in subclasses if customization is desired.
\note \a region is relative to the window which may not be top-level in case
\a window corresponds to a native child widget. \a offset is the position of
the native child relative to the top-level window.
- */
-
-void QPlatformBackingStore::composeAndFlush(QWindow *window, const QRegion &region,
- const QPoint &offset,
- QPlatformTextureList *textures,
- bool translucentBackground)
-{
- if (!qt_window_private(window)->receivedExpose)
- return;
-
- if (!d_ptr->context) {
- d_ptr->context.reset(new QOpenGLContext);
- d_ptr->context->setFormat(d_ptr->window->requestedFormat());
- d_ptr->context->setScreen(d_ptr->window->screen());
- d_ptr->context->setShareContext(qt_window_private(d_ptr->window)->shareContext());
- if (!d_ptr->context->create()) {
- qCWarning(lcQpaBackingStore, "composeAndFlush: QOpenGLContext creation failed");
- return;
- }
- }
-
- bool current = d_ptr->context->makeCurrent(window);
-
- if (!current && !d_ptr->context->isValid()) {
- delete d_ptr->blitter;
- d_ptr->blitter = nullptr;
- d_ptr->textureId = 0;
- current = d_ptr->context->create() && d_ptr->context->makeCurrent(window);
- }
-
- if (!current) {
- qCWarning(lcQpaBackingStore, "composeAndFlush: makeCurrent() failed");
- return;
- }
-
- qCDebug(lcQpaBackingStore) << "Composing and flushing" << region << "of" << window
- << "at offset" << offset << "with" << textures->count() << "texture(s) in" << textures;
-
- QWindowPrivate::get(window)->lastComposeTime.start();
-
- QOpenGLFunctions *funcs = d_ptr->context->functions();
- funcs->glViewport(0, 0, qRound(window->width() * window->devicePixelRatio()), qRound(window->height() * window->devicePixelRatio()));
- funcs->glClearColor(0, 0, 0, translucentBackground ? 0 : 1);
- funcs->glClear(GL_COLOR_BUFFER_BIT);
- if (!d_ptr->blitter) {
- d_ptr->blitter = new QOpenGLTextureBlitter;
- d_ptr->blitter->create();
- }
-
- d_ptr->blitter->bind();
-
- const QRect deviceWindowRect = deviceRect(QRect(QPoint(), window->size()), window);
- const QPoint deviceWindowOffset = deviceOffset(offset, window);
-
- bool canUseSrgb = false;
- // If there are any sRGB textures in the list, check if the destination
- // framebuffer is sRGB capable.
- for (int i = 0; i < textures->count(); ++i) {
- if (textures->flags(i).testFlag(QPlatformTextureList::TextureIsSrgb)) {
- GLint cap = 0;
- funcs->glGetIntegerv(GL_FRAMEBUFFER_SRGB_CAPABLE, &cap);
- if (cap)
- canUseSrgb = true;
- break;
- }
- }
-
- // Textures for renderToTexture widgets.
- for (int i = 0; i < textures->count(); ++i) {
- if (!textures->flags(i).testFlag(QPlatformTextureList::StacksOnTop))
- blitTextureForWidget(textures, i, window, deviceWindowRect, d_ptr->blitter, offset, canUseSrgb);
- }
-
- // Backingstore texture with the normal widgets.
- GLuint textureId = 0;
- QOpenGLTextureBlitter::Origin origin = QOpenGLTextureBlitter::OriginTopLeft;
- if (QPlatformGraphicsBuffer *graphicsBuffer = this->graphicsBuffer()) {
- if (graphicsBuffer->size() != d_ptr->textureSize) {
- if (d_ptr->textureId)
- funcs->glDeleteTextures(1, &d_ptr->textureId);
- funcs->glGenTextures(1, &d_ptr->textureId);
- funcs->glBindTexture(GL_TEXTURE_2D, d_ptr->textureId);
- QOpenGLContext *ctx = QOpenGLContext::currentContext();
- if (!ctx->isOpenGLES() || ctx->format().majorVersion() >= 3) {
- funcs->glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_BASE_LEVEL, 0);
- funcs->glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAX_LEVEL, 0);
- }
- funcs->glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
- funcs->glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
- funcs->glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);
- funcs->glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);
-
- if (QPlatformGraphicsBufferHelper::lockAndBindToTexture(graphicsBuffer, &d_ptr->needsSwizzle, &d_ptr->premultiplied)) {
- d_ptr->textureSize = graphicsBuffer->size();
- } else {
- d_ptr->textureSize = QSize(0,0);
- }
-
- graphicsBuffer->unlock();
- } else if (!region.isEmpty()){
- funcs->glBindTexture(GL_TEXTURE_2D, d_ptr->textureId);
- QPlatformGraphicsBufferHelper::lockAndBindToTexture(graphicsBuffer, &d_ptr->needsSwizzle, &d_ptr->premultiplied);
- graphicsBuffer->unlock();
- }
-
- if (graphicsBuffer->origin() == QPlatformGraphicsBuffer::OriginBottomLeft)
- origin = QOpenGLTextureBlitter::OriginBottomLeft;
- textureId = d_ptr->textureId;
- } else {
- TextureFlags flags;
- textureId = toTexture(deviceRegion(region, window, offset), &d_ptr->textureSize, &flags);
- d_ptr->needsSwizzle = (flags & TextureSwizzle) != 0;
- d_ptr->premultiplied = (flags & TexturePremultiplied) != 0;
- if (flags & TextureFlip)
- origin = QOpenGLTextureBlitter::OriginBottomLeft;
- }
-
- funcs->glEnable(GL_BLEND);
- if (d_ptr->premultiplied)
- funcs->glBlendFuncSeparate(GL_ONE, GL_ONE_MINUS_SRC_ALPHA, GL_ONE, GL_ONE);
- else
- funcs->glBlendFuncSeparate(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA, GL_ONE, GL_ONE);
-
- if (textureId) {
- if (d_ptr->needsSwizzle)
- d_ptr->blitter->setRedBlueSwizzle(true);
- // The backingstore is for the entire tlw.
- // In case of native children offset tells the position relative to the tlw.
- const QRect srcRect = toBottomLeftRect(deviceWindowRect.translated(deviceWindowOffset), d_ptr->textureSize.height());
- const QMatrix3x3 source = QOpenGLTextureBlitter::sourceTransform(srcRect,
- d_ptr->textureSize,
- origin);
- d_ptr->blitter->blit(textureId, QMatrix4x4(), source);
- if (d_ptr->needsSwizzle)
- d_ptr->blitter->setRedBlueSwizzle(false);
- }
-
- // Textures for renderToTexture widgets that have WA_AlwaysStackOnTop set.
- bool blendIsPremultiplied = d_ptr->premultiplied;
- for (int i = 0; i < textures->count(); ++i) {
- const QPlatformTextureList::Flags flags = textures->flags(i);
- if (flags.testFlag(QPlatformTextureList::NeedsPremultipliedAlphaBlending)) {
- if (!blendIsPremultiplied) {
- funcs->glBlendFuncSeparate(GL_ONE, GL_ONE_MINUS_SRC_ALPHA, GL_ONE, GL_ONE);
- blendIsPremultiplied = true;
- }
- } else {
- if (blendIsPremultiplied) {
- funcs->glBlendFuncSeparate(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA, GL_ONE, GL_ONE);
- blendIsPremultiplied = false;
- }
- }
- if (flags.testFlag(QPlatformTextureList::StacksOnTop))
- blitTextureForWidget(textures, i, window, deviceWindowRect, d_ptr->blitter, offset, canUseSrgb);
- }
-
- funcs->glDisable(GL_BLEND);
- d_ptr->blitter->release();
-
- d_ptr->context->swapBuffers(window);
+ \sa flush()
+ */
+QPlatformBackingStore::FlushResult QPlatformBackingStore::rhiFlush(QWindow *window,
+ qreal sourceDevicePixelRatio,
+ const QRegion &region,
+ const QPoint &offset,
+ QPlatformTextureList *textures,
+ bool translucentBackground)
+{
+ return d_ptr->compositor.flush(this, d_ptr->rhiSupport.rhi(), d_ptr->rhiSupport.swapChainForWindow(window),
+ window, sourceDevicePixelRatio, region, offset, textures, translucentBackground);
}
-#endif
+
/*!
Implemented in subclasses to return the content of the backingstore as a QImage.
- If QPlatformIntegration::RasterGLSurface is supported, either this function or
+ If composition via a 3D graphics API is supported, either this function or
toTexture() must be implemented.
+ The returned image is only valid until the next operation (resize, paint, scroll,
+ or flush) on the backingstore. The caller must not store the return value between
+ calls, but instead call this function before each use, or make an explicit copy.
+
\sa toTexture()
*/
QImage QPlatformBackingStore::toImage() const
{
return QImage();
}
-#ifndef QT_NO_OPENGL
+
/*!
May be reimplemented in subclasses to return the content of the
- backingstore as an OpenGL texture. \a dirtyRegion is the part of the
+ backingstore as an QRhiTexture. \a dirtyRegion is the part of the
backingstore which may have changed since the last call to this function. The
caller of this function must ensure that there is a current context.
- The size of the texture is returned in \a textureSize.
-
The ownership of the texture is not transferred. The caller must not store
the return value between calls, but instead call this function before each use.
- The default implementation returns a cached texture if \a dirtyRegion is empty and
- \a textureSize matches the backingstore size, otherwise it retrieves the content using
- toImage() and performs a texture upload. This works only if the value of \a textureSize
- is preserved between the calls to this function.
+ The default implementation returns a cached texture if \a dirtyRegion is
+ empty and the existing texture's size matches the backingstore size,
+ otherwise it retrieves the content using toImage() and performs a texture
+ upload.
If the red and blue components have to swapped, \a flags will be set to include \c
TextureSwizzle. This allows creating textures from images in formats like
@@ -521,142 +257,12 @@ QImage QPlatformBackingStore::toImage() const
\note \a dirtyRegion is relative to the backingstore so no adjustment is needed.
*/
-GLuint QPlatformBackingStore::toTexture(const QRegion &dirtyRegion, QSize *textureSize, TextureFlags *flags) const
-{
- Q_ASSERT(textureSize);
- Q_ASSERT(flags);
-
- QImage image = toImage();
- QSize imageSize = image.size();
-
- QOpenGLContext *ctx = QOpenGLContext::currentContext();
- GLenum internalFormat = GL_RGBA;
- GLuint pixelType = GL_UNSIGNED_BYTE;
-
- bool needsConversion = false;
- *flags = { };
- switch (image.format()) {
- case QImage::Format_ARGB32_Premultiplied:
- *flags |= TexturePremultiplied;
- Q_FALLTHROUGH();
- case QImage::Format_RGB32:
- case QImage::Format_ARGB32:
- *flags |= TextureSwizzle;
- break;
- case QImage::Format_RGBA8888_Premultiplied:
- *flags |= TexturePremultiplied;
- Q_FALLTHROUGH();
- case QImage::Format_RGBX8888:
- case QImage::Format_RGBA8888:
- break;
- case QImage::Format_BGR30:
- case QImage::Format_A2BGR30_Premultiplied:
- if (!ctx->isOpenGLES() || ctx->format().majorVersion() >= 3) {
- pixelType = GL_UNSIGNED_INT_2_10_10_10_REV;
- internalFormat = GL_RGB10_A2;
- *flags |= TexturePremultiplied;
- } else {
- needsConversion = true;
- }
- break;
- case QImage::Format_RGB30:
- case QImage::Format_A2RGB30_Premultiplied:
- if (!ctx->isOpenGLES() || ctx->format().majorVersion() >= 3) {
- pixelType = GL_UNSIGNED_INT_2_10_10_10_REV;
- internalFormat = GL_RGB10_A2;
- *flags |= TextureSwizzle | TexturePremultiplied;
- } else {
- needsConversion = true;
- }
- break;
- default:
- needsConversion = true;
- break;
- }
- if (imageSize.isEmpty()) {
- *textureSize = imageSize;
- return 0;
- }
-
- // Must rely on the input only, not d_ptr.
- // With the default composeAndFlush() textureSize is &d_ptr->textureSize.
- bool resized = *textureSize != imageSize;
- if (dirtyRegion.isEmpty() && !resized)
- return d_ptr->textureId;
-
- *textureSize = imageSize;
-
- if (needsConversion)
- image = image.convertToFormat(QImage::Format_RGBA8888);
-
- // The image provided by the backingstore may have a stride larger than width * 4, for
- // instance on platforms that manually implement client-side decorations.
- static const int bytesPerPixel = 4;
- const int strideInPixels = image.bytesPerLine() / bytesPerPixel;
- const bool hasUnpackRowLength = !ctx->isOpenGLES() || ctx->format().majorVersion() >= 3;
-
- QOpenGLFunctions *funcs = ctx->functions();
-
- if (hasUnpackRowLength) {
- funcs->glPixelStorei(GL_UNPACK_ROW_LENGTH, strideInPixels);
- } else if (strideInPixels != image.width()) {
- // No UNPACK_ROW_LENGTH on ES 2.0 and yet we would need it. This case is typically
- // hit with QtWayland which is rarely used in combination with a ES2.0-only GL
- // implementation. Therefore, accept the performance hit and do a copy.
- image = image.copy();
- }
-
- if (resized) {
- if (d_ptr->textureId)
- funcs->glDeleteTextures(1, &d_ptr->textureId);
- funcs->glGenTextures(1, &d_ptr->textureId);
- funcs->glBindTexture(GL_TEXTURE_2D, d_ptr->textureId);
- if (!ctx->isOpenGLES() || ctx->format().majorVersion() >= 3) {
- funcs->glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_BASE_LEVEL, 0);
- funcs->glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAX_LEVEL, 0);
- }
- funcs->glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
- funcs->glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
- funcs->glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);
- funcs->glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);
-
- funcs->glTexImage2D(GL_TEXTURE_2D, 0, internalFormat, imageSize.width(), imageSize.height(), 0, GL_RGBA, pixelType,
- const_cast<uchar*>(image.constBits()));
- } else {
- funcs->glBindTexture(GL_TEXTURE_2D, d_ptr->textureId);
- QRect imageRect = image.rect();
- QRect rect = dirtyRegion.boundingRect() & imageRect;
-
- if (hasUnpackRowLength) {
- funcs->glTexSubImage2D(GL_TEXTURE_2D, 0, rect.x(), rect.y(), rect.width(), rect.height(), GL_RGBA, pixelType,
- image.constScanLine(rect.y()) + rect.x() * bytesPerPixel);
- } else {
- // if the rect is wide enough it's cheaper to just
- // extend it instead of doing an image copy
- if (rect.width() >= imageRect.width() / 2) {
- rect.setX(0);
- rect.setWidth(imageRect.width());
- }
-
- // if the sub-rect is full-width we can pass the image data directly to
- // OpenGL instead of copying, since there's no gap between scanlines
-
- if (rect.width() == imageRect.width()) {
- funcs->glTexSubImage2D(GL_TEXTURE_2D, 0, 0, rect.y(), rect.width(), rect.height(), GL_RGBA, pixelType,
- image.constScanLine(rect.y()));
- } else {
- funcs->glTexSubImage2D(GL_TEXTURE_2D, 0, rect.x(), rect.y(), rect.width(), rect.height(), GL_RGBA, pixelType,
- image.copy(rect).constBits());
- }
- }
- }
-
- if (hasUnpackRowLength)
- funcs->glPixelStorei(GL_UNPACK_ROW_LENGTH, 0);
-
- return d_ptr->textureId;
+QRhiTexture *QPlatformBackingStore::toTexture(QRhiResourceUpdateBatch *resourceUpdates,
+ const QRegion &dirtyRegion,
+ TextureFlags *flags) const
+{
+ return d_ptr->compositor.toTexture(this, d_ptr->rhiSupport.rhi(), resourceUpdates, dirtyRegion, flags);
}
-#endif // QT_NO_OPENGL
/*!
\fn QPaintDevice* QPlatformBackingStore::paintDevice()
@@ -750,4 +356,36 @@ bool QPlatformBackingStore::scroll(const QRegion &area, int dx, int dy)
return false;
}
+void QPlatformBackingStore::setRhiConfig(const QPlatformBackingStoreRhiConfig &config)
+{
+ if (!config.isEnabled())
+ return;
+
+ d_ptr->rhiSupport.setConfig(config);
+ d_ptr->rhiSupport.setWindow(d_ptr->window);
+ d_ptr->rhiSupport.setFormat(d_ptr->window->format());
+ d_ptr->rhiSupport.create();
+}
+
+QRhi *QPlatformBackingStore::rhi() const
+{
+ // Returning null is valid, and means this is not a QRhi-capable backingstore.
+ return d_ptr->rhiSupport.rhi();
+}
+
+void QPlatformBackingStore::graphicsDeviceReportedLost()
+{
+ if (!d_ptr->rhiSupport.rhi())
+ return;
+
+ qWarning("Rhi backingstore: graphics device lost, attempting to reinitialize");
+ d_ptr->compositor.reset();
+ d_ptr->rhiSupport.reset();
+ d_ptr->rhiSupport.create();
+ if (!d_ptr->rhiSupport.rhi())
+ qWarning("Rhi backingstore: failed to reinitialize after losing the device");
+}
+
QT_END_NAMESPACE
+
+#include "moc_qplatformbackingstore.cpp"
diff --git a/src/gui/painting/qplatformbackingstore.h b/src/gui/painting/qplatformbackingstore.h
index 7aa054f1e2..1d55e9ab6a 100644
--- a/src/gui/painting/qplatformbackingstore.h
+++ b/src/gui/painting/qplatformbackingstore.h
@@ -1,41 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the QtGui module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#ifndef QPLATFORMBACKINGSTORE_H
#define QPLATFORMBACKINGSTORE_H
@@ -56,24 +20,71 @@
#include <QtGui/qwindow.h>
#include <QtGui/qregion.h>
-#include <QtGui/qopengl.h>
QT_BEGIN_NAMESPACE
-Q_GUI_EXPORT Q_DECLARE_LOGGING_CATEGORY(lcQpaBackingStore)
+Q_DECLARE_EXPORTED_LOGGING_CATEGORY(lcQpaBackingStore, Q_GUI_EXPORT)
class QRegion;
class QRect;
class QPoint;
class QImage;
class QPlatformBackingStorePrivate;
-class QPlatformWindow;
class QPlatformTextureList;
class QPlatformTextureListPrivate;
-class QOpenGLContext;
class QPlatformGraphicsBuffer;
+class QRhi;
+class QRhiTexture;
+class QRhiResourceUpdateBatch;
+
+struct Q_GUI_EXPORT QPlatformBackingStoreRhiConfig
+{
+ enum Api {
+ OpenGL,
+ Metal,
+ Vulkan,
+ D3D11,
+ D3D12,
+ Null
+ };
+
+ QPlatformBackingStoreRhiConfig()
+ : m_enable(false)
+ { }
+
+ QPlatformBackingStoreRhiConfig(Api api)
+ : m_enable(true),
+ m_api(api)
+ { }
+
+ bool isEnabled() const { return m_enable; }
+ void setEnabled(bool enable) { m_enable = enable; }
+
+ Api api() const { return m_api; }
+ void setApi(Api api) { m_api = api; }
+
+ bool isDebugLayerEnabled() const { return m_debugLayer; }
+ void setDebugLayer(bool enable) { m_debugLayer = enable; }
+
+private:
+ bool m_enable;
+ Api m_api = Null;
+ bool m_debugLayer = false;
+ friend bool operator==(const QPlatformBackingStoreRhiConfig &a, const QPlatformBackingStoreRhiConfig &b);
+};
+
+inline bool operator==(const QPlatformBackingStoreRhiConfig &a, const QPlatformBackingStoreRhiConfig &b)
+{
+ return a.m_enable == b.m_enable
+ && a.m_api == b.m_api
+ && a.m_debugLayer == b.m_debugLayer;
+}
+
+inline bool operator!=(const QPlatformBackingStoreRhiConfig &a, const QPlatformBackingStoreRhiConfig &b)
+{
+ return !(a == b);
+}
-#ifndef QT_NO_OPENGL
class Q_GUI_EXPORT QPlatformTextureList : public QObject
{
Q_OBJECT
@@ -82,7 +93,8 @@ public:
enum Flag {
StacksOnTop = 0x01,
TextureIsSrgb = 0x02,
- NeedsPremultipliedAlphaBlending = 0x04
+ NeedsPremultipliedAlphaBlending = 0x04,
+ MirrorVertically = 0x08
};
Q_DECLARE_FLAGS(Flags, Flag)
@@ -91,7 +103,8 @@ public:
int count() const;
bool isEmpty() const { return count() == 0; }
- GLuint textureId(int index) const;
+ QRhiTexture *texture(int index) const;
+ QRhiTexture *textureExtra(int index) const;
QRect geometry(int index) const;
QRect clipRect(int index) const;
void *source(int index);
@@ -99,7 +112,10 @@ public:
void lock(bool on);
bool isLocked() const;
- void appendTexture(void *source, GLuint textureId, const QRect &geometry,
+ void appendTexture(void *source, QRhiTexture *texture, const QRect &geometry,
+ const QRect &clipRect = QRect(), Flags flags = { });
+
+ void appendTexture(void *source, QRhiTexture *textureLeft, QRhiTexture *textureRight, const QRect &geometry,
const QRect &clipRect = QRect(), Flags flags = { });
void clear();
@@ -107,11 +123,16 @@ public:
void locked(bool);
};
Q_DECLARE_OPERATORS_FOR_FLAGS(QPlatformTextureList::Flags)
-#endif
class Q_GUI_EXPORT QPlatformBackingStore
{
public:
+ enum FlushResult {
+ FlushSuccess,
+ FlushFailed,
+ FlushFailedDueToLostDevice
+ };
+
explicit QPlatformBackingStore(QWindow *window);
virtual ~QPlatformBackingStore();
@@ -120,22 +141,26 @@ public:
virtual QPaintDevice *paintDevice() = 0;
- virtual void flush(QWindow *window, const QRegion &region, const QPoint &offset) = 0;
-#ifndef QT_NO_OPENGL
- virtual void composeAndFlush(QWindow *window, const QRegion &region, const QPoint &offset,
+ virtual void flush(QWindow *window, const QRegion &region, const QPoint &offset);
+
+ virtual FlushResult rhiFlush(QWindow *window,
+ qreal sourceDevicePixelRatio,
+ const QRegion &region,
+ const QPoint &offset,
QPlatformTextureList *textures,
bool translucentBackground);
-#endif
+
virtual QImage toImage() const;
-#ifndef QT_NO_OPENGL
+
enum TextureFlag {
TextureSwizzle = 0x01,
TextureFlip = 0x02,
- TexturePremultiplied = 0x04,
+ TexturePremultiplied = 0x04
};
Q_DECLARE_FLAGS(TextureFlags, TextureFlag)
- virtual GLuint toTexture(const QRegion &dirtyRegion, QSize *textureSize, TextureFlags *flags) const;
-#endif
+ virtual QRhiTexture *toTexture(QRhiResourceUpdateBatch *resourceUpdates,
+ const QRegion &dirtyRegion,
+ TextureFlags *flags) const;
virtual QPlatformGraphicsBuffer *graphicsBuffer() const;
@@ -146,6 +171,11 @@ public:
virtual void beginPaint(const QRegion &);
virtual void endPaint();
+ void setRhiConfig(const QPlatformBackingStoreRhiConfig &config);
+ QRhi *rhi() const;
+ void surfaceAboutToBeDestroyed();
+ void graphicsDeviceReportedLost();
+
private:
QPlatformBackingStorePrivate *d_ptr;
@@ -153,9 +183,7 @@ private:
friend class QBackingStore;
};
-#ifndef QT_NO_OPENGL
Q_DECLARE_OPERATORS_FOR_FLAGS(QPlatformBackingStore::TextureFlags)
-#endif
QT_END_NAMESPACE
diff --git a/src/gui/painting/qpolygon.cpp b/src/gui/painting/qpolygon.cpp
index 3bf6004fcc..d615245eb4 100644
--- a/src/gui/painting/qpolygon.cpp
+++ b/src/gui/painting/qpolygon.cpp
@@ -1,48 +1,12 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the QtGui module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#include "qpolygon.h"
#include "qrect.h"
#include "qdatastream.h"
-#include "qmatrix.h"
#include "qdebug.h"
#include "qpainterpath.h"
+#include "qtransform.h"
#include "qvariant.h"
#include "qpainterpath_p.h"
#include "qbezier_p.h"
@@ -84,7 +48,7 @@ static void qt_polygon_isect_line(const QPointF &p1, const QPointF &p2, const QP
/*!
\class QPolygon
- \brief The QPolygon class provides a vector of points using
+ \brief The QPolygon class provides a list of points using
integer precision.
\inmodule QtGui
@@ -93,13 +57,13 @@ static void qt_polygon_isect_line(const QPointF &p1, const QPointF &p2, const QP
\ingroup painting
\ingroup shared
- A QPolygon object is a QVector<QPoint>. The easiest way to add
- points to a QPolygon is to use QVector's streaming operator, as
+ A QPolygon object is a QList<QPoint>. The easiest way to add
+ points to a QPolygon is to use QList's streaming operator, as
illustrated below:
\snippet polygon/polygon.cpp 0
- In addition to the functions provided by QVector, QPolygon
+ In addition to the functions provided by QList, QPolygon
provides some point-specific functions.
Each point in a polygon can be retrieved by passing its index to
@@ -111,13 +75,13 @@ static void qt_polygon_isect_line(const QPointF &p1, const QPointF &p2, const QP
from a specified index (resizing the polygon if necessary).
QPolygon provides the boundingRect() and translate() functions for
- geometry functions. Use the QMatrix::map() function for more
+ geometry functions. Use the QTransform::map() function for more
general transformations of QPolygons.
The QPolygon class is \l {Implicit Data Sharing}{implicitly
shared}.
- \sa QVector, QPolygonF, QLine
+ \sa QList, QPolygonF, QLine
*/
@@ -130,28 +94,11 @@ static void qt_polygon_isect_line(const QPointF &p1, const QPointF &p2, const QP
Constructs a polygon with no points.
- \sa QVector::isEmpty()
+ \sa QList::isEmpty()
*/
/*!
- \fn QPolygon::QPolygon(int size)
-
- Constructs a polygon of the given \a size. Creates an empty
- polygon if \a size == 0.
-
- \sa QVector::isEmpty()
-*/
-
-/*!
- \fn QPolygon::QPolygon(const QPolygon &polygon)
-
- Constructs a copy of the given \a polygon.
-
- \sa setPoints()
-*/
-
-/*!
- \fn QPolygon::QPolygon(const QVector<QPoint> &points)
+ \fn QPolygon::QPolygon(const QList<QPoint> &points)
Constructs a polygon containing the specified \a points.
@@ -197,14 +144,6 @@ QPolygon::QPolygon(int nPoints, const int *points)
setPoints(nPoints, points);
}
-
-/*!
- \fn QPolygon::~QPolygon()
-
- Destroys the polygon.
-*/
-
-
/*!
Translates all points in the polygon by (\a{dx}, \a{dy}).
@@ -288,13 +227,16 @@ void QPolygon::point(int index, int *x, int *y) const
*/
/*!
- \fn void QPolygon::setPoint(int index, int x, int y)
-
Sets the point at the given \a index to the point specified by
(\a{x}, \a{y}).
\sa point(), putPoints(), setPoints(),
*/
+void QPolygon::setPoint(int index, int x, int y)
+{
+ (*this)[index] = QPoint(x, y);
+}
+
/*!
Resizes the polygon to \a nPoints and populates it with the given
@@ -438,7 +380,7 @@ void QPolygon::putPoints(int index, int nPoints, const QPolygon & from, int from
Returns the bounding rectangle of the polygon, or QRect(0, 0, 0,
0) if the polygon is empty.
- \sa QVector::isEmpty()
+ \sa QList::isEmpty()
*/
QRect QPolygon::boundingRect() const
@@ -464,22 +406,27 @@ QRect QPolygon::boundingRect() const
return QRect(QPoint(minx,miny), QPoint(maxx,maxy));
}
+/*!
+ \fn QPolygon::toPolygonF() const
+ \since 6.4
+
+ Returns this polygon as a polygon with floating point accuracy.
+
+ \sa QPolygonF::toPolygon()
+*/
+
+
#ifndef QT_NO_DEBUG_STREAM
QDebug operator<<(QDebug dbg, const QPolygon &a)
{
- QDebugStateSaver saver(dbg);
- dbg.nospace() << "QPolygon(";
- for (int i = 0; i < a.count(); ++i)
- dbg.nospace() << a.at(i);
- dbg.nospace() << ')';
- return dbg;
+ return QtPrivate::printSequentialContainer(dbg, "QPolygon", a);
}
#endif
/*!
\class QPolygonF
- \brief The QPolygonF class provides a vector of points using
+ \brief The QPolygonF class provides a list of points using
floating point precision.
\inmodule QtGui
@@ -487,15 +434,15 @@ QDebug operator<<(QDebug dbg, const QPolygon &a)
\ingroup painting
\ingroup shared
- A QPolygonF is a QVector<QPointF>. The easiest way to add points
+ A QPolygonF is a QList<QPointF>. The easiest way to add points
to a QPolygonF is to use its streaming operator, as illustrated
below:
\snippet polygon/polygon.cpp 1
- In addition to the functions provided by QVector, QPolygonF
+ In addition to the functions provided by QList, QPolygonF
provides the boundingRect() and translate() functions for geometry
- operations. Use the QMatrix::map() function for more general
+ operations. Use the QTransform::map() function for more general
transformations of QPolygonFs.
QPolygonF also provides the isClosed() function to determine
@@ -506,7 +453,7 @@ QDebug operator<<(QDebug dbg, const QPolygon &a)
The QPolygonF class is \l {Implicit Data Sharing}{implicitly
shared}.
- \sa QVector, QPolygon, QLineF
+ \sa QList, QPolygon, QLineF
*/
@@ -519,26 +466,11 @@ QDebug operator<<(QDebug dbg, const QPolygon &a)
Constructs a polygon with no points.
- \sa QVector::isEmpty()
+ \sa QList::isEmpty()
*/
/*!
- \fn QPolygonF::QPolygonF(int size)
-
- Constructs a polygon of the given \a size. Creates an empty
- polygon if \a size == 0.
-
- \sa QVector::isEmpty()
-*/
-
-/*!
- \fn QPolygonF::QPolygonF(const QPolygonF &polygon)
-
- Constructs a copy of the given \a polygon.
-*/
-
-/*!
- \fn QPolygonF::QPolygonF(const QVector<QPointF> &points)
+ \fn QPolygonF::QPolygonF(const QList<QPointF> &points)
Constructs a polygon containing the specified \a points.
*/
@@ -581,13 +513,6 @@ QPolygonF::QPolygonF(const QPolygon &a)
}
/*!
- \fn QPolygonF::~QPolygonF()
-
- Destroys the polygon.
-*/
-
-
-/*!
Translate all points in the polygon by the given \a offset.
\sa translated()
@@ -645,14 +570,14 @@ QPolygonF QPolygonF::translated(const QPointF &offset) const
A polygon is said to be closed if its start point and end point are equal.
- \sa QVector::first(), QVector::last()
+ \sa QList::first(), QList::last()
*/
/*!
Returns the bounding rectangle of the polygon, or QRectF(0,0,0,0)
if the polygon is empty.
- \sa QVector::isEmpty()
+ \sa QList::isEmpty()
*/
QRectF QPolygonF::boundingRect() const
@@ -716,7 +641,7 @@ QPolygon QPolygonF::toPolygon() const
*/
QPolygon::operator QVariant() const
{
- return QVariant(QVariant::Polygon, this);
+ return QVariant::fromValue(*this);
}
/*****************************************************************************
@@ -735,7 +660,7 @@ QPolygon::operator QVariant() const
*/
QDataStream &operator<<(QDataStream &s, const QPolygon &a)
{
- const QVector<QPoint> &v = a;
+ const QList<QPoint> &v = a;
return s << v;
}
@@ -751,7 +676,7 @@ QDataStream &operator<<(QDataStream &s, const QPolygon &a)
*/
QDataStream &operator>>(QDataStream &s, QPolygon &a)
{
- QVector<QPoint> &v = a;
+ QList<QPoint> &v = a;
return s >> v;
}
#endif // QT_NO_DATASTREAM
@@ -772,13 +697,7 @@ QDataStream &operator>>(QDataStream &s, QPolygon &a)
QDataStream &operator<<(QDataStream &s, const QPolygonF &a)
{
- quint32 len = a.size();
- uint i;
-
- s << len;
- for (i = 0; i < len; ++i)
- s << a.at(i);
- return s;
+ return s << static_cast<const QList<QPointF> &>(a);
}
/*!
@@ -793,29 +712,14 @@ QDataStream &operator<<(QDataStream &s, const QPolygonF &a)
QDataStream &operator>>(QDataStream &s, QPolygonF &a)
{
- quint32 len;
- uint i;
-
- s >> len;
- a.reserve(a.size() + (int)len);
- QPointF p;
- for (i = 0; i < len; ++i) {
- s >> p;
- a.insert(i, p);
- }
- return s;
+ return s >> static_cast<QList<QPointF> &>(a);
}
#endif //QT_NO_DATASTREAM
#ifndef QT_NO_DEBUG_STREAM
QDebug operator<<(QDebug dbg, const QPolygonF &a)
{
- QDebugStateSaver saver(dbg);
- dbg.nospace() << "QPolygonF(";
- for (int i = 0; i < a.count(); ++i)
- dbg.nospace() << a.at(i);
- dbg.nospace() << ')';
- return dbg;
+ return QtPrivate::printSequentialContainer(dbg, "QPolygonF", a);
}
#endif
@@ -1040,7 +944,7 @@ bool QPolygonF::intersects(const QPolygonF &p) const
QPolygonF::operator QVariant() const
{
- return QVariant(QMetaType::QPolygonF, this);
+ return QVariant::fromValue(*this);
}
QT_END_NAMESPACE
diff --git a/src/gui/painting/qpolygon.h b/src/gui/painting/qpolygon.h
index 93fab55aa1..f2f5d48395 100644
--- a/src/gui/painting/qpolygon.h
+++ b/src/gui/painting/qpolygon.h
@@ -1,105 +1,66 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the QtGui module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#ifndef QPOLYGON_H
#define QPOLYGON_H
#include <QtGui/qtguiglobal.h>
-#include <QtCore/qvector.h>
+#include <QtCore/qlist.h>
#include <QtCore/qpoint.h>
#include <QtCore/qrect.h>
QT_BEGIN_NAMESPACE
-
-class QMatrix;
class QTransform;
class QRect;
class QVariant;
-class Q_GUI_EXPORT QPolygon : public QVector<QPoint>
+class QPolygonF;
+
+// We export each out-of-line method individually to prevent MSVC from
+// exporting the whole QList class.
+class QPolygon : public QList<QPoint>
{
public:
- inline QPolygon() {}
- inline ~QPolygon() {}
- inline explicit QPolygon(int size);
- inline /*implicit*/ QPolygon(const QVector<QPoint> &v) : QVector<QPoint>(v) {}
- /*implicit*/ QPolygon(QVector<QPoint> &&v) noexcept : QVector<QPoint>(std::move(v)) {}
- QPolygon(const QRect &r, bool closed=false);
- QPolygon(int nPoints, const int *points);
- QPolygon(const QPolygon &other) : QVector<QPoint>(other) {}
- QPolygon(QPolygon &&other) noexcept : QVector<QPoint>(std::move(other)) {}
- QPolygon &operator=(QPolygon &&other) noexcept { swap(other); return *this; }
- QPolygon &operator=(const QPolygon &other) { QVector<QPoint>::operator=(other); return *this; }
- void swap(QPolygon &other) noexcept { QVector<QPoint>::swap(other); } // prevent QVector<QPoint><->QPolygon swaps
-
- operator QVariant() const;
-
- void translate(int dx, int dy);
+ using QList<QPoint>::QList;
+ QPolygon() = default;
+ Q_IMPLICIT QPolygon(const QList<QPoint> &v) : QList<QPoint>(v) { }
+ Q_IMPLICIT QPolygon(QList<QPoint> &&v) noexcept : QList<QPoint>(std::move(v)) { }
+ Q_IMPLICIT Q_GUI_EXPORT QPolygon(const QRect &r, bool closed=false);
+ Q_GUI_EXPORT QPolygon(int nPoints, const int *points);
+ void swap(QPolygon &other) noexcept { QList<QPoint>::swap(other); } // prevent QList<QPoint><->QPolygon swaps
+
+ Q_GUI_EXPORT operator QVariant() const;
+
+ Q_GUI_EXPORT void translate(int dx, int dy);
void translate(const QPoint &offset);
- Q_REQUIRED_RESULT QPolygon translated(int dx, int dy) const;
- Q_REQUIRED_RESULT inline QPolygon translated(const QPoint &offset) const;
+ [[nodiscard]] Q_GUI_EXPORT QPolygon translated(int dx, int dy) const;
+ [[nodiscard]] inline QPolygon translated(const QPoint &offset) const;
- QRect boundingRect() const;
+ Q_GUI_EXPORT QRect boundingRect() const;
- void point(int i, int *x, int *y) const;
+ Q_GUI_EXPORT void point(int i, int *x, int *y) const;
QPoint point(int i) const;
- void setPoint(int index, int x, int y);
- void setPoint(int index, const QPoint &p);
- void setPoints(int nPoints, const int *points);
- void setPoints(int nPoints, int firstx, int firsty, ...);
- void putPoints(int index, int nPoints, const int *points);
- void putPoints(int index, int nPoints, int firstx, int firsty, ...);
- void putPoints(int index, int nPoints, const QPolygon & from, int fromIndex=0);
+ Q_GUI_EXPORT void setPoint(int index, int x, int y);
+ inline void setPoint(int index, const QPoint &p);
+ Q_GUI_EXPORT void setPoints(int nPoints, const int *points);
+ Q_GUI_EXPORT void setPoints(int nPoints, int firstx, int firsty, ...);
+ Q_GUI_EXPORT void putPoints(int index, int nPoints, const int *points);
+ Q_GUI_EXPORT void putPoints(int index, int nPoints, int firstx, int firsty, ...);
+ Q_GUI_EXPORT void putPoints(int index, int nPoints, const QPolygon & from, int fromIndex=0);
- bool containsPoint(const QPoint &pt, Qt::FillRule fillRule) const;
+ Q_GUI_EXPORT bool containsPoint(const QPoint &pt, Qt::FillRule fillRule) const;
- Q_REQUIRED_RESULT QPolygon united(const QPolygon &r) const;
- Q_REQUIRED_RESULT QPolygon intersected(const QPolygon &r) const;
- Q_REQUIRED_RESULT QPolygon subtracted(const QPolygon &r) const;
+ [[nodiscard]] Q_GUI_EXPORT QPolygon united(const QPolygon &r) const;
+ [[nodiscard]] Q_GUI_EXPORT QPolygon intersected(const QPolygon &r) const;
+ [[nodiscard]] Q_GUI_EXPORT QPolygon subtracted(const QPolygon &r) const;
- bool intersects(const QPolygon &r) const;
-};
-Q_DECLARE_SHARED_NOT_MOVABLE_UNTIL_QT6(QPolygon)
+ Q_GUI_EXPORT bool intersects(const QPolygon &r) const;
-inline QPolygon::QPolygon(int asize) : QVector<QPoint>(asize) {}
+ [[nodiscard]] inline QPolygonF toPolygonF() const;
+};
+Q_DECLARE_SHARED(QPolygon)
#ifndef QT_NO_DEBUG_STREAM
Q_GUI_EXPORT QDebug operator<<(QDebug, const QPolygon &);
@@ -118,10 +79,7 @@ Q_GUI_EXPORT QDataStream &operator>>(QDataStream &stream, QPolygon &polygon);
*****************************************************************************/
inline void QPolygon::setPoint(int index, const QPoint &pt)
-{ (*this)[index] = pt; }
-
-inline void QPolygon::setPoint(int index, int x, int y)
-{ (*this)[index] = QPoint(x, y); }
+{ setPoint(index, pt.x(), pt.y()); }
inline QPoint QPolygon::point(int index) const
{ return at(index); }
@@ -134,47 +92,42 @@ inline QPolygon QPolygon::translated(const QPoint &offset) const
class QRectF;
-class Q_GUI_EXPORT QPolygonF : public QVector<QPointF>
+class QPolygonF : public QList<QPointF>
{
public:
- inline QPolygonF() {}
- inline ~QPolygonF() {}
- inline explicit QPolygonF(int size);
- inline /*implicit*/ QPolygonF(const QVector<QPointF> &v) : QVector<QPointF>(v) {}
- /* implicit */ QPolygonF(QVector<QPointF> &&v) noexcept : QVector<QPointF>(std::move(v)) {}
- QPolygonF(const QRectF &r);
- /*implicit*/ QPolygonF(const QPolygon &a);
- inline QPolygonF(const QPolygonF &a) : QVector<QPointF>(a) {}
- QPolygonF(QPolygonF &&other) noexcept : QVector<QPointF>(std::move(other)) {}
- QPolygonF &operator=(QPolygonF &&other) noexcept { swap(other); return *this; }
- QPolygonF &operator=(const QPolygonF &other) { QVector<QPointF>::operator=(other); return *this; }
- inline void swap(QPolygonF &other) { QVector<QPointF>::swap(other); } // prevent QVector<QPointF><->QPolygonF swaps
-
- operator QVariant() const;
+ using QList<QPointF>::QList;
+ QPolygonF() = default;
+ Q_IMPLICIT QPolygonF(const QList<QPointF> &v) : QList<QPointF>(v) { }
+ Q_IMPLICIT QPolygonF(QList<QPointF> &&v) noexcept : QList<QPointF>(std::move(v)) { }
+ Q_IMPLICIT Q_GUI_EXPORT QPolygonF(const QRectF &r);
+ Q_IMPLICIT Q_GUI_EXPORT QPolygonF(const QPolygon &a);
+ inline void swap(QPolygonF &other) { QList<QPointF>::swap(other); } // prevent QList<QPointF><->QPolygonF swaps
+
+ Q_GUI_EXPORT operator QVariant() const;
inline void translate(qreal dx, qreal dy);
- void translate(const QPointF &offset);
+ void Q_GUI_EXPORT translate(const QPointF &offset);
inline QPolygonF translated(qreal dx, qreal dy) const;
- Q_REQUIRED_RESULT QPolygonF translated(const QPointF &offset) const;
+ [[nodiscard]] Q_GUI_EXPORT QPolygonF translated(const QPointF &offset) const;
- QPolygon toPolygon() const;
+ QPolygon Q_GUI_EXPORT toPolygon() const;
bool isClosed() const { return !isEmpty() && first() == last(); }
- QRectF boundingRect() const;
+ QRectF Q_GUI_EXPORT boundingRect() const;
- bool containsPoint(const QPointF &pt, Qt::FillRule fillRule) const;
+ Q_GUI_EXPORT bool containsPoint(const QPointF &pt, Qt::FillRule fillRule) const;
- Q_REQUIRED_RESULT QPolygonF united(const QPolygonF &r) const;
- Q_REQUIRED_RESULT QPolygonF intersected(const QPolygonF &r) const;
- Q_REQUIRED_RESULT QPolygonF subtracted(const QPolygonF &r) const;
+ [[nodiscard]] Q_GUI_EXPORT QPolygonF united(const QPolygonF &r) const;
+ [[nodiscard]] Q_GUI_EXPORT QPolygonF intersected(const QPolygonF &r) const;
+ [[nodiscard]] Q_GUI_EXPORT QPolygonF subtracted(const QPolygonF &r) const;
- bool intersects(const QPolygonF &r) const;
+ Q_GUI_EXPORT bool intersects(const QPolygonF &r) const;
};
-Q_DECLARE_SHARED_NOT_MOVABLE_UNTIL_QT6(QPolygonF)
+Q_DECLARE_SHARED(QPolygonF)
-inline QPolygonF::QPolygonF(int asize) : QVector<QPointF>(asize) {}
+QPolygonF QPolygon::toPolygonF() const { return QPolygonF(*this); }
#ifndef QT_NO_DEBUG_STREAM
Q_GUI_EXPORT QDebug operator<<(QDebug, const QPolygonF &);
diff --git a/src/gui/painting/qpolygonclipper_p.h b/src/gui/painting/qpolygonclipper_p.h
deleted file mode 100644
index 04a31111c9..0000000000
--- a/src/gui/painting/qpolygonclipper_p.h
+++ /dev/null
@@ -1,316 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the QtGui module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef QPOLYGONCLIPPER_P_H
-#define QPOLYGONCLIPPER_P_H
-
-//
-// W A R N I N G
-// -------------
-//
-// This file is not part of the Qt API. It exists for the convenience
-// of other Qt classes. This header file may change from version to
-// version without notice, or even be removed.
-//
-// We mean it.
-//
-
-#include <QtGui/private/qtguiglobal_p.h>
-#include "private/qdatabuffer_p.h"
-
-QT_BEGIN_NAMESPACE
-
-/* based on sutherland-hodgman line-by-line clipping, as described in
- Computer Graphics and Principles */
-template <typename InType, typename OutType, typename CastType> class QPolygonClipper
-{
-public:
- QPolygonClipper() :
- buffer1(0), buffer2(0)
- {
- x1 = y1 = x2 = y2 = 0;
- }
-
- ~QPolygonClipper()
- {
- }
-
- void setBoundingRect(const QRect bounds)
- {
- x1 = bounds.x();
- x2 = bounds.x() + bounds.width();
- y1 = bounds.y();
- y2 = bounds.y() + bounds.height();
- }
-
- QRect boundingRect()
- {
- return QRect(QPoint(x1, y1), QPoint(x2, y2));
- }
-
- inline OutType intersectLeft(const OutType &p1, const OutType &p2)
- {
- OutType t;
- qreal dy = (p1.y - p2.y) / qreal(p1.x - p2.x);
- t.x = x1;
- t.y = static_cast<CastType>(p2.y + (x1 - p2.x) * dy);
- return t;
- }
-
-
- inline OutType intersectRight(const OutType &p1, const OutType &p2)
- {
- OutType t;
- qreal dy = (p1.y - p2.y) / qreal(p1.x - p2.x);
- t.x = x2;
- t.y = static_cast<CastType>(p2.y + (x2 - p2.x) * dy);
- return t;
- }
-
-
- inline OutType intersectTop(const OutType &p1, const OutType &p2)
- {
- OutType t;
- qreal dx = (p1.x - p2.x) / qreal(p1.y - p2.y);
- t.x = static_cast<CastType>(p2.x + (y1 - p2.y) * dx);
- t.y = y1;
- return t;
- }
-
-
- inline OutType intersectBottom(const OutType &p1, const OutType &p2)
- {
- OutType t;
- qreal dx = (p1.x - p2.x) / qreal(p1.y - p2.y);
- t.x = static_cast<CastType>(p2.x + (y2 - p2.y) * dx);
- t.y = y2;
- return t;
- }
-
-
- void clipPolygon(const InType *inPoints, int inCount, OutType **outPoints, int *outCount,
- bool closePolygon = true)
- {
- Q_ASSERT(outPoints);
- Q_ASSERT(outCount);
-
- if (inCount < 2) {
- *outCount = 0;
- return;
- }
-
- buffer1.reset();
- buffer2.reset();
-
- QDataBuffer<OutType> *source = &buffer1;
- QDataBuffer<OutType> *clipped = &buffer2;
-
- // Gather some info since we are iterating through the points anyway..
- bool doLeft = false, doRight = false, doTop = false, doBottom = false;
- OutType ot;
- for (int i=0; i<inCount; ++i) {
- ot = inPoints[i];
- clipped->add(ot);
-
- if (ot.x < x1)
- doLeft = true;
- else if (ot.x > x2)
- doRight = true;
- if (ot.y < y1)
- doTop = true;
- else if (ot.y > y2)
- doBottom = true;
- }
-
- if (doLeft && clipped->size() > 1) {
- QDataBuffer<OutType> *tmp = source;
- source = clipped;
- clipped = tmp;
- clipped->reset();
- int lastPos, start;
- if (closePolygon) {
- lastPos = source->size() - 1;
- start = 0;
- } else {
- lastPos = 0;
- start = 1;
- if (source->at(0).x >= x1)
- clipped->add(source->at(0));
- }
- for (int i=start; i<inCount; ++i) {
- const OutType &cpt = source->at(i);
- const OutType &ppt = source->at(lastPos);
-
- if (cpt.x >= x1) {
- if (ppt.x >= x1) {
- clipped->add(cpt);
- } else {
- clipped->add(intersectLeft(cpt, ppt));
- clipped->add(cpt);
- }
- } else if (ppt.x >= x1) {
- clipped->add(intersectLeft(cpt, ppt));
- }
- lastPos = i;
- }
- }
-
- if (doRight && clipped->size() > 1) {
- QDataBuffer<OutType> *tmp = source;
- source = clipped;
- clipped = tmp;
- clipped->reset();
- int lastPos, start;
- if (closePolygon) {
- lastPos = source->size() - 1;
- start = 0;
- } else {
- lastPos = 0;
- start = 1;
- if (source->at(0).x <= x2)
- clipped->add(source->at(0));
- }
- for (int i=start; i<source->size(); ++i) {
- const OutType &cpt = source->at(i);
- const OutType &ppt = source->at(lastPos);
-
- if (cpt.x <= x2) {
- if (ppt.x <= x2) {
- clipped->add(cpt);
- } else {
- clipped->add(intersectRight(cpt, ppt));
- clipped->add(cpt);
- }
- } else if (ppt.x <= x2) {
- clipped->add(intersectRight(cpt, ppt));
- }
-
- lastPos = i;
- }
-
- }
-
- if (doTop && clipped->size() > 1) {
- QDataBuffer<OutType> *tmp = source;
- source = clipped;
- clipped = tmp;
- clipped->reset();
- int lastPos, start;
- if (closePolygon) {
- lastPos = source->size() - 1;
- start = 0;
- } else {
- lastPos = 0;
- start = 1;
- if (source->at(0).y >= y1)
- clipped->add(source->at(0));
- }
- for (int i=start; i<source->size(); ++i) {
- const OutType &cpt = source->at(i);
- const OutType &ppt = source->at(lastPos);
-
- if (cpt.y >= y1) {
- if (ppt.y >= y1) {
- clipped->add(cpt);
- } else {
- clipped->add(intersectTop(cpt, ppt));
- clipped->add(cpt);
- }
- } else if (ppt.y >= y1) {
- clipped->add(intersectTop(cpt, ppt));
- }
-
- lastPos = i;
- }
- }
-
- if (doBottom && clipped->size() > 1) {
- QDataBuffer<OutType> *tmp = source;
- source = clipped;
- clipped = tmp;
- clipped->reset();
- int lastPos, start;
- if (closePolygon) {
- lastPos = source->size() - 1;
- start = 0;
- } else {
- lastPos = 0;
- start = 1;
- if (source->at(0).y <= y2)
- clipped->add(source->at(0));
- }
- for (int i=start; i<source->size(); ++i) {
- const OutType &cpt = source->at(i);
- const OutType &ppt = source->at(lastPos);
-
- if (cpt.y <= y2) {
- if (ppt.y <= y2) {
- clipped->add(cpt);
- } else {
- clipped->add(intersectBottom(cpt, ppt));
- clipped->add(cpt);
- }
- } else if (ppt.y <= y2) {
- clipped->add(intersectBottom(cpt, ppt));
- }
- lastPos = i;
- }
- }
-
- if (closePolygon && clipped->size() > 0) {
- // close clipped polygon
- if (clipped->at(0).x != clipped->at(clipped->size()-1).x ||
- clipped->at(0).y != clipped->at(clipped->size()-1).y) {
- OutType ot = clipped->at(0);
- clipped->add(ot);
- }
- }
- *outCount = clipped->size();
- *outPoints = clipped->data();
- }
-
-private:
- int x1, x2, y1, y2;
- QDataBuffer<OutType> buffer1;
- QDataBuffer<OutType> buffer2;
-};
-
-QT_END_NAMESPACE
-
-#endif // QPOLYGONCLIPPER_P_H
diff --git a/src/gui/painting/qrasterbackingstore.cpp b/src/gui/painting/qrasterbackingstore.cpp
new file mode 100644
index 0000000000..3b3ef2fd2e
--- /dev/null
+++ b/src/gui/painting/qrasterbackingstore.cpp
@@ -0,0 +1,83 @@
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
+
+#include "qrasterbackingstore_p.h"
+
+#include <QtGui/qbackingstore.h>
+#include <QtGui/qpainter.h>
+
+#include <private/qhighdpiscaling_p.h>
+#include <qpa/qplatformwindow.h>
+
+QT_BEGIN_NAMESPACE
+
+QRasterBackingStore::QRasterBackingStore(QWindow *window)
+ : QPlatformBackingStore(window)
+{
+}
+
+QRasterBackingStore::~QRasterBackingStore()
+{
+}
+
+void QRasterBackingStore::resize(const QSize &size, const QRegion &staticContents)
+{
+ Q_UNUSED(staticContents);
+ m_requestedSize = size;
+}
+
+QImage::Format QRasterBackingStore::format() const
+{
+ if (window()->format().hasAlpha())
+ return QImage::Format_ARGB32_Premultiplied;
+ else
+ return QImage::Format_RGB32;
+}
+
+QPaintDevice *QRasterBackingStore::paintDevice()
+{
+ return &m_image;
+}
+
+QImage QRasterBackingStore::toImage() const
+{
+ return m_image;
+}
+
+bool QRasterBackingStore::scroll(const QRegion &region, int dx, int dy)
+{
+ if (!QPlatformSurface::isRasterSurface(window()))
+ return false;
+
+ extern void qt_scrollRectInImage(QImage &, const QRect &, const QPoint &);
+
+ const qreal devicePixelRatio = m_image.devicePixelRatio();
+ const QPoint delta(dx * devicePixelRatio, dy * devicePixelRatio);
+
+ const QRect rect = region.boundingRect();
+ qt_scrollRectInImage(m_image, QRect(rect.topLeft() * devicePixelRatio, rect.size() * devicePixelRatio), delta);
+
+ return true;
+}
+
+void QRasterBackingStore::beginPaint(const QRegion &region)
+{
+ qreal nativeWindowDevicePixelRatio = window()->handle()->devicePixelRatio();
+ QSize effectiveBufferSize = m_requestedSize * nativeWindowDevicePixelRatio;
+ if (m_image.devicePixelRatio() != nativeWindowDevicePixelRatio || m_image.size() != effectiveBufferSize) {
+ m_image = QImage(effectiveBufferSize, format());
+ m_image.setDevicePixelRatio(nativeWindowDevicePixelRatio);
+ if (m_image.hasAlphaChannel())
+ m_image.fill(Qt::transparent);
+ }
+
+ if (!m_image.hasAlphaChannel())
+ return;
+
+ QPainter painter(&m_image);
+ painter.setCompositionMode(QPainter::CompositionMode_Source);
+ for (const QRect &rect : region)
+ painter.fillRect(rect, Qt::transparent);
+}
+
+QT_END_NAMESPACE
diff --git a/src/gui/painting/qrasterbackingstore_p.h b/src/gui/painting/qrasterbackingstore_p.h
new file mode 100644
index 0000000000..be8d122655
--- /dev/null
+++ b/src/gui/painting/qrasterbackingstore_p.h
@@ -0,0 +1,46 @@
+// Copyright (C) 2020 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
+
+#ifndef QRASTERBACKINGSTORE_P_H
+#define QRASTERBACKINGSTORE_P_H
+
+//
+// W A R N I N G
+// -------------
+//
+// This file is not part of the Qt API. It exists purely as an
+// implementation detail. This header file may change from version to
+// version without notice, or even be removed.
+//
+// We mean it.
+//
+
+#include <qpa/qplatformbackingstore.h>
+#include <private/qglobal_p.h>
+
+
+QT_BEGIN_NAMESPACE
+
+class Q_GUI_EXPORT QRasterBackingStore : public QPlatformBackingStore
+{
+public:
+ QRasterBackingStore(QWindow *window);
+ ~QRasterBackingStore();
+
+ void resize(const QSize &size, const QRegion &staticContents) override;
+ bool scroll(const QRegion &area, int dx, int dy) override;
+ void beginPaint(const QRegion &region) override;
+
+ QPaintDevice *paintDevice() override;
+ QImage toImage() const override;
+
+protected:
+ virtual QImage::Format format() const;
+
+ QImage m_image;
+ QSize m_requestedSize;
+};
+
+QT_END_NAMESPACE
+
+#endif // QRASTERBACKINGSTORE_P_H
diff --git a/src/gui/painting/qrasterdefs_p.h b/src/gui/painting/qrasterdefs_p.h
index bf57a84c24..f6bf3bb0c8 100644
--- a/src/gui/painting/qrasterdefs_p.h
+++ b/src/gui/painting/qrasterdefs_p.h
@@ -1,41 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the QtGui module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
/***************************************************************************/
/* */
@@ -865,10 +829,10 @@ QT_FT_BEGIN_HEADER
/* */
typedef struct QT_FT_Span_
{
- short x;
- unsigned short len;
- short y;
- unsigned char coverage;
+ int x;
+ int len;
+ int y;
+ unsigned char coverage;
} QT_FT_Span;
diff --git a/src/gui/painting/qrasterizer.cpp b/src/gui/painting/qrasterizer.cpp
index cd31d75f83..cd9d3ba4d0 100644
--- a/src/gui/painting/qrasterizer.cpp
+++ b/src/gui/painting/qrasterizer.cpp
@@ -1,41 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the QtGui module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#include "qrasterizer_p.h"
@@ -46,19 +10,26 @@
#include <private/qdatabuffer_p.h>
#include <private/qdrawhelper_p.h>
+#include <QtGui/qpainterpath.h>
+
#include <algorithm>
QT_BEGIN_NAMESPACE
-typedef int Q16Dot16;
-#define Q16Dot16ToFloat(i) ((i)/65536.)
-#define FloatToQ16Dot16(i) (int)((i) * 65536.)
-#define IntToQ16Dot16(i) ((i) * (1 << 16))
-#define Q16Dot16ToInt(i) ((i) >> 16)
-#define Q16Dot16Factor 65536
-
-#define Q16Dot16Multiply(x, y) (int)((qlonglong(x) * qlonglong(y)) >> 16)
-#define Q16Dot16FastMultiply(x, y) (((x) * (y)) >> 16)
+#if Q_PROCESSOR_WORDSIZE == 8
+typedef qint64 QScFixed;
+#else
+typedef int QScFixed;
+#endif
+#define QScFixedToFloat(i) ((i) * (1./65536.))
+#define FloatToQScFixed(i) (QScFixed)((i) * 65536.)
+#define IntToQScFixed(i) ((QScFixed)(i) * (1 << 16))
+#define QScFixedToInt(i) ((i) >> 16)
+#define QScFixedFactor 65536
+#define FTPosToQScFixed(i) ((QScFixed)(i) * (1 << 10))
+
+#define QScFixedMultiply(x, y) (QScFixed)((qlonglong(x) * qlonglong(y)) >> 16)
+#define QScFixedFastMultiply(x, y) (((x) * (y)) >> 16)
#define SPAN_BUFFER_SIZE 256
@@ -86,11 +57,12 @@ public:
flushSpans();
}
- void addSpan(int x, unsigned int len, int y, unsigned char coverage)
+ void addSpan(int x, int len, int y, int coverage)
{
if (!coverage || !len)
return;
+ Q_ASSERT(coverage >= 0 && coverage <= 255);
Q_ASSERT(y >= m_clipRect.top());
Q_ASSERT(y <= m_clipRect.bottom());
Q_ASSERT(x >= m_clipRect.left());
@@ -129,7 +101,7 @@ public:
~QScanConverter();
void begin(int top, int bottom, int left, int right,
- Qt::FillRule fillRule, bool legacyRounding, QSpanBuffer *spanBuffer);
+ Qt::FillRule fillRule, QSpanBuffer *spanBuffer);
void end();
void mergeCurve(const QT_FT_Vector &a, const QT_FT_Vector &b,
@@ -138,8 +110,8 @@ public:
struct Line
{
- Q16Dot16 x;
- Q16Dot16 delta;
+ QScFixed x;
+ QScFixed delta;
int top, bottom;
@@ -155,7 +127,7 @@ private:
int left, right;
};
- inline bool clip(Q16Dot16 &xFP, int &iTop, int &iBottom, Q16Dot16 slopeFP, Q16Dot16 edgeFP, int winding);
+ inline bool clip(QScFixed &xFP, int &iTop, int &iBottom, QScFixed slopeFP, QScFixed edgeFP, int winding);
inline void mergeIntersection(Intersection *head, const Intersection &isect);
void prepareChunk();
@@ -173,11 +145,10 @@ private:
int m_top;
int m_bottom;
- Q16Dot16 m_leftFP;
- Q16Dot16 m_rightFP;
+ QScFixed m_leftFP;
+ QScFixed m_rightFP;
int m_fillRuleMask;
- bool m_legacyRounding;
int m_x;
int m_y;
@@ -189,15 +160,14 @@ private:
QDataBuffer<Line *> m_active;
- template <typename T>
- friend void qScanConvert(QScanConverter &d, T allVertical);
+ template <bool AllVertical>
+ void scanConvert();
};
class QRasterizerPrivate
{
public:
bool antialiased;
- bool legacyRounding;
ProcessSpans blend;
void *data;
QRect clipRect;
@@ -221,18 +191,17 @@ QScanConverter::~QScanConverter()
}
void QScanConverter::begin(int top, int bottom, int left, int right,
- Qt::FillRule fillRule, bool legacyRounding,
+ Qt::FillRule fillRule,
QSpanBuffer *spanBuffer)
{
m_top = top;
m_bottom = bottom;
- m_leftFP = IntToQ16Dot16(left);
- m_rightFP = IntToQ16Dot16(right + 1);
+ m_leftFP = IntToQScFixed(left);
+ m_rightFP = IntToQScFixed(right + 1);
m_lines.reset();
m_fillRuleMask = fillRule == Qt::WindingFill ? ~0x0 : 0x1;
- m_legacyRounding = legacyRounding;
m_spanBuffer = spanBuffer;
}
@@ -299,71 +268,58 @@ static void split(QT_FT_Vector *b)
}
}
-static inline bool topOrder(const QScanConverter::Line &a, const QScanConverter::Line &b)
-{
- return a.top < b.top;
-}
-
-static inline bool xOrder(const QScanConverter::Line *a, const QScanConverter::Line *b)
-{
- return a->x < b->x;
-}
-
-template <bool B>
-struct QBoolToType
+template <bool AllVertical>
+void QScanConverter::scanConvert()
{
- inline bool operator()() const
- {
- return B;
- }
-};
-
-// should be a member function but VC6 doesn't support member template functions
-template <typename T>
-void qScanConvert(QScanConverter &d, T allVertical)
-{
- if (!d.m_lines.size()) {
- d.m_active.reset();
+ if (!m_lines.size()) {
+ m_active.reset();
return;
}
- std::sort(d.m_lines.data(), d.m_lines.data() + d.m_lines.size(), QT_PREPEND_NAMESPACE(topOrder));
+ constexpr auto topOrder = [](const Line &a, const Line &b) {
+ return a.top < b.top;
+ };
+ constexpr auto xOrder = [](const Line *a, const Line *b) {
+ return a->x < b->x;
+ };
+
+ std::sort(m_lines.data(), m_lines.data() + m_lines.size(), topOrder);
int line = 0;
- for (int y = d.m_lines.first().top; y <= d.m_bottom; ++y) {
- for (; line < d.m_lines.size() && d.m_lines.at(line).top == y; ++line) {
+ for (int y = m_lines.first().top; y <= m_bottom; ++y) {
+ for (; line < m_lines.size() && m_lines.at(line).top == y; ++line) {
// add node to active list
- if (allVertical()) {
- QScanConverter::Line *l = &d.m_lines.at(line);
- d.m_active.resize(d.m_active.size() + 1);
+ if constexpr(AllVertical) {
+ QScanConverter::Line *l = &m_lines.at(line);
+ m_active.resize(m_active.size() + 1);
int j;
- for (j = d.m_active.size() - 2; j >= 0 && QT_PREPEND_NAMESPACE(xOrder)(l, d.m_active.at(j)); --j)
- d.m_active.at(j+1) = d.m_active.at(j);
- d.m_active.at(j+1) = l;
+ for (j = m_active.size() - 2; j >= 0 && xOrder(l, m_active.at(j)); --j)
+ m_active.at(j+1) = m_active.at(j);
+ m_active.at(j+1) = l;
} else {
- d.m_active << &d.m_lines.at(line);
+ m_active << &m_lines.at(line);
}
}
- int numActive = d.m_active.size();
- if (!allVertical()) {
- // use insertion sort instead of qSort, as the active edge list is quite small
- // and in the average case already sorted
+ int numActive = m_active.size();
+ if constexpr(!AllVertical) {
+ // use insertion sort instead of std::sort, as the active edge list is quite small
+ // and in the average case already sorted
for (int i = 1; i < numActive; ++i) {
- QScanConverter::Line *l = d.m_active.at(i);
+ QScanConverter::Line *l = m_active.at(i);
int j;
- for (j = i-1; j >= 0 && QT_PREPEND_NAMESPACE(xOrder)(l, d.m_active.at(j)); --j)
- d.m_active.at(j+1) = d.m_active.at(j);
- d.m_active.at(j+1) = l;
+ for (j = i-1; j >= 0 && xOrder(l, m_active.at(j)); --j)
+ m_active.at(j+1) = m_active.at(j);
+ m_active.at(j+1) = l;
}
}
int x = 0;
int winding = 0;
for (int i = 0; i < numActive; ++i) {
- QScanConverter::Line *node = d.m_active.at(i);
+ QScanConverter::Line *node = m_active.at(i);
- const int current = Q16Dot16ToInt(node->x);
- if (winding & d.m_fillRuleMask)
- d.m_spanBuffer->addSpan(x, current - x, y, 0xff);
+ const int current = QScFixedToInt(node->x);
+ if (winding & m_fillRuleMask)
+ m_spanBuffer->addSpan(x, current - x, y, 0xff);
x = current;
winding += node->winding;
@@ -371,15 +327,17 @@ void qScanConvert(QScanConverter &d, T allVertical)
if (node->bottom == y) {
// remove node from active list
for (int j = i; j < numActive - 1; ++j)
- d.m_active.at(j) = d.m_active.at(j+1);
+ m_active.at(j) = m_active.at(j+1);
- d.m_active.resize(--numActive);
+ m_active.resize(--numActive);
--i;
- } else if (!allVertical())
- node->x += node->delta;
+ } else {
+ if constexpr(!AllVertical)
+ node->x += node->delta;
+ }
}
}
- d.m_active.reset();
+ m_active.reset();
}
void QScanConverter::end()
@@ -396,9 +354,9 @@ void QScanConverter::end()
}
}
if (allVertical)
- qScanConvert(*this, QBoolToType<true>());
+ scanConvert<true>();
else
- qScanConvert(*this, QBoolToType<false>());
+ scanConvert<false>();
} else {
for (int chunkTop = m_top; chunkTop <= m_bottom; chunkTop += CHUNK_SIZE) {
prepareChunk();
@@ -423,12 +381,12 @@ void QScanConverter::end()
if (line.delta) {
for (; it != end; ++it) {
- isect.x = Q16Dot16ToInt(line.x);
+ isect.x = QScFixedToInt(line.x);
line.x += line.delta;
mergeIntersection(it, isect);
}
} else {
- isect.x = Q16Dot16ToInt(line.x);
+ isect.x = QScFixedToInt(line.x);
for (; it != end; ++it)
mergeIntersection(it, isect);
}
@@ -525,7 +483,7 @@ void QScanConverter::mergeCurve(const QT_FT_Vector &pa, const QT_FT_Vector &pb,
}
}
-inline bool QScanConverter::clip(Q16Dot16 &xFP, int &iTop, int &iBottom, Q16Dot16 slopeFP, Q16Dot16 edgeFP, int winding)
+inline bool QScanConverter::clip(QScFixed &xFP, int &iTop, int &iBottom, QScFixed slopeFP, QScFixed edgeFP, int winding)
{
bool right = edgeFP == m_rightFP;
@@ -539,7 +497,7 @@ inline bool QScanConverter::clip(Q16Dot16 &xFP, int &iTop, int &iBottom, Q16Dot1
}
}
- Q16Dot16 lastFP = xFP + slopeFP * (iBottom - iTop);
+ QScFixed lastFP = xFP + slopeFP * (iBottom - iTop);
if (lastFP == edgeFP) {
if ((slopeFP < 0) ^ right)
@@ -553,11 +511,11 @@ inline bool QScanConverter::clip(Q16Dot16 &xFP, int &iTop, int &iBottom, Q16Dot1
// does line cross edge?
if ((lastFP < edgeFP) ^ (xFP < edgeFP)) {
- Q16Dot16 deltaY = Q16Dot16((edgeFP - xFP) / Q16Dot16ToFloat(slopeFP));
+ QScFixed deltaY = QScFixed((edgeFP - xFP) / QScFixedToFloat(slopeFP));
if ((xFP < edgeFP) ^ right) {
// top segment needs to be clipped
- int iHeight = Q16Dot16ToInt(deltaY + 1);
+ int iHeight = QScFixedToInt(deltaY + 1);
int iMiddle = iTop + iHeight;
Line line = { edgeFP, 0, iTop, iMiddle, winding };
@@ -570,7 +528,7 @@ inline bool QScanConverter::clip(Q16Dot16 &xFP, int &iTop, int &iBottom, Q16Dot1
return true;
} else {
// bottom segment needs to be clipped
- int iHeight = Q16Dot16ToInt(deltaY);
+ int iHeight = QScFixedToInt(deltaY);
int iMiddle = iTop + iHeight;
if (iMiddle != iBottom) {
@@ -599,20 +557,11 @@ void QScanConverter::mergeLine(QT_FT_Vector a, QT_FT_Vector b)
winding = -1;
}
- if (m_legacyRounding) {
- a.x += COORD_OFFSET;
- a.y += COORD_OFFSET;
- b.x += COORD_OFFSET;
- b.y += COORD_OFFSET;
- }
-
- int rounding = m_legacyRounding ? COORD_ROUNDING : 0;
-
- int iTop = qMax(m_top, int((a.y + 32 - rounding) >> 6));
- int iBottom = qMin(m_bottom, int((b.y - 32 - rounding) >> 6));
+ int iTop = qMax(m_top, int((a.y + 32) >> 6));
+ int iBottom = qMin(m_bottom, int((b.y - 32) >> 6));
if (iTop <= iBottom) {
- Q16Dot16 aFP = Q16Dot16Factor/2 + (a.x * (1 << 10)) - rounding;
+ QScFixed aFP = QScFixedFactor/2 + FTPosToQScFixed(a.x);
if (b.x == a.x) {
Line line = { qBound(m_leftFP, aFP, m_rightFP), 0, iTop, iBottom, winding };
@@ -620,11 +569,11 @@ void QScanConverter::mergeLine(QT_FT_Vector a, QT_FT_Vector b)
} else {
const qreal slope = (b.x - a.x) / qreal(b.y - a.y);
- const Q16Dot16 slopeFP = FloatToQ16Dot16(slope);
+ const QScFixed slopeFP = FloatToQScFixed(slope);
- Q16Dot16 xFP = aFP + Q16Dot16Multiply(slopeFP,
- IntToQ16Dot16(iTop)
- + Q16Dot16Factor/2 - (a.y * (1 << 10)));
+ QScFixed xFP = aFP + QScFixedMultiply(slopeFP,
+ IntToQScFixed(iTop)
+ + QScFixedFactor/2 - FTPosToQScFixed(a.y));
if (clip(xFP, iTop, iBottom, slopeFP, m_leftFP, winding))
return;
@@ -643,7 +592,6 @@ void QScanConverter::mergeLine(QT_FT_Vector a, QT_FT_Vector b)
QRasterizer::QRasterizer()
: d(new QRasterizerPrivate)
{
- d->legacyRounding = false;
}
QRasterizer::~QRasterizer()
@@ -667,44 +615,44 @@ void QRasterizer::setClipRect(const QRect &clipRect)
d->clipRect = clipRect;
}
-void QRasterizer::setLegacyRoundingEnabled(bool legacyRoundingEnabled)
-{
- d->legacyRounding = legacyRoundingEnabled;
-}
-
-static Q16Dot16 intersectPixelFP(int x, Q16Dot16 top, Q16Dot16 bottom, Q16Dot16 leftIntersectX, Q16Dot16 rightIntersectX, Q16Dot16 slope, Q16Dot16 invSlope)
+static QScFixed intersectPixelFP(int x, QScFixed top, QScFixed bottom, QScFixed leftIntersectX, QScFixed rightIntersectX, QScFixed slope, QScFixed invSlope)
{
- Q16Dot16 leftX = IntToQ16Dot16(x);
- Q16Dot16 rightX = IntToQ16Dot16(x) + Q16Dot16Factor;
+ QScFixed leftX = IntToQScFixed(x);
+ QScFixed rightX = IntToQScFixed(x) + QScFixedFactor;
- Q16Dot16 leftIntersectY, rightIntersectY;
- if (slope > 0) {
- leftIntersectY = top + Q16Dot16Multiply(leftX - leftIntersectX, invSlope);
- rightIntersectY = leftIntersectY + invSlope;
- } else {
- leftIntersectY = top + Q16Dot16Multiply(leftX - rightIntersectX, invSlope);
- rightIntersectY = leftIntersectY + invSlope;
- }
+ QScFixed leftIntersectY, rightIntersectY;
+ auto computeIntersectY = [&]() {
+ if (slope > 0) {
+ leftIntersectY = top + QScFixedMultiply(leftX - leftIntersectX, invSlope);
+ rightIntersectY = leftIntersectY + invSlope;
+ } else {
+ leftIntersectY = top + QScFixedMultiply(leftX - rightIntersectX, invSlope);
+ rightIntersectY = leftIntersectY + invSlope;
+ }
+ };
if (leftIntersectX >= leftX && rightIntersectX <= rightX) {
- return Q16Dot16Multiply(bottom - top, leftIntersectX - leftX + ((rightIntersectX - leftIntersectX) >> 1));
+ return QScFixedMultiply(bottom - top, leftIntersectX - leftX + ((rightIntersectX - leftIntersectX) >> 1));
} else if (leftIntersectX >= rightX) {
return bottom - top;
} else if (leftIntersectX >= leftX) {
+ computeIntersectY();
if (slope > 0) {
- return (bottom - top) - Q16Dot16FastMultiply((rightX - leftIntersectX) >> 1, rightIntersectY - top);
+ return (bottom - top) - QScFixedFastMultiply((rightX - leftIntersectX) >> 1, rightIntersectY - top);
} else {
- return (bottom - top) - Q16Dot16FastMultiply((rightX - leftIntersectX) >> 1, bottom - rightIntersectY);
+ return (bottom - top) - QScFixedFastMultiply((rightX - leftIntersectX) >> 1, bottom - rightIntersectY);
}
} else if (rightIntersectX <= leftX) {
return 0;
} else if (rightIntersectX <= rightX) {
+ computeIntersectY();
if (slope > 0) {
- return Q16Dot16FastMultiply((rightIntersectX - leftX) >> 1, bottom - leftIntersectY);
+ return QScFixedFastMultiply((rightIntersectX - leftX) >> 1, bottom - leftIntersectY);
} else {
- return Q16Dot16FastMultiply((rightIntersectX - leftX) >> 1, leftIntersectY - top);
+ return QScFixedFastMultiply((rightIntersectX - leftX) >> 1, leftIntersectY - top);
}
} else {
+ computeIntersectY();
if (slope > 0) {
return (bottom - rightIntersectY) + ((rightIntersectY - leftIntersectY) >> 1);
} else {
@@ -743,14 +691,78 @@ static inline qreal qSafeDivide(qreal x, qreal y)
too small to fit into INT_MIN, so we need this slightly safer conversion
when floating point exceptions are enabled
*/
-static inline int qSafeFloatToQ16Dot16(qreal x)
+static inline QScFixed qSafeFloatToQScFixed(qreal x)
{
- qreal tmp = x * 65536.;
+ qreal tmp = x * QScFixedFactor;
+#if Q_PROCESSOR_WORDSIZE == 8
+ if (tmp > qreal(INT_MAX) * QScFixedFactor)
+ return QScFixed(INT_MAX) * QScFixedFactor;
+ else if (tmp < qreal(INT_MIN) * QScFixedFactor)
+ return QScFixed(INT_MIN) * QScFixedFactor;
+#else
if (tmp > qreal(INT_MAX))
return INT_MAX;
else if (tmp < qreal(INT_MIN))
return -INT_MAX;
- return int(tmp);
+#endif
+ return QScFixed(tmp);
+}
+
+// returns true if the whole line gets clipped away
+static inline bool qClipLine(QPointF *pt1, QPointF *pt2, const QRectF &clip)
+{
+ qreal &x1 = pt1->rx();
+ qreal &y1 = pt1->ry();
+ qreal &x2 = pt2->rx();
+ qreal &y2 = pt2->ry();
+
+ if (!qIsFinite(x1) || !qIsFinite(y1) || !qIsFinite(x2) || !qIsFinite(y2))
+ return true;
+
+ const qreal xmin = clip.left();
+ const qreal xmax = clip.right();
+ const qreal ymin = clip.top();
+ const qreal ymax = clip.bottom();
+
+ if (x1 < xmin) {
+ if (x2 <= xmin)
+ return true;
+ y1 += (y2 - y1) / (x2 - x1) * (xmin - x1);
+ x1 = xmin;
+ } else if (x1 > xmax) {
+ if (x2 >= xmax)
+ return true;
+ y1 += (y2 - y1) / (x2 - x1) * (xmax - x1);
+ x1 = xmax;
+ }
+ if (x2 < xmin) {
+ y2 += (y2 - y1) / (x2 - x1) * (xmin - x2);
+ x2 = xmin;
+ } else if (x2 > xmax) {
+ y2 += (y2 - y1) / (x2 - x1) * (xmax - x2);
+ x2 = xmax;
+ }
+
+ if (y1 < ymin) {
+ if (y2 <= ymin)
+ return true;
+ x1 += (x2 - x1) / (y2 - y1) * (ymin - y1);
+ y1 = ymin;
+ } else if (y1 > ymax) {
+ if (y2 >= ymax)
+ return true;
+ x1 += (x2 - x1) / (y2 - y1) * (ymax - y1);
+ y1 = ymax;
+ }
+ if (y2 < ymin) {
+ x2 += (x2 - x1) / (y2 - y1) * (ymin - y2);
+ y2 = ymin;
+ } else if (y2 > ymax) {
+ x2 += (x2 - x1) / (y2 - y1) * (ymax - y2);
+ y2 = ymax;
+ }
+
+ return false;
}
void QRasterizer::rasterizeLine(const QPointF &a, const QPointF &b, qreal width, bool squareCap)
@@ -769,49 +781,8 @@ void QRasterizer::rasterizeLine(const QPointF &a, const QPointF &b, qreal width,
QPointF offs = QPointF(qAbs(b.y() - a.y()), qAbs(b.x() - a.x())) * width * 0.5;
const QRectF clip(d->clipRect.topLeft() - offs, d->clipRect.bottomRight() + QPoint(1, 1) + offs);
-
- if (!clip.contains(pa) || !clip.contains(pb)) {
- qreal t1 = 0;
- qreal t2 = 1;
-
- const qreal o[2] = { pa.x(), pa.y() };
- const qreal d[2] = { pb.x() - pa.x(), pb.y() - pa.y() };
-
- const qreal low[2] = { clip.left(), clip.top() };
- const qreal high[2] = { clip.right(), clip.bottom() };
-
- for (int i = 0; i < 2; ++i) {
- if (d[i] == 0) {
- if (o[i] <= low[i] || o[i] >= high[i])
- return;
- continue;
- }
- const qreal d_inv = 1 / d[i];
- qreal t_low = (low[i] - o[i]) * d_inv;
- qreal t_high = (high[i] - o[i]) * d_inv;
- if (t_low > t_high)
- qSwap(t_low, t_high);
- if (t1 < t_low)
- t1 = t_low;
- if (t2 > t_high)
- t2 = t_high;
- if (t1 >= t2)
- return;
- }
-
- QPointF npa = pa + (pb - pa) * t1;
- QPointF npb = pa + (pb - pa) * t2;
-
- pa = npa;
- pb = npb;
- }
-
- if (!d->antialiased && d->legacyRounding) {
- pa.rx() += (COORD_OFFSET - COORD_ROUNDING)/64.;
- pa.ry() += (COORD_OFFSET - COORD_ROUNDING)/64.;
- pb.rx() += (COORD_OFFSET - COORD_ROUNDING)/64.;
- pb.ry() += (COORD_OFFSET - COORD_ROUNDING)/64.;
- }
+ if (qClipLine(&pa, &pb, clip))
+ return;
{
// old delta
@@ -864,30 +835,33 @@ void QRasterizer::rasterizeLine(const QPointF &a, const QPointF &b, qreal width,
return;
if (d->antialiased) {
- const Q16Dot16 iLeft = int(left);
- const Q16Dot16 iRight = int(right);
- const Q16Dot16 leftWidth = IntToQ16Dot16(iLeft + 1)
- - qSafeFloatToQ16Dot16(left);
- const Q16Dot16 rightWidth = qSafeFloatToQ16Dot16(right)
- - IntToQ16Dot16(iRight);
-
- Q16Dot16 coverage[3];
+ const int iLeft = int(left);
+ const int iRight = int(right);
+ const QScFixed leftWidth = IntToQScFixed(iLeft + 1)
+ - qSafeFloatToQScFixed(left);
+ const QScFixed rightWidth = qSafeFloatToQScFixed(right)
+ - IntToQScFixed(iRight);
+
+ QScFixed coverage[3];
int x[3];
int len[3];
int n = 1;
if (iLeft == iRight) {
- coverage[0] = (leftWidth + rightWidth) * 255;
+ if (leftWidth == QScFixedFactor)
+ coverage[0] = rightWidth * 255;
+ else
+ coverage[0] = (rightWidth + leftWidth - QScFixedFactor) * 255;
x[0] = iLeft;
len[0] = 1;
} else {
coverage[0] = leftWidth * 255;
x[0] = iLeft;
len[0] = 1;
- if (leftWidth == Q16Dot16Factor) {
+ if (leftWidth == QScFixedFactor) {
len[0] = iRight - iLeft;
} else if (iRight - iLeft > 1) {
- coverage[1] = IntToQ16Dot16(255);
+ coverage[1] = IntToQScFixed(255);
x[1] = iLeft + 1;
len[1] = iRight - iLeft - 1;
++n;
@@ -900,19 +874,19 @@ void QRasterizer::rasterizeLine(const QPointF &a, const QPointF &b, qreal width,
}
}
- const Q16Dot16 iTopFP = IntToQ16Dot16(int(pa.y()));
- const Q16Dot16 iBottomFP = IntToQ16Dot16(int(pb.y()));
- const Q16Dot16 yPa = qSafeFloatToQ16Dot16(pa.y());
- const Q16Dot16 yPb = qSafeFloatToQ16Dot16(pb.y());
- for (Q16Dot16 yFP = iTopFP; yFP <= iBottomFP; yFP += Q16Dot16Factor) {
- const Q16Dot16 rowHeight = qMin(yFP + Q16Dot16Factor, yPb)
+ const QScFixed iTopFP = IntToQScFixed(int(pa.y()));
+ const QScFixed iBottomFP = IntToQScFixed(int(pb.y()));
+ const QScFixed yPa = qSafeFloatToQScFixed(pa.y());
+ const QScFixed yPb = qSafeFloatToQScFixed(pb.y());
+ for (QScFixed yFP = iTopFP; yFP <= iBottomFP; yFP += QScFixedFactor) {
+ const QScFixed rowHeight = qMin(yFP + QScFixedFactor, yPb)
- qMax(yFP, yPa);
- const int y = Q16Dot16ToInt(yFP);
+ const int y = QScFixedToInt(yFP);
if (y > d->clipRect.bottom())
break;
for (int i = 0; i < n; ++i) {
buffer.addSpan(x[i], len[i], y,
- Q16Dot16ToInt(Q16Dot16Multiply(rowHeight, coverage[i])));
+ QScFixedToInt(QScFixedMultiply(rowHeight, coverage[i])));
}
}
} else { // aliased
@@ -969,111 +943,111 @@ void QRasterizer::rasterizeLine(const QPointF &a, const QPointF &b, qreal width,
const qreal topRightSlope = qSafeDivide(topRightEdge.x(), topRightEdge.y());
const qreal bottomRightSlope = qSafeDivide(bottomRightEdge.x(), bottomRightEdge.y());
- const Q16Dot16 topLeftSlopeFP = qSafeFloatToQ16Dot16(topLeftSlope);
- const Q16Dot16 topRightSlopeFP = qSafeFloatToQ16Dot16(topRightSlope);
+ const QScFixed topLeftSlopeFP = qSafeFloatToQScFixed(topLeftSlope);
+ const QScFixed topRightSlopeFP = qSafeFloatToQScFixed(topRightSlope);
- const Q16Dot16 bottomLeftSlopeFP = qSafeFloatToQ16Dot16(bottomLeftSlope);
- const Q16Dot16 bottomRightSlopeFP = qSafeFloatToQ16Dot16(bottomRightSlope);
+ const QScFixed bottomLeftSlopeFP = qSafeFloatToQScFixed(bottomLeftSlope);
+ const QScFixed bottomRightSlopeFP = qSafeFloatToQScFixed(bottomRightSlope);
- const Q16Dot16 invTopLeftSlopeFP = qSafeFloatToQ16Dot16(qSafeDivide(1, topLeftSlope));
- const Q16Dot16 invTopRightSlopeFP = qSafeFloatToQ16Dot16(qSafeDivide(1, topRightSlope));
+ const QScFixed invTopLeftSlopeFP = qSafeFloatToQScFixed(qSafeDivide(1, topLeftSlope));
+ const QScFixed invTopRightSlopeFP = qSafeFloatToQScFixed(qSafeDivide(1, topRightSlope));
- const Q16Dot16 invBottomLeftSlopeFP = qSafeFloatToQ16Dot16(qSafeDivide(1, bottomLeftSlope));
- const Q16Dot16 invBottomRightSlopeFP = qSafeFloatToQ16Dot16(qSafeDivide(1, bottomRightSlope));
+ const QScFixed invBottomLeftSlopeFP = qSafeFloatToQScFixed(qSafeDivide(1, bottomLeftSlope));
+ const QScFixed invBottomRightSlopeFP = qSafeFloatToQScFixed(qSafeDivide(1, bottomRightSlope));
if (d->antialiased) {
- const Q16Dot16 iTopFP = IntToQ16Dot16(int(topBound));
- const Q16Dot16 iLeftFP = IntToQ16Dot16(int(left.y()));
- const Q16Dot16 iRightFP = IntToQ16Dot16(int(right.y()));
- const Q16Dot16 iBottomFP = IntToQ16Dot16(int(bottomBound));
+ const QScFixed iTopFP = IntToQScFixed(int(topBound));
+ const QScFixed iLeftFP = IntToQScFixed(int(left.y()));
+ const QScFixed iRightFP = IntToQScFixed(int(right.y()));
+ const QScFixed iBottomFP = IntToQScFixed(int(bottomBound));
- Q16Dot16 leftIntersectAf = qSafeFloatToQ16Dot16(top.x() + (int(topBound) - top.y()) * topLeftSlope);
- Q16Dot16 rightIntersectAf = qSafeFloatToQ16Dot16(top.x() + (int(topBound) - top.y()) * topRightSlope);
- Q16Dot16 leftIntersectBf = 0;
- Q16Dot16 rightIntersectBf = 0;
+ QScFixed leftIntersectAf = qSafeFloatToQScFixed(top.x() + (int(topBound) - top.y()) * topLeftSlope);
+ QScFixed rightIntersectAf = qSafeFloatToQScFixed(top.x() + (int(topBound) - top.y()) * topRightSlope);
+ QScFixed leftIntersectBf = 0;
+ QScFixed rightIntersectBf = 0;
if (iLeftFP < iTopFP)
- leftIntersectBf = qSafeFloatToQ16Dot16(left.x() + (int(topBound) - left.y()) * bottomLeftSlope);
+ leftIntersectBf = qSafeFloatToQScFixed(left.x() + (int(topBound) - left.y()) * bottomLeftSlope);
if (iRightFP < iTopFP)
- rightIntersectBf = qSafeFloatToQ16Dot16(right.x() + (int(topBound) - right.y()) * bottomRightSlope);
+ rightIntersectBf = qSafeFloatToQScFixed(right.x() + (int(topBound) - right.y()) * bottomRightSlope);
- Q16Dot16 rowTop, rowBottomLeft, rowBottomRight, rowTopLeft, rowTopRight, rowBottom;
- Q16Dot16 topLeftIntersectAf, topLeftIntersectBf, topRightIntersectAf, topRightIntersectBf;
- Q16Dot16 bottomLeftIntersectAf, bottomLeftIntersectBf, bottomRightIntersectAf, bottomRightIntersectBf;
+ QScFixed rowTop, rowBottomLeft, rowBottomRight, rowTopLeft, rowTopRight, rowBottom;
+ QScFixed topLeftIntersectAf, topLeftIntersectBf, topRightIntersectAf, topRightIntersectBf;
+ QScFixed bottomLeftIntersectAf, bottomLeftIntersectBf, bottomRightIntersectAf, bottomRightIntersectBf;
int leftMin, leftMax, rightMin, rightMax;
- const Q16Dot16 yTopFP = qSafeFloatToQ16Dot16(top.y());
- const Q16Dot16 yLeftFP = qSafeFloatToQ16Dot16(left.y());
- const Q16Dot16 yRightFP = qSafeFloatToQ16Dot16(right.y());
- const Q16Dot16 yBottomFP = qSafeFloatToQ16Dot16(bottom.y());
+ const QScFixed yTopFP = qSafeFloatToQScFixed(top.y());
+ const QScFixed yLeftFP = qSafeFloatToQScFixed(left.y());
+ const QScFixed yRightFP = qSafeFloatToQScFixed(right.y());
+ const QScFixed yBottomFP = qSafeFloatToQScFixed(bottom.y());
rowTop = qMax(iTopFP, yTopFP);
topLeftIntersectAf = leftIntersectAf +
- Q16Dot16Multiply(topLeftSlopeFP, rowTop - iTopFP);
+ QScFixedMultiply(topLeftSlopeFP, rowTop - iTopFP);
topRightIntersectAf = rightIntersectAf +
- Q16Dot16Multiply(topRightSlopeFP, rowTop - iTopFP);
+ QScFixedMultiply(topRightSlopeFP, rowTop - iTopFP);
- Q16Dot16 yFP = iTopFP;
+ QScFixed yFP = iTopFP;
while (yFP <= iBottomFP) {
- rowBottomLeft = qMin(yFP + Q16Dot16Factor, yLeftFP);
- rowBottomRight = qMin(yFP + Q16Dot16Factor, yRightFP);
+ rowBottomLeft = qMin(yFP + QScFixedFactor, yLeftFP);
+ rowBottomRight = qMin(yFP + QScFixedFactor, yRightFP);
rowTopLeft = qMax(yFP, yLeftFP);
rowTopRight = qMax(yFP, yRightFP);
- rowBottom = qMin(yFP + Q16Dot16Factor, yBottomFP);
+ rowBottom = qMin(yFP + QScFixedFactor, yBottomFP);
if (yFP == iLeftFP) {
- const int y = Q16Dot16ToInt(yFP);
- leftIntersectBf = qSafeFloatToQ16Dot16(left.x() + (y - left.y()) * bottomLeftSlope);
- topLeftIntersectBf = leftIntersectBf + Q16Dot16Multiply(bottomLeftSlopeFP, rowTopLeft - yFP);
- bottomLeftIntersectAf = leftIntersectAf + Q16Dot16Multiply(topLeftSlopeFP, rowBottomLeft - yFP);
+ const int y = QScFixedToInt(yFP);
+ leftIntersectBf = qSafeFloatToQScFixed(left.x() + (y - left.y()) * bottomLeftSlope);
+ topLeftIntersectBf = leftIntersectBf + QScFixedMultiply(bottomLeftSlopeFP, rowTopLeft - yFP);
+ bottomLeftIntersectAf = leftIntersectAf + QScFixedMultiply(topLeftSlopeFP, rowBottomLeft - yFP);
} else {
topLeftIntersectBf = leftIntersectBf;
bottomLeftIntersectAf = leftIntersectAf + topLeftSlopeFP;
}
if (yFP == iRightFP) {
- const int y = Q16Dot16ToInt(yFP);
- rightIntersectBf = qSafeFloatToQ16Dot16(right.x() + (y - right.y()) * bottomRightSlope);
- topRightIntersectBf = rightIntersectBf + Q16Dot16Multiply(bottomRightSlopeFP, rowTopRight - yFP);
- bottomRightIntersectAf = rightIntersectAf + Q16Dot16Multiply(topRightSlopeFP, rowBottomRight - yFP);
+ const int y = QScFixedToInt(yFP);
+ rightIntersectBf = qSafeFloatToQScFixed(right.x() + (y - right.y()) * bottomRightSlope);
+ topRightIntersectBf = rightIntersectBf + QScFixedMultiply(bottomRightSlopeFP, rowTopRight - yFP);
+ bottomRightIntersectAf = rightIntersectAf + QScFixedMultiply(topRightSlopeFP, rowBottomRight - yFP);
} else {
topRightIntersectBf = rightIntersectBf;
bottomRightIntersectAf = rightIntersectAf + topRightSlopeFP;
}
if (yFP == iBottomFP) {
- bottomLeftIntersectBf = leftIntersectBf + Q16Dot16Multiply(bottomLeftSlopeFP, rowBottom - yFP);
- bottomRightIntersectBf = rightIntersectBf + Q16Dot16Multiply(bottomRightSlopeFP, rowBottom - yFP);
+ bottomLeftIntersectBf = leftIntersectBf + QScFixedMultiply(bottomLeftSlopeFP, rowBottom - yFP);
+ bottomRightIntersectBf = rightIntersectBf + QScFixedMultiply(bottomRightSlopeFP, rowBottom - yFP);
} else {
bottomLeftIntersectBf = leftIntersectBf + bottomLeftSlopeFP;
bottomRightIntersectBf = rightIntersectBf + bottomRightSlopeFP;
}
if (yFP < iLeftFP) {
- leftMin = Q16Dot16ToInt(bottomLeftIntersectAf);
- leftMax = Q16Dot16ToInt(topLeftIntersectAf);
+ leftMin = QScFixedToInt(bottomLeftIntersectAf);
+ leftMax = QScFixedToInt(topLeftIntersectAf);
} else if (yFP == iLeftFP) {
- leftMin = Q16Dot16ToInt(qMax(bottomLeftIntersectAf, topLeftIntersectBf));
- leftMax = Q16Dot16ToInt(qMax(topLeftIntersectAf, bottomLeftIntersectBf));
+ leftMin = QScFixedToInt(qMax(bottomLeftIntersectAf, topLeftIntersectBf));
+ leftMax = QScFixedToInt(qMax(topLeftIntersectAf, bottomLeftIntersectBf));
} else {
- leftMin = Q16Dot16ToInt(topLeftIntersectBf);
- leftMax = Q16Dot16ToInt(bottomLeftIntersectBf);
+ leftMin = QScFixedToInt(topLeftIntersectBf);
+ leftMax = QScFixedToInt(bottomLeftIntersectBf);
}
leftMin = qBound(d->clipRect.left(), leftMin, d->clipRect.right());
leftMax = qBound(d->clipRect.left(), leftMax, d->clipRect.right());
if (yFP < iRightFP) {
- rightMin = Q16Dot16ToInt(topRightIntersectAf);
- rightMax = Q16Dot16ToInt(bottomRightIntersectAf);
+ rightMin = QScFixedToInt(topRightIntersectAf);
+ rightMax = QScFixedToInt(bottomRightIntersectAf);
} else if (yFP == iRightFP) {
- rightMin = Q16Dot16ToInt(qMin(topRightIntersectAf, bottomRightIntersectBf));
- rightMax = Q16Dot16ToInt(qMin(bottomRightIntersectAf, topRightIntersectBf));
+ rightMin = QScFixedToInt(qMin(topRightIntersectAf, bottomRightIntersectBf));
+ rightMax = QScFixedToInt(qMin(bottomRightIntersectAf, topRightIntersectBf));
} else {
- rightMin = Q16Dot16ToInt(bottomRightIntersectBf);
- rightMax = Q16Dot16ToInt(topRightIntersectBf);
+ rightMin = QScFixedToInt(bottomRightIntersectBf);
+ rightMax = QScFixedToInt(topRightIntersectBf);
}
rightMin = qBound(d->clipRect.left(), rightMin, d->clipRect.right());
@@ -1084,56 +1058,57 @@ void QRasterizer::rasterizeLine(const QPointF &a, const QPointF &b, qreal width,
if (rightMin < leftMin)
rightMin = leftMin;
- Q16Dot16 rowHeight = rowBottom - rowTop;
+ QScFixed rowHeight = rowBottom - rowTop;
int x = leftMin;
while (x <= leftMax) {
- Q16Dot16 excluded = 0;
+ QScFixed excluded = 0;
- if (yFP <= iLeftFP)
+ if (yFP <= iLeftFP && rowBottomLeft > rowTop)
excluded += intersectPixelFP(x, rowTop, rowBottomLeft,
bottomLeftIntersectAf, topLeftIntersectAf,
topLeftSlopeFP, invTopLeftSlopeFP);
- if (yFP >= iLeftFP)
+ if (yFP >= iLeftFP && rowBottom > rowTopLeft)
excluded += intersectPixelFP(x, rowTopLeft, rowBottom,
topLeftIntersectBf, bottomLeftIntersectBf,
bottomLeftSlopeFP, invBottomLeftSlopeFP);
-
if (x >= rightMin) {
- if (yFP <= iRightFP)
+ if (yFP <= iRightFP && rowBottomRight > rowTop)
excluded += (rowBottomRight - rowTop) - intersectPixelFP(x, rowTop, rowBottomRight,
topRightIntersectAf, bottomRightIntersectAf,
topRightSlopeFP, invTopRightSlopeFP);
- if (yFP >= iRightFP)
+ if (yFP >= iRightFP && rowBottom > rowTopRight)
excluded += (rowBottom - rowTopRight) - intersectPixelFP(x, rowTopRight, rowBottom,
bottomRightIntersectBf, topRightIntersectBf,
bottomRightSlopeFP, invBottomRightSlopeFP);
}
- Q16Dot16 coverage = rowHeight - excluded;
- buffer.addSpan(x, 1, Q16Dot16ToInt(yFP),
- Q16Dot16ToInt(255 * coverage));
+ Q_ASSERT(excluded >= 0 && excluded <= rowHeight);
+ QScFixed coverage = rowHeight - excluded;
+ buffer.addSpan(x, 1, QScFixedToInt(yFP),
+ QScFixedToInt(255 * coverage));
++x;
}
if (x < rightMin) {
- buffer.addSpan(x, rightMin - x, Q16Dot16ToInt(yFP),
- Q16Dot16ToInt(255 * rowHeight));
+ buffer.addSpan(x, rightMin - x, QScFixedToInt(yFP),
+ QScFixedToInt(255 * rowHeight));
x = rightMin;
}
while (x <= rightMax) {
- Q16Dot16 excluded = 0;
- if (yFP <= iRightFP)
+ QScFixed excluded = 0;
+ if (yFP <= iRightFP && rowBottomRight > rowTop)
excluded += (rowBottomRight - rowTop) - intersectPixelFP(x, rowTop, rowBottomRight,
topRightIntersectAf, bottomRightIntersectAf,
topRightSlopeFP, invTopRightSlopeFP);
- if (yFP >= iRightFP)
+ if (yFP >= iRightFP && rowBottom > rowTopRight)
excluded += (rowBottom - rowTopRight) - intersectPixelFP(x, rowTopRight, rowBottom,
bottomRightIntersectBf, topRightIntersectBf,
bottomRightSlopeFP, invBottomRightSlopeFP);
- Q16Dot16 coverage = rowHeight - excluded;
- buffer.addSpan(x, 1, Q16Dot16ToInt(yFP),
- Q16Dot16ToInt(255 * coverage));
+ Q_ASSERT(excluded >= 0 && excluded <= rowHeight);
+ QScFixed coverage = rowHeight - excluded;
+ buffer.addSpan(x, 1, QScFixedToInt(yFP),
+ QScFixedToInt(255 * coverage));
++x;
}
@@ -1144,7 +1119,7 @@ void QRasterizer::rasterizeLine(const QPointF &a, const QPointF &b, qreal width,
topLeftIntersectAf = leftIntersectAf;
topRightIntersectAf = rightIntersectAf;
- yFP += Q16Dot16Factor;
+ yFP += QScFixedFactor;
rowTop = yFP;
}
} else { // aliased
@@ -1154,10 +1129,10 @@ void QRasterizer::rasterizeLine(const QPointF &a, const QPointF &b, qreal width,
int iBottom = bottom.y() < 0.5f? -1 : int(bottom.y() - 0.5f);
int iMiddle = qMin(iLeft, iRight);
- Q16Dot16 leftIntersectAf = qSafeFloatToQ16Dot16(top.x() + 0.5f + (iTop + 0.5f - top.y()) * topLeftSlope);
- Q16Dot16 leftIntersectBf = qSafeFloatToQ16Dot16(left.x() + 0.5f + (iLeft + 1.5f - left.y()) * bottomLeftSlope);
- Q16Dot16 rightIntersectAf = qSafeFloatToQ16Dot16(top.x() - 0.5f + (iTop + 0.5f - top.y()) * topRightSlope);
- Q16Dot16 rightIntersectBf = qSafeFloatToQ16Dot16(right.x() - 0.5f + (iRight + 1.5f - right.y()) * bottomRightSlope);
+ QScFixed leftIntersectAf = qSafeFloatToQScFixed(top.x() + 0.5f + (iTop + 0.5f - top.y()) * topLeftSlope);
+ QScFixed leftIntersectBf = qSafeFloatToQScFixed(left.x() + 0.5f + (iLeft + 1.5f - left.y()) * bottomLeftSlope);
+ QScFixed rightIntersectAf = qSafeFloatToQScFixed(top.x() - 0.5f + (iTop + 0.5f - top.y()) * topRightSlope);
+ QScFixed rightIntersectBf = qSafeFloatToQScFixed(right.x() - 0.5f + (iRight + 1.5f - right.y()) * bottomRightSlope);
int ny;
int y = iTop;
@@ -1171,8 +1146,8 @@ void QRasterizer::rasterizeLine(const QPointF &a, const QPointF &b, qreal width,
if (next > d->clipRect.bottom()) \
next = d->clipRect.bottom(); \
for (; y <= next; ++y) { \
- const int x1 = qMax(Q16Dot16ToInt(li), d->clipRect.left()); \
- const int x2 = qMin(Q16Dot16ToInt(ri), d->clipRect.right()); \
+ const int x1 = qMax(QScFixedToInt(li), d->clipRect.left()); \
+ const int x2 = qMin(QScFixedToInt(ri), d->clipRect.right()); \
if (x2 >= x1) \
buffer.addSpan(x1, x2 - x1 + 1, y, 255); \
li += ls; \
@@ -1207,15 +1182,13 @@ void QRasterizer::rasterize(const QT_FT_Outline *outline, Qt::FillRule fillRule)
max_y = qMax(p.y, max_y);
}
- int rounding = d->legacyRounding ? COORD_OFFSET - COORD_ROUNDING : 0;
-
- int iTopBound = qMax(d->clipRect.top(), int((min_y + 32 + rounding) >> 6));
- int iBottomBound = qMin(d->clipRect.bottom(), int((max_y - 32 + rounding) >> 6));
+ int iTopBound = qMax(d->clipRect.top(), int((min_y + 32) >> 6));
+ int iBottomBound = qMin(d->clipRect.bottom(), int((max_y - 32) >> 6));
if (iTopBound > iBottomBound)
return;
- d->scanConverter.begin(iTopBound, iBottomBound, d->clipRect.left(), d->clipRect.right(), fillRule, d->legacyRounding, &buffer);
+ d->scanConverter.begin(iTopBound, iBottomBound, d->clipRect.left(), d->clipRect.right(), fillRule, &buffer);
int first = 0;
for (int i = 0; i < outline->n_contours; ++i) {
@@ -1245,15 +1218,13 @@ void QRasterizer::rasterize(const QPainterPath &path, Qt::FillRule fillRule)
QRectF bounds = path.controlPointRect();
- double rounding = d->legacyRounding ? (COORD_OFFSET - COORD_ROUNDING) / 64. : 0.0;
-
- int iTopBound = qMax(d->clipRect.top(), int(bounds.top() + 0.5 + rounding));
- int iBottomBound = qMin(d->clipRect.bottom(), int(bounds.bottom() - 0.5 + rounding));
+ int iTopBound = qMax(d->clipRect.top(), int(bounds.top() + 0.5));
+ int iBottomBound = qMin(d->clipRect.bottom(), int(bounds.bottom() - 0.5));
if (iTopBound > iBottomBound)
return;
- d->scanConverter.begin(iTopBound, iBottomBound, d->clipRect.left(), d->clipRect.right(), fillRule, d->legacyRounding, &buffer);
+ d->scanConverter.begin(iTopBound, iBottomBound, d->clipRect.left(), d->clipRect.right(), fillRule, &buffer);
int subpathStart = 0;
QT_FT_Vector last = { 0, 0 };
diff --git a/src/gui/painting/qrasterizer_p.h b/src/gui/painting/qrasterizer_p.h
index 955577f4a3..f12ab1b812 100644
--- a/src/gui/painting/qrasterizer_p.h
+++ b/src/gui/painting/qrasterizer_p.h
@@ -1,41 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the QtGui module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#ifndef QRASTERIZER_P_H
#define QRASTERIZER_P_H
@@ -72,7 +36,6 @@ public:
void setAntialiased(bool antialiased);
void setClipRect(const QRect &clipRect);
- void setLegacyRoundingEnabled(bool legacyRoundingEnabled);
void initialize(ProcessSpans blend, void *data);
diff --git a/src/gui/painting/qrbtree_p.h b/src/gui/painting/qrbtree_p.h
index 42e88889a1..e42c4081f6 100644
--- a/src/gui/painting/qrbtree_p.h
+++ b/src/gui/painting/qrbtree_p.h
@@ -1,41 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the QtGui module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#ifndef QRBTREE_P_H
#define QRBTREE_P_H
@@ -538,8 +502,8 @@ int QRBTree<T>::order(Node *left, Node *right)
if (left == right)
return 0;
- QVector<Node *> leftAncestors;
- QVector<Node *> rightAncestors;
+ QList<Node *> leftAncestors;
+ QList<Node *> rightAncestors;
while (left) {
leftAncestors.push_back(left);
left = left->parent;
diff --git a/src/gui/painting/qregion.cpp b/src/gui/painting/qregion.cpp
index 783b02fb93..8b712ee46d 100644
--- a/src/gui/painting/qregion.cpp
+++ b/src/gui/painting/qregion.cpp
@@ -1,41 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the QtGui module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#include "qregion.h"
#include "qpainterpath.h"
@@ -46,9 +10,15 @@
#include "qvarlengtharray.h"
#include "qimage.h"
#include "qbitmap.h"
+#include "qtransform.h"
+#include <memory>
#include <private/qdebug_p.h>
+#ifdef Q_OS_WIN
+# include <qt_windows.h>
+#endif
+
QT_BEGIN_NAMESPACE
/*!
@@ -81,7 +51,7 @@ QT_BEGIN_NAMESPACE
contains() a QPoint or QRect. The bounding rectangle can be found
with boundingRect().
- Iteration over the region (with begin(), end(), or C++11
+ Iteration over the region (with begin(), end(), or
ranged-for loops) gives a decomposition of the region into
rectangles.
@@ -129,7 +99,7 @@ QT_BEGIN_NAMESPACE
\fn QRegion::QRegion(const QRect &r, RegionType t)
\overload
- Create a region based on the rectange \a r with region type \a t.
+ Create a region based on the rectangle \a r with region type \a t.
If the rectangle is invalid a null region will be created.
@@ -295,7 +265,7 @@ void QRegion::exec(const QByteArray &buffer, int ver, QDataStream::ByteOrder byt
quint32 n;
s >> n;
QRect r;
- for (int i=0; i<(int)n; i++) {
+ for (int i=0; i < static_cast<int>(n); i++) {
s >> r;
rgn = rgn.united(QRegion(r));
}
@@ -344,19 +314,19 @@ QDataStream &operator<<(QDataStream &s, const QRegion &r)
{
auto b = r.begin(), e = r.end();
if (b == e) {
- s << (quint32)0;
+ s << static_cast<quint32>(0);
} else {
const auto size = e - b;
if (s.version() == 1) {
for (auto i = size - 1; i > 0; --i) {
- s << (quint32)(12 + i * 24);
- s << (int)QRGN_OR;
+ s << static_cast<quint32>(12 + i * 24);
+ s << static_cast<int>(QRGN_OR);
}
for (auto it = b; it != e; ++it)
- s << (quint32)(4+8) << (int)QRGN_SETRECT << *it;
+ s << static_cast<quint32>(4+8) << static_cast<int>(QRGN_SETRECT) << *it;
} else {
s << quint32(4 + 4 + 16 * size); // 16: storage size of QRect
- s << (qint32)QRGN_RECTS;
+ s << static_cast<qint32>(QRGN_RECTS);
s << quint32(size);
for (auto it = b; it != e; ++it)
s << *it;
@@ -428,9 +398,6 @@ QDebug operator<<(QDebug s, const QRegion &r)
\sa united(), operator+()
*/
-#ifdef Q_COMPILER_MANGLES_RETURN_TYPE
-const
-#endif
QRegion QRegion::operator|(const QRegion &r) const
{ return united(r); }
@@ -440,9 +407,6 @@ QRegion QRegion::operator|(const QRegion &r) const
\sa united(), operator|()
*/
-#ifdef Q_COMPILER_MANGLES_RETURN_TYPE
-const
-#endif
QRegion QRegion::operator+(const QRegion &r) const
{ return united(r); }
@@ -450,9 +414,6 @@ QRegion QRegion::operator+(const QRegion &r) const
\overload
\since 4.4
*/
-#ifdef Q_COMPILER_MANGLES_RETURN_TYPE
-const
-#endif
QRegion QRegion::operator+(const QRect &r) const
{ return united(r); }
@@ -462,9 +423,6 @@ QRegion QRegion::operator+(const QRect &r) const
\sa intersected()
*/
-#ifdef Q_COMPILER_MANGLES_RETURN_TYPE
-const
-#endif
QRegion QRegion::operator&(const QRegion &r) const
{ return intersected(r); }
@@ -472,9 +430,6 @@ QRegion QRegion::operator&(const QRegion &r) const
\overload
\since 4.4
*/
-#ifdef Q_COMPILER_MANGLES_RETURN_TYPE
-const
-#endif
QRegion QRegion::operator&(const QRect &r) const
{
return intersected(r);
@@ -486,9 +441,6 @@ QRegion QRegion::operator&(const QRect &r) const
\sa subtracted()
*/
-#ifdef Q_COMPILER_MANGLES_RETURN_TYPE
-const
-#endif
QRegion QRegion::operator-(const QRegion &r) const
{ return subtracted(r); }
@@ -498,9 +450,6 @@ QRegion QRegion::operator-(const QRegion &r) const
\sa xored()
*/
-#ifdef Q_COMPILER_MANGLES_RETURN_TYPE
-const
-#endif
QRegion QRegion::operator^(const QRegion &r) const
{ return xored(r); }
@@ -599,7 +548,7 @@ QRegion& QRegion::operator^=(const QRegion &r)
*/
QRegion::operator QVariant() const
{
- return QVariant(QVariant::Region, this);
+ return QVariant::fromValue(*this);
}
/*!
@@ -687,7 +636,7 @@ bool QRegion::intersects(const QRegion &region) const
*/
-#if !defined (Q_OS_UNIX) && !defined (Q_OS_WIN) || defined(Q_CLANG_QDOC)
+#if !defined (Q_OS_UNIX) && !defined (Q_OS_WIN) || defined(Q_QDOC)
/*
\overload
\since 4.4
@@ -743,21 +692,6 @@ QRegion QRegion::intersect(const QRect &r) const
*/
/*!
- \fn QRegion QRegion::unite(const QRegion &r) const
- \obsolete
-
- Use united(\a r) instead.
-*/
-
-/*!
- \fn QRegion QRegion::unite(const QRect &rect) const
- \since 4.4
- \obsolete
-
- Use united(\a rect) instead.
-*/
-
-/*!
\fn QRegion QRegion::united(const QRect &rect) const
\since 4.4
@@ -780,21 +714,6 @@ QRegion QRegion::intersect(const QRect &r) const
*/
/*!
- \fn QRegion QRegion::intersect(const QRegion &r) const
- \obsolete
-
- Use intersected(\a r) instead.
-*/
-
-/*!
- \fn QRegion QRegion::intersect(const QRect &rect) const
- \since 4.4
- \obsolete
-
- Use intersected(\a rect) instead.
-*/
-
-/*!
\fn QRegion QRegion::intersected(const QRect &rect) const
\since 4.4
@@ -817,13 +736,6 @@ QRegion QRegion::intersect(const QRect &r) const
*/
/*!
- \fn QRegion QRegion::subtract(const QRegion &r) const
- \obsolete
-
- Use subtracted(\a r) instead.
-*/
-
-/*!
\fn QRegion QRegion::subtracted(const QRegion &r) const
\since 4.2
@@ -838,13 +750,6 @@ QRegion QRegion::intersect(const QRect &r) const
*/
/*!
- \fn QRegion QRegion::eor(const QRegion &r) const
- \obsolete
-
- Use xored(\a r) instead.
-*/
-
-/*!
\fn QRegion QRegion::xored(const QRegion &r) const
\since 4.2
@@ -865,20 +770,6 @@ QRegion QRegion::intersect(const QRect &r) const
gives a rectangle that is QRect::isNull().
*/
-#if QT_DEPRECATED_SINCE(5, 11)
-/*!
- \fn QVector<QRect> QRegion::rects() const
- \obsolete
-
- Use begin() and end() instead.
-
- Returns an array of non-overlapping rectangles that make up the
- region.
-
- The union of all the rectangles is equal to the original region.
-*/
-#endif
-
/*!
\typedef QRegion::const_iterator
\since 5.8
@@ -1179,7 +1070,7 @@ Q_GUI_EXPORT QPainterPath qt_regionToPath(const QRegion &region)
struct QRegionPrivate {
int numRects;
int innerArea;
- QVector<QRect> rects;
+ QList<QRect> rects;
QRect extents;
QRect innerRect;
@@ -2251,7 +2142,7 @@ static void miRegionOp(QRegionPrivate &dest,
* reg1->rects and reg2->rects (if the regions have more than 1 rectangle),
* take a copy of dest.rects to keep those iteractors valid.
*/
- const QVector<QRect> destRectsCopy = dest.rects;
+ const QList<QRect> destRectsCopy = dest.rects;
Q_UNUSED(destRectsCopy);
dest.numRects = 0;
@@ -2844,7 +2735,7 @@ static bool RectInRegion(QRegionPrivate *region, int rx, int ry, uint rwidth, ui
break;
}
}
- return partIn ? ((ry <= prect->bottom()) ? RectanglePart : RectangleIn) : RectangleOut;
+ return partIn;
}
// END OF Region.c extract
// START OF poly.h extract
@@ -3300,8 +3191,7 @@ static void CreateETandAET(int count, const QPoint *pts,
int iSLLBlock = 0;
int dy;
- if (count < 2)
- return;
+ Q_ASSERT(count > 1);
/*
* initialize the Active Edge Table
@@ -3560,7 +3450,7 @@ static void PtsToRegion(int numFullPtBlocks, int iCurPtBlock,
int extendTo = 0;
bool needsExtend = false;
QVarLengthArray<QRegionSpan> row;
- int rowSize = 0;
+ qsizetype rowSize = 0;
reg->extents.setLeft(INT_MAX);
reg->extents.setRight(INT_MIN);
@@ -3643,9 +3533,12 @@ static QRegionPrivate *PolygonRegion(const QPoint *Pts, int Count, int rule)
int fixWAET = false;
POINTBLOCK FirstPtBlock, *curPtBlock; /* PtBlock buffers */
FirstPtBlock.pts = reinterpret_cast<QPoint *>(FirstPtBlock.data);
+ FirstPtBlock.next = nullptr;
POINTBLOCK *tmpPtBlock;
int numFullPtBlocks = 0;
+ Q_ASSERT(Count > 1);
+
region = new QRegionPrivate;
/* special case a rectangle */
@@ -3924,7 +3817,7 @@ QRegion::QRegion(const QRect &r, RegionType t)
QRegion::QRegion(const QPolygon &a, Qt::FillRule fillRule)
{
- if (a.count() > 2) {
+ if (a.size() > 2) {
QRegionPrivate *qt_rgn = PolygonRegion(a.constData(), a.size(),
fillRule == Qt::WindingFill ? WindingRule : EvenOddRule);
if (qt_rgn) {
@@ -3986,7 +3879,7 @@ QRegion &QRegion::operator=(const QRegion &r)
QRegion QRegion::copy() const
{
QRegion r;
- QScopedPointer<QRegionData> x(new QRegionData);
+ auto x = std::make_unique<QRegionData>();
x->ref.initializeOwned();
if (d->qt_rgn)
x->qt_rgn = new QRegionPrivate(*d->qt_rgn);
@@ -3994,7 +3887,7 @@ QRegion QRegion::copy() const
x->qt_rgn = new QRegionPrivate;
if (!r.d->ref.deref())
cleanUp(r.d);
- r.d = x.take();
+ r.d = x.release();
return r;
}
@@ -4311,20 +4204,6 @@ bool qt_region_strictContains(const QRegion &region, const QRect &rect)
&& rect.top() >= r1.top() && rect.bottom() <= r1.bottom());
}
-#if QT_DEPRECATED_SINCE(5, 11)
-QVector<QRect> QRegion::rects() const
-{
- if (d->qt_rgn) {
- d->qt_rgn->vectorize();
- d->qt_rgn->rects.reserve(d->qt_rgn->numRects);
- d->qt_rgn->rects.resize(d->qt_rgn->numRects);
- return d->qt_rgn->rects;
- } else {
- return QVector<QRect>();
- }
-}
-#endif
-
QRegion::const_iterator QRegion::begin() const noexcept
{
return d->qt_rgn ? d->qt_rgn->begin() : nullptr;
@@ -4406,4 +4285,65 @@ bool QRegion::intersects(const QRect &rect) const
#endif
+
+#if defined(Q_OS_WIN) || defined(Q_QDOC)
+
+static inline HRGN qt_RectToHRGN(const QRect &rc)
+{
+ return CreateRectRgn(rc.left(), rc.top(), rc.right() + 1, rc.bottom() + 1);
+}
+
+/*!
+ \since 6.0
+
+ Returns a HRGN that is equivalent to the given region.
+*/
+HRGN QRegion::toHRGN() const
+{
+ const int size = rectCount();
+ if (size == 0)
+ return nullptr;
+
+ HRGN resultRgn = nullptr;
+ const auto rects = begin();
+ resultRgn = qt_RectToHRGN(rects[0]);
+ for (int i = 1; i < size; ++i) {
+ HRGN tmpRgn = qt_RectToHRGN(rects[i]);
+ int err = CombineRgn(resultRgn, resultRgn, tmpRgn, RGN_OR);
+ if (err == ERROR)
+ qWarning("Error combining HRGNs.");
+ DeleteObject(tmpRgn);
+ }
+ return resultRgn;
+}
+
+/*!
+ \since 6.0
+
+ Returns a QRegion that is equivalent to the given \a hrgn.
+ */
+QRegion QRegion::fromHRGN(HRGN hrgn)
+{
+ DWORD regionDataSize = GetRegionData(hrgn, 0, nullptr);
+ if (regionDataSize == 0)
+ return QRegion();
+
+ auto regionData = reinterpret_cast<LPRGNDATA>(malloc(regionDataSize));
+ if (!regionData)
+ return QRegion();
+
+ QRegion region;
+ if (GetRegionData(hrgn, regionDataSize, regionData) == regionDataSize) {
+ auto pRect = reinterpret_cast<LPRECT>(regionData->Buffer);
+ for (DWORD i = 0; i < regionData->rdh.nCount; ++i)
+ region += QRect(pRect[i].left, pRect[i].top,
+ pRect[i].right - pRect[i].left,
+ pRect[i].bottom - pRect[i].top);
+ }
+
+ free(regionData);
+ return region;
+}
+#endif // Q_OS_WIN || Q_QDOC
+
QT_END_NAMESPACE
diff --git a/src/gui/painting/qregion.h b/src/gui/painting/qregion.h
index 54de916198..b0051b6067 100644
--- a/src/gui/painting/qregion.h
+++ b/src/gui/painting/qregion.h
@@ -1,41 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the QtGui module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#ifndef QREGION_H
#define QREGION_H
@@ -44,6 +8,7 @@
#include <QtCore/qatomic.h>
#include <QtCore/qrect.h>
#include <QtGui/qwindowdefs.h>
+#include <QtCore/qcontainerfwd.h>
#ifndef QT_NO_DATASTREAM
#include <QtCore/qdatastream.h>
@@ -52,7 +17,6 @@
QT_BEGIN_NAMESPACE
-template <class T> class QVector;
class QVariant;
struct QRegionPrivate;
@@ -70,13 +34,12 @@ public:
QRegion(const QPolygon &pa, Qt::FillRule fillRule = Qt::OddEvenFill);
QRegion(const QRegion &region);
QRegion(QRegion &&other) noexcept
- : d(other.d) { other.d = const_cast<QRegionData*>(&shared_empty); }
+ : d(std::exchange(other.d, const_cast<QRegionData*>(&shared_empty))) {}
QRegion(const QBitmap &bitmap);
~QRegion();
QRegion &operator=(const QRegion &);
- inline QRegion &operator=(QRegion &&other) noexcept
- { qSwap(d, other.d); return *this; }
- inline void swap(QRegion &other) noexcept { qSwap(d, other.d); }
+ QT_MOVE_ASSIGNMENT_OPERATOR_IMPL_VIA_PURE_SWAP(QRegion)
+ void swap(QRegion &other) noexcept { qt_ptr_swap(d, other.d); }
bool isEmpty() const;
bool isNull() const;
@@ -97,45 +60,23 @@ public:
void translate(int dx, int dy);
inline void translate(const QPoint &p) { translate(p.x(), p.y()); }
- Q_REQUIRED_RESULT QRegion translated(int dx, int dy) const;
- Q_REQUIRED_RESULT inline QRegion translated(const QPoint &p) const { return translated(p.x(), p.y()); }
-
- Q_REQUIRED_RESULT QRegion united(const QRegion &r) const;
- Q_REQUIRED_RESULT QRegion united(const QRect &r) const;
- Q_REQUIRED_RESULT QRegion intersected(const QRegion &r) const;
- Q_REQUIRED_RESULT QRegion intersected(const QRect &r) const;
- Q_REQUIRED_RESULT QRegion subtracted(const QRegion &r) const;
- Q_REQUIRED_RESULT QRegion xored(const QRegion &r) const;
-
-#if QT_DEPRECATED_SINCE(5, 0)
- Q_REQUIRED_RESULT inline QT_DEPRECATED QRegion unite(const QRegion &r) const { return united(r); }
- Q_REQUIRED_RESULT inline QT_DEPRECATED QRegion unite(const QRect &r) const { return united(r); }
- Q_REQUIRED_RESULT inline QT_DEPRECATED QRegion intersect(const QRegion &r) const { return intersected(r); }
- Q_REQUIRED_RESULT inline QT_DEPRECATED QRegion intersect(const QRect &r) const { return intersected(r); }
- Q_REQUIRED_RESULT inline QT_DEPRECATED QRegion subtract(const QRegion &r) const { return subtracted(r); }
- Q_REQUIRED_RESULT inline QT_DEPRECATED QRegion eor(const QRegion &r) const { return xored(r); }
-#endif
+ [[nodiscard]] QRegion translated(int dx, int dy) const;
+ [[nodiscard]] inline QRegion translated(const QPoint &p) const { return translated(p.x(), p.y()); }
+
+ [[nodiscard]] QRegion united(const QRegion &r) const;
+ [[nodiscard]] QRegion united(const QRect &r) const;
+ [[nodiscard]] QRegion intersected(const QRegion &r) const;
+ [[nodiscard]] QRegion intersected(const QRect &r) const;
+ [[nodiscard]] QRegion subtracted(const QRegion &r) const;
+ [[nodiscard]] QRegion xored(const QRegion &r) const;
bool intersects(const QRegion &r) const;
bool intersects(const QRect &r) const;
QRect boundingRect() const noexcept;
-#if QT_DEPRECATED_SINCE(5, 11)
- QT_DEPRECATED_X("Use begin()/end() instead")
- QVector<QRect> rects() const;
-#endif
void setRects(const QRect *rect, int num);
int rectCount() const noexcept;
-#ifdef Q_COMPILER_MANGLES_RETURN_TYPE
- // ### Qt 6: remove these, they're kept for MSVC compat
- const QRegion operator|(const QRegion &r) const;
- const QRegion operator+(const QRegion &r) const;
- const QRegion operator+(const QRect &r) const;
- const QRegion operator&(const QRegion &r) const;
- const QRegion operator&(const QRect &r) const;
- const QRegion operator-(const QRegion &r) const;
- const QRegion operator^(const QRegion &r) const;
-#else
+
QRegion operator|(const QRegion &r) const;
QRegion operator+(const QRegion &r) const;
QRegion operator+(const QRect &r) const;
@@ -143,7 +84,7 @@ public:
QRegion operator&(const QRect &r) const;
QRegion operator-(const QRegion &r) const;
QRegion operator^(const QRegion &r) const;
-#endif // Q_COMPILER_MANGLES_RETURN_TYPE
+
QRegion& operator|=(const QRegion &r);
QRegion& operator+=(const QRegion &r);
QRegion& operator+=(const QRect &r);
@@ -156,6 +97,12 @@ public:
inline bool operator!=(const QRegion &r) const { return !(operator==(r)); }
operator QVariant() const;
+ // Platform specific conversion functions
+#if defined(Q_OS_WIN) || defined(Q_QDOC)
+ HRGN toHRGN() const;
+ static QRegion fromHRGN(HRGN hrgn);
+#endif
+
#ifndef QT_NO_DATASTREAM
friend Q_GUI_EXPORT QDataStream &operator<<(QDataStream &, const QRegion &);
friend Q_GUI_EXPORT QDataStream &operator>>(QDataStream &, QRegion &);
@@ -179,7 +126,7 @@ Q_GUI_EXPORT
static const struct QRegionData shared_empty;
static void cleanUp(QRegionData *x);
};
-Q_DECLARE_SHARED_NOT_MOVABLE_UNTIL_QT6(QRegion)
+Q_DECLARE_SHARED(QRegion)
/*****************************************************************************
QRegion stream functions
diff --git a/src/gui/painting/qrgb.h b/src/gui/painting/qrgb.h
index fe8306109b..150d889d33 100644
--- a/src/gui/painting/qrgb.h
+++ b/src/gui/painting/qrgb.h
@@ -1,41 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the QtGui module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#ifndef QRGB_H
#define QRGB_H
@@ -49,36 +13,36 @@ QT_BEGIN_NAMESPACE
typedef unsigned int QRgb; // RGB triplet
// non-namespaced Qt global variable
-const Q_DECL_UNUSED QRgb RGB_MASK = 0x00ffffff; // masks RGB values
+ inline constexpr QRgb RGB_MASK = 0x00ffffff; // masks RGB values
-inline Q_DECL_CONSTEXPR int qRed(QRgb rgb) // get red part of RGB
+inline constexpr int qRed(QRgb rgb) // get red part of RGB
{ return ((rgb >> 16) & 0xff); }
-inline Q_DECL_CONSTEXPR int qGreen(QRgb rgb) // get green part of RGB
+inline constexpr int qGreen(QRgb rgb) // get green part of RGB
{ return ((rgb >> 8) & 0xff); }
-inline Q_DECL_CONSTEXPR int qBlue(QRgb rgb) // get blue part of RGB
+inline constexpr int qBlue(QRgb rgb) // get blue part of RGB
{ return (rgb & 0xff); }
-inline Q_DECL_CONSTEXPR int qAlpha(QRgb rgb) // get alpha part of RGBA
+inline constexpr int qAlpha(QRgb rgb) // get alpha part of RGBA
{ return rgb >> 24; }
-inline Q_DECL_CONSTEXPR QRgb qRgb(int r, int g, int b)// set RGB value
+inline constexpr QRgb qRgb(int r, int g, int b) // set RGB value
{ return (0xffu << 24) | ((r & 0xffu) << 16) | ((g & 0xffu) << 8) | (b & 0xffu); }
-inline Q_DECL_CONSTEXPR QRgb qRgba(int r, int g, int b, int a)// set RGBA value
+inline constexpr QRgb qRgba(int r, int g, int b, int a) // set RGBA value
{ return ((a & 0xffu) << 24) | ((r & 0xffu) << 16) | ((g & 0xffu) << 8) | (b & 0xffu); }
-inline Q_DECL_CONSTEXPR int qGray(int r, int g, int b)// convert R,G,B to gray 0..255
+inline constexpr int qGray(int r, int g, int b) // convert R,G,B to gray 0..255
{ return (r*11+g*16+b*5)/32; }
-inline Q_DECL_CONSTEXPR int qGray(QRgb rgb) // convert RGB to gray 0..255
+inline constexpr int qGray(QRgb rgb) // convert RGB to gray 0..255
{ return qGray(qRed(rgb), qGreen(rgb), qBlue(rgb)); }
-inline Q_DECL_CONSTEXPR bool qIsGray(QRgb rgb)
+inline constexpr bool qIsGray(QRgb rgb)
{ return qRed(rgb) == qGreen(rgb) && qRed(rgb) == qBlue(rgb); }
-inline Q_DECL_RELAXED_CONSTEXPR QRgb qPremultiply(QRgb x)
+inline constexpr QRgb qPremultiply(QRgb x)
{
const uint a = qAlpha(x);
uint t = (x & 0xff00ff) * a;
diff --git a/src/gui/painting/qrgba64.h b/src/gui/painting/qrgba64.h
index 0e0b567890..9c0c210320 100644
--- a/src/gui/painting/qrgba64.h
+++ b/src/gui/painting/qrgba64.h
@@ -1,41 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the QtGui module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#ifndef QRGBA64_H
#define QRGBA64_H
@@ -64,16 +28,16 @@ class QRgba64 {
#endif
};
- explicit Q_ALWAYS_INLINE Q_DECL_CONSTEXPR QRgba64(quint64 c) : rgba(c) { }
+ explicit Q_ALWAYS_INLINE constexpr QRgba64(quint64 c) : rgba(c) { }
public:
QRgba64() = default;
- Q_DECL_CONSTEXPR static
+ constexpr static
QRgba64 fromRgba64(quint64 c)
{
return QRgba64(c);
}
- Q_DECL_CONSTEXPR static
+ constexpr static
QRgba64 fromRgba64(quint16 red, quint16 green, quint16 blue, quint16 alpha)
{
return fromRgba64(quint64(red) << RedShift
@@ -81,44 +45,43 @@ public:
| quint64(blue) << BlueShift
| quint64(alpha) << AlphaShift);
}
- Q_DECL_RELAXED_CONSTEXPR static QRgba64 fromRgba(quint8 red, quint8 green, quint8 blue, quint8 alpha)
+ constexpr static QRgba64 fromRgba(quint8 red, quint8 green, quint8 blue, quint8 alpha)
{
QRgba64 rgb64 = fromRgba64(red, green, blue, alpha);
// Expand the range so that 0x00 maps to 0x0000 and 0xff maps to 0xffff.
rgb64.rgba |= rgb64.rgba << 8;
return rgb64;
}
- Q_DECL_RELAXED_CONSTEXPR static
+ constexpr static
QRgba64 fromArgb32(uint rgb)
{
return fromRgba(quint8(rgb >> 16), quint8(rgb >> 8), quint8(rgb), quint8(rgb >> 24));
}
- Q_DECL_CONSTEXPR bool isOpaque() const
+ constexpr bool isOpaque() const
{
return (rgba & alphaMask()) == alphaMask();
}
- Q_DECL_CONSTEXPR bool isTransparent() const
+ constexpr bool isTransparent() const
{
return (rgba & alphaMask()) == 0;
}
- Q_DECL_CONSTEXPR quint16 red() const { return quint16(rgba >> RedShift); }
- Q_DECL_CONSTEXPR quint16 green() const { return quint16(rgba >> GreenShift); }
- Q_DECL_CONSTEXPR quint16 blue() const { return quint16(rgba >> BlueShift); }
- Q_DECL_CONSTEXPR quint16 alpha() const { return quint16(rgba >> AlphaShift); }
+ constexpr quint16 red() const { return quint16(rgba >> RedShift); }
+ constexpr quint16 green() const { return quint16(rgba >> GreenShift); }
+ constexpr quint16 blue() const { return quint16(rgba >> BlueShift); }
+ constexpr quint16 alpha() const { return quint16(rgba >> AlphaShift); }
void setRed(quint16 _red) { rgba = (rgba & ~(Q_UINT64_C(0xffff) << RedShift)) | (quint64(_red) << RedShift); }
void setGreen(quint16 _green) { rgba = (rgba & ~(Q_UINT64_C(0xffff) << GreenShift)) | (quint64(_green) << GreenShift); }
void setBlue(quint16 _blue) { rgba = (rgba & ~(Q_UINT64_C(0xffff) << BlueShift)) | (quint64(_blue) << BlueShift); }
void setAlpha(quint16 _alpha) { rgba = (rgba & ~(Q_UINT64_C(0xffff) << AlphaShift)) | (quint64(_alpha) << AlphaShift); }
- Q_DECL_CONSTEXPR quint8 red8() const { return div_257(red()); }
- Q_DECL_CONSTEXPR quint8 green8() const { return div_257(green()); }
- Q_DECL_CONSTEXPR quint8 blue8() const { return div_257(blue()); }
- Q_DECL_CONSTEXPR quint8 alpha8() const { return div_257(alpha()); }
- Q_DECL_CONSTEXPR uint toArgb32() const
+ constexpr quint8 red8() const { return div_257(red()); }
+ constexpr quint8 green8() const { return div_257(green()); }
+ constexpr quint8 blue8() const { return div_257(blue()); }
+ constexpr quint8 alpha8() const { return div_257(alpha()); }
+ constexpr uint toArgb32() const
{
-#if defined(__cpp_constexpr) && __cpp_constexpr-0 >= 201304
quint64 br = rgba & Q_UINT64_C(0xffff0000ffff);
quint64 ag = (rgba >> 16) & Q_UINT64_C(0xffff0000ffff);
br += Q_UINT64_C(0x8000000080);
@@ -136,16 +99,13 @@ public:
| (ag & 0xff00)
| ((br >> 32) & 0xff);
#endif
-#else
- return uint((alpha8() << 24) | (red8() << 16) | (green8() << 8) | blue8());
-#endif
}
- Q_DECL_CONSTEXPR ushort toRgb16() const
+ constexpr ushort toRgb16() const
{
return ushort((red() & 0xf800) | ((green() >> 10) << 5) | (blue() >> 11));
}
- Q_DECL_RELAXED_CONSTEXPR QRgba64 premultiplied() const
+ constexpr QRgba64 premultiplied() const
{
if (isOpaque())
return *this;
@@ -167,7 +127,7 @@ public:
#endif
}
- Q_DECL_RELAXED_CONSTEXPR QRgba64 unpremultiplied() const
+ constexpr QRgba64 unpremultiplied() const
{
#if Q_PROCESSOR_WORDSIZE < 8
return unpremultiplied_32bit();
@@ -176,23 +136,23 @@ public:
#endif
}
- Q_DECL_CONSTEXPR operator quint64() const
+ constexpr operator quint64() const
{
return rgba;
}
- QRgba64 operator=(quint64 _rgba)
+ QRgba64 &operator=(quint64 _rgba) noexcept
{
rgba = _rgba;
return *this;
}
private:
- static Q_DECL_CONSTEXPR Q_ALWAYS_INLINE quint64 alphaMask() { return Q_UINT64_C(0xffff) << AlphaShift; }
+ static constexpr Q_ALWAYS_INLINE quint64 alphaMask() { return Q_UINT64_C(0xffff) << AlphaShift; }
- static Q_DECL_CONSTEXPR Q_ALWAYS_INLINE quint8 div_257_floor(uint x) { return quint8((x - (x >> 8)) >> 8); }
- static Q_DECL_CONSTEXPR Q_ALWAYS_INLINE quint8 div_257(quint16 x) { return div_257_floor(x + 128U); }
- Q_DECL_RELAXED_CONSTEXPR Q_ALWAYS_INLINE QRgba64 unpremultiplied_32bit() const
+ static constexpr Q_ALWAYS_INLINE quint8 div_257_floor(uint x) { return quint8((x - (x >> 8)) >> 8); }
+ static constexpr Q_ALWAYS_INLINE quint8 div_257(quint16 x) { return div_257_floor(x + 128U); }
+ constexpr Q_ALWAYS_INLINE QRgba64 unpremultiplied_32bit() const
{
if (isOpaque() || isTransparent())
return *this;
@@ -202,7 +162,7 @@ private:
const quint16 b = quint16((blue() * 0xffff + a/2) / a);
return fromRgba64(r, g, b, quint16(a));
}
- Q_DECL_RELAXED_CONSTEXPR Q_ALWAYS_INLINE QRgba64 unpremultiplied_64bit() const
+ constexpr Q_ALWAYS_INLINE QRgba64 unpremultiplied_64bit() const
{
if (isOpaque() || isTransparent())
return *this;
@@ -217,36 +177,36 @@ private:
Q_DECLARE_TYPEINFO(QRgba64, Q_PRIMITIVE_TYPE);
-Q_DECL_CONSTEXPR inline QRgba64 qRgba64(quint16 r, quint16 g, quint16 b, quint16 a)
+constexpr inline QRgba64 qRgba64(quint16 r, quint16 g, quint16 b, quint16 a)
{
return QRgba64::fromRgba64(r, g, b, a);
}
-Q_DECL_CONSTEXPR inline QRgba64 qRgba64(quint64 c)
+constexpr inline QRgba64 qRgba64(quint64 c)
{
return QRgba64::fromRgba64(c);
}
-Q_DECL_RELAXED_CONSTEXPR inline QRgba64 qPremultiply(QRgba64 c)
+constexpr inline QRgba64 qPremultiply(QRgba64 c)
{
return c.premultiplied();
}
-Q_DECL_RELAXED_CONSTEXPR inline QRgba64 qUnpremultiply(QRgba64 c)
+constexpr inline QRgba64 qUnpremultiply(QRgba64 c)
{
return c.unpremultiplied();
}
-inline Q_DECL_CONSTEXPR uint qRed(QRgba64 rgb)
+inline constexpr uint qRed(QRgba64 rgb)
{ return rgb.red8(); }
-inline Q_DECL_CONSTEXPR uint qGreen(QRgba64 rgb)
+inline constexpr uint qGreen(QRgba64 rgb)
{ return rgb.green8(); }
-inline Q_DECL_CONSTEXPR uint qBlue(QRgba64 rgb)
+inline constexpr uint qBlue(QRgba64 rgb)
{ return rgb.blue8(); }
-inline Q_DECL_CONSTEXPR uint qAlpha(QRgba64 rgb)
+inline constexpr uint qAlpha(QRgba64 rgb)
{ return rgb.alpha8(); }
QT_END_NAMESPACE
diff --git a/src/gui/painting/qrgba64.qdoc b/src/gui/painting/qrgba64.qdoc
index 3ee8a355e6..fd78b539a3 100644
--- a/src/gui/painting/qrgba64.qdoc
+++ b/src/gui/painting/qrgba64.qdoc
@@ -1,29 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the documentation of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:FDL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Free Documentation License Usage
-** Alternatively, this file may be used under the terms of the GNU Free
-** Documentation License version 1.3 as published by the Free Software
-** Foundation and appearing in the file included in the packaging of
-** this file. Please review the following information to ensure
-** the GNU Free Documentation License version 1.3 requirements
-** will be met: https://www.gnu.org/licenses/fdl-1.3.html.
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GFDL-1.3-no-invariants-only
/*!
\class QRgba64
diff --git a/src/gui/painting/qrgba64_p.h b/src/gui/painting/qrgba64_p.h
index d145dbfbea..ae8b6fd8cb 100644
--- a/src/gui/painting/qrgba64_p.h
+++ b/src/gui/painting/qrgba64_p.h
@@ -1,41 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the QtGui module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2020 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#ifndef QRGBA64_P_H
#define QRGBA64_P_H
@@ -64,40 +28,30 @@ inline QRgba64 combineAlpha256(QRgba64 rgba64, uint alpha256)
return QRgba64::fromRgba64(rgba64.red(), rgba64.green(), rgba64.blue(), (rgba64.alpha() * alpha256) >> 8);
}
-inline QRgba64 multiplyAlpha65535(QRgba64 rgba64, uint alpha65535)
-{
- return QRgba64::fromRgba64(qt_div_65535(rgba64.red() * alpha65535),
- qt_div_65535(rgba64.green() * alpha65535),
- qt_div_65535(rgba64.blue() * alpha65535),
- qt_div_65535(rgba64.alpha() * alpha65535));
-}
-
-#ifdef __SSE2__
-Q_ALWAYS_INLINE __m128i multiplyAlpha65535(__m128i rgba64, __m128i va)
+#if defined(__SSE2__)
+static inline __m128i Q_DECL_VECTORCALL multiplyAlpha65535(__m128i rgba64, __m128i va)
{
__m128i vs = rgba64;
vs = _mm_unpacklo_epi16(_mm_mullo_epi16(vs, va), _mm_mulhi_epu16(vs, va));
vs = _mm_add_epi32(vs, _mm_srli_epi32(vs, 16));
vs = _mm_add_epi32(vs, _mm_set1_epi32(0x8000));
vs = _mm_srai_epi32(vs, 16);
- vs = _mm_packs_epi32(vs, _mm_setzero_si128());
+ vs = _mm_packs_epi32(vs, vs);
return vs;
}
-Q_ALWAYS_INLINE __m128i multiplyAlpha65535(__m128i rgba64, uint alpha65535)
+static inline __m128i Q_DECL_VECTORCALL multiplyAlpha65535(__m128i rgba64, uint alpha65535)
{
const __m128i va = _mm_shufflelo_epi16(_mm_cvtsi32_si128(alpha65535), _MM_SHUFFLE(0, 0, 0, 0));
return multiplyAlpha65535(rgba64, va);
}
-#endif
-
-#if defined(__ARM_NEON__)
-Q_ALWAYS_INLINE uint16x4_t multiplyAlpha65535(uint16x4_t rgba64, uint16x4_t alpha65535)
+#elif defined(__ARM_NEON__)
+static inline uint16x4_t multiplyAlpha65535(uint16x4_t rgba64, uint16x4_t alpha65535)
{
uint32x4_t vs32 = vmull_u16(rgba64, alpha65535); // vs = vs * alpha
vs32 = vsraq_n_u32(vs32, vs32, 16); // vs = vs + (vs >> 16)
return vrshrn_n_u32(vs32, 16); // vs = (vs + 0x8000) >> 16
}
-Q_ALWAYS_INLINE uint16x4_t multiplyAlpha65535(uint16x4_t rgba64, uint alpha65535)
+static inline uint16x4_t multiplyAlpha65535(uint16x4_t rgba64, uint alpha65535)
{
uint32x4_t vs32 = vmull_n_u16(rgba64, alpha65535); // vs = vs * alpha
vs32 = vsraq_n_u32(vs32, vs32, 16); // vs = vs + (vs >> 16)
@@ -105,77 +59,144 @@ Q_ALWAYS_INLINE uint16x4_t multiplyAlpha65535(uint16x4_t rgba64, uint alpha65535
}
#endif
-template<typename T>
-inline T multiplyAlpha255(T rgba64, uint alpha255)
+static inline QRgba64 multiplyAlpha65535(QRgba64 rgba64, uint alpha65535)
{
+#if defined(__SSE2__)
+ const __m128i v = _mm_loadl_epi64(reinterpret_cast<const __m128i *>(&rgba64));
+ const __m128i vr = multiplyAlpha65535(v, alpha65535);
+ QRgba64 r;
+ _mm_storel_epi64(reinterpret_cast<__m128i *>(&r), vr);
+ return r;
+#elif defined(__ARM_NEON__)
+ const uint16x4_t v = vreinterpret_u16_u64(vld1_u64(reinterpret_cast<const uint64_t *>(&rgba64)));
+ const uint16x4_t vr = multiplyAlpha65535(v, alpha65535);
+ QRgba64 r;
+ vst1_u64(reinterpret_cast<uint64_t *>(&r), vreinterpret_u64_u16(vr));
+ return r;
+#else
+ return QRgba64::fromRgba64(qt_div_65535(rgba64.red() * alpha65535),
+ qt_div_65535(rgba64.green() * alpha65535),
+ qt_div_65535(rgba64.blue() * alpha65535),
+ qt_div_65535(rgba64.alpha() * alpha65535));
+#endif
+}
+
#if defined(__SSE2__) || defined(__ARM_NEON__)
+template<typename T>
+static inline T Q_DECL_VECTORCALL multiplyAlpha255(T rgba64, uint alpha255)
+{
return multiplyAlpha65535(rgba64, alpha255 * 257);
+}
#else
+template<typename T>
+static inline T multiplyAlpha255(T rgba64, uint alpha255)
+{
return QRgba64::fromRgba64(qt_div_255(rgba64.red() * alpha255),
qt_div_255(rgba64.green() * alpha255),
qt_div_255(rgba64.blue() * alpha255),
qt_div_255(rgba64.alpha() * alpha255));
-#endif
-}
-
-inline QRgba64 interpolate255(QRgba64 x, uint alpha1, QRgba64 y, uint alpha2)
-{
- return QRgba64::fromRgba64(multiplyAlpha255(x, alpha1) + multiplyAlpha255(y, alpha2));
}
+#endif
#if defined __SSE2__
-Q_ALWAYS_INLINE __m128i interpolate255(__m128i x, uint alpha1, __m128i y, uint alpha2)
+static inline __m128i Q_DECL_VECTORCALL interpolate255(__m128i x, uint alpha1, __m128i y, uint alpha2)
{
- return _mm_add_epi32(multiplyAlpha255(x, alpha1), multiplyAlpha255(y, alpha2));
+ return _mm_add_epi16(multiplyAlpha255(x, alpha1), multiplyAlpha255(y, alpha2));
}
#endif
#if defined __ARM_NEON__
-Q_ALWAYS_INLINE uint16x4_t interpolate255(uint16x4_t x, uint alpha1, uint16x4_t y, uint alpha2)
+inline uint16x4_t interpolate255(uint16x4_t x, uint alpha1, uint16x4_t y, uint alpha2)
{
return vadd_u16(multiplyAlpha255(x, alpha1), multiplyAlpha255(y, alpha2));
}
#endif
-inline QRgba64 interpolate65535(QRgba64 x, uint alpha1, QRgba64 y, uint alpha2)
+static inline QRgba64 interpolate255(QRgba64 x, uint alpha1, QRgba64 y, uint alpha2)
{
- return QRgba64::fromRgba64(multiplyAlpha65535(x, alpha1) + multiplyAlpha65535(y, alpha2));
+#if defined(__SSE2__)
+ const __m128i vx = _mm_loadl_epi64(reinterpret_cast<const __m128i *>(&x));
+ const __m128i vy = _mm_loadl_epi64(reinterpret_cast<const __m128i *>(&y));
+ const __m128i vr = interpolate255(vx, alpha1, vy, alpha2);
+ QRgba64 r;
+ _mm_storel_epi64(reinterpret_cast<__m128i *>(&r), vr);
+ return r;
+#elif defined(__ARM_NEON__)
+ const uint16x4_t vx = vreinterpret_u16_u64(vld1_u64(reinterpret_cast<const uint64_t *>(&x)));
+ const uint16x4_t vy = vreinterpret_u16_u64(vld1_u64(reinterpret_cast<const uint64_t *>(&y)));
+ const uint16x4_t vr = interpolate255(vx, alpha1, vy, alpha2);
+ QRgba64 r;
+ vst1_u64(reinterpret_cast<uint64_t *>(&r), vreinterpret_u64_u16(vr));
+ return r;
+#else
+ return QRgba64::fromRgba64(multiplyAlpha255(x, alpha1) + multiplyAlpha255(y, alpha2));
+#endif
}
#if defined __SSE2__
-Q_ALWAYS_INLINE __m128i interpolate65535(__m128i x, uint alpha1, __m128i y, uint alpha2)
+static inline __m128i Q_DECL_VECTORCALL interpolate65535(__m128i x, uint alpha1, __m128i y, uint alpha2)
{
- return _mm_add_epi32(multiplyAlpha65535(x, alpha1), multiplyAlpha65535(y, alpha2));
+ return _mm_add_epi16(multiplyAlpha65535(x, alpha1), multiplyAlpha65535(y, alpha2));
}
-// alpha2 below is const-ref because otherwise MSVC2015 complains that it can't 16-byte align the argument.
-Q_ALWAYS_INLINE __m128i interpolate65535(__m128i x, __m128i alpha1, __m128i y, const __m128i &alpha2)
+
+static inline __m128i Q_DECL_VECTORCALL interpolate65535(__m128i x, __m128i alpha1, __m128i y, __m128i alpha2)
{
- return _mm_add_epi32(multiplyAlpha65535(x, alpha1), multiplyAlpha65535(y, alpha2));
+ return _mm_add_epi16(multiplyAlpha65535(x, alpha1), multiplyAlpha65535(y, alpha2));
}
#endif
#if defined __ARM_NEON__
-Q_ALWAYS_INLINE uint16x4_t interpolate65535(uint16x4_t x, uint alpha1, uint16x4_t y, uint alpha2)
+inline uint16x4_t interpolate65535(uint16x4_t x, uint alpha1, uint16x4_t y, uint alpha2)
{
return vadd_u16(multiplyAlpha65535(x, alpha1), multiplyAlpha65535(y, alpha2));
}
-Q_ALWAYS_INLINE uint16x4_t interpolate65535(uint16x4_t x, uint16x4_t alpha1, uint16x4_t y, uint16x4_t alpha2)
+inline uint16x4_t interpolate65535(uint16x4_t x, uint16x4_t alpha1, uint16x4_t y, uint16x4_t alpha2)
{
return vadd_u16(multiplyAlpha65535(x, alpha1), multiplyAlpha65535(y, alpha2));
}
#endif
-inline QRgba64 addWithSaturation(QRgba64 a, QRgba64 b)
+static inline QRgba64 interpolate65535(QRgba64 x, uint alpha1, QRgba64 y, uint alpha2)
{
+#if defined(__SSE2__)
+ const __m128i vx = _mm_loadl_epi64(reinterpret_cast<const __m128i *>(&x));
+ const __m128i vy = _mm_loadl_epi64(reinterpret_cast<const __m128i *>(&y));
+ const __m128i vr = interpolate65535(vx, alpha1, vy, alpha2);
+ QRgba64 r;
+ _mm_storel_epi64(reinterpret_cast<__m128i *>(&r), vr);
+ return r;
+#elif defined(__ARM_NEON__)
+ const uint16x4_t vx = vreinterpret_u16_u64(vld1_u64(reinterpret_cast<const uint64_t *>(&x)));
+ const uint16x4_t vy = vreinterpret_u16_u64(vld1_u64(reinterpret_cast<const uint64_t *>(&y)));
+ const uint16x4_t vr = interpolate65535(vx, alpha1, vy, alpha2);
+ QRgba64 r;
+ vst1_u64(reinterpret_cast<uint64_t *>(&r), vreinterpret_u64_u16(vr));
+ return r;
+#else
+ return QRgba64::fromRgba64(multiplyAlpha65535(x, alpha1) + multiplyAlpha65535(y, alpha2));
+#endif
+}
+
+static inline QRgba64 addWithSaturation(QRgba64 a, QRgba64 b)
+{
+#if defined(__SSE2__)
+ const __m128i va = _mm_loadl_epi64(reinterpret_cast<const __m128i *>(&a));
+ const __m128i vb = _mm_loadl_epi64(reinterpret_cast<const __m128i *>(&b));
+ const __m128i vr = _mm_adds_epu16(va, vb);
+ QRgba64 r;
+ _mm_storel_epi64(reinterpret_cast<__m128i *>(&r), vr);
+ return r;
+#else
return QRgba64::fromRgba64(qMin(a.red() + b.red(), 65535),
qMin(a.green() + b.green(), 65535),
qMin(a.blue() + b.blue(), 65535),
qMin(a.alpha() + b.alpha(), 65535));
+#endif
}
#if QT_COMPILER_SUPPORTS_HERE(SSE2)
QT_FUNCTION_TARGET(SSE2)
-Q_ALWAYS_INLINE uint toArgb32(__m128i v)
+static inline uint Q_DECL_VECTORCALL toArgb32(__m128i v)
{
v = _mm_unpacklo_epi16(v, _mm_setzero_si128());
v = _mm_add_epi32(v, _mm_set1_epi32(128));
@@ -186,7 +207,7 @@ Q_ALWAYS_INLINE uint toArgb32(__m128i v)
return _mm_cvtsi128_si32(v);
}
#elif defined __ARM_NEON__
-Q_ALWAYS_INLINE uint toArgb32(uint16x4_t v)
+static inline uint toArgb32(uint16x4_t v)
{
v = vsub_u16(v, vrshr_n_u16(v, 8));
v = vrshr_n_u16(v, 8);
@@ -195,10 +216,10 @@ Q_ALWAYS_INLINE uint toArgb32(uint16x4_t v)
}
#endif
-inline uint toArgb32(QRgba64 rgba64)
+static inline uint toArgb32(QRgba64 rgba64)
{
#if defined __SSE2__
- __m128i v = _mm_loadl_epi64((const __m128i *)&rgba64);
+ __m128i v = _mm_loadl_epi64(reinterpret_cast<const __m128i *>(&rgba64));
v = _mm_shufflelo_epi16(v, _MM_SHUFFLE(3, 0, 1, 2));
return toArgb32(v);
#elif defined __ARM_NEON__
@@ -215,10 +236,10 @@ inline uint toArgb32(QRgba64 rgba64)
#endif
}
-inline uint toRgba8888(QRgba64 rgba64)
+static inline uint toRgba8888(QRgba64 rgba64)
{
#if defined __SSE2__
- __m128i v = _mm_loadl_epi64((const __m128i *)&rgba64);
+ __m128i v = _mm_loadl_epi64(reinterpret_cast<const __m128i *>(&rgba64));
return toArgb32(v);
#elif defined __ARM_NEON__
uint16x4_t v = vreinterpret_u16_u64(vld1_u64(reinterpret_cast<const uint64_t *>(&rgba64)));
@@ -228,12 +249,12 @@ inline uint toRgba8888(QRgba64 rgba64)
#endif
}
-inline QRgba64 rgbBlend(QRgba64 d, QRgba64 s, uint rgbAlpha)
+static inline QRgba64 rgbBlend(QRgba64 d, QRgba64 s, uint rgbAlpha)
{
QRgba64 blend;
#if defined(__SSE2__)
- __m128i vd = _mm_loadl_epi64((const __m128i *)&d);
- __m128i vs = _mm_loadl_epi64((const __m128i *)&s);
+ __m128i vd = _mm_loadl_epi64(reinterpret_cast<const __m128i *>(&d));
+ __m128i vs = _mm_loadl_epi64(reinterpret_cast<const __m128i *>(&s));
__m128i va = _mm_cvtsi32_si128(rgbAlpha);
va = _mm_unpacklo_epi8(va, va);
va = _mm_shufflelo_epi16(va, _MM_SHUFFLE(3, 0, 1, 2));
@@ -245,9 +266,9 @@ inline QRgba64 rgbBlend(QRgba64 d, QRgba64 s, uint rgbAlpha)
vd = _mm_add_epi32(vd, _mm_srli_epi32(vd, 16));
vd = _mm_add_epi32(vd, _mm_set1_epi32(0x8000));
vd = _mm_srai_epi32(vd, 16);
- vd = _mm_packs_epi32(vd, _mm_setzero_si128());
+ vd = _mm_packs_epi32(vd, vd);
- _mm_storel_epi64((__m128i *)&blend, vd);
+ _mm_storel_epi64(reinterpret_cast<__m128i *>(&blend), vd);
#elif defined(__ARM_NEON__)
uint16x4_t vd = vreinterpret_u16_u64(vmov_n_u64(d));
uint16x4_t vs = vreinterpret_u16_u64(vmov_n_u64(s));
@@ -274,21 +295,39 @@ inline QRgba64 rgbBlend(QRgba64 d, QRgba64 s, uint rgbAlpha)
return blend;
}
-static Q_ALWAYS_INLINE void blend_pixel(QRgba64 &dst, QRgba64 src)
+static inline void blend_pixel(QRgba64 &dst, QRgba64 src)
{
if (src.isOpaque())
dst = src;
- else if (!src.isTransparent())
+ else if (!src.isTransparent()) {
+#if defined(__SSE2__)
+ const __m128i vd = _mm_loadl_epi64(reinterpret_cast<const __m128i *>(&dst));
+ const __m128i vs = _mm_loadl_epi64(reinterpret_cast<const __m128i *>(&src));
+ const __m128i via = _mm_xor_si128(_mm_set1_epi16(-1), _mm_shufflelo_epi16(vs, _MM_SHUFFLE(3, 3, 3, 3)));
+ const __m128i vr = _mm_add_epi16(vs, multiplyAlpha65535(vd, via));
+ _mm_storel_epi64(reinterpret_cast<__m128i *>(&dst), vr);
+#else
dst = src + multiplyAlpha65535(dst, 65535 - src.alpha());
+#endif
+ }
}
-static Q_ALWAYS_INLINE void blend_pixel(QRgba64 &dst, QRgba64 src, const int const_alpha)
+static inline void blend_pixel(QRgba64 &dst, QRgba64 src, const int const_alpha)
{
if (const_alpha == 255)
return blend_pixel(dst, src);
if (!src.isTransparent()) {
+#if defined(__SSE2__)
+ const __m128i vd = _mm_loadl_epi64(reinterpret_cast<const __m128i *>(&dst));
+ __m128i vs = _mm_loadl_epi64(reinterpret_cast<const __m128i *>(&src));
+ vs = multiplyAlpha255(vs, const_alpha);
+ const __m128i via = _mm_xor_si128(_mm_set1_epi16(-1), _mm_shufflelo_epi16(vs, _MM_SHUFFLE(3, 3, 3, 3)));
+ const __m128i vr = _mm_add_epi16(vs, multiplyAlpha65535(vd, via));
+ _mm_storel_epi64(reinterpret_cast<__m128i *>(&dst), vr);
+#else
src = multiplyAlpha255(src, const_alpha);
dst = src + multiplyAlpha65535(dst, 65535 - src.alpha());
+#endif
}
}
diff --git a/src/gui/painting/qrgbafloat.h b/src/gui/painting/qrgbafloat.h
new file mode 100644
index 0000000000..da74328f71
--- /dev/null
+++ b/src/gui/painting/qrgbafloat.h
@@ -0,0 +1,126 @@
+// Copyright (C) 2021 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
+
+#ifndef QRGBAFLOAT_H
+#define QRGBAFLOAT_H
+
+#include <QtGui/qtguiglobal.h>
+#include <QtCore/qfloat16.h>
+
+#include <algorithm>
+#include <cmath>
+#include <type_traits>
+
+QT_BEGIN_NAMESPACE
+
+template<typename F>
+class alignas(sizeof(F) * 4) QRgbaFloat
+{
+ static_assert(std::is_same<F, qfloat16>::value || std::is_same<F, float>::value);
+public:
+ using Type = F;
+#if defined(__AVX512FP16__) && QFLOAT16_IS_NATIVE
+ // AVX512FP16 has multiplication instructions
+ using FastType = F;
+#else
+ // use FP32 for multiplications
+ using FastType = float;
+#endif
+ F r;
+ F g;
+ F b;
+ F a;
+
+ static constexpr
+ QRgbaFloat fromRgba64(quint16 red, quint16 green, quint16 blue, quint16 alpha)
+ {
+ constexpr FastType scale = FastType(1.0f / 65535.0f);
+ return QRgbaFloat{
+ F(red * scale),
+ F(green * scale),
+ F(blue * scale),
+ F(alpha * scale) };
+ }
+
+ static constexpr
+ QRgbaFloat fromRgba(quint8 red, quint8 green, quint8 blue, quint8 alpha)
+ {
+ constexpr FastType scale = FastType(1.0f / 255.0f);
+ return QRgbaFloat{
+ F(red * scale),
+ F(green * scale),
+ F(blue * scale),
+ F(alpha * scale) };
+ }
+ static constexpr
+ QRgbaFloat fromArgb32(uint rgb)
+ {
+ return fromRgba(quint8(rgb >> 16), quint8(rgb >> 8), quint8(rgb), quint8(rgb >> 24));
+ }
+
+ constexpr bool isOpaque() const { return a >= FastType(1.0f); }
+ constexpr bool isTransparent() const { return a <= FastType(0.0f); }
+
+ constexpr float red() const { return r; }
+ constexpr float green() const { return g; }
+ constexpr float blue() const { return b; }
+ constexpr float alpha() const { return a; }
+ void setRed(float _red) { r = F(_red); }
+ void setGreen(float _green) { g = F(_green); }
+ void setBlue(float _blue) { b = F(_blue); }
+ void setAlpha(float _alpha) { a = F(_alpha); }
+
+ constexpr float redNormalized() const { return clamp01(r); }
+ constexpr float greenNormalized() const { return clamp01(g); }
+ constexpr float blueNormalized() const { return clamp01(b); }
+ constexpr float alphaNormalized() const { return clamp01(a); }
+
+ constexpr quint8 red8() const { return qRound(redNormalized() * FastType(255.0f)); }
+ constexpr quint8 green8() const { return qRound(greenNormalized() * FastType(255.0f)); }
+ constexpr quint8 blue8() const { return qRound(blueNormalized() * FastType(255.0f)); }
+ constexpr quint8 alpha8() const { return qRound(alphaNormalized() * FastType(255.0f)); }
+ constexpr uint toArgb32() const
+ {
+ return uint((alpha8() << 24) | (red8() << 16) | (green8() << 8) | blue8());
+ }
+
+ constexpr quint16 red16() const { return qRound(redNormalized() * FastType(65535.0f)); }
+ constexpr quint16 green16() const { return qRound(greenNormalized() * FastType(65535.0f)); }
+ constexpr quint16 blue16() const { return qRound(blueNormalized() * FastType(65535.0f)); }
+ constexpr quint16 alpha16() const { return qRound(alphaNormalized() * FastType(65535.0f)); }
+
+ constexpr Q_ALWAYS_INLINE QRgbaFloat premultiplied() const
+ {
+ return QRgbaFloat{r * a, g * a, b * a, a};
+ }
+ constexpr Q_ALWAYS_INLINE QRgbaFloat unpremultiplied() const
+ {
+ if (a <= F{0.0f})
+ return QRgbaFloat{}; // default-initialization: zeroes
+ if (a >= F{1.0f})
+ return *this;
+ const FastType ia = 1.0f / a;
+ return QRgbaFloat{F(r * ia), F(g * ia), F(b * ia), F(a)};
+ }
+ constexpr bool operator==(QRgbaFloat f) const
+ {
+ return r == f.r && g == f.g && b == f.b && a == f.a;
+ }
+ constexpr bool operator!=(QRgbaFloat f) const
+ {
+ return !(*this == f);
+ }
+
+private:
+ constexpr static FastType clamp01(Type f)
+ {
+ return std::clamp(FastType(f), FastType(0.0f), FastType(1.0f));
+ }
+};
+
+typedef QRgbaFloat<qfloat16> QRgbaFloat16;
+typedef QRgbaFloat<float> QRgbaFloat32;
+
+QT_END_NAMESPACE
+
+#endif // QRGBAFLOAT_H
diff --git a/src/gui/painting/qrgbafloat.qdoc b/src/gui/painting/qrgbafloat.qdoc
new file mode 100644
index 0000000000..3ec0d209f4
--- /dev/null
+++ b/src/gui/painting/qrgbafloat.qdoc
@@ -0,0 +1,241 @@
+// Copyright (C) 2021 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GFDL-1.3-no-invariants-only
+
+/*!
+ \class QRgbaFloat
+ \brief The QRgbaFloat struct contains a four part RGBA floating-point color.
+ \since 6.2
+
+ \ingroup painting
+ \inmodule QtGui
+
+ \sa QRgb, QRgba64, QColor
+*/
+
+/*!
+ \typealias QRgbaFloat::FastType
+
+ Alias for \e float.
+*/
+
+/*!
+ \typedef QRgbaFloat16
+ \relates QRgbaFloat
+
+ A 64-bit data-structure containing four 16-bit floating point color channels: Red, green, blue and alpha.
+*/
+
+/*!
+ \typedef QRgbaFloat32
+ \relates QRgbaFloat
+
+ A 128-bit data-structure containing four 32-bit floating point color channels: Red, green, blue and alpha.
+*/
+
+/*!
+ \fn template<typename F> QRgbaFloat QRgbaFloat<F>::fromRgba64(quint16 red, quint16 green, quint16 blue, quint16 alpha)
+
+ Constructs a QRgbaFloat value from the four 16-bit integer color channels \a red, \a green, \a blue and \a alpha.
+
+ \sa fromRgba()
+*/
+
+/*!
+ \fn template<typename F> QRgbaFloat QRgbaFloat<F>::fromRgba(quint8 red, quint8 green, quint8 blue, quint8 alpha)
+
+ Constructs a QRgbaFloat value from the four 8-bit color channels \a red, \a green, \a blue and \a alpha.
+
+ \sa fromArgb32()
+*/
+
+/*!
+ \fn template<typename F> QRgbaFloat QRgbaFloat<F>::fromArgb32(uint rgb)
+
+ Constructs a QRgbaFloat value from the 32bit ARGB value \a rgb.
+
+ \sa fromRgba(), toArgb32()
+*/
+
+/*!
+ \fn template<typename F> bool QRgbaFloat<F>::isOpaque() const
+
+ Returns whether the color is fully opaque.
+
+ \sa isTransparent(), alpha()
+*/
+
+/*!
+ \fn template<typename F> bool QRgbaFloat<F>::isTransparent() const
+
+ Returns whether the color is fully transparent.
+
+ \sa isOpaque(), alpha()
+*/
+
+/*!
+ \fn template<typename F> float QRgbaFloat<F>::red() const
+
+ Returns the red color component.
+
+ \sa setRed()
+*/
+
+/*!
+ \fn template<typename F> void QRgbaFloat<F>::setRed(float red)
+
+ Sets the red color component of this color to \a red.
+
+ \sa red()
+*/
+
+/*!
+ \fn template<typename F> float QRgbaFloat<F>::green() const
+
+ Returns the green color component.
+
+ \sa setGreen()
+*/
+
+/*!
+ \fn template<typename F> void QRgbaFloat<F>::setGreen(float green)
+
+ Sets the green color component of this color to \a green.
+
+ \sa green()
+*/
+
+/*!
+ \fn template<typename F> float QRgbaFloat<F>::blue() const
+
+ Returns the blue color component.
+
+ \sa setBlue()
+*/
+
+/*!
+ \fn template<typename F> void QRgbaFloat<F>::setBlue(float blue)
+
+ Sets the blue color component of this color to \a blue.
+
+ \sa blue()
+*/
+
+/*!
+ \fn template<typename F> float QRgbaFloat<F>::alpha() const
+
+ Returns the alpha channel.
+
+ \sa setAlpha()
+*/
+
+/*!
+ \fn template<typename F> void QRgbaFloat<F>::setAlpha(float alpha)
+
+ Sets the alpha of this color to \a alpha.
+
+ \sa alpha()
+*/
+
+/*!
+ \fn template<typename F> float QRgbaFloat<F>::redNormalized() const
+
+ Returns the red color component normalized to values between \c 0.0f and \c 1.0f.
+
+ \sa setRed()
+*/
+
+/*!
+ \fn template<typename F> float QRgbaFloat<F>::greenNormalized() const
+
+ Returns the green color component normalized to values between \c 0.0f and \c 1.0f.
+
+ \sa setGreen()
+*/
+
+/*!
+ \fn template<typename F> float QRgbaFloat<F>::blueNormalized() const
+
+ Returns the blue color component normalized to values between \c 0.0f and \c 1.0f.
+
+ \sa setBlue()
+*/
+
+/*!
+ \fn template<typename F> float QRgbaFloat<F>::alphaNormalized() const
+
+ Returns the alpha channel normalized to values between \c 0.0f and \c 1.0f.
+
+ \sa alpha()
+*/
+
+/*!
+ \fn template<typename F> quint8 QRgbaFloat<F>::red8() const
+
+ Returns the red color component as an 8-bit.
+*/
+
+/*!
+ \fn template<typename F> quint8 QRgbaFloat<F>::green8() const
+
+ Returns the green color component as an 8-bit.
+*/
+
+/*!
+ \fn template<typename F> quint8 QRgbaFloat<F>::blue8() const
+
+ Returns the blue color component as an 8-bit.
+*/
+
+/*!
+ \fn template<typename F> quint8 QRgbaFloat<F>::alpha8() const
+
+ Returns the alpha channel as an 8-bit.
+*/
+
+/*!
+ \fn template<typename F> uint QRgbaFloat<F>::toArgb32() const
+
+ Returns the color as a 32-bit ARGB value.
+
+ \sa fromArgb32()
+*/
+
+/*!
+ \fn template<typename F> quint16 QRgbaFloat<F>::red16() const
+
+ Returns the red color component as a 16-bit integer.
+*/
+
+/*!
+ \fn template<typename F> quint16 QRgbaFloat<F>::green16() const
+
+ Returns the green color component as a 16-bit integer.
+*/
+
+/*!
+ \fn template<typename F> quint16 QRgbaFloat<F>::blue16() const
+
+ Returns the blue color component as a 16-bit integer.
+*/
+
+/*!
+ \fn template<typename F> quint16 QRgbaFloat<F>::alpha16() const
+
+ Returns the alpha channel as a 16-bit integer.
+*/
+
+/*!
+ \fn template<typename F> QRgbaFloat QRgbaFloat<F>::premultiplied() const
+
+ Returns the color with the alpha premultiplied.
+
+ \sa unpremultiplied()
+*/
+
+/*!
+ \fn template<typename F> QRgbaFloat QRgbaFloat<F>::unpremultiplied() const
+
+ Returns the color with the alpha unpremultiplied.
+
+ \sa premultiplied()
+*/
diff --git a/src/gui/painting/qrhibackingstore.cpp b/src/gui/painting/qrhibackingstore.cpp
new file mode 100644
index 0000000000..586dfb44a4
--- /dev/null
+++ b/src/gui/painting/qrhibackingstore.cpp
@@ -0,0 +1,68 @@
+// Copyright (C) 2022 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
+
+#include "qrhibackingstore_p.h"
+#include <private/qimage_p.h>
+
+QT_BEGIN_NAMESPACE
+
+QRhiBackingStore::QRhiBackingStore(QWindow *window)
+ : QRasterBackingStore(window)
+{
+}
+
+QRhiBackingStore::~QRhiBackingStore()
+{
+}
+
+void QRhiBackingStore::flush(QWindow *flushedWindow, const QRegion &region, const QPoint &offset)
+{
+ Q_UNUSED(region);
+ Q_UNUSED(offset);
+
+ if (flushedWindow->surfaceType() != window()->surfaceType()) {
+ qWarning() << "Cannot flush child window" << flushedWindow
+ << "with surface type" << flushedWindow->surfaceType() << ";"
+ << "Must match" << window()->surfaceType() << "of" << window();
+
+ // FIXME: Support different surface types by not tying the
+ // RHI config to the backing store itself (per window config).
+ return;
+ }
+
+ if (!rhi()) {
+ QPlatformBackingStoreRhiConfig rhiConfig;
+ switch (window()->surfaceType()) {
+ case QSurface::OpenGLSurface:
+ rhiConfig.setApi(QPlatformBackingStoreRhiConfig::OpenGL);
+ break;
+ case QSurface::MetalSurface:
+ rhiConfig.setApi(QPlatformBackingStoreRhiConfig::Metal);
+ break;
+ default:
+ Q_UNREACHABLE();
+ }
+ rhiConfig.setEnabled(true);
+ setRhiConfig(rhiConfig);
+ }
+
+ static QPlatformTextureList emptyTextureList;
+ bool translucentBackground = m_image.hasAlphaChannel();
+ rhiFlush(flushedWindow, flushedWindow->devicePixelRatio(),
+ region, offset, &emptyTextureList, translucentBackground);
+}
+
+QImage::Format QRhiBackingStore::format() const
+{
+ QImage::Format fmt = QRasterBackingStore::format();
+
+ // With render-to-texture widgets and QRhi-based flushing the backingstore
+ // image must have an alpha channel. Hence upgrading the format. Matches
+ // what other platforms (Windows, xcb) do.
+ if (QImage::toPixelFormat(fmt).alphaUsage() != QPixelFormat::UsesAlpha)
+ fmt = qt_maybeDataCompatibleAlphaVersion(fmt);
+
+ return fmt;
+}
+
+QT_END_NAMESPACE
diff --git a/src/gui/painting/qrhibackingstore_p.h b/src/gui/painting/qrhibackingstore_p.h
new file mode 100644
index 0000000000..f222db860f
--- /dev/null
+++ b/src/gui/painting/qrhibackingstore_p.h
@@ -0,0 +1,34 @@
+// Copyright (C) 2022 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
+
+#ifndef QRHIBACKINGSTORE_H
+#define QRHIBACKINGSTORE_H
+
+//
+// W A R N I N G
+// -------------
+//
+// This file is not part of the Qt API. It exists purely as an
+// implementation detail. This header file may change from version to
+// version without notice, or even be removed.
+//
+// We mean it.
+//
+
+#include <QtGui/private/qrasterbackingstore_p.h>
+
+QT_BEGIN_NAMESPACE
+
+class Q_GUI_EXPORT QRhiBackingStore : public QRasterBackingStore
+{
+public:
+ QRhiBackingStore(QWindow *window);
+ ~QRhiBackingStore();
+
+ void flush(QWindow *window, const QRegion &region, const QPoint &offset) override;
+ QImage::Format format() const override;
+};
+
+QT_END_NAMESPACE
+
+#endif // QRHIBACKINGSTORE_H
diff --git a/src/gui/painting/qstroker.cpp b/src/gui/painting/qstroker.cpp
index 22302f9790..79799ca2ec 100644
--- a/src/gui/painting/qstroker.cpp
+++ b/src/gui/painting/qstroker.cpp
@@ -1,41 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the QtGui module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#include "private/qstroker_p.h"
#include "private/qbezier_p.h"
@@ -295,7 +259,7 @@ void QStrokerOps::strokePath(const QPainterPath &path, void *customData, const Q
/*!
Convenience function for stroking a polygon of the \a pointCount
first points in \a points. If \a implicit_close is set to true a
- line is implictly drawn between the first and last point in the
+ line is implicitly drawn between the first and last point in the
polygon. Typically true for polygons and false for polylines.
The \a matrix is used to transform the points before they enter the
@@ -1028,13 +992,13 @@ QDashStroker::~QDashStroker()
{
}
-QVector<qfixed> QDashStroker::patternForStyle(Qt::PenStyle style)
+QList<qfixed> QDashStroker::patternForStyle(Qt::PenStyle style)
{
const qfixed space = 2;
const qfixed dot = 1;
const qfixed dash = 4;
- QVector<qfixed> pattern;
+ QList<qfixed> pattern;
switch (style) {
case Qt::DashLine:
@@ -1133,7 +1097,9 @@ void QDashStroker::processCurrentSubpath()
qreal doffset = m_dashOffset * m_stroke_width;
// make sure doffset is in range [0..sumLength)
- doffset -= qFloor(doffset * invSumLength) * sumLength;
+ doffset = std::fmod(doffset, sumLength);
+ if (doffset < 0)
+ doffset += sumLength;
while (doffset >= dashes[idash]) {
doffset -= dashes[idash];
@@ -1179,32 +1145,42 @@ void QDashStroker::processCurrentSubpath()
bool done = pos >= estop;
- if (clipping) {
- // Check if the entire line can be clipped away.
- if (!lineIntersectsRect(prev, e, clip_tl, clip_br)) {
- // Cut away full dash sequences.
- elen -= qFloor(elen * invSumLength) * sumLength;
- // Update dash offset.
- while (!done) {
- qreal dpos = pos + dashes[idash] - doffset - estart;
-
- Q_ASSERT(dpos >= 0);
-
- if (dpos > elen) { // dash extends this line
- doffset = dashes[idash] - (dpos - elen); // subtract the part already used
- pos = estop; // move pos to next path element
- done = true;
- } else { // Dash is on this line
- pos = dpos + estart;
- done = pos >= estop;
- if (++idash >= dashCount)
- idash = 0;
- doffset = 0; // full segment so no offset on next.
- }
+ // Check if the entire line should be clipped away or simplified
+ bool clipIt = clipping && !lineIntersectsRect(prev, e, clip_tl, clip_br);
+ bool skipDashing = elen * invSumLength > repetitionLimit();
+ int maxDashes = dashCount;
+ if (skipDashing || clipIt) {
+ // Cut away full dash sequences.
+ elen -= std::floor(elen * invSumLength) * sumLength;
+ // Update dash offset.
+ while (!done) {
+ qreal dpos = pos + dashes[idash] - doffset - estart;
+
+ Q_ASSERT(dpos >= 0);
+
+ if (dpos > elen) { // dash extends this line
+ doffset = dashes[idash] - (dpos - elen); // subtract the part already used
+ pos = estop; // move pos to next path element
+ done = true;
+ } else { // Dash is on this line
+ pos = --maxDashes > 0 ? dpos + estart : estop;
+ done = pos >= estop;
+ if (++idash >= dashCount)
+ idash = 0;
+ doffset = 0; // full segment so no offset on next.
}
+ }
+ if (clipIt) {
hasMoveTo = false;
- move_to_pos = e;
+ } else {
+ // skip costly dashing, just draw solid line
+ if (!hasMoveTo) {
+ emitMoveTo(move_to_pos.x, move_to_pos.y);
+ hasMoveTo = true;
+ }
+ emitLineTo(e.x, e.y);
}
+ move_to_pos = e;
}
// Dash away...
diff --git a/src/gui/painting/qstroker_p.h b/src/gui/painting/qstroker_p.h
index 3207f1944b..2519bbadc2 100644
--- a/src/gui/painting/qstroker_p.h
+++ b/src/gui/painting/qstroker_p.h
@@ -1,41 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the QtGui module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#ifndef QSTROKER_P_H
#define QSTROKER_P_H
@@ -209,7 +173,11 @@ public:
QStroker();
~QStroker();
- void setStrokeWidth(qfixed width) { m_strokeWidth = width; m_curveThreshold = qt_real_to_fixed(qBound(0.025, 1.0/width, 0.25)); }
+ void setStrokeWidth(qfixed width)
+ {
+ m_strokeWidth = width;
+ m_curveThreshold = qt_real_to_fixed(qBound(0.00025, 1.0 / qt_fixed_to_real(width), 0.25));
+ }
qfixed strokeWidth() const { return m_strokeWidth; }
void setCapStyle(Qt::PenCapStyle capStyle) { m_capStyle = joinModeForCap(capStyle); }
@@ -224,7 +192,7 @@ public:
qfixed miterLimit() const { return m_miterLimit; }
void setForceOpen(bool state) { m_forceOpen = state; }
- bool forceOpen() { return m_forceOpen; }
+ bool forceOpen() const { return m_forceOpen; }
void joinPoints(qfixed x, qfixed y, const QLineF &nextLine, LineJoinMode join);
inline void emitMoveTo(qfixed x, qfixed y);
@@ -263,10 +231,11 @@ public:
QStroker *stroker() const { return m_stroker; }
- static QVector<qfixed> patternForStyle(Qt::PenStyle style);
+ static QList<qfixed> patternForStyle(Qt::PenStyle style);
+ static int repetitionLimit() { return 10000; }
- void setDashPattern(const QVector<qfixed> &dashPattern) { m_dashPattern = dashPattern; }
- QVector<qfixed> dashPattern() const { return m_dashPattern; }
+ void setDashPattern(const QList<qfixed> &dashPattern) { m_dashPattern = dashPattern; }
+ QList<qfixed> dashPattern() const { return m_dashPattern; }
void setDashOffset(qreal offset) { m_dashOffset = offset; }
qreal dashOffset() const { return m_dashOffset; }
@@ -281,7 +250,7 @@ protected:
void processCurrentSubpath() override;
QStroker *m_stroker;
- QVector<qfixed> m_dashPattern;
+ QList<qfixed> m_dashPattern;
qreal m_dashOffset;
qreal m_stroke_width;
diff --git a/src/gui/painting/qt_attribution.json b/src/gui/painting/qt_attribution.json
index 7b16e8c211..33ed2fd5c7 100644
--- a/src/gui/painting/qt_attribution.json
+++ b/src/gui/painting/qt_attribution.json
@@ -4,13 +4,13 @@
"Name": "Anti-aliasing rasterizer from FreeType 2",
"QDocModule": "qtgui",
"QtUsage": "Used in Qt GUI.",
- "Path": "qgrayraster.c",
+ "Files": "qgrayraster.c",
"Description": "FreeType is a freely available software library to render fonts.",
"Homepage": "http://www.freetype.org",
"License": "Freetype Project License or GNU General Public License v2.0 only",
- "LicenseId": "FTL or GPL-2.0",
- "LicenseFile": "../../3rdparty/freetype/docs/LICENSE.TXT",
+ "LicenseId": "FTL OR GPL-2.0-only",
+ "LicenseFile": "../../3rdparty/freetype/LICENSE.txt",
"Copyright": "Copyright 2000-2016 by David Turner, Robert Wilhelm, and Werner Lemberg."
},
{
@@ -24,23 +24,9 @@
"LicenseId": "BSD-2-Clause AND Imlib2",
"License": "BSD 2-clause \"Simplified\" License and Imlib2 License",
"LicenseFile": "QIMAGETRANSFORM_LICENSE.txt",
- "Copyright": "Copyright (C) 2004, 2005 Daniel M. Duley.
- (C) Carsten Haitzler and various contributors.
- (C) Willem Monsuwe <willem@stack.nl>"
- },
- {
- "Id": "webgradients",
- "Name": "WebGradients",
- "QDocModule": "qtgui",
- "QtUsage": "Used in Qt GUI to provide presets for QGradient.",
- "Files": "webgradients.css",
-
- "Description": "WebGradients is a free collection of 180 linear gradients.",
- "Homepage": "https://webgradients.com/",
- "License": "MIT License",
- "LicenseId": "MIT",
- "LicenseFile": "WEBGRADIENTS_LICENSE.txt",
- "Copyright": "Copyright (c) 2017 itmeo"
+ "Copyright": ["Copyright (C) 2004, 2005 Daniel M. Duley.",
+ "(C) Carsten Haitzler and various contributors.",
+ "(C) Willem Monsuwe <willem@stack.nl>"]
},
{
"Id": "xserverhelper",
@@ -54,7 +40,7 @@
"License": "X11 License and Historical Permission Notice and Disclaimer",
"LicenseId": "X11 AND HPND",
"LicenseFile": "XCONSORTIUM_LICENSE.txt",
- "Copyright": "Copyright (c) 1987, 1988 X Consortium
-Copyright 1987, 1988 by Digital Equipment Corporation, Maynard, Massachusetts."
+ "Copyright": ["Copyright (c) 1987, 1988 X Consortium",
+ "Copyright 1987, 1988 by Digital Equipment Corporation, Maynard, Massachusetts."]
}
]
diff --git a/src/gui/painting/qt_mips_asm_dsp_p.h b/src/gui/painting/qt_mips_asm_dsp_p.h
index 172910ea1c..6b33285f32 100644
--- a/src/gui/painting/qt_mips_asm_dsp_p.h
+++ b/src/gui/painting/qt_mips_asm_dsp_p.h
@@ -1,41 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2013 Imagination Technologies Limited, www.imgtec.com
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the QtGui module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2013 Imagination Technologies Limited, www.imgtec.com
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#ifndef QT_MIPS_ASM_DSP_H
#define QT_MIPS_ASM_DSP_H
@@ -55,7 +19,7 @@
#pragma qt_sync_stop_processing
#endif
-#ifndef Q_CLANG_QDOC
+#ifndef Q_QDOC
#define zero $0
#define AT $1
#define v0 $2
@@ -277,7 +241,7 @@ LEAF_MIPS32R2(symbol) \
/*
* Saves set of registers on stack. Maximum number of registers that
- * can be saved on stack is limitted to 14 (a0-a3, v0-v1 and s0-s7).
+ * can be saved on stack is limited to 14 (a0-a3, v0-v1 and s0-s7).
* Stack offset is number of bytes that are added to stack pointer (sp)
* before registers are pushed in order to provide enough space on stack
* (offset must be multiple of 4, and must be big enough, as described by
@@ -352,7 +316,7 @@ LEAF_MIPS32R2(symbol) \
/*
* Restores set of registers from stack. Maximum number of registers that
- * can be restored from stack is limitted to 14 (a0-a3, v0-v1 and s0-s7).
+ * can be restored from stack is limited to 14 (a0-a3, v0-v1 and s0-s7).
* Stack offset is number of bytes that are added to stack pointer (sp)
* after registers are restored (offset must be multiple of 4, and must
* be big enough, as described by CHECK_STACK_OFFSET macro). This macro is
diff --git a/src/gui/painting/qtextureglyphcache.cpp b/src/gui/painting/qtextureglyphcache.cpp
index f40ca9d8b4..70d70e342a 100644
--- a/src/gui/painting/qtextureglyphcache.cpp
+++ b/src/gui/painting/qtextureglyphcache.cpp
@@ -1,41 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the QtGui module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#include <qmath.h>
@@ -43,6 +7,8 @@
#include "private/qfontengine_p.h"
#include "private/qnumeric_p.h"
+#include <QtGui/qpainterpath.h>
+
QT_BEGIN_NAMESPACE
// #define CACHE_DEBUG
@@ -62,7 +28,7 @@ int QTextureGlyphCache::calculateSubPixelPositionCount(glyph_t glyph) const
QImage images[NumSubpixelPositions];
int numImages = 0;
for (int i = 0; i < NumSubpixelPositions; ++i) {
- QImage img = textureMapForGlyph(glyph, QFixed::fromReal(i / 12.0));
+ QImage img = textureMapForGlyph(glyph, QFixedPoint(QFixed::fromReal(i / 12.0), 0));
if (numImages == 0) {
QPainterPath path;
@@ -90,11 +56,15 @@ int QTextureGlyphCache::calculateSubPixelPositionCount(glyph_t glyph) const
return numImages;
}
-bool QTextureGlyphCache::populate(QFontEngine *fontEngine, int numGlyphs, const glyph_t *glyphs,
- const QFixedPoint *positions)
+bool QTextureGlyphCache::populate(QFontEngine *fontEngine,
+ qsizetype numGlyphs,
+ const glyph_t *glyphs,
+ const QFixedPoint *positions,
+ QPainter::RenderHints renderHints,
+ bool includeGlyphCacheScale)
{
#ifdef CACHE_DEBUG
- printf("Populating with %d glyphs\n", numGlyphs);
+ printf("Populating with %lld glyphs\n", static_cast<long long>(numGlyphs));
qDebug() << " -> current transformation: " << m_transform;
#endif
@@ -103,11 +73,13 @@ bool QTextureGlyphCache::populate(QFontEngine *fontEngine, int numGlyphs, const
const int paddingDoubled = padding * 2;
bool supportsSubPixelPositions = fontEngine->supportsSubPixelPositions();
+ bool verticalSubPixelPositions = fontEngine->supportsVerticalSubPixelPositions()
+ && (renderHints & QPainter::VerticalSubpixelPositioning) != 0;
if (fontEngine->m_subPixelPositionCount == 0) {
if (!supportsSubPixelPositions) {
fontEngine->m_subPixelPositionCount = 1;
} else {
- int i = 0;
+ qsizetype i = 0;
while (fontEngine->m_subPixelPositionCount == 0 && i < numGlyphs)
fontEngine->m_subPixelPositionCount = calculateSubPixelPositionCount(glyphs[i++]);
}
@@ -118,17 +90,26 @@ bool QTextureGlyphCache::populate(QFontEngine *fontEngine, int numGlyphs, const
m_cy = padding;
}
+ qreal glyphCacheScaleX = transform().m11();
+ qreal glyphCacheScaleY = transform().m22();
+
QHash<GlyphAndSubPixelPosition, Coord> listItemCoordinates;
int rowHeight = 0;
// check each glyph for its metrics and get the required rowHeight.
- for (int i=0; i < numGlyphs; ++i) {
+ for (qsizetype i = 0; i < numGlyphs; ++i) {
const glyph_t glyph = glyphs[i];
- QFixed subPixelPosition;
+ QFixedPoint subPixelPosition;
if (supportsSubPixelPositions) {
- QFixed x = positions != nullptr ? positions[i].x : QFixed();
- subPixelPosition = fontEngine->subPixelPositionForX(x);
+ QFixedPoint pos = positions != nullptr ? positions[i] : QFixedPoint();
+ if (includeGlyphCacheScale) {
+ pos = QFixedPoint(QFixed::fromReal(pos.x.toReal() * glyphCacheScaleX),
+ QFixed::fromReal(pos.y.toReal() * glyphCacheScaleY));
+ }
+ subPixelPosition = fontEngine->subPixelPositionFor(pos);
+ if (!verticalSubPixelPositions)
+ subPixelPosition.y = 0;
}
if (coords.contains(GlyphAndSubPixelPosition(glyph, subPixelPosition)))
@@ -261,7 +242,7 @@ void QTextureGlyphCache::fillInPendingGlyphs()
m_pendingGlyphs.clear();
}
-QImage QTextureGlyphCache::textureMapForGlyph(glyph_t g, QFixed subPixelPosition) const
+QImage QTextureGlyphCache::textureMapForGlyph(glyph_t g, const QFixedPoint &subPixelPosition) const
{
switch (m_format) {
case QFontEngine::Format_A32:
@@ -315,7 +296,9 @@ void QImageTextureGlyphCache::createTextureData(int width, int height)
m_image.fill(0);
}
-void QImageTextureGlyphCache::fillTexture(const Coord &c, glyph_t g, QFixed subPixelPosition)
+void QImageTextureGlyphCache::fillTexture(const Coord &c,
+ glyph_t g,
+ const QFixedPoint &subPixelPosition)
{
QImage mask = textureMapForGlyph(g, subPixelPosition);
@@ -341,15 +324,16 @@ void QImageTextureGlyphCache::fillTexture(const Coord &c, glyph_t g, QFixed subP
} else if (m_format == QFontEngine::Format_Mono) {
if (mask.depth() > 1) {
// TODO optimize this
- mask = mask.alphaChannel();
+ mask.convertTo(QImage::Format_Alpha8);
+ mask.reinterpretAsFormat(QImage::Format_Grayscale8);
mask.invertPixels();
- mask = mask.convertToFormat(QImage::Format_Mono, Qt::ThresholdDither);
+ mask.convertTo(QImage::Format_Mono, Qt::ThresholdDither);
}
int mw = qMin(mask.width(), c.w);
int mh = qMin(mask.height(), c.h);
uchar *d = m_image.bits();
- int dbpl = m_image.bytesPerLine();
+ qsizetype dbpl = m_image.bytesPerLine();
for (int y = 0; y < c.h; ++y) {
uchar *dest = d + (c.y + y) *dbpl + c.x/8;
@@ -371,7 +355,7 @@ void QImageTextureGlyphCache::fillTexture(const Coord &c, glyph_t g, QFixed subP
int mw = qMin(mask.width(), c.w);
int mh = qMin(mask.height(), c.h);
uchar *d = m_image.bits();
- int dbpl = m_image.bytesPerLine();
+ qsizetype dbpl = m_image.bytesPerLine();
if (mask.depth() == 1) {
for (int y = 0; y < c.h; ++y) {
diff --git a/src/gui/painting/qtextureglyphcache_p.h b/src/gui/painting/qtextureglyphcache_p.h
index b6fc7230a8..c0218b3ace 100644
--- a/src/gui/painting/qtextureglyphcache_p.h
+++ b/src/gui/painting/qtextureglyphcache_p.h
@@ -1,41 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the QtGui module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#ifndef QTEXTUREGLYPHCACHE_P_H
#define QTEXTUREGLYPHCACHE_P_H
@@ -83,7 +47,8 @@ public:
struct GlyphAndSubPixelPosition
{
- GlyphAndSubPixelPosition(glyph_t g, QFixed spp) : glyph(g), subPixelPosition(spp) {}
+ GlyphAndSubPixelPosition(glyph_t g, const QFixedPoint &spp)
+ : glyph(g), subPixelPosition(spp) {}
bool operator==(const GlyphAndSubPixelPosition &other) const
{
@@ -91,7 +56,7 @@ public:
}
glyph_t glyph;
- QFixed subPixelPosition;
+ QFixedPoint subPixelPosition;
};
struct Coord {
@@ -109,9 +74,13 @@ public:
}
};
- bool populate(QFontEngine *fontEngine, int numGlyphs, const glyph_t *glyphs,
- const QFixedPoint *positions);
- bool hasPendingGlyphs() const { return !m_pendingGlyphs.isEmpty(); };
+ bool populate(QFontEngine *fontEngine,
+ qsizetype numGlyphs,
+ const glyph_t *glyphs,
+ const QFixedPoint *positions,
+ QPainter::RenderHints renderHints = QPainter::RenderHints(),
+ bool includeGlyphCacheScale = false);
+ bool hasPendingGlyphs() const { return !m_pendingGlyphs.isEmpty(); }
void fillInPendingGlyphs();
virtual void createTextureData(int width, int height) = 0;
@@ -119,7 +88,9 @@ public:
virtual int glyphPadding() const { return 0; }
virtual void beginFillTexture() { }
- virtual void fillTexture(const Coord &coord, glyph_t glyph, QFixed subPixelPosition) = 0;
+ virtual void fillTexture(const Coord &coord,
+ glyph_t glyph,
+ const QFixedPoint &subPixelPosition) = 0;
virtual void endFillTexture() { }
inline void createCache(int width, int height) {
@@ -141,7 +112,7 @@ public:
virtual int maxTextureWidth() const { return QT_DEFAULT_TEXTURE_GLYPH_CACHE_WIDTH; }
virtual int maxTextureHeight() const { return -1; }
- QImage textureMapForGlyph(glyph_t g, QFixed subPixelPosition) const;
+ QImage textureMapForGlyph(glyph_t g, const QFixedPoint &subPixelPosition) const;
protected:
int calculateSubPixelPositionCount(glyph_t) const;
@@ -156,9 +127,12 @@ protected:
int m_currentRowHeight; // Height of last row
};
-inline uint qHash(const QTextureGlyphCache::GlyphAndSubPixelPosition &g)
+inline size_t qHash(const QTextureGlyphCache::GlyphAndSubPixelPosition &g, size_t seed = 0)
{
- return (g.glyph << 8) | (g.subPixelPosition * 10).round().toInt();
+ return qHashMulti(seed,
+ g.glyph,
+ g.subPixelPosition.x.value(),
+ g.subPixelPosition.y.value());
}
@@ -171,7 +145,9 @@ public:
virtual void createTextureData(int width, int height) override;
virtual void resizeTextureData(int width, int height) override;
- virtual void fillTexture(const Coord &c, glyph_t glyph, QFixed subPixelPosition) override;
+ virtual void fillTexture(const Coord &c,
+ glyph_t glyph,
+ const QFixedPoint &subPixelPosition) override;
inline const QImage &image() const { return m_image; }
diff --git a/src/gui/painting/qtransform.cpp b/src/gui/painting/qtransform.cpp
index d75b66c50b..df57d2c190 100644
--- a/src/gui/painting/qtransform.cpp
+++ b/src/gui/painting/qtransform.cpp
@@ -1,52 +1,15 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the QtGui module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2021 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#include "qtransform.h"
#include "qdatastream.h"
#include "qdebug.h"
#include "qhashfunctions.h"
-#include "qmatrix.h"
#include "qregion.h"
#include "qpainterpath.h"
#include "qpainterpath_p.h"
#include "qvariant.h"
-#include <qmath.h>
+#include "qmath_p.h"
#include <qnumeric.h>
#include <private/qbezier_p.h>
@@ -76,22 +39,22 @@ static void nanWarning(const char *func)
ny = FY_; \
break; \
case TxTranslate: \
- nx = FX_ + affine._dx; \
- ny = FY_ + affine._dy; \
+ nx = FX_ + m_matrix[2][0]; \
+ ny = FY_ + m_matrix[2][1]; \
break; \
case TxScale: \
- nx = affine._m11 * FX_ + affine._dx; \
- ny = affine._m22 * FY_ + affine._dy; \
+ nx = m_matrix[0][0] * FX_ + m_matrix[2][0]; \
+ ny = m_matrix[1][1] * FY_ + m_matrix[2][1]; \
break; \
case TxRotate: \
case TxShear: \
case TxProject: \
- nx = affine._m11 * FX_ + affine._m21 * FY_ + affine._dx; \
- ny = affine._m12 * FX_ + affine._m22 * FY_ + affine._dy; \
+ nx = m_matrix[0][0] * FX_ + m_matrix[1][0] * FY_ + m_matrix[2][0]; \
+ ny = m_matrix[0][1] * FX_ + m_matrix[1][1] * FY_ + m_matrix[2][1]; \
if (t == TxProject) { \
- qreal w = (m_13 * FX_ + m_23 * FY_ + m_33); \
+ qreal w = (m_matrix[0][2] * FX_ + m_matrix[1][2] * FY_ + m_matrix[2][2]); \
if (w < qreal(Q_NEAR_CLIP)) w = qreal(Q_NEAR_CLIP); \
- w = 1./w; \
+ w = qreal(1.)/w; \
nx *= w; \
ny *= w; \
} \
@@ -109,14 +72,6 @@ static void nanWarning(const char *func)
or project the coordinate system, and is typically used when
rendering graphics.
- QTransform differs from QMatrix in that it is a true 3x3 matrix,
- allowing perspective transformations. QTransform's toAffine()
- method allows casting QTransform to QMatrix. If a perspective
- transformation has been specified on the matrix, then the
- conversion will cause loss of data.
-
- QTransform is the recommended transformation class in Qt.
-
A QTransform object can be built using the setMatrix(), scale(),
rotate(), translate() and shear() functions. Alternatively, it
can be built by applying \l {QTransform#Basic Matrix
@@ -222,6 +177,7 @@ static void nanWarning(const char *func)
transformation is achieved by setting both the projection factors and
the scaling factors.
+ \section2 Combining Transforms
Here's the combined transformations example using basic matrix
operations:
@@ -232,6 +188,26 @@ static void nanWarning(const char *func)
\snippet transform/main.cpp 2
\endtable
+ The combined transform first scales each operand, then rotates it, and
+ finally translates it, just as in the order in which the product of its
+ factors is written. This means the point to which the transforms are
+ applied is implicitly multiplied on the left with the transform
+ to its right.
+
+ \section2 Relation to Matrix Notation
+ The matrix notation in QTransform is the transpose of a commonly-taught
+ convention which represents transforms and points as matrices and vectors.
+ That convention multiplies its matrix on the left and column vector to the
+ right. In other words, when several transforms are applied to a point, the
+ right-most matrix acts directly on the vector first. Then the next matrix
+ to the left acts on the result of the first operation - and so on. As a
+ result, that convention multiplies the matrices that make up a composite
+ transform in the reverse of the order in QTransform, as you can see in
+ \l {Combining Transforms}. Transposing the matrices, and combining them to
+ the right of a row vector that represents the point, lets the matrices of
+ transforms appear, in their product, in the order in which we think of the
+ transforms being applied to the point.
+
\sa QPainter, {Coordinate System}, {painting/affine}{Affine
Transformations Example}, {Transformations Example}
*/
@@ -253,6 +229,8 @@ static void nanWarning(const char *func)
*/
/*!
+ \fn QTransform::QTransform()
+
Constructs an identity matrix.
All elements are set to zero except \c m11 and \c m22 (specifying
@@ -260,16 +238,6 @@ static void nanWarning(const char *func)
\sa reset()
*/
-QTransform::QTransform()
- : affine(true)
- , m_13(0), m_23(0), m_33(1)
- , m_type(TxNone)
- , m_dirty(TxNone)
-#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
- , d(nullptr)
-#endif
-{
-}
/*!
\fn QTransform::QTransform(qreal m11, qreal m12, qreal m13, qreal m21, qreal m22, qreal m23, qreal m31, qreal m32, qreal m33)
@@ -279,18 +247,6 @@ QTransform::QTransform()
\sa setMatrix()
*/
-QTransform::QTransform(qreal h11, qreal h12, qreal h13,
- qreal h21, qreal h22, qreal h23,
- qreal h31, qreal h32, qreal h33)
- : affine(h11, h12, h21, h22, h31, h32, true)
- , m_13(h13), m_23(h23), m_33(h33)
- , m_type(TxNone)
- , m_dirty(TxProject)
-#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
- , d(nullptr)
-#endif
-{
-}
/*!
\fn QTransform::QTransform(qreal m11, qreal m12, qreal m21, qreal m22, qreal dx, qreal dy)
@@ -299,35 +255,6 @@ QTransform::QTransform(qreal h11, qreal h12, qreal h13,
\sa setMatrix()
*/
-QTransform::QTransform(qreal h11, qreal h12, qreal h21,
- qreal h22, qreal dx, qreal dy)
- : affine(h11, h12, h21, h22, dx, dy, true)
- , m_13(0), m_23(0), m_33(1)
- , m_type(TxNone)
- , m_dirty(TxShear)
-#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
- , d(nullptr)
-#endif
-{
-}
-
-/*!
- \fn QTransform::QTransform(const QMatrix &matrix)
-
- Constructs a matrix that is a copy of the given \a matrix.
- Note that the \c m13, \c m23, and \c m33 elements are set to 0, 0,
- and 1 respectively.
- */
-QTransform::QTransform(const QMatrix &mtx)
- : affine(mtx._m11, mtx._m12, mtx._m21, mtx._m22, mtx._dx, mtx._dy, true),
- m_13(0), m_23(0), m_33(1)
- , m_type(TxNone)
- , m_dirty(TxShear)
-#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
- , d(nullptr)
-#endif
-{
-}
/*!
Returns the adjoint of this matrix.
@@ -335,21 +262,21 @@ QTransform::QTransform(const QMatrix &mtx)
QTransform QTransform::adjoint() const
{
qreal h11, h12, h13,
- h21, h22, h23,
- h31, h32, h33;
- h11 = affine._m22*m_33 - m_23*affine._dy;
- h21 = m_23*affine._dx - affine._m21*m_33;
- h31 = affine._m21*affine._dy - affine._m22*affine._dx;
- h12 = m_13*affine._dy - affine._m12*m_33;
- h22 = affine._m11*m_33 - m_13*affine._dx;
- h32 = affine._m12*affine._dx - affine._m11*affine._dy;
- h13 = affine._m12*m_23 - m_13*affine._m22;
- h23 = m_13*affine._m21 - affine._m11*m_23;
- h33 = affine._m11*affine._m22 - affine._m12*affine._m21;
+ h21, h22, h23,
+ h31, h32, h33;
+ h11 = m_matrix[1][1] * m_matrix[2][2] - m_matrix[1][2] * m_matrix[2][1];
+ h21 = m_matrix[1][2] * m_matrix[2][0] - m_matrix[1][0] * m_matrix[2][2];
+ h31 = m_matrix[1][0] * m_matrix[2][1] - m_matrix[1][1] * m_matrix[2][0];
+ h12 = m_matrix[0][2] * m_matrix[2][1] - m_matrix[0][1] * m_matrix[2][2];
+ h22 = m_matrix[0][0] * m_matrix[2][2] - m_matrix[0][2] * m_matrix[2][0];
+ h32 = m_matrix[0][1] * m_matrix[2][0] - m_matrix[0][0] * m_matrix[2][1];
+ h13 = m_matrix[0][1] * m_matrix[1][2] - m_matrix[0][2] * m_matrix[1][1];
+ h23 = m_matrix[0][2] * m_matrix[1][0] - m_matrix[0][0] * m_matrix[1][2];
+ h33 = m_matrix[0][0] * m_matrix[1][1] - m_matrix[0][1] * m_matrix[1][0];
return QTransform(h11, h12, h13,
h21, h22, h23,
- h31, h32, h33, true);
+ h31, h32, h33);
}
/*!
@@ -357,9 +284,9 @@ QTransform QTransform::adjoint() const
*/
QTransform QTransform::transposed() const
{
- QTransform t(affine._m11, affine._m21, affine._dx,
- affine._m12, affine._m22, affine._dy,
- m_13, m_23, m_33, true);
+ QTransform t(m_matrix[0][0], m_matrix[1][0], m_matrix[2][0],
+ m_matrix[0][1], m_matrix[1][1], m_matrix[2][1],
+ m_matrix[0][2], m_matrix[1][2], m_matrix[2][2]);
return t;
}
@@ -375,30 +302,30 @@ QTransform QTransform::transposed() const
*/
QTransform QTransform::inverted(bool *invertible) const
{
- QTransform invert(true);
+ QTransform invert;
bool inv = true;
switch(inline_type()) {
case TxNone:
break;
case TxTranslate:
- invert.affine._dx = -affine._dx;
- invert.affine._dy = -affine._dy;
+ invert.m_matrix[2][0] = -m_matrix[2][0];
+ invert.m_matrix[2][1] = -m_matrix[2][1];
break;
case TxScale:
- inv = !qFuzzyIsNull(affine._m11);
- inv &= !qFuzzyIsNull(affine._m22);
+ inv = !qFuzzyIsNull(m_matrix[0][0]);
+ inv &= !qFuzzyIsNull(m_matrix[1][1]);
if (inv) {
- invert.affine._m11 = 1. / affine._m11;
- invert.affine._m22 = 1. / affine._m22;
- invert.affine._dx = -affine._dx * invert.affine._m11;
- invert.affine._dy = -affine._dy * invert.affine._m22;
+ invert.m_matrix[0][0] = 1. / m_matrix[0][0];
+ invert.m_matrix[1][1] = 1. / m_matrix[1][1];
+ invert.m_matrix[2][0] = -m_matrix[2][0] * invert.m_matrix[0][0];
+ invert.m_matrix[2][1] = -m_matrix[2][1] * invert.m_matrix[1][1];
}
break;
- case TxRotate:
- case TxShear:
- invert.affine = affine.inverted(&inv);
- break;
+// case TxRotate:
+// case TxShear:
+// invert.affine = affine.inverted(&inv);
+// break;
default:
// general case
qreal det = determinant();
@@ -431,7 +358,7 @@ QTransform &QTransform::translate(qreal dx, qreal dy)
if (dx == 0 && dy == 0)
return *this;
#ifndef QT_NO_DEBUG
- if (qIsNaN(dx) | qIsNaN(dy)) {
+ if (qIsNaN(dx) || qIsNaN(dy)) {
nanWarning("translate");
return *this;
}
@@ -439,24 +366,24 @@ QTransform &QTransform::translate(qreal dx, qreal dy)
switch(inline_type()) {
case TxNone:
- affine._dx = dx;
- affine._dy = dy;
+ m_matrix[2][0] = dx;
+ m_matrix[2][1] = dy;
break;
case TxTranslate:
- affine._dx += dx;
- affine._dy += dy;
+ m_matrix[2][0] += dx;
+ m_matrix[2][1] += dy;
break;
case TxScale:
- affine._dx += dx*affine._m11;
- affine._dy += dy*affine._m22;
+ m_matrix[2][0] += dx * m_matrix[0][0];
+ m_matrix[2][1] += dy * m_matrix[1][1];
break;
case TxProject:
- m_33 += dx*m_13 + dy*m_23;
+ m_matrix[2][2] += dx * m_matrix[0][2] + dy * m_matrix[1][2];
Q_FALLTHROUGH();
case TxShear:
case TxRotate:
- affine._dx += dx*affine._m11 + dy*affine._m21;
- affine._dy += dy*affine._m22 + dx*affine._m12;
+ m_matrix[2][0] += dx * m_matrix[0][0] + dy * m_matrix[1][0];
+ m_matrix[2][1] += dy * m_matrix[1][1] + dx * m_matrix[0][1];
break;
}
if (m_dirty < TxTranslate)
@@ -474,12 +401,12 @@ QTransform &QTransform::translate(qreal dx, qreal dy)
QTransform QTransform::fromTranslate(qreal dx, qreal dy)
{
#ifndef QT_NO_DEBUG
- if (qIsNaN(dx) | qIsNaN(dy)) {
+ if (qIsNaN(dx) || qIsNaN(dy)) {
nanWarning("fromTranslate");
return QTransform();
}
#endif
- QTransform transform(1, 0, 0, 0, 1, 0, dx, dy, 1, true);
+ QTransform transform(1, 0, 0, 0, 1, 0, dx, dy, 1);
if (dx == 0 && dy == 0)
transform.m_type = TxNone;
else
@@ -499,7 +426,7 @@ QTransform & QTransform::scale(qreal sx, qreal sy)
if (sx == 1 && sy == 1)
return *this;
#ifndef QT_NO_DEBUG
- if (qIsNaN(sx) | qIsNaN(sy)) {
+ if (qIsNaN(sx) || qIsNaN(sy)) {
nanWarning("scale");
return *this;
}
@@ -508,21 +435,21 @@ QTransform & QTransform::scale(qreal sx, qreal sy)
switch(inline_type()) {
case TxNone:
case TxTranslate:
- affine._m11 = sx;
- affine._m22 = sy;
+ m_matrix[0][0] = sx;
+ m_matrix[1][1] = sy;
break;
case TxProject:
- m_13 *= sx;
- m_23 *= sy;
+ m_matrix[0][2] *= sx;
+ m_matrix[1][2] *= sy;
Q_FALLTHROUGH();
case TxRotate:
case TxShear:
- affine._m12 *= sx;
- affine._m21 *= sy;
+ m_matrix[0][1] *= sx;
+ m_matrix[1][0] *= sy;
Q_FALLTHROUGH();
case TxScale:
- affine._m11 *= sx;
- affine._m22 *= sy;
+ m_matrix[0][0] *= sx;
+ m_matrix[1][1] *= sy;
break;
}
if (m_dirty < TxScale)
@@ -540,12 +467,12 @@ QTransform & QTransform::scale(qreal sx, qreal sy)
QTransform QTransform::fromScale(qreal sx, qreal sy)
{
#ifndef QT_NO_DEBUG
- if (qIsNaN(sx) | qIsNaN(sy)) {
+ if (qIsNaN(sx) || qIsNaN(sy)) {
nanWarning("fromScale");
return QTransform();
}
#endif
- QTransform transform(sx, 0, 0, 0, sy, 0, 0, 0, 1, true);
+ QTransform transform(sx, 0, 0, 0, sy, 0, 0, 0, 1);
if (sx == 1. && sy == 1.)
transform.m_type = TxNone;
else
@@ -565,7 +492,7 @@ QTransform & QTransform::shear(qreal sh, qreal sv)
if (sh == 0 && sv == 0)
return *this;
#ifndef QT_NO_DEBUG
- if (qIsNaN(sh) | qIsNaN(sv)) {
+ if (qIsNaN(sh) || qIsNaN(sv)) {
nanWarning("shear");
return *this;
}
@@ -574,28 +501,30 @@ QTransform & QTransform::shear(qreal sh, qreal sv)
switch(inline_type()) {
case TxNone:
case TxTranslate:
- affine._m12 = sv;
- affine._m21 = sh;
+ m_matrix[0][1] = sv;
+ m_matrix[1][0] = sh;
break;
case TxScale:
- affine._m12 = sv*affine._m22;
- affine._m21 = sh*affine._m11;
+ m_matrix[0][1] = sv*m_matrix[1][1];
+ m_matrix[1][0] = sh*m_matrix[0][0];
break;
case TxProject: {
- qreal tm13 = sv*m_23;
- qreal tm23 = sh*m_13;
- m_13 += tm13;
- m_23 += tm23;
+ qreal tm13 = sv * m_matrix[1][2];
+ qreal tm23 = sh * m_matrix[0][2];
+ m_matrix[0][2] += tm13;
+ m_matrix[1][2] += tm23;
}
Q_FALLTHROUGH();
case TxRotate:
case TxShear: {
- qreal tm11 = sv*affine._m21;
- qreal tm22 = sh*affine._m12;
- qreal tm12 = sv*affine._m22;
- qreal tm21 = sh*affine._m11;
- affine._m11 += tm11; affine._m12 += tm12;
- affine._m21 += tm21; affine._m22 += tm22;
+ qreal tm11 = sv * m_matrix[1][0];
+ qreal tm22 = sh * m_matrix[0][1];
+ qreal tm12 = sv * m_matrix[1][1];
+ qreal tm21 = sh * m_matrix[0][0];
+ m_matrix[0][0] += tm11;
+ m_matrix[0][1] += tm12;
+ m_matrix[1][0] += tm21;
+ m_matrix[1][1] += tm22;
break;
}
}
@@ -604,29 +533,33 @@ QTransform & QTransform::shear(qreal sh, qreal sv)
return *this;
}
-const qreal deg2rad = qreal(0.017453292519943295769); // pi/180
-const qreal inv_dist_to_plane = 1. / 1024.;
-
/*!
- \fn QTransform &QTransform::rotate(qreal angle, Qt::Axis axis)
+ \since 6.5
- Rotates the coordinate system counterclockwise by the given \a angle
- about the specified \a axis and returns a reference to the matrix.
+ Rotates the coordinate system counterclockwise by the given angle \a a
+ about the specified \a axis at distance \a distanceToPlane from the
+ screen and returns a reference to the matrix.
+//! [transform-rotate-note]
Note that if you apply a QTransform to a point defined in widget
coordinates, the direction of the rotation will be clockwise
because the y-axis points downwards.
The angle is specified in degrees.
+//! [transform-rotate-note]
+
+ If \a distanceToPlane is zero, it will be ignored. This is suitable
+ for implementing orthographic projections where the z coordinate should
+ be dropped rather than projected.
\sa setMatrix()
*/
-QTransform & QTransform::rotate(qreal a, Qt::Axis axis)
+QTransform & QTransform::rotate(qreal a, Qt::Axis axis, qreal distanceToPlane)
{
if (a == 0)
return *this;
#ifndef QT_NO_DEBUG
- if (qIsNaN(a)) {
+ if (qIsNaN(a) || qIsNaN(distanceToPlane)) {
nanWarning("rotate");
return *this;
}
@@ -641,7 +574,7 @@ QTransform & QTransform::rotate(qreal a, Qt::Axis axis)
else if (a == 180.)
cosa = -1.;
else{
- qreal b = deg2rad*a; // convert to radians
+ qreal b = qDegreesToRadians(a);
sina = qSin(b); // fast and convenient
cosa = qCos(b);
}
@@ -650,48 +583,55 @@ QTransform & QTransform::rotate(qreal a, Qt::Axis axis)
switch(inline_type()) {
case TxNone:
case TxTranslate:
- affine._m11 = cosa;
- affine._m12 = sina;
- affine._m21 = -sina;
- affine._m22 = cosa;
+ m_matrix[0][0] = cosa;
+ m_matrix[0][1] = sina;
+ m_matrix[1][0] = -sina;
+ m_matrix[1][1] = cosa;
break;
case TxScale: {
- qreal tm11 = cosa*affine._m11;
- qreal tm12 = sina*affine._m22;
- qreal tm21 = -sina*affine._m11;
- qreal tm22 = cosa*affine._m22;
- affine._m11 = tm11; affine._m12 = tm12;
- affine._m21 = tm21; affine._m22 = tm22;
+ qreal tm11 = cosa * m_matrix[0][0];
+ qreal tm12 = sina * m_matrix[1][1];
+ qreal tm21 = -sina * m_matrix[0][0];
+ qreal tm22 = cosa * m_matrix[1][1];
+ m_matrix[0][0] = tm11;
+ m_matrix[0][1] = tm12;
+ m_matrix[1][0] = tm21;
+ m_matrix[1][1] = tm22;
break;
}
case TxProject: {
- qreal tm13 = cosa*m_13 + sina*m_23;
- qreal tm23 = -sina*m_13 + cosa*m_23;
- m_13 = tm13;
- m_23 = tm23;
+ qreal tm13 = cosa * m_matrix[0][2] + sina * m_matrix[1][2];
+ qreal tm23 = -sina * m_matrix[0][2] + cosa * m_matrix[1][2];
+ m_matrix[0][2] = tm13;
+ m_matrix[1][2] = tm23;
Q_FALLTHROUGH();
}
case TxRotate:
case TxShear: {
- qreal tm11 = cosa*affine._m11 + sina*affine._m21;
- qreal tm12 = cosa*affine._m12 + sina*affine._m22;
- qreal tm21 = -sina*affine._m11 + cosa*affine._m21;
- qreal tm22 = -sina*affine._m12 + cosa*affine._m22;
- affine._m11 = tm11; affine._m12 = tm12;
- affine._m21 = tm21; affine._m22 = tm22;
+ qreal tm11 = cosa * m_matrix[0][0] + sina * m_matrix[1][0];
+ qreal tm12 = cosa * m_matrix[0][1] + sina * m_matrix[1][1];
+ qreal tm21 = -sina * m_matrix[0][0] + cosa * m_matrix[1][0];
+ qreal tm22 = -sina * m_matrix[0][1] + cosa * m_matrix[1][1];
+ m_matrix[0][0] = tm11;
+ m_matrix[0][1] = tm12;
+ m_matrix[1][0] = tm21;
+ m_matrix[1][1] = tm22;
break;
}
}
if (m_dirty < TxRotate)
m_dirty = TxRotate;
} else {
+ if (!qIsNull(distanceToPlane))
+ sina /= distanceToPlane;
+
QTransform result;
if (axis == Qt::YAxis) {
- result.affine._m11 = cosa;
- result.m_13 = -sina * inv_dist_to_plane;
+ result.m_matrix[0][0] = cosa;
+ result.m_matrix[0][2] = -sina;
} else {
- result.affine._m22 = cosa;
- result.m_23 = -sina * inv_dist_to_plane;
+ result.m_matrix[1][1] = cosa;
+ result.m_matrix[1][2] = -sina;
}
result.m_type = TxProject;
*this = result * *this;
@@ -700,24 +640,49 @@ QTransform & QTransform::rotate(qreal a, Qt::Axis axis)
return *this;
}
+#if QT_VERSION < QT_VERSION_CHECK(7, 0, 0)
/*!
- \fn QTransform & QTransform::rotateRadians(qreal angle, Qt::Axis axis)
+ \overload
+
+ Rotates the coordinate system counterclockwise by the given angle \a a
+ about the specified \a axis at distance 1024.0 from the screen and
+ returns a reference to the matrix.
- Rotates the coordinate system counterclockwise by the given \a angle
- about the specified \a axis and returns a reference to the matrix.
+ \include qtransform.cpp transform-rotate-note
+ \sa setMatrix
+*/
+QTransform &QTransform::rotate(qreal a, Qt::Axis axis)
+{
+ return rotate(a, axis, 1024.0);
+}
+#endif
+
+/*!
+ \since 6.5
+
+ Rotates the coordinate system counterclockwise by the given angle \a a
+ about the specified \a axis at distance \a distanceToPlane from the
+ screen and returns a reference to the matrix.
+
+//! [transform-rotate-radians-note]
Note that if you apply a QTransform to a point defined in widget
coordinates, the direction of the rotation will be clockwise
because the y-axis points downwards.
The angle is specified in radians.
+//! [transform-rotate-radians-note]
+
+ If \a distanceToPlane is zero, it will be ignored. This is suitable
+ for implementing orthographic projections where the z coordinate should
+ be dropped rather than projected.
\sa setMatrix()
*/
-QTransform & QTransform::rotateRadians(qreal a, Qt::Axis axis)
+QTransform & QTransform::rotateRadians(qreal a, Qt::Axis axis, qreal distanceToPlane)
{
#ifndef QT_NO_DEBUG
- if (qIsNaN(a)) {
+ if (qIsNaN(a) || qIsNaN(distanceToPlane)) {
nanWarning("rotateRadians");
return *this;
}
@@ -729,48 +694,55 @@ QTransform & QTransform::rotateRadians(qreal a, Qt::Axis axis)
switch(inline_type()) {
case TxNone:
case TxTranslate:
- affine._m11 = cosa;
- affine._m12 = sina;
- affine._m21 = -sina;
- affine._m22 = cosa;
+ m_matrix[0][0] = cosa;
+ m_matrix[0][1] = sina;
+ m_matrix[1][0] = -sina;
+ m_matrix[1][1] = cosa;
break;
case TxScale: {
- qreal tm11 = cosa*affine._m11;
- qreal tm12 = sina*affine._m22;
- qreal tm21 = -sina*affine._m11;
- qreal tm22 = cosa*affine._m22;
- affine._m11 = tm11; affine._m12 = tm12;
- affine._m21 = tm21; affine._m22 = tm22;
+ qreal tm11 = cosa * m_matrix[0][0];
+ qreal tm12 = sina * m_matrix[1][1];
+ qreal tm21 = -sina * m_matrix[0][0];
+ qreal tm22 = cosa * m_matrix[1][1];
+ m_matrix[0][0] = tm11;
+ m_matrix[0][1] = tm12;
+ m_matrix[1][0] = tm21;
+ m_matrix[1][1] = tm22;
break;
}
case TxProject: {
- qreal tm13 = cosa*m_13 + sina*m_23;
- qreal tm23 = -sina*m_13 + cosa*m_23;
- m_13 = tm13;
- m_23 = tm23;
+ qreal tm13 = cosa * m_matrix[0][2] + sina * m_matrix[1][2];
+ qreal tm23 = -sina * m_matrix[0][2] + cosa * m_matrix[1][2];
+ m_matrix[0][2] = tm13;
+ m_matrix[1][2] = tm23;
Q_FALLTHROUGH();
}
case TxRotate:
case TxShear: {
- qreal tm11 = cosa*affine._m11 + sina*affine._m21;
- qreal tm12 = cosa*affine._m12 + sina*affine._m22;
- qreal tm21 = -sina*affine._m11 + cosa*affine._m21;
- qreal tm22 = -sina*affine._m12 + cosa*affine._m22;
- affine._m11 = tm11; affine._m12 = tm12;
- affine._m21 = tm21; affine._m22 = tm22;
+ qreal tm11 = cosa * m_matrix[0][0] + sina * m_matrix[1][0];
+ qreal tm12 = cosa * m_matrix[0][1] + sina * m_matrix[1][1];
+ qreal tm21 = -sina * m_matrix[0][0] + cosa * m_matrix[1][0];
+ qreal tm22 = -sina * m_matrix[0][1] + cosa * m_matrix[1][1];
+ m_matrix[0][0] = tm11;
+ m_matrix[0][1] = tm12;
+ m_matrix[1][0] = tm21;
+ m_matrix[1][1] = tm22;
break;
}
}
if (m_dirty < TxRotate)
m_dirty = TxRotate;
} else {
+ if (!qIsNull(distanceToPlane))
+ sina /= distanceToPlane;
+
QTransform result;
if (axis == Qt::YAxis) {
- result.affine._m11 = cosa;
- result.m_13 = -sina * inv_dist_to_plane;
+ result.m_matrix[0][0] = cosa;
+ result.m_matrix[0][2] = -sina;
} else {
- result.affine._m22 = cosa;
- result.m_23 = -sina * inv_dist_to_plane;
+ result.m_matrix[1][1] = cosa;
+ result.m_matrix[1][2] = -sina;
}
result.m_type = TxProject;
*this = result * *this;
@@ -778,6 +750,24 @@ QTransform & QTransform::rotateRadians(qreal a, Qt::Axis axis)
return *this;
}
+#if QT_VERSION < QT_VERSION_CHECK(7, 0, 0)
+/*!
+ \overload
+
+ Rotates the coordinate system counterclockwise by the given angle \a a
+ about the specified \a axis at distance 1024.0 from the screen and
+ returns a reference to the matrix.
+
+ \include qtransform.cpp transform-rotate-radians-note
+
+ \sa setMatrix()
+*/
+QTransform &QTransform::rotateRadians(qreal a, Qt::Axis axis)
+{
+ return rotateRadians(a, axis, 1024.0);
+}
+#endif
+
/*!
\fn bool QTransform::operator==(const QTransform &matrix) const
Returns \c true if this matrix is equal to the given \a matrix,
@@ -785,15 +775,15 @@ QTransform & QTransform::rotateRadians(qreal a, Qt::Axis axis)
*/
bool QTransform::operator==(const QTransform &o) const
{
- return affine._m11 == o.affine._m11 &&
- affine._m12 == o.affine._m12 &&
- affine._m21 == o.affine._m21 &&
- affine._m22 == o.affine._m22 &&
- affine._dx == o.affine._dx &&
- affine._dy == o.affine._dy &&
- m_13 == o.m_13 &&
- m_23 == o.m_23 &&
- m_33 == o.m_33;
+ return m_matrix[0][0] == o.m_matrix[0][0] &&
+ m_matrix[0][1] == o.m_matrix[0][1] &&
+ m_matrix[1][0] == o.m_matrix[1][0] &&
+ m_matrix[1][1] == o.m_matrix[1][1] &&
+ m_matrix[2][0] == o.m_matrix[2][0] &&
+ m_matrix[2][1] == o.m_matrix[2][1] &&
+ m_matrix[0][2] == o.m_matrix[0][2] &&
+ m_matrix[1][2] == o.m_matrix[1][2] &&
+ m_matrix[2][2] == o.m_matrix[2][2];
}
/*!
@@ -803,7 +793,7 @@ bool QTransform::operator==(const QTransform &o) const
Returns the hash value for \a key, using
\a seed to seed the calculation.
*/
-uint qHash(const QTransform &key, uint seed) noexcept
+size_t qHash(const QTransform &key, size_t seed) noexcept
{
QtPrivate::QHashCombine hash;
seed = hash(seed, key.m11());
@@ -851,56 +841,59 @@ QTransform & QTransform::operator*=(const QTransform &o)
case TxNone:
break;
case TxTranslate:
- affine._dx += o.affine._dx;
- affine._dy += o.affine._dy;
+ m_matrix[2][0] += o.m_matrix[2][0];
+ m_matrix[2][1] += o.m_matrix[2][1];
break;
case TxScale:
{
- qreal m11 = affine._m11*o.affine._m11;
- qreal m22 = affine._m22*o.affine._m22;
+ qreal m11 = m_matrix[0][0] * o.m_matrix[0][0];
+ qreal m22 = m_matrix[1][1] * o.m_matrix[1][1];
- qreal m31 = affine._dx*o.affine._m11 + o.affine._dx;
- qreal m32 = affine._dy*o.affine._m22 + o.affine._dy;
+ qreal m31 = m_matrix[2][0] * o.m_matrix[0][0] + o.m_matrix[2][0];
+ qreal m32 = m_matrix[2][1] * o.m_matrix[1][1] + o.m_matrix[2][1];
- affine._m11 = m11;
- affine._m22 = m22;
- affine._dx = m31; affine._dy = m32;
+ m_matrix[0][0] = m11;
+ m_matrix[1][1] = m22;
+ m_matrix[2][0] = m31; m_matrix[2][1] = m32;
break;
}
case TxRotate:
case TxShear:
{
- qreal m11 = affine._m11*o.affine._m11 + affine._m12*o.affine._m21;
- qreal m12 = affine._m11*o.affine._m12 + affine._m12*o.affine._m22;
+ qreal m11 = m_matrix[0][0] * o.m_matrix[0][0] + m_matrix[0][1] * o.m_matrix[1][0];
+ qreal m12 = m_matrix[0][0] * o.m_matrix[0][1] + m_matrix[0][1] * o.m_matrix[1][1];
- qreal m21 = affine._m21*o.affine._m11 + affine._m22*o.affine._m21;
- qreal m22 = affine._m21*o.affine._m12 + affine._m22*o.affine._m22;
+ qreal m21 = m_matrix[1][0] * o.m_matrix[0][0] + m_matrix[1][1] * o.m_matrix[1][0];
+ qreal m22 = m_matrix[1][0] * o.m_matrix[0][1] + m_matrix[1][1] * o.m_matrix[1][1];
- qreal m31 = affine._dx*o.affine._m11 + affine._dy*o.affine._m21 + o.affine._dx;
- qreal m32 = affine._dx*o.affine._m12 + affine._dy*o.affine._m22 + o.affine._dy;
+ qreal m31 = m_matrix[2][0] * o.m_matrix[0][0] + m_matrix[2][1] * o.m_matrix[1][0] + o.m_matrix[2][0];
+ qreal m32 = m_matrix[2][0] * o.m_matrix[0][1] + m_matrix[2][1] * o.m_matrix[1][1] + o.m_matrix[2][1];
- affine._m11 = m11; affine._m12 = m12;
- affine._m21 = m21; affine._m22 = m22;
- affine._dx = m31; affine._dy = m32;
+ m_matrix[0][0] = m11;
+ m_matrix[0][1] = m12;
+ m_matrix[1][0] = m21;
+ m_matrix[1][1] = m22;
+ m_matrix[2][0] = m31;
+ m_matrix[2][1] = m32;
break;
}
case TxProject:
{
- qreal m11 = affine._m11*o.affine._m11 + affine._m12*o.affine._m21 + m_13*o.affine._dx;
- qreal m12 = affine._m11*o.affine._m12 + affine._m12*o.affine._m22 + m_13*o.affine._dy;
- qreal m13 = affine._m11*o.m_13 + affine._m12*o.m_23 + m_13*o.m_33;
+ qreal m11 = m_matrix[0][0] * o.m_matrix[0][0] + m_matrix[0][1] * o.m_matrix[1][0] + m_matrix[0][2] * o.m_matrix[2][0];
+ qreal m12 = m_matrix[0][0] * o.m_matrix[0][1] + m_matrix[0][1] * o.m_matrix[1][1] + m_matrix[0][2] * o.m_matrix[2][1];
+ qreal m13 = m_matrix[0][0] * o.m_matrix[0][2] + m_matrix[0][1] * o.m_matrix[1][2] + m_matrix[0][2] * o.m_matrix[2][2];
- qreal m21 = affine._m21*o.affine._m11 + affine._m22*o.affine._m21 + m_23*o.affine._dx;
- qreal m22 = affine._m21*o.affine._m12 + affine._m22*o.affine._m22 + m_23*o.affine._dy;
- qreal m23 = affine._m21*o.m_13 + affine._m22*o.m_23 + m_23*o.m_33;
+ qreal m21 = m_matrix[1][0] * o.m_matrix[0][0] + m_matrix[1][1] * o.m_matrix[1][0] + m_matrix[1][2] * o.m_matrix[2][0];
+ qreal m22 = m_matrix[1][0] * o.m_matrix[0][1] + m_matrix[1][1] * o.m_matrix[1][1] + m_matrix[1][2] * o.m_matrix[2][1];
+ qreal m23 = m_matrix[1][0] * o.m_matrix[0][2] + m_matrix[1][1] * o.m_matrix[1][2] + m_matrix[1][2] * o.m_matrix[2][2];
- qreal m31 = affine._dx*o.affine._m11 + affine._dy*o.affine._m21 + m_33*o.affine._dx;
- qreal m32 = affine._dx*o.affine._m12 + affine._dy*o.affine._m22 + m_33*o.affine._dy;
- qreal m33 = affine._dx*o.m_13 + affine._dy*o.m_23 + m_33*o.m_33;
+ qreal m31 = m_matrix[2][0] * o.m_matrix[0][0] + m_matrix[2][1] * o.m_matrix[1][0] + m_matrix[2][2] * o.m_matrix[2][0];
+ qreal m32 = m_matrix[2][0] * o.m_matrix[0][1] + m_matrix[2][1] * o.m_matrix[1][1] + m_matrix[2][2] * o.m_matrix[2][1];
+ qreal m33 = m_matrix[2][0] * o.m_matrix[0][2] + m_matrix[2][1] * o.m_matrix[1][2] + m_matrix[2][2] * o.m_matrix[2][2];
- affine._m11 = m11; affine._m12 = m12; m_13 = m13;
- affine._m21 = m21; affine._m22 = m22; m_23 = m23;
- affine._dx = m31; affine._dy = m32; m_33 = m33;
+ m_matrix[0][0] = m11; m_matrix[0][1] = m12; m_matrix[0][2] = m13;
+ m_matrix[1][0] = m21; m_matrix[1][1] = m22; m_matrix[1][2] = m23;
+ m_matrix[2][0] = m31; m_matrix[2][1] = m32; m_matrix[2][2] = m33;
}
}
@@ -928,62 +921,63 @@ QTransform QTransform::operator*(const QTransform &m) const
if (thisType == TxNone)
return m;
- QTransform t(true);
+ QTransform t;
TransformationType type = qMax(thisType, otherType);
switch(type) {
case TxNone:
break;
case TxTranslate:
- t.affine._dx = affine._dx + m.affine._dx;
- t.affine._dy += affine._dy + m.affine._dy;
+ t.m_matrix[2][0] = m_matrix[2][0] + m.m_matrix[2][0];
+ t.m_matrix[2][1] = m_matrix[2][1] + m.m_matrix[2][1];
break;
case TxScale:
{
- qreal m11 = affine._m11*m.affine._m11;
- qreal m22 = affine._m22*m.affine._m22;
+ qreal m11 = m_matrix[0][0] * m.m_matrix[0][0];
+ qreal m22 = m_matrix[1][1] * m.m_matrix[1][1];
- qreal m31 = affine._dx*m.affine._m11 + m.affine._dx;
- qreal m32 = affine._dy*m.affine._m22 + m.affine._dy;
+ qreal m31 = m_matrix[2][0] * m.m_matrix[0][0] + m.m_matrix[2][0];
+ qreal m32 = m_matrix[2][1] * m.m_matrix[1][1] + m.m_matrix[2][1];
- t.affine._m11 = m11;
- t.affine._m22 = m22;
- t.affine._dx = m31; t.affine._dy = m32;
+ t.m_matrix[0][0] = m11;
+ t.m_matrix[1][1] = m22;
+ t.m_matrix[2][0] = m31;
+ t.m_matrix[2][1] = m32;
break;
}
case TxRotate:
case TxShear:
{
- qreal m11 = affine._m11*m.affine._m11 + affine._m12*m.affine._m21;
- qreal m12 = affine._m11*m.affine._m12 + affine._m12*m.affine._m22;
+ qreal m11 = m_matrix[0][0] * m.m_matrix[0][0] + m_matrix[0][1] * m.m_matrix[1][0];
+ qreal m12 = m_matrix[0][0] * m.m_matrix[0][1] + m_matrix[0][1] * m.m_matrix[1][1];
- qreal m21 = affine._m21*m.affine._m11 + affine._m22*m.affine._m21;
- qreal m22 = affine._m21*m.affine._m12 + affine._m22*m.affine._m22;
+ qreal m21 = m_matrix[1][0] * m.m_matrix[0][0] + m_matrix[1][1] * m.m_matrix[1][0];
+ qreal m22 = m_matrix[1][0] * m.m_matrix[0][1] + m_matrix[1][1] * m.m_matrix[1][1];
- qreal m31 = affine._dx*m.affine._m11 + affine._dy*m.affine._m21 + m.affine._dx;
- qreal m32 = affine._dx*m.affine._m12 + affine._dy*m.affine._m22 + m.affine._dy;
+ qreal m31 = m_matrix[2][0] * m.m_matrix[0][0] + m_matrix[2][1] * m.m_matrix[1][0] + m.m_matrix[2][0];
+ qreal m32 = m_matrix[2][0] * m.m_matrix[0][1] + m_matrix[2][1] * m.m_matrix[1][1] + m.m_matrix[2][1];
- t.affine._m11 = m11; t.affine._m12 = m12;
- t.affine._m21 = m21; t.affine._m22 = m22;
- t.affine._dx = m31; t.affine._dy = m32;
+ t.m_matrix[0][0] = m11; t.m_matrix[0][1] = m12;
+ t.m_matrix[1][0] = m21; t.m_matrix[1][1] = m22;
+ t.m_matrix[2][0] = m31; t.m_matrix[2][1] = m32;
break;
}
case TxProject:
{
- qreal m11 = affine._m11*m.affine._m11 + affine._m12*m.affine._m21 + m_13*m.affine._dx;
- qreal m12 = affine._m11*m.affine._m12 + affine._m12*m.affine._m22 + m_13*m.affine._dy;
- qreal m13 = affine._m11*m.m_13 + affine._m12*m.m_23 + m_13*m.m_33;
+ qreal m11 = m_matrix[0][0] * m.m_matrix[0][0] + m_matrix[0][1] * m.m_matrix[1][0] + m_matrix[0][2] * m.m_matrix[2][0];
+ qreal m12 = m_matrix[0][0] * m.m_matrix[0][1] + m_matrix[0][1] * m.m_matrix[1][1] + m_matrix[0][2] * m.m_matrix[2][1];
+ qreal m13 = m_matrix[0][0] * m.m_matrix[0][2] + m_matrix[0][1] * m.m_matrix[1][2] + m_matrix[0][2] * m.m_matrix[2][2];
- qreal m21 = affine._m21*m.affine._m11 + affine._m22*m.affine._m21 + m_23*m.affine._dx;
- qreal m22 = affine._m21*m.affine._m12 + affine._m22*m.affine._m22 + m_23*m.affine._dy;
- qreal m23 = affine._m21*m.m_13 + affine._m22*m.m_23 + m_23*m.m_33;
+ qreal m21 = m_matrix[1][0] * m.m_matrix[0][0] + m_matrix[1][1] * m.m_matrix[1][0] + m_matrix[1][2] * m.m_matrix[2][0];
+ qreal m22 = m_matrix[1][0] * m.m_matrix[0][1] + m_matrix[1][1] * m.m_matrix[1][1] + m_matrix[1][2] * m.m_matrix[2][1];
+ qreal m23 = m_matrix[1][0] * m.m_matrix[0][2] + m_matrix[1][1] * m.m_matrix[1][2] + m_matrix[1][2] * m.m_matrix[2][2];
- qreal m31 = affine._dx*m.affine._m11 + affine._dy*m.affine._m21 + m_33*m.affine._dx;
- qreal m32 = affine._dx*m.affine._m12 + affine._dy*m.affine._m22 + m_33*m.affine._dy;
- qreal m33 = affine._dx*m.m_13 + affine._dy*m.m_23 + m_33*m.m_33;
+ qreal m31 = m_matrix[2][0] * m.m_matrix[0][0] + m_matrix[2][1] * m.m_matrix[1][0] + m_matrix[2][2] * m.m_matrix[2][0];
+ qreal m32 = m_matrix[2][0] * m.m_matrix[0][1] + m_matrix[2][1] * m.m_matrix[1][1] + m_matrix[2][2] * m.m_matrix[2][1];
+ qreal m33 = m_matrix[2][0] * m.m_matrix[0][2] + m_matrix[2][1] * m.m_matrix[1][2] + m_matrix[2][2] * m.m_matrix[2][2];
- t.affine._m11 = m11; t.affine._m12 = m12; t.m_13 = m13;
- t.affine._m21 = m21; t.affine._m22 = m22; t.m_23 = m23;
- t.affine._dx = m31; t.affine._dy = m32; t.m_33 = m33;
+ t.m_matrix[0][0] = m11; t.m_matrix[0][1] = m12; t.m_matrix[0][2] = m13;
+ t.m_matrix[1][0] = m21; t.m_matrix[1][1] = m22; t.m_matrix[1][2] = m23;
+ t.m_matrix[2][0] = m31; t.m_matrix[2][1] = m32; t.m_matrix[2][2] = m33;
}
}
@@ -1025,27 +1019,11 @@ QTransform QTransform::operator*(const QTransform &m) const
element of this matrix.
*/
-#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
/*!
+ \fn QTransform &QTransform::operator=(const QTransform &matrix) noexcept
+
Assigns the given \a matrix's values to this matrix.
*/
-QTransform & QTransform::operator=(const QTransform &matrix) noexcept
-{
- affine._m11 = matrix.affine._m11;
- affine._m12 = matrix.affine._m12;
- affine._m21 = matrix.affine._m21;
- affine._m22 = matrix.affine._m22;
- affine._dx = matrix.affine._dx;
- affine._dy = matrix.affine._dy;
- m_13 = matrix.m_13;
- m_23 = matrix.m_23;
- m_33 = matrix.m_33;
- m_type = matrix.m_type;
- m_dirty = matrix.m_dirty;
-
- return *this;
-}
-#endif
/*!
Resets the matrix to an identity matrix, i.e. all elements are set
@@ -1057,10 +1035,7 @@ QTransform & QTransform::operator=(const QTransform &matrix) noexcept
*/
void QTransform::reset()
{
- affine._m11 = affine._m22 = m_33 = 1.0;
- affine._m12 = m_13 = affine._m21 = m_23 = affine._dx = affine._dy = 0;
- m_type = TxNone;
- m_dirty = TxNone;
+ *this = QTransform();
}
#ifndef QT_NO_DATASTREAM
@@ -1170,30 +1145,8 @@ QPoint QTransform::map(const QPoint &p) const
qreal x = 0, y = 0;
TransformationType t = inline_type();
- switch(t) {
- case TxNone:
- x = fx;
- y = fy;
- break;
- case TxTranslate:
- x = fx + affine._dx;
- y = fy + affine._dy;
- break;
- case TxScale:
- x = affine._m11 * fx + affine._dx;
- y = affine._m22 * fy + affine._dy;
- break;
- case TxRotate:
- case TxShear:
- case TxProject:
- x = affine._m11 * fx + affine._m21 * fy + affine._dx;
- y = affine._m12 * fx + affine._m22 * fy + affine._dy;
- if (t == TxProject) {
- qreal w = 1./(m_13 * fx + m_23 * fy + m_33);
- x *= w;
- y *= w;
- }
- }
+ MAP(fx, fy, x, y);
+
return QPoint(qRound(x), qRound(y));
}
@@ -1221,30 +1174,8 @@ QPointF QTransform::map(const QPointF &p) const
qreal x = 0, y = 0;
TransformationType t = inline_type();
- switch(t) {
- case TxNone:
- x = fx;
- y = fy;
- break;
- case TxTranslate:
- x = fx + affine._dx;
- y = fy + affine._dy;
- break;
- case TxScale:
- x = affine._m11 * fx + affine._dx;
- y = affine._m22 * fy + affine._dy;
- break;
- case TxRotate:
- case TxShear:
- case TxProject:
- x = affine._m11 * fx + affine._m21 * fy + affine._dx;
- y = affine._m12 * fx + affine._m22 * fy + affine._dy;
- if (t == TxProject) {
- qreal w = 1./(m_13 * fx + m_23 * fy + m_33);
- x *= w;
- y *= w;
- }
- }
+ MAP(fx, fy, x, y);
+
return QPointF(x, y);
}
@@ -1292,41 +1223,9 @@ QLine QTransform::map(const QLine &l) const
qreal x1 = 0, y1 = 0, x2 = 0, y2 = 0;
TransformationType t = inline_type();
- switch(t) {
- case TxNone:
- x1 = fx1;
- y1 = fy1;
- x2 = fx2;
- y2 = fy2;
- break;
- case TxTranslate:
- x1 = fx1 + affine._dx;
- y1 = fy1 + affine._dy;
- x2 = fx2 + affine._dx;
- y2 = fy2 + affine._dy;
- break;
- case TxScale:
- x1 = affine._m11 * fx1 + affine._dx;
- y1 = affine._m22 * fy1 + affine._dy;
- x2 = affine._m11 * fx2 + affine._dx;
- y2 = affine._m22 * fy2 + affine._dy;
- break;
- case TxRotate:
- case TxShear:
- case TxProject:
- x1 = affine._m11 * fx1 + affine._m21 * fy1 + affine._dx;
- y1 = affine._m12 * fx1 + affine._m22 * fy1 + affine._dy;
- x2 = affine._m11 * fx2 + affine._m21 * fy2 + affine._dx;
- y2 = affine._m12 * fx2 + affine._m22 * fy2 + affine._dy;
- if (t == TxProject) {
- qreal w = 1./(m_13 * fx1 + m_23 * fy1 + m_33);
- x1 *= w;
- y1 *= w;
- w = 1./(m_13 * fx2 + m_23 * fy2 + m_33);
- x2 *= w;
- y2 *= w;
- }
- }
+ MAP(fx1, fy1, x1, y1);
+ MAP(fx2, fy2, x2, y2);
+
return QLine(qRound(x1), qRound(y1), qRound(x2), qRound(y2));
}
@@ -1351,66 +1250,12 @@ QLineF QTransform::map(const QLineF &l) const
qreal x1 = 0, y1 = 0, x2 = 0, y2 = 0;
TransformationType t = inline_type();
- switch(t) {
- case TxNone:
- x1 = fx1;
- y1 = fy1;
- x2 = fx2;
- y2 = fy2;
- break;
- case TxTranslate:
- x1 = fx1 + affine._dx;
- y1 = fy1 + affine._dy;
- x2 = fx2 + affine._dx;
- y2 = fy2 + affine._dy;
- break;
- case TxScale:
- x1 = affine._m11 * fx1 + affine._dx;
- y1 = affine._m22 * fy1 + affine._dy;
- x2 = affine._m11 * fx2 + affine._dx;
- y2 = affine._m22 * fy2 + affine._dy;
- break;
- case TxRotate:
- case TxShear:
- case TxProject:
- x1 = affine._m11 * fx1 + affine._m21 * fy1 + affine._dx;
- y1 = affine._m12 * fx1 + affine._m22 * fy1 + affine._dy;
- x2 = affine._m11 * fx2 + affine._m21 * fy2 + affine._dx;
- y2 = affine._m12 * fx2 + affine._m22 * fy2 + affine._dy;
- if (t == TxProject) {
- qreal w = 1./(m_13 * fx1 + m_23 * fy1 + m_33);
- x1 *= w;
- y1 *= w;
- w = 1./(m_13 * fx2 + m_23 * fy2 + m_33);
- x2 *= w;
- y2 *= w;
- }
- }
- return QLineF(x1, y1, x2, y2);
-}
-
-static QPolygonF mapProjective(const QTransform &transform, const QPolygonF &poly)
-{
- if (poly.size() == 0)
- return poly;
-
- if (poly.size() == 1)
- return QPolygonF() << transform.map(poly.at(0));
-
- QPainterPath path;
- path.addPolygon(poly);
+ MAP(fx1, fy1, x1, y1);
+ MAP(fx2, fy2, x2, y2);
- path = transform.map(path);
-
- QPolygonF result;
- const int elementCount = path.elementCount();
- result.reserve(elementCount);
- for (int i = 0; i < elementCount; ++i)
- result << path.elementAt(i);
- return result;
+ return QLineF(x1, y1, x2, y2);
}
-
/*!
\fn QPolygonF operator *(const QPolygonF &polygon, const QTransform &matrix)
\since 4.3
@@ -1442,10 +1287,7 @@ QPolygonF QTransform::map(const QPolygonF &a) const
{
TransformationType t = inline_type();
if (t <= TxTranslate)
- return a.translated(affine._dx, affine._dy);
-
- if (t >= QTransform::TxProject)
- return mapProjective(*this, a);
+ return a.translated(m_matrix[2][0], m_matrix[2][1]);
int size = a.size();
int i;
@@ -1472,10 +1314,7 @@ QPolygon QTransform::map(const QPolygon &a) const
{
TransformationType t = inline_type();
if (t <= TxTranslate)
- return a.translated(qRound(affine._dx), qRound(affine._dy));
-
- if (t >= QTransform::TxProject)
- return mapProjective(*this, QPolygonF(a)).toPolygon();
+ return a.translated(qRound(m_matrix[2][0]), qRound(m_matrix[2][1]));
int size = a.size();
int i;
@@ -1521,7 +1360,7 @@ QRegion QTransform::map(const QRegion &r) const
if (t == TxTranslate) {
QRegion copy(r);
- copy.translate(qRound(affine._dx), qRound(affine._dy));
+ copy.translate(qRound(m_matrix[2][0]), qRound(m_matrix[2][1]));
return copy;
}
@@ -1529,22 +1368,22 @@ QRegion QTransform::map(const QRegion &r) const
QRegion res;
if (m11() < 0 || m22() < 0) {
for (const QRect &rect : r)
- res += mapRect(QRectF(rect)).toRect();
+ res += qt_mapFillRect(QRectF(rect), *this);
} else {
QVarLengthArray<QRect, 32> rects;
rects.reserve(r.rectCount());
for (const QRect &rect : r) {
- QRect nr = mapRect(QRectF(rect)).toRect();
+ QRect nr = qt_mapFillRect(QRectF(rect), *this);
if (!nr.isEmpty())
rects.append(nr);
}
- res.setRects(rects.constData(), rects.count());
+ res.setRects(rects.constData(), rects.size());
}
return res;
}
QPainterPath p = map(qt_regionToPath(r));
- return p.toFillPolygon(QTransform()).toPolygon();
+ return p.toFillPolygon().toPolygon();
}
struct QHomogeneousCoordinate
@@ -1700,7 +1539,7 @@ QPainterPath QTransform::map(const QPainterPath &path) const
QPainterPath copy = path;
if (t == TxTranslate) {
- copy.translate(affine._dx, affine._dy);
+ copy.translate(m_matrix[2][0], m_matrix[2][1]);
} else {
copy.detach();
// Full xform
@@ -1740,10 +1579,10 @@ QPolygon QTransform::mapToPolygon(const QRect &rect) const
QPolygon a(4);
qreal x[4] = { 0, 0, 0, 0 }, y[4] = { 0, 0, 0, 0 };
if (t <= TxScale) {
- x[0] = affine._m11*rect.x() + affine._dx;
- y[0] = affine._m22*rect.y() + affine._dy;
- qreal w = affine._m11*rect.width();
- qreal h = affine._m22*rect.height();
+ x[0] = m_matrix[0][0]*rect.x() + m_matrix[2][0];
+ y[0] = m_matrix[1][1]*rect.y() + m_matrix[2][1];
+ qreal w = m_matrix[0][0]*rect.width();
+ qreal h = m_matrix[1][1]*rect.height();
if (w < 0) {
w = -w;
x[0] -= w;
@@ -1767,7 +1606,7 @@ QPolygon QTransform::mapToPolygon(const QRect &rect) const
MAP(rect.x(), bottom, x[3], y[3]);
}
- // all coordinates are correctly, tranform to a pointarray
+ // all coordinates are correctly, transform to a pointarray
// (rounding to the next integer)
a.setPoints(4, qRound(x[0]), qRound(y[0]),
qRound(x[1]), qRound(y[1]),
@@ -1785,7 +1624,7 @@ QPolygon QTransform::mapToPolygon(const QRect &rect) const
*/
bool QTransform::squareToQuad(const QPolygonF &quad, QTransform &trans)
{
- if (quad.count() != 4)
+ if (quad.size() != 4)
return false;
qreal dx0 = quad[0].x();
@@ -1900,32 +1739,24 @@ void QTransform::setMatrix(qreal m11, qreal m12, qreal m13,
qreal m21, qreal m22, qreal m23,
qreal m31, qreal m32, qreal m33)
{
- affine._m11 = m11; affine._m12 = m12; m_13 = m13;
- affine._m21 = m21; affine._m22 = m22; m_23 = m23;
- affine._dx = m31; affine._dy = m32; m_33 = m33;
+ m_matrix[0][0] = m11; m_matrix[0][1] = m12; m_matrix[0][2] = m13;
+ m_matrix[1][0] = m21; m_matrix[1][1] = m22; m_matrix[1][2] = m23;
+ m_matrix[2][0] = m31; m_matrix[2][1] = m32; m_matrix[2][2] = m33;
m_type = TxNone;
m_dirty = TxProject;
}
-static inline bool needsPerspectiveClipping(const QRectF &rect, const QTransform &transform)
-{
- const qreal wx = qMin(transform.m13() * rect.left(), transform.m13() * rect.right());
- const qreal wy = qMin(transform.m23() * rect.top(), transform.m23() * rect.bottom());
-
- return wx + wy + transform.m33() < Q_NEAR_CLIP;
-}
-
QRect QTransform::mapRect(const QRect &rect) const
{
TransformationType t = inline_type();
if (t <= TxTranslate)
- return rect.translated(qRound(affine._dx), qRound(affine._dy));
+ return rect.translated(qRound(m_matrix[2][0]), qRound(m_matrix[2][1]));
if (t <= TxScale) {
- int x = qRound(affine._m11*rect.x() + affine._dx);
- int y = qRound(affine._m22*rect.y() + affine._dy);
- int w = qRound(affine._m11*rect.width());
- int h = qRound(affine._m22*rect.height());
+ int x = qRound(m_matrix[0][0] * rect.x() + m_matrix[2][0]);
+ int y = qRound(m_matrix[1][1] * rect.y() + m_matrix[2][1]);
+ int w = qRound(m_matrix[0][0] * rect.width());
+ int h = qRound(m_matrix[1][1] * rect.height());
if (w < 0) {
w = -w;
x -= w;
@@ -1935,8 +1766,7 @@ QRect QTransform::mapRect(const QRect &rect) const
y -= h;
}
return QRect(x, y, w, h);
- } else if (t < TxProject || !needsPerspectiveClipping(rect, *this)) {
- // see mapToPolygon for explanations of the algorithm.
+ } else {
qreal x = 0, y = 0;
MAP(rect.left(), rect.top(), x, y);
qreal xmin = x;
@@ -1958,11 +1788,7 @@ QRect QTransform::mapRect(const QRect &rect) const
ymin = qMin(ymin, y);
xmax = qMax(xmax, x);
ymax = qMax(ymax, y);
- return QRect(qRound(xmin), qRound(ymin), qRound(xmax)-qRound(xmin), qRound(ymax)-qRound(ymin));
- } else {
- QPainterPath path;
- path.addRect(rect);
- return map(path).boundingRect().toRect();
+ return QRectF(xmin, ymin, xmax-xmin, ymax-ymin).toRect();
}
}
@@ -1989,13 +1815,13 @@ QRectF QTransform::mapRect(const QRectF &rect) const
{
TransformationType t = inline_type();
if (t <= TxTranslate)
- return rect.translated(affine._dx, affine._dy);
+ return rect.translated(m_matrix[2][0], m_matrix[2][1]);
if (t <= TxScale) {
- qreal x = affine._m11*rect.x() + affine._dx;
- qreal y = affine._m22*rect.y() + affine._dy;
- qreal w = affine._m11*rect.width();
- qreal h = affine._m22*rect.height();
+ qreal x = m_matrix[0][0] * rect.x() + m_matrix[2][0];
+ qreal y = m_matrix[1][1] * rect.y() + m_matrix[2][1];
+ qreal w = m_matrix[0][0] * rect.width();
+ qreal h = m_matrix[1][1] * rect.height();
if (w < 0) {
w = -w;
x -= w;
@@ -2005,7 +1831,7 @@ QRectF QTransform::mapRect(const QRectF &rect) const
y -= h;
}
return QRectF(x, y, w, h);
- } else if (t < TxProject || !needsPerspectiveClipping(rect, *this)) {
+ } else {
qreal x = 0, y = 0;
MAP(rect.x(), rect.y(), x, y);
qreal xmin = x;
@@ -2028,10 +1854,6 @@ QRectF QTransform::mapRect(const QRectF &rect) const
xmax = qMax(xmax, x);
ymax = qMax(ymax, y);
return QRectF(xmin, ymin, xmax-xmin, ymax - ymin);
- } else {
- QPainterPath path;
- path.addRect(rect);
- return map(path).boundingRect();
}
}
@@ -2083,17 +1905,6 @@ void QTransform::map(int x, int y, int *tx, int *ty) const
}
/*!
- Returns the QTransform as an affine matrix.
-
- \warning If a perspective transformation has been specified,
- then the conversion will cause loss of data.
-*/
-const QMatrix &QTransform::toAffine() const
-{
- return affine;
-}
-
-/*!
Returns the transformation type of this matrix.
The transformation type is the highest enumeration value
@@ -2107,20 +1918,20 @@ const QMatrix &QTransform::toAffine() const
*/
QTransform::TransformationType QTransform::type() const
{
- if(m_dirty == TxNone || m_dirty < m_type)
+ if (m_dirty == TxNone || m_dirty < m_type)
return static_cast<TransformationType>(m_type);
switch (static_cast<TransformationType>(m_dirty)) {
case TxProject:
- if (!qFuzzyIsNull(m_13) || !qFuzzyIsNull(m_23) || !qFuzzyIsNull(m_33 - 1)) {
+ if (!qFuzzyIsNull(m_matrix[0][2]) || !qFuzzyIsNull(m_matrix[1][2]) || !qFuzzyIsNull(m_matrix[2][2] - 1)) {
m_type = TxProject;
break;
}
Q_FALLTHROUGH();
case TxShear:
case TxRotate:
- if (!qFuzzyIsNull(affine._m12) || !qFuzzyIsNull(affine._m21)) {
- const qreal dot = affine._m11 * affine._m12 + affine._m21 * affine._m22;
+ if (!qFuzzyIsNull(m_matrix[0][1]) || !qFuzzyIsNull(m_matrix[1][0])) {
+ const qreal dot = m_matrix[0][0] * m_matrix[1][0] + m_matrix[0][1] * m_matrix[1][1];
if (qFuzzyIsNull(dot))
m_type = TxRotate;
else
@@ -2129,13 +1940,13 @@ QTransform::TransformationType QTransform::type() const
}
Q_FALLTHROUGH();
case TxScale:
- if (!qFuzzyIsNull(affine._m11 - 1) || !qFuzzyIsNull(affine._m22 - 1)) {
+ if (!qFuzzyIsNull(m_matrix[0][0] - 1) || !qFuzzyIsNull(m_matrix[1][1] - 1)) {
m_type = TxScale;
break;
}
Q_FALLTHROUGH();
case TxTranslate:
- if (!qFuzzyIsNull(affine._dx) || !qFuzzyIsNull(affine._dy)) {
+ if (!qFuzzyIsNull(m_matrix[2][0]) || !qFuzzyIsNull(m_matrix[2][1])) {
m_type = TxTranslate;
break;
}
@@ -2155,7 +1966,7 @@ QTransform::TransformationType QTransform::type() const
*/
QTransform::operator QVariant() const
{
- return QVariant(QVariant::Transform, this);
+ return QVariant::fromValue(*this);
}
@@ -2167,15 +1978,6 @@ QTransform::operator QVariant() const
\sa inverted()
*/
-#if QT_DEPRECATED_SINCE(5, 13)
-/*!
- \fn qreal QTransform::det() const
- \obsolete
-
- Returns the matrix's determinant. Use determinant() instead.
-*/
-#endif
-
/*!
\fn qreal QTransform::m11() const
@@ -2384,4 +2186,50 @@ bool qt_scaleForTransform(const QTransform &transform, qreal *scale)
}
}
+QDataStream & operator>>(QDataStream &s, QTransform::Affine &m)
+{
+ if (s.version() == 1) {
+ float m11, m12, m21, m22, dx, dy;
+ s >> m11; s >> m12; s >> m21; s >> m22; s >> dx; s >> dy;
+
+ m.m_matrix[0][0] = m11;
+ m.m_matrix[0][1] = m12;
+ m.m_matrix[1][0] = m21;
+ m.m_matrix[1][1] = m22;
+ m.m_matrix[2][0] = dx;
+ m.m_matrix[2][1] = dy;
+ } else {
+ s >> m.m_matrix[0][0];
+ s >> m.m_matrix[0][1];
+ s >> m.m_matrix[1][0];
+ s >> m.m_matrix[1][1];
+ s >> m.m_matrix[2][0];
+ s >> m.m_matrix[2][1];
+ }
+ m.m_matrix[0][2] = 0;
+ m.m_matrix[1][2] = 0;
+ m.m_matrix[2][2] = 1;
+ return s;
+}
+
+QDataStream &operator<<(QDataStream &s, const QTransform::Affine &m)
+{
+ if (s.version() == 1) {
+ s << (float)m.m_matrix[0][0]
+ << (float)m.m_matrix[0][1]
+ << (float)m.m_matrix[1][0]
+ << (float)m.m_matrix[1][1]
+ << (float)m.m_matrix[2][0]
+ << (float)m.m_matrix[2][1];
+ } else {
+ s << m.m_matrix[0][0]
+ << m.m_matrix[0][1]
+ << m.m_matrix[1][0]
+ << m.m_matrix[1][1]
+ << m.m_matrix[2][0]
+ << m.m_matrix[2][1];
+ }
+ return s;
+}
+
QT_END_NAMESPACE
diff --git a/src/gui/painting/qtransform.h b/src/gui/painting/qtransform.h
index b2a634dd2a..e5b245d8c9 100644
--- a/src/gui/painting/qtransform.h
+++ b/src/gui/painting/qtransform.h
@@ -1,47 +1,9 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the QtGui module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#ifndef QTRANSFORM_H
#define QTRANSFORM_H
#include <QtGui/qtguiglobal.h>
-#include <QtGui/qmatrix.h>
-#include <QtGui/qpainterpath.h>
#include <QtGui/qpolygon.h>
#include <QtGui/qregion.h>
#include <QtGui/qwindowdefs.h>
@@ -51,8 +13,8 @@
QT_BEGIN_NAMESPACE
-
class QVariant;
+class QPainterPath;
class Q_GUI_EXPORT QTransform
{
@@ -66,27 +28,27 @@ public:
TxProject = 0x10
};
- inline explicit QTransform(Qt::Initialization) : affine(Qt::Uninitialized) {}
- QTransform();
+ inline explicit QTransform(Qt::Initialization) {}
+ inline QTransform()
+ : m_matrix{ {1, 0, 0}, {0, 1, 0}, {0, 0, 1} }
+ , m_type(TxNone)
+ , m_dirty(TxNone) {}
QTransform(qreal h11, qreal h12, qreal h13,
qreal h21, qreal h22, qreal h23,
- qreal h31, qreal h32, qreal h33 = 1.0);
+ qreal h31, qreal h32, qreal h33)
+ : m_matrix{ {h11, h12, h13}, {h21, h22, h23}, {h31, h32, h33} }
+ , m_type(TxNone)
+ , m_dirty(TxProject) {}
QTransform(qreal h11, qreal h12, qreal h21,
- qreal h22, qreal dx, qreal dy);
- explicit QTransform(const QMatrix &mtx);
-
-#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
- // ### Qt 6: remove; the compiler-generated ones are fine!
- QTransform &operator=(QTransform &&other) noexcept // = default
- { memcpy(static_cast<void *>(this), static_cast<void *>(&other), sizeof(QTransform)); return *this; }
- QTransform &operator=(const QTransform &) noexcept; // = default
- QTransform(QTransform &&other) noexcept // = default
- : affine(Qt::Uninitialized)
- { memcpy(static_cast<void *>(this), static_cast<void *>(&other), sizeof(QTransform)); }
- QTransform(const QTransform &other) noexcept // = default
- : affine(Qt::Uninitialized)
- { memcpy(static_cast<void *>(this), static_cast<const void *>(&other), sizeof(QTransform)); }
-#endif
+ qreal h22, qreal dx, qreal dy)
+ : m_matrix{ {h11, h12, 0}, {h21, h22, 0}, {dx, dy, 1} }
+ , m_type(TxNone)
+ , m_dirty(TxShear) {}
+
+ QTransform &operator=(QTransform &&other) noexcept = default;
+ QTransform &operator=(const QTransform &) noexcept = default;
+ QTransform(QTransform &&other) noexcept = default;
+ QTransform(const QTransform &other) noexcept = default;
bool isAffine() const;
bool isIdentity() const;
@@ -98,10 +60,6 @@ public:
TransformationType type() const;
inline qreal determinant() const;
-#if QT_DEPRECATED_SINCE(5, 13)
- QT_DEPRECATED_X("Use determinant() instead")
- qreal det() const;
-#endif
qreal m11() const;
qreal m12() const;
@@ -119,15 +77,24 @@ public:
qreal m21, qreal m22, qreal m23,
qreal m31, qreal m32, qreal m33);
- Q_REQUIRED_RESULT QTransform inverted(bool *invertible = nullptr) const;
- Q_REQUIRED_RESULT QTransform adjoint() const;
- Q_REQUIRED_RESULT QTransform transposed() const;
+ [[nodiscard]] QTransform inverted(bool *invertible = nullptr) const;
+ [[nodiscard]] QTransform adjoint() const;
+ [[nodiscard]] QTransform transposed() const;
QTransform &translate(qreal dx, qreal dy);
QTransform &scale(qreal sx, qreal sy);
QTransform &shear(qreal sh, qreal sv);
+#if QT_VERSION < QT_VERSION_CHECK(7, 0, 0)
+ QTransform &rotate(qreal a, Qt::Axis axis, qreal distanceToPlane);
+ // ### Qt7: Remove
QTransform &rotate(qreal a, Qt::Axis axis = Qt::ZAxis);
+ QTransform &rotateRadians(qreal a, Qt::Axis axis, qreal distanceToPlane);
+ // ### Qt7: Remove
QTransform &rotateRadians(qreal a, Qt::Axis axis = Qt::ZAxis);
+#else
+ QTransform &rotate(qreal a, Qt::Axis axis = Qt::ZAxis, qreal distanceToPlane = 1024.0f);
+ QTransform &rotateRadians(qreal a, Qt::Axis axis = Qt::ZAxis, qreal distanceToPlane = 1024.0f);
+#endif
static bool squareToQuad(const QPolygonF &square, QTransform &result);
static bool quadToSquare(const QPolygonF &quad, QTransform &result);
@@ -158,8 +125,6 @@ public:
void map(int x, int y, int *tx, int *ty) const;
void map(qreal x, qreal y, qreal *tx, qreal *ty) const;
- const QMatrix &toAffine() const;
-
QTransform &operator*=(qreal div);
QTransform &operator/=(qreal div);
QTransform &operator+=(qreal div);
@@ -169,44 +134,25 @@ public:
static QTransform fromScale(qreal dx, qreal dy);
private:
- inline QTransform(qreal h11, qreal h12, qreal h13,
- qreal h21, qreal h22, qreal h23,
- qreal h31, qreal h32, qreal h33, bool)
- : affine(h11, h12, h21, h22, h31, h32, true)
- , m_13(h13), m_23(h23), m_33(h33)
- , m_type(TxNone)
- , m_dirty(TxProject)
-#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
- , d(nullptr)
-#endif
- {
- }
- inline QTransform(bool)
- : affine(true)
- , m_13(0), m_23(0), m_33(1)
- , m_type(TxNone)
- , m_dirty(TxNone)
-#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
- , d(nullptr)
-#endif
- {
- }
+ struct Affine {
+ qreal (& m_matrix)[3][3];
+ };
+
+public:
+ auto asAffineMatrix() { return Affine { m_matrix }; }
+ friend Q_GUI_EXPORT QDataStream &operator>>(QDataStream &s, Affine &m);
+ friend Q_GUI_EXPORT QDataStream &operator<<(QDataStream &s, const Affine &m);
+
+private:
inline TransformationType inline_type() const;
- QMatrix affine;
- qreal m_13;
- qreal m_23;
- qreal m_33;
+ qreal m_matrix[3][3];
mutable uint m_type : 5;
mutable uint m_dirty : 5;
-#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
- class Private;
- Private *d;
-#endif
};
-Q_DECLARE_TYPEINFO(QTransform, Q_MOVABLE_TYPE);
+Q_DECLARE_TYPEINFO(QTransform, Q_RELOCATABLE_TYPE);
-Q_GUI_EXPORT Q_DECL_CONST_FUNCTION uint qHash(const QTransform &key, uint seed = 0) noexcept;
+Q_GUI_EXPORT Q_DECL_CONST_FUNCTION size_t qHash(const QTransform &key, size_t seed = 0) noexcept;
/******* inlines *****/
inline QTransform::TransformationType QTransform::inline_type() const
@@ -246,78 +192,71 @@ inline bool QTransform::isTranslating() const
inline qreal QTransform::determinant() const
{
- return affine._m11*(m_33*affine._m22-affine._dy*m_23) -
- affine._m21*(m_33*affine._m12-affine._dy*m_13)+affine._dx*(m_23*affine._m12-affine._m22*m_13);
-}
-#if QT_DEPRECATED_SINCE(5, 13)
-inline qreal QTransform::det() const
-{
- return determinant();
+ return m_matrix[0][0] * (m_matrix[2][2] * m_matrix[1][1] - m_matrix[2][1] * m_matrix[1][2]) -
+ m_matrix[1][0] * (m_matrix[2][2] * m_matrix[0][1] - m_matrix[2][1] * m_matrix[0][2]) +
+ m_matrix[2][0] * (m_matrix[1][2] * m_matrix[0][1] - m_matrix[1][1] * m_matrix[0][2]);
}
-#endif
inline qreal QTransform::m11() const
{
- return affine._m11;
+ return m_matrix[0][0];
}
inline qreal QTransform::m12() const
{
- return affine._m12;
+ return m_matrix[0][1];
}
inline qreal QTransform::m13() const
{
- return m_13;
+ return m_matrix[0][2];
}
inline qreal QTransform::m21() const
{
- return affine._m21;
+ return m_matrix[1][0];
}
inline qreal QTransform::m22() const
{
- return affine._m22;
+ return m_matrix[1][1];
}
inline qreal QTransform::m23() const
{
- return m_23;
+ return m_matrix[1][2];
}
inline qreal QTransform::m31() const
{
- return affine._dx;
+ return m_matrix[2][0];
}
inline qreal QTransform::m32() const
{
- return affine._dy;
+ return m_matrix[2][1];
}
inline qreal QTransform::m33() const
{
- return m_33;
+ return m_matrix[2][2];
}
inline qreal QTransform::dx() const
{
- return affine._dx;
+ return m_matrix[2][0];
}
inline qreal QTransform::dy() const
{
- return affine._dy;
+ return m_matrix[2][1];
}
QT_WARNING_PUSH
-QT_WARNING_DISABLE_CLANG("-Wfloat-equal")
-QT_WARNING_DISABLE_GCC("-Wfloat-equal")
-QT_WARNING_DISABLE_INTEL(1572)
+QT_WARNING_DISABLE_FLOAT_COMPARE
inline QTransform &QTransform::operator*=(qreal num)
{
if (num == 1.)
return *this;
- affine._m11 *= num;
- affine._m12 *= num;
- m_13 *= num;
- affine._m21 *= num;
- affine._m22 *= num;
- m_23 *= num;
- affine._dx *= num;
- affine._dy *= num;
- m_33 *= num;
+ m_matrix[0][0] *= num;
+ m_matrix[0][1] *= num;
+ m_matrix[0][2] *= num;
+ m_matrix[1][0] *= num;
+ m_matrix[1][1] *= num;
+ m_matrix[1][2] *= num;
+ m_matrix[2][0] *= num;
+ m_matrix[2][1] *= num;
+ m_matrix[2][2] *= num;
if (m_dirty < TxScale)
m_dirty = TxScale;
return *this;
@@ -333,15 +272,15 @@ inline QTransform &QTransform::operator+=(qreal num)
{
if (num == 0)
return *this;
- affine._m11 += num;
- affine._m12 += num;
- m_13 += num;
- affine._m21 += num;
- affine._m22 += num;
- m_23 += num;
- affine._dx += num;
- affine._dy += num;
- m_33 += num;
+ m_matrix[0][0] += num;
+ m_matrix[0][1] += num;
+ m_matrix[0][2] += num;
+ m_matrix[1][0] += num;
+ m_matrix[1][1] += num;
+ m_matrix[1][2] += num;
+ m_matrix[2][0] += num;
+ m_matrix[2][1] += num;
+ m_matrix[2][2] += num;
m_dirty = TxProject;
return *this;
}
@@ -349,15 +288,15 @@ inline QTransform &QTransform::operator-=(qreal num)
{
if (num == 0)
return *this;
- affine._m11 -= num;
- affine._m12 -= num;
- m_13 -= num;
- affine._m21 -= num;
- affine._m22 -= num;
- m_23 -= num;
- affine._dx -= num;
- affine._dy -= num;
- m_33 -= num;
+ m_matrix[0][0] -= num;
+ m_matrix[0][1] -= num;
+ m_matrix[0][2] -= num;
+ m_matrix[1][0] -= num;
+ m_matrix[1][1] -= num;
+ m_matrix[1][2] -= num;
+ m_matrix[2][0] -= num;
+ m_matrix[2][1] -= num;
+ m_matrix[2][2] -= num;
m_dirty = TxProject;
return *this;
}
@@ -404,8 +343,6 @@ inline QPolygonF operator *(const QPolygonF &a, const QTransform &m)
{ return m.map(a); }
inline QRegion operator *(const QRegion &r, const QTransform &m)
{ return m.map(r); }
-inline QPainterPath operator *(const QPainterPath &p, const QTransform &m)
-{ return m.map(p); }
inline QTransform operator *(const QTransform &a, qreal n)
{ QTransform t(a); t *= n; return t; }
diff --git a/src/gui/painting/qtriangulatingstroker.cpp b/src/gui/painting/qtriangulatingstroker.cpp
index 8e0308f268..c8d2e90397 100644
--- a/src/gui/painting/qtriangulatingstroker.cpp
+++ b/src/gui/painting/qtriangulatingstroker.cpp
@@ -1,41 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the QtGui module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#include "qtriangulatingstroker_p.h"
#include <qmath.h>
@@ -50,6 +14,7 @@ QT_BEGIN_NAMESPACE
void QTriangulatingStroker::endCapOrJoinClosed(const qreal *start, const qreal *cur,
bool implicitClose, bool endsAtStart)
{
+ Q_ASSERT(start);
if (endsAtStart) {
join(start + 2);
} else if (implicitClose) {
@@ -79,11 +44,12 @@ static inline void skipDuplicatePoints(const qreal **pts, const qreal *endPts)
}
}
-void QTriangulatingStroker::process(const QVectorPath &path, const QPen &pen, const QRectF &, QPainter::RenderHints hints)
+void QTriangulatingStroker::process(const QVectorPath &path, const QPen &pen, const QRectF &, QPainter::RenderHints)
{
const qreal *pts = path.points();
const QPainterPath::ElementType *types = path.elements();
int count = path.elementCount();
+ m_vertices.reset();
if (count < 2)
return;
@@ -93,14 +59,13 @@ void QTriangulatingStroker::process(const QVectorPath &path, const QPen &pen, co
m_width = realWidth / 2;
- bool cosmetic = qt_pen_is_cosmetic(pen, hints);
+ bool cosmetic = pen.isCosmetic();
if (cosmetic) {
m_width = m_width * m_inv_scale;
}
m_join_style = qpen_joinStyle(pen);
m_cap_style = qpen_capStyle(pen);
- m_vertices.reset();
m_miter_limit = pen.miterLimit() * qpen_widthf(pen);
// The curvyness is based on the notion that I originally wanted
@@ -188,6 +153,31 @@ void QTriangulatingStroker::process(const QVectorPath &path, const QPen &pen, co
while (pts < endPts) {
switch (*types) {
case QPainterPath::MoveToElement: {
+ int end = (endPts - pts) / 2;
+ int nextMoveElement = 1;
+ bool hasValidLineSegments = false;
+ while (nextMoveElement < end && types[nextMoveElement] != QPainterPath::MoveToElement) {
+ if (!hasValidLineSegments) {
+ hasValidLineSegments =
+ float(pts[0]) != float(pts[nextMoveElement * 2]) ||
+ float(pts[1]) != float(pts[nextMoveElement * 2 + 1]);
+ }
+ ++nextMoveElement;
+ }
+
+ /**
+ * 'LineToElement' may be skipped if it doesn't move the center point
+ * of the line. We should make sure that we don't end up with a lost
+ * 'MoveToElement' in the vertex buffer, not connected to anything. Since
+ * the buffer uses degenerate triangles trick to split the primitives,
+ * this spurious MoveToElement will create artifacts when rendering.
+ */
+ if (!hasValidLineSegments) {
+ pts += 2 * nextMoveElement;
+ types += nextMoveElement;
+ continue;
+ }
+
if (previousType != QPainterPath::MoveToElement)
endCapOrJoinClosed(startPts, previousPts, path.hasImplicitClose(), endsAtStart);
@@ -196,13 +186,8 @@ void QTriangulatingStroker::process(const QVectorPath &path, const QPen &pen, co
if (startPts + 2 >= endPts)
return; // Nothing to see here...
- int end = (endPts - pts) / 2;
- int i = 2; // Start looking to ahead since we never have two moveto's in a row
- while (i<end && types[i] != QPainterPath::MoveToElement) {
- ++i;
- }
- endsAtStart = float(startPts[0]) == float(pts[i*2 - 2])
- && float(startPts[1]) == float(pts[i*2 - 1]);
+ endsAtStart = float(startPts[0]) == float(pts[nextMoveElement * 2 - 2])
+ && float(startPts[1]) == float(pts[nextMoveElement * 2 - 1]);
if (endsAtStart || path.hasImplicitClose())
m_cap_style = Qt::FlatCap;
@@ -517,14 +502,14 @@ QDashedStrokeProcessor::QDashedStrokeProcessor()
m_dash_stroker.setCubicToHook(qdashprocessor_cubicTo);
}
-void QDashedStrokeProcessor::process(const QVectorPath &path, const QPen &pen, const QRectF &clip, QPainter::RenderHints hints)
+void QDashedStrokeProcessor::process(const QVectorPath &path, const QPen &pen, const QRectF &clip, QPainter::RenderHints)
{
const qreal *pts = path.points();
const QPainterPath::ElementType *types = path.elements();
int count = path.elementCount();
- bool cosmetic = qt_pen_is_cosmetic(pen, hints);
+ bool cosmetic = pen.isCosmetic();
bool implicitClose = path.hasImplicitClose();
m_points.reset();
@@ -619,4 +604,3 @@ void QDashedStrokeProcessor::process(const QVectorPath &path, const QPen &pen, c
}
QT_END_NAMESPACE
-
diff --git a/src/gui/painting/qtriangulatingstroker_p.h b/src/gui/painting/qtriangulatingstroker_p.h
index 2b0f08972b..cd038b0d45 100644
--- a/src/gui/painting/qtriangulatingstroker_p.h
+++ b/src/gui/painting/qtriangulatingstroker_p.h
@@ -1,41 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the QtGui module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2020 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#ifndef QTRIANGULATINGSTROKER_P_H
#define QTRIANGULATINGSTROKER_P_H
@@ -51,6 +15,7 @@
// We mean it.
//
+#include <QtCore/qmath.h>
#include <QtGui/private/qtguiglobal_p.h>
#include <private/qdatabuffer_p.h>
#include <qvarlengtharray.h>
@@ -134,18 +99,9 @@ private:
inline void QTriangulatingStroker::normalVector(float x1, float y1, float x2, float y2,
float *nx, float *ny)
{
- float dx = x2 - x1;
- float dy = y2 - y1;
- Q_ASSERT(dx != 0 || dy != 0);
-
- float pw;
-
- if (dx == 0)
- pw = m_width / std::abs(dy);
- else if (dy == 0)
- pw = m_width / std::abs(dx);
- else
- pw = m_width / std::sqrt(dx*dx + dy*dy);
+ const float dx = x2 - x1;
+ const float dy = y2 - y1;
+ const float pw = m_width / qHypot(dx, dy);
*nx = -dy * pw;
*ny = dx * pw;
diff --git a/src/gui/painting/qtriangulator.cpp b/src/gui/painting/qtriangulator.cpp
index ec3ab8ff8f..029566f1b9 100644
--- a/src/gui/painting/qtriangulator.cpp
+++ b/src/gui/painting/qtriangulator.cpp
@@ -1,41 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the QtGui module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#include "qtriangulator_p.h"
@@ -66,8 +30,8 @@ struct QVertexSet
QVertexSet<T> &operator = (const QVertexSet<T> &other) {vertices = other.vertices; indices = other.indices; return *this;}
// The vertices of a triangle are given by: (x[i[n]], y[i[n]]), (x[j[n]], y[j[n]]), (x[k[n]], y[k[n]]), n = 0, 1, ...
- QVector<qreal> vertices; // [x[0], y[0], x[1], y[1], x[2], ...]
- QVector<T> indices; // [i[0], j[0], k[0], i[1], j[1], k[1], i[2], ...]
+ QList<qreal> vertices; // [x[0], y[0], x[1], y[1], x[2], ...]
+ QList<T> indices; // [i[0], j[0], k[0], i[1], j[1], k[1], i[2], ...]
};
//============================================================================//
@@ -570,8 +534,8 @@ public:
class ComplexToSimple
{
public:
- inline ComplexToSimple(QTriangulator<T> *parent) : m_parent(parent),
- m_edges(0), m_events(0), m_splits(0) { }
+ inline ComplexToSimple(QTriangulator<T> *parent)
+ : m_parent(parent), m_edges(0), m_events(0), m_splits(0), m_initialPointCount(0) { }
void decompose();
private:
struct Edge
@@ -674,7 +638,8 @@ public:
class SimpleToMonotone
{
public:
- inline SimpleToMonotone(QTriangulator<T> *parent) : m_parent(parent), m_edges(0), m_upperVertex(0) { }
+ inline SimpleToMonotone(QTriangulator<T> *parent)
+ : m_parent(parent), m_edges(0), m_upperVertex(0), m_clockwiseOrder(false) { }
void decompose();
private:
enum VertexType {MergeVertex, EndVertex, RegularVertex, StartVertex, SplitVertex};
@@ -730,7 +695,8 @@ public:
class MonotoneToTriangles
{
public:
- inline MonotoneToTriangles(QTriangulator<T> *parent) : m_parent(parent) { }
+ inline MonotoneToTriangles(QTriangulator<T> *parent)
+ : m_parent(parent), m_first(0), m_length(0) { }
void decompose();
private:
inline T indices(int index) const {return m_parent->m_indices.at(index + m_first);}
@@ -748,7 +714,8 @@ public:
int m_length;
};
- inline QTriangulator() : m_vertices(0) { }
+ inline QTriangulator()
+ : m_vertices(0), m_hint(0) { }
// Call this only once.
void initialize(const qreal *polygon, int count, uint hint, const QTransform &matrix);
@@ -761,7 +728,7 @@ public:
QVertexSet<T> polyline();
private:
QDataBuffer<QPodPoint> m_vertices;
- QVector<T> m_indices;
+ QList<T> m_indices;
uint m_hint;
};
@@ -1061,7 +1028,7 @@ template <typename T>
QPair<QRBTree<int>::Node *, QRBTree<int>::Node *> QTriangulator<T>::ComplexToSimple::bounds(const QPodPoint &point) const
{
QRBTree<int>::Node *current = m_edgeList.root;
- QPair<QRBTree<int>::Node *, QRBTree<int>::Node *> result(0, 0);
+ QPair<QRBTree<int>::Node *, QRBTree<int>::Node *> result(nullptr, nullptr);
while (current) {
const QPodPoint &v1 = m_parent->m_vertices.at(m_edges.at(current->data).lower());
const QPodPoint &v2 = m_parent->m_vertices.at(m_edges.at(current->data).upper());
@@ -1110,7 +1077,7 @@ template <typename T>
QPair<QRBTree<int>::Node *, QRBTree<int>::Node *> QTriangulator<T>::ComplexToSimple::outerBounds(const QPodPoint &point) const
{
QRBTree<int>::Node *current = m_edgeList.root;
- QPair<QRBTree<int>::Node *, QRBTree<int>::Node *> result(0, 0);
+ QPair<QRBTree<int>::Node *, QRBTree<int>::Node *> result(nullptr, nullptr);
while (current) {
const QPodPoint &v1 = m_parent->m_vertices.at(m_edges.at(current->data).lower());
@@ -1309,7 +1276,7 @@ void QTriangulator<T>::ComplexToSimple::calculateIntersections()
int vertex = (event.type == Event::Upper ? m_edges.at(event.edge).upper() : m_edges.at(event.edge).lower());
QIntersectionPoint eventPoint = QT_PREPEND_NAMESPACE(qIntersectionPoint)(event.point);
- if (range.first != 0) {
+ if (range.first != nullptr) {
splitEdgeListRange(range.first, range.second, vertex, eventPoint);
reorderEdgeListRange(range.first, range.second);
}
@@ -1985,7 +1952,7 @@ void QTriangulator<T>::SimpleToMonotone::createDiagonal(int lower, int upper)
int prevLower = m_edges.at(lower).previous;
int prevUpper = m_edges.at(upper).previous;
- Edge e;
+ Edge e = {};
e.twin = m_edges.size() + 1;
e.next = upper;
@@ -2155,7 +2122,7 @@ bool QTriangulator<T>::SimpleToMonotone::CompareVertices::operator () (int i, in
template <typename T>
void QTriangulator<T>::MonotoneToTriangles::decompose()
{
- QVector<T> result;
+ QList<T> result;
QDataBuffer<int> stack(m_parent->m_indices.size());
m_first = 0;
// Require at least three more indices.
@@ -2354,3 +2321,5 @@ QPolylineSet qPolyline(const QPainterPath &path,
}
QT_END_NAMESPACE
+
+#undef Q_FIXED_POINT_SCALE
diff --git a/src/gui/painting/qtriangulator_p.h b/src/gui/painting/qtriangulator_p.h
index 177e5e66ed..09db3f1619 100644
--- a/src/gui/painting/qtriangulator_p.h
+++ b/src/gui/painting/qtriangulator_p.h
@@ -1,41 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the QtGui module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#ifndef QTRIANGULATOR_P_H
#define QTRIANGULATOR_P_H
@@ -52,8 +16,8 @@
//
#include <QtGui/private/qtguiglobal_p.h>
-#include <QtCore/qvector.h>
#include <QtGui/private/qvectorpath_p.h>
+#include <QtCore/qlist.h>
QT_BEGIN_NAMESPACE
@@ -67,13 +31,13 @@ public:
inline Type type() const { return t; }
- inline void setDataUint(const QVector<quint32> &data)
+ inline void setDataUint(const QList<quint32> &data)
{
t = UnsignedInt;
indices32 = data;
}
- inline void setDataUshort(const QVector<quint16> &data)
+ inline void setDataUshort(const QList<quint16> &data)
{
t = UnsignedShort;
indices16 = data;
@@ -96,20 +60,20 @@ public:
private:
Type t;
- QVector<quint32> indices32;
- QVector<quint16> indices16;
+ QList<quint32> indices32;
+ QList<quint16> indices16;
};
struct QTriangleSet
{
// The vertices of a triangle are given by: (x[i[n]], y[i[n]]), (x[j[n]], y[j[n]]), (x[k[n]], y[k[n]]), n = 0, 1, ...
- QVector<qreal> vertices; // [x[0], y[0], x[1], y[1], x[2], ...]
+ QList<qreal> vertices; // [x[0], y[0], x[1], y[1], x[2], ...]
QVertexIndexVector indices; // [i[0], j[0], k[0], i[1], j[1], k[1], i[2], ...]
};
struct QPolylineSet
{
- QVector<qreal> vertices; // [x[0], y[0], x[1], y[1], x[2], ...]
+ QList<qreal> vertices; // [x[0], y[0], x[1], y[1], x[2], ...]
QVertexIndexVector indices; // End of polyline is marked with -1.
};
diff --git a/src/gui/painting/qvectorpath_p.h b/src/gui/painting/qvectorpath_p.h
index df5772d4cc..b99d8fd857 100644
--- a/src/gui/painting/qvectorpath_p.h
+++ b/src/gui/painting/qvectorpath_p.h
@@ -1,41 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the QtGui module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#ifndef QVECTORPATH_P_H
#define QVECTORPATH_P_H
diff --git a/src/gui/painting/shaders/backingstorecompose.frag b/src/gui/painting/shaders/backingstorecompose.frag
new file mode 100644
index 0000000000..3b08ade035
--- /dev/null
+++ b/src/gui/painting/shaders/backingstorecompose.frag
@@ -0,0 +1,25 @@
+#version 440
+
+layout(location = 0) in vec2 v_texcoord;
+layout(location = 0) out vec4 fragColor;
+
+layout(std140, binding = 0) uniform buf {
+ mat4 vertexTransform;
+ mat3 textureTransform;
+ float opacity;
+ int textureSwizzle;
+};
+
+layout(binding = 1) uniform sampler2D textureSampler;
+
+void main()
+{
+ vec4 tmpFragColor = texture(textureSampler, v_texcoord);
+ tmpFragColor.a *= opacity;
+ if (textureSwizzle == 0)
+ fragColor = tmpFragColor;
+ else if(textureSwizzle == 2)
+ fragColor.argb = tmpFragColor;
+ else
+ fragColor.bgra = tmpFragColor;
+}
diff --git a/src/gui/painting/shaders/backingstorecompose.frag.qsb b/src/gui/painting/shaders/backingstorecompose.frag.qsb
new file mode 100644
index 0000000000..63ba55eed8
--- /dev/null
+++ b/src/gui/painting/shaders/backingstorecompose.frag.qsb
Binary files differ
diff --git a/src/gui/painting/shaders/backingstorecompose.vert b/src/gui/painting/shaders/backingstorecompose.vert
new file mode 100644
index 0000000000..0c72c97419
--- /dev/null
+++ b/src/gui/painting/shaders/backingstorecompose.vert
@@ -0,0 +1,19 @@
+#version 440
+
+layout(location = 0) in vec3 position;
+layout(location = 1) in vec2 texcoord;
+
+layout(location = 0) out vec2 v_texcoord;
+
+layout(std140, binding = 0) uniform buf {
+ mat4 vertexTransform;
+ mat3 textureTransform;
+ float opacity;
+ int textureSwizzle;
+};
+
+void main()
+{
+ v_texcoord = (textureTransform * vec3(texcoord, 1.0)).xy;
+ gl_Position = vertexTransform * vec4(position, 1.0);
+}
diff --git a/src/gui/painting/shaders/backingstorecompose.vert.qsb b/src/gui/painting/shaders/backingstorecompose.vert.qsb
new file mode 100644
index 0000000000..1aa6e661f8
--- /dev/null
+++ b/src/gui/painting/shaders/backingstorecompose.vert.qsb
Binary files differ
diff --git a/src/gui/painting/webgradients.binaryjson b/src/gui/painting/webgradients.binaryjson
deleted file mode 100644
index 75edd487be..0000000000
--- a/src/gui/painting/webgradients.binaryjson
+++ /dev/null
Binary files differ
diff --git a/src/gui/painting/webgradients.cpp b/src/gui/painting/webgradients.cpp
new file mode 100644
index 0000000000..fd5031349e
--- /dev/null
+++ b/src/gui/painting/webgradients.cpp
@@ -0,0 +1,533 @@
+// Copyright (C) 2019 Klarälvdalens Datakonsult AB, a KDAB Group company, info@kdab.com, author Giuseppe D'Angelo <giuseppe.dangelo@kdab.com>
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
+
+// This file is auto-generated by gradientgen. DO NOT EDIT!
+
+static QList<QGradientStop> qt_preset_gradient_stops(QGradient::Preset preset)
+{
+ Q_ASSERT(preset < QGradient::NumPresets);
+ switch (preset) {
+ case QGradient::WarmFlame:
+ return Q_ARRAY_LITERAL(QGradientStop, QGradientStop(0, QColor(255, 154, 158, 255)), QGradientStop(0.99, QColor(250, 208, 196, 255)), QGradientStop(1, QColor(250, 208, 196, 255)));
+ case QGradient::NightFade:
+ return Q_ARRAY_LITERAL(QGradientStop, QGradientStop(0, QColor(161, 140, 209, 255)), QGradientStop(1, QColor(251, 194, 235, 255)));
+ case QGradient::SpringWarmth:
+ return Q_ARRAY_LITERAL(QGradientStop, QGradientStop(0, QColor(250, 208, 196, 255)), QGradientStop(0.01, QColor(250, 208, 196, 255)), QGradientStop(1, QColor(255, 209, 255, 255)));
+ case QGradient::JuicyPeach:
+ return Q_ARRAY_LITERAL(QGradientStop, QGradientStop(0, QColor(255, 236, 210, 255)), QGradientStop(1, QColor(252, 182, 159, 255)));
+ case QGradient::YoungPassion:
+ return Q_ARRAY_LITERAL(QGradientStop, QGradientStop(0, QColor(255, 129, 119, 255)), QGradientStop(0, QColor(255, 134, 122, 255)), QGradientStop(0.21, QColor(255, 140, 127, 255)), QGradientStop(0.52, QColor(249, 145, 133, 255)), QGradientStop(0.78, QColor(207, 85, 108, 255)), QGradientStop(1, QColor(177, 42, 91, 255)));
+ case QGradient::LadyLips:
+ return Q_ARRAY_LITERAL(QGradientStop, QGradientStop(0, QColor(255, 154, 158, 255)), QGradientStop(0.99, QColor(254, 207, 239, 255)), QGradientStop(1, QColor(254, 207, 239, 255)));
+ case QGradient::SunnyMorning:
+ return Q_ARRAY_LITERAL(QGradientStop, QGradientStop(0, QColor(246, 211, 101, 255)), QGradientStop(1, QColor(253, 160, 133, 255)));
+ case QGradient::RainyAshville:
+ return Q_ARRAY_LITERAL(QGradientStop, QGradientStop(0, QColor(251, 194, 235, 255)), QGradientStop(1, QColor(166, 193, 238, 255)));
+ case QGradient::FrozenDreams:
+ return Q_ARRAY_LITERAL(QGradientStop, QGradientStop(0, QColor(253, 203, 241, 255)), QGradientStop(0.01, QColor(253, 203, 241, 255)), QGradientStop(1, QColor(230, 222, 233, 255)));
+ case QGradient::WinterNeva:
+ return Q_ARRAY_LITERAL(QGradientStop, QGradientStop(0, QColor(161, 196, 253, 255)), QGradientStop(1, QColor(194, 233, 251, 255)));
+ case QGradient::DustyGrass:
+ return Q_ARRAY_LITERAL(QGradientStop, QGradientStop(0, QColor(212, 252, 121, 255)), QGradientStop(1, QColor(150, 230, 161, 255)));
+ case QGradient::TemptingAzure:
+ return Q_ARRAY_LITERAL(QGradientStop, QGradientStop(0, QColor(132, 250, 176, 255)), QGradientStop(1, QColor(143, 211, 244, 255)));
+ case QGradient::HeavyRain:
+ return Q_ARRAY_LITERAL(QGradientStop, QGradientStop(0, QColor(207, 217, 223, 255)), QGradientStop(1, QColor(226, 235, 240, 255)));
+ case QGradient::AmyCrisp:
+ return Q_ARRAY_LITERAL(QGradientStop, QGradientStop(0, QColor(166, 192, 254, 255)), QGradientStop(1, QColor(246, 128, 132, 255)));
+ case QGradient::MeanFruit:
+ return Q_ARRAY_LITERAL(QGradientStop, QGradientStop(0, QColor(252, 203, 144, 255)), QGradientStop(1, QColor(213, 126, 235, 255)));
+ case QGradient::DeepBlue:
+ return Q_ARRAY_LITERAL(QGradientStop, QGradientStop(0, QColor(224, 195, 252, 255)), QGradientStop(1, QColor(142, 197, 252, 255)));
+ case QGradient::RipeMalinka:
+ return Q_ARRAY_LITERAL(QGradientStop, QGradientStop(0, QColor(240, 147, 251, 255)), QGradientStop(1, QColor(245, 87, 108, 255)));
+ case QGradient::CloudyKnoxville:
+ return Q_ARRAY_LITERAL(QGradientStop, QGradientStop(0, QColor(253, 251, 251, 255)), QGradientStop(1, QColor(235, 237, 238, 255)));
+ case QGradient::MalibuBeach:
+ return Q_ARRAY_LITERAL(QGradientStop, QGradientStop(0, QColor(79, 172, 254, 255)), QGradientStop(1, QColor(0, 242, 254, 255)));
+ case QGradient::NewLife:
+ return Q_ARRAY_LITERAL(QGradientStop, QGradientStop(0, QColor(67, 233, 123, 255)), QGradientStop(1, QColor(56, 249, 215, 255)));
+ case QGradient::TrueSunset:
+ return Q_ARRAY_LITERAL(QGradientStop, QGradientStop(0, QColor(250, 112, 154, 255)), QGradientStop(1, QColor(254, 225, 64, 255)));
+ case QGradient::MorpheusDen:
+ return Q_ARRAY_LITERAL(QGradientStop, QGradientStop(0, QColor(48, 207, 208, 255)), QGradientStop(1, QColor(51, 8, 103, 255)));
+ case QGradient::RareWind:
+ return Q_ARRAY_LITERAL(QGradientStop, QGradientStop(0, QColor(168, 237, 234, 255)), QGradientStop(1, QColor(254, 214, 227, 255)));
+ case QGradient::NearMoon:
+ return Q_ARRAY_LITERAL(QGradientStop, QGradientStop(0, QColor(94, 231, 223, 255)), QGradientStop(1, QColor(180, 144, 202, 255)));
+ case QGradient::WildApple:
+ return Q_ARRAY_LITERAL(QGradientStop, QGradientStop(0, QColor(210, 153, 194, 255)), QGradientStop(1, QColor(254, 249, 215, 255)));
+ case QGradient::SaintPetersburg:
+ return Q_ARRAY_LITERAL(QGradientStop, QGradientStop(0, QColor(245, 247, 250, 255)), QGradientStop(1, QColor(195, 207, 226, 255)));
+ case QGradient::PlumPlate:
+ return Q_ARRAY_LITERAL(QGradientStop, QGradientStop(0, QColor(102, 126, 234, 255)), QGradientStop(1, QColor(118, 75, 162, 255)));
+ case QGradient::EverlastingSky:
+ return Q_ARRAY_LITERAL(QGradientStop, QGradientStop(0, QColor(253, 252, 251, 255)), QGradientStop(1, QColor(226, 209, 195, 255)));
+ case QGradient::HappyFisher:
+ return Q_ARRAY_LITERAL(QGradientStop, QGradientStop(0, QColor(137, 247, 254, 255)), QGradientStop(1, QColor(102, 166, 255, 255)));
+ case QGradient::Blessing:
+ return Q_ARRAY_LITERAL(QGradientStop, QGradientStop(0, QColor(253, 219, 146, 255)), QGradientStop(1, QColor(209, 253, 255, 255)));
+ case QGradient::SharpeyeEagle:
+ return Q_ARRAY_LITERAL(QGradientStop, QGradientStop(0, QColor(152, 144, 227, 255)), QGradientStop(1, QColor(177, 244, 207, 255)));
+ case QGradient::LadogaBottom:
+ return Q_ARRAY_LITERAL(QGradientStop, QGradientStop(0, QColor(235, 192, 253, 255)), QGradientStop(1, QColor(217, 222, 216, 255)));
+ case QGradient::LemonGate:
+ return Q_ARRAY_LITERAL(QGradientStop, QGradientStop(0, QColor(150, 251, 196, 255)), QGradientStop(1, QColor(249, 245, 134, 255)));
+ case QGradient::ItmeoBranding:
+ return Q_ARRAY_LITERAL(QGradientStop, QGradientStop(0, QColor(42, 245, 152, 255)), QGradientStop(1, QColor(0, 158, 253, 255)));
+ case QGradient::ZeusMiracle:
+ return Q_ARRAY_LITERAL(QGradientStop, QGradientStop(0, QColor(205, 156, 242, 255)), QGradientStop(1, QColor(246, 243, 255, 255)));
+ case QGradient::OldHat:
+ return Q_ARRAY_LITERAL(QGradientStop, QGradientStop(0, QColor(228, 175, 203, 255)), QGradientStop(0, QColor(184, 203, 184, 255)), QGradientStop(0, QColor(184, 203, 184, 255)), QGradientStop(0.3, QColor(226, 197, 139, 255)), QGradientStop(0.64, QColor(194, 206, 156, 255)), QGradientStop(1, QColor(126, 219, 220, 255)));
+ case QGradient::StarWine:
+ return Q_ARRAY_LITERAL(QGradientStop, QGradientStop(0, QColor(184, 203, 184, 255)), QGradientStop(0, QColor(184, 203, 184, 255)), QGradientStop(0, QColor(180, 101, 218, 255)), QGradientStop(0.33, QColor(207, 108, 201, 255)), QGradientStop(0.66, QColor(238, 96, 156, 255)), QGradientStop(1, QColor(238, 96, 156, 255)));
+ case QGradient::HappyAcid:
+ return Q_ARRAY_LITERAL(QGradientStop, QGradientStop(0, QColor(55, 236, 186, 255)), QGradientStop(1, QColor(114, 175, 211, 255)));
+ case QGradient::AwesomePine:
+ return Q_ARRAY_LITERAL(QGradientStop, QGradientStop(0, QColor(235, 187, 167, 255)), QGradientStop(1, QColor(207, 199, 248, 255)));
+ case QGradient::NewYork:
+ return Q_ARRAY_LITERAL(QGradientStop, QGradientStop(0, QColor(255, 241, 235, 255)), QGradientStop(1, QColor(172, 224, 249, 255)));
+ case QGradient::ShyRainbow:
+ return Q_ARRAY_LITERAL(QGradientStop, QGradientStop(0, QColor(238, 162, 162, 255)), QGradientStop(0.19, QColor(187, 193, 191, 255)), QGradientStop(0.42, QColor(87, 198, 225, 255)), QGradientStop(0.79, QColor(180, 159, 218, 255)), QGradientStop(1, QColor(122, 197, 216, 255)));
+ case QGradient::MixedHopes:
+ return Q_ARRAY_LITERAL(QGradientStop, QGradientStop(0, QColor(196, 113, 245, 255)), QGradientStop(1, QColor(250, 113, 205, 255)));
+ case QGradient::FlyHigh:
+ return Q_ARRAY_LITERAL(QGradientStop, QGradientStop(0, QColor(72, 198, 239, 255)), QGradientStop(1, QColor(111, 134, 214, 255)));
+ case QGradient::StrongBliss:
+ return Q_ARRAY_LITERAL(QGradientStop, QGradientStop(0, QColor(247, 140, 160, 255)), QGradientStop(0.19, QColor(249, 116, 143, 255)), QGradientStop(0.6, QColor(253, 134, 140, 255)), QGradientStop(1, QColor(254, 154, 139, 255)));
+ case QGradient::FreshMilk:
+ return Q_ARRAY_LITERAL(QGradientStop, QGradientStop(0, QColor(254, 173, 166, 255)), QGradientStop(1, QColor(245, 239, 239, 255)));
+ case QGradient::SnowAgain:
+ return Q_ARRAY_LITERAL(QGradientStop, QGradientStop(0, QColor(230, 233, 240, 255)), QGradientStop(1, QColor(238, 241, 245, 255)));
+ case QGradient::FebruaryInk:
+ return Q_ARRAY_LITERAL(QGradientStop, QGradientStop(0, QColor(172, 203, 238, 255)), QGradientStop(1, QColor(231, 240, 253, 255)));
+ case QGradient::KindSteel:
+ return Q_ARRAY_LITERAL(QGradientStop, QGradientStop(0, QColor(233, 222, 250, 255)), QGradientStop(1, QColor(251, 252, 219, 255)));
+ case QGradient::SoftGrass:
+ return Q_ARRAY_LITERAL(QGradientStop, QGradientStop(0, QColor(193, 223, 196, 255)), QGradientStop(1, QColor(222, 236, 221, 255)));
+ case QGradient::GrownEarly:
+ return Q_ARRAY_LITERAL(QGradientStop, QGradientStop(0, QColor(11, 163, 96, 255)), QGradientStop(1, QColor(60, 186, 146, 255)));
+ case QGradient::SharpBlues:
+ return Q_ARRAY_LITERAL(QGradientStop, QGradientStop(0, QColor(0, 198, 251, 255)), QGradientStop(1, QColor(0, 91, 234, 255)));
+ case QGradient::ShadyWater:
+ return Q_ARRAY_LITERAL(QGradientStop, QGradientStop(0, QColor(116, 235, 213, 255)), QGradientStop(1, QColor(159, 172, 230, 255)));
+ case QGradient::DirtyBeauty:
+ return Q_ARRAY_LITERAL(QGradientStop, QGradientStop(0, QColor(106, 133, 182, 255)), QGradientStop(1, QColor(186, 200, 224, 255)));
+ case QGradient::GreatWhale:
+ return Q_ARRAY_LITERAL(QGradientStop, QGradientStop(0, QColor(163, 189, 237, 255)), QGradientStop(1, QColor(105, 145, 199, 255)));
+ case QGradient::TeenNotebook:
+ return Q_ARRAY_LITERAL(QGradientStop, QGradientStop(0, QColor(151, 149, 240, 255)), QGradientStop(1, QColor(251, 200, 212, 255)));
+ case QGradient::PoliteRumors:
+ return Q_ARRAY_LITERAL(QGradientStop, QGradientStop(0, QColor(167, 166, 203, 255)), QGradientStop(0.52, QColor(137, 137, 186, 255)), QGradientStop(1, QColor(137, 137, 186, 255)));
+ case QGradient::SweetPeriod:
+ return Q_ARRAY_LITERAL(QGradientStop, QGradientStop(0, QColor(63, 81, 177, 255)), QGradientStop(0.13, QColor(90, 85, 174, 255)), QGradientStop(0.25, QColor(123, 95, 172, 255)), QGradientStop(0.38, QColor(143, 106, 174, 255)), QGradientStop(0.5, QColor(168, 106, 164, 255)), QGradientStop(0.62, QColor(204, 107, 142, 255)), QGradientStop(0.75, QColor(241, 130, 113, 255)), QGradientStop(0.87, QColor(243, 164, 105, 255)), QGradientStop(1, QColor(247, 201, 120, 255)));
+ case QGradient::WideMatrix:
+ return Q_ARRAY_LITERAL(QGradientStop, QGradientStop(0, QColor(252, 197, 228, 255)), QGradientStop(0.15, QColor(253, 163, 75, 255)), QGradientStop(0.35, QColor(255, 120, 130, 255)), QGradientStop(0.52, QColor(200, 105, 158, 255)), QGradientStop(0.71, QColor(112, 70, 170, 255)), QGradientStop(0.87, QColor(12, 29, 184, 255)), QGradientStop(1, QColor(2, 15, 117, 255)));
+ case QGradient::SoftCherish:
+ return Q_ARRAY_LITERAL(QGradientStop, QGradientStop(0, QColor(219, 220, 215, 255)), QGradientStop(0.24, QColor(221, 220, 215, 255)), QGradientStop(0.3, QColor(226, 201, 204, 255)), QGradientStop(0.46, QColor(231, 98, 125, 255)), QGradientStop(0.59, QColor(184, 35, 90, 255)), QGradientStop(0.71, QColor(128, 19, 87, 255)), QGradientStop(0.84, QColor(61, 22, 53, 255)), QGradientStop(1, QColor(28, 26, 39, 255)));
+ case QGradient::RedSalvation:
+ return Q_ARRAY_LITERAL(QGradientStop, QGradientStop(0, QColor(244, 59, 71, 255)), QGradientStop(1, QColor(69, 58, 148, 255)));
+ case QGradient::BurningSpring:
+ return Q_ARRAY_LITERAL(QGradientStop, QGradientStop(0, QColor(79, 181, 118, 255)), QGradientStop(0.3, QColor(68, 196, 137, 255)), QGradientStop(0.46, QColor(40, 169, 174, 255)), QGradientStop(0.59, QColor(40, 162, 183, 255)), QGradientStop(0.71, QColor(76, 119, 136, 255)), QGradientStop(0.86, QColor(108, 79, 99, 255)), QGradientStop(1, QColor(67, 44, 57, 255)));
+ case QGradient::NightParty:
+ return Q_ARRAY_LITERAL(QGradientStop, QGradientStop(0, QColor(2, 80, 197, 255)), QGradientStop(1, QColor(212, 63, 141, 255)));
+ case QGradient::SkyGlider:
+ return Q_ARRAY_LITERAL(QGradientStop, QGradientStop(0, QColor(136, 211, 206, 255)), QGradientStop(1, QColor(110, 69, 226, 255)));
+ case QGradient::HeavenPeach:
+ return Q_ARRAY_LITERAL(QGradientStop, QGradientStop(0, QColor(217, 175, 217, 255)), QGradientStop(1, QColor(151, 217, 225, 255)));
+ case QGradient::PurpleDivision:
+ return Q_ARRAY_LITERAL(QGradientStop, QGradientStop(0, QColor(112, 40, 228, 255)), QGradientStop(1, QColor(229, 178, 202, 255)));
+ case QGradient::AquaSplash:
+ return Q_ARRAY_LITERAL(QGradientStop, QGradientStop(0, QColor(19, 84, 122, 255)), QGradientStop(1, QColor(128, 208, 199, 255)));
+ case QGradient::SpikyNaga:
+ return Q_ARRAY_LITERAL(QGradientStop, QGradientStop(0, QColor(80, 82, 133, 255)), QGradientStop(0.12, QColor(88, 94, 146, 255)), QGradientStop(0.25, QColor(101, 104, 159, 255)), QGradientStop(0.37, QColor(116, 116, 176, 255)), QGradientStop(0.5, QColor(126, 126, 187, 255)), QGradientStop(0.62, QColor(131, 137, 199, 255)), QGradientStop(0.75, QColor(151, 149, 212, 255)), QGradientStop(0.87, QColor(162, 161, 220, 255)), QGradientStop(1, QColor(181, 174, 228, 255)));
+ case QGradient::LoveKiss:
+ return Q_ARRAY_LITERAL(QGradientStop, QGradientStop(0, QColor(255, 8, 68, 255)), QGradientStop(1, QColor(255, 177, 153, 255)));
+ case QGradient::CleanMirror:
+ return Q_ARRAY_LITERAL(QGradientStop, QGradientStop(0, QColor(147, 165, 207, 255)), QGradientStop(1, QColor(228, 239, 233, 255)));
+ case QGradient::PremiumDark:
+ return Q_ARRAY_LITERAL(QGradientStop, QGradientStop(0, QColor(67, 67, 67, 255)), QGradientStop(1, QColor(0, 0, 0, 255)));
+ case QGradient::ColdEvening:
+ return Q_ARRAY_LITERAL(QGradientStop, QGradientStop(0, QColor(12, 52, 131, 255)), QGradientStop(1, QColor(162, 182, 223, 255)), QGradientStop(1, QColor(107, 140, 206, 255)), QGradientStop(1, QColor(162, 182, 223, 255)));
+ case QGradient::CochitiLake:
+ return Q_ARRAY_LITERAL(QGradientStop, QGradientStop(0, QColor(147, 165, 207, 255)), QGradientStop(1, QColor(228, 239, 233, 255)));
+ case QGradient::SummerGames:
+ return Q_ARRAY_LITERAL(QGradientStop, QGradientStop(0, QColor(146, 254, 157, 255)), QGradientStop(1, QColor(0, 201, 255, 255)));
+ case QGradient::PassionateBed:
+ return Q_ARRAY_LITERAL(QGradientStop, QGradientStop(0, QColor(255, 117, 140, 255)), QGradientStop(1, QColor(255, 126, 179, 255)));
+ case QGradient::MountainRock:
+ return Q_ARRAY_LITERAL(QGradientStop, QGradientStop(0, QColor(134, 143, 150, 255)), QGradientStop(1, QColor(89, 97, 100, 255)));
+ case QGradient::DesertHump:
+ return Q_ARRAY_LITERAL(QGradientStop, QGradientStop(0, QColor(199, 144, 129, 255)), QGradientStop(1, QColor(223, 165, 121, 255)));
+ case QGradient::JungleDay:
+ return Q_ARRAY_LITERAL(QGradientStop, QGradientStop(0, QColor(139, 170, 170, 255)), QGradientStop(1, QColor(174, 139, 156, 255)));
+ case QGradient::PhoenixStart:
+ return Q_ARRAY_LITERAL(QGradientStop, QGradientStop(0, QColor(248, 54, 0, 255)), QGradientStop(1, QColor(249, 212, 35, 255)));
+ case QGradient::OctoberSilence:
+ return Q_ARRAY_LITERAL(QGradientStop, QGradientStop(0, QColor(183, 33, 255, 255)), QGradientStop(1, QColor(33, 212, 253, 255)));
+ case QGradient::FarawayRiver:
+ return Q_ARRAY_LITERAL(QGradientStop, QGradientStop(0, QColor(110, 69, 226, 255)), QGradientStop(1, QColor(136, 211, 206, 255)));
+ case QGradient::AlchemistLab:
+ return Q_ARRAY_LITERAL(QGradientStop, QGradientStop(0, QColor(213, 88, 200, 255)), QGradientStop(1, QColor(36, 210, 146, 255)));
+ case QGradient::OverSun:
+ return Q_ARRAY_LITERAL(QGradientStop, QGradientStop(0, QColor(171, 236, 214, 255)), QGradientStop(1, QColor(251, 237, 150, 255)));
+ case QGradient::PremiumWhite:
+ return Q_ARRAY_LITERAL(QGradientStop, QGradientStop(0, QColor(213, 212, 208, 255)), QGradientStop(0.01, QColor(213, 212, 208, 255)), QGradientStop(0.31, QColor(238, 238, 236, 255)), QGradientStop(0.75, QColor(239, 238, 236, 255)), QGradientStop(1, QColor(233, 233, 231, 255)));
+ case QGradient::MarsParty:
+ return Q_ARRAY_LITERAL(QGradientStop, QGradientStop(0, QColor(95, 114, 189, 255)), QGradientStop(1, QColor(155, 35, 234, 255)));
+ case QGradient::EternalConstance:
+ return Q_ARRAY_LITERAL(QGradientStop, QGradientStop(0, QColor(9, 32, 63, 255)), QGradientStop(1, QColor(83, 120, 149, 255)));
+ case QGradient::JapanBlush:
+ return Q_ARRAY_LITERAL(QGradientStop, QGradientStop(0, QColor(221, 214, 243, 255)), QGradientStop(1, QColor(250, 172, 168, 255)), QGradientStop(1, QColor(250, 172, 168, 255)));
+ case QGradient::SmilingRain:
+ return Q_ARRAY_LITERAL(QGradientStop, QGradientStop(0, QColor(220, 176, 237, 255)), QGradientStop(1, QColor(153, 201, 156, 255)));
+ case QGradient::CloudyApple:
+ return Q_ARRAY_LITERAL(QGradientStop, QGradientStop(0, QColor(243, 231, 233, 255)), QGradientStop(0.99, QColor(227, 238, 255, 255)), QGradientStop(1, QColor(227, 238, 255, 255)));
+ case QGradient::BigMango:
+ return Q_ARRAY_LITERAL(QGradientStop, QGradientStop(0, QColor(199, 29, 111, 255)), QGradientStop(1, QColor(208, 150, 147, 255)));
+ case QGradient::HealthyWater:
+ return Q_ARRAY_LITERAL(QGradientStop, QGradientStop(0, QColor(150, 222, 218, 255)), QGradientStop(1, QColor(80, 201, 195, 255)));
+ case QGradient::AmourAmour:
+ return Q_ARRAY_LITERAL(QGradientStop, QGradientStop(0, QColor(247, 112, 98, 255)), QGradientStop(1, QColor(254, 81, 150, 255)));
+ case QGradient::RiskyConcrete:
+ return Q_ARRAY_LITERAL(QGradientStop, QGradientStop(0, QColor(196, 197, 199, 255)), QGradientStop(0.52, QColor(220, 221, 223, 255)), QGradientStop(1, QColor(235, 235, 235, 255)));
+ case QGradient::StrongStick:
+ return Q_ARRAY_LITERAL(QGradientStop, QGradientStop(0, QColor(168, 202, 186, 255)), QGradientStop(1, QColor(93, 65, 87, 255)));
+ case QGradient::ViciousStance:
+ return Q_ARRAY_LITERAL(QGradientStop, QGradientStop(0, QColor(41, 50, 60, 255)), QGradientStop(1, QColor(72, 85, 99, 255)));
+ case QGradient::PaloAlto:
+ return Q_ARRAY_LITERAL(QGradientStop, QGradientStop(0, QColor(22, 160, 133, 255)), QGradientStop(1, QColor(244, 208, 63, 255)));
+ case QGradient::HappyMemories:
+ return Q_ARRAY_LITERAL(QGradientStop, QGradientStop(0, QColor(255, 88, 88, 255)), QGradientStop(1, QColor(240, 152, 25, 255)));
+ case QGradient::MidnightBloom:
+ return Q_ARRAY_LITERAL(QGradientStop, QGradientStop(0, QColor(43, 88, 118, 255)), QGradientStop(1, QColor(78, 67, 118, 255)));
+ case QGradient::Crystalline:
+ return Q_ARRAY_LITERAL(QGradientStop, QGradientStop(0, QColor(0, 205, 172, 255)), QGradientStop(1, QColor(141, 218, 213, 255)));
+ case QGradient::PartyBliss:
+ return Q_ARRAY_LITERAL(QGradientStop, QGradientStop(0, QColor(68, 129, 235, 255)), QGradientStop(1, QColor(4, 190, 254, 255)));
+ case QGradient::ConfidentCloud:
+ return Q_ARRAY_LITERAL(QGradientStop, QGradientStop(0, QColor(218, 212, 236, 255)), QGradientStop(0.01, QColor(218, 212, 236, 255)), QGradientStop(1, QColor(243, 231, 233, 255)));
+ case QGradient::LeCocktail:
+ return Q_ARRAY_LITERAL(QGradientStop, QGradientStop(0, QColor(135, 77, 162, 255)), QGradientStop(1, QColor(196, 58, 48, 255)));
+ case QGradient::RiverCity:
+ return Q_ARRAY_LITERAL(QGradientStop, QGradientStop(0, QColor(68, 129, 235, 255)), QGradientStop(1, QColor(4, 190, 254, 255)));
+ case QGradient::FrozenBerry:
+ return Q_ARRAY_LITERAL(QGradientStop, QGradientStop(0, QColor(232, 25, 139, 255)), QGradientStop(1, QColor(199, 234, 253, 255)));
+ case QGradient::ChildCare:
+ return Q_ARRAY_LITERAL(QGradientStop, QGradientStop(0, QColor(247, 148, 164, 255)), QGradientStop(1, QColor(253, 214, 189, 255)));
+ case QGradient::FlyingLemon:
+ return Q_ARRAY_LITERAL(QGradientStop, QGradientStop(0, QColor(100, 179, 244, 255)), QGradientStop(1, QColor(194, 229, 156, 255)));
+ case QGradient::NewRetrowave:
+ return Q_ARRAY_LITERAL(QGradientStop, QGradientStop(0, QColor(59, 65, 197, 255)), QGradientStop(0.49, QColor(169, 129, 187, 255)), QGradientStop(1, QColor(255, 200, 169, 255)));
+ case QGradient::HiddenJaguar:
+ return Q_ARRAY_LITERAL(QGradientStop, QGradientStop(0, QColor(15, 216, 80, 255)), QGradientStop(1, QColor(249, 240, 71, 255)));
+ case QGradient::AboveTheSky:
+ return Q_ARRAY_LITERAL(QGradientStop, QGradientStop(0, QColor(211, 211, 211, 255)), QGradientStop(0.01, QColor(211, 211, 211, 255)), QGradientStop(0.26, QColor(224, 224, 224, 255)), QGradientStop(0.48, QColor(239, 239, 239, 255)), QGradientStop(0.75, QColor(217, 217, 217, 255)), QGradientStop(1, QColor(188, 188, 188, 255)));
+ case QGradient::Nega:
+ return Q_ARRAY_LITERAL(QGradientStop, QGradientStop(0, QColor(238, 156, 167, 255)), QGradientStop(1, QColor(255, 221, 225, 255)));
+ case QGradient::DenseWater:
+ return Q_ARRAY_LITERAL(QGradientStop, QGradientStop(0, QColor(58, 181, 176, 255)), QGradientStop(0.31, QColor(61, 153, 190, 255)), QGradientStop(1, QColor(86, 49, 122, 255)));
+ case QGradient::Seashore:
+ return Q_ARRAY_LITERAL(QGradientStop, QGradientStop(0, QColor(32, 156, 255, 255)), QGradientStop(1, QColor(104, 224, 207, 255)));
+ case QGradient::MarbleWall:
+ return Q_ARRAY_LITERAL(QGradientStop, QGradientStop(0, QColor(189, 194, 232, 255)), QGradientStop(0.01, QColor(189, 194, 232, 255)), QGradientStop(1, QColor(230, 222, 233, 255)));
+ case QGradient::CheerfulCaramel:
+ return Q_ARRAY_LITERAL(QGradientStop, QGradientStop(0, QColor(230, 185, 128, 255)), QGradientStop(1, QColor(234, 205, 163, 255)));
+ case QGradient::NightSky:
+ return Q_ARRAY_LITERAL(QGradientStop, QGradientStop(0, QColor(30, 60, 114, 255)), QGradientStop(0.01, QColor(30, 60, 114, 255)), QGradientStop(1, QColor(42, 82, 152, 255)));
+ case QGradient::MagicLake:
+ return Q_ARRAY_LITERAL(QGradientStop, QGradientStop(0, QColor(213, 222, 231, 255)), QGradientStop(0, QColor(255, 175, 189, 255)), QGradientStop(1, QColor(201, 255, 191, 255)));
+ case QGradient::YoungGrass:
+ return Q_ARRAY_LITERAL(QGradientStop, QGradientStop(0, QColor(155, 225, 93, 255)), QGradientStop(1, QColor(0, 227, 174, 255)));
+ case QGradient::ColorfulPeach:
+ return Q_ARRAY_LITERAL(QGradientStop, QGradientStop(0, QColor(237, 110, 160, 255)), QGradientStop(1, QColor(236, 140, 105, 255)));
+ case QGradient::GentleCare:
+ return Q_ARRAY_LITERAL(QGradientStop, QGradientStop(0, QColor(255, 195, 160, 255)), QGradientStop(1, QColor(255, 175, 189, 255)));
+ case QGradient::PlumBath:
+ return Q_ARRAY_LITERAL(QGradientStop, QGradientStop(0, QColor(204, 32, 142, 255)), QGradientStop(1, QColor(103, 19, 210, 255)));
+ case QGradient::HappyUnicorn:
+ return Q_ARRAY_LITERAL(QGradientStop, QGradientStop(0, QColor(179, 255, 171, 255)), QGradientStop(1, QColor(18, 255, 247, 255)));
+ case QGradient::AfricanField:
+ return Q_ARRAY_LITERAL(QGradientStop, QGradientStop(0, QColor(101, 189, 96, 255)), QGradientStop(0.25, QColor(90, 193, 168, 255)), QGradientStop(0.5, QColor(62, 198, 237, 255)), QGradientStop(0.75, QColor(183, 221, 183, 255)), QGradientStop(1, QColor(254, 243, 129, 255)));
+ case QGradient::SolidStone:
+ return Q_ARRAY_LITERAL(QGradientStop, QGradientStop(0, QColor(36, 57, 73, 255)), QGradientStop(1, QColor(81, 127, 164, 255)));
+ case QGradient::OrangeJuice:
+ return Q_ARRAY_LITERAL(QGradientStop, QGradientStop(0, QColor(252, 96, 118, 255)), QGradientStop(1, QColor(255, 154, 68, 255)));
+ case QGradient::GlassWater:
+ return Q_ARRAY_LITERAL(QGradientStop, QGradientStop(0, QColor(223, 233, 243, 255)), QGradientStop(1, QColor(255, 255, 255, 255)));
+ case QGradient::NorthMiracle:
+ return Q_ARRAY_LITERAL(QGradientStop, QGradientStop(0, QColor(0, 219, 222, 255)), QGradientStop(1, QColor(252, 0, 255, 255)));
+ case QGradient::FruitBlend:
+ return Q_ARRAY_LITERAL(QGradientStop, QGradientStop(0, QColor(249, 212, 35, 255)), QGradientStop(1, QColor(255, 78, 80, 255)));
+ case QGradient::MillenniumPine:
+ return Q_ARRAY_LITERAL(QGradientStop, QGradientStop(0, QColor(80, 204, 127, 255)), QGradientStop(1, QColor(245, 209, 0, 255)));
+ case QGradient::HighFlight:
+ return Q_ARRAY_LITERAL(QGradientStop, QGradientStop(0, QColor(10, 207, 254, 255)), QGradientStop(1, QColor(73, 90, 255, 255)));
+ case QGradient::MoleHall:
+ return Q_ARRAY_LITERAL(QGradientStop, QGradientStop(0, QColor(97, 97, 97, 255)), QGradientStop(1, QColor(155, 197, 195, 255)));
+ case QGradient::SpaceShift:
+ return Q_ARRAY_LITERAL(QGradientStop, QGradientStop(0, QColor(61, 51, 147, 255)), QGradientStop(0.37, QColor(43, 118, 185, 255)), QGradientStop(0.65, QColor(44, 172, 209, 255)), QGradientStop(1, QColor(53, 235, 147, 255)));
+ case QGradient::ForestInei:
+ return Q_ARRAY_LITERAL(QGradientStop, QGradientStop(0, QColor(223, 137, 181, 255)), QGradientStop(1, QColor(191, 217, 254, 255)));
+ case QGradient::RoyalGarden:
+ return Q_ARRAY_LITERAL(QGradientStop, QGradientStop(0, QColor(237, 110, 160, 255)), QGradientStop(1, QColor(236, 140, 105, 255)));
+ case QGradient::RichMetal:
+ return Q_ARRAY_LITERAL(QGradientStop, QGradientStop(0, QColor(215, 210, 204, 255)), QGradientStop(1, QColor(48, 67, 82, 255)));
+ case QGradient::JuicyCake:
+ return Q_ARRAY_LITERAL(QGradientStop, QGradientStop(0, QColor(225, 79, 173, 255)), QGradientStop(1, QColor(249, 212, 35, 255)));
+ case QGradient::SmartIndigo:
+ return Q_ARRAY_LITERAL(QGradientStop, QGradientStop(0, QColor(178, 36, 239, 255)), QGradientStop(1, QColor(117, 121, 255, 255)));
+ case QGradient::SandStrike:
+ return Q_ARRAY_LITERAL(QGradientStop, QGradientStop(0, QColor(193, 193, 97, 255)), QGradientStop(0, QColor(193, 193, 97, 255)), QGradientStop(1, QColor(212, 212, 177, 255)));
+ case QGradient::NorseBeauty:
+ return Q_ARRAY_LITERAL(QGradientStop, QGradientStop(0, QColor(236, 119, 171, 255)), QGradientStop(1, QColor(120, 115, 245, 255)));
+ case QGradient::AquaGuidance:
+ return Q_ARRAY_LITERAL(QGradientStop, QGradientStop(0, QColor(0, 122, 223, 255)), QGradientStop(1, QColor(0, 236, 188, 255)));
+ case QGradient::SunVeggie:
+ return Q_ARRAY_LITERAL(QGradientStop, QGradientStop(0, QColor(32, 226, 215, 255)), QGradientStop(1, QColor(249, 254, 165, 255)));
+ case QGradient::SeaLord:
+ return Q_ARRAY_LITERAL(QGradientStop, QGradientStop(0, QColor(44, 216, 213, 255)), QGradientStop(0.56, QColor(197, 193, 255, 255)), QGradientStop(1, QColor(255, 186, 195, 255)));
+ case QGradient::BlackSea:
+ return Q_ARRAY_LITERAL(QGradientStop, QGradientStop(0, QColor(44, 216, 213, 255)), QGradientStop(0.48, QColor(107, 141, 214, 255)), QGradientStop(1, QColor(142, 55, 215, 255)));
+ case QGradient::GrassShampoo:
+ return Q_ARRAY_LITERAL(QGradientStop, QGradientStop(0, QColor(223, 255, 205, 255)), QGradientStop(0.48, QColor(144, 249, 196, 255)), QGradientStop(1, QColor(57, 243, 187, 255)));
+ case QGradient::LandingAircraft:
+ return Q_ARRAY_LITERAL(QGradientStop, QGradientStop(0, QColor(93, 159, 255, 255)), QGradientStop(0.48, QColor(184, 220, 255, 255)), QGradientStop(1, QColor(107, 187, 255, 255)));
+ case QGradient::WitchDance:
+ return Q_ARRAY_LITERAL(QGradientStop, QGradientStop(0, QColor(168, 191, 255, 255)), QGradientStop(1, QColor(136, 77, 128, 255)));
+ case QGradient::SleeplessNight:
+ return Q_ARRAY_LITERAL(QGradientStop, QGradientStop(0, QColor(82, 113, 196, 255)), QGradientStop(0.48, QColor(177, 159, 255, 255)), QGradientStop(1, QColor(236, 161, 254, 255)));
+ case QGradient::AngelCare:
+ return Q_ARRAY_LITERAL(QGradientStop, QGradientStop(0, QColor(255, 226, 159, 255)), QGradientStop(0.48, QColor(255, 169, 159, 255)), QGradientStop(1, QColor(255, 113, 154, 255)));
+ case QGradient::CrystalRiver:
+ return Q_ARRAY_LITERAL(QGradientStop, QGradientStop(0, QColor(34, 225, 255, 255)), QGradientStop(0.48, QColor(29, 143, 225, 255)), QGradientStop(1, QColor(98, 94, 177, 255)));
+ case QGradient::SoftLipstick:
+ return Q_ARRAY_LITERAL(QGradientStop, QGradientStop(0, QColor(182, 206, 232, 255)), QGradientStop(1, QColor(245, 120, 220, 255)));
+ case QGradient::SaltMountain:
+ return Q_ARRAY_LITERAL(QGradientStop, QGradientStop(0, QColor(255, 254, 255, 255)), QGradientStop(1, QColor(215, 255, 254, 255)));
+ case QGradient::PerfectWhite:
+ return Q_ARRAY_LITERAL(QGradientStop, QGradientStop(0, QColor(227, 253, 245, 255)), QGradientStop(1, QColor(255, 230, 250, 255)));
+ case QGradient::FreshOasis:
+ return Q_ARRAY_LITERAL(QGradientStop, QGradientStop(0, QColor(125, 226, 252, 255)), QGradientStop(1, QColor(185, 182, 229, 255)));
+ case QGradient::StrictNovember:
+ return Q_ARRAY_LITERAL(QGradientStop, QGradientStop(0, QColor(203, 186, 204, 255)), QGradientStop(1, QColor(37, 128, 179, 255)));
+ case QGradient::MorningSalad:
+ return Q_ARRAY_LITERAL(QGradientStop, QGradientStop(0, QColor(183, 248, 219, 255)), QGradientStop(1, QColor(80, 167, 194, 255)));
+ case QGradient::DeepRelief:
+ return Q_ARRAY_LITERAL(QGradientStop, QGradientStop(0, QColor(112, 133, 182, 255)), QGradientStop(0.5, QColor(135, 167, 217, 255)), QGradientStop(1, QColor(222, 243, 248, 255)));
+ case QGradient::SeaStrike:
+ return Q_ARRAY_LITERAL(QGradientStop, QGradientStop(0, QColor(119, 255, 210, 255)), QGradientStop(0.48, QColor(98, 151, 219, 255)), QGradientStop(1, QColor(30, 236, 255, 255)));
+ case QGradient::NightCall:
+ return Q_ARRAY_LITERAL(QGradientStop, QGradientStop(0, QColor(172, 50, 228, 255)), QGradientStop(0.48, QColor(121, 24, 242, 255)), QGradientStop(1, QColor(72, 1, 255, 255)));
+ case QGradient::SupremeSky:
+ return Q_ARRAY_LITERAL(QGradientStop, QGradientStop(0, QColor(212, 255, 236, 255)), QGradientStop(0.48, QColor(87, 242, 204, 255)), QGradientStop(1, QColor(69, 150, 251, 255)));
+ case QGradient::LightBlue:
+ return Q_ARRAY_LITERAL(QGradientStop, QGradientStop(0, QColor(158, 251, 211, 255)), QGradientStop(0.48, QColor(87, 233, 242, 255)), QGradientStop(1, QColor(69, 212, 251, 255)));
+ case QGradient::MindCrawl:
+ return Q_ARRAY_LITERAL(QGradientStop, QGradientStop(0, QColor(71, 59, 123, 255)), QGradientStop(0.51, QColor(53, 132, 167, 255)), QGradientStop(1, QColor(48, 210, 190, 255)));
+ case QGradient::LilyMeadow:
+ return Q_ARRAY_LITERAL(QGradientStop, QGradientStop(0, QColor(101, 55, 155, 255)), QGradientStop(0.53, QColor(136, 106, 234, 255)), QGradientStop(1, QColor(100, 87, 198, 255)));
+ case QGradient::SugarLollipop:
+ return Q_ARRAY_LITERAL(QGradientStop, QGradientStop(0, QColor(164, 69, 178, 255)), QGradientStop(0.52, QColor(212, 24, 114, 255)), QGradientStop(1, QColor(255, 0, 102, 255)));
+ case QGradient::SweetDessert:
+ return Q_ARRAY_LITERAL(QGradientStop, QGradientStop(0, QColor(119, 66, 178, 255)), QGradientStop(0.52, QColor(241, 128, 255, 255)), QGradientStop(1, QColor(253, 139, 217, 255)));
+ case QGradient::MagicRay:
+ return Q_ARRAY_LITERAL(QGradientStop, QGradientStop(0, QColor(255, 60, 172, 255)), QGradientStop(0.52, QColor(86, 43, 124, 255)), QGradientStop(1, QColor(43, 134, 197, 255)));
+ case QGradient::TeenParty:
+ return Q_ARRAY_LITERAL(QGradientStop, QGradientStop(0, QColor(255, 5, 124, 255)), QGradientStop(0.5, QColor(141, 11, 147, 255)), QGradientStop(1, QColor(50, 21, 117, 255)));
+ case QGradient::FrozenHeat:
+ return Q_ARRAY_LITERAL(QGradientStop, QGradientStop(0, QColor(255, 5, 124, 255)), QGradientStop(0.48, QColor(124, 100, 213, 255)), QGradientStop(1, QColor(76, 195, 255, 255)));
+ case QGradient::GagarinView:
+ return Q_ARRAY_LITERAL(QGradientStop, QGradientStop(0, QColor(105, 234, 203, 255)), QGradientStop(0.48, QColor(234, 204, 248, 255)), QGradientStop(1, QColor(102, 84, 241, 255)));
+ case QGradient::FabledSunset:
+ return Q_ARRAY_LITERAL(QGradientStop, QGradientStop(0, QColor(35, 21, 87, 255)), QGradientStop(0.29, QColor(68, 16, 122, 255)), QGradientStop(0.67, QColor(255, 19, 97, 255)), QGradientStop(1, QColor(255, 248, 0, 255)));
+ case QGradient::PerfectBlue:
+ return Q_ARRAY_LITERAL(QGradientStop, QGradientStop(0, QColor(61, 78, 129, 255)), QGradientStop(0.48, QColor(87, 83, 201, 255)), QGradientStop(1, QColor(110, 127, 243, 255)));
+ case QGradient::NumPresets:
+ Q_UNREACHABLE();
+ }
+ Q_UNREACHABLE_RETURN({});
+}
+
+static constexpr QGradient::QGradientData qt_preset_gradient_data[] = {
+ { { 0, 1, 1, 0 } },
+ { { 0.5, 1, 0.5, 0 } },
+ { { 0.5, 1, 0.5, 0 } },
+ { { 0, 0.5, 1, 0.5 } },
+ { { 0, 0.5, 1, 0.5 } },
+ { { 0.5, 1, 0.5, 0 } },
+ { { -0.0915064, 0.158494, 1.09151, 0.841506 } },
+ { { 0.5, 1, 0.5, 0 } },
+ { { 0.5, 1, 0.5, 0 } },
+ { { -0.0915064, 0.158494, 1.09151, 0.841506 } },
+ { { -0.0915064, 0.158494, 1.09151, 0.841506 } },
+ { { -0.0915064, 0.158494, 1.09151, 0.841506 } },
+ { { 0.5, 1, 0.5, 0 } },
+ { { -0.0915064, 0.158494, 1.09151, 0.841506 } },
+ { { -0.0915064, 0.158494, 1.09151, 0.841506 } },
+ { { -0.0915064, 0.158494, 1.09151, 0.841506 } },
+ { { -0.0915064, 0.158494, 1.09151, 0.841506 } },
+ { { -0.0915064, 0.158494, 1.09151, 0.841506 } },
+ { { 0, 0.5, 1, 0.5 } },
+ { { 0, 0.5, 1, 0.5 } },
+ { { 0, 0.5, 1, 0.5 } },
+ { { 0.5, 1, 0.5, 0 } },
+ { { 0.5, 1, 0.5, 0 } },
+ { { 0.5, 1, 0.5, 0 } },
+ { { 0.5, 1, 0.5, 0 } },
+ { { 0, 0, 1, 1 } },
+ { { 0, 0, 0, 0 } },
+ { { 0, 0, 1, 1 } },
+ { { 0, 0, 1, 1 } },
+ { { -0.0915064, 0.158494, 1.09151, 0.841506 } },
+ { { 0.5, 1, 0.5, 0 } },
+ { { 0.5, 1, 0.5, 0 } },
+ { { 0.5, 1, 0.5, 0 } },
+ { { 0.5, 1, 0.5, 0 } },
+ { { 0.5, 0, 0.5, 1 } },
+ { { 0.5, 1, 0.5, 0 } },
+ { { 0, 0.5, 1, 0.5 } },
+ { { 0, 0.5, 1, 0.5 } },
+ { { 0, 0, 0, 0 } },
+ { { 0, 0, 0, 0 } },
+ { { 0.5, 1, 0.5, 0 } },
+ { { 0.5, 1, 0.5, 0 } },
+ { { 0.5, 1, 0.5, 0 } },
+ { { 0, 0.5, 1, 0.5 } },
+ { { 0, 0, 0, 0 } },
+ { { 0.5, 1, 0.5, 0 } },
+ { { 0.5, 1, 0.5, 0 } },
+ { { 0, 0.5, 1, 0.5 } },
+ { { 0.5, 1, 0.5, 0 } },
+ { { 0.5, 1, 0.5, 0 } },
+ { { 0.5, 1, 0.5, 0 } },
+ { { 0.719186, 1.10221, 0.280814, -0.102208 } },
+ { { 0.5, 1, 0.5, 0 } },
+ { { 0.5, 1, 0.5, 0 } },
+ { { 0.5, 1, 0.5, 0 } },
+ { { 0, 0.5, 1, 0.5 } },
+ { { 0.5, 1, 0.5, 0 } },
+ { { 0.5, 1, 0.5, 0 } },
+ { { 0.5, 1, 0.5, 0 } },
+ { { 0.5, 1, 0.5, 0 } },
+ { { 0.5, 1, 0.5, 0 } },
+ { { 0.5, 1, 0.5, 0 } },
+ { { 0.5, 1, 0.5, 0 } },
+ { { 0.5, 1, 0.5, 0 } },
+ { { 0.5, 1, 0.5, 0 } },
+ { { 0.5, 1, 0.5, 0 } },
+ { { 0.5, 1, 0.5, 0 } },
+ { { 0.5, 1, 0.5, 0 } },
+ { { 0.5, 1, 0.5, 0 } },
+ { { 0.341506, 1.09151, 0.658494, -0.0915064 } },
+ { { 0, 0, 0, 0 } },
+ { { 0.5, 1, 0.5, 0 } },
+ { { 0.5, 1, 0.5, 0 } },
+ { { 0, 0, 0, 0 } },
+ { { 0, 1, 1, 0 } },
+ { { 0, 0.5, 1, 0.5 } },
+ { { 0.5, 1, 0.5, 0 } },
+ { { 0, 1, 1, 0 } },
+ { { 0, 0.5, 1, 0.5 } },
+ { { 0, 0.5, 1, 0.5 } },
+ { { 0, 0.5, 1, 0.5 } },
+ { { 0.5, 1, 0.5, 0 } },
+ { { 0, 1, 1, 0 } },
+ { { 0, 0.5, 1, 0.5 } },
+ { { 0.719186, 1.10221, 0.280814, -0.102208 } },
+ { { 0.719186, 1.10221, 0.280814, -0.102208 } },
+ { { 0.719186, 1.10221, 0.280814, -0.102208 } },
+ { { -0.0915064, 0.841506, 1.09151, 0.158494 } },
+ { { 0.5, 1, 0.5, 0 } },
+ { { 0.5, 1, 0.5, 0 } },
+ { { 0.5, 1, 0.5, 0 } },
+ { { 0.719186, 1.10221, 0.280814, -0.102208 } },
+ { { 0.719186, 1.10221, 0.280814, -0.102208 } },
+ { { 0.5, 1, 0.5, 0 } },
+ { { 0.5, 1, 0.5, 0 } },
+ { { -0.0915064, 0.841506, 1.09151, 0.158494 } },
+ { { 0.5, 1, 0.5, 0 } },
+ { { 0.5, 1, 0.5, 0 } },
+ { { 0, 0.5, 1, 0.5 } },
+ { { -0.0915064, 0.841506, 1.09151, 0.158494 } },
+ { { 1.09151, 0.841506, -0.0915064, 0.158494 } },
+ { { 1.09151, 0.841506, -0.0915064, 0.158494 } },
+ { { 0.719186, 1.10221, 0.280814, -0.102208 } },
+ { { 0.719186, 1.10221, 0.280814, -0.102208 } },
+ { { 0, 0, 0, 0 } },
+ { { 0.5, 1, 0.5, 0 } },
+ { { 0.5, 1, 0.5, 0 } },
+ { { 0, 1, 1, 0 } },
+ { { 0.5, 1, 0.5, 0 } },
+ { { 0.5, 1, 0.5, 0 } },
+ { { 0, 0, 0, 0 } },
+ { { 0.719186, 1.10221, 0.280814, -0.102208 } },
+ { { -0.0915064, 0.841506, 1.09151, 0.158494 } },
+ { { 0.5, 1, 0.5, 0 } },
+ { { 0.5, 1, 0.5, 0 } },
+ { { 0.5, 1, 0.5, 0 } },
+ { { 0, 1, 1, 0 } },
+ { { 0, 0.5, 1, 0.5 } },
+ { { 0, 0, 0, 0 } },
+ { { 0.5, 1, 0.5, 0 } },
+ { { 0.5, 1, 0.5, 0 } },
+ { { 0.5, 1, 0.5, 0 } },
+ { { 0.5, 1, 0.5, 0 } },
+ { { 0.5, 1, 0.5, 0 } },
+ { { 0.5, 1, 0.5, 0 } },
+ { { 0, 0.5, 1, 0.5 } },
+ { { 0, 0.5, 1, 0.5 } },
+ { { 0.5, 1, 0.5, 0 } },
+ { { 0.5, 1, 0.5, 0 } },
+ { { 0, 0, 0, 0 } },
+ { { 0.5, 1, 0.5, 0 } },
+ { { 0, 0.5, 1, 0.5 } },
+ { { 0.719186, 1.10221, 0.280814, -0.102208 } },
+ { { 0.5, 1, 0.5, 0 } },
+ { { 0, 0, 0, 0 } },
+ { { 0, 0.5, 1, 0.5 } },
+ { { 0, 0.5, 1, 0.5 } },
+ { { 0.5, 1, 0.5, 0 } },
+ { { 0, 0.5, 1, 0.5 } },
+ { { 0.719186, 1.10221, 0.280814, -0.102208 } },
+ { { 0, 0, 0, 0 } },
+ { { -0.0915064, 0.841506, 1.09151, 0.158494 } },
+ { { 0.5, 1, 0.5, 0 } },
+ { { 0, 0.5, 1, 0.5 } },
+ { { 0, 0.5, 1, 0.5 } },
+ { { 0.5, 1, 0.5, 0 } },
+ { { 0.5, 1, 0.5, 0 } },
+ { { 0, 0.5, 1, 0.5 } },
+ { { 0, 0.5, 1, 0.5 } },
+ { { 0.5, 1, 0.5, 0 } },
+ { { 0, 0, 1, 1 } },
+ { { 0, 0, 1, 1 } },
+ { { 0, 0, 1, 1 } },
+ { { 0, 0, 1, 1 } },
+ { { 0, 0, 1, 1 } },
+ { { 0, 0, 1, 1 } },
+ { { 0, 0, 1, 1 } },
+ { { 0, 0, 1, 1 } },
+ { { 0, 0, 1, 1 } },
+ { { 0, 0, 1, 1 } },
+ { { 0, 0, 1, 1 } },
+ { { 0, 0, 1, 1 } },
+ { { 0, 0, 1, 1 } },
+ { { 0, 0, 1, 1 } },
+ { { 0, 0, 1, 1 } },
+ { { 0, 0, 1, 1 } },
+ { { 0, 0, 1, 1 } },
+ { { 0, 0, 1, 1 } },
+ { { 0, 0, 1, 1 } },
+ { { 0, 0, 1, 1 } },
+ { { 0, 0, 1, 1 } },
+ { { 0, 0, 1, 1 } },
+ { { 0, 0, 1, 1 } },
+ { { 0, 0, 1, 1 } },
+ { { 0, 0, 1, 1 } },
+ { { 0, 0, 1, 1 } },
+ { { 0, 0, 1, 1 } },
+ { { 0, 0, 1, 1 } },
+ { { 0, 0, 1, 1 } },
+ { { 0, 0, 1, 1 } },
+};
diff --git a/src/gui/painting/webgradients.css b/src/gui/painting/webgradients.css
deleted file mode 100644
index 870866bb46..0000000000
--- a/src/gui/painting/webgradients.css
+++ /dev/null
@@ -1,909 +0,0 @@
-/*001 Warm Flame*/
-.warm_flame{
- background-image: linear-gradient(45deg, #ff9a9e 0%, #fad0c4 99%, #fad0c4 100%);
-}
-
-/*002 Night Fade*/
-.night_fade{
- background-image: linear-gradient(to top, #a18cd1 0%, #fbc2eb 100%);
-}
-
-/*003 Spring Warmth*/
-.spring_warmth{
- background-image: linear-gradient(to top, #fad0c4 0%, #fad0c4 1%, #ffd1ff 100%);
-}
-
-/*004 Juicy Peach*/
-.juicy_peach{
- background-image: linear-gradient(to right, #ffecd2 0%, #fcb69f 100%);
-}
-
-/*005 Young Passion*/
-.young_passion{
- background-image: linear-gradient(to right, #ff8177 0%, #ff867a 0%, #ff8c7f 21%, #f99185 52%, #cf556c 78%, #b12a5b 100%);
-}
-
-/*006 Lady Lips*/
-.lady_lips{
- background-image: linear-gradient(to top, #ff9a9e 0%, #fecfef 99%, #fecfef 100%);
-}
-
-/*007 Sunny Morning*/
-.sunny_morning{
- background-image: linear-gradient(120deg, #f6d365 0%, #fda085 100%);
-}
-
-/*008 Rainy Ashville*/
-.rainy_ashville{
- background-image: linear-gradient(to top, #fbc2eb 0%, #a6c1ee 100%);
-}
-
-/*009 Frozen Dreams*/
-.frozen_dreams{
- background-image: linear-gradient(to top, #fdcbf1 0%, #fdcbf1 1%, #e6dee9 100%);
-}
-
-/*010 Winter Neva*/
-.winter_neva{
- background-image: linear-gradient(120deg, #a1c4fd 0%, #c2e9fb 100%);
-}
-
-/*011 Dusty Grass*/
-.dusty_grass{
- background-image: linear-gradient(120deg, #d4fc79 0%, #96e6a1 100%);
-}
-
-/*012 Tempting Azure*/
-.tempting_azure{
- background-image: linear-gradient(120deg, #84fab0 0%, #8fd3f4 100%);
-}
-
-/*013 Heavy Rain*/
-.heavy_rain{
- background-image: linear-gradient(to top, #cfd9df 0%, #e2ebf0 100%);
-}
-
-/*014 Amy Crisp*/
-.amy_crisp{
- background-image: linear-gradient(120deg, #a6c0fe 0%, #f68084 100%);
-}
-
-/*015 Mean Fruit*/
-.mean_fruit{
- background-image: linear-gradient(120deg, #fccb90 0%, #d57eeb 100%);
-}
-
-/*016 Deep Blue*/
-.deep_blue{
- background-image: linear-gradient(120deg, #e0c3fc 0%, #8ec5fc 100%);
-}
-
-/*017 Ripe Malinka*/
-.ripe_malinka{
- background-image: linear-gradient(120deg, #f093fb 0%, #f5576c 100%);
-}
-
-/*018 Cloudy Knoxville*/
-.cloudy_knoxville{
- background-image: linear-gradient(120deg, #fdfbfb 0%, #ebedee 100%);
-}
-
-/*019 Malibu Beach*/
-.malibu_beach{
- background-image: linear-gradient(to right, #4facfe 0%, #00f2fe 100%);
-}
-
-/*020 New Life*/
-.new_life{
- background-image: linear-gradient(to right, #43e97b 0%, #38f9d7 100%);
-}
-
-/*021 True Sunset*/
-.true_sunset{
- background-image: linear-gradient(to right, #fa709a 0%, #fee140 100%);
-}
-
-/*022 Morpheus Den*/
-.morpheus_den{
- background-image: linear-gradient(to top, #30cfd0 0%, #330867 100%);
-}
-
-/*023 Rare Wind*/
-.rare_wind{
- background-image: linear-gradient(to top, #a8edea 0%, #fed6e3 100%);
-}
-
-/*024 Near Moon*/
-.near_moon{
- background-image: linear-gradient(to top, #5ee7df 0%, #b490ca 100%);
-}
-
-/*025 Wild Apple*/
-.wild_apple{
- background-image: linear-gradient(to top, #d299c2 0%, #fef9d7 100%);
-}
-
-/*026 Saint Petersburg*/
-.saint_petersburg{
- background-image: linear-gradient(135deg, #f5f7fa 0%, #c3cfe2 100%);
-}
-
-/*027 Arielle's Smile*/
-.arielles_smile{
- background-image: radial-gradient(circle 248px at center, #16d9e3 0%, #30c7ec 47%, #46aef7 100%);
-}
-
-/*028 Plum Plate*/
-.plum_plate{
- background-image: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
-}
-
-/*029 Everlasting Sky*/
-.everlasting_sky{
- background-image: linear-gradient(135deg, #fdfcfb 0%, #e2d1c3 100%);
-}
-
-/*030 Happy Fisher*/
-.happy_fisher{
- background-image: linear-gradient(120deg, #89f7fe 0%, #66a6ff 100%);
-}
-
-/*031 Blessing*/
-.blessing{
- background-image: linear-gradient(to top, #fddb92 0%, #d1fdff 100%);
-}
-
-/*032 Sharpeye Eagle*/
-.sharpeye_eagle{
- background-image: linear-gradient(to top, #9890e3 0%, #b1f4cf 100%);
-}
-
-/*033 Ladoga Bottom*/
-.ladoga_bottom{
- background-image: linear-gradient(to top, #ebc0fd 0%, #d9ded8 100%);
-}
-
-/*034 Lemon Gate*/
-.lemon_gate{
- background-image: linear-gradient(to top, #96fbc4 0%, #f9f586 100%);
-}
-
-/*035 Itmeo Branding*/
-.itmeo_branding{
- background-image: linear-gradient(180deg, #2af598 0%, #009efd 100%);
-}
-
-/*036 Zeus Miracle*/
-.zeus_miracle{
- background-image: linear-gradient(to top, #cd9cf2 0%, #f6f3ff 100%);
-}
-
-/*037 Old Hat*/
-.old_hat{
- background-image: linear-gradient(to right, #e4afcb 0%, #b8cbb8 0%, #b8cbb8 0%, #e2c58b 30%, #c2ce9c 64%, #7edbdc 100%);
-}
-
-/*038 Star Wine*/
-.star_wine{
- background-image: linear-gradient(to right, #b8cbb8 0%, #b8cbb8 0%, #b465da 0%, #cf6cc9 33%, #ee609c 66%, #ee609c 100%);
-}
-
-/*039 Deep Blue*/
-.deep_blue{
- background-image: linear-gradient(to right, #6a11cb 0%, #2575fc 100%);
-}
-
-/*040 Coup de Grace*/
-.coup_de_grace{
- background: #DCD9D4 linear-gradient(to bottom, rgba(255, 255, 255, 0.50) 0%, rgba(0, 0, 0, 0.50) 100%), radial-gradient(at 50% 0%, rgba(255, 255, 255, 0.10) 0%, rgba(0, 0, 0, 0.50) 50%);
- background-blend-mode: soft-light,screen;
-}
-
-/*041 Happy Acid*/
-.happy_acid{
- background-image: linear-gradient(to top, #37ecba 0%, #72afd3 100%);
-}
-
-/*042 Awesome Pine*/
-.awesome_pine{
- background-image: linear-gradient(to top, #ebbba7 0%, #cfc7f8 100%);
-}
-
-/*043 New York*/
-.new_york{
- background-image: linear-gradient(to top, #fff1eb 0%, #ace0f9 100%);
-}
-
-/*044 Shy Rainbow*/
-.shy_rainbow{
- background-image: linear-gradient(to right, #eea2a2 0%, #bbc1bf 19%, #57c6e1 42%, #b49fda 79%, #7ac5d8 100%);
-}
-
-/*045 Loon Crest*/
-.loon_crest{
- background: linear-gradient(to bottom, rgba(255,255,255,0.15) 0%, rgba(0,0,0,0.15) 100%), radial-gradient(at top center, rgba(255,255,255,0.40) 0%, rgba(0,0,0,0.40) 120%) #989898;
- background-blend-mode: multiply,multiply;
-}
-
-/*046 Mixed Hopes*/
-.mixed_hopes{
- background-image: linear-gradient(to top, #c471f5 0%, #fa71cd 100%);
-}
-
-/*047 Fly High*/
-.fly_high{
- background-image: linear-gradient(to top, #48c6ef 0%, #6f86d6 100%);
-}
-
-/*048 Strong Bliss*/
-.strong_bliss{
- background-image: linear-gradient(to right, #f78ca0 0%, #f9748f 19%, #fd868c 60%, #fe9a8b 100%);
-}
-
-/*049 Fresh Milk*/
-.fresh_milk{
- background-image: linear-gradient(to top, #feada6 0%, #f5efef 100%);
-}
-
-/*050 Snow Again*/
-.snow_again{
- background-image: linear-gradient(to top, #e6e9f0 0%, #eef1f5 100%);
-}
-
-/*051 February Ink*/
-.february_ink{
- background-image: linear-gradient(to top, #accbee 0%, #e7f0fd 100%);
-}
-
-/*052 Kind Steel*/
-.kind_steel{
- background-image: linear-gradient(-20deg, #e9defa 0%, #fbfcdb 100%);
-}
-
-/*053 Soft Grass*/
-.soft_grass{
- background-image: linear-gradient(to top, #c1dfc4 0%, #deecdd 100%);
-}
-
-/*054 Grown Early*/
-.grown_early{
- background-image: linear-gradient(to top, #0ba360 0%, #3cba92 100%);
-}
-
-/*055 Sharp Blues*/
-.sharp_blues{
- background-image: linear-gradient(to top, #00c6fb 0%, #005bea 100%);
-}
-
-/*056 Shady Water*/
-.shady_water{
- background-image: linear-gradient(to right, #74ebd5 0%, #9face6 100%);
-}
-
-/*057 Dirty Beauty*/
-.dirty_beauty{
- background-image: linear-gradient(to top, #6a85b6 0%, #bac8e0 100%);
-}
-
-/*058 Great Whale*/
-.great_whale{
- background-image: linear-gradient(to top, #a3bded 0%, #6991c7 100%);
-}
-
-/*059 Teen Notebook*/
-.teen_notebook{
- background-image: linear-gradient(to top, #9795f0 0%, #fbc8d4 100%);
-}
-
-/*060 Polite Rumors*/
-.polite_rumors{
- background-image: linear-gradient(to top, #a7a6cb 0%, #8989ba 52%, #8989ba 100%);
-}
-
-/*061 Sweet Period*/
-.sweet_period{
- background-image: linear-gradient(to top, #3f51b1 0%, #5a55ae 13%, #7b5fac 25%, #8f6aae 38%, #a86aa4 50%, #cc6b8e 62%, #f18271 75%, #f3a469 87%, #f7c978 100%);
-}
-
-/*062 Wide Matrix*/
-.wide_matrix{
- background-image: linear-gradient(to top, #fcc5e4 0%, #fda34b 15%, #ff7882 35%, #c8699e 52%, #7046aa 71%, #0c1db8 87%, #020f75 100%);
-}
-
-/*063 Soft Cherish*/
-.soft_cherish{
- background-image: linear-gradient(to top, #dbdcd7 0%, #dddcd7 24%, #e2c9cc 30%, #e7627d 46%, #b8235a 59%, #801357 71%, #3d1635 84%, #1c1a27 100%);
-}
-
-/*064 Red Salvation*/
-.red_salvation{
- background-image: linear-gradient(to top, #f43b47 0%, #453a94 100%);
-}
-
-/*065 Burning Spring*/
-.burning_spring{
- background-image: linear-gradient(to top, #4fb576 0%, #44c489 30%, #28a9ae 46%, #28a2b7 59%, #4c7788 71%, #6c4f63 86%, #432c39 100%);
-}
-
-/*066 Night Party*/
-.night_party{
- background-image: linear-gradient(to top, #0250c5 0%, #d43f8d 100%);
-}
-
-/*067 Sky Glider*/
-.sky_glider{
- background-image: linear-gradient(to top, #88d3ce 0%, #6e45e2 100%);
-}
-
-/*068 Heaven Peach*/
-.heaven_peach{
- background-image: linear-gradient(to top, #d9afd9 0%, #97d9e1 100%);
-}
-
-/*069 Purple Division*/
-.purple_division{
- background-image: linear-gradient(to top, #7028e4 0%, #e5b2ca 100%);
-}
-
-/*070 Aqua Splash*/
-.aqua_splash{
- background-image: linear-gradient(15deg, #13547a 0%, #80d0c7 100%);
-}
-
-/*071 Above Clouds*/
-.above_clouds{
- background-image: linear-gradient(to left, #BDBBBE 0%, #9D9EA3 100%), radial-gradient(88% 271%, rgba(255, 255, 255, 0.25) 0%, rgba(254, 254, 254, 0.25) 1%, rgba(0, 0, 0, 0.25) 100%), radial-gradient(50% 100%, rgba(255, 255, 255, 0.30) 0%, rgba(0, 0, 0, 0.30) 100%);
- background-blend-mode: normal, lighten, soft-light;
-}
-
-/*072 Spiky Naga*/
-.spiky_naga{
- background-image: linear-gradient(to top, #505285 0%, #585e92 12%, #65689f 25%, #7474b0 37%, #7e7ebb 50%, #8389c7 62%, #9795d4 75%, #a2a1dc 87%, #b5aee4 100%);
-}
-
-/*073 Love Kiss*/
-.love_kiss{
- background-image: linear-gradient(to top, #ff0844 0%, #ffb199 100%);
-}
-
-/*074 Sharp Glass*/
-.sharp_glass{
- background: #C9CCD3 linear-gradient(-180deg, rgba(255, 255, 255, 0.50) 0%, rgba(0, 0, 0, 0.50) 100%);
- background-blend-mode: lighten;
-}
-
-/*075 Clean Mirror*/
-.clean_mirror{
- background-image: linear-gradient(45deg, #93a5cf 0%, #e4efe9 100%);
-}
-
-/*076 Premium Dark*/
-.premium_dark{
- background-image: linear-gradient(to right, #434343 0%, black 100%);
-}
-
-/*077 Cold Evening*/
-.cold_evening{
- background-image: linear-gradient(to top, #0c3483 0%, #a2b6df 100%, #6b8cce 100%, #a2b6df 100%);
-}
-
-/*078 Cochiti Lake*/
-.cochiti_lake{
- background-image: linear-gradient(45deg, #93a5cf 0%, #e4efe9 100%);
-}
-
-/*079 Summer Games*/
-.summer_games{
- background-image: linear-gradient(to right, #92fe9d 0%, #00c9ff 100%);
-}
-
-/*080 Passionate Bed*/
-.passionate_bed{
- background-image: linear-gradient(to right, #ff758c 0%, #ff7eb3 100%);
-}
-
-/*081 Mountain Rock*/
-.mountain_rock{
- background-image: linear-gradient(to right, #868f96 0%, #596164 100%);
-}
-
-/*082 Desert Hump*/
-.desert_hump{
- background-image: linear-gradient(to top, #c79081 0%, #dfa579 100%);
-}
-
-/*083 Jungle Day*/
-.jungle_day{
- background-image: linear-gradient(45deg, #8baaaa 0%, #ae8b9c 100%);
-}
-
-/*084 Phoenix Start*/
-.phoenix_start{
- background-image: linear-gradient(to right, #f83600 0%, #f9d423 100%);
-}
-
-/*085 October Silence*/
-.october_silence{
- background-image: linear-gradient(-20deg, #b721ff 0%, #21d4fd 100%);
-}
-
-/*086 Faraway River*/
-.faraway_river{
- background-image: linear-gradient(-20deg, #6e45e2 0%, #88d3ce 100%);
-}
-
-/*087 Alchemist Lab*/
-.alchemist_lab{
- background-image: linear-gradient(-20deg, #d558c8 0%, #24d292 100%);
-}
-
-/*088 Over Sun*/
-.over_sun{
- background-image: linear-gradient(60deg, #abecd6 0%, #fbed96 100%);
-}
-
-/*089 Premium White*/
-.premium_white{
- background-image: linear-gradient(to top, #d5d4d0 0%, #d5d4d0 1%, #eeeeec 31%, #efeeec 75%, #e9e9e7 100%);
-}
-
-/*090 Mars Party*/
-.mars_party{
- background-image: linear-gradient(to top, #5f72bd 0%, #9b23ea 100%);
-}
-
-/*091 Eternal Constance*/
-.eternal_constance{
- background-image: linear-gradient(to top, #09203f 0%, #537895 100%);
-}
-
-/*092 Japan Blush*/
-.japan_blush{
- background-image: linear-gradient(-20deg, #ddd6f3 0%, #faaca8 100%, #faaca8 100%);
-}
-
-/*093 Smiling Rain*/
-.smiling_rain{
- background-image: linear-gradient(-20deg, #dcb0ed 0%, #99c99c 100%);
-}
-
-/*094 Cloudy Apple*/
-.cloudy_apple{
- background-image: linear-gradient(to top, #f3e7e9 0%, #e3eeff 99%, #e3eeff 100%);
-}
-
-/*095 Big Mango*/
-.big_mango{
- background-image: linear-gradient(to top, #c71d6f 0%, #d09693 100%);
-}
-
-/*096 Healthy Water*/
-.healthy_water{
- background-image: linear-gradient(60deg, #96deda 0%, #50c9c3 100%);
-}
-
-/*097 Amour Amour*/
-.amour_amour{
- background-image: linear-gradient(to top, #f77062 0%, #fe5196 100%);
-}
-
-/*098 Risky Concrete*/
-.risky_concrete{
- background-image: linear-gradient(to top, #c4c5c7 0%, #dcdddf 52%, #ebebeb 100%);
-}
-
-/*099 Strong Stick*/
-.strong_stick{
- background-image: linear-gradient(to right, #a8caba 0%, #5d4157 100%);
-}
-
-/*100 Vicious Stance*/
-.vicious_stance{
- background-image: linear-gradient(60deg, #29323c 0%, #485563 100%);
-}
-
-/*101 Palo Alto*/
-.palo_alto{
- background-image: linear-gradient(-60deg, #16a085 0%, #f4d03f 100%);
-}
-
-/*102 Happy Memories*/
-.happy_memories{
- background-image: linear-gradient(-60deg, #ff5858 0%, #f09819 100%);
-}
-
-/*103 Midnight Bloom*/
-.midnight_bloom{
- background-image: linear-gradient(-20deg, #2b5876 0%, #4e4376 100%);
-}
-
-/*104 Crystalline*/
-.crystalline{
- background-image: linear-gradient(-20deg, #00cdac 0%, #8ddad5 100%);
-}
-
-/*105 Raccoon Back*/
-.raccoon_back{
- background: linear-gradient(-180deg, #BCC5CE 0%, #929EAD 98%), radial-gradient(at top left, rgba(255,255,255,0.30) 0%, rgba(0,0,0,0.30) 100%);
- background-blend-mode: screen;
-}
-
-/*106 Party Bliss*/
-.party_bliss{
- background-image: linear-gradient(to top, #4481eb 0%, #04befe 100%);
-}
-
-/*107 Confident Cloud*/
-.confident_cloud{
- background-image: linear-gradient(to top, #dad4ec 0%, #dad4ec 1%, #f3e7e9 100%);
-}
-
-/*108 Le Cocktail*/
-.le_cocktail{
- background-image: linear-gradient(45deg, #874da2 0%, #c43a30 100%);
-}
-
-/*109 River City*/
-.river_city{
- background-image: linear-gradient(to top, #4481eb 0%, #04befe 100%);
-}
-
-/*110 Frozen Berry*/
-.frozen_berry{
- background-image: linear-gradient(to top, #e8198b 0%, #c7eafd 100%);
-}
-
-/*111 Elegance*/
-.elegance{
- background-image: radial-gradient(73% 147%, #EADFDF 59%, #ECE2DF 100%), radial-gradient(91% 146%, rgba(255,255,255,0.50) 47%, rgba(0,0,0,0.50) 100%);
- background-blend-mode: screen;
-}
-
-/*112 Child Care*/
-.child_care{
- background-image: linear-gradient(-20deg, #f794a4 0%, #fdd6bd 100%);
-}
-
-/*113 Flying Lemon*/
-.flying_lemon{
- background-image: linear-gradient(60deg, #64b3f4 0%, #c2e59c 100%);
-}
-
-/*114 New Retrowave*/
-.new_retrowave{
- background-image: linear-gradient(to top, #3b41c5 0%, #a981bb 49%, #ffc8a9 100%);
-}
-
-/*115 Hidden Jaguar*/
-.hidden_jaguar{
- background-image: linear-gradient(to top, #0fd850 0%, #f9f047 100%);
-}
-
-/*116 Above The Sky*/
-.above_the_sky{
- background-image: linear-gradient(to top, lightgrey 0%, lightgrey 1%, #e0e0e0 26%, #efefef 48%, #d9d9d9 75%, #bcbcbc 100%);
-}
-
-/*117 Nega*/
-.nega{
- background-image: linear-gradient(45deg, #ee9ca7 0%, #ffdde1 100%);
-}
-
-/*118 Dense Water*/
-.dense_water{
- background-image: linear-gradient(to right, #3ab5b0 0%, #3d99be 31%, #56317a 100%);
-}
-
-/*119 Chemic Aqua*/
-.chemic_aqua{
- background: #CDDCDC radial-gradient(at 50% 100%, rgba(255, 255, 255, 0.50) 0%, rgba(0, 0, 0, 0.50) 100%), linear-gradient(to bottom, rgba(255, 255, 255, 0.25) 0%, rgba(0, 0, 0, 0.25) 100%);
- background-blend-mode: screen, overlay;
-}
-
-/*120 Seashore*/
-.seashore{
- background-image: linear-gradient(to top, #209cff 0%, #68e0cf 100%);
-}
-
-/*121 Marble Wall*/
-.marble_wall{
- background-image: linear-gradient(to top, #bdc2e8 0%, #bdc2e8 1%, #e6dee9 100%);
-}
-
-/*122 Cheerful Caramel*/
-.cheerful_caramel{
- background-image: linear-gradient(to top, #e6b980 0%, #eacda3 100%);
-}
-
-/*123 Night Sky*/
-.night_sky{
- background-image: linear-gradient(to top, #1e3c72 0%, #1e3c72 1%, #2a5298 100%);
-}
-
-/*124 Magic Lake*/
-.magic_lake{
- background-image: linear-gradient(to top, #d5dee7 0%, #ffafbd 0%, #c9ffbf 100%);
-}
-
-/*125 Young Grass*/
-.young_grass{
- background-image: linear-gradient(to top, #9be15d 0%, #00e3ae 100%);
-}
-
-/*126 Colorful Peach*/
-.colorful_peach{
- background-image: linear-gradient(to right, #ed6ea0 0%, #ec8c69 100%);
-}
-
-/*127 Gentle Care*/
-.gentle_care{
- background-image: linear-gradient(to right, #ffc3a0 0%, #ffafbd 100%);
-}
-
-/*128 Plum Bath*/
-.plum_bath{
- background-image: linear-gradient(to top, #cc208e 0%, #6713d2 100%);
-}
-
-/*129 Happy Unicorn*/
-.happy_unicorn{
- background-image: linear-gradient(to top, #b3ffab 0%, #12fff7 100%);
-}
-
-/*130 Full Metal*/
-.full_metal{
- background: linear-gradient(to bottom, #D5DEE7 0%, #E8EBF2 50%, #E2E7ED 100%), linear-gradient(to bottom, rgba(0,0,0,0.02) 50%, rgba(255,255,255,0.02) 61%, rgba(0,0,0,0.02) 73%), linear-gradient(33deg, rgba(255,255,255,0.20) 0%, rgba(0,0,0,0.20) 100%);
- background-blend-mode: normal,color-burn;
-}
-
-/*131 African Field*/
-.african_field{
- background-image: linear-gradient(to top, #65bd60 0%, #5ac1a8 25%, #3ec6ed 50%, #b7ddb7 75%, #fef381 100%);
-}
-
-/*132 Solid Stone*/
-.solid_stone{
- background-image: linear-gradient(to right, #243949 0%, #517fa4 100%);
-}
-
-/*133 Orange Juice*/
-.orange_juice{
- background-image: linear-gradient(-20deg, #fc6076 0%, #ff9a44 100%);
-}
-
-/*134 Glass Water*/
-.glass_water{
- background-image: linear-gradient(to top, #dfe9f3 0%, white 100%);
-}
-
-/*135 Slick Carbon*/
-.slick_carbon{
- background: linear-gradient(to bottom, #323232 0%, #3F3F3F 40%, #1C1C1C 150%), linear-gradient(to top, rgba(255,255,255,0.40) 0%, rgba(0,0,0,0.25) 200%);
- background-blend-mode: multiply;
-}
-
-/*136 North Miracle*/
-.north_miracle{
- background-image: linear-gradient(to right, #00dbde 0%, #fc00ff 100%);
-}
-
-/*137 Fruit Blend*/
-.fruit_blend{
- background-image: linear-gradient(to right, #f9d423 0%, #ff4e50 100%);
-}
-
-/*138 Millennium Pine*/
-.millennium_pine{
- background-image: linear-gradient(to top, #50cc7f 0%, #f5d100 100%);
-}
-
-/*139 High Flight*/
-.high_flight{
- background-image: linear-gradient(to right, #0acffe 0%, #495aff 100%);
-}
-
-/*140 Mole Hall*/
-.mole_hall{
- background-image: linear-gradient(-20deg, #616161 0%, #9bc5c3 100%);
-}
-
-/*141 Earl Gray*/
-.earl_gray{
- background: #E4E4E1 radial-gradient(at top center, rgba(255, 255, 255, 0.03) 0%, rgba(0, 0, 0, 0.03) 100%), linear-gradient(to top, rgba(255, 255, 255, 0.1) 0%, rgba(143, 152, 157, 0.60) 100%);
- background-blend-mode: normal, multiply;
-}
-
-/*142 Space Shift*/
-.space_shift{
- background-image: linear-gradient(60deg, #3d3393 0%, #2b76b9 37%, #2cacd1 65%, #35eb93 100%);
-}
-
-/*143 Forest Inei*/
-.forest_inei{
- background-image: linear-gradient(to top, #df89b5 0%, #bfd9fe 100%);
-}
-
-/*144 Royal Garden*/
-.royal_garden{
- background-image: linear-gradient(to right, #ed6ea0 0%, #ec8c69 100%);
-}
-
-/*145 Rich Metal*/
-.rich_metal{
- background-image: linear-gradient(to right, #d7d2cc 0%, #304352 100%);
-}
-
-/*146 Juicy Cake*/
-.juicy_cake{
- background-image: linear-gradient(to top, #e14fad 0%, #f9d423 100%);
-}
-
-/*147 Smart Indigo*/
-.smart_indigo{
- background-image: linear-gradient(to top, #b224ef 0%, #7579ff 100%);
-}
-
-/*148 Sand Strike*/
-.sand_strike{
- background-image: linear-gradient(to right, #c1c161 0%, #c1c161 0%, #d4d4b1 100%);
-}
-
-/*149 Norse Beauty*/
-.norse_beauty{
- background-image: linear-gradient(to right, #ec77ab 0%, #7873f5 100%);
-}
-
-/*150 Aqua Guidance*/
-.aqua_guidance{
- background-image: linear-gradient(to top, #007adf 0%, #00ecbc 100%);
-}
-
-/*151 Sun Veggie*/
-.sun_veggie{
- background-image: linear-gradient(-225deg, #20E2D7 0%, #F9FEA5 100%);
-}
-
-/*152 Sea Lord*/
-.sea_lord{
- background-image: linear-gradient(-225deg, #2CD8D5 0%, #C5C1FF 56%, #FFBAC3 100%);
-}
-
-/*153 Black Sea*/
-.black_sea{
- background-image: linear-gradient(-225deg, #2CD8D5 0%, #6B8DD6 48%, #8E37D7 100%);
-}
-
-/*154 Grass Shampoo*/
-.grass_shampoo{
- background-image: linear-gradient(-225deg, #DFFFCD 0%, #90F9C4 48%, #39F3BB 100%);
-}
-
-/*155 Landing Aircraft*/
-.landing_aircraft{
- background-image: linear-gradient(-225deg, #5D9FFF 0%, #B8DCFF 48%, #6BBBFF 100%);
-}
-
-/*156 Witch Dance*/
-.witch_dance{
- background-image: linear-gradient(-225deg, #A8BFFF 0%, #884D80 100%);
-}
-
-/*157 Sleepless Night*/
-.sleepless_night{
- background-image: linear-gradient(-225deg, #5271C4 0%, #B19FFF 48%, #ECA1FE 100%);
-}
-
-/*158 Angel Care*/
-.angel_care{
- background-image: linear-gradient(-225deg, #FFE29F 0%, #FFA99F 48%, #FF719A 100%);
-}
-
-/*159 Crystal River*/
-.crystal_river{
- background-image: linear-gradient(-225deg, #22E1FF 0%, #1D8FE1 48%, #625EB1 100%);
-}
-
-/*160 Soft Lipstick*/
-.soft_lipstick{
- background-image: linear-gradient(-225deg, #B6CEE8 0%, #F578DC 100%);
-}
-
-/*161 Salt Mountain*/
-.salt_mountain{
- background-image: linear-gradient(-225deg, #FFFEFF 0%, #D7FFFE 100%);
-}
-
-/*162 Perfect White*/
-.perfect_white{
- background-image: linear-gradient(-225deg, #E3FDF5 0%, #FFE6FA 100%);
-}
-
-/*163 Fresh Oasis*/
-.fresh_oasis{
- background-image: linear-gradient(-225deg, #7DE2FC 0%, #B9B6E5 100%);
-}
-
-/*164 Strict November*/
-.strict_november{
- background-image: linear-gradient(-225deg, #CBBACC 0%, #2580B3 100%);
-}
-
-/*165 Morning Salad*/
-.morning_salad{
- background-image: linear-gradient(-225deg, #B7F8DB 0%, #50A7C2 100%);
-}
-
-/*166 Deep Relief*/
-.deep_relief{
- background-image: linear-gradient(-225deg, #7085B6 0%, #87A7D9 50%, #DEF3F8 100%);
-}
-
-/*167 Sea Strike*/
-.sea_strike{
- background-image: linear-gradient(-225deg, #77FFD2 0%, #6297DB 48%, #1EECFF 100%);
-}
-
-/*168 Night Call*/
-.night_call{
- background-image: linear-gradient(-225deg, #AC32E4 0%, #7918F2 48%, #4801FF 100%);
-}
-
-/*169 Supreme Sky*/
-.supreme_sky{
- background-image: linear-gradient(-225deg, #D4FFEC 0%, #57F2CC 48%, #4596FB 100%);
-}
-
-/*170 Light Blue*/
-.light_blue{
- background-image: linear-gradient(-225deg, #9EFBD3 0%, #57E9F2 48%, #45D4FB 100%);
-}
-
-/*171 Mind Crawl*/
-.mind_crawl{
- background-image: linear-gradient(-225deg, #473B7B 0%, #3584A7 51%, #30D2BE 100%);
-}
-
-/*172 Lily Meadow*/
-.lily_meadow{
- background-image: linear-gradient(-225deg, #65379B 0%, #886AEA 53%, #6457C6 100%);
-}
-
-/*173 Sugar Lollipop*/
-.sugar_lollipop{
- background-image: linear-gradient(-225deg, #A445B2 0%, #D41872 52%, #FF0066 100%);
-}
-
-/*174 Sweet Dessert*/
-.sweet_dessert{
- background-image: linear-gradient(-225deg, #7742B2 0%, #F180FF 52%, #FD8BD9 100%);
-}
-
-/*175 Magic Ray*/
-.magic_ray{
- background-image: linear-gradient(-225deg, #FF3CAC 0%, #562B7C 52%, #2B86C5 100%);
-}
-
-/*176 Teen Party*/
-.teen_party{
- background-image: linear-gradient(-225deg, #FF057C 0%, #8D0B93 50%, #321575 100%);
-}
-
-/*177 Frozen Heat*/
-.frozen_heat{
- background-image: linear-gradient(-225deg, #FF057C 0%, #7C64D5 48%, #4CC3FF 100%);
-}
-
-/*178 Gagarin View*/
-.gagarin_view{
- background-image: linear-gradient(-225deg, #69EACB 0%, #EACCF8 48%, #6654F1 100%);
-}
-
-/*179 Fabled Sunset*/
-.fabled_sunset{
- background-image: linear-gradient(-225deg, #231557 0%, #44107A 29%, #FF1361 67%, #FFF800 100%);
-}
-
-/*180 Perfect Blue*/
-.perfect_blue{
- background-image: linear-gradient(-225deg, #3D4E81 0%, #5753C9 48%, #6E7FF3 100%);
-}
diff --git a/src/gui/platform/android/qandroidnativeinterface.cpp b/src/gui/platform/android/qandroidnativeinterface.cpp
new file mode 100644
index 0000000000..c1c4b7149f
--- /dev/null
+++ b/src/gui/platform/android/qandroidnativeinterface.cpp
@@ -0,0 +1,54 @@
+// Copyright (C) 2020 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
+
+#include <qpa/qplatformoffscreensurface.h>
+#include <qpa/qplatformintegration.h>
+
+#include <QtGui/qoffscreensurface_platform.h>
+#include <QtGui/private/qguiapplication_p.h>
+
+#include <QtGui/qpa/qplatformscreen_p.h>
+
+QT_BEGIN_NAMESPACE
+
+using namespace QNativeInterface::Private;
+
+/*!
+ \class QNativeInterface::QAndroidOffscreenSurface
+ \since 6.0
+ \brief Native interface to a offscreen surface on Android.
+
+ Accessed through QOffscreenSurface::nativeInterface().
+
+ \inmodule QtGui
+ \inheaderfile QOffscreenSurface
+ \ingroup native-interfaces
+ \ingroup native-interfaces-qoffscreensurface
+*/
+
+QT_DEFINE_NATIVE_INTERFACE(QAndroidOffscreenSurface);
+QT_DEFINE_PRIVATE_NATIVE_INTERFACE(QAndroidOffScreenIntegration);
+
+QOffscreenSurface *QNativeInterface::QAndroidOffscreenSurface::fromNative(ANativeWindow *nativeSurface)
+{
+ return QGuiApplicationPrivate::platformIntegration()->call<
+ &QAndroidOffScreenIntegration::createOffscreenSurface>(nativeSurface);
+}
+
+/*!
+ \class QNativeInterface::QAndroidScreen
+ \since 6.7
+ \brief Native interface to a screen.
+
+ Accessed through QScreen::nativeInterface().
+ \inmodule QtGui
+ \ingroup native-interfaces
+ \ingroup native-interfaces-qscreen
+*/
+/*!
+ \fn int QNativeInterface::QAndroidScreen::displayId() const;
+ \return the id of the underlying Android display.
+*/
+QT_DEFINE_NATIVE_INTERFACE(QAndroidScreen);
+
+QT_END_NAMESPACE
diff --git a/src/gui/platform/darwin/qappleiconengine.mm b/src/gui/platform/darwin/qappleiconengine.mm
new file mode 100644
index 0000000000..7e0ed184dc
--- /dev/null
+++ b/src/gui/platform/darwin/qappleiconengine.mm
@@ -0,0 +1,464 @@
+// Copyright (C) 2023 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
+
+#include "qappleiconengine_p.h"
+
+#if defined(Q_OS_MACOS)
+# include <AppKit/AppKit.h>
+#elif defined(QT_PLATFORM_UIKIT)
+# include <UIKit/UIKit.h>
+#endif
+
+#include <QtGui/qguiapplication.h>
+#include <QtGui/qpainter.h>
+#include <QtGui/qpalette.h>
+#include <QtGui/qstylehints.h>
+
+#include <QtGui/private/qcoregraphics_p.h>
+
+QT_BEGIN_NAMESPACE
+
+using namespace Qt::StringLiterals;
+
+namespace {
+auto *loadImage(const QString &iconName)
+{
+ static constexpr std::pair<QLatin1StringView, NSString *> iconMap[] = {
+ {"address-book-new"_L1, @"book.closed"},
+ {"application-exit"_L1, @"xmark.circle"},
+ {"appointment-new"_L1, @"calendar.badge.plus"},
+ {"call-start"_L1, @"phone.arrow.up.right"},
+ {"call-stop"_L1, @"phone.down"},
+ {"contact-new"_L1, @"person.crop.circle.badge.plus"},
+ {"document-new"_L1, @"doc.badge.plus"},
+ {"document-open"_L1, @"folder"},
+ {"document-open-recent"_L1, @"doc.badge.clock"},
+ {"document-page-setup"_L1, @"doc.badge.gearshape"},
+ {"document-print"_L1, @"printer"},
+ //{"document-print-preview"_L1, @""},
+ {"document-properties"_L1, @"doc.badge.ellipsis"},
+ //{"document-revert"_L1, @""},
+ {"document-save"_L1, @"square.and.arrow.down"},
+ //{"document-save-as"_L1, @""},
+ {"document-send"_L1, @"paperplane"},
+ {"edit-clear"_L1, @"xmark.circle"},
+ {"edit-copy"_L1, @"doc.on.doc"},
+ {"edit-cut"_L1, @"scissors"},
+ {"edit-delete"_L1, @"delete.left"},
+ {"edit-find"_L1, @"magnifyingglass"},
+ //{"edit-find-replace"_L1, @"arrow.up.left.and.down.right.magnifyingglass"},
+ {"edit-paste"_L1, @"clipboard"},
+ {"edit-redo"_L1, @"arrowshape.turn.up.right"},
+ //{"edit-select-all"_L1, @""},
+ {"edit-undo"_L1, @"arrowshape.turn.up.left"},
+ {"folder-new"_L1, @"folder.badge.plus"},
+ {"format-indent-less"_L1, @"decrease.indent"},
+ {"format-indent-more"_L1, @"increase.indent"},
+ {"format-justify-center"_L1, @"text.aligncenter"},
+ {"format-justify-fill"_L1, @"text.justify"},
+ {"format-justify-left"_L1, @"text.justify.left"},
+ {"format-justify-right"_L1, @"text.justify.right"},
+ {"format-text-direction-ltr"_L1, @"text.justify.leading"},
+ {"format-text-direction-rtl"_L1, @"text.justify.trailing"},
+ {"format-text-bold"_L1, @"bold"},
+ {"format-text-italic"_L1, @"italic"},
+ {"format-text-underline"_L1, @"underline"},
+ {"format-text-strikethrough"_L1, @"strikethrough"},
+ //{"go-bottom"_L1, @""},
+ {"go-down"_L1, @"arrowshape.down"},
+ {"go-first"_L1, @"increase.indent"},
+ {"go-home"_L1, @"house"},
+ //{"go-jump"_L1, @""},
+ //{"go-last"_L1, @""},
+ {"go-next"_L1, @"arrowshape.right"},
+ {"go-previous"_L1, @"arrowshape.left"},
+ //{"go-top"_L1, @""},
+ {"go-up"_L1, @"arrowshape.up"},
+ {"help-about"_L1, @"info.circle"},
+ //{"help-contents"_L1, @""},
+ {"help-faq"_L1, @"questionmark.app"},
+ {"insert-image"_L1, @"photo.badge.plus"},
+ {"insert-link"_L1, @"link.badge.plus"},
+ //{"insert-object"_L1, @""},
+ {"insert-text"_L1, @"textformat"},
+ {"list-add"_L1, @"plus.circle"},
+ {"list-remove"_L1, @"minus.circle"},
+ {"mail-forward"_L1, @"arrowshape.turn.up.right"},
+ {"mail-mark-important"_L1, @"star"},
+ {"mail-mark-junk"_L1, @"xmark.bin"},
+ {"mail-mark-notjunk"_L1, @"trash.slash"},
+ {"mail-mark-read"_L1, @"envelope.open"},
+ {"mail-mark-unread"_L1, @"envelope.fill"},
+ {"mail-message-new"_L1, @"square.and.pencil"},
+ {"mail-reply-all"_L1, @"arrowshape.turn.up.left.2"},
+ {"mail-reply-sender"_L1, @"arrowshape.turn.up.left"},
+ {"mail-send"_L1, @"paperplane"},
+ {"mail-send-receive"_L1, @"envelope.arrow.triangle.branch"},
+ {"media-eject"_L1, @"eject"},
+ {"media-playback-pause"_L1, @"pause"},
+ {"media-playback-start"_L1, @"play"},
+ {"media-playback-stop"_L1, @"stop"},
+ {"media-record"_L1, @"record.circle"},
+ {"media-seek-backward"_L1, @"backward"},
+ {"media-seek-forward"_L1, @"forward"},
+ {"media-skip-backward"_L1, @"backward.end.alt"},
+ {"media-skip-forward"_L1, @"forward.end.alt"},
+ {"object-flip-horizontal"_L1, @"rectangle.landscape.rotate"},
+ {"object-flip-vertical"_L1, @"rectangle.portrait.rotate"},
+ {"object-rotate-left"_L1, @"rotate.left"},
+ {"object-rotate-right"_L1, @"rotate.right"},
+ {"process-stop"_L1, @"stop.circle"},
+ {"system-lock-screen"_L1, @"lock.display"},
+ {"system-log-out"_L1, @"door.left.hand.open"},
+ //{"system-run"_L1, @""},
+ {"system-search"_L1, @"magnifyingglass"},
+ //{"system-reboot"_L1, @""},
+ {"system-shutdown"_L1, @"power"},
+ //{"tools-check-spelling"_L1, @""},
+ {"view-fullscreen"_L1, @"arrow.up.left.and.arrow.down.right"},
+ {"view-refresh"_L1, @"arrow.clockwise"},
+ {"view-restore"_L1, @"arrow.down.right.and.arrow.up.left"},
+ //{"view-sort-ascending"_L1, @""},
+ //{"view-sort-descending"_L1, @""},
+ {"window-close"_L1, @"xmark.circle"},
+ {"window-new"_L1, @"macwindow.badge.plus"},
+ {"zoom-fit-best"_L1, @"square.arrowtriangle.4.outward"},
+ {"zoom-in"_L1, @"plus.magnifyingglass"},
+ //{"zoom-original"_L1, @""},
+ {"zoom-out"_L1, @"minus.magnifyingglass"},
+ {"process-working"_L1, @"circle.dotted"},
+ //{"accessories-calculator"_L1, @""},
+ //{"accessories-character-map"_L1, @""},
+ {"accessories-dictionary"_L1, @"character.book.closed"},
+ {"accessories-text-editor"_L1, @"textformat"},
+ {"help-browser"_L1, @"folder.badge.questionmark"},
+ {"multimedia-volume-control"_L1, @"speaker.wave.3"},
+ {"preferences-desktop-accessibility"_L1, @"accessibility"},
+ //{"preferences-desktop-font"_L1, @""},
+ {"preferences-desktop-keyboard"_L1, @"keyboard.badge.ellipsis"},
+ //{"preferences-desktop-locale"_L1, @""},
+ //{"preferences-desktop-multimedia"_L1, @""},
+ //{"preferences-desktop-screensaver"_L1, @""},
+ //{"preferences-desktop-theme"_L1, @""},
+ //{"preferences-desktop-wallpaper"_L1, @""},
+ {"system-file-manager"_L1, @"folder.badge.gearshape"},
+ //{"system-software-install"_L1, @""},
+ //{"system-software-update"_L1, @""}, d
+ //{"utilities-system-monitor"_L1, @""},
+ {"utilities-terminal"_L1, @"apple.terminal"},
+ //{"applications-accessories"_L1, @""},
+ //{"applications-development"_L1, @""},
+ //{"applications-engineering"_L1, @""},
+ {"applications-games"_L1, @"gamecontroller"},
+ //{"applications-graphics"_L1, @""},
+ {"applications-internet"_L1, @"network"},
+ {"applications-multimedia"_L1, @"tv.and.mediabox"},
+ //{"applications-office"_L1, @""},
+ //{"applications-other"_L1, @""},
+ {"applications-science"_L1, @"atom"},
+ //{"applications-system"_L1, @""},
+ //{"applications-utilities"_L1, @""},
+ {"preferences-desktop"_L1, @"menubar.dock.rectangle"},
+ //{"preferences-desktop-peripherals"_L1, @""},
+ //{"preferences-desktop-personal"_L1, @""},
+ //{"preferences-other"_L1, @""},
+ //{"preferences-system"_L1, @""},
+ {"preferences-system-network"_L1, @"network"},
+ {"system-help"_L1, @"questionmark.diamond"},
+ {"audio-card"_L1, @"waveform.circle"},
+ {"audio-input-microphone"_L1, @"mic"},
+ {"battery"_L1, @"battery.100percent"},
+ {"camera-photo"_L1, @"camera"},
+ {"camera-video"_L1, @"video"},
+ {"camera-web"_L1, @"web.camera"},
+ {"computer"_L1, @"desktopcomputer"},
+ {"drive-harddisk"_L1, @"internaldrive"},
+ {"drive-optical"_L1, @"opticaldiscdrive"},
+ {"drive-removable-media"_L1, @"externaldrive"},
+ {"input-gaming"_L1, @"gamecontroller"}, // "games" also using this one
+ {"input-keyboard"_L1, @"keyboard"},
+ {"input-mouse"_L1, @"computermouse"},
+ {"input-tablet"_L1, @"ipad"},
+ {"media-flash"_L1, @"mediastick"},
+ //{"media-floppy"_L1, @""},
+ //{"media-optical"_L1, @""},
+ {"media-tape"_L1, @"recordingtape"},
+ //{"modem"_L1, @""},
+ {"multimedia-player"_L1, @"play.rectangle"},
+ {"network-wired"_L1, @"app.connected.to.app.below.fill"},
+ {"network-wireless"_L1, @"wifi"},
+ //{"pda"_L1, @""},
+ {"phone"_L1, @"iphone"},
+ {"printer"_L1, @"printer"},
+ {"scanner"_L1, @"scanner"},
+ {"video-display"_L1, @"play.display"},
+ //{"emblem-default"_L1, @""},
+ {"emblem-documents"_L1, @"doc.circle"},
+ {"emblem-downloads"_L1, @"arrow.down.circle"},
+ {"emblem-favorite"_L1, @"star"},
+ {"emblem-important"_L1, @"exclamationmark.bubble.circle"},
+ {"emblem-mail"_L1, @"envelope"},
+ {"emblem-photos"_L1, @"photo.stack"},
+ //{"emblem-readonly"_L1, @""},
+ {"emblem-shared"_L1, @"folder.badge.person.crop"},
+ {"emblem-symbolic-link"_L1, @"link.circle"},
+ {"emblem-synchronized"_L1, @"arrow.triangle.2.circlepath.circle"},
+ {"emblem-system"_L1, @"gear"},
+ //{"emblem-unreadable"_L1, @""},
+ {"folder"_L1, @"folder"},
+ //{"folder-remote"_L1, @""},
+ {"network-server"_L1, @"server.rack"},
+ //{"network-workgroup"_L1, @""},
+ //{"start-here"_L1, @""},
+ {"user-bookmarks"_L1, @"bookmark.circle"},
+ {"user-desktop"_L1, @"desktopcomputer"}, //"computer" also using this one
+ {"user-home"_L1, @"house"}, //"go-home" also using this one
+ {"user-trash"_L1, @"trash"},
+ {"appointment-missed"_L1, @"calendar.badge.exclamationmark"},
+ {"appointment-soon"_L1, @"calendar.badge.clock"},
+ {"audio-volume-high"_L1, @"speaker.wave.3"},
+ {"audio-volume-low"_L1, @"speaker.wave.1"},
+ {"audio-volume-medium"_L1, @"speaker.wave.2"},
+ {"audio-volume-muted"_L1, @"speaker.slash"},
+ {"battery-caution"_L1, @"minus.plus.batteryblock.exclamationmark"},
+ {"battery-low"_L1, @"battery.25percent"}, // there are different levels that can be low battery
+ {"dialog-error"_L1, @"exclamationmark.bubble"},
+ {"dialog-information"_L1, @"info.circle"},
+ {"dialog-password"_L1, @"lock"},
+ {"dialog-question"_L1, @"questionmark.circle"},
+ {"dialog-warning"_L1, @"exclamationmark.octagon"},
+ {"folder-drag-accept"_L1, @"plus.rectangle.on.folder"},
+ //{"folder-open"_L1, @""},
+ {"folder-visiting"_L1, @"folder.circle"},
+ {"image-loading"_L1, @"photo.circle"},
+ {"image-missing"_L1, @"photo"},
+ {"mail-attachment"_L1, @"paperclip"},
+ {"mail-unread"_L1, @"envelope.badge"},
+ {"mail-read"_L1, @"envelope.open"},
+ {"mail-replied"_L1, @"arrowshape.turn.up.left"},
+ //{"mail-signed"_L1, @""},
+ //{"mail-signed-verified"_L1, @""},
+ {"media-playlist-repeat"_L1, @"repet"},
+ {"media-playlist-shuffle"_L1, @"shuffle"},
+ //{"network-error"_L1, @""},
+ //{"network-idle"_L1, @""},
+ {"network-offline"_L1, @"network.slash"},
+ //{"network-receive"_L1, @""},
+ //{"network-transmit"_L1, @""},
+ //{"network-transmit-receive"_L1, @""},
+ //{"printer-error"_L1, @""},
+ {"printer-printing"_L1, @"printer.dotmatrix.filled.and.paper"}, // not sure
+ {"security-high"_L1, @"lock.shield"},
+ //{"security-medium"_L1, @""},
+ {"security-low"_L1, @"lock.trianglebadge.exclamationmark"},
+ {"software-update-available"_L1, @"arrowshape.up.circle"},
+ {"software-update-urgent"_L1, @"exclamationmark.transmission"},
+ {"sync-error"_L1, @"exclamationmark.arrow.triangle.2.circlepath"},
+ {"sync-synchronizing"_L1, @"arrow.triangle.2.circlepath"},
+ {"task-due"_L1, @"clock.badge.exclamationmark"},
+ {"task-past-due"_L1, @"clock.badge.xmark"},
+ {"user-available"_L1, @"person.crop.circle.badge.checkmark"},
+ {"user-away"_L1, @"person.crop.circle.badge.clock"},
+ //{"user-idle"_L1, @""},
+ {"user-offline"_L1, @"person.crop.circle.badge.xmark"},
+ //{"user-trash-full"_L1, @""},
+ {"weather-clear"_L1, @"sun.max"},
+ {"weather-clear-night"_L1, @"moon"},
+ {"weather-few-clouds"_L1, @"cloud.sun"},
+ {"weather-few-clouds-night"_L1, @"cloud.moon"},
+ {"weather-fog"_L1, @"cloud.fog"},
+ {"weather-overcast"_L1, @"cloud"},
+ //{"weather-severe-alert"_L1, @""},
+ {"weather-showers"_L1, @"cloud.rain"},
+ //{"weather-showers-scattered"_L1, @""},
+ {"weather-snow"_L1, @"cloud.snow"},
+ {"weather-storm"_L1, @"tropicalstorm"},
+ };
+ const auto it = std::find_if(std::begin(iconMap), std::end(iconMap), [iconName](const auto &c){
+ return c.first == iconName;
+ });
+ NSString *systemIconName = it != std::end(iconMap) ? it->second : iconName.toNSString();
+#if defined(Q_OS_MACOS)
+ return [NSImage imageWithSystemSymbolName:systemIconName accessibilityDescription:nil];
+#elif defined(QT_PLATFORM_UIKIT)
+ return [UIImage systemImageNamed:systemIconName];
+#endif
+}
+}
+
+QAppleIconEngine::QAppleIconEngine(const QString &iconName)
+ : m_iconName(iconName), m_image(loadImage(iconName))
+{
+ if (m_image)
+ [m_image retain];
+}
+
+QAppleIconEngine::~QAppleIconEngine()
+{
+ if (m_image)
+ [m_image release];
+}
+
+QIconEngine *QAppleIconEngine::clone() const
+{
+ return new QAppleIconEngine(m_iconName);
+}
+
+QString QAppleIconEngine::key() const
+{
+ return u"QAppleIconEngine"_s;
+}
+
+QString QAppleIconEngine::iconName()
+{
+ return m_iconName;
+}
+
+bool QAppleIconEngine::isNull()
+{
+ return m_image == nullptr;
+}
+
+QList<QSize> QAppleIconEngine::availableIconSizes(double aspectRatio)
+{
+ const qreal devicePixelRatio = qGuiApp->devicePixelRatio();
+ const QList<QSize> sizes = {
+ {qRound(16 * devicePixelRatio), qRound(16. * devicePixelRatio / aspectRatio)},
+ {qRound(32 * devicePixelRatio), qRound(32. * devicePixelRatio / aspectRatio)},
+ {qRound(64 * devicePixelRatio), qRound(64. * devicePixelRatio / aspectRatio)},
+ {qRound(128 * devicePixelRatio), qRound(128. * devicePixelRatio / aspectRatio)},
+ {qRound(256 * devicePixelRatio), qRound(256. * devicePixelRatio / aspectRatio)},
+ };
+ return sizes;
+}
+
+QList<QSize> QAppleIconEngine::availableSizes(QIcon::Mode, QIcon::State)
+{
+ const double aspectRatio = isNull() ? 1.0 : m_image.size.width / m_image.size.height;
+ return availableIconSizes(aspectRatio);
+}
+
+QSize QAppleIconEngine::actualSize(const QSize &size, QIcon::Mode /*mode*/, QIcon::State /*state*/)
+{
+ const double inputAspectRatio = isNull() ? 1.0 : m_image.size.width / m_image.size.height;
+ const double outputAspectRatio = size.width() / size.height();
+ QSize result = size;
+ if (outputAspectRatio > inputAspectRatio)
+ result.rwidth() = result.height() * inputAspectRatio;
+ else
+ result.rheight() = result.width() / inputAspectRatio;
+ return result;
+}
+
+QPixmap QAppleIconEngine::pixmap(const QSize &size, QIcon::Mode mode, QIcon::State state)
+{
+ return scaledPixmap(size, mode, state, 1.0);
+}
+
+namespace {
+#if defined(Q_OS_MACOS)
+auto *configuredImage(const NSImage *image, const QColor &color)
+{
+ auto *config = [NSImageSymbolConfiguration configurationWithPointSize:48
+ weight:NSFontWeightRegular
+ scale:NSImageSymbolScaleLarge];
+ if (@available(macOS 12, *)) {
+ auto *primaryColor = [NSColor colorWithSRGBRed:color.redF()
+ green:color.greenF()
+ blue:color.blueF()
+ alpha:color.alphaF()];
+
+ auto *colorConfig = [NSImageSymbolConfiguration configurationWithHierarchicalColor:primaryColor];
+ config = [config configurationByApplyingConfiguration:colorConfig];
+ }
+
+ return [image imageWithSymbolConfiguration:config];
+}
+#elif defined(QT_PLATFORM_UIKIT)
+auto *configuredImage(const UIImage *image, const QColor &color)
+{
+ auto *config = [UIImageSymbolConfiguration configurationWithPointSize:48
+ weight:UIImageSymbolWeightRegular
+ scale:UIImageSymbolScaleLarge];
+
+ if (@available(iOS 15, *)) {
+ auto *primaryColor = [UIColor colorWithRed:color.redF()
+ green:color.greenF()
+ blue:color.blueF()
+ alpha:color.alphaF()];
+
+ auto *colorConfig = [UIImageSymbolConfiguration configurationWithHierarchicalColor:primaryColor];
+ config = [config configurationByApplyingConfiguration:colorConfig];
+ }
+ return [image imageByApplyingSymbolConfiguration:config];
+}
+#endif
+}
+
+QPixmap QAppleIconEngine::scaledPixmap(const QSize &size, QIcon::Mode mode, QIcon::State state, qreal scale)
+{
+ const quint64 cacheKey = calculateCacheKey(mode, state);
+ if (cacheKey != m_cacheKey || m_pixmap.size() != size || m_pixmap.devicePixelRatio() != scale) {
+ const QSize paintSize = actualSize(size, mode, state);
+ const QSize paintOffset = paintSize != size
+ ? (QSizeF(size - paintSize) * 0.5).toSize()
+ : QSize();
+
+ m_pixmap = QPixmap(size * scale);
+ m_pixmap.setDevicePixelRatio(scale);
+ m_pixmap.fill(Qt::transparent);
+
+ QPainter painter(&m_pixmap);
+ paint(&painter, QRect(paintOffset.width(), paintOffset.height(),
+ paintSize.width(), paintSize.height()), mode, state);
+
+ m_cacheKey = cacheKey;
+ }
+ return m_pixmap;
+}
+
+void QAppleIconEngine::paint(QPainter *painter, const QRect &rect, QIcon::Mode mode, QIcon::State state)
+{
+ Q_UNUSED(state);
+
+ QColor color;
+ const QPalette palette;
+ switch (mode) {
+ case QIcon::Normal:
+ color = palette.color(QPalette::Inactive, QPalette::Text);
+ break;
+ case QIcon::Disabled:
+ color = palette.color(QPalette::Disabled, QPalette::Text);
+ break;
+ case QIcon::Active:
+ color = palette.color(QPalette::Active, QPalette::Text);
+ break;
+ case QIcon::Selected:
+ color = palette.color(QPalette::Active, QPalette::HighlightedText);
+ break;
+ }
+ const auto *image = configuredImage(m_image, color);
+
+ QMacCGContext ctx(painter);
+
+#if defined(Q_OS_MACOS)
+ NSGraphicsContext *gc = [NSGraphicsContext graphicsContextWithCGContext:ctx flipped:YES];
+ [NSGraphicsContext saveGraphicsState];
+ [NSGraphicsContext setCurrentContext:gc];
+
+ const NSSize pixmapSize = NSMakeSize(rect.width(), rect.height());
+ [image setSize:pixmapSize];
+ const NSRect sourceRect = NSMakeRect(0, 0, pixmapSize.width, pixmapSize.height);
+ const NSRect iconRect = NSMakeRect(rect.x(), rect.y(), pixmapSize.width, pixmapSize.height);
+
+ [image drawInRect:iconRect fromRect:sourceRect operation:NSCompositingOperationSourceOver fraction:1.0 respectFlipped:YES hints:nil];
+ [NSGraphicsContext restoreGraphicsState];
+#elif defined(QT_PLATFORM_UIKIT)
+ UIGraphicsPushContext(ctx);
+ const CGRect cgrect = CGRectMake(rect.x(), rect.y(), rect.width(), rect.height());
+ [image drawInRect:cgrect];
+ UIGraphicsPopContext();
+#endif
+}
+
+QT_END_NAMESPACE
diff --git a/src/gui/platform/darwin/qappleiconengine_p.h b/src/gui/platform/darwin/qappleiconengine_p.h
new file mode 100644
index 0000000000..2a4ff7fc64
--- /dev/null
+++ b/src/gui/platform/darwin/qappleiconengine_p.h
@@ -0,0 +1,64 @@
+// Copyright (C) 2023 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
+
+#ifndef QAPPLEICONENGINE_P_H
+#define QAPPLEICONENGINE_P_H
+
+//
+// W A R N I N G
+// -------------
+//
+// This file is not part of the Qt API. It exists purely as an
+// implementation detail. This header file may change from version to
+// version without notice, or even be removed.
+//
+// We mean it.
+//
+
+#include <QtGui/qiconengine.h>
+
+#include <QtCore/private/qcore_mac_p.h>
+
+Q_FORWARD_DECLARE_OBJC_CLASS(UIImage);
+Q_FORWARD_DECLARE_OBJC_CLASS(NSImage);
+
+QT_BEGIN_NAMESPACE
+
+class Q_GUI_EXPORT QAppleIconEngine : public QIconEngine
+{
+public:
+ QAppleIconEngine(const QString &iconName);
+ ~QAppleIconEngine();
+ QIconEngine *clone() const override;
+ QString key() const override;
+ QString iconName() override;
+ bool isNull() override;
+
+ QList<QSize> availableSizes(QIcon::Mode, QIcon::State) override;
+ QSize actualSize(const QSize &size, QIcon::Mode mode, QIcon::State state) override;
+ QPixmap pixmap(const QSize &size, QIcon::Mode mode, QIcon::State state) override;
+ QPixmap scaledPixmap(const QSize &size, QIcon::Mode mode, QIcon::State state, qreal scale) override;
+ void paint(QPainter *painter, const QRect &rect, QIcon::Mode mode, QIcon::State state) override;
+
+ static QList<QSize> availableIconSizes(double aspectRatio = 1.0);
+
+private:
+ static constexpr quint64 calculateCacheKey(QIcon::Mode mode, QIcon::State state)
+ {
+ return (quint64(mode) << 32) | state;
+ }
+
+ const QString m_iconName;
+#if defined(Q_OS_MACOS)
+ const NSImage *m_image;
+#elif defined(QT_PLATFORM_UIKIT)
+ const UIImage *m_image;
+#endif
+ mutable QPixmap m_pixmap;
+ mutable quint64 m_cacheKey = {};
+};
+
+
+QT_END_NAMESPACE
+
+#endif // QAPPLEICONENGINE_P_H
diff --git a/src/gui/platform/darwin/qapplekeymapper.mm b/src/gui/platform/darwin/qapplekeymapper.mm
new file mode 100644
index 0000000000..b8ff5c9d6d
--- /dev/null
+++ b/src/gui/platform/darwin/qapplekeymapper.mm
@@ -0,0 +1,717 @@
+// Copyright (C) 2021 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
+
+#include <qglobal.h>
+
+#ifdef Q_OS_MACOS
+#include <AppKit/AppKit.h>
+#endif
+
+#if defined(QT_PLATFORM_UIKIT)
+#include <UIKit/UIKit.h>
+#endif
+
+#include "qapplekeymapper_p.h"
+
+#include <QtCore/qloggingcategory.h>
+#include <QtGui/QGuiApplication>
+
+QT_BEGIN_NAMESPACE
+
+Q_LOGGING_CATEGORY(lcQpaKeyMapperKeys, "qt.qpa.keymapper.keys");
+
+static Qt::KeyboardModifiers swapModifiersIfNeeded(const Qt::KeyboardModifiers modifiers)
+{
+ if (QCoreApplication::testAttribute(Qt::AA_MacDontSwapCtrlAndMeta))
+ return modifiers;
+
+ Qt::KeyboardModifiers swappedModifiers = modifiers;
+ swappedModifiers &= ~(Qt::MetaModifier | Qt::ControlModifier);
+
+ if (modifiers & Qt::ControlModifier)
+ swappedModifiers |= Qt::MetaModifier;
+ if (modifiers & Qt::MetaModifier)
+ swappedModifiers |= Qt::ControlModifier;
+
+ return swappedModifiers;
+}
+
+#ifdef Q_OS_MACOS
+static constexpr std::tuple<NSEventModifierFlags, Qt::KeyboardModifier> cocoaModifierMap[] = {
+ { NSEventModifierFlagShift, Qt::ShiftModifier },
+ { NSEventModifierFlagControl, Qt::ControlModifier },
+ { NSEventModifierFlagCommand, Qt::MetaModifier },
+ { NSEventModifierFlagOption, Qt::AltModifier },
+ { NSEventModifierFlagNumericPad, Qt::KeypadModifier }
+};
+
+Qt::KeyboardModifiers QAppleKeyMapper::fromCocoaModifiers(NSEventModifierFlags cocoaModifiers)
+{
+ Qt::KeyboardModifiers qtModifiers = Qt::NoModifier;
+ for (const auto &[cocoaModifier, qtModifier] : cocoaModifierMap) {
+ if (cocoaModifiers & cocoaModifier)
+ qtModifiers |= qtModifier;
+ }
+
+ return swapModifiersIfNeeded(qtModifiers);
+}
+
+NSEventModifierFlags QAppleKeyMapper::toCocoaModifiers(Qt::KeyboardModifiers qtModifiers)
+{
+ qtModifiers = swapModifiersIfNeeded(qtModifiers);
+
+ NSEventModifierFlags cocoaModifiers = 0;
+ for (const auto &[cocoaModifier, qtModifier] : cocoaModifierMap) {
+ if (qtModifiers & qtModifier)
+ cocoaModifiers |= cocoaModifier;
+ }
+
+ return cocoaModifiers;
+}
+
+using CarbonModifiers = UInt32; // As opposed to EventModifiers which is UInt16
+
+static CarbonModifiers toCarbonModifiers(Qt::KeyboardModifiers qtModifiers)
+{
+ qtModifiers = swapModifiersIfNeeded(qtModifiers);
+
+ static constexpr std::tuple<int, Qt::KeyboardModifier> carbonModifierMap[] = {
+ { shiftKey, Qt::ShiftModifier },
+ { controlKey, Qt::ControlModifier },
+ { cmdKey, Qt::MetaModifier },
+ { optionKey, Qt::AltModifier },
+ { kEventKeyModifierNumLockMask, Qt::KeypadModifier }
+ };
+
+ CarbonModifiers carbonModifiers = 0;
+ for (const auto &[carbonModifier, qtModifier] : carbonModifierMap) {
+ if (qtModifiers & qtModifier)
+ carbonModifiers |= carbonModifier;
+ }
+
+ return carbonModifiers;
+}
+
+// Keyboard keys (non-modifiers)
+static QHash<char16_t, Qt::Key> standardKeys = {
+ { kHomeCharCode, Qt::Key_Home },
+ { kEnterCharCode, Qt::Key_Enter },
+ { kEndCharCode, Qt::Key_End },
+ { kBackspaceCharCode, Qt::Key_Backspace },
+ { kTabCharCode, Qt::Key_Tab },
+ { kPageUpCharCode, Qt::Key_PageUp },
+ { kPageDownCharCode, Qt::Key_PageDown },
+ { kReturnCharCode, Qt::Key_Return },
+ { kEscapeCharCode, Qt::Key_Escape },
+ { kLeftArrowCharCode, Qt::Key_Left },
+ { kRightArrowCharCode, Qt::Key_Right },
+ { kUpArrowCharCode, Qt::Key_Up },
+ { kDownArrowCharCode, Qt::Key_Down },
+ { kHelpCharCode, Qt::Key_Help },
+ { kDeleteCharCode, Qt::Key_Delete },
+ // ASCII maps, for debugging
+ { ':', Qt::Key_Colon },
+ { ';', Qt::Key_Semicolon },
+ { '<', Qt::Key_Less },
+ { '=', Qt::Key_Equal },
+ { '>', Qt::Key_Greater },
+ { '?', Qt::Key_Question },
+ { '@', Qt::Key_At },
+ { ' ', Qt::Key_Space },
+ { '!', Qt::Key_Exclam },
+ { '"', Qt::Key_QuoteDbl },
+ { '#', Qt::Key_NumberSign },
+ { '$', Qt::Key_Dollar },
+ { '%', Qt::Key_Percent },
+ { '&', Qt::Key_Ampersand },
+ { '\'', Qt::Key_Apostrophe },
+ { '(', Qt::Key_ParenLeft },
+ { ')', Qt::Key_ParenRight },
+ { '*', Qt::Key_Asterisk },
+ { '+', Qt::Key_Plus },
+ { ',', Qt::Key_Comma },
+ { '-', Qt::Key_Minus },
+ { '.', Qt::Key_Period },
+ { '/', Qt::Key_Slash },
+ { '[', Qt::Key_BracketLeft },
+ { ']', Qt::Key_BracketRight },
+ { '\\', Qt::Key_Backslash },
+ { '_', Qt::Key_Underscore },
+ { '`', Qt::Key_QuoteLeft },
+ { '{', Qt::Key_BraceLeft },
+ { '}', Qt::Key_BraceRight },
+ { '|', Qt::Key_Bar },
+ { '~', Qt::Key_AsciiTilde },
+ { '^', Qt::Key_AsciiCircum }
+};
+
+static QHash<char16_t, Qt::Key> virtualKeys = {
+ { kVK_F1, Qt::Key_F1 },
+ { kVK_F2, Qt::Key_F2 },
+ { kVK_F3, Qt::Key_F3 },
+ { kVK_F4, Qt::Key_F4 },
+ { kVK_F5, Qt::Key_F5 },
+ { kVK_F6, Qt::Key_F6 },
+ { kVK_F7, Qt::Key_F7 },
+ { kVK_F8, Qt::Key_F8 },
+ { kVK_F9, Qt::Key_F9 },
+ { kVK_F10, Qt::Key_F10 },
+ { kVK_F11, Qt::Key_F11 },
+ { kVK_F12, Qt::Key_F12 },
+ { kVK_F13, Qt::Key_F13 },
+ { kVK_F14, Qt::Key_F14 },
+ { kVK_F15, Qt::Key_F15 },
+ { kVK_F16, Qt::Key_F16 },
+ { kVK_Return, Qt::Key_Return },
+ { kVK_Tab, Qt::Key_Tab },
+ { kVK_Escape, Qt::Key_Escape },
+ { kVK_Help, Qt::Key_Help },
+ { kVK_UpArrow, Qt::Key_Up },
+ { kVK_DownArrow, Qt::Key_Down },
+ { kVK_LeftArrow, Qt::Key_Left },
+ { kVK_RightArrow, Qt::Key_Right },
+ { kVK_PageUp, Qt::Key_PageUp },
+ { kVK_PageDown, Qt::Key_PageDown }
+};
+
+static QHash<char16_t, Qt::Key> functionKeys = {
+ { NSUpArrowFunctionKey, Qt::Key_Up },
+ { NSDownArrowFunctionKey, Qt::Key_Down },
+ { NSLeftArrowFunctionKey, Qt::Key_Left },
+ { NSRightArrowFunctionKey, Qt::Key_Right },
+ // F1-35 function keys handled manually below
+ { NSInsertFunctionKey, Qt::Key_Insert },
+ { NSDeleteFunctionKey, Qt::Key_Delete },
+ { NSHomeFunctionKey, Qt::Key_Home },
+ { NSEndFunctionKey, Qt::Key_End },
+ { NSPageUpFunctionKey, Qt::Key_PageUp },
+ { NSPageDownFunctionKey, Qt::Key_PageDown },
+ { NSPrintScreenFunctionKey, Qt::Key_Print },
+ { NSScrollLockFunctionKey, Qt::Key_ScrollLock },
+ { NSPauseFunctionKey, Qt::Key_Pause },
+ { NSSysReqFunctionKey, Qt::Key_SysReq },
+ { NSMenuFunctionKey, Qt::Key_Menu },
+ { NSPrintFunctionKey, Qt::Key_Printer },
+ { NSClearDisplayFunctionKey, Qt::Key_Clear },
+ { NSInsertCharFunctionKey, Qt::Key_Insert },
+ { NSDeleteCharFunctionKey, Qt::Key_Delete },
+ { NSSelectFunctionKey, Qt::Key_Select },
+ { NSExecuteFunctionKey, Qt::Key_Execute },
+ { NSUndoFunctionKey, Qt::Key_Undo },
+ { NSRedoFunctionKey, Qt::Key_Redo },
+ { NSFindFunctionKey, Qt::Key_Find },
+ { NSHelpFunctionKey, Qt::Key_Help },
+ { NSModeSwitchFunctionKey, Qt::Key_Mode_switch }
+};
+
+static int toKeyCode(const QChar &key, int virtualKey, int modifiers)
+{
+ qCDebug(lcQpaKeyMapperKeys, "Mapping key: %d (0x%04x) / vk %d (0x%04x)",
+ key.unicode(), key.unicode(), virtualKey, virtualKey);
+
+ if (key == QChar(kClearCharCode) && virtualKey == 0x47)
+ return Qt::Key_Clear;
+
+ if (key.isDigit()) {
+ qCDebug(lcQpaKeyMapperKeys, "Got digit key: %d", key.digitValue());
+ return key.digitValue() + Qt::Key_0;
+ }
+
+ if (key.isLetter()) {
+ qCDebug(lcQpaKeyMapperKeys, "Got letter key: %d", (key.toUpper().unicode() - 'A'));
+ return (key.toUpper().unicode() - 'A') + Qt::Key_A;
+ }
+ if (key.isSymbol()) {
+ qCDebug(lcQpaKeyMapperKeys, "Got symbol key: %d", (key.unicode()));
+ return key.unicode();
+ }
+
+ if (auto qtKey = standardKeys.value(key.unicode())) {
+ // To work like Qt for X11 we issue Backtab when Shift + Tab are pressed
+ if (qtKey == Qt::Key_Tab && (modifiers & Qt::ShiftModifier)) {
+ qCDebug(lcQpaKeyMapperKeys, "Got key: Qt::Key_Backtab");
+ return Qt::Key_Backtab;
+ }
+
+ qCDebug(lcQpaKeyMapperKeys) << "Got" << qtKey;
+ return qtKey;
+ }
+
+ // Last ditch try to match the scan code
+ if (auto qtKey = virtualKeys.value(virtualKey)) {
+ qCDebug(lcQpaKeyMapperKeys) << "Got scancode" << qtKey;
+ return qtKey;
+ }
+
+ // Check if they belong to key codes in private unicode range
+ if (key >= QChar(NSUpArrowFunctionKey) && key <= QChar(NSModeSwitchFunctionKey)) {
+ if (auto qtKey = functionKeys.value(key.unicode())) {
+ qCDebug(lcQpaKeyMapperKeys) << "Got" << qtKey;
+ return qtKey;
+ } else if (key >= QChar(NSF1FunctionKey) && key <= QChar(NSF35FunctionKey)) {
+ auto functionKey = Qt::Key_F1 + (key.unicode() - NSF1FunctionKey) ;
+ qCDebug(lcQpaKeyMapperKeys) << "Got" << functionKey;
+ return functionKey;
+ }
+ }
+
+ qCDebug(lcQpaKeyMapperKeys, "Unknown case.. %d[%d] %d", key.unicode(), key.toLatin1(), virtualKey);
+ return Qt::Key_unknown;
+}
+
+// --------- Cocoa key mapping moved from Qt Core ---------
+
+static const int NSEscapeCharacter = 27; // not defined by Cocoa headers
+
+static const QHash<char16_t, Qt::Key> cocoaKeys = {
+ { NSEnterCharacter, Qt::Key_Enter },
+ { NSBackspaceCharacter, Qt::Key_Backspace },
+ { NSTabCharacter, Qt::Key_Tab },
+ { NSNewlineCharacter, Qt::Key_Return },
+ { NSCarriageReturnCharacter, Qt::Key_Return },
+ { NSBackTabCharacter, Qt::Key_Backtab },
+ { NSEscapeCharacter, Qt::Key_Escape },
+ { NSDeleteCharacter, Qt::Key_Backspace },
+ { NSUpArrowFunctionKey, Qt::Key_Up },
+ { NSDownArrowFunctionKey, Qt::Key_Down },
+ { NSLeftArrowFunctionKey, Qt::Key_Left },
+ { NSRightArrowFunctionKey, Qt::Key_Right },
+ { NSF1FunctionKey, Qt::Key_F1 },
+ { NSF2FunctionKey, Qt::Key_F2 },
+ { NSF3FunctionKey, Qt::Key_F3 },
+ { NSF4FunctionKey, Qt::Key_F4 },
+ { NSF5FunctionKey, Qt::Key_F5 },
+ { NSF6FunctionKey, Qt::Key_F6 },
+ { NSF7FunctionKey, Qt::Key_F7 },
+ { NSF8FunctionKey, Qt::Key_F8 },
+ { NSF9FunctionKey, Qt::Key_F9 },
+ { NSF10FunctionKey, Qt::Key_F10 },
+ { NSF11FunctionKey, Qt::Key_F11 },
+ { NSF12FunctionKey, Qt::Key_F12 },
+ { NSF13FunctionKey, Qt::Key_F13 },
+ { NSF14FunctionKey, Qt::Key_F14 },
+ { NSF15FunctionKey, Qt::Key_F15 },
+ { NSF16FunctionKey, Qt::Key_F16 },
+ { NSF17FunctionKey, Qt::Key_F17 },
+ { NSF18FunctionKey, Qt::Key_F18 },
+ { NSF19FunctionKey, Qt::Key_F19 },
+ { NSF20FunctionKey, Qt::Key_F20 },
+ { NSF21FunctionKey, Qt::Key_F21 },
+ { NSF22FunctionKey, Qt::Key_F22 },
+ { NSF23FunctionKey, Qt::Key_F23 },
+ { NSF24FunctionKey, Qt::Key_F24 },
+ { NSF25FunctionKey, Qt::Key_F25 },
+ { NSF26FunctionKey, Qt::Key_F26 },
+ { NSF27FunctionKey, Qt::Key_F27 },
+ { NSF28FunctionKey, Qt::Key_F28 },
+ { NSF29FunctionKey, Qt::Key_F29 },
+ { NSF30FunctionKey, Qt::Key_F30 },
+ { NSF31FunctionKey, Qt::Key_F31 },
+ { NSF32FunctionKey, Qt::Key_F32 },
+ { NSF33FunctionKey, Qt::Key_F33 },
+ { NSF34FunctionKey, Qt::Key_F34 },
+ { NSF35FunctionKey, Qt::Key_F35 },
+ { NSInsertFunctionKey, Qt::Key_Insert },
+ { NSDeleteFunctionKey, Qt::Key_Delete },
+ { NSHomeFunctionKey, Qt::Key_Home },
+ { NSEndFunctionKey, Qt::Key_End },
+ { NSPageUpFunctionKey, Qt::Key_PageUp },
+ { NSPageDownFunctionKey, Qt::Key_PageDown },
+ { NSPrintScreenFunctionKey, Qt::Key_Print },
+ { NSScrollLockFunctionKey, Qt::Key_ScrollLock },
+ { NSPauseFunctionKey, Qt::Key_Pause },
+ { NSSysReqFunctionKey, Qt::Key_SysReq },
+ { NSMenuFunctionKey, Qt::Key_Menu },
+ { NSHelpFunctionKey, Qt::Key_Help },
+};
+
+QChar QAppleKeyMapper::toCocoaKey(Qt::Key key)
+{
+ // Prioritize overloaded keys
+ if (key == Qt::Key_Return)
+ return QChar(NSCarriageReturnCharacter);
+ if (key == Qt::Key_Backspace)
+ return QChar(NSBackspaceCharacter);
+
+ Q_CONSTINIT static QHash<Qt::Key, char16_t> reverseCocoaKeys;
+ if (reverseCocoaKeys.isEmpty()) {
+ reverseCocoaKeys.reserve(cocoaKeys.size());
+ for (auto it = cocoaKeys.begin(); it != cocoaKeys.end(); ++it)
+ reverseCocoaKeys.insert(it.value(), it.key());
+ }
+
+ return reverseCocoaKeys.value(key);
+}
+
+Qt::Key QAppleKeyMapper::fromCocoaKey(QChar keyCode)
+{
+ if (auto key = cocoaKeys.value(keyCode.unicode()))
+ return key;
+
+ return Qt::Key(keyCode.toUpper().unicode());
+}
+
+// ------------------------------------------------
+
+Qt::KeyboardModifiers QAppleKeyMapper::queryKeyboardModifiers() const
+{
+ return fromCocoaModifiers(NSEvent.modifierFlags);
+}
+
+bool QAppleKeyMapper::updateKeyboard()
+{
+ QCFType<TISInputSourceRef> source = TISCopyInputMethodKeyboardLayoutOverride();
+ if (!source)
+ source = TISCopyCurrentKeyboardInputSource();
+
+ if (m_keyboardMode != NullMode && source == m_currentInputSource)
+ return false;
+
+ Q_ASSERT(source);
+ m_currentInputSource = source;
+ m_keyboardKind = LMGetKbdType();
+
+ m_keyMap.clear();
+
+ if (auto data = CFDataRef(TISGetInputSourceProperty(source, kTISPropertyUnicodeKeyLayoutData))) {
+ const UCKeyboardLayout *uchrData = reinterpret_cast<const UCKeyboardLayout *>(CFDataGetBytePtr(data));
+ Q_ASSERT(uchrData);
+ m_keyboardLayoutFormat = uchrData;
+ m_keyboardMode = UnicodeMode;
+ } else {
+ m_keyboardLayoutFormat = nullptr;
+ m_keyboardMode = NullMode;
+ }
+
+ qCDebug(lcQpaKeyMapper) << "Updated keyboard to"
+ << QString::fromCFString(CFStringRef(TISGetInputSourceProperty(
+ m_currentInputSource, kTISPropertyLocalizedName)));
+
+ return true;
+}
+
+static constexpr Qt::KeyboardModifiers modifierCombinations[] = {
+ Qt::NoModifier, // 0
+ Qt::ShiftModifier, // 1
+ Qt::ControlModifier, // 2
+ Qt::ControlModifier | Qt::ShiftModifier, // 3
+ Qt::AltModifier, // 4
+ Qt::AltModifier | Qt::ShiftModifier, // 5
+ Qt::AltModifier | Qt::ControlModifier, // 6
+ Qt::AltModifier | Qt::ShiftModifier | Qt::ControlModifier, // 7
+ Qt::MetaModifier, // 8
+ Qt::MetaModifier | Qt::ShiftModifier, // 9
+ Qt::MetaModifier | Qt::ControlModifier, // 10
+ Qt::MetaModifier | Qt::ControlModifier | Qt::ShiftModifier, // 11
+ Qt::MetaModifier | Qt::AltModifier, // 12
+ Qt::MetaModifier | Qt::AltModifier | Qt::ShiftModifier, // 13
+ Qt::MetaModifier | Qt::AltModifier | Qt::ControlModifier, // 14
+ Qt::MetaModifier | Qt::AltModifier | Qt::ShiftModifier | Qt::ControlModifier, // 15
+};
+
+/*
+ Returns a key map for the given \virtualKey based on all
+ possible modifier combinations.
+*/
+const QAppleKeyMapper::KeyMap &QAppleKeyMapper::keyMapForKey(VirtualKeyCode virtualKey) const
+{
+ static_assert(sizeof(modifierCombinations) / sizeof(Qt::KeyboardModifiers) == kNumModifierCombinations);
+
+ const_cast<QAppleKeyMapper *>(this)->updateKeyboard();
+
+ auto &keyMap = m_keyMap[virtualKey];
+ if (keyMap[Qt::NoModifier] != Qt::Key_unknown)
+ return keyMap; // Already filled
+
+ qCDebug(lcQpaKeyMapper, "Updating key map for virtual key 0x%02x", (uint)virtualKey);
+
+ // Key mapping via [NSEvent charactersByApplyingModifiers:] only works for key down
+ // events, but we might (wrongly) get into this code path for other key events such
+ // as NSEventTypeFlagsChanged.
+ const bool canMapCocoaEvent = NSApp.currentEvent.type == NSEventTypeKeyDown;
+
+ if (!canMapCocoaEvent)
+ qCWarning(lcQpaKeyMapper) << "Could not map key to character for event" << NSApp.currentEvent;
+
+ for (int i = 0; i < kNumModifierCombinations; ++i) {
+ Q_ASSERT(!i || keyMap[i] == 0);
+
+ auto qtModifiers = modifierCombinations[i];
+ auto carbonModifiers = toCarbonModifiers(qtModifiers);
+ const UInt32 modifierKeyState = (carbonModifiers >> 8) & 0xFF;
+
+ UInt32 deadKeyState = 0;
+ static const UniCharCount maxStringLength = 10;
+ static UniChar unicodeString[maxStringLength];
+ UniCharCount actualStringLength = 0;
+ OSStatus err = UCKeyTranslate(m_keyboardLayoutFormat, virtualKey,
+ kUCKeyActionDown, modifierKeyState, m_keyboardKind,
+ kUCKeyTranslateNoDeadKeysMask, &deadKeyState,
+ maxStringLength, &actualStringLength,
+ unicodeString);
+
+ // Use translated Unicode key if valid
+ QChar carbonUnicodeKey;
+ if (err == noErr && actualStringLength)
+ carbonUnicodeKey = QChar(unicodeString[0]);
+
+ if (@available(macOS 10.15, *)) {
+ if (canMapCocoaEvent) {
+ // Until we've verified that the Cocoa API works as expected
+ // we first run the event through the Carbon APIs and then
+ // compare the results to Cocoa.
+ auto cocoaModifiers = toCocoaModifiers(qtModifiers);
+ auto *charactersWithModifiers = [NSApp.currentEvent charactersByApplyingModifiers:cocoaModifiers];
+
+ QChar cocoaUnicodeKey;
+ if (charactersWithModifiers.length > 0)
+ cocoaUnicodeKey = QChar([charactersWithModifiers characterAtIndex:0]);
+
+ if (cocoaUnicodeKey != carbonUnicodeKey) {
+ qCWarning(lcQpaKeyMapper) << "Mismatch between Cocoa" << cocoaUnicodeKey
+ << "and Carbon" << carbonUnicodeKey << "for virtual key" << virtualKey
+ << "with" << qtModifiers;
+ }
+ }
+ }
+
+ int qtKey = toKeyCode(carbonUnicodeKey, virtualKey, qtModifiers);
+ if (qtKey == Qt::Key_unknown)
+ qtKey = carbonUnicodeKey.unicode();
+
+ keyMap[i] = qtKey;
+
+ qCDebug(lcQpaKeyMapper).verbosity(0) << "\t" << qtModifiers
+ << "+" << qUtf8Printable(QString::asprintf("0x%02x", virtualKey))
+ << "=" << qUtf8Printable(QString::asprintf("%d / 0x%02x /", qtKey, qtKey))
+ << QKeySequence(qtKey).toString();
+ }
+
+ return keyMap;
+}
+
+/*
+ Compute the possible key combinations that can map to the event's
+ virtual key and modifiers, in the current keyboard layout.
+
+ For example, given a normal US keyboard layout, the virtual key
+ 23 combined with the Alt (⌥) and Shift (⇧) modifiers, can map
+ to the following key combinations:
+
+ - Alt+Shift+5
+ - Alt+%
+ - Shift+∞
+ - fi
+
+ The function builds on a key map produced by keyMapForKey(),
+ where each modifier-key combination has been mapped to the
+ key it will produce.
+*/
+QList<QKeyCombination> QAppleKeyMapper::possibleKeyCombinations(const QKeyEvent *event) const
+{
+ QList<QKeyCombination> ret;
+
+ const auto nativeVirtualKey = event->nativeVirtualKey();
+ if (!nativeVirtualKey)
+ return ret;
+
+ auto keyMap = keyMapForKey(nativeVirtualKey);
+
+ auto unmodifiedKey = keyMap[Qt::NoModifier];
+ Q_ASSERT(unmodifiedKey != Qt::Key_unknown);
+
+ auto eventModifiers = event->modifiers();
+
+ int startingModifierLayer = 0;
+ if (toCocoaModifiers(eventModifiers) & NSEventModifierFlagCommand) {
+ // When the Command key is pressed AppKit seems to do key equivalent
+ // matching using a Latin/Roman interpretation of the current keyboard
+ // layout. For example, for a Greek layout, pressing Option+Command+C
+ // produces a key event with chars="ç" and unmodchars="ψ", but AppKit
+ // still treats this as a match for a key equivalent of Option+Command+C.
+ // We can't do the same by just applying the modifiers to our key map,
+ // as that too contains "ψ" for the Option+Command combination. What we
+ // can do instead is take advantage of the fact that the Command
+ // modifier layer in all/most keyboard layouts contains a Latin
+ // layer. We then combine that with the modifiers of the event
+ // to produce the resulting "Latin" key combination.
+ static constexpr int kCommandLayer = 2;
+ ret << QKeyCombination::fromCombined(
+ int(eventModifiers) + int(keyMap[kCommandLayer]));
+
+ // If the unmodified key is outside of Latin1, we also treat
+ // that as a valid key combination, even if AppKit natively
+ // does not. For example, for a Greek layout, we still want
+ // to support Option+Command+ψ as a key combination, as it's
+ // unlikely to clash with the Latin key combination we added
+ // above.
+
+ // However, if the unmodified key is within Latin1, we skip
+ // it, to avoid these types of conflicts. For example, in
+ // the same Greek layout, pressing the key next to Tab will
+ // produce a Latin ';' symbol, but we've already treated that
+ // as 'q' above, thanks to the Command modifier, so we skip
+ // the potential Command+; key combination. This is also in
+ // line with what AppKit natively does.
+
+ // Skipping Latin1 unmodified keys also handles the case of
+ // a Latin layout, where the unmodified and modified keys
+ // are the same.
+
+ if (unmodifiedKey <= 0xff)
+ startingModifierLayer = 1;
+ }
+
+ // FIXME: We only compute the first 8 combinations. Why?
+ for (int i = startingModifierLayer; i < 15; ++i) {
+ auto keyAfterApplyingModifiers = keyMap[i];
+ if (!keyAfterApplyingModifiers)
+ continue;
+
+ // Include key if the event modifiers match exactly,
+ // or are a superset of the current candidate modifiers.
+ auto candidateModifiers = modifierCombinations[i];
+ if ((eventModifiers & candidateModifiers) == candidateModifiers) {
+ // If the event includes more modifiers than the candidate they
+ // will need to be included in the resulting key combination.
+ auto additionalModifiers = eventModifiers & ~candidateModifiers;
+
+ auto keyCombination = QKeyCombination::fromCombined(
+ int(additionalModifiers) + int(keyAfterApplyingModifiers));
+
+ // If there's an existing key combination with the same key,
+ // but a different set of modifiers, we want to choose only
+ // one of them, by priority (see below).
+ const auto existingCombination = std::find_if(
+ ret.begin(), ret.end(), [&](auto existingCombination) {
+ return existingCombination.key() == keyAfterApplyingModifiers;
+ });
+
+ if (existingCombination != ret.end()) {
+ // We prioritize the combination with the more specific
+ // modifiers. In the case where the number of modifiers
+ // are the same, we want to prioritize Command over Option
+ // over Control over Shift. Unfortunately the order (and
+ // hence value) of the modifiers in Qt::KeyboardModifier
+ // does not match our preferred order when Control and
+ // Meta is switched, but we can work around that by
+ // explicitly swapping the modifiers and using that
+ // for the comparison. This also works when the
+ // Qt::AA_MacDontSwapCtrlAndMeta application attribute
+ // is set, as the incoming modifiers are then left
+ // as is, and we can still trust the order.
+ auto existingModifiers = swapModifiersIfNeeded(existingCombination->keyboardModifiers());
+ auto replacementModifiers = swapModifiersIfNeeded(additionalModifiers);
+ if (replacementModifiers > existingModifiers)
+ *existingCombination = keyCombination;
+ } else {
+ // All is good, no existing combination has this key
+ ret << keyCombination;
+ }
+ }
+ }
+
+ return ret;
+}
+
+
+
+#else // iOS
+
+Qt::Key QAppleKeyMapper::fromNSString(Qt::KeyboardModifiers qtModifiers, NSString *characters,
+ NSString *charactersIgnoringModifiers, QString &text)
+{
+ if ([characters isEqualToString:@"\t"]) {
+ if (qtModifiers & Qt::ShiftModifier)
+ return Qt::Key_Backtab;
+ return Qt::Key_Tab;
+ } else if ([characters isEqualToString:@"\r"]) {
+ if (qtModifiers & Qt::KeypadModifier)
+ return Qt::Key_Enter;
+ return Qt::Key_Return;
+ }
+ if ([characters length] != 0 || [charactersIgnoringModifiers length] != 0) {
+ QChar ch;
+ if (((qtModifiers & Qt::MetaModifier) || (qtModifiers & Qt::AltModifier)) &&
+ ([charactersIgnoringModifiers length] != 0)) {
+ ch = QChar([charactersIgnoringModifiers characterAtIndex:0]);
+ } else if ([characters length] != 0) {
+ ch = QChar([characters characterAtIndex:0]);
+ }
+ if (!(qtModifiers & (Qt::ControlModifier | Qt::MetaModifier)) &&
+ (ch.unicode() < 0xf700 || ch.unicode() > 0xf8ff)) {
+ text = QString::fromNSString(characters);
+ }
+ if (!ch.isNull())
+ return Qt::Key(ch.toUpper().unicode());
+ }
+ return Qt::Key_unknown;
+}
+
+// Keyboard keys (non-modifiers)
+API_AVAILABLE(ios(13.4)) Qt::Key QAppleKeyMapper::fromUIKitKey(NSString *keyCode)
+{
+ static QHash<NSString *, Qt::Key> uiKitKeys = {
+ { UIKeyInputF1, Qt::Key_F1 },
+ { UIKeyInputF2, Qt::Key_F2 },
+ { UIKeyInputF3, Qt::Key_F3 },
+ { UIKeyInputF4, Qt::Key_F4 },
+ { UIKeyInputF5, Qt::Key_F5 },
+ { UIKeyInputF6, Qt::Key_F6 },
+ { UIKeyInputF7, Qt::Key_F7 },
+ { UIKeyInputF8, Qt::Key_F8 },
+ { UIKeyInputF9, Qt::Key_F9 },
+ { UIKeyInputF10, Qt::Key_F10 },
+ { UIKeyInputF11, Qt::Key_F11 },
+ { UIKeyInputF12, Qt::Key_F12 },
+ { UIKeyInputHome, Qt::Key_Home },
+ { UIKeyInputEnd, Qt::Key_End },
+ { UIKeyInputPageUp, Qt::Key_PageUp },
+ { UIKeyInputPageDown, Qt::Key_PageDown },
+ { UIKeyInputEscape, Qt::Key_Escape },
+ { UIKeyInputUpArrow, Qt::Key_Up },
+ { UIKeyInputDownArrow, Qt::Key_Down },
+ { UIKeyInputLeftArrow, Qt::Key_Left },
+ { UIKeyInputRightArrow, Qt::Key_Right }
+ };
+
+ if (auto key = uiKitKeys.value(keyCode))
+ return key;
+
+ return Qt::Key_unknown;
+}
+
+static constexpr std::tuple<ulong, Qt::KeyboardModifier> uiKitModifierMap[] = {
+ { UIKeyModifierShift, Qt::ShiftModifier },
+ { UIKeyModifierControl, Qt::ControlModifier },
+ { UIKeyModifierCommand, Qt::MetaModifier },
+ { UIKeyModifierAlternate, Qt::AltModifier },
+ { UIKeyModifierNumericPad, Qt::KeypadModifier }
+};
+
+ulong QAppleKeyMapper::toUIKitModifiers(Qt::KeyboardModifiers qtModifiers)
+{
+ qtModifiers = swapModifiersIfNeeded(qtModifiers);
+
+ ulong nativeModifiers = 0;
+ for (const auto &[nativeModifier, qtModifier] : uiKitModifierMap) {
+ if (qtModifiers & qtModifier)
+ nativeModifiers |= nativeModifier;
+ }
+
+ return nativeModifiers;
+}
+
+Qt::KeyboardModifiers QAppleKeyMapper::fromUIKitModifiers(ulong nativeModifiers)
+{
+ Qt::KeyboardModifiers qtModifiers = Qt::NoModifier;
+ for (const auto &[nativeModifier, qtModifier] : uiKitModifierMap) {
+ if (nativeModifiers & nativeModifier)
+ qtModifiers |= qtModifier;
+ }
+
+ return swapModifiersIfNeeded(qtModifiers);
+}
+#endif
+
+QT_END_NAMESPACE
diff --git a/src/gui/platform/darwin/qapplekeymapper_p.h b/src/gui/platform/darwin/qapplekeymapper_p.h
new file mode 100644
index 0000000000..1f3494d16f
--- /dev/null
+++ b/src/gui/platform/darwin/qapplekeymapper_p.h
@@ -0,0 +1,82 @@
+// Copyright (C) 2021 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
+
+#ifndef QAPPLEKEYMAPPER_H
+#define QAPPLEKEYMAPPER_H
+
+//
+// W A R N I N G
+// -------------
+//
+// This file is not part of the Qt API. It exists purely as an
+// implementation detail. This header file may change from version to
+// version without notice, or even be removed.
+//
+// We mean it.
+//
+
+#ifdef Q_OS_MACOS
+#include <Carbon/Carbon.h>
+#endif
+
+#include <qpa/qplatformkeymapper.h>
+
+#include <QtCore/QList>
+#include <QtCore/QHash>
+#include <QtGui/QKeyEvent>
+
+#include <QtCore/private/qcore_mac_p.h>
+
+QT_BEGIN_NAMESPACE
+
+class Q_GUI_EXPORT QAppleKeyMapper : public QPlatformKeyMapper
+{
+public:
+ Qt::KeyboardModifiers queryKeyboardModifiers() const override;
+ QList<QKeyCombination> possibleKeyCombinations(const QKeyEvent *event) const override;
+
+#ifdef Q_OS_MACOS
+ static Qt::KeyboardModifiers fromCocoaModifiers(NSEventModifierFlags cocoaModifiers);
+ static NSEventModifierFlags toCocoaModifiers(Qt::KeyboardModifiers);
+
+ static QChar toCocoaKey(Qt::Key key);
+ static Qt::Key fromCocoaKey(QChar keyCode);
+#else
+ static Qt::Key fromNSString(Qt::KeyboardModifiers qtMods, NSString *characters,
+ NSString *charactersIgnoringModifiers, QString &text);
+
+ static Qt::Key fromUIKitKey(NSString *keyCode);
+ static Qt::KeyboardModifiers fromUIKitModifiers(ulong uikitModifiers);
+ static ulong toUIKitModifiers(Qt::KeyboardModifiers);
+#endif
+private:
+#ifdef Q_OS_MACOS
+ static constexpr int kNumModifierCombinations = 16;
+ struct KeyMap : std::array<char32_t, kNumModifierCombinations>
+ {
+ // Initialize first element to a sentinel that allows us
+ // to distinguish an uninitialized map from an initialized.
+ // Using 0 would not allow us to map U+0000 (NUL), however
+ // unlikely that is.
+ KeyMap() : std::array<char32_t, 16>{Qt::Key_unknown} {}
+ };
+
+ bool updateKeyboard();
+
+ using VirtualKeyCode = unsigned short;
+ const KeyMap &keyMapForKey(VirtualKeyCode virtualKey) const;
+
+ QCFType<TISInputSourceRef> m_currentInputSource = nullptr;
+
+ enum { NullMode, UnicodeMode, OtherMode } m_keyboardMode = NullMode;
+ const UCKeyboardLayout *m_keyboardLayoutFormat = nullptr;
+ KeyboardLayoutKind m_keyboardKind = kKLKCHRuchrKind;
+
+ mutable QHash<VirtualKeyCode, KeyMap> m_keyMap;
+#endif
+};
+
+QT_END_NAMESPACE
+
+#endif
+
diff --git a/src/gui/platform/darwin/qmacmimeregistry.mm b/src/gui/platform/darwin/qmacmimeregistry.mm
new file mode 100644
index 0000000000..6710a0656f
--- /dev/null
+++ b/src/gui/platform/darwin/qmacmimeregistry.mm
@@ -0,0 +1,118 @@
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
+
+#include <QtCore/qmimedata.h>
+
+#include "qutimimeconverter.h"
+#include "qmacmimeregistry_p.h"
+#include "qguiapplication.h"
+#include "private/qcore_mac_p.h"
+
+QT_BEGIN_NAMESPACE
+
+using namespace Qt::StringLiterals;
+
+namespace QMacMimeRegistry {
+
+typedef QList<QUtiMimeConverter*> MimeList;
+Q_GLOBAL_STATIC(MimeList, globalMimeList)
+Q_GLOBAL_STATIC(QStringList, globalDraggedTypesList)
+
+// implemented in qutimimeconverter.mm
+void registerBuiltInTypes();
+
+void registerDraggedTypes(const QStringList &types)
+{
+ (*globalDraggedTypesList()) += types;
+}
+
+const QStringList& enabledDraggedTypes()
+{
+ return (*globalDraggedTypesList());
+}
+
+/*****************************************************************************
+ QDnD debug facilities
+ *****************************************************************************/
+//#define DEBUG_MIME_MAPS
+
+/*!
+ \class QMacMimeRegistry
+ \internal
+ \ingroup draganddrop
+*/
+
+/*!
+ \internal
+
+ This is an internal function.
+*/
+void initializeMimeTypes()
+{
+ if (globalMimeList()->isEmpty())
+ registerBuiltInTypes();
+}
+
+/*!
+ \internal
+*/
+void destroyMimeTypes()
+{
+ MimeList *mimes = globalMimeList();
+ while (!mimes->isEmpty())
+ delete mimes->takeFirst();
+}
+
+/*
+ Returns a MIME type of for scope \a scope for \a uti, or \nullptr if none exists.
+*/
+QString flavorToMime(QUtiMimeConverter::HandlerScope scope, const QString &uti)
+{
+ const MimeList &mimes = *globalMimeList();
+ for (const auto &mime : mimes) {
+ const bool relevantScope = mime->scope() & scope;
+#ifdef DEBUG_MIME_MAPS
+ qDebug("QMacMimeRegistry::flavorToMime: attempting (%d) for uti %s [%s]",
+ relevantScope, qPrintable(uti), qPrintable((*it)->mimeForUti(uti)));
+#endif
+ if (relevantScope) {
+ const QString mimeType = mime->mimeForUti(uti);
+ if (!mimeType.isNull())
+ return mimeType;
+ }
+ }
+ return QString();
+}
+
+void registerMimeConverter(QUtiMimeConverter *macMime)
+{
+ // globalMimeList is in decreasing priority order. Recently added
+ // converters take prioity over previously added converters: prepend
+ // to the list.
+ globalMimeList()->prepend(macMime);
+}
+
+void unregisterMimeConverter(QUtiMimeConverter *macMime)
+{
+ if (!QGuiApplication::closingDown())
+ globalMimeList()->removeAll(macMime);
+}
+
+
+/*
+ Returns a list of all currently defined QUtiMimeConverter objects for scope \a scope.
+*/
+QList<QUtiMimeConverter *> all(QUtiMimeConverter::HandlerScope scope)
+{
+ MimeList ret;
+ const MimeList &mimes = *globalMimeList();
+ for (const auto &mime : mimes) {
+ if (mime->scope() & scope)
+ ret.append(mime);
+ }
+ return ret;
+}
+
+} // namespace QMacMimeRegistry
+
+QT_END_NAMESPACE
diff --git a/src/gui/platform/darwin/qmacmimeregistry_p.h b/src/gui/platform/darwin/qmacmimeregistry_p.h
new file mode 100644
index 0000000000..5928b81959
--- /dev/null
+++ b/src/gui/platform/darwin/qmacmimeregistry_p.h
@@ -0,0 +1,42 @@
+// Copyright (C) 2022 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
+
+#ifndef QMACMIMEREGISTRY_H
+#define QMACMIMEREGISTRY_H
+
+//
+// W A R N I N G
+// -------------
+//
+// This file is not part of the Qt API. It exists purely as an
+// implementation detail. This header file may change from version to
+// version without notice, or even be removed.
+//
+// We mean it.
+//
+
+
+#include <QtGui/private/qtguiglobal_p.h>
+#include <QtGui/qutimimeconverter.h>
+
+#include <CoreFoundation/CoreFoundation.h>
+
+QT_BEGIN_NAMESPACE
+
+namespace QMacMimeRegistry {
+ Q_GUI_EXPORT void initializeMimeTypes();
+ Q_GUI_EXPORT void destroyMimeTypes();
+
+ Q_GUI_EXPORT void registerMimeConverter(QUtiMimeConverter *);
+ Q_GUI_EXPORT void unregisterMimeConverter(QUtiMimeConverter *);
+
+ Q_GUI_EXPORT QList<QUtiMimeConverter *> all(QUtiMimeConverter::HandlerScope scope);
+ Q_GUI_EXPORT QString flavorToMime(QUtiMimeConverter::HandlerScope scope, const QString &flav);
+
+ Q_GUI_EXPORT void registerDraggedTypes(const QStringList &types);
+ Q_GUI_EXPORT const QStringList& enabledDraggedTypes();
+};
+
+QT_END_NAMESPACE
+
+#endif // QMACMIMEREGISTRY_H
diff --git a/src/gui/platform/darwin/qutimimeconverter.h b/src/gui/platform/darwin/qutimimeconverter.h
new file mode 100644
index 0000000000..e9297b5fa0
--- /dev/null
+++ b/src/gui/platform/darwin/qutimimeconverter.h
@@ -0,0 +1,62 @@
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
+
+#ifndef QUTIMIMECONVERTER_H
+#define QUTIMIMECONVERTER_H
+
+#include <QtGui/qtguiglobal.h>
+
+#include <QtCore/qlist.h>
+
+QT_BEGIN_NAMESPACE
+
+class QByteArray;
+class QString;
+class QVariant;
+class QMimeData;
+
+class Q_GUI_EXPORT QUtiMimeConverter
+{
+ Q_DISABLE_COPY(QUtiMimeConverter)
+public:
+ enum class HandlerScopeFlag : uint8_t
+ {
+ DnD = 0x01,
+ Clipboard = 0x02,
+ Qt_compatible = 0x04,
+ Qt3_compatible = 0x08,
+ All = DnD|Clipboard,
+ AllCompatible = All|Qt_compatible
+ };
+ Q_DECLARE_FLAGS(HandlerScope, HandlerScopeFlag)
+
+ QUtiMimeConverter();
+ virtual ~QUtiMimeConverter();
+
+ HandlerScope scope() const { return m_scope; }
+ bool canConvert(const QString &mime, const QString &uti) const { return mimeForUti(uti) == mime; }
+
+ // for converting from Qt
+ virtual QList<QByteArray> convertFromMime(const QString &mime, const QVariant &data, const QString &uti) const = 0;
+ virtual QString utiForMime(const QString &mime) const = 0;
+
+ // for converting to Qt
+ virtual QString mimeForUti(const QString &uti) const = 0;
+ virtual QVariant convertToMime(const QString &mime, const QList<QByteArray> &data, const QString &uti) const = 0;
+ virtual int count(const QMimeData *mimeData) const;
+
+private:
+ friend class QMacMimeTypeName;
+ friend class QMacMimeAny;
+
+ explicit QUtiMimeConverter(HandlerScope scope);
+
+ const HandlerScope m_scope;
+};
+Q_DECLARE_OPERATORS_FOR_FLAGS(QUtiMimeConverter::HandlerScope)
+
+
+QT_END_NAMESPACE
+
+#endif
+
diff --git a/src/gui/platform/darwin/qutimimeconverter.mm b/src/gui/platform/darwin/qutimimeconverter.mm
new file mode 100644
index 0000000000..ee643fd0c6
--- /dev/null
+++ b/src/gui/platform/darwin/qutimimeconverter.mm
@@ -0,0 +1,823 @@
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
+
+#include <ImageIO/ImageIO.h>
+#include <CoreFoundation/CoreFoundation.h>
+#include <UniformTypeIdentifiers/UTCoreTypes.h>
+
+#include <QtCore/qsystemdetection.h>
+#include <QtCore/qurl.h>
+#include <QtGui/qimage.h>
+#include <QtCore/qmimedata.h>
+#include <QtCore/qstringconverter.h>
+
+#if defined(Q_OS_MACOS)
+#import <AppKit/AppKit.h>
+#else
+#include <MobileCoreServices/MobileCoreServices.h>
+#endif
+
+#if defined(QT_PLATFORM_UIKIT)
+#import <UIKit/UIKit.h>
+#endif
+
+#include "qutimimeconverter.h"
+#include "qmacmimeregistry_p.h"
+#include "qguiapplication.h"
+#include "private/qcore_mac_p.h"
+
+QT_BEGIN_NAMESPACE
+
+using namespace Qt::StringLiterals;
+
+/*****************************************************************************
+ QDnD debug facilities
+ *****************************************************************************/
+//#define DEBUG_MIME_MAPS
+
+/*!
+ \class QUtiMimeConverter
+ \brief The QUtiMimeConverter class converts between a MIME type and a
+ \l{https://developer.apple.com/documentation/uniformtypeidentifiers}
+ {Uniform Type Identifier (UTI)} format.
+ \since 6.5
+
+ \ingroup draganddrop
+ \inmodule QtGui
+
+ Qt's drag and drop and clipboard facilities use the MIME
+ standard. On X11, this maps trivially to the Xdnd protocol. On
+ Mac, although some applications use MIME to describe clipboard
+ contents, it is more common to use Apple's UTI format.
+
+ QUtiMimeConverter's role is to bridge the gap between MIME and UTI;
+ By subclasses this class, one can extend Qt's drag and drop
+ and clipboard handling to convert to and from unsupported, or proprietary, UTI formats.
+
+ Construct an instance of your converter implementation after instantiating
+ QGuiApplication:
+
+ \code
+ int main(int argc, char **argv)
+ {
+ QGuiApplication app(argc, argv);
+ JsonMimeConverter jsonConverter;
+ }
+ \endcode
+
+ Destroying the instance will unregister the converter and remove support
+ for the conversion. It is also valid to heap-allocate the converter
+ instance; Qt takes ownership and will delete the converter object during
+ QGuiApplication shut-down.
+
+ Qt has predefined support for the following UTIs:
+ \list
+ \li public.utf8-plain-text - converts to "text/plain"
+ \li public.utf16-plain-text - converts to "text/plain"
+ \li public.text - converts to "text/plain"
+ \li public.html - converts to "text/html"
+ \li public.url - converts to "text/uri-list"
+ \li public.file-url - converts to "text/uri-list"
+ \li public.tiff - converts to "application/x-qt-image"
+ \li public.vcard - converts to "text/plain"
+ \li com.apple.traditional-mac-plain-text - converts to "text/plain"
+ \li com.apple.pict - converts to "application/x-qt-image"
+ \endlist
+
+ When working with MIME data, Qt will iterate through all instances of QUtiMimeConverter to find
+ find an instance that can convert to, or from, a specific MIME type. It will do this by calling
+ mimeForUti() or utiForMime() on each instance, starting with (and choosing) the last created
+ instance first. The actual conversions will be done by using convertToMime() and convertFromMime().
+*/
+
+/*!
+ \enum QUtiMimeConverter::HandlerScope
+ \internal
+*/
+
+/*!
+ \internal
+ Constructs a new conversion object of type \a scope, adding it to the
+ globally accessed list of available converters.
+*/
+QUtiMimeConverter::QUtiMimeConverter(HandlerScope scope)
+ : m_scope(scope)
+{
+ QMacMimeRegistry::registerMimeConverter(this);
+}
+
+/*!
+ Constructs a new conversion object and adds it to the
+ globally accessed list of available converters.
+
+ Call this constructor after QGuiApplication has been created.
+*/
+QUtiMimeConverter::QUtiMimeConverter()
+ : QUtiMimeConverter(HandlerScopeFlag::All)
+{
+}
+
+/*!
+ Destroys a conversion object, removing it from the global
+ list of available converters.
+*/
+QUtiMimeConverter::~QUtiMimeConverter()
+{
+ QMacMimeRegistry::unregisterMimeConverter(this);
+}
+
+/*!
+ Returns the item count for the given \a mimeData
+*/
+int QUtiMimeConverter::count(const QMimeData *mimeData) const
+{
+ Q_UNUSED(mimeData);
+ return 1;
+}
+
+/*!
+ \fn bool QUtiMimeConverter::canConvert(const QString &mime, const QString &uti) const
+
+ Returns \c true if the converter can convert (both ways) between
+ \a mime and \a uti; otherwise returns \c false.
+*/
+
+/*!
+ \fn QString QUtiMimeConverter::mimeForUti(const QString &uti) const
+
+ Returns the MIME type used for Mac UTI \a uti, or an empty string if
+ this converter does not support converting from \a uti.
+
+ All subclasses must reimplement this pure virtual function.
+*/
+
+/*!
+ \fn QString QUtiMimeConverter::utiForMime(const QString &mime) const
+
+ Returns the Mac UTI used for MIME type \a mime, or an empty string if
+ this converter does not support converting from \a mime.
+
+ All subclasses must reimplement this pure virtual function.
+*/
+
+/*!
+ \fn QVariant QUtiMimeConverter::convertToMime(const QString &mime,
+ const QList<QByteArray> &data, const QString &uti) const
+
+ Returns \a data converted from Mac UTI \a uti to MIME type \a mime.
+
+ Note that Mac UTIs must all be self-terminating. The input \a data
+ may contain trailing data.
+
+ All subclasses must reimplement this pure virtual function.
+*/
+
+/*!
+ \fn QList<QByteArray> QUtiMimeConverter::convertFromMime(const QString &mime,
+ const QVariant &data, const QString & uti) const
+
+ Returns \a data converted from MIME type \a mime to Mac UTI \a uti.
+
+ Note that Mac UTIs must all be self-terminating. The return
+ value may contain trailing data.
+
+ All subclasses must reimplement this pure virtual function.
+*/
+
+
+class QMacMimeAny : public QUtiMimeConverter {
+public:
+ QMacMimeAny() : QUtiMimeConverter(HandlerScopeFlag::AllCompatible) {}
+
+ QString utiForMime(const QString &mime) const override;
+ QString mimeForUti(const QString &uti) const override;
+ QVariant convertToMime(const QString &mime, const QList<QByteArray> &data,
+ const QString &uti) const override;
+ QList<QByteArray> convertFromMime(const QString &mime, const QVariant &data,
+ const QString &uti) const override;
+};
+
+QString QMacMimeAny::utiForMime(const QString &mime) const
+{
+ // do not handle the mime type name in the drag pasteboard
+ if (mime == "application/x-qt-mime-type-name"_L1)
+ return QString();
+ QString ret = "com.trolltech.anymime."_L1 + mime;
+ return ret.replace(u'/', "--"_L1);
+}
+
+QString QMacMimeAny::mimeForUti(const QString &uti) const
+{
+ const QString any_prefix = "com.trolltech.anymime."_L1;
+ if (uti.size() > any_prefix.length() && uti.startsWith(any_prefix))
+ return uti.mid(any_prefix.length()).replace("--"_L1, "/"_L1);
+ return QString();
+}
+
+QVariant QMacMimeAny::convertToMime(const QString &mime, const QList<QByteArray> &data,
+ const QString &) const
+{
+ if (data.count() > 1)
+ qWarning("QMacMimeAny: Cannot handle multiple member data");
+ QVariant ret;
+ if (mime == "text/plain"_L1)
+ ret = QString::fromUtf8(data.first());
+ else
+ ret = data.first();
+ return ret;
+}
+
+QList<QByteArray> QMacMimeAny::convertFromMime(const QString &mime, const QVariant &data,
+ const QString &) const
+{
+ QList<QByteArray> ret;
+ if (mime == "text/plain"_L1)
+ ret.append(data.toString().toUtf8());
+ else
+ ret.append(data.toByteArray());
+ return ret;
+}
+
+class QMacMimeTypeName : public QUtiMimeConverter {
+private:
+
+public:
+ QMacMimeTypeName(): QUtiMimeConverter(HandlerScopeFlag::AllCompatible) {}
+
+ QString utiForMime(const QString &mime) const override;
+ QString mimeForUti(const QString &uti) const override;
+ QVariant convertToMime(const QString &mime, const QList<QByteArray> &data, const QString &uti) const override;
+ QList<QByteArray> convertFromMime(const QString &mime, const QVariant &data, const QString &uti) const override;
+};
+
+QString QMacMimeTypeName::utiForMime(const QString &mime) const
+{
+ if (mime == "application/x-qt-mime-type-name"_L1)
+ return u"com.trolltech.qt.MimeTypeName"_s;
+ return QString();
+}
+
+QString QMacMimeTypeName::mimeForUti(const QString &) const
+{
+ return QString();
+}
+
+QVariant QMacMimeTypeName::convertToMime(const QString &, const QList<QByteArray> &, const QString &) const
+{
+ QVariant ret;
+ return ret;
+}
+
+QList<QByteArray> QMacMimeTypeName::convertFromMime(const QString &, const QVariant &, const QString &) const
+{
+ QList<QByteArray> ret;
+ ret.append(QString("x-qt-mime-type-name"_L1).toUtf8());
+ return ret;
+}
+
+class QMacMimePlainTextFallback : public QUtiMimeConverter
+{
+public:
+ QString utiForMime(const QString &mime) const override;
+ QString mimeForUti(const QString &uti) const override;
+ QVariant convertToMime(const QString &mime, const QList<QByteArray> &data,
+ const QString &uti) const override;
+ QList<QByteArray> convertFromMime(const QString &mime, const QVariant &data,
+ const QString &uti) const override;
+};
+
+QString QMacMimePlainTextFallback::utiForMime(const QString &mime) const
+{
+ if (mime == "text/plain"_L1)
+ return "public.text"_L1;
+ return QString();
+}
+
+QString QMacMimePlainTextFallback::mimeForUti(const QString &uti) const
+{
+ if (uti == "public.text"_L1)
+ return "text/plain"_L1;
+ return QString();
+}
+
+QVariant
+QMacMimePlainTextFallback::convertToMime(const QString &mimetype,
+ const QList<QByteArray> &data, const QString &uti) const
+{
+ if (data.count() > 1)
+ qWarning("QMacMimePlainTextFallback: Cannot handle multiple member data");
+
+ if (uti == "public.text"_L1) {
+ // Note that public.text is documented by Apple to have an undefined encoding. From
+ // testing it seems that utf8 is normally used, at least by Safari on iOS.
+ const QByteArray &firstData = data.first();
+ return QString(QCFString(CFStringCreateWithBytes(kCFAllocatorDefault,
+ reinterpret_cast<const UInt8 *>(firstData.constData()),
+ firstData.size(), kCFStringEncodingUTF8, false)));
+ } else {
+ qWarning("QMime::convertToMime: unhandled mimetype: %s", qPrintable(mimetype));
+ }
+ return QVariant();
+}
+
+QList<QByteArray>
+QMacMimePlainTextFallback::convertFromMime(const QString &, const QVariant &data,
+ const QString &uti) const
+{
+ QList<QByteArray> ret;
+ QString string = data.toString();
+ if (uti == "public.text"_L1)
+ ret.append(string.toUtf8());
+ return ret;
+}
+
+class QMacMimeUnicodeText : public QUtiMimeConverter
+{
+public:
+ QString utiForMime(const QString &mime) const override;
+ QString mimeForUti(const QString &uti) const override;
+ QVariant convertToMime(const QString &mime, const QList<QByteArray> &data,
+ const QString &uti) const override;
+ QList<QByteArray> convertFromMime(const QString &mime, const QVariant &data,
+ const QString &uti) const override;
+};
+
+QString QMacMimeUnicodeText::utiForMime(const QString &mime) const
+{
+ if (mime == "text/plain"_L1)
+ return "public.utf16-plain-text"_L1;
+ if (qsizetype i = mime.indexOf("charset="_L1); i >= 0) {
+ QString cs(mime.mid(i + 8).toLower());
+ i = cs.indexOf(u';');
+ if (i >= 0)
+ cs = cs.left(i);
+ if (cs == "system"_L1)
+ return "public.utf8-plain-text"_L1;
+ else if (cs == "iso-10646-ucs-2"_L1 || cs == "utf16"_L1)
+ return "public.utf16-plain-text"_L1;
+ }
+ return QString();
+}
+
+QString QMacMimeUnicodeText::mimeForUti(const QString &uti) const
+{
+ if (uti == "public.utf16-plain-text"_L1 || uti == "public.utf8-plain-text"_L1)
+ return "text/plain"_L1;
+ return QString();
+}
+
+QVariant
+QMacMimeUnicodeText::convertToMime(const QString &mimetype,
+ const QList<QByteArray> &data, const QString &uti) const
+{
+ if (data.count() > 1)
+ qWarning("QMacMimeUnicodeText: Cannot handle multiple member data");
+ const QByteArray &firstData = data.first();
+ // I can only handle two types (system and unicode) so deal with them that way
+ QVariant ret;
+ if (uti == "public.utf8-plain-text"_L1) {
+ ret = QString::fromUtf8(firstData);
+ } else if (uti == "public.utf16-plain-text"_L1) {
+ QString str = QStringDecoder(QStringDecoder::Utf16)(firstData);
+ ret = str;
+ } else {
+ qWarning("QMime::convertToMime: unhandled mimetype: %s", qPrintable(mimetype));
+ }
+ return ret;
+}
+
+QList<QByteArray>
+QMacMimeUnicodeText::convertFromMime(const QString &, const QVariant &data,
+ const QString &uti) const
+{
+ QList<QByteArray> ret;
+ QString string = data.toString();
+ if (uti == "public.utf8-plain-text"_L1)
+ ret.append(string.toUtf8());
+ else if (uti == "public.utf16-plain-text"_L1) {
+ QStringEncoder::Flags f;
+#if defined(Q_OS_MACOS)
+ // Some applications such as Microsoft Excel, don't deal well with
+ // a BOM present, so we follow the traditional approach of Qt on
+ // macOS to not generate public.utf16-plain-text with a BOM.
+ f = QStringEncoder::Flag::Default;
+#else
+ // Whereas iOS applications will fail to paste if we do _not_
+ // include a BOM in the public.utf16-plain-text content, most
+ // likely due to converting the data using NSUTF16StringEncoding
+ // which assumes big-endian byte order if there is no BOM.
+ f = QStringEncoder::Flag::WriteBom;
+#endif
+ QStringEncoder encoder(QStringEncoder::Utf16, f);
+ ret.append(encoder(string));
+ }
+ return ret;
+}
+
+class QMacMimeHTMLText : public QUtiMimeConverter
+{
+public:
+ QString utiForMime(const QString &mime) const override;
+ QString mimeForUti(const QString &uti) const override;
+ QVariant convertToMime(const QString &mime, const QList<QByteArray> &data,
+ const QString &uti) const override;
+ QList<QByteArray> convertFromMime(const QString &mime, const QVariant &data,
+ const QString &uti) const override;
+};
+
+QString QMacMimeHTMLText::utiForMime(const QString &mime) const
+{
+ if (mime == "text/html"_L1)
+ return "public.html"_L1;
+ return QString();
+}
+
+QString QMacMimeHTMLText::mimeForUti(const QString &uti) const
+{
+ if (uti == "public.html"_L1)
+ return "text/html"_L1;
+ return QString();
+}
+
+QVariant
+QMacMimeHTMLText::convertToMime(const QString &mimeType,
+ const QList<QByteArray> &data, const QString &uti) const
+{
+ if (!canConvert(mimeType, uti))
+ return QVariant();
+ if (data.count() > 1)
+ qWarning("QMacMimeHTMLText: Cannot handle multiple member data");
+ return data.first();
+}
+
+QList<QByteArray>
+QMacMimeHTMLText::convertFromMime(const QString &mime,
+ const QVariant &data, const QString &uti) const
+{
+ QList<QByteArray> ret;
+ if (!canConvert(mime, uti))
+ return ret;
+ ret.append(data.toByteArray());
+ return ret;
+}
+
+class QMacMimeRtfText : public QUtiMimeConverter
+{
+public:
+ QString utiForMime(const QString &mime) const override;
+ QString mimeForUti(const QString &uti) const override;
+ QVariant convertToMime(const QString &mime, const QList<QByteArray> &data,
+ const QString &uti) const override;
+ QList<QByteArray> convertFromMime(const QString &mime, const QVariant &data,
+ const QString &uti) const override;
+};
+
+QString QMacMimeRtfText::utiForMime(const QString &mime) const
+{
+ if (mime == "text/html"_L1)
+ return "public.rtf"_L1;
+ return QString();
+}
+
+QString QMacMimeRtfText::mimeForUti(const QString &uti) const
+{
+ if (uti == "public.rtf"_L1)
+ return "text/html"_L1;
+ return QString();
+}
+
+QVariant
+QMacMimeRtfText::convertToMime(const QString &mimeType,
+ const QList<QByteArray> &data, const QString &uti) const
+{
+ if (!canConvert(mimeType, uti))
+ return QVariant();
+ if (data.count() > 1)
+ qWarning("QMacMimeHTMLText: Cannot handle multiple member data");
+
+ // Read RTF into to NSAttributedString, then convert the string to HTML
+ NSAttributedString *string = [[NSAttributedString alloc] initWithData:data.at(0).toNSData()
+ options:@{NSDocumentTypeDocumentAttribute: NSRTFTextDocumentType}
+ documentAttributes:nil
+ error:nil];
+
+ NSError *error;
+ NSRange range = NSMakeRange(0, [string length]);
+ NSDictionary *dict = @{NSDocumentTypeDocumentAttribute: NSHTMLTextDocumentType};
+ NSData *htmlData = [string dataFromRange:range documentAttributes:dict error:&error];
+ return QByteArray::fromNSData(htmlData);
+}
+
+QList<QByteArray>
+QMacMimeRtfText::convertFromMime(const QString &mime,
+ const QVariant &data, const QString &uti) const
+{
+ QList<QByteArray> ret;
+ if (!canConvert(mime, uti))
+ return ret;
+
+ NSAttributedString *string = [[NSAttributedString alloc] initWithData:data.toByteArray().toNSData()
+ options:@{NSDocumentTypeDocumentAttribute: NSHTMLTextDocumentType}
+ documentAttributes:nil
+ error:nil];
+
+ NSError *error;
+ NSRange range = NSMakeRange(0, [string length]);
+ NSDictionary *dict = @{NSDocumentTypeDocumentAttribute: NSRTFTextDocumentType};
+ NSData *rtfData = [string dataFromRange:range documentAttributes:dict error:&error];
+ ret << QByteArray::fromNSData(rtfData);
+ return ret;
+}
+
+class QMacMimeFileUri : public QUtiMimeConverter
+{
+public:
+ QString utiForMime(const QString &mime) const override;
+ QString mimeForUti(const QString &uti) const override;
+ QVariant convertToMime(const QString &mime, const QList<QByteArray> &data,
+ const QString &uti) const override;
+ QList<QByteArray> convertFromMime(const QString &mime, const QVariant &data,
+ const QString &uti) const override;
+ int count(const QMimeData *mimeData) const override;
+};
+
+QString QMacMimeFileUri::utiForMime(const QString &mime) const
+{
+ if (mime == "text/uri-list"_L1)
+ return "public.file-url"_L1;
+ return QString();
+}
+
+QString QMacMimeFileUri::mimeForUti(const QString &uti) const
+{
+ if (uti == "public.file-url"_L1)
+ return "text/uri-list"_L1;
+ return QString();
+}
+
+QVariant
+QMacMimeFileUri::convertToMime(const QString &mime,
+ const QList<QByteArray> &data, const QString &uti) const
+{
+ if (!canConvert(mime, uti))
+ return QVariant();
+ QList<QVariant> ret;
+ for (int i = 0; i < data.size(); ++i) {
+ const QByteArray &a = data.at(i);
+ NSString *urlString = [[[NSString alloc] initWithBytesNoCopy:(void *)a.data() length:a.size()
+ encoding:NSUTF8StringEncoding freeWhenDone:NO] autorelease];
+ NSURL *nsurl = [NSURL URLWithString:urlString];
+ QUrl url;
+ // OS X 10.10 sends file references instead of file paths
+ if ([nsurl isFileReferenceURL]) {
+ url = QUrl::fromNSURL([nsurl filePathURL]);
+ } else {
+ url = QUrl::fromNSURL(nsurl);
+ }
+
+ if (url.host().toLower() == "localhost"_L1)
+ url.setHost(QString());
+
+ url.setPath(url.path().normalized(QString::NormalizationForm_C));
+ ret.append(url);
+ }
+ return QVariant(ret);
+}
+
+QList<QByteArray>
+QMacMimeFileUri::convertFromMime(const QString &mime,
+ const QVariant &data, const QString &uti) const
+{
+ QList<QByteArray> ret;
+ if (!canConvert(mime, uti))
+ return ret;
+ QList<QVariant> urls = data.toList();
+ for (int i = 0; i < urls.size(); ++i) {
+ QUrl url = urls.at(i).toUrl();
+ if (url.scheme().isEmpty())
+ url.setScheme("file"_L1);
+ if (url.scheme() == "file"_L1) {
+ if (url.host().isEmpty())
+ url.setHost("localhost"_L1);
+ url.setPath(url.path().normalized(QString::NormalizationForm_D));
+ }
+ if (url.isLocalFile())
+ ret.append(url.toEncoded());
+ }
+ return ret;
+}
+
+int QMacMimeFileUri::count(const QMimeData *mimeData) const
+{
+ return mimeData->urls().count();
+}
+
+class QMacMimeUrl : public QUtiMimeConverter
+{
+public:
+ QString utiForMime(const QString &mime) const override;
+ QString mimeForUti(const QString &uti) const override;
+ QVariant convertToMime(const QString &mime, const QList<QByteArray> &data,
+ const QString &uti) const override;
+ QList<QByteArray> convertFromMime(const QString &mime, const QVariant &data,
+ const QString &uti) const override;
+};
+
+QString QMacMimeUrl::utiForMime(const QString &mime) const
+{
+ if (mime.startsWith("text/uri-list"_L1))
+ return "public.url"_L1;
+ return QString();
+}
+
+QString QMacMimeUrl::mimeForUti(const QString &uti) const
+{
+ if (uti == "public.url"_L1)
+ return "text/uri-list"_L1;
+ return QString();
+}
+
+QVariant QMacMimeUrl::convertToMime(const QString &mime,
+ const QList<QByteArray> &data, const QString &uti) const
+{
+ if (!canConvert(mime, uti))
+ return QVariant();
+
+ QList<QVariant> ret;
+ for (int i=0; i<data.size(); ++i) {
+ QUrl url = QUrl::fromEncoded(data.at(i));
+ if (url.host().toLower() == "localhost"_L1)
+ url.setHost(QString());
+ url.setPath(url.path().normalized(QString::NormalizationForm_C));
+ ret.append(url);
+ }
+ return QVariant(ret);
+}
+
+QList<QByteArray> QMacMimeUrl::convertFromMime(const QString &mime,
+ const QVariant &data, const QString &uti) const
+{
+ QList<QByteArray> ret;
+ if (!canConvert(mime, uti))
+ return ret;
+
+ QList<QVariant> urls = data.toList();
+ for (int i=0; i<urls.size(); ++i) {
+ QUrl url = urls.at(i).toUrl();
+ if (url.scheme().isEmpty())
+ url.setScheme("file"_L1);
+ if (url.scheme() == "file"_L1) {
+ if (url.host().isEmpty())
+ url.setHost("localhost"_L1);
+ url.setPath(url.path().normalized(QString::NormalizationForm_D));
+ }
+ ret.append(url.toEncoded());
+ }
+ return ret;
+}
+
+class QMacMimeVCard : public QUtiMimeConverter
+{
+public:
+ QString utiForMime(const QString &mime) const override;
+ QString mimeForUti(const QString &uti) const override;
+ QVariant convertToMime(const QString &mime, const QList<QByteArray> &data,
+ const QString &uti) const override;
+ QList<QByteArray> convertFromMime(const QString &mime, const QVariant &data,
+ const QString &uti) const override;
+};
+
+QString QMacMimeVCard::utiForMime(const QString &mime) const
+{
+ if (mime.startsWith("text/vcard"_L1))
+ return "public.vcard"_L1;
+ return QString();
+}
+
+QString QMacMimeVCard::mimeForUti(const QString &uti) const
+{
+ if (uti == "public.vcard"_L1)
+ return "text/vcard"_L1;
+ return QString();
+}
+
+QVariant QMacMimeVCard::convertToMime(const QString &mime,
+ const QList<QByteArray> &data, const QString &uti) const
+{
+ if (!canConvert(mime, uti))
+ return QVariant();
+ QByteArray cards;
+ if (uti == "public.vcard"_L1) {
+ for (int i=0; i<data.size(); ++i)
+ cards += data[i];
+ }
+ return QVariant(cards);
+}
+
+QList<QByteArray> QMacMimeVCard::convertFromMime(const QString &mime,
+ const QVariant &data, const QString &uti) const
+{
+ QList<QByteArray> ret;
+ if (!canConvert(mime, uti))
+ return ret;
+
+ if (mime == "text/vcard"_L1)
+ ret.append(data.toString().toUtf8());
+ return ret;
+}
+
+extern QImage qt_mac_toQImage(CGImageRef image);
+extern CGImageRef qt_mac_toCGImage(const QImage &qImage);
+
+class QMacMimeTiff : public QUtiMimeConverter
+{
+public:
+ QString utiForMime(const QString &mime) const override;
+ QString mimeForUti(const QString &uti) const override;
+ QVariant convertToMime(const QString &mime, const QList<QByteArray> &data,
+ const QString &uti) const override;
+ QList<QByteArray> convertFromMime(const QString &mime, const QVariant &data,
+ const QString &uti) const override;
+};
+
+QString QMacMimeTiff::utiForMime(const QString &mime) const
+{
+ if (mime.startsWith("application/x-qt-image"_L1))
+ return "public.tiff"_L1;
+ return QString();
+}
+
+QString QMacMimeTiff::mimeForUti(const QString &uti) const
+{
+ if (uti == "public.tiff"_L1)
+ return "application/x-qt-image"_L1;
+ return QString();
+}
+
+QVariant QMacMimeTiff::convertToMime(const QString &mime,
+ const QList<QByteArray> &data, const QString &uti) const
+{
+ if (data.count() > 1)
+ qWarning("QMacMimeTiff: Cannot handle multiple member data");
+
+ if (!canConvert(mime, uti))
+ return QVariant();
+
+ QCFType<CFDataRef> tiffData = data.first().toRawCFData();
+ QCFType<CGImageSourceRef> imageSource = CGImageSourceCreateWithData(tiffData, 0);
+
+ if (QCFType<CGImageRef> image = CGImageSourceCreateImageAtIndex(imageSource, 0, 0))
+ return QVariant(qt_mac_toQImage(image));
+
+ return QVariant();
+}
+
+QList<QByteArray> QMacMimeTiff::convertFromMime(const QString &mime,
+ const QVariant &variant, const QString &uti) const
+{
+ if (!canConvert(mime, uti))
+ return QList<QByteArray>();
+
+ QCFType<CFMutableDataRef> data = CFDataCreateMutable(0, 0);
+ QCFType<CGImageDestinationRef> imageDestination = CGImageDestinationCreateWithData(data,
+ (CFStringRef)UTTypeTIFF.identifier, 1, 0);
+
+ if (!imageDestination)
+ return QList<QByteArray>();
+
+ QImage img = qvariant_cast<QImage>(variant);
+ NSDictionary *props = @{
+ static_cast<NSString *>(kCGImagePropertyPixelWidth): @(img.width()),
+ static_cast<NSString *>(kCGImagePropertyPixelHeight): @(img.height())
+ };
+
+ CGImageDestinationAddImage(imageDestination, qt_mac_toCGImage(img),
+ static_cast<CFDictionaryRef>(props));
+ CGImageDestinationFinalize(imageDestination);
+
+ return QList<QByteArray>() << QByteArray::fromCFData(data);
+}
+
+namespace QMacMimeRegistry {
+
+void registerBuiltInTypes()
+{
+ // Create QMacMimeAny first to put it at the end of globalMimeList
+ // with lowest priority. (the constructor prepends to the list)
+ new QMacMimeAny;
+
+ //standard types that we wrap
+ new QMacMimeTiff;
+ new QMacMimePlainTextFallback;
+ new QMacMimeUnicodeText;
+ new QMacMimeRtfText;
+ new QMacMimeHTMLText;
+ new QMacMimeFileUri;
+ new QMacMimeUrl;
+ new QMacMimeTypeName;
+ new QMacMimeVCard;
+}
+
+}
+
+QT_END_NAMESPACE
diff --git a/src/gui/platform/ios/PrivacyInfo.xcprivacy b/src/gui/platform/ios/PrivacyInfo.xcprivacy
new file mode 100644
index 0000000000..bde2b167c7
--- /dev/null
+++ b/src/gui/platform/ios/PrivacyInfo.xcprivacy
@@ -0,0 +1,23 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
+<plist version="1.0">
+<dict>
+ <key>NSPrivacyTracking</key>
+ <false/>
+ <key>NSPrivacyCollectedDataTypes</key>
+ <array/>
+ <key>NSPrivacyTrackingDomains</key>
+ <array/>
+ <key>NSPrivacyAccessedAPITypes</key>
+ <array>
+ <dict>
+ <key>NSPrivacyAccessedAPIType</key>
+ <string>NSPrivacyAccessedAPICategorySystemBootTime</string>
+ <key>NSPrivacyAccessedAPITypeReasons</key>
+ <array>
+ <string>35F9.1</string> <!-- QUIView event handling -->
+ </array>
+ </dict>
+ </array>
+</dict>
+</plist>
diff --git a/src/gui/platform/macos/qcocoanativeinterface.mm b/src/gui/platform/macos/qcocoanativeinterface.mm
new file mode 100644
index 0000000000..cb6acb4496
--- /dev/null
+++ b/src/gui/platform/macos/qcocoanativeinterface.mm
@@ -0,0 +1,86 @@
+// Copyright (C) 2020 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
+
+#include <QtGui/qtgui-config.h>
+#ifndef QT_NO_OPENGL
+# include <QtGui/private/qopenglcontext_p.h>
+#endif
+
+#include <QtGui/private/qguiapplication_p.h>
+#include <qpa/qplatformopenglcontext.h>
+#include <qpa/qplatformintegration.h>
+#include <qpa/qplatformwindow_p.h>
+#include <qpa/qplatformmenu_p.h>
+
+#include <AppKit/AppKit.h>
+
+QT_BEGIN_NAMESPACE
+
+using namespace QNativeInterface::Private;
+
+/*!
+ \class QNativeInterface::Private::QCocoaWindow
+ \since 6.0
+ \internal
+ \brief Native interface for QPlatformWindow on \macos.
+ \inmodule QtGui
+ \ingroup native-interfaces
+*/
+
+QT_DEFINE_PRIVATE_NATIVE_INTERFACE(QCocoaWindow);
+
+
+/*!
+ \class QNativeInterface::Private::QCocoaMenu
+ \since 6.0
+ \internal
+ \brief Native interface for QPlatformMenu on \macos.
+ \inmodule QtGui
+ \ingroup native-interfaces
+*/
+
+QT_DEFINE_PRIVATE_NATIVE_INTERFACE(QCocoaMenu);
+QT_DEFINE_PRIVATE_NATIVE_INTERFACE(QCocoaMenuBar);
+
+#ifndef QT_NO_OPENGL
+
+/*!
+ \class QNativeInterface::QCocoaGLContext
+ \since 6.0
+ \brief Native interface to an NSOpenGLContext on \macos.
+
+ Accessed through QOpenGLContext::nativeInterface().
+
+ \inmodule QtGui
+ \inheaderfile QOpenGLContext
+ \ingroup native-interfaces
+ \ingroup native-interfaces-qopenglcontext
+*/
+
+/*!
+ \fn QOpenGLContext *QNativeInterface::QCocoaGLContext::fromNative(NSOpenGLContext *context, QOpenGLContext *shareContext = nullptr)
+
+ \brief Adopts an NSOpenGLContext.
+
+ The adopted NSOpenGLContext \a context is retained. Ownership of the
+ created QOpenGLContext \a shareContext is transferred to the caller.
+*/
+
+/*!
+ \fn NSOpenGLContext *QNativeInterface::QCocoaGLContext::nativeContext() const
+
+ \return the underlying NSOpenGLContext.
+*/
+
+QT_DEFINE_NATIVE_INTERFACE(QCocoaGLContext);
+QT_DEFINE_PRIVATE_NATIVE_INTERFACE(QCocoaGLIntegration);
+
+QOpenGLContext *QNativeInterface::QCocoaGLContext::fromNative(NSOpenGLContext *nativeContext, QOpenGLContext *shareContext)
+{
+ return QGuiApplicationPrivate::platformIntegration()->call<
+ &QCocoaGLIntegration::createOpenGLContext>(nativeContext, shareContext);
+}
+
+#endif // QT_NO_OPENGL
+
+QT_END_NAMESPACE
diff --git a/src/gui/platform/platform.pri b/src/gui/platform/platform.pri
deleted file mode 100644
index 1fe2db81b0..0000000000
--- a/src/gui/platform/platform.pri
+++ /dev/null
@@ -1 +0,0 @@
-wasm:include(wasm/wasm.pri)
diff --git a/src/gui/platform/unix/dbusmenu/qdbusmenuadaptor.cpp b/src/gui/platform/unix/dbusmenu/qdbusmenuadaptor.cpp
new file mode 100644
index 0000000000..a3b7b6db00
--- /dev/null
+++ b/src/gui/platform/unix/dbusmenu/qdbusmenuadaptor.cpp
@@ -0,0 +1,133 @@
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
+
+/*
+ This file was originally created by qdbusxml2cpp version 0.8
+ Command line was:
+ qdbusxml2cpp -a dbusmenu ../../3rdparty/dbus-ifaces/dbus-menu.xml
+
+ However it is maintained manually.
+*/
+
+#include <QMetaObject>
+#include <QByteArray>
+#include <QList>
+#include <QMap>
+#include <QString>
+#include <QStringList>
+#include <QVariant>
+#include <QLocale>
+
+#include <private/qdbusmenuadaptor_p.h>
+#include <private/qdbusplatformmenu_p.h>
+
+QT_BEGIN_NAMESPACE
+
+using namespace Qt::StringLiterals;
+
+QDBusMenuAdaptor::QDBusMenuAdaptor(QDBusPlatformMenu *topLevelMenu)
+ : QDBusAbstractAdaptor(topLevelMenu)
+ , m_topLevelMenu(topLevelMenu)
+{
+ setAutoRelaySignals(true);
+}
+
+QDBusMenuAdaptor::~QDBusMenuAdaptor()
+{
+}
+
+QString QDBusMenuAdaptor::status() const
+{
+ qCDebug(qLcMenu);
+ return "normal"_L1;
+}
+
+QString QDBusMenuAdaptor::textDirection() const
+{
+ return QLocale().textDirection() == Qt::RightToLeft ? "rtl"_L1 : "ltr"_L1;
+}
+
+uint QDBusMenuAdaptor::version() const
+{
+ return 4;
+}
+
+bool QDBusMenuAdaptor::AboutToShow(int id)
+{
+ qCDebug(qLcMenu) << id;
+ if (id == 0) {
+ emit m_topLevelMenu->aboutToShow();
+ } else {
+ QDBusPlatformMenuItem *item = QDBusPlatformMenuItem::byId(id);
+ if (item) {
+ const QDBusPlatformMenu *menu = static_cast<const QDBusPlatformMenu *>(item->menu());
+ if (menu)
+ emit const_cast<QDBusPlatformMenu *>(menu)->aboutToShow();
+ }
+ }
+ return false; // updateNeeded (we don't know that, so false)
+}
+
+QList<int> QDBusMenuAdaptor::AboutToShowGroup(const QList<int> &ids, QList<int> &idErrors)
+{
+ qCDebug(qLcMenu) << ids;
+ Q_UNUSED(idErrors);
+ idErrors.clear();
+ for (int id : ids)
+ AboutToShow(id);
+ return QList<int>(); // updatesNeeded
+}
+
+void QDBusMenuAdaptor::Event(int id, const QString &eventId, const QDBusVariant &data, uint timestamp)
+{
+ Q_UNUSED(data);
+ Q_UNUSED(timestamp);
+ QDBusPlatformMenuItem *item = QDBusPlatformMenuItem::byId(id);
+ qCDebug(qLcMenu) << id << (item ? item->text() : ""_L1) << eventId;
+ if (item && eventId == "clicked"_L1)
+ item->trigger();
+ if (item && eventId == "hovered"_L1)
+ emit item->hovered();
+ if (eventId == "closed"_L1) {
+ // There is no explicit AboutToHide method, so map closed event to aboutToHide method
+ const QDBusPlatformMenu *menu = nullptr;
+ if (item)
+ menu = static_cast<const QDBusPlatformMenu *>(item->menu());
+ else if (id == 0)
+ menu = m_topLevelMenu;
+ if (menu)
+ emit const_cast<QDBusPlatformMenu *>(menu)->aboutToHide();
+ }
+}
+
+QList<int> QDBusMenuAdaptor::EventGroup(const QDBusMenuEventList &events)
+{
+ for (const QDBusMenuEvent &ev : events)
+ Event(ev.m_id, ev.m_eventId, ev.m_data, ev.m_timestamp);
+ return QList<int>(); // idErrors
+}
+
+QDBusMenuItemList QDBusMenuAdaptor::GetGroupProperties(const QList<int> &ids, const QStringList &propertyNames)
+{
+ qCDebug(qLcMenu) << ids << propertyNames << "=>" << QDBusMenuItem::items(ids, propertyNames);
+ return QDBusMenuItem::items(ids, propertyNames);
+}
+
+uint QDBusMenuAdaptor::GetLayout(int parentId, int recursionDepth, const QStringList &propertyNames, QDBusMenuLayoutItem &layout)
+{
+ uint ret = layout.populate(parentId, recursionDepth, propertyNames, m_topLevelMenu);
+ qCDebug(qLcMenu) << parentId << "depth" << recursionDepth << propertyNames << layout.m_id << layout.m_properties << "revision" << ret << layout;
+ return ret;
+}
+
+QDBusVariant QDBusMenuAdaptor::GetProperty(int id, const QString &name)
+{
+ qCDebug(qLcMenu) << id << name;
+ // handle method call com.canonical.dbusmenu.GetProperty
+ QDBusVariant value;
+ return value;
+}
+
+QT_END_NAMESPACE
+
+#include "moc_qdbusmenuadaptor_p.cpp"
diff --git a/src/gui/platform/unix/dbusmenu/qdbusmenuadaptor_p.h b/src/gui/platform/unix/dbusmenu/qdbusmenuadaptor_p.h
new file mode 100644
index 0000000000..b6f538f6b3
--- /dev/null
+++ b/src/gui/platform/unix/dbusmenu/qdbusmenuadaptor_p.h
@@ -0,0 +1,147 @@
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
+
+/*
+ This file was originally created by qdbusxml2cpp version 0.8
+ Command line was:
+ qdbusxml2cpp -a dbusmenu ../../3rdparty/dbus-ifaces/dbus-menu.xml
+
+ However it is maintained manually.
+
+ It is also not part of the public API. This header file may change from
+ version to version without notice, or even be removed.
+*/
+
+#ifndef DBUSMENUADAPTOR_H
+#define DBUSMENUADAPTOR_H
+
+//
+// W A R N I N G
+// -------------
+//
+// This file is not part of the Qt API. It exists purely as an
+// implementation detail. This header file may change from version to
+// version without notice, or even be removed.
+//
+// We mean it.
+//
+
+#include <QObject>
+#include <QDBusAbstractAdaptor>
+
+#include <private/qdbusmenutypes_p.h>
+
+QT_BEGIN_NAMESPACE
+
+/*
+ * Adaptor class for interface com.canonical.dbusmenu
+ */
+class QDBusMenuAdaptor: public QDBusAbstractAdaptor
+{
+ Q_OBJECT
+ Q_CLASSINFO("D-Bus Interface", "com.canonical.dbusmenu")
+ Q_CLASSINFO("D-Bus Introspection", ""
+" <interface name=\"com.canonical.dbusmenu\">\n"
+" <property access=\"read\" type=\"u\" name=\"Version\">\n"
+" </property>\n"
+" <property access=\"read\" type=\"s\" name=\"TextDirection\">\n"
+" </property>\n"
+" <property access=\"read\" type=\"s\" name=\"Status\">\n"
+" </property>\n"
+" <property access=\"read\" type=\"as\" name=\"IconThemePath\">\n"
+" </property>\n"
+" <method name=\"GetLayout\">\n"
+" <annotation value=\"QDBusMenuLayoutItem\" name=\"org.qtproject.QtDBus.QtTypeName.Out1\"/>\n"
+" <arg direction=\"in\" type=\"i\" name=\"parentId\"/>\n"
+" <arg direction=\"in\" type=\"i\" name=\"recursionDepth\"/>\n"
+" <arg direction=\"in\" type=\"as\" name=\"propertyNames\"/>\n"
+" <arg direction=\"out\" type=\"u\" name=\"revision\"/>\n"
+" <arg direction=\"out\" type=\"(ia{sv}av)\" name=\"layout\"/>\n"
+" </method>\n"
+" <method name=\"GetGroupProperties\">\n"
+" <annotation value=\"QList&lt;int&gt;\" name=\"org.qtproject.QtDBus.QtTypeName.In0\"/>\n"
+" <annotation value=\"QDBusMenuItemList\" name=\"org.qtproject.QtDBus.QtTypeName.Out0\"/>\n"
+" <arg direction=\"in\" type=\"ai\" name=\"ids\"/>\n"
+" <arg direction=\"in\" type=\"as\" name=\"propertyNames\"/>\n"
+" <arg direction=\"out\" type=\"a(ia{sv})\" name=\"properties\"/>\n"
+" </method>\n"
+" <method name=\"GetProperty\">\n"
+" <arg direction=\"in\" type=\"i\" name=\"id\"/>\n"
+" <arg direction=\"in\" type=\"s\" name=\"name\"/>\n"
+" <arg direction=\"out\" type=\"v\" name=\"value\"/>\n"
+" </method>\n"
+" <method name=\"Event\">\n"
+" <arg direction=\"in\" type=\"i\" name=\"id\"/>\n"
+" <arg direction=\"in\" type=\"s\" name=\"eventId\"/>\n"
+" <arg direction=\"in\" type=\"v\" name=\"data\"/>\n"
+" <arg direction=\"in\" type=\"u\" name=\"timestamp\"/>\n"
+" </method>\n"
+" <method name=\"EventGroup\">\n"
+" <annotation value=\"QList&lt;QDBusMenuEvent&gt;\" name=\"org.qtproject.QtDBus.QtTypeName.In0\"/>\n"
+" <annotation value=\"QList&lt;int&gt;\" name=\"org.qtproject.QtDBus.QtTypeName.Out0\"/>\n"
+" <arg direction=\"in\" type=\"a(isvu)\" name=\"events\"/>\n"
+" <arg direction=\"out\" type=\"ai\" name=\"idErrors\"/>\n"
+" </method>\n"
+" <method name=\"AboutToShow\">\n"
+" <arg direction=\"in\" type=\"i\" name=\"id\"/>\n"
+" <arg direction=\"out\" type=\"b\" name=\"needUpdate\"/>\n"
+" </method>\n"
+" <method name=\"AboutToShowGroup\">\n"
+" <annotation value=\"QList&lt;int&gt;\" name=\"org.qtproject.QtDBus.QtTypeName.In0\"/>\n"
+" <annotation value=\"QList&lt;int&gt;\" name=\"org.qtproject.QtDBus.QtTypeName.Out0\"/>\n"
+" <annotation value=\"QList&lt;int&gt;\" name=\"org.qtproject.QtDBus.QtTypeName.Out1\"/>\n"
+" <arg direction=\"in\" type=\"ai\" name=\"ids\"/>\n"
+" <arg direction=\"out\" type=\"ai\" name=\"updatesNeeded\"/>\n"
+" <arg direction=\"out\" type=\"ai\" name=\"idErrors\"/>\n"
+" </method>\n"
+" <signal name=\"ItemsPropertiesUpdated\">\n"
+" <annotation value=\"QDBusMenuItemList\" name=\"org.qtproject.QtDBus.QtTypeName.In0\"/>\n"
+" <annotation value=\"QDBusMenuItemKeysList\" name=\"org.qtproject.QtDBus.QtTypeName.In1\"/>\n"
+" <arg direction=\"out\" type=\"a(ia{sv})\" name=\"updatedProps\"/>\n"
+" <arg direction=\"out\" type=\"a(ias)\" name=\"removedProps\"/>\n"
+" </signal>\n"
+" <signal name=\"LayoutUpdated\">\n"
+" <arg direction=\"out\" type=\"u\" name=\"revision\"/>\n"
+" <arg direction=\"out\" type=\"i\" name=\"parent\"/>\n"
+" </signal>\n"
+" <signal name=\"ItemActivationRequested\">\n"
+" <arg direction=\"out\" type=\"i\" name=\"id\"/>\n"
+" <arg direction=\"out\" type=\"u\" name=\"timestamp\"/>\n"
+" </signal>\n"
+" </interface>\n"
+ "")
+public:
+ QDBusMenuAdaptor(QDBusPlatformMenu *topLevelMenu);
+ virtual ~QDBusMenuAdaptor();
+
+public: // PROPERTIES
+ Q_PROPERTY(QString Status READ status)
+ QString status() const;
+
+ Q_PROPERTY(QString TextDirection READ textDirection)
+ QString textDirection() const;
+
+ Q_PROPERTY(uint Version READ version)
+ uint version() const;
+
+public Q_SLOTS: // METHODS
+ bool AboutToShow(int id);
+ QList<int> AboutToShowGroup(const QList<int> &ids, QList<int> &idErrors);
+ void Event(int id, const QString &eventId, const QDBusVariant &data, uint timestamp);
+ QList<int> EventGroup(const QDBusMenuEventList &events);
+ QDBusMenuItemList GetGroupProperties(const QList<int> &ids, const QStringList &propertyNames);
+ uint GetLayout(int parentId, int recursionDepth, const QStringList &propertyNames, QDBusMenuLayoutItem &layout);
+ QDBusVariant GetProperty(int id, const QString &name);
+
+Q_SIGNALS: // SIGNALS
+ void ItemActivationRequested(int id, uint timestamp);
+ void ItemsPropertiesUpdated(const QDBusMenuItemList &updatedProps, const QDBusMenuItemKeysList &removedProps);
+ void LayoutUpdated(uint revision, int parent);
+
+private:
+ QDBusPlatformMenu *m_topLevelMenu;
+};
+
+QT_END_NAMESPACE
+
+#endif // DBUSMENUADAPTOR_H
diff --git a/src/gui/platform/unix/dbusmenu/qdbusmenubar.cpp b/src/gui/platform/unix/dbusmenu/qdbusmenubar.cpp
new file mode 100644
index 0000000000..2c006366cb
--- /dev/null
+++ b/src/gui/platform/unix/dbusmenu/qdbusmenubar.cpp
@@ -0,0 +1,147 @@
+// Copyright (C) 2016 Dmitry Shachnev <mitya57@gmail.com>
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
+
+#include "qdbusmenubar_p.h"
+#include "qdbusmenuregistrarproxy_p.h"
+
+QT_BEGIN_NAMESPACE
+
+using namespace Qt::StringLiterals;
+
+/* note: do not change these to QStringLiteral;
+ we are unloaded before QtDBus is done using the strings.
+ */
+#define REGISTRAR_SERVICE "com.canonical.AppMenu.Registrar"_L1
+#define REGISTRAR_PATH "/com/canonical/AppMenu/Registrar"_L1
+
+QDBusMenuBar::QDBusMenuBar()
+ : QPlatformMenuBar()
+ , m_menu(new QDBusPlatformMenu())
+ , m_menuAdaptor(new QDBusMenuAdaptor(m_menu))
+ , m_windowId(0)
+{
+ QDBusMenuItem::registerDBusTypes();
+ connect(m_menu, &QDBusPlatformMenu::propertiesUpdated,
+ m_menuAdaptor, &QDBusMenuAdaptor::ItemsPropertiesUpdated);
+ connect(m_menu, &QDBusPlatformMenu::updated,
+ m_menuAdaptor, &QDBusMenuAdaptor::LayoutUpdated);
+ connect(m_menu, &QDBusPlatformMenu::popupRequested,
+ m_menuAdaptor, &QDBusMenuAdaptor::ItemActivationRequested);
+}
+
+QDBusMenuBar::~QDBusMenuBar()
+{
+ unregisterMenuBar();
+ delete m_menuAdaptor;
+ delete m_menu;
+ qDeleteAll(m_menuItems);
+}
+
+QDBusPlatformMenuItem *QDBusMenuBar::menuItemForMenu(QPlatformMenu *menu)
+{
+ if (!menu)
+ return nullptr;
+ quintptr tag = menu->tag();
+ const auto it = m_menuItems.constFind(tag);
+ if (it != m_menuItems.cend()) {
+ return *it;
+ } else {
+ QDBusPlatformMenuItem *item = new QDBusPlatformMenuItem;
+ updateMenuItem(item, menu);
+ m_menuItems.insert(tag, item);
+ return item;
+ }
+}
+
+void QDBusMenuBar::updateMenuItem(QDBusPlatformMenuItem *item, QPlatformMenu *menu)
+{
+ const QDBusPlatformMenu *ourMenu = qobject_cast<const QDBusPlatformMenu *>(menu);
+ item->setText(ourMenu->text());
+ item->setIcon(ourMenu->icon());
+ item->setEnabled(ourMenu->isEnabled());
+ item->setVisible(ourMenu->isVisible());
+ item->setMenu(menu);
+}
+
+void QDBusMenuBar::insertMenu(QPlatformMenu *menu, QPlatformMenu *before)
+{
+ QDBusPlatformMenuItem *menuItem = menuItemForMenu(menu);
+ QDBusPlatformMenuItem *beforeItem = menuItemForMenu(before);
+ m_menu->insertMenuItem(menuItem, beforeItem);
+ m_menu->emitUpdated();
+}
+
+void QDBusMenuBar::removeMenu(QPlatformMenu *menu)
+{
+ QDBusPlatformMenuItem *menuItem = menuItemForMenu(menu);
+ m_menu->removeMenuItem(menuItem);
+ m_menu->emitUpdated();
+}
+
+void QDBusMenuBar::syncMenu(QPlatformMenu *menu)
+{
+ QDBusPlatformMenuItem *menuItem = menuItemForMenu(menu);
+ updateMenuItem(menuItem, menu);
+}
+
+void QDBusMenuBar::handleReparent(QWindow *newParentWindow)
+{
+ if (newParentWindow) {
+ unregisterMenuBar();
+ m_windowId = newParentWindow->winId();
+ registerMenuBar();
+ }
+}
+
+QPlatformMenu *QDBusMenuBar::menuForTag(quintptr tag) const
+{
+ QDBusPlatformMenuItem *menuItem = m_menuItems.value(tag);
+ if (menuItem)
+ return const_cast<QPlatformMenu *>(menuItem->menu());
+ return nullptr;
+}
+
+QPlatformMenu *QDBusMenuBar::createMenu() const
+{
+ return new QDBusPlatformMenu;
+}
+
+void QDBusMenuBar::registerMenuBar()
+{
+ static uint menuBarId = 0;
+
+ QDBusConnection connection = QDBusConnection::sessionBus();
+ m_objectPath = QStringLiteral("/MenuBar/%1").arg(++menuBarId);
+ if (!connection.registerObject(m_objectPath, m_menu))
+ return;
+
+ QDBusMenuRegistrarInterface registrar(REGISTRAR_SERVICE, REGISTRAR_PATH, connection, this);
+ QDBusPendingReply<> r = registrar.RegisterWindow(m_windowId, QDBusObjectPath(m_objectPath));
+ r.waitForFinished();
+ if (r.isError()) {
+ qWarning("Failed to register window menu, reason: %s (\"%s\")",
+ qUtf8Printable(r.error().name()), qUtf8Printable(r.error().message()));
+ connection.unregisterObject(m_objectPath);
+ }
+}
+
+void QDBusMenuBar::unregisterMenuBar()
+{
+ QDBusConnection connection = QDBusConnection::sessionBus();
+
+ if (m_windowId) {
+ QDBusMenuRegistrarInterface registrar(REGISTRAR_SERVICE, REGISTRAR_PATH, connection, this);
+ QDBusPendingReply<> r = registrar.UnregisterWindow(m_windowId);
+ r.waitForFinished();
+ if (r.isError())
+ qWarning("Failed to unregister window menu, reason: %s (\"%s\")",
+ qUtf8Printable(r.error().name()), qUtf8Printable(r.error().message()));
+ }
+
+ if (!m_objectPath.isEmpty())
+ connection.unregisterObject(m_objectPath);
+}
+
+QT_END_NAMESPACE
+
+#include "moc_qdbusmenubar_p.cpp"
diff --git a/src/gui/platform/unix/dbusmenu/qdbusmenubar_p.h b/src/gui/platform/unix/dbusmenu/qdbusmenubar_p.h
new file mode 100644
index 0000000000..3028df7215
--- /dev/null
+++ b/src/gui/platform/unix/dbusmenu/qdbusmenubar_p.h
@@ -0,0 +1,56 @@
+// Copyright (C) 2016 Dmitry Shachnev <mitya57@gmail.com>
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
+
+#ifndef QDBUSMENUBAR_P_H
+#define QDBUSMENUBAR_P_H
+
+//
+// W A R N I N G
+// -------------
+//
+// This file is not part of the Qt API. It exists purely as an
+// implementation detail. This header file may change from version to
+// version without notice, or even be removed.
+//
+// We mean it.
+//
+
+#include <private/qdbusplatformmenu_p.h>
+#include <private/qdbusmenuadaptor_p.h>
+#include <QtCore/QHash>
+#include <QtCore/QString>
+#include <QtGui/QWindow>
+
+QT_BEGIN_NAMESPACE
+
+class QDBusMenuBar : public QPlatformMenuBar
+{
+ Q_OBJECT
+
+public:
+ QDBusMenuBar();
+ virtual ~QDBusMenuBar();
+
+ void insertMenu(QPlatformMenu *menu, QPlatformMenu *before) override;
+ void removeMenu(QPlatformMenu *menu) override;
+ void syncMenu(QPlatformMenu *menu) override;
+ void handleReparent(QWindow *newParentWindow) override;
+ QPlatformMenu *menuForTag(quintptr tag) const override;
+ QPlatformMenu *createMenu() const override;
+
+private:
+ QDBusPlatformMenu *m_menu;
+ QDBusMenuAdaptor *m_menuAdaptor;
+ QHash<quintptr, QDBusPlatformMenuItem *> m_menuItems;
+ uint m_windowId;
+ QString m_objectPath;
+
+ QDBusPlatformMenuItem *menuItemForMenu(QPlatformMenu *menu);
+ static void updateMenuItem(QDBusPlatformMenuItem *item, QPlatformMenu *menu);
+ void registerMenuBar();
+ void unregisterMenuBar();
+};
+
+QT_END_NAMESPACE
+
+#endif // QDBUSMENUBAR_P_H
diff --git a/src/gui/platform/unix/dbusmenu/qdbusmenuconnection.cpp b/src/gui/platform/unix/dbusmenu/qdbusmenuconnection.cpp
new file mode 100644
index 0000000000..1023b16662
--- /dev/null
+++ b/src/gui/platform/unix/dbusmenu/qdbusmenuconnection.cpp
@@ -0,0 +1,114 @@
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
+
+#include <QtGui/qtgui-config.h>
+
+#include <QDBusMessage>
+#include <QDBusInterface>
+#include <QDBusServiceWatcher>
+#include <QDBusConnectionInterface>
+#include <QDebug>
+#include <QCoreApplication>
+
+#ifndef QT_NO_SYSTEMTRAYICON
+#include <private/qdbustrayicon_p.h>
+#endif
+#include <private/qdbusmenuconnection_p.h>
+#include <private/qdbusmenuadaptor_p.h>
+#include <private/qdbusplatformmenu_p.h>
+
+QT_BEGIN_NAMESPACE
+
+using namespace Qt::StringLiterals;
+
+Q_DECLARE_LOGGING_CATEGORY(qLcMenu)
+
+const QString StatusNotifierWatcherService = "org.kde.StatusNotifierWatcher"_L1;
+const QString StatusNotifierWatcherPath = "/StatusNotifierWatcher"_L1;
+const QString StatusNotifierItemPath = "/StatusNotifierItem"_L1;
+const QString MenuBarPath = "/MenuBar"_L1;
+
+/*!
+ \class QDBusMenuConnection
+ \internal
+ A D-Bus connection which is used for both menu and tray icon services.
+ Connects to the session bus and registers with the respective watcher services.
+*/
+QDBusMenuConnection::QDBusMenuConnection(QObject *parent, const QString &serviceName)
+ : QObject(parent)
+ , m_serviceName(serviceName)
+ , m_connection(serviceName.isNull() ? QDBusConnection::sessionBus()
+ : QDBusConnection::connectToBus(QDBusConnection::SessionBus, serviceName))
+ , m_dbusWatcher(new QDBusServiceWatcher(StatusNotifierWatcherService, m_connection, QDBusServiceWatcher::WatchForRegistration, this))
+ , m_watcherRegistered(false)
+{
+#ifndef QT_NO_SYSTEMTRAYICON
+ // Start monitoring if any known tray-related services are registered.
+ if (m_connection.interface()->isServiceRegistered(StatusNotifierWatcherService))
+ m_watcherRegistered = true;
+ else
+ qCDebug(qLcMenu) << "failed to find service" << StatusNotifierWatcherService;
+#endif
+}
+
+QDBusMenuConnection::~QDBusMenuConnection()
+{
+ if (!m_serviceName.isEmpty() && m_connection.isConnected())
+ QDBusConnection::disconnectFromBus(m_serviceName);
+}
+
+void QDBusMenuConnection::dbusError(const QDBusError &error)
+{
+ qWarning() << "QDBusTrayIcon encountered a D-Bus error:" << error;
+}
+
+#ifndef QT_NO_SYSTEMTRAYICON
+bool QDBusMenuConnection::registerTrayIconMenu(QDBusTrayIcon *item)
+{
+ bool success = connection().registerObject(MenuBarPath, item->menu());
+ if (!success) // success == false is normal, because the object may be already registered
+ qCDebug(qLcMenu) << "failed to register" << item->instanceId() << MenuBarPath;
+ return success;
+}
+
+void QDBusMenuConnection::unregisterTrayIconMenu(QDBusTrayIcon *item)
+{
+ if (item->menu())
+ connection().unregisterObject(MenuBarPath);
+}
+
+bool QDBusMenuConnection::registerTrayIcon(QDBusTrayIcon *item)
+{
+ bool success = connection().registerObject(StatusNotifierItemPath, item);
+ if (!success) {
+ unregisterTrayIcon(item);
+ qWarning() << "failed to register" << item->instanceId() << StatusNotifierItemPath;
+ return false;
+ }
+
+ if (item->menu())
+ registerTrayIconMenu(item);
+
+ return registerTrayIconWithWatcher(item);
+}
+
+bool QDBusMenuConnection::registerTrayIconWithWatcher(QDBusTrayIcon *item)
+{
+ Q_UNUSED(item);
+ QDBusMessage registerMethod = QDBusMessage::createMethodCall(
+ StatusNotifierWatcherService, StatusNotifierWatcherPath, StatusNotifierWatcherService,
+ "RegisterStatusNotifierItem"_L1);
+ registerMethod.setArguments(QVariantList() << m_connection.baseService());
+ return m_connection.callWithCallback(registerMethod, this, SIGNAL(trayIconRegistered()), SLOT(dbusError(QDBusError)));
+}
+
+void QDBusMenuConnection::unregisterTrayIcon(QDBusTrayIcon *item)
+{
+ unregisterTrayIconMenu(item);
+ connection().unregisterObject(StatusNotifierItemPath);
+}
+#endif // QT_NO_SYSTEMTRAYICON
+
+QT_END_NAMESPACE
+
+#include "moc_qdbusmenuconnection_p.cpp"
diff --git a/src/gui/platform/unix/dbusmenu/qdbusmenuconnection_p.h b/src/gui/platform/unix/dbusmenu/qdbusmenuconnection_p.h
new file mode 100644
index 0000000000..37033e2fa3
--- /dev/null
+++ b/src/gui/platform/unix/dbusmenu/qdbusmenuconnection_p.h
@@ -0,0 +1,68 @@
+// Copyright (C) 2020 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
+
+#ifndef QDBUSMENUCONNECTION_H
+#define QDBUSMENUCONNECTION_H
+
+//
+// W A R N I N G
+// -------------
+//
+// This file is not part of the Qt API. It exists purely as an
+// implementation detail. This header file may change from version to
+// version without notice, or even be removed.
+//
+// We mean it.
+//
+
+#include <QtCore/QString>
+#include <QtDBus/QDBusConnection>
+#include <QtDBus/QDBusVariant>
+
+#include <QtGui/qtgui-config.h>
+#include <QtCore/private/qglobal_p.h>
+Q_MOC_INCLUDE(<QtDBus/QDBusError>)
+
+QT_BEGIN_NAMESPACE
+
+class QDBusServiceWatcher;
+#ifndef QT_NO_SYSTEMTRAYICON
+class QDBusTrayIcon;
+#endif // QT_NO_SYSTEMTRAYICON
+
+class QDBusMenuConnection : public QObject
+{
+ Q_OBJECT
+
+public:
+ QDBusMenuConnection(QObject *parent = nullptr, const QString &serviceName = QString());
+ ~QDBusMenuConnection();
+ QDBusConnection connection() const { return m_connection; }
+ QDBusServiceWatcher *dbusWatcher() const { return m_dbusWatcher; }
+ bool isWatcherRegistered() const { return m_watcherRegistered; }
+#ifndef QT_NO_SYSTEMTRAYICON
+ bool registerTrayIconMenu(QDBusTrayIcon *item);
+ void unregisterTrayIconMenu(QDBusTrayIcon *item);
+ bool registerTrayIcon(QDBusTrayIcon *item);
+ bool registerTrayIconWithWatcher(QDBusTrayIcon *item);
+ void unregisterTrayIcon(QDBusTrayIcon *item);
+#endif // QT_NO_SYSTEMTRAYICON
+
+Q_SIGNALS:
+#ifndef QT_NO_SYSTEMTRAYICON
+ void trayIconRegistered();
+#endif // QT_NO_SYSTEMTRAYICON
+
+private Q_SLOTS:
+ void dbusError(const QDBusError &error);
+
+private:
+ QString m_serviceName;
+ QDBusConnection m_connection;
+ QDBusServiceWatcher *m_dbusWatcher;
+ bool m_watcherRegistered;
+};
+
+QT_END_NAMESPACE
+
+#endif // QDBUSMENUCONNECTION_H
diff --git a/src/gui/platform/unix/dbusmenu/qdbusmenuregistrarproxy.cpp b/src/gui/platform/unix/dbusmenu/qdbusmenuregistrarproxy.cpp
new file mode 100644
index 0000000000..089bf5de47
--- /dev/null
+++ b/src/gui/platform/unix/dbusmenu/qdbusmenuregistrarproxy.cpp
@@ -0,0 +1,30 @@
+// Copyright (C) 2016 Dmitry Shachnev <mitya57@gmail.com>
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
+
+/*
+ * This file was originally created by qdbusxml2cpp version 0.8
+ * Command line was: qdbusxml2cpp -p qdbusmenuregistrarproxy ../../3rdparty/dbus-ifaces/com.canonical.AppMenu.Registrar.xml
+ *
+ * However it is maintained manually.
+ */
+
+#include "qdbusmenuregistrarproxy_p.h"
+
+QT_BEGIN_NAMESPACE
+
+/*
+ * Implementation of interface class QDBusMenuRegistrarInterface
+ */
+
+QDBusMenuRegistrarInterface::QDBusMenuRegistrarInterface(const QString &service, const QString &path, const QDBusConnection &connection, QObject *parent)
+ : QDBusAbstractInterface(service, path, staticInterfaceName(), connection, parent)
+{
+}
+
+QDBusMenuRegistrarInterface::~QDBusMenuRegistrarInterface()
+{
+}
+
+QT_END_NAMESPACE
+
+#include "moc_qdbusmenuregistrarproxy_p.cpp"
diff --git a/src/gui/platform/unix/dbusmenu/qdbusmenuregistrarproxy_p.h b/src/gui/platform/unix/dbusmenu/qdbusmenuregistrarproxy_p.h
new file mode 100644
index 0000000000..8041f3af0a
--- /dev/null
+++ b/src/gui/platform/unix/dbusmenu/qdbusmenuregistrarproxy_p.h
@@ -0,0 +1,84 @@
+// Copyright (C) 2016 Dmitry Shachnev <mitya57@gmail.com>
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
+
+/*
+ * This file was originally created by qdbusxml2cpp version 0.8
+ * Command line was: qdbusxml2cpp -p qdbusmenuregistrarproxy ../../3rdparty/dbus-ifaces/com.canonical.AppMenu.Registrar.xml
+ *
+ * However it is maintained manually.
+ */
+
+#ifndef QDBUSMENUREGISTRARPROXY_P_H
+#define QDBUSMENUREGISTRARPROXY_P_H
+
+//
+// W A R N I N G
+// -------------
+//
+// This file is not part of the Qt API. It exists purely as an
+// implementation detail. This header file may change from version to
+// version without notice, or even be removed.
+//
+// We mean it.
+//
+
+#include <QtCore/QObject>
+#include <QtCore/QByteArray>
+#include <QtCore/QList>
+#include <QtCore/QString>
+#include <QtCore/QVariant>
+#include <QtDBus/QDBusAbstractInterface>
+#include <QtDBus/QDBusConnection>
+#include <QtDBus/QDBusReply>
+#include <QtCore/private/qglobal_p.h>
+
+QT_BEGIN_NAMESPACE
+
+/*
+ * Proxy class for interface com.canonical.AppMenu.Registrar
+ */
+class QDBusMenuRegistrarInterface : public QDBusAbstractInterface
+{
+ Q_OBJECT
+public:
+ static inline const char *staticInterfaceName()
+ {
+ return "com.canonical.AppMenu.Registrar";
+ }
+
+public:
+ explicit QDBusMenuRegistrarInterface(const QString &service,
+ const QString &path,
+ const QDBusConnection &connection,
+ QObject *parent = nullptr);
+
+ ~QDBusMenuRegistrarInterface();
+
+public Q_SLOTS: // METHODS
+ QDBusPendingReply<QString, QDBusObjectPath> GetMenuForWindow(uint windowId)
+ {
+ return asyncCall(QStringLiteral("GetMenuForWindow"), windowId);
+ }
+ QDBusReply<QString> GetMenuForWindow(uint windowId, QDBusObjectPath &menuObjectPath)
+ {
+ QDBusMessage reply = call(QDBus::Block, QStringLiteral("GetMenuForWindow"), windowId);
+ QList<QVariant> arguments = reply.arguments();
+ if (reply.type() == QDBusMessage::ReplyMessage && arguments.size() == 2)
+ menuObjectPath = qdbus_cast<QDBusObjectPath>(arguments.at(1));
+ return reply;
+ }
+
+ QDBusPendingReply<> RegisterWindow(uint windowId, const QDBusObjectPath &menuObjectPath)
+ {
+ return asyncCall(QStringLiteral("RegisterWindow"), windowId, menuObjectPath);
+ }
+
+ QDBusPendingReply<> UnregisterWindow(uint windowId)
+ {
+ return asyncCall(QStringLiteral("UnregisterWindow"), windowId);
+ }
+};
+
+QT_END_NAMESPACE
+
+#endif // QDBUSMENUREGISTRARPROXY_P_H
diff --git a/src/gui/platform/unix/dbusmenu/qdbusmenutypes.cpp b/src/gui/platform/unix/dbusmenu/qdbusmenutypes.cpp
new file mode 100644
index 0000000000..b7fd035883
--- /dev/null
+++ b/src/gui/platform/unix/dbusmenu/qdbusmenutypes.cpp
@@ -0,0 +1,279 @@
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
+
+#include "qdbusmenutypes_p.h"
+
+#include <QDBusConnection>
+#include <QDBusMetaType>
+#include <QImage>
+#include <QIcon>
+#include <QImage>
+#include <QPixmap>
+#include <QDebug>
+#include <QtEndian>
+#include <QBuffer>
+#if QT_CONFIG(shortcut)
+# include <private/qkeysequence_p.h>
+#endif
+#include <qpa/qplatformmenu.h>
+#include "qdbusplatformmenu_p.h"
+
+QT_BEGIN_NAMESPACE
+
+using namespace Qt::StringLiterals;
+
+QT_IMPL_METATYPE_EXTERN(QDBusMenuItem)
+QT_IMPL_METATYPE_EXTERN(QDBusMenuItemList)
+QT_IMPL_METATYPE_EXTERN(QDBusMenuItemKeys)
+QT_IMPL_METATYPE_EXTERN(QDBusMenuItemKeysList)
+QT_IMPL_METATYPE_EXTERN(QDBusMenuLayoutItem)
+QT_IMPL_METATYPE_EXTERN(QDBusMenuLayoutItemList)
+QT_IMPL_METATYPE_EXTERN(QDBusMenuEvent)
+QT_IMPL_METATYPE_EXTERN(QDBusMenuEventList)
+QT_IMPL_METATYPE_EXTERN(QDBusMenuShortcut)
+
+const QDBusArgument &operator<<(QDBusArgument &arg, const QDBusMenuItem &item)
+{
+ arg.beginStructure();
+ arg << item.m_id << item.m_properties;
+ arg.endStructure();
+ return arg;
+}
+
+const QDBusArgument &operator>>(const QDBusArgument &arg, QDBusMenuItem &item)
+{
+ arg.beginStructure();
+ arg >> item.m_id >> item.m_properties;
+ arg.endStructure();
+ return arg;
+}
+
+const QDBusArgument &operator<<(QDBusArgument &arg, const QDBusMenuItemKeys &keys)
+{
+ arg.beginStructure();
+ arg << keys.id << keys.properties;
+ arg.endStructure();
+ return arg;
+}
+
+const QDBusArgument &operator>>(const QDBusArgument &arg, QDBusMenuItemKeys &keys)
+{
+ arg.beginStructure();
+ arg >> keys.id >> keys.properties;
+ arg.endStructure();
+ return arg;
+}
+
+uint QDBusMenuLayoutItem::populate(int id, int depth, const QStringList &propertyNames, const QDBusPlatformMenu *topLevelMenu)
+{
+ qCDebug(qLcMenu) << id << "depth" << depth << propertyNames;
+ m_id = id;
+ if (id == 0) {
+ m_properties.insert("children-display"_L1, "submenu"_L1);
+ if (topLevelMenu)
+ populate(topLevelMenu, depth, propertyNames);
+ return 1; // revision
+ }
+
+ QDBusPlatformMenuItem *item = QDBusPlatformMenuItem::byId(id);
+ if (item) {
+ const QDBusPlatformMenu *menu = static_cast<const QDBusPlatformMenu *>(item->menu());
+
+ if (menu) {
+ if (depth != 0)
+ populate(menu, depth, propertyNames);
+ return menu->revision();
+ }
+ }
+
+ return 1; // revision
+}
+
+void QDBusMenuLayoutItem::populate(const QDBusPlatformMenu *menu, int depth, const QStringList &propertyNames)
+{
+ const auto items = menu->items();
+ for (QDBusPlatformMenuItem *item : items) {
+ QDBusMenuLayoutItem child;
+ child.populate(item, depth - 1, propertyNames);
+ m_children << child;
+ }
+}
+
+void QDBusMenuLayoutItem::populate(const QDBusPlatformMenuItem *item, int depth, const QStringList &propertyNames)
+{
+ m_id = item->dbusID();
+ QDBusMenuItem proxy(item);
+ m_properties = proxy.m_properties;
+
+ const QDBusPlatformMenu *menu = static_cast<const QDBusPlatformMenu *>(item->menu());
+ if (depth != 0 && menu)
+ populate(menu, depth, propertyNames);
+}
+
+const QDBusArgument &operator<<(QDBusArgument &arg, const QDBusMenuLayoutItem &item)
+{
+ arg.beginStructure();
+ arg << item.m_id << item.m_properties;
+ arg.beginArray(qMetaTypeId<QDBusVariant>());
+ for (const QDBusMenuLayoutItem &child : item.m_children)
+ arg << QDBusVariant(QVariant::fromValue<QDBusMenuLayoutItem>(child));
+ arg.endArray();
+ arg.endStructure();
+ return arg;
+}
+
+const QDBusArgument &operator>>(const QDBusArgument &arg, QDBusMenuLayoutItem &item)
+{
+ arg.beginStructure();
+ arg >> item.m_id >> item.m_properties;
+ arg.beginArray();
+ while (!arg.atEnd()) {
+ QDBusVariant dbusVariant;
+ arg >> dbusVariant;
+ QDBusArgument childArgument = qvariant_cast<QDBusArgument>(dbusVariant.variant());
+
+ QDBusMenuLayoutItem child;
+ childArgument >> child;
+ item.m_children.append(child);
+ }
+ arg.endArray();
+ arg.endStructure();
+ return arg;
+}
+
+void QDBusMenuItem::registerDBusTypes()
+{
+ qDBusRegisterMetaType<QDBusMenuItem>();
+ qDBusRegisterMetaType<QDBusMenuItemList>();
+ qDBusRegisterMetaType<QDBusMenuItemKeys>();
+ qDBusRegisterMetaType<QDBusMenuItemKeysList>();
+ qDBusRegisterMetaType<QDBusMenuLayoutItem>();
+ qDBusRegisterMetaType<QDBusMenuLayoutItemList>();
+ qDBusRegisterMetaType<QDBusMenuEvent>();
+ qDBusRegisterMetaType<QDBusMenuEventList>();
+ qDBusRegisterMetaType<QDBusMenuShortcut>();
+}
+
+QDBusMenuItem::QDBusMenuItem(const QDBusPlatformMenuItem *item)
+ : m_id(item->dbusID())
+{
+ if (item->isSeparator()) {
+ m_properties.insert("type"_L1, "separator"_L1);
+ } else {
+ m_properties.insert("label"_L1, convertMnemonic(item->text()));
+ if (item->menu())
+ m_properties.insert("children-display"_L1, "submenu"_L1);
+ m_properties.insert("enabled"_L1, item->isEnabled());
+ if (item->isCheckable()) {
+ QString toggleType = item->hasExclusiveGroup() ? "radio"_L1 : "checkmark"_L1;
+ m_properties.insert("toggle-type"_L1, toggleType);
+ m_properties.insert("toggle-state"_L1, item->isChecked() ? 1 : 0);
+ }
+#ifndef QT_NO_SHORTCUT
+ const QKeySequence &scut = item->shortcut();
+ if (!scut.isEmpty()) {
+ QDBusMenuShortcut shortcut = convertKeySequence(scut);
+ m_properties.insert("shortcut"_L1, QVariant::fromValue(shortcut));
+ }
+#endif
+ const QIcon &icon = item->icon();
+ if (!icon.name().isEmpty()) {
+ m_properties.insert("icon-name"_L1, icon.name());
+ } else if (!icon.isNull()) {
+ QBuffer buf;
+ icon.pixmap(16).save(&buf, "PNG");
+ m_properties.insert("icon-data"_L1, buf.data());
+ }
+ }
+ m_properties.insert("visible"_L1, item->isVisible());
+}
+
+QDBusMenuItemList QDBusMenuItem::items(const QList<int> &ids, const QStringList &propertyNames)
+{
+ Q_UNUSED(propertyNames);
+ QDBusMenuItemList ret;
+ const QList<const QDBusPlatformMenuItem *> items = QDBusPlatformMenuItem::byIds(ids);
+ ret.reserve(items.size());
+ for (const QDBusPlatformMenuItem *item : items)
+ ret << QDBusMenuItem(item);
+ return ret;
+}
+
+QString QDBusMenuItem::convertMnemonic(const QString &label)
+{
+ // convert only the first occurrence of ampersand which is not at the end
+ // dbusmenu uses underscore instead of ampersand
+ int idx = label.indexOf(u'&');
+ if (idx < 0 || idx == label.size() - 1)
+ return label;
+ QString ret(label);
+ ret[idx] = u'_';
+ return ret;
+}
+
+#ifndef QT_NO_SHORTCUT
+QDBusMenuShortcut QDBusMenuItem::convertKeySequence(const QKeySequence &sequence)
+{
+ QDBusMenuShortcut shortcut;
+ for (int i = 0; i < sequence.count(); ++i) {
+ QStringList tokens;
+ auto modifiers = sequence[i].keyboardModifiers();
+ if (modifiers & Qt::MetaModifier)
+ tokens << QStringLiteral("Super");
+ if (modifiers & Qt::ControlModifier)
+ tokens << QStringLiteral("Control");
+ if (modifiers & Qt::AltModifier)
+ tokens << QStringLiteral("Alt");
+ if (modifiers & Qt::ShiftModifier)
+ tokens << QStringLiteral("Shift");
+ if (modifiers & Qt::KeypadModifier)
+ tokens << QStringLiteral("Num");
+
+ QString keyName = QKeySequencePrivate::keyName(sequence[i].key(), QKeySequence::PortableText);
+ if (keyName == "+"_L1)
+ tokens << QStringLiteral("plus");
+ else if (keyName == "-"_L1)
+ tokens << QStringLiteral("minus");
+ else
+ tokens << keyName;
+ shortcut << tokens;
+ }
+ return shortcut;
+}
+#endif
+
+const QDBusArgument &operator<<(QDBusArgument &arg, const QDBusMenuEvent &ev)
+{
+ arg.beginStructure();
+ arg << ev.m_id << ev.m_eventId << ev.m_data << ev.m_timestamp;
+ arg.endStructure();
+ return arg;
+}
+
+const QDBusArgument &operator>>(const QDBusArgument &arg, QDBusMenuEvent &ev)
+{
+ arg.beginStructure();
+ arg >> ev.m_id >> ev.m_eventId >> ev.m_data >> ev.m_timestamp;
+ arg.endStructure();
+ return arg;
+}
+
+#ifndef QT_NO_DEBUG_STREAM
+QDebug operator<<(QDebug d, const QDBusMenuItem &item)
+{
+ QDebugStateSaver saver(d);
+ d.nospace();
+ d << "QDBusMenuItem(id=" << item.m_id << ", properties=" << item.m_properties << ')';
+ return d;
+}
+
+QDebug operator<<(QDebug d, const QDBusMenuLayoutItem &item)
+{
+ QDebugStateSaver saver(d);
+ d.nospace();
+ d << "QDBusMenuLayoutItem(id=" << item.m_id << ", properties=" << item.m_properties << ", " << item.m_children.size() << " children)";
+ return d;
+}
+#endif
+
+QT_END_NAMESPACE
diff --git a/src/gui/platform/unix/dbusmenu/qdbusmenutypes_p.h b/src/gui/platform/unix/dbusmenu/qdbusmenutypes_p.h
new file mode 100644
index 0000000000..4775c0094d
--- /dev/null
+++ b/src/gui/platform/unix/dbusmenu/qdbusmenutypes_p.h
@@ -0,0 +1,120 @@
+// Copyright (C) 2020 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
+
+#ifndef QDBUSMENUTYPES_H
+#define QDBUSMENUTYPES_H
+
+//
+// W A R N I N G
+// -------------
+//
+// This file is not part of the Qt API. It exists for the convenience
+// of other Qt classes. This header file may change from version to
+// version without notice, or even be removed.
+//
+// We mean it.
+//
+
+#include <QObject>
+#include <QString>
+#include <QDBusArgument>
+#include <QDBusConnection>
+#include <QDBusObjectPath>
+#include <QPixmap>
+#include <private/qglobal_p.h>
+
+QT_BEGIN_NAMESPACE
+
+class QDBusPlatformMenu;
+class QDBusPlatformMenuItem;
+class QDBusMenuItem;
+typedef QList<QDBusMenuItem> QDBusMenuItemList;
+typedef QList<QStringList> QDBusMenuShortcut;
+
+class QDBusMenuItem
+{
+public:
+ QDBusMenuItem() { }
+ QDBusMenuItem(const QDBusPlatformMenuItem *item);
+
+ static QDBusMenuItemList items(const QList<int> &ids, const QStringList &propertyNames);
+ static QString convertMnemonic(const QString &label);
+#ifndef QT_NO_SHORTCUT
+ static QDBusMenuShortcut convertKeySequence(const QKeySequence &sequence);
+#endif
+ static void registerDBusTypes();
+
+ int m_id;
+ QVariantMap m_properties;
+};
+Q_DECLARE_TYPEINFO(QDBusMenuItem, Q_RELOCATABLE_TYPE);
+
+const QDBusArgument &operator<<(QDBusArgument &arg, const QDBusMenuItem &item);
+const QDBusArgument &operator>>(const QDBusArgument &arg, QDBusMenuItem &item);
+
+class QDBusMenuItemKeys
+{
+public:
+
+ int id;
+ QStringList properties;
+};
+Q_DECLARE_TYPEINFO(QDBusMenuItemKeys, Q_RELOCATABLE_TYPE);
+
+const QDBusArgument &operator<<(QDBusArgument &arg, const QDBusMenuItemKeys &keys);
+const QDBusArgument &operator>>(const QDBusArgument &arg, QDBusMenuItemKeys &keys);
+
+typedef QList<QDBusMenuItemKeys> QDBusMenuItemKeysList;
+
+class QDBusMenuLayoutItem
+{
+public:
+ uint populate(int id, int depth, const QStringList &propertyNames, const QDBusPlatformMenu *topLevelMenu);
+ void populate(const QDBusPlatformMenu *menu, int depth, const QStringList &propertyNames);
+ void populate(const QDBusPlatformMenuItem *item, int depth, const QStringList &propertyNames);
+
+ int m_id;
+ QVariantMap m_properties;
+ QList<QDBusMenuLayoutItem> m_children;
+};
+Q_DECLARE_TYPEINFO(QDBusMenuLayoutItem, Q_RELOCATABLE_TYPE);
+
+const QDBusArgument &operator<<(QDBusArgument &arg, const QDBusMenuLayoutItem &);
+const QDBusArgument &operator>>(const QDBusArgument &arg, QDBusMenuLayoutItem &item);
+
+typedef QList<QDBusMenuLayoutItem> QDBusMenuLayoutItemList;
+
+class QDBusMenuEvent
+{
+public:
+ int m_id;
+ QString m_eventId;
+ QDBusVariant m_data;
+ uint m_timestamp;
+};
+Q_DECLARE_TYPEINFO(QDBusMenuEvent, Q_RELOCATABLE_TYPE); // QDBusVariant is movable, even though it cannot
+ // be marked as such until Qt 6.
+
+const QDBusArgument &operator<<(QDBusArgument &arg, const QDBusMenuEvent &ev);
+const QDBusArgument &operator>>(const QDBusArgument &arg, QDBusMenuEvent &ev);
+
+typedef QList<QDBusMenuEvent> QDBusMenuEventList;
+
+#ifndef QT_NO_DEBUG_STREAM
+QDebug operator<<(QDebug d, const QDBusMenuItem &item);
+QDebug operator<<(QDebug d, const QDBusMenuLayoutItem &item);
+#endif
+
+QT_END_NAMESPACE
+
+QT_DECL_METATYPE_EXTERN(QDBusMenuItem, Q_GUI_EXPORT)
+QT_DECL_METATYPE_EXTERN(QDBusMenuItemList, Q_GUI_EXPORT)
+QT_DECL_METATYPE_EXTERN(QDBusMenuItemKeys, Q_GUI_EXPORT)
+QT_DECL_METATYPE_EXTERN(QDBusMenuItemKeysList, Q_GUI_EXPORT)
+QT_DECL_METATYPE_EXTERN(QDBusMenuLayoutItem, Q_GUI_EXPORT)
+QT_DECL_METATYPE_EXTERN(QDBusMenuLayoutItemList, Q_GUI_EXPORT)
+QT_DECL_METATYPE_EXTERN(QDBusMenuEvent, Q_GUI_EXPORT)
+QT_DECL_METATYPE_EXTERN(QDBusMenuEventList, Q_GUI_EXPORT)
+QT_DECL_METATYPE_EXTERN(QDBusMenuShortcut, Q_GUI_EXPORT)
+
+#endif
diff --git a/src/gui/platform/unix/dbusmenu/qdbusplatformmenu.cpp b/src/gui/platform/unix/dbusmenu/qdbusplatformmenu.cpp
new file mode 100644
index 0000000000..f25fb0831b
--- /dev/null
+++ b/src/gui/platform/unix/dbusmenu/qdbusplatformmenu.cpp
@@ -0,0 +1,274 @@
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
+
+#include "qdbusplatformmenu_p.h"
+
+#include <QDateTime>
+#include <QDebug>
+#include <QWindow>
+
+QT_BEGIN_NAMESPACE
+
+Q_LOGGING_CATEGORY(qLcMenu, "qt.qpa.menu")
+
+static int nextDBusID = 1;
+QHash<int, QDBusPlatformMenuItem *> menuItemsByID;
+
+QDBusPlatformMenuItem::QDBusPlatformMenuItem()
+ : m_subMenu(nullptr)
+ , m_role(NoRole)
+ , m_isEnabled(true)
+ , m_isVisible(true)
+ , m_isSeparator(false)
+ , m_isCheckable(false)
+ , m_isChecked(false)
+ , m_hasExclusiveGroup(false)
+ , m_dbusID(nextDBusID++)
+{
+ menuItemsByID.insert(m_dbusID, this);
+}
+
+QDBusPlatformMenuItem::~QDBusPlatformMenuItem()
+{
+ menuItemsByID.remove(m_dbusID);
+ if (m_subMenu)
+ static_cast<QDBusPlatformMenu *>(m_subMenu)->setContainingMenuItem(nullptr);
+}
+
+void QDBusPlatformMenuItem::setText(const QString &text)
+{
+ qCDebug(qLcMenu) << m_dbusID << text;
+ m_text = text;
+}
+
+void QDBusPlatformMenuItem::setIcon(const QIcon &icon)
+{
+ m_icon = icon;
+}
+
+/*!
+ Set a submenu under this menu item.
+*/
+void QDBusPlatformMenuItem::setMenu(QPlatformMenu *menu)
+{
+ if (m_subMenu)
+ static_cast<QDBusPlatformMenu *>(m_subMenu)->setContainingMenuItem(nullptr);
+ m_subMenu = menu;
+ if (menu)
+ static_cast<QDBusPlatformMenu *>(menu)->setContainingMenuItem(this);
+}
+
+void QDBusPlatformMenuItem::setEnabled(bool enabled)
+{
+ m_isEnabled = enabled;
+}
+
+void QDBusPlatformMenuItem::setVisible(bool isVisible)
+{
+ m_isVisible = isVisible;
+}
+
+void QDBusPlatformMenuItem::setIsSeparator(bool isSeparator)
+{
+ m_isSeparator = isSeparator;
+}
+
+void QDBusPlatformMenuItem::setRole(QPlatformMenuItem::MenuRole role)
+{
+ m_role = role;
+}
+
+void QDBusPlatformMenuItem::setCheckable(bool checkable)
+{
+ m_isCheckable = checkable;
+}
+
+void QDBusPlatformMenuItem::setChecked(bool isChecked)
+{
+ m_isChecked = isChecked;
+}
+
+void QDBusPlatformMenuItem::setHasExclusiveGroup(bool hasExclusiveGroup)
+{
+ m_hasExclusiveGroup = hasExclusiveGroup;
+}
+
+#ifndef QT_NO_SHORTCUT
+void QDBusPlatformMenuItem::setShortcut(const QKeySequence &shortcut)
+{
+ m_shortcut = shortcut;
+}
+#endif
+
+void QDBusPlatformMenuItem::trigger()
+{
+ emit activated();
+}
+
+QDBusPlatformMenuItem *QDBusPlatformMenuItem::byId(int id)
+{
+ // We need to check contains because otherwise QHash would insert
+ // a default-constructed nullptr value into menuItemsByID
+ if (menuItemsByID.contains(id))
+ return menuItemsByID[id];
+ return nullptr;
+}
+
+QList<const QDBusPlatformMenuItem *> QDBusPlatformMenuItem::byIds(const QList<int> &ids)
+{
+ QList<const QDBusPlatformMenuItem *> ret;
+ for (int id : ids) {
+ if (menuItemsByID.contains(id))
+ ret << menuItemsByID[id];
+ }
+ return ret;
+}
+
+
+QDBusPlatformMenu::QDBusPlatformMenu()
+ : m_isEnabled(true)
+ , m_isVisible(true)
+ , m_revision(1)
+ , m_containingMenuItem(nullptr)
+{
+}
+
+QDBusPlatformMenu::~QDBusPlatformMenu()
+{
+ if (m_containingMenuItem)
+ m_containingMenuItem->setMenu(nullptr);
+}
+
+void QDBusPlatformMenu::insertMenuItem(QPlatformMenuItem *menuItem, QPlatformMenuItem *before)
+{
+ QDBusPlatformMenuItem *item = static_cast<QDBusPlatformMenuItem *>(menuItem);
+ QDBusPlatformMenuItem *beforeItem = static_cast<QDBusPlatformMenuItem *>(before);
+ int idx = m_items.indexOf(beforeItem);
+ qCDebug(qLcMenu) << item->dbusID() << item->text();
+ if (idx < 0)
+ m_items.append(item);
+ else
+ m_items.insert(idx, item);
+ m_itemsByTag.insert(item->tag(), item);
+ if (item->menu())
+ syncSubMenu(static_cast<const QDBusPlatformMenu *>(item->menu()));
+ emitUpdated();
+}
+
+void QDBusPlatformMenu::removeMenuItem(QPlatformMenuItem *menuItem)
+{
+ QDBusPlatformMenuItem *item = static_cast<QDBusPlatformMenuItem *>(menuItem);
+ m_items.removeAll(item);
+ m_itemsByTag.remove(menuItem->tag());
+ if (item->menu()) {
+ // disconnect from the signals we connected to in syncSubMenu()
+ const QDBusPlatformMenu *menu = static_cast<const QDBusPlatformMenu *>(item->menu());
+ disconnect(menu, &QDBusPlatformMenu::propertiesUpdated,
+ this, &QDBusPlatformMenu::propertiesUpdated);
+ disconnect(menu, &QDBusPlatformMenu::updated,
+ this, &QDBusPlatformMenu::updated);
+ disconnect(menu, &QDBusPlatformMenu::popupRequested,
+ this, &QDBusPlatformMenu::popupRequested);
+ }
+ emitUpdated();
+}
+
+void QDBusPlatformMenu::syncSubMenu(const QDBusPlatformMenu *menu)
+{
+ // The adaptor is only connected to the propertiesUpdated signal of the top-level
+ // menu, so the submenus should transfer their signals to their parents.
+ connect(menu, &QDBusPlatformMenu::propertiesUpdated,
+ this, &QDBusPlatformMenu::propertiesUpdated, Qt::UniqueConnection);
+ connect(menu, &QDBusPlatformMenu::updated,
+ this, &QDBusPlatformMenu::updated, Qt::UniqueConnection);
+ connect(menu, &QDBusPlatformMenu::popupRequested,
+ this, &QDBusPlatformMenu::popupRequested, Qt::UniqueConnection);
+}
+
+void QDBusPlatformMenu::syncMenuItem(QPlatformMenuItem *menuItem)
+{
+ QDBusPlatformMenuItem *item = static_cast<QDBusPlatformMenuItem *>(menuItem);
+ // if a submenu was added to this item, we need to connect to its signals
+ if (item->menu())
+ syncSubMenu(static_cast<const QDBusPlatformMenu *>(item->menu()));
+ // TODO keep around copies of the QDBusMenuLayoutItems so they can be updated?
+ // or eliminate them by putting dbus streaming operators in this class instead?
+ // or somehow tell the dbusmenu client that something has changed, so it will ask for properties again
+ QDBusMenuItemList updated;
+ QDBusMenuItemKeysList removed;
+ updated << QDBusMenuItem(item);
+ qCDebug(qLcMenu) << updated;
+ emit propertiesUpdated(updated, removed);
+}
+
+void QDBusPlatformMenu::emitUpdated()
+{
+ if (m_containingMenuItem)
+ emit updated(++m_revision, m_containingMenuItem->dbusID());
+ else
+ emit updated(++m_revision, 0);
+}
+
+void QDBusPlatformMenu::setText(const QString &text)
+{
+ m_text = text;
+}
+
+void QDBusPlatformMenu::setIcon(const QIcon &icon)
+{
+ m_icon = icon;
+}
+
+void QDBusPlatformMenu::setEnabled(bool enabled)
+{
+ m_isEnabled = enabled;
+}
+
+void QDBusPlatformMenu::setVisible(bool isVisible)
+{
+ m_isVisible = isVisible;
+}
+
+void QDBusPlatformMenu::setContainingMenuItem(QDBusPlatformMenuItem *item)
+{
+ m_containingMenuItem = item;
+}
+
+void QDBusPlatformMenu::showPopup(const QWindow *parentWindow, const QRect &targetRect, const QPlatformMenuItem *item)
+{
+ Q_UNUSED(parentWindow);
+ Q_UNUSED(targetRect);
+ Q_UNUSED(item);
+ setVisible(true);
+ emit popupRequested(m_containingMenuItem->dbusID(), QDateTime::currentMSecsSinceEpoch());
+}
+
+QPlatformMenuItem *QDBusPlatformMenu::menuItemAt(int position) const
+{
+ return m_items.value(position);
+}
+
+QPlatformMenuItem *QDBusPlatformMenu::menuItemForTag(quintptr tag) const
+{
+ return m_itemsByTag[tag];
+}
+
+const QList<QDBusPlatformMenuItem *> QDBusPlatformMenu::items() const
+{
+ return m_items;
+}
+
+QPlatformMenuItem *QDBusPlatformMenu::createMenuItem() const
+{
+ QDBusPlatformMenuItem *ret = new QDBusPlatformMenuItem();
+ return ret;
+}
+
+QPlatformMenu *QDBusPlatformMenu::createSubMenu() const
+{
+ return new QDBusPlatformMenu;
+}
+
+QT_END_NAMESPACE
+
+#include "moc_qdbusplatformmenu_p.cpp"
diff --git a/src/gui/platform/unix/dbusmenu/qdbusplatformmenu_p.h b/src/gui/platform/unix/dbusmenu/qdbusplatformmenu_p.h
new file mode 100644
index 0000000000..cb672fee48
--- /dev/null
+++ b/src/gui/platform/unix/dbusmenu/qdbusplatformmenu_p.h
@@ -0,0 +1,155 @@
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
+
+#ifndef QDBUSPLATFORMMENU_H
+#define QDBUSPLATFORMMENU_H
+
+//
+// W A R N I N G
+// -------------
+//
+// This file is not part of the Qt API. It exists purely as an
+// implementation detail. This header file may change from version to
+// version without notice, or even be removed.
+//
+// We mean it.
+//
+//
+// W A R N I N G
+// -------------
+//
+// This file is part of the DBus menu support and is not meant to be used
+// in applications. Usage of this API may make your code
+// source and binary incompatible with future versions of Qt.
+//
+
+#include <qpa/qplatformmenu.h>
+#include <QLoggingCategory>
+#include "qdbusmenutypes_p.h"
+
+QT_BEGIN_NAMESPACE
+Q_DECLARE_LOGGING_CATEGORY(qLcMenu)
+
+class QDBusPlatformMenu;
+
+class QDBusPlatformMenuItem : public QPlatformMenuItem
+{
+ Q_OBJECT
+
+public:
+ QDBusPlatformMenuItem();
+ ~QDBusPlatformMenuItem();
+
+ const QString text() const { return m_text; }
+ void setText(const QString &text) override;
+ QIcon icon() const { return m_icon; }
+ void setIcon(const QIcon &icon) override;
+ const QPlatformMenu *menu() const { return m_subMenu; }
+ void setMenu(QPlatformMenu *menu) override;
+ bool isEnabled() const { return m_isEnabled; }
+ void setEnabled(bool enabled) override;
+ bool isVisible() const { return m_isVisible; }
+ void setVisible(bool isVisible) override;
+ bool isSeparator() const { return m_isSeparator; }
+ void setIsSeparator(bool isSeparator) override;
+ void setFont(const QFont &font) override { Q_UNUSED(font); }
+ void setRole(MenuRole role) override;
+ bool isCheckable() const { return m_isCheckable; }
+ void setCheckable(bool checkable) override;
+ bool isChecked() const { return m_isChecked; }
+ void setChecked(bool isChecked) override;
+ bool hasExclusiveGroup() const { return m_hasExclusiveGroup; }
+ void setHasExclusiveGroup(bool hasExclusiveGroup) override;
+#if QT_CONFIG(shortcut)
+ QKeySequence shortcut() const { return m_shortcut; }
+ void setShortcut(const QKeySequence& shortcut) override;
+#endif
+ void setIconSize(int size) override { Q_UNUSED(size); }
+ void setNativeContents(WId item) override { Q_UNUSED(item); }
+
+ int dbusID() const { return m_dbusID; }
+
+ void trigger();
+
+ static QDBusPlatformMenuItem *byId(int id);
+ static QList<const QDBusPlatformMenuItem *> byIds(const QList<int> &ids);
+
+private:
+ QString m_text;
+ QIcon m_icon;
+ QPlatformMenu *m_subMenu;
+ MenuRole m_role : 4;
+ bool m_isEnabled : 1;
+ bool m_isVisible : 1;
+ bool m_isSeparator : 1;
+ bool m_isCheckable : 1;
+ bool m_isChecked : 1;
+ bool m_hasExclusiveGroup : 1;
+ short /*unused*/ : 6;
+ short m_dbusID : 16;
+#if QT_CONFIG(shortcut)
+ QKeySequence m_shortcut;
+#endif
+};
+
+class QDBusPlatformMenu : public QPlatformMenu
+{
+ Q_OBJECT
+
+public:
+ QDBusPlatformMenu();
+ ~QDBusPlatformMenu();
+ void insertMenuItem(QPlatformMenuItem *menuItem, QPlatformMenuItem *before) override;
+ void removeMenuItem(QPlatformMenuItem *menuItem) override;
+ void syncSubMenu(const QDBusPlatformMenu *menu);
+ void syncMenuItem(QPlatformMenuItem *menuItem) override;
+ void syncSeparatorsCollapsible(bool enable) override { Q_UNUSED(enable); }
+
+ const QString text() const { return m_text; }
+ void setText(const QString &text) override;
+ QIcon icon() const { return m_icon; }
+ void setIcon(const QIcon &icon) override;
+ bool isEnabled() const override { return m_isEnabled; }
+ void setEnabled(bool enabled) override;
+ bool isVisible() const { return m_isVisible; }
+ void setVisible(bool visible) override;
+ void setMinimumWidth(int width) override { Q_UNUSED(width); }
+ void setFont(const QFont &font) override { Q_UNUSED(font); }
+ void setMenuType(MenuType type) override { Q_UNUSED(type); }
+ void setContainingMenuItem(QDBusPlatformMenuItem *item);
+
+ void showPopup(const QWindow *parentWindow, const QRect &targetRect, const QPlatformMenuItem *item) override;
+
+ void dismiss() override { } // Closes this and all its related menu popups
+
+ QPlatformMenuItem *menuItemAt(int position) const override;
+ QPlatformMenuItem *menuItemForTag(quintptr tag) const override;
+ const QList<QDBusPlatformMenuItem *> items() const;
+
+ QPlatformMenuItem *createMenuItem() const override;
+ QPlatformMenu *createSubMenu() const override;
+
+ uint revision() const { return m_revision; }
+
+ void emitUpdated();
+
+signals:
+ void updated(uint revision, int dbusId);
+ void propertiesUpdated(QDBusMenuItemList updatedProps, QDBusMenuItemKeysList removedProps);
+ void popupRequested(int id, uint timestamp);
+
+private:
+ QString m_text;
+ QIcon m_icon;
+ bool m_isEnabled;
+ bool m_isVisible;
+ uint m_revision;
+ QHash<quintptr, QDBusPlatformMenuItem *> m_itemsByTag;
+ QList<QDBusPlatformMenuItem *> m_items;
+ QDBusPlatformMenuItem *m_containingMenuItem;
+};
+
+QT_END_NAMESPACE
+
+#endif
+
diff --git a/src/gui/platform/unix/dbustray/qdbustrayicon.cpp b/src/gui/platform/unix/dbustray/qdbustrayicon.cpp
new file mode 100644
index 0000000000..0dff9b598e
--- /dev/null
+++ b/src/gui/platform/unix/dbustray/qdbustrayicon.cpp
@@ -0,0 +1,347 @@
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
+
+#include "qdbustrayicon_p.h"
+
+#ifndef QT_NO_SYSTEMTRAYICON
+
+#include <QString>
+#include <QDebug>
+#include <QRect>
+#include <QLoggingCategory>
+#include <QStandardPaths>
+#include <QFileInfo>
+#include <QDir>
+#include <QMetaObject>
+#include <QMetaEnum>
+#include <QDBusConnectionInterface>
+#include <QDBusArgument>
+#include <QDBusMetaType>
+#include <QDBusServiceWatcher>
+
+#include <qpa/qplatformmenu.h>
+#include <qpa/qplatformintegration.h>
+#include <qpa/qplatformservices.h>
+
+#include <private/qdbusmenuconnection_p.h>
+#include <private/qstatusnotifieritemadaptor_p.h>
+#include <private/qdbusmenuadaptor_p.h>
+#include <private/qdbusplatformmenu_p.h>
+#include <private/qxdgnotificationproxy_p.h>
+#include <private/qlockfile_p.h>
+#include <private/qguiapplication_p.h>
+
+// Defined in Windows headers which get included by qlockfile_p.h
+#undef interface
+
+QT_BEGIN_NAMESPACE
+
+using namespace Qt::StringLiterals;
+
+Q_LOGGING_CATEGORY(qLcTray, "qt.qpa.tray")
+
+static QString iconTempPath()
+{
+ QString tempPath = QStandardPaths::writableLocation(QStandardPaths::RuntimeLocation);
+ if (!tempPath.isEmpty()) {
+ QString flatpakId = qEnvironmentVariable("FLATPAK_ID");
+ if (!flatpakId.isEmpty() && QFileInfo::exists("/.flatpak-info"_L1))
+ tempPath += "/app/"_L1 + flatpakId;
+ return tempPath;
+ }
+
+ tempPath = QStandardPaths::writableLocation(QStandardPaths::GenericCacheLocation);
+
+ if (!tempPath.isEmpty()) {
+ QDir tempDir(tempPath);
+ if (tempDir.exists())
+ return tempPath;
+
+ if (tempDir.mkpath(QStringLiteral("."))) {
+ const QFile::Permissions permissions = QFile::ReadOwner | QFile::WriteOwner | QFile::ExeOwner;
+ if (QFile(tempPath).setPermissions(permissions))
+ return tempPath;
+ }
+ }
+
+ return QDir::tempPath();
+}
+
+static const QString KDEItemFormat = QStringLiteral("org.kde.StatusNotifierItem-%1-%2");
+static const QString KDEWatcherService = QStringLiteral("org.kde.StatusNotifierWatcher");
+static const QString XdgNotificationService = QStringLiteral("org.freedesktop.Notifications");
+static const QString XdgNotificationPath = QStringLiteral("/org/freedesktop/Notifications");
+static const QString DefaultAction = QStringLiteral("default");
+static int instanceCount = 0;
+
+static inline QString tempFileTemplate()
+{
+ static const QString TempFileTemplate = iconTempPath() + "/qt-trayicon-XXXXXX.png"_L1;
+ return TempFileTemplate;
+}
+
+/*!
+ \class QDBusTrayIcon
+ \internal
+*/
+
+QDBusTrayIcon::QDBusTrayIcon()
+ : m_dbusConnection(nullptr)
+ , m_adaptor(new QStatusNotifierItemAdaptor(this))
+ , m_menuAdaptor(nullptr)
+ , m_menu(nullptr)
+ , m_notifier(nullptr)
+ , m_instanceId(KDEItemFormat.arg(QCoreApplication::applicationPid()).arg(++instanceCount))
+ , m_category(QStringLiteral("ApplicationStatus"))
+ , m_defaultStatus(QStringLiteral("Active")) // be visible all the time. QSystemTrayIcon has no API to control this.
+ , m_status(m_defaultStatus)
+ , m_tempIcon(nullptr)
+ , m_tempAttentionIcon(nullptr)
+ , m_registered(false)
+{
+ qCDebug(qLcTray);
+ if (instanceCount == 1) {
+ QDBusMenuItem::registerDBusTypes();
+ qDBusRegisterMetaType<QXdgDBusImageStruct>();
+ qDBusRegisterMetaType<QXdgDBusImageVector>();
+ qDBusRegisterMetaType<QXdgDBusToolTipStruct>();
+ }
+ connect(this, SIGNAL(statusChanged(QString)), m_adaptor, SIGNAL(NewStatus(QString)));
+ connect(this, SIGNAL(tooltipChanged()), m_adaptor, SIGNAL(NewToolTip()));
+ connect(this, SIGNAL(iconChanged()), m_adaptor, SIGNAL(NewIcon()));
+ connect(this, SIGNAL(attention()), m_adaptor, SIGNAL(NewAttentionIcon()));
+ connect(this, SIGNAL(menuChanged()), m_adaptor, SIGNAL(NewMenu()));
+ connect(this, SIGNAL(attention()), m_adaptor, SIGNAL(NewTitle()));
+ connect(&m_attentionTimer, SIGNAL(timeout()), this, SLOT(attentionTimerExpired()));
+ m_attentionTimer.setSingleShot(true);
+}
+
+QDBusTrayIcon::~QDBusTrayIcon()
+{
+}
+
+void QDBusTrayIcon::init()
+{
+ qCDebug(qLcTray) << "registering" << m_instanceId;
+ m_registered = dBusConnection()->registerTrayIcon(this);
+ QObject::connect(dBusConnection()->dbusWatcher(), &QDBusServiceWatcher::serviceRegistered,
+ this, &QDBusTrayIcon::watcherServiceRegistered);
+}
+
+void QDBusTrayIcon::cleanup()
+{
+ qCDebug(qLcTray) << "unregistering" << m_instanceId;
+ if (m_registered)
+ dBusConnection()->unregisterTrayIcon(this);
+ delete m_dbusConnection;
+ m_dbusConnection = nullptr;
+ delete m_notifier;
+ m_notifier = nullptr;
+ m_registered = false;
+}
+
+void QDBusTrayIcon::watcherServiceRegistered(const QString &serviceName)
+{
+ Q_UNUSED(serviceName);
+ // We have the icon registered, but the watcher has restarted or
+ // changed, so we need to tell it about our icon again
+ if (m_registered)
+ dBusConnection()->registerTrayIconWithWatcher(this);
+}
+
+void QDBusTrayIcon::attentionTimerExpired()
+{
+ m_messageTitle = QString();
+ m_message = QString();
+ m_attentionIcon = QIcon();
+ emit attention();
+ emit tooltipChanged();
+ setStatus(m_defaultStatus);
+}
+
+void QDBusTrayIcon::setStatus(const QString &status)
+{
+ qCDebug(qLcTray) << status;
+ if (m_status == status)
+ return;
+ m_status = status;
+ emit statusChanged(m_status);
+}
+
+QTemporaryFile *QDBusTrayIcon::tempIcon(const QIcon &icon)
+{
+ // Hack for indicator-application, which doesn't handle icons sent across D-Bus:
+ // save the icon to a temp file and set the icon name to that filename.
+ static bool necessity_checked = false;
+ static bool necessary = false;
+ if (!necessity_checked) {
+ QDBusConnection session = QDBusConnection::sessionBus();
+ uint pid = session.interface()->servicePid(KDEWatcherService).value();
+ QString processName = QLockFilePrivate::processNameByPid(pid);
+ necessary = processName.endsWith("indicator-application-service"_L1);
+ if (!necessary) {
+ necessary = session.interface()->isServiceRegistered(
+ QStringLiteral("com.canonical.indicator.application"));
+ }
+ if (!necessary) {
+ necessary = session.interface()->isServiceRegistered(
+ QStringLiteral("org.ayatana.indicator.application"));
+ }
+ if (!necessary && QGuiApplication::desktopSettingsAware()) {
+ // Accessing to process name might be not allowed if the application
+ // is confined, thus we can just rely on the current desktop in use
+ const QPlatformServices *services = QGuiApplicationPrivate::platformIntegration()->services();
+ necessary = services->desktopEnvironment().split(':').contains("UNITY");
+ }
+ necessity_checked = true;
+ }
+ if (!necessary)
+ return nullptr;
+ QTemporaryFile *ret = new QTemporaryFile(tempFileTemplate(), this);
+ if (!ret->open()) {
+ delete ret;
+ return nullptr;
+ }
+ icon.pixmap(QSize(22, 22)).save(ret);
+ ret->close();
+ return ret;
+}
+
+QDBusMenuConnection * QDBusTrayIcon::dBusConnection()
+{
+ if (!m_dbusConnection) {
+ m_dbusConnection = new QDBusMenuConnection(this, m_instanceId);
+ m_notifier = new QXdgNotificationInterface(XdgNotificationService,
+ XdgNotificationPath, m_dbusConnection->connection(), this);
+ connect(m_notifier, SIGNAL(NotificationClosed(uint,uint)), this, SLOT(notificationClosed(uint,uint)));
+ connect(m_notifier, SIGNAL(ActionInvoked(uint,QString)), this, SLOT(actionInvoked(uint,QString)));
+ }
+ return m_dbusConnection;
+}
+
+void QDBusTrayIcon::updateIcon(const QIcon &icon)
+{
+ m_iconName = icon.name();
+ m_icon = icon;
+ if (m_iconName.isEmpty()) {
+ if (m_tempIcon)
+ delete m_tempIcon;
+ m_tempIcon = tempIcon(icon);
+ if (m_tempIcon)
+ m_iconName = m_tempIcon->fileName();
+ }
+ qCDebug(qLcTray) << m_iconName << icon.availableSizes();
+ emit iconChanged();
+}
+
+void QDBusTrayIcon::updateToolTip(const QString &tooltip)
+{
+ qCDebug(qLcTray) << tooltip;
+ m_tooltip = tooltip;
+ emit tooltipChanged();
+}
+
+QPlatformMenu *QDBusTrayIcon::createMenu() const
+{
+ return new QDBusPlatformMenu();
+}
+
+void QDBusTrayIcon::updateMenu(QPlatformMenu * menu)
+{
+ qCDebug(qLcTray) << menu;
+ QDBusPlatformMenu *newMenu = qobject_cast<QDBusPlatformMenu *>(menu);
+ if (m_menu != newMenu) {
+ if (m_menu) {
+ dBusConnection()->unregisterTrayIconMenu(this);
+ delete m_menuAdaptor;
+ }
+ m_menu = newMenu;
+ m_menuAdaptor = new QDBusMenuAdaptor(m_menu);
+ // TODO connect(m_menu, , m_menuAdaptor, SIGNAL(ItemActivationRequested(int,uint)));
+ connect(m_menu, SIGNAL(propertiesUpdated(QDBusMenuItemList,QDBusMenuItemKeysList)),
+ m_menuAdaptor, SIGNAL(ItemsPropertiesUpdated(QDBusMenuItemList,QDBusMenuItemKeysList)));
+ connect(m_menu, SIGNAL(updated(uint,int)),
+ m_menuAdaptor, SIGNAL(LayoutUpdated(uint,int)));
+ dBusConnection()->registerTrayIconMenu(this);
+ emit menuChanged();
+ }
+}
+
+void QDBusTrayIcon::showMessage(const QString &title, const QString &msg, const QIcon &icon,
+ QPlatformSystemTrayIcon::MessageIcon iconType, int msecs)
+{
+ m_messageTitle = title;
+ m_message = msg;
+ m_attentionIcon = icon;
+ QStringList notificationActions;
+ switch (iconType) {
+ case Information:
+ m_attentionIconName = QStringLiteral("dialog-information");
+ break;
+ case Warning:
+ m_attentionIconName = QStringLiteral("dialog-warning");
+ break;
+ case Critical:
+ m_attentionIconName = QStringLiteral("dialog-error");
+ // If there are actions, the desktop notification may appear as a message dialog
+ // with button(s), which will interrupt the user and require a response.
+ // That is an optional feature in implementations of org.freedesktop.Notifications
+ notificationActions << DefaultAction << tr("OK");
+ break;
+ default:
+ m_attentionIconName.clear();
+ break;
+ }
+ if (m_attentionIconName.isEmpty()) {
+ if (m_tempAttentionIcon)
+ delete m_tempAttentionIcon;
+ m_tempAttentionIcon = tempIcon(icon);
+ if (m_tempAttentionIcon)
+ m_attentionIconName = m_tempAttentionIcon->fileName();
+ }
+ qCDebug(qLcTray) << title << msg <<
+ QPlatformSystemTrayIcon::metaObject()->enumerator(
+ QPlatformSystemTrayIcon::staticMetaObject.indexOfEnumerator("MessageIcon")).valueToKey(iconType)
+ << m_attentionIconName << msecs;
+ setStatus(QStringLiteral("NeedsAttention"));
+ m_attentionTimer.start(msecs);
+ emit tooltipChanged();
+ emit attention();
+
+ // Desktop notification
+ QVariantMap hints;
+ // urgency levels according to https://developer.gnome.org/notification-spec/#urgency-levels
+ // 0 low, 1 normal, 2 critical
+ int urgency = static_cast<int>(iconType) - 1;
+ if (urgency < 0) // no icon
+ urgency = 0;
+ hints.insert("urgency"_L1, QVariant(urgency));
+ m_notifier->notify(QCoreApplication::applicationName(), 0,
+ m_attentionIconName, title, msg, notificationActions, hints, msecs);
+}
+
+void QDBusTrayIcon::actionInvoked(uint id, const QString &action)
+{
+ qCDebug(qLcTray) << id << action;
+ emit messageClicked();
+}
+
+void QDBusTrayIcon::notificationClosed(uint id, uint reason)
+{
+ qCDebug(qLcTray) << id << reason;
+}
+
+bool QDBusTrayIcon::isSystemTrayAvailable() const
+{
+ QDBusMenuConnection * conn = const_cast<QDBusTrayIcon *>(this)->dBusConnection();
+
+ // If the KDE watcher service is registered, we must be on a desktop
+ // where a StatusNotifier-conforming system tray exists.
+ qCDebug(qLcTray) << conn->isWatcherRegistered();
+ return conn->isWatcherRegistered();
+}
+
+QT_END_NAMESPACE
+
+#include "moc_qdbustrayicon_p.cpp"
+#endif //QT_NO_SYSTEMTRAYICON
diff --git a/src/gui/platform/unix/dbustray/qdbustrayicon_p.h b/src/gui/platform/unix/dbustray/qdbustrayicon_p.h
new file mode 100644
index 0000000000..3041e132fd
--- /dev/null
+++ b/src/gui/platform/unix/dbustray/qdbustrayicon_p.h
@@ -0,0 +1,132 @@
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
+
+
+#ifndef QDBUSTRAYICON_H
+#define QDBUSTRAYICON_H
+
+//
+// W A R N I N G
+// -------------
+//
+// This file is not part of the Qt API. It exists purely as an
+// implementation detail. This header file may change from version to
+// version without notice, or even be removed.
+//
+// We mean it.
+//
+
+#include <QtGui/private/qtguiglobal_p.h>
+
+QT_REQUIRE_CONFIG(systemtrayicon);
+
+#include <QIcon>
+#include <QTemporaryFile>
+#include <QTimer>
+#include "QtGui/qpa/qplatformsystemtrayicon.h"
+#include "private/qdbusmenuconnection_p.h"
+
+QT_BEGIN_NAMESPACE
+
+class QStatusNotifierItemAdaptor;
+class QDBusMenuAdaptor;
+class QDBusPlatformMenu;
+class QXdgNotificationInterface;
+
+class QDBusTrayIcon: public QPlatformSystemTrayIcon
+{
+ Q_OBJECT
+ Q_PROPERTY(QString category READ category NOTIFY categoryChanged)
+ Q_PROPERTY(QString status READ status NOTIFY statusChanged)
+ Q_PROPERTY(QString tooltip READ tooltip NOTIFY tooltipChanged)
+ Q_PROPERTY(QString iconName READ iconName NOTIFY iconChanged)
+ Q_PROPERTY(QIcon icon READ icon NOTIFY iconChanged)
+ Q_PROPERTY(bool isRequestingAttention READ isRequestingAttention NOTIFY attention)
+ Q_PROPERTY(QString attentionTitle READ attentionTitle NOTIFY attention)
+ Q_PROPERTY(QString attentionMessage READ attentionMessage NOTIFY attention)
+ Q_PROPERTY(QString attentionIconName READ attentionIconName NOTIFY attention)
+ Q_PROPERTY(QIcon attentionIcon READ attentionIcon NOTIFY attention)
+ Q_PROPERTY(QDBusPlatformMenu *menu READ menu NOTIFY menuChanged)
+ Q_MOC_INCLUDE(<private/qdbusplatformmenu_p.h>)
+
+public:
+ QDBusTrayIcon();
+
+ virtual ~QDBusTrayIcon();
+
+ QDBusMenuConnection * dBusConnection();
+
+ void init() override;
+ void cleanup() override;
+ void updateIcon(const QIcon &icon) override;
+ void updateToolTip(const QString &tooltip) override;
+ void updateMenu(QPlatformMenu *menu) override;
+ QPlatformMenu *createMenu() const override;
+ void showMessage(const QString &title, const QString &msg,
+ const QIcon &icon, MessageIcon iconType, int msecs) override;
+
+ bool isSystemTrayAvailable() const override;
+ bool supportsMessages() const override { return true; }
+ QRect geometry() const override { return QRect(); }
+
+ QString category() const { return m_category; }
+ QString status() const { return m_status; }
+ QString tooltip() const { return m_tooltip; }
+
+ QString iconName() const { return m_iconName; }
+ const QIcon & icon() const { return m_icon; }
+
+ bool isRequestingAttention() const { return m_attentionTimer.isActive(); }
+ QString attentionTitle() const { return m_messageTitle; }
+ QString attentionMessage() const { return m_message; }
+ QString attentionIconName() const { return m_attentionIconName; }
+ const QIcon & attentionIcon() const { return m_attentionIcon; }
+
+ QString instanceId() const { return m_instanceId; }
+
+ QDBusPlatformMenu *menu() { return m_menu; }
+
+signals:
+ void categoryChanged();
+ void statusChanged(QString arg);
+ void tooltipChanged();
+ void iconChanged();
+ void attention();
+ void menuChanged();
+
+private Q_SLOTS:
+ void attentionTimerExpired();
+ void actionInvoked(uint id, const QString &action);
+ void notificationClosed(uint id, uint reason);
+ void watcherServiceRegistered(const QString &serviceName);
+
+private:
+ void setStatus(const QString &status);
+ QTemporaryFile *tempIcon(const QIcon &icon);
+
+private:
+ QDBusMenuConnection* m_dbusConnection;
+ QStatusNotifierItemAdaptor *m_adaptor;
+ QDBusMenuAdaptor *m_menuAdaptor;
+ QDBusPlatformMenu *m_menu;
+ QXdgNotificationInterface *m_notifier;
+ QString m_instanceId;
+ QString m_category;
+ QString m_defaultStatus;
+ QString m_status;
+ QString m_tooltip;
+ QString m_messageTitle;
+ QString m_message;
+ QIcon m_icon;
+ QTemporaryFile *m_tempIcon;
+ QString m_iconName;
+ QIcon m_attentionIcon;
+ QTemporaryFile *m_tempAttentionIcon;
+ QString m_attentionIconName;
+ QTimer m_attentionTimer;
+ bool m_registered;
+};
+
+QT_END_NAMESPACE
+
+#endif // QDBUSTRAYICON_H
diff --git a/src/gui/platform/unix/dbustray/qdbustraytypes.cpp b/src/gui/platform/unix/dbustray/qdbustraytypes.cpp
new file mode 100644
index 0000000000..accbd87e7e
--- /dev/null
+++ b/src/gui/platform/unix/dbustray/qdbustraytypes.cpp
@@ -0,0 +1,181 @@
+// Copyright (C) 2009 Marco Martin <notmart@gmail.com>
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
+
+#ifndef QT_NO_SYSTEMTRAYICON
+
+#include "qdbustraytypes_p.h"
+
+#include <QDBusConnection>
+#include <QDBusMetaType>
+#include <QImage>
+#include <QIcon>
+#include <QIconEngine>
+#include <QImage>
+#include <QPixmap>
+#include <QDebug>
+#include <QtEndian>
+#include <QPainter>
+#include <QGuiApplication>
+#include <qpa/qplatformmenu.h>
+#include <private/qdbusplatformmenu_p.h>
+#include <private/qicon_p.h>
+
+QT_BEGIN_NAMESPACE
+
+QT_IMPL_METATYPE_EXTERN(QXdgDBusImageStruct)
+QT_IMPL_METATYPE_EXTERN(QXdgDBusImageVector)
+QT_IMPL_METATYPE_EXTERN(QXdgDBusToolTipStruct)
+
+static const int IconSizeLimit = 64;
+static const int IconNormalSmallSize = 22;
+static const int IconNormalMediumSize = 64;
+
+QXdgDBusImageVector iconToQXdgDBusImageVector(const QIcon &icon)
+{
+ QXdgDBusImageVector ret;
+ if (icon.isNull())
+ return ret;
+ QIconEngine *engine = const_cast<QIcon &>(icon).data_ptr()->engine;
+ QList<QSize> sizes = engine->availableSizes(QIcon::Normal, QIcon::Off);
+
+ // Omit any size larger than 64 px, to save D-Bus bandwidth;
+ // ensure that 22px or smaller exists, because it's a common size;
+ // and ensure that something between 22px and 64px exists, for better scaling to other sizes.
+ bool hasSmallIcon = false;
+ bool hasMediumIcon = false;
+ QList<QSize> toRemove;
+ for (const QSize &size : std::as_const(sizes)) {
+ int maxSize = qMax(size.width(), size.height());
+ if (maxSize <= IconNormalSmallSize)
+ hasSmallIcon = true;
+ else if (maxSize <= IconNormalMediumSize)
+ hasMediumIcon = true;
+ else if (maxSize > IconSizeLimit)
+ toRemove << size;
+ }
+ for (const QSize &size : std::as_const(toRemove))
+ sizes.removeOne(size);
+ if (!hasSmallIcon)
+ sizes.append(QSize(IconNormalSmallSize, IconNormalSmallSize));
+ if (!hasMediumIcon)
+ sizes.append(QSize(IconNormalMediumSize, IconNormalMediumSize));
+
+ ret.reserve(sizes.size());
+ for (const QSize &size : std::as_const(sizes)) {
+ // Protocol specifies ARGB32 format in network byte order
+ QImage im = engine->pixmap(size, QIcon::Normal, QIcon::Off).toImage().convertToFormat(QImage::Format_ARGB32);
+ // letterbox if necessary to make it square
+ if (im.height() != im.width()) {
+ int maxSize = qMax(im.width(), im.height());
+ QImage padded(maxSize, maxSize, QImage::Format_ARGB32);
+ padded.fill(Qt::transparent);
+ QPainter painter(&padded);
+ painter.drawImage((maxSize - im.width()) / 2, (maxSize - im.height()) / 2, im);
+ im = padded;
+ }
+ // copy and endian-convert
+ QXdgDBusImageStruct kim(im.width(), im.height());
+ qToBigEndian<quint32>(im.constBits(), im.width() * im.height(), kim.data.data());
+
+ ret << kim;
+ }
+ return ret;
+}
+
+// Marshall the ImageStruct data into a D-Bus argument
+const QDBusArgument &operator<<(QDBusArgument &argument, const QXdgDBusImageStruct &icon)
+{
+ argument.beginStructure();
+ argument << icon.width;
+ argument << icon.height;
+ argument << icon.data;
+ argument.endStructure();
+ return argument;
+}
+
+// Retrieve the ImageStruct data from the D-Bus argument
+const QDBusArgument &operator>>(const QDBusArgument &argument, QXdgDBusImageStruct &icon)
+{
+ qint32 width;
+ qint32 height;
+ QByteArray data;
+
+ argument.beginStructure();
+ argument >> width;
+ argument >> height;
+ argument >> data;
+ argument.endStructure();
+
+ icon.width = width;
+ icon.height = height;
+ icon.data = data;
+
+ return argument;
+}
+
+// Marshall the ImageVector data into a D-Bus argument
+const QDBusArgument &operator<<(QDBusArgument &argument, const QXdgDBusImageVector &iconVector)
+{
+ argument.beginArray(qMetaTypeId<QXdgDBusImageStruct>());
+ for (int i = 0; i < iconVector.size(); ++i) {
+ argument << iconVector[i];
+ }
+ argument.endArray();
+ return argument;
+}
+
+// Retrieve the ImageVector data from the D-Bus argument
+const QDBusArgument &operator>>(const QDBusArgument &argument, QXdgDBusImageVector &iconVector)
+{
+ argument.beginArray();
+ iconVector.clear();
+
+ while (!argument.atEnd()) {
+ QXdgDBusImageStruct element;
+ argument >> element;
+ iconVector.append(element);
+ }
+
+ argument.endArray();
+
+ return argument;
+}
+
+// Marshall the ToolTipStruct data into a D-Bus argument
+const QDBusArgument &operator<<(QDBusArgument &argument, const QXdgDBusToolTipStruct &toolTip)
+{
+ argument.beginStructure();
+ argument << toolTip.icon;
+ argument << toolTip.image;
+ argument << toolTip.title;
+ argument << toolTip.subTitle;
+ argument.endStructure();
+ return argument;
+}
+
+// Retrieve the ToolTipStruct data from the D-Bus argument
+const QDBusArgument &operator>>(const QDBusArgument &argument, QXdgDBusToolTipStruct &toolTip)
+{
+ QString icon;
+ QXdgDBusImageVector image;
+ QString title;
+ QString subTitle;
+
+ argument.beginStructure();
+ argument >> icon;
+ argument >> image;
+ argument >> title;
+ argument >> subTitle;
+ argument.endStructure();
+
+ toolTip.icon = icon;
+ toolTip.image = image;
+ toolTip.title = title;
+ toolTip.subTitle = subTitle;
+
+ return argument;
+}
+
+QT_END_NAMESPACE
+#endif // QT_NO_SYSTEMTRAYICON
diff --git a/src/gui/platform/unix/dbustray/qdbustraytypes_p.h b/src/gui/platform/unix/dbustray/qdbustraytypes_p.h
new file mode 100644
index 0000000000..08294d486c
--- /dev/null
+++ b/src/gui/platform/unix/dbustray/qdbustraytypes_p.h
@@ -0,0 +1,73 @@
+// Copyright (C) 2009 Marco Martin <notmart@gmail.com>
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
+
+#ifndef QDBUSTRAYTYPES_P_H
+#define QDBUSTRAYTYPES_P_H
+
+//
+// W A R N I N G
+// -------------
+//
+// This file is not part of the Qt API. It exists for the convenience
+// of other Qt classes. This header file may change from version to
+// version without notice, or even be removed.
+//
+// We mean it.
+//
+
+#include <QtGui/private/qtguiglobal_p.h>
+
+QT_REQUIRE_CONFIG(systemtrayicon);
+
+#include <QObject>
+#include <QString>
+#include <QDBusArgument>
+#include <QDBusConnection>
+#include <QDBusObjectPath>
+#include <QPixmap>
+
+QT_BEGIN_NAMESPACE
+
+// Custom message type to send icons across D-Bus
+struct QXdgDBusImageStruct
+{
+ QXdgDBusImageStruct() { }
+ QXdgDBusImageStruct(int w, int h)
+ : width(w), height(h), data(width * height * 4, 0) { }
+ int width;
+ int height;
+ QByteArray data;
+};
+Q_DECLARE_TYPEINFO(QXdgDBusImageStruct, Q_RELOCATABLE_TYPE);
+
+using QXdgDBusImageVector = QList<QXdgDBusImageStruct>;
+
+QXdgDBusImageVector iconToQXdgDBusImageVector(const QIcon &icon);
+
+// Custom message type to send tooltips across D-Bus
+struct QXdgDBusToolTipStruct
+{
+ QString icon;
+ QXdgDBusImageVector image;
+ QString title;
+ QString subTitle;
+};
+Q_DECLARE_TYPEINFO(QXdgDBusToolTipStruct, Q_RELOCATABLE_TYPE);
+
+const QDBusArgument &operator<<(QDBusArgument &argument, const QXdgDBusImageStruct &icon);
+const QDBusArgument &operator>>(const QDBusArgument &argument, QXdgDBusImageStruct &icon);
+
+const QDBusArgument &operator<<(QDBusArgument &argument, const QXdgDBusImageVector &iconVector);
+const QDBusArgument &operator>>(const QDBusArgument &argument, QXdgDBusImageVector &iconVector);
+
+const QDBusArgument &operator<<(QDBusArgument &argument, const QXdgDBusToolTipStruct &toolTip);
+const QDBusArgument &operator>>(const QDBusArgument &argument, QXdgDBusToolTipStruct &toolTip);
+
+QT_END_NAMESPACE
+
+QT_DECL_METATYPE_EXTERN(QXdgDBusImageStruct, Q_GUI_EXPORT)
+QT_DECL_METATYPE_EXTERN(QXdgDBusImageVector, Q_GUI_EXPORT)
+QT_DECL_METATYPE_EXTERN(QXdgDBusToolTipStruct, Q_GUI_EXPORT)
+
+#endif // QDBUSTRAYTYPES_P_H
diff --git a/src/gui/platform/unix/dbustray/qstatusnotifieritemadaptor.cpp b/src/gui/platform/unix/dbustray/qstatusnotifieritemadaptor.cpp
new file mode 100644
index 0000000000..2f6c13b6cf
--- /dev/null
+++ b/src/gui/platform/unix/dbustray/qstatusnotifieritemadaptor.cpp
@@ -0,0 +1,161 @@
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
+
+/*
+ This file was originally created by qdbusxml2cpp version 0.8
+ Command line was:
+ qdbusxml2cpp -a statusnotifieritem ../../3rdparty/dbus-ifaces/org.kde.StatusNotifierItem.xml
+
+ However it is maintained manually, because this adapter needs to do
+ significant interface adaptation, and can do it more efficiently using the
+ QDBusTrayIcon API directly rather than via QObject::property() and
+ QMetaObject::invokeMethod().
+*/
+
+#include "qstatusnotifieritemadaptor_p.h"
+
+#ifndef QT_NO_SYSTEMTRAYICON
+
+#include <QtCore/QLoggingCategory>
+#include <QtCore/QCoreApplication>
+
+#include "qdbustrayicon_p.h"
+
+QT_BEGIN_NAMESPACE
+
+Q_DECLARE_LOGGING_CATEGORY(qLcMenu)
+Q_DECLARE_LOGGING_CATEGORY(qLcTray)
+
+QStatusNotifierItemAdaptor::QStatusNotifierItemAdaptor(QDBusTrayIcon *parent)
+ : QDBusAbstractAdaptor(parent), m_trayIcon(parent)
+{
+ setAutoRelaySignals(true);
+}
+
+QStatusNotifierItemAdaptor::~QStatusNotifierItemAdaptor()
+{
+}
+
+QString QStatusNotifierItemAdaptor::attentionIconName() const
+{
+ return m_trayIcon->attentionIconName();
+}
+
+QXdgDBusImageVector QStatusNotifierItemAdaptor::attentionIconPixmap() const
+{
+ return iconToQXdgDBusImageVector(m_trayIcon->attentionIcon());
+}
+
+QString QStatusNotifierItemAdaptor::attentionMovieName() const
+{
+ return QString();
+}
+
+QString QStatusNotifierItemAdaptor::category() const
+{
+ return m_trayIcon->category();
+}
+
+QString QStatusNotifierItemAdaptor::iconName() const
+{
+ return m_trayIcon->iconName();
+}
+
+QXdgDBusImageVector QStatusNotifierItemAdaptor::iconPixmap() const
+{
+ return iconToQXdgDBusImageVector(m_trayIcon->icon());
+}
+
+QString QStatusNotifierItemAdaptor::id() const
+{
+ // from the API docs: "a name that should be unique for this application and
+ // consistent between sessions, such as the application name itself"
+ return QCoreApplication::applicationName();
+}
+
+bool QStatusNotifierItemAdaptor::itemIsMenu() const
+{
+ // From KDE docs: if this is true, the item only supports the context menu,
+ // so the visualization should prefer sending ContextMenu() instead of Activate().
+ // But QSystemTrayIcon doesn't have such a setting: it will emit activated()
+ // and the application is free to use it or ignore it; we don't know whether it will.
+ return false;
+}
+
+QDBusObjectPath QStatusNotifierItemAdaptor::menu() const
+{
+ return QDBusObjectPath(m_trayIcon->menu() ? "/MenuBar" : "/NO_DBUSMENU");
+}
+
+QString QStatusNotifierItemAdaptor::overlayIconName() const
+{
+ return QString();
+}
+
+QXdgDBusImageVector QStatusNotifierItemAdaptor::overlayIconPixmap() const
+{
+ QXdgDBusImageVector ret; // empty vector
+ return ret;
+}
+
+QString QStatusNotifierItemAdaptor::status() const
+{
+ return m_trayIcon->status();
+}
+
+QString QStatusNotifierItemAdaptor::title() const
+{
+ // Shown e.g. when the icon is hidden, in the popup showing all hidden items.
+ // Since QSystemTrayIcon doesn't have this property, the application name
+ // is the best information we have available.
+ return QCoreApplication::applicationName();
+}
+
+QXdgDBusToolTipStruct QStatusNotifierItemAdaptor::toolTip() const
+{
+ QXdgDBusToolTipStruct ret;
+ if (m_trayIcon->isRequestingAttention()) {
+ ret.title = m_trayIcon->attentionTitle();
+ ret.subTitle = m_trayIcon->attentionMessage();
+ ret.icon = m_trayIcon->attentionIconName();
+ } else {
+ ret.title = m_trayIcon->tooltip();
+ }
+ return ret;
+}
+
+void QStatusNotifierItemAdaptor::Activate(int x, int y)
+{
+ qCDebug(qLcTray) << x << y;
+ emit m_trayIcon->activated(QPlatformSystemTrayIcon::Trigger);
+}
+
+void QStatusNotifierItemAdaptor::ContextMenu(int x, int y)
+{
+ qCDebug(qLcTray) << x << y;
+ emit m_trayIcon->activated(QPlatformSystemTrayIcon::Context);
+}
+
+void QStatusNotifierItemAdaptor::ProvideXdgActivationToken(const QString &token)
+{
+ qCDebug(qLcTray) << token;
+ qputenv("XDG_ACTIVATION_TOKEN", token.toUtf8());
+}
+
+void QStatusNotifierItemAdaptor::Scroll(int w, const QString &s)
+{
+ qCDebug(qLcTray) << w << s;
+ // unsupported
+}
+
+void QStatusNotifierItemAdaptor::SecondaryActivate(int x, int y)
+{
+ qCDebug(qLcTray) << x << y;
+ emit m_trayIcon->activated(QPlatformSystemTrayIcon::MiddleClick);
+}
+
+QT_END_NAMESPACE
+
+#include "moc_qstatusnotifieritemadaptor_p.cpp"
+
+#endif // QT_NO_SYSTEMTRAYICON
diff --git a/src/gui/platform/unix/dbustray/qstatusnotifieritemadaptor_p.h b/src/gui/platform/unix/dbustray/qstatusnotifieritemadaptor_p.h
new file mode 100644
index 0000000000..103fc974dd
--- /dev/null
+++ b/src/gui/platform/unix/dbustray/qstatusnotifieritemadaptor_p.h
@@ -0,0 +1,174 @@
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
+
+/*
+ This file was originally created by qdbusxml2cpp version 0.8
+ Command line was:
+ qdbusxml2cpp -a statusnotifieritem ../../3rdparty/dbus-ifaces/org.kde.StatusNotifierItem.xml
+
+ However it is maintained manually.
+
+ It is also not part of the public API. This header file may change from
+ version to version without notice, or even be removed.
+*/
+
+#ifndef QSTATUSNOTIFIERITEMADAPTER_P_H
+#define QSTATUSNOTIFIERITEMADAPTER_P_H
+
+//
+// W A R N I N G
+// -------------
+//
+// This file is not part of the Qt API. It exists purely as an
+// implementation detail. This header file may change from version to
+// version without notice, or even be removed.
+//
+// We mean it.
+//
+
+#include <private/qtguiglobal_p.h>
+
+QT_REQUIRE_CONFIG(systemtrayicon);
+
+#include <QObject>
+#include <QDBusAbstractAdaptor>
+
+#include <private/qdbustraytypes_p.h>
+
+QT_BEGIN_NAMESPACE
+class QDBusTrayIcon;
+
+/*
+ Adaptor class for interface org.kde.StatusNotifierItem
+ see http://www.freedesktop.org/wiki/Specifications/StatusNotifierItem/
+ (also http://www.notmart.org/misc/statusnotifieritem/)
+*/
+class QStatusNotifierItemAdaptor: public QDBusAbstractAdaptor
+{
+ Q_OBJECT
+ Q_CLASSINFO("D-Bus Interface", "org.kde.StatusNotifierItem")
+ Q_CLASSINFO("D-Bus Introspection", ""
+" <interface name=\"org.kde.StatusNotifierItem\">\n"
+" <property access=\"read\" type=\"s\" name=\"Category\"/>\n"
+" <property access=\"read\" type=\"s\" name=\"Id\"/>\n"
+" <property access=\"read\" type=\"s\" name=\"Title\"/>\n"
+" <property access=\"read\" type=\"s\" name=\"Status\"/>\n"
+" <property access=\"read\" type=\"i\" name=\"WindowId\"/>\n"
+" <property access=\"read\" type=\"s\" name=\"IconThemePath\"/>\n"
+" <property access=\"read\" type=\"o\" name=\"Menu\"/>\n"
+" <property access=\"read\" type=\"b\" name=\"ItemIsMenu\"/>\n"
+" <property access=\"read\" type=\"s\" name=\"IconName\"/>\n"
+" <property access=\"read\" type=\"a(iiay)\" name=\"IconPixmap\">\n"
+" <annotation value=\"QXdgDBusImageVector\" name=\"org.qtproject.QtDBus.QtTypeName\"/>\n"
+" </property>\n"
+" <property access=\"read\" type=\"s\" name=\"OverlayIconName\"/>\n"
+" <property access=\"read\" type=\"a(iiay)\" name=\"OverlayIconPixmap\">\n"
+" <annotation value=\"QXdgDBusImageVector\" name=\"org.qtproject.QtDBus.QtTypeName\"/>\n"
+" </property>\n"
+" <property access=\"read\" type=\"s\" name=\"AttentionIconName\"/>\n"
+" <property access=\"read\" type=\"a(iiay)\" name=\"AttentionIconPixmap\">\n"
+" <annotation value=\"QXdgDBusImageVector\" name=\"org.qtproject.QtDBus.QtTypeName\"/>\n"
+" </property>\n"
+" <property access=\"read\" type=\"s\" name=\"AttentionMovieName\"/>\n"
+" <property access=\"read\" type=\"(sa(iiay)ss)\" name=\"ToolTip\">\n"
+" <annotation value=\"QXdgDBusToolTipStruct\" name=\"org.qtproject.QtDBus.QtTypeName\"/>\n"
+" </property>\n"
+" <method name=\"ProvideXdgActivationToken\">\n"
+" <arg name=\"token\" type=\"s\" direction=\"in\"/>\n"
+" </method>\n"
+" <method name=\"ContextMenu\">\n"
+" <arg direction=\"in\" type=\"i\" name=\"x\"/>\n"
+" <arg direction=\"in\" type=\"i\" name=\"y\"/>\n"
+" </method>\n"
+" <method name=\"Activate\">\n"
+" <arg direction=\"in\" type=\"i\" name=\"x\"/>\n"
+" <arg direction=\"in\" type=\"i\" name=\"y\"/>\n"
+" </method>\n"
+" <method name=\"SecondaryActivate\">\n"
+" <arg direction=\"in\" type=\"i\" name=\"x\"/>\n"
+" <arg direction=\"in\" type=\"i\" name=\"y\"/>\n"
+" </method>\n"
+" <method name=\"Scroll\">\n"
+" <arg direction=\"in\" type=\"i\" name=\"delta\"/>\n"
+" <arg direction=\"in\" type=\"s\" name=\"orientation\"/>\n"
+" </method>\n"
+" <signal name=\"NewTitle\"/>\n"
+" <signal name=\"NewIcon\"/>\n"
+" <signal name=\"NewAttentionIcon\"/>\n"
+" <signal name=\"NewOverlayIcon\"/>\n"
+" <signal name=\"NewMenu\"/>\n"
+" <signal name=\"NewToolTip\"/>\n"
+" <signal name=\"NewStatus\">\n"
+" <arg type=\"s\" name=\"status\"/>\n"
+" </signal>\n"
+" </interface>\n"
+ "")
+public:
+ QStatusNotifierItemAdaptor(QDBusTrayIcon *parent);
+ virtual ~QStatusNotifierItemAdaptor();
+
+public: // PROPERTIES
+ Q_PROPERTY(QString AttentionIconName READ attentionIconName)
+ QString attentionIconName() const;
+
+ Q_PROPERTY(QXdgDBusImageVector AttentionIconPixmap READ attentionIconPixmap)
+ QXdgDBusImageVector attentionIconPixmap() const;
+
+ Q_PROPERTY(QString AttentionMovieName READ attentionMovieName)
+ QString attentionMovieName() const;
+
+ Q_PROPERTY(QString Category READ category)
+ QString category() const;
+
+ Q_PROPERTY(QString IconName READ iconName)
+ QString iconName() const;
+
+ Q_PROPERTY(QXdgDBusImageVector IconPixmap READ iconPixmap)
+ QXdgDBusImageVector iconPixmap() const;
+
+ Q_PROPERTY(QString Id READ id)
+ QString id() const;
+
+ Q_PROPERTY(bool ItemIsMenu READ itemIsMenu)
+ bool itemIsMenu() const;
+
+ Q_PROPERTY(QDBusObjectPath Menu READ menu)
+ QDBusObjectPath menu() const;
+
+ Q_PROPERTY(QString OverlayIconName READ overlayIconName)
+ QString overlayIconName() const;
+
+ Q_PROPERTY(QXdgDBusImageVector OverlayIconPixmap READ overlayIconPixmap)
+ QXdgDBusImageVector overlayIconPixmap() const;
+
+ Q_PROPERTY(QString Status READ status)
+ QString status() const;
+
+ Q_PROPERTY(QString Title READ title)
+ QString title() const;
+
+ Q_PROPERTY(QXdgDBusToolTipStruct ToolTip READ toolTip)
+ QXdgDBusToolTipStruct toolTip() const;
+
+public Q_SLOTS: // METHODS
+ void Activate(int x, int y);
+ void ContextMenu(int x, int y);
+ void ProvideXdgActivationToken(const QString &token);
+ void Scroll(int delta, const QString &orientation);
+ void SecondaryActivate(int x, int y);
+Q_SIGNALS: // SIGNALS
+ void NewAttentionIcon();
+ void NewIcon();
+ void NewOverlayIcon();
+ void NewMenu();
+ void NewStatus(const QString &status);
+ void NewTitle();
+ void NewToolTip();
+
+private:
+ QDBusTrayIcon *m_trayIcon;
+};
+
+QT_END_NAMESPACE
+
+#endif // QSTATUSNOTIFIERITEMADAPTER_P_H
diff --git a/src/gui/platform/unix/dbustray/qxdgnotificationproxy.cpp b/src/gui/platform/unix/dbustray/qxdgnotificationproxy.cpp
new file mode 100644
index 0000000000..97b6697e6d
--- /dev/null
+++ b/src/gui/platform/unix/dbustray/qxdgnotificationproxy.cpp
@@ -0,0 +1,19 @@
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
+
+#include "qxdgnotificationproxy_p.h"
+
+QT_BEGIN_NAMESPACE
+
+QXdgNotificationInterface::QXdgNotificationInterface(const QString &service, const QString &path, const QDBusConnection &connection, QObject *parent)
+ : QDBusAbstractInterface(service, path, staticInterfaceName(), connection, parent)
+{
+}
+
+QXdgNotificationInterface::~QXdgNotificationInterface()
+{
+}
+
+QT_END_NAMESPACE
+
+#include "moc_qxdgnotificationproxy_p.cpp"
diff --git a/src/gui/platform/unix/dbustray/qxdgnotificationproxy_p.h b/src/gui/platform/unix/dbustray/qxdgnotificationproxy_p.h
new file mode 100644
index 0000000000..dfbc64f33b
--- /dev/null
+++ b/src/gui/platform/unix/dbustray/qxdgnotificationproxy_p.h
@@ -0,0 +1,110 @@
+// Copyright (C) 2021 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
+
+/*
+ This file was originally created by qdbusxml2cpp version 0.8
+ Command line was:
+ qdbusxml2cpp -p qxdgnotificationproxy ../../3rdparty/dbus-ifaces/org.freedesktop.Notifications.xml
+
+ However it is maintained manually.
+
+ It is also not part of the public API. This header file may change from
+ version to version without notice, or even be removed.
+*/
+
+#ifndef QXDGNOTIFICATIONPROXY_P_H
+#define QXDGNOTIFICATIONPROXY_P_H
+
+//
+// W A R N I N G
+// -------------
+//
+// This file is not part of the Qt API. It exists for the convenience
+// of other Qt classes. This header file may change from version to
+// version without notice, or even be removed.
+//
+// We mean it.
+//
+
+#include <QObject>
+#include <QByteArray>
+#include <QList>
+#include <QLoggingCategory>
+#include <QMap>
+#include <QString>
+#include <QStringList>
+#include <QVariant>
+#include <QDBusAbstractInterface>
+#include <QDBusPendingReply>
+#include <QDBusReply>
+#include <private/qglobal_p.h>
+
+QT_BEGIN_NAMESPACE
+
+Q_DECLARE_LOGGING_CATEGORY(qLcTray)
+
+/*
+ * Proxy class for interface org.freedesktop.Notifications
+ */
+class QXdgNotificationInterface: public QDBusAbstractInterface
+{
+ Q_OBJECT
+public:
+ static inline const char *staticInterfaceName()
+ { return "org.freedesktop.Notifications"; }
+
+public:
+ QXdgNotificationInterface(const QString &service, const QString &path,
+ const QDBusConnection &connection, QObject *parent = nullptr);
+
+ ~QXdgNotificationInterface();
+
+public Q_SLOTS: // METHODS
+ inline QDBusPendingReply<> closeNotification(uint id)
+ {
+ return asyncCall(QStringLiteral("CloseNotification"), id);
+ }
+
+ inline QDBusPendingReply<QStringList> getCapabilities()
+ {
+ return asyncCall(QStringLiteral("GetCapabilities"));
+ }
+
+ inline QDBusPendingReply<QString, QString, QString, QString> getServerInformation()
+ {
+ return asyncCall(QStringLiteral("GetServerInformation"));
+ }
+ inline QDBusReply<QString> getServerInformation(QString &vendor, QString &version, QString &specVersion)
+ {
+ QDBusMessage reply = call(QDBus::Block, QStringLiteral("GetServerInformation"));
+ if (reply.type() == QDBusMessage::ReplyMessage && reply.arguments().size() == 4) {
+ vendor = qdbus_cast<QString>(reply.arguments().at(1));
+ version = qdbus_cast<QString>(reply.arguments().at(2));
+ specVersion = qdbus_cast<QString>(reply.arguments().at(3));
+ }
+ return reply;
+ }
+
+ // see https://developer.gnome.org/notification-spec/#basic-design
+ inline QDBusPendingReply<uint> notify(const QString &appName, uint replacesId, const QString &appIcon,
+ const QString &summary, const QString &body, const QStringList &actions,
+ const QVariantMap &hints, int timeout)
+ {
+ qCDebug(qLcTray) << appName << replacesId << appIcon << summary << body << actions << hints << timeout;
+ return asyncCall(QStringLiteral("Notify"), appName, replacesId, appIcon, summary, body, actions, hints, timeout);
+ }
+
+Q_SIGNALS:
+ void ActionInvoked(uint id, const QString &action_key);
+ void NotificationClosed(uint id, uint reason);
+};
+
+QT_END_NAMESPACE
+
+namespace org {
+ namespace freedesktop {
+ using Notifications = QT_PREPEND_NAMESPACE(QXdgNotificationInterface);
+ }
+}
+
+#endif
diff --git a/src/gui/platform/unix/qeventdispatcher_glib.cpp b/src/gui/platform/unix/qeventdispatcher_glib.cpp
new file mode 100644
index 0000000000..368006f302
--- /dev/null
+++ b/src/gui/platform/unix/qeventdispatcher_glib.cpp
@@ -0,0 +1,92 @@
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
+
+#include "qeventdispatcher_glib_p.h"
+
+#include "qguiapplication.h"
+
+#include "qplatformdefs.h"
+
+#include <glib.h>
+#include "private/qguiapplication_p.h"
+
+QT_BEGIN_NAMESPACE
+
+struct GUserEventSource
+{
+ GSource source;
+ QPAEventDispatcherGlib *q;
+ QPAEventDispatcherGlibPrivate *d;
+};
+
+static gboolean userEventSourcePrepare(GSource *source, gint *timeout)
+{
+ Q_UNUSED(timeout);
+ GUserEventSource *userEventSource = reinterpret_cast<GUserEventSource *>(source);
+ return userEventSource->d->wakeUpCalled;
+}
+
+static gboolean userEventSourceCheck(GSource *source)
+{
+ return userEventSourcePrepare(source, nullptr);
+}
+
+static gboolean userEventSourceDispatch(GSource *source, GSourceFunc, gpointer)
+{
+ GUserEventSource *userEventSource = reinterpret_cast<GUserEventSource *>(source);
+ QPAEventDispatcherGlib *dispatcher = userEventSource->q;
+ QWindowSystemInterface::sendWindowSystemEvents(dispatcher->m_flags);
+ return true;
+}
+
+static GSourceFuncs userEventSourceFuncs = {
+ userEventSourcePrepare,
+ userEventSourceCheck,
+ userEventSourceDispatch,
+ NULL,
+ NULL,
+ NULL
+};
+
+QPAEventDispatcherGlibPrivate::QPAEventDispatcherGlibPrivate(GMainContext *context)
+ : QEventDispatcherGlibPrivate(context)
+{
+ Q_Q(QPAEventDispatcherGlib);
+
+ GSource *source = g_source_new(&userEventSourceFuncs, sizeof(GUserEventSource));
+ g_source_set_name(source, "[Qt] GUserEventSource");
+ userEventSource = reinterpret_cast<GUserEventSource *>(source);
+
+ userEventSource->q = q;
+ userEventSource->d = this;
+ g_source_set_can_recurse(&userEventSource->source, true);
+ g_source_attach(&userEventSource->source, mainContext);
+}
+
+
+QPAEventDispatcherGlib::QPAEventDispatcherGlib(QObject *parent)
+ : QEventDispatcherGlib(*new QPAEventDispatcherGlibPrivate, parent)
+ , m_flags(QEventLoop::AllEvents)
+{
+ Q_D(QPAEventDispatcherGlib);
+ d->userEventSource->q = this;
+}
+
+QPAEventDispatcherGlib::~QPAEventDispatcherGlib()
+{
+ Q_D(QPAEventDispatcherGlib);
+
+ g_source_destroy(&d->userEventSource->source);
+ g_source_unref(&d->userEventSource->source);
+ d->userEventSource = nullptr;
+}
+
+bool QPAEventDispatcherGlib::processEvents(QEventLoop::ProcessEventsFlags flags)
+{
+ m_flags = flags;
+ return QEventDispatcherGlib::processEvents(m_flags);
+}
+
+QT_END_NAMESPACE
+
+#include "moc_qeventdispatcher_glib_p.cpp"
diff --git a/src/gui/platform/unix/qeventdispatcher_glib_p.h b/src/gui/platform/unix/qeventdispatcher_glib_p.h
new file mode 100644
index 0000000000..95fac16237
--- /dev/null
+++ b/src/gui/platform/unix/qeventdispatcher_glib_p.h
@@ -0,0 +1,52 @@
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
+
+#ifndef QEVENTDISPATCHER_GLIB_QPA_P_H
+#define QEVENTDISPATCHER_GLIB_QPA_P_H
+
+//
+// W A R N I N G
+// -------------
+//
+// This file is not part of the Qt API. It exists purely as an
+// implementation detail. This header file may change from version to
+// version without notice, or even be removed.
+//
+// We mean it.
+//
+
+#include <QtCore/private/qeventdispatcher_glib_p.h>
+#include <QtGui/qtguiglobal.h>
+
+typedef struct _GMainContext GMainContext;
+
+QT_BEGIN_NAMESPACE
+class QPAEventDispatcherGlibPrivate;
+
+class Q_GUI_EXPORT QPAEventDispatcherGlib : public QEventDispatcherGlib
+{
+ Q_OBJECT
+ Q_DECLARE_PRIVATE(QPAEventDispatcherGlib)
+
+public:
+ explicit QPAEventDispatcherGlib(QObject *parent = nullptr);
+ ~QPAEventDispatcherGlib();
+
+ bool processEvents(QEventLoop::ProcessEventsFlags flags) override;
+ QEventLoop::ProcessEventsFlags m_flags;
+};
+
+struct GUserEventSource;
+
+class QPAEventDispatcherGlibPrivate : public QEventDispatcherGlibPrivate
+{
+ Q_DECLARE_PUBLIC(QPAEventDispatcherGlib)
+public:
+ QPAEventDispatcherGlibPrivate(GMainContext *context = nullptr);
+ GUserEventSource *userEventSource;
+};
+
+
+QT_END_NAMESPACE
+
+#endif // QEVENTDISPATCHER_GLIB_QPA_P_H
diff --git a/src/gui/platform/unix/qgenericunixeventdispatcher.cpp b/src/gui/platform/unix/qgenericunixeventdispatcher.cpp
new file mode 100644
index 0000000000..b551aefe99
--- /dev/null
+++ b/src/gui/platform/unix/qgenericunixeventdispatcher.cpp
@@ -0,0 +1,21 @@
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
+
+#include "qgenericunixeventdispatcher_p.h"
+#include "qunixeventdispatcher_qpa_p.h"
+#if QT_CONFIG(glib)
+# include "qeventdispatcher_glib_p.h"
+#endif
+QT_BEGIN_NAMESPACE
+
+class QAbstractEventDispatcher *QtGenericUnixDispatcher::createUnixEventDispatcher()
+{
+#if !defined(QT_NO_GLIB) && !defined(Q_OS_WIN)
+ if (qEnvironmentVariableIsEmpty("QT_NO_GLIB") && QEventDispatcherGlib::versionSupported())
+ return new QPAEventDispatcherGlib();
+ else
+#endif
+ return new QUnixEventDispatcherQPA();
+}
+
+QT_END_NAMESPACE
diff --git a/src/gui/platform/unix/qgenericunixeventdispatcher_p.h b/src/gui/platform/unix/qgenericunixeventdispatcher_p.h
new file mode 100644
index 0000000000..82dc35da0b
--- /dev/null
+++ b/src/gui/platform/unix/qgenericunixeventdispatcher_p.h
@@ -0,0 +1,31 @@
+// Copyright (C) 2020 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
+
+//
+// W A R N I N G
+// -------------
+//
+// This file is not part of the Qt API. It exists for the convenience
+// of other Qt classes. This header file may change from version to
+// version without notice, or even be removed.
+//
+// We mean it.
+//
+
+#ifndef QGENERICUNIXEVENTDISPATCHER_P_H
+#define QGENERICUNIXEVENTDISPATCHER_P_H
+
+#include <QtGui/qtguiglobal.h>
+#include <QtCore/private/qglobal_p.h>
+
+QT_BEGIN_NAMESPACE
+
+class QAbstractEventDispatcher;
+namespace QtGenericUnixDispatcher {
+Q_GUI_EXPORT QAbstractEventDispatcher *createUnixEventDispatcher();
+}
+using QtGenericUnixDispatcher::createUnixEventDispatcher;
+
+QT_END_NAMESPACE
+
+#endif // QGENERICUNIXEVENTDISPATCHER_P_H
diff --git a/src/gui/platform/unix/qgenericunixservices.cpp b/src/gui/platform/unix/qgenericunixservices.cpp
new file mode 100644
index 0000000000..bfd2556b1e
--- /dev/null
+++ b/src/gui/platform/unix/qgenericunixservices.cpp
@@ -0,0 +1,613 @@
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
+
+#include "qgenericunixservices_p.h"
+#include <QtGui/private/qtguiglobal_p.h>
+#include "qguiapplication.h"
+#include "qwindow.h"
+#include <QtGui/qpa/qplatformwindow_p.h>
+#include <QtGui/qpa/qplatformwindow.h>
+#include <QtGui/qpa/qplatformnativeinterface.h>
+
+#include <QtCore/QDebug>
+#include <QtCore/QFile>
+#if QT_CONFIG(process)
+# include <QtCore/QProcess>
+#endif
+#if QT_CONFIG(settings)
+#include <QtCore/QSettings>
+#endif
+#include <QtCore/QStandardPaths>
+#include <QtCore/QUrl>
+
+#if QT_CONFIG(dbus)
+// These QtCore includes are needed for xdg-desktop-portal support
+#include <QtCore/private/qcore_unix_p.h>
+
+#include <QtCore/QFileInfo>
+#include <QtCore/QUrlQuery>
+
+#include <QtDBus/QDBusConnection>
+#include <QtDBus/QDBusMessage>
+#include <QtDBus/QDBusPendingCall>
+#include <QtDBus/QDBusPendingCallWatcher>
+#include <QtDBus/QDBusPendingReply>
+#include <QtDBus/QDBusUnixFileDescriptor>
+
+#include <fcntl.h>
+
+#endif // QT_CONFIG(dbus)
+
+#include <stdlib.h>
+
+QT_BEGIN_NAMESPACE
+
+using namespace Qt::StringLiterals;
+
+#if QT_CONFIG(multiprocess)
+
+enum { debug = 0 };
+
+static inline QByteArray detectDesktopEnvironment()
+{
+ const QByteArray xdgCurrentDesktop = qgetenv("XDG_CURRENT_DESKTOP");
+ if (!xdgCurrentDesktop.isEmpty())
+ return xdgCurrentDesktop.toUpper(); // KDE, GNOME, UNITY, LXDE, MATE, XFCE...
+
+ // Classic fallbacks
+ if (!qEnvironmentVariableIsEmpty("KDE_FULL_SESSION"))
+ return QByteArrayLiteral("KDE");
+ if (!qEnvironmentVariableIsEmpty("GNOME_DESKTOP_SESSION_ID"))
+ return QByteArrayLiteral("GNOME");
+
+ // Fallback to checking $DESKTOP_SESSION (unreliable)
+ QByteArray desktopSession = qgetenv("DESKTOP_SESSION");
+
+ // This can be a path in /usr/share/xsessions
+ int slash = desktopSession.lastIndexOf('/');
+ if (slash != -1) {
+#if QT_CONFIG(settings)
+ QSettings desktopFile(QFile::decodeName(desktopSession + ".desktop"), QSettings::IniFormat);
+ desktopFile.beginGroup(QStringLiteral("Desktop Entry"));
+ QByteArray desktopName = desktopFile.value(QStringLiteral("DesktopNames")).toByteArray();
+ if (!desktopName.isEmpty())
+ return desktopName;
+#endif
+
+ // try decoding just the basename
+ desktopSession = desktopSession.mid(slash + 1);
+ }
+
+ if (desktopSession == "gnome")
+ return QByteArrayLiteral("GNOME");
+ else if (desktopSession == "xfce")
+ return QByteArrayLiteral("XFCE");
+ else if (desktopSession == "kde")
+ return QByteArrayLiteral("KDE");
+
+ return QByteArrayLiteral("UNKNOWN");
+}
+
+static inline bool checkExecutable(const QString &candidate, QString *result)
+{
+ *result = QStandardPaths::findExecutable(candidate);
+ return !result->isEmpty();
+}
+
+static inline bool detectWebBrowser(const QByteArray &desktop,
+ bool checkBrowserVariable,
+ QString *browser)
+{
+ const char *browsers[] = {"google-chrome", "firefox", "mozilla", "opera"};
+
+ browser->clear();
+ if (checkExecutable(QStringLiteral("xdg-open"), browser))
+ return true;
+
+ if (checkBrowserVariable) {
+ QByteArray browserVariable = qgetenv("DEFAULT_BROWSER");
+ if (browserVariable.isEmpty())
+ browserVariable = qgetenv("BROWSER");
+ if (!browserVariable.isEmpty() && checkExecutable(QString::fromLocal8Bit(browserVariable), browser))
+ return true;
+ }
+
+ if (desktop == QByteArray("KDE")) {
+ if (checkExecutable(QStringLiteral("kde-open5"), browser))
+ return true;
+ // Konqueror launcher
+ if (checkExecutable(QStringLiteral("kfmclient"), browser)) {
+ browser->append(" exec"_L1);
+ return true;
+ }
+ } else if (desktop == QByteArray("GNOME")) {
+ if (checkExecutable(QStringLiteral("gnome-open"), browser))
+ return true;
+ }
+
+ for (size_t i = 0; i < sizeof(browsers)/sizeof(char *); ++i)
+ if (checkExecutable(QLatin1StringView(browsers[i]), browser))
+ return true;
+ return false;
+}
+
+static inline bool launch(const QString &launcher, const QUrl &url,
+ const QString &xdgActivationToken)
+{
+ if (!xdgActivationToken.isEmpty()) {
+ qputenv("XDG_ACTIVATION_TOKEN", xdgActivationToken.toUtf8());
+ }
+
+ const QString command = launcher + u' ' + QLatin1StringView(url.toEncoded());
+ if (debug)
+ qDebug("Launching %s", qPrintable(command));
+#if !QT_CONFIG(process)
+ const bool ok = ::system(qPrintable(command + " &"_L1));
+#else
+ QStringList args = QProcess::splitCommand(command);
+ bool ok = false;
+ if (!args.isEmpty()) {
+ QString program = args.takeFirst();
+ ok = QProcess::startDetached(program, args);
+ }
+#endif
+ if (!ok)
+ qWarning("Launch failed (%s)", qPrintable(command));
+
+ qunsetenv("XDG_ACTIVATION_TOKEN");
+
+ return ok;
+}
+
+#if QT_CONFIG(dbus)
+static inline bool checkNeedPortalSupport()
+{
+ return QFileInfo::exists("/.flatpak-info"_L1) || qEnvironmentVariableIsSet("SNAP");
+}
+
+static inline QDBusMessage xdgDesktopPortalOpenFile(const QUrl &url, const QString &parentWindow,
+ const QString &xdgActivationToken)
+{
+ // DBus signature:
+ // OpenFile (IN s parent_window,
+ // IN h fd,
+ // IN a{sv} options,
+ // OUT o handle)
+ // Options:
+ // handle_token (s) - A string that will be used as the last element of the @handle.
+ // writable (b) - Whether to allow the chosen application to write to the file.
+
+ const int fd = qt_safe_open(QFile::encodeName(url.toLocalFile()), O_RDONLY);
+ if (fd != -1) {
+ QDBusMessage message = QDBusMessage::createMethodCall("org.freedesktop.portal.Desktop"_L1,
+ "/org/freedesktop/portal/desktop"_L1,
+ "org.freedesktop.portal.OpenURI"_L1,
+ "OpenFile"_L1);
+
+ QDBusUnixFileDescriptor descriptor;
+ descriptor.giveFileDescriptor(fd);
+
+ QVariantMap options = {};
+
+ if (!xdgActivationToken.isEmpty()) {
+ options.insert("activation_token"_L1, xdgActivationToken);
+ }
+
+ message << parentWindow << QVariant::fromValue(descriptor) << options;
+
+ return QDBusConnection::sessionBus().call(message);
+ }
+
+ return QDBusMessage::createError(QDBusError::InternalError, qt_error_string());
+}
+
+static inline QDBusMessage xdgDesktopPortalOpenUrl(const QUrl &url, const QString &parentWindow,
+ const QString &xdgActivationToken)
+{
+ // DBus signature:
+ // OpenURI (IN s parent_window,
+ // IN s uri,
+ // IN a{sv} options,
+ // OUT o handle)
+ // Options:
+ // handle_token (s) - A string that will be used as the last element of the @handle.
+ // writable (b) - Whether to allow the chosen application to write to the file.
+ // This key only takes effect the uri points to a local file that is exported in the document portal,
+ // and the chosen application is sandboxed itself.
+
+ QDBusMessage message = QDBusMessage::createMethodCall("org.freedesktop.portal.Desktop"_L1,
+ "/org/freedesktop/portal/desktop"_L1,
+ "org.freedesktop.portal.OpenURI"_L1,
+ "OpenURI"_L1);
+ // FIXME parent_window_id and handle writable option
+ QVariantMap options;
+
+ if (!xdgActivationToken.isEmpty()) {
+ options.insert("activation_token"_L1, xdgActivationToken);
+ }
+
+ message << parentWindow << url.toString() << options;
+
+ return QDBusConnection::sessionBus().call(message);
+}
+
+static inline QDBusMessage xdgDesktopPortalSendEmail(const QUrl &url, const QString &parentWindow,
+ const QString &xdgActivationToken)
+{
+ // DBus signature:
+ // ComposeEmail (IN s parent_window,
+ // IN a{sv} options,
+ // OUT o handle)
+ // Options:
+ // address (s) - The email address to send to.
+ // subject (s) - The subject for the email.
+ // body (s) - The body for the email.
+ // attachment_fds (ah) - File descriptors for files to attach.
+
+ QUrlQuery urlQuery(url);
+ QVariantMap options;
+ options.insert("address"_L1, url.path());
+ options.insert("subject"_L1, urlQuery.queryItemValue("subject"_L1));
+ options.insert("body"_L1, urlQuery.queryItemValue("body"_L1));
+
+ // O_PATH seems to be present since Linux 2.6.39, which is not case of RHEL 6
+#ifdef O_PATH
+ QList<QDBusUnixFileDescriptor> attachments;
+ const QStringList attachmentUris = urlQuery.allQueryItemValues("attachment"_L1);
+
+ for (const QString &attachmentUri : attachmentUris) {
+ const int fd = qt_safe_open(QFile::encodeName(attachmentUri), O_PATH);
+ if (fd != -1) {
+ QDBusUnixFileDescriptor descriptor(fd);
+ attachments << descriptor;
+ qt_safe_close(fd);
+ }
+ }
+
+ options.insert("attachment_fds"_L1, QVariant::fromValue(attachments));
+#endif
+
+ if (!xdgActivationToken.isEmpty()) {
+ options.insert("activation_token"_L1, xdgActivationToken);
+ }
+
+ QDBusMessage message = QDBusMessage::createMethodCall("org.freedesktop.portal.Desktop"_L1,
+ "/org/freedesktop/portal/desktop"_L1,
+ "org.freedesktop.portal.Email"_L1,
+ "ComposeEmail"_L1);
+
+ message << parentWindow << options;
+
+ return QDBusConnection::sessionBus().call(message);
+}
+
+namespace {
+struct XDGDesktopColor
+{
+ double r = 0;
+ double g = 0;
+ double b = 0;
+
+ QColor toQColor() const
+ {
+ constexpr auto rgbMax = 255;
+ return { static_cast<int>(r * rgbMax), static_cast<int>(g * rgbMax),
+ static_cast<int>(b * rgbMax) };
+ }
+};
+
+const QDBusArgument &operator>>(const QDBusArgument &argument, XDGDesktopColor &myStruct)
+{
+ argument.beginStructure();
+ argument >> myStruct.r >> myStruct.g >> myStruct.b;
+ argument.endStructure();
+ return argument;
+}
+
+class XdgDesktopPortalColorPicker : public QPlatformServiceColorPicker
+{
+ Q_OBJECT
+public:
+ XdgDesktopPortalColorPicker(const QString &parentWindowId, QWindow *parent)
+ : QPlatformServiceColorPicker(parent), m_parentWindowId(parentWindowId)
+ {
+ }
+
+ void pickColor() override
+ {
+ // DBus signature:
+ // PickColor (IN s parent_window,
+ // IN a{sv} options
+ // OUT o handle)
+ // Options:
+ // handle_token (s) - A string that will be used as the last element of the @handle.
+
+ QDBusMessage message = QDBusMessage::createMethodCall(
+ "org.freedesktop.portal.Desktop"_L1, "/org/freedesktop/portal/desktop"_L1,
+ "org.freedesktop.portal.Screenshot"_L1, "PickColor"_L1);
+ message << m_parentWindowId << QVariantMap();
+
+ QDBusPendingCall pendingCall = QDBusConnection::sessionBus().asyncCall(message);
+ auto watcher = new QDBusPendingCallWatcher(pendingCall, this);
+ connect(watcher, &QDBusPendingCallWatcher::finished, this,
+ [this](QDBusPendingCallWatcher *watcher) {
+ watcher->deleteLater();
+ QDBusPendingReply<QDBusObjectPath> reply = *watcher;
+ if (reply.isError()) {
+ qWarning("DBus call to pick color failed: %s",
+ qPrintable(reply.error().message()));
+ Q_EMIT colorPicked({});
+ } else {
+ QDBusConnection::sessionBus().connect(
+ "org.freedesktop.portal.Desktop"_L1, reply.value().path(),
+ "org.freedesktop.portal.Request"_L1, "Response"_L1, this,
+ // clang-format off
+ SLOT(gotColorResponse(uint,QVariantMap))
+ // clang-format on
+ );
+ }
+ });
+ }
+
+private Q_SLOTS:
+ void gotColorResponse(uint result, const QVariantMap &map)
+ {
+ if (result != 0)
+ return;
+ if (map.contains(u"color"_s)) {
+ XDGDesktopColor color{};
+ map.value(u"color"_s).value<QDBusArgument>() >> color;
+ Q_EMIT colorPicked(color.toQColor());
+ } else {
+ Q_EMIT colorPicked({});
+ }
+ deleteLater();
+ }
+
+private:
+ const QString m_parentWindowId;
+};
+} // namespace
+
+#endif // QT_CONFIG(dbus)
+
+QGenericUnixServices::QGenericUnixServices()
+{
+#if QT_CONFIG(dbus)
+ if (qEnvironmentVariableIntValue("QT_NO_XDG_DESKTOP_PORTAL") > 0) {
+ return;
+ }
+ QDBusMessage message = QDBusMessage::createMethodCall(
+ "org.freedesktop.portal.Desktop"_L1, "/org/freedesktop/portal/desktop"_L1,
+ "org.freedesktop.DBus.Properties"_L1, "Get"_L1);
+ message << "org.freedesktop.portal.Screenshot"_L1
+ << "version"_L1;
+
+ QDBusPendingCall pendingCall = QDBusConnection::sessionBus().asyncCall(message);
+ auto watcher = new QDBusPendingCallWatcher(pendingCall);
+ QObject::connect(watcher, &QDBusPendingCallWatcher::finished, watcher,
+ [this](QDBusPendingCallWatcher *watcher) {
+ watcher->deleteLater();
+ QDBusPendingReply<QVariant> reply = *watcher;
+ if (!reply.isError() && reply.value().toUInt() >= 2)
+ m_hasScreenshotPortalWithColorPicking = true;
+ });
+
+#endif
+}
+
+QPlatformServiceColorPicker *QGenericUnixServices::colorPicker(QWindow *parent)
+{
+#if QT_CONFIG(dbus)
+ // Make double sure that we are in a wayland environment. In particular check
+ // WAYLAND_DISPLAY so also XWayland apps benefit from portal-based color picking.
+ // Outside wayland we'll rather rely on other means than the XDG desktop portal.
+ if (!qEnvironmentVariableIsEmpty("WAYLAND_DISPLAY")
+ || QGuiApplication::platformName().startsWith("wayland"_L1)) {
+ return new XdgDesktopPortalColorPicker(portalWindowIdentifier(parent), parent);
+ }
+ return nullptr;
+#else
+ Q_UNUSED(parent);
+ return nullptr;
+#endif
+}
+
+QByteArray QGenericUnixServices::desktopEnvironment() const
+{
+ static const QByteArray result = detectDesktopEnvironment();
+ return result;
+}
+
+template<typename F>
+void runWithXdgActivationToken(F &&functionToCall)
+{
+#if QT_CONFIG(wayland)
+ QWindow *window = qGuiApp->focusWindow();
+
+ if (!window) {
+ functionToCall({});
+ return;
+ }
+
+ auto waylandApp = dynamic_cast<QNativeInterface::QWaylandApplication *>(
+ qGuiApp->platformNativeInterface());
+ auto waylandWindow =
+ dynamic_cast<QNativeInterface::Private::QWaylandWindow *>(window->handle());
+
+ if (!waylandWindow || !waylandApp) {
+ functionToCall({});
+ return;
+ }
+
+ QObject::connect(waylandWindow,
+ &QNativeInterface::Private::QWaylandWindow::xdgActivationTokenCreated,
+ waylandWindow, functionToCall, Qt::SingleShotConnection);
+ waylandWindow->requestXdgActivationToken(waylandApp->lastInputSerial());
+#else
+ functionToCall({});
+#endif
+}
+
+bool QGenericUnixServices::openUrl(const QUrl &url)
+{
+ auto openUrlInternal = [this](const QUrl &url, const QString &xdgActivationToken) {
+ if (url.scheme() == "mailto"_L1) {
+# if QT_CONFIG(dbus)
+ if (checkNeedPortalSupport()) {
+ const QString parentWindow = QGuiApplication::focusWindow()
+ ? portalWindowIdentifier(QGuiApplication::focusWindow())
+ : QString();
+ QDBusError error = xdgDesktopPortalSendEmail(url, parentWindow, xdgActivationToken);
+ if (!error.isValid())
+ return true;
+
+ // service not running, fall back
+ }
+# endif
+ return openDocument(url);
+ }
+
+# if QT_CONFIG(dbus)
+ if (checkNeedPortalSupport()) {
+ const QString parentWindow = QGuiApplication::focusWindow()
+ ? portalWindowIdentifier(QGuiApplication::focusWindow())
+ : QString();
+ QDBusError error = xdgDesktopPortalOpenUrl(url, parentWindow, xdgActivationToken);
+ if (!error.isValid())
+ return true;
+ }
+# endif
+
+ if (m_webBrowser.isEmpty()
+ && !detectWebBrowser(desktopEnvironment(), true, &m_webBrowser)) {
+ qWarning("Unable to detect a web browser to launch '%s'", qPrintable(url.toString()));
+ return false;
+ }
+ return launch(m_webBrowser, url, xdgActivationToken);
+ };
+
+ if (QGuiApplication::platformName().startsWith("wayland"_L1)) {
+ runWithXdgActivationToken(
+ [openUrlInternal, url](const QString &token) { openUrlInternal(url, token); });
+
+ return true;
+
+ } else {
+ return openUrlInternal(url, QString());
+ }
+}
+
+bool QGenericUnixServices::openDocument(const QUrl &url)
+{
+ auto openDocumentInternal = [this](const QUrl &url, const QString &xdgActivationToken) {
+
+# if QT_CONFIG(dbus)
+ if (checkNeedPortalSupport()) {
+ const QString parentWindow = QGuiApplication::focusWindow()
+ ? portalWindowIdentifier(QGuiApplication::focusWindow())
+ : QString();
+ QDBusError error = xdgDesktopPortalOpenFile(url, parentWindow, xdgActivationToken);
+ if (!error.isValid())
+ return true;
+ }
+# endif
+
+ if (m_documentLauncher.isEmpty()
+ && !detectWebBrowser(desktopEnvironment(), false, &m_documentLauncher)) {
+ qWarning("Unable to detect a launcher for '%s'", qPrintable(url.toString()));
+ return false;
+ }
+ return launch(m_documentLauncher, url, xdgActivationToken);
+ };
+
+ if (QGuiApplication::platformName().startsWith("wayland"_L1)) {
+ runWithXdgActivationToken([openDocumentInternal, url](const QString &token) {
+ openDocumentInternal(url, token);
+ });
+
+ return true;
+ } else {
+ return openDocumentInternal(url, QString());
+ }
+}
+
+#else
+QGenericUnixServices::QGenericUnixServices() = default;
+
+QByteArray QGenericUnixServices::desktopEnvironment() const
+{
+ return QByteArrayLiteral("UNKNOWN");
+}
+
+bool QGenericUnixServices::openUrl(const QUrl &url)
+{
+ Q_UNUSED(url);
+ qWarning("openUrl() not supported on this platform");
+ return false;
+}
+
+bool QGenericUnixServices::openDocument(const QUrl &url)
+{
+ Q_UNUSED(url);
+ qWarning("openDocument() not supported on this platform");
+ return false;
+}
+
+QPlatformServiceColorPicker *QGenericUnixServices::colorPicker(QWindow *parent)
+{
+ Q_UNUSED(parent);
+ return nullptr;
+}
+
+#endif // QT_NO_MULTIPROCESS
+
+QString QGenericUnixServices::portalWindowIdentifier(QWindow *window)
+{
+ Q_UNUSED(window);
+ return QString();
+}
+
+bool QGenericUnixServices::hasCapability(Capability capability) const
+{
+ switch (capability) {
+ case Capability::ColorPicking:
+ return m_hasScreenshotPortalWithColorPicking;
+ }
+ return false;
+}
+
+void QGenericUnixServices::setApplicationBadge(qint64 number)
+{
+#if QT_CONFIG(dbus)
+ if (qGuiApp->desktopFileName().isEmpty()) {
+ qWarning("QGuiApplication::desktopFileName() is empty");
+ return;
+ }
+
+
+ const QString launcherUrl = QStringLiteral("application://") + qGuiApp->desktopFileName() + QStringLiteral(".desktop");
+ const qint64 count = qBound(0, number, 9999);
+ QVariantMap dbusUnityProperties;
+
+ if (count > 0) {
+ dbusUnityProperties[QStringLiteral("count")] = count;
+ dbusUnityProperties[QStringLiteral("count-visible")] = true;
+ } else {
+ dbusUnityProperties[QStringLiteral("count-visible")] = false;
+ }
+
+ auto signal = QDBusMessage::createSignal(QStringLiteral("/com/canonical/unity/launcherentry/")
+ + qGuiApp->applicationName(), QStringLiteral("com.canonical.Unity.LauncherEntry"), QStringLiteral("Update"));
+
+ signal.setArguments({launcherUrl, dbusUnityProperties});
+
+ QDBusConnection::sessionBus().send(signal);
+#else
+ Q_UNUSED(number)
+#endif
+}
+
+QT_END_NAMESPACE
+
+#include "qgenericunixservices.moc"
diff --git a/src/gui/platform/unix/qgenericunixservices_p.h b/src/gui/platform/unix/qgenericunixservices_p.h
new file mode 100644
index 0000000000..56e15103f7
--- /dev/null
+++ b/src/gui/platform/unix/qgenericunixservices_p.h
@@ -0,0 +1,49 @@
+// Copyright (C) 2020 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
+
+#ifndef QGENERICUNIXDESKTOPSERVICES_H
+#define QGENERICUNIXDESKTOPSERVICES_H
+
+//
+// W A R N I N G
+// -------------
+//
+// This file is not part of the Qt API. It exists purely as an
+// implementation detail. This header file may change from version to
+// version without notice, or even be removed.
+//
+// We mean it.
+//
+
+#include <qpa/qplatformservices.h>
+#include <QtCore/QString>
+#include <QtCore/private/qglobal_p.h>
+
+QT_BEGIN_NAMESPACE
+
+class QWindow;
+
+class Q_GUI_EXPORT QGenericUnixServices : public QPlatformServices
+{
+public:
+ QGenericUnixServices();
+
+ QByteArray desktopEnvironment() const override;
+
+ bool hasCapability(Capability capability) const override;
+ bool openUrl(const QUrl &url) override;
+ bool openDocument(const QUrl &url) override;
+ QPlatformServiceColorPicker *colorPicker(QWindow *parent = nullptr) override;
+
+ void setApplicationBadge(qint64 number);
+ virtual QString portalWindowIdentifier(QWindow *window);
+
+private:
+ QString m_webBrowser;
+ QString m_documentLauncher;
+ bool m_hasScreenshotPortalWithColorPicking = false;
+};
+
+QT_END_NAMESPACE
+
+#endif // QGENERICUNIXDESKTOPSERVICES_H
diff --git a/src/gui/platform/unix/qgenericunixthemes.cpp b/src/gui/platform/unix/qgenericunixthemes.cpp
new file mode 100644
index 0000000000..fc4b2296d2
--- /dev/null
+++ b/src/gui/platform/unix/qgenericunixthemes.cpp
@@ -0,0 +1,1351 @@
+// Copyright (C) 2022 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
+
+#include "qgenericunixthemes_p.h"
+
+#include <QPalette>
+#include <QFont>
+#include <QGuiApplication>
+#include <QDir>
+#include <QFileInfo>
+#include <QFile>
+#include <QDebug>
+#include <QHash>
+#include <QLoggingCategory>
+#include <QVariant>
+#include <QStandardPaths>
+#include <QStringList>
+#if QT_CONFIG(mimetype)
+#include <QMimeDatabase>
+#endif
+#if QT_CONFIG(settings)
+#include <QSettings>
+#endif
+
+#include <qpa/qplatformfontdatabase.h> // lcQpaFonts
+#include <qpa/qplatformintegration.h>
+#include <qpa/qplatformservices.h>
+#include <qpa/qplatformdialoghelper.h>
+#include <qpa/qplatformtheme_p.h>
+
+#include <private/qguiapplication_p.h>
+#ifndef QT_NO_DBUS
+#include <QDBusConnectionInterface>
+#include <private/qdbusplatformmenu_p.h>
+#include <private/qdbusmenubar_p.h>
+#include <private/qflatmap_p.h>
+#include <QJsonDocument>
+#include <QJsonArray>
+#include <QJsonObject>
+#include <QJsonValue>
+#include <QJsonParseError>
+#endif
+#if !defined(QT_NO_DBUS) && !defined(QT_NO_SYSTEMTRAYICON)
+#include <private/qdbustrayicon_p.h>
+#endif
+
+#include <algorithm>
+
+QT_BEGIN_NAMESPACE
+#ifndef QT_NO_DBUS
+Q_LOGGING_CATEGORY(lcQpaThemeDBus, "qt.qpa.theme.dbus")
+#endif
+
+using namespace Qt::StringLiterals;
+
+Q_DECLARE_LOGGING_CATEGORY(qLcTray)
+
+ResourceHelper::ResourceHelper()
+{
+ std::fill(palettes, palettes + QPlatformTheme::NPalettes, static_cast<QPalette *>(nullptr));
+ std::fill(fonts, fonts + QPlatformTheme::NFonts, static_cast<QFont *>(nullptr));
+}
+
+void ResourceHelper::clear()
+{
+ qDeleteAll(palettes, palettes + QPlatformTheme::NPalettes);
+ qDeleteAll(fonts, fonts + QPlatformTheme::NFonts);
+ std::fill(palettes, palettes + QPlatformTheme::NPalettes, static_cast<QPalette *>(nullptr));
+ std::fill(fonts, fonts + QPlatformTheme::NFonts, static_cast<QFont *>(nullptr));
+}
+
+const char *QGenericUnixTheme::name = "generic";
+
+// Default system font, corresponding to the value returned by 4.8 for
+// XRender/FontConfig which we can now assume as default.
+static const char defaultSystemFontNameC[] = "Sans Serif";
+static const char defaultFixedFontNameC[] = "monospace";
+enum { defaultSystemFontSize = 9 };
+
+#if !defined(QT_NO_DBUS) && !defined(QT_NO_SYSTEMTRAYICON)
+static bool isDBusTrayAvailable() {
+ static bool dbusTrayAvailable = false;
+ static bool dbusTrayAvailableKnown = false;
+ if (!dbusTrayAvailableKnown) {
+ QDBusMenuConnection conn;
+ if (conn.isWatcherRegistered())
+ dbusTrayAvailable = true;
+ dbusTrayAvailableKnown = true;
+ qCDebug(qLcTray) << "D-Bus tray available:" << dbusTrayAvailable;
+ }
+ return dbusTrayAvailable;
+}
+#endif
+
+static QString mouseCursorTheme()
+{
+ static QString themeName = qEnvironmentVariable("XCURSOR_THEME");
+ return themeName;
+}
+
+static QSize mouseCursorSize()
+{
+ constexpr int defaultCursorSize = 24;
+ static const int xCursorSize = qEnvironmentVariableIntValue("XCURSOR_SIZE");
+ static const int s = xCursorSize > 0 ? xCursorSize : defaultCursorSize;
+ return QSize(s, s);
+}
+
+#ifndef QT_NO_DBUS
+static bool checkDBusGlobalMenuAvailable()
+{
+ const QDBusConnection connection = QDBusConnection::sessionBus();
+ static const QString registrarService = QStringLiteral("com.canonical.AppMenu.Registrar");
+ if (const auto iface = connection.interface())
+ return iface->isServiceRegistered(registrarService);
+ return false;
+}
+
+static bool isDBusGlobalMenuAvailable()
+{
+ static bool dbusGlobalMenuAvailable = checkDBusGlobalMenuAvailable();
+ return dbusGlobalMenuAvailable;
+}
+
+/*!
+ * \internal
+ * The QGenericUnixThemeDBusListener class listens to the SettingChanged DBus signal
+ * and translates it into combinations of the enums \c Provider and \c Setting.
+ * Upon construction, it logs success/failure of the DBus connection.
+ *
+ * The signal settingChanged delivers the normalized setting type and the new value as a string.
+ * It is emitted on known setting types only.
+ */
+
+class QGenericUnixThemeDBusListener : public QObject
+{
+ Q_OBJECT
+
+public:
+
+ enum class Provider {
+ Kde,
+ Gtk,
+ Gnome,
+ };
+ Q_ENUM(Provider)
+
+ enum class Setting {
+ Theme,
+ ApplicationStyle,
+ ColorScheme,
+ };
+ Q_ENUM(Setting)
+
+ QGenericUnixThemeDBusListener();
+ QGenericUnixThemeDBusListener(const QString &service, const QString &path,
+ const QString &interface, const QString &signal);
+
+private Q_SLOTS:
+ void onSettingChanged(const QString &location, const QString &key, const QDBusVariant &value);
+
+Q_SIGNALS:
+ void settingChanged(QGenericUnixThemeDBusListener::Provider provider,
+ QGenericUnixThemeDBusListener::Setting setting,
+ const QString &value);
+
+private:
+ struct DBusKey
+ {
+ QString location;
+ QString key;
+ DBusKey(const QString &loc, const QString &k) : location(loc), key(k) {};
+ bool operator<(const DBusKey &other) const
+ {
+ return location + key < other.location + other.key;
+ }
+ };
+
+ struct ChangeSignal
+ {
+ Provider provider;
+ Setting setting;
+ ChangeSignal(Provider p, Setting s) : provider(p), setting(s) {}
+ ChangeSignal() {}
+ };
+
+ // Json keys
+ static constexpr QLatin1StringView s_dbusLocation = QLatin1StringView("DBusLocation");
+ static constexpr QLatin1StringView s_dbusKey = QLatin1StringView("DBusKey");
+ static constexpr QLatin1StringView s_provider = QLatin1StringView("Provider");
+ static constexpr QLatin1StringView s_setting = QLatin1StringView("Setting");
+ static constexpr QLatin1StringView s_signals = QLatin1StringView("DbusSignals");
+ static constexpr QLatin1StringView s_root = QLatin1StringView("Qt.qpa.DBusSignals");
+
+ QFlatMap <DBusKey, ChangeSignal> m_signalMap;
+
+ void init(const QString &service, const QString &path,
+ const QString &interface, const QString &signal);
+
+ std::optional<ChangeSignal> findSignal(const QString &location, const QString &key) const;
+ void populateSignalMap();
+ void loadJson(const QString &fileName);
+ void saveJson(const QString &fileName) const;
+};
+
+QGenericUnixThemeDBusListener::QGenericUnixThemeDBusListener(const QString &service,
+ const QString &path, const QString &interface, const QString &signal)
+{
+ init (service, path, interface, signal);
+}
+
+QGenericUnixThemeDBusListener::QGenericUnixThemeDBusListener()
+{
+ static constexpr QLatin1StringView service("");
+ static constexpr QLatin1StringView path("/org/freedesktop/portal/desktop");
+ static constexpr QLatin1StringView interface("org.freedesktop.portal.Settings");
+ static constexpr QLatin1StringView signal("SettingChanged");
+
+ init (service, path, interface, signal);
+}
+
+void QGenericUnixThemeDBusListener::init(const QString &service, const QString &path,
+ const QString &interface, const QString &signal)
+{
+ QDBusConnection dbus = QDBusConnection::sessionBus();
+ const bool dBusRunning = dbus.isConnected();
+ bool dBusSignalConnected = false;
+#define LOG service << path << interface << signal;
+
+ if (dBusRunning) {
+ populateSignalMap();
+ qRegisterMetaType<QDBusVariant>();
+ dBusSignalConnected = dbus.connect(service, path, interface, signal, this,
+ SLOT(onSettingChanged(QString,QString,QDBusVariant)));
+ }
+
+ if (dBusSignalConnected) {
+ // Connection successful
+ qCDebug(lcQpaThemeDBus) << LOG;
+ } else {
+ if (dBusRunning) {
+ // DBus running, but connection failed
+ qCWarning(lcQpaThemeDBus) << "DBus connection failed:" << LOG;
+ } else {
+ // DBus not running
+ qCWarning(lcQpaThemeDBus) << "Session DBus not running.";
+ }
+ qCWarning(lcQpaThemeDBus) << "Application will not react to setting changes.\n"
+ << "Check your DBus installation.";
+ }
+#undef LOG
+}
+
+void QGenericUnixThemeDBusListener::loadJson(const QString &fileName)
+{
+ Q_ASSERT(!fileName.isEmpty());
+#define CHECK(cond, warning)\
+ if (!cond) {\
+ qCWarning(lcQpaThemeDBus) << fileName << warning << "Falling back to default.";\
+ return;\
+ }
+
+#define PARSE(var, enumeration, string)\
+ enumeration var;\
+ {\
+ bool success;\
+ const int val = QMetaEnum::fromType<enumeration>().keyToValue(string.toLatin1(), &success);\
+ CHECK(success, "Parse Error: Invalid value" << string << "for" << #var);\
+ var = static_cast<enumeration>(val);\
+ }
+
+ QFile file(fileName);
+ CHECK(file.exists(), fileName << "doesn't exist.");
+ CHECK(file.open(QIODevice::ReadOnly), "could not be opened for reading.");
+
+ QJsonParseError error;
+ QJsonDocument doc = QJsonDocument::fromJson(file.readAll(), &error);
+ CHECK((error.error == QJsonParseError::NoError), error.errorString());
+ CHECK(doc.isObject(), "Parse Error: Expected root object" << s_root);
+
+ const QJsonObject &root = doc.object();
+ CHECK(root.contains(s_root), "Parse Error: Expected root object" << s_root);
+ CHECK(root[s_root][s_signals].isArray(), "Parse Error: Expected array" << s_signals);
+
+ const QJsonArray &sigs = root[s_root][s_signals].toArray();
+ CHECK((sigs.count() > 0), "Parse Error: Found empty array" << s_signals);
+
+ for (auto sig = sigs.constBegin(); sig != sigs.constEnd(); ++sig) {
+ CHECK(sig->isObject(), "Parse Error: Expected object array" << s_signals);
+ const QJsonObject &obj = sig->toObject();
+ CHECK(obj.contains(s_dbusLocation), "Parse Error: Expected key" << s_dbusLocation);
+ CHECK(obj.contains(s_dbusKey), "Parse Error: Expected key" << s_dbusKey);
+ CHECK(obj.contains(s_provider), "Parse Error: Expected key" << s_provider);
+ CHECK(obj.contains(s_setting), "Parse Error: Expected key" << s_setting);
+ const QString &location = obj[s_dbusLocation].toString();
+ const QString &key = obj[s_dbusKey].toString();
+ const QString &providerString = obj[s_provider].toString();
+ const QString &settingString = obj[s_setting].toString();
+ PARSE(provider, Provider, providerString);
+ PARSE(setting, Setting, settingString);
+ const DBusKey dkey(location, key);
+ CHECK (!m_signalMap.contains(dkey), "Duplicate key" << location << key);
+ m_signalMap.insert(dkey, ChangeSignal(provider, setting));
+ }
+#undef PARSE
+#undef CHECK
+
+ if (m_signalMap.count() > 0)
+ qCInfo(lcQpaThemeDBus) << "Successfully imported" << fileName;
+ else
+ qCWarning(lcQpaThemeDBus) << "No data imported from" << fileName << "falling back to default.";
+
+#ifdef QT_DEBUG
+ const int count = m_signalMap.count();
+ if (count == 0)
+ return;
+
+ qCDebug(lcQpaThemeDBus) << "Listening to" << count << "signals:";
+ for (auto it = m_signalMap.constBegin(); it != m_signalMap.constEnd(); ++it) {
+ qDebug() << it.key().key << it.key().location << "mapped to"
+ << it.value().provider << it.value().setting;
+ }
+
+#endif
+}
+
+void QGenericUnixThemeDBusListener::saveJson(const QString &fileName) const
+{
+ Q_ASSERT(!m_signalMap.isEmpty());
+ Q_ASSERT(!fileName.isEmpty());
+ QFile file(fileName);
+ if (!file.open(QIODevice::WriteOnly)) {
+ qCWarning(lcQpaThemeDBus) << fileName << "could not be opened for writing.";
+ return;
+ }
+
+ QJsonArray sigs;
+ for (auto sig = m_signalMap.constBegin(); sig != m_signalMap.constEnd(); ++sig) {
+ const DBusKey &dkey = sig.key();
+ const ChangeSignal &csig = sig.value();
+ QJsonObject obj;
+ obj[s_dbusLocation] = dkey.location;
+ obj[s_dbusKey] = dkey.key;
+ obj[s_provider] = QLatin1StringView(QMetaEnum::fromType<Provider>()
+ .valueToKey(static_cast<int>(csig.provider)));
+ obj[s_setting] = QLatin1StringView(QMetaEnum::fromType<Setting>()
+ .valueToKey(static_cast<int>(csig.setting)));
+ sigs.append(obj);
+ }
+ QJsonObject obj;
+ obj[s_signals] = sigs;
+ QJsonObject root;
+ root[s_root] = obj;
+ QJsonDocument doc(root);
+ file.write(doc.toJson());
+ file.close();
+}
+
+void QGenericUnixThemeDBusListener::populateSignalMap()
+{
+ m_signalMap.clear();
+ const QString &loadJsonFile = qEnvironmentVariable("QT_QPA_DBUS_SIGNALS");
+ if (!loadJsonFile.isEmpty())
+ loadJson(loadJsonFile);
+ if (!m_signalMap.isEmpty())
+ return;
+
+ m_signalMap.insert(DBusKey("org.kde.kdeglobals.KDE"_L1, "widgetStyle"_L1),
+ ChangeSignal(Provider::Kde, Setting::ApplicationStyle));
+
+ m_signalMap.insert(DBusKey("org.kde.kdeglobals.General"_L1, "ColorScheme"_L1),
+ ChangeSignal(Provider::Kde, Setting::Theme));
+
+ m_signalMap.insert(DBusKey("org.gnome.desktop.interface"_L1, "gtk-theme"_L1),
+ ChangeSignal(Provider::Gtk, Setting::Theme));
+
+ m_signalMap.insert(DBusKey("org.freedesktop.appearance"_L1, "color-scheme"_L1),
+ ChangeSignal(Provider::Gnome, Setting::ColorScheme));
+
+ const QString &saveJsonFile = qEnvironmentVariable("QT_QPA_DBUS_SIGNALS_SAVE");
+ if (!saveJsonFile.isEmpty())
+ saveJson(saveJsonFile);
+}
+
+std::optional<QGenericUnixThemeDBusListener::ChangeSignal>
+ QGenericUnixThemeDBusListener::findSignal(const QString &location, const QString &key) const
+{
+ const DBusKey dkey(location, key);
+ std::optional<QGenericUnixThemeDBusListener::ChangeSignal> ret;
+ if (m_signalMap.contains(dkey))
+ ret.emplace(m_signalMap.value(dkey));
+
+ return ret;
+}
+
+void QGenericUnixThemeDBusListener::onSettingChanged(const QString &location, const QString &key, const QDBusVariant &value)
+{
+ auto sig = findSignal(location, key);
+ if (!sig.has_value())
+ return;
+
+ emit settingChanged(sig.value().provider, sig.value().setting, value.variant().toString());
+}
+
+#endif //QT_NO_DBUS
+
+class QGenericUnixThemePrivate : public QPlatformThemePrivate
+{
+public:
+ QGenericUnixThemePrivate()
+ : QPlatformThemePrivate()
+ , systemFont(QLatin1StringView(defaultSystemFontNameC), defaultSystemFontSize)
+ , fixedFont(QLatin1StringView(defaultFixedFontNameC), systemFont.pointSize())
+ {
+ fixedFont.setStyleHint(QFont::TypeWriter);
+ qCDebug(lcQpaFonts) << "default fonts: system" << systemFont << "fixed" << fixedFont;
+ }
+
+ const QFont systemFont;
+ QFont fixedFont;
+};
+
+QGenericUnixTheme::QGenericUnixTheme()
+ : QPlatformTheme(new QGenericUnixThemePrivate())
+{
+}
+
+const QFont *QGenericUnixTheme::font(Font type) const
+{
+ Q_D(const QGenericUnixTheme);
+ switch (type) {
+ case QPlatformTheme::SystemFont:
+ return &d->systemFont;
+ case QPlatformTheme::FixedFont:
+ return &d->fixedFont;
+ default:
+ return nullptr;
+ }
+}
+
+// Helper to return the icon theme paths from XDG.
+QStringList QGenericUnixTheme::xdgIconThemePaths()
+{
+ QStringList paths;
+ // Add home directory first in search path
+ const QFileInfo homeIconDir(QDir::homePath() + "/.icons"_L1);
+ if (homeIconDir.isDir())
+ paths.prepend(homeIconDir.absoluteFilePath());
+
+ paths.append(QStandardPaths::locateAll(QStandardPaths::GenericDataLocation,
+ QStringLiteral("icons"),
+ QStandardPaths::LocateDirectory));
+
+ return paths;
+}
+
+QStringList QGenericUnixTheme::iconFallbackPaths()
+{
+ QStringList paths;
+ const QFileInfo pixmapsIconsDir(QStringLiteral("/usr/share/pixmaps"));
+ if (pixmapsIconsDir.isDir())
+ paths.append(pixmapsIconsDir.absoluteFilePath());
+
+ return paths;
+}
+
+#ifndef QT_NO_DBUS
+QPlatformMenuBar *QGenericUnixTheme::createPlatformMenuBar() const
+{
+ if (isDBusGlobalMenuAvailable())
+ return new QDBusMenuBar();
+ return nullptr;
+}
+#endif
+
+#if !defined(QT_NO_DBUS) && !defined(QT_NO_SYSTEMTRAYICON)
+QPlatformSystemTrayIcon *QGenericUnixTheme::createPlatformSystemTrayIcon() const
+{
+ if (isDBusTrayAvailable())
+ return new QDBusTrayIcon();
+ return nullptr;
+}
+#endif
+
+QVariant QGenericUnixTheme::themeHint(ThemeHint hint) const
+{
+ switch (hint) {
+ case QPlatformTheme::SystemIconFallbackThemeName:
+ return QVariant(QString(QStringLiteral("hicolor")));
+ case QPlatformTheme::IconThemeSearchPaths:
+ return xdgIconThemePaths();
+ case QPlatformTheme::IconFallbackSearchPaths:
+ return iconFallbackPaths();
+ case QPlatformTheme::DialogButtonBoxButtonsHaveIcons:
+ return QVariant(true);
+ case QPlatformTheme::StyleNames: {
+ QStringList styleNames;
+ styleNames << QStringLiteral("Fusion") << QStringLiteral("Windows");
+ return QVariant(styleNames);
+ }
+ case QPlatformTheme::KeyboardScheme:
+ return QVariant(int(X11KeyboardScheme));
+ case QPlatformTheme::UiEffects:
+ return QVariant(int(HoverEffect));
+ case QPlatformTheme::MouseCursorTheme:
+ return QVariant(mouseCursorTheme());
+ case QPlatformTheme::MouseCursorSize:
+ return QVariant(mouseCursorSize());
+ default:
+ break;
+ }
+ return QPlatformTheme::themeHint(hint);
+}
+
+// Helper functions for implementing QPlatformTheme::fileIcon() for XDG icon themes.
+static QList<QSize> availableXdgFileIconSizes()
+{
+ return QIcon::fromTheme(QStringLiteral("inode-directory")).availableSizes();
+}
+
+#if QT_CONFIG(mimetype)
+static QIcon xdgFileIcon(const QFileInfo &fileInfo)
+{
+ QMimeDatabase mimeDatabase;
+ QMimeType mimeType = mimeDatabase.mimeTypeForFile(fileInfo);
+ if (!mimeType.isValid())
+ return QIcon();
+ const QString &iconName = mimeType.iconName();
+ if (!iconName.isEmpty()) {
+ const QIcon icon = QIcon::fromTheme(iconName);
+ if (!icon.isNull())
+ return icon;
+ }
+ const QString &genericIconName = mimeType.genericIconName();
+ return genericIconName.isEmpty() ? QIcon() : QIcon::fromTheme(genericIconName);
+}
+#endif
+
+#if QT_CONFIG(settings)
+class QKdeThemePrivate : public QPlatformThemePrivate
+{
+
+public:
+ QKdeThemePrivate(const QStringList &kdeDirs, int kdeVersion);
+
+ static QString kdeGlobals(const QString &kdeDir, int kdeVersion)
+ {
+ if (kdeVersion > 4)
+ return kdeDir + "/kdeglobals"_L1;
+ return kdeDir + "/share/config/kdeglobals"_L1;
+ }
+
+ void refresh();
+ static QVariant readKdeSetting(const QString &key, const QStringList &kdeDirs, int kdeVersion, QHash<QString, QSettings*> &kdeSettings);
+ static void readKdeSystemPalette(const QStringList &kdeDirs, int kdeVersion, QHash<QString, QSettings*> &kdeSettings, QPalette *pal);
+ static QFont *kdeFont(const QVariant &fontValue);
+ static QStringList kdeIconThemeSearchPaths(const QStringList &kdeDirs);
+
+ const QStringList kdeDirs;
+ const int kdeVersion;
+
+ ResourceHelper resources;
+ QString iconThemeName;
+ QString iconFallbackThemeName;
+ QStringList styleNames;
+ int toolButtonStyle = Qt::ToolButtonTextBesideIcon;
+ int toolBarIconSize = 0;
+ bool singleClick = true;
+ bool showIconsOnPushButtons = true;
+ int wheelScrollLines = 3;
+ int doubleClickInterval = 400;
+ int startDragDist = 10;
+ int startDragTime = 500;
+ int cursorBlinkRate = 1000;
+ Qt::ColorScheme m_colorScheme = Qt::ColorScheme::Unknown;
+ void updateColorScheme(const QString &themeName);
+
+#ifndef QT_NO_DBUS
+private:
+ std::unique_ptr<QGenericUnixThemeDBusListener> dbus;
+ bool initDbus();
+ void settingChangedHandler(QGenericUnixThemeDBusListener::Provider provider,
+ QGenericUnixThemeDBusListener::Setting setting,
+ const QString &value);
+#endif // QT_NO_DBUS
+};
+
+#ifndef QT_NO_DBUS
+void QKdeThemePrivate::settingChangedHandler(QGenericUnixThemeDBusListener::Provider provider,
+ QGenericUnixThemeDBusListener::Setting setting,
+ const QString &value)
+{
+ if (provider != QGenericUnixThemeDBusListener::Provider::Kde)
+ return;
+
+ switch (setting) {
+ case QGenericUnixThemeDBusListener::Setting::ColorScheme:
+ qCDebug(lcQpaThemeDBus) << "KDE color theme changed to:" << value;
+ break;
+ case QGenericUnixThemeDBusListener::Setting::Theme:
+ qCDebug(lcQpaThemeDBus) << "KDE global theme changed to:" << value;
+ break;
+ case QGenericUnixThemeDBusListener::Setting::ApplicationStyle:
+ qCDebug(lcQpaThemeDBus) << "KDE application style changed to:" << value;
+ break;
+ }
+
+ refresh();
+}
+
+bool QKdeThemePrivate::initDbus()
+{
+ dbus.reset(new QGenericUnixThemeDBusListener());
+ Q_ASSERT(dbus);
+
+ // Wrap slot in a lambda to avoid inheriting QKdeThemePrivate from QObject
+ auto wrapper = [this](QGenericUnixThemeDBusListener::Provider provider,
+ QGenericUnixThemeDBusListener::Setting setting,
+ const QString &value) {
+ settingChangedHandler(provider, setting, value);
+ };
+
+ return QObject::connect(dbus.get(), &QGenericUnixThemeDBusListener::settingChanged, dbus.get(), wrapper);
+}
+#endif // QT_NO_DBUS
+
+QKdeThemePrivate::QKdeThemePrivate(const QStringList &kdeDirs, int kdeVersion)
+ : kdeDirs(kdeDirs), kdeVersion(kdeVersion)
+{
+#ifndef QT_NO_DBUS
+ initDbus();
+#endif // QT_NO_DBUS
+}
+
+void QKdeThemePrivate::refresh()
+{
+ resources.clear();
+
+ toolButtonStyle = Qt::ToolButtonTextBesideIcon;
+ toolBarIconSize = 0;
+ styleNames.clear();
+ if (kdeVersion >= 5)
+ styleNames << QStringLiteral("breeze");
+ styleNames << QStringLiteral("Oxygen") << QStringLiteral("Fusion") << QStringLiteral("windows");
+ if (kdeVersion >= 5)
+ iconFallbackThemeName = iconThemeName = QStringLiteral("breeze");
+ else
+ iconFallbackThemeName = iconThemeName = QStringLiteral("oxygen");
+
+ QHash<QString, QSettings*> kdeSettings;
+
+ QPalette systemPalette = QPalette();
+ readKdeSystemPalette(kdeDirs, kdeVersion, kdeSettings, &systemPalette);
+ resources.palettes[QPlatformTheme::SystemPalette] = new QPalette(systemPalette);
+ //## TODO tooltip color
+
+ const QVariant styleValue = readKdeSetting(QStringLiteral("widgetStyle"), kdeDirs, kdeVersion, kdeSettings);
+ if (styleValue.isValid()) {
+ const QString style = styleValue.toString();
+ if (style != styleNames.front())
+ styleNames.push_front(style);
+ }
+
+ const QVariant colorScheme = readKdeSetting(QStringLiteral("ColorScheme"), kdeDirs,
+ kdeVersion, kdeSettings);
+
+ if (colorScheme.isValid())
+ updateColorScheme(colorScheme.toString());
+ else
+ m_colorScheme = Qt::ColorScheme::Unknown;
+
+ const QVariant singleClickValue = readKdeSetting(QStringLiteral("KDE/SingleClick"), kdeDirs, kdeVersion, kdeSettings);
+ if (singleClickValue.isValid())
+ singleClick = singleClickValue.toBool();
+
+ const QVariant showIconsOnPushButtonsValue = readKdeSetting(QStringLiteral("KDE/ShowIconsOnPushButtons"), kdeDirs, kdeVersion, kdeSettings);
+ if (showIconsOnPushButtonsValue.isValid())
+ showIconsOnPushButtons = showIconsOnPushButtonsValue.toBool();
+
+ const QVariant themeValue = readKdeSetting(QStringLiteral("Icons/Theme"), kdeDirs, kdeVersion, kdeSettings);
+ if (themeValue.isValid())
+ iconThemeName = themeValue.toString();
+
+ const QVariant toolBarIconSizeValue = readKdeSetting(QStringLiteral("ToolbarIcons/Size"), kdeDirs, kdeVersion, kdeSettings);
+ if (toolBarIconSizeValue.isValid())
+ toolBarIconSize = toolBarIconSizeValue.toInt();
+
+ const QVariant toolbarStyleValue = readKdeSetting(QStringLiteral("Toolbar style/ToolButtonStyle"), kdeDirs, kdeVersion, kdeSettings);
+ if (toolbarStyleValue.isValid()) {
+ const QString toolBarStyle = toolbarStyleValue.toString();
+ if (toolBarStyle == "TextBesideIcon"_L1)
+ toolButtonStyle = Qt::ToolButtonTextBesideIcon;
+ else if (toolBarStyle == "TextOnly"_L1)
+ toolButtonStyle = Qt::ToolButtonTextOnly;
+ else if (toolBarStyle == "TextUnderIcon"_L1)
+ toolButtonStyle = Qt::ToolButtonTextUnderIcon;
+ }
+
+ const QVariant wheelScrollLinesValue = readKdeSetting(QStringLiteral("KDE/WheelScrollLines"), kdeDirs, kdeVersion, kdeSettings);
+ if (wheelScrollLinesValue.isValid())
+ wheelScrollLines = wheelScrollLinesValue.toInt();
+
+ const QVariant doubleClickIntervalValue = readKdeSetting(QStringLiteral("KDE/DoubleClickInterval"), kdeDirs, kdeVersion, kdeSettings);
+ if (doubleClickIntervalValue.isValid())
+ doubleClickInterval = doubleClickIntervalValue.toInt();
+
+ const QVariant startDragDistValue = readKdeSetting(QStringLiteral("KDE/StartDragDist"), kdeDirs, kdeVersion, kdeSettings);
+ if (startDragDistValue.isValid())
+ startDragDist = startDragDistValue.toInt();
+
+ const QVariant startDragTimeValue = readKdeSetting(QStringLiteral("KDE/StartDragTime"), kdeDirs, kdeVersion, kdeSettings);
+ if (startDragTimeValue.isValid())
+ startDragTime = startDragTimeValue.toInt();
+
+ const QVariant cursorBlinkRateValue = readKdeSetting(QStringLiteral("KDE/CursorBlinkRate"), kdeDirs, kdeVersion, kdeSettings);
+ if (cursorBlinkRateValue.isValid()) {
+ cursorBlinkRate = cursorBlinkRateValue.toInt();
+ cursorBlinkRate = cursorBlinkRate > 0 ? qBound(200, cursorBlinkRate, 2000) : 0;
+ }
+
+ // Read system font, ignore 'smallestReadableFont'
+ if (QFont *systemFont = kdeFont(readKdeSetting(QStringLiteral("font"), kdeDirs, kdeVersion, kdeSettings)))
+ resources.fonts[QPlatformTheme::SystemFont] = systemFont;
+ else
+ resources.fonts[QPlatformTheme::SystemFont] = new QFont(QLatin1StringView(defaultSystemFontNameC), defaultSystemFontSize);
+
+ if (QFont *fixedFont = kdeFont(readKdeSetting(QStringLiteral("fixed"), kdeDirs, kdeVersion, kdeSettings))) {
+ resources.fonts[QPlatformTheme::FixedFont] = fixedFont;
+ } else {
+ fixedFont = new QFont(QLatin1StringView(defaultFixedFontNameC), defaultSystemFontSize);
+ fixedFont->setStyleHint(QFont::TypeWriter);
+ resources.fonts[QPlatformTheme::FixedFont] = fixedFont;
+ }
+
+ if (QFont *menuFont = kdeFont(readKdeSetting(QStringLiteral("menuFont"), kdeDirs, kdeVersion, kdeSettings))) {
+ resources.fonts[QPlatformTheme::MenuFont] = menuFont;
+ resources.fonts[QPlatformTheme::MenuBarFont] = new QFont(*menuFont);
+ }
+
+ if (QFont *toolBarFont = kdeFont(readKdeSetting(QStringLiteral("toolBarFont"), kdeDirs, kdeVersion, kdeSettings)))
+ resources.fonts[QPlatformTheme::ToolButtonFont] = toolBarFont;
+
+ QWindowSystemInterface::handleThemeChange();
+
+ qCDebug(lcQpaFonts) << "default fonts: system" << resources.fonts[QPlatformTheme::SystemFont]
+ << "fixed" << resources.fonts[QPlatformTheme::FixedFont];
+ qDeleteAll(kdeSettings);
+}
+
+QVariant QKdeThemePrivate::readKdeSetting(const QString &key, const QStringList &kdeDirs, int kdeVersion, QHash<QString, QSettings*> &kdeSettings)
+{
+ for (const QString &kdeDir : kdeDirs) {
+ QSettings *settings = kdeSettings.value(kdeDir);
+ if (!settings) {
+ const QString kdeGlobalsPath = kdeGlobals(kdeDir, kdeVersion);
+ if (QFileInfo(kdeGlobalsPath).isReadable()) {
+ settings = new QSettings(kdeGlobalsPath, QSettings::IniFormat);
+ kdeSettings.insert(kdeDir, settings);
+ }
+ }
+ if (settings) {
+ const QVariant value = settings->value(key);
+ if (value.isValid())
+ return value;
+ }
+ }
+ return QVariant();
+}
+
+// Reads the color from the KDE configuration, and store it in the
+// palette with the given color role if found.
+static inline bool kdeColor(QPalette *pal, QPalette::ColorRole role, const QVariant &value)
+{
+ if (!value.isValid())
+ return false;
+ const QStringList values = value.toStringList();
+ if (values.size() != 3)
+ return false;
+ pal->setBrush(role, QColor(values.at(0).toInt(), values.at(1).toInt(), values.at(2).toInt()));
+ return true;
+}
+
+void QKdeThemePrivate::readKdeSystemPalette(const QStringList &kdeDirs, int kdeVersion, QHash<QString, QSettings*> &kdeSettings, QPalette *pal)
+{
+ if (!kdeColor(pal, QPalette::Button, readKdeSetting(QStringLiteral("Colors:Button/BackgroundNormal"), kdeDirs, kdeVersion, kdeSettings))) {
+ // kcolorscheme.cpp: SetDefaultColors
+ const QColor defaultWindowBackground(214, 210, 208);
+ const QColor defaultButtonBackground(223, 220, 217);
+ *pal = QPalette(defaultButtonBackground, defaultWindowBackground);
+ return;
+ }
+
+ kdeColor(pal, QPalette::Window, readKdeSetting(QStringLiteral("Colors:Window/BackgroundNormal"), kdeDirs, kdeVersion, kdeSettings));
+ kdeColor(pal, QPalette::Text, readKdeSetting(QStringLiteral("Colors:View/ForegroundNormal"), kdeDirs, kdeVersion, kdeSettings));
+ kdeColor(pal, QPalette::WindowText, readKdeSetting(QStringLiteral("Colors:Window/ForegroundNormal"), kdeDirs, kdeVersion, kdeSettings));
+ kdeColor(pal, QPalette::Base, readKdeSetting(QStringLiteral("Colors:View/BackgroundNormal"), kdeDirs, kdeVersion, kdeSettings));
+ kdeColor(pal, QPalette::Highlight, readKdeSetting(QStringLiteral("Colors:Selection/BackgroundNormal"), kdeDirs, kdeVersion, kdeSettings));
+ kdeColor(pal, QPalette::HighlightedText, readKdeSetting(QStringLiteral("Colors:Selection/ForegroundNormal"), kdeDirs, kdeVersion, kdeSettings));
+ kdeColor(pal, QPalette::AlternateBase, readKdeSetting(QStringLiteral("Colors:View/BackgroundAlternate"), kdeDirs, kdeVersion, kdeSettings));
+ kdeColor(pal, QPalette::ButtonText, readKdeSetting(QStringLiteral("Colors:Button/ForegroundNormal"), kdeDirs, kdeVersion, kdeSettings));
+ kdeColor(pal, QPalette::Link, readKdeSetting(QStringLiteral("Colors:View/ForegroundLink"), kdeDirs, kdeVersion, kdeSettings));
+ kdeColor(pal, QPalette::LinkVisited, readKdeSetting(QStringLiteral("Colors:View/ForegroundVisited"), kdeDirs, kdeVersion, kdeSettings));
+ kdeColor(pal, QPalette::ToolTipBase, readKdeSetting(QStringLiteral("Colors:Tooltip/BackgroundNormal"), kdeDirs, kdeVersion, kdeSettings));
+ kdeColor(pal, QPalette::ToolTipText, readKdeSetting(QStringLiteral("Colors:Tooltip/ForegroundNormal"), kdeDirs, kdeVersion, kdeSettings));
+
+ // The above code sets _all_ color roles to "normal" colors. In KDE, the disabled
+ // color roles are calculated by applying various effects described in kdeglobals.
+ // We use a bit simpler approach here, similar logic than in qt_palette_from_color().
+ const QColor button = pal->color(QPalette::Button);
+ int h, s, v;
+ button.getHsv(&h, &s, &v);
+
+ const QBrush whiteBrush = QBrush(Qt::white);
+ const QBrush buttonBrush = QBrush(button);
+ const QBrush buttonBrushDark = QBrush(button.darker(v > 128 ? 200 : 50));
+ const QBrush buttonBrushDark150 = QBrush(button.darker(v > 128 ? 150 : 75));
+ const QBrush buttonBrushLight150 = QBrush(button.lighter(v > 128 ? 150 : 75));
+ const QBrush buttonBrushLight = QBrush(button.lighter(v > 128 ? 200 : 50));
+
+ pal->setBrush(QPalette::Disabled, QPalette::WindowText, buttonBrushDark);
+ pal->setBrush(QPalette::Disabled, QPalette::ButtonText, buttonBrushDark);
+ pal->setBrush(QPalette::Disabled, QPalette::Button, buttonBrush);
+ pal->setBrush(QPalette::Disabled, QPalette::Text, buttonBrushDark);
+ pal->setBrush(QPalette::Disabled, QPalette::BrightText, whiteBrush);
+ pal->setBrush(QPalette::Disabled, QPalette::Base, buttonBrush);
+ pal->setBrush(QPalette::Disabled, QPalette::Window, buttonBrush);
+ pal->setBrush(QPalette::Disabled, QPalette::Highlight, buttonBrushDark150);
+ pal->setBrush(QPalette::Disabled, QPalette::HighlightedText, buttonBrushLight150);
+
+ // set calculated colors for all groups
+ pal->setBrush(QPalette::Light, buttonBrushLight);
+ pal->setBrush(QPalette::Midlight, buttonBrushLight150);
+ pal->setBrush(QPalette::Mid, buttonBrushDark150);
+ pal->setBrush(QPalette::Dark, buttonBrushDark);
+}
+
+/*!
+ \class QKdeTheme
+ \brief QKdeTheme is a theme implementation for the KDE desktop (version 4 or higher).
+ \since 5.0
+ \internal
+ \ingroup qpa
+*/
+
+const char *QKdeTheme::name = "kde";
+
+QKdeTheme::QKdeTheme(const QStringList& kdeDirs, int kdeVersion)
+ : QPlatformTheme(new QKdeThemePrivate(kdeDirs,kdeVersion))
+{
+ d_func()->refresh();
+}
+
+QFont *QKdeThemePrivate::kdeFont(const QVariant &fontValue)
+{
+ if (fontValue.isValid()) {
+ // Read font value: Might be a QStringList as KDE stores fonts without quotes.
+ // Also retrieve the family for the constructor since we cannot use the
+ // default constructor of QFont, which accesses QGuiApplication::systemFont()
+ // causing recursion.
+ QString fontDescription;
+ QString fontFamily;
+ if (fontValue.userType() == QMetaType::QStringList) {
+ const QStringList list = fontValue.toStringList();
+ if (!list.isEmpty()) {
+ fontFamily = list.first();
+ fontDescription = list.join(u',');
+ }
+ } else {
+ fontDescription = fontFamily = fontValue.toString();
+ }
+ if (!fontDescription.isEmpty()) {
+ QFont font(fontFamily);
+ if (font.fromString(fontDescription))
+ return new QFont(font);
+ }
+ }
+ return nullptr;
+}
+
+
+QStringList QKdeThemePrivate::kdeIconThemeSearchPaths(const QStringList &kdeDirs)
+{
+ QStringList paths = QGenericUnixTheme::xdgIconThemePaths();
+ const QString iconPath = QStringLiteral("/share/icons");
+ for (const QString &candidate : kdeDirs) {
+ const QFileInfo fi(candidate + iconPath);
+ if (fi.isDir())
+ paths.append(fi.absoluteFilePath());
+ }
+ return paths;
+}
+
+QVariant QKdeTheme::themeHint(QPlatformTheme::ThemeHint hint) const
+{
+ Q_D(const QKdeTheme);
+ switch (hint) {
+ case QPlatformTheme::UseFullScreenForPopupMenu:
+ return QVariant(true);
+ case QPlatformTheme::DialogButtonBoxButtonsHaveIcons:
+ return QVariant(d->showIconsOnPushButtons);
+ case QPlatformTheme::DialogButtonBoxLayout:
+ return QVariant(QPlatformDialogHelper::KdeLayout);
+ case QPlatformTheme::ToolButtonStyle:
+ return QVariant(d->toolButtonStyle);
+ case QPlatformTheme::ToolBarIconSize:
+ return QVariant(d->toolBarIconSize);
+ case QPlatformTheme::SystemIconThemeName:
+ return QVariant(d->iconThemeName);
+ case QPlatformTheme::SystemIconFallbackThemeName:
+ return QVariant(d->iconFallbackThemeName);
+ case QPlatformTheme::IconThemeSearchPaths:
+ return QVariant(d->kdeIconThemeSearchPaths(d->kdeDirs));
+ case QPlatformTheme::IconPixmapSizes:
+ return QVariant::fromValue(availableXdgFileIconSizes());
+ case QPlatformTheme::StyleNames:
+ return QVariant(d->styleNames);
+ case QPlatformTheme::KeyboardScheme:
+ return QVariant(int(KdeKeyboardScheme));
+ case QPlatformTheme::ItemViewActivateItemOnSingleClick:
+ return QVariant(d->singleClick);
+ case QPlatformTheme::WheelScrollLines:
+ return QVariant(d->wheelScrollLines);
+ case QPlatformTheme::MouseDoubleClickInterval:
+ return QVariant(d->doubleClickInterval);
+ case QPlatformTheme::StartDragTime:
+ return QVariant(d->startDragTime);
+ case QPlatformTheme::StartDragDistance:
+ return QVariant(d->startDragDist);
+ case QPlatformTheme::CursorFlashTime:
+ return QVariant(d->cursorBlinkRate);
+ case QPlatformTheme::UiEffects:
+ return QVariant(int(HoverEffect));
+ case QPlatformTheme::MouseCursorTheme:
+ return QVariant(mouseCursorTheme());
+ case QPlatformTheme::MouseCursorSize:
+ return QVariant(mouseCursorSize());
+ default:
+ break;
+ }
+ return QPlatformTheme::themeHint(hint);
+}
+
+QIcon QKdeTheme::fileIcon(const QFileInfo &fileInfo, QPlatformTheme::IconOptions) const
+{
+#if QT_CONFIG(mimetype)
+ return xdgFileIcon(fileInfo);
+#else
+ Q_UNUSED(fileInfo);
+ return QIcon();
+#endif
+}
+
+Qt::ColorScheme QKdeTheme::colorScheme() const
+{
+ return d_func()->m_colorScheme;
+}
+
+/*!
+ \internal
+ \brief QKdeTheme::updateColorScheme - guess and set appearance for unix themes.
+ KDE themes do not have an appearance property.
+ The key words "dark" or "light" should be part of the theme name.
+ This is, however, not a mandatory convention.
+
+ If \param themeName contains a key word, the respective appearance is set.
+ If it doesn't, the appearance is heuristically determined by comparing text and base color
+ of the system palette.
+ */
+void QKdeThemePrivate::updateColorScheme(const QString &themeName)
+{
+ if (themeName.contains(QLatin1StringView("light"), Qt::CaseInsensitive)) {
+ m_colorScheme = Qt::ColorScheme::Light;
+ return;
+ }
+ if (themeName.contains(QLatin1StringView("dark"), Qt::CaseInsensitive)) {
+ m_colorScheme = Qt::ColorScheme::Dark;
+ return;
+ }
+
+ if (systemPalette) {
+ if (systemPalette->text().color().lightness() < systemPalette->base().color().lightness()) {
+ m_colorScheme = Qt::ColorScheme::Light;
+ return;
+ }
+ if (systemPalette->text().color().lightness() > systemPalette->base().color().lightness()) {
+ m_colorScheme = Qt::ColorScheme::Dark;
+ return;
+ }
+ }
+
+ m_colorScheme = Qt::ColorScheme::Unknown;
+}
+
+
+const QPalette *QKdeTheme::palette(Palette type) const
+{
+ Q_D(const QKdeTheme);
+ return d->resources.palettes[type];
+}
+
+const QFont *QKdeTheme::font(Font type) const
+{
+ Q_D(const QKdeTheme);
+ return d->resources.fonts[type];
+}
+
+QPlatformTheme *QKdeTheme::createKdeTheme()
+{
+ const QByteArray kdeVersionBA = qgetenv("KDE_SESSION_VERSION");
+ const int kdeVersion = kdeVersionBA.toInt();
+ if (kdeVersion < 4)
+ return nullptr;
+
+ if (kdeVersion > 4)
+ // Plasma 5 follows XDG spec
+ // but uses the same config file format:
+ return new QKdeTheme(QStandardPaths::standardLocations(QStandardPaths::GenericConfigLocation), kdeVersion);
+
+ // Determine KDE prefixes in the following priority order:
+ // - KDEHOME and KDEDIRS environment variables
+ // - ~/.kde(<version>)
+ // - read prefixes from /etc/kde<version>rc
+ // - fallback to /etc/kde<version>
+
+ QStringList kdeDirs;
+ const QString kdeHomePathVar = QFile::decodeName(qgetenv("KDEHOME"));
+ if (!kdeHomePathVar.isEmpty())
+ kdeDirs += kdeHomePathVar;
+
+ const QString kdeDirsVar = QFile::decodeName(qgetenv("KDEDIRS"));
+ if (!kdeDirsVar.isEmpty())
+ kdeDirs += kdeDirsVar.split(u':', Qt::SkipEmptyParts);
+
+ const QString kdeVersionHomePath = QDir::homePath() + "/.kde"_L1 + QLatin1StringView(kdeVersionBA);
+ if (QFileInfo(kdeVersionHomePath).isDir())
+ kdeDirs += kdeVersionHomePath;
+
+ const QString kdeHomePath = QDir::homePath() + "/.kde"_L1;
+ if (QFileInfo(kdeHomePath).isDir())
+ kdeDirs += kdeHomePath;
+
+ const QString kdeRcPath = "/etc/kde"_L1 + QLatin1StringView(kdeVersionBA) + "rc"_L1;
+ if (QFileInfo(kdeRcPath).isReadable()) {
+ QSettings kdeSettings(kdeRcPath, QSettings::IniFormat);
+ kdeSettings.beginGroup(QStringLiteral("Directories-default"));
+ kdeDirs += kdeSettings.value(QStringLiteral("prefixes")).toStringList();
+ }
+
+ const QString kdeVersionPrefix = "/etc/kde"_L1 + QLatin1StringView(kdeVersionBA);
+ if (QFileInfo(kdeVersionPrefix).isDir())
+ kdeDirs += kdeVersionPrefix;
+
+ kdeDirs.removeDuplicates();
+ if (kdeDirs.isEmpty()) {
+ qWarning("Unable to determine KDE dirs");
+ return nullptr;
+ }
+
+ return new QKdeTheme(kdeDirs, kdeVersion);
+}
+
+#ifndef QT_NO_DBUS
+QPlatformMenuBar *QKdeTheme::createPlatformMenuBar() const
+{
+ if (isDBusGlobalMenuAvailable())
+ return new QDBusMenuBar();
+ return nullptr;
+}
+#endif
+
+#if !defined(QT_NO_DBUS) && !defined(QT_NO_SYSTEMTRAYICON)
+QPlatformSystemTrayIcon *QKdeTheme::createPlatformSystemTrayIcon() const
+{
+ if (isDBusTrayAvailable())
+ return new QDBusTrayIcon();
+ return nullptr;
+}
+#endif
+
+#endif // settings
+
+/*!
+ \class QGnomeTheme
+ \brief QGnomeTheme is a theme implementation for the Gnome desktop.
+ \since 5.0
+ \internal
+ \ingroup qpa
+*/
+
+const char *QGnomeTheme::name = "gnome";
+
+class QGnomeThemePrivate : public QPlatformThemePrivate
+{
+public:
+ QGnomeThemePrivate();
+ ~QGnomeThemePrivate();
+
+ void configureFonts(const QString &gtkFontName) const
+ {
+ Q_ASSERT(!systemFont);
+ const int split = gtkFontName.lastIndexOf(QChar::Space);
+ float size = QStringView{gtkFontName}.mid(split + 1).toFloat();
+ QString fontName = gtkFontName.left(split);
+
+ systemFont = new QFont(fontName, size);
+ fixedFont = new QFont(QLatin1StringView(defaultFixedFontNameC), systemFont->pointSize());
+ fixedFont->setStyleHint(QFont::TypeWriter);
+ qCDebug(lcQpaFonts) << "default fonts: system" << systemFont << "fixed" << fixedFont;
+ }
+
+ mutable QFont *systemFont = nullptr;
+ mutable QFont *fixedFont = nullptr;
+
+#ifndef QT_NO_DBUS
+ Qt::ColorScheme m_colorScheme = Qt::ColorScheme::Unknown;
+private:
+ std::unique_ptr<QGenericUnixThemeDBusListener> dbus;
+ bool initDbus();
+ void updateColorScheme(const QString &themeName);
+#endif // QT_NO_DBUS
+};
+
+QGnomeThemePrivate::QGnomeThemePrivate()
+{
+#ifndef QT_NO_DBUS
+ initDbus();
+#endif // QT_NO_DBUS
+}
+QGnomeThemePrivate::~QGnomeThemePrivate()
+{
+ if (systemFont)
+ delete systemFont;
+ if (fixedFont)
+ delete fixedFont;
+}
+
+#ifndef QT_NO_DBUS
+bool QGnomeThemePrivate::initDbus()
+{
+ dbus.reset(new QGenericUnixThemeDBusListener());
+ Q_ASSERT(dbus);
+
+ // Wrap slot in a lambda to avoid inheriting QGnomeThemePrivate from QObject
+ auto wrapper = [this](QGenericUnixThemeDBusListener::Provider provider,
+ QGenericUnixThemeDBusListener::Setting setting,
+ const QString &value) {
+ if (provider != QGenericUnixThemeDBusListener::Provider::Gnome
+ && provider != QGenericUnixThemeDBusListener::Provider::Gtk) {
+ return;
+ }
+
+ if (setting == QGenericUnixThemeDBusListener::Setting::Theme)
+ updateColorScheme(value);
+ };
+
+ return QObject::connect(dbus.get(), &QGenericUnixThemeDBusListener::settingChanged, dbus.get(), wrapper);
+}
+
+void QGnomeThemePrivate::updateColorScheme(const QString &themeName)
+{
+ const auto oldColorScheme = m_colorScheme;
+ if (themeName.contains(QLatin1StringView("light"), Qt::CaseInsensitive)) {
+ m_colorScheme = Qt::ColorScheme::Light;
+ } else if (themeName.contains(QLatin1StringView("dark"), Qt::CaseInsensitive)) {
+ m_colorScheme = Qt::ColorScheme::Dark;
+ } else {
+ m_colorScheme = Qt::ColorScheme::Unknown;
+ }
+
+ if (oldColorScheme != m_colorScheme)
+ QWindowSystemInterface::handleThemeChange();
+}
+#endif // QT_NO_DBUS
+
+QGnomeTheme::QGnomeTheme()
+ : QPlatformTheme(new QGnomeThemePrivate())
+{
+}
+
+QVariant QGnomeTheme::themeHint(QPlatformTheme::ThemeHint hint) const
+{
+ switch (hint) {
+ case QPlatformTheme::DialogButtonBoxButtonsHaveIcons:
+ return QVariant(true);
+ case QPlatformTheme::DialogButtonBoxLayout:
+ return QVariant(QPlatformDialogHelper::GnomeLayout);
+ case QPlatformTheme::SystemIconThemeName:
+ return QVariant(QStringLiteral("Adwaita"));
+ case QPlatformTheme::SystemIconFallbackThemeName:
+ return QVariant(QStringLiteral("gnome"));
+ case QPlatformTheme::IconThemeSearchPaths:
+ return QVariant(QGenericUnixTheme::xdgIconThemePaths());
+ case QPlatformTheme::IconPixmapSizes:
+ return QVariant::fromValue(availableXdgFileIconSizes());
+ case QPlatformTheme::StyleNames: {
+ QStringList styleNames;
+ styleNames << QStringLiteral("Fusion") << QStringLiteral("windows");
+ return QVariant(styleNames);
+ }
+ case QPlatformTheme::KeyboardScheme:
+ return QVariant(int(GnomeKeyboardScheme));
+ case QPlatformTheme::PasswordMaskCharacter:
+ return QVariant(QChar(0x2022));
+ case QPlatformTheme::UiEffects:
+ return QVariant(int(HoverEffect));
+ case QPlatformTheme::ButtonPressKeys:
+ return QVariant::fromValue(
+ QList<Qt::Key>({ Qt::Key_Space, Qt::Key_Return, Qt::Key_Enter, Qt::Key_Select }));
+ case QPlatformTheme::PreselectFirstFileInDirectory:
+ return true;
+ case QPlatformTheme::MouseCursorTheme:
+ return QVariant(mouseCursorTheme());
+ case QPlatformTheme::MouseCursorSize:
+ return QVariant(mouseCursorSize());
+ default:
+ break;
+ }
+ return QPlatformTheme::themeHint(hint);
+}
+
+QIcon QGnomeTheme::fileIcon(const QFileInfo &fileInfo, QPlatformTheme::IconOptions) const
+{
+#if QT_CONFIG(mimetype)
+ return xdgFileIcon(fileInfo);
+#else
+ Q_UNUSED(fileInfo);
+ return QIcon();
+#endif
+}
+
+const QFont *QGnomeTheme::font(Font type) const
+{
+ Q_D(const QGnomeTheme);
+ if (!d->systemFont)
+ d->configureFonts(gtkFontName());
+ switch (type) {
+ case QPlatformTheme::SystemFont:
+ return d->systemFont;
+ case QPlatformTheme::FixedFont:
+ return d->fixedFont;
+ default:
+ return nullptr;
+ }
+}
+
+QString QGnomeTheme::gtkFontName() const
+{
+ return QStringLiteral("%1 %2").arg(QLatin1StringView(defaultSystemFontNameC)).arg(defaultSystemFontSize);
+}
+
+#ifndef QT_NO_DBUS
+QPlatformMenuBar *QGnomeTheme::createPlatformMenuBar() const
+{
+ if (isDBusGlobalMenuAvailable())
+ return new QDBusMenuBar();
+ return nullptr;
+}
+
+Qt::ColorScheme QGnomeTheme::colorScheme() const
+{
+ return d_func()->m_colorScheme;
+}
+
+#endif
+
+#if !defined(QT_NO_DBUS) && !defined(QT_NO_SYSTEMTRAYICON)
+QPlatformSystemTrayIcon *QGnomeTheme::createPlatformSystemTrayIcon() const
+{
+ if (isDBusTrayAvailable())
+ return new QDBusTrayIcon();
+ return nullptr;
+}
+#endif
+
+QString QGnomeTheme::standardButtonText(int button) const
+{
+ switch (button) {
+ case QPlatformDialogHelper::Ok:
+ return QCoreApplication::translate("QGnomeTheme", "&OK");
+ case QPlatformDialogHelper::Save:
+ return QCoreApplication::translate("QGnomeTheme", "&Save");
+ case QPlatformDialogHelper::Cancel:
+ return QCoreApplication::translate("QGnomeTheme", "&Cancel");
+ case QPlatformDialogHelper::Close:
+ return QCoreApplication::translate("QGnomeTheme", "&Close");
+ case QPlatformDialogHelper::Discard:
+ return QCoreApplication::translate("QGnomeTheme", "Close without Saving");
+ default:
+ break;
+ }
+ return QPlatformTheme::standardButtonText(button);
+}
+
+/*!
+ \brief Creates a UNIX theme according to the detected desktop environment.
+*/
+
+QPlatformTheme *QGenericUnixTheme::createUnixTheme(const QString &name)
+{
+ if (name == QLatin1StringView(QGenericUnixTheme::name))
+ return new QGenericUnixTheme;
+#if QT_CONFIG(settings)
+ if (name == QLatin1StringView(QKdeTheme::name))
+ if (QPlatformTheme *kdeTheme = QKdeTheme::createKdeTheme())
+ return kdeTheme;
+#endif
+ if (name == QLatin1StringView(QGnomeTheme::name))
+ return new QGnomeTheme;
+ return nullptr;
+}
+
+QStringList QGenericUnixTheme::themeNames()
+{
+ QStringList result;
+ if (QGuiApplication::desktopSettingsAware()) {
+ const QByteArray desktopEnvironment = QGuiApplicationPrivate::platformIntegration()->services()->desktopEnvironment();
+ QList<QByteArray> gtkBasedEnvironments;
+ gtkBasedEnvironments << "GNOME"
+ << "X-CINNAMON"
+ << "UNITY"
+ << "MATE"
+ << "XFCE"
+ << "LXDE";
+ const QList<QByteArray> desktopNames = desktopEnvironment.split(':');
+ for (const QByteArray &desktopName : desktopNames) {
+ if (desktopEnvironment == "KDE") {
+#if QT_CONFIG(settings)
+ result.push_back(QLatin1StringView(QKdeTheme::name));
+#endif
+ } else if (gtkBasedEnvironments.contains(desktopName)) {
+ // prefer the GTK3 theme implementation with native dialogs etc.
+ result.push_back(QStringLiteral("gtk3"));
+ // fallback to the generic Gnome theme if loading the GTK3 theme fails
+ result.push_back(QLatin1StringView(QGnomeTheme::name));
+ } else {
+ // unknown, but lowercase the name (our standard practice) and
+ // remove any "x-" prefix
+ QString s = QString::fromLatin1(desktopName.toLower());
+ result.push_back(s.startsWith("x-"_L1) ? s.mid(2) : s);
+ }
+ }
+ } // desktopSettingsAware
+ result.append(QLatin1StringView(QGenericUnixTheme::name));
+ return result;
+}
+
+QT_END_NAMESPACE
+
+#ifndef QT_NO_DBUS
+#include "qgenericunixthemes.moc"
+#endif // QT_NO_DBUS
diff --git a/src/gui/platform/unix/qgenericunixthemes_p.h b/src/gui/platform/unix/qgenericunixthemes_p.h
new file mode 100644
index 0000000000..63b20651e6
--- /dev/null
+++ b/src/gui/platform/unix/qgenericunixthemes_p.h
@@ -0,0 +1,123 @@
+// Copyright (C) 2020 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
+
+#ifndef QGENERICUNIXTHEMES_H
+#define QGENERICUNIXTHEMES_H
+
+//
+// W A R N I N G
+// -------------
+//
+// This file is not part of the Qt API. It exists purely as an
+// implementation detail. This header file may change from version to
+// version without notice, or even be removed.
+//
+// We mean it.
+//
+
+#include <qpa/qplatformtheme.h>
+#include <QtCore/QString>
+#include <QtCore/QStringList>
+#include <QtGui/QFont>
+#include <QtCore/private/qglobal_p.h>
+
+QT_BEGIN_NAMESPACE
+
+class ResourceHelper
+{
+public:
+ ResourceHelper();
+ ~ResourceHelper() { clear(); }
+
+ void clear();
+
+ QPalette *palettes[QPlatformTheme::NPalettes];
+ QFont *fonts[QPlatformTheme::NFonts];
+};
+
+class QGenericUnixThemePrivate;
+
+class Q_GUI_EXPORT QGenericUnixTheme : public QPlatformTheme
+{
+ Q_DECLARE_PRIVATE(QGenericUnixTheme)
+public:
+ QGenericUnixTheme();
+
+ static QPlatformTheme *createUnixTheme(const QString &name);
+ static QStringList themeNames();
+
+ const QFont *font(Font type) const override;
+ QVariant themeHint(ThemeHint hint) const override;
+
+ static QStringList xdgIconThemePaths();
+ static QStringList iconFallbackPaths();
+#ifndef QT_NO_DBUS
+ QPlatformMenuBar *createPlatformMenuBar() const override;
+#endif
+#if !defined(QT_NO_DBUS) && !defined(QT_NO_SYSTEMTRAYICON)
+ QPlatformSystemTrayIcon *createPlatformSystemTrayIcon() const override;
+#endif
+
+ static const char *name;
+};
+
+#if QT_CONFIG(settings)
+class QKdeThemePrivate;
+
+class QKdeTheme : public QPlatformTheme
+{
+ Q_DECLARE_PRIVATE(QKdeTheme)
+public:
+ QKdeTheme(const QStringList& kdeDirs, int kdeVersion);
+
+ static QPlatformTheme *createKdeTheme();
+ QVariant themeHint(ThemeHint hint) const override;
+
+ QIcon fileIcon(const QFileInfo &fileInfo,
+ QPlatformTheme::IconOptions iconOptions = { }) const override;
+
+ const QPalette *palette(Palette type = SystemPalette) const override;
+ Qt::ColorScheme colorScheme() const override;
+
+ const QFont *font(Font type) const override;
+#ifndef QT_NO_DBUS
+ QPlatformMenuBar *createPlatformMenuBar() const override;
+#endif
+#if !defined(QT_NO_DBUS) && !defined(QT_NO_SYSTEMTRAYICON)
+ QPlatformSystemTrayIcon *createPlatformSystemTrayIcon() const override;
+#endif
+
+ static const char *name;
+};
+#endif // settings
+
+class QGnomeThemePrivate;
+
+class Q_GUI_EXPORT QGnomeTheme : public QPlatformTheme
+{
+ Q_DECLARE_PRIVATE(QGnomeTheme)
+public:
+ QGnomeTheme();
+ QVariant themeHint(ThemeHint hint) const override;
+ QIcon fileIcon(const QFileInfo &fileInfo,
+ QPlatformTheme::IconOptions = { }) const override;
+ const QFont *font(Font type) const override;
+ QString standardButtonText(int button) const override;
+
+ virtual QString gtkFontName() const;
+#ifndef QT_NO_DBUS
+ QPlatformMenuBar *createPlatformMenuBar() const override;
+ Qt::ColorScheme colorScheme() const override;
+#endif
+#if !defined(QT_NO_DBUS) && !defined(QT_NO_SYSTEMTRAYICON)
+ QPlatformSystemTrayIcon *createPlatformSystemTrayIcon() const override;
+#endif
+
+ static const char *name;
+};
+
+QPlatformTheme *qt_createUnixTheme();
+
+QT_END_NAMESPACE
+
+#endif // QGENERICUNIXTHEMES_H
diff --git a/src/gui/platform/unix/qtx11extras.cpp b/src/gui/platform/unix/qtx11extras.cpp
new file mode 100644
index 0000000000..ef37518d95
--- /dev/null
+++ b/src/gui/platform/unix/qtx11extras.cpp
@@ -0,0 +1,514 @@
+// Copyright (C) 2021 The Qt Company Ltd.
+// Copyright (C) 2016 Richard Moore <rich@kde.org>
+// Copyright (C) 2016 David Faure <david.faure@kdab.com>
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
+
+#include "qtx11extras_p.h"
+
+#include <qpa/qplatformnativeinterface.h>
+#include <qpa/qplatformwindow.h>
+#include <qpa/qplatformscreen_p.h>
+#include <qpa/qplatformscreen.h>
+#include <qscreen.h>
+#include <qwindow.h>
+#include <qguiapplication.h>
+#include <xcb/xcb.h>
+#include <QtCore/qdebug.h>
+
+QT_BEGIN_NAMESPACE
+
+using namespace Qt::StringLiterals;
+
+static QScreen *findScreenForVirtualDesktop(int virtualDesktopNumber)
+{
+ const auto screens = QGuiApplication::screens();
+ for (QScreen *screen : screens) {
+ auto *qxcbScreen = dynamic_cast<QNativeInterface::Private::QXcbScreen *>(screen->handle());
+ if (qxcbScreen && qxcbScreen->virtualDesktopNumber() == virtualDesktopNumber)
+ return screen;
+ }
+ return nullptr;
+}
+
+/*!
+ \class QX11Info
+ \inmodule QtGui
+ \since 6.2
+ \internal
+
+ \brief Provides information about the X display configuration.
+
+ The class provides two APIs: a set of non-static functions that
+ provide information about a specific widget or pixmap, and a set
+ of static functions that provide the default information for the
+ application.
+
+ \warning This class is only available on X11. For querying
+ per-screen information in a portable way, use QScreen.
+*/
+
+/*!
+ Constructs an empty QX11Info object.
+*/
+QX11Info::QX11Info()
+{
+}
+
+/*!
+ Returns true if the application is currently running on X11.
+
+ \since 6.2
+ */
+bool QX11Info::isPlatformX11()
+{
+ return QGuiApplication::platformName() == "xcb"_L1;
+}
+
+/*!
+ Returns the horizontal resolution of the given \a screen in terms of the
+ number of dots per inch.
+
+ The \a screen argument is an X screen number. Be aware that if
+ the user's system uses Xinerama (as opposed to traditional X11
+ multiscreen), there is only one X screen. Use QScreen to
+ query for information about Xinerama screens.
+
+ \sa appDpiY()
+*/
+int QX11Info::appDpiX(int screen)
+{
+ if (screen == -1) {
+ const QScreen *scr = QGuiApplication::primaryScreen();
+ if (!scr)
+ return 75;
+ return qRound(scr->logicalDotsPerInchX());
+ }
+
+ QScreen *scr = findScreenForVirtualDesktop(screen);
+ if (!scr)
+ return 0;
+
+ return scr->logicalDotsPerInchX();
+}
+
+/*!
+ Returns the vertical resolution of the given \a screen in terms of the
+ number of dots per inch.
+
+ The \a screen argument is an X screen number. Be aware that if
+ the user's system uses Xinerama (as opposed to traditional X11
+ multiscreen), there is only one X screen. Use QScreen to
+ query for information about Xinerama screens.
+
+ \sa appDpiX()
+*/
+int QX11Info::appDpiY(int screen)
+{
+ if (screen == -1) {
+ const QScreen *scr = QGuiApplication::primaryScreen();
+ if (!scr)
+ return 75;
+ return qRound(scr->logicalDotsPerInchY());
+ }
+
+ QScreen *scr = findScreenForVirtualDesktop(screen);
+ if (!scr)
+ return 0;
+
+ return scr->logicalDotsPerInchY();
+}
+
+/*!
+ Returns a handle for the applications root window on the given \a screen.
+
+ The \a screen argument is an X screen number. Be aware that if
+ the user's system uses Xinerama (as opposed to traditional X11
+ multiscreen), there is only one X screen. Use QScreen to
+ query for information about Xinerama screens.
+*/
+quint32 QX11Info::appRootWindow(int screen)
+{
+ if (!qApp)
+ return 0;
+ QPlatformNativeInterface *native = qApp->platformNativeInterface();
+ if (!native)
+ return 0;
+ QScreen *scr = screen == -1 ? QGuiApplication::primaryScreen() : findScreenForVirtualDesktop(screen);
+ if (!scr)
+ return 0;
+ return static_cast<xcb_window_t>(reinterpret_cast<quintptr>(native->nativeResourceForScreen(QByteArrayLiteral("rootwindow"), scr)));
+}
+
+/*!
+ Returns the number of the screen where the application is being
+ displayed.
+
+ This method refers to screens in the original X11 meaning with a
+ different DISPLAY environment variable per screen.
+ This information is only useful if your application needs to know
+ on which X screen it is running.
+
+ In a typical multi-head configuration, multiple physical monitors
+ are combined in one X11 screen. This means this method returns the
+ same number for each of the physical monitors. In such a setup you
+ are interested in the monitor information as provided by the X11
+ RandR extension. This is available through QScreen.
+
+ \sa display()
+*/
+int QX11Info::appScreen()
+{
+ if (!qApp)
+ return 0;
+ QPlatformNativeInterface *native = qApp->platformNativeInterface();
+ if (!native)
+ return 0;
+ return reinterpret_cast<qintptr>(native->nativeResourceForIntegration(QByteArrayLiteral("x11screen")));
+}
+
+/*!
+ Returns the X11 time.
+
+ \sa setAppTime(), appUserTime()
+*/
+quint32 QX11Info::appTime()
+{
+ if (!qApp)
+ return 0;
+ QPlatformNativeInterface *native = qApp->platformNativeInterface();
+ if (!native)
+ return 0;
+ QScreen* screen = QGuiApplication::primaryScreen();
+ return static_cast<xcb_timestamp_t>(reinterpret_cast<quintptr>(native->nativeResourceForScreen("apptime", screen)));
+}
+
+/*!
+ Returns the X11 user time.
+
+ \sa setAppUserTime(), appTime()
+*/
+quint32 QX11Info::appUserTime()
+{
+ if (!qApp)
+ return 0;
+ QPlatformNativeInterface *native = qApp->platformNativeInterface();
+ if (!native)
+ return 0;
+ QScreen* screen = QGuiApplication::primaryScreen();
+ return static_cast<xcb_timestamp_t>(reinterpret_cast<quintptr>(native->nativeResourceForScreen("appusertime", screen)));
+}
+
+/*!
+ Sets the X11 time to the value specified by \a time.
+
+ \sa appTime(), setAppUserTime()
+*/
+void QX11Info::setAppTime(quint32 time)
+{
+ if (!qApp)
+ return;
+ QPlatformNativeInterface *native = qApp->platformNativeInterface();
+ if (!native)
+ return;
+ typedef void (*SetAppTimeFunc)(QScreen *, xcb_timestamp_t);
+ QScreen* screen = QGuiApplication::primaryScreen();
+ SetAppTimeFunc func = reinterpret_cast<SetAppTimeFunc>(reinterpret_cast<void *>(native->nativeResourceFunctionForScreen("setapptime")));
+ if (func)
+ func(screen, time);
+ else
+ qWarning("Internal error: QPA plugin doesn't implement setAppTime");
+}
+
+/*!
+ Sets the X11 user time as specified by \a time.
+
+ \sa appUserTime(), setAppTime()
+*/
+void QX11Info::setAppUserTime(quint32 time)
+{
+ if (!qApp)
+ return;
+ QPlatformNativeInterface *native = qApp->platformNativeInterface();
+ if (!native)
+ return;
+ typedef void (*SetAppUserTimeFunc)(QScreen *, xcb_timestamp_t);
+ QScreen* screen = QGuiApplication::primaryScreen();
+ SetAppUserTimeFunc func = reinterpret_cast<SetAppUserTimeFunc>(reinterpret_cast<void *>(native->nativeResourceFunctionForScreen("setappusertime")));
+ if (func)
+ func(screen, time);
+ else
+ qWarning("Internal error: QPA plugin doesn't implement setAppUserTime");
+}
+
+/*!
+ Fetches the current X11 time stamp from the X Server.
+
+ This method creates a property notify event and blocks till it is
+ received back from the X Server.
+*/
+quint32 QX11Info::getTimestamp()
+{
+ if (!qApp)
+ return 0;
+ QPlatformNativeInterface *native = qApp->platformNativeInterface();
+ if (!native)
+ return 0;
+ QScreen* screen = QGuiApplication::primaryScreen();
+ return static_cast<xcb_timestamp_t>(reinterpret_cast<quintptr>(native->nativeResourceForScreen("gettimestamp", screen)));
+}
+
+/*!
+ Returns the startup ID that will be used for the next window to be shown by this process.
+
+ After the next window is shown, the next startup ID will be empty.
+
+ http://standards.freedesktop.org/startup-notification-spec/startup-notification-latest.txt
+
+ \sa setNextStartupId()
+*/
+QByteArray QX11Info::nextStartupId()
+{
+ if (!qApp)
+ return QByteArray();
+ QPlatformNativeInterface *native = qApp->platformNativeInterface();
+ if (!native)
+ return QByteArray();
+ return static_cast<char *>(native->nativeResourceForIntegration("startupid"));
+}
+
+/*!
+ Sets the next startup ID to \a id.
+
+ This is the startup ID that will be used for the next window to be shown by this process.
+
+ The startup ID of the first window comes from the environment variable DESKTOP_STARTUP_ID.
+ This method is useful for subsequent windows, when the request comes from another process
+ (e.g. via DBus).
+
+ \sa nextStartupId()
+*/
+void QX11Info::setNextStartupId(const QByteArray &id)
+{
+ if (!qApp)
+ return;
+ QPlatformNativeInterface *native = qApp->platformNativeInterface();
+ if (!native)
+ return;
+ typedef void (*SetStartupIdFunc)(const char*);
+ SetStartupIdFunc func = reinterpret_cast<SetStartupIdFunc>(reinterpret_cast<void *>(native->nativeResourceFunctionForIntegration("setstartupid")));
+ if (func)
+ func(id.constData());
+ else
+ qWarning("Internal error: QPA plugin doesn't implement setStartupId");
+}
+
+/*!
+ Returns the default display for the application.
+
+ \sa appScreen()
+*/
+Display *QX11Info::display()
+{
+ if (!qApp)
+ return nullptr;
+ QPlatformNativeInterface *native = qApp->platformNativeInterface();
+ if (!native)
+ return nullptr;
+
+ void *display = native->nativeResourceForIntegration(QByteArray("display"));
+ return reinterpret_cast<Display *>(display);
+}
+
+/*!
+ Returns the default XCB connection for the application.
+
+ \sa display()
+*/
+xcb_connection_t *QX11Info::connection()
+{
+ if (!qApp)
+ return nullptr;
+ QPlatformNativeInterface *native = qApp->platformNativeInterface();
+ if (!native)
+ return nullptr;
+
+ void *connection = native->nativeResourceForIntegration(QByteArray("connection"));
+ return reinterpret_cast<xcb_connection_t *>(connection);
+}
+
+/*!
+ Returns true if there is a compositing manager running for the connection
+ attached to \a screen.
+
+ If \a screen equals -1, the application's primary screen is used.
+*/
+bool QX11Info::isCompositingManagerRunning(int screen)
+{
+ if (!qApp)
+ return false;
+ QPlatformNativeInterface *native = qApp->platformNativeInterface();
+ if (!native)
+ return false;
+
+ QScreen *scr = screen == -1 ? QGuiApplication::primaryScreen() : findScreenForVirtualDesktop(screen);
+ if (!scr) {
+ qWarning() << "isCompositingManagerRunning: Could not find screen number" << screen;
+ return false;
+ }
+
+ return native->nativeResourceForScreen(QByteArray("compositingEnabled"), scr);
+}
+
+/*!
+ Returns a new peeker id or -1 if some internal error has occurred.
+ Each peeker id is associated with an index in the buffered native
+ event queue.
+
+ For more details see QX11Info::PeekOption and peekEventQueue().
+
+ \sa peekEventQueue(), removePeekerId()
+*/
+qint32 QX11Info::generatePeekerId()
+{
+ if (!qApp)
+ return -1;
+ QPlatformNativeInterface *native = qApp->platformNativeInterface();
+ if (!native)
+ return -1;
+
+ typedef qint32 (*GeneratePeekerIdFunc)(void);
+ GeneratePeekerIdFunc generatepeekerid = reinterpret_cast<GeneratePeekerIdFunc>(
+ reinterpret_cast<void *>(native->nativeResourceFunctionForIntegration("generatepeekerid")));
+ if (!generatepeekerid) {
+ qWarning("Internal error: QPA plugin doesn't implement generatePeekerId");
+ return -1;
+ }
+
+ return generatepeekerid();
+}
+
+/*!
+ Removes \a peekerId, which was earlier obtained via generatePeekerId().
+
+ Returns \c true on success or \c false if unknown peeker id was
+ provided or some internal error has occurred.
+
+ \sa generatePeekerId()
+*/
+bool QX11Info::removePeekerId(qint32 peekerId)
+{
+ if (!qApp)
+ return false;
+ QPlatformNativeInterface *native = qApp->platformNativeInterface();
+ if (!native)
+ return false;
+
+ typedef bool (*RemovePeekerIdFunc)(qint32);
+ RemovePeekerIdFunc removePeekerId = reinterpret_cast<RemovePeekerIdFunc>(
+ reinterpret_cast<void *>(native->nativeResourceFunctionForIntegration("removepeekerid")));
+ if (!removePeekerId) {
+ qWarning("Internal error: QPA plugin doesn't implement removePeekerId");
+ return false;
+ }
+
+ return removePeekerId(peekerId);
+}
+
+/*!
+ \enum QX11Info::PeekOption
+ \brief An enum to tune the behavior of QX11Info::peekEventQueue().
+
+ \value PeekDefault
+ Peek from the beginning of the buffered native event queue. A peeker
+ id is optional with PeekDefault. If a peeker id is provided to
+ peekEventQueue() when using PeekDefault, then peeking starts from
+ the beginning of the queue, not from the cached index; thus, this
+ can be used to manually reset a cached index to peek from the start
+ of the queue. When this operation completes, the associated index
+ will be updated to the new position in the queue.
+
+ \value PeekFromCachedIndex
+ QX11Info::peekEventQueue() can optimize the peeking algorithm by
+ skipping events that it already has seen in earlier calls to
+ peekEventQueue(). When control returns to the main event loop,
+ which causes the buffered native event queue to be flushed to Qt's
+ event queue, the cached indices are marked invalid and will be
+ reset on the next access. The same is true if the program
+ explicitly flushes the buffered native event queue by
+ QCoreApplication::processEvents().
+*/
+
+/*!
+ \typedef QX11Info::PeekerCallback
+ Typedef for a pointer to a function with the following signature:
+
+ \code
+ bool (*PeekerCallback)(xcb_generic_event_t *event, void *peekerData);
+ \endcode
+
+ The \a event is a native XCB event.
+ The \a peekerData is a pointer to data, passed in via peekEventQueue().
+
+ Return \c true from this function to stop examining the buffered
+ native event queue or \c false to continue.
+
+ \note A non-capturing lambda can serve as a PeekerCallback.
+*/
+
+/*!
+ \brief Peek into the buffered XCB event queue.
+
+ You can call peekEventQueue() periodically, when your program is busy
+ performing a long-running operation, to peek into the buffered native
+ event queue. The more time the long-running operation blocks the
+ program from returning control to the main event loop, the more
+ events will accumulate in the buffered XCB event queue. Once control
+ returns to the main event loop these events will be flushed to Qt's
+ event queue, which is a separate event queue from the queue this
+ function is peeking into.
+
+ \note It is usually better to run CPU-intensive operations in a
+ non-GUI thread, instead of blocking the main event loop.
+
+ The buffered XCB event queue is populated from a non-GUI thread and
+ therefore might be ahead of the current GUI state. To handle native
+ events as they are processed by the GUI thread, see
+ QAbstractNativeEventFilter::nativeEventFilter().
+
+ The \a peeker is a callback function as documented in PeekerCallback.
+ The \a peekerData can be used to pass in arbitrary data to the \a
+ peeker callback.
+ The \a option is an enum that tunes the behavior of peekEventQueue().
+ The \a peekerId is used to track an index in the queue, for more
+ details see QX11Info::PeekOption. There can be several indices,
+ each tracked individually by a peeker id obtained via generatePeekerId().
+
+ This function returns \c true when the peeker has stopped the event
+ proccesing by returning \c true from the callback. If there were no
+ events in the buffered native event queue to peek at or all the
+ events have been processed by the peeker, this function returns \c
+ false.
+
+ \sa generatePeekerId(), QAbstractNativeEventFilter::nativeEventFilter()
+*/
+bool QX11Info::peekEventQueue(PeekerCallback peeker, void *peekerData, PeekOptions option,
+ qint32 peekerId)
+{
+ if (!peeker || !qApp)
+ return false;
+ QPlatformNativeInterface *native = qApp->platformNativeInterface();
+ if (!native)
+ return false;
+
+ typedef bool (*PeekEventQueueFunc)(PeekerCallback, void *, PeekOptions, qint32);
+ PeekEventQueueFunc peekeventqueue = reinterpret_cast<PeekEventQueueFunc>(
+ reinterpret_cast<void *>(native->nativeResourceFunctionForIntegration("peekeventqueue")));
+ if (!peekeventqueue) {
+ qWarning("Internal error: QPA plugin doesn't implement peekEventQueue");
+ return false;
+ }
+
+ return peekeventqueue(peeker, peekerData, option, peekerId);
+}
+
+QT_END_NAMESPACE
diff --git a/src/gui/platform/unix/qtx11extras_p.h b/src/gui/platform/unix/qtx11extras_p.h
new file mode 100644
index 0000000000..253162f83a
--- /dev/null
+++ b/src/gui/platform/unix/qtx11extras_p.h
@@ -0,0 +1,75 @@
+// Copyright (C) 2021 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
+
+#ifndef QTX11EXTRAS_P_H
+#define QTX11EXTRAS_P_H
+
+//
+// W A R N I N G
+// -------------
+//
+// This file is not part of the Qt API. It exists purely as an
+// implementation detail. This header file may change from version to
+// version without notice, or even be removed.
+//
+// We mean it.
+//
+
+#include <QtGui/qtguiglobal.h>
+#include <QtCore/private/qglobal_p.h>
+
+#include <xcb/xcb.h>
+
+typedef struct _XDisplay Display;
+
+QT_BEGIN_NAMESPACE
+
+class Q_GUI_EXPORT QX11Info
+{
+public:
+ enum PeekOption {
+ PeekDefault = 0,
+ PeekFromCachedIndex = 1
+ };
+ Q_DECLARE_FLAGS(PeekOptions, PeekOption)
+
+ static bool isPlatformX11();
+
+ static int appDpiX(int screen=-1);
+ static int appDpiY(int screen=-1);
+
+ static quint32 appRootWindow(int screen=-1);
+ static int appScreen();
+
+ static quint32 appTime();
+ static quint32 appUserTime();
+
+ static void setAppTime(quint32 time);
+ static void setAppUserTime(quint32 time);
+
+ static quint32 getTimestamp();
+
+ static QByteArray nextStartupId();
+ static void setNextStartupId(const QByteArray &id);
+
+ static Display *display();
+ static xcb_connection_t *connection();
+
+ static bool isCompositingManagerRunning(int screen = -1);
+
+ static qint32 generatePeekerId();
+ static bool removePeekerId(qint32 peekerId);
+ typedef bool (*PeekerCallback)(xcb_generic_event_t *event, void *peekerData);
+ static bool peekEventQueue(PeekerCallback peeker, void *peekerData = nullptr,
+ PeekOptions option = PeekDefault, qint32 peekerId = -1);
+
+private:
+ QX11Info();
+};
+
+Q_DECLARE_OPERATORS_FOR_FLAGS(QX11Info::PeekOptions)
+
+QT_END_NAMESPACE
+
+#endif // QTX11EXTRAS_P_H
+
diff --git a/src/gui/platform/unix/qunixeventdispatcher.cpp b/src/gui/platform/unix/qunixeventdispatcher.cpp
new file mode 100644
index 0000000000..0178b7544e
--- /dev/null
+++ b/src/gui/platform/unix/qunixeventdispatcher.cpp
@@ -0,0 +1,31 @@
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
+
+#include "qplatformdefs.h"
+#include "qcoreapplication.h"
+#include "qunixeventdispatcher_qpa_p.h"
+#include "private/qguiapplication_p.h"
+
+#include <qpa/qwindowsysteminterface.h>
+
+#include <QtCore/QDebug>
+
+QT_BEGIN_NAMESPACE
+
+QT_USE_NAMESPACE
+
+
+QUnixEventDispatcherQPA::QUnixEventDispatcherQPA(QObject *parent)
+ : QEventDispatcherUNIX(parent)
+{ }
+
+QUnixEventDispatcherQPA::~QUnixEventDispatcherQPA()
+{ }
+
+bool QUnixEventDispatcherQPA::processEvents(QEventLoop::ProcessEventsFlags flags)
+{
+ const bool didSendEvents = QEventDispatcherUNIX::processEvents(flags);
+ return QWindowSystemInterface::sendWindowSystemEvents(flags) || didSendEvents;
+}
+
+QT_END_NAMESPACE
diff --git a/src/gui/platform/unix/qunixeventdispatcher_qpa_p.h b/src/gui/platform/unix/qunixeventdispatcher_qpa_p.h
new file mode 100644
index 0000000000..bcae9b5a1c
--- /dev/null
+++ b/src/gui/platform/unix/qunixeventdispatcher_qpa_p.h
@@ -0,0 +1,36 @@
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
+
+#ifndef QUNIXEVENTDISPATCHER_QPA_H
+#define QUNIXEVENTDISPATCHER_QPA_H
+
+//
+// W A R N I N G
+// -------------
+//
+// This file is not part of the Qt API. It exists purely as an
+// implementation detail. This header file may change from version to
+// version without notice, or even be removed.
+//
+// We mean it.
+//
+
+#include <QtGui/qtguiglobal.h>
+#include <QtCore/private/qeventdispatcher_unix_p.h>
+
+QT_BEGIN_NAMESPACE
+
+class Q_GUI_EXPORT QUnixEventDispatcherQPA : public QEventDispatcherUNIX
+{
+ Q_OBJECT
+
+public:
+ explicit QUnixEventDispatcherQPA(QObject *parent = nullptr);
+ ~QUnixEventDispatcherQPA();
+
+ bool processEvents(QEventLoop::ProcessEventsFlags flags) override;
+};
+
+QT_END_NAMESPACE
+
+#endif // QUNIXEVENTDISPATCHER_QPA_H
diff --git a/src/gui/platform/unix/qunixnativeinterface.cpp b/src/gui/platform/unix/qunixnativeinterface.cpp
new file mode 100644
index 0000000000..09561d9ada
--- /dev/null
+++ b/src/gui/platform/unix/qunixnativeinterface.cpp
@@ -0,0 +1,311 @@
+// Copyright (C) 2020 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
+
+#include <QtGui/private/qtguiglobal_p.h>
+
+#if QT_CONFIG(opengl)
+# include <QtGui/private/qopenglcontext_p.h>
+#endif
+#include <QtGui/private/qguiapplication_p.h>
+
+#include <qpa/qplatformopenglcontext.h>
+#include <qpa/qplatformintegration.h>
+#include <qpa/qplatformscreen_p.h>
+#include <qpa/qplatformwindow_p.h>
+
+#include <QtGui/private/qkeymapper_p.h>
+
+QT_BEGIN_NAMESPACE
+
+using namespace QNativeInterface::Private;
+
+#ifndef QT_NO_OPENGL
+
+#if QT_CONFIG(xcb_glx_plugin)
+
+/*!
+ \class QNativeInterface::QGLXContext
+ \since 6.0
+ \brief Native interface to a GLX context.
+
+ Accessed through QOpenGLContext::nativeInterface().
+
+ \inmodule QtGui
+ \inheaderfile QOpenGLContext
+ \ingroup native-interfaces
+ \ingroup native-interfaces-qopenglcontext
+*/
+
+/*!
+ \fn QOpenGLContext *QNativeInterface::QGLXContext::fromNative(GLXContext configBasedContext, QOpenGLContext *shareContext = nullptr)
+
+ \brief Adopts a GLXContext \a configBasedContext created from an FBConfig.
+
+ The context must be created from a framebuffer configuration, using the \c glXCreateNewContext function.
+
+ Ownership of the created QOpenGLContext \a shareContext is transferred to the caller.
+*/
+
+/*!
+ \fn QOpenGLContext *QNativeInterface::QGLXContext::fromNative(GLXContext visualBasedContext, void *visualInfo, QOpenGLContext *shareContext = nullptr)
+
+ \brief Adopts a GLXContext created from an X visual.
+
+ The context must be created from a visual, using the \c glXCreateContext function.
+ The same visual must be passed as a pointer to an \c XVisualInfo struct, in the \a visualInfo argument.
+
+ Ownership of the created QOpenGLContext is transferred to the caller.
+*/
+
+/*!
+ \fn GLXContext QNativeInterface::QGLXContext::nativeContext() const
+
+ \return the underlying GLXContext.
+*/
+
+QT_DEFINE_NATIVE_INTERFACE(QGLXContext);
+QT_DEFINE_PRIVATE_NATIVE_INTERFACE(QGLXIntegration);
+
+QOpenGLContext *QNativeInterface::QGLXContext::fromNative(GLXContext configBasedContext, QOpenGLContext *shareContext)
+{
+ return QGuiApplicationPrivate::platformIntegration()->call<
+ &QGLXIntegration::createOpenGLContext>(configBasedContext, nullptr, shareContext);
+}
+
+QOpenGLContext *QNativeInterface::QGLXContext::fromNative(GLXContext visualBasedContext, void *visualInfo, QOpenGLContext *shareContext)
+{
+ return QGuiApplicationPrivate::platformIntegration()->call<
+ &QGLXIntegration::createOpenGLContext>(visualBasedContext, visualInfo, shareContext);
+}
+#endif // QT_CONFIG(xcb_glx_plugin)
+
+#if QT_CONFIG(egl)
+
+/*!
+ \class QNativeInterface::QEGLContext
+ \since 6.0
+ \brief Native interface to an EGL context.
+
+ Accessed through QOpenGLContext::nativeInterface().
+
+ \inmodule QtGui
+ \inheaderfile QOpenGLContext
+ \ingroup native-interfaces
+ \ingroup native-interfaces-qopenglcontext
+*/
+
+/*!
+ \fn QOpenGLContext *QNativeInterface::QEGLContext::fromNative(EGLContext context, EGLDisplay display, QOpenGLContext *shareContext = nullptr)
+
+ \brief Adopts an EGLContext \a context.
+
+ The same \c EGLDisplay passed to \c eglCreateContext must be passed as the \a display argument.
+
+ Ownership of the created QOpenGLContext \a shareContext is transferred
+ to the caller.
+*/
+
+/*!
+ \fn EGLContext QNativeInterface::QEGLContext::nativeContext() const
+
+ \return the underlying EGLContext.
+*/
+
+/*!
+ \fn EGLConfig QNativeInterface::QEGLContext::config() const
+ \since 6.3
+ \return the EGLConfig associated with the underlying EGLContext.
+*/
+
+/*!
+ \fn EGLDisplay QNativeInterface::QEGLContext::display() const
+ \since 6.3
+ \return the EGLDisplay associated with the underlying EGLContext.
+*/
+
+
+/*!
+ \fn void QNativeInterface::QEGLContext::invalidateContext()
+ \since 6.5
+ \brief Marks the context as invalid
+
+ If this context is used by the Qt Quick scenegraph, this will trigger the
+ SceneGraph to destroy this context and create a new one.
+
+ Similarly to QPlatformWindow::invalidateSurface(),
+ this function can only be expected to have an effect on certain platforms,
+ such as eglfs.
+
+ \sa QOpenGLContext::isValid(), QPlatformWindow::invalidateSurface()
+*/
+
+QT_DEFINE_NATIVE_INTERFACE(QEGLContext);
+QT_DEFINE_PRIVATE_NATIVE_INTERFACE(QEGLIntegration);
+
+QOpenGLContext *QNativeInterface::QEGLContext::fromNative(EGLContext context, EGLDisplay display, QOpenGLContext *shareContext)
+{
+ return QGuiApplicationPrivate::platformIntegration()->call<
+ &QEGLIntegration::createOpenGLContext>(context, display, shareContext);
+}
+#endif // QT_CONFIG(egl)
+
+#endif // QT_NO_OPENGL
+
+#if QT_CONFIG(xcb)
+
+/*!
+ \class QNativeInterface::Private::QXcbScreen
+ \since 6.0
+ \internal
+ \brief Native interface to QPlatformScreen.
+ \inmodule QtGui
+ \ingroup native-interfaces
+*/
+
+QT_DEFINE_PRIVATE_NATIVE_INTERFACE(QXcbScreen);
+
+/*!
+ \class QNativeInterface::Private::QXcbWindow
+ \since 6.0
+ \internal
+ \brief Native interface to QPlatformWindow.
+ \inmodule QtGui
+ \ingroup native-interfaces
+*/
+
+QT_DEFINE_PRIVATE_NATIVE_INTERFACE(QXcbWindow);
+
+/*!
+ \class QNativeInterface::QX11Application
+ \since 6.2
+ \brief Native interface to an X11 application.
+
+ Accessed through QGuiApplication::nativeInterface().
+
+ \inmodule QtGui
+ \inheaderfile QGuiApplication
+ \ingroup native-interfaces
+ \ingroup native-interfaces-qguiapplication
+*/
+
+/*!
+ \fn Display *QNativeInterface::QX11Application::display() const
+
+ \return the X display of the application, for use with Xlib.
+
+ \sa connection()
+*/
+
+/*!
+ \fn xcb_connection_t *QNativeInterface::QX11Application::connection() const
+
+ \return the X connection of the application, for use with XCB.
+
+ \sa display()
+*/
+
+QT_DEFINE_NATIVE_INTERFACE(QX11Application);
+
+#endif // QT_CONFIG(xcb)
+
+#if QT_CONFIG(vsp2)
+QT_DEFINE_PRIVATE_NATIVE_INTERFACE(QVsp2Screen);
+#endif
+
+#ifdef Q_OS_WEBOS
+QT_DEFINE_PRIVATE_NATIVE_INTERFACE(QWebOSScreen);
+#endif
+
+#if QT_CONFIG(evdev)
+
+/*!
+ \class QNativeInterface::Private::QEvdevKeyMapper
+ \since 6.0
+ \internal
+ \brief Native interface to QKeyMapper.
+ \inmodule QtGui
+ \ingroup native-interfaces
+*/
+
+QT_DEFINE_PRIVATE_NATIVE_INTERFACE(QEvdevKeyMapper);
+
+#endif // QT_CONFIG(evdev)
+
+#if QT_CONFIG(wayland)
+
+/*!
+ \class QNativeInterface::QWaylandApplication
+ \inheaderfile QGuiApplication
+ \since 6.5
+ \brief Native interface to a Wayland application.
+
+ Accessed through QGuiApplication::nativeInterface().
+ \inmodule QtGui
+ \ingroup native-interfaces
+ \ingroup native-interfaces-qguiapplication
+*/
+/*!
+ \fn wl_display *QNativeInterface::QWaylandApplication::display() const
+ \return the wl_display that the application is using.
+*/
+/*!
+ \fn wl_compositor *QNativeInterface::QWaylandApplication::compositor() const
+ \return the wl_compositor that the application is using.
+*/
+/*!
+ \fn wl_keyboard *QNativeInterface::QWaylandApplication::keyboard() const
+ \return the wl_keyboard belonging to seat() if available.
+*/
+/*!
+ \fn wl_pointer *QNativeInterface::QWaylandApplication::pointer() const
+ \return the wl_pointer belonging to seat() if available.
+*/
+/*!
+ \fn wl_touch *QNativeInterface::QWaylandApplication::touch() const
+ \return the wl_touch belonging to seat() if available.
+*/
+/*!
+ \fn uint *QNativeInterface::QWaylandApplication::lastInputSerial() const
+ \return the serial of the last input event on any seat.
+*/
+/*!
+ \fn wl_seat *QNativeInterface::QWaylandApplication::lastInputSeat() const
+ \return the seat on which the last input event happened.
+*/
+/*!
+ \fn wl_seat *QNativeInterface::QWaylandApplication::seat() const
+ \return the seat associated with the default input device.
+*/
+
+QT_DEFINE_NATIVE_INTERFACE(QWaylandApplication);
+
+/*!
+ \class QNativeInterface::QWaylandScreen
+ \since 6.7
+ \brief Native interface to a screen on Wayland.
+
+ Accessed through QScreen::nativeInterface().
+ \inmodule QtGui
+ \ingroup native-interfaces
+ \ingroup native-interfaces-qscreen
+*/
+/*!
+ \fn wl_output *QNativeInterface::QWaylandScreen::output() const
+ \return the underlying wl_output of this QScreen.
+*/
+QT_DEFINE_NATIVE_INTERFACE(QWaylandScreen);
+
+/*!
+ \class QNativeInterface::QWaylandWindow
+ \since 6.5
+ \internal
+ \brief Native interface to a Wayland window.
+ \inmodule QtGui
+ \ingroup native-interfaces
+*/
+
+QT_DEFINE_PRIVATE_NATIVE_INTERFACE(QWaylandWindow);
+
+#endif // QT_CONFIG(wayland)
+
+QT_END_NAMESPACE
diff --git a/src/gui/platform/unix/qxkbcommon.cpp b/src/gui/platform/unix/qxkbcommon.cpp
new file mode 100644
index 0000000000..ed29db3005
--- /dev/null
+++ b/src/gui/platform/unix/qxkbcommon.cpp
@@ -0,0 +1,831 @@
+// Copyright (C) 2019 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
+
+#include "qxkbcommon_p.h"
+
+#include <private/qmakearray_p.h>
+
+#include <QtCore/private/qstringiterator_p.h>
+#include <QtCore/qvarlengtharray.h>
+#include <QtCore/QMetaMethod>
+
+#include <QtGui/QKeyEvent>
+#include <QtGui/private/qguiapplication_p.h>
+
+#include <qpa/qplatforminputcontext.h>
+#include <qpa/qplatformintegration.h>
+
+QT_BEGIN_NAMESPACE
+
+static int keysymToQtKey_internal(xkb_keysym_t keysym, Qt::KeyboardModifiers modifiers,
+ xkb_state *state, xkb_keycode_t code,
+ bool superAsMeta, bool hyperAsMeta);
+
+typedef struct xkb2qt
+{
+ unsigned int xkb;
+ unsigned int qt;
+
+ constexpr bool operator <=(const xkb2qt &that) const noexcept
+ {
+ return xkb <= that.xkb;
+ }
+
+ constexpr bool operator <(const xkb2qt &that) const noexcept
+ {
+ return xkb < that.xkb;
+ }
+} xkb2qt_t;
+
+template<std::size_t Xkb, std::size_t Qt>
+struct Xkb2Qt
+{
+ using Type = xkb2qt_t;
+ static constexpr Type data() noexcept { return Type{Xkb, Qt}; }
+};
+
+static constexpr const auto KeyTbl = qMakeArray(
+ QSortedData<
+ // misc keys
+
+ Xkb2Qt<XKB_KEY_Escape, Qt::Key_Escape>,
+ Xkb2Qt<XKB_KEY_Tab, Qt::Key_Tab>,
+ Xkb2Qt<XKB_KEY_ISO_Left_Tab, Qt::Key_Backtab>,
+ Xkb2Qt<XKB_KEY_BackSpace, Qt::Key_Backspace>,
+ Xkb2Qt<XKB_KEY_Return, Qt::Key_Return>,
+ Xkb2Qt<XKB_KEY_Insert, Qt::Key_Insert>,
+ Xkb2Qt<XKB_KEY_Delete, Qt::Key_Delete>,
+ Xkb2Qt<XKB_KEY_Clear, Qt::Key_Delete>,
+ Xkb2Qt<XKB_KEY_Pause, Qt::Key_Pause>,
+ Xkb2Qt<XKB_KEY_Print, Qt::Key_Print>,
+ Xkb2Qt<XKB_KEY_Sys_Req, Qt::Key_SysReq>,
+ Xkb2Qt<0x1005FF60, Qt::Key_SysReq>, // hardcoded Sun SysReq
+ Xkb2Qt<0x1007ff00, Qt::Key_SysReq>, // hardcoded X386 SysReq
+
+ // cursor movement
+
+ Xkb2Qt<XKB_KEY_Home, Qt::Key_Home>,
+ Xkb2Qt<XKB_KEY_End, Qt::Key_End>,
+ Xkb2Qt<XKB_KEY_Left, Qt::Key_Left>,
+ Xkb2Qt<XKB_KEY_Up, Qt::Key_Up>,
+ Xkb2Qt<XKB_KEY_Right, Qt::Key_Right>,
+ Xkb2Qt<XKB_KEY_Down, Qt::Key_Down>,
+ Xkb2Qt<XKB_KEY_Prior, Qt::Key_PageUp>,
+ Xkb2Qt<XKB_KEY_Next, Qt::Key_PageDown>,
+
+ // modifiers
+
+ Xkb2Qt<XKB_KEY_Shift_L, Qt::Key_Shift>,
+ Xkb2Qt<XKB_KEY_Shift_R, Qt::Key_Shift>,
+ Xkb2Qt<XKB_KEY_Shift_Lock, Qt::Key_Shift>,
+ Xkb2Qt<XKB_KEY_Control_L, Qt::Key_Control>,
+ Xkb2Qt<XKB_KEY_Control_R, Qt::Key_Control>,
+ Xkb2Qt<XKB_KEY_Meta_L, Qt::Key_Meta>,
+ Xkb2Qt<XKB_KEY_Meta_R, Qt::Key_Meta>,
+ Xkb2Qt<XKB_KEY_Alt_L, Qt::Key_Alt>,
+ Xkb2Qt<XKB_KEY_Alt_R, Qt::Key_Alt>,
+ Xkb2Qt<XKB_KEY_Caps_Lock, Qt::Key_CapsLock>,
+ Xkb2Qt<XKB_KEY_Num_Lock, Qt::Key_NumLock>,
+ Xkb2Qt<XKB_KEY_Scroll_Lock, Qt::Key_ScrollLock>,
+ Xkb2Qt<XKB_KEY_Super_L, Qt::Key_Super_L>,
+ Xkb2Qt<XKB_KEY_Super_R, Qt::Key_Super_R>,
+ Xkb2Qt<XKB_KEY_Menu, Qt::Key_Menu>,
+ Xkb2Qt<XKB_KEY_Hyper_L, Qt::Key_Hyper_L>,
+ Xkb2Qt<XKB_KEY_Hyper_R, Qt::Key_Hyper_R>,
+ Xkb2Qt<XKB_KEY_Help, Qt::Key_Help>,
+ Xkb2Qt<0x1000FF74, Qt::Key_Backtab>, // hardcoded HP backtab
+ Xkb2Qt<0x1005FF10, Qt::Key_F11>, // hardcoded Sun F36 (labeled F11)
+ Xkb2Qt<0x1005FF11, Qt::Key_F12>, // hardcoded Sun F37 (labeled F12)
+
+ // numeric and function keypad keys
+
+ Xkb2Qt<XKB_KEY_KP_Space, Qt::Key_Space>,
+ Xkb2Qt<XKB_KEY_KP_Tab, Qt::Key_Tab>,
+ Xkb2Qt<XKB_KEY_KP_Enter, Qt::Key_Enter>,
+ Xkb2Qt<XKB_KEY_KP_Home, Qt::Key_Home>,
+ Xkb2Qt<XKB_KEY_KP_Left, Qt::Key_Left>,
+ Xkb2Qt<XKB_KEY_KP_Up, Qt::Key_Up>,
+ Xkb2Qt<XKB_KEY_KP_Right, Qt::Key_Right>,
+ Xkb2Qt<XKB_KEY_KP_Down, Qt::Key_Down>,
+ Xkb2Qt<XKB_KEY_KP_Prior, Qt::Key_PageUp>,
+ Xkb2Qt<XKB_KEY_KP_Next, Qt::Key_PageDown>,
+ Xkb2Qt<XKB_KEY_KP_End, Qt::Key_End>,
+ Xkb2Qt<XKB_KEY_KP_Begin, Qt::Key_Clear>,
+ Xkb2Qt<XKB_KEY_KP_Insert, Qt::Key_Insert>,
+ Xkb2Qt<XKB_KEY_KP_Delete, Qt::Key_Delete>,
+ Xkb2Qt<XKB_KEY_KP_Equal, Qt::Key_Equal>,
+ Xkb2Qt<XKB_KEY_KP_Multiply, Qt::Key_Asterisk>,
+ Xkb2Qt<XKB_KEY_KP_Add, Qt::Key_Plus>,
+ Xkb2Qt<XKB_KEY_KP_Separator, Qt::Key_Comma>,
+ Xkb2Qt<XKB_KEY_KP_Subtract, Qt::Key_Minus>,
+ Xkb2Qt<XKB_KEY_KP_Decimal, Qt::Key_Period>,
+ Xkb2Qt<XKB_KEY_KP_Divide, Qt::Key_Slash>,
+
+ // special non-XF86 function keys
+
+ Xkb2Qt<XKB_KEY_Undo, Qt::Key_Undo>,
+ Xkb2Qt<XKB_KEY_Redo, Qt::Key_Redo>,
+ Xkb2Qt<XKB_KEY_Find, Qt::Key_Find>,
+ Xkb2Qt<XKB_KEY_Cancel, Qt::Key_Cancel>,
+
+ // International input method support keys
+
+ // International & multi-key character composition
+ Xkb2Qt<XKB_KEY_ISO_Level3_Shift, Qt::Key_AltGr>,
+ Xkb2Qt<XKB_KEY_Multi_key, Qt::Key_Multi_key>,
+ Xkb2Qt<XKB_KEY_Codeinput, Qt::Key_Codeinput>,
+ Xkb2Qt<XKB_KEY_SingleCandidate, Qt::Key_SingleCandidate>,
+ Xkb2Qt<XKB_KEY_MultipleCandidate, Qt::Key_MultipleCandidate>,
+ Xkb2Qt<XKB_KEY_PreviousCandidate, Qt::Key_PreviousCandidate>,
+
+ // Misc Functions
+ Xkb2Qt<XKB_KEY_Mode_switch, Qt::Key_Mode_switch>,
+ Xkb2Qt<XKB_KEY_script_switch, Qt::Key_Mode_switch>,
+
+ // Japanese keyboard support
+ Xkb2Qt<XKB_KEY_Kanji, Qt::Key_Kanji>,
+ Xkb2Qt<XKB_KEY_Muhenkan, Qt::Key_Muhenkan>,
+ //Xkb2Qt<XKB_KEY_Henkan_Mode, Qt::Key_Henkan_Mode>,
+ Xkb2Qt<XKB_KEY_Henkan_Mode, Qt::Key_Henkan>,
+ Xkb2Qt<XKB_KEY_Henkan, Qt::Key_Henkan>,
+ Xkb2Qt<XKB_KEY_Romaji, Qt::Key_Romaji>,
+ Xkb2Qt<XKB_KEY_Hiragana, Qt::Key_Hiragana>,
+ Xkb2Qt<XKB_KEY_Katakana, Qt::Key_Katakana>,
+ Xkb2Qt<XKB_KEY_Hiragana_Katakana, Qt::Key_Hiragana_Katakana>,
+ Xkb2Qt<XKB_KEY_Zenkaku, Qt::Key_Zenkaku>,
+ Xkb2Qt<XKB_KEY_Hankaku, Qt::Key_Hankaku>,
+ Xkb2Qt<XKB_KEY_Zenkaku_Hankaku, Qt::Key_Zenkaku_Hankaku>,
+ Xkb2Qt<XKB_KEY_Touroku, Qt::Key_Touroku>,
+ Xkb2Qt<XKB_KEY_Massyo, Qt::Key_Massyo>,
+ Xkb2Qt<XKB_KEY_Kana_Lock, Qt::Key_Kana_Lock>,
+ Xkb2Qt<XKB_KEY_Kana_Shift, Qt::Key_Kana_Shift>,
+ Xkb2Qt<XKB_KEY_Eisu_Shift, Qt::Key_Eisu_Shift>,
+ Xkb2Qt<XKB_KEY_Eisu_toggle, Qt::Key_Eisu_toggle>,
+ //Xkb2Qt<XKB_KEY_Kanji_Bangou, Qt::Key_Kanji_Bangou>,
+ //Xkb2Qt<XKB_KEY_Zen_Koho, Qt::Key_Zen_Koho>,
+ //Xkb2Qt<XKB_KEY_Mae_Koho, Qt::Key_Mae_Koho>,
+ Xkb2Qt<XKB_KEY_Kanji_Bangou, Qt::Key_Codeinput>,
+ Xkb2Qt<XKB_KEY_Zen_Koho, Qt::Key_MultipleCandidate>,
+ Xkb2Qt<XKB_KEY_Mae_Koho, Qt::Key_PreviousCandidate>,
+
+ // Korean keyboard support
+ Xkb2Qt<XKB_KEY_Hangul, Qt::Key_Hangul>,
+ Xkb2Qt<XKB_KEY_Hangul_Start, Qt::Key_Hangul_Start>,
+ Xkb2Qt<XKB_KEY_Hangul_End, Qt::Key_Hangul_End>,
+ Xkb2Qt<XKB_KEY_Hangul_Hanja, Qt::Key_Hangul_Hanja>,
+ Xkb2Qt<XKB_KEY_Hangul_Jamo, Qt::Key_Hangul_Jamo>,
+ Xkb2Qt<XKB_KEY_Hangul_Romaja, Qt::Key_Hangul_Romaja>,
+ //Xkb2Qt<XKB_KEY_Hangul_Codeinput, Qt::Key_Hangul_Codeinput>,
+ Xkb2Qt<XKB_KEY_Hangul_Codeinput, Qt::Key_Codeinput>,
+ Xkb2Qt<XKB_KEY_Hangul_Jeonja, Qt::Key_Hangul_Jeonja>,
+ Xkb2Qt<XKB_KEY_Hangul_Banja, Qt::Key_Hangul_Banja>,
+ Xkb2Qt<XKB_KEY_Hangul_PreHanja, Qt::Key_Hangul_PreHanja>,
+ Xkb2Qt<XKB_KEY_Hangul_PostHanja, Qt::Key_Hangul_PostHanja>,
+ //Xkb2Qt<XKB_KEY_Hangul_SingleCandidate,Qt::Key_Hangul_SingleCandidate>,
+ //Xkb2Qt<XKB_KEY_Hangul_MultipleCandidate,Qt::Key_Hangul_MultipleCandidate>,
+ //Xkb2Qt<XKB_KEY_Hangul_PreviousCandidate,Qt::Key_Hangul_PreviousCandidate>,
+ Xkb2Qt<XKB_KEY_Hangul_SingleCandidate, Qt::Key_SingleCandidate>,
+ Xkb2Qt<XKB_KEY_Hangul_MultipleCandidate,Qt::Key_MultipleCandidate>,
+ Xkb2Qt<XKB_KEY_Hangul_PreviousCandidate,Qt::Key_PreviousCandidate>,
+ Xkb2Qt<XKB_KEY_Hangul_Special, Qt::Key_Hangul_Special>,
+ //Xkb2Qt<XKB_KEY_Hangul_switch, Qt::Key_Hangul_switch>,
+ Xkb2Qt<XKB_KEY_Hangul_switch, Qt::Key_Mode_switch>,
+
+ // dead keys
+ Xkb2Qt<XKB_KEY_dead_grave, Qt::Key_Dead_Grave>,
+ Xkb2Qt<XKB_KEY_dead_acute, Qt::Key_Dead_Acute>,
+ Xkb2Qt<XKB_KEY_dead_circumflex, Qt::Key_Dead_Circumflex>,
+ Xkb2Qt<XKB_KEY_dead_tilde, Qt::Key_Dead_Tilde>,
+ Xkb2Qt<XKB_KEY_dead_macron, Qt::Key_Dead_Macron>,
+ Xkb2Qt<XKB_KEY_dead_breve, Qt::Key_Dead_Breve>,
+ Xkb2Qt<XKB_KEY_dead_abovedot, Qt::Key_Dead_Abovedot>,
+ Xkb2Qt<XKB_KEY_dead_diaeresis, Qt::Key_Dead_Diaeresis>,
+ Xkb2Qt<XKB_KEY_dead_abovering, Qt::Key_Dead_Abovering>,
+ Xkb2Qt<XKB_KEY_dead_doubleacute, Qt::Key_Dead_Doubleacute>,
+ Xkb2Qt<XKB_KEY_dead_caron, Qt::Key_Dead_Caron>,
+ Xkb2Qt<XKB_KEY_dead_cedilla, Qt::Key_Dead_Cedilla>,
+ Xkb2Qt<XKB_KEY_dead_ogonek, Qt::Key_Dead_Ogonek>,
+ Xkb2Qt<XKB_KEY_dead_iota, Qt::Key_Dead_Iota>,
+ Xkb2Qt<XKB_KEY_dead_voiced_sound, Qt::Key_Dead_Voiced_Sound>,
+ Xkb2Qt<XKB_KEY_dead_semivoiced_sound, Qt::Key_Dead_Semivoiced_Sound>,
+ Xkb2Qt<XKB_KEY_dead_belowdot, Qt::Key_Dead_Belowdot>,
+ Xkb2Qt<XKB_KEY_dead_hook, Qt::Key_Dead_Hook>,
+ Xkb2Qt<XKB_KEY_dead_horn, Qt::Key_Dead_Horn>,
+ Xkb2Qt<XKB_KEY_dead_stroke, Qt::Key_Dead_Stroke>,
+ Xkb2Qt<XKB_KEY_dead_abovecomma, Qt::Key_Dead_Abovecomma>,
+ Xkb2Qt<XKB_KEY_dead_abovereversedcomma, Qt::Key_Dead_Abovereversedcomma>,
+ Xkb2Qt<XKB_KEY_dead_doublegrave, Qt::Key_Dead_Doublegrave>,
+ Xkb2Qt<XKB_KEY_dead_belowring, Qt::Key_Dead_Belowring>,
+ Xkb2Qt<XKB_KEY_dead_belowmacron, Qt::Key_Dead_Belowmacron>,
+ Xkb2Qt<XKB_KEY_dead_belowcircumflex, Qt::Key_Dead_Belowcircumflex>,
+ Xkb2Qt<XKB_KEY_dead_belowtilde, Qt::Key_Dead_Belowtilde>,
+ Xkb2Qt<XKB_KEY_dead_belowbreve, Qt::Key_Dead_Belowbreve>,
+ Xkb2Qt<XKB_KEY_dead_belowdiaeresis, Qt::Key_Dead_Belowdiaeresis>,
+ Xkb2Qt<XKB_KEY_dead_invertedbreve, Qt::Key_Dead_Invertedbreve>,
+ Xkb2Qt<XKB_KEY_dead_belowcomma, Qt::Key_Dead_Belowcomma>,
+ Xkb2Qt<XKB_KEY_dead_currency, Qt::Key_Dead_Currency>,
+ Xkb2Qt<XKB_KEY_dead_a, Qt::Key_Dead_a>,
+ Xkb2Qt<XKB_KEY_dead_A, Qt::Key_Dead_A>,
+ Xkb2Qt<XKB_KEY_dead_e, Qt::Key_Dead_e>,
+ Xkb2Qt<XKB_KEY_dead_E, Qt::Key_Dead_E>,
+ Xkb2Qt<XKB_KEY_dead_i, Qt::Key_Dead_i>,
+ Xkb2Qt<XKB_KEY_dead_I, Qt::Key_Dead_I>,
+ Xkb2Qt<XKB_KEY_dead_o, Qt::Key_Dead_o>,
+ Xkb2Qt<XKB_KEY_dead_O, Qt::Key_Dead_O>,
+ Xkb2Qt<XKB_KEY_dead_u, Qt::Key_Dead_u>,
+ Xkb2Qt<XKB_KEY_dead_U, Qt::Key_Dead_U>,
+ Xkb2Qt<XKB_KEY_dead_small_schwa, Qt::Key_Dead_Small_Schwa>,
+ Xkb2Qt<XKB_KEY_dead_capital_schwa, Qt::Key_Dead_Capital_Schwa>,
+ Xkb2Qt<XKB_KEY_dead_greek, Qt::Key_Dead_Greek>,
+/* The following four XKB_KEY_dead keys got removed in libxkbcommon 1.6.0
+ The define check is kind of version check here. */
+#ifdef XKB_KEY_dead_lowline
+ Xkb2Qt<XKB_KEY_dead_lowline, Qt::Key_Dead_Lowline>,
+ Xkb2Qt<XKB_KEY_dead_aboveverticalline, Qt::Key_Dead_Aboveverticalline>,
+ Xkb2Qt<XKB_KEY_dead_belowverticalline, Qt::Key_Dead_Belowverticalline>,
+ Xkb2Qt<XKB_KEY_dead_longsolidusoverlay, Qt::Key_Dead_Longsolidusoverlay>,
+#endif
+
+ // Special keys from X.org - This include multimedia keys,
+ // wireless/bluetooth/uwb keys, special launcher keys, etc.
+ Xkb2Qt<XKB_KEY_XF86Back, Qt::Key_Back>,
+ Xkb2Qt<XKB_KEY_XF86Forward, Qt::Key_Forward>,
+ Xkb2Qt<XKB_KEY_XF86Stop, Qt::Key_Stop>,
+ Xkb2Qt<XKB_KEY_XF86Refresh, Qt::Key_Refresh>,
+ Xkb2Qt<XKB_KEY_XF86Favorites, Qt::Key_Favorites>,
+ Xkb2Qt<XKB_KEY_XF86AudioMedia, Qt::Key_LaunchMedia>,
+ Xkb2Qt<XKB_KEY_XF86OpenURL, Qt::Key_OpenUrl>,
+ Xkb2Qt<XKB_KEY_XF86HomePage, Qt::Key_HomePage>,
+ Xkb2Qt<XKB_KEY_XF86Search, Qt::Key_Search>,
+ Xkb2Qt<XKB_KEY_XF86AudioLowerVolume, Qt::Key_VolumeDown>,
+ Xkb2Qt<XKB_KEY_XF86AudioMute, Qt::Key_VolumeMute>,
+ Xkb2Qt<XKB_KEY_XF86AudioRaiseVolume, Qt::Key_VolumeUp>,
+ Xkb2Qt<XKB_KEY_XF86AudioPlay, Qt::Key_MediaPlay>,
+ Xkb2Qt<XKB_KEY_XF86AudioStop, Qt::Key_MediaStop>,
+ Xkb2Qt<XKB_KEY_XF86AudioPrev, Qt::Key_MediaPrevious>,
+ Xkb2Qt<XKB_KEY_XF86AudioNext, Qt::Key_MediaNext>,
+ Xkb2Qt<XKB_KEY_XF86AudioRecord, Qt::Key_MediaRecord>,
+ Xkb2Qt<XKB_KEY_XF86AudioPause, Qt::Key_MediaPause>,
+ Xkb2Qt<XKB_KEY_XF86Mail, Qt::Key_LaunchMail>,
+ Xkb2Qt<XKB_KEY_XF86MyComputer, Qt::Key_LaunchMedia>,
+ Xkb2Qt<XKB_KEY_XF86Memo, Qt::Key_Memo>,
+ Xkb2Qt<XKB_KEY_XF86ToDoList, Qt::Key_ToDoList>,
+ Xkb2Qt<XKB_KEY_XF86Calendar, Qt::Key_Calendar>,
+ Xkb2Qt<XKB_KEY_XF86PowerDown, Qt::Key_PowerDown>,
+ Xkb2Qt<XKB_KEY_XF86ContrastAdjust, Qt::Key_ContrastAdjust>,
+ Xkb2Qt<XKB_KEY_XF86Standby, Qt::Key_Standby>,
+ Xkb2Qt<XKB_KEY_XF86MonBrightnessUp, Qt::Key_MonBrightnessUp>,
+ Xkb2Qt<XKB_KEY_XF86MonBrightnessDown, Qt::Key_MonBrightnessDown>,
+ Xkb2Qt<XKB_KEY_XF86KbdLightOnOff, Qt::Key_KeyboardLightOnOff>,
+ Xkb2Qt<XKB_KEY_XF86KbdBrightnessUp, Qt::Key_KeyboardBrightnessUp>,
+ Xkb2Qt<XKB_KEY_XF86KbdBrightnessDown, Qt::Key_KeyboardBrightnessDown>,
+ Xkb2Qt<XKB_KEY_XF86PowerOff, Qt::Key_PowerOff>,
+ Xkb2Qt<XKB_KEY_XF86WakeUp, Qt::Key_WakeUp>,
+ Xkb2Qt<XKB_KEY_XF86Eject, Qt::Key_Eject>,
+ Xkb2Qt<XKB_KEY_XF86ScreenSaver, Qt::Key_ScreenSaver>,
+ Xkb2Qt<XKB_KEY_XF86WWW, Qt::Key_WWW>,
+ Xkb2Qt<XKB_KEY_XF86Sleep, Qt::Key_Sleep>,
+ Xkb2Qt<XKB_KEY_XF86LightBulb, Qt::Key_LightBulb>,
+ Xkb2Qt<XKB_KEY_XF86Shop, Qt::Key_Shop>,
+ Xkb2Qt<XKB_KEY_XF86History, Qt::Key_History>,
+ Xkb2Qt<XKB_KEY_XF86AddFavorite, Qt::Key_AddFavorite>,
+ Xkb2Qt<XKB_KEY_XF86HotLinks, Qt::Key_HotLinks>,
+ Xkb2Qt<XKB_KEY_XF86BrightnessAdjust, Qt::Key_BrightnessAdjust>,
+ Xkb2Qt<XKB_KEY_XF86Finance, Qt::Key_Finance>,
+ Xkb2Qt<XKB_KEY_XF86Community, Qt::Key_Community>,
+ Xkb2Qt<XKB_KEY_XF86AudioRewind, Qt::Key_AudioRewind>,
+ Xkb2Qt<XKB_KEY_XF86BackForward, Qt::Key_BackForward>,
+ Xkb2Qt<XKB_KEY_XF86ApplicationLeft, Qt::Key_ApplicationLeft>,
+ Xkb2Qt<XKB_KEY_XF86ApplicationRight, Qt::Key_ApplicationRight>,
+ Xkb2Qt<XKB_KEY_XF86Book, Qt::Key_Book>,
+ Xkb2Qt<XKB_KEY_XF86CD, Qt::Key_CD>,
+ Xkb2Qt<XKB_KEY_XF86Calculater, Qt::Key_Calculator>,
+ Xkb2Qt<XKB_KEY_XF86Calculator, Qt::Key_Calculator>,
+ Xkb2Qt<XKB_KEY_XF86Clear, Qt::Key_Clear>,
+ Xkb2Qt<XKB_KEY_XF86ClearGrab, Qt::Key_ClearGrab>,
+ Xkb2Qt<XKB_KEY_XF86Close, Qt::Key_Close>,
+ Xkb2Qt<XKB_KEY_XF86Copy, Qt::Key_Copy>,
+ Xkb2Qt<XKB_KEY_XF86Cut, Qt::Key_Cut>,
+ Xkb2Qt<XKB_KEY_XF86Display, Qt::Key_Display>,
+ Xkb2Qt<XKB_KEY_XF86DOS, Qt::Key_DOS>,
+ Xkb2Qt<XKB_KEY_XF86Documents, Qt::Key_Documents>,
+ Xkb2Qt<XKB_KEY_XF86Excel, Qt::Key_Excel>,
+ Xkb2Qt<XKB_KEY_XF86Explorer, Qt::Key_Explorer>,
+ Xkb2Qt<XKB_KEY_XF86Game, Qt::Key_Game>,
+ Xkb2Qt<XKB_KEY_XF86Go, Qt::Key_Go>,
+ Xkb2Qt<XKB_KEY_XF86iTouch, Qt::Key_iTouch>,
+ Xkb2Qt<XKB_KEY_XF86LogOff, Qt::Key_LogOff>,
+ Xkb2Qt<XKB_KEY_XF86Market, Qt::Key_Market>,
+ Xkb2Qt<XKB_KEY_XF86Meeting, Qt::Key_Meeting>,
+ Xkb2Qt<XKB_KEY_XF86MenuKB, Qt::Key_MenuKB>,
+ Xkb2Qt<XKB_KEY_XF86MenuPB, Qt::Key_MenuPB>,
+ Xkb2Qt<XKB_KEY_XF86MySites, Qt::Key_MySites>,
+ Xkb2Qt<XKB_KEY_XF86New, Qt::Key_New>,
+ Xkb2Qt<XKB_KEY_XF86News, Qt::Key_News>,
+ Xkb2Qt<XKB_KEY_XF86OfficeHome, Qt::Key_OfficeHome>,
+ Xkb2Qt<XKB_KEY_XF86Open, Qt::Key_Open>,
+ Xkb2Qt<XKB_KEY_XF86Option, Qt::Key_Option>,
+ Xkb2Qt<XKB_KEY_XF86Paste, Qt::Key_Paste>,
+ Xkb2Qt<XKB_KEY_XF86Phone, Qt::Key_Phone>,
+ Xkb2Qt<XKB_KEY_XF86Reply, Qt::Key_Reply>,
+ Xkb2Qt<XKB_KEY_XF86Reload, Qt::Key_Reload>,
+ Xkb2Qt<XKB_KEY_XF86RotateWindows, Qt::Key_RotateWindows>,
+ Xkb2Qt<XKB_KEY_XF86RotationPB, Qt::Key_RotationPB>,
+ Xkb2Qt<XKB_KEY_XF86RotationKB, Qt::Key_RotationKB>,
+ Xkb2Qt<XKB_KEY_XF86Save, Qt::Key_Save>,
+ Xkb2Qt<XKB_KEY_XF86Send, Qt::Key_Send>,
+ Xkb2Qt<XKB_KEY_XF86Spell, Qt::Key_Spell>,
+ Xkb2Qt<XKB_KEY_XF86SplitScreen, Qt::Key_SplitScreen>,
+ Xkb2Qt<XKB_KEY_XF86Support, Qt::Key_Support>,
+ Xkb2Qt<XKB_KEY_XF86TaskPane, Qt::Key_TaskPane>,
+ Xkb2Qt<XKB_KEY_XF86Terminal, Qt::Key_Terminal>,
+ Xkb2Qt<XKB_KEY_XF86Tools, Qt::Key_Tools>,
+ Xkb2Qt<XKB_KEY_XF86Travel, Qt::Key_Travel>,
+ Xkb2Qt<XKB_KEY_XF86Video, Qt::Key_Video>,
+ Xkb2Qt<XKB_KEY_XF86Word, Qt::Key_Word>,
+ Xkb2Qt<XKB_KEY_XF86Xfer, Qt::Key_Xfer>,
+ Xkb2Qt<XKB_KEY_XF86ZoomIn, Qt::Key_ZoomIn>,
+ Xkb2Qt<XKB_KEY_XF86ZoomOut, Qt::Key_ZoomOut>,
+ Xkb2Qt<XKB_KEY_XF86Away, Qt::Key_Away>,
+ Xkb2Qt<XKB_KEY_XF86Messenger, Qt::Key_Messenger>,
+ Xkb2Qt<XKB_KEY_XF86WebCam, Qt::Key_WebCam>,
+ Xkb2Qt<XKB_KEY_XF86MailForward, Qt::Key_MailForward>,
+ Xkb2Qt<XKB_KEY_XF86Pictures, Qt::Key_Pictures>,
+ Xkb2Qt<XKB_KEY_XF86Music, Qt::Key_Music>,
+ Xkb2Qt<XKB_KEY_XF86Battery, Qt::Key_Battery>,
+ Xkb2Qt<XKB_KEY_XF86Bluetooth, Qt::Key_Bluetooth>,
+ Xkb2Qt<XKB_KEY_XF86WLAN, Qt::Key_WLAN>,
+ Xkb2Qt<XKB_KEY_XF86UWB, Qt::Key_UWB>,
+ Xkb2Qt<XKB_KEY_XF86AudioForward, Qt::Key_AudioForward>,
+ Xkb2Qt<XKB_KEY_XF86AudioRepeat, Qt::Key_AudioRepeat>,
+ Xkb2Qt<XKB_KEY_XF86AudioRandomPlay, Qt::Key_AudioRandomPlay>,
+ Xkb2Qt<XKB_KEY_XF86Subtitle, Qt::Key_Subtitle>,
+ Xkb2Qt<XKB_KEY_XF86AudioCycleTrack, Qt::Key_AudioCycleTrack>,
+ Xkb2Qt<XKB_KEY_XF86Time, Qt::Key_Time>,
+ Xkb2Qt<XKB_KEY_XF86Select, Qt::Key_Select>,
+ Xkb2Qt<XKB_KEY_XF86View, Qt::Key_View>,
+ Xkb2Qt<XKB_KEY_XF86TopMenu, Qt::Key_TopMenu>,
+ Xkb2Qt<XKB_KEY_XF86Red, Qt::Key_Red>,
+ Xkb2Qt<XKB_KEY_XF86Green, Qt::Key_Green>,
+ Xkb2Qt<XKB_KEY_XF86Yellow, Qt::Key_Yellow>,
+ Xkb2Qt<XKB_KEY_XF86Blue, Qt::Key_Blue>,
+ Xkb2Qt<XKB_KEY_XF86Bluetooth, Qt::Key_Bluetooth>,
+ Xkb2Qt<XKB_KEY_XF86Suspend, Qt::Key_Suspend>,
+ Xkb2Qt<XKB_KEY_XF86Hibernate, Qt::Key_Hibernate>,
+ Xkb2Qt<XKB_KEY_XF86TouchpadToggle, Qt::Key_TouchpadToggle>,
+ Xkb2Qt<XKB_KEY_XF86TouchpadOn, Qt::Key_TouchpadOn>,
+ Xkb2Qt<XKB_KEY_XF86TouchpadOff, Qt::Key_TouchpadOff>,
+ Xkb2Qt<XKB_KEY_XF86AudioMicMute, Qt::Key_MicMute>,
+ Xkb2Qt<XKB_KEY_XF86Launch0, Qt::Key_Launch0>,
+ Xkb2Qt<XKB_KEY_XF86Launch1, Qt::Key_Launch1>,
+ Xkb2Qt<XKB_KEY_XF86Launch2, Qt::Key_Launch2>,
+ Xkb2Qt<XKB_KEY_XF86Launch3, Qt::Key_Launch3>,
+ Xkb2Qt<XKB_KEY_XF86Launch4, Qt::Key_Launch4>,
+ Xkb2Qt<XKB_KEY_XF86Launch5, Qt::Key_Launch5>,
+ Xkb2Qt<XKB_KEY_XF86Launch6, Qt::Key_Launch6>,
+ Xkb2Qt<XKB_KEY_XF86Launch7, Qt::Key_Launch7>,
+ Xkb2Qt<XKB_KEY_XF86Launch8, Qt::Key_Launch8>,
+ Xkb2Qt<XKB_KEY_XF86Launch9, Qt::Key_Launch9>,
+ Xkb2Qt<XKB_KEY_XF86LaunchA, Qt::Key_LaunchA>,
+ Xkb2Qt<XKB_KEY_XF86LaunchB, Qt::Key_LaunchB>,
+ Xkb2Qt<XKB_KEY_XF86LaunchC, Qt::Key_LaunchC>,
+ Xkb2Qt<XKB_KEY_XF86LaunchD, Qt::Key_LaunchD>,
+ Xkb2Qt<XKB_KEY_XF86LaunchE, Qt::Key_LaunchE>,
+ Xkb2Qt<XKB_KEY_XF86LaunchF, Qt::Key_LaunchF>
+ >::Data{}
+);
+
+xkb_keysym_t QXkbCommon::qxkbcommon_xkb_keysym_to_upper(xkb_keysym_t ks)
+{
+ xkb_keysym_t lower, upper;
+
+ xkbcommon_XConvertCase(ks, &lower, &upper);
+
+ return upper;
+}
+
+QString QXkbCommon::lookupString(struct xkb_state *state, xkb_keycode_t code)
+{
+ QVarLengthArray<char, 32> chars(32);
+ const int size = xkb_state_key_get_utf8(state, code, chars.data(), chars.size());
+ if (Q_UNLIKELY(size + 1 > chars.size())) { // +1 for NUL
+ chars.resize(size + 1);
+ xkb_state_key_get_utf8(state, code, chars.data(), chars.size());
+ }
+ return QString::fromUtf8(chars.constData(), size);
+}
+
+QString QXkbCommon::lookupStringNoKeysymTransformations(xkb_keysym_t keysym)
+{
+ QVarLengthArray<char, 32> chars(32);
+ const int size = xkb_keysym_to_utf8(keysym, chars.data(), chars.size());
+ if (size == 0)
+ return QString(); // the keysym does not have a Unicode representation
+
+ if (Q_UNLIKELY(size > chars.size())) {
+ chars.resize(size);
+ xkb_keysym_to_utf8(keysym, chars.data(), chars.size());
+ }
+ return QString::fromUtf8(chars.constData(), size - 1);
+}
+
+QList<xkb_keysym_t> QXkbCommon::toKeysym(QKeyEvent *event)
+{
+ QList<xkb_keysym_t> keysyms;
+ int qtKey = event->key();
+
+ if (qtKey >= Qt::Key_F1 && qtKey <= Qt::Key_F35) {
+ keysyms.append(XKB_KEY_F1 + (qtKey - Qt::Key_F1));
+ } else if (event->modifiers() & Qt::KeypadModifier) {
+ if (qtKey >= Qt::Key_0 && qtKey <= Qt::Key_9)
+ keysyms.append(XKB_KEY_KP_0 + (qtKey - Qt::Key_0));
+ } else if (isLatin1(qtKey) && event->text().isUpper()) {
+ keysyms.append(qtKey);
+ }
+
+ if (!keysyms.isEmpty())
+ return keysyms;
+
+ // check if we have a direct mapping
+ auto it = std::find_if(KeyTbl.cbegin(), KeyTbl.cend(), [&qtKey](xkb2qt_t elem) {
+ return elem.qt == static_cast<uint>(qtKey);
+ });
+ if (it != KeyTbl.end()) {
+ keysyms.append(it->xkb);
+ return keysyms;
+ }
+
+ QList<uint> ucs4;
+ if (event->text().isEmpty())
+ ucs4.append(qtKey);
+ else
+ ucs4 = event->text().toUcs4();
+
+ // From libxkbcommon keysym-utf.c:
+ // "We allow to represent any UCS character in the range U-00000000 to
+ // U-00FFFFFF by a keysym value in the range 0x01000000 to 0x01ffffff."
+ for (uint utf32 : std::as_const(ucs4))
+ keysyms.append(utf32 | 0x01000000);
+
+ return keysyms;
+}
+
+int QXkbCommon::keysymToQtKey(xkb_keysym_t keysym, Qt::KeyboardModifiers modifiers)
+{
+ return keysymToQtKey(keysym, modifiers, nullptr, 0);
+}
+
+int QXkbCommon::keysymToQtKey(xkb_keysym_t keysym, Qt::KeyboardModifiers modifiers,
+ xkb_state *state, xkb_keycode_t code,
+ bool superAsMeta, bool hyperAsMeta)
+{
+ // Note 1: All standard key sequences on linux (as defined in platform theme)
+ // that use a latin character also contain a control modifier, which is why
+ // checking for Qt::ControlModifier is sufficient here. It is possible to
+ // override QPlatformTheme::keyBindings() and provide custom sequences for
+ // QKeySequence::StandardKey. Custom sequences probably should respect this
+ // convention (alternatively, we could test against other modifiers here).
+ // Note 2: The possibleKeys() shorcut mechanism is not affected by this value
+ // adjustment and does its own thing.
+ if (modifiers & Qt::ControlModifier) {
+ // With standard shortcuts we should prefer a latin character, this is
+ // for checks like "some qkeyevent == QKeySequence::Copy" to work even
+ // when using for example 'russian' keyboard layout.
+ if (!QXkbCommon::isLatin1(keysym)) {
+ xkb_keysym_t latinKeysym = QXkbCommon::lookupLatinKeysym(state, code);
+ if (latinKeysym != XKB_KEY_NoSymbol)
+ keysym = latinKeysym;
+ }
+ }
+
+ return keysymToQtKey_internal(keysym, modifiers, state, code, superAsMeta, hyperAsMeta);
+}
+
+static int keysymToQtKey_internal(xkb_keysym_t keysym, Qt::KeyboardModifiers modifiers,
+ xkb_state *state, xkb_keycode_t code,
+ bool superAsMeta, bool hyperAsMeta)
+{
+ int qtKey = 0;
+
+ // lookup from direct mapping
+ if (keysym >= XKB_KEY_F1 && keysym <= XKB_KEY_F35) {
+ // function keys
+ qtKey = Qt::Key_F1 + (keysym - XKB_KEY_F1);
+ } else if (keysym >= XKB_KEY_KP_0 && keysym <= XKB_KEY_KP_9) {
+ // numeric keypad keys
+ qtKey = Qt::Key_0 + (keysym - XKB_KEY_KP_0);
+ } else if (QXkbCommon::isLatin1(keysym)) {
+ // Most Qt::Key values are determined by their upper-case version,
+ // where this is in the Latin-1 repertoire. So start with that:
+ qtKey = QXkbCommon::qxkbcommon_xkb_keysym_to_upper(keysym);
+ // However, Key_mu and Key_ydiaeresis are U+00B5 MICRO SIGN and
+ // U+00FF LATIN SMALL LETTER Y WITH DIAERESIS, both lower-case,
+ // with upper-case forms outside Latin-1, so use them as they are
+ // since they're the Qt::Key values.
+ if (!QXkbCommon::isLatin1(qtKey))
+ qtKey = keysym;
+ } else {
+ // check if we have a direct mapping
+ xkb2qt_t searchKey{keysym, 0};
+ auto it = std::lower_bound(KeyTbl.cbegin(), KeyTbl.cend(), searchKey);
+ if (it != KeyTbl.end() && !(searchKey < *it))
+ qtKey = it->qt;
+
+ // translate Super/Hyper keys to Meta if we're using them as the MetaModifier
+ if (superAsMeta && (qtKey == Qt::Key_Super_L || qtKey == Qt::Key_Super_R))
+ qtKey = Qt::Key_Meta;
+ if (hyperAsMeta && (qtKey == Qt::Key_Hyper_L || qtKey == Qt::Key_Hyper_R))
+ qtKey = Qt::Key_Meta;
+ }
+
+ if (qtKey)
+ return qtKey;
+
+ // lookup from unicode
+ QString text;
+ if (!state || modifiers & Qt::ControlModifier) {
+ // Control modifier changes the text to ASCII control character, therefore we
+ // can't use this text to map keysym to a qt key. We can use the same keysym
+ // (it is not affectd by transformation) to obtain untransformed text. For details
+ // see "Appendix A. Default Symbol Transformations" in the XKB specification.
+ text = QXkbCommon::lookupStringNoKeysymTransformations(keysym);
+ } else {
+ text = QXkbCommon::lookupString(state, code);
+ }
+ if (!text.isEmpty()) {
+ if (text.unicode()->isDigit()) {
+ // Ensures that also non-latin digits are mapped to corresponding qt keys,
+ // e.g CTRL + ۲ (arabic two), is mapped to CTRL + Qt::Key_2.
+ qtKey = Qt::Key_0 + text.unicode()->digitValue();
+ } else {
+ text = text.toUpper();
+ QStringIterator i(text);
+ qtKey = i.next(0);
+ }
+ }
+
+ return qtKey;
+}
+
+Qt::KeyboardModifiers QXkbCommon::modifiers(struct xkb_state *state, xkb_keysym_t keysym)
+{
+ Qt::KeyboardModifiers modifiers = Qt::NoModifier;
+
+ if (xkb_state_mod_name_is_active(state, XKB_MOD_NAME_CTRL, XKB_STATE_MODS_EFFECTIVE) > 0)
+ modifiers |= Qt::ControlModifier;
+ if (xkb_state_mod_name_is_active(state, XKB_MOD_NAME_ALT, XKB_STATE_MODS_EFFECTIVE) > 0)
+ modifiers |= Qt::AltModifier;
+ if (xkb_state_mod_name_is_active(state, XKB_MOD_NAME_SHIFT, XKB_STATE_MODS_EFFECTIVE) > 0)
+ modifiers |= Qt::ShiftModifier;
+ if (xkb_state_mod_name_is_active(state, XKB_MOD_NAME_LOGO, XKB_STATE_MODS_EFFECTIVE) > 0)
+ modifiers |= Qt::MetaModifier;
+
+ if (isKeypad(keysym))
+ modifiers |= Qt::KeypadModifier;
+
+ return modifiers;
+}
+
+// Possible modifier states.
+static const Qt::KeyboardModifiers ModsTbl[] = {
+ Qt::NoModifier, // 0
+ Qt::ShiftModifier, // 1
+ Qt::ControlModifier, // 2
+ Qt::ControlModifier | Qt::ShiftModifier, // 3
+ Qt::AltModifier, // 4
+ Qt::AltModifier | Qt::ShiftModifier, // 5
+ Qt::AltModifier | Qt::ControlModifier, // 6
+ Qt::AltModifier | Qt::ShiftModifier | Qt::ControlModifier, // 7
+ Qt::NoModifier // Fall-back to raw Key_*, for non-latin1 kb layouts
+};
+
+/*
+ Compatibility until all sub modules have transitioned to new API below
+*/
+QList<int> QXkbCommon::possibleKeys(xkb_state *state, const QKeyEvent *event,
+ bool superAsMeta, bool hyperAsMeta)
+{
+ QList<int> result;
+ auto keyCombinations = possibleKeyCombinations(state, event, superAsMeta, hyperAsMeta);
+ for (auto keyCombination : keyCombinations)
+ result << keyCombination.toCombined();
+
+ return result;
+}
+
+QList<QKeyCombination> QXkbCommon::possibleKeyCombinations(xkb_state *state, const QKeyEvent *event,
+ bool superAsMeta, bool hyperAsMeta)
+{
+ QList<QKeyCombination> result;
+ quint32 keycode = event->nativeScanCode();
+ if (!keycode)
+ return result;
+
+ Qt::KeyboardModifiers modifiers = event->modifiers();
+ xkb_keymap *keymap = xkb_state_get_keymap(state);
+ // turn off the modifier bits which doesn't participate in shortcuts
+ Qt::KeyboardModifiers notNeeded = Qt::KeypadModifier | Qt::GroupSwitchModifier;
+ modifiers &= ~notNeeded;
+ // create a fresh kb state and test against the relevant modifier combinations
+ ScopedXKBState scopedXkbQueryState(xkb_state_new(keymap));
+ xkb_state *queryState = scopedXkbQueryState.get();
+ if (!queryState) {
+ qCWarning(lcQpaKeyMapper) << Q_FUNC_INFO << "failed to compile xkb keymap";
+ return result;
+ }
+ // get kb state from the master state and update the temporary state
+ xkb_layout_index_t lockedLayout = xkb_state_serialize_layout(state, XKB_STATE_LAYOUT_LOCKED);
+ xkb_mod_mask_t latchedMods = xkb_state_serialize_mods(state, XKB_STATE_MODS_LATCHED);
+ xkb_mod_mask_t lockedMods = xkb_state_serialize_mods(state, XKB_STATE_MODS_LOCKED);
+ xkb_mod_mask_t depressedMods = xkb_state_serialize_mods(state, XKB_STATE_MODS_DEPRESSED);
+ xkb_state_update_mask(queryState, depressedMods, latchedMods, lockedMods, 0, 0, lockedLayout);
+ // handle shortcuts for level three and above
+ xkb_layout_index_t layoutIndex = xkb_state_key_get_layout(queryState, keycode);
+ xkb_level_index_t levelIndex = 0;
+ if (layoutIndex != XKB_LAYOUT_INVALID) {
+ levelIndex = xkb_state_key_get_level(queryState, keycode, layoutIndex);
+ if (levelIndex == XKB_LEVEL_INVALID)
+ levelIndex = 0;
+ }
+ if (levelIndex <= 1)
+ xkb_state_update_mask(queryState, 0, latchedMods, lockedMods, 0, 0, lockedLayout);
+
+ xkb_keysym_t sym = xkb_state_key_get_one_sym(queryState, keycode);
+ if (sym == XKB_KEY_NoSymbol)
+ return result;
+
+ int baseQtKey = keysymToQtKey_internal(sym, modifiers, queryState, keycode, superAsMeta, hyperAsMeta);
+ if (baseQtKey)
+ result += QKeyCombination::fromCombined(baseQtKey + int(modifiers));
+
+ xkb_mod_index_t shiftMod = xkb_keymap_mod_get_index(keymap, "Shift");
+ xkb_mod_index_t altMod = xkb_keymap_mod_get_index(keymap, "Alt");
+ xkb_mod_index_t controlMod = xkb_keymap_mod_get_index(keymap, "Control");
+ xkb_mod_index_t metaMod = xkb_keymap_mod_get_index(keymap, "Meta");
+
+ Q_ASSERT(shiftMod < 32);
+ Q_ASSERT(altMod < 32);
+ Q_ASSERT(controlMod < 32);
+
+ xkb_mod_mask_t depressed;
+ int qtKey = 0;
+ // obtain a list of possible shortcuts for the given key event
+ for (uint i = 1; i < sizeof(ModsTbl) / sizeof(*ModsTbl) ; ++i) {
+ Qt::KeyboardModifiers neededMods = ModsTbl[i];
+ if ((modifiers & neededMods) == neededMods) {
+ if (i == 8) {
+ if (isLatin1(baseQtKey))
+ continue;
+ // add a latin key as a fall back key
+ sym = lookupLatinKeysym(state, keycode);
+ } else {
+ depressed = 0;
+ if (neededMods & Qt::AltModifier)
+ depressed |= (1 << altMod);
+ if (neededMods & Qt::ShiftModifier)
+ depressed |= (1 << shiftMod);
+ if (neededMods & Qt::ControlModifier)
+ depressed |= (1 << controlMod);
+ if (metaMod < 32 && neededMods & Qt::MetaModifier)
+ depressed |= (1 << metaMod);
+ xkb_state_update_mask(queryState, depressed, latchedMods, lockedMods, 0, 0, lockedLayout);
+ sym = xkb_state_key_get_one_sym(queryState, keycode);
+ }
+ if (sym == XKB_KEY_NoSymbol)
+ continue;
+
+ Qt::KeyboardModifiers mods = modifiers & ~neededMods;
+ qtKey = keysymToQtKey_internal(sym, mods, queryState, keycode, superAsMeta, hyperAsMeta);
+ if (!qtKey || qtKey == baseQtKey)
+ continue;
+
+ // catch only more specific shortcuts, i.e. Ctrl+Shift+= also generates Ctrl++ and +,
+ // but Ctrl++ is more specific than +, so we should skip the last one
+ bool ambiguous = false;
+ for (auto keyCombination : std::as_const(result)) {
+ if (keyCombination.key() == qtKey
+ && (keyCombination.keyboardModifiers() & mods) == mods) {
+ ambiguous = true;
+ break;
+ }
+ }
+ if (ambiguous)
+ continue;
+
+ result += QKeyCombination::fromCombined(qtKey + int(mods));
+ }
+ }
+
+ return result;
+}
+
+void QXkbCommon::verifyHasLatinLayout(xkb_keymap *keymap)
+{
+ const xkb_layout_index_t layoutCount = xkb_keymap_num_layouts(keymap);
+ const xkb_keycode_t minKeycode = xkb_keymap_min_keycode(keymap);
+ const xkb_keycode_t maxKeycode = xkb_keymap_max_keycode(keymap);
+
+ const xkb_keysym_t *keysyms = nullptr;
+ int nrLatinKeys = 0;
+ for (xkb_layout_index_t layout = 0; layout < layoutCount; ++layout) {
+ for (xkb_keycode_t code = minKeycode; code < maxKeycode; ++code) {
+ xkb_keymap_key_get_syms_by_level(keymap, code, layout, 0, &keysyms);
+ if (keysyms && isLatin1(keysyms[0]))
+ nrLatinKeys++;
+ if (nrLatinKeys > 10) // arbitrarily chosen threshold
+ return;
+ }
+ }
+ // This means that lookupLatinKeysym() will not find anything and latin
+ // key shortcuts might not work. This is a bug in the affected desktop
+ // environment. Usually can be solved via system settings by adding e.g. 'us'
+ // layout to the list of selected layouts, or by using command line, "setxkbmap
+ // -layout rus,en". The position of latin key based layout in the list of the
+ // selected layouts is irrelevant. Properly functioning desktop environments
+ // handle this behind the scenes, even if no latin key based layout has been
+ // explicitly listed in the selected layouts.
+ qCDebug(lcQpaKeyMapper, "no keyboard layouts with latin keys present");
+}
+
+xkb_keysym_t QXkbCommon::lookupLatinKeysym(xkb_state *state, xkb_keycode_t keycode)
+{
+ xkb_layout_index_t layout;
+ xkb_keysym_t sym = XKB_KEY_NoSymbol;
+ if (!state)
+ return sym;
+ xkb_keymap *keymap = xkb_state_get_keymap(state);
+ const xkb_layout_index_t layoutCount = xkb_keymap_num_layouts_for_key(keymap, keycode);
+ const xkb_layout_index_t currentLayout = xkb_state_key_get_layout(state, keycode);
+ // Look at user layouts in the order in which they are defined in system
+ // settings to find a latin keysym.
+ for (layout = 0; layout < layoutCount; ++layout) {
+ if (layout == currentLayout)
+ continue;
+ const xkb_keysym_t *syms = nullptr;
+ xkb_level_index_t level = xkb_state_key_get_level(state, keycode, layout);
+ if (xkb_keymap_key_get_syms_by_level(keymap, keycode, layout, level, &syms) != 1)
+ continue;
+ if (isLatin1(syms[0])) {
+ sym = syms[0];
+ break;
+ }
+ }
+
+ if (sym == XKB_KEY_NoSymbol)
+ return sym;
+
+ xkb_mod_mask_t latchedMods = xkb_state_serialize_mods(state, XKB_STATE_MODS_LATCHED);
+ xkb_mod_mask_t lockedMods = xkb_state_serialize_mods(state, XKB_STATE_MODS_LOCKED);
+
+ // Check for uniqueness, consider the following setup:
+ // setxkbmap -layout us,ru,us -variant dvorak,, -option 'grp:ctrl_alt_toggle' (set 'ru' as active).
+ // In this setup, the user would expect to trigger a ctrl+q shortcut by pressing ctrl+<physical x key>,
+ // because "US dvorak" is higher up in the layout settings list. This check verifies that an obtained
+ // 'sym' can not be acquired by any other layout higher up in the user's layout list. If it can be acquired
+ // then the obtained key is not unique. This prevents ctrl+<physical q key> from generating a ctrl+q
+ // shortcut in the above described setup. We don't want ctrl+<physical x key> and ctrl+<physical q key> to
+ // generate the same shortcut event in this case.
+ const xkb_keycode_t minKeycode = xkb_keymap_min_keycode(keymap);
+ const xkb_keycode_t maxKeycode = xkb_keymap_max_keycode(keymap);
+ ScopedXKBState queryState(xkb_state_new(keymap));
+ for (xkb_layout_index_t prevLayout = 0; prevLayout < layout; ++prevLayout) {
+ xkb_state_update_mask(queryState.get(), 0, latchedMods, lockedMods, 0, 0, prevLayout);
+ for (xkb_keycode_t code = minKeycode; code < maxKeycode; ++code) {
+ xkb_keysym_t prevSym = xkb_state_key_get_one_sym(queryState.get(), code);
+ if (prevSym == sym) {
+ sym = XKB_KEY_NoSymbol;
+ break;
+ }
+ }
+ }
+
+ return sym;
+}
+
+void QXkbCommon::setXkbContext(QPlatformInputContext *inputContext, struct xkb_context *context)
+{
+ if (!inputContext || !context)
+ return;
+
+ const char *const inputContextClassName = "QComposeInputContext";
+ const char *const normalizedSignature = "setXkbContext(xkb_context*)";
+
+ if (inputContext->objectName() != QLatin1StringView(inputContextClassName))
+ return;
+
+ static const QMetaMethod setXkbContext = [&]() {
+ int methodIndex = inputContext->metaObject()->indexOfMethod(normalizedSignature);
+ QMetaMethod method = inputContext->metaObject()->method(methodIndex);
+ Q_ASSERT(method.isValid());
+ if (!method.isValid())
+ qCWarning(lcQpaKeyMapper) << normalizedSignature << "not found on" << inputContextClassName;
+ return method;
+ }();
+
+ if (!setXkbContext.isValid())
+ return;
+
+ setXkbContext.invoke(inputContext, Qt::DirectConnection, Q_ARG(struct xkb_context*, context));
+}
+
+QT_END_NAMESPACE
diff --git a/src/gui/platform/unix/qxkbcommon_3rdparty.cpp b/src/gui/platform/unix/qxkbcommon_3rdparty.cpp
new file mode 100644
index 0000000000..207c103235
--- /dev/null
+++ b/src/gui/platform/unix/qxkbcommon_3rdparty.cpp
@@ -0,0 +1,187 @@
+// Copyright (C) 2019 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
+
+/* Copyright 1985, 1987, 1990, 1998 The Open Group
+
+ Permission is hereby granted, free of charge, to any person obtaining a
+ copy of this software and associated documentation files (the "Software"),
+ to deal in the Software without restriction, including without limitation
+ the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ and/or sell copies of the Software, and to permit persons to whom the
+ Software is furnished to do so, subject to the following conditions:
+
+ The above copyright notice and this permission notice shall be included in
+ all copies or substantial portions of the Software.
+
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
+ ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+ Except as contained in this notice, the names of the authors or their
+ institutions shall not be used in advertising or otherwise to promote the
+ sale, use or other dealings in this Software without prior written
+ authorization from the authors.
+
+
+
+ Copyright © 2009 Dan Nicholson
+
+ Permission is hereby granted, free of charge, to any person obtaining a
+ copy of this software and associated documentation files (the "Software"),
+ to deal in the Software without restriction, including without limitation
+ the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ and/or sell copies of the Software, and to permit persons to whom the
+ Software is furnished to do so, subject to the following conditions:
+
+ The above copyright notice and this permission notice (including the next
+ paragraph) shall be included in all copies or substantial portions of the
+ Software.
+
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+ FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
+ DEALINGS IN THE SOFTWARE.
+*/
+
+/*
+ XConvertCase was copied from src/3rdparty/xkbcommon/src/keysym.c
+ The following code modifications were applied:
+
+ XConvertCase() was renamed to xkbcommon_XConvertCase(), to not confuse it
+ with Xlib's XConvertCase().
+
+ UCSConvertCase() was renamed to qt_UCSConvertCase() and function's body was
+ replaced to use Qt APIs for doing case conversion, which should give us better
+ results instead of using the less complete version from keysym.c
+*/
+
+#include "qxkbcommon_p.h"
+
+#include <QtCore/QChar>
+
+QT_BEGIN_NAMESPACE
+
+static void qt_UCSConvertCase(uint32_t code, xkb_keysym_t *lower, xkb_keysym_t *upper)
+{
+ *lower = QChar::toLower(code);
+ *upper = QChar::toUpper(code);
+}
+
+void QXkbCommon::xkbcommon_XConvertCase(xkb_keysym_t sym, xkb_keysym_t *lower, xkb_keysym_t *upper)
+{
+ /* Latin 1 keysym */
+ if (sym < 0x100) {
+ qt_UCSConvertCase(sym, lower, upper);
+ return;
+ }
+
+ /* Unicode keysym */
+ if ((sym & 0xff000000) == 0x01000000) {
+ qt_UCSConvertCase((sym & 0x00ffffff), lower, upper);
+ *upper |= 0x01000000;
+ *lower |= 0x01000000;
+ return;
+ }
+
+ /* Legacy keysym */
+
+ *lower = sym;
+ *upper = sym;
+
+ switch (sym >> 8) {
+ case 1: /* Latin 2 */
+ /* Assume the KeySym is a legal value (ignore discontinuities) */
+ if (sym == XKB_KEY_Aogonek)
+ *lower = XKB_KEY_aogonek;
+ else if (sym >= XKB_KEY_Lstroke && sym <= XKB_KEY_Sacute)
+ *lower += (XKB_KEY_lstroke - XKB_KEY_Lstroke);
+ else if (sym >= XKB_KEY_Scaron && sym <= XKB_KEY_Zacute)
+ *lower += (XKB_KEY_scaron - XKB_KEY_Scaron);
+ else if (sym >= XKB_KEY_Zcaron && sym <= XKB_KEY_Zabovedot)
+ *lower += (XKB_KEY_zcaron - XKB_KEY_Zcaron);
+ else if (sym == XKB_KEY_aogonek)
+ *upper = XKB_KEY_Aogonek;
+ else if (sym >= XKB_KEY_lstroke && sym <= XKB_KEY_sacute)
+ *upper -= (XKB_KEY_lstroke - XKB_KEY_Lstroke);
+ else if (sym >= XKB_KEY_scaron && sym <= XKB_KEY_zacute)
+ *upper -= (XKB_KEY_scaron - XKB_KEY_Scaron);
+ else if (sym >= XKB_KEY_zcaron && sym <= XKB_KEY_zabovedot)
+ *upper -= (XKB_KEY_zcaron - XKB_KEY_Zcaron);
+ else if (sym >= XKB_KEY_Racute && sym <= XKB_KEY_Tcedilla)
+ *lower += (XKB_KEY_racute - XKB_KEY_Racute);
+ else if (sym >= XKB_KEY_racute && sym <= XKB_KEY_tcedilla)
+ *upper -= (XKB_KEY_racute - XKB_KEY_Racute);
+ break;
+ case 2: /* Latin 3 */
+ /* Assume the KeySym is a legal value (ignore discontinuities) */
+ if (sym >= XKB_KEY_Hstroke && sym <= XKB_KEY_Hcircumflex)
+ *lower += (XKB_KEY_hstroke - XKB_KEY_Hstroke);
+ else if (sym >= XKB_KEY_Gbreve && sym <= XKB_KEY_Jcircumflex)
+ *lower += (XKB_KEY_gbreve - XKB_KEY_Gbreve);
+ else if (sym >= XKB_KEY_hstroke && sym <= XKB_KEY_hcircumflex)
+ *upper -= (XKB_KEY_hstroke - XKB_KEY_Hstroke);
+ else if (sym >= XKB_KEY_gbreve && sym <= XKB_KEY_jcircumflex)
+ *upper -= (XKB_KEY_gbreve - XKB_KEY_Gbreve);
+ else if (sym >= XKB_KEY_Cabovedot && sym <= XKB_KEY_Scircumflex)
+ *lower += (XKB_KEY_cabovedot - XKB_KEY_Cabovedot);
+ else if (sym >= XKB_KEY_cabovedot && sym <= XKB_KEY_scircumflex)
+ *upper -= (XKB_KEY_cabovedot - XKB_KEY_Cabovedot);
+ break;
+ case 3: /* Latin 4 */
+ /* Assume the KeySym is a legal value (ignore discontinuities) */
+ if (sym >= XKB_KEY_Rcedilla && sym <= XKB_KEY_Tslash)
+ *lower += (XKB_KEY_rcedilla - XKB_KEY_Rcedilla);
+ else if (sym >= XKB_KEY_rcedilla && sym <= XKB_KEY_tslash)
+ *upper -= (XKB_KEY_rcedilla - XKB_KEY_Rcedilla);
+ else if (sym == XKB_KEY_ENG)
+ *lower = XKB_KEY_eng;
+ else if (sym == XKB_KEY_eng)
+ *upper = XKB_KEY_ENG;
+ else if (sym >= XKB_KEY_Amacron && sym <= XKB_KEY_Umacron)
+ *lower += (XKB_KEY_amacron - XKB_KEY_Amacron);
+ else if (sym >= XKB_KEY_amacron && sym <= XKB_KEY_umacron)
+ *upper -= (XKB_KEY_amacron - XKB_KEY_Amacron);
+ break;
+ case 6: /* Cyrillic */
+ /* Assume the KeySym is a legal value (ignore discontinuities) */
+ if (sym >= XKB_KEY_Serbian_DJE && sym <= XKB_KEY_Serbian_DZE)
+ *lower -= (XKB_KEY_Serbian_DJE - XKB_KEY_Serbian_dje);
+ else if (sym >= XKB_KEY_Serbian_dje && sym <= XKB_KEY_Serbian_dze)
+ *upper += (XKB_KEY_Serbian_DJE - XKB_KEY_Serbian_dje);
+ else if (sym >= XKB_KEY_Cyrillic_YU && sym <= XKB_KEY_Cyrillic_HARDSIGN)
+ *lower -= (XKB_KEY_Cyrillic_YU - XKB_KEY_Cyrillic_yu);
+ else if (sym >= XKB_KEY_Cyrillic_yu && sym <= XKB_KEY_Cyrillic_hardsign)
+ *upper += (XKB_KEY_Cyrillic_YU - XKB_KEY_Cyrillic_yu);
+ break;
+ case 7: /* Greek */
+ /* Assume the KeySym is a legal value (ignore discontinuities) */
+ if (sym >= XKB_KEY_Greek_ALPHAaccent && sym <= XKB_KEY_Greek_OMEGAaccent)
+ *lower += (XKB_KEY_Greek_alphaaccent - XKB_KEY_Greek_ALPHAaccent);
+ else if (sym >= XKB_KEY_Greek_alphaaccent && sym <= XKB_KEY_Greek_omegaaccent &&
+ sym != XKB_KEY_Greek_iotaaccentdieresis &&
+ sym != XKB_KEY_Greek_upsilonaccentdieresis)
+ *upper -= (XKB_KEY_Greek_alphaaccent - XKB_KEY_Greek_ALPHAaccent);
+ else if (sym >= XKB_KEY_Greek_ALPHA && sym <= XKB_KEY_Greek_OMEGA)
+ *lower += (XKB_KEY_Greek_alpha - XKB_KEY_Greek_ALPHA);
+ else if (sym >= XKB_KEY_Greek_alpha && sym <= XKB_KEY_Greek_omega &&
+ sym != XKB_KEY_Greek_finalsmallsigma)
+ *upper -= (XKB_KEY_Greek_alpha - XKB_KEY_Greek_ALPHA);
+ break;
+ case 0x13: /* Latin 9 */
+ if (sym == XKB_KEY_OE)
+ *lower = XKB_KEY_oe;
+ else if (sym == XKB_KEY_oe)
+ *upper = XKB_KEY_OE;
+ else if (sym == XKB_KEY_Ydiaeresis)
+ *lower = XKB_KEY_ydiaeresis;
+ break;
+ }
+}
+
+QT_END_NAMESPACE
diff --git a/src/gui/platform/unix/qxkbcommon_p.h b/src/gui/platform/unix/qxkbcommon_p.h
new file mode 100644
index 0000000000..a40d794451
--- /dev/null
+++ b/src/gui/platform/unix/qxkbcommon_p.h
@@ -0,0 +1,128 @@
+// Copyright (C) 2020 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
+
+#ifndef QXKBCOMMON_P_H
+#define QXKBCOMMON_P_H
+
+//
+// W A R N I N G
+// -------------
+//
+// This file is not part of the Qt API. It exists purely as an
+// implementation detail. This header file may change from version to
+// version without notice, or even be removed.
+//
+// We mean it.
+//
+
+#include <QtGui/qtguiglobal.h>
+#include <QtCore/qstring.h>
+#include <QtCore/qloggingcategory.h>
+#include <QtCore/qlist.h>
+#include <QtCore/private/qglobal_p.h>
+
+#include <xkbcommon/xkbcommon.h>
+
+#include <qpa/qplatformkeymapper.h>
+
+#include <memory>
+
+QT_BEGIN_NAMESPACE
+
+class QEvent;
+class QKeyEvent;
+class QPlatformInputContext;
+
+class Q_GUI_EXPORT QXkbCommon
+{
+public:
+ static QString lookupString(struct xkb_state *state, xkb_keycode_t code);
+ static QString lookupStringNoKeysymTransformations(xkb_keysym_t keysym);
+
+ static QList<xkb_keysym_t> toKeysym(QKeyEvent *event);
+
+ static int keysymToQtKey(xkb_keysym_t keysym, Qt::KeyboardModifiers modifiers);
+ static int keysymToQtKey(xkb_keysym_t keysym, Qt::KeyboardModifiers modifiers,
+ xkb_state *state, xkb_keycode_t code,
+ bool superAsMeta = true, bool hyperAsMeta = true);
+
+ // xkbcommon_* API is part of libxkbcommon internals, with modifications as
+ // described in the header of the implementation file.
+ static void xkbcommon_XConvertCase(xkb_keysym_t sym, xkb_keysym_t *lower, xkb_keysym_t *upper);
+ static xkb_keysym_t qxkbcommon_xkb_keysym_to_upper(xkb_keysym_t ks);
+
+ static Qt::KeyboardModifiers modifiers(struct xkb_state *state, xkb_keysym_t keysym = XKB_KEY_VoidSymbol);
+
+ static QList<int> possibleKeys(xkb_state *state,
+ const QKeyEvent *event, bool superAsMeta = false, bool hyperAsMeta = false);
+ static QList<QKeyCombination> possibleKeyCombinations(xkb_state *state,
+ const QKeyEvent *event, bool superAsMeta = false, bool hyperAsMeta = false);
+
+ static void verifyHasLatinLayout(xkb_keymap *keymap);
+ static xkb_keysym_t lookupLatinKeysym(xkb_state *state, xkb_keycode_t keycode);
+
+ static bool isLatin1(xkb_keysym_t sym) {
+ return sym >= 0x20 && sym <= 0xff;
+ }
+ static bool isKeypad(xkb_keysym_t sym) {
+ switch (sym) {
+ case XKB_KEY_KP_Space:
+ case XKB_KEY_KP_Tab:
+ case XKB_KEY_KP_Enter:
+ case XKB_KEY_KP_F1:
+ case XKB_KEY_KP_F2:
+ case XKB_KEY_KP_F3:
+ case XKB_KEY_KP_F4:
+ case XKB_KEY_KP_Home:
+ case XKB_KEY_KP_Left:
+ case XKB_KEY_KP_Up:
+ case XKB_KEY_KP_Right:
+ case XKB_KEY_KP_Down:
+ case XKB_KEY_KP_Prior:
+ case XKB_KEY_KP_Next:
+ case XKB_KEY_KP_End:
+ case XKB_KEY_KP_Begin:
+ case XKB_KEY_KP_Insert:
+ case XKB_KEY_KP_Delete:
+ case XKB_KEY_KP_Equal:
+ case XKB_KEY_KP_Multiply:
+ case XKB_KEY_KP_Add:
+ case XKB_KEY_KP_Separator:
+ case XKB_KEY_KP_Subtract:
+ case XKB_KEY_KP_Decimal:
+ case XKB_KEY_KP_Divide:
+ case XKB_KEY_KP_0:
+ case XKB_KEY_KP_1:
+ case XKB_KEY_KP_2:
+ case XKB_KEY_KP_3:
+ case XKB_KEY_KP_4:
+ case XKB_KEY_KP_5:
+ case XKB_KEY_KP_6:
+ case XKB_KEY_KP_7:
+ case XKB_KEY_KP_8:
+ case XKB_KEY_KP_9:
+ return true;
+ default:
+ return false;
+ }
+ }
+
+ static void setXkbContext(QPlatformInputContext *inputContext, struct xkb_context *context);
+
+ struct XKBStateDeleter {
+ void operator()(struct xkb_state *state) const { return xkb_state_unref(state); }
+ };
+ struct XKBKeymapDeleter {
+ void operator()(struct xkb_keymap *keymap) const { return xkb_keymap_unref(keymap); }
+ };
+ struct XKBContextDeleter {
+ void operator()(struct xkb_context *context) const { return xkb_context_unref(context); }
+ };
+ using ScopedXKBState = std::unique_ptr<struct xkb_state, XKBStateDeleter>;
+ using ScopedXKBKeymap = std::unique_ptr<struct xkb_keymap, XKBKeymapDeleter>;
+ using ScopedXKBContext = std::unique_ptr<struct xkb_context, XKBContextDeleter>;
+};
+
+QT_END_NAMESPACE
+
+#endif // QXKBCOMMON_P_H
diff --git a/src/gui/platform/wasm/qlocalfileapi.cpp b/src/gui/platform/wasm/qlocalfileapi.cpp
new file mode 100644
index 0000000000..76b99361c4
--- /dev/null
+++ b/src/gui/platform/wasm/qlocalfileapi.cpp
@@ -0,0 +1,211 @@
+// Copyright (C) 2022 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
+
+#include "qlocalfileapi_p.h"
+#include <private/qstdweb_p.h>
+#include <QtCore/QRegularExpression>
+
+QT_BEGIN_NAMESPACE
+namespace LocalFileApi {
+namespace {
+std::string qtFilterListToFileInputAccept(const QStringList &filterList)
+{
+ QStringList transformed;
+ for (const auto &filter : filterList) {
+ const auto type = Type::fromQt(filter);
+ if (type && type->accept()) {
+ const auto &extensions = type->accept()->mimeType().extensions();
+ std::transform(extensions.begin(), extensions.end(), std::back_inserter(transformed),
+ [](const Type::Accept::MimeType::Extension &extension) {
+ return extension.value().toString();
+ });
+ }
+ }
+ return transformed.join(QStringLiteral(",")).toStdString();
+}
+
+std::optional<emscripten::val> qtFilterListToTypes(const QStringList &filterList)
+{
+ using namespace qstdweb;
+ using namespace emscripten;
+ auto types = emscripten::val::array();
+
+ for (const auto &fileFilter : filterList) {
+ auto type = Type::fromQt(fileFilter);
+ if (type) {
+ auto jsType = emscripten::val::object();
+ jsType.set("description", type->description().toString().toStdString());
+ if (type->accept()) {
+ jsType.set("accept", ([&mimeType = type->accept()->mimeType()]() {
+ val acceptDict = val::object();
+
+ QList<emscripten::val> extensions;
+ extensions.reserve(mimeType.extensions().size());
+ std::transform(
+ mimeType.extensions().begin(), mimeType.extensions().end(),
+ std::back_inserter(extensions),
+ [](const Type::Accept::MimeType::Extension &extension) {
+ return val(extension.value().toString().toStdString());
+ });
+ acceptDict.set("application/octet-stream",
+ emscripten::val::array(extensions.begin(),
+ extensions.end()));
+ return acceptDict;
+ })());
+ }
+ types.call<void>("push", std::move(jsType));
+ }
+ }
+
+ return types["length"].as<int>() == 0 ? std::optional<emscripten::val>() : types;
+}
+} // namespace
+
+Type::Type(QStringView description, std::optional<Accept> accept)
+ : m_description(description.trimmed()), m_accept(std::move(accept))
+{
+}
+
+Type::~Type() = default;
+
+std::optional<Type> Type::fromQt(QStringView type)
+{
+ using namespace emscripten;
+
+ // Accepts either a string in format:
+ // GROUP3
+ // or in this format:
+ // GROUP1 (GROUP2)
+ // Group 1 is treated as the description, whereas group 2 or 3 are treated as the filter list.
+ static QRegularExpression regex(
+ QString(QStringLiteral("(?:(?:([^(]*)\\(([^()]+)\\)[^)]*)|([^()]+))")));
+ const auto match = regex.matchView(type);
+
+ if (!match.hasMatch())
+ return std::nullopt;
+
+ constexpr size_t DescriptionIndex = 1;
+ constexpr size_t FilterListFromParensIndex = 2;
+ constexpr size_t PlainFilterListIndex = 3;
+
+ const auto description = match.hasCaptured(DescriptionIndex)
+ ? match.capturedView(DescriptionIndex)
+ : QStringView();
+ const auto filterList = match.capturedView(match.hasCaptured(FilterListFromParensIndex)
+ ? FilterListFromParensIndex
+ : PlainFilterListIndex);
+
+ auto accept = Type::Accept::fromQt(filterList);
+ if (!accept)
+ return std::nullopt;
+
+ return Type(description, std::move(*accept));
+}
+
+Type::Accept::Accept() = default;
+
+Type::Accept::~Accept() = default;
+
+std::optional<Type::Accept> Type::Accept::fromQt(QStringView qtRepresentation)
+{
+ Accept accept;
+
+ // Used for accepting multiple extension specifications on a filter list.
+ // The next group of non-empty characters.
+ static QRegularExpression internalRegex(QString(QStringLiteral("([^\\s]+)\\s*")));
+ int offset = 0;
+ auto internalMatch = internalRegex.matchView(qtRepresentation, offset);
+ MimeType mimeType;
+
+ while (internalMatch.hasMatch()) {
+ auto webExtension = MimeType::Extension::fromQt(internalMatch.capturedView(1));
+
+ if (!webExtension)
+ return std::nullopt;
+
+ mimeType.addExtension(*webExtension);
+
+ internalMatch = internalRegex.matchView(qtRepresentation, internalMatch.capturedEnd());
+ }
+
+ accept.setMimeType(mimeType);
+ return accept;
+}
+
+void Type::Accept::setMimeType(MimeType mimeType)
+{
+ m_mimeType = std::move(mimeType);
+}
+
+Type::Accept::MimeType::MimeType() = default;
+
+Type::Accept::MimeType::~MimeType() = default;
+
+void Type::Accept::MimeType::addExtension(Extension extension)
+{
+ m_extensions.push_back(std::move(extension));
+}
+
+Type::Accept::MimeType::Extension::Extension(QStringView extension) : m_value(extension) { }
+
+Type::Accept::MimeType::Extension::~Extension() = default;
+
+std::optional<Type::Accept::MimeType::Extension>
+Type::Accept::MimeType::Extension::fromQt(QStringView qtRepresentation)
+{
+ // Checks for a filter that matches everything:
+ // Any number of asterisks or any number of asterisks with a '.' between them.
+ // The web filter does not support wildcards.
+ static QRegularExpression qtAcceptAllRegex(
+ QRegularExpression::anchoredPattern(QString(QStringLiteral("[*]+|[*]+\\.[*]+"))));
+ if (qtAcceptAllRegex.matchView(qtRepresentation).hasMatch())
+ return std::nullopt;
+
+ // Checks for correctness. The web filter only allows filename extensions and does not filter
+ // the actual filenames, therefore we check whether the filter provided only filters for the
+ // extension.
+ static QRegularExpression qtFilenameMatcherRegex(
+ QRegularExpression::anchoredPattern(QString(QStringLiteral("(\\*?)(\\.[^*]+)"))));
+
+ auto extensionMatch = qtFilenameMatcherRegex.matchView(qtRepresentation);
+ if (extensionMatch.hasMatch())
+ return Extension(extensionMatch.capturedView(2));
+
+ // Mapping impossible.
+ return std::nullopt;
+}
+
+emscripten::val makeOpenFileOptions(const QStringList &filterList, bool acceptMultiple)
+{
+ auto options = emscripten::val::object();
+ if (auto typeList = qtFilterListToTypes(filterList); typeList) {
+ options.set("types", std::move(*typeList));
+ options.set("excludeAcceptAllOption", true);
+ }
+
+ options.set("multiple", acceptMultiple);
+
+ return options;
+}
+
+emscripten::val makeSaveFileOptions(const QStringList &filterList, const std::string& suggestedName)
+{
+ auto options = emscripten::val::object();
+
+ if (!suggestedName.empty())
+ options.set("suggestedName", emscripten::val(suggestedName));
+
+ if (auto typeList = qtFilterListToTypes(filterList))
+ options.set("types", emscripten::val(std::move(*typeList)));
+
+ return options;
+}
+
+std::string makeFileInputAccept(const QStringList &filterList)
+{
+ return qtFilterListToFileInputAccept(filterList);
+}
+
+} // namespace LocalFileApi
+
+QT_END_NAMESPACE
diff --git a/src/gui/platform/wasm/qlocalfileapi_p.h b/src/gui/platform/wasm/qlocalfileapi_p.h
new file mode 100644
index 0000000000..1398d674d8
--- /dev/null
+++ b/src/gui/platform/wasm/qlocalfileapi_p.h
@@ -0,0 +1,94 @@
+// Copyright (C) 2022 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
+
+#ifndef QLOCALFILEAPI_P_H
+#define QLOCALFILEAPI_P_H
+
+//
+// W A R N I N G
+// -------------
+//
+// This file is not part of the Qt API. It exists purely as an
+// implementation detail. This header file may change from version to
+// version without notice, or even be removed.
+//
+// We mean it.
+//
+
+#include <private/qglobal_p.h>
+#include <qstringview.h>
+#include <emscripten/val.h>
+#include <cstdint>
+#include <functional>
+
+QT_BEGIN_NAMESPACE
+
+namespace LocalFileApi {
+class Q_AUTOTEST_EXPORT Type
+{
+public:
+ class Accept {
+ public:
+ class MimeType {
+ public:
+ class Extension {
+ public:
+ static std::optional<Extension> fromQt(QStringView extension);
+
+ ~Extension();
+
+ const QStringView &value() const { return m_value; }
+
+ private:
+ explicit Extension(QStringView extension);
+
+ QStringView m_value;
+ };
+
+ MimeType();
+ ~MimeType();
+
+ void addExtension(Extension type);
+
+ const std::vector<Extension> &extensions() const { return m_extensions; }
+
+ private:
+ std::vector<Extension> m_extensions;
+ };
+
+ static std::optional<Accept> fromQt(QStringView type);
+
+ ~Accept();
+
+ void setMimeType(MimeType mimeType);
+
+ const MimeType &mimeType() const { return m_mimeType; }
+
+ private:
+ Accept();
+ MimeType m_mimeType;
+ };
+
+ Type(QStringView description, std::optional<Accept> accept);
+ ~Type();
+
+ static std::optional<Type> fromQt(QStringView type);
+ const QStringView &description() const { return m_description; }
+ const std::optional<Accept> &accept() const { return m_accept; }
+
+private:
+ QStringView m_description;
+ std::optional<Accept> m_accept;
+};
+
+Q_AUTOTEST_EXPORT emscripten::val makeOpenFileOptions(const QStringList &filterList,
+ bool acceptMultiple);
+Q_AUTOTEST_EXPORT emscripten::val makeSaveFileOptions(const QStringList &filterList,
+ const std::string &suggestedName);
+
+Q_AUTOTEST_EXPORT std::string makeFileInputAccept(const QStringList &filterList);
+
+} // namespace LocalFileApi
+QT_END_NAMESPACE
+
+#endif // QLOCALFILEAPI_P_H
diff --git a/src/gui/platform/wasm/qwasmlocalfileaccess.cpp b/src/gui/platform/wasm/qwasmlocalfileaccess.cpp
index 85c894a74a..a946cda043 100644
--- a/src/gui/platform/wasm/qwasmlocalfileaccess.cpp
+++ b/src/gui/platform/wasm/qwasmlocalfileaccess.cpp
@@ -1,94 +1,111 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the QtGui module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#include "qwasmlocalfileaccess_p.h"
+#include "qlocalfileapi_p.h"
#include <private/qstdweb_p.h>
#include <emscripten.h>
#include <emscripten/bind.h>
#include <emscripten/html5.h>
#include <emscripten/val.h>
+#include <QtCore/qregularexpression.h>
+
QT_BEGIN_NAMESPACE
namespace QWasmLocalFileAccess {
+namespace FileDialog {
+namespace {
+bool hasLocalFilesApi()
+{
+ return !qstdweb::window()["showOpenFilePicker"].isUndefined();
+}
-void streamFile(const qstdweb::File &file, uint32_t offset, uint32_t length, char *buffer, const std::function<void ()> &completed)
+void showOpenViaHTMLPolyfill(const QStringList &accept, FileSelectMode fileSelectMode,
+ qstdweb::PromiseCallbacks onFilesSelected)
{
- // Read file in chunks in order to avoid holding two copies in memory at the same time
- const uint32_t chunkSize = 256 * 1024;
- const uint32_t end = offset + length;
- // assert end < file.size
- auto fileReader = std::make_shared<qstdweb::FileReader>();
-
- auto chunkCompleted = std::make_shared<std::function<void (uint32_t, char *buffer)>>();
- *chunkCompleted = [=](uint32_t chunkBegin, char *chunkBuffer) mutable {
-
- // Copy current chunk from JS memory to Wasm memory
- qstdweb::ArrayBuffer result = fileReader->result();
- qstdweb::Uint8Array(result).copyTo(chunkBuffer);
-
- // Read next chunk if not at buffer end
- uint32_t nextChunkBegin = std::min(chunkBegin + result.byteLength(), end);
- uint32_t nextChunkEnd = std::min(nextChunkBegin + chunkSize, end);
- if (nextChunkBegin == end) {
- completed();
- chunkCompleted.reset();
- return;
- }
- char *nextChunkBuffer = chunkBuffer + result.byteLength();
- fileReader->onLoad([=]() { (*chunkCompleted)(nextChunkBegin, nextChunkBuffer); });
- qstdweb::Blob blob = file.slice(nextChunkBegin, nextChunkEnd);
- fileReader->readAsArrayBuffer(blob);
- };
+ // Create file input html element which will display a native file dialog
+ // and call back to our onchange handler once the user has selected
+ // one or more files.
+ emscripten::val document = emscripten::val::global("document");
+ emscripten::val input = document.call<emscripten::val>("createElement", std::string("input"));
+ input.set("type", "file");
+ input.set("style", "display:none");
+ input.set("accept", LocalFileApi::makeFileInputAccept(accept));
+ Q_UNUSED(accept);
+ input.set("multiple", emscripten::val(fileSelectMode == FileSelectMode::MultipleFiles));
+
+ // Note: there is no event in case the user cancels the file dialog.
+ static std::unique_ptr<qstdweb::EventCallback> changeEvent;
+ auto callback = [=](emscripten::val) { onFilesSelected.thenFunc(input["files"]); };
+ changeEvent = std::make_unique<qstdweb::EventCallback>(input, "change", callback);
+
+ // Activate file input
+ emscripten::val body = document["body"];
+ body.call<void>("appendChild", input);
+ input.call<void>("click");
+ body.call<void>("removeChild", input);
+}
+
+void showOpenViaLocalFileApi(const QStringList &accept, FileSelectMode fileSelectMode,
+ qstdweb::PromiseCallbacks callbacks)
+{
+ using namespace qstdweb;
+
+ auto options = LocalFileApi::makeOpenFileOptions(accept, fileSelectMode == FileSelectMode::MultipleFiles);
+
+ Promise::make(
+ window(), QStringLiteral("showOpenFilePicker"),
+ {
+ .thenFunc = [=](emscripten::val fileHandles) mutable {
+ std::vector<emscripten::val> filePromises;
+ filePromises.reserve(fileHandles["length"].as<int>());
+ for (int i = 0; i < fileHandles["length"].as<int>(); ++i)
+ filePromises.push_back(fileHandles[i].call<emscripten::val>("getFile"));
+ Promise::all(std::move(filePromises), callbacks);
+ },
+ .catchFunc = callbacks.catchFunc,
+ .finallyFunc = callbacks.finallyFunc,
+ }, std::move(options));
+}
+
+void showSaveViaLocalFileApi(const std::string &fileNameHint, qstdweb::PromiseCallbacks callbacks)
+{
+ using namespace qstdweb;
+ using namespace emscripten;
+
+ auto options = LocalFileApi::makeSaveFileOptions(QStringList(), fileNameHint);
+
+ Promise::make(
+ window(), QStringLiteral("showSaveFilePicker"),
+ std::move(callbacks), std::move(options));
+}
+} // namespace
- // Read first chunk. First iteration is a dummy iteration with no available data.
- (*chunkCompleted)(offset, buffer);
+void showOpen(const QStringList &accept, FileSelectMode fileSelectMode,
+ qstdweb::PromiseCallbacks callbacks)
+{
+ hasLocalFilesApi() ?
+ showOpenViaLocalFileApi(accept, fileSelectMode, std::move(callbacks)) :
+ showOpenViaHTMLPolyfill(accept, fileSelectMode, std::move(callbacks));
+}
+
+bool canShowSave()
+{
+ return hasLocalFilesApi();
}
-void streamFile(const qstdweb::File &file, char *buffer, const std::function<void ()> &completed)
+void showSave(const std::string &fileNameHint, qstdweb::PromiseCallbacks callbacks)
{
- streamFile(file, 0, file.size(), buffer, completed);
+ Q_ASSERT(canShowSave());
+ showSaveViaLocalFileApi(fileNameHint, std::move(callbacks));
}
+} // namespace FileDialog
+namespace {
void readFiles(const qstdweb::FileList &fileList,
- const std::function<char *(uint64_t size, const std::string name)> &acceptFile,
- const std::function<void ()> &fileDataReady)
+ const std::function<char *(uint64_t size, const std::string name)> &acceptFile,
+ const std::function<void ()> &fileDataReady)
{
auto readFile = std::make_shared<std::function<void(int)>>();
@@ -99,7 +116,7 @@ void readFiles(const qstdweb::FileList &fileList,
return;
}
- const qstdweb::File file = fileList[fileIndex];
+ const qstdweb::File file = qstdweb::File(fileList[fileIndex]);
// Ask caller if the file should be accepted
char *buffer = acceptFile(file.size(), file.name());
@@ -109,7 +126,7 @@ void readFiles(const qstdweb::FileList &fileList,
}
// Read file data into caller-provided buffer
- streamFile(file, buffer, [=]() {
+ file.stream(buffer, [readFile = readFile.get(), fileIndex, fileDataReady]() {
fileDataReady();
(*readFile)(fileIndex + 1);
});
@@ -118,87 +135,153 @@ void readFiles(const qstdweb::FileList &fileList,
(*readFile)(0);
}
-typedef std::function<void (const qstdweb::FileList &fileList)> OpenFileDialogCallback;
-void openFileDialog(const std::string &accept, FileSelectMode fileSelectMode,
- const OpenFileDialogCallback &filesSelected)
+QStringList makeFilterList(const std::string &qtAcceptList)
{
- // Create file input html element which will display a native file dialog
- // and call back to our onchange handler once the user has selected
- // one or more files.
- emscripten::val document = emscripten::val::global("document");
- emscripten::val input = document.call<emscripten::val>("createElement", std::string("input"));
- input.set("type", "file");
- input.set("style", "display:none");
- input.set("accept", emscripten::val(accept));
- input.set("multiple", emscripten::val(fileSelectMode == MultipleFiles));
+ // copy of qt_make_filter_list() from qfiledialog.cpp
+ auto filter = QString::fromStdString(qtAcceptList);
+ if (filter.isEmpty())
+ return QStringList();
+ QString sep(";;");
+ if (!filter.contains(sep) && filter.contains(u'\n'))
+ sep = u'\n';
- // Note: there is no event in case the user cancels the file dialog.
- static std::unique_ptr<qstdweb::EventCallback> changeEvent;
- auto callback = [=]() { filesSelected(qstdweb::FileList(input["files"])); };
- changeEvent.reset(new qstdweb::EventCallback(input, "change", callback));
+ return filter.split(sep);
+}
+}
+
+void downloadDataAsFile(const char *content, size_t size, const std::string &fileNameHint)
+{
+ // Save a file by creating programmatically clicking a download
+ // link to an object url to a Blob containing a copy of the file
+ // content. The copy is made so that the passed in content buffer
+ // can be released as soon as this function returns.
+ qstdweb::Blob contentBlob = qstdweb::Blob::copyFrom(content, size);
+ emscripten::val document = emscripten::val::global("document");
+ emscripten::val window = qstdweb::window();
+ emscripten::val contentUrl = window["URL"].call<emscripten::val>("createObjectURL", contentBlob.val());
+ emscripten::val contentLink = document.call<emscripten::val>("createElement", std::string("a"));
+ contentLink.set("href", contentUrl);
+ contentLink.set("download", fileNameHint);
+ contentLink.set("style", "display:none");
- // Activate file input
emscripten::val body = document["body"];
- body.call<void>("appendChild", input);
- input.call<void>("click");
- body.call<void>("removeChild", input);
+ body.call<void>("appendChild", contentLink);
+ contentLink.call<void>("click");
+ body.call<void>("removeChild", contentLink);
+
+ window["URL"].call<emscripten::val>("revokeObjectURL", contentUrl);
}
void openFiles(const std::string &accept, FileSelectMode fileSelectMode,
const std::function<void (int fileCount)> &fileDialogClosed,
- const std::function<char *(uint64_t size, const std::string name)> &acceptFile,
+ const std::function<char *(uint64_t size, const std::string& name)> &acceptFile,
const std::function<void()> &fileDataReady)
{
- openFileDialog(accept, fileSelectMode, [=](const qstdweb::FileList &files) {
- fileDialogClosed(files.length());
- readFiles(files, acceptFile, fileDataReady);
+ FileDialog::showOpen(makeFilterList(accept), fileSelectMode, {
+ .thenFunc = [=](emscripten::val result) {
+ auto files = qstdweb::FileList(result);
+ fileDialogClosed(files.length());
+ readFiles(files, acceptFile, fileDataReady);
+ },
+ .catchFunc = [=](emscripten::val) {
+ fileDialogClosed(0);
+ }
});
}
void openFile(const std::string &accept,
const std::function<void (bool fileSelected)> &fileDialogClosed,
- const std::function<char *(uint64_t size, const std::string name)> &acceptFile,
+ const std::function<char *(uint64_t size, const std::string& name)> &acceptFile,
const std::function<void()> &fileDataReady)
{
auto fileDialogClosedWithInt = [=](int fileCount) { fileDialogClosed(fileCount != 0); };
openFiles(accept, FileSelectMode::SingleFile, fileDialogClosedWithInt, acceptFile, fileDataReady);
}
-void saveFile(const char *content, size_t size, const std::string &fileNameHint)
+void saveDataToFileInChunks(emscripten::val fileHandle, const QByteArray &data)
{
- // Save a file by creating programatically clicking a download
- // link to an object url to a Blob containing the file content.
- // File content is copied once, so that the passed in content
- // buffer can be released as soon as this function returns - we
- // don't know for how long the browser will retain the TypedArray
- // view used to create the Blob.
+ using namespace emscripten;
+ using namespace qstdweb;
- emscripten::val document = emscripten::val::global("document");
- emscripten::val window = emscripten::val::global("window");
+ Promise::make(fileHandle, QStringLiteral("createWritable"), {
+ .thenFunc = [=](val writable) {
+ struct State {
+ size_t written;
+ std::function<void(val result)> continuation;
+ };
- emscripten::val fileContentView = emscripten::val(emscripten::typed_memory_view(size, content));
- emscripten::val fileContentCopy = emscripten::val::global("ArrayBuffer").new_(size);
- emscripten::val fileContentCopyView = emscripten::val::global("Uint8Array").new_(fileContentCopy);
- fileContentCopyView.call<void>("set", fileContentView);
+ static constexpr size_t desiredChunkSize = 1024u;
+#if defined(__EMSCRIPTEN_SHARED_MEMORY__)
+ qstdweb::Uint8Array chunkArray(desiredChunkSize);
+#endif
- emscripten::val contentArray = emscripten::val::array();
- contentArray.call<void>("push", fileContentCopyView);
- emscripten::val type = emscripten::val::object();
- type.set("type","application/octet-stream");
- emscripten::val contentBlob = emscripten::val::global("Blob").new_(contentArray, type);
+ auto state = std::make_shared<State>();
+ state->written = 0u;
+ state->continuation = [=](val) mutable {
+ const size_t remaining = data.size() - state->written;
+ if (remaining == 0) {
+ Promise::make(writable, QStringLiteral("close"), { .thenFunc = [=](val) {} });
+ state.reset();
+ return;
+ }
- emscripten::val contentUrl = window["URL"].call<emscripten::val>("createObjectURL", contentBlob);
- emscripten::val contentLink = document.call<emscripten::val>("createElement", std::string("a"));
- contentLink.set("href", contentUrl);
- contentLink.set("download", fileNameHint);
- contentLink.set("style", "display:none");
+ const auto currentChunkSize = std::min(remaining, desiredChunkSize);
- emscripten::val body = document["body"];
- body.call<void>("appendChild", contentLink);
- contentLink.call<void>("click");
- body.call<void>("removeChild", contentLink);
+#if defined(__EMSCRIPTEN_SHARED_MEMORY__)
+ // If shared memory is used, WebAssembly.Memory is instantiated with the 'shared'
+ // option on. Passing a typed_memory_view to SharedArrayBuffer to
+ // FileSystemWritableFileStream.write is disallowed by security policies, so we
+ // need to make a copy of the data to a chunk array buffer.
+ Promise::make(
+ writable, QStringLiteral("write"),
+ {
+ .thenFunc = state->continuation,
+ },
+ chunkArray.copyFrom(data.constData() + state->written, currentChunkSize)
+ .val()
+ .call<emscripten::val>("subarray", emscripten::val(0),
+ emscripten::val(currentChunkSize)));
+#else
+ Promise::make(writable, QStringLiteral("write"),
+ {
+ .thenFunc = state->continuation,
+ },
+ val(typed_memory_view(currentChunkSize, data.constData() + state->written)));
+#endif
+ state->written += currentChunkSize;
+ };
- window["URL"].call<emscripten::val>("revokeObjectURL", contentUrl);
+ state->continuation(val::undefined());
+ },
+ });
+}
+
+void saveFile(const QByteArray &data, const std::string &fileNameHint)
+{
+ if (!FileDialog::canShowSave()) {
+ downloadDataAsFile(data.constData(), data.size(), fileNameHint);
+ return;
+ }
+
+ FileDialog::showSave(fileNameHint, {
+ .thenFunc = [=](emscripten::val result) {
+ saveDataToFileInChunks(result, data);
+ },
+ });
+}
+
+void saveFile(const char *content, size_t size, const std::string &fileNameHint)
+{
+ if (!FileDialog::canShowSave()) {
+ downloadDataAsFile(content, size, fileNameHint);
+ return;
+ }
+
+ FileDialog::showSave(fileNameHint, {
+ .thenFunc = [=](emscripten::val result) {
+ saveDataToFileInChunks(result, QByteArray(content, size));
+ },
+ });
}
} // namespace QWasmLocalFileAccess
diff --git a/src/gui/platform/wasm/qwasmlocalfileaccess_p.h b/src/gui/platform/wasm/qwasmlocalfileaccess_p.h
index ccd88570c8..77b14577f7 100644
--- a/src/gui/platform/wasm/qwasmlocalfileaccess_p.h
+++ b/src/gui/platform/wasm/qwasmlocalfileaccess_p.h
@@ -1,41 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the QtGui module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2019 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#ifndef QWASMLOCALFILEACCESS_P_H
#define QWASMLOCALFILEACCESS_P_H
@@ -51,7 +15,7 @@
// We mean it.
//
-#include <qglobal.h>
+#include <private/qglobal_p.h>
#include <cstdint>
#include <functional>
@@ -59,19 +23,20 @@ QT_BEGIN_NAMESPACE
namespace QWasmLocalFileAccess {
-enum FileSelectMode { SingleFile, MultipleFiles };
+enum class FileSelectMode { SingleFile, MultipleFiles };
-void openFiles(const std::string &accept, FileSelectMode fileSelectMode,
+Q_CORE_EXPORT void openFiles(const std::string &accept, FileSelectMode fileSelectMode,
const std::function<void (int fileCount)> &fileDialogClosed,
- const std::function<char *(uint64_t size, const std::string name)> &acceptFile,
+ const std::function<char *(uint64_t size, const std::string& name)> &acceptFile,
const std::function<void()> &fileDataReady);
-void openFile(const std::string &accept,
+Q_CORE_EXPORT void openFile(const std::string &accept,
const std::function<void (bool fileSelected)> &fileDialogClosed,
- const std::function<char *(uint64_t size, const std::string name)> &acceptFile,
+ const std::function<char *(uint64_t size, const std::string& name)> &acceptFile,
const std::function<void()> &fileDataReady);
-void saveFile(const char *content, size_t size, const std::string &fileNameHint);
+Q_CORE_EXPORT void saveFile(const QByteArray &data, const std::string &fileNameHint);
+Q_CORE_EXPORT void saveFile(const char *content, size_t size, const std::string &fileNameHint);
} // namespace QWasmLocalFileAccess
diff --git a/src/gui/platform/wasm/qwasmnativeinterface.cpp b/src/gui/platform/wasm/qwasmnativeinterface.cpp
new file mode 100644
index 0000000000..7313629a8d
--- /dev/null
+++ b/src/gui/platform/wasm/qwasmnativeinterface.cpp
@@ -0,0 +1,17 @@
+// Copyright (C) 2023 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
+
+
+
+#include <QtGui/private/qguiapplication_p.h>
+#include <qpa/qplatformintegration.h>
+#include <qpa/qplatformwindow_p.h>
+
+
+QT_BEGIN_NAMESPACE
+
+using namespace QNativeInterface::Private;
+
+QT_DEFINE_PRIVATE_NATIVE_INTERFACE(QWasmWindow);
+
+QT_END_NAMESPACE
diff --git a/src/gui/platform/wasm/wasm.pri b/src/gui/platform/wasm/wasm.pri
deleted file mode 100644
index 1b5d7eadb5..0000000000
--- a/src/gui/platform/wasm/wasm.pri
+++ /dev/null
@@ -1,3 +0,0 @@
-INCLUDEDIR += $$PWD
-HEADERS += $$PWD/qwasmlocalfileaccess_p.h
-SOURCES += $$PWD/qwasmlocalfileaccess.cpp
diff --git a/src/gui/platform/windows/qwindowsguieventdispatcher.cpp b/src/gui/platform/windows/qwindowsguieventdispatcher.cpp
new file mode 100644
index 0000000000..c2f0efe96e
--- /dev/null
+++ b/src/gui/platform/windows/qwindowsguieventdispatcher.cpp
@@ -0,0 +1,201 @@
+// Copyright (C) 2013 Samuel Gaist <samuel.gaist@edeltech.ch>
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
+
+#include "qwindowsguieventdispatcher_p.h"
+
+#include <qpa/qwindowsysteminterface.h>
+
+#include <QtCore/QCoreApplication>
+#include <QtCore/QDebug>
+
+QT_BEGIN_NAMESPACE
+
+/*!
+ \class QWindowsGuiEventDispatcher
+ \brief Event dispatcher for Windows
+
+ Maintains a global stack storing the current event dispatcher and
+ its processing flags for access from the Windows procedure
+ qWindowsWndProc. Handling the QPA gui events should be done
+ from within the qWindowsWndProc to ensure correct processing of messages.
+
+ \internal
+*/
+
+QWindowsGuiEventDispatcher::QWindowsGuiEventDispatcher(QObject *parent) :
+ QEventDispatcherWin32(parent)
+{
+ setObjectName(QStringLiteral("QWindowsGuiEventDispatcher"));
+}
+
+bool QWindowsGuiEventDispatcher::processEvents(QEventLoop::ProcessEventsFlags flags)
+{
+ const QEventLoop::ProcessEventsFlags oldFlags = m_flags;
+ m_flags = flags;
+ const bool rc = QEventDispatcherWin32::processEvents(flags);
+ m_flags = oldFlags;
+ return rc;
+}
+
+void QWindowsGuiEventDispatcher::sendPostedEvents()
+{
+ QEventDispatcherWin32::sendPostedEvents();
+ QWindowSystemInterface::sendWindowSystemEvents(m_flags);
+}
+
+// Helpers for printing debug output for WM_* messages.
+struct MessageDebugEntry
+{
+ UINT message;
+ const char *description;
+ bool interesting;
+};
+
+static const MessageDebugEntry
+messageDebugEntries[] = {
+ {WM_CREATE, "WM_CREATE", true},
+ {WM_PAINT, "WM_PAINT", true},
+ {WM_CLOSE, "WM_CLOSE", true},
+ {WM_DESTROY, "WM_DESTROY", true},
+ {WM_MOVE, "WM_MOVE", true},
+ {WM_SIZE, "WM_SIZE", true},
+ {WM_GETICON, "WM_GETICON", false},
+ {WM_KEYDOWN, "WM_KEYDOWN", true},
+ {WM_SYSKEYDOWN, "WM_SYSKEYDOWN", true},
+ {WM_SYSCOMMAND, "WM_SYSCOMMAND", true},
+ {WM_KEYUP, "WM_KEYUP", true},
+ {WM_SYSKEYUP, "WM_SYSKEYUP", true},
+#if defined(WM_APPCOMMAND)
+ {WM_APPCOMMAND, "WM_APPCOMMAND", true},
+#endif
+ {WM_IME_CHAR, "WM_IMECHAR", true},
+ {WM_IME_KEYDOWN, "WM_IMECHAR", true},
+ {WM_CANCELMODE, "WM_CANCELMODE", true},
+ {WM_CHAR, "WM_CHAR", true},
+ {WM_DEADCHAR, "WM_DEADCHAR", true},
+ {WM_ACTIVATE, "WM_ACTIVATE", true},
+ {WM_SETFOCUS, "WM_SETFOCUS", true},
+ {WM_KILLFOCUS, "WM_KILLFOCUS", true},
+ {WM_ENABLE, "WM_ENABLE", true},
+ {WM_SHOWWINDOW, "WM_SHOWWINDOW", true},
+ {WM_WINDOWPOSCHANGED, "WM_WINDOWPOSCHANGED", true},
+ {WM_SETCURSOR, "WM_SETCURSOR", false},
+ {WM_GETFONT, "WM_GETFONT", true},
+ {WM_LBUTTONDOWN, "WM_LBUTTONDOWN", true},
+ {WM_LBUTTONUP, "WM_LBUTTONUP", true},
+ {WM_LBUTTONDBLCLK, "WM_LBUTTONDBLCLK", true},
+ {WM_RBUTTONDOWN, "WM_RBUTTONDOWN", true},
+ {WM_RBUTTONUP, "WM_RBUTTONUP", true},
+ {WM_RBUTTONDBLCLK, "WM_RBUTTONDBLCLK", true},
+ {WM_MBUTTONDOWN, "WM_MBUTTONDOWN", true},
+ {WM_MBUTTONUP, "WM_MBUTTONUP", true},
+ {WM_MBUTTONDBLCLK, "WM_MBUTTONDBLCLK", true},
+ {WM_MOUSEWHEEL, "WM_MOUSEWHEEL", true},
+ {WM_XBUTTONDOWN, "WM_XBUTTONDOWN", true},
+ {WM_XBUTTONUP, "WM_XBUTTONUP", true},
+ {WM_XBUTTONDBLCLK, "WM_XBUTTONDBLCLK", true},
+ {WM_MOUSEHWHEEL, "WM_MOUSEHWHEEL", true},
+ {WM_GETOBJECT, "WM_GETOBJECT", true},
+ {WM_IME_SETCONTEXT, "WM_IME_SETCONTEXT", true},
+ {WM_INPUTLANGCHANGE, "WM_INPUTLANGCHANGE", true},
+ {WM_IME_NOTIFY, "WM_IME_NOTIFY", true},
+#if defined(WM_DWMNCRENDERINGCHANGED)
+ {WM_DWMNCRENDERINGCHANGED, "WM_DWMNCRENDERINGCHANGED", true},
+#endif
+ {WM_IME_SETCONTEXT, "WM_IME_SETCONTEXT", true},
+ {WM_IME_NOTIFY, "WM_IME_NOTIFY", true},
+ {WM_RENDERFORMAT, "WM_RENDERFORMAT", true},
+ {WM_RENDERALLFORMATS, "WM_RENDERALLFORMATS", true},
+ {WM_DESTROYCLIPBOARD, "WM_DESTROYCLIPBOARD", true},
+ {WM_CAPTURECHANGED, "WM_CAPTURECHANGED", true},
+ {WM_IME_STARTCOMPOSITION, "WM_IME_STARTCOMPOSITION", true},
+ {WM_IME_COMPOSITION, "WM_IME_COMPOSITION", true},
+ {WM_IME_ENDCOMPOSITION, "WM_IME_ENDCOMPOSITION", true},
+ {WM_IME_NOTIFY, "WM_IME_NOTIFY", true},
+ {WM_IME_REQUEST, "WM_IME_REQUEST", true},
+#if !defined(QT_NO_SESSIONMANAGER)
+ {WM_QUERYENDSESSION, "WM_QUERYENDSESSION", true},
+ {WM_ENDSESSION, "WM_ENDSESSION", true},
+#endif
+ {WM_MOUSEACTIVATE,"WM_MOUSEACTIVATE", true},
+ {WM_CHILDACTIVATE, "WM_CHILDACTIVATE", true},
+ {WM_PARENTNOTIFY, "WM_PARENTNOTIFY", true},
+ {WM_ENTERIDLE, "WM_ENTERIDLE", false},
+ {WM_GETMINMAXINFO, "WM_GETMINMAXINFO", true},
+ {WM_WINDOWPOSCHANGING, "WM_WINDOWPOSCHANGING", true},
+ {WM_NCCREATE, "WM_NCCREATE", true},
+ {WM_NCDESTROY, "WM_NCDESTROY", true},
+ {WM_NCCALCSIZE, "WM_NCCALCSIZE", true},
+ {WM_NCACTIVATE, "WM_NCACTIVATE", true},
+ {WM_NCMOUSEMOVE, "WM_NCMOUSEMOVE", true},
+ {WM_NCMOUSELEAVE, "WM_NCMOUSELEAVE", true},
+ {WM_NCLBUTTONDOWN, "WM_NCLBUTTONDOWN", true},
+ {WM_NCLBUTTONUP, "WM_NCLBUTTONUP", true},
+ {WM_ACTIVATEAPP, "WM_ACTIVATEAPP", true},
+ {WM_NCPAINT, "WM_NCPAINT", true},
+ {WM_ERASEBKGND, "WM_ERASEBKGND", true},
+ {WM_MOUSEMOVE, "WM_MOUSEMOVE", true},
+ {WM_MOUSELEAVE, "WM_MOUSELEAVE", true},
+ {WM_NCHITTEST, "WM_NCHITTEST", false},
+#ifdef WM_TOUCH
+ {WM_TOUCH, "WM_TOUCH", true},
+#endif
+ {WM_CHANGECBCHAIN, "WM_CHANGECBCHAIN", true},
+ {WM_DISPLAYCHANGE, "WM_DISPLAYCHANGE", true},
+ {WM_DRAWCLIPBOARD, "WM_DRAWCLIPBOARD", true},
+ {WM_THEMECHANGED, "WM_THEMECHANGED", true},
+ {0x90, "WM_UAHDESTROYWINDOW", true},
+ {0x272, "WM_UNREGISTER_WINDOW_SERVICES", true},
+#ifdef WM_POINTERUPDATE
+ {WM_POINTERDEVICECHANGE, "WM_POINTERDEVICECHANGE", true},
+ {WM_POINTERDEVICEINRANGE, "WM_POINTERDEVICEINRANGE", true},
+ {WM_POINTERDEVICEOUTOFRANGE, "WM_POINTERDEVICEOUTOFRANGE", true},
+ {WM_NCPOINTERUPDATE, "WM_NCPOINTERUPDATE", true},
+ {WM_NCPOINTERDOWN, "WM_NCPOINTERDOWN", true},
+ {WM_NCPOINTERUP, "WM_NCPOINTERUP", true},
+ {WM_POINTERUPDATE, "WM_POINTERUPDATE", true},
+ {WM_POINTERDOWN, "WM_POINTERDOWN", true},
+ {WM_POINTERUP, "WM_POINTERUP", true},
+ {WM_POINTERENTER, "WM_POINTERENTER", true},
+ {WM_POINTERLEAVE, "WM_POINTERLEAVE", true},
+ {WM_POINTERACTIVATE, "WM_POINTERACTIVATE", true},
+ {WM_POINTERCAPTURECHANGED, "WM_POINTERCAPTURECHANGED", true},
+ {WM_TOUCHHITTESTING, "WM_TOUCHHITTESTING", true},
+ {WM_POINTERWHEEL, "WM_POINTERWHEEL", true},
+ {WM_POINTERHWHEEL, "WM_POINTERHWHEEL", true},
+#endif // WM_POINTERUPDATE
+#ifdef DM_POINTERHITTEST
+ {DM_POINTERHITTEST, "DM_POINTERHITTEST", true},
+#endif // DM_POINTERHITTEST
+#ifdef WM_POINTERROUTEDTO
+ {WM_POINTERROUTEDTO, "WM_POINTERROUTEDTO", true},
+ {WM_POINTERROUTEDAWAY, "WM_POINTERROUTEDAWAY", true},
+ {WM_POINTERROUTEDRELEASED, "WM_POINTERROUTEDRELEASED", true},
+#endif // WM_POINTERROUTEDTO
+#ifdef WM_GETDPISCALEDSIZE
+ {WM_GETDPISCALEDSIZE, "WM_GETDPISCALEDSIZE", true},
+#endif
+#ifdef WM_DPICHANGED
+ {WM_DPICHANGED, "WM_DPICHANGED", true},
+#endif
+};
+
+static inline const MessageDebugEntry *messageDebugEntry(UINT msg)
+{
+ for (size_t i = 0; i < sizeof(messageDebugEntries)/sizeof(MessageDebugEntry); i++)
+ if (messageDebugEntries[i].message == msg)
+ return messageDebugEntries + i;
+ return 0;
+}
+
+const char *QWindowsGuiEventDispatcher::windowsMessageName(UINT msg)
+{
+ if (const MessageDebugEntry *e = messageDebugEntry(msg))
+ return e->description;
+ return "Unknown";
+}
+
+QT_END_NAMESPACE
+
+#include "moc_qwindowsguieventdispatcher_p.cpp"
diff --git a/src/gui/platform/windows/qwindowsguieventdispatcher_p.h b/src/gui/platform/windows/qwindowsguieventdispatcher_p.h
new file mode 100644
index 0000000000..7d326c0780
--- /dev/null
+++ b/src/gui/platform/windows/qwindowsguieventdispatcher_p.h
@@ -0,0 +1,40 @@
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
+
+#ifndef QWINDOWSGUIEVENTDISPATCHER_H
+#define QWINDOWSGUIEVENTDISPATCHER_H
+
+//
+// W A R N I N G
+// -------------
+//
+// This file is not part of the Qt API. It exists purely as an
+// implementation detail. This header file may change from version to
+// version without notice, or even be removed.
+//
+// We mean it.
+//
+
+#include <QtCore/private/qeventdispatcher_win_p.h>
+#include <QtGui/qtguiglobal.h>
+
+QT_BEGIN_NAMESPACE
+
+class Q_GUI_EXPORT QWindowsGuiEventDispatcher : public QEventDispatcherWin32
+{
+ Q_OBJECT
+public:
+ explicit QWindowsGuiEventDispatcher(QObject *parent = nullptr);
+
+ static const char *windowsMessageName(UINT msg);
+
+ bool QT_ENSURE_STACK_ALIGNED_FOR_SSE processEvents(QEventLoop::ProcessEventsFlags flags) override;
+ void sendPostedEvents() override;
+
+private:
+ QEventLoop::ProcessEventsFlags m_flags;
+};
+
+QT_END_NAMESPACE
+
+#endif // QWINDOWSGUIEVENTDISPATCHER_H
diff --git a/src/gui/platform/windows/qwindowsmimeconverter.cpp b/src/gui/platform/windows/qwindowsmimeconverter.cpp
new file mode 100644
index 0000000000..49d524cb99
--- /dev/null
+++ b/src/gui/platform/windows/qwindowsmimeconverter.cpp
@@ -0,0 +1,170 @@
+// Copyright (C) 2022 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
+
+#include "qwindowsmimeconverter.h"
+
+#include <QtCore/qt_windows.h>
+
+#include <QtGui/private/qguiapplication_p.h>
+#include <QtGui/qpa/qplatformintegration.h>
+
+QT_BEGIN_NAMESPACE
+
+/*!
+ \class QWindowsMimeConverter
+ \brief The QWindowsMimeConverter class maps open-standard MIME to Window Clipboard formats.
+ \inmodule QtGui
+
+ Qt's drag-and-drop and clipboard facilities use the MIME standard.
+ On X11, this maps trivially to the Xdnd protocol, but on Windows
+ although some applications use MIME types to describe clipboard
+ formats, others use arbitrary non-standardized naming conventions,
+ or unnamed built-in formats of Windows.
+
+ By instantiating subclasses of QWindowsMimeConverter that provide
+ conversions between Windows Clipboard and MIME formats, you can convert
+ proprietary clipboard formats to MIME formats.
+
+ Construct an instance of your converter implementation after instantiating
+ QGuiApplication:
+
+ \code
+ int main(int argc, char **argv)
+ {
+ QGuiApplication app(argc, argv);
+ JsonMimeConverter jsonConverter;
+ }
+ \endcode
+
+ Destroying the instance will unregister the converter and remove support
+ for the conversion. It is also valid to heap-allocate the converter
+ instance; Qt takes ownership and will delete the converter object during
+ QGuiApplication shut-down.
+
+ Qt has predefined support for the following Windows Clipboard formats:
+
+ \table
+ \header \li Windows Format \li Equivalent MIME type
+ \row \li \c CF_UNICODETEXT \li \c text/plain
+ \row \li \c CF_TEXT \li \c text/plain
+ \row \li \c CF_DIB \li \c{image/xyz}, where \c xyz is
+ a \l{QImageWriter::supportedImageFormats()}{Qt image format}
+ \row \li \c CF_HDROP \li \c text/uri-list
+ \row \li \c CF_INETURL \li \c text/uri-list
+ \row \li \c CF_HTML \li \c text/html
+ \endtable
+
+ An example use of this class would be to map the Windows Metafile
+ clipboard format (\c CF_METAFILEPICT) to and from the MIME type
+ \c{image/x-wmf}. This conversion might simply be adding or removing
+ a header, or even just passing on the data. See \l{Drag and Drop}
+ for more information on choosing and definition MIME types.
+
+ You can check if a MIME type is convertible using canConvertFromMime() and
+ can perform conversions with convertToMime() and convertFromMime().
+*/
+
+
+/*!
+ \fn bool QWindowsMimeConverter::canConvertFromMime(const FORMATETC &formatetc, const QMimeData *mimeData) const
+
+ Returns \c true if the converter can convert from the \a mimeData to
+ the format specified in \a formatetc.
+
+ All subclasses must reimplement this pure virtual function.
+*/
+
+/*!
+ \fn bool QWindowsMimeConverter::canConvertToMime(const QString &mimeType, IDataObject *pDataObj) const
+
+ Returns \c true if the converter can convert to the \a mimeType from
+ the available formats in \a pDataObj.
+
+ All subclasses must reimplement this pure virtual function.
+*/
+
+/*!
+ \fn QString QWindowsMimeConverter::mimeForFormat(const FORMATETC &formatetc) const
+
+ Returns the mime type that will be created form the format specified
+ in \a formatetc, or an empty string if this converter does not support
+ \a formatetc.
+
+ All subclasses must reimplement this pure virtual function.
+*/
+
+/*!
+ \fn QList<FORMATETC> QWindowsMimeConverter::formatsForMime(const QString &mimeType, const QMimeData *mimeData) const
+
+ Returns a QList of FORMATETC structures representing the different windows clipboard
+ formats that can be provided for the \a mimeType from the \a mimeData.
+
+ All subclasses must reimplement this pure virtual function.
+*/
+
+/*!
+ \fn QVariant QWindowsMimeConverter::convertToMime(const QString &mimeType, IDataObject *pDataObj,
+ QMetaType preferredType) const
+
+ Returns a QVariant containing the converted data for \a mimeType from \a pDataObj.
+ If possible the QVariant should be of the \a preferredType to avoid needless conversions.
+
+ All subclasses must reimplement this pure virtual function.
+*/
+
+/*!
+ \fn bool QWindowsMimeConverter::convertFromMime(const FORMATETC &formatetc, const QMimeData *mimeData, STGMEDIUM * pmedium) const
+
+ Convert the \a mimeData to the format specified in \a formatetc.
+ The converted data should then be placed in \a pmedium structure.
+
+ Return true if the conversion was successful.
+
+ All subclasses must reimplement this pure virtual function.
+*/
+
+/*!
+ Constructs a QWindowsMimeConverter instance.
+
+ The instance is automatically registered, and will be called to convert data during
+ clipboard or drag'n'drop operations.
+
+ Call this constructor after QGuiApplication has been created.
+*/
+QWindowsMimeConverter::QWindowsMimeConverter()
+{
+ using QWindowsApplication = QNativeInterface::Private::QWindowsApplication;
+ auto nativeWindowsApp = dynamic_cast<QWindowsApplication *>(QGuiApplicationPrivate::platformIntegration());
+ Q_ASSERT(nativeWindowsApp);
+ nativeWindowsApp->registerMime(this);
+}
+
+/*!
+ Constructs a QWindowsMimeConverter instance.
+
+ The instance is automatically unregistered.
+*/
+QWindowsMimeConverter::~QWindowsMimeConverter()
+{
+ using QWindowsApplication = QNativeInterface::Private::QWindowsApplication;
+ auto nativeWindowsApp = dynamic_cast<QWindowsApplication *>(QGuiApplicationPrivate::platformIntegration());
+ Q_ASSERT(nativeWindowsApp);
+ nativeWindowsApp->unregisterMime(this);
+}
+
+/*!
+ Registers the MIME type \a mimeType, and returns an ID number
+ identifying the format on Windows.
+
+ A mime type \c {application/x-qt-windows-mime;value="WindowsType"} will be
+ registered as the clipboard format for \c WindowsType.
+*/
+int QWindowsMimeConverter::registerMimeType(const QString &mimeType)
+{
+ using QWindowsApplication = QNativeInterface::Private::QWindowsApplication;
+ auto nativeWindowsApp = dynamic_cast<QWindowsApplication *>(QGuiApplicationPrivate::platformIntegration());
+ Q_ASSERT(nativeWindowsApp);
+ return nativeWindowsApp->registerMimeType(mimeType);
+}
+
+QT_END_NAMESPACE
diff --git a/src/gui/platform/windows/qwindowsmimeconverter.h b/src/gui/platform/windows/qwindowsmimeconverter.h
new file mode 100644
index 0000000000..145355fe15
--- /dev/null
+++ b/src/gui/platform/windows/qwindowsmimeconverter.h
@@ -0,0 +1,43 @@
+// Copyright (C) 2022 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
+
+#ifndef QWINDOWSMIMECONVERTER_P_H
+#define QWINDOWSMIMECONVERTER_P_H
+
+#include <QtGui/qtguiglobal.h>
+
+struct tagFORMATETC;
+using FORMATETC = tagFORMATETC;
+struct tagSTGMEDIUM;
+using STGMEDIUM = tagSTGMEDIUM;
+struct IDataObject;
+
+QT_BEGIN_NAMESPACE
+
+class QMetaType;
+class QMimeData;
+class QVariant;
+
+class Q_GUI_EXPORT QWindowsMimeConverter
+{
+ Q_DISABLE_COPY(QWindowsMimeConverter)
+public:
+ QWindowsMimeConverter();
+ virtual ~QWindowsMimeConverter();
+
+ static int registerMimeType(const QString &mimeType);
+
+ // for converting from Qt
+ virtual bool canConvertFromMime(const FORMATETC &formatetc, const QMimeData *mimeData) const = 0;
+ virtual bool convertFromMime(const FORMATETC &formatetc, const QMimeData *mimeData, STGMEDIUM * pmedium) const = 0;
+ virtual QList<FORMATETC> formatsForMime(const QString &mimeType, const QMimeData *mimeData) const = 0;
+
+ // for converting to Qt
+ virtual bool canConvertToMime(const QString &mimeType, IDataObject *pDataObj) const = 0;
+ virtual QVariant convertToMime(const QString &mimeType, IDataObject *pDataObj, QMetaType preferredType) const = 0;
+ virtual QString mimeForFormat(const FORMATETC &formatetc) const = 0;
+};
+
+QT_END_NAMESPACE
+
+#endif // QWINDOWSMIMECONVERTER_H
diff --git a/src/gui/platform/windows/qwindowsnativeinterface.cpp b/src/gui/platform/windows/qwindowsnativeinterface.cpp
new file mode 100644
index 0000000000..44f230e1d3
--- /dev/null
+++ b/src/gui/platform/windows/qwindowsnativeinterface.cpp
@@ -0,0 +1,312 @@
+// Copyright (C) 2020 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
+
+#include <QtGui/qopenglcontext.h>
+#include <QtGui/private/qguiapplication_p.h>
+#include <qpa/qplatformopenglcontext.h>
+#include <qpa/qplatformintegration.h>
+#include <qpa/qplatformwindow.h>
+#include <qpa/qplatformwindow_p.h>
+#include <qpa/qplatformscreen_p.h>
+
+QT_BEGIN_NAMESPACE
+
+using namespace QNativeInterface::Private;
+
+#ifndef QT_NO_OPENGL
+
+/*!
+ \class QNativeInterface::QWGLContext
+ \inheaderfile QOpenGLContext
+ \since 6.0
+ \brief Native interface to a WGL context on Windows.
+
+ Accessed through QOpenGLContext::nativeInterface().
+
+ \inmodule QtGui
+ \inheaderfile QOpenGLContext
+ \ingroup native-interfaces
+ \ingroup native-interfaces-qopenglcontext
+*/
+
+/*!
+ \fn QOpenGLContext *QNativeInterface::QWGLContext::fromNative(HGLRC context, HWND window, QOpenGLContext *shareContext = nullptr)
+
+ \brief Adopts an WGL \a context handle.
+
+ The \a window is needed because the its pixel format will be queried. When the
+ adoption is successful, QOpenGLContext::format() will return a QSurfaceFormat
+ describing this pixel format.
+
+ \note The window specified by \a window must have its pixel format set to a
+ format compatible with the context's. If no SetPixelFormat() call was made on
+ any device context belonging to the window, adopting the context will fail.
+
+ Ownership of the created QOpenGLContext \a shareContext is transferred to the
+ caller.
+*/
+
+/*!
+ \fn HGLRC QNativeInterface::QWGLContext::nativeContext() const
+
+ \return the underlying context handle.
+*/
+
+/*!
+ \fn HMODULE QNativeInterface::QWGLContext::openGLModuleHandle()
+
+ \return the handle for the OpenGL implementation that is currently in use.
+
+ \note This function requires that the QGuiApplication instance is already created.
+*/
+
+QT_DEFINE_NATIVE_INTERFACE(QWGLContext);
+QT_DEFINE_PRIVATE_NATIVE_INTERFACE(QWindowsGLIntegration);
+
+HMODULE QNativeInterface::QWGLContext::openGLModuleHandle()
+{
+ return QGuiApplicationPrivate::platformIntegration()->call<
+ &QWindowsGLIntegration::openGLModuleHandle>();
+}
+
+QOpenGLContext *QNativeInterface::QWGLContext::fromNative(HGLRC context, HWND window, QOpenGLContext *shareContext)
+{
+ return QGuiApplicationPrivate::platformIntegration()->call<
+ &QWindowsGLIntegration::createOpenGLContext>(context, window, shareContext);
+}
+
+#endif // QT_NO_OPENGL
+
+/*!
+ \class QNativeInterface::Private::QWindowsApplication
+ \since 6.0
+ \internal
+ \brief Native interface to QGuiApplication, to be retrieved from QPlatformIntegration.
+ \inmodule QtGui
+ \ingroup native-interfaces
+*/
+
+QT_DEFINE_PRIVATE_NATIVE_INTERFACE(QWindowsApplication);
+
+/*!
+ \class QNativeInterface::QWindowsScreen
+ \since 6.7
+ \brief Native interface to a screen.
+
+ Accessed through QScreen::nativeInterface().
+ \inmodule QtGui
+ \ingroup native-interfaces
+ \ingroup native-interfaces-qscreen
+*/
+/*!
+ * \fn HWMONITOR QNativeInterface::QWindowsScreen::handle() const;
+ * \return The underlying HWMONITOR of the screen.
+ */
+QT_DEFINE_NATIVE_INTERFACE(QWindowsScreen);
+/*!
+ \enum QNativeInterface::Private::QWindowsApplication::TouchWindowTouchType
+
+ This enum represents the supported TouchWindow touch flags for registerTouchWindow().
+
+ \value NormalTouch
+ \value FineTouch
+ \value WantPalmTouch
+*/
+
+/*!
+ \fn void QNativeInterface::Private::QWindowsApplication::setTouchWindowTouchType(QNativeInterface::Private::QWindowsApplication::TouchWindowTouchTypes type)
+ \internal
+
+ Sets the touch window type for all windows to \a type.
+*/
+
+/*!
+ \fn QNativeInterface::Private::QWindowsApplication::TouchWindowTouchTypes QNativeInterface::Private::QWindowsApplication::touchWindowTouchType() const
+ \internal
+
+ Returns the currently set the touch window type.
+*/
+
+/*!
+ \enum QNativeInterface::Private::QWindowsApplication::WindowActivationBehavior
+
+ This enum specifies the behavior of QWidget::activateWindow() and
+ QWindow::requestActivate().
+
+ \value DefaultActivateWindow The window is activated according to the default
+ behavior of the Windows operating system. This means the window will not
+ be activated in some circumstances (most notably when the calling process
+ is not the active process); only the taskbar entry will be flashed.
+ \value AlwaysActivateWindow The window is always activated, even when the
+ calling process is not the active process.
+
+ \sa QWidget::activateWindow(), QWindow::requestActivate()
+*/
+
+/*!
+ \fn void QNativeInterface::Private::QWindowsApplication::setWindowActivationBehavior(QNativeInterface::Private::QWindowsApplication::WindowActivationBehavior behavior)
+ \internal
+
+ Sets the window activation behavior to \a behavior.
+
+ \sa QWidget::activateWindow(), QWindow::requestActivate()
+*/
+
+/*!
+ \fn QNativeInterface::Private::QWindowsApplication::WindowActivationBehavior QNativeInterface::Private::QWindowsApplication::windowActivationBehavior() const
+ \internal
+
+ Returns the currently set the window activation behavior.
+*/
+
+/*!
+ \fn bool QNativeInterface::Private::QWindowsApplication::isTabletMode() const
+ \internal
+
+ Returns \c true if Windows 10 operates in \e{Tablet Mode}.
+ In this mode, Windows forces all application main windows to open in maximized
+ state. Applications should then avoid resizing windows or restoring geometries
+ to non-maximized states.
+
+ \sa QWidget::showMaximized(), QWidget::saveGeometry(), QWidget::restoreGeometry()
+*/
+
+/*!
+ \enum QNativeInterface::Private::QWindowsApplication::DarkModeHandlingFlag
+
+ This enum specifies the behavior of the application when Windows
+ is configured to use dark mode for applications.
+
+ \value DarkModeWindowFrames The window frames will be switched to dark.
+ \value DarkModeStyle The Windows Vista style will be turned off and
+ a simple dark style will be used.
+
+ \sa setDarkModeHandling()
+*/
+
+/*!
+ \fn void QNativeInterface::Private::QWindowsApplication::setDarkModeHandling(DarkModeHandling handling) = 0
+ \internal
+
+ Sets the dark mode handling to \a handling.
+*/
+
+/*!
+ \fn QNativeInterface::Private::QWindowsApplication::DarkModeHandling QNativeInterface::Private::QWindowsApplication::darkModeHandling() const
+ \internal
+
+ Returns the currently set dark mode handling.
+*/
+
+/*!
+ \fn bool QNativeInterface::Private::QWindowsApplication::isWinTabEnabled() const = 0
+ \internal
+
+ Returns whether the \e{Tablet WinTab Driver} (\c Wintab32.dll) is used.
+*/
+
+/*!
+ \fn bool QNativeInterface::Private::QWindowsApplication::setWinTabEnabled(bool enabled)
+ \internal
+
+ Sets whether the \e{Tablet WinTab Driver} (\c Wintab32.dll) should be used to \a enabled.
+
+ Returns \c true on success, \c false otherwise.
+*/
+
+/*!
+ \fn bool QNativeInterface::Private::QWindowsApplication::registerMime(QWindowsMimeConverter *mime)
+ \internal
+
+ Registers the converter \a mime to the system.
+
+ \sa QWindowsMimeConverter, unregisterMime()
+*/
+
+/*!
+ \fn void QNativeInterface::Private::QWindowsApplication::unregisterMime(QWindowsMimeConverter *mime)
+ \internal
+
+ Unregisters the converter \a mime from the system.
+
+ \sa QWindowsMimeConverter, registerMime()
+*/
+
+/*!
+ \fn int QNativeInterface::Private::QWindowsApplication::registerMimeType(const QString &mime)
+ \internal
+
+ Registers the MIME type \a mime, and returns an ID number
+ identifying the format on Windows.
+*/
+
+/*!
+ \fn HWND QNativeInterface::Private::QWindowsApplication::createMessageWindow(const QString &, const QString &, QFunctionPointer) const
+ \internal
+*/
+
+/*!
+ \fn bool QNativeInterface::Private::QWindowsApplication::asyncExpose() const
+ \internal
+*/
+
+/*!
+ \fn void QNativeInterface::Private::QWindowsApplication::setAsyncExpose(bool)
+ \internal
+*/
+
+/*!
+ \fn QVariant QNativeInterface::Private::QWindowsApplication::gpu()
+ \internal
+*/
+
+/*!
+ \fn QVariant QNativeInterface::Private::QWindowsApplication::gpuList()
+ \internal
+*/
+
+/*!
+ \class QNativeInterface::Private::QWindowsWindow
+ \since 6.0
+ \internal
+ \brief Native interface to QPlatformWindow.
+ \inmodule QtGui
+ \ingroup native-interfaces
+*/
+
+QT_DEFINE_PRIVATE_NATIVE_INTERFACE(QWindowsWindow);
+
+/*!
+ \fn void QNativeInterface::Private::QWindowsWindow::setHasBorderInFullScreen(bool border)
+ \internal
+
+ Sets whether the WS_BORDER flag will be set for the window in full screen mode
+ to \a border.
+
+ See also \l [QtDoc] {Fullscreen OpenGL Based Windows}
+*/
+
+/*!
+ \fn bool QNativeInterface::Private::QWindowsWindow::hasBorderInFullScreen() const
+ \internal
+
+ Returns whether the WS_BORDER flag will be set for the window in full screen
+ mode.
+*/
+
+/*!
+ \fn QMargins QNativeInterface::Private::QWindowsWindow::customMargins() const
+ \internal
+
+ Returns the margin to be used when handling the \c WM_NCCALCSIZE message.
+*/
+
+/*!
+ \fn void QNativeInterface::Private::QWindowsWindow::setCustomMargins(const QMargins &margins)
+ \internal
+
+ Sets the\a margins to be used when handling the \c WM_NCCALCSIZE message. It is
+ possible to remove a frame border by specifying a negative value.
+*/
+
+QT_END_NAMESPACE
diff --git a/src/gui/platform/windows/qwindowsthemecache.cpp b/src/gui/platform/windows/qwindowsthemecache.cpp
new file mode 100644
index 0000000000..3bb92e67ca
--- /dev/null
+++ b/src/gui/platform/windows/qwindowsthemecache.cpp
@@ -0,0 +1,79 @@
+// Copyright (C) 2023 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
+
+#include "qwindowsthemecache_p.h"
+#include <QtCore/qdebug.h>
+#include <QtCore/qhash.h>
+
+QT_BEGIN_NAMESPACE
+
+// Theme names matching the QWindowsVistaStylePrivate::Theme enumeration.
+constexpr const wchar_t *themeNames[] = {
+ L"BUTTON", L"COMBOBOX", L"EDIT", L"HEADER", L"LISTVIEW",
+ L"MENU", L"PROGRESS", L"REBAR", L"SCROLLBAR", L"SPIN",
+ L"TAB", L"TASKDIALOG", L"TOOLBAR", L"TOOLTIP", L"TRACKBAR",
+ L"WINDOW", L"STATUS", L"TREEVIEW"
+};
+
+typedef std::array<HTHEME, std::size(themeNames)> ThemeArray;
+typedef QHash<HWND, ThemeArray> ThemesCache;
+Q_GLOBAL_STATIC(ThemesCache, themesCache);
+
+QString QWindowsThemeCache::themeName(int theme)
+{
+ return theme >= 0 && theme < int(std::size(themeNames))
+ ? QString::fromWCharArray(themeNames[theme]) : QString();
+}
+
+HTHEME QWindowsThemeCache::createTheme(int theme, HWND hwnd)
+{
+ if (Q_UNLIKELY(theme < 0 || theme >= int(std::size(themeNames)) || !hwnd)) {
+ qWarning("Invalid parameters #%d, %p", theme, hwnd);
+ return nullptr;
+ }
+
+ // Get or create themes array for this window.
+ ThemesCache *cache = themesCache();
+ auto it = cache->find(hwnd);
+ if (it == cache->end())
+ it = cache->insert(hwnd, ThemeArray {});
+
+ // Get or create theme data
+ ThemeArray &themes = *it;
+ if (!themes[theme]) {
+ const wchar_t *name = themeNames[theme];
+ themes[theme] = OpenThemeData(hwnd, name);
+ if (Q_UNLIKELY(!themes[theme]))
+ qErrnoWarning("OpenThemeData() failed for theme %d (%s).",
+ theme, qPrintable(themeName(theme)));
+ }
+ return themes[theme];
+}
+
+static void clearThemes(ThemeArray &themes)
+{
+ for (auto &theme : themes) {
+ if (theme) {
+ CloseThemeData(theme);
+ theme = nullptr;
+ }
+ }
+}
+
+void QWindowsThemeCache::clearThemeCache(HWND hwnd)
+{
+ ThemesCache *cache = themesCache();
+ auto it = cache->find(hwnd);
+ if (it == cache->end())
+ return;
+ clearThemes(*it);
+}
+
+void QWindowsThemeCache::clearAllThemeCaches()
+{
+ ThemesCache *cache = themesCache();
+ for (auto &themeArray : *cache)
+ clearThemes(themeArray);
+}
+
+QT_END_NAMESPACE
diff --git a/src/gui/platform/windows/qwindowsthemecache_p.h b/src/gui/platform/windows/qwindowsthemecache_p.h
new file mode 100644
index 0000000000..beb724dc5c
--- /dev/null
+++ b/src/gui/platform/windows/qwindowsthemecache_p.h
@@ -0,0 +1,35 @@
+// Copyright (C) 2023 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
+
+#ifndef QWINDOWSTHEME_CACHE_P_H
+#define QWINDOWSTHEME_CACHE_P_H
+
+//
+// W A R N I N G
+// -------------
+//
+// This file is not part of the Qt API. It exists purely as an
+// implementation detail. This header file may change from version to
+// version without notice, or even be removed.
+//
+// We mean it.
+//
+
+#include "QtGui/private/qtguiglobal_p.h"
+
+#include <QtCore/qt_windows.h>
+#include <uxtheme.h>
+
+QT_BEGIN_NAMESPACE
+
+namespace QWindowsThemeCache
+{
+ Q_GUI_EXPORT QString themeName(int theme);
+ Q_GUI_EXPORT HTHEME createTheme(int theme, HWND hwnd);
+ Q_GUI_EXPORT void clearThemeCache(HWND hwnd);
+ Q_GUI_EXPORT void clearAllThemeCaches();
+}
+
+QT_END_NAMESPACE
+
+#endif // QWINDOWSTHEME_CACHE_P_H
diff --git a/src/gui/qt_cmdline.cmake b/src/gui/qt_cmdline.cmake
new file mode 100644
index 0000000000..379cc417e7
--- /dev/null
+++ b/src/gui/qt_cmdline.cmake
@@ -0,0 +1,38 @@
+# Copyright (C) 2022 The Qt Company Ltd.
+# SPDX-License-Identifier: BSD-3-Clause
+
+qt_commandline_option(accessibility TYPE boolean)
+qt_commandline_option(direct2d TYPE boolean)
+qt_commandline_option(directfb TYPE boolean)
+qt_commandline_option(directwrite TYPE boolean)
+qt_commandline_option(egl TYPE boolean)
+qt_commandline_option(eglfs TYPE boolean)
+qt_commandline_option(evdev TYPE boolean)
+qt_commandline_option(fontconfig TYPE boolean)
+qt_commandline_option(freetype TYPE enum VALUES no qt system)
+qt_commandline_option(gbm TYPE boolean)
+qt_commandline_option(gif TYPE boolean)
+qt_commandline_option(harfbuzz TYPE enum VALUES no qt system)
+qt_commandline_option(ico TYPE boolean)
+qt_commandline_option(imf TYPE boolean NAME qqnx_imf)
+qt_commandline_option(kms TYPE boolean)
+qt_commandline_option(lgmon TYPE boolean)
+qt_commandline_option(libinput TYPE boolean)
+qt_commandline_option(libjpeg TYPE enum VALUES no qt system)
+qt_commandline_option(libmd4c TYPE enum VALUES no qt system)
+qt_commandline_option(libpng TYPE enum VALUES no qt system)
+qt_commandline_option(linuxfb TYPE boolean)
+qt_commandline_option(mtdev TYPE boolean)
+qt_commandline_option(opengl TYPE optionalString VALUES no yes desktop es2 dynamic)
+qt_commandline_option(opengl-es-2 TYPE void NAME opengl VALUE es2)
+qt_commandline_option(opengles3 TYPE boolean)
+qt_commandline_option(openvg TYPE boolean)
+qt_commandline_option(qpa TYPE string NAME qpa_default_platform)
+qt_commandline_option(sm TYPE boolean NAME sessionmanager)
+qt_commandline_option(tslib TYPE boolean)
+qt_commandline_option(vulkan TYPE boolean)
+qt_commandline_option(xcb TYPE boolean)
+qt_commandline_option(bundled-xcb-xinput TYPE boolean)
+qt_commandline_option(xcb-native-painting TYPE boolean)
+qt_commandline_option(xcb-xlib TYPE boolean)
+qt_commandline_option(xkbcommon TYPE boolean)
diff --git a/src/gui/qtgui.tracepoints b/src/gui/qtgui.tracepoints
deleted file mode 100644
index 52916a3aa2..0000000000
--- a/src/gui/qtgui.tracepoints
+++ /dev/null
@@ -1,19 +0,0 @@
-{
-QT_BEGIN_NAMESPACE
-class QImageReader;
-QT_END_NAMESPACE
-}
-
-QGuiApplicationPrivate_init_entry()
-QGuiApplicationPrivate_init_exit()
-
-QGuiApplicationPrivate_processWindowSystemEvent_entry(int type)
-QGuiApplicationPrivate_processWindowSystemEvent_exit()
-
-QFontDatabase_addApplicationFont(const QString &filename)
-QFontDatabase_load(const QString &family, int pointSize)
-QFontDatabase_loadEngine(const QString &family, int pointSize)
-QFontDatabasePrivate_addAppFont(const QString &fileName)
-
-QImageReader_read_before_reading(QImageReader *reader, const QString &filename)
-QImageReader_read_after_reading(QImageReader *reader, bool result)
diff --git a/src/gui/painting/WEBGRADIENTS_LICENSE.txt b/src/gui/rhi/MiniEngine_LICENSE.txt
index 1a4d527a4d..b8b569d774 100644
--- a/src/gui/painting/WEBGRADIENTS_LICENSE.txt
+++ b/src/gui/rhi/MiniEngine_LICENSE.txt
@@ -1,6 +1,6 @@
-MIT License
+The MIT License (MIT)
-Copyright (c) 2017 itmeo
+Copyright (c) 2015 Microsoft
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
@@ -19,3 +19,4 @@ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
+
diff --git a/src/gui/rhi/cs_mipmap_p.h b/src/gui/rhi/cs_mipmap_p.h
new file mode 100644
index 0000000000..317cbe7b2e
--- /dev/null
+++ b/src/gui/rhi/cs_mipmap_p.h
@@ -0,0 +1,939 @@
+// Copyright (C) 2023 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
+
+#ifndef CS_MIPMAP_P_H
+#define CS_MIPMAP_P_H
+
+//
+// W A R N I N G
+// -------------
+//
+// This file is not part of the Qt API. It exists for the convenience
+// of other Qt classes. This header file may change from version to
+// version without notice, or even be removed.
+//
+// We mean it.
+//
+
+#include <QtCore/private/qglobal_p.h>
+
+#ifdef Q_OS_WIN
+
+#include <qt_windows.h>
+
+#if 0
+//
+// Generated by Microsoft (R) HLSL Shader Compiler 10.1
+//
+//
+// Buffer Definitions:
+//
+// cbuffer CB0
+// {
+//
+// uint SrcMipLevel; // Offset: 0 Size: 4
+// uint NumMipLevels; // Offset: 4 Size: 4
+// float2 TexelSize; // Offset: 8 Size: 8
+//
+// }
+//
+//
+// Resource Bindings:
+//
+// Name Type Format Dim HLSL Bind Count
+// ------------------------------ ---------- ------- ----------- -------------- ------
+// BilinearClamp sampler NA NA s0 1
+// SrcMip texture float4 2d t0 1
+// OutMip1 UAV float4 2d u0 1
+// OutMip2 UAV float4 2d u1 1
+// OutMip3 UAV float4 2d u2 1
+// OutMip4 UAV float4 2d u3 1
+// CB0 cbuffer NA NA cb0 1
+//
+//
+//
+// Input signature:
+//
+// Name Index Mask Register SysValue Format Used
+// -------------------- ----- ------ -------- -------- ------- ------
+// no Input
+//
+// Output signature:
+//
+// Name Index Mask Register SysValue Format Used
+// -------------------- ----- ------ -------- -------- ------- ------
+// no Output
+cs_5_0
+dcl_globalFlags refactoringAllowed
+dcl_constantbuffer CB0[1], immediateIndexed
+dcl_sampler s0, mode_default
+dcl_resource_texture2d (float,float,float,float) t0
+dcl_uav_typed_texture2d (float,float,float,float) u0
+dcl_uav_typed_texture2d (float,float,float,float) u1
+dcl_uav_typed_texture2d (float,float,float,float) u2
+dcl_uav_typed_texture2d (float,float,float,float) u3
+dcl_input vThreadIDInGroupFlattened
+dcl_input vThreadID.xy
+dcl_temps 6
+dcl_tgsm_structured g0, 4, 64
+dcl_tgsm_structured g1, 4, 64
+dcl_tgsm_structured g2, 4, 64
+dcl_tgsm_structured g3, 4, 64
+dcl_thread_group 8, 8, 1
+utof r0.xy, vThreadID.xyxx
+add r0.xy, r0.xyxx, l(0.250000, 0.250000, 0.000000, 0.000000)
+mul r0.zw, r0.xxxy, cb0[0].zzzw
+utof r1.x, cb0[0].x
+sample_l_indexable(texture2d)(float,float,float,float) r2.xyzw, r0.zwzz, t0.xyzw, s0, r1.x
+mul r3.xyz, cb0[0].zwzz, l(0.500000, 0.500000, 0.500000, 0.000000)
+mov r3.w, l(0)
+mad r3.xyzw, cb0[0].zwzw, r0.xyxy, r3.zwxy
+sample_l_indexable(texture2d)(float,float,float,float) r4.xyzw, r3.xyxx, t0.xyzw, s0, r1.x
+add r2.xyzw, r2.xyzw, r4.xyzw
+mov r3.x, l(0)
+mul r3.y, cb0[0].w, l(0.500000)
+mad r0.xy, cb0[0].zwzz, r0.xyxx, r3.xyxx
+sample_l_indexable(texture2d)(float,float,float,float) r0.xyzw, r0.xyxx, t0.xyzw, s0, r1.x
+add r0.xyzw, r0.xyzw, r2.xyzw
+sample_l_indexable(texture2d)(float,float,float,float) r1.xyzw, r3.zwzz, t0.xyzw, s0, r1.x
+add r0.xyzw, r0.xyzw, r1.xyzw
+mul r1.xyzw, r0.xyzw, l(0.250000, 0.250000, 0.250000, 0.250000)
+store_uav_typed u0.xyzw, vThreadID.xyyy, r1.xyzw
+ieq r2.x, cb0[0].y, l(1)
+if_nz r2.x
+ ret
+endif
+store_structured g0.x, vThreadIDInGroupFlattened.x, l(0), r1.x
+store_structured g1.x, vThreadIDInGroupFlattened.x, l(0), r1.y
+store_structured g2.x, vThreadIDInGroupFlattened.x, l(0), r1.z
+store_structured g3.x, vThreadIDInGroupFlattened.x, l(0), r1.w
+sync_g_t
+and r2.x, vThreadIDInGroupFlattened.x, l(9)
+if_z r2.x
+ iadd r2.xyz, vThreadIDInGroupFlattened.xxxx, l(1, 8, 9, 0)
+ ld_structured r3.x, r2.x, l(0), g0.xxxx
+ ld_structured r3.y, r2.x, l(0), g1.xxxx
+ ld_structured r3.z, r2.x, l(0), g2.xxxx
+ ld_structured r3.w, r2.x, l(0), g3.xxxx
+ ld_structured r4.x, r2.y, l(0), g0.xxxx
+ ld_structured r4.y, r2.y, l(0), g1.xxxx
+ ld_structured r4.z, r2.y, l(0), g2.xxxx
+ ld_structured r4.w, r2.y, l(0), g3.xxxx
+ ld_structured r5.x, r2.z, l(0), g0.xxxx
+ ld_structured r5.y, r2.z, l(0), g1.xxxx
+ ld_structured r5.z, r2.z, l(0), g2.xxxx
+ ld_structured r5.w, r2.z, l(0), g3.xxxx
+ mad r0.xyzw, r0.xyzw, l(0.250000, 0.250000, 0.250000, 0.250000), r3.xyzw
+ add r0.xyzw, r4.xyzw, r0.xyzw
+ add r0.xyzw, r5.xyzw, r0.xyzw
+ mul r1.xyzw, r0.xyzw, l(0.250000, 0.250000, 0.250000, 0.250000)
+ ushr r0.xyzw, vThreadID.xyyy, l(1, 1, 1, 1)
+ store_uav_typed u1.xyzw, r0.xyzw, r1.xyzw
+ store_structured g0.x, vThreadIDInGroupFlattened.x, l(0), r1.x
+ store_structured g1.x, vThreadIDInGroupFlattened.x, l(0), r1.y
+ store_structured g2.x, vThreadIDInGroupFlattened.x, l(0), r1.z
+ store_structured g3.x, vThreadIDInGroupFlattened.x, l(0), r1.w
+endif
+ieq r0.x, cb0[0].y, l(2)
+if_nz r0.x
+ ret
+endif
+sync_g_t
+and r0.x, vThreadIDInGroupFlattened.x, l(27)
+if_z r0.x
+ iadd r0.xyz, vThreadIDInGroupFlattened.xxxx, l(2, 16, 18, 0)
+ ld_structured r2.x, r0.x, l(0), g0.xxxx
+ ld_structured r2.y, r0.x, l(0), g1.xxxx
+ ld_structured r2.z, r0.x, l(0), g2.xxxx
+ ld_structured r2.w, r0.x, l(0), g3.xxxx
+ ld_structured r3.x, r0.y, l(0), g0.xxxx
+ ld_structured r3.y, r0.y, l(0), g1.xxxx
+ ld_structured r3.z, r0.y, l(0), g2.xxxx
+ ld_structured r3.w, r0.y, l(0), g3.xxxx
+ ld_structured r4.x, r0.z, l(0), g0.xxxx
+ ld_structured r4.y, r0.z, l(0), g1.xxxx
+ ld_structured r4.z, r0.z, l(0), g2.xxxx
+ ld_structured r4.w, r0.z, l(0), g3.xxxx
+ add r0.xyzw, r1.xyzw, r2.xyzw
+ add r0.xyzw, r3.xyzw, r0.xyzw
+ add r0.xyzw, r4.xyzw, r0.xyzw
+ mul r1.xyzw, r0.xyzw, l(0.250000, 0.250000, 0.250000, 0.250000)
+ ushr r0.xyzw, vThreadID.xyyy, l(2, 2, 2, 2)
+ store_uav_typed u2.xyzw, r0.xyzw, r1.xyzw
+ store_structured g0.x, vThreadIDInGroupFlattened.x, l(0), r1.x
+ store_structured g1.x, vThreadIDInGroupFlattened.x, l(0), r1.y
+ store_structured g2.x, vThreadIDInGroupFlattened.x, l(0), r1.z
+ store_structured g3.x, vThreadIDInGroupFlattened.x, l(0), r1.w
+endif
+ieq r0.x, cb0[0].y, l(3)
+if_nz r0.x
+ ret
+endif
+sync_g_t
+if_z vThreadIDInGroupFlattened.x
+ ld_structured r0.x, l(4), l(0), g0.xxxx
+ ld_structured r0.y, l(4), l(0), g1.xxxx
+ ld_structured r0.z, l(4), l(0), g2.xxxx
+ ld_structured r0.w, l(4), l(0), g3.xxxx
+ ld_structured r2.x, l(32), l(0), g0.xxxx
+ ld_structured r2.y, l(32), l(0), g1.xxxx
+ ld_structured r2.z, l(32), l(0), g2.xxxx
+ ld_structured r2.w, l(32), l(0), g3.xxxx
+ ld_structured r3.x, l(36), l(0), g0.xxxx
+ ld_structured r3.y, l(36), l(0), g1.xxxx
+ ld_structured r3.z, l(36), l(0), g2.xxxx
+ ld_structured r3.w, l(36), l(0), g3.xxxx
+ add r0.xyzw, r0.xyzw, r1.xyzw
+ add r0.xyzw, r2.xyzw, r0.xyzw
+ add r0.xyzw, r3.xyzw, r0.xyzw
+ mul r0.xyzw, r0.xyzw, l(0.250000, 0.250000, 0.250000, 0.250000)
+ ushr r1.xyzw, vThreadID.xyyy, l(3, 3, 3, 3)
+ store_uav_typed u3.xyzw, r1.xyzw, r0.xyzw
+endif
+ret
+// Approximately 111 instruction slots used
+#endif
+
+inline constexpr BYTE g_csMipmap[] =
+{
+ 68, 88, 66, 67, 133, 122,
+ 5, 181, 163, 163, 140, 185,
+ 158, 179, 4, 65, 180, 238,
+ 158, 10, 1, 0, 0, 0,
+ 60, 17, 0, 0, 5, 0,
+ 0, 0, 52, 0, 0, 0,
+ 200, 2, 0, 0, 216, 2,
+ 0, 0, 232, 2, 0, 0,
+ 160, 16, 0, 0, 82, 68,
+ 69, 70, 140, 2, 0, 0,
+ 1, 0, 0, 0, 88, 1,
+ 0, 0, 7, 0, 0, 0,
+ 60, 0, 0, 0, 0, 5,
+ 83, 67, 0, 1, 0, 0,
+ 100, 2, 0, 0, 82, 68,
+ 49, 49, 60, 0, 0, 0,
+ 24, 0, 0, 0, 32, 0,
+ 0, 0, 40, 0, 0, 0,
+ 36, 0, 0, 0, 12, 0,
+ 0, 0, 0, 0, 0, 0,
+ 28, 1, 0, 0, 3, 0,
+ 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 1, 0, 0, 0, 1, 0,
+ 0, 0, 42, 1, 0, 0,
+ 2, 0, 0, 0, 5, 0,
+ 0, 0, 4, 0, 0, 0,
+ 255, 255, 255, 255, 0, 0,
+ 0, 0, 1, 0, 0, 0,
+ 13, 0, 0, 0, 49, 1,
+ 0, 0, 4, 0, 0, 0,
+ 5, 0, 0, 0, 4, 0,
+ 0, 0, 255, 255, 255, 255,
+ 0, 0, 0, 0, 1, 0,
+ 0, 0, 13, 0, 0, 0,
+ 57, 1, 0, 0, 4, 0,
+ 0, 0, 5, 0, 0, 0,
+ 4, 0, 0, 0, 255, 255,
+ 255, 255, 1, 0, 0, 0,
+ 1, 0, 0, 0, 13, 0,
+ 0, 0, 65, 1, 0, 0,
+ 4, 0, 0, 0, 5, 0,
+ 0, 0, 4, 0, 0, 0,
+ 255, 255, 255, 255, 2, 0,
+ 0, 0, 1, 0, 0, 0,
+ 13, 0, 0, 0, 73, 1,
+ 0, 0, 4, 0, 0, 0,
+ 5, 0, 0, 0, 4, 0,
+ 0, 0, 255, 255, 255, 255,
+ 3, 0, 0, 0, 1, 0,
+ 0, 0, 13, 0, 0, 0,
+ 81, 1, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 1, 0, 0, 0, 1, 0,
+ 0, 0, 66, 105, 108, 105,
+ 110, 101, 97, 114, 67, 108,
+ 97, 109, 112, 0, 83, 114,
+ 99, 77, 105, 112, 0, 79,
+ 117, 116, 77, 105, 112, 49,
+ 0, 79, 117, 116, 77, 105,
+ 112, 50, 0, 79, 117, 116,
+ 77, 105, 112, 51, 0, 79,
+ 117, 116, 77, 105, 112, 52,
+ 0, 67, 66, 48, 0, 171,
+ 171, 171, 81, 1, 0, 0,
+ 3, 0, 0, 0, 112, 1,
+ 0, 0, 16, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 0, 0, 232, 1, 0, 0,
+ 0, 0, 0, 0, 4, 0,
+ 0, 0, 2, 0, 0, 0,
+ 252, 1, 0, 0, 0, 0,
+ 0, 0, 255, 255, 255, 255,
+ 0, 0, 0, 0, 255, 255,
+ 255, 255, 0, 0, 0, 0,
+ 32, 2, 0, 0, 4, 0,
+ 0, 0, 4, 0, 0, 0,
+ 2, 0, 0, 0, 252, 1,
+ 0, 0, 0, 0, 0, 0,
+ 255, 255, 255, 255, 0, 0,
+ 0, 0, 255, 255, 255, 255,
+ 0, 0, 0, 0, 45, 2,
+ 0, 0, 8, 0, 0, 0,
+ 8, 0, 0, 0, 2, 0,
+ 0, 0, 64, 2, 0, 0,
+ 0, 0, 0, 0, 255, 255,
+ 255, 255, 0, 0, 0, 0,
+ 255, 255, 255, 255, 0, 0,
+ 0, 0, 83, 114, 99, 77,
+ 105, 112, 76, 101, 118, 101,
+ 108, 0, 100, 119, 111, 114,
+ 100, 0, 171, 171, 0, 0,
+ 19, 0, 1, 0, 1, 0,
+ 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 244, 1, 0, 0, 78, 117,
+ 109, 77, 105, 112, 76, 101,
+ 118, 101, 108, 115, 0, 84,
+ 101, 120, 101, 108, 83, 105,
+ 122, 101, 0, 102, 108, 111,
+ 97, 116, 50, 0, 171, 171,
+ 1, 0, 3, 0, 1, 0,
+ 2, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 0, 0, 55, 2, 0, 0,
+ 77, 105, 99, 114, 111, 115,
+ 111, 102, 116, 32, 40, 82,
+ 41, 32, 72, 76, 83, 76,
+ 32, 83, 104, 97, 100, 101,
+ 114, 32, 67, 111, 109, 112,
+ 105, 108, 101, 114, 32, 49,
+ 48, 46, 49, 0, 73, 83,
+ 71, 78, 8, 0, 0, 0,
+ 0, 0, 0, 0, 8, 0,
+ 0, 0, 79, 83, 71, 78,
+ 8, 0, 0, 0, 0, 0,
+ 0, 0, 8, 0, 0, 0,
+ 83, 72, 69, 88, 176, 13,
+ 0, 0, 80, 0, 5, 0,
+ 108, 3, 0, 0, 106, 8,
+ 0, 1, 89, 0, 0, 4,
+ 70, 142, 32, 0, 0, 0,
+ 0, 0, 1, 0, 0, 0,
+ 90, 0, 0, 3, 0, 96,
+ 16, 0, 0, 0, 0, 0,
+ 88, 24, 0, 4, 0, 112,
+ 16, 0, 0, 0, 0, 0,
+ 85, 85, 0, 0, 156, 24,
+ 0, 4, 0, 224, 17, 0,
+ 0, 0, 0, 0, 85, 85,
+ 0, 0, 156, 24, 0, 4,
+ 0, 224, 17, 0, 1, 0,
+ 0, 0, 85, 85, 0, 0,
+ 156, 24, 0, 4, 0, 224,
+ 17, 0, 2, 0, 0, 0,
+ 85, 85, 0, 0, 156, 24,
+ 0, 4, 0, 224, 17, 0,
+ 3, 0, 0, 0, 85, 85,
+ 0, 0, 95, 0, 0, 2,
+ 0, 64, 2, 0, 95, 0,
+ 0, 2, 50, 0, 2, 0,
+ 104, 0, 0, 2, 6, 0,
+ 0, 0, 160, 0, 0, 5,
+ 0, 240, 17, 0, 0, 0,
+ 0, 0, 4, 0, 0, 0,
+ 64, 0, 0, 0, 160, 0,
+ 0, 5, 0, 240, 17, 0,
+ 1, 0, 0, 0, 4, 0,
+ 0, 0, 64, 0, 0, 0,
+ 160, 0, 0, 5, 0, 240,
+ 17, 0, 2, 0, 0, 0,
+ 4, 0, 0, 0, 64, 0,
+ 0, 0, 160, 0, 0, 5,
+ 0, 240, 17, 0, 3, 0,
+ 0, 0, 4, 0, 0, 0,
+ 64, 0, 0, 0, 155, 0,
+ 0, 4, 8, 0, 0, 0,
+ 8, 0, 0, 0, 1, 0,
+ 0, 0, 86, 0, 0, 4,
+ 50, 0, 16, 0, 0, 0,
+ 0, 0, 70, 0, 2, 0,
+ 0, 0, 0, 10, 50, 0,
+ 16, 0, 0, 0, 0, 0,
+ 70, 0, 16, 0, 0, 0,
+ 0, 0, 2, 64, 0, 0,
+ 0, 0, 128, 62, 0, 0,
+ 128, 62, 0, 0, 0, 0,
+ 0, 0, 0, 0, 56, 0,
+ 0, 8, 194, 0, 16, 0,
+ 0, 0, 0, 0, 6, 4,
+ 16, 0, 0, 0, 0, 0,
+ 166, 142, 32, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 86, 0, 0, 6, 18, 0,
+ 16, 0, 1, 0, 0, 0,
+ 10, 128, 32, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 72, 0, 0, 141, 194, 0,
+ 0, 128, 67, 85, 21, 0,
+ 242, 0, 16, 0, 2, 0,
+ 0, 0, 230, 10, 16, 0,
+ 0, 0, 0, 0, 70, 126,
+ 16, 0, 0, 0, 0, 0,
+ 0, 96, 16, 0, 0, 0,
+ 0, 0, 10, 0, 16, 0,
+ 1, 0, 0, 0, 56, 0,
+ 0, 11, 114, 0, 16, 0,
+ 3, 0, 0, 0, 230, 138,
+ 32, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 2, 64,
+ 0, 0, 0, 0, 0, 63,
+ 0, 0, 0, 63, 0, 0,
+ 0, 63, 0, 0, 0, 0,
+ 54, 0, 0, 5, 130, 0,
+ 16, 0, 3, 0, 0, 0,
+ 1, 64, 0, 0, 0, 0,
+ 0, 0, 50, 0, 0, 10,
+ 242, 0, 16, 0, 3, 0,
+ 0, 0, 230, 142, 32, 0,
+ 0, 0, 0, 0, 0, 0,
+ 0, 0, 70, 4, 16, 0,
+ 0, 0, 0, 0, 230, 4,
+ 16, 0, 3, 0, 0, 0,
+ 72, 0, 0, 141, 194, 0,
+ 0, 128, 67, 85, 21, 0,
+ 242, 0, 16, 0, 4, 0,
+ 0, 0, 70, 0, 16, 0,
+ 3, 0, 0, 0, 70, 126,
+ 16, 0, 0, 0, 0, 0,
+ 0, 96, 16, 0, 0, 0,
+ 0, 0, 10, 0, 16, 0,
+ 1, 0, 0, 0, 0, 0,
+ 0, 7, 242, 0, 16, 0,
+ 2, 0, 0, 0, 70, 14,
+ 16, 0, 2, 0, 0, 0,
+ 70, 14, 16, 0, 4, 0,
+ 0, 0, 54, 0, 0, 5,
+ 18, 0, 16, 0, 3, 0,
+ 0, 0, 1, 64, 0, 0,
+ 0, 0, 0, 0, 56, 0,
+ 0, 8, 34, 0, 16, 0,
+ 3, 0, 0, 0, 58, 128,
+ 32, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 1, 64,
+ 0, 0, 0, 0, 0, 63,
+ 50, 0, 0, 10, 50, 0,
+ 16, 0, 0, 0, 0, 0,
+ 230, 138, 32, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 70, 0, 16, 0, 0, 0,
+ 0, 0, 70, 0, 16, 0,
+ 3, 0, 0, 0, 72, 0,
+ 0, 141, 194, 0, 0, 128,
+ 67, 85, 21, 0, 242, 0,
+ 16, 0, 0, 0, 0, 0,
+ 70, 0, 16, 0, 0, 0,
+ 0, 0, 70, 126, 16, 0,
+ 0, 0, 0, 0, 0, 96,
+ 16, 0, 0, 0, 0, 0,
+ 10, 0, 16, 0, 1, 0,
+ 0, 0, 0, 0, 0, 7,
+ 242, 0, 16, 0, 0, 0,
+ 0, 0, 70, 14, 16, 0,
+ 0, 0, 0, 0, 70, 14,
+ 16, 0, 2, 0, 0, 0,
+ 72, 0, 0, 141, 194, 0,
+ 0, 128, 67, 85, 21, 0,
+ 242, 0, 16, 0, 1, 0,
+ 0, 0, 230, 10, 16, 0,
+ 3, 0, 0, 0, 70, 126,
+ 16, 0, 0, 0, 0, 0,
+ 0, 96, 16, 0, 0, 0,
+ 0, 0, 10, 0, 16, 0,
+ 1, 0, 0, 0, 0, 0,
+ 0, 7, 242, 0, 16, 0,
+ 0, 0, 0, 0, 70, 14,
+ 16, 0, 0, 0, 0, 0,
+ 70, 14, 16, 0, 1, 0,
+ 0, 0, 56, 0, 0, 10,
+ 242, 0, 16, 0, 1, 0,
+ 0, 0, 70, 14, 16, 0,
+ 0, 0, 0, 0, 2, 64,
+ 0, 0, 0, 0, 128, 62,
+ 0, 0, 128, 62, 0, 0,
+ 128, 62, 0, 0, 128, 62,
+ 164, 0, 0, 6, 242, 224,
+ 17, 0, 0, 0, 0, 0,
+ 70, 5, 2, 0, 70, 14,
+ 16, 0, 1, 0, 0, 0,
+ 32, 0, 0, 8, 18, 0,
+ 16, 0, 2, 0, 0, 0,
+ 26, 128, 32, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 1, 64, 0, 0, 1, 0,
+ 0, 0, 31, 0, 4, 3,
+ 10, 0, 16, 0, 2, 0,
+ 0, 0, 62, 0, 0, 1,
+ 21, 0, 0, 1, 168, 0,
+ 0, 8, 18, 240, 17, 0,
+ 0, 0, 0, 0, 10, 64,
+ 2, 0, 1, 64, 0, 0,
+ 0, 0, 0, 0, 10, 0,
+ 16, 0, 1, 0, 0, 0,
+ 168, 0, 0, 8, 18, 240,
+ 17, 0, 1, 0, 0, 0,
+ 10, 64, 2, 0, 1, 64,
+ 0, 0, 0, 0, 0, 0,
+ 26, 0, 16, 0, 1, 0,
+ 0, 0, 168, 0, 0, 8,
+ 18, 240, 17, 0, 2, 0,
+ 0, 0, 10, 64, 2, 0,
+ 1, 64, 0, 0, 0, 0,
+ 0, 0, 42, 0, 16, 0,
+ 1, 0, 0, 0, 168, 0,
+ 0, 8, 18, 240, 17, 0,
+ 3, 0, 0, 0, 10, 64,
+ 2, 0, 1, 64, 0, 0,
+ 0, 0, 0, 0, 58, 0,
+ 16, 0, 1, 0, 0, 0,
+ 190, 24, 0, 1, 1, 0,
+ 0, 6, 18, 0, 16, 0,
+ 2, 0, 0, 0, 10, 64,
+ 2, 0, 1, 64, 0, 0,
+ 9, 0, 0, 0, 31, 0,
+ 0, 3, 10, 0, 16, 0,
+ 2, 0, 0, 0, 30, 0,
+ 0, 9, 114, 0, 16, 0,
+ 2, 0, 0, 0, 6, 64,
+ 2, 0, 2, 64, 0, 0,
+ 1, 0, 0, 0, 8, 0,
+ 0, 0, 9, 0, 0, 0,
+ 0, 0, 0, 0, 167, 0,
+ 0, 9, 18, 0, 16, 0,
+ 3, 0, 0, 0, 10, 0,
+ 16, 0, 2, 0, 0, 0,
+ 1, 64, 0, 0, 0, 0,
+ 0, 0, 6, 240, 17, 0,
+ 0, 0, 0, 0, 167, 0,
+ 0, 9, 34, 0, 16, 0,
+ 3, 0, 0, 0, 10, 0,
+ 16, 0, 2, 0, 0, 0,
+ 1, 64, 0, 0, 0, 0,
+ 0, 0, 6, 240, 17, 0,
+ 1, 0, 0, 0, 167, 0,
+ 0, 9, 66, 0, 16, 0,
+ 3, 0, 0, 0, 10, 0,
+ 16, 0, 2, 0, 0, 0,
+ 1, 64, 0, 0, 0, 0,
+ 0, 0, 6, 240, 17, 0,
+ 2, 0, 0, 0, 167, 0,
+ 0, 9, 130, 0, 16, 0,
+ 3, 0, 0, 0, 10, 0,
+ 16, 0, 2, 0, 0, 0,
+ 1, 64, 0, 0, 0, 0,
+ 0, 0, 6, 240, 17, 0,
+ 3, 0, 0, 0, 167, 0,
+ 0, 9, 18, 0, 16, 0,
+ 4, 0, 0, 0, 26, 0,
+ 16, 0, 2, 0, 0, 0,
+ 1, 64, 0, 0, 0, 0,
+ 0, 0, 6, 240, 17, 0,
+ 0, 0, 0, 0, 167, 0,
+ 0, 9, 34, 0, 16, 0,
+ 4, 0, 0, 0, 26, 0,
+ 16, 0, 2, 0, 0, 0,
+ 1, 64, 0, 0, 0, 0,
+ 0, 0, 6, 240, 17, 0,
+ 1, 0, 0, 0, 167, 0,
+ 0, 9, 66, 0, 16, 0,
+ 4, 0, 0, 0, 26, 0,
+ 16, 0, 2, 0, 0, 0,
+ 1, 64, 0, 0, 0, 0,
+ 0, 0, 6, 240, 17, 0,
+ 2, 0, 0, 0, 167, 0,
+ 0, 9, 130, 0, 16, 0,
+ 4, 0, 0, 0, 26, 0,
+ 16, 0, 2, 0, 0, 0,
+ 1, 64, 0, 0, 0, 0,
+ 0, 0, 6, 240, 17, 0,
+ 3, 0, 0, 0, 167, 0,
+ 0, 9, 18, 0, 16, 0,
+ 5, 0, 0, 0, 42, 0,
+ 16, 0, 2, 0, 0, 0,
+ 1, 64, 0, 0, 0, 0,
+ 0, 0, 6, 240, 17, 0,
+ 0, 0, 0, 0, 167, 0,
+ 0, 9, 34, 0, 16, 0,
+ 5, 0, 0, 0, 42, 0,
+ 16, 0, 2, 0, 0, 0,
+ 1, 64, 0, 0, 0, 0,
+ 0, 0, 6, 240, 17, 0,
+ 1, 0, 0, 0, 167, 0,
+ 0, 9, 66, 0, 16, 0,
+ 5, 0, 0, 0, 42, 0,
+ 16, 0, 2, 0, 0, 0,
+ 1, 64, 0, 0, 0, 0,
+ 0, 0, 6, 240, 17, 0,
+ 2, 0, 0, 0, 167, 0,
+ 0, 9, 130, 0, 16, 0,
+ 5, 0, 0, 0, 42, 0,
+ 16, 0, 2, 0, 0, 0,
+ 1, 64, 0, 0, 0, 0,
+ 0, 0, 6, 240, 17, 0,
+ 3, 0, 0, 0, 50, 0,
+ 0, 12, 242, 0, 16, 0,
+ 0, 0, 0, 0, 70, 14,
+ 16, 0, 0, 0, 0, 0,
+ 2, 64, 0, 0, 0, 0,
+ 128, 62, 0, 0, 128, 62,
+ 0, 0, 128, 62, 0, 0,
+ 128, 62, 70, 14, 16, 0,
+ 3, 0, 0, 0, 0, 0,
+ 0, 7, 242, 0, 16, 0,
+ 0, 0, 0, 0, 70, 14,
+ 16, 0, 4, 0, 0, 0,
+ 70, 14, 16, 0, 0, 0,
+ 0, 0, 0, 0, 0, 7,
+ 242, 0, 16, 0, 0, 0,
+ 0, 0, 70, 14, 16, 0,
+ 5, 0, 0, 0, 70, 14,
+ 16, 0, 0, 0, 0, 0,
+ 56, 0, 0, 10, 242, 0,
+ 16, 0, 1, 0, 0, 0,
+ 70, 14, 16, 0, 0, 0,
+ 0, 0, 2, 64, 0, 0,
+ 0, 0, 128, 62, 0, 0,
+ 128, 62, 0, 0, 128, 62,
+ 0, 0, 128, 62, 85, 0,
+ 0, 9, 242, 0, 16, 0,
+ 0, 0, 0, 0, 70, 5,
+ 2, 0, 2, 64, 0, 0,
+ 1, 0, 0, 0, 1, 0,
+ 0, 0, 1, 0, 0, 0,
+ 1, 0, 0, 0, 164, 0,
+ 0, 7, 242, 224, 17, 0,
+ 1, 0, 0, 0, 70, 14,
+ 16, 0, 0, 0, 0, 0,
+ 70, 14, 16, 0, 1, 0,
+ 0, 0, 168, 0, 0, 8,
+ 18, 240, 17, 0, 0, 0,
+ 0, 0, 10, 64, 2, 0,
+ 1, 64, 0, 0, 0, 0,
+ 0, 0, 10, 0, 16, 0,
+ 1, 0, 0, 0, 168, 0,
+ 0, 8, 18, 240, 17, 0,
+ 1, 0, 0, 0, 10, 64,
+ 2, 0, 1, 64, 0, 0,
+ 0, 0, 0, 0, 26, 0,
+ 16, 0, 1, 0, 0, 0,
+ 168, 0, 0, 8, 18, 240,
+ 17, 0, 2, 0, 0, 0,
+ 10, 64, 2, 0, 1, 64,
+ 0, 0, 0, 0, 0, 0,
+ 42, 0, 16, 0, 1, 0,
+ 0, 0, 168, 0, 0, 8,
+ 18, 240, 17, 0, 3, 0,
+ 0, 0, 10, 64, 2, 0,
+ 1, 64, 0, 0, 0, 0,
+ 0, 0, 58, 0, 16, 0,
+ 1, 0, 0, 0, 21, 0,
+ 0, 1, 32, 0, 0, 8,
+ 18, 0, 16, 0, 0, 0,
+ 0, 0, 26, 128, 32, 0,
+ 0, 0, 0, 0, 0, 0,
+ 0, 0, 1, 64, 0, 0,
+ 2, 0, 0, 0, 31, 0,
+ 4, 3, 10, 0, 16, 0,
+ 0, 0, 0, 0, 62, 0,
+ 0, 1, 21, 0, 0, 1,
+ 190, 24, 0, 1, 1, 0,
+ 0, 6, 18, 0, 16, 0,
+ 0, 0, 0, 0, 10, 64,
+ 2, 0, 1, 64, 0, 0,
+ 27, 0, 0, 0, 31, 0,
+ 0, 3, 10, 0, 16, 0,
+ 0, 0, 0, 0, 30, 0,
+ 0, 9, 114, 0, 16, 0,
+ 0, 0, 0, 0, 6, 64,
+ 2, 0, 2, 64, 0, 0,
+ 2, 0, 0, 0, 16, 0,
+ 0, 0, 18, 0, 0, 0,
+ 0, 0, 0, 0, 167, 0,
+ 0, 9, 18, 0, 16, 0,
+ 2, 0, 0, 0, 10, 0,
+ 16, 0, 0, 0, 0, 0,
+ 1, 64, 0, 0, 0, 0,
+ 0, 0, 6, 240, 17, 0,
+ 0, 0, 0, 0, 167, 0,
+ 0, 9, 34, 0, 16, 0,
+ 2, 0, 0, 0, 10, 0,
+ 16, 0, 0, 0, 0, 0,
+ 1, 64, 0, 0, 0, 0,
+ 0, 0, 6, 240, 17, 0,
+ 1, 0, 0, 0, 167, 0,
+ 0, 9, 66, 0, 16, 0,
+ 2, 0, 0, 0, 10, 0,
+ 16, 0, 0, 0, 0, 0,
+ 1, 64, 0, 0, 0, 0,
+ 0, 0, 6, 240, 17, 0,
+ 2, 0, 0, 0, 167, 0,
+ 0, 9, 130, 0, 16, 0,
+ 2, 0, 0, 0, 10, 0,
+ 16, 0, 0, 0, 0, 0,
+ 1, 64, 0, 0, 0, 0,
+ 0, 0, 6, 240, 17, 0,
+ 3, 0, 0, 0, 167, 0,
+ 0, 9, 18, 0, 16, 0,
+ 3, 0, 0, 0, 26, 0,
+ 16, 0, 0, 0, 0, 0,
+ 1, 64, 0, 0, 0, 0,
+ 0, 0, 6, 240, 17, 0,
+ 0, 0, 0, 0, 167, 0,
+ 0, 9, 34, 0, 16, 0,
+ 3, 0, 0, 0, 26, 0,
+ 16, 0, 0, 0, 0, 0,
+ 1, 64, 0, 0, 0, 0,
+ 0, 0, 6, 240, 17, 0,
+ 1, 0, 0, 0, 167, 0,
+ 0, 9, 66, 0, 16, 0,
+ 3, 0, 0, 0, 26, 0,
+ 16, 0, 0, 0, 0, 0,
+ 1, 64, 0, 0, 0, 0,
+ 0, 0, 6, 240, 17, 0,
+ 2, 0, 0, 0, 167, 0,
+ 0, 9, 130, 0, 16, 0,
+ 3, 0, 0, 0, 26, 0,
+ 16, 0, 0, 0, 0, 0,
+ 1, 64, 0, 0, 0, 0,
+ 0, 0, 6, 240, 17, 0,
+ 3, 0, 0, 0, 167, 0,
+ 0, 9, 18, 0, 16, 0,
+ 4, 0, 0, 0, 42, 0,
+ 16, 0, 0, 0, 0, 0,
+ 1, 64, 0, 0, 0, 0,
+ 0, 0, 6, 240, 17, 0,
+ 0, 0, 0, 0, 167, 0,
+ 0, 9, 34, 0, 16, 0,
+ 4, 0, 0, 0, 42, 0,
+ 16, 0, 0, 0, 0, 0,
+ 1, 64, 0, 0, 0, 0,
+ 0, 0, 6, 240, 17, 0,
+ 1, 0, 0, 0, 167, 0,
+ 0, 9, 66, 0, 16, 0,
+ 4, 0, 0, 0, 42, 0,
+ 16, 0, 0, 0, 0, 0,
+ 1, 64, 0, 0, 0, 0,
+ 0, 0, 6, 240, 17, 0,
+ 2, 0, 0, 0, 167, 0,
+ 0, 9, 130, 0, 16, 0,
+ 4, 0, 0, 0, 42, 0,
+ 16, 0, 0, 0, 0, 0,
+ 1, 64, 0, 0, 0, 0,
+ 0, 0, 6, 240, 17, 0,
+ 3, 0, 0, 0, 0, 0,
+ 0, 7, 242, 0, 16, 0,
+ 0, 0, 0, 0, 70, 14,
+ 16, 0, 1, 0, 0, 0,
+ 70, 14, 16, 0, 2, 0,
+ 0, 0, 0, 0, 0, 7,
+ 242, 0, 16, 0, 0, 0,
+ 0, 0, 70, 14, 16, 0,
+ 3, 0, 0, 0, 70, 14,
+ 16, 0, 0, 0, 0, 0,
+ 0, 0, 0, 7, 242, 0,
+ 16, 0, 0, 0, 0, 0,
+ 70, 14, 16, 0, 4, 0,
+ 0, 0, 70, 14, 16, 0,
+ 0, 0, 0, 0, 56, 0,
+ 0, 10, 242, 0, 16, 0,
+ 1, 0, 0, 0, 70, 14,
+ 16, 0, 0, 0, 0, 0,
+ 2, 64, 0, 0, 0, 0,
+ 128, 62, 0, 0, 128, 62,
+ 0, 0, 128, 62, 0, 0,
+ 128, 62, 85, 0, 0, 9,
+ 242, 0, 16, 0, 0, 0,
+ 0, 0, 70, 5, 2, 0,
+ 2, 64, 0, 0, 2, 0,
+ 0, 0, 2, 0, 0, 0,
+ 2, 0, 0, 0, 2, 0,
+ 0, 0, 164, 0, 0, 7,
+ 242, 224, 17, 0, 2, 0,
+ 0, 0, 70, 14, 16, 0,
+ 0, 0, 0, 0, 70, 14,
+ 16, 0, 1, 0, 0, 0,
+ 168, 0, 0, 8, 18, 240,
+ 17, 0, 0, 0, 0, 0,
+ 10, 64, 2, 0, 1, 64,
+ 0, 0, 0, 0, 0, 0,
+ 10, 0, 16, 0, 1, 0,
+ 0, 0, 168, 0, 0, 8,
+ 18, 240, 17, 0, 1, 0,
+ 0, 0, 10, 64, 2, 0,
+ 1, 64, 0, 0, 0, 0,
+ 0, 0, 26, 0, 16, 0,
+ 1, 0, 0, 0, 168, 0,
+ 0, 8, 18, 240, 17, 0,
+ 2, 0, 0, 0, 10, 64,
+ 2, 0, 1, 64, 0, 0,
+ 0, 0, 0, 0, 42, 0,
+ 16, 0, 1, 0, 0, 0,
+ 168, 0, 0, 8, 18, 240,
+ 17, 0, 3, 0, 0, 0,
+ 10, 64, 2, 0, 1, 64,
+ 0, 0, 0, 0, 0, 0,
+ 58, 0, 16, 0, 1, 0,
+ 0, 0, 21, 0, 0, 1,
+ 32, 0, 0, 8, 18, 0,
+ 16, 0, 0, 0, 0, 0,
+ 26, 128, 32, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 1, 64, 0, 0, 3, 0,
+ 0, 0, 31, 0, 4, 3,
+ 10, 0, 16, 0, 0, 0,
+ 0, 0, 62, 0, 0, 1,
+ 21, 0, 0, 1, 190, 24,
+ 0, 1, 31, 0, 0, 2,
+ 10, 64, 2, 0, 167, 0,
+ 0, 9, 18, 0, 16, 0,
+ 0, 0, 0, 0, 1, 64,
+ 0, 0, 4, 0, 0, 0,
+ 1, 64, 0, 0, 0, 0,
+ 0, 0, 6, 240, 17, 0,
+ 0, 0, 0, 0, 167, 0,
+ 0, 9, 34, 0, 16, 0,
+ 0, 0, 0, 0, 1, 64,
+ 0, 0, 4, 0, 0, 0,
+ 1, 64, 0, 0, 0, 0,
+ 0, 0, 6, 240, 17, 0,
+ 1, 0, 0, 0, 167, 0,
+ 0, 9, 66, 0, 16, 0,
+ 0, 0, 0, 0, 1, 64,
+ 0, 0, 4, 0, 0, 0,
+ 1, 64, 0, 0, 0, 0,
+ 0, 0, 6, 240, 17, 0,
+ 2, 0, 0, 0, 167, 0,
+ 0, 9, 130, 0, 16, 0,
+ 0, 0, 0, 0, 1, 64,
+ 0, 0, 4, 0, 0, 0,
+ 1, 64, 0, 0, 0, 0,
+ 0, 0, 6, 240, 17, 0,
+ 3, 0, 0, 0, 167, 0,
+ 0, 9, 18, 0, 16, 0,
+ 2, 0, 0, 0, 1, 64,
+ 0, 0, 32, 0, 0, 0,
+ 1, 64, 0, 0, 0, 0,
+ 0, 0, 6, 240, 17, 0,
+ 0, 0, 0, 0, 167, 0,
+ 0, 9, 34, 0, 16, 0,
+ 2, 0, 0, 0, 1, 64,
+ 0, 0, 32, 0, 0, 0,
+ 1, 64, 0, 0, 0, 0,
+ 0, 0, 6, 240, 17, 0,
+ 1, 0, 0, 0, 167, 0,
+ 0, 9, 66, 0, 16, 0,
+ 2, 0, 0, 0, 1, 64,
+ 0, 0, 32, 0, 0, 0,
+ 1, 64, 0, 0, 0, 0,
+ 0, 0, 6, 240, 17, 0,
+ 2, 0, 0, 0, 167, 0,
+ 0, 9, 130, 0, 16, 0,
+ 2, 0, 0, 0, 1, 64,
+ 0, 0, 32, 0, 0, 0,
+ 1, 64, 0, 0, 0, 0,
+ 0, 0, 6, 240, 17, 0,
+ 3, 0, 0, 0, 167, 0,
+ 0, 9, 18, 0, 16, 0,
+ 3, 0, 0, 0, 1, 64,
+ 0, 0, 36, 0, 0, 0,
+ 1, 64, 0, 0, 0, 0,
+ 0, 0, 6, 240, 17, 0,
+ 0, 0, 0, 0, 167, 0,
+ 0, 9, 34, 0, 16, 0,
+ 3, 0, 0, 0, 1, 64,
+ 0, 0, 36, 0, 0, 0,
+ 1, 64, 0, 0, 0, 0,
+ 0, 0, 6, 240, 17, 0,
+ 1, 0, 0, 0, 167, 0,
+ 0, 9, 66, 0, 16, 0,
+ 3, 0, 0, 0, 1, 64,
+ 0, 0, 36, 0, 0, 0,
+ 1, 64, 0, 0, 0, 0,
+ 0, 0, 6, 240, 17, 0,
+ 2, 0, 0, 0, 167, 0,
+ 0, 9, 130, 0, 16, 0,
+ 3, 0, 0, 0, 1, 64,
+ 0, 0, 36, 0, 0, 0,
+ 1, 64, 0, 0, 0, 0,
+ 0, 0, 6, 240, 17, 0,
+ 3, 0, 0, 0, 0, 0,
+ 0, 7, 242, 0, 16, 0,
+ 0, 0, 0, 0, 70, 14,
+ 16, 0, 0, 0, 0, 0,
+ 70, 14, 16, 0, 1, 0,
+ 0, 0, 0, 0, 0, 7,
+ 242, 0, 16, 0, 0, 0,
+ 0, 0, 70, 14, 16, 0,
+ 2, 0, 0, 0, 70, 14,
+ 16, 0, 0, 0, 0, 0,
+ 0, 0, 0, 7, 242, 0,
+ 16, 0, 0, 0, 0, 0,
+ 70, 14, 16, 0, 3, 0,
+ 0, 0, 70, 14, 16, 0,
+ 0, 0, 0, 0, 56, 0,
+ 0, 10, 242, 0, 16, 0,
+ 0, 0, 0, 0, 70, 14,
+ 16, 0, 0, 0, 0, 0,
+ 2, 64, 0, 0, 0, 0,
+ 128, 62, 0, 0, 128, 62,
+ 0, 0, 128, 62, 0, 0,
+ 128, 62, 85, 0, 0, 9,
+ 242, 0, 16, 0, 1, 0,
+ 0, 0, 70, 5, 2, 0,
+ 2, 64, 0, 0, 3, 0,
+ 0, 0, 3, 0, 0, 0,
+ 3, 0, 0, 0, 3, 0,
+ 0, 0, 164, 0, 0, 7,
+ 242, 224, 17, 0, 3, 0,
+ 0, 0, 70, 14, 16, 0,
+ 1, 0, 0, 0, 70, 14,
+ 16, 0, 0, 0, 0, 0,
+ 21, 0, 0, 1, 62, 0,
+ 0, 1, 83, 84, 65, 84,
+ 148, 0, 0, 0, 111, 0,
+ 0, 0, 6, 0, 0, 0,
+ 0, 0, 0, 0, 2, 0,
+ 0, 0, 22, 0, 0, 0,
+ 5, 0, 0, 0, 5, 0,
+ 0, 0, 4, 0, 0, 0,
+ 6, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 4, 0,
+ 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 0, 0, 2, 0, 0, 0,
+ 0, 0, 0, 0, 2, 0,
+ 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 0, 0, 3, 0, 0, 0,
+ 0, 0, 0, 0, 4, 0,
+ 0, 0
+};
+
+#endif // Q_OS_WIN
+
+#endif // CS_MIPMAP_P_H
diff --git a/src/gui/rhi/cs_tdr_p.h b/src/gui/rhi/cs_tdr_p.h
deleted file mode 100644
index 620a4a101d..0000000000
--- a/src/gui/rhi/cs_tdr_p.h
+++ /dev/null
@@ -1,225 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2019 The Qt Company Ltd.
-** Contact: http://www.qt.io/licensing/
-**
-** This file is part of the Qt Gui module
-**
-** $QT_BEGIN_LICENSE:LGPL3$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef CS_TDR_P_H
-#define CS_TDR_P_H
-
-//
-// W A R N I N G
-// -------------
-//
-// This file is not part of the Qt API. It exists for the convenience
-// of other Qt classes. This header file may change from version to
-// version without notice, or even be removed.
-//
-// We mean it.
-//
-
-#include <QtCore/qglobal.h>
-
-#ifdef Q_OS_WIN
-
-#include <qt_windows.h>
-
-#if 0
-//
-// Generated by Microsoft (R) HLSL Shader Compiler 10.1
-//
-//
-// Buffer Definitions:
-//
-// cbuffer ConstantBuffer
-// {
-//
-// uint zero; // Offset: 0 Size: 4
-//
-// }
-//
-//
-// Resource Bindings:
-//
-// Name Type Format Dim HLSL Bind Count
-// ------------------------------ ---------- ------- ----------- -------------- ------
-// uav UAV uint buf u0 1
-// ConstantBuffer cbuffer NA NA cb0 1
-//
-//
-//
-// Input signature:
-//
-// Name Index Mask Register SysValue Format Used
-// -------------------- ----- ------ -------- -------- ------- ------
-// no Input
-//
-// Output signature:
-//
-// Name Index Mask Register SysValue Format Used
-// -------------------- ----- ------ -------- -------- ------- ------
-// no Output
-cs_5_0
-dcl_globalFlags refactoringAllowed
-dcl_constantbuffer CB0[1], immediateIndexed
-dcl_uav_typed_buffer (uint,uint,uint,uint) u0
-dcl_input vThreadID.x
-dcl_thread_group 256, 1, 1
-loop
- breakc_nz cb0[0].x
- store_uav_typed u0.xyzw, vThreadID.xxxx, cb0[0].xxxx
-endloop
-ret
-// Approximately 5 instruction slots used
-#endif
-
-const BYTE g_killDeviceByTimingOut[] =
-{
- 68, 88, 66, 67, 217, 62,
- 220, 38, 136, 51, 86, 245,
- 161, 96, 18, 35, 141, 17,
- 26, 13, 1, 0, 0, 0,
- 164, 2, 0, 0, 5, 0,
- 0, 0, 52, 0, 0, 0,
- 100, 1, 0, 0, 116, 1,
- 0, 0, 132, 1, 0, 0,
- 8, 2, 0, 0, 82, 68,
- 69, 70, 40, 1, 0, 0,
- 1, 0, 0, 0, 144, 0,
- 0, 0, 2, 0, 0, 0,
- 60, 0, 0, 0, 0, 5,
- 83, 67, 0, 1, 0, 0,
- 0, 1, 0, 0, 82, 68,
- 49, 49, 60, 0, 0, 0,
- 24, 0, 0, 0, 32, 0,
- 0, 0, 40, 0, 0, 0,
- 36, 0, 0, 0, 12, 0,
- 0, 0, 0, 0, 0, 0,
- 124, 0, 0, 0, 4, 0,
- 0, 0, 4, 0, 0, 0,
- 1, 0, 0, 0, 255, 255,
- 255, 255, 0, 0, 0, 0,
- 1, 0, 0, 0, 0, 0,
- 0, 0, 128, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
- 0, 0, 1, 0, 0, 0,
- 0, 0, 0, 0, 117, 97,
- 118, 0, 67, 111, 110, 115,
- 116, 97, 110, 116, 66, 117,
- 102, 102, 101, 114, 0, 171,
- 128, 0, 0, 0, 1, 0,
- 0, 0, 168, 0, 0, 0,
- 16, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
- 208, 0, 0, 0, 0, 0,
- 0, 0, 4, 0, 0, 0,
- 2, 0, 0, 0, 220, 0,
- 0, 0, 0, 0, 0, 0,
- 255, 255, 255, 255, 0, 0,
- 0, 0, 255, 255, 255, 255,
- 0, 0, 0, 0, 122, 101,
- 114, 111, 0, 100, 119, 111,
- 114, 100, 0, 171, 0, 0,
- 19, 0, 1, 0, 1, 0,
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
- 213, 0, 0, 0, 77, 105,
- 99, 114, 111, 115, 111, 102,
- 116, 32, 40, 82, 41, 32,
- 72, 76, 83, 76, 32, 83,
- 104, 97, 100, 101, 114, 32,
- 67, 111, 109, 112, 105, 108,
- 101, 114, 32, 49, 48, 46,
- 49, 0, 73, 83, 71, 78,
- 8, 0, 0, 0, 0, 0,
- 0, 0, 8, 0, 0, 0,
- 79, 83, 71, 78, 8, 0,
- 0, 0, 0, 0, 0, 0,
- 8, 0, 0, 0, 83, 72,
- 69, 88, 124, 0, 0, 0,
- 80, 0, 5, 0, 31, 0,
- 0, 0, 106, 8, 0, 1,
- 89, 0, 0, 4, 70, 142,
- 32, 0, 0, 0, 0, 0,
- 1, 0, 0, 0, 156, 8,
- 0, 4, 0, 224, 17, 0,
- 0, 0, 0, 0, 68, 68,
- 0, 0, 95, 0, 0, 2,
- 18, 0, 2, 0, 155, 0,
- 0, 4, 0, 1, 0, 0,
- 1, 0, 0, 0, 1, 0,
- 0, 0, 48, 0, 0, 1,
- 3, 0, 4, 4, 10, 128,
- 32, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 164, 0,
- 0, 7, 242, 224, 17, 0,
- 0, 0, 0, 0, 6, 0,
- 2, 0, 6, 128, 32, 0,
- 0, 0, 0, 0, 0, 0,
- 0, 0, 22, 0, 0, 1,
- 62, 0, 0, 1, 83, 84,
- 65, 84, 148, 0, 0, 0,
- 5, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
- 1, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 2, 0,
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
- 1, 0, 0, 0
-};
-
-#endif // Q_OS_WIN
-
-#endif // CS_TDR_P_H
diff --git a/src/gui/rhi/mipmap.hlsl b/src/gui/rhi/mipmap.hlsl
new file mode 100644
index 0000000000..ac293e07f9
--- /dev/null
+++ b/src/gui/rhi/mipmap.hlsl
@@ -0,0 +1,117 @@
+// Copyright (c) Microsoft. All rights reserved.
+// This code is licensed under the MIT License (MIT).
+// THIS CODE IS PROVIDED *AS IS* WITHOUT WARRANTY OF
+// ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING ANY
+// IMPLIED WARRANTIES OF FITNESS FOR A PARTICULAR
+// PURPOSE, MERCHANTABILITY, OR NON-INFRINGEMENT.
+
+RWTexture2D<float4> OutMip1 : register(u0);
+RWTexture2D<float4> OutMip2 : register(u1);
+RWTexture2D<float4> OutMip3 : register(u2);
+RWTexture2D<float4> OutMip4 : register(u3);
+Texture2D<float4> SrcMip : register(t0);
+SamplerState BilinearClamp : register(s0);
+
+cbuffer CB0 : register(b0)
+{
+ uint SrcMipLevel; // Texture level of source mip
+ uint NumMipLevels; // Number of OutMips to write: [1, 4]
+ float2 TexelSize; // 1.0 / OutMip1.Dimensions
+}
+
+// The reason for separating channels is to reduce bank conflicts in the
+// local data memory controller. A large stride will cause more threads
+// to collide on the same memory bank.
+groupshared float gs_R[64];
+groupshared float gs_G[64];
+groupshared float gs_B[64];
+groupshared float gs_A[64];
+
+void StoreColor( uint Index, float4 Color )
+{
+ gs_R[Index] = Color.r;
+ gs_G[Index] = Color.g;
+ gs_B[Index] = Color.b;
+ gs_A[Index] = Color.a;
+}
+
+float4 LoadColor( uint Index )
+{
+ return float4( gs_R[Index], gs_G[Index], gs_B[Index], gs_A[Index]);
+}
+
+[numthreads( 8, 8, 1 )]
+void csMain( uint GI : SV_GroupIndex, uint3 DTid : SV_DispatchThreadID )
+{
+ // Use 4 bilinear samples to guarantee we don't undersample when downsizing by more than 2x
+ // in both directions.
+ float2 UV1 = TexelSize * (DTid.xy + float2(0.25, 0.25));
+ float2 O = TexelSize * 0.5;
+ float4 Src1 = SrcMip.SampleLevel(BilinearClamp, UV1, SrcMipLevel);
+ Src1 += SrcMip.SampleLevel(BilinearClamp, UV1 + float2(O.x, 0.0), SrcMipLevel);
+ Src1 += SrcMip.SampleLevel(BilinearClamp, UV1 + float2(0.0, O.y), SrcMipLevel);
+ Src1 += SrcMip.SampleLevel(BilinearClamp, UV1 + float2(O.x, O.y), SrcMipLevel);
+ Src1 *= 0.25;
+
+ OutMip1[DTid.xy] = Src1;
+
+ // A scalar (constant) branch can exit all threads coherently.
+ if (NumMipLevels == 1)
+ return;
+
+ // Without lane swizzle operations, the only way to share data with other
+ // threads is through LDS.
+ StoreColor(GI, Src1);
+
+ // This guarantees all LDS writes are complete and that all threads have
+ // executed all instructions so far (and therefore have issued their LDS
+ // write instructions.)
+ GroupMemoryBarrierWithGroupSync();
+
+ // With low three bits for X and high three bits for Y, this bit mask
+ // (binary: 001001) checks that X and Y are even.
+ if ((GI & 0x9) == 0)
+ {
+ float4 Src2 = LoadColor(GI + 0x01);
+ float4 Src3 = LoadColor(GI + 0x08);
+ float4 Src4 = LoadColor(GI + 0x09);
+ Src1 = 0.25 * (Src1 + Src2 + Src3 + Src4);
+
+ OutMip2[DTid.xy / 2] = Src1;
+ StoreColor(GI, Src1);
+ }
+
+ if (NumMipLevels == 2)
+ return;
+
+ GroupMemoryBarrierWithGroupSync();
+
+ // This bit mask (binary: 011011) checks that X and Y are multiples of four.
+ if ((GI & 0x1B) == 0)
+ {
+ float4 Src2 = LoadColor(GI + 0x02);
+ float4 Src3 = LoadColor(GI + 0x10);
+ float4 Src4 = LoadColor(GI + 0x12);
+ Src1 = 0.25 * (Src1 + Src2 + Src3 + Src4);
+
+ OutMip3[DTid.xy / 4] = Src1;
+ StoreColor(GI, Src1);
+ }
+
+ if (NumMipLevels == 3)
+ return;
+
+ GroupMemoryBarrierWithGroupSync();
+
+ // This bit mask would be 111111 (X & Y multiples of 8), but only one
+ // thread fits that criteria.
+ if (GI == 0)
+ {
+ float4 Src2 = LoadColor(GI + 0x04);
+ float4 Src3 = LoadColor(GI + 0x20);
+ float4 Src4 = LoadColor(GI + 0x24);
+ Src1 = 0.25 * (Src1 + Src2 + Src3 + Src4);
+
+ OutMip4[DTid.xy / 8] = Src1;
+ }
+}
diff --git a/src/gui/rhi/qrhi.cpp b/src/gui/rhi/qrhi.cpp
index 58f30deb41..a39709c726 100644
--- a/src/gui/rhi/qrhi.cpp
+++ b/src/gui/rhi/qrhi.cpp
@@ -1,65 +1,37 @@
-/****************************************************************************
-**
-** Copyright (C) 2019 The Qt Company Ltd.
-** Contact: http://www.qt.io/licensing/
-**
-** This file is part of the Qt Gui module
-**
-** $QT_BEGIN_LICENSE:LGPL3$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "qrhi_p_p.h"
+// Copyright (C) 2023 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
+
+#include "qrhi_p.h"
#include <qmath.h>
#include <QLoggingCategory>
-#include "qrhinull_p_p.h"
+#include "qrhinull_p.h"
#ifndef QT_NO_OPENGL
-#include "qrhigles2_p_p.h"
+#include "qrhigles2_p.h"
#endif
#if QT_CONFIG(vulkan)
-#include "qrhivulkan_p_p.h"
+#include "qrhivulkan_p.h"
#endif
#ifdef Q_OS_WIN
-#include "qrhid3d11_p_p.h"
+#include "qrhid3d11_p.h"
+#include "qrhid3d12_p.h"
#endif
-#if defined(Q_OS_MACOS) || defined(Q_OS_IOS)
-#include "qrhimetal_p_p.h"
+#if QT_CONFIG(metal)
+#include "qrhimetal_p.h"
#endif
+#include <memory>
+
QT_BEGIN_NAMESPACE
Q_LOGGING_CATEGORY(QRHI_LOG_INFO, "qt.rhi.general")
/*!
\class QRhi
- \internal
- \inmodule QtGui
+ \ingroup painting-3D
+ \inmodule QtGuiPrivate
+ \inheaderfile rhi/qrhi.h
+ \since 6.6
\brief Accelerated 2D/3D graphics API abstraction.
@@ -70,50 +42,55 @@ Q_LOGGING_CATEGORY(QRHI_LOG_INFO, "qt.rhi.general")
\l{https://developer.apple.com/metal/}{Metal}, and
\l{https://www.khronos.org/vulkan/}{Vulkan}.
- Some of the main design goals are:
-
- \list
-
- \li Simple, minimal, understandable, extensible. Follow the proven path of the
- Qt Quick scenegraph.
-
- \li Aim to be a product - and in the bigger picture, part of a product (Qt) -
- that is usable out of the box both by internal (such as, Qt Quick) and,
- eventually, external users.
-
- \li Not a complete 1:1 wrapper for any of the underlying APIs. The feature set
- is tuned towards the needs of Qt's 2D and 3D offering (QPainter, Qt Quick, Qt
- 3D Studio). Iterate and evolve in a sustainable manner.
-
- \li Intrinsically cross-platform, without reinventing: abstracting
- cross-platform aspects of certain APIs (such as, OpenGL context creation and
- windowing system interfaces, Vulkan instance and surface management) is not in
- scope here. These are delegated to the existing QtGui facilities (QWindow,
- QOpenGLContext, QVulkanInstance) and its backing QPA architecture.
-
- \endlist
+ \warning The QRhi family of classes in the Qt Gui module, including QShader
+ and QShaderDescription, offer limited compatibility guarantees. There are
+ no source or binary compatibility guarantees for these classes, meaning the
+ API is only guaranteed to work with the Qt version the application was
+ developed against. Source incompatible changes are however aimed to be kept
+ at a minimum and will only be made in minor releases (6.7, 6.8, and so on).
+ To use these classes in an application, link to
+ \c{Qt::GuiPrivate} (if using CMake), and include the headers with the \c
+ rhi prefix, for example \c{#include <rhi/qrhi.h>}.
Each QRhi instance is backed by a backend for a specific graphics API. The
selection of the backend is a run time choice and is up to the application
or library that creates the QRhi instance. Some backends are available on
multiple platforms (OpenGL, Vulkan, Null), while APIs specific to a given
platform are only available when running on the platform in question (Metal
- on macOS/iOS/tvOS, Direct3D on Windows).
+ on macOS/iOS, Direct3D on Windows).
The available backends currently are:
\list
- \li OpenGL 2.1 or OpenGL ES 2.0 or newer. Some extensions are utilized when
- present, for example to enable multisample framebuffers.
+ \li OpenGL 2.1 / OpenGL ES 2.0 or newer. Some extensions and newer core
+ specification features are utilized when present, for example to enable
+ multisample framebuffers or compute shaders. Operating in core profile
+ contexts is supported as well. If necessary, applications can query the
+ \l{QRhi::Feature}{feature flags} at runtime to check for features that are
+ not supported in the OpenGL context backing the QRhi. The OpenGL backend
+ builds on QOpenGLContext, QOpenGLFunctions, and the related cross-platform
+ infrastructure of the Qt GUI module.
- \li Direct3D 11.1
+ \li Direct3D 11.1 or newer, with Shader Model 5.0 or newer. When the D3D
+ runtime has no support for 11.1 features or Shader Model 5.0,
+ initialization using an accelerated graphics device will fail, but using
+ the
+ \l{https://learn.microsoft.com/en-us/windows/win32/direct3darticles/directx-warp}{software
+ adapter} is still an option.
- \li Metal
+ \li Direct3D 12 on Windows 10 version 1703 and newer, with Shader Model 5.0
+ or newer. Qt requires ID3D12Device2 to be present, hence the requirement
+ for at least version 1703 of Windows 10. The D3D12 device is by default
+ created with specifying a minimum feature level of
+ \c{D3D_FEATURE_LEVEL_11_0}.
- \li Vulkan 1.0, optionally with some extensions that are part of Vulkan 1.1
+ \li Metal 1.2 or newer.
- \li Null - A "dummy" backend that issues no graphics calls at all.
+ \li Vulkan 1.0 or newer, optionally utilizing some Vulkan 1.1 level
+ features.
+
+ \li Null, a "dummy" backend that issues no graphics calls at all.
\endlist
@@ -123,15 +100,60 @@ Q_LOGGING_CATEGORY(QRHI_LOG_INFO, "qt.rhi.general")
are then generated from that, together with reflection information (inputs,
outputs, shader resources). This is then packed into easily and efficiently
serializable QShader instances. The compilers and tools to generate such
- shaders are not part of QRhi, but the core classes for using such shaders,
- QShader and QShaderDescription, are.
+ shaders are not part of QRhi and the Qt GUI module, but the core classes
+ for using such shaders, QShader and QShaderDescription, are. The APIs and
+ tools for performing compilation and translation are part of the Qt Shader
+ Tools module.
+
+ See the \l{RHI Window Example} for an introductory example of creating a
+ portable, cross-platform application that performs accelerated 3D rendering
+ onto a QWindow using QRhi.
+
+ \section1 An Impression of the API
+
+ To provide a quick look at the API with a short yet complete example that
+ does not involve window-related setup, the following is a complete,
+ runnable cross-platform application that renders 20 frames off-screen, and
+ then saves the generated images to files after reading back the texture
+ contents from the GPU. For an example that renders on-screen, which then
+ involves setting up a QWindow and a swapchain, refer to the
+ \l{RHI Window Example}.
+
+ For brevity, the initialization of the QRhi is done based on the platform:
+ the sample code here chooses Direct 3D 12 on Windows, Metal on macOS and
+ iOS, and Vulkan otherwise. OpenGL and Direct 3D 11 are never used by this
+ application, but support for those could be introduced with a few
+ additional lines.
+
+ \snippet rhioffscreen/main.cpp 0
- \section2 Design Fundamentals
+ The result of the application is 20 \c PNG images (frame0.png -
+ frame19.png). These contain a rotating triangle with varying opacity over a
+ green background.
+
+ The vertex and fragment shaders are expected to be processed and packaged
+ into \c{.qsb} files. The Vulkan-compatible GLSL source code is the
+ following:
+
+ \e color.vert
+ \snippet rhioffscreen/color.vert 0
+
+ \e color.frag
+ \snippet rhioffscreen/color.frag 0
+
+ To manually compile and transpile these shaders to a number of targets
+ (SPIR-V, HLSL, MSL, GLSL) and generate the \c{.qsb} files the application
+ loads at run time, run \c{qsb --qt6 color.vert -o color.vert.qsb} and
+ \c{qsb --qt6 color.frag -o color.frag.qsb}. Alternatively, the Qt Shader
+ Tools module offers build system integration for CMake, the
+ \c qt_add_shaders() CMake function, that can achieve the same at build time.
+
+ \section1 Design Fundamentals
A QRhi cannot be instantiated directly. Instead, use the create()
function. Delete the QRhi instance normally to release the graphics device.
- \section3 Resources
+ \section2 Resources
Instances of classes deriving from QRhiResource, such as, QRhiBuffer,
QRhiTexture, etc., encapsulate zero, one, or more native graphics
@@ -139,51 +161,54 @@ Q_LOGGING_CATEGORY(QRHI_LOG_INFO, "qt.rhi.general")
functions of the QRhi, such as, newBuffer(), newTexture(),
newTextureRenderTarget(), newSwapChain().
- \badcode
- vbuf = rhi->newBuffer(QRhiBuffer::Immutable, QRhiBuffer::VertexBuffer, sizeof(vertexData));
- if (!vbuf->build()) { error }
- ...
+ \code
+ QRhiBuffer *vbuf = rhi->newBuffer(QRhiBuffer::Immutable, QRhiBuffer::VertexBuffer, sizeof(vertexData));
+ if (!vbuf->create()) { error(); }
+ // ...
delete vbuf;
\endcode
\list
- \li The returned value from both create() and functions like newBuffer() is
- owned by the caller.
+ \li The returned value from functions like newBuffer() is always owned by
+ the caller.
- \li Just creating a QRhiResource subclass never allocates or initializes any
- native resources. That is only done when calling the \c build function of a
- subclass, for example, QRhiBuffer::build() or QRhiTexture::build().
+ \li Just creating an instance of a QRhiResource subclass never allocates or
+ initializes any native resources. That is only done when calling the
+ \c create() function of a subclass, for example, QRhiBuffer::create() or
+ QRhiTexture::create().
- \li The exception is
- QRhiTextureRenderTarget::newCompatibleRenderPassDescriptor() and
- QRhiSwapChain::newCompatibleRenderPassDescriptor(). There is no \c build
- operation for these and the returned object is immediately active.
+ \li The exceptions are
+ QRhiTextureRenderTarget::newCompatibleRenderPassDescriptor(),
+ QRhiSwapChain::newCompatibleRenderPassDescriptor(), and
+ QRhiRenderPassDescriptor::newCompatibleRenderPassDescriptor(). There is no
+ \c create() operation for these and the returned object is immediately
+ active.
\li The resource objects themselves are treated as immutable: once a
- resource is built, changing any parameters via the setters, such as,
+ resource has create() called, changing any parameters via the setters, such as,
QRhiTexture::setPixelSize(), has no effect, unless the underlying native
- resource is released and \c build is called again. See more about resource
+ resource is released and \c create() is called again. See more about resource
reuse in the sections below.
\li The underlying native resources are scheduled for releasing by the
- QRhiResource destructor, or by calling QRhiResource::release(). Backends
+ QRhiResource destructor, or by calling QRhiResource::destroy(). Backends
often queue release requests and defer executing them to an unspecified
time, this is hidden from the applications. This way applications do not
have to worry about releasing native resources that may still be in use by
an in-flight frame.
\li Note that this does not mean that a QRhiResource can freely be
- destroyed or release()'d within a frame (that is, in a
- \l{QRhiCommandBuffer::beginFrame()}{beginFrame()} -
- \l{QRhiCommandBuffer::endFrame()}{endFrame()} section). As a general rule,
- all referenced QRhiResource objects must stay unchanged until the frame is
- submitted by calling \l{QRhiCommandBuffer::endFrame()}{endFrame()}. To ease
- this, QRhiResource::releaseAndDestroyLater() is provided as a convenience.
+ destroy()'ed or deleted within a frame (that is, in a
+ \l{QRhi::beginFrame()}{beginFrame()} - \l{QRhi::endFrame()}{endFrame()}
+ section). As a general rule, all referenced QRhiResource objects must stay
+ unchanged until the frame is submitted by calling
+ \l{QRhi::endFrame()}{endFrame()}. To ease this,
+ QRhiResource::deleteLater() is provided as a convenience.
\endlist
- \section3 Command buffers and deferred command execution
+ \section2 Command buffers and deferred command execution
Regardless of the design and capabilities of the underlying graphics API,
all QRhi backends implement some level of command buffers. No
@@ -201,27 +226,37 @@ Q_LOGGING_CATEGORY(QRHI_LOG_INFO, "qt.rhi.general")
relative to a draw call.
Furthermore, instances of QRhiResource subclasses must be treated immutable
- within a frame in which they are referenced in any way. Create or rebuild
+ within a frame in which they are referenced in any way. Create
all resources upfront, before starting to record commands for the next
- frame. Reusing a QRhiResource instance within a frame (by rebuilding it and
+ frame. Reusing a QRhiResource instance within a frame (by calling \c create()
then referencing it again in the same \c{beginFrame - endFrame} section)
should be avoided as it may lead to unexpected results, depending on the
backend.
As a general rule, all referenced QRhiResource objects must stay valid and
unmodified until the frame is submitted by calling
- \l{QRhiCommandBuffer::endFrame()}{endFrame()}. On the other hand, calling
- \l{QRhiResource::release()}{release()} or destroying the QRhiResource are
+ \l{QRhi::endFrame()}{endFrame()}. On the other hand, calling
+ \l{QRhiResource::destroy()}{destroy()} or deleting the QRhiResource are
always safe once the frame is submitted, regardless of the status of the
underlying native resources (which may still be in use by the GPU - but
that is taken care of internally).
Unlike APIs like OpenGL, upload and copy type of commands cannot be mixed
with draw commands. The typical renderer will involve a sequence similar to
- the following: \c{(re)build resources} - \c{begin frame} - \c{record
- uploads and copies} - \c{start renderpass} - \c{record draw calls} - \c{end
- renderpass} - \c{end frame}. Recording copy type of operations happens via
- QRhiResourceUpdateBatch. Such operations are committed typically on
+ the following:
+
+ \list
+ \li (re)create resources
+ \li begin frame
+ \li record/issue uploads and copies
+ \li start recording a render pass
+ \li record draw calls
+ \li end render pass
+ \li end frame
+ \endlist
+
+ Recording copy type of operations happens via QRhiResourceUpdateBatch. Such
+ operations are committed typically on
\l{QRhiCommandBuffer::beginPass()}{beginPass()}.
When working with legacy rendering engines designed for OpenGL, the
@@ -240,7 +275,7 @@ Q_LOGGING_CATEGORY(QRHI_LOG_INFO, "qt.rhi.general")
remain the primary way of operating since this is what fits Qt's various UI
technologies best.
- \section3 Threading
+ \section2 Threading
A QRhi instance and the associated resources can be created and used on any
thread but all usage must be limited to that one single thread. When
@@ -269,7 +304,7 @@ Q_LOGGING_CATEGORY(QRHI_LOG_INFO, "qt.rhi.general")
(gui) thread, but becomes important when a separate, dedicated render
thread is used.
- \section3 Resource synchronization
+ \section2 Resource synchronization
QRhi does not expose APIs for resource barriers or image layout
transitions. Such synchronization is done implicitly by the backends, where
@@ -289,11 +324,11 @@ Q_LOGGING_CATEGORY(QRHI_LOG_INFO, "qt.rhi.general")
different access (one for load, one for store) is supported even within the
same pass.
- \section3 Resource reuse
+ \section2 Resource reuse
From the user's point of view a QRhiResource is reusable immediately after
- calling QRhiResource::release(). With the exception of swapchains, calling
- \c build() on an already built object does an implicit \c release(). This
+ calling QRhiResource::destroy(). With the exception of swapchains, calling
+ \c create() on an already created object does an implicit \c destroy(). This
provides a handy shortcut to reuse a QRhiResource instance with different
parameters, with a new native graphics object underneath.
@@ -304,31 +339,44 @@ Q_LOGGING_CATEGORY(QRHI_LOG_INFO, "qt.rhi.general")
needs changing, destroying and creating a whole new QRhiBuffer or
QRhiSampler would invalidate all references to the old instance. By just
changing the appropriate parameters via QRhiBuffer::setSize() or similar
- and then calling QRhiBuffer::build(), everything works as expected and
+ and then calling QRhiBuffer::create(), everything works as expected and
there is no need to touch the QRhiShaderResourceBindings at all, even
though there is a good chance that under the hood the QRhiBuffer is now
backed by a whole new native buffer.
- \badcode
- ubuf = rhi->newBuffer(QRhiBuffer::Dynamic, QRhiBuffer::UniformBuffer, 256);
- ubuf->build();
+ \code
+ QRhiBuffer *ubuf = rhi->newBuffer(QRhiBuffer::Dynamic, QRhiBuffer::UniformBuffer, 256);
+ ubuf->create();
- srb = rhi->newShaderResourceBindings()
+ QRhiShaderResourceBindings *srb = rhi->newShaderResourceBindings()
srb->setBindings({
QRhiShaderResourceBinding::uniformBuffer(0, QRhiShaderResourceBinding::VertexStage | QRhiShaderResourceBinding::FragmentStage, ubuf)
});
- srb->build();
+ srb->create();
- ...
+ // ...
// now in a later frame we need to grow the buffer to a larger size
ubuf->setSize(512);
- ubuf->build(); // same as ubuf->release(); ubuf->build();
+ ubuf->create(); // same as ubuf->destroy(); ubuf->create();
- // that's it, srb needs no changes whatsoever
+ // srb needs no changes whatsoever, any references in it to ubuf
+ // stay valid. When it comes to internal details, such as that
+ // ubuf may now be backed by a completely different native buffer
+ // resource, that is is recognized and handled automatically by the
+ // next setShaderResources().
\endcode
- \section3 Pooled objects
+ QRhiTextureRenderTarget offers the same contract: calling
+ QRhiCommandBuffer::beginPass() is safe even when one of the render target's
+ associated textures or renderbuffers has been rebuilt (by calling \c
+ create() on it) since the creation of the render target object. This allows
+ the application to resize a texture by setting a new pixel size on the
+ QRhiTexture and calling create(), thus creating a whole new native texture
+ resource underneath, without having to update the QRhiTextureRenderTarget
+ as that will be done implicitly in beginPass().
+
+ \section2 Pooled objects
In addition to resources, there are pooled objects as well, such as,
QRhiResourceUpdateBatch. An instance is retrieved via a \c next function,
@@ -342,35 +390,36 @@ Q_LOGGING_CATEGORY(QRHI_LOG_INFO, "qt.rhi.general")
A typical pattern is thus:
- \badcode
+ \code
QRhiResourceUpdateBatch *resUpdates = rhi->nextResourceUpdateBatch();
- ...
+ // ...
resUpdates->updateDynamicBuffer(ubuf, 0, 64, mvp.constData());
if (!image.isNull()) {
resUpdates->uploadTexture(texture, image);
image = QImage();
}
- ...
+ // ...
QRhiCommandBuffer *cb = m_sc->currentFrameCommandBuffer();
+ // note the last argument
cb->beginPass(swapchain->currentFrameRenderTarget(), clearCol, clearDs, resUpdates);
\endcode
- \section3 Swapchain specifics
+ \section2 Swapchain specifics
QRhiSwapChain features some special semantics due to the peculiar nature of
swapchains.
\list
- \li It has no \c build but rather a QRhiSwapChain::buildOrResize().
+ \li It has no \c create() but rather a QRhiSwapChain::createOrResize().
Repeatedly calling this function is \b not the same as calling
- QRhiSwapChain::release() followed by QRhiSwapChain::buildOrResize(). This
+ QRhiSwapChain::destroy() followed by QRhiSwapChain::createOrResize(). This
is because swapchains often have ways to handle the case where buffers need
to be resized in a manner that is more efficient than a brute force
destroying and recreating from scratch.
\li An active QRhiSwapChain must be released by calling
- \l{QRhiSwapChain::release()}{release()}, or by destroying the object, before
+ \l{QRhiSwapChain::destroy()}{destroy()}, or by destroying the object, before
the QWindow's underlying QPlatformWindow, and so the associated native
window object, is destroyed. It should not be postponed because releasing
the swapchain may become problematic (and with some APIs, like Vulkan, is
@@ -386,30 +435,174 @@ Q_LOGGING_CATEGORY(QRHI_LOG_INFO, "qt.rhi.general")
\endlist
- \section3 Ownership
+ \section2 Ownership
The general rule is no ownership transfer. Creating a QRhi with an already
existing graphics device does not mean the QRhi takes ownership of the
device object. Similarly, ownership is not given away when a device or
texture object is "exported" via QRhi::nativeHandles() or
- QRhiTexture::nativeHandles(). Most importantly, passing pointers in structs
+ QRhiTexture::nativeTexture(). Most importantly, passing pointers in structs
and via setters does not transfer ownership.
- \section2 Troubleshooting
+ \section1 Troubleshooting and Profiling
- Errors are printed to the output via qWarning(). Additional debug messages
- can be enabled via the following logging categories. Messages from these
- categories are not printed by default unless explicitly enabled via
- QRhi::EnableProfiling or the facilities of QLoggingCategory (such as, the
- \c QT_LOGGING_RULES environment variable).
+ \section2 Error reporting
+
+ Functions such as \l QRhi::create() and the resource classes' \c create()
+ member functions (e.g., \l QRhiBuffer::create()) indicate failure with the
+ return value (\nullptr or
+ \c false, respectively). When working with QShader, \l QShader::fromSerialized()
+ returns an invalid QShader (for which \l{QShader::isValid()}{isValid()} returns
+ \c false) when the data passed to the function cannot be successfully deserialized.
+ Some functions, beginFrame() in particular, may also sometimes report "soft failures",
+ such as \l FrameOpSwapChainOutOfDate, which do not indicate an unrecoverable error,
+ but rather should be seen as a "try again later" response.
+
+ Warnings and errors may get printed at any time to the debug output via
+ qWarning(). It is therefore always advisable to inspect the output of the
+ application.
+
+ Additional debug messages can be enabled via the following logging
+ categories. Messages from these categories are not printed by default
+ unless explicitly enabled via QLoggingCategory or the \c QT_LOGGING_RULES
+ environment variable. For better interoperation with Qt Quick, the
+ environment variable \c{QSG_INFO} also enables these debug prints.
\list
\li \c{qt.rhi.general}
\endlist
- It is strongly advised to inspect the output with the logging categories
- (\c{qt.rhi.*}) enabled whenever a QRhi-based application is not behaving as
- expected.
+ Additionally, applications can query the \l{QRhi::backendName()}{QRhi
+ backend name} and
+ \l{QRhi::driverInfo()}{graphics device information} from a successfully
+ initialized QRhi. This can then be printed to the user or stored in the
+ application logs even in production builds, if desired.
+
+ \section2 Investigating rendering problems
+
+ When the rendering results are not as expected, or the application is
+ experiencing problems, always consider checking with the the native 3D
+ APIs' debug and validation facilities. QRhi itself features limited error
+ checking since replicating the already existing, vast amount of
+ functionality in the underlying layers is not reasonable.
+
+ \list
+
+ \li For Vulkan, controlling the
+ \l{https://github.com/KhronosGroup/Vulkan-ValidationLayers}{Vulkan
+ Validation Layers} is not in the scope of the QRhi, but rather can be
+ achieved by configuring the \l QVulkanInstance with the appropriate layers.
+ For example, call \c{instance.setLayers({ "VK_LAYER_KHRONOS_validation" });}
+ before invoking \l{QVulkanInstance::create()}{create()} on the QVulkanInstance.
+ (note that this assumes that the validation layers are actually installed
+ and available, e.g. from the Vulkan SDK) By default, QVulkanInstance conveniently
+ redirects the Vulkan debug messages to qDebug, meaning the validation messages get
+ printed just like other Qt warnings.
+
+ \li With Direct 3D 11 and 12, a graphics device with the debug layer
+ enabled can be requested by toggling the \c enableDebugLayer flag in the
+ appropriate \l{QRhiD3D11InitParams}{init params struct}. The messages appear on the
+ debug output, which is visible in Qt Creator's messages panel or via a tool
+ such as \l{https://learn.microsoft.com/en-us/sysinternals/downloads/debugview}{DebugView}.
+
+ \li For Metal, controlling Metal Validation is outside of QRhi's scope.
+ Rather, to enable validation, run the application with the environment
+ variable \c{METAL_DEVICE_WRAPPER_TYPE=1} set, or run the application within
+ XCode. There may also be further settings and environment variable in modern
+ XCode and macOS versions. See for instance
+ \l{https://developer.apple.com/documentation/metal/diagnosing_metal_programming_issues_early}{this
+ page}.
+
+ \endlist
+
+ \section2 Frame captures and performance profiling
+
+ A Qt application rendering with QRhi to a window while relying on a 3D API
+ under the hood, is, from the windowing and graphics pipeline perspective at
+ least, no different from any other (non-Qt) applications using the same 3D
+ API. This means that tools and practices for debugging and profiling
+ applications involving 3D graphics, such as games, all apply to such a Qt
+ application as well.
+
+ A few examples of tools that can provide insights into the rendering
+ internals of Qt applications that use QRhi, which includes Qt Quick and Qt
+ Quick 3D based projects as well:
+
+ \list
+
+ \li \l{https://renderdoc.org/}{RenderDoc} allows taking frame captures and
+ introspecting the recorded commands and pipeline state on Windows and Linux
+ for applications using OpenGL, Vulkan, D3D11, or D3D12. When trying to
+ figure out why some parts of the 3D scene do not show up as expected,
+ RenderDoc is often a fast and efficient way to check the pipeline stages
+ and the related state and discover the missing or incorrect value. It is
+ also a tool that is actively used when developing Qt itself.
+
+ \li For NVIDIA-based systems,
+ \l{https://developer.nvidia.com/nsight-graphics}{Nsight Graphics} provides
+ a graphics debugger tool on Windows and Linux. In addition to investigating the commands
+ in the frame and the pipeline, the vendor-specific tools allow looking at timings and
+ hardware performance information, which is not something simple frame captures can provide.
+
+ \li For AMD-based systems, the \l{https://gpuopen.com/rgp/}{Radeon GPU
+ Profiler} can be used to gain deeper insights into the application's
+ rendering and its performance.
+
+ \li As QRhi supports Direct 3D 12, using
+ \l{https://devblogs.microsoft.com/pix/download/}{PIX}, a performance tuning
+ and debugging tool for DirectX 12 games on Windows is an option as well.
+
+ \li On macOS,
+ \l{https://developer.apple.com/documentation/metal/debugging_tools/viewing_your_gpu_workload_with_the_metal_debugger}{the
+ XCode Metal debugger} can be used to take and introspect frame
+ captures, to investigate performance details, and debug shaders. In macOS 13 it is also possible
+ to enable an overlay that displays frame rate and other information for any Metal-based window by
+ setting the environment variable \c{MTL_HUD_ENABLED=1}.
+
+ \endlist
+
+ On mobile and embedded platforms, there may be vendor and platform-specific
+ tools, provided by the GPU or SoC vendor, available to perform performance
+ profiling of application using OpenGL ES or Vulkan.
+
+ When capturing frames, remember that objects and groups of commands can be
+ named via debug markers, as long as \l{QRhi::EnableDebugMarkers}{debug
+ markers were enabled} for the QRhi, and the graphics API in use supports
+ this. To annotate the command stream, call
+ \l{QRhiCommandBuffer::debugMarkBegin()}{debugMarkBegin()},
+ \l{QRhiCommandBuffer::debugMarkEnd()}{debugMarkEnd()} and/or
+ \l{QRhiCommandBuffer::debugMarkMsg()}{debugMarkMsg()}.
+ This can be particularly useful in larger frames with multiple render passes.
+ Resources are named by calling \l{QRhiResource::setName()}{setName()} before create().
+
+ To perform basic timing measurements on the CPU and GPU side within the
+ application, \l QElapsedTimer and
+ \l QRhiCommandBuffer::lastCompletedGpuTime() can be used. The latter is
+ only available with select graphics APIs at the moment and requires opting
+ in via the \l QRhi::EnableTimestamps flag.
+
+ \section2 Resource leak checking
+
+ When destroying a QRhi object without properly destroying all buffers,
+ textures, and other resources created from it, warnings about this are
+ printed to the debug output whenever the application is a debug build, or
+ when the \c QT_RHI_LEAK_CHECK environment variable is set to a non-zero
+ value. This is a simple way to discover design issues around resource
+ handling within the application rendering logic. Note however that some
+ platforms and underlying graphics APIs may perform their own allocation and
+ resource leak detection as well, over which Qt will have no direct control.
+ For example, when using Vulkan, the memory allocator may raise failing
+ assertions in debug builds when resources that own graphics memory
+ allocations are not destroyed before the QRhi. In addition, the Vulkan
+ validation layer, when enabled, will issue warnings about native graphics
+ resources that were not released. Similarly, with Direct 3D warnings may
+ get printed about unreleased COM objects when the application does not
+ destroy the QRhi and its resources in the correct order.
+
+ \sa {RHI Window Example}, QRhiCommandBuffer, QRhiResourceUpdateBatch,
+ QRhiShaderResourceBindings, QShader, QRhiBuffer, QRhiTexture,
+ QRhiRenderBuffer, QRhiSampler, QRhiTextureRenderTarget,
+ QRhiGraphicsPipeline, QRhiComputePipeline, QRhiSwapChain
*/
/*!
@@ -420,6 +613,7 @@ Q_LOGGING_CATEGORY(QRHI_LOG_INFO, "qt.rhi.general")
\value Vulkan
\value OpenGLES2
\value D3D11
+ \value D3D12
\value Metal
*/
@@ -427,17 +621,18 @@ Q_LOGGING_CATEGORY(QRHI_LOG_INFO, "qt.rhi.general")
\enum QRhi::Flag
Describes what special features to enable.
- \value EnableProfiling Enables gathering timing (CPU, GPU) and resource
- (QRhiBuffer, QRhiTexture, etc.) information and additional metadata. See
- QRhiProfiler. Avoid enabling in production builds as it may involve a
- performance penalty. Also enables debug messages from the \c{qt.rhi.*}
- logging categories.
-
\value EnableDebugMarkers Enables debug marker groups. Without this frame
debugging features like making debug groups and custom resource name
visible in external GPU debugging tools will not be available and functions
- like QRhiCommandBuffer::debugMarkBegin() will become a no-op. Avoid
- enabling in production builds as it may involve a performance penalty.
+ like QRhiCommandBuffer::debugMarkBegin() will become no-ops. Avoid enabling
+ in production builds as it may involve a small performance impact. Has no
+ effect when the QRhi::DebugMarkers feature is not reported as supported.
+
+ \value EnableTimestamps Enables GPU timestamp collection. When not set,
+ QRhiCommandBuffer::lastCompletedGpuTime() always returns 0. Enable this
+ only when needed since there may be a small amount of extra work involved
+ (e.g. timestamp queries), depending on the underlying graphics API. Has no
+ effect when the QRhi::Timestamps feature is not reported as supported.
\value PreferSoftwareRenderer Indicates that backends should prefer
choosing an adapter or physical device that renders in software on the CPU.
@@ -450,6 +645,38 @@ Q_LOGGING_CATEGORY(QRHI_LOG_INFO, "qt.rhi.general")
possible to decide if an adapter/device is software-based, this flag is
ignored. It may also be ignored with graphics APIs that have no concept and
means of enumerating adapters/devices.
+
+ \value EnablePipelineCacheDataSave Enables retrieving the pipeline cache
+ contents, where applicable. When not set, pipelineCacheData() will return
+ an empty blob always. With backends where retrieving and restoring the
+ pipeline cache contents is not supported, the flag has no effect and the
+ serialized cache data is always empty. The flag provides an opt-in
+ mechanism because the cost of maintaining the related data structures is
+ not insignificant with some backends. With Vulkan this feature maps
+ directly to VkPipelineCache, vkGetPipelineCacheData and
+ VkPipelineCacheCreateInfo::pInitialData. With Direct3D 11 there is no real
+ pipline cache, but the results of HLSL->DXBC compilations are stored and
+ can be serialized/deserialized via this mechanism. This allows skipping the
+ time consuming D3DCompile() in future runs of the applications for shaders
+ that come with HLSL source instead of offline pre-compiled bytecode. This
+ can provide a huge boost in startup and load times, if there is a lot of
+ HLSL source compilation happening. With OpenGL the "pipeline cache" is
+ simulated by retrieving and loading shader program binaries (if supported
+ by the driver). With OpenGL there are additional, disk-based caching
+ mechanisms for shader/program binaries provided by Qt. Writing to those may
+ get disabled whenever this flag is set since storing program binaries to
+ multiple caches is not sensible.
+
+ \value SuppressSmokeTestWarnings Indicates that, with backends where this
+ is relevant, certain, non-fatal QRhi::create() failures should not
+ produce qWarning() calls. For example, with D3D11, passing this flag
+ makes a number of warning messages (that appear due to QRhi::create()
+ failing) to become categorized debug prints instead under the commonly used
+ \c{qt.rhi.general} logging category. This can be used by engines, such as
+ Qt Quick, that feature fallback logic, i.e. they retry calling create()
+ with a different set of flags (such as, \l PreferSoftwareRenderer), in order
+ to hide the unconditional warnings from the output that would be printed
+ when the first create() attempt had failed.
*/
/*!
@@ -475,21 +702,34 @@ Q_LOGGING_CATEGORY(QRHI_LOG_INFO, "qt.rhi.general")
Flag values to indicate what features are supported by the backend currently in use.
\value MultisampleTexture Indicates that textures with a sample count larger
- than 1 are supported.
+ than 1 are supported. In practice this feature will be unsupported with
+ OpenGL ES versions older than 3.1, and OpenGL older than 3.0.
\value MultisampleRenderBuffer Indicates that renderbuffers with a sample
- count larger than 1 are supported.
+ count larger than 1 are supported. In practice this feature will be
+ unsupported with OpenGL ES 2.0, and may also be unsupported with OpenGL 2.x
+ unless the relevant extensions are present.
\value DebugMarkers Indicates that debug marker groups (and so
QRhiCommandBuffer::debugMarkBegin()) are supported.
\value Timestamps Indicates that command buffer timestamps are supported.
- Relevant for QRhiProfiler::gpuFrameTimes().
-
- \value Instancing Indicates that instanced drawing is supported.
-
- \value CustomInstanceStepRate Indicates that instance step rates other than
- 1 are supported.
+ Relevant for QRhiCommandBuffer::lastCompletedGpuTime(). This can be
+ expected to be supported on Metal, Vulkan, Direct 3D 11 and 12, and OpenGL
+ contexts of version 3.3 or newer. However, with some of these APIs support
+ for timestamp queries is technically optional, and therefore it cannot be
+ guaranteed that this feature is always supported with every implementation
+ of them.
+
+ \value Instancing Indicates that instanced drawing is supported. In
+ practice this feature will be unsupported with OpenGL ES 2.0 and OpenGL
+ 3.2 or older.
+
+ \value CustomInstanceStepRate Indicates that instance step rates other
+ than 1 are supported. In practice this feature will always be unsupported
+ with OpenGL. In addition, running with Vulkan 1.0 without
+ VK_EXT_vertex_attribute_divisor will also lead to reporting false for this
+ feature.
\value PrimitiveRestart Indicates that restarting the assembly of
primitives when encountering an index value of 0xFFFF
@@ -517,7 +757,8 @@ Q_LOGGING_CATEGORY(QRHI_LOG_INFO, "qt.rhi.general")
index buffer offsets (\c{indexOffset + firstIndex * indexComponentSize})
that are not 4 byte aligned are supported. When not supported, attempting
to issue a \l{QRhiCommandBuffer::drawIndexed()}{drawIndexed()} with a
- non-aligned effective offset may lead to unspecified behavior.
+ non-aligned effective offset may lead to unspecified behavior. Relevant in
+ particular for Metal, where this will be reported as unsupported.
\value NPOTTextureRepeat Indicates that the
\l{QRhiSampler::Repeat}{Repeat} wrap mode and mipmap filtering modes are
@@ -528,8 +769,12 @@ Q_LOGGING_CATEGORY(QRHI_LOG_INFO, "qt.rhi.general")
\value RedOrAlpha8IsRed Indicates that the
\l{QRhiTexture::RED_OR_ALPHA8}{RED_OR_ALPHA8} format maps to a one
component 8-bit \c red format. This is the case for all backends except
- OpenGL, where \c{GL_ALPHA}, a one component 8-bit \c alpha format, is used
- instead. This is relevant for shader code that samples from the texture.
+ OpenGL when using either OpenGL ES or a non-core profile context. There
+ \c{GL_ALPHA}, a one component 8-bit \c alpha format, is used
+ instead. Using the special texture format allows having a single code
+ path for creating textures, leaving it up to the backend to decide the
+ actual format, while the feature flag can be used to pick the
+ appropriate shader variant for sampling the texture.
\value ElementIndexUint Indicates that 32-bit unsigned integer elements are
supported in the index buffer. In practice this is true everywhere except
@@ -538,13 +783,15 @@ Q_LOGGING_CATEGORY(QRHI_LOG_INFO, "qt.rhi.general")
index buffer.
\value Compute Indicates that compute shaders, image load/store, and
- storage buffers are supported.
+ storage buffers are supported. OpenGL older than 4.3 and OpenGL ES older
+ than 3.1 have no compute support.
\value WideLines Indicates that lines with a width other than 1 are
supported. When reported as not supported, the line width set on the
graphics pipeline state is ignored. This can always be false with some
- backends (D3D11, Metal). With Vulkan, the value depends on the
- implementation.
+ backends (D3D11, D3D12, Metal). With Vulkan, the value depends on the
+ implementation. With OpenGL, wide lines are not supported in core profile
+ contexts.
\value VertexShaderPointSize Indicates that the size of rasterized points
set via \c{gl_PointSize} in the vertex shader is taken into account. When
@@ -555,38 +802,245 @@ Q_LOGGING_CATEGORY(QRHI_LOG_INFO, "qt.rhi.general")
require the point size to be set in the shader explicitly whenever drawing
points, even when the size is 1, as they do not automatically default to 1.
- \value BaseVertex Indicates that \l{QRhiCommandBuffer::drawIndexed()}{drawIndexed()}
- supports the \c vertexOffset argument. When reported as not supported, the
- vertexOffset value in an indexed draw is ignored.
+ \value BaseVertex Indicates that
+ \l{QRhiCommandBuffer::drawIndexed()}{drawIndexed()} supports the \c
+ vertexOffset argument. When reported as not supported, the vertexOffset
+ value in an indexed draw is ignored. In practice this feature will be
+ unsupported with OpenGL and OpenGL ES versions lower than 3.2, and with
+ Metal on older iOS devices, including the iOS Simulator.
\value BaseInstance Indicates that instanced draw commands support the \c
firstInstance argument. When reported as not supported, the firstInstance
- value is ignored and the instance ID starts from 0.
+ value is ignored and the instance ID starts from 0. In practice this feature
+ will be unsupported with OpenGL, and with Metal on older iOS devices,
+ including the iOS Simulator.
\value TriangleFanTopology Indicates that QRhiGraphicsPipeline::setTopology()
- supports QRhiGraphicsPipeline::TriangleFan.
+ supports QRhiGraphicsPipeline::TriangleFan. In practice this feature will be
+ unsupported with Metal and Direct 3D 11/12.
\value ReadBackNonUniformBuffer Indicates that
\l{QRhiResourceUpdateBatch::readBackBuffer()}{reading buffer contents} is
supported for QRhiBuffer instances with a usage different than
- UniformBuffer. While this is supported in the majority of cases, it will be
- unsupported with OpenGL ES older than 3.0.
+ UniformBuffer. In practice this feature will be unsupported with OpenGL ES
+ 2.0.
\value ReadBackNonBaseMipLevel Indicates that specifying a mip level other
than 0 is supported when reading back texture contents. When not supported,
specifying a non-zero level in QRhiReadbackDescription leads to returning
an all-zero image. In practice this feature will be unsupported with OpenGL
- ES 2.0, while it will likely be supported everywhere else.
+ ES 2.0.
+
+ \value TexelFetch Indicates that texelFetch() and textureLod() are available
+ in shaders. In practice this will be reported as unsupported with OpenGL ES
+ 2.0 and OpenGL 2.x contexts, because GLSL 100 es and versions before 130 do
+ not support these functions.
+
+ \value RenderToNonBaseMipLevel Indicates that specifying a mip level other
+ than 0 is supported when creating a QRhiTextureRenderTarget with a
+ QRhiTexture as its color attachment. When not supported, create() will fail
+ whenever the target mip level is not zero. In practice this feature will be
+ unsupported with OpenGL ES 2.0.
+
+ \value IntAttributes Indicates that specifying input attributes with
+ signed and unsigned integer types for a shader pipeline is supported. When
+ not supported, build() will succeed but just show a warning message and the
+ values of the target attributes will be broken. In practice this feature
+ will be unsupported with OpenGL ES 2.0 and OpenGL 2.x.
+
+ \value ScreenSpaceDerivatives Indicates that functions such as dFdx(),
+ dFdy(), and fwidth() are supported in shaders. In practice this feature will
+ be unsupported with OpenGL ES 2.0 without the GL_OES_standard_derivatives
+ extension.
+
+ \value ReadBackAnyTextureFormat Indicates that reading back texture
+ contents can be expected to work for any QRhiTexture::Format. Backends
+ other than OpenGL can be expected to return true for this feature. When
+ reported as false, which will typically happen with OpenGL, only the
+ formats QRhiTexture::RGBA8 and QRhiTexture::BGRA8 are guaranteed to be
+ supported for readbacks. In addition, with OpenGL, but not OpenGL ES,
+ reading back the 1 byte per component formats QRhiTexture::R8 and
+ QRhiTexture::RED_OR_ALPHA8 are supported as well. Reading back floating
+ point formats QRhiTexture::RGBA16F and RGBA32F may work too with OpenGL, as
+ long as the implementation provides support for these, but QRhi can give no
+ guarantees, as indicated by this flag.
+
+ \value PipelineCacheDataLoadSave Indicates that the pipelineCacheData() and
+ setPipelineCacheData() functions are functional. When not supported, the
+ functions will not perform any action, the retrieved blob is always empty,
+ and thus no benefits can be expected from retrieving and, during a
+ subsequent run of the application, reloading the pipeline cache content.
+
+ \value ImageDataStride Indicates that specifying a custom stride (row
+ length) for raw image data in texture uploads is supported. When not
+ supported (which can happen when the underlying API is OpenGL ES 2.0 without
+ support for GL_UNPACK_ROW_LENGTH),
+ QRhiTextureSubresourceUploadDescription::setDataStride() must not be used.
+
+ \value RenderBufferImport Indicates that QRhiRenderBuffer::createFrom() is
+ supported. For most graphics APIs this is not sensible because
+ QRhiRenderBuffer encapsulates texture objects internally, just like
+ QRhiTexture. With OpenGL however, renderbuffer object exist as a separate
+ object type in the API, and in certain environments (for example, where one
+ may want to associated a renderbuffer object with an EGLImage object) it is
+ important to allow wrapping an existing OpenGL renderbuffer object with a
+ QRhiRenderBuffer.
+
+ \value ThreeDimensionalTextures Indicates that 3D textures are supported.
+ In practice this feature will be unsupported with OpenGL and OpenGL ES
+ versions lower than 3.0.
+
+ \value RenderTo3DTextureSlice Indicates that rendering to a slice in a 3D
+ texture is supported. This can be unsupported with Vulkan 1.0 due to
+ relying on VK_IMAGE_CREATE_2D_ARRAY_COMPATIBLE_BIT which is a Vulkan 1.1
+ feature.
+
+ \value TextureArrays Indicates that texture arrays are supported and
+ QRhi::newTextureArray() is functional. Note that even when texture arrays
+ are not supported, arrays of textures are still available as those are two
+ independent features.
+
+ \value Tessellation Indicates that the tessellation control and evaluation
+ stages are supported. When reported as supported, the topology of a
+ QRhiGraphicsPipeline can be set to
+ \l{QRhiGraphicsPipeline::Patches}{Patches}, the number of control points
+ can be set via
+ \l{QRhiGraphicsPipeline::setPatchControlPointCount()}{setPatchControlPointCount()},
+ and shaders for tessellation control and evaluation can be specified in the
+ QRhiShaderStage list. Tessellation shaders have portability issues between
+ APIs (for example, translating GLSL/SPIR-V to HLSL is problematic due to
+ the way hull shaders are structured, whereas Metal uses a somewhat
+ different tessellation pipeline than others), and therefore unexpected
+ issues may still arise, even though basic functionality is implemented
+ across all the underlying APIs. For Direct 3D in particular, handwritten
+ HLSL hull and domain shaders must be injected into each QShader for the
+ tessellation control and evaluation stages, respectively, since qsb cannot
+ generate these from SPIR-V. Note that isoline tessellation should be
+ avoided as it will not be supported by all backends. The maximum patch
+ control point count portable between backends is 32.
+
+ \value GeometryShader Indicates that the geometry shader stage is
+ supported. When supported, a geometry shader can be specified in the
+ QRhiShaderStage list. Geometry Shaders are considered an experimental
+ feature in QRhi and can only be expected to be supported with Vulkan,
+ Direct 3D, OpenGL (3.2+) and OpenGL ES (3.2+), assuming the implementation
+ reports it as supported at run time. Geometry shaders have portability
+ issues between APIs, and therefore no guarantees can be given for a
+ universal solution. They will never be supported with Metal. Whereas with
+ Direct 3D a handwritten HLSL geometry shader must be injected into each
+ QShader for the geometry stage since qsb cannot generate this from SPIR-V.
+
+ \value TextureArrayRange Indicates that for
+ \l{QRhi::newTextureArray()}{texture arrays} it is possible to specify a
+ range that is exposed to the shaders. Normally all array layers are exposed
+ and it is up to the shader to select the layer (via the third coordinate
+ passed to texture() when sampling the \c sampler2DArray). When supported,
+ calling QRhiTexture::setArrayRangeStart() and
+ QRhiTexture::setArrayRangeLength() before
+ \l{QRhiTexture::create()}{building} or
+ \l{QRhiTexture::createFrom()}{importing} the native texture has an effect,
+ and leads to selecting only the specified range from the array. This will
+ be necessary in special cases, such as when working with accelerated video
+ decoding and Direct 3D 11, because a texture array with both
+ \c{D3D11_BIND_DECODER} and \c{D3D11_BIND_SHADER_RESOURCE} on it is only
+ usable as a shader resource if a single array layer is selected. Note that
+ all this is applicable only when the texture is used as a
+ QRhiShaderResourceBinding::SampledTexture or
+ QRhiShaderResourceBinding::Texture shader resource, and is not compatible
+ with image load/store. This feature is only available with some backends as
+ it does not map well to all graphics APIs, and it is only meant to provide
+ support for special cases anyhow. In practice the feature can be expected to
+ be supported with Direct3D 11/12 and Vulkan.
+
+ \value NonFillPolygonMode Indicates that setting a PolygonMode other than
+ the default Fill is supported for QRhiGraphicsPipeline. A common use case
+ for changing the mode to Line is to get wireframe rendering. This however
+ is not available as a core OpenGL ES feature, and is optional with Vulkan
+ as well as some mobile GPUs may not offer the feature.
+
+ \value OneDimensionalTextures Indicates that 1D textures are supported.
+ In practice this feature will be unsupported on OpenGL ES.
+
+ \value OneDimensionalTextureMipmaps Indicates that generating 1D texture
+ mipmaps are supported. In practice this feature will be unsupported on
+ backends that do not report support for
+ \l{OneDimensionalTextures}, Metal, and Direct 3D 12.
+
+ \value HalfAttributes Indicates that specifying input attributes with half
+ precision (16bit) floating point types for a shader pipeline is supported.
+ When not supported, build() will succeed but just show a warning message
+ and the values of the target attributes will be broken. In practice this
+ feature will be unsupported in some OpenGL ES 2.0 and OpenGL 2.x
+ implementations. Note that while Direct3D 11/12 does support half precision
+ input attributes, it does not support the half3 type. The D3D backends pass
+ half3 attributes as half4. To ensure cross platform compatibility, half3
+ inputs should be padded to 8 bytes.
+
+ \value RenderToOneDimensionalTexture Indicates that 1D texture render
+ targets are supported. In practice this feature will be unsupported on
+ backends that do not report support for
+ \l{OneDimensionalTextures}, and Metal.
+
+ \value ThreeDimensionalTextureMipmaps Indicates that generating 3D texture
+ mipmaps are supported. In practice this feature will be unsupported with
+ Direct 3D 12.
+
+ \value MultiView Indicates that multiview, see e.g.
+ \l{https://registry.khronos.org/vulkan/specs/1.3-extensions/man/html/VK_KHR_multiview.html}{VK_KHR_multiview}
+ is supported. With OpenGL ES 2.0, Direct 3D 11, and OpenGL (ES)
+ implementations without \c{GL_OVR_multiview2} this feature will not be
+ supported. With Vulkan 1.1 and newer, and Direct 3D 12 multiview is
+ typically supported. When reported as supported, creating a
+ QRhiTextureRenderTarget with a QRhiColorAttachment that references a texture
+ array and has \l{QRhiColorAttachment::setMultiViewCount()}{multiViewCount}
+ set enables recording a render pass that uses multiview rendering. In addition,
+ any QRhiGraphicsPipeline used in that render pass must have
+ \l{QRhiGraphicsPipeline::setMultiViewCount()}{the same view count set}. Note that
+ multiview is only available in combination with 2D texture arrays. It cannot
+ be used to optimize the rendering into individual textures (e.g. two, for
+ the left and right eyes). Rather, the target of a multiview render pass is
+ always a texture array, automatically rendering to the layer (array element)
+ corresponding to each view. Therefore this feature implies \l TextureArrays
+ as well. Multiview rendering is not supported in combination with
+ tessellation or geometry shaders. See QRhiColorAttachment::setMultiViewCount()
+ for further details on multiview rendering. This enum value has been introduced in Qt 6.7.
+
+ \value TextureViewFormat Indicates that setting a
+ \l{QRhiTexture::setWriteViewFormat()}{view format} on a QRhiTexture is
+ effective. When reported as supported, setting the read (sampling) or write
+ (render target / image load-store) view mode changes the texture's viewing
+ format. When unsupported, setting a view format has no effect. Note that Qt
+ has no knowledge or control over format compatibility or resource view rules
+ in the underlying 3D API and its implementation. Passing in unsuitable,
+ incompatible formats may lead to errors and unspecified behavior. This is
+ provided mainly to allow "casting" rendering into a texture created with an
+ sRGB format to non-sRGB to avoid the unwanted linear->sRGB conversion on
+ shader writes. Other types of casting may or may not be functional,
+ depending on the underlying API. Currently implemented for Vulkan and Direct
+ 3D 12. With D3D12 the feature is available only if
+ \c CastingFullyTypedFormatSupported is supported, see
+ \l{https://microsoft.github.io/DirectX-Specs/d3d/RelaxedCasting.html} (and
+ note that QRhi always uses fully typed formats for textures.) This enum
+ value has been introduced in Qt 6.8.
+
+ \value ResolveDepthStencil Indicates that resolving a multisample depth or
+ depth-stencil texture is supported. Otherwise,
+ \l{QRhiTextureRenderTargetDescription::setDepthResolveTexture()}{setting a
+ depth resolve texture} is not functional and must be avoided. Direct 3D 11
+ and 12 have no support for resolving depth/depth-stencil formats, and
+ therefore this feature will never be supported with those. Vulkan 1.0 has no
+ API to request resolving a depth-stencil attachment. Therefore, with Vulkan
+ this feature will only be supported with Vulkan 1.2 and up, and on 1.1
+ implementations with the appropriate extensions present. This feature is
+ provided for the rare case when resolving into a non-multisample depth
+ texture becomes necessary, for example when rendering into an
+ OpenXR-provided depth texture (XR_KHR_composition_layer_depth). This enum
+ value has been introduced in Qt 6.8.
*/
/*!
\enum QRhi::BeginFrameFlag
Flag values for QRhi::beginFrame()
-
- \value ExternalContentsInPass Specifies that one or more render or compute
- passes in this frame will call QRhiCommandBuffer::beginExternal(). Some
- backends, Vulkan in particular, will fail if this flag is not set and
- beginExternal() is still called.
*/
/*!
@@ -622,38 +1076,99 @@ Q_LOGGING_CATEGORY(QRHI_LOG_INFO, "qt.rhi.general")
is what some OpenGL ES implementations provide.
\value FramesInFlight The number of frames the backend may keep "in
- flight". The value has no relevance, and is unspecified, with backends like
- OpenGL and Direct3D 11. With backends like Vulkan or Metal, it is the
- responsibility of QRhi to block whenever starting a new frame and finding
- the CPU is already \c{N - 1} frames ahead of the GPU (because the command
- buffer submitted in frame no. \c{current} - \c{N} has not yet completed).
- The value N is what is returned from here, and is typically 2. This can be
- relevant to applications that integrate rendering done directly with the
- graphics API, as such rendering code may want to perform double (if the
- value is 2) buffering for resources, such as, buffers, similarly to the
- QRhi backends themselves. The current frame slot index (a value running 0,
- 1, .., N-1, then wrapping around) is retrievable from
- QRhi::currentFrameSlot().
+ flight": with backends like Vulkan or Metal, it is the responsibility of
+ QRhi to block whenever starting a new frame and finding the CPU is already
+ \c{N - 1} frames ahead of the GPU (because the command buffer submitted in
+ frame no. \c{current} - \c{N} has not yet completed). The value N is what
+ is returned from here, and is typically 2. This can be relevant to
+ applications that integrate rendering done directly with the graphics API,
+ as such rendering code may want to perform double (if the value is 2)
+ buffering for resources, such as, buffers, similarly to the QRhi backends
+ themselves. The current frame slot index (a value running 0, 1, .., N-1,
+ then wrapping around) is retrievable from QRhi::currentFrameSlot(). The
+ value is 1 for backends where the graphics API offers no such low level
+ control over the command submission process. Note that pipelining may still
+ happen even when this value is 1 (some backends, such as D3D11, are
+ designed to attempt to enable this, for instance, by using an update
+ strategy for uniform buffers that does not stall the pipeline), but that is
+ then not controlled by QRhi and so not reflected here in the API.
+
+ \value MaxAsyncReadbackFrames The number of \l{QRhi::endFrame()}{submitted}
+ frames (including the one that contains the readback) after which an
+ asynchronous texture or buffer readback is guaranteed to complete upon
+ \l{QRhi::beginFrame()}{starting a new frame}.
+
+ \value MaxThreadGroupsPerDimension The maximum number of compute
+ work/thread groups that can be dispatched. Effectively the maximum value
+ for the arguments of QRhiCommandBuffer::dispatch(). Typically 65535.
+
+ \value MaxThreadsPerThreadGroup The maximum number of invocations in a
+ single local work group, or in other terminology, the maximum number of
+ threads in a thread group. Effectively the maximum value for the product of
+ \c local_size_x, \c local_size_y, and \c local_size_z in the compute
+ shader. Typical values are 128, 256, 512, 1024, or 1536. Watch out that
+ both OpenGL ES and Vulkan specify only 128 as the minimum required limit
+ for implementations. While uncommon for Vulkan, some OpenGL ES 3.1
+ implementations for mobile/embedded devices only support the spec-mandated
+ minimum value.
+
+ \value MaxThreadGroupX The maximum size of a work/thread group in the X
+ dimension. Effectively the maximum value of \c local_size_x in the compute
+ shader. Typically 256 or 1024.
+
+ \value MaxThreadGroupY The maximum size of a work/thread group in the Y
+ dimension. Effectively the maximum value of \c local_size_y in the compute
+ shader. Typically 256 or 1024.
+
+ \value MaxThreadGroupZ The maximum size of a work/thread group in the Z
+ dimension. Effectively the maximum value of \c local_size_z in the compute
+ shader. Typically 64 or 256.
+
+ \value TextureArraySizeMax Maximum texture array size. Typically in range
+ 256 - 2048. Attempting to \l{QRhi::newTextureArray()}{create a texture
+ array} with more elements will likely fail.
+
+ \value MaxUniformBufferRange The number of bytes that can be exposed from a
+ uniform buffer to the shaders at once. On OpenGL ES 2.0 and 3.0
+ implementations this may be as low as 3584 bytes (224 four component, 32
+ bits per component vectors). Elsewhere the value is typically 16384 (1024
+ vec4s) or 65536 (4096 vec4s).
+
+ \value MaxVertexInputs The number of input attributes to the vertex shader.
+ The location in a QRhiVertexInputAttribute must be in range \c{[0,
+ MaxVertexInputs-1]}. The value may be as low as 8 with OpenGL ES 2.0.
+ Elsewhere, typical values are 16, 31, or 32.
+
+ \value MaxVertexOutputs The maximum number of outputs (4 component vector
+ \c out variables) from the vertex shader. The value may be as low as 8 with
+ OpenGL ES 2.0, and 15 with OpenGL ES 3.0 and some Metal devices. Elsewhere,
+ a typical value is 32.
*/
/*!
\class QRhiInitParams
- \internal
\inmodule QtGui
+ \since 6.6
\brief Base class for backend-specific initialization parameters.
Contains fields that are relevant to all backends.
+
+ \note This is a RHI API with limited compatibility guarantees, see \l QRhi
+ for details.
*/
/*!
\class QRhiDepthStencilClearValue
- \internal
\inmodule QtGui
+ \since 6.6
\brief Specifies clear values for a depth or stencil buffer.
+
+ \note This is a RHI API with limited compatibility guarantees, see \l QRhi
+ for details.
*/
/*!
- \fn QRhiDepthStencilClearValue::QRhiDepthStencilClearValue()
+ \fn QRhiDepthStencilClearValue::QRhiDepthStencilClearValue() = default
Constructs a depth/stencil clear value with depth clear value 1.0f and
stencil clear value 0.
@@ -670,37 +1185,45 @@ QRhiDepthStencilClearValue::QRhiDepthStencilClearValue(float d, quint32 s)
}
/*!
+ \fn float QRhiDepthStencilClearValue::depthClearValue() const
+ \return the depth clear value. In most cases this is 1.0f.
+ */
+
+/*!
+ \fn void QRhiDepthStencilClearValue::setDepthClearValue(float d)
+ Sets the depth clear value to \a d.
+ */
+
+/*!
+ \fn quint32 QRhiDepthStencilClearValue::stencilClearValue() const
+ \return the stencil clear value. In most cases this is 0.
+ */
+
+/*!
+ \fn void QRhiDepthStencilClearValue::setStencilClearValue(quint32 s)
+ Sets the stencil clear value to \a s.
+ */
+
+/*!
+ \fn bool QRhiDepthStencilClearValue::operator==(const QRhiDepthStencilClearValue &a, const QRhiDepthStencilClearValue &b) noexcept
+
\return \c true if the values in the two QRhiDepthStencilClearValue objects
\a a and \a b are equal.
-
- \relates QRhiDepthStencilClearValue
*/
-bool operator==(const QRhiDepthStencilClearValue &a, const QRhiDepthStencilClearValue &b) Q_DECL_NOTHROW
-{
- return a.depthClearValue() == b.depthClearValue()
- && a.stencilClearValue() == b.stencilClearValue();
-}
/*!
+ \fn bool QRhiDepthStencilClearValue::operator!=(const QRhiDepthStencilClearValue &a, const QRhiDepthStencilClearValue &b) noexcept
+
\return \c false if the values in the two QRhiDepthStencilClearValue
objects \a a and \a b are equal; otherwise returns \c true.
- \relates QRhiDepthStencilClearValue
*/
-bool operator!=(const QRhiDepthStencilClearValue &a, const QRhiDepthStencilClearValue &b) Q_DECL_NOTHROW
-{
- return !(a == b);
-}
/*!
- \return the hash value for \a v, using \a seed to seed the calculation.
+ \fn size_t QRhiDepthStencilClearValue::qHash(const QRhiDepthStencilClearValue &v, size_t seed = 0) noexcept
- \relates QRhiDepthStencilClearValue
+ \return the hash value for \a v, using \a seed to seed the calculation.
*/
-uint qHash(const QRhiDepthStencilClearValue &v, uint seed) Q_DECL_NOTHROW
-{
- return seed * (uint(qFloor(qreal(v.depthClearValue()) * 100)) + v.stencilClearValue());
-}
#ifndef QT_NO_DEBUG_STREAM
QDebug operator<<(QDebug dbg, const QRhiDepthStencilClearValue &v)
@@ -715,8 +1238,8 @@ QDebug operator<<(QDebug dbg, const QRhiDepthStencilClearValue &v)
/*!
\class QRhiViewport
- \internal
\inmodule QtGui
+ \since 6.6
\brief Specifies a viewport rectangle.
Used with QRhiCommandBuffer::setViewport().
@@ -726,20 +1249,23 @@ QDebug operator<<(QDebug dbg, const QRhiDepthStencilClearValue &v)
Typical usage is like the following:
- \badcode
+ \code
const QSize outputSizeInPixels = swapchain->currentPixelSize();
const QRhiViewport viewport(0, 0, outputSizeInPixels.width(), outputSizeInPixels.height());
- cb->beginPass(swapchain->currentFrameRenderTarget(), { 0, 0, 0, 1 }, { 1, 0 });
+ cb->beginPass(swapchain->currentFrameRenderTarget(), Qt::black, { 1.0f, 0 });
cb->setGraphicsPipeline(ps);
cb->setViewport(viewport);
- ...
+ // ...
\endcode
+ \note This is a RHI API with limited compatibility guarantees, see \l QRhi
+ for details.
+
\sa QRhiCommandBuffer::setViewport(), QRhi::clipSpaceCorrMatrix(), QRhiScissor
*/
/*!
- \fn QRhiViewport::QRhiViewport()
+ \fn QRhiViewport::QRhiViewport() = default
Constructs a viewport description with an empty rectangle and a depth range
of 0.0f - 1.0f.
@@ -765,40 +1291,59 @@ QRhiViewport::QRhiViewport(float x, float y, float w, float h, float minDepth, f
}
/*!
+ \fn std::array<float, 4> QRhiViewport::viewport() const
+ \return the viewport x, y, width, and height.
+ */
+
+/*!
+ \fn void QRhiViewport::setViewport(float x, float y, float w, float h)
+ Sets the viewport's position and size to \a x, \a y, \a w, and \a h.
+
+ \note Viewports are specified in a coordinate system that has its origin in
+ the bottom-left.
+ */
+
+/*!
+ \fn float QRhiViewport::minDepth() const
+ \return the minDepth value of the depth range of the viewport.
+ */
+
+/*!
+ \fn void QRhiViewport::setMinDepth(float minDepth)
+ Sets the \a minDepth of the depth range of the viewport.
+ By default this is set to 0.0f.
+ */
+
+/*!
+ \fn float QRhiViewport::maxDepth() const
+ \return the maxDepth value of the depth range of the viewport.
+ */
+
+/*!
+ \fn void QRhiViewport::setMaxDepth(float maxDepth)
+ Sets the \a maxDepth of the depth range of the viewport.
+ By default this is set to 1.0f.
+ */
+
+/*!
+ \fn bool QRhiViewport::operator==(const QRhiViewport &a, const QRhiViewport &b) noexcept
+
\return \c true if the values in the two QRhiViewport objects
\a a and \a b are equal.
-
- \relates QRhiViewport
*/
-bool operator==(const QRhiViewport &a, const QRhiViewport &b) Q_DECL_NOTHROW
-{
- return a.viewport() == b.viewport()
- && a.minDepth() == b.minDepth()
- && a.maxDepth() == b.maxDepth();
-}
/*!
+ \fn bool QRhiViewport::operator!=(const QRhiViewport &a, const QRhiViewport &b) noexcept
+
\return \c false if the values in the two QRhiViewport
objects \a a and \a b are equal; otherwise returns \c true.
-
- \relates QRhiViewport
*/
-bool operator!=(const QRhiViewport &a, const QRhiViewport &b) Q_DECL_NOTHROW
-{
- return !(a == b);
-}
/*!
- \return the hash value for \a v, using \a seed to seed the calculation.
+ \fn size_t QRhiViewport::qHash(const QRhiViewport &v, size_t seed = 0) noexcept
- \relates QRhiViewport
+ \return the hash value for \a v, using \a seed to seed the calculation.
*/
-uint qHash(const QRhiViewport &v, uint seed) Q_DECL_NOTHROW
-{
- const std::array<float, 4> r = v.viewport();
- return seed + uint(r[0]) + uint(r[1]) + uint(r[2]) + uint(r[3])
- + uint(qFloor(qreal(v.minDepth()) * 100)) + uint(qFloor(qreal(v.maxDepth()) * 100));
-}
#ifndef QT_NO_DEBUG_STREAM
QDebug operator<<(QDebug dbg, const QRhiViewport &v)
@@ -818,8 +1363,8 @@ QDebug operator<<(QDebug dbg, const QRhiViewport &v)
/*!
\class QRhiScissor
- \internal
\inmodule QtGui
+ \since 6.6
\brief Specifies a scissor rectangle.
Used with QRhiCommandBuffer::setScissor(). Setting a scissor rectangle is
@@ -833,11 +1378,14 @@ QDebug operator<<(QDebug dbg, const QRhiViewport &v)
appropriate. Therefore, any rendering logic targeting OpenGL can feed
scissor rectangles into QRhiScissor as-is, without any adaptation.
+ \note This is a RHI API with limited compatibility guarantees, see \l QRhi
+ for details.
+
\sa QRhiCommandBuffer::setScissor(), QRhiViewport
*/
/*!
- \fn QRhiScissor::QRhiScissor()
+ \fn QRhiScissor::QRhiScissor() = default
Constructs an empty scissor.
*/
@@ -858,37 +1406,37 @@ QRhiScissor::QRhiScissor(int x, int y, int w, int h)
}
/*!
+ \fn std::array<int, 4> QRhiScissor::scissor() const
+ \return the scissor position and size.
+ */
+
+/*!
+ \fn void QRhiScissor::setScissor(int x, int y, int w, int h)
+ Sets the scissor position and size to \a x, \a y, \a w, \a h.
+
+ \note The position is always expected to be specified in a coordinate
+ system that has its origin in the bottom-left corner, like OpenGL.
+ */
+
+/*!
+ \fn bool QRhiScissor::operator==(const QRhiScissor &a, const QRhiScissor &b) noexcept
+
\return \c true if the values in the two QRhiScissor objects
\a a and \a b are equal.
-
- \relates QRhiScissor
*/
-bool operator==(const QRhiScissor &a, const QRhiScissor &b) Q_DECL_NOTHROW
-{
- return a.scissor() == b.scissor();
-}
/*!
+ \fn bool QRhiScissor::operator!=(const QRhiScissor &a, const QRhiScissor &b) noexcept
+
\return \c false if the values in the two QRhiScissor
objects \a a and \a b are equal; otherwise returns \c true.
-
- \relates QRhiScissor
*/
-bool operator!=(const QRhiScissor &a, const QRhiScissor &b) Q_DECL_NOTHROW
-{
- return !(a == b);
-}
/*!
- \return the hash value for \a v, using \a seed to seed the calculation.
+ \fn size_t QRhiScissor::qHash(const QRhiScissor &v, size_t seed = 0) noexcept
- \relates QRhiScissor
+ \return the hash value for \a v, using \a seed to seed the calculation.
*/
-uint qHash(const QRhiScissor &v, uint seed) Q_DECL_NOTHROW
-{
- const std::array<int, 4> r = v.scissor();
- return seed + uint(r[0]) + uint(r[1]) + uint(r[2]) + uint(r[3]);
-}
#ifndef QT_NO_DEBUG_STREAM
QDebug operator<<(QDebug dbg, const QRhiScissor &s)
@@ -906,8 +1454,8 @@ QDebug operator<<(QDebug dbg, const QRhiScissor &s)
/*!
\class QRhiVertexInputBinding
- \internal
\inmodule QtGui
+ \since 6.6
\brief Describes a vertex input binding.
Specifies the stride (in bytes, must be a multiple of 4), the
@@ -922,10 +1470,10 @@ QDebug operator<<(QDebug dbg, const QRhiScissor &s)
Now let's assume also that 3 component vertex positions \c{(x, y, z)} and 2
component texture coordinates \c{(u, v)} are provided in a non-interleaved
- format in a buffer (or separate buffers even). Definining two bindings
+ format in a buffer (or separate buffers even). Defining two bindings
could then be done like this:
- \badcode
+ \code
QRhiVertexInputLayout inputLayout;
inputLayout.setBindings({
{ 3 * sizeof(float) },
@@ -942,7 +1490,7 @@ QDebug operator<<(QDebug dbg, const QRhiScissor &s)
vertices, assuming we have a single buffer with first the positions and
then the texture coordinates:
- \badcode
+ \code
const QRhiCommandBuffer::VertexInput vbufBindings[] = {
{ cubeBuf, 0 },
{ cubeBuf, 36 * 3 * sizeof(float) }
@@ -958,6 +1506,9 @@ QDebug operator<<(QDebug dbg, const QRhiScissor &s)
\note the stride must always be a multiple of 4.
+ \note This is a RHI API with limited compatibility guarantees, see \l QRhi
+ for details.
+
\sa QRhiCommandBuffer::setVertexInput()
*/
@@ -970,7 +1521,7 @@ QDebug operator<<(QDebug dbg, const QRhiScissor &s)
*/
/*!
- \fn QRhiVertexInputBinding::QRhiVertexInputBinding()
+ \fn QRhiVertexInputBinding::QRhiVertexInputBinding() = default
Constructs a default vertex input binding description.
*/
@@ -982,7 +1533,7 @@ QDebug operator<<(QDebug dbg, const QRhiScissor &s)
\note \a stepRate other than 1 is only supported when
QRhi::CustomInstanceStepRate is reported to be supported.
*/
-QRhiVertexInputBinding::QRhiVertexInputBinding(quint32 stride, Classification cls, int stepRate)
+QRhiVertexInputBinding::QRhiVertexInputBinding(quint32 stride, Classification cls, quint32 stepRate)
: m_stride(stride),
m_classification(cls),
m_instanceStepRate(stepRate)
@@ -990,38 +1541,54 @@ QRhiVertexInputBinding::QRhiVertexInputBinding(quint32 stride, Classification cl
}
/*!
+ \fn quint32 QRhiVertexInputBinding::stride() const
+ \return the stride in bytes.
+ */
+
+/*!
+ \fn void QRhiVertexInputBinding::setStride(quint32 s)
+ Sets the stride to \a s.
+ */
+
+/*!
+ \fn QRhiVertexInputBinding::Classification QRhiVertexInputBinding::classification() const
+ \return the input data classification.
+ */
+
+/*!
+ \fn void QRhiVertexInputBinding::setClassification(Classification c)
+ Sets the input data classification \a c. By default this is set to PerVertex.
+ */
+
+/*!
+ \fn quint32 QRhiVertexInputBinding::instanceStepRate() const
+ \return the instance step rate.
+ */
+
+/*!
+ \fn void QRhiVertexInputBinding::setInstanceStepRate(quint32 rate)
+ Sets the instance step \a rate. By default this is set to 1.
+ */
+
+/*!
+ \fn bool QRhiVertexInputBinding::operator==(const QRhiVertexInputBinding &a, const QRhiVertexInputBinding &b) noexcept
+
\return \c true if the values in the two QRhiVertexInputBinding objects
\a a and \a b are equal.
-
- \relates QRhiVertexInputBinding
*/
-bool operator==(const QRhiVertexInputBinding &a, const QRhiVertexInputBinding &b) Q_DECL_NOTHROW
-{
- return a.stride() == b.stride()
- && a.classification() == b.classification()
- && a.instanceStepRate() == b.instanceStepRate();
-}
/*!
+ \fn bool QRhiVertexInputBinding::operator!=(const QRhiVertexInputBinding &a, const QRhiVertexInputBinding &b) noexcept
+
\return \c false if the values in the two QRhiVertexInputBinding
objects \a a and \a b are equal; otherwise returns \c true.
-
- \relates QRhiVertexInputBinding
*/
-bool operator!=(const QRhiVertexInputBinding &a, const QRhiVertexInputBinding &b) Q_DECL_NOTHROW
-{
- return !(a == b);
-}
/*!
- \return the hash value for \a v, using \a seed to seed the calculation.
+ \fn size_t QRhiVertexInputBinding::qHash(const QRhiVertexInputBinding &v, size_t seed = 0) noexcept
- \relates QRhiVertexInputBinding
+ \return the hash value for \a v, using \a seed to seed the calculation.
*/
-uint qHash(const QRhiVertexInputBinding &v, uint seed) Q_DECL_NOTHROW
-{
- return seed + v.stride() + v.classification();
-}
#ifndef QT_NO_DEBUG_STREAM
QDebug operator<<(QDebug dbg, const QRhiVertexInputBinding &b)
@@ -1037,14 +1604,15 @@ QDebug operator<<(QDebug dbg, const QRhiVertexInputBinding &b)
/*!
\class QRhiVertexInputAttribute
- \internal
\inmodule QtGui
+ \since 6.6
\brief Describes a single vertex input element.
The members specify the binding number, location, format, and offset for a
single vertex input element.
- \note For HLSL it is assumed that the vertex shader uses
+ \note For HLSL it is assumed that the vertex shader translated from SPIR-V
+ uses
\c{TEXCOORD<location>} as the semantic for each input. Hence no separate
semantic name and index.
@@ -1060,7 +1628,7 @@ QDebug operator<<(QDebug dbg, const QRhiVertexInputBinding &b)
non-interleaved format in a buffer (or separate buffers even). Once two
bindings are defined, the attributes could be specified as:
- \badcode
+ \code
QRhiVertexInputLayout inputLayout;
inputLayout.setBindings({
{ 3 * sizeof(float) },
@@ -1077,7 +1645,7 @@ QDebug operator<<(QDebug dbg, const QRhiVertexInputBinding &b)
vertices, assuming we have a single buffer with first the positions and
then the texture coordinates:
- \badcode
+ \code
const QRhiCommandBuffer::VertexInput vbufBindings[] = {
{ cubeBuf, 0 },
{ cubeBuf, 36 * 3 * sizeof(float) }
@@ -1089,7 +1657,7 @@ QDebug operator<<(QDebug dbg, const QRhiVertexInputBinding &b)
binding, with multiple attributes referring to that same buffer binding
point:
- \badcode
+ \code
QRhiVertexInputLayout inputLayout;
inputLayout.setBindings({
{ 5 * sizeof(float) }
@@ -1102,11 +1670,14 @@ QDebug operator<<(QDebug dbg, const QRhiVertexInputBinding &b)
and then:
- \badcode
+ \code
const QRhiCommandBuffer::VertexInput vbufBinding(interleavedCubeBuf, 0);
cb->setVertexInput(0, 1, &vbufBinding);
\endcode
+ \note This is a RHI API with limited compatibility guarantees, see \l QRhi
+ for details.
+
\sa QRhiCommandBuffer::setVertexInput()
*/
@@ -1121,10 +1692,38 @@ QDebug operator<<(QDebug dbg, const QRhiVertexInputBinding &b)
\value UNormByte4 Four component normalized unsigned byte vector
\value UNormByte2 Two component normalized unsigned byte vector
\value UNormByte Normalized unsigned byte
- */
-
-/*!
- \fn QRhiVertexInputAttribute::QRhiVertexInputAttribute()
+ \value UInt4 Four component unsigned integer vector
+ \value UInt3 Three component unsigned integer vector
+ \value UInt2 Two component unsigned integer vector
+ \value UInt Unsigned integer
+ \value SInt4 Four component signed integer vector
+ \value SInt3 Three component signed integer vector
+ \value SInt2 Two component signed integer vector
+ \value SInt Signed integer
+ \value Half4 Four component half precision (16 bit) float vector
+ \value Half3 Three component half precision (16 bit) float vector
+ \value Half2 Two component half precision (16 bit) float vector
+ \value Half Half precision (16 bit) float
+ \value UShort4 Four component unsigned short (16 bit) integer vector
+ \value UShort3 Three component unsigned short (16 bit) integer vector
+ \value UShort2 Two component unsigned short (16 bit) integer vector
+ \value UShort Unsigned short (16 bit) integer
+ \value SShort4 Four component signed short (16 bit) integer vector
+ \value SShort3 Three component signed short (16 bit) integer vector
+ \value SShort2 Two component signed short (16 bit) integer vector
+ \value SShort Signed short (16 bit) integer
+
+ \note Support for half precision floating point attributes is indicated at
+ run time by the QRhi::Feature::HalfAttributes feature flag.
+
+ \note Direct3D 11/12 supports 16 bit input attributes, but does not support
+ the Half3, UShort3 or SShort3 types. The D3D backends pass through Half3 as
+ Half4, UShort3 as UShort4, and SShort3 as SShort4. To ensure cross platform
+ compatibility, 16 bit inputs should be padded to 8 bytes.
+ */
+
+/*!
+ \fn QRhiVertexInputAttribute::QRhiVertexInputAttribute() = default
Constructs a default vertex input attribute description.
*/
@@ -1132,49 +1731,102 @@ QDebug operator<<(QDebug dbg, const QRhiVertexInputBinding &b)
/*!
Constructs a vertex input attribute description with the specified \a
binding number, \a location, \a format, and \a offset.
+
+ \a matrixSlice should be -1 except when this attribute corresponds to a row
+ or column of a matrix (for example, a 4x4 matrix becomes 4 vec4s, consuming
+ 4 consecutive vertex input locations), in which case it is the index of the
+ row or column. \c{location - matrixSlice} must always be equal to the \c
+ location for the first row or column of the unrolled matrix.
*/
-QRhiVertexInputAttribute::QRhiVertexInputAttribute(int binding, int location, Format format, quint32 offset)
+QRhiVertexInputAttribute::QRhiVertexInputAttribute(int binding, int location, Format format, quint32 offset, int matrixSlice)
: m_binding(binding),
m_location(location),
m_format(format),
- m_offset(offset)
+ m_offset(offset),
+ m_matrixSlice(matrixSlice)
{
}
/*!
+ \fn int QRhiVertexInputAttribute::binding() const
+ \return the binding point index.
+ */
+
+/*!
+ \fn void QRhiVertexInputAttribute::setBinding(int b)
+ Sets the binding point index to \a b.
+ By default this is set to 0.
+ */
+
+/*!
+ \fn int QRhiVertexInputAttribute::location() const
+ \return the location of the vertex input element.
+ */
+
+/*!
+ \fn void QRhiVertexInputAttribute::setLocation(int loc)
+ Sets the location of the vertex input element to \a loc.
+ By default this is set to 0.
+ */
+
+/*!
+ \fn QRhiVertexInputAttribute::Format QRhiVertexInputAttribute::format() const
+ \return the format of the vertex input element.
+ */
+
+/*!
+ \fn void QRhiVertexInputAttribute::setFormat(Format f)
+ Sets the format of the vertex input element to \a f.
+ By default this is set to Float4.
+ */
+
+/*!
+ \fn quint32 QRhiVertexInputAttribute::offset() const
+ \return the byte offset for the input element.
+ */
+
+/*!
+ \fn void QRhiVertexInputAttribute::setOffset(quint32 ofs)
+ Sets the byte offset for the input element to \a ofs.
+ */
+
+/*!
+ \fn int QRhiVertexInputAttribute::matrixSlice() const
+
+ \return the matrix slice if the input element corresponds to a row or
+ column of a matrix, or -1 if not relevant.
+ */
+
+/*!
+ \fn void QRhiVertexInputAttribute::setMatrixSlice(int slice)
+
+ Sets the matrix \a slice. By default this is set to -1, and should be set
+ to a >= 0 value only when this attribute corresponds to a row or column of
+ a matrix (for example, a 4x4 matrix becomes 4 vec4s, consuming 4
+ consecutive vertex input locations), in which case it is the index of the
+ row or column. \c{location - matrixSlice} must always be equal to the \c
+ location for the first row or column of the unrolled matrix.
+ */
+
+/*!
+ \fn bool QRhiVertexInputAttribute::operator==(const QRhiVertexInputAttribute &a, const QRhiVertexInputAttribute &b) noexcept
+
\return \c true if the values in the two QRhiVertexInputAttribute objects
\a a and \a b are equal.
-
- \relates QRhiVertexInputAttribute
*/
-bool operator==(const QRhiVertexInputAttribute &a, const QRhiVertexInputAttribute &b) Q_DECL_NOTHROW
-{
- return a.binding() == b.binding()
- && a.location() == b.location()
- && a.format() == b.format()
- && a.offset() == b.offset();
-}
/*!
+ \fn bool QRhiVertexInputAttribute::operator!=(const QRhiVertexInputAttribute &a, const QRhiVertexInputAttribute &b) noexcept
+
\return \c false if the values in the two QRhiVertexInputAttribute
objects \a a and \a b are equal; otherwise returns \c true.
-
- \relates QRhiVertexInputAttribute
*/
-bool operator!=(const QRhiVertexInputAttribute &a, const QRhiVertexInputAttribute &b) Q_DECL_NOTHROW
-{
- return !(a == b);
-}
/*!
- \return the hash value for \a v, using \a seed to seed the calculation.
+ \fn size_t QRhiVertexInputAttribute::qHash(const QRhiVertexInputAttribute &v, size_t seed = 0) noexcept
- \relates QRhiVertexInputAttribute
+ \return the hash value for \a v, using \a seed to seed the calculation.
*/
-uint qHash(const QRhiVertexInputAttribute &v, uint seed) Q_DECL_NOTHROW
-{
- return seed + uint(v.binding()) + uint(v.location()) + uint(v.format()) + v.offset();
-}
#ifndef QT_NO_DEBUG_STREAM
QDebug operator<<(QDebug dbg, const QRhiVertexInputAttribute &a)
@@ -1189,61 +1841,237 @@ QDebug operator<<(QDebug dbg, const QRhiVertexInputAttribute &a)
}
#endif
+QRhiVertexInputAttribute::Format QRhiImplementation::shaderDescVariableFormatToVertexInputFormat(QShaderDescription::VariableType type) const
+{
+ switch (type) {
+ case QShaderDescription::Vec4:
+ return QRhiVertexInputAttribute::Float4;
+ case QShaderDescription::Vec3:
+ return QRhiVertexInputAttribute::Float3;
+ case QShaderDescription::Vec2:
+ return QRhiVertexInputAttribute::Float2;
+ case QShaderDescription::Float:
+ return QRhiVertexInputAttribute::Float;
+
+ case QShaderDescription::Int4:
+ return QRhiVertexInputAttribute::SInt4;
+ case QShaderDescription::Int3:
+ return QRhiVertexInputAttribute::SInt3;
+ case QShaderDescription::Int2:
+ return QRhiVertexInputAttribute::SInt2;
+ case QShaderDescription::Int:
+ return QRhiVertexInputAttribute::SInt;
+
+ case QShaderDescription::Uint4:
+ return QRhiVertexInputAttribute::UInt4;
+ case QShaderDescription::Uint3:
+ return QRhiVertexInputAttribute::UInt3;
+ case QShaderDescription::Uint2:
+ return QRhiVertexInputAttribute::UInt2;
+ case QShaderDescription::Uint:
+ return QRhiVertexInputAttribute::UInt;
+
+ case QShaderDescription::Half4:
+ return QRhiVertexInputAttribute::Half4;
+ case QShaderDescription::Half3:
+ return QRhiVertexInputAttribute::Half3;
+ case QShaderDescription::Half2:
+ return QRhiVertexInputAttribute::Half2;
+ case QShaderDescription::Half:
+ return QRhiVertexInputAttribute::Half;
+
+ default:
+ Q_UNREACHABLE_RETURN(QRhiVertexInputAttribute::Float);
+ }
+}
+
+quint32 QRhiImplementation::byteSizePerVertexForVertexInputFormat(QRhiVertexInputAttribute::Format format) const
+{
+ switch (format) {
+ case QRhiVertexInputAttribute::Float4:
+ return 4 * sizeof(float);
+ case QRhiVertexInputAttribute::Float3:
+ return 4 * sizeof(float); // vec3 still takes 16 bytes
+ case QRhiVertexInputAttribute::Float2:
+ return 2 * sizeof(float);
+ case QRhiVertexInputAttribute::Float:
+ return sizeof(float);
+
+ case QRhiVertexInputAttribute::UNormByte4:
+ return 4 * sizeof(quint8);
+ case QRhiVertexInputAttribute::UNormByte2:
+ return 2 * sizeof(quint8);
+ case QRhiVertexInputAttribute::UNormByte:
+ return sizeof(quint8);
+
+ case QRhiVertexInputAttribute::UInt4:
+ return 4 * sizeof(quint32);
+ case QRhiVertexInputAttribute::UInt3:
+ return 4 * sizeof(quint32); // ivec3 still takes 16 bytes
+ case QRhiVertexInputAttribute::UInt2:
+ return 2 * sizeof(quint32);
+ case QRhiVertexInputAttribute::UInt:
+ return sizeof(quint32);
+
+ case QRhiVertexInputAttribute::SInt4:
+ return 4 * sizeof(qint32);
+ case QRhiVertexInputAttribute::SInt3:
+ return 4 * sizeof(qint32); // uvec3 still takes 16 bytes
+ case QRhiVertexInputAttribute::SInt2:
+ return 2 * sizeof(qint32);
+ case QRhiVertexInputAttribute::SInt:
+ return sizeof(qint32);
+
+ case QRhiVertexInputAttribute::Half4:
+ return 4 * sizeof(qfloat16);
+ case QRhiVertexInputAttribute::Half3:
+ return 4 * sizeof(qfloat16); // half3 still takes 8 bytes
+ case QRhiVertexInputAttribute::Half2:
+ return 2 * sizeof(qfloat16);
+ case QRhiVertexInputAttribute::Half:
+ return sizeof(qfloat16);
+
+ case QRhiVertexInputAttribute::UShort4:
+ return 4 * sizeof(quint16);
+ case QRhiVertexInputAttribute::UShort3:
+ return 4 * sizeof(quint16); // ivec3 still takes 8 bytes
+ case QRhiVertexInputAttribute::UShort2:
+ return 2 * sizeof(quint16);
+ case QRhiVertexInputAttribute::UShort:
+ return sizeof(quint16);
+
+ case QRhiVertexInputAttribute::SShort4:
+ return 4 * sizeof(qint16);
+ case QRhiVertexInputAttribute::SShort3:
+ return 4 * sizeof(qint16); // uvec3 still takes 8 bytes
+ case QRhiVertexInputAttribute::SShort2:
+ return 2 * sizeof(qint16);
+ case QRhiVertexInputAttribute::SShort:
+ return sizeof(qint16);
+
+ default:
+ Q_UNREACHABLE_RETURN(1);
+ }
+}
+
/*!
\class QRhiVertexInputLayout
- \internal
\inmodule QtGui
+ \since 6.6
\brief Describes the layout of vertex inputs consumed by a vertex shader.
The vertex input layout is defined by the collections of
QRhiVertexInputBinding and QRhiVertexInputAttribute.
+
+ As an example, let's assume that we have a single buffer with 3 component
+ vertex positions and 2 component UV coordinates interleaved (\c x, \c y, \c
+ z, \c u, \c v), that the position and UV are expected at input locations 0
+ and 1 by the vertex shader, and that the vertex buffer will be bound at
+ binding point 0 using
+ \l{QRhiCommandBuffer::setVertexInput()}{setVertexInput()} later on:
+
+ \code
+ QRhiVertexInputLayout inputLayout;
+ inputLayout.setBindings({
+ { 5 * sizeof(float) }
+ });
+ inputLayout.setAttributes({
+ { 0, 0, QRhiVertexInputAttribute::Float3, 0 },
+ { 0, 1, QRhiVertexInputAttribute::Float2, 3 * sizeof(float) }
+ });
+ \endcode
+
+ \note This is a RHI API with limited compatibility guarantees, see \l QRhi
+ for details.
*/
/*!
- \fn QRhiVertexInputLayout::QRhiVertexInputLayout()
+ \fn QRhiVertexInputLayout::QRhiVertexInputLayout() = default
Constructs an empty vertex input layout description.
*/
/*!
+ \fn void QRhiVertexInputLayout::setBindings(std::initializer_list<QRhiVertexInputBinding> list)
+ Sets the bindings from the specified \a list.
+ */
+
+/*!
+ \fn template<typename InputIterator> void QRhiVertexInputLayout::setBindings(InputIterator first, InputIterator last)
+ Sets the bindings using the iterators \a first and \a last.
+ */
+
+/*!
+ \fn const QRhiVertexInputBinding *QRhiVertexInputLayout::cbeginBindings() const
+ \return a const iterator pointing to the first item in the binding list.
+ */
+
+/*!
+ \fn const QRhiVertexInputBinding *QRhiVertexInputLayout::cendBindings() const
+ \return a const iterator pointing just after the last item in the binding list.
+ */
+
+/*!
+ \fn const QRhiVertexInputBinding *QRhiVertexInputLayout::bindingAt(qsizetype index) const
+ \return the binding at the given \a index.
+ */
+
+/*!
+ \fn qsizetype QRhiVertexInputLayout::bindingCount() const
+ \return the number of bindings.
+ */
+
+/*!
+ \fn void QRhiVertexInputLayout::setAttributes(std::initializer_list<QRhiVertexInputAttribute> list)
+ Sets the attributes from the specified \a list.
+ */
+
+/*!
+ \fn template<typename InputIterator> void QRhiVertexInputLayout::setAttributes(InputIterator first, InputIterator last)
+ Sets the attributes using the iterators \a first and \a last.
+ */
+
+/*!
+ \fn const QRhiVertexInputAttribute *QRhiVertexInputLayout::cbeginAttributes() const
+ \return a const iterator pointing to the first item in the attribute list.
+ */
+
+/*!
+ \fn const QRhiVertexInputAttribute *QRhiVertexInputLayout::cendAttributes() const
+ \return a const iterator pointing just after the last item in the attribute list.
+ */
+
+/*!
+ \fn const QRhiVertexInputAttribute *QRhiVertexInputLayout::attributeAt(qsizetype index) const
+ \return the attribute at the given \a index.
+ */
+
+/*!
+ \fn qsizetype QRhiVertexInputLayout::attributeCount() const
+ \return the number of attributes.
+ */
+
+/*!
+ \fn bool QRhiVertexInputLayout::operator==(const QRhiVertexInputLayout &a, const QRhiVertexInputLayout &b) noexcept
+
\return \c true if the values in the two QRhiVertexInputLayout objects
\a a and \a b are equal.
-
- \relates QRhiVertexInputLayout
*/
-bool operator==(const QRhiVertexInputLayout &a, const QRhiVertexInputLayout &b) Q_DECL_NOTHROW
-{
- return a.m_bindings == b.m_bindings && a.m_attributes == b.m_attributes;
-}
/*!
+ \fn bool QRhiVertexInputLayout::operator!=(const QRhiVertexInputLayout &a, const QRhiVertexInputLayout &b) noexcept
+
\return \c false if the values in the two QRhiVertexInputLayout
objects \a a and \a b are equal; otherwise returns \c true.
-
- \relates QRhiVertexInputLayout
*/
-bool operator!=(const QRhiVertexInputLayout &a, const QRhiVertexInputLayout &b) Q_DECL_NOTHROW
-{
- return !(a == b);
-}
/*!
- \return the hash value for \a v, using \a seed to seed the calculation.
+ \fn size_t QRhiVertexInputLayout::qHash(const QRhiVertexInputLayout &v, size_t seed = 0) noexcept
- \relates QRhiVertexInputLayout
+ \return the hash value for \a v, using \a seed to seed the calculation.
*/
-uint qHash(const QRhiVertexInputLayout &v, uint seed) Q_DECL_NOTHROW
-{
- return qHash(v.m_bindings, seed) + qHash(v.m_attributes, seed);
-}
#ifndef QT_NO_DEBUG_STREAM
-template<typename T, int N>
-QDebug operator<<(QDebug dbg, const QVarLengthArray<T, N> &vla)
-{
- return QtPrivate::printSequentialContainer(dbg, "VLA", vla);
-}
-
QDebug operator<<(QDebug dbg, const QRhiVertexInputLayout &v)
{
QDebugStateSaver saver(dbg);
@@ -1256,9 +2084,39 @@ QDebug operator<<(QDebug dbg, const QRhiVertexInputLayout &v)
/*!
\class QRhiShaderStage
- \internal
\inmodule QtGui
+ \since 6.6
\brief Specifies the type and the shader code for a shader stage in the pipeline.
+
+ When setting up a QRhiGraphicsPipeline, a collection of shader stages are
+ specified. The QRhiShaderStage contains a QShader and some associated
+ metadata, such as the graphics pipeline stage, and the
+ \l{QShader::Variant}{shader variant} to select. There is no need to specify
+ the shader language or version because the QRhi backend in use at runtime
+ will take care of choosing the appropriate shader version from the
+ collection within the QShader.
+
+ The typical usage is in combination with
+ QRhiGraphicsPipeline::setShaderStages(), shown here with a simple approach
+ to load the QShader from \c{.qsb} files generated offline or at build time:
+
+ \code
+ QShader getShader(const QString &name)
+ {
+ QFile f(name);
+ return f.open(QIODevice::ReadOnly) ? QShader::fromSerialized(f.readAll()) : QShader();
+ }
+
+ QShader vs = getShader("material.vert.qsb");
+ QShader fs = getShader("material.frag.qsb");
+ pipeline->setShaderStages({
+ { QRhiShaderStage::Vertex, vs },
+ { QRhiShaderStage::Fragment, fs }
+ });
+ \endcode
+
+ \note This is a RHI API with limited compatibility guarantees, see \l QRhi
+ for details.
*/
/*!
@@ -1266,18 +2124,63 @@ QDebug operator<<(QDebug dbg, const QRhiVertexInputLayout &v)
Specifies the type of the shader stage.
\value Vertex Vertex stage
- \value Fragment Fragment (pixel) stage
- \value Compute Compute stage (this may not always be supported at run time)
+
+ \value TessellationControl Tessellation control (hull shader) stage. Must
+ be used only when the QRhi::Tessellation feature is supported.
+
+ \value TessellationEvaluation Tessellation evaluation (domain shader)
+ stage. Must be used only when the QRhi::Tessellation feature is supported.
+
+ \value Fragment Fragment (pixel shader) stage
+
+ \value Compute Compute stage. Must be used only when the QRhi::Compute
+ feature is supported.
+
+ \value Geometry Geometry stage. Must be used only when the
+ QRhi::GeometryShader feature is supported.
*/
/*!
- \fn QRhiShaderStage::QRhiShaderStage()
+ \fn QRhiShaderStage::QRhiShaderStage() = default
Constructs a shader stage description for the vertex stage with an empty
QShader.
*/
/*!
+ \fn QRhiShaderStage::Type QRhiShaderStage::type() const
+ \return the type of the stage.
+ */
+
+/*!
+ \fn void QRhiShaderStage::setType(Type t)
+
+ Sets the type of the stage to \a t. Setters should rarely be needed in
+ pratice. Most applications will likely use the QRhiShaderStage constructor
+ in most cases.
+ */
+
+/*!
+ \fn QShader QRhiShaderStage::shader() const
+ \return the QShader to be used for this stage in the graphics pipeline.
+ */
+
+/*!
+ \fn void QRhiShaderStage::setShader(const QShader &s)
+ Sets the shader collection \a s.
+ */
+
+/*!
+ \fn QShader::Variant QRhiShaderStage::shaderVariant() const
+ \return the requested shader variant.
+ */
+
+/*!
+ \fn void QRhiShaderStage::setShaderVariant(QShader::Variant v)
+ Sets the requested shader variant \a v.
+ */
+
+/*!
Constructs a shader stage description with the \a type of the stage and the
\a shader.
@@ -1294,38 +2197,24 @@ QRhiShaderStage::QRhiShaderStage(Type type, const QShader &shader, QShader::Vari
}
/*!
+ \fn bool QRhiShaderStage::operator==(const QRhiShaderStage &a, const QRhiShaderStage &b) noexcept
+
\return \c true if the values in the two QRhiShaderStage objects
\a a and \a b are equal.
-
- \relates QRhiShaderStage
*/
-bool operator==(const QRhiShaderStage &a, const QRhiShaderStage &b) Q_DECL_NOTHROW
-{
- return a.type() == b.type()
- && a.shader() == b.shader()
- && a.shaderVariant() == b.shaderVariant();
-}
/*!
+ \fn bool QRhiShaderStage::operator!=(const QRhiShaderStage &a, const QRhiShaderStage &b) noexcept
+
\return \c false if the values in the two QRhiShaderStage
objects \a a and \a b are equal; otherwise returns \c true.
-
- \relates QRhiShaderStage
*/
-bool operator!=(const QRhiShaderStage &a, const QRhiShaderStage &b) Q_DECL_NOTHROW
-{
- return !(a == b);
-}
/*!
- \return the hash value for \a v, using \a seed to seed the calculation.
+ \fn size_t QRhiShaderStage::qHash(const QRhiShaderStage &v, size_t seed = 0) noexcept
- \relates QRhiShaderStage
+ \return the hash value for \a v, using \a seed to seed the calculation.
*/
-uint qHash(const QRhiShaderStage &v, uint seed) Q_DECL_NOTHROW
-{
- return v.type() + qHash(v.shader(), seed) + v.shaderVariant();
-}
#ifndef QT_NO_DEBUG_STREAM
QDebug operator<<(QDebug dbg, const QRhiShaderStage &s)
@@ -1341,12 +2230,14 @@ QDebug operator<<(QDebug dbg, const QRhiShaderStage &s)
/*!
\class QRhiColorAttachment
- \internal
\inmodule QtGui
+ \since 6.6
\brief Describes the a single color attachment of a render target.
A color attachment is either a QRhiTexture or a QRhiRenderBuffer. The
- former, when texture() is set, is used in most cases.
+ former, i.e. when texture() is set, is used in most cases.
+ QRhiColorAttachment is commonly used in combination with
+ QRhiTextureRenderTargetDescription.
\note texture() and renderBuffer() cannot be both set (be non-null at the
same time).
@@ -1358,9 +2249,10 @@ QDebug operator<<(QDebug dbg, const QRhiShaderStage &s)
support for multisample textures, but does support multisample
renderbuffers).
- When targeting a non-multisample texture, the layer() and level()
- indicate the targeted layer (face index \c{0-5} for cubemaps) and mip
- level.
+ When targeting a non-multisample texture, the layer() and level() indicate
+ the targeted layer (face index \c{0-5} for cubemaps) and mip level. For 3D
+ textures layer() specifies the slice (one 2D image within the 3D texture)
+ to render to. For texture arrays layer() is the array index.
When texture() or renderBuffer() is multisample, resolveTexture() can be
set optionally. When set, samples are resolved automatically into that
@@ -1372,10 +2264,15 @@ QDebug operator<<(QDebug dbg, const QRhiShaderStage &s)
\note when resolving is enabled, the multisample data may not be written
out at all. This means that the multisample texture() must not be used
afterwards with shaders for sampling when resolveTexture() is set.
+
+ \note This is a RHI API with limited compatibility guarantees, see \l QRhi
+ for details.
+
+ \sa QRhiTextureRenderTargetDescription
*/
/*!
- \fn QRhiColorAttachment::QRhiColorAttachment()
+ \fn QRhiColorAttachment::QRhiColorAttachment() = default
Constructs an empty color attachment description.
*/
@@ -1399,9 +2296,194 @@ QRhiColorAttachment::QRhiColorAttachment(QRhiRenderBuffer *renderBuffer)
}
/*!
+ \fn QRhiTexture *QRhiColorAttachment::texture() const
+
+ \return the texture this attachment description references, or \nullptr if
+ there is none.
+ */
+
+/*!
+ \fn void QRhiColorAttachment::setTexture(QRhiTexture *tex)
+
+ Sets the texture \a tex.
+
+ \note texture() and renderBuffer() cannot be both set (be non-null at the
+ same time).
+ */
+
+/*!
+ \fn QRhiRenderBuffer *QRhiColorAttachment::renderBuffer() const
+
+ \return the renderbuffer this attachment description references, or
+ \nullptr if there is none.
+
+ In practice associating a QRhiRenderBuffer with a QRhiColorAttachment makes
+ the most sense when setting up multisample rendering via a multisample
+ \l{QRhiRenderBuffer::Type}{color} renderbuffer that is then resolved into a
+ non-multisample texture at the end of the render pass.
+ */
+
+/*!
+ \fn void QRhiColorAttachment::setRenderBuffer(QRhiRenderBuffer *rb)
+
+ Sets the renderbuffer \a rb.
+
+ \note texture() and renderBuffer() cannot be both set (be non-null at the
+ same time).
+ */
+
+/*!
+ \fn int QRhiColorAttachment::layer() const
+ \return the layer index (cubemap face or array layer). 0 by default.
+ */
+
+/*!
+ \fn void QRhiColorAttachment::setLayer(int layer)
+ Sets the \a layer index.
+ */
+
+/*!
+ \fn int QRhiColorAttachment::level() const
+ \return the mip level. 0 by default.
+ */
+
+/*!
+ \fn void QRhiColorAttachment::setLevel(int level)
+ Sets the mip \a level.
+ */
+
+/*!
+ \fn QRhiTexture *QRhiColorAttachment::resolveTexture() const
+
+ \return the resolve texture this attachment description references, or
+ \nullptr if there is none.
+
+ Setting a non-null resolve texture is applicable when the attachment
+ references a multisample texture or renderbuffer. The QRhiTexture in the
+ resolveTexture() is then a non-multisample 2D texture (or texture array)
+ with the same size (but a sample count of 1). The multisample content is
+ automatically resolved into this texture at the end of each render pass.
+ */
+
+/*!
+ \fn void QRhiColorAttachment::setResolveTexture(QRhiTexture *tex)
+
+ Sets the resolve texture \a tex.
+
+ \a tex is expected to be a 2D texture or a 2D texture array. In either
+ case, resolving targets a single mip level of a single layer (array
+ element) of \a tex. The mip level and array layer are specified by
+ resolveLevel() and resolveLayer().
+
+ An exception is \l{setMultiViewCount()}{multiview}: when the color
+ attachment is associated with a texture array and multiview is enabled, the
+ resolve texture must also be a texture array with sufficient elements for
+ all views. In this case all elements that correspond to views are resolved
+ automatically; the behavior is similar to the following pseudo-code:
+ \badcode
+ for (i = 0; i < multiViewCount(); ++i)
+ resolve texture's layer() + i into resolveTexture's resolveLayer() + i
+ \endcode
+
+ Setting a non-multisample texture to resolve a multisample texture or
+ renderbuffer automatically at the end of the render pass is often
+ preferable to working with multisample textures (and not setting a resolve
+ texture), because it avoids the need for writing dedicated fragment shaders
+ that work exclusively with multisample textures (\c sampler2DMS, \c
+ texelFetch, etc.), and rather allows using the same shader as one would if
+ the attachment's texture was not multisampled to begin with. This comes at
+ the expense of an additional resource (the non-multisample \a tex).
+ */
+
+/*!
+ \fn int QRhiColorAttachment::resolveLayer() const
+ \return the currently set resolve texture layer. Defaults to 0.
+ */
+
+/*!
+ \fn void QRhiColorAttachment::setResolveLayer(int layer)
+ Sets the resolve texture \a layer to use.
+ */
+
+/*!
+ \fn int QRhiColorAttachment::resolveLevel() const
+ \return the currently set resolve texture mip level. Defaults to 0.
+ */
+
+/*!
+ \fn void QRhiColorAttachment::setResolveLevel(int level)
+ Sets the resolve texture mip \a level to use.
+ */
+
+/*!
+ \fn int QRhiColorAttachment::multiViewCount() const
+
+ \return the currently set number of views. Defaults to 0 which indicates
+ the render target with this color attachment is not going to be used with
+ multiview rendering.
+
+ \since 6.7
+ */
+
+/*!
+ \fn void QRhiColorAttachment::setMultiViewCount(int count)
+
+ Sets the view \a count. Setting a value larger than 1 indicates that the
+ render target with this color attachment is going to be used with multiview
+ rendering. The default value is 0. Values smaller than 2 indicate no
+ multiview rendering.
+
+ When \a count is set to \c 2 or greater, the color attachment must be
+ associated with a 2D texture array. layer() and multiViewCount() together
+ define the range of texture array elements that are targeted during
+ multiview rendering.
+
+ For example, if \c layer is \c 0 and \c multiViewCount is \c 2, the texture
+ array must have 2 (or more) elements, and the multiview rendering will
+ target elements 0 and 1. The \c{gl_ViewIndex} variable in the shaders has a
+ value of \c 0 or \c 1 then, where view \c 0 corresponds to the texture array
+ element \c 0, and view \c 1 to the array element \c 1.
+
+ \note Setting a \a count larger than 1, using a texture array as texture(),
+ and calling \l{QRhiCommandBuffer::beginPass()}{beginPass()} on a
+ QRhiTextureRenderTarget with this color attachment implies multiview
+ rendering for the entire render pass. multiViewCount() should not be set
+ unless multiview rendering is wanted. Multiview cannot be used with texture
+ types other than 2D texture arrays. (although 3D textures may work,
+ depending on the graphics API and backend; applications are nonetheless
+ advised not to rely on that and only use 2D texture arrays as the render
+ targets of multiview rendering)
+
+ See
+ \l{https://registry.khronos.org/OpenGL/extensions/OVR/OVR_multiview.txt}{GL_OVR_multiview}
+ for more details regarding multiview rendering. Do note that Qt requires
+ \l{https://registry.khronos.org/OpenGL/extensions/OVR/OVR_multiview2.txt}{GL_OVR_multiview2}
+ as well, when running on OpenGL (ES).
+
+ Multiview rendering is available only when the
+ \l{QRhi::MultiView}{MultiView} feature is reported as supported from
+ \l{QRhi::isFeatureSupported()}{isFeatureSupported()}.
+
+ \note For portability, be aware of limitations that exist for multiview
+ rendering with some of the graphics APIs. It is recommended that multiview
+ render passes do not rely on any of the features that
+ \l{https://registry.khronos.org/OpenGL/extensions/OVR/OVR_multiview.txt}{GL_OVR_multiview}
+ declares as unsupported. The one exception is shader stage outputs other
+ than \c{gl_Position} depending on \c{gl_ViewIndex}: that can be relied on
+ (even with OpenGL) because QRhi never reports multiview as supported without
+ \c{GL_OVR_multiview2} also being present.
+
+ \note Multiview rendering is not supported in combination with tessellation
+ or geometry shaders, even though some implementations of some graphics APIs
+ may allow this.
+
+ \since 6.7
+ */
+
+/*!
\class QRhiTextureRenderTargetDescription
- \internal
\inmodule QtGui
+ \since 6.6
\brief Describes the color and depth or depth/stencil attachments of a render target.
A texture render target has zero or more textures as color attachments,
@@ -1410,10 +2492,97 @@ QRhiColorAttachment::QRhiColorAttachment(QRhiRenderBuffer *renderBuffer)
\note depthStencilBuffer() and depthTexture() cannot be both set (cannot be
non-null at the same time).
+
+ Let's look at some example usages in combination with
+ QRhiTextureRenderTarget.
+
+ Due to the constructors, the targeting a texture (and no depth/stencil
+ buffer) is simple:
+
+ \code
+ QRhiTexture *texture = rhi->newTexture(QRhiTexture::RGBA8, QSize(256, 256), 1, QRhiTexture::RenderTarget);
+ texture->create();
+ QRhiTextureRenderTarget *rt = rhi->newTextureRenderTarget({ texture }));
+ \endcode
+
+ The following creates a texture render target that is set up to target mip
+ level #2 of a texture:
+
+ \code
+ QRhiTexture *texture = rhi->newTexture(QRhiTexture::RGBA8, QSize(512, 512), 1, QRhiTexture::RenderTarget | QRhiTexture::MipMapped);
+ texture->create();
+ QRhiColorAttachment colorAtt(texture);
+ colorAtt.setLevel(2);
+ QRhiTextureRenderTarget *rt = rhi->newTextureRenderTarget({ colorAtt });
+ \endcode
+
+ Another example, this time to render into a depth texture:
+
+ \code
+ QRhiTexture *shadowMap = rhi->newTexture(QRhiTexture::D32F, QSize(1024, 1024), 1, QRhiTexture::RenderTarget);
+ shadowMap->create();
+ QRhiTextureRenderTargetDescription rtDesc;
+ rtDesc.setDepthTexture(shadowMap);
+ QRhiTextureRenderTarget *rt = rhi->newTextureRenderTarget(rtDesc);
+ \endcode
+
+ A very common case, having a texture as the color attachment and a
+ renderbuffer as depth/stencil to enable depth testing:
+
+ \code
+ QRhiTexture *texture = rhi->newTexture(QRhiTexture::RGBA8, QSize(512, 512), 1. QRhiTexture::RenderTarget);
+ texture->create();
+ QRhiRenderBuffer *depthStencil = rhi->newRenderBuffer(QRhiRenderBuffer::DepthStencil, QSize(512, 512));
+ depthStencil->create();
+ QRhiTextureRenderTargetDescription rtDesc({ texture }, depthStencil);
+ QRhiTextureRenderTarget *rt = rhi->newTextureRenderTarget(rtDesc);
+ \endcode
+
+ Finally, to enable multisample rendering in a portable manner (so also
+ supporting OpenGL ES 3.0), using a QRhiRenderBuffer as the (multisample)
+ color buffer and then resolving into a regular (non-multisample) 2D
+ texture. To enable depth testing, a depth-stencil buffer, which also must
+ use the same sample count, is used as well:
+
+ \code
+ QRhiRenderBuffer *colorBuffer = rhi->newRenderBuffer(QRhiRenderBuffer::Color, QSize(512, 512), 4); // 4x MSAA
+ colorBuffer->create();
+ QRhiRenderBuffer *depthStencil = rhi->newRenderBuffer(QRhiRenderBuffer::DepthStencil, QSize(512, 512), 4);
+ depthStencil->create();
+ QRhiTexture *texture = rhi->newTexture(QRhiTexture::RGBA8, QSize(512, 512), 1, QRhiTexture::RenderTarget);
+ texture->create();
+ QRhiColorAttachment colorAtt(colorBuffer);
+ colorAtt.setResolveTexture(texture);
+ QRhiTextureRenderTarget *rt = rhi->newTextureRenderTarget({ colorAtt, depthStencil });
+ \endcode
+
+ \note when multisample resolving is enabled, the multisample data may not be
+ written out at all. This means that the multisample texture in a color
+ attachment must not be used afterwards with shaders for sampling (or other
+ purposes) whenever a resolve texture is set, since the multisample color
+ buffer is merely an intermediate storage then that gets no data written back
+ on some GPU architectures at all. See
+ \l{QRhiTextureRenderTarget::Flag}{PreserveColorContents} for more details.
+
+ \note When using setDepthTexture(), not setDepthStencilBuffer(), and the
+ depth (stencil) data is not of interest afterwards, set the
+ DoNotStoreDepthStencilContents flag on the QRhiTextureRenderTarget. This
+ allows indicating to the underlying 3D API that the depth/stencil data can
+ be discarded, leading potentially to better performance with tiled GPU
+ architectures. When the depth-stencil buffer is a QRhiRenderBuffer (and also
+ for the multisample color texture, see previous note) this is implicit, but
+ with a depth (stencil) QRhiTexture the intention needs to be declared
+ explicitly. By default QRhi assumes that the data is of interest (e.g., the
+ depth texture is sampled in a shader afterwards).
+
+ \note This is a RHI API with limited compatibility guarantees, see \l QRhi
+ for details.
+
+ \sa QRhiColorAttachment, QRhiTextureRenderTarget
*/
/*!
- \fn QRhiTextureRenderTargetDescription::QRhiTextureRenderTargetDescription()
+ \fn QRhiTextureRenderTargetDescription::QRhiTextureRenderTargetDescription() = default
Constructs an empty texture render target description.
*/
@@ -1455,9 +2624,125 @@ QRhiTextureRenderTargetDescription::QRhiTextureRenderTargetDescription(const QRh
}
/*!
+ \fn void QRhiTextureRenderTargetDescription::setColorAttachments(std::initializer_list<QRhiColorAttachment> list)
+ Sets the \a list of color attachments.
+ */
+
+/*!
+ \fn template<typename InputIterator> void QRhiTextureRenderTargetDescription::setColorAttachments(InputIterator first, InputIterator last)
+ Sets the list of color attachments via the iterators \a first and \a last.
+ */
+
+/*!
+ \fn const QRhiColorAttachment *QRhiTextureRenderTargetDescription::cbeginColorAttachments() const
+ \return a const iterator pointing to the first item in the attachment list.
+ */
+
+/*!
+ \fn const QRhiColorAttachment *QRhiTextureRenderTargetDescription::cendColorAttachments() const
+ \return a const iterator pointing just after the last item in the attachment list.
+ */
+
+/*!
+ \fn const QRhiColorAttachment *QRhiTextureRenderTargetDescription::colorAttachmentAt(qsizetype index) const
+ \return the color attachment at the specified \a index.
+ */
+
+/*!
+ \fn qsizetype QRhiTextureRenderTargetDescription::colorAttachmentCount() const
+ \return the number of currently set color attachments.
+ */
+
+/*!
+ \fn QRhiRenderBuffer *QRhiTextureRenderTargetDescription::depthStencilBuffer() const
+ \return the renderbuffer used as depth-stencil buffer, or \nullptr if none was set.
+ */
+
+/*!
+ \fn void QRhiTextureRenderTargetDescription::setDepthStencilBuffer(QRhiRenderBuffer *renderBuffer)
+
+ Sets the \a renderBuffer for depth-stencil. Not mandatory, e.g. when no
+ depth test/write or stencil-related features are used within any graphics
+ pipelines in any of the render passes for this render target, it can be
+ left set to \nullptr.
+
+ \note depthStencilBuffer() and depthTexture() cannot be both set (cannot be
+ non-null at the same time).
+
+ Using a QRhiRenderBuffer over a 2D QRhiTexture as the depth or
+ depth/stencil buffer is very common, and is the recommended approach for
+ applications. Using a QRhiTexture, and so setDepthTexture() becomes
+ relevant if the depth data is meant to be accessed (e.g. sampled in a
+ shader) afterwards, or when
+ \l{QRhiColorAttachment::setMultiViewCount()}{multiview rendering} is
+ involved (because then the depth texture must be a texture array).
+
+ \sa setDepthTexture()
+ */
+
+/*!
+ \fn QRhiTexture *QRhiTextureRenderTargetDescription::depthTexture() const
+ \return the currently referenced depth texture, or \nullptr if none was set.
+ */
+
+/*!
+ \fn void QRhiTextureRenderTargetDescription::setDepthTexture(QRhiTexture *texture)
+
+ Sets the \a texture for depth-stencil. This is an alternative to
+ setDepthStencilBuffer(), where instead of a QRhiRenderBuffer a QRhiTexture
+ with a suitable type (e.g., QRhiTexture::D32F) is provided.
+
+ \note depthStencilBuffer() and depthTexture() cannot be both set (cannot be
+ non-null at the same time).
+
+ \a texture can either be a 2D texture or a 2D texture array (when texture
+ arrays are supported). Specifying a texture array is relevant in particular
+ with
+ \l{QRhiColorAttachment::setMultiViewCount()}{multiview rendering}.
+
+ \note If \a texture is a format with a stencil component, such as
+ \l QRhiTexture::D24S8, it will serve as the stencil buffer as well.
+
+ \sa setDepthStencilBuffer()
+ */
+
+/*!
+ \fn QRhiTexture *QRhiTextureRenderTargetDescription::depthResolveTexture() const
+
+ \return the texture to which a multisample depth (or depth-stencil) texture
+ (or texture array) is resolved to. \nullptr if there is none, which is the
+ most common case.
+
+ \since 6.8
+ \sa QRhiColorAttachment::resolveTexture(), depthTexture()
+ */
+
+/*!
+ \fn void QRhiTextureRenderTargetDescription::setDepthResolveTexture(QRhiTexture *tex)
+
+ Sets the depth (or depth-stencil) resolve texture \a tex.
+
+ \a tex is expected to be a 2D texture or a 2D texture array with a format
+ matching the texture set via setDepthTexture().
+
+ \note Resolving depth (or depth-stencil) data is only functional when the
+ \l ResolveDepthStencil feature is reported as supported at run time. Support
+ for depth-stencil resolve is not universally available among the graphics
+ APIs. Designs assuming unconditional availability of depth-stencil resolve
+ are therefore non-portable, and should be avoided.
+
+ \note As an additional limitation for OpenGL ES in particular, setting a
+ depth resolve texture may only be functional in combination with
+ setDepthTexture(), not with setDepthStencilBuffer().
+
+ \since 6.8
+ \sa QRhiColorAttachment::setResolveTexture(), setDepthTexture()
+ */
+
+/*!
\class QRhiTextureSubresourceUploadDescription
- \internal
\inmodule QtGui
+ \since 6.6
\brief Describes the source for one mip level in a layer in a texture upload operation.
The source content is specified either as a QImage or as a raw blob. The
@@ -1475,29 +2760,54 @@ QRhiTextureRenderTargetDescription::QRhiTextureRenderTargetDescription(const QRh
the size of the source image() must match the subresource. When providing
raw data instead, sufficient number of bytes must be provided in data().
- \note With compressed textures the first upload must always match the
- subresource size due to graphics API limitations with some backends.
-
sourceTopLeft() is supported only for QImage-based uploads, and specifies
the top-left corner of the source rectangle.
\note Setting sourceSize() or sourceTopLeft() may trigger a QImage copy
internally, depending on the format and the backend.
- When providing raw data, the stride (row pitch, row length in bytes) of the
+ When providing raw data, and the stride is not specified via
+ setDataStride(), the stride (row pitch, row length in bytes) of the
provided data must be equal to \c{width * pixelSize} where \c pixelSize is
the number of bytes used for one pixel, and there must be no additional
padding between rows. There is no row start alignment requirement.
+ When there is unused data at the end of each row in the input raw data,
+ call setDataStride() with the total number of bytes per row. The stride
+ must always be a multiple of the number of bytes for one pixel. The row
+ stride is only applicable to image data for textures with an uncompressed
+ format.
+
\note The format of the source data must be compatible with the texture
format. With many graphics APIs the data is copied as-is into a staging
buffer, there is no intermediate format conversion provided by QRhi. This
applies to floating point formats as well, with, for example, RGBA16F
requiring half floats in the source data.
+
+ \note Setting the stride via setDataStride() is only functional when
+ QRhi::ImageDataStride is reported as
+ \l{QRhi::isFeatureSupported()}{supported}. In practice this can be expected
+ to be supported everywhere except for OpenGL ES 2.0.
+
+ \note When a QImage is given, the stride returned from
+ QImage::bytesPerLine() is taken into account automatically.
+
+ \warning When a QImage is given and the QImage does not own the underlying
+ pixel data, it is up to the caller to ensure that the associated data stays
+ valid until the end of the frame. (just submitting the resource update batch
+ is not sufficient, the data must stay valid until QRhi::endFrame() is called
+ in order to be portable across all backends) If this cannot be ensured, the
+ caller is strongly encouraged to call QImage::detach() on the image before
+ passing it to uploadTexture().
+
+ \note This is a RHI API with limited compatibility guarantees, see \l QRhi
+ for details.
+
+ \sa QRhiTextureUploadDescription
*/
/*!
- \fn QRhiTextureSubresourceUploadDescription::QRhiTextureSubresourceUploadDescription()
+ \fn QRhiTextureSubresourceUploadDescription::QRhiTextureSubresourceUploadDescription() = default
Constructs an empty subresource description.
@@ -1530,16 +2840,124 @@ QRhiTextureSubresourceUploadDescription::QRhiTextureSubresourceUploadDescription
\a data can safely be destroyed or changed once this function returns.
*/
-QRhiTextureSubresourceUploadDescription::QRhiTextureSubresourceUploadDescription(const void *data, int size)
+QRhiTextureSubresourceUploadDescription::QRhiTextureSubresourceUploadDescription(const void *data, quint32 size)
: m_data(reinterpret_cast<const char *>(data), size)
{
}
/*!
+ Constructs a mip level description with the image data specified by \a
+ data. This is suitable for floating point and compressed formats as well.
+ */
+QRhiTextureSubresourceUploadDescription::QRhiTextureSubresourceUploadDescription(const QByteArray &data)
+ : m_data(data)
+{
+}
+
+/*!
+ \fn QImage QRhiTextureSubresourceUploadDescription::image() const
+ \return the currently set QImage.
+ */
+
+/*!
+ \fn void QRhiTextureSubresourceUploadDescription::setImage(const QImage &image)
+
+ Sets \a image.
+ Upon textures loading, the image data will be read as is, with no formats conversions.
+
+ \note image() and data() cannot be both set at the same time.
+ */
+
+/*!
+ \fn QByteArray QRhiTextureSubresourceUploadDescription::data() const
+ \return the currently set raw pixel data.
+ */
+
+/*!
+ \fn void QRhiTextureSubresourceUploadDescription::setData(const QByteArray &data)
+
+ Sets \a data.
+
+ \note image() and data() cannot be both set at the same time.
+ */
+
+/*!
+ \fn quint32 QRhiTextureSubresourceUploadDescription::dataStride() const
+ \return the currently set data stride.
+ */
+
+/*!
+ \fn void QRhiTextureSubresourceUploadDescription::setDataStride(quint32 stride)
+
+ Sets the data \a stride in bytes. By default this is 0 and not always
+ relevant. When providing raw data(), and the stride is not specified via
+ setDataStride(), the stride (row pitch, row length in bytes) of the
+ provided data must be equal to \c{width * pixelSize} where \c pixelSize is
+ the number of bytes used for one pixel, and there must be no additional
+ padding between rows. Otherwise, if there is additional space between the
+ lines, set a non-zero \a stride. All this is applicable only when raw image
+ data is provided, and is not necessary when working QImage since that has
+ its own \l{QImage::bytesPerLine()}{stride} value.
+
+ \note Setting the stride via setDataStride() is only functional when
+ QRhi::ImageDataStride is reported as
+ \l{QRhi::isFeatureSupported()}{supported}.
+
+ \note When a QImage is given, the stride returned from
+ QImage::bytesPerLine() is taken into account automatically and therefore
+ there is no need to set the data stride manually.
+ */
+
+/*!
+ \fn QPoint QRhiTextureSubresourceUploadDescription::destinationTopLeft() const
+ \return the currently set destination top-left position. Defaults to (0, 0).
+ */
+
+/*!
+ \fn void QRhiTextureSubresourceUploadDescription::setDestinationTopLeft(const QPoint &p)
+ Sets the destination top-left position \a p.
+ */
+
+/*!
+ \fn QSize QRhiTextureSubresourceUploadDescription::sourceSize() const
+
+ \return the source size in pixels. Defaults to a default-constructed QSize,
+ which indicates the entire subresource.
+ */
+
+/*!
+ \fn void QRhiTextureSubresourceUploadDescription::setSourceSize(const QSize &size)
+
+ Sets the source \a size in pixels.
+
+ \note Setting sourceSize() or sourceTopLeft() may trigger a QImage copy
+ internally, depending on the format and the backend.
+ */
+
+/*!
+ \fn QPoint QRhiTextureSubresourceUploadDescription::sourceTopLeft() const
+ \return the currently set source top-left position. Defaults to (0, 0).
+ */
+
+/*!
+ \fn void QRhiTextureSubresourceUploadDescription::setSourceTopLeft(const QPoint &p)
+
+ Sets the source top-left position \a p.
+
+ \note Setting sourceSize() or sourceTopLeft() may trigger a QImage copy
+ internally, depending on the format and the backend.
+ */
+
+/*!
\class QRhiTextureUploadEntry
- \internal
\inmodule QtGui
- \brief Describes one layer (face for cubemaps) in a texture upload operation.
+ \since 6.6
+
+ \brief Describes one layer (face for cubemaps, slice for 3D textures,
+ element for texture arrays) in a texture upload operation.
+
+ \note This is a RHI API with limited compatibility guarantees, see \l QRhi
+ for details.
*/
/*!
@@ -1565,18 +2983,61 @@ QRhiTextureUploadEntry::QRhiTextureUploadEntry(int layer, int level,
}
/*!
+ \fn int QRhiTextureUploadEntry::layer() const
+ \return the currently set layer index (cubemap face, array layer). Defaults to 0.
+ */
+
+/*!
+ \fn void QRhiTextureUploadEntry::setLayer(int layer)
+ Sets the \a layer.
+ */
+
+/*!
+ \fn int QRhiTextureUploadEntry::level() const
+ \return the currently set mip level. Defaults to 0.
+ */
+
+/*!
+ \fn void QRhiTextureUploadEntry::setLevel(int level)
+ Sets the mip \a level.
+ */
+
+/*!
+ \fn QRhiTextureSubresourceUploadDescription QRhiTextureUploadEntry::description() const
+ \return the currently set subresource description.
+ */
+
+/*!
+ \fn void QRhiTextureUploadEntry::setDescription(const QRhiTextureSubresourceUploadDescription &desc)
+ Sets the subresource description \a desc.
+ */
+
+/*!
\class QRhiTextureUploadDescription
- \internal
\inmodule QtGui
+ \since 6.6
\brief Describes a texture upload operation.
Used with QRhiResourceUpdateBatch::uploadTexture(). That function has two
variants: one taking a QImage and one taking a
QRhiTextureUploadDescription. The former is a convenience version,
internally creating a QRhiTextureUploadDescription with a single image
- targeting level 0 for layer 0. However, when cubemaps, pre-generated mip
- images, or compressed textures are involved, applications will have to work
- directly with this class instead.
+ targeting level 0 for layer 0.
+
+ An example of the the common, simple case of wanting to upload the contents
+ of a QImage to a QRhiTexture with a matching pixel size:
+
+ \code
+ QImage image(256, 256, QImage::Format_RGBA8888);
+ image.fill(Qt::green); // or could use a QPainter targeting image
+ QRhiTexture *texture = rhi->newTexture(QRhiTexture::RGBA8, QSize(256, 256));
+ texture->create();
+ QRhiResourceUpdateBatch *u = rhi->nextResourceUpdateBatch();
+ u->uploadTexture(texture, image);
+ \endcode
+
+ When cubemaps, pre-generated mip images, compressed textures, or partial
+ uploads are involved, applications will have to use this class instead.
QRhiTextureUploadDescription also enables specifying batched uploads, which
are useful for example when generating an atlas or glyph cache texture:
@@ -1592,32 +3053,35 @@ QRhiTextureUploadEntry::QRhiTextureUploadEntry(int layer, int level,
For example, specifying the faces of a cubemap could look like the following:
- \badcode
+ \code
QImage faces[6];
- ...
- QVector<QRhiTextureUploadEntry> entries;
+ // ...
+ QVarLengthArray<QRhiTextureUploadEntry, 6> entries;
for (int i = 0; i < 6; ++i)
entries.append(QRhiTextureUploadEntry(i, 0, faces[i]));
- QRhiTextureUploadDescription desc(entries);
+ QRhiTextureUploadDescription desc;
+ desc.setEntries(entries.cbegin(), entries.cend());
resourceUpdates->uploadTexture(texture, desc);
\endcode
Another example that specifies mip images for a compressed texture:
- \badcode
- QRhiTextureUploadDescription desc;
+ \code
+ QList<QRhiTextureUploadEntry> entries;
const int mipCount = rhi->mipLevelsForSize(compressedTexture->pixelSize());
for (int level = 0; level < mipCount; ++level) {
const QByteArray compressedDataForLevel = ..
- desc.append(QRhiTextureUploadEntry(0, level, compressedDataForLevel));
+ entries.append(QRhiTextureUploadEntry(0, level, compressedDataForLevel));
}
+ QRhiTextureUploadDescription desc;
+ desc.setEntries(entries.cbegin(), entries.cend());
resourceUpdates->uploadTexture(compressedTexture, desc);
\endcode
With partial uploads targeting the same subresource, it is recommended to
batch them into a single upload request, whenever possible:
- \badcode
+ \code
QRhiTextureSubresourceUploadDescription subresDesc(image);
subresDesc.setSourceSize(QSize(10, 10));
subResDesc.setDestinationTopLeft(QPoint(50, 40));
@@ -1631,6 +3095,11 @@ QRhiTextureUploadEntry::QRhiTextureUploadEntry(int layer, int level,
QRhiTextureUploadDescription desc({ entry, entry2});
resourceUpdates->uploadTexture(texture, desc);
\endcode
+
+ \note This is a RHI API with limited compatibility guarantees, see \l QRhi
+ for details.
+
+ \sa QRhiResourceUpdateBatch
*/
/*!
@@ -1652,7 +3121,7 @@ QRhiTextureUploadDescription::QRhiTextureUploadDescription(const QRhiTextureUplo
Constructs a texture upload description with the specified \a list of entries.
\note \a list can also contain multiple QRhiTextureUploadEntry elements
- with the the same layer and level. This makes sense when those uploads are
+ with the same layer and level. This makes sense when those uploads are
partial, meaning their subresource description has a source size or image
smaller than the subresource dimensions, and can be more efficient than
issuing separate uploadTexture()'s.
@@ -1663,9 +3132,39 @@ QRhiTextureUploadDescription::QRhiTextureUploadDescription(std::initializer_list
}
/*!
+ \fn void QRhiTextureUploadDescription::setEntries(std::initializer_list<QRhiTextureUploadEntry> list)
+ Sets the \a list of entries.
+ */
+
+/*!
+ \fn template<typename InputIterator> void QRhiTextureUploadDescription::setEntries(InputIterator first, InputIterator last)
+ Sets the list of entries using the iterators \a first and \a last.
+ */
+
+/*!
+ \fn const QRhiTextureUploadEntry *QRhiTextureUploadDescription::cbeginEntries() const
+ \return a const iterator pointing to the first item in the entry list.
+ */
+
+/*!
+ \fn const QRhiTextureUploadEntry *QRhiTextureUploadDescription::cendEntries() const
+ \return a const iterator pointing just after the last item in the entry list.
+ */
+
+/*!
+ \fn const QRhiTextureUploadEntry *QRhiTextureUploadDescription::entryAt(qsizetype index) const
+ \return the entry at \a index.
+ */
+
+/*!
+ \fn qsizetype QRhiTextureUploadDescription::entryCount() const
+ \return the number of entries.
+ */
+
+/*!
\class QRhiTextureCopyDescription
- \internal
\inmodule QtGui
+ \since 6.6
\brief Describes a texture-to-texture copy operation.
An empty pixelSize() indicates that the entire subresource is to be copied.
@@ -1678,6 +3177,16 @@ QRhiTextureUploadDescription::QRhiTextureUploadDescription(std::initializer_list
\note The source and destination rectangles defined by pixelSize(),
sourceTopLeft(), and destinationTopLeft() must fit the source and
destination textures, respectively. The behavior is undefined otherwise.
+
+ With cubemaps, 3D textures, and texture arrays one face or slice can be
+ copied at a time. The face or slice is specified by the source and
+ destination layer indices. With mipmapped textures one mip level can be
+ copied at a time. The source and destination layer and mip level indices can
+ differ, but the size and position must be carefully controlled to avoid out
+ of bounds copies, in which case the behavior is undefined.
+
+ \note This is a RHI API with limited compatibility guarantees, see \l QRhi
+ for details.
*/
/*!
@@ -1687,9 +3196,83 @@ QRhiTextureUploadDescription::QRhiTextureUploadDescription(std::initializer_list
*/
/*!
+ \fn QSize QRhiTextureCopyDescription::pixelSize() const
+ \return the size of the region to copy.
+
+ \note An empty pixelSize() indicates that the entire subresource is to be
+ copied. A default constructed copy description therefore leads to copying
+ the entire subresource at level 0 of layer 0.
+ */
+
+/*!
+ \fn void QRhiTextureCopyDescription::setPixelSize(const QSize &sz)
+ Sets the size of the region to copy to \a sz.
+ */
+
+/*!
+ \fn int QRhiTextureCopyDescription::sourceLayer() const
+ \return the source array layer (cubemap face or array layer index). Defaults to 0.
+ */
+
+/*!
+ \fn void QRhiTextureCopyDescription::setSourceLayer(int layer)
+ Sets the source array \a layer.
+ */
+
+/*!
+ \fn int QRhiTextureCopyDescription::sourceLevel() const
+ \return the source mip level. Defaults to 0.
+ */
+
+/*!
+ \fn void QRhiTextureCopyDescription::setSourceLevel(int level)
+ Sets the source mip \a level.
+ */
+
+/*!
+ \fn QPoint QRhiTextureCopyDescription::sourceTopLeft() const
+ \return the source top-left position (in pixels). Defaults to (0, 0).
+ */
+
+/*!
+ \fn void QRhiTextureCopyDescription::setSourceTopLeft(const QPoint &p)
+ Sets the source top-left position to \a p.
+ */
+
+/*!
+ \fn int QRhiTextureCopyDescription::destinationLayer() const
+ \return the destination array layer (cubemap face or array layer index). Default to 0.
+ */
+
+/*!
+ \fn void QRhiTextureCopyDescription::setDestinationLayer(int layer)
+ Sets the destination array \a layer.
+ */
+
+/*!
+ \fn int QRhiTextureCopyDescription::destinationLevel() const
+ \return the destionation mip level. Defaults to 0.
+ */
+
+/*!
+ \fn void QRhiTextureCopyDescription::setDestinationLevel(int level)
+ Sets the destination mip \a level.
+ */
+
+/*!
+ \fn QPoint QRhiTextureCopyDescription::destinationTopLeft() const
+ \return the destionation top-left position in pixels. Defaults to (0, 0).
+ */
+
+/*!
+ \fn void QRhiTextureCopyDescription::setDestinationTopLeft(const QPoint &p)
+ Sets the destination top-left position \a p.
+ */
+
+/*!
\class QRhiReadbackDescription
- \internal
\inmodule QtGui
+ \since 6.6
\brief Describes a readback (reading back texture contents from possibly GPU-only memory) operation.
The source of the readback operation is either a QRhiTexture or the
@@ -1707,10 +3290,13 @@ QRhiTextureUploadDescription::QRhiTextureUploadDescription(std::initializer_list
\note Multisample textures cannot be read back. Readbacks are supported for
multisample swapchain buffers however.
+
+ \note This is a RHI API with limited compatibility guarantees, see \l QRhi
+ for details.
*/
/*!
- \fn QRhiReadbackDescription::QRhiReadbackDescription()
+ \fn QRhiReadbackDescription::QRhiReadbackDescription() = default
Constructs an empty texture readback description.
@@ -1734,32 +3320,140 @@ QRhiReadbackDescription::QRhiReadbackDescription(QRhiTexture *texture)
}
/*!
+ \fn QRhiTexture *QRhiReadbackDescription::texture() const
+
+ \return the QRhiTexture that is read back. Can be left set to \nullptr
+ which indicates that the backbuffer of the current swapchain is to be used
+ instead.
+ */
+
+/*!
+ \fn void QRhiReadbackDescription::setTexture(QRhiTexture *tex)
+
+ Sets the texture \a tex as the source of the readback operation.
+
+ Setting \nullptr is valid too, in which case the current swapchain's
+ current backbuffer is used. (but then the readback cannot be issued in a
+ non-swapchain-based frame)
+
+ \note Multisample textures cannot be read back. Readbacks are supported for
+ multisample swapchain buffers however.
+
+ \note Textures used in readbacks must be created with
+ QRhiTexture::UsedAsTransferSource.
+
+ \note Swapchains used in readbacks must be created with
+ QRhiSwapChain::UsedAsTransferSource.
+ */
+
+/*!
+ \fn int QRhiReadbackDescription::layer() const
+
+ \return the currently set array layer (cubemap face, array index). Defaults to 0.
+
+ Applicable only when the source of the readback is a QRhiTexture.
+ */
+
+/*!
+ \fn void QRhiReadbackDescription::setLayer(int layer)
+ Sets the array \a layer to read back.
+ */
+
+/*!
+ \fn int QRhiReadbackDescription::level() const
+
+ \return the currently set mip level. Defaults to 0.
+
+ Applicable only when the source of the readback is a QRhiTexture.
+ */
+
+/*!
+ \fn void QRhiReadbackDescription::setLevel(int level)
+ Sets the mip \a level to read back.
+ */
+
+/*!
\class QRhiReadbackResult
- \internal
\inmodule QtGui
- \brief Describes the results of a potentially asynchronous readback operation.
+ \since 6.6
+ \brief Describes the results of a potentially asynchronous buffer or texture readback operation.
When \l completed is set, the function is invoked when the \l data is
available. \l format and \l pixelSize are set upon completion together with
\l data.
+
+ \note This is a RHI API with limited compatibility guarantees, see \l QRhi
+ for details.
+ */
+
+/*!
+ \variable QRhiReadbackResult::completed
+
+ Callback that is invoked upon completion, on the thread the QRhi operates
+ on. Can be left set to \nullptr, in which case no callback is invoked.
+ */
+
+/*!
+ \variable QRhiReadbackResult::format
+
+ Valid only for textures, the texture format.
*/
/*!
+ \variable QRhiReadbackResult::pixelSize
+
+ Valid only for textures, the size in pixels.
+ */
+
+/*!
+ \variable QRhiReadbackResult::data
+
+ The buffer or image data.
+
+ \sa QRhiResourceUpdateBatch::readBackTexture(), QRhiResourceUpdateBatch::readBackBuffer()
+ */
+
+
+/*!
\class QRhiNativeHandles
- \internal
\inmodule QtGui
+ \since 6.6
\brief Base class for classes exposing backend-specific collections of native resource objects.
+
+ \note This is a RHI API with limited compatibility guarantees, see \l QRhi
+ for details.
*/
/*!
\class QRhiResource
- \internal
\inmodule QtGui
+ \since 6.6
\brief Base class for classes encapsulating native resource objects.
+
+ \note This is a RHI API with limited compatibility guarantees, see \l QRhi
+ for details.
+ */
+
+/*!
+ \enum QRhiResource::Type
+ Specifies type of the resource.
+
+ \value Buffer
+ \value Texture
+ \value Sampler
+ \value RenderBuffer
+ \value RenderPassDescriptor
+ \value SwapChainRenderTarget
+ \value TextureRenderTarget
+ \value ShaderResourceBindings
+ \value GraphicsPipeline
+ \value SwapChain
+ \value ComputePipeline
+ \value CommandBuffer
*/
/*!
- \fn QRhiResource::Type QRhiResource::resourceType() const
+ \fn virtual QRhiResource::Type QRhiResource::resourceType() const = 0
\return the type of the resource.
*/
@@ -1782,32 +3476,32 @@ QRhiResource::QRhiResource(QRhiImplementation *rhi)
\note Resources referenced by commands for the current frame should not be
released until the frame is submitted by QRhi::endFrame().
- \sa release()
+ \sa destroy()
*/
QRhiResource::~QRhiResource()
{
- // release() cannot be called here, it being virtual; it is up to the
+ // destroy() cannot be called here, due to virtuals; it is up to the
// subclasses to do that.
}
/*!
- \fn void QRhiResource::release()
+ \fn virtual void QRhiResource::destroy() = 0
Releases (or requests deferred releasing of) the underlying native graphics
resources. Safe to call multiple times, subsequent invocations will be a
no-op then.
- Once release() is called, the QRhiResource instance can be reused, by
- calling \c build() again. That will then result in creating new native
+ Once destroy() is called, the QRhiResource instance can be reused, by
+ calling \c create() again. That will then result in creating new native
graphics resources underneath.
\note Resources referenced by commands for the current frame should not be
released until the frame is submitted by QRhi::endFrame().
The QRhiResource destructor also performs the same task, so calling this
- function is not necessary before destroying a QRhiResource.
+ function is not necessary before deleting a QRhiResource.
- \sa releaseAndDestroyLater()
+ \sa deleteLater()
*/
/*!
@@ -1818,11 +3512,42 @@ QRhiResource::~QRhiResource()
requirement of not altering QRhiResource objects that are referenced by the
frame being recorded.
- \sa release()
+ If the QRhi that created this object is already destroyed, the object is
+ deleted immediately.
+
+ Using deleteLater() can be a useful convenience in many cases, and it
+ complements the low-level guarantee (that the underlying native graphics
+ objects are never destroyed until it is safe to do so and it is known for
+ sure that they are not used by the GPU in an still in-flight frame), by
+ offering a way to make sure the C++ object instances (of QRhiBuffer,
+ QRhiTexture, etc.) themselves also stay valid until the end of the current
+ frame.
+
+ The following example shows a convenient way of creating a throwaway buffer
+ that is only used in one frame and gets automatically released in
+ endFrame(). (when it comes to the underlying native buffer(s), the usual
+ guarantee applies: the QRhi backend defers the releasing of those until it
+ is guaranteed that the frame in which the buffer is accessed by the GPU has
+ completed)
+
+ \code
+ rhi->beginFrame(swapchain);
+ QRhiBuffer *buf = rhi->newBuffer(QRhiBuffer::Immutable, QRhiBuffer::VertexBuffer, 256);
+ buf->deleteLater(); // !
+ u = rhi->nextResourceUpdateBatch();
+ u->uploadStaticBuffer(buf, data);
+ // ... draw with buf
+ rhi->endFrame();
+ \endcode
+
+ \sa destroy()
*/
-void QRhiResource::releaseAndDestroyLater()
+void QRhiResource::deleteLater()
{
- m_rhi->addReleaseAndDestroyLater(this);
+ if (m_rhi)
+ m_rhi->addDeleteLater(this);
+ else
+ delete this;
}
/*!
@@ -1836,11 +3561,10 @@ QByteArray QRhiResource::name() const
/*!
Sets a \a name for the object.
- This has two uses: to get descriptive names for the native graphics
+ This allows getting descriptive names for the native graphics
resources visible in graphics debugging tools, such as
\l{https://renderdoc.org/}{RenderDoc} and
- \l{https://developer.apple.com/xcode/}{XCode}, and in the output stream of
- QRhiProfiler.
+ \l{https://developer.apple.com/xcode/}{XCode}.
When it comes to naming native objects by relaying the name via the
appropriate graphics API, note that the name is ignored when
@@ -1857,7 +3581,6 @@ QByteArray QRhiResource::name() const
void QRhiResource::setName(const QByteArray &name)
{
m_objectName = name;
- m_objectName.replace(',', '_'); // cannot contain comma for QRhiProfiler
}
/*!
@@ -1872,10 +3595,141 @@ quint64 QRhiResource::globalResourceId() const
}
/*!
+ \return the QRhi that created this resource.
+
+ If the QRhi that created this object is already destroyed, the result is
+ \nullptr.
+ */
+QRhi *QRhiResource::rhi() const
+{
+ return m_rhi ? m_rhi->q : nullptr;
+}
+
+/*!
\class QRhiBuffer
- \internal
\inmodule QtGui
+ \since 6.6
\brief Vertex, index, or uniform (constant) buffer resource.
+
+ \note This is a RHI API with limited compatibility guarantees, see \l QRhi
+ for details.
+
+ A QRhiBuffer encapsulates zero, one, or more native buffer objects (such as
+ a \c VkBuffer or \c MTLBuffer). With some graphics APIs and backends
+ certain types of buffers may not use a native buffer object at all (e.g.
+ OpenGL if uniform buffer objects are not used), but this is transparent to
+ the user of the QRhiBuffer API. Similarly, the fact that some types of
+ buffers may use two or three native buffers underneath, in order to allow
+ efficient per-frame content update without stalling the GPU pipeline, is
+ mostly invisible to the applications and libraries.
+
+ A QRhiBuffer instance is always created by calling
+ \l{QRhi::newBuffer()}{the QRhi's newBuffer() function}. This creates no
+ native graphics resources. To do that, call create() after setting the
+ appropriate options, such as the type, usage flags, size, although in most cases these
+ are already set based on the arguments passed to
+ \l{QRhi::newBuffer()}{newBuffer()}.
+
+ \section2 Example usage
+
+ To create a uniform buffer for a shader where the GLSL uniform block
+ contains a single \c mat4 member, and update the contents:
+
+ \code
+ QRhiBuffer *ubuf = rhi->newBuffer(QRhiBuffer::Dynamic, QRhiBuffer::UniformBuffer, 64);
+ if (!ubuf->create()) { error(); }
+ QRhiResourceUpdateBatch *batch = rhi->nextResourceUpdateBatch();
+ QMatrix4x4 mvp;
+ // ... set up the modelview-projection matrix
+ batch->updateDynamicBuffer(ubuf, 0, 64, mvp.constData());
+ // ...
+ commandBuffer->resourceUpdate(batch); // or, alternatively, pass 'batch' to a beginPass() call
+ \endcode
+
+ An example of creating a buffer with vertex data:
+
+ \code
+ const float vertices[] = { -1.0f, -1.0f, 1.0f, -1.0f, 0.0f, 1.0f };
+ QRhiBuffer *vbuf = rhi->newBuffer(QRhiBuffer::Immutable, QRhiBuffer::VertexBuffer, sizeof(vertices));
+ if (!vbuf->create()) { error(); }
+ QRhiResourceUpdateBatch *batch = rhi->nextResourceUpdateBatch();
+ batch->uploadStaticBuffer(vbuf, vertices);
+ // ...
+ commandBuffer->resourceUpdate(batch); // or, alternatively, pass 'batch' to a beginPass() call
+ \endcode
+
+ An index buffer:
+
+ \code
+ static const quint16 indices[] = { 0, 1, 2 };
+ QRhiBuffer *ibuf = rhi->newBuffer(QRhiBuffer::Immutable, QRhiBuffer::IndexBuffer, sizeof(indices));
+ if (!ibuf->create()) { error(); }
+ QRhiResourceUpdateBatch *batch = rhi->nextResourceUpdateBatch();
+ batch->uploadStaticBuffer(ibuf, indices);
+ // ...
+ commandBuffer->resourceUpdate(batch); // or, alternatively, pass 'batch' to a beginPass() call
+ \endcode
+
+ \section2 Common patterns
+
+ A call to create() destroys any existing native resources if create() was
+ successfully called before. If those native resources are still in use by
+ an in-flight frame (i.e., there's a chance they are still read by the GPU),
+ the destroying of those resources is deferred automatically. Thus a very
+ common and convenient pattern to safely increase the size of an already
+ initialized buffer is the following. In practice this drops and creates a
+ whole new set of native resources underneath, so it is not necessarily a
+ cheap operation, but is more convenient and still faster than the
+ alternatives, because by not destroying the \c buf object itself, all
+ references to it stay valid in other data structures (e.g., in any
+ QRhiShaderResourceBinding the QRhiBuffer is referenced from).
+
+ \code
+ if (buf->size() < newSize) {
+ buf->setSize(newSize);
+ if (!buf->create()) { error(); }
+ }
+ // continue using buf, fill it with new data
+ \endcode
+
+ When working with uniform buffers, it will sometimes be necessary to
+ combine data for multiple draw calls into a single buffer for efficiency
+ reasons. Be aware of the aligment requirements: with some graphics APIs
+ offsets for a uniform buffer must be aligned to 256 bytes. This applies
+ both to QRhiShaderResourceBinding and to the dynamic offsets passed to
+ \l{QRhiCommandBuffer::setShaderResources()}{setShaderResources()}. Use the
+ \l{QRhi::ubufAlignment()}{ubufAlignment()} and
+ \l{QRhi::ubufAligned()}{ubufAligned()} functions to create portable code.
+ As an example, the following is an outline for issuing multiple (\c N) draw
+ calls with the same pipeline and geometry, but with a different data in the
+ uniform buffers exposed at binding point 0. This assumes the buffer is
+ exposed via
+ \l{QRhiShaderResourceBinding::uniformBufferWithDynamicOffset()}{uniformBufferWithDynamicOffset()}
+ which allows passing a QRhiCommandBuffer::DynamicOffset list to
+ \l{QRhiCommandBuffer::setShaderResources()}{setShaderResources()}.
+
+ \code
+ const int N = 2;
+ const int UB_SIZE = 64 + 4; // assuming a uniform block with { mat4 matrix; float opacity; }
+ const int ONE_UBUF_SIZE = rhi->ubufAligned(UB_SIZE);
+ const int TOTAL_UBUF_SIZE = N * ONE_UBUF_SIZE;
+ QRhiBuffer *ubuf = rhi->newBuffer(QRhiBuffer::Dynamic, QRhiBuffer::UniformBuffer, TOTAL_UBUF_SIZE);
+ if (!ubuf->create()) { error(); }
+ QRhiResourceUpdateBatch *batch = rhi->nextResourceUpdateBatch();
+ for (int i = 0; i < N; ++i) {
+ batch->updateDynamicBuffer(ubuf, i * ONE_UBUF_SIZE, 64, matrix.constData());
+ batch->updateDynamicBuffer(ubuf, i * ONE_UBUF_SIZE + 64, 4, &opacity);
+ }
+ // ...
+ // beginPass(), set pipeline, etc., and then:
+ for (int i = 0; i < N; ++i) {
+ QRhiCommandBuffer::DynamicOffset dynOfs[] = { { 0, i * ONE_UBUF_SIZE } };
+ cb->setShaderResources(srb, 1, dynOfs);
+ cb->draw(36);
+ }
+ \endcode
+
+ \sa QRhiResourceUpdateBatch, QRhi, QRhiCommandBuffer
*/
/*!
@@ -1911,44 +3765,68 @@ quint64 QRhiResource::globalResourceId() const
Flag values to specify how the buffer is going to be used.
\value VertexBuffer Vertex buffer. This allows the QRhiBuffer to be used in
- \l{setVertexInput()}{QRhiCommandBuffer::setVertexInput()}.
+ \l{QRhiCommandBuffer::setVertexInput()}{setVertexInput()}.
\value IndexBuffer Index buffer. This allows the QRhiBuffer to be used in
- \l{setVertexInput()}{QRhiCommandBuffer::setVertexInput()}.
+ \l{QRhiCommandBuffer::setVertexInput()}{setVertexInput()}.
\value UniformBuffer Uniform buffer (also called constant buffer). This
allows the QRhiBuffer to be used in combination with
- \l{UniformBuffer}{QRhiShaderResourceBinding::UniformBuffer}. When
+ \l{QRhiShaderResourceBinding::UniformBuffer}{UniformBuffer}. When
\l{QRhi::NonDynamicUniformBuffers}{NonDynamicUniformBuffers} is reported as
not supported, this usage can only be combined with the type Dynamic.
\value StorageBuffer Storage buffer. This allows the QRhiBuffer to be used
- in combination with \l{BufferLoad}{QRhiShaderResourceBinding::BufferLoad},
- \l{BufferStore}{QRhiShaderResourceBinding::BufferStore}, or
- \l{BufferLoadStore}{QRhiShaderResourceBinding::BufferLoadStore}. This usage
+ in combination with \l{QRhiShaderResourceBinding::BufferLoad}{BufferLoad},
+ \l{QRhiShaderResourceBinding::BufferStore}{BufferStore}, or
+ \l{QRhiShaderResourceBinding::BufferLoadStore}{BufferLoadStore}. This usage
can only be combined with the types Immutable or Static, and is only
available when the \l{QRhi::Compute}{Compute feature} is reported as
supported.
*/
/*!
- \fn void QRhiBuffer::setSize(int sz)
+ \class QRhiBuffer::NativeBuffer
+ \inmodule QtGui
+ \brief Contains information about the underlying native resources of a buffer.
+ */
- Sets the size of the buffer in bytes. The size is normally specified in
- QRhi::newBuffer() so this function is only used when the size has to be
- changed. As with other setters, the size only takes effect when calling
- build(), and for already built buffers this involves releasing the previous
- native resource and creating new ones under the hood.
+/*!
+ \variable QRhiBuffer::NativeBuffer::objects
+ \brief an array with pointers to the native object handles.
- Backends may choose to allocate buffers bigger than \a sz in order to
- fulfill alignment requirements. This is hidden from the applications and
- size() will always report the size requested in \a sz.
+ With OpenGL, the native handle is a GLuint value, so the elements in the \c
+ objects array are pointers to a GLuint. With Vulkan, the native handle is a
+ VkBuffer, so the elements of the array are pointers to a VkBuffer. With
+ Direct3D 11 and Metal the elements are pointers to a ID3D11Buffer or
+ MTLBuffer pointer, respectively. With Direct3D 12, the elements are
+ pointers to a ID3D12Resource.
+
+ \note Pay attention to the fact that the elements are always pointers to
+ the native buffer handle type, even if the native type itself is a pointer.
+ (so the elements are \c{VkBuffer *} on Vulkan, even though VkBuffer itself
+ is a pointer on 64-bit architectures).
+ */
+
+/*!
+ \variable QRhiBuffer::NativeBuffer::slotCount
+ \brief Specifies the number of valid elements in the objects array.
+
+ The value can be 0, 1, 2, or 3 in practice. 0 indicates that the QRhiBuffer
+ is not backed by any native buffer objects. This can happen with
+ QRhiBuffers with the usage UniformBuffer when the underlying API does not
+ support (or the backend chooses not to use) native uniform buffers. 1 is
+ commonly used for Immutable and Static types (but some backends may
+ differ). 2 or 3 is typical when the type is Dynamic (but some backends may
+ differ).
+
+ \sa QRhi::currentFrameSlot(), QRhi::FramesInFlight
*/
/*!
\internal
*/
-QRhiBuffer::QRhiBuffer(QRhiImplementation *rhi, Type type_, UsageFlags usage_, int size_)
+QRhiBuffer::QRhiBuffer(QRhiImplementation *rhi, Type type_, UsageFlags usage_, quint32 size_)
: QRhiResource(rhi),
m_type(type_), m_usage(usage_), m_size(size_)
{
@@ -1963,30 +3841,160 @@ QRhiResource::Type QRhiBuffer::resourceType() const
}
/*!
- \fn bool QRhiBuffer::build()
+ \fn virtual bool QRhiBuffer::create() = 0
Creates the corresponding native graphics resources. If there are already
- resources present due to an earlier build() with no corresponding
- release(), then release() is called implicitly first.
+ resources present due to an earlier create() with no corresponding
+ destroy(), then destroy() is called implicitly first.
\return \c true when successful, \c false when a graphics operation failed.
- Regardless of the return value, calling release() is always safe.
+ Regardless of the return value, calling destroy() is always safe.
*/
/*!
+ \fn QRhiBuffer::Type QRhiBuffer::type() const
+ \return the buffer type.
+ */
+
+/*!
+ \fn void QRhiBuffer::setType(Type t)
+ Sets the buffer's type to \a t.
+ */
+
+/*!
+ \fn QRhiBuffer::UsageFlags QRhiBuffer::usage() const
+ \return the buffer's usage flags.
+ */
+
+/*!
+ \fn void QRhiBuffer::setUsage(UsageFlags u)
+ Sets the buffer's usage flags to \a u.
+ */
+
+/*!
+ \fn quint32 QRhiBuffer::size() const
+
+ \return the buffer's size in bytes.
+
+ This is always the value that was passed to setSize() or QRhi::newBuffer().
+ Internally, the native buffers may be bigger if that is required by the
+ underlying graphics API.
+ */
+
+/*!
+ \fn void QRhiBuffer::setSize(quint32 sz)
+
+ Sets the size of the buffer in bytes. The size is normally specified in
+ QRhi::newBuffer() so this function is only used when the size has to be
+ changed. As with other setters, the size only takes effect when calling
+ create(), and for already created buffers this involves releasing the previous
+ native resource and creating new ones under the hood.
+
+ Backends may choose to allocate buffers bigger than \a sz in order to
+ fulfill alignment requirements. This is hidden from the applications and
+ size() will always report the size requested in \a sz.
+ */
+
+/*!
+ \return the underlying native resources for this buffer. The returned value
+ will be empty if exposing the underlying native resources is not supported by
+ the backend.
+
+ A QRhiBuffer may be backed by multiple native buffer objects, depending on
+ the type() and the QRhi backend in use. When this is the case, all of them
+ are returned in the objects array in the returned struct, with slotCount
+ specifying the number of native buffer objects. While
+ \l{QRhi::beginFrame()}{recording a frame}, QRhi::currentFrameSlot() can be
+ used to determine which of the native buffers QRhi is using for operations
+ that read or write from this QRhiBuffer within the frame being recorded.
+
+ In some cases a QRhiBuffer will not be backed by a native buffer object at
+ all. In this case slotCount will be set to 0 and no valid native objects
+ are returned. This is not an error, and is perfectly valid when a given
+ backend does not use native buffers for QRhiBuffers with certain types or
+ usages.
+
+ \note Be aware that QRhi backends may employ various buffer update
+ strategies. Unlike textures, where uploading image data always means
+ recording a buffer-to-image (or similar) copy command on the command
+ buffer, buffers, in particular Dynamic and UniformBuffer ones, can operate
+ in many different ways. For example, a QRhiBuffer with usage type
+ UniformBuffer may not even be backed by a native buffer object at all if
+ uniform buffers are not used or supported by a given backend and graphics
+ API. There are also differences to how data is written to the buffer and
+ the type of backing memory used. For buffers backed by host visible memory,
+ calling this function guarantees that pending host writes are executed for
+ all the returned native buffers.
+
+ \sa QRhi::currentFrameSlot(), QRhi::FramesInFlight
+ */
+QRhiBuffer::NativeBuffer QRhiBuffer::nativeBuffer()
+{
+ return {};
+}
+
+/*!
+ \return a pointer to a memory block with the host visible buffer data.
+
+ This is a shortcut for medium-to-large dynamic uniform buffers that have
+ their \b entire contents (or at least all regions that are read by the
+ shaders in the current frame) changed \b{in every frame} and the
+ QRhiResourceUpdateBatch-based update mechanism is seen too heavy due to the
+ amount of data copying involved.
+
+ The call to this function must be eventually followed by a call to
+ endFullDynamicUniformBufferUpdateForCurrentFrame(), before recording any
+ render or compute pass that relies on this buffer.
+
+ \warning Updating data via this method is not compatible with
+ QRhiResourceUpdateBatch-based updates and readbacks. Unexpected behavior
+ may occur when attempting to combine the two update models for the same
+ buffer. Similarly, the data updated this direct way may not be visible to
+ \l{QRhiResourceUpdateBatch::readBackBuffer()}{readBackBuffer operations},
+ depending on the backend.
+
+ \warning When updating buffer data via this method, the update must be done
+ in every frame, otherwise backends that perform double or triple buffering
+ of resources may end up in unexpected behavior.
+
+ \warning Partial updates are not possible with this approach since some
+ backends may choose a strategy where the previous contents of the buffer is
+ lost upon calling this function. Data must be written to all regions that
+ are read by shaders in the frame currently being prepared.
+
+ \warning This function can only be called when recording a frame, so
+ between QRhi::beginFrame() and QRhi::endFrame().
+
+ \warning This function can only be called on Dynamic buffers.
+ */
+char *QRhiBuffer::beginFullDynamicBufferUpdateForCurrentFrame()
+{
+ return nullptr;
+}
+
+/*!
+ To be called when the entire contents of the buffer data has been updated
+ in the memory block returned from
+ beginFullDynamicBufferUpdateForCurrentFrame().
+ */
+void QRhiBuffer::endFullDynamicBufferUpdateForCurrentFrame()
+{
+}
+
+/*!
\class QRhiRenderBuffer
- \internal
\inmodule QtGui
+ \since 6.6
\brief Renderbuffer resource.
Renderbuffers cannot be sampled or read but have some benefits over
textures in some cases:
- A DepthStencil renderbuffer may be lazily allocated and be backed by
+ A \l DepthStencil renderbuffer may be lazily allocated and be backed by
transient memory with some APIs. On some platforms this may mean the
depth/stencil buffer uses no physical backing at all.
- Color renderbuffers are useful since QRhi::MultisampleRenderBuffer may be
+ \l Color renderbuffers are useful since QRhi::MultisampleRenderBuffer may be
supported even when QRhi::MultisampleTexture is not.
How the renderbuffer is implemented by a backend is not exposed to the
@@ -1998,8 +4006,11 @@ QRhiResource::Type QRhiBuffer::resourceType() const
UsedWithSwapChainOnly flag set. This serves a double purpose: such buffers,
depending on the backend and the underlying APIs, be more efficient, and
QRhi provides automatic sizing behavior to match the color buffers, which
- means calling setPixelSize() and build() are not necessary for such
+ means calling setPixelSize() and create() are not necessary for such
renderbuffers.
+
+ \note This is a RHI API with limited compatibility guarantees, see \l QRhi
+ for details.
*/
/*!
@@ -2011,13 +4022,29 @@ QRhiResource::Type QRhiBuffer::resourceType() const
*/
/*!
+ \struct QRhiRenderBuffer::NativeRenderBuffer
+ \inmodule QtGui
+ \brief Wraps a native renderbuffer object.
+ */
+
+/*!
+ \variable QRhiRenderBuffer::NativeRenderBuffer::object
+ \brief 64-bit integer containing the native object handle.
+
+ Used with QRhiRenderBuffer::createFrom().
+
+ With OpenGL the native handle is a GLuint value. \c object is expected to
+ be a valid OpenGL renderbuffer object ID.
+ */
+
+/*!
\enum QRhiRenderBuffer::Flag
Flag values for flags() and setFlags()
\value UsedWithSwapChainOnly For DepthStencil renderbuffers this indicates
that the renderbuffer is only used in combination with a QRhiSwapChain, and
never in any other way. This provides automatic sizing and resource
- rebuilding, so calling setPixelSize() or build() is not needed whenever
+ rebuilding, so calling setPixelSize() or create() is not needed whenever
this flag is set. This flag value may also trigger backend-specific
behavior, for example with OpenGL, where a separate windowing system
interface API is in use (EGL, GLX, etc.), the flag is especially important
@@ -2030,9 +4057,11 @@ QRhiResource::Type QRhiBuffer::resourceType() const
\internal
*/
QRhiRenderBuffer::QRhiRenderBuffer(QRhiImplementation *rhi, Type type_, const QSize &pixelSize_,
- int sampleCount_, Flags flags_)
+ int sampleCount_, Flags flags_,
+ QRhiTexture::Format backingFormatHint_)
: QRhiResource(rhi),
- m_type(type_), m_pixelSize(pixelSize_), m_sampleCount(sampleCount_), m_flags(flags_)
+ m_type(type_), m_pixelSize(pixelSize_), m_sampleCount(sampleCount_), m_flags(flags_),
+ m_backingFormatHint(backingFormatHint_)
{
}
@@ -2045,34 +4074,177 @@ QRhiResource::Type QRhiRenderBuffer::resourceType() const
}
/*!
- \fn bool QRhiRenderBuffer::build()
+ \fn virtual bool QRhiRenderBuffer::create() = 0
Creates the corresponding native graphics resources. If there are already
- resources present due to an earlier build() with no corresponding
- release(), then release() is called implicitly first.
+ resources present due to an earlier create() with no corresponding
+ destroy(), then destroy() is called implicitly first.
\return \c true when successful, \c false when a graphics operation failed.
- Regardless of the return value, calling release() is always safe.
+ Regardless of the return value, calling destroy() is always safe.
*/
/*!
- \fn QRhiTexture::Format QRhiRenderBuffer::backingFormat() const
+ Similar to create() except that no new native renderbuffer objects are
+ created. Instead, the native renderbuffer object specified by \a src is
+ used.
+
+ This allows importing an existing renderbuffer object (which must belong to
+ the same device or sharing context, depending on the graphics API) from an
+ external graphics engine.
+
+ \note This is currently applicable to OpenGL only. This function exists
+ solely to allow importing a renderbuffer object that is bound to some
+ special, external object, such as an EGLImageKHR. Once the application
+ performed the glEGLImageTargetRenderbufferStorageOES call, the renderbuffer
+ object can be passed to this function to create a wrapping
+ QRhiRenderBuffer, which in turn can be passed in as a color attachment to
+ a QRhiTextureRenderTarget to enable rendering to the EGLImage.
+
+ \note pixelSize(), sampleCount(), and flags() must still be set correctly.
+ Passing incorrect sizes and other values to QRhi::newRenderBuffer() and
+ then following it with a createFrom() expecting that the native
+ renderbuffer object alone is sufficient to deduce such values is \b wrong
+ and will lead to problems.
+
+ \note QRhiRenderBuffer does not take ownership of the native object, and
+ destroy() will not release that object.
+
+ \note This function is only implemented when the QRhi::RenderBufferImport
+ feature is reported as \l{QRhi::isFeatureSupported()}{supported}. Otherwise,
+ the function does nothing and the return value is \c false.
+
+ \return \c true when successful, \c false when not supported.
+ */
+bool QRhiRenderBuffer::createFrom(NativeRenderBuffer src)
+{
+ Q_UNUSED(src);
+ return false;
+}
+
+/*!
+ \fn QRhiRenderBuffer::Type QRhiRenderBuffer::type() const
+ \return the renderbuffer type.
+ */
+
+/*!
+ \fn void QRhiRenderBuffer::setType(Type t)
+ Sets the type to \a t.
+ */
+
+/*!
+ \fn QSize QRhiRenderBuffer::pixelSize() const
+ \return the pixel size.
+ */
+
+/*!
+ \fn void QRhiRenderBuffer::setPixelSize(const QSize &sz)
+ Sets the size (in pixels) to \a sz.
+ */
+
+/*!
+ \fn int QRhiRenderBuffer::sampleCount() const
+ \return the sample count. 1 means no multisample antialiasing.
+ */
+
+/*!
+ \fn void QRhiRenderBuffer::setSampleCount(int s)
+ Sets the sample count to \a s.
+ */
+
+/*!
+ \fn QRhiRenderBuffer::Flags QRhiRenderBuffer::flags() const
+ \return the flags.
+ */
+
+/*!
+ \fn void QRhiRenderBuffer::setFlags(Flags f)
+ Sets the flags to \a f.
+ */
+
+/*!
+ \fn virtual QRhiTexture::Format QRhiRenderBuffer::backingFormat() const = 0
\internal
*/
/*!
\class QRhiTexture
- \internal
\inmodule QtGui
+ \since 6.6
\brief Texture resource.
+
+ A QRhiTexture encapsulates a native texture object, such as a \c VkImage or
+ \c MTLTexture.
+
+ A QRhiTexture instance is always created by calling
+ \l{QRhi::newTexture()}{the QRhi's newTexture() function}. This creates no
+ native graphics resources. To do that, call create() after setting the
+ appropriate options, such as the format and size, although in most cases
+ these are already set based on the arguments passed to
+ \l{QRhi::newTexture()}{newTexture()}.
+
+ Setting the \l{QRhiTexture::Flags}{flags} correctly is essential, otherwise
+ various errors can occur depending on the underlying QRhi backend and
+ graphics API. For example, when a texture will be rendered into from a
+ render pass via QRhiTextureRenderTarget, the texture must be created with
+ the \l RenderTarget flag set. Similarly, when the texture is going to be
+ \l{QRhiResourceUpdateBatch::readBackTexture()}{read back}, the \l
+ UsedAsTransferSource flag must be set upfront. Mipmapped textures must have
+ the MipMapped flag set. And so on. It is not possible to change the flags
+ once create() has succeeded. To release the existing and create a new
+ native texture object with the changed settings, call the setters and call
+ create() again. This then might be a potentially expensive operation.
+
+ \section2 Example usage
+
+ To create a 2D texture with a size of 512x512 pixels and set its contents to all green:
+
+ \code
+ QRhiTexture *texture = rhi->newTexture(QRhiTexture::RGBA8, QSize(512, 512));
+ if (!texture->create()) { error(); }
+ QRhiResourceUpdateBatch *batch = rhi->nextResourceUpdateBatch();
+ QImage image(512, 512, QImage::Format_RGBA8888);
+ image.fill(Qt::green);
+ batch->uploadTexture(texture, image);
+ // ...
+ commandBuffer->resourceUpdate(batch); // or, alternatively, pass 'batch' to a beginPass() call
+ \endcode
+
+ \section2 Common patterns
+
+ A call to create() destroys any existing native resources if create() was
+ successfully called before. If those native resources are still in use by
+ an in-flight frame (i.e., there's a chance they are still read by the GPU),
+ the destroying of those resources is deferred automatically. Thus a very
+ common and convenient pattern to safely change the size of an already
+ existing texture is the following. In practice this drops and creates a
+ whole new native texture resource underneath, so it is not necessarily a
+ cheap operation, but is more convenient and still faster than the
+ alternatives, because by not destroying the \c texture object itself, all
+ references to it stay valid in other data structures (e.g., in any
+ QShaderResourceBinding the QRhiTexture is referenced from).
+
+ \code
+ // determine newSize, e.g. based on the swapchain's output size or other factors
+ if (texture->pixelSize() != newSize) {
+ texture->setPixelSize(newSize);
+ if (!texture->create()) { error(); }
+ }
+ // continue using texture, fill it with new data
+ \endcode
+
+ \note This is a RHI API with limited compatibility guarantees, see \l QRhi
+ for details.
+
+ \sa QRhiResourceUpdateBatch, QRhi, QRhiTextureRenderTarget
*/
/*!
\enum QRhiTexture::Flag
Flag values to specify how the texture is going to be used. Not honoring
- the flags set before build() and attempting to use the texture in ways that
+ the flags set before create() and attempting to use the texture in ways that
was not declared upfront can lead to unspecified behavior or decreased
performance depending on the backend and the underlying graphics API.
@@ -2102,6 +4274,44 @@ QRhiResource::Type QRhiRenderBuffer::resourceType() const
\value UsedWithLoadStore The texture is going to be used with image
load/store operations, for example, in a compute shader.
+
+ \value UsedAsCompressedAtlas The texture has a compressed format and the
+ dimensions of subresource uploads may not match the texture size.
+
+ \value ExternalOES The texture should use the GL_TEXTURE_EXTERNAL_OES
+ target with OpenGL. This flag is ignored with other graphics APIs.
+
+ \value ThreeDimensional The texture is a 3D texture. Such textures should
+ be created with the QRhi::newTexture() overload taking a depth in addition
+ to width and height. A 3D texture can have mipmaps but cannot be
+ multisample. When rendering into, or uploading data to a 3D texture, the \c
+ layer specified in the render target's color attachment or the upload
+ description refers to a single slice in range [0..depth-1]. The underlying
+ graphics API may not support 3D textures at run time. Support is indicated
+ by the QRhi::ThreeDimensionalTextures feature.
+
+ \value TextureRectangleGL The texture should use the GL_TEXTURE_RECTANGLE
+ target with OpenGL. This flag is ignored with other graphics APIs. Just
+ like ExternalOES, this flag is useful when working with platform APIs where
+ native OpenGL texture objects received from the platform are wrapped in a
+ QRhiTexture, and the platform can only provide textures for a non-2D
+ texture target.
+
+ \value TextureArray The texture is a texture array, i.e. a single texture
+ object that is a homogeneous array of 2D textures. Texture arrays are
+ created with QRhi::newTextureArray(). The underlying graphics API may not
+ support texture array objects at run time. Support is indicated by the
+ QRhi::TextureArrays feature. When rendering into, or uploading data to a
+ texture array, the \c layer specified in the render target's color
+ attachment or the upload description selects a single element in the array.
+
+ \value OneDimensional The texture is a 1D texture. Such textures can be
+ created by passing a 0 height and depth to QRhi::newTexture(). Note that
+ there can be limitations on one dimensional textures depending on the
+ underlying graphics API. For example, rendering to them or using them with
+ mipmap-based filtering may be unsupported. This is indicated by the
+ QRhi::OneDimensionalTextures and QRhi::OneDimensionalTextureMipmaps
+ feature flags.
*/
/*!
@@ -2118,8 +4328,12 @@ QRhiResource::Type QRhiRenderBuffer::resourceType() const
\value R8 One component, unsigned normalized 8 bit.
+ \value RG8 Two components, unsigned normalized 8 bit.
+
\value R16 One component, unsigned normalized 16 bit.
+ \value RG16 Two component, unsigned normalized 16 bit.
+
\value RED_OR_ALPHA8 Either same as R8, or is a similar format with the component swizzled to alpha,
depending on \l{QRhi::RedOrAlpha8IsRed}{RedOrAlpha8IsRed}.
@@ -2127,8 +4341,25 @@ QRhiResource::Type QRhiRenderBuffer::resourceType() const
\value RGBA32F Four components, 32-bit float per component.
+ \value R16F One component, 16-bit float.
+
+ \value R32F One component, 32-bit float.
+
+ \value RGB10A2 Four components, unsigned normalized 10 bit R, G, and B,
+ 2-bit alpha. This is a packed format so native endianness applies. Note
+ that there is no BGR10A2. This is because RGB10A2 maps to
+ DXGI_FORMAT_R10G10B10A2_UNORM with D3D, MTLPixelFormatRGB10A2Unorm with
+ Metal, VK_FORMAT_A2B10G10R10_UNORM_PACK32 with Vulkan, and
+ GL_RGB10_A2/GL_RGB/GL_UNSIGNED_INT_2_10_10_10_REV on OpenGL (ES). This is
+ the only universally supported RGB30 option. The corresponding QImage
+ formats are QImage::Format_BGR30 and QImage::Format_A2BGR30_Premultiplied.
+
\value D16 16-bit depth (normalized unsigned integer)
+ \value D24 24-bit depth (normalized unsigned integer)
+
+ \value D24S8 24-bit depth (normalized unsigned integer), 8 bit stencil
+
\value D32F 32-bit depth (32-bit float)
\value BC1
@@ -2160,22 +4391,20 @@ QRhiResource::Type QRhiRenderBuffer::resourceType() const
*/
/*!
- \class QRhiTexture::NativeTexture
+ \struct QRhiTexture::NativeTexture
+ \inmodule QtGui
\brief Contains information about the underlying native resources of a texture.
*/
/*!
\variable QRhiTexture::NativeTexture::object
- \brief a pointer to the native object handle.
-
- With OpenGL, the native handle is a GLuint value, so \c object is then a
- pointer to a GLuint. With Vulkan, the native handle is a VkImage, so \c
- object is a pointer to a VkImage. With Direct3D 11 and Metal \c
- object is a pointer to a ID3D11Texture2D or MTLTexture pointer, respectively.
+ \brief 64-bit integer containing the native object handle.
- \note Pay attention to the fact that \a object is always a pointer
- to the native texture handle type, even if the native type itself is a
- pointer.
+ With OpenGL, the native handle is a GLuint value, so \c object can then be
+ cast to a GLuint. With Vulkan, the native handle is a VkImage, so \c object
+ can be cast to a VkImage. With Direct3D 11 and Metal \c object contains a
+ ID3D11Texture2D or MTLTexture pointer, respectively. With Direct3D 12
+ \c object contains a ID3D12Resource pointer.
*/
/*!
@@ -2188,10 +4417,11 @@ QRhiResource::Type QRhiRenderBuffer::resourceType() const
/*!
\internal
*/
-QRhiTexture::QRhiTexture(QRhiImplementation *rhi, Format format_, const QSize &pixelSize_,
- int sampleCount_, Flags flags_)
+QRhiTexture::QRhiTexture(QRhiImplementation *rhi, Format format_, const QSize &pixelSize_, int depth_,
+ int arraySize_, int sampleCount_, Flags flags_)
: QRhiResource(rhi),
- m_format(format_), m_pixelSize(pixelSize_), m_sampleCount(sampleCount_), m_flags(flags_)
+ m_format(format_), m_pixelSize(pixelSize_), m_depth(depth_),
+ m_arraySize(arraySize_), m_sampleCount(sampleCount_), m_flags(flags_)
{
}
@@ -2204,36 +4434,22 @@ QRhiResource::Type QRhiTexture::resourceType() const
}
/*!
- \fn bool QRhiTexture::build()
+ \fn virtual bool QRhiTexture::create() = 0
Creates the corresponding native graphics resources. If there are already
- resources present due to an earlier build() with no corresponding
- release(), then release() is called implicitly first.
+ resources present due to an earlier create() with no corresponding
+ destroy(), then destroy() is called implicitly first.
\return \c true when successful, \c false when a graphics operation failed.
- Regardless of the return value, calling release() is always safe.
+ Regardless of the return value, calling destroy() is always safe.
*/
/*!
- \return a pointer to a backend-specific QRhiNativeHandles subclass, such as
- QRhiVulkanTextureNativeHandles. The returned value is null when exposing
- the underlying native resources is not supported by the backend.
-
- \sa QRhiVulkanTextureNativeHandles, QRhiD3D11TextureNativeHandles,
- QRhiMetalTextureNativeHandles, QRhiGles2TextureNativeHandles
- */
-// TODO: remove this version once QtQuick has stopped using it
-const QRhiNativeHandles *QRhiTexture::nativeHandles()
-{
- return nullptr;
-}
-
-/*!
\return the underlying native resources for this texture. The returned value
will be empty if exposing the underlying native resources is not supported by
the backend.
- \sa buildFrom()
+ \sa createFrom()
*/
QRhiTexture::NativeTexture QRhiTexture::nativeTexture()
{
@@ -2241,67 +4457,258 @@ QRhiTexture::NativeTexture QRhiTexture::nativeTexture()
}
/*!
- Similar to build() except that no new native textures are created. Instead,
- the texture from \a src is used.
+ Similar to create(), except that no new native textures are created.
+ Instead, the native texture resources specified by \a src is used.
This allows importing an existing native texture object (which must belong
to the same device or sharing context, depending on the graphics API) from
an external graphics engine.
+ \return true if the specified existing native texture object has been
+ successfully wrapped as a non-owning QRhiTexture.
+
\note format(), pixelSize(), sampleCount(), and flags() must still be set
correctly. Passing incorrect sizes and other values to QRhi::newTexture()
- and then following it with a buildFrom() expecting that the native texture
+ and then following it with a createFrom() expecting that the native texture
object alone is sufficient to deduce such values is \b wrong and will lead
to problems.
- \note QRhiTexture does not take ownership of the texture object. release()
+ \note QRhiTexture does not take ownership of the texture object. destroy()
does not free the object or any associated memory.
The opposite of this operation, exposing a QRhiTexture-created native
- texture object to a foreign engine, is possible via nativeHandles().
+ texture object to a foreign engine, is possible via nativeTexture().
- \sa QRhiVulkanTextureNativeHandles, QRhiD3D11TextureNativeHandles,
- QRhiMetalTextureNativeHandles, QRhiGles2TextureNativeHandles
- */
-// TODO: remove this version once QtQuick has stopped using it
-bool QRhiTexture::buildFrom(const QRhiNativeHandles *src)
+ \note When importing a 3D texture, or a texture array object, or, with
+ OpenGL ES, an external texture, it is then especially important to set the
+ corresponding flags (ThreeDimensional, TextureArray, ExternalOES) via
+ setFlags() before calling this function.
+*/
+bool QRhiTexture::createFrom(QRhiTexture::NativeTexture src)
{
Q_UNUSED(src);
return false;
}
/*!
- Similar to build() except that no new native textures are created. Instead,
- the native texture resources specified by \a src is used.
+ With some graphics APIs, such as Vulkan, integrating custom rendering code
+ that uses the graphics API directly needs special care when it comes to
+ image layouts. This function allows communicating the expected \a layout the
+ image backing the QRhiTexture is in after the native rendering commands.
- This allows importing an existing native texture object (which must belong
- to the same device or sharing context, depending on the graphics API) from
- an external graphics engine.
+ For example, consider rendering into a QRhiTexture's VkImage directly with
+ Vulkan in a code block enclosed by QRhiCommandBuffer::beginExternal() and
+ QRhiCommandBuffer::endExternal(), followed by using the image for texture
+ sampling in a QRhi-based render pass. To avoid potentially incorrect image
+ layout transitions, this function can be used to indicate what the image
+ layout will be once the commands recorded in said code block complete.
- \note format(), pixelSize(), sampleCount(), and flags() must still be set
- correctly. Passing incorrect sizes and other values to QRhi::newTexture()
- and then following it with a buildFrom() expecting that the native texture
- object alone is sufficient to deduce such values is \b wrong and will lead
- to problems.
-
- \note QRhiTexture does not take ownership of the texture object. release()
- does not free the object or any associated memory.
+ Calling this function makes sense only after
+ QRhiCommandBuffer::endExternal() and before a subsequent
+ QRhiCommandBuffer::beginPass().
- The opposite of this operation, exposing a QRhiTexture-created native
- texture object to a foreign engine, is possible via nativeTexture().
+ This function has no effect with QRhi backends where the underlying
+ graphics API does not expose a concept of image layouts.
-*/
-bool QRhiTexture::buildFrom(QRhiTexture::NativeTexture src)
+ \note With Vulkan \a layout is a \c VkImageLayout. With Direct 3D 12 \a
+ layout is a value composed of the bits from \c D3D12_RESOURCE_STATES.
+ */
+void QRhiTexture::setNativeLayout(int layout)
{
- Q_UNUSED(src);
- return false;
+ Q_UNUSED(layout);
}
/*!
+ \fn QRhiTexture::Format QRhiTexture::format() const
+ \return the texture format.
+ */
+
+/*!
+ \fn void QRhiTexture::setFormat(QRhiTexture::Format fmt)
+
+ Sets the requested texture format to \a fmt.
+
+ \note The value set is only taken into account upon the next call to
+ create(), i.e. when the underlying graphics resource are (re)created.
+ Setting a new value is futile otherwise and must be avoided since it can
+ lead to inconsistent state.
+ */
+
+/*!
+ \fn QSize QRhiTexture::pixelSize() const
+ \return the size in pixels.
+ */
+
+/*!
+ \fn void QRhiTexture::setPixelSize(const QSize &sz)
+
+ Sets the texture size, specified in pixels, to \a sz.
+
+ \note The value set is only taken into account upon the next call to
+ create(), i.e. when the underlying graphics resource are (re)created.
+ Setting a new value is futile otherwise and must be avoided since it can
+ lead to inconsistent state. The same applies to all other setters as well.
+ */
+
+/*!
+ \fn int QRhiTexture::depth() const
+ \return the depth for 3D textures.
+ */
+
+/*!
+ \fn void QRhiTexture::setDepth(int depth)
+ Sets the \a depth for a 3D texture.
+ */
+
+/*!
+ \fn int QRhiTexture::arraySize() const
+ \return the texture array size.
+ */
+
+/*!
+ \fn void QRhiTexture::setArraySize(int arraySize)
+ Sets the texture \a arraySize.
+ */
+
+/*!
+ \fn int QRhiTexture::arrayRangeStart() const
+
+ \return the first array layer when setArrayRange() was called.
+
+ \sa setArrayRange()
+ */
+
+/*!
+ \fn int QRhiTexture::arrayRangeLength() const
+
+ \return the exposed array range size when setArrayRange() was called.
+
+ \sa setArrayRange()
+*/
+
+/*!
+ \fn void QRhiTexture::setArrayRange(int startIndex, int count)
+
+ Normally all array layers are exposed and it is up to the shader to select
+ the layer via the third coordinate passed to the \c{texture()} GLSL
+ function when sampling the \c sampler2DArray. When QRhi::TextureArrayRange
+ is reported as supported, calling setArrayRange() before create() or
+ createFrom() requests selecting only the specified range, \a count elements
+ starting from \a startIndex. The shader logic can then be written with this
+ in mind.
+
+ \sa QRhi::TextureArrayRange
+ */
+
+/*!
+ \fn Flags QRhiTexture::flags() const
+ \return the texture flags.
+ */
+
+/*!
+ \fn void QRhiTexture::setFlags(Flags f)
+ Sets the texture flags to \a f.
+ */
+
+/*!
+ \fn int QRhiTexture::sampleCount() const
+ \return the sample count. 1 means no multisample antialiasing.
+ */
+
+/*!
+ \fn void QRhiTexture::setSampleCount(int s)
+ Sets the sample count to \a s.
+ */
+
+/*!
+ \struct QRhiTexture::ViewFormat
+ \inmodule QtGui
+ \since 6.8
+ \brief Specifies the view format for reading or writing from or to the texture.
+
+ \note This is a RHI API with limited compatibility guarantees, see \l QRhi
+ for details.
+ */
+
+/*!
+ \variable QRhiTexture::ViewFormat::format
+ */
+
+/*!
+ \variable QRhiTexture::ViewFormat::srgb
+ */
+
+/*!
+ \fn QRhiTexture::ViewFormat QRhiTexture::readViewFormat() const
+ \since 6.8
+ \return the view format used when sampling the texture. When not called, the view
+ format is assumed to be the same as format().
+ */
+
+/*!
+ \fn void QRhiTexture::setReadViewFormat(const ViewFormat &fmt)
+ \since 6.8
+
+ Sets the shader resource view format (or the format of the view used for
+ sampling the texture) to \a fmt. By default the same format (and sRGB-ness)
+ is used as the texture itself, and in most cases this function does not need
+ to be called.
+
+ This setting is only taken into account when the \l TextureViewFormat
+ feature is reported as supported.
+
+ \note This functionality is provided to allow "casting" between
+ non-sRGB and sRGB in order to get the shader reads perform, or not perform,
+ the implicit sRGB conversions. Other types of casting may or may not be
+ functional.
+ */
+
+/*!
+ \fn QRhiTexture::ViewFormat QRhiTexture::writeViewFormat() const
+ \since 6.8
+ \return the view format used when writing to the texture and when using it
+ with image load/store. When not called, the view format is assumed to be the
+ same as format().
+ */
+
+/*!
+ \fn void QRhiTexture::setWriteViewFormat(const ViewFormat &fmt)
+ \since 6.8
+
+ Sets the render target view format to \a fmt. By default the same format
+ (and sRGB-ness) is used as the texture itself, and in most cases this
+ function does not need to be called.
+
+ One common use case for providing a write view format is working with
+ externally provided textures that, outside of our control, use an sRGB
+ format with 3D APIs such as Vulkan or Direct 3D, but the rendering engine is
+ already prepared to handle linearization and conversion to sRGB at the end
+ of its shading pipeline. In this case what is wanted when rendering into
+ such a texture is a render target view (e.g. VkImageView) that has the same,
+ but non-sRGB format. (if e.g. from an OpenXR implementation one gets a
+ VK_FORMAT_R8G8B8A8_SRGB texture, it is likely that rendering into it should
+ be done using a VK_FORMAT_R8G8B8A8_UNORM view, if that is what the rendering
+ engine's pipeline requires; in this example one would call this function
+ with a ViewFormat that has a format of QRhiTexture::RGBA8 and \c srgb set to
+ \c false).
+
+ This setting is only taken into account when the \l TextureViewFormat
+ feature is reported as supported.
+
+ \note This functionality is provided to allow "casting" between
+ non-sRGB and sRGB in order to get the shader write not perform, or perform,
+ the implicit sRGB conversions. Other types of casting may or may not be
+ functional.
+ */
+
+/*!
\class QRhiSampler
- \internal
\inmodule QtGui
+ \since 6.6
\brief Sampler resource.
+
+ \note This is a RHI API with limited compatibility guarantees, see \l QRhi
+ for details.
*/
/*!
@@ -2341,11 +4748,10 @@ bool QRhiTexture::buildFrom(QRhiTexture::NativeTexture src)
*/
QRhiSampler::QRhiSampler(QRhiImplementation *rhi,
Filter magFilter_, Filter minFilter_, Filter mipmapMode_,
- AddressMode u_, AddressMode v_)
+ AddressMode u_, AddressMode v_, AddressMode w_)
: QRhiResource(rhi),
m_magFilter(magFilter_), m_minFilter(minFilter_), m_mipmapMode(mipmapMode_),
- m_addressU(u_), m_addressV(v_),
- m_addressW(QRhiSampler::ClampToEdge),
+ m_addressU(u_), m_addressV(v_), m_addressW(w_),
m_compareOp(QRhiSampler::Never)
{
}
@@ -2359,14 +4765,91 @@ QRhiResource::Type QRhiSampler::resourceType() const
}
/*!
+ \fn QRhiSampler::Filter QRhiSampler::magFilter() const
+ \return the magnification filter mode.
+ */
+
+/*!
+ \fn void QRhiSampler::setMagFilter(Filter f)
+ Sets the magnification filter mode to \a f.
+ */
+
+/*!
+ \fn QRhiSampler::Filter QRhiSampler::minFilter() const
+ \return the minification filter mode.
+ */
+
+/*!
+ \fn void QRhiSampler::setMinFilter(Filter f)
+ Sets the minification filter mode to \a f.
+ */
+
+/*!
+ \fn QRhiSampler::Filter QRhiSampler::mipmapMode() const
+ \return the mipmap filter mode.
+ */
+
+/*!
+ \fn void QRhiSampler::setMipmapMode(Filter f)
+
+ Sets the mipmap filter mode to \a f.
+
+ Leave this set to None when the texture has no mip levels, or when the mip
+ levels are not to be taken into account.
+ */
+
+/*!
+ \fn QRhiSampler::AddressMode QRhiSampler::addressU() const
+ \return the horizontal wrap mode.
+ */
+
+/*!
+ \fn void QRhiSampler::setAddressU(AddressMode mode)
+ Sets the horizontal wrap \a mode.
+ */
+
+/*!
+ \fn QRhiSampler::AddressMode QRhiSampler::addressV() const
+ \return the vertical wrap mode.
+ */
+
+/*!
+ \fn void QRhiSampler::setAddressV(AddressMode mode)
+ Sets the vertical wrap \a mode.
+ */
+
+/*!
+ \fn QRhiSampler::AddressMode QRhiSampler::addressW() const
+ \return the depth wrap mode.
+ */
+
+/*!
+ \fn void QRhiSampler::setAddressW(AddressMode mode)
+ Sets the depth wrap \a mode.
+ */
+
+/*!
+ \fn QRhiSampler::CompareOp QRhiSampler::textureCompareOp() const
+ \return the texture comparison function.
+ */
+
+/*!
+ \fn void QRhiSampler::setTextureCompareOp(CompareOp op)
+ Sets the texture comparison function \a op.
+ */
+
+/*!
\class QRhiRenderPassDescriptor
- \internal
\inmodule QtGui
+ \since 6.6
\brief Render pass resource.
A render pass, if such a concept exists in the underlying graphics API, is
a collection of attachments (color, depth, stencil) and describes how those
attachments are used.
+
+ \note This is a RHI API with limited compatibility guarantees, see \l QRhi
+ for details.
*/
/*!
@@ -2386,7 +4869,7 @@ QRhiResource::Type QRhiRenderPassDescriptor::resourceType() const
}
/*!
- \fn bool QRhiRenderPassDescriptor::isCompatible(const QRhiRenderPassDescriptor *other) const;
+ \fn virtual bool QRhiRenderPassDescriptor::isCompatible(const QRhiRenderPassDescriptor *other) const = 0
\return true if the \a other QRhiRenderPassDescriptor is compatible with
this one, meaning \c this and \a other can be used interchangebly in
@@ -2401,11 +4884,67 @@ QRhiResource::Type QRhiRenderPassDescriptor::resourceType() const
allowing a different QRhiRenderPassDescriptor and
QRhiShaderResourceBindings to be used in combination with the pipeline, as
long as they are compatible.
+
+ The exact details of compatibility depend on the underlying graphics API.
+ Two renderpass descriptors
+ \l{QRhiTextureRenderTarget::newCompatibleRenderPassDescriptor()}{created}
+ from the same QRhiTextureRenderTarget are always compatible.
+
+ Similarly to QRhiShaderResourceBindings, compatibility can also be tested
+ without having two existing objects available. Extracting the opaque blob by
+ calling serializedFormat() allows testing for compatibility by comparing the
+ returned vector to another QRhiRenderPassDescriptor's
+ serializedFormat(). This has benefits in certain situations, because it
+ allows testing the compatibility of a QRhiRenderPassDescriptor with a
+ QRhiGraphicsPipeline even when the QRhiRenderPassDescriptor the pipeline was
+ originally built was is no longer available (but the data returned from its
+ serializedFormat() still is).
+
+ \sa newCompatibleRenderPassDescriptor(), serializedFormat()
+ */
+
+/*!
+ \fn virtual QRhiRenderPassDescriptor *QRhiRenderPassDescriptor::newCompatibleRenderPassDescriptor() const = 0
+
+ \return a new QRhiRenderPassDescriptor that is
+ \l{isCompatible()}{compatible} with this one.
+
+ This function allows cloning a QRhiRenderPassDescriptor. The returned
+ object is ready to be used, and the ownership is transferred to the caller.
+ Cloning a QRhiRenderPassDescriptor object can become useful in situations
+ where the object is stored in data structures related to graphics pipelines
+ (in order to allow creating new pipelines which in turn requires a
+ renderpass descriptor object), and the lifetime of the renderpass
+ descriptor created from a render target may be shorter than the pipelines.
+ (for example, because the engine manages and destroys renderpasses together
+ with the textures and render targets it was created from) In such a
+ situation, it can be beneficial to store a cloned version in the data
+ structures, and thus transferring ownership as well.
+
+ \sa isCompatible()
+ */
+
+/*!
+ \fn virtual QVector<quint32> QRhiRenderPassDescriptor::serializedFormat() const = 0
+
+ \return a vector of integers containing an opaque blob describing the data
+ relevant for \l{isCompatible()}{compatibility}.
+
+ Given two QRhiRenderPassDescriptor objects \c rp1 and \c rp2, if the data
+ returned from this function is identical, then \c{rp1->isCompatible(rp2)},
+ and vice versa hold true as well.
+
+ \note The returned data is meant to be used for storing in memory and
+ comparisons during the lifetime of the QRhi the object belongs to. It is not
+ meant for storing on disk, reusing between processes, or using with multiple
+ QRhi instances with potentially different backends.
+
+ \sa isCompatible()
*/
/*!
\return a pointer to a backend-specific QRhiNativeHandles subclass, such as
- QRhiVulkanRenderPassNativeHandles. The returned value is null when exposing
+ QRhiVulkanRenderPassNativeHandles. The returned value is \nullptr when exposing
the underlying native resources is not supported by the backend.
\sa QRhiVulkanRenderPassNativeHandles
@@ -2417,9 +4956,21 @@ const QRhiNativeHandles *QRhiRenderPassDescriptor::nativeHandles()
/*!
\class QRhiRenderTarget
- \internal
\inmodule QtGui
+ \since 6.6
\brief Represents an onscreen (swapchain) or offscreen (texture) render target.
+
+ Applications do not create an instance of this class directly. Rather, it
+ is the subclass QRhiTextureRenderTarget that is instantiable by clients of
+ the API via \l{QRhi::newTextureRenderTarget()}{newTextureRenderTarget()}.
+ The other subclass is QRhiSwapChainRenderTarget, which is the type
+ QRhiSwapChain returns when calling
+ \l{QRhiSwapChain::currentFrameRenderTarget()}{currentFrameRenderTarget()}.
+
+ \note This is a RHI API with limited compatibility guarantees, see \l QRhi
+ for details.
+
+ \sa QRhiSwapChainRenderTarget, QRhiTextureRenderTarget
*/
/*!
@@ -2431,21 +4982,25 @@ QRhiRenderTarget::QRhiRenderTarget(QRhiImplementation *rhi)
}
/*!
- \return the resource type.
- */
-QRhiResource::Type QRhiRenderTarget::resourceType() const
-{
- return RenderTarget;
-}
-
-/*!
- \fn QSize QRhiRenderTarget::pixelSize() const
+ \fn virtual QSize QRhiRenderTarget::pixelSize() const = 0
\return the size in pixels.
+
+ Valid only after create() has been called successfully. Until then the
+ result is a default-constructed QSize.
+
+ With QRhiTextureRenderTarget the returned size is the size of the
+ associated attachments at the time of create(), in practice the size of the
+ first color attachment, or the depth/stencil buffer if there are no color
+ attachments. If the associated textures or renderbuffers are resized and
+ rebuilt afterwards, then pixelSize() performs an implicit call to create()
+ in order to rebuild the underlying data structures. This implicit check is
+ similar to what QRhiCommandBuffer::beginPass() does, and ensures that the
+ returned size is always up-to-date.
*/
/*!
- \fn float QRhiRenderTarget::devicePixelRatio() const
+ \fn virtual float QRhiRenderTarget::devicePixelRatio() const = 0
\return the device pixel ratio. For QRhiTextureRenderTarget this is always
1. For targets retrieved from a QRhiSwapChain the value reflects the
@@ -2454,29 +5009,94 @@ QRhiResource::Type QRhiRenderTarget::resourceType() const
*/
/*!
- \class QRhiTextureRenderTarget
+ \fn virtual int QRhiRenderTarget::sampleCount() const = 0
+
+ \return the sample count or 1 if multisample antialiasing is not relevant for
+ this render target.
+ */
+
+/*!
+ \fn QRhiRenderPassDescriptor *QRhiRenderTarget::renderPassDescriptor() const
+
+ \return the associated QRhiRenderPassDescriptor.
+ */
+
+/*!
+ \fn void QRhiRenderTarget::setRenderPassDescriptor(QRhiRenderPassDescriptor *desc)
+
+ Sets the QRhiRenderPassDescriptor \a desc for use with this render target.
+ */
+
+/*!
\internal
+ */
+QRhiSwapChainRenderTarget::QRhiSwapChainRenderTarget(QRhiImplementation *rhi, QRhiSwapChain *swapchain_)
+ : QRhiRenderTarget(rhi),
+ m_swapchain(swapchain_)
+{
+}
+
+/*!
+ \class QRhiSwapChainRenderTarget
\inmodule QtGui
+ \since 6.6
+ \brief Swapchain render target resource.
+
+ When targeting the color buffers of a swapchain, active render target is a
+ QRhiSwapChainRenderTarget. This is what
+ QRhiSwapChain::currentFrameRenderTarget() returns.
+
+ \note This is a RHI API with limited compatibility guarantees, see \l QRhi
+ for details.
+
+ \sa QRhiSwapChain
+ */
+
+/*!
+ \return the resource type.
+ */
+QRhiResource::Type QRhiSwapChainRenderTarget::resourceType() const
+{
+ return SwapChainRenderTarget;
+}
+
+/*!
+ \fn QRhiSwapChain *QRhiSwapChainRenderTarget::swapChain() const
+
+ \return the swapchain object.
+ */
+
+/*!
+ \class QRhiTextureRenderTarget
+ \inmodule QtGui
+ \since 6.6
\brief Texture render target resource.
A texture render target allows rendering into one or more textures,
optionally with a depth texture or depth/stencil renderbuffer.
+ For multisample rendering the common approach is to use a renderbuffer as
+ the color attachment and set the non-multisample destination texture as the
+ \c{resolve texture}.
+
\note Textures used in combination with QRhiTextureRenderTarget must be
created with the QRhiTexture::RenderTarget flag.
The simplest example of creating a render target with a texture as its
single color attachment:
- \badcode
- texture = rhi->newTexture(QRhiTexture::RGBA8, size, 1, QRhiTexture::RenderTarget);
- texture->build();
- rt = rhi->newTextureRenderTarget({ texture });
+ \code
+ QRhiTexture *texture = rhi->newTexture(QRhiTexture::RGBA8, size, 1, QRhiTexture::RenderTarget);
+ texture->create();
+ QRhiTextureRenderTarget *rt = rhi->newTextureRenderTarget({ texture });
rp = rt->newCompatibleRenderPassDescriptor();
rt->setRenderPassDescriptor(rt);
- rt->build();
+ rt->create();
// rt can now be used with beginPass()
\endcode
+
+ \note This is a RHI API with limited compatibility guarantees, see \l QRhi
+ for details.
*/
/*!
@@ -2491,7 +5111,19 @@ QRhiResource::Type QRhiRenderTarget::resourceType() const
\value PreserveColorContents Indicates that the contents of the color
attachments is to be loaded when starting a render pass, instead of
clearing. This is potentially more expensive, especially on mobile (tiled)
- GPUs, but allows preserving the existing contents between passes.
+ GPUs, but allows preserving the existing contents between passes. When doing
+ multisample rendering with a resolve texture set, setting this flag also
+ requests the multisample color data to be stored (written out) to the
+ multisample texture or render buffer. (for non-multisample rendering the
+ color data is always stored, but for MSAA storing the multisample data
+ decreases efficiency for certain GPU architectures, hence defaulting to not
+ writing it out) Note however that this is non-portable: in some cases there
+ is no intermediate multisample texture on the graphics API level, e.g. when
+ using OpenGL ES's \c{GL_EXT_multisampled_render_to_texture} as it is all
+ implicit, handled by the OpenGL ES implementation. In that case,
+ PreserveColorContents will likely have no effect. Therefore, avoid relying
+ on this flag when using multisample rendering and the color attachment is
+ using a multisample QRhiTexture (not QRhiRenderBuffer).
\value PreserveDepthStencilContents Indicates that the contents of the
depth texture is to be loaded when starting a render pass, instead
@@ -2499,6 +5131,13 @@ QRhiResource::Type QRhiRenderTarget::resourceType() const
(QRhiTextureRenderTargetDescription::depthTexture() is set) because
depth/stencil renderbuffers may not have any physical backing and data may
not be written out in the first place.
+
+ \value DoNotStoreDepthStencilContents Indicates that the contents of the
+ depth texture does not need to be written out. Relevant only when a
+ QRhiTexture, not QRhiRenderBuffer, is used as the depth-stencil buffer,
+ because for QRhiRenderBuffer this is implicit. When a depthResolveTexture is
+ set, the flag is not relevant, because the behavior is then as if the flag
+ was set. This enum value is introduced in Qt 6.8.
*/
/*!
@@ -2522,7 +5161,7 @@ QRhiResource::Type QRhiTextureRenderTarget::resourceType() const
}
/*!
- \fn QRhiRenderPassDescriptor *QRhiTextureRenderTarget::newCompatibleRenderPassDescriptor()
+ \fn virtual QRhiRenderPassDescriptor *QRhiTextureRenderTarget::newCompatibleRenderPassDescriptor() = 0
\return a new QRhiRenderPassDescriptor that is compatible with this render
target.
@@ -2532,31 +5171,32 @@ QRhiResource::Type QRhiTextureRenderTarget::resourceType() const
QRhiGraphicsPipeline::setRenderPassDescriptor(). A render pass descriptor
describes the attachments (color, depth/stencil) and the load/store
behavior that can be affected by flags(). A QRhiGraphicsPipeline can only
- be used in combination with a render target that has the same
+ be used in combination with a render target that has a
+ \l{QRhiRenderPassDescriptor::isCompatible()}{compatible}
QRhiRenderPassDescriptor set.
Two QRhiTextureRenderTarget instances can share the same render pass
descriptor as long as they have the same number and type of attachments.
The associated QRhiTexture or QRhiRenderBuffer instances are not part of
the render pass descriptor so those can differ in the two
- QRhiTextureRenderTarget intances.
+ QRhiTextureRenderTarget instances.
\note resources, such as QRhiTexture instances, referenced in description()
- must already be built
+ must already have create() called on them.
- \sa build()
+ \sa create()
*/
/*!
- \fn bool QRhiTextureRenderTarget::build()
+ \fn virtual bool QRhiTextureRenderTarget::create() = 0
Creates the corresponding native graphics resources. If there are already
- resources present due to an earlier build() with no corresponding
- release(), then release() is called implicitly first.
+ resources present due to an earlier create() with no corresponding
+ destroy(), then destroy() is called implicitly first.
- \note renderPassDescriptor() must be set before calling build(). To obtain
+ \note renderPassDescriptor() must be set before calling create(). To obtain
a QRhiRenderPassDescriptor compatible with the render target, call
- newCompatibleRenderPassDescriptor() before build() but after setting all
+ newCompatibleRenderPassDescriptor() before create() but after setting all
other parameters, such as description() and flags(). To save resources,
reuse the same QRhiRenderPassDescriptor with multiple
QRhiTextureRenderTarget instances, whenever possible. Sharing the same
@@ -2565,16 +5205,36 @@ QRhiResource::Type QRhiTextureRenderTarget::resourceType() const
the same flags.
\note resources, such as QRhiTexture instances, referenced in description()
- must already be built
+ must already have create() called on them.
\return \c true when successful, \c false when a graphics operation failed.
- Regardless of the return value, calling release() is always safe.
+ Regardless of the return value, calling destroy() is always safe.
+ */
+
+/*!
+ \fn QRhiTextureRenderTargetDescription QRhiTextureRenderTarget::description() const
+ \return the render target description.
+ */
+
+/*!
+ \fn void QRhiTextureRenderTarget::setDescription(const QRhiTextureRenderTargetDescription &desc)
+ Sets the render target description \a desc.
+ */
+
+/*!
+ \fn QRhiTextureRenderTarget::Flags QRhiTextureRenderTarget::flags() const
+ \return the currently set flags.
+ */
+
+/*!
+ \fn void QRhiTextureRenderTarget::setFlags(Flags f)
+ Sets the flags to \a f.
*/
/*!
\class QRhiShaderResourceBindings
- \internal
\inmodule QtGui
+ \since 6.6
\brief Encapsulates resources for making buffer, texture, sampler resources visible to shaders.
A QRhiShaderResourceBindings is a collection of QRhiShaderResourceBinding
@@ -2595,19 +5255,19 @@ QRhiResource::Type QRhiTextureRenderTarget::resourceType() const
QRhiShaderResourceBindings could be created and then passed to
QRhiGraphicsPipeline::setShaderResourceBindings():
- \badcode
- srb = rhi->newShaderResourceBindings();
+ \code
+ QRhiShaderResourceBindings *srb = rhi->newShaderResourceBindings();
srb->setBindings({
QRhiShaderResourceBinding::uniformBuffer(0, QRhiShaderResourceBinding::VertexStage | QRhiShaderResourceBinding::FragmentStage, ubuf),
QRhiShaderResourceBinding::sampledTexture(1, QRhiShaderResourceBinding::FragmentStage, texture, sampler)
});
- srb->build();
- ...
- ps = rhi->newGraphicsPipeline();
- ...
+ srb->create();
+ // ...
+ QRhiGraphicsPipeline *ps = rhi->newGraphicsPipeline();
+ // ...
ps->setShaderResourceBindings(srb);
- ps->build();
- ...
+ ps->create();
+ // ...
cb->setGraphicsPipeline(ps);
cb->setShaderResources(); // binds srb
\endcode
@@ -2625,23 +5285,35 @@ QRhiResource::Type QRhiTextureRenderTarget::resourceType() const
This is why QRhiCommandBuffer::setShaderResources() allows specifying a \a
srb argument. As long as the layouts (so the number of bindings and the
binding points) match between two QRhiShaderResourceBindings, they can both
- be used with the same pipeline, assuming the pipeline was built with one of
- them in the first place.
+ be used with the same pipeline, assuming the pipeline was created with one of
+ them in the first place. See isLayoutCompatible() for more details.
- \badcode
- srb2 = rhi->newShaderResourceBindings();
- ...
+ \code
+ QRhiShaderResourceBindings *srb2 = rhi->newShaderResourceBindings();
+ // ...
cb->setGraphicsPipeline(ps);
cb->setShaderResources(srb2); // binds srb2
\endcode
+
+ \note This is a RHI API with limited compatibility guarantees, see \l QRhi
+ for details.
*/
/*!
+ \typedef QRhiShaderResourceBindingSet
+ \relates QRhi
+ \since 6.7
+
+ Synonym for QRhiShaderResourceBindings.
+*/
+
+/*!
\internal
*/
QRhiShaderResourceBindings::QRhiShaderResourceBindings(QRhiImplementation *rhi)
: QRhiResource(rhi)
{
+ m_layoutDesc.reserve(BINDING_PREALLOC * QRhiShaderResourceBinding::LAYOUT_DESC_ENTRIES_PER_BINDING);
}
/*!
@@ -2664,31 +5336,106 @@ QRhiResource::Type QRhiShaderResourceBindings::resourceType() const
then safely be passed to QRhiCommandBuffer::setShaderResources(), and so
be used with the pipeline in place of this QRhiShaderResourceBindings.
- This function can be called before build() as well. The bindings must
- already be set via setBindings() however.
+ \note This function must only be called after a successful create(), because
+ it relies on data generated during the baking of the underlying data
+ structures. This way the function can implement a comparison approach that
+ is more efficient than iterating through two binding lists and calling
+ QRhiShaderResourceBinding::isLayoutCompatible() on each pair. This becomes
+ relevant especially when this function is called at a high frequency.
+
+ \sa serializedLayoutDescription()
*/
bool QRhiShaderResourceBindings::isLayoutCompatible(const QRhiShaderResourceBindings *other) const
{
- const int count = m_bindings.count();
- if (count != other->m_bindings.count())
+ if (other == this)
+ return true;
+
+ if (!other)
return false;
- for (int i = 0; i < count; ++i) {
- if (!m_bindings[i].isLayoutCompatible(other->m_bindings.at(i)))
- return false;
- }
+ // This can become a hot code path. Therefore we do not iterate and call
+ // isLayoutCompatible() on m_bindings, but rather check a pre-calculated
+ // hash code and then, if the hash matched, do a uint array comparison
+ // (that's still more cache friendly).
- return true;
+ return m_layoutDescHash == other->m_layoutDescHash
+ && m_layoutDesc == other->m_layoutDesc;
}
/*!
+ \fn QVector<quint32> QRhiShaderResourceBindings::serializedLayoutDescription() const
+
+ \return a vector of integers containing an opaque blob describing the layout
+ of the binding list, i.e. the data relevant for
+ \l{isLayoutCompatible()}{layout compatibility tests}.
+
+ Given two objects \c srb1 and \c srb2, if the data returned from this
+ function is identical, then \c{srb1->isLayoutCompatible(srb2)}, and vice
+ versa hold true as well.
+
+ \note The returned data is meant to be used for storing in memory and
+ comparisons during the lifetime of the QRhi the object belongs to. It is not
+ meant for storing on disk, reusing between processes, or using with multiple
+ QRhi instances with potentially different backends.
+
+ \sa isLayoutCompatible()
+ */
+
+void QRhiImplementation::updateLayoutDesc(QRhiShaderResourceBindings *srb)
+{
+ srb->m_layoutDescHash = 0;
+ srb->m_layoutDesc.clear();
+ auto layoutDescAppender = std::back_inserter(srb->m_layoutDesc);
+ for (const QRhiShaderResourceBinding &b : std::as_const(srb->m_bindings)) {
+ const QRhiShaderResourceBinding::Data *d = &b.d;
+ srb->m_layoutDescHash ^= uint(d->binding) ^ uint(d->stage) ^ uint(d->type)
+ ^ uint(d->arraySize());
+ layoutDescAppender = d->serialize(layoutDescAppender);
+ }
+}
+
+/*!
+ \fn void QRhiShaderResourceBindings::setBindings(std::initializer_list<QRhiShaderResourceBinding> list)
+ Sets the \a list of bindings.
+ */
+
+/*!
+ \fn template<typename InputIterator> void QRhiShaderResourceBindings::setBindings(InputIterator first, InputIterator last)
+ Sets the list of bindings from the iterators \a first and \a last.
+ */
+
+/*!
+ \fn const QRhiShaderResourceBinding *QRhiShaderResourceBindings::cbeginBindings() const
+ \return a const iterator pointing to the first item in the binding list.
+ */
+
+/*!
+ \fn const QRhiShaderResourceBinding *QRhiShaderResourceBindings::cendBindings() const
+ \return a const iterator pointing just after the last item in the binding list.
+ */
+
+/*!
+ \fn const QRhiShaderResourceBinding *QRhiShaderResourceBindings::bindingAt(qsizetype index) const
+ \return the binding at the specified \a index.
+ */
+
+/*!
+ \fn qsizetype QRhiShaderResourceBindings::bindingCount() const
+ \return the number of bindings.
+ */
+
+/*!
\class QRhiShaderResourceBinding
- \internal
\inmodule QtGui
+ \since 6.6
\brief Describes the shader resource for a single binding point.
- A QRhiShaderResourceBinding cannot be constructed directly. Instead, use
- the static functions uniformBuffer(), sampledTexture() to get an instance.
+ A QRhiShaderResourceBinding cannot be constructed directly. Instead, use the
+ static functions such as uniformBuffer() or sampledTexture() to get an
+ instance.
+
+ \note This is a RHI API with limited compatibility guarantees, see \l QRhi
+ for details.
*/
/*!
@@ -2697,7 +5444,15 @@ bool QRhiShaderResourceBindings::isLayoutCompatible(const QRhiShaderResourceBind
\value UniformBuffer Uniform buffer
- \value SampledTexture Combined image sampler
+ \value SampledTexture Combined image sampler (a texture and sampler pair).
+ Even when the shading language associated with the underlying 3D API has no
+ support for this concept (e.g. D3D and HLSL), this is still supported
+ because the shader translation layer takes care of the appropriate
+ translation and remapping of binding points or shader registers.
+
+ \value Texture Texture (separate)
+
+ \value Sampler Sampler (separate)
\value ImageLoad Image load (with GLSL this maps to doing imageLoad() on a
single level - and either one or all layers - of a texture exposed to the
@@ -2723,42 +5478,50 @@ bool QRhiShaderResourceBindings::isLayoutCompatible(const QRhiShaderResourceBind
Flag values to indicate which stages the shader resource is visible in
\value VertexStage Vertex stage
- \value FragmentStage Fragment (pixel) stage
+ \value TessellationControlStage Tessellation control (hull shader) stage
+ \value TessellationEvaluationStage Tessellation evaluation (domain shader) stage
+ \value FragmentStage Fragment (pixel shader) stage
\value ComputeStage Compute stage
+ \value GeometryStage Geometry stage
*/
/*!
- \internal
- */
-QRhiShaderResourceBinding::QRhiShaderResourceBinding()
-{
- // Zero out everything, including possible padding, because will use
- // qHashBits on it.
- memset(&d.u, 0, sizeof(d.u));
-}
-
-/*!
\return \c true if the layout is compatible with \a other. The layout does not
include the actual resource (such as, buffer or texture) and related
parameters (such as, offset or size).
For example, \c a and \c b below are not equal, but are compatible layout-wise:
- \badcode
+ \code
auto a = QRhiShaderResourceBinding::uniformBuffer(0, QRhiShaderResourceBinding::VertexStage, buffer);
auto b = QRhiShaderResourceBinding::uniformBuffer(0, QRhiShaderResourceBinding::VertexStage, someOtherBuffer, 256);
\endcode
*/
bool QRhiShaderResourceBinding::isLayoutCompatible(const QRhiShaderResourceBinding &other) const
{
- return d.binding == other.d.binding && d.stage == other.d.stage && d.type == other.d.type;
+ // everything that goes into a VkDescriptorSetLayoutBinding must match
+ return d.binding == other.d.binding
+ && d.stage == other.d.stage
+ && d.type == other.d.type
+ && d.arraySize() == other.d.arraySize();
}
/*!
\return a shader resource binding for the given binding number, pipeline
stages, and buffer specified by \a binding, \a stage, and \a buf.
- \note \a buf must have been created with QRhiBuffer::UniformBuffer.
+ \note When \a buf is not null, it must have been created with
+ QRhiBuffer::UniformBuffer.
+
+ \note \a buf can be null. It is valid to create a
+ QRhiShaderResourceBindings with unspecified resources, but such an object
+ cannot be used with QRhiCommandBuffer::setShaderResources(). It is however
+ suitable for creating pipelines. Such a pipeline must then always be used
+ together with another, layout compatible QRhiShaderResourceBindings with
+ resources present passed to QRhiCommandBuffer::setShaderResources().
+
+ \note If the size of \a buf exceeds the limit reported for
+ QRhi::MaxUniformBufferRange, unexpected errors may occur.
*/
QRhiShaderResourceBinding QRhiShaderResourceBinding::uniformBuffer(
int binding, StageFlags stage, QRhiBuffer *buf)
@@ -2784,15 +5547,31 @@ QRhiShaderResourceBinding QRhiShaderResourceBinding::uniformBuffer(
\note \a size must be greater than 0.
- \note \a buf must have been created with QRhiBuffer::UniformBuffer.
+ \note When \a buf is not null, it must have been created with
+ QRhiBuffer::UniformBuffer.
+
+ \note \a buf can be null. It is valid to create a
+ QRhiShaderResourceBindings with unspecified resources, but such an object
+ cannot be used with QRhiCommandBuffer::setShaderResources(). It is however
+ suitable for creating pipelines. Such a pipeline must then always be used
+ together with another, layout compatible QRhiShaderResourceBindings with
+ resources present passed to QRhiCommandBuffer::setShaderResources().
+
+ \note If \a size exceeds the limit reported for QRhi::MaxUniformBufferRange,
+ unexpected errors may occur.
*/
QRhiShaderResourceBinding QRhiShaderResourceBinding::uniformBuffer(
- int binding, StageFlags stage, QRhiBuffer *buf, int offset, int size)
+ int binding, StageFlags stage, QRhiBuffer *buf, quint32 offset, quint32 size)
{
Q_ASSERT(size > 0);
- QRhiShaderResourceBinding b = uniformBuffer(binding, stage, buf);
+ QRhiShaderResourceBinding b;
+ b.d.binding = binding;
+ b.d.stage = stage;
+ b.d.type = UniformBuffer;
+ b.d.u.ubuf.buf = buf;
b.d.u.ubuf.offset = offset;
b.d.u.ubuf.maybeSize = size;
+ b.d.u.ubuf.hasDynamicOffset = false;
return b;
}
@@ -2805,12 +5584,30 @@ QRhiShaderResourceBinding QRhiShaderResourceBinding::uniformBuffer(
size of the bound region is specified by \a size. Like with non-dynamic
offsets, \c{offset + size} cannot exceed the size of \a buf.
- \note \a buf must have been created with QRhiBuffer::UniformBuffer.
+ \note When \a buf is not null, it must have been created with
+ QRhiBuffer::UniformBuffer.
+
+ \note \a buf can be null. It is valid to create a
+ QRhiShaderResourceBindings with unspecified resources, but such an object
+ cannot be used with QRhiCommandBuffer::setShaderResources(). It is however
+ suitable for creating pipelines. Such a pipeline must then always be used
+ together with another, layout compatible QRhiShaderResourceBindings with
+ resources present passed to QRhiCommandBuffer::setShaderResources().
+
+ \note If \a size exceeds the limit reported for QRhi::MaxUniformBufferRange,
+ unexpected errors may occur.
*/
QRhiShaderResourceBinding QRhiShaderResourceBinding::uniformBufferWithDynamicOffset(
- int binding, StageFlags stage, QRhiBuffer *buf, int size)
+ int binding, StageFlags stage, QRhiBuffer *buf, quint32 size)
{
- QRhiShaderResourceBinding b = uniformBuffer(binding, stage, buf, 0, size);
+ Q_ASSERT(size > 0);
+ QRhiShaderResourceBinding b;
+ b.d.binding = binding;
+ b.d.stage = stage;
+ b.d.type = UniformBuffer;
+ b.d.u.ubuf.buf = buf;
+ b.d.u.ubuf.offset = 0;
+ b.d.u.ubuf.maybeSize = size;
b.d.u.ubuf.hasDynamicOffset = true;
return b;
}
@@ -2819,6 +5616,26 @@ QRhiShaderResourceBinding QRhiShaderResourceBinding::uniformBufferWithDynamicOff
\return a shader resource binding for the given binding number, pipeline
stages, texture, and sampler specified by \a binding, \a stage, \a tex,
\a sampler.
+
+ \note This function is equivalent to calling sampledTextures() with a
+ \c count of 1.
+
+ \note \a tex and \a sampler can be null. It is valid to create a
+ QRhiShaderResourceBindings with unspecified resources, but such an object
+ cannot be used with QRhiCommandBuffer::setShaderResources(). It is however
+ suitable for creating pipelines. Such a pipeline must then always be used
+ together with another, layout compatible QRhiShaderResourceBindings with
+ resources present passed to QRhiCommandBuffer::setShaderResources().
+
+ \note A shader may not be able to consume more than 16 textures/samplers,
+ depending on the underlying graphics API. This hard limit must be kept in
+ mind in renderer design. This does not apply to texture arrays which
+ consume a single binding point (shader register) and can contain 256-2048
+ textures, depending on the underlying graphics API. Arrays of textures (see
+ sampledTextures()) are however no different in this regard than using the
+ same number of individual textures.
+
+ \sa sampledTextures()
*/
QRhiShaderResourceBinding QRhiShaderResourceBinding::sampledTexture(
int binding, StageFlags stage, QRhiTexture *tex, QRhiSampler *sampler)
@@ -2827,8 +5644,176 @@ QRhiShaderResourceBinding QRhiShaderResourceBinding::sampledTexture(
b.d.binding = binding;
b.d.stage = stage;
b.d.type = SampledTexture;
- b.d.u.stex.tex = tex;
- b.d.u.stex.sampler = sampler;
+ b.d.u.stex.count = 1;
+ b.d.u.stex.texSamplers[0] = { tex, sampler };
+ return b;
+}
+
+/*!
+ \return a shader resource binding for the given binding number, pipeline
+ stages, and the array of texture-sampler pairs specified by \a binding, \a
+ stage, \a count, and \a texSamplers.
+
+ \note \a count must be at least 1, and not larger than 16.
+
+ \note When \a count is 1, this function is equivalent to sampledTexture().
+
+ This function is relevant when arrays of combined image samplers are
+ involved. For example, in GLSL \c{layout(binding = 5) uniform sampler2D
+ shadowMaps[8];} declares an array of combined image samplers. The
+ application is then expected provide a QRhiShaderResourceBinding for
+ binding point 5, set up by calling this function with \a count set to 8 and
+ a valid texture and sampler for each element of the array.
+
+ \warning All elements of the array must be specified. With the above
+ example, the only valid, portable approach is calling this function with a
+ \a count of 8. Additionally, all QRhiTexture and QRhiSampler instances must
+ be valid, meaning nullptr is not an accepted value. This is due to some of
+ the underlying APIs, such as, Vulkan, that require a valid image and
+ sampler object for each element in descriptor arrays. Applications are
+ advised to provide "dummy" samplers and textures if some array elements are
+ not relevant (due to not being accessed in the shader).
+
+ \note \a texSamplers can be null. It is valid to create a
+ QRhiShaderResourceBindings with unspecified resources, but such an object
+ cannot be used with QRhiCommandBuffer::setShaderResources(). It is however
+ suitable for creating pipelines. Such a pipeline must then always be used
+ together with another, layout compatible QRhiShaderResourceBindings with
+ resources present passed to QRhiCommandBuffer::setShaderResources().
+
+ \sa sampledTexture()
+ */
+QRhiShaderResourceBinding QRhiShaderResourceBinding::sampledTextures(
+ int binding, StageFlags stage, int count, const TextureAndSampler *texSamplers)
+{
+ Q_ASSERT(count >= 1 && count <= Data::MAX_TEX_SAMPLER_ARRAY_SIZE);
+ QRhiShaderResourceBinding b;
+ b.d.binding = binding;
+ b.d.stage = stage;
+ b.d.type = SampledTexture;
+ b.d.u.stex.count = count;
+ for (int i = 0; i < count; ++i) {
+ if (texSamplers)
+ b.d.u.stex.texSamplers[i] = texSamplers[i];
+ else
+ b.d.u.stex.texSamplers[i] = { nullptr, nullptr };
+ }
+ return b;
+}
+
+/*!
+ \return a shader resource binding for the given binding number, pipeline
+ stages, and texture specified by \a binding, \a stage, \a tex.
+
+ \note This function is equivalent to calling textures() with a
+ \c count of 1.
+
+ \note \a tex can be null. It is valid to create a
+ QRhiShaderResourceBindings with unspecified resources, but such an object
+ cannot be used with QRhiCommandBuffer::setShaderResources(). It is however
+ suitable for creating pipelines. Such a pipeline must then always be used
+ together with another, layout compatible QRhiShaderResourceBindings with
+ resources present passed to QRhiCommandBuffer::setShaderResources().
+
+ This creates a binding for a separate texture (image) object, whereas
+ sampledTexture() is suitable for combined image samplers. In
+ Vulkan-compatible GLSL code separate textures are declared as \c texture2D
+ as opposed to \c sampler2D: \c{layout(binding = 1) uniform texture2D tex;}
+
+ \note A shader may not be able to consume more than 16 textures, depending
+ on the underlying graphics API. This hard limit must be kept in mind in
+ renderer design. This does not apply to texture arrays which consume a
+ single binding point (shader register) and can contain 256-2048 textures,
+ depending on the underlying graphics API. Arrays of textures (see
+ sampledTextures()) are however no different in this regard than using the
+ same number of individual textures.
+
+ \sa textures(), sampler()
+ */
+QRhiShaderResourceBinding QRhiShaderResourceBinding::texture(int binding, StageFlags stage, QRhiTexture *tex)
+{
+ QRhiShaderResourceBinding b;
+ b.d.binding = binding;
+ b.d.stage = stage;
+ b.d.type = Texture;
+ b.d.u.stex.count = 1;
+ b.d.u.stex.texSamplers[0] = { tex, nullptr };
+ return b;
+}
+
+/*!
+ \return a shader resource binding for the given binding number, pipeline
+ stages, and the array of (separate) textures specified by \a binding, \a
+ stage, \a count, and \a tex.
+
+ \note \a count must be at least 1, and not larger than 16.
+
+ \note When \a count is 1, this function is equivalent to texture().
+
+ \warning All elements of the array must be specified.
+
+ \note \a tex can be null. It is valid to create a
+ QRhiShaderResourceBindings with unspecified resources, but such an object
+ cannot be used with QRhiCommandBuffer::setShaderResources(). It is however
+ suitable for creating pipelines. Such a pipeline must then always be used
+ together with another, layout compatible QRhiShaderResourceBindings with
+ resources present passed to QRhiCommandBuffer::setShaderResources().
+
+ \sa texture(), sampler()
+ */
+QRhiShaderResourceBinding QRhiShaderResourceBinding::textures(int binding, StageFlags stage, int count, QRhiTexture **tex)
+{
+ Q_ASSERT(count >= 1 && count <= Data::MAX_TEX_SAMPLER_ARRAY_SIZE);
+ QRhiShaderResourceBinding b;
+ b.d.binding = binding;
+ b.d.stage = stage;
+ b.d.type = Texture;
+ b.d.u.stex.count = count;
+ for (int i = 0; i < count; ++i) {
+ if (tex)
+ b.d.u.stex.texSamplers[i] = { tex[i], nullptr };
+ else
+ b.d.u.stex.texSamplers[i] = { nullptr, nullptr };
+ }
+ return b;
+}
+
+/*!
+ \return a shader resource binding for the given binding number, pipeline
+ stages, and sampler specified by \a binding, \a stage, \a sampler.
+
+ \note \a sampler can be null. It is valid to create a
+ QRhiShaderResourceBindings with unspecified resources, but such an object
+ cannot be used with QRhiCommandBuffer::setShaderResources(). It is however
+ suitable for creating pipelines. Such a pipeline must then always be used
+ together with another, layout compatible QRhiShaderResourceBindings with
+ resources present passed to QRhiCommandBuffer::setShaderResources().
+
+ Arrays of separate samplers are not supported.
+
+ This creates a binding for a separate sampler object, whereas
+ sampledTexture() is suitable for combined image samplers. In
+ Vulkan-compatible GLSL code separate samplers are declared as \c sampler
+ as opposed to \c sampler2D: \c{layout(binding = 2) uniform sampler samp;}
+
+ With both a \c texture2D and \c sampler present, they can be used together
+ to sample the texture: \c{fragColor = texture(sampler2D(tex, samp),
+ texcoord);}.
+
+ \note A shader may not be able to consume more than 16 samplers, depending
+ on the underlying graphics API. This hard limit must be kept in mind in
+ renderer design.
+
+ \sa texture()
+ */
+QRhiShaderResourceBinding QRhiShaderResourceBinding::sampler(int binding, StageFlags stage, QRhiSampler *sampler)
+{
+ QRhiShaderResourceBinding b;
+ b.d.binding = binding;
+ b.d.stage = stage;
+ b.d.type = Sampler;
+ b.d.u.stex.count = 1;
+ b.d.u.stex.texSamplers[0] = { nullptr, sampler };
return b;
}
@@ -2838,7 +5823,22 @@ QRhiShaderResourceBinding QRhiShaderResourceBinding::sampledTexture(
will have access to all layers of the specified \a level. (so if the texture
is a cubemap, the shader must use imageCube instead of image2D)
- \note \a tex must have been created with QRhiTexture::UsedWithLoadStore.
+ \note When \a tex is not null, it must have been created with
+ QRhiTexture::UsedWithLoadStore.
+
+ \note \a tex can be null. It is valid to create a QRhiShaderResourceBindings
+ with unspecified resources, but such an object cannot be used with
+ QRhiCommandBuffer::setShaderResources(). It is however suitable for creating
+ pipelines. Such a pipeline must then always be used together with another,
+ layout compatible QRhiShaderResourceBindings with resources present passed
+ to QRhiCommandBuffer::setShaderResources().
+
+ \note Image load/store is only guaranteed to be available within a compute
+ pipeline. While some backends may support using these resources in a
+ graphics pipeline as well, this is not universally supported, and even when
+ it is, unexpected problems may arise when it comes to barriers and
+ synchronization. Therefore, avoid using such resources with shaders other
+ than compute.
*/
QRhiShaderResourceBinding QRhiShaderResourceBinding::imageLoad(
int binding, StageFlags stage, QRhiTexture *tex, int level)
@@ -2858,13 +5858,32 @@ QRhiShaderResourceBinding QRhiShaderResourceBinding::imageLoad(
will have access to all layers of the specified \a level. (so if the texture
is a cubemap, the shader must use imageCube instead of image2D)
- \note \a tex must have been created with QRhiTexture::UsedWithLoadStore.
+ \note When \a tex is not null, it must have been created with
+ QRhiTexture::UsedWithLoadStore.
+
+ \note \a tex can be null. It is valid to create a QRhiShaderResourceBindings
+ with unspecified resources, but such an object cannot be used with
+ QRhiCommandBuffer::setShaderResources(). It is however suitable for creating
+ pipelines. Such a pipeline must then always be used together with another,
+ layout compatible QRhiShaderResourceBindings with resources present passed
+ to QRhiCommandBuffer::setShaderResources().
+
+ \note Image load/store is only guaranteed to be available within a compute
+ pipeline. While some backends may support using these resources in a
+ graphics pipeline as well, this is not universally supported, and even when
+ it is, unexpected problems may arise when it comes to barriers and
+ synchronization. Therefore, avoid using such resources with shaders other
+ than compute.
*/
QRhiShaderResourceBinding QRhiShaderResourceBinding::imageStore(
int binding, StageFlags stage, QRhiTexture *tex, int level)
{
- QRhiShaderResourceBinding b = imageLoad(binding, stage, tex, level);
+ QRhiShaderResourceBinding b;
+ b.d.binding = binding;
+ b.d.stage = stage;
b.d.type = ImageStore;
+ b.d.u.simage.tex = tex;
+ b.d.u.simage.level = level;
return b;
}
@@ -2874,13 +5893,32 @@ QRhiShaderResourceBinding QRhiShaderResourceBinding::imageStore(
will have access to all layers of the specified \a level. (so if the texture
is a cubemap, the shader must use imageCube instead of image2D)
- \note \a tex must have been created with QRhiTexture::UsedWithLoadStore.
+ \note When \a tex is not null, it must have been created with
+ QRhiTexture::UsedWithLoadStore.
+
+ \note \a tex can be null. It is valid to create a QRhiShaderResourceBindings
+ with unspecified resources, but such an object cannot be used with
+ QRhiCommandBuffer::setShaderResources(). It is however suitable for creating
+ pipelines. Such a pipeline must then always be used together with another,
+ layout compatible QRhiShaderResourceBindings with resources present passed
+ to QRhiCommandBuffer::setShaderResources().
+
+ \note Image load/store is only guaranteed to be available within a compute
+ pipeline. While some backends may support using these resources in a
+ graphics pipeline as well, this is not universally supported, and even when
+ it is, unexpected problems may arise when it comes to barriers and
+ synchronization. Therefore, avoid using such resources with shaders other
+ than compute.
*/
QRhiShaderResourceBinding QRhiShaderResourceBinding::imageLoadStore(
int binding, StageFlags stage, QRhiTexture *tex, int level)
{
- QRhiShaderResourceBinding b = imageLoad(binding, stage, tex, level);
+ QRhiShaderResourceBinding b;
+ b.d.binding = binding;
+ b.d.stage = stage;
b.d.type = ImageLoadStore;
+ b.d.u.simage.tex = tex;
+ b.d.u.simage.level = level;
return b;
}
@@ -2888,7 +5926,22 @@ QRhiShaderResourceBinding QRhiShaderResourceBinding::imageLoadStore(
\return a shader resource binding for a read-only storage buffer with the
given \a binding number and pipeline \a stage.
- \note \a buf must have been created with QRhiBuffer::StorageBuffer.
+ \note When \a buf is not null, must have been created with
+ QRhiBuffer::StorageBuffer.
+
+ \note \a buf can be null. It is valid to create a
+ QRhiShaderResourceBindings with unspecified resources, but such an object
+ cannot be used with QRhiCommandBuffer::setShaderResources(). It is however
+ suitable for creating pipelines. Such a pipeline must then always be used
+ together with another, layout compatible QRhiShaderResourceBindings with
+ resources present passed to QRhiCommandBuffer::setShaderResources().
+
+ \note Buffer load/store is only guaranteed to be available within a compute
+ pipeline. While some backends may support using these resources in a
+ graphics pipeline as well, this is not universally supported, and even when
+ it is, unexpected problems may arise when it comes to barriers and
+ synchronization. Therefore, avoid using such resources with shaders other
+ than compute.
*/
QRhiShaderResourceBinding QRhiShaderResourceBinding::bufferLoad(
int binding, StageFlags stage, QRhiBuffer *buf)
@@ -2908,13 +5961,32 @@ QRhiShaderResourceBinding QRhiShaderResourceBinding::bufferLoad(
given \a binding number and pipeline \a stage. This overload binds a region
only, as specified by \a offset and \a size.
- \note \a buf must have been created with QRhiBuffer::StorageBuffer.
+ \note When \a buf is not null, must have been created with
+ QRhiBuffer::StorageBuffer.
+
+ \note \a buf can be null. It is valid to create a
+ QRhiShaderResourceBindings with unspecified resources, but such an object
+ cannot be used with QRhiCommandBuffer::setShaderResources(). It is however
+ suitable for creating pipelines. Such a pipeline must then always be used
+ together with another, layout compatible QRhiShaderResourceBindings with
+ resources present passed to QRhiCommandBuffer::setShaderResources().
+
+ \note Buffer load/store is only guaranteed to be available within a compute
+ pipeline. While some backends may support using these resources in a
+ graphics pipeline as well, this is not universally supported, and even when
+ it is, unexpected problems may arise when it comes to barriers and
+ synchronization. Therefore, avoid using such resources with shaders other
+ than compute.
*/
QRhiShaderResourceBinding QRhiShaderResourceBinding::bufferLoad(
- int binding, StageFlags stage, QRhiBuffer *buf, int offset, int size)
+ int binding, StageFlags stage, QRhiBuffer *buf, quint32 offset, quint32 size)
{
Q_ASSERT(size > 0);
- QRhiShaderResourceBinding b = bufferLoad(binding, stage, buf);
+ QRhiShaderResourceBinding b;
+ b.d.binding = binding;
+ b.d.stage = stage;
+ b.d.type = BufferLoad;
+ b.d.u.sbuf.buf = buf;
b.d.u.sbuf.offset = offset;
b.d.u.sbuf.maybeSize = size;
return b;
@@ -2924,13 +5996,33 @@ QRhiShaderResourceBinding QRhiShaderResourceBinding::bufferLoad(
\return a shader resource binding for a write-only storage buffer with the
given \a binding number and pipeline \a stage.
- \note \a buf must have been created with QRhiBuffer::StorageBuffer.
+ \note When \a buf is not null, must have been created with
+ QRhiBuffer::StorageBuffer.
+
+ \note \a buf can be null. It is valid to create a
+ QRhiShaderResourceBindings with unspecified resources, but such an object
+ cannot be used with QRhiCommandBuffer::setShaderResources(). It is however
+ suitable for creating pipelines. Such a pipeline must then always be used
+ together with another, layout compatible QRhiShaderResourceBindings with
+ resources present passed to QRhiCommandBuffer::setShaderResources().
+
+ \note Buffer load/store is only guaranteed to be available within a compute
+ pipeline. While some backends may support using these resources in a
+ graphics pipeline as well, this is not universally supported, and even when
+ it is, unexpected problems may arise when it comes to barriers and
+ synchronization. Therefore, avoid using such resources with shaders other
+ than compute.
*/
QRhiShaderResourceBinding QRhiShaderResourceBinding::bufferStore(
int binding, StageFlags stage, QRhiBuffer *buf)
{
- QRhiShaderResourceBinding b = bufferLoad(binding, stage, buf);
+ QRhiShaderResourceBinding b;
+ b.d.binding = binding;
+ b.d.stage = stage;
b.d.type = BufferStore;
+ b.d.u.sbuf.buf = buf;
+ b.d.u.sbuf.offset = 0;
+ b.d.u.sbuf.maybeSize = 0; // entire buffer
return b;
}
@@ -2939,13 +6031,32 @@ QRhiShaderResourceBinding QRhiShaderResourceBinding::bufferStore(
given \a binding number and pipeline \a stage. This overload binds a region
only, as specified by \a offset and \a size.
- \note \a buf must have been created with QRhiBuffer::StorageBuffer.
+ \note When \a buf is not null, must have been created with
+ QRhiBuffer::StorageBuffer.
+
+ \note \a buf can be null. It is valid to create a
+ QRhiShaderResourceBindings with unspecified resources, but such an object
+ cannot be used with QRhiCommandBuffer::setShaderResources(). It is however
+ suitable for creating pipelines. Such a pipeline must then always be used
+ together with another, layout compatible QRhiShaderResourceBindings with
+ resources present passed to QRhiCommandBuffer::setShaderResources().
+
+ \note Buffer load/store is only guaranteed to be available within a compute
+ pipeline. While some backends may support using these resources in a
+ graphics pipeline as well, this is not universally supported, and even when
+ it is, unexpected problems may arise when it comes to barriers and
+ synchronization. Therefore, avoid using such resources with shaders other
+ than compute.
*/
QRhiShaderResourceBinding QRhiShaderResourceBinding::bufferStore(
- int binding, StageFlags stage, QRhiBuffer *buf, int offset, int size)
+ int binding, StageFlags stage, QRhiBuffer *buf, quint32 offset, quint32 size)
{
Q_ASSERT(size > 0);
- QRhiShaderResourceBinding b = bufferStore(binding, stage, buf);
+ QRhiShaderResourceBinding b;
+ b.d.binding = binding;
+ b.d.stage = stage;
+ b.d.type = BufferStore;
+ b.d.u.sbuf.buf = buf;
b.d.u.sbuf.offset = offset;
b.d.u.sbuf.maybeSize = size;
return b;
@@ -2955,13 +6066,33 @@ QRhiShaderResourceBinding QRhiShaderResourceBinding::bufferStore(
\return a shader resource binding for a read-write storage buffer with the
given \a binding number and pipeline \a stage.
- \note \a buf must have been created with QRhiBuffer::StorageBuffer.
+ \note When \a buf is not null, must have been created with
+ QRhiBuffer::StorageBuffer.
+
+ \note \a buf can be null. It is valid to create a
+ QRhiShaderResourceBindings with unspecified resources, but such an object
+ cannot be used with QRhiCommandBuffer::setShaderResources(). It is however
+ suitable for creating pipelines. Such a pipeline must then always be used
+ together with another, layout compatible QRhiShaderResourceBindings with
+ resources present passed to QRhiCommandBuffer::setShaderResources().
+
+ \note Buffer load/store is only guaranteed to be available within a compute
+ pipeline. While some backends may support using these resources in a
+ graphics pipeline as well, this is not universally supported, and even when
+ it is, unexpected problems may arise when it comes to barriers and
+ synchronization. Therefore, avoid using such resources with shaders other
+ than compute.
*/
QRhiShaderResourceBinding QRhiShaderResourceBinding::bufferLoadStore(
int binding, StageFlags stage, QRhiBuffer *buf)
{
- QRhiShaderResourceBinding b = bufferLoad(binding, stage, buf);
+ QRhiShaderResourceBinding b;
+ b.d.binding = binding;
+ b.d.stage = stage;
b.d.type = BufferLoadStore;
+ b.d.u.sbuf.buf = buf;
+ b.d.u.sbuf.offset = 0;
+ b.d.u.sbuf.maybeSize = 0; // entire buffer
return b;
}
@@ -2970,13 +6101,32 @@ QRhiShaderResourceBinding QRhiShaderResourceBinding::bufferLoadStore(
given \a binding number and pipeline \a stage. This overload binds a region
only, as specified by \a offset and \a size.
- \note \a buf must have been created with QRhiBuffer::StorageBuffer.
+ \note When \a buf is not null, must have been created with
+ QRhiBuffer::StorageBuffer.
+
+ \note \a buf can be null. It is valid to create a
+ QRhiShaderResourceBindings with unspecified resources, but such an object
+ cannot be used with QRhiCommandBuffer::setShaderResources(). It is however
+ suitable for creating pipelines. Such a pipeline must then always be used
+ together with another, layout compatible QRhiShaderResourceBindings with
+ resources present passed to QRhiCommandBuffer::setShaderResources().
+
+ \note Buffer load/store is only guaranteed to be available within a compute
+ pipeline. While some backends may support using these resources in a
+ graphics pipeline as well, this is not universally supported, and even when
+ it is, unexpected problems may arise when it comes to barriers and
+ synchronization. Therefore, avoid using such resources with shaders other
+ than compute.
*/
QRhiShaderResourceBinding QRhiShaderResourceBinding::bufferLoadStore(
- int binding, StageFlags stage, QRhiBuffer *buf, int offset, int size)
+ int binding, StageFlags stage, QRhiBuffer *buf, quint32 offset, quint32 size)
{
Q_ASSERT(size > 0);
- QRhiShaderResourceBinding b = bufferLoadStore(binding, stage, buf);
+ QRhiShaderResourceBinding b;
+ b.d.binding = binding;
+ b.d.stage = stage;
+ b.d.type = BufferLoadStore;
+ b.d.u.sbuf.buf = buf;
b.d.u.sbuf.offset = offset;
b.d.u.sbuf.maybeSize = size;
return b;
@@ -2992,10 +6142,10 @@ QRhiShaderResourceBinding QRhiShaderResourceBinding::bufferLoadStore(
\relates QRhiShaderResourceBinding
*/
-bool operator==(const QRhiShaderResourceBinding &a, const QRhiShaderResourceBinding &b) Q_DECL_NOTHROW
+bool operator==(const QRhiShaderResourceBinding &a, const QRhiShaderResourceBinding &b) noexcept
{
- const QRhiShaderResourceBinding::Data *da = a.data();
- const QRhiShaderResourceBinding::Data *db = b.data();
+ const QRhiShaderResourceBinding::Data *da = QRhiImplementation::shaderResourceBindingData(a);
+ const QRhiShaderResourceBinding::Data *db = QRhiImplementation::shaderResourceBindingData(b);
if (da == db)
return true;
@@ -3018,16 +6168,30 @@ bool operator==(const QRhiShaderResourceBinding &a, const QRhiShaderResourceBind
}
break;
case QRhiShaderResourceBinding::SampledTexture:
- if (da->u.stex.tex != db->u.stex.tex
- || da->u.stex.sampler != db->u.stex.sampler)
- {
+ if (da->u.stex.count != db->u.stex.count)
return false;
+ for (int i = 0; i < da->u.stex.count; ++i) {
+ if (da->u.stex.texSamplers[i].tex != db->u.stex.texSamplers[i].tex
+ || da->u.stex.texSamplers[i].sampler != db->u.stex.texSamplers[i].sampler)
+ {
+ return false;
+ }
}
break;
+ case QRhiShaderResourceBinding::Texture:
+ if (da->u.stex.count != db->u.stex.count)
+ return false;
+ for (int i = 0; i < da->u.stex.count; ++i) {
+ if (da->u.stex.texSamplers[i].tex != db->u.stex.texSamplers[i].tex)
+ return false;
+ }
+ break;
+ case QRhiShaderResourceBinding::Sampler:
+ if (da->u.stex.texSamplers[0].sampler != db->u.stex.texSamplers[0].sampler)
+ return false;
+ break;
case QRhiShaderResourceBinding::ImageLoad:
- Q_FALLTHROUGH();
case QRhiShaderResourceBinding::ImageStore:
- Q_FALLTHROUGH();
case QRhiShaderResourceBinding::ImageLoadStore:
if (da->u.simage.tex != db->u.simage.tex
|| da->u.simage.level != db->u.simage.level)
@@ -3036,9 +6200,7 @@ bool operator==(const QRhiShaderResourceBinding &a, const QRhiShaderResourceBind
}
break;
case QRhiShaderResourceBinding::BufferLoad:
- Q_FALLTHROUGH();
case QRhiShaderResourceBinding::BufferStore:
- Q_FALLTHROUGH();
case QRhiShaderResourceBinding::BufferLoadStore:
if (da->u.sbuf.buf != db->u.sbuf.buf
|| da->u.sbuf.offset != db->u.sbuf.offset
@@ -3048,8 +6210,7 @@ bool operator==(const QRhiShaderResourceBinding &a, const QRhiShaderResourceBind
}
break;
default:
- Q_UNREACHABLE();
- return false;
+ Q_UNREACHABLE_RETURN(false);
}
return true;
@@ -3061,7 +6222,7 @@ bool operator==(const QRhiShaderResourceBinding &a, const QRhiShaderResourceBind
\relates QRhiShaderResourceBinding
*/
-bool operator!=(const QRhiShaderResourceBinding &a, const QRhiShaderResourceBinding &b) Q_DECL_NOTHROW
+bool operator!=(const QRhiShaderResourceBinding &a, const QRhiShaderResourceBinding &b) noexcept
{
return !(a == b);
}
@@ -3071,18 +6232,46 @@ bool operator!=(const QRhiShaderResourceBinding &a, const QRhiShaderResourceBind
\relates QRhiShaderResourceBinding
*/
-uint qHash(const QRhiShaderResourceBinding &b, uint seed) Q_DECL_NOTHROW
+size_t qHash(const QRhiShaderResourceBinding &b, size_t seed) noexcept
{
- const QRhiShaderResourceBinding::Data *d = b.data();
- return seed + uint(d->binding) + 10 * uint(d->stage) + 100 * uint(d->type)
- + qHashBits(&d->u, sizeof(d->u), seed);
+ const QRhiShaderResourceBinding::Data *d = QRhiImplementation::shaderResourceBindingData(b);
+ QtPrivate::QHashCombine hash;
+ seed = hash(seed, d->binding);
+ seed = hash(seed, d->stage);
+ seed = hash(seed, d->type);
+ switch (d->type) {
+ case QRhiShaderResourceBinding::UniformBuffer:
+ seed = hash(seed, reinterpret_cast<quintptr>(d->u.ubuf.buf));
+ break;
+ case QRhiShaderResourceBinding::SampledTexture:
+ seed = hash(seed, reinterpret_cast<quintptr>(d->u.stex.texSamplers[0].tex));
+ seed = hash(seed, reinterpret_cast<quintptr>(d->u.stex.texSamplers[0].sampler));
+ break;
+ case QRhiShaderResourceBinding::Texture:
+ seed = hash(seed, reinterpret_cast<quintptr>(d->u.stex.texSamplers[0].tex));
+ break;
+ case QRhiShaderResourceBinding::Sampler:
+ seed = hash(seed, reinterpret_cast<quintptr>(d->u.stex.texSamplers[0].sampler));
+ break;
+ case QRhiShaderResourceBinding::ImageLoad:
+ case QRhiShaderResourceBinding::ImageStore:
+ case QRhiShaderResourceBinding::ImageLoadStore:
+ seed = hash(seed, reinterpret_cast<quintptr>(d->u.simage.tex));
+ break;
+ case QRhiShaderResourceBinding::BufferLoad:
+ case QRhiShaderResourceBinding::BufferStore:
+ case QRhiShaderResourceBinding::BufferLoadStore:
+ seed = hash(seed, reinterpret_cast<quintptr>(d->u.sbuf.buf));
+ break;
+ }
+ return seed;
}
#ifndef QT_NO_DEBUG_STREAM
QDebug operator<<(QDebug dbg, const QRhiShaderResourceBinding &b)
{
QDebugStateSaver saver(dbg);
- const QRhiShaderResourceBinding::Data *d = b.data();
+ const QRhiShaderResourceBinding::Data *d = QRhiImplementation::shaderResourceBindingData(b);
dbg.nospace() << "QRhiShaderResourceBinding("
<< "binding=" << d->binding
<< " stage=" << d->stage
@@ -3096,9 +6285,24 @@ QDebug operator<<(QDebug dbg, const QRhiShaderResourceBinding &b)
<< ')';
break;
case QRhiShaderResourceBinding::SampledTexture:
- dbg.nospace() << " SampledTexture("
- << "texture=" << d->u.stex.tex
- << " sampler=" << d->u.stex.sampler
+ dbg.nospace() << " SampledTextures("
+ << "count=" << d->u.stex.count;
+ for (int i = 0; i < d->u.stex.count; ++i) {
+ dbg.nospace() << " texture=" << d->u.stex.texSamplers[i].tex
+ << " sampler=" << d->u.stex.texSamplers[i].sampler;
+ }
+ dbg.nospace() << ')';
+ break;
+ case QRhiShaderResourceBinding::Texture:
+ dbg.nospace() << " Textures("
+ << "count=" << d->u.stex.count;
+ for (int i = 0; i < d->u.stex.count; ++i)
+ dbg.nospace() << " texture=" << d->u.stex.texSamplers[i].tex;
+ dbg.nospace() << ')';
+ break;
+ case QRhiShaderResourceBinding::Sampler:
+ dbg.nospace() << " Sampler("
+ << " sampler=" << d->u.stex.texSamplers[0].sampler
<< ')';
break;
case QRhiShaderResourceBinding::ImageLoad:
@@ -3141,7 +6345,7 @@ QDebug operator<<(QDebug dbg, const QRhiShaderResourceBinding &b)
<< ')';
break;
default:
- Q_UNREACHABLE();
+ dbg.nospace() << " UNKNOWN()";
break;
}
dbg.nospace() << ')';
@@ -3162,17 +6366,44 @@ QDebug operator<<(QDebug dbg, const QRhiShaderResourceBindings &srb)
/*!
\class QRhiGraphicsPipeline
- \internal
\inmodule QtGui
+ \since 6.6
\brief Graphics pipeline state resource.
+ Represents a graphics pipeline. What exactly this map to in the underlying
+ native graphics API, varies. Where there is a concept of pipeline objects,
+ for example with Vulkan, the QRhi backend will create such an object upon
+ calling create(). Elsewhere, for example with OpenGL, the
+ QRhiGraphicsPipeline may merely collect the various state, and create()'s
+ main task is to set up the corresponding shader program, but deferring
+ looking at any of the requested state to a later point.
+
+ As with all QRhiResource subclasses, the two-phased initialization pattern
+ applies: setting any values via the setters, for example setDepthTest(), is
+ only effective after calling create(). Avoid changing any values once the
+ QRhiGraphicsPipeline has been initialized via create(). To change some
+ state, set the new value and call create() again. However, that will
+ effectively release all underlying native resources and create new ones. As
+ a result, it may be a heavy, expensive operation. Rather, prefer creating
+ multiple pipelines with the different states, and
+ \l{QRhiCommandBuffer::setGraphicsPipeline()}{switch between them} when
+ recording the render pass.
+
\note Setting the shader stages is mandatory. There must be at least one
stage, and there must be a vertex stage.
\note Setting the shader resource bindings is mandatory. The referenced
- QRhiShaderResourceBindings must already be built by the time build() is
- called. Associating with a QRhiShaderResourceBindings that has no bindings
- is also valid, as long as no shader in any stage expects any resources.
+ QRhiShaderResourceBindings must already have create() called on it by the
+ time create() is called. Associating with a QRhiShaderResourceBindings that
+ has no bindings is also valid, as long as no shader in any stage expects any
+ resources. Using a QRhiShaderResourceBindings object that does not specify
+ any actual resources (i.e., the buffers, textures, etc. for the binding
+ points are set to \nullptr) is valid as well, as long as a
+ \l{QRhiShaderResourceBindings::isLayoutCompatible()}{layout-compatible}
+ QRhiShaderResourceBindings, that specifies resources for all the bindings,
+ is going to be set via
+ \l{QRhiCommandBuffer::setShaderResources()}{setShaderResources()} when
+ recording the render pass.
\note Setting the render pass descriptor is mandatory. To obtain a
QRhiRenderPassDescriptor that can be passed to setRenderPassDescriptor(),
@@ -3185,26 +6416,56 @@ QDebug operator<<(QDebug dbg, const QRhiShaderResourceBindings &srb)
render target's color and depth stencil attachments.
\note The depth test, depth write, and stencil test are disabled by
- default.
+ default. The face culling mode defaults to no culling.
\note stencilReadMask() and stencilWriteMask() apply to both faces. They
both default to 0xFF.
- */
-/*!
- \fn void QRhiGraphicsPipeline::setTargetBlends(const QVector<TargetBlend> &blends)
+ \section2 Example usage
- Sets the blend specification for color attachments. Each element in \a
- blends corresponds to a color attachment of the render target.
+ All settings of a graphics pipeline have defaults which might be suitable
+ to many applications. Therefore a minimal example of creating a graphics
+ pipeline could be the following. This assumes that the vertex shader takes
+ a single \c{vec3 position} input at the input location 0. With the
+ QRhiShaderResourceBindings and QRhiRenderPassDescriptor objects, plus the
+ QShader collections for the vertex and fragment stages, a pipeline could be
+ created like this:
- By default no blends are set, which is a shortcut to disabling blending and
- enabling color write for all four channels.
+ \code
+ QRhiShaderResourceBindings *srb;
+ QRhiRenderPassDescriptor *rpDesc;
+ QShader vs, fs;
+ // ...
+
+ QRhiVertexInputLayout inputLayout;
+ inputLayout.setBindings({ { 3 * sizeof(float) } });
+ inputLayout.setAttributes({ { 0, 0, QRhiVertexInputAttribute::Float3, 0 } });
+
+ QRhiGraphicsPipeline *ps = rhi->newGraphicsPipeline();
+ ps->setShaderStages({ { QRhiShaderStage::Vertex, vs }, { QRhiShaderStage::Fragment, fs } });
+ ps->setVertexInputLayout(inputLayout);
+ ps->setShaderResourceBindings(srb);
+ ps->setRenderPassDescriptor(rpDesc);
+ if (!ps->create()) { error(); }
+ \endcode
+
+ The above code creates a pipeline object that uses the defaults for many
+ settings and states. For example, it will use a \l Triangles topology, no
+ backface culling, blending is disabled but color write is enabled for all
+ four channels, depth test/write are disabled, stencil operations are
+ disabled.
+
+ \note This is a RHI API with limited compatibility guarantees, see \l QRhi
+ for details.
+
+ \sa QRhiCommandBuffer, QRhi
*/
/*!
\enum QRhiGraphicsPipeline::Flag
- Flag values for describing the dynamic state of the pipeline. The viewport is always dynamic.
+ Flag values for describing the dynamic state of the pipeline, and other
+ options. The viewport is always dynamic.
\value UsesBlendConstants Indicates that a blend color constant will be set
via QRhiCommandBuffer::setBlendConstants()
@@ -3214,6 +6475,22 @@ QDebug operator<<(QDebug dbg, const QRhiShaderResourceBindings &srb)
\value UsesScissor Indicates that a scissor rectangle will be set via
QRhiCommandBuffer::setScissor()
+
+ \value CompileShadersWithDebugInfo Requests compiling shaders with debug
+ information enabled. This is relevant only when runtime shader compilation
+ from source code is involved, and only when the underlying infrastructure
+ supports this. With concrete examples, this is not relevant with Vulkan and
+ SPIR-V, because the GLSL-to-SPIR-V compilation does not happen at run
+ time. On the other hand, consider Direct3D and HLSL, where there are
+ multiple options: when the QShader packages ship with pre-compiled bytecode
+ (\c DXBC), debug information is to be requested through the tool that
+ generates the \c{.qsb} file, similarly to the case of Vulkan and
+ SPIR-V. However, when having HLSL source code in the pre- or
+ runtime-generated QShader packages, the first phase of compilation (HLSL
+ source to intermediate format) happens at run time too, with this flag taken
+ into account. Debug information is relevant in particular with tools like
+ RenderDoc since it allows seeing the original source code when investigating
+ the pipeline and when performing vertex or fragment shader debugging.
*/
/*!
@@ -3226,6 +6503,9 @@ QDebug operator<<(QDebug dbg, const QRhiShaderResourceBindings &srb)
\value Lines
\value LineStrip
\value Points
+
+ \value Patches (only available if QRhi::Tessellation is supported, and
+ requires the tessellation stages to be present in the pipeline)
*/
/*!
@@ -3320,21 +6600,102 @@ QDebug operator<<(QDebug dbg, const QRhiShaderResourceBindings &srb)
*/
/*!
- \class QRhiGraphicsPipeline::TargetBlend
- \internal
+ \enum QRhiGraphicsPipeline::PolygonMode
+ \brief Specifies the polygon rasterization mode
+
+ Polygon Mode (Triangle Fill Mode in Metal, Fill Mode in D3D) specifies
+ the fill mode used when rasterizing polygons. Polygons may be drawn as
+ solids (Fill), or as a wire mesh (Line).
+
+ Support for non-fill polygon modes is optional and is indicated by the
+ QRhi::NonFillPolygonMode feature. With OpenGL ES and some Vulkan
+ implementations the feature will likely be reported as unsupported, which
+ then means values other than Fill cannot be used.
+
+ \value Fill The interior of the polygon is filled (default)
+ \value Line Boundary edges of the polygon are drawn as line segments.
+ */
+
+/*!
+ \struct QRhiGraphicsPipeline::TargetBlend
\inmodule QtGui
+ \since 6.6
\brief Describes the blend state for one color attachment.
Defaults to color write enabled, blending disabled. The blend values are
set up for pre-multiplied alpha (One, OneMinusSrcAlpha, One,
- OneMinusSrcAlpha) by default.
+ OneMinusSrcAlpha) by default. This means that to get the alpha blending
+ mode Qt Quick uses, it is enough to set the \c enable flag to true while
+ leaving other values at their defaults.
+
+ \note This is a RHI API with limited compatibility guarantees, see \l QRhi
+ for details.
*/
/*!
- \class QRhiGraphicsPipeline::StencilOpState
- \internal
+ \variable QRhiGraphicsPipeline::TargetBlend::colorWrite
+ */
+
+/*!
+ \variable QRhiGraphicsPipeline::TargetBlend::enable
+ */
+
+/*!
+ \variable QRhiGraphicsPipeline::TargetBlend::srcColor
+ */
+
+/*!
+ \variable QRhiGraphicsPipeline::TargetBlend::dstColor
+ */
+
+/*!
+ \variable QRhiGraphicsPipeline::TargetBlend::opColor
+ */
+
+/*!
+ \variable QRhiGraphicsPipeline::TargetBlend::srcAlpha
+ */
+
+/*!
+ \variable QRhiGraphicsPipeline::TargetBlend::dstAlpha
+ */
+
+/*!
+ \variable QRhiGraphicsPipeline::TargetBlend::opAlpha
+ */
+
+/*!
+ \struct QRhiGraphicsPipeline::StencilOpState
\inmodule QtGui
+ \since 6.6
\brief Describes the stencil operation state.
+
+ The default-constructed StencilOpState has the following set:
+ \list
+ \li failOp - \l Keep
+ \li depthFailOp - \l Keep
+ \li passOp - \l Keep
+ \li compareOp \l Always
+ \endlist
+
+ \note This is a RHI API with limited compatibility guarantees, see \l QRhi
+ for details.
+ */
+
+/*!
+ \variable QRhiGraphicsPipeline::StencilOpState::failOp
+ */
+
+/*!
+ \variable QRhiGraphicsPipeline::StencilOpState::depthFailOp
+ */
+
+/*!
+ \variable QRhiGraphicsPipeline::StencilOpState::passOp
+ */
+
+/*!
+ \variable QRhiGraphicsPipeline::StencilOpState::compareOp
*/
/*!
@@ -3354,31 +6715,140 @@ QRhiResource::Type QRhiGraphicsPipeline::resourceType() const
}
/*!
- \fn bool QRhiGraphicsPipeline::build()
+ \fn virtual bool QRhiGraphicsPipeline::create() = 0
Creates the corresponding native graphics resources. If there are already
- resources present due to an earlier build() with no corresponding
- release(), then release() is called implicitly first.
+ resources present due to an earlier create() with no corresponding
+ destroy(), then destroy() is called implicitly first.
\return \c true when successful, \c false when a graphics operation failed.
- Regardless of the return value, calling release() is always safe.
+ Regardless of the return value, calling destroy() is always safe.
+
+ \note This may be, depending on the underlying graphics API, an expensive
+ operation, especially when shaders get compiled/optimized from source or
+ from an intermediate bytecode format to the GPU's own instruction set.
+ Where applicable, the QRhi backend automatically sets up the relevant
+ non-persistent facilities to accelerate this, for example the Vulkan
+ backend automatically creates a \c VkPipelineCache to improve data reuse
+ during the lifetime of the application.
+
+ \note Drivers may also employ various persistent (disk-based) caching
+ strategies for shader and pipeline data, which is hidden to and is outside
+ of Qt's control. In some cases, depending on the graphics API and the QRhi
+ backend, there are facilities within QRhi for manually managing such a
+ cache, allowing the retrieval of a serializable blob that can then be
+ reloaded in the future runs of the application to ensure faster pipeline
+ creation times. See QRhi::pipelineCacheData() and
+ QRhi::setPipelineCacheData() for details. Note also that when working with
+ a QRhi instance managed by a higher level Qt framework, such as Qt Quick,
+ it is possible that such disk-based caching is taken care of automatically,
+ for example QQuickWindow uses a disk-based pipeline cache by default (which
+ comes in addition to any driver-level caching).
+ */
+
+/*!
+ \fn QRhiGraphicsPipeline::Flags QRhiGraphicsPipeline::flags() const
+ \return the currently set flags.
+ */
+
+/*!
+ \fn void QRhiGraphicsPipeline::setFlags(Flags f)
+ Sets the flags \a f.
+ */
+
+/*!
+ \fn QRhiGraphicsPipeline::Topology QRhiGraphicsPipeline::topology() const
+ \return the currently set primitive topology.
+ */
+
+/*!
+ \fn void QRhiGraphicsPipeline::setTopology(Topology t)
+ Sets the primitive topology \a t.
+ */
+
+/*!
+ \fn QRhiGraphicsPipeline::CullMode QRhiGraphicsPipeline::cullMode() const
+ \return the currently set face culling mode.
+ */
+
+/*!
+ \fn void QRhiGraphicsPipeline::setCullMode(CullMode mode)
+ Sets the specified face culling \a mode.
+ */
+
+/*!
+ \fn QRhiGraphicsPipeline::FrontFace QRhiGraphicsPipeline::frontFace() const
+ \return the currently set front face mode.
+ */
+
+/*!
+ \fn void QRhiGraphicsPipeline::setFrontFace(FrontFace f)
+ Sets the front face mode \a f.
+ */
+
+/*!
+ \fn void QRhiGraphicsPipeline::setTargetBlends(std::initializer_list<TargetBlend> list)
+
+ Sets the \a list of render target blend settings. This is a list because
+ when multiple render targets are used (i.e., a QRhiTextureRenderTarget with
+ more than one QRhiColorAttachment), there needs to be a TargetBlend
+ structure per render target (color attachment).
+
+ By default there is one default-constructed TargetBlend set.
+
+ \sa QRhi::MaxColorAttachments
+ */
+
+/*!
+ \fn template<typename InputIterator> void QRhiGraphicsPipeline::setTargetBlends(InputIterator first, InputIterator last)
+ Sets the list of render target blend settings from the iterators \a first and \a last.
+ */
+
+/*!
+ \fn const QRhiGraphicsPipeline::TargetBlend *QRhiGraphicsPipeline::cbeginTargetBlends() const
+ \return a const iterator pointing to the first item in the render target blend setting list.
+ */
+
+/*!
+ \fn const QRhiGraphicsPipeline::TargetBlend *QRhiGraphicsPipeline::cendTargetBlends() const
+ \return a const iterator pointing just after the last item in the render target blend setting list.
+ */
+
+/*!
+ \fn const QRhiGraphicsPipeline::TargetBlend *QRhiGraphicsPipeline::targetBlendAt(qsizetype index) const
+ \return the render target blend setting at the specified \a index.
+ */
+
+/*!
+ \fn qsizetype QRhiGraphicsPipeline::targetBlendCount() const
+ \return the number of render target blend settings.
+ */
+
+/*!
+ \fn bool QRhiGraphicsPipeline::hasDepthTest() const
+ \return true if depth testing is enabled.
*/
/*!
\fn void QRhiGraphicsPipeline::setDepthTest(bool enable)
- Enables or disables depth testing. Both depth test and the writing out of
- depth data are disabled by default.
+ Enables or disables depth testing based on \a enable. Both depth test and
+ the writing out of depth data are disabled by default.
\sa setDepthWrite()
*/
/*!
+ \fn bool QRhiGraphicsPipeline::hasDepthWrite() const
+ \return true if depth write is enabled.
+ */
+
+/*!
\fn void QRhiGraphicsPipeline::setDepthWrite(bool enable)
- Controls the writing out of depth data into the depth buffer. By default
- this is disabled. Depth write is typically enabled together with the depth
- test.
+ Controls the writing out of depth data into the depth buffer based on
+ \a enable. By default this is disabled. Depth write is typically enabled
+ together with the depth test.
\note Enabling depth write without having depth testing enabled may not
lead to the desired result, and should be avoided.
@@ -3387,9 +6857,233 @@ QRhiResource::Type QRhiGraphicsPipeline::resourceType() const
*/
/*!
+ \fn QRhiGraphicsPipeline::CompareOp QRhiGraphicsPipeline::depthOp() const
+ \return the depth comparison function.
+ */
+
+/*!
+ \fn void QRhiGraphicsPipeline::setDepthOp(CompareOp op)
+ Sets the depth comparison function \a op.
+ */
+
+/*!
+ \fn bool QRhiGraphicsPipeline::hasStencilTest() const
+ \return true if stencil testing is enabled.
+ */
+
+/*!
+ \fn void QRhiGraphicsPipeline::setStencilTest(bool enable)
+ Enables or disables stencil tests based on \a enable.
+ By default this is disabled.
+ */
+
+/*!
+ \fn QRhiGraphicsPipeline::StencilOpState QRhiGraphicsPipeline::stencilFront() const
+ \return the current stencil test state for front faces.
+ */
+
+/*!
+ \fn void QRhiGraphicsPipeline::setStencilFront(const StencilOpState &state)
+ Sets the stencil test \a state for front faces.
+ */
+
+/*!
+ \fn QRhiGraphicsPipeline::StencilOpState QRhiGraphicsPipeline::stencilBack() const
+ \return the current stencil test state for back faces.
+ */
+
+/*!
+ \fn void QRhiGraphicsPipeline::setStencilBack(const StencilOpState &state)
+ Sets the stencil test \a state for back faces.
+ */
+
+/*!
+ \fn quint32 QRhiGraphicsPipeline::stencilReadMask() const
+ \return the currrent stencil read mask.
+ */
+
+/*!
+ \fn void QRhiGraphicsPipeline::setStencilReadMask(quint32 mask)
+ Sets the stencil read \a mask. The default value is 0xFF.
+ */
+
+/*!
+ \fn quint32 QRhiGraphicsPipeline::stencilWriteMask() const
+ \return the current stencil write mask.
+ */
+
+/*!
+ \fn void QRhiGraphicsPipeline::setStencilWriteMask(quint32 mask)
+ Sets the stencil write \a mask. The default value is 0xFF.
+ */
+
+/*!
+ \fn int QRhiGraphicsPipeline::sampleCount() const
+ \return the currently set sample count. 1 means no multisample antialiasing.
+ */
+
+/*!
+ \fn void QRhiGraphicsPipeline::setSampleCount(int s)
+
+ Sets the sample count. Typical values for \a s are 1, 4, or 8. The pipeline
+ must always be compatible with the render target, i.e. the sample counts
+ must match.
+
+ \sa QRhi::supportedSampleCounts()
+ */
+
+/*!
+ \fn float QRhiGraphicsPipeline::lineWidth() const
+ \return the currently set line width. The default is 1.0f.
+ */
+
+/*!
+ \fn void QRhiGraphicsPipeline::setLineWidth(float width)
+
+ Sets the line \a width. If the QRhi::WideLines feature is reported as
+ unsupported at runtime, values other than 1.0f are ignored.
+ */
+
+/*!
+ \fn int QRhiGraphicsPipeline::depthBias() const
+ \return the currently set depth bias.
+ */
+
+/*!
+ \fn void QRhiGraphicsPipeline::setDepthBias(int bias)
+ Sets the depth \a bias. The default value is 0.
+ */
+
+/*!
+ \fn float QRhiGraphicsPipeline::slopeScaledDepthBias() const
+ \return the currently set slope scaled depth bias.
+ */
+
+/*!
+ \fn void QRhiGraphicsPipeline::setSlopeScaledDepthBias(float bias)
+ Sets the slope scaled depth \a bias. The default value is 0.
+ */
+
+/*!
+ \fn void QRhiGraphicsPipeline::setShaderStages(std::initializer_list<QRhiShaderStage> list)
+ Sets the \a list of shader stages.
+ */
+
+/*!
+ \fn template<typename InputIterator> void QRhiGraphicsPipeline::setShaderStages(InputIterator first, InputIterator last)
+ Sets the list of shader stages from the iterators \a first and \a last.
+ */
+
+/*!
+ \fn const QRhiShaderStage *QRhiGraphicsPipeline::cbeginShaderStages() const
+ \return a const iterator pointing to the first item in the shader stage list.
+ */
+
+/*!
+ \fn const QRhiShaderStage *QRhiGraphicsPipeline::cendShaderStages() const
+ \return a const iterator pointing just after the last item in the shader stage list.
+ */
+
+/*!
+ \fn const QRhiShaderStage *QRhiGraphicsPipeline::shaderStageAt(qsizetype index) const
+ \return the shader stage at the specified \a index.
+ */
+
+/*!
+ \fn qsizetype QRhiGraphicsPipeline::shaderStageCount() const
+ \return the number of shader stages in this pipeline.
+ */
+
+/*!
+ \fn QRhiVertexInputLayout QRhiGraphicsPipeline::vertexInputLayout() const
+ \return the currently set vertex input layout specification.
+ */
+
+/*!
+ \fn void QRhiGraphicsPipeline::setVertexInputLayout(const QRhiVertexInputLayout &layout)
+ Specifies the vertex input \a layout.
+ */
+
+/*!
+ \fn QRhiShaderResourceBindings *QRhiGraphicsPipeline::shaderResourceBindings() const
+ \return the currently associated QRhiShaderResourceBindings object.
+ */
+
+/*!
+ \fn void QRhiGraphicsPipeline::setShaderResourceBindings(QRhiShaderResourceBindings *srb)
+
+ Associates with \a srb describing the resource binding layout and the
+ resources (QRhiBuffer, QRhiTexture) themselves. The latter is optional,
+ because only the layout matters during pipeline creation. Therefore, the \a
+ srb passed in here can leave the actual buffer or texture objects
+ unspecified (\nullptr) as long as there is another,
+ \l{QRhiShaderResourceBindings::isLayoutCompatible()}{layout-compatible}
+ QRhiShaderResourceBindings bound via
+ \l{QRhiCommandBuffer::setShaderResources()}{setShaderResources()} before
+ recording the draw calls.
+ */
+
+/*!
+ \fn QRhiRenderPassDescriptor *QRhiGraphicsPipeline::renderPassDescriptor() const
+ \return the currently set QRhiRenderPassDescriptor.
+ */
+
+/*!
+ \fn void QRhiGraphicsPipeline::setRenderPassDescriptor(QRhiRenderPassDescriptor *desc)
+ Associates with the specified QRhiRenderPassDescriptor \a desc.
+ */
+
+/*!
+ \fn int QRhiGraphicsPipeline::patchControlPointCount() const
+ \return the currently set patch control point count.
+ */
+
+/*!
+ \fn void QRhiGraphicsPipeline::setPatchControlPointCount(int count)
+
+ Sets the number of patch control points to \a count. The default value is
+ 3. This is used only when the topology is set to \l Patches.
+ */
+
+/*!
+ \fn QRhiGraphicsPipeline::PolygonMode QRhiGraphicsPipeline::polygonMode() const
+ \return the polygon mode.
+ */
+
+/*!
+ \fn void QRhiGraphicsPipeline::setPolygonMode(PolygonMode mode)
+ Sets the polygon \a mode. The default is Fill.
+
+ \sa QRhi::NonFillPolygonMode
+ */
+
+/*!
+ \fn int QRhiGraphicsPipeline::multiViewCount() const
+ \return the view count. The default is 0, indicating no multiview rendering.
+ \since 6.7
+ */
+
+/*!
+ \fn void QRhiGraphicsPipeline::setMultiViewCount(int count)
+ Sets the view \a count for multiview rendering. The default is 0,
+ indicating no multiview rendering.
+ \a count must be 2 or larger to trigger multiview rendering.
+
+ Multiview is only available when the \l{QRhi::MultiView}{MultiView feature}
+ is reported as supported. The render target must be a 2D texture array, and
+ the color attachment for the render target must have the same \a count set.
+
+ See QRhiColorAttachment::setMultiViewCount() for further details on
+ multiview rendering.
+
+ \since 6.7
+ \sa QRhi::MultiView, QRhiColorAttachment::setMultiViewCount()
+ */
+
+/*!
\class QRhiSwapChain
- \internal
\inmodule QtGui
+ \since 6.6
\brief Swapchain resource.
A swapchain enables presenting rendering results to a surface. A swapchain
@@ -3399,7 +7093,7 @@ QRhiResource::Type QRhiGraphicsPipeline::resourceType() const
Below is a typical pattern for creating and managing a swapchain and some
associated resources in order to render onto a QWindow:
- \badcode
+ \code
void init()
{
sc = rhi->newSwapChain();
@@ -3416,7 +7110,7 @@ QRhiResource::Type QRhiGraphicsPipeline::resourceType() const
void resizeSwapChain()
{
- hasSwapChain = sc->buildOrResize();
+ hasSwapChain = sc->createOrResize();
}
void render()
@@ -3445,11 +7139,11 @@ QRhiResource::Type QRhiGraphicsPipeline::resourceType() const
Releasing the swapchain must happen while the QWindow and the underlying
native window is fully up and running. Building on the previous example:
- \badcode
+ \code
void releaseSwapChain()
{
if (hasSwapChain) {
- sc->release();
+ sc->destroy();
hasSwapChain = false;
}
}
@@ -3477,7 +7171,7 @@ QRhiResource::Type QRhiGraphicsPipeline::resourceType() const
events. QExposeEvent is a loosely specified event that is sent whenever a
window gets mapped, obscured, and resized, depending on the platform.
- \badcode
+ \code
void Window::exposeEvent(QExposeEvent *)
{
// initialize and start rendering when the window becomes usable for graphics purposes
@@ -3523,6 +7217,9 @@ QRhiResource::Type QRhiGraphicsPipeline::resourceType() const
command at the end of a frame. For OpenGL, it is necessary to request the
appropriate sample count also via QSurfaceFormat, by calling
QSurfaceFormat::setDefaultFormat() before initializing the QRhi.
+
+ \note This is a RHI API with limited compatibility guarantees, see \l QRhi
+ for details.
*/
/*!
@@ -3543,14 +7240,15 @@ QRhiResource::Type QRhiGraphicsPipeline::resourceType() const
with premultiplied alpha. In that case the behavior with this flag set is
expected to be equivalent to SurfaceHasPreMulAlpha.
- \value sRGB Requests to pick an sRGB format for the swapchain and/or its
- render target views, where applicable. Note that this implies that sRGB
- framebuffer update and blending will get enabled for all content targeting
- this swapchain, and opting out is not possible. For OpenGL, set
- \l{QSurfaceFormat::sRGBColorSpace}{sRGBColorSpace} on the QSurfaceFormat of
- the QWindow in addition.
+ \value sRGB Requests to pick an sRGB format for the swapchain's color
+ buffers and/or render target views, where applicable. Note that this
+ implies that sRGB framebuffer update and blending will get enabled for all
+ content targeting this swapchain, and opting out is not possible. For
+ OpenGL, set \l{QSurfaceFormat::sRGBColorSpace}{sRGBColorSpace} on the
+ QSurfaceFormat of the QWindow in addition. Applicable only when the
+ swapchain format is set to QRhiSwapChain::SDR.
- \value UsedAsTransferSource Indicates the the swapchain will be used as the
+ \value UsedAsTransferSource Indicates the swapchain will be used as the
source of a readback in QRhiResourceUpdateBatch::readBackTexture().
\value NoVSync Requests disabling waiting for vertical sync, also avoiding
@@ -3577,6 +7275,39 @@ QRhiResource::Type QRhiGraphicsPipeline::resourceType() const
*/
/*!
+ \enum QRhiSwapChain::Format
+ Describes the swapchain format. The default format is SDR.
+
+ This enum is used with
+ \l{QRhiSwapChain::isFormatSupported()}{isFormatSupported()} to check
+ upfront if creating the swapchain with the given format is supported by the
+ platform and the window's associated screen, and with
+ \l{QRhiSwapChain::setFormat()}{setFormat()}
+ to set the requested format in the swapchain before calling
+ \l{QRhiSwapChain::createOrResize()}{createOrResize()} for the first time.
+
+ \value SDR 8-bit RGBA or BGRA, depending on the backend and platform. With
+ OpenGL ES in particular, it could happen that the platform provides less
+ than 8 bits (e.g. due to EGL and the QSurfaceFormat choosing a 565 or 444
+ format - this is outside the control of QRhi). Standard dynamic range. May
+ be combined with setting the QRhiSwapChain::sRGB flag.
+
+ \value HDRExtendedSrgbLinear 16-bit float RGBA, high dynamic range,
+ extended linear sRGB (scRGB) color space. This involves Rec. 709 primaries
+ (same as SDR/sRGB) and linear colors. Conversion to the display's native
+ color space (such as, HDR10) is performed by the windowing system. On
+ Windows this is the canonical color space of the system compositor, and is
+ the recommended format for HDR swapchains in general on desktop platforms.
+
+ \value HDR10 10-bit unsigned int RGB or BGR with 2 bit alpha, high dynamic
+ range, HDR10 (Rec. 2020) color space with an ST2084 PQ transfer function.
+
+ \value HDRExtendedDisplayP3Linear 16-bit float RGBA, high dynamic range,
+ extended linear Display P3 color space. The primary choice for HDR on
+ platforms such as iOS and VisionOS.
+ */
+
+/*!
\internal
*/
QRhiSwapChain::QRhiSwapChain(QRhiImplementation *rhi)
@@ -3596,7 +7327,7 @@ QRhiResource::Type QRhiSwapChain::resourceType() const
\fn QSize QRhiSwapChain::currentPixelSize() const
\return the size with which the swapchain was last successfully built. Use
- this to decide if buildOrResize() needs to be called again: if
+ this to decide if createOrResize() needs to be called again: if
\c{currentPixelSize() != surfacePixelSize()} then the swapchain needs to be
resized.
@@ -3619,7 +7350,7 @@ QRhiResource::Type QRhiSwapChain::resourceType() const
*/
/*!
- \fn QSize QRhiSwapChain::surfacePixelSize()
+ \fn virtual QSize QRhiSwapChain::surfacePixelSize() = 0
\return The size of the window's associated surface or layer.
@@ -3627,20 +7358,20 @@ QRhiResource::Type QRhiSwapChain::resourceType() const
QWindow::devicePixelRatio()}. With some graphics APIs and windowing system
interfaces (for example, Vulkan) there is a theoretical possibility for a
surface to assume a size different from the associated window. To support
- these cases, rendering logic must always base size-derived calculations
+ these cases, \b{rendering logic must always base size-derived calculations
(such as, viewports) on the size reported from QRhiSwapChain, and never on
- the size queried from QWindow.
+ the size queried from QWindow}.
- \note Can also be called before buildOrResize(), if at least window() is
- already set) This in combination with currentPixelSize() allows to detect
- when a swapchain needs to be resized. However, watch out for the fact that
+ \note \b{Can also be called before createOrResize(), if at least window() is
+ already set. This in combination with currentPixelSize() allows to detect
+ when a swapchain needs to be resized.} However, watch out for the fact that
the size of the underlying native object (surface, layer, or similar) is
"live", so whenever this function is called, it returns the latest value
reported by the underlying implementation, without any atomicity guarantee.
Therefore, using this function to determine pixel sizes for graphics
resources that are used in a frame is strongly discouraged. Rely on
currentPixelSize() instead which returns a size that is atomic and will not
- change between buildOrResize() invocations.
+ change between createOrResize() invocations.
\note For depth-stencil buffers used in combination with the swapchain's
color buffers, it is strongly recommended to rely on the automatic sizing
@@ -3654,20 +7385,61 @@ QRhiResource::Type QRhiSwapChain::resourceType() const
*/
/*!
- \fn QRhiCommandBuffer *QRhiSwapChain::currentFrameCommandBuffer()
+ \fn virtual bool QRhiSwapChain::isFormatSupported(Format f) = 0
- \return a command buffer on which rendering commands can be recorded. Only
- valid within a QRhi::beginFrame() - QRhi::endFrame() block where
- beginFrame() was called with this swapchain.
+ \return true if the given swapchain format \a f is supported. SDR is always
+ supported.
- \note the value must not be cached and reused between frames
+ \note Can be called independently of createOrResize(), but window() must
+ already be set. Calling without the window set may lead to unexpected
+ results depending on the backend and platform (most likely false for any
+ HDR format), because HDR format support is usually tied to the output
+ (screen) to which the swapchain's associated window belongs at any given
+ time. If the result is true for a HDR format, then creating the swapchain
+ with that format is expected to succeed as long as the window is not moved
+ to another screen in the meantime.
+
+ The main use of this function is to call it before the first
+ createOrResize() after the window is already set. This allow the QRhi
+ backends to perform platform or windowing system specific queries to
+ determine if the window (and the screen it is on) is capable of true HDR
+ output with the specified format.
+
+ When the format is reported as supported, call setFormat() to set the
+ requested format and call createOrResize(). Be aware of the consequences
+ however: successfully requesting a HDR format will involve having to deal
+ with a different color space, possibly doing white level correction for
+ non-HDR-aware content, adjusting tonemapping methods, adjusting offscreen
+ render target settings, etc.
+
+ \sa setFormat()
+ */
+
+/*!
+ \fn virtual QRhiCommandBuffer *QRhiSwapChain::currentFrameCommandBuffer() = 0
+
+ \return a command buffer on which rendering commands and resource updates
+ can be recorded within a \l{QRhi::beginFrame()}{beginFrame} -
+ \l{QRhi::endFrame()}{endFrame} block, assuming beginFrame() was called with
+ this swapchain.
+
+ \note The returned object is valid also after endFrame(), up until the next
+ beginFrame(), but the returned command buffer should not be used to record
+ any commands then. Rather, it can be used to query data collected during
+ the frame (or previous frames), for example by calling
+ \l{QRhiCommandBuffer::lastCompletedGpuTime()}{lastCompletedGpuTime()}.
+
+ \note The value must not be cached and reused between frames. The caller
+ should not hold on to the returned object once
+ \l{QRhi::beginFrame()}{beginFrame()} is called again. Instead, the command
+ buffer object should be queried again by calling this function.
*/
/*!
- \fn QRhiRenderTarget *QRhiSwapChain::currentFrameRenderTarget()
+ \fn virtual QRhiRenderTarget *QRhiSwapChain::currentFrameRenderTarget() = 0
\return a render target that can used with beginPass() in order to render
- the the swapchain's current backbuffer. Only valid within a
+ the swapchain's current backbuffer. Only valid within a
QRhi::beginFrame() - QRhi::endFrame() block where beginFrame() was called
with this swapchain.
@@ -3675,32 +7447,416 @@ QRhiResource::Type QRhiSwapChain::resourceType() const
*/
/*!
- \fn bool QRhiSwapChain::buildOrResize()
+ \enum QRhiSwapChain::StereoTargetBuffer
+ Selects the backbuffer to use with a stereoscopic swapchain.
+
+ \value LeftBuffer
+ \value RightBuffer
+ */
+
+/*!
+ \return a render target that can be used with beginPass() in order to
+ render to the swapchain's left or right backbuffer. This overload should be
+ used only with stereoscopic rendering, that is, when the associated QWindow
+ is backed by two color buffers, one for each eye, instead of just one.
+
+ When stereoscopic rendering is not supported, the return value will be
+ the default target. It is supported by all hardware backends except for Metal, in
+ combination with \l QSurfaceFormat::StereoBuffers, assuming it is supported
+ by the graphics and display driver stack at run time. Metal and Null backends
+ are going to return the default render target from this overload.
+
+ \note the value must not be cached and reused between frames
+ */
+QRhiRenderTarget *QRhiSwapChain::currentFrameRenderTarget(StereoTargetBuffer targetBuffer)
+{
+ Q_UNUSED(targetBuffer);
+ return currentFrameRenderTarget();
+}
+
+/*!
+ \fn virtual bool QRhiSwapChain::createOrResize() = 0
Creates the swapchain if not already done and resizes the swapchain buffers
to match the current size of the targeted surface. Call this whenever the
size of the target surface is different than before.
- \note call release() only when the swapchain needs to be released
+ \note call destroy() only when the swapchain needs to be released
completely, typically upon
QPlatformSurfaceEvent::SurfaceAboutToBeDestroyed. To perform resizing, just
- call buildOrResize().
+ call createOrResize().
\return \c true when successful, \c false when a graphics operation failed.
- Regardless of the return value, calling release() is always safe.
+ Regardless of the return value, calling destroy() is always safe.
+ */
+
+/*!
+ \fn QWindow *QRhiSwapChain::window() const
+ \return the currently set window.
+ */
+
+/*!
+ \fn void QRhiSwapChain::setWindow(QWindow *window)
+ Sets the \a window.
*/
/*!
+ \fn QRhiSwapChainProxyData QRhiSwapChain::proxyData() const
+ \return the currently set proxy data.
+ */
+
+/*!
+ \fn void QRhiSwapChain::setProxyData(const QRhiSwapChainProxyData &d)
+ Sets the proxy data \a d.
+
+ \sa QRhi::updateSwapChainProxyData()
+ */
+
+/*!
+ \fn QRhiSwapChain::Flags QRhiSwapChain::flags() const
+ \return the currently set flags.
+ */
+
+/*!
+ \fn void QRhiSwapChain::setFlags(Flags f)
+ Sets the flags \a f.
+ */
+
+/*!
+ \fn QRhiSwapChain::Format QRhiSwapChain::format() const
+ \return the currently set format.
+ */
+
+/*!
+ \fn void QRhiSwapChain::setFormat(Format f)
+ Sets the format \a f.
+
+ Avoid setting formats that are reported as unsupported from
+ isFormatSupported(). Note that support for a given format may depend on the
+ screen the swapchain's associated window is opened on. On some platforms,
+ such as Windows and macOS, for HDR output to work it is necessary to have
+ HDR output enabled in the display settings.
+
+ See isFormatSupported(), \l QRhiSwapChainHdrInfo, and \l Format for more
+ information on high dynamic range output.
+ */
+
+/*!
+ \fn QRhiRenderBuffer *QRhiSwapChain::depthStencil() const
+ \return the currently associated renderbuffer for depth-stencil.
+ */
+
+/*!
+ \fn void QRhiSwapChain::setDepthStencil(QRhiRenderBuffer *ds)
+ Sets the renderbuffer \a ds for use as a depth-stencil buffer.
+ */
+
+/*!
+ \fn int QRhiSwapChain::sampleCount() const
+ \return the currently set sample count. 1 means no multisample antialiasing.
+ */
+
+/*!
+ \fn void QRhiSwapChain::setSampleCount(int samples)
+
+ Sets the sample count. Common values for \a samples are 1 (no MSAA), 4 (4x
+ MSAA), or 8 (8x MSAA).
+
+ \sa QRhi::supportedSampleCounts()
+ */
+
+/*!
+ \fn QRhiRenderPassDescriptor *QRhiSwapChain::renderPassDescriptor() const
+ \return the currently associated QRhiRenderPassDescriptor object.
+ */
+
+/*!
+ \fn void QRhiSwapChain::setRenderPassDescriptor(QRhiRenderPassDescriptor *desc)
+ Associates with the QRhiRenderPassDescriptor \a desc.
+ */
+
+/*!
+ \fn virtual QRhiRenderPassDescriptor *QRhiSwapChain::newCompatibleRenderPassDescriptor() = 0;
+
+ \return a new QRhiRenderPassDescriptor that is compatible with this swapchain.
+
+ The returned value is used in two ways: it can be passed to
+ setRenderPassDescriptor() and
+ QRhiGraphicsPipeline::setRenderPassDescriptor(). A render pass descriptor
+ describes the attachments (color, depth/stencil) and the load/store
+ behavior that can be affected by flags(). A QRhiGraphicsPipeline can only
+ be used in combination with a swapchain that has a
+ \l{QRhiRenderPassDescriptor::isCompatible()}{compatible}
+ QRhiRenderPassDescriptor set.
+
+ \sa createOrResize()
+ */
+
+/*!
+ \struct QRhiSwapChainHdrInfo
+ \inmodule QtGui
+ \since 6.6
+
+ \brief Describes the high dynamic range related information of the
+ swapchain's associated output.
+
+ To perform HDR-compatible tonemapping, where the target range is not [0,1],
+ one often needs to know the maximum luminance of the display the
+ swapchain's window is associated with. While this is often made
+ user-configurable (think brightness, gamma and similar settings in games),
+ it can be highly useful to set defaults based on the values reported by the
+ display itself, thus providing a decent starting point.
+
+ There are some problems however: the information is exposed in different
+ forms on different platforms, whereas with cross-platform graphics APIs
+ there is often no associated solution at all, because managing such
+ information is not in the scope of the API (and may rather be retrievable
+ via other platform-specific means, if any).
+
+ With Metal on macOS/iOS, there is no luminance values exposed in the
+ platform APIs. Instead, the maximum color component value, that would be
+ 1.0 in a non-HDR setup, is provided. The \c limitsType field indicates what
+ kind of information is available. It is then up to the clients of QRhi to
+ access the correct data from the \c limits union and use it as they see
+ fit.
+
+ With an API like Vulkan, where there is no way to get such information, the
+ values are always the built-in defaults.
+
+ Therefore, the struct returned from QRhiSwapChain::hdrInfo() contains
+ either some hard-coded defaults or real values received from an API such as
+ DXGI (IDXGIOutput6) or Cocoa (NSScreen). When no platform queries are
+ available (or needs using platform facilities out of scope for QRhi), the
+ hard-coded defaults are a maximum luminance of 1000 nits and an SDR white
+ level of 200.
+
+ The struct also exposes the presumed luminance behavior of the platform and
+ its compositor, to indicate what a color component value of 1.0 is treated
+ as in a HDR color buffer. In some cases it will be necessary to perform
+ color correction of non-HDR content composited with HDR content. To enable
+ this, the SDR white level is queried from the system on some platforms
+ (Windows) and exposed here.
+
+ \note This is a RHI API with limited compatibility guarantees, see \l QRhi
+ for details.
+
+ \sa QRhiSwapChain::hdrInfo()
+ */
+
+/*!
+ \enum QRhiSwapChainHdrInfo::LimitsType
+
+ \value LuminanceInNits Indicates that the \l limits union has its
+ \c luminanceInNits struct set
+
+ \value ColorComponentValue Indicates that the \l limits union has its
+ \c colorComponentValue struct set
+*/
+
+/*!
+ \enum QRhiSwapChainHdrInfo::LuminanceBehavior
+
+ \value SceneReferred Indicates that the color value of 1.0 is interpreted
+ as 80 nits. This is the behavior of HDR-enabled windows with the Windows
+ compositor. See
+ \l{https://learn.microsoft.com/en-us/windows/win32/direct3darticles/high-dynamic-range}{this
+ page} for more information on HDR on Windows.
+
+ \value DisplayReferred Indicates that the color value of 1.0 is interpreted
+ as the value of the SDR white. (which can be e.g. 200 nits, but will vary
+ depending on screen brightness) This is the behavior of HDR-enabled windows
+ on Apple platforms. See
+ \l{https://developer.apple.com/documentation/metal/hdr_content/displaying_hdr_content_in_a_metal_layer}{this
+ page} for more information on Apple's EDR system.
+*/
+
+/*!
+ \variable QRhiSwapChainHdrInfo::limitsType
+
+ With Metal on macOS/iOS, there is no luminance values exposed in the
+ platform APIs. Instead, the maximum color component value, that would be
+ 1.0 in a non-HDR setup, is provided. This value indicates what kind of
+ information is available in \l limits.
+
+ \sa QRhiSwapChain::hdrInfo()
+*/
+
+/*!
+ \variable QRhiSwapChainHdrInfo::limits
+
+ Contains the actual values queried from the graphics API or the platform.
+ The type of data is indicated by \l limitsType. This is therefore a union.
+ There are currently two options:
+
+ Luminance values in nits:
+
+ \code
+ struct {
+ float minLuminance;
+ float maxLuminance;
+ } luminanceInNits;
+ \endcode
+
+ On Windows the minimum and maximum luminance depends on the screen
+ brightness. While not relevant for desktops, on laptops the screen
+ brightness may change at any time. Increasing brightness implies decreased
+ maximum luminance. In addition, the results may also be dependent on the
+ HDR Content Brightness set in Windows Settings' System/Display/HDR view,
+ if there is such a setting.
+
+ Note however that the changes made to the laptop screen's brightness or in
+ the system settings while the application is running are not necessarily
+ reflected in the returned values, meaning calling hdrInfo() again may still
+ return the same luminance range as before for the rest of the process'
+ lifetime. The exact behavior is up to DXGI and Qt has no control over it.
+
+ \note The Windows compositor works in scene-referred mode for HDR content.
+ A color component value of 1.0 corresponds to a luminance of 80 nits. When
+ rendering non-HDR content (e.g. 2D UI elements), the correction of the
+ white level is often necessary. (e.g., outputting the fragment color (1, 1,
+ 1) will likely lead to showing a shade of white that is too dim on-screen)
+ See \l sdrWhiteLevel.
+
+ For macOS/iOS, the current maximum and potential maximum color
+ component values are provided:
+
+ \code
+ struct {
+ float maxColorComponentValue;
+ float maxPotentialColorComponentValue;
+ } colorComponentValue;
+ \endcode
+
+ The value may depend on the screen brightness, which on laptops means that
+ the result may change in the next call to hdrInfo() if the brightness was
+ changed in the meantime. The maximum screen brightness implies a maximum
+ color value of 1.0.
+
+ \note Apple's EDR is display-referred. 1.0 corresponds to a luminance level
+ of SDR white (e.g. 200 nits), the value of which varies based on the screen
+ brightness and possibly other settings. The exact luminance value for that,
+ or the maximum luminance of the display, are not exposed to the
+ applications.
+
+ \note It has been observed that the color component values are not set to
+ the correct larger-than-1 value right away on startup on some macOS
+ systems, but the values tend to change during or after the first frame.
+
+ \sa QRhiSwapChain::hdrInfo()
+*/
+
+/*!
+ \variable QRhiSwapChainHdrInfo::luminanceBehavior
+
+ Describes the platform's presumed behavior with regards to color values.
+
+ \sa sdrWhiteLevel
+ */
+
+/*!
+ \variable QRhiSwapChainHdrInfo::sdrWhiteLevel
+
+ On Windows this is the dynamic SDR white level in nits. The value is
+ dependent on the screen brightness (on laptops), and the SDR or HDR Content
+ Brightness settings in the Windows settings' System/Display/HDR view.
+
+ To perform white level correction for non-HDR (SDR) content, such as 2D UI
+ elemenents, multiply the final color with sdrWhiteLevel / 80.0 whenever
+ \l luminanceBehavior is SceneReferred. (assuming Windows and a linear
+ extended sRGB (scRGB) color space)
+
+ On other platforms the value is always a pre-defined value, 200. This may
+ not match the system's actual SDR white level, but the value of this
+ variable is not relevant in practice when the \l luminanceBehavior is
+ DisplayReferred, because then the color component value of 1.0 refers to
+ the SDR white by default.
+
+ \sa luminanceBehavior
+*/
+
+/*!
+ \return the HDR information for the associated display.
+
+ Do not assume that this is a cheap operation. Depending on the platform,
+ this function makes various platform queries which may have a performance
+ impact.
+
+ \note Can be called before createOrResize() as long as the window is
+ \l{setWindow()}{set}.
+
+ \note What happens when moving a window with an initialized swapchain
+ between displays (HDR to HDR with different characteristics, HDR to SDR,
+ etc.) is not currently well-defined and depends heavily on the windowing
+ system and compositor, with potentially varying behavior between platforms.
+ Currently QRhi only guarantees that hdrInfo() returns valid data, if
+ available, for the display to which the swapchain's associated window
+ belonged at the time of createOrResize().
+
+ \sa QRhiSwapChainHdrInfo
+ */
+QRhiSwapChainHdrInfo QRhiSwapChain::hdrInfo()
+{
+ QRhiSwapChainHdrInfo info;
+ info.limitsType = QRhiSwapChainHdrInfo::LuminanceInNits;
+ info.limits.luminanceInNits.minLuminance = 0.0f;
+ info.limits.luminanceInNits.maxLuminance = 1000.0f;
+ info.luminanceBehavior = QRhiSwapChainHdrInfo::SceneReferred;
+ info.sdrWhiteLevel = 200.0f;
+ return info;
+}
+
+#ifndef QT_NO_DEBUG_STREAM
+QDebug operator<<(QDebug dbg, const QRhiSwapChainHdrInfo &info)
+{
+ QDebugStateSaver saver(dbg);
+ dbg.nospace() << "QRhiSwapChainHdrInfo(";
+ switch (info.limitsType) {
+ case QRhiSwapChainHdrInfo::LuminanceInNits:
+ dbg.nospace() << " minLuminance=" << info.limits.luminanceInNits.minLuminance
+ << " maxLuminance=" << info.limits.luminanceInNits.maxLuminance;
+ break;
+ case QRhiSwapChainHdrInfo::ColorComponentValue:
+ dbg.nospace() << " maxColorComponentValue=" << info.limits.colorComponentValue.maxColorComponentValue;
+ dbg.nospace() << " maxPotentialColorComponentValue=" << info.limits.colorComponentValue.maxPotentialColorComponentValue;
+ break;
+ }
+ switch (info.luminanceBehavior) {
+ case QRhiSwapChainHdrInfo::SceneReferred:
+ dbg.nospace() << " scene-referred, SDR white level=" << info.sdrWhiteLevel;
+ break;
+ case QRhiSwapChainHdrInfo::DisplayReferred:
+ dbg.nospace() << " display-referred";
+ break;
+ }
+ dbg.nospace() << ')';
+ return dbg;
+}
+#endif
+
+/*!
\class QRhiComputePipeline
- \internal
\inmodule QtGui
+ \since 6.6
\brief Compute pipeline state resource.
\note Setting the shader resource bindings is mandatory. The referenced
- QRhiShaderResourceBindings must already be built by the time build() is
- called.
+ QRhiShaderResourceBindings must already have created() called on it by the
+ time create() is called.
\note Setting the shader is mandatory.
+
+ \note This is a RHI API with limited compatibility guarantees, see \l QRhi
+ for details.
+ */
+
+/*!
+ \enum QRhiComputePipeline::Flag
+
+ Flag values for describing pipeline options.
+
+ \value CompileShadersWithDebugInfo Requests compiling shaders with debug
+ information enabled, when applicable. See
+ QRhiGraphicsPipeline::CompileShadersWithDebugInfo for more information.
*/
/*!
@@ -3720,15 +7876,59 @@ QRhiComputePipeline::QRhiComputePipeline(QRhiImplementation *rhi)
}
/*!
+ \fn QRhiComputePipeline::Flags QRhiComputePipeline::flags() const
+ \return the currently set flags.
+ */
+
+/*!
+ \fn void QRhiComputePipeline::setFlags(Flags f)
+ Sets the flags \a f.
+ */
+
+/*!
+ \fn QRhiShaderStage QRhiComputePipeline::shaderStage() const
+ \return the currently set shader.
+ */
+
+/*!
+ \fn void QRhiComputePipeline::setShaderStage(const QRhiShaderStage &stage)
+
+ Sets the shader to use. \a stage can only refer to the
+ \l{QRhiShaderStage::Compute}{compute stage}.
+ */
+
+/*!
+ \fn QRhiShaderResourceBindings *QRhiComputePipeline::shaderResourceBindings() const
+ \return the currently associated QRhiShaderResourceBindings object.
+ */
+
+/*!
+ \fn void QRhiComputePipeline::setShaderResourceBindings(QRhiShaderResourceBindings *srb)
+
+ Associates with \a srb describing the resource binding layout and the
+ resources (QRhiBuffer, QRhiTexture) themselves. The latter is optional. As
+ with graphics pipelines, the \a srb passed in here can leave the actual
+ buffer or texture objects unspecified (\nullptr) as long as there is
+ another,
+ \l{QRhiShaderResourceBindings::isLayoutCompatible()}{layout-compatible}
+ QRhiShaderResourceBindings bound via
+ \l{QRhiCommandBuffer::setShaderResources()}{setShaderResources()} before
+ recording the dispatch call.
+ */
+
+/*!
\class QRhiCommandBuffer
- \internal
\inmodule QtGui
+ \since 6.6
\brief Command buffer resource.
Not creatable by applications at the moment. The only ways to obtain a
valid QRhiCommandBuffer are to get it from the targeted swapchain via
QRhiSwapChain::currentFrameCommandBuffer(), or, in case of rendering
completely offscreen, initializing one via QRhi::beginOffscreenFrame().
+
+ \note This is a RHI API with limited compatibility guarantees, see \l QRhi
+ for details.
*/
/*!
@@ -3740,6 +7940,26 @@ QRhiComputePipeline::QRhiComputePipeline(QRhiImplementation *rhi)
*/
/*!
+ \enum QRhiCommandBuffer::BeginPassFlag
+ Flag values for QRhi::beginPass()
+
+ \value ExternalContent Specifies that there will be a call to
+ QRhiCommandBuffer::beginExternal() in this pass. Some backends, Vulkan in
+ particular, will fail if this flag is not set and beginExternal() is still
+ called.
+
+ \value DoNotTrackResourcesForCompute Specifies that there is no need to
+ track resources used in this pass if the only purpose of such tracking is
+ to generate barriers for compute. Implies that there are no compute passes
+ in the frame. This is an optimization hint that may be taken into account
+ by certain backends, OpenGL in particular, allowing them to skip certain
+ operations. When this flag is set for a render pass in a frame, calling
+ \l{QRhiCommandBuffer::beginComputePass()}{beginComputePass()} in that frame
+ may lead to unexpected behavior, depending on the resource dependencies
+ between the render and compute passes.
+ */
+
+/*!
\typedef QRhiCommandBuffer::DynamicOffset
Synonym for QPair<int, quint32>. The first entry is the binding, the second
@@ -3769,8 +7989,7 @@ QRhiResource::Type QRhiCommandBuffer::resourceType() const
return CommandBuffer;
}
-#ifndef QT_NO_DEBUG
-static const char *resourceTypeStr(QRhiResource *res)
+static const char *resourceTypeStr(const QRhiResource *res)
{
switch (res->resourceType()) {
case QRhiResource::Buffer:
@@ -3783,8 +8002,8 @@ static const char *resourceTypeStr(QRhiResource *res)
return "RenderBuffer";
case QRhiResource::RenderPassDescriptor:
return "RenderPassDescriptor";
- case QRhiResource::RenderTarget:
- return "RenderTarget";
+ case QRhiResource::SwapChainRenderTarget:
+ return "SwapChainRenderTarget";
case QRhiResource::TextureRenderTarget:
return "TextureRenderTarget";
case QRhiResource::ShaderResourceBindings:
@@ -3797,13 +8016,10 @@ static const char *resourceTypeStr(QRhiResource *res)
return "ComputePipeline";
case QRhiResource::CommandBuffer:
return "CommandBuffer";
- default:
- Q_UNREACHABLE();
- break;
}
- return "";
+
+ Q_UNREACHABLE_RETURN("");
}
-#endif
QRhiImplementation::~QRhiImplementation()
{
@@ -3813,15 +8029,30 @@ QRhiImplementation::~QRhiImplementation()
// this far with some backends where the allocator or the api may check
// and freak out for unfreed graphics objects in the derived dtor already.
#ifndef QT_NO_DEBUG
+ // debug builds: just do it always
+ static bool leakCheck = true;
+#else
+ // release builds: opt-in
+ static bool leakCheck = qEnvironmentVariableIntValue("QT_RHI_LEAK_CHECK");
+#endif
if (!resources.isEmpty()) {
- qWarning("QRhi %p going down with %d unreleased resources that own native graphics objects. This is not nice.",
- q, resources.count());
- for (QRhiResource *res : qAsConst(resources)) {
- qWarning(" %s resource %p (%s)", resourceTypeStr(res), res, res->m_objectName.constData());
+ if (leakCheck) {
+ qWarning("QRhi %p going down with %d unreleased resources that own native graphics objects. This is not nice.",
+ q, int(resources.size()));
+ }
+ for (auto it = resources.cbegin(), end = resources.cend(); it != end; ++it) {
+ QRhiResource *res = it.key();
+ const bool ownsNativeResources = it.value();
+ if (leakCheck && ownsNativeResources)
+ qWarning(" %s resource %p (%s)", resourceTypeStr(res), res, res->m_objectName.constData());
+
+ // Null out the resource's rhi pointer. This is why it makes sense to do null
+ // checks in the destroy() implementations of the various resource types. It
+ // allows to survive in bad applications that somehow manage to destroy a
+ // resource of a QRhi after the QRhi itself.
res->m_rhi = nullptr;
}
}
-#endif
}
bool QRhiImplementation::isCompressedFormat(QRhiTexture::Format format) const
@@ -3952,7 +8183,7 @@ void QRhiImplementation::compressedFormatInfo(QRhiTexture::Format format, const
}
void QRhiImplementation::textureFormatInfo(QRhiTexture::Format format, const QSize &size,
- quint32 *bpl, quint32 *byteSize) const
+ quint32 *bpl, quint32 *byteSize, quint32 *bytesPerPixel) const
{
if (isCompressedFormat(format)) {
compressedFormatInfo(format, size, bpl, byteSize, nullptr);
@@ -3970,9 +8201,15 @@ void QRhiImplementation::textureFormatInfo(QRhiTexture::Format format, const QSi
case QRhiTexture::R8:
bpc = 1;
break;
+ case QRhiTexture::RG8:
+ bpc = 2;
+ break;
case QRhiTexture::R16:
bpc = 2;
break;
+ case QRhiTexture::RG16:
+ bpc = 4;
+ break;
case QRhiTexture::RED_OR_ALPHA8:
bpc = 1;
break;
@@ -3983,10 +8220,22 @@ void QRhiImplementation::textureFormatInfo(QRhiTexture::Format format, const QSi
case QRhiTexture::RGBA32F:
bpc = 16;
break;
+ case QRhiTexture::R16F:
+ bpc = 2;
+ break;
+ case QRhiTexture::R32F:
+ bpc = 4;
+ break;
+
+ case QRhiTexture::RGB10A2:
+ bpc = 4;
+ break;
case QRhiTexture::D16:
bpc = 2;
break;
+ case QRhiTexture::D24:
+ case QRhiTexture::D24S8:
case QRhiTexture::D32F:
bpc = 4;
break;
@@ -4000,22 +8249,19 @@ void QRhiImplementation::textureFormatInfo(QRhiTexture::Format format, const QSi
*bpl = uint(size.width()) * bpc;
if (byteSize)
*byteSize = uint(size.width() * size.height()) * bpc;
+ if (bytesPerPixel)
+ *bytesPerPixel = bpc;
}
-// Approximate because it excludes subresource alignment or multisampling.
-quint32 QRhiImplementation::approxByteSizeForTexture(QRhiTexture::Format format, const QSize &baseSize,
- int mipCount, int layerCount)
+bool QRhiImplementation::isStencilSupportingFormat(QRhiTexture::Format format) const
{
- quint32 approxSize = 0;
- for (int level = 0; level < mipCount; ++level) {
- quint32 byteSize = 0;
- const QSize size(qFloor(qreal(qMax(1, baseSize.width() >> level))),
- qFloor(qreal(qMax(1, baseSize.height() >> level))));
- textureFormatInfo(format, size, nullptr, &byteSize);
- approxSize += byteSize;
+ switch (format) {
+ case QRhiTexture::D24S8:
+ return true;
+ default:
+ break;
}
- approxSize *= uint(layerCount);
- return approxSize;
+ return false;
}
bool QRhiImplementation::sanityCheckGraphicsPipeline(QRhiGraphicsPipeline *ps)
@@ -4031,14 +8277,8 @@ bool QRhiImplementation::sanityCheckGraphicsPipeline(QRhiGraphicsPipeline *ps)
qWarning("Empty shader passed to graphics pipeline");
return false;
}
- if (it->type() == QRhiShaderStage::Vertex) {
+ if (it->type() == QRhiShaderStage::Vertex)
hasVertexStage = true;
- const QRhiVertexInputLayout inputLayout = ps->vertexInputLayout();
- if (inputLayout.cbeginAttributes() == inputLayout.cendAttributes()) {
- qWarning("Vertex stage present without any vertex inputs");
- return false;
- }
- }
}
if (!hasVertexStage) {
qWarning("Cannot build a graphics pipeline without a vertex stage");
@@ -4058,6 +8298,126 @@ bool QRhiImplementation::sanityCheckGraphicsPipeline(QRhiGraphicsPipeline *ps)
return true;
}
+bool QRhiImplementation::sanityCheckShaderResourceBindings(QRhiShaderResourceBindings *srb)
+{
+#ifndef QT_NO_DEBUG
+ bool bindingsOk = true;
+ const int CHECKED_BINDINGS_COUNT = 64;
+ bool bindingSeen[CHECKED_BINDINGS_COUNT] = {};
+ for (auto it = srb->cbeginBindings(), end = srb->cendBindings(); it != end; ++it) {
+ const int binding = shaderResourceBindingData(*it)->binding;
+ if (binding >= CHECKED_BINDINGS_COUNT)
+ continue;
+ if (binding < 0) {
+ qWarning("Invalid binding number %d", binding);
+ bindingsOk = false;
+ continue;
+ }
+ switch (shaderResourceBindingData(*it)->type) {
+ case QRhiShaderResourceBinding::UniformBuffer:
+ if (!bindingSeen[binding]) {
+ bindingSeen[binding] = true;
+ } else {
+ qWarning("Uniform buffer duplicates an existing binding number %d", binding);
+ bindingsOk = false;
+ }
+ break;
+ case QRhiShaderResourceBinding::SampledTexture:
+ if (!bindingSeen[binding]) {
+ bindingSeen[binding] = true;
+ } else {
+ qWarning("Combined image sampler duplicates an existing binding number %d", binding);
+ bindingsOk = false;
+ }
+ break;
+ case QRhiShaderResourceBinding::Texture:
+ if (!bindingSeen[binding]) {
+ bindingSeen[binding] = true;
+ } else {
+ qWarning("Texture duplicates an existing binding number %d", binding);
+ bindingsOk = false;
+ }
+ break;
+ case QRhiShaderResourceBinding::Sampler:
+ if (!bindingSeen[binding]) {
+ bindingSeen[binding] = true;
+ } else {
+ qWarning("Sampler duplicates an existing binding number %d", binding);
+ bindingsOk = false;
+ }
+ break;
+ case QRhiShaderResourceBinding::ImageLoad:
+ case QRhiShaderResourceBinding::ImageStore:
+ case QRhiShaderResourceBinding::ImageLoadStore:
+ if (!bindingSeen[binding]) {
+ bindingSeen[binding] = true;
+ } else {
+ qWarning("Image duplicates an existing binding number %d", binding);
+ bindingsOk = false;
+ }
+ break;
+ case QRhiShaderResourceBinding::BufferLoad:
+ case QRhiShaderResourceBinding::BufferStore:
+ case QRhiShaderResourceBinding::BufferLoadStore:
+ if (!bindingSeen[binding]) {
+ bindingSeen[binding] = true;
+ } else {
+ qWarning("Buffer duplicates an existing binding number %d", binding);
+ bindingsOk = false;
+ }
+ break;
+ default:
+ qWarning("Unknown binding type %d", int(shaderResourceBindingData(*it)->type));
+ bindingsOk = false;
+ break;
+ }
+ }
+
+ if (!bindingsOk) {
+ qWarning() << *srb;
+ return false;
+ }
+#else
+ Q_UNUSED(srb);
+#endif
+ return true;
+}
+
+int QRhiImplementation::effectiveSampleCount(int sampleCount) const
+{
+ // Stay compatible with QSurfaceFormat and friends where samples == 0 means the same as 1.
+ const int s = qBound(1, sampleCount, 64);
+ const QList<int> supported = supportedSampleCounts();
+ int result = 1;
+
+ // Stay compatible with Qt 5 in that requesting an unsupported sample count
+ // is not an error (although we still do a categorized debug print about
+ // this), and rather a supported value, preferably a close one, not just 1,
+ // is used instead. This is actually deviating from Qt 5 as that performs a
+ // clamping only and does not handle cases such as when sample count 2 is
+ // not supported but 4 is. (OpenGL handles things like that gracefully,
+ // other APIs may not, so improve this by picking the next largest, or in
+ // absence of that, the largest value; this with the goal to not reduce
+ // quality by rather picking a larger-than-requested value than a smaller one)
+
+ for (int i = 0, ie = supported.count(); i != ie; ++i) {
+ // assumes the 'supported' list is sorted
+ if (supported[i] >= s) {
+ result = supported[i];
+ break;
+ }
+ }
+
+ if (result != s) {
+ if (result == 1 && !supported.isEmpty())
+ result = supported.last();
+ qCDebug(QRHI_LOG_INFO, "Attempted to set unsupported sample count %d, using %d instead",
+ sampleCount, result);
+ }
+
+ return result;
+}
+
/*!
\internal
*/
@@ -4073,30 +8433,64 @@ QRhi::~QRhi()
if (!d)
return;
- qDeleteAll(d->pendingReleaseAndDestroyResources);
- d->pendingReleaseAndDestroyResources.clear();
-
runCleanup();
+ qDeleteAll(d->pendingDeleteResources);
+ d->pendingDeleteResources.clear();
+
d->destroy();
delete d;
}
+void QRhiImplementation::prepareForCreate(QRhi *rhi, QRhi::Implementation impl, QRhi::Flags flags)
+{
+ q = rhi;
+
+ // Play nice with QSG_INFO since that is still the most commonly used
+ // way to get graphics info printed from Qt Quick apps, and the Quick
+ // scenegraph is our primary user.
+ if (qEnvironmentVariableIsSet("QSG_INFO"))
+ const_cast<QLoggingCategory &>(QRHI_LOG_INFO()).setEnabled(QtDebugMsg, true);
+
+ debugMarkers = flags.testFlag(QRhi::EnableDebugMarkers);
+
+ implType = impl;
+ implThread = QThread::currentThread();
+}
+
/*!
- \return a new QRhi instance with a backend for the graphics API specified by \a impl.
+ \return a new QRhi instance with a backend for the graphics API specified
+ by \a impl with the specified \a flags.
\a params must point to an instance of one of the backend-specific
subclasses of QRhiInitParams, such as, QRhiVulkanInitParams,
- QRhiMetalInitParams, QRhiD3D11InitParams, QRhiGles2InitParams. See these
- classes for examples on creating a QRhi.
-
- \a flags is optional. It is used to enable profile and debug related
- features that are potentially expensive and should only be used during
- development.
+ QRhiMetalInitParams, QRhiD3D11InitParams, QRhiD3D12InitParams,
+ QRhiGles2InitParams. See these classes for examples on creating a QRhi.
+
+ QRhi by design does not implement any fallback logic: if the specified API
+ cannot be initialized, create() will fail, with warnings printed on the
+ debug output by the backends. The clients of QRhi, for example Qt Quick,
+ may however provide additional logic that allow falling back to an API
+ different than what was requested, depending on the platform. If the
+ intention is just to test if initialization would succeed when calling
+ create() at later point, it is preferable to use probe() instead of
+ create(), because with some backends probing can be implemented in a more
+ lightweight manner as opposed to create(), which performs full
+ initialization of the infrastructure and is wasteful if that QRhi instance
+ is then thrown immediately away.
+
+ \a importDevice allows using an already existing graphics device, without
+ QRhi creating its own. When not null, this parameter must point to an
+ instance of one of the subclasses of QRhiNativeHandles:
+ QRhiVulkanNativeHandles, QRhiD3D11NativeHandles, QRhiD3D12NativeHandles,
+ QRhiMetalNativeHandles, QRhiGles2NativeHandles. The exact details and
+ semantics depend on the backand and the underlying graphics API.
+
+ \sa probe()
*/
QRhi *QRhi::create(Implementation impl, QRhiInitParams *params, Flags flags, QRhiNativeHandles *importDevice)
{
- QScopedPointer<QRhi> r(new QRhi);
+ std::unique_ptr<QRhi> r(new QRhi);
switch (impl) {
case Null:
@@ -4131,7 +8525,7 @@ QRhi *QRhi::create(Implementation impl, QRhiInitParams *params, Flags flags, QRh
break;
#endif
case Metal:
-#if defined(Q_OS_MACOS) || defined(Q_OS_IOS)
+#if QT_CONFIG(metal)
r->d = new QRhiMetal(static_cast<QRhiMetalInitParams *>(params),
static_cast<QRhiMetalNativeHandles *>(importDevice));
break;
@@ -4139,35 +8533,116 @@ QRhi *QRhi::create(Implementation impl, QRhiInitParams *params, Flags flags, QRh
qWarning("This platform has no Metal support");
break;
#endif
- default:
+ case D3D12:
+#ifdef Q_OS_WIN
+#ifdef QRHI_D3D12_AVAILABLE
+ r->d = new QRhiD3D12(static_cast<QRhiD3D12InitParams *>(params),
+ static_cast<QRhiD3D12NativeHandles *>(importDevice));
+ break;
+#else
+ qWarning("Qt was built without Direct3D 12 support. "
+ "This is likely due to having ancient SDK headers (such as d3d12.h) in the Qt build environment. "
+ "Rebuild Qt with an SDK supporting D3D12 features introduced in Windows 10 version 1703, "
+ "or use an MSVC build as those typically are built with more up-to-date SDKs.");
break;
+#endif
+#else
+ qWarning("This platform has no Direct3D 12 support");
+ break;
+#endif
}
if (r->d) {
- r->d->q = r.data();
+ r->d->prepareForCreate(r.get(), impl, flags);
+ if (r->d->create(flags))
+ return r.release();
+ }
- if (flags.testFlag(EnableProfiling)) {
- QRhiProfilerPrivate *profD = QRhiProfilerPrivate::get(&r->d->profiler);
- profD->rhiDWhenEnabled = r->d;
- const_cast<QLoggingCategory &>(QRHI_LOG_INFO()).setEnabled(QtDebugMsg, true);
- }
+ return nullptr;
+}
- // Play nice with QSG_INFO since that is still the most commonly used
- // way to get graphics info printed from Qt Quick apps, and the Quick
- // scenegraph is our primary user.
- if (qEnvironmentVariableIsSet("QSG_INFO"))
- const_cast<QLoggingCategory &>(QRHI_LOG_INFO()).setEnabled(QtDebugMsg, true);
+/*!
+ \return true if create() can be expected to succeed when called the given
+ \a impl and \a params.
- r->d->debugMarkers = flags.testFlag(EnableDebugMarkers);
+ For some backends this is equivalent to calling create(), checking its
+ return value, and then destroying the resulting QRhi.
- if (r->d->create(flags)) {
- r->d->implType = impl;
- r->d->implThread = QThread::currentThread();
- return r.take();
- }
+ For others, in particular with Metal, there may be a specific probing
+ implementation, which allows testing in a more lightweight manner without
+ polluting the debug output with warnings upon failures.
+
+ \sa create()
+ */
+bool QRhi::probe(QRhi::Implementation impl, QRhiInitParams *params)
+{
+ bool ok = false;
+
+ // The only place currently where this makes sense is Metal, where the API
+ // is simple enough so that a special probing function - doing nothing but
+ // a MTLCreateSystemDefaultDevice - is reasonable. Elsewhere, just call
+ // create() and then drop the result.
+
+ if (impl == Metal) {
+#if QT_CONFIG(metal)
+ ok = QRhiMetal::probe(static_cast<QRhiMetalInitParams *>(params));
+#endif
+ } else {
+ QRhi *rhi = create(impl, params);
+ ok = rhi != nullptr;
+ delete rhi;
}
+ return ok;
+}
- return nullptr;
+/*!
+ \struct QRhiSwapChainProxyData
+ \inmodule QtGui
+ \since 6.6
+
+ \brief Opaque data describing native objects needed to set up a swapchain.
+
+ \note This is a RHI API with limited compatibility guarantees, see \l QRhi
+ for details.
+
+ \sa QRhi::updateSwapChainProxyData()
+ */
+
+/*!
+ Generates and returns a QRhiSwapChainProxyData struct containing opaque
+ data specific to the backend and graphics API specified by \a impl. \a
+ window is the QWindow a swapchain is targeting.
+
+ The returned struct can be passed to QRhiSwapChain::setProxyData(). This
+ makes sense in threaded rendering systems: this static function is expected
+ to be called on the \b{main (gui) thread}, unlike all QRhi operations, then
+ transferred to the thread working with the QRhi and QRhiSwapChain and passed
+ on to the swapchain. This allows doing native platform queries that are
+ only safe to be called on the main thread, for example to query the
+ CAMetalLayer from a NSView, and then passing on the data to the
+ QRhiSwapChain living on the rendering thread. With the Metal example, doing
+ the view.layer access on a dedicated rendering thread causes a warning in
+ the Xcode Thread Checker. With the data proxy mechanism, this is avoided.
+
+ When threads are not involved, generating and passing on the
+ QRhiSwapChainProxyData is not required: backends are guaranteed to be able
+ to query whatever is needed on their own, and if everything lives on the
+ main (gui) thread, that should be sufficient.
+
+ \note \a impl should match what the QRhi is created with. For example,
+ calling with QRhi::Metal on a non-Apple platform will not generate any
+ useful data.
+ */
+QRhiSwapChainProxyData QRhi::updateSwapChainProxyData(QRhi::Implementation impl, QWindow *window)
+{
+#if QT_CONFIG(metal)
+ if (impl == Metal)
+ return QRhiMetal::updateSwapChainProxyData(window);
+#else
+ Q_UNUSED(impl);
+ Q_UNUSED(window);
+#endif
+ return {};
}
/*!
@@ -4179,6 +8654,139 @@ QRhi::Implementation QRhi::backend() const
}
/*!
+ \return a friendly name for the backend \a impl, usually the name of the 3D
+ API in use.
+ */
+const char *QRhi::backendName(Implementation impl)
+{
+ switch (impl) {
+ case QRhi::Null:
+ return "Null";
+ case QRhi::Vulkan:
+ return "Vulkan";
+ case QRhi::OpenGLES2:
+ return "OpenGL";
+ case QRhi::D3D11:
+ return "D3D11";
+ case QRhi::Metal:
+ return "Metal";
+ case QRhi::D3D12:
+ return "D3D12";
+ }
+
+ Q_UNREACHABLE_RETURN("Unknown");
+}
+
+/*!
+ \return the backend type as string for this QRhi.
+ */
+const char *QRhi::backendName() const
+{
+ return backendName(d->implType);
+}
+
+/*!
+ \enum QRhiDriverInfo::DeviceType
+ Specifies the graphics device's type, when the information is available.
+
+ In practice this is only applicable with Vulkan and Metal. With Direct 3D
+ 11 and 12, using an adapter with the software flag set leads to the value
+ \c CpuDevice. Otherwise, and with OpenGL, the value is always UnknownDevice.
+
+ \value UnknownDevice
+ \value IntegratedDevice
+ \value DiscreteDevice
+ \value ExternalDevice
+ \value VirtualDevice
+ \value CpuDevice
+*/
+
+/*!
+ \struct QRhiDriverInfo
+ \inmodule QtGui
+ \since 6.6
+
+ \brief Describes the physical device, adapter, or graphics API
+ implementation that is used by an initialized QRhi.
+
+ Graphics APIs offer different levels and kinds of information. The only
+ value that is available across all APIs is the deviceName, which is a
+ freetext description of the physical device, adapter, or is a combination
+ of the strings reported for \c{GL_VENDOR} + \c{GL_RENDERER} +
+ \c{GL_VERSION}. The deviceId is always 0 for OpenGL. vendorId is always 0
+ for OpenGL and Metal. deviceType is always UnknownDevice for OpenGL and
+ Direct 3D.
+
+ \note This is a RHI API with limited compatibility guarantees, see \l QRhi
+ for details.
+ */
+
+/*!
+ \variable QRhiDriverInfo::deviceName
+
+ \sa QRhi::driverInfo()
+*/
+
+/*!
+ \variable QRhiDriverInfo::deviceId
+
+ \sa QRhi::driverInfo()
+*/
+
+/*!
+ \variable QRhiDriverInfo::vendorId
+
+ \sa QRhi::driverInfo()
+*/
+
+/*!
+ \variable QRhiDriverInfo::deviceType
+
+ \sa QRhi::driverInfo(), QRhiDriverInfo::DeviceType
+*/
+
+#ifndef QT_NO_DEBUG_STREAM
+static inline const char *deviceTypeStr(QRhiDriverInfo::DeviceType type)
+{
+ switch (type) {
+ case QRhiDriverInfo::UnknownDevice:
+ return "Unknown";
+ case QRhiDriverInfo::IntegratedDevice:
+ return "Integrated";
+ case QRhiDriverInfo::DiscreteDevice:
+ return "Discrete";
+ case QRhiDriverInfo::ExternalDevice:
+ return "External";
+ case QRhiDriverInfo::VirtualDevice:
+ return "Virtual";
+ case QRhiDriverInfo::CpuDevice:
+ return "Cpu";
+ }
+
+ Q_UNREACHABLE_RETURN(nullptr);
+}
+QDebug operator<<(QDebug dbg, const QRhiDriverInfo &info)
+{
+ QDebugStateSaver saver(dbg);
+ dbg.nospace() << "QRhiDriverInfo(deviceName=" << info.deviceName
+ << " deviceId=0x" << Qt::hex << info.deviceId
+ << " vendorId=0x" << info.vendorId
+ << " deviceType=" << deviceTypeStr(info.deviceType)
+ << ')';
+ return dbg;
+}
+#endif
+
+/*!
+ \return metadata for the graphics device used by this successfully
+ initialized QRhi instance.
+ */
+QRhiDriverInfo QRhi::driverInfo() const
+{
+ return d->driverInfo();
+}
+
+/*!
\return the thread on which the QRhi was \l{QRhi::create()}{initialized}.
*/
QThread *QRhi::thread() const
@@ -4204,6 +8812,33 @@ void QRhi::addCleanupCallback(const CleanupCallback &callback)
}
/*!
+ \overload
+
+ Registers \a callback to be invoked either when the QRhi is destroyed or
+ when runCleanup() is called. This overload takes an opaque pointer, \a key,
+ that is used to ensure that a given callback is registered (and so called)
+ only once.
+
+ \sa removeCleanupCallback()
+ */
+void QRhi::addCleanupCallback(const void *key, const CleanupCallback &callback)
+{
+ d->addCleanupCallback(key, callback);
+}
+
+/*!
+ Deregisters the callback with \a key. If no cleanup callback was registered
+ with \a key, the function does nothing. Callbacks registered without a key
+ cannot be removed.
+
+ \sa addCleanupCallback()
+ */
+void QRhi::removeCleanupCallback(const void *key)
+{
+ d->removeCleanupCallback(key);
+}
+
+/*!
Invokes all registered cleanup functions. The list of cleanup callbacks it
then cleared. Normally destroying the QRhi does this automatically, but
sometimes it can be useful to trigger cleanup in order to release all
@@ -4213,16 +8848,21 @@ void QRhi::addCleanupCallback(const CleanupCallback &callback)
*/
void QRhi::runCleanup()
{
- for (const CleanupCallback &f : qAsConst(d->cleanupCallbacks))
+ for (const CleanupCallback &f : std::as_const(d->cleanupCallbacks))
f(this);
d->cleanupCallbacks.clear();
+
+ for (auto it = d->keyedCleanupCallbacks.cbegin(), end = d->keyedCleanupCallbacks.cend(); it != end; ++it)
+ it.value()(this);
+
+ d->keyedCleanupCallbacks.clear();
}
/*!
\class QRhiResourceUpdateBatch
- \internal
\inmodule QtGui
+ \since 6.6
\brief Records upload and copy type of operations.
With QRhi it is no longer possible to perform copy type of operations at
@@ -4238,6 +8878,9 @@ void QRhi::runCleanup()
To get an available, empty batch from the pool, call
QRhi::nextResourceUpdateBatch().
+
+ \note This is a RHI API with limited compatibility guarantees, see \l QRhi
+ for details.
*/
/*!
@@ -4259,7 +8902,7 @@ QRhiResourceUpdateBatch::~QRhiResourceUpdateBatch()
\return the batch to the pool. This should only be used when the batch is
not passed to one of QRhiCommandBuffer::beginPass(),
QRhiCommandBuffer::endPass(), or QRhiCommandBuffer::resourceUpdate()
- because these implicitly call release().
+ because these implicitly call destroy().
\note QRhiResourceUpdateBatch instances must never by \c deleted by
applications.
@@ -4272,37 +8915,35 @@ void QRhiResourceUpdateBatch::release()
/*!
Copies all queued operations from the \a other batch into this one.
- \note \a other is not changed in any way, typically it will still need a
- release()
+ \note \a other may no longer contain valid data after the merge operation,
+ and must not be submitted, but it will still need to be released by calling
+ release().
This allows for a convenient pattern where resource updates that are
already known during the initialization step are collected into a batch
that is then merged into another when starting to first render pass later
on:
- \badcode
- void init()
- {
- ...
- initialUpdates = rhi->nextResourceUpdateBatch();
- initialUpdates->uploadStaticBuffer(vbuf, vertexData);
- initialUpdates->uploadStaticBuffer(ibuf, indexData);
- ...
- }
+ \code
+ void init()
+ {
+ initialUpdates = rhi->nextResourceUpdateBatch();
+ initialUpdates->uploadStaticBuffer(vbuf, vertexData);
+ initialUpdates->uploadStaticBuffer(ibuf, indexData);
+ // ...
+ }
- void render()
- {
- ...
- QRhiResourceUpdateBatch *resUpdates = rhi->nextResourceUpdateBatch();
- if (initialUpdates) {
- resUpdates->merge(initialUpdates);
- initialUpdates->release();
- initialUpdates = nullptr;
+ void render()
+ {
+ QRhiResourceUpdateBatch *resUpdates = rhi->nextResourceUpdateBatch();
+ if (initialUpdates) {
+ resUpdates->merge(initialUpdates);
+ initialUpdates->release();
+ initialUpdates = nullptr;
+ }
+ // resUpdates->updateDynamicBuffer(...);
+ cb->beginPass(rt, clearCol, clearDs, resUpdates);
}
- resUpdates->updateDynamicBuffer(...);
- ...
- cb->beginPass(rt, clearCol, clearDs, resUpdates);
- }
\endcode
*/
void QRhiResourceUpdateBatch::merge(QRhiResourceUpdateBatch *other)
@@ -4311,6 +8952,24 @@ void QRhiResourceUpdateBatch::merge(QRhiResourceUpdateBatch *other)
}
/*!
+ \return true until the number of buffer and texture operations enqueued
+ onto this batch is below a reasonable limit.
+
+ The return value is false when the number of buffer and/or texture
+ operations added to this batch have reached, or are about to reach, a
+ certain limit. The batch is fully functional afterwards as well, but may
+ need to allocate additional memory. Therefore, a renderer that collects
+ lots of buffer and texture updates in a single batch when preparing a frame
+ may want to consider \l{QRhiCommandBuffer::resourceUpdate()}{submitting the
+ batch} and \l{QRhi::nextResourceUpdateBatch()}{starting a new one} when
+ this function returns false.
+ */
+bool QRhiResourceUpdateBatch::hasOptimalCapacity() const
+{
+ return d->hasOptimalCapacity();
+}
+
+/*!
Enqueues updating a region of a QRhiBuffer \a buf created with the type
QRhiBuffer::Dynamic.
@@ -4326,13 +8985,19 @@ void QRhiResourceUpdateBatch::merge(QRhiResourceUpdateBatch *other)
\note QRhi transparently manages double buffering in order to prevent
stalling the graphics pipeline. The fact that a QRhiBuffer may have
- multiple native underneath can be safely ignored when using the QRhi and
- QRhiResourceUpdateBatch.
- */
-void QRhiResourceUpdateBatch::updateDynamicBuffer(QRhiBuffer *buf, int offset, int size, const void *data)
-{
- if (size > 0)
- d->bufferOps.append(QRhiResourceUpdateBatchPrivate::BufferOp::dynamicUpdate(buf, offset, size, data));
+ multiple native buffer objects underneath can be safely ignored when using
+ the QRhi and QRhiResourceUpdateBatch.
+ */
+void QRhiResourceUpdateBatch::updateDynamicBuffer(QRhiBuffer *buf, quint32 offset, quint32 size, const void *data)
+{
+ if (size > 0) {
+ const int idx = d->activeBufferOpCount++;
+ const int opListSize = d->bufferOps.size();
+ if (idx < opListSize)
+ QRhiResourceUpdateBatchPrivate::BufferOp::changeToDynamicUpdate(&d->bufferOps[idx], buf, offset, size, data);
+ else
+ d->bufferOps.append(QRhiResourceUpdateBatchPrivate::BufferOp::dynamicUpdate(buf, offset, size, data));
+ }
}
/*!
@@ -4343,20 +9008,32 @@ void QRhiResourceUpdateBatch::updateDynamicBuffer(QRhiBuffer *buf, int offset, i
are specified by \a data which must have at least \a size bytes available.
\a data can safely be destroyed or changed once this function returns.
*/
-void QRhiResourceUpdateBatch::uploadStaticBuffer(QRhiBuffer *buf, int offset, int size, const void *data)
+void QRhiResourceUpdateBatch::uploadStaticBuffer(QRhiBuffer *buf, quint32 offset, quint32 size, const void *data)
{
- if (size > 0)
- d->bufferOps.append(QRhiResourceUpdateBatchPrivate::BufferOp::staticUpload(buf, offset, size, data));
+ if (size > 0) {
+ const int idx = d->activeBufferOpCount++;
+ if (idx < d->bufferOps.size())
+ QRhiResourceUpdateBatchPrivate::BufferOp::changeToStaticUpload(&d->bufferOps[idx], buf, offset, size, data);
+ else
+ d->bufferOps.append(QRhiResourceUpdateBatchPrivate::BufferOp::staticUpload(buf, offset, size, data));
+ }
}
/*!
+ \overload
+
Enqueues updating the entire QRhiBuffer \a buf created with the type
QRhiBuffer::Immutable or QRhiBuffer::Static.
*/
void QRhiResourceUpdateBatch::uploadStaticBuffer(QRhiBuffer *buf, const void *data)
{
- if (buf->size() > 0)
- d->bufferOps.append(QRhiResourceUpdateBatchPrivate::BufferOp::staticUpload(buf, 0, 0, data));
+ if (buf->size() > 0) {
+ const int idx = d->activeBufferOpCount++;
+ if (idx < d->bufferOps.size())
+ QRhiResourceUpdateBatchPrivate::BufferOp::changeToStaticUpload(&d->bufferOps[idx], buf, 0, 0, data);
+ else
+ d->bufferOps.append(QRhiResourceUpdateBatchPrivate::BufferOp::staticUpload(buf, 0, 0, data));
+ }
}
/*!
@@ -4366,18 +9043,30 @@ void QRhiResourceUpdateBatch::uploadStaticBuffer(QRhiBuffer *buf, const void *da
A readback is asynchronous. \a result contains a callback that is invoked
when the operation has completed. The data is provided in
- QRhiBufferReadbackResult::data. Upon successful completion that QByteArray
+ QRhiReadbackResult::data. Upon successful completion that QByteArray
will have a size equal to \a size. On failure the QByteArray will be empty.
\note Reading buffers with a usage different than QRhiBuffer::UniformBuffer
is supported only when the QRhi::ReadBackNonUniformBuffer feature is
reported as supported.
- \a readBackTexture(), QRhi::isFeatureSupported()
+ \note The asynchronous readback is guaranteed to have completed when one of
+ the following conditions is met: \l{QRhi::finish()}{finish()} has been
+ called; or, at least \c N frames have been \l{QRhi::endFrame()}{submitted},
+ including the frame that issued the readback operation, and the
+ \l{QRhi::beginFrame()}{recording of a new frame} has been started, where \c
+ N is the \l{QRhi::resourceLimit()}{resource limit value} returned for
+ QRhi::MaxAsyncReadbackFrames.
+
+ \sa readBackTexture(), QRhi::isFeatureSupported(), QRhi::resourceLimit()
*/
-void QRhiResourceUpdateBatch::readBackBuffer(QRhiBuffer *buf, int offset, int size, QRhiBufferReadbackResult *result)
+void QRhiResourceUpdateBatch::readBackBuffer(QRhiBuffer *buf, quint32 offset, quint32 size, QRhiReadbackResult *result)
{
- d->bufferOps.append(QRhiResourceUpdateBatchPrivate::BufferOp::read(buf, offset, size, result));
+ const int idx = d->activeBufferOpCount++;
+ if (idx < d->bufferOps.size())
+ d->bufferOps[idx] = QRhiResourceUpdateBatchPrivate::BufferOp::read(buf, offset, size, result);
+ else
+ d->bufferOps.append(QRhiResourceUpdateBatchPrivate::BufferOp::read(buf, offset, size, result));
}
/*!
@@ -4389,8 +9078,13 @@ void QRhiResourceUpdateBatch::readBackBuffer(QRhiBuffer *buf, int offset, int si
*/
void QRhiResourceUpdateBatch::uploadTexture(QRhiTexture *tex, const QRhiTextureUploadDescription &desc)
{
- if (desc.cbeginEntries() != desc.cendEntries())
- d->textureOps.append(QRhiResourceUpdateBatchPrivate::TextureOp::upload(tex, desc));
+ if (desc.cbeginEntries() != desc.cendEntries()) {
+ const int idx = d->activeTextureOpCount++;
+ if (idx < d->textureOps.size())
+ d->textureOps[idx] = QRhiResourceUpdateBatchPrivate::TextureOp::upload(tex, desc);
+ else
+ d->textureOps.append(QRhiResourceUpdateBatchPrivate::TextureOp::upload(tex, desc));
+ }
}
/*!
@@ -4403,7 +9097,8 @@ void QRhiResourceUpdateBatch::uploadTexture(QRhiTexture *tex, const QRhiTextureU
*/
void QRhiResourceUpdateBatch::uploadTexture(QRhiTexture *tex, const QImage &image)
{
- uploadTexture(tex, QRhiTextureUploadEntry(0, 0, image));
+ uploadTexture(tex,
+ QRhiTextureUploadEntry(0, 0, QRhiTextureSubresourceUploadDescription(image)));
}
/*!
@@ -4412,10 +9107,19 @@ void QRhiResourceUpdateBatch::uploadTexture(QRhiTexture *tex, const QImage &imag
\note The source texture \a src must be created with
QRhiTexture::UsedAsTransferSource.
+
+ \note The format of the textures must match. With most graphics
+ APIs the data is copied as-is without any format conversions. If
+ \a dst and \a src are created with different formats, unspecified
+ issues may arise.
*/
void QRhiResourceUpdateBatch::copyTexture(QRhiTexture *dst, QRhiTexture *src, const QRhiTextureCopyDescription &desc)
{
- d->textureOps.append(QRhiResourceUpdateBatchPrivate::TextureOp::copy(dst, src, desc));
+ const int idx = d->activeTextureOpCount++;
+ if (idx < d->textureOps.size())
+ d->textureOps[idx] = QRhiResourceUpdateBatchPrivate::TextureOp::copy(dst, src, desc);
+ else
+ d->textureOps.append(QRhiResourceUpdateBatchPrivate::TextureOp::copy(dst, src, desc));
}
/*!
@@ -4430,10 +9134,10 @@ void QRhiResourceUpdateBatch::copyTexture(QRhiTexture *dst, QRhiTexture *src, co
application. Therefore, \a result provides not just the data but also a
callback as operations on the batch are asynchronous by nature:
- \badcode
- beginFrame(sc);
- beginPass
- ...
+ \code
+ rhi->beginFrame(swapchain);
+ cb->beginPass(swapchain->currentFrameRenderTarget(), colorClear, dsClear);
+ // ...
QRhiReadbackResult *rbResult = new QRhiReadbackResult;
rbResult->completed = [rbResult] {
{
@@ -4444,11 +9148,11 @@ void QRhiResourceUpdateBatch::copyTexture(QRhiTexture *dst, QRhiTexture *src, co
}
delete rbResult;
};
- u = nextResourceUpdateBatch();
+ QRhiResourceUpdateBatch *u = nextResourceUpdateBatch();
QRhiReadbackDescription rb; // no texture -> uses the current backbuffer of sc
u->readBackTexture(rb, rbResult);
- endPass(u);
- endFrame(sc);
+ cb->endPass(u);
+ rhi->endFrame(swapchain);
\endcode
\note The texture must be created with QRhiTexture::UsedAsTransferSource.
@@ -4464,22 +9168,52 @@ void QRhiResourceUpdateBatch::copyTexture(QRhiTexture *dst, QRhiTexture *src, co
happens with a byte ordered format. A \l{QRhiTexture::RGBA8}{RGBA8} texture
maps therefore to byte ordered QImage formats, such as,
QImage::Format_RGBA8888.
+
+ \note The asynchronous readback is guaranteed to have completed when one of
+ the following conditions is met: \l{QRhi::finish()}{finish()} has been
+ called; or, at least \c N frames have been \l{QRhi::endFrame()}{submitted},
+ including the frame that issued the readback operation, and the
+ \l{QRhi::beginFrame()}{recording of a new frame} has been started, where \c
+ N is the \l{QRhi::resourceLimit()}{resource limit value} returned for
+ QRhi::MaxAsyncReadbackFrames.
+
+ A single readback operation copies one mip level of one layer (cubemap face
+ or 3D slice or texture array element) at a time. The level and layer are
+ specified by the respective fields in \a rb.
+
+ \sa readBackBuffer(), QRhi::resourceLimit()
*/
void QRhiResourceUpdateBatch::readBackTexture(const QRhiReadbackDescription &rb, QRhiReadbackResult *result)
{
- d->textureOps.append(QRhiResourceUpdateBatchPrivate::TextureOp::read(rb, result));
+ const int idx = d->activeTextureOpCount++;
+ if (idx < d->textureOps.size())
+ d->textureOps[idx] = QRhiResourceUpdateBatchPrivate::TextureOp::read(rb, result);
+ else
+ d->textureOps.append(QRhiResourceUpdateBatchPrivate::TextureOp::read(rb, result));
}
/*!
- Enqueues a mipmap generation operation for the specified \a layer of texture
- \a tex.
+ Enqueues a mipmap generation operation for the specified texture \a tex.
+
+ Both 2D and cube textures are supported.
\note The texture must be created with QRhiTexture::MipMapped and
QRhiTexture::UsedWithGenerateMips.
+
+ \warning QRhi cannot guarantee that mipmaps can be generated for all
+ supported texture formats. For example, QRhiTexture::RGBA32F is not a \c
+ filterable format in OpenGL ES 3.0 and Metal on iOS, and therefore the
+ mipmap generation request may fail. RGBA8 and RGBA16F are typically
+ filterable, so it is recommended to use these formats when mipmap generation
+ is desired.
*/
-void QRhiResourceUpdateBatch::generateMips(QRhiTexture *tex, int layer)
+void QRhiResourceUpdateBatch::generateMips(QRhiTexture *tex)
{
- d->textureOps.append(QRhiResourceUpdateBatchPrivate::TextureOp::genMips(tex, layer));
+ const int idx = d->activeTextureOpCount++;
+ if (idx < d->textureOps.size())
+ d->textureOps[idx] = QRhiResourceUpdateBatchPrivate::TextureOp::genMips(tex);
+ else
+ d->textureOps.append(QRhiResourceUpdateBatchPrivate::TextureOp::genMips(tex));
}
/*!
@@ -4487,40 +9221,91 @@ void QRhiResourceUpdateBatch::generateMips(QRhiTexture *tex, int layer)
recorded.
\note the return value is not owned by the caller and must never be
- destroyed. Instead, the batch is returned the the pool for reuse by passing
+ destroyed. Instead, the batch is returned the pool for reuse by passing
it to QRhiCommandBuffer::beginPass(), QRhiCommandBuffer::endPass(), or
QRhiCommandBuffer::resourceUpdate(), or by calling
- QRhiResourceUpdateBatch::release() on it.
+ QRhiResourceUpdateBatch::destroy() on it.
\note Can be called outside beginFrame() - endFrame() as well since a batch
instance just collects data on its own, it does not perform any operations.
+
+ Due to not being tied to a frame being recorded, the following sequence is
+ valid for example:
+
+ \code
+ rhi->beginFrame(swapchain);
+ QRhiResourceUpdateBatch *u = rhi->nextResourceUpdateBatch();
+ u->uploadStaticBuffer(buf, data);
+ // ... do not commit the batch
+ rhi->endFrame();
+ // u stays valid (assuming buf stays valid as well)
+ rhi->beginFrame(swapchain);
+ swapchain->currentFrameCommandBuffer()->resourceUpdate(u);
+ // ... draw with buf
+ rhi->endFrame();
+ \endcode
+
+ \warning The maximum number of batches per QRhi is 64. When this limit is
+ reached, the function will return null until a batch is returned to the
+ pool.
*/
QRhiResourceUpdateBatch *QRhi::nextResourceUpdateBatch()
{
+ // By default we prefer spreading out the utilization of the 64 batches as
+ // much as possible, meaning we won't pick the first one even if it's free,
+ // but prefer picking one after the last picked one. Relevant due to how
+ // QVLA and QRhiBufferData allocations behind the bufferOps are reused; in
+ // typical Qt Quick scenes this leads to a form of (eventually) seeding all
+ // the 64 resource batches with buffer operation data allocations which are
+ // then reused in subsequent frames. This comes at the expense of using
+ // more memory, but has proven good results when (CPU) profiling typical
+ // Quick/Quick3D apps.
+ //
+ // Prefering memory over performance means that we always pick the first
+ // free batch, and triggering the aggressive deallocating of all backing
+ // memory (see trimOpLists) before returning it.
+ static const bool preferMemoryOverPerformance = qEnvironmentVariableIntValue("QT_RHI_MINIMIZE_POOLS");
+
auto nextFreeBatch = [this]() -> QRhiResourceUpdateBatch * {
- for (int i = 0, ie = d->resUpdPoolMap.count(); i != ie; ++i) {
- if (!d->resUpdPoolMap.testBit(i)) {
- d->resUpdPoolMap.setBit(i);
+ auto isFree = [this](int i) -> QRhiResourceUpdateBatch * {
+ const quint64 mask = 1ULL << quint64(i);
+ if (!(d->resUpdPoolMap & mask)) {
+ d->resUpdPoolMap |= mask;
QRhiResourceUpdateBatch *u = d->resUpdPool[i];
QRhiResourceUpdateBatchPrivate::get(u)->poolIndex = i;
+ if (!preferMemoryOverPerformance)
+ d->lastResUpdIdx = i;
return u;
}
+ return nullptr;
+ };
+ const int poolSize = d->resUpdPool.size();
+ for (int i = d->lastResUpdIdx + 1; i < poolSize; ++i) {
+ if (QRhiResourceUpdateBatch *u = isFree(i))
+ return u;
+ }
+ for (int i = 0; i <= d->lastResUpdIdx; ++i) {
+ if (QRhiResourceUpdateBatch *u = isFree(i))
+ return u;
}
return nullptr;
};
QRhiResourceUpdateBatch *u = nextFreeBatch();
if (!u) {
- const int oldSize = d->resUpdPool.count();
- const int newSize = oldSize + 4;
+ const int oldSize = d->resUpdPool.size();
+ const int newSize = oldSize + qMin(4, qMax(0, 64 - oldSize));
d->resUpdPool.resize(newSize);
- d->resUpdPoolMap.resize(newSize);
for (int i = oldSize; i < newSize; ++i)
d->resUpdPool[i] = new QRhiResourceUpdateBatch(d);
u = nextFreeBatch();
- Q_ASSERT(u);
+ if (!u)
+ qWarning("Resource update batch pool exhausted (max is 64)");
}
+ if (preferMemoryOverPerformance && u)
+ u->d->trimOpLists();
+
return u;
}
@@ -4528,28 +9313,71 @@ void QRhiResourceUpdateBatchPrivate::free()
{
Q_ASSERT(poolIndex >= 0 && rhi->resUpdPool[poolIndex] == q);
- bufferOps.clear();
- textureOps.clear();
+ activeBufferOpCount = 0;
+ activeTextureOpCount = 0;
- rhi->resUpdPoolMap.clearBit(poolIndex);
+ const quint64 mask = 1ULL << quint64(poolIndex);
+ rhi->resUpdPoolMap &= ~mask;
poolIndex = -1;
+
+ // textureOps is cleared, to not keep the potentially large image pixel
+ // data alive, but it is expected that the container keeps the list alloc
+ // at least. Only trimOpList() goes for the more aggressive route with squeeze.
+ textureOps.clear();
+
+ // bufferOps is not touched, to allow reusing allocations (incl. in the
+ // elements' QRhiBufferData) as much as possible when this batch is used
+ // again in the future, which is important for performance, in particular
+ // with Qt Quick.
}
void QRhiResourceUpdateBatchPrivate::merge(QRhiResourceUpdateBatchPrivate *other)
{
- bufferOps.reserve(bufferOps.size() + other->bufferOps.size());
- for (const BufferOp &op : qAsConst(other->bufferOps))
- bufferOps.append(op);
+ int combinedSize = activeBufferOpCount + other->activeBufferOpCount;
+ if (bufferOps.size() < combinedSize)
+ bufferOps.resize(combinedSize);
+ for (int i = activeBufferOpCount; i < combinedSize; ++i)
+ bufferOps[i] = std::move(other->bufferOps[i - activeBufferOpCount]);
+ activeBufferOpCount += other->activeBufferOpCount;
- textureOps.reserve(textureOps.size() + other->textureOps.size());
- for (const TextureOp &op : qAsConst(other->textureOps))
- textureOps.append(op);
+ combinedSize = activeTextureOpCount + other->activeTextureOpCount;
+ if (textureOps.size() < combinedSize)
+ textureOps.resize(combinedSize);
+ for (int i = activeTextureOpCount; i < combinedSize; ++i)
+ textureOps[i] = std::move(other->textureOps[i - activeTextureOpCount]);
+ activeTextureOpCount += other->activeTextureOpCount;
+}
+
+bool QRhiResourceUpdateBatchPrivate::hasOptimalCapacity() const
+{
+ return activeBufferOpCount < BUFFER_OPS_STATIC_ALLOC - 16
+ && activeTextureOpCount < TEXTURE_OPS_STATIC_ALLOC - 16;
+}
+
+void QRhiResourceUpdateBatchPrivate::trimOpLists()
+{
+ // Unlike free(), this is expected to aggressively deallocate all memory
+ // used by both the buffer and texture operation lists. (i.e. using
+ // squeeze() to only keep the stack prealloc of the QVLAs)
+ //
+ // This (e.g. just the destruction of bufferOps elements) may have a
+ // non-negligible performance impact e.g. with Qt Quick with scenes where
+ // there are lots of buffer operations per frame.
+
+ activeBufferOpCount = 0;
+ bufferOps.clear();
+ bufferOps.squeeze();
+
+ activeTextureOpCount = 0;
+ textureOps.clear();
+ textureOps.squeeze();
}
/*!
- Sometimes committing resource updates is necessary without starting a
- render pass. Not often needed, updates should typically be passed to
- beginPass (or endPass, in case of readbacks) instead.
+ Sometimes committing resource updates is necessary or just more convenient
+ without starting a render pass. Calling this function with \a
+ resourceUpdates is an alternative to passing \a resourceUpdates to a
+ beginPass() call (or endPass(), which would be typical in case of readbacks).
\note Cannot be called inside a pass.
*/
@@ -4588,13 +9416,37 @@ void QRhiCommandBuffer::resourceUpdate(QRhiResourceUpdateBatch *resourceUpdates)
called inside a pass. Also, with the exception of setGraphicsPipeline(),
they expect to have a pipeline set already on the command buffer.
Unspecified issues may arise otherwise, depending on the backend.
+
+ If \a rt is a QRhiTextureRenderTarget, beginPass() performs a check to see
+ if the texture and renderbuffer objects referenced from the render target
+ are up-to-date. This is similar to what setShaderResources() does for
+ QRhiShaderResourceBindings. If any of the attachments had been rebuilt
+ since QRhiTextureRenderTarget::create(), an implicit call to create() is
+ made on \a rt. Therefore, if \a rt has a QRhiTexture color attachment \c
+ texture, and one needs to make the texture a different size, the following
+ is then valid:
+ \code
+ QRhiTextureRenderTarget *rt = rhi->newTextureRenderTarget({ { texture } });
+ rt->create();
+ // ...
+ texture->setPixelSize(new_size);
+ texture->create();
+ cb->beginPass(rt, colorClear, dsClear); // this is ok, no explicit rt->create() is required before
+ \endcode
+
+ \a flags allow controlling certain advanced functionality. One commonly used
+ flag is \c ExternalContents. This should be specified whenever
+ beginExternal() will be called within the pass started by this function.
+
+ \sa endPass(), BeginPassFlags
*/
void QRhiCommandBuffer::beginPass(QRhiRenderTarget *rt,
const QColor &colorClearValue,
const QRhiDepthStencilClearValue &depthStencilClearValue,
- QRhiResourceUpdateBatch *resourceUpdates)
+ QRhiResourceUpdateBatch *resourceUpdates,
+ BeginPassFlags flags)
{
- m_rhi->beginPass(this, rt, colorClearValue, depthStencilClearValue, resourceUpdates);
+ m_rhi->beginPass(this, rt, colorClearValue, depthStencilClearValue, resourceUpdates, flags);
}
/*!
@@ -4602,6 +9454,8 @@ void QRhiCommandBuffer::beginPass(QRhiRenderTarget *rt,
\a resourceUpdates, when not null, specifies a resource update batch that
is to be committed and then released.
+
+ \sa beginPass()
*/
void QRhiCommandBuffer::endPass(QRhiResourceUpdateBatch *resourceUpdates)
{
@@ -4620,9 +9474,12 @@ void QRhiCommandBuffer::endPass(QRhiResourceUpdateBatch *resourceUpdates)
\note This function can only be called inside a render pass, meaning
between a beginPass() and endPass() call.
+
+ \note The new graphics pipeline \a ps must be a valid pointer.
*/
void QRhiCommandBuffer::setGraphicsPipeline(QRhiGraphicsPipeline *ps)
{
+ Q_ASSERT(ps != nullptr);
m_rhi->setGraphicsPipeline(this, ps);
}
@@ -4636,17 +9493,24 @@ void QRhiCommandBuffer::setGraphicsPipeline(QRhiGraphicsPipeline *ps)
\l{QRhiShaderResourceBindings::isLayoutCompatible()}{layout-compatible},
meaning the layout (number of bindings, the type and binding number of each
binding) must fully match the QRhiShaderResourceBindings that was
- associated with the pipeline at the time of calling the pipeline's build().
+ associated with the pipeline at the time of calling the pipeline's create().
There are cases when a seemingly unnecessary setShaderResources() call is
mandatory: when rebuilding a resource referenced from \a srb, for example
- changing the size of a QRhiBuffer followed by a QRhiBuffer::build(), this
+ changing the size of a QRhiBuffer followed by a QRhiBuffer::create(), this
is the place where associated native objects (such as descriptor sets in
case of Vulkan) are updated to refer to the current native resources that
back the QRhiBuffer, QRhiTexture, QRhiSampler objects referenced from \a
srb. In this case setShaderResources() must be called even if \a srb is
the same as in the last call.
+ When \a srb is not null, the QRhiShaderResourceBindings object the pipeline
+ was built with in create() is guaranteed to be not accessed in any form. In
+ fact, it does not need to be valid even at this point: destroying the
+ pipeline's associated srb after create() and instead explicitly specifying
+ another, \l{QRhiShaderResourceBindings::isLayoutCompatible()}{layout
+ compatible} one in every setShaderResources() call is valid.
+
\a dynamicOffsets allows specifying buffer offsets for uniform buffers that
were associated with \a srb via
QRhiShaderResourceBinding::uniformBufferWithDynamicOffset(). This is
@@ -4660,6 +9524,9 @@ void QRhiCommandBuffer::setGraphicsPipeline(QRhiGraphicsPipeline *ps)
\note All offsets in \a dynamicOffsets must be byte aligned to the value
returned from QRhi::ubufAlignment().
+ \note Some backends may limit the number of supported dynamic offsets.
+ Avoid using a \a dynamicOffsetCount larger than 8.
+
\note QRhi will optimize out unnecessary invocations within a pass (taking
the conditions described above into account), so therefore overoptimizing
to avoid calls to this function is not necessary on the applications' side.
@@ -4688,6 +9555,9 @@ void QRhiCommandBuffer::setShaderResources(QRhiShaderResourceBindings *srb,
in \a bindings. Each element in \a bindings specifies a QRhiBuffer and an
offset.
+ \note Some backends may limit the number of vertex buffer bindings. Avoid
+ using a \a bindingCount larger than 8.
+
Superfluous vertex input and index changes in the same pass are ignored
automatically with most backends and therefore applications do not need to
overoptimize to avoid calls to this function.
@@ -4706,7 +9576,7 @@ void QRhiCommandBuffer::setShaderResources(QRhiShaderResourceBindings *srb,
floats for position (so 5 floats per vertex: x, y, r, g, b). A QRhiGraphicsPipeline for
this shader can then be created using the input layout:
- \badcode
+ \code
QRhiVertexInputLayout inputLayout;
inputLayout.setBindings({
{ 5 * sizeof(float) }
@@ -4719,11 +9589,10 @@ void QRhiCommandBuffer::setShaderResources(QRhiShaderResourceBindings *srb,
Here there is one buffer binding (binding number 0), with two inputs
referencing it. When recording the pass, once the pipeline is set, the
- vertex bindings can be specified simply like the following (using C++11
- initializer syntax), assuming vbuf is the QRhiBuffer with all the
- interleaved position+color data:
+ vertex bindings can be specified simply like the following, assuming vbuf
+ is the QRhiBuffer with all the interleaved position+color data:
- \badcode
+ \code
const QRhiCommandBuffer::VertexInput vbufBinding(vbuf, 0);
cb->setVertexInput(0, 1, &vbufBinding);
\endcode
@@ -4863,8 +9732,9 @@ void QRhiCommandBuffer::drawIndexed(quint32 indexCount,
}
/*!
- Records a named debug group on the command buffer. This is shown in
- graphics debugging tools such as \l{https://renderdoc.org/}{RenderDoc} and
+ Records a named debug group on the command buffer with the specified \a
+ name. This is shown in graphics debugging tools such as
+ \l{https://renderdoc.org/}{RenderDoc} and
\l{https://developer.apple.com/xcode/}{XCode}. The end of the grouping is
indicated by debugMarkEnd().
@@ -4922,10 +9792,12 @@ void QRhiCommandBuffer::debugMarkMsg(const QByteArray &msg)
\note Compute is only available when the \l{QRhi::Compute}{Compute} feature
is reported as supported.
+
+ \a flags is not currently used.
*/
-void QRhiCommandBuffer::beginComputePass(QRhiResourceUpdateBatch *resourceUpdates)
+void QRhiCommandBuffer::beginComputePass(QRhiResourceUpdateBatch *resourceUpdates, BeginPassFlags flags)
{
- m_rhi->beginComputePass(this, resourceUpdates);
+ m_rhi->beginComputePass(this, resourceUpdates, flags);
}
/*!
@@ -4963,6 +9835,18 @@ void QRhiCommandBuffer::setComputePipeline(QRhiComputePipeline *ps)
\note This function can only be called inside a compute pass, meaning
between a beginComputePass() and endComputePass() call.
+
+ \note \a x, \a y, and \a z must fit the limits from the underlying graphics
+ API implementation at run time. The maximum values are typically 65535.
+
+ \note Watch out for possible limits on the local workgroup size as well.
+ This is specified in the shader, for example: \c{layout(local_size_x = 16,
+ local_size_y = 16) in;}. For example, with OpenGL the minimum value mandated
+ by the specification for the number of invocations in a single local work
+ group (the product of \c local_size_x, \c local_size_y, and \c local_size_z)
+ is 1024, while with OpenGL ES (3.1) the value may be as low as 128. This
+ means that the example given above may be rejected by some OpenGL ES
+ implementations as the number of invocations is 256.
*/
void QRhiCommandBuffer::dispatch(int x, int y, int z)
{
@@ -4971,7 +9855,7 @@ void QRhiCommandBuffer::dispatch(int x, int y, int z)
/*!
\return a pointer to a backend-specific QRhiNativeHandles subclass, such as
- QRhiVulkanCommandBufferNativeHandles. The returned value is null when
+ QRhiVulkanCommandBufferNativeHandles. The returned value is \nullptr when
exposing the underlying native resources is not supported by, or not
applicable to, the backend.
@@ -4988,14 +9872,14 @@ const QRhiNativeHandles *QRhiCommandBuffer::nativeHandles()
enqueue commands to the current pass' command buffer by calling graphics
API functions directly.
- \note This is only available when the intent was declared up front in
- beginFrame(). Therefore this function must only be called when the frame
- was started with specifying QRhi::ExternalContentsInPass in the flags
- passed to QRhi::beginFrame().
+ \note This is only available when the intent was declared upfront in
+ beginPass() or beginComputePass(). Therefore this function must only be
+ called when the pass recording was started with specifying
+ QRhiCommandBuffer::ExternalContent.
- With Vulkan or Metal one can query the native command buffer or encoder
- objects via nativeHandles() and enqueue commands to them. With OpenGL or
- Direct3D 11 the (device) context can be retrieved from
+ With Vulkan, Metal, or Direct3D 12 one can query the native command buffer
+ or encoder objects via nativeHandles() and enqueue commands to them. With
+ OpenGL or Direct3D 11 the (device) context can be retrieved from
QRhi::nativeHandles(). However, this must never be done without ensuring
the QRhiCommandBuffer's state stays up-to-date. Hence the requirement for
wrapping any externally added command recording between beginExternal() and
@@ -5043,6 +9927,72 @@ void QRhiCommandBuffer::endExternal()
}
/*!
+ \return the last available timestamp, in seconds, when
+ \l QRhi::EnableTimestamps was enabled when creating the QRhi. The value
+ indicates the elapsed time on the GPU during the last completed frame.
+
+ \note Do not expect results other than 0 when the QRhi::Timestamps feature
+ is not reported as supported, or when QRhi::EnableTimestamps was not passed
+ to QRhi::create(). There are exceptions to this, because with some graphics
+ APIs (Metal) timings are available without having to perform extra
+ operations (timestamp queries), but portable applications should always
+ consciously opt-in to timestamp collection when they know it is needed, and
+ call this function accordingly.
+
+ Care must be exercised with the interpretation of the value, as its
+ precision and granularity is often not controlled by Qt, and depends on the
+ underlying graphics API and its implementation. In particular, comparing
+ the values between different graphics APIs and hardware is discouraged and
+ may be meaningless.
+
+ When the frame was recorded with \l{QRhi::beginFrame()}{beginFrame()} and
+ \l{QRhi::endFrame()}{endFrame()}, i.e., with a swapchain, the timing values
+ will likely become available asynchronously. The returned value may
+ therefore be 0 (e.g., for the first 1-2 frames) or the last known value
+ referring to some previous frame. The value my also
+ become 0 again under certain conditions, such as when resizing the window.
+ It can be expected that the most up-to-date available value is retrieved in
+ beginFrame() and becomes queriable via this function once beginFrame()
+ returns.
+
+ \note Do not assume that the value refers to the previous
+ (\c{currently_recorded - 1}) frame. It may refer to \c{currently_recorded -
+ 2} or \c{currently_recorded - 3} as well. The exact behavior may depend on
+ the graphics API and its implementation.
+
+ On the other hand, with offscreen frames the returned value is up-to-date
+ once \l{QRhi::endOffscreenFrame()}{endOffscreenFrame()} returns, because
+ offscreen frames reduce GPU pipelining and wait the the commands to be
+ complete.
+
+ \note This means that, unlike with swapchain frames, with offscreen frames
+ the returned value is guaranteed to refer to the frame that has just been
+ submitted and completed. (assuming this function is called after
+ endOffscreenFrame() but before the next beginOffscreenFrame())
+
+ Watch out for the consequences of GPU frequency scaling and GPU clock
+ changes, depending on the platform. For example, on Windows the returned
+ timing may vary in a quite wide range between frames with modern graphics
+ cards, even when submitting frames with a similar, or the same workload.
+ This is out of scope for Qt to control and solve, generally speaking.
+ However, the D3D12 backend automatically calls
+ \l{https://learn.microsoft.com/en-us/windows/win32/api/d3d12/nf-d3d12-id3d12device-setstablepowerstate}{ID3D12Device::SetStablePowerState()}
+ whenever the environment variable \c QT_D3D_STABLE_POWER_STATE is set to a
+ non-zero value. This can greatly stabilize the result. It can also have a
+ non-insignificant effect on the CPU-side timings measured via QElapsedTimer
+ for example, especially when offscreen frames are involved.
+
+ \note Do not and never ship applications to production with
+ \c QT_D3D_STABLE_POWER_STATE set. See the Windows API documentation for details.
+
+ \sa QRhi::Timestamps, QRhi::EnableTimestamps
+ */
+double QRhiCommandBuffer::lastCompletedGpuTime()
+{
+ return m_rhi->lastCompletedGpuTime(this);
+}
+
+/*!
\return the value (typically an offset) \a v aligned to the uniform buffer
alignment given by by ubufAlignment().
*/
@@ -5055,7 +10005,7 @@ int QRhi::ubufAligned(int v) const
/*!
\return the number of mip levels for a given \a size.
*/
-int QRhi::mipLevelsForSize(const QSize &size) const
+int QRhi::mipLevelsForSize(const QSize &size)
{
return qFloor(std::log2(qMax(size.width(), size.height()))) + 1;
}
@@ -5064,7 +10014,7 @@ int QRhi::mipLevelsForSize(const QSize &size) const
\return the texture image size for a given \a mipLevel, calculated based on
the level 0 size given in \a baseLevelSize.
*/
-QSize QRhi::sizeForMipLevel(int mipLevel, const QSize &baseLevelSize) const
+QSize QRhi::sizeForMipLevel(int mipLevel, const QSize &baseLevelSize)
{
const int w = qMax(1, baseLevelSize.width() >> mipLevel);
const int h = qMax(1, baseLevelSize.height() >> mipLevel);
@@ -5097,13 +10047,24 @@ bool QRhi::isYUpInNDC() const
}
/*!
- \return \c true if the underlying graphics API uses depth 0 - 1 in clip
- space.
+ \return \c true if the underlying graphics API uses depth range [0, 1] in
+ clip space.
- In practice this is \c false for OpenGL only.
+ In practice this is \c false for OpenGL only, because OpenGL uses a
+ post-projection depth range of [-1, 1]. (not to be confused with the
+ NDC-to-window mapping controlled by glDepthRange(), which uses a range of
+ [0, 1], unless overridden by the QRhiViewport) In some OpenGL versions
+ glClipControl() could be used to change this, but the OpenGL backend of
+ QRhi does not use that function as it is not available in OpenGL ES or
+ OpenGL versions lower than 4.5.
\note clipSpaceCorrMatrix() includes the corresponding adjustment in its
- returned matrix.
+ returned matrix. Therefore, many users of QRhi do not need to take any
+ further measures apart from pre-multiplying their projection matrices with
+ clipSpaceCorrMatrix(). However, some graphics techniques, such as, some
+ types of shadow mapping, involve working with and outputting depth values
+ in the shaders. These will need to query and take the value of this
+ function into account as appropriate.
*/
bool QRhi::isClipDepthZeroToOne() const
{
@@ -5113,11 +10074,15 @@ bool QRhi::isClipDepthZeroToOne() const
/*!
\return a matrix that can be used to allow applications keep using
OpenGL-targeted vertex data and perspective projection matrices (such as,
- the ones generated by QMatrix4x4::perspective()), regardless of the
- backend. Once \c{this_matrix * mvp} is used instead of just \c mvp, vertex
- data with Y up and viewports with depth range 0 - 1 can be used without
- considering what backend and so graphics API is going to be used at run
- time.
+ the ones generated by QMatrix4x4::perspective()), regardless of the active
+ QRhi backend.
+
+ In a typical renderer, once \c{this_matrix * mvp} is used instead of just
+ \c mvp, vertex data with Y up and viewports with depth range 0 - 1 can be
+ used without considering what backend (and so graphics API) is going to be
+ used at run time. This way branching based on isYUpInNDC() and
+ isClipDepthZeroToOne() can be avoided (although such logic may still become
+ required when implementing certain advanced graphics techniques).
See
\l{https://matthewwellings.com/blog/the-new-vulkan-coordinate-system/}{this
@@ -5163,7 +10128,8 @@ int QRhi::resourceLimit(ResourceLimit limit) const
for the device, context, and similar concepts used by the backend.
Cast to QRhiVulkanNativeHandles, QRhiD3D11NativeHandles,
- QRhiGles2NativeHandles, QRhiMetalNativeHandles as appropriate.
+ QRhiD3D12NativeHandles, QRhiGles2NativeHandles, or QRhiMetalNativeHandles
+ as appropriate.
\note No ownership is transferred, neither for the returned pointer nor for
any native objects.
@@ -5195,18 +10161,6 @@ bool QRhi::makeThreadLocalNativeContextCurrent()
}
/*!
- \return the associated QRhiProfiler instance.
-
- An instance is always available for each QRhi, but it is not very useful
- without EnableProfiling because no data is collected without setting the
- flag upon creation.
- */
-QRhiProfiler *QRhi::profiler()
-{
- return &d->profiler;
-}
-
-/*!
Attempts to release resources in the backend's caches. This can include both
CPU and GPU resources. Only memory and resources that can be recreated
automatically are in scope. As an example, if the backend's
@@ -5221,15 +10175,20 @@ QRhiProfiler *QRhi::profiler()
void QRhi::releaseCachedResources()
{
d->releaseCachedResources();
+
+ for (QRhiResourceUpdateBatch *u : d->resUpdPool) {
+ if (u->d->poolIndex < 0)
+ u->d->trimOpLists();
+ }
}
/*!
\return true if the graphics device was lost.
The loss of the device is typically detected in beginFrame(), endFrame() or
- QRhiSwapChain::buildOrResize(), depending on the backend and the underlying
+ QRhiSwapChain::createOrResize(), depending on the backend and the underlying
native APIs. The most common is endFrame() because that is where presenting
- happens. With some backends QRhiSwapChain::buildOrResize() can also fail
+ happens. With some backends QRhiSwapChain::createOrResize() can also fail
due to a device loss. Therefore this function is provided as a generic way
to check if a device loss was detected by a previous operation.
@@ -5271,9 +10230,238 @@ bool QRhi::isDeviceLost() const
}
/*!
+ \return a binary data blob with data collected from the
+ QRhiGraphicsPipeline and QRhiComputePipeline successfully created during
+ the lifetime of this QRhi.
+
+ By saving and then, in subsequent runs of the same application, reloading
+ the cache data, pipeline and shader creation times can potentially be
+ reduced. What exactly the cache and its serialized version includes is not
+ specified, is always specific to the backend used, and in some cases also
+ dependent on the particular implementation of the graphics API.
+
+ When the PipelineCacheDataLoadSave is reported as unsupported, the returned
+ QByteArray is empty.
+
+ When the EnablePipelineCacheDataSave flag was not specified when calling
+ create(), the returned QByteArray may be empty, even when the
+ PipelineCacheDataLoadSave feature is supported.
+
+ When the returned data is non-empty, it is always specific to the Qt
+ version and QRhi backend. In addition, in some cases there is a strong
+ dependency to the graphics device and the exact driver version used. QRhi
+ takes care of adding the appropriate header and safeguards that ensure that
+ the data can always be passed safely to setPipelineCacheData(), therefore
+ attempting to load data from a run on another version of a driver will be
+ handled safely and gracefully.
+
+ \note Calling releaseCachedResources() may, depending on the backend, clear
+ the pipeline data collected. A subsequent call to this function may then
+ not return any data.
+
+ See EnablePipelineCacheDataSave for further details about this feature.
+
+ \note Minimize the number of calls to this function. Retrieving the blob is
+ not always a cheap operation, and therefore this function should only be
+ called at a low frequency, ideally only once e.g. when closing the
+ application.
+
+ \sa setPipelineCacheData(), create(), isFeatureSupported()
+ */
+QByteArray QRhi::pipelineCacheData()
+{
+ return d->pipelineCacheData();
+}
+
+/*!
+ Loads \a data into the pipeline cache, when applicable.
+
+ When the PipelineCacheDataLoadSave is reported as unsupported, the function
+ is safe to call, but has no effect.
+
+ The blob returned by pipelineCacheData() is always specific to the Qt
+ version, the QRhi backend, and, in some cases, also to the graphics device,
+ and a given version of the graphics driver. QRhi takes care of adding the
+ appropriate header and safeguards that ensure that the data can always be
+ passed safely to this function. If there is a mismatch, e.g. because the
+ driver has been upgraded to a newer version, or because the data was
+ generated from a different QRhi backend, a warning is printed and \a data
+ is safely ignored.
+
+ With Vulkan, this maps directly to VkPipelineCache. Calling this function
+ creates a new Vulkan pipeline cache object, with its initial data sourced
+ from \a data. The pipeline cache object is then used by all subsequently
+ created QRhiGraphicsPipeline and QRhiComputePipeline objects, thus
+ accelerating, potentially, the pipeline creation.
+
+ With other APIs there is no real pipeline cache, but they may provide a
+ cache with bytecode from shader compilations (D3D) or program binaries
+ (OpenGL). In applications that perform a lot of shader compilation from
+ source at run time this can provide a significant boost in subsequent runs
+ if the "pipeline cache" is pre-seeded from an earlier run using this
+ function.
+
+ \note QRhi cannot give any guarantees that \a data has an effect on the
+ pipeline and shader creation performance. With APIs like Vulkan, it is up
+ to the driver to decide if \a data is used for some purpose, or if it is
+ ignored.
+
+ See EnablePipelineCacheDataSave for further details about this feature.
+
+ \note This mechanism offered by QRhi is independent of the drivers' own
+ internal caching mechanism, if any. This means that, depending on the
+ graphics API and its implementation, the exact effects of retrieving and
+ then reloading \a data are not predictable. Improved performance may not be
+ visible at all in case other caching mechanisms outside of Qt's control are
+ already active.
+
+ \note Minimize the number of calls to this function. Loading the blob is
+ not always a cheap operation, and therefore this function should only be
+ called at a low frequency, ideally only once e.g. when starting the
+ application.
+
+ \sa pipelineCacheData(), isFeatureSupported()
+ */
+void QRhi::setPipelineCacheData(const QByteArray &data)
+{
+ d->setPipelineCacheData(data);
+}
+
+/*!
+ \struct QRhiStats
+ \inmodule QtGui
+ \since 6.6
+
+ \brief Statistics provided from the underlying memory allocator.
+
+ \note This is a RHI API with limited compatibility guarantees, see \l QRhi
+ for details.
+ */
+
+/*!
+ \variable QRhiStats::totalPipelineCreationTime
+
+ The total time in milliseconds spent in graphics and compute pipeline
+ creation, which usually involves shader compilation or cache lookups, and
+ potentially expensive processing.
+
+ \note The value should not be compared between different backends since the
+ concept of "pipelines" and what exactly happens under the hood during, for
+ instance, a call to QRhiGraphicsPipeline::create(), differ greatly between
+ graphics APIs and their implementations.
+
+ \sa QRhi::statistics()
+*/
+
+/*!
+ \variable QRhiStats::blockCount
+
+ Statistic reported from the Vulkan or D3D12 memory allocator.
+
+ \sa QRhi::statistics()
+*/
+
+/*!
+ \variable QRhiStats::allocCount
+
+ Statistic reported from the Vulkan or D3D12 memory allocator.
+
+ \sa QRhi::statistics()
+*/
+
+/*!
+ \variable QRhiStats::usedBytes
+
+ Statistic reported from the Vulkan or D3D12 memory allocator.
+
+ \sa QRhi::statistics()
+*/
+
+/*!
+ \variable QRhiStats::unusedBytes
+
+ Statistic reported from the Vulkan or D3D12 memory allocator.
+
+ \sa QRhi::statistics()
+*/
+
+/*!
+ \variable QRhiStats::totalUsageBytes
+
+ Valid only with D3D12 currently. Matches IDXGIAdapter3::QueryVideoMemoryInfo().
+
+ \sa QRhi::statistics()
+*/
+
+#ifndef QT_NO_DEBUG_STREAM
+QDebug operator<<(QDebug dbg, const QRhiStats &info)
+{
+ QDebugStateSaver saver(dbg);
+ dbg.nospace() << "QRhiStats("
+ << "totalPipelineCreationTime=" << info.totalPipelineCreationTime
+ << " blockCount=" << info.blockCount
+ << " allocCount=" << info.allocCount
+ << " usedBytes=" << info.usedBytes
+ << " unusedBytes=" << info.unusedBytes
+ << " totalUsageBytes=" << info.totalUsageBytes
+ << ')';
+ return dbg;
+}
+#endif
+
+/*!
+ Gathers and returns statistics about the timings and allocations of
+ graphics resources.
+
+ Data about memory allocations is only available with some backends, where
+ such operations are under Qt's control. With graphics APIs where there is
+ no lower level control over resource memory allocations, this will never be
+ supported and all relevant fields in the results are 0.
+
+ With Vulkan in particular, the values are valid always, and are queried
+ from the underlying memory allocator library. This gives an insight into
+ the memory requirements of the active buffers and textures.
+
+ The same is true for Direct 3D 12. In addition to the memory allocator
+ library's statistics, here the result also includes a \c totalUsageBytes
+ field which reports the total size including additional resources that are
+ not under the memory allocator library's control (swapchain buffers,
+ descriptor heaps, etc.), as reported by DXGI.
+
+ The values correspond to all types of memory used, combined. (i.e. video +
+ system in case of a discreet GPU)
+
+ Additional data, such as the total time in milliseconds spent in graphics
+ and compute pipeline creation (which usually involves shader compilation or
+ cache lookups, and potentially expensive processing) is available with most
+ backends.
+
+ \note The elapsed times for operations such as pipeline creation may be
+ affected by various factors. The results should not be compared between
+ different backends since the concept of "pipelines" and what exactly
+ happens under the hood during, for instance, a call to
+ QRhiGraphicsPipeline::create(), differ greatly between graphics APIs and
+ their implementations.
+
+ \note Additionally, many drivers will likely employ various caching
+ strategies for shaders, programs, pipelines. (independently of Qt's own
+ similar facilities, such as setPipelineCacheData() or the OpenGL-specific
+ program binary disk cache). Because such internal behavior is transparent
+ to the API client, Qt and QRhi have no knowledge or control over the exact
+ caching strategy, persistency, invalidation of the cached data, etc. When
+ reading timings, such as the time spent on pipeline creation, the potential
+ presence and unspecified behavior of driver-level caching mechanisms should
+ be kept in mind.
+ */
+QRhiStats QRhi::statistics() const
+{
+ return d->statistics();
+}
+
+/*!
\return a new graphics pipeline resource.
- \sa QRhiResource::release()
+ \sa QRhiResource::destroy()
*/
QRhiGraphicsPipeline *QRhi::newGraphicsPipeline()
{
@@ -5286,7 +10474,7 @@ QRhiGraphicsPipeline *QRhi::newGraphicsPipeline()
\note Compute is only available when the \l{QRhi::Compute}{Compute} feature
is reported as supported.
- \sa QRhiResource::release()
+ \sa QRhiResource::destroy()
*/
QRhiComputePipeline *QRhi::newComputePipeline()
{
@@ -5296,7 +10484,7 @@ QRhiComputePipeline *QRhi::newComputePipeline()
/*!
\return a new shader resource binding collection resource.
- \sa QRhiResource::release()
+ \sa QRhiResource::destroy()
*/
QRhiShaderResourceBindings *QRhi::newShaderResourceBindings()
{
@@ -5315,11 +10503,11 @@ QRhiShaderResourceBindings *QRhi::newShaderResourceBindings()
the value of \a size. QRhiBuffer::size() will always report back the value
that was requested in \a size.
- \sa QRhiResource::release()
+ \sa QRhiResource::destroy()
*/
QRhiBuffer *QRhi::newBuffer(QRhiBuffer::Type type,
QRhiBuffer::UsageFlags usage,
- int size)
+ quint32 size)
{
return d->createBuffer(type, usage, size);
}
@@ -5328,54 +10516,167 @@ QRhiBuffer *QRhi::newBuffer(QRhiBuffer::Type type,
\return a new renderbuffer with the specified \a type, \a pixelSize, \a
sampleCount, and \a flags.
- \sa QRhiResource::release()
+ When \a backingFormatHint is set to a texture format other than
+ QRhiTexture::UnknownFormat, it may be used by the backend to decide what
+ format to use for the storage backing the renderbuffer.
+
+ \note \a backingFormatHint becomes relevant typically when multisampling
+ and floating point texture formats are involved: rendering into a
+ multisample QRhiRenderBuffer and then resolving into a non-RGBA8
+ QRhiTexture implies (with some graphics APIs) that the storage backing the
+ QRhiRenderBuffer uses the matching non-RGBA8 format. That means that
+ passing a format like QRhiTexture::RGBA32F is important, because backends
+ will typically opt for QRhiTexture::RGBA8 by default, which would then
+ break later on due to attempting to set up RGBA8->RGBA32F multisample
+ resolve in the color attachment(s) of the QRhiTextureRenderTarget.
+
+ \sa QRhiResource::destroy()
*/
QRhiRenderBuffer *QRhi::newRenderBuffer(QRhiRenderBuffer::Type type,
const QSize &pixelSize,
int sampleCount,
- QRhiRenderBuffer::Flags flags)
+ QRhiRenderBuffer::Flags flags,
+ QRhiTexture::Format backingFormatHint)
{
- return d->createRenderBuffer(type, pixelSize, sampleCount, flags);
+ return d->createRenderBuffer(type, pixelSize, sampleCount, flags, backingFormatHint);
}
/*!
- \return a new texture with the specified \a format, \a pixelSize, \a
+ \return a new 1D or 2D texture with the specified \a format, \a pixelSize, \a
sampleCount, and \a flags.
+ A 1D texture array must have QRhiTexture::OneDimensional set in \a flags. This
+ function will implicitly set this flag if the \a pixelSize height is 0.
+
\note \a format specifies the requested internal and external format,
meaning the data to be uploaded to the texture will need to be in a
compatible format, while the native texture may (but is not guaranteed to,
in case of OpenGL at least) use this format internally.
- \sa QRhiResource::release()
+ \note 1D textures are only functional when the OneDimensionalTextures feature is
+ reported as supported at run time. Further, mipmaps on 1D textures are only
+ functional when the OneDimensionalTextureMipmaps feature is reported at run time.
+
+ \sa QRhiResource::destroy()
*/
QRhiTexture *QRhi::newTexture(QRhiTexture::Format format,
const QSize &pixelSize,
int sampleCount,
QRhiTexture::Flags flags)
{
- return d->createTexture(format, pixelSize, sampleCount, flags);
+ if (pixelSize.height() == 0)
+ flags |= QRhiTexture::OneDimensional;
+
+ return d->createTexture(format, pixelSize, 1, 0, sampleCount, flags);
+}
+
+/*!
+ \return a new 1D, 2D or 3D texture with the specified \a format, \a width, \a
+ height, \a depth, \a sampleCount, and \a flags.
+
+ This overload is suitable for 3D textures because it allows specifying \a
+ depth. A 3D texture must have QRhiTexture::ThreeDimensional set in \a
+ flags, but using this overload that can be omitted because the flag is set
+ implicitly whenever \a depth is greater than 0. For 1D, 2D and cube textures \a
+ depth should be set to 0.
+
+ A 1D texture must have QRhiTexture::OneDimensional set in \a flags. This overload
+ will implicitly set this flag if both \a height and \a depth are 0.
+
+ \note 3D textures are only functional when the ThreeDimensionalTextures
+ feature is reported as supported at run time.
+
+ \note 1D textures are only functional when the OneDimensionalTextures feature is
+ reported as supported at run time. Further, mipmaps on 1D textures are only
+ functional when the OneDimensionalTextureMipmaps feature is reported at run time.
+
+ \overload
+ */
+QRhiTexture *QRhi::newTexture(QRhiTexture::Format format,
+ int width, int height, int depth,
+ int sampleCount,
+ QRhiTexture::Flags flags)
+{
+ if (depth > 0)
+ flags |= QRhiTexture::ThreeDimensional;
+
+ if (height == 0 && depth == 0)
+ flags |= QRhiTexture::OneDimensional;
+
+ return d->createTexture(format, QSize(width, height), depth, 0, sampleCount, flags);
+}
+
+/*!
+ \return a new 1D or 2D texture array with the specified \a format, \a arraySize,
+ \a pixelSize, \a sampleCount, and \a flags.
+
+ This function implicitly sets QRhiTexture::TextureArray in \a flags.
+
+ A 1D texture array must have QRhiTexture::OneDimensional set in \a flags. This
+ function will implicitly set this flag if the \a pixelSize height is 0.
+
+ \note Do not confuse texture arrays with arrays of textures. A QRhiTexture
+ created by this function is usable with 1D or 2D array samplers in the shader, for
+ example: \c{layout(binding = 1) uniform sampler2DArray texArr;}. Arrays of
+ textures refers to a list of textures that are exposed to the shader via
+ QRhiShaderResourceBinding::sampledTextures() and a count > 1, and declared
+ in the shader for example like this: \c{layout(binding = 1) uniform
+ sampler2D textures[4];}
+
+ \note This is only functional when the TextureArrays feature is reported as
+ supported at run time.
+
+ \note 1D textures are only functional when the OneDimensionalTextures feature is
+ reported as supported at run time. Further, mipmaps on 1D textures are only
+ functional when the OneDimensionalTextureMipmaps feature is reported at run time.
+
+
+ \sa newTexture()
+ */
+QRhiTexture *QRhi::newTextureArray(QRhiTexture::Format format,
+ int arraySize,
+ const QSize &pixelSize,
+ int sampleCount,
+ QRhiTexture::Flags flags)
+{
+ flags |= QRhiTexture::TextureArray;
+
+ if (pixelSize.height() == 0)
+ flags |= QRhiTexture::OneDimensional;
+
+ return d->createTexture(format, pixelSize, 1, arraySize, sampleCount, flags);
}
/*!
\return a new sampler with the specified magnification filter \a magFilter,
- minification filter \a minFilter, mipmapping mode \a mipmapMpde, and S/T
- addressing modes \a u and \a v.
+ minification filter \a minFilter, mipmapping mode \a mipmapMode, and the
+ addressing (wrap) modes \a addressU, \a addressV, and \a addressW.
- \sa QRhiResource::release()
+ \note Setting \a mipmapMode to a value other than \c None implies that
+ images for all relevant mip levels will be provided either via
+ \l{QRhiResourceUpdateBatch::uploadTexture()}{texture uploads} or by calling
+ \l{QRhiResourceUpdateBatch::generateMips()}{generateMips()} on the texture
+ that is used with this sampler. Attempting to use the sampler with a
+ texture that has no data for all relevant mip levels will lead to rendering
+ errors, with the exact behavior dependent on the underlying graphics API.
+
+ \sa QRhiResource::destroy()
*/
-QRhiSampler *QRhi::newSampler(QRhiSampler::Filter magFilter, QRhiSampler::Filter minFilter,
+QRhiSampler *QRhi::newSampler(QRhiSampler::Filter magFilter,
+ QRhiSampler::Filter minFilter,
QRhiSampler::Filter mipmapMode,
- QRhiSampler:: AddressMode u, QRhiSampler::AddressMode v)
+ QRhiSampler::AddressMode addressU,
+ QRhiSampler::AddressMode addressV,
+ QRhiSampler::AddressMode addressW)
{
- return d->createSampler(magFilter, minFilter, mipmapMode, u, v);
+ return d->createSampler(magFilter, minFilter, mipmapMode, addressU, addressV, addressW);
}
/*!
\return a new texture render target with color and depth/stencil
attachments given in \a desc, and with the specified \a flags.
- \sa QRhiResource::release()
+ \sa QRhiResource::destroy()
*/
QRhiTextureRenderTarget *QRhi::newTextureRenderTarget(const QRhiTextureRenderTargetDescription &desc,
@@ -5387,7 +10688,7 @@ QRhiTextureRenderTarget *QRhi::newTextureRenderTarget(const QRhiTextureRenderTar
/*!
\return a new swapchain.
- \sa QRhiResource::release(), QRhiSwapChain::buildOrResize()
+ \sa QRhiResource::destroy(), QRhiSwapChain::createOrResize()
*/
QRhiSwapChain *QRhi::newSwapChain()
{
@@ -5400,9 +10701,7 @@ QRhiSwapChain *QRhi::newSwapChain()
A frame consists of resource updates and one or more render and compute
passes.
- \a flags can indicate certain special cases. For example, the fact that
- QRhiCommandBuffer::beginExternal() will be called within this new frame
- must be declared up front by setting the ExternalContentsInPass flag.
+ \a flags can indicate certain special cases.
The high level pattern of rendering into a QWindow using a swapchain:
@@ -5410,10 +10709,10 @@ QRhiSwapChain *QRhi::newSwapChain()
\li Create a swapchain.
- \li Call QRhiSwapChain::buildOrResize() whenever the surface size is
+ \li Call QRhiSwapChain::createOrResize() whenever the surface size is
different than before.
- \li Call QRhiSwapChain::release() on
+ \li Call QRhiSwapChain::destroy() on
QPlatformSurfaceEvent::SurfaceAboutToBeDestroyed.
\li Then on every frame:
@@ -5435,7 +10734,7 @@ QRhiSwapChain *QRhi::newSwapChain()
value on failure. Some of these should be treated as soft, "try again
later" type of errors: When QRhi::FrameOpSwapChainOutOfDate is returned,
the swapchain is to be resized or updated by calling
- QRhiSwapChain::buildOrResize(). The application should then attempt to
+ QRhiSwapChain::createOrResize(). The application should then attempt to
generate a new frame. QRhi::FrameOpDeviceLost means the graphics device is
lost but this may also be recoverable by releasing all resources, including
the QRhi itself, and then recreating all resources. See isDeviceLost() for
@@ -5470,7 +10769,7 @@ QRhi::FrameOpResult QRhi::beginFrame(QRhiSwapChain *swapChain, BeginFrameFlags f
value on failure. Some of these should be treated as soft, "try again
later" type of errors: When QRhi::FrameOpSwapChainOutOfDate is returned,
the swapchain is to be resized or updated by calling
- QRhiSwapChain::buildOrResize(). The application should then attempt to
+ QRhiSwapChain::createOrResize(). The application should then attempt to
generate a new frame. QRhi::FrameOpDeviceLost means the graphics device is
lost but this may also be recoverable by releasing all resources, including
the QRhi itself, and then recreating all resources. See isDeviceLost() for
@@ -5485,10 +10784,10 @@ QRhi::FrameOpResult QRhi::endFrame(QRhiSwapChain *swapChain, EndFrameFlags flags
QRhi::FrameOpResult r = d->inFrame ? d->endFrame(swapChain, flags) : FrameOpSuccess;
d->inFrame = false;
- // releaseAndDestroyLater is a high level QRhi concept the backends know
+ // deleteLater is a high level QRhi concept the backends know
// nothing about - handle it here.
- qDeleteAll(d->pendingReleaseAndDestroyResources);
- d->pendingReleaseAndDestroyResources.clear();
+ qDeleteAll(d->pendingDeleteResources);
+ d->pendingDeleteResources.clear();
return r;
}
@@ -5529,7 +10828,7 @@ bool QRhi::isRecordingFrame() const
C++ containers and other types. It may also be similar to what an OpenGL or
Direct 3D 11 implementation performs internally for certain type of objects.
- In practice, such double (or tripple) buffering resources is realized in
+ In practice, such double (or triple) buffering resources is realized in
the Vulkan, Metal, and similar QRhi backends by having a fixed number of
native resource (such as, VkBuffer) \c slots behind a QRhiResource. That
can then be indexed by a frame slot index running 0, 1, ..,
@@ -5537,7 +10836,7 @@ bool QRhi::isRecordingFrame() const
All this is managed transparently to the users of QRhi. However,
applications that integrate rendering done directly with the graphics API
- may want to perform a similar double or tripple buffering of their own
+ may want to perform a similar double or triple buffering of their own
graphics resources. That is then most easily achieved by knowing the values
of the maximum number of in-flight frames (retrievable via resourceLimit())
and the current frame (slot) index (returned by this function).
@@ -5564,26 +10863,29 @@ int QRhi::currentFrameSlot() const
beginOffscreenFrame, endOffscreenFrame, beginFrame, ...) is possible too
but it does reduce parallelism so it should be done only infrequently.
- Offscreen frames do not let the CPU - potentially - generate another frame
+ Offscreen frames do not let the CPU potentially generate another frame
while the GPU is still processing the previous one. This has the side
effect that if readbacks are scheduled, the results are guaranteed to be
available once endOffscreenFrame() returns. That is not the case with
- frames targeting a swapchain.
+ frames targeting a swapchain: there the GPU is potentially better utilized,
+ but working with readback operations needs more care from the application
+ because endFrame(), unlike endOffscreenFrame(), does not guarantee that the
+ results from the readback are available at that point.
The skeleton of rendering a frame without a swapchain and then reading the
frame contents back could look like the following:
- \badcode
- QRhiReadbackResult rbResult;
- QRhiCommandBuffer *cb;
- beginOffscreenFrame(&cb);
- beginPass
- ...
- u = nextResourceUpdateBatch();
- u->readBackTexture(rb, &rbResult);
- endPass(u);
- endOffscreenFrame();
- // image data available in rbResult
+ \code
+ QRhiReadbackResult rbResult;
+ QRhiCommandBuffer *cb;
+ rhi->beginOffscreenFrame(&cb);
+ cb->beginPass(rt, colorClear, dsClear);
+ // ...
+ u = nextResourceUpdateBatch();
+ u->readBackTexture(rb, &rbResult);
+ cb->endPass(u);
+ rhi->endOffscreenFrame();
+ // image data available in rbResult
\endcode
\sa endOffscreenFrame(), beginFrame()
@@ -5601,7 +10903,9 @@ QRhi::FrameOpResult QRhi::beginOffscreenFrame(QRhiCommandBuffer **cb, BeginFrame
}
/*!
- Ends and waits for the offscreen frame.
+ Ends, submits, and waits for the offscreen frame.
+
+ \a flags is not currently used.
\sa beginOffscreenFrame()
*/
@@ -5612,8 +10916,8 @@ QRhi::FrameOpResult QRhi::endOffscreenFrame(EndFrameFlags flags)
QRhi::FrameOpResult r = d->inFrame ? d->endOffscreenFrame(flags) : FrameOpSuccess;
d->inFrame = false;
- qDeleteAll(d->pendingReleaseAndDestroyResources);
- d->pendingReleaseAndDestroyResources.clear();
+ qDeleteAll(d->pendingDeleteResources);
+ d->pendingDeleteResources.clear();
return r;
}
@@ -5642,8 +10946,11 @@ QRhi::FrameOpResult QRhi::finish()
With some backend this list of supported values is fixed in advance, while
with some others the (physical) device properties indicate what is
supported at run time.
+
+ \sa QRhiRenderBuffer::setSampleCount(), QRhiTexture::setSampleCount(),
+ QRhiGraphicsPipeline::setSampleCount(), QRhiSwapChain::setSampleCount()
*/
-QVector<int> QRhi::supportedSampleCounts() const
+QList<int> QRhi::supportedSampleCounts() const
{
return d->supportedSampleCounts();
}
@@ -5663,7 +10970,7 @@ int QRhi::ubufAlignment() const
return d->ubufAlignment();
}
-static QBasicAtomicInteger<QRhiGlobalObjectIdGenerator::Type> counter = Q_BASIC_ATOMIC_INITIALIZER(0);
+Q_CONSTINIT static QBasicAtomicInteger<QRhiGlobalObjectIdGenerator::Type> counter = Q_BASIC_ATOMIC_INITIALIZER(0);
QRhiGlobalObjectIdGenerator::Type QRhiGlobalObjectIdGenerator::newId()
{
@@ -5764,13 +11071,18 @@ QRhiPassResourceTracker::BufferStage QRhiPassResourceTracker::toPassTrackerBuffe
// pick the earlier stage (as this is going to be dstAccessMask)
if (stages.testFlag(QRhiShaderResourceBinding::VertexStage))
return QRhiPassResourceTracker::BufVertexStage;
+ if (stages.testFlag(QRhiShaderResourceBinding::TessellationControlStage))
+ return QRhiPassResourceTracker::BufTCStage;
+ if (stages.testFlag(QRhiShaderResourceBinding::TessellationEvaluationStage))
+ return QRhiPassResourceTracker::BufTEStage;
if (stages.testFlag(QRhiShaderResourceBinding::FragmentStage))
return QRhiPassResourceTracker::BufFragmentStage;
if (stages.testFlag(QRhiShaderResourceBinding::ComputeStage))
return QRhiPassResourceTracker::BufComputeStage;
+ if (stages.testFlag(QRhiShaderResourceBinding::GeometryStage))
+ return QRhiPassResourceTracker::BufGeometryStage;
- Q_UNREACHABLE();
- return QRhiPassResourceTracker::BufVertexStage;
+ Q_UNREACHABLE_RETURN(QRhiPassResourceTracker::BufVertexStage);
}
QRhiPassResourceTracker::TextureStage QRhiPassResourceTracker::toPassTrackerTextureStage(QRhiShaderResourceBinding::StageFlags stages)
@@ -5778,13 +11090,18 @@ QRhiPassResourceTracker::TextureStage QRhiPassResourceTracker::toPassTrackerText
// pick the earlier stage (as this is going to be dstAccessMask)
if (stages.testFlag(QRhiShaderResourceBinding::VertexStage))
return QRhiPassResourceTracker::TexVertexStage;
+ if (stages.testFlag(QRhiShaderResourceBinding::TessellationControlStage))
+ return QRhiPassResourceTracker::TexTCStage;
+ if (stages.testFlag(QRhiShaderResourceBinding::TessellationEvaluationStage))
+ return QRhiPassResourceTracker::TexTEStage;
if (stages.testFlag(QRhiShaderResourceBinding::FragmentStage))
return QRhiPassResourceTracker::TexFragmentStage;
if (stages.testFlag(QRhiShaderResourceBinding::ComputeStage))
return QRhiPassResourceTracker::TexComputeStage;
+ if (stages.testFlag(QRhiShaderResourceBinding::GeometryStage))
+ return QRhiPassResourceTracker::TexGeometryStage;
- Q_UNREACHABLE();
- return QRhiPassResourceTracker::TexVertexStage;
+ Q_UNREACHABLE_RETURN(QRhiPassResourceTracker::TexVertexStage);
}
QT_END_NAMESPACE
diff --git a/src/gui/rhi/qrhi.h b/src/gui/rhi/qrhi.h
new file mode 100644
index 0000000000..d20b7e00d1
--- /dev/null
+++ b/src/gui/rhi/qrhi.h
@@ -0,0 +1,2026 @@
+// Copyright (C) 2023 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
+
+#ifndef QRHI_H
+#define QRHI_H
+
+//
+// W A R N I N G
+// -------------
+//
+// This file is part of the RHI API, with limited compatibility guarantees.
+// Usage of this API may make your code source and binary incompatible with
+// future versions of Qt.
+//
+
+#include <QtGui/qtguiglobal.h>
+#include <QtCore/qsize.h>
+#include <QtCore/qlist.h>
+#include <QtCore/qvarlengtharray.h>
+#include <QtCore/qthread.h>
+#include <QtGui/qmatrix4x4.h>
+#include <QtGui/qcolor.h>
+#include <QtGui/qimage.h>
+#include <functional>
+#include <array>
+
+#include <rhi/qshader.h>
+
+QT_BEGIN_NAMESPACE
+
+class QWindow;
+class QRhi;
+class QRhiImplementation;
+class QRhiBuffer;
+class QRhiRenderBuffer;
+class QRhiTexture;
+class QRhiSampler;
+class QRhiCommandBuffer;
+class QRhiResourceUpdateBatch;
+class QRhiResourceUpdateBatchPrivate;
+class QRhiSwapChain;
+
+class Q_GUI_EXPORT QRhiDepthStencilClearValue
+{
+public:
+ QRhiDepthStencilClearValue() = default;
+ QRhiDepthStencilClearValue(float d, quint32 s);
+
+ float depthClearValue() const { return m_d; }
+ void setDepthClearValue(float d) { m_d = d; }
+
+ quint32 stencilClearValue() const { return m_s; }
+ void setStencilClearValue(quint32 s) { m_s = s; }
+
+private:
+ float m_d = 1.0f;
+ quint32 m_s = 0;
+
+ friend bool operator==(const QRhiDepthStencilClearValue &a, const QRhiDepthStencilClearValue &b) noexcept
+ {
+ return a.m_d == b.m_d && a.m_s == b.m_s;
+ }
+
+ friend bool operator!=(const QRhiDepthStencilClearValue &a, const QRhiDepthStencilClearValue &b) noexcept
+ {
+ return !(a == b);
+ }
+
+ friend size_t qHash(const QRhiDepthStencilClearValue &v, size_t seed = 0) noexcept
+ {
+ QtPrivate::QHashCombine hash;
+ seed = hash(seed, v.m_d);
+ seed = hash(seed, v.m_s);
+ return seed;
+ }
+};
+
+Q_DECLARE_TYPEINFO(QRhiDepthStencilClearValue, Q_RELOCATABLE_TYPE);
+
+#ifndef QT_NO_DEBUG_STREAM
+Q_GUI_EXPORT QDebug operator<<(QDebug, const QRhiDepthStencilClearValue &);
+#endif
+
+class Q_GUI_EXPORT QRhiViewport
+{
+public:
+ QRhiViewport() = default;
+ QRhiViewport(float x, float y, float w, float h, float minDepth = 0.0f, float maxDepth = 1.0f);
+
+ std::array<float, 4> viewport() const { return m_rect; }
+ void setViewport(float x, float y, float w, float h) {
+ m_rect[0] = x; m_rect[1] = y; m_rect[2] = w; m_rect[3] = h;
+ }
+
+ float minDepth() const { return m_minDepth; }
+ void setMinDepth(float minDepth) { m_minDepth = minDepth; }
+
+ float maxDepth() const { return m_maxDepth; }
+ void setMaxDepth(float maxDepth) { m_maxDepth = maxDepth; }
+
+private:
+ std::array<float, 4> m_rect { { 0.0f, 0.0f, 0.0f, 0.0f } };
+ float m_minDepth = 0.0f;
+ float m_maxDepth = 1.0f;
+
+ friend bool operator==(const QRhiViewport &a, const QRhiViewport &b) noexcept
+ {
+ return a.m_rect == b.m_rect
+ && a.m_minDepth == b.m_minDepth
+ && a.m_maxDepth == b.m_maxDepth;
+ }
+
+ friend bool operator!=(const QRhiViewport &a, const QRhiViewport &b) noexcept
+ {
+ return !(a == b);
+ }
+
+ friend size_t qHash(const QRhiViewport &v, size_t seed = 0) noexcept
+ {
+ QtPrivate::QHashCombine hash;
+ seed = hash(seed, v.m_rect[0]);
+ seed = hash(seed, v.m_rect[1]);
+ seed = hash(seed, v.m_rect[2]);
+ seed = hash(seed, v.m_rect[3]);
+ seed = hash(seed, v.m_minDepth);
+ seed = hash(seed, v.m_maxDepth);
+ return seed;
+ }
+};
+
+Q_DECLARE_TYPEINFO(QRhiViewport, Q_RELOCATABLE_TYPE);
+
+#ifndef QT_NO_DEBUG_STREAM
+Q_GUI_EXPORT QDebug operator<<(QDebug, const QRhiViewport &);
+#endif
+
+class Q_GUI_EXPORT QRhiScissor
+{
+public:
+ QRhiScissor() = default;
+ QRhiScissor(int x, int y, int w, int h);
+
+ std::array<int, 4> scissor() const { return m_rect; }
+ void setScissor(int x, int y, int w, int h) {
+ m_rect[0] = x; m_rect[1] = y; m_rect[2] = w; m_rect[3] = h;
+ }
+
+private:
+ std::array<int, 4> m_rect { { 0, 0, 0, 0 } };
+
+ friend bool operator==(const QRhiScissor &a, const QRhiScissor &b) noexcept
+ {
+ return a.m_rect == b.m_rect;
+ }
+
+ friend bool operator!=(const QRhiScissor &a, const QRhiScissor &b) noexcept
+ {
+ return !(a == b);
+ }
+
+ friend size_t qHash(const QRhiScissor &v, size_t seed = 0) noexcept
+ {
+ QtPrivate::QHashCombine hash;
+ seed = hash(seed, v.m_rect[0]);
+ seed = hash(seed, v.m_rect[1]);
+ seed = hash(seed, v.m_rect[2]);
+ seed = hash(seed, v.m_rect[3]);
+ return seed;
+ }
+};
+
+Q_DECLARE_TYPEINFO(QRhiScissor, Q_RELOCATABLE_TYPE);
+
+#ifndef QT_NO_DEBUG_STREAM
+Q_GUI_EXPORT QDebug operator<<(QDebug, const QRhiScissor &);
+#endif
+
+class Q_GUI_EXPORT QRhiVertexInputBinding
+{
+public:
+ enum Classification {
+ PerVertex,
+ PerInstance
+ };
+
+ QRhiVertexInputBinding() = default;
+ QRhiVertexInputBinding(quint32 stride, Classification cls = PerVertex, quint32 stepRate = 1);
+
+ quint32 stride() const { return m_stride; }
+ void setStride(quint32 s) { m_stride = s; }
+
+ Classification classification() const { return m_classification; }
+ void setClassification(Classification c) { m_classification = c; }
+
+ quint32 instanceStepRate() const { return m_instanceStepRate; }
+ void setInstanceStepRate(quint32 rate) { m_instanceStepRate = rate; }
+
+private:
+ quint32 m_stride = 0;
+ Classification m_classification = PerVertex;
+ quint32 m_instanceStepRate = 1;
+
+ friend bool operator==(const QRhiVertexInputBinding &a, const QRhiVertexInputBinding &b) noexcept
+ {
+ return a.m_stride == b.m_stride
+ && a.m_classification == b.m_classification
+ && a.m_instanceStepRate == b.m_instanceStepRate;
+ }
+
+ friend bool operator!=(const QRhiVertexInputBinding &a, const QRhiVertexInputBinding &b) noexcept
+ {
+ return !(a == b);
+ }
+
+ friend size_t qHash(const QRhiVertexInputBinding &v, size_t seed = 0) noexcept
+ {
+ QtPrivate::QHashCombine hash;
+ seed = hash(seed, v.m_stride);
+ seed = hash(seed, v.m_classification);
+ seed = hash(seed, v.m_instanceStepRate);
+ return seed;
+ }
+};
+
+Q_DECLARE_TYPEINFO(QRhiVertexInputBinding, Q_RELOCATABLE_TYPE);
+
+#ifndef QT_NO_DEBUG_STREAM
+Q_GUI_EXPORT QDebug operator<<(QDebug, const QRhiVertexInputBinding &);
+#endif
+
+class Q_GUI_EXPORT QRhiVertexInputAttribute
+{
+public:
+ enum Format {
+ Float4,
+ Float3,
+ Float2,
+ Float,
+ UNormByte4,
+ UNormByte2,
+ UNormByte,
+ UInt4,
+ UInt3,
+ UInt2,
+ UInt,
+ SInt4,
+ SInt3,
+ SInt2,
+ SInt,
+ Half4,
+ Half3,
+ Half2,
+ Half,
+ UShort4,
+ UShort3,
+ UShort2,
+ UShort,
+ SShort4,
+ SShort3,
+ SShort2,
+ SShort,
+ };
+
+ QRhiVertexInputAttribute() = default;
+ QRhiVertexInputAttribute(int binding, int location, Format format, quint32 offset, int matrixSlice = -1);
+
+ int binding() const { return m_binding; }
+ void setBinding(int b) { m_binding = b; }
+
+ int location() const { return m_location; }
+ void setLocation(int loc) { m_location = loc; }
+
+ Format format() const { return m_format; }
+ void setFormat(Format f) { m_format = f; }
+
+ quint32 offset() const { return m_offset; }
+ void setOffset(quint32 ofs) { m_offset = ofs; }
+
+ int matrixSlice() const { return m_matrixSlice; }
+ void setMatrixSlice(int slice) { m_matrixSlice = slice; }
+
+private:
+ int m_binding = 0;
+ int m_location = 0;
+ Format m_format = Float4;
+ quint32 m_offset = 0;
+ int m_matrixSlice = -1;
+
+ friend bool operator==(const QRhiVertexInputAttribute &a, const QRhiVertexInputAttribute &b) noexcept
+ {
+ return a.m_binding == b.m_binding
+ && a.m_location == b.m_location
+ && a.m_format == b.m_format
+ && a.m_offset == b.m_offset;
+ // matrixSlice excluded intentionally
+ }
+
+ friend bool operator!=(const QRhiVertexInputAttribute &a, const QRhiVertexInputAttribute &b) noexcept
+ {
+ return !(a == b);
+ }
+
+ friend size_t qHash(const QRhiVertexInputAttribute &v, size_t seed = 0) noexcept
+ {
+ QtPrivate::QHashCombine hash;
+ seed = hash(seed, v.m_binding);
+ seed = hash(seed, v.m_location);
+ seed = hash(seed, v.m_format);
+ seed = hash(seed, v.m_offset);
+ return seed;
+ }
+};
+
+Q_DECLARE_TYPEINFO(QRhiVertexInputAttribute, Q_RELOCATABLE_TYPE);
+
+#ifndef QT_NO_DEBUG_STREAM
+Q_GUI_EXPORT QDebug operator<<(QDebug, const QRhiVertexInputAttribute &);
+#endif
+
+class Q_GUI_EXPORT QRhiVertexInputLayout
+{
+public:
+ QRhiVertexInputLayout() = default;
+
+ void setBindings(std::initializer_list<QRhiVertexInputBinding> list) { m_bindings = list; }
+ template<typename InputIterator>
+ void setBindings(InputIterator first, InputIterator last)
+ {
+ m_bindings.clear();
+ std::copy(first, last, std::back_inserter(m_bindings));
+ }
+ const QRhiVertexInputBinding *cbeginBindings() const { return m_bindings.cbegin(); }
+ const QRhiVertexInputBinding *cendBindings() const { return m_bindings.cend(); }
+ const QRhiVertexInputBinding *bindingAt(qsizetype index) const { return &m_bindings.at(index); }
+ qsizetype bindingCount() const { return m_bindings.count(); }
+
+ void setAttributes(std::initializer_list<QRhiVertexInputAttribute> list) { m_attributes = list; }
+ template<typename InputIterator>
+ void setAttributes(InputIterator first, InputIterator last)
+ {
+ m_attributes.clear();
+ std::copy(first, last, std::back_inserter(m_attributes));
+ }
+ const QRhiVertexInputAttribute *cbeginAttributes() const { return m_attributes.cbegin(); }
+ const QRhiVertexInputAttribute *cendAttributes() const { return m_attributes.cend(); }
+ const QRhiVertexInputAttribute *attributeAt(qsizetype index) const { return &m_attributes.at(index); }
+ qsizetype attributeCount() const { return m_attributes.count(); }
+
+private:
+ QVarLengthArray<QRhiVertexInputBinding, 8> m_bindings;
+ QVarLengthArray<QRhiVertexInputAttribute, 8> m_attributes;
+
+ friend bool operator==(const QRhiVertexInputLayout &a, const QRhiVertexInputLayout &b) noexcept
+ {
+ return a.m_bindings == b.m_bindings && a.m_attributes == b.m_attributes;
+ }
+
+ friend bool operator!=(const QRhiVertexInputLayout &a, const QRhiVertexInputLayout &b) noexcept
+ {
+ return !(a == b);
+ }
+
+ friend size_t qHash(const QRhiVertexInputLayout &v, size_t seed = 0) noexcept
+ {
+ QtPrivate::QHashCombine hash;
+ seed = hash(seed, v.m_bindings);
+ seed = hash(seed, v.m_attributes);
+ return seed;
+ }
+
+ friend Q_GUI_EXPORT QDebug operator<<(QDebug, const QRhiVertexInputLayout &);
+};
+
+#ifndef QT_NO_DEBUG_STREAM
+Q_GUI_EXPORT QDebug operator<<(QDebug, const QRhiVertexInputLayout &);
+#endif
+
+class Q_GUI_EXPORT QRhiShaderStage
+{
+public:
+ enum Type {
+ Vertex,
+ TessellationControl,
+ TessellationEvaluation,
+ Geometry,
+ Fragment,
+ Compute
+ };
+
+ QRhiShaderStage() = default;
+ QRhiShaderStage(Type type, const QShader &shader,
+ QShader::Variant v = QShader::StandardShader);
+
+ Type type() const { return m_type; }
+ void setType(Type t) { m_type = t; }
+
+ QShader shader() const { return m_shader; }
+ void setShader(const QShader &s) { m_shader = s; }
+
+ QShader::Variant shaderVariant() const { return m_shaderVariant; }
+ void setShaderVariant(QShader::Variant v) { m_shaderVariant = v; }
+
+private:
+ Type m_type = Vertex;
+ QShader m_shader;
+ QShader::Variant m_shaderVariant = QShader::StandardShader;
+
+ friend bool operator==(const QRhiShaderStage &a, const QRhiShaderStage &b) noexcept
+ {
+ return a.m_type == b.m_type
+ && a.m_shader == b.m_shader
+ && a.m_shaderVariant == b.m_shaderVariant;
+ }
+
+ friend bool operator!=(const QRhiShaderStage &a, const QRhiShaderStage &b) noexcept
+ {
+ return !(a == b);
+ }
+
+ friend size_t qHash(const QRhiShaderStage &v, size_t seed = 0) noexcept
+ {
+ QtPrivate::QHashCombine hash;
+ seed = hash(seed, v.m_type);
+ seed = hash(seed, v.m_shader);
+ seed = hash(seed, v.m_shaderVariant);
+ return seed;
+ }
+};
+
+Q_DECLARE_TYPEINFO(QRhiShaderStage, Q_RELOCATABLE_TYPE);
+
+#ifndef QT_NO_DEBUG_STREAM
+Q_GUI_EXPORT QDebug operator<<(QDebug, const QRhiShaderStage &);
+#endif
+
+using QRhiGraphicsShaderStage = QRhiShaderStage;
+
+class Q_GUI_EXPORT QRhiShaderResourceBinding
+{
+public:
+ enum Type {
+ UniformBuffer,
+ SampledTexture,
+ Texture,
+ Sampler,
+ ImageLoad,
+ ImageStore,
+ ImageLoadStore,
+ BufferLoad,
+ BufferStore,
+ BufferLoadStore
+ };
+
+ enum StageFlag {
+ VertexStage = 1 << 0,
+ TessellationControlStage = 1 << 1,
+ TessellationEvaluationStage = 1 << 2,
+ GeometryStage = 1 << 3,
+ FragmentStage = 1 << 4,
+ ComputeStage = 1 << 5
+ };
+ Q_DECLARE_FLAGS(StageFlags, StageFlag)
+
+ QRhiShaderResourceBinding() = default;
+
+ bool isLayoutCompatible(const QRhiShaderResourceBinding &other) const;
+
+ static QRhiShaderResourceBinding uniformBuffer(int binding, StageFlags stage, QRhiBuffer *buf);
+ static QRhiShaderResourceBinding uniformBuffer(int binding, StageFlags stage, QRhiBuffer *buf, quint32 offset, quint32 size);
+ static QRhiShaderResourceBinding uniformBufferWithDynamicOffset(int binding, StageFlags stage, QRhiBuffer *buf, quint32 size);
+
+ static QRhiShaderResourceBinding sampledTexture(int binding, StageFlags stage, QRhiTexture *tex, QRhiSampler *sampler);
+
+ struct TextureAndSampler {
+ QRhiTexture *tex;
+ QRhiSampler *sampler;
+ };
+ static QRhiShaderResourceBinding sampledTextures(int binding, StageFlags stage, int count, const TextureAndSampler *texSamplers);
+
+ static QRhiShaderResourceBinding texture(int binding, StageFlags stage, QRhiTexture *tex);
+ static QRhiShaderResourceBinding textures(int binding, StageFlags stage, int count, QRhiTexture **tex);
+ static QRhiShaderResourceBinding sampler(int binding, StageFlags stage, QRhiSampler *sampler);
+
+ static QRhiShaderResourceBinding imageLoad(int binding, StageFlags stage, QRhiTexture *tex, int level);
+ static QRhiShaderResourceBinding imageStore(int binding, StageFlags stage, QRhiTexture *tex, int level);
+ static QRhiShaderResourceBinding imageLoadStore(int binding, StageFlags stage, QRhiTexture *tex, int level);
+
+ static QRhiShaderResourceBinding bufferLoad(int binding, StageFlags stage, QRhiBuffer *buf);
+ static QRhiShaderResourceBinding bufferLoad(int binding, StageFlags stage, QRhiBuffer *buf, quint32 offset, quint32 size);
+ static QRhiShaderResourceBinding bufferStore(int binding, StageFlags stage, QRhiBuffer *buf);
+ static QRhiShaderResourceBinding bufferStore(int binding, StageFlags stage, QRhiBuffer *buf, quint32 offset, quint32 size);
+ static QRhiShaderResourceBinding bufferLoadStore(int binding, StageFlags stage, QRhiBuffer *buf);
+ static QRhiShaderResourceBinding bufferLoadStore(int binding, StageFlags stage, QRhiBuffer *buf, quint32 offset, quint32 size);
+
+ struct Data
+ {
+ int binding;
+ QRhiShaderResourceBinding::StageFlags stage;
+ QRhiShaderResourceBinding::Type type;
+ struct UniformBufferData {
+ QRhiBuffer *buf;
+ quint32 offset;
+ quint32 maybeSize;
+ bool hasDynamicOffset;
+ };
+ static constexpr int MAX_TEX_SAMPLER_ARRAY_SIZE = 16;
+ struct TextureAndOrSamplerData {
+ int count;
+ TextureAndSampler texSamplers[MAX_TEX_SAMPLER_ARRAY_SIZE];
+ };
+ struct StorageImageData {
+ QRhiTexture *tex;
+ int level;
+ };
+ struct StorageBufferData {
+ QRhiBuffer *buf;
+ quint32 offset;
+ quint32 maybeSize;
+ };
+ union {
+ UniformBufferData ubuf;
+ TextureAndOrSamplerData stex;
+ StorageImageData simage;
+ StorageBufferData sbuf;
+ } u;
+
+ int arraySize() const
+ {
+ return type == QRhiShaderResourceBinding::SampledTexture || type == QRhiShaderResourceBinding::Texture
+ ? u.stex.count
+ : 1;
+ }
+
+ template<typename Output>
+ Output serialize(Output dst) const
+ {
+ // must write out exactly LAYOUT_DESC_ENTRIES_PER_BINDING elements here
+ *dst++ = quint32(binding);
+ *dst++ = quint32(stage);
+ *dst++ = quint32(type);
+ *dst++ = quint32(arraySize());
+ return dst;
+ }
+ };
+
+ static constexpr int LAYOUT_DESC_ENTRIES_PER_BINDING = 4;
+
+ template<typename Output>
+ static void serializeLayoutDescription(const QRhiShaderResourceBinding *first,
+ const QRhiShaderResourceBinding *last,
+ Output dst)
+ {
+ while (first != last) {
+ dst = first->d.serialize(dst);
+ ++first;
+ }
+ }
+
+private:
+ Data d;
+ friend class QRhiImplementation;
+};
+
+Q_DECLARE_OPERATORS_FOR_FLAGS(QRhiShaderResourceBinding::StageFlags)
+
+Q_DECLARE_TYPEINFO(QRhiShaderResourceBinding, Q_PRIMITIVE_TYPE);
+
+Q_GUI_EXPORT bool operator==(const QRhiShaderResourceBinding &a, const QRhiShaderResourceBinding &b) noexcept;
+Q_GUI_EXPORT bool operator!=(const QRhiShaderResourceBinding &a, const QRhiShaderResourceBinding &b) noexcept;
+Q_GUI_EXPORT size_t qHash(const QRhiShaderResourceBinding &b, size_t seed = 0) noexcept;
+#ifndef QT_NO_DEBUG_STREAM
+Q_GUI_EXPORT QDebug operator<<(QDebug, const QRhiShaderResourceBinding &);
+#endif
+
+class Q_GUI_EXPORT QRhiColorAttachment
+{
+public:
+ QRhiColorAttachment() = default;
+ QRhiColorAttachment(QRhiTexture *texture);
+ QRhiColorAttachment(QRhiRenderBuffer *renderBuffer);
+
+ QRhiTexture *texture() const { return m_texture; }
+ void setTexture(QRhiTexture *tex) { m_texture = tex; }
+
+ QRhiRenderBuffer *renderBuffer() const { return m_renderBuffer; }
+ void setRenderBuffer(QRhiRenderBuffer *rb) { m_renderBuffer = rb; }
+
+ int layer() const { return m_layer; }
+ void setLayer(int layer) { m_layer = layer; }
+
+ int level() const { return m_level; }
+ void setLevel(int level) { m_level = level; }
+
+ QRhiTexture *resolveTexture() const { return m_resolveTexture; }
+ void setResolveTexture(QRhiTexture *tex) { m_resolveTexture = tex; }
+
+ int resolveLayer() const { return m_resolveLayer; }
+ void setResolveLayer(int layer) { m_resolveLayer = layer; }
+
+ int resolveLevel() const { return m_resolveLevel; }
+ void setResolveLevel(int level) { m_resolveLevel = level; }
+
+ int multiViewCount() const { return m_multiViewCount; }
+ void setMultiViewCount(int count) { m_multiViewCount = count; }
+
+private:
+ QRhiTexture *m_texture = nullptr;
+ QRhiRenderBuffer *m_renderBuffer = nullptr;
+ int m_layer = 0;
+ int m_level = 0;
+ QRhiTexture *m_resolveTexture = nullptr;
+ int m_resolveLayer = 0;
+ int m_resolveLevel = 0;
+ int m_multiViewCount = 0;
+};
+
+Q_DECLARE_TYPEINFO(QRhiColorAttachment, Q_RELOCATABLE_TYPE);
+
+class Q_GUI_EXPORT QRhiTextureRenderTargetDescription
+{
+public:
+ QRhiTextureRenderTargetDescription() = default;
+ QRhiTextureRenderTargetDescription(const QRhiColorAttachment &colorAttachment);
+ QRhiTextureRenderTargetDescription(const QRhiColorAttachment &colorAttachment, QRhiRenderBuffer *depthStencilBuffer);
+ QRhiTextureRenderTargetDescription(const QRhiColorAttachment &colorAttachment, QRhiTexture *depthTexture);
+
+ void setColorAttachments(std::initializer_list<QRhiColorAttachment> list) { m_colorAttachments = list; }
+ template<typename InputIterator>
+ void setColorAttachments(InputIterator first, InputIterator last)
+ {
+ m_colorAttachments.clear();
+ std::copy(first, last, std::back_inserter(m_colorAttachments));
+ }
+ const QRhiColorAttachment *cbeginColorAttachments() const { return m_colorAttachments.cbegin(); }
+ const QRhiColorAttachment *cendColorAttachments() const { return m_colorAttachments.cend(); }
+ const QRhiColorAttachment *colorAttachmentAt(qsizetype index) const { return &m_colorAttachments.at(index); }
+ qsizetype colorAttachmentCount() const { return m_colorAttachments.count(); }
+
+ QRhiRenderBuffer *depthStencilBuffer() const { return m_depthStencilBuffer; }
+ void setDepthStencilBuffer(QRhiRenderBuffer *renderBuffer) { m_depthStencilBuffer = renderBuffer; }
+
+ QRhiTexture *depthTexture() const { return m_depthTexture; }
+ void setDepthTexture(QRhiTexture *texture) { m_depthTexture = texture; }
+
+ QRhiTexture *depthResolveTexture() const { return m_depthResolveTexture; }
+ void setDepthResolveTexture(QRhiTexture *tex) { m_depthResolveTexture = tex; }
+
+private:
+ QVarLengthArray<QRhiColorAttachment, 8> m_colorAttachments;
+ QRhiRenderBuffer *m_depthStencilBuffer = nullptr;
+ QRhiTexture *m_depthTexture = nullptr;
+ QRhiTexture *m_depthResolveTexture = nullptr;
+};
+
+class Q_GUI_EXPORT QRhiTextureSubresourceUploadDescription
+{
+public:
+ QRhiTextureSubresourceUploadDescription() = default;
+ explicit QRhiTextureSubresourceUploadDescription(const QImage &image);
+ QRhiTextureSubresourceUploadDescription(const void *data, quint32 size);
+ explicit QRhiTextureSubresourceUploadDescription(const QByteArray &data);
+
+ QImage image() const { return m_image; }
+ void setImage(const QImage &image) { m_image = image; }
+
+ QByteArray data() const { return m_data; }
+ void setData(const QByteArray &data) { m_data = data; }
+
+ quint32 dataStride() const { return m_dataStride; }
+ void setDataStride(quint32 stride) { m_dataStride = stride; }
+
+ QPoint destinationTopLeft() const { return m_destinationTopLeft; }
+ void setDestinationTopLeft(const QPoint &p) { m_destinationTopLeft = p; }
+
+ QSize sourceSize() const { return m_sourceSize; }
+ void setSourceSize(const QSize &size) { m_sourceSize = size; }
+
+ QPoint sourceTopLeft() const { return m_sourceTopLeft; }
+ void setSourceTopLeft(const QPoint &p) { m_sourceTopLeft = p; }
+
+private:
+ QImage m_image;
+ QByteArray m_data;
+ quint32 m_dataStride = 0;
+ QPoint m_destinationTopLeft;
+ QSize m_sourceSize;
+ QPoint m_sourceTopLeft;
+};
+
+Q_DECLARE_TYPEINFO(QRhiTextureSubresourceUploadDescription, Q_RELOCATABLE_TYPE);
+
+class Q_GUI_EXPORT QRhiTextureUploadEntry
+{
+public:
+ QRhiTextureUploadEntry() = default;
+ QRhiTextureUploadEntry(int layer, int level, const QRhiTextureSubresourceUploadDescription &desc);
+
+ int layer() const { return m_layer; }
+ void setLayer(int layer) { m_layer = layer; }
+
+ int level() const { return m_level; }
+ void setLevel(int level) { m_level = level; }
+
+ QRhiTextureSubresourceUploadDescription description() const { return m_desc; }
+ void setDescription(const QRhiTextureSubresourceUploadDescription &desc) { m_desc = desc; }
+
+private:
+ int m_layer = 0;
+ int m_level = 0;
+ QRhiTextureSubresourceUploadDescription m_desc;
+};
+
+Q_DECLARE_TYPEINFO(QRhiTextureUploadEntry, Q_RELOCATABLE_TYPE);
+
+class Q_GUI_EXPORT QRhiTextureUploadDescription
+{
+public:
+ QRhiTextureUploadDescription() = default;
+ QRhiTextureUploadDescription(const QRhiTextureUploadEntry &entry);
+ QRhiTextureUploadDescription(std::initializer_list<QRhiTextureUploadEntry> list);
+
+ void setEntries(std::initializer_list<QRhiTextureUploadEntry> list) { m_entries = list; }
+ template<typename InputIterator>
+ void setEntries(InputIterator first, InputIterator last)
+ {
+ m_entries.clear();
+ std::copy(first, last, std::back_inserter(m_entries));
+ }
+ const QRhiTextureUploadEntry *cbeginEntries() const { return m_entries.cbegin(); }
+ const QRhiTextureUploadEntry *cendEntries() const { return m_entries.cend(); }
+ const QRhiTextureUploadEntry *entryAt(qsizetype index) const { return &m_entries.at(index); }
+ qsizetype entryCount() const { return m_entries.count(); }
+
+private:
+ QVarLengthArray<QRhiTextureUploadEntry, 16> m_entries;
+};
+
+class Q_GUI_EXPORT QRhiTextureCopyDescription
+{
+public:
+ QRhiTextureCopyDescription() = default;
+
+ QSize pixelSize() const { return m_pixelSize; }
+ void setPixelSize(const QSize &sz) { m_pixelSize = sz; }
+
+ int sourceLayer() const { return m_sourceLayer; }
+ void setSourceLayer(int layer) { m_sourceLayer = layer; }
+
+ int sourceLevel() const { return m_sourceLevel; }
+ void setSourceLevel(int level) { m_sourceLevel = level; }
+
+ QPoint sourceTopLeft() const { return m_sourceTopLeft; }
+ void setSourceTopLeft(const QPoint &p) { m_sourceTopLeft = p; }
+
+ int destinationLayer() const { return m_destinationLayer; }
+ void setDestinationLayer(int layer) { m_destinationLayer = layer; }
+
+ int destinationLevel() const { return m_destinationLevel; }
+ void setDestinationLevel(int level) { m_destinationLevel = level; }
+
+ QPoint destinationTopLeft() const { return m_destinationTopLeft; }
+ void setDestinationTopLeft(const QPoint &p) { m_destinationTopLeft = p; }
+
+private:
+ QSize m_pixelSize;
+ int m_sourceLayer = 0;
+ int m_sourceLevel = 0;
+ QPoint m_sourceTopLeft;
+ int m_destinationLayer = 0;
+ int m_destinationLevel = 0;
+ QPoint m_destinationTopLeft;
+};
+
+Q_DECLARE_TYPEINFO(QRhiTextureCopyDescription, Q_RELOCATABLE_TYPE);
+
+class Q_GUI_EXPORT QRhiReadbackDescription
+{
+public:
+ QRhiReadbackDescription() = default;
+ QRhiReadbackDescription(QRhiTexture *texture);
+
+ QRhiTexture *texture() const { return m_texture; }
+ void setTexture(QRhiTexture *tex) { m_texture = tex; }
+
+ int layer() const { return m_layer; }
+ void setLayer(int layer) { m_layer = layer; }
+
+ int level() const { return m_level; }
+ void setLevel(int level) { m_level = level; }
+
+private:
+ QRhiTexture *m_texture = nullptr;
+ int m_layer = 0;
+ int m_level = 0;
+};
+
+Q_DECLARE_TYPEINFO(QRhiReadbackDescription, Q_RELOCATABLE_TYPE);
+
+struct Q_GUI_EXPORT QRhiNativeHandles
+{
+};
+
+class Q_GUI_EXPORT QRhiResource
+{
+public:
+ enum Type {
+ Buffer,
+ Texture,
+ Sampler,
+ RenderBuffer,
+ RenderPassDescriptor,
+ SwapChainRenderTarget,
+ TextureRenderTarget,
+ ShaderResourceBindings,
+ GraphicsPipeline,
+ SwapChain,
+ ComputePipeline,
+ CommandBuffer
+ };
+
+ virtual ~QRhiResource();
+
+ virtual Type resourceType() const = 0;
+
+ virtual void destroy() = 0;
+
+ void deleteLater();
+
+ QByteArray name() const;
+ void setName(const QByteArray &name);
+
+ quint64 globalResourceId() const;
+
+ QRhi *rhi() const;
+
+protected:
+ QRhiResource(QRhiImplementation *rhi);
+ Q_DISABLE_COPY(QRhiResource)
+ friend class QRhiImplementation;
+ QRhiImplementation *m_rhi = nullptr;
+ quint64 m_id;
+ QByteArray m_objectName;
+};
+
+class Q_GUI_EXPORT QRhiBuffer : public QRhiResource
+{
+public:
+ enum Type {
+ Immutable,
+ Static,
+ Dynamic
+ };
+
+ enum UsageFlag {
+ VertexBuffer = 1 << 0,
+ IndexBuffer = 1 << 1,
+ UniformBuffer = 1 << 2,
+ StorageBuffer = 1 << 3
+ };
+ Q_DECLARE_FLAGS(UsageFlags, UsageFlag)
+
+ struct NativeBuffer {
+ const void *objects[3];
+ int slotCount;
+ };
+
+ QRhiResource::Type resourceType() const override;
+
+ Type type() const { return m_type; }
+ void setType(Type t) { m_type = t; }
+
+ UsageFlags usage() const { return m_usage; }
+ void setUsage(UsageFlags u) { m_usage = u; }
+
+ quint32 size() const { return m_size; }
+ void setSize(quint32 sz) { m_size = sz; }
+
+ virtual bool create() = 0;
+
+ virtual NativeBuffer nativeBuffer();
+
+ virtual char *beginFullDynamicBufferUpdateForCurrentFrame();
+ virtual void endFullDynamicBufferUpdateForCurrentFrame();
+
+protected:
+ QRhiBuffer(QRhiImplementation *rhi, Type type_, UsageFlags usage_, quint32 size_);
+ Type m_type;
+ UsageFlags m_usage;
+ quint32 m_size;
+};
+
+Q_DECLARE_OPERATORS_FOR_FLAGS(QRhiBuffer::UsageFlags)
+
+class Q_GUI_EXPORT QRhiTexture : public QRhiResource
+{
+public:
+ enum Flag {
+ RenderTarget = 1 << 0,
+ CubeMap = 1 << 2,
+ MipMapped = 1 << 3,
+ sRGB = 1 << 4,
+ UsedAsTransferSource = 1 << 5,
+ UsedWithGenerateMips = 1 << 6,
+ UsedWithLoadStore = 1 << 7,
+ UsedAsCompressedAtlas = 1 << 8,
+ ExternalOES = 1 << 9,
+ ThreeDimensional = 1 << 10,
+ TextureRectangleGL = 1 << 11,
+ TextureArray = 1 << 12,
+ OneDimensional = 1 << 13
+ };
+ Q_DECLARE_FLAGS(Flags, Flag)
+
+ enum Format {
+ UnknownFormat,
+
+ RGBA8,
+ BGRA8,
+ R8,
+ RG8,
+ R16,
+ RG16,
+ RED_OR_ALPHA8,
+
+ RGBA16F,
+ RGBA32F,
+ R16F,
+ R32F,
+
+ RGB10A2,
+
+ D16,
+ D24,
+ D24S8,
+ D32F,
+
+ BC1,
+ BC2,
+ BC3,
+ BC4,
+ BC5,
+ BC6H,
+ BC7,
+
+ ETC2_RGB8,
+ ETC2_RGB8A1,
+ ETC2_RGBA8,
+
+ ASTC_4x4,
+ ASTC_5x4,
+ ASTC_5x5,
+ ASTC_6x5,
+ ASTC_6x6,
+ ASTC_8x5,
+ ASTC_8x6,
+ ASTC_8x8,
+ ASTC_10x5,
+ ASTC_10x6,
+ ASTC_10x8,
+ ASTC_10x10,
+ ASTC_12x10,
+ ASTC_12x12
+ };
+
+ struct NativeTexture {
+ quint64 object;
+ int layout; // or state
+ };
+
+ QRhiResource::Type resourceType() const override;
+
+ Format format() const { return m_format; }
+ void setFormat(Format fmt) { m_format = fmt; }
+
+ QSize pixelSize() const { return m_pixelSize; }
+ void setPixelSize(const QSize &sz) { m_pixelSize = sz; }
+
+ int depth() const { return m_depth; }
+ void setDepth(int depth) { m_depth = depth; }
+
+ int arraySize() const { return m_arraySize; }
+ void setArraySize(int arraySize) { m_arraySize = arraySize; }
+
+ int arrayRangeStart() const { return m_arrayRangeStart; }
+ int arrayRangeLength() const { return m_arrayRangeLength; }
+ void setArrayRange(int startIndex, int count)
+ {
+ m_arrayRangeStart = startIndex;
+ m_arrayRangeLength = count;
+ }
+
+ Flags flags() const { return m_flags; }
+ void setFlags(Flags f) { m_flags = f; }
+
+ int sampleCount() const { return m_sampleCount; }
+ void setSampleCount(int s) { m_sampleCount = s; }
+
+ struct ViewFormat {
+ QRhiTexture::Format format;
+ bool srgb;
+ };
+ ViewFormat readViewFormat() const { return m_readViewFormat; }
+ void setReadViewFormat(const ViewFormat &fmt) { m_readViewFormat = fmt; }
+ ViewFormat writeViewFormat() const { return m_writeViewFormat; }
+ void setWriteViewFormat(const ViewFormat &fmt) { m_writeViewFormat = fmt; }
+
+ virtual bool create() = 0;
+ virtual NativeTexture nativeTexture();
+ virtual bool createFrom(NativeTexture src);
+ virtual void setNativeLayout(int layout);
+
+protected:
+ QRhiTexture(QRhiImplementation *rhi, Format format_, const QSize &pixelSize_, int depth_,
+ int arraySize_, int sampleCount_, Flags flags_);
+ Format m_format;
+ QSize m_pixelSize;
+ int m_depth;
+ int m_arraySize;
+ int m_sampleCount;
+ Flags m_flags;
+ int m_arrayRangeStart = -1;
+ int m_arrayRangeLength = -1;
+ ViewFormat m_readViewFormat = { UnknownFormat, false };
+ ViewFormat m_writeViewFormat = { UnknownFormat, false };
+};
+
+Q_DECLARE_OPERATORS_FOR_FLAGS(QRhiTexture::Flags)
+
+class Q_GUI_EXPORT QRhiSampler : public QRhiResource
+{
+public:
+ enum Filter {
+ None,
+ Nearest,
+ Linear
+ };
+
+ enum AddressMode {
+ Repeat,
+ ClampToEdge,
+ Mirror,
+ };
+
+ enum CompareOp {
+ Never,
+ Less,
+ Equal,
+ LessOrEqual,
+ Greater,
+ NotEqual,
+ GreaterOrEqual,
+ Always
+ };
+
+ QRhiResource::Type resourceType() const override;
+
+ Filter magFilter() const { return m_magFilter; }
+ void setMagFilter(Filter f) { m_magFilter = f; }
+
+ Filter minFilter() const { return m_minFilter; }
+ void setMinFilter(Filter f) { m_minFilter = f; }
+
+ Filter mipmapMode() const { return m_mipmapMode; }
+ void setMipmapMode(Filter f) { m_mipmapMode = f; }
+
+ AddressMode addressU() const { return m_addressU; }
+ void setAddressU(AddressMode mode) { m_addressU = mode; }
+
+ AddressMode addressV() const { return m_addressV; }
+ void setAddressV(AddressMode mode) { m_addressV = mode; }
+
+ AddressMode addressW() const { return m_addressW; }
+ void setAddressW(AddressMode mode) { m_addressW = mode; }
+
+ CompareOp textureCompareOp() const { return m_compareOp; }
+ void setTextureCompareOp(CompareOp op) { m_compareOp = op; }
+
+ virtual bool create() = 0;
+
+protected:
+ QRhiSampler(QRhiImplementation *rhi,
+ Filter magFilter_, Filter minFilter_, Filter mipmapMode_,
+ AddressMode u_, AddressMode v_, AddressMode w_);
+ Filter m_magFilter;
+ Filter m_minFilter;
+ Filter m_mipmapMode;
+ AddressMode m_addressU;
+ AddressMode m_addressV;
+ AddressMode m_addressW;
+ CompareOp m_compareOp;
+};
+
+class Q_GUI_EXPORT QRhiRenderBuffer : public QRhiResource
+{
+public:
+ enum Type {
+ DepthStencil,
+ Color
+ };
+
+ enum Flag {
+ UsedWithSwapChainOnly = 1 << 0
+ };
+ Q_DECLARE_FLAGS(Flags, Flag)
+
+ struct NativeRenderBuffer {
+ quint64 object;
+ };
+
+ QRhiResource::Type resourceType() const override;
+
+ Type type() const { return m_type; }
+ void setType(Type t) { m_type = t; }
+
+ QSize pixelSize() const { return m_pixelSize; }
+ void setPixelSize(const QSize &sz) { m_pixelSize = sz; }
+
+ int sampleCount() const { return m_sampleCount; }
+ void setSampleCount(int s) { m_sampleCount = s; }
+
+ Flags flags() const { return m_flags; }
+ void setFlags(Flags f) { m_flags = f; }
+
+ virtual bool create() = 0;
+ virtual bool createFrom(NativeRenderBuffer src);
+
+ virtual QRhiTexture::Format backingFormat() const = 0;
+
+protected:
+ QRhiRenderBuffer(QRhiImplementation *rhi, Type type_, const QSize &pixelSize_,
+ int sampleCount_, Flags flags_, QRhiTexture::Format backingFormatHint_);
+ Type m_type;
+ QSize m_pixelSize;
+ int m_sampleCount;
+ Flags m_flags;
+ QRhiTexture::Format m_backingFormatHint;
+};
+
+Q_DECLARE_OPERATORS_FOR_FLAGS(QRhiRenderBuffer::Flags)
+
+class Q_GUI_EXPORT QRhiRenderPassDescriptor : public QRhiResource
+{
+public:
+ QRhiResource::Type resourceType() const override;
+
+ virtual bool isCompatible(const QRhiRenderPassDescriptor *other) const = 0;
+ virtual const QRhiNativeHandles *nativeHandles();
+
+ virtual QRhiRenderPassDescriptor *newCompatibleRenderPassDescriptor() const = 0;
+
+ virtual QVector<quint32> serializedFormat() const = 0;
+
+protected:
+ QRhiRenderPassDescriptor(QRhiImplementation *rhi);
+};
+
+class Q_GUI_EXPORT QRhiRenderTarget : public QRhiResource
+{
+public:
+ virtual QSize pixelSize() const = 0;
+ virtual float devicePixelRatio() const = 0;
+ virtual int sampleCount() const = 0;
+
+ QRhiRenderPassDescriptor *renderPassDescriptor() const { return m_renderPassDesc; }
+ void setRenderPassDescriptor(QRhiRenderPassDescriptor *desc) { m_renderPassDesc = desc; }
+
+protected:
+ QRhiRenderTarget(QRhiImplementation *rhi);
+ QRhiRenderPassDescriptor *m_renderPassDesc = nullptr;
+};
+
+class Q_GUI_EXPORT QRhiSwapChainRenderTarget : public QRhiRenderTarget
+{
+public:
+ QRhiResource::Type resourceType() const override;
+ QRhiSwapChain *swapChain() const { return m_swapchain; }
+
+protected:
+ QRhiSwapChainRenderTarget(QRhiImplementation *rhi, QRhiSwapChain *swapchain_);
+ QRhiSwapChain *m_swapchain;
+};
+
+class Q_GUI_EXPORT QRhiTextureRenderTarget : public QRhiRenderTarget
+{
+public:
+ enum Flag {
+ PreserveColorContents = 1 << 0,
+ PreserveDepthStencilContents = 1 << 1,
+ DoNotStoreDepthStencilContents = 1 << 2
+ };
+ Q_DECLARE_FLAGS(Flags, Flag)
+
+ QRhiResource::Type resourceType() const override;
+
+ QRhiTextureRenderTargetDescription description() const { return m_desc; }
+ void setDescription(const QRhiTextureRenderTargetDescription &desc) { m_desc = desc; }
+
+ Flags flags() const { return m_flags; }
+ void setFlags(Flags f) { m_flags = f; }
+
+ virtual QRhiRenderPassDescriptor *newCompatibleRenderPassDescriptor() = 0;
+
+ virtual bool create() = 0;
+
+protected:
+ QRhiTextureRenderTarget(QRhiImplementation *rhi, const QRhiTextureRenderTargetDescription &desc_, Flags flags_);
+ QRhiTextureRenderTargetDescription m_desc;
+ Flags m_flags;
+};
+
+Q_DECLARE_OPERATORS_FOR_FLAGS(QRhiTextureRenderTarget::Flags)
+
+class Q_GUI_EXPORT QRhiShaderResourceBindings : public QRhiResource
+{
+public:
+ QRhiResource::Type resourceType() const override;
+
+ void setBindings(std::initializer_list<QRhiShaderResourceBinding> list) { m_bindings = list; }
+ template<typename InputIterator>
+ void setBindings(InputIterator first, InputIterator last)
+ {
+ m_bindings.clear();
+ std::copy(first, last, std::back_inserter(m_bindings));
+ }
+ const QRhiShaderResourceBinding *cbeginBindings() const { return m_bindings.cbegin(); }
+ const QRhiShaderResourceBinding *cendBindings() const { return m_bindings.cend(); }
+ const QRhiShaderResourceBinding *bindingAt(qsizetype index) const { return &m_bindings.at(index); }
+ qsizetype bindingCount() const { return m_bindings.count(); }
+
+ bool isLayoutCompatible(const QRhiShaderResourceBindings *other) const;
+
+ QVector<quint32> serializedLayoutDescription() const { return m_layoutDesc; }
+
+ virtual bool create() = 0;
+
+ enum UpdateFlag {
+ BindingsAreSorted = 0x01
+ };
+ Q_DECLARE_FLAGS(UpdateFlags, UpdateFlag)
+
+ virtual void updateResources(UpdateFlags flags = {}) = 0;
+
+protected:
+ static constexpr int BINDING_PREALLOC = 12;
+ QRhiShaderResourceBindings(QRhiImplementation *rhi);
+ QVarLengthArray<QRhiShaderResourceBinding, BINDING_PREALLOC> m_bindings;
+ size_t m_layoutDescHash = 0;
+ // Intentionally not using QVLA for m_layoutDesc: clients like Qt Quick are much
+ // better served with an implicitly shared container here, because they will likely
+ // throw this directly into structs serving as cache keys.
+ QVector<quint32> m_layoutDesc;
+ friend class QRhiImplementation;
+#ifndef QT_NO_DEBUG_STREAM
+ friend Q_GUI_EXPORT QDebug operator<<(QDebug, const QRhiShaderResourceBindings &);
+#endif
+};
+
+Q_DECLARE_OPERATORS_FOR_FLAGS(QRhiShaderResourceBindings::UpdateFlags)
+
+#ifndef QT_NO_DEBUG_STREAM
+Q_GUI_EXPORT QDebug operator<<(QDebug, const QRhiShaderResourceBindings &);
+#endif
+
+// The proper name. Until it gets rolled out universally, have the better name
+// as a typedef. Eventually it should be reversed (the old name being a typedef
+// to the new one).
+using QRhiShaderResourceBindingSet = QRhiShaderResourceBindings;
+
+class Q_GUI_EXPORT QRhiGraphicsPipeline : public QRhiResource
+{
+public:
+ enum Flag {
+ UsesBlendConstants = 1 << 0,
+ UsesStencilRef = 1 << 1,
+ UsesScissor = 1 << 2,
+ CompileShadersWithDebugInfo = 1 << 3
+ };
+ Q_DECLARE_FLAGS(Flags, Flag)
+
+ enum Topology {
+ Triangles,
+ TriangleStrip,
+ TriangleFan,
+ Lines,
+ LineStrip,
+ Points,
+ Patches
+ };
+
+ enum CullMode {
+ None,
+ Front,
+ Back
+ };
+
+ enum FrontFace {
+ CCW,
+ CW
+ };
+
+ enum ColorMaskComponent {
+ R = 1 << 0,
+ G = 1 << 1,
+ B = 1 << 2,
+ A = 1 << 3
+ };
+ Q_DECLARE_FLAGS(ColorMask, ColorMaskComponent)
+
+ enum BlendFactor {
+ Zero,
+ One,
+ SrcColor,
+ OneMinusSrcColor,
+ DstColor,
+ OneMinusDstColor,
+ SrcAlpha,
+ OneMinusSrcAlpha,
+ DstAlpha,
+ OneMinusDstAlpha,
+ ConstantColor,
+ OneMinusConstantColor,
+ ConstantAlpha,
+ OneMinusConstantAlpha,
+ SrcAlphaSaturate,
+ Src1Color,
+ OneMinusSrc1Color,
+ Src1Alpha,
+ OneMinusSrc1Alpha
+ };
+
+ enum BlendOp {
+ Add,
+ Subtract,
+ ReverseSubtract,
+ Min,
+ Max
+ };
+
+ struct TargetBlend {
+ ColorMask colorWrite = ColorMask(0xF); // R | G | B | A
+ bool enable = false;
+ BlendFactor srcColor = One;
+ BlendFactor dstColor = OneMinusSrcAlpha;
+ BlendOp opColor = Add;
+ BlendFactor srcAlpha = One;
+ BlendFactor dstAlpha = OneMinusSrcAlpha;
+ BlendOp opAlpha = Add;
+ };
+
+ enum CompareOp {
+ Never,
+ Less,
+ Equal,
+ LessOrEqual,
+ Greater,
+ NotEqual,
+ GreaterOrEqual,
+ Always
+ };
+
+ enum StencilOp {
+ StencilZero,
+ Keep,
+ Replace,
+ IncrementAndClamp,
+ DecrementAndClamp,
+ Invert,
+ IncrementAndWrap,
+ DecrementAndWrap
+ };
+
+ struct StencilOpState {
+ StencilOp failOp = Keep;
+ StencilOp depthFailOp = Keep;
+ StencilOp passOp = Keep;
+ CompareOp compareOp = Always;
+ };
+
+ enum PolygonMode {
+ Fill,
+ Line
+ };
+
+ QRhiResource::Type resourceType() const override;
+
+ Flags flags() const { return m_flags; }
+ void setFlags(Flags f) { m_flags = f; }
+
+ Topology topology() const { return m_topology; }
+ void setTopology(Topology t) { m_topology = t; }
+
+ CullMode cullMode() const { return m_cullMode; }
+ void setCullMode(CullMode mode) { m_cullMode = mode; }
+
+ FrontFace frontFace() const { return m_frontFace; }
+ void setFrontFace(FrontFace f) { m_frontFace = f; }
+
+ void setTargetBlends(std::initializer_list<TargetBlend> list) { m_targetBlends = list; }
+ template<typename InputIterator>
+ void setTargetBlends(InputIterator first, InputIterator last)
+ {
+ m_targetBlends.clear();
+ std::copy(first, last, std::back_inserter(m_targetBlends));
+ }
+ const TargetBlend *cbeginTargetBlends() const { return m_targetBlends.cbegin(); }
+ const TargetBlend *cendTargetBlends() const { return m_targetBlends.cend(); }
+ const TargetBlend *targetBlendAt(qsizetype index) const { return &m_targetBlends.at(index); }
+ qsizetype targetBlendCount() const { return m_targetBlends.count(); }
+
+ bool hasDepthTest() const { return m_depthTest; }
+ void setDepthTest(bool enable) { m_depthTest = enable; }
+
+ bool hasDepthWrite() const { return m_depthWrite; }
+ void setDepthWrite(bool enable) { m_depthWrite = enable; }
+
+ CompareOp depthOp() const { return m_depthOp; }
+ void setDepthOp(CompareOp op) { m_depthOp = op; }
+
+ bool hasStencilTest() const { return m_stencilTest; }
+ void setStencilTest(bool enable) { m_stencilTest = enable; }
+
+ StencilOpState stencilFront() const { return m_stencilFront; }
+ void setStencilFront(const StencilOpState &state) { m_stencilFront = state; }
+
+ StencilOpState stencilBack() const { return m_stencilBack; }
+ void setStencilBack(const StencilOpState &state) { m_stencilBack = state; }
+
+ quint32 stencilReadMask() const { return m_stencilReadMask; }
+ void setStencilReadMask(quint32 mask) { m_stencilReadMask = mask; }
+
+ quint32 stencilWriteMask() const { return m_stencilWriteMask; }
+ void setStencilWriteMask(quint32 mask) { m_stencilWriteMask = mask; }
+
+ int sampleCount() const { return m_sampleCount; }
+ void setSampleCount(int s) { m_sampleCount = s; }
+
+ float lineWidth() const { return m_lineWidth; }
+ void setLineWidth(float width) { m_lineWidth = width; }
+
+ int depthBias() const { return m_depthBias; }
+ void setDepthBias(int bias) { m_depthBias = bias; }
+
+ float slopeScaledDepthBias() const { return m_slopeScaledDepthBias; }
+ void setSlopeScaledDepthBias(float bias) { m_slopeScaledDepthBias = bias; }
+
+ void setShaderStages(std::initializer_list<QRhiShaderStage> list) { m_shaderStages = list; }
+ template<typename InputIterator>
+ void setShaderStages(InputIterator first, InputIterator last)
+ {
+ m_shaderStages.clear();
+ std::copy(first, last, std::back_inserter(m_shaderStages));
+ }
+ const QRhiShaderStage *cbeginShaderStages() const { return m_shaderStages.cbegin(); }
+ const QRhiShaderStage *cendShaderStages() const { return m_shaderStages.cend(); }
+ const QRhiShaderStage *shaderStageAt(qsizetype index) const { return &m_shaderStages.at(index); }
+ qsizetype shaderStageCount() const { return m_shaderStages.count(); }
+
+ QRhiVertexInputLayout vertexInputLayout() const { return m_vertexInputLayout; }
+ void setVertexInputLayout(const QRhiVertexInputLayout &layout) { m_vertexInputLayout = layout; }
+
+ QRhiShaderResourceBindings *shaderResourceBindings() const { return m_shaderResourceBindings; }
+ void setShaderResourceBindings(QRhiShaderResourceBindings *srb) { m_shaderResourceBindings = srb; }
+
+ QRhiRenderPassDescriptor *renderPassDescriptor() const { return m_renderPassDesc; }
+ void setRenderPassDescriptor(QRhiRenderPassDescriptor *desc) { m_renderPassDesc = desc; }
+
+ int patchControlPointCount() const { return m_patchControlPointCount; }
+ void setPatchControlPointCount(int count) { m_patchControlPointCount = count; }
+
+ PolygonMode polygonMode() const {return m_polygonMode; }
+ void setPolygonMode(PolygonMode mode) {m_polygonMode = mode; }
+
+ int multiViewCount() const { return m_multiViewCount; }
+ void setMultiViewCount(int count) { m_multiViewCount = count; }
+
+ virtual bool create() = 0;
+
+protected:
+ QRhiGraphicsPipeline(QRhiImplementation *rhi);
+ Flags m_flags;
+ Topology m_topology = Triangles;
+ CullMode m_cullMode = None;
+ FrontFace m_frontFace = CCW;
+ QVarLengthArray<TargetBlend, 8> m_targetBlends;
+ bool m_depthTest = false;
+ bool m_depthWrite = false;
+ CompareOp m_depthOp = Less;
+ bool m_stencilTest = false;
+ StencilOpState m_stencilFront;
+ StencilOpState m_stencilBack;
+ quint32 m_stencilReadMask = 0xFF;
+ quint32 m_stencilWriteMask = 0xFF;
+ int m_sampleCount = 1;
+ float m_lineWidth = 1.0f;
+ int m_depthBias = 0;
+ float m_slopeScaledDepthBias = 0.0f;
+ int m_patchControlPointCount = 3;
+ PolygonMode m_polygonMode = Fill;
+ int m_multiViewCount = 0;
+ QVarLengthArray<QRhiShaderStage, 4> m_shaderStages;
+ QRhiVertexInputLayout m_vertexInputLayout;
+ QRhiShaderResourceBindings *m_shaderResourceBindings = nullptr;
+ QRhiRenderPassDescriptor *m_renderPassDesc = nullptr;
+};
+
+Q_DECLARE_OPERATORS_FOR_FLAGS(QRhiGraphicsPipeline::Flags)
+Q_DECLARE_OPERATORS_FOR_FLAGS(QRhiGraphicsPipeline::ColorMask)
+Q_DECLARE_TYPEINFO(QRhiGraphicsPipeline::TargetBlend, Q_RELOCATABLE_TYPE);
+
+struct QRhiSwapChainHdrInfo
+{
+ enum LimitsType {
+ LuminanceInNits,
+ ColorComponentValue
+ };
+
+ enum LuminanceBehavior {
+ SceneReferred,
+ DisplayReferred
+ };
+
+ LimitsType limitsType;
+ union {
+ struct {
+ float minLuminance;
+ float maxLuminance;
+ } luminanceInNits;
+ struct {
+ float maxColorComponentValue;
+ float maxPotentialColorComponentValue;
+ } colorComponentValue;
+ } limits;
+ LuminanceBehavior luminanceBehavior;
+ float sdrWhiteLevel;
+};
+
+Q_DECLARE_TYPEINFO(QRhiSwapChainHdrInfo, Q_RELOCATABLE_TYPE);
+
+#ifndef QT_NO_DEBUG_STREAM
+Q_GUI_EXPORT QDebug operator<<(QDebug, const QRhiSwapChainHdrInfo &);
+#endif
+
+struct QRhiSwapChainProxyData
+{
+ void *reserved[2] = {};
+};
+
+class Q_GUI_EXPORT QRhiSwapChain : public QRhiResource
+{
+public:
+ enum Flag {
+ SurfaceHasPreMulAlpha = 1 << 0,
+ SurfaceHasNonPreMulAlpha = 1 << 1,
+ sRGB = 1 << 2,
+ UsedAsTransferSource = 1 << 3,
+ NoVSync = 1 << 4,
+ MinimalBufferCount = 1 << 5
+ };
+ Q_DECLARE_FLAGS(Flags, Flag)
+
+ enum Format {
+ SDR,
+ HDRExtendedSrgbLinear,
+ HDR10,
+ HDRExtendedDisplayP3Linear
+ };
+
+ enum StereoTargetBuffer {
+ LeftBuffer,
+ RightBuffer
+ };
+
+ QRhiResource::Type resourceType() const override;
+
+ QWindow *window() const { return m_window; }
+ void setWindow(QWindow *window) { m_window = window; }
+
+ QRhiSwapChainProxyData proxyData() const { return m_proxyData; }
+ void setProxyData(const QRhiSwapChainProxyData &d) { m_proxyData = d; }
+
+ Flags flags() const { return m_flags; }
+ void setFlags(Flags f) { m_flags = f; }
+
+ Format format() const { return m_format; }
+ void setFormat(Format f) { m_format = f; }
+
+ QRhiRenderBuffer *depthStencil() const { return m_depthStencil; }
+ void setDepthStencil(QRhiRenderBuffer *ds) { m_depthStencil = ds; }
+
+ int sampleCount() const { return m_sampleCount; }
+ void setSampleCount(int samples) { m_sampleCount = samples; }
+
+ QRhiRenderPassDescriptor *renderPassDescriptor() const { return m_renderPassDesc; }
+ void setRenderPassDescriptor(QRhiRenderPassDescriptor *desc) { m_renderPassDesc = desc; }
+
+ QSize currentPixelSize() const { return m_currentPixelSize; }
+
+ virtual QRhiCommandBuffer *currentFrameCommandBuffer() = 0;
+ virtual QRhiRenderTarget *currentFrameRenderTarget() = 0;
+ virtual QRhiRenderTarget *currentFrameRenderTarget(StereoTargetBuffer targetBuffer);
+ virtual QSize surfacePixelSize() = 0;
+ virtual bool isFormatSupported(Format f) = 0;
+ virtual QRhiRenderPassDescriptor *newCompatibleRenderPassDescriptor() = 0;
+ virtual bool createOrResize() = 0;
+ virtual QRhiSwapChainHdrInfo hdrInfo();
+
+protected:
+ QRhiSwapChain(QRhiImplementation *rhi);
+ QWindow *m_window = nullptr;
+ Flags m_flags;
+ Format m_format = SDR;
+ QRhiRenderBuffer *m_depthStencil = nullptr;
+ int m_sampleCount = 1;
+ QRhiRenderPassDescriptor *m_renderPassDesc = nullptr;
+ QSize m_currentPixelSize;
+ QRhiSwapChainProxyData m_proxyData;
+};
+
+Q_DECLARE_OPERATORS_FOR_FLAGS(QRhiSwapChain::Flags)
+
+class Q_GUI_EXPORT QRhiComputePipeline : public QRhiResource
+{
+public:
+ enum Flag {
+ CompileShadersWithDebugInfo = 1 << 0
+ };
+ Q_DECLARE_FLAGS(Flags, Flag)
+
+ QRhiResource::Type resourceType() const override;
+ virtual bool create() = 0;
+
+ Flags flags() const { return m_flags; }
+ void setFlags(Flags f) { m_flags = f; }
+
+ QRhiShaderStage shaderStage() const { return m_shaderStage; }
+ void setShaderStage(const QRhiShaderStage &stage) { m_shaderStage = stage; }
+
+ QRhiShaderResourceBindings *shaderResourceBindings() const { return m_shaderResourceBindings; }
+ void setShaderResourceBindings(QRhiShaderResourceBindings *srb) { m_shaderResourceBindings = srb; }
+
+protected:
+ QRhiComputePipeline(QRhiImplementation *rhi);
+ Flags m_flags;
+ QRhiShaderStage m_shaderStage;
+ QRhiShaderResourceBindings *m_shaderResourceBindings = nullptr;
+};
+
+Q_DECLARE_OPERATORS_FOR_FLAGS(QRhiComputePipeline::Flags)
+
+class Q_GUI_EXPORT QRhiCommandBuffer : public QRhiResource
+{
+public:
+ enum IndexFormat {
+ IndexUInt16,
+ IndexUInt32
+ };
+
+ enum BeginPassFlag {
+ ExternalContent = 0x01,
+ DoNotTrackResourcesForCompute = 0x02
+ };
+ Q_DECLARE_FLAGS(BeginPassFlags, BeginPassFlag)
+
+ QRhiResource::Type resourceType() const override;
+
+ void resourceUpdate(QRhiResourceUpdateBatch *resourceUpdates);
+
+ void beginPass(QRhiRenderTarget *rt,
+ const QColor &colorClearValue,
+ const QRhiDepthStencilClearValue &depthStencilClearValue,
+ QRhiResourceUpdateBatch *resourceUpdates = nullptr,
+ BeginPassFlags flags = {});
+ void endPass(QRhiResourceUpdateBatch *resourceUpdates = nullptr);
+
+ void setGraphicsPipeline(QRhiGraphicsPipeline *ps);
+ using DynamicOffset = QPair<int, quint32>; // binding, offset
+ void setShaderResources(QRhiShaderResourceBindings *srb = nullptr,
+ int dynamicOffsetCount = 0,
+ const DynamicOffset *dynamicOffsets = nullptr);
+ using VertexInput = QPair<QRhiBuffer *, quint32>; // buffer, offset
+ void setVertexInput(int startBinding, int bindingCount, const VertexInput *bindings,
+ QRhiBuffer *indexBuf = nullptr, quint32 indexOffset = 0,
+ IndexFormat indexFormat = IndexUInt16);
+
+ void setViewport(const QRhiViewport &viewport);
+ void setScissor(const QRhiScissor &scissor);
+ void setBlendConstants(const QColor &c);
+ void setStencilRef(quint32 refValue);
+
+ void draw(quint32 vertexCount,
+ quint32 instanceCount = 1,
+ quint32 firstVertex = 0,
+ quint32 firstInstance = 0);
+
+ void drawIndexed(quint32 indexCount,
+ quint32 instanceCount = 1,
+ quint32 firstIndex = 0,
+ qint32 vertexOffset = 0,
+ quint32 firstInstance = 0);
+
+ void debugMarkBegin(const QByteArray &name);
+ void debugMarkEnd();
+ void debugMarkMsg(const QByteArray &msg);
+
+ void beginComputePass(QRhiResourceUpdateBatch *resourceUpdates = nullptr, BeginPassFlags flags = {});
+ void endComputePass(QRhiResourceUpdateBatch *resourceUpdates = nullptr);
+ void setComputePipeline(QRhiComputePipeline *ps);
+ void dispatch(int x, int y, int z);
+
+ const QRhiNativeHandles *nativeHandles();
+ void beginExternal();
+ void endExternal();
+
+ double lastCompletedGpuTime();
+
+protected:
+ QRhiCommandBuffer(QRhiImplementation *rhi);
+};
+
+Q_DECLARE_OPERATORS_FOR_FLAGS(QRhiCommandBuffer::BeginPassFlags)
+
+struct Q_GUI_EXPORT QRhiReadbackResult
+{
+ std::function<void()> completed = nullptr;
+ QRhiTexture::Format format;
+ QSize pixelSize;
+ QByteArray data;
+};
+
+class Q_GUI_EXPORT QRhiResourceUpdateBatch
+{
+public:
+ ~QRhiResourceUpdateBatch();
+
+ void release();
+
+ void merge(QRhiResourceUpdateBatch *other);
+ bool hasOptimalCapacity() const;
+
+ void updateDynamicBuffer(QRhiBuffer *buf, quint32 offset, quint32 size, const void *data);
+ void uploadStaticBuffer(QRhiBuffer *buf, quint32 offset, quint32 size, const void *data);
+ void uploadStaticBuffer(QRhiBuffer *buf, const void *data);
+ void readBackBuffer(QRhiBuffer *buf, quint32 offset, quint32 size, QRhiReadbackResult *result);
+ void uploadTexture(QRhiTexture *tex, const QRhiTextureUploadDescription &desc);
+ void uploadTexture(QRhiTexture *tex, const QImage &image);
+ void copyTexture(QRhiTexture *dst, QRhiTexture *src, const QRhiTextureCopyDescription &desc = QRhiTextureCopyDescription());
+ void readBackTexture(const QRhiReadbackDescription &rb, QRhiReadbackResult *result);
+ void generateMips(QRhiTexture *tex);
+
+private:
+ QRhiResourceUpdateBatch(QRhiImplementation *rhi);
+ Q_DISABLE_COPY(QRhiResourceUpdateBatch)
+ QRhiResourceUpdateBatchPrivate *d;
+ friend class QRhiResourceUpdateBatchPrivate;
+ friend class QRhi;
+};
+
+struct Q_GUI_EXPORT QRhiDriverInfo
+{
+ enum DeviceType {
+ UnknownDevice,
+ IntegratedDevice,
+ DiscreteDevice,
+ ExternalDevice,
+ VirtualDevice,
+ CpuDevice
+ };
+
+ QByteArray deviceName;
+ quint64 deviceId = 0;
+ quint64 vendorId = 0;
+ DeviceType deviceType = UnknownDevice;
+};
+
+Q_DECLARE_TYPEINFO(QRhiDriverInfo, Q_RELOCATABLE_TYPE);
+
+#ifndef QT_NO_DEBUG_STREAM
+Q_GUI_EXPORT QDebug operator<<(QDebug, const QRhiDriverInfo &);
+#endif
+
+struct Q_GUI_EXPORT QRhiStats
+{
+ qint64 totalPipelineCreationTime = 0;
+ // Vulkan or D3D12 memory allocator statistics
+ quint32 blockCount = 0;
+ quint32 allocCount = 0;
+ quint64 usedBytes = 0;
+ quint64 unusedBytes = 0;
+ // D3D12 only, from IDXGIAdapter3::QueryVideoMemoryInfo(), incl. all resources
+ quint64 totalUsageBytes = 0;
+};
+
+Q_DECLARE_TYPEINFO(QRhiStats, Q_RELOCATABLE_TYPE);
+
+#ifndef QT_NO_DEBUG_STREAM
+Q_GUI_EXPORT QDebug operator<<(QDebug, const QRhiStats &);
+#endif
+
+struct Q_GUI_EXPORT QRhiInitParams
+{
+};
+
+class Q_GUI_EXPORT QRhi
+{
+public:
+ enum Implementation {
+ Null,
+ Vulkan,
+ OpenGLES2,
+ D3D11,
+ Metal,
+ D3D12
+ };
+
+ enum Flag {
+ EnableDebugMarkers = 1 << 0,
+ PreferSoftwareRenderer = 1 << 1,
+ EnablePipelineCacheDataSave = 1 << 2,
+ EnableTimestamps = 1 << 3,
+ SuppressSmokeTestWarnings = 1 << 4
+ };
+ Q_DECLARE_FLAGS(Flags, Flag)
+
+ enum FrameOpResult {
+ FrameOpSuccess = 0,
+ FrameOpError,
+ FrameOpSwapChainOutOfDate,
+ FrameOpDeviceLost
+ };
+
+ enum Feature {
+ MultisampleTexture = 1,
+ MultisampleRenderBuffer,
+ DebugMarkers,
+ Timestamps,
+ Instancing,
+ CustomInstanceStepRate,
+ PrimitiveRestart,
+ NonDynamicUniformBuffers,
+ NonFourAlignedEffectiveIndexBufferOffset,
+ NPOTTextureRepeat,
+ RedOrAlpha8IsRed,
+ ElementIndexUint,
+ Compute,
+ WideLines,
+ VertexShaderPointSize,
+ BaseVertex,
+ BaseInstance,
+ TriangleFanTopology,
+ ReadBackNonUniformBuffer,
+ ReadBackNonBaseMipLevel,
+ TexelFetch,
+ RenderToNonBaseMipLevel,
+ IntAttributes,
+ ScreenSpaceDerivatives,
+ ReadBackAnyTextureFormat,
+ PipelineCacheDataLoadSave,
+ ImageDataStride,
+ RenderBufferImport,
+ ThreeDimensionalTextures,
+ RenderTo3DTextureSlice,
+ TextureArrays,
+ Tessellation,
+ GeometryShader,
+ TextureArrayRange,
+ NonFillPolygonMode,
+ OneDimensionalTextures,
+ OneDimensionalTextureMipmaps,
+ HalfAttributes,
+ RenderToOneDimensionalTexture,
+ ThreeDimensionalTextureMipmaps,
+ MultiView,
+ TextureViewFormat,
+ ResolveDepthStencil
+ };
+
+ enum BeginFrameFlag {
+ };
+ Q_DECLARE_FLAGS(BeginFrameFlags, BeginFrameFlag)
+
+ enum EndFrameFlag {
+ SkipPresent = 1 << 0
+ };
+ Q_DECLARE_FLAGS(EndFrameFlags, EndFrameFlag)
+
+ enum ResourceLimit {
+ TextureSizeMin = 1,
+ TextureSizeMax,
+ MaxColorAttachments,
+ FramesInFlight,
+ MaxAsyncReadbackFrames,
+ MaxThreadGroupsPerDimension,
+ MaxThreadsPerThreadGroup,
+ MaxThreadGroupX,
+ MaxThreadGroupY,
+ MaxThreadGroupZ,
+ TextureArraySizeMax,
+ MaxUniformBufferRange,
+ MaxVertexInputs,
+ MaxVertexOutputs
+ };
+
+ ~QRhi();
+
+ static QRhi *create(Implementation impl,
+ QRhiInitParams *params,
+ Flags flags = {},
+ QRhiNativeHandles *importDevice = nullptr);
+ static bool probe(Implementation impl, QRhiInitParams *params);
+
+ Implementation backend() const;
+ const char *backendName() const;
+ static const char *backendName(Implementation impl);
+ QRhiDriverInfo driverInfo() const;
+ QThread *thread() const;
+
+ using CleanupCallback = std::function<void(QRhi *)>;
+ void addCleanupCallback(const CleanupCallback &callback);
+ void addCleanupCallback(const void *key, const CleanupCallback &callback);
+ void removeCleanupCallback(const void *key);
+ void runCleanup();
+
+ QRhiGraphicsPipeline *newGraphicsPipeline();
+ QRhiComputePipeline *newComputePipeline();
+ QRhiShaderResourceBindings *newShaderResourceBindings();
+
+ QRhiBuffer *newBuffer(QRhiBuffer::Type type,
+ QRhiBuffer::UsageFlags usage,
+ quint32 size);
+
+ QRhiRenderBuffer *newRenderBuffer(QRhiRenderBuffer::Type type,
+ const QSize &pixelSize,
+ int sampleCount = 1,
+ QRhiRenderBuffer::Flags flags = {},
+ QRhiTexture::Format backingFormatHint = QRhiTexture::UnknownFormat);
+
+ QRhiTexture *newTexture(QRhiTexture::Format format,
+ const QSize &pixelSize,
+ int sampleCount = 1,
+ QRhiTexture::Flags flags = {});
+
+ QRhiTexture *newTexture(QRhiTexture::Format format,
+ int width, int height, int depth,
+ int sampleCount = 1,
+ QRhiTexture::Flags flags = {});
+
+ QRhiTexture *newTextureArray(QRhiTexture::Format format,
+ int arraySize,
+ const QSize &pixelSize,
+ int sampleCount = 1,
+ QRhiTexture::Flags flags = {});
+
+ QRhiSampler *newSampler(QRhiSampler::Filter magFilter,
+ QRhiSampler::Filter minFilter,
+ QRhiSampler::Filter mipmapMode,
+ QRhiSampler::AddressMode addressU,
+ QRhiSampler::AddressMode addressV,
+ QRhiSampler::AddressMode addressW = QRhiSampler::Repeat);
+
+ QRhiTextureRenderTarget *newTextureRenderTarget(const QRhiTextureRenderTargetDescription &desc,
+ QRhiTextureRenderTarget::Flags flags = {});
+
+ QRhiSwapChain *newSwapChain();
+ FrameOpResult beginFrame(QRhiSwapChain *swapChain, BeginFrameFlags flags = {});
+ FrameOpResult endFrame(QRhiSwapChain *swapChain, EndFrameFlags flags = {});
+ bool isRecordingFrame() const;
+ int currentFrameSlot() const;
+
+ FrameOpResult beginOffscreenFrame(QRhiCommandBuffer **cb, BeginFrameFlags flags = {});
+ FrameOpResult endOffscreenFrame(EndFrameFlags flags = {});
+
+ QRhi::FrameOpResult finish();
+
+ QRhiResourceUpdateBatch *nextResourceUpdateBatch();
+
+ QList<int> supportedSampleCounts() const;
+
+ int ubufAlignment() const;
+ int ubufAligned(int v) const;
+
+ static int mipLevelsForSize(const QSize &size);
+ static QSize sizeForMipLevel(int mipLevel, const QSize &baseLevelSize);
+
+ bool isYUpInFramebuffer() const;
+ bool isYUpInNDC() const;
+ bool isClipDepthZeroToOne() const;
+
+ QMatrix4x4 clipSpaceCorrMatrix() const;
+
+ bool isTextureFormatSupported(QRhiTexture::Format format, QRhiTexture::Flags flags = {}) const;
+ bool isFeatureSupported(QRhi::Feature feature) const;
+ int resourceLimit(ResourceLimit limit) const;
+
+ const QRhiNativeHandles *nativeHandles();
+ bool makeThreadLocalNativeContextCurrent();
+
+ static constexpr int MAX_MIP_LEVELS = 16; // -> max width or height is 65536
+
+ void releaseCachedResources();
+
+ bool isDeviceLost() const;
+
+ QByteArray pipelineCacheData();
+ void setPipelineCacheData(const QByteArray &data);
+
+ QRhiStats statistics() const;
+
+ static QRhiSwapChainProxyData updateSwapChainProxyData(Implementation impl, QWindow *window);
+
+protected:
+ QRhi();
+
+private:
+ Q_DISABLE_COPY(QRhi)
+ QRhiImplementation *d = nullptr;
+};
+
+Q_DECLARE_OPERATORS_FOR_FLAGS(QRhi::Flags)
+Q_DECLARE_OPERATORS_FOR_FLAGS(QRhi::BeginFrameFlags)
+Q_DECLARE_OPERATORS_FOR_FLAGS(QRhi::EndFrameFlags)
+
+QT_END_NAMESPACE
+
+#include <rhi/qrhi_platform.h>
+
+#endif
diff --git a/src/gui/rhi/qrhi_p.h b/src/gui/rhi/qrhi_p.h
index 44118b2f10..b5429372a8 100644
--- a/src/gui/rhi/qrhi_p.h
+++ b/src/gui/rhi/qrhi_p.h
@@ -1,41 +1,8 @@
-/****************************************************************************
-**
-** Copyright (C) 2019 The Qt Company Ltd.
-** Contact: http://www.qt.io/licensing/
-**
-** This file is part of the Qt Gui module
-**
-** $QT_BEGIN_LICENSE:LGPL3$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef QRHI_H
-#define QRHI_H
+// Copyright (C) 2023 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
+
+#ifndef QRHI_P_H
+#define QRHI_P_H
//
// W A R N I N G
@@ -48,1493 +15,803 @@
// We mean it.
//
-#include <QtGui/qtguiglobal.h>
-#include <QSize>
-#include <QMatrix4x4>
-#include <QVector>
-#include <QVarLengthArray>
-#include <QThread>
-#include <QColor>
-#include <QImage>
-#include <functional>
-#include <array>
-#include <private/qshader_p.h>
+#include <rhi/qrhi.h>
+#include <QBitArray>
+#include <QAtomicInt>
+#include <QElapsedTimer>
+#include <QLoggingCategory>
+#include <QtCore/qset.h>
+#include <QtCore/qvarlengtharray.h>
QT_BEGIN_NAMESPACE
-class QWindow;
-class QRhiImplementation;
-class QRhiBuffer;
-class QRhiRenderBuffer;
-class QRhiTexture;
-class QRhiSampler;
-class QRhiCommandBuffer;
-class QRhiResourceUpdateBatch;
-class QRhiResourceUpdateBatchPrivate;
-class QRhiProfiler;
-
-class Q_GUI_EXPORT QRhiDepthStencilClearValue
-{
-public:
- QRhiDepthStencilClearValue() = default;
- QRhiDepthStencilClearValue(float d, quint32 s);
-
- float depthClearValue() const { return m_d; }
- void setDepthClearValue(float d) { m_d = d; }
+#define QRHI_RES(t, x) static_cast<t *>(x)
+#define QRHI_RES_RHI(t) t *rhiD = static_cast<t *>(m_rhi)
- quint32 stencilClearValue() const { return m_s; }
- void setStencilClearValue(quint32 s) { m_s = s; }
-
-private:
- float m_d = 1.0f;
- quint32 m_s = 0;
-};
+Q_DECLARE_LOGGING_CATEGORY(QRHI_LOG_INFO)
-Q_DECLARE_TYPEINFO(QRhiDepthStencilClearValue, Q_MOVABLE_TYPE);
-
-Q_GUI_EXPORT bool operator==(const QRhiDepthStencilClearValue &a, const QRhiDepthStencilClearValue &b) Q_DECL_NOTHROW;
-Q_GUI_EXPORT bool operator!=(const QRhiDepthStencilClearValue &a, const QRhiDepthStencilClearValue &b) Q_DECL_NOTHROW;
-Q_GUI_EXPORT uint qHash(const QRhiDepthStencilClearValue &v, uint seed = 0) Q_DECL_NOTHROW;
-#ifndef QT_NO_DEBUG_STREAM
-Q_GUI_EXPORT QDebug operator<<(QDebug, const QRhiDepthStencilClearValue &);
-#endif
-
-class Q_GUI_EXPORT QRhiViewport
+class QRhiImplementation
{
public:
- QRhiViewport() = default;
- QRhiViewport(float x, float y, float w, float h, float minDepth = 0.0f, float maxDepth = 1.0f);
-
- std::array<float, 4> viewport() const { return m_rect; }
- void setViewport(float x, float y, float w, float h) {
- m_rect[0] = x; m_rect[1] = y; m_rect[2] = w; m_rect[3] = h;
+ virtual ~QRhiImplementation();
+
+ virtual bool create(QRhi::Flags flags) = 0;
+ virtual void destroy() = 0;
+
+ virtual QRhiGraphicsPipeline *createGraphicsPipeline() = 0;
+ virtual QRhiComputePipeline *createComputePipeline() = 0;
+ virtual QRhiShaderResourceBindings *createShaderResourceBindings() = 0;
+ virtual QRhiBuffer *createBuffer(QRhiBuffer::Type type,
+ QRhiBuffer::UsageFlags usage,
+ quint32 size) = 0;
+ virtual QRhiRenderBuffer *createRenderBuffer(QRhiRenderBuffer::Type type,
+ const QSize &pixelSize,
+ int sampleCount,
+ QRhiRenderBuffer::Flags flags,
+ QRhiTexture::Format backingFormatHint) = 0;
+ virtual QRhiTexture *createTexture(QRhiTexture::Format format,
+ const QSize &pixelSize,
+ int depth,
+ int arraySize,
+ int sampleCount,
+ QRhiTexture::Flags flags) = 0;
+ virtual QRhiSampler *createSampler(QRhiSampler::Filter magFilter,
+ QRhiSampler::Filter minFilter,
+ QRhiSampler::Filter mipmapMode,
+ QRhiSampler:: AddressMode u,
+ QRhiSampler::AddressMode v,
+ QRhiSampler::AddressMode w) = 0;
+
+ virtual QRhiTextureRenderTarget *createTextureRenderTarget(const QRhiTextureRenderTargetDescription &desc,
+ QRhiTextureRenderTarget::Flags flags) = 0;
+
+ virtual QRhiSwapChain *createSwapChain() = 0;
+ virtual QRhi::FrameOpResult beginFrame(QRhiSwapChain *swapChain, QRhi::BeginFrameFlags flags) = 0;
+ virtual QRhi::FrameOpResult endFrame(QRhiSwapChain *swapChain, QRhi::EndFrameFlags flags) = 0;
+ virtual QRhi::FrameOpResult beginOffscreenFrame(QRhiCommandBuffer **cb, QRhi::BeginFrameFlags flags) = 0;
+ virtual QRhi::FrameOpResult endOffscreenFrame(QRhi::EndFrameFlags flags) = 0;
+ virtual QRhi::FrameOpResult finish() = 0;
+
+ virtual void resourceUpdate(QRhiCommandBuffer *cb, QRhiResourceUpdateBatch *resourceUpdates) = 0;
+
+ virtual void beginPass(QRhiCommandBuffer *cb,
+ QRhiRenderTarget *rt,
+ const QColor &colorClearValue,
+ const QRhiDepthStencilClearValue &depthStencilClearValue,
+ QRhiResourceUpdateBatch *resourceUpdates,
+ QRhiCommandBuffer::BeginPassFlags flags) = 0;
+ virtual void endPass(QRhiCommandBuffer *cb, QRhiResourceUpdateBatch *resourceUpdates) = 0;
+
+ virtual void setGraphicsPipeline(QRhiCommandBuffer *cb,
+ QRhiGraphicsPipeline *ps) = 0;
+
+ virtual void setShaderResources(QRhiCommandBuffer *cb,
+ QRhiShaderResourceBindings *srb,
+ int dynamicOffsetCount,
+ const QRhiCommandBuffer::DynamicOffset *dynamicOffsets) = 0;
+
+ virtual void setVertexInput(QRhiCommandBuffer *cb,
+ int startBinding, int bindingCount, const QRhiCommandBuffer::VertexInput *bindings,
+ QRhiBuffer *indexBuf, quint32 indexOffset,
+ QRhiCommandBuffer::IndexFormat indexFormat) = 0;
+
+ virtual void setViewport(QRhiCommandBuffer *cb, const QRhiViewport &viewport) = 0;
+ virtual void setScissor(QRhiCommandBuffer *cb, const QRhiScissor &scissor) = 0;
+ virtual void setBlendConstants(QRhiCommandBuffer *cb, const QColor &c) = 0;
+ virtual void setStencilRef(QRhiCommandBuffer *cb, quint32 refValue) = 0;
+
+ virtual void draw(QRhiCommandBuffer *cb, quint32 vertexCount,
+ quint32 instanceCount, quint32 firstVertex, quint32 firstInstance) = 0;
+ virtual void drawIndexed(QRhiCommandBuffer *cb, quint32 indexCount,
+ quint32 instanceCount, quint32 firstIndex,
+ qint32 vertexOffset, quint32 firstInstance) = 0;
+
+ virtual void debugMarkBegin(QRhiCommandBuffer *cb, const QByteArray &name) = 0;
+ virtual void debugMarkEnd(QRhiCommandBuffer *cb) = 0;
+ virtual void debugMarkMsg(QRhiCommandBuffer *cb, const QByteArray &msg) = 0;
+
+ virtual void beginComputePass(QRhiCommandBuffer *cb,
+ QRhiResourceUpdateBatch *resourceUpdates,
+ QRhiCommandBuffer::BeginPassFlags flags) = 0;
+ virtual void endComputePass(QRhiCommandBuffer *cb, QRhiResourceUpdateBatch *resourceUpdates) = 0;
+ virtual void setComputePipeline(QRhiCommandBuffer *cb, QRhiComputePipeline *ps) = 0;
+ virtual void dispatch(QRhiCommandBuffer *cb, int x, int y, int z) = 0;
+
+ virtual const QRhiNativeHandles *nativeHandles(QRhiCommandBuffer *cb) = 0;
+ virtual void beginExternal(QRhiCommandBuffer *cb) = 0;
+ virtual void endExternal(QRhiCommandBuffer *cb) = 0;
+ virtual double lastCompletedGpuTime(QRhiCommandBuffer *cb) = 0;
+
+ virtual QList<int> supportedSampleCounts() const = 0;
+ virtual int ubufAlignment() const = 0;
+ virtual bool isYUpInFramebuffer() const = 0;
+ virtual bool isYUpInNDC() const = 0;
+ virtual bool isClipDepthZeroToOne() const = 0;
+ virtual QMatrix4x4 clipSpaceCorrMatrix() const = 0;
+ virtual bool isTextureFormatSupported(QRhiTexture::Format format, QRhiTexture::Flags flags) const = 0;
+ virtual bool isFeatureSupported(QRhi::Feature feature) const = 0;
+ virtual int resourceLimit(QRhi::ResourceLimit limit) const = 0;
+ virtual const QRhiNativeHandles *nativeHandles() = 0;
+ virtual QRhiDriverInfo driverInfo() const = 0;
+ virtual QRhiStats statistics() = 0;
+ virtual bool makeThreadLocalNativeContextCurrent() = 0;
+ virtual void releaseCachedResources() = 0;
+ virtual bool isDeviceLost() const = 0;
+
+ virtual QByteArray pipelineCacheData() = 0;
+ virtual void setPipelineCacheData(const QByteArray &data) = 0;
+
+ void prepareForCreate(QRhi *rhi, QRhi::Implementation impl, QRhi::Flags flags);
+
+ bool isCompressedFormat(QRhiTexture::Format format) const;
+ void compressedFormatInfo(QRhiTexture::Format format, const QSize &size,
+ quint32 *bpl, quint32 *byteSize,
+ QSize *blockDim) const;
+ void textureFormatInfo(QRhiTexture::Format format, const QSize &size,
+ quint32 *bpl, quint32 *byteSize, quint32 *bytesPerPixel) const;
+ bool isStencilSupportingFormat(QRhiTexture::Format format) const;
+
+ void registerResource(QRhiResource *res, bool ownsNativeResources = true)
+ {
+ // The ownsNativeResources is relevant for the (graphics resource) leak
+ // check in ~QRhiImplementation; when false, the registration's sole
+ // purpose is to automatically null out the resource's m_rhi pointer in
+ // case the rhi goes away first. (which should not happen in
+ // well-written applications but we try to be graceful)
+ resources.insert(res, ownsNativeResources);
}
- float minDepth() const { return m_minDepth; }
- void setMinDepth(float minDepth) { m_minDepth = minDepth; }
-
- float maxDepth() const { return m_maxDepth; }
- void setMaxDepth(float maxDepth) { m_maxDepth = maxDepth; }
-
-private:
- std::array<float, 4> m_rect { { 0.0f, 0.0f, 0.0f, 0.0f } };
- float m_minDepth = 0.0f;
- float m_maxDepth = 1.0f;
-};
-
-Q_DECLARE_TYPEINFO(QRhiViewport, Q_MOVABLE_TYPE);
-
-Q_GUI_EXPORT bool operator==(const QRhiViewport &a, const QRhiViewport &b) Q_DECL_NOTHROW;
-Q_GUI_EXPORT bool operator!=(const QRhiViewport &a, const QRhiViewport &b) Q_DECL_NOTHROW;
-Q_GUI_EXPORT uint qHash(const QRhiViewport &v, uint seed = 0) Q_DECL_NOTHROW;
-#ifndef QT_NO_DEBUG_STREAM
-Q_GUI_EXPORT QDebug operator<<(QDebug, const QRhiViewport &);
-#endif
-
-class Q_GUI_EXPORT QRhiScissor
-{
-public:
- QRhiScissor() = default;
- QRhiScissor(int x, int y, int w, int h);
-
- std::array<int, 4> scissor() const { return m_rect; }
- void setScissor(int x, int y, int w, int h) {
- m_rect[0] = x; m_rect[1] = y; m_rect[2] = w; m_rect[3] = h;
+ void unregisterResource(QRhiResource *res)
+ {
+ resources.remove(res);
}
-private:
- std::array<int, 4> m_rect { { 0, 0, 0, 0 } };
-};
-
-Q_DECLARE_TYPEINFO(QRhiScissor, Q_MOVABLE_TYPE);
-
-Q_GUI_EXPORT bool operator==(const QRhiScissor &a, const QRhiScissor &b) Q_DECL_NOTHROW;
-Q_GUI_EXPORT bool operator!=(const QRhiScissor &a, const QRhiScissor &b) Q_DECL_NOTHROW;
-Q_GUI_EXPORT uint qHash(const QRhiScissor &v, uint seed = 0) Q_DECL_NOTHROW;
-#ifndef QT_NO_DEBUG_STREAM
-Q_GUI_EXPORT QDebug operator<<(QDebug, const QRhiScissor &);
-#endif
-
-class Q_GUI_EXPORT QRhiVertexInputBinding
-{
-public:
- enum Classification {
- PerVertex,
- PerInstance
- };
-
- QRhiVertexInputBinding() = default;
- QRhiVertexInputBinding(quint32 stride, Classification cls = PerVertex, int stepRate = 1);
-
- quint32 stride() const { return m_stride; }
- void setStride(quint32 s) { m_stride = s; }
-
- Classification classification() const { return m_classification; }
- void setClassification(Classification c) { m_classification = c; }
-
- int instanceStepRate() const { return m_instanceStepRate; }
- void setInstanceStepRate(int rate) { m_instanceStepRate = rate; }
-
-private:
- quint32 m_stride = 0;
- Classification m_classification = PerVertex;
- int m_instanceStepRate = 1;
-};
-
-Q_DECLARE_TYPEINFO(QRhiVertexInputBinding, Q_MOVABLE_TYPE);
-
-Q_GUI_EXPORT bool operator==(const QRhiVertexInputBinding &a, const QRhiVertexInputBinding &b) Q_DECL_NOTHROW;
-Q_GUI_EXPORT bool operator!=(const QRhiVertexInputBinding &a, const QRhiVertexInputBinding &b) Q_DECL_NOTHROW;
-Q_GUI_EXPORT uint qHash(const QRhiVertexInputBinding &v, uint seed = 0) Q_DECL_NOTHROW;
-#ifndef QT_NO_DEBUG_STREAM
-Q_GUI_EXPORT QDebug operator<<(QDebug, const QRhiVertexInputBinding &);
-#endif
-
-class Q_GUI_EXPORT QRhiVertexInputAttribute
-{
-public:
- enum Format {
- Float4,
- Float3,
- Float2,
- Float,
- UNormByte4,
- UNormByte2,
- UNormByte
- };
-
- QRhiVertexInputAttribute() = default;
- QRhiVertexInputAttribute(int binding, int location, Format format, quint32 offset);
-
- int binding() const { return m_binding; }
- void setBinding(int b) { m_binding = b; }
-
- int location() const { return m_location; }
- void setLocation(int loc) { m_location = loc; }
-
- Format format() const { return m_format; }
- void setFormt(Format f) { m_format = f; }
-
- quint32 offset() const { return m_offset; }
- void setOffset(quint32 ofs) { m_offset = ofs; }
-
-private:
- int m_binding = 0;
- int m_location = 0;
- Format m_format = Float4;
- quint32 m_offset = 0;
-};
-
-Q_DECLARE_TYPEINFO(QRhiVertexInputAttribute, Q_MOVABLE_TYPE);
-
-Q_GUI_EXPORT bool operator==(const QRhiVertexInputAttribute &a, const QRhiVertexInputAttribute &b) Q_DECL_NOTHROW;
-Q_GUI_EXPORT bool operator!=(const QRhiVertexInputAttribute &a, const QRhiVertexInputAttribute &b) Q_DECL_NOTHROW;
-Q_GUI_EXPORT uint qHash(const QRhiVertexInputAttribute &v, uint seed = 0) Q_DECL_NOTHROW;
-#ifndef QT_NO_DEBUG_STREAM
-Q_GUI_EXPORT QDebug operator<<(QDebug, const QRhiVertexInputAttribute &);
-#endif
-
-class Q_GUI_EXPORT QRhiVertexInputLayout
-{
-public:
- QRhiVertexInputLayout() = default;
-
- void setBindings(std::initializer_list<QRhiVertexInputBinding> list) { m_bindings = list; }
- template<typename InputIterator>
- void setBindings(InputIterator first, InputIterator last)
+ void addDeleteLater(QRhiResource *res)
{
- m_bindings.clear();
- std::copy(first, last, std::back_inserter(m_bindings));
+ if (inFrame)
+ pendingDeleteResources.insert(res);
+ else
+ delete res;
}
- const QRhiVertexInputBinding *cbeginBindings() const { return m_bindings.cbegin(); }
- const QRhiVertexInputBinding *cendBindings() const { return m_bindings.cend(); }
- const QRhiVertexInputBinding *bindingAt(int index) const { return &m_bindings.at(index); }
- void setAttributes(std::initializer_list<QRhiVertexInputAttribute> list) { m_attributes = list; }
- template<typename InputIterator>
- void setAttributes(InputIterator first, InputIterator last)
+ void addCleanupCallback(const QRhi::CleanupCallback &callback)
{
- m_attributes.clear();
- std::copy(first, last, std::back_inserter(m_attributes));
+ cleanupCallbacks.append(callback);
}
- const QRhiVertexInputAttribute *cbeginAttributes() const { return m_attributes.cbegin(); }
- const QRhiVertexInputAttribute *cendAttributes() const { return m_attributes.cend(); }
-
-private:
- QVarLengthArray<QRhiVertexInputBinding, 8> m_bindings;
- QVarLengthArray<QRhiVertexInputAttribute, 8> m_attributes;
-
- friend Q_GUI_EXPORT bool operator==(const QRhiVertexInputLayout &a, const QRhiVertexInputLayout &b) Q_DECL_NOTHROW;
- friend Q_GUI_EXPORT uint qHash(const QRhiVertexInputLayout &v, uint seed) Q_DECL_NOTHROW;
- friend Q_GUI_EXPORT QDebug operator<<(QDebug, const QRhiVertexInputLayout &);
-};
-
-Q_DECLARE_TYPEINFO(QRhiVertexInputLayout, Q_MOVABLE_TYPE);
-
-Q_GUI_EXPORT bool operator==(const QRhiVertexInputLayout &a, const QRhiVertexInputLayout &b) Q_DECL_NOTHROW;
-Q_GUI_EXPORT bool operator!=(const QRhiVertexInputLayout &a, const QRhiVertexInputLayout &b) Q_DECL_NOTHROW;
-Q_GUI_EXPORT uint qHash(const QRhiVertexInputLayout &v, uint seed = 0) Q_DECL_NOTHROW;
-#ifndef QT_NO_DEBUG_STREAM
-Q_GUI_EXPORT QDebug operator<<(QDebug, const QRhiVertexInputLayout &);
-#endif
-
-class Q_GUI_EXPORT QRhiShaderStage
-{
-public:
- enum Type {
- Vertex,
- Fragment,
- Compute
- };
-
- QRhiShaderStage() = default;
- QRhiShaderStage(Type type, const QShader &shader,
- QShader::Variant v = QShader::StandardShader);
-
- Type type() const { return m_type; }
- void setType(Type t) { m_type = t; }
-
- QShader shader() const { return m_shader; }
- void setShader(const QShader &s) { m_shader = s; }
- QShader::Variant shaderVariant() const { return m_shaderVariant; }
- void setShaderVariant(QShader::Variant v) { m_shaderVariant = v; }
-
-private:
- Type m_type = Vertex;
- QShader m_shader;
- QShader::Variant m_shaderVariant = QShader::StandardShader;
-};
-
-Q_DECLARE_TYPEINFO(QRhiShaderStage, Q_MOVABLE_TYPE);
-
-Q_GUI_EXPORT bool operator==(const QRhiShaderStage &a, const QRhiShaderStage &b) Q_DECL_NOTHROW;
-Q_GUI_EXPORT bool operator!=(const QRhiShaderStage &a, const QRhiShaderStage &b) Q_DECL_NOTHROW;
-Q_GUI_EXPORT uint qHash(const QRhiShaderStage &s, uint seed = 0) Q_DECL_NOTHROW;
-#ifndef QT_NO_DEBUG_STREAM
-Q_GUI_EXPORT QDebug operator<<(QDebug, const QRhiShaderStage &);
-#endif
-
-using QRhiGraphicsShaderStage = QRhiShaderStage;
-
-class Q_GUI_EXPORT QRhiShaderResourceBinding
-{
-public:
- enum Type {
- UniformBuffer,
- SampledTexture,
- ImageLoad,
- ImageStore,
- ImageLoadStore,
- BufferLoad,
- BufferStore,
- BufferLoadStore
- };
-
- enum StageFlag {
- VertexStage = 1 << 0,
- FragmentStage = 1 << 1,
- ComputeStage = 1 << 2
- };
- Q_DECLARE_FLAGS(StageFlags, StageFlag)
-
- QRhiShaderResourceBinding();
-
- bool isLayoutCompatible(const QRhiShaderResourceBinding &other) const;
-
- static QRhiShaderResourceBinding uniformBuffer(int binding, StageFlags stage, QRhiBuffer *buf);
- static QRhiShaderResourceBinding uniformBuffer(int binding, StageFlags stage, QRhiBuffer *buf, int offset, int size);
- static QRhiShaderResourceBinding uniformBufferWithDynamicOffset(int binding, StageFlags stage, QRhiBuffer *buf, int size);
-
- static QRhiShaderResourceBinding sampledTexture(int binding, StageFlags stage, QRhiTexture *tex, QRhiSampler *sampler);
-
- static QRhiShaderResourceBinding imageLoad(int binding, StageFlags stage, QRhiTexture *tex, int level);
- static QRhiShaderResourceBinding imageStore(int binding, StageFlags stage, QRhiTexture *tex, int level);
- static QRhiShaderResourceBinding imageLoadStore(int binding, StageFlags stage, QRhiTexture *tex, int level);
-
- static QRhiShaderResourceBinding bufferLoad(int binding, StageFlags stage, QRhiBuffer *buf);
- static QRhiShaderResourceBinding bufferLoad(int binding, StageFlags stage, QRhiBuffer *buf, int offset, int size);
- static QRhiShaderResourceBinding bufferStore(int binding, StageFlags stage, QRhiBuffer *buf);
- static QRhiShaderResourceBinding bufferStore(int binding, StageFlags stage, QRhiBuffer *buf, int offset, int size);
- static QRhiShaderResourceBinding bufferLoadStore(int binding, StageFlags stage, QRhiBuffer *buf);
- static QRhiShaderResourceBinding bufferLoadStore(int binding, StageFlags stage, QRhiBuffer *buf, int offset, int size);
-
- struct Data
+ void addCleanupCallback(const void *key, const QRhi::CleanupCallback &callback)
{
- int binding;
- QRhiShaderResourceBinding::StageFlags stage;
- QRhiShaderResourceBinding::Type type;
- struct UniformBufferData {
- QRhiBuffer *buf;
- int offset;
- int maybeSize;
- bool hasDynamicOffset;
- };
- struct SampledTextureData {
- QRhiTexture *tex;
- QRhiSampler *sampler;
- };
- struct StorageImageData {
- QRhiTexture *tex;
- int level;
- };
- struct StorageBufferData {
- QRhiBuffer *buf;
- int offset;
- int maybeSize;
- };
- union {
- UniformBufferData ubuf;
- SampledTextureData stex;
- StorageImageData simage;
- StorageBufferData sbuf;
- } u;
- };
-
- Data *data() { return &d; }
- const Data *data() const { return &d; }
-
-private:
- Data d;
-};
-
-Q_DECLARE_OPERATORS_FOR_FLAGS(QRhiShaderResourceBinding::StageFlags)
-
-Q_DECLARE_TYPEINFO(QRhiShaderResourceBinding, Q_MOVABLE_TYPE);
-
-Q_GUI_EXPORT bool operator==(const QRhiShaderResourceBinding &a, const QRhiShaderResourceBinding &b) Q_DECL_NOTHROW;
-Q_GUI_EXPORT bool operator!=(const QRhiShaderResourceBinding &a, const QRhiShaderResourceBinding &b) Q_DECL_NOTHROW;
-Q_GUI_EXPORT uint qHash(const QRhiShaderResourceBinding &b, uint seed = 0) Q_DECL_NOTHROW;
-#ifndef QT_NO_DEBUG_STREAM
-Q_GUI_EXPORT QDebug operator<<(QDebug, const QRhiShaderResourceBinding &);
-#endif
-
-class Q_GUI_EXPORT QRhiColorAttachment
-{
-public:
- QRhiColorAttachment() = default;
- QRhiColorAttachment(QRhiTexture *texture);
- QRhiColorAttachment(QRhiRenderBuffer *renderBuffer);
-
- QRhiTexture *texture() const { return m_texture; }
- void setTexture(QRhiTexture *tex) { m_texture = tex; }
-
- QRhiRenderBuffer *renderBuffer() const { return m_renderBuffer; }
- void setRenderBuffer(QRhiRenderBuffer *rb) { m_renderBuffer = rb; }
-
- int layer() const { return m_layer; }
- void setLayer(int layer) { m_layer = layer; }
-
- int level() const { return m_level; }
- void setLevel(int level) { m_level = level; }
-
- QRhiTexture *resolveTexture() const { return m_resolveTexture; }
- void setResolveTexture(QRhiTexture *tex) { m_resolveTexture = tex; }
-
- int resolveLayer() const { return m_resolveLayer; }
- void setResolveLayer(int layer) { m_resolveLayer = layer; }
-
- int resolveLevel() const { return m_resolveLevel; }
- void setResolveLevel(int level) { m_resolveLevel = level; }
-
-private:
- QRhiTexture *m_texture = nullptr;
- QRhiRenderBuffer *m_renderBuffer = nullptr;
- int m_layer = 0;
- int m_level = 0;
- QRhiTexture *m_resolveTexture = nullptr;
- int m_resolveLayer = 0;
- int m_resolveLevel = 0;
-};
-
-Q_DECLARE_TYPEINFO(QRhiColorAttachment, Q_MOVABLE_TYPE);
+ keyedCleanupCallbacks[key] = callback;
+ }
-class Q_GUI_EXPORT QRhiTextureRenderTargetDescription
-{
-public:
- QRhiTextureRenderTargetDescription() = default;
- QRhiTextureRenderTargetDescription(const QRhiColorAttachment &colorAttachment);
- QRhiTextureRenderTargetDescription(const QRhiColorAttachment &colorAttachment, QRhiRenderBuffer *depthStencilBuffer);
- QRhiTextureRenderTargetDescription(const QRhiColorAttachment &colorAttachment, QRhiTexture *depthTexture);
-
- void setColorAttachments(std::initializer_list<QRhiColorAttachment> list) { m_colorAttachments = list; }
- template<typename InputIterator>
- void setColorAttachments(InputIterator first, InputIterator last)
+ void removeCleanupCallback(const void *key)
{
- m_colorAttachments.clear();
- std::copy(first, last, std::back_inserter(m_colorAttachments));
+ keyedCleanupCallbacks.remove(key);
}
- const QRhiColorAttachment *cbeginColorAttachments() const { return m_colorAttachments.cbegin(); }
- const QRhiColorAttachment *cendColorAttachments() const { return m_colorAttachments.cend(); }
- const QRhiColorAttachment *colorAttachmentAt(int index) const { return &m_colorAttachments.at(index); }
-
- QRhiRenderBuffer *depthStencilBuffer() const { return m_depthStencilBuffer; }
- void setDepthStencilBuffer(QRhiRenderBuffer *renderBuffer) { m_depthStencilBuffer = renderBuffer; }
-
- QRhiTexture *depthTexture() const { return m_depthTexture; }
- void setDepthTexture(QRhiTexture *texture) { m_depthTexture = texture; }
-
-private:
- QVarLengthArray<QRhiColorAttachment, 8> m_colorAttachments;
- QRhiRenderBuffer *m_depthStencilBuffer = nullptr;
- QRhiTexture *m_depthTexture = nullptr;
-};
-
-Q_DECLARE_TYPEINFO(QRhiTextureRenderTargetDescription, Q_MOVABLE_TYPE);
-
-class Q_GUI_EXPORT QRhiTextureSubresourceUploadDescription
-{
-public:
- QRhiTextureSubresourceUploadDescription() = default;
- QRhiTextureSubresourceUploadDescription(const QImage &image);
- QRhiTextureSubresourceUploadDescription(const void *data, int size);
-
- QImage image() const { return m_image; }
- void setImage(const QImage &image) { m_image = image; }
-
- QByteArray data() const { return m_data; }
- void setData(const QByteArray &data) { m_data = data; }
-
- QPoint destinationTopLeft() const { return m_destinationTopLeft; }
- void setDestinationTopLeft(const QPoint &p) { m_destinationTopLeft = p; }
-
- QSize sourceSize() const { return m_sourceSize; }
- void setSourceSize(const QSize &size) { m_sourceSize = size; }
-
- QPoint sourceTopLeft() const { return m_sourceTopLeft; }
- void setSourceTopLeft(const QPoint &p) { m_sourceTopLeft = p; }
-
-private:
- QImage m_image;
- QByteArray m_data;
- QPoint m_destinationTopLeft;
- QSize m_sourceSize;
- QPoint m_sourceTopLeft;
-};
-
-Q_DECLARE_TYPEINFO(QRhiTextureSubresourceUploadDescription, Q_MOVABLE_TYPE);
-
-class Q_GUI_EXPORT QRhiTextureUploadEntry
-{
-public:
- QRhiTextureUploadEntry() = default;
- QRhiTextureUploadEntry(int layer, int level, const QRhiTextureSubresourceUploadDescription &desc);
-
- int layer() const { return m_layer; }
- void setLayer(int layer) { m_layer = layer; }
-
- int level() const { return m_level; }
- void setLevel(int level) { m_level = level; }
-
- QRhiTextureSubresourceUploadDescription description() const { return m_desc; }
- void setDescription(const QRhiTextureSubresourceUploadDescription &desc) { m_desc = desc; }
-
-private:
- int m_layer = 0;
- int m_level = 0;
- QRhiTextureSubresourceUploadDescription m_desc;
-};
-Q_DECLARE_TYPEINFO(QRhiTextureUploadEntry, Q_MOVABLE_TYPE);
+ bool sanityCheckGraphicsPipeline(QRhiGraphicsPipeline *ps);
+ bool sanityCheckShaderResourceBindings(QRhiShaderResourceBindings *srb);
+ void updateLayoutDesc(QRhiShaderResourceBindings *srb);
-class Q_GUI_EXPORT QRhiTextureUploadDescription
-{
-public:
- QRhiTextureUploadDescription() = default;
- QRhiTextureUploadDescription(const QRhiTextureUploadEntry &entry);
- QRhiTextureUploadDescription(std::initializer_list<QRhiTextureUploadEntry> list);
-
- void setEntries(std::initializer_list<QRhiTextureUploadEntry> list) { m_entries = list; }
- template<typename InputIterator>
- void setEntries(InputIterator first, InputIterator last)
+ quint32 pipelineCacheRhiId() const
{
- m_entries.clear();
- std::copy(first, last, std::back_inserter(m_entries));
+ const quint32 ver = (QT_VERSION_MAJOR << 16) | (QT_VERSION_MINOR << 8) | (QT_VERSION_PATCH);
+ return (quint32(implType) << 24) | ver;
}
- const QRhiTextureUploadEntry *cbeginEntries() const { return m_entries.cbegin(); }
- const QRhiTextureUploadEntry *cendEntries() const { return m_entries.cend(); }
-
-private:
- QVarLengthArray<QRhiTextureUploadEntry, 16> m_entries;
-};
-
-Q_DECLARE_TYPEINFO(QRhiTextureUploadDescription, Q_MOVABLE_TYPE);
-
-class Q_GUI_EXPORT QRhiTextureCopyDescription
-{
-public:
- QRhiTextureCopyDescription() = default;
-
- QSize pixelSize() const { return m_pixelSize; }
- void setPixelSize(const QSize &sz) { m_pixelSize = sz; }
- int sourceLayer() const { return m_sourceLayer; }
- void setSourceLayer(int layer) { m_sourceLayer = layer; }
-
- int sourceLevel() const { return m_sourceLevel; }
- void setSourceLevel(int level) { m_sourceLevel = level; }
+ void pipelineCreationStart()
+ {
+ pipelineCreationTimer.start();
+ }
- QPoint sourceTopLeft() const { return m_sourceTopLeft; }
- void setSourceTopLeft(const QPoint &p) { m_sourceTopLeft = p; }
+ void pipelineCreationEnd()
+ {
+ accumulatedPipelineCreationTime += pipelineCreationTimer.elapsed();
+ }
- int destinationLayer() const { return m_destinationLayer; }
- void setDestinationLayer(int layer) { m_destinationLayer = layer; }
+ qint64 totalPipelineCreationTime() const
+ {
+ return accumulatedPipelineCreationTime;
+ }
- int destinationLevel() const { return m_destinationLevel; }
- void setDestinationLevel(int level) { m_destinationLevel = level; }
+ QRhiVertexInputAttribute::Format shaderDescVariableFormatToVertexInputFormat(QShaderDescription::VariableType type) const;
+ quint32 byteSizePerVertexForVertexInputFormat(QRhiVertexInputAttribute::Format format) const;
- QPoint destinationTopLeft() const { return m_destinationTopLeft; }
- void setDestinationTopLeft(const QPoint &p) { m_destinationTopLeft = p; }
+ static const QRhiShaderResourceBinding::Data *shaderResourceBindingData(const QRhiShaderResourceBinding &binding)
+ {
+ return &binding.d;
+ }
-private:
- QSize m_pixelSize;
- int m_sourceLayer = 0;
- int m_sourceLevel = 0;
- QPoint m_sourceTopLeft;
- int m_destinationLayer = 0;
- int m_destinationLevel = 0;
- QPoint m_destinationTopLeft;
-};
+ static QRhiShaderResourceBinding::Data *shaderResourceBindingData(QRhiShaderResourceBinding &binding)
+ {
+ return &binding.d;
+ }
-Q_DECLARE_TYPEINFO(QRhiTextureCopyDescription, Q_MOVABLE_TYPE);
+ static bool sortedBindingLessThan(const QRhiShaderResourceBinding &a, const QRhiShaderResourceBinding &b)
+ {
+ return a.d.binding < b.d.binding;
+ }
-class Q_GUI_EXPORT QRhiReadbackDescription
-{
-public:
- QRhiReadbackDescription() = default;
- QRhiReadbackDescription(QRhiTexture *texture);
+ int effectiveSampleCount(int sampleCount) const;
- QRhiTexture *texture() const { return m_texture; }
- void setTexture(QRhiTexture *tex) { m_texture = tex; }
+ QRhi *q;
- int layer() const { return m_layer; }
- void setLayer(int layer) { m_layer = layer; }
+ static const int MAX_SHADER_CACHE_ENTRIES = 128;
- int level() const { return m_level; }
- void setLevel(int level) { m_level = level; }
+ bool debugMarkers = false;
+ int currentFrameSlot = 0; // for vk, mtl, and similar. unused by gl and d3d11.
+ bool inFrame = false;
private:
- QRhiTexture *m_texture = nullptr;
- int m_layer = 0;
- int m_level = 0;
-};
-
-Q_DECLARE_TYPEINFO(QRhiReadbackDescription, Q_MOVABLE_TYPE);
+ QRhi::Implementation implType;
+ QThread *implThread;
+ QVarLengthArray<QRhiResourceUpdateBatch *, 4> resUpdPool;
+ quint64 resUpdPoolMap = 0;
+ int lastResUpdIdx = -1;
+ QHash<QRhiResource *, bool> resources;
+ QSet<QRhiResource *> pendingDeleteResources;
+ QVarLengthArray<QRhi::CleanupCallback, 4> cleanupCallbacks;
+ QHash<const void *, QRhi::CleanupCallback> keyedCleanupCallbacks;
+ QElapsedTimer pipelineCreationTimer;
+ qint64 accumulatedPipelineCreationTime = 0;
-struct Q_GUI_EXPORT QRhiNativeHandles
-{
+ friend class QRhi;
+ friend class QRhiResourceUpdateBatchPrivate;
};
-class Q_GUI_EXPORT QRhiResource
+enum QRhiTargetRectBoundMode
{
-public:
- enum Type {
- Buffer,
- Texture,
- Sampler,
- RenderBuffer,
- RenderPassDescriptor,
- RenderTarget,
- TextureRenderTarget,
- ShaderResourceBindings,
- GraphicsPipeline,
- SwapChain,
- ComputePipeline,
- CommandBuffer
- };
-
- virtual ~QRhiResource();
-
- virtual Type resourceType() const = 0;
-
- virtual void release() = 0;
- void releaseAndDestroyLater();
-
- QByteArray name() const;
- void setName(const QByteArray &name);
-
- quint64 globalResourceId() const;
-
-protected:
- QRhiResource(QRhiImplementation *rhi);
- Q_DISABLE_COPY(QRhiResource)
- friend class QRhiImplementation;
- QRhiImplementation *m_rhi = nullptr;
- quint64 m_id;
- QByteArray m_objectName;
+ UnBounded,
+ Bounded
};
-class Q_GUI_EXPORT QRhiBuffer : public QRhiResource
+template<QRhiTargetRectBoundMode boundingMode, typename T, size_t N>
+bool qrhi_toTopLeftRenderTargetRect(const QSize &outputSize, const std::array<T, N> &r,
+ T *x, T *y, T *w, T *h)
{
-public:
- enum Type {
- Immutable,
- Static,
- Dynamic
- };
-
- enum UsageFlag {
- VertexBuffer = 1 << 0,
- IndexBuffer = 1 << 1,
- UniformBuffer = 1 << 2,
- StorageBuffer = 1 << 3
- };
- Q_DECLARE_FLAGS(UsageFlags, UsageFlag)
+ // x,y are bottom-left in QRhiScissor and QRhiViewport but top-left in
+ // Vulkan/Metal/D3D. Our input is an OpenGL-style scissor rect where both
+ // negative x or y, and partly or completely out of bounds rects are
+ // allowed. The only thing the input here cannot have is a negative width
+ // or height. We must handle all other input gracefully, clamping to a zero
+ // width or height rect in the worst case, and ensuring the resulting rect
+ // is inside the rendertarget's bounds because some APIs' validation/debug
+ // layers are allergic to out of bounds scissor rects.
- QRhiResource::Type resourceType() const override;
+ const T outputWidth = outputSize.width();
+ const T outputHeight = outputSize.height();
+ const T inputWidth = r[2];
+ const T inputHeight = r[3];
- Type type() const { return m_type; }
- void setType(Type t) { m_type = t; }
+ if (inputWidth < 0 || inputHeight < 0)
+ return false;
- UsageFlags usage() const { return m_usage; }
- void setUsage(UsageFlags u) { m_usage = u; }
+ *x = r[0];
+ *y = outputHeight - (r[1] + inputHeight);
+ *w = inputWidth;
+ *h = inputHeight;
- int size() const { return m_size; }
- void setSize(int sz) { m_size = sz; }
-
- virtual bool build() = 0;
-
-protected:
- QRhiBuffer(QRhiImplementation *rhi, Type type_, UsageFlags usage_, int size_);
- Type m_type;
- UsageFlags m_usage;
- int m_size;
-};
+ if (boundingMode == Bounded) {
+ const T widthOffset = *x < 0 ? -*x : 0;
+ const T heightOffset = *y < 0 ? -*y : 0;
+ *w = *x < outputWidth ? qMax<T>(0, inputWidth - widthOffset) : 0;
+ *h = *y < outputHeight ? qMax<T>(0, inputHeight - heightOffset) : 0;
-Q_DECLARE_OPERATORS_FOR_FLAGS(QRhiBuffer::UsageFlags)
+ if (outputWidth > 0)
+ *x = qBound<T>(0, *x, outputWidth - 1);
+ if (outputHeight > 0)
+ *y = qBound<T>(0, *y, outputHeight - 1);
-class Q_GUI_EXPORT QRhiTexture : public QRhiResource
-{
-public:
- enum Flag {
- RenderTarget = 1 << 0,
- CubeMap = 1 << 2,
- MipMapped = 1 << 3,
- sRGB = 1 << 4,
- UsedAsTransferSource = 1 << 5,
- UsedWithGenerateMips = 1 << 6,
- UsedWithLoadStore = 1 << 7
- };
- Q_DECLARE_FLAGS(Flags, Flag)
-
- enum Format {
- UnknownFormat,
-
- RGBA8,
- BGRA8,
- R8,
- R16,
- RED_OR_ALPHA8,
-
- RGBA16F,
- RGBA32F,
-
- D16,
- D32F,
-
- BC1,
- BC2,
- BC3,
- BC4,
- BC5,
- BC6H,
- BC7,
-
- ETC2_RGB8,
- ETC2_RGB8A1,
- ETC2_RGBA8,
-
- ASTC_4x4,
- ASTC_5x4,
- ASTC_5x5,
- ASTC_6x5,
- ASTC_6x6,
- ASTC_8x5,
- ASTC_8x6,
- ASTC_8x8,
- ASTC_10x5,
- ASTC_10x6,
- ASTC_10x8,
- ASTC_10x10,
- ASTC_12x10,
- ASTC_12x12
- };
-
- struct NativeTexture {
- const void *object;
- int layout;
- };
-
- QRhiResource::Type resourceType() const override;
-
- Format format() const { return m_format; }
- void setFormat(Format fmt) { m_format = fmt; }
-
- QSize pixelSize() const { return m_pixelSize; }
- void setPixelSize(const QSize &sz) { m_pixelSize = sz; }
-
- Flags flags() const { return m_flags; }
- void setFlags(Flags f) { m_flags = f; }
-
- int sampleCount() const { return m_sampleCount; }
- void setSampleCount(int s) { m_sampleCount = s; }
-
- virtual bool build() = 0;
- virtual const QRhiNativeHandles *nativeHandles();
- virtual NativeTexture nativeTexture();
- virtual bool buildFrom(const QRhiNativeHandles *src);
- virtual bool buildFrom(NativeTexture src);
-
-protected:
- QRhiTexture(QRhiImplementation *rhi, Format format_, const QSize &pixelSize_,
- int sampleCount_, Flags flags_);
- Format m_format;
- QSize m_pixelSize;
- int m_sampleCount;
- Flags m_flags;
-};
-
-Q_DECLARE_OPERATORS_FOR_FLAGS(QRhiTexture::Flags)
+ if (*x + *w > outputWidth)
+ *w = qMax<T>(0, outputWidth - *x);
+ if (*y + *h > outputHeight)
+ *h = qMax<T>(0, outputHeight - *y);
+ }
+ return true;
+}
-class Q_GUI_EXPORT QRhiSampler : public QRhiResource
+struct QRhiBufferDataPrivate
{
-public:
- enum Filter {
- None,
- Nearest,
- Linear
- };
-
- enum AddressMode {
- Repeat,
- ClampToEdge,
- Mirror,
- };
-
- enum CompareOp {
- Never,
- Less,
- Equal,
- LessOrEqual,
- Greater,
- NotEqual,
- GreaterOrEqual,
- Always
- };
-
- QRhiResource::Type resourceType() const override;
-
- Filter magFilter() const { return m_magFilter; }
- void setMagFilter(Filter f) { m_magFilter = f; }
-
- Filter minFilter() const { return m_minFilter; }
- void setMinFilter(Filter f) { m_minFilter = f; }
-
- Filter mipmapMode() const { return m_mipmapMode; }
- void setMipmapMode(Filter f) { m_mipmapMode = f; }
-
- AddressMode addressU() const { return m_addressU; }
- void setAddressU(AddressMode mode) { m_addressU = mode; }
-
- AddressMode addressV() const { return m_addressV; }
- void setAddressV(AddressMode mode) { m_addressV = mode; }
-
- AddressMode addressW() const { return m_addressW; }
- void setAddressW(AddressMode mode) { m_addressW = mode; }
-
- CompareOp textureCompareOp() const { return m_compareOp; }
- void setTextureCompareOp(CompareOp op) { m_compareOp = op; }
-
- virtual bool build() = 0;
-
-protected:
- QRhiSampler(QRhiImplementation *rhi,
- Filter magFilter_, Filter minFilter_, Filter mipmapMode_,
- AddressMode u_, AddressMode v_);
- Filter m_magFilter;
- Filter m_minFilter;
- Filter m_mipmapMode;
- AddressMode m_addressU;
- AddressMode m_addressV;
- AddressMode m_addressW;
- CompareOp m_compareOp;
+ Q_DISABLE_COPY_MOVE(QRhiBufferDataPrivate)
+ QRhiBufferDataPrivate() { }
+ ~QRhiBufferDataPrivate() { delete[] largeData; }
+ int ref = 1;
+ quint32 size = 0;
+ quint32 largeAlloc = 0;
+ char *largeData = nullptr;
+ static constexpr quint32 SMALL_DATA_SIZE = 1024;
+ char data[SMALL_DATA_SIZE];
};
-class Q_GUI_EXPORT QRhiRenderBuffer : public QRhiResource
+// no detach-with-contents, no atomic refcount, no shrink
+class QRhiBufferData
{
public:
- enum Type {
- DepthStencil,
- Color
- };
-
- enum Flag {
- UsedWithSwapChainOnly = 1 << 0
- };
- Q_DECLARE_FLAGS(Flags, Flag)
-
- QRhiResource::Type resourceType() const override;
-
- Type type() const { return m_type; }
- void setType(Type t) { m_type = t; }
-
- QSize pixelSize() const { return m_pixelSize; }
- void setPixelSize(const QSize &sz) { m_pixelSize = sz; }
-
- int sampleCount() const { return m_sampleCount; }
- void setSampleCount(int s) { m_sampleCount = s; }
-
- Flags flags() const { return m_flags; }
- void setFlags(Flags h) { m_flags = h; }
-
- virtual bool build() = 0;
-
- virtual QRhiTexture::Format backingFormat() const = 0;
-
-protected:
- QRhiRenderBuffer(QRhiImplementation *rhi, Type type_, const QSize &pixelSize_,
- int sampleCount_, Flags flags_);
- Type m_type;
- QSize m_pixelSize;
- int m_sampleCount;
- Flags m_flags;
+ QRhiBufferData() = default;
+ ~QRhiBufferData()
+ {
+ if (d && !--d->ref)
+ delete d;
+ }
+ QRhiBufferData(const QRhiBufferData &other)
+ : d(other.d)
+ {
+ if (d)
+ d->ref += 1;
+ }
+ QRhiBufferData &operator=(const QRhiBufferData &other)
+ {
+ if (d == other.d)
+ return *this;
+ if (other.d)
+ other.d->ref += 1;
+ if (d && !--d->ref)
+ delete d;
+ d = other.d;
+ return *this;
+ }
+ const char *constData() const
+ {
+ return d->size <= QRhiBufferDataPrivate::SMALL_DATA_SIZE ? d->data : d->largeData;
+ }
+ quint32 size() const
+ {
+ return d->size;
+ }
+ void assign(const char *s, quint32 size)
+ {
+ if (!d) {
+ d = new QRhiBufferDataPrivate;
+ } else if (d->ref != 1) {
+ d->ref -= 1;
+ d = new QRhiBufferDataPrivate;
+ }
+ d->size = size;
+ if (size <= QRhiBufferDataPrivate::SMALL_DATA_SIZE) {
+ memcpy(d->data, s, size);
+ } else {
+ if (d->largeAlloc < size) {
+ delete[] d->largeData;
+ d->largeAlloc = size;
+ d->largeData = new char[size];
+ }
+ memcpy(d->largeData, s, size);
+ }
+ }
+private:
+ QRhiBufferDataPrivate *d = nullptr;
};
-Q_DECLARE_OPERATORS_FOR_FLAGS(QRhiRenderBuffer::Flags)
+Q_DECLARE_TYPEINFO(QRhiBufferData, Q_RELOCATABLE_TYPE);
-class Q_GUI_EXPORT QRhiRenderPassDescriptor : public QRhiResource
+class QRhiResourceUpdateBatchPrivate
{
public:
- QRhiResource::Type resourceType() const override;
-
- virtual bool isCompatible(const QRhiRenderPassDescriptor *other) const = 0;
- virtual const QRhiNativeHandles *nativeHandles();
-
-protected:
- QRhiRenderPassDescriptor(QRhiImplementation *rhi);
-};
+ struct BufferOp {
+ enum Type {
+ DynamicUpdate,
+ StaticUpload,
+ Read
+ };
+ Type type;
+ QRhiBuffer *buf;
+ quint32 offset;
+ QRhiBufferData data;
+ quint32 readSize;
+ QRhiReadbackResult *result;
+
+ static BufferOp dynamicUpdate(QRhiBuffer *buf, quint32 offset, quint32 size, const void *data)
+ {
+ BufferOp op = {};
+ op.type = DynamicUpdate;
+ op.buf = buf;
+ op.offset = offset;
+ const int effectiveSize = size ? size : buf->size();
+ op.data.assign(reinterpret_cast<const char *>(data), effectiveSize);
+ return op;
+ }
+
+ static void changeToDynamicUpdate(BufferOp *op, QRhiBuffer *buf, quint32 offset, quint32 size, const void *data)
+ {
+ op->type = DynamicUpdate;
+ op->buf = buf;
+ op->offset = offset;
+ const int effectiveSize = size ? size : buf->size();
+ op->data.assign(reinterpret_cast<const char *>(data), effectiveSize);
+ }
+
+ static BufferOp staticUpload(QRhiBuffer *buf, quint32 offset, quint32 size, const void *data)
+ {
+ BufferOp op = {};
+ op.type = StaticUpload;
+ op.buf = buf;
+ op.offset = offset;
+ const int effectiveSize = size ? size : buf->size();
+ op.data.assign(reinterpret_cast<const char *>(data), effectiveSize);
+ return op;
+ }
+
+ static void changeToStaticUpload(BufferOp *op, QRhiBuffer *buf, quint32 offset, quint32 size, const void *data)
+ {
+ op->type = StaticUpload;
+ op->buf = buf;
+ op->offset = offset;
+ const int effectiveSize = size ? size : buf->size();
+ op->data.assign(reinterpret_cast<const char *>(data), effectiveSize);
+ }
+
+ static BufferOp read(QRhiBuffer *buf, quint32 offset, quint32 size, QRhiReadbackResult *result)
+ {
+ BufferOp op = {};
+ op.type = Read;
+ op.buf = buf;
+ op.offset = offset;
+ op.readSize = size;
+ op.result = result;
+ return op;
+ }
+ };
+
+ struct TextureOp {
+ enum Type {
+ Upload,
+ Copy,
+ Read,
+ GenMips
+ };
+ Type type;
+ QRhiTexture *dst;
+ // Specifying multiple uploads for a subresource must be supported.
+ // In the backend this can then end up, where applicable, as a
+ // single, batched copy operation with only one set of barriers.
+ // This helps when doing for example glyph cache fills.
+ using MipLevelUploadList = std::array<QVector<QRhiTextureSubresourceUploadDescription>, QRhi::MAX_MIP_LEVELS>;
+ QVarLengthArray<MipLevelUploadList, 6> subresDesc;
+ QRhiTexture *src;
+ QRhiTextureCopyDescription desc;
+ QRhiReadbackDescription rb;
+ QRhiReadbackResult *result;
+
+ static TextureOp upload(QRhiTexture *tex, const QRhiTextureUploadDescription &desc)
+ {
+ TextureOp op = {};
+ op.type = Upload;
+ op.dst = tex;
+ int maxLayer = -1;
+ for (auto it = desc.cbeginEntries(), itEnd = desc.cendEntries(); it != itEnd; ++it) {
+ if (it->layer() > maxLayer)
+ maxLayer = it->layer();
+ }
+ op.subresDesc.resize(maxLayer + 1);
+ for (auto it = desc.cbeginEntries(), itEnd = desc.cendEntries(); it != itEnd; ++it)
+ op.subresDesc[it->layer()][it->level()].append(it->description());
+ return op;
+ }
+
+ static TextureOp copy(QRhiTexture *dst, QRhiTexture *src, const QRhiTextureCopyDescription &desc)
+ {
+ TextureOp op = {};
+ op.type = Copy;
+ op.dst = dst;
+ op.src = src;
+ op.desc = desc;
+ return op;
+ }
+
+ static TextureOp read(const QRhiReadbackDescription &rb, QRhiReadbackResult *result)
+ {
+ TextureOp op = {};
+ op.type = Read;
+ op.rb = rb;
+ op.result = result;
+ return op;
+ }
+
+ static TextureOp genMips(QRhiTexture *tex)
+ {
+ TextureOp op = {};
+ op.type = GenMips;
+ op.dst = tex;
+ return op;
+ }
+ };
+
+ int activeBufferOpCount = 0; // this is the real number of used elements in bufferOps, not bufferOps.count()
+ static const int BUFFER_OPS_STATIC_ALLOC = 1024;
+ QVarLengthArray<BufferOp, BUFFER_OPS_STATIC_ALLOC> bufferOps;
+
+ int activeTextureOpCount = 0; // this is the real number of used elements in textureOps, not textureOps.count()
+ static const int TEXTURE_OPS_STATIC_ALLOC = 256;
+ QVarLengthArray<TextureOp, TEXTURE_OPS_STATIC_ALLOC> textureOps;
+
+ QRhiResourceUpdateBatch *q = nullptr;
+ QRhiImplementation *rhi = nullptr;
+ int poolIndex = -1;
+
+ void free();
+ void merge(QRhiResourceUpdateBatchPrivate *other);
+ bool hasOptimalCapacity() const;
+ void trimOpLists();
+
+ static QRhiResourceUpdateBatchPrivate *get(QRhiResourceUpdateBatch *b) { return b->d; }
+};
+
+template<typename T>
+struct QRhiBatchedBindings
+{
+ void feed(int binding, T resource) { // binding must be strictly increasing
+ if (curBinding == -1 || binding > curBinding + 1) {
+ finish();
+ curBatch.startBinding = binding;
+ curBatch.resources.clear();
+ curBatch.resources.append(resource);
+ } else {
+ Q_ASSERT(binding == curBinding + 1);
+ curBatch.resources.append(resource);
+ }
+ curBinding = binding;
+ }
-class Q_GUI_EXPORT QRhiRenderTarget : public QRhiResource
-{
-public:
- QRhiResource::Type resourceType() const override;
+ bool finish() {
+ if (!curBatch.resources.isEmpty())
+ batches.append(curBatch);
+ return !batches.isEmpty();
+ }
- virtual QSize pixelSize() const = 0;
- virtual float devicePixelRatio() const = 0;
- virtual int sampleCount() const = 0;
+ void clear() {
+ batches.clear();
+ curBatch.resources.clear();
+ curBinding = -1;
+ }
- QRhiRenderPassDescriptor *renderPassDescriptor() const { return m_renderPassDesc; }
- void setRenderPassDescriptor(QRhiRenderPassDescriptor *desc) { m_renderPassDesc = desc; }
+ struct Batch {
+ uint startBinding;
+ QVarLengthArray<T, 4> resources;
-protected:
- QRhiRenderTarget(QRhiImplementation *rhi);
- QRhiRenderPassDescriptor *m_renderPassDesc = nullptr;
-};
+ bool operator==(const Batch &other) const
+ {
+ return startBinding == other.startBinding && resources == other.resources;
+ }
-class Q_GUI_EXPORT QRhiTextureRenderTarget : public QRhiRenderTarget
-{
-public:
- enum Flag {
- PreserveColorContents = 1 << 0,
- PreserveDepthStencilContents = 1 << 1
+ bool operator!=(const Batch &other) const
+ {
+ return !operator==(other);
+ }
};
- Q_DECLARE_FLAGS(Flags, Flag)
-
- QRhiResource::Type resourceType() const override;
-
- QRhiTextureRenderTargetDescription description() const { return m_desc; }
- void setDescription(const QRhiTextureRenderTargetDescription &desc) { m_desc = desc; }
- Flags flags() const { return m_flags; }
- void setFlags(Flags f) { m_flags = f; }
+ QVarLengthArray<Batch, 4> batches; // sorted by startBinding
- virtual QRhiRenderPassDescriptor *newCompatibleRenderPassDescriptor() = 0;
+ bool operator==(const QRhiBatchedBindings<T> &other) const
+ {
+ return batches == other.batches;
+ }
- virtual bool build() = 0;
+ bool operator!=(const QRhiBatchedBindings<T> &other) const
+ {
+ return !operator==(other);
+ }
-protected:
- QRhiTextureRenderTarget(QRhiImplementation *rhi, const QRhiTextureRenderTargetDescription &desc_, Flags flags_);
- QRhiTextureRenderTargetDescription m_desc;
- Flags m_flags;
+private:
+ Batch curBatch;
+ int curBinding = -1;
};
-Q_DECLARE_OPERATORS_FOR_FLAGS(QRhiTextureRenderTarget::Flags)
-
-class Q_GUI_EXPORT QRhiShaderResourceBindings : public QRhiResource
+class QRhiGlobalObjectIdGenerator
{
public:
- QRhiResource::Type resourceType() const override;
-
- void setBindings(std::initializer_list<QRhiShaderResourceBinding> list) { m_bindings = list; }
-
- template<typename InputIterator>
- void setBindings(InputIterator first, InputIterator last)
- {
- m_bindings.clear();
- std::copy(first, last, std::back_inserter(m_bindings));
- }
-
- const QRhiShaderResourceBinding *cbeginBindings() const { return m_bindings.cbegin(); }
- const QRhiShaderResourceBinding *cendBindings() const { return m_bindings.cend(); }
-
- bool isLayoutCompatible(const QRhiShaderResourceBindings *other) const;
-
- virtual bool build() = 0;
-
-protected:
- QRhiShaderResourceBindings(QRhiImplementation *rhi);
- QVarLengthArray<QRhiShaderResourceBinding, 8> m_bindings;
-#ifndef QT_NO_DEBUG_STREAM
- friend Q_GUI_EXPORT QDebug operator<<(QDebug, const QRhiShaderResourceBindings &);
+#ifdef Q_ATOMIC_INT64_IS_SUPPORTED
+ using Type = quint64;
+#else
+ using Type = quint32;
#endif
+ static Type newId();
};
-#ifndef QT_NO_DEBUG_STREAM
-Q_GUI_EXPORT QDebug operator<<(QDebug, const QRhiShaderResourceBindings &);
-#endif
-
-class Q_GUI_EXPORT QRhiGraphicsPipeline : public QRhiResource
+class QRhiPassResourceTracker
{
public:
- enum Flag {
- UsesBlendConstants = 1 << 0,
- UsesStencilRef = 1 << 1,
- UsesScissor = 1 << 2
- };
- Q_DECLARE_FLAGS(Flags, Flag)
-
- enum Topology {
- Triangles,
- TriangleStrip,
- TriangleFan,
- Lines,
- LineStrip,
- Points
- };
-
- enum CullMode {
- None,
- Front,
- Back
- };
-
- enum FrontFace {
- CCW,
- CW
- };
+ bool isEmpty() const;
+ void reset();
- enum ColorMaskComponent {
- R = 1 << 0,
- G = 1 << 1,
- B = 1 << 2,
- A = 1 << 3
- };
- Q_DECLARE_FLAGS(ColorMask, ColorMaskComponent)
-
- enum BlendFactor {
- Zero,
- One,
- SrcColor,
- OneMinusSrcColor,
- DstColor,
- OneMinusDstColor,
- SrcAlpha,
- OneMinusSrcAlpha,
- DstAlpha,
- OneMinusDstAlpha,
- ConstantColor,
- OneMinusConstantColor,
- ConstantAlpha,
- OneMinusConstantAlpha,
- SrcAlphaSaturate,
- Src1Color,
- OneMinusSrc1Color,
- Src1Alpha,
- OneMinusSrc1Alpha
+ struct UsageState {
+ int layout;
+ int access;
+ int stage;
};
- enum BlendOp {
- Add,
- Subtract,
- ReverseSubtract,
- Min,
- Max
+ enum BufferStage {
+ BufVertexInputStage,
+ BufVertexStage,
+ BufTCStage,
+ BufTEStage,
+ BufFragmentStage,
+ BufComputeStage,
+ BufGeometryStage
};
- struct TargetBlend {
- ColorMask colorWrite = ColorMask(0xF); // R | G | B | A
- bool enable = false;
- BlendFactor srcColor = One;
- BlendFactor dstColor = OneMinusSrcAlpha;
- BlendOp opColor = Add;
- BlendFactor srcAlpha = One;
- BlendFactor dstAlpha = OneMinusSrcAlpha;
- BlendOp opAlpha = Add;
+ enum BufferAccess {
+ BufVertexInput,
+ BufIndexRead,
+ BufUniformRead,
+ BufStorageLoad,
+ BufStorageStore,
+ BufStorageLoadStore
};
- enum CompareOp {
- Never,
- Less,
- Equal,
- LessOrEqual,
- Greater,
- NotEqual,
- GreaterOrEqual,
- Always
- };
+ void registerBuffer(QRhiBuffer *buf, int slot, BufferAccess *access, BufferStage *stage,
+ const UsageState &state);
- enum StencilOp {
- StencilZero,
- Keep,
- Replace,
- IncrementAndClamp,
- DecrementAndClamp,
- Invert,
- IncrementAndWrap,
- DecrementAndWrap
+ enum TextureStage {
+ TexVertexStage,
+ TexTCStage,
+ TexTEStage,
+ TexFragmentStage,
+ TexColorOutputStage,
+ TexDepthOutputStage,
+ TexComputeStage,
+ TexGeometryStage
};
- struct StencilOpState {
- StencilOp failOp = Keep;
- StencilOp depthFailOp = Keep;
- StencilOp passOp = Keep;
- CompareOp compareOp = Always;
+ enum TextureAccess {
+ TexSample,
+ TexColorOutput,
+ TexDepthOutput,
+ TexStorageLoad,
+ TexStorageStore,
+ TexStorageLoadStore
};
- QRhiResource::Type resourceType() const override;
-
- Flags flags() const { return m_flags; }
- void setFlags(Flags f) { m_flags = f; }
-
- Topology topology() const { return m_topology; }
- void setTopology(Topology t) { m_topology = t; }
-
- CullMode cullMode() const { return m_cullMode; }
- void setCullMode(CullMode mode) { m_cullMode = mode; }
+ void registerTexture(QRhiTexture *tex, TextureAccess *access, TextureStage *stage,
+ const UsageState &state);
- FrontFace frontFace() const { return m_frontFace; }
- void setFrontFace(FrontFace f) { m_frontFace = f; }
-
- void setTargetBlends(std::initializer_list<TargetBlend> list) { m_targetBlends = list; }
- template<typename InputIterator>
- void setTargetBlends(InputIterator first, InputIterator last)
- {
- m_targetBlends.clear();
- std::copy(first, last, std::back_inserter(m_targetBlends));
- }
- const TargetBlend *cbeginTargetBlends() const { return m_targetBlends.cbegin(); }
- const TargetBlend *cendTargetBlends() const { return m_targetBlends.cend(); }
-
- bool hasDepthTest() const { return m_depthTest; }
- void setDepthTest(bool enable) { m_depthTest = enable; }
-
- bool hasDepthWrite() const { return m_depthWrite; }
- void setDepthWrite(bool enable) { m_depthWrite = enable; }
-
- CompareOp depthOp() const { return m_depthOp; }
- void setDepthOp(CompareOp op) { m_depthOp = op; }
-
- bool hasStencilTest() const { return m_stencilTest; }
- void setStencilTest(bool enable) { m_stencilTest = enable; }
-
- StencilOpState stencilFront() const { return m_stencilFront; }
- void setStencilFront(const StencilOpState &state) { m_stencilFront = state; }
-
- StencilOpState stencilBack() const { return m_stencilBack; }
- void setStencilBack(const StencilOpState &state) { m_stencilBack = state; }
-
- quint32 stencilReadMask() const { return m_stencilReadMask; }
- void setStencilReadMask(quint32 mask) { m_stencilReadMask = mask; }
-
- quint32 stencilWriteMask() const { return m_stencilWriteMask; }
- void setStencilWriteMask(quint32 mask) { m_stencilWriteMask = mask; }
-
- int sampleCount() const { return m_sampleCount; }
- void setSampleCount(int s) { m_sampleCount = s; }
-
- float lineWidth() const { return m_lineWidth; }
- void setLineWidth(float width) { m_lineWidth = width; }
-
- void setShaderStages(std::initializer_list<QRhiShaderStage> list) { m_shaderStages = list; }
- template<typename InputIterator>
- void setShaderStages(InputIterator first, InputIterator last)
- {
- m_shaderStages.clear();
- std::copy(first, last, std::back_inserter(m_shaderStages));
- }
- const QRhiShaderStage *cbeginShaderStages() const { return m_shaderStages.cbegin(); }
- const QRhiShaderStage *cendShaderStages() const { return m_shaderStages.cend(); }
-
- QRhiVertexInputLayout vertexInputLayout() const { return m_vertexInputLayout; }
- void setVertexInputLayout(const QRhiVertexInputLayout &layout) { m_vertexInputLayout = layout; }
-
- QRhiShaderResourceBindings *shaderResourceBindings() const { return m_shaderResourceBindings; }
- void setShaderResourceBindings(QRhiShaderResourceBindings *srb) { m_shaderResourceBindings = srb; }
-
- QRhiRenderPassDescriptor *renderPassDescriptor() const { return m_renderPassDesc; }
- void setRenderPassDescriptor(QRhiRenderPassDescriptor *desc) { m_renderPassDesc = desc; }
-
- virtual bool build() = 0;
-
-protected:
- QRhiGraphicsPipeline(QRhiImplementation *rhi);
- Flags m_flags;
- Topology m_topology = Triangles;
- CullMode m_cullMode = None;
- FrontFace m_frontFace = CCW;
- QVarLengthArray<TargetBlend, 8> m_targetBlends;
- bool m_depthTest = false;
- bool m_depthWrite = false;
- CompareOp m_depthOp = Less;
- bool m_stencilTest = false;
- StencilOpState m_stencilFront;
- StencilOpState m_stencilBack;
- quint32 m_stencilReadMask = 0xFF;
- quint32 m_stencilWriteMask = 0xFF;
- int m_sampleCount = 1;
- float m_lineWidth = 1.0f;
- QVarLengthArray<QRhiShaderStage, 4> m_shaderStages;
- QRhiVertexInputLayout m_vertexInputLayout;
- QRhiShaderResourceBindings *m_shaderResourceBindings = nullptr;
- QRhiRenderPassDescriptor *m_renderPassDesc = nullptr;
-};
-
-Q_DECLARE_OPERATORS_FOR_FLAGS(QRhiGraphicsPipeline::Flags)
-Q_DECLARE_OPERATORS_FOR_FLAGS(QRhiGraphicsPipeline::ColorMask)
-Q_DECLARE_TYPEINFO(QRhiGraphicsPipeline::TargetBlend, Q_MOVABLE_TYPE);
-
-class Q_GUI_EXPORT QRhiSwapChain : public QRhiResource
-{
-public:
- enum Flag {
- SurfaceHasPreMulAlpha = 1 << 0,
- SurfaceHasNonPreMulAlpha = 1 << 1,
- sRGB = 1 << 2,
- UsedAsTransferSource = 1 << 3,
- NoVSync = 1 << 4,
- MinimalBufferCount = 1 << 5
+ struct Buffer {
+ int slot;
+ BufferAccess access;
+ BufferStage stage;
+ UsageState stateAtPassBegin;
};
- Q_DECLARE_FLAGS(Flags, Flag)
-
- QRhiResource::Type resourceType() const override;
-
- QWindow *window() const { return m_window; }
- void setWindow(QWindow *window) { m_window = window; }
-
- Flags flags() const { return m_flags; }
- void setFlags(Flags f) { m_flags = f; }
-
- QRhiRenderBuffer *depthStencil() const { return m_depthStencil; }
- void setDepthStencil(QRhiRenderBuffer *ds) { m_depthStencil = ds; }
- int sampleCount() const { return m_sampleCount; }
- void setSampleCount(int samples) { m_sampleCount = samples; }
+ using BufferIterator = QHash<QRhiBuffer *, Buffer>::const_iterator;
+ BufferIterator cbeginBuffers() const { return m_buffers.cbegin(); }
+ BufferIterator cendBuffers() const { return m_buffers.cend(); }
- QRhiRenderPassDescriptor *renderPassDescriptor() const { return m_renderPassDesc; }
- void setRenderPassDescriptor(QRhiRenderPassDescriptor *desc) { m_renderPassDesc = desc; }
-
- QSize currentPixelSize() const { return m_currentPixelSize; }
-
- virtual QRhiCommandBuffer *currentFrameCommandBuffer() = 0;
- virtual QRhiRenderTarget *currentFrameRenderTarget() = 0;
- virtual QSize surfacePixelSize() = 0;
- virtual QRhiRenderPassDescriptor *newCompatibleRenderPassDescriptor() = 0;
- virtual bool buildOrResize() = 0;
-
-protected:
- QRhiSwapChain(QRhiImplementation *rhi);
- QWindow *m_window = nullptr;
- Flags m_flags;
- QRhiRenderBuffer *m_depthStencil = nullptr;
- int m_sampleCount = 1;
- QRhiRenderPassDescriptor *m_renderPassDesc = nullptr;
- QSize m_currentPixelSize;
-};
-
-Q_DECLARE_OPERATORS_FOR_FLAGS(QRhiSwapChain::Flags)
-
-class Q_GUI_EXPORT QRhiComputePipeline : public QRhiResource
-{
-public:
- QRhiResource::Type resourceType() const override;
- virtual bool build() = 0;
-
- QRhiShaderStage shaderStage() const { return m_shaderStage; }
- void setShaderStage(const QRhiShaderStage &stage) { m_shaderStage = stage; }
-
- QRhiShaderResourceBindings *shaderResourceBindings() const { return m_shaderResourceBindings; }
- void setShaderResourceBindings(QRhiShaderResourceBindings *srb) { m_shaderResourceBindings = srb; }
-
-protected:
- QRhiComputePipeline(QRhiImplementation *rhi);
- QRhiShaderStage m_shaderStage;
- QRhiShaderResourceBindings *m_shaderResourceBindings = nullptr;
-};
-
-class Q_GUI_EXPORT QRhiCommandBuffer : public QRhiResource
-{
-public:
- enum IndexFormat {
- IndexUInt16,
- IndexUInt32
+ struct Texture {
+ TextureAccess access;
+ TextureStage stage;
+ UsageState stateAtPassBegin;
};
- QRhiResource::Type resourceType() const override;
-
- void resourceUpdate(QRhiResourceUpdateBatch *resourceUpdates);
-
- void beginPass(QRhiRenderTarget *rt,
- const QColor &colorClearValue,
- const QRhiDepthStencilClearValue &depthStencilClearValue,
- QRhiResourceUpdateBatch *resourceUpdates = nullptr);
- void endPass(QRhiResourceUpdateBatch *resourceUpdates = nullptr);
-
- void setGraphicsPipeline(QRhiGraphicsPipeline *ps);
- using DynamicOffset = QPair<int, quint32>; // binding, offset
- void setShaderResources(QRhiShaderResourceBindings *srb = nullptr,
- int dynamicOffsetCount = 0,
- const DynamicOffset *dynamicOffsets = nullptr);
- using VertexInput = QPair<QRhiBuffer *, quint32>; // buffer, offset
- void setVertexInput(int startBinding, int bindingCount, const VertexInput *bindings,
- QRhiBuffer *indexBuf = nullptr, quint32 indexOffset = 0,
- IndexFormat indexFormat = IndexUInt16);
-
- void setViewport(const QRhiViewport &viewport);
- void setScissor(const QRhiScissor &scissor);
- void setBlendConstants(const QColor &c);
- void setStencilRef(quint32 refValue);
-
- void draw(quint32 vertexCount,
- quint32 instanceCount = 1,
- quint32 firstVertex = 0,
- quint32 firstInstance = 0);
-
- void drawIndexed(quint32 indexCount,
- quint32 instanceCount = 1,
- quint32 firstIndex = 0,
- qint32 vertexOffset = 0,
- quint32 firstInstance = 0);
-
- void debugMarkBegin(const QByteArray &name);
- void debugMarkEnd();
- void debugMarkMsg(const QByteArray &msg);
-
- void beginComputePass(QRhiResourceUpdateBatch *resourceUpdates = nullptr);
- void endComputePass(QRhiResourceUpdateBatch *resourceUpdates = nullptr);
- void setComputePipeline(QRhiComputePipeline *ps);
- void dispatch(int x, int y, int z);
-
- const QRhiNativeHandles *nativeHandles();
- void beginExternal();
- void endExternal();
-
-protected:
- QRhiCommandBuffer(QRhiImplementation *rhi);
-};
-
-struct Q_GUI_EXPORT QRhiReadbackResult
-{
- std::function<void()> completed = nullptr;
- QRhiTexture::Format format;
- QSize pixelSize;
- QByteArray data;
-}; // non-movable due to the std::function
-
-struct Q_GUI_EXPORT QRhiBufferReadbackResult
-{
- std::function<void()> completed = nullptr;
- QByteArray data;
-};
-
-class Q_GUI_EXPORT QRhiResourceUpdateBatch
-{
-public:
- ~QRhiResourceUpdateBatch();
-
- void release();
+ using TextureIterator = QHash<QRhiTexture *, Texture>::const_iterator;
+ TextureIterator cbeginTextures() const { return m_textures.cbegin(); }
+ TextureIterator cendTextures() const { return m_textures.cend(); }
- void merge(QRhiResourceUpdateBatch *other);
-
- void updateDynamicBuffer(QRhiBuffer *buf, int offset, int size, const void *data);
- void uploadStaticBuffer(QRhiBuffer *buf, int offset, int size, const void *data);
- void uploadStaticBuffer(QRhiBuffer *buf, const void *data);
- void readBackBuffer(QRhiBuffer *buf, int offset, int size, QRhiBufferReadbackResult *result);
- void uploadTexture(QRhiTexture *tex, const QRhiTextureUploadDescription &desc);
- void uploadTexture(QRhiTexture *tex, const QImage &image);
- void copyTexture(QRhiTexture *dst, QRhiTexture *src, const QRhiTextureCopyDescription &desc = QRhiTextureCopyDescription());
- void readBackTexture(const QRhiReadbackDescription &rb, QRhiReadbackResult *result);
- void generateMips(QRhiTexture *tex, int layer = 0);
+ static BufferStage toPassTrackerBufferStage(QRhiShaderResourceBinding::StageFlags stages);
+ static TextureStage toPassTrackerTextureStage(QRhiShaderResourceBinding::StageFlags stages);
private:
- QRhiResourceUpdateBatch(QRhiImplementation *rhi);
- Q_DISABLE_COPY(QRhiResourceUpdateBatch)
- QRhiResourceUpdateBatchPrivate *d;
- friend class QRhiResourceUpdateBatchPrivate;
- friend class QRhi;
+ QHash<QRhiBuffer *, Buffer> m_buffers;
+ QHash<QRhiTexture *, Texture> m_textures;
};
-struct Q_GUI_EXPORT QRhiInitParams
-{
-};
+Q_DECLARE_TYPEINFO(QRhiPassResourceTracker::Buffer, Q_RELOCATABLE_TYPE);
+Q_DECLARE_TYPEINFO(QRhiPassResourceTracker::Texture, Q_RELOCATABLE_TYPE);
-class Q_GUI_EXPORT QRhi
+template<typename T, int GROW = 1024>
+class QRhiBackendCommandList
{
public:
- enum Implementation {
- Null,
- Vulkan,
- OpenGLES2,
- D3D11,
- Metal
- };
-
- enum Flag {
- EnableProfiling = 1 << 0,
- EnableDebugMarkers = 1 << 1,
- PreferSoftwareRenderer = 1 << 2
- };
- Q_DECLARE_FLAGS(Flags, Flag)
-
- enum FrameOpResult {
- FrameOpSuccess = 0,
- FrameOpError,
- FrameOpSwapChainOutOfDate,
- FrameOpDeviceLost
- };
-
- enum Feature {
- MultisampleTexture = 1,
- MultisampleRenderBuffer,
- DebugMarkers,
- Timestamps,
- Instancing,
- CustomInstanceStepRate,
- PrimitiveRestart,
- NonDynamicUniformBuffers,
- NonFourAlignedEffectiveIndexBufferOffset,
- NPOTTextureRepeat,
- RedOrAlpha8IsRed,
- ElementIndexUint,
- Compute,
- WideLines,
- VertexShaderPointSize,
- BaseVertex,
- BaseInstance,
- TriangleFanTopology,
- ReadBackNonUniformBuffer,
- ReadBackNonBaseMipLevel
- };
-
- enum BeginFrameFlag {
- ExternalContentsInPass = 0x01
- };
- Q_DECLARE_FLAGS(BeginFrameFlags, BeginFrameFlag)
-
- enum EndFrameFlag {
- SkipPresent = 1 << 0
- };
- Q_DECLARE_FLAGS(EndFrameFlags, EndFrameFlag)
-
- enum ResourceLimit {
- TextureSizeMin = 1,
- TextureSizeMax,
- MaxColorAttachments,
- FramesInFlight
- };
-
- ~QRhi();
-
- static QRhi *create(Implementation impl,
- QRhiInitParams *params,
- Flags flags = Flags(),
- QRhiNativeHandles *importDevice = nullptr);
-
- Implementation backend() const;
- QThread *thread() const;
-
- using CleanupCallback = std::function<void(QRhi *)>;
- void addCleanupCallback(const CleanupCallback &callback);
- void runCleanup();
-
- QRhiGraphicsPipeline *newGraphicsPipeline();
- QRhiComputePipeline *newComputePipeline();
- QRhiShaderResourceBindings *newShaderResourceBindings();
-
- QRhiBuffer *newBuffer(QRhiBuffer::Type type,
- QRhiBuffer::UsageFlags usage,
- int size);
-
- QRhiRenderBuffer *newRenderBuffer(QRhiRenderBuffer::Type type,
- const QSize &pixelSize,
- int sampleCount = 1,
- QRhiRenderBuffer::Flags flags = QRhiRenderBuffer::Flags());
-
- QRhiTexture *newTexture(QRhiTexture::Format format,
- const QSize &pixelSize,
- int sampleCount = 1,
- QRhiTexture::Flags flags = QRhiTexture::Flags());
-
- QRhiSampler *newSampler(QRhiSampler::Filter magFilter, QRhiSampler::Filter minFilter,
- QRhiSampler::Filter mipmapMode,
- QRhiSampler::AddressMode u, QRhiSampler::AddressMode v);
-
- QRhiTextureRenderTarget *newTextureRenderTarget(const QRhiTextureRenderTargetDescription &desc,
- QRhiTextureRenderTarget::Flags flags = QRhiTextureRenderTarget::Flags());
-
- QRhiSwapChain *newSwapChain();
- FrameOpResult beginFrame(QRhiSwapChain *swapChain, BeginFrameFlags flags = BeginFrameFlags());
- FrameOpResult endFrame(QRhiSwapChain *swapChain, EndFrameFlags flags = EndFrameFlags());
- bool isRecordingFrame() const;
- int currentFrameSlot() const;
-
- FrameOpResult beginOffscreenFrame(QRhiCommandBuffer **cb, BeginFrameFlags flags = BeginFrameFlags());
- FrameOpResult endOffscreenFrame(EndFrameFlags flags = EndFrameFlags());
-
- QRhi::FrameOpResult finish();
-
- QRhiResourceUpdateBatch *nextResourceUpdateBatch();
-
- QVector<int> supportedSampleCounts() const;
-
- int ubufAlignment() const;
- int ubufAligned(int v) const;
-
- int mipLevelsForSize(const QSize &size) const;
- QSize sizeForMipLevel(int mipLevel, const QSize &baseLevelSize) const;
-
- bool isYUpInFramebuffer() const;
- bool isYUpInNDC() const;
- bool isClipDepthZeroToOne() const;
-
- QMatrix4x4 clipSpaceCorrMatrix() const;
-
- bool isTextureFormatSupported(QRhiTexture::Format format, QRhiTexture::Flags flags = QRhiTexture::Flags()) const;
- bool isFeatureSupported(QRhi::Feature feature) const;
- int resourceLimit(ResourceLimit limit) const;
-
- const QRhiNativeHandles *nativeHandles();
- bool makeThreadLocalNativeContextCurrent();
-
- QRhiProfiler *profiler();
-
- static const int MAX_LAYERS = 6; // cubemaps only
- static const int MAX_LEVELS = 16; // a width and/or height of 65536 should be enough for everyone
-
- void releaseCachedResources();
-
- bool isDeviceLost() const;
-
-protected:
- QRhi();
-
+ QRhiBackendCommandList() = default;
+ ~QRhiBackendCommandList() { delete[] v; }
+ inline void reset() { p = 0; }
+ inline bool isEmpty() const { return p == 0; }
+ inline T &get() {
+ if (p == a) {
+ a += GROW;
+ T *nv = new T[a];
+ if (v) {
+ memcpy(nv, v, p * sizeof(T));
+ delete[] v;
+ }
+ v = nv;
+ }
+ return v[p++];
+ }
+ inline void unget() { --p; }
+ inline T *cbegin() const { return v; }
+ inline T *cend() const { return v + p; }
+ inline T *begin() { return v; }
+ inline T *end() { return v + p; }
private:
- Q_DISABLE_COPY(QRhi)
- QRhiImplementation *d = nullptr;
-};
-
-Q_DECLARE_OPERATORS_FOR_FLAGS(QRhi::Flags)
-Q_DECLARE_OPERATORS_FOR_FLAGS(QRhi::BeginFrameFlags)
-Q_DECLARE_OPERATORS_FOR_FLAGS(QRhi::EndFrameFlags)
+ Q_DISABLE_COPY(QRhiBackendCommandList)
+ T *v = nullptr;
+ int a = 0;
+ int p = 0;
+};
+
+struct QRhiRenderTargetAttachmentTracker
+{
+ struct ResId { quint64 id; uint generation; };
+ using ResIdList = QVarLengthArray<ResId, 8 * 2 + 1>; // color, resolve, ds
+
+ template<typename TexType, typename RenderBufferType>
+ static void updateResIdList(const QRhiTextureRenderTargetDescription &desc, ResIdList *dst);
+
+ template<typename TexType, typename RenderBufferType>
+ static bool isUpToDate(const QRhiTextureRenderTargetDescription &desc, const ResIdList &currentResIdList);
+};
+
+inline bool operator==(const QRhiRenderTargetAttachmentTracker::ResId &a, const QRhiRenderTargetAttachmentTracker::ResId &b)
+{
+ return a.id == b.id && a.generation == b.generation;
+}
+
+inline bool operator!=(const QRhiRenderTargetAttachmentTracker::ResId &a, const QRhiRenderTargetAttachmentTracker::ResId &b)
+{
+ return !(a == b);
+}
+
+template<typename TexType, typename RenderBufferType>
+void QRhiRenderTargetAttachmentTracker::updateResIdList(const QRhiTextureRenderTargetDescription &desc, ResIdList *dst)
+{
+ const bool hasDepthStencil = desc.depthStencilBuffer() || desc.depthTexture();
+ dst->resize(desc.colorAttachmentCount() * 2 + (hasDepthStencil ? 1 : 0));
+ int n = 0;
+ for (auto it = desc.cbeginColorAttachments(), itEnd = desc.cendColorAttachments(); it != itEnd; ++it, ++n) {
+ const QRhiColorAttachment &colorAtt(*it);
+ if (colorAtt.texture()) {
+ TexType *texD = QRHI_RES(TexType, colorAtt.texture());
+ (*dst)[n] = { texD->globalResourceId(), texD->generation };
+ } else if (colorAtt.renderBuffer()) {
+ RenderBufferType *rbD = QRHI_RES(RenderBufferType, colorAtt.renderBuffer());
+ (*dst)[n] = { rbD->globalResourceId(), rbD->generation };
+ } else {
+ (*dst)[n] = { 0, 0 };
+ }
+ ++n;
+ if (colorAtt.resolveTexture()) {
+ TexType *texD = QRHI_RES(TexType, colorAtt.resolveTexture());
+ (*dst)[n] = { texD->globalResourceId(), texD->generation };
+ } else {
+ (*dst)[n] = { 0, 0 };
+ }
+ }
+ if (hasDepthStencil) {
+ if (desc.depthTexture()) {
+ TexType *depthTexD = QRHI_RES(TexType, desc.depthTexture());
+ (*dst)[n] = { depthTexD->globalResourceId(), depthTexD->generation };
+ } else if (desc.depthStencilBuffer()) {
+ RenderBufferType *depthRbD = QRHI_RES(RenderBufferType, desc.depthStencilBuffer());
+ (*dst)[n] = { depthRbD->globalResourceId(), depthRbD->generation };
+ } else {
+ (*dst)[n] = { 0, 0 };
+ }
+ }
+}
+
+template<typename TexType, typename RenderBufferType>
+bool QRhiRenderTargetAttachmentTracker::isUpToDate(const QRhiTextureRenderTargetDescription &desc, const ResIdList &currentResIdList)
+{
+ // Just as setShaderResources() recognizes if an srb's referenced
+ // resources have been rebuilt (got a create() since the srb's
+ // create()), we should do the same for the textures and renderbuffers
+ // referenced from the rendertarget. It is not uncommon that a texture
+ // or ds buffer gets resized due to following a window size in some
+ // form, which involves a create() on them. It is then nice if the
+ // render target auto-rebuilds in beginPass().
+
+ ResIdList resIdList;
+ updateResIdList<TexType, RenderBufferType>(desc, &resIdList);
+ return resIdList == currentResIdList;
+}
+
+template<typename T>
+inline T *qrhi_objectFromProxyData(QRhiSwapChainProxyData *pd, QWindow *window, QRhi::Implementation impl, uint objectIndex)
+{
+ Q_ASSERT(objectIndex < std::size(pd->reserved));
+ if (!pd->reserved[objectIndex]) // // was not set, no other choice, do it here, whatever thread this is
+ *pd = QRhi::updateSwapChainProxyData(impl, window);
+ return static_cast<T *>(pd->reserved[objectIndex]);
+}
QT_END_NAMESPACE
diff --git a/src/gui/rhi/qrhi_p_p.h b/src/gui/rhi/qrhi_p_p.h
deleted file mode 100644
index baffe28202..0000000000
--- a/src/gui/rhi/qrhi_p_p.h
+++ /dev/null
@@ -1,551 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2019 The Qt Company Ltd.
-** Contact: http://www.qt.io/licensing/
-**
-** This file is part of the Qt Gui module
-**
-** $QT_BEGIN_LICENSE:LGPL3$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef QRHI_P_H
-#define QRHI_P_H
-
-//
-// W A R N I N G
-// -------------
-//
-// This file is not part of the Qt API. It exists purely as an
-// implementation detail. This header file may change from version to
-// version without notice, or even be removed.
-//
-// We mean it.
-//
-
-#include "qrhi_p.h"
-#include "qrhiprofiler_p_p.h"
-#include <QBitArray>
-#include <QAtomicInt>
-#include <QLoggingCategory>
-
-QT_BEGIN_NAMESPACE
-
-#define QRHI_RES(t, x) static_cast<t *>(x)
-#define QRHI_RES_RHI(t) t *rhiD = static_cast<t *>(m_rhi)
-#define QRHI_PROF QRhiProfilerPrivate *rhiP = m_rhi->profilerPrivateOrNull()
-#define QRHI_PROF_F(f) for (bool qrhip_enabled = rhiP != nullptr; qrhip_enabled; qrhip_enabled = false) rhiP->f
-
-Q_DECLARE_LOGGING_CATEGORY(QRHI_LOG_INFO)
-
-class QRhiImplementation
-{
-public:
- virtual ~QRhiImplementation();
-
- virtual bool create(QRhi::Flags flags) = 0;
- virtual void destroy() = 0;
-
- virtual QRhiGraphicsPipeline *createGraphicsPipeline() = 0;
- virtual QRhiComputePipeline *createComputePipeline() = 0;
- virtual QRhiShaderResourceBindings *createShaderResourceBindings() = 0;
- virtual QRhiBuffer *createBuffer(QRhiBuffer::Type type,
- QRhiBuffer::UsageFlags usage,
- int size) = 0;
- virtual QRhiRenderBuffer *createRenderBuffer(QRhiRenderBuffer::Type type,
- const QSize &pixelSize,
- int sampleCount,
- QRhiRenderBuffer::Flags flags) = 0;
- virtual QRhiTexture *createTexture(QRhiTexture::Format format,
- const QSize &pixelSize,
- int sampleCount,
- QRhiTexture::Flags flags) = 0;
- virtual QRhiSampler *createSampler(QRhiSampler::Filter magFilter, QRhiSampler::Filter minFilter,
- QRhiSampler::Filter mipmapMode,
- QRhiSampler:: AddressMode u, QRhiSampler::AddressMode v) = 0;
-
- virtual QRhiTextureRenderTarget *createTextureRenderTarget(const QRhiTextureRenderTargetDescription &desc,
- QRhiTextureRenderTarget::Flags flags) = 0;
-
- virtual QRhiSwapChain *createSwapChain() = 0;
- virtual QRhi::FrameOpResult beginFrame(QRhiSwapChain *swapChain, QRhi::BeginFrameFlags flags) = 0;
- virtual QRhi::FrameOpResult endFrame(QRhiSwapChain *swapChain, QRhi::EndFrameFlags flags) = 0;
- virtual QRhi::FrameOpResult beginOffscreenFrame(QRhiCommandBuffer **cb, QRhi::BeginFrameFlags flags) = 0;
- virtual QRhi::FrameOpResult endOffscreenFrame(QRhi::EndFrameFlags flags) = 0;
- virtual QRhi::FrameOpResult finish() = 0;
-
- virtual void resourceUpdate(QRhiCommandBuffer *cb, QRhiResourceUpdateBatch *resourceUpdates) = 0;
-
- virtual void beginPass(QRhiCommandBuffer *cb,
- QRhiRenderTarget *rt,
- const QColor &colorClearValue,
- const QRhiDepthStencilClearValue &depthStencilClearValue,
- QRhiResourceUpdateBatch *resourceUpdates) = 0;
- virtual void endPass(QRhiCommandBuffer *cb, QRhiResourceUpdateBatch *resourceUpdates) = 0;
-
- virtual void setGraphicsPipeline(QRhiCommandBuffer *cb,
- QRhiGraphicsPipeline *ps) = 0;
-
- virtual void setShaderResources(QRhiCommandBuffer *cb,
- QRhiShaderResourceBindings *srb,
- int dynamicOffsetCount,
- const QRhiCommandBuffer::DynamicOffset *dynamicOffsets) = 0;
-
- virtual void setVertexInput(QRhiCommandBuffer *cb,
- int startBinding, int bindingCount, const QRhiCommandBuffer::VertexInput *bindings,
- QRhiBuffer *indexBuf, quint32 indexOffset,
- QRhiCommandBuffer::IndexFormat indexFormat) = 0;
-
- virtual void setViewport(QRhiCommandBuffer *cb, const QRhiViewport &viewport) = 0;
- virtual void setScissor(QRhiCommandBuffer *cb, const QRhiScissor &scissor) = 0;
- virtual void setBlendConstants(QRhiCommandBuffer *cb, const QColor &c) = 0;
- virtual void setStencilRef(QRhiCommandBuffer *cb, quint32 refValue) = 0;
-
- virtual void draw(QRhiCommandBuffer *cb, quint32 vertexCount,
- quint32 instanceCount, quint32 firstVertex, quint32 firstInstance) = 0;
- virtual void drawIndexed(QRhiCommandBuffer *cb, quint32 indexCount,
- quint32 instanceCount, quint32 firstIndex,
- qint32 vertexOffset, quint32 firstInstance) = 0;
-
- virtual void debugMarkBegin(QRhiCommandBuffer *cb, const QByteArray &name) = 0;
- virtual void debugMarkEnd(QRhiCommandBuffer *cb) = 0;
- virtual void debugMarkMsg(QRhiCommandBuffer *cb, const QByteArray &msg) = 0;
-
- virtual void beginComputePass(QRhiCommandBuffer *cb, QRhiResourceUpdateBatch *resourceUpdates) = 0;
- virtual void endComputePass(QRhiCommandBuffer *cb, QRhiResourceUpdateBatch *resourceUpdates) = 0;
- virtual void setComputePipeline(QRhiCommandBuffer *cb, QRhiComputePipeline *ps) = 0;
- virtual void dispatch(QRhiCommandBuffer *cb, int x, int y, int z) = 0;
-
- virtual const QRhiNativeHandles *nativeHandles(QRhiCommandBuffer *cb) = 0;
- virtual void beginExternal(QRhiCommandBuffer *cb) = 0;
- virtual void endExternal(QRhiCommandBuffer *cb) = 0;
-
- virtual QVector<int> supportedSampleCounts() const = 0;
- virtual int ubufAlignment() const = 0;
- virtual bool isYUpInFramebuffer() const = 0;
- virtual bool isYUpInNDC() const = 0;
- virtual bool isClipDepthZeroToOne() const = 0;
- virtual QMatrix4x4 clipSpaceCorrMatrix() const = 0;
- virtual bool isTextureFormatSupported(QRhiTexture::Format format, QRhiTexture::Flags flags) const = 0;
- virtual bool isFeatureSupported(QRhi::Feature feature) const = 0;
- virtual int resourceLimit(QRhi::ResourceLimit limit) const = 0;
- virtual const QRhiNativeHandles *nativeHandles() = 0;
- virtual void sendVMemStatsToProfiler() = 0;
- virtual bool makeThreadLocalNativeContextCurrent() = 0;
- virtual void releaseCachedResources() = 0;
- virtual bool isDeviceLost() const = 0;
-
- bool isCompressedFormat(QRhiTexture::Format format) const;
- void compressedFormatInfo(QRhiTexture::Format format, const QSize &size,
- quint32 *bpl, quint32 *byteSize,
- QSize *blockDim) const;
- void textureFormatInfo(QRhiTexture::Format format, const QSize &size,
- quint32 *bpl, quint32 *byteSize) const;
- quint32 approxByteSizeForTexture(QRhiTexture::Format format, const QSize &baseSize,
- int mipCount, int layerCount);
-
- QRhiProfilerPrivate *profilerPrivateOrNull()
- {
- // return null when QRhi::EnableProfiling was not set
- QRhiProfilerPrivate *p = QRhiProfilerPrivate::get(&profiler);
- return p->rhiDWhenEnabled ? p : nullptr;
- }
-
- // only really care about resources that own native graphics resources underneath
- void registerResource(QRhiResource *res)
- {
- resources.insert(res);
- }
-
- void unregisterResource(QRhiResource *res)
- {
- resources.remove(res);
- }
-
- QSet<QRhiResource *> activeResources() const
- {
- return resources;
- }
-
- void addReleaseAndDestroyLater(QRhiResource *res)
- {
- if (inFrame)
- pendingReleaseAndDestroyResources.insert(res);
- else
- delete res;
- }
-
- void addCleanupCallback(const QRhi::CleanupCallback &callback)
- {
- cleanupCallbacks.append(callback);
- }
-
- bool sanityCheckGraphicsPipeline(QRhiGraphicsPipeline *ps);
-
- QRhi *q;
-
- static const int MAX_SHADER_CACHE_ENTRIES = 128;
-
-protected:
- bool debugMarkers = false;
- int currentFrameSlot = 0; // for vk, mtl, and similar. unused by gl and d3d11.
- bool inFrame = false;
-
-private:
- QRhi::Implementation implType;
- QThread *implThread;
- QRhiProfiler profiler;
- QVarLengthArray<QRhiResourceUpdateBatch *, 4> resUpdPool;
- QBitArray resUpdPoolMap;
- QSet<QRhiResource *> resources;
- QSet<QRhiResource *> pendingReleaseAndDestroyResources;
- QVector<QRhi::CleanupCallback> cleanupCallbacks;
-
- friend class QRhi;
- friend class QRhiResourceUpdateBatchPrivate;
-};
-
-template<typename T, size_t N>
-bool qrhi_toTopLeftRenderTargetRect(const QSize &outputSize, const std::array<T, N> &r,
- T *x, T *y, T *w, T *h)
-{
- // x,y are bottom-left in QRhiScissor and QRhiViewport but top-left in
- // Vulkan/Metal/D3D. Our input is an OpenGL-style scissor rect where both
- // negative x or y, and partly or completely out of bounds rects are
- // allowed. The only thing the input here cannot have is a negative width
- // or height. We must handle all other input gracefully, clamping to a zero
- // width or height rect in the worst case, and ensuring the resulting rect
- // is inside the rendertarget's bounds because some APIs' validation/debug
- // layers are allergic to out of bounds scissor or viewport rects.
-
- const T outputWidth = outputSize.width();
- const T outputHeight = outputSize.height();
- const T inputWidth = r[2];
- const T inputHeight = r[3];
-
- if (inputWidth < 0 || inputHeight < 0)
- return false;
-
- *x = r[0];
- *y = outputHeight - (r[1] + inputHeight);
-
- const T widthOffset = *x < 0 ? -*x : 0;
- const T heightOffset = *y < 0 ? -*y : 0;
-
- *x = qBound<T>(0, *x, outputWidth - 1);
- *y = qBound<T>(0, *y, outputHeight - 1);
- *w = qMax<T>(0, inputWidth - widthOffset);
- *h = qMax<T>(0, inputHeight - heightOffset);
-
- if (*x + *w > outputWidth)
- *w = qMax<T>(0, outputWidth - *x - 1);
- if (*y + *h > outputHeight)
- *h = qMax<T>(0, outputHeight - *y - 1);
-
- return true;
-}
-
-class QRhiResourceUpdateBatchPrivate
-{
-public:
- struct BufferOp {
- enum Type {
- DynamicUpdate,
- StaticUpload,
- Read
- };
- Type type;
- QRhiBuffer *buf;
- int offset;
- QByteArray data;
- int readSize;
- QRhiBufferReadbackResult *result;
-
- static BufferOp dynamicUpdate(QRhiBuffer *buf, int offset, int size, const void *data)
- {
- BufferOp op;
- op.type = DynamicUpdate;
- op.buf = buf;
- op.offset = offset;
- op.data = QByteArray(reinterpret_cast<const char *>(data), size ? size : buf->size());
- return op;
- }
-
- static BufferOp staticUpload(QRhiBuffer *buf, int offset, int size, const void *data)
- {
- BufferOp op;
- op.type = StaticUpload;
- op.buf = buf;
- op.offset = offset;
- op.data = QByteArray(reinterpret_cast<const char *>(data), size ? size : buf->size());
- return op;
- }
-
- static BufferOp read(QRhiBuffer *buf, int offset, int size, QRhiBufferReadbackResult *result)
- {
- BufferOp op;
- op.type = Read;
- op.buf = buf;
- op.offset = offset;
- op.readSize = size;
- op.result = result;
- return op;
- }
- };
-
- struct TextureOp {
- enum Type {
- Upload,
- Copy,
- Read,
- GenMips
- };
- Type type;
- QRhiTexture *dst;
- // Specifying multiple uploads for a subresource must be supported.
- // In the backend this can then end up, where applicable, as a
- // single, batched copy operation with only one set of barriers.
- // This helps when doing for example glyph cache fills.
- QVector<QRhiTextureSubresourceUploadDescription> subresDesc[QRhi::MAX_LAYERS][QRhi::MAX_LEVELS];
- QRhiTexture *src;
- QRhiTextureCopyDescription desc;
- QRhiReadbackDescription rb;
- QRhiReadbackResult *result;
- int layer;
-
- static TextureOp upload(QRhiTexture *tex, const QRhiTextureUploadDescription &desc)
- {
- TextureOp op;
- op.type = Upload;
- op.dst = tex;
- for (auto it = desc.cbeginEntries(), itEnd = desc.cendEntries(); it != itEnd; ++it)
- op.subresDesc[it->layer()][it->level()].append(it->description());
- return op;
- }
-
- static TextureOp copy(QRhiTexture *dst, QRhiTexture *src, const QRhiTextureCopyDescription &desc)
- {
- TextureOp op;
- op.type = Copy;
- op.dst = dst;
- op.src = src;
- op.desc = desc;
- return op;
- }
-
- static TextureOp read(const QRhiReadbackDescription &rb, QRhiReadbackResult *result)
- {
- TextureOp op;
- op.type = Read;
- op.rb = rb;
- op.result = result;
- return op;
- }
-
- static TextureOp genMips(QRhiTexture *tex, int layer)
- {
- TextureOp op;
- op.type = GenMips;
- op.dst = tex;
- op.layer = layer;
- return op;
- }
- };
-
- QVarLengthArray<BufferOp, 1024> bufferOps;
- QVarLengthArray<TextureOp, 256> textureOps;
-
- QRhiResourceUpdateBatch *q = nullptr;
- QRhiImplementation *rhi = nullptr;
- int poolIndex = -1;
-
- void free();
- void merge(QRhiResourceUpdateBatchPrivate *other);
-
- static QRhiResourceUpdateBatchPrivate *get(QRhiResourceUpdateBatch *b) { return b->d; }
-};
-
-Q_DECLARE_TYPEINFO(QRhiResourceUpdateBatchPrivate::BufferOp, Q_MOVABLE_TYPE);
-Q_DECLARE_TYPEINFO(QRhiResourceUpdateBatchPrivate::TextureOp, Q_MOVABLE_TYPE);
-
-template<typename T>
-struct QRhiBatchedBindings
-{
- void feed(int binding, T resource) { // binding must be strictly increasing
- if (curBinding == -1 || binding > curBinding + 1) {
- finish();
- curBatch.startBinding = binding;
- curBatch.resources.clear();
- curBatch.resources.append(resource);
- } else {
- Q_ASSERT(binding == curBinding + 1);
- curBatch.resources.append(resource);
- }
- curBinding = binding;
- }
-
- void finish() {
- if (!curBatch.resources.isEmpty())
- batches.append(curBatch);
- }
-
- void clear() {
- batches.clear();
- curBatch.resources.clear();
- curBinding = -1;
- }
-
- struct Batch {
- uint startBinding;
- QVarLengthArray<T, 4> resources;
-
- bool operator==(const Batch &other) const
- {
- return startBinding == other.startBinding && resources == other.resources;
- }
-
- bool operator!=(const Batch &other) const
- {
- return !operator==(other);
- }
- };
-
- QVarLengthArray<Batch, 4> batches; // sorted by startBinding
-
- bool operator==(const QRhiBatchedBindings<T> &other) const
- {
- return batches == other.batches;
- }
-
- bool operator!=(const QRhiBatchedBindings<T> &other) const
- {
- return !operator==(other);
- }
-
-private:
- Batch curBatch;
- int curBinding = -1;
-};
-
-class QRhiGlobalObjectIdGenerator
-{
-public:
-#ifdef Q_ATOMIC_INT64_IS_SUPPORTED
- using Type = quint64;
-#else
- using Type = quint32;
-#endif
- static Type newId();
-};
-
-class QRhiPassResourceTracker
-{
-public:
- bool isEmpty() const;
- void reset();
-
- struct UsageState {
- int layout;
- int access;
- int stage;
- };
-
- enum BufferStage {
- BufVertexInputStage,
- BufVertexStage,
- BufFragmentStage,
- BufComputeStage
- };
-
- enum BufferAccess {
- BufVertexInput,
- BufIndexRead,
- BufUniformRead,
- BufStorageLoad,
- BufStorageStore,
- BufStorageLoadStore
- };
-
- void registerBuffer(QRhiBuffer *buf, int slot, BufferAccess *access, BufferStage *stage,
- const UsageState &state);
-
- enum TextureStage {
- TexVertexStage,
- TexFragmentStage,
- TexColorOutputStage,
- TexDepthOutputStage,
- TexComputeStage
- };
-
- enum TextureAccess {
- TexSample,
- TexColorOutput,
- TexDepthOutput,
- TexStorageLoad,
- TexStorageStore,
- TexStorageLoadStore
- };
-
- void registerTexture(QRhiTexture *tex, TextureAccess *access, TextureStage *stage,
- const UsageState &state);
-
- struct Buffer {
- int slot;
- BufferAccess access;
- BufferStage stage;
- UsageState stateAtPassBegin;
- };
-
- using BufferIterator = QHash<QRhiBuffer *, Buffer>::const_iterator;
- BufferIterator cbeginBuffers() const { return m_buffers.cbegin(); }
- BufferIterator cendBuffers() const { return m_buffers.cend(); }
-
- struct Texture {
- TextureAccess access;
- TextureStage stage;
- UsageState stateAtPassBegin;
- };
-
- using TextureIterator = QHash<QRhiTexture *, Texture>::const_iterator;
- TextureIterator cbeginTextures() const { return m_textures.cbegin(); }
- TextureIterator cendTextures() const { return m_textures.cend(); }
-
- static BufferStage toPassTrackerBufferStage(QRhiShaderResourceBinding::StageFlags stages);
- static TextureStage toPassTrackerTextureStage(QRhiShaderResourceBinding::StageFlags stages);
-
-private:
- QHash<QRhiBuffer *, Buffer> m_buffers;
- QHash<QRhiTexture *, Texture> m_textures;
-};
-
-Q_DECLARE_TYPEINFO(QRhiPassResourceTracker::Buffer, Q_MOVABLE_TYPE);
-Q_DECLARE_TYPEINFO(QRhiPassResourceTracker::Texture, Q_MOVABLE_TYPE);
-
-QT_END_NAMESPACE
-
-#endif
diff --git a/src/gui/rhi/qrhi_platform.h b/src/gui/rhi/qrhi_platform.h
new file mode 100644
index 0000000000..e7be522c52
--- /dev/null
+++ b/src/gui/rhi/qrhi_platform.h
@@ -0,0 +1,175 @@
+// Copyright (C) 2023 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
+
+#ifndef QRHIPLATFORM_H
+#define QRHIPLATFORM_H
+
+//
+// W A R N I N G
+// -------------
+//
+// This file is part of the RHI API, with limited compatibility guarantees.
+// Usage of this API may make your code source and binary incompatible with
+// future versions of Qt.
+//
+
+#include <rhi/qrhi.h>
+
+#if QT_CONFIG(opengl)
+#include <QtGui/qsurfaceformat.h>
+#endif
+
+#if QT_CONFIG(vulkan)
+#include <QtGui/qvulkaninstance.h>
+#endif
+
+#if QT_CONFIG(metal) || defined(Q_QDOC)
+Q_FORWARD_DECLARE_OBJC_CLASS(MTLDevice);
+Q_FORWARD_DECLARE_OBJC_CLASS(MTLCommandQueue);
+Q_FORWARD_DECLARE_OBJC_CLASS(MTLCommandBuffer);
+Q_FORWARD_DECLARE_OBJC_CLASS(MTLRenderCommandEncoder);
+#endif
+
+QT_BEGIN_NAMESPACE
+
+struct Q_GUI_EXPORT QRhiNullInitParams : public QRhiInitParams
+{
+};
+
+struct Q_GUI_EXPORT QRhiNullNativeHandles : public QRhiNativeHandles
+{
+};
+
+#if QT_CONFIG(opengl) || defined(Q_QDOC)
+
+class QOpenGLContext;
+class QOffscreenSurface;
+class QSurface;
+class QWindow;
+
+struct Q_GUI_EXPORT QRhiGles2InitParams : public QRhiInitParams
+{
+ QRhiGles2InitParams();
+
+ QSurfaceFormat format;
+ QSurface *fallbackSurface = nullptr;
+ QWindow *window = nullptr;
+ QOpenGLContext *shareContext = nullptr;
+
+ static QOffscreenSurface *newFallbackSurface(const QSurfaceFormat &format = QSurfaceFormat::defaultFormat());
+};
+
+struct Q_GUI_EXPORT QRhiGles2NativeHandles : public QRhiNativeHandles
+{
+ QOpenGLContext *context = nullptr;
+};
+
+#endif // opengl/qdoc
+
+#if (QT_CONFIG(vulkan) && __has_include(<vulkan/vulkan.h>)) || defined(Q_QDOC)
+
+struct Q_GUI_EXPORT QRhiVulkanInitParams : public QRhiInitParams
+{
+ QVulkanInstance *inst = nullptr;
+ QWindow *window = nullptr;
+ QByteArrayList deviceExtensions;
+
+ static QByteArrayList preferredInstanceExtensions();
+ static QByteArrayList preferredExtensionsForImportedDevice();
+};
+
+struct Q_GUI_EXPORT QRhiVulkanNativeHandles : public QRhiNativeHandles
+{
+ // to import a physical device (always required)
+ VkPhysicalDevice physDev = VK_NULL_HANDLE;
+ // to import a device and queue
+ VkDevice dev = VK_NULL_HANDLE;
+ quint32 gfxQueueFamilyIdx = 0;
+ quint32 gfxQueueIdx = 0;
+ // and optionally, the mem allocator
+ void *vmemAllocator = nullptr;
+
+ // only for querying (rhi->nativeHandles())
+ VkQueue gfxQueue = VK_NULL_HANDLE;
+ QVulkanInstance *inst = nullptr;
+};
+
+struct Q_GUI_EXPORT QRhiVulkanCommandBufferNativeHandles : public QRhiNativeHandles
+{
+ VkCommandBuffer commandBuffer = VK_NULL_HANDLE;
+};
+
+struct Q_GUI_EXPORT QRhiVulkanRenderPassNativeHandles : public QRhiNativeHandles
+{
+ VkRenderPass renderPass = VK_NULL_HANDLE;
+};
+
+#endif // vulkan/qdoc
+
+#if defined(Q_OS_WIN) || defined(Q_QDOC)
+
+// no d3d includes here, to prevent precompiled header mess due to COM, hence the void pointers
+
+struct Q_GUI_EXPORT QRhiD3D11InitParams : public QRhiInitParams
+{
+ bool enableDebugLayer = false;
+};
+
+struct Q_GUI_EXPORT QRhiD3D11NativeHandles : public QRhiNativeHandles
+{
+ // to import a device and a context
+ void *dev = nullptr;
+ void *context = nullptr;
+ // alternatively, to specify the device feature level and/or the adapter to use
+ int featureLevel = 0;
+ quint32 adapterLuidLow = 0;
+ qint32 adapterLuidHigh = 0;
+};
+
+struct Q_GUI_EXPORT QRhiD3D12InitParams : public QRhiInitParams
+{
+ bool enableDebugLayer = false;
+};
+
+struct Q_GUI_EXPORT QRhiD3D12NativeHandles : public QRhiNativeHandles
+{
+ // to import a device
+ void *dev = nullptr;
+ int minimumFeatureLevel = 0;
+ // to just specify the adapter to use, set these and leave dev set to null
+ quint32 adapterLuidLow = 0;
+ qint32 adapterLuidHigh = 0;
+ // in addition, can specify the command queue to use
+ void *commandQueue = nullptr;
+};
+
+struct Q_GUI_EXPORT QRhiD3D12CommandBufferNativeHandles : public QRhiNativeHandles
+{
+ void *commandList = nullptr; // ID3D12GraphicsCommandList1
+};
+
+#endif // WIN/QDOC
+
+#if QT_CONFIG(metal) || defined(Q_QDOC)
+
+struct Q_GUI_EXPORT QRhiMetalInitParams : public QRhiInitParams
+{
+};
+
+struct Q_GUI_EXPORT QRhiMetalNativeHandles : public QRhiNativeHandles
+{
+ MTLDevice *dev = nullptr;
+ MTLCommandQueue *cmdQueue = nullptr;
+};
+
+struct Q_GUI_EXPORT QRhiMetalCommandBufferNativeHandles : public QRhiNativeHandles
+{
+ MTLCommandBuffer *commandBuffer = nullptr;
+ MTLRenderCommandEncoder *encoder = nullptr;
+};
+
+#endif // MACOS/IOS/QDOC
+
+QT_END_NAMESPACE
+
+#endif
diff --git a/src/gui/rhi/qrhid3d11.cpp b/src/gui/rhi/qrhid3d11.cpp
index ba2488bffb..b09baf57b2 100644
--- a/src/gui/rhi/qrhid3d11.cpp
+++ b/src/gui/rhi/qrhid3d11.cpp
@@ -1,55 +1,22 @@
-/****************************************************************************
-**
-** Copyright (C) 2019 The Qt Company Ltd.
-** Contact: http://www.qt.io/licensing/
-**
-** This file is part of the Qt Gui module
-**
-** $QT_BEGIN_LICENSE:LGPL3$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "qrhid3d11_p_p.h"
-#include "qshader_p.h"
-#include "cs_tdr_p.h"
+// Copyright (C) 2019 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
+
+#include "qrhid3d11_p.h"
+#include "qshader.h"
+#include "vs_test_p.h"
#include <QWindow>
-#include <QOperatingSystemVersion>
#include <qmath.h>
-#include <private/qsystemlibrary_p.h>
-
-#include <d3dcompiler.h>
-#include <comdef.h>
+#include <QtCore/qcryptographichash.h>
+#include <QtCore/private/qsystemerror_p.h>
+#include "qrhid3dhelpers_p.h"
QT_BEGIN_NAMESPACE
+using namespace Qt::StringLiterals;
+
/*
- Direct3D 11 backend. Provides a double-buffered flip model (FLIP_DISCARD)
- swapchain. Textures and "static" buffers are USAGE_DEFAULT, leaving it to
+ Direct3D 11 backend. Provides a double-buffered flip model swapchain.
+ Textures and "static" buffers are USAGE_DEFAULT, leaving it to
UpdateSubResource to upload the data in any way it sees fit. "Dynamic"
buffers are USAGE_DYNAMIC and updating is done by mapping with WRITE_DISCARD.
(so here QRhiBuffer keeps a copy of the buffer contents and all of it is
@@ -59,10 +26,13 @@ QT_BEGIN_NAMESPACE
/*!
\class QRhiD3D11InitParams
- \internal
\inmodule QtGui
+ \since 6.6
\brief Direct3D 11 specific initialization parameters.
+ \note This is a RHI API with limited compatibility guarantees, see \l QRhi
+ for details.
+
A D3D11-based QRhi needs no special parameters for initialization. If
desired, enableDebugLayer can be set to \c true to enable the Direct3D
debug layer. This can be useful during development, but should be avoided
@@ -75,19 +45,22 @@ QT_BEGIN_NAMESPACE
\endcode
\note QRhiSwapChain should only be used in combination with QWindow
- instances that have their surface type set to QSurface::OpenGLSurface.
- There are currently no Direct3D specifics in the Windows platform support
- of Qt and therefore there is no separate QSurface type available.
+ instances that have their surface type set to QSurface::Direct3DSurface.
\section2 Working with existing Direct3D 11 devices
When interoperating with another graphics engine, it may be necessary to
get a QRhi instance that uses the same Direct3D device. This can be
achieved by passing a pointer to a QRhiD3D11NativeHandles to
- QRhi::create(). Both the device and the device context must be set to a
- non-null value then.
+ QRhi::create(). When the device is set to a non-null value, the device
+ context must be specified as well. QRhi does not take ownership of any of
+ the external objects.
- The QRhi does not take ownership of any of the external objects.
+ Sometimes, for example when using QRhi in combination with OpenXR, one will
+ want to specify which adapter to use, and optionally, which feature level
+ to request on the device, while leaving the device creation to QRhi. This
+ is achieved by leaving the device and context pointers set to null, while
+ specifying the adapter LUID and feature level.
\note QRhi works with immediate contexts only. Deferred contexts are not
used in any way.
@@ -98,73 +71,107 @@ QT_BEGIN_NAMESPACE
*/
/*!
+ \variable QRhiD3D11InitParams::enableDebugLayer
+
+ When set to true, a debug device is created, assuming the debug layer is
+ available. The default value is false.
+*/
+
+/*!
\class QRhiD3D11NativeHandles
- \internal
\inmodule QtGui
+ \since 6.6
\brief Holds the D3D device and device context used by the QRhi.
\note The class uses \c{void *} as the type since including the COM-based
\c{d3d11.h} headers is not acceptable here. The actual types are
\c{ID3D11Device *} and \c{ID3D11DeviceContext *}.
+
+ \note This is a RHI API with limited compatibility guarantees, see \l QRhi
+ for details.
*/
/*!
- \class QRhiD3D11TextureNativeHandles
- \internal
- \inmodule QtGui
- \brief Holds the D3D texture object that is backing a QRhiTexture instance.
+ \variable QRhiD3D11NativeHandles::dev
- \note The class uses \c{void *} as the type since including the COM-based
- \c{d3d11.h} headers is not acceptable here. The actual type is
- \c{ID3D11Texture2D *}.
- */
+ Points to a
+ \l{https://learn.microsoft.com/en-us/windows/win32/api/d3d11/nn-d3d11-id3d11device}{ID3D11Device}
+ or left set to \nullptr if no existing device is to be imported.
+
+ \note When importing a device, both the device and the device context must be set to valid objects.
+*/
+
+/*!
+ \variable QRhiD3D11NativeHandles::context
+
+ Points to a \l{https://learn.microsoft.com/en-us/windows/win32/api/d3d11/nn-d3d11-id3d11devicecontext}{ID3D11DeviceContext}
+ or left set to \nullptr if no existing device context is to be imported.
+
+ \note When importing a device, both the device and the device context must be set to valid objects.
+*/
+
+/*!
+ \variable QRhiD3D11NativeHandles::featureLevel
+
+ Specifies the feature level passed to
+ \l{https://learn.microsoft.com/en-us/windows/win32/api/d3d11/nf-d3d11-d3d11createdevice}{D3D11CreateDevice()}.
+ Relevant only when QRhi creates the device, ignored when importing a device
+ and device context. When not set, the default rules outlined in the D3D
+ documentation apply.
+*/
+
+/*!
+ \variable QRhiD3D11NativeHandles::adapterLuidLow
+
+ The low part of the local identifier (LUID) of the DXGI adapter to use.
+ Relevant only when QRhi creates the device, ignored when importing a device
+ and device context.
+*/
+
+/*!
+ \variable QRhiD3D11NativeHandles::adapterLuidHigh
+
+ The high part of the local identifier (LUID) of the DXGI adapter to use.
+ Relevant only when QRhi creates the device, ignored when importing a device
+ and device context.
+*/
// help mingw with its ancient sdk headers
#ifndef DXGI_ADAPTER_FLAG_SOFTWARE
#define DXGI_ADAPTER_FLAG_SOFTWARE 2
#endif
-QRhiD3D11::QRhiD3D11(QRhiD3D11InitParams *params, QRhiD3D11NativeHandles *importDevice)
- : ofr(this),
- deviceCurse(this)
+#ifndef D3D11_1_UAV_SLOT_COUNT
+#define D3D11_1_UAV_SLOT_COUNT 64
+#endif
+
+#ifndef D3D11_VS_INPUT_REGISTER_COUNT
+#define D3D11_VS_INPUT_REGISTER_COUNT 32
+#endif
+
+QRhiD3D11::QRhiD3D11(QRhiD3D11InitParams *params, QRhiD3D11NativeHandles *importParams)
+ : ofr(this)
{
debugLayer = params->enableDebugLayer;
- deviceCurse.framesToActivate = params->framesUntilKillingDeviceViaTdr;
- deviceCurse.permanent = params->repeatDeviceKill;
-
- importedDevice = importDevice != nullptr;
- if (importedDevice) {
- dev = reinterpret_cast<ID3D11Device *>(importDevice->dev);
- if (dev) {
- ID3D11DeviceContext *ctx = reinterpret_cast<ID3D11DeviceContext *>(importDevice->context);
- if (SUCCEEDED(ctx->QueryInterface(IID_ID3D11DeviceContext1, reinterpret_cast<void **>(&context)))) {
+ if (importParams) {
+ if (importParams->dev && importParams->context) {
+ dev = reinterpret_cast<ID3D11Device *>(importParams->dev);
+ ID3D11DeviceContext *ctx = reinterpret_cast<ID3D11DeviceContext *>(importParams->context);
+ if (SUCCEEDED(ctx->QueryInterface(__uuidof(ID3D11DeviceContext1), reinterpret_cast<void **>(&context)))) {
// get rid of the ref added by QueryInterface
ctx->Release();
+ importedDeviceAndContext = true;
} else {
qWarning("ID3D11DeviceContext1 not supported by context, cannot import");
- importedDevice = false;
}
- } else {
- qWarning("No ID3D11Device given, cannot import");
- importedDevice = false;
}
+ featureLevel = D3D_FEATURE_LEVEL(importParams->featureLevel);
+ adapterLuid.LowPart = importParams->adapterLuidLow;
+ adapterLuid.HighPart = importParams->adapterLuidHigh;
}
}
-static QString comErrorMessage(HRESULT hr)
-{
-#ifndef Q_OS_WINRT
- const _com_error comError(hr);
-#else
- const _com_error comError(hr, nullptr);
-#endif
- QString result = QLatin1String("Error 0x") + QString::number(ulong(hr), 16);
- if (const wchar_t *msg = comError.ErrorMessage())
- result += QLatin1String(": ") + QString::fromWCharArray(msg);
- return result;
-}
-
template <class Int>
inline Int aligned(Int v, Int byteAlign)
{
@@ -174,28 +181,10 @@ inline Int aligned(Int v, Int byteAlign)
static IDXGIFactory1 *createDXGIFactory2()
{
IDXGIFactory1 *result = nullptr;
- if (QOperatingSystemVersion::current() > QOperatingSystemVersion::Windows7) {
- using PtrCreateDXGIFactory2 = HRESULT (WINAPI *)(UINT, REFIID, void **);
- QSystemLibrary dxgilib(QStringLiteral("dxgi"));
- if (auto createDXGIFactory2 = reinterpret_cast<PtrCreateDXGIFactory2>(dxgilib.resolve("CreateDXGIFactory2"))) {
- const HRESULT hr = createDXGIFactory2(0, IID_IDXGIFactory2, reinterpret_cast<void **>(&result));
- if (FAILED(hr)) {
- qWarning("CreateDXGIFactory2() failed to create DXGI factory: %s", qPrintable(comErrorMessage(hr)));
- result = nullptr;
- }
- } else {
- qWarning("Unable to resolve CreateDXGIFactory2()");
- }
- }
- return result;
-}
-
-static IDXGIFactory1 *createDXGIFactory1()
-{
- IDXGIFactory1 *result = nullptr;
- const HRESULT hr = CreateDXGIFactory1(IID_IDXGIFactory1, reinterpret_cast<void **>(&result));
+ const HRESULT hr = CreateDXGIFactory2(0, __uuidof(IDXGIFactory2), reinterpret_cast<void **>(&result));
if (FAILED(hr)) {
- qWarning("CreateDXGIFactory1() failed to create DXGI factory: %s", qPrintable(comErrorMessage(hr)));
+ qWarning("CreateDXGIFactory2() failed to create DXGI factory: %s",
+ qPrintable(QSystemError::windowsComString(hr)));
result = nullptr;
}
return result;
@@ -203,36 +192,61 @@ static IDXGIFactory1 *createDXGIFactory1()
bool QRhiD3D11::create(QRhi::Flags flags)
{
- Q_UNUSED(flags);
+ rhiFlags = flags;
uint devFlags = 0;
if (debugLayer)
devFlags |= D3D11_CREATE_DEVICE_DEBUG;
dxgiFactory = createDXGIFactory2();
- if (dxgiFactory != nullptr) {
- hasDxgi2 = true;
- supportsFlipDiscardSwapchain = QOperatingSystemVersion::current() >= QOperatingSystemVersion::Windows10
- && !qEnvironmentVariableIntValue("QT_D3D_NO_FLIP");
- } else {
- dxgiFactory = createDXGIFactory1();
- hasDxgi2 = false;
- supportsFlipDiscardSwapchain = false;
+ if (!dxgiFactory)
+ return false;
+
+ // For a FLIP_* swapchain Present(0, 0) is not necessarily
+ // sufficient to get non-blocking behavior, try using ALLOW_TEARING
+ // when available.
+ supportsAllowTearing = false;
+ IDXGIFactory5 *factory5 = nullptr;
+ if (SUCCEEDED(dxgiFactory->QueryInterface(__uuidof(IDXGIFactory5), reinterpret_cast<void **>(&factory5)))) {
+ BOOL allowTearing = false;
+ if (SUCCEEDED(factory5->CheckFeatureSupport(DXGI_FEATURE_PRESENT_ALLOW_TEARING, &allowTearing, sizeof(allowTearing))))
+ supportsAllowTearing = allowTearing;
+ factory5->Release();
}
- if (dxgiFactory == nullptr)
- return false;
+ if (qEnvironmentVariableIntValue("QT_D3D_FLIP_DISCARD"))
+ qWarning("The default swap effect is FLIP_DISCARD, QT_D3D_FLIP_DISCARD is now ignored");
+
+ // Support for flip model swapchains is required now (since we are
+ // targeting Windows 10+), but the option for using the old model is still
+ // there. (some features are not supported then, however)
+ useLegacySwapchainModel = qEnvironmentVariableIntValue("QT_D3D_NO_FLIP");
- qCDebug(QRHI_LOG_INFO, "DXGI 1.2 = %s, FLIP_DISCARD swapchain supported = %s",
- hasDxgi2 ? "true" : "false", supportsFlipDiscardSwapchain ? "true" : "false");
+ qCDebug(QRHI_LOG_INFO, "FLIP_* swapchain supported = true, ALLOW_TEARING supported = %s, use legacy (non-FLIP) model = %s",
+ supportsAllowTearing ? "true" : "false",
+ useLegacySwapchainModel ? "true" : "false");
- if (!importedDevice) {
- IDXGIAdapter1 *adapterToUse = nullptr;
+ if (!importedDeviceAndContext) {
IDXGIAdapter1 *adapter;
int requestedAdapterIndex = -1;
if (qEnvironmentVariableIsSet("QT_D3D_ADAPTER_INDEX"))
requestedAdapterIndex = qEnvironmentVariableIntValue("QT_D3D_ADAPTER_INDEX");
+ // The importParams may specify an adapter by the luid, take that into account.
+ if (requestedAdapterIndex < 0 && (adapterLuid.LowPart || adapterLuid.HighPart)) {
+ for (int adapterIndex = 0; dxgiFactory->EnumAdapters1(UINT(adapterIndex), &adapter) != DXGI_ERROR_NOT_FOUND; ++adapterIndex) {
+ DXGI_ADAPTER_DESC1 desc;
+ adapter->GetDesc1(&desc);
+ adapter->Release();
+ if (desc.AdapterLuid.LowPart == adapterLuid.LowPart
+ && desc.AdapterLuid.HighPart == adapterLuid.HighPart)
+ {
+ requestedAdapterIndex = adapterIndex;
+ break;
+ }
+ }
+ }
+
if (requestedAdapterIndex < 0 && flags.testFlag(QRhi::PreferSoftwareRenderer)) {
for (int adapterIndex = 0; dxgiFactory->EnumAdapters1(UINT(adapterIndex), &adapter) != DXGI_ERROR_NOT_FOUND; ++adapterIndex) {
DXGI_ADAPTER_DESC1 desc;
@@ -245,6 +259,7 @@ bool QRhiD3D11::create(QRhi::Flags flags)
}
}
+ activeAdapter = nullptr;
for (int adapterIndex = 0; dxgiFactory->EnumAdapters1(UINT(adapterIndex), &adapter) != DXGI_ERROR_NOT_FOUND; ++adapterIndex) {
DXGI_ADAPTER_DESC1 desc;
adapter->GetDesc1(&desc);
@@ -255,48 +270,126 @@ bool QRhiD3D11::create(QRhi::Flags flags)
desc.VendorId,
desc.DeviceId,
desc.Flags);
- if (!adapterToUse && (requestedAdapterIndex < 0 || requestedAdapterIndex == adapterIndex)) {
- adapterToUse = adapter;
+ if (!activeAdapter && (requestedAdapterIndex < 0 || requestedAdapterIndex == adapterIndex)) {
+ activeAdapter = adapter;
+ adapterLuid = desc.AdapterLuid;
+ QRhiD3D::fillDriverInfo(&driverInfoStruct, desc);
qCDebug(QRHI_LOG_INFO, " using this adapter");
} else {
adapter->Release();
}
}
- if (!adapterToUse) {
+ if (!activeAdapter) {
qWarning("No adapter");
return false;
}
+ // Normally we won't specify a requested feature level list,
+ // except when a level was specified in importParams.
+ QVarLengthArray<D3D_FEATURE_LEVEL, 4> requestedFeatureLevels;
+ bool requestFeatureLevels = false;
+ if (featureLevel) {
+ requestFeatureLevels = true;
+ requestedFeatureLevels.append(featureLevel);
+ }
+
ID3D11DeviceContext *ctx = nullptr;
- HRESULT hr = D3D11CreateDevice(adapterToUse, D3D_DRIVER_TYPE_UNKNOWN, nullptr, devFlags,
- nullptr, 0, D3D11_SDK_VERSION,
+ HRESULT hr = D3D11CreateDevice(activeAdapter, D3D_DRIVER_TYPE_UNKNOWN, nullptr, devFlags,
+ requestFeatureLevels ? requestedFeatureLevels.constData() : nullptr,
+ requestFeatureLevels ? requestedFeatureLevels.count() : 0,
+ D3D11_SDK_VERSION,
&dev, &featureLevel, &ctx);
- adapterToUse->Release();
+ // We cannot assume that D3D11_CREATE_DEVICE_DEBUG is always available. Retry without it, if needed.
+ if (hr == DXGI_ERROR_SDK_COMPONENT_MISSING && debugLayer) {
+ qCDebug(QRHI_LOG_INFO, "Debug layer was requested but is not available. "
+ "Attempting to create D3D11 device without it.");
+ devFlags &= ~D3D11_CREATE_DEVICE_DEBUG;
+ hr = D3D11CreateDevice(activeAdapter, D3D_DRIVER_TYPE_UNKNOWN, nullptr, devFlags,
+ requestFeatureLevels ? requestedFeatureLevels.constData() : nullptr,
+ requestFeatureLevels ? requestedFeatureLevels.count() : 0,
+ D3D11_SDK_VERSION,
+ &dev, &featureLevel, &ctx);
+ }
if (FAILED(hr)) {
- qWarning("Failed to create D3D11 device and context: %s", qPrintable(comErrorMessage(hr)));
+ qWarning("Failed to create D3D11 device and context: %s",
+ qPrintable(QSystemError::windowsComString(hr)));
return false;
}
- if (SUCCEEDED(ctx->QueryInterface(IID_ID3D11DeviceContext1, reinterpret_cast<void **>(&context)))) {
- ctx->Release();
- } else {
+
+ const bool supports11_1 = SUCCEEDED(ctx->QueryInterface(__uuidof(ID3D11DeviceContext1), reinterpret_cast<void **>(&context)));
+ ctx->Release();
+ if (!supports11_1) {
qWarning("ID3D11DeviceContext1 not supported");
return false;
}
+
+ // Test if creating a Shader Model 5.0 vertex shader works; we want to
+ // fail already in create() if that's not the case.
+ ID3D11VertexShader *testShader = nullptr;
+ if (SUCCEEDED(dev->CreateVertexShader(g_testVertexShader, sizeof(g_testVertexShader), nullptr, &testShader))) {
+ testShader->Release();
+ } else {
+ static const char *msg = "D3D11 smoke test: Failed to create vertex shader";
+ if (flags.testFlag(QRhi::SuppressSmokeTestWarnings))
+ qCDebug(QRHI_LOG_INFO, "%s", msg);
+ else
+ qWarning("%s", msg);
+ return false;
+ }
+
+ D3D11_FEATURE_DATA_D3D11_OPTIONS features = {};
+ if (SUCCEEDED(dev->CheckFeatureSupport(D3D11_FEATURE_D3D11_OPTIONS, &features, sizeof(features)))) {
+ // The D3D _runtime_ may be 11.1, but the underlying _driver_ may
+ // still not support this D3D_FEATURE_LEVEL_11_1 feature. (e.g.
+ // because it only does 11_0)
+ if (!features.ConstantBufferOffsetting) {
+ static const char *msg = "D3D11 smoke test: Constant buffer offsetting is not supported by the driver";
+ if (flags.testFlag(QRhi::SuppressSmokeTestWarnings))
+ qCDebug(QRHI_LOG_INFO, "%s", msg);
+ else
+ qWarning("%s", msg);
+ return false;
+ }
+ } else {
+ static const char *msg = "D3D11 smoke test: Failed to query D3D11_FEATURE_D3D11_OPTIONS";
+ if (flags.testFlag(QRhi::SuppressSmokeTestWarnings))
+ qCDebug(QRHI_LOG_INFO, "%s", msg);
+ else
+ qWarning("%s", msg);
+ return false;
+ }
} else {
Q_ASSERT(dev && context);
featureLevel = dev->GetFeatureLevel();
+ IDXGIDevice *dxgiDev = nullptr;
+ if (SUCCEEDED(dev->QueryInterface(__uuidof(IDXGIDevice), reinterpret_cast<void **>(&dxgiDev)))) {
+ IDXGIAdapter *adapter = nullptr;
+ if (SUCCEEDED(dxgiDev->GetAdapter(&adapter))) {
+ IDXGIAdapter1 *adapter1 = nullptr;
+ if (SUCCEEDED(adapter->QueryInterface(__uuidof(IDXGIAdapter1), reinterpret_cast<void **>(&adapter1)))) {
+ DXGI_ADAPTER_DESC1 desc;
+ adapter1->GetDesc1(&desc);
+ adapterLuid = desc.AdapterLuid;
+ QRhiD3D::fillDriverInfo(&driverInfoStruct, desc);
+ adapter1->Release();
+ }
+ adapter->Release();
+ }
+ dxgiDev->Release();
+ }
+ qCDebug(QRHI_LOG_INFO, "Using imported device %p", dev);
}
- if (FAILED(context->QueryInterface(IID_ID3DUserDefinedAnnotation, reinterpret_cast<void **>(&annotations))))
+ if (FAILED(context->QueryInterface(__uuidof(ID3DUserDefinedAnnotation), reinterpret_cast<void **>(&annotations))))
annotations = nullptr;
deviceLost = false;
nativeHandlesStruct.dev = dev;
nativeHandlesStruct.context = context;
-
- if (deviceCurse.framesToActivate > 0)
- deviceCurse.initResources();
+ nativeHandlesStruct.featureLevel = featureLevel;
+ nativeHandlesStruct.adapterLuidLow = adapterLuid.LowPart;
+ nativeHandlesStruct.adapterLuidHigh = adapterLuid.HighPart;
return true;
}
@@ -315,14 +408,23 @@ void QRhiD3D11::destroy()
clearShaderCache();
- deviceCurse.releaseResources();
+ if (ofr.tsDisjointQuery) {
+ ofr.tsDisjointQuery->Release();
+ ofr.tsDisjointQuery = nullptr;
+ }
+ for (int i = 0; i < 2; ++i) {
+ if (ofr.tsQueries[i]) {
+ ofr.tsQueries[i]->Release();
+ ofr.tsQueries[i] = nullptr;
+ }
+ }
if (annotations) {
annotations->Release();
annotations = nullptr;
}
- if (!importedDevice) {
+ if (!importedDeviceAndContext) {
if (context) {
context->Release();
context = nullptr;
@@ -333,6 +435,16 @@ void QRhiD3D11::destroy()
}
}
+ if (dcompDevice) {
+ dcompDevice->Release();
+ dcompDevice = nullptr;
+ }
+
+ if (activeAdapter) {
+ activeAdapter->Release();
+ activeAdapter = nullptr;
+ }
+
if (dxgiFactory) {
dxgiFactory->Release();
dxgiFactory = nullptr;
@@ -343,30 +455,24 @@ void QRhiD3D11::reportLiveObjects(ID3D11Device *device)
{
// this works only when params.enableDebugLayer was true
ID3D11Debug *debug;
- if (SUCCEEDED(device->QueryInterface(IID_ID3D11Debug, reinterpret_cast<void **>(&debug)))) {
+ if (SUCCEEDED(device->QueryInterface(__uuidof(ID3D11Debug), reinterpret_cast<void **>(&debug)))) {
debug->ReportLiveDeviceObjects(D3D11_RLDO_DETAIL);
debug->Release();
}
}
-QVector<int> QRhiD3D11::supportedSampleCounts() const
+QList<int> QRhiD3D11::supportedSampleCounts() const
{
return { 1, 2, 4, 8 };
}
-DXGI_SAMPLE_DESC QRhiD3D11::effectiveSampleCount(int sampleCount) const
+DXGI_SAMPLE_DESC QRhiD3D11::effectiveSampleDesc(int sampleCount) const
{
DXGI_SAMPLE_DESC desc;
desc.Count = 1;
desc.Quality = 0;
- // Stay compatible with QSurfaceFormat and friends where samples == 0 means the same as 1.
- int s = qBound(1, sampleCount, 64);
-
- if (!supportedSampleCounts().contains(s)) {
- qWarning("Attempted to set unsupported sample count %d", sampleCount);
- return desc;
- }
+ const int s = effectiveSampleCount(sampleCount);
desc.Count = UINT(s);
if (s > 1)
@@ -382,7 +488,7 @@ QRhiSwapChain *QRhiD3D11::createSwapChain()
return new QD3D11SwapChain(this);
}
-QRhiBuffer *QRhiD3D11::createBuffer(QRhiBuffer::Type type, QRhiBuffer::UsageFlags usage, int size)
+QRhiBuffer *QRhiD3D11::createBuffer(QRhiBuffer::Type type, QRhiBuffer::UsageFlags usage, quint32 size)
{
return new QD3D11Buffer(this, type, usage, size);
}
@@ -475,6 +581,52 @@ bool QRhiD3D11::isFeatureSupported(QRhi::Feature feature) const
return true;
case QRhi::ReadBackNonBaseMipLevel:
return true;
+ case QRhi::TexelFetch:
+ return true;
+ case QRhi::RenderToNonBaseMipLevel:
+ return true;
+ case QRhi::IntAttributes:
+ return true;
+ case QRhi::ScreenSpaceDerivatives:
+ return true;
+ case QRhi::ReadBackAnyTextureFormat:
+ return true;
+ case QRhi::PipelineCacheDataLoadSave:
+ return true;
+ case QRhi::ImageDataStride:
+ return true;
+ case QRhi::RenderBufferImport:
+ return false;
+ case QRhi::ThreeDimensionalTextures:
+ return true;
+ case QRhi::RenderTo3DTextureSlice:
+ return true;
+ case QRhi::TextureArrays:
+ return true;
+ case QRhi::Tessellation:
+ return true;
+ case QRhi::GeometryShader:
+ return true;
+ case QRhi::TextureArrayRange:
+ return true;
+ case QRhi::NonFillPolygonMode:
+ return true;
+ case QRhi::OneDimensionalTextures:
+ return true;
+ case QRhi::OneDimensionalTextureMipmaps:
+ return true;
+ case QRhi::HalfAttributes:
+ return true;
+ case QRhi::RenderToOneDimensionalTexture:
+ return true;
+ case QRhi::ThreeDimensionalTextureMipmaps:
+ return true;
+ case QRhi::MultiView:
+ return false;
+ case QRhi::TextureViewFormat:
+ return false; // because we use fully typed formats for textures and relaxed casting is a D3D12 thing
+ case QRhi::ResolveDepthStencil:
+ return false;
default:
Q_UNREACHABLE();
return false;
@@ -491,7 +643,31 @@ int QRhiD3D11::resourceLimit(QRhi::ResourceLimit limit) const
case QRhi::MaxColorAttachments:
return 8;
case QRhi::FramesInFlight:
- return 2; // dummy
+ // From our perspective. What D3D does internally is another question
+ // (there could be pipelining, helped f.ex. by our MAP_DISCARD based
+ // uniform buffer update strategy), but that's out of our hands and
+ // does not concern us here.
+ return 1;
+ case QRhi::MaxAsyncReadbackFrames:
+ return 1;
+ case QRhi::MaxThreadGroupsPerDimension:
+ return D3D11_CS_DISPATCH_MAX_THREAD_GROUPS_PER_DIMENSION;
+ case QRhi::MaxThreadsPerThreadGroup:
+ return D3D11_CS_THREAD_GROUP_MAX_THREADS_PER_GROUP;
+ case QRhi::MaxThreadGroupX:
+ return D3D11_CS_THREAD_GROUP_MAX_X;
+ case QRhi::MaxThreadGroupY:
+ return D3D11_CS_THREAD_GROUP_MAX_Y;
+ case QRhi::MaxThreadGroupZ:
+ return D3D11_CS_THREAD_GROUP_MAX_Z;
+ case QRhi::TextureArraySizeMax:
+ return D3D11_REQ_TEXTURE2D_ARRAY_AXIS_DIMENSION;
+ case QRhi::MaxUniformBufferRange:
+ return 65536;
+ case QRhi::MaxVertexInputs:
+ return D3D11_VS_INPUT_REGISTER_COUNT;
+ case QRhi::MaxVertexOutputs:
+ return D3D11_VS_OUTPUT_REGISTER_COUNT;
default:
Q_UNREACHABLE();
return 0;
@@ -503,9 +679,16 @@ const QRhiNativeHandles *QRhiD3D11::nativeHandles()
return &nativeHandlesStruct;
}
-void QRhiD3D11::sendVMemStatsToProfiler()
+QRhiDriverInfo QRhiD3D11::driverInfo() const
{
- // nothing to do here
+ return driverInfoStruct;
+}
+
+QRhiStats QRhiD3D11::statistics()
+{
+ QRhiStats result;
+ result.totalPipelineCreationTime = totalPipelineCreationTime();
+ return result;
}
bool QRhiD3D11::makeThreadLocalNativeContextCurrent()
@@ -517,6 +700,7 @@ bool QRhiD3D11::makeThreadLocalNativeContextCurrent()
void QRhiD3D11::releaseCachedResources()
{
clearShaderCache();
+ m_bytecodeCache.clear();
}
bool QRhiD3D11::isDeviceLost() const
@@ -524,23 +708,180 @@ bool QRhiD3D11::isDeviceLost() const
return deviceLost;
}
+struct QD3D11PipelineCacheDataHeader
+{
+ quint32 rhiId;
+ quint32 arch;
+ // no need for driver specifics
+ quint32 count;
+ quint32 dataSize;
+};
+
+QByteArray QRhiD3D11::pipelineCacheData()
+{
+ QByteArray data;
+ if (m_bytecodeCache.isEmpty())
+ return data;
+
+ QD3D11PipelineCacheDataHeader header;
+ memset(&header, 0, sizeof(header));
+ header.rhiId = pipelineCacheRhiId();
+ header.arch = quint32(sizeof(void*));
+ header.count = m_bytecodeCache.count();
+
+ const size_t dataOffset = sizeof(header);
+ size_t dataSize = 0;
+ for (auto it = m_bytecodeCache.cbegin(), end = m_bytecodeCache.cend(); it != end; ++it) {
+ BytecodeCacheKey key = it.key();
+ QByteArray bytecode = it.value();
+ dataSize +=
+ sizeof(quint32) + key.sourceHash.size()
+ + sizeof(quint32) + key.target.size()
+ + sizeof(quint32) + key.entryPoint.size()
+ + sizeof(quint32) // compileFlags
+ + sizeof(quint32) + bytecode.size();
+ }
+
+ QByteArray buf(dataOffset + dataSize, Qt::Uninitialized);
+ char *p = buf.data() + dataOffset;
+ for (auto it = m_bytecodeCache.cbegin(), end = m_bytecodeCache.cend(); it != end; ++it) {
+ BytecodeCacheKey key = it.key();
+ QByteArray bytecode = it.value();
+
+ quint32 i = key.sourceHash.size();
+ memcpy(p, &i, 4);
+ p += 4;
+ memcpy(p, key.sourceHash.constData(), key.sourceHash.size());
+ p += key.sourceHash.size();
+
+ i = key.target.size();
+ memcpy(p, &i, 4);
+ p += 4;
+ memcpy(p, key.target.constData(), key.target.size());
+ p += key.target.size();
+
+ i = key.entryPoint.size();
+ memcpy(p, &i, 4);
+ p += 4;
+ memcpy(p, key.entryPoint.constData(), key.entryPoint.size());
+ p += key.entryPoint.size();
+
+ quint32 f = key.compileFlags;
+ memcpy(p, &f, 4);
+ p += 4;
+
+ i = bytecode.size();
+ memcpy(p, &i, 4);
+ p += 4;
+ memcpy(p, bytecode.constData(), bytecode.size());
+ p += bytecode.size();
+ }
+ Q_ASSERT(p == buf.data() + dataOffset + dataSize);
+
+ header.dataSize = quint32(dataSize);
+ memcpy(buf.data(), &header, sizeof(header));
+
+ return buf;
+}
+
+void QRhiD3D11::setPipelineCacheData(const QByteArray &data)
+{
+ if (data.isEmpty())
+ return;
+
+ const size_t headerSize = sizeof(QD3D11PipelineCacheDataHeader);
+ if (data.size() < qsizetype(headerSize)) {
+ qCDebug(QRHI_LOG_INFO, "setPipelineCacheData: Invalid blob size (header incomplete)");
+ return;
+ }
+ const size_t dataOffset = headerSize;
+ QD3D11PipelineCacheDataHeader header;
+ memcpy(&header, data.constData(), headerSize);
+
+ const quint32 rhiId = pipelineCacheRhiId();
+ if (header.rhiId != rhiId) {
+ qCDebug(QRHI_LOG_INFO, "setPipelineCacheData: The data is for a different QRhi version or backend (%u, %u)",
+ rhiId, header.rhiId);
+ return;
+ }
+ const quint32 arch = quint32(sizeof(void*));
+ if (header.arch != arch) {
+ qCDebug(QRHI_LOG_INFO, "setPipelineCacheData: Architecture does not match (%u, %u)",
+ arch, header.arch);
+ return;
+ }
+ if (header.count == 0)
+ return;
+
+ if (data.size() < qsizetype(dataOffset + header.dataSize)) {
+ qCDebug(QRHI_LOG_INFO, "setPipelineCacheData: Invalid blob size (data incomplete)");
+ return;
+ }
+
+ m_bytecodeCache.clear();
+
+ const char *p = data.constData() + dataOffset;
+ for (quint32 i = 0; i < header.count; ++i) {
+ quint32 len = 0;
+ memcpy(&len, p, 4);
+ p += 4;
+ QByteArray sourceHash(len, Qt::Uninitialized);
+ memcpy(sourceHash.data(), p, len);
+ p += len;
+
+ memcpy(&len, p, 4);
+ p += 4;
+ QByteArray target(len, Qt::Uninitialized);
+ memcpy(target.data(), p, len);
+ p += len;
+
+ memcpy(&len, p, 4);
+ p += 4;
+ QByteArray entryPoint(len, Qt::Uninitialized);
+ memcpy(entryPoint.data(), p, len);
+ p += len;
+
+ quint32 flags;
+ memcpy(&flags, p, 4);
+ p += 4;
+
+ memcpy(&len, p, 4);
+ p += 4;
+ QByteArray bytecode(len, Qt::Uninitialized);
+ memcpy(bytecode.data(), p, len);
+ p += len;
+
+ BytecodeCacheKey cacheKey;
+ cacheKey.sourceHash = sourceHash;
+ cacheKey.target = target;
+ cacheKey.entryPoint = entryPoint;
+ cacheKey.compileFlags = flags;
+
+ m_bytecodeCache.insert(cacheKey, bytecode);
+ }
+
+ qCDebug(QRHI_LOG_INFO, "Seeded bytecode cache with %d shaders", int(m_bytecodeCache.count()));
+}
+
QRhiRenderBuffer *QRhiD3D11::createRenderBuffer(QRhiRenderBuffer::Type type, const QSize &pixelSize,
- int sampleCount, QRhiRenderBuffer::Flags flags)
+ int sampleCount, QRhiRenderBuffer::Flags flags,
+ QRhiTexture::Format backingFormatHint)
{
- return new QD3D11RenderBuffer(this, type, pixelSize, sampleCount, flags);
+ return new QD3D11RenderBuffer(this, type, pixelSize, sampleCount, flags, backingFormatHint);
}
-QRhiTexture *QRhiD3D11::createTexture(QRhiTexture::Format format, const QSize &pixelSize,
+QRhiTexture *QRhiD3D11::createTexture(QRhiTexture::Format format,
+ const QSize &pixelSize, int depth, int arraySize,
int sampleCount, QRhiTexture::Flags flags)
{
- return new QD3D11Texture(this, format, pixelSize, sampleCount, flags);
+ return new QD3D11Texture(this, format, pixelSize, depth, arraySize, sampleCount, flags);
}
QRhiSampler *QRhiD3D11::createSampler(QRhiSampler::Filter magFilter, QRhiSampler::Filter minFilter,
QRhiSampler::Filter mipmapMode,
- QRhiSampler::AddressMode u, QRhiSampler::AddressMode v)
+ QRhiSampler::AddressMode u, QRhiSampler::AddressMode v, QRhiSampler::AddressMode w)
{
- return new QD3D11Sampler(this, magFilter, minFilter, mipmapMode, u, v);
+ return new QD3D11Sampler(this, magFilter, minFilter, mipmapMode, u, v, w);
}
QRhiTextureRenderTarget *QRhiD3D11::createTextureRenderTarget(const QRhiTextureRenderTargetDescription &desc,
@@ -576,13 +917,20 @@ void QRhiD3D11::setGraphicsPipeline(QRhiCommandBuffer *cb, QRhiGraphicsPipeline
cbD->currentComputePipeline = nullptr;
cbD->currentPipelineGeneration = psD->generation;
- QD3D11CommandBuffer::Command cmd;
+ QD3D11CommandBuffer::Command &cmd(cbD->commands.get());
cmd.cmd = QD3D11CommandBuffer::Command::BindGraphicsPipeline;
cmd.args.bindGraphicsPipeline.ps = psD;
- cbD->commands.append(cmd);
}
}
+static const int RBM_SUPPORTED_STAGES = 6;
+static const int RBM_VERTEX = 0;
+static const int RBM_HULL = 1;
+static const int RBM_DOMAIN = 2;
+static const int RBM_GEOMETRY = 3;
+static const int RBM_FRAGMENT = 4;
+static const int RBM_COMPUTE = 5;
+
void QRhiD3D11::setShaderResources(QRhiCommandBuffer *cb, QRhiShaderResourceBindings *srb,
int dynamicOffsetCount,
const QRhiCommandBuffer::DynamicOffset *dynamicOffsets)
@@ -601,49 +949,62 @@ void QRhiD3D11::setShaderResources(QRhiCommandBuffer *cb, QRhiShaderResourceBind
QD3D11ShaderResourceBindings *srbD = QRHI_RES(QD3D11ShaderResourceBindings, srb);
- bool hasDynamicOffsetInSrb = false;
bool srbUpdate = false;
for (int i = 0, ie = srbD->sortedBindings.count(); i != ie; ++i) {
- const QRhiShaderResourceBinding::Data *b = srbD->sortedBindings.at(i).data();
+ const QRhiShaderResourceBinding::Data *b = shaderResourceBindingData(srbD->sortedBindings.at(i));
QD3D11ShaderResourceBindings::BoundResourceData &bd(srbD->boundResourceData[i]);
switch (b->type) {
case QRhiShaderResourceBinding::UniformBuffer:
{
QD3D11Buffer *bufD = QRHI_RES(QD3D11Buffer, b->u.ubuf.buf);
- if (bufD->m_type == QRhiBuffer::Dynamic)
- executeBufferHostWritesForCurrentFrame(bufD);
+ // NonDynamicUniformBuffers is not supported by this backend
+ Q_ASSERT(bufD->m_type == QRhiBuffer::Dynamic && bufD->m_usage.testFlag(QRhiBuffer::UniformBuffer));
+
+ executeBufferHostWrites(bufD);
if (bufD->generation != bd.ubuf.generation || bufD->m_id != bd.ubuf.id) {
srbUpdate = true;
bd.ubuf.id = bufD->m_id;
bd.ubuf.generation = bufD->generation;
}
-
- if (b->u.ubuf.hasDynamicOffset)
- hasDynamicOffsetInSrb = true;
}
break;
case QRhiShaderResourceBinding::SampledTexture:
+ case QRhiShaderResourceBinding::Texture:
+ case QRhiShaderResourceBinding::Sampler:
{
- QD3D11Texture *texD = QRHI_RES(QD3D11Texture, b->u.stex.tex);
- QD3D11Sampler *samplerD = QRHI_RES(QD3D11Sampler, b->u.stex.sampler);
- if (texD->generation != bd.stex.texGeneration
- || texD->m_id != bd.stex.texId
- || samplerD->generation != bd.stex.samplerGeneration
- || samplerD->m_id != bd.stex.samplerId)
- {
+ const QRhiShaderResourceBinding::Data::TextureAndOrSamplerData *data = &b->u.stex;
+ if (bd.stex.count != data->count) {
+ bd.stex.count = data->count;
srbUpdate = true;
- bd.stex.texId = texD->m_id;
- bd.stex.texGeneration = texD->generation;
- bd.stex.samplerId = samplerD->m_id;
- bd.stex.samplerGeneration = samplerD->generation;
+ }
+ for (int elem = 0; elem < data->count; ++elem) {
+ QD3D11Texture *texD = QRHI_RES(QD3D11Texture, data->texSamplers[elem].tex);
+ QD3D11Sampler *samplerD = QRHI_RES(QD3D11Sampler, data->texSamplers[elem].sampler);
+ // We use the same code path for both combined and separate
+ // images and samplers, so tex or sampler (but not both) can be
+ // null here.
+ Q_ASSERT(texD || samplerD);
+ const quint64 texId = texD ? texD->m_id : 0;
+ const uint texGen = texD ? texD->generation : 0;
+ const quint64 samplerId = samplerD ? samplerD->m_id : 0;
+ const uint samplerGen = samplerD ? samplerD->generation : 0;
+ if (texGen != bd.stex.d[elem].texGeneration
+ || texId != bd.stex.d[elem].texId
+ || samplerGen != bd.stex.d[elem].samplerGeneration
+ || samplerId != bd.stex.d[elem].samplerId)
+ {
+ srbUpdate = true;
+ bd.stex.d[elem].texId = texId;
+ bd.stex.d[elem].texGeneration = texGen;
+ bd.stex.d[elem].samplerId = samplerId;
+ bd.stex.d[elem].samplerGeneration = samplerGen;
+ }
}
}
break;
case QRhiShaderResourceBinding::ImageLoad:
- Q_FALLTHROUGH();
case QRhiShaderResourceBinding::ImageStore:
- Q_FALLTHROUGH();
case QRhiShaderResourceBinding::ImageLoadStore:
{
QD3D11Texture *texD = QRHI_RES(QD3D11Texture, b->u.simage.tex);
@@ -655,9 +1016,7 @@ void QRhiD3D11::setShaderResources(QRhiCommandBuffer *cb, QRhiShaderResourceBind
}
break;
case QRhiShaderResourceBinding::BufferLoad:
- Q_FALLTHROUGH();
case QRhiShaderResourceBinding::BufferStore:
- Q_FALLTHROUGH();
case QRhiShaderResourceBinding::BufferLoadStore:
{
QD3D11Buffer *bufD = QRHI_RES(QD3D11Buffer, b->u.sbuf.buf);
@@ -674,13 +1033,25 @@ void QRhiD3D11::setShaderResources(QRhiCommandBuffer *cb, QRhiShaderResourceBind
}
}
- if (srbUpdate)
- updateShaderResourceBindings(srbD);
+ if (srbUpdate) {
+ const QShader::NativeResourceBindingMap *resBindMaps[RBM_SUPPORTED_STAGES];
+ memset(resBindMaps, 0, sizeof(resBindMaps));
+ if (gfxPsD) {
+ resBindMaps[RBM_VERTEX] = &gfxPsD->vs.nativeResourceBindingMap;
+ resBindMaps[RBM_HULL] = &gfxPsD->hs.nativeResourceBindingMap;
+ resBindMaps[RBM_DOMAIN] = &gfxPsD->ds.nativeResourceBindingMap;
+ resBindMaps[RBM_GEOMETRY] = &gfxPsD->gs.nativeResourceBindingMap;
+ resBindMaps[RBM_FRAGMENT] = &gfxPsD->fs.nativeResourceBindingMap;
+ } else {
+ resBindMaps[RBM_COMPUTE] = &compPsD->cs.nativeResourceBindingMap;
+ }
+ updateShaderResourceBindings(srbD, resBindMaps);
+ }
const bool srbChanged = gfxPsD ? (cbD->currentGraphicsSrb != srb) : (cbD->currentComputeSrb != srb);
const bool srbRebuilt = cbD->currentSrbGeneration != srbD->generation;
- if (srbChanged || srbRebuilt || srbUpdate || hasDynamicOffsetInSrb) {
+ if (srbChanged || srbRebuilt || srbUpdate || srbD->hasDynamicOffset) {
if (gfxPsD) {
cbD->currentGraphicsSrb = srb;
cbD->currentComputeSrb = nullptr;
@@ -690,32 +1061,30 @@ void QRhiD3D11::setShaderResources(QRhiCommandBuffer *cb, QRhiShaderResourceBind
}
cbD->currentSrbGeneration = srbD->generation;
- QD3D11CommandBuffer::Command cmd;
+ QD3D11CommandBuffer::Command &cmd(cbD->commands.get());
cmd.cmd = QD3D11CommandBuffer::Command::BindShaderResources;
cmd.args.bindShaderResources.srb = srbD;
// dynamic offsets have to be applied at the time of executing the bind
// operations, not here
- cmd.args.bindShaderResources.offsetOnlyChange = !srbChanged && !srbRebuilt && !srbUpdate && hasDynamicOffsetInSrb;
+ cmd.args.bindShaderResources.offsetOnlyChange = !srbChanged && !srbRebuilt && !srbUpdate && srbD->hasDynamicOffset;
cmd.args.bindShaderResources.dynamicOffsetCount = 0;
- if (hasDynamicOffsetInSrb) {
- if (dynamicOffsetCount < QD3D11CommandBuffer::Command::MAX_UBUF_BINDINGS) {
+ if (srbD->hasDynamicOffset) {
+ if (dynamicOffsetCount < QD3D11CommandBuffer::MAX_DYNAMIC_OFFSET_COUNT) {
cmd.args.bindShaderResources.dynamicOffsetCount = dynamicOffsetCount;
uint *p = cmd.args.bindShaderResources.dynamicOffsetPairs;
for (int i = 0; i < dynamicOffsetCount; ++i) {
const QRhiCommandBuffer::DynamicOffset &dynOfs(dynamicOffsets[i]);
const uint binding = uint(dynOfs.first);
- Q_ASSERT(aligned(dynOfs.second, quint32(256)) == dynOfs.second);
- const uint offsetInConstants = dynOfs.second / 16;
+ Q_ASSERT(aligned(dynOfs.second, 256u) == dynOfs.second);
+ const quint32 offsetInConstants = dynOfs.second / 16;
*p++ = binding;
*p++ = offsetInConstants;
}
} else {
qWarning("Too many dynamic offsets (%d, max is %d)",
- dynamicOffsetCount, QD3D11CommandBuffer::Command::MAX_UBUF_BINDINGS);
+ dynamicOffsetCount, QD3D11CommandBuffer::MAX_DYNAMIC_OFFSET_COUNT);
}
}
-
- cbD->commands.append(cmd);
}
}
@@ -732,7 +1101,7 @@ void QRhiD3D11::setVertexInput(QRhiCommandBuffer *cb,
QD3D11Buffer *bufD = QRHI_RES(QD3D11Buffer, bindings[i].first);
Q_ASSERT(bufD->m_usage.testFlag(QRhiBuffer::VertexBuffer));
if (bufD->m_type == QRhiBuffer::Dynamic)
- executeBufferHostWritesForCurrentFrame(bufD);
+ executeBufferHostWrites(bufD);
if (cbD->currentVertexBuffers[inputSlot] != bufD->buffer
|| cbD->currentVertexOffsets[inputSlot] != bindings[i].second)
@@ -744,9 +1113,14 @@ void QRhiD3D11::setVertexInput(QRhiCommandBuffer *cb,
}
if (needsBindVBuf) {
- QD3D11CommandBuffer::Command cmd;
+ QD3D11CommandBuffer::Command &cmd(cbD->commands.get());
cmd.cmd = QD3D11CommandBuffer::Command::BindVertexBuffers;
cmd.args.bindVertexBuffers.startSlot = startBinding;
+ if (bindingCount > QD3D11CommandBuffer::MAX_VERTEX_BUFFER_BINDING_COUNT) {
+ qWarning("Too many vertex buffer bindings (%d, max is %d)",
+ bindingCount, QD3D11CommandBuffer::MAX_VERTEX_BUFFER_BINDING_COUNT);
+ bindingCount = QD3D11CommandBuffer::MAX_VERTEX_BUFFER_BINDING_COUNT;
+ }
cmd.args.bindVertexBuffers.slotCount = bindingCount;
QD3D11GraphicsPipeline *psD = QRHI_RES(QD3D11GraphicsPipeline, cbD->currentGraphicsPipeline);
const QRhiVertexInputLayout &inputLayout(psD->m_vertexInputLayout);
@@ -757,14 +1131,13 @@ void QRhiD3D11::setVertexInput(QRhiCommandBuffer *cb,
cmd.args.bindVertexBuffers.offsets[i] = bindings[i].second;
cmd.args.bindVertexBuffers.strides[i] = inputLayout.bindingAt(i)->stride();
}
- cbD->commands.append(cmd);
}
if (indexBuf) {
QD3D11Buffer *ibufD = QRHI_RES(QD3D11Buffer, indexBuf);
Q_ASSERT(ibufD->m_usage.testFlag(QRhiBuffer::IndexBuffer));
if (ibufD->m_type == QRhiBuffer::Dynamic)
- executeBufferHostWritesForCurrentFrame(ibufD);
+ executeBufferHostWrites(ibufD);
const DXGI_FORMAT dxgiFormat = indexFormat == QRhiCommandBuffer::IndexUInt16 ? DXGI_FORMAT_R16_UINT
: DXGI_FORMAT_R32_UINT;
@@ -776,12 +1149,11 @@ void QRhiD3D11::setVertexInput(QRhiCommandBuffer *cb,
cbD->currentIndexOffset = indexOffset;
cbD->currentIndexFormat = dxgiFormat;
- QD3D11CommandBuffer::Command cmd;
+ QD3D11CommandBuffer::Command &cmd(cbD->commands.get());
cmd.cmd = QD3D11CommandBuffer::Command::BindIndexBuffer;
cmd.args.bindIndexBuffer.buffer = ibufD->buffer;
cmd.args.bindIndexBuffer.offset = indexOffset;
cmd.args.bindIndexBuffer.format = dxgiFormat;
- cbD->commands.append(cmd);
}
}
}
@@ -793,21 +1165,19 @@ void QRhiD3D11::setViewport(QRhiCommandBuffer *cb, const QRhiViewport &viewport)
Q_ASSERT(cbD->currentTarget);
const QSize outputSize = cbD->currentTarget->pixelSize();
- QD3D11CommandBuffer::Command cmd;
- cmd.cmd = QD3D11CommandBuffer::Command::Viewport;
-
// d3d expects top-left, QRhiViewport is bottom-left
float x, y, w, h;
- if (!qrhi_toTopLeftRenderTargetRect(outputSize, viewport.viewport(), &x, &y, &w, &h))
+ if (!qrhi_toTopLeftRenderTargetRect<UnBounded>(outputSize, viewport.viewport(), &x, &y, &w, &h))
return;
+ QD3D11CommandBuffer::Command &cmd(cbD->commands.get());
+ cmd.cmd = QD3D11CommandBuffer::Command::Viewport;
cmd.args.viewport.x = x;
cmd.args.viewport.y = y;
cmd.args.viewport.w = w;
cmd.args.viewport.h = h;
cmd.args.viewport.d0 = viewport.minDepth();
cmd.args.viewport.d1 = viewport.maxDepth();
- cbD->commands.append(cmd);
}
void QRhiD3D11::setScissor(QRhiCommandBuffer *cb, const QRhiScissor &scissor)
@@ -817,19 +1187,17 @@ void QRhiD3D11::setScissor(QRhiCommandBuffer *cb, const QRhiScissor &scissor)
Q_ASSERT(cbD->currentTarget);
const QSize outputSize = cbD->currentTarget->pixelSize();
- QD3D11CommandBuffer::Command cmd;
- cmd.cmd = QD3D11CommandBuffer::Command::Scissor;
-
// d3d expects top-left, QRhiScissor is bottom-left
int x, y, w, h;
- if (!qrhi_toTopLeftRenderTargetRect(outputSize, scissor.scissor(), &x, &y, &w, &h))
+ if (!qrhi_toTopLeftRenderTargetRect<Bounded>(outputSize, scissor.scissor(), &x, &y, &w, &h))
return;
+ QD3D11CommandBuffer::Command &cmd(cbD->commands.get());
+ cmd.cmd = QD3D11CommandBuffer::Command::Scissor;
cmd.args.scissor.x = x;
cmd.args.scissor.y = y;
cmd.args.scissor.w = w;
cmd.args.scissor.h = h;
- cbD->commands.append(cmd);
}
void QRhiD3D11::setBlendConstants(QRhiCommandBuffer *cb, const QColor &c)
@@ -837,14 +1205,13 @@ void QRhiD3D11::setBlendConstants(QRhiCommandBuffer *cb, const QColor &c)
QD3D11CommandBuffer *cbD = QRHI_RES(QD3D11CommandBuffer, cb);
Q_ASSERT(cbD->recordingPass == QD3D11CommandBuffer::RenderPass);
- QD3D11CommandBuffer::Command cmd;
+ QD3D11CommandBuffer::Command &cmd(cbD->commands.get());
cmd.cmd = QD3D11CommandBuffer::Command::BlendConstants;
cmd.args.blendConstants.ps = QRHI_RES(QD3D11GraphicsPipeline, cbD->currentGraphicsPipeline);
cmd.args.blendConstants.c[0] = float(c.redF());
cmd.args.blendConstants.c[1] = float(c.greenF());
cmd.args.blendConstants.c[2] = float(c.blueF());
cmd.args.blendConstants.c[3] = float(c.alphaF());
- cbD->commands.append(cmd);
}
void QRhiD3D11::setStencilRef(QRhiCommandBuffer *cb, quint32 refValue)
@@ -852,11 +1219,10 @@ void QRhiD3D11::setStencilRef(QRhiCommandBuffer *cb, quint32 refValue)
QD3D11CommandBuffer *cbD = QRHI_RES(QD3D11CommandBuffer, cb);
Q_ASSERT(cbD->recordingPass == QD3D11CommandBuffer::RenderPass);
- QD3D11CommandBuffer::Command cmd;
+ QD3D11CommandBuffer::Command &cmd(cbD->commands.get());
cmd.cmd = QD3D11CommandBuffer::Command::StencilRef;
cmd.args.stencilRef.ps = QRHI_RES(QD3D11GraphicsPipeline, cbD->currentGraphicsPipeline);
cmd.args.stencilRef.ref = refValue;
- cbD->commands.append(cmd);
}
void QRhiD3D11::draw(QRhiCommandBuffer *cb, quint32 vertexCount,
@@ -865,14 +1231,13 @@ void QRhiD3D11::draw(QRhiCommandBuffer *cb, quint32 vertexCount,
QD3D11CommandBuffer *cbD = QRHI_RES(QD3D11CommandBuffer, cb);
Q_ASSERT(cbD->recordingPass == QD3D11CommandBuffer::RenderPass);
- QD3D11CommandBuffer::Command cmd;
+ QD3D11CommandBuffer::Command &cmd(cbD->commands.get());
cmd.cmd = QD3D11CommandBuffer::Command::Draw;
cmd.args.draw.ps = QRHI_RES(QD3D11GraphicsPipeline, cbD->currentGraphicsPipeline);
cmd.args.draw.vertexCount = vertexCount;
cmd.args.draw.instanceCount = instanceCount;
cmd.args.draw.firstVertex = firstVertex;
cmd.args.draw.firstInstance = firstInstance;
- cbD->commands.append(cmd);
}
void QRhiD3D11::drawIndexed(QRhiCommandBuffer *cb, quint32 indexCount,
@@ -881,7 +1246,7 @@ void QRhiD3D11::drawIndexed(QRhiCommandBuffer *cb, quint32 indexCount,
QD3D11CommandBuffer *cbD = QRHI_RES(QD3D11CommandBuffer, cb);
Q_ASSERT(cbD->recordingPass == QD3D11CommandBuffer::RenderPass);
- QD3D11CommandBuffer::Command cmd;
+ QD3D11CommandBuffer::Command &cmd(cbD->commands.get());
cmd.cmd = QD3D11CommandBuffer::Command::DrawIndexed;
cmd.args.drawIndexed.ps = QRHI_RES(QD3D11GraphicsPipeline, cbD->currentGraphicsPipeline);
cmd.args.drawIndexed.indexCount = indexCount;
@@ -889,7 +1254,6 @@ void QRhiD3D11::drawIndexed(QRhiCommandBuffer *cb, quint32 indexCount,
cmd.args.drawIndexed.firstIndex = firstIndex;
cmd.args.drawIndexed.vertexOffset = vertexOffset;
cmd.args.drawIndexed.firstInstance = firstInstance;
- cbD->commands.append(cmd);
}
void QRhiD3D11::debugMarkBegin(QRhiCommandBuffer *cb, const QByteArray &name)
@@ -898,11 +1262,9 @@ void QRhiD3D11::debugMarkBegin(QRhiCommandBuffer *cb, const QByteArray &name)
return;
QD3D11CommandBuffer *cbD = QRHI_RES(QD3D11CommandBuffer, cb);
- QD3D11CommandBuffer::Command cmd;
+ QD3D11CommandBuffer::Command &cmd(cbD->commands.get());
cmd.cmd = QD3D11CommandBuffer::Command::DebugMarkBegin;
- strncpy(cmd.args.debugMark.s, name.constData(), sizeof(cmd.args.debugMark.s));
- cmd.args.debugMark.s[sizeof(cmd.args.debugMark.s) - 1] = '\0';
- cbD->commands.append(cmd);
+ qstrncpy(cmd.args.debugMark.s, name.constData(), sizeof(cmd.args.debugMark.s));
}
void QRhiD3D11::debugMarkEnd(QRhiCommandBuffer *cb)
@@ -911,9 +1273,8 @@ void QRhiD3D11::debugMarkEnd(QRhiCommandBuffer *cb)
return;
QD3D11CommandBuffer *cbD = QRHI_RES(QD3D11CommandBuffer, cb);
- QD3D11CommandBuffer::Command cmd;
+ QD3D11CommandBuffer::Command &cmd(cbD->commands.get());
cmd.cmd = QD3D11CommandBuffer::Command::DebugMarkEnd;
- cbD->commands.append(cmd);
}
void QRhiD3D11::debugMarkMsg(QRhiCommandBuffer *cb, const QByteArray &msg)
@@ -922,11 +1283,9 @@ void QRhiD3D11::debugMarkMsg(QRhiCommandBuffer *cb, const QByteArray &msg)
return;
QD3D11CommandBuffer *cbD = QRHI_RES(QD3D11CommandBuffer, cb);
- QD3D11CommandBuffer::Command cmd;
+ QD3D11CommandBuffer::Command &cmd(cbD->commands.get());
cmd.cmd = QD3D11CommandBuffer::Command::DebugMarkMsg;
- strncpy(cmd.args.debugMark.s, msg.constData(), sizeof(cmd.args.debugMark.s));
- cmd.args.debugMark.s[sizeof(cmd.args.debugMark.s) - 1] = '\0';
- cbD->commands.append(cmd);
+ qstrncpy(cmd.args.debugMark.s, msg.constData(), sizeof(cmd.args.debugMark.s));
}
const QRhiNativeHandles *QRhiD3D11::nativeHandles(QRhiCommandBuffer *cb)
@@ -938,7 +1297,6 @@ const QRhiNativeHandles *QRhiD3D11::nativeHandles(QRhiCommandBuffer *cb)
void QRhiD3D11::beginExternal(QRhiCommandBuffer *cb)
{
QD3D11CommandBuffer *cbD = QRHI_RES(QD3D11CommandBuffer, cb);
- // no timestampSwapChain, in order to avoid timestamp mess
executeCommandBuffer(cbD);
cbD->resetCommands();
}
@@ -949,10 +1307,28 @@ void QRhiD3D11::endExternal(QRhiCommandBuffer *cb)
Q_ASSERT(cbD->commands.isEmpty());
cbD->resetCachedState();
if (cbD->currentTarget) { // could be compute, no rendertarget then
- QD3D11CommandBuffer::Command fbCmd;
+ QD3D11CommandBuffer::Command &fbCmd(cbD->commands.get());
fbCmd.cmd = QD3D11CommandBuffer::Command::SetRenderTarget;
fbCmd.args.setRenderTarget.rt = cbD->currentTarget;
- cbD->commands.append(fbCmd);
+ }
+}
+
+double QRhiD3D11::lastCompletedGpuTime(QRhiCommandBuffer *cb)
+{
+ QD3D11CommandBuffer *cbD = QRHI_RES(QD3D11CommandBuffer, cb);
+ return cbD->lastGpuTime;
+}
+
+static inline QD3D11RenderTargetData *rtData(QRhiRenderTarget *rt)
+{
+ switch (rt->resourceType()) {
+ case QRhiResource::SwapChainRenderTarget:
+ return &QRHI_RES(QD3D11SwapChainRenderTarget, rt)->d;
+ case QRhiResource::TextureRenderTarget:
+ return &QRHI_RES(QD3D11TextureRenderTarget, rt)->d;
+ default:
+ Q_UNREACHABLE();
+ return nullptr;
}
}
@@ -963,32 +1339,6 @@ QRhi::FrameOpResult QRhiD3D11::beginFrame(QRhiSwapChain *swapChain, QRhi::BeginF
QD3D11SwapChain *swapChainD = QRHI_RES(QD3D11SwapChain, swapChain);
contextState.currentSwapChain = swapChainD;
const int currentFrameSlot = swapChainD->currentFrameSlot;
- QRhiProfilerPrivate *rhiP = profilerPrivateOrNull();
-
- if (swapChainD->timestampActive[currentFrameSlot]) {
- ID3D11Query *tsDisjoint = swapChainD->timestampDisjointQuery[currentFrameSlot];
- const int tsIdx = QD3D11SwapChain::BUFFER_COUNT * currentFrameSlot;
- ID3D11Query *tsStart = swapChainD->timestampQuery[tsIdx];
- ID3D11Query *tsEnd = swapChainD->timestampQuery[tsIdx + 1];
- quint64 timestamps[2];
- D3D11_QUERY_DATA_TIMESTAMP_DISJOINT dj;
- bool ok = true;
- ok &= context->GetData(tsDisjoint, &dj, sizeof(dj), D3D11_ASYNC_GETDATA_DONOTFLUSH) == S_OK;
- ok &= context->GetData(tsEnd, &timestamps[1], sizeof(quint64), D3D11_ASYNC_GETDATA_DONOTFLUSH) == S_OK;
- // this above is often not ready, not even in frame_where_recorded+2,
- // not clear why. so make the whole thing async and do not touch the
- // queries until they are finally all available in frame this+2 or
- // this+4 or ...
- ok &= context->GetData(tsStart, &timestamps[0], sizeof(quint64), D3D11_ASYNC_GETDATA_DONOTFLUSH) == S_OK;
- if (ok) {
- if (!dj.Disjoint && dj.Frequency) {
- const float elapsedMs = (timestamps[1] - timestamps[0]) / float(dj.Frequency) * 1000.0f;
- // finally got a value, just report it, the profiler cares about min/max/avg anyway
- QRHI_PROF_F(swapChainFrameGpuTime(swapChain, elapsedMs));
- }
- swapChainD->timestampActive[currentFrameSlot] = false;
- } // else leave timestampActive set to true, will retry in a subsequent beginFrame
- }
swapChainD->cb.resetState();
@@ -996,10 +1346,24 @@ QRhi::FrameOpResult QRhiD3D11::beginFrame(QRhiSwapChain *swapChain, QRhi::BeginF
swapChainD->msaaRtv[currentFrameSlot] : swapChainD->backBufferRtv;
swapChainD->rt.d.dsv = swapChainD->ds ? swapChainD->ds->dsv : nullptr;
- QRHI_PROF_F(beginSwapChainFrame(swapChain));
-
finishActiveReadbacks();
+ if (swapChainD->timestamps.active[swapChainD->currentTimestampPairIndex]) {
+ double elapsedSec = 0;
+ if (swapChainD->timestamps.tryQueryTimestamps(swapChainD->currentTimestampPairIndex, context, &elapsedSec))
+ swapChainD->cb.lastGpuTime = elapsedSec;
+ }
+
+ ID3D11Query *tsStart = swapChainD->timestamps.query[swapChainD->currentTimestampPairIndex * 2];
+ ID3D11Query *tsDisjoint = swapChainD->timestamps.disjointQuery[swapChainD->currentTimestampPairIndex];
+ const bool recordTimestamps = tsStart && tsDisjoint && !swapChainD->timestamps.active[swapChainD->currentTimestampPairIndex];
+
+ QD3D11CommandBuffer::Command &cmd(swapChainD->cb.commands.get());
+ cmd.cmd = QD3D11CommandBuffer::Command::BeginFrame;
+ cmd.args.beginFrame.tsQuery = recordTimestamps ? tsStart : nullptr;
+ cmd.args.beginFrame.tsDisjointQuery = recordTimestamps ? tsDisjoint : nullptr;
+ cmd.args.beginFrame.swapchainData = rtData(&swapChainD->rt);
+
return QRhi::FrameOpSuccess;
}
@@ -1009,17 +1373,13 @@ QRhi::FrameOpResult QRhiD3D11::endFrame(QRhiSwapChain *swapChain, QRhi::EndFrame
Q_ASSERT(contextState.currentSwapChain = swapChainD);
const int currentFrameSlot = swapChainD->currentFrameSlot;
- ID3D11Query *tsDisjoint = swapChainD->timestampDisjointQuery[currentFrameSlot];
- const int tsIdx = QD3D11SwapChain::BUFFER_COUNT * currentFrameSlot;
- ID3D11Query *tsStart = swapChainD->timestampQuery[tsIdx];
- ID3D11Query *tsEnd = swapChainD->timestampQuery[tsIdx + 1];
- const bool recordTimestamps = tsDisjoint && tsStart && tsEnd && !swapChainD->timestampActive[currentFrameSlot];
+ QD3D11CommandBuffer::Command &cmd(swapChainD->cb.commands.get());
+ cmd.cmd = QD3D11CommandBuffer::Command::EndFrame;
+ cmd.args.endFrame.tsQuery = nullptr; // done later manually, see below
+ cmd.args.endFrame.tsDisjointQuery = nullptr;
// send all commands to the context
- if (recordTimestamps)
- executeCommandBuffer(&swapChainD->cb, swapChainD);
- else
- executeCommandBuffer(&swapChainD->cb);
+ executeCommandBuffer(&swapChainD->cb);
if (swapChainD->sampleDesc.Count > 1) {
context->ResolveSubresource(swapChainD->backBufferTex, 0,
@@ -1027,29 +1387,39 @@ QRhi::FrameOpResult QRhiD3D11::endFrame(QRhiSwapChain *swapChain, QRhi::EndFrame
swapChainD->colorFormat);
}
- // this is here because we want to include the time spent on the resolve as well
+ // this is here because we want to include the time spent on the ResolveSubresource as well
+ ID3D11Query *tsEnd = swapChainD->timestamps.query[swapChainD->currentTimestampPairIndex * 2 + 1];
+ ID3D11Query *tsDisjoint = swapChainD->timestamps.disjointQuery[swapChainD->currentTimestampPairIndex];
+ const bool recordTimestamps = tsEnd && tsDisjoint && !swapChainD->timestamps.active[swapChainD->currentTimestampPairIndex];
if (recordTimestamps) {
context->End(tsEnd);
context->End(tsDisjoint);
- swapChainD->timestampActive[currentFrameSlot] = true;
+ swapChainD->timestamps.active[swapChainD->currentTimestampPairIndex] = true;
+ swapChainD->currentTimestampPairIndex = (swapChainD->currentTimestampPairIndex + 1) % QD3D11SwapChainTimestamps::TIMESTAMP_PAIRS;
}
- QRhiProfilerPrivate *rhiP = profilerPrivateOrNull();
- // this must be done before the Present
- QRHI_PROF_F(endSwapChainFrame(swapChain, swapChainD->frameCount + 1));
-
if (!flags.testFlag(QRhi::SkipPresent)) {
- const UINT presentFlags = 0;
+ UINT presentFlags = 0;
+ if (swapChainD->swapInterval == 0 && (swapChainD->swapChainFlags & DXGI_SWAP_CHAIN_FLAG_ALLOW_TEARING))
+ presentFlags |= DXGI_PRESENT_ALLOW_TEARING;
+ if (!swapChainD->swapChain) {
+ qWarning("Failed to present: IDXGISwapChain is unavailable");
+ return QRhi::FrameOpError;
+ }
HRESULT hr = swapChainD->swapChain->Present(swapChainD->swapInterval, presentFlags);
if (hr == DXGI_ERROR_DEVICE_REMOVED || hr == DXGI_ERROR_DEVICE_RESET) {
qWarning("Device loss detected in Present()");
deviceLost = true;
return QRhi::FrameOpDeviceLost;
} else if (FAILED(hr)) {
- qWarning("Failed to present: %s", qPrintable(comErrorMessage(hr)));
+ qWarning("Failed to present: %s",
+ qPrintable(QSystemError::windowsComString(hr)));
return QRhi::FrameOpError;
}
+ if (dcompDevice && swapChainD->dcompTarget && swapChainD->dcompVisual)
+ dcompDevice->Commit();
+
// move on to the next buffer
swapChainD->currentFrameSlot = (swapChainD->currentFrameSlot + 1) % QD3D11SwapChain::BUFFER_COUNT;
} else {
@@ -1059,19 +1429,6 @@ QRhi::FrameOpResult QRhiD3D11::endFrame(QRhiSwapChain *swapChain, QRhi::EndFrame
swapChainD->frameCount += 1;
contextState.currentSwapChain = nullptr;
- if (deviceCurse.framesToActivate > 0) {
- deviceCurse.framesLeft -= 1;
- if (deviceCurse.framesLeft == 0) {
- deviceCurse.framesLeft = deviceCurse.framesToActivate;
- if (!deviceCurse.permanent)
- deviceCurse.framesToActivate = -1;
-
- deviceCurse.activate();
- } else if (deviceCurse.framesLeft % 100 == 0) {
- qDebug("Impending doom: %d frames left", deviceCurse.framesLeft);
- }
- }
-
return QRhi::FrameOpSuccess;
}
@@ -1083,6 +1440,36 @@ QRhi::FrameOpResult QRhiD3D11::beginOffscreenFrame(QRhiCommandBuffer **cb, QRhi:
ofr.cbWrapper.resetState();
*cb = &ofr.cbWrapper;
+ if (rhiFlags.testFlag(QRhi::EnableTimestamps)) {
+ D3D11_QUERY_DESC queryDesc = {};
+ if (!ofr.tsDisjointQuery) {
+ queryDesc.Query = D3D11_QUERY_TIMESTAMP_DISJOINT;
+ HRESULT hr = dev->CreateQuery(&queryDesc, &ofr.tsDisjointQuery);
+ if (FAILED(hr)) {
+ qWarning("Failed to create timestamp disjoint query: %s",
+ qPrintable(QSystemError::windowsComString(hr)));
+ return QRhi::FrameOpError;
+ }
+ }
+ queryDesc.Query = D3D11_QUERY_TIMESTAMP;
+ for (int i = 0; i < 2; ++i) {
+ if (!ofr.tsQueries[i]) {
+ HRESULT hr = dev->CreateQuery(&queryDesc, &ofr.tsQueries[i]);
+ if (FAILED(hr)) {
+ qWarning("Failed to create timestamp query: %s",
+ qPrintable(QSystemError::windowsComString(hr)));
+ return QRhi::FrameOpError;
+ }
+ }
+ }
+ }
+
+ QD3D11CommandBuffer::Command &cmd(ofr.cbWrapper.commands.get());
+ cmd.cmd = QD3D11CommandBuffer::Command::BeginFrame;
+ cmd.args.beginFrame.tsQuery = ofr.tsQueries[0] ? ofr.tsQueries[0] : nullptr;
+ cmd.args.beginFrame.tsDisjointQuery = ofr.tsDisjointQuery ? ofr.tsDisjointQuery : nullptr;
+ cmd.args.beginFrame.swapchainData = nullptr;
+
return QRhi::FrameOpSuccess;
}
@@ -1091,10 +1478,41 @@ QRhi::FrameOpResult QRhiD3D11::endOffscreenFrame(QRhi::EndFrameFlags flags)
Q_UNUSED(flags);
ofr.active = false;
+ QD3D11CommandBuffer::Command &cmd(ofr.cbWrapper.commands.get());
+ cmd.cmd = QD3D11CommandBuffer::Command::EndFrame;
+ cmd.args.endFrame.tsQuery = ofr.tsQueries[1] ? ofr.tsQueries[1] : nullptr;
+ cmd.args.endFrame.tsDisjointQuery = ofr.tsDisjointQuery ? ofr.tsDisjointQuery : nullptr;
+
executeCommandBuffer(&ofr.cbWrapper);
+ context->Flush();
finishActiveReadbacks();
+ if (ofr.tsQueries[0]) {
+ quint64 timestamps[2];
+ D3D11_QUERY_DATA_TIMESTAMP_DISJOINT dj;
+ HRESULT hr;
+ bool ok = true;
+ do {
+ hr = context->GetData(ofr.tsDisjointQuery, &dj, sizeof(dj), 0);
+ } while (hr == S_FALSE);
+ ok &= hr == S_OK;
+ do {
+ hr = context->GetData(ofr.tsQueries[1], &timestamps[1], sizeof(quint64), 0);
+ } while (hr == S_FALSE);
+ ok &= hr == S_OK;
+ do {
+ hr = context->GetData(ofr.tsQueries[0], &timestamps[0], sizeof(quint64), 0);
+ } while (hr == S_FALSE);
+ ok &= hr == S_OK;
+ if (ok) {
+ if (!dj.Disjoint && dj.Frequency) {
+ const float elapsedMs = (timestamps[1] - timestamps[0]) / float(dj.Frequency) * 1000.0f;
+ ofr.cbWrapper.lastGpuTime = elapsedMs / 1000.0;
+ }
+ }
+ }
+
return QRhi::FrameOpSuccess;
}
@@ -1108,8 +1526,12 @@ static inline DXGI_FORMAT toD3DTextureFormat(QRhiTexture::Format format, QRhiTex
return srgb ? DXGI_FORMAT_B8G8R8A8_UNORM_SRGB : DXGI_FORMAT_B8G8R8A8_UNORM;
case QRhiTexture::R8:
return DXGI_FORMAT_R8_UNORM;
+ case QRhiTexture::RG8:
+ return DXGI_FORMAT_R8G8_UNORM;
case QRhiTexture::R16:
return DXGI_FORMAT_R16_UNORM;
+ case QRhiTexture::RG16:
+ return DXGI_FORMAT_R16G16_UNORM;
case QRhiTexture::RED_OR_ALPHA8:
return DXGI_FORMAT_R8_UNORM;
@@ -1117,9 +1539,20 @@ static inline DXGI_FORMAT toD3DTextureFormat(QRhiTexture::Format format, QRhiTex
return DXGI_FORMAT_R16G16B16A16_FLOAT;
case QRhiTexture::RGBA32F:
return DXGI_FORMAT_R32G32B32A32_FLOAT;
+ case QRhiTexture::R16F:
+ return DXGI_FORMAT_R16_FLOAT;
+ case QRhiTexture::R32F:
+ return DXGI_FORMAT_R32_FLOAT;
+
+ case QRhiTexture::RGB10A2:
+ return DXGI_FORMAT_R10G10B10A2_UNORM;
case QRhiTexture::D16:
return DXGI_FORMAT_R16_TYPELESS;
+ case QRhiTexture::D24:
+ return DXGI_FORMAT_R24G8_TYPELESS;
+ case QRhiTexture::D24S8:
+ return DXGI_FORMAT_R24G8_TYPELESS;
case QRhiTexture::D32F:
return DXGI_FORMAT_R32_TYPELESS;
@@ -1139,39 +1572,24 @@ static inline DXGI_FORMAT toD3DTextureFormat(QRhiTexture::Format format, QRhiTex
return srgb ? DXGI_FORMAT_BC7_UNORM_SRGB : DXGI_FORMAT_BC7_UNORM;
case QRhiTexture::ETC2_RGB8:
- Q_FALLTHROUGH();
case QRhiTexture::ETC2_RGB8A1:
- Q_FALLTHROUGH();
case QRhiTexture::ETC2_RGBA8:
qWarning("QRhiD3D11 does not support ETC2 textures");
return DXGI_FORMAT_R8G8B8A8_UNORM;
case QRhiTexture::ASTC_4x4:
- Q_FALLTHROUGH();
case QRhiTexture::ASTC_5x4:
- Q_FALLTHROUGH();
case QRhiTexture::ASTC_5x5:
- Q_FALLTHROUGH();
case QRhiTexture::ASTC_6x5:
- Q_FALLTHROUGH();
case QRhiTexture::ASTC_6x6:
- Q_FALLTHROUGH();
case QRhiTexture::ASTC_8x5:
- Q_FALLTHROUGH();
case QRhiTexture::ASTC_8x6:
- Q_FALLTHROUGH();
case QRhiTexture::ASTC_8x8:
- Q_FALLTHROUGH();
case QRhiTexture::ASTC_10x5:
- Q_FALLTHROUGH();
case QRhiTexture::ASTC_10x6:
- Q_FALLTHROUGH();
case QRhiTexture::ASTC_10x8:
- Q_FALLTHROUGH();
case QRhiTexture::ASTC_10x10:
- Q_FALLTHROUGH();
case QRhiTexture::ASTC_12x10:
- Q_FALLTHROUGH();
case QRhiTexture::ASTC_12x12:
qWarning("QRhiD3D11 does not support ASTC textures");
return DXGI_FORMAT_R8G8B8A8_UNORM;
@@ -1182,7 +1600,7 @@ static inline DXGI_FORMAT toD3DTextureFormat(QRhiTexture::Format format, QRhiTex
}
}
-static inline QRhiTexture::Format colorTextureFormatFromDxgiFormat(DXGI_FORMAT format, QRhiTexture::Flags *flags)
+static inline QRhiTexture::Format swapchainReadbackTextureFormat(DXGI_FORMAT format, QRhiTexture::Flags *flags)
{
switch (format) {
case DXGI_FORMAT_R8G8B8A8_UNORM:
@@ -1197,12 +1615,14 @@ static inline QRhiTexture::Format colorTextureFormatFromDxgiFormat(DXGI_FORMAT f
if (flags)
(*flags) |= QRhiTexture::sRGB;
return QRhiTexture::BGRA8;
- case DXGI_FORMAT_R8_UNORM:
- return QRhiTexture::R8;
- case DXGI_FORMAT_R16_UNORM:
- return QRhiTexture::R16;
- default: // this cannot assert, must warn and return unknown
- qWarning("DXGI_FORMAT %d is not a recognized uncompressed color format", format);
+ case DXGI_FORMAT_R16G16B16A16_FLOAT:
+ return QRhiTexture::RGBA16F;
+ case DXGI_FORMAT_R32G32B32A32_FLOAT:
+ return QRhiTexture::RGBA32F;
+ case DXGI_FORMAT_R10G10B10A2_UNORM:
+ return QRhiTexture::RGB10A2;
+ default:
+ qWarning("DXGI_FORMAT %d cannot be read back", format);
break;
}
return QRhiTexture::UnknownFormat;
@@ -1212,7 +1632,8 @@ static inline bool isDepthTextureFormat(QRhiTexture::Format format)
{
switch (format) {
case QRhiTexture::Format::D16:
- Q_FALLTHROUGH();
+ case QRhiTexture::Format::D24:
+ case QRhiTexture::Format::D24S8:
case QRhiTexture::Format::D32F:
return true;
@@ -1232,7 +1653,7 @@ QRhi::FrameOpResult QRhiD3D11::finish()
} else {
Q_ASSERT(contextState.currentSwapChain);
Q_ASSERT(contextState.currentSwapChain->cb.recordingPass == QD3D11CommandBuffer::NoPass);
- executeCommandBuffer(&contextState.currentSwapChain->cb); // no timestampSwapChain, in order to avoid timestamp mess
+ executeCommandBuffer(&contextState.currentSwapChain->cb);
contextState.currentSwapChain->cb.resetCommands();
}
}
@@ -1245,18 +1666,18 @@ QRhi::FrameOpResult QRhiD3D11::finish()
void QRhiD3D11::enqueueSubresUpload(QD3D11Texture *texD, QD3D11CommandBuffer *cbD,
int layer, int level, const QRhiTextureSubresourceUploadDescription &subresDesc)
{
- UINT subres = D3D11CalcSubresource(UINT(level), UINT(layer), texD->mipLevelCount);
- const QPoint dp = subresDesc.destinationTopLeft();
+ const bool is3D = texD->m_flags.testFlag(QRhiTexture::ThreeDimensional);
+ UINT subres = D3D11CalcSubresource(UINT(level), is3D ? 0u : UINT(layer), texD->mipLevelCount);
D3D11_BOX box;
- box.front = 0;
+ box.front = is3D ? UINT(layer) : 0u;
// back, right, bottom are exclusive
- box.back = 1;
- QD3D11CommandBuffer::Command cmd;
+ box.back = box.front + 1;
+ QD3D11CommandBuffer::Command &cmd(cbD->commands.get());
cmd.cmd = QD3D11CommandBuffer::Command::UpdateSubRes;
- cmd.args.updateSubRes.dst = texD->tex;
+ cmd.args.updateSubRes.dst = texD->textureResource();
cmd.args.updateSubRes.dstSubRes = subres;
- bool cmdValid = true;
+ const QPoint dp = subresDesc.destinationTopLeft();
if (!subresDesc.image().isNull()) {
QImage img = subresDesc.image();
QSize size = img.size();
@@ -1304,7 +1725,10 @@ void QRhiD3D11::enqueueSubresUpload(QD3D11Texture *texD, QD3D11CommandBuffer *cb
const QSize size = subresDesc.sourceSize().isEmpty() ? q->sizeForMipLevel(level, texD->m_pixelSize)
: subresDesc.sourceSize();
quint32 bpl = 0;
- textureFormatInfo(texD->m_format, size, &bpl, nullptr);
+ if (subresDesc.dataStride())
+ bpl = subresDesc.dataStride();
+ else
+ textureFormatInfo(texD->m_format, size, &bpl, nullptr, nullptr);
box.left = UINT(dp.x());
box.top = UINT(dp.y());
box.right = UINT(dp.x() + size.width());
@@ -1315,97 +1739,93 @@ void QRhiD3D11::enqueueSubresUpload(QD3D11Texture *texD, QD3D11CommandBuffer *cb
cmd.args.updateSubRes.srcRowPitch = bpl;
} else {
qWarning("Invalid texture upload for %p layer=%d mip=%d", texD, layer, level);
- cmdValid = false;
+ cbD->commands.unget();
}
- if (cmdValid)
- cbD->commands.append(cmd);
}
void QRhiD3D11::enqueueResourceUpdates(QRhiCommandBuffer *cb, QRhiResourceUpdateBatch *resourceUpdates)
{
QD3D11CommandBuffer *cbD = QRHI_RES(QD3D11CommandBuffer, cb);
QRhiResourceUpdateBatchPrivate *ud = QRhiResourceUpdateBatchPrivate::get(resourceUpdates);
- QRhiProfilerPrivate *rhiP = profilerPrivateOrNull();
- for (const QRhiResourceUpdateBatchPrivate::BufferOp &u : ud->bufferOps) {
+ for (int opIdx = 0; opIdx < ud->activeBufferOpCount; ++opIdx) {
+ const QRhiResourceUpdateBatchPrivate::BufferOp &u(ud->bufferOps[opIdx]);
if (u.type == QRhiResourceUpdateBatchPrivate::BufferOp::DynamicUpdate) {
QD3D11Buffer *bufD = QRHI_RES(QD3D11Buffer, u.buf);
Q_ASSERT(bufD->m_type == QRhiBuffer::Dynamic);
- memcpy(bufD->dynBuf.data() + u.offset, u.data.constData(), size_t(u.data.size()));
+ memcpy(bufD->dynBuf + u.offset, u.data.constData(), size_t(u.data.size()));
bufD->hasPendingDynamicUpdates = true;
} else if (u.type == QRhiResourceUpdateBatchPrivate::BufferOp::StaticUpload) {
QD3D11Buffer *bufD = QRHI_RES(QD3D11Buffer, u.buf);
Q_ASSERT(bufD->m_type != QRhiBuffer::Dynamic);
Q_ASSERT(u.offset + u.data.size() <= bufD->m_size);
- QD3D11CommandBuffer::Command cmd;
+ QD3D11CommandBuffer::Command &cmd(cbD->commands.get());
cmd.cmd = QD3D11CommandBuffer::Command::UpdateSubRes;
cmd.args.updateSubRes.dst = bufD->buffer;
cmd.args.updateSubRes.dstSubRes = 0;
- cmd.args.updateSubRes.src = cbD->retainData(u.data);
+ cmd.args.updateSubRes.src = cbD->retainBufferData(u.data);
cmd.args.updateSubRes.srcRowPitch = 0;
// Specify the region (even when offset is 0 and all data is provided)
// since the ID3D11Buffer's size is rounded up to be a multiple of 256
// while the data we have has the original size.
D3D11_BOX box;
- box.left = UINT(u.offset);
+ box.left = u.offset;
box.top = box.front = 0;
box.back = box.bottom = 1;
- box.right = UINT(u.offset + u.data.size()); // no -1: right, bottom, back are exclusive, see D3D11_BOX doc
+ box.right = u.offset + u.data.size(); // no -1: right, bottom, back are exclusive, see D3D11_BOX doc
cmd.args.updateSubRes.hasDstBox = true;
cmd.args.updateSubRes.dstBox = box;
- cbD->commands.append(cmd);
} else if (u.type == QRhiResourceUpdateBatchPrivate::BufferOp::Read) {
QD3D11Buffer *bufD = QRHI_RES(QD3D11Buffer, u.buf);
if (bufD->m_type == QRhiBuffer::Dynamic) {
u.result->data.resize(u.readSize);
- memcpy(u.result->data.data(), bufD->dynBuf.constData() + u.offset, size_t(u.readSize));
+ memcpy(u.result->data.data(), bufD->dynBuf + u.offset, size_t(u.readSize));
+ if (u.result->completed)
+ u.result->completed();
} else {
BufferReadback readback;
readback.result = u.result;
readback.byteSize = u.readSize;
- D3D11_BUFFER_DESC desc;
- memset(&desc, 0, sizeof(desc));
+ D3D11_BUFFER_DESC desc = {};
desc.ByteWidth = readback.byteSize;
desc.Usage = D3D11_USAGE_STAGING;
desc.CPUAccessFlags = D3D11_CPU_ACCESS_READ;
HRESULT hr = dev->CreateBuffer(&desc, nullptr, &readback.stagingBuf);
if (FAILED(hr)) {
- qWarning("Failed to create buffer: %s", qPrintable(comErrorMessage(hr)));
+ qWarning("Failed to create buffer: %s",
+ qPrintable(QSystemError::windowsComString(hr)));
continue;
}
- QRHI_PROF_F(newReadbackBuffer(qint64(qintptr(readback.stagingBuf)), bufD, readback.byteSize));
- QD3D11CommandBuffer::Command cmd;
+ QD3D11CommandBuffer::Command &cmd(cbD->commands.get());
cmd.cmd = QD3D11CommandBuffer::Command::CopySubRes;
cmd.args.copySubRes.dst = readback.stagingBuf;
cmd.args.copySubRes.dstSubRes = 0;
cmd.args.copySubRes.dstX = 0;
cmd.args.copySubRes.dstY = 0;
+ cmd.args.copySubRes.dstZ = 0;
cmd.args.copySubRes.src = bufD->buffer;
cmd.args.copySubRes.srcSubRes = 0;
cmd.args.copySubRes.hasSrcBox = true;
D3D11_BOX box;
- box.left = UINT(u.offset);
+ box.left = u.offset;
box.top = box.front = 0;
box.back = box.bottom = 1;
- box.right = UINT(u.offset + u.readSize);
+ box.right = u.offset + u.readSize;
cmd.args.copySubRes.srcBox = box;
- cbD->commands.append(cmd);
activeBufferReadbacks.append(readback);
}
- if (u.result->completed)
- u.result->completed();
}
}
-
- for (const QRhiResourceUpdateBatchPrivate::TextureOp &u : ud->textureOps) {
+ for (int opIdx = 0; opIdx < ud->activeTextureOpCount; ++opIdx) {
+ const QRhiResourceUpdateBatchPrivate::TextureOp &u(ud->textureOps[opIdx]);
if (u.type == QRhiResourceUpdateBatchPrivate::TextureOp::Upload) {
QD3D11Texture *texD = QRHI_RES(QD3D11Texture, u.dst);
- for (int layer = 0; layer < QRhi::MAX_LAYERS; ++layer) {
- for (int level = 0; level < QRhi::MAX_LEVELS; ++level) {
- for (const QRhiTextureSubresourceUploadDescription &subresDesc : qAsConst(u.subresDesc[layer][level]))
+ for (int layer = 0, maxLayer = u.subresDesc.count(); layer < maxLayer; ++layer) {
+ for (int level = 0; level < QRhi::MAX_MIP_LEVELS; ++level) {
+ for (const QRhiTextureSubresourceUploadDescription &subresDesc : std::as_const(u.subresDesc[layer][level]))
enqueueSubresUpload(texD, cbD, layer, level, subresDesc);
}
}
@@ -1413,8 +1833,10 @@ void QRhiD3D11::enqueueResourceUpdates(QRhiCommandBuffer *cb, QRhiResourceUpdate
Q_ASSERT(u.src && u.dst);
QD3D11Texture *srcD = QRHI_RES(QD3D11Texture, u.src);
QD3D11Texture *dstD = QRHI_RES(QD3D11Texture, u.dst);
- UINT srcSubRes = D3D11CalcSubresource(UINT(u.desc.sourceLevel()), UINT(u.desc.sourceLayer()), srcD->mipLevelCount);
- UINT dstSubRes = D3D11CalcSubresource(UINT(u.desc.destinationLevel()), UINT(u.desc.destinationLayer()), dstD->mipLevelCount);
+ const bool srcIs3D = srcD->m_flags.testFlag(QRhiTexture::ThreeDimensional);
+ const bool dstIs3D = dstD->m_flags.testFlag(QRhiTexture::ThreeDimensional);
+ UINT srcSubRes = D3D11CalcSubresource(UINT(u.desc.sourceLevel()), srcIs3D ? 0u : UINT(u.desc.sourceLayer()), srcD->mipLevelCount);
+ UINT dstSubRes = D3D11CalcSubresource(UINT(u.desc.destinationLevel()), dstIs3D ? 0u : UINT(u.desc.destinationLayer()), dstD->mipLevelCount);
const QPoint dp = u.desc.destinationTopLeft();
const QSize mipSize = q->sizeForMipLevel(u.desc.sourceLevel(), srcD->m_pixelSize);
const QSize copySize = u.desc.pixelSize().isEmpty() ? mipSize : u.desc.pixelSize();
@@ -1422,22 +1844,22 @@ void QRhiD3D11::enqueueResourceUpdates(QRhiCommandBuffer *cb, QRhiResourceUpdate
D3D11_BOX srcBox;
srcBox.left = UINT(sp.x());
srcBox.top = UINT(sp.y());
- srcBox.front = 0;
+ srcBox.front = srcIs3D ? UINT(u.desc.sourceLayer()) : 0u;
// back, right, bottom are exclusive
srcBox.right = srcBox.left + UINT(copySize.width());
srcBox.bottom = srcBox.top + UINT(copySize.height());
- srcBox.back = 1;
- QD3D11CommandBuffer::Command cmd;
+ srcBox.back = srcBox.front + 1;
+ QD3D11CommandBuffer::Command &cmd(cbD->commands.get());
cmd.cmd = QD3D11CommandBuffer::Command::CopySubRes;
- cmd.args.copySubRes.dst = dstD->tex;
+ cmd.args.copySubRes.dst = dstD->textureResource();
cmd.args.copySubRes.dstSubRes = dstSubRes;
cmd.args.copySubRes.dstX = UINT(dp.x());
cmd.args.copySubRes.dstY = UINT(dp.y());
- cmd.args.copySubRes.src = srcD->tex;
+ cmd.args.copySubRes.dstZ = dstIs3D ? UINT(u.desc.destinationLayer()) : 0u;
+ cmd.args.copySubRes.src = srcD->textureResource();
cmd.args.copySubRes.srcSubRes = srcSubRes;
cmd.args.copySubRes.hasSrcBox = true;
cmd.args.copySubRes.srcBox = srcBox;
- cbD->commands.append(cmd);
} else if (u.type == QRhiResourceUpdateBatchPrivate::TextureOp::Read) {
TextureReadback readback;
readback.desc = u.rb;
@@ -1450,45 +1872,45 @@ void QRhiD3D11::enqueueResourceUpdates(QRhiCommandBuffer *cb, QRhiResourceUpdate
UINT subres = 0;
QD3D11Texture *texD = QRHI_RES(QD3D11Texture, u.rb.texture());
QD3D11SwapChain *swapChainD = nullptr;
+ bool is3D = false;
if (texD) {
if (texD->sampleDesc.Count > 1) {
qWarning("Multisample texture cannot be read back");
continue;
}
- src = texD->tex;
+ src = texD->textureResource();
dxgiFormat = texD->dxgiFormat;
pixelSize = q->sizeForMipLevel(u.rb.level(), texD->m_pixelSize);
format = texD->m_format;
- subres = D3D11CalcSubresource(UINT(u.rb.level()), UINT(u.rb.layer()), texD->mipLevelCount);
+ is3D = texD->m_flags.testFlag(QRhiTexture::ThreeDimensional);
+ subres = D3D11CalcSubresource(UINT(u.rb.level()), UINT(is3D ? 0 : u.rb.layer()), texD->mipLevelCount);
} else {
Q_ASSERT(contextState.currentSwapChain);
swapChainD = QRHI_RES(QD3D11SwapChain, contextState.currentSwapChain);
if (swapChainD->sampleDesc.Count > 1) {
// Unlike with textures, reading back a multisample swapchain image
// has to be supported. Insert a resolve.
- QD3D11CommandBuffer::Command rcmd;
+ QD3D11CommandBuffer::Command &rcmd(cbD->commands.get());
rcmd.cmd = QD3D11CommandBuffer::Command::ResolveSubRes;
rcmd.args.resolveSubRes.dst = swapChainD->backBufferTex;
rcmd.args.resolveSubRes.dstSubRes = 0;
rcmd.args.resolveSubRes.src = swapChainD->msaaTex[swapChainD->currentFrameSlot];
rcmd.args.resolveSubRes.srcSubRes = 0;
rcmd.args.resolveSubRes.format = swapChainD->colorFormat;
- cbD->commands.append(rcmd);
}
src = swapChainD->backBufferTex;
dxgiFormat = swapChainD->colorFormat;
pixelSize = swapChainD->pixelSize;
- format = colorTextureFormatFromDxgiFormat(dxgiFormat, nullptr);
+ format = swapchainReadbackTextureFormat(dxgiFormat, nullptr);
if (format == QRhiTexture::UnknownFormat)
continue;
}
quint32 byteSize = 0;
quint32 bpl = 0;
- textureFormatInfo(format, pixelSize, &bpl, &byteSize);
+ textureFormatInfo(format, pixelSize, &bpl, &byteSize, nullptr);
- D3D11_TEXTURE2D_DESC desc;
- memset(&desc, 0, sizeof(desc));
+ D3D11_TEXTURE2D_DESC desc = {};
desc.Width = UINT(pixelSize.width());
desc.Height = UINT(pixelSize.height());
desc.MipLevels = 1;
@@ -1500,23 +1922,31 @@ void QRhiD3D11::enqueueResourceUpdates(QRhiCommandBuffer *cb, QRhiResourceUpdate
ID3D11Texture2D *stagingTex;
HRESULT hr = dev->CreateTexture2D(&desc, nullptr, &stagingTex);
if (FAILED(hr)) {
- qWarning("Failed to create readback staging texture: %s", qPrintable(comErrorMessage(hr)));
+ qWarning("Failed to create readback staging texture: %s",
+ qPrintable(QSystemError::windowsComString(hr)));
return;
}
- QRHI_PROF_F(newReadbackBuffer(qint64(qintptr(stagingTex)),
- texD ? static_cast<QRhiResource *>(texD) : static_cast<QRhiResource *>(swapChainD),
- byteSize));
- QD3D11CommandBuffer::Command cmd;
+ QD3D11CommandBuffer::Command &cmd(cbD->commands.get());
cmd.cmd = QD3D11CommandBuffer::Command::CopySubRes;
cmd.args.copySubRes.dst = stagingTex;
cmd.args.copySubRes.dstSubRes = 0;
cmd.args.copySubRes.dstX = 0;
cmd.args.copySubRes.dstY = 0;
+ cmd.args.copySubRes.dstZ = 0;
cmd.args.copySubRes.src = src;
cmd.args.copySubRes.srcSubRes = subres;
- cmd.args.copySubRes.hasSrcBox = false;
- cbD->commands.append(cmd);
+ if (is3D) {
+ D3D11_BOX srcBox = {};
+ srcBox.front = UINT(u.rb.layer());
+ srcBox.right = desc.Width; // exclusive
+ srcBox.bottom = desc.Height;
+ srcBox.back = srcBox.front + 1;
+ cmd.args.copySubRes.hasSrcBox = true;
+ cmd.args.copySubRes.srcBox = srcBox;
+ } else {
+ cmd.args.copySubRes.hasSrcBox = false;
+ }
readback.stagingTex = stagingTex;
readback.byteSize = byteSize;
@@ -1527,10 +1957,9 @@ void QRhiD3D11::enqueueResourceUpdates(QRhiCommandBuffer *cb, QRhiResourceUpdate
activeTextureReadbacks.append(readback);
} else if (u.type == QRhiResourceUpdateBatchPrivate::TextureOp::GenMips) {
Q_ASSERT(u.dst->flags().testFlag(QRhiTexture::UsedWithGenerateMips));
- QD3D11CommandBuffer::Command cmd;
+ QD3D11CommandBuffer::Command &cmd(cbD->commands.get());
cmd.cmd = QD3D11CommandBuffer::Command::GenMip;
cmd.args.genMip.srv = QRHI_RES(QD3D11Texture, u.dst)->srv;
- cbD->commands.append(cmd);
}
}
@@ -1540,7 +1969,6 @@ void QRhiD3D11::enqueueResourceUpdates(QRhiCommandBuffer *cb, QRhiResourceUpdate
void QRhiD3D11::finishActiveReadbacks()
{
QVarLengthArray<std::function<void()>, 4> completedCallbacks;
- QRhiProfilerPrivate *rhiP = profilerPrivateOrNull();
for (int i = activeTextureReadbacks.count() - 1; i >= 0; --i) {
const QRhiD3D11::TextureReadback &readback(activeTextureReadbacks[i]);
@@ -1562,16 +1990,16 @@ void QRhiD3D11::finishActiveReadbacks()
}
context->Unmap(readback.stagingTex, 0);
} else {
- qWarning("Failed to map readback staging texture: %s", qPrintable(comErrorMessage(hr)));
+ qWarning("Failed to map readback staging texture: %s",
+ qPrintable(QSystemError::windowsComString(hr)));
}
readback.stagingTex->Release();
- QRHI_PROF_F(releaseReadbackBuffer(qint64(qintptr(readback.stagingTex))));
if (readback.result->completed)
completedCallbacks.append(readback.result->completed);
- activeTextureReadbacks.removeAt(i);
+ activeTextureReadbacks.removeLast();
}
for (int i = activeBufferReadbacks.count() - 1; i >= 0; --i) {
@@ -1584,35 +2012,22 @@ void QRhiD3D11::finishActiveReadbacks()
memcpy(readback.result->data.data(), mp.pData, readback.byteSize);
context->Unmap(readback.stagingBuf, 0);
} else {
- qWarning("Failed to map readback staging texture: %s", qPrintable(comErrorMessage(hr)));
+ qWarning("Failed to map readback staging texture: %s",
+ qPrintable(QSystemError::windowsComString(hr)));
}
readback.stagingBuf->Release();
- QRHI_PROF_F(releaseReadbackBuffer(qint64(qintptr(readback.stagingBuf))));
if (readback.result->completed)
completedCallbacks.append(readback.result->completed);
- activeBufferReadbacks.removeAt(i);
+ activeBufferReadbacks.removeLast();
}
for (auto f : completedCallbacks)
f();
}
-static inline QD3D11RenderTargetData *rtData(QRhiRenderTarget *rt)
-{
- switch (rt->resourceType()) {
- case QRhiResource::RenderTarget:
- return &QRHI_RES(QD3D11ReferenceRenderTarget, rt)->d;
- case QRhiResource::TextureRenderTarget:
- return &QRHI_RES(QD3D11TextureRenderTarget, rt)->d;
- default:
- Q_UNREACHABLE();
- return nullptr;
- }
-}
-
void QRhiD3D11::resourceUpdate(QRhiCommandBuffer *cb, QRhiResourceUpdateBatch *resourceUpdates)
{
Q_ASSERT(QRHI_RES(QD3D11CommandBuffer, cb)->recordingPass == QD3D11CommandBuffer::NoPass);
@@ -1624,7 +2039,8 @@ void QRhiD3D11::beginPass(QRhiCommandBuffer *cb,
QRhiRenderTarget *rt,
const QColor &colorClearValue,
const QRhiDepthStencilClearValue &depthStencilClearValue,
- QRhiResourceUpdateBatch *resourceUpdates)
+ QRhiResourceUpdateBatch *resourceUpdates,
+ QRhiCommandBuffer::BeginPassFlags)
{
QD3D11CommandBuffer *cbD = QRHI_RES(QD3D11CommandBuffer, cb);
Q_ASSERT(cbD->recordingPass == QD3D11CommandBuffer::NoPass);
@@ -1639,16 +2055,17 @@ void QRhiD3D11::beginPass(QRhiCommandBuffer *cb,
QD3D11TextureRenderTarget *rtTex = QRHI_RES(QD3D11TextureRenderTarget, rt);
wantsColorClear = !rtTex->m_flags.testFlag(QRhiTextureRenderTarget::PreserveColorContents);
wantsDsClear = !rtTex->m_flags.testFlag(QRhiTextureRenderTarget::PreserveDepthStencilContents);
+ if (!QRhiRenderTargetAttachmentTracker::isUpToDate<QD3D11Texture, QD3D11RenderBuffer>(rtTex->description(), rtD->currentResIdList))
+ rtTex->create();
}
- QD3D11CommandBuffer::Command fbCmd;
- fbCmd.cmd = QD3D11CommandBuffer::Command::ResetShaderResources;
- cbD->commands.append(fbCmd);
+ cbD->commands.get().cmd = QD3D11CommandBuffer::Command::ResetShaderResources;
+
+ QD3D11CommandBuffer::Command &fbCmd(cbD->commands.get());
fbCmd.cmd = QD3D11CommandBuffer::Command::SetRenderTarget;
fbCmd.args.setRenderTarget.rt = rt;
- cbD->commands.append(fbCmd);
- QD3D11CommandBuffer::Command clearCmd;
+ QD3D11CommandBuffer::Command &clearCmd(cbD->commands.get());
clearCmd.cmd = QD3D11CommandBuffer::Command::Clear;
clearCmd.args.clear.rt = rt;
clearCmd.args.clear.mask = 0;
@@ -1663,12 +2080,11 @@ void QRhiD3D11::beginPass(QRhiCommandBuffer *cb,
clearCmd.args.clear.c[3] = float(colorClearValue.alphaF());
clearCmd.args.clear.d = depthStencilClearValue.depthClearValue();
clearCmd.args.clear.s = depthStencilClearValue.stencilClearValue();
- cbD->commands.append(clearCmd);
cbD->recordingPass = QD3D11CommandBuffer::RenderPass;
cbD->currentTarget = rt;
- cbD->resetCachedShaderResourceState();
+ cbD->resetCachedState();
}
void QRhiD3D11::endPass(QRhiCommandBuffer *cb, QRhiResourceUpdateBatch *resourceUpdates)
@@ -1689,41 +2105,49 @@ void QRhiD3D11::endPass(QRhiCommandBuffer *cb, QRhiResourceUpdateBatch *resource
QD3D11Texture *srcTexD = QRHI_RES(QD3D11Texture, colorAtt.texture());
QD3D11RenderBuffer *srcRbD = QRHI_RES(QD3D11RenderBuffer, colorAtt.renderBuffer());
Q_ASSERT(srcTexD || srcRbD);
- QD3D11CommandBuffer::Command cmd;
+ QD3D11CommandBuffer::Command &cmd(cbD->commands.get());
cmd.cmd = QD3D11CommandBuffer::Command::ResolveSubRes;
- cmd.args.resolveSubRes.dst = dstTexD->tex;
+ cmd.args.resolveSubRes.dst = dstTexD->textureResource();
cmd.args.resolveSubRes.dstSubRes = D3D11CalcSubresource(UINT(colorAtt.resolveLevel()),
UINT(colorAtt.resolveLayer()),
dstTexD->mipLevelCount);
if (srcTexD) {
- cmd.args.resolveSubRes.src = srcTexD->tex;
+ cmd.args.resolveSubRes.src = srcTexD->textureResource();
if (srcTexD->dxgiFormat != dstTexD->dxgiFormat) {
- qWarning("Resolve source and destination formats do not match");
+ qWarning("Resolve source (%d) and destination (%d) formats do not match",
+ int(srcTexD->dxgiFormat), int(dstTexD->dxgiFormat));
+ cbD->commands.unget();
continue;
}
if (srcTexD->sampleDesc.Count <= 1) {
qWarning("Cannot resolve a non-multisample texture");
+ cbD->commands.unget();
continue;
}
if (srcTexD->m_pixelSize != dstTexD->m_pixelSize) {
qWarning("Resolve source and destination sizes do not match");
+ cbD->commands.unget();
continue;
}
} else {
cmd.args.resolveSubRes.src = srcRbD->tex;
if (srcRbD->dxgiFormat != dstTexD->dxgiFormat) {
- qWarning("Resolve source and destination formats do not match");
+ qWarning("Resolve source (%d) and destination (%d) formats do not match",
+ int(srcRbD->dxgiFormat), int(dstTexD->dxgiFormat));
+ cbD->commands.unget();
continue;
}
if (srcRbD->m_pixelSize != dstTexD->m_pixelSize) {
qWarning("Resolve source and destination sizes do not match");
+ cbD->commands.unget();
continue;
}
}
cmd.args.resolveSubRes.srcSubRes = D3D11CalcSubresource(0, UINT(colorAtt.layer()), 1);
cmd.args.resolveSubRes.format = dstTexD->dxgiFormat;
- cbD->commands.append(cmd);
}
+ if (rtTex->m_desc.depthResolveTexture())
+ qWarning("Resolving multisample depth-stencil buffers is not supported with D3D");
}
cbD->recordingPass = QD3D11CommandBuffer::NoPass;
@@ -1733,7 +2157,9 @@ void QRhiD3D11::endPass(QRhiCommandBuffer *cb, QRhiResourceUpdateBatch *resource
enqueueResourceUpdates(cb, resourceUpdates);
}
-void QRhiD3D11::beginComputePass(QRhiCommandBuffer *cb, QRhiResourceUpdateBatch *resourceUpdates)
+void QRhiD3D11::beginComputePass(QRhiCommandBuffer *cb,
+ QRhiResourceUpdateBatch *resourceUpdates,
+ QRhiCommandBuffer::BeginPassFlags)
{
QD3D11CommandBuffer *cbD = QRHI_RES(QD3D11CommandBuffer, cb);
Q_ASSERT(cbD->recordingPass == QD3D11CommandBuffer::NoPass);
@@ -1741,13 +2167,12 @@ void QRhiD3D11::beginComputePass(QRhiCommandBuffer *cb, QRhiResourceUpdateBatch
if (resourceUpdates)
enqueueResourceUpdates(cb, resourceUpdates);
- QD3D11CommandBuffer::Command cmd;
+ QD3D11CommandBuffer::Command &cmd(cbD->commands.get());
cmd.cmd = QD3D11CommandBuffer::Command::ResetShaderResources;
- cbD->commands.append(cmd);
cbD->recordingPass = QD3D11CommandBuffer::ComputePass;
- cbD->resetCachedShaderResourceState();
+ cbD->resetCachedState();
}
void QRhiD3D11::endComputePass(QRhiCommandBuffer *cb, QRhiResourceUpdateBatch *resourceUpdates)
@@ -1773,10 +2198,9 @@ void QRhiD3D11::setComputePipeline(QRhiCommandBuffer *cb, QRhiComputePipeline *p
cbD->currentComputePipeline = psD;
cbD->currentPipelineGeneration = psD->generation;
- QD3D11CommandBuffer::Command cmd;
+ QD3D11CommandBuffer::Command &cmd(cbD->commands.get());
cmd.cmd = QD3D11CommandBuffer::Command::BindComputePipeline;
cmd.args.bindComputePipeline.ps = psD;
- cbD->commands.append(cmd);
}
}
@@ -1785,129 +2209,263 @@ void QRhiD3D11::dispatch(QRhiCommandBuffer *cb, int x, int y, int z)
QD3D11CommandBuffer *cbD = QRHI_RES(QD3D11CommandBuffer, cb);
Q_ASSERT(cbD->recordingPass == QD3D11CommandBuffer::ComputePass);
- QD3D11CommandBuffer::Command cmd;
+ QD3D11CommandBuffer::Command &cmd(cbD->commands.get());
cmd.cmd = QD3D11CommandBuffer::Command::Dispatch;
cmd.args.dispatch.x = UINT(x);
cmd.args.dispatch.y = UINT(y);
cmd.args.dispatch.z = UINT(z);
- cbD->commands.append(cmd);
}
-void QRhiD3D11::updateShaderResourceBindings(QD3D11ShaderResourceBindings *srbD)
-{
- srbD->vsubufs.clear();
- srbD->vsubufoffsets.clear();
- srbD->vsubufsizes.clear();
-
- srbD->fsubufs.clear();
- srbD->fsubufoffsets.clear();
- srbD->fsubufsizes.clear();
-
- srbD->csubufs.clear();
- srbD->csubufoffsets.clear();
- srbD->csubufsizes.clear();
-
- srbD->vssamplers.clear();
- srbD->vsshaderresources.clear();
-
- srbD->fssamplers.clear();
- srbD->fsshaderresources.clear();
-
- srbD->cssamplers.clear();
- srbD->csshaderresources.clear();
-
- srbD->csUAVs.clear();
+static inline QPair<int, int> mapBinding(int binding,
+ int stageIndex,
+ const QShader::NativeResourceBindingMap *nativeResourceBindingMaps[])
+{
+ const QShader::NativeResourceBindingMap *map = nativeResourceBindingMaps[stageIndex];
+ if (!map || map->isEmpty())
+ return { binding, binding }; // assume 1:1 mapping
+
+ auto it = map->constFind(binding);
+ if (it != map->cend())
+ return *it;
+
+ // Hitting this path is normal too. It is not given that the resource is
+ // present in the shaders for all the stages specified by the visibility
+ // mask in the QRhiShaderResourceBinding.
+ return { -1, -1 };
+}
+
+void QRhiD3D11::updateShaderResourceBindings(QD3D11ShaderResourceBindings *srbD,
+ const QShader::NativeResourceBindingMap *nativeResourceBindingMaps[])
+{
+ srbD->vsUniformBufferBatches.clear();
+ srbD->hsUniformBufferBatches.clear();
+ srbD->dsUniformBufferBatches.clear();
+ srbD->gsUniformBufferBatches.clear();
+ srbD->fsUniformBufferBatches.clear();
+ srbD->csUniformBufferBatches.clear();
+
+ srbD->vsSamplerBatches.clear();
+ srbD->hsSamplerBatches.clear();
+ srbD->dsSamplerBatches.clear();
+ srbD->gsSamplerBatches.clear();
+ srbD->fsSamplerBatches.clear();
+ srbD->csSamplerBatches.clear();
+
+ srbD->csUavBatches.clear();
+
+ struct Stage {
+ struct Buffer {
+ int binding; // stored and sent along in XXorigbindings just for applyDynamicOffsets()
+ int breg; // b0, b1, ...
+ ID3D11Buffer *buffer;
+ uint offsetInConstants;
+ uint sizeInConstants;
+ };
+ struct Texture {
+ int treg; // t0, t1, ...
+ ID3D11ShaderResourceView *srv;
+ };
+ struct Sampler {
+ int sreg; // s0, s1, ...
+ ID3D11SamplerState *sampler;
+ };
+ struct Uav {
+ int ureg;
+ ID3D11UnorderedAccessView *uav;
+ };
+ QVarLengthArray<Buffer, 8> buffers;
+ QVarLengthArray<Texture, 8> textures;
+ QVarLengthArray<Sampler, 8> samplers;
+ QVarLengthArray<Uav, 8> uavs;
+ void buildBufferBatches(QD3D11ShaderResourceBindings::StageUniformBufferBatches &batches) const
+ {
+ for (const Buffer &buf : buffers) {
+ batches.ubufs.feed(buf.breg, buf.buffer);
+ batches.ubuforigbindings.feed(buf.breg, UINT(buf.binding));
+ batches.ubufoffsets.feed(buf.breg, buf.offsetInConstants);
+ batches.ubufsizes.feed(buf.breg, buf.sizeInConstants);
+ }
+ batches.finish();
+ }
+ void buildSamplerBatches(QD3D11ShaderResourceBindings::StageSamplerBatches &batches) const
+ {
+ for (const Texture &t : textures)
+ batches.shaderresources.feed(t.treg, t.srv);
+ for (const Sampler &s : samplers)
+ batches.samplers.feed(s.sreg, s.sampler);
+ batches.finish();
+ }
+ void buildUavBatches(QD3D11ShaderResourceBindings::StageUavBatches &batches) const
+ {
+ for (const Stage::Uav &u : uavs)
+ batches.uavs.feed(u.ureg, u.uav);
+ batches.finish();
+ }
+ } res[RBM_SUPPORTED_STAGES];
for (int i = 0, ie = srbD->sortedBindings.count(); i != ie; ++i) {
- const QRhiShaderResourceBinding::Data *b = srbD->sortedBindings.at(i).data();
+ const QRhiShaderResourceBinding::Data *b = shaderResourceBindingData(srbD->sortedBindings.at(i));
QD3D11ShaderResourceBindings::BoundResourceData &bd(srbD->boundResourceData[i]);
switch (b->type) {
case QRhiShaderResourceBinding::UniformBuffer:
{
QD3D11Buffer *bufD = QRHI_RES(QD3D11Buffer, b->u.ubuf.buf);
- Q_ASSERT(aligned(b->u.ubuf.offset, 256) == b->u.ubuf.offset);
+ Q_ASSERT(aligned(b->u.ubuf.offset, 256u) == b->u.ubuf.offset);
bd.ubuf.id = bufD->m_id;
bd.ubuf.generation = bufD->generation;
- // dynamic ubuf offsets are not considered here, those are baked in
+ // Dynamic ubuf offsets are not considered here, those are baked in
// at a later stage, which is good as vsubufoffsets and friends are
- // per-srb, not per-setShaderResources call
- const uint offsetInConstants = uint(b->u.ubuf.offset) / 16;
+ // per-srb, not per-setShaderResources call. Other backends (GL,
+ // Metal) are different in this respect since those do not store
+ // per-srb vsubufoffsets etc. data so life's a bit easier for them.
+ // But here we have to defer baking in the dynamic offset.
+ const quint32 offsetInConstants = b->u.ubuf.offset / 16;
// size must be 16 mult. (in constants, i.e. multiple of 256 bytes).
// We can round up if needed since the buffers's actual size
// (ByteWidth) is always a multiple of 256.
- const uint sizeInConstants = uint(aligned(b->u.ubuf.maybeSize ? b->u.ubuf.maybeSize : bufD->m_size, 256) / 16);
+ const quint32 sizeInConstants = aligned(b->u.ubuf.maybeSize ? b->u.ubuf.maybeSize : bufD->m_size, 256u) / 16;
if (b->stage.testFlag(QRhiShaderResourceBinding::VertexStage)) {
- srbD->vsubufs.feed(b->binding, bufD->buffer);
- srbD->vsubufoffsets.feed(b->binding, offsetInConstants);
- srbD->vsubufsizes.feed(b->binding, sizeInConstants);
+ QPair<int, int> nativeBinding = mapBinding(b->binding, RBM_VERTEX, nativeResourceBindingMaps);
+ if (nativeBinding.first >= 0)
+ res[RBM_VERTEX].buffers.append({ b->binding, nativeBinding.first, bufD->buffer, offsetInConstants, sizeInConstants });
+ }
+ if (b->stage.testFlag(QRhiShaderResourceBinding::TessellationControlStage)) {
+ QPair<int, int> nativeBinding = mapBinding(b->binding, RBM_HULL, nativeResourceBindingMaps);
+ if (nativeBinding.first >= 0)
+ res[RBM_HULL].buffers.append({ b->binding, nativeBinding.first, bufD->buffer, offsetInConstants, sizeInConstants });
+ }
+ if (b->stage.testFlag(QRhiShaderResourceBinding::TessellationEvaluationStage)) {
+ QPair<int, int> nativeBinding = mapBinding(b->binding, RBM_DOMAIN, nativeResourceBindingMaps);
+ if (nativeBinding.first >= 0)
+ res[RBM_DOMAIN].buffers.append({ b->binding, nativeBinding.first, bufD->buffer, offsetInConstants, sizeInConstants });
+ }
+ if (b->stage.testFlag(QRhiShaderResourceBinding::GeometryStage)) {
+ QPair<int, int> nativeBinding = mapBinding(b->binding, RBM_GEOMETRY, nativeResourceBindingMaps);
+ if (nativeBinding.first >= 0)
+ res[RBM_GEOMETRY].buffers.append({ b->binding, nativeBinding.first, bufD->buffer, offsetInConstants, sizeInConstants });
}
if (b->stage.testFlag(QRhiShaderResourceBinding::FragmentStage)) {
- srbD->fsubufs.feed(b->binding, bufD->buffer);
- srbD->fsubufoffsets.feed(b->binding, offsetInConstants);
- srbD->fsubufsizes.feed(b->binding, sizeInConstants);
+ QPair<int, int> nativeBinding = mapBinding(b->binding, RBM_FRAGMENT, nativeResourceBindingMaps);
+ if (nativeBinding.first >= 0)
+ res[RBM_FRAGMENT].buffers.append({ b->binding, nativeBinding.first, bufD->buffer, offsetInConstants, sizeInConstants });
}
if (b->stage.testFlag(QRhiShaderResourceBinding::ComputeStage)) {
- srbD->csubufs.feed(b->binding, bufD->buffer);
- srbD->csubufoffsets.feed(b->binding, offsetInConstants);
- srbD->csubufsizes.feed(b->binding, sizeInConstants);
+ QPair<int, int> nativeBinding = mapBinding(b->binding, RBM_COMPUTE, nativeResourceBindingMaps);
+ if (nativeBinding.first >= 0)
+ res[RBM_COMPUTE].buffers.append({ b->binding, nativeBinding.first, bufD->buffer, offsetInConstants, sizeInConstants });
}
}
break;
case QRhiShaderResourceBinding::SampledTexture:
+ case QRhiShaderResourceBinding::Texture:
+ case QRhiShaderResourceBinding::Sampler:
{
- // A sampler with binding N is mapped to a HLSL sampler and texture
- // with registers sN and tN by SPIRV-Cross.
- QD3D11Texture *texD = QRHI_RES(QD3D11Texture, b->u.stex.tex);
- QD3D11Sampler *samplerD = QRHI_RES(QD3D11Sampler, b->u.stex.sampler);
- bd.stex.texId = texD->m_id;
- bd.stex.texGeneration = texD->generation;
- bd.stex.samplerId = samplerD->m_id;
- bd.stex.samplerGeneration = samplerD->generation;
- if (b->stage.testFlag(QRhiShaderResourceBinding::VertexStage)) {
- srbD->vssamplers.feed(b->binding, samplerD->samplerState);
- srbD->vsshaderresources.feed(b->binding, texD->srv);
- }
- if (b->stage.testFlag(QRhiShaderResourceBinding::FragmentStage)) {
- srbD->fssamplers.feed(b->binding, samplerD->samplerState);
- srbD->fsshaderresources.feed(b->binding, texD->srv);
- }
- if (b->stage.testFlag(QRhiShaderResourceBinding::ComputeStage)) {
- srbD->cssamplers.feed(b->binding, samplerD->samplerState);
- srbD->csshaderresources.feed(b->binding, texD->srv);
+ const QRhiShaderResourceBinding::Data::TextureAndOrSamplerData *data = &b->u.stex;
+ bd.stex.count = data->count;
+ const QPair<int, int> nativeBindingVert = mapBinding(b->binding, RBM_VERTEX, nativeResourceBindingMaps);
+ const QPair<int, int> nativeBindingHull = mapBinding(b->binding, RBM_HULL, nativeResourceBindingMaps);
+ const QPair<int, int> nativeBindingDomain = mapBinding(b->binding, RBM_DOMAIN, nativeResourceBindingMaps);
+ const QPair<int, int> nativeBindingGeom = mapBinding(b->binding, RBM_GEOMETRY, nativeResourceBindingMaps);
+ const QPair<int, int> nativeBindingFrag = mapBinding(b->binding, RBM_FRAGMENT, nativeResourceBindingMaps);
+ const QPair<int, int> nativeBindingComp = mapBinding(b->binding, RBM_COMPUTE, nativeResourceBindingMaps);
+ // if SPIR-V binding b is mapped to tN and sN in HLSL, and it
+ // is an array, then it will use tN, tN+1, tN+2, ..., and sN,
+ // sN+1, sN+2, ...
+ for (int elem = 0; elem < data->count; ++elem) {
+ QD3D11Texture *texD = QRHI_RES(QD3D11Texture, data->texSamplers[elem].tex);
+ QD3D11Sampler *samplerD = QRHI_RES(QD3D11Sampler, data->texSamplers[elem].sampler);
+ bd.stex.d[elem].texId = texD ? texD->m_id : 0;
+ bd.stex.d[elem].texGeneration = texD ? texD->generation : 0;
+ bd.stex.d[elem].samplerId = samplerD ? samplerD->m_id : 0;
+ bd.stex.d[elem].samplerGeneration = samplerD ? samplerD->generation : 0;
+ // Must handle all three cases (combined, separate, separate):
+ // first = texture binding, second = sampler binding
+ // first = texture binding
+ // first = sampler binding
+ if (b->stage.testFlag(QRhiShaderResourceBinding::VertexStage)) {
+ const int samplerBinding = texD && samplerD ? nativeBindingVert.second
+ : (samplerD ? nativeBindingVert.first : -1);
+ if (nativeBindingVert.first >= 0 && texD)
+ res[RBM_VERTEX].textures.append({ nativeBindingVert.first + elem, texD->srv });
+ if (samplerBinding >= 0)
+ res[RBM_VERTEX].samplers.append({ samplerBinding + elem, samplerD->samplerState });
+ }
+ if (b->stage.testFlag(QRhiShaderResourceBinding::TessellationControlStage)) {
+ const int samplerBinding = texD && samplerD ? nativeBindingHull.second
+ : (samplerD ? nativeBindingHull.first : -1);
+ if (nativeBindingHull.first >= 0 && texD)
+ res[RBM_HULL].textures.append({ nativeBindingHull.first + elem, texD->srv });
+ if (samplerBinding >= 0)
+ res[RBM_HULL].samplers.append({ samplerBinding + elem, samplerD->samplerState });
+ }
+ if (b->stage.testFlag(QRhiShaderResourceBinding::TessellationEvaluationStage)) {
+ const int samplerBinding = texD && samplerD ? nativeBindingDomain.second
+ : (samplerD ? nativeBindingDomain.first : -1);
+ if (nativeBindingDomain.first >= 0 && texD)
+ res[RBM_DOMAIN].textures.append({ nativeBindingDomain.first + elem, texD->srv });
+ if (samplerBinding >= 0)
+ res[RBM_DOMAIN].samplers.append({ samplerBinding + elem, samplerD->samplerState });
+ }
+ if (b->stage.testFlag(QRhiShaderResourceBinding::GeometryStage)) {
+ const int samplerBinding = texD && samplerD ? nativeBindingGeom.second
+ : (samplerD ? nativeBindingGeom.first : -1);
+ if (nativeBindingGeom.first >= 0 && texD)
+ res[RBM_GEOMETRY].textures.append({ nativeBindingGeom.first + elem, texD->srv });
+ if (samplerBinding >= 0)
+ res[RBM_GEOMETRY].samplers.append({ samplerBinding + elem, samplerD->samplerState });
+ }
+ if (b->stage.testFlag(QRhiShaderResourceBinding::FragmentStage)) {
+ const int samplerBinding = texD && samplerD ? nativeBindingFrag.second
+ : (samplerD ? nativeBindingFrag.first : -1);
+ if (nativeBindingFrag.first >= 0 && texD)
+ res[RBM_FRAGMENT].textures.append({ nativeBindingFrag.first + elem, texD->srv });
+ if (samplerBinding >= 0)
+ res[RBM_FRAGMENT].samplers.append({ samplerBinding + elem, samplerD->samplerState });
+ }
+ if (b->stage.testFlag(QRhiShaderResourceBinding::ComputeStage)) {
+ const int samplerBinding = texD && samplerD ? nativeBindingComp.second
+ : (samplerD ? nativeBindingComp.first : -1);
+ if (nativeBindingComp.first >= 0 && texD)
+ res[RBM_COMPUTE].textures.append({ nativeBindingComp.first + elem, texD->srv });
+ if (samplerBinding >= 0)
+ res[RBM_COMPUTE].samplers.append({ samplerBinding + elem, samplerD->samplerState });
+ }
}
}
break;
case QRhiShaderResourceBinding::ImageLoad:
- Q_FALLTHROUGH();
case QRhiShaderResourceBinding::ImageStore:
- Q_FALLTHROUGH();
case QRhiShaderResourceBinding::ImageLoadStore:
{
QD3D11Texture *texD = QRHI_RES(QD3D11Texture, b->u.simage.tex);
bd.simage.id = texD->m_id;
bd.simage.generation = texD->generation;
if (b->stage.testFlag(QRhiShaderResourceBinding::ComputeStage)) {
- ID3D11UnorderedAccessView *uav = texD->unorderedAccessViewForLevel(b->u.simage.level);
- if (uav)
- srbD->csUAVs.feed(b->binding, uav);
+ QPair<int, int> nativeBinding = mapBinding(b->binding, RBM_COMPUTE, nativeResourceBindingMaps);
+ if (nativeBinding.first >= 0) {
+ ID3D11UnorderedAccessView *uav = texD->unorderedAccessViewForLevel(b->u.simage.level);
+ if (uav)
+ res[RBM_COMPUTE].uavs.append({ nativeBinding.first, uav });
+ }
} else {
qWarning("Unordered access only supported at compute stage");
}
}
break;
case QRhiShaderResourceBinding::BufferLoad:
- Q_FALLTHROUGH();
case QRhiShaderResourceBinding::BufferStore:
- Q_FALLTHROUGH();
case QRhiShaderResourceBinding::BufferLoadStore:
{
QD3D11Buffer *bufD = QRHI_RES(QD3D11Buffer, b->u.sbuf.buf);
bd.sbuf.id = bufD->m_id;
bd.sbuf.generation = bufD->generation;
if (b->stage.testFlag(QRhiShaderResourceBinding::ComputeStage)) {
- ID3D11UnorderedAccessView *uav = bufD->unorderedAccessView();
- if (uav)
- srbD->csUAVs.feed(b->binding, uav);
+ QPair<int, int> nativeBinding = mapBinding(b->binding, RBM_COMPUTE, nativeResourceBindingMaps);
+ if (nativeBinding.first >= 0) {
+ ID3D11UnorderedAccessView *uav = bufD->unorderedAccessView(b->u.sbuf.offset);
+ if (uav)
+ res[RBM_COMPUTE].uavs.append({ nativeBinding.first, uav });
+ }
} else {
qWarning("Unordered access only supported at compute stage");
}
@@ -1919,33 +2477,45 @@ void QRhiD3D11::updateShaderResourceBindings(QD3D11ShaderResourceBindings *srbD)
}
}
- srbD->vsubufs.finish();
- srbD->vsubufoffsets.finish();
- srbD->vsubufsizes.finish();
-
- srbD->fsubufs.finish();
- srbD->fsubufoffsets.finish();
- srbD->fsubufsizes.finish();
-
- srbD->csubufs.finish();
- srbD->csubufoffsets.finish();
- srbD->csubufsizes.finish();
-
- srbD->vssamplers.finish();
- srbD->vsshaderresources.finish();
+ // QRhiBatchedBindings works with the native bindings and expects
+ // sorted input. The pre-sorted QRhiShaderResourceBinding list (based
+ // on the QRhi (SPIR-V) binding) is not helpful in this regard, so we
+ // have to sort here every time.
+ for (int stage = 0; stage < RBM_SUPPORTED_STAGES; ++stage) {
+ std::sort(res[stage].buffers.begin(), res[stage].buffers.end(), [](const Stage::Buffer &a, const Stage::Buffer &b) {
+ return a.breg < b.breg;
+ });
+ std::sort(res[stage].textures.begin(), res[stage].textures.end(), [](const Stage::Texture &a, const Stage::Texture &b) {
+ return a.treg < b.treg;
+ });
+ std::sort(res[stage].samplers.begin(), res[stage].samplers.end(), [](const Stage::Sampler &a, const Stage::Sampler &b) {
+ return a.sreg < b.sreg;
+ });
+ std::sort(res[stage].uavs.begin(), res[stage].uavs.end(), [](const Stage::Uav &a, const Stage::Uav &b) {
+ return a.ureg < b.ureg;
+ });
+ }
- srbD->fssamplers.finish();
- srbD->fsshaderresources.finish();
+ res[RBM_VERTEX].buildBufferBatches(srbD->vsUniformBufferBatches);
+ res[RBM_HULL].buildBufferBatches(srbD->hsUniformBufferBatches);
+ res[RBM_DOMAIN].buildBufferBatches(srbD->dsUniformBufferBatches);
+ res[RBM_GEOMETRY].buildBufferBatches(srbD->gsUniformBufferBatches);
+ res[RBM_FRAGMENT].buildBufferBatches(srbD->fsUniformBufferBatches);
+ res[RBM_COMPUTE].buildBufferBatches(srbD->csUniformBufferBatches);
- srbD->cssamplers.finish();
- srbD->csshaderresources.finish();
+ res[RBM_VERTEX].buildSamplerBatches(srbD->vsSamplerBatches);
+ res[RBM_HULL].buildSamplerBatches(srbD->hsSamplerBatches);
+ res[RBM_DOMAIN].buildSamplerBatches(srbD->dsSamplerBatches);
+ res[RBM_GEOMETRY].buildSamplerBatches(srbD->gsSamplerBatches);
+ res[RBM_FRAGMENT].buildSamplerBatches(srbD->fsSamplerBatches);
+ res[RBM_COMPUTE].buildSamplerBatches(srbD->csSamplerBatches);
- srbD->csUAVs.finish();
+ res[RBM_COMPUTE].buildUavBatches(srbD->csUavBatches);
}
-void QRhiD3D11::executeBufferHostWritesForCurrentFrame(QD3D11Buffer *bufD)
+void QRhiD3D11::executeBufferHostWrites(QD3D11Buffer *bufD)
{
- if (!bufD->hasPendingDynamicUpdates)
+ if (!bufD->hasPendingDynamicUpdates || bufD->m_size < 1)
return;
Q_ASSERT(bufD->m_type == QRhiBuffer::Dynamic);
@@ -1953,130 +2523,134 @@ void QRhiD3D11::executeBufferHostWritesForCurrentFrame(QD3D11Buffer *bufD)
D3D11_MAPPED_SUBRESOURCE mp;
HRESULT hr = context->Map(bufD->buffer, 0, D3D11_MAP_WRITE_DISCARD, 0, &mp);
if (SUCCEEDED(hr)) {
- memcpy(mp.pData, bufD->dynBuf.constData(), size_t(bufD->dynBuf.size()));
+ memcpy(mp.pData, bufD->dynBuf, bufD->m_size);
context->Unmap(bufD->buffer, 0);
} else {
- qWarning("Failed to map buffer: %s", qPrintable(comErrorMessage(hr)));
+ qWarning("Failed to map buffer: %s",
+ qPrintable(QSystemError::windowsComString(hr)));
}
}
-static void applyDynamicOffsets(QVarLengthArray<UINT, 4> *offsets,
+static void applyDynamicOffsets(UINT *offsets,
int batchIndex,
- QRhiBatchedBindings<ID3D11Buffer *> *ubufs,
- QRhiBatchedBindings<UINT> *ubufoffsets,
+ const QRhiBatchedBindings<UINT> *originalBindings,
+ const QRhiBatchedBindings<UINT> *staticOffsets,
const uint *dynOfsPairs, int dynOfsPairCount)
{
- const int count = ubufs->batches[batchIndex].resources.count();
- const UINT startBinding = ubufs->batches[batchIndex].startBinding;
- *offsets = ubufoffsets->batches[batchIndex].resources;
+ const int count = staticOffsets->batches[batchIndex].resources.count();
+ // Make a copy of the offset list, the entries that have no corresponding
+ // dynamic offset will continue to use the existing offset value.
for (int b = 0; b < count; ++b) {
+ offsets[b] = staticOffsets->batches[batchIndex].resources[b];
for (int di = 0; di < dynOfsPairCount; ++di) {
const uint binding = dynOfsPairs[2 * di];
- if (binding == startBinding + UINT(b)) {
+ // binding is the SPIR-V style binding point here, nothing to do
+ // with the native one.
+ if (binding == originalBindings->batches[batchIndex].resources[b]) {
const uint offsetInConstants = dynOfsPairs[2 * di + 1];
- (*offsets)[b] = offsetInConstants;
+ offsets[b] = offsetInConstants;
break;
}
}
}
}
-void QRhiD3D11::bindShaderResources(QD3D11ShaderResourceBindings *srbD,
- const uint *dynOfsPairs, int dynOfsPairCount,
- bool offsetOnlyChange)
+static inline uint clampedResourceCount(uint startSlot, int countSlots, uint maxSlots, const char *resType)
{
- if (!offsetOnlyChange) {
- for (const auto &batch : srbD->vssamplers.batches)
- context->VSSetSamplers(batch.startBinding, UINT(batch.resources.count()), batch.resources.constData());
-
- for (const auto &batch : srbD->vsshaderresources.batches) {
- context->VSSetShaderResources(batch.startBinding, UINT(batch.resources.count()), batch.resources.constData());
- contextState.vsHighestActiveSrvBinding = qMax<int>(contextState.vsHighestActiveSrvBinding,
- int(batch.startBinding) + batch.resources.count() - 1);
- }
-
- for (const auto &batch : srbD->fssamplers.batches)
- context->PSSetSamplers(batch.startBinding, UINT(batch.resources.count()), batch.resources.constData());
-
- for (const auto &batch : srbD->fsshaderresources.batches) {
- context->PSSetShaderResources(batch.startBinding, UINT(batch.resources.count()), batch.resources.constData());
- contextState.fsHighestActiveSrvBinding = qMax<int>(contextState.fsHighestActiveSrvBinding,
- int(batch.startBinding) + batch.resources.count() - 1);
- }
-
- for (const auto &batch : srbD->cssamplers.batches)
- context->CSSetSamplers(batch.startBinding, UINT(batch.resources.count()), batch.resources.constData());
-
- for (const auto &batch : srbD->csshaderresources.batches) {
- context->CSSetShaderResources(batch.startBinding, UINT(batch.resources.count()), batch.resources.constData());
- contextState.csHighestActiveSrvBinding = qMax<int>(contextState.csHighestActiveSrvBinding,
- int(batch.startBinding) + batch.resources.count() - 1);
- }
+ if (startSlot + countSlots > maxSlots) {
+ qWarning("Not enough D3D11 %s slots to bind %d resources starting at slot %d, max slots is %d",
+ resType, countSlots, startSlot, maxSlots);
+ countSlots = maxSlots > startSlot ? maxSlots - startSlot : 0;
}
-
- for (int i = 0, ie = srbD->vsubufs.batches.count(); i != ie; ++i) {
- if (!dynOfsPairCount) {
- context->VSSetConstantBuffers1(srbD->vsubufs.batches[i].startBinding,
- UINT(srbD->vsubufs.batches[i].resources.count()),
- srbD->vsubufs.batches[i].resources.constData(),
- srbD->vsubufoffsets.batches[i].resources.constData(),
- srbD->vsubufsizes.batches[i].resources.constData());
- } else {
- QVarLengthArray<UINT, 4> offsets;
- applyDynamicOffsets(&offsets, i, &srbD->vsubufs, &srbD->vsubufoffsets, dynOfsPairs, dynOfsPairCount);
- context->VSSetConstantBuffers1(srbD->vsubufs.batches[i].startBinding,
- UINT(srbD->vsubufs.batches[i].resources.count()),
- srbD->vsubufs.batches[i].resources.constData(),
- offsets.constData(),
- srbD->vsubufsizes.batches[i].resources.constData());
- }
+ return countSlots;
+}
+
+#define SETUBUFBATCH(stagePrefixL, stagePrefixU) \
+ if (srbD->stagePrefixL##UniformBufferBatches.present) { \
+ const QD3D11ShaderResourceBindings::StageUniformBufferBatches &batches(srbD->stagePrefixL##UniformBufferBatches); \
+ for (int i = 0, ie = batches.ubufs.batches.count(); i != ie; ++i) { \
+ const uint count = clampedResourceCount(batches.ubufs.batches[i].startBinding, \
+ batches.ubufs.batches[i].resources.count(), \
+ D3D11_COMMONSHADER_CONSTANT_BUFFER_API_SLOT_COUNT, \
+ #stagePrefixU " cbuf"); \
+ if (count) { \
+ if (!dynOfsPairCount) { \
+ context->stagePrefixU##SetConstantBuffers1(batches.ubufs.batches[i].startBinding, \
+ count, \
+ batches.ubufs.batches[i].resources.constData(), \
+ batches.ubufoffsets.batches[i].resources.constData(), \
+ batches.ubufsizes.batches[i].resources.constData()); \
+ } else { \
+ applyDynamicOffsets(offsets, i, \
+ &batches.ubuforigbindings, &batches.ubufoffsets, \
+ dynOfsPairs, dynOfsPairCount); \
+ context->stagePrefixU##SetConstantBuffers1(batches.ubufs.batches[i].startBinding, \
+ count, \
+ batches.ubufs.batches[i].resources.constData(), \
+ offsets, \
+ batches.ubufsizes.batches[i].resources.constData()); \
+ } \
+ } \
+ } \
}
- for (int i = 0, ie = srbD->fsubufs.batches.count(); i != ie; ++i) {
- if (!dynOfsPairCount) {
- context->PSSetConstantBuffers1(srbD->fsubufs.batches[i].startBinding,
- UINT(srbD->fsubufs.batches[i].resources.count()),
- srbD->fsubufs.batches[i].resources.constData(),
- srbD->fsubufoffsets.batches[i].resources.constData(),
- srbD->fsubufsizes.batches[i].resources.constData());
- } else {
- QVarLengthArray<UINT, 4> offsets;
- applyDynamicOffsets(&offsets, i, &srbD->fsubufs, &srbD->fsubufoffsets, dynOfsPairs, dynOfsPairCount);
- context->PSSetConstantBuffers1(srbD->fsubufs.batches[i].startBinding,
- UINT(srbD->fsubufs.batches[i].resources.count()),
- srbD->fsubufs.batches[i].resources.constData(),
- offsets.constData(),
- srbD->fsubufsizes.batches[i].resources.constData());
- }
+#define SETSAMPLERBATCH(stagePrefixL, stagePrefixU) \
+ if (srbD->stagePrefixL##SamplerBatches.present) { \
+ for (const auto &batch : srbD->stagePrefixL##SamplerBatches.samplers.batches) { \
+ const uint count = clampedResourceCount(batch.startBinding, batch.resources.count(), \
+ D3D11_COMMONSHADER_SAMPLER_SLOT_COUNT, #stagePrefixU " sampler"); \
+ if (count) \
+ context->stagePrefixU##SetSamplers(batch.startBinding, count, batch.resources.constData()); \
+ } \
+ for (const auto &batch : srbD->stagePrefixL##SamplerBatches.shaderresources.batches) { \
+ const uint count = clampedResourceCount(batch.startBinding, batch.resources.count(), \
+ D3D11_COMMONSHADER_INPUT_RESOURCE_SLOT_COUNT, #stagePrefixU " SRV"); \
+ if (count) { \
+ context->stagePrefixU##SetShaderResources(batch.startBinding, count, batch.resources.constData()); \
+ contextState.stagePrefixL##HighestActiveSrvBinding = qMax(contextState.stagePrefixL##HighestActiveSrvBinding, \
+ int(batch.startBinding + count) - 1); \
+ } \
+ } \
}
- for (int i = 0, ie = srbD->csubufs.batches.count(); i != ie; ++i) {
- if (!dynOfsPairCount) {
- context->CSSetConstantBuffers1(srbD->csubufs.batches[i].startBinding,
- UINT(srbD->csubufs.batches[i].resources.count()),
- srbD->csubufs.batches[i].resources.constData(),
- srbD->csubufoffsets.batches[i].resources.constData(),
- srbD->csubufsizes.batches[i].resources.constData());
- } else {
- QVarLengthArray<UINT, 4> offsets;
- applyDynamicOffsets(&offsets, i, &srbD->csubufs, &srbD->csubufoffsets, dynOfsPairs, dynOfsPairCount);
- context->CSSetConstantBuffers1(srbD->csubufs.batches[i].startBinding,
- UINT(srbD->csubufs.batches[i].resources.count()),
- srbD->csubufs.batches[i].resources.constData(),
- offsets.constData(),
- srbD->csubufsizes.batches[i].resources.constData());
- }
+#define SETUAVBATCH(stagePrefixL, stagePrefixU) \
+ if (srbD->stagePrefixL##UavBatches.present) { \
+ for (const auto &batch : srbD->stagePrefixL##UavBatches.uavs.batches) { \
+ const uint count = clampedResourceCount(batch.startBinding, batch.resources.count(), \
+ D3D11_1_UAV_SLOT_COUNT, #stagePrefixU " UAV"); \
+ if (count) { \
+ context->stagePrefixU##SetUnorderedAccessViews(batch.startBinding, \
+ count, \
+ batch.resources.constData(), \
+ nullptr); \
+ contextState.stagePrefixL##HighestActiveUavBinding = qMax(contextState.stagePrefixL##HighestActiveUavBinding, \
+ int(batch.startBinding + count) - 1); \
+ } \
+ } \
}
- for (int i = 0, ie = srbD->csUAVs.batches.count(); i != ie; ++i) {
- const uint startBinding = srbD->csUAVs.batches[i].startBinding;
- const uint count = uint(srbD->csUAVs.batches[i].resources.count());
- context->CSSetUnorderedAccessViews(startBinding,
- count,
- srbD->csUAVs.batches[i].resources.constData(),
- nullptr);
- contextState.csHighestActiveUavBinding = qMax<int>(contextState.csHighestActiveUavBinding,
- int(startBinding + count - 1));
+void QRhiD3D11::bindShaderResources(QD3D11ShaderResourceBindings *srbD,
+ const uint *dynOfsPairs, int dynOfsPairCount,
+ bool offsetOnlyChange)
+{
+ UINT offsets[QD3D11CommandBuffer::MAX_DYNAMIC_OFFSET_COUNT];
+
+ SETUBUFBATCH(vs, VS)
+ SETUBUFBATCH(hs, HS)
+ SETUBUFBATCH(ds, DS)
+ SETUBUFBATCH(gs, GS)
+ SETUBUFBATCH(fs, PS)
+ SETUBUFBATCH(cs, CS)
+
+ if (!offsetOnlyChange) {
+ SETSAMPLERBATCH(vs, VS)
+ SETSAMPLERBATCH(hs, HS)
+ SETSAMPLERBATCH(ds, DS)
+ SETSAMPLERBATCH(gs, GS)
+ SETSAMPLERBATCH(fs, PS)
+ SETSAMPLERBATCH(cs, CS)
+
+ SETUAVBATCH(cs, CS)
}
}
@@ -2105,6 +2679,9 @@ void QRhiD3D11::resetShaderResources()
}
int nullsrvCount = qMax(contextState.vsHighestActiveSrvBinding, contextState.fsHighestActiveSrvBinding);
+ nullsrvCount = qMax(nullsrvCount, contextState.hsHighestActiveSrvBinding);
+ nullsrvCount = qMax(nullsrvCount, contextState.dsHighestActiveSrvBinding);
+ nullsrvCount = qMax(nullsrvCount, contextState.gsHighestActiveSrvBinding);
nullsrvCount = qMax(nullsrvCount, contextState.csHighestActiveSrvBinding);
nullsrvCount += 1;
if (nullsrvCount > 0) {
@@ -2116,6 +2693,18 @@ void QRhiD3D11::resetShaderResources()
context->VSSetShaderResources(0, UINT(contextState.vsHighestActiveSrvBinding + 1), nullsrvs.constData());
contextState.vsHighestActiveSrvBinding = -1;
}
+ if (contextState.hsHighestActiveSrvBinding >= 0) {
+ context->HSSetShaderResources(0, UINT(contextState.hsHighestActiveSrvBinding + 1), nullsrvs.constData());
+ contextState.hsHighestActiveSrvBinding = -1;
+ }
+ if (contextState.dsHighestActiveSrvBinding >= 0) {
+ context->DSSetShaderResources(0, UINT(contextState.dsHighestActiveSrvBinding + 1), nullsrvs.constData());
+ contextState.dsHighestActiveSrvBinding = -1;
+ }
+ if (contextState.gsHighestActiveSrvBinding >= 0) {
+ context->GSSetShaderResources(0, UINT(contextState.gsHighestActiveSrvBinding + 1), nullsrvs.constData());
+ contextState.gsHighestActiveSrvBinding = -1;
+ }
if (contextState.fsHighestActiveSrvBinding >= 0) {
context->PSSetShaderResources(0, UINT(contextState.fsHighestActiveSrvBinding + 1), nullsrvs.constData());
contextState.fsHighestActiveSrvBinding = -1;
@@ -2137,30 +2726,52 @@ void QRhiD3D11::resetShaderResources()
}
}
-void QRhiD3D11::executeCommandBuffer(QD3D11CommandBuffer *cbD, QD3D11SwapChain *timestampSwapChain)
+#define SETSHADER(StageL, StageU) \
+ if (psD->StageL.shader) { \
+ context->StageU##SetShader(psD->StageL.shader, nullptr, 0); \
+ currentShaderMask |= StageU##MaskBit; \
+ } else if (currentShaderMask & StageU##MaskBit) { \
+ context->StageU##SetShader(nullptr, nullptr, 0); \
+ currentShaderMask &= ~StageU##MaskBit; \
+ }
+
+void QRhiD3D11::executeCommandBuffer(QD3D11CommandBuffer *cbD)
{
quint32 stencilRef = 0;
float blendConstants[] = { 1, 1, 1, 1 };
-
- if (timestampSwapChain) {
- const int currentFrameSlot = timestampSwapChain->currentFrameSlot;
- ID3D11Query *tsDisjoint = timestampSwapChain->timestampDisjointQuery[currentFrameSlot];
- const int tsIdx = QD3D11SwapChain::BUFFER_COUNT * currentFrameSlot;
- ID3D11Query *tsStart = timestampSwapChain->timestampQuery[tsIdx];
- if (tsDisjoint && tsStart && !timestampSwapChain->timestampActive[currentFrameSlot]) {
- // The timestamps seem to include vsync time with Present(1), except
- // when running on a non-primary gpu. This is not ideal. So try working
- // it around by issuing a semi-fake OMSetRenderTargets early and
- // writing the first timestamp only afterwards.
- context->Begin(tsDisjoint);
- QD3D11RenderTargetData *rtD = rtData(&timestampSwapChain->rt);
- context->OMSetRenderTargets(UINT(rtD->colorAttCount), rtD->colorAttCount ? rtD->rtv : nullptr, rtD->dsv);
- context->End(tsStart); // just record a timestamp, no Begin needed
- }
- }
-
- for (const QD3D11CommandBuffer::Command &cmd : qAsConst(cbD->commands)) {
+ enum ActiveShaderMask {
+ VSMaskBit = 0x01,
+ HSMaskBit = 0x02,
+ DSMaskBit = 0x04,
+ GSMaskBit = 0x08,
+ PSMaskBit = 0x10
+ };
+ int currentShaderMask = 0xFF;
+
+ for (auto it = cbD->commands.cbegin(), end = cbD->commands.cend(); it != end; ++it) {
+ const QD3D11CommandBuffer::Command &cmd(*it);
switch (cmd.cmd) {
+ case QD3D11CommandBuffer::Command::BeginFrame:
+ if (cmd.args.beginFrame.tsDisjointQuery)
+ context->Begin(cmd.args.beginFrame.tsDisjointQuery);
+ if (cmd.args.beginFrame.tsQuery) {
+ if (cmd.args.beginFrame.swapchainData) {
+ // The timestamps seem to include vsync time with Present(1), except
+ // when running on a non-primary gpu. This is not ideal. So try working
+ // it around by issuing a semi-fake OMSetRenderTargets early and
+ // writing the first timestamp only afterwards.
+ QD3D11RenderTargetData *rtD = cmd.args.beginFrame.swapchainData;
+ context->OMSetRenderTargets(UINT(rtD->colorAttCount), rtD->colorAttCount ? rtD->rtv : nullptr, rtD->dsv);
+ }
+ context->End(cmd.args.beginFrame.tsQuery); // no Begin() for D3D11_QUERY_TIMESTAMP
+ }
+ break;
+ case QD3D11CommandBuffer::Command::EndFrame:
+ if (cmd.args.endFrame.tsQuery)
+ context->End(cmd.args.endFrame.tsQuery);
+ if (cmd.args.endFrame.tsDisjointQuery)
+ context->End(cmd.args.endFrame.tsDisjointQuery);
+ break;
case QD3D11CommandBuffer::Command::ResetShaderResources:
resetShaderResources();
break;
@@ -2228,10 +2839,13 @@ void QRhiD3D11::executeCommandBuffer(QD3D11CommandBuffer *cbD, QD3D11SwapChain *
case QD3D11CommandBuffer::Command::BindGraphicsPipeline:
{
QD3D11GraphicsPipeline *psD = cmd.args.bindGraphicsPipeline.ps;
- context->VSSetShader(psD->vs, nullptr, 0);
- context->PSSetShader(psD->fs, nullptr, 0);
+ SETSHADER(vs, VS)
+ SETSHADER(hs, HS)
+ SETSHADER(ds, DS)
+ SETSHADER(gs, GS)
+ SETSHADER(fs, PS)
context->IASetPrimitiveTopology(psD->d3dTopology);
- context->IASetInputLayout(psD->inputLayout);
+ context->IASetInputLayout(psD->inputLayout); // may be null, that's ok
context->OMSetDepthStencilState(psD->dsState, stencilRef);
context->OMSetBlendState(psD->blendState, blendConstants, 0xffffffff);
context->RSSetState(psD->rastState);
@@ -2282,7 +2896,7 @@ void QRhiD3D11::executeCommandBuffer(QD3D11CommandBuffer *cbD, QD3D11SwapChain *
break;
case QD3D11CommandBuffer::Command::CopySubRes:
context->CopySubresourceRegion(cmd.args.copySubRes.dst, cmd.args.copySubRes.dstSubRes,
- cmd.args.copySubRes.dstX, cmd.args.copySubRes.dstY, 0,
+ cmd.args.copySubRes.dstX, cmd.args.copySubRes.dstY, cmd.args.copySubRes.dstZ,
cmd.args.copySubRes.src, cmd.args.copySubRes.srcSubRes,
cmd.args.copySubRes.hasSrcBox ? &cmd.args.copySubRes.srcBox : nullptr);
break;
@@ -2304,7 +2918,7 @@ void QRhiD3D11::executeCommandBuffer(QD3D11CommandBuffer *cbD, QD3D11SwapChain *
annotations->SetMarker(reinterpret_cast<LPCWSTR>(QString::fromLatin1(cmd.args.debugMark.s).utf16()));
break;
case QD3D11CommandBuffer::Command::BindComputePipeline:
- context->CSSetShader(cmd.args.bindComputePipeline.ps->cs, nullptr, 0);
+ context->CSSetShader(cmd.args.bindComputePipeline.ps->cs.shader, nullptr, 0);
break;
case QD3D11CommandBuffer::Command::Dispatch:
context->Dispatch(cmd.args.dispatch.x, cmd.args.dispatch.y, cmd.args.dispatch.z);
@@ -2315,35 +2929,34 @@ void QRhiD3D11::executeCommandBuffer(QD3D11CommandBuffer *cbD, QD3D11SwapChain *
}
}
-QD3D11Buffer::QD3D11Buffer(QRhiImplementation *rhi, Type type, UsageFlags usage, int size)
+QD3D11Buffer::QD3D11Buffer(QRhiImplementation *rhi, Type type, UsageFlags usage, quint32 size)
: QRhiBuffer(rhi, type, usage, size)
{
}
QD3D11Buffer::~QD3D11Buffer()
{
- release();
+ destroy();
}
-void QD3D11Buffer::release()
+void QD3D11Buffer::destroy()
{
if (!buffer)
return;
- dynBuf.clear();
-
buffer->Release();
buffer = nullptr;
- if (uav) {
- uav->Release();
- uav = nullptr;
- }
+ delete[] dynBuf;
+ dynBuf = nullptr;
+
+ for (auto it = uavs.begin(), end = uavs.end(); it != end; ++it)
+ it.value()->Release();
+ uavs.clear();
QRHI_RES_RHI(QRhiD3D11);
- QRHI_PROF;
- QRHI_PROF_F(releaseBuffer(this));
- rhiD->unregisterResource(this);
+ if (rhiD)
+ rhiD->unregisterResource(this);
}
static inline uint toD3DBufferUsage(QRhiBuffer::UsageFlags usage)
@@ -2360,10 +2973,10 @@ static inline uint toD3DBufferUsage(QRhiBuffer::UsageFlags usage)
return uint(u);
}
-bool QD3D11Buffer::build()
+bool QD3D11Buffer::create()
{
if (buffer)
- release();
+ destroy();
if (m_usage.testFlag(QRhiBuffer::UniformBuffer) && m_type != Dynamic) {
qWarning("UniformBuffer must always be combined with Dynamic on D3D11");
@@ -2375,12 +2988,11 @@ bool QD3D11Buffer::build()
return false;
}
- const int nonZeroSize = m_size <= 0 ? 256 : m_size;
- const int roundedSize = aligned(nonZeroSize, m_usage.testFlag(QRhiBuffer::UniformBuffer) ? 256 : 4);
+ const quint32 nonZeroSize = m_size <= 0 ? 256 : m_size;
+ const quint32 roundedSize = aligned(nonZeroSize, m_usage.testFlag(QRhiBuffer::UniformBuffer) ? 256u : 4u);
- D3D11_BUFFER_DESC desc;
- memset(&desc, 0, sizeof(desc));
- desc.ByteWidth = UINT(roundedSize);
+ D3D11_BUFFER_DESC desc = {};
+ desc.ByteWidth = roundedSize;
desc.Usage = m_type == Dynamic ? D3D11_USAGE_DYNAMIC : D3D11_USAGE_DEFAULT;
desc.BindFlags = toD3DBufferUsage(m_usage);
desc.CPUAccessFlags = m_type == Dynamic ? D3D11_CPU_ACCESS_WRITE : 0;
@@ -2389,62 +3001,99 @@ bool QD3D11Buffer::build()
QRHI_RES_RHI(QRhiD3D11);
HRESULT hr = rhiD->dev->CreateBuffer(&desc, nullptr, &buffer);
if (FAILED(hr)) {
- qWarning("Failed to create buffer: %s", qPrintable(comErrorMessage(hr)));
+ qWarning("Failed to create buffer: %s",
+ qPrintable(QSystemError::windowsComString(hr)));
return false;
}
if (m_type == Dynamic) {
- dynBuf.resize(m_size);
+ dynBuf = new char[nonZeroSize];
hasPendingDynamicUpdates = false;
}
if (!m_objectName.isEmpty())
buffer->SetPrivateData(WKPDID_D3DDebugObjectName, UINT(m_objectName.size()), m_objectName.constData());
- QRHI_PROF;
- QRHI_PROF_F(newBuffer(this, quint32(roundedSize), m_type == Dynamic ? 2 : 1, m_type == Dynamic ? 1 : 0));
-
generation += 1;
rhiD->registerResource(this);
return true;
}
-ID3D11UnorderedAccessView *QD3D11Buffer::unorderedAccessView()
+QRhiBuffer::NativeBuffer QD3D11Buffer::nativeBuffer()
+{
+ if (m_type == Dynamic) {
+ QRHI_RES_RHI(QRhiD3D11);
+ rhiD->executeBufferHostWrites(this);
+ }
+ return { { &buffer }, 1 };
+}
+
+char *QD3D11Buffer::beginFullDynamicBufferUpdateForCurrentFrame()
+{
+ // Shortcut the entire buffer update mechanism and allow the client to do
+ // the host writes directly to the buffer. This will lead to unexpected
+ // results when combined with QRhiResourceUpdateBatch-based updates for the
+ // buffer, since dynBuf is left untouched and out of sync, but provides a
+ // fast path for dynamic buffers that have all their content changed in
+ // every frame.
+ Q_ASSERT(m_type == Dynamic);
+ D3D11_MAPPED_SUBRESOURCE mp;
+ QRHI_RES_RHI(QRhiD3D11);
+ HRESULT hr = rhiD->context->Map(buffer, 0, D3D11_MAP_WRITE_DISCARD, 0, &mp);
+ if (FAILED(hr)) {
+ qWarning("Failed to map buffer: %s",
+ qPrintable(QSystemError::windowsComString(hr)));
+ return nullptr;
+ }
+ return static_cast<char *>(mp.pData);
+}
+
+void QD3D11Buffer::endFullDynamicBufferUpdateForCurrentFrame()
{
- if (uav)
- return uav;
+ QRHI_RES_RHI(QRhiD3D11);
+ rhiD->context->Unmap(buffer, 0);
+}
+
+ID3D11UnorderedAccessView *QD3D11Buffer::unorderedAccessView(quint32 offset)
+{
+ auto it = uavs.find(offset);
+ if (it != uavs.end())
+ return it.value();
// SPIRV-Cross generated HLSL uses RWByteAddressBuffer
- D3D11_UNORDERED_ACCESS_VIEW_DESC desc;
- memset(&desc, 0, sizeof(desc));
+ D3D11_UNORDERED_ACCESS_VIEW_DESC desc = {};
desc.Format = DXGI_FORMAT_R32_TYPELESS;
desc.ViewDimension = D3D11_UAV_DIMENSION_BUFFER;
- desc.Buffer.FirstElement = 0;
- desc.Buffer.NumElements = UINT(aligned(m_size, 4) / 4);
+ desc.Buffer.FirstElement = offset / 4u;
+ desc.Buffer.NumElements = aligned(m_size - offset, 4u) / 4u;
desc.Buffer.Flags = D3D11_BUFFER_UAV_FLAG_RAW;
QRHI_RES_RHI(QRhiD3D11);
+ ID3D11UnorderedAccessView *uav = nullptr;
HRESULT hr = rhiD->dev->CreateUnorderedAccessView(buffer, &desc, &uav);
if (FAILED(hr)) {
- qWarning("Failed to create UAV: %s", qPrintable(comErrorMessage(hr)));
+ qWarning("Failed to create UAV: %s",
+ qPrintable(QSystemError::windowsComString(hr)));
return nullptr;
}
+ uavs[offset] = uav;
return uav;
}
QD3D11RenderBuffer::QD3D11RenderBuffer(QRhiImplementation *rhi, Type type, const QSize &pixelSize,
- int sampleCount, QRhiRenderBuffer::Flags flags)
- : QRhiRenderBuffer(rhi, type, pixelSize, sampleCount, flags)
+ int sampleCount, QRhiRenderBuffer::Flags flags,
+ QRhiTexture::Format backingFormatHint)
+ : QRhiRenderBuffer(rhi, type, pixelSize, sampleCount, flags, backingFormatHint)
{
}
QD3D11RenderBuffer::~QD3D11RenderBuffer()
{
- release();
+ destroy();
}
-void QD3D11RenderBuffer::release()
+void QD3D11RenderBuffer::destroy()
{
if (!tex)
return;
@@ -2463,24 +3112,22 @@ void QD3D11RenderBuffer::release()
tex = nullptr;
QRHI_RES_RHI(QRhiD3D11);
- QRHI_PROF;
- QRHI_PROF_F(releaseRenderBuffer(this));
- rhiD->unregisterResource(this);
+ if (rhiD)
+ rhiD->unregisterResource(this);
}
-bool QD3D11RenderBuffer::build()
+bool QD3D11RenderBuffer::create()
{
if (tex)
- release();
+ destroy();
if (m_pixelSize.isEmpty())
return false;
QRHI_RES_RHI(QRhiD3D11);
- sampleDesc = rhiD->effectiveSampleCount(m_sampleCount);
+ sampleDesc = rhiD->effectiveSampleDesc(m_sampleCount);
- D3D11_TEXTURE2D_DESC desc;
- memset(&desc, 0, sizeof(desc));
+ D3D11_TEXTURE2D_DESC desc = {};
desc.Width = UINT(m_pixelSize.width());
desc.Height = UINT(m_pixelSize.height());
desc.MipLevels = 1;
@@ -2489,22 +3136,24 @@ bool QD3D11RenderBuffer::build()
desc.Usage = D3D11_USAGE_DEFAULT;
if (m_type == Color) {
- dxgiFormat = DXGI_FORMAT_R8G8B8A8_UNORM;
+ dxgiFormat = m_backingFormatHint == QRhiTexture::UnknownFormat ? DXGI_FORMAT_R8G8B8A8_UNORM
+ : toD3DTextureFormat(m_backingFormatHint, {});
desc.Format = dxgiFormat;
desc.BindFlags = D3D11_BIND_RENDER_TARGET;
HRESULT hr = rhiD->dev->CreateTexture2D(&desc, nullptr, &tex);
if (FAILED(hr)) {
- qWarning("Failed to create color renderbuffer: %s", qPrintable(comErrorMessage(hr)));
+ qWarning("Failed to create color renderbuffer: %s",
+ qPrintable(QSystemError::windowsComString(hr)));
return false;
}
- D3D11_RENDER_TARGET_VIEW_DESC rtvDesc;
- memset(&rtvDesc, 0, sizeof(rtvDesc));
+ D3D11_RENDER_TARGET_VIEW_DESC rtvDesc = {};
rtvDesc.Format = dxgiFormat;
rtvDesc.ViewDimension = desc.SampleDesc.Count > 1 ? D3D11_RTV_DIMENSION_TEXTURE2DMS
: D3D11_RTV_DIMENSION_TEXTURE2D;
hr = rhiD->dev->CreateRenderTargetView(tex, &rtvDesc, &rtv);
if (FAILED(hr)) {
- qWarning("Failed to create rtv: %s", qPrintable(comErrorMessage(hr)));
+ qWarning("Failed to create rtv: %s",
+ qPrintable(QSystemError::windowsComString(hr)));
return false;
}
} else if (m_type == DepthStencil) {
@@ -2513,17 +3162,18 @@ bool QD3D11RenderBuffer::build()
desc.BindFlags = D3D11_BIND_DEPTH_STENCIL;
HRESULT hr = rhiD->dev->CreateTexture2D(&desc, nullptr, &tex);
if (FAILED(hr)) {
- qWarning("Failed to create depth-stencil buffer: %s", qPrintable(comErrorMessage(hr)));
+ qWarning("Failed to create depth-stencil buffer: %s",
+ qPrintable(QSystemError::windowsComString(hr)));
return false;
}
- D3D11_DEPTH_STENCIL_VIEW_DESC dsvDesc;
- memset(&dsvDesc, 0, sizeof(dsvDesc));
+ D3D11_DEPTH_STENCIL_VIEW_DESC dsvDesc = {};
dsvDesc.Format = dxgiFormat;
dsvDesc.ViewDimension = desc.SampleDesc.Count > 1 ? D3D11_DSV_DIMENSION_TEXTURE2DMS
: D3D11_DSV_DIMENSION_TEXTURE2D;
hr = rhiD->dev->CreateDepthStencilView(tex, &dsvDesc, &dsv);
if (FAILED(hr)) {
- qWarning("Failed to create dsv: %s", qPrintable(comErrorMessage(hr)));
+ qWarning("Failed to create dsv: %s",
+ qPrintable(QSystemError::windowsComString(hr)));
return false;
}
} else {
@@ -2533,34 +3183,35 @@ bool QD3D11RenderBuffer::build()
if (!m_objectName.isEmpty())
tex->SetPrivateData(WKPDID_D3DDebugObjectName, UINT(m_objectName.size()), m_objectName.constData());
- QRHI_PROF;
- QRHI_PROF_F(newRenderBuffer(this, false, false, int(sampleDesc.Count)));
-
+ generation += 1;
rhiD->registerResource(this);
return true;
}
QRhiTexture::Format QD3D11RenderBuffer::backingFormat() const
{
- return m_type == Color ? QRhiTexture::RGBA8 : QRhiTexture::UnknownFormat;
+ if (m_backingFormatHint != QRhiTexture::UnknownFormat)
+ return m_backingFormatHint;
+ else
+ return m_type == Color ? QRhiTexture::RGBA8 : QRhiTexture::UnknownFormat;
}
-QD3D11Texture::QD3D11Texture(QRhiImplementation *rhi, Format format, const QSize &pixelSize,
- int sampleCount, Flags flags)
- : QRhiTexture(rhi, format, pixelSize, sampleCount, flags)
+QD3D11Texture::QD3D11Texture(QRhiImplementation *rhi, Format format, const QSize &pixelSize, int depth,
+ int arraySize, int sampleCount, Flags flags)
+ : QRhiTexture(rhi, format, pixelSize, depth, arraySize, sampleCount, flags)
{
- for (int i = 0; i < QRhi::MAX_LEVELS; ++i)
+ for (int i = 0; i < QRhi::MAX_MIP_LEVELS; ++i)
perLevelViews[i] = nullptr;
}
QD3D11Texture::~QD3D11Texture()
{
- release();
+ destroy();
}
-void QD3D11Texture::release()
+void QD3D11Texture::destroy()
{
- if (!tex)
+ if (!tex && !tex3D && !tex1D)
return;
if (srv) {
@@ -2568,22 +3219,29 @@ void QD3D11Texture::release()
srv = nullptr;
}
- for (int i = 0; i < QRhi::MAX_LEVELS; ++i) {
+ for (int i = 0; i < QRhi::MAX_MIP_LEVELS; ++i) {
if (perLevelViews[i]) {
perLevelViews[i]->Release();
perLevelViews[i] = nullptr;
}
}
- if (owns)
- tex->Release();
+ if (owns) {
+ if (tex)
+ tex->Release();
+ if (tex3D)
+ tex3D->Release();
+ if (tex1D)
+ tex1D->Release();
+ }
tex = nullptr;
+ tex3D = nullptr;
+ tex1D = nullptr;
QRHI_RES_RHI(QRhiD3D11);
- QRHI_PROF;
- QRHI_PROF_F(releaseTexture(this));
- rhiD->unregisterResource(this);
+ if (rhiD)
+ rhiD->unregisterResource(this);
}
static inline DXGI_FORMAT toD3DDepthTextureSRVFormat(QRhiTexture::Format format)
@@ -2591,6 +3249,10 @@ static inline DXGI_FORMAT toD3DDepthTextureSRVFormat(QRhiTexture::Format format)
switch (format) {
case QRhiTexture::Format::D16:
return DXGI_FORMAT_R16_FLOAT;
+ case QRhiTexture::Format::D24:
+ return DXGI_FORMAT_R24_UNORM_X8_TYPELESS;
+ case QRhiTexture::Format::D24S8:
+ return DXGI_FORMAT_R24_UNORM_X8_TYPELESS;
case QRhiTexture::Format::D32F:
return DXGI_FORMAT_R32_FLOAT;
default:
@@ -2604,6 +3266,10 @@ static inline DXGI_FORMAT toD3DDepthTextureDSVFormat(QRhiTexture::Format format)
switch (format) {
case QRhiTexture::Format::D16:
return DXGI_FORMAT_D16_UNORM;
+ case QRhiTexture::Format::D24:
+ return DXGI_FORMAT_D24_UNORM_S8_UINT;
+ case QRhiTexture::Format::D24S8:
+ return DXGI_FORMAT_D24_UNORM_S8_UINT;
case QRhiTexture::Format::D32F:
return DXGI_FORMAT_D32_FLOAT;
default:
@@ -2612,25 +3278,34 @@ static inline DXGI_FORMAT toD3DDepthTextureDSVFormat(QRhiTexture::Format format)
}
}
-bool QD3D11Texture::prepareBuild(QSize *adjustedSize)
+bool QD3D11Texture::prepareCreate(QSize *adjustedSize)
{
- if (tex)
- release();
+ if (tex || tex3D || tex1D)
+ destroy();
- const QSize size = m_pixelSize.isEmpty() ? QSize(1, 1) : m_pixelSize;
const bool isDepth = isDepthTextureFormat(m_format);
const bool isCube = m_flags.testFlag(CubeMap);
+ const bool is3D = m_flags.testFlag(ThreeDimensional);
+ const bool isArray = m_flags.testFlag(TextureArray);
const bool hasMipMaps = m_flags.testFlag(MipMapped);
+ const bool is1D = m_flags.testFlag(OneDimensional);
+
+ const QSize size = is1D ? QSize(qMax(1, m_pixelSize.width()), 1)
+ : (m_pixelSize.isEmpty() ? QSize(1, 1) : m_pixelSize);
QRHI_RES_RHI(QRhiD3D11);
dxgiFormat = toD3DTextureFormat(m_format, m_flags);
mipLevelCount = uint(hasMipMaps ? rhiD->q->mipLevelsForSize(size) : 1);
- sampleDesc = rhiD->effectiveSampleCount(m_sampleCount);
+ sampleDesc = rhiD->effectiveSampleDesc(m_sampleCount);
if (sampleDesc.Count > 1) {
if (isCube) {
qWarning("Cubemap texture cannot be multisample");
return false;
}
+ if (is3D) {
+ qWarning("3D texture cannot be multisample");
+ return false;
+ }
if (hasMipMaps) {
qWarning("Multisample texture cannot have mipmaps");
return false;
@@ -2640,6 +3315,34 @@ bool QD3D11Texture::prepareBuild(QSize *adjustedSize)
qWarning("Depth texture cannot have mipmaps");
return false;
}
+ if (isCube && is3D) {
+ qWarning("Texture cannot be both cube and 3D");
+ return false;
+ }
+ if (isArray && is3D) {
+ qWarning("Texture cannot be both array and 3D");
+ return false;
+ }
+ if (isCube && is1D) {
+ qWarning("Texture cannot be both cube and 1D");
+ return false;
+ }
+ if (is1D && is3D) {
+ qWarning("Texture cannot be both 1D and 3D");
+ return false;
+ }
+ if (m_depth > 1 && !is3D) {
+ qWarning("Texture cannot have a depth of %d when it is not 3D", m_depth);
+ return false;
+ }
+ if (m_arraySize > 0 && !isArray) {
+ qWarning("Texture cannot have an array size of %d when it is not an array", m_arraySize);
+ return false;
+ }
+ if (m_arraySize < 1 && isArray) {
+ qWarning("Texture is an array but array size is %d", m_arraySize);
+ return false;
+ }
if (adjustedSize)
*adjustedSize = size;
@@ -2647,47 +3350,92 @@ bool QD3D11Texture::prepareBuild(QSize *adjustedSize)
return true;
}
-bool QD3D11Texture::finishBuild()
+bool QD3D11Texture::finishCreate()
{
QRHI_RES_RHI(QRhiD3D11);
const bool isDepth = isDepthTextureFormat(m_format);
const bool isCube = m_flags.testFlag(CubeMap);
+ const bool is3D = m_flags.testFlag(ThreeDimensional);
+ const bool isArray = m_flags.testFlag(TextureArray);
+ const bool is1D = m_flags.testFlag(OneDimensional);
- D3D11_SHADER_RESOURCE_VIEW_DESC srvDesc;
- memset(&srvDesc, 0, sizeof(srvDesc));
+ D3D11_SHADER_RESOURCE_VIEW_DESC srvDesc = {};
srvDesc.Format = isDepth ? toD3DDepthTextureSRVFormat(m_format) : dxgiFormat;
if (isCube) {
srvDesc.ViewDimension = D3D11_SRV_DIMENSION_TEXTURECUBE;
srvDesc.TextureCube.MipLevels = mipLevelCount;
} else {
- if (sampleDesc.Count > 1) {
- srvDesc.ViewDimension = D3D11_SRV_DIMENSION_TEXTURE2DMS;
+ if (is1D) {
+ if (isArray) {
+ srvDesc.ViewDimension = D3D11_SRV_DIMENSION_TEXTURE1DARRAY;
+ srvDesc.Texture1DArray.MipLevels = mipLevelCount;
+ if (m_arrayRangeStart >= 0 && m_arrayRangeLength >= 0) {
+ srvDesc.Texture1DArray.FirstArraySlice = UINT(m_arrayRangeStart);
+ srvDesc.Texture1DArray.ArraySize = UINT(m_arrayRangeLength);
+ } else {
+ srvDesc.Texture1DArray.FirstArraySlice = 0;
+ srvDesc.Texture1DArray.ArraySize = UINT(qMax(0, m_arraySize));
+ }
+ } else {
+ srvDesc.ViewDimension = D3D11_SRV_DIMENSION_TEXTURE1D;
+ srvDesc.Texture1D.MipLevels = mipLevelCount;
+ }
+ } else if (isArray) {
+ if (sampleDesc.Count > 1) {
+ srvDesc.ViewDimension = D3D11_SRV_DIMENSION_TEXTURE2DMSARRAY;
+ if (m_arrayRangeStart >= 0 && m_arrayRangeLength >= 0) {
+ srvDesc.Texture2DMSArray.FirstArraySlice = UINT(m_arrayRangeStart);
+ srvDesc.Texture2DMSArray.ArraySize = UINT(m_arrayRangeLength);
+ } else {
+ srvDesc.Texture2DMSArray.FirstArraySlice = 0;
+ srvDesc.Texture2DMSArray.ArraySize = UINT(qMax(0, m_arraySize));
+ }
+ } else {
+ srvDesc.ViewDimension = D3D11_SRV_DIMENSION_TEXTURE2DARRAY;
+ srvDesc.Texture2DArray.MipLevels = mipLevelCount;
+ if (m_arrayRangeStart >= 0 && m_arrayRangeLength >= 0) {
+ srvDesc.Texture2DArray.FirstArraySlice = UINT(m_arrayRangeStart);
+ srvDesc.Texture2DArray.ArraySize = UINT(m_arrayRangeLength);
+ } else {
+ srvDesc.Texture2DArray.FirstArraySlice = 0;
+ srvDesc.Texture2DArray.ArraySize = UINT(qMax(0, m_arraySize));
+ }
+ }
} else {
- srvDesc.ViewDimension = D3D11_SRV_DIMENSION_TEXTURE2D;
- srvDesc.Texture2D.MipLevels = mipLevelCount;
+ if (sampleDesc.Count > 1) {
+ srvDesc.ViewDimension = D3D11_SRV_DIMENSION_TEXTURE2DMS;
+ } else if (is3D) {
+ srvDesc.ViewDimension = D3D11_SRV_DIMENSION_TEXTURE3D;
+ srvDesc.Texture3D.MipLevels = mipLevelCount;
+ } else {
+ srvDesc.ViewDimension = D3D11_SRV_DIMENSION_TEXTURE2D;
+ srvDesc.Texture2D.MipLevels = mipLevelCount;
+ }
}
}
- HRESULT hr = rhiD->dev->CreateShaderResourceView(tex, &srvDesc, &srv);
+ HRESULT hr = rhiD->dev->CreateShaderResourceView(textureResource(), &srvDesc, &srv);
if (FAILED(hr)) {
- qWarning("Failed to create srv: %s", qPrintable(comErrorMessage(hr)));
+ qWarning("Failed to create srv: %s",
+ qPrintable(QSystemError::windowsComString(hr)));
return false;
}
- nativeHandlesStruct.texture = tex;
-
generation += 1;
return true;
}
-bool QD3D11Texture::build()
+bool QD3D11Texture::create()
{
QSize size;
- if (!prepareBuild(&size))
+ if (!prepareCreate(&size))
return false;
const bool isDepth = isDepthTextureFormat(m_format);
const bool isCube = m_flags.testFlag(CubeMap);
+ const bool is3D = m_flags.testFlag(ThreeDimensional);
+ const bool isArray = m_flags.testFlag(TextureArray);
+ const bool is1D = m_flags.testFlag(OneDimensional);
uint bindFlags = D3D11_BIND_SHADER_RESOURCE;
uint miscFlags = isCube ? D3D11_RESOURCE_MISC_TEXTURECUBE : 0;
@@ -2708,93 +3456,102 @@ bool QD3D11Texture::build()
if (m_flags.testFlag(UsedWithLoadStore))
bindFlags |= D3D11_BIND_UNORDERED_ACCESS;
- D3D11_TEXTURE2D_DESC desc;
- memset(&desc, 0, sizeof(desc));
- desc.Width = UINT(size.width());
- desc.Height = UINT(size.height());
- desc.MipLevels = mipLevelCount;
- desc.ArraySize = isCube ? 6 : 1;
- desc.Format = dxgiFormat;
- desc.SampleDesc = sampleDesc;
- desc.Usage = D3D11_USAGE_DEFAULT;
- desc.BindFlags = bindFlags;
- desc.MiscFlags = miscFlags;
-
QRHI_RES_RHI(QRhiD3D11);
- HRESULT hr = rhiD->dev->CreateTexture2D(&desc, nullptr, &tex);
- if (FAILED(hr)) {
- qWarning("Failed to create texture: %s", qPrintable(comErrorMessage(hr)));
- return false;
- }
-
- if (!finishBuild())
- return false;
-
- if (!m_objectName.isEmpty())
- tex->SetPrivateData(WKPDID_D3DDebugObjectName, UINT(m_objectName.size()), m_objectName.constData());
-
- QRHI_PROF;
- QRHI_PROF_F(newTexture(this, true, int(mipLevelCount), isCube ? 6 : 1, int(sampleDesc.Count)));
-
- owns = true;
- rhiD->registerResource(this);
- return true;
-}
+ if (is1D) {
+ D3D11_TEXTURE1D_DESC desc = {};
+ desc.Width = UINT(size.width());
+ desc.MipLevels = mipLevelCount;
+ desc.ArraySize = isArray ? UINT(qMax(0, m_arraySize)) : 1;
+ desc.Format = dxgiFormat;
+ desc.Usage = D3D11_USAGE_DEFAULT;
+ desc.BindFlags = bindFlags;
+ desc.MiscFlags = miscFlags;
-bool QD3D11Texture::buildFrom(const QRhiNativeHandles *src)
-{
- const QRhiD3D11TextureNativeHandles *h = static_cast<const QRhiD3D11TextureNativeHandles *>(src);
- if (!h || !h->texture)
- return false;
+ HRESULT hr = rhiD->dev->CreateTexture1D(&desc, nullptr, &tex1D);
+ if (FAILED(hr)) {
+ qWarning("Failed to create 1D texture: %s",
+ qPrintable(QSystemError::windowsComString(hr)));
+ return false;
+ }
+ if (!m_objectName.isEmpty())
+ tex->SetPrivateData(WKPDID_D3DDebugObjectName, UINT(m_objectName.size()),
+ m_objectName.constData());
+ } else if (!is3D) {
+ D3D11_TEXTURE2D_DESC desc = {};
+ desc.Width = UINT(size.width());
+ desc.Height = UINT(size.height());
+ desc.MipLevels = mipLevelCount;
+ desc.ArraySize = isCube ? 6 : (isArray ? UINT(qMax(0, m_arraySize)) : 1);
+ desc.Format = dxgiFormat;
+ desc.SampleDesc = sampleDesc;
+ desc.Usage = D3D11_USAGE_DEFAULT;
+ desc.BindFlags = bindFlags;
+ desc.MiscFlags = miscFlags;
- if (!prepareBuild())
- return false;
+ HRESULT hr = rhiD->dev->CreateTexture2D(&desc, nullptr, &tex);
+ if (FAILED(hr)) {
+ qWarning("Failed to create 2D texture: %s",
+ qPrintable(QSystemError::windowsComString(hr)));
+ return false;
+ }
+ if (!m_objectName.isEmpty())
+ tex->SetPrivateData(WKPDID_D3DDebugObjectName, UINT(m_objectName.size()), m_objectName.constData());
+ } else {
+ D3D11_TEXTURE3D_DESC desc = {};
+ desc.Width = UINT(size.width());
+ desc.Height = UINT(size.height());
+ desc.Depth = UINT(qMax(1, m_depth));
+ desc.MipLevels = mipLevelCount;
+ desc.Format = dxgiFormat;
+ desc.Usage = D3D11_USAGE_DEFAULT;
+ desc.BindFlags = bindFlags;
+ desc.MiscFlags = miscFlags;
- tex = static_cast<ID3D11Texture2D *>(h->texture);
+ HRESULT hr = rhiD->dev->CreateTexture3D(&desc, nullptr, &tex3D);
+ if (FAILED(hr)) {
+ qWarning("Failed to create 3D texture: %s",
+ qPrintable(QSystemError::windowsComString(hr)));
+ return false;
+ }
+ if (!m_objectName.isEmpty())
+ tex3D->SetPrivateData(WKPDID_D3DDebugObjectName, UINT(m_objectName.size()), m_objectName.constData());
+ }
- if (!finishBuild())
+ if (!finishCreate())
return false;
- QRHI_PROF;
- QRHI_PROF_F(newTexture(this, false, int(mipLevelCount), m_flags.testFlag(CubeMap) ? 6 : 1, int(sampleDesc.Count)));
-
- owns = false;
- QRHI_RES_RHI(QRhiD3D11);
+ owns = true;
rhiD->registerResource(this);
return true;
}
-bool QD3D11Texture::buildFrom(QRhiTexture::NativeTexture src)
+bool QD3D11Texture::createFrom(QRhiTexture::NativeTexture src)
{
- auto *srcTex = static_cast<ID3D11Texture2D * const *>(src.object);
- if (!srcTex || !*srcTex)
+ if (!src.object)
return false;
- if (!prepareBuild())
+ if (!prepareCreate())
return false;
- tex = *srcTex;
+ if (m_flags.testFlag(ThreeDimensional))
+ tex3D = reinterpret_cast<ID3D11Texture3D *>(src.object);
+ else if (m_flags.testFlags(OneDimensional))
+ tex1D = reinterpret_cast<ID3D11Texture1D *>(src.object);
+ else
+ tex = reinterpret_cast<ID3D11Texture2D *>(src.object);
- if (!finishBuild())
+ if (!finishCreate())
return false;
- QRHI_PROF;
- QRHI_PROF_F(newTexture(this, false, int(mipLevelCount), m_flags.testFlag(CubeMap) ? 6 : 1, int(sampleDesc.Count)));
-
owns = false;
QRHI_RES_RHI(QRhiD3D11);
rhiD->registerResource(this);
return true;
}
-const QRhiNativeHandles *QD3D11Texture::nativeHandles()
-{
- return &nativeHandlesStruct;
-}
-
QRhiTexture::NativeTexture QD3D11Texture::nativeTexture()
{
- return {&nativeHandlesStruct.texture, 0};
+ return { quint64(textureResource()), 0 };
}
ID3D11UnorderedAccessView *QD3D11Texture::unorderedAccessViewForLevel(int level)
@@ -2803,14 +3560,23 @@ ID3D11UnorderedAccessView *QD3D11Texture::unorderedAccessViewForLevel(int level)
return perLevelViews[level];
const bool isCube = m_flags.testFlag(CubeMap);
- D3D11_UNORDERED_ACCESS_VIEW_DESC desc;
- memset(&desc, 0, sizeof(desc));
+ const bool isArray = m_flags.testFlag(TextureArray);
+ const bool is3D = m_flags.testFlag(ThreeDimensional);
+ D3D11_UNORDERED_ACCESS_VIEW_DESC desc = {};
desc.Format = dxgiFormat;
if (isCube) {
desc.ViewDimension = D3D11_UAV_DIMENSION_TEXTURE2DARRAY;
desc.Texture2DArray.MipSlice = UINT(level);
desc.Texture2DArray.FirstArraySlice = 0;
desc.Texture2DArray.ArraySize = 6;
+ } else if (isArray) {
+ desc.ViewDimension = D3D11_UAV_DIMENSION_TEXTURE2DARRAY;
+ desc.Texture2DArray.MipSlice = UINT(level);
+ desc.Texture2DArray.FirstArraySlice = 0;
+ desc.Texture2DArray.ArraySize = UINT(qMax(0, m_arraySize));
+ } else if (is3D) {
+ desc.ViewDimension = D3D11_UAV_DIMENSION_TEXTURE3D;
+ desc.Texture3D.MipSlice = UINT(level);
} else {
desc.ViewDimension = D3D11_UAV_DIMENSION_TEXTURE2D;
desc.Texture2D.MipSlice = UINT(level);
@@ -2818,9 +3584,10 @@ ID3D11UnorderedAccessView *QD3D11Texture::unorderedAccessViewForLevel(int level)
QRHI_RES_RHI(QRhiD3D11);
ID3D11UnorderedAccessView *uav = nullptr;
- HRESULT hr = rhiD->dev->CreateUnorderedAccessView(tex, &desc, &uav);
+ HRESULT hr = rhiD->dev->CreateUnorderedAccessView(textureResource(), &desc, &uav);
if (FAILED(hr)) {
- qWarning("Failed to create UAV: %s", qPrintable(comErrorMessage(hr)));
+ qWarning("Failed to create UAV: %s",
+ qPrintable(QSystemError::windowsComString(hr)));
return nullptr;
}
@@ -2829,17 +3596,17 @@ ID3D11UnorderedAccessView *QD3D11Texture::unorderedAccessViewForLevel(int level)
}
QD3D11Sampler::QD3D11Sampler(QRhiImplementation *rhi, Filter magFilter, Filter minFilter, Filter mipmapMode,
- AddressMode u, AddressMode v)
- : QRhiSampler(rhi, magFilter, minFilter, mipmapMode, u, v)
+ AddressMode u, AddressMode v, AddressMode w)
+ : QRhiSampler(rhi, magFilter, minFilter, mipmapMode, u, v, w)
{
}
QD3D11Sampler::~QD3D11Sampler()
{
- release();
+ destroy();
}
-void QD3D11Sampler::release()
+void QD3D11Sampler::destroy()
{
if (!samplerState)
return;
@@ -2848,7 +3615,8 @@ void QD3D11Sampler::release()
samplerState = nullptr;
QRHI_RES_RHI(QRhiD3D11);
- rhiD->unregisterResource(this);
+ if (rhiD)
+ rhiD->unregisterResource(this);
}
static inline D3D11_FILTER toD3DFilter(QRhiSampler::Filter minFilter, QRhiSampler::Filter magFilter, QRhiSampler::Filter mipFilter)
@@ -2923,13 +3691,12 @@ static inline D3D11_COMPARISON_FUNC toD3DTextureComparisonFunc(QRhiSampler::Comp
}
}
-bool QD3D11Sampler::build()
+bool QD3D11Sampler::create()
{
if (samplerState)
- release();
+ destroy();
- D3D11_SAMPLER_DESC desc;
- memset(&desc, 0, sizeof(desc));
+ D3D11_SAMPLER_DESC desc = {};
desc.Filter = toD3DFilter(m_minFilter, m_magFilter, m_mipmapMode);
if (m_compareOp != Never)
desc.Filter = D3D11_FILTER(desc.Filter | 0x80);
@@ -2943,7 +3710,8 @@ bool QD3D11Sampler::build()
QRHI_RES_RHI(QRhiD3D11);
HRESULT hr = rhiD->dev->CreateSamplerState(&desc, &samplerState);
if (FAILED(hr)) {
- qWarning("Failed to create sampler state: %s", qPrintable(comErrorMessage(hr)));
+ qWarning("Failed to create sampler state: %s",
+ qPrintable(QSystemError::windowsComString(hr)));
return false;
}
@@ -2960,12 +3728,14 @@ QD3D11RenderPassDescriptor::QD3D11RenderPassDescriptor(QRhiImplementation *rhi)
QD3D11RenderPassDescriptor::~QD3D11RenderPassDescriptor()
{
- release();
+ destroy();
}
-void QD3D11RenderPassDescriptor::release()
+void QD3D11RenderPassDescriptor::destroy()
{
- // nothing to do here
+ QRHI_RES_RHI(QRhiD3D11);
+ if (rhiD)
+ rhiD->unregisterResource(this);
}
bool QD3D11RenderPassDescriptor::isCompatible(const QRhiRenderPassDescriptor *other) const
@@ -2974,33 +3744,46 @@ bool QD3D11RenderPassDescriptor::isCompatible(const QRhiRenderPassDescriptor *ot
return true;
}
-QD3D11ReferenceRenderTarget::QD3D11ReferenceRenderTarget(QRhiImplementation *rhi)
- : QRhiRenderTarget(rhi),
+QRhiRenderPassDescriptor *QD3D11RenderPassDescriptor::newCompatibleRenderPassDescriptor() const
+{
+ QD3D11RenderPassDescriptor *rpD = new QD3D11RenderPassDescriptor(m_rhi);
+ QRHI_RES_RHI(QRhiD3D11);
+ rhiD->registerResource(rpD, false);
+ return rpD;
+}
+
+QVector<quint32> QD3D11RenderPassDescriptor::serializedFormat() const
+{
+ return {};
+}
+
+QD3D11SwapChainRenderTarget::QD3D11SwapChainRenderTarget(QRhiImplementation *rhi, QRhiSwapChain *swapchain)
+ : QRhiSwapChainRenderTarget(rhi, swapchain),
d(rhi)
{
}
-QD3D11ReferenceRenderTarget::~QD3D11ReferenceRenderTarget()
+QD3D11SwapChainRenderTarget::~QD3D11SwapChainRenderTarget()
{
- release();
+ destroy();
}
-void QD3D11ReferenceRenderTarget::release()
+void QD3D11SwapChainRenderTarget::destroy()
{
// nothing to do here
}
-QSize QD3D11ReferenceRenderTarget::pixelSize() const
+QSize QD3D11SwapChainRenderTarget::pixelSize() const
{
return d.pixelSize;
}
-float QD3D11ReferenceRenderTarget::devicePixelRatio() const
+float QD3D11SwapChainRenderTarget::devicePixelRatio() const
{
return d.dpr;
}
-int QD3D11ReferenceRenderTarget::sampleCount() const
+int QD3D11SwapChainRenderTarget::sampleCount() const
{
return d.sampleCount;
}
@@ -3019,13 +3802,11 @@ QD3D11TextureRenderTarget::QD3D11TextureRenderTarget(QRhiImplementation *rhi,
QD3D11TextureRenderTarget::~QD3D11TextureRenderTarget()
{
- release();
+ destroy();
}
-void QD3D11TextureRenderTarget::release()
+void QD3D11TextureRenderTarget::destroy()
{
- QRHI_RES_RHI(QRhiD3D11);
-
if (!rtv[0] && !dsv)
return;
@@ -3043,21 +3824,25 @@ void QD3D11TextureRenderTarget::release()
}
}
- rhiD->unregisterResource(this);
+ QRHI_RES_RHI(QRhiD3D11);
+ if (rhiD)
+ rhiD->unregisterResource(this);
}
QRhiRenderPassDescriptor *QD3D11TextureRenderTarget::newCompatibleRenderPassDescriptor()
{
- return new QD3D11RenderPassDescriptor(m_rhi);
+ QD3D11RenderPassDescriptor *rpD = new QD3D11RenderPassDescriptor(m_rhi);
+ QRHI_RES_RHI(QRhiD3D11);
+ rhiD->registerResource(rpD, false);
+ return rpD;
}
-bool QD3D11TextureRenderTarget::build()
+bool QD3D11TextureRenderTarget::create()
{
if (rtv[0] || dsv)
- release();
+ destroy();
- const bool hasColorAttachments = m_desc.cbeginColorAttachments() != m_desc.cendColorAttachments();
- Q_ASSERT(hasColorAttachments || m_desc.depthTexture());
+ Q_ASSERT(m_desc.colorAttachmentCount() > 0 || m_desc.depthTexture());
Q_ASSERT(!m_desc.depthStencilBuffer() || !m_desc.depthTexture());
const bool hasDepthStencil = m_desc.depthStencilBuffer() || m_desc.depthTexture();
@@ -3073,14 +3858,39 @@ bool QD3D11TextureRenderTarget::build()
Q_ASSERT(texture || rb);
if (texture) {
QD3D11Texture *texD = QRHI_RES(QD3D11Texture, texture);
- D3D11_RENDER_TARGET_VIEW_DESC rtvDesc;
- memset(&rtvDesc, 0, sizeof(rtvDesc));
+ D3D11_RENDER_TARGET_VIEW_DESC rtvDesc = {};
rtvDesc.Format = toD3DTextureFormat(texD->format(), texD->flags());
if (texD->flags().testFlag(QRhiTexture::CubeMap)) {
rtvDesc.ViewDimension = D3D11_RTV_DIMENSION_TEXTURE2DARRAY;
rtvDesc.Texture2DArray.MipSlice = UINT(colorAtt.level());
rtvDesc.Texture2DArray.FirstArraySlice = UINT(colorAtt.layer());
rtvDesc.Texture2DArray.ArraySize = 1;
+ } else if (texD->flags().testFlag(QRhiTexture::OneDimensional)) {
+ if (texD->flags().testFlag(QRhiTexture::TextureArray)) {
+ rtvDesc.ViewDimension = D3D11_RTV_DIMENSION_TEXTURE1DARRAY;
+ rtvDesc.Texture1DArray.MipSlice = UINT(colorAtt.level());
+ rtvDesc.Texture1DArray.FirstArraySlice = UINT(colorAtt.layer());
+ rtvDesc.Texture1DArray.ArraySize = 1;
+ } else {
+ rtvDesc.ViewDimension = D3D11_RTV_DIMENSION_TEXTURE1D;
+ rtvDesc.Texture1D.MipSlice = UINT(colorAtt.level());
+ }
+ } else if (texD->flags().testFlag(QRhiTexture::TextureArray)) {
+ if (texD->sampleDesc.Count > 1) {
+ rtvDesc.ViewDimension = D3D11_RTV_DIMENSION_TEXTURE2DMSARRAY;
+ rtvDesc.Texture2DMSArray.FirstArraySlice = UINT(colorAtt.layer());
+ rtvDesc.Texture2DMSArray.ArraySize = 1;
+ } else {
+ rtvDesc.ViewDimension = D3D11_RTV_DIMENSION_TEXTURE2DARRAY;
+ rtvDesc.Texture2DArray.MipSlice = UINT(colorAtt.level());
+ rtvDesc.Texture2DArray.FirstArraySlice = UINT(colorAtt.layer());
+ rtvDesc.Texture2DArray.ArraySize = 1;
+ }
+ } else if (texD->flags().testFlag(QRhiTexture::ThreeDimensional)) {
+ rtvDesc.ViewDimension = D3D11_RTV_DIMENSION_TEXTURE3D;
+ rtvDesc.Texture3D.MipSlice = UINT(colorAtt.level());
+ rtvDesc.Texture3D.FirstWSlice = UINT(colorAtt.layer());
+ rtvDesc.Texture3D.WSize = 1;
} else {
if (texD->sampleDesc.Count > 1) {
rtvDesc.ViewDimension = D3D11_RTV_DIMENSION_TEXTURE2DMS;
@@ -3089,14 +3899,15 @@ bool QD3D11TextureRenderTarget::build()
rtvDesc.Texture2D.MipSlice = UINT(colorAtt.level());
}
}
- HRESULT hr = rhiD->dev->CreateRenderTargetView(texD->tex, &rtvDesc, &rtv[attIndex]);
+ HRESULT hr = rhiD->dev->CreateRenderTargetView(texD->textureResource(), &rtvDesc, &rtv[attIndex]);
if (FAILED(hr)) {
- qWarning("Failed to create rtv: %s", qPrintable(comErrorMessage(hr)));
+ qWarning("Failed to create rtv: %s",
+ qPrintable(QSystemError::windowsComString(hr)));
return false;
}
ownsRtv[attIndex] = true;
if (attIndex == 0) {
- d.pixelSize = texD->pixelSize();
+ d.pixelSize = rhiD->q->sizeForMipLevel(colorAtt.level(), texD->pixelSize());
d.sampleCount = int(texD->sampleDesc.Count);
}
} else if (rb) {
@@ -3115,14 +3926,35 @@ bool QD3D11TextureRenderTarget::build()
if (m_desc.depthTexture()) {
ownsDsv = true;
QD3D11Texture *depthTexD = QRHI_RES(QD3D11Texture, m_desc.depthTexture());
- D3D11_DEPTH_STENCIL_VIEW_DESC dsvDesc;
- memset(&dsvDesc, 0, sizeof(dsvDesc));
+ D3D11_DEPTH_STENCIL_VIEW_DESC dsvDesc = {};
dsvDesc.Format = toD3DDepthTextureDSVFormat(depthTexD->format());
dsvDesc.ViewDimension = depthTexD->sampleDesc.Count > 1 ? D3D11_DSV_DIMENSION_TEXTURE2DMS
: D3D11_DSV_DIMENSION_TEXTURE2D;
+ if (depthTexD->flags().testFlag(QRhiTexture::TextureArray)) {
+ if (depthTexD->sampleDesc.Count > 1) {
+ dsvDesc.ViewDimension = D3D11_DSV_DIMENSION_TEXTURE2DMSARRAY;
+ if (depthTexD->arrayRangeStart() >= 0 && depthTexD->arrayRangeLength() >= 0) {
+ dsvDesc.Texture2DMSArray.FirstArraySlice = UINT(depthTexD->arrayRangeStart());
+ dsvDesc.Texture2DMSArray.ArraySize = UINT(depthTexD->arrayRangeLength());
+ } else {
+ dsvDesc.Texture2DMSArray.FirstArraySlice = 0;
+ dsvDesc.Texture2DMSArray.ArraySize = UINT(qMax(0, depthTexD->arraySize()));
+ }
+ } else {
+ dsvDesc.ViewDimension = D3D11_DSV_DIMENSION_TEXTURE2DARRAY;
+ if (depthTexD->arrayRangeStart() >= 0 && depthTexD->arrayRangeLength() >= 0) {
+ dsvDesc.Texture2DArray.FirstArraySlice = UINT(depthTexD->arrayRangeStart());
+ dsvDesc.Texture2DArray.ArraySize = UINT(depthTexD->arrayRangeLength());
+ } else {
+ dsvDesc.Texture2DArray.FirstArraySlice = 0;
+ dsvDesc.Texture2DArray.ArraySize = UINT(qMax(0, depthTexD->arraySize()));
+ }
+ }
+ }
HRESULT hr = rhiD->dev->CreateDepthStencilView(depthTexD->tex, &dsvDesc, &dsv);
if (FAILED(hr)) {
- qWarning("Failed to create dsv: %s", qPrintable(comErrorMessage(hr)));
+ qWarning("Failed to create dsv: %s",
+ qPrintable(QSystemError::windowsComString(hr)));
return false;
}
if (d.colorAttCount == 0) {
@@ -3149,12 +3981,17 @@ bool QD3D11TextureRenderTarget::build()
d.dsv = dsv;
d.rp = QRHI_RES(QD3D11RenderPassDescriptor, m_renderPassDesc);
+ QRhiRenderTargetAttachmentTracker::updateResIdList<QD3D11Texture, QD3D11RenderBuffer>(m_desc, &d.currentResIdList);
+
rhiD->registerResource(this);
return true;
}
QSize QD3D11TextureRenderTarget::pixelSize() const
{
+ if (!QRhiRenderTargetAttachmentTracker::isUpToDate<QD3D11Texture, QD3D11RenderBuffer>(m_desc, d.currentResIdList))
+ const_cast<QD3D11TextureRenderTarget *>(this)->create();
+
return d.pixelSize;
}
@@ -3175,35 +4012,66 @@ QD3D11ShaderResourceBindings::QD3D11ShaderResourceBindings(QRhiImplementation *r
QD3D11ShaderResourceBindings::~QD3D11ShaderResourceBindings()
{
- release();
+ destroy();
}
-void QD3D11ShaderResourceBindings::release()
+void QD3D11ShaderResourceBindings::destroy()
{
sortedBindings.clear();
+ boundResourceData.clear();
+
+ QRHI_RES_RHI(QRhiD3D11);
+ if (rhiD)
+ rhiD->unregisterResource(this);
}
-bool QD3D11ShaderResourceBindings::build()
+bool QD3D11ShaderResourceBindings::create()
{
if (!sortedBindings.isEmpty())
- release();
+ destroy();
+
+ QRHI_RES_RHI(QRhiD3D11);
+ if (!rhiD->sanityCheckShaderResourceBindings(this))
+ return false;
+
+ rhiD->updateLayoutDesc(this);
std::copy(m_bindings.cbegin(), m_bindings.cend(), std::back_inserter(sortedBindings));
- std::sort(sortedBindings.begin(), sortedBindings.end(),
- [](const QRhiShaderResourceBinding &a, const QRhiShaderResourceBinding &b)
- {
- return a.data()->binding < b.data()->binding;
- });
+ std::sort(sortedBindings.begin(), sortedBindings.end(), QRhiImplementation::sortedBindingLessThan);
boundResourceData.resize(sortedBindings.count());
- QRHI_RES_RHI(QRhiD3D11);
- rhiD->updateShaderResourceBindings(this);
+ for (BoundResourceData &bd : boundResourceData)
+ memset(&bd, 0, sizeof(BoundResourceData));
+
+ hasDynamicOffset = false;
+ for (const QRhiShaderResourceBinding &b : sortedBindings) {
+ const QRhiShaderResourceBinding::Data *bd = QRhiImplementation::shaderResourceBindingData(b);
+ if (bd->type == QRhiShaderResourceBinding::UniformBuffer && bd->u.ubuf.hasDynamicOffset) {
+ hasDynamicOffset = true;
+ break;
+ }
+ }
generation += 1;
+ rhiD->registerResource(this, false);
return true;
}
+void QD3D11ShaderResourceBindings::updateResources(UpdateFlags flags)
+{
+ sortedBindings.clear();
+ std::copy(m_bindings.cbegin(), m_bindings.cend(), std::back_inserter(sortedBindings));
+ if (!flags.testFlag(BindingsAreSorted))
+ std::sort(sortedBindings.begin(), sortedBindings.end(), QRhiImplementation::sortedBindingLessThan);
+
+ Q_ASSERT(boundResourceData.count() == sortedBindings.count());
+ for (BoundResourceData &bd : boundResourceData)
+ memset(&bd, 0, sizeof(BoundResourceData));
+
+ generation += 1;
+}
+
QD3D11GraphicsPipeline::QD3D11GraphicsPipeline(QRhiImplementation *rhi)
: QRhiGraphicsPipeline(rhi)
{
@@ -3211,13 +4079,21 @@ QD3D11GraphicsPipeline::QD3D11GraphicsPipeline(QRhiImplementation *rhi)
QD3D11GraphicsPipeline::~QD3D11GraphicsPipeline()
{
- release();
+ destroy();
}
-void QD3D11GraphicsPipeline::release()
+template<typename T>
+inline void releasePipelineShader(T &s)
{
- QRHI_RES_RHI(QRhiD3D11);
+ if (s.shader) {
+ s.shader->Release();
+ s.shader = nullptr;
+ }
+ s.nativeResourceBindingMap.clear();
+}
+void QD3D11GraphicsPipeline::destroy()
+{
if (!dsState)
return;
@@ -3239,17 +4115,15 @@ void QD3D11GraphicsPipeline::release()
rastState = nullptr;
}
- if (vs) {
- vs->Release();
- vs = nullptr;
- }
-
- if (fs) {
- fs->Release();
- fs = nullptr;
- }
+ releasePipelineShader(vs);
+ releasePipelineShader(hs);
+ releasePipelineShader(ds);
+ releasePipelineShader(gs);
+ releasePipelineShader(fs);
- rhiD->unregisterResource(this);
+ QRHI_RES_RHI(QRhiD3D11);
+ if (rhiD)
+ rhiD->unregisterResource(this);
}
static inline D3D11_CULL_MODE toD3DCullMode(QRhiGraphicsPipeline::CullMode c)
@@ -3267,6 +4141,19 @@ static inline D3D11_CULL_MODE toD3DCullMode(QRhiGraphicsPipeline::CullMode c)
}
}
+static inline D3D11_FILL_MODE toD3DFillMode(QRhiGraphicsPipeline::PolygonMode mode)
+{
+ switch (mode) {
+ case QRhiGraphicsPipeline::Fill:
+ return D3D11_FILL_SOLID;
+ case QRhiGraphicsPipeline::Line:
+ return D3D11_FILL_WIREFRAME;
+ default:
+ Q_UNREACHABLE();
+ return D3D11_FILL_SOLID;
+ }
+}
+
static inline D3D11_COMPARISON_FUNC toD3DCompareOp(QRhiGraphicsPipeline::CompareOp op)
{
switch (op) {
@@ -3334,13 +4221,53 @@ static inline DXGI_FORMAT toD3DAttributeFormat(QRhiVertexInputAttribute::Format
return DXGI_FORMAT_R8G8_UNORM;
case QRhiVertexInputAttribute::UNormByte:
return DXGI_FORMAT_R8_UNORM;
+ case QRhiVertexInputAttribute::UInt4:
+ return DXGI_FORMAT_R32G32B32A32_UINT;
+ case QRhiVertexInputAttribute::UInt3:
+ return DXGI_FORMAT_R32G32B32_UINT;
+ case QRhiVertexInputAttribute::UInt2:
+ return DXGI_FORMAT_R32G32_UINT;
+ case QRhiVertexInputAttribute::UInt:
+ return DXGI_FORMAT_R32_UINT;
+ case QRhiVertexInputAttribute::SInt4:
+ return DXGI_FORMAT_R32G32B32A32_SINT;
+ case QRhiVertexInputAttribute::SInt3:
+ return DXGI_FORMAT_R32G32B32_SINT;
+ case QRhiVertexInputAttribute::SInt2:
+ return DXGI_FORMAT_R32G32_SINT;
+ case QRhiVertexInputAttribute::SInt:
+ return DXGI_FORMAT_R32_SINT;
+ case QRhiVertexInputAttribute::Half4:
+ // Note: D3D does not support half3. Pass through half3 as half4.
+ case QRhiVertexInputAttribute::Half3:
+ return DXGI_FORMAT_R16G16B16A16_FLOAT;
+ case QRhiVertexInputAttribute::Half2:
+ return DXGI_FORMAT_R16G16_FLOAT;
+ case QRhiVertexInputAttribute::Half:
+ return DXGI_FORMAT_R16_FLOAT;
+ case QRhiVertexInputAttribute::UShort4:
+ // Note: D3D does not support UShort3. Pass through UShort3 as UShort4.
+ case QRhiVertexInputAttribute::UShort3:
+ return DXGI_FORMAT_R16G16B16A16_UINT;
+ case QRhiVertexInputAttribute::UShort2:
+ return DXGI_FORMAT_R16G16_UINT;
+ case QRhiVertexInputAttribute::UShort:
+ return DXGI_FORMAT_R16_UINT;
+ case QRhiVertexInputAttribute::SShort4:
+ // Note: D3D does not support SShort3. Pass through SShort3 as SShort4.
+ case QRhiVertexInputAttribute::SShort3:
+ return DXGI_FORMAT_R16G16B16A16_SINT;
+ case QRhiVertexInputAttribute::SShort2:
+ return DXGI_FORMAT_R16G16_SINT;
+ case QRhiVertexInputAttribute::SShort:
+ return DXGI_FORMAT_R16_SINT;
default:
Q_UNREACHABLE();
return DXGI_FORMAT_R32G32B32A32_FLOAT;
}
}
-static inline D3D11_PRIMITIVE_TOPOLOGY toD3DTopology(QRhiGraphicsPipeline::Topology t)
+static inline D3D11_PRIMITIVE_TOPOLOGY toD3DTopology(QRhiGraphicsPipeline::Topology t, int patchControlPointCount)
{
switch (t) {
case QRhiGraphicsPipeline::Triangles:
@@ -3353,6 +4280,9 @@ static inline D3D11_PRIMITIVE_TOPOLOGY toD3DTopology(QRhiGraphicsPipeline::Topol
return D3D11_PRIMITIVE_TOPOLOGY_LINESTRIP;
case QRhiGraphicsPipeline::Points:
return D3D11_PRIMITIVE_TOPOLOGY_POINTLIST;
+ case QRhiGraphicsPipeline::Patches:
+ Q_ASSERT(patchControlPointCount >= 1 && patchControlPointCount <= 32);
+ return D3D11_PRIMITIVE_TOPOLOGY(D3D11_PRIMITIVE_TOPOLOGY_1_CONTROL_POINT_PATCHLIST + (patchControlPointCount - 1));
default:
Q_UNREACHABLE();
return D3D11_PRIMITIVE_TOPOLOGY_TRIANGLELIST;
@@ -3373,21 +4303,27 @@ static inline UINT8 toD3DColorWriteMask(QRhiGraphicsPipeline::ColorMask c)
return f;
}
-static inline D3D11_BLEND toD3DBlendFactor(QRhiGraphicsPipeline::BlendFactor f)
+static inline D3D11_BLEND toD3DBlendFactor(QRhiGraphicsPipeline::BlendFactor f, bool rgb)
{
+ // SrcBlendAlpha and DstBlendAlpha do not accept *_COLOR. With other APIs
+ // this is handled internally (so that e.g. VK_BLEND_FACTOR_SRC_COLOR is
+ // accepted and is in effect equivalent to VK_BLEND_FACTOR_SRC_ALPHA when
+ // set as an alpha src/dest factor), but for D3D we have to take care of it
+ // ourselves. Hence the rgb argument.
+
switch (f) {
case QRhiGraphicsPipeline::Zero:
return D3D11_BLEND_ZERO;
case QRhiGraphicsPipeline::One:
return D3D11_BLEND_ONE;
case QRhiGraphicsPipeline::SrcColor:
- return D3D11_BLEND_SRC_COLOR;
+ return rgb ? D3D11_BLEND_SRC_COLOR : D3D11_BLEND_SRC_ALPHA;
case QRhiGraphicsPipeline::OneMinusSrcColor:
- return D3D11_BLEND_INV_SRC_COLOR;
+ return rgb ? D3D11_BLEND_INV_SRC_COLOR : D3D11_BLEND_INV_SRC_ALPHA;
case QRhiGraphicsPipeline::DstColor:
- return D3D11_BLEND_DEST_COLOR;
+ return rgb ? D3D11_BLEND_DEST_COLOR : D3D11_BLEND_DEST_ALPHA;
case QRhiGraphicsPipeline::OneMinusDstColor:
- return D3D11_BLEND_INV_DEST_COLOR;
+ return rgb ? D3D11_BLEND_INV_DEST_COLOR : D3D11_BLEND_INV_DEST_ALPHA;
case QRhiGraphicsPipeline::SrcAlpha:
return D3D11_BLEND_SRC_ALPHA;
case QRhiGraphicsPipeline::OneMinusSrcAlpha:
@@ -3397,19 +4333,17 @@ static inline D3D11_BLEND toD3DBlendFactor(QRhiGraphicsPipeline::BlendFactor f)
case QRhiGraphicsPipeline::OneMinusDstAlpha:
return D3D11_BLEND_INV_DEST_ALPHA;
case QRhiGraphicsPipeline::ConstantColor:
- Q_FALLTHROUGH();
case QRhiGraphicsPipeline::ConstantAlpha:
return D3D11_BLEND_BLEND_FACTOR;
case QRhiGraphicsPipeline::OneMinusConstantColor:
- Q_FALLTHROUGH();
case QRhiGraphicsPipeline::OneMinusConstantAlpha:
return D3D11_BLEND_INV_BLEND_FACTOR;
case QRhiGraphicsPipeline::SrcAlphaSaturate:
return D3D11_BLEND_SRC_ALPHA_SAT;
case QRhiGraphicsPipeline::Src1Color:
- return D3D11_BLEND_SRC1_COLOR;
+ return rgb ? D3D11_BLEND_SRC1_COLOR : D3D11_BLEND_SRC1_ALPHA;
case QRhiGraphicsPipeline::OneMinusSrc1Color:
- return D3D11_BLEND_INV_SRC1_COLOR;
+ return rgb ? D3D11_BLEND_INV_SRC1_COLOR : D3D11_BLEND_INV_SRC1_ALPHA;
case QRhiGraphicsPipeline::Src1Alpha:
return D3D11_BLEND_SRC1_ALPHA;
case QRhiGraphicsPipeline::OneMinusSrc1Alpha:
@@ -3439,30 +4373,35 @@ static inline D3D11_BLEND_OP toD3DBlendOp(QRhiGraphicsPipeline::BlendOp op)
}
}
-static pD3DCompile resolveD3DCompile()
+static inline QByteArray sourceHash(const QByteArray &source)
{
- for (const wchar_t *libraryName : {L"D3DCompiler_47", L"D3DCompiler_43"}) {
- QSystemLibrary library(libraryName);
- if (library.load()) {
- if (auto symbol = library.resolve("D3DCompile"))
- return reinterpret_cast<pD3DCompile>(symbol);
- }
- }
- return nullptr;
+ // taken from the GL backend, use the same mechanism to get a key
+ QCryptographicHash keyBuilder(QCryptographicHash::Sha1);
+ keyBuilder.addData(source);
+ return keyBuilder.result().toHex();
}
-static QByteArray compileHlslShaderSource(const QShader &shader, QShader::Variant shaderVariant, QString *error)
+QByteArray QRhiD3D11::compileHlslShaderSource(const QShader &shader, QShader::Variant shaderVariant, uint flags,
+ QString *error, QShaderKey *usedShaderKey)
{
- QShaderCode dxbc = shader.shader({ QShader::DxbcShader, 50, shaderVariant });
- if (!dxbc.shader().isEmpty())
+ QShaderKey key = { QShader::DxbcShader, 50, shaderVariant };
+ QShaderCode dxbc = shader.shader(key);
+ if (!dxbc.shader().isEmpty()) {
+ if (usedShaderKey)
+ *usedShaderKey = key;
return dxbc.shader();
+ }
- QShaderCode hlslSource = shader.shader({ QShader::HlslShader, 50, shaderVariant });
+ key = { QShader::HlslShader, 50, shaderVariant };
+ QShaderCode hlslSource = shader.shader(key);
if (hlslSource.shader().isEmpty()) {
qWarning() << "No HLSL (shader model 5.0) code found in baked shader" << shader;
return QByteArray();
}
+ if (usedShaderKey)
+ *usedShaderKey = key;
+
const char *target;
switch (shader.stage()) {
case QShader::VertexStage:
@@ -3488,7 +4427,18 @@ static QByteArray compileHlslShaderSource(const QShader &shader, QShader::Varian
return QByteArray();
}
- static const pD3DCompile d3dCompile = resolveD3DCompile();
+ BytecodeCacheKey cacheKey;
+ if (rhiFlags.testFlag(QRhi::EnablePipelineCacheDataSave)) {
+ cacheKey.sourceHash = sourceHash(hlslSource.shader());
+ cacheKey.target = target;
+ cacheKey.entryPoint = hlslSource.entryPoint();
+ cacheKey.compileFlags = flags;
+ auto cacheIt = m_bytecodeCache.constFind(cacheKey);
+ if (cacheIt != m_bytecodeCache.constEnd())
+ return cacheIt.value();
+ }
+
+ static const pD3DCompile d3dCompile = QRhiD3D::resolveD3DCompile();
if (d3dCompile == nullptr) {
qWarning("Unable to resolve function D3DCompile()");
return QByteArray();
@@ -3498,7 +4448,7 @@ static QByteArray compileHlslShaderSource(const QShader &shader, QShader::Varian
ID3DBlob *errors = nullptr;
HRESULT hr = d3dCompile(hlslSource.shader().constData(), SIZE_T(hlslSource.shader().size()),
nullptr, nullptr, nullptr,
- hlslSource.entryPoint().constData(), target, 0, 0, &bytecode, &errors);
+ hlslSource.entryPoint().constData(), target, flags, 0, &bytecode, &errors);
if (FAILED(hr) || !bytecode) {
qWarning("HLSL shader compilation failed: 0x%x", uint(hr));
if (errors) {
@@ -3513,33 +4463,40 @@ static QByteArray compileHlslShaderSource(const QShader &shader, QShader::Varian
result.resize(int(bytecode->GetBufferSize()));
memcpy(result.data(), bytecode->GetBufferPointer(), size_t(result.size()));
bytecode->Release();
+
+ if (rhiFlags.testFlag(QRhi::EnablePipelineCacheDataSave))
+ m_bytecodeCache.insert(cacheKey, result);
+
return result;
}
-bool QD3D11GraphicsPipeline::build()
+bool QD3D11GraphicsPipeline::create()
{
if (dsState)
- release();
+ destroy();
QRHI_RES_RHI(QRhiD3D11);
+ rhiD->pipelineCreationStart();
if (!rhiD->sanityCheckGraphicsPipeline(this))
return false;
- D3D11_RASTERIZER_DESC rastDesc;
- memset(&rastDesc, 0, sizeof(rastDesc));
- rastDesc.FillMode = D3D11_FILL_SOLID;
+ D3D11_RASTERIZER_DESC rastDesc = {};
+ rastDesc.FillMode = toD3DFillMode(m_polygonMode);
rastDesc.CullMode = toD3DCullMode(m_cullMode);
rastDesc.FrontCounterClockwise = m_frontFace == CCW;
+ rastDesc.DepthBias = m_depthBias;
+ rastDesc.SlopeScaledDepthBias = m_slopeScaledDepthBias;
+ rastDesc.DepthClipEnable = true;
rastDesc.ScissorEnable = m_flags.testFlag(UsesScissor);
- rastDesc.MultisampleEnable = rhiD->effectiveSampleCount(m_sampleCount).Count > 1;
+ rastDesc.MultisampleEnable = rhiD->effectiveSampleDesc(m_sampleCount).Count > 1;
HRESULT hr = rhiD->dev->CreateRasterizerState(&rastDesc, &rastState);
if (FAILED(hr)) {
- qWarning("Failed to create rasterizer state: %s", qPrintable(comErrorMessage(hr)));
+ qWarning("Failed to create rasterizer state: %s",
+ qPrintable(QSystemError::windowsComString(hr)));
return false;
}
- D3D11_DEPTH_STENCIL_DESC dsDesc;
- memset(&dsDesc, 0, sizeof(dsDesc));
+ D3D11_DEPTH_STENCIL_DESC dsDesc = {};
dsDesc.DepthEnable = m_depthTest;
dsDesc.DepthWriteMask = m_depthWrite ? D3D11_DEPTH_WRITE_MASK_ALL : D3D11_DEPTH_WRITE_MASK_ZERO;
dsDesc.DepthFunc = toD3DCompareOp(m_depthOp);
@@ -3558,59 +4515,81 @@ bool QD3D11GraphicsPipeline::build()
}
hr = rhiD->dev->CreateDepthStencilState(&dsDesc, &dsState);
if (FAILED(hr)) {
- qWarning("Failed to create depth-stencil state: %s", qPrintable(comErrorMessage(hr)));
+ qWarning("Failed to create depth-stencil state: %s",
+ qPrintable(QSystemError::windowsComString(hr)));
return false;
}
- D3D11_BLEND_DESC blendDesc;
- memset(&blendDesc, 0, sizeof(blendDesc));
+ D3D11_BLEND_DESC blendDesc = {};
blendDesc.IndependentBlendEnable = m_targetBlends.count() > 1;
for (int i = 0, ie = m_targetBlends.count(); i != ie; ++i) {
const QRhiGraphicsPipeline::TargetBlend &b(m_targetBlends[i]);
- D3D11_RENDER_TARGET_BLEND_DESC blend;
- memset(&blend, 0, sizeof(blend));
+ D3D11_RENDER_TARGET_BLEND_DESC blend = {};
blend.BlendEnable = b.enable;
- blend.SrcBlend = toD3DBlendFactor(b.srcColor);
- blend.DestBlend = toD3DBlendFactor(b.dstColor);
+ blend.SrcBlend = toD3DBlendFactor(b.srcColor, true);
+ blend.DestBlend = toD3DBlendFactor(b.dstColor, true);
blend.BlendOp = toD3DBlendOp(b.opColor);
- blend.SrcBlendAlpha = toD3DBlendFactor(b.srcAlpha);
- blend.DestBlendAlpha = toD3DBlendFactor(b.dstAlpha);
+ blend.SrcBlendAlpha = toD3DBlendFactor(b.srcAlpha, false);
+ blend.DestBlendAlpha = toD3DBlendFactor(b.dstAlpha, false);
blend.BlendOpAlpha = toD3DBlendOp(b.opAlpha);
blend.RenderTargetWriteMask = toD3DColorWriteMask(b.colorWrite);
blendDesc.RenderTarget[i] = blend;
}
if (m_targetBlends.isEmpty()) {
- D3D11_RENDER_TARGET_BLEND_DESC blend;
- memset(&blend, 0, sizeof(blend));
+ D3D11_RENDER_TARGET_BLEND_DESC blend = {};
blend.RenderTargetWriteMask = D3D11_COLOR_WRITE_ENABLE_ALL;
blendDesc.RenderTarget[0] = blend;
}
hr = rhiD->dev->CreateBlendState(&blendDesc, &blendState);
if (FAILED(hr)) {
- qWarning("Failed to create blend state: %s", qPrintable(comErrorMessage(hr)));
+ qWarning("Failed to create blend state: %s",
+ qPrintable(QSystemError::windowsComString(hr)));
return false;
}
QByteArray vsByteCode;
- for (const QRhiShaderStage &shaderStage : qAsConst(m_shaderStages)) {
+ for (const QRhiShaderStage &shaderStage : std::as_const(m_shaderStages)) {
auto cacheIt = rhiD->m_shaderCache.constFind(shaderStage);
if (cacheIt != rhiD->m_shaderCache.constEnd()) {
switch (shaderStage.type()) {
case QRhiShaderStage::Vertex:
- vs = static_cast<ID3D11VertexShader *>(cacheIt->s);
- vs->AddRef();
+ vs.shader = static_cast<ID3D11VertexShader *>(cacheIt->s);
+ vs.shader->AddRef();
vsByteCode = cacheIt->bytecode;
+ vs.nativeResourceBindingMap = cacheIt->nativeResourceBindingMap;
+ break;
+ case QRhiShaderStage::TessellationControl:
+ hs.shader = static_cast<ID3D11HullShader *>(cacheIt->s);
+ hs.shader->AddRef();
+ hs.nativeResourceBindingMap = cacheIt->nativeResourceBindingMap;
+ break;
+ case QRhiShaderStage::TessellationEvaluation:
+ ds.shader = static_cast<ID3D11DomainShader *>(cacheIt->s);
+ ds.shader->AddRef();
+ ds.nativeResourceBindingMap = cacheIt->nativeResourceBindingMap;
+ break;
+ case QRhiShaderStage::Geometry:
+ gs.shader = static_cast<ID3D11GeometryShader *>(cacheIt->s);
+ gs.shader->AddRef();
+ gs.nativeResourceBindingMap = cacheIt->nativeResourceBindingMap;
break;
case QRhiShaderStage::Fragment:
- fs = static_cast<ID3D11PixelShader *>(cacheIt->s);
- fs->AddRef();
+ fs.shader = static_cast<ID3D11PixelShader *>(cacheIt->s);
+ fs.shader->AddRef();
+ fs.nativeResourceBindingMap = cacheIt->nativeResourceBindingMap;
break;
default:
break;
}
} else {
QString error;
- const QByteArray bytecode = compileHlslShaderSource(shaderStage.shader(), shaderStage.shaderVariant(), &error);
+ QShaderKey shaderKey;
+ UINT compileFlags = 0;
+ if (m_flags.testFlag(CompileShadersWithDebugInfo))
+ compileFlags |= D3DCOMPILE_DEBUG;
+
+ const QByteArray bytecode = rhiD->compileHlslShaderSource(shaderStage.shader(), shaderStage.shaderVariant(), compileFlags,
+ &error, &shaderKey);
if (bytecode.isEmpty()) {
qWarning("HLSL shader compilation failed: %s", qPrintable(error));
return false;
@@ -3623,23 +4602,60 @@ bool QD3D11GraphicsPipeline::build()
switch (shaderStage.type()) {
case QRhiShaderStage::Vertex:
- hr = rhiD->dev->CreateVertexShader(bytecode.constData(), SIZE_T(bytecode.size()), nullptr, &vs);
+ hr = rhiD->dev->CreateVertexShader(bytecode.constData(), SIZE_T(bytecode.size()), nullptr, &vs.shader);
if (FAILED(hr)) {
- qWarning("Failed to create vertex shader: %s", qPrintable(comErrorMessage(hr)));
+ qWarning("Failed to create vertex shader: %s",
+ qPrintable(QSystemError::windowsComString(hr)));
return false;
}
vsByteCode = bytecode;
- rhiD->m_shaderCache.insert(shaderStage, QRhiD3D11::Shader(vs, bytecode));
- vs->AddRef();
+ vs.nativeResourceBindingMap = shaderStage.shader().nativeResourceBindingMap(shaderKey);
+ rhiD->m_shaderCache.insert(shaderStage, QRhiD3D11::Shader(vs.shader, bytecode, vs.nativeResourceBindingMap));
+ vs.shader->AddRef();
+ break;
+ case QRhiShaderStage::TessellationControl:
+ hr = rhiD->dev->CreateHullShader(bytecode.constData(), SIZE_T(bytecode.size()), nullptr, &hs.shader);
+ if (FAILED(hr)) {
+ qWarning("Failed to create hull shader: %s",
+ qPrintable(QSystemError::windowsComString(hr)));
+ return false;
+ }
+ hs.nativeResourceBindingMap = shaderStage.shader().nativeResourceBindingMap(shaderKey);
+ rhiD->m_shaderCache.insert(shaderStage, QRhiD3D11::Shader(hs.shader, bytecode, hs.nativeResourceBindingMap));
+ hs.shader->AddRef();
+ break;
+ case QRhiShaderStage::TessellationEvaluation:
+ hr = rhiD->dev->CreateDomainShader(bytecode.constData(), SIZE_T(bytecode.size()), nullptr, &ds.shader);
+ if (FAILED(hr)) {
+ qWarning("Failed to create domain shader: %s",
+ qPrintable(QSystemError::windowsComString(hr)));
+ return false;
+ }
+ ds.nativeResourceBindingMap = shaderStage.shader().nativeResourceBindingMap(shaderKey);
+ rhiD->m_shaderCache.insert(shaderStage, QRhiD3D11::Shader(ds.shader, bytecode, ds.nativeResourceBindingMap));
+ ds.shader->AddRef();
+ break;
+ case QRhiShaderStage::Geometry:
+ hr = rhiD->dev->CreateGeometryShader(bytecode.constData(), SIZE_T(bytecode.size()), nullptr, &gs.shader);
+ if (FAILED(hr)) {
+ qWarning("Failed to create geometry shader: %s",
+ qPrintable(QSystemError::windowsComString(hr)));
+ return false;
+ }
+ gs.nativeResourceBindingMap = shaderStage.shader().nativeResourceBindingMap(shaderKey);
+ rhiD->m_shaderCache.insert(shaderStage, QRhiD3D11::Shader(gs.shader, bytecode, gs.nativeResourceBindingMap));
+ gs.shader->AddRef();
break;
case QRhiShaderStage::Fragment:
- hr = rhiD->dev->CreatePixelShader(bytecode.constData(), SIZE_T(bytecode.size()), nullptr, &fs);
+ hr = rhiD->dev->CreatePixelShader(bytecode.constData(), SIZE_T(bytecode.size()), nullptr, &fs.shader);
if (FAILED(hr)) {
- qWarning("Failed to create pixel shader: %s", qPrintable(comErrorMessage(hr)));
+ qWarning("Failed to create pixel shader: %s",
+ qPrintable(QSystemError::windowsComString(hr)));
return false;
}
- rhiD->m_shaderCache.insert(shaderStage, QRhiD3D11::Shader(fs, bytecode));
- fs->AddRef();
+ fs.nativeResourceBindingMap = shaderStage.shader().nativeResourceBindingMap(shaderKey);
+ rhiD->m_shaderCache.insert(shaderStage, QRhiD3D11::Shader(fs.shader, bytecode, fs.nativeResourceBindingMap));
+ fs.shader->AddRef();
break;
default:
break;
@@ -3647,38 +4663,55 @@ bool QD3D11GraphicsPipeline::build()
}
}
- d3dTopology = toD3DTopology(m_topology);
+ d3dTopology = toD3DTopology(m_topology, m_patchControlPointCount);
if (!vsByteCode.isEmpty()) {
+ QByteArrayList matrixSliceSemantics;
QVarLengthArray<D3D11_INPUT_ELEMENT_DESC, 4> inputDescs;
for (auto it = m_vertexInputLayout.cbeginAttributes(), itEnd = m_vertexInputLayout.cendAttributes();
it != itEnd; ++it)
{
- D3D11_INPUT_ELEMENT_DESC desc;
- memset(&desc, 0, sizeof(desc));
- // the output from SPIRV-Cross uses TEXCOORD<location> as the semantic
- desc.SemanticName = "TEXCOORD";
- desc.SemanticIndex = UINT(it->location());
+ D3D11_INPUT_ELEMENT_DESC desc = {};
+ // The output from SPIRV-Cross uses TEXCOORD<location> as the
+ // semantic, except for matrices that are unrolled into consecutive
+ // vec2/3/4s attributes and need TEXCOORD<location>_ as
+ // SemanticName and row/column index as SemanticIndex.
+ const int matrixSlice = it->matrixSlice();
+ if (matrixSlice < 0) {
+ desc.SemanticName = "TEXCOORD";
+ desc.SemanticIndex = UINT(it->location());
+ } else {
+ QByteArray sem;
+ sem.resize(16);
+ qsnprintf(sem.data(), sem.size(), "TEXCOORD%d_", it->location() - matrixSlice);
+ matrixSliceSemantics.append(sem);
+ desc.SemanticName = matrixSliceSemantics.last().constData();
+ desc.SemanticIndex = UINT(matrixSlice);
+ }
desc.Format = toD3DAttributeFormat(it->format());
desc.InputSlot = UINT(it->binding());
desc.AlignedByteOffset = it->offset();
const QRhiVertexInputBinding *inputBinding = m_vertexInputLayout.bindingAt(it->binding());
if (inputBinding->classification() == QRhiVertexInputBinding::PerInstance) {
desc.InputSlotClass = D3D11_INPUT_PER_INSTANCE_DATA;
- desc.InstanceDataStepRate = UINT(inputBinding->instanceStepRate());
+ desc.InstanceDataStepRate = inputBinding->instanceStepRate();
} else {
desc.InputSlotClass = D3D11_INPUT_PER_VERTEX_DATA;
}
inputDescs.append(desc);
}
- hr = rhiD->dev->CreateInputLayout(inputDescs.constData(), UINT(inputDescs.count()),
- vsByteCode, SIZE_T(vsByteCode.size()), &inputLayout);
- if (FAILED(hr)) {
- qWarning("Failed to create input layout: %s", qPrintable(comErrorMessage(hr)));
- return false;
- }
+ if (!inputDescs.isEmpty()) {
+ hr = rhiD->dev->CreateInputLayout(inputDescs.constData(), UINT(inputDescs.count()),
+ vsByteCode, SIZE_T(vsByteCode.size()), &inputLayout);
+ if (FAILED(hr)) {
+ qWarning("Failed to create input layout: %s",
+ qPrintable(QSystemError::windowsComString(hr)));
+ return false;
+ }
+ } // else leave inputLayout set to nullptr; that's valid and it avoids a debug layer warning about an input layout with 0 elements
}
+ rhiD->pipelineCreationEnd();
generation += 1;
rhiD->registerResource(this);
return true;
@@ -3691,54 +4724,67 @@ QD3D11ComputePipeline::QD3D11ComputePipeline(QRhiImplementation *rhi)
QD3D11ComputePipeline::~QD3D11ComputePipeline()
{
- release();
+ destroy();
}
-void QD3D11ComputePipeline::release()
+void QD3D11ComputePipeline::destroy()
{
- QRHI_RES_RHI(QRhiD3D11);
-
- if (!cs)
+ if (!cs.shader)
return;
- cs->Release();
- cs = nullptr;
+ cs.shader->Release();
+ cs.shader = nullptr;
+ cs.nativeResourceBindingMap.clear();
- rhiD->unregisterResource(this);
+ QRHI_RES_RHI(QRhiD3D11);
+ if (rhiD)
+ rhiD->unregisterResource(this);
}
-bool QD3D11ComputePipeline::build()
+bool QD3D11ComputePipeline::create()
{
- if (cs)
- release();
+ if (cs.shader)
+ destroy();
QRHI_RES_RHI(QRhiD3D11);
+ rhiD->pipelineCreationStart();
auto cacheIt = rhiD->m_shaderCache.constFind(m_shaderStage);
if (cacheIt != rhiD->m_shaderCache.constEnd()) {
- cs = static_cast<ID3D11ComputeShader *>(cacheIt->s);
+ cs.shader = static_cast<ID3D11ComputeShader *>(cacheIt->s);
+ cs.nativeResourceBindingMap = cacheIt->nativeResourceBindingMap;
} else {
QString error;
- const QByteArray bytecode = compileHlslShaderSource(m_shaderStage.shader(), m_shaderStage.shaderVariant(), &error);
+ QShaderKey shaderKey;
+ UINT compileFlags = 0;
+ if (m_flags.testFlag(CompileShadersWithDebugInfo))
+ compileFlags |= D3DCOMPILE_DEBUG;
+
+ const QByteArray bytecode = rhiD->compileHlslShaderSource(m_shaderStage.shader(), m_shaderStage.shaderVariant(), compileFlags,
+ &error, &shaderKey);
if (bytecode.isEmpty()) {
qWarning("HLSL compute shader compilation failed: %s", qPrintable(error));
return false;
}
- HRESULT hr = rhiD->dev->CreateComputeShader(bytecode.constData(), SIZE_T(bytecode.size()), nullptr, &cs);
+ HRESULT hr = rhiD->dev->CreateComputeShader(bytecode.constData(), SIZE_T(bytecode.size()), nullptr, &cs.shader);
if (FAILED(hr)) {
- qWarning("Failed to create compute shader: %s", qPrintable(comErrorMessage(hr)));
+ qWarning("Failed to create compute shader: %s",
+ qPrintable(QSystemError::windowsComString(hr)));
return false;
}
+ cs.nativeResourceBindingMap = m_shaderStage.shader().nativeResourceBindingMap(shaderKey);
+
if (rhiD->m_shaderCache.count() >= QRhiD3D11::MAX_SHADER_CACHE_ENTRIES)
rhiD->clearShaderCache();
- rhiD->m_shaderCache.insert(m_shaderStage, QRhiD3D11::Shader(cs, bytecode));
+ rhiD->m_shaderCache.insert(m_shaderStage, QRhiD3D11::Shader(cs.shader, bytecode, cs.nativeResourceBindingMap));
}
- cs->AddRef();
+ cs.shader->AddRef();
+ rhiD->pipelineCreationEnd();
generation += 1;
rhiD->registerResource(this);
return true;
@@ -3752,34 +4798,107 @@ QD3D11CommandBuffer::QD3D11CommandBuffer(QRhiImplementation *rhi)
QD3D11CommandBuffer::~QD3D11CommandBuffer()
{
- release();
+ destroy();
}
-void QD3D11CommandBuffer::release()
+void QD3D11CommandBuffer::destroy()
{
// nothing to do here
}
+bool QD3D11SwapChainTimestamps::prepare(QRhiD3D11 *rhiD)
+{
+ // Creates the query objects if not yet done, but otherwise calling this
+ // function is expected to be a no-op.
+
+ D3D11_QUERY_DESC queryDesc = {};
+ for (int i = 0; i < TIMESTAMP_PAIRS; ++i) {
+ if (!disjointQuery[i]) {
+ queryDesc.Query = D3D11_QUERY_TIMESTAMP_DISJOINT;
+ HRESULT hr = rhiD->dev->CreateQuery(&queryDesc, &disjointQuery[i]);
+ if (FAILED(hr)) {
+ qWarning("Failed to create timestamp disjoint query: %s",
+ qPrintable(QSystemError::windowsComString(hr)));
+ return false;
+ }
+ }
+ queryDesc.Query = D3D11_QUERY_TIMESTAMP;
+ for (int j = 0; j < 2; ++j) {
+ const int idx = 2 * i + j;
+ if (!query[idx]) {
+ HRESULT hr = rhiD->dev->CreateQuery(&queryDesc, &query[idx]);
+ if (FAILED(hr)) {
+ qWarning("Failed to create timestamp query: %s",
+ qPrintable(QSystemError::windowsComString(hr)));
+ return false;
+ }
+ }
+ }
+ }
+ return true;
+}
+
+void QD3D11SwapChainTimestamps::destroy()
+{
+ for (int i = 0; i < TIMESTAMP_PAIRS; ++i) {
+ active[i] = false;
+ if (disjointQuery[i]) {
+ disjointQuery[i]->Release();
+ disjointQuery[i] = nullptr;
+ }
+ for (int j = 0; j < 2; ++j) {
+ const int idx = TIMESTAMP_PAIRS * i + j;
+ if (query[idx]) {
+ query[idx]->Release();
+ query[idx] = nullptr;
+ }
+ }
+ }
+}
+
+bool QD3D11SwapChainTimestamps::tryQueryTimestamps(int pairIndex, ID3D11DeviceContext *context, double *elapsedSec)
+{
+ bool result = false;
+ if (!active[pairIndex])
+ return result;
+
+ ID3D11Query *tsDisjoint = disjointQuery[pairIndex];
+ ID3D11Query *tsStart = query[pairIndex * 2];
+ ID3D11Query *tsEnd = query[pairIndex * 2 + 1];
+ quint64 timestamps[2];
+ D3D11_QUERY_DATA_TIMESTAMP_DISJOINT dj;
+
+ bool ok = true;
+ ok &= context->GetData(tsDisjoint, &dj, sizeof(dj), D3D11_ASYNC_GETDATA_DONOTFLUSH) == S_OK;
+ ok &= context->GetData(tsEnd, &timestamps[1], sizeof(quint64), D3D11_ASYNC_GETDATA_DONOTFLUSH) == S_OK;
+ ok &= context->GetData(tsStart, &timestamps[0], sizeof(quint64), D3D11_ASYNC_GETDATA_DONOTFLUSH) == S_OK;
+
+ if (ok) {
+ if (!dj.Disjoint && dj.Frequency) {
+ const float elapsedMs = (timestamps[1] - timestamps[0]) / float(dj.Frequency) * 1000.0f;
+ *elapsedSec = elapsedMs / 1000.0;
+ result = true;
+ }
+ active[pairIndex] = false;
+ } // else leave active set, will retry in a subsequent beginFrame
+
+ return result;
+}
+
QD3D11SwapChain::QD3D11SwapChain(QRhiImplementation *rhi)
- : QRhiSwapChain(rhi),
- rt(rhi),
- cb(rhi)
+ : QRhiSwapChain(rhi), rt(rhi, this), rtRight(rhi, this), cb(rhi)
{
backBufferTex = nullptr;
backBufferRtv = nullptr;
for (int i = 0; i < BUFFER_COUNT; ++i) {
msaaTex[i] = nullptr;
msaaRtv[i] = nullptr;
- timestampActive[i] = false;
- timestampDisjointQuery[i] = nullptr;
- timestampQuery[2 * i] = nullptr;
- timestampQuery[2 * i + 1] = nullptr;
}
}
QD3D11SwapChain::~QD3D11SwapChain()
{
- release();
+ destroy();
}
void QD3D11SwapChain::releaseBuffers()
@@ -3788,6 +4907,10 @@ void QD3D11SwapChain::releaseBuffers()
backBufferRtv->Release();
backBufferRtv = nullptr;
}
+ if (backBufferRtvRight) {
+ backBufferRtvRight->Release();
+ backBufferRtvRight = nullptr;
+ }
if (backBufferTex) {
backBufferTex->Release();
backBufferTex = nullptr;
@@ -3804,35 +4927,35 @@ void QD3D11SwapChain::releaseBuffers()
}
}
-void QD3D11SwapChain::release()
+void QD3D11SwapChain::destroy()
{
if (!swapChain)
return;
releaseBuffers();
- for (int i = 0; i < BUFFER_COUNT; ++i) {
- if (timestampDisjointQuery[i]) {
- timestampDisjointQuery[i]->Release();
- timestampDisjointQuery[i] = nullptr;
- }
- for (int j = 0; j < 2; ++j) {
- const int idx = BUFFER_COUNT * i + j;
- if (timestampQuery[idx]) {
- timestampQuery[idx]->Release();
- timestampQuery[idx] = nullptr;
- }
- }
- }
+ timestamps.destroy();
swapChain->Release();
swapChain = nullptr;
- QRHI_PROF;
- QRHI_PROF_F(releaseSwapChain(this));
+ if (dcompVisual) {
+ dcompVisual->Release();
+ dcompVisual = nullptr;
+ }
+
+ if (dcompTarget) {
+ dcompTarget->Release();
+ dcompTarget = nullptr;
+ }
QRHI_RES_RHI(QRhiD3D11);
- rhiD->unregisterResource(this);
+ if (rhiD) {
+ rhiD->unregisterResource(this);
+ // See Deferred Destruction Issues with Flip Presentation Swap Chains in
+ // https://learn.microsoft.com/en-us/windows/win32/api/d3d11/nf-d3d11-id3d11devicecontext-flush
+ rhiD->context->Flush();
+ }
}
QRhiCommandBuffer *QD3D11SwapChain::currentFrameCommandBuffer()
@@ -3845,22 +4968,67 @@ QRhiRenderTarget *QD3D11SwapChain::currentFrameRenderTarget()
return &rt;
}
+QRhiRenderTarget *QD3D11SwapChain::currentFrameRenderTarget(StereoTargetBuffer targetBuffer)
+{
+ return targetBuffer == StereoTargetBuffer::LeftBuffer? &rt: &rtRight;
+}
+
QSize QD3D11SwapChain::surfacePixelSize()
{
Q_ASSERT(m_window);
return m_window->size() * m_window->devicePixelRatio();
}
+bool QD3D11SwapChain::isFormatSupported(Format f)
+{
+ if (f == SDR)
+ return true;
+
+ if (!m_window) {
+ qWarning("Attempted to call isFormatSupported() without a window set");
+ return false;
+ }
+
+ QRHI_RES_RHI(QRhiD3D11);
+ DXGI_OUTPUT_DESC1 desc1;
+ if (QRhiD3D::outputDesc1ForWindow(m_window, rhiD->activeAdapter, &desc1)) {
+ if (desc1.ColorSpace == DXGI_COLOR_SPACE_RGB_FULL_G2084_NONE_P2020)
+ return f == QRhiSwapChain::HDRExtendedSrgbLinear || f == QRhiSwapChain::HDR10;
+ }
+
+ return false;
+}
+
+QRhiSwapChainHdrInfo QD3D11SwapChain::hdrInfo()
+{
+ QRhiSwapChainHdrInfo info = QRhiSwapChain::hdrInfo();
+ // Must use m_window, not window, given this may be called before createOrResize().
+ if (m_window) {
+ QRHI_RES_RHI(QRhiD3D11);
+ DXGI_OUTPUT_DESC1 hdrOutputDesc;
+ if (QRhiD3D::outputDesc1ForWindow(m_window, rhiD->activeAdapter, &hdrOutputDesc)) {
+ info.limitsType = QRhiSwapChainHdrInfo::LuminanceInNits;
+ info.limits.luminanceInNits.minLuminance = hdrOutputDesc.MinLuminance;
+ info.limits.luminanceInNits.maxLuminance = hdrOutputDesc.MaxLuminance;
+ info.luminanceBehavior = QRhiSwapChainHdrInfo::SceneReferred; // 1.0 = 80 nits
+ info.sdrWhiteLevel = QRhiD3D::sdrWhiteLevelInNits(hdrOutputDesc);
+ }
+ }
+ return info;
+}
+
QRhiRenderPassDescriptor *QD3D11SwapChain::newCompatibleRenderPassDescriptor()
{
- return new QD3D11RenderPassDescriptor(m_rhi);
+ QD3D11RenderPassDescriptor *rpD = new QD3D11RenderPassDescriptor(m_rhi);
+ QRHI_RES_RHI(QRhiD3D11);
+ rhiD->registerResource(rpD, false);
+ return rpD;
}
bool QD3D11SwapChain::newColorBuffer(const QSize &size, DXGI_FORMAT format, DXGI_SAMPLE_DESC sampleDesc,
ID3D11Texture2D **tex, ID3D11RenderTargetView **rtv) const
{
- D3D11_TEXTURE2D_DESC desc;
- memset(&desc, 0, sizeof(desc));
+ D3D11_TEXTURE2D_DESC desc = {};
desc.Width = UINT(size.width());
desc.Height = UINT(size.height());
desc.MipLevels = 1;
@@ -3873,17 +5041,18 @@ bool QD3D11SwapChain::newColorBuffer(const QSize &size, DXGI_FORMAT format, DXGI
QRHI_RES_RHI(QRhiD3D11);
HRESULT hr = rhiD->dev->CreateTexture2D(&desc, nullptr, tex);
if (FAILED(hr)) {
- qWarning("Failed to create color buffer texture: %s", qPrintable(comErrorMessage(hr)));
+ qWarning("Failed to create color buffer texture: %s",
+ qPrintable(QSystemError::windowsComString(hr)));
return false;
}
- D3D11_RENDER_TARGET_VIEW_DESC rtvDesc;
- memset(&rtvDesc, 0, sizeof(rtvDesc));
+ D3D11_RENDER_TARGET_VIEW_DESC rtvDesc = {};
rtvDesc.Format = format;
rtvDesc.ViewDimension = sampleDesc.Count > 1 ? D3D11_RTV_DIMENSION_TEXTURE2DMS : D3D11_RTV_DIMENSION_TEXTURE2D;
hr = rhiD->dev->CreateRenderTargetView(*tex, &rtvDesc, rtv);
if (FAILED(hr)) {
- qWarning("Failed to create color buffer rtv: %s", qPrintable(comErrorMessage(hr)));
+ qWarning("Failed to create color buffer rtv: %s",
+ qPrintable(QSystemError::windowsComString(hr)));
(*tex)->Release();
*tex = nullptr;
return false;
@@ -3892,17 +5061,31 @@ bool QD3D11SwapChain::newColorBuffer(const QSize &size, DXGI_FORMAT format, DXGI
return true;
}
-bool QD3D11SwapChain::buildOrResize()
+bool QRhiD3D11::ensureDirectCompositionDevice()
+{
+ if (dcompDevice)
+ return true;
+
+ qCDebug(QRHI_LOG_INFO, "Creating Direct Composition device (needed for semi-transparent windows)");
+ dcompDevice = QRhiD3D::createDirectCompositionDevice();
+ return dcompDevice ? true : false;
+}
+
+static const DXGI_FORMAT DEFAULT_FORMAT = DXGI_FORMAT_R8G8B8A8_UNORM;
+static const DXGI_FORMAT DEFAULT_SRGB_FORMAT = DXGI_FORMAT_R8G8B8A8_UNORM_SRGB;
+
+bool QD3D11SwapChain::createOrResize()
{
// Can be called multiple times due to window resizes - that is not the
- // same as a simple release+build (as with other resources). Just need to
+ // same as a simple destroy+create (as with other resources). Just need to
// resize the buffers then.
const bool needsRegistration = !window || window != m_window;
+ const bool stereo = m_window->format().stereo();
// except if the window actually changes
if (window && window != m_window)
- release();
+ destroy();
window = m_window;
m_currentPixelSize = surfacePixelSize();
@@ -3911,101 +5094,183 @@ bool QD3D11SwapChain::buildOrResize()
if (pixelSize.isEmpty())
return false;
- colorFormat = DXGI_FORMAT_R8G8B8A8_UNORM;
- const DXGI_FORMAT srgbAdjustedFormat = m_flags.testFlag(sRGB) ?
- DXGI_FORMAT_R8G8B8A8_UNORM_SRGB : DXGI_FORMAT_R8G8B8A8_UNORM;
-
- const UINT swapChainFlags = 0;
+ HWND hwnd = reinterpret_cast<HWND>(window->winId());
+ HRESULT hr;
QRHI_RES_RHI(QRhiD3D11);
- bool useFlipDiscard = rhiD->hasDxgi2 && rhiD->supportsFlipDiscardSwapchain;
+
+ if (m_flags.testFlag(SurfaceHasPreMulAlpha) || m_flags.testFlag(SurfaceHasNonPreMulAlpha)) {
+ if (!rhiD->useLegacySwapchainModel && rhiD->ensureDirectCompositionDevice()) {
+ if (!dcompTarget) {
+ hr = rhiD->dcompDevice->CreateTargetForHwnd(hwnd, false, &dcompTarget);
+ if (FAILED(hr)) {
+ qWarning("Failed to create Direct Compsition target for the window: %s",
+ qPrintable(QSystemError::windowsComString(hr)));
+ }
+ }
+ if (dcompTarget && !dcompVisual) {
+ hr = rhiD->dcompDevice->CreateVisual(&dcompVisual);
+ if (FAILED(hr)) {
+ qWarning("Failed to create DirectComposition visual: %s",
+ qPrintable(QSystemError::windowsComString(hr)));
+ }
+ }
+ }
+ // simple consistency check
+ if (window->requestedFormat().alphaBufferSize() <= 0)
+ qWarning("Swapchain says surface has alpha but the window has no alphaBufferSize set. "
+ "This may lead to problems.");
+ }
+
+ swapInterval = m_flags.testFlag(QRhiSwapChain::NoVSync) ? 0 : 1;
+ swapChainFlags = 0;
+
+ // A non-flip swapchain can do Present(0) as expected without
+ // ALLOW_TEARING, and ALLOW_TEARING is not compatible with it at all so the
+ // flag must not be set then. Whereas for flip we should use it, if
+ // supported, to get better results for 'unthrottled' presentation.
+ if (swapInterval == 0 && rhiD->supportsAllowTearing)
+ swapChainFlags |= DXGI_SWAP_CHAIN_FLAG_ALLOW_TEARING;
+
if (!swapChain) {
- HWND hwnd = reinterpret_cast<HWND>(window->winId());
- sampleDesc = rhiD->effectiveSampleCount(m_sampleCount);
-
- // Take a shortcut for alpha: our QWindow is OpenGLSurface so whatever
- // the platform plugin does to enable transparency for OpenGL window
- // will be sufficient for us too on the legacy (DISCARD) path. For
- // FLIP_DISCARD we'd need to use DirectComposition (create a
- // IDCompositionDevice/Target/Visual), avoid that for now.
- if (m_flags.testFlag(SurfaceHasPreMulAlpha) || m_flags.testFlag(SurfaceHasNonPreMulAlpha)) {
- useFlipDiscard = false;
- if (window->requestedFormat().alphaBufferSize() <= 0)
- qWarning("Swapchain says surface has alpha but the window has no alphaBufferSize set. "
- "This may lead to problems.");
+ sampleDesc = rhiD->effectiveSampleDesc(m_sampleCount);
+ colorFormat = DEFAULT_FORMAT;
+ srgbAdjustedColorFormat = m_flags.testFlag(sRGB) ? DEFAULT_SRGB_FORMAT : DEFAULT_FORMAT;
+
+ DXGI_COLOR_SPACE_TYPE hdrColorSpace = DXGI_COLOR_SPACE_RGB_FULL_G22_NONE_P709; // SDR
+ DXGI_OUTPUT_DESC1 hdrOutputDesc;
+ if (QRhiD3D::outputDesc1ForWindow(m_window, rhiD->activeAdapter, &hdrOutputDesc) && m_format != SDR) {
+ // https://docs.microsoft.com/en-us/windows/win32/direct3darticles/high-dynamic-range
+ if (hdrOutputDesc.ColorSpace == DXGI_COLOR_SPACE_RGB_FULL_G2084_NONE_P2020) {
+ switch (m_format) {
+ case HDRExtendedSrgbLinear:
+ colorFormat = DXGI_FORMAT_R16G16B16A16_FLOAT;
+ hdrColorSpace = DXGI_COLOR_SPACE_RGB_FULL_G10_NONE_P709;
+ srgbAdjustedColorFormat = colorFormat;
+ break;
+ case HDR10:
+ colorFormat = DXGI_FORMAT_R10G10B10A2_UNORM;
+ hdrColorSpace = DXGI_COLOR_SPACE_RGB_FULL_G2084_NONE_P2020;
+ srgbAdjustedColorFormat = colorFormat;
+ break;
+ default:
+ break;
+ }
+ } else {
+ // This happens also when Use HDR is set to Off in the Windows
+ // Display settings. Show a helpful warning, but continue with the
+ // default non-HDR format.
+ qWarning("The output associated with the window is not HDR capable "
+ "(or Use HDR is Off in the Display Settings), ignoring HDR format request");
+ }
}
- HRESULT hr;
- if (useFlipDiscard) {
- // We use FLIP_DISCARD which implies a buffer count of 2 (as opposed to the
- // old DISCARD with back buffer count == 1). This makes no difference for
- // the rest of the stuff except that automatic MSAA is unsupported and
- // needs to be implemented via a custom multisample render target and an
- // explicit resolve.
-
- DXGI_SWAP_CHAIN_DESC1 desc;
- memset(&desc, 0, sizeof(desc));
- desc.Width = UINT(pixelSize.width());
- desc.Height = UINT(pixelSize.height());
- desc.Format = colorFormat;
- desc.SampleDesc.Count = 1;
- desc.BufferUsage = DXGI_USAGE_RENDER_TARGET_OUTPUT;
- desc.BufferCount = BUFFER_COUNT;
+ // We use a FLIP model swapchain which implies a buffer count of 2
+ // (as opposed to the old DISCARD with back buffer count == 1).
+ // This makes no difference for the rest of the stuff except that
+ // automatic MSAA is unsupported and needs to be implemented via a
+ // custom multisample render target and an explicit resolve.
+
+ DXGI_SWAP_CHAIN_DESC1 desc = {};
+ desc.Width = UINT(pixelSize.width());
+ desc.Height = UINT(pixelSize.height());
+ desc.Format = colorFormat;
+ desc.SampleDesc.Count = 1;
+ desc.BufferUsage = DXGI_USAGE_RENDER_TARGET_OUTPUT;
+ desc.BufferCount = BUFFER_COUNT;
+ desc.Flags = swapChainFlags;
+ desc.Scaling = rhiD->useLegacySwapchainModel ? DXGI_SCALING_STRETCH : DXGI_SCALING_NONE;
+ desc.SwapEffect = rhiD->useLegacySwapchainModel ? DXGI_SWAP_EFFECT_DISCARD : DXGI_SWAP_EFFECT_FLIP_DISCARD;
+ desc.Stereo = stereo;
+
+ if (dcompVisual) {
+ // With DirectComposition setting AlphaMode to STRAIGHT fails the
+ // swapchain creation, whereas the result seems to be identical
+ // with any of the other values, including IGNORE. (?)
+ desc.AlphaMode = DXGI_ALPHA_MODE_PREMULTIPLIED;
+
+ // DirectComposition has its own limitations, cannot use
+ // SCALING_NONE. So with semi-transparency requested we are forced
+ // to SCALING_STRETCH.
desc.Scaling = DXGI_SCALING_STRETCH;
- desc.SwapEffect = DXGI_SWAP_EFFECT(4); // DXGI_SWAP_EFFECT_FLIP_DISCARD
- // Do not bother with AlphaMode, if won't work unless we go through
- // DirectComposition. Instead, we just take the other (DISCARD)
- // path for now when alpha is requested.
- desc.Flags = swapChainFlags;
-
- IDXGISwapChain1 *sc1;
- hr = static_cast<IDXGIFactory2 *>(rhiD->dxgiFactory)->CreateSwapChainForHwnd(rhiD->dev, hwnd, &desc,
- nullptr, nullptr, &sc1);
- if (SUCCEEDED(hr))
- swapChain = sc1;
- } else {
- // Windows 7 for instance. Use DISCARD mode. Regardless, keep on
- // using our manual resolve for symmetry with the FLIP_DISCARD code
- // path when MSAA is requested.
-
- DXGI_SWAP_CHAIN_DESC desc;
- memset(&desc, 0, sizeof(desc));
- desc.BufferDesc.Width = UINT(pixelSize.width());
- desc.BufferDesc.Height = UINT(pixelSize.height());
- desc.BufferDesc.RefreshRate.Numerator = 60;
- desc.BufferDesc.RefreshRate.Denominator = 1;
- desc.BufferDesc.Format = colorFormat;
- desc.SampleDesc.Count = 1;
- desc.BufferUsage = DXGI_USAGE_RENDER_TARGET_OUTPUT;
- desc.BufferCount = 1;
- desc.OutputWindow = hwnd;
- desc.Windowed = true;
- desc.SwapEffect = DXGI_SWAP_EFFECT_DISCARD;
- desc.Flags = swapChainFlags;
-
- hr = rhiD->dxgiFactory->CreateSwapChain(rhiD->dev, &desc, &swapChain);
+ }
+
+ IDXGIFactory2 *fac = static_cast<IDXGIFactory2 *>(rhiD->dxgiFactory);
+ IDXGISwapChain1 *sc1;
+
+ if (dcompVisual)
+ hr = fac->CreateSwapChainForComposition(rhiD->dev, &desc, nullptr, &sc1);
+ else
+ hr = fac->CreateSwapChainForHwnd(rhiD->dev, hwnd, &desc, nullptr, nullptr, &sc1);
+
+ // If failed and we tried a HDR format, then try with SDR. This
+ // matches other backends, such as Vulkan where if the format is
+ // not supported, the default one is used instead.
+ if (FAILED(hr) && m_format != SDR) {
+ colorFormat = DEFAULT_FORMAT;
+ desc.Format = DEFAULT_FORMAT;
+ if (dcompVisual)
+ hr = fac->CreateSwapChainForComposition(rhiD->dev, &desc, nullptr, &sc1);
+ else
+ hr = fac->CreateSwapChainForHwnd(rhiD->dev, hwnd, &desc, nullptr, nullptr, &sc1);
+ }
+
+ if (SUCCEEDED(hr)) {
+ swapChain = sc1;
+ if (m_format != SDR) {
+ IDXGISwapChain3 *sc3 = nullptr;
+ if (SUCCEEDED(sc1->QueryInterface(__uuidof(IDXGISwapChain3), reinterpret_cast<void **>(&sc3)))) {
+ hr = sc3->SetColorSpace1(hdrColorSpace);
+ if (FAILED(hr))
+ qWarning("Failed to set color space on swapchain: %s",
+ qPrintable(QSystemError::windowsComString(hr)));
+ sc3->Release();
+ } else {
+ qWarning("IDXGISwapChain3 not available, HDR swapchain will not work as expected");
+ }
+ }
+ if (dcompVisual) {
+ hr = dcompVisual->SetContent(sc1);
+ if (SUCCEEDED(hr)) {
+ hr = dcompTarget->SetRoot(dcompVisual);
+ if (FAILED(hr)) {
+ qWarning("Failed to associate Direct Composition visual with the target: %s",
+ qPrintable(QSystemError::windowsComString(hr)));
+ }
+ } else {
+ qWarning("Failed to set content for Direct Composition visual: %s",
+ qPrintable(QSystemError::windowsComString(hr)));
+ }
+ } else {
+ // disable Alt+Enter; not relevant when using DirectComposition
+ rhiD->dxgiFactory->MakeWindowAssociation(hwnd, DXGI_MWA_NO_WINDOW_CHANGES);
+ }
}
if (FAILED(hr)) {
- qWarning("Failed to create D3D11 swapchain: %s", qPrintable(comErrorMessage(hr)));
+ qWarning("Failed to create D3D11 swapchain: %s"
+ " (Width=%u Height=%u Format=%u SampleCount=%u BufferCount=%u Scaling=%u SwapEffect=%u Stereo=%u)",
+ qPrintable(QSystemError::windowsComString(hr)),
+ desc.Width, desc.Height, UINT(desc.Format), desc.SampleDesc.Count,
+ desc.BufferCount, UINT(desc.Scaling), UINT(desc.SwapEffect), UINT(desc.Stereo));
return false;
}
- rhiD->dxgiFactory->MakeWindowAssociation(hwnd, DXGI_MWA_NO_ALT_ENTER);
} else {
releaseBuffers();
- const UINT count = useFlipDiscard ? BUFFER_COUNT : 1;
- HRESULT hr = swapChain->ResizeBuffers(count, UINT(pixelSize.width()), UINT(pixelSize.height()),
- colorFormat, swapChainFlags);
+ // flip model -> buffer count is the real buffer count, not 1 like with the legacy modes
+ hr = swapChain->ResizeBuffers(UINT(BUFFER_COUNT), UINT(pixelSize.width()), UINT(pixelSize.height()),
+ colorFormat, swapChainFlags);
if (hr == DXGI_ERROR_DEVICE_REMOVED || hr == DXGI_ERROR_DEVICE_RESET) {
qWarning("Device loss detected in ResizeBuffers()");
rhiD->deviceLost = true;
return false;
} else if (FAILED(hr)) {
- qWarning("Failed to resize D3D11 swapchain: %s", qPrintable(comErrorMessage(hr)));
+ qWarning("Failed to resize D3D11 swapchain: %s",
+ qPrintable(QSystemError::windowsComString(hr)));
return false;
}
}
- // This looks odd (for FLIP_DISCARD, esp. compared with backends for Vulkan
+ // This looks odd (for FLIP_*, esp. compared with backends for Vulkan
// & co.) but the backbuffer is always at index 0, with magic underneath.
// Some explanation from
// https://docs.microsoft.com/en-us/windows/win32/direct3ddxgi/dxgi-1-4-improvements
@@ -4019,25 +5284,39 @@ bool QD3D11SwapChain::buildOrResize()
// swapchain."
// So just query index 0 once (per resize) and be done with it.
- HRESULT hr = swapChain->GetBuffer(0, IID_ID3D11Texture2D, reinterpret_cast<void **>(&backBufferTex));
+ hr = swapChain->GetBuffer(0, __uuidof(ID3D11Texture2D), reinterpret_cast<void **>(&backBufferTex));
if (FAILED(hr)) {
- qWarning("Failed to query swapchain backbuffer: %s", qPrintable(comErrorMessage(hr)));
+ qWarning("Failed to query swapchain backbuffer: %s",
+ qPrintable(QSystemError::windowsComString(hr)));
return false;
}
- D3D11_RENDER_TARGET_VIEW_DESC rtvDesc;
- memset(&rtvDesc, 0, sizeof(rtvDesc));
- rtvDesc.Format = srgbAdjustedFormat;
+ D3D11_RENDER_TARGET_VIEW_DESC rtvDesc = {};
+ rtvDesc.Format = srgbAdjustedColorFormat;
rtvDesc.ViewDimension = D3D11_RTV_DIMENSION_TEXTURE2D;
hr = rhiD->dev->CreateRenderTargetView(backBufferTex, &rtvDesc, &backBufferRtv);
if (FAILED(hr)) {
- qWarning("Failed to create rtv for swapchain backbuffer: %s", qPrintable(comErrorMessage(hr)));
+ qWarning("Failed to create rtv for swapchain backbuffer: %s",
+ qPrintable(QSystemError::windowsComString(hr)));
return false;
}
+ if (stereo) {
+ // Create a second render target view for the right eye
+ rtvDesc.ViewDimension = D3D11_RTV_DIMENSION_TEXTURE2DARRAY;
+ rtvDesc.Texture2DArray.FirstArraySlice = 1;
+ rtvDesc.Texture2DArray.ArraySize = 1;
+ hr = rhiD->dev->CreateRenderTargetView(backBufferTex, &rtvDesc, &backBufferRtvRight);
+ if (FAILED(hr)) {
+ qWarning("Failed to create rtv for swapchain backbuffer (right eye): %s",
+ qPrintable(QSystemError::windowsComString(hr)));
+ return false;
+ }
+ }
+
// Try to reduce stalls by having a dedicated MSAA texture per swapchain buffer.
for (int i = 0; i < BUFFER_COUNT; ++i) {
if (sampleDesc.Count > 1) {
- if (!newColorBuffer(pixelSize, srgbAdjustedFormat, sampleDesc, &msaaTex[i], &msaaRtv[i]))
+ if (!newColorBuffer(pixelSize, srgbAdjustedColorFormat, sampleDesc, &msaaTex[i], &msaaRtv[i]))
return false;
}
}
@@ -4049,7 +5328,7 @@ bool QD3D11SwapChain::buildOrResize()
if (m_depthStencil && m_depthStencil->pixelSize() != pixelSize) {
if (m_depthStencil->flags().testFlag(QRhiRenderBuffer::UsedWithSwapChainOnly)) {
m_depthStencil->setPixelSize(pixelSize);
- if (!m_depthStencil->build())
+ if (!m_depthStencil->create())
qWarning("Failed to rebuild swapchain's associated depth-stencil buffer for size %dx%d",
pixelSize.width(), pixelSize.height());
} else {
@@ -4062,9 +5341,9 @@ bool QD3D11SwapChain::buildOrResize()
currentFrameSlot = 0;
frameCount = 0;
ds = m_depthStencil ? QRHI_RES(QD3D11RenderBuffer, m_depthStencil) : nullptr;
- swapInterval = m_flags.testFlag(QRhiSwapChain::NoVSync) ? 0 : 1;
- QD3D11ReferenceRenderTarget *rtD = QRHI_RES(QD3D11ReferenceRenderTarget, &rt);
+ rt.setRenderPassDescriptor(m_renderPassDesc); // for the public getter in QRhiRenderTarget
+ QD3D11SwapChainRenderTarget *rtD = QRHI_RES(QD3D11SwapChainRenderTarget, &rt);
rtD->d.rp = QRHI_RES(QD3D11RenderPassDescriptor, m_renderPassDesc);
rtD->d.pixelSize = pixelSize;
rtD->d.dpr = float(window->devicePixelRatio());
@@ -4072,32 +5351,20 @@ bool QD3D11SwapChain::buildOrResize()
rtD->d.colorAttCount = 1;
rtD->d.dsAttCount = m_depthStencil ? 1 : 0;
- QRHI_PROF;
- QRHI_PROF_F(resizeSwapChain(this, BUFFER_COUNT, sampleDesc.Count > 1 ? BUFFER_COUNT : 0, int(sampleDesc.Count)));
- if (rhiP) {
- D3D11_QUERY_DESC queryDesc;
- memset(&queryDesc, 0, sizeof(queryDesc));
- for (int i = 0; i < BUFFER_COUNT; ++i) {
- if (!timestampDisjointQuery[i]) {
- queryDesc.Query = D3D11_QUERY_TIMESTAMP_DISJOINT;
- HRESULT hr = rhiD->dev->CreateQuery(&queryDesc, &timestampDisjointQuery[i]);
- if (FAILED(hr)) {
- qWarning("Failed to create timestamp disjoint query: %s", qPrintable(comErrorMessage(hr)));
- break;
- }
- }
- queryDesc.Query = D3D11_QUERY_TIMESTAMP;
- for (int j = 0; j < 2; ++j) {
- const int idx = BUFFER_COUNT * i + j; // one pair per buffer (frame)
- if (!timestampQuery[idx]) {
- HRESULT hr = rhiD->dev->CreateQuery(&queryDesc, &timestampQuery[idx]);
- if (FAILED(hr)) {
- qWarning("Failed to create timestamp query: %s", qPrintable(comErrorMessage(hr)));
- break;
- }
- }
- }
- }
+ if (stereo) {
+ rtD = QRHI_RES(QD3D11SwapChainRenderTarget, &rtRight);
+ rtD->d.rp = QRHI_RES(QD3D11RenderPassDescriptor, m_renderPassDesc);
+ rtD->d.pixelSize = pixelSize;
+ rtD->d.dpr = float(window->devicePixelRatio());
+ rtD->d.sampleCount = int(sampleDesc.Count);
+ rtD->d.colorAttCount = 1;
+ rtD->d.dsAttCount = m_depthStencil ? 1 : 0;
+ rtD->d.rtv[0] = backBufferRtvRight;
+ rtD->d.dsv = ds ? ds->dsv : nullptr;
+ }
+
+ if (rhiD->rhiFlags.testFlag(QRhi::EnableTimestamps)) {
+ timestamps.prepare(rhiD);
// timestamp queries are optional so we can go on even if they failed
}
@@ -4107,34 +5374,4 @@ bool QD3D11SwapChain::buildOrResize()
return true;
}
-void QRhiD3D11::DeviceCurse::initResources()
-{
- framesLeft = framesToActivate;
-
- HRESULT hr = q->dev->CreateComputeShader(g_killDeviceByTimingOut, sizeof(g_killDeviceByTimingOut), nullptr, &cs);
- if (FAILED(hr)) {
- qWarning("Failed to create compute shader: %s", qPrintable(comErrorMessage(hr)));
- return;
- }
-}
-
-void QRhiD3D11::DeviceCurse::releaseResources()
-{
- if (cs) {
- cs->Release();
- cs = nullptr;
- }
-}
-
-void QRhiD3D11::DeviceCurse::activate()
-{
- if (!cs)
- return;
-
- qDebug("Activating Curse. Goodbye Cruel World.");
-
- q->context->CSSetShader(cs, nullptr, 0);
- q->context->Dispatch(256, 1, 1);
-}
-
QT_END_NAMESPACE
diff --git a/src/gui/rhi/qrhid3d11_p.h b/src/gui/rhi/qrhid3d11_p.h
index 5df1843b1e..7644748407 100644
--- a/src/gui/rhi/qrhid3d11_p.h
+++ b/src/gui/rhi/qrhid3d11_p.h
@@ -1,41 +1,8 @@
-/****************************************************************************
-**
-** Copyright (C) 2019 The Qt Company Ltd.
-** Contact: http://www.qt.io/licensing/
-**
-** This file is part of the Qt Gui module
-**
-** $QT_BEGIN_LICENSE:LGPL3$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef QRHID3D11_H
-#define QRHID3D11_H
+// Copyright (C) 2023 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
+
+#ifndef QRHID3D11_P_H
+#define QRHID3D11_P_H
//
// W A R N I N G
@@ -48,32 +15,852 @@
// We mean it.
//
-#include <private/qrhi_p.h>
+#include "qrhi_p.h"
+#include <rhi/qshaderdescription.h>
+#include <QWindow>
-// no d3d includes here, to prevent precompiled header mess (due to this being
-// a public header)
+#include <d3d11_1.h>
+#include <dxgi1_6.h>
+#include <dcomp.h>
QT_BEGIN_NAMESPACE
-struct Q_GUI_EXPORT QRhiD3D11InitParams : public QRhiInitParams
+class QRhiD3D11;
+
+struct QD3D11Buffer : public QRhiBuffer
+{
+ QD3D11Buffer(QRhiImplementation *rhi, Type type, UsageFlags usage, quint32 size);
+ ~QD3D11Buffer();
+ void destroy() override;
+ bool create() override;
+ QRhiBuffer::NativeBuffer nativeBuffer() override;
+ char *beginFullDynamicBufferUpdateForCurrentFrame() override;
+ void endFullDynamicBufferUpdateForCurrentFrame() override;
+
+ ID3D11UnorderedAccessView *unorderedAccessView(quint32 offset);
+
+ ID3D11Buffer *buffer = nullptr;
+ char *dynBuf = nullptr;
+ bool hasPendingDynamicUpdates = false;
+ QHash<quint32, ID3D11UnorderedAccessView *> uavs;
+ uint generation = 0;
+ friend class QRhiD3D11;
+};
+
+struct QD3D11RenderBuffer : public QRhiRenderBuffer
+{
+ QD3D11RenderBuffer(QRhiImplementation *rhi, Type type, const QSize &pixelSize,
+ int sampleCount, QRhiRenderBuffer::Flags flags,
+ QRhiTexture::Format backingFormatHint);
+ ~QD3D11RenderBuffer();
+ void destroy() override;
+ bool create() override;
+ QRhiTexture::Format backingFormat() const override;
+
+ ID3D11Texture2D *tex = nullptr;
+ ID3D11DepthStencilView *dsv = nullptr;
+ ID3D11RenderTargetView *rtv = nullptr;
+ DXGI_FORMAT dxgiFormat;
+ DXGI_SAMPLE_DESC sampleDesc;
+ uint generation = 0;
+ friend class QRhiD3D11;
+};
+
+struct QD3D11Texture : public QRhiTexture
+{
+ QD3D11Texture(QRhiImplementation *rhi, Format format, const QSize &pixelSize, int depth,
+ int arraySize, int sampleCount, Flags flags);
+ ~QD3D11Texture();
+ void destroy() override;
+ bool create() override;
+ bool createFrom(NativeTexture src) override;
+ NativeTexture nativeTexture() override;
+
+ bool prepareCreate(QSize *adjustedSize = nullptr);
+ bool finishCreate();
+ ID3D11UnorderedAccessView *unorderedAccessViewForLevel(int level);
+ ID3D11Resource *textureResource() const
+ {
+ if (tex)
+ return tex;
+ else if (tex1D)
+ return tex1D;
+ return tex3D;
+ }
+
+ ID3D11Texture2D *tex = nullptr;
+ ID3D11Texture3D *tex3D = nullptr;
+ ID3D11Texture1D *tex1D = nullptr;
+ bool owns = true;
+ ID3D11ShaderResourceView *srv = nullptr;
+ DXGI_FORMAT dxgiFormat;
+ uint mipLevelCount = 0;
+ DXGI_SAMPLE_DESC sampleDesc;
+ ID3D11UnorderedAccessView *perLevelViews[QRhi::MAX_MIP_LEVELS];
+ uint generation = 0;
+ friend class QRhiD3D11;
+};
+
+struct QD3D11Sampler : public QRhiSampler
{
- bool enableDebugLayer = false;
+ QD3D11Sampler(QRhiImplementation *rhi, Filter magFilter, Filter minFilter, Filter mipmapMode,
+ AddressMode u, AddressMode v, AddressMode w);
+ ~QD3D11Sampler();
+ void destroy() override;
+ bool create() override;
- int framesUntilKillingDeviceViaTdr = -1;
- bool repeatDeviceKill = false;
+ ID3D11SamplerState *samplerState = nullptr;
+ uint generation = 0;
+ friend class QRhiD3D11;
};
-struct Q_GUI_EXPORT QRhiD3D11NativeHandles : public QRhiNativeHandles
+struct QD3D11RenderPassDescriptor : public QRhiRenderPassDescriptor
{
- void *dev = nullptr;
- void *context = nullptr;
+ QD3D11RenderPassDescriptor(QRhiImplementation *rhi);
+ ~QD3D11RenderPassDescriptor();
+ void destroy() override;
+ bool isCompatible(const QRhiRenderPassDescriptor *other) const override;
+ QRhiRenderPassDescriptor *newCompatibleRenderPassDescriptor() const override;
+ QVector<quint32> serializedFormat() const override;
+};
+
+struct QD3D11RenderTargetData
+{
+ QD3D11RenderTargetData(QRhiImplementation *)
+ {
+ for (int i = 0; i < MAX_COLOR_ATTACHMENTS; ++i)
+ rtv[i] = nullptr;
+ }
+
+ QD3D11RenderPassDescriptor *rp = nullptr;
+ QSize pixelSize;
+ float dpr = 1;
+ int sampleCount = 1;
+ int colorAttCount = 0;
+ int dsAttCount = 0;
+
+ static const int MAX_COLOR_ATTACHMENTS = 8;
+ ID3D11RenderTargetView *rtv[MAX_COLOR_ATTACHMENTS];
+ ID3D11DepthStencilView *dsv = nullptr;
+
+ QRhiRenderTargetAttachmentTracker::ResIdList currentResIdList;
};
-struct Q_GUI_EXPORT QRhiD3D11TextureNativeHandles : public QRhiNativeHandles
+struct QD3D11SwapChainRenderTarget : public QRhiSwapChainRenderTarget
{
- void *texture = nullptr; // ID3D11Texture2D*
+ QD3D11SwapChainRenderTarget(QRhiImplementation *rhi, QRhiSwapChain *swapchain);
+ ~QD3D11SwapChainRenderTarget();
+ void destroy() override;
+
+ QSize pixelSize() const override;
+ float devicePixelRatio() const override;
+ int sampleCount() const override;
+
+ QD3D11RenderTargetData d;
};
+struct QD3D11TextureRenderTarget : public QRhiTextureRenderTarget
+{
+ QD3D11TextureRenderTarget(QRhiImplementation *rhi, const QRhiTextureRenderTargetDescription &desc, Flags flags);
+ ~QD3D11TextureRenderTarget();
+ void destroy() override;
+
+ QSize pixelSize() const override;
+ float devicePixelRatio() const override;
+ int sampleCount() const override;
+
+ QRhiRenderPassDescriptor *newCompatibleRenderPassDescriptor() override;
+ bool create() override;
+
+ QD3D11RenderTargetData d;
+ bool ownsRtv[QD3D11RenderTargetData::MAX_COLOR_ATTACHMENTS];
+ ID3D11RenderTargetView *rtv[QD3D11RenderTargetData::MAX_COLOR_ATTACHMENTS];
+ bool ownsDsv = false;
+ ID3D11DepthStencilView *dsv = nullptr;
+ friend class QRhiD3D11;
+};
+
+struct QD3D11ShaderResourceBindings : public QRhiShaderResourceBindings
+{
+ QD3D11ShaderResourceBindings(QRhiImplementation *rhi);
+ ~QD3D11ShaderResourceBindings();
+ void destroy() override;
+ bool create() override;
+ void updateResources(UpdateFlags flags) override;
+
+ bool hasDynamicOffset = false;
+ QVarLengthArray<QRhiShaderResourceBinding, 8> sortedBindings;
+ uint generation = 0;
+
+ // Keep track of the generation number of each referenced QRhi* to be able
+ // to detect that the batched bindings are out of date.
+ struct BoundUniformBufferData {
+ quint64 id;
+ uint generation;
+ };
+ struct BoundSampledTextureData {
+ int count;
+ struct {
+ quint64 texId;
+ uint texGeneration;
+ quint64 samplerId;
+ uint samplerGeneration;
+ } d[QRhiShaderResourceBinding::Data::MAX_TEX_SAMPLER_ARRAY_SIZE];
+ };
+ struct BoundStorageImageData {
+ quint64 id;
+ uint generation;
+ };
+ struct BoundStorageBufferData {
+ quint64 id;
+ uint generation;
+ };
+ struct BoundResourceData {
+ union {
+ BoundUniformBufferData ubuf;
+ BoundSampledTextureData stex;
+ BoundStorageImageData simage;
+ BoundStorageBufferData sbuf;
+ };
+ };
+ QVarLengthArray<BoundResourceData, 8> boundResourceData;
+
+ struct StageUniformBufferBatches {
+ bool present = false;
+ QRhiBatchedBindings<ID3D11Buffer *> ubufs;
+ QRhiBatchedBindings<UINT> ubuforigbindings;
+ QRhiBatchedBindings<UINT> ubufoffsets;
+ QRhiBatchedBindings<UINT> ubufsizes;
+ void finish() {
+ present = ubufs.finish();
+ ubuforigbindings.finish();
+ ubufoffsets.finish();
+ ubufsizes.finish();
+ }
+ void clear() {
+ ubufs.clear();
+ ubuforigbindings.clear();
+ ubufoffsets.clear();
+ ubufsizes.clear();
+ }
+ };
+
+ struct StageSamplerBatches {
+ bool present = false;
+ QRhiBatchedBindings<ID3D11SamplerState *> samplers;
+ QRhiBatchedBindings<ID3D11ShaderResourceView *> shaderresources;
+ void finish() {
+ present = samplers.finish();
+ shaderresources.finish();
+ }
+ void clear() {
+ samplers.clear();
+ shaderresources.clear();
+ }
+ };
+
+ struct StageUavBatches {
+ bool present = false;
+ QRhiBatchedBindings<ID3D11UnorderedAccessView *> uavs;
+ void finish() {
+ present = uavs.finish();
+ }
+ void clear() {
+ uavs.clear();
+ }
+ };
+
+ StageUniformBufferBatches vsUniformBufferBatches;
+ StageUniformBufferBatches hsUniformBufferBatches;
+ StageUniformBufferBatches dsUniformBufferBatches;
+ StageUniformBufferBatches gsUniformBufferBatches;
+ StageUniformBufferBatches fsUniformBufferBatches;
+ StageUniformBufferBatches csUniformBufferBatches;
+
+ StageSamplerBatches vsSamplerBatches;
+ StageSamplerBatches hsSamplerBatches;
+ StageSamplerBatches dsSamplerBatches;
+ StageSamplerBatches gsSamplerBatches;
+ StageSamplerBatches fsSamplerBatches;
+ StageSamplerBatches csSamplerBatches;
+
+ StageUavBatches csUavBatches;
+
+ friend class QRhiD3D11;
+};
+
+Q_DECLARE_TYPEINFO(QD3D11ShaderResourceBindings::BoundResourceData, Q_RELOCATABLE_TYPE);
+
+struct QD3D11GraphicsPipeline : public QRhiGraphicsPipeline
+{
+ QD3D11GraphicsPipeline(QRhiImplementation *rhi);
+ ~QD3D11GraphicsPipeline();
+ void destroy() override;
+ bool create() override;
+
+ ID3D11DepthStencilState *dsState = nullptr;
+ ID3D11BlendState *blendState = nullptr;
+ struct {
+ ID3D11VertexShader *shader = nullptr;
+ QShader::NativeResourceBindingMap nativeResourceBindingMap;
+ } vs;
+ struct {
+ ID3D11HullShader *shader = nullptr;
+ QShader::NativeResourceBindingMap nativeResourceBindingMap;
+ } hs;
+ struct {
+ ID3D11DomainShader *shader = nullptr;
+ QShader::NativeResourceBindingMap nativeResourceBindingMap;
+ } ds;
+ struct {
+ ID3D11GeometryShader *shader = nullptr;
+ QShader::NativeResourceBindingMap nativeResourceBindingMap;
+ } gs;
+ struct {
+ ID3D11PixelShader *shader = nullptr;
+ QShader::NativeResourceBindingMap nativeResourceBindingMap;
+ } fs;
+ ID3D11InputLayout *inputLayout = nullptr;
+ D3D11_PRIMITIVE_TOPOLOGY d3dTopology = D3D11_PRIMITIVE_TOPOLOGY_TRIANGLELIST;
+ ID3D11RasterizerState *rastState = nullptr;
+ uint generation = 0;
+ friend class QRhiD3D11;
+};
+
+struct QD3D11ComputePipeline : public QRhiComputePipeline
+{
+ QD3D11ComputePipeline(QRhiImplementation *rhi);
+ ~QD3D11ComputePipeline();
+ void destroy() override;
+ bool create() override;
+
+ struct {
+ ID3D11ComputeShader *shader = nullptr;
+ QShader::NativeResourceBindingMap nativeResourceBindingMap;
+ } cs;
+ uint generation = 0;
+ friend class QRhiD3D11;
+};
+
+struct QD3D11SwapChain;
+
+struct QD3D11CommandBuffer : public QRhiCommandBuffer
+{
+ QD3D11CommandBuffer(QRhiImplementation *rhi);
+ ~QD3D11CommandBuffer();
+ void destroy() override;
+
+ // these must be kept at a reasonably low value otherwise sizeof Command explodes
+ static const int MAX_DYNAMIC_OFFSET_COUNT = 8;
+ static const int MAX_VERTEX_BUFFER_BINDING_COUNT = 8;
+
+ struct Command {
+ enum Cmd {
+ BeginFrame,
+ EndFrame,
+ ResetShaderResources,
+ SetRenderTarget,
+ Clear,
+ Viewport,
+ Scissor,
+ BindVertexBuffers,
+ BindIndexBuffer,
+ BindGraphicsPipeline,
+ BindShaderResources,
+ StencilRef,
+ BlendConstants,
+ Draw,
+ DrawIndexed,
+ UpdateSubRes,
+ CopySubRes,
+ ResolveSubRes,
+ GenMip,
+ DebugMarkBegin,
+ DebugMarkEnd,
+ DebugMarkMsg,
+ BindComputePipeline,
+ Dispatch
+ };
+ enum ClearFlag { Color = 1, Depth = 2, Stencil = 4 };
+ Cmd cmd;
+
+ // QRhi*/QD3D11* references should be kept at minimum (so no
+ // QRhiTexture/Buffer/etc. pointers).
+ union Args {
+ struct {
+ ID3D11Query *tsQuery;
+ ID3D11Query *tsDisjointQuery;
+ QD3D11RenderTargetData *swapchainData;
+ } beginFrame;
+ struct {
+ ID3D11Query *tsQuery;
+ ID3D11Query *tsDisjointQuery;
+ } endFrame;
+ struct {
+ QRhiRenderTarget *rt;
+ } setRenderTarget;
+ struct {
+ QRhiRenderTarget *rt;
+ int mask;
+ float c[4];
+ float d;
+ quint32 s;
+ } clear;
+ struct {
+ float x, y, w, h;
+ float d0, d1;
+ } viewport;
+ struct {
+ int x, y, w, h;
+ } scissor;
+ struct {
+ int startSlot;
+ int slotCount;
+ ID3D11Buffer *buffers[MAX_VERTEX_BUFFER_BINDING_COUNT];
+ UINT offsets[MAX_VERTEX_BUFFER_BINDING_COUNT];
+ UINT strides[MAX_VERTEX_BUFFER_BINDING_COUNT];
+ } bindVertexBuffers;
+ struct {
+ ID3D11Buffer *buffer;
+ quint32 offset;
+ DXGI_FORMAT format;
+ } bindIndexBuffer;
+ struct {
+ QD3D11GraphicsPipeline *ps;
+ } bindGraphicsPipeline;
+ struct {
+ QD3D11ShaderResourceBindings *srb;
+ bool offsetOnlyChange;
+ int dynamicOffsetCount;
+ uint dynamicOffsetPairs[MAX_DYNAMIC_OFFSET_COUNT * 2]; // binding, offsetInConstants
+ } bindShaderResources;
+ struct {
+ QD3D11GraphicsPipeline *ps;
+ quint32 ref;
+ } stencilRef;
+ struct {
+ QD3D11GraphicsPipeline *ps;
+ float c[4];
+ } blendConstants;
+ struct {
+ QD3D11GraphicsPipeline *ps;
+ quint32 vertexCount;
+ quint32 instanceCount;
+ quint32 firstVertex;
+ quint32 firstInstance;
+ } draw;
+ struct {
+ QD3D11GraphicsPipeline *ps;
+ quint32 indexCount;
+ quint32 instanceCount;
+ quint32 firstIndex;
+ qint32 vertexOffset;
+ quint32 firstInstance;
+ } drawIndexed;
+ struct {
+ ID3D11Resource *dst;
+ UINT dstSubRes;
+ bool hasDstBox;
+ D3D11_BOX dstBox;
+ const void *src; // must come from retain*()
+ UINT srcRowPitch;
+ } updateSubRes;
+ struct {
+ ID3D11Resource *dst;
+ UINT dstSubRes;
+ UINT dstX;
+ UINT dstY;
+ UINT dstZ;
+ ID3D11Resource *src;
+ UINT srcSubRes;
+ bool hasSrcBox;
+ D3D11_BOX srcBox;
+ } copySubRes;
+ struct {
+ ID3D11Resource *dst;
+ UINT dstSubRes;
+ ID3D11Resource *src;
+ UINT srcSubRes;
+ DXGI_FORMAT format;
+ } resolveSubRes;
+ struct {
+ ID3D11ShaderResourceView *srv;
+ } genMip;
+ struct {
+ char s[64];
+ } debugMark;
+ struct {
+ QD3D11ComputePipeline *ps;
+ } bindComputePipeline;
+ struct {
+ UINT x;
+ UINT y;
+ UINT z;
+ } dispatch;
+ } args;
+ };
+
+ enum PassType {
+ NoPass,
+ RenderPass,
+ ComputePass
+ };
+
+ QRhiBackendCommandList<Command> commands;
+ PassType recordingPass;
+ double lastGpuTime = 0;
+ QRhiRenderTarget *currentTarget;
+ QRhiGraphicsPipeline *currentGraphicsPipeline;
+ QRhiComputePipeline *currentComputePipeline;
+ uint currentPipelineGeneration;
+ QRhiShaderResourceBindings *currentGraphicsSrb;
+ QRhiShaderResourceBindings *currentComputeSrb;
+ uint currentSrbGeneration;
+ ID3D11Buffer *currentIndexBuffer;
+ quint32 currentIndexOffset;
+ DXGI_FORMAT currentIndexFormat;
+ ID3D11Buffer *currentVertexBuffers[D3D11_IA_VERTEX_INPUT_RESOURCE_SLOT_COUNT];
+ quint32 currentVertexOffsets[D3D11_IA_VERTEX_INPUT_RESOURCE_SLOT_COUNT];
+
+ QVarLengthArray<QByteArray, 4> dataRetainPool;
+ QVarLengthArray<QRhiBufferData, 4> bufferDataRetainPool;
+ QVarLengthArray<QImage, 4> imageRetainPool;
+
+ // relies heavily on implicit sharing (no copies of the actual data will be made)
+ const uchar *retainData(const QByteArray &data) {
+ dataRetainPool.append(data);
+ return reinterpret_cast<const uchar *>(dataRetainPool.last().constData());
+ }
+ const uchar *retainBufferData(const QRhiBufferData &data) {
+ bufferDataRetainPool.append(data);
+ return reinterpret_cast<const uchar *>(bufferDataRetainPool.last().constData());
+ }
+ const uchar *retainImage(const QImage &image) {
+ imageRetainPool.append(image);
+ return imageRetainPool.last().constBits();
+ }
+ void resetCommands() {
+ commands.reset();
+ dataRetainPool.clear();
+ bufferDataRetainPool.clear();
+ imageRetainPool.clear();
+ }
+ void resetState() {
+ recordingPass = NoPass;
+ // do not zero lastGpuTime
+ currentTarget = nullptr;
+ resetCommands();
+ resetCachedState();
+ }
+ void resetCachedState() {
+ currentGraphicsPipeline = nullptr;
+ currentComputePipeline = nullptr;
+ currentPipelineGeneration = 0;
+ currentGraphicsSrb = nullptr;
+ currentComputeSrb = nullptr;
+ currentSrbGeneration = 0;
+ currentIndexBuffer = nullptr;
+ currentIndexOffset = 0;
+ currentIndexFormat = DXGI_FORMAT_R16_UINT;
+ memset(currentVertexBuffers, 0, sizeof(currentVertexBuffers));
+ memset(currentVertexOffsets, 0, sizeof(currentVertexOffsets));
+ }
+};
+
+struct QD3D11SwapChainTimestamps
+{
+ static const int TIMESTAMP_PAIRS = 2;
+
+ bool active[TIMESTAMP_PAIRS] = {};
+ ID3D11Query *disjointQuery[TIMESTAMP_PAIRS] = {};
+ ID3D11Query *query[TIMESTAMP_PAIRS * 2] = {};
+
+ bool prepare(QRhiD3D11 *rhiD);
+ void destroy();
+ bool tryQueryTimestamps(int idx, ID3D11DeviceContext *context, double *elapsedSec);
+};
+
+struct QD3D11SwapChain : public QRhiSwapChain
+{
+ QD3D11SwapChain(QRhiImplementation *rhi);
+ ~QD3D11SwapChain();
+ void destroy() override;
+
+ QRhiCommandBuffer *currentFrameCommandBuffer() override;
+ QRhiRenderTarget *currentFrameRenderTarget() override;
+ QRhiRenderTarget *currentFrameRenderTarget(StereoTargetBuffer targetBuffer) override;
+
+ QSize surfacePixelSize() override;
+ bool isFormatSupported(Format f) override;
+ QRhiSwapChainHdrInfo hdrInfo() override;
+
+ QRhiRenderPassDescriptor *newCompatibleRenderPassDescriptor() override;
+ bool createOrResize() override;
+
+ void releaseBuffers();
+ bool newColorBuffer(const QSize &size, DXGI_FORMAT format, DXGI_SAMPLE_DESC sampleDesc,
+ ID3D11Texture2D **tex, ID3D11RenderTargetView **rtv) const;
+
+ QWindow *window = nullptr;
+ QSize pixelSize;
+ QD3D11SwapChainRenderTarget rt;
+ QD3D11SwapChainRenderTarget rtRight;
+ QD3D11CommandBuffer cb;
+ DXGI_FORMAT colorFormat;
+ DXGI_FORMAT srgbAdjustedColorFormat;
+ IDXGISwapChain *swapChain = nullptr;
+ UINT swapChainFlags = 0;
+ ID3D11Texture2D *backBufferTex;
+ ID3D11RenderTargetView *backBufferRtv;
+ ID3D11RenderTargetView *backBufferRtvRight = nullptr;
+ static const int BUFFER_COUNT = 2;
+ ID3D11Texture2D *msaaTex[BUFFER_COUNT];
+ ID3D11RenderTargetView *msaaRtv[BUFFER_COUNT];
+ DXGI_SAMPLE_DESC sampleDesc;
+ int currentFrameSlot = 0;
+ int frameCount = 0;
+ QD3D11RenderBuffer *ds = nullptr;
+ UINT swapInterval = 1;
+ IDCompositionTarget *dcompTarget = nullptr;
+ IDCompositionVisual *dcompVisual = nullptr;
+ QD3D11SwapChainTimestamps timestamps;
+ int currentTimestampPairIndex = 0;
+};
+
+class QRhiD3D11 : public QRhiImplementation
+{
+public:
+ QRhiD3D11(QRhiD3D11InitParams *params, QRhiD3D11NativeHandles *importDevice = nullptr);
+
+ bool create(QRhi::Flags flags) override;
+ void destroy() override;
+
+ QRhiGraphicsPipeline *createGraphicsPipeline() override;
+ QRhiComputePipeline *createComputePipeline() override;
+ QRhiShaderResourceBindings *createShaderResourceBindings() override;
+ QRhiBuffer *createBuffer(QRhiBuffer::Type type,
+ QRhiBuffer::UsageFlags usage,
+ quint32 size) override;
+ QRhiRenderBuffer *createRenderBuffer(QRhiRenderBuffer::Type type,
+ const QSize &pixelSize,
+ int sampleCount,
+ QRhiRenderBuffer::Flags flags,
+ QRhiTexture::Format backingFormatHint) override;
+ QRhiTexture *createTexture(QRhiTexture::Format format,
+ const QSize &pixelSize,
+ int depth,
+ int arraySize,
+ int sampleCount,
+ QRhiTexture::Flags flags) override;
+ QRhiSampler *createSampler(QRhiSampler::Filter magFilter,
+ QRhiSampler::Filter minFilter,
+ QRhiSampler::Filter mipmapMode,
+ QRhiSampler:: AddressMode u,
+ QRhiSampler::AddressMode v,
+ QRhiSampler::AddressMode w) override;
+
+ QRhiTextureRenderTarget *createTextureRenderTarget(const QRhiTextureRenderTargetDescription &desc,
+ QRhiTextureRenderTarget::Flags flags) override;
+
+ QRhiSwapChain *createSwapChain() override;
+ QRhi::FrameOpResult beginFrame(QRhiSwapChain *swapChain, QRhi::BeginFrameFlags flags) override;
+ QRhi::FrameOpResult endFrame(QRhiSwapChain *swapChain, QRhi::EndFrameFlags flags) override;
+ QRhi::FrameOpResult beginOffscreenFrame(QRhiCommandBuffer **cb, QRhi::BeginFrameFlags flags) override;
+ QRhi::FrameOpResult endOffscreenFrame(QRhi::EndFrameFlags flags) override;
+ QRhi::FrameOpResult finish() override;
+
+ void resourceUpdate(QRhiCommandBuffer *cb, QRhiResourceUpdateBatch *resourceUpdates) override;
+
+ void beginPass(QRhiCommandBuffer *cb,
+ QRhiRenderTarget *rt,
+ const QColor &colorClearValue,
+ const QRhiDepthStencilClearValue &depthStencilClearValue,
+ QRhiResourceUpdateBatch *resourceUpdates,
+ QRhiCommandBuffer::BeginPassFlags flags) override;
+ void endPass(QRhiCommandBuffer *cb, QRhiResourceUpdateBatch *resourceUpdates) override;
+
+ void setGraphicsPipeline(QRhiCommandBuffer *cb,
+ QRhiGraphicsPipeline *ps) override;
+
+ void setShaderResources(QRhiCommandBuffer *cb,
+ QRhiShaderResourceBindings *srb,
+ int dynamicOffsetCount,
+ const QRhiCommandBuffer::DynamicOffset *dynamicOffsets) override;
+
+ void setVertexInput(QRhiCommandBuffer *cb,
+ int startBinding, int bindingCount, const QRhiCommandBuffer::VertexInput *bindings,
+ QRhiBuffer *indexBuf, quint32 indexOffset,
+ QRhiCommandBuffer::IndexFormat indexFormat) override;
+
+ void setViewport(QRhiCommandBuffer *cb, const QRhiViewport &viewport) override;
+ void setScissor(QRhiCommandBuffer *cb, const QRhiScissor &scissor) override;
+ void setBlendConstants(QRhiCommandBuffer *cb, const QColor &c) override;
+ void setStencilRef(QRhiCommandBuffer *cb, quint32 refValue) override;
+
+ void draw(QRhiCommandBuffer *cb, quint32 vertexCount,
+ quint32 instanceCount, quint32 firstVertex, quint32 firstInstance) override;
+
+ void drawIndexed(QRhiCommandBuffer *cb, quint32 indexCount,
+ quint32 instanceCount, quint32 firstIndex,
+ qint32 vertexOffset, quint32 firstInstance) override;
+
+ void debugMarkBegin(QRhiCommandBuffer *cb, const QByteArray &name) override;
+ void debugMarkEnd(QRhiCommandBuffer *cb) override;
+ void debugMarkMsg(QRhiCommandBuffer *cb, const QByteArray &msg) override;
+
+ void beginComputePass(QRhiCommandBuffer *cb,
+ QRhiResourceUpdateBatch *resourceUpdates,
+ QRhiCommandBuffer::BeginPassFlags flags) override;
+ void endComputePass(QRhiCommandBuffer *cb, QRhiResourceUpdateBatch *resourceUpdates) override;
+ void setComputePipeline(QRhiCommandBuffer *cb, QRhiComputePipeline *ps) override;
+ void dispatch(QRhiCommandBuffer *cb, int x, int y, int z) override;
+
+ const QRhiNativeHandles *nativeHandles(QRhiCommandBuffer *cb) override;
+ void beginExternal(QRhiCommandBuffer *cb) override;
+ void endExternal(QRhiCommandBuffer *cb) override;
+ double lastCompletedGpuTime(QRhiCommandBuffer *cb) override;
+
+ QList<int> supportedSampleCounts() const override;
+ int ubufAlignment() const override;
+ bool isYUpInFramebuffer() const override;
+ bool isYUpInNDC() const override;
+ bool isClipDepthZeroToOne() const override;
+ QMatrix4x4 clipSpaceCorrMatrix() const override;
+ bool isTextureFormatSupported(QRhiTexture::Format format, QRhiTexture::Flags flags) const override;
+ bool isFeatureSupported(QRhi::Feature feature) const override;
+ int resourceLimit(QRhi::ResourceLimit limit) const override;
+ const QRhiNativeHandles *nativeHandles() override;
+ QRhiDriverInfo driverInfo() const override;
+ QRhiStats statistics() override;
+ bool makeThreadLocalNativeContextCurrent() override;
+ void releaseCachedResources() override;
+ bool isDeviceLost() const override;
+
+ QByteArray pipelineCacheData() override;
+ void setPipelineCacheData(const QByteArray &data) override;
+
+ void enqueueSubresUpload(QD3D11Texture *texD, QD3D11CommandBuffer *cbD,
+ int layer, int level, const QRhiTextureSubresourceUploadDescription &subresDesc);
+ void enqueueResourceUpdates(QRhiCommandBuffer *cb, QRhiResourceUpdateBatch *resourceUpdates);
+ void updateShaderResourceBindings(QD3D11ShaderResourceBindings *srbD,
+ const QShader::NativeResourceBindingMap *nativeResourceBindingMaps[]);
+ void executeBufferHostWrites(QD3D11Buffer *bufD);
+ void bindShaderResources(QD3D11ShaderResourceBindings *srbD,
+ const uint *dynOfsPairs, int dynOfsPairCount,
+ bool offsetOnlyChange);
+ void resetShaderResources();
+ void executeCommandBuffer(QD3D11CommandBuffer *cbD);
+ DXGI_SAMPLE_DESC effectiveSampleDesc(int sampleCount) const;
+ void finishActiveReadbacks();
+ void reportLiveObjects(ID3D11Device *device);
+ void clearShaderCache();
+ QByteArray compileHlslShaderSource(const QShader &shader, QShader::Variant shaderVariant, uint flags,
+ QString *error, QShaderKey *usedShaderKey);
+ bool ensureDirectCompositionDevice();
+
+ QRhi::Flags rhiFlags;
+ bool debugLayer = false;
+ bool importedDeviceAndContext = false;
+ ID3D11Device *dev = nullptr;
+ ID3D11DeviceContext1 *context = nullptr;
+ D3D_FEATURE_LEVEL featureLevel = D3D_FEATURE_LEVEL(0);
+ LUID adapterLuid = {};
+ ID3DUserDefinedAnnotation *annotations = nullptr;
+ IDXGIAdapter1 *activeAdapter = nullptr;
+ IDXGIFactory1 *dxgiFactory = nullptr;
+ IDCompositionDevice *dcompDevice = nullptr;
+ bool supportsAllowTearing = false;
+ bool useLegacySwapchainModel = false;
+ bool deviceLost = false;
+ QRhiD3D11NativeHandles nativeHandlesStruct;
+ QRhiDriverInfo driverInfoStruct;
+
+ struct {
+ int vsHighestActiveVertexBufferBinding = -1;
+ bool vsHasIndexBufferBound = false;
+ int vsHighestActiveSrvBinding = -1;
+ int hsHighestActiveSrvBinding = -1;
+ int dsHighestActiveSrvBinding = -1;
+ int gsHighestActiveSrvBinding = -1;
+ int fsHighestActiveSrvBinding = -1;
+ int csHighestActiveSrvBinding = -1;
+ int csHighestActiveUavBinding = -1;
+ QD3D11SwapChain *currentSwapChain = nullptr;
+ } contextState;
+
+ struct OffscreenFrame {
+ OffscreenFrame(QRhiImplementation *rhi) : cbWrapper(rhi) { }
+ bool active = false;
+ QD3D11CommandBuffer cbWrapper;
+ ID3D11Query *tsQueries[2] = {};
+ ID3D11Query *tsDisjointQuery = nullptr;
+ } ofr;
+
+ struct TextureReadback {
+ QRhiReadbackDescription desc;
+ QRhiReadbackResult *result;
+ ID3D11Texture2D *stagingTex;
+ quint32 byteSize;
+ quint32 bpl;
+ QSize pixelSize;
+ QRhiTexture::Format format;
+ };
+ QVarLengthArray<TextureReadback, 2> activeTextureReadbacks;
+ struct BufferReadback {
+ QRhiReadbackResult *result;
+ quint32 byteSize;
+ ID3D11Buffer *stagingBuf;
+ };
+ QVarLengthArray<BufferReadback, 2> activeBufferReadbacks;
+
+ struct Shader {
+ Shader() = default;
+ Shader(IUnknown *s, const QByteArray &bytecode, const QShader::NativeResourceBindingMap &rbm)
+ : s(s), bytecode(bytecode), nativeResourceBindingMap(rbm) { }
+ IUnknown *s;
+ QByteArray bytecode;
+ QShader::NativeResourceBindingMap nativeResourceBindingMap;
+ };
+ QHash<QRhiShaderStage, Shader> m_shaderCache;
+
+ // This is what gets exposed as the "pipeline cache", not that that concept
+ // applies anyway. Here we are just storing the DX bytecode for a shader so
+ // we can skip the HLSL->DXBC compilation when the QShader has HLSL source
+ // code and the same shader source has already been compiled before.
+ // m_shaderCache seemingly does the same, but this here does not care about
+ // the ID3D11*Shader, this is just about the bytecode and about allowing
+ // the data to be serialized to persistent storage and then reloaded in
+ // future runs of the app, or when creating another QRhi, etc.
+ struct BytecodeCacheKey {
+ QByteArray sourceHash;
+ QByteArray target;
+ QByteArray entryPoint;
+ uint compileFlags;
+ };
+ QHash<BytecodeCacheKey, QByteArray> m_bytecodeCache;
+};
+
+Q_DECLARE_TYPEINFO(QRhiD3D11::TextureReadback, Q_RELOCATABLE_TYPE);
+Q_DECLARE_TYPEINFO(QRhiD3D11::BufferReadback, Q_RELOCATABLE_TYPE);
+
+inline bool operator==(const QRhiD3D11::BytecodeCacheKey &a, const QRhiD3D11::BytecodeCacheKey &b) noexcept
+{
+ return a.sourceHash == b.sourceHash
+ && a.target == b.target
+ && a.entryPoint == b.entryPoint
+ && a.compileFlags == b.compileFlags;
+}
+
+inline bool operator!=(const QRhiD3D11::BytecodeCacheKey &a, const QRhiD3D11::BytecodeCacheKey &b) noexcept
+{
+ return !(a == b);
+}
+
+inline size_t qHash(const QRhiD3D11::BytecodeCacheKey &k, size_t seed = 0) noexcept
+{
+ return qHash(k.sourceHash, seed) ^ qHash(k.target) ^ qHash(k.entryPoint) ^ k.compileFlags;
+}
+
QT_END_NAMESPACE
#endif
diff --git a/src/gui/rhi/qrhid3d11_p_p.h b/src/gui/rhi/qrhid3d11_p_p.h
deleted file mode 100644
index 8f02c4300b..0000000000
--- a/src/gui/rhi/qrhid3d11_p_p.h
+++ /dev/null
@@ -1,728 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2019 The Qt Company Ltd.
-** Contact: http://www.qt.io/licensing/
-**
-** This file is part of the Qt Gui module
-**
-** $QT_BEGIN_LICENSE:LGPL3$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef QRHID3D11_P_H
-#define QRHID3D11_P_H
-
-//
-// W A R N I N G
-// -------------
-//
-// This file is not part of the Qt API. It exists purely as an
-// implementation detail. This header file may change from version to
-// version without notice, or even be removed.
-//
-// We mean it.
-//
-
-#include "qrhid3d11_p.h"
-#include "qrhi_p_p.h"
-#include "qshaderdescription_p.h"
-#include <QWindow>
-
-#include <d3d11_1.h>
-#include <dxgi1_3.h>
-
-QT_BEGIN_NAMESPACE
-
-struct QD3D11Buffer : public QRhiBuffer
-{
- QD3D11Buffer(QRhiImplementation *rhi, Type type, UsageFlags usage, int size);
- ~QD3D11Buffer();
- void release() override;
- bool build() override;
-
- ID3D11UnorderedAccessView *unorderedAccessView();
-
- ID3D11Buffer *buffer = nullptr;
- QByteArray dynBuf;
- bool hasPendingDynamicUpdates = false;
- ID3D11UnorderedAccessView *uav = nullptr;
- uint generation = 0;
- friend class QRhiD3D11;
-};
-
-struct QD3D11RenderBuffer : public QRhiRenderBuffer
-{
- QD3D11RenderBuffer(QRhiImplementation *rhi, Type type, const QSize &pixelSize,
- int sampleCount, QRhiRenderBuffer::Flags flags);
- ~QD3D11RenderBuffer();
- void release() override;
- bool build() override;
- QRhiTexture::Format backingFormat() const override;
-
- ID3D11Texture2D *tex = nullptr;
- ID3D11DepthStencilView *dsv = nullptr;
- ID3D11RenderTargetView *rtv = nullptr;
- DXGI_FORMAT dxgiFormat;
- DXGI_SAMPLE_DESC sampleDesc;
- friend class QRhiD3D11;
-};
-
-struct QD3D11Texture : public QRhiTexture
-{
- QD3D11Texture(QRhiImplementation *rhi, Format format, const QSize &pixelSize,
- int sampleCount, Flags flags);
- ~QD3D11Texture();
- void release() override;
- bool build() override;
- bool buildFrom(const QRhiNativeHandles *src) override;
- bool buildFrom(NativeTexture src) override;
- const QRhiNativeHandles *nativeHandles() override;
- NativeTexture nativeTexture() override;
-
- bool prepareBuild(QSize *adjustedSize = nullptr);
- bool finishBuild();
- ID3D11UnorderedAccessView *unorderedAccessViewForLevel(int level);
-
- ID3D11Texture2D *tex = nullptr;
- bool owns = true;
- ID3D11ShaderResourceView *srv = nullptr;
- DXGI_FORMAT dxgiFormat;
- uint mipLevelCount = 0;
- DXGI_SAMPLE_DESC sampleDesc;
- QRhiD3D11TextureNativeHandles nativeHandlesStruct;
- ID3D11UnorderedAccessView *perLevelViews[QRhi::MAX_LEVELS];
- uint generation = 0;
- friend class QRhiD3D11;
-};
-
-struct QD3D11Sampler : public QRhiSampler
-{
- QD3D11Sampler(QRhiImplementation *rhi, Filter magFilter, Filter minFilter, Filter mipmapMode,
- AddressMode u, AddressMode v);
- ~QD3D11Sampler();
- void release() override;
- bool build() override;
-
- ID3D11SamplerState *samplerState = nullptr;
- uint generation = 0;
- friend class QRhiD3D11;
-};
-
-struct QD3D11RenderPassDescriptor : public QRhiRenderPassDescriptor
-{
- QD3D11RenderPassDescriptor(QRhiImplementation *rhi);
- ~QD3D11RenderPassDescriptor();
- void release() override;
- bool isCompatible(const QRhiRenderPassDescriptor *other) const override;
-};
-
-struct QD3D11RenderTargetData
-{
- QD3D11RenderTargetData(QRhiImplementation *)
- {
- for (int i = 0; i < MAX_COLOR_ATTACHMENTS; ++i)
- rtv[i] = nullptr;
- }
-
- QD3D11RenderPassDescriptor *rp = nullptr;
- QSize pixelSize;
- float dpr = 1;
- int sampleCount = 1;
- int colorAttCount = 0;
- int dsAttCount = 0;
-
- static const int MAX_COLOR_ATTACHMENTS = 8;
- ID3D11RenderTargetView *rtv[MAX_COLOR_ATTACHMENTS];
- ID3D11DepthStencilView *dsv = nullptr;
-};
-
-struct QD3D11ReferenceRenderTarget : public QRhiRenderTarget
-{
- QD3D11ReferenceRenderTarget(QRhiImplementation *rhi);
- ~QD3D11ReferenceRenderTarget();
- void release() override;
-
- QSize pixelSize() const override;
- float devicePixelRatio() const override;
- int sampleCount() const override;
-
- QD3D11RenderTargetData d;
-};
-
-struct QD3D11TextureRenderTarget : public QRhiTextureRenderTarget
-{
- QD3D11TextureRenderTarget(QRhiImplementation *rhi, const QRhiTextureRenderTargetDescription &desc, Flags flags);
- ~QD3D11TextureRenderTarget();
- void release() override;
-
- QSize pixelSize() const override;
- float devicePixelRatio() const override;
- int sampleCount() const override;
-
- QRhiRenderPassDescriptor *newCompatibleRenderPassDescriptor() override;
- bool build() override;
-
- QD3D11RenderTargetData d;
- bool ownsRtv[QD3D11RenderTargetData::MAX_COLOR_ATTACHMENTS];
- ID3D11RenderTargetView *rtv[QD3D11RenderTargetData::MAX_COLOR_ATTACHMENTS];
- bool ownsDsv = false;
- ID3D11DepthStencilView *dsv = nullptr;
- friend class QRhiD3D11;
-};
-
-struct QD3D11ShaderResourceBindings : public QRhiShaderResourceBindings
-{
- QD3D11ShaderResourceBindings(QRhiImplementation *rhi);
- ~QD3D11ShaderResourceBindings();
- void release() override;
- bool build() override;
-
- QVarLengthArray<QRhiShaderResourceBinding, 8> sortedBindings;
- uint generation = 0;
-
- // Keep track of the generation number of each referenced QRhi* to be able
- // to detect that the batched bindings are out of date.
- struct BoundUniformBufferData {
- quint64 id;
- uint generation;
- };
- struct BoundSampledTextureData {
- quint64 texId;
- uint texGeneration;
- quint64 samplerId;
- uint samplerGeneration;
- };
- struct BoundStorageImageData {
- quint64 id;
- uint generation;
- };
- struct BoundStorageBufferData {
- quint64 id;
- uint generation;
- };
- struct BoundResourceData {
- union {
- BoundUniformBufferData ubuf;
- BoundSampledTextureData stex;
- BoundStorageImageData simage;
- BoundStorageBufferData sbuf;
- };
- };
- QVarLengthArray<BoundResourceData, 8> boundResourceData;
-
- QRhiBatchedBindings<ID3D11Buffer *> vsubufs;
- QRhiBatchedBindings<UINT> vsubufoffsets;
- QRhiBatchedBindings<UINT> vsubufsizes;
-
- QRhiBatchedBindings<ID3D11Buffer *> fsubufs;
- QRhiBatchedBindings<UINT> fsubufoffsets;
- QRhiBatchedBindings<UINT> fsubufsizes;
-
- QRhiBatchedBindings<ID3D11Buffer *> csubufs;
- QRhiBatchedBindings<UINT> csubufoffsets;
- QRhiBatchedBindings<UINT> csubufsizes;
-
- QRhiBatchedBindings<ID3D11SamplerState *> vssamplers;
- QRhiBatchedBindings<ID3D11ShaderResourceView *> vsshaderresources;
-
- QRhiBatchedBindings<ID3D11SamplerState *> fssamplers;
- QRhiBatchedBindings<ID3D11ShaderResourceView *> fsshaderresources;
-
- QRhiBatchedBindings<ID3D11SamplerState *> cssamplers;
- QRhiBatchedBindings<ID3D11ShaderResourceView *> csshaderresources;
-
- QRhiBatchedBindings<ID3D11UnorderedAccessView *> csUAVs;
-
- friend class QRhiD3D11;
-};
-
-Q_DECLARE_TYPEINFO(QD3D11ShaderResourceBindings::BoundResourceData, Q_MOVABLE_TYPE);
-
-struct QD3D11GraphicsPipeline : public QRhiGraphicsPipeline
-{
- QD3D11GraphicsPipeline(QRhiImplementation *rhi);
- ~QD3D11GraphicsPipeline();
- void release() override;
- bool build() override;
-
- ID3D11DepthStencilState *dsState = nullptr;
- ID3D11BlendState *blendState = nullptr;
- ID3D11VertexShader *vs = nullptr;
- ID3D11PixelShader *fs = nullptr;
- ID3D11InputLayout *inputLayout = nullptr;
- D3D11_PRIMITIVE_TOPOLOGY d3dTopology = D3D11_PRIMITIVE_TOPOLOGY_TRIANGLELIST;
- ID3D11RasterizerState *rastState = nullptr;
- uint generation = 0;
- friend class QRhiD3D11;
-};
-
-struct QD3D11ComputePipeline : public QRhiComputePipeline
-{
- QD3D11ComputePipeline(QRhiImplementation *rhi);
- ~QD3D11ComputePipeline();
- void release() override;
- bool build() override;
-
- ID3D11ComputeShader *cs = nullptr;
- uint generation = 0;
- friend class QRhiD3D11;
-};
-
-struct QD3D11SwapChain;
-
-struct QD3D11CommandBuffer : public QRhiCommandBuffer
-{
- QD3D11CommandBuffer(QRhiImplementation *rhi);
- ~QD3D11CommandBuffer();
- void release() override;
-
- struct Command {
- enum Cmd {
- ResetShaderResources,
- SetRenderTarget,
- Clear,
- Viewport,
- Scissor,
- BindVertexBuffers,
- BindIndexBuffer,
- BindGraphicsPipeline,
- BindShaderResources,
- StencilRef,
- BlendConstants,
- Draw,
- DrawIndexed,
- UpdateSubRes,
- CopySubRes,
- ResolveSubRes,
- GenMip,
- DebugMarkBegin,
- DebugMarkEnd,
- DebugMarkMsg,
- BindComputePipeline,
- Dispatch
- };
- enum ClearFlag { Color = 1, Depth = 2, Stencil = 4 };
- Cmd cmd;
-
- static const int MAX_UBUF_BINDINGS = 32; // should be D3D11_COMMONSHADER_INPUT_RESOURCE_SLOT_COUNT but 128 is a waste of space for our purposes
-
- // QRhi*/QD3D11* references should be kept at minimum (so no
- // QRhiTexture/Buffer/etc. pointers).
- union {
- struct {
- QRhiRenderTarget *rt;
- } setRenderTarget;
- struct {
- QRhiRenderTarget *rt;
- int mask;
- float c[4];
- float d;
- quint32 s;
- } clear;
- struct {
- float x, y, w, h;
- float d0, d1;
- } viewport;
- struct {
- int x, y, w, h;
- } scissor;
- struct {
- int startSlot;
- int slotCount;
- ID3D11Buffer *buffers[D3D11_IA_VERTEX_INPUT_RESOURCE_SLOT_COUNT];
- UINT offsets[D3D11_IA_VERTEX_INPUT_RESOURCE_SLOT_COUNT];
- UINT strides[D3D11_IA_VERTEX_INPUT_RESOURCE_SLOT_COUNT];
- } bindVertexBuffers;
- struct {
- ID3D11Buffer *buffer;
- quint32 offset;
- DXGI_FORMAT format;
- } bindIndexBuffer;
- struct {
- QD3D11GraphicsPipeline *ps;
- } bindGraphicsPipeline;
- struct {
- QD3D11ShaderResourceBindings *srb;
- bool offsetOnlyChange;
- int dynamicOffsetCount;
- uint dynamicOffsetPairs[MAX_UBUF_BINDINGS * 2]; // binding, offsetInConstants
- } bindShaderResources;
- struct {
- QD3D11GraphicsPipeline *ps;
- quint32 ref;
- } stencilRef;
- struct {
- QD3D11GraphicsPipeline *ps;
- float c[4];
- } blendConstants;
- struct {
- QD3D11GraphicsPipeline *ps;
- quint32 vertexCount;
- quint32 instanceCount;
- quint32 firstVertex;
- quint32 firstInstance;
- } draw;
- struct {
- QD3D11GraphicsPipeline *ps;
- quint32 indexCount;
- quint32 instanceCount;
- quint32 firstIndex;
- qint32 vertexOffset;
- quint32 firstInstance;
- } drawIndexed;
- struct {
- ID3D11Resource *dst;
- UINT dstSubRes;
- bool hasDstBox;
- D3D11_BOX dstBox;
- const void *src; // must come from retain*()
- UINT srcRowPitch;
- } updateSubRes;
- struct {
- ID3D11Resource *dst;
- UINT dstSubRes;
- UINT dstX;
- UINT dstY;
- ID3D11Resource *src;
- UINT srcSubRes;
- bool hasSrcBox;
- D3D11_BOX srcBox;
- } copySubRes;
- struct {
- ID3D11Resource *dst;
- UINT dstSubRes;
- ID3D11Resource *src;
- UINT srcSubRes;
- DXGI_FORMAT format;
- } resolveSubRes;
- struct {
- ID3D11ShaderResourceView *srv;
- } genMip;
- struct {
- char s[64];
- } debugMark;
- struct {
- QD3D11ComputePipeline *ps;
- } bindComputePipeline;
- struct {
- UINT x;
- UINT y;
- UINT z;
- } dispatch;
- } args;
- };
-
- enum PassType {
- NoPass,
- RenderPass,
- ComputePass
- };
-
- QVector<Command> commands;
- PassType recordingPass;
- QRhiRenderTarget *currentTarget;
- QRhiGraphicsPipeline *currentGraphicsPipeline;
- QRhiComputePipeline *currentComputePipeline;
- uint currentPipelineGeneration;
- QRhiShaderResourceBindings *currentGraphicsSrb;
- QRhiShaderResourceBindings *currentComputeSrb;
- uint currentSrbGeneration;
- ID3D11Buffer *currentIndexBuffer;
- quint32 currentIndexOffset;
- DXGI_FORMAT currentIndexFormat;
- ID3D11Buffer *currentVertexBuffers[D3D11_IA_VERTEX_INPUT_RESOURCE_SLOT_COUNT];
- quint32 currentVertexOffsets[D3D11_IA_VERTEX_INPUT_RESOURCE_SLOT_COUNT];
-
- QVector<QByteArray> dataRetainPool;
- QVector<QImage> imageRetainPool;
-
- // relies heavily on implicit sharing (no copies of the actual data will be made)
- const uchar *retainData(const QByteArray &data) {
- dataRetainPool.append(data);
- return reinterpret_cast<const uchar *>(dataRetainPool.constLast().constData());
- }
- const uchar *retainImage(const QImage &image) {
- imageRetainPool.append(image);
- return imageRetainPool.constLast().constBits();
- }
- void resetCommands() {
- commands.clear();
- dataRetainPool.clear();
- imageRetainPool.clear();
- }
- void resetState() {
- recordingPass = NoPass;
- currentTarget = nullptr;
- resetCommands();
- resetCachedState();
- }
- void resetCachedState() {
- currentGraphicsPipeline = nullptr;
- currentComputePipeline = nullptr;
- currentPipelineGeneration = 0;
- resetCachedShaderResourceState();
- }
- void resetCachedShaderResourceState() {
- currentGraphicsSrb = nullptr;
- currentComputeSrb = nullptr;
- currentSrbGeneration = 0;
- currentIndexBuffer = nullptr;
- currentIndexOffset = 0;
- currentIndexFormat = DXGI_FORMAT_R16_UINT;
- memset(currentVertexBuffers, 0, sizeof(currentVertexBuffers));
- memset(currentVertexOffsets, 0, sizeof(currentVertexOffsets));
- }
-};
-
-Q_DECLARE_TYPEINFO(QD3D11CommandBuffer::Command, Q_MOVABLE_TYPE);
-
-struct QD3D11SwapChain : public QRhiSwapChain
-{
- QD3D11SwapChain(QRhiImplementation *rhi);
- ~QD3D11SwapChain();
- void release() override;
-
- QRhiCommandBuffer *currentFrameCommandBuffer() override;
- QRhiRenderTarget *currentFrameRenderTarget() override;
-
- QSize surfacePixelSize() override;
-
- QRhiRenderPassDescriptor *newCompatibleRenderPassDescriptor() override;
- bool buildOrResize() override;
-
- void releaseBuffers();
- bool newColorBuffer(const QSize &size, DXGI_FORMAT format, DXGI_SAMPLE_DESC sampleDesc,
- ID3D11Texture2D **tex, ID3D11RenderTargetView **rtv) const;
-
- QWindow *window = nullptr;
- QSize pixelSize;
- QD3D11ReferenceRenderTarget rt;
- QD3D11CommandBuffer cb;
- DXGI_FORMAT colorFormat;
- IDXGISwapChain *swapChain = nullptr;
- static const int BUFFER_COUNT = 2;
- ID3D11Texture2D *backBufferTex;
- ID3D11RenderTargetView *backBufferRtv;
- ID3D11Texture2D *msaaTex[BUFFER_COUNT];
- ID3D11RenderTargetView *msaaRtv[BUFFER_COUNT];
- DXGI_SAMPLE_DESC sampleDesc;
- int currentFrameSlot = 0;
- int frameCount = 0;
- QD3D11RenderBuffer *ds = nullptr;
- bool timestampActive[BUFFER_COUNT];
- ID3D11Query *timestampDisjointQuery[BUFFER_COUNT];
- ID3D11Query *timestampQuery[BUFFER_COUNT * 2];
- UINT swapInterval = 1;
-};
-
-class QRhiD3D11 : public QRhiImplementation
-{
-public:
- QRhiD3D11(QRhiD3D11InitParams *params, QRhiD3D11NativeHandles *importDevice = nullptr);
-
- bool create(QRhi::Flags flags) override;
- void destroy() override;
-
- QRhiGraphicsPipeline *createGraphicsPipeline() override;
- QRhiComputePipeline *createComputePipeline() override;
- QRhiShaderResourceBindings *createShaderResourceBindings() override;
- QRhiBuffer *createBuffer(QRhiBuffer::Type type,
- QRhiBuffer::UsageFlags usage,
- int size) override;
- QRhiRenderBuffer *createRenderBuffer(QRhiRenderBuffer::Type type,
- const QSize &pixelSize,
- int sampleCount,
- QRhiRenderBuffer::Flags flags) override;
- QRhiTexture *createTexture(QRhiTexture::Format format,
- const QSize &pixelSize,
- int sampleCount,
- QRhiTexture::Flags flags) override;
- QRhiSampler *createSampler(QRhiSampler::Filter magFilter, QRhiSampler::Filter minFilter,
- QRhiSampler::Filter mipmapMode,
- QRhiSampler:: AddressMode u, QRhiSampler::AddressMode v) override;
-
- QRhiTextureRenderTarget *createTextureRenderTarget(const QRhiTextureRenderTargetDescription &desc,
- QRhiTextureRenderTarget::Flags flags) override;
-
- QRhiSwapChain *createSwapChain() override;
- QRhi::FrameOpResult beginFrame(QRhiSwapChain *swapChain, QRhi::BeginFrameFlags flags) override;
- QRhi::FrameOpResult endFrame(QRhiSwapChain *swapChain, QRhi::EndFrameFlags flags) override;
- QRhi::FrameOpResult beginOffscreenFrame(QRhiCommandBuffer **cb, QRhi::BeginFrameFlags flags) override;
- QRhi::FrameOpResult endOffscreenFrame(QRhi::EndFrameFlags flags) override;
- QRhi::FrameOpResult finish() override;
-
- void resourceUpdate(QRhiCommandBuffer *cb, QRhiResourceUpdateBatch *resourceUpdates) override;
-
- void beginPass(QRhiCommandBuffer *cb,
- QRhiRenderTarget *rt,
- const QColor &colorClearValue,
- const QRhiDepthStencilClearValue &depthStencilClearValue,
- QRhiResourceUpdateBatch *resourceUpdates) override;
- void endPass(QRhiCommandBuffer *cb, QRhiResourceUpdateBatch *resourceUpdates) override;
-
- void setGraphicsPipeline(QRhiCommandBuffer *cb,
- QRhiGraphicsPipeline *ps) override;
-
- void setShaderResources(QRhiCommandBuffer *cb,
- QRhiShaderResourceBindings *srb,
- int dynamicOffsetCount,
- const QRhiCommandBuffer::DynamicOffset *dynamicOffsets) override;
-
- void setVertexInput(QRhiCommandBuffer *cb,
- int startBinding, int bindingCount, const QRhiCommandBuffer::VertexInput *bindings,
- QRhiBuffer *indexBuf, quint32 indexOffset,
- QRhiCommandBuffer::IndexFormat indexFormat) override;
-
- void setViewport(QRhiCommandBuffer *cb, const QRhiViewport &viewport) override;
- void setScissor(QRhiCommandBuffer *cb, const QRhiScissor &scissor) override;
- void setBlendConstants(QRhiCommandBuffer *cb, const QColor &c) override;
- void setStencilRef(QRhiCommandBuffer *cb, quint32 refValue) override;
-
- void draw(QRhiCommandBuffer *cb, quint32 vertexCount,
- quint32 instanceCount, quint32 firstVertex, quint32 firstInstance) override;
-
- void drawIndexed(QRhiCommandBuffer *cb, quint32 indexCount,
- quint32 instanceCount, quint32 firstIndex,
- qint32 vertexOffset, quint32 firstInstance) override;
-
- void debugMarkBegin(QRhiCommandBuffer *cb, const QByteArray &name) override;
- void debugMarkEnd(QRhiCommandBuffer *cb) override;
- void debugMarkMsg(QRhiCommandBuffer *cb, const QByteArray &msg) override;
-
- void beginComputePass(QRhiCommandBuffer *cb, QRhiResourceUpdateBatch *resourceUpdates) override;
- void endComputePass(QRhiCommandBuffer *cb, QRhiResourceUpdateBatch *resourceUpdates) override;
- void setComputePipeline(QRhiCommandBuffer *cb, QRhiComputePipeline *ps) override;
- void dispatch(QRhiCommandBuffer *cb, int x, int y, int z) override;
-
- const QRhiNativeHandles *nativeHandles(QRhiCommandBuffer *cb) override;
- void beginExternal(QRhiCommandBuffer *cb) override;
- void endExternal(QRhiCommandBuffer *cb) override;
-
- QVector<int> supportedSampleCounts() const override;
- int ubufAlignment() const override;
- bool isYUpInFramebuffer() const override;
- bool isYUpInNDC() const override;
- bool isClipDepthZeroToOne() const override;
- QMatrix4x4 clipSpaceCorrMatrix() const override;
- bool isTextureFormatSupported(QRhiTexture::Format format, QRhiTexture::Flags flags) const override;
- bool isFeatureSupported(QRhi::Feature feature) const override;
- int resourceLimit(QRhi::ResourceLimit limit) const override;
- const QRhiNativeHandles *nativeHandles() override;
- void sendVMemStatsToProfiler() override;
- bool makeThreadLocalNativeContextCurrent() override;
- void releaseCachedResources() override;
- bool isDeviceLost() const override;
-
- void enqueueSubresUpload(QD3D11Texture *texD, QD3D11CommandBuffer *cbD,
- int layer, int level, const QRhiTextureSubresourceUploadDescription &subresDesc);
- void enqueueResourceUpdates(QRhiCommandBuffer *cb, QRhiResourceUpdateBatch *resourceUpdates);
- void updateShaderResourceBindings(QD3D11ShaderResourceBindings *srbD);
- void executeBufferHostWritesForCurrentFrame(QD3D11Buffer *bufD);
- void bindShaderResources(QD3D11ShaderResourceBindings *srbD,
- const uint *dynOfsPairs, int dynOfsPairCount,
- bool offsetOnlyChange);
- void resetShaderResources();
- void executeCommandBuffer(QD3D11CommandBuffer *cbD, QD3D11SwapChain *timestampSwapChain = nullptr);
- DXGI_SAMPLE_DESC effectiveSampleCount(int sampleCount) const;
- void finishActiveReadbacks();
- void reportLiveObjects(ID3D11Device *device);
- void clearShaderCache();
-
- bool debugLayer = false;
- bool importedDevice = false;
- ID3D11Device *dev = nullptr;
- ID3D11DeviceContext1 *context = nullptr;
- D3D_FEATURE_LEVEL featureLevel;
- ID3DUserDefinedAnnotation *annotations = nullptr;
- IDXGIFactory1 *dxgiFactory = nullptr;
- bool hasDxgi2 = false;
- bool supportsFlipDiscardSwapchain = false;
- bool deviceLost = false;
- QRhiD3D11NativeHandles nativeHandlesStruct;
-
- struct {
- int vsHighestActiveVertexBufferBinding = -1;
- bool vsHasIndexBufferBound = false;
- int vsHighestActiveSrvBinding = -1;
- int fsHighestActiveSrvBinding = -1;
- int csHighestActiveSrvBinding = -1;
- int csHighestActiveUavBinding = -1;
- QD3D11SwapChain *currentSwapChain = nullptr;
- } contextState;
-
- struct OffscreenFrame {
- OffscreenFrame(QRhiImplementation *rhi) : cbWrapper(rhi) { }
- bool active = false;
- QD3D11CommandBuffer cbWrapper;
- } ofr;
-
- struct TextureReadback {
- QRhiReadbackDescription desc;
- QRhiReadbackResult *result;
- ID3D11Texture2D *stagingTex;
- quint32 byteSize;
- quint32 bpl;
- QSize pixelSize;
- QRhiTexture::Format format;
- };
- QVector<TextureReadback> activeTextureReadbacks;
- struct BufferReadback {
- QRhiBufferReadbackResult *result;
- quint32 byteSize;
- ID3D11Buffer *stagingBuf;
- };
- QVector<BufferReadback> activeBufferReadbacks;
-
- struct Shader {
- Shader() = default;
- Shader(IUnknown *s, const QByteArray &bytecode) : s(s), bytecode(bytecode) { }
- IUnknown *s;
- QByteArray bytecode;
- };
- QHash<QRhiShaderStage, Shader> m_shaderCache;
-
- struct DeviceCurse {
- DeviceCurse(QRhiD3D11 *impl) : q(impl) { }
- QRhiD3D11 *q;
- int framesToActivate = -1;
- bool permanent = false;
- int framesLeft = 0;
- ID3D11ComputeShader *cs = nullptr;
-
- void initResources();
- void releaseResources();
- void activate();
- } deviceCurse;
-};
-
-Q_DECLARE_TYPEINFO(QRhiD3D11::TextureReadback, Q_MOVABLE_TYPE);
-Q_DECLARE_TYPEINFO(QRhiD3D11::BufferReadback, Q_MOVABLE_TYPE);
-
-QT_END_NAMESPACE
-
-#endif
diff --git a/src/gui/rhi/qrhid3d12.cpp b/src/gui/rhi/qrhid3d12.cpp
new file mode 100644
index 0000000000..0f176c683d
--- /dev/null
+++ b/src/gui/rhi/qrhid3d12.cpp
@@ -0,0 +1,6569 @@
+// Copyright (C) 2023 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
+
+#include "qrhid3d12_p.h"
+#include <qmath.h>
+#include <QtCore/private/qsystemerror_p.h>
+#include <comdef.h>
+#include "qrhid3dhelpers_p.h"
+#include "cs_mipmap_p.h"
+
+#if __has_include(<pix.h>)
+#include <pix.h>
+#define QRHI_D3D12_HAS_OLD_PIX
+#endif
+
+#ifdef __ID3D12Device2_INTERFACE_DEFINED__
+
+QT_BEGIN_NAMESPACE
+
+/*
+ Direct 3D 12 backend.
+*/
+
+/*!
+ \class QRhiD3D12InitParams
+ \inmodule QtGui
+ \brief Direct3D 12 specific initialization parameters.
+
+ \note This is a RHI API with limited compatibility guarantees, see \l QRhi
+ for details.
+
+ A D3D12-based QRhi needs no special parameters for initialization. If
+ desired, enableDebugLayer can be set to \c true to enable the Direct3D
+ debug layer. This can be useful during development, but should be avoided
+ in production builds.
+
+ \badcode
+ QRhiD3D12InitParams params;
+ params.enableDebugLayer = true;
+ rhi = QRhi::create(QRhi::D3D12, &params);
+ \endcode
+
+ \note QRhiSwapChain should only be used in combination with QWindow
+ instances that have their surface type set to QSurface::Direct3DSurface.
+
+ \section2 Working with existing Direct3D 12 devices
+
+ When interoperating with another graphics engine, it may be necessary to
+ get a QRhi instance that uses the same Direct3D device. This can be
+ achieved by passing a pointer to a QRhiD3D12NativeHandles to
+ QRhi::create(). QRhi does not take ownership of any of the external
+ objects.
+
+ Sometimes, for example when using QRhi in combination with OpenXR, one will
+ want to specify which adapter to use, and optionally, which feature level
+ to request on the device, while leaving the device creation to QRhi. This
+ is achieved by leaving the device pointer set to null, while specifying the
+ adapter LUID and feature level.
+
+ Optionally the ID3D12CommandQueue can be specified as well, by setting \c
+ commandQueue to a non-null value.
+ */
+
+/*!
+ \variable QRhiD3D12InitParams::enableDebugLayer
+
+ When set to true, the debug layer is enabled, if installed and available.
+ The default value is false.
+*/
+
+/*!
+ \class QRhiD3D12NativeHandles
+ \inmodule QtGui
+ \brief Holds the D3D12 device used by the QRhi.
+
+ \note The class uses \c{void *} as the type since including the COM-based
+ \c{d3d12.h} headers is not acceptable here. The actual types are
+ \c{ID3D12Device *} and \c{ID3D12CommandQueue *}.
+
+ \note This is a RHI API with limited compatibility guarantees, see \l QRhi
+ for details.
+ */
+
+/*!
+ \variable QRhiD3D12NativeHandles::dev
+
+ Points to a
+ \l{https://learn.microsoft.com/en-us/windows/win32/api/d3d12/nn-d3d12-id3d12device}{ID3D12Device}
+ or left set to \nullptr if no existing device is to be imported.
+*/
+
+/*!
+ \variable QRhiD3D12NativeHandles::minimumFeatureLevel
+
+ Specifies the \b minimum feature level passed to
+ \l{https://learn.microsoft.com/en-us/windows/win32/api/d3d12/nf-d3d12-d3d12createdevice}{D3D12CreateDevice()}.
+ When not set, \c{D3D_FEATURE_LEVEL_11_0} is used. See
+ \l{https://learn.microsoft.com/en-us/windows/win32/direct3d12/hardware-feature-levels}{this
+ page} for details.
+
+ Relevant only when QRhi creates the device, ignored when importing a device
+ and device context.
+*/
+
+/*!
+ \variable QRhiD3D12NativeHandles::adapterLuidLow
+
+ The low part of the local identifier (LUID) of the DXGI adapter to use.
+ Relevant only when QRhi creates the device, ignored when importing a device
+ and device context.
+*/
+
+/*!
+ \variable QRhiD3D12NativeHandles::adapterLuidHigh
+
+ The high part of the local identifier (LUID) of the DXGI adapter to use.
+ Relevant only when QRhi creates the device, ignored when importing a device
+ and device context.
+*/
+
+/*!
+ \variable QRhiD3D12NativeHandles::commandQueue
+
+ When set, must point to a
+ \l{https://learn.microsoft.com/en-us/windows/win32/api/d3d12/nn-d3d12-id3d12commandqueue}{ID3D12CommandQueue}.
+ It allows to optionally import a command queue as well, in addition to a
+ device.
+*/
+
+/*!
+ \class QRhiD3D12CommandBufferNativeHandles
+ \inmodule QtGui
+ \brief Holds the ID3D12GraphicsCommandList1 object that is backing a QRhiCommandBuffer.
+
+ \note The command list object is only guaranteed to be valid, and
+ in recording state, while recording a frame. That is, between a
+ \l{QRhi::beginFrame()}{beginFrame()} - \l{QRhi::endFrame()}{endFrame()} or
+ \l{QRhi::beginOffscreenFrame()}{beginOffscreenFrame()} -
+ \l{QRhi::endOffscreenFrame()}{endOffscreenFrame()} pair.
+
+ \note This is a RHI API with limited compatibility guarantees, see \l QRhi
+ for details.
+ */
+
+/*!
+ \variable QRhiD3D12CommandBufferNativeHandles::commandList
+*/
+
+// https://learn.microsoft.com/en-us/windows/win32/direct3d12/hardware-feature-levels
+static const D3D_FEATURE_LEVEL MIN_FEATURE_LEVEL = D3D_FEATURE_LEVEL_11_0;
+
+QRhiD3D12::QRhiD3D12(QRhiD3D12InitParams *params, QRhiD3D12NativeHandles *importParams)
+{
+ debugLayer = params->enableDebugLayer;
+ if (importParams) {
+ if (importParams->dev) {
+ ID3D12Device *d3d12Device = reinterpret_cast<ID3D12Device *>(importParams->dev);
+ if (SUCCEEDED(d3d12Device->QueryInterface(__uuidof(ID3D12Device2), reinterpret_cast<void **>(&dev)))) {
+ // get rid of the ref added by QueryInterface
+ d3d12Device->Release();
+ importedDevice = true;
+ } else {
+ qWarning("ID3D12Device2 not supported, cannot import device");
+ }
+ }
+ if (importParams->commandQueue) {
+ cmdQueue = reinterpret_cast<ID3D12CommandQueue *>(importParams->commandQueue);
+ importedCommandQueue = true;
+ }
+ minimumFeatureLevel = D3D_FEATURE_LEVEL(importParams->minimumFeatureLevel);
+ adapterLuid.LowPart = importParams->adapterLuidLow;
+ adapterLuid.HighPart = importParams->adapterLuidHigh;
+ }
+}
+
+template <class Int>
+inline Int aligned(Int v, Int byteAlign)
+{
+ return (v + byteAlign - 1) & ~(byteAlign - 1);
+}
+
+static inline UINT calcSubresource(UINT mipSlice, UINT arraySlice, UINT mipLevels)
+{
+ return mipSlice + arraySlice * mipLevels;
+}
+
+static inline QD3D12RenderTargetData *rtData(QRhiRenderTarget *rt)
+{
+ switch (rt->resourceType()) {
+ case QRhiResource::SwapChainRenderTarget:
+ return &QRHI_RES(QD3D12SwapChainRenderTarget, rt)->d;
+ case QRhiResource::TextureRenderTarget:
+ return &QRHI_RES(QD3D12TextureRenderTarget, rt)->d;
+ break;
+ default:
+ break;
+ }
+ Q_UNREACHABLE_RETURN(nullptr);
+}
+
+bool QRhiD3D12::create(QRhi::Flags flags)
+{
+ rhiFlags = flags;
+
+ UINT factoryFlags = 0;
+ if (debugLayer)
+ factoryFlags |= DXGI_CREATE_FACTORY_DEBUG;
+ HRESULT hr = CreateDXGIFactory2(factoryFlags, __uuidof(IDXGIFactory2), reinterpret_cast<void **>(&dxgiFactory));
+ if (FAILED(hr)) {
+ // retry without debug, if it was requested (to match D3D11 backend behavior)
+ if (debugLayer) {
+ qCDebug(QRHI_LOG_INFO, "Debug layer was requested but is not available. "
+ "Attempting to create DXGIFactory2 without it.");
+ factoryFlags &= ~DXGI_CREATE_FACTORY_DEBUG;
+ hr = CreateDXGIFactory2(factoryFlags, __uuidof(IDXGIFactory2), reinterpret_cast<void **>(&dxgiFactory));
+ }
+ if (SUCCEEDED(hr)) {
+ debugLayer = false;
+ } else {
+ qWarning("CreateDXGIFactory2() failed to create DXGI factory: %s",
+ qPrintable(QSystemError::windowsComString(hr)));
+ return false;
+ }
+ }
+
+ supportsAllowTearing = false;
+ IDXGIFactory5 *factory5 = nullptr;
+ if (SUCCEEDED(dxgiFactory->QueryInterface(__uuidof(IDXGIFactory5), reinterpret_cast<void **>(&factory5)))) {
+ BOOL allowTearing = false;
+ if (SUCCEEDED(factory5->CheckFeatureSupport(DXGI_FEATURE_PRESENT_ALLOW_TEARING, &allowTearing, sizeof(allowTearing))))
+ supportsAllowTearing = allowTearing;
+ factory5->Release();
+ }
+
+ if (debugLayer) {
+ ID3D12Debug1 *debug = nullptr;
+ if (SUCCEEDED(D3D12GetDebugInterface(__uuidof(ID3D12Debug1), reinterpret_cast<void **>(&debug)))) {
+ qCDebug(QRHI_LOG_INFO, "Enabling D3D12 debug layer");
+ debug->EnableDebugLayer();
+ debug->Release();
+ }
+ }
+
+ if (!importedDevice) {
+ IDXGIAdapter1 *adapter;
+ int requestedAdapterIndex = -1;
+ if (qEnvironmentVariableIsSet("QT_D3D_ADAPTER_INDEX"))
+ requestedAdapterIndex = qEnvironmentVariableIntValue("QT_D3D_ADAPTER_INDEX");
+
+ // The importParams may specify an adapter by the luid, take that into account.
+ if (requestedAdapterIndex < 0 && (adapterLuid.LowPart || adapterLuid.HighPart)) {
+ for (int adapterIndex = 0; dxgiFactory->EnumAdapters1(UINT(adapterIndex), &adapter) != DXGI_ERROR_NOT_FOUND; ++adapterIndex) {
+ DXGI_ADAPTER_DESC1 desc;
+ adapter->GetDesc1(&desc);
+ adapter->Release();
+ if (desc.AdapterLuid.LowPart == adapterLuid.LowPart
+ && desc.AdapterLuid.HighPart == adapterLuid.HighPart)
+ {
+ requestedAdapterIndex = adapterIndex;
+ break;
+ }
+ }
+ }
+
+ if (requestedAdapterIndex < 0 && flags.testFlag(QRhi::PreferSoftwareRenderer)) {
+ for (int adapterIndex = 0; dxgiFactory->EnumAdapters1(UINT(adapterIndex), &adapter) != DXGI_ERROR_NOT_FOUND; ++adapterIndex) {
+ DXGI_ADAPTER_DESC1 desc;
+ adapter->GetDesc1(&desc);
+ adapter->Release();
+ if (desc.Flags & DXGI_ADAPTER_FLAG_SOFTWARE) {
+ requestedAdapterIndex = adapterIndex;
+ break;
+ }
+ }
+ }
+
+ activeAdapter = nullptr;
+ for (int adapterIndex = 0; dxgiFactory->EnumAdapters1(UINT(adapterIndex), &adapter) != DXGI_ERROR_NOT_FOUND; ++adapterIndex) {
+ DXGI_ADAPTER_DESC1 desc;
+ adapter->GetDesc1(&desc);
+ const QString name = QString::fromUtf16(reinterpret_cast<char16_t *>(desc.Description));
+ qCDebug(QRHI_LOG_INFO, "Adapter %d: '%s' (vendor 0x%X device 0x%X flags 0x%X)",
+ adapterIndex,
+ qPrintable(name),
+ desc.VendorId,
+ desc.DeviceId,
+ desc.Flags);
+ if (!activeAdapter && (requestedAdapterIndex < 0 || requestedAdapterIndex == adapterIndex)) {
+ activeAdapter = adapter;
+ adapterLuid = desc.AdapterLuid;
+ QRhiD3D::fillDriverInfo(&driverInfoStruct, desc);
+ qCDebug(QRHI_LOG_INFO, " using this adapter");
+ } else {
+ adapter->Release();
+ }
+ }
+ if (!activeAdapter) {
+ qWarning("No adapter");
+ return false;
+ }
+
+ if (minimumFeatureLevel == 0)
+ minimumFeatureLevel = MIN_FEATURE_LEVEL;
+
+ hr = D3D12CreateDevice(activeAdapter,
+ minimumFeatureLevel,
+ __uuidof(ID3D12Device2),
+ reinterpret_cast<void **>(&dev));
+ if (FAILED(hr)) {
+ qWarning("Failed to create D3D12 device: %s", qPrintable(QSystemError::windowsComString(hr)));
+ return false;
+ }
+ } else {
+ Q_ASSERT(dev);
+ // cannot just get a IDXGIDevice from the ID3D12Device anymore, look up the adapter instead
+ adapterLuid = dev->GetAdapterLuid();
+ IDXGIAdapter1 *adapter;
+ for (int adapterIndex = 0; dxgiFactory->EnumAdapters1(UINT(adapterIndex), &adapter) != DXGI_ERROR_NOT_FOUND; ++adapterIndex) {
+ DXGI_ADAPTER_DESC1 desc;
+ adapter->GetDesc1(&desc);
+ if (desc.AdapterLuid.LowPart == adapterLuid.LowPart
+ && desc.AdapterLuid.HighPart == adapterLuid.HighPart)
+ {
+ activeAdapter = adapter;
+ QRhiD3D::fillDriverInfo(&driverInfoStruct, desc);
+ break;
+ } else {
+ adapter->Release();
+ }
+ }
+ if (!activeAdapter) {
+ qWarning("No adapter");
+ return false;
+ }
+ qCDebug(QRHI_LOG_INFO, "Using imported device %p", dev);
+ }
+
+ if (debugLayer) {
+ ID3D12InfoQueue *infoQueue;
+ if (SUCCEEDED(dev->QueryInterface(__uuidof(ID3D12InfoQueue), reinterpret_cast<void **>(&infoQueue)))) {
+ if (qEnvironmentVariableIntValue("QT_D3D_DEBUG_BREAK")) {
+ infoQueue->SetBreakOnSeverity(D3D12_MESSAGE_SEVERITY_CORRUPTION, true);
+ infoQueue->SetBreakOnSeverity(D3D12_MESSAGE_SEVERITY_ERROR, true);
+ infoQueue->SetBreakOnSeverity(D3D12_MESSAGE_SEVERITY_WARNING, true);
+ }
+ D3D12_INFO_QUEUE_FILTER filter = {};
+ D3D12_MESSAGE_ID suppressedMessages[2] = {
+ // there is no way of knowing the clear color upfront
+ D3D12_MESSAGE_ID_CLEARRENDERTARGETVIEW_MISMATCHINGCLEARVALUE,
+ // we have no control over viewport and scissor rects
+ D3D12_MESSAGE_ID_DRAW_EMPTY_SCISSOR_RECTANGLE
+ };
+ filter.DenyList.NumIDs = 2;
+ filter.DenyList.pIDList = suppressedMessages;
+ // Setting the filter would enable Info messages (e.g. about
+ // resource creation) which we don't need.
+ D3D12_MESSAGE_SEVERITY infoSev = D3D12_MESSAGE_SEVERITY_INFO;
+ filter.DenyList.NumSeverities = 1;
+ filter.DenyList.pSeverityList = &infoSev;
+ infoQueue->PushStorageFilter(&filter);
+ infoQueue->Release();
+ }
+ }
+
+ if (!importedCommandQueue) {
+ D3D12_COMMAND_QUEUE_DESC queueDesc = {};
+ queueDesc.Type = D3D12_COMMAND_LIST_TYPE_DIRECT;
+ queueDesc.Priority = D3D12_COMMAND_QUEUE_PRIORITY_NORMAL;
+ hr = dev->CreateCommandQueue(&queueDesc, __uuidof(ID3D12CommandQueue), reinterpret_cast<void **>(&cmdQueue));
+ if (FAILED(hr)) {
+ qWarning("Failed to create command queue: %s", qPrintable(QSystemError::windowsComString(hr)));
+ return false;
+ }
+ }
+
+ hr = dev->CreateFence(0, D3D12_FENCE_FLAG_NONE, __uuidof(ID3D12Fence), reinterpret_cast<void **>(&fullFence));
+ if (FAILED(hr)) {
+ qWarning("Failed to create fence: %s", qPrintable(QSystemError::windowsComString(hr)));
+ return false;
+ }
+ fullFenceEvent = CreateEvent(nullptr, FALSE, FALSE, nullptr);
+ fullFenceCounter = 0;
+
+ for (int i = 0; i < QD3D12_FRAMES_IN_FLIGHT; ++i) {
+ hr = dev->CreateCommandAllocator(D3D12_COMMAND_LIST_TYPE_DIRECT,
+ __uuidof(ID3D12CommandAllocator),
+ reinterpret_cast<void **>(&cmdAllocators[i]));
+ if (FAILED(hr)) {
+ qWarning("Failed to create command allocator: %s", qPrintable(QSystemError::windowsComString(hr)));
+ return false;
+ }
+ }
+
+ if (!vma.create(dev, activeAdapter)) {
+ qWarning("Failed to initialize graphics memory suballocator");
+ return false;
+ }
+
+ if (!rtvPool.create(dev, D3D12_DESCRIPTOR_HEAP_TYPE_RTV, "main RTV pool")) {
+ qWarning("Could not create RTV pool");
+ return false;
+ }
+
+ if (!dsvPool.create(dev, D3D12_DESCRIPTOR_HEAP_TYPE_DSV, "main DSV pool")) {
+ qWarning("Could not create DSV pool");
+ return false;
+ }
+
+ if (!cbvSrvUavPool.create(dev, D3D12_DESCRIPTOR_HEAP_TYPE_CBV_SRV_UAV, "main CBV-SRV-UAV pool")) {
+ qWarning("Could not create CBV-SRV-UAV pool");
+ return false;
+ }
+
+ resourcePool.create("main resource pool");
+ pipelinePool.create("main pipeline pool");
+ rootSignaturePool.create("main root signature pool");
+ releaseQueue.create(&resourcePool, &pipelinePool, &rootSignaturePool);
+ barrierGen.create(&resourcePool);
+
+ if (!samplerMgr.create(dev)) {
+ qWarning("Could not create sampler pool and shader-visible sampler heap");
+ return false;
+ }
+
+ if (!mipmapGen.create(this)) {
+ qWarning("Could not initialize mipmap generator");
+ return false;
+ }
+
+ const qint32 smallStagingSize = aligned(SMALL_STAGING_AREA_BYTES_PER_FRAME, QD3D12StagingArea::ALIGNMENT);
+ for (int i = 0; i < QD3D12_FRAMES_IN_FLIGHT; ++i) {
+ if (!smallStagingAreas[i].create(this, smallStagingSize, D3D12_HEAP_TYPE_UPLOAD)) {
+ qWarning("Could not create host-visible staging area");
+ return false;
+ }
+ QString decoratedName = QLatin1String("Small staging area buffer/");
+ decoratedName += QString::number(i);
+ smallStagingAreas[i].mem.buffer->SetName(reinterpret_cast<LPCWSTR>(decoratedName.utf16()));
+ }
+
+ if (!shaderVisibleCbvSrvUavHeap.create(dev,
+ D3D12_DESCRIPTOR_HEAP_TYPE_CBV_SRV_UAV,
+ SHADER_VISIBLE_CBV_SRV_UAV_HEAP_PER_FRAME_START_SIZE))
+ {
+ qWarning("Could not create first shader-visible CBV/SRV/UAV heap");
+ return false;
+ }
+
+ if (flags.testFlag(QRhi::EnableTimestamps)) {
+ static bool wantsStablePowerState = qEnvironmentVariableIntValue("QT_D3D_STABLE_POWER_STATE");
+ //
+ // https://learn.microsoft.com/en-us/windows/win32/api/d3d12/nf-d3d12-id3d12device-setstablepowerstate
+ //
+ // NB! This is a _global_ setting, affecting other processes (and 3D
+ // APIs such as Vulkan), as long as this application is running. Hence
+ // making it an env.var. for now. Never enable it in production. But
+ // extremely useful for the GPU timings with NVIDIA at least; the
+ // timestamps become stable and smooth, making the number readable and
+ // actually useful e.g. in Quick 3D's DebugView when this is enabled.
+ // (otherwise the number's all over the place)
+ //
+ // See also
+ // https://developer.nvidia.com/blog/advanced-api-performance-setstablepowerstate/
+ // for possible other approaches.
+ //
+ if (wantsStablePowerState)
+ dev->SetStablePowerState(TRUE);
+
+ hr = cmdQueue->GetTimestampFrequency(&timestampTicksPerSecond);
+ if (FAILED(hr)) {
+ qWarning("Failed to query timestamp frequency: %s",
+ qPrintable(QSystemError::windowsComString(hr)));
+ return false;
+ }
+ if (!timestampQueryHeap.create(dev, QD3D12_FRAMES_IN_FLIGHT * 2, D3D12_QUERY_HEAP_TYPE_TIMESTAMP)) {
+ qWarning("Failed to create timestamp query pool");
+ return false;
+ }
+ const quint32 readbackBufSize = QD3D12_FRAMES_IN_FLIGHT * 2 * sizeof(quint64);
+ if (!timestampReadbackArea.create(this, readbackBufSize, D3D12_HEAP_TYPE_READBACK)) {
+ qWarning("Failed to create timestamp readback buffer");
+ return false;
+ }
+ timestampReadbackArea.mem.buffer->SetName(L"Timestamp readback buffer");
+ memset(timestampReadbackArea.mem.p, 0, readbackBufSize);
+ }
+
+ caps = {};
+ D3D12_FEATURE_DATA_D3D12_OPTIONS3 options3 = {};
+ if (SUCCEEDED(dev->CheckFeatureSupport(D3D12_FEATURE_D3D12_OPTIONS3, &options3, sizeof(options3)))) {
+ caps.multiView = options3.ViewInstancingTier != D3D12_VIEW_INSTANCING_TIER_NOT_SUPPORTED;
+ // https://microsoft.github.io/DirectX-Specs/d3d/RelaxedCasting.html
+ caps.textureViewFormat = options3.CastingFullyTypedFormatSupported;
+ }
+
+ deviceLost = false;
+ offscreenActive = false;
+
+ nativeHandlesStruct.dev = dev;
+ nativeHandlesStruct.minimumFeatureLevel = minimumFeatureLevel;
+ nativeHandlesStruct.adapterLuidLow = adapterLuid.LowPart;
+ nativeHandlesStruct.adapterLuidHigh = adapterLuid.HighPart;
+ nativeHandlesStruct.commandQueue = cmdQueue;
+
+ return true;
+}
+
+void QRhiD3D12::destroy()
+{
+ if (!deviceLost && fullFence && fullFenceEvent)
+ waitGpu();
+
+ releaseQueue.releaseAll();
+
+ for (int i = 0; i < QD3D12_FRAMES_IN_FLIGHT; ++i) {
+ if (offscreenCb[i]) {
+ if (offscreenCb[i]->cmdList)
+ offscreenCb[i]->cmdList->Release();
+ delete offscreenCb[i];
+ offscreenCb[i] = nullptr;
+ }
+ }
+
+ timestampQueryHeap.destroy();
+ timestampReadbackArea.destroy();
+
+ shaderVisibleCbvSrvUavHeap.destroy();
+
+ for (int i = 0; i < QD3D12_FRAMES_IN_FLIGHT; ++i)
+ smallStagingAreas[i].destroy();
+
+ mipmapGen.destroy();
+ samplerMgr.destroy();
+ resourcePool.destroy();
+ pipelinePool.destroy();
+ rootSignaturePool.destroy();
+ rtvPool.destroy();
+ dsvPool.destroy();
+ cbvSrvUavPool.destroy();
+
+ for (int i = 0; i < QD3D12_FRAMES_IN_FLIGHT; ++i) {
+ if (cmdAllocators[i]) {
+ cmdAllocators[i]->Release();
+ cmdAllocators[i] = nullptr;
+ }
+ }
+
+ if (fullFenceEvent) {
+ CloseHandle(fullFenceEvent);
+ fullFenceEvent = nullptr;
+ }
+
+ if (fullFence) {
+ fullFence->Release();
+ fullFence = nullptr;
+ }
+
+ if (!importedCommandQueue) {
+ if (cmdQueue) {
+ cmdQueue->Release();
+ cmdQueue = nullptr;
+ }
+ }
+
+ vma.destroy();
+
+ if (!importedDevice) {
+ if (dev) {
+ dev->Release();
+ dev = nullptr;
+ }
+ }
+
+ if (dcompDevice) {
+ dcompDevice->Release();
+ dcompDevice = nullptr;
+ }
+
+ if (activeAdapter) {
+ activeAdapter->Release();
+ activeAdapter = nullptr;
+ }
+
+ if (dxgiFactory) {
+ dxgiFactory->Release();
+ dxgiFactory = nullptr;
+ }
+}
+
+QList<int> QRhiD3D12::supportedSampleCounts() const
+{
+ return { 1, 2, 4, 8 };
+}
+
+QRhiSwapChain *QRhiD3D12::createSwapChain()
+{
+ return new QD3D12SwapChain(this);
+}
+
+QRhiBuffer *QRhiD3D12::createBuffer(QRhiBuffer::Type type, QRhiBuffer::UsageFlags usage, quint32 size)
+{
+ return new QD3D12Buffer(this, type, usage, size);
+}
+
+int QRhiD3D12::ubufAlignment() const
+{
+ return D3D12_CONSTANT_BUFFER_DATA_PLACEMENT_ALIGNMENT; // 256
+}
+
+bool QRhiD3D12::isYUpInFramebuffer() const
+{
+ return false;
+}
+
+bool QRhiD3D12::isYUpInNDC() const
+{
+ return true;
+}
+
+bool QRhiD3D12::isClipDepthZeroToOne() const
+{
+ return true;
+}
+
+QMatrix4x4 QRhiD3D12::clipSpaceCorrMatrix() const
+{
+ // Like with Vulkan, but Y is already good.
+
+ static QMatrix4x4 m;
+ if (m.isIdentity()) {
+ // NB the ctor takes row-major
+ m = QMatrix4x4(1.0f, 0.0f, 0.0f, 0.0f,
+ 0.0f, 1.0f, 0.0f, 0.0f,
+ 0.0f, 0.0f, 0.5f, 0.5f,
+ 0.0f, 0.0f, 0.0f, 1.0f);
+ }
+ return m;
+}
+
+bool QRhiD3D12::isTextureFormatSupported(QRhiTexture::Format format, QRhiTexture::Flags flags) const
+{
+ Q_UNUSED(flags);
+
+ if (format >= QRhiTexture::ETC2_RGB8 && format <= QRhiTexture::ASTC_12x12)
+ return false;
+
+ return true;
+}
+
+bool QRhiD3D12::isFeatureSupported(QRhi::Feature feature) const
+{
+ switch (feature) {
+ case QRhi::MultisampleTexture:
+ return true;
+ case QRhi::MultisampleRenderBuffer:
+ return true;
+ case QRhi::DebugMarkers:
+#ifdef QRHI_D3D12_HAS_OLD_PIX
+ return true;
+#else
+ return false;
+#endif
+ case QRhi::Timestamps:
+ return true;
+ case QRhi::Instancing:
+ return true;
+ case QRhi::CustomInstanceStepRate:
+ return true;
+ case QRhi::PrimitiveRestart:
+ return true;
+ case QRhi::NonDynamicUniformBuffers:
+ return false;
+ case QRhi::NonFourAlignedEffectiveIndexBufferOffset:
+ return true;
+ case QRhi::NPOTTextureRepeat:
+ return true;
+ case QRhi::RedOrAlpha8IsRed:
+ return true;
+ case QRhi::ElementIndexUint:
+ return true;
+ case QRhi::Compute:
+ return true;
+ case QRhi::WideLines:
+ return false;
+ case QRhi::VertexShaderPointSize:
+ return false;
+ case QRhi::BaseVertex:
+ return true;
+ case QRhi::BaseInstance:
+ return true;
+ case QRhi::TriangleFanTopology:
+ return false;
+ case QRhi::ReadBackNonUniformBuffer:
+ return true;
+ case QRhi::ReadBackNonBaseMipLevel:
+ return true;
+ case QRhi::TexelFetch:
+ return true;
+ case QRhi::RenderToNonBaseMipLevel:
+ return true;
+ case QRhi::IntAttributes:
+ return true;
+ case QRhi::ScreenSpaceDerivatives:
+ return true;
+ case QRhi::ReadBackAnyTextureFormat:
+ return true;
+ case QRhi::PipelineCacheDataLoadSave:
+ return false; // ###
+ case QRhi::ImageDataStride:
+ return true;
+ case QRhi::RenderBufferImport:
+ return false;
+ case QRhi::ThreeDimensionalTextures:
+ return true;
+ case QRhi::RenderTo3DTextureSlice:
+ return true;
+ case QRhi::TextureArrays:
+ return true;
+ case QRhi::Tessellation:
+ return true;
+ case QRhi::GeometryShader:
+ return true;
+ case QRhi::TextureArrayRange:
+ return true;
+ case QRhi::NonFillPolygonMode:
+ return true;
+ case QRhi::OneDimensionalTextures:
+ return true;
+ case QRhi::OneDimensionalTextureMipmaps:
+ return false; // we generate mipmaps ourselves with compute and this is not implemented
+ case QRhi::HalfAttributes:
+ return true;
+ case QRhi::RenderToOneDimensionalTexture:
+ return true;
+ case QRhi::ThreeDimensionalTextureMipmaps:
+ return false; // we generate mipmaps ourselves with compute and this is not implemented
+ case QRhi::MultiView:
+ return caps.multiView;
+ case QRhi::TextureViewFormat:
+ return caps.textureViewFormat;
+ case QRhi::ResolveDepthStencil:
+ // there is no Multisample Resolve support for depth/stencil formats
+ // https://learn.microsoft.com/en-us/windows/win32/direct3ddxgi/hardware-support-for-direct3d-12-1-formats
+ return false;
+ }
+ return false;
+}
+
+int QRhiD3D12::resourceLimit(QRhi::ResourceLimit limit) const
+{
+ switch (limit) {
+ case QRhi::TextureSizeMin:
+ return 1;
+ case QRhi::TextureSizeMax:
+ return 16384;
+ case QRhi::MaxColorAttachments:
+ return 8;
+ case QRhi::FramesInFlight:
+ return QD3D12_FRAMES_IN_FLIGHT;
+ case QRhi::MaxAsyncReadbackFrames:
+ return QD3D12_FRAMES_IN_FLIGHT;
+ case QRhi::MaxThreadGroupsPerDimension:
+ return 65535;
+ case QRhi::MaxThreadsPerThreadGroup:
+ return 1024;
+ case QRhi::MaxThreadGroupX:
+ return 1024;
+ case QRhi::MaxThreadGroupY:
+ return 1024;
+ case QRhi::MaxThreadGroupZ:
+ return 1024;
+ case QRhi::TextureArraySizeMax:
+ return 2048;
+ case QRhi::MaxUniformBufferRange:
+ return 65536;
+ case QRhi::MaxVertexInputs:
+ return 32;
+ case QRhi::MaxVertexOutputs:
+ return 32;
+ }
+ return 0;
+}
+
+const QRhiNativeHandles *QRhiD3D12::nativeHandles()
+{
+ return &nativeHandlesStruct;
+}
+
+QRhiDriverInfo QRhiD3D12::driverInfo() const
+{
+ return driverInfoStruct;
+}
+
+QRhiStats QRhiD3D12::statistics()
+{
+ QRhiStats result;
+ result.totalPipelineCreationTime = totalPipelineCreationTime();
+
+ D3D12MA::Budget budgets[2]; // [gpu, system] with discreet GPU or [shared, nothing] with UMA
+ vma.getBudget(&budgets[0], &budgets[1]);
+ for (int i = 0; i < 2; ++i) {
+ const D3D12MA::Statistics &stats(budgets[i].Stats);
+ result.blockCount += stats.BlockCount;
+ result.allocCount += stats.AllocationCount;
+ result.usedBytes += stats.AllocationBytes;
+ result.unusedBytes += stats.BlockBytes - stats.AllocationBytes;
+ result.totalUsageBytes += budgets[i].UsageBytes;
+ }
+
+ return result;
+}
+
+bool QRhiD3D12::makeThreadLocalNativeContextCurrent()
+{
+ // not applicable
+ return false;
+}
+
+void QRhiD3D12::releaseCachedResources()
+{
+ shaderBytecodeCache.data.clear();
+}
+
+bool QRhiD3D12::isDeviceLost() const
+{
+ return deviceLost;
+}
+
+QByteArray QRhiD3D12::pipelineCacheData()
+{
+ return {};
+}
+
+void QRhiD3D12::setPipelineCacheData(const QByteArray &data)
+{
+ Q_UNUSED(data);
+}
+
+QRhiRenderBuffer *QRhiD3D12::createRenderBuffer(QRhiRenderBuffer::Type type, const QSize &pixelSize,
+ int sampleCount, QRhiRenderBuffer::Flags flags,
+ QRhiTexture::Format backingFormatHint)
+{
+ return new QD3D12RenderBuffer(this, type, pixelSize, sampleCount, flags, backingFormatHint);
+}
+
+QRhiTexture *QRhiD3D12::createTexture(QRhiTexture::Format format,
+ const QSize &pixelSize, int depth, int arraySize,
+ int sampleCount, QRhiTexture::Flags flags)
+{
+ return new QD3D12Texture(this, format, pixelSize, depth, arraySize, sampleCount, flags);
+}
+
+QRhiSampler *QRhiD3D12::createSampler(QRhiSampler::Filter magFilter, QRhiSampler::Filter minFilter,
+ QRhiSampler::Filter mipmapMode,
+ QRhiSampler::AddressMode u, QRhiSampler::AddressMode v, QRhiSampler::AddressMode w)
+{
+ return new QD3D12Sampler(this, magFilter, minFilter, mipmapMode, u, v, w);
+}
+
+QRhiTextureRenderTarget *QRhiD3D12::createTextureRenderTarget(const QRhiTextureRenderTargetDescription &desc,
+ QRhiTextureRenderTarget::Flags flags)
+{
+ return new QD3D12TextureRenderTarget(this, desc, flags);
+}
+
+QRhiGraphicsPipeline *QRhiD3D12::createGraphicsPipeline()
+{
+ return new QD3D12GraphicsPipeline(this);
+}
+
+QRhiComputePipeline *QRhiD3D12::createComputePipeline()
+{
+ return new QD3D12ComputePipeline(this);
+}
+
+QRhiShaderResourceBindings *QRhiD3D12::createShaderResourceBindings()
+{
+ return new QD3D12ShaderResourceBindings(this);
+}
+
+void QRhiD3D12::setGraphicsPipeline(QRhiCommandBuffer *cb, QRhiGraphicsPipeline *ps)
+{
+ QD3D12CommandBuffer *cbD = QRHI_RES(QD3D12CommandBuffer, cb);
+ Q_ASSERT(cbD->recordingPass == QD3D12CommandBuffer::RenderPass);
+ QD3D12GraphicsPipeline *psD = QRHI_RES(QD3D12GraphicsPipeline, ps);
+ const bool pipelineChanged = cbD->currentGraphicsPipeline != psD || cbD->currentPipelineGeneration != psD->generation;
+
+ if (pipelineChanged) {
+ cbD->currentGraphicsPipeline = psD;
+ cbD->currentComputePipeline = nullptr;
+ cbD->currentPipelineGeneration = psD->generation;
+
+ if (QD3D12Pipeline *pipeline = pipelinePool.lookupRef(psD->handle)) {
+ Q_ASSERT(pipeline->type == QD3D12Pipeline::Graphics);
+ cbD->cmdList->SetPipelineState(pipeline->pso);
+ if (QD3D12RootSignature *rs = rootSignaturePool.lookupRef(psD->rootSigHandle))
+ cbD->cmdList->SetGraphicsRootSignature(rs->rootSig);
+ }
+
+ cbD->cmdList->IASetPrimitiveTopology(psD->topology);
+
+ if (psD->viewInstanceMask)
+ cbD->cmdList->SetViewInstanceMask(psD->viewInstanceMask);
+ }
+}
+
+void QD3D12CommandBuffer::visitUniformBuffer(QD3D12Stage s,
+ const QRhiShaderResourceBinding::Data::UniformBufferData &d,
+ int,
+ int binding,
+ int dynamicOffsetCount,
+ const QRhiCommandBuffer::DynamicOffset *dynamicOffsets)
+{
+ QD3D12Buffer *bufD = QRHI_RES(QD3D12Buffer, d.buf);
+ quint32 offset = d.offset;
+ if (d.hasDynamicOffset) {
+ for (int i = 0; i < dynamicOffsetCount; ++i) {
+ const QRhiCommandBuffer::DynamicOffset &dynOfs(dynamicOffsets[i]);
+ if (dynOfs.first == binding) {
+ Q_ASSERT(aligned(dynOfs.second, 256u) == dynOfs.second);
+ offset += dynOfs.second;
+ }
+ }
+ }
+ QRHI_RES_RHI(QRhiD3D12);
+ visitorData.cbufs[s].append({ bufD->handles[rhiD->currentFrameSlot], offset });
+}
+
+void QD3D12CommandBuffer::visitTexture(QD3D12Stage s,
+ const QRhiShaderResourceBinding::TextureAndSampler &d,
+ int)
+{
+ QD3D12Texture *texD = QRHI_RES(QD3D12Texture, d.tex);
+ visitorData.srvs[s].append(texD->srv);
+}
+
+void QD3D12CommandBuffer::visitSampler(QD3D12Stage s,
+ const QRhiShaderResourceBinding::TextureAndSampler &d,
+ int)
+{
+ QD3D12Sampler *samplerD = QRHI_RES(QD3D12Sampler, d.sampler);
+ visitorData.samplers[s].append(samplerD->lookupOrCreateShaderVisibleDescriptor());
+}
+
+void QD3D12CommandBuffer::visitStorageBuffer(QD3D12Stage s,
+ const QRhiShaderResourceBinding::Data::StorageBufferData &d,
+ QD3D12ShaderResourceVisitor::StorageOp,
+ int)
+{
+ QD3D12Buffer *bufD = QRHI_RES(QD3D12Buffer, d.buf);
+ // SPIRV-Cross generated HLSL uses RWByteAddressBuffer
+ D3D12_UNORDERED_ACCESS_VIEW_DESC uavDesc = {};
+ uavDesc.Format = DXGI_FORMAT_R32_TYPELESS;
+ uavDesc.ViewDimension = D3D12_UAV_DIMENSION_BUFFER;
+ uavDesc.Buffer.FirstElement = d.offset / 4;
+ uavDesc.Buffer.NumElements = aligned(bufD->m_size - d.offset, 4u) / 4;
+ uavDesc.Buffer.Flags = D3D12_BUFFER_UAV_FLAG_RAW;
+ visitorData.uavs[s].append({ bufD->handles[0], uavDesc });
+}
+
+void QD3D12CommandBuffer::visitStorageImage(QD3D12Stage s,
+ const QRhiShaderResourceBinding::Data::StorageImageData &d,
+ QD3D12ShaderResourceVisitor::StorageOp,
+ int)
+{
+ QD3D12Texture *texD = QRHI_RES(QD3D12Texture, d.tex);
+ const bool isCube = texD->m_flags.testFlag(QRhiTexture::CubeMap);
+ const bool isArray = texD->m_flags.testFlag(QRhiTexture::TextureArray);
+ const bool is3D = texD->m_flags.testFlag(QRhiTexture::ThreeDimensional);
+ D3D12_UNORDERED_ACCESS_VIEW_DESC uavDesc = {};
+ uavDesc.Format = texD->rtFormat;
+ if (isCube) {
+ uavDesc.ViewDimension = D3D12_UAV_DIMENSION_TEXTURE2DARRAY;
+ uavDesc.Texture2DArray.MipSlice = UINT(d.level);
+ uavDesc.Texture2DArray.FirstArraySlice = 0;
+ uavDesc.Texture2DArray.ArraySize = 6;
+ } else if (isArray) {
+ uavDesc.ViewDimension = D3D12_UAV_DIMENSION_TEXTURE2DARRAY;
+ uavDesc.Texture2DArray.MipSlice = UINT(d.level);
+ uavDesc.Texture2DArray.FirstArraySlice = 0;
+ uavDesc.Texture2DArray.ArraySize = UINT(qMax(0, texD->m_arraySize));
+ } else if (is3D) {
+ uavDesc.ViewDimension = D3D12_UAV_DIMENSION_TEXTURE3D;
+ uavDesc.Texture3D.MipSlice = UINT(d.level);
+ } else {
+ uavDesc.ViewDimension = D3D12_UAV_DIMENSION_TEXTURE2D;
+ uavDesc.Texture2D.MipSlice = UINT(d.level);
+ }
+ visitorData.uavs[s].append({ texD->handle, uavDesc });
+}
+
+void QRhiD3D12::setShaderResources(QRhiCommandBuffer *cb, QRhiShaderResourceBindings *srb,
+ int dynamicOffsetCount,
+ const QRhiCommandBuffer::DynamicOffset *dynamicOffsets)
+{
+ QD3D12CommandBuffer *cbD = QRHI_RES(QD3D12CommandBuffer, cb);
+ Q_ASSERT(cbD->recordingPass != QD3D12CommandBuffer::NoPass);
+ QD3D12GraphicsPipeline *gfxPsD = QRHI_RES(QD3D12GraphicsPipeline, cbD->currentGraphicsPipeline);
+ QD3D12ComputePipeline *compPsD = QRHI_RES(QD3D12ComputePipeline, cbD->currentComputePipeline);
+
+ if (!srb) {
+ if (gfxPsD)
+ srb = gfxPsD->m_shaderResourceBindings;
+ else
+ srb = compPsD->m_shaderResourceBindings;
+ }
+
+ QD3D12ShaderResourceBindings *srbD = QRHI_RES(QD3D12ShaderResourceBindings, srb);
+
+ for (int i = 0, ie = srbD->m_bindings.size(); i != ie; ++i) {
+ const QRhiShaderResourceBinding::Data *b = shaderResourceBindingData(srbD->m_bindings[i]);
+ switch (b->type) {
+ case QRhiShaderResourceBinding::UniformBuffer:
+ {
+ QD3D12Buffer *bufD = QRHI_RES(QD3D12Buffer, b->u.ubuf.buf);
+ Q_ASSERT(bufD->m_usage.testFlag(QRhiBuffer::UniformBuffer));
+ Q_ASSERT(bufD->m_type == QRhiBuffer::Dynamic);
+ bufD->executeHostWritesForFrameSlot(currentFrameSlot);
+ }
+ break;
+ case QRhiShaderResourceBinding::SampledTexture:
+ case QRhiShaderResourceBinding::Texture:
+ case QRhiShaderResourceBinding::Sampler:
+ {
+ const QRhiShaderResourceBinding::Data::TextureAndOrSamplerData *data = &b->u.stex;
+ for (int elem = 0; elem < data->count; ++elem) {
+ QD3D12Texture *texD = QRHI_RES(QD3D12Texture, data->texSamplers[elem].tex);
+ QD3D12Sampler *samplerD = QRHI_RES(QD3D12Sampler, data->texSamplers[elem].sampler);
+ // We use the same code path for both combined and separate
+ // images and samplers, so tex or sampler (but not both) can be
+ // null here.
+ Q_ASSERT(texD || samplerD);
+ if (texD) {
+ UINT state = 0;
+ if (b->stage == QRhiShaderResourceBinding::FragmentStage) {
+ state = D3D12_RESOURCE_STATE_PIXEL_SHADER_RESOURCE;
+ } else if (b->stage.testFlag(QRhiShaderResourceBinding::FragmentStage)) {
+ state = D3D12_RESOURCE_STATE_PIXEL_SHADER_RESOURCE | D3D12_RESOURCE_STATE_NON_PIXEL_SHADER_RESOURCE;
+ } else {
+ state = D3D12_RESOURCE_STATE_NON_PIXEL_SHADER_RESOURCE;
+ }
+ barrierGen.addTransitionBarrier(texD->handle, D3D12_RESOURCE_STATES(state));
+ barrierGen.enqueueBufferedTransitionBarriers(cbD);
+ }
+ }
+ }
+ break;
+ case QRhiShaderResourceBinding::ImageLoad:
+ case QRhiShaderResourceBinding::ImageStore:
+ case QRhiShaderResourceBinding::ImageLoadStore:
+ {
+ QD3D12Texture *texD = QRHI_RES(QD3D12Texture, b->u.simage.tex);
+ if (QD3D12Resource *res = resourcePool.lookupRef(texD->handle)) {
+ if (res->uavUsage) {
+ if (res->uavUsage & QD3D12Resource::UavUsageWrite) {
+ // RaW or WaW
+ barrierGen.enqueueUavBarrier(cbD, texD->handle);
+ } else {
+ if (b->type == QRhiShaderResourceBinding::ImageStore
+ || b->type == QRhiShaderResourceBinding::ImageLoadStore)
+ {
+ // WaR or WaW
+ barrierGen.enqueueUavBarrier(cbD, texD->handle);
+ }
+ }
+ }
+ res->uavUsage = 0;
+ if (b->type == QRhiShaderResourceBinding::ImageLoad || b->type == QRhiShaderResourceBinding::ImageLoadStore)
+ res->uavUsage |= QD3D12Resource::UavUsageRead;
+ if (b->type == QRhiShaderResourceBinding::ImageStore || b->type == QRhiShaderResourceBinding::ImageLoadStore)
+ res->uavUsage |= QD3D12Resource::UavUsageWrite;
+ barrierGen.addTransitionBarrier(texD->handle, D3D12_RESOURCE_STATE_UNORDERED_ACCESS);
+ barrierGen.enqueueBufferedTransitionBarriers(cbD);
+ }
+ }
+ break;
+ case QRhiShaderResourceBinding::BufferLoad:
+ case QRhiShaderResourceBinding::BufferStore:
+ case QRhiShaderResourceBinding::BufferLoadStore:
+ {
+ QD3D12Buffer *bufD = QRHI_RES(QD3D12Buffer, b->u.sbuf.buf);
+ Q_ASSERT(bufD->m_usage.testFlag(QRhiBuffer::StorageBuffer));
+ Q_ASSERT(bufD->m_type != QRhiBuffer::Dynamic);
+ if (QD3D12Resource *res = resourcePool.lookupRef(bufD->handles[0])) {
+ if (res->uavUsage) {
+ if (res->uavUsage & QD3D12Resource::UavUsageWrite) {
+ // RaW or WaW
+ barrierGen.enqueueUavBarrier(cbD, bufD->handles[0]);
+ } else {
+ if (b->type == QRhiShaderResourceBinding::BufferStore
+ || b->type == QRhiShaderResourceBinding::BufferLoadStore)
+ {
+ // WaR or WaW
+ barrierGen.enqueueUavBarrier(cbD, bufD->handles[0]);
+ }
+ }
+ }
+ res->uavUsage = 0;
+ if (b->type == QRhiShaderResourceBinding::BufferLoad || b->type == QRhiShaderResourceBinding::BufferLoadStore)
+ res->uavUsage |= QD3D12Resource::UavUsageRead;
+ if (b->type == QRhiShaderResourceBinding::BufferStore || b->type == QRhiShaderResourceBinding::BufferLoadStore)
+ res->uavUsage |= QD3D12Resource::UavUsageWrite;
+ barrierGen.addTransitionBarrier(bufD->handles[0], D3D12_RESOURCE_STATE_UNORDERED_ACCESS);
+ barrierGen.enqueueBufferedTransitionBarriers(cbD);
+ }
+ }
+ break;
+ }
+ }
+
+ const bool srbChanged = gfxPsD ? (cbD->currentGraphicsSrb != srb) : (cbD->currentComputeSrb != srb);
+ const bool srbRebuilt = cbD->currentSrbGeneration != srbD->generation;
+
+ if (srbChanged || srbRebuilt || srbD->hasDynamicOffset) {
+ const QD3D12ShaderStageData *stageData = gfxPsD ? gfxPsD->stageData.data() : &compPsD->stageData;
+
+ // The order of root parameters must match
+ // QD3D12ShaderResourceBindings::createRootSignature(), meaning the
+ // logic below must mirror that function (uniform buffers first etc.)
+
+ QD3D12ShaderResourceVisitor visitor(srbD, stageData, gfxPsD ? 5 : 1);
+
+ QD3D12CommandBuffer::VisitorData &visitorData(cbD->visitorData);
+ visitorData = {};
+
+ using namespace std::placeholders;
+ visitor.uniformBuffer = std::bind(&QD3D12CommandBuffer::visitUniformBuffer, cbD, _1, _2, _3, _4, dynamicOffsetCount, dynamicOffsets);
+ visitor.texture = std::bind(&QD3D12CommandBuffer::visitTexture, cbD, _1, _2, _3);
+ visitor.sampler = std::bind(&QD3D12CommandBuffer::visitSampler, cbD, _1, _2, _3);
+ visitor.storageBuffer = std::bind(&QD3D12CommandBuffer::visitStorageBuffer, cbD, _1, _2, _3, _4);
+ visitor.storageImage = std::bind(&QD3D12CommandBuffer::visitStorageImage, cbD, _1, _2, _3, _4);
+
+ visitor.visit();
+
+ quint32 cbvSrvUavCount = 0;
+ for (int s = 0; s < 6; ++s) {
+ // CBs use root constant buffer views, no need to count them here
+ cbvSrvUavCount += visitorData.srvs[s].count();
+ cbvSrvUavCount += visitorData.uavs[s].count();
+ }
+
+ bool gotNewHeap = false;
+ if (!ensureShaderVisibleDescriptorHeapCapacity(&shaderVisibleCbvSrvUavHeap,
+ D3D12_DESCRIPTOR_HEAP_TYPE_CBV_SRV_UAV,
+ currentFrameSlot,
+ cbvSrvUavCount,
+ &gotNewHeap))
+ {
+ return;
+ }
+ if (gotNewHeap) {
+ qCDebug(QRHI_LOG_INFO, "Created new shader-visible CBV/SRV/UAV descriptor heap,"
+ " per-frame slice size is now %u,"
+ " if this happens frequently then that's not great.",
+ shaderVisibleCbvSrvUavHeap.perFrameHeapSlice[0].capacity);
+ bindShaderVisibleHeaps(cbD);
+ }
+
+ int rootParamIndex = 0;
+ for (int s = 0; s < 6; ++s) {
+ if (!visitorData.cbufs[s].isEmpty()) {
+ for (int i = 0, count = visitorData.cbufs[s].count(); i < count; ++i) {
+ const auto &cbuf(visitorData.cbufs[s][i]);
+ if (QD3D12Resource *res = resourcePool.lookupRef(cbuf.first)) {
+ quint32 offset = cbuf.second;
+ D3D12_GPU_VIRTUAL_ADDRESS gpuAddr = res->resource->GetGPUVirtualAddress() + offset;
+ if (cbD->currentGraphicsPipeline)
+ cbD->cmdList->SetGraphicsRootConstantBufferView(rootParamIndex, gpuAddr);
+ else
+ cbD->cmdList->SetComputeRootConstantBufferView(rootParamIndex, gpuAddr);
+ }
+ rootParamIndex += 1;
+ }
+ }
+ }
+ for (int s = 0; s < 6; ++s) {
+ if (!visitorData.srvs[s].isEmpty()) {
+ QD3D12DescriptorHeap &gpuSrvHeap(shaderVisibleCbvSrvUavHeap.perFrameHeapSlice[currentFrameSlot]);
+ QD3D12Descriptor startDesc = gpuSrvHeap.get(visitorData.srvs[s].count());
+ for (int i = 0, count = visitorData.srvs[s].count(); i < count; ++i) {
+ const auto &srv(visitorData.srvs[s][i]);
+ dev->CopyDescriptorsSimple(1, gpuSrvHeap.incremented(startDesc, i).cpuHandle, srv.cpuHandle,
+ D3D12_DESCRIPTOR_HEAP_TYPE_CBV_SRV_UAV);
+ }
+
+ if (cbD->currentGraphicsPipeline)
+ cbD->cmdList->SetGraphicsRootDescriptorTable(rootParamIndex, startDesc.gpuHandle);
+ else if (cbD->currentComputePipeline)
+ cbD->cmdList->SetComputeRootDescriptorTable(rootParamIndex, startDesc.gpuHandle);
+
+ rootParamIndex += 1;
+ }
+ }
+ for (int s = 0; s < 6; ++s) {
+ // Samplers are one parameter / descriptor table each, and the
+ // descriptor is from the shader visible sampler heap already.
+ for (const QD3D12Descriptor &samplerDescriptor : visitorData.samplers[s]) {
+ if (cbD->currentGraphicsPipeline)
+ cbD->cmdList->SetGraphicsRootDescriptorTable(rootParamIndex, samplerDescriptor.gpuHandle);
+ else if (cbD->currentComputePipeline)
+ cbD->cmdList->SetComputeRootDescriptorTable(rootParamIndex, samplerDescriptor.gpuHandle);
+
+ rootParamIndex += 1;
+ }
+ }
+ for (int s = 0; s < 6; ++s) {
+ if (!visitorData.uavs[s].isEmpty()) {
+ QD3D12DescriptorHeap &gpuUavHeap(shaderVisibleCbvSrvUavHeap.perFrameHeapSlice[currentFrameSlot]);
+ QD3D12Descriptor startDesc = gpuUavHeap.get(visitorData.uavs[s].count());
+ for (int i = 0, count = visitorData.uavs[s].count(); i < count; ++i) {
+ const auto &uav(visitorData.uavs[s][i]);
+ if (QD3D12Resource *res = resourcePool.lookupRef(uav.first)) {
+ dev->CreateUnorderedAccessView(res->resource, nullptr, &uav.second,
+ gpuUavHeap.incremented(startDesc, i).cpuHandle);
+ } else {
+ dev->CreateUnorderedAccessView(nullptr, nullptr, nullptr,
+ gpuUavHeap.incremented(startDesc, i).cpuHandle);
+ }
+ }
+
+ if (cbD->currentGraphicsPipeline)
+ cbD->cmdList->SetGraphicsRootDescriptorTable(rootParamIndex, startDesc.gpuHandle);
+ else if (cbD->currentComputePipeline)
+ cbD->cmdList->SetComputeRootDescriptorTable(rootParamIndex, startDesc.gpuHandle);
+
+ rootParamIndex += 1;
+ }
+ }
+
+ if (gfxPsD) {
+ cbD->currentGraphicsSrb = srb;
+ cbD->currentComputeSrb = nullptr;
+ } else {
+ cbD->currentGraphicsSrb = nullptr;
+ cbD->currentComputeSrb = srb;
+ }
+ cbD->currentSrbGeneration = srbD->generation;
+ }
+}
+
+void QRhiD3D12::setVertexInput(QRhiCommandBuffer *cb,
+ int startBinding, int bindingCount, const QRhiCommandBuffer::VertexInput *bindings,
+ QRhiBuffer *indexBuf, quint32 indexOffset, QRhiCommandBuffer::IndexFormat indexFormat)
+{
+ QD3D12CommandBuffer *cbD = QRHI_RES(QD3D12CommandBuffer, cb);
+ Q_ASSERT(cbD->recordingPass == QD3D12CommandBuffer::RenderPass);
+
+ bool needsBindVBuf = false;
+ for (int i = 0; i < bindingCount; ++i) {
+ const int inputSlot = startBinding + i;
+ QD3D12Buffer *bufD = QRHI_RES(QD3D12Buffer, bindings[i].first);
+ Q_ASSERT(bufD->m_usage.testFlag(QRhiBuffer::VertexBuffer));
+ const bool isDynamic = bufD->m_type == QRhiBuffer::Dynamic;
+ if (isDynamic)
+ bufD->executeHostWritesForFrameSlot(currentFrameSlot);
+
+ if (cbD->currentVertexBuffers[inputSlot] != bufD->handles[isDynamic ? currentFrameSlot : 0]
+ || cbD->currentVertexOffsets[inputSlot] != bindings[i].second)
+ {
+ needsBindVBuf = true;
+ cbD->currentVertexBuffers[inputSlot] = bufD->handles[isDynamic ? currentFrameSlot : 0];
+ cbD->currentVertexOffsets[inputSlot] = bindings[i].second;
+ }
+ }
+
+ if (needsBindVBuf) {
+ QVarLengthArray<D3D12_VERTEX_BUFFER_VIEW, 4> vbv;
+ vbv.reserve(bindingCount);
+
+ QD3D12GraphicsPipeline *psD = cbD->currentGraphicsPipeline;
+ const QRhiVertexInputLayout &inputLayout(psD->m_vertexInputLayout);
+ const int inputBindingCount = inputLayout.cendBindings() - inputLayout.cbeginBindings();
+
+ for (int i = 0, ie = qMin(bindingCount, inputBindingCount); i != ie; ++i) {
+ QD3D12Buffer *bufD = QRHI_RES(QD3D12Buffer, bindings[i].first);
+ const QD3D12ObjectHandle handle = bufD->handles[bufD->m_type == QRhiBuffer::Dynamic ? currentFrameSlot : 0];
+ const quint32 offset = bindings[i].second;
+ const quint32 stride = inputLayout.bindingAt(i)->stride();
+
+ if (bufD->m_type != QRhiBuffer::Dynamic) {
+ barrierGen.addTransitionBarrier(handle, D3D12_RESOURCE_STATE_VERTEX_AND_CONSTANT_BUFFER);
+ barrierGen.enqueueBufferedTransitionBarriers(cbD);
+ }
+
+ if (QD3D12Resource *res = resourcePool.lookupRef(handle)) {
+ vbv.append({
+ res->resource->GetGPUVirtualAddress() + offset,
+ UINT(res->desc.Width - offset),
+ stride
+ });
+ }
+ }
+
+ cbD->cmdList->IASetVertexBuffers(UINT(startBinding), vbv.count(), vbv.constData());
+ }
+
+ if (indexBuf) {
+ QD3D12Buffer *ibufD = QRHI_RES(QD3D12Buffer, indexBuf);
+ Q_ASSERT(ibufD->m_usage.testFlag(QRhiBuffer::IndexBuffer));
+ const bool isDynamic = ibufD->m_type == QRhiBuffer::Dynamic;
+ if (isDynamic)
+ ibufD->executeHostWritesForFrameSlot(currentFrameSlot);
+
+ const DXGI_FORMAT dxgiFormat = indexFormat == QRhiCommandBuffer::IndexUInt16 ? DXGI_FORMAT_R16_UINT
+ : DXGI_FORMAT_R32_UINT;
+ if (cbD->currentIndexBuffer != ibufD->handles[isDynamic ? currentFrameSlot : 0]
+ || cbD->currentIndexOffset != indexOffset
+ || cbD->currentIndexFormat != dxgiFormat)
+ {
+ cbD->currentIndexBuffer = ibufD->handles[isDynamic ? currentFrameSlot : 0];
+ cbD->currentIndexOffset = indexOffset;
+ cbD->currentIndexFormat = dxgiFormat;
+
+ if (ibufD->m_type != QRhiBuffer::Dynamic) {
+ barrierGen.addTransitionBarrier(cbD->currentIndexBuffer, D3D12_RESOURCE_STATE_INDEX_BUFFER);
+ barrierGen.enqueueBufferedTransitionBarriers(cbD);
+ }
+
+ if (QD3D12Resource *res = resourcePool.lookupRef(cbD->currentIndexBuffer)) {
+ const D3D12_INDEX_BUFFER_VIEW ibv = {
+ res->resource->GetGPUVirtualAddress() + indexOffset,
+ UINT(res->desc.Width - indexOffset),
+ dxgiFormat
+ };
+ cbD->cmdList->IASetIndexBuffer(&ibv);
+ }
+ }
+ }
+}
+
+void QRhiD3D12::setViewport(QRhiCommandBuffer *cb, const QRhiViewport &viewport)
+{
+ QD3D12CommandBuffer *cbD = QRHI_RES(QD3D12CommandBuffer, cb);
+ Q_ASSERT(cbD->recordingPass == QD3D12CommandBuffer::RenderPass);
+ Q_ASSERT(cbD->currentTarget);
+ const QSize outputSize = cbD->currentTarget->pixelSize();
+
+ // D3D expects top-left, QRhiViewport is bottom-left
+ float x, y, w, h;
+ if (!qrhi_toTopLeftRenderTargetRect<UnBounded>(outputSize, viewport.viewport(), &x, &y, &w, &h))
+ return;
+
+ D3D12_VIEWPORT v;
+ v.TopLeftX = x;
+ v.TopLeftY = y;
+ v.Width = w;
+ v.Height = h;
+ v.MinDepth = viewport.minDepth();
+ v.MaxDepth = viewport.maxDepth();
+ cbD->cmdList->RSSetViewports(1, &v);
+
+ if (cbD->currentGraphicsPipeline
+ && !cbD->currentGraphicsPipeline->flags().testFlag(QRhiGraphicsPipeline::UsesScissor))
+ {
+ qrhi_toTopLeftRenderTargetRect<Bounded>(outputSize, viewport.viewport(), &x, &y, &w, &h);
+ D3D12_RECT r;
+ r.left = x;
+ r.top = y;
+ // right and bottom are exclusive
+ r.right = x + w;
+ r.bottom = y + h;
+ cbD->cmdList->RSSetScissorRects(1, &r);
+ }
+}
+
+void QRhiD3D12::setScissor(QRhiCommandBuffer *cb, const QRhiScissor &scissor)
+{
+ QD3D12CommandBuffer *cbD = QRHI_RES(QD3D12CommandBuffer, cb);
+ Q_ASSERT(cbD->recordingPass == QD3D12CommandBuffer::RenderPass);
+ Q_ASSERT(cbD->currentTarget);
+ const QSize outputSize = cbD->currentTarget->pixelSize();
+
+ // D3D expects top-left, QRhiScissor is bottom-left
+ int x, y, w, h;
+ if (!qrhi_toTopLeftRenderTargetRect<Bounded>(outputSize, scissor.scissor(), &x, &y, &w, &h))
+ return;
+
+ D3D12_RECT r;
+ r.left = x;
+ r.top = y;
+ // right and bottom are exclusive
+ r.right = x + w;
+ r.bottom = y + h;
+ cbD->cmdList->RSSetScissorRects(1, &r);
+}
+
+void QRhiD3D12::setBlendConstants(QRhiCommandBuffer *cb, const QColor &c)
+{
+ QD3D12CommandBuffer *cbD = QRHI_RES(QD3D12CommandBuffer, cb);
+ Q_ASSERT(cbD->recordingPass == QD3D12CommandBuffer::RenderPass);
+ float v[4] = { c.redF(), c.greenF(), c.blueF(), c.alphaF() };
+ cbD->cmdList->OMSetBlendFactor(v);
+}
+
+void QRhiD3D12::setStencilRef(QRhiCommandBuffer *cb, quint32 refValue)
+{
+ QD3D12CommandBuffer *cbD = QRHI_RES(QD3D12CommandBuffer, cb);
+ Q_ASSERT(cbD->recordingPass == QD3D12CommandBuffer::RenderPass);
+ cbD->cmdList->OMSetStencilRef(refValue);
+}
+
+void QRhiD3D12::draw(QRhiCommandBuffer *cb, quint32 vertexCount,
+ quint32 instanceCount, quint32 firstVertex, quint32 firstInstance)
+{
+ QD3D12CommandBuffer *cbD = QRHI_RES(QD3D12CommandBuffer, cb);
+ Q_ASSERT(cbD->recordingPass == QD3D12CommandBuffer::RenderPass);
+ cbD->cmdList->DrawInstanced(vertexCount, instanceCount, firstVertex, firstInstance);
+}
+
+void QRhiD3D12::drawIndexed(QRhiCommandBuffer *cb, quint32 indexCount,
+ quint32 instanceCount, quint32 firstIndex, qint32 vertexOffset, quint32 firstInstance)
+{
+ QD3D12CommandBuffer *cbD = QRHI_RES(QD3D12CommandBuffer, cb);
+ Q_ASSERT(cbD->recordingPass == QD3D12CommandBuffer::RenderPass);
+ cbD->cmdList->DrawIndexedInstanced(indexCount, instanceCount,
+ firstIndex, vertexOffset,
+ firstInstance);
+}
+
+void QRhiD3D12::debugMarkBegin(QRhiCommandBuffer *cb, const QByteArray &name)
+{
+ if (!debugMarkers)
+ return;
+
+ QD3D12CommandBuffer *cbD = QRHI_RES(QD3D12CommandBuffer, cb);
+#ifdef QRHI_D3D12_HAS_OLD_PIX
+ PIXBeginEvent(cbD->cmdList, PIX_COLOR_DEFAULT, reinterpret_cast<LPCWSTR>(QString::fromLatin1(name).utf16()));
+#else
+ Q_UNUSED(cbD);
+ Q_UNUSED(name);
+#endif
+}
+
+void QRhiD3D12::debugMarkEnd(QRhiCommandBuffer *cb)
+{
+ if (!debugMarkers)
+ return;
+
+ QD3D12CommandBuffer *cbD = QRHI_RES(QD3D12CommandBuffer, cb);
+#ifdef QRHI_D3D12_HAS_OLD_PIX
+ PIXEndEvent(cbD->cmdList);
+#else
+ Q_UNUSED(cbD);
+#endif
+}
+
+void QRhiD3D12::debugMarkMsg(QRhiCommandBuffer *cb, const QByteArray &msg)
+{
+ if (!debugMarkers)
+ return;
+
+ QD3D12CommandBuffer *cbD = QRHI_RES(QD3D12CommandBuffer, cb);
+#ifdef QRHI_D3D12_HAS_OLD_PIX
+ PIXSetMarker(cbD->cmdList, PIX_COLOR_DEFAULT, reinterpret_cast<LPCWSTR>(QString::fromLatin1(msg).utf16()));
+#else
+ Q_UNUSED(cbD);
+ Q_UNUSED(msg);
+#endif
+}
+
+const QRhiNativeHandles *QRhiD3D12::nativeHandles(QRhiCommandBuffer *cb)
+{
+ return QRHI_RES(QD3D12CommandBuffer, cb)->nativeHandles();
+}
+
+void QRhiD3D12::beginExternal(QRhiCommandBuffer *cb)
+{
+ Q_UNUSED(cb);
+}
+
+void QRhiD3D12::endExternal(QRhiCommandBuffer *cb)
+{
+ QD3D12CommandBuffer *cbD = QRHI_RES(QD3D12CommandBuffer, cb);
+ cbD->resetPerPassState();
+ bindShaderVisibleHeaps(cbD);
+ if (cbD->currentTarget) { // could be compute, no rendertarget then
+ QD3D12RenderTargetData *rtD = rtData(cbD->currentTarget);
+ cbD->cmdList->OMSetRenderTargets(UINT(rtD->colorAttCount),
+ rtD->rtv,
+ TRUE,
+ rtD->dsAttCount ? &rtD->dsv : nullptr);
+ }
+}
+
+double QRhiD3D12::lastCompletedGpuTime(QRhiCommandBuffer *cb)
+{
+ QD3D12CommandBuffer *cbD = QRHI_RES(QD3D12CommandBuffer, cb);
+ return cbD->lastGpuTime;
+}
+
+static void calculateGpuTime(QD3D12CommandBuffer *cbD,
+ int timestampPairStartIndex,
+ const quint8 *readbackBufPtr,
+ quint64 timestampTicksPerSecond)
+{
+ const size_t byteOffset = timestampPairStartIndex * sizeof(quint64);
+ const quint64 *p = reinterpret_cast<const quint64 *>(readbackBufPtr + byteOffset);
+ const quint64 startTime = *p++;
+ const quint64 endTime = *p;
+ if (startTime < endTime) {
+ const quint64 ticks = endTime - startTime;
+ const double timeSec = ticks / double(timestampTicksPerSecond);
+ cbD->lastGpuTime = timeSec;
+ }
+}
+
+QRhi::FrameOpResult QRhiD3D12::beginFrame(QRhiSwapChain *swapChain, QRhi::BeginFrameFlags flags)
+{
+ Q_UNUSED(flags);
+
+ QD3D12SwapChain *swapChainD = QRHI_RES(QD3D12SwapChain, swapChain);
+ currentSwapChain = swapChainD;
+ currentFrameSlot = swapChainD->currentFrameSlot;
+ QD3D12SwapChain::FrameResources &fr(swapChainD->frameRes[currentFrameSlot]);
+
+ // We could do smarter things but mirror the Vulkan backend for now: Make
+ // sure the previous commands for this same frame slot have finished. Do
+ // this also for any other swapchain's commands with the same frame slot.
+ // While this reduces concurrency in render-to-swapchain-A,
+ // render-to-swapchain-B, repeat kind of scenarios, it keeps resource usage
+ // safe: swapchain A starting its frame 0, followed by swapchain B starting
+ // its own frame 0 will make B wait for A's frame 0 commands. If a resource
+ // is written in B's frame or when B checks for pending resource releases,
+ // that won't mess up A's in-flight commands (as they are guaranteed not to
+ // be in flight anymore). With Qt Quick this situation cannot happen anyway
+ // by design (one QRhi per window).
+ for (QD3D12SwapChain *sc : std::as_const(swapchains))
+ sc->waitCommandCompletionForFrameSlot(currentFrameSlot); // note: swapChainD->currentFrameSlot, not sc's
+
+ HRESULT hr = cmdAllocators[currentFrameSlot]->Reset();
+ if (FAILED(hr)) {
+ qWarning("Failed to reset command allocator: %s",
+ qPrintable(QSystemError::windowsComString(hr)));
+ return QRhi::FrameOpError;
+ }
+
+ if (!startCommandListForCurrentFrameSlot(&fr.cmdList))
+ return QRhi::FrameOpError;
+
+ QD3D12CommandBuffer *cbD = &swapChainD->cbWrapper;
+ cbD->cmdList = fr.cmdList;
+
+ swapChainD->rtWrapper.d.rtv[0] = swapChainD->sampleDesc.Count > 1
+ ? swapChainD->msaaRtvs[swapChainD->currentBackBufferIndex].cpuHandle
+ : swapChainD->rtvs[swapChainD->currentBackBufferIndex].cpuHandle;
+
+ swapChainD->rtWrapper.d.dsv = swapChainD->ds ? swapChainD->ds->dsv.cpuHandle
+ : D3D12_CPU_DESCRIPTOR_HANDLE { 0 };
+
+ if (swapChainD->stereo) {
+ swapChainD->rtWrapperRight.d.rtv[0] = swapChainD->sampleDesc.Count > 1
+ ? swapChainD->msaaRtvs[swapChainD->currentBackBufferIndex].cpuHandle
+ : swapChainD->rtvsRight[swapChainD->currentBackBufferIndex].cpuHandle;
+
+ swapChainD->rtWrapperRight.d.dsv =
+ swapChainD->ds ? swapChainD->ds->dsv.cpuHandle : D3D12_CPU_DESCRIPTOR_HANDLE{ 0 };
+ }
+
+
+ // Time to release things that are marked for currentFrameSlot since due to
+ // the wait above we know that the previous commands on the GPU for this
+ // slot must have finished already.
+ releaseQueue.executeDeferredReleases(currentFrameSlot);
+
+ // Full reset of the command buffer data.
+ cbD->resetState();
+
+ // Move the head back to zero for the per-frame shader-visible descriptor heap work areas.
+ shaderVisibleCbvSrvUavHeap.perFrameHeapSlice[currentFrameSlot].head = 0;
+ // Same for the small staging area.
+ smallStagingAreas[currentFrameSlot].head = 0;
+
+ bindShaderVisibleHeaps(cbD);
+
+ finishActiveReadbacks(); // last, in case the readback-completed callback issues rhi calls
+
+ if (timestampQueryHeap.isValid() && timestampTicksPerSecond) {
+ // Read the timestamps for the previous frame for this slot. (the
+ // ResolveQuery() should have completed by now due to the wait above)
+ const int timestampPairStartIndex = currentFrameSlot * QD3D12_FRAMES_IN_FLIGHT;
+ calculateGpuTime(cbD,
+ timestampPairStartIndex,
+ timestampReadbackArea.mem.p,
+ timestampTicksPerSecond);
+ // Write the start timestamp for this frame for this slot.
+ cbD->cmdList->EndQuery(timestampQueryHeap.heap,
+ D3D12_QUERY_TYPE_TIMESTAMP,
+ timestampPairStartIndex);
+ }
+
+ return QRhi::FrameOpSuccess;
+}
+
+QRhi::FrameOpResult QRhiD3D12::endFrame(QRhiSwapChain *swapChain, QRhi::EndFrameFlags flags)
+{
+ QD3D12SwapChain *swapChainD = QRHI_RES(QD3D12SwapChain, swapChain);
+ Q_ASSERT(currentSwapChain == swapChainD);
+ QD3D12CommandBuffer *cbD = &swapChainD->cbWrapper;
+
+ QD3D12ObjectHandle backBufferResourceHandle = swapChainD->colorBuffers[swapChainD->currentBackBufferIndex];
+ if (swapChainD->sampleDesc.Count > 1) {
+ QD3D12ObjectHandle msaaBackBufferResourceHandle = swapChainD->msaaBuffers[swapChainD->currentBackBufferIndex];
+ barrierGen.addTransitionBarrier(msaaBackBufferResourceHandle, D3D12_RESOURCE_STATE_RESOLVE_SOURCE);
+ barrierGen.addTransitionBarrier(backBufferResourceHandle, D3D12_RESOURCE_STATE_RESOLVE_DEST);
+ barrierGen.enqueueBufferedTransitionBarriers(cbD);
+ const QD3D12Resource *src = resourcePool.lookupRef(msaaBackBufferResourceHandle);
+ const QD3D12Resource *dst = resourcePool.lookupRef(backBufferResourceHandle);
+ if (src && dst)
+ cbD->cmdList->ResolveSubresource(dst->resource, 0, src->resource, 0, swapChainD->colorFormat);
+ }
+
+ barrierGen.addTransitionBarrier(backBufferResourceHandle, D3D12_RESOURCE_STATE_PRESENT);
+ barrierGen.enqueueBufferedTransitionBarriers(cbD);
+
+ if (timestampQueryHeap.isValid()) {
+ const int timestampPairStartIndex = currentFrameSlot * QD3D12_FRAMES_IN_FLIGHT;
+ cbD->cmdList->EndQuery(timestampQueryHeap.heap,
+ D3D12_QUERY_TYPE_TIMESTAMP,
+ timestampPairStartIndex + 1);
+ cbD->cmdList->ResolveQueryData(timestampQueryHeap.heap,
+ D3D12_QUERY_TYPE_TIMESTAMP,
+ timestampPairStartIndex,
+ 2,
+ timestampReadbackArea.mem.buffer,
+ timestampPairStartIndex * sizeof(quint64));
+ }
+
+ ID3D12GraphicsCommandList1 *cmdList = cbD->cmdList;
+ HRESULT hr = cmdList->Close();
+ if (FAILED(hr)) {
+ qWarning("Failed to close command list: %s",
+ qPrintable(QSystemError::windowsComString(hr)));
+ return QRhi::FrameOpError;
+ }
+
+ ID3D12CommandList *execList[] = { cmdList };
+ cmdQueue->ExecuteCommandLists(1, execList);
+
+ if (!flags.testFlag(QRhi::SkipPresent)) {
+ UINT presentFlags = 0;
+ if (swapChainD->swapInterval == 0
+ && (swapChainD->swapChainFlags & DXGI_SWAP_CHAIN_FLAG_ALLOW_TEARING))
+ {
+ presentFlags |= DXGI_PRESENT_ALLOW_TEARING;
+ }
+ if (!swapChainD->swapChain) {
+ qWarning("Failed to present, no swapchain");
+ return QRhi::FrameOpError;
+ }
+ HRESULT hr = swapChainD->swapChain->Present(swapChainD->swapInterval, presentFlags);
+ if (hr == DXGI_ERROR_DEVICE_REMOVED || hr == DXGI_ERROR_DEVICE_RESET) {
+ qWarning("Device loss detected in Present()");
+ deviceLost = true;
+ return QRhi::FrameOpDeviceLost;
+ } else if (FAILED(hr)) {
+ qWarning("Failed to present: %s", qPrintable(QSystemError::windowsComString(hr)));
+ return QRhi::FrameOpError;
+ }
+
+ if (dcompDevice && swapChainD->dcompTarget && swapChainD->dcompVisual)
+ dcompDevice->Commit();
+ }
+
+ swapChainD->addCommandCompletionSignalForCurrentFrameSlot();
+
+ // NB! The deferred-release mechanism here differs from the older QRhi
+ // backends. There is no lastActiveFrameSlot tracking. Instead,
+ // currentFrameSlot is written to the registered entries now, and so the
+ // resources will get released in the frames_in_flight'th beginFrame()
+ // counting starting from now.
+ releaseQueue.activatePendingDeferredReleaseRequests(currentFrameSlot);
+
+ if (!flags.testFlag(QRhi::SkipPresent)) {
+ // Only move to the next slot if we presented. Otherwise will block and
+ // wait for completion in the next beginFrame already, but SkipPresent
+ // should be infrequent anyway.
+ swapChainD->currentFrameSlot = (swapChainD->currentFrameSlot + 1) % QD3D12_FRAMES_IN_FLIGHT;
+ swapChainD->currentBackBufferIndex = swapChainD->swapChain->GetCurrentBackBufferIndex();
+ }
+
+ currentSwapChain = nullptr;
+ return QRhi::FrameOpSuccess;
+}
+
+QRhi::FrameOpResult QRhiD3D12::beginOffscreenFrame(QRhiCommandBuffer **cb, QRhi::BeginFrameFlags flags)
+{
+ Q_UNUSED(flags);
+
+ // Switch to the next slot manually. Swapchains do not know about this
+ // which is good. So for example an onscreen, onscreen, offscreen,
+ // onscreen, onscreen, onscreen sequence of frames leads to 0, 1, 0, 0, 1,
+ // 0. (no strict alternation anymore) But this is not different from what
+ // happens when multiple swapchains are involved. Offscreen frames are
+ // synchronous anyway in the sense that they wait for execution to complete
+ // in endOffscreenFrame, so no resources used in that frame are busy
+ // anymore in the next frame.
+
+ currentFrameSlot = (currentFrameSlot + 1) % QD3D12_FRAMES_IN_FLIGHT;
+
+ for (QD3D12SwapChain *sc : std::as_const(swapchains))
+ sc->waitCommandCompletionForFrameSlot(currentFrameSlot); // note: not sc's currentFrameSlot
+
+ if (!offscreenCb[currentFrameSlot])
+ offscreenCb[currentFrameSlot] = new QD3D12CommandBuffer(this);
+ QD3D12CommandBuffer *cbD = offscreenCb[currentFrameSlot];
+ if (!startCommandListForCurrentFrameSlot(&cbD->cmdList))
+ return QRhi::FrameOpError;
+
+ releaseQueue.executeDeferredReleases(currentFrameSlot);
+ cbD->resetState();
+ shaderVisibleCbvSrvUavHeap.perFrameHeapSlice[currentFrameSlot].head = 0;
+ smallStagingAreas[currentFrameSlot].head = 0;
+
+ bindShaderVisibleHeaps(cbD);
+
+ if (timestampQueryHeap.isValid() && timestampTicksPerSecond) {
+ cbD->cmdList->EndQuery(timestampQueryHeap.heap,
+ D3D12_QUERY_TYPE_TIMESTAMP,
+ currentFrameSlot * QD3D12_FRAMES_IN_FLIGHT);
+ }
+
+ offscreenActive = true;
+ *cb = cbD;
+
+ return QRhi::FrameOpSuccess;
+}
+
+QRhi::FrameOpResult QRhiD3D12::endOffscreenFrame(QRhi::EndFrameFlags flags)
+{
+ Q_UNUSED(flags);
+ Q_ASSERT(offscreenActive);
+ offscreenActive = false;
+
+ QD3D12CommandBuffer *cbD = offscreenCb[currentFrameSlot];
+ if (timestampQueryHeap.isValid()) {
+ const int timestampPairStartIndex = currentFrameSlot * QD3D12_FRAMES_IN_FLIGHT;
+ cbD->cmdList->EndQuery(timestampQueryHeap.heap,
+ D3D12_QUERY_TYPE_TIMESTAMP,
+ timestampPairStartIndex + 1);
+ cbD->cmdList->ResolveQueryData(timestampQueryHeap.heap,
+ D3D12_QUERY_TYPE_TIMESTAMP,
+ timestampPairStartIndex,
+ 2,
+ timestampReadbackArea.mem.buffer,
+ timestampPairStartIndex * sizeof(quint64));
+ }
+
+ ID3D12GraphicsCommandList1 *cmdList = cbD->cmdList;
+ HRESULT hr = cmdList->Close();
+ if (FAILED(hr)) {
+ qWarning("Failed to close command list: %s",
+ qPrintable(QSystemError::windowsComString(hr)));
+ return QRhi::FrameOpError;
+ }
+
+ ID3D12CommandList *execList[] = { cmdList };
+ cmdQueue->ExecuteCommandLists(1, execList);
+
+ releaseQueue.activatePendingDeferredReleaseRequests(currentFrameSlot);
+
+ // wait for completion
+ waitGpu();
+
+ // Here we know that executing the host-side reads for this (or any
+ // previous) frame is safe since we waited for completion above.
+ finishActiveReadbacks(true);
+
+ // the timestamp query results should be available too, given the wait
+ if (timestampQueryHeap.isValid()) {
+ calculateGpuTime(cbD,
+ currentFrameSlot * QD3D12_FRAMES_IN_FLIGHT,
+ timestampReadbackArea.mem.p,
+ timestampTicksPerSecond);
+ }
+
+ return QRhi::FrameOpSuccess;
+}
+
+QRhi::FrameOpResult QRhiD3D12::finish()
+{
+ if (!inFrame)
+ return QRhi::FrameOpSuccess;
+
+ QD3D12CommandBuffer *cbD = nullptr;
+ if (offscreenActive) {
+ Q_ASSERT(!currentSwapChain);
+ cbD = offscreenCb[currentFrameSlot];
+ } else {
+ Q_ASSERT(currentSwapChain);
+ cbD = &currentSwapChain->cbWrapper;
+ }
+ if (!cbD)
+ return QRhi::FrameOpError;
+
+ Q_ASSERT(cbD->recordingPass == QD3D12CommandBuffer::NoPass);
+
+ ID3D12GraphicsCommandList1 *cmdList = cbD->cmdList;
+ HRESULT hr = cmdList->Close();
+ if (FAILED(hr)) {
+ qWarning("Failed to close command list: %s",
+ qPrintable(QSystemError::windowsComString(hr)));
+ return QRhi::FrameOpError;
+ }
+
+ ID3D12CommandList *execList[] = { cmdList };
+ cmdQueue->ExecuteCommandLists(1, execList);
+
+ releaseQueue.activatePendingDeferredReleaseRequests(currentFrameSlot);
+
+ // full blocking wait for everything, frame slots do not matter now
+ waitGpu();
+
+ hr = cmdAllocators[currentFrameSlot]->Reset();
+ if (FAILED(hr)) {
+ qWarning("Failed to reset command allocator: %s",
+ qPrintable(QSystemError::windowsComString(hr)));
+ return QRhi::FrameOpError;
+ }
+
+ if (!startCommandListForCurrentFrameSlot(&cmdList))
+ return QRhi::FrameOpError;
+
+ cbD->resetState();
+
+ shaderVisibleCbvSrvUavHeap.perFrameHeapSlice[currentFrameSlot].head = 0;
+ smallStagingAreas[currentFrameSlot].head = 0;
+
+ bindShaderVisibleHeaps(cbD);
+
+ releaseQueue.executeDeferredReleases(currentFrameSlot);
+
+ finishActiveReadbacks(true);
+
+ return QRhi::FrameOpSuccess;
+}
+
+void QRhiD3D12::resourceUpdate(QRhiCommandBuffer *cb, QRhiResourceUpdateBatch *resourceUpdates)
+{
+ QD3D12CommandBuffer *cbD = QRHI_RES(QD3D12CommandBuffer, cb);
+ Q_ASSERT(cbD->recordingPass == QD3D12CommandBuffer::NoPass);
+ enqueueResourceUpdates(cbD, resourceUpdates);
+}
+
+void QRhiD3D12::beginPass(QRhiCommandBuffer *cb,
+ QRhiRenderTarget *rt,
+ const QColor &colorClearValue,
+ const QRhiDepthStencilClearValue &depthStencilClearValue,
+ QRhiResourceUpdateBatch *resourceUpdates,
+ QRhiCommandBuffer::BeginPassFlags)
+{
+ QD3D12CommandBuffer *cbD = QRHI_RES(QD3D12CommandBuffer, cb);
+ Q_ASSERT(cbD->recordingPass == QD3D12CommandBuffer::NoPass);
+
+ if (resourceUpdates)
+ enqueueResourceUpdates(cbD, resourceUpdates);
+
+ QD3D12RenderTargetData *rtD = rtData(rt);
+ bool wantsColorClear = true;
+ bool wantsDsClear = true;
+ if (rt->resourceType() == QRhiRenderTarget::TextureRenderTarget) {
+ QD3D12TextureRenderTarget *rtTex = QRHI_RES(QD3D12TextureRenderTarget, rt);
+ wantsColorClear = !rtTex->m_flags.testFlag(QRhiTextureRenderTarget::PreserveColorContents);
+ wantsDsClear = !rtTex->m_flags.testFlag(QRhiTextureRenderTarget::PreserveDepthStencilContents);
+ if (!QRhiRenderTargetAttachmentTracker::isUpToDate<QD3D12Texture, QD3D12RenderBuffer>(rtTex->description(), rtD->currentResIdList))
+ rtTex->create();
+
+ for (auto it = rtTex->m_desc.cbeginColorAttachments(), itEnd = rtTex->m_desc.cendColorAttachments(); it != itEnd; ++it) {
+ QD3D12Texture *texD = QRHI_RES(QD3D12Texture, it->texture());
+ QD3D12Texture *resolveTexD = QRHI_RES(QD3D12Texture, it->resolveTexture());
+ QD3D12RenderBuffer *rbD = QRHI_RES(QD3D12RenderBuffer, it->renderBuffer());
+ if (texD)
+ barrierGen.addTransitionBarrier(texD->handle, D3D12_RESOURCE_STATE_RENDER_TARGET);
+ else if (rbD)
+ barrierGen.addTransitionBarrier(rbD->handle, D3D12_RESOURCE_STATE_RENDER_TARGET);
+ if (resolveTexD)
+ barrierGen.addTransitionBarrier(resolveTexD->handle, D3D12_RESOURCE_STATE_RENDER_TARGET);
+ }
+ if (rtTex->m_desc.depthStencilBuffer()) {
+ QD3D12RenderBuffer *rbD = QRHI_RES(QD3D12RenderBuffer, rtTex->m_desc.depthStencilBuffer());
+ Q_ASSERT(rbD->m_type == QRhiRenderBuffer::DepthStencil);
+ barrierGen.addTransitionBarrier(rbD->handle, D3D12_RESOURCE_STATE_DEPTH_WRITE);
+ } else if (rtTex->m_desc.depthTexture()) {
+ QD3D12Texture *depthTexD = QRHI_RES(QD3D12Texture, rtTex->m_desc.depthTexture());
+ barrierGen.addTransitionBarrier(depthTexD->handle, D3D12_RESOURCE_STATE_DEPTH_WRITE);
+ }
+ barrierGen.enqueueBufferedTransitionBarriers(cbD);
+ } else {
+ Q_ASSERT(currentSwapChain);
+ barrierGen.addTransitionBarrier(currentSwapChain->sampleDesc.Count > 1
+ ? currentSwapChain->msaaBuffers[currentSwapChain->currentBackBufferIndex]
+ : currentSwapChain->colorBuffers[currentSwapChain->currentBackBufferIndex],
+ D3D12_RESOURCE_STATE_RENDER_TARGET);
+ barrierGen.enqueueBufferedTransitionBarriers(cbD);
+ }
+
+ cbD->cmdList->OMSetRenderTargets(UINT(rtD->colorAttCount),
+ rtD->rtv,
+ TRUE,
+ rtD->dsAttCount ? &rtD->dsv : nullptr);
+
+ if (rtD->colorAttCount && wantsColorClear) {
+ float clearColor[4] = {
+ colorClearValue.redF(),
+ colorClearValue.greenF(),
+ colorClearValue.blueF(),
+ colorClearValue.alphaF()
+ };
+ for (int i = 0; i < rtD->colorAttCount; ++i)
+ cbD->cmdList->ClearRenderTargetView(rtD->rtv[i], clearColor, 0, nullptr);
+ }
+ if (rtD->dsAttCount && wantsDsClear) {
+ cbD->cmdList->ClearDepthStencilView(rtD->dsv,
+ D3D12_CLEAR_FLAGS(D3D12_CLEAR_FLAG_DEPTH | D3D12_CLEAR_FLAG_STENCIL),
+ depthStencilClearValue.depthClearValue(),
+ UINT8(depthStencilClearValue.stencilClearValue()),
+ 0,
+ nullptr);
+ }
+
+ cbD->recordingPass = QD3D12CommandBuffer::RenderPass;
+ cbD->currentTarget = rt;
+
+ cbD->resetPerPassState();
+}
+
+void QRhiD3D12::endPass(QRhiCommandBuffer *cb, QRhiResourceUpdateBatch *resourceUpdates)
+{
+ QD3D12CommandBuffer *cbD = QRHI_RES(QD3D12CommandBuffer, cb);
+ Q_ASSERT(cbD->recordingPass == QD3D12CommandBuffer::RenderPass);
+
+ if (cbD->currentTarget->resourceType() == QRhiResource::TextureRenderTarget) {
+ QD3D12TextureRenderTarget *rtTex = QRHI_RES(QD3D12TextureRenderTarget, cbD->currentTarget);
+ for (auto it = rtTex->m_desc.cbeginColorAttachments(), itEnd = rtTex->m_desc.cendColorAttachments();
+ it != itEnd; ++it)
+ {
+ const QRhiColorAttachment &colorAtt(*it);
+ if (!colorAtt.resolveTexture())
+ continue;
+
+ QD3D12Texture *dstTexD = QRHI_RES(QD3D12Texture, colorAtt.resolveTexture());
+ QD3D12Resource *dstRes = resourcePool.lookupRef(dstTexD->handle);
+ if (!dstRes)
+ continue;
+
+ QD3D12Texture *srcTexD = QRHI_RES(QD3D12Texture, colorAtt.texture());
+ QD3D12RenderBuffer *srcRbD = QRHI_RES(QD3D12RenderBuffer, colorAtt.renderBuffer());
+ Q_ASSERT(srcTexD || srcRbD);
+ QD3D12Resource *srcRes = resourcePool.lookupRef(srcTexD ? srcTexD->handle : srcRbD->handle);
+ if (!srcRes)
+ continue;
+
+ if (srcTexD) {
+ if (srcTexD->dxgiFormat != dstTexD->dxgiFormat) {
+ qWarning("Resolve source (%d) and destination (%d) formats do not match",
+ int(srcTexD->dxgiFormat), int(dstTexD->dxgiFormat));
+ continue;
+ }
+ if (srcTexD->sampleDesc.Count <= 1) {
+ qWarning("Cannot resolve a non-multisample texture");
+ continue;
+ }
+ if (srcTexD->m_pixelSize != dstTexD->m_pixelSize) {
+ qWarning("Resolve source and destination sizes do not match");
+ continue;
+ }
+ } else {
+ if (srcRbD->dxgiFormat != dstTexD->dxgiFormat) {
+ qWarning("Resolve source (%d) and destination (%d) formats do not match",
+ int(srcRbD->dxgiFormat), int(dstTexD->dxgiFormat));
+ continue;
+ }
+ if (srcRbD->m_pixelSize != dstTexD->m_pixelSize) {
+ qWarning("Resolve source and destination sizes do not match");
+ continue;
+ }
+ }
+
+ barrierGen.addTransitionBarrier(srcTexD ? srcTexD->handle : srcRbD->handle, D3D12_RESOURCE_STATE_RESOLVE_SOURCE);
+ barrierGen.addTransitionBarrier(dstTexD->handle, D3D12_RESOURCE_STATE_RESOLVE_DEST);
+ barrierGen.enqueueBufferedTransitionBarriers(cbD);
+
+ const UINT resolveCount = colorAtt.multiViewCount() >= 2 ? colorAtt.multiViewCount() : 1;
+ for (UINT resolveIdx = 0; resolveIdx < resolveCount; ++resolveIdx) {
+ const UINT srcSubresource = calcSubresource(0, UINT(colorAtt.layer()) + resolveIdx, 1);
+ const UINT dstSubresource = calcSubresource(UINT(colorAtt.resolveLevel()),
+ UINT(colorAtt.resolveLayer()) + resolveIdx,
+ dstTexD->mipLevelCount);
+ cbD->cmdList->ResolveSubresource(dstRes->resource, dstSubresource,
+ srcRes->resource, srcSubresource,
+ dstTexD->dxgiFormat);
+ }
+ }
+ if (rtTex->m_desc.depthResolveTexture())
+ qWarning("Resolving multisample depth-stencil buffers is not supported with D3D");
+ }
+
+ cbD->recordingPass = QD3D12CommandBuffer::NoPass;
+ cbD->currentTarget = nullptr;
+
+ if (resourceUpdates)
+ enqueueResourceUpdates(cbD, resourceUpdates);
+}
+
+void QRhiD3D12::beginComputePass(QRhiCommandBuffer *cb,
+ QRhiResourceUpdateBatch *resourceUpdates,
+ QRhiCommandBuffer::BeginPassFlags)
+{
+ QD3D12CommandBuffer *cbD = QRHI_RES(QD3D12CommandBuffer, cb);
+ Q_ASSERT(cbD->recordingPass == QD3D12CommandBuffer::NoPass);
+
+ if (resourceUpdates)
+ enqueueResourceUpdates(cbD, resourceUpdates);
+
+ cbD->recordingPass = QD3D12CommandBuffer::ComputePass;
+
+ cbD->resetPerPassState();
+}
+
+void QRhiD3D12::endComputePass(QRhiCommandBuffer *cb, QRhiResourceUpdateBatch *resourceUpdates)
+{
+ QD3D12CommandBuffer *cbD = QRHI_RES(QD3D12CommandBuffer, cb);
+ Q_ASSERT(cbD->recordingPass == QD3D12CommandBuffer::ComputePass);
+
+ cbD->recordingPass = QD3D12CommandBuffer::NoPass;
+
+ if (resourceUpdates)
+ enqueueResourceUpdates(cbD, resourceUpdates);
+}
+
+void QRhiD3D12::setComputePipeline(QRhiCommandBuffer *cb, QRhiComputePipeline *ps)
+{
+ QD3D12CommandBuffer *cbD = QRHI_RES(QD3D12CommandBuffer, cb);
+ Q_ASSERT(cbD->recordingPass == QD3D12CommandBuffer::ComputePass);
+ QD3D12ComputePipeline *psD = QRHI_RES(QD3D12ComputePipeline, ps);
+ const bool pipelineChanged = cbD->currentComputePipeline != psD || cbD->currentPipelineGeneration != psD->generation;
+
+ if (pipelineChanged) {
+ cbD->currentGraphicsPipeline = nullptr;
+ cbD->currentComputePipeline = psD;
+ cbD->currentPipelineGeneration = psD->generation;
+
+ if (QD3D12Pipeline *pipeline = pipelinePool.lookupRef(psD->handle)) {
+ Q_ASSERT(pipeline->type == QD3D12Pipeline::Compute);
+ cbD->cmdList->SetPipelineState(pipeline->pso);
+ if (QD3D12RootSignature *rs = rootSignaturePool.lookupRef(psD->rootSigHandle))
+ cbD->cmdList->SetComputeRootSignature(rs->rootSig);
+ }
+ }
+}
+
+void QRhiD3D12::dispatch(QRhiCommandBuffer *cb, int x, int y, int z)
+{
+ QD3D12CommandBuffer *cbD = QRHI_RES(QD3D12CommandBuffer, cb);
+ Q_ASSERT(cbD->recordingPass == QD3D12CommandBuffer::ComputePass);
+ cbD->cmdList->Dispatch(UINT(x), UINT(y), UINT(z));
+}
+
+bool QD3D12DescriptorHeap::create(ID3D12Device *device,
+ quint32 descriptorCount,
+ D3D12_DESCRIPTOR_HEAP_TYPE heapType,
+ D3D12_DESCRIPTOR_HEAP_FLAGS heapFlags)
+{
+ head = 0;
+ capacity = descriptorCount;
+ this->heapType = heapType;
+ this->heapFlags = heapFlags;
+
+ D3D12_DESCRIPTOR_HEAP_DESC heapDesc = {};
+ heapDesc.Type = heapType;
+ heapDesc.NumDescriptors = capacity;
+ heapDesc.Flags = D3D12_DESCRIPTOR_HEAP_FLAGS(heapFlags);
+
+ HRESULT hr = device->CreateDescriptorHeap(&heapDesc, __uuidof(ID3D12DescriptorHeap), reinterpret_cast<void **>(&heap));
+ if (FAILED(hr)) {
+ qWarning("Failed to create descriptor heap: %s", qPrintable(QSystemError::windowsComString(hr)));
+ heap = nullptr;
+ capacity = descriptorByteSize = 0;
+ return false;
+ }
+
+ descriptorByteSize = device->GetDescriptorHandleIncrementSize(heapType);
+ heapStart.cpuHandle = heap->GetCPUDescriptorHandleForHeapStart();
+ if (heapFlags & D3D12_DESCRIPTOR_HEAP_FLAG_SHADER_VISIBLE)
+ heapStart.gpuHandle = heap->GetGPUDescriptorHandleForHeapStart();
+
+ return true;
+}
+
+void QD3D12DescriptorHeap::createWithExisting(const QD3D12DescriptorHeap &other,
+ quint32 offsetInDescriptors,
+ quint32 descriptorCount)
+{
+ heap = nullptr;
+ head = 0;
+ capacity = descriptorCount;
+ heapType = other.heapType;
+ heapFlags = other.heapFlags;
+ descriptorByteSize = other.descriptorByteSize;
+ heapStart = incremented(other.heapStart, offsetInDescriptors);
+}
+
+void QD3D12DescriptorHeap::destroy()
+{
+ if (heap) {
+ heap->Release();
+ heap = nullptr;
+ }
+ capacity = 0;
+}
+
+void QD3D12DescriptorHeap::destroyWithDeferredRelease(QD3D12ReleaseQueue *releaseQueue)
+{
+ if (heap) {
+ releaseQueue->deferredReleaseDescriptorHeap(heap);
+ heap = nullptr;
+ }
+ capacity = 0;
+}
+
+QD3D12Descriptor QD3D12DescriptorHeap::get(quint32 count)
+{
+ Q_ASSERT(count > 0);
+ if (head + count > capacity) {
+ qWarning("Cannot get %u descriptors as that would exceed capacity %u", count, capacity);
+ return {};
+ }
+ head += count;
+ return at(head - count);
+}
+
+QD3D12Descriptor QD3D12DescriptorHeap::at(quint32 index) const
+{
+ const quint32 startOffset = index * descriptorByteSize;
+ QD3D12Descriptor result;
+ result.cpuHandle.ptr = heapStart.cpuHandle.ptr + startOffset;
+ if (heapStart.gpuHandle.ptr != 0)
+ result.gpuHandle.ptr = heapStart.gpuHandle.ptr + startOffset;
+ return result;
+}
+
+bool QD3D12CpuDescriptorPool::create(ID3D12Device *device, D3D12_DESCRIPTOR_HEAP_TYPE heapType, const char *debugName)
+{
+ QD3D12DescriptorHeap firstHeap;
+ if (!firstHeap.create(device, DESCRIPTORS_PER_HEAP, heapType, D3D12_DESCRIPTOR_HEAP_FLAG_NONE))
+ return false;
+ heaps.append(HeapWithMap::init(firstHeap, DESCRIPTORS_PER_HEAP));
+ descriptorByteSize = heaps[0].heap.descriptorByteSize;
+ this->device = device;
+ this->debugName = debugName;
+ return true;
+}
+
+void QD3D12CpuDescriptorPool::destroy()
+{
+#ifndef QT_NO_DEBUG
+ // debug builds: just do it always
+ static bool leakCheck = true;
+#else
+ // release builds: opt-in
+ static bool leakCheck = qEnvironmentVariableIntValue("QT_RHI_LEAK_CHECK");
+#endif
+ if (leakCheck) {
+ for (HeapWithMap &heap : heaps) {
+ const int leakedDescriptorCount = heap.map.count(true);
+ if (leakedDescriptorCount > 0) {
+ qWarning("QD3D12CpuDescriptorPool::destroy(): "
+ "Heap %p for descriptor pool %p '%s' has %d unreleased descriptors",
+ &heap.heap, this, debugName, leakedDescriptorCount);
+ }
+ }
+ }
+ for (HeapWithMap &heap : heaps)
+ heap.heap.destroy();
+ heaps.clear();
+}
+
+QD3D12Descriptor QD3D12CpuDescriptorPool::allocate(quint32 count)
+{
+ Q_ASSERT(count > 0 && count <= DESCRIPTORS_PER_HEAP);
+
+ HeapWithMap &last(heaps.last());
+ if (last.heap.head + count <= last.heap.capacity) {
+ quint32 firstIndex = last.heap.head;
+ for (quint32 i = 0; i < count; ++i)
+ last.map.setBit(firstIndex + i);
+ return last.heap.get(count);
+ }
+
+ for (HeapWithMap &heap : heaps) {
+ quint32 freeCount = 0;
+ for (quint32 i = 0; i < DESCRIPTORS_PER_HEAP; ++i) {
+ if (heap.map.testBit(i)) {
+ freeCount = 0;
+ } else {
+ freeCount += 1;
+ if (freeCount == count) {
+ quint32 firstIndex = i - (freeCount - 1);
+ for (quint32 j = 0; j < count; ++j) {
+ heap.map.setBit(firstIndex + j);
+ return heap.heap.at(firstIndex);
+ }
+ }
+ }
+ }
+ }
+
+ QD3D12DescriptorHeap newHeap;
+ if (!newHeap.create(device, DESCRIPTORS_PER_HEAP, last.heap.heapType, last.heap.heapFlags))
+ return {};
+
+ heaps.append(HeapWithMap::init(newHeap, DESCRIPTORS_PER_HEAP));
+
+ for (quint32 i = 0; i < count; ++i)
+ heaps.last().map.setBit(i);
+
+ return heaps.last().heap.get(count);
+}
+
+void QD3D12CpuDescriptorPool::release(const QD3D12Descriptor &descriptor, quint32 count)
+{
+ Q_ASSERT(count > 0 && count <= DESCRIPTORS_PER_HEAP);
+ if (!descriptor.isValid())
+ return;
+
+ const SIZE_T addr = descriptor.cpuHandle.ptr;
+ for (HeapWithMap &heap : heaps) {
+ const SIZE_T begin = heap.heap.heapStart.cpuHandle.ptr;
+ const SIZE_T end = begin + heap.heap.descriptorByteSize * heap.heap.capacity;
+ if (addr >= begin && addr < end) {
+ quint32 firstIndex = (addr - begin) / heap.heap.descriptorByteSize;
+ for (quint32 i = 0; i < count; ++i)
+ heap.map.setBit(firstIndex + i, false);
+ return;
+ }
+ }
+
+ qWarning("QD3D12CpuDescriptorPool::release: Descriptor with address %llu is not in any heap",
+ quint64(descriptor.cpuHandle.ptr));
+}
+
+bool QD3D12QueryHeap::create(ID3D12Device *device,
+ quint32 queryCount,
+ D3D12_QUERY_HEAP_TYPE heapType)
+{
+ capacity = queryCount;
+
+ D3D12_QUERY_HEAP_DESC heapDesc = {};
+ heapDesc.Type = heapType;
+ heapDesc.Count = capacity;
+
+ HRESULT hr = device->CreateQueryHeap(&heapDesc, __uuidof(ID3D12QueryHeap), reinterpret_cast<void **>(&heap));
+ if (FAILED(hr)) {
+ qWarning("Failed to create query heap: %s", qPrintable(QSystemError::windowsComString(hr)));
+ heap = nullptr;
+ capacity = 0;
+ return false;
+ }
+
+ return true;
+}
+
+void QD3D12QueryHeap::destroy()
+{
+ if (heap) {
+ heap->Release();
+ heap = nullptr;
+ }
+ capacity = 0;
+}
+
+bool QD3D12StagingArea::create(QRhiD3D12 *rhi, quint32 capacity, D3D12_HEAP_TYPE heapType)
+{
+ Q_ASSERT(heapType == D3D12_HEAP_TYPE_UPLOAD || heapType == D3D12_HEAP_TYPE_READBACK);
+ D3D12_RESOURCE_DESC resourceDesc = {};
+ resourceDesc.Dimension = D3D12_RESOURCE_DIMENSION_BUFFER;
+ resourceDesc.Width = capacity;
+ resourceDesc.Height = 1;
+ resourceDesc.DepthOrArraySize = 1;
+ resourceDesc.MipLevels = 1;
+ resourceDesc.Format = DXGI_FORMAT_UNKNOWN;
+ resourceDesc.SampleDesc = { 1, 0 };
+ resourceDesc.Layout = D3D12_TEXTURE_LAYOUT_ROW_MAJOR;
+ resourceDesc.Flags = D3D12_RESOURCE_FLAG_NONE;
+ UINT state = heapType == D3D12_HEAP_TYPE_UPLOAD ? D3D12_RESOURCE_STATE_GENERIC_READ : D3D12_RESOURCE_STATE_COPY_DEST;
+ HRESULT hr = rhi->vma.createResource(heapType,
+ &resourceDesc,
+ D3D12_RESOURCE_STATES(state),
+ nullptr,
+ &allocation,
+ __uuidof(ID3D12Resource),
+ reinterpret_cast<void **>(&resource));
+ if (FAILED(hr)) {
+ qWarning("Failed to create buffer for staging area: %s",
+ qPrintable(QSystemError::windowsComString(hr)));
+ return false;
+ }
+ void *p = nullptr;
+ hr = resource->Map(0, nullptr, &p);
+ if (FAILED(hr)) {
+ qWarning("Failed to map buffer for staging area: %s",
+ qPrintable(QSystemError::windowsComString(hr)));
+ destroy();
+ return false;
+ }
+
+ mem.p = static_cast<quint8 *>(p);
+ mem.gpuAddr = resource->GetGPUVirtualAddress();
+ mem.buffer = resource;
+ mem.bufferOffset = 0;
+
+ this->capacity = capacity;
+ head = 0;
+
+ return true;
+}
+
+void QD3D12StagingArea::destroy()
+{
+ if (resource) {
+ resource->Release();
+ resource = nullptr;
+ }
+ if (allocation) {
+ allocation->Release();
+ allocation = nullptr;
+ }
+ mem = {};
+}
+
+void QD3D12StagingArea::destroyWithDeferredRelease(QD3D12ReleaseQueue *releaseQueue)
+{
+ if (resource)
+ releaseQueue->deferredReleaseResourceAndAllocation(resource, allocation);
+ mem = {};
+}
+
+QD3D12StagingArea::Allocation QD3D12StagingArea::get(quint32 byteSize)
+{
+ const quint32 allocSize = aligned(byteSize, ALIGNMENT);
+ if (head + allocSize > capacity) {
+ qWarning("Failed to allocate %u (%u) bytes from staging area of size %u with %u bytes left",
+ allocSize, byteSize, capacity, remainingCapacity());
+ return {};
+ }
+ const quint32 offset = head;
+ head += allocSize;
+ return {
+ mem.p + offset,
+ mem.gpuAddr + offset,
+ mem.buffer,
+ offset
+ };
+}
+
+// Can be called inside and outside of begin-endFrame. Removes from the pool
+// and releases the underlying native resource only in the frames_in_flight'th
+// beginFrame() counted starting from the next endFrame().
+void QD3D12ReleaseQueue::deferredReleaseResource(const QD3D12ObjectHandle &handle)
+{
+ DeferredReleaseEntry e;
+ e.handle = handle;
+ queue.append(e);
+}
+
+void QD3D12ReleaseQueue::deferredReleaseResourceWithViews(const QD3D12ObjectHandle &handle,
+ QD3D12CpuDescriptorPool *pool,
+ const QD3D12Descriptor &viewsStart,
+ int viewCount)
+{
+ DeferredReleaseEntry e;
+ e.type = DeferredReleaseEntry::Resource;
+ e.handle = handle;
+ e.poolForViews = pool;
+ e.viewsStart = viewsStart;
+ e.viewCount = viewCount;
+ queue.append(e);
+}
+
+void QD3D12ReleaseQueue::deferredReleasePipeline(const QD3D12ObjectHandle &handle)
+{
+ DeferredReleaseEntry e;
+ e.type = DeferredReleaseEntry::Pipeline;
+ e.handle = handle;
+ queue.append(e);
+}
+
+void QD3D12ReleaseQueue::deferredReleaseRootSignature(const QD3D12ObjectHandle &handle)
+{
+ DeferredReleaseEntry e;
+ e.type = DeferredReleaseEntry::RootSignature;
+ e.handle = handle;
+ queue.append(e);
+}
+
+void QD3D12ReleaseQueue::deferredReleaseCallback(std::function<void(void*)> callback, void *userData)
+{
+ DeferredReleaseEntry e;
+ e.type = DeferredReleaseEntry::Callback;
+ e.callback = callback;
+ e.callbackUserData = userData;
+ queue.append(e);
+}
+
+void QD3D12ReleaseQueue::deferredReleaseResourceAndAllocation(ID3D12Resource *resource,
+ D3D12MA::Allocation *allocation)
+{
+ DeferredReleaseEntry e;
+ e.type = DeferredReleaseEntry::ResourceAndAllocation;
+ e.resourceAndAllocation = { resource, allocation };
+ queue.append(e);
+}
+
+void QD3D12ReleaseQueue::deferredReleaseDescriptorHeap(ID3D12DescriptorHeap *heap)
+{
+ DeferredReleaseEntry e;
+ e.type = DeferredReleaseEntry::DescriptorHeap;
+ e.descriptorHeap = heap;
+ queue.append(e);
+}
+
+void QD3D12ReleaseQueue::deferredReleaseViews(QD3D12CpuDescriptorPool *pool,
+ const QD3D12Descriptor &viewsStart,
+ int viewCount)
+{
+ DeferredReleaseEntry e;
+ e.type = DeferredReleaseEntry::Views;
+ e.poolForViews = pool;
+ e.viewsStart = viewsStart;
+ e.viewCount = viewCount;
+ queue.append(e);
+}
+
+void QD3D12ReleaseQueue::activatePendingDeferredReleaseRequests(int frameSlot)
+{
+ for (DeferredReleaseEntry &e : queue) {
+ if (!e.frameSlotToBeReleasedIn.has_value())
+ e.frameSlotToBeReleasedIn = frameSlot;
+ }
+}
+
+void QD3D12ReleaseQueue::executeDeferredReleases(int frameSlot, bool forced)
+{
+ for (int i = queue.count() - 1; i >= 0; --i) {
+ const DeferredReleaseEntry &e(queue[i]);
+ if (forced || (e.frameSlotToBeReleasedIn.has_value() && e.frameSlotToBeReleasedIn.value() == frameSlot)) {
+ switch (e.type) {
+ case DeferredReleaseEntry::Resource:
+ resourcePool->remove(e.handle);
+ if (e.poolForViews && e.viewsStart.isValid() && e.viewCount > 0)
+ e.poolForViews->release(e.viewsStart, e.viewCount);
+ break;
+ case DeferredReleaseEntry::Pipeline:
+ pipelinePool->remove(e.handle);
+ break;
+ case DeferredReleaseEntry::RootSignature:
+ rootSignaturePool->remove(e.handle);
+ break;
+ case DeferredReleaseEntry::Callback:
+ e.callback(e.callbackUserData);
+ break;
+ case DeferredReleaseEntry::ResourceAndAllocation:
+ // order matters: resource first, then the allocation (which
+ // may be null)
+ e.resourceAndAllocation.first->Release();
+ if (e.resourceAndAllocation.second)
+ e.resourceAndAllocation.second->Release();
+ break;
+ case DeferredReleaseEntry::DescriptorHeap:
+ e.descriptorHeap->Release();
+ break;
+ case DeferredReleaseEntry::Views:
+ e.poolForViews->release(e.viewsStart, e.viewCount);
+ break;
+ }
+ queue.removeAt(i);
+ }
+ }
+}
+
+void QD3D12ReleaseQueue::releaseAll()
+{
+ executeDeferredReleases(0, true);
+}
+
+void QD3D12ResourceBarrierGenerator::addTransitionBarrier(const QD3D12ObjectHandle &resourceHandle,
+ D3D12_RESOURCE_STATES stateAfter)
+{
+ if (QD3D12Resource *res = resourcePool->lookupRef(resourceHandle)) {
+ if (stateAfter != res->state) {
+ transitionResourceBarriers.append({ resourceHandle, res->state, stateAfter });
+ res->state = stateAfter;
+ }
+ }
+}
+
+void QD3D12ResourceBarrierGenerator::enqueueBufferedTransitionBarriers(QD3D12CommandBuffer *cbD)
+{
+ QVarLengthArray<D3D12_RESOURCE_BARRIER, PREALLOC> barriers;
+ for (const TransitionResourceBarrier &trb : transitionResourceBarriers) {
+ if (QD3D12Resource *res = resourcePool->lookupRef(trb.resourceHandle)) {
+ D3D12_RESOURCE_BARRIER barrier = {};
+ barrier.Type = D3D12_RESOURCE_BARRIER_TYPE_TRANSITION;
+ barrier.Flags = D3D12_RESOURCE_BARRIER_FLAG_NONE;
+ barrier.Transition.pResource = res->resource;
+ barrier.Transition.Subresource = D3D12_RESOURCE_BARRIER_ALL_SUBRESOURCES;
+ barrier.Transition.StateBefore = trb.stateBefore;
+ barrier.Transition.StateAfter = trb.stateAfter;
+ barriers.append(barrier);
+ }
+ }
+ transitionResourceBarriers.clear();
+ if (!barriers.isEmpty())
+ cbD->cmdList->ResourceBarrier(barriers.count(), barriers.constData());
+}
+
+void QD3D12ResourceBarrierGenerator::enqueueSubresourceTransitionBarrier(QD3D12CommandBuffer *cbD,
+ const QD3D12ObjectHandle &resourceHandle,
+ UINT subresource,
+ D3D12_RESOURCE_STATES stateBefore,
+ D3D12_RESOURCE_STATES stateAfter)
+{
+ if (QD3D12Resource *res = resourcePool->lookupRef(resourceHandle)) {
+ D3D12_RESOURCE_BARRIER barrier = {};
+ barrier.Type = D3D12_RESOURCE_BARRIER_TYPE_TRANSITION;
+ barrier.Flags = D3D12_RESOURCE_BARRIER_FLAG_NONE;
+ barrier.Transition.pResource = res->resource;
+ barrier.Transition.Subresource = subresource;
+ barrier.Transition.StateBefore = stateBefore;
+ barrier.Transition.StateAfter = stateAfter;
+ cbD->cmdList->ResourceBarrier(1, &barrier);
+ }
+}
+
+void QD3D12ResourceBarrierGenerator::enqueueUavBarrier(QD3D12CommandBuffer *cbD,
+ const QD3D12ObjectHandle &resourceHandle)
+{
+ if (QD3D12Resource *res = resourcePool->lookupRef(resourceHandle)) {
+ D3D12_RESOURCE_BARRIER barrier = {};
+ barrier.Type = D3D12_RESOURCE_BARRIER_TYPE_UAV;
+ barrier.Flags = D3D12_RESOURCE_BARRIER_FLAG_NONE;
+ barrier.UAV.pResource = res->resource;
+ cbD->cmdList->ResourceBarrier(1, &barrier);
+ }
+}
+
+void QD3D12ShaderBytecodeCache::insertWithCapacityLimit(const QRhiShaderStage &key, const Shader &s)
+{
+ if (data.count() >= QRhiD3D12::MAX_SHADER_CACHE_ENTRIES)
+ data.clear();
+ data.insert(key, s);
+}
+
+bool QD3D12ShaderVisibleDescriptorHeap::create(ID3D12Device *device,
+ D3D12_DESCRIPTOR_HEAP_TYPE type,
+ quint32 perFrameDescriptorCount)
+{
+ Q_ASSERT(type == D3D12_DESCRIPTOR_HEAP_TYPE_CBV_SRV_UAV || type == D3D12_DESCRIPTOR_HEAP_TYPE_SAMPLER);
+
+ quint32 size = perFrameDescriptorCount * QD3D12_FRAMES_IN_FLIGHT;
+
+ // https://learn.microsoft.com/en-us/windows/win32/direct3d12/hardware-support
+ const quint32 CBV_SRV_UAV_MAX = 1000000;
+ const quint32 SAMPLER_MAX = 2048;
+ if (type == D3D12_DESCRIPTOR_HEAP_TYPE_CBV_SRV_UAV)
+ size = qMin(size, CBV_SRV_UAV_MAX);
+ else if (type == D3D12_DESCRIPTOR_HEAP_TYPE_SAMPLER)
+ size = qMin(size, SAMPLER_MAX);
+
+ if (!heap.create(device, size, type, D3D12_DESCRIPTOR_HEAP_FLAG_SHADER_VISIBLE)) {
+ qWarning("Failed to create shader-visible descriptor heap of size %u", size);
+ return false;
+ }
+
+ perFrameDescriptorCount = size / QD3D12_FRAMES_IN_FLIGHT;
+ quint32 currentOffsetInDescriptors = 0;
+ for (int i = 0; i < QD3D12_FRAMES_IN_FLIGHT; ++i) {
+ perFrameHeapSlice[i].createWithExisting(heap, currentOffsetInDescriptors, perFrameDescriptorCount);
+ currentOffsetInDescriptors += perFrameDescriptorCount;
+ }
+
+ return true;
+}
+
+void QD3D12ShaderVisibleDescriptorHeap::destroy()
+{
+ heap.destroy();
+}
+
+void QD3D12ShaderVisibleDescriptorHeap::destroyWithDeferredRelease(QD3D12ReleaseQueue *releaseQueue)
+{
+ heap.destroyWithDeferredRelease(releaseQueue);
+}
+
+static inline QPair<int, int> mapBinding(int binding, const QShader::NativeResourceBindingMap &map)
+{
+ if (map.isEmpty())
+ return { binding, binding }; // assume 1:1 mapping
+
+ auto it = map.constFind(binding);
+ if (it != map.cend())
+ return *it;
+
+ // Hitting this path is normal too. It is not given that the resource is
+ // present in the shaders for all the stages specified by the visibility
+ // mask in the QRhiShaderResourceBinding.
+ return { -1, -1 };
+}
+
+void QD3D12ShaderResourceVisitor::visit()
+{
+ for (int bindingIdx = 0, bindingCount = srb->m_bindings.count(); bindingIdx != bindingCount; ++bindingIdx) {
+ const QRhiShaderResourceBinding &b(srb->m_bindings[bindingIdx]);
+ const QRhiShaderResourceBinding::Data *bd = QRhiImplementation::shaderResourceBindingData(b);
+
+ for (int stageIdx = 0; stageIdx < stageCount; ++stageIdx) {
+ const QD3D12ShaderStageData *sd = &stageData[stageIdx];
+ if (!sd->valid)
+ continue;
+
+ if (!bd->stage.testFlag(qd3d12_stageToSrb(sd->stage)))
+ continue;
+
+ switch (bd->type) {
+ case QRhiShaderResourceBinding::UniformBuffer:
+ {
+ const int shaderRegister = mapBinding(bd->binding, sd->nativeResourceBindingMap).first;
+ if (shaderRegister >= 0 && uniformBuffer)
+ uniformBuffer(sd->stage, bd->u.ubuf, shaderRegister, bd->binding);
+ }
+ break;
+ case QRhiShaderResourceBinding::SampledTexture:
+ {
+ Q_ASSERT(bd->u.stex.count > 0);
+ const int textureBaseShaderRegister = mapBinding(bd->binding, sd->nativeResourceBindingMap).first;
+ const int samplerBaseShaderRegister = mapBinding(bd->binding, sd->nativeResourceBindingMap).second;
+ for (int i = 0; i < bd->u.stex.count; ++i) {
+ if (textureBaseShaderRegister >= 0 && texture)
+ texture(sd->stage, bd->u.stex.texSamplers[i], textureBaseShaderRegister + i);
+ if (samplerBaseShaderRegister >= 0 && sampler)
+ sampler(sd->stage, bd->u.stex.texSamplers[i], samplerBaseShaderRegister + i);
+ }
+ }
+ break;
+ case QRhiShaderResourceBinding::Texture:
+ {
+ Q_ASSERT(bd->u.stex.count > 0);
+ const int baseShaderRegister = mapBinding(bd->binding, sd->nativeResourceBindingMap).first;
+ if (baseShaderRegister >= 0 && texture) {
+ for (int i = 0; i < bd->u.stex.count; ++i)
+ texture(sd->stage, bd->u.stex.texSamplers[i], baseShaderRegister + i);
+ }
+ }
+ break;
+ case QRhiShaderResourceBinding::Sampler:
+ {
+ Q_ASSERT(bd->u.stex.count > 0);
+ const int baseShaderRegister = mapBinding(bd->binding, sd->nativeResourceBindingMap).first;
+ if (baseShaderRegister >= 0 && sampler) {
+ for (int i = 0; i < bd->u.stex.count; ++i)
+ sampler(sd->stage, bd->u.stex.texSamplers[i], baseShaderRegister + i);
+ }
+ }
+ break;
+ case QRhiShaderResourceBinding::ImageLoad:
+ {
+ const int shaderRegister = mapBinding(bd->binding, sd->nativeResourceBindingMap).first;
+ if (shaderRegister >= 0 && storageImage)
+ storageImage(sd->stage, bd->u.simage, Load, shaderRegister);
+ }
+ break;
+ case QRhiShaderResourceBinding::ImageStore:
+ {
+ const int shaderRegister = mapBinding(bd->binding, sd->nativeResourceBindingMap).first;
+ if (shaderRegister >= 0 && storageImage)
+ storageImage(sd->stage, bd->u.simage, Store, shaderRegister);
+ }
+ break;
+ case QRhiShaderResourceBinding::ImageLoadStore:
+ {
+ const int shaderRegister = mapBinding(bd->binding, sd->nativeResourceBindingMap).first;
+ if (shaderRegister >= 0 && storageImage)
+ storageImage(sd->stage, bd->u.simage, LoadStore, shaderRegister);
+ }
+ break;
+ case QRhiShaderResourceBinding::BufferLoad:
+ {
+ const int shaderRegister = mapBinding(bd->binding, sd->nativeResourceBindingMap).first;
+ if (shaderRegister >= 0 && storageBuffer)
+ storageBuffer(sd->stage, bd->u.sbuf, Load, shaderRegister);
+ }
+ break;
+ case QRhiShaderResourceBinding::BufferStore:
+ {
+ const int shaderRegister = mapBinding(bd->binding, sd->nativeResourceBindingMap).first;
+ if (shaderRegister >= 0 && storageBuffer)
+ storageBuffer(sd->stage, bd->u.sbuf, Store, shaderRegister);
+ }
+ break;
+ case QRhiShaderResourceBinding::BufferLoadStore:
+ {
+ const int shaderRegister = mapBinding(bd->binding, sd->nativeResourceBindingMap).first;
+ if (shaderRegister >= 0 && storageBuffer)
+ storageBuffer(sd->stage, bd->u.sbuf, LoadStore, shaderRegister);
+ }
+ break;
+ }
+ }
+ }
+}
+
+bool QD3D12SamplerManager::create(ID3D12Device *device)
+{
+ // This does not need to be per-frame slot, just grab space for MAX_SAMPLERS samplers.
+ if (!shaderVisibleSamplerHeap.create(device,
+ D3D12_DESCRIPTOR_HEAP_TYPE_SAMPLER,
+ MAX_SAMPLERS / QD3D12_FRAMES_IN_FLIGHT))
+ {
+ qWarning("Could not create shader-visible SAMPLER heap");
+ return false;
+ }
+
+ this->device = device;
+ return true;
+}
+
+void QD3D12SamplerManager::destroy()
+{
+ if (device) {
+ shaderVisibleSamplerHeap.destroy();
+ device = nullptr;
+ }
+}
+
+QD3D12Descriptor QD3D12SamplerManager::getShaderVisibleDescriptor(const D3D12_SAMPLER_DESC &desc)
+{
+ auto it = gpuMap.constFind({desc});
+ if (it != gpuMap.cend())
+ return *it;
+
+ QD3D12Descriptor descriptor = shaderVisibleSamplerHeap.heap.get(1);
+ if (descriptor.isValid()) {
+ device->CreateSampler(&desc, descriptor.cpuHandle);
+ gpuMap.insert({desc}, descriptor);
+ } else {
+ qWarning("Out of shader-visible SAMPLER descriptor heap space,"
+ " this should not happen, maximum number of unique samplers is %u",
+ shaderVisibleSamplerHeap.heap.capacity);
+ }
+
+ return descriptor;
+}
+
+bool QD3D12MipmapGenerator::create(QRhiD3D12 *rhiD)
+{
+ this->rhiD = rhiD;
+
+ D3D12_ROOT_PARAMETER1 rootParams[3] = {};
+ D3D12_DESCRIPTOR_RANGE1 descriptorRanges[2] = {};
+
+ // b0
+ rootParams[0].ParameterType = D3D12_ROOT_PARAMETER_TYPE_CBV;
+ rootParams[0].ShaderVisibility = D3D12_SHADER_VISIBILITY_ALL;
+ rootParams[0].Descriptor.Flags = D3D12_ROOT_DESCRIPTOR_FLAG_DATA_STATIC;
+
+ // t0
+ descriptorRanges[0].RangeType = D3D12_DESCRIPTOR_RANGE_TYPE_SRV;
+ descriptorRanges[0].NumDescriptors = 1;
+ descriptorRanges[0].Flags = D3D12_DESCRIPTOR_RANGE_FLAG_DATA_VOLATILE;
+ rootParams[1].ParameterType = D3D12_ROOT_PARAMETER_TYPE_DESCRIPTOR_TABLE;
+ rootParams[1].ShaderVisibility = D3D12_SHADER_VISIBILITY_ALL;
+ rootParams[1].DescriptorTable.NumDescriptorRanges = 1;
+ rootParams[1].DescriptorTable.pDescriptorRanges = &descriptorRanges[0];
+
+ // u0..3
+ descriptorRanges[1].RangeType = D3D12_DESCRIPTOR_RANGE_TYPE_UAV;
+ descriptorRanges[1].NumDescriptors = 4;
+ rootParams[2].ParameterType = D3D12_ROOT_PARAMETER_TYPE_DESCRIPTOR_TABLE;
+ rootParams[2].ShaderVisibility = D3D12_SHADER_VISIBILITY_ALL;
+ rootParams[2].DescriptorTable.NumDescriptorRanges = 1;
+ rootParams[2].DescriptorTable.pDescriptorRanges = &descriptorRanges[1];
+
+ // s0
+ D3D12_STATIC_SAMPLER_DESC samplerDesc = {};
+ samplerDesc.Filter = D3D12_FILTER_MIN_MAG_MIP_LINEAR;
+ samplerDesc.AddressU = D3D12_TEXTURE_ADDRESS_MODE_CLAMP;
+ samplerDesc.AddressV = D3D12_TEXTURE_ADDRESS_MODE_CLAMP;
+ samplerDesc.AddressW = D3D12_TEXTURE_ADDRESS_MODE_CLAMP;
+ samplerDesc.MaxLOD = 10000.0f;
+ samplerDesc.ShaderVisibility = D3D12_SHADER_VISIBILITY_ALL;
+
+ D3D12_VERSIONED_ROOT_SIGNATURE_DESC rsDesc = {};
+ rsDesc.Version = D3D_ROOT_SIGNATURE_VERSION_1_1;
+ rsDesc.Desc_1_1.NumParameters = 3;
+ rsDesc.Desc_1_1.pParameters = rootParams;
+ rsDesc.Desc_1_1.NumStaticSamplers = 1;
+ rsDesc.Desc_1_1.pStaticSamplers = &samplerDesc;
+
+ ID3DBlob *signature = nullptr;
+ HRESULT hr = D3D12SerializeVersionedRootSignature(&rsDesc, &signature, nullptr);
+ if (FAILED(hr)) {
+ qWarning("Failed to serialize root signature: %s", qPrintable(QSystemError::windowsComString(hr)));
+ return false;
+ }
+ ID3D12RootSignature *rootSig = nullptr;
+ hr = rhiD->dev->CreateRootSignature(0,
+ signature->GetBufferPointer(),
+ signature->GetBufferSize(),
+ __uuidof(ID3D12RootSignature),
+ reinterpret_cast<void **>(&rootSig));
+ signature->Release();
+ if (FAILED(hr)) {
+ qWarning("Failed to create root signature: %s",
+ qPrintable(QSystemError::windowsComString(hr)));
+ return false;
+ }
+
+ rootSigHandle = QD3D12RootSignature::addToPool(&rhiD->rootSignaturePool, rootSig);
+
+ D3D12_COMPUTE_PIPELINE_STATE_DESC psoDesc = {};
+ psoDesc.pRootSignature = rootSig;
+ psoDesc.CS.pShaderBytecode = g_csMipmap;
+ psoDesc.CS.BytecodeLength = sizeof(g_csMipmap);
+ ID3D12PipelineState *pso = nullptr;
+ hr = rhiD->dev->CreateComputePipelineState(&psoDesc,
+ __uuidof(ID3D12PipelineState),
+ reinterpret_cast<void **>(&pso));
+ if (FAILED(hr)) {
+ qWarning("Failed to create compute pipeline state: %s",
+ qPrintable(QSystemError::windowsComString(hr)));
+ rhiD->rootSignaturePool.remove(rootSigHandle);
+ rootSigHandle = {};
+ return false;
+ }
+
+ pipelineHandle = QD3D12Pipeline::addToPool(&rhiD->pipelinePool, QD3D12Pipeline::Compute, pso);
+
+ return true;
+}
+
+void QD3D12MipmapGenerator::destroy()
+{
+ rhiD->pipelinePool.remove(pipelineHandle);
+ pipelineHandle = {};
+ rhiD->rootSignaturePool.remove(rootSigHandle);
+ rootSigHandle = {};
+}
+
+void QD3D12MipmapGenerator::generate(QD3D12CommandBuffer *cbD, const QD3D12ObjectHandle &textureHandle)
+{
+ QD3D12Pipeline *pipeline = rhiD->pipelinePool.lookupRef(pipelineHandle);
+ if (!pipeline)
+ return;
+ QD3D12RootSignature *rootSig = rhiD->rootSignaturePool.lookupRef(rootSigHandle);
+ if (!rootSig)
+ return;
+ QD3D12Resource *res = rhiD->resourcePool.lookupRef(textureHandle);
+ if (!res)
+ return;
+
+ const quint32 mipLevelCount = res->desc.MipLevels;
+ if (mipLevelCount < 2)
+ return;
+
+ if (res->desc.SampleDesc.Count > 1) {
+ qWarning("Cannot generate mipmaps for MSAA texture");
+ return;
+ }
+
+ const bool is1D = res->desc.Dimension == D3D12_RESOURCE_DIMENSION_TEXTURE1D;
+ if (is1D) {
+ qWarning("Cannot generate mipmaps for 1D texture");
+ return;
+ }
+
+ const bool is3D = res->desc.Dimension == D3D12_RESOURCE_DIMENSION_TEXTURE3D;
+ const bool isCubeOrArray = res->desc.Dimension == D3D12_RESOURCE_DIMENSION_TEXTURE2D
+ && res->desc.DepthOrArraySize > 1;
+ const quint32 layerCount = isCubeOrArray ? res->desc.DepthOrArraySize : 1;
+
+ if (is3D) {
+ // ### needs its own shader and maybe a different solution
+ qWarning("3D texture mipmapping is not implemented for D3D12 atm");
+ return;
+ }
+
+ rhiD->barrierGen.addTransitionBarrier(textureHandle, D3D12_RESOURCE_STATE_UNORDERED_ACCESS);
+ rhiD->barrierGen.enqueueBufferedTransitionBarriers(cbD);
+
+ cbD->cmdList->SetPipelineState(pipeline->pso);
+ cbD->cmdList->SetComputeRootSignature(rootSig->rootSig);
+
+ const quint32 descriptorByteSize = rhiD->shaderVisibleCbvSrvUavHeap.perFrameHeapSlice[rhiD->currentFrameSlot].descriptorByteSize;
+
+ struct CBufData {
+ quint32 srcMipLevel;
+ quint32 numMipLevels;
+ float texelWidth;
+ float texelHeight;
+ };
+
+ const quint32 allocSize = QD3D12StagingArea::allocSizeForArray(sizeof(CBufData), mipLevelCount * layerCount);
+ std::optional<QD3D12StagingArea> ownStagingArea;
+ if (rhiD->smallStagingAreas[rhiD->currentFrameSlot].remainingCapacity() < allocSize) {
+ ownStagingArea = QD3D12StagingArea();
+ if (!ownStagingArea->create(rhiD, allocSize, D3D12_HEAP_TYPE_UPLOAD)) {
+ qWarning("Could not create staging area for mipmap generation");
+ return;
+ }
+ }
+ QD3D12StagingArea *workArea = ownStagingArea.has_value()
+ ? &ownStagingArea.value()
+ : &rhiD->smallStagingAreas[rhiD->currentFrameSlot];
+
+ bool gotNewHeap = false;
+ if (!rhiD->ensureShaderVisibleDescriptorHeapCapacity(&rhiD->shaderVisibleCbvSrvUavHeap,
+ D3D12_DESCRIPTOR_HEAP_TYPE_CBV_SRV_UAV,
+ rhiD->currentFrameSlot,
+ (1 + 4) * mipLevelCount * layerCount,
+ &gotNewHeap))
+ {
+ qWarning("Could not ensure enough space in descriptor heap for mipmap generation");
+ return;
+ }
+ if (gotNewHeap)
+ rhiD->bindShaderVisibleHeaps(cbD);
+
+ for (quint32 layer = 0; layer < layerCount; ++layer) {
+ for (quint32 level = 0; level < mipLevelCount ;) {
+ UINT subresource = calcSubresource(level, layer, res->desc.MipLevels);
+ rhiD->barrierGen.enqueueSubresourceTransitionBarrier(cbD, textureHandle, subresource,
+ D3D12_RESOURCE_STATE_UNORDERED_ACCESS,
+ D3D12_RESOURCE_STATE_NON_PIXEL_SHADER_RESOURCE);
+
+ quint32 levelPlusOneMipWidth = res->desc.Width >> (level + 1);
+ quint32 levelPlusOneMipHeight = res->desc.Height >> (level + 1);
+ const quint32 dw = levelPlusOneMipWidth == 1 ? levelPlusOneMipHeight : levelPlusOneMipWidth;
+ const quint32 dh = levelPlusOneMipHeight == 1 ? levelPlusOneMipWidth : levelPlusOneMipHeight;
+ // number of times the size can be halved while still resulting in an even dimension
+ const quint32 additionalMips = qCountTrailingZeroBits(dw | dh);
+ const quint32 numGenMips = qMin(1u + qMin(3u, additionalMips), res->desc.MipLevels - level);
+ levelPlusOneMipWidth = qMax(1u, levelPlusOneMipWidth);
+ levelPlusOneMipHeight = qMax(1u, levelPlusOneMipHeight);
+
+ CBufData cbufData = {
+ level,
+ numGenMips,
+ 1.0f / float(levelPlusOneMipWidth),
+ 1.0f / float(levelPlusOneMipHeight)
+ };
+
+ QD3D12StagingArea::Allocation cbuf = workArea->get(sizeof(cbufData));
+ memcpy(cbuf.p, &cbufData, sizeof(cbufData));
+ cbD->cmdList->SetComputeRootConstantBufferView(0, cbuf.gpuAddr);
+
+ QD3D12Descriptor srv = rhiD->shaderVisibleCbvSrvUavHeap.perFrameHeapSlice[rhiD->currentFrameSlot].get(1);
+ D3D12_SHADER_RESOURCE_VIEW_DESC srvDesc = {};
+ srvDesc.Format = res->desc.Format;
+ srvDesc.Shader4ComponentMapping = D3D12_DEFAULT_SHADER_4_COMPONENT_MAPPING;
+ if (isCubeOrArray) {
+ srvDesc.ViewDimension = D3D12_SRV_DIMENSION_TEXTURE2DARRAY;
+ srvDesc.Texture2DArray.MostDetailedMip = level;
+ srvDesc.Texture2DArray.MipLevels = 1;
+ srvDesc.Texture2DArray.FirstArraySlice = layer;
+ srvDesc.Texture2DArray.ArraySize = 1;
+ } else if (is3D) {
+ srvDesc.ViewDimension = D3D12_SRV_DIMENSION_TEXTURE3D;
+ srvDesc.Texture3D.MostDetailedMip = level;
+ srvDesc.Texture3D.MipLevels = 1;
+ } else {
+ srvDesc.ViewDimension = D3D12_SRV_DIMENSION_TEXTURE2D;
+ srvDesc.Texture2D.MostDetailedMip = level;
+ srvDesc.Texture2D.MipLevels = 1;
+ }
+ rhiD->dev->CreateShaderResourceView(res->resource, &srvDesc, srv.cpuHandle);
+ cbD->cmdList->SetComputeRootDescriptorTable(1, srv.gpuHandle);
+
+ QD3D12Descriptor uavStart = rhiD->shaderVisibleCbvSrvUavHeap.perFrameHeapSlice[rhiD->currentFrameSlot].get(4);
+ D3D12_CPU_DESCRIPTOR_HANDLE uavCpuHandle = uavStart.cpuHandle;
+ // if level is N, then need UAVs for levels N+1, ..., N+4
+ for (quint32 uavIdx = 0; uavIdx < 4; ++uavIdx) {
+ const quint32 uavMipLevel = qMin(level + 1u + uavIdx, res->desc.MipLevels - 1u);
+ D3D12_UNORDERED_ACCESS_VIEW_DESC uavDesc = {};
+ uavDesc.Format = res->desc.Format;
+ if (isCubeOrArray) {
+ uavDesc.ViewDimension = D3D12_UAV_DIMENSION_TEXTURE2DARRAY;
+ uavDesc.Texture2DArray.MipSlice = uavMipLevel;
+ uavDesc.Texture2DArray.FirstArraySlice = layer;
+ uavDesc.Texture2DArray.ArraySize = 1;
+ } else if (is3D) {
+ uavDesc.ViewDimension = D3D12_UAV_DIMENSION_TEXTURE3D;
+ uavDesc.Texture3D.MipSlice = uavMipLevel;
+ uavDesc.Texture3D.FirstWSlice = 0; // depth etc. not implemented yet
+ uavDesc.Texture3D.WSize = 1;
+ } else {
+ uavDesc.ViewDimension = D3D12_UAV_DIMENSION_TEXTURE2D;
+ uavDesc.Texture2D.MipSlice = uavMipLevel;
+ }
+ rhiD->dev->CreateUnorderedAccessView(res->resource, nullptr, &uavDesc, uavCpuHandle);
+ uavCpuHandle.ptr += descriptorByteSize;
+ }
+ cbD->cmdList->SetComputeRootDescriptorTable(2, uavStart.gpuHandle);
+
+ cbD->cmdList->Dispatch(levelPlusOneMipWidth, levelPlusOneMipHeight, 1);
+
+ rhiD->barrierGen.enqueueUavBarrier(cbD, textureHandle);
+ rhiD->barrierGen.enqueueSubresourceTransitionBarrier(cbD, textureHandle, subresource,
+ D3D12_RESOURCE_STATE_NON_PIXEL_SHADER_RESOURCE,
+ D3D12_RESOURCE_STATE_UNORDERED_ACCESS);
+
+ level += numGenMips;
+ }
+ }
+
+ if (ownStagingArea.has_value())
+ ownStagingArea->destroyWithDeferredRelease(&rhiD->releaseQueue);
+}
+
+bool QD3D12MemoryAllocator::create(ID3D12Device *device, IDXGIAdapter1 *adapter)
+{
+ this->device = device;
+
+ // We can function with and without D3D12MA: CreateCommittedResource is
+ // just fine for our purposes and not any complicated API-wise; the memory
+ // allocator is interesting for efficiency mainly since it can suballocate
+ // instead of making everything a committed resource allocation.
+
+ static bool disableMA = qEnvironmentVariableIntValue("QT_D3D_NO_SUBALLOC");
+ if (disableMA)
+ return true;
+
+ DXGI_ADAPTER_DESC1 desc;
+ adapter->GetDesc1(&desc);
+ if (desc.Flags & DXGI_ADAPTER_FLAG_SOFTWARE)
+ return true;
+
+ D3D12MA::ALLOCATOR_DESC allocatorDesc = {};
+ allocatorDesc.pDevice = device;
+ allocatorDesc.pAdapter = adapter;
+ // A QRhi is supposed to be used from one single thread only. Disable
+ // the allocator's own mutexes. This may give a performance boost.
+ allocatorDesc.Flags = D3D12MA::ALLOCATOR_FLAG_SINGLETHREADED;
+ HRESULT hr = D3D12MA::CreateAllocator(&allocatorDesc, &allocator);
+ if (FAILED(hr)) {
+ qWarning("Failed to initialize D3D12 Memory Allocator: %s",
+ qPrintable(QSystemError::windowsComString(hr)));
+ return false;
+ }
+ return true;
+}
+
+void QD3D12MemoryAllocator::destroy()
+{
+ if (allocator) {
+ allocator->Release();
+ allocator = nullptr;
+ }
+}
+
+HRESULT QD3D12MemoryAllocator::createResource(D3D12_HEAP_TYPE heapType,
+ const D3D12_RESOURCE_DESC *resourceDesc,
+ D3D12_RESOURCE_STATES initialState,
+ const D3D12_CLEAR_VALUE *optimizedClearValue,
+ D3D12MA::Allocation **maybeAllocation,
+ REFIID riidResource,
+ void **ppvResource)
+{
+ if (allocator) {
+ D3D12MA::ALLOCATION_DESC allocDesc = {};
+ allocDesc.HeapType = heapType;
+ return allocator->CreateResource(&allocDesc,
+ resourceDesc,
+ initialState,
+ optimizedClearValue,
+ maybeAllocation,
+ riidResource,
+ ppvResource);
+ } else {
+ *maybeAllocation = nullptr;
+ D3D12_HEAP_PROPERTIES heapProps = {};
+ heapProps.Type = heapType;
+ return device->CreateCommittedResource(&heapProps,
+ D3D12_HEAP_FLAG_NONE,
+ resourceDesc,
+ initialState,
+ optimizedClearValue,
+ riidResource,
+ ppvResource);
+ }
+}
+
+void QD3D12MemoryAllocator::getBudget(D3D12MA::Budget *localBudget, D3D12MA::Budget *nonLocalBudget)
+{
+ if (allocator) {
+ allocator->GetBudget(localBudget, nonLocalBudget);
+ } else {
+ *localBudget = {};
+ *nonLocalBudget = {};
+ }
+}
+
+void QRhiD3D12::waitGpu()
+{
+ fullFenceCounter += 1u;
+ if (SUCCEEDED(cmdQueue->Signal(fullFence, fullFenceCounter))) {
+ if (SUCCEEDED(fullFence->SetEventOnCompletion(fullFenceCounter, fullFenceEvent)))
+ WaitForSingleObject(fullFenceEvent, INFINITE);
+ }
+}
+
+DXGI_SAMPLE_DESC QRhiD3D12::effectiveSampleDesc(int sampleCount, DXGI_FORMAT format) const
+{
+ DXGI_SAMPLE_DESC desc;
+ desc.Count = 1;
+ desc.Quality = 0;
+
+ const int s = effectiveSampleCount(sampleCount);
+
+ if (s > 1) {
+ D3D12_FEATURE_DATA_MULTISAMPLE_QUALITY_LEVELS msaaInfo = {};
+ msaaInfo.Format = format;
+ msaaInfo.SampleCount = UINT(s);
+ if (SUCCEEDED(dev->CheckFeatureSupport(D3D12_FEATURE_MULTISAMPLE_QUALITY_LEVELS, &msaaInfo, sizeof(msaaInfo)))) {
+ if (msaaInfo.NumQualityLevels > 0) {
+ desc.Count = UINT(s);
+ desc.Quality = msaaInfo.NumQualityLevels - 1;
+ } else {
+ qWarning("No quality levels for multisampling with sample count %d", s);
+ }
+ }
+ }
+
+ return desc;
+}
+
+bool QRhiD3D12::startCommandListForCurrentFrameSlot(ID3D12GraphicsCommandList1 **cmdList)
+{
+ ID3D12CommandAllocator *cmdAlloc = cmdAllocators[currentFrameSlot];
+ if (!*cmdList) {
+ HRESULT hr = dev->CreateCommandList(0,
+ D3D12_COMMAND_LIST_TYPE_DIRECT,
+ cmdAlloc,
+ nullptr,
+ __uuidof(ID3D12GraphicsCommandList1),
+ reinterpret_cast<void **>(cmdList));
+ if (FAILED(hr)) {
+ qWarning("Failed to create command list: %s", qPrintable(QSystemError::windowsComString(hr)));
+ return false;
+ }
+ } else {
+ HRESULT hr = (*cmdList)->Reset(cmdAlloc, nullptr);
+ if (FAILED(hr)) {
+ qWarning("Failed to reset command list: %s", qPrintable(QSystemError::windowsComString(hr)));
+ return false;
+ }
+ }
+ return true;
+}
+
+static inline QRhiTexture::Format swapchainReadbackTextureFormat(DXGI_FORMAT format, QRhiTexture::Flags *flags)
+{
+ switch (format) {
+ case DXGI_FORMAT_R8G8B8A8_UNORM:
+ return QRhiTexture::RGBA8;
+ case DXGI_FORMAT_R8G8B8A8_UNORM_SRGB:
+ if (flags)
+ (*flags) |= QRhiTexture::sRGB;
+ return QRhiTexture::RGBA8;
+ case DXGI_FORMAT_B8G8R8A8_UNORM:
+ return QRhiTexture::BGRA8;
+ case DXGI_FORMAT_B8G8R8A8_UNORM_SRGB:
+ if (flags)
+ (*flags) |= QRhiTexture::sRGB;
+ return QRhiTexture::BGRA8;
+ case DXGI_FORMAT_R16G16B16A16_FLOAT:
+ return QRhiTexture::RGBA16F;
+ case DXGI_FORMAT_R32G32B32A32_FLOAT:
+ return QRhiTexture::RGBA32F;
+ case DXGI_FORMAT_R10G10B10A2_UNORM:
+ return QRhiTexture::RGB10A2;
+ default:
+ qWarning("DXGI_FORMAT %d cannot be read back", format);
+ break;
+ }
+ return QRhiTexture::UnknownFormat;
+}
+
+void QRhiD3D12::enqueueResourceUpdates(QD3D12CommandBuffer *cbD, QRhiResourceUpdateBatch *resourceUpdates)
+{
+ QRhiResourceUpdateBatchPrivate *ud = QRhiResourceUpdateBatchPrivate::get(resourceUpdates);
+
+ for (int opIdx = 0; opIdx < ud->activeBufferOpCount; ++opIdx) {
+ const QRhiResourceUpdateBatchPrivate::BufferOp &u(ud->bufferOps[opIdx]);
+ if (u.type == QRhiResourceUpdateBatchPrivate::BufferOp::DynamicUpdate) {
+ QD3D12Buffer *bufD = QRHI_RES(QD3D12Buffer, u.buf);
+ Q_ASSERT(bufD->m_type == QRhiBuffer::Dynamic);
+ for (int i = 0; i < QD3D12_FRAMES_IN_FLIGHT; ++i) {
+ if (u.offset == 0 && u.data.size() == bufD->m_size)
+ bufD->pendingHostWrites[i].clear();
+ bufD->pendingHostWrites[i].append({ u.offset, u.data });
+ }
+ } else if (u.type == QRhiResourceUpdateBatchPrivate::BufferOp::StaticUpload) {
+ QD3D12Buffer *bufD = QRHI_RES(QD3D12Buffer, u.buf);
+ Q_ASSERT(bufD->m_type != QRhiBuffer::Dynamic);
+ Q_ASSERT(u.offset + u.data.size() <= bufD->m_size);
+
+ // The general approach to staging upload data is to first try
+ // using the per-frame "small" staging area, which is a very simple
+ // linear allocator; if that's not big enough then create a
+ // dedicated StagingArea and then deferred-release it to make sure
+ // if stays alive while the frame is possibly still in flight.
+
+ QD3D12StagingArea::Allocation stagingAlloc;
+ const quint32 allocSize = QD3D12StagingArea::allocSizeForArray(bufD->m_size, 1);
+ if (smallStagingAreas[currentFrameSlot].remainingCapacity() >= allocSize)
+ stagingAlloc = smallStagingAreas[currentFrameSlot].get(bufD->m_size);
+
+ std::optional<QD3D12StagingArea> ownStagingArea;
+ if (!stagingAlloc.isValid()) {
+ ownStagingArea = QD3D12StagingArea();
+ if (!ownStagingArea->create(this, allocSize, D3D12_HEAP_TYPE_UPLOAD))
+ continue;
+ stagingAlloc = ownStagingArea->get(allocSize);
+ if (!stagingAlloc.isValid()) {
+ ownStagingArea->destroy();
+ continue;
+ }
+ }
+
+ memcpy(stagingAlloc.p + u.offset, u.data.constData(), u.data.size());
+
+ barrierGen.addTransitionBarrier(bufD->handles[0], D3D12_RESOURCE_STATE_COPY_DEST);
+ barrierGen.enqueueBufferedTransitionBarriers(cbD);
+
+ if (QD3D12Resource *res = resourcePool.lookupRef(bufD->handles[0])) {
+ cbD->cmdList->CopyBufferRegion(res->resource,
+ u.offset,
+ stagingAlloc.buffer,
+ stagingAlloc.bufferOffset + u.offset,
+ u.data.size());
+ }
+
+ if (ownStagingArea.has_value())
+ ownStagingArea->destroyWithDeferredRelease(&releaseQueue);
+ } else if (u.type == QRhiResourceUpdateBatchPrivate::BufferOp::Read) {
+ QD3D12Buffer *bufD = QRHI_RES(QD3D12Buffer, u.buf);
+ if (bufD->m_type == QRhiBuffer::Dynamic) {
+ bufD->executeHostWritesForFrameSlot(currentFrameSlot);
+ if (QD3D12Resource *res = resourcePool.lookupRef(bufD->handles[currentFrameSlot])) {
+ Q_ASSERT(res->cpuMapPtr);
+ u.result->data.resize(u.readSize);
+ memcpy(u.result->data.data(), reinterpret_cast<char *>(res->cpuMapPtr) + u.offset, u.readSize);
+ }
+ if (u.result->completed)
+ u.result->completed();
+ } else {
+ QD3D12Readback readback;
+ readback.frameSlot = currentFrameSlot;
+ readback.result = u.result;
+ readback.byteSize = u.readSize;
+ const quint32 allocSize = aligned(u.readSize, QD3D12StagingArea::ALIGNMENT);
+ if (!readback.staging.create(this, allocSize, D3D12_HEAP_TYPE_READBACK)) {
+ if (u.result->completed)
+ u.result->completed();
+ continue;
+ }
+ QD3D12StagingArea::Allocation stagingAlloc = readback.staging.get(u.readSize);
+ if (!stagingAlloc.isValid()) {
+ readback.staging.destroy();
+ if (u.result->completed)
+ u.result->completed();
+ continue;
+ }
+ Q_ASSERT(stagingAlloc.bufferOffset == 0);
+ barrierGen.addTransitionBarrier(bufD->handles[0], D3D12_RESOURCE_STATE_COPY_SOURCE);
+ barrierGen.enqueueBufferedTransitionBarriers(cbD);
+ if (QD3D12Resource *res = resourcePool.lookupRef(bufD->handles[0])) {
+ cbD->cmdList->CopyBufferRegion(stagingAlloc.buffer, 0, res->resource, u.offset, u.readSize);
+ activeReadbacks.append(readback);
+ } else {
+ readback.staging.destroy();
+ if (u.result->completed)
+ u.result->completed();
+ }
+ }
+ }
+ }
+
+ for (int opIdx = 0; opIdx < ud->activeTextureOpCount; ++opIdx) {
+ const QRhiResourceUpdateBatchPrivate::TextureOp &u(ud->textureOps[opIdx]);
+ if (u.type == QRhiResourceUpdateBatchPrivate::TextureOp::Upload) {
+ QD3D12Texture *texD = QRHI_RES(QD3D12Texture, u.dst);
+ const bool is3D = texD->m_flags.testFlag(QRhiTexture::ThreeDimensional);
+ QD3D12Resource *res = resourcePool.lookupRef(texD->handle);
+ if (!res)
+ continue;
+ barrierGen.addTransitionBarrier(texD->handle, D3D12_RESOURCE_STATE_COPY_DEST);
+ barrierGen.enqueueBufferedTransitionBarriers(cbD);
+ for (int layer = 0, maxLayer = u.subresDesc.size(); layer < maxLayer; ++layer) {
+ for (int level = 0; level < QRhi::MAX_MIP_LEVELS; ++level) {
+ for (const QRhiTextureSubresourceUploadDescription &subresDesc : std::as_const(u.subresDesc[layer][level])) {
+ D3D12_SUBRESOURCE_FOOTPRINT footprint = {};
+ footprint.Format = res->desc.Format;
+ footprint.Depth = 1;
+ quint32 totalBytes = 0;
+
+ const QSize subresSize = subresDesc.sourceSize().isEmpty() ? q->sizeForMipLevel(level, texD->m_pixelSize)
+ : subresDesc.sourceSize();
+ const QPoint srcPos = subresDesc.sourceTopLeft();
+ QPoint dstPos = subresDesc.destinationTopLeft();
+
+ if (!subresDesc.image().isNull()) {
+ const QImage img = subresDesc.image();
+ const int bpl = img.bytesPerLine();
+ footprint.RowPitch = aligned<UINT>(bpl, D3D12_TEXTURE_DATA_PITCH_ALIGNMENT);
+ totalBytes = footprint.RowPitch * img.height();
+ } else if (!subresDesc.data().isEmpty() && isCompressedFormat(texD->m_format)) {
+ QSize blockDim;
+ quint32 bpl = 0;
+ compressedFormatInfo(texD->m_format, subresSize, &bpl, nullptr, &blockDim);
+ footprint.RowPitch = aligned<UINT>(bpl, D3D12_TEXTURE_DATA_PITCH_ALIGNMENT);
+ const int rowCount = aligned(subresSize.height(), blockDim.height()) / blockDim.height();
+ totalBytes = footprint.RowPitch * rowCount;
+ } else if (!subresDesc.data().isEmpty()) {
+ quint32 bpl = 0;
+ if (subresDesc.dataStride())
+ bpl = subresDesc.dataStride();
+ else
+ textureFormatInfo(texD->m_format, subresSize, &bpl, nullptr, nullptr);
+ footprint.RowPitch = aligned<UINT>(bpl, D3D12_TEXTURE_DATA_PITCH_ALIGNMENT);
+ totalBytes = footprint.RowPitch * subresSize.height();
+ } else {
+ qWarning("Invalid texture upload for %p layer=%d mip=%d", texD, layer, level);
+ continue;
+ }
+
+ const quint32 allocSize = QD3D12StagingArea::allocSizeForArray(totalBytes, 1);
+ QD3D12StagingArea::Allocation stagingAlloc;
+ if (smallStagingAreas[currentFrameSlot].remainingCapacity() >= allocSize)
+ stagingAlloc = smallStagingAreas[currentFrameSlot].get(allocSize);
+
+ std::optional<QD3D12StagingArea> ownStagingArea;
+ if (!stagingAlloc.isValid()) {
+ ownStagingArea = QD3D12StagingArea();
+ if (!ownStagingArea->create(this, allocSize, D3D12_HEAP_TYPE_UPLOAD))
+ continue;
+ stagingAlloc = ownStagingArea->get(allocSize);
+ if (!stagingAlloc.isValid()) {
+ ownStagingArea->destroy();
+ continue;
+ }
+ }
+
+ D3D12_TEXTURE_COPY_LOCATION dst;
+ dst.pResource = res->resource;
+ dst.Type = D3D12_TEXTURE_COPY_TYPE_SUBRESOURCE_INDEX;
+ dst.SubresourceIndex = calcSubresource(UINT(level), is3D ? 0u : UINT(layer), texD->mipLevelCount);
+ D3D12_TEXTURE_COPY_LOCATION src;
+ src.pResource = stagingAlloc.buffer;
+ src.Type = D3D12_TEXTURE_COPY_TYPE_PLACED_FOOTPRINT;
+ src.PlacedFootprint.Offset = stagingAlloc.bufferOffset;
+
+ D3D12_BOX srcBox; // back, right, bottom are exclusive
+
+ if (!subresDesc.image().isNull()) {
+ const QImage img = subresDesc.image();
+ const int bpc = qMax(1, img.depth() / 8);
+ const int bpl = img.bytesPerLine();
+
+ QSize size = subresDesc.sourceSize().isEmpty() ? img.size() : subresDesc.sourceSize();
+ size.setWidth(qMin(size.width(), img.width() - srcPos.x()));
+ size.setHeight(qMin(size.height(), img.height() - srcPos.y()));
+
+ footprint.Width = size.width();
+ footprint.Height = size.height();
+
+ srcBox.left = 0;
+ srcBox.top = 0;
+ srcBox.right = UINT(size.width());
+ srcBox.bottom = UINT(size.height());
+ srcBox.front = 0;
+ srcBox.back = 1;
+
+ const uchar *imgPtr = img.constBits();
+ const quint32 lineBytes = size.width() * bpc;
+ for (int y = 0, h = size.height(); y < h; ++y) {
+ memcpy(stagingAlloc.p + y * footprint.RowPitch,
+ imgPtr + srcPos.x() * bpc + (y + srcPos.y()) * bpl,
+ lineBytes);
+ }
+ } else if (!subresDesc.data().isEmpty() && isCompressedFormat(texD->m_format)) {
+ QSize blockDim;
+ quint32 bpl = 0;
+ compressedFormatInfo(texD->m_format, subresSize, &bpl, nullptr, &blockDim);
+ // x and y must be multiples of the block width and height
+ dstPos.setX(aligned(dstPos.x(), blockDim.width()));
+ dstPos.setY(aligned(dstPos.y(), blockDim.height()));
+
+ srcBox.left = 0;
+ srcBox.top = 0;
+ // width and height must be multiples of the block width and height
+ srcBox.right = aligned(subresSize.width(), blockDim.width());
+ srcBox.bottom = aligned(subresSize.height(), blockDim.height());
+
+ srcBox.front = 0;
+ srcBox.back = 1;
+
+ footprint.Width = aligned(subresSize.width(), blockDim.width());
+ footprint.Height = aligned(subresSize.height(), blockDim.height());
+
+ const quint32 copyBytes = qMin(bpl, footprint.RowPitch);
+ const QByteArray imgData = subresDesc.data();
+ const char *imgPtr = imgData.constData();
+ const int rowCount = aligned(subresSize.height(), blockDim.height()) / blockDim.height();
+ for (int y = 0; y < rowCount; ++y)
+ memcpy(stagingAlloc.p + y * footprint.RowPitch, imgPtr + y * bpl, copyBytes);
+ } else if (!subresDesc.data().isEmpty()) {
+ srcBox.left = 0;
+ srcBox.top = 0;
+ srcBox.right = subresSize.width();
+ srcBox.bottom = subresSize.height();
+ srcBox.front = 0;
+ srcBox.back = 1;
+
+ footprint.Width = subresSize.width();
+ footprint.Height = subresSize.height();
+
+ quint32 bpl = 0;
+ if (subresDesc.dataStride())
+ bpl = subresDesc.dataStride();
+ else
+ textureFormatInfo(texD->m_format, subresSize, &bpl, nullptr, nullptr);
+
+ const quint32 copyBytes = qMin(bpl, footprint.RowPitch);
+ const QByteArray data = subresDesc.data();
+ const char *imgPtr = data.constData();
+ for (int y = 0, h = subresSize.height(); y < h; ++y)
+ memcpy(stagingAlloc.p + y * footprint.RowPitch, imgPtr + y * bpl, copyBytes);
+ }
+
+ src.PlacedFootprint.Footprint = footprint;
+
+ cbD->cmdList->CopyTextureRegion(&dst,
+ UINT(dstPos.x()),
+ UINT(dstPos.y()),
+ is3D ? UINT(layer) : 0u,
+ &src,
+ &srcBox);
+
+ if (ownStagingArea.has_value())
+ ownStagingArea->destroyWithDeferredRelease(&releaseQueue);
+ }
+ }
+ }
+ } else if (u.type == QRhiResourceUpdateBatchPrivate::TextureOp::Copy) {
+ Q_ASSERT(u.src && u.dst);
+ QD3D12Texture *srcD = QRHI_RES(QD3D12Texture, u.src);
+ QD3D12Texture *dstD = QRHI_RES(QD3D12Texture, u.dst);
+ const bool srcIs3D = srcD->m_flags.testFlag(QRhiTexture::ThreeDimensional);
+ const bool dstIs3D = dstD->m_flags.testFlag(QRhiTexture::ThreeDimensional);
+ QD3D12Resource *srcRes = resourcePool.lookupRef(srcD->handle);
+ QD3D12Resource *dstRes = resourcePool.lookupRef(dstD->handle);
+ if (!srcRes || !dstRes)
+ continue;
+
+ barrierGen.addTransitionBarrier(srcD->handle, D3D12_RESOURCE_STATE_COPY_SOURCE);
+ barrierGen.addTransitionBarrier(dstD->handle, D3D12_RESOURCE_STATE_COPY_DEST);
+ barrierGen.enqueueBufferedTransitionBarriers(cbD);
+
+ const UINT srcSubresource = calcSubresource(UINT(u.desc.sourceLevel()),
+ srcIs3D ? 0u : UINT(u.desc.sourceLayer()),
+ srcD->mipLevelCount);
+ const UINT dstSubresource = calcSubresource(UINT(u.desc.destinationLevel()),
+ dstIs3D ? 0u : UINT(u.desc.destinationLayer()),
+ dstD->mipLevelCount);
+ const QPoint dp = u.desc.destinationTopLeft();
+ const QSize mipSize = q->sizeForMipLevel(u.desc.sourceLevel(), srcD->m_pixelSize);
+ const QSize copySize = u.desc.pixelSize().isEmpty() ? mipSize : u.desc.pixelSize();
+ const QPoint sp = u.desc.sourceTopLeft();
+
+ D3D12_BOX srcBox;
+ srcBox.left = UINT(sp.x());
+ srcBox.top = UINT(sp.y());
+ srcBox.front = srcIs3D ? UINT(u.desc.sourceLayer()) : 0u;
+ // back, right, bottom are exclusive
+ srcBox.right = srcBox.left + UINT(copySize.width());
+ srcBox.bottom = srcBox.top + UINT(copySize.height());
+ srcBox.back = srcBox.front + 1;
+
+ D3D12_TEXTURE_COPY_LOCATION src;
+ src.pResource = srcRes->resource;
+ src.Type = D3D12_TEXTURE_COPY_TYPE_SUBRESOURCE_INDEX;
+ src.SubresourceIndex = srcSubresource;
+ D3D12_TEXTURE_COPY_LOCATION dst;
+ dst.pResource = dstRes->resource;
+ dst.Type = D3D12_TEXTURE_COPY_TYPE_SUBRESOURCE_INDEX;
+ dst.SubresourceIndex = dstSubresource;
+
+ cbD->cmdList->CopyTextureRegion(&dst,
+ UINT(dp.x()),
+ UINT(dp.y()),
+ dstIs3D ? UINT(u.desc.destinationLayer()) : 0u,
+ &src,
+ &srcBox);
+ } else if (u.type == QRhiResourceUpdateBatchPrivate::TextureOp::Read) {
+ QD3D12Readback readback;
+ readback.frameSlot = currentFrameSlot;
+ readback.result = u.result;
+
+ QD3D12ObjectHandle srcHandle;
+ bool is3D = false;
+ if (u.rb.texture()) {
+ QD3D12Texture *texD = QRHI_RES(QD3D12Texture, u.rb.texture());
+ if (texD->sampleDesc.Count > 1) {
+ qWarning("Multisample texture cannot be read back");
+ continue;
+ }
+ is3D = texD->m_flags.testFlag(QRhiTexture::ThreeDimensional);
+ readback.pixelSize = q->sizeForMipLevel(u.rb.level(), texD->m_pixelSize);
+ readback.format = texD->m_format;
+ srcHandle = texD->handle;
+ } else {
+ Q_ASSERT(currentSwapChain);
+ readback.pixelSize = currentSwapChain->pixelSize;
+ readback.format = swapchainReadbackTextureFormat(currentSwapChain->colorFormat, nullptr);
+ if (readback.format == QRhiTexture::UnknownFormat)
+ continue;
+ srcHandle = currentSwapChain->colorBuffers[currentSwapChain->currentBackBufferIndex];
+ }
+
+ textureFormatInfo(readback.format,
+ readback.pixelSize,
+ &readback.bytesPerLine,
+ &readback.byteSize,
+ nullptr);
+
+ QD3D12Resource *srcRes = resourcePool.lookupRef(srcHandle);
+ if (!srcRes)
+ continue;
+
+ const UINT subresource = calcSubresource(UINT(u.rb.level()),
+ is3D ? 0u : UINT(u.rb.layer()),
+ srcRes->desc.MipLevels);
+ D3D12_PLACED_SUBRESOURCE_FOOTPRINT layout;
+ // totalBytes is what we get from D3D, with the 256 aligned stride,
+ // readback.byteSize is the final result that's not relevant here yet
+ UINT64 totalBytes = 0;
+ dev->GetCopyableFootprints(&srcRes->desc, subresource, 1, 0,
+ &layout, nullptr, nullptr, &totalBytes);
+ readback.stagingRowPitch = layout.Footprint.RowPitch;
+
+ const quint32 allocSize = aligned<quint32>(totalBytes, QD3D12StagingArea::ALIGNMENT);
+ if (!readback.staging.create(this, allocSize, D3D12_HEAP_TYPE_READBACK)) {
+ if (u.result->completed)
+ u.result->completed();
+ continue;
+ }
+ QD3D12StagingArea::Allocation stagingAlloc = readback.staging.get(totalBytes);
+ if (!stagingAlloc.isValid()) {
+ readback.staging.destroy();
+ if (u.result->completed)
+ u.result->completed();
+ continue;
+ }
+ Q_ASSERT(stagingAlloc.bufferOffset == 0);
+
+ barrierGen.addTransitionBarrier(srcHandle, D3D12_RESOURCE_STATE_COPY_SOURCE);
+ barrierGen.enqueueBufferedTransitionBarriers(cbD);
+
+ D3D12_TEXTURE_COPY_LOCATION dst;
+ dst.pResource = stagingAlloc.buffer;
+ dst.Type = D3D12_TEXTURE_COPY_TYPE_PLACED_FOOTPRINT;
+ dst.PlacedFootprint.Offset = 0;
+ dst.PlacedFootprint.Footprint = layout.Footprint;
+
+ D3D12_TEXTURE_COPY_LOCATION src;
+ src.pResource = srcRes->resource;
+ src.Type = D3D12_TEXTURE_COPY_TYPE_SUBRESOURCE_INDEX;
+ src.SubresourceIndex = subresource;
+
+ D3D12_BOX srcBox = {};
+ if (is3D) {
+ srcBox.front = UINT(u.rb.layer());
+ srcBox.back = srcBox.front + 1;
+ srcBox.right = readback.pixelSize.width(); // exclusive
+ srcBox.bottom = readback.pixelSize.height();
+ }
+ cbD->cmdList->CopyTextureRegion(&dst, 0, 0, 0, &src, is3D ? &srcBox : nullptr);
+ activeReadbacks.append(readback);
+ } else if (u.type == QRhiResourceUpdateBatchPrivate::TextureOp::GenMips) {
+ QD3D12Texture *texD = QRHI_RES(QD3D12Texture, u.dst);
+ Q_ASSERT(texD->flags().testFlag(QRhiTexture::UsedWithGenerateMips));
+ mipmapGen.generate(cbD, texD->handle);
+ }
+ }
+
+ ud->free();
+}
+
+void QRhiD3D12::finishActiveReadbacks(bool forced)
+{
+ QVarLengthArray<std::function<void()>, 4> completedCallbacks;
+
+ for (int i = activeReadbacks.size() - 1; i >= 0; --i) {
+ QD3D12Readback &readback(activeReadbacks[i]);
+ if (forced || currentFrameSlot == readback.frameSlot || readback.frameSlot < 0) {
+ readback.result->format = readback.format;
+ readback.result->pixelSize = readback.pixelSize;
+ readback.result->data.resize(int(readback.byteSize));
+
+ if (readback.format != QRhiTexture::UnknownFormat) {
+ quint8 *dstPtr = reinterpret_cast<quint8 *>(readback.result->data.data());
+ const quint8 *srcPtr = readback.staging.mem.p;
+ const quint32 lineSize = qMin(readback.bytesPerLine, readback.stagingRowPitch);
+ for (int y = 0, h = readback.pixelSize.height(); y < h; ++y)
+ memcpy(dstPtr + y * readback.bytesPerLine, srcPtr + y * readback.stagingRowPitch, lineSize);
+ } else {
+ memcpy(readback.result->data.data(), readback.staging.mem.p, readback.byteSize);
+ }
+
+ readback.staging.destroy();
+
+ if (readback.result->completed)
+ completedCallbacks.append(readback.result->completed);
+
+ activeReadbacks.removeLast();
+ }
+ }
+
+ for (auto f : completedCallbacks)
+ f();
+}
+
+bool QRhiD3D12::ensureShaderVisibleDescriptorHeapCapacity(QD3D12ShaderVisibleDescriptorHeap *h,
+ D3D12_DESCRIPTOR_HEAP_TYPE type,
+ int frameSlot,
+ quint32 neededDescriptorCount,
+ bool *gotNew)
+{
+ // Gets a new heap if needed. Note that the capacity we get is clamped
+ // automatically (e.g. to 1 million, or 2048 for samplers), so * 2 does not
+ // mean we can grow indefinitely, then again even using the same size would
+ // work (because we what we are after here is a new heap for the rest of
+ // the commands, not affecting what's already recorded).
+ if (h->perFrameHeapSlice[frameSlot].remainingCapacity() < neededDescriptorCount) {
+ const quint32 newPerFrameSize = qMax(h->perFrameHeapSlice[frameSlot].capacity * 2,
+ neededDescriptorCount);
+ QD3D12ShaderVisibleDescriptorHeap newHeap;
+ if (!newHeap.create(dev, type, newPerFrameSize)) {
+ qWarning("Could not create new shader-visible descriptor heap");
+ return false;
+ }
+ h->destroyWithDeferredRelease(&releaseQueue);
+ *h = newHeap;
+ *gotNew = true;
+ }
+ return true;
+}
+
+void QRhiD3D12::bindShaderVisibleHeaps(QD3D12CommandBuffer *cbD)
+{
+ ID3D12DescriptorHeap *heaps[] = {
+ shaderVisibleCbvSrvUavHeap.heap.heap,
+ samplerMgr.shaderVisibleSamplerHeap.heap.heap
+ };
+ cbD->cmdList->SetDescriptorHeaps(2, heaps);
+}
+
+QD3D12Buffer::QD3D12Buffer(QRhiImplementation *rhi, Type type, UsageFlags usage, quint32 size)
+ : QRhiBuffer(rhi, type, usage, size)
+{
+}
+
+QD3D12Buffer::~QD3D12Buffer()
+{
+ destroy();
+}
+
+void QD3D12Buffer::destroy()
+{
+ if (handles[0].isNull())
+ return;
+
+ QRHI_RES_RHI(QRhiD3D12);
+
+ // destroy() implementations, unlike other functions, are expected to test
+ // for m_rhi (rhiD) being null, to allow surviving in case one attempts to
+ // destroy a (leaked) resource after the QRhi.
+ //
+ // If there is no QRhi anymore, we do not deferred-release but that's fine
+ // since the QRhi already released everything that was in the resourcePool.
+
+ for (int i = 0; i < QD3D12_FRAMES_IN_FLIGHT; ++i) {
+ if (rhiD)
+ rhiD->releaseQueue.deferredReleaseResource(handles[i]);
+ handles[i] = {};
+ pendingHostWrites[i].clear();
+ }
+
+ if (rhiD)
+ rhiD->unregisterResource(this);
+}
+
+bool QD3D12Buffer::create()
+{
+ if (!handles[0].isNull())
+ destroy();
+
+ if (m_usage.testFlag(QRhiBuffer::UniformBuffer) && m_type != Dynamic) {
+ qWarning("UniformBuffer must always be Dynamic");
+ return false;
+ }
+
+ if (m_usage.testFlag(QRhiBuffer::StorageBuffer) && m_type == Dynamic) {
+ qWarning("StorageBuffer cannot be combined with Dynamic");
+ return false;
+ }
+
+ const quint32 nonZeroSize = m_size <= 0 ? 256 : m_size;
+ const quint32 roundedSize = aligned(nonZeroSize, m_usage.testFlag(QRhiBuffer::UniformBuffer) ? 256u : 4u);
+
+ UINT resourceFlags = D3D12_RESOURCE_FLAG_NONE;
+ if (m_usage.testFlag(QRhiBuffer::StorageBuffer))
+ resourceFlags |= D3D12_RESOURCE_FLAG_ALLOW_UNORDERED_ACCESS;
+
+ QRHI_RES_RHI(QRhiD3D12);
+ HRESULT hr = 0;
+ for (int i = 0; i < QD3D12_FRAMES_IN_FLIGHT; ++i) {
+ if (i == 0 || m_type == Dynamic) {
+ D3D12_RESOURCE_DESC resourceDesc = {};
+ resourceDesc.Dimension = D3D12_RESOURCE_DIMENSION_BUFFER;
+ resourceDesc.Width = roundedSize;
+ resourceDesc.Height = 1;
+ resourceDesc.DepthOrArraySize = 1;
+ resourceDesc.MipLevels = 1;
+ resourceDesc.Format = DXGI_FORMAT_UNKNOWN;
+ resourceDesc.SampleDesc = { 1, 0 };
+ resourceDesc.Layout = D3D12_TEXTURE_LAYOUT_ROW_MAJOR;
+ resourceDesc.Flags = D3D12_RESOURCE_FLAGS(resourceFlags);
+ ID3D12Resource *resource = nullptr;
+ D3D12MA::Allocation *allocation = nullptr;
+ // Dynamic == host (CPU) visible
+ D3D12_HEAP_TYPE heapType = m_type == Dynamic
+ ? D3D12_HEAP_TYPE_UPLOAD
+ : D3D12_HEAP_TYPE_DEFAULT;
+ D3D12_RESOURCE_STATES resourceState = m_type == Dynamic
+ ? D3D12_RESOURCE_STATE_GENERIC_READ
+ : D3D12_RESOURCE_STATE_COMMON;
+ hr = rhiD->vma.createResource(heapType,
+ &resourceDesc,
+ resourceState,
+ nullptr,
+ &allocation,
+ __uuidof(resource),
+ reinterpret_cast<void **>(&resource));
+ if (FAILED(hr))
+ break;
+ if (!m_objectName.isEmpty()) {
+ QString decoratedName = QString::fromUtf8(m_objectName);
+ if (m_type == Dynamic) {
+ decoratedName += QLatin1Char('/');
+ decoratedName += QString::number(i);
+ }
+ resource->SetName(reinterpret_cast<LPCWSTR>(decoratedName.utf16()));
+ }
+ void *cpuMemPtr = nullptr;
+ if (m_type == Dynamic) {
+ // will be mapped for ever on the CPU, this makes future host write operations very simple
+ hr = resource->Map(0, nullptr, &cpuMemPtr);
+ if (FAILED(hr)) {
+ qWarning("Map() failed to dynamic buffer");
+ resource->Release();
+ if (allocation)
+ allocation->Release();
+ break;
+ }
+ }
+ handles[i] = QD3D12Resource::addToPool(&rhiD->resourcePool,
+ resource,
+ resourceState,
+ allocation,
+ cpuMemPtr);
+ }
+ }
+ if (FAILED(hr)) {
+ qWarning("Failed to create buffer: '%s' Type was %d, size was %u, using D3D12MA was %d.",
+ qPrintable(QSystemError::windowsComString(hr)),
+ int(m_type),
+ roundedSize,
+ int(rhiD->vma.isUsingD3D12MA()));
+ return false;
+ }
+
+ rhiD->registerResource(this);
+ return true;
+}
+
+QRhiBuffer::NativeBuffer QD3D12Buffer::nativeBuffer()
+{
+ NativeBuffer b;
+ Q_ASSERT(sizeof(b.objects) / sizeof(b.objects[0]) >= size_t(QD3D12_FRAMES_IN_FLIGHT));
+ QRHI_RES_RHI(QRhiD3D12);
+ if (m_type == Dynamic) {
+ for (int i = 0; i < QD3D12_FRAMES_IN_FLIGHT; ++i) {
+ executeHostWritesForFrameSlot(i);
+ if (QD3D12Resource *res = rhiD->resourcePool.lookupRef(handles[i]))
+ b.objects[i] = res->resource;
+ else
+ b.objects[i] = nullptr;
+ }
+ b.slotCount = QD3D12_FRAMES_IN_FLIGHT;
+ return b;
+ }
+ if (QD3D12Resource *res = rhiD->resourcePool.lookupRef(handles[0]))
+ b.objects[0] = res->resource;
+ else
+ b.objects[0] = nullptr;
+ b.slotCount = 1;
+ return b;
+}
+
+char *QD3D12Buffer::beginFullDynamicBufferUpdateForCurrentFrame()
+{
+ // Shortcut the entire buffer update mechanism and allow the client to do
+ // the host writes directly to the buffer. This will lead to unexpected
+ // results when combined with QRhiResourceUpdateBatch-based updates for the
+ // buffer, but provides a fast path for dynamic buffers that have all their
+ // content changed in every frame.
+
+ Q_ASSERT(m_type == Dynamic);
+ QRHI_RES_RHI(QRhiD3D12);
+ Q_ASSERT(rhiD->inFrame);
+ if (QD3D12Resource *res = rhiD->resourcePool.lookupRef(handles[rhiD->currentFrameSlot]))
+ return static_cast<char *>(res->cpuMapPtr);
+
+ return nullptr;
+}
+
+void QD3D12Buffer::endFullDynamicBufferUpdateForCurrentFrame()
+{
+ // nothing to do here
+}
+
+void QD3D12Buffer::executeHostWritesForFrameSlot(int frameSlot)
+{
+ if (pendingHostWrites[frameSlot].isEmpty())
+ return;
+
+ Q_ASSERT(m_type == QRhiBuffer::Dynamic);
+ QRHI_RES_RHI(QRhiD3D12);
+ if (QD3D12Resource *res = rhiD->resourcePool.lookupRef(handles[frameSlot])) {
+ Q_ASSERT(res->cpuMapPtr);
+ for (const QD3D12Buffer::HostWrite &u : std::as_const(pendingHostWrites[frameSlot]))
+ memcpy(static_cast<char *>(res->cpuMapPtr) + u.offset, u.data.constData(), u.data.size());
+ }
+ pendingHostWrites[frameSlot].clear();
+}
+
+static inline DXGI_FORMAT toD3DTextureFormat(QRhiTexture::Format format, QRhiTexture::Flags flags)
+{
+ const bool srgb = flags.testFlag(QRhiTexture::sRGB);
+ switch (format) {
+ case QRhiTexture::RGBA8:
+ return srgb ? DXGI_FORMAT_R8G8B8A8_UNORM_SRGB : DXGI_FORMAT_R8G8B8A8_UNORM;
+ case QRhiTexture::BGRA8:
+ return srgb ? DXGI_FORMAT_B8G8R8A8_UNORM_SRGB : DXGI_FORMAT_B8G8R8A8_UNORM;
+ case QRhiTexture::R8:
+ return DXGI_FORMAT_R8_UNORM;
+ case QRhiTexture::RG8:
+ return DXGI_FORMAT_R8G8_UNORM;
+ case QRhiTexture::R16:
+ return DXGI_FORMAT_R16_UNORM;
+ case QRhiTexture::RG16:
+ return DXGI_FORMAT_R16G16_UNORM;
+ case QRhiTexture::RED_OR_ALPHA8:
+ return DXGI_FORMAT_R8_UNORM;
+
+ case QRhiTexture::RGBA16F:
+ return DXGI_FORMAT_R16G16B16A16_FLOAT;
+ case QRhiTexture::RGBA32F:
+ return DXGI_FORMAT_R32G32B32A32_FLOAT;
+ case QRhiTexture::R16F:
+ return DXGI_FORMAT_R16_FLOAT;
+ case QRhiTexture::R32F:
+ return DXGI_FORMAT_R32_FLOAT;
+
+ case QRhiTexture::RGB10A2:
+ return DXGI_FORMAT_R10G10B10A2_UNORM;
+
+ case QRhiTexture::D16:
+ return DXGI_FORMAT_R16_TYPELESS;
+ case QRhiTexture::D24:
+ return DXGI_FORMAT_R24G8_TYPELESS;
+ case QRhiTexture::D24S8:
+ return DXGI_FORMAT_R24G8_TYPELESS;
+ case QRhiTexture::D32F:
+ return DXGI_FORMAT_R32_TYPELESS;
+
+ case QRhiTexture::BC1:
+ return srgb ? DXGI_FORMAT_BC1_UNORM_SRGB : DXGI_FORMAT_BC1_UNORM;
+ case QRhiTexture::BC2:
+ return srgb ? DXGI_FORMAT_BC2_UNORM_SRGB : DXGI_FORMAT_BC2_UNORM;
+ case QRhiTexture::BC3:
+ return srgb ? DXGI_FORMAT_BC3_UNORM_SRGB : DXGI_FORMAT_BC3_UNORM;
+ case QRhiTexture::BC4:
+ return DXGI_FORMAT_BC4_UNORM;
+ case QRhiTexture::BC5:
+ return DXGI_FORMAT_BC5_UNORM;
+ case QRhiTexture::BC6H:
+ return DXGI_FORMAT_BC6H_UF16;
+ case QRhiTexture::BC7:
+ return srgb ? DXGI_FORMAT_BC7_UNORM_SRGB : DXGI_FORMAT_BC7_UNORM;
+
+ case QRhiTexture::ETC2_RGB8:
+ case QRhiTexture::ETC2_RGB8A1:
+ case QRhiTexture::ETC2_RGBA8:
+ qWarning("QRhiD3D12 does not support ETC2 textures");
+ return DXGI_FORMAT_R8G8B8A8_UNORM;
+
+ case QRhiTexture::ASTC_4x4:
+ case QRhiTexture::ASTC_5x4:
+ case QRhiTexture::ASTC_5x5:
+ case QRhiTexture::ASTC_6x5:
+ case QRhiTexture::ASTC_6x6:
+ case QRhiTexture::ASTC_8x5:
+ case QRhiTexture::ASTC_8x6:
+ case QRhiTexture::ASTC_8x8:
+ case QRhiTexture::ASTC_10x5:
+ case QRhiTexture::ASTC_10x6:
+ case QRhiTexture::ASTC_10x8:
+ case QRhiTexture::ASTC_10x10:
+ case QRhiTexture::ASTC_12x10:
+ case QRhiTexture::ASTC_12x12:
+ qWarning("QRhiD3D12 does not support ASTC textures");
+ return DXGI_FORMAT_R8G8B8A8_UNORM;
+
+ default:
+ break;
+ }
+ return DXGI_FORMAT_R8G8B8A8_UNORM;
+}
+
+QD3D12RenderBuffer::QD3D12RenderBuffer(QRhiImplementation *rhi,
+ Type type,
+ const QSize &pixelSize,
+ int sampleCount,
+ Flags flags,
+ QRhiTexture::Format backingFormatHint)
+ : QRhiRenderBuffer(rhi, type, pixelSize, sampleCount, flags, backingFormatHint)
+{
+}
+
+QD3D12RenderBuffer::~QD3D12RenderBuffer()
+{
+ destroy();
+}
+
+void QD3D12RenderBuffer::destroy()
+{
+ if (handle.isNull())
+ return;
+
+ QRHI_RES_RHI(QRhiD3D12);
+ if (rhiD) {
+ if (rtv.isValid())
+ rhiD->releaseQueue.deferredReleaseResourceWithViews(handle, &rhiD->rtvPool, rtv, 1);
+ else if (dsv.isValid())
+ rhiD->releaseQueue.deferredReleaseResourceWithViews(handle, &rhiD->dsvPool, dsv, 1);
+ }
+
+ handle = {};
+ rtv = {};
+ dsv = {};
+
+ if (rhiD)
+ rhiD->unregisterResource(this);
+}
+
+bool QD3D12RenderBuffer::create()
+{
+ if (!handle.isNull())
+ destroy();
+
+ if (m_pixelSize.isEmpty())
+ return false;
+
+ QRHI_RES_RHI(QRhiD3D12);
+
+ switch (m_type) {
+ case QRhiRenderBuffer::Color:
+ {
+ dxgiFormat = toD3DTextureFormat(backingFormat(), {});
+ sampleDesc = rhiD->effectiveSampleDesc(m_sampleCount, dxgiFormat);
+ D3D12_RESOURCE_DESC resourceDesc = {};
+ resourceDesc.Dimension = D3D12_RESOURCE_DIMENSION_TEXTURE2D;
+ resourceDesc.Width = UINT64(m_pixelSize.width());
+ resourceDesc.Height = UINT(m_pixelSize.height());
+ resourceDesc.DepthOrArraySize = 1;
+ resourceDesc.MipLevels = 1;
+ resourceDesc.Format = dxgiFormat;
+ resourceDesc.SampleDesc = sampleDesc;
+ resourceDesc.Layout = D3D12_TEXTURE_LAYOUT_UNKNOWN;
+ resourceDesc.Flags = D3D12_RESOURCE_FLAG_ALLOW_RENDER_TARGET;
+ D3D12_CLEAR_VALUE clearValue = {};
+ clearValue.Format = dxgiFormat;
+ // have a separate allocation and resource object (meaning both will need its own Release())
+ ID3D12Resource *resource = nullptr;
+ D3D12MA::Allocation *allocation = nullptr;
+ HRESULT hr = rhiD->vma.createResource(D3D12_HEAP_TYPE_DEFAULT,
+ &resourceDesc,
+ D3D12_RESOURCE_STATE_RENDER_TARGET,
+ &clearValue,
+ &allocation,
+ __uuidof(ID3D12Resource),
+ reinterpret_cast<void **>(&resource));
+ if (FAILED(hr)) {
+ qWarning("Failed to create color buffer: %s", qPrintable(QSystemError::windowsComString(hr)));
+ return false;
+ }
+ handle = QD3D12Resource::addToPool(&rhiD->resourcePool, resource, D3D12_RESOURCE_STATE_RENDER_TARGET, allocation);
+ rtv = rhiD->rtvPool.allocate(1);
+ if (!rtv.isValid())
+ return false;
+ D3D12_RENDER_TARGET_VIEW_DESC rtvDesc = {};
+ rtvDesc.Format = dxgiFormat;
+ rtvDesc.ViewDimension = sampleDesc.Count > 1 ? D3D12_RTV_DIMENSION_TEXTURE2DMS
+ : D3D12_RTV_DIMENSION_TEXTURE2D;
+ rhiD->dev->CreateRenderTargetView(resource, &rtvDesc, rtv.cpuHandle);
+ }
+ break;
+ case QRhiRenderBuffer::DepthStencil:
+ {
+ dxgiFormat = DS_FORMAT;
+ sampleDesc = rhiD->effectiveSampleDesc(m_sampleCount, dxgiFormat);
+ D3D12_RESOURCE_DESC resourceDesc = {};
+ resourceDesc.Dimension = D3D12_RESOURCE_DIMENSION_TEXTURE2D;
+ resourceDesc.Width = UINT64(m_pixelSize.width());
+ resourceDesc.Height = UINT(m_pixelSize.height());
+ resourceDesc.DepthOrArraySize = 1;
+ resourceDesc.MipLevels = 1;
+ resourceDesc.Format = dxgiFormat;
+ resourceDesc.SampleDesc = sampleDesc;
+ resourceDesc.Layout = D3D12_TEXTURE_LAYOUT_UNKNOWN;
+ resourceDesc.Flags = D3D12_RESOURCE_FLAG_ALLOW_DEPTH_STENCIL;
+ if (m_flags.testFlag(UsedWithSwapChainOnly))
+ resourceDesc.Flags |= D3D12_RESOURCE_FLAG_DENY_SHADER_RESOURCE;
+ D3D12_CLEAR_VALUE clearValue = {};
+ clearValue.Format = dxgiFormat;
+ clearValue.DepthStencil.Depth = 1.0f;
+ clearValue.DepthStencil.Stencil = 0;
+ ID3D12Resource *resource = nullptr;
+ D3D12MA::Allocation *allocation = nullptr;
+ HRESULT hr = rhiD->vma.createResource(D3D12_HEAP_TYPE_DEFAULT,
+ &resourceDesc,
+ D3D12_RESOURCE_STATE_DEPTH_WRITE,
+ &clearValue,
+ &allocation,
+ __uuidof(ID3D12Resource),
+ reinterpret_cast<void **>(&resource));
+ if (FAILED(hr)) {
+ qWarning("Failed to create depth-stencil buffer: %s", qPrintable(QSystemError::windowsComString(hr)));
+ return false;
+ }
+ handle = QD3D12Resource::addToPool(&rhiD->resourcePool, resource, D3D12_RESOURCE_STATE_DEPTH_WRITE, allocation);
+ dsv = rhiD->dsvPool.allocate(1);
+ if (!dsv.isValid())
+ return false;
+ D3D12_DEPTH_STENCIL_VIEW_DESC dsvDesc = {};
+ dsvDesc.Format = dxgiFormat;
+ dsvDesc.ViewDimension = sampleDesc.Count > 1 ? D3D12_DSV_DIMENSION_TEXTURE2DMS
+ : D3D12_DSV_DIMENSION_TEXTURE2D;
+ rhiD->dev->CreateDepthStencilView(resource, &dsvDesc, dsv.cpuHandle);
+ }
+ break;
+ }
+
+ if (!m_objectName.isEmpty()) {
+ if (QD3D12Resource *res = rhiD->resourcePool.lookupRef(handle)) {
+ const QString name = QString::fromUtf8(m_objectName);
+ res->resource->SetName(reinterpret_cast<LPCWSTR>(name.utf16()));
+ }
+ }
+
+ generation += 1;
+ rhiD->registerResource(this);
+ return true;
+}
+
+QRhiTexture::Format QD3D12RenderBuffer::backingFormat() const
+{
+ if (m_backingFormatHint != QRhiTexture::UnknownFormat)
+ return m_backingFormatHint;
+ else
+ return m_type == Color ? QRhiTexture::RGBA8 : QRhiTexture::UnknownFormat;
+}
+
+QD3D12Texture::QD3D12Texture(QRhiImplementation *rhi, Format format, const QSize &pixelSize, int depth,
+ int arraySize, int sampleCount, Flags flags)
+ : QRhiTexture(rhi, format, pixelSize, depth, arraySize, sampleCount, flags)
+{
+}
+
+QD3D12Texture::~QD3D12Texture()
+{
+ destroy();
+}
+
+void QD3D12Texture::destroy()
+{
+ if (handle.isNull())
+ return;
+
+ QRHI_RES_RHI(QRhiD3D12);
+ if (rhiD)
+ rhiD->releaseQueue.deferredReleaseResourceWithViews(handle, &rhiD->cbvSrvUavPool, srv, 1);
+
+ handle = {};
+ srv = {};
+
+ if (rhiD)
+ rhiD->unregisterResource(this);
+}
+
+static inline DXGI_FORMAT toD3DDepthTextureSRVFormat(QRhiTexture::Format format)
+{
+ switch (format) {
+ case QRhiTexture::Format::D16:
+ return DXGI_FORMAT_R16_FLOAT;
+ case QRhiTexture::Format::D24:
+ return DXGI_FORMAT_R24_UNORM_X8_TYPELESS;
+ case QRhiTexture::Format::D24S8:
+ return DXGI_FORMAT_R24_UNORM_X8_TYPELESS;
+ case QRhiTexture::Format::D32F:
+ return DXGI_FORMAT_R32_FLOAT;
+ default:
+ break;
+ }
+ Q_UNREACHABLE_RETURN(DXGI_FORMAT_R32_FLOAT);
+}
+
+static inline DXGI_FORMAT toD3DDepthTextureDSVFormat(QRhiTexture::Format format)
+{
+ // here the result cannot be typeless
+ switch (format) {
+ case QRhiTexture::Format::D16:
+ return DXGI_FORMAT_D16_UNORM;
+ case QRhiTexture::Format::D24:
+ return DXGI_FORMAT_D24_UNORM_S8_UINT;
+ case QRhiTexture::Format::D24S8:
+ return DXGI_FORMAT_D24_UNORM_S8_UINT;
+ case QRhiTexture::Format::D32F:
+ return DXGI_FORMAT_D32_FLOAT;
+ default:
+ break;
+ }
+ Q_UNREACHABLE_RETURN(DXGI_FORMAT_D32_FLOAT);
+}
+
+static inline bool isDepthTextureFormat(QRhiTexture::Format format)
+{
+ switch (format) {
+ case QRhiTexture::Format::D16:
+ case QRhiTexture::Format::D24:
+ case QRhiTexture::Format::D24S8:
+ case QRhiTexture::Format::D32F:
+ return true;
+ default:
+ return false;
+ }
+}
+
+bool QD3D12Texture::prepareCreate(QSize *adjustedSize)
+{
+ if (!handle.isNull())
+ destroy();
+
+ const bool isDepth = isDepthTextureFormat(m_format);
+ const bool isCube = m_flags.testFlag(CubeMap);
+ const bool is3D = m_flags.testFlag(ThreeDimensional);
+ const bool isArray = m_flags.testFlag(TextureArray);
+ const bool hasMipMaps = m_flags.testFlag(MipMapped);
+ const bool is1D = m_flags.testFlag(OneDimensional);
+
+ const QSize size = is1D ? QSize(qMax(1, m_pixelSize.width()), 1)
+ : (m_pixelSize.isEmpty() ? QSize(1, 1) : m_pixelSize);
+
+ dxgiFormat = toD3DTextureFormat(m_format, m_flags);
+ if (isDepth) {
+ srvFormat = toD3DDepthTextureSRVFormat(m_format);
+ rtFormat = toD3DDepthTextureDSVFormat(m_format);
+ } else {
+ srvFormat = dxgiFormat;
+ rtFormat = dxgiFormat;
+ }
+ if (m_writeViewFormat.format != UnknownFormat) {
+ if (isDepth)
+ rtFormat = toD3DDepthTextureDSVFormat(m_writeViewFormat.format);
+ else
+ rtFormat = toD3DTextureFormat(m_writeViewFormat.format, m_writeViewFormat.srgb ? sRGB : Flags());
+ }
+ if (m_readViewFormat.format != UnknownFormat) {
+ if (isDepth)
+ srvFormat = toD3DDepthTextureSRVFormat(m_readViewFormat.format);
+ else
+ srvFormat = toD3DTextureFormat(m_readViewFormat.format, m_readViewFormat.srgb ? sRGB : Flags());
+ }
+
+ QRHI_RES_RHI(QRhiD3D12);
+ mipLevelCount = uint(hasMipMaps ? rhiD->q->mipLevelsForSize(size) : 1);
+ sampleDesc = rhiD->effectiveSampleDesc(m_sampleCount, dxgiFormat);
+ if (sampleDesc.Count > 1) {
+ if (isCube) {
+ qWarning("Cubemap texture cannot be multisample");
+ return false;
+ }
+ if (is3D) {
+ qWarning("3D texture cannot be multisample");
+ return false;
+ }
+ if (hasMipMaps) {
+ qWarning("Multisample texture cannot have mipmaps");
+ return false;
+ }
+ }
+ if (isDepth && hasMipMaps) {
+ qWarning("Depth texture cannot have mipmaps");
+ return false;
+ }
+ if (isCube && is3D) {
+ qWarning("Texture cannot be both cube and 3D");
+ return false;
+ }
+ if (isArray && is3D) {
+ qWarning("Texture cannot be both array and 3D");
+ return false;
+ }
+ if (isCube && is1D) {
+ qWarning("Texture cannot be both cube and 1D");
+ return false;
+ }
+ if (is1D && is3D) {
+ qWarning("Texture cannot be both 1D and 3D");
+ return false;
+ }
+ if (m_depth > 1 && !is3D) {
+ qWarning("Texture cannot have a depth of %d when it is not 3D", m_depth);
+ return false;
+ }
+ if (m_arraySize > 0 && !isArray) {
+ qWarning("Texture cannot have an array size of %d when it is not an array", m_arraySize);
+ return false;
+ }
+ if (m_arraySize < 1 && isArray) {
+ qWarning("Texture is an array but array size is %d", m_arraySize);
+ return false;
+ }
+
+ if (adjustedSize)
+ *adjustedSize = size;
+
+ return true;
+}
+
+bool QD3D12Texture::finishCreate()
+{
+ QRHI_RES_RHI(QRhiD3D12);
+ const bool isCube = m_flags.testFlag(CubeMap);
+ const bool is3D = m_flags.testFlag(ThreeDimensional);
+ const bool isArray = m_flags.testFlag(TextureArray);
+ const bool is1D = m_flags.testFlag(OneDimensional);
+
+ D3D12_SHADER_RESOURCE_VIEW_DESC srvDesc = {};
+ srvDesc.Format = srvFormat;
+ srvDesc.Shader4ComponentMapping = D3D12_DEFAULT_SHADER_4_COMPONENT_MAPPING;
+
+ if (isCube) {
+ srvDesc.ViewDimension = D3D12_SRV_DIMENSION_TEXTURECUBE;
+ srvDesc.TextureCube.MipLevels = mipLevelCount;
+ } else {
+ if (is1D) {
+ if (isArray) {
+ srvDesc.ViewDimension = D3D12_SRV_DIMENSION_TEXTURE1DARRAY;
+ srvDesc.Texture1DArray.MipLevels = mipLevelCount;
+ if (m_arrayRangeStart >= 0 && m_arrayRangeLength >= 0) {
+ srvDesc.Texture1DArray.FirstArraySlice = UINT(m_arrayRangeStart);
+ srvDesc.Texture1DArray.ArraySize = UINT(m_arrayRangeLength);
+ } else {
+ srvDesc.Texture1DArray.FirstArraySlice = 0;
+ srvDesc.Texture1DArray.ArraySize = UINT(qMax(0, m_arraySize));
+ }
+ } else {
+ srvDesc.ViewDimension = D3D12_SRV_DIMENSION_TEXTURE1D;
+ srvDesc.Texture1D.MipLevels = mipLevelCount;
+ }
+ } else if (isArray) {
+ if (sampleDesc.Count > 1) {
+ srvDesc.ViewDimension = D3D12_SRV_DIMENSION_TEXTURE2DMSARRAY;
+ if (m_arrayRangeStart >= 0 && m_arrayRangeLength >= 0) {
+ srvDesc.Texture2DMSArray.FirstArraySlice = UINT(m_arrayRangeStart);
+ srvDesc.Texture2DMSArray.ArraySize = UINT(m_arrayRangeLength);
+ } else {
+ srvDesc.Texture2DMSArray.FirstArraySlice = 0;
+ srvDesc.Texture2DMSArray.ArraySize = UINT(qMax(0, m_arraySize));
+ }
+ } else {
+ srvDesc.ViewDimension = D3D12_SRV_DIMENSION_TEXTURE2DARRAY;
+ srvDesc.Texture2DArray.MipLevels = mipLevelCount;
+ if (m_arrayRangeStart >= 0 && m_arrayRangeLength >= 0) {
+ srvDesc.Texture2DArray.FirstArraySlice = UINT(m_arrayRangeStart);
+ srvDesc.Texture2DArray.ArraySize = UINT(m_arrayRangeLength);
+ } else {
+ srvDesc.Texture2DArray.FirstArraySlice = 0;
+ srvDesc.Texture2DArray.ArraySize = UINT(qMax(0, m_arraySize));
+ }
+ }
+ } else {
+ if (sampleDesc.Count > 1) {
+ srvDesc.ViewDimension = D3D12_SRV_DIMENSION_TEXTURE2DMS;
+ } else if (is3D) {
+ srvDesc.ViewDimension = D3D12_SRV_DIMENSION_TEXTURE3D;
+ srvDesc.Texture3D.MipLevels = mipLevelCount;
+ } else {
+ srvDesc.ViewDimension = D3D12_SRV_DIMENSION_TEXTURE2D;
+ srvDesc.Texture2D.MipLevels = mipLevelCount;
+ }
+ }
+ }
+
+ srv = rhiD->cbvSrvUavPool.allocate(1);
+ if (!srv.isValid())
+ return false;
+
+ if (QD3D12Resource *res = rhiD->resourcePool.lookupRef(handle)) {
+ rhiD->dev->CreateShaderResourceView(res->resource, &srvDesc, srv.cpuHandle);
+ if (!m_objectName.isEmpty()) {
+ const QString name = QString::fromUtf8(m_objectName);
+ res->resource->SetName(reinterpret_cast<LPCWSTR>(name.utf16()));
+ }
+ } else {
+ return false;
+ }
+
+ generation += 1;
+ return true;
+}
+
+bool QD3D12Texture::create()
+{
+ QSize size;
+ if (!prepareCreate(&size))
+ return false;
+
+ const bool isDepth = isDepthTextureFormat(m_format);
+ const bool isCube = m_flags.testFlag(CubeMap);
+ const bool is3D = m_flags.testFlag(ThreeDimensional);
+ const bool isArray = m_flags.testFlag(TextureArray);
+ const bool is1D = m_flags.testFlag(OneDimensional);
+
+ QRHI_RES_RHI(QRhiD3D12);
+
+ bool needsOptimizedClearValueSpecified = false;
+ UINT resourceFlags = 0;
+ if (m_flags.testFlag(RenderTarget) || sampleDesc.Count > 1) {
+ if (isDepth)
+ resourceFlags |= D3D12_RESOURCE_FLAG_ALLOW_DEPTH_STENCIL;
+ else
+ resourceFlags |= D3D12_RESOURCE_FLAG_ALLOW_RENDER_TARGET;
+ needsOptimizedClearValueSpecified = true;
+ }
+ if (m_flags.testFlag(UsedWithGenerateMips)) {
+ if (isDepth) {
+ qWarning("Depth texture cannot have mipmaps generated");
+ return false;
+ }
+ resourceFlags |= D3D12_RESOURCE_FLAG_ALLOW_UNORDERED_ACCESS;
+ }
+ if (m_flags.testFlag(UsedWithLoadStore))
+ resourceFlags |= D3D12_RESOURCE_FLAG_ALLOW_UNORDERED_ACCESS;
+
+ D3D12_RESOURCE_DESC resourceDesc = {};
+ resourceDesc.Dimension = is1D ? D3D12_RESOURCE_DIMENSION_TEXTURE1D
+ : (is3D ? D3D12_RESOURCE_DIMENSION_TEXTURE3D
+ : D3D12_RESOURCE_DIMENSION_TEXTURE2D);
+ resourceDesc.Width = UINT64(size.width());
+ resourceDesc.Height = UINT(size.height());
+ resourceDesc.DepthOrArraySize = isCube ? 6
+ : (isArray ? UINT(qMax(0, m_arraySize))
+ : (is3D ? qMax(1, m_depth)
+ : 1));
+ resourceDesc.MipLevels = mipLevelCount;
+ resourceDesc.Format = dxgiFormat;
+ resourceDesc.SampleDesc = sampleDesc;
+ resourceDesc.Layout = D3D12_TEXTURE_LAYOUT_UNKNOWN;
+ resourceDesc.Flags = D3D12_RESOURCE_FLAGS(resourceFlags);
+ D3D12_CLEAR_VALUE clearValue = {};
+ clearValue.Format = dxgiFormat;
+ if (isDepth) {
+ clearValue.Format = toD3DDepthTextureDSVFormat(m_format);
+ clearValue.DepthStencil.Depth = 1.0f;
+ clearValue.DepthStencil.Stencil = 0;
+ }
+ ID3D12Resource *resource = nullptr;
+ D3D12MA::Allocation *allocation = nullptr;
+ HRESULT hr = rhiD->vma.createResource(D3D12_HEAP_TYPE_DEFAULT,
+ &resourceDesc,
+ D3D12_RESOURCE_STATE_COMMON,
+ needsOptimizedClearValueSpecified ? &clearValue : nullptr,
+ &allocation,
+ __uuidof(ID3D12Resource),
+ reinterpret_cast<void **>(&resource));
+ if (FAILED(hr)) {
+ qWarning("Failed to create texture: '%s'"
+ " Dim was %d Size was %ux%u Depth/ArraySize was %u MipLevels was %u Format was %d Sample count was %d",
+ qPrintable(QSystemError::windowsComString(hr)),
+ int(resourceDesc.Dimension),
+ uint(resourceDesc.Width),
+ uint(resourceDesc.Height),
+ uint(resourceDesc.DepthOrArraySize),
+ uint(resourceDesc.MipLevels),
+ int(resourceDesc.Format),
+ int(resourceDesc.SampleDesc.Count));
+ return false;
+ }
+
+ handle = QD3D12Resource::addToPool(&rhiD->resourcePool, resource, D3D12_RESOURCE_STATE_COMMON, allocation);
+
+ if (!finishCreate())
+ return false;
+
+ rhiD->registerResource(this);
+ return true;
+}
+
+bool QD3D12Texture::createFrom(QRhiTexture::NativeTexture src)
+{
+ if (!src.object)
+ return false;
+
+ if (!prepareCreate())
+ return false;
+
+ ID3D12Resource *resource = reinterpret_cast<ID3D12Resource *>(src.object);
+ D3D12_RESOURCE_STATES state = D3D12_RESOURCE_STATES(src.layout);
+
+ QRHI_RES_RHI(QRhiD3D12);
+ handle = QD3D12Resource::addNonOwningToPool(&rhiD->resourcePool, resource, state);
+
+ if (!finishCreate())
+ return false;
+
+ rhiD->registerResource(this);
+ return true;
+}
+
+QRhiTexture::NativeTexture QD3D12Texture::nativeTexture()
+{
+ QRHI_RES_RHI(QRhiD3D12);
+ if (QD3D12Resource *res = rhiD->resourcePool.lookupRef(handle))
+ return { quint64(res->resource), int(res->state) };
+
+ return {};
+}
+
+void QD3D12Texture::setNativeLayout(int layout)
+{
+ QRHI_RES_RHI(QRhiD3D12);
+ if (QD3D12Resource *res = rhiD->resourcePool.lookupRef(handle))
+ res->state = D3D12_RESOURCE_STATES(layout);
+}
+
+QD3D12Sampler::QD3D12Sampler(QRhiImplementation *rhi, Filter magFilter, Filter minFilter, Filter mipmapMode,
+ AddressMode u, AddressMode v, AddressMode w)
+ : QRhiSampler(rhi, magFilter, minFilter, mipmapMode, u, v, w)
+{
+}
+
+QD3D12Sampler::~QD3D12Sampler()
+{
+ destroy();
+}
+
+void QD3D12Sampler::destroy()
+{
+ shaderVisibleDescriptor = {};
+
+ QRHI_RES_RHI(QRhiD3D12);
+ if (rhiD)
+ rhiD->unregisterResource(this);
+}
+
+static inline D3D12_FILTER toD3DFilter(QRhiSampler::Filter minFilter, QRhiSampler::Filter magFilter, QRhiSampler::Filter mipFilter)
+{
+ if (minFilter == QRhiSampler::Nearest) {
+ if (magFilter == QRhiSampler::Nearest) {
+ if (mipFilter == QRhiSampler::Linear)
+ return D3D12_FILTER_MIN_MAG_POINT_MIP_LINEAR;
+ else
+ return D3D12_FILTER_MIN_MAG_MIP_POINT;
+ } else {
+ if (mipFilter == QRhiSampler::Linear)
+ return D3D12_FILTER_MIN_POINT_MAG_MIP_LINEAR;
+ else
+ return D3D12_FILTER_MIN_POINT_MAG_LINEAR_MIP_POINT;
+ }
+ } else {
+ if (magFilter == QRhiSampler::Nearest) {
+ if (mipFilter == QRhiSampler::Linear)
+ return D3D12_FILTER_MIN_LINEAR_MAG_POINT_MIP_LINEAR;
+ else
+ return D3D12_FILTER_MIN_LINEAR_MAG_MIP_POINT;
+ } else {
+ if (mipFilter == QRhiSampler::Linear)
+ return D3D12_FILTER_MIN_MAG_MIP_LINEAR;
+ else
+ return D3D12_FILTER_MIN_MAG_LINEAR_MIP_POINT;
+ }
+ }
+ Q_UNREACHABLE_RETURN(D3D12_FILTER_MIN_MAG_MIP_LINEAR);
+}
+
+static inline D3D12_TEXTURE_ADDRESS_MODE toD3DAddressMode(QRhiSampler::AddressMode m)
+{
+ switch (m) {
+ case QRhiSampler::Repeat:
+ return D3D12_TEXTURE_ADDRESS_MODE_WRAP;
+ case QRhiSampler::ClampToEdge:
+ return D3D12_TEXTURE_ADDRESS_MODE_CLAMP;
+ case QRhiSampler::Mirror:
+ return D3D12_TEXTURE_ADDRESS_MODE_MIRROR;
+ }
+ Q_UNREACHABLE_RETURN(D3D12_TEXTURE_ADDRESS_MODE_CLAMP);
+}
+
+static inline D3D12_COMPARISON_FUNC toD3DTextureComparisonFunc(QRhiSampler::CompareOp op)
+{
+ switch (op) {
+ case QRhiSampler::Never:
+ return D3D12_COMPARISON_FUNC_NEVER;
+ case QRhiSampler::Less:
+ return D3D12_COMPARISON_FUNC_LESS;
+ case QRhiSampler::Equal:
+ return D3D12_COMPARISON_FUNC_EQUAL;
+ case QRhiSampler::LessOrEqual:
+ return D3D12_COMPARISON_FUNC_LESS_EQUAL;
+ case QRhiSampler::Greater:
+ return D3D12_COMPARISON_FUNC_GREATER;
+ case QRhiSampler::NotEqual:
+ return D3D12_COMPARISON_FUNC_NOT_EQUAL;
+ case QRhiSampler::GreaterOrEqual:
+ return D3D12_COMPARISON_FUNC_GREATER_EQUAL;
+ case QRhiSampler::Always:
+ return D3D12_COMPARISON_FUNC_ALWAYS;
+ }
+ Q_UNREACHABLE_RETURN(D3D12_COMPARISON_FUNC_NEVER);
+}
+
+bool QD3D12Sampler::create()
+{
+ desc = {};
+ desc.Filter = toD3DFilter(m_minFilter, m_magFilter, m_mipmapMode);
+ if (m_compareOp != Never)
+ desc.Filter = D3D12_FILTER(desc.Filter | 0x80);
+ desc.AddressU = toD3DAddressMode(m_addressU);
+ desc.AddressV = toD3DAddressMode(m_addressV);
+ desc.AddressW = toD3DAddressMode(m_addressW);
+ desc.MaxAnisotropy = 1.0f;
+ desc.ComparisonFunc = toD3DTextureComparisonFunc(m_compareOp);
+ desc.MaxLOD = m_mipmapMode == None ? 0.0f : 10000.0f;
+
+ QRHI_RES_RHI(QRhiD3D12);
+ rhiD->registerResource(this, false);
+ return true;
+}
+
+QD3D12Descriptor QD3D12Sampler::lookupOrCreateShaderVisibleDescriptor()
+{
+ if (!shaderVisibleDescriptor.isValid()) {
+ QRHI_RES_RHI(QRhiD3D12);
+ shaderVisibleDescriptor = rhiD->samplerMgr.getShaderVisibleDescriptor(desc);
+ }
+ return shaderVisibleDescriptor;
+}
+
+QD3D12TextureRenderTarget::QD3D12TextureRenderTarget(QRhiImplementation *rhi,
+ const QRhiTextureRenderTargetDescription &desc,
+ Flags flags)
+ : QRhiTextureRenderTarget(rhi, desc, flags),
+ d(rhi)
+{
+}
+
+QD3D12TextureRenderTarget::~QD3D12TextureRenderTarget()
+{
+ destroy();
+}
+
+void QD3D12TextureRenderTarget::destroy()
+{
+ if (!rtv[0].isValid() && !dsv.isValid())
+ return;
+
+ QRHI_RES_RHI(QRhiD3D12);
+ if (dsv.isValid()) {
+ if (ownsDsv && rhiD)
+ rhiD->releaseQueue.deferredReleaseViews(&rhiD->dsvPool, dsv, 1);
+ dsv = {};
+ }
+
+ for (int i = 0; i < QD3D12RenderTargetData::MAX_COLOR_ATTACHMENTS; ++i) {
+ if (rtv[i].isValid()) {
+ if (ownsRtv[i] && rhiD)
+ rhiD->releaseQueue.deferredReleaseViews(&rhiD->rtvPool, rtv[i], 1);
+ rtv[i] = {};
+ }
+ }
+
+ if (rhiD)
+ rhiD->unregisterResource(this);
+}
+
+QRhiRenderPassDescriptor *QD3D12TextureRenderTarget::newCompatibleRenderPassDescriptor()
+{
+ // not yet built so cannot rely on data computed in create()
+
+ QD3D12RenderPassDescriptor *rpD = new QD3D12RenderPassDescriptor(m_rhi);
+
+ rpD->colorAttachmentCount = 0;
+ for (auto it = m_desc.cbeginColorAttachments(), itEnd = m_desc.cendColorAttachments(); it != itEnd; ++it) {
+ QD3D12Texture *texD = QRHI_RES(QD3D12Texture, it->texture());
+ QD3D12RenderBuffer *rbD = QRHI_RES(QD3D12RenderBuffer, it->renderBuffer());
+ if (texD)
+ rpD->colorFormat[rpD->colorAttachmentCount] = texD->rtFormat;
+ else if (rbD)
+ rpD->colorFormat[rpD->colorAttachmentCount] = rbD->dxgiFormat;
+ rpD->colorAttachmentCount += 1;
+ }
+
+ rpD->hasDepthStencil = false;
+ if (m_desc.depthStencilBuffer()) {
+ rpD->hasDepthStencil = true;
+ rpD->dsFormat = QD3D12RenderBuffer::DS_FORMAT;
+ } else if (m_desc.depthTexture()) {
+ QD3D12Texture *depthTexD = QRHI_RES(QD3D12Texture, m_desc.depthTexture());
+ rpD->hasDepthStencil = true;
+ rpD->dsFormat = toD3DDepthTextureDSVFormat(depthTexD->format()); // cannot be a typeless format
+ }
+
+ rpD->updateSerializedFormat();
+
+ QRHI_RES_RHI(QRhiD3D12);
+ rhiD->registerResource(rpD);
+ return rpD;
+}
+
+bool QD3D12TextureRenderTarget::create()
+{
+ if (rtv[0].isValid() || dsv.isValid())
+ destroy();
+
+ QRHI_RES_RHI(QRhiD3D12);
+ Q_ASSERT(m_desc.colorAttachmentCount() > 0 || m_desc.depthTexture());
+ Q_ASSERT(!m_desc.depthStencilBuffer() || !m_desc.depthTexture());
+ const bool hasDepthStencil = m_desc.depthStencilBuffer() || m_desc.depthTexture();
+ d.colorAttCount = 0;
+ int attIndex = 0;
+
+ for (auto it = m_desc.cbeginColorAttachments(), itEnd = m_desc.cendColorAttachments(); it != itEnd; ++it, ++attIndex) {
+ d.colorAttCount += 1;
+ const QRhiColorAttachment &colorAtt(*it);
+ QRhiTexture *texture = colorAtt.texture();
+ QRhiRenderBuffer *rb = colorAtt.renderBuffer();
+ Q_ASSERT(texture || rb);
+ if (texture) {
+ QD3D12Texture *texD = QRHI_RES(QD3D12Texture, texture);
+ QD3D12Resource *res = rhiD->resourcePool.lookupRef(texD->handle);
+ if (!res) {
+ qWarning("Could not look up texture handle for render target");
+ return false;
+ }
+ const bool isMultiView = it->multiViewCount() >= 2;
+ UINT layerCount = isMultiView ? UINT(it->multiViewCount()) : 1;
+ D3D12_RENDER_TARGET_VIEW_DESC rtvDesc = {};
+ rtvDesc.Format = texD->rtFormat;
+ if (texD->flags().testFlag(QRhiTexture::CubeMap)) {
+ rtvDesc.ViewDimension = D3D12_RTV_DIMENSION_TEXTURE2DARRAY;
+ rtvDesc.Texture2DArray.MipSlice = UINT(colorAtt.level());
+ rtvDesc.Texture2DArray.FirstArraySlice = UINT(colorAtt.layer());
+ rtvDesc.Texture2DArray.ArraySize = layerCount;
+ } else if (texD->flags().testFlag(QRhiTexture::OneDimensional)) {
+ if (texD->flags().testFlag(QRhiTexture::TextureArray)) {
+ rtvDesc.ViewDimension = D3D12_RTV_DIMENSION_TEXTURE1DARRAY;
+ rtvDesc.Texture1DArray.MipSlice = UINT(colorAtt.level());
+ rtvDesc.Texture1DArray.FirstArraySlice = UINT(colorAtt.layer());
+ rtvDesc.Texture1DArray.ArraySize = layerCount;
+ } else {
+ rtvDesc.ViewDimension = D3D12_RTV_DIMENSION_TEXTURE1D;
+ rtvDesc.Texture1D.MipSlice = UINT(colorAtt.level());
+ }
+ } else if (texD->flags().testFlag(QRhiTexture::TextureArray)) {
+ if (texD->sampleDesc.Count > 1) {
+ rtvDesc.ViewDimension = D3D12_RTV_DIMENSION_TEXTURE2DMSARRAY;
+ rtvDesc.Texture2DMSArray.FirstArraySlice = UINT(colorAtt.layer());
+ rtvDesc.Texture2DMSArray.ArraySize = layerCount;
+ } else {
+ rtvDesc.ViewDimension = D3D12_RTV_DIMENSION_TEXTURE2DARRAY;
+ rtvDesc.Texture2DArray.MipSlice = UINT(colorAtt.level());
+ rtvDesc.Texture2DArray.FirstArraySlice = UINT(colorAtt.layer());
+ rtvDesc.Texture2DArray.ArraySize = layerCount;
+ }
+ } else if (texD->flags().testFlag(QRhiTexture::ThreeDimensional)) {
+ rtvDesc.ViewDimension = D3D12_RTV_DIMENSION_TEXTURE3D;
+ rtvDesc.Texture3D.MipSlice = UINT(colorAtt.level());
+ rtvDesc.Texture3D.FirstWSlice = UINT(colorAtt.layer());
+ rtvDesc.Texture3D.WSize = layerCount;
+ } else {
+ if (texD->sampleDesc.Count > 1) {
+ rtvDesc.ViewDimension = D3D12_RTV_DIMENSION_TEXTURE2DMS;
+ } else {
+ rtvDesc.ViewDimension = D3D12_RTV_DIMENSION_TEXTURE2D;
+ rtvDesc.Texture2D.MipSlice = UINT(colorAtt.level());
+ }
+ }
+ rtv[attIndex] = rhiD->rtvPool.allocate(1);
+ if (!rtv[attIndex].isValid()) {
+ qWarning("Failed to allocate RTV for texture render target");
+ return false;
+ }
+ rhiD->dev->CreateRenderTargetView(res->resource, &rtvDesc, rtv[attIndex].cpuHandle);
+ ownsRtv[attIndex] = true;
+ if (attIndex == 0) {
+ d.pixelSize = rhiD->q->sizeForMipLevel(colorAtt.level(), texD->pixelSize());
+ d.sampleCount = int(texD->sampleDesc.Count);
+ }
+ } else if (rb) {
+ QD3D12RenderBuffer *rbD = QRHI_RES(QD3D12RenderBuffer, rb);
+ ownsRtv[attIndex] = false;
+ rtv[attIndex] = rbD->rtv;
+ if (attIndex == 0) {
+ d.pixelSize = rbD->pixelSize();
+ d.sampleCount = int(rbD->sampleDesc.Count);
+ }
+ }
+ }
+
+ d.dpr = 1;
+
+ if (hasDepthStencil) {
+ if (m_desc.depthTexture()) {
+ ownsDsv = true;
+ QD3D12Texture *depthTexD = QRHI_RES(QD3D12Texture, m_desc.depthTexture());
+ QD3D12Resource *res = rhiD->resourcePool.lookupRef(depthTexD->handle);
+ if (!res) {
+ qWarning("Could not look up depth texture handle");
+ return false;
+ }
+ D3D12_DEPTH_STENCIL_VIEW_DESC dsvDesc = {};
+ dsvDesc.Format = depthTexD->rtFormat;
+ dsvDesc.ViewDimension = depthTexD->sampleDesc.Count > 1 ? D3D12_DSV_DIMENSION_TEXTURE2DMS
+ : D3D12_DSV_DIMENSION_TEXTURE2D;
+ if (depthTexD->flags().testFlag(QRhiTexture::TextureArray)) {
+ if (depthTexD->sampleDesc.Count > 1) {
+ dsvDesc.ViewDimension = D3D12_DSV_DIMENSION_TEXTURE2DMSARRAY;
+ if (depthTexD->arrayRangeStart() >= 0 && depthTexD->arrayRangeLength() >= 0) {
+ dsvDesc.Texture2DMSArray.FirstArraySlice = UINT(depthTexD->arrayRangeStart());
+ dsvDesc.Texture2DMSArray.ArraySize = UINT(depthTexD->arrayRangeLength());
+ } else {
+ dsvDesc.Texture2DMSArray.FirstArraySlice = 0;
+ dsvDesc.Texture2DMSArray.ArraySize = UINT(qMax(0, depthTexD->arraySize()));
+ }
+ } else {
+ dsvDesc.ViewDimension = D3D12_DSV_DIMENSION_TEXTURE2DARRAY;
+ if (depthTexD->arrayRangeStart() >= 0 && depthTexD->arrayRangeLength() >= 0) {
+ dsvDesc.Texture2DArray.FirstArraySlice = UINT(depthTexD->arrayRangeStart());
+ dsvDesc.Texture2DArray.ArraySize = UINT(depthTexD->arrayRangeLength());
+ } else {
+ dsvDesc.Texture2DArray.FirstArraySlice = 0;
+ dsvDesc.Texture2DArray.ArraySize = UINT(qMax(0, depthTexD->arraySize()));
+ }
+ }
+ }
+ dsv = rhiD->dsvPool.allocate(1);
+ if (!dsv.isValid()) {
+ qWarning("Failed to allocate DSV for texture render target");
+ return false;
+ }
+ rhiD->dev->CreateDepthStencilView(res->resource, &dsvDesc, dsv.cpuHandle);
+ if (d.colorAttCount == 0) {
+ d.pixelSize = depthTexD->pixelSize();
+ d.sampleCount = int(depthTexD->sampleDesc.Count);
+ }
+ } else {
+ ownsDsv = false;
+ QD3D12RenderBuffer *depthRbD = QRHI_RES(QD3D12RenderBuffer, m_desc.depthStencilBuffer());
+ dsv = depthRbD->dsv;
+ if (d.colorAttCount == 0) {
+ d.pixelSize = m_desc.depthStencilBuffer()->pixelSize();
+ d.sampleCount = int(depthRbD->sampleDesc.Count);
+ }
+ }
+ d.dsAttCount = 1;
+ } else {
+ d.dsAttCount = 0;
+ }
+
+ D3D12_CPU_DESCRIPTOR_HANDLE nullDescHandle = { 0 };
+ for (int i = 0; i < QD3D12RenderTargetData::MAX_COLOR_ATTACHMENTS; ++i)
+ d.rtv[i] = i < d.colorAttCount ? rtv[i].cpuHandle : nullDescHandle;
+ d.dsv = dsv.cpuHandle;
+ d.rp = QRHI_RES(QD3D12RenderPassDescriptor, m_renderPassDesc);
+
+ QRhiRenderTargetAttachmentTracker::updateResIdList<QD3D12Texture, QD3D12RenderBuffer>(m_desc, &d.currentResIdList);
+
+ rhiD->registerResource(this);
+ return true;
+}
+
+QSize QD3D12TextureRenderTarget::pixelSize() const
+{
+ if (!QRhiRenderTargetAttachmentTracker::isUpToDate<QD3D12Texture, QD3D12RenderBuffer>(m_desc, d.currentResIdList))
+ const_cast<QD3D12TextureRenderTarget *>(this)->create();
+
+ return d.pixelSize;
+}
+
+float QD3D12TextureRenderTarget::devicePixelRatio() const
+{
+ return d.dpr;
+}
+
+int QD3D12TextureRenderTarget::sampleCount() const
+{
+ return d.sampleCount;
+}
+
+QD3D12ShaderResourceBindings::QD3D12ShaderResourceBindings(QRhiImplementation *rhi)
+ : QRhiShaderResourceBindings(rhi)
+{
+}
+
+QD3D12ShaderResourceBindings::~QD3D12ShaderResourceBindings()
+{
+ destroy();
+}
+
+void QD3D12ShaderResourceBindings::destroy()
+{
+ QRHI_RES_RHI(QRhiD3D12);
+ if (rhiD)
+ rhiD->unregisterResource(this);
+}
+
+bool QD3D12ShaderResourceBindings::create()
+{
+ QRHI_RES_RHI(QRhiD3D12);
+ if (!rhiD->sanityCheckShaderResourceBindings(this))
+ return false;
+
+ rhiD->updateLayoutDesc(this);
+
+ hasDynamicOffset = false;
+ for (const QRhiShaderResourceBinding &b : std::as_const(m_bindings)) {
+ const QRhiShaderResourceBinding::Data *bd = QRhiImplementation::shaderResourceBindingData(b);
+ if (bd->type == QRhiShaderResourceBinding::UniformBuffer && bd->u.ubuf.hasDynamicOffset) {
+ hasDynamicOffset = true;
+ break;
+ }
+ }
+
+ // The root signature is not part of the srb. Unintuitive, but the shader
+ // translation pipeline ties our hands: as long as the per-shader (so per
+ // stage!) nativeResourceBindingMap exist, meaning f.ex. that a SPIR-V
+ // combined image sampler binding X passed in here may map to the tY and sY
+ // HLSL registers, where Y is known only once the mapping table from the
+ // shader is looked up. Creating a root parameters at this stage is
+ // therefore impossible.
+
+ generation += 1;
+ rhiD->registerResource(this, false);
+ return true;
+}
+
+void QD3D12ShaderResourceBindings::updateResources(UpdateFlags flags)
+{
+ Q_UNUSED(flags);
+ generation += 1;
+}
+
+// Accessing the QRhiBuffer/Texture/Sampler resources must be avoided in the
+// callbacks; that would only be possible if the srb had those specified, and
+// that's not required at the time of srb and pipeline create() time, and
+// createRootSignature is called from the pipeline create().
+
+void QD3D12ShaderResourceBindings::visitUniformBuffer(QD3D12Stage s,
+ const QRhiShaderResourceBinding::Data::UniformBufferData &,
+ int shaderRegister,
+ int)
+{
+ D3D12_ROOT_PARAMETER1 rootParam = {};
+ rootParam.ParameterType = D3D12_ROOT_PARAMETER_TYPE_CBV;
+ rootParam.ShaderVisibility = qd3d12_stageToVisibility(s);
+ rootParam.Descriptor.ShaderRegister = shaderRegister;
+ rootParam.Descriptor.Flags = D3D12_ROOT_DESCRIPTOR_FLAG_DATA_STATIC;
+ visitorData.cbParams[s].append(rootParam);
+}
+
+void QD3D12ShaderResourceBindings::visitTexture(QD3D12Stage s,
+ const QRhiShaderResourceBinding::TextureAndSampler &,
+ int shaderRegister)
+{
+ D3D12_DESCRIPTOR_RANGE1 range = {};
+ range.RangeType = D3D12_DESCRIPTOR_RANGE_TYPE_SRV;
+ range.NumDescriptors = 1;
+ range.BaseShaderRegister = shaderRegister;
+ range.OffsetInDescriptorsFromTableStart = visitorData.currentSrvRangeOffset[s];
+ visitorData.currentSrvRangeOffset[s] += 1;
+ visitorData.srvRanges[s].append(range);
+ if (visitorData.srvRanges[s].count() == 1) {
+ visitorData.srvTables[s].ParameterType = D3D12_ROOT_PARAMETER_TYPE_DESCRIPTOR_TABLE;
+ visitorData.srvTables[s].ShaderVisibility = qd3d12_stageToVisibility(s);
+ }
+}
+
+void QD3D12ShaderResourceBindings::visitSampler(QD3D12Stage s,
+ const QRhiShaderResourceBinding::TextureAndSampler &,
+ int shaderRegister)
+{
+ // Unlike SRVs and UAVs, samplers are handled so that each sampler becomes
+ // a root parameter with its own descriptor table.
+
+ int &rangeStoreIdx(visitorData.samplerRangeHeads[s]);
+ if (rangeStoreIdx == 16) {
+ qWarning("Sampler count in QD3D12Stage %d exceeds the limit of 16, this is disallowed by QRhi", s);
+ return;
+ }
+ D3D12_DESCRIPTOR_RANGE1 range = {};
+ range.RangeType = D3D12_DESCRIPTOR_RANGE_TYPE_SAMPLER;
+ range.NumDescriptors = 1;
+ range.BaseShaderRegister = shaderRegister;
+ visitorData.samplerRanges[s][rangeStoreIdx] = range;
+ D3D12_ROOT_PARAMETER1 param = {};
+ param.ParameterType = D3D12_ROOT_PARAMETER_TYPE_DESCRIPTOR_TABLE;
+ param.ShaderVisibility = qd3d12_stageToVisibility(s);
+ param.DescriptorTable.NumDescriptorRanges = 1;
+ param.DescriptorTable.pDescriptorRanges = &visitorData.samplerRanges[s][rangeStoreIdx];
+ rangeStoreIdx += 1;
+ visitorData.samplerTables[s].append(param);
+}
+
+void QD3D12ShaderResourceBindings::visitStorageBuffer(QD3D12Stage s,
+ const QRhiShaderResourceBinding::Data::StorageBufferData &,
+ QD3D12ShaderResourceVisitor::StorageOp,
+ int shaderRegister)
+{
+ D3D12_DESCRIPTOR_RANGE1 range = {};
+ range.RangeType = D3D12_DESCRIPTOR_RANGE_TYPE_UAV;
+ range.NumDescriptors = 1;
+ range.BaseShaderRegister = shaderRegister;
+ range.OffsetInDescriptorsFromTableStart = visitorData.currentUavRangeOffset[s];
+ visitorData.currentUavRangeOffset[s] += 1;
+ visitorData.uavRanges[s].append(range);
+ if (visitorData.uavRanges[s].count() == 1) {
+ visitorData.uavTables[s].ParameterType = D3D12_ROOT_PARAMETER_TYPE_DESCRIPTOR_TABLE;
+ visitorData.uavTables[s].ShaderVisibility = qd3d12_stageToVisibility(s);
+ }
+}
+
+void QD3D12ShaderResourceBindings::visitStorageImage(QD3D12Stage s,
+ const QRhiShaderResourceBinding::Data::StorageImageData &,
+ QD3D12ShaderResourceVisitor::StorageOp,
+ int shaderRegister)
+{
+ D3D12_DESCRIPTOR_RANGE1 range = {};
+ range.RangeType = D3D12_DESCRIPTOR_RANGE_TYPE_UAV;
+ range.NumDescriptors = 1;
+ range.BaseShaderRegister = shaderRegister;
+ range.OffsetInDescriptorsFromTableStart = visitorData.currentUavRangeOffset[s];
+ visitorData.currentUavRangeOffset[s] += 1;
+ visitorData.uavRanges[s].append(range);
+ if (visitorData.uavRanges[s].count() == 1) {
+ visitorData.uavTables[s].ParameterType = D3D12_ROOT_PARAMETER_TYPE_DESCRIPTOR_TABLE;
+ visitorData.uavTables[s].ShaderVisibility = qd3d12_stageToVisibility(s);
+ }
+}
+
+QD3D12ObjectHandle QD3D12ShaderResourceBindings::createRootSignature(const QD3D12ShaderStageData *stageData,
+ int stageCount)
+{
+ QRHI_RES_RHI(QRhiD3D12);
+
+ // It's not just that the root signature has to be tied to the pipeline
+ // (cannot just freely create it like e.g. with Vulkan where one just
+ // creates a descriptor layout 1:1 with the QRhiShaderResourceBindings'
+ // data), due to not knowing the shader-specific resource binding mapping
+ // tables at the point of srb creation, but each shader stage may have a
+ // different mapping table. (ugh!)
+ //
+ // Hence we set up everything per-stage, even if it means the root
+ // signature gets unnecessarily big. (note that the magic is in the
+ // ShaderVisibility: even though the register range is the same in the
+ // descriptor tables, the visibility is different)
+
+ QD3D12ShaderResourceVisitor visitor(this, stageData, stageCount);
+
+ visitorData = {};
+
+ using namespace std::placeholders;
+ visitor.uniformBuffer = std::bind(&QD3D12ShaderResourceBindings::visitUniformBuffer, this, _1, _2, _3, _4);
+ visitor.texture = std::bind(&QD3D12ShaderResourceBindings::visitTexture, this, _1, _2, _3);
+ visitor.sampler = std::bind(&QD3D12ShaderResourceBindings::visitSampler, this, _1, _2, _3);
+ visitor.storageBuffer = std::bind(&QD3D12ShaderResourceBindings::visitStorageBuffer, this, _1, _2, _3, _4);
+ visitor.storageImage = std::bind(&QD3D12ShaderResourceBindings::visitStorageImage, this, _1, _2, _3, _4);
+
+ visitor.visit();
+
+ // The maximum size of a root signature is 256 bytes, where a descriptor
+ // table is 4, a root descriptor (e.g. CBV) is 8. We have 5 stages at most
+ // (or 1 with compute) and a separate descriptor table for SRVs (->
+ // textures) and UAVs (-> storage buffers and images) per stage, plus each
+ // uniform buffer counts as a CBV in the stages it is visible.
+ //
+ // Due to the limited maximum size of a shader-visible sampler heap (2048)
+ // and the potential costly switching of descriptor heaps, each sampler is
+ // declared as a separate root parameter / descriptor table (meaning that
+ // two samplers in the same stage are two parameters and two tables, not
+ // just one). QRhi documents a hard limit of 16 on texture/sampler bindings
+ // in a shader (matching D3D11), so we can hopefully get away with this.
+ //
+ // This means that e.g. a vertex+fragment shader with a uniform buffer
+ // visible in both and one texture+sampler in the fragment shader would
+ // consume 2*8 + 4 + 4 = 24 bytes. This also implies that clients
+ // specifying the minimal stage bit mask for each entry in
+ // QRhiShaderResourceBindings are ideal for this backend since it helps
+ // reducing the chance of hitting the size limit.
+
+ QVarLengthArray<D3D12_ROOT_PARAMETER1, 4> rootParams;
+ for (int s = 0; s < 6; ++s) {
+ if (!visitorData.cbParams[s].isEmpty())
+ rootParams.append(visitorData.cbParams[s].constData(), visitorData.cbParams[s].count());
+ }
+ for (int s = 0; s < 6; ++s) {
+ if (!visitorData.srvRanges[s].isEmpty()) {
+ visitorData.srvTables[s].DescriptorTable.NumDescriptorRanges = visitorData.srvRanges[s].count();
+ visitorData.srvTables[s].DescriptorTable.pDescriptorRanges = visitorData.srvRanges[s].constData();
+ rootParams.append(visitorData.srvTables[s]);
+ }
+ }
+ for (int s = 0; s < 6; ++s) {
+ if (!visitorData.samplerTables[s].isEmpty())
+ rootParams.append(visitorData.samplerTables[s].constData(), visitorData.samplerTables[s].count());
+ }
+ for (int s = 0; s < 6; ++s) {
+ if (!visitorData.uavRanges[s].isEmpty()) {
+ visitorData.uavTables[s].DescriptorTable.NumDescriptorRanges = visitorData.uavRanges[s].count();
+ visitorData.uavTables[s].DescriptorTable.pDescriptorRanges = visitorData.uavRanges[s].constData();
+ rootParams.append(visitorData.uavTables[s]);
+ }
+ }
+
+ D3D12_VERSIONED_ROOT_SIGNATURE_DESC rsDesc = {};
+ rsDesc.Version = D3D_ROOT_SIGNATURE_VERSION_1_1;
+ if (!rootParams.isEmpty()) {
+ rsDesc.Desc_1_1.NumParameters = rootParams.count();
+ rsDesc.Desc_1_1.pParameters = rootParams.constData();
+ }
+
+ UINT rsFlags = 0;
+ for (int stageIdx = 0; stageIdx < stageCount; ++stageIdx) {
+ if (stageData[stageIdx].valid && stageData[stageIdx].stage == VS)
+ rsFlags |= D3D12_ROOT_SIGNATURE_FLAG_ALLOW_INPUT_ASSEMBLER_INPUT_LAYOUT;
+ }
+ rsDesc.Desc_1_1.Flags = D3D12_ROOT_SIGNATURE_FLAGS(rsFlags);
+
+ ID3DBlob *signature = nullptr;
+ HRESULT hr = D3D12SerializeVersionedRootSignature(&rsDesc, &signature, nullptr);
+ if (FAILED(hr)) {
+ qWarning("Failed to serialize root signature: %s", qPrintable(QSystemError::windowsComString(hr)));
+ return {};
+ }
+ ID3D12RootSignature *rootSig = nullptr;
+ hr = rhiD->dev->CreateRootSignature(0,
+ signature->GetBufferPointer(),
+ signature->GetBufferSize(),
+ __uuidof(ID3D12RootSignature),
+ reinterpret_cast<void **>(&rootSig));
+ signature->Release();
+ if (FAILED(hr)) {
+ qWarning("Failed to create root signature: %s", qPrintable(QSystemError::windowsComString(hr)));
+ return {};
+ }
+
+ return QD3D12RootSignature::addToPool(&rhiD->rootSignaturePool, rootSig);
+}
+
+// For shader model < 6.0 we do the same as the D3D11 backend: use the old
+// compiler (D3DCompile) to generate DXBC, just as qsb does (when -c is passed)
+// by invoking fxc, not dxc. For SM >= 6.0 we have to use the new compiler and
+// work with DXIL. And that involves IDxcCompiler and needs the presence of
+// dxcompiler.dll and dxil.dll at runtime. Plus there's a chance we have
+// ancient SDK headers when not using MSVC. So this is heavily optional,
+// meaning support for dxc can be disabled both at build time (no dxcapi.h) and
+// at run time (no DLLs).
+
+static inline void makeHlslTargetString(char target[7], const char stage[3], int version)
+{
+ const int smMajor = version / 10;
+ const int smMinor = version % 10;
+ target[0] = stage[0];
+ target[1] = stage[1];
+ target[2] = '_';
+ target[3] = '0' + smMajor;
+ target[4] = '_';
+ target[5] = '0' + smMinor;
+ target[6] = '\0';
+}
+
+enum class HlslCompileFlag
+{
+ WithDebugInfo = 0x01
+};
+
+static QByteArray legacyCompile(const QShaderCode &hlslSource, const char *target, int flags, QString *error)
+{
+ static const pD3DCompile d3dCompile = QRhiD3D::resolveD3DCompile();
+ if (!d3dCompile) {
+ qWarning("Unable to resolve function D3DCompile()");
+ return QByteArray();
+ }
+
+ ID3DBlob *bytecode = nullptr;
+ ID3DBlob *errors = nullptr;
+ UINT d3dCompileFlags = 0;
+ if (flags & int(HlslCompileFlag::WithDebugInfo))
+ d3dCompileFlags |= D3DCOMPILE_DEBUG;
+
+ HRESULT hr = d3dCompile(hlslSource.shader().constData(), SIZE_T(hlslSource.shader().size()),
+ nullptr, nullptr, nullptr,
+ hlslSource.entryPoint().constData(), target, d3dCompileFlags, 0, &bytecode, &errors);
+ if (FAILED(hr) || !bytecode) {
+ qWarning("HLSL shader compilation failed: 0x%x", uint(hr));
+ if (errors) {
+ *error = QString::fromUtf8(static_cast<const char *>(errors->GetBufferPointer()),
+ int(errors->GetBufferSize()));
+ errors->Release();
+ }
+ return QByteArray();
+ }
+
+ QByteArray result;
+ result.resize(int(bytecode->GetBufferSize()));
+ memcpy(result.data(), bytecode->GetBufferPointer(), size_t(result.size()));
+ bytecode->Release();
+ return result;
+}
+
+#ifdef QRHI_D3D12_HAS_DXC
+
+#ifndef DXC_CP_UTF8
+#define DXC_CP_UTF8 65001
+#endif
+
+#ifndef DXC_ARG_DEBUG
+#define DXC_ARG_DEBUG L"-Zi"
+#endif
+
+static QByteArray dxcCompile(const QShaderCode &hlslSource, const char *target, int flags, QString *error)
+{
+ static std::pair<IDxcCompiler *, IDxcLibrary *> dxc = QRhiD3D::createDxcCompiler();
+ IDxcCompiler *compiler = dxc.first;
+ if (!compiler) {
+ qWarning("Unable to instantiate IDxcCompiler. Likely no dxcompiler.dll and dxil.dll present. "
+ "Use windeployqt or try https://github.com/microsoft/DirectXShaderCompiler/releases");
+ return QByteArray();
+ }
+ IDxcLibrary *library = dxc.second;
+ if (!library)
+ return QByteArray();
+
+ IDxcBlobEncoding *sourceBlob = nullptr;
+ HRESULT hr = library->CreateBlobWithEncodingOnHeapCopy(hlslSource.shader().constData(),
+ UINT32(hlslSource.shader().size()),
+ DXC_CP_UTF8,
+ &sourceBlob);
+ if (FAILED(hr)) {
+ qWarning("Failed to create source blob for dxc: 0x%x (%s)",
+ uint(hr),
+ qPrintable(QSystemError::windowsComString(hr)));
+ return QByteArray();
+ }
+
+ const QString entryPointStr = QString::fromLatin1(hlslSource.entryPoint());
+ const QString targetStr = QString::fromLatin1(target);
+
+ QVarLengthArray<LPCWSTR, 4> argPtrs;
+ QString debugArg;
+ if (flags & int(HlslCompileFlag::WithDebugInfo)) {
+ debugArg = QString::fromUtf16(reinterpret_cast<const char16_t *>(DXC_ARG_DEBUG));
+ argPtrs.append(reinterpret_cast<LPCWSTR>(debugArg.utf16()));
+ }
+
+ IDxcOperationResult *result = nullptr;
+ hr = compiler->Compile(sourceBlob,
+ nullptr,
+ reinterpret_cast<LPCWSTR>(entryPointStr.utf16()),
+ reinterpret_cast<LPCWSTR>(targetStr.utf16()),
+ argPtrs.data(), argPtrs.count(),
+ nullptr, 0,
+ nullptr,
+ &result);
+ sourceBlob->Release();
+ if (SUCCEEDED(hr))
+ result->GetStatus(&hr);
+ if (FAILED(hr)) {
+ qWarning("HLSL shader compilation failed: 0x%x (%s)",
+ uint(hr),
+ qPrintable(QSystemError::windowsComString(hr)));
+ if (result) {
+ IDxcBlobEncoding *errorsBlob = nullptr;
+ if (SUCCEEDED(result->GetErrorBuffer(&errorsBlob))) {
+ if (errorsBlob) {
+ *error = QString::fromUtf8(static_cast<const char *>(errorsBlob->GetBufferPointer()),
+ int(errorsBlob->GetBufferSize()));
+ errorsBlob->Release();
+ }
+ }
+ }
+ return QByteArray();
+ }
+
+ IDxcBlob *bytecode = nullptr;
+ if FAILED(result->GetResult(&bytecode)) {
+ qWarning("No result from IDxcCompiler: 0x%x (%s)",
+ uint(hr),
+ qPrintable(QSystemError::windowsComString(hr)));
+ return QByteArray();
+ }
+
+ QByteArray ba;
+ ba.resize(int(bytecode->GetBufferSize()));
+ memcpy(ba.data(), bytecode->GetBufferPointer(), size_t(ba.size()));
+ bytecode->Release();
+ return ba;
+}
+
+#endif // QRHI_D3D12_HAS_DXC
+
+static QByteArray compileHlslShaderSource(const QShader &shader,
+ QShader::Variant shaderVariant,
+ int flags,
+ QString *error,
+ QShaderKey *usedShaderKey)
+{
+ // look for SM 6.7, 6.6, .., 5.0
+ const int shaderModelMax = 67;
+ for (int sm = shaderModelMax; sm >= 50; --sm) {
+ for (QShader::Source type : { QShader::DxilShader, QShader::DxbcShader }) {
+ QShaderKey key = { type, sm, shaderVariant };
+ QShaderCode intermediateBytecodeShader = shader.shader(key);
+ if (!intermediateBytecodeShader.shader().isEmpty()) {
+ if (usedShaderKey)
+ *usedShaderKey = key;
+ return intermediateBytecodeShader.shader();
+ }
+ }
+ }
+
+ QShaderCode hlslSource;
+ QShaderKey key;
+ for (int sm = shaderModelMax; sm >= 50; --sm) {
+ key = { QShader::HlslShader, sm, shaderVariant };
+ hlslSource = shader.shader(key);
+ if (!hlslSource.shader().isEmpty())
+ break;
+ }
+
+ if (hlslSource.shader().isEmpty()) {
+ qWarning() << "No HLSL (shader model 6.7..5.0) code found in baked shader" << shader;
+ return QByteArray();
+ }
+
+ if (usedShaderKey)
+ *usedShaderKey = key;
+
+ char target[7];
+ switch (shader.stage()) {
+ case QShader::VertexStage:
+ makeHlslTargetString(target, "vs", key.sourceVersion().version());
+ break;
+ case QShader::TessellationControlStage:
+ makeHlslTargetString(target, "hs", key.sourceVersion().version());
+ break;
+ case QShader::TessellationEvaluationStage:
+ makeHlslTargetString(target, "ds", key.sourceVersion().version());
+ break;
+ case QShader::GeometryStage:
+ makeHlslTargetString(target, "gs", key.sourceVersion().version());
+ break;
+ case QShader::FragmentStage:
+ makeHlslTargetString(target, "ps", key.sourceVersion().version());
+ break;
+ case QShader::ComputeStage:
+ makeHlslTargetString(target, "cs", key.sourceVersion().version());
+ break;
+ }
+
+ if (key.sourceVersion().version() >= 60) {
+#ifdef QRHI_D3D12_HAS_DXC
+ return dxcCompile(hlslSource, target, flags, error);
+#else
+ qWarning("Attempted to runtime-compile HLSL source code for shader model >= 6.0 "
+ "but the Qt build has no support for DXC. "
+ "Rebuild Qt with a recent Windows SDK or switch to an MSVC build.");
+#endif
+ }
+
+ return legacyCompile(hlslSource, target, flags, error);
+}
+
+static inline UINT8 toD3DColorWriteMask(QRhiGraphicsPipeline::ColorMask c)
+{
+ UINT8 f = 0;
+ if (c.testFlag(QRhiGraphicsPipeline::R))
+ f |= D3D12_COLOR_WRITE_ENABLE_RED;
+ if (c.testFlag(QRhiGraphicsPipeline::G))
+ f |= D3D12_COLOR_WRITE_ENABLE_GREEN;
+ if (c.testFlag(QRhiGraphicsPipeline::B))
+ f |= D3D12_COLOR_WRITE_ENABLE_BLUE;
+ if (c.testFlag(QRhiGraphicsPipeline::A))
+ f |= D3D12_COLOR_WRITE_ENABLE_ALPHA;
+ return f;
+}
+
+static inline D3D12_BLEND toD3DBlendFactor(QRhiGraphicsPipeline::BlendFactor f, bool rgb)
+{
+ // SrcBlendAlpha and DstBlendAlpha do not accept *_COLOR. With other APIs
+ // this is handled internally (so that e.g. VK_BLEND_FACTOR_SRC_COLOR is
+ // accepted and is in effect equivalent to VK_BLEND_FACTOR_SRC_ALPHA when
+ // set as an alpha src/dest factor), but for D3D we have to take care of it
+ // ourselves. Hence the rgb argument.
+
+ switch (f) {
+ case QRhiGraphicsPipeline::Zero:
+ return D3D12_BLEND_ZERO;
+ case QRhiGraphicsPipeline::One:
+ return D3D12_BLEND_ONE;
+ case QRhiGraphicsPipeline::SrcColor:
+ return rgb ? D3D12_BLEND_SRC_COLOR : D3D12_BLEND_SRC_ALPHA;
+ case QRhiGraphicsPipeline::OneMinusSrcColor:
+ return rgb ? D3D12_BLEND_INV_SRC_COLOR : D3D12_BLEND_INV_SRC_ALPHA;
+ case QRhiGraphicsPipeline::DstColor:
+ return rgb ? D3D12_BLEND_DEST_COLOR : D3D12_BLEND_DEST_ALPHA;
+ case QRhiGraphicsPipeline::OneMinusDstColor:
+ return rgb ? D3D12_BLEND_INV_DEST_COLOR : D3D12_BLEND_INV_DEST_ALPHA;
+ case QRhiGraphicsPipeline::SrcAlpha:
+ return D3D12_BLEND_SRC_ALPHA;
+ case QRhiGraphicsPipeline::OneMinusSrcAlpha:
+ return D3D12_BLEND_INV_SRC_ALPHA;
+ case QRhiGraphicsPipeline::DstAlpha:
+ return D3D12_BLEND_DEST_ALPHA;
+ case QRhiGraphicsPipeline::OneMinusDstAlpha:
+ return D3D12_BLEND_INV_DEST_ALPHA;
+ case QRhiGraphicsPipeline::ConstantColor:
+ case QRhiGraphicsPipeline::ConstantAlpha:
+ return D3D12_BLEND_BLEND_FACTOR;
+ case QRhiGraphicsPipeline::OneMinusConstantColor:
+ case QRhiGraphicsPipeline::OneMinusConstantAlpha:
+ return D3D12_BLEND_INV_BLEND_FACTOR;
+ case QRhiGraphicsPipeline::SrcAlphaSaturate:
+ return D3D12_BLEND_SRC_ALPHA_SAT;
+ case QRhiGraphicsPipeline::Src1Color:
+ return rgb ? D3D12_BLEND_SRC1_COLOR : D3D12_BLEND_SRC1_ALPHA;
+ case QRhiGraphicsPipeline::OneMinusSrc1Color:
+ return rgb ? D3D12_BLEND_INV_SRC1_COLOR : D3D12_BLEND_INV_SRC1_ALPHA;
+ case QRhiGraphicsPipeline::Src1Alpha:
+ return D3D12_BLEND_SRC1_ALPHA;
+ case QRhiGraphicsPipeline::OneMinusSrc1Alpha:
+ return D3D12_BLEND_INV_SRC1_ALPHA;
+ }
+ Q_UNREACHABLE_RETURN(D3D12_BLEND_ZERO);
+}
+
+static inline D3D12_BLEND_OP toD3DBlendOp(QRhiGraphicsPipeline::BlendOp op)
+{
+ switch (op) {
+ case QRhiGraphicsPipeline::Add:
+ return D3D12_BLEND_OP_ADD;
+ case QRhiGraphicsPipeline::Subtract:
+ return D3D12_BLEND_OP_SUBTRACT;
+ case QRhiGraphicsPipeline::ReverseSubtract:
+ return D3D12_BLEND_OP_REV_SUBTRACT;
+ case QRhiGraphicsPipeline::Min:
+ return D3D12_BLEND_OP_MIN;
+ case QRhiGraphicsPipeline::Max:
+ return D3D12_BLEND_OP_MAX;
+ }
+ Q_UNREACHABLE_RETURN(D3D12_BLEND_OP_ADD);
+}
+
+static inline D3D12_CULL_MODE toD3DCullMode(QRhiGraphicsPipeline::CullMode c)
+{
+ switch (c) {
+ case QRhiGraphicsPipeline::None:
+ return D3D12_CULL_MODE_NONE;
+ case QRhiGraphicsPipeline::Front:
+ return D3D12_CULL_MODE_FRONT;
+ case QRhiGraphicsPipeline::Back:
+ return D3D12_CULL_MODE_BACK;
+ }
+ Q_UNREACHABLE_RETURN(D3D12_CULL_MODE_NONE);
+}
+
+static inline D3D12_FILL_MODE toD3DFillMode(QRhiGraphicsPipeline::PolygonMode mode)
+{
+ switch (mode) {
+ case QRhiGraphicsPipeline::Fill:
+ return D3D12_FILL_MODE_SOLID;
+ case QRhiGraphicsPipeline::Line:
+ return D3D12_FILL_MODE_WIREFRAME;
+ }
+ Q_UNREACHABLE_RETURN(D3D12_FILL_MODE_SOLID);
+}
+
+static inline D3D12_COMPARISON_FUNC toD3DCompareOp(QRhiGraphicsPipeline::CompareOp op)
+{
+ switch (op) {
+ case QRhiGraphicsPipeline::Never:
+ return D3D12_COMPARISON_FUNC_NEVER;
+ case QRhiGraphicsPipeline::Less:
+ return D3D12_COMPARISON_FUNC_LESS;
+ case QRhiGraphicsPipeline::Equal:
+ return D3D12_COMPARISON_FUNC_EQUAL;
+ case QRhiGraphicsPipeline::LessOrEqual:
+ return D3D12_COMPARISON_FUNC_LESS_EQUAL;
+ case QRhiGraphicsPipeline::Greater:
+ return D3D12_COMPARISON_FUNC_GREATER;
+ case QRhiGraphicsPipeline::NotEqual:
+ return D3D12_COMPARISON_FUNC_NOT_EQUAL;
+ case QRhiGraphicsPipeline::GreaterOrEqual:
+ return D3D12_COMPARISON_FUNC_GREATER_EQUAL;
+ case QRhiGraphicsPipeline::Always:
+ return D3D12_COMPARISON_FUNC_ALWAYS;
+ }
+ Q_UNREACHABLE_RETURN(D3D12_COMPARISON_FUNC_ALWAYS);
+}
+
+static inline D3D12_STENCIL_OP toD3DStencilOp(QRhiGraphicsPipeline::StencilOp op)
+{
+ switch (op) {
+ case QRhiGraphicsPipeline::StencilZero:
+ return D3D12_STENCIL_OP_ZERO;
+ case QRhiGraphicsPipeline::Keep:
+ return D3D12_STENCIL_OP_KEEP;
+ case QRhiGraphicsPipeline::Replace:
+ return D3D12_STENCIL_OP_REPLACE;
+ case QRhiGraphicsPipeline::IncrementAndClamp:
+ return D3D12_STENCIL_OP_INCR_SAT;
+ case QRhiGraphicsPipeline::DecrementAndClamp:
+ return D3D12_STENCIL_OP_DECR_SAT;
+ case QRhiGraphicsPipeline::Invert:
+ return D3D12_STENCIL_OP_INVERT;
+ case QRhiGraphicsPipeline::IncrementAndWrap:
+ return D3D12_STENCIL_OP_INCR;
+ case QRhiGraphicsPipeline::DecrementAndWrap:
+ return D3D12_STENCIL_OP_DECR;
+ }
+ Q_UNREACHABLE_RETURN(D3D12_STENCIL_OP_KEEP);
+}
+
+static inline D3D12_PRIMITIVE_TOPOLOGY toD3DTopology(QRhiGraphicsPipeline::Topology t, int patchControlPointCount)
+{
+ switch (t) {
+ case QRhiGraphicsPipeline::Triangles:
+ return D3D_PRIMITIVE_TOPOLOGY_TRIANGLELIST;
+ case QRhiGraphicsPipeline::TriangleStrip:
+ return D3D_PRIMITIVE_TOPOLOGY_TRIANGLESTRIP;
+ case QRhiGraphicsPipeline::TriangleFan:
+ qWarning("Triangle fans are not supported with D3D");
+ return D3D_PRIMITIVE_TOPOLOGY_TRIANGLESTRIP;
+ case QRhiGraphicsPipeline::Lines:
+ return D3D_PRIMITIVE_TOPOLOGY_LINELIST;
+ case QRhiGraphicsPipeline::LineStrip:
+ return D3D_PRIMITIVE_TOPOLOGY_LINESTRIP;
+ case QRhiGraphicsPipeline::Points:
+ return D3D_PRIMITIVE_TOPOLOGY_POINTLIST;
+ case QRhiGraphicsPipeline::Patches:
+ Q_ASSERT(patchControlPointCount >= 1 && patchControlPointCount <= 32);
+ return D3D_PRIMITIVE_TOPOLOGY(D3D_PRIMITIVE_TOPOLOGY_1_CONTROL_POINT_PATCHLIST + (patchControlPointCount - 1));
+ }
+ Q_UNREACHABLE_RETURN(D3D_PRIMITIVE_TOPOLOGY_TRIANGLELIST);
+}
+
+static inline D3D12_PRIMITIVE_TOPOLOGY_TYPE toD3DTopologyType(QRhiGraphicsPipeline::Topology t)
+{
+ switch (t) {
+ case QRhiGraphicsPipeline::Triangles:
+ case QRhiGraphicsPipeline::TriangleStrip:
+ case QRhiGraphicsPipeline::TriangleFan:
+ return D3D12_PRIMITIVE_TOPOLOGY_TYPE_TRIANGLE;
+ case QRhiGraphicsPipeline::Lines:
+ case QRhiGraphicsPipeline::LineStrip:
+ return D3D12_PRIMITIVE_TOPOLOGY_TYPE_LINE;
+ case QRhiGraphicsPipeline::Points:
+ return D3D12_PRIMITIVE_TOPOLOGY_TYPE_POINT;
+ case QRhiGraphicsPipeline::Patches:
+ return D3D12_PRIMITIVE_TOPOLOGY_TYPE_PATCH;
+ }
+ Q_UNREACHABLE_RETURN(D3D12_PRIMITIVE_TOPOLOGY_TYPE_TRIANGLE);
+}
+
+static inline DXGI_FORMAT toD3DAttributeFormat(QRhiVertexInputAttribute::Format format)
+{
+ switch (format) {
+ case QRhiVertexInputAttribute::Float4:
+ return DXGI_FORMAT_R32G32B32A32_FLOAT;
+ case QRhiVertexInputAttribute::Float3:
+ return DXGI_FORMAT_R32G32B32_FLOAT;
+ case QRhiVertexInputAttribute::Float2:
+ return DXGI_FORMAT_R32G32_FLOAT;
+ case QRhiVertexInputAttribute::Float:
+ return DXGI_FORMAT_R32_FLOAT;
+ case QRhiVertexInputAttribute::UNormByte4:
+ return DXGI_FORMAT_R8G8B8A8_UNORM;
+ case QRhiVertexInputAttribute::UNormByte2:
+ return DXGI_FORMAT_R8G8_UNORM;
+ case QRhiVertexInputAttribute::UNormByte:
+ return DXGI_FORMAT_R8_UNORM;
+ case QRhiVertexInputAttribute::UInt4:
+ return DXGI_FORMAT_R32G32B32A32_UINT;
+ case QRhiVertexInputAttribute::UInt3:
+ return DXGI_FORMAT_R32G32B32_UINT;
+ case QRhiVertexInputAttribute::UInt2:
+ return DXGI_FORMAT_R32G32_UINT;
+ case QRhiVertexInputAttribute::UInt:
+ return DXGI_FORMAT_R32_UINT;
+ case QRhiVertexInputAttribute::SInt4:
+ return DXGI_FORMAT_R32G32B32A32_SINT;
+ case QRhiVertexInputAttribute::SInt3:
+ return DXGI_FORMAT_R32G32B32_SINT;
+ case QRhiVertexInputAttribute::SInt2:
+ return DXGI_FORMAT_R32G32_SINT;
+ case QRhiVertexInputAttribute::SInt:
+ return DXGI_FORMAT_R32_SINT;
+ case QRhiVertexInputAttribute::Half4:
+ // Note: D3D does not support half3. Pass through half3 as half4.
+ case QRhiVertexInputAttribute::Half3:
+ return DXGI_FORMAT_R16G16B16A16_FLOAT;
+ case QRhiVertexInputAttribute::Half2:
+ return DXGI_FORMAT_R16G16_FLOAT;
+ case QRhiVertexInputAttribute::Half:
+ return DXGI_FORMAT_R16_FLOAT;
+ case QRhiVertexInputAttribute::UShort4:
+ // Note: D3D does not support UShort3. Pass through UShort3 as UShort4.
+ case QRhiVertexInputAttribute::UShort3:
+ return DXGI_FORMAT_R16G16B16A16_UINT;
+ case QRhiVertexInputAttribute::UShort2:
+ return DXGI_FORMAT_R16G16_UINT;
+ case QRhiVertexInputAttribute::UShort:
+ return DXGI_FORMAT_R16_UINT;
+ case QRhiVertexInputAttribute::SShort4:
+ // Note: D3D does not support SShort3. Pass through SShort3 as SShort4.
+ case QRhiVertexInputAttribute::SShort3:
+ return DXGI_FORMAT_R16G16B16A16_SINT;
+ case QRhiVertexInputAttribute::SShort2:
+ return DXGI_FORMAT_R16G16_SINT;
+ case QRhiVertexInputAttribute::SShort:
+ return DXGI_FORMAT_R16_SINT;
+ }
+ Q_UNREACHABLE_RETURN(DXGI_FORMAT_R32G32B32A32_FLOAT);
+}
+
+QD3D12GraphicsPipeline::QD3D12GraphicsPipeline(QRhiImplementation *rhi)
+ : QRhiGraphicsPipeline(rhi)
+{
+}
+
+QD3D12GraphicsPipeline::~QD3D12GraphicsPipeline()
+{
+ destroy();
+}
+
+void QD3D12GraphicsPipeline::destroy()
+{
+ if (handle.isNull())
+ return;
+
+ QRHI_RES_RHI(QRhiD3D12);
+ if (rhiD) {
+ rhiD->releaseQueue.deferredReleasePipeline(handle);
+ rhiD->releaseQueue.deferredReleaseRootSignature(rootSigHandle);
+ }
+
+ handle = {};
+ stageData = {};
+
+ if (rhiD)
+ rhiD->unregisterResource(this);
+}
+
+bool QD3D12GraphicsPipeline::create()
+{
+ if (!handle.isNull())
+ destroy();
+
+ QRHI_RES_RHI(QRhiD3D12);
+ if (!rhiD->sanityCheckGraphicsPipeline(this))
+ return false;
+
+ rhiD->pipelineCreationStart();
+
+ QByteArray shaderBytecode[5];
+ for (const QRhiShaderStage &shaderStage : std::as_const(m_shaderStages)) {
+ const QD3D12Stage d3dStage = qd3d12_stage(shaderStage.type());
+ stageData[d3dStage].valid = true;
+ stageData[d3dStage].stage = d3dStage;
+ auto cacheIt = rhiD->shaderBytecodeCache.data.constFind(shaderStage);
+ if (cacheIt != rhiD->shaderBytecodeCache.data.constEnd()) {
+ shaderBytecode[d3dStage] = cacheIt->bytecode;
+ stageData[d3dStage].nativeResourceBindingMap = cacheIt->nativeResourceBindingMap;
+ } else {
+ QString error;
+ QShaderKey shaderKey;
+ int compileFlags = 0;
+ if (m_flags.testFlag(CompileShadersWithDebugInfo))
+ compileFlags |= int(HlslCompileFlag::WithDebugInfo);
+ const QByteArray bytecode = compileHlslShaderSource(shaderStage.shader(),
+ shaderStage.shaderVariant(),
+ compileFlags,
+ &error,
+ &shaderKey);
+ if (bytecode.isEmpty()) {
+ qWarning("HLSL graphics shader compilation failed: %s", qPrintable(error));
+ return false;
+ }
+
+ shaderBytecode[d3dStage] = bytecode;
+ stageData[d3dStage].nativeResourceBindingMap = shaderStage.shader().nativeResourceBindingMap(shaderKey);
+ rhiD->shaderBytecodeCache.insertWithCapacityLimit(shaderStage,
+ { bytecode, stageData[d3dStage].nativeResourceBindingMap });
+ }
+ }
+
+ QD3D12ShaderResourceBindings *srbD = QRHI_RES(QD3D12ShaderResourceBindings, m_shaderResourceBindings);
+ if (srbD) {
+ rootSigHandle = srbD->createRootSignature(stageData.data(), 5);
+ if (rootSigHandle.isNull()) {
+ qWarning("Failed to create root signature");
+ return false;
+ }
+ }
+ ID3D12RootSignature *rootSig = nullptr;
+ if (QD3D12RootSignature *rs = rhiD->rootSignaturePool.lookupRef(rootSigHandle))
+ rootSig = rs->rootSig;
+ if (!rootSig) {
+ qWarning("Cannot create graphics pipeline state without root signature");
+ return false;
+ }
+
+ QD3D12RenderPassDescriptor *rpD = QRHI_RES(QD3D12RenderPassDescriptor, m_renderPassDesc);
+ const DXGI_SAMPLE_DESC sampleDesc = rhiD->effectiveSampleDesc(m_sampleCount, DXGI_FORMAT(rpD->colorFormat[0]));
+
+ struct {
+ QD3D12PipelineStateSubObject<ID3D12RootSignature *, D3D12_PIPELINE_STATE_SUBOBJECT_TYPE_ROOT_SIGNATURE> rootSig;
+ QD3D12PipelineStateSubObject<D3D12_INPUT_LAYOUT_DESC, D3D12_PIPELINE_STATE_SUBOBJECT_TYPE_INPUT_LAYOUT> inputLayout;
+ QD3D12PipelineStateSubObject<D3D12_PRIMITIVE_TOPOLOGY_TYPE, D3D12_PIPELINE_STATE_SUBOBJECT_TYPE_PRIMITIVE_TOPOLOGY> primitiveTopology;
+ QD3D12PipelineStateSubObject<D3D12_SHADER_BYTECODE, D3D12_PIPELINE_STATE_SUBOBJECT_TYPE_VS> VS;
+ QD3D12PipelineStateSubObject<D3D12_SHADER_BYTECODE, D3D12_PIPELINE_STATE_SUBOBJECT_TYPE_HS> HS;
+ QD3D12PipelineStateSubObject<D3D12_SHADER_BYTECODE, D3D12_PIPELINE_STATE_SUBOBJECT_TYPE_DS> DS;
+ QD3D12PipelineStateSubObject<D3D12_SHADER_BYTECODE, D3D12_PIPELINE_STATE_SUBOBJECT_TYPE_GS> GS;
+ QD3D12PipelineStateSubObject<D3D12_SHADER_BYTECODE, D3D12_PIPELINE_STATE_SUBOBJECT_TYPE_PS> PS;
+ QD3D12PipelineStateSubObject<D3D12_RASTERIZER_DESC, D3D12_PIPELINE_STATE_SUBOBJECT_TYPE_RASTERIZER> rasterizerState;
+ QD3D12PipelineStateSubObject<D3D12_DEPTH_STENCIL_DESC, D3D12_PIPELINE_STATE_SUBOBJECT_TYPE_DEPTH_STENCIL> depthStencilState;
+ QD3D12PipelineStateSubObject<D3D12_BLEND_DESC, D3D12_PIPELINE_STATE_SUBOBJECT_TYPE_BLEND> blendState;
+ QD3D12PipelineStateSubObject<D3D12_RT_FORMAT_ARRAY, D3D12_PIPELINE_STATE_SUBOBJECT_TYPE_RENDER_TARGET_FORMATS> rtFormats;
+ QD3D12PipelineStateSubObject<DXGI_FORMAT, D3D12_PIPELINE_STATE_SUBOBJECT_TYPE_DEPTH_STENCIL_FORMAT> dsFormat;
+ QD3D12PipelineStateSubObject<DXGI_SAMPLE_DESC, D3D12_PIPELINE_STATE_SUBOBJECT_TYPE_SAMPLE_DESC> sampleDesc;
+ QD3D12PipelineStateSubObject<UINT, D3D12_PIPELINE_STATE_SUBOBJECT_TYPE_SAMPLE_MASK> sampleMask;
+ QD3D12PipelineStateSubObject<D3D12_VIEW_INSTANCING_DESC, D3D12_PIPELINE_STATE_SUBOBJECT_TYPE_VIEW_INSTANCING> viewInstancingDesc;
+ } stream;
+
+ stream.rootSig.object = rootSig;
+
+ QVarLengthArray<D3D12_INPUT_ELEMENT_DESC, 4> inputDescs;
+ QByteArrayList matrixSliceSemantics;
+ if (!shaderBytecode[VS].isEmpty()) {
+ for (auto it = m_vertexInputLayout.cbeginAttributes(), itEnd = m_vertexInputLayout.cendAttributes();
+ it != itEnd; ++it)
+ {
+ D3D12_INPUT_ELEMENT_DESC desc = {};
+ // The output from SPIRV-Cross uses TEXCOORD<location> as the
+ // semantic, except for matrices that are unrolled into consecutive
+ // vec2/3/4s attributes and need TEXCOORD<location>_ as
+ // SemanticName and row/column index as SemanticIndex.
+ const int matrixSlice = it->matrixSlice();
+ if (matrixSlice < 0) {
+ desc.SemanticName = "TEXCOORD";
+ desc.SemanticIndex = UINT(it->location());
+ } else {
+ QByteArray sem;
+ sem.resize(16);
+ qsnprintf(sem.data(), sem.size(), "TEXCOORD%d_", it->location() - matrixSlice);
+ matrixSliceSemantics.append(sem);
+ desc.SemanticName = matrixSliceSemantics.last().constData();
+ desc.SemanticIndex = UINT(matrixSlice);
+ }
+ desc.Format = toD3DAttributeFormat(it->format());
+ desc.InputSlot = UINT(it->binding());
+ desc.AlignedByteOffset = it->offset();
+ const QRhiVertexInputBinding *inputBinding = m_vertexInputLayout.bindingAt(it->binding());
+ if (inputBinding->classification() == QRhiVertexInputBinding::PerInstance) {
+ desc.InputSlotClass = D3D12_INPUT_CLASSIFICATION_PER_INSTANCE_DATA;
+ desc.InstanceDataStepRate = inputBinding->instanceStepRate();
+ } else {
+ desc.InputSlotClass = D3D12_INPUT_CLASSIFICATION_PER_VERTEX_DATA;
+ }
+ inputDescs.append(desc);
+ }
+ }
+
+ stream.inputLayout.object.NumElements = inputDescs.count();
+ stream.inputLayout.object.pInputElementDescs = inputDescs.isEmpty() ? nullptr : inputDescs.constData();
+
+ stream.primitiveTopology.object = toD3DTopologyType(m_topology);
+ topology = toD3DTopology(m_topology, m_patchControlPointCount);
+
+ for (const QRhiShaderStage &shaderStage : std::as_const(m_shaderStages)) {
+ const int d3dStage = qd3d12_stage(shaderStage.type());
+ switch (d3dStage) {
+ case VS:
+ stream.VS.object.pShaderBytecode = shaderBytecode[d3dStage].constData();
+ stream.VS.object.BytecodeLength = shaderBytecode[d3dStage].size();
+ break;
+ case HS:
+ stream.HS.object.pShaderBytecode = shaderBytecode[d3dStage].constData();
+ stream.HS.object.BytecodeLength = shaderBytecode[d3dStage].size();
+ break;
+ case DS:
+ stream.DS.object.pShaderBytecode = shaderBytecode[d3dStage].constData();
+ stream.DS.object.BytecodeLength = shaderBytecode[d3dStage].size();
+ break;
+ case GS:
+ stream.GS.object.pShaderBytecode = shaderBytecode[d3dStage].constData();
+ stream.GS.object.BytecodeLength = shaderBytecode[d3dStage].size();
+ break;
+ case PS:
+ stream.PS.object.pShaderBytecode = shaderBytecode[d3dStage].constData();
+ stream.PS.object.BytecodeLength = shaderBytecode[d3dStage].size();
+ break;
+ default:
+ Q_UNREACHABLE();
+ break;
+ }
+ }
+
+ stream.rasterizerState.object.FillMode = toD3DFillMode(m_polygonMode);
+ stream.rasterizerState.object.CullMode = toD3DCullMode(m_cullMode);
+ stream.rasterizerState.object.FrontCounterClockwise = m_frontFace == CCW;
+ stream.rasterizerState.object.DepthBias = m_depthBias;
+ stream.rasterizerState.object.SlopeScaledDepthBias = m_slopeScaledDepthBias;
+ stream.rasterizerState.object.DepthClipEnable = TRUE;
+ stream.rasterizerState.object.MultisampleEnable = sampleDesc.Count > 1;
+
+ stream.depthStencilState.object.DepthEnable = m_depthTest;
+ stream.depthStencilState.object.DepthWriteMask = m_depthWrite ? D3D12_DEPTH_WRITE_MASK_ALL : D3D12_DEPTH_WRITE_MASK_ZERO;
+ stream.depthStencilState.object.DepthFunc = toD3DCompareOp(m_depthOp);
+ stream.depthStencilState.object.StencilEnable = m_stencilTest;
+ if (m_stencilTest) {
+ stream.depthStencilState.object.StencilReadMask = UINT8(m_stencilReadMask);
+ stream.depthStencilState.object.StencilWriteMask = UINT8(m_stencilWriteMask);
+ stream.depthStencilState.object.FrontFace.StencilFailOp = toD3DStencilOp(m_stencilFront.failOp);
+ stream.depthStencilState.object.FrontFace.StencilDepthFailOp = toD3DStencilOp(m_stencilFront.depthFailOp);
+ stream.depthStencilState.object.FrontFace.StencilPassOp = toD3DStencilOp(m_stencilFront.passOp);
+ stream.depthStencilState.object.FrontFace.StencilFunc = toD3DCompareOp(m_stencilFront.compareOp);
+ stream.depthStencilState.object.BackFace.StencilFailOp = toD3DStencilOp(m_stencilBack.failOp);
+ stream.depthStencilState.object.BackFace.StencilDepthFailOp = toD3DStencilOp(m_stencilBack.depthFailOp);
+ stream.depthStencilState.object.BackFace.StencilPassOp = toD3DStencilOp(m_stencilBack.passOp);
+ stream.depthStencilState.object.BackFace.StencilFunc = toD3DCompareOp(m_stencilBack.compareOp);
+ }
+
+ stream.blendState.object.IndependentBlendEnable = m_targetBlends.count() > 1;
+ for (int i = 0, ie = m_targetBlends.count(); i != ie; ++i) {
+ const QRhiGraphicsPipeline::TargetBlend &b(m_targetBlends[i]);
+ D3D12_RENDER_TARGET_BLEND_DESC blend = {};
+ blend.BlendEnable = b.enable;
+ blend.SrcBlend = toD3DBlendFactor(b.srcColor, true);
+ blend.DestBlend = toD3DBlendFactor(b.dstColor, true);
+ blend.BlendOp = toD3DBlendOp(b.opColor);
+ blend.SrcBlendAlpha = toD3DBlendFactor(b.srcAlpha, false);
+ blend.DestBlendAlpha = toD3DBlendFactor(b.dstAlpha, false);
+ blend.BlendOpAlpha = toD3DBlendOp(b.opAlpha);
+ blend.RenderTargetWriteMask = toD3DColorWriteMask(b.colorWrite);
+ stream.blendState.object.RenderTarget[i] = blend;
+ }
+ if (m_targetBlends.isEmpty()) {
+ D3D12_RENDER_TARGET_BLEND_DESC blend = {};
+ blend.RenderTargetWriteMask = D3D12_COLOR_WRITE_ENABLE_ALL;
+ stream.blendState.object.RenderTarget[0] = blend;
+ }
+
+ stream.rtFormats.object.NumRenderTargets = rpD->colorAttachmentCount;
+ for (int i = 0; i < rpD->colorAttachmentCount; ++i)
+ stream.rtFormats.object.RTFormats[i] = DXGI_FORMAT(rpD->colorFormat[i]);
+
+ stream.dsFormat.object = rpD->hasDepthStencil ? DXGI_FORMAT(rpD->dsFormat) : DXGI_FORMAT_UNKNOWN;
+
+ stream.sampleDesc.object = sampleDesc;
+
+ stream.sampleMask.object = 0xFFFFFFFF;
+
+ viewInstanceMask = 0;
+ const bool isMultiView = m_multiViewCount >= 2;
+ stream.viewInstancingDesc.object.ViewInstanceCount = isMultiView ? m_multiViewCount : 0;
+ QVarLengthArray<D3D12_VIEW_INSTANCE_LOCATION, 4> viewInstanceLocations;
+ if (isMultiView) {
+ for (int i = 0; i < m_multiViewCount; ++i) {
+ viewInstanceMask |= (1 << i);
+ viewInstanceLocations.append({ 0, UINT(i) });
+ }
+ stream.viewInstancingDesc.object.pViewInstanceLocations = viewInstanceLocations.constData();
+ }
+
+ const D3D12_PIPELINE_STATE_STREAM_DESC streamDesc = { sizeof(stream), &stream };
+
+ ID3D12PipelineState *pso = nullptr;
+ HRESULT hr = rhiD->dev->CreatePipelineState(&streamDesc, __uuidof(ID3D12PipelineState), reinterpret_cast<void **>(&pso));
+ if (FAILED(hr)) {
+ qWarning("Failed to create graphics pipeline state: %s",
+ qPrintable(QSystemError::windowsComString(hr)));
+ rhiD->rootSignaturePool.remove(rootSigHandle);
+ rootSigHandle = {};
+ return false;
+ }
+
+ handle = QD3D12Pipeline::addToPool(&rhiD->pipelinePool, QD3D12Pipeline::Graphics, pso);
+
+ rhiD->pipelineCreationEnd();
+ generation += 1;
+ rhiD->registerResource(this);
+ return true;
+}
+
+QD3D12ComputePipeline::QD3D12ComputePipeline(QRhiImplementation *rhi)
+ : QRhiComputePipeline(rhi)
+{
+}
+
+QD3D12ComputePipeline::~QD3D12ComputePipeline()
+{
+ destroy();
+}
+
+void QD3D12ComputePipeline::destroy()
+{
+ if (handle.isNull())
+ return;
+
+ QRHI_RES_RHI(QRhiD3D12);
+ if (rhiD) {
+ rhiD->releaseQueue.deferredReleasePipeline(handle);
+ rhiD->releaseQueue.deferredReleaseRootSignature(rootSigHandle);
+ }
+
+ handle = {};
+ stageData = {};
+
+ if (rhiD)
+ rhiD->unregisterResource(this);
+}
+
+bool QD3D12ComputePipeline::create()
+{
+ if (!handle.isNull())
+ destroy();
+
+ QRHI_RES_RHI(QRhiD3D12);
+ rhiD->pipelineCreationStart();
+
+ stageData.valid = true;
+ stageData.stage = CS;
+
+ QByteArray shaderBytecode;
+ auto cacheIt = rhiD->shaderBytecodeCache.data.constFind(m_shaderStage);
+ if (cacheIt != rhiD->shaderBytecodeCache.data.constEnd()) {
+ shaderBytecode = cacheIt->bytecode;
+ stageData.nativeResourceBindingMap = cacheIt->nativeResourceBindingMap;
+ } else {
+ QString error;
+ QShaderKey shaderKey;
+ int compileFlags = 0;
+ if (m_flags.testFlag(CompileShadersWithDebugInfo))
+ compileFlags |= int(HlslCompileFlag::WithDebugInfo);
+ const QByteArray bytecode = compileHlslShaderSource(m_shaderStage.shader(),
+ m_shaderStage.shaderVariant(),
+ compileFlags,
+ &error,
+ &shaderKey);
+ if (bytecode.isEmpty()) {
+ qWarning("HLSL compute shader compilation failed: %s", qPrintable(error));
+ return false;
+ }
+
+ shaderBytecode = bytecode;
+ stageData.nativeResourceBindingMap = m_shaderStage.shader().nativeResourceBindingMap(shaderKey);
+ rhiD->shaderBytecodeCache.insertWithCapacityLimit(m_shaderStage, { bytecode,
+ stageData.nativeResourceBindingMap });
+ }
+
+ QD3D12ShaderResourceBindings *srbD = QRHI_RES(QD3D12ShaderResourceBindings, m_shaderResourceBindings);
+ if (srbD) {
+ rootSigHandle = srbD->createRootSignature(&stageData, 1);
+ if (rootSigHandle.isNull()) {
+ qWarning("Failed to create root signature");
+ return false;
+ }
+ }
+ ID3D12RootSignature *rootSig = nullptr;
+ if (QD3D12RootSignature *rs = rhiD->rootSignaturePool.lookupRef(rootSigHandle))
+ rootSig = rs->rootSig;
+ if (!rootSig) {
+ qWarning("Cannot create compute pipeline state without root signature");
+ return false;
+ }
+
+ struct {
+ QD3D12PipelineStateSubObject<ID3D12RootSignature *, D3D12_PIPELINE_STATE_SUBOBJECT_TYPE_ROOT_SIGNATURE> rootSig;
+ QD3D12PipelineStateSubObject<D3D12_SHADER_BYTECODE, D3D12_PIPELINE_STATE_SUBOBJECT_TYPE_CS> CS;
+ } stream;
+ stream.rootSig.object = rootSig;
+ stream.CS.object.pShaderBytecode = shaderBytecode.constData();
+ stream.CS.object.BytecodeLength = shaderBytecode.size();
+ const D3D12_PIPELINE_STATE_STREAM_DESC streamDesc = { sizeof(stream), &stream };
+ ID3D12PipelineState *pso = nullptr;
+ HRESULT hr = rhiD->dev->CreatePipelineState(&streamDesc, __uuidof(ID3D12PipelineState), reinterpret_cast<void **>(&pso));
+ if (FAILED(hr)) {
+ qWarning("Failed to create compute pipeline state: %s",
+ qPrintable(QSystemError::windowsComString(hr)));
+ rhiD->rootSignaturePool.remove(rootSigHandle);
+ rootSigHandle = {};
+ return false;
+ }
+
+ handle = QD3D12Pipeline::addToPool(&rhiD->pipelinePool, QD3D12Pipeline::Compute, pso);
+
+ rhiD->pipelineCreationEnd();
+ generation += 1;
+ rhiD->registerResource(this);
+ return true;
+}
+
+// This is a lot like in the Metal backend: we need to now the rtv and dsv
+// formats to create a graphics pipeline, and that's exactly what our
+// "renderpass descriptor" is going to hold.
+QD3D12RenderPassDescriptor::QD3D12RenderPassDescriptor(QRhiImplementation *rhi)
+ : QRhiRenderPassDescriptor(rhi)
+{
+ serializedFormatData.reserve(16);
+}
+
+QD3D12RenderPassDescriptor::~QD3D12RenderPassDescriptor()
+{
+ destroy();
+}
+
+void QD3D12RenderPassDescriptor::destroy()
+{
+ QRHI_RES_RHI(QRhiD3D12);
+ if (rhiD)
+ rhiD->unregisterResource(this);
+}
+
+bool QD3D12RenderPassDescriptor::isCompatible(const QRhiRenderPassDescriptor *other) const
+{
+ if (!other)
+ return false;
+
+ const QD3D12RenderPassDescriptor *o = QRHI_RES(const QD3D12RenderPassDescriptor, other);
+
+ if (colorAttachmentCount != o->colorAttachmentCount)
+ return false;
+
+ if (hasDepthStencil != o->hasDepthStencil)
+ return false;
+
+ for (int i = 0; i < colorAttachmentCount; ++i) {
+ if (colorFormat[i] != o->colorFormat[i])
+ return false;
+ }
+
+ if (hasDepthStencil) {
+ if (dsFormat != o->dsFormat)
+ return false;
+ }
+
+ return true;
+}
+
+void QD3D12RenderPassDescriptor::updateSerializedFormat()
+{
+ serializedFormatData.clear();
+ auto p = std::back_inserter(serializedFormatData);
+
+ *p++ = colorAttachmentCount;
+ *p++ = hasDepthStencil;
+ for (int i = 0; i < colorAttachmentCount; ++i)
+ *p++ = colorFormat[i];
+ *p++ = hasDepthStencil ? dsFormat : 0;
+}
+
+QRhiRenderPassDescriptor *QD3D12RenderPassDescriptor::newCompatibleRenderPassDescriptor() const
+{
+ QD3D12RenderPassDescriptor *rpD = new QD3D12RenderPassDescriptor(m_rhi);
+ rpD->colorAttachmentCount = colorAttachmentCount;
+ rpD->hasDepthStencil = hasDepthStencil;
+ memcpy(rpD->colorFormat, colorFormat, sizeof(colorFormat));
+ rpD->dsFormat = dsFormat;
+
+ rpD->updateSerializedFormat();
+
+ QRHI_RES_RHI(QRhiD3D12);
+ rhiD->registerResource(rpD);
+ return rpD;
+}
+
+QVector<quint32> QD3D12RenderPassDescriptor::serializedFormat() const
+{
+ return serializedFormatData;
+}
+
+QD3D12CommandBuffer::QD3D12CommandBuffer(QRhiImplementation *rhi)
+ : QRhiCommandBuffer(rhi)
+{
+ resetState();
+}
+
+QD3D12CommandBuffer::~QD3D12CommandBuffer()
+{
+ destroy();
+}
+
+void QD3D12CommandBuffer::destroy()
+{
+ // nothing to do here, the command list is not owned by us
+}
+
+const QRhiNativeHandles *QD3D12CommandBuffer::nativeHandles()
+{
+ nativeHandlesStruct.commandList = cmdList;
+ return &nativeHandlesStruct;
+}
+
+QD3D12SwapChainRenderTarget::QD3D12SwapChainRenderTarget(QRhiImplementation *rhi, QRhiSwapChain *swapchain)
+ : QRhiSwapChainRenderTarget(rhi, swapchain),
+ d(rhi)
+{
+}
+
+QD3D12SwapChainRenderTarget::~QD3D12SwapChainRenderTarget()
+{
+ destroy();
+}
+
+void QD3D12SwapChainRenderTarget::destroy()
+{
+ // nothing to do here
+}
+
+QSize QD3D12SwapChainRenderTarget::pixelSize() const
+{
+ return d.pixelSize;
+}
+
+float QD3D12SwapChainRenderTarget::devicePixelRatio() const
+{
+ return d.dpr;
+}
+
+int QD3D12SwapChainRenderTarget::sampleCount() const
+{
+ return d.sampleCount;
+}
+
+QD3D12SwapChain::QD3D12SwapChain(QRhiImplementation *rhi)
+ : QRhiSwapChain(rhi),
+ rtWrapper(rhi, this),
+ rtWrapperRight(rhi, this),
+ cbWrapper(rhi)
+{
+}
+
+QD3D12SwapChain::~QD3D12SwapChain()
+{
+ destroy();
+}
+
+void QD3D12SwapChain::destroy()
+{
+ if (!swapChain)
+ return;
+
+ releaseBuffers();
+
+ swapChain->Release();
+ swapChain = nullptr;
+ sourceSwapChain1->Release();
+ sourceSwapChain1 = nullptr;
+
+ for (int i = 0; i < QD3D12_FRAMES_IN_FLIGHT; ++i) {
+ FrameResources &fr(frameRes[i]);
+ if (fr.fence)
+ fr.fence->Release();
+ if (fr.fenceEvent)
+ CloseHandle(fr.fenceEvent);
+ if (fr.cmdList)
+ fr.cmdList->Release();
+ fr = {};
+ }
+
+ if (dcompVisual) {
+ dcompVisual->Release();
+ dcompVisual = nullptr;
+ }
+
+ if (dcompTarget) {
+ dcompTarget->Release();
+ dcompTarget = nullptr;
+ }
+
+ QRHI_RES_RHI(QRhiD3D12);
+ if (rhiD) {
+ rhiD->swapchains.remove(this);
+ rhiD->unregisterResource(this);
+ }
+}
+
+void QD3D12SwapChain::releaseBuffers()
+{
+ QRHI_RES_RHI(QRhiD3D12);
+ rhiD->waitGpu();
+ for (UINT i = 0; i < BUFFER_COUNT; ++i) {
+ rhiD->resourcePool.remove(colorBuffers[i]);
+ rhiD->rtvPool.release(rtvs[i], 1);
+ if (stereo)
+ rhiD->rtvPool.release(rtvsRight[i], 1);
+ if (!msaaBuffers[i].isNull())
+ rhiD->resourcePool.remove(msaaBuffers[i]);
+ if (msaaRtvs[i].isValid())
+ rhiD->rtvPool.release(msaaRtvs[i], 1);
+ }
+}
+
+void QD3D12SwapChain::waitCommandCompletionForFrameSlot(int frameSlot)
+{
+ FrameResources &fr(frameRes[frameSlot]);
+ if (fr.fence->GetCompletedValue() < fr.fenceCounter) {
+ fr.fence->SetEventOnCompletion(fr.fenceCounter, fr.fenceEvent);
+ WaitForSingleObject(fr.fenceEvent, INFINITE);
+ }
+}
+
+void QD3D12SwapChain::addCommandCompletionSignalForCurrentFrameSlot()
+{
+ QRHI_RES_RHI(QRhiD3D12);
+ FrameResources &fr(frameRes[currentFrameSlot]);
+ fr.fenceCounter += 1u;
+ rhiD->cmdQueue->Signal(fr.fence, fr.fenceCounter);
+}
+
+QRhiCommandBuffer *QD3D12SwapChain::currentFrameCommandBuffer()
+{
+ return &cbWrapper;
+}
+
+QRhiRenderTarget *QD3D12SwapChain::currentFrameRenderTarget()
+{
+ return &rtWrapper;
+}
+
+QRhiRenderTarget *QD3D12SwapChain::currentFrameRenderTarget(StereoTargetBuffer targetBuffer)
+{
+ return !stereo || targetBuffer == StereoTargetBuffer::LeftBuffer ? &rtWrapper : &rtWrapperRight;
+}
+
+QSize QD3D12SwapChain::surfacePixelSize()
+{
+ Q_ASSERT(m_window);
+ return m_window->size() * m_window->devicePixelRatio();
+}
+
+bool QD3D12SwapChain::isFormatSupported(Format f)
+{
+ if (f == SDR)
+ return true;
+
+ if (!m_window) {
+ qWarning("Attempted to call isFormatSupported() without a window set");
+ return false;
+ }
+
+ QRHI_RES_RHI(QRhiD3D12);
+ DXGI_OUTPUT_DESC1 desc1;
+ if (QRhiD3D::outputDesc1ForWindow(m_window, rhiD->activeAdapter, &desc1)) {
+ if (desc1.ColorSpace == DXGI_COLOR_SPACE_RGB_FULL_G2084_NONE_P2020)
+ return f == QRhiSwapChain::HDRExtendedSrgbLinear || f == QRhiSwapChain::HDR10;
+ }
+
+ return false;
+}
+
+QRhiSwapChainHdrInfo QD3D12SwapChain::hdrInfo()
+{
+ QRhiSwapChainHdrInfo info = QRhiSwapChain::hdrInfo();
+ // Must use m_window, not window, given this may be called before createOrResize().
+ if (m_window) {
+ QRHI_RES_RHI(QRhiD3D12);
+ DXGI_OUTPUT_DESC1 hdrOutputDesc;
+ if (QRhiD3D::outputDesc1ForWindow(m_window, rhiD->activeAdapter, &hdrOutputDesc)) {
+ info.limitsType = QRhiSwapChainHdrInfo::LuminanceInNits;
+ info.limits.luminanceInNits.minLuminance = hdrOutputDesc.MinLuminance;
+ info.limits.luminanceInNits.maxLuminance = hdrOutputDesc.MaxLuminance;
+ info.luminanceBehavior = QRhiSwapChainHdrInfo::SceneReferred; // 1.0 = 80 nits
+ info.sdrWhiteLevel = QRhiD3D::sdrWhiteLevelInNits(hdrOutputDesc);
+ }
+ }
+ return info;
+}
+
+QRhiRenderPassDescriptor *QD3D12SwapChain::newCompatibleRenderPassDescriptor()
+{
+ // not yet built so cannot rely on data computed in createOrResize()
+ chooseFormats();
+
+ QD3D12RenderPassDescriptor *rpD = new QD3D12RenderPassDescriptor(m_rhi);
+ rpD->colorAttachmentCount = 1;
+ rpD->hasDepthStencil = m_depthStencil != nullptr;
+ rpD->colorFormat[0] = int(srgbAdjustedColorFormat);
+ rpD->dsFormat = QD3D12RenderBuffer::DS_FORMAT;
+ rpD->updateSerializedFormat();
+
+ QRHI_RES_RHI(QRhiD3D12);
+ rhiD->registerResource(rpD);
+ return rpD;
+}
+
+bool QRhiD3D12::ensureDirectCompositionDevice()
+{
+ if (dcompDevice)
+ return true;
+
+ qCDebug(QRHI_LOG_INFO, "Creating Direct Composition device (needed for semi-transparent windows)");
+ dcompDevice = QRhiD3D::createDirectCompositionDevice();
+ return dcompDevice ? true : false;
+}
+
+static const DXGI_FORMAT DEFAULT_FORMAT = DXGI_FORMAT_R8G8B8A8_UNORM;
+static const DXGI_FORMAT DEFAULT_SRGB_FORMAT = DXGI_FORMAT_R8G8B8A8_UNORM_SRGB;
+
+void QD3D12SwapChain::chooseFormats()
+{
+ colorFormat = DEFAULT_FORMAT;
+ srgbAdjustedColorFormat = m_flags.testFlag(sRGB) ? DEFAULT_SRGB_FORMAT : DEFAULT_FORMAT;
+ hdrColorSpace = DXGI_COLOR_SPACE_RGB_FULL_G22_NONE_P709; // SDR
+ DXGI_OUTPUT_DESC1 hdrOutputDesc;
+ QRHI_RES_RHI(QRhiD3D12);
+ if (QRhiD3D::outputDesc1ForWindow(m_window, rhiD->activeAdapter, &hdrOutputDesc) && m_format != SDR) {
+ // https://docs.microsoft.com/en-us/windows/win32/direct3darticles/high-dynamic-range
+ if (hdrOutputDesc.ColorSpace == DXGI_COLOR_SPACE_RGB_FULL_G2084_NONE_P2020) {
+ switch (m_format) {
+ case HDRExtendedSrgbLinear:
+ colorFormat = DXGI_FORMAT_R16G16B16A16_FLOAT;
+ hdrColorSpace = DXGI_COLOR_SPACE_RGB_FULL_G10_NONE_P709;
+ srgbAdjustedColorFormat = colorFormat;
+ break;
+ case HDR10:
+ colorFormat = DXGI_FORMAT_R10G10B10A2_UNORM;
+ hdrColorSpace = DXGI_COLOR_SPACE_RGB_FULL_G2084_NONE_P2020;
+ srgbAdjustedColorFormat = colorFormat;
+ break;
+ default:
+ break;
+ }
+ } else {
+ // This happens also when Use HDR is set to Off in the Windows
+ // Display settings. Show a helpful warning, but continue with the
+ // default non-HDR format.
+ qWarning("The output associated with the window is not HDR capable "
+ "(or Use HDR is Off in the Display Settings), ignoring HDR format request");
+ }
+ }
+ sampleDesc = rhiD->effectiveSampleDesc(m_sampleCount, colorFormat);
+}
+
+bool QD3D12SwapChain::createOrResize()
+{
+ // Can be called multiple times due to window resizes - that is not the
+ // same as a simple destroy+create (as with other resources). Just need to
+ // resize the buffers then.
+
+ const bool needsRegistration = !window || window != m_window;
+
+ // except if the window actually changes
+ if (window && window != m_window)
+ destroy();
+
+ window = m_window;
+ m_currentPixelSize = surfacePixelSize();
+ pixelSize = m_currentPixelSize;
+
+ if (pixelSize.isEmpty())
+ return false;
+
+ HWND hwnd = reinterpret_cast<HWND>(window->winId());
+ HRESULT hr;
+ QRHI_RES_RHI(QRhiD3D12);
+ stereo = m_window->format().stereo() && rhiD->dxgiFactory->IsWindowedStereoEnabled();
+
+ if (m_flags.testFlag(SurfaceHasPreMulAlpha) || m_flags.testFlag(SurfaceHasNonPreMulAlpha)) {
+ if (rhiD->ensureDirectCompositionDevice()) {
+ if (!dcompTarget) {
+ hr = rhiD->dcompDevice->CreateTargetForHwnd(hwnd, false, &dcompTarget);
+ if (FAILED(hr)) {
+ qWarning("Failed to create Direct Composition target for the window: %s",
+ qPrintable(QSystemError::windowsComString(hr)));
+ }
+ }
+ if (dcompTarget && !dcompVisual) {
+ hr = rhiD->dcompDevice->CreateVisual(&dcompVisual);
+ if (FAILED(hr)) {
+ qWarning("Failed to create DirectComposition visual: %s",
+ qPrintable(QSystemError::windowsComString(hr)));
+ }
+ }
+ }
+ // simple consistency check
+ if (window->requestedFormat().alphaBufferSize() <= 0)
+ qWarning("Swapchain says surface has alpha but the window has no alphaBufferSize set. "
+ "This may lead to problems.");
+ }
+
+ swapInterval = m_flags.testFlag(QRhiSwapChain::NoVSync) ? 0 : 1;
+ swapChainFlags = 0;
+ if (swapInterval == 0 && rhiD->supportsAllowTearing)
+ swapChainFlags |= DXGI_SWAP_CHAIN_FLAG_ALLOW_TEARING;
+
+ if (!swapChain) {
+ chooseFormats();
+
+ DXGI_SWAP_CHAIN_DESC1 desc = {};
+ desc.Width = UINT(pixelSize.width());
+ desc.Height = UINT(pixelSize.height());
+ desc.Format = colorFormat;
+ desc.SampleDesc.Count = 1;
+ desc.BufferUsage = DXGI_USAGE_RENDER_TARGET_OUTPUT;
+ desc.BufferCount = BUFFER_COUNT;
+ desc.Flags = swapChainFlags;
+ desc.Scaling = DXGI_SCALING_NONE;
+ desc.SwapEffect = DXGI_SWAP_EFFECT_FLIP_DISCARD;
+ desc.Stereo = stereo;
+
+ if (dcompVisual) {
+ // With DirectComposition setting AlphaMode to STRAIGHT fails the
+ // swapchain creation, whereas the result seems to be identical
+ // with any of the other values, including IGNORE. (?)
+ desc.AlphaMode = DXGI_ALPHA_MODE_PREMULTIPLIED;
+
+ // DirectComposition has its own limitations, cannot use
+ // SCALING_NONE. So with semi-transparency requested we are forced
+ // to SCALING_STRETCH.
+ desc.Scaling = DXGI_SCALING_STRETCH;
+ }
+
+ if (dcompVisual)
+ hr = rhiD->dxgiFactory->CreateSwapChainForComposition(rhiD->cmdQueue, &desc, nullptr, &sourceSwapChain1);
+ else
+ hr = rhiD->dxgiFactory->CreateSwapChainForHwnd(rhiD->cmdQueue, hwnd, &desc, nullptr, nullptr, &sourceSwapChain1);
+
+ // If failed and we tried a HDR format, then try with SDR. This
+ // matches other backends, such as Vulkan where if the format is
+ // not supported, the default one is used instead.
+ if (FAILED(hr) && m_format != SDR) {
+ colorFormat = DEFAULT_FORMAT;
+ desc.Format = DEFAULT_FORMAT;
+ if (dcompVisual)
+ hr = rhiD->dxgiFactory->CreateSwapChainForComposition(rhiD->cmdQueue, &desc, nullptr, &sourceSwapChain1);
+ else
+ hr = rhiD->dxgiFactory->CreateSwapChainForHwnd(rhiD->cmdQueue, hwnd, &desc, nullptr, nullptr, &sourceSwapChain1);
+ }
+
+ if (SUCCEEDED(hr)) {
+ if (FAILED(sourceSwapChain1->QueryInterface(__uuidof(IDXGISwapChain3), reinterpret_cast<void **>(&swapChain)))) {
+ qWarning("IDXGISwapChain3 not available");
+ return false;
+ }
+ if (m_format != SDR) {
+ hr = swapChain->SetColorSpace1(hdrColorSpace);
+ if (FAILED(hr)) {
+ qWarning("Failed to set color space on swapchain: %s",
+ qPrintable(QSystemError::windowsComString(hr)));
+ }
+ }
+ if (dcompVisual) {
+ hr = dcompVisual->SetContent(swapChain);
+ if (SUCCEEDED(hr)) {
+ hr = dcompTarget->SetRoot(dcompVisual);
+ if (FAILED(hr)) {
+ qWarning("Failed to associate Direct Composition visual with the target: %s",
+ qPrintable(QSystemError::windowsComString(hr)));
+ }
+ } else {
+ qWarning("Failed to set content for Direct Composition visual: %s",
+ qPrintable(QSystemError::windowsComString(hr)));
+ }
+ } else {
+ // disable Alt+Enter; not relevant when using DirectComposition
+ rhiD->dxgiFactory->MakeWindowAssociation(hwnd, DXGI_MWA_NO_WINDOW_CHANGES);
+ }
+ }
+ if (FAILED(hr)) {
+ qWarning("Failed to create D3D12 swapchain: %s"
+ " (Width=%u Height=%u Format=%u SampleCount=%u BufferCount=%u Scaling=%u SwapEffect=%u Stereo=%u)",
+ qPrintable(QSystemError::windowsComString(hr)),
+ desc.Width, desc.Height, UINT(desc.Format), desc.SampleDesc.Count,
+ desc.BufferCount, UINT(desc.Scaling), UINT(desc.SwapEffect), UINT(desc.Stereo));
+ return false;
+ }
+
+ for (int i = 0; i < QD3D12_FRAMES_IN_FLIGHT; ++i) {
+ hr = rhiD->dev->CreateFence(0,
+ D3D12_FENCE_FLAG_NONE,
+ __uuidof(ID3D12Fence),
+ reinterpret_cast<void **>(&frameRes[i].fence));
+ if (FAILED(hr)) {
+ qWarning("Failed to create fence for swapchain: %s",
+ qPrintable(QSystemError::windowsComString(hr)));
+ return false;
+ }
+ frameRes[i].fenceEvent = CreateEvent(nullptr, FALSE, FALSE, nullptr);
+
+ frameRes[i].fenceCounter = 0;
+ }
+ } else {
+ releaseBuffers();
+ hr = swapChain->ResizeBuffers(BUFFER_COUNT,
+ UINT(pixelSize.width()),
+ UINT(pixelSize.height()),
+ colorFormat,
+ swapChainFlags);
+ if (hr == DXGI_ERROR_DEVICE_REMOVED || hr == DXGI_ERROR_DEVICE_RESET) {
+ qWarning("Device loss detected in ResizeBuffers()");
+ rhiD->deviceLost = true;
+ return false;
+ } else if (FAILED(hr)) {
+ qWarning("Failed to resize D3D12 swapchain: %s", qPrintable(QSystemError::windowsComString(hr)));
+ return false;
+ }
+ }
+
+ for (UINT i = 0; i < BUFFER_COUNT; ++i) {
+ ID3D12Resource *colorBuffer;
+ hr = swapChain->GetBuffer(i, __uuidof(ID3D12Resource), reinterpret_cast<void **>(&colorBuffer));
+ if (FAILED(hr)) {
+ qWarning("Failed to get buffer %u for D3D12 swapchain: %s",
+ i, qPrintable(QSystemError::windowsComString(hr)));
+ return false;
+ }
+ colorBuffers[i] = QD3D12Resource::addToPool(&rhiD->resourcePool, colorBuffer, D3D12_RESOURCE_STATE_PRESENT);
+ rtvs[i] = rhiD->rtvPool.allocate(1);
+ D3D12_RENDER_TARGET_VIEW_DESC rtvDesc = {};
+ rtvDesc.Format = srgbAdjustedColorFormat;
+ rtvDesc.ViewDimension = D3D12_RTV_DIMENSION_TEXTURE2D;
+ rhiD->dev->CreateRenderTargetView(colorBuffer, &rtvDesc, rtvs[i].cpuHandle);
+
+ if (stereo) {
+ rtvsRight[i] = rhiD->rtvPool.allocate(1);
+ D3D12_RENDER_TARGET_VIEW_DESC rtvDesc = {};
+ rtvDesc.Format = srgbAdjustedColorFormat;
+ rtvDesc.ViewDimension = D3D12_RTV_DIMENSION_TEXTURE2DARRAY;
+ rtvDesc.Texture2DArray.ArraySize = 1;
+ rtvDesc.Texture2DArray.FirstArraySlice = 1;
+ rhiD->dev->CreateRenderTargetView(colorBuffer, &rtvDesc, rtvsRight[i].cpuHandle);
+ }
+ }
+
+ if (m_depthStencil && m_depthStencil->sampleCount() != m_sampleCount) {
+ qWarning("Depth-stencil buffer's sampleCount (%d) does not match color buffers' sample count (%d). Expect problems.",
+ m_depthStencil->sampleCount(), m_sampleCount);
+ }
+ if (m_depthStencil && m_depthStencil->pixelSize() != pixelSize) {
+ if (m_depthStencil->flags().testFlag(QRhiRenderBuffer::UsedWithSwapChainOnly)) {
+ m_depthStencil->setPixelSize(pixelSize);
+ if (!m_depthStencil->create())
+ qWarning("Failed to rebuild swapchain's associated depth-stencil buffer for size %dx%d",
+ pixelSize.width(), pixelSize.height());
+ } else {
+ qWarning("Depth-stencil buffer's size (%dx%d) does not match the surface size (%dx%d). Expect problems.",
+ m_depthStencil->pixelSize().width(), m_depthStencil->pixelSize().height(),
+ pixelSize.width(), pixelSize.height());
+ }
+ }
+
+ ds = m_depthStencil ? QRHI_RES(QD3D12RenderBuffer, m_depthStencil) : nullptr;
+
+ if (sampleDesc.Count > 1) {
+ for (UINT i = 0; i < BUFFER_COUNT; ++i) {
+ D3D12_RESOURCE_DESC resourceDesc = {};
+ resourceDesc.Dimension = D3D12_RESOURCE_DIMENSION_TEXTURE2D;
+ resourceDesc.Width = UINT64(pixelSize.width());
+ resourceDesc.Height = UINT(pixelSize.height());
+ resourceDesc.DepthOrArraySize = 1;
+ resourceDesc.MipLevels = 1;
+ resourceDesc.Format = srgbAdjustedColorFormat;
+ resourceDesc.SampleDesc = sampleDesc;
+ resourceDesc.Layout = D3D12_TEXTURE_LAYOUT_UNKNOWN;
+ resourceDesc.Flags = D3D12_RESOURCE_FLAG_ALLOW_RENDER_TARGET;
+ D3D12_CLEAR_VALUE clearValue = {};
+ clearValue.Format = colorFormat;
+ ID3D12Resource *resource = nullptr;
+ D3D12MA::Allocation *allocation = nullptr;
+ HRESULT hr = rhiD->vma.createResource(D3D12_HEAP_TYPE_DEFAULT,
+ &resourceDesc,
+ D3D12_RESOURCE_STATE_RENDER_TARGET,
+ &clearValue,
+ &allocation,
+ __uuidof(ID3D12Resource),
+ reinterpret_cast<void **>(&resource));
+ if (FAILED(hr)) {
+ qWarning("Failed to create MSAA color buffer: %s", qPrintable(QSystemError::windowsComString(hr)));
+ return false;
+ }
+ msaaBuffers[i] = QD3D12Resource::addToPool(&rhiD->resourcePool, resource, D3D12_RESOURCE_STATE_RENDER_TARGET, allocation);
+ msaaRtvs[i] = rhiD->rtvPool.allocate(1);
+ if (!msaaRtvs[i].isValid())
+ return false;
+ D3D12_RENDER_TARGET_VIEW_DESC rtvDesc = {};
+ rtvDesc.Format = srgbAdjustedColorFormat;
+ rtvDesc.ViewDimension = sampleDesc.Count > 1 ? D3D12_RTV_DIMENSION_TEXTURE2DMS
+ : D3D12_RTV_DIMENSION_TEXTURE2D;
+ rhiD->dev->CreateRenderTargetView(resource, &rtvDesc, msaaRtvs[i].cpuHandle);
+ }
+ }
+
+ currentBackBufferIndex = swapChain->GetCurrentBackBufferIndex();
+ currentFrameSlot = 0;
+
+ rtWrapper.setRenderPassDescriptor(m_renderPassDesc); // for the public getter in QRhiRenderTarget
+ QD3D12SwapChainRenderTarget *rtD = QRHI_RES(QD3D12SwapChainRenderTarget, &rtWrapper);
+ rtD->d.rp = QRHI_RES(QD3D12RenderPassDescriptor, m_renderPassDesc);
+ rtD->d.pixelSize = pixelSize;
+ rtD->d.dpr = float(window->devicePixelRatio());
+ rtD->d.sampleCount = int(sampleDesc.Count);
+ rtD->d.colorAttCount = 1;
+ rtD->d.dsAttCount = m_depthStencil ? 1 : 0;
+
+ rtWrapperRight.setRenderPassDescriptor(m_renderPassDesc);
+ QD3D12SwapChainRenderTarget *rtDr = QRHI_RES(QD3D12SwapChainRenderTarget, &rtWrapperRight);
+ rtDr->d.rp = QRHI_RES(QD3D12RenderPassDescriptor, m_renderPassDesc);
+ rtDr->d.pixelSize = pixelSize;
+ rtDr->d.dpr = float(window->devicePixelRatio());
+ rtDr->d.sampleCount = int(sampleDesc.Count);
+ rtDr->d.colorAttCount = 1;
+ rtDr->d.dsAttCount = m_depthStencil ? 1 : 0;
+
+ if (needsRegistration) {
+ rhiD->swapchains.insert(this);
+ rhiD->registerResource(this);
+ }
+
+ return true;
+}
+
+QT_END_NAMESPACE
+
+#endif // __ID3D12Device2_INTERFACE_DEFINED__
diff --git a/src/gui/rhi/qrhid3d12_p.h b/src/gui/rhi/qrhid3d12_p.h
new file mode 100644
index 0000000000..3f9abbb5ac
--- /dev/null
+++ b/src/gui/rhi/qrhid3d12_p.h
@@ -0,0 +1,1248 @@
+// Copyright (C) 2023 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
+
+#ifndef QRHID3D12_P_H
+#define QRHID3D12_P_H
+
+//
+// W A R N I N G
+// -------------
+//
+// This file is not part of the Qt API. It exists purely as an
+// implementation detail. This header file may change from version to
+// version without notice, or even be removed.
+//
+// We mean it.
+//
+
+#include "qrhi_p.h"
+#include <QWindow>
+#include <QBitArray>
+
+#include <optional>
+#include <array>
+
+#include <d3d12.h>
+#include <d3d12sdklayers.h>
+#include <dxgi1_6.h>
+#include <dcomp.h>
+
+#include "D3D12MemAlloc.h"
+
+// ID3D12Device2 and ID3D12GraphicsCommandList1 and types and enums introduced
+// with those are hard requirements now. These should be declared in any
+// moderately recent d3d12.h, but if it is an SDK from before Windows 10
+// version 1703 then these types could be missing. In the absence of other
+// options, handle this by skipping all the code and making QRhi::create() fail
+// in such builds.
+#ifdef __ID3D12Device2_INTERFACE_DEFINED__
+#define QRHI_D3D12_AVAILABLE
+
+QT_BEGIN_NAMESPACE
+
+static const int QD3D12_FRAMES_IN_FLIGHT = 2;
+
+class QRhiD3D12;
+
+struct QD3D12Descriptor
+{
+ D3D12_CPU_DESCRIPTOR_HANDLE cpuHandle = {};
+ D3D12_GPU_DESCRIPTOR_HANDLE gpuHandle = {};
+
+ bool isValid() const { return cpuHandle.ptr != 0; }
+};
+
+struct QD3D12ReleaseQueue;
+
+struct QD3D12DescriptorHeap
+{
+ bool isValid() const { return heap && capacity; }
+ bool create(ID3D12Device *device,
+ quint32 descriptorCount,
+ D3D12_DESCRIPTOR_HEAP_TYPE heapType,
+ D3D12_DESCRIPTOR_HEAP_FLAGS heapFlags);
+ void createWithExisting(const QD3D12DescriptorHeap &other,
+ quint32 offsetInDescriptors,
+ quint32 descriptorCount);
+ void destroy();
+ void destroyWithDeferredRelease(QD3D12ReleaseQueue *releaseQueue);
+
+ QD3D12Descriptor get(quint32 count);
+ QD3D12Descriptor at(quint32 index) const;
+ quint32 remainingCapacity() const { return capacity - head; }
+
+ QD3D12Descriptor incremented(const QD3D12Descriptor &descriptor, quint32 offsetInDescriptors) const
+ {
+ D3D12_CPU_DESCRIPTOR_HANDLE cpuHandle = descriptor.cpuHandle;
+ cpuHandle.ptr += offsetInDescriptors * descriptorByteSize;
+ D3D12_GPU_DESCRIPTOR_HANDLE gpuHandle = descriptor.gpuHandle;
+ if (gpuHandle.ptr)
+ gpuHandle.ptr += offsetInDescriptors * descriptorByteSize;
+ return { cpuHandle, gpuHandle };
+ }
+
+ ID3D12DescriptorHeap *heap = nullptr;
+ quint32 capacity = 0;
+ QD3D12Descriptor heapStart;
+ quint32 head = 0;
+ quint32 descriptorByteSize = 0;
+ D3D12_DESCRIPTOR_HEAP_TYPE heapType;
+ D3D12_DESCRIPTOR_HEAP_FLAGS heapFlags;
+};
+
+struct QD3D12CpuDescriptorPool
+{
+ bool isValid() const { return !heaps.isEmpty(); }
+ bool create(ID3D12Device *device, D3D12_DESCRIPTOR_HEAP_TYPE heapType, const char *debugName = "");
+ void destroy();
+
+ QD3D12Descriptor allocate(quint32 count);
+ void release(const QD3D12Descriptor &descriptor, quint32 count);
+
+ static const int DESCRIPTORS_PER_HEAP = 256;
+
+ struct HeapWithMap {
+ QD3D12DescriptorHeap heap;
+ QBitArray map;
+ static HeapWithMap init(const QD3D12DescriptorHeap &heap, quint32 descriptorCount) {
+ HeapWithMap result;
+ result.heap = heap;
+ result.map.resize(descriptorCount);
+ return result;
+ }
+ };
+
+ ID3D12Device *device;
+ quint32 descriptorByteSize;
+ QVector<HeapWithMap> heaps;
+ const char *debugName;
+};
+
+struct QD3D12QueryHeap
+{
+ bool isValid() const { return heap && capacity; }
+ bool create(ID3D12Device *device,
+ quint32 queryCount,
+ D3D12_QUERY_HEAP_TYPE heapType);
+ void destroy();
+
+ ID3D12QueryHeap *heap = nullptr;
+ quint32 capacity = 0;
+};
+
+struct QD3D12StagingArea
+{
+ static const quint32 ALIGNMENT = D3D12_TEXTURE_DATA_PLACEMENT_ALIGNMENT; // 512 so good enough both for cb and texdata
+
+ struct Allocation {
+ quint8 *p = nullptr;
+ D3D12_GPU_VIRTUAL_ADDRESS gpuAddr = 0;
+ ID3D12Resource *buffer = nullptr;
+ quint32 bufferOffset = 0;
+ bool isValid() const { return p != nullptr; }
+ };
+
+ bool isValid() const { return allocation && mem.isValid(); }
+ bool create(QRhiD3D12 *rhi, quint32 capacity, D3D12_HEAP_TYPE heapType);
+ void destroy();
+ void destroyWithDeferredRelease(QD3D12ReleaseQueue *releaseQueue);
+
+ Allocation get(quint32 byteSize);
+
+ quint32 remainingCapacity() const
+ {
+ return capacity - head;
+ }
+
+ static quint32 allocSizeForArray(quint32 size, int count = 1)
+ {
+ return count * ((size + ALIGNMENT - 1) & ~(ALIGNMENT - 1));
+ }
+
+ Allocation mem;
+ ID3D12Resource *resource = nullptr;
+ D3D12MA::Allocation *allocation = nullptr;
+ quint32 head;
+ quint32 capacity;
+};
+
+struct QD3D12ObjectHandle
+{
+ quint32 index = 0;
+ quint32 generation = 0;
+
+ // the default, null handle is guaranteed to give ObjectPool::isValid() == false
+ bool isNull() const { return index == 0 && generation == 0; }
+};
+
+inline bool operator==(const QD3D12ObjectHandle &a, const QD3D12ObjectHandle &b) noexcept
+{
+ return a.index == b.index && a.generation == b.generation;
+}
+
+inline bool operator!=(const QD3D12ObjectHandle &a, const QD3D12ObjectHandle &b) noexcept
+{
+ return !(a == b);
+}
+
+template<typename T>
+struct QD3D12ObjectPool
+{
+ void create(const char *debugName = "")
+ {
+ this->debugName = debugName;
+ Q_ASSERT(data.isEmpty());
+ data.append(Data()); // index 0 is always invalid
+ }
+
+ void destroy() {
+ int leakCount = 0; // will nicely destroy everything here, but warn about it if enabled
+ for (Data &d : data) {
+ if (d.object.has_value()) {
+ leakCount += 1;
+ d.object->releaseResources();
+ }
+ }
+ data.clear();
+#ifndef QT_NO_DEBUG
+ // debug builds: just do it always
+ static bool leakCheck = true;
+#else
+ // release builds: opt-in
+ static bool leakCheck = qEnvironmentVariableIntValue("QT_RHI_LEAK_CHECK");
+#endif
+ if (leakCheck) {
+ if (leakCount > 0) {
+ qWarning("QD3D12ObjectPool::destroy(): Pool %p '%s' had %d unreleased objects",
+ this, debugName, leakCount);
+ }
+ }
+ }
+
+ bool isValid(const QD3D12ObjectHandle &handle) const
+ {
+ return handle.index > 0
+ && handle.index < quint32(data.count())
+ && handle.generation > 0
+ && handle.generation == data[handle.index].generation
+ && data[handle.index].object.has_value();
+ }
+
+ T lookup(const QD3D12ObjectHandle &handle) const
+ {
+ return isValid(handle) ? *data[handle.index].object : T();
+ }
+
+ const T *lookupRef(const QD3D12ObjectHandle &handle) const
+ {
+ return isValid(handle) ? &*data[handle.index].object : nullptr;
+ }
+
+ T *lookupRef(const QD3D12ObjectHandle &handle)
+ {
+ return isValid(handle) ? &*data[handle.index].object : nullptr;
+ }
+
+ QD3D12ObjectHandle add(const T &object)
+ {
+ Q_ASSERT(!data.isEmpty());
+ const quint32 count = quint32(data.count());
+ quint32 index = 1; // index 0 is always invalid
+ for (; index < count; ++index) {
+ if (!data[index].object.has_value())
+ break;
+ }
+ if (index < count) {
+ data[index].object = object;
+ quint32 &generation = data[index].generation;
+ generation += 1u;
+ return { index, generation };
+ } else {
+ data.append({ object, 1 });
+ return { count, 1 };
+ }
+ }
+
+ void remove(const QD3D12ObjectHandle &handle)
+ {
+ if (T *object = lookupRef(handle)) {
+ object->releaseResources();
+ data[handle.index].object.reset();
+ }
+ }
+
+ const char *debugName;
+ struct Data {
+ std::optional<T> object;
+ quint32 generation = 0;
+ };
+ QVector<Data> data;
+};
+
+struct QD3D12Resource
+{
+ ID3D12Resource *resource;
+ D3D12_RESOURCE_STATES state;
+ D3D12_RESOURCE_DESC desc;
+ D3D12MA::Allocation *allocation;
+ void *cpuMapPtr;
+ enum { UavUsageRead = 0x01, UavUsageWrite = 0x02 };
+ int uavUsage;
+ bool owns;
+
+ // note that this assumes the allocation (if there is one) and the resource
+ // are separately releaseable, see D3D12MemAlloc docs
+ static QD3D12ObjectHandle addToPool(QD3D12ObjectPool<QD3D12Resource> *pool,
+ ID3D12Resource *resource,
+ D3D12_RESOURCE_STATES state,
+ D3D12MA::Allocation *allocation = nullptr,
+ void *cpuMapPtr = nullptr)
+ {
+ Q_ASSERT(resource);
+ return pool->add({ resource, state, resource->GetDesc(), allocation, cpuMapPtr, 0, true });
+ }
+
+ // for QRhiTexture::createFrom() where the ID3D12Resource is not owned by us
+ static QD3D12ObjectHandle addNonOwningToPool(QD3D12ObjectPool<QD3D12Resource> *pool,
+ ID3D12Resource *resource,
+ D3D12_RESOURCE_STATES state)
+ {
+ Q_ASSERT(resource);
+ return pool->add({ resource, state, resource->GetDesc(), nullptr, nullptr, 0, false });
+ }
+
+ void releaseResources()
+ {
+ if (owns) {
+ // order matters: resource first, then the allocation
+ resource->Release();
+ if (allocation)
+ allocation->Release();
+ }
+ }
+};
+
+struct QD3D12Pipeline
+{
+ enum Type {
+ Graphics,
+ Compute
+ };
+ Type type;
+ ID3D12PipelineState *pso;
+
+ static QD3D12ObjectHandle addToPool(QD3D12ObjectPool<QD3D12Pipeline> *pool,
+ Type type,
+ ID3D12PipelineState *pso)
+ {
+ return pool->add({ type, pso });
+ }
+
+ void releaseResources()
+ {
+ pso->Release();
+ }
+};
+
+struct QD3D12RootSignature
+{
+ ID3D12RootSignature *rootSig;
+
+ static QD3D12ObjectHandle addToPool(QD3D12ObjectPool<QD3D12RootSignature> *pool,
+ ID3D12RootSignature *rootSig)
+ {
+ return pool->add({ rootSig });
+ }
+
+ void releaseResources()
+ {
+ rootSig->Release();
+ }
+};
+
+struct QD3D12ReleaseQueue
+{
+ void create(QD3D12ObjectPool<QD3D12Resource> *resourcePool,
+ QD3D12ObjectPool<QD3D12Pipeline> *pipelinePool,
+ QD3D12ObjectPool<QD3D12RootSignature> *rootSignaturePool)
+ {
+ this->resourcePool = resourcePool;
+ this->pipelinePool = pipelinePool;
+ this->rootSignaturePool = rootSignaturePool;
+ }
+
+ void deferredReleaseResource(const QD3D12ObjectHandle &handle);
+ void deferredReleaseResourceWithViews(const QD3D12ObjectHandle &handle,
+ QD3D12CpuDescriptorPool *pool,
+ const QD3D12Descriptor &viewsStart,
+ int viewCount);
+ void deferredReleasePipeline(const QD3D12ObjectHandle &handle);
+ void deferredReleaseRootSignature(const QD3D12ObjectHandle &handle);
+ void deferredReleaseCallback(std::function<void(void*)> callback, void *userData);
+ void deferredReleaseResourceAndAllocation(ID3D12Resource *resource,
+ D3D12MA::Allocation *allocation);
+ void deferredReleaseDescriptorHeap(ID3D12DescriptorHeap *heap);
+ void deferredReleaseViews(QD3D12CpuDescriptorPool *pool,
+ const QD3D12Descriptor &viewsStart,
+ int viewCount);
+
+ void activatePendingDeferredReleaseRequests(int frameSlot);
+ void executeDeferredReleases(int frameSlot, bool forced = false);
+ void releaseAll();
+
+ struct DeferredReleaseEntry {
+ enum Type {
+ Resource,
+ Pipeline,
+ RootSignature,
+ Callback,
+ ResourceAndAllocation,
+ DescriptorHeap,
+ Views
+ };
+ Type type = Resource;
+ std::optional<int> frameSlotToBeReleasedIn;
+ QD3D12ObjectHandle handle;
+ QD3D12CpuDescriptorPool *poolForViews = nullptr;
+ QD3D12Descriptor viewsStart;
+ int viewCount = 0;
+ std::function<void(void*)> callback = nullptr;
+ void *callbackUserData = nullptr;
+ QPair<ID3D12Resource *, D3D12MA::Allocation *> resourceAndAllocation = {};
+ ID3D12DescriptorHeap *descriptorHeap = nullptr;
+ };
+ QVector<DeferredReleaseEntry> queue;
+ QD3D12ObjectPool<QD3D12Resource> *resourcePool = nullptr;
+ QD3D12ObjectPool<QD3D12Pipeline> *pipelinePool = nullptr;
+ QD3D12ObjectPool<QD3D12RootSignature> *rootSignaturePool = nullptr;
+};
+
+struct QD3D12CommandBuffer;
+
+struct QD3D12ResourceBarrierGenerator
+{
+ static const int PREALLOC = 16;
+
+ void create(QD3D12ObjectPool<QD3D12Resource> *resourcePool)
+ {
+ this->resourcePool = resourcePool;
+ }
+
+ void addTransitionBarrier(const QD3D12ObjectHandle &resourceHandle, D3D12_RESOURCE_STATES stateAfter);
+ void enqueueBufferedTransitionBarriers(QD3D12CommandBuffer *cbD);
+ void enqueueSubresourceTransitionBarrier(QD3D12CommandBuffer *cbD,
+ const QD3D12ObjectHandle &resourceHandle,
+ UINT subresource,
+ D3D12_RESOURCE_STATES stateBefore,
+ D3D12_RESOURCE_STATES stateAfter);
+ void enqueueUavBarrier(QD3D12CommandBuffer *cbD, const QD3D12ObjectHandle &resourceHandle);
+
+ struct TransitionResourceBarrier {
+ QD3D12ObjectHandle resourceHandle;
+ D3D12_RESOURCE_STATES stateBefore;
+ D3D12_RESOURCE_STATES stateAfter;
+ };
+ QVarLengthArray<TransitionResourceBarrier, PREALLOC> transitionResourceBarriers;
+ QD3D12ObjectPool<QD3D12Resource> *resourcePool = nullptr;
+};
+
+struct QD3D12ShaderBytecodeCache
+{
+ struct Shader {
+ Shader() = default;
+ Shader(const QByteArray &bytecode, const QShader::NativeResourceBindingMap &rbm)
+ : bytecode(bytecode), nativeResourceBindingMap(rbm)
+ { }
+ QByteArray bytecode;
+ QShader::NativeResourceBindingMap nativeResourceBindingMap;
+ };
+
+ QHash<QRhiShaderStage, Shader> data;
+
+ void insertWithCapacityLimit(const QRhiShaderStage &key, const Shader &s);
+};
+
+struct QD3D12ShaderVisibleDescriptorHeap
+{
+ bool create(ID3D12Device *device, D3D12_DESCRIPTOR_HEAP_TYPE type, quint32 perFrameDescriptorCount);
+ void destroy();
+ void destroyWithDeferredRelease(QD3D12ReleaseQueue *releaseQueue);
+
+ QD3D12DescriptorHeap heap;
+ QD3D12DescriptorHeap perFrameHeapSlice[QD3D12_FRAMES_IN_FLIGHT];
+};
+
+// wrap foreign struct so we can legally supply equality operators and qHash:
+struct Q_D3D12_SAMPLER_DESC
+{
+ D3D12_SAMPLER_DESC desc;
+
+ friend bool operator==(const Q_D3D12_SAMPLER_DESC &lhs, const Q_D3D12_SAMPLER_DESC &rhs) noexcept
+ {
+ return lhs.desc.Filter == rhs.desc.Filter
+ && lhs.desc.AddressU == rhs.desc.AddressU
+ && lhs.desc.AddressV == rhs.desc.AddressV
+ && lhs.desc.AddressW == rhs.desc.AddressW
+ && lhs.desc.MipLODBias == rhs.desc.MipLODBias
+ && lhs.desc.MaxAnisotropy == rhs.desc.MaxAnisotropy
+ && lhs.desc.ComparisonFunc == rhs.desc.ComparisonFunc
+ // BorderColor is never used, skip it
+ && lhs.desc.MinLOD == rhs.desc.MinLOD
+ && lhs.desc.MaxLOD == rhs.desc.MaxLOD;
+ }
+
+ friend bool operator!=(const Q_D3D12_SAMPLER_DESC &lhs, const Q_D3D12_SAMPLER_DESC &rhs) noexcept
+ {
+ return !(lhs == rhs);
+ }
+
+ friend size_t qHash(const Q_D3D12_SAMPLER_DESC &key, size_t seed = 0) noexcept
+ {
+ QtPrivate::QHashCombine hash;
+ seed = hash(seed, key.desc.Filter);
+ seed = hash(seed, key.desc.AddressU);
+ seed = hash(seed, key.desc.AddressV);
+ seed = hash(seed, key.desc.AddressW);
+ seed = hash(seed, key.desc.MipLODBias);
+ seed = hash(seed, key.desc.MaxAnisotropy);
+ seed = hash(seed, key.desc.ComparisonFunc);
+ // BorderColor is never used, skip it
+ seed = hash(seed, key.desc.MinLOD);
+ seed = hash(seed, key.desc.MaxLOD);
+ return seed;
+ }
+};
+
+struct QD3D12SamplerManager
+{
+ const quint32 MAX_SAMPLERS = 512;
+
+ bool create(ID3D12Device *device);
+ void destroy();
+
+ QD3D12Descriptor getShaderVisibleDescriptor(const D3D12_SAMPLER_DESC &desc);
+
+ ID3D12Device *device = nullptr;
+ QD3D12ShaderVisibleDescriptorHeap shaderVisibleSamplerHeap;
+ QHash<Q_D3D12_SAMPLER_DESC, QD3D12Descriptor> gpuMap;
+};
+
+enum QD3D12Stage { VS = 0, HS, DS, GS, PS, CS };
+
+static inline QD3D12Stage qd3d12_stage(QRhiShaderStage::Type type)
+{
+ switch (type) {
+ case QRhiShaderStage::Vertex:
+ return VS;
+ case QRhiShaderStage::TessellationControl:
+ return HS;
+ case QRhiShaderStage::TessellationEvaluation:
+ return DS;
+ case QRhiShaderStage::Geometry:
+ return GS;
+ case QRhiShaderStage::Fragment:
+ return PS;
+ case QRhiShaderStage::Compute:
+ return CS;
+ }
+ Q_UNREACHABLE_RETURN(VS);
+}
+
+static inline D3D12_SHADER_VISIBILITY qd3d12_stageToVisibility(QD3D12Stage s)
+{
+ switch (s) {
+ case VS:
+ return D3D12_SHADER_VISIBILITY_VERTEX;
+ case HS:
+ return D3D12_SHADER_VISIBILITY_HULL;
+ case DS:
+ return D3D12_SHADER_VISIBILITY_DOMAIN;
+ case GS:
+ return D3D12_SHADER_VISIBILITY_GEOMETRY;
+ case PS:
+ return D3D12_SHADER_VISIBILITY_PIXEL;
+ case CS:
+ return D3D12_SHADER_VISIBILITY_ALL;
+ }
+ Q_UNREACHABLE_RETURN(D3D12_SHADER_VISIBILITY_ALL);
+}
+
+static inline QRhiShaderResourceBinding::StageFlag qd3d12_stageToSrb(QD3D12Stage s)
+{
+ switch (s) {
+ case VS:
+ return QRhiShaderResourceBinding::VertexStage;
+ case HS:
+ return QRhiShaderResourceBinding::TessellationControlStage;
+ case DS:
+ return QRhiShaderResourceBinding::TessellationEvaluationStage;
+ case GS:
+ return QRhiShaderResourceBinding::GeometryStage;
+ case PS:
+ return QRhiShaderResourceBinding::FragmentStage;
+ case CS:
+ return QRhiShaderResourceBinding::ComputeStage;
+ }
+ Q_UNREACHABLE_RETURN(QRhiShaderResourceBinding::VertexStage);
+}
+
+struct QD3D12ShaderStageData
+{
+ bool valid = false; // to allow simple arrays where unused stages are indicated by !valid
+ QD3D12Stage stage = VS;
+ QShader::NativeResourceBindingMap nativeResourceBindingMap;
+};
+
+struct QD3D12ShaderResourceBindings;
+
+struct QD3D12ShaderResourceVisitor
+{
+ enum StorageOp { Load = 0, Store, LoadStore };
+
+ QD3D12ShaderResourceVisitor(const QD3D12ShaderResourceBindings *srb,
+ const QD3D12ShaderStageData *stageData,
+ int stageCount)
+ : srb(srb),
+ stageData(stageData),
+ stageCount(stageCount)
+ {
+ }
+
+ std::function<void(QD3D12Stage, const QRhiShaderResourceBinding::Data::UniformBufferData &, int, int)> uniformBuffer = nullptr;
+ std::function<void(QD3D12Stage, const QRhiShaderResourceBinding::TextureAndSampler &, int)> texture = nullptr;
+ std::function<void(QD3D12Stage, const QRhiShaderResourceBinding::TextureAndSampler &, int)> sampler = nullptr;
+ std::function<void(QD3D12Stage, const QRhiShaderResourceBinding::Data::StorageImageData &, StorageOp, int)> storageImage = nullptr;
+ std::function<void(QD3D12Stage, const QRhiShaderResourceBinding::Data::StorageBufferData &, StorageOp, int)> storageBuffer = nullptr;
+
+ void visit();
+
+ const QD3D12ShaderResourceBindings *srb;
+ const QD3D12ShaderStageData *stageData;
+ int stageCount;
+};
+
+struct QD3D12Readback
+{
+ // common
+ int frameSlot = -1;
+ QRhiReadbackResult *result = nullptr;
+ QD3D12StagingArea staging;
+ quint32 byteSize = 0;
+ // textures
+ quint32 bytesPerLine = 0;
+ QSize pixelSize;
+ QRhiTexture::Format format = QRhiTexture::UnknownFormat;
+ quint32 stagingRowPitch = 0;
+};
+
+struct QD3D12MipmapGenerator
+{
+ bool create(QRhiD3D12 *rhiD);
+ void destroy();
+ void generate(QD3D12CommandBuffer *cbD, const QD3D12ObjectHandle &textureHandle);
+
+ QRhiD3D12 *rhiD;
+ QD3D12ObjectHandle rootSigHandle;
+ QD3D12ObjectHandle pipelineHandle;
+};
+
+struct QD3D12MemoryAllocator
+{
+ bool create(ID3D12Device *device, IDXGIAdapter1 *adapter);
+ void destroy();
+
+ HRESULT createResource(D3D12_HEAP_TYPE heapType,
+ const D3D12_RESOURCE_DESC *resourceDesc,
+ D3D12_RESOURCE_STATES initialState,
+ const D3D12_CLEAR_VALUE *optimizedClearValue,
+ D3D12MA::Allocation **maybeAllocation,
+ REFIID riidResource,
+ void **ppvResource);
+
+ void getBudget(D3D12MA::Budget *localBudget, D3D12MA::Budget *nonLocalBudget);
+
+ bool isUsingD3D12MA() const { return allocator != nullptr; }
+
+ ID3D12Device *device = nullptr;
+ D3D12MA::Allocator *allocator = nullptr;
+};
+
+struct QD3D12Buffer : public QRhiBuffer
+{
+ QD3D12Buffer(QRhiImplementation *rhi, Type type, UsageFlags usage, quint32 size);
+ ~QD3D12Buffer();
+
+ void destroy() override;
+ bool create() override;
+ QRhiBuffer::NativeBuffer nativeBuffer() override;
+ char *beginFullDynamicBufferUpdateForCurrentFrame() override;
+ void endFullDynamicBufferUpdateForCurrentFrame() override;
+
+ void executeHostWritesForFrameSlot(int frameSlot);
+
+ QD3D12ObjectHandle handles[QD3D12_FRAMES_IN_FLIGHT] = {};
+ struct HostWrite {
+ quint32 offset;
+ QRhiBufferData data;
+ };
+ QVarLengthArray<HostWrite, 16> pendingHostWrites[QD3D12_FRAMES_IN_FLIGHT];
+ friend class QRhiD3D12;
+ friend struct QD3D12CommandBuffer;
+};
+
+struct QD3D12RenderBuffer : public QRhiRenderBuffer
+{
+ QD3D12RenderBuffer(QRhiImplementation *rhi,
+ Type type,
+ const QSize &pixelSize,
+ int sampleCount,
+ Flags flags,
+ QRhiTexture::Format backingFormatHint);
+ ~QD3D12RenderBuffer();
+ void destroy() override;
+ bool create() override;
+ QRhiTexture::Format backingFormat() const override;
+
+ static const DXGI_FORMAT DS_FORMAT = DXGI_FORMAT_D24_UNORM_S8_UINT;
+
+ QD3D12ObjectHandle handle;
+ QD3D12Descriptor rtv;
+ QD3D12Descriptor dsv;
+ DXGI_FORMAT dxgiFormat;
+ DXGI_SAMPLE_DESC sampleDesc;
+ uint generation = 0;
+ friend class QRhiD3D12;
+};
+
+struct QD3D12Texture : public QRhiTexture
+{
+ QD3D12Texture(QRhiImplementation *rhi, Format format, const QSize &pixelSize, int depth,
+ int arraySize, int sampleCount, Flags flags);
+ ~QD3D12Texture();
+ void destroy() override;
+ bool create() override;
+ bool createFrom(NativeTexture src) override;
+ NativeTexture nativeTexture() override;
+ void setNativeLayout(int layout) override;
+
+ bool prepareCreate(QSize *adjustedSize = nullptr);
+ bool finishCreate();
+
+ QD3D12ObjectHandle handle;
+ QD3D12Descriptor srv;
+ DXGI_FORMAT dxgiFormat;
+ DXGI_FORMAT srvFormat;
+ DXGI_FORMAT rtFormat; // RTV/DSV/UAV
+ uint mipLevelCount;
+ DXGI_SAMPLE_DESC sampleDesc;
+ uint generation = 0;
+ friend class QRhiD3D12;
+ friend struct QD3D12CommandBuffer;
+};
+
+struct QD3D12Sampler : public QRhiSampler
+{
+ QD3D12Sampler(QRhiImplementation *rhi, Filter magFilter, Filter minFilter, Filter mipmapMode,
+ AddressMode u, AddressMode v, AddressMode w);
+ ~QD3D12Sampler();
+ void destroy() override;
+ bool create() override;
+
+ QD3D12Descriptor lookupOrCreateShaderVisibleDescriptor();
+
+ D3D12_SAMPLER_DESC desc = {};
+ QD3D12Descriptor shaderVisibleDescriptor;
+};
+
+struct QD3D12RenderPassDescriptor : public QRhiRenderPassDescriptor
+{
+ QD3D12RenderPassDescriptor(QRhiImplementation *rhi);
+ ~QD3D12RenderPassDescriptor();
+ void destroy() override;
+ bool isCompatible(const QRhiRenderPassDescriptor *other) const override;
+ QRhiRenderPassDescriptor *newCompatibleRenderPassDescriptor() const override;
+ QVector<quint32> serializedFormat() const override;
+
+ void updateSerializedFormat();
+
+ static const int MAX_COLOR_ATTACHMENTS = 8;
+ int colorAttachmentCount = 0;
+ bool hasDepthStencil = false;
+ int colorFormat[MAX_COLOR_ATTACHMENTS];
+ int dsFormat;
+ QVector<quint32> serializedFormatData;
+};
+
+struct QD3D12RenderTargetData
+{
+ QD3D12RenderTargetData(QRhiImplementation *) { }
+
+ QD3D12RenderPassDescriptor *rp = nullptr;
+ QSize pixelSize;
+ float dpr = 1;
+ int sampleCount = 1;
+ int colorAttCount = 0;
+ int dsAttCount = 0;
+ QRhiRenderTargetAttachmentTracker::ResIdList currentResIdList;
+ static const int MAX_COLOR_ATTACHMENTS = QD3D12RenderPassDescriptor::MAX_COLOR_ATTACHMENTS;
+ D3D12_CPU_DESCRIPTOR_HANDLE rtv[MAX_COLOR_ATTACHMENTS];
+ D3D12_CPU_DESCRIPTOR_HANDLE dsv;
+};
+
+struct QD3D12SwapChainRenderTarget : public QRhiSwapChainRenderTarget
+{
+ QD3D12SwapChainRenderTarget(QRhiImplementation *rhi, QRhiSwapChain *swapchain);
+ ~QD3D12SwapChainRenderTarget();
+ void destroy() override;
+
+ QSize pixelSize() const override;
+ float devicePixelRatio() const override;
+ int sampleCount() const override;
+
+ QD3D12RenderTargetData d;
+};
+
+struct QD3D12TextureRenderTarget : public QRhiTextureRenderTarget
+{
+ QD3D12TextureRenderTarget(QRhiImplementation *rhi,
+ const QRhiTextureRenderTargetDescription &desc,
+ Flags flags);
+ ~QD3D12TextureRenderTarget();
+ void destroy() override;
+
+ QSize pixelSize() const override;
+ float devicePixelRatio() const override;
+ int sampleCount() const override;
+
+ QRhiRenderPassDescriptor *newCompatibleRenderPassDescriptor() override;
+ bool create() override;
+
+ QD3D12RenderTargetData d;
+ bool ownsRtv[QD3D12RenderTargetData::MAX_COLOR_ATTACHMENTS];
+ QD3D12Descriptor rtv[QD3D12RenderTargetData::MAX_COLOR_ATTACHMENTS];
+ bool ownsDsv = false;
+ QD3D12Descriptor dsv;
+ friend class QRhiD3D12;
+};
+
+struct QD3D12ShaderResourceBindings : public QRhiShaderResourceBindings
+{
+ QD3D12ShaderResourceBindings(QRhiImplementation *rhi);
+ ~QD3D12ShaderResourceBindings();
+ void destroy() override;
+ bool create() override;
+ void updateResources(UpdateFlags flags) override;
+
+ QD3D12ObjectHandle createRootSignature(const QD3D12ShaderStageData *stageData, int stageCount);
+
+ struct VisitorData {
+ QVarLengthArray<D3D12_ROOT_PARAMETER1, 2> cbParams[6];
+
+ D3D12_ROOT_PARAMETER1 srvTables[6] = {};
+ QVarLengthArray<D3D12_DESCRIPTOR_RANGE1, 4> srvRanges[6];
+ quint32 currentSrvRangeOffset[6] = {};
+
+ QVarLengthArray<D3D12_ROOT_PARAMETER1, 4> samplerTables[6];
+ std::array<D3D12_DESCRIPTOR_RANGE1, 16> samplerRanges[6] = {};
+ int samplerRangeHeads[6] = {};
+
+ D3D12_ROOT_PARAMETER1 uavTables[6] = {};
+ QVarLengthArray<D3D12_DESCRIPTOR_RANGE1, 4> uavRanges[6];
+ quint32 currentUavRangeOffset[6] = {};
+ } visitorData;
+
+
+ void visitUniformBuffer(QD3D12Stage s,
+ const QRhiShaderResourceBinding::Data::UniformBufferData &d,
+ int shaderRegister,
+ int binding);
+ void visitTexture(QD3D12Stage s,
+ const QRhiShaderResourceBinding::TextureAndSampler &d,
+ int shaderRegister);
+ void visitSampler(QD3D12Stage s,
+ const QRhiShaderResourceBinding::TextureAndSampler &d,
+ int shaderRegister);
+ void visitStorageBuffer(QD3D12Stage s,
+ const QRhiShaderResourceBinding::Data::StorageBufferData &d,
+ QD3D12ShaderResourceVisitor::StorageOp op,
+ int shaderRegister);
+ void visitStorageImage(QD3D12Stage s,
+ const QRhiShaderResourceBinding::Data::StorageImageData &d,
+ QD3D12ShaderResourceVisitor::StorageOp op,
+ int shaderRegister);
+
+ bool hasDynamicOffset = false;
+ uint generation = 0;
+
+ friend class QRhiD3D12;
+ friend struct QD3D12ShaderResourceVisitor;
+};
+
+struct QD3D12GraphicsPipeline : public QRhiGraphicsPipeline
+{
+ QD3D12GraphicsPipeline(QRhiImplementation *rhi);
+ ~QD3D12GraphicsPipeline();
+ void destroy() override;
+ bool create() override;
+
+ QD3D12ObjectHandle handle;
+ QD3D12ObjectHandle rootSigHandle;
+ std::array<QD3D12ShaderStageData, 5> stageData;
+ D3D12_PRIMITIVE_TOPOLOGY topology;
+ UINT viewInstanceMask = 0;
+ uint generation = 0;
+ friend class QRhiD3D12;
+};
+
+struct QD3D12ComputePipeline : public QRhiComputePipeline
+{
+ QD3D12ComputePipeline(QRhiImplementation *rhi);
+ ~QD3D12ComputePipeline();
+ void destroy() override;
+ bool create() override;
+
+ QD3D12ObjectHandle handle;
+ QD3D12ObjectHandle rootSigHandle;
+ QD3D12ShaderStageData stageData;
+ uint generation = 0;
+ friend class QRhiD3D12;
+};
+
+struct QD3D12CommandBuffer : public QRhiCommandBuffer
+{
+ QD3D12CommandBuffer(QRhiImplementation *rhi);
+ ~QD3D12CommandBuffer();
+ void destroy() override;
+
+ const QRhiNativeHandles *nativeHandles();
+
+ ID3D12GraphicsCommandList1 *cmdList = nullptr; // not owned
+ QRhiD3D12CommandBufferNativeHandles nativeHandlesStruct;
+
+ enum PassType {
+ NoPass,
+ RenderPass,
+ ComputePass
+ };
+
+ void resetState()
+ {
+ recordingPass = NoPass;
+ currentTarget = nullptr;
+
+ resetPerPassState();
+ }
+
+ void resetPerPassState()
+ {
+ currentGraphicsPipeline = nullptr;
+ currentComputePipeline = nullptr;
+ currentPipelineGeneration = 0;
+ currentGraphicsSrb = nullptr;
+ currentComputeSrb = nullptr;
+ currentSrbGeneration = 0;
+ currentIndexBuffer = {};
+ currentIndexOffset = 0;
+ currentIndexFormat = DXGI_FORMAT_R16_UINT;
+ currentVertexBuffers = {};
+ currentVertexOffsets = {};
+ }
+
+ // per-frame
+ PassType recordingPass;
+ QRhiRenderTarget *currentTarget;
+
+ // per-pass
+ QD3D12GraphicsPipeline *currentGraphicsPipeline;
+ QD3D12ComputePipeline *currentComputePipeline;
+ uint currentPipelineGeneration;
+ QRhiShaderResourceBindings *currentGraphicsSrb;
+ QRhiShaderResourceBindings *currentComputeSrb;
+ uint currentSrbGeneration;
+ QD3D12ObjectHandle currentIndexBuffer;
+ quint32 currentIndexOffset;
+ DXGI_FORMAT currentIndexFormat;
+ std::array<QD3D12ObjectHandle, D3D12_IA_VERTEX_INPUT_RESOURCE_SLOT_COUNT> currentVertexBuffers;
+ std::array<quint32, D3D12_IA_VERTEX_INPUT_RESOURCE_SLOT_COUNT> currentVertexOffsets;
+
+ // global
+ double lastGpuTime = 0;
+
+ // per-setShaderResources
+ struct VisitorData {
+ QVarLengthArray<QPair<QD3D12ObjectHandle, quint32>, 4> cbufs[6];
+ QVarLengthArray<QD3D12Descriptor, 8> srvs[6];
+ QVarLengthArray<QD3D12Descriptor, 8> samplers[6];
+ QVarLengthArray<QPair<QD3D12ObjectHandle, D3D12_UNORDERED_ACCESS_VIEW_DESC>, 4> uavs[6];
+ } visitorData;
+
+ void visitUniformBuffer(QD3D12Stage s,
+ const QRhiShaderResourceBinding::Data::UniformBufferData &d,
+ int shaderRegister,
+ int binding,
+ int dynamicOffsetCount,
+ const QRhiCommandBuffer::DynamicOffset *dynamicOffsets);
+ void visitTexture(QD3D12Stage s,
+ const QRhiShaderResourceBinding::TextureAndSampler &d,
+ int shaderRegister);
+ void visitSampler(QD3D12Stage s,
+ const QRhiShaderResourceBinding::TextureAndSampler &d,
+ int shaderRegister);
+ void visitStorageBuffer(QD3D12Stage s,
+ const QRhiShaderResourceBinding::Data::StorageBufferData &d,
+ QD3D12ShaderResourceVisitor::StorageOp op,
+ int shaderRegister);
+ void visitStorageImage(QD3D12Stage s,
+ const QRhiShaderResourceBinding::Data::StorageImageData &d,
+ QD3D12ShaderResourceVisitor::StorageOp op,
+ int shaderRegister);
+};
+
+struct QD3D12SwapChain : public QRhiSwapChain
+{
+ QD3D12SwapChain(QRhiImplementation *rhi);
+ ~QD3D12SwapChain();
+ void destroy() override;
+
+ QRhiCommandBuffer *currentFrameCommandBuffer() override;
+ QRhiRenderTarget *currentFrameRenderTarget() override;
+ QRhiRenderTarget *currentFrameRenderTarget(StereoTargetBuffer targetBuffer) override;
+
+ QSize surfacePixelSize() override;
+ bool isFormatSupported(Format f) override;
+ QRhiSwapChainHdrInfo hdrInfo() override;
+
+ QRhiRenderPassDescriptor *newCompatibleRenderPassDescriptor() override;
+ bool createOrResize() override;
+
+ void releaseBuffers();
+ void waitCommandCompletionForFrameSlot(int frameSlot);
+ void addCommandCompletionSignalForCurrentFrameSlot();
+ void chooseFormats();
+
+ QWindow *window = nullptr;
+ IDXGISwapChain1 *sourceSwapChain1 = nullptr;
+ IDXGISwapChain3 *swapChain = nullptr;
+ QSize pixelSize;
+ UINT swapInterval = 1;
+ UINT swapChainFlags = 0;
+ BOOL stereo = false;
+ DXGI_FORMAT colorFormat;
+ DXGI_FORMAT srgbAdjustedColorFormat;
+ DXGI_COLOR_SPACE_TYPE hdrColorSpace;
+ IDCompositionTarget *dcompTarget = nullptr;
+ IDCompositionVisual *dcompVisual = nullptr;
+ static const UINT BUFFER_COUNT = 3;
+ QD3D12ObjectHandle colorBuffers[BUFFER_COUNT];
+ QD3D12Descriptor rtvs[BUFFER_COUNT];
+ QD3D12Descriptor rtvsRight[BUFFER_COUNT];
+ DXGI_SAMPLE_DESC sampleDesc;
+ QD3D12ObjectHandle msaaBuffers[BUFFER_COUNT];
+ QD3D12Descriptor msaaRtvs[BUFFER_COUNT];
+ QD3D12RenderBuffer *ds = nullptr;
+ UINT currentBackBufferIndex = 0;
+ QD3D12SwapChainRenderTarget rtWrapper;
+ QD3D12SwapChainRenderTarget rtWrapperRight;
+ QD3D12CommandBuffer cbWrapper;
+
+ struct FrameResources {
+ ID3D12Fence *fence = nullptr;
+ HANDLE fenceEvent = nullptr;
+ UINT64 fenceCounter = 0;
+ ID3D12GraphicsCommandList1 *cmdList = nullptr;
+ } frameRes[QD3D12_FRAMES_IN_FLIGHT];
+
+ int currentFrameSlot = 0; // index in frameRes
+};
+
+template<typename T, D3D12_PIPELINE_STATE_SUBOBJECT_TYPE Type>
+struct alignas(void*) QD3D12PipelineStateSubObject
+{
+ D3D12_PIPELINE_STATE_SUBOBJECT_TYPE type = Type;
+ T object = {};
+};
+
+class QRhiD3D12 : public QRhiImplementation
+{
+public:
+ // 16MB * QD3D12_FRAMES_IN_FLIGHT; buffer and texture upload staging data that
+ // gets no space from this will get their own temporary staging areas.
+ static const quint32 SMALL_STAGING_AREA_BYTES_PER_FRAME = 16 * 1024 * 1024;
+
+ static const quint32 SHADER_VISIBLE_CBV_SRV_UAV_HEAP_PER_FRAME_START_SIZE = 16384;
+
+ QRhiD3D12(QRhiD3D12InitParams *params, QRhiD3D12NativeHandles *importDevice = nullptr);
+
+ bool create(QRhi::Flags flags) override;
+ void destroy() override;
+
+ QRhiGraphicsPipeline *createGraphicsPipeline() override;
+ QRhiComputePipeline *createComputePipeline() override;
+ QRhiShaderResourceBindings *createShaderResourceBindings() override;
+ QRhiBuffer *createBuffer(QRhiBuffer::Type type,
+ QRhiBuffer::UsageFlags usage,
+ quint32 size) override;
+ QRhiRenderBuffer *createRenderBuffer(QRhiRenderBuffer::Type type,
+ const QSize &pixelSize,
+ int sampleCount,
+ QRhiRenderBuffer::Flags flags,
+ QRhiTexture::Format backingFormatHint) override;
+ QRhiTexture *createTexture(QRhiTexture::Format format,
+ const QSize &pixelSize,
+ int depth,
+ int arraySize,
+ int sampleCount,
+ QRhiTexture::Flags flags) override;
+ QRhiSampler *createSampler(QRhiSampler::Filter magFilter,
+ QRhiSampler::Filter minFilter,
+ QRhiSampler::Filter mipmapMode,
+ QRhiSampler:: AddressMode u,
+ QRhiSampler::AddressMode v,
+ QRhiSampler::AddressMode w) override;
+
+ QRhiTextureRenderTarget *createTextureRenderTarget(const QRhiTextureRenderTargetDescription &desc,
+ QRhiTextureRenderTarget::Flags flags) override;
+
+ QRhiSwapChain *createSwapChain() override;
+ QRhi::FrameOpResult beginFrame(QRhiSwapChain *swapChain, QRhi::BeginFrameFlags flags) override;
+ QRhi::FrameOpResult endFrame(QRhiSwapChain *swapChain, QRhi::EndFrameFlags flags) override;
+ QRhi::FrameOpResult beginOffscreenFrame(QRhiCommandBuffer **cb, QRhi::BeginFrameFlags flags) override;
+ QRhi::FrameOpResult endOffscreenFrame(QRhi::EndFrameFlags flags) override;
+ QRhi::FrameOpResult finish() override;
+
+ void resourceUpdate(QRhiCommandBuffer *cb, QRhiResourceUpdateBatch *resourceUpdates) override;
+
+ void beginPass(QRhiCommandBuffer *cb,
+ QRhiRenderTarget *rt,
+ const QColor &colorClearValue,
+ const QRhiDepthStencilClearValue &depthStencilClearValue,
+ QRhiResourceUpdateBatch *resourceUpdates,
+ QRhiCommandBuffer::BeginPassFlags flags) override;
+ void endPass(QRhiCommandBuffer *cb, QRhiResourceUpdateBatch *resourceUpdates) override;
+
+ void setGraphicsPipeline(QRhiCommandBuffer *cb,
+ QRhiGraphicsPipeline *ps) override;
+
+ void setShaderResources(QRhiCommandBuffer *cb,
+ QRhiShaderResourceBindings *srb,
+ int dynamicOffsetCount,
+ const QRhiCommandBuffer::DynamicOffset *dynamicOffsets) override;
+
+ void setVertexInput(QRhiCommandBuffer *cb,
+ int startBinding, int bindingCount, const QRhiCommandBuffer::VertexInput *bindings,
+ QRhiBuffer *indexBuf, quint32 indexOffset,
+ QRhiCommandBuffer::IndexFormat indexFormat) override;
+
+ void setViewport(QRhiCommandBuffer *cb, const QRhiViewport &viewport) override;
+ void setScissor(QRhiCommandBuffer *cb, const QRhiScissor &scissor) override;
+ void setBlendConstants(QRhiCommandBuffer *cb, const QColor &c) override;
+ void setStencilRef(QRhiCommandBuffer *cb, quint32 refValue) override;
+
+ void draw(QRhiCommandBuffer *cb, quint32 vertexCount,
+ quint32 instanceCount, quint32 firstVertex, quint32 firstInstance) override;
+
+ void drawIndexed(QRhiCommandBuffer *cb, quint32 indexCount,
+ quint32 instanceCount, quint32 firstIndex,
+ qint32 vertexOffset, quint32 firstInstance) override;
+
+ void debugMarkBegin(QRhiCommandBuffer *cb, const QByteArray &name) override;
+ void debugMarkEnd(QRhiCommandBuffer *cb) override;
+ void debugMarkMsg(QRhiCommandBuffer *cb, const QByteArray &msg) override;
+
+ void beginComputePass(QRhiCommandBuffer *cb,
+ QRhiResourceUpdateBatch *resourceUpdates,
+ QRhiCommandBuffer::BeginPassFlags flags) override;
+ void endComputePass(QRhiCommandBuffer *cb, QRhiResourceUpdateBatch *resourceUpdates) override;
+ void setComputePipeline(QRhiCommandBuffer *cb, QRhiComputePipeline *ps) override;
+ void dispatch(QRhiCommandBuffer *cb, int x, int y, int z) override;
+
+ const QRhiNativeHandles *nativeHandles(QRhiCommandBuffer *cb) override;
+ void beginExternal(QRhiCommandBuffer *cb) override;
+ void endExternal(QRhiCommandBuffer *cb) override;
+ double lastCompletedGpuTime(QRhiCommandBuffer *cb) override;
+
+ QList<int> supportedSampleCounts() const override;
+ int ubufAlignment() const override;
+ bool isYUpInFramebuffer() const override;
+ bool isYUpInNDC() const override;
+ bool isClipDepthZeroToOne() const override;
+ QMatrix4x4 clipSpaceCorrMatrix() const override;
+ bool isTextureFormatSupported(QRhiTexture::Format format, QRhiTexture::Flags flags) const override;
+ bool isFeatureSupported(QRhi::Feature feature) const override;
+ int resourceLimit(QRhi::ResourceLimit limit) const override;
+ const QRhiNativeHandles *nativeHandles() override;
+ QRhiDriverInfo driverInfo() const override;
+ QRhiStats statistics() override;
+ bool makeThreadLocalNativeContextCurrent() override;
+ void releaseCachedResources() override;
+ bool isDeviceLost() const override;
+
+ QByteArray pipelineCacheData() override;
+ void setPipelineCacheData(const QByteArray &data) override;
+
+ void waitGpu();
+ DXGI_SAMPLE_DESC effectiveSampleDesc(int sampleCount, DXGI_FORMAT format) const;
+ bool ensureDirectCompositionDevice();
+ bool startCommandListForCurrentFrameSlot(ID3D12GraphicsCommandList1 **cmdList);
+ void enqueueResourceUpdates(QD3D12CommandBuffer *cbD, QRhiResourceUpdateBatch *resourceUpdates);
+ void finishActiveReadbacks(bool forced = false);
+ bool ensureShaderVisibleDescriptorHeapCapacity(QD3D12ShaderVisibleDescriptorHeap *h,
+ D3D12_DESCRIPTOR_HEAP_TYPE type,
+ int frameSlot,
+ quint32 neededDescriptorCount,
+ bool *gotNew);
+ void bindShaderVisibleHeaps(QD3D12CommandBuffer *cbD);
+
+ bool debugLayer = false;
+ ID3D12Device2 *dev = nullptr;
+ D3D_FEATURE_LEVEL minimumFeatureLevel = D3D_FEATURE_LEVEL(0);
+ LUID adapterLuid = {};
+ bool importedDevice = false;
+ bool importedCommandQueue = false;
+ QRhi::Flags rhiFlags;
+ IDXGIFactory2 *dxgiFactory = nullptr;
+ bool supportsAllowTearing = false;
+ IDXGIAdapter1 *activeAdapter = nullptr;
+ QRhiDriverInfo driverInfoStruct;
+ QRhiD3D12NativeHandles nativeHandlesStruct;
+ bool deviceLost = false;
+ ID3D12CommandQueue *cmdQueue = nullptr;
+ ID3D12Fence *fullFence = nullptr;
+ HANDLE fullFenceEvent = nullptr;
+ UINT64 fullFenceCounter = 0;
+ ID3D12CommandAllocator *cmdAllocators[QD3D12_FRAMES_IN_FLIGHT] = {};
+ QD3D12MemoryAllocator vma;
+ QD3D12CpuDescriptorPool rtvPool;
+ QD3D12CpuDescriptorPool dsvPool;
+ QD3D12CpuDescriptorPool cbvSrvUavPool;
+ QD3D12ObjectPool<QD3D12Resource> resourcePool;
+ QD3D12ObjectPool<QD3D12Pipeline> pipelinePool;
+ QD3D12ObjectPool<QD3D12RootSignature> rootSignaturePool;
+ QD3D12ReleaseQueue releaseQueue;
+ QD3D12ResourceBarrierGenerator barrierGen;
+ QD3D12SamplerManager samplerMgr;
+ QD3D12MipmapGenerator mipmapGen;
+ QD3D12StagingArea smallStagingAreas[QD3D12_FRAMES_IN_FLIGHT];
+ QD3D12ShaderVisibleDescriptorHeap shaderVisibleCbvSrvUavHeap;
+ UINT64 timestampTicksPerSecond = 0;
+ QD3D12QueryHeap timestampQueryHeap;
+ QD3D12StagingArea timestampReadbackArea;
+ IDCompositionDevice *dcompDevice = nullptr;
+ QD3D12SwapChain *currentSwapChain = nullptr;
+ QSet<QD3D12SwapChain *> swapchains;
+ QD3D12ShaderBytecodeCache shaderBytecodeCache;
+ QVarLengthArray<QD3D12Readback, 4> activeReadbacks;
+ bool offscreenActive = false;
+ QD3D12CommandBuffer *offscreenCb[QD3D12_FRAMES_IN_FLIGHT] = {};
+
+ struct {
+ bool multiView = false;
+ bool textureViewFormat = false;
+ } caps;
+};
+
+QT_END_NAMESPACE
+
+#endif // __ID3D12Device2_INTERFACE_DEFINED__
+
+#endif
diff --git a/src/gui/rhi/qrhid3dhelpers.cpp b/src/gui/rhi/qrhid3dhelpers.cpp
new file mode 100644
index 0000000000..216c358cbe
--- /dev/null
+++ b/src/gui/rhi/qrhid3dhelpers.cpp
@@ -0,0 +1,172 @@
+// Copyright (C) 2023 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
+
+#include "qrhid3dhelpers_p.h"
+#include <QtCore/private/qsystemlibrary_p.h>
+#include <QtCore/private/qsystemerror_p.h>
+
+QT_BEGIN_NAMESPACE
+
+namespace QRhiD3D {
+
+bool output6ForWindow(QWindow *w, IDXGIAdapter1 *adapter, IDXGIOutput6 **result)
+{
+ bool ok = false;
+ QRect wr = w->geometry();
+ wr = QRect(wr.topLeft() * w->devicePixelRatio(), wr.size() * w->devicePixelRatio());
+ const QPoint center = wr.center();
+ IDXGIOutput *currentOutput = nullptr;
+ IDXGIOutput *output = nullptr;
+ for (UINT i = 0; adapter->EnumOutputs(i, &output) != DXGI_ERROR_NOT_FOUND; ++i) {
+ DXGI_OUTPUT_DESC desc;
+ output->GetDesc(&desc);
+ const RECT r = desc.DesktopCoordinates;
+ const QRect dr(QPoint(r.left, r.top), QPoint(r.right - 1, r.bottom - 1));
+ if (dr.contains(center)) {
+ currentOutput = output;
+ break;
+ } else {
+ output->Release();
+ }
+ }
+ if (currentOutput) {
+ ok = SUCCEEDED(currentOutput->QueryInterface(__uuidof(IDXGIOutput6), reinterpret_cast<void **>(result)));
+ currentOutput->Release();
+ }
+ return ok;
+}
+
+bool outputDesc1ForWindow(QWindow *w, IDXGIAdapter1 *adapter, DXGI_OUTPUT_DESC1 *result)
+{
+ bool ok = false;
+ IDXGIOutput6 *out6 = nullptr;
+ if (output6ForWindow(w, adapter, &out6)) {
+ ok = SUCCEEDED(out6->GetDesc1(result));
+ out6->Release();
+ }
+ return ok;
+}
+
+float sdrWhiteLevelInNits(const DXGI_OUTPUT_DESC1 &outputDesc)
+{
+ QVector<DISPLAYCONFIG_PATH_INFO> pathInfos;
+ uint32_t pathInfoCount, modeInfoCount;
+ LONG result;
+ do {
+ if (GetDisplayConfigBufferSizes(QDC_ONLY_ACTIVE_PATHS, &pathInfoCount, &modeInfoCount) == ERROR_SUCCESS) {
+ pathInfos.resize(pathInfoCount);
+ QVector<DISPLAYCONFIG_MODE_INFO> modeInfos(modeInfoCount);
+ result = QueryDisplayConfig(QDC_ONLY_ACTIVE_PATHS, &pathInfoCount, pathInfos.data(), &modeInfoCount, modeInfos.data(), nullptr);
+ } else {
+ return 200.0f;
+ }
+ } while (result == ERROR_INSUFFICIENT_BUFFER);
+
+ MONITORINFOEX monitorInfo = {};
+ monitorInfo.cbSize = sizeof(monitorInfo);
+ GetMonitorInfo(outputDesc.Monitor, &monitorInfo);
+
+ for (const DISPLAYCONFIG_PATH_INFO &info : pathInfos) {
+ DISPLAYCONFIG_SOURCE_DEVICE_NAME deviceName = {};
+ deviceName.header.type = DISPLAYCONFIG_DEVICE_INFO_GET_SOURCE_NAME;
+ deviceName.header.size = sizeof(deviceName);
+ deviceName.header.adapterId = info.sourceInfo.adapterId;
+ deviceName.header.id = info.sourceInfo.id;
+ if (DisplayConfigGetDeviceInfo(&deviceName.header) == ERROR_SUCCESS) {
+ if (!wcscmp(monitorInfo.szDevice, deviceName.viewGdiDeviceName)) {
+ DISPLAYCONFIG_SDR_WHITE_LEVEL whiteLevel = {};
+ whiteLevel.header.type = DISPLAYCONFIG_DEVICE_INFO_GET_SDR_WHITE_LEVEL;
+ whiteLevel.header.size = sizeof(DISPLAYCONFIG_SDR_WHITE_LEVEL);
+ whiteLevel.header.adapterId = info.targetInfo.adapterId;
+ whiteLevel.header.id = info.targetInfo.id;
+ if (DisplayConfigGetDeviceInfo(&whiteLevel.header) == ERROR_SUCCESS)
+ return whiteLevel.SDRWhiteLevel * 80 / 1000.0f;
+ }
+ }
+ }
+
+ return 200.0f;
+}
+
+pD3DCompile resolveD3DCompile()
+{
+ for (const wchar_t *libraryName : {L"D3DCompiler_47", L"D3DCompiler_43"}) {
+ QSystemLibrary library(libraryName);
+ if (library.load()) {
+ if (auto symbol = library.resolve("D3DCompile"))
+ return reinterpret_cast<pD3DCompile>(symbol);
+ } else {
+ qWarning("Failed to load D3DCompiler_47/43.dll");
+ }
+ }
+ return nullptr;
+}
+
+IDCompositionDevice *createDirectCompositionDevice()
+{
+ QSystemLibrary dcomplib(QStringLiteral("dcomp"));
+ typedef HRESULT (__stdcall *DCompositionCreateDeviceFuncPtr)(
+ _In_opt_ IDXGIDevice *dxgiDevice,
+ _In_ REFIID iid,
+ _Outptr_ void **dcompositionDevice);
+ DCompositionCreateDeviceFuncPtr func = reinterpret_cast<DCompositionCreateDeviceFuncPtr>(
+ dcomplib.resolve("DCompositionCreateDevice"));
+ if (!func) {
+ qWarning("Unable to resolve DCompositionCreateDevice, perhaps dcomp.dll is missing?");
+ return nullptr;
+ }
+ IDCompositionDevice *device = nullptr;
+ HRESULT hr = func(nullptr, __uuidof(IDCompositionDevice), reinterpret_cast<void **>(&device));
+ if (FAILED(hr)) {
+ qWarning("Failed to create Direct Composition device: %s",
+ qPrintable(QSystemError::windowsComString(hr)));
+ return nullptr;
+ }
+ return device;
+}
+
+#ifdef QRHI_D3D12_HAS_DXC
+std::pair<IDxcCompiler *, IDxcLibrary *> createDxcCompiler()
+{
+ QSystemLibrary dxclib(QStringLiteral("dxcompiler"));
+ // this will not be in the system library location, hence onlySystemDirectory==false
+ if (!dxclib.load(false)) {
+ qWarning("Failed to load dxcompiler.dll");
+ return {};
+ }
+ DxcCreateInstanceProc func = reinterpret_cast<DxcCreateInstanceProc>(dxclib.resolve("DxcCreateInstance"));
+ if (!func) {
+ qWarning("Unable to resolve DxcCreateInstance");
+ return {};
+ }
+ IDxcCompiler *compiler = nullptr;
+ HRESULT hr = func(CLSID_DxcCompiler, __uuidof(IDxcCompiler), reinterpret_cast<void**>(&compiler));
+ if (FAILED(hr)) {
+ qWarning("Failed to create dxc compiler instance: %s",
+ qPrintable(QSystemError::windowsComString(hr)));
+ return {};
+ }
+ IDxcLibrary *library = nullptr;
+ hr = func(CLSID_DxcLibrary, __uuidof(IDxcLibrary), reinterpret_cast<void**>(&library));
+ if (FAILED(hr)) {
+ qWarning("Failed to create dxc library instance: %s",
+ qPrintable(QSystemError::windowsComString(hr)));
+ return {};
+ }
+ return { compiler, library };
+}
+#endif
+
+void fillDriverInfo(QRhiDriverInfo *info, const DXGI_ADAPTER_DESC1 &desc)
+{
+ const QString name = QString::fromUtf16(reinterpret_cast<const char16_t *>(desc.Description));
+ info->deviceName = name.toUtf8();
+ info->deviceId = desc.DeviceId;
+ info->vendorId = desc.VendorId;
+ info->deviceType = (desc.Flags & DXGI_ADAPTER_FLAG_SOFTWARE) ? QRhiDriverInfo::CpuDevice
+ : QRhiDriverInfo::UnknownDevice;
+}
+
+} // namespace
+
+QT_END_NAMESPACE
diff --git a/src/gui/rhi/qrhid3dhelpers_p.h b/src/gui/rhi/qrhid3dhelpers_p.h
new file mode 100644
index 0000000000..f31cdc8d11
--- /dev/null
+++ b/src/gui/rhi/qrhid3dhelpers_p.h
@@ -0,0 +1,53 @@
+// Copyright (C) 2023 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
+
+#ifndef QRHID3DHELPERS_P_H
+#define QRHID3DHELPERS_P_H
+
+//
+// W A R N I N G
+// -------------
+//
+// This file is not part of the Qt API. It exists purely as an
+// implementation detail. This header file may change from version to
+// version without notice, or even be removed.
+//
+// We mean it.
+//
+
+#include <rhi/qrhi.h>
+
+#include <QtGui/qwindow.h>
+
+#include <dxgi1_6.h>
+#include <dcomp.h>
+#include <d3dcompiler.h>
+
+#if __has_include(<dxcapi.h>)
+#include <dxcapi.h>
+#define QRHI_D3D12_HAS_DXC
+#endif
+
+QT_BEGIN_NAMESPACE
+
+namespace QRhiD3D {
+
+bool output6ForWindow(QWindow *w, IDXGIAdapter1 *adapter, IDXGIOutput6 **result);
+bool outputDesc1ForWindow(QWindow *w, IDXGIAdapter1 *adapter, DXGI_OUTPUT_DESC1 *result);
+float sdrWhiteLevelInNits(const DXGI_OUTPUT_DESC1 &outputDesc);
+
+pD3DCompile resolveD3DCompile();
+
+IDCompositionDevice *createDirectCompositionDevice();
+
+#ifdef QRHI_D3D12_HAS_DXC
+std::pair<IDxcCompiler *, IDxcLibrary *> createDxcCompiler();
+#endif
+
+void fillDriverInfo(QRhiDriverInfo *info, const DXGI_ADAPTER_DESC1 &desc);
+
+} // namespace
+
+QT_END_NAMESPACE
+
+#endif
diff --git a/src/gui/rhi/qrhigles2.cpp b/src/gui/rhi/qrhigles2.cpp
index 3fb2ec38a7..dcaa87a5ff 100644
--- a/src/gui/rhi/qrhigles2.cpp
+++ b/src/gui/rhi/qrhigles2.cpp
@@ -1,45 +1,14 @@
-/****************************************************************************
-**
-** Copyright (C) 2019 The Qt Company Ltd.
-** Contact: http://www.qt.io/licensing/
-**
-** This file is part of the Qt Gui module
-**
-** $QT_BEGIN_LICENSE:LGPL3$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "qrhigles2_p_p.h"
-#include <QWindow>
+// Copyright (C) 2023 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
+
+#include "qrhigles2_p.h"
#include <QOffscreenSurface>
#include <QOpenGLContext>
+#include <QtCore/qmap.h>
#include <QtGui/private/qopenglextensions_p.h>
#include <QtGui/private/qopenglprogrambinarycache_p.h>
+#include <QtGui/private/qwindow_p.h>
+#include <qpa/qplatformopenglcontext.h>
#include <qmath.h>
QT_BEGIN_NAMESPACE
@@ -59,13 +28,17 @@ QT_BEGIN_NAMESPACE
/*!
\class QRhiGles2InitParams
- \internal
\inmodule QtGui
+ \since 6.6
\brief OpenGL specific initialization parameters.
- An OpenGL-based QRhi needs an already created QOffscreenSurface at minimum.
- Additionally, while optional, it is recommended that the QWindow the first
- QRhiSwapChain will target is passed in as well.
+ \note This is a RHI API with limited compatibility guarantees, see \l QRhi
+ for details.
+
+ An OpenGL-based QRhi needs an already created QSurface that can be used in
+ combination with QOpenGLContext. Most commonly, this is a QOffscreenSurface
+ in practice. Additionally, while optional, it is recommended that the QWindow
+ the first QRhiSwapChain will target is passed in as well.
\badcode
QOffscreenSurface *fallbackSurface = QRhiGles2InitParams::newFallbackSurface();
@@ -82,21 +55,21 @@ QT_BEGIN_NAMESPACE
thread) are satisfied. The implicitly created context is destroyed
automatically together with the QRhi.
- The QSurfaceFormat for the context is specified in \l format. The
+ The QSurfaceFormat for the context is specified in \c format. The
constructor sets this to QSurfaceFormat::defaultFormat() so applications
- that use QSurfaceFormat::setDefaultFormat() do not need to set the format
- again.
+ that call QSurfaceFormat::setDefaultFormat() with the appropriate settings
+ before the constructor runs will not need to change value of \c format.
- \note The depth and stencil buffer sizes are set automatically to 24 and 8
- when no size was explicitly set for these buffers in \l format. As there
- are possible adjustments to \l format, applications can use
- adjustedFormat() to query the effective format that is passed to
- QOpenGLContext::setFormat() internally.
+ \note Remember to set the depth and stencil buffer sizes to 24 and 8 when
+ the renderer relies on depth or stencil testing, either in the global
+ default QSurfaceFormat, or, alternatively, separately in all the involved
+ QSurfaceFormat instances: in \c format, the format argument passed to
+ newFallbackSurface(), and on any QWindow that is used with the QRhi.
- A QOffscreenSurface has to be specified in \l fallbackSurface. In order to
- prevent mistakes in threaded situations, this is never created
- automatically by the QRhi since, like QWindow, QOffscreenSurface can only
- be created on the gui/main thread.
+ A QSurface has to be specified in \c fallbackSurface. In order to prevent
+ mistakes in threaded situations, this is never created automatically by the
+ QRhi because, like QWindow, instances of QSurface subclasses can often be
+ created on the gui/main thread only.
As a convenience, applications can use newFallbackSurface() which creates
and returns a QOffscreenSurface that is compatible with the QOpenGLContext
@@ -104,23 +77,27 @@ QT_BEGIN_NAMESPACE
of the returned QOffscreenSurface is transferred to the caller and the QRhi
will not destroy it.
- \note QRhiSwapChain can only target QWindow instances that have their
- surface type set to QSurface::OpenGLSurface.
+ \note With the OpenGL backend, QRhiSwapChain can only target QWindow
+ instances that have their surface type set to QSurface::OpenGLSurface or
+ QSurface::RasterGLSurface.
- \note \l window is optional. It is recommended to specify it whenever
+ \note \c window is optional. It is recommended to specify it whenever
possible, in order to avoid problems on multi-adapter and multi-screen
- systems. When \l window is not set, the very first
- QOpenGLContext::makeCurrent() happens with \l fallbackSurface which may be
+ systems. When \c window is not set, the very first
+ QOpenGLContext::makeCurrent() happens with \c fallbackSurface which may be
an invisible window on some platforms (for example, Windows) and that may
trigger unexpected problems in some cases.
+ In case resource sharing with an existing QOpenGLContext is desired, \c
+ shareContext can be set to an existing QOpenGLContext. Alternatively,
+ Qt::AA_ShareOpenGLContexts is honored as well, when enabled.
+
\section2 Working with existing OpenGL contexts
When interoperating with another graphics engine, it may be necessary to
get a QRhi instance that uses the same OpenGL context. This can be achieved
by passing a pointer to a QRhiGles2NativeHandles to QRhi::create(). The
- \l{QRhiGles2NativeHandles::context}{context} must be set to a non-null
- value.
+ \c{QRhiGles2NativeHandles::context} must be set to a non-null value then.
An alternative approach is to create a QOpenGLContext that
\l{QOpenGLContext::setShareContext()}{shares resources} with the other
@@ -131,18 +108,49 @@ QT_BEGIN_NAMESPACE
*/
/*!
+ \variable QRhiGles2InitParams::format
+
+ The QSurfaceFormat, initialized to QSurfaceFormat::defaultFormat() by default.
+*/
+
+/*!
+ \variable QRhiGles2InitParams::fallbackSurface
+
+ A QSurface compatible with \l format. Typically a QOffscreenSurface.
+ Providing this is mandatory. Be aware of the threading implications: a
+ QOffscreenSurface, like QWindow, must only ever be created and destroyed on
+ the main (gui) thread, even if the QRhi is created and operates on another
+ thread.
+*/
+
+/*!
+ \variable QRhiGles2InitParams::window
+
+ Optional, but setting it is recommended when targeting a QWindow with the
+ QRhi.
+*/
+
+/*!
+ \variable QRhiGles2InitParams::shareContext
+
+ Optional, the QOpenGLContext to share resource with. QRhi creates its own
+ context, and setting this member to a valid QOpenGLContext leads to calling
+ \l{QOpenGLContext::setShareContext()}{setShareContext()} with it.
+*/
+
+/*!
\class QRhiGles2NativeHandles
- \internal
\inmodule QtGui
+ \since 6.6
\brief Holds the OpenGL context used by the QRhi.
+
+ \note This is a RHI API with limited compatibility guarantees, see \l QRhi
+ for details.
*/
/*!
- \class QRhiGles2TextureNativeHandles
- \internal
- \inmodule QtGui
- \brief Holds the OpenGL texture object that is backing a QRhiTexture instance.
- */
+ \variable QRhiGles2NativeHandles::context
+*/
#ifndef GL_BGRA
#define GL_BGRA 0x80E1
@@ -152,10 +160,22 @@ QT_BEGIN_NAMESPACE
#define GL_R8 0x8229
#endif
+#ifndef GL_RG8
+#define GL_RG8 0x822B
+#endif
+
+#ifndef GL_RG
+#define GL_RG 0x8227
+#endif
+
#ifndef GL_R16
#define GL_R16 0x822A
#endif
+#ifndef GL_RG16
+#define GL_RG16 0x822C
+#endif
+
#ifndef GL_RED
#define GL_RED 0x1903
#endif
@@ -172,6 +192,14 @@ QT_BEGIN_NAMESPACE
#define GL_RGBA16F 0x881A
#endif
+#ifndef GL_R16F
+#define GL_R16F 0x822D
+#endif
+
+#ifndef GL_R32F
+#define GL_R32F 0x822E
+#endif
+
#ifndef GL_HALF_FLOAT
#define GL_HALF_FLOAT 0x140B
#endif
@@ -188,6 +216,10 @@ QT_BEGIN_NAMESPACE
#define GL_DEPTH_COMPONENT32F 0x8CAC
#endif
+#ifndef GL_UNSIGNED_INT_24_8
+#define GL_UNSIGNED_INT_24_8 0x84FA
+#endif
+
#ifndef GL_STENCIL_INDEX
#define GL_STENCIL_INDEX 0x1901
#endif
@@ -213,7 +245,7 @@ QT_BEGIN_NAMESPACE
#endif
#ifndef GL_FRAMEBUFFER_SRGB
-#define GL_FRAMEBUFFER_SRGB 0x8DB9
+#define GL_FRAMEBUFFER_SRGB 0x8DB9
#endif
#ifndef GL_READ_FRAMEBUFFER
@@ -264,6 +296,46 @@ QT_BEGIN_NAMESPACE
#define GL_COMPUTE_SHADER 0x91B9
#endif
+#ifndef GL_VERTEX_ATTRIB_ARRAY_BARRIER_BIT
+#define GL_VERTEX_ATTRIB_ARRAY_BARRIER_BIT 0x00000001
+#endif
+
+#ifndef GL_ELEMENT_ARRAY_BARRIER_BIT
+#define GL_ELEMENT_ARRAY_BARRIER_BIT 0x00000002
+#endif
+
+#ifndef GL_UNIFORM_BARRIER_BIT
+#define GL_UNIFORM_BARRIER_BIT 0x00000004
+#endif
+
+#ifndef GL_BUFFER_UPDATE_BARRIER_BIT
+#define GL_BUFFER_UPDATE_BARRIER_BIT 0x00000200
+#endif
+
+#ifndef GL_SHADER_STORAGE_BARRIER_BIT
+#define GL_SHADER_STORAGE_BARRIER_BIT 0x00002000
+#endif
+
+#ifndef GL_TEXTURE_FETCH_BARRIER_BIT
+#define GL_TEXTURE_FETCH_BARRIER_BIT 0x00000008
+#endif
+
+#ifndef GL_SHADER_IMAGE_ACCESS_BARRIER_BIT
+#define GL_SHADER_IMAGE_ACCESS_BARRIER_BIT 0x00000020
+#endif
+
+#ifndef GL_PIXEL_BUFFER_BARRIER_BIT
+#define GL_PIXEL_BUFFER_BARRIER_BIT 0x00000080
+#endif
+
+#ifndef GL_TEXTURE_UPDATE_BARRIER_BIT
+#define GL_TEXTURE_UPDATE_BARRIER_BIT 0x00000100
+#endif
+
+#ifndef GL_FRAMEBUFFER_BARRIER_BIT
+#define GL_FRAMEBUFFER_BARRIER_BIT 0x00000400
+#endif
+
#ifndef GL_ALL_BARRIER_BITS
#define GL_ALL_BARRIER_BITS 0xFFFFFFFF
#endif
@@ -280,7 +352,181 @@ QT_BEGIN_NAMESPACE
#define GL_MAP_READ_BIT 0x0001
#endif
-Q_DECLARE_LOGGING_CATEGORY(lcOpenGLProgramDiskCache)
+#ifndef GL_MAP_WRITE_BIT
+#define GL_MAP_WRITE_BIT 0x0002
+#endif
+
+#ifndef GL_TEXTURE_2D_MULTISAMPLE
+#define GL_TEXTURE_2D_MULTISAMPLE 0x9100
+#endif
+
+#ifndef GL_TEXTURE_2D_MULTISAMPLE_ARRAY
+#define GL_TEXTURE_2D_MULTISAMPLE_ARRAY 0x9102
+#endif
+
+#ifndef GL_TEXTURE_EXTERNAL_OES
+#define GL_TEXTURE_EXTERNAL_OES 0x8D65
+#endif
+
+#ifndef GL_MAX_COMPUTE_WORK_GROUP_INVOCATIONS
+#define GL_MAX_COMPUTE_WORK_GROUP_INVOCATIONS 0x90EB
+#endif
+
+#ifndef GL_MAX_COMPUTE_WORK_GROUP_COUNT
+#define GL_MAX_COMPUTE_WORK_GROUP_COUNT 0x91BE
+#endif
+
+#ifndef GL_MAX_COMPUTE_WORK_GROUP_SIZE
+#define GL_MAX_COMPUTE_WORK_GROUP_SIZE 0x91BF
+#endif
+
+#ifndef GL_TEXTURE_CUBE_MAP_SEAMLESS
+#define GL_TEXTURE_CUBE_MAP_SEAMLESS 0x884F
+#endif
+
+#ifndef GL_CONTEXT_LOST
+#define GL_CONTEXT_LOST 0x0507
+#endif
+
+#ifndef GL_PROGRAM_BINARY_LENGTH
+#define GL_PROGRAM_BINARY_LENGTH 0x8741
+#endif
+
+#ifndef GL_NUM_PROGRAM_BINARY_FORMATS
+#define GL_NUM_PROGRAM_BINARY_FORMATS 0x87FE
+#endif
+
+#ifndef GL_UNPACK_ROW_LENGTH
+#define GL_UNPACK_ROW_LENGTH 0x0CF2
+#endif
+
+#ifndef GL_TEXTURE_3D
+#define GL_TEXTURE_3D 0x806F
+#endif
+
+#ifndef GL_TEXTURE_WRAP_R
+#define GL_TEXTURE_WRAP_R 0x8072
+#endif
+
+#ifndef GL_TEXTURE_RECTANGLE
+#define GL_TEXTURE_RECTANGLE 0x84F5
+#endif
+
+#ifndef GL_TEXTURE_2D_ARRAY
+#define GL_TEXTURE_2D_ARRAY 0x8C1A
+#endif
+
+#ifndef GL_MAX_ARRAY_TEXTURE_LAYERS
+#define GL_MAX_ARRAY_TEXTURE_LAYERS 0x88FF
+#endif
+
+#ifndef GL_MAX_VERTEX_UNIFORM_COMPONENTS
+#define GL_MAX_VERTEX_UNIFORM_COMPONENTS 0x8B4A
+#endif
+
+#ifndef GL_MAX_FRAGMENT_UNIFORM_COMPONENTS
+#define GL_MAX_FRAGMENT_UNIFORM_COMPONENTS 0x8B49
+#endif
+
+#ifndef GL_MAX_VERTEX_UNIFORM_VECTORS
+#define GL_MAX_VERTEX_UNIFORM_VECTORS 0x8DFB
+#endif
+
+#ifndef GL_MAX_FRAGMENT_UNIFORM_VECTORS
+#define GL_MAX_FRAGMENT_UNIFORM_VECTORS 0x8DFD
+#endif
+
+#ifndef GL_RGB10_A2
+#define GL_RGB10_A2 0x8059
+#endif
+
+#ifndef GL_UNSIGNED_INT_2_10_10_10_REV
+#define GL_UNSIGNED_INT_2_10_10_10_REV 0x8368
+#endif
+
+#ifndef GL_MAX_VARYING_COMPONENTS
+#define GL_MAX_VARYING_COMPONENTS 0x8B4B
+#endif
+
+#ifndef GL_MAX_VARYING_FLOATS
+#define GL_MAX_VARYING_FLOATS 0x8B4B
+#endif
+
+#ifndef GL_MAX_VARYING_VECTORS
+#define GL_MAX_VARYING_VECTORS 0x8DFC
+#endif
+
+#ifndef GL_TESS_CONTROL_SHADER
+#define GL_TESS_CONTROL_SHADER 0x8E88
+#endif
+
+#ifndef GL_TESS_EVALUATION_SHADER
+#define GL_TESS_EVALUATION_SHADER 0x8E87
+#endif
+
+#ifndef GL_PATCH_VERTICES
+#define GL_PATCH_VERTICES 0x8E72
+#endif
+
+#ifndef GL_LINE
+#define GL_LINE 0x1B01
+#endif
+
+#ifndef GL_FILL
+#define GL_FILL 0x1B02
+#endif
+
+#ifndef GL_PATCHES
+#define GL_PATCHES 0x000E
+#endif
+
+#ifndef GL_GEOMETRY_SHADER
+#define GL_GEOMETRY_SHADER 0x8DD9
+#endif
+
+#ifndef GL_BACK_LEFT
+#define GL_BACK_LEFT 0x0402
+#endif
+
+#ifndef GL_BACK_RIGHT
+#define GL_BACK_RIGHT 0x0403
+#endif
+
+#ifndef GL_TEXTURE_1D
+# define GL_TEXTURE_1D 0x0DE0
+#endif
+
+#ifndef GL_TEXTURE_1D_ARRAY
+# define GL_TEXTURE_1D_ARRAY 0x8C18
+#endif
+
+#ifndef GL_HALF_FLOAT
+#define GL_HALF_FLOAT 0x140B
+#endif
+
+#ifndef GL_MAX_VERTEX_OUTPUT_COMPONENTS
+#define GL_MAX_VERTEX_OUTPUT_COMPONENTS 0x9122
+#endif
+
+#ifndef GL_TIMESTAMP
+#define GL_TIMESTAMP 0x8E28
+#endif
+
+#ifndef GL_QUERY_RESULT
+#define GL_QUERY_RESULT 0x8866
+#endif
+
+#ifndef GL_QUERY_RESULT_AVAILABLE
+#define GL_QUERY_RESULT_AVAILABLE 0x8867
+#endif
+
+#ifndef GL_BUFFER
+#define GL_BUFFER 0x82E0
+#endif
+
+#ifndef GL_PROGRAM
+#define GL_PROGRAM 0x82E2
+#endif
/*!
Constructs a new QRhiGles2InitParams.
@@ -293,28 +539,12 @@ QRhiGles2InitParams::QRhiGles2InitParams()
}
/*!
- \return the QSurfaceFormat that will be set on the QOpenGLContext before
- calling QOpenGLContext::create(). This format is based on \a format, but
- may be adjusted. Applicable only when QRhi creates the context.
- Applications are advised to set this format on their QWindow in order to
- avoid potential BAD_MATCH failures.
- */
-QSurfaceFormat QRhiGles2InitParams::adjustedFormat(const QSurfaceFormat &format)
-{
- QSurfaceFormat fmt = format;
-
- if (fmt.depthBufferSize() == -1)
- fmt.setDepthBufferSize(24);
- if (fmt.stencilBufferSize() == -1)
- fmt.setStencilBufferSize(8);
-
- return fmt;
-}
-
-/*!
\return a new QOffscreenSurface that can be used with a QRhi by passing it
via a QRhiGles2InitParams.
+ When \a format is not specified, its default value is the global default
+ format settable via QSurfaceFormat::setDefaultFormat().
+
\a format is adjusted as appropriate in order to avoid having problems
afterwards due to an incompatible context and surface.
@@ -326,7 +556,7 @@ QSurfaceFormat QRhiGles2InitParams::adjustedFormat(const QSurfaceFormat &format)
*/
QOffscreenSurface *QRhiGles2InitParams::newFallbackSurface(const QSurfaceFormat &format)
{
- QSurfaceFormat fmt = adjustedFormat(format);
+ QSurfaceFormat fmt = format;
// To resolve all fields in the format as much as possible, create a context.
// This may be heavy, but allows avoiding BAD_MATCH on some systems.
@@ -347,9 +577,10 @@ QOffscreenSurface *QRhiGles2InitParams::newFallbackSurface(const QSurfaceFormat
QRhiGles2::QRhiGles2(QRhiGles2InitParams *params, QRhiGles2NativeHandles *importDevice)
: ofr(this)
{
- requestedFormat = QRhiGles2InitParams::adjustedFormat(params->format);
+ requestedFormat = params->format;
fallbackSurface = params->fallbackSurface;
maybeWindow = params->window; // may be null
+ maybeShareContext = params->shareContext; // may be null
importedContext = importDevice != nullptr;
if (importedContext) {
@@ -361,21 +592,50 @@ QRhiGles2::QRhiGles2(QRhiGles2InitParams *params, QRhiGles2NativeHandles *import
}
}
-bool QRhiGles2::ensureContext(QSurface *surface) const
+static inline QSurface *currentSurfaceForCurrentContext(QOpenGLContext *ctx)
{
- bool nativeWindowGone = false;
- if (surface && surface->surfaceClass() == QSurface::Window && !surface->surfaceHandle()) {
- surface = fallbackSurface;
- nativeWindowGone = true;
- }
+ if (QOpenGLContext::currentContext() != ctx)
+ return nullptr;
+
+ QSurface *currentSurface = ctx->surface();
+ if (!currentSurface)
+ return nullptr;
+
+ if (currentSurface->surfaceClass() == QSurface::Window && !currentSurface->surfaceHandle())
+ return nullptr;
+
+ return currentSurface;
+}
- if (!surface)
- surface = fallbackSurface;
+QSurface *QRhiGles2::evaluateFallbackSurface() const
+{
+ // With Apple's deprecated OpenGL support we need to minimize the usage of
+ // QOffscreenSurface since delicate problems can pop up with
+ // NSOpenGLContext and drawables.
+#if defined(Q_OS_MACOS)
+ return maybeWindow && maybeWindow->handle() ? static_cast<QSurface *>(maybeWindow) : fallbackSurface;
+#else
+ return fallbackSurface;
+#endif
+}
- if (needsMakeCurrent)
- needsMakeCurrent = false;
- else if (!nativeWindowGone && QOpenGLContext::currentContext() == ctx && (surface == fallbackSurface || ctx->surface() == surface))
+bool QRhiGles2::ensureContext(QSurface *surface) const
+{
+ if (!surface) {
+ // null means any surface is good because not going to render
+ if (currentSurfaceForCurrentContext(ctx))
+ return true;
+ // if the context is not already current with a valid surface, use our
+ // fallback surface, but platform specific quirks may apply
+ surface = evaluateFallbackSurface();
+ } else if (surface->surfaceClass() == QSurface::Window && !surface->surfaceHandle()) {
+ // the window is not usable anymore (no native window underneath), behave as if offscreen
+ surface = evaluateFallbackSurface();
+ } else if (!needsMakeCurrentDueToSwap && currentSurfaceForCurrentContext(ctx) == surface) {
+ // bail out if the makeCurrent is not necessary
return true;
+ }
+ needsMakeCurrentDueToSwap = false;
if (!ctx->makeCurrent(surface)) {
if (ctx->isValid()) {
@@ -390,14 +650,75 @@ bool QRhiGles2::ensureContext(QSurface *surface) const
return true;
}
+static inline GLenum toGlCompressedTextureFormat(QRhiTexture::Format format, QRhiTexture::Flags flags)
+{
+ const bool srgb = flags.testFlag(QRhiTexture::sRGB);
+ switch (format) {
+ case QRhiTexture::BC1:
+ return srgb ? 0x8C4C : 0x83F0;
+ case QRhiTexture::BC2:
+ return srgb ? 0x8C4E : 0x83F2;
+ case QRhiTexture::BC3:
+ return srgb ? 0x8C4F : 0x83F3;
+
+ case QRhiTexture::ETC2_RGB8:
+ return srgb ? 0x9275 : 0x9274;
+ case QRhiTexture::ETC2_RGB8A1:
+ return srgb ? 0x9277 : 0x9276;
+ case QRhiTexture::ETC2_RGBA8:
+ return srgb ? 0x9279 : 0x9278;
+
+ case QRhiTexture::ASTC_4x4:
+ return srgb ? 0x93D0 : 0x93B0;
+ case QRhiTexture::ASTC_5x4:
+ return srgb ? 0x93D1 : 0x93B1;
+ case QRhiTexture::ASTC_5x5:
+ return srgb ? 0x93D2 : 0x93B2;
+ case QRhiTexture::ASTC_6x5:
+ return srgb ? 0x93D3 : 0x93B3;
+ case QRhiTexture::ASTC_6x6:
+ return srgb ? 0x93D4 : 0x93B4;
+ case QRhiTexture::ASTC_8x5:
+ return srgb ? 0x93D5 : 0x93B5;
+ case QRhiTexture::ASTC_8x6:
+ return srgb ? 0x93D6 : 0x93B6;
+ case QRhiTexture::ASTC_8x8:
+ return srgb ? 0x93D7 : 0x93B7;
+ case QRhiTexture::ASTC_10x5:
+ return srgb ? 0x93D8 : 0x93B8;
+ case QRhiTexture::ASTC_10x6:
+ return srgb ? 0x93D9 : 0x93B9;
+ case QRhiTexture::ASTC_10x8:
+ return srgb ? 0x93DA : 0x93BA;
+ case QRhiTexture::ASTC_10x10:
+ return srgb ? 0x93DB : 0x93BB;
+ case QRhiTexture::ASTC_12x10:
+ return srgb ? 0x93DC : 0x93BC;
+ case QRhiTexture::ASTC_12x12:
+ return srgb ? 0x93DD : 0x93BD;
+
+ default:
+ return 0; // this is reachable, just return an invalid format
+ }
+}
+
bool QRhiGles2::create(QRhi::Flags flags)
{
- Q_UNUSED(flags);
Q_ASSERT(fallbackSurface);
+ rhiFlags = flags;
if (!importedContext) {
ctx = new QOpenGLContext;
ctx->setFormat(requestedFormat);
+ if (maybeShareContext) {
+ ctx->setShareContext(maybeShareContext);
+ ctx->setScreen(maybeShareContext->screen());
+ } else if (QOpenGLContext *shareContext = qt_gl_global_share_context()) {
+ ctx->setShareContext(shareContext);
+ ctx->setScreen(shareContext->screen());
+ } else if (maybeWindow) {
+ ctx->setScreen(maybeWindow->screen());
+ }
if (!ctx->create()) {
qWarning("QRhiGles2: Failed to create context");
delete ctx;
@@ -411,6 +732,40 @@ bool QRhiGles2::create(QRhi::Flags flags)
return false;
f = static_cast<QOpenGLExtensions *>(ctx->extraFunctions());
+ const QSurfaceFormat actualFormat = ctx->format();
+ caps.gles = actualFormat.renderableType() == QSurfaceFormat::OpenGLES;
+
+ if (!caps.gles) {
+ glPolygonMode = reinterpret_cast<void(QOPENGLF_APIENTRYP)(GLenum, GLenum)>(
+ ctx->getProcAddress(QByteArrayLiteral("glPolygonMode")));
+
+ glTexImage1D = reinterpret_cast<void(QOPENGLF_APIENTRYP)(
+ GLenum, GLint, GLint, GLsizei, GLint, GLenum, GLenum, const void *)>(
+ ctx->getProcAddress(QByteArrayLiteral("glTexImage1D")));
+
+ glTexStorage1D = reinterpret_cast<void(QOPENGLF_APIENTRYP)(GLenum, GLint, GLenum, GLsizei)>(
+ ctx->getProcAddress(QByteArrayLiteral("glTexStorage1D")));
+
+ glTexSubImage1D = reinterpret_cast<void(QOPENGLF_APIENTRYP)(
+ GLenum, GLint, GLint, GLsizei, GLenum, GLenum, const GLvoid *)>(
+ ctx->getProcAddress(QByteArrayLiteral("glTexSubImage1D")));
+
+ glCopyTexSubImage1D = reinterpret_cast<void(QOPENGLF_APIENTRYP)(GLenum, GLint, GLint, GLint,
+ GLint, GLsizei)>(
+ ctx->getProcAddress(QByteArrayLiteral("glCopyTexSubImage1D")));
+
+ glCompressedTexImage1D = reinterpret_cast<void(QOPENGLF_APIENTRYP)(
+ GLenum, GLint, GLenum, GLsizei, GLint, GLsizei, const GLvoid *)>(
+ ctx->getProcAddress(QByteArrayLiteral("glCompressedTexImage1D")));
+
+ glCompressedTexSubImage1D = reinterpret_cast<void(QOPENGLF_APIENTRYP)(
+ GLenum, GLint, GLint, GLsizei, GLenum, GLsizei, const GLvoid *)>(
+ ctx->getProcAddress(QByteArrayLiteral("glCompressedTexSubImage1D")));
+
+ glFramebufferTexture1D =
+ reinterpret_cast<void(QOPENGLF_APIENTRYP)(GLenum, GLenum, GLenum, GLuint, GLint)>(
+ ctx->getProcAddress(QByteArrayLiteral("glFramebufferTexture1D")));
+ }
const char *vendor = reinterpret_cast<const char *>(f->glGetString(GL_VENDOR));
const char *renderer = reinterpret_cast<const char *>(f->glGetString(GL_RENDERER));
@@ -418,26 +773,89 @@ bool QRhiGles2::create(QRhi::Flags flags)
if (vendor && renderer && version)
qCDebug(QRHI_LOG_INFO, "OpenGL VENDOR: %s RENDERER: %s VERSION: %s", vendor, renderer, version);
- const QSurfaceFormat actualFormat = ctx->format();
+ if (vendor) {
+ driverInfoStruct.deviceName += QByteArray(vendor);
+ driverInfoStruct.deviceName += ' ';
+ }
+ if (renderer) {
+ driverInfoStruct.deviceName += QByteArray(renderer);
+ driverInfoStruct.deviceName += ' ';
+ }
+ if (version)
+ driverInfoStruct.deviceName += QByteArray(version);
caps.ctxMajor = actualFormat.majorVersion();
caps.ctxMinor = actualFormat.minorVersion();
GLint n = 0;
f->glGetIntegerv(GL_NUM_COMPRESSED_TEXTURE_FORMATS, &n);
- supportedCompressedFormats.resize(n);
- if (n > 0)
- f->glGetIntegerv(GL_COMPRESSED_TEXTURE_FORMATS, supportedCompressedFormats.data());
+ if (n > 0) {
+ QVarLengthArray<GLint, 16> compressedTextureFormats(n);
+ f->glGetIntegerv(GL_COMPRESSED_TEXTURE_FORMATS, compressedTextureFormats.data());
+ for (GLint format : compressedTextureFormats)
+ supportedCompressedFormats.insert(format);
+
+ }
+ // The above looks nice, if only it worked always. With GLES the list we
+ // query is likely the full list of compressed formats (mostly anything
+ // that can be decoded). With OpenGL however the list is not required to
+ // include all formats due to the way the spec is worded. For instance, we
+ // cannot rely on ASTC formats being present in the list on non-ES. Some
+ // drivers do include them (Intel, NVIDIA), some don't (Mesa). On the other
+ // hand, relying on extension strings only is not ok: for example, Intel
+ // reports GL_KHR_texture_compression_astc_ldr whereas NVIDIA doesn't. So
+ // the only reasonable thing to do is to query the list always and then see
+ // if there is something we can add - if not already in there.
+ std::array<QRhiTexture::Flags, 2> textureVariantFlags;
+ textureVariantFlags[0] = {};
+ textureVariantFlags[1] = QRhiTexture::sRGB;
+ if (f->hasOpenGLExtension(QOpenGLExtensions::DDSTextureCompression)) {
+ for (QRhiTexture::Flags f : textureVariantFlags) {
+ supportedCompressedFormats.insert(toGlCompressedTextureFormat(QRhiTexture::BC1, f));
+ supportedCompressedFormats.insert(toGlCompressedTextureFormat(QRhiTexture::BC2, f));
+ supportedCompressedFormats.insert(toGlCompressedTextureFormat(QRhiTexture::BC3, f));
+ }
+ }
+ if (f->hasOpenGLExtension(QOpenGLExtensions::ETC2TextureCompression)) {
+ for (QRhiTexture::Flags f : textureVariantFlags) {
+ supportedCompressedFormats.insert(toGlCompressedTextureFormat(QRhiTexture::ETC2_RGB8, f));
+ supportedCompressedFormats.insert(toGlCompressedTextureFormat(QRhiTexture::ETC2_RGB8A1, f));
+ supportedCompressedFormats.insert(toGlCompressedTextureFormat(QRhiTexture::ETC2_RGBA8, f));
+ }
+ }
+ if (f->hasOpenGLExtension(QOpenGLExtensions::ASTCTextureCompression)) {
+ for (QRhiTexture::Flags f : textureVariantFlags) {
+ supportedCompressedFormats.insert(toGlCompressedTextureFormat(QRhiTexture::ASTC_4x4, f));
+ supportedCompressedFormats.insert(toGlCompressedTextureFormat(QRhiTexture::ASTC_5x4, f));
+ supportedCompressedFormats.insert(toGlCompressedTextureFormat(QRhiTexture::ASTC_5x5, f));
+ supportedCompressedFormats.insert(toGlCompressedTextureFormat(QRhiTexture::ASTC_6x5, f));
+ supportedCompressedFormats.insert(toGlCompressedTextureFormat(QRhiTexture::ASTC_6x6, f));
+ supportedCompressedFormats.insert(toGlCompressedTextureFormat(QRhiTexture::ASTC_8x5, f));
+ supportedCompressedFormats.insert(toGlCompressedTextureFormat(QRhiTexture::ASTC_8x6, f));
+ supportedCompressedFormats.insert(toGlCompressedTextureFormat(QRhiTexture::ASTC_8x8, f));
+ supportedCompressedFormats.insert(toGlCompressedTextureFormat(QRhiTexture::ASTC_10x5, f));
+ supportedCompressedFormats.insert(toGlCompressedTextureFormat(QRhiTexture::ASTC_10x8, f));
+ supportedCompressedFormats.insert(toGlCompressedTextureFormat(QRhiTexture::ASTC_10x10, f));
+ supportedCompressedFormats.insert(toGlCompressedTextureFormat(QRhiTexture::ASTC_12x10, f));
+ supportedCompressedFormats.insert(toGlCompressedTextureFormat(QRhiTexture::ASTC_12x12, f));
+ }
+ }
f->glGetIntegerv(GL_MAX_TEXTURE_SIZE, &caps.maxTextureSize);
- if (caps.ctxMajor >= 3 || actualFormat.renderableType() == QSurfaceFormat::OpenGL) {
+ if (!caps.gles || caps.ctxMajor >= 3) {
+ // non-ES or ES 3.0+
f->glGetIntegerv(GL_MAX_DRAW_BUFFERS, &caps.maxDrawBuffers);
+ caps.hasDrawBuffersFunc = true;
f->glGetIntegerv(GL_MAX_SAMPLES, &caps.maxSamples);
caps.maxSamples = qMax(1, caps.maxSamples);
} else {
+ // ES 2.0 / WebGL 1
caps.maxDrawBuffers = 1;
- caps.maxSamples = 1;
+ caps.hasDrawBuffersFunc = false;
+ // This does not mean MSAA is not supported, just that we cannot query
+ // the supported sample counts. Assume that 4x is always supported.
+ caps.maxSamples = 4;
}
caps.msaaRenderBuffer = f->hasOpenGLExtension(QOpenGLExtensions::FramebufferMultisample)
@@ -446,20 +864,27 @@ bool QRhiGles2::create(QRhi::Flags flags)
caps.npotTextureFull = f->hasOpenGLFeature(QOpenGLFunctions::NPOTTextures)
&& f->hasOpenGLFeature(QOpenGLFunctions::NPOTTextureRepeat);
- caps.gles = actualFormat.renderableType() == QSurfaceFormat::OpenGLES;
if (caps.gles)
caps.fixedIndexPrimitiveRestart = caps.ctxMajor >= 3; // ES 3.0
else
caps.fixedIndexPrimitiveRestart = caps.ctxMajor > 4 || (caps.ctxMajor == 4 && caps.ctxMinor >= 3); // 4.3
- if (caps.fixedIndexPrimitiveRestart)
+ if (caps.fixedIndexPrimitiveRestart) {
+#ifdef Q_OS_WASM
+ // WebGL 2 behaves as if GL_PRIMITIVE_RESTART_FIXED_INDEX was always
+ // enabled (i.e. matching D3D/Metal), and the value cannot be passed to
+ // glEnable, so skip the call.
+#else
f->glEnable(GL_PRIMITIVE_RESTART_FIXED_INDEX);
+#endif
+ }
caps.bgraExternalFormat = f->hasOpenGLExtension(QOpenGLExtensions::BGRATextureFormat);
caps.bgraInternalFormat = caps.bgraExternalFormat && caps.gles;
caps.r8Format = f->hasOpenGLFeature(QOpenGLFunctions::TextureRGFormats);
caps.r16Format = f->hasOpenGLExtension(QOpenGLExtensions::Sized16Formats);
caps.floatFormats = caps.ctxMajor >= 3; // 3.0 or ES 3.0
+ caps.rgb10Formats = caps.ctxMajor >= 3; // 3.0 or ES 3.0
caps.depthTexture = caps.ctxMajor >= 3; // 3.0 or ES 3.0
caps.packedDepthStencil = f->hasOpenGLExtension(QOpenGLExtensions::PackedDepthStencil);
#ifdef Q_OS_WASM
@@ -467,7 +892,13 @@ bool QRhiGles2::create(QRhi::Flags flags)
#else
caps.needsDepthStencilCombinedAttach = false;
#endif
- caps.srgbCapableDefaultFramebuffer = f->hasOpenGLExtension(QOpenGLExtensions::SRGBFrameBuffer);
+
+ // QOpenGLExtensions::SRGBFrameBuffer is not useful here. We need to know if
+ // controlling the sRGB-on-shader-write state is supported, not that if the
+ // default framebuffer is sRGB-capable. And there are two different
+ // extensions for desktop and ES.
+ caps.srgbWriteControl = ctx->hasExtension("GL_EXT_framebuffer_sRGB") || ctx->hasExtension("GL_EXT_sRGB_write_control");
+
caps.coreProfile = actualFormat.profile() == QSurfaceFormat::CoreProfile;
if (caps.gles)
@@ -491,6 +922,18 @@ bool QRhiGles2::create(QRhi::Flags flags)
else
caps.compute = caps.ctxMajor > 4 || (caps.ctxMajor == 4 && caps.ctxMinor >= 3); // 4.3
+ if (caps.compute) {
+ f->glGetIntegerv(GL_MAX_COMPUTE_WORK_GROUP_INVOCATIONS, &caps.maxThreadsPerThreadGroup);
+ GLint tgPerDim[3];
+ f->glGetIntegeri_v(GL_MAX_COMPUTE_WORK_GROUP_COUNT, 0, &tgPerDim[0]);
+ f->glGetIntegeri_v(GL_MAX_COMPUTE_WORK_GROUP_COUNT, 1, &tgPerDim[1]);
+ f->glGetIntegeri_v(GL_MAX_COMPUTE_WORK_GROUP_COUNT, 2, &tgPerDim[2]);
+ caps.maxThreadGroupsPerDimension = qMin(tgPerDim[0], qMin(tgPerDim[1], tgPerDim[2]));
+ f->glGetIntegeri_v(GL_MAX_COMPUTE_WORK_GROUP_SIZE, 0, &caps.maxThreadGroupsX);
+ f->glGetIntegeri_v(GL_MAX_COMPUTE_WORK_GROUP_SIZE, 1, &caps.maxThreadGroupsY);
+ f->glGetIntegeri_v(GL_MAX_COMPUTE_WORK_GROUP_SIZE, 2, &caps.maxThreadGroupsZ);
+ }
+
if (caps.gles)
caps.textureCompareMode = caps.ctxMajor >= 3; // ES 3.0
else
@@ -505,11 +948,156 @@ bool QRhiGles2::create(QRhi::Flags flags)
else
caps.nonBaseLevelFramebufferTexture = true;
+ caps.texelFetch = caps.ctxMajor >= 3; // 3.0 or ES 3.0
+ caps.intAttributes = caps.ctxMajor >= 3; // 3.0 or ES 3.0
+ caps.screenSpaceDerivatives = f->hasOpenGLExtension(QOpenGLExtensions::StandardDerivatives);
+
+ if (caps.gles)
+ caps.multisampledTexture = caps.ctxMajor > 3 || (caps.ctxMajor == 3 && caps.ctxMinor >= 1); // ES 3.1
+ else
+ caps.multisampledTexture = caps.ctxMajor >= 3; // 3.0
+
+ // Program binary support: only the core stuff, do not bother with the old
+ // extensions like GL_OES_get_program_binary
+ if (caps.gles)
+ caps.programBinary = caps.ctxMajor >= 3; // ES 3.0
+ else
+ caps.programBinary = caps.ctxMajor > 4 || (caps.ctxMajor == 4 && caps.ctxMinor >= 1); // 4.1
+
+ if (caps.programBinary) {
+ GLint fmtCount = 0;
+ f->glGetIntegerv(GL_NUM_PROGRAM_BINARY_FORMATS, &fmtCount);
+ if (fmtCount < 1)
+ caps.programBinary = false;
+ }
+
+ caps.texture3D = caps.ctxMajor >= 3; // 3.0
+
+ if (caps.gles)
+ caps.texture1D = false; // ES
+ else
+ caps.texture1D = glTexImage1D && (caps.ctxMajor >= 2); // 2.0
+
+ if (caps.gles)
+ caps.tessellation = caps.ctxMajor > 3 || (caps.ctxMajor == 3 && caps.ctxMinor >= 2); // ES 3.2
+ else
+ caps.tessellation = caps.ctxMajor >= 4; // 4.0
+
+ if (caps.gles)
+ caps.geometryShader = caps.ctxMajor > 3 || (caps.ctxMajor == 3 && caps.ctxMinor >= 2); // ES 3.2
+ else
+ caps.geometryShader = caps.ctxMajor > 3 || (caps.ctxMajor == 3 && caps.ctxMinor >= 2); // 3.2
+
+ if (caps.ctxMajor >= 3) { // 3.0 or ES 3.0
+ GLint maxArraySize = 0;
+ f->glGetIntegerv(GL_MAX_ARRAY_TEXTURE_LAYERS, &maxArraySize);
+ caps.maxTextureArraySize = maxArraySize;
+ } else {
+ caps.maxTextureArraySize = 0;
+ }
+
+ // The ES 2.0 spec only has MAX_xxxx_VECTORS. ES 3.0 and up has both
+ // *VECTORS and *COMPONENTS. OpenGL 2.0-4.0 only has MAX_xxxx_COMPONENTS.
+ // 4.1 and above has both. What a mess.
+ if (caps.gles) {
+ GLint maxVertexUniformVectors = 0;
+ f->glGetIntegerv(GL_MAX_VERTEX_UNIFORM_VECTORS, &maxVertexUniformVectors);
+ GLint maxFragmentUniformVectors = 0;
+ f->glGetIntegerv(GL_MAX_FRAGMENT_UNIFORM_VECTORS, &maxFragmentUniformVectors);
+ caps.maxUniformVectors = qMin(maxVertexUniformVectors, maxFragmentUniformVectors);
+ } else {
+ GLint maxVertexUniformComponents = 0;
+ f->glGetIntegerv(GL_MAX_VERTEX_UNIFORM_COMPONENTS, &maxVertexUniformComponents);
+ GLint maxFragmentUniformComponents = 0;
+ f->glGetIntegerv(GL_MAX_FRAGMENT_UNIFORM_COMPONENTS, &maxFragmentUniformComponents);
+ caps.maxUniformVectors = qMin(maxVertexUniformComponents, maxFragmentUniformComponents) / 4;
+ }
+
+ f->glGetIntegerv(GL_MAX_VERTEX_ATTRIBS, &caps.maxVertexInputs);
+
+ if (caps.gles) {
+ f->glGetIntegerv(GL_MAX_VARYING_VECTORS, &caps.maxVertexOutputs);
+ } else if (caps.ctxMajor >= 3) {
+ GLint components = 0;
+ f->glGetIntegerv(caps.coreProfile ? GL_MAX_VERTEX_OUTPUT_COMPONENTS : GL_MAX_VARYING_COMPONENTS, &components);
+ caps.maxVertexOutputs = components / 4;
+ } else {
+ // OpenGL before 3.0 only has this, and not the same as
+ // MAX_VARYING_COMPONENTS strictly speaking, but will do.
+ GLint components = 0;
+ f->glGetIntegerv(GL_MAX_VARYING_FLOATS, &components);
+ if (components > 0)
+ caps.maxVertexOutputs = components / 4;
+ }
+
if (!caps.gles) {
f->glEnable(GL_VERTEX_PROGRAM_POINT_SIZE);
- f->glEnable(GL_POINT_SPRITE);
+ if (!caps.coreProfile)
+ f->glEnable(GL_POINT_SPRITE);
} // else (with gles) these are always on
+ // Match D3D and others when it comes to seamless cubemap filtering.
+ // ES 3.0+ has this always enabled. (hopefully)
+ // ES 2.0 and GL < 3.2 will not have it.
+ if (!caps.gles && (caps.ctxMajor > 3 || (caps.ctxMajor == 3 && caps.ctxMinor >= 2)))
+ f->glEnable(GL_TEXTURE_CUBE_MAP_SEAMLESS);
+
+ caps.halfAttributes = f->hasOpenGLExtension(QOpenGLExtensions::HalfFloatVertex);
+
+ // We always require GL_OVR_multiview2 for symmetry with other backends.
+ caps.multiView = f->hasOpenGLExtension(QOpenGLExtensions::MultiView)
+ && f->hasOpenGLExtension(QOpenGLExtensions::MultiViewExtended);
+ if (caps.multiView) {
+ glFramebufferTextureMultiviewOVR =
+ reinterpret_cast<void(QOPENGLF_APIENTRYP)(GLenum, GLenum, GLuint, GLint, GLint, GLsizei)>(
+ ctx->getProcAddress(QByteArrayLiteral("glFramebufferTextureMultiviewOVR")));
+ }
+
+ // Only do timestamp queries on OpenGL 3.3+.
+ caps.timestamps = !caps.gles && (caps.ctxMajor > 3 || (caps.ctxMajor == 3 && caps.ctxMinor >= 3));
+ if (caps.timestamps) {
+ glQueryCounter = reinterpret_cast<void(QOPENGLF_APIENTRYP)(GLuint, GLenum)>(
+ ctx->getProcAddress(QByteArrayLiteral("glQueryCounter")));
+ glGetQueryObjectui64v = reinterpret_cast<void(QOPENGLF_APIENTRYP)(GLuint, GLenum, quint64 *)>(
+ ctx->getProcAddress(QByteArrayLiteral("glGetQueryObjectui64v")));
+ if (!glQueryCounter || !glGetQueryObjectui64v)
+ caps.timestamps = false;
+ }
+
+ // glObjectLabel is available on OpenGL ES 3.2+ and OpenGL 4.3+
+ if (caps.gles)
+ caps.objectLabel = caps.ctxMajor > 3 || (caps.ctxMajor == 3 && caps.ctxMinor >= 2);
+ else
+ caps.objectLabel = caps.ctxMajor > 4 || (caps.ctxMajor == 4 && caps.ctxMinor >= 3);
+ if (caps.objectLabel) {
+ glObjectLabel = reinterpret_cast<void(QOPENGLF_APIENTRYP)(GLenum, GLuint, GLsizei, const GLchar *)>(
+ ctx->getProcAddress(QByteArrayLiteral("glObjectLabel")));
+ }
+
+ if (caps.gles) {
+ // This is the third way to get multisample rendering with GLES. (1. is
+ // multisample render buffer -> resolve to texture; 2. is multisample
+ // texture with GLES 3.1; 3. is this, avoiding the explicit multisample
+ // buffer and should be more efficient with tiled architectures.
+ // Interesting also because 2. does not seem to work in practice on
+ // devices such as the Quest 3)
+ caps.glesMultisampleRenderToTexture = ctx->hasExtension("GL_EXT_multisampled_render_to_texture");
+ if (caps.glesMultisampleRenderToTexture) {
+ glFramebufferTexture2DMultisampleEXT = reinterpret_cast<void(QOPENGLF_APIENTRYP)(GLenum, GLenum, GLenum, GLuint, GLint, GLsizei)>(
+ ctx->getProcAddress(QByteArrayLiteral("glFramebufferTexture2DMultisampleEXT")));
+ }
+ caps.glesMultiviewMultisampleRenderToTexture = ctx->hasExtension("GL_OVR_multiview_multisampled_render_to_texture");
+ if (caps.glesMultiviewMultisampleRenderToTexture) {
+ glFramebufferTextureMultisampleMultiviewOVR = reinterpret_cast<void(QOPENGLF_APIENTRYP)(GLenum, GLenum, GLuint, GLint, GLsizei, GLint, GLsizei)>(
+ ctx->getProcAddress(QByteArrayLiteral("glFramebufferTextureMultisampleMultiviewOVR")));
+ }
+ } else {
+ caps.glesMultisampleRenderToTexture = false;
+ caps.glesMultiviewMultisampleRenderToTexture = false;
+ }
+
+ caps.unpackRowLength = !caps.gles || caps.ctxMajor >= 3;
+
nativeHandlesStruct.context = ctx;
contextLost = false;
@@ -525,6 +1113,11 @@ void QRhiGles2::destroy()
ensureContext();
executeDeferredReleases();
+ if (ofr.tsQueries[0]) {
+ f->glDeleteQueries(2, ofr.tsQueries);
+ ofr.tsQueries[0] = ofr.tsQueries[1] = 0;
+ }
+
if (vao) {
f->glDeleteVertexArrays(1, &vao);
vao = 0;
@@ -544,7 +1137,7 @@ void QRhiGles2::destroy()
void QRhiGles2::executeDeferredReleases()
{
- for (int i = releaseQueue.count() - 1; i >= 0; --i) {
+ for (int i = releaseQueue.size() - 1; i >= 0; --i) {
const QRhiGles2::DeferredReleaseEntry &e(releaseQueue[i]);
switch (e.type) {
case QRhiGles2::DeferredReleaseEntry::Buffer:
@@ -562,6 +1155,7 @@ void QRhiGles2::executeDeferredReleases()
break;
case QRhiGles2::DeferredReleaseEntry::TextureRenderTarget:
f->glDeleteFramebuffers(1, &e.textureRenderTarget.framebuffer);
+ f->glDeleteTextures(1, &e.textureRenderTarget.nonMsaaThrowawayDepthTexture);
break;
default:
Q_UNREACHABLE();
@@ -571,7 +1165,7 @@ void QRhiGles2::executeDeferredReleases()
}
}
-QVector<int> QRhiGles2::supportedSampleCounts() const
+QList<int> QRhiGles2::supportedSampleCounts() const
{
if (supportedSampleCountList.isEmpty()) {
// 1, 2, 4, 8, ...
@@ -581,23 +1175,12 @@ QVector<int> QRhiGles2::supportedSampleCounts() const
return supportedSampleCountList;
}
-int QRhiGles2::effectiveSampleCount(int sampleCount) const
-{
- // Stay compatible with QSurfaceFormat and friends where samples == 0 means the same as 1.
- const int s = qBound(1, sampleCount, 64);
- if (!supportedSampleCounts().contains(s)) {
- qWarning("Attempted to set unsupported sample count %d", sampleCount);
- return 1;
- }
- return s;
-}
-
QRhiSwapChain *QRhiGles2::createSwapChain()
{
return new QGles2SwapChain(this);
}
-QRhiBuffer *QRhiGles2::createBuffer(QRhiBuffer::Type type, QRhiBuffer::UsageFlags usage, int size)
+QRhiBuffer *QRhiGles2::createBuffer(QRhiBuffer::Type type, QRhiBuffer::UsageFlags usage, quint32 size)
{
return new QGles2Buffer(this, type, usage, size);
}
@@ -629,55 +1212,114 @@ QMatrix4x4 QRhiGles2::clipSpaceCorrMatrix() const
return QMatrix4x4(); // identity
}
-static inline GLenum toGlCompressedTextureFormat(QRhiTexture::Format format, QRhiTexture::Flags flags)
+static inline void toGlTextureFormat(QRhiTexture::Format format, const QRhiGles2::Caps &caps,
+ GLenum *glintformat, GLenum *glsizedintformat,
+ GLenum *glformat, GLenum *gltype)
{
- const bool srgb = flags.testFlag(QRhiTexture::sRGB);
switch (format) {
- case QRhiTexture::BC1:
- return srgb ? 0x8C4C : 0x83F0;
- case QRhiTexture::BC3:
- return srgb ? 0x8C4E : 0x83F2;
- case QRhiTexture::BC5:
- return srgb ? 0x8C4F : 0x83F3;
-
- case QRhiTexture::ETC2_RGB8:
- return srgb ? 0x9275 : 0x9274;
- case QRhiTexture::ETC2_RGB8A1:
- return srgb ? 0x9277 : 0x9276;
- case QRhiTexture::ETC2_RGBA8:
- return srgb ? 0x9279 : 0x9278;
-
- case QRhiTexture::ASTC_4x4:
- return srgb ? 0x93D0 : 0x93B0;
- case QRhiTexture::ASTC_5x4:
- return srgb ? 0x93D1 : 0x93B1;
- case QRhiTexture::ASTC_5x5:
- return srgb ? 0x93D2 : 0x93B2;
- case QRhiTexture::ASTC_6x5:
- return srgb ? 0x93D3 : 0x93B3;
- case QRhiTexture::ASTC_6x6:
- return srgb ? 0x93D4 : 0x93B4;
- case QRhiTexture::ASTC_8x5:
- return srgb ? 0x93D5 : 0x93B5;
- case QRhiTexture::ASTC_8x6:
- return srgb ? 0x93D6 : 0x93B6;
- case QRhiTexture::ASTC_8x8:
- return srgb ? 0x93D7 : 0x93B7;
- case QRhiTexture::ASTC_10x5:
- return srgb ? 0x93D8 : 0x93B8;
- case QRhiTexture::ASTC_10x6:
- return srgb ? 0x93D9 : 0x93B9;
- case QRhiTexture::ASTC_10x8:
- return srgb ? 0x93DA : 0x93BA;
- case QRhiTexture::ASTC_10x10:
- return srgb ? 0x93DB : 0x93BB;
- case QRhiTexture::ASTC_12x10:
- return srgb ? 0x93DC : 0x93BC;
- case QRhiTexture::ASTC_12x12:
- return srgb ? 0x93DD : 0x93BD;
-
+ case QRhiTexture::RGBA8:
+ *glintformat = GL_RGBA;
+ *glsizedintformat = caps.rgba8Format ? GL_RGBA8 : GL_RGBA;
+ *glformat = GL_RGBA;
+ *gltype = GL_UNSIGNED_BYTE;
+ break;
+ case QRhiTexture::BGRA8:
+ *glintformat = caps.bgraInternalFormat ? GL_BGRA : GL_RGBA;
+ *glsizedintformat = caps.rgba8Format ? GL_RGBA8 : GL_RGBA;
+ *glformat = GL_BGRA;
+ *gltype = GL_UNSIGNED_BYTE;
+ break;
+ case QRhiTexture::R16:
+ *glintformat = GL_R16;
+ *glsizedintformat = *glintformat;
+ *glformat = GL_RED;
+ *gltype = GL_UNSIGNED_SHORT;
+ break;
+ case QRhiTexture::RG16:
+ *glintformat = GL_RG16;
+ *glsizedintformat = *glintformat;
+ *glformat = GL_RG;
+ *gltype = GL_UNSIGNED_SHORT;
+ break;
+ case QRhiTexture::R8:
+ *glintformat = GL_R8;
+ *glsizedintformat = *glintformat;
+ *glformat = GL_RED;
+ *gltype = GL_UNSIGNED_BYTE;
+ break;
+ case QRhiTexture::RG8:
+ *glintformat = GL_RG8;
+ *glsizedintformat = *glintformat;
+ *glformat = GL_RG;
+ *gltype = GL_UNSIGNED_BYTE;
+ break;
+ case QRhiTexture::RED_OR_ALPHA8:
+ *glintformat = caps.coreProfile ? GL_R8 : GL_ALPHA;
+ *glsizedintformat = *glintformat;
+ *glformat = caps.coreProfile ? GL_RED : GL_ALPHA;
+ *gltype = GL_UNSIGNED_BYTE;
+ break;
+ case QRhiTexture::RGBA16F:
+ *glintformat = GL_RGBA16F;
+ *glsizedintformat = *glintformat;
+ *glformat = GL_RGBA;
+ *gltype = GL_HALF_FLOAT;
+ break;
+ case QRhiTexture::RGBA32F:
+ *glintformat = GL_RGBA32F;
+ *glsizedintformat = *glintformat;
+ *glformat = GL_RGBA;
+ *gltype = GL_FLOAT;
+ break;
+ case QRhiTexture::R16F:
+ *glintformat = GL_R16F;
+ *glsizedintformat = *glintformat;
+ *glformat = GL_RED;
+ *gltype = GL_HALF_FLOAT;
+ break;
+ case QRhiTexture::R32F:
+ *glintformat = GL_R32F;
+ *glsizedintformat = *glintformat;
+ *glformat = GL_RED;
+ *gltype = GL_FLOAT;
+ break;
+ case QRhiTexture::RGB10A2:
+ *glintformat = GL_RGB10_A2;
+ *glsizedintformat = *glintformat;
+ *glformat = GL_RGBA;
+ *gltype = GL_UNSIGNED_INT_2_10_10_10_REV;
+ break;
+ case QRhiTexture::D16:
+ *glintformat = GL_DEPTH_COMPONENT16;
+ *glsizedintformat = *glintformat;
+ *glformat = GL_DEPTH_COMPONENT;
+ *gltype = GL_UNSIGNED_SHORT;
+ break;
+ case QRhiTexture::D24:
+ *glintformat = GL_DEPTH_COMPONENT24;
+ *glsizedintformat = *glintformat;
+ *glformat = GL_DEPTH_COMPONENT;
+ *gltype = GL_UNSIGNED_INT;
+ break;
+ case QRhiTexture::D24S8:
+ *glintformat = GL_DEPTH24_STENCIL8;
+ *glsizedintformat = *glintformat;
+ *glformat = GL_DEPTH_STENCIL;
+ *gltype = GL_UNSIGNED_INT_24_8;
+ break;
+ case QRhiTexture::D32F:
+ *glintformat = GL_DEPTH_COMPONENT32F;
+ *glsizedintformat = *glintformat;
+ *glformat = GL_DEPTH_COMPONENT;
+ *gltype = GL_FLOAT;
+ break;
default:
- return 0; // this is reachable, just return an invalid format
+ Q_UNREACHABLE();
+ *glintformat = GL_RGBA;
+ *glsizedintformat = caps.rgba8Format ? GL_RGBA8 : GL_RGBA;
+ *glformat = GL_RGBA;
+ *gltype = GL_UNSIGNED_BYTE;
+ break;
}
}
@@ -688,24 +1330,41 @@ bool QRhiGles2::isTextureFormatSupported(QRhiTexture::Format format, QRhiTexture
switch (format) {
case QRhiTexture::D16:
- Q_FALLTHROUGH();
case QRhiTexture::D32F:
return caps.depthTexture;
+ case QRhiTexture::D24:
+ return caps.depth24;
+
+ case QRhiTexture::D24S8:
+ return caps.depth24 && caps.packedDepthStencil;
+
case QRhiTexture::BGRA8:
return caps.bgraExternalFormat;
case QRhiTexture::R8:
return caps.r8Format;
+ case QRhiTexture::RG8:
+ return caps.r8Format;
+
case QRhiTexture::R16:
return caps.r16Format;
+ case QRhiTexture::RG16:
+ return caps.r16Format;
+
case QRhiTexture::RGBA16F:
- Q_FALLTHROUGH();
case QRhiTexture::RGBA32F:
return caps.floatFormats;
+ case QRhiTexture::R16F:
+ case QRhiTexture::R32F:
+ return caps.floatFormats;
+
+ case QRhiTexture::RGB10A2:
+ return caps.rgb10Formats;
+
default:
break;
}
@@ -717,13 +1376,13 @@ bool QRhiGles2::isFeatureSupported(QRhi::Feature feature) const
{
switch (feature) {
case QRhi::MultisampleTexture:
- return false;
+ return caps.multisampledTexture;
case QRhi::MultisampleRenderBuffer:
return caps.msaaRenderBuffer;
case QRhi::DebugMarkers:
return false;
case QRhi::Timestamps:
- return false;
+ return caps.timestamps;
case QRhi::Instancing:
return caps.instancing;
case QRhi::CustomInstanceStepRate:
@@ -743,7 +1402,7 @@ bool QRhiGles2::isFeatureSupported(QRhi::Feature feature) const
case QRhi::Compute:
return caps.compute;
case QRhi::WideLines:
- return true;
+ return !caps.coreProfile;
case QRhi::VertexShaderPointSize:
return true;
case QRhi::BaseVertex:
@@ -756,9 +1415,54 @@ bool QRhiGles2::isFeatureSupported(QRhi::Feature feature) const
return !caps.gles || caps.properMapBuffer;
case QRhi::ReadBackNonBaseMipLevel:
return caps.nonBaseLevelFramebufferTexture;
- default:
- Q_UNREACHABLE();
+ case QRhi::TexelFetch:
+ return caps.texelFetch;
+ case QRhi::RenderToNonBaseMipLevel:
+ return caps.nonBaseLevelFramebufferTexture;
+ case QRhi::IntAttributes:
+ return caps.intAttributes;
+ case QRhi::ScreenSpaceDerivatives:
+ return caps.screenSpaceDerivatives;
+ case QRhi::ReadBackAnyTextureFormat:
+ return false;
+ case QRhi::PipelineCacheDataLoadSave:
+ return caps.programBinary;
+ case QRhi::ImageDataStride:
+ return caps.unpackRowLength;
+ case QRhi::RenderBufferImport:
+ return true;
+ case QRhi::ThreeDimensionalTextures:
+ return caps.texture3D;
+ case QRhi::RenderTo3DTextureSlice:
+ return caps.texture3D;
+ case QRhi::TextureArrays:
+ return caps.maxTextureArraySize > 0;
+ case QRhi::Tessellation:
+ return caps.tessellation;
+ case QRhi::GeometryShader:
+ return caps.geometryShader;
+ case QRhi::TextureArrayRange:
return false;
+ case QRhi::NonFillPolygonMode:
+ return !caps.gles;
+ case QRhi::OneDimensionalTextures:
+ return caps.texture1D;
+ case QRhi::OneDimensionalTextureMipmaps:
+ return caps.texture1D;
+ case QRhi::HalfAttributes:
+ return caps.halfAttributes;
+ case QRhi::RenderToOneDimensionalTexture:
+ return caps.texture1D;
+ case QRhi::ThreeDimensionalTextureMipmaps:
+ return caps.texture3D;
+ case QRhi::MultiView:
+ return caps.multiView && caps.maxTextureArraySize > 0;
+ case QRhi::TextureViewFormat:
+ return false;
+ case QRhi::ResolveDepthStencil:
+ return true;
+ default:
+ Q_UNREACHABLE_RETURN(false);
}
}
@@ -772,10 +1476,31 @@ int QRhiGles2::resourceLimit(QRhi::ResourceLimit limit) const
case QRhi::MaxColorAttachments:
return caps.maxDrawBuffers;
case QRhi::FramesInFlight:
- return 2; // dummy
+ // From our perspective. What the GL impl does internally is another
+ // question, but that's out of our hands and does not concern us here.
+ return 1;
+ case QRhi::MaxAsyncReadbackFrames:
+ return 1;
+ case QRhi::MaxThreadGroupsPerDimension:
+ return caps.maxThreadGroupsPerDimension;
+ case QRhi::MaxThreadsPerThreadGroup:
+ return caps.maxThreadsPerThreadGroup;
+ case QRhi::MaxThreadGroupX:
+ return caps.maxThreadGroupsX;
+ case QRhi::MaxThreadGroupY:
+ return caps.maxThreadGroupsY;
+ case QRhi::MaxThreadGroupZ:
+ return caps.maxThreadGroupsZ;
+ case QRhi::TextureArraySizeMax:
+ return 2048;
+ case QRhi::MaxUniformBufferRange:
+ return int(qMin<qint64>(INT_MAX, caps.maxUniformVectors * qint64(16)));
+ case QRhi::MaxVertexInputs:
+ return caps.maxVertexInputs;
+ case QRhi::MaxVertexOutputs:
+ return caps.maxVertexOutputs;
default:
- Q_UNREACHABLE();
- return 0;
+ Q_UNREACHABLE_RETURN(0);
}
}
@@ -784,9 +1509,16 @@ const QRhiNativeHandles *QRhiGles2::nativeHandles()
return &nativeHandlesStruct;
}
-void QRhiGles2::sendVMemStatsToProfiler()
+QRhiDriverInfo QRhiGles2::driverInfo() const
{
- // nothing to do here
+ return driverInfoStruct;
+}
+
+QRhiStats QRhiGles2::statistics()
+{
+ QRhiStats result;
+ result.totalPipelineCreationTime = totalPipelineCreationTime();
+ return result;
}
bool QRhiGles2::makeThreadLocalNativeContextCurrent()
@@ -806,6 +1538,8 @@ void QRhiGles2::releaseCachedResources()
f->glDeleteShader(shader);
m_shaderCache.clear();
+
+ m_pipelineCache.clear();
}
bool QRhiGles2::isDeviceLost() const
@@ -813,23 +1547,156 @@ bool QRhiGles2::isDeviceLost() const
return contextLost;
}
+struct QGles2PipelineCacheDataHeader
+{
+ quint32 rhiId;
+ quint32 arch;
+ quint32 programBinaryCount;
+ quint32 dataSize;
+ char driver[240];
+};
+
+QByteArray QRhiGles2::pipelineCacheData()
+{
+ Q_STATIC_ASSERT(sizeof(QGles2PipelineCacheDataHeader) == 256);
+
+ if (m_pipelineCache.isEmpty())
+ return QByteArray();
+
+ QGles2PipelineCacheDataHeader header;
+ memset(&header, 0, sizeof(header));
+ header.rhiId = pipelineCacheRhiId();
+ header.arch = quint32(sizeof(void*));
+ header.programBinaryCount = m_pipelineCache.size();
+ const size_t driverStrLen = qMin(sizeof(header.driver) - 1, size_t(driverInfoStruct.deviceName.size()));
+ if (driverStrLen)
+ memcpy(header.driver, driverInfoStruct.deviceName.constData(), driverStrLen);
+ header.driver[driverStrLen] = '\0';
+
+ const size_t dataOffset = sizeof(header);
+ size_t dataSize = 0;
+ for (auto it = m_pipelineCache.cbegin(), end = m_pipelineCache.cend(); it != end; ++it) {
+ dataSize += sizeof(quint32) + it.key().size()
+ + sizeof(quint32) + it->data.size()
+ + sizeof(quint32);
+ }
+
+ QByteArray buf(dataOffset + dataSize, Qt::Uninitialized);
+ char *p = buf.data() + dataOffset;
+ for (auto it = m_pipelineCache.cbegin(), end = m_pipelineCache.cend(); it != end; ++it) {
+ const QByteArray key = it.key();
+ const QByteArray data = it->data;
+ const quint32 format = it->format;
+
+ quint32 i = key.size();
+ memcpy(p, &i, 4);
+ p += 4;
+ memcpy(p, key.constData(), key.size());
+ p += key.size();
+
+ i = data.size();
+ memcpy(p, &i, 4);
+ p += 4;
+ memcpy(p, data.constData(), data.size());
+ p += data.size();
+
+ memcpy(p, &format, 4);
+ p += 4;
+ }
+ Q_ASSERT(p == buf.data() + dataOffset + dataSize);
+
+ header.dataSize = quint32(dataSize);
+ memcpy(buf.data(), &header, sizeof(header));
+
+ return buf;
+}
+
+void QRhiGles2::setPipelineCacheData(const QByteArray &data)
+{
+ if (data.isEmpty())
+ return;
+
+ const size_t headerSize = sizeof(QGles2PipelineCacheDataHeader);
+ if (data.size() < qsizetype(headerSize)) {
+ qCDebug(QRHI_LOG_INFO, "setPipelineCacheData: Invalid blob size (header incomplete)");
+ return;
+ }
+ const size_t dataOffset = headerSize;
+ QGles2PipelineCacheDataHeader header;
+ memcpy(&header, data.constData(), headerSize);
+
+ const quint32 rhiId = pipelineCacheRhiId();
+ if (header.rhiId != rhiId) {
+ qCDebug(QRHI_LOG_INFO, "setPipelineCacheData: The data is for a different QRhi version or backend (%u, %u)",
+ rhiId, header.rhiId);
+ return;
+ }
+ const quint32 arch = quint32(sizeof(void*));
+ if (header.arch != arch) {
+ qCDebug(QRHI_LOG_INFO, "setPipelineCacheData: Architecture does not match (%u, %u)",
+ arch, header.arch);
+ return;
+ }
+ if (header.programBinaryCount == 0)
+ return;
+
+ const size_t driverStrLen = qMin(sizeof(header.driver) - 1, size_t(driverInfoStruct.deviceName.size()));
+ if (strncmp(header.driver, driverInfoStruct.deviceName.constData(), driverStrLen)) {
+ qCDebug(QRHI_LOG_INFO, "setPipelineCacheData: OpenGL vendor/renderer/version does not match");
+ return;
+ }
+
+ if (data.size() < qsizetype(dataOffset + header.dataSize)) {
+ qCDebug(QRHI_LOG_INFO, "setPipelineCacheData: Invalid blob size (data incomplete)");
+ return;
+ }
+
+ m_pipelineCache.clear();
+
+ const char *p = data.constData() + dataOffset;
+ for (quint32 i = 0; i < header.programBinaryCount; ++i) {
+ quint32 len = 0;
+ memcpy(&len, p, 4);
+ p += 4;
+ QByteArray key(len, Qt::Uninitialized);
+ memcpy(key.data(), p, len);
+ p += len;
+
+ memcpy(&len, p, 4);
+ p += 4;
+ QByteArray data(len, Qt::Uninitialized);
+ memcpy(data.data(), p, len);
+ p += len;
+
+ quint32 format;
+ memcpy(&format, p, 4);
+ p += 4;
+
+ m_pipelineCache.insert(key, { format, data });
+ }
+
+ qCDebug(QRHI_LOG_INFO, "Seeded pipeline cache with %d program binaries", int(m_pipelineCache.size()));
+}
+
QRhiRenderBuffer *QRhiGles2::createRenderBuffer(QRhiRenderBuffer::Type type, const QSize &pixelSize,
- int sampleCount, QRhiRenderBuffer::Flags flags)
+ int sampleCount, QRhiRenderBuffer::Flags flags,
+ QRhiTexture::Format backingFormatHint)
{
- return new QGles2RenderBuffer(this, type, pixelSize, sampleCount, flags);
+ return new QGles2RenderBuffer(this, type, pixelSize, sampleCount, flags, backingFormatHint);
}
-QRhiTexture *QRhiGles2::createTexture(QRhiTexture::Format format, const QSize &pixelSize,
+QRhiTexture *QRhiGles2::createTexture(QRhiTexture::Format format,
+ const QSize &pixelSize, int depth, int arraySize,
int sampleCount, QRhiTexture::Flags flags)
{
- return new QGles2Texture(this, format, pixelSize, sampleCount, flags);
+ return new QGles2Texture(this, format, pixelSize, depth, arraySize, sampleCount, flags);
}
QRhiSampler *QRhiGles2::createSampler(QRhiSampler::Filter magFilter, QRhiSampler::Filter minFilter,
QRhiSampler::Filter mipmapMode,
- QRhiSampler::AddressMode u, QRhiSampler::AddressMode v)
+ QRhiSampler::AddressMode u, QRhiSampler::AddressMode v, QRhiSampler::AddressMode w)
{
- return new QGles2Sampler(this, magFilter, minFilter, mipmapMode, u, v);
+ return new QGles2Sampler(this, magFilter, minFilter, mipmapMode, u, v, w);
}
QRhiTextureRenderTarget *QRhiGles2::createTextureRenderTarget(const QRhiTextureRenderTargetDescription &desc,
@@ -865,10 +1732,9 @@ void QRhiGles2::setGraphicsPipeline(QRhiCommandBuffer *cb, QRhiGraphicsPipeline
cbD->currentComputePipeline = nullptr;
cbD->currentPipelineGeneration = psD->generation;
- QGles2CommandBuffer::Command cmd;
+ QGles2CommandBuffer::Command &cmd(cbD->commands.get());
cmd.cmd = QGles2CommandBuffer::Command::BindGraphicsPipeline;
cmd.args.bindGraphicsPipeline.ps = ps;
- cbD->commands.append(cmd);
}
}
@@ -888,68 +1754,86 @@ void QRhiGles2::setShaderResources(QRhiCommandBuffer *cb, QRhiShaderResourceBind
srb = compPsD->m_shaderResourceBindings;
}
- QRhiPassResourceTracker &passResTracker(cbD->passResTrackers[cbD->currentPassResTrackerIndex]);
QGles2ShaderResourceBindings *srbD = QRHI_RES(QGles2ShaderResourceBindings, srb);
- bool hasDynamicOffsetInSrb = false;
- for (int i = 0, ie = srbD->m_bindings.count(); i != ie; ++i) {
- const QRhiShaderResourceBinding::Data *b = srbD->m_bindings.at(i).data();
- switch (b->type) {
- case QRhiShaderResourceBinding::UniformBuffer:
- // no BufUniformRead / AccessUniform because no real uniform buffers are used
- if (b->u.ubuf.hasDynamicOffset)
- hasDynamicOffsetInSrb = true;
- break;
- case QRhiShaderResourceBinding::SampledTexture:
- trackedRegisterTexture(&passResTracker,
- QRHI_RES(QGles2Texture, b->u.stex.tex),
- QRhiPassResourceTracker::TexSample,
- QRhiPassResourceTracker::toPassTrackerTextureStage(b->stage));
- break;
- case QRhiShaderResourceBinding::ImageLoad:
- Q_FALLTHROUGH();
- case QRhiShaderResourceBinding::ImageStore:
- Q_FALLTHROUGH();
- case QRhiShaderResourceBinding::ImageLoadStore:
- {
- QGles2Texture *texD = QRHI_RES(QGles2Texture, b->u.simage.tex);
- QRhiPassResourceTracker::TextureAccess access;
- if (b->type == QRhiShaderResourceBinding::ImageLoad)
- access = QRhiPassResourceTracker::TexStorageLoad;
- else if (b->type == QRhiShaderResourceBinding::ImageStore)
- access = QRhiPassResourceTracker::TexStorageStore;
- else
- access = QRhiPassResourceTracker::TexStorageLoadStore;
- trackedRegisterTexture(&passResTracker, texD, access,
- QRhiPassResourceTracker::toPassTrackerTextureStage(b->stage));
- }
- break;
- case QRhiShaderResourceBinding::BufferLoad:
- Q_FALLTHROUGH();
- case QRhiShaderResourceBinding::BufferStore:
- Q_FALLTHROUGH();
- case QRhiShaderResourceBinding::BufferLoadStore:
- {
- QGles2Buffer *bufD = QRHI_RES(QGles2Buffer, b->u.sbuf.buf);
- QRhiPassResourceTracker::BufferAccess access;
- if (b->type == QRhiShaderResourceBinding::BufferLoad)
- access = QRhiPassResourceTracker::BufStorageLoad;
- else if (b->type == QRhiShaderResourceBinding::BufferStore)
- access = QRhiPassResourceTracker::BufStorageStore;
- else
- access = QRhiPassResourceTracker::BufStorageLoadStore;
- trackedRegisterBuffer(&passResTracker, bufD, access,
- QRhiPassResourceTracker::toPassTrackerBufferStage(b->stage));
- }
- break;
- default:
- break;
+ if (cbD->passNeedsResourceTracking) {
+ QRhiPassResourceTracker &passResTracker(cbD->passResTrackers[cbD->currentPassResTrackerIndex]);
+ for (int i = 0, ie = srbD->m_bindings.size(); i != ie; ++i) {
+ const QRhiShaderResourceBinding::Data *b = shaderResourceBindingData(srbD->m_bindings.at(i));
+ switch (b->type) {
+ case QRhiShaderResourceBinding::UniformBuffer:
+ // no BufUniformRead / AccessUniform because no real uniform buffers are used
+ break;
+ case QRhiShaderResourceBinding::SampledTexture:
+ case QRhiShaderResourceBinding::Texture:
+ for (int elem = 0; elem < b->u.stex.count; ++elem) {
+ trackedRegisterTexture(&passResTracker,
+ QRHI_RES(QGles2Texture, b->u.stex.texSamplers[elem].tex),
+ QRhiPassResourceTracker::TexSample,
+ QRhiPassResourceTracker::toPassTrackerTextureStage(b->stage));
+ }
+ break;
+ case QRhiShaderResourceBinding::ImageLoad:
+ case QRhiShaderResourceBinding::ImageStore:
+ case QRhiShaderResourceBinding::ImageLoadStore:
+ {
+ QGles2Texture *texD = QRHI_RES(QGles2Texture, b->u.simage.tex);
+ QRhiPassResourceTracker::TextureAccess access;
+ if (b->type == QRhiShaderResourceBinding::ImageLoad)
+ access = QRhiPassResourceTracker::TexStorageLoad;
+ else if (b->type == QRhiShaderResourceBinding::ImageStore)
+ access = QRhiPassResourceTracker::TexStorageStore;
+ else
+ access = QRhiPassResourceTracker::TexStorageLoadStore;
+ trackedRegisterTexture(&passResTracker, texD, access,
+ QRhiPassResourceTracker::toPassTrackerTextureStage(b->stage));
+ }
+ break;
+ case QRhiShaderResourceBinding::BufferLoad:
+ case QRhiShaderResourceBinding::BufferStore:
+ case QRhiShaderResourceBinding::BufferLoadStore:
+ {
+ QGles2Buffer *bufD = QRHI_RES(QGles2Buffer, b->u.sbuf.buf);
+ QRhiPassResourceTracker::BufferAccess access;
+ if (b->type == QRhiShaderResourceBinding::BufferLoad)
+ access = QRhiPassResourceTracker::BufStorageLoad;
+ else if (b->type == QRhiShaderResourceBinding::BufferStore)
+ access = QRhiPassResourceTracker::BufStorageStore;
+ else
+ access = QRhiPassResourceTracker::BufStorageLoadStore;
+ trackedRegisterBuffer(&passResTracker, bufD, access,
+ QRhiPassResourceTracker::toPassTrackerBufferStage(b->stage));
+ }
+ break;
+ default:
+ break;
+ }
}
}
- const bool srbChanged = gfxPsD ? (cbD->currentGraphicsSrb != srb) : (cbD->currentComputeSrb != srb);
- const bool srbRebuilt = cbD->currentSrbGeneration != srbD->generation;
+ bool srbChanged = gfxPsD ? (cbD->currentGraphicsSrb != srb) : (cbD->currentComputeSrb != srb);
+
+ // The Command::BindShaderResources command generated below is what will
+ // cause uniforms to be set (glUniformNxx). This needs some special
+ // handling here in this backend without real uniform buffers, because,
+ // like in other backends, we optimize out the setShaderResources when the
+ // srb that was set before is attempted to be set again on the command
+ // buffer, but that is incorrect if the same srb is now used with another
+ // pipeline. (because that could mean a glUseProgram not followed by
+ // up-to-date glUniform calls, i.e. with GL we have a strong dependency
+ // between the pipeline (== program) and the srb, unlike other APIs) This
+ // is the reason there is a second level of srb(+generation) tracking in
+ // the pipeline objects.
+ if (gfxPsD && (gfxPsD->currentSrb != srb || gfxPsD->currentSrbGeneration != srbD->generation)) {
+ srbChanged = true;
+ gfxPsD->currentSrb = srb;
+ gfxPsD->currentSrbGeneration = srbD->generation;
+ } else if (compPsD && (compPsD->currentSrb != srb || compPsD->currentSrbGeneration != srbD->generation)) {
+ srbChanged = true;
+ compPsD->currentSrb = srb;
+ compPsD->currentSrbGeneration = srbD->generation;
+ }
- if (srbChanged || srbRebuilt || hasDynamicOffsetInSrb) {
+ if (srbChanged || cbD->currentSrbGeneration != srbD->generation || srbD->hasDynamicOffset) {
if (gfxPsD) {
cbD->currentGraphicsSrb = srb;
cbD->currentComputeSrb = nullptr;
@@ -959,14 +1843,14 @@ void QRhiGles2::setShaderResources(QRhiCommandBuffer *cb, QRhiShaderResourceBind
}
cbD->currentSrbGeneration = srbD->generation;
- QGles2CommandBuffer::Command cmd;
+ QGles2CommandBuffer::Command &cmd(cbD->commands.get());
cmd.cmd = QGles2CommandBuffer::Command::BindShaderResources;
cmd.args.bindShaderResources.maybeGraphicsPs = gfxPsD;
cmd.args.bindShaderResources.maybeComputePs = compPsD;
cmd.args.bindShaderResources.srb = srb;
cmd.args.bindShaderResources.dynamicOffsetCount = 0;
- if (hasDynamicOffsetInSrb) {
- if (dynamicOffsetCount < QGles2CommandBuffer::Command::MAX_UBUF_BINDINGS) {
+ if (srbD->hasDynamicOffset) {
+ if (dynamicOffsetCount < QGles2CommandBuffer::MAX_DYNAMIC_OFFSET_COUNT) {
cmd.args.bindShaderResources.dynamicOffsetCount = dynamicOffsetCount;
uint *p = cmd.args.bindShaderResources.dynamicOffsetPairs;
for (int i = 0; i < dynamicOffsetCount; ++i) {
@@ -976,10 +1860,9 @@ void QRhiGles2::setShaderResources(QRhiCommandBuffer *cb, QRhiShaderResourceBind
}
} else {
qWarning("Too many dynamic offsets (%d, max is %d)",
- dynamicOffsetCount, QGles2CommandBuffer::Command::MAX_UBUF_BINDINGS);
+ dynamicOffsetCount, QGles2CommandBuffer::MAX_DYNAMIC_OFFSET_COUNT);
}
}
- cbD->commands.append(cmd);
}
}
@@ -997,31 +1880,33 @@ void QRhiGles2::setVertexInput(QRhiCommandBuffer *cb,
QGles2Buffer *bufD = QRHI_RES(QGles2Buffer, buf);
Q_ASSERT(bufD->m_usage.testFlag(QRhiBuffer::VertexBuffer));
- QGles2CommandBuffer::Command cmd;
+ QGles2CommandBuffer::Command &cmd(cbD->commands.get());
cmd.cmd = QGles2CommandBuffer::Command::BindVertexBuffer;
cmd.args.bindVertexBuffer.ps = cbD->currentGraphicsPipeline;
cmd.args.bindVertexBuffer.buffer = bufD->buffer;
cmd.args.bindVertexBuffer.offset = ofs;
cmd.args.bindVertexBuffer.binding = startBinding + i;
- cbD->commands.append(cmd);
- trackedRegisterBuffer(&passResTracker, bufD, QRhiPassResourceTracker::BufVertexInput,
- QRhiPassResourceTracker::BufVertexInputStage);
+ if (cbD->passNeedsResourceTracking) {
+ trackedRegisterBuffer(&passResTracker, bufD, QRhiPassResourceTracker::BufVertexInput,
+ QRhiPassResourceTracker::BufVertexInputStage);
+ }
}
if (indexBuf) {
QGles2Buffer *ibufD = QRHI_RES(QGles2Buffer, indexBuf);
Q_ASSERT(ibufD->m_usage.testFlag(QRhiBuffer::IndexBuffer));
- QGles2CommandBuffer::Command cmd;
+ QGles2CommandBuffer::Command &cmd(cbD->commands.get());
cmd.cmd = QGles2CommandBuffer::Command::BindIndexBuffer;
cmd.args.bindIndexBuffer.buffer = ibufD->buffer;
cmd.args.bindIndexBuffer.offset = indexOffset;
cmd.args.bindIndexBuffer.type = indexFormat == QRhiCommandBuffer::IndexUInt16 ? GL_UNSIGNED_SHORT : GL_UNSIGNED_INT;
- cbD->commands.append(cmd);
- trackedRegisterBuffer(&passResTracker, ibufD, QRhiPassResourceTracker::BufIndexRead,
- QRhiPassResourceTracker::BufVertexInputStage);
+ if (cbD->passNeedsResourceTracking) {
+ trackedRegisterBuffer(&passResTracker, ibufD, QRhiPassResourceTracker::BufIndexRead,
+ QRhiPassResourceTracker::BufVertexInputStage);
+ }
}
}
@@ -1030,20 +1915,19 @@ void QRhiGles2::setViewport(QRhiCommandBuffer *cb, const QRhiViewport &viewport)
QGles2CommandBuffer *cbD = QRHI_RES(QGles2CommandBuffer, cb);
Q_ASSERT(cbD->recordingPass == QGles2CommandBuffer::RenderPass);
- QGles2CommandBuffer::Command cmd;
- cmd.cmd = QGles2CommandBuffer::Command::Viewport;
const std::array<float, 4> r = viewport.viewport();
// A negative width or height is an error. A negative x or y is not.
if (r[2] < 0.0f || r[3] < 0.0f)
return;
+ QGles2CommandBuffer::Command &cmd(cbD->commands.get());
+ cmd.cmd = QGles2CommandBuffer::Command::Viewport;
cmd.args.viewport.x = r[0];
cmd.args.viewport.y = r[1];
cmd.args.viewport.w = r[2];
cmd.args.viewport.h = r[3];
cmd.args.viewport.d0 = viewport.minDepth();
cmd.args.viewport.d1 = viewport.maxDepth();
- cbD->commands.append(cmd);
}
void QRhiGles2::setScissor(QRhiCommandBuffer *cb, const QRhiScissor &scissor)
@@ -1051,18 +1935,17 @@ void QRhiGles2::setScissor(QRhiCommandBuffer *cb, const QRhiScissor &scissor)
QGles2CommandBuffer *cbD = QRHI_RES(QGles2CommandBuffer, cb);
Q_ASSERT(cbD->recordingPass == QGles2CommandBuffer::RenderPass);
- QGles2CommandBuffer::Command cmd;
- cmd.cmd = QGles2CommandBuffer::Command::Scissor;
const std::array<int, 4> r = scissor.scissor();
// A negative width or height is an error. A negative x or y is not.
if (r[2] < 0 || r[3] < 0)
return;
+ QGles2CommandBuffer::Command &cmd(cbD->commands.get());
+ cmd.cmd = QGles2CommandBuffer::Command::Scissor;
cmd.args.scissor.x = r[0];
cmd.args.scissor.y = r[1];
cmd.args.scissor.w = r[2];
cmd.args.scissor.h = r[3];
- cbD->commands.append(cmd);
}
void QRhiGles2::setBlendConstants(QRhiCommandBuffer *cb, const QColor &c)
@@ -1070,13 +1953,12 @@ void QRhiGles2::setBlendConstants(QRhiCommandBuffer *cb, const QColor &c)
QGles2CommandBuffer *cbD = QRHI_RES(QGles2CommandBuffer, cb);
Q_ASSERT(cbD->recordingPass == QGles2CommandBuffer::RenderPass);
- QGles2CommandBuffer::Command cmd;
+ QGles2CommandBuffer::Command &cmd(cbD->commands.get());
cmd.cmd = QGles2CommandBuffer::Command::BlendConstants;
cmd.args.blendConstants.r = float(c.redF());
cmd.args.blendConstants.g = float(c.greenF());
cmd.args.blendConstants.b = float(c.blueF());
cmd.args.blendConstants.a = float(c.alphaF());
- cbD->commands.append(cmd);
}
void QRhiGles2::setStencilRef(QRhiCommandBuffer *cb, quint32 refValue)
@@ -1084,11 +1966,10 @@ void QRhiGles2::setStencilRef(QRhiCommandBuffer *cb, quint32 refValue)
QGles2CommandBuffer *cbD = QRHI_RES(QGles2CommandBuffer, cb);
Q_ASSERT(cbD->recordingPass == QGles2CommandBuffer::RenderPass);
- QGles2CommandBuffer::Command cmd;
+ QGles2CommandBuffer::Command &cmd(cbD->commands.get());
cmd.cmd = QGles2CommandBuffer::Command::StencilRef;
cmd.args.stencilRef.ref = refValue;
cmd.args.stencilRef.ps = cbD->currentGraphicsPipeline;
- cbD->commands.append(cmd);
}
void QRhiGles2::draw(QRhiCommandBuffer *cb, quint32 vertexCount,
@@ -1097,14 +1978,13 @@ void QRhiGles2::draw(QRhiCommandBuffer *cb, quint32 vertexCount,
QGles2CommandBuffer *cbD = QRHI_RES(QGles2CommandBuffer, cb);
Q_ASSERT(cbD->recordingPass == QGles2CommandBuffer::RenderPass);
- QGles2CommandBuffer::Command cmd;
+ QGles2CommandBuffer::Command &cmd(cbD->commands.get());
cmd.cmd = QGles2CommandBuffer::Command::Draw;
cmd.args.draw.ps = cbD->currentGraphicsPipeline;
cmd.args.draw.vertexCount = vertexCount;
cmd.args.draw.firstVertex = firstVertex;
cmd.args.draw.instanceCount = instanceCount;
cmd.args.draw.baseInstance = firstInstance;
- cbD->commands.append(cmd);
}
void QRhiGles2::drawIndexed(QRhiCommandBuffer *cb, quint32 indexCount,
@@ -1113,7 +1993,7 @@ void QRhiGles2::drawIndexed(QRhiCommandBuffer *cb, quint32 indexCount,
QGles2CommandBuffer *cbD = QRHI_RES(QGles2CommandBuffer, cb);
Q_ASSERT(cbD->recordingPass == QGles2CommandBuffer::RenderPass);
- QGles2CommandBuffer::Command cmd;
+ QGles2CommandBuffer::Command &cmd(cbD->commands.get());
cmd.cmd = QGles2CommandBuffer::Command::DrawIndexed;
cmd.args.drawIndexed.ps = cbD->currentGraphicsPipeline;
cmd.args.drawIndexed.indexCount = indexCount;
@@ -1121,7 +2001,6 @@ void QRhiGles2::drawIndexed(QRhiCommandBuffer *cb, quint32 indexCount,
cmd.args.drawIndexed.instanceCount = instanceCount;
cmd.args.drawIndexed.baseInstance = firstInstance;
cmd.args.drawIndexed.baseVertex = vertexOffset;
- cbD->commands.append(cmd);
}
void QRhiGles2::debugMarkBegin(QRhiCommandBuffer *cb, const QByteArray &name)
@@ -1156,11 +2035,14 @@ const QRhiNativeHandles *QRhiGles2::nativeHandles(QRhiCommandBuffer *cb)
return nullptr;
}
-static void addBoundaryCommand(QGles2CommandBuffer *cbD, QGles2CommandBuffer::Command::Cmd type)
+static inline void addBoundaryCommand(QGles2CommandBuffer *cbD, QGles2CommandBuffer::Command::Cmd type, GLuint tsQuery = 0)
{
- QGles2CommandBuffer::Command cmd;
+ QGles2CommandBuffer::Command &cmd(cbD->commands.get());
cmd.cmd = type;
- cbD->commands.append(cmd);
+ if (type == QGles2CommandBuffer::Command::BeginFrame)
+ cmd.args.beginFrame.timestampQuery = tsQuery;
+ else if (type == QGles2CommandBuffer::Command::EndFrame)
+ cmd.args.endFrame.timestampQuery = tsQuery;
}
void QRhiGles2::beginExternal(QRhiCommandBuffer *cb)
@@ -1176,11 +2058,27 @@ void QRhiGles2::beginExternal(QRhiCommandBuffer *cb)
}
QGles2CommandBuffer *cbD = QRHI_RES(QGles2CommandBuffer, cb);
+
+ if (cbD->recordingPass == QGles2CommandBuffer::ComputePass
+ && !cbD->computePassState.writtenResources.isEmpty())
+ {
+ QGles2CommandBuffer::Command &cmd(cbD->commands.get());
+ cmd.cmd = QGles2CommandBuffer::Command::Barrier;
+ cmd.args.barrier.barriers = GL_ALL_BARRIER_BITS;
+ }
+
executeCommandBuffer(cbD);
+
cbD->resetCommands();
- if (vao)
+ if (vao) {
f->glBindVertexArray(0);
+ } else {
+ f->glBindBuffer(GL_ARRAY_BUFFER, 0);
+ f->glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, 0);
+ if (caps.compute)
+ f->glBindBuffer(GL_SHADER_STORAGE_BUFFER, 0);
+ }
}
void QRhiGles2::endExternal(QRhiCommandBuffer *cb)
@@ -1204,23 +2102,36 @@ void QRhiGles2::endExternal(QRhiCommandBuffer *cb)
enqueueBindFramebuffer(cbD->currentTarget, cbD);
}
-QRhi::FrameOpResult QRhiGles2::beginFrame(QRhiSwapChain *swapChain, QRhi::BeginFrameFlags flags)
+double QRhiGles2::lastCompletedGpuTime(QRhiCommandBuffer *cb)
{
- Q_UNUSED(flags);
+ QGles2CommandBuffer *cbD = QRHI_RES(QGles2CommandBuffer, cb);
+ return cbD->lastGpuTime;
+}
+QRhi::FrameOpResult QRhiGles2::beginFrame(QRhiSwapChain *swapChain, QRhi::BeginFrameFlags)
+{
QGles2SwapChain *swapChainD = QRHI_RES(QGles2SwapChain, swapChain);
if (!ensureContext(swapChainD->surface))
return contextLost ? QRhi::FrameOpDeviceLost : QRhi::FrameOpError;
- currentSwapChain = swapChainD;
+ ctx->handle()->beginFrame();
- QRhiProfilerPrivate *rhiP = profilerPrivateOrNull();
- QRHI_PROF_F(beginSwapChainFrame(swapChain));
+ currentSwapChain = swapChainD;
executeDeferredReleases();
swapChainD->cb.resetState();
- addBoundaryCommand(&swapChainD->cb, QGles2CommandBuffer::Command::BeginFrame);
+ if (swapChainD->timestamps.active[swapChainD->currentTimestampPairIndex]) {
+ double elapsedSec = 0;
+ if (swapChainD->timestamps.tryQueryTimestamps(swapChainD->currentTimestampPairIndex, this, &elapsedSec))
+ swapChainD->cb.lastGpuTime = elapsedSec;
+ }
+
+ GLuint tsStart = swapChainD->timestamps.query[swapChainD->currentTimestampPairIndex * 2];
+ GLuint tsEnd = swapChainD->timestamps.query[swapChainD->currentTimestampPairIndex * 2 + 1];
+ const bool recordTimestamps = tsStart && tsEnd && !swapChainD->timestamps.active[swapChainD->currentTimestampPairIndex];
+
+ addBoundaryCommand(&swapChainD->cb, QGles2CommandBuffer::Command::BeginFrame, recordTimestamps ? tsStart : 0);
return QRhi::FrameOpSuccess;
}
@@ -1230,32 +2141,38 @@ QRhi::FrameOpResult QRhiGles2::endFrame(QRhiSwapChain *swapChain, QRhi::EndFrame
QGles2SwapChain *swapChainD = QRHI_RES(QGles2SwapChain, swapChain);
Q_ASSERT(currentSwapChain == swapChainD);
- addBoundaryCommand(&swapChainD->cb, QGles2CommandBuffer::Command::EndFrame);
+ GLuint tsStart = swapChainD->timestamps.query[swapChainD->currentTimestampPairIndex * 2];
+ GLuint tsEnd = swapChainD->timestamps.query[swapChainD->currentTimestampPairIndex * 2 + 1];
+ const bool recordTimestamps = tsStart && tsEnd && !swapChainD->timestamps.active[swapChainD->currentTimestampPairIndex];
+ if (recordTimestamps) {
+ swapChainD->timestamps.active[swapChainD->currentTimestampPairIndex] = true;
+ swapChainD->currentTimestampPairIndex = (swapChainD->currentTimestampPairIndex + 1) % QGles2SwapChainTimestamps::TIMESTAMP_PAIRS;
+ }
+
+ addBoundaryCommand(&swapChainD->cb, QGles2CommandBuffer::Command::EndFrame, recordTimestamps ? tsEnd : 0);
if (!ensureContext(swapChainD->surface))
return contextLost ? QRhi::FrameOpDeviceLost : QRhi::FrameOpError;
executeCommandBuffer(&swapChainD->cb);
- QRhiProfilerPrivate *rhiP = profilerPrivateOrNull();
- // this must be done before the swap
- QRHI_PROF_F(endSwapChainFrame(swapChain, swapChainD->frameCount + 1));
-
if (swapChainD->surface && !flags.testFlag(QRhi::SkipPresent)) {
ctx->swapBuffers(swapChainD->surface);
- needsMakeCurrent = true;
+ needsMakeCurrentDueToSwap = true;
} else {
f->glFlush();
}
swapChainD->frameCount += 1;
currentSwapChain = nullptr;
+
+ ctx->handle()->endFrame();
+
return QRhi::FrameOpSuccess;
}
-QRhi::FrameOpResult QRhiGles2::beginOffscreenFrame(QRhiCommandBuffer **cb, QRhi::BeginFrameFlags flags)
+QRhi::FrameOpResult QRhiGles2::beginOffscreenFrame(QRhiCommandBuffer **cb, QRhi::BeginFrameFlags)
{
- Q_UNUSED(flags);
if (!ensureContext())
return contextLost ? QRhi::FrameOpDeviceLost : QRhi::FrameOpError;
@@ -1264,7 +2181,12 @@ QRhi::FrameOpResult QRhiGles2::beginOffscreenFrame(QRhiCommandBuffer **cb, QRhi:
executeDeferredReleases();
ofr.cbWrapper.resetState();
- addBoundaryCommand(&ofr.cbWrapper, QGles2CommandBuffer::Command::BeginFrame);
+ if (rhiFlags.testFlag(QRhi::EnableTimestamps) && caps.timestamps) {
+ if (!ofr.tsQueries[0])
+ f->glGenQueries(2, ofr.tsQueries);
+ }
+
+ addBoundaryCommand(&ofr.cbWrapper, QGles2CommandBuffer::Command::BeginFrame, ofr.tsQueries[0]);
*cb = &ofr.cbWrapper;
return QRhi::FrameOpSuccess;
@@ -1276,13 +2198,29 @@ QRhi::FrameOpResult QRhiGles2::endOffscreenFrame(QRhi::EndFrameFlags flags)
Q_ASSERT(ofr.active);
ofr.active = false;
- addBoundaryCommand(&ofr.cbWrapper, QGles2CommandBuffer::Command::EndFrame);
+ addBoundaryCommand(&ofr.cbWrapper, QGles2CommandBuffer::Command::EndFrame, ofr.tsQueries[1]);
if (!ensureContext())
return contextLost ? QRhi::FrameOpDeviceLost : QRhi::FrameOpError;
executeCommandBuffer(&ofr.cbWrapper);
+ // Just as endFrame() does a flush when skipping the swapBuffers(), do it
+ // here as well. This has the added benefit of playing nice when rendering
+ // to a texture from a context and then consuming that texture from
+ // another, sharing context.
+ f->glFlush();
+
+ if (ofr.tsQueries[0]) {
+ quint64 timestamps[2];
+ glGetQueryObjectui64v(ofr.tsQueries[1], GL_QUERY_RESULT, &timestamps[1]);
+ glGetQueryObjectui64v(ofr.tsQueries[0], GL_QUERY_RESULT, &timestamps[0]);
+ if (timestamps[1] >= timestamps[0]) {
+ const quint64 nanoseconds = timestamps[1] - timestamps[0];
+ ofr.cbWrapper.lastGpuTime = nanoseconds / 1000000000.0; // seconds
+ }
+ }
+
return QRhi::FrameOpSuccess;
}
@@ -1304,26 +2242,67 @@ QRhi::FrameOpResult QRhiGles2::finish()
executeCommandBuffer(&currentSwapChain->cb);
currentSwapChain->cb.resetCommands();
}
+ // Do an actual glFinish(). May seem superfluous, but this is what
+ // matches most other backends e.g. Vulkan/Metal that do a heavyweight
+ // wait-for-idle blocking in their finish(). More importantly, this
+ // allows clients simply call finish() in threaded or shared context
+ // situations where one explicitly needs to do a glFlush or Finish.
+ f->glFinish();
}
return QRhi::FrameOpSuccess;
}
+static bool bufferAccessIsWrite(QGles2Buffer::Access access)
+{
+ return access == QGles2Buffer::AccessStorageWrite
+ || access == QGles2Buffer::AccessStorageReadWrite
+ || access == QGles2Buffer::AccessUpdate;
+}
+
+static bool textureAccessIsWrite(QGles2Texture::Access access)
+{
+ return access == QGles2Texture::AccessStorageWrite
+ || access == QGles2Texture::AccessStorageReadWrite
+ || access == QGles2Texture::AccessUpdate
+ || access == QGles2Texture::AccessFramebuffer;
+}
+
+static inline GLbitfield barriersForBuffer()
+{
+ return GL_VERTEX_ATTRIB_ARRAY_BARRIER_BIT
+ | GL_ELEMENT_ARRAY_BARRIER_BIT
+ | GL_UNIFORM_BARRIER_BIT
+ | GL_BUFFER_UPDATE_BARRIER_BIT
+ | GL_SHADER_STORAGE_BARRIER_BIT;
+}
+
+static inline GLbitfield barriersForTexture()
+{
+ return GL_TEXTURE_FETCH_BARRIER_BIT
+ | GL_SHADER_IMAGE_ACCESS_BARRIER_BIT
+ | GL_PIXEL_BUFFER_BARRIER_BIT
+ | GL_TEXTURE_UPDATE_BARRIER_BIT
+ | GL_FRAMEBUFFER_BARRIER_BIT;
+}
+
void QRhiGles2::trackedBufferBarrier(QGles2CommandBuffer *cbD, QGles2Buffer *bufD, QGles2Buffer::Access access)
{
Q_ASSERT(cbD->recordingPass == QGles2CommandBuffer::NoPass); // this is for resource updates only
+ if (!bufD->m_usage.testFlag(QRhiBuffer::StorageBuffer))
+ return;
+
const QGles2Buffer::Access prevAccess = bufD->usageState.access;
if (access == prevAccess)
return;
- if (prevAccess == QGles2Buffer::AccessStorageWrite || prevAccess == QGles2Buffer::AccessStorageReadWrite) {
+ if (bufferAccessIsWrite(prevAccess)) {
// Generating the minimal barrier set is way too complicated to do
// correctly (prevAccess is overwritten so we won't have proper
// tracking across multiple passes) so setting all barrier bits will do
// for now.
- QGles2CommandBuffer::Command cmd;
+ QGles2CommandBuffer::Command &cmd(cbD->commands.get());
cmd.cmd = QGles2CommandBuffer::Command::Barrier;
- cmd.args.barrier.barriers = GL_ALL_BARRIER_BITS;
- cbD->commands.append(cmd);
+ cmd.args.barrier.barriers = barriersForBuffer();
}
bufD->usageState.access = access;
@@ -1332,15 +2311,17 @@ void QRhiGles2::trackedBufferBarrier(QGles2CommandBuffer *cbD, QGles2Buffer *buf
void QRhiGles2::trackedImageBarrier(QGles2CommandBuffer *cbD, QGles2Texture *texD, QGles2Texture::Access access)
{
Q_ASSERT(cbD->recordingPass == QGles2CommandBuffer::NoPass); // this is for resource updates only
+ if (!texD->m_flags.testFlag(QRhiTexture::UsedWithLoadStore))
+ return;
+
const QGles2Texture::Access prevAccess = texD->usageState.access;
if (access == prevAccess)
return;
- if (prevAccess == QGles2Texture::AccessStorageWrite || prevAccess == QGles2Texture::AccessStorageReadWrite) {
- QGles2CommandBuffer::Command cmd;
+ if (textureAccessIsWrite(prevAccess)) {
+ QGles2CommandBuffer::Command &cmd(cbD->commands.get());
cmd.cmd = QGles2CommandBuffer::Command::Barrier;
- cmd.args.barrier.barriers = GL_ALL_BARRIER_BITS;
- cbD->commands.append(cmd);
+ cmd.args.barrier.barriers = barriersForTexture();
}
texD->usageState.access = access;
@@ -1352,88 +2333,131 @@ void QRhiGles2::enqueueSubresUpload(QGles2Texture *texD, QGles2CommandBuffer *cb
trackedImageBarrier(cbD, texD, QGles2Texture::AccessUpdate);
const bool isCompressed = isCompressedFormat(texD->m_format);
const bool isCubeMap = texD->m_flags.testFlag(QRhiTexture::CubeMap);
+ const bool is3D = texD->m_flags.testFlag(QRhiTexture::ThreeDimensional);
+ const bool is1D = texD->m_flags.testFlag(QRhiTexture::OneDimensional);
+ const bool isArray = texD->m_flags.testFlag(QRhiTexture::TextureArray);
const GLenum faceTargetBase = isCubeMap ? GL_TEXTURE_CUBE_MAP_POSITIVE_X : texD->target;
+ const GLenum effectiveTarget = faceTargetBase + (isCubeMap ? uint(layer) : 0u);
const QPoint dp = subresDesc.destinationTopLeft();
const QByteArray rawData = subresDesc.data();
- if (!subresDesc.image().isNull()) {
- QImage img = subresDesc.image();
- QSize size = img.size();
- QGles2CommandBuffer::Command cmd;
+
+ auto setCmdByNotCompressedData = [&](const void* data, QSize size, quint32 dataStride)
+ {
+ quint32 bytesPerLine = 0;
+ quint32 bytesPerPixel = 0;
+ textureFormatInfo(texD->m_format, size, &bytesPerLine, nullptr, &bytesPerPixel);
+
+ QGles2CommandBuffer::Command &cmd(cbD->commands.get());
cmd.cmd = QGles2CommandBuffer::Command::SubImage;
- if (!subresDesc.sourceSize().isEmpty() || !subresDesc.sourceTopLeft().isNull()) {
- const QPoint sp = subresDesc.sourceTopLeft();
- if (!subresDesc.sourceSize().isEmpty())
- size = subresDesc.sourceSize();
- img = img.copy(sp.x(), sp.y(), size.width(), size.height());
- }
cmd.args.subImage.target = texD->target;
cmd.args.subImage.texture = texD->texture;
- cmd.args.subImage.faceTarget = faceTargetBase + uint(layer);
+ cmd.args.subImage.faceTarget = effectiveTarget;
cmd.args.subImage.level = level;
cmd.args.subImage.dx = dp.x();
- cmd.args.subImage.dy = dp.y();
+ cmd.args.subImage.dy = is1D && isArray ? layer : dp.y();
+ cmd.args.subImage.dz = is3D || isArray ? layer : 0;
cmd.args.subImage.w = size.width();
cmd.args.subImage.h = size.height();
cmd.args.subImage.glformat = texD->glformat;
cmd.args.subImage.gltype = texD->gltype;
- cmd.args.subImage.rowStartAlign = 4;
- cmd.args.subImage.data = cbD->retainImage(img);
- cbD->commands.append(cmd);
+
+ if (dataStride == 0)
+ dataStride = bytesPerLine;
+
+ cmd.args.subImage.rowStartAlign = (dataStride & 3) ? 1 : 4;
+ cmd.args.subImage.rowLength = caps.unpackRowLength ? (bytesPerPixel ? dataStride / bytesPerPixel : 0) : 0;
+
+ cmd.args.subImage.data = data;
+ };
+
+ if (!subresDesc.image().isNull()) {
+ QImage img = subresDesc.image();
+ QSize size = img.size();
+ if (!subresDesc.sourceSize().isEmpty() || !subresDesc.sourceTopLeft().isNull()) {
+ const QPoint sp = subresDesc.sourceTopLeft();
+ if (!subresDesc.sourceSize().isEmpty())
+ size = subresDesc.sourceSize();
+
+ if (caps.unpackRowLength) {
+ cbD->retainImage(img);
+ // create a non-owning wrapper for the subimage
+ const uchar *data = img.constBits() + sp.y() * img.bytesPerLine() + sp.x() * (qMax(1, img.depth() / 8));
+ img = QImage(data, size.width(), size.height(), img.bytesPerLine(), img.format());
+ } else {
+ img = img.copy(sp.x(), sp.y(), size.width(), size.height());
+ }
+ }
+
+ setCmdByNotCompressedData(cbD->retainImage(img), size, img.bytesPerLine());
} else if (!rawData.isEmpty() && isCompressed) {
+ const int depth = qMax(1, texD->m_depth);
+ const int arraySize = qMax(0, texD->m_arraySize);
+ if ((texD->flags().testFlag(QRhiTexture::UsedAsCompressedAtlas) || is3D || isArray)
+ && !texD->zeroInitialized)
+ {
+ // Create on first upload since glCompressedTexImage2D cannot take
+ // nullptr data. We have a rule in the QRhi docs that the first
+ // upload for a compressed texture must cover the entire image, but
+ // that is clearly not ideal when building a texture atlas, or when
+ // having a 3D texture with per-slice data.
+ quint32 byteSize = 0;
+ compressedFormatInfo(texD->m_format, texD->m_pixelSize, nullptr, &byteSize, nullptr);
+ if (is3D)
+ byteSize *= depth;
+ if (isArray)
+ byteSize *= arraySize;
+ QByteArray zeroBuf(byteSize, 0);
+ QGles2CommandBuffer::Command &cmd(cbD->commands.get());
+ cmd.cmd = QGles2CommandBuffer::Command::CompressedImage;
+ cmd.args.compressedImage.target = texD->target;
+ cmd.args.compressedImage.texture = texD->texture;
+ cmd.args.compressedImage.faceTarget = effectiveTarget;
+ cmd.args.compressedImage.level = level;
+ cmd.args.compressedImage.glintformat = texD->glintformat;
+ cmd.args.compressedImage.w = texD->m_pixelSize.width();
+ cmd.args.compressedImage.h = is1D && isArray ? arraySize : texD->m_pixelSize.height();
+ cmd.args.compressedImage.depth = is3D ? depth : (isArray ? arraySize : 0);
+ cmd.args.compressedImage.size = byteSize;
+ cmd.args.compressedImage.data = cbD->retainData(zeroBuf);
+ texD->zeroInitialized = true;
+ }
+
const QSize size = subresDesc.sourceSize().isEmpty() ? q->sizeForMipLevel(level, texD->m_pixelSize)
: subresDesc.sourceSize();
- if (texD->specified) {
- QGles2CommandBuffer::Command cmd;
+ if (texD->specified || texD->zeroInitialized) {
+ QGles2CommandBuffer::Command &cmd(cbD->commands.get());
cmd.cmd = QGles2CommandBuffer::Command::CompressedSubImage;
cmd.args.compressedSubImage.target = texD->target;
cmd.args.compressedSubImage.texture = texD->texture;
- cmd.args.compressedSubImage.faceTarget = faceTargetBase + uint(layer);
+ cmd.args.compressedSubImage.faceTarget = effectiveTarget;
cmd.args.compressedSubImage.level = level;
cmd.args.compressedSubImage.dx = dp.x();
- cmd.args.compressedSubImage.dy = dp.y();
+ cmd.args.compressedSubImage.dy = is1D && isArray ? layer : dp.y();
+ cmd.args.compressedSubImage.dz = is3D || isArray ? layer : 0;
cmd.args.compressedSubImage.w = size.width();
cmd.args.compressedSubImage.h = size.height();
cmd.args.compressedSubImage.glintformat = texD->glintformat;
cmd.args.compressedSubImage.size = rawData.size();
cmd.args.compressedSubImage.data = cbD->retainData(rawData);
- cbD->commands.append(cmd);
} else {
- QGles2CommandBuffer::Command cmd;
+ QGles2CommandBuffer::Command &cmd(cbD->commands.get());
cmd.cmd = QGles2CommandBuffer::Command::CompressedImage;
cmd.args.compressedImage.target = texD->target;
cmd.args.compressedImage.texture = texD->texture;
- cmd.args.compressedImage.faceTarget = faceTargetBase + uint(layer);
+ cmd.args.compressedImage.faceTarget = effectiveTarget;
cmd.args.compressedImage.level = level;
cmd.args.compressedImage.glintformat = texD->glintformat;
cmd.args.compressedImage.w = size.width();
- cmd.args.compressedImage.h = size.height();
+ cmd.args.compressedImage.h = is1D && isArray ? arraySize : size.height();
+ cmd.args.compressedImage.depth = is3D ? depth : (isArray ? arraySize : 0);
cmd.args.compressedImage.size = rawData.size();
cmd.args.compressedImage.data = cbD->retainData(rawData);
- cbD->commands.append(cmd);
}
} else if (!rawData.isEmpty()) {
const QSize size = subresDesc.sourceSize().isEmpty() ? q->sizeForMipLevel(level, texD->m_pixelSize)
: subresDesc.sourceSize();
- quint32 bpl = 0;
- textureFormatInfo(texD->m_format, size, &bpl, nullptr);
- QGles2CommandBuffer::Command cmd;
- cmd.cmd = QGles2CommandBuffer::Command::SubImage;
- cmd.args.subImage.target = texD->target;
- cmd.args.subImage.texture = texD->texture;
- cmd.args.subImage.faceTarget = faceTargetBase + uint(layer);
- cmd.args.subImage.level = level;
- cmd.args.subImage.dx = dp.x();
- cmd.args.subImage.dy = dp.y();
- cmd.args.subImage.w = size.width();
- cmd.args.subImage.h = size.height();
- cmd.args.subImage.glformat = texD->glformat;
- cmd.args.subImage.gltype = texD->gltype;
- // Default unpack alignment (row start aligment
- // requirement) is 4. QImage guarantees 4 byte aligned
- // row starts, but our raw data here does not.
- cmd.args.subImage.rowStartAlign = (bpl & 3) ? 1 : 4;
- cmd.args.subImage.data = cbD->retainData(rawData);
- cbD->commands.append(cmd);
+
+ setCmdByNotCompressedData(cbD->retainData(rawData), size, subresDesc.dataStride());
} else {
qWarning("Invalid texture upload for %p layer=%d mip=%d", texD, layer, level);
}
@@ -1444,66 +2468,65 @@ void QRhiGles2::enqueueResourceUpdates(QRhiCommandBuffer *cb, QRhiResourceUpdate
QGles2CommandBuffer *cbD = QRHI_RES(QGles2CommandBuffer, cb);
QRhiResourceUpdateBatchPrivate *ud = QRhiResourceUpdateBatchPrivate::get(resourceUpdates);
- for (const QRhiResourceUpdateBatchPrivate::BufferOp &u : ud->bufferOps) {
+ for (int opIdx = 0; opIdx < ud->activeBufferOpCount; ++opIdx) {
+ const QRhiResourceUpdateBatchPrivate::BufferOp &u(ud->bufferOps[opIdx]);
if (u.type == QRhiResourceUpdateBatchPrivate::BufferOp::DynamicUpdate) {
QGles2Buffer *bufD = QRHI_RES(QGles2Buffer, u.buf);
Q_ASSERT(bufD->m_type == QRhiBuffer::Dynamic);
if (bufD->m_usage.testFlag(QRhiBuffer::UniformBuffer)) {
- memcpy(bufD->ubuf.data() + u.offset, u.data.constData(), size_t(u.data.size()));
+ memcpy(bufD->data.data() + u.offset, u.data.constData(), size_t(u.data.size()));
} else {
trackedBufferBarrier(cbD, bufD, QGles2Buffer::AccessUpdate);
- QGles2CommandBuffer::Command cmd;
+ QGles2CommandBuffer::Command &cmd(cbD->commands.get());
cmd.cmd = QGles2CommandBuffer::Command::BufferSubData;
cmd.args.bufferSubData.target = bufD->targetForDataOps;
cmd.args.bufferSubData.buffer = bufD->buffer;
cmd.args.bufferSubData.offset = u.offset;
cmd.args.bufferSubData.size = u.data.size();
- cmd.args.bufferSubData.data = cbD->retainData(u.data);
- cbD->commands.append(cmd);
+ cmd.args.bufferSubData.data = cbD->retainBufferData(u.data);
}
} else if (u.type == QRhiResourceUpdateBatchPrivate::BufferOp::StaticUpload) {
QGles2Buffer *bufD = QRHI_RES(QGles2Buffer, u.buf);
Q_ASSERT(bufD->m_type != QRhiBuffer::Dynamic);
Q_ASSERT(u.offset + u.data.size() <= bufD->m_size);
if (bufD->m_usage.testFlag(QRhiBuffer::UniformBuffer)) {
- memcpy(bufD->ubuf.data() + u.offset, u.data.constData(), size_t(u.data.size()));
+ memcpy(bufD->data.data() + u.offset, u.data.constData(), size_t(u.data.size()));
} else {
trackedBufferBarrier(cbD, bufD, QGles2Buffer::AccessUpdate);
- QGles2CommandBuffer::Command cmd;
+ QGles2CommandBuffer::Command &cmd(cbD->commands.get());
cmd.cmd = QGles2CommandBuffer::Command::BufferSubData;
cmd.args.bufferSubData.target = bufD->targetForDataOps;
cmd.args.bufferSubData.buffer = bufD->buffer;
cmd.args.bufferSubData.offset = u.offset;
cmd.args.bufferSubData.size = u.data.size();
- cmd.args.bufferSubData.data = cbD->retainData(u.data);
- cbD->commands.append(cmd);
+ cmd.args.bufferSubData.data = cbD->retainBufferData(u.data);
}
} else if (u.type == QRhiResourceUpdateBatchPrivate::BufferOp::Read) {
QGles2Buffer *bufD = QRHI_RES(QGles2Buffer, u.buf);
if (bufD->m_usage.testFlag(QRhiBuffer::UniformBuffer)) {
u.result->data.resize(u.readSize);
- memcpy(u.result->data.data(), bufD->ubuf.constData() + u.offset, size_t(u.readSize));
+ memcpy(u.result->data.data(), bufD->data.constData() + u.offset, size_t(u.readSize));
if (u.result->completed)
u.result->completed();
} else {
- QGles2CommandBuffer::Command cmd;
+ QGles2CommandBuffer::Command &cmd(cbD->commands.get());
cmd.cmd = QGles2CommandBuffer::Command::GetBufferSubData;
cmd.args.getBufferSubData.result = u.result;
cmd.args.getBufferSubData.target = bufD->targetForDataOps;
cmd.args.getBufferSubData.buffer = bufD->buffer;
cmd.args.getBufferSubData.offset = u.offset;
cmd.args.getBufferSubData.size = u.readSize;
- cbD->commands.append(cmd);
}
}
}
- for (const QRhiResourceUpdateBatchPrivate::TextureOp &u : ud->textureOps) {
+ for (int opIdx = 0; opIdx < ud->activeTextureOpCount; ++opIdx) {
+ const QRhiResourceUpdateBatchPrivate::TextureOp &u(ud->textureOps[opIdx]);
if (u.type == QRhiResourceUpdateBatchPrivate::TextureOp::Upload) {
QGles2Texture *texD = QRHI_RES(QGles2Texture, u.dst);
- for (int layer = 0; layer < QRhi::MAX_LAYERS; ++layer) {
- for (int level = 0; level < QRhi::MAX_LEVELS; ++level) {
- for (const QRhiTextureSubresourceUploadDescription &subresDesc : qAsConst(u.subresDesc[layer][level]))
+ for (int layer = 0, maxLayer = u.subresDesc.size(); layer < maxLayer; ++layer) {
+ for (int level = 0; level < QRhi::MAX_MIP_LEVELS; ++level) {
+ for (const QRhiTextureSubresourceUploadDescription &subresDesc : std::as_const(u.subresDesc[layer][level]))
enqueueSubresUpload(texD, cbD, layer, level, subresDesc);
}
}
@@ -1527,53 +2550,65 @@ void QRhiGles2::enqueueResourceUpdates(QRhiCommandBuffer *cb, QRhiResourceUpdate
const GLenum dstFaceTargetBase = dstD->m_flags.testFlag(QRhiTexture::CubeMap)
? GL_TEXTURE_CUBE_MAP_POSITIVE_X : dstD->target;
- QGles2CommandBuffer::Command cmd;
+ QGles2CommandBuffer::Command &cmd(cbD->commands.get());
cmd.cmd = QGles2CommandBuffer::Command::CopyTex;
- cmd.args.copyTex.srcFaceTarget = srcFaceTargetBase + uint(u.desc.sourceLayer());
+ const bool srcHasZ = srcD->m_flags.testFlag(QRhiTexture::ThreeDimensional) || srcD->m_flags.testFlag(QRhiTexture::TextureArray);
+ const bool dstHasZ = dstD->m_flags.testFlag(QRhiTexture::ThreeDimensional) || dstD->m_flags.testFlag(QRhiTexture::TextureArray);
+ const bool dstIs1dArray = dstD->m_flags.testFlag(QRhiTexture::OneDimensional)
+ && dstD->m_flags.testFlag(QRhiTexture::TextureArray);
+
+ cmd.args.copyTex.srcTarget = srcD->target;
+ cmd.args.copyTex.srcFaceTarget = srcFaceTargetBase + (srcHasZ ? 0u : uint(u.desc.sourceLayer()));
cmd.args.copyTex.srcTexture = srcD->texture;
cmd.args.copyTex.srcLevel = u.desc.sourceLevel();
cmd.args.copyTex.srcX = sp.x();
cmd.args.copyTex.srcY = sp.y();
+ cmd.args.copyTex.srcZ = srcHasZ ? u.desc.sourceLayer() : 0;
cmd.args.copyTex.dstTarget = dstD->target;
+ cmd.args.copyTex.dstFaceTarget = dstFaceTargetBase + (dstHasZ ? 0u : uint(u.desc.destinationLayer()));
cmd.args.copyTex.dstTexture = dstD->texture;
- cmd.args.copyTex.dstFaceTarget = dstFaceTargetBase + uint(u.desc.destinationLayer());
cmd.args.copyTex.dstLevel = u.desc.destinationLevel();
cmd.args.copyTex.dstX = dp.x();
- cmd.args.copyTex.dstY = dp.y();
+ cmd.args.copyTex.dstY = dstIs1dArray ? u.desc.destinationLayer() : dp.y();
+ cmd.args.copyTex.dstZ = dstHasZ ? u.desc.destinationLayer() : 0;
cmd.args.copyTex.w = copySize.width();
cmd.args.copyTex.h = copySize.height();
-
- cbD->commands.append(cmd);
} else if (u.type == QRhiResourceUpdateBatchPrivate::TextureOp::Read) {
- QGles2CommandBuffer::Command cmd;
+ QGles2CommandBuffer::Command &cmd(cbD->commands.get());
cmd.cmd = QGles2CommandBuffer::Command::ReadPixels;
cmd.args.readPixels.result = u.result;
QGles2Texture *texD = QRHI_RES(QGles2Texture, u.rb.texture());
if (texD)
trackedImageBarrier(cbD, texD, QGles2Texture::AccessRead);
cmd.args.readPixels.texture = texD ? texD->texture : 0;
+ cmd.args.readPixels.slice3D = -1;
if (texD) {
const QSize readImageSize = q->sizeForMipLevel(u.rb.level(), texD->m_pixelSize);
cmd.args.readPixels.w = readImageSize.width();
cmd.args.readPixels.h = readImageSize.height();
cmd.args.readPixels.format = texD->m_format;
- const GLenum faceTargetBase = texD->m_flags.testFlag(QRhiTexture::CubeMap)
- ? GL_TEXTURE_CUBE_MAP_POSITIVE_X : texD->target;
- cmd.args.readPixels.readTarget = faceTargetBase + uint(u.rb.layer());
+ if (texD->m_flags.testFlag(QRhiTexture::ThreeDimensional)
+ || texD->m_flags.testFlag(QRhiTexture::TextureArray))
+ {
+ cmd.args.readPixels.readTarget = texD->target;
+ cmd.args.readPixels.slice3D = u.rb.layer();
+ } else {
+ const GLenum faceTargetBase = texD->m_flags.testFlag(QRhiTexture::CubeMap)
+ ? GL_TEXTURE_CUBE_MAP_POSITIVE_X : texD->target;
+ cmd.args.readPixels.readTarget = faceTargetBase + uint(u.rb.layer());
+ }
cmd.args.readPixels.level = u.rb.level();
}
- cbD->commands.append(cmd);
} else if (u.type == QRhiResourceUpdateBatchPrivate::TextureOp::GenMips) {
QGles2Texture *texD = QRHI_RES(QGles2Texture, u.dst);
trackedImageBarrier(cbD, texD, QGles2Texture::AccessFramebuffer);
- QGles2CommandBuffer::Command cmd;
+ QGles2CommandBuffer::Command &cmd(cbD->commands.get());
cmd.cmd = QGles2CommandBuffer::Command::GenMip;
cmd.args.genMip.target = texD->target;
cmd.args.genMip.texture = texD->texture;
- cbD->commands.append(cmd);
}
}
@@ -1595,9 +2630,10 @@ static inline GLenum toGlTopology(QRhiGraphicsPipeline::Topology t)
return GL_LINE_STRIP;
case QRhiGraphicsPipeline::Points:
return GL_POINTS;
+ case QRhiGraphicsPipeline::Patches:
+ return GL_PATCHES;
default:
- Q_UNREACHABLE();
- return GL_TRIANGLES;
+ Q_UNREACHABLE_RETURN(GL_TRIANGLES);
}
}
@@ -1609,8 +2645,7 @@ static inline GLenum toGlCullMode(QRhiGraphicsPipeline::CullMode c)
case QRhiGraphicsPipeline::Back:
return GL_BACK;
default:
- Q_UNREACHABLE();
- return GL_BACK;
+ Q_UNREACHABLE_RETURN(GL_BACK);
}
}
@@ -1622,8 +2657,7 @@ static inline GLenum toGlFrontFace(QRhiGraphicsPipeline::FrontFace f)
case QRhiGraphicsPipeline::CW:
return GL_CW;
default:
- Q_UNREACHABLE();
- return GL_CCW;
+ Q_UNREACHABLE_RETURN(GL_CCW);
}
}
@@ -1661,17 +2695,13 @@ static inline GLenum toGlBlendFactor(QRhiGraphicsPipeline::BlendFactor f)
case QRhiGraphicsPipeline::SrcAlphaSaturate:
return GL_SRC_ALPHA_SATURATE;
case QRhiGraphicsPipeline::Src1Color:
- Q_FALLTHROUGH();
case QRhiGraphicsPipeline::OneMinusSrc1Color:
- Q_FALLTHROUGH();
case QRhiGraphicsPipeline::Src1Alpha:
- Q_FALLTHROUGH();
case QRhiGraphicsPipeline::OneMinusSrc1Alpha:
qWarning("Unsupported blend factor %d", f);
return GL_ZERO;
default:
- Q_UNREACHABLE();
- return GL_ZERO;
+ Q_UNREACHABLE_RETURN(GL_ZERO);
}
}
@@ -1689,8 +2719,7 @@ static inline GLenum toGlBlendOp(QRhiGraphicsPipeline::BlendOp op)
case QRhiGraphicsPipeline::Max:
return GL_MAX;
default:
- Q_UNREACHABLE();
- return GL_FUNC_ADD;
+ Q_UNREACHABLE_RETURN(GL_FUNC_ADD);
}
}
@@ -1714,8 +2743,7 @@ static inline GLenum toGlCompareOp(QRhiGraphicsPipeline::CompareOp op)
case QRhiGraphicsPipeline::Always:
return GL_ALWAYS;
default:
- Q_UNREACHABLE();
- return GL_ALWAYS;
+ Q_UNREACHABLE_RETURN(GL_ALWAYS);
}
}
@@ -1739,8 +2767,19 @@ static inline GLenum toGlStencilOp(QRhiGraphicsPipeline::StencilOp op)
case QRhiGraphicsPipeline::DecrementAndWrap:
return GL_DECR_WRAP;
default:
- Q_UNREACHABLE();
- return GL_KEEP;
+ Q_UNREACHABLE_RETURN(GL_KEEP);
+ }
+}
+
+static inline GLenum toGlPolygonMode(QRhiGraphicsPipeline::PolygonMode mode)
+{
+ switch (mode) {
+ case QRhiGraphicsPipeline::PolygonMode::Fill:
+ return GL_FILL;
+ case QRhiGraphicsPipeline::PolygonMode::Line:
+ return GL_LINE;
+ default:
+ Q_UNREACHABLE_RETURN(GL_FILL);
}
}
@@ -1758,8 +2797,7 @@ static inline GLenum toGlMinFilter(QRhiSampler::Filter f, QRhiSampler::Filter m)
else
return m == QRhiSampler::Nearest ? GL_LINEAR_MIPMAP_NEAREST : GL_LINEAR_MIPMAP_LINEAR;
default:
- Q_UNREACHABLE();
- return GL_LINEAR;
+ Q_UNREACHABLE_RETURN(GL_LINEAR);
}
}
@@ -1771,8 +2809,7 @@ static inline GLenum toGlMagFilter(QRhiSampler::Filter f)
case QRhiSampler::Linear:
return GL_LINEAR;
default:
- Q_UNREACHABLE();
- return GL_LINEAR;
+ Q_UNREACHABLE_RETURN(GL_LINEAR);
}
}
@@ -1786,8 +2823,7 @@ static inline GLenum toGlWrapMode(QRhiSampler::AddressMode m)
case QRhiSampler::Mirror:
return GL_MIRRORED_REPEAT;
default:
- Q_UNREACHABLE();
- return GL_CLAMP_TO_EDGE;
+ Q_UNREACHABLE_RETURN(GL_CLAMP_TO_EDGE);
}
}
@@ -1811,8 +2847,7 @@ static inline GLenum toGlTextureCompareFunc(QRhiSampler::CompareOp op)
case QRhiSampler::Always:
return GL_ALWAYS;
default:
- Q_UNREACHABLE();
- return GL_NEVER;
+ Q_UNREACHABLE_RETURN(GL_NEVER);
}
}
@@ -1898,16 +2933,51 @@ void QRhiGles2::trackedRegisterTexture(QRhiPassResourceTracker *passResTracker,
u.access = toGlAccess(access);
}
-void QRhiGles2::executeCommandBuffer(QRhiCommandBuffer *cb)
+struct CommandBufferExecTrackedState
{
- QGles2CommandBuffer *cbD = QRHI_RES(QGles2CommandBuffer, cb);
GLenum indexType = GL_UNSIGNED_SHORT;
quint32 indexStride = sizeof(quint16);
quint32 indexOffset = 0;
+ GLuint currentArrayBuffer = 0;
+ GLuint currentElementArrayBuffer = 0;
+ struct {
+ QRhiGraphicsPipeline *ps = nullptr;
+ GLuint buffer = 0;
+ quint32 offset = 0;
+ int binding = 0;
+ } lastBindVertexBuffer;
+ static const int TRACKED_ATTRIB_COUNT = 16;
+ bool enabledAttribArrays[TRACKED_ATTRIB_COUNT] = {};
+ bool nonzeroAttribDivisor[TRACKED_ATTRIB_COUNT] = {};
+ bool instancedAttributesUsed = false;
+ int maxUntrackedInstancedAttribute = 0;
+};
+
+// Helper that must be used in executeCommandBuffer() whenever changing the
+// ARRAY or ELEMENT_ARRAY buffer binding outside of Command::BindVertexBuffer
+// and Command::BindIndexBuffer.
+static inline void bindVertexIndexBufferWithStateReset(CommandBufferExecTrackedState *state,
+ QOpenGLExtensions *f,
+ GLenum target,
+ GLuint buffer)
+{
+ state->currentArrayBuffer = 0;
+ state->currentElementArrayBuffer = 0;
+ state->lastBindVertexBuffer.buffer = 0;
+ f->glBindBuffer(target, buffer);
+}
+
+void QRhiGles2::executeCommandBuffer(QRhiCommandBuffer *cb)
+{
+ CommandBufferExecTrackedState state;
+ QGles2CommandBuffer *cbD = QRHI_RES(QGles2CommandBuffer, cb);
- for (const QGles2CommandBuffer::Command &cmd : qAsConst(cbD->commands)) {
+ for (auto it = cbD->commands.cbegin(), end = cbD->commands.cend(); it != end; ++it) {
+ const QGles2CommandBuffer::Command &cmd(*it);
switch (cmd.cmd) {
case QGles2CommandBuffer::Command::BeginFrame:
+ if (cmd.args.beginFrame.timestampQuery)
+ glQueryCounter(cmd.args.beginFrame.timestampQuery, GL_TIMESTAMP);
if (caps.coreProfile) {
if (!vao)
f->glGenVertexArrays(1, &vao);
@@ -1915,8 +2985,27 @@ void QRhiGles2::executeCommandBuffer(QRhiCommandBuffer *cb)
}
break;
case QGles2CommandBuffer::Command::EndFrame:
+ if (state.instancedAttributesUsed) {
+ for (int i = 0; i < CommandBufferExecTrackedState::TRACKED_ATTRIB_COUNT; ++i) {
+ if (state.nonzeroAttribDivisor[i])
+ f->glVertexAttribDivisor(GLuint(i), 0);
+ }
+ for (int i = CommandBufferExecTrackedState::TRACKED_ATTRIB_COUNT; i <= state.maxUntrackedInstancedAttribute; ++i)
+ f->glVertexAttribDivisor(GLuint(i), 0);
+ state.instancedAttributesUsed = false;
+ }
+#ifdef Q_OS_WASM
+ for (int i = 0; i < CommandBufferExecTrackedState::TRACKED_ATTRIB_COUNT; ++i) {
+ if (state.enabledAttribArrays[i]) {
+ f->glDisableVertexAttribArray(GLuint(i));
+ state.enabledAttribArrays[i] = false;
+ }
+ }
+#endif
if (vao)
f->glBindVertexArray(0);
+ if (cmd.args.endFrame.timestampQuery)
+ glQueryCounter(cmd.args.endFrame.timestampQuery, GL_TIMESTAMP);
break;
case QGles2CommandBuffer::Command::ResetFrame:
if (vao)
@@ -1936,8 +3025,10 @@ void QRhiGles2::executeCommandBuffer(QRhiCommandBuffer *cb)
{
QGles2GraphicsPipeline *psD = QRHI_RES(QGles2GraphicsPipeline, cmd.args.stencilRef.ps);
if (psD) {
- f->glStencilFuncSeparate(GL_FRONT, toGlCompareOp(psD->m_stencilFront.compareOp), GLint(cmd.args.stencilRef.ref), psD->m_stencilReadMask);
- f->glStencilFuncSeparate(GL_BACK, toGlCompareOp(psD->m_stencilBack.compareOp), GLint(cmd.args.stencilRef.ref), psD->m_stencilReadMask);
+ const GLint ref = GLint(cmd.args.stencilRef.ref);
+ f->glStencilFuncSeparate(GL_FRONT, toGlCompareOp(psD->m_stencilFront.compareOp), ref, psD->m_stencilReadMask);
+ f->glStencilFuncSeparate(GL_BACK, toGlCompareOp(psD->m_stencilBack.compareOp), ref, psD->m_stencilReadMask);
+ cbD->graphicsPassState.dynamic.stencilRef = ref;
} else {
qWarning("No graphics pipeline active for setStencilRef; ignored");
}
@@ -1947,6 +3038,26 @@ void QRhiGles2::executeCommandBuffer(QRhiCommandBuffer *cb)
{
QGles2GraphicsPipeline *psD = QRHI_RES(QGles2GraphicsPipeline, cmd.args.bindVertexBuffer.ps);
if (psD) {
+ if (state.lastBindVertexBuffer.ps == psD
+ && state.lastBindVertexBuffer.buffer == cmd.args.bindVertexBuffer.buffer
+ && state.lastBindVertexBuffer.offset == cmd.args.bindVertexBuffer.offset
+ && state.lastBindVertexBuffer.binding == cmd.args.bindVertexBuffer.binding)
+ {
+ // The pipeline and so the vertex input layout is
+ // immutable, no point in issuing the exact same set of
+ // glVertexAttribPointer again and again for the same buffer.
+ break;
+ }
+ state.lastBindVertexBuffer.ps = psD;
+ state.lastBindVertexBuffer.buffer = cmd.args.bindVertexBuffer.buffer;
+ state.lastBindVertexBuffer.offset = cmd.args.bindVertexBuffer.offset;
+ state.lastBindVertexBuffer.binding = cmd.args.bindVertexBuffer.binding;
+
+ if (cmd.args.bindVertexBuffer.buffer != state.currentArrayBuffer) {
+ state.currentArrayBuffer = cmd.args.bindVertexBuffer.buffer;
+ // we do not support more than one vertex buffer
+ f->glBindBuffer(GL_ARRAY_BUFFER, state.currentArrayBuffer);
+ }
for (auto it = psD->m_vertexInputLayout.cbeginAttributes(), itEnd = psD->m_vertexInputLayout.cendAttributes();
it != itEnd; ++it)
{
@@ -1954,9 +3065,6 @@ void QRhiGles2::executeCommandBuffer(QRhiCommandBuffer *cb)
if (bindingIdx != cmd.args.bindVertexBuffer.binding)
continue;
- // we do not support more than one vertex buffer
- f->glBindBuffer(GL_ARRAY_BUFFER, cmd.args.bindVertexBuffer.buffer);
-
const QRhiVertexInputBinding *inputBinding = psD->m_vertexInputLayout.bindingAt(bindingIdx);
const int stride = int(inputBinding->stride());
int size = 1;
@@ -1994,17 +3102,127 @@ void QRhiGles2::executeCommandBuffer(QRhiCommandBuffer *cb)
normalize = true;
size = 1;
break;
+ case QRhiVertexInputAttribute::UInt4:
+ type = GL_UNSIGNED_INT;
+ size = 4;
+ break;
+ case QRhiVertexInputAttribute::UInt3:
+ type = GL_UNSIGNED_INT;
+ size = 3;
+ break;
+ case QRhiVertexInputAttribute::UInt2:
+ type = GL_UNSIGNED_INT;
+ size = 2;
+ break;
+ case QRhiVertexInputAttribute::UInt:
+ type = GL_UNSIGNED_INT;
+ size = 1;
+ break;
+ case QRhiVertexInputAttribute::SInt4:
+ type = GL_INT;
+ size = 4;
+ break;
+ case QRhiVertexInputAttribute::SInt3:
+ type = GL_INT;
+ size = 3;
+ break;
+ case QRhiVertexInputAttribute::SInt2:
+ type = GL_INT;
+ size = 2;
+ break;
+ case QRhiVertexInputAttribute::SInt:
+ type = GL_INT;
+ size = 1;
+ break;
+ case QRhiVertexInputAttribute::Half4:
+ type = GL_HALF_FLOAT;
+ size = 4;
+ break;
+ case QRhiVertexInputAttribute::Half3:
+ type = GL_HALF_FLOAT;
+ size = 3;
+ break;
+ case QRhiVertexInputAttribute::Half2:
+ type = GL_HALF_FLOAT;
+ size = 2;
+ break;
+ case QRhiVertexInputAttribute::Half:
+ type = GL_HALF_FLOAT;
+ size = 1;
+ break;
+ case QRhiVertexInputAttribute::UShort4:
+ type = GL_UNSIGNED_SHORT;
+ size = 4;
+ break;
+ case QRhiVertexInputAttribute::UShort3:
+ type = GL_UNSIGNED_SHORT;
+ size = 3;
+ break;
+ case QRhiVertexInputAttribute::UShort2:
+ type = GL_UNSIGNED_SHORT;
+ size = 2;
+ break;
+ case QRhiVertexInputAttribute::UShort:
+ type = GL_UNSIGNED_SHORT;
+ size = 1;
+ break;
+ case QRhiVertexInputAttribute::SShort4:
+ type = GL_SHORT;
+ size = 4;
+ break;
+ case QRhiVertexInputAttribute::SShort3:
+ type = GL_SHORT;
+ size = 3;
+ break;
+ case QRhiVertexInputAttribute::SShort2:
+ type = GL_SHORT;
+ size = 2;
+ break;
+ case QRhiVertexInputAttribute::SShort:
+ type = GL_SHORT;
+ size = 1;
+ break;
default:
break;
}
const int locationIdx = it->location();
quint32 ofs = it->offset() + cmd.args.bindVertexBuffer.offset;
- f->glVertexAttribPointer(GLuint(locationIdx), size, type, normalize, stride,
- reinterpret_cast<const GLvoid *>(quintptr(ofs)));
- f->glEnableVertexAttribArray(GLuint(locationIdx));
- if (inputBinding->classification() == QRhiVertexInputBinding::PerInstance && caps.instancing)
- f->glVertexAttribDivisor(GLuint(locationIdx), GLuint(inputBinding->instanceStepRate()));
+ if (type == GL_UNSIGNED_INT || type == GL_INT) {
+ if (caps.intAttributes) {
+ f->glVertexAttribIPointer(GLuint(locationIdx), size, type, stride,
+ reinterpret_cast<const GLvoid *>(quintptr(ofs)));
+ } else {
+ qWarning("Current RHI backend does not support IntAttributes. Check supported features.");
+ // This is a trick to disable this attribute
+ if (locationIdx < CommandBufferExecTrackedState::TRACKED_ATTRIB_COUNT)
+ state.enabledAttribArrays[locationIdx] = true;
+ }
+ } else {
+ f->glVertexAttribPointer(GLuint(locationIdx), size, type, normalize, stride,
+ reinterpret_cast<const GLvoid *>(quintptr(ofs)));
+ }
+ if (locationIdx >= CommandBufferExecTrackedState::TRACKED_ATTRIB_COUNT || !state.enabledAttribArrays[locationIdx]) {
+ if (locationIdx < CommandBufferExecTrackedState::TRACKED_ATTRIB_COUNT)
+ state.enabledAttribArrays[locationIdx] = true;
+ f->glEnableVertexAttribArray(GLuint(locationIdx));
+ }
+ if (inputBinding->classification() == QRhiVertexInputBinding::PerInstance && caps.instancing) {
+ f->glVertexAttribDivisor(GLuint(locationIdx), inputBinding->instanceStepRate());
+ if (Q_LIKELY(locationIdx < CommandBufferExecTrackedState::TRACKED_ATTRIB_COUNT))
+ state.nonzeroAttribDivisor[locationIdx] = true;
+ else
+ state.maxUntrackedInstancedAttribute = qMax(state.maxUntrackedInstancedAttribute, locationIdx);
+ state.instancedAttributesUsed = true;
+ } else if ((locationIdx < CommandBufferExecTrackedState::TRACKED_ATTRIB_COUNT
+ && state.nonzeroAttribDivisor[locationIdx])
+ || Q_UNLIKELY(locationIdx >= CommandBufferExecTrackedState::TRACKED_ATTRIB_COUNT
+ && locationIdx <= state.maxUntrackedInstancedAttribute))
+ {
+ f->glVertexAttribDivisor(GLuint(locationIdx), 0);
+ if (locationIdx < CommandBufferExecTrackedState::TRACKED_ATTRIB_COUNT)
+ state.nonzeroAttribDivisor[locationIdx] = false;
+ }
}
} else {
qWarning("No graphics pipeline active for setVertexInput; ignored");
@@ -2012,10 +3230,13 @@ void QRhiGles2::executeCommandBuffer(QRhiCommandBuffer *cb)
}
break;
case QGles2CommandBuffer::Command::BindIndexBuffer:
- indexType = cmd.args.bindIndexBuffer.type;
- indexStride = indexType == GL_UNSIGNED_SHORT ? sizeof(quint16) : sizeof(quint32);
- indexOffset = cmd.args.bindIndexBuffer.offset;
- f->glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, cmd.args.bindIndexBuffer.buffer);
+ state.indexType = cmd.args.bindIndexBuffer.type;
+ state.indexStride = state.indexType == GL_UNSIGNED_SHORT ? sizeof(quint16) : sizeof(quint32);
+ state.indexOffset = cmd.args.bindIndexBuffer.offset;
+ if (state.currentElementArrayBuffer != cmd.args.bindIndexBuffer.buffer) {
+ state.currentElementArrayBuffer = cmd.args.bindIndexBuffer.buffer;
+ f->glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, state.currentElementArrayBuffer);
+ }
break;
case QGles2CommandBuffer::Command::Draw:
{
@@ -2037,32 +3258,32 @@ void QRhiGles2::executeCommandBuffer(QRhiCommandBuffer *cb)
QGles2GraphicsPipeline *psD = QRHI_RES(QGles2GraphicsPipeline, cmd.args.drawIndexed.ps);
if (psD) {
const GLvoid *ofs = reinterpret_cast<const GLvoid *>(
- quintptr(cmd.args.drawIndexed.firstIndex * indexStride + indexOffset));
+ quintptr(cmd.args.drawIndexed.firstIndex * state.indexStride + state.indexOffset));
if (cmd.args.drawIndexed.instanceCount == 1 || !caps.instancing) {
if (cmd.args.drawIndexed.baseVertex != 0 && caps.baseVertex) {
f->glDrawElementsBaseVertex(psD->drawMode,
GLsizei(cmd.args.drawIndexed.indexCount),
- indexType,
+ state.indexType,
ofs,
cmd.args.drawIndexed.baseVertex);
} else {
f->glDrawElements(psD->drawMode,
GLsizei(cmd.args.drawIndexed.indexCount),
- indexType,
+ state.indexType,
ofs);
}
} else {
if (cmd.args.drawIndexed.baseVertex != 0 && caps.baseVertex) {
f->glDrawElementsInstancedBaseVertex(psD->drawMode,
GLsizei(cmd.args.drawIndexed.indexCount),
- indexType,
+ state.indexType,
ofs,
GLsizei(cmd.args.drawIndexed.instanceCount),
cmd.args.drawIndexed.baseVertex);
} else {
f->glDrawElementsInstanced(psD->drawMode,
GLsizei(cmd.args.drawIndexed.indexCount),
- indexType,
+ state.indexType,
ofs,
GLsizei(cmd.args.drawIndexed.instanceCount));
}
@@ -2073,38 +3294,43 @@ void QRhiGles2::executeCommandBuffer(QRhiCommandBuffer *cb)
}
break;
case QGles2CommandBuffer::Command::BindGraphicsPipeline:
- executeBindGraphicsPipeline(cmd.args.bindGraphicsPipeline.ps);
+ executeBindGraphicsPipeline(cbD, QRHI_RES(QGles2GraphicsPipeline, cmd.args.bindGraphicsPipeline.ps));
break;
case QGles2CommandBuffer::Command::BindShaderResources:
- bindShaderResources(cmd.args.bindShaderResources.maybeGraphicsPs,
+ bindShaderResources(cbD,
+ cmd.args.bindShaderResources.maybeGraphicsPs,
cmd.args.bindShaderResources.maybeComputePs,
cmd.args.bindShaderResources.srb,
cmd.args.bindShaderResources.dynamicOffsetPairs,
cmd.args.bindShaderResources.dynamicOffsetCount);
break;
case QGles2CommandBuffer::Command::BindFramebuffer:
+ {
+ QVarLengthArray<GLenum, 8> bufs;
if (cmd.args.bindFramebuffer.fbo) {
f->glBindFramebuffer(GL_FRAMEBUFFER, cmd.args.bindFramebuffer.fbo);
+ const int colorAttCount = cmd.args.bindFramebuffer.colorAttCount;
+ bufs.append(colorAttCount > 0 ? GL_COLOR_ATTACHMENT0 : GL_NONE);
if (caps.maxDrawBuffers > 1) {
- const int colorAttCount = cmd.args.bindFramebuffer.colorAttCount;
- QVarLengthArray<GLenum, 8> bufs;
- for (int i = 0; i < colorAttCount; ++i)
+ for (int i = 1; i < colorAttCount; ++i)
bufs.append(GL_COLOR_ATTACHMENT0 + uint(i));
- f->glDrawBuffers(colorAttCount, bufs.constData());
}
} else {
f->glBindFramebuffer(GL_FRAMEBUFFER, ctx->defaultFramebufferObject());
- if (caps.maxDrawBuffers > 1) {
- GLenum bufs = GL_BACK;
- f->glDrawBuffers(1, &bufs);
- }
+ if (cmd.args.bindFramebuffer.stereo && cmd.args.bindFramebuffer.stereoTarget == QRhiSwapChain::RightBuffer)
+ bufs.append(GL_BACK_RIGHT);
+ else
+ bufs.append(caps.gles ? GL_BACK : GL_BACK_LEFT);
}
- if (caps.srgbCapableDefaultFramebuffer) {
+ if (caps.hasDrawBuffersFunc)
+ f->glDrawBuffers(bufs.count(), bufs.constData());
+ if (caps.srgbWriteControl) {
if (cmd.args.bindFramebuffer.srgb)
f->glEnable(GL_FRAMEBUFFER_SRGB);
else
f->glDisable(GL_FRAMEBUFFER_SRGB);
}
+ }
break;
case QGles2CommandBuffer::Command::Clear:
f->glDisable(GL_SCISSOR_TEST);
@@ -2116,19 +3342,22 @@ void QRhiGles2::executeCommandBuffer(QRhiCommandBuffer *cb)
f->glDepthMask(GL_TRUE);
f->glClearDepthf(cmd.args.clear.d);
}
- if (cmd.args.clear.mask & GL_STENCIL_BUFFER_BIT)
+ if (cmd.args.clear.mask & GL_STENCIL_BUFFER_BIT) {
+ f->glStencilMask(0xFF);
f->glClearStencil(GLint(cmd.args.clear.s));
+ }
f->glClear(cmd.args.clear.mask);
+ cbD->graphicsPassState.reset(); // altered depth/color write, invalidate in order to avoid confusing the state tracking
break;
case QGles2CommandBuffer::Command::BufferSubData:
- f->glBindBuffer(cmd.args.bufferSubData.target, cmd.args.bufferSubData.buffer);
+ bindVertexIndexBufferWithStateReset(&state, f, cmd.args.bufferSubData.target, cmd.args.bufferSubData.buffer);
f->glBufferSubData(cmd.args.bufferSubData.target, cmd.args.bufferSubData.offset, cmd.args.bufferSubData.size,
cmd.args.bufferSubData.data);
break;
case QGles2CommandBuffer::Command::GetBufferSubData:
{
- QRhiBufferReadbackResult *result = cmd.args.getBufferSubData.result;
- f->glBindBuffer(cmd.args.getBufferSubData.target, cmd.args.getBufferSubData.buffer);
+ QRhiReadbackResult *result = cmd.args.getBufferSubData.result;
+ bindVertexIndexBufferWithStateReset(&state, f, cmd.args.getBufferSubData.target, cmd.args.getBufferSubData.buffer);
if (caps.gles) {
if (caps.properMapBuffer) {
void *p = f->glMapBufferRange(cmd.args.getBufferSubData.target,
@@ -2157,13 +3386,35 @@ void QRhiGles2::executeCommandBuffer(QRhiCommandBuffer *cb)
GLuint fbo;
f->glGenFramebuffers(1, &fbo);
f->glBindFramebuffer(GL_FRAMEBUFFER, fbo);
- f->glFramebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0,
- cmd.args.copyTex.srcFaceTarget, cmd.args.copyTex.srcTexture, cmd.args.copyTex.srcLevel);
+ if (cmd.args.copyTex.srcTarget == GL_TEXTURE_3D
+ || cmd.args.copyTex.srcTarget == GL_TEXTURE_2D_ARRAY
+ || cmd.args.copyTex.srcTarget == GL_TEXTURE_1D_ARRAY) {
+ f->glFramebufferTextureLayer(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, cmd.args.copyTex.srcTexture,
+ cmd.args.copyTex.srcLevel, cmd.args.copyTex.srcZ);
+ } else if (cmd.args.copyTex.srcTarget == GL_TEXTURE_1D) {
+ glFramebufferTexture1D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0,
+ cmd.args.copyTex.srcTarget, cmd.args.copyTex.srcTexture,
+ cmd.args.copyTex.srcLevel);
+ } else {
+ f->glFramebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0,
+ cmd.args.copyTex.srcFaceTarget, cmd.args.copyTex.srcTexture, cmd.args.copyTex.srcLevel);
+ }
f->glBindTexture(cmd.args.copyTex.dstTarget, cmd.args.copyTex.dstTexture);
- f->glCopyTexSubImage2D(cmd.args.copyTex.dstFaceTarget, cmd.args.copyTex.dstLevel,
- cmd.args.copyTex.dstX, cmd.args.copyTex.dstY,
- cmd.args.copyTex.srcX, cmd.args.copyTex.srcY,
- cmd.args.copyTex.w, cmd.args.copyTex.h);
+ if (cmd.args.copyTex.dstTarget == GL_TEXTURE_3D || cmd.args.copyTex.dstTarget == GL_TEXTURE_2D_ARRAY) {
+ f->glCopyTexSubImage3D(cmd.args.copyTex.dstTarget, cmd.args.copyTex.dstLevel,
+ cmd.args.copyTex.dstX, cmd.args.copyTex.dstY, cmd.args.copyTex.dstZ,
+ cmd.args.copyTex.srcX, cmd.args.copyTex.srcY,
+ cmd.args.copyTex.w, cmd.args.copyTex.h);
+ } else if (cmd.args.copyTex.dstTarget == GL_TEXTURE_1D) {
+ glCopyTexSubImage1D(cmd.args.copyTex.dstTarget, cmd.args.copyTex.dstLevel,
+ cmd.args.copyTex.dstX, cmd.args.copyTex.srcX,
+ cmd.args.copyTex.srcY, cmd.args.copyTex.w);
+ } else {
+ f->glCopyTexSubImage2D(cmd.args.copyTex.dstFaceTarget, cmd.args.copyTex.dstLevel,
+ cmd.args.copyTex.dstX, cmd.args.copyTex.dstY,
+ cmd.args.copyTex.srcX, cmd.args.copyTex.srcY,
+ cmd.args.copyTex.w, cmd.args.copyTex.h);
+ }
f->glBindFramebuffer(GL_FRAMEBUFFER, ctx->defaultFramebufferObject());
f->glDeleteFramebuffers(1, &fbo);
}
@@ -2181,21 +3432,77 @@ void QRhiGles2::executeCommandBuffer(QRhiCommandBuffer *cb)
if (mipLevel == 0 || caps.nonBaseLevelFramebufferTexture) {
f->glGenFramebuffers(1, &fbo);
f->glBindFramebuffer(GL_FRAMEBUFFER, fbo);
- f->glFramebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0,
- cmd.args.readPixels.readTarget, cmd.args.readPixels.texture, mipLevel);
+ if (cmd.args.readPixels.slice3D >= 0) {
+ f->glFramebufferTextureLayer(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0,
+ tex, mipLevel, cmd.args.readPixels.slice3D);
+ } else if (cmd.args.readPixels.readTarget == GL_TEXTURE_1D) {
+ glFramebufferTexture1D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0,
+ cmd.args.readPixels.readTarget, tex, mipLevel);
+ } else {
+ f->glFramebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0,
+ cmd.args.readPixels.readTarget, tex, mipLevel);
+ }
}
} else {
result->pixelSize = currentSwapChain->pixelSize;
result->format = QRhiTexture::RGBA8;
// readPixels handles multisample resolving implicitly
}
- result->data.resize(result->pixelSize.width() * result->pixelSize.height() * 4);
+ const int w = result->pixelSize.width();
+ const int h = result->pixelSize.height();
if (mipLevel == 0 || caps.nonBaseLevelFramebufferTexture) {
- // With GLES (2.0?) GL_RGBA is the only mandated readback format, so stick with it.
- f->glReadPixels(0, 0, result->pixelSize.width(), result->pixelSize.height(),
- GL_RGBA, GL_UNSIGNED_BYTE,
- result->data.data());
+ // With GLES, GL_RGBA is the only mandated readback format, so stick with it.
+ // (and that's why we return false for the ReadBackAnyTextureFormat feature)
+ if (result->format == QRhiTexture::R8 || result->format == QRhiTexture::RED_OR_ALPHA8) {
+ result->data.resize(w * h);
+ QByteArray tmpBuf;
+ tmpBuf.resize(w * h * 4);
+ f->glReadPixels(0, 0, w, h, GL_RGBA, GL_UNSIGNED_BYTE, tmpBuf.data());
+ const quint8 *srcBase = reinterpret_cast<const quint8 *>(tmpBuf.constData());
+ quint8 *dstBase = reinterpret_cast<quint8 *>(result->data.data());
+ const int componentIndex = isFeatureSupported(QRhi::RedOrAlpha8IsRed) ? 0 : 3;
+ for (int y = 0; y < h; ++y) {
+ const quint8 *src = srcBase + y * w * 4;
+ quint8 *dst = dstBase + y * w;
+ int count = w;
+ while (count-- > 0) {
+ *dst++ = src[componentIndex];
+ src += 4;
+ }
+ }
+ } else {
+ switch (result->format) {
+ // For floating point formats try it because this can be
+ // relevant for some use cases; if it works, then fine, if
+ // not, there's nothing we can do.
+ case QRhiTexture::RGBA16F:
+ result->data.resize(w * h * 8);
+ f->glReadPixels(0, 0, w, h, GL_RGBA, GL_HALF_FLOAT, result->data.data());
+ break;
+ case QRhiTexture::R16F:
+ result->data.resize(w * h * 2);
+ f->glReadPixels(0, 0, w, h, GL_RED, GL_HALF_FLOAT, result->data.data());
+ break;
+ case QRhiTexture::R32F:
+ result->data.resize(w * h * 4);
+ f->glReadPixels(0, 0, w, h, GL_RED, GL_FLOAT, result->data.data());
+ break;
+ case QRhiTexture::RGBA32F:
+ result->data.resize(w * h * 16);
+ f->glReadPixels(0, 0, w, h, GL_RGBA, GL_FLOAT, result->data.data());
+ break;
+ case QRhiTexture::RGB10A2:
+ result->data.resize(w * h * 4);
+ f->glReadPixels(0, 0, w, h, GL_RGBA, GL_UNSIGNED_INT_2_10_10_10_REV, result->data.data());
+ break;
+ default:
+ result->data.resize(w * h * 4);
+ f->glReadPixels(0, 0, w, h, GL_RGBA, GL_UNSIGNED_BYTE, result->data.data());
+ break;
+ }
+ }
} else {
+ result->data.resize(w * h * 4);
result->data.fill('\0');
}
if (fbo) {
@@ -2210,45 +3517,198 @@ void QRhiGles2::executeCommandBuffer(QRhiCommandBuffer *cb)
f->glBindTexture(cmd.args.subImage.target, cmd.args.subImage.texture);
if (cmd.args.subImage.rowStartAlign != 4)
f->glPixelStorei(GL_UNPACK_ALIGNMENT, cmd.args.subImage.rowStartAlign);
- f->glTexSubImage2D(cmd.args.subImage.faceTarget, cmd.args.subImage.level,
- cmd.args.subImage.dx, cmd.args.subImage.dy,
- cmd.args.subImage.w, cmd.args.subImage.h,
- cmd.args.subImage.glformat, cmd.args.subImage.gltype,
- cmd.args.subImage.data);
+ if (cmd.args.subImage.rowLength != 0)
+ f->glPixelStorei(GL_UNPACK_ROW_LENGTH, cmd.args.subImage.rowLength);
+ if (cmd.args.subImage.target == GL_TEXTURE_3D || cmd.args.subImage.target == GL_TEXTURE_2D_ARRAY) {
+ f->glTexSubImage3D(cmd.args.subImage.target, cmd.args.subImage.level,
+ cmd.args.subImage.dx, cmd.args.subImage.dy, cmd.args.subImage.dz,
+ cmd.args.subImage.w, cmd.args.subImage.h, 1,
+ cmd.args.subImage.glformat, cmd.args.subImage.gltype,
+ cmd.args.subImage.data);
+ } else if (cmd.args.subImage.target == GL_TEXTURE_1D) {
+ glTexSubImage1D(cmd.args.subImage.target, cmd.args.subImage.level,
+ cmd.args.subImage.dx, cmd.args.subImage.w,
+ cmd.args.subImage.glformat, cmd.args.subImage.gltype,
+ cmd.args.subImage.data);
+ } else {
+ f->glTexSubImage2D(cmd.args.subImage.faceTarget, cmd.args.subImage.level,
+ cmd.args.subImage.dx, cmd.args.subImage.dy,
+ cmd.args.subImage.w, cmd.args.subImage.h,
+ cmd.args.subImage.glformat, cmd.args.subImage.gltype,
+ cmd.args.subImage.data);
+ }
if (cmd.args.subImage.rowStartAlign != 4)
f->glPixelStorei(GL_UNPACK_ALIGNMENT, 4);
+ if (cmd.args.subImage.rowLength != 0)
+ f->glPixelStorei(GL_UNPACK_ROW_LENGTH, 0);
break;
case QGles2CommandBuffer::Command::CompressedImage:
f->glBindTexture(cmd.args.compressedImage.target, cmd.args.compressedImage.texture);
- f->glCompressedTexImage2D(cmd.args.compressedImage.faceTarget, cmd.args.compressedImage.level,
- cmd.args.compressedImage.glintformat,
- cmd.args.compressedImage.w, cmd.args.compressedImage.h, 0,
- cmd.args.compressedImage.size, cmd.args.compressedImage.data);
+ if (cmd.args.compressedImage.target == GL_TEXTURE_3D || cmd.args.compressedImage.target == GL_TEXTURE_2D_ARRAY) {
+ f->glCompressedTexImage3D(cmd.args.compressedImage.target, cmd.args.compressedImage.level,
+ cmd.args.compressedImage.glintformat,
+ cmd.args.compressedImage.w, cmd.args.compressedImage.h, cmd.args.compressedImage.depth,
+ 0, cmd.args.compressedImage.size, cmd.args.compressedImage.data);
+ } else if (cmd.args.compressedImage.target == GL_TEXTURE_1D) {
+ glCompressedTexImage1D(
+ cmd.args.compressedImage.target, cmd.args.compressedImage.level,
+ cmd.args.compressedImage.glintformat, cmd.args.compressedImage.w, 0,
+ cmd.args.compressedImage.size, cmd.args.compressedImage.data);
+ } else {
+ f->glCompressedTexImage2D(cmd.args.compressedImage.faceTarget, cmd.args.compressedImage.level,
+ cmd.args.compressedImage.glintformat,
+ cmd.args.compressedImage.w, cmd.args.compressedImage.h,
+ 0, cmd.args.compressedImage.size, cmd.args.compressedImage.data);
+ }
break;
case QGles2CommandBuffer::Command::CompressedSubImage:
f->glBindTexture(cmd.args.compressedSubImage.target, cmd.args.compressedSubImage.texture);
- f->glCompressedTexSubImage2D(cmd.args.compressedSubImage.faceTarget, cmd.args.compressedSubImage.level,
- cmd.args.compressedSubImage.dx, cmd.args.compressedSubImage.dy,
- cmd.args.compressedSubImage.w, cmd.args.compressedSubImage.h,
- cmd.args.compressedSubImage.glintformat,
- cmd.args.compressedSubImage.size, cmd.args.compressedSubImage.data);
+ if (cmd.args.compressedSubImage.target == GL_TEXTURE_3D || cmd.args.compressedSubImage.target == GL_TEXTURE_2D_ARRAY) {
+ f->glCompressedTexSubImage3D(cmd.args.compressedSubImage.target, cmd.args.compressedSubImage.level,
+ cmd.args.compressedSubImage.dx, cmd.args.compressedSubImage.dy, cmd.args.compressedSubImage.dz,
+ cmd.args.compressedSubImage.w, cmd.args.compressedSubImage.h, 1,
+ cmd.args.compressedSubImage.glintformat,
+ cmd.args.compressedSubImage.size, cmd.args.compressedSubImage.data);
+ } else if (cmd.args.compressedImage.target == GL_TEXTURE_1D) {
+ glCompressedTexSubImage1D(
+ cmd.args.compressedSubImage.target, cmd.args.compressedSubImage.level,
+ cmd.args.compressedSubImage.dx, cmd.args.compressedSubImage.w,
+ cmd.args.compressedSubImage.glintformat, cmd.args.compressedSubImage.size,
+ cmd.args.compressedSubImage.data);
+ } else {
+ f->glCompressedTexSubImage2D(cmd.args.compressedSubImage.faceTarget, cmd.args.compressedSubImage.level,
+ cmd.args.compressedSubImage.dx, cmd.args.compressedSubImage.dy,
+ cmd.args.compressedSubImage.w, cmd.args.compressedSubImage.h,
+ cmd.args.compressedSubImage.glintformat,
+ cmd.args.compressedSubImage.size, cmd.args.compressedSubImage.data);
+ }
break;
case QGles2CommandBuffer::Command::BlitFromRenderbuffer:
{
+ // Altering the scissor state, so reset the stored state, although
+ // not strictly required as long as blit is done in endPass() only.
+ cbD->graphicsPassState.reset();
+ f->glDisable(GL_SCISSOR_TEST);
GLuint fbo[2];
f->glGenFramebuffers(2, fbo);
f->glBindFramebuffer(GL_READ_FRAMEBUFFER, fbo[0]);
- f->glFramebufferRenderbuffer(GL_READ_FRAMEBUFFER, GL_COLOR_ATTACHMENT0,
- GL_RENDERBUFFER, cmd.args.blitFromRb.renderbuffer);
+ const bool ds = cmd.args.blitFromRenderbuffer.isDepthStencil;
+ if (ds) {
+ f->glFramebufferRenderbuffer(GL_READ_FRAMEBUFFER, GL_DEPTH_ATTACHMENT,
+ GL_RENDERBUFFER, cmd.args.blitFromRenderbuffer.renderbuffer);
+ f->glFramebufferRenderbuffer(GL_READ_FRAMEBUFFER, GL_STENCIL_ATTACHMENT,
+ GL_RENDERBUFFER, cmd.args.blitFromRenderbuffer.renderbuffer);
+ } else {
+ f->glFramebufferRenderbuffer(GL_READ_FRAMEBUFFER, GL_COLOR_ATTACHMENT0,
+ GL_RENDERBUFFER, cmd.args.blitFromRenderbuffer.renderbuffer);
+ }
f->glBindFramebuffer(GL_DRAW_FRAMEBUFFER, fbo[1]);
-
- f->glFramebufferTexture2D(GL_DRAW_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, cmd.args.blitFromRb.target,
- cmd.args.blitFromRb.texture, cmd.args.blitFromRb.dstLevel);
- f->glBlitFramebuffer(0, 0, cmd.args.blitFromRb.w, cmd.args.blitFromRb.h,
- 0, 0, cmd.args.blitFromRb.w, cmd.args.blitFromRb.h,
- GL_COLOR_BUFFER_BIT,
- GL_LINEAR);
+ if (cmd.args.blitFromRenderbuffer.target == GL_TEXTURE_3D || cmd.args.blitFromRenderbuffer.target == GL_TEXTURE_2D_ARRAY) {
+ if (ds) {
+ f->glFramebufferTextureLayer(GL_DRAW_FRAMEBUFFER, GL_DEPTH_ATTACHMENT,
+ cmd.args.blitFromRenderbuffer.dstTexture,
+ cmd.args.blitFromRenderbuffer.dstLevel,
+ cmd.args.blitFromRenderbuffer.dstLayer);
+ f->glFramebufferTextureLayer(GL_DRAW_FRAMEBUFFER, GL_STENCIL_ATTACHMENT,
+ cmd.args.blitFromRenderbuffer.dstTexture,
+ cmd.args.blitFromRenderbuffer.dstLevel,
+ cmd.args.blitFromRenderbuffer.dstLayer);
+ } else {
+ f->glFramebufferTextureLayer(GL_DRAW_FRAMEBUFFER, GL_COLOR_ATTACHMENT0,
+ cmd.args.blitFromRenderbuffer.dstTexture,
+ cmd.args.blitFromRenderbuffer.dstLevel,
+ cmd.args.blitFromRenderbuffer.dstLayer);
+ }
+ } else {
+ if (ds) {
+ f->glFramebufferTexture2D(GL_DRAW_FRAMEBUFFER, GL_DEPTH_ATTACHMENT, cmd.args.blitFromRenderbuffer.target,
+ cmd.args.blitFromRenderbuffer.dstTexture, cmd.args.blitFromRenderbuffer.dstLevel);
+ f->glFramebufferTexture2D(GL_DRAW_FRAMEBUFFER, GL_STENCIL_ATTACHMENT, cmd.args.blitFromRenderbuffer.target,
+ cmd.args.blitFromRenderbuffer.dstTexture, cmd.args.blitFromRenderbuffer.dstLevel);
+ } else {
+ f->glFramebufferTexture2D(GL_DRAW_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, cmd.args.blitFromRenderbuffer.target,
+ cmd.args.blitFromRenderbuffer.dstTexture, cmd.args.blitFromRenderbuffer.dstLevel);
+ }
+ }
+ f->glBlitFramebuffer(0, 0, cmd.args.blitFromRenderbuffer.w, cmd.args.blitFromRenderbuffer.h,
+ 0, 0, cmd.args.blitFromRenderbuffer.w, cmd.args.blitFromRenderbuffer.h,
+ ds ? GL_DEPTH_BUFFER_BIT | GL_STENCIL_BUFFER_BIT : GL_COLOR_BUFFER_BIT,
+ GL_NEAREST); // Qt 5 used Nearest when resolving samples, stick to that
f->glBindFramebuffer(GL_FRAMEBUFFER, ctx->defaultFramebufferObject());
+ f->glDeleteFramebuffers(2, fbo);
+ }
+ break;
+ case QGles2CommandBuffer::Command::BlitFromTexture:
+ {
+ // Altering the scissor state, so reset the stored state, although
+ // not strictly required as long as blit is done in endPass() only.
+ cbD->graphicsPassState.reset();
+ f->glDisable(GL_SCISSOR_TEST);
+ GLuint fbo[2];
+ f->glGenFramebuffers(2, fbo);
+ f->glBindFramebuffer(GL_READ_FRAMEBUFFER, fbo[0]);
+ const bool ds = cmd.args.blitFromTexture.isDepthStencil;
+ if (cmd.args.blitFromTexture.srcTarget == GL_TEXTURE_2D_MULTISAMPLE_ARRAY) {
+ if (ds) {
+ f->glFramebufferTextureLayer(GL_READ_FRAMEBUFFER, GL_DEPTH_ATTACHMENT,
+ cmd.args.blitFromTexture.srcTexture,
+ cmd.args.blitFromTexture.srcLevel,
+ cmd.args.blitFromTexture.srcLayer);
+ f->glFramebufferTextureLayer(GL_READ_FRAMEBUFFER, GL_STENCIL_ATTACHMENT,
+ cmd.args.blitFromTexture.srcTexture,
+ cmd.args.blitFromTexture.srcLevel,
+ cmd.args.blitFromTexture.srcLayer);
+ } else {
+ f->glFramebufferTextureLayer(GL_READ_FRAMEBUFFER, GL_COLOR_ATTACHMENT0,
+ cmd.args.blitFromTexture.srcTexture,
+ cmd.args.blitFromTexture.srcLevel,
+ cmd.args.blitFromTexture.srcLayer);
+ }
+ } else {
+ if (ds) {
+ f->glFramebufferTexture2D(GL_READ_FRAMEBUFFER, GL_DEPTH_ATTACHMENT, cmd.args.blitFromTexture.srcTarget,
+ cmd.args.blitFromTexture.srcTexture, cmd.args.blitFromTexture.srcLevel);
+ f->glFramebufferTexture2D(GL_READ_FRAMEBUFFER, GL_STENCIL_ATTACHMENT, cmd.args.blitFromTexture.srcTarget,
+ cmd.args.blitFromTexture.srcTexture, cmd.args.blitFromTexture.srcLevel);
+ } else {
+ f->glFramebufferTexture2D(GL_READ_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, cmd.args.blitFromTexture.srcTarget,
+ cmd.args.blitFromTexture.srcTexture, cmd.args.blitFromTexture.srcLevel);
+ }
+ }
+ f->glBindFramebuffer(GL_DRAW_FRAMEBUFFER, fbo[1]);
+ if (cmd.args.blitFromTexture.dstTarget == GL_TEXTURE_3D || cmd.args.blitFromTexture.dstTarget == GL_TEXTURE_2D_ARRAY) {
+ if (ds) {
+ f->glFramebufferTextureLayer(GL_DRAW_FRAMEBUFFER, GL_DEPTH_ATTACHMENT,
+ cmd.args.blitFromTexture.dstTexture,
+ cmd.args.blitFromTexture.dstLevel,
+ cmd.args.blitFromTexture.dstLayer);
+ f->glFramebufferTextureLayer(GL_DRAW_FRAMEBUFFER, GL_STENCIL_ATTACHMENT,
+ cmd.args.blitFromTexture.dstTexture,
+ cmd.args.blitFromTexture.dstLevel,
+ cmd.args.blitFromTexture.dstLayer);
+ } else {
+ f->glFramebufferTextureLayer(GL_DRAW_FRAMEBUFFER, GL_COLOR_ATTACHMENT0,
+ cmd.args.blitFromTexture.dstTexture,
+ cmd.args.blitFromTexture.dstLevel,
+ cmd.args.blitFromTexture.dstLayer);
+ }
+ } else {
+ if (ds) {
+ f->glFramebufferTexture2D(GL_DRAW_FRAMEBUFFER, GL_DEPTH_ATTACHMENT, cmd.args.blitFromTexture.dstTarget,
+ cmd.args.blitFromTexture.dstTexture, cmd.args.blitFromTexture.dstLevel);
+ f->glFramebufferTexture2D(GL_DRAW_FRAMEBUFFER, GL_STENCIL_ATTACHMENT, cmd.args.blitFromTexture.dstTarget,
+ cmd.args.blitFromTexture.dstTexture, cmd.args.blitFromTexture.dstLevel);
+ } else {
+ f->glFramebufferTexture2D(GL_DRAW_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, cmd.args.blitFromTexture.dstTarget,
+ cmd.args.blitFromTexture.dstTexture, cmd.args.blitFromTexture.dstLevel);
+ }
+ }
+ f->glBlitFramebuffer(0, 0, cmd.args.blitFromTexture.w, cmd.args.blitFromTexture.h,
+ 0, 0, cmd.args.blitFromTexture.w, cmd.args.blitFromTexture.h,
+ ds ? GL_DEPTH_BUFFER_BIT | GL_STENCIL_BUFFER_BIT : GL_COLOR_BUFFER_BIT,
+ GL_NEAREST); // Qt 5 used Nearest when resolving samples, stick to that
+ f->glBindFramebuffer(GL_FRAMEBUFFER, ctx->defaultFramebufferObject());
+ f->glDeleteFramebuffers(2, fbo);
}
break;
case QGles2CommandBuffer::Command::GenMip:
@@ -2266,6 +3726,8 @@ void QRhiGles2::executeCommandBuffer(QRhiCommandBuffer *cb)
break;
case QGles2CommandBuffer::Command::BarriersForPass:
{
+ if (!caps.compute)
+ break;
GLbitfield barriers = 0;
QRhiPassResourceTracker &tracker(cbD->passResTrackers[cmd.args.barriersForPass.trackerIndex]);
// we only care about after-write, not any other accesses, and
@@ -2277,181 +3739,543 @@ void QRhiGles2::executeCommandBuffer(QRhiCommandBuffer *cb)
// subsequent pass.
for (auto it = tracker.cbeginBuffers(), itEnd = tracker.cendBuffers(); it != itEnd; ++it) {
QGles2Buffer::Access accessBeforePass = QGles2Buffer::Access(it->stateAtPassBegin.access);
- if (accessBeforePass == QGles2Buffer::AccessStorageWrite
- || accessBeforePass == QGles2Buffer::AccessStorageReadWrite)
- {
- barriers |= GL_ALL_BARRIER_BITS;
- }
+ if (bufferAccessIsWrite(accessBeforePass))
+ barriers |= barriersForBuffer();
}
for (auto it = tracker.cbeginTextures(), itEnd = tracker.cendTextures(); it != itEnd; ++it) {
QGles2Texture::Access accessBeforePass = QGles2Texture::Access(it->stateAtPassBegin.access);
- if (accessBeforePass == QGles2Texture::AccessStorageWrite
- || accessBeforePass == QGles2Texture::AccessStorageReadWrite)
- {
- barriers |= GL_ALL_BARRIER_BITS;
- }
+ if (textureAccessIsWrite(accessBeforePass))
+ barriers |= barriersForTexture();
}
if (barriers)
f->glMemoryBarrier(barriers);
}
break;
case QGles2CommandBuffer::Command::Barrier:
- f->glMemoryBarrier(cmd.args.barrier.barriers);
+ if (caps.compute)
+ f->glMemoryBarrier(cmd.args.barrier.barriers);
+ break;
+ case QGles2CommandBuffer::Command::InvalidateFramebuffer:
+ if (caps.gles && caps.ctxMajor >= 3) {
+ f->glInvalidateFramebuffer(GL_DRAW_FRAMEBUFFER,
+ cmd.args.invalidateFramebuffer.attCount,
+ cmd.args.invalidateFramebuffer.att);
+ }
break;
default:
break;
}
}
+ if (state.instancedAttributesUsed) {
+ for (int i = 0; i < CommandBufferExecTrackedState::TRACKED_ATTRIB_COUNT; ++i) {
+ if (state.nonzeroAttribDivisor[i])
+ f->glVertexAttribDivisor(GLuint(i), 0);
+ }
+ for (int i = CommandBufferExecTrackedState::TRACKED_ATTRIB_COUNT; i <= state.maxUntrackedInstancedAttribute; ++i)
+ f->glVertexAttribDivisor(GLuint(i), 0);
+ }
}
-void QRhiGles2::executeBindGraphicsPipeline(QRhiGraphicsPipeline *ps)
+void QRhiGles2::executeBindGraphicsPipeline(QGles2CommandBuffer *cbD, QGles2GraphicsPipeline *psD)
{
- QGles2GraphicsPipeline *psD = QRHI_RES(QGles2GraphicsPipeline, ps);
+ QGles2CommandBuffer::GraphicsPassState &state(cbD->graphicsPassState);
+ const bool forceUpdate = !state.valid;
+ state.valid = true;
- // No state tracking logic as of now. Could introduce something to reduce
- // the number of gl* calls (when using and changing between multiple
- // pipelines), but then begin/endExternal() should invalidate the cached
- // state as appropriate.
+ const bool scissor = psD->m_flags.testFlag(QRhiGraphicsPipeline::UsesScissor);
+ if (forceUpdate || scissor != state.scissor) {
+ state.scissor = scissor;
+ if (scissor)
+ f->glEnable(GL_SCISSOR_TEST);
+ else
+ f->glDisable(GL_SCISSOR_TEST);
+ }
- if (psD->m_flags.testFlag(QRhiGraphicsPipeline::UsesScissor))
- f->glEnable(GL_SCISSOR_TEST);
- else
- f->glDisable(GL_SCISSOR_TEST);
- if (psD->m_cullMode == QRhiGraphicsPipeline::None) {
- f->glDisable(GL_CULL_FACE);
- } else {
- f->glEnable(GL_CULL_FACE);
- f->glCullFace(toGlCullMode(psD->m_cullMode));
+ const bool cullFace = psD->m_cullMode != QRhiGraphicsPipeline::None;
+ const GLenum cullMode = cullFace ? toGlCullMode(psD->m_cullMode) : GL_NONE;
+ if (forceUpdate || cullFace != state.cullFace || cullMode != state.cullMode) {
+ state.cullFace = cullFace;
+ state.cullMode = cullMode;
+ if (cullFace) {
+ f->glEnable(GL_CULL_FACE);
+ f->glCullFace(cullMode);
+ } else {
+ f->glDisable(GL_CULL_FACE);
+ }
+ }
+
+ const GLenum frontFace = toGlFrontFace(psD->m_frontFace);
+ if (forceUpdate || frontFace != state.frontFace) {
+ state.frontFace = frontFace;
+ f->glFrontFace(frontFace);
}
- f->glFrontFace(toGlFrontFace(psD->m_frontFace));
+
+ const GLenum polygonMode = toGlPolygonMode(psD->m_polygonMode);
+ if (glPolygonMode && (forceUpdate || polygonMode != state.polygonMode)) {
+ state.polygonMode = polygonMode;
+ glPolygonMode(GL_FRONT_AND_BACK, polygonMode);
+ }
+
if (!psD->m_targetBlends.isEmpty()) {
- const QRhiGraphicsPipeline::TargetBlend &blend(psD->m_targetBlends.first()); // no MRT
- GLboolean wr = blend.colorWrite.testFlag(QRhiGraphicsPipeline::R);
- GLboolean wg = blend.colorWrite.testFlag(QRhiGraphicsPipeline::G);
- GLboolean wb = blend.colorWrite.testFlag(QRhiGraphicsPipeline::B);
- GLboolean wa = blend.colorWrite.testFlag(QRhiGraphicsPipeline::A);
- f->glColorMask(wr, wg, wb, wa);
- if (blend.enable) {
- f->glEnable(GL_BLEND);
- f->glBlendFuncSeparate(toGlBlendFactor(blend.srcColor),
- toGlBlendFactor(blend.dstColor),
- toGlBlendFactor(blend.srcAlpha),
- toGlBlendFactor(blend.dstAlpha));
- f->glBlendEquationSeparate(toGlBlendOp(blend.opColor), toGlBlendOp(blend.opAlpha));
- } else {
- f->glDisable(GL_BLEND);
+ // We do not have MRT support here, meaning all targets use the blend
+ // params from the first one. This is technically incorrect, even if
+ // nothing in Qt relies on it. However, considering that
+ // glBlendFuncSeparatei is only available in GL 4.0+ and GLES 3.2+, we
+ // may just live with this for now because no point in bothering if it
+ // won't be usable on many GLES (3.1 or 3.0) systems.
+ const QRhiGraphicsPipeline::TargetBlend &targetBlend(psD->m_targetBlends.first());
+
+ const QGles2CommandBuffer::GraphicsPassState::ColorMask colorMask = {
+ targetBlend.colorWrite.testFlag(QRhiGraphicsPipeline::R),
+ targetBlend.colorWrite.testFlag(QRhiGraphicsPipeline::G),
+ targetBlend.colorWrite.testFlag(QRhiGraphicsPipeline::B),
+ targetBlend.colorWrite.testFlag(QRhiGraphicsPipeline::A)
+ };
+ if (forceUpdate || colorMask != state.colorMask) {
+ state.colorMask = colorMask;
+ f->glColorMask(colorMask.r, colorMask.g, colorMask.b, colorMask.a);
+ }
+
+ const bool blendEnabled = targetBlend.enable;
+ const QGles2CommandBuffer::GraphicsPassState::Blend blend = {
+ toGlBlendFactor(targetBlend.srcColor),
+ toGlBlendFactor(targetBlend.dstColor),
+ toGlBlendFactor(targetBlend.srcAlpha),
+ toGlBlendFactor(targetBlend.dstAlpha),
+ toGlBlendOp(targetBlend.opColor),
+ toGlBlendOp(targetBlend.opAlpha)
+ };
+ if (forceUpdate || blendEnabled != state.blendEnabled || (blendEnabled && blend != state.blend)) {
+ state.blendEnabled = blendEnabled;
+ if (blendEnabled) {
+ state.blend = blend;
+ f->glEnable(GL_BLEND);
+ f->glBlendFuncSeparate(blend.srcColor, blend.dstColor, blend.srcAlpha, blend.dstAlpha);
+ f->glBlendEquationSeparate(blend.opColor, blend.opAlpha);
+ } else {
+ f->glDisable(GL_BLEND);
+ }
}
} else {
- f->glDisable(GL_BLEND);
- f->glColorMask(GL_TRUE, GL_TRUE, GL_TRUE, GL_TRUE);
+ const QGles2CommandBuffer::GraphicsPassState::ColorMask colorMask = { true, true, true, true };
+ if (forceUpdate || colorMask != state.colorMask) {
+ state.colorMask = colorMask;
+ f->glColorMask(GL_TRUE, GL_TRUE, GL_TRUE, GL_TRUE);
+ }
+ const bool blendEnabled = false;
+ if (forceUpdate || blendEnabled != state.blendEnabled) {
+ state.blendEnabled = blendEnabled;
+ f->glDisable(GL_BLEND);
+ }
}
- if (psD->m_depthTest)
- f->glEnable(GL_DEPTH_TEST);
- else
- f->glDisable(GL_DEPTH_TEST);
- if (psD->m_depthWrite)
- f->glDepthMask(GL_TRUE);
- else
- f->glDepthMask(GL_FALSE);
- f->glDepthFunc(toGlCompareOp(psD->m_depthOp));
- if (psD->m_stencilTest) {
- f->glEnable(GL_STENCIL_TEST);
- f->glStencilFuncSeparate(GL_FRONT, toGlCompareOp(psD->m_stencilFront.compareOp), 0, psD->m_stencilReadMask);
- f->glStencilOpSeparate(GL_FRONT,
- toGlStencilOp(psD->m_stencilFront.failOp),
- toGlStencilOp(psD->m_stencilFront.depthFailOp),
- toGlStencilOp(psD->m_stencilFront.passOp));
- f->glStencilMaskSeparate(GL_FRONT, psD->m_stencilWriteMask);
- f->glStencilFuncSeparate(GL_BACK, toGlCompareOp(psD->m_stencilBack.compareOp), 0, psD->m_stencilReadMask);
- f->glStencilOpSeparate(GL_BACK,
- toGlStencilOp(psD->m_stencilBack.failOp),
- toGlStencilOp(psD->m_stencilBack.depthFailOp),
- toGlStencilOp(psD->m_stencilBack.passOp));
- f->glStencilMaskSeparate(GL_BACK, psD->m_stencilWriteMask);
- } else {
- f->glDisable(GL_STENCIL_TEST);
+
+ const bool depthTest = psD->m_depthTest;
+ if (forceUpdate || depthTest != state.depthTest) {
+ state.depthTest = depthTest;
+ if (depthTest)
+ f->glEnable(GL_DEPTH_TEST);
+ else
+ f->glDisable(GL_DEPTH_TEST);
+ }
+
+ const bool depthWrite = psD->m_depthWrite;
+ if (forceUpdate || depthWrite != state.depthWrite) {
+ state.depthWrite = depthWrite;
+ f->glDepthMask(depthWrite);
}
- if (psD->topology() == QRhiGraphicsPipeline::Lines || psD->topology() == QRhiGraphicsPipeline::LineStrip)
- f->glLineWidth(psD->m_lineWidth);
+ const GLenum depthFunc = toGlCompareOp(psD->m_depthOp);
+ if (forceUpdate || depthFunc != state.depthFunc) {
+ state.depthFunc = depthFunc;
+ f->glDepthFunc(depthFunc);
+ }
+
+ const bool stencilTest = psD->m_stencilTest;
+ const GLuint stencilReadMask = psD->m_stencilReadMask;
+ const GLuint stencilWriteMask = psD->m_stencilWriteMask;
+ const QGles2CommandBuffer::GraphicsPassState::StencilFace stencilFront = {
+ toGlCompareOp(psD->m_stencilFront.compareOp),
+ toGlStencilOp(psD->m_stencilFront.failOp),
+ toGlStencilOp(psD->m_stencilFront.depthFailOp),
+ toGlStencilOp(psD->m_stencilFront.passOp)
+ };
+ const QGles2CommandBuffer::GraphicsPassState::StencilFace stencilBack = {
+ toGlCompareOp(psD->m_stencilBack.compareOp),
+ toGlStencilOp(psD->m_stencilBack.failOp),
+ toGlStencilOp(psD->m_stencilBack.depthFailOp),
+ toGlStencilOp(psD->m_stencilBack.passOp)
+ };
+ if (forceUpdate || stencilTest != state.stencilTest
+ || (stencilTest
+ && (stencilReadMask != state.stencilReadMask || stencilWriteMask != state.stencilWriteMask
+ || stencilFront != state.stencil[0] || stencilBack != state.stencil[1])))
+ {
+ state.stencilTest = stencilTest;
+ if (stencilTest) {
+ state.stencilReadMask = stencilReadMask;
+ state.stencilWriteMask = stencilWriteMask;
+ state.stencil[0] = stencilFront;
+ state.stencil[1] = stencilBack;
+
+ f->glEnable(GL_STENCIL_TEST);
+
+ f->glStencilFuncSeparate(GL_FRONT, stencilFront.func, state.dynamic.stencilRef, stencilReadMask);
+ f->glStencilOpSeparate(GL_FRONT, stencilFront.failOp, stencilFront.zfailOp, stencilFront.zpassOp);
+ f->glStencilMaskSeparate(GL_FRONT, stencilWriteMask);
+
+ f->glStencilFuncSeparate(GL_BACK, stencilBack.func, state.dynamic.stencilRef, stencilReadMask);
+ f->glStencilOpSeparate(GL_BACK, stencilBack.failOp, stencilBack.zfailOp, stencilBack.zpassOp);
+ f->glStencilMaskSeparate(GL_BACK, stencilWriteMask);
+ } else {
+ f->glDisable(GL_STENCIL_TEST);
+ }
+ }
+
+ const bool polyOffsetFill = psD->m_depthBias != 0 || !qFuzzyIsNull(psD->m_slopeScaledDepthBias);
+ const float polyOffsetFactor = psD->m_slopeScaledDepthBias;
+ const float polyOffsetUnits = psD->m_depthBias;
+ if (forceUpdate || state.polyOffsetFill != polyOffsetFill
+ || polyOffsetFactor != state.polyOffsetFactor || polyOffsetUnits != state.polyOffsetUnits)
+ {
+ state.polyOffsetFill = polyOffsetFill;
+ state.polyOffsetFactor = polyOffsetFactor;
+ state.polyOffsetUnits = polyOffsetUnits;
+ if (polyOffsetFill) {
+ f->glPolygonOffset(polyOffsetFactor, polyOffsetUnits);
+ f->glEnable(GL_POLYGON_OFFSET_FILL);
+ } else {
+ f->glDisable(GL_POLYGON_OFFSET_FILL);
+ }
+ }
+
+ if (psD->m_topology == QRhiGraphicsPipeline::Lines || psD->m_topology == QRhiGraphicsPipeline::LineStrip) {
+ const float lineWidth = psD->m_lineWidth;
+ if (forceUpdate || lineWidth != state.lineWidth) {
+ state.lineWidth = lineWidth;
+ f->glLineWidth(lineWidth);
+ }
+ }
+
+ if (psD->m_topology == QRhiGraphicsPipeline::Patches) {
+ const int cpCount = psD->m_patchControlPointCount;
+ if (forceUpdate || cpCount != state.cpCount) {
+ state.cpCount = cpCount;
+ f->glPatchParameteri(GL_PATCH_VERTICES, qMax(1, cpCount));
+ }
+ }
f->glUseProgram(psD->program);
}
-void QRhiGles2::bindShaderResources(QRhiGraphicsPipeline *maybeGraphicsPs, QRhiComputePipeline *maybeComputePs,
+template <typename T>
+static inline void qrhi_std140_to_packed(T *dst, int vecSize, int elemCount, const void *src)
+{
+ const T *p = reinterpret_cast<const T *>(src);
+ for (int i = 0; i < elemCount; ++i) {
+ for (int j = 0; j < vecSize; ++j)
+ dst[vecSize * i + j] = *p++;
+ p += 4 - vecSize;
+ }
+}
+
+void QRhiGles2::bindCombinedSampler(QGles2CommandBuffer *cbD, QGles2Texture *texD, QGles2Sampler *samplerD,
+ void *ps, uint psGeneration, int glslLocation,
+ int *texUnit, bool *activeTexUnitAltered)
+{
+ const bool samplerStateValid = texD->samplerState == samplerD->d;
+ const bool cachedStateInRange = *texUnit < 16;
+ bool updateTextureBinding = true;
+ if (samplerStateValid && cachedStateInRange) {
+ // If we already encountered the same texture with
+ // the same pipeline for this texture unit in the
+ // current pass, then the shader program already
+ // has the uniform set. As in a 3D scene one model
+ // often has more than one associated texture map,
+ // the savings here can become significant,
+ // depending on the scene.
+ if (cbD->textureUnitState[*texUnit].ps == ps
+ && cbD->textureUnitState[*texUnit].psGeneration == psGeneration
+ && cbD->textureUnitState[*texUnit].texture == texD->texture)
+ {
+ updateTextureBinding = false;
+ }
+ }
+ if (updateTextureBinding) {
+ f->glActiveTexture(GL_TEXTURE0 + uint(*texUnit));
+ *activeTexUnitAltered = true;
+ f->glBindTexture(texD->target, texD->texture);
+ f->glUniform1i(glslLocation, *texUnit);
+ if (cachedStateInRange) {
+ cbD->textureUnitState[*texUnit].ps = ps;
+ cbD->textureUnitState[*texUnit].psGeneration = psGeneration;
+ cbD->textureUnitState[*texUnit].texture = texD->texture;
+ }
+ }
+ ++(*texUnit);
+ if (!samplerStateValid) {
+ f->glTexParameteri(texD->target, GL_TEXTURE_MIN_FILTER, GLint(samplerD->d.glminfilter));
+ f->glTexParameteri(texD->target, GL_TEXTURE_MAG_FILTER, GLint(samplerD->d.glmagfilter));
+ f->glTexParameteri(texD->target, GL_TEXTURE_WRAP_S, GLint(samplerD->d.glwraps));
+ f->glTexParameteri(texD->target, GL_TEXTURE_WRAP_T, GLint(samplerD->d.glwrapt));
+ if (caps.texture3D)
+ f->glTexParameteri(texD->target, GL_TEXTURE_WRAP_R, GLint(samplerD->d.glwrapr));
+ if (caps.textureCompareMode) {
+ if (samplerD->d.gltexcomparefunc != GL_NEVER) {
+ f->glTexParameteri(texD->target, GL_TEXTURE_COMPARE_MODE, GL_COMPARE_REF_TO_TEXTURE);
+ f->glTexParameteri(texD->target, GL_TEXTURE_COMPARE_FUNC, GLint(samplerD->d.gltexcomparefunc));
+ } else {
+ f->glTexParameteri(texD->target, GL_TEXTURE_COMPARE_MODE, GL_NONE);
+ }
+ }
+ texD->samplerState = samplerD->d;
+ }
+}
+
+void QRhiGles2::bindShaderResources(QGles2CommandBuffer *cbD,
+ QRhiGraphicsPipeline *maybeGraphicsPs, QRhiComputePipeline *maybeComputePs,
QRhiShaderResourceBindings *srb,
const uint *dynOfsPairs, int dynOfsCount)
{
QGles2ShaderResourceBindings *srbD = QRHI_RES(QGles2ShaderResourceBindings, srb);
- int texUnit = 0;
-
- for (int i = 0, ie = srbD->m_bindings.count(); i != ie; ++i) {
- const QRhiShaderResourceBinding::Data *b = srbD->m_bindings.at(i).data();
+ int texUnit = 1; // start from unit 1, keep 0 for resource mgmt stuff to avoid clashes
+ bool activeTexUnitAltered = false;
+ union data32_t {
+ float f;
+ qint32 i;
+ };
+ QVarLengthArray<data32_t, 256> packedArray;
+ QGles2UniformDescriptionVector &uniforms(maybeGraphicsPs ? QRHI_RES(QGles2GraphicsPipeline, maybeGraphicsPs)->uniforms
+ : QRHI_RES(QGles2ComputePipeline, maybeComputePs)->uniforms);
+ QGles2UniformState *uniformState = maybeGraphicsPs ? QRHI_RES(QGles2GraphicsPipeline, maybeGraphicsPs)->uniformState
+ : QRHI_RES(QGles2ComputePipeline, maybeComputePs)->uniformState;
+ struct SeparateTexture {
+ QGles2Texture *texture;
+ int binding;
+ int elem;
+ };
+ QVarLengthArray<SeparateTexture, 8> separateTextureBindings;
+ struct SeparateSampler {
+ QGles2Sampler *sampler;
+ int binding;
+ };
+ QVarLengthArray<SeparateSampler, 4> separateSamplerBindings;
+
+ for (int i = 0, ie = srbD->m_bindings.size(); i != ie; ++i) {
+ const QRhiShaderResourceBinding::Data *b = shaderResourceBindingData(srbD->m_bindings.at(i));
switch (b->type) {
case QRhiShaderResourceBinding::UniformBuffer:
{
int viewOffset = b->u.ubuf.offset;
- if (dynOfsCount) {
- for (int j = 0; j < dynOfsCount; ++j) {
- if (dynOfsPairs[2 * j] == uint(b->binding)) {
- viewOffset = int(dynOfsPairs[2 * j + 1]);
- break;
- }
+ for (int j = 0; j < dynOfsCount; ++j) {
+ if (dynOfsPairs[2 * j] == uint(b->binding)) {
+ viewOffset = int(dynOfsPairs[2 * j + 1]);
+ break;
}
}
QGles2Buffer *bufD = QRHI_RES(QGles2Buffer, b->u.ubuf.buf);
- const QByteArray bufView = QByteArray::fromRawData(bufD->ubuf.constData() + viewOffset,
- b->u.ubuf.maybeSize ? b->u.ubuf.maybeSize : bufD->m_size);
- QVector<QGles2UniformDescription> &uniforms(maybeGraphicsPs ? QRHI_RES(QGles2GraphicsPipeline, maybeGraphicsPs)->uniforms
- : QRHI_RES(QGles2ComputePipeline, maybeComputePs)->uniforms);
- for (QGles2UniformDescription &uniform : uniforms) {
+ const char *bufView = bufD->data.constData() + viewOffset;
+ for (const QGles2UniformDescription &uniform : std::as_const(uniforms)) {
if (uniform.binding == b->binding) {
// in a uniform buffer everything is at least 4 byte aligned
// so this should not cause unaligned reads
- const void *src = bufView.constData() + uniform.offset;
+ const void *src = bufView + uniform.offset;
+
+#ifndef QT_NO_DEBUG
+ if (uniform.arrayDim > 0
+ && uniform.type != QShaderDescription::Float
+ && uniform.type != QShaderDescription::Vec2
+ && uniform.type != QShaderDescription::Vec3
+ && uniform.type != QShaderDescription::Vec4
+ && uniform.type != QShaderDescription::Int
+ && uniform.type != QShaderDescription::Int2
+ && uniform.type != QShaderDescription::Int3
+ && uniform.type != QShaderDescription::Int4
+ && uniform.type != QShaderDescription::Mat3
+ && uniform.type != QShaderDescription::Mat4)
+ {
+ qWarning("Uniform with buffer binding %d, buffer offset %d, type %d is an array, "
+ "but arrays are only supported for float, vec2, vec3, vec4, int, "
+ "ivec2, ivec3, ivec4, mat3 and mat4. "
+ "Only the first element will be set.",
+ uniform.binding, uniform.offset, uniform.type);
+ }
+#endif
+
+ // Our input is an std140 layout uniform block. See
+ // "Standard Uniform Block Layout" in section 7.6.2.2 of
+ // the OpenGL spec. This has some peculiar alignment
+ // requirements, which is not what glUniform* wants. Hence
+ // the unpacking/repacking for arrays and certain types.
switch (uniform.type) {
case QShaderDescription::Float:
- f->glUniform1f(uniform.glslLocation, *reinterpret_cast<const float *>(src));
+ {
+ const int elemCount = uniform.arrayDim;
+ if (elemCount < 1) {
+ const float v = *reinterpret_cast<const float *>(src);
+ if (uniform.glslLocation <= QGles2UniformState::MAX_TRACKED_LOCATION) {
+ QGles2UniformState &thisUniformState(uniformState[uniform.glslLocation]);
+ if (thisUniformState.componentCount != 1 || thisUniformState.v[0] != v) {
+ thisUniformState.componentCount = 1;
+ thisUniformState.v[0] = v;
+ f->glUniform1f(uniform.glslLocation, v);
+ }
+ } else {
+ f->glUniform1f(uniform.glslLocation, v);
+ }
+ } else {
+ // input is 16 bytes per element as per std140, have to convert to packed
+ packedArray.resize(elemCount);
+ qrhi_std140_to_packed(&packedArray.data()->f, 1, elemCount, src);
+ f->glUniform1fv(uniform.glslLocation, elemCount, &packedArray.constData()->f);
+ }
+ }
break;
case QShaderDescription::Vec2:
- f->glUniform2fv(uniform.glslLocation, 1, reinterpret_cast<const float *>(src));
+ {
+ const int elemCount = uniform.arrayDim;
+ if (elemCount < 1) {
+ const float *v = reinterpret_cast<const float *>(src);
+ if (uniform.glslLocation <= QGles2UniformState::MAX_TRACKED_LOCATION) {
+ QGles2UniformState &thisUniformState(uniformState[uniform.glslLocation]);
+ if (thisUniformState.componentCount != 2
+ || thisUniformState.v[0] != v[0]
+ || thisUniformState.v[1] != v[1])
+ {
+ thisUniformState.componentCount = 2;
+ thisUniformState.v[0] = v[0];
+ thisUniformState.v[1] = v[1];
+ f->glUniform2fv(uniform.glslLocation, 1, v);
+ }
+ } else {
+ f->glUniform2fv(uniform.glslLocation, 1, v);
+ }
+ } else {
+ packedArray.resize(elemCount * 2);
+ qrhi_std140_to_packed(&packedArray.data()->f, 2, elemCount, src);
+ f->glUniform2fv(uniform.glslLocation, elemCount, &packedArray.constData()->f);
+ }
+ }
break;
case QShaderDescription::Vec3:
- f->glUniform3fv(uniform.glslLocation, 1, reinterpret_cast<const float *>(src));
+ {
+ const int elemCount = uniform.arrayDim;
+ if (elemCount < 1) {
+ const float *v = reinterpret_cast<const float *>(src);
+ if (uniform.glslLocation <= QGles2UniformState::MAX_TRACKED_LOCATION) {
+ QGles2UniformState &thisUniformState(uniformState[uniform.glslLocation]);
+ if (thisUniformState.componentCount != 3
+ || thisUniformState.v[0] != v[0]
+ || thisUniformState.v[1] != v[1]
+ || thisUniformState.v[2] != v[2])
+ {
+ thisUniformState.componentCount = 3;
+ thisUniformState.v[0] = v[0];
+ thisUniformState.v[1] = v[1];
+ thisUniformState.v[2] = v[2];
+ f->glUniform3fv(uniform.glslLocation, 1, v);
+ }
+ } else {
+ f->glUniform3fv(uniform.glslLocation, 1, v);
+ }
+ } else {
+ packedArray.resize(elemCount * 3);
+ qrhi_std140_to_packed(&packedArray.data()->f, 3, elemCount, src);
+ f->glUniform3fv(uniform.glslLocation, elemCount, &packedArray.constData()->f);
+ }
+ }
break;
case QShaderDescription::Vec4:
- f->glUniform4fv(uniform.glslLocation, 1, reinterpret_cast<const float *>(src));
+ {
+ const int elemCount = uniform.arrayDim;
+ if (elemCount < 1) {
+ const float *v = reinterpret_cast<const float *>(src);
+ if (uniform.glslLocation <= QGles2UniformState::MAX_TRACKED_LOCATION) {
+ QGles2UniformState &thisUniformState(uniformState[uniform.glslLocation]);
+ if (thisUniformState.componentCount != 4
+ || thisUniformState.v[0] != v[0]
+ || thisUniformState.v[1] != v[1]
+ || thisUniformState.v[2] != v[2]
+ || thisUniformState.v[3] != v[3])
+ {
+ thisUniformState.componentCount = 4;
+ thisUniformState.v[0] = v[0];
+ thisUniformState.v[1] = v[1];
+ thisUniformState.v[2] = v[2];
+ thisUniformState.v[3] = v[3];
+ f->glUniform4fv(uniform.glslLocation, 1, v);
+ }
+ } else {
+ f->glUniform4fv(uniform.glslLocation, 1, v);
+ }
+ } else {
+ f->glUniform4fv(uniform.glslLocation, elemCount, reinterpret_cast<const float *>(src));
+ }
+ }
break;
case QShaderDescription::Mat2:
f->glUniformMatrix2fv(uniform.glslLocation, 1, GL_FALSE, reinterpret_cast<const float *>(src));
break;
case QShaderDescription::Mat3:
{
- // 4 floats per column (or row, if row-major)
- float mat[9];
- const float *srcMat = reinterpret_cast<const float *>(src);
- memcpy(mat, srcMat, 3 * sizeof(float));
- memcpy(mat + 3, srcMat + 4, 3 * sizeof(float));
- memcpy(mat + 6, srcMat + 8, 3 * sizeof(float));
- f->glUniformMatrix3fv(uniform.glslLocation, 1, GL_FALSE, mat);
+ const int elemCount = uniform.arrayDim;
+ if (elemCount < 1) {
+ // 4 floats per column (or row, if row-major)
+ float mat[9];
+ const float *srcMat = reinterpret_cast<const float *>(src);
+ memcpy(mat, srcMat, 3 * sizeof(float));
+ memcpy(mat + 3, srcMat + 4, 3 * sizeof(float));
+ memcpy(mat + 6, srcMat + 8, 3 * sizeof(float));
+ f->glUniformMatrix3fv(uniform.glslLocation, 1, GL_FALSE, mat);
+ } else {
+ packedArray.resize(elemCount * 9);
+ qrhi_std140_to_packed(&packedArray.data()->f, 3, elemCount * 3, src);
+ f->glUniformMatrix3fv(uniform.glslLocation, elemCount, GL_FALSE, &packedArray.constData()->f);
+ }
}
break;
case QShaderDescription::Mat4:
- f->glUniformMatrix4fv(uniform.glslLocation, 1, GL_FALSE, reinterpret_cast<const float *>(src));
+ f->glUniformMatrix4fv(uniform.glslLocation, qMax(1, uniform.arrayDim), GL_FALSE, reinterpret_cast<const float *>(src));
break;
case QShaderDescription::Int:
- f->glUniform1i(uniform.glslLocation, *reinterpret_cast<const qint32 *>(src));
+ {
+ const int elemCount = uniform.arrayDim;
+ if (elemCount < 1) {
+ f->glUniform1i(uniform.glslLocation, *reinterpret_cast<const qint32 *>(src));
+ } else {
+ packedArray.resize(elemCount);
+ qrhi_std140_to_packed(&packedArray.data()->i, 1, elemCount, src);
+ f->glUniform1iv(uniform.glslLocation, elemCount, &packedArray.constData()->i);
+ }
+ }
break;
case QShaderDescription::Int2:
- f->glUniform2iv(uniform.glslLocation, 1, reinterpret_cast<const qint32 *>(src));
+ {
+ const int elemCount = uniform.arrayDim;
+ if (elemCount < 1) {
+ f->glUniform2iv(uniform.glslLocation, 1, reinterpret_cast<const qint32 *>(src));
+ } else {
+ packedArray.resize(elemCount * 2);
+ qrhi_std140_to_packed(&packedArray.data()->i, 2, elemCount, src);
+ f->glUniform2iv(uniform.glslLocation, elemCount, &packedArray.constData()->i);
+ }
+ }
break;
case QShaderDescription::Int3:
- f->glUniform3iv(uniform.glslLocation, 1, reinterpret_cast<const qint32 *>(src));
+ {
+ const int elemCount = uniform.arrayDim;
+ if (elemCount < 1) {
+ f->glUniform3iv(uniform.glslLocation, 1, reinterpret_cast<const qint32 *>(src));
+ } else {
+ packedArray.resize(elemCount * 3);
+ qrhi_std140_to_packed(&packedArray.data()->i, 3, elemCount, src);
+ f->glUniform3iv(uniform.glslLocation, elemCount, &packedArray.constData()->i);
+ }
+ }
break;
case QShaderDescription::Int4:
- f->glUniform4iv(uniform.glslLocation, 1, reinterpret_cast<const qint32 *>(src));
+ f->glUniform4iv(uniform.glslLocation, qMax(1, uniform.arrayDim), reinterpret_cast<const qint32 *>(src));
break;
case QShaderDescription::Uint:
f->glUniform1ui(uniform.glslLocation, *reinterpret_cast<const quint32 *>(src));
@@ -2477,8 +4301,9 @@ void QRhiGles2::bindShaderResources(QRhiGraphicsPipeline *maybeGraphicsPs, QRhiC
case QShaderDescription::Bool4:
f->glUniform4iv(uniform.glslLocation, 1, reinterpret_cast<const qint32 *>(src));
break;
- // ### more types
default:
+ qWarning("Uniform with buffer binding %d, buffer offset %d has unsupported type %d",
+ uniform.binding, uniform.offset, uniform.type);
break;
}
}
@@ -2487,47 +4312,48 @@ void QRhiGles2::bindShaderResources(QRhiGraphicsPipeline *maybeGraphicsPs, QRhiC
break;
case QRhiShaderResourceBinding::SampledTexture:
{
- QGles2Texture *texD = QRHI_RES(QGles2Texture, b->u.stex.tex);
- QGles2Sampler *samplerD = QRHI_RES(QGles2Sampler, b->u.stex.sampler);
- QVector<QGles2SamplerDescription> &samplers(maybeGraphicsPs ? QRHI_RES(QGles2GraphicsPipeline, maybeGraphicsPs)->samplers
- : QRHI_RES(QGles2ComputePipeline, maybeComputePs)->samplers);
-
- for (QGles2SamplerDescription &sampler : samplers) {
- if (sampler.binding == b->binding) {
- f->glActiveTexture(GL_TEXTURE0 + uint(texUnit));
- f->glBindTexture(texD->target, texD->texture);
-
- if (texD->samplerState != samplerD->d) {
- f->glTexParameteri(texD->target, GL_TEXTURE_MIN_FILTER, GLint(samplerD->d.glminfilter));
- f->glTexParameteri(texD->target, GL_TEXTURE_MAG_FILTER, GLint(samplerD->d.glmagfilter));
- f->glTexParameteri(texD->target, GL_TEXTURE_WRAP_S, GLint(samplerD->d.glwraps));
- f->glTexParameteri(texD->target, GL_TEXTURE_WRAP_T, GLint(samplerD->d.glwrapt));
- // 3D textures not supported by GLES 2.0 or by us atm...
- //f->glTexParameteri(texD->target, GL_TEXTURE_WRAP_R, samplerD->d.glwrapr);
- if (caps.textureCompareMode) {
- if (samplerD->d.gltexcomparefunc != GL_NEVER) {
- f->glTexParameteri(texD->target, GL_TEXTURE_COMPARE_MODE, GL_COMPARE_REF_TO_TEXTURE);
- f->glTexParameteri(texD->target, GL_TEXTURE_COMPARE_FUNC, GLint(samplerD->d.gltexcomparefunc));
- } else {
- f->glTexParameteri(texD->target, GL_TEXTURE_COMPARE_MODE, GL_NONE);
- }
- }
- texD->samplerState = samplerD->d;
+ const QGles2SamplerDescriptionVector &samplers(maybeGraphicsPs ? QRHI_RES(QGles2GraphicsPipeline, maybeGraphicsPs)->samplers
+ : QRHI_RES(QGles2ComputePipeline, maybeComputePs)->samplers);
+ void *ps;
+ uint psGeneration;
+ if (maybeGraphicsPs) {
+ ps = maybeGraphicsPs;
+ psGeneration = QRHI_RES(QGles2GraphicsPipeline, maybeGraphicsPs)->generation;
+ } else {
+ ps = maybeComputePs;
+ psGeneration = QRHI_RES(QGles2ComputePipeline, maybeComputePs)->generation;
+ }
+ for (int elem = 0; elem < b->u.stex.count; ++elem) {
+ QGles2Texture *texD = QRHI_RES(QGles2Texture, b->u.stex.texSamplers[elem].tex);
+ QGles2Sampler *samplerD = QRHI_RES(QGles2Sampler, b->u.stex.texSamplers[elem].sampler);
+ for (const QGles2SamplerDescription &shaderSampler : samplers) {
+ if (shaderSampler.combinedBinding == b->binding) {
+ const int loc = shaderSampler.glslLocation + elem;
+ bindCombinedSampler(cbD, texD, samplerD, ps, psGeneration, loc, &texUnit, &activeTexUnitAltered);
+ break;
}
-
- f->glUniform1i(sampler.glslLocation, texUnit);
- ++texUnit;
}
}
}
break;
+ case QRhiShaderResourceBinding::Texture:
+ for (int elem = 0; elem < b->u.stex.count; ++elem) {
+ QGles2Texture *texD = QRHI_RES(QGles2Texture, b->u.stex.texSamplers[elem].tex);
+ separateTextureBindings.append({ texD, b->binding, elem });
+ }
+ break;
+ case QRhiShaderResourceBinding::Sampler:
+ {
+ QGles2Sampler *samplerD = QRHI_RES(QGles2Sampler, b->u.stex.texSamplers[0].sampler);
+ separateSamplerBindings.append({ samplerD, b->binding });
+ }
+ break;
case QRhiShaderResourceBinding::ImageLoad:
- Q_FALLTHROUGH();
case QRhiShaderResourceBinding::ImageStore:
- Q_FALLTHROUGH();
case QRhiShaderResourceBinding::ImageLoadStore:
{
QGles2Texture *texD = QRHI_RES(QGles2Texture, b->u.simage.tex);
+ Q_ASSERT(texD->m_flags.testFlag(QRhiTexture::UsedWithLoadStore));
const bool layered = texD->m_flags.testFlag(QRhiTexture::CubeMap);
GLenum access = GL_READ_WRITE;
if (b->type == QRhiShaderResourceBinding::ImageLoad)
@@ -2540,12 +4366,11 @@ void QRhiGles2::bindShaderResources(QRhiGraphicsPipeline *maybeGraphicsPs, QRhiC
}
break;
case QRhiShaderResourceBinding::BufferLoad:
- Q_FALLTHROUGH();
case QRhiShaderResourceBinding::BufferStore:
- Q_FALLTHROUGH();
case QRhiShaderResourceBinding::BufferLoadStore:
{
QGles2Buffer *bufD = QRHI_RES(QGles2Buffer, b->u.sbuf.buf);
+ Q_ASSERT(bufD->m_usage.testFlag(QRhiBuffer::StorageBuffer));
if (b->u.sbuf.offset == 0 && b->u.sbuf.maybeSize == 0)
f->glBindBufferBase(GL_SHADER_STORAGE_BUFFER, GLuint(b->binding), bufD->buffer);
else
@@ -2559,7 +4384,36 @@ void QRhiGles2::bindShaderResources(QRhiGraphicsPipeline *maybeGraphicsPs, QRhiC
}
}
- if (texUnit > 1)
+ if (!separateTextureBindings.isEmpty() || !separateSamplerBindings.isEmpty()) {
+ const QGles2SamplerDescriptionVector &samplers(maybeGraphicsPs ? QRHI_RES(QGles2GraphicsPipeline, maybeGraphicsPs)->samplers
+ : QRHI_RES(QGles2ComputePipeline, maybeComputePs)->samplers);
+ void *ps;
+ uint psGeneration;
+ if (maybeGraphicsPs) {
+ ps = maybeGraphicsPs;
+ psGeneration = QRHI_RES(QGles2GraphicsPipeline, maybeGraphicsPs)->generation;
+ } else {
+ ps = maybeComputePs;
+ psGeneration = QRHI_RES(QGles2ComputePipeline, maybeComputePs)->generation;
+ }
+ for (const QGles2SamplerDescription &shaderSampler : samplers) {
+ if (shaderSampler.combinedBinding >= 0)
+ continue;
+ for (const SeparateSampler &sepSampler : separateSamplerBindings) {
+ if (sepSampler.binding != shaderSampler.sbinding)
+ continue;
+ for (const SeparateTexture &sepTex : separateTextureBindings) {
+ if (sepTex.binding != shaderSampler.tbinding)
+ continue;
+ const int loc = shaderSampler.glslLocation + sepTex.elem;
+ bindCombinedSampler(cbD, sepTex.texture, sepSampler.sampler, ps, psGeneration,
+ loc, &texUnit, &activeTexUnitAltered);
+ }
+ }
+ }
+ }
+
+ if (activeTexUnitAltered)
f->glActiveTexture(GL_TEXTURE0);
}
@@ -2576,18 +4430,24 @@ QGles2RenderTargetData *QRhiGles2::enqueueBindFramebuffer(QRhiRenderTarget *rt,
QGles2RenderTargetData *rtD = nullptr;
QRhiPassResourceTracker &passResTracker(cbD->passResTrackers[cbD->currentPassResTrackerIndex]);
- QGles2CommandBuffer::Command fbCmd;
+ QGles2CommandBuffer::Command &fbCmd(cbD->commands.get());
fbCmd.cmd = QGles2CommandBuffer::Command::BindFramebuffer;
+ static const bool doClearBuffers = qEnvironmentVariableIntValue("QT_GL_NO_CLEAR_BUFFERS") == 0;
+ static const bool doClearColorBuffer = qEnvironmentVariableIntValue("QT_GL_NO_CLEAR_COLOR_BUFFER") == 0;
+
switch (rt->resourceType()) {
- case QRhiResource::RenderTarget:
- rtD = &QRHI_RES(QGles2ReferenceRenderTarget, rt)->d;
+ case QRhiResource::SwapChainRenderTarget:
+ rtD = &QRHI_RES(QGles2SwapChainRenderTarget, rt)->d;
if (wantsColorClear)
- *wantsColorClear = true;
+ *wantsColorClear = doClearBuffers && doClearColorBuffer;
if (wantsDsClear)
- *wantsDsClear = true;
+ *wantsDsClear = doClearBuffers;
fbCmd.args.bindFramebuffer.fbo = 0;
fbCmd.args.bindFramebuffer.colorAttCount = 1;
+ fbCmd.args.bindFramebuffer.stereo = rtD->stereoTarget.has_value();
+ if (fbCmd.args.bindFramebuffer.stereo)
+ fbCmd.args.bindFramebuffer.stereoTarget = rtD->stereoTarget.value();
break;
case QRhiResource::TextureRenderTarget:
{
@@ -2599,6 +4459,7 @@ QGles2RenderTargetData *QRhiGles2::enqueueBindFramebuffer(QRhiRenderTarget *rt,
*wantsDsClear = !rtTex->m_flags.testFlag(QRhiTextureRenderTarget::PreserveDepthStencilContents);
fbCmd.args.bindFramebuffer.fbo = rtTex->framebuffer;
fbCmd.args.bindFramebuffer.colorAttCount = rtD->colorAttCount;
+ fbCmd.args.bindFramebuffer.stereo = false;
for (auto it = rtTex->m_desc.cbeginColorAttachments(), itEnd = rtTex->m_desc.cendColorAttachments();
it != itEnd; ++it)
@@ -2606,12 +4467,12 @@ QGles2RenderTargetData *QRhiGles2::enqueueBindFramebuffer(QRhiRenderTarget *rt,
const QRhiColorAttachment &colorAtt(*it);
QGles2Texture *texD = QRHI_RES(QGles2Texture, colorAtt.texture());
QGles2Texture *resolveTexD = QRHI_RES(QGles2Texture, colorAtt.resolveTexture());
- if (texD) {
+ if (texD && cbD->passNeedsResourceTracking) {
trackedRegisterTexture(&passResTracker, texD,
QRhiPassResourceTracker::TexColorOutput,
QRhiPassResourceTracker::TexColorOutputStage);
}
- if (resolveTexD) {
+ if (resolveTexD && cbD->passNeedsResourceTracking) {
trackedRegisterTexture(&passResTracker, resolveTexD,
QRhiPassResourceTracker::TexColorOutput,
QRhiPassResourceTracker::TexColorOutputStage);
@@ -2619,7 +4480,7 @@ QGles2RenderTargetData *QRhiGles2::enqueueBindFramebuffer(QRhiRenderTarget *rt,
// renderbuffers cannot be written in shaders (no image store) so
// they do not matter here
}
- if (rtTex->m_desc.depthTexture()) {
+ if (rtTex->m_desc.depthTexture() && cbD->passNeedsResourceTracking) {
trackedRegisterTexture(&passResTracker, QRHI_RES(QGles2Texture, rtTex->m_desc.depthTexture()),
QRhiPassResourceTracker::TexDepthOutput,
QRhiPassResourceTracker::TexDepthOutputStage);
@@ -2632,7 +4493,6 @@ QGles2RenderTargetData *QRhiGles2::enqueueBindFramebuffer(QRhiRenderTarget *rt,
}
fbCmd.args.bindFramebuffer.srgb = rtD->srgbUpdateAndBlend;
- cbD->commands.append(fbCmd);
return rtD;
}
@@ -2640,18 +4500,18 @@ QGles2RenderTargetData *QRhiGles2::enqueueBindFramebuffer(QRhiRenderTarget *rt,
void QRhiGles2::enqueueBarriersForPass(QGles2CommandBuffer *cbD)
{
cbD->passResTrackers.append(QRhiPassResourceTracker());
- cbD->currentPassResTrackerIndex = cbD->passResTrackers.count() - 1;
- QGles2CommandBuffer::Command cmd;
+ cbD->currentPassResTrackerIndex = cbD->passResTrackers.size() - 1;
+ QGles2CommandBuffer::Command &cmd(cbD->commands.get());
cmd.cmd = QGles2CommandBuffer::Command::BarriersForPass;
cmd.args.barriersForPass.trackerIndex = cbD->currentPassResTrackerIndex;
- cbD->commands.append(cmd);
}
void QRhiGles2::beginPass(QRhiCommandBuffer *cb,
QRhiRenderTarget *rt,
const QColor &colorClearValue,
const QRhiDepthStencilClearValue &depthStencilClearValue,
- QRhiResourceUpdateBatch *resourceUpdates)
+ QRhiResourceUpdateBatch *resourceUpdates,
+ QRhiCommandBuffer::BeginPassFlags flags)
{
QGles2CommandBuffer *cbD = QRHI_RES(QGles2CommandBuffer, cb);
Q_ASSERT(cbD->recordingPass == QGles2CommandBuffer::NoPass);
@@ -2663,10 +4523,16 @@ void QRhiGles2::beginPass(QRhiCommandBuffer *cb,
// glMemoryBarrier() calls based on that tracker when submitted.
enqueueBarriersForPass(cbD);
+ if (rt->resourceType() == QRhiRenderTarget::TextureRenderTarget) {
+ QGles2TextureRenderTarget *rtTex = QRHI_RES(QGles2TextureRenderTarget, rt);
+ if (!QRhiRenderTargetAttachmentTracker::isUpToDate<QGles2Texture, QGles2RenderBuffer>(rtTex->description(), rtTex->d.currentResIdList))
+ rtTex->create();
+ }
+
bool wantsColorClear, wantsDsClear;
QGles2RenderTargetData *rtD = enqueueBindFramebuffer(rt, cbD, &wantsColorClear, &wantsDsClear);
- QGles2CommandBuffer::Command clearCmd;
+ QGles2CommandBuffer::Command &clearCmd(cbD->commands.get());
clearCmd.cmd = QGles2CommandBuffer::Command::Clear;
clearCmd.args.clear.mask = 0;
if (rtD->colorAttCount && wantsColorClear)
@@ -2679,9 +4545,9 @@ void QRhiGles2::beginPass(QRhiCommandBuffer *cb,
clearCmd.args.clear.c[3] = float(colorClearValue.alphaF());
clearCmd.args.clear.d = depthStencilClearValue.depthClearValue();
clearCmd.args.clear.s = depthStencilClearValue.stencilClearValue();
- cbD->commands.append(clearCmd);
cbD->recordingPass = QGles2CommandBuffer::RenderPass;
+ cbD->passNeedsResourceTracking = !flags.testFlag(QRhiCommandBuffer::DoNotTrackResourcesForCompute);
cbD->currentTarget = rt;
cbD->resetCachedState();
@@ -2694,29 +4560,129 @@ void QRhiGles2::endPass(QRhiCommandBuffer *cb, QRhiResourceUpdateBatch *resource
if (cbD->currentTarget->resourceType() == QRhiResource::TextureRenderTarget) {
QGles2TextureRenderTarget *rtTex = QRHI_RES(QGles2TextureRenderTarget, cbD->currentTarget);
- if (rtTex->m_desc.cbeginColorAttachments() != rtTex->m_desc.cendColorAttachments()) {
- // handle only 1 color attachment and only (msaa) renderbuffer
- const QRhiColorAttachment &colorAtt(*rtTex->m_desc.cbeginColorAttachments());
- if (colorAtt.resolveTexture()) {
- Q_ASSERT(colorAtt.renderBuffer());
+ for (auto it = rtTex->m_desc.cbeginColorAttachments(), itEnd = rtTex->m_desc.cendColorAttachments();
+ it != itEnd; ++it)
+ {
+ const QRhiColorAttachment &colorAtt(*it);
+ if (!colorAtt.resolveTexture())
+ continue;
+
+ QGles2Texture *resolveTexD = QRHI_RES(QGles2Texture, colorAtt.resolveTexture());
+ const QSize size = resolveTexD->pixelSize();
+ if (colorAtt.renderBuffer()) {
QGles2RenderBuffer *rbD = QRHI_RES(QGles2RenderBuffer, colorAtt.renderBuffer());
- const QSize size = colorAtt.resolveTexture()->pixelSize();
if (rbD->pixelSize() != size) {
qWarning("Resolve source (%dx%d) and target (%dx%d) size does not match",
rbD->pixelSize().width(), rbD->pixelSize().height(), size.width(), size.height());
}
- QGles2CommandBuffer::Command cmd;
+ QGles2CommandBuffer::Command &cmd(cbD->commands.get());
cmd.cmd = QGles2CommandBuffer::Command::BlitFromRenderbuffer;
- cmd.args.blitFromRb.renderbuffer = rbD->renderbuffer;
- cmd.args.blitFromRb.w = size.width();
- cmd.args.blitFromRb.h = size.height();
- QGles2Texture *colorTexD = QRHI_RES(QGles2Texture, colorAtt.resolveTexture());
- const GLenum faceTargetBase = colorTexD->m_flags.testFlag(QRhiTexture::CubeMap) ? GL_TEXTURE_CUBE_MAP_POSITIVE_X
- : colorTexD->target;
- cmd.args.blitFromRb.target = faceTargetBase + uint(colorAtt.resolveLayer());
- cmd.args.blitFromRb.texture = colorTexD->texture;
- cmd.args.blitFromRb.dstLevel = colorAtt.resolveLevel();
- cbD->commands.append(cmd);
+ cmd.args.blitFromRenderbuffer.renderbuffer = rbD->renderbuffer;
+ cmd.args.blitFromRenderbuffer.w = size.width();
+ cmd.args.blitFromRenderbuffer.h = size.height();
+ if (resolveTexD->m_flags.testFlag(QRhiTexture::CubeMap))
+ cmd.args.blitFromRenderbuffer.target = GL_TEXTURE_CUBE_MAP_POSITIVE_X + uint(colorAtt.resolveLayer());
+ else
+ cmd.args.blitFromRenderbuffer.target = resolveTexD->target;
+ cmd.args.blitFromRenderbuffer.dstTexture = resolveTexD->texture;
+ cmd.args.blitFromRenderbuffer.dstLevel = colorAtt.resolveLevel();
+ const bool hasZ = resolveTexD->m_flags.testFlag(QRhiTexture::ThreeDimensional)
+ || resolveTexD->m_flags.testFlag(QRhiTexture::TextureArray);
+ cmd.args.blitFromRenderbuffer.dstLayer = hasZ ? colorAtt.resolveLayer() : 0;
+ cmd.args.blitFromRenderbuffer.isDepthStencil = false;
+ } else if (caps.glesMultisampleRenderToTexture) {
+ // Nothing to do, resolving into colorAtt.resolveTexture() is automatic,
+ // colorAtt.texture() is in fact not used for anything.
+ } else {
+ Q_ASSERT(colorAtt.texture());
+ QGles2Texture *texD = QRHI_RES(QGles2Texture, colorAtt.texture());
+ if (texD->pixelSize() != size) {
+ qWarning("Resolve source (%dx%d) and target (%dx%d) size does not match",
+ texD->pixelSize().width(), texD->pixelSize().height(), size.width(), size.height());
+ }
+ const int resolveCount = colorAtt.multiViewCount() >= 2 ? colorAtt.multiViewCount() : 1;
+ for (int resolveIdx = 0; resolveIdx < resolveCount; ++resolveIdx) {
+ const int srcLayer = colorAtt.layer() + resolveIdx;
+ const int dstLayer = colorAtt.resolveLayer() + resolveIdx;
+ QGles2CommandBuffer::Command &cmd(cbD->commands.get());
+ cmd.cmd = QGles2CommandBuffer::Command::BlitFromTexture;
+ if (texD->m_flags.testFlag(QRhiTexture::CubeMap))
+ cmd.args.blitFromTexture.srcTarget = GL_TEXTURE_CUBE_MAP_POSITIVE_X + uint(srcLayer);
+ else
+ cmd.args.blitFromTexture.srcTarget = texD->target;
+ cmd.args.blitFromTexture.srcTexture = texD->texture;
+ cmd.args.blitFromTexture.srcLevel = colorAtt.level();
+ cmd.args.blitFromTexture.srcLayer = 0;
+ if (texD->m_flags.testFlag(QRhiTexture::ThreeDimensional) || texD->m_flags.testFlag(QRhiTexture::TextureArray))
+ cmd.args.blitFromTexture.srcLayer = srcLayer;
+ cmd.args.blitFromTexture.w = size.width();
+ cmd.args.blitFromTexture.h = size.height();
+ if (resolveTexD->m_flags.testFlag(QRhiTexture::CubeMap))
+ cmd.args.blitFromTexture.dstTarget = GL_TEXTURE_CUBE_MAP_POSITIVE_X + uint(dstLayer);
+ else
+ cmd.args.blitFromTexture.dstTarget = resolveTexD->target;
+ cmd.args.blitFromTexture.dstTexture = resolveTexD->texture;
+ cmd.args.blitFromTexture.dstLevel = colorAtt.resolveLevel();
+ cmd.args.blitFromTexture.dstLayer = 0;
+ if (resolveTexD->m_flags.testFlag(QRhiTexture::ThreeDimensional) || resolveTexD->m_flags.testFlag(QRhiTexture::TextureArray))
+ cmd.args.blitFromTexture.dstLayer = dstLayer;
+ cmd.args.blitFromTexture.isDepthStencil = false;
+ }
+ }
+ }
+
+ if (rtTex->m_desc.depthResolveTexture()) {
+ QGles2Texture *depthResolveTexD = QRHI_RES(QGles2Texture, rtTex->m_desc.depthResolveTexture());
+ const QSize size = depthResolveTexD->pixelSize();
+ if (rtTex->m_desc.depthStencilBuffer()) {
+ QGles2RenderBuffer *rbD = QRHI_RES(QGles2RenderBuffer, rtTex->m_desc.depthStencilBuffer());
+ QGles2CommandBuffer::Command &cmd(cbD->commands.get());
+ cmd.cmd = QGles2CommandBuffer::Command::BlitFromRenderbuffer;
+ cmd.args.blitFromRenderbuffer.renderbuffer = rbD->renderbuffer;
+ cmd.args.blitFromRenderbuffer.w = size.width();
+ cmd.args.blitFromRenderbuffer.h = size.height();
+ cmd.args.blitFromRenderbuffer.target = depthResolveTexD->target;
+ cmd.args.blitFromRenderbuffer.dstTexture = depthResolveTexD->texture;
+ cmd.args.blitFromRenderbuffer.dstLevel = 0;
+ cmd.args.blitFromRenderbuffer.dstLayer = 0;
+ cmd.args.blitFromRenderbuffer.isDepthStencil = true;
+ } else if (caps.glesMultisampleRenderToTexture) {
+ // Nothing to do, resolving into depthResolveTexture() is automatic.
+ } else {
+ QGles2Texture *depthTexD = QRHI_RES(QGles2Texture, rtTex->m_desc.depthTexture());
+ const int resolveCount = depthTexD->arraySize() >= 2 ? depthTexD->arraySize() : 1;
+ for (int resolveIdx = 0; resolveIdx < resolveCount; ++resolveIdx) {
+ QGles2CommandBuffer::Command &cmd(cbD->commands.get());
+ cmd.cmd = QGles2CommandBuffer::Command::BlitFromTexture;
+ cmd.args.blitFromTexture.srcTarget = depthTexD->target;
+ cmd.args.blitFromTexture.srcTexture = depthTexD->texture;
+ cmd.args.blitFromTexture.srcLevel = 0;
+ cmd.args.blitFromTexture.srcLayer = resolveIdx;
+ cmd.args.blitFromTexture.w = size.width();
+ cmd.args.blitFromTexture.h = size.height();
+ cmd.args.blitFromTexture.dstTarget = depthResolveTexD->target;
+ cmd.args.blitFromTexture.dstTexture = depthResolveTexD->texture;
+ cmd.args.blitFromTexture.dstLevel = 0;
+ cmd.args.blitFromTexture.dstLayer = resolveIdx;
+ cmd.args.blitFromTexture.isDepthStencil = true;
+ }
+ }
+ }
+
+ const bool mayDiscardDepthStencil =
+ (rtTex->m_desc.depthStencilBuffer()
+ || (rtTex->m_desc.depthTexture() && rtTex->m_flags.testFlag(QRhiTextureRenderTarget::DoNotStoreDepthStencilContents)))
+ && !rtTex->m_desc.depthResolveTexture();
+ if (mayDiscardDepthStencil) {
+ QGles2CommandBuffer::Command &cmd(cbD->commands.get());
+ cmd.cmd = QGles2CommandBuffer::Command::InvalidateFramebuffer;
+ if (caps.needsDepthStencilCombinedAttach) {
+ cmd.args.invalidateFramebuffer.attCount = 1;
+ cmd.args.invalidateFramebuffer.att[0] = GL_DEPTH_STENCIL_ATTACHMENT;
+ } else {
+ cmd.args.invalidateFramebuffer.attCount = 2;
+ cmd.args.invalidateFramebuffer.att[0] = GL_DEPTH_ATTACHMENT;
+ cmd.args.invalidateFramebuffer.att[1] = GL_STENCIL_ATTACHMENT;
}
}
}
@@ -2728,7 +4694,9 @@ void QRhiGles2::endPass(QRhiCommandBuffer *cb, QRhiResourceUpdateBatch *resource
enqueueResourceUpdates(cb, resourceUpdates);
}
-void QRhiGles2::beginComputePass(QRhiCommandBuffer *cb, QRhiResourceUpdateBatch *resourceUpdates)
+void QRhiGles2::beginComputePass(QRhiCommandBuffer *cb,
+ QRhiResourceUpdateBatch *resourceUpdates,
+ QRhiCommandBuffer::BeginPassFlags)
{
QGles2CommandBuffer *cbD = QRHI_RES(QGles2CommandBuffer, cb);
Q_ASSERT(cbD->recordingPass == QGles2CommandBuffer::NoPass);
@@ -2766,24 +4734,106 @@ void QRhiGles2::setComputePipeline(QRhiCommandBuffer *cb, QRhiComputePipeline *p
cbD->currentComputePipeline = ps;
cbD->currentPipelineGeneration = psD->generation;
- QGles2CommandBuffer::Command cmd;
+ QGles2CommandBuffer::Command &cmd(cbD->commands.get());
cmd.cmd = QGles2CommandBuffer::Command::BindComputePipeline;
cmd.args.bindComputePipeline.ps = ps;
- cbD->commands.append(cmd);
}
}
+template<typename T>
+inline void qrhigl_accumulateComputeResource(T *writtenResources, QRhiResource *resource,
+ QRhiShaderResourceBinding::Type bindingType,
+ int loadTypeVal, int storeTypeVal, int loadStoreTypeVal)
+{
+ int access = 0;
+ if (bindingType == loadTypeVal) {
+ access = QGles2CommandBuffer::ComputePassState::Read;
+ } else {
+ access = QGles2CommandBuffer::ComputePassState::Write;
+ if (bindingType == loadStoreTypeVal)
+ access |= QGles2CommandBuffer::ComputePassState::Read;
+ }
+ auto it = writtenResources->find(resource);
+ if (it != writtenResources->end())
+ it->first |= access;
+ else if (bindingType == storeTypeVal || bindingType == loadStoreTypeVal)
+ writtenResources->insert(resource, { access, true });
+}
+
void QRhiGles2::dispatch(QRhiCommandBuffer *cb, int x, int y, int z)
{
QGles2CommandBuffer *cbD = QRHI_RES(QGles2CommandBuffer, cb);
Q_ASSERT(cbD->recordingPass == QGles2CommandBuffer::ComputePass);
- QGles2CommandBuffer::Command cmd;
+ if (cbD->currentComputeSrb) {
+ GLbitfield barriers = 0;
+
+ // The key in the writtenResources map indicates that the resource was
+ // written in a previous dispatch, whereas the value accumulates the
+ // access mask in the current one.
+ for (auto &accessAndIsNewFlag : cbD->computePassState.writtenResources)
+ accessAndIsNewFlag = { 0, false };
+
+ QGles2ShaderResourceBindings *srbD = QRHI_RES(QGles2ShaderResourceBindings, cbD->currentComputeSrb);
+ const int bindingCount = srbD->m_bindings.size();
+ for (int i = 0; i < bindingCount; ++i) {
+ const QRhiShaderResourceBinding::Data *b = shaderResourceBindingData(srbD->m_bindings.at(i));
+ switch (b->type) {
+ case QRhiShaderResourceBinding::ImageLoad:
+ case QRhiShaderResourceBinding::ImageStore:
+ case QRhiShaderResourceBinding::ImageLoadStore:
+ qrhigl_accumulateComputeResource(&cbD->computePassState.writtenResources,
+ b->u.simage.tex,
+ b->type,
+ QRhiShaderResourceBinding::ImageLoad,
+ QRhiShaderResourceBinding::ImageStore,
+ QRhiShaderResourceBinding::ImageLoadStore);
+ break;
+ case QRhiShaderResourceBinding::BufferLoad:
+ case QRhiShaderResourceBinding::BufferStore:
+ case QRhiShaderResourceBinding::BufferLoadStore:
+ qrhigl_accumulateComputeResource(&cbD->computePassState.writtenResources,
+ b->u.sbuf.buf,
+ b->type,
+ QRhiShaderResourceBinding::BufferLoad,
+ QRhiShaderResourceBinding::BufferStore,
+ QRhiShaderResourceBinding::BufferLoadStore);
+ break;
+ default:
+ break;
+ }
+ }
+
+ for (auto it = cbD->computePassState.writtenResources.begin(); it != cbD->computePassState.writtenResources.end(); ) {
+ const int accessInThisDispatch = it->first;
+ const bool isNewInThisDispatch = it->second;
+ if (accessInThisDispatch && !isNewInThisDispatch) {
+ if (it.key()->resourceType() == QRhiResource::Texture)
+ barriers |= GL_SHADER_IMAGE_ACCESS_BARRIER_BIT;
+ else
+ barriers |= GL_SHADER_STORAGE_BARRIER_BIT;
+ }
+ // Anything that was previously written, but is only read now, can be
+ // removed from the written list (because that previous write got a
+ // corresponding barrier now).
+ if (accessInThisDispatch == QGles2CommandBuffer::ComputePassState::Read)
+ it = cbD->computePassState.writtenResources.erase(it);
+ else
+ ++it;
+ }
+
+ if (barriers) {
+ QGles2CommandBuffer::Command &cmd(cbD->commands.get());
+ cmd.cmd = QGles2CommandBuffer::Command::Barrier;
+ cmd.args.barrier.barriers = barriers;
+ }
+ }
+
+ QGles2CommandBuffer::Command &cmd(cbD->commands.get());
cmd.cmd = QGles2CommandBuffer::Command::Dispatch;
cmd.args.dispatch.x = GLuint(x);
cmd.args.dispatch.y = GLuint(y);
cmd.args.dispatch.z = GLuint(z);
- cbD->commands.append(cmd);
}
static inline GLenum toGlShaderType(QRhiShaderStage::Type type)
@@ -2791,20 +4841,25 @@ static inline GLenum toGlShaderType(QRhiShaderStage::Type type)
switch (type) {
case QRhiShaderStage::Vertex:
return GL_VERTEX_SHADER;
+ case QRhiShaderStage::TessellationControl:
+ return GL_TESS_CONTROL_SHADER;
+ case QRhiShaderStage::TessellationEvaluation:
+ return GL_TESS_EVALUATION_SHADER;
+ case QRhiShaderStage::Geometry:
+ return GL_GEOMETRY_SHADER;
case QRhiShaderStage::Fragment:
return GL_FRAGMENT_SHADER;
case QRhiShaderStage::Compute:
return GL_COMPUTE_SHADER;
default:
- Q_UNREACHABLE();
- return GL_VERTEX_SHADER;
+ Q_UNREACHABLE_RETURN(GL_VERTEX_SHADER);
}
}
-QByteArray QRhiGles2::shaderSource(const QRhiShaderStage &shaderStage, int *glslVersion)
+QByteArray QRhiGles2::shaderSource(const QRhiShaderStage &shaderStage, QShaderVersion *shaderVersion)
{
const QShader bakedShader = shaderStage.shader();
- QVector<int> versionsToTry;
+ QList<int> versionsToTry;
QByteArray source;
if (caps.gles) {
if (caps.ctxMajor > 3 || (caps.ctxMajor == 3 && caps.ctxMinor >= 2)) {
@@ -2820,38 +4875,42 @@ QByteArray QRhiGles2::shaderSource(const QRhiShaderStage &shaderStage, int *glsl
QShaderVersion ver(v, QShaderVersion::GlslEs);
source = bakedShader.shader({ QShader::GlslShader, ver, shaderStage.shaderVariant() }).shader();
if (!source.isEmpty()) {
- if (glslVersion)
- *glslVersion = v;
+ if (shaderVersion)
+ *shaderVersion = ver;
break;
}
}
} else {
if (caps.ctxMajor > 4 || (caps.ctxMajor == 4 && caps.ctxMinor >= 6)) {
- versionsToTry << 460 << 450 << 440 << 430 << 420 << 410 << 400 << 330 << 150;
+ versionsToTry << 460 << 450 << 440 << 430 << 420 << 410 << 400 << 330 << 150 << 140 << 130;
} else if (caps.ctxMajor == 4 && caps.ctxMinor == 5) {
- versionsToTry << 450 << 440 << 430 << 420 << 410 << 400 << 330 << 150;
+ versionsToTry << 450 << 440 << 430 << 420 << 410 << 400 << 330 << 150 << 140 << 130;
} else if (caps.ctxMajor == 4 && caps.ctxMinor == 4) {
- versionsToTry << 440 << 430 << 420 << 410 << 400 << 330 << 150;
+ versionsToTry << 440 << 430 << 420 << 410 << 400 << 330 << 150 << 140 << 130;
} else if (caps.ctxMajor == 4 && caps.ctxMinor == 3) {
- versionsToTry << 430 << 420 << 410 << 400 << 330 << 150;
+ versionsToTry << 430 << 420 << 410 << 400 << 330 << 150 << 140 << 130;
} else if (caps.ctxMajor == 4 && caps.ctxMinor == 2) {
- versionsToTry << 420 << 410 << 400 << 330 << 150;
+ versionsToTry << 420 << 410 << 400 << 330 << 150 << 140 << 130;
} else if (caps.ctxMajor == 4 && caps.ctxMinor == 1) {
- versionsToTry << 410 << 400 << 330 << 150;
+ versionsToTry << 410 << 400 << 330 << 150 << 140 << 130;
} else if (caps.ctxMajor == 4 && caps.ctxMinor == 0) {
- versionsToTry << 400 << 330 << 150;
+ versionsToTry << 400 << 330 << 150 << 140 << 130;
} else if (caps.ctxMajor == 3 && caps.ctxMinor == 3) {
- versionsToTry << 330 << 150;
+ versionsToTry << 330 << 150 << 140 << 130;
} else if (caps.ctxMajor == 3 && caps.ctxMinor == 2) {
- versionsToTry << 150;
+ versionsToTry << 150 << 140 << 130;
+ } else if (caps.ctxMajor == 3 && caps.ctxMinor == 1) {
+ versionsToTry << 140 << 130;
+ } else if (caps.ctxMajor == 3 && caps.ctxMinor == 0) {
+ versionsToTry << 130;
}
if (!caps.coreProfile)
versionsToTry << 120;
for (int v : versionsToTry) {
source = bakedShader.shader({ QShader::GlslShader, v, shaderStage.shaderVariant() }).shader();
if (!source.isEmpty()) {
- if (glslVersion)
- *glslVersion = v;
+ if (shaderVersion)
+ *shaderVersion = v;
break;
}
}
@@ -2863,9 +4922,9 @@ QByteArray QRhiGles2::shaderSource(const QRhiShaderStage &shaderStage, int *glsl
return source;
}
-bool QRhiGles2::compileShader(GLuint program, const QRhiShaderStage &shaderStage, int *glslVersion)
+bool QRhiGles2::compileShader(GLuint program, const QRhiShaderStage &shaderStage, QShaderVersion *shaderVersion)
{
- const QByteArray source = shaderSource(shaderStage, glslVersion);
+ const QByteArray source = shaderSource(shaderStage, shaderVersion);
if (source.isEmpty())
return false;
@@ -2876,7 +4935,7 @@ bool QRhiGles2::compileShader(GLuint program, const QRhiShaderStage &shaderStage
} else {
shader = f->glCreateShader(toGlShaderType(shaderStage.type()));
const char *srcStr = source.constData();
- const GLint srcLength = source.count();
+ const GLint srcLength = source.size();
f->glShaderSource(shader, 1, &srcStr, &srcLength);
f->glCompileShader(shader);
GLint compiled = 0;
@@ -2893,7 +4952,7 @@ bool QRhiGles2::compileShader(GLuint program, const QRhiShaderStage &shaderStage
qWarning("Failed to compile shader: %s\nSource was:\n%s", log.constData(), source.constData());
return false;
}
- if (m_shaderCache.count() >= MAX_SHADER_CACHE_ENTRIES) {
+ if (m_shaderCache.size() >= MAX_SHADER_CACHE_ENTRIES) {
// Use the simplest strategy: too many cached shaders -> drop them all.
for (uint shader : m_shaderCache)
f->glDeleteShader(shader); // does not actually get released yet when attached to a not-yet-released program
@@ -2932,75 +4991,125 @@ void QRhiGles2::registerUniformIfActive(const QShaderDescription::BlockVariable
int binding,
int baseOffset,
GLuint program,
- QVector<QGles2UniformDescription> *dst)
+ QDuplicateTracker<int, 256> *activeUniformLocations,
+ QGles2UniformDescriptionVector *dst)
{
if (var.type == QShaderDescription::Struct) {
qWarning("Nested structs are not supported at the moment. '%s' ignored.",
- qPrintable(var.name));
+ var.name.constData());
return;
}
QGles2UniformDescription uniform;
uniform.type = var.type;
- const QByteArray name = namePrefix + var.name.toUtf8();
+ const QByteArray name = namePrefix + var.name;
+ // Here we expect that the OpenGL implementation has proper active uniform
+ // handling, meaning that a uniform that is declared but not accessed
+ // elsewhere in the code is reported as -1 when querying the location. If
+ // that is not the case, it won't break anything, but we'll generate
+ // unnecessary glUniform* calls then.
uniform.glslLocation = f->glGetUniformLocation(program, name.constData());
- if (uniform.glslLocation >= 0) {
+ if (uniform.glslLocation >= 0 && !activeUniformLocations->hasSeen(uniform.glslLocation)) {
+ if (var.arrayDims.size() > 1) {
+ qWarning("Array '%s' has more than one dimension. This is not supported.",
+ var.name.constData());
+ return;
+ }
uniform.binding = binding;
uniform.offset = uint(baseOffset + var.offset);
uniform.size = var.size;
+ uniform.arrayDim = var.arrayDims.isEmpty() ? 0 : var.arrayDims.first();
dst->append(uniform);
}
}
void QRhiGles2::gatherUniforms(GLuint program,
const QShaderDescription::UniformBlock &ub,
- QVector<QGles2UniformDescription> *dst)
+ QDuplicateTracker<int, 256> *activeUniformLocations,
+ QGles2UniformDescriptionVector *dst)
{
- QByteArray prefix = ub.structName.toUtf8() + '.';
+ QByteArray prefix = ub.structName + '.';
for (const QShaderDescription::BlockVariable &blockMember : ub.members) {
if (blockMember.type == QShaderDescription::Struct) {
- prefix += blockMember.name.toUtf8();
+ QByteArray structPrefix = prefix + blockMember.name;
+
const int baseOffset = blockMember.offset;
if (blockMember.arrayDims.isEmpty()) {
for (const QShaderDescription::BlockVariable &structMember : blockMember.structMembers)
- registerUniformIfActive(structMember, prefix, ub.binding, baseOffset, program, dst);
+ registerUniformIfActive(structMember, structPrefix + ".", ub.binding,
+ baseOffset, program, activeUniformLocations, dst);
} else {
- if (blockMember.arrayDims.count() > 1) {
- qWarning("Array of struct '%s' has more than one dimension. Only the first dimension is used.",
- qPrintable(blockMember.name));
+ if (blockMember.arrayDims.size() > 1) {
+ qWarning("Array of struct '%s' has more than one dimension. Only the first "
+ "dimension is used.",
+ blockMember.name.constData());
}
const int dim = blockMember.arrayDims.first();
const int elemSize = blockMember.size / dim;
int elemOffset = baseOffset;
for (int di = 0; di < dim; ++di) {
- const QByteArray arrayPrefix = prefix + '[' + QByteArray::number(di) + ']' + '.';
+ const QByteArray arrayPrefix = structPrefix + '[' + QByteArray::number(di) + ']' + '.';
for (const QShaderDescription::BlockVariable &structMember : blockMember.structMembers)
- registerUniformIfActive(structMember, arrayPrefix, ub.binding, elemOffset, program, dst);
+ registerUniformIfActive(structMember, arrayPrefix, ub.binding, elemOffset, program, activeUniformLocations, dst);
elemOffset += elemSize;
}
}
} else {
- if (!blockMember.arrayDims.isEmpty()) {
- qWarning("Arrays are only supported for structs at the moment. '%s' ignored.",
- qPrintable(blockMember.name));
- continue;
- }
- registerUniformIfActive(blockMember, prefix, ub.binding, 0, program, dst);
+ registerUniformIfActive(blockMember, prefix, ub.binding, 0, program, activeUniformLocations, dst);
}
}
}
-void QRhiGles2::gatherSamplers(GLuint program, const QShaderDescription::InOutVariable &v,
- QVector<QGles2SamplerDescription> *dst)
+void QRhiGles2::gatherSamplers(GLuint program,
+ const QShaderDescription::InOutVariable &v,
+ QGles2SamplerDescriptionVector *dst)
+{
+ QGles2SamplerDescription sampler;
+ sampler.glslLocation = f->glGetUniformLocation(program, v.name.constData());
+ if (sampler.glslLocation >= 0) {
+ sampler.combinedBinding = v.binding;
+ sampler.tbinding = -1;
+ sampler.sbinding = -1;
+ dst->append(sampler);
+ }
+}
+
+void QRhiGles2::gatherGeneratedSamplers(GLuint program,
+ const QShader::SeparateToCombinedImageSamplerMapping &mapping,
+ QGles2SamplerDescriptionVector *dst)
{
QGles2SamplerDescription sampler;
- const QByteArray name = v.name.toUtf8();
- sampler.glslLocation = f->glGetUniformLocation(program, name.constData());
+ sampler.glslLocation = f->glGetUniformLocation(program, mapping.combinedSamplerName.constData());
if (sampler.glslLocation >= 0) {
- sampler.binding = v.binding;
+ sampler.combinedBinding = -1;
+ sampler.tbinding = mapping.textureBinding;
+ sampler.sbinding = mapping.samplerBinding;
dst->append(sampler);
}
}
+void QRhiGles2::sanityCheckVertexFragmentInterface(const QShaderDescription &vsDesc, const QShaderDescription &fsDesc)
+{
+ if (!vsDesc.isValid() || !fsDesc.isValid())
+ return;
+
+ // Print a warning if the fragment shader input for a given location uses a
+ // name that does not match the vertex shader output at the same location.
+ // This is not an error with any other API and not with GLSL >= 330 either,
+ // but matters for older GLSL code that has no location qualifiers.
+ for (const QShaderDescription::InOutVariable &outVar : vsDesc.outputVariables()) {
+ for (const QShaderDescription::InOutVariable &inVar : fsDesc.inputVariables()) {
+ if (inVar.location == outVar.location) {
+ if (inVar.name != outVar.name) {
+ qWarning("Vertex output name '%s' does not match fragment input '%s'. "
+ "This should be avoided because it causes problems with older GLSL versions.",
+ outVar.name.constData(), inVar.name.constData());
+ }
+ break;
+ }
+ }
+ }
+}
+
bool QRhiGles2::isProgramBinaryDiskCacheEnabled() const
{
static QOpenGLProgramBinarySupportCheckWrapper checker;
@@ -3014,67 +5123,153 @@ static inline QShader::Stage toShaderStage(QRhiShaderStage::Type type)
switch (type) {
case QRhiShaderStage::Vertex:
return QShader::VertexStage;
+ case QRhiShaderStage::TessellationControl:
+ return QShader::TessellationControlStage;
+ case QRhiShaderStage::TessellationEvaluation:
+ return QShader::TessellationEvaluationStage;
+ case QRhiShaderStage::Geometry:
+ return QShader::GeometryStage;
case QRhiShaderStage::Fragment:
return QShader::FragmentStage;
case QRhiShaderStage::Compute:
return QShader::ComputeStage;
default:
- Q_UNREACHABLE();
- return QShader::VertexStage;
+ Q_UNREACHABLE_RETURN(QShader::VertexStage);
}
}
-QRhiGles2::DiskCacheResult QRhiGles2::tryLoadFromDiskCache(const QRhiShaderStage *stages, int stageCount,
- GLuint program, QByteArray *cacheKey)
+QRhiGles2::ProgramCacheResult QRhiGles2::tryLoadFromDiskOrPipelineCache(const QRhiShaderStage *stages,
+ int stageCount,
+ GLuint program,
+ const QVector<QShaderDescription::InOutVariable> &inputVars,
+ QByteArray *cacheKey)
{
- QRhiGles2::DiskCacheResult result = QRhiGles2::DiskCacheMiss;
- QByteArray diskCacheKey;
+ Q_ASSERT(cacheKey);
- if (isProgramBinaryDiskCacheEnabled()) {
+ // the traditional QOpenGL disk cache since Qt 5.9
+ const bool legacyDiskCacheEnabled = isProgramBinaryDiskCacheEnabled();
+
+ // QRhi's own (set)PipelineCacheData()
+ const bool pipelineCacheEnabled = caps.programBinary && !m_pipelineCache.isEmpty();
+
+ // calculating the cache key based on the source code is common for both types of caches
+ if (legacyDiskCacheEnabled || pipelineCacheEnabled) {
QOpenGLProgramBinaryCache::ProgramDesc binaryProgram;
for (int i = 0; i < stageCount; ++i) {
const QRhiShaderStage &stage(stages[i]);
- const QByteArray source = shaderSource(stage, nullptr);
+ QByteArray source = shaderSource(stage, nullptr);
if (source.isEmpty())
- return QRhiGles2::DiskCacheError;
+ return QRhiGles2::ProgramCacheError;
+
+ if (stage.type() == QRhiShaderStage::Vertex) {
+ // Now add something to the key that indicates the vertex input locations.
+ // A GLSL shader lower than 330 (150, 140, ...) will not have location
+ // qualifiers. This means that the shader source code is the same
+ // regardless of what locations inputVars contains. This becomes a problem
+ // because we'll glBindAttribLocation the shader based on inputVars, but
+ // that's only when compiling/linking when there was no cache hit. Picking
+ // from the cache afterwards should take the input locations into account
+ // since if inputVars has now different locations for the attributes, then
+ // it is not ok to reuse a program binary that used different attribute
+ // locations. For a lot of clients this would not be an issue since they
+ // typically hardcode and use the same vertex locations on every run. Some
+ // systems that dynamically generate shaders may end up with a non-stable
+ // order (and so location numbers), however. This is sub-optimal because
+ // it makes caching inefficient, and said clients should be fixed, but in
+ // any case this should not break rendering. Hence including the locations
+ // in the cache key.
+ QMap<QByteArray, int> inputLocations; // sorted by key when iterating
+ for (const QShaderDescription::InOutVariable &var : inputVars)
+ inputLocations.insert(var.name, var.location);
+ source += QByteArrayLiteral("\n // "); // just to be nice; treated as an arbitrary string regardless
+ for (auto it = inputLocations.cbegin(), end = inputLocations.cend(); it != end; ++it) {
+ source += it.key();
+ source += QByteArray::number(it.value());
+ }
+ source += QByteArrayLiteral("\n");
+ }
+
binaryProgram.shaders.append(QOpenGLProgramBinaryCache::ShaderDesc(toShaderStage(stage.type()), source));
}
- diskCacheKey = binaryProgram.cacheKey();
- if (qrhi_programBinaryCache()->load(diskCacheKey, program)) {
+ *cacheKey = binaryProgram.cacheKey();
+
+ // Try our pipeline cache simulation first, if it got seeded with
+ // setPipelineCacheData and there's a hit, then no need to go to the
+ // filesystem at all.
+ if (pipelineCacheEnabled) {
+ auto it = m_pipelineCache.constFind(*cacheKey);
+ if (it != m_pipelineCache.constEnd()) {
+ GLenum err;
+ for ( ; ; ) {
+ err = f->glGetError();
+ if (err == GL_NO_ERROR || err == GL_CONTEXT_LOST)
+ break;
+ }
+ f->glProgramBinary(program, it->format, it->data.constData(), it->data.size());
+ err = f->glGetError();
+ if (err == GL_NO_ERROR) {
+ GLint linkStatus = 0;
+ f->glGetProgramiv(program, GL_LINK_STATUS, &linkStatus);
+ if (linkStatus == GL_TRUE)
+ return QRhiGles2::ProgramCacheHit;
+ }
+ }
+ }
+
+ if (legacyDiskCacheEnabled && qrhi_programBinaryCache()->load(*cacheKey, program)) {
+ // use the logging category QOpenGLShaderProgram would
qCDebug(lcOpenGLProgramDiskCache, "Program binary received from cache, program %u, key %s",
- program, diskCacheKey.constData());
- result = QRhiGles2::DiskCacheHit;
+ program, cacheKey->constData());
+ return QRhiGles2::ProgramCacheHit;
}
}
- if (cacheKey)
- *cacheKey = diskCacheKey;
-
- return result;
+ return QRhiGles2::ProgramCacheMiss;
}
void QRhiGles2::trySaveToDiskCache(GLuint program, const QByteArray &cacheKey)
{
+ // This is only for the traditional QOpenGL disk cache since Qt 5.9.
+
if (isProgramBinaryDiskCacheEnabled()) {
+ // use the logging category QOpenGLShaderProgram would
qCDebug(lcOpenGLProgramDiskCache, "Saving program binary, program %u, key %s",
program, cacheKey.constData());
qrhi_programBinaryCache()->save(cacheKey, program);
}
}
-QGles2Buffer::QGles2Buffer(QRhiImplementation *rhi, Type type, UsageFlags usage, int size)
+void QRhiGles2::trySaveToPipelineCache(GLuint program, const QByteArray &cacheKey, bool force)
+{
+ // This handles our own simulated "pipeline cache". (specific to QRhi, not
+ // shared with legacy QOpenGL* stuff)
+
+ if (caps.programBinary && (force || !m_pipelineCache.contains(cacheKey))) {
+ GLint blobSize = 0;
+ f->glGetProgramiv(program, GL_PROGRAM_BINARY_LENGTH, &blobSize);
+ QByteArray blob(blobSize, Qt::Uninitialized);
+ GLint outSize = 0;
+ GLenum binaryFormat = 0;
+ f->glGetProgramBinary(program, blobSize, &outSize, &binaryFormat, blob.data());
+ if (blobSize == outSize)
+ m_pipelineCache.insert(cacheKey, { binaryFormat, blob });
+ }
+}
+
+QGles2Buffer::QGles2Buffer(QRhiImplementation *rhi, Type type, UsageFlags usage, quint32 size)
: QRhiBuffer(rhi, type, usage, size)
{
}
QGles2Buffer::~QGles2Buffer()
{
- release();
+ destroy();
}
-void QGles2Buffer::release()
+void QGles2Buffer::destroy()
{
+ data.clear();
if (!buffer)
return;
@@ -3082,33 +5277,30 @@ void QGles2Buffer::release()
e.type = QRhiGles2::DeferredReleaseEntry::Buffer;
e.buffer.buffer = buffer;
-
buffer = 0;
QRHI_RES_RHI(QRhiGles2);
- rhiD->releaseQueue.append(e);
- QRHI_PROF;
- QRHI_PROF_F(releaseBuffer(this));
- rhiD->unregisterResource(this);
+ if (rhiD) {
+ rhiD->releaseQueue.append(e);
+ rhiD->unregisterResource(this);
+ }
}
-bool QGles2Buffer::build()
+bool QGles2Buffer::create()
{
if (buffer)
- release();
+ destroy();
QRHI_RES_RHI(QRhiGles2);
- QRHI_PROF;
- const int nonZeroSize = m_size <= 0 ? 256 : m_size;
+ nonZeroSize = m_size <= 0 ? 256 : m_size;
if (m_usage.testFlag(QRhiBuffer::UniformBuffer)) {
if (int(m_usage) != QRhiBuffer::UniformBuffer) {
qWarning("Uniform buffer: multiple usages specified, this is not supported by the OpenGL backend");
return false;
}
- ubuf.resize(nonZeroSize);
- QRHI_PROF_F(newBuffer(this, uint(nonZeroSize), 0, 1));
+ data.resize(nonZeroSize);
return true;
}
@@ -3125,25 +5317,65 @@ bool QGles2Buffer::build()
rhiD->f->glBindBuffer(targetForDataOps, buffer);
rhiD->f->glBufferData(targetForDataOps, nonZeroSize, nullptr, m_type == Dynamic ? GL_DYNAMIC_DRAW : GL_STATIC_DRAW);
+ if (rhiD->glObjectLabel)
+ rhiD->glObjectLabel(GL_BUFFER, buffer, -1, m_objectName.constData());
+
usageState.access = AccessNone;
- QRHI_PROF_F(newBuffer(this, uint(nonZeroSize), 1, 0));
rhiD->registerResource(this);
return true;
}
+QRhiBuffer::NativeBuffer QGles2Buffer::nativeBuffer()
+{
+ if (m_usage.testFlag(QRhiBuffer::UniformBuffer))
+ return { {}, 0 };
+
+ return { { &buffer }, 1 };
+}
+
+char *QGles2Buffer::beginFullDynamicBufferUpdateForCurrentFrame()
+{
+ Q_ASSERT(m_type == Dynamic);
+ if (!m_usage.testFlag(UniformBuffer)) {
+ QRHI_RES_RHI(QRhiGles2);
+ rhiD->f->glBindBuffer(targetForDataOps, buffer);
+ if (rhiD->caps.properMapBuffer) {
+ return static_cast<char *>(rhiD->f->glMapBufferRange(targetForDataOps, 0, nonZeroSize,
+ GL_MAP_READ_BIT | GL_MAP_WRITE_BIT));
+ } else {
+ // Need some storage for the data, use the otherwise unused 'data' member.
+ if (data.isEmpty())
+ data.resize(nonZeroSize);
+ }
+ }
+ return data.data();
+}
+
+void QGles2Buffer::endFullDynamicBufferUpdateForCurrentFrame()
+{
+ if (!m_usage.testFlag(UniformBuffer)) {
+ QRHI_RES_RHI(QRhiGles2);
+ if (rhiD->caps.properMapBuffer)
+ rhiD->f->glUnmapBuffer(targetForDataOps);
+ else
+ rhiD->f->glBufferSubData(targetForDataOps, 0, nonZeroSize, data.data());
+ }
+}
+
QGles2RenderBuffer::QGles2RenderBuffer(QRhiImplementation *rhi, Type type, const QSize &pixelSize,
- int sampleCount, QRhiRenderBuffer::Flags flags)
- : QRhiRenderBuffer(rhi, type, pixelSize, sampleCount, flags)
+ int sampleCount, QRhiRenderBuffer::Flags flags,
+ QRhiTexture::Format backingFormatHint)
+ : QRhiRenderBuffer(rhi, type, pixelSize, sampleCount, flags, backingFormatHint)
{
}
QGles2RenderBuffer::~QGles2RenderBuffer()
{
- release();
+ destroy();
}
-void QGles2RenderBuffer::release()
+void QGles2RenderBuffer::destroy()
{
if (!renderbuffer)
return;
@@ -3158,26 +5390,24 @@ void QGles2RenderBuffer::release()
stencilRenderbuffer = 0;
QRHI_RES_RHI(QRhiGles2);
- rhiD->releaseQueue.append(e);
- QRHI_PROF;
- QRHI_PROF_F(releaseRenderBuffer(this));
- rhiD->unregisterResource(this);
+ if (rhiD) {
+ if (owns)
+ rhiD->releaseQueue.append(e);
+ rhiD->unregisterResource(this);
+ }
}
-bool QGles2RenderBuffer::build()
+bool QGles2RenderBuffer::create()
{
if (renderbuffer)
- release();
+ destroy();
QRHI_RES_RHI(QRhiGles2);
- QRHI_PROF;
samples = rhiD->effectiveSampleCount(m_sampleCount);
if (m_flags.testFlag(UsedWithSwapChainOnly)) {
- if (m_type == DepthStencil) {
- QRHI_PROF_F(newRenderBuffer(this, false, true, samples));
+ if (m_type == DepthStencil)
return true;
- }
qWarning("RenderBuffer: UsedWithSwapChainOnly is meaningless in combination with Color");
}
@@ -3217,43 +5447,87 @@ bool QGles2RenderBuffer::build()
rhiD->f->glRenderbufferStorage(GL_RENDERBUFFER, stencilStorage,
size.width(), size.height());
}
- QRHI_PROF_F(newRenderBuffer(this, false, false, samples));
break;
case QRhiRenderBuffer::Color:
- if (rhiD->caps.msaaRenderBuffer && samples > 1)
- rhiD->f->glRenderbufferStorageMultisample(GL_RENDERBUFFER, samples, GL_RGBA8,
+ {
+ GLenum internalFormat = GL_RGBA4; // ES 2.0
+ if (rhiD->caps.rgba8Format) {
+ internalFormat = GL_RGBA8;
+ if (m_backingFormatHint != QRhiTexture::UnknownFormat) {
+ GLenum glintformat, glformat, gltype;
+ // only care about the sized internal format, the rest is not used here
+ toGlTextureFormat(m_backingFormatHint, rhiD->caps,
+ &glintformat, &internalFormat, &glformat, &gltype);
+ }
+ }
+ if (rhiD->caps.msaaRenderBuffer && samples > 1) {
+ rhiD->f->glRenderbufferStorageMultisample(GL_RENDERBUFFER, samples, internalFormat,
size.width(), size.height());
- else
- rhiD->f->glRenderbufferStorage(GL_RENDERBUFFER, rhiD->caps.rgba8Format ? GL_RGBA8 : GL_RGBA4,
+ } else {
+ rhiD->f->glRenderbufferStorage(GL_RENDERBUFFER, internalFormat,
size.width(), size.height());
- QRHI_PROF_F(newRenderBuffer(this, false, false, samples));
+ }
+ }
break;
default:
Q_UNREACHABLE();
break;
}
+ if (rhiD->glObjectLabel)
+ rhiD->glObjectLabel(GL_RENDERBUFFER, renderbuffer, -1, m_objectName.constData());
+
+ owns = true;
+ generation += 1;
+ rhiD->registerResource(this);
+ return true;
+}
+
+bool QGles2RenderBuffer::createFrom(NativeRenderBuffer src)
+{
+ if (!src.object)
+ return false;
+
+ if (renderbuffer)
+ destroy();
+
+ QRHI_RES_RHI(QRhiGles2);
+ samples = rhiD->effectiveSampleCount(m_sampleCount);
+
+ if (m_flags.testFlag(UsedWithSwapChainOnly))
+ qWarning("RenderBuffer: UsedWithSwapChainOnly is meaningless when importing an existing native object");
+
+ if (!rhiD->ensureContext())
+ return false;
+
+ renderbuffer = src.object;
+
+ owns = false;
+ generation += 1;
rhiD->registerResource(this);
return true;
}
QRhiTexture::Format QGles2RenderBuffer::backingFormat() const
{
- return m_type == Color ? QRhiTexture::RGBA8 : QRhiTexture::UnknownFormat;
+ if (m_backingFormatHint != QRhiTexture::UnknownFormat)
+ return m_backingFormatHint;
+ else
+ return m_type == Color ? QRhiTexture::RGBA8 : QRhiTexture::UnknownFormat;
}
-QGles2Texture::QGles2Texture(QRhiImplementation *rhi, Format format, const QSize &pixelSize,
- int sampleCount, Flags flags)
- : QRhiTexture(rhi, format, pixelSize, sampleCount, flags)
+QGles2Texture::QGles2Texture(QRhiImplementation *rhi, Format format, const QSize &pixelSize, int depth,
+ int arraySize, int sampleCount, Flags flags)
+ : QRhiTexture(rhi, format, pixelSize, depth, arraySize, sampleCount, flags)
{
}
QGles2Texture::~QGles2Texture()
{
- release();
+ destroy();
}
-void QGles2Texture::release()
+void QGles2Texture::destroy()
{
if (!texture)
return;
@@ -3265,32 +5539,84 @@ void QGles2Texture::release()
texture = 0;
specified = false;
- nativeHandlesStruct.texture = 0;
+ zeroInitialized = false;
QRHI_RES_RHI(QRhiGles2);
- if (owns)
- rhiD->releaseQueue.append(e);
- QRHI_PROF;
- QRHI_PROF_F(releaseTexture(this));
- rhiD->unregisterResource(this);
+ if (rhiD) {
+ if (owns)
+ rhiD->releaseQueue.append(e);
+ rhiD->unregisterResource(this);
+ }
}
-bool QGles2Texture::prepareBuild(QSize *adjustedSize)
+bool QGles2Texture::prepareCreate(QSize *adjustedSize)
{
if (texture)
- release();
+ destroy();
QRHI_RES_RHI(QRhiGles2);
if (!rhiD->ensureContext())
return false;
- const QSize size = m_pixelSize.isEmpty() ? QSize(1, 1) : m_pixelSize;
-
const bool isCube = m_flags.testFlag(CubeMap);
+ const bool isArray = m_flags.testFlag(QRhiTexture::TextureArray);
+ const bool is3D = m_flags.testFlag(ThreeDimensional);
const bool hasMipMaps = m_flags.testFlag(MipMapped);
const bool isCompressed = rhiD->isCompressedFormat(m_format);
+ const bool is1D = m_flags.testFlag(OneDimensional);
+
+ const QSize size = is1D ? QSize(qMax(1, m_pixelSize.width()), 1)
+ : (m_pixelSize.isEmpty() ? QSize(1, 1) : m_pixelSize);
+
+ if (is3D && !rhiD->caps.texture3D) {
+ qWarning("3D textures are not supported");
+ return false;
+ }
+ if (isCube && is3D) {
+ qWarning("Texture cannot be both cube and 3D");
+ return false;
+ }
+ if (isArray && is3D) {
+ qWarning("Texture cannot be both array and 3D");
+ return false;
+ }
+ if (is1D && !rhiD->caps.texture1D) {
+ qWarning("1D textures are not supported");
+ return false;
+ }
+ if (is1D && is3D) {
+ qWarning("Texture cannot be both 1D and 3D");
+ return false;
+ }
+ if (is1D && isCube) {
+ qWarning("Texture cannot be both 1D and cube");
+ return false;
+ }
+
+ if (m_depth > 1 && !is3D) {
+ qWarning("Texture cannot have a depth of %d when it is not 3D", m_depth);
+ return false;
+ }
+ if (m_arraySize > 0 && !isArray) {
+ qWarning("Texture cannot have an array size of %d when it is not an array", m_arraySize);
+ return false;
+ }
+ if (m_arraySize < 1 && isArray) {
+ qWarning("Texture is an array but array size is %d", m_arraySize);
+ return false;
+ }
+
+ target = isCube ? GL_TEXTURE_CUBE_MAP
+ : m_sampleCount > 1 ? (isArray ? GL_TEXTURE_2D_MULTISAMPLE_ARRAY : GL_TEXTURE_2D_MULTISAMPLE)
+ : (is3D ? GL_TEXTURE_3D
+ : (is1D ? (isArray ? GL_TEXTURE_1D_ARRAY : GL_TEXTURE_1D)
+ : (isArray ? GL_TEXTURE_2D_ARRAY : GL_TEXTURE_2D)));
+
+ if (m_flags.testFlag(ExternalOES))
+ target = GL_TEXTURE_EXTERNAL_OES;
+ else if (m_flags.testFlag(TextureRectangleGL))
+ target = GL_TEXTURE_RECTANGLE;
- target = isCube ? GL_TEXTURE_CUBE_MAP : GL_TEXTURE_2D;
mipLevelCount = hasMipMaps ? rhiD->q->mipLevelsForSize(size) : 1;
gltype = GL_UNSIGNED_BYTE;
@@ -3307,64 +5633,8 @@ bool QGles2Texture::prepareBuild(QSize *adjustedSize)
glsizedintformat = glintformat;
glformat = GL_RGBA;
} else {
- switch (m_format) {
- case QRhiTexture::RGBA8:
- glintformat = GL_RGBA;
- glsizedintformat = rhiD->caps.rgba8Format ? GL_RGBA8 : GL_RGBA;
- glformat = GL_RGBA;
- break;
- case QRhiTexture::BGRA8:
- glintformat = rhiD->caps.bgraInternalFormat ? GL_BGRA : GL_RGBA;
- glsizedintformat = rhiD->caps.rgba8Format ? GL_RGBA8 : GL_RGBA;
- glformat = GL_BGRA;
- break;
- case QRhiTexture::R16:
- glintformat = GL_R16;
- glsizedintformat = glintformat;
- glformat = GL_RED;
- gltype = GL_UNSIGNED_SHORT;
- break;
- case QRhiTexture::R8:
- glintformat = GL_R8;
- glsizedintformat = glintformat;
- glformat = GL_RED;
- break;
- case QRhiTexture::RED_OR_ALPHA8:
- glintformat = rhiD->caps.coreProfile ? GL_R8 : GL_ALPHA;
- glsizedintformat = glintformat;
- glformat = rhiD->caps.coreProfile ? GL_RED : GL_ALPHA;
- break;
- case QRhiTexture::RGBA16F:
- glintformat = GL_RGBA16F;
- glsizedintformat = glintformat;
- glformat = GL_RGBA;
- gltype = GL_HALF_FLOAT;
- break;
- case QRhiTexture::RGBA32F:
- glintformat = GL_RGBA32F;
- glsizedintformat = glintformat;
- glformat = GL_RGBA;
- gltype = GL_FLOAT;
- break;
- case QRhiTexture::D16:
- glintformat = GL_DEPTH_COMPONENT16;
- glsizedintformat = glintformat;
- glformat = GL_DEPTH_COMPONENT;
- gltype = GL_UNSIGNED_SHORT;
- break;
- case QRhiTexture::D32F:
- glintformat = GL_DEPTH_COMPONENT32F;
- glsizedintformat = glintformat;
- glformat = GL_DEPTH_COMPONENT;
- gltype = GL_FLOAT;
- break;
- default:
- Q_UNREACHABLE();
- glintformat = GL_RGBA;
- glsizedintformat = rhiD->caps.rgba8Format ? GL_RGBA8 : GL_RGBA;
- glformat = GL_RGBA;
- break;
- }
+ toGlTextureFormat(m_format, rhiD->caps,
+ &glintformat, &glsizedintformat, &glformat, &gltype);
}
samplerState = QGles2SamplerData();
@@ -3377,22 +5647,48 @@ bool QGles2Texture::prepareBuild(QSize *adjustedSize)
return true;
}
-bool QGles2Texture::build()
+bool QGles2Texture::create()
{
QSize size;
- if (!prepareBuild(&size))
+ if (!prepareCreate(&size))
return false;
QRHI_RES_RHI(QRhiGles2);
rhiD->f->glGenTextures(1, &texture);
const bool isCube = m_flags.testFlag(CubeMap);
+ const bool isArray = m_flags.testFlag(QRhiTexture::TextureArray);
+ const bool is3D = m_flags.testFlag(ThreeDimensional);
const bool hasMipMaps = m_flags.testFlag(MipMapped);
const bool isCompressed = rhiD->isCompressedFormat(m_format);
+ const bool is1D = m_flags.testFlag(OneDimensional);
+
if (!isCompressed) {
rhiD->f->glBindTexture(target, texture);
if (!m_flags.testFlag(UsedWithLoadStore)) {
- if (hasMipMaps || isCube) {
+ if (is1D) {
+ for (int level = 0; level < mipLevelCount; ++level) {
+ const QSize mipSize = rhiD->q->sizeForMipLevel(level, size);
+ if (isArray)
+ rhiD->f->glTexImage2D(target, level, GLint(glintformat), mipSize.width(),
+ qMax(0, m_arraySize), 0, glformat, gltype, nullptr);
+ else
+ rhiD->glTexImage1D(target, level, GLint(glintformat), mipSize.width(), 0,
+ glformat, gltype, nullptr);
+ }
+ } else if (is3D || isArray) {
+ const int layerCount = is3D ? qMax(1, m_depth) : qMax(0, m_arraySize);
+ if (hasMipMaps) {
+ for (int level = 0; level != mipLevelCount; ++level) {
+ const QSize mipSize = rhiD->q->sizeForMipLevel(level, size);
+ rhiD->f->glTexImage3D(target, level, GLint(glintformat), mipSize.width(), mipSize.height(), layerCount,
+ 0, glformat, gltype, nullptr);
+ }
+ } else {
+ rhiD->f->glTexImage3D(target, 0, GLint(glintformat), size.width(), size.height(), layerCount,
+ 0, glformat, gltype, nullptr);
+ }
+ } else if (hasMipMaps || isCube) {
const GLenum faceTargetBase = isCube ? GL_TEXTURE_CUBE_MAP_POSITIVE_X : target;
for (int layer = 0, layerCount = isCube ? 6 : 1; layer != layerCount; ++layer) {
for (int level = 0; level != mipLevelCount; ++level) {
@@ -3403,14 +5699,32 @@ bool QGles2Texture::build()
}
}
} else {
- rhiD->f->glTexImage2D(target, 0, GLint(glintformat), size.width(), size.height(),
- 0, glformat, gltype, nullptr);
+ // 2D texture. For multisample textures the GLES 3.1
+ // glStorage2DMultisample must be used for portability.
+ if (m_sampleCount > 1 && rhiD->caps.multisampledTexture) {
+ // internal format must be sized
+ rhiD->f->glTexStorage2DMultisample(target, m_sampleCount, glsizedintformat,
+ size.width(), size.height(), GL_TRUE);
+ } else {
+ rhiD->f->glTexImage2D(target, 0, GLint(glintformat), size.width(), size.height(),
+ 0, glformat, gltype, nullptr);
+ }
}
} else {
// Must be specified with immutable storage functions otherwise
// bindImageTexture may fail. Also, the internal format must be a
// sized format here.
- rhiD->f->glTexStorage2D(target, mipLevelCount, glsizedintformat, size.width(), size.height());
+ if (is1D && !isArray)
+ rhiD->glTexStorage1D(target, mipLevelCount, glsizedintformat, size.width());
+ else if (!is1D && (is3D || isArray))
+ rhiD->f->glTexStorage3D(target, mipLevelCount, glsizedintformat, size.width(), size.height(),
+ is3D ? qMax(1, m_depth) : qMax(0, m_arraySize));
+ else if (m_sampleCount > 1)
+ rhiD->f->glTexStorage2DMultisample(target, m_sampleCount, glsizedintformat,
+ size.width(), size.height(), GL_TRUE);
+ else
+ rhiD->f->glTexStorage2D(target, mipLevelCount, glsizedintformat, size.width(),
+ is1D ? qMax(0, m_arraySize) : size.height());
}
specified = true;
} else {
@@ -3420,92 +5734,61 @@ bool QGles2Texture::build()
specified = false;
}
- QRHI_PROF;
- QRHI_PROF_F(newTexture(this, true, mipLevelCount, isCube ? 6 : 1, 1));
+ if (rhiD->glObjectLabel)
+ rhiD->glObjectLabel(GL_TEXTURE, texture, -1, m_objectName.constData());
owns = true;
- nativeHandlesStruct.texture = texture;
generation += 1;
rhiD->registerResource(this);
return true;
}
-bool QGles2Texture::buildFrom(const QRhiNativeHandles *src)
+bool QGles2Texture::createFrom(QRhiTexture::NativeTexture src)
{
- const QRhiGles2TextureNativeHandles *h = static_cast<const QRhiGles2TextureNativeHandles *>(src);
- if (!h || !h->texture)
+ const uint textureId = uint(src.object);
+ if (textureId == 0)
return false;
- if (!prepareBuild())
+ if (!prepareCreate())
return false;
- texture = h->texture;
+ texture = textureId;
specified = true;
-
- QRHI_RES_RHI(QRhiGles2);
- QRHI_PROF;
- QRHI_PROF_F(newTexture(this, false, mipLevelCount, m_flags.testFlag(CubeMap) ? 6 : 1, 1));
+ zeroInitialized = true;
owns = false;
- nativeHandlesStruct.texture = texture;
generation += 1;
- rhiD->registerResource(this);
- return true;
-}
-
-bool QGles2Texture::buildFrom(QRhiTexture::NativeTexture src)
-{
- const uint *textureId = static_cast<const uint *>(src.object);
- if (!textureId || !*textureId)
- return false;
-
- if (!prepareBuild())
- return false;
-
- texture = *textureId;
- specified = true;
-
QRHI_RES_RHI(QRhiGles2);
- QRHI_PROF;
- QRHI_PROF_F(newTexture(this, false, mipLevelCount, m_flags.testFlag(CubeMap) ? 6 : 1, 1));
-
- owns = false;
- nativeHandlesStruct.texture = texture;
-
- generation += 1;
rhiD->registerResource(this);
return true;
}
-const QRhiNativeHandles *QGles2Texture::nativeHandles()
-{
- return &nativeHandlesStruct;
-}
-
QRhiTexture::NativeTexture QGles2Texture::nativeTexture()
{
- return {&nativeHandlesStruct.texture, 0};
+ return {texture, 0};
}
QGles2Sampler::QGles2Sampler(QRhiImplementation *rhi, Filter magFilter, Filter minFilter, Filter mipmapMode,
- AddressMode u, AddressMode v)
- : QRhiSampler(rhi, magFilter, minFilter, mipmapMode, u, v)
+ AddressMode u, AddressMode v, AddressMode w)
+ : QRhiSampler(rhi, magFilter, minFilter, mipmapMode, u, v, w)
{
}
QGles2Sampler::~QGles2Sampler()
{
- release();
+ destroy();
}
-void QGles2Sampler::release()
+void QGles2Sampler::destroy()
{
- // nothing to do here
+ QRHI_RES_RHI(QRhiGles2);
+ if (rhiD)
+ rhiD->unregisterResource(this);
}
-bool QGles2Sampler::build()
+bool QGles2Sampler::create()
{
d.glminfilter = toGlMinFilter(m_minFilter, m_mipmapMode);
d.glmagfilter = toGlMagFilter(m_magFilter);
@@ -3515,6 +5798,8 @@ bool QGles2Sampler::build()
d.gltexcomparefunc = toGlTextureCompareFunc(m_compareOp);
generation += 1;
+ QRHI_RES_RHI(QRhiGles2);
+ rhiD->registerResource(this, false);
return true;
}
@@ -3526,12 +5811,14 @@ QGles2RenderPassDescriptor::QGles2RenderPassDescriptor(QRhiImplementation *rhi)
QGles2RenderPassDescriptor::~QGles2RenderPassDescriptor()
{
- release();
+ destroy();
}
-void QGles2RenderPassDescriptor::release()
+void QGles2RenderPassDescriptor::destroy()
{
- // nothing to do here
+ QRHI_RES_RHI(QRhiGles2);
+ if (rhiD)
+ rhiD->unregisterResource(this);
}
bool QGles2RenderPassDescriptor::isCompatible(const QRhiRenderPassDescriptor *other) const
@@ -3540,33 +5827,46 @@ bool QGles2RenderPassDescriptor::isCompatible(const QRhiRenderPassDescriptor *ot
return true;
}
-QGles2ReferenceRenderTarget::QGles2ReferenceRenderTarget(QRhiImplementation *rhi)
- : QRhiRenderTarget(rhi),
+QRhiRenderPassDescriptor *QGles2RenderPassDescriptor::newCompatibleRenderPassDescriptor() const
+{
+ QGles2RenderPassDescriptor *rpD = new QGles2RenderPassDescriptor(m_rhi);
+ QRHI_RES_RHI(QRhiGles2);
+ rhiD->registerResource(rpD, false);
+ return rpD;
+}
+
+QVector<quint32> QGles2RenderPassDescriptor::serializedFormat() const
+{
+ return {};
+}
+
+QGles2SwapChainRenderTarget::QGles2SwapChainRenderTarget(QRhiImplementation *rhi, QRhiSwapChain *swapchain)
+ : QRhiSwapChainRenderTarget(rhi, swapchain),
d(rhi)
{
}
-QGles2ReferenceRenderTarget::~QGles2ReferenceRenderTarget()
+QGles2SwapChainRenderTarget::~QGles2SwapChainRenderTarget()
{
- release();
+ destroy();
}
-void QGles2ReferenceRenderTarget::release()
+void QGles2SwapChainRenderTarget::destroy()
{
// nothing to do here
}
-QSize QGles2ReferenceRenderTarget::pixelSize() const
+QSize QGles2SwapChainRenderTarget::pixelSize() const
{
return d.pixelSize;
}
-float QGles2ReferenceRenderTarget::devicePixelRatio() const
+float QGles2SwapChainRenderTarget::devicePixelRatio() const
{
return d.dpr;
}
-int QGles2ReferenceRenderTarget::sampleCount() const
+int QGles2SwapChainRenderTarget::sampleCount() const
{
return d.sampleCount;
}
@@ -3581,10 +5881,10 @@ QGles2TextureRenderTarget::QGles2TextureRenderTarget(QRhiImplementation *rhi,
QGles2TextureRenderTarget::~QGles2TextureRenderTarget()
{
- release();
+ destroy();
}
-void QGles2TextureRenderTarget::release()
+void QGles2TextureRenderTarget::destroy()
{
if (!framebuffer)
return;
@@ -3593,34 +5893,40 @@ void QGles2TextureRenderTarget::release()
e.type = QRhiGles2::DeferredReleaseEntry::TextureRenderTarget;
e.textureRenderTarget.framebuffer = framebuffer;
+ e.textureRenderTarget.nonMsaaThrowawayDepthTexture = nonMsaaThrowawayDepthTexture;
framebuffer = 0;
+ nonMsaaThrowawayDepthTexture = 0;
QRHI_RES_RHI(QRhiGles2);
- rhiD->releaseQueue.append(e);
-
- rhiD->unregisterResource(this);
+ if (rhiD) {
+ rhiD->releaseQueue.append(e);
+ rhiD->unregisterResource(this);
+ }
}
QRhiRenderPassDescriptor *QGles2TextureRenderTarget::newCompatibleRenderPassDescriptor()
{
- return new QGles2RenderPassDescriptor(m_rhi);
+ QGles2RenderPassDescriptor *rpD = new QGles2RenderPassDescriptor(m_rhi);
+ QRHI_RES_RHI(QRhiGles2);
+ rhiD->registerResource(rpD, false);
+ return rpD;
}
-bool QGles2TextureRenderTarget::build()
+bool QGles2TextureRenderTarget::create()
{
QRHI_RES_RHI(QRhiGles2);
if (framebuffer)
- release();
+ destroy();
- const bool hasColorAttachments = m_desc.cbeginColorAttachments() != m_desc.cendColorAttachments();
+ const bool hasColorAttachments = m_desc.colorAttachmentCount() > 0;
Q_ASSERT(hasColorAttachments || m_desc.depthTexture());
Q_ASSERT(!m_desc.depthStencilBuffer() || !m_desc.depthTexture());
const bool hasDepthStencil = m_desc.depthStencilBuffer() || m_desc.depthTexture();
if (hasColorAttachments) {
- const int count = m_desc.cendColorAttachments() - m_desc.cbeginColorAttachments();
+ const int count = int(m_desc.colorAttachmentCount());
if (count > rhiD->caps.maxDrawBuffers) {
qWarning("QGles2TextureRenderTarget: Too many color attachments (%d, max is %d)",
count, rhiD->caps.maxDrawBuffers);
@@ -3637,6 +5943,7 @@ bool QGles2TextureRenderTarget::build()
d.colorAttCount = 0;
int attIndex = 0;
+ int multiViewCount = 0;
for (auto it = m_desc.cbeginColorAttachments(), itEnd = m_desc.cendColorAttachments(); it != itEnd; ++it, ++attIndex) {
d.colorAttCount += 1;
const QRhiColorAttachment &colorAtt(*it);
@@ -3646,12 +5953,57 @@ bool QGles2TextureRenderTarget::build()
if (texture) {
QGles2Texture *texD = QRHI_RES(QGles2Texture, texture);
Q_ASSERT(texD->texture && texD->specified);
- const GLenum faceTargetBase = texD->flags().testFlag(QRhiTexture::CubeMap) ? GL_TEXTURE_CUBE_MAP_POSITIVE_X : texD->target;
- rhiD->f->glFramebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0 + uint(attIndex), faceTargetBase + uint(colorAtt.layer()),
- texD->texture, colorAtt.level());
+ if (texD->flags().testFlag(QRhiTexture::ThreeDimensional) || texD->flags().testFlag(QRhiTexture::TextureArray)) {
+ if (colorAtt.multiViewCount() < 2) {
+ rhiD->f->glFramebufferTextureLayer(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0 + uint(attIndex), texD->texture,
+ colorAtt.level(), colorAtt.layer());
+ } else {
+ multiViewCount = colorAtt.multiViewCount();
+ if (texD->sampleCount() > 1 && rhiD->caps.glesMultiviewMultisampleRenderToTexture && colorAtt.resolveTexture()) {
+ // Special path for GLES and GL_OVR_multiview_multisampled_render_to_texture:
+ // ignore the color attachment's (multisample) texture
+ // array and give the resolve texture array to GL. (no
+ // explicit resolving is needed by us later on)
+ QGles2Texture *resolveTexD = QRHI_RES(QGles2Texture, colorAtt.resolveTexture());
+ rhiD->glFramebufferTextureMultisampleMultiviewOVR(GL_FRAMEBUFFER,
+ GL_COLOR_ATTACHMENT0 + uint(attIndex),
+ resolveTexD->texture,
+ colorAtt.resolveLevel(),
+ texD->sampleCount(),
+ colorAtt.resolveLayer(),
+ multiViewCount);
+ } else {
+ rhiD->glFramebufferTextureMultiviewOVR(GL_FRAMEBUFFER,
+ GL_COLOR_ATTACHMENT0 + uint(attIndex),
+ texD->texture,
+ colorAtt.level(),
+ colorAtt.layer(),
+ multiViewCount);
+ }
+ }
+ } else if (texD->flags().testFlag(QRhiTexture::OneDimensional)) {
+ rhiD->glFramebufferTexture1D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0 + uint(attIndex),
+ texD->target + uint(colorAtt.layer()), texD->texture,
+ colorAtt.level());
+ } else {
+ if (texD->sampleCount() > 1 && rhiD->caps.glesMultisampleRenderToTexture && colorAtt.resolveTexture()) {
+ // Special path for GLES and GL_EXT_multisampled_render_to_texture:
+ // ignore the color attachment's (multisample) texture and
+ // give the resolve texture to GL. (no explicit resolving is
+ // needed by us later on)
+ QGles2Texture *resolveTexD = QRHI_RES(QGles2Texture, colorAtt.resolveTexture());
+ const GLenum faceTargetBase = resolveTexD->flags().testFlag(QRhiTexture::CubeMap) ? GL_TEXTURE_CUBE_MAP_POSITIVE_X : resolveTexD->target;
+ rhiD->glFramebufferTexture2DMultisampleEXT(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0 + uint(attIndex), faceTargetBase + uint(colorAtt.resolveLayer()),
+ resolveTexD->texture, colorAtt.level(), texD->sampleCount());
+ } else {
+ const GLenum faceTargetBase = texD->flags().testFlag(QRhiTexture::CubeMap) ? GL_TEXTURE_CUBE_MAP_POSITIVE_X : texD->target;
+ rhiD->f->glFramebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0 + uint(attIndex), faceTargetBase + uint(colorAtt.layer()),
+ texD->texture, colorAtt.level());
+ }
+ }
if (attIndex == 0) {
- d.pixelSize = texD->pixelSize();
- d.sampleCount = 1;
+ d.pixelSize = rhiD->q->sizeForMipLevel(colorAtt.level(), texD->pixelSize());
+ d.sampleCount = texD->sampleCount();
}
} else if (renderBuffer) {
QGles2RenderBuffer *rbD = QRHI_RES(QGles2RenderBuffer, renderBuffer);
@@ -3672,12 +6024,14 @@ bool QGles2TextureRenderTarget::build()
} else {
rhiD->f->glFramebufferRenderbuffer(GL_FRAMEBUFFER, GL_DEPTH_ATTACHMENT, GL_RENDERBUFFER,
depthRbD->renderbuffer);
- if (depthRbD->stencilRenderbuffer)
+ if (depthRbD->stencilRenderbuffer) {
rhiD->f->glFramebufferRenderbuffer(GL_FRAMEBUFFER, GL_STENCIL_ATTACHMENT, GL_RENDERBUFFER,
depthRbD->stencilRenderbuffer);
- else // packed
+ } else {
+ // packed depth-stencil
rhiD->f->glFramebufferRenderbuffer(GL_FRAMEBUFFER, GL_STENCIL_ATTACHMENT, GL_RENDERBUFFER,
depthRbD->renderbuffer);
+ }
}
if (d.colorAttCount == 0) {
d.pixelSize = depthRbD->pixelSize();
@@ -3685,10 +6039,105 @@ bool QGles2TextureRenderTarget::build()
}
} else {
QGles2Texture *depthTexD = QRHI_RES(QGles2Texture, m_desc.depthTexture());
- rhiD->f->glFramebufferTexture2D(GL_FRAMEBUFFER, GL_DEPTH_ATTACHMENT, GL_TEXTURE_2D, depthTexD->texture, 0);
+ if (multiViewCount < 2) {
+ if (depthTexD->sampleCount() > 1 && rhiD->caps.glesMultisampleRenderToTexture && m_desc.depthResolveTexture()) {
+ // Special path for GLES and
+ // GL_EXT_multisampled_render_to_texture, for depth-stencil.
+ // Relevant only when depthResolveTexture is set.
+ QGles2Texture *depthResolveTexD = QRHI_RES(QGles2Texture, m_desc.depthResolveTexture());
+ rhiD->glFramebufferTexture2DMultisampleEXT(GL_FRAMEBUFFER, GL_DEPTH_ATTACHMENT, depthResolveTexD->target,
+ depthResolveTexD->texture, 0, depthTexD->sampleCount());
+ if (rhiD->isStencilSupportingFormat(depthResolveTexD->format())) {
+ rhiD->glFramebufferTexture2DMultisampleEXT(GL_FRAMEBUFFER, GL_STENCIL_ATTACHMENT, depthResolveTexD->target,
+ depthResolveTexD->texture, 0, depthTexD->sampleCount());
+ }
+ } else {
+ rhiD->f->glFramebufferTexture2D(GL_FRAMEBUFFER, GL_DEPTH_ATTACHMENT, depthTexD->target,
+ depthTexD->texture, 0);
+ if (rhiD->isStencilSupportingFormat(depthTexD->format())) {
+ rhiD->f->glFramebufferTexture2D(GL_FRAMEBUFFER, GL_STENCIL_ATTACHMENT, depthTexD->target,
+ depthTexD->texture, 0);
+ }
+ }
+ } else {
+ if (depthTexD->sampleCount() > 1 && rhiD->caps.glesMultiviewMultisampleRenderToTexture) {
+ // And so it turns out
+ // https://registry.khronos.org/OpenGL/extensions/OVR/OVR_multiview.txt
+ // does not work with multisample 2D texture arrays. (at least
+ // that's what Issue 30 in the extension spec seems to imply)
+ //
+ // There is https://registry.khronos.org/OpenGL/extensions/EXT/EXT_multiview_texture_multisample.txt
+ // that seems to resolve that, but that does not seem to
+ // work (or not available) on GLES devices such as the Quest 3.
+ //
+ // So instead, on GLES we can use the
+ // multisample-multiview-auto-resolving version (which in
+ // turn is not supported on desktop GL e.g. by NVIDIA), too
+ // bad we have a multisample depth texture array here as
+ // every other API out there requires that. So, in absence
+ // of a depthResolveTexture, create a temporary one ignoring
+ // what the user has already created.
+ //
+ if (!m_flags.testFlag(DoNotStoreDepthStencilContents) && !m_desc.depthResolveTexture()) {
+ qWarning("Attempted to create a multiview+multisample QRhiTextureRenderTarget, but DoNotStoreDepthStencilContents was not set."
+ " This path has no choice but to behave as if DoNotStoreDepthStencilContents was set, because QRhi is forced to create"
+ " a throwaway non-multisample depth texture here. Set the flag to silence this warning, or set a depthResolveTexture.");
+ }
+ if (m_desc.depthResolveTexture()) {
+ QGles2Texture *depthResolveTexD = QRHI_RES(QGles2Texture, m_desc.depthResolveTexture());
+ rhiD->glFramebufferTextureMultisampleMultiviewOVR(GL_FRAMEBUFFER,
+ GL_DEPTH_ATTACHMENT,
+ depthResolveTexD->texture,
+ 0,
+ depthTexD->sampleCount(),
+ 0,
+ multiViewCount);
+ if (rhiD->isStencilSupportingFormat(depthResolveTexD->format())) {
+ rhiD->glFramebufferTextureMultisampleMultiviewOVR(GL_FRAMEBUFFER,
+ GL_STENCIL_ATTACHMENT,
+ depthResolveTexD->texture,
+ 0,
+ depthTexD->sampleCount(),
+ 0,
+ multiViewCount);
+ }
+ } else {
+ if (!nonMsaaThrowawayDepthTexture) {
+ rhiD->f->glGenTextures(1, &nonMsaaThrowawayDepthTexture);
+ rhiD->f->glBindTexture(GL_TEXTURE_2D_ARRAY, nonMsaaThrowawayDepthTexture);
+ rhiD->f->glTexStorage3D(GL_TEXTURE_2D_ARRAY, 1, GL_DEPTH24_STENCIL8,
+ depthTexD->pixelSize().width(), depthTexD->pixelSize().height(), multiViewCount);
+ }
+ rhiD->glFramebufferTextureMultisampleMultiviewOVR(GL_FRAMEBUFFER,
+ GL_DEPTH_ATTACHMENT,
+ nonMsaaThrowawayDepthTexture,
+ 0,
+ depthTexD->sampleCount(),
+ 0,
+ multiViewCount);
+ rhiD->glFramebufferTextureMultisampleMultiviewOVR(GL_FRAMEBUFFER,
+ GL_STENCIL_ATTACHMENT,
+ nonMsaaThrowawayDepthTexture,
+ 0,
+ depthTexD->sampleCount(),
+ 0,
+ multiViewCount);
+ }
+ } else {
+ // The depth texture here must be an array with at least
+ // multiViewCount elements, and the format should be D24 or D32F
+ // for depth only, or D24S8 for depth and stencil.
+ rhiD->glFramebufferTextureMultiviewOVR(GL_FRAMEBUFFER, GL_DEPTH_ATTACHMENT, depthTexD->texture,
+ 0, 0, multiViewCount);
+ if (rhiD->isStencilSupportingFormat(depthTexD->format())) {
+ rhiD->glFramebufferTextureMultiviewOVR(GL_FRAMEBUFFER, GL_STENCIL_ATTACHMENT, depthTexD->texture,
+ 0, 0, multiViewCount);
+ }
+ }
+ }
if (d.colorAttCount == 0) {
d.pixelSize = depthTexD->pixelSize();
- d.sampleCount = 1;
+ d.sampleCount = depthTexD->sampleCount();
}
}
d.dsAttCount = 1;
@@ -3705,12 +6154,20 @@ bool QGles2TextureRenderTarget::build()
return false;
}
+ if (rhiD->glObjectLabel)
+ rhiD->glObjectLabel(GL_FRAMEBUFFER, framebuffer, -1, m_objectName.constData());
+
+ QRhiRenderTargetAttachmentTracker::updateResIdList<QGles2Texture, QGles2RenderBuffer>(m_desc, &d.currentResIdList);
+
rhiD->registerResource(this);
return true;
}
QSize QGles2TextureRenderTarget::pixelSize() const
{
+ if (!QRhiRenderTargetAttachmentTracker::isUpToDate<QGles2Texture, QGles2RenderBuffer>(m_desc, d.currentResIdList))
+ const_cast<QGles2TextureRenderTarget *>(this)->create();
+
return d.pixelSize;
}
@@ -3731,20 +6188,46 @@ QGles2ShaderResourceBindings::QGles2ShaderResourceBindings(QRhiImplementation *r
QGles2ShaderResourceBindings::~QGles2ShaderResourceBindings()
{
- release();
+ destroy();
}
-void QGles2ShaderResourceBindings::release()
+void QGles2ShaderResourceBindings::destroy()
{
- // nothing to do here
+ QRHI_RES_RHI(QRhiGles2);
+ if (rhiD)
+ rhiD->unregisterResource(this);
}
-bool QGles2ShaderResourceBindings::build()
+bool QGles2ShaderResourceBindings::create()
{
+ QRHI_RES_RHI(QRhiGles2);
+ if (!rhiD->sanityCheckShaderResourceBindings(this))
+ return false;
+
+ hasDynamicOffset = false;
+ for (int i = 0, ie = m_bindings.size(); i != ie; ++i) {
+ const QRhiShaderResourceBinding::Data *b = QRhiImplementation::shaderResourceBindingData(m_bindings.at(i));
+ if (b->type == QRhiShaderResourceBinding::UniformBuffer) {
+ if (b->u.ubuf.hasDynamicOffset) {
+ hasDynamicOffset = true;
+ break;
+ }
+ }
+ }
+
+ rhiD->updateLayoutDesc(this);
+
generation += 1;
+ rhiD->registerResource(this, false);
return true;
}
+void QGles2ShaderResourceBindings::updateResources(UpdateFlags flags)
+{
+ Q_UNUSED(flags);
+ generation += 1;
+}
+
QGles2GraphicsPipeline::QGles2GraphicsPipeline(QRhiImplementation *rhi)
: QRhiGraphicsPipeline(rhi)
{
@@ -3752,10 +6235,10 @@ QGles2GraphicsPipeline::QGles2GraphicsPipeline(QRhiImplementation *rhi)
QGles2GraphicsPipeline::~QGles2GraphicsPipeline()
{
- release();
+ destroy();
}
-void QGles2GraphicsPipeline::release()
+void QGles2GraphicsPipeline::destroy()
{
if (!program)
return;
@@ -3770,21 +6253,33 @@ void QGles2GraphicsPipeline::release()
samplers.clear();
QRHI_RES_RHI(QRhiGles2);
- rhiD->releaseQueue.append(e);
+ if (rhiD) {
+ rhiD->releaseQueue.append(e);
+ rhiD->unregisterResource(this);
+ }
+}
- rhiD->unregisterResource(this);
+static inline bool isGraphicsStage(const QRhiShaderStage &shaderStage)
+{
+ const QRhiShaderStage::Type t = shaderStage.type();
+ return t == QRhiShaderStage::Vertex
+ || t == QRhiShaderStage::TessellationControl
+ || t == QRhiShaderStage::TessellationEvaluation
+ || t == QRhiShaderStage::Geometry
+ || t == QRhiShaderStage::Fragment;
}
-bool QGles2GraphicsPipeline::build()
+bool QGles2GraphicsPipeline::create()
{
QRHI_RES_RHI(QRhiGles2);
if (program)
- release();
+ destroy();
if (!rhiD->ensureContext())
return false;
+ rhiD->pipelineCreationStart();
if (!rhiD->sanityCheckGraphicsPipeline(this))
return false;
@@ -3792,55 +6287,126 @@ bool QGles2GraphicsPipeline::build()
program = rhiD->f->glCreateProgram();
- QByteArray diskCacheKey;
- QRhiGles2::DiskCacheResult diskCacheResult = rhiD->tryLoadFromDiskCache(m_shaderStages.constData(),
- m_shaderStages.count(),
- program,
- &diskCacheKey);
- if (diskCacheResult == QRhiGles2::DiskCacheError)
+ enum {
+ VtxIdx = 0,
+ TCIdx,
+ TEIdx,
+ GeomIdx,
+ FragIdx,
+ LastIdx
+ };
+ const auto descIdxForStage = [](const QRhiShaderStage &shaderStage) {
+ switch (shaderStage.type()) {
+ case QRhiShaderStage::Vertex:
+ return VtxIdx;
+ case QRhiShaderStage::TessellationControl:
+ return TCIdx;
+ case QRhiShaderStage::TessellationEvaluation:
+ return TEIdx;
+ case QRhiShaderStage::Geometry:
+ return GeomIdx;
+ case QRhiShaderStage::Fragment:
+ return FragIdx;
+ default:
+ break;
+ }
+ Q_UNREACHABLE_RETURN(VtxIdx);
+ };
+ QShaderDescription desc[LastIdx];
+ QShader::SeparateToCombinedImageSamplerMappingList samplerMappingList[LastIdx];
+ bool vertexFragmentOnly = true;
+ for (const QRhiShaderStage &shaderStage : std::as_const(m_shaderStages)) {
+ if (isGraphicsStage(shaderStage)) {
+ const int idx = descIdxForStage(shaderStage);
+ if (idx != VtxIdx && idx != FragIdx)
+ vertexFragmentOnly = false;
+ QShader shader = shaderStage.shader();
+ QShaderVersion shaderVersion;
+ desc[idx] = shader.description();
+ if (!rhiD->shaderSource(shaderStage, &shaderVersion).isEmpty()) {
+ samplerMappingList[idx] = shader.separateToCombinedImageSamplerMappingList(
+ { QShader::GlslShader, shaderVersion, shaderStage.shaderVariant() });
+ }
+ }
+ }
+
+ QByteArray cacheKey;
+ QRhiGles2::ProgramCacheResult cacheResult = rhiD->tryLoadFromDiskOrPipelineCache(m_shaderStages.constData(),
+ m_shaderStages.size(),
+ program,
+ desc[VtxIdx].inputVariables(),
+ &cacheKey);
+ if (cacheResult == QRhiGles2::ProgramCacheError)
return false;
- const bool needsCompile = diskCacheResult == QRhiGles2::DiskCacheMiss;
+ if (cacheResult == QRhiGles2::ProgramCacheMiss) {
+ for (const QRhiShaderStage &shaderStage : std::as_const(m_shaderStages)) {
+ if (isGraphicsStage(shaderStage)) {
+ if (!rhiD->compileShader(program, shaderStage, nullptr))
+ return false;
+ }
+ }
+
+ // important when GLSL <= 150 is used that does not have location qualifiers
+ for (const QShaderDescription::InOutVariable &inVar : desc[VtxIdx].inputVariables())
+ rhiD->f->glBindAttribLocation(program, GLuint(inVar.location), inVar.name);
+
+ if (vertexFragmentOnly)
+ rhiD->sanityCheckVertexFragmentInterface(desc[VtxIdx], desc[FragIdx]);
- QShaderDescription vsDesc;
- QShaderDescription fsDesc;
- for (const QRhiShaderStage &shaderStage : qAsConst(m_shaderStages)) {
- const bool isVertex = shaderStage.type() == QRhiShaderStage::Vertex;
- const bool isFragment = shaderStage.type() == QRhiShaderStage::Fragment;
- if (isVertex) {
- if (needsCompile && !rhiD->compileShader(program, shaderStage, nullptr))
- return false;
- vsDesc = shaderStage.shader().description();
- } else if (isFragment) {
- if (needsCompile && !rhiD->compileShader(program, shaderStage, nullptr))
- return false;
- fsDesc = shaderStage.shader().description();
+ if (!rhiD->linkProgram(program))
+ return false;
+
+ if (rhiD->rhiFlags.testFlag(QRhi::EnablePipelineCacheDataSave)) {
+ // force replacing existing cache entry (if there is one, then
+ // something is wrong with it, as there was no hit)
+ rhiD->trySaveToPipelineCache(program, cacheKey, true);
+ } else {
+ // legacy QOpenGLShaderProgram style behavior: the "pipeline cache"
+ // was not enabled, so instead store to the Qt 5 disk cache
+ rhiD->trySaveToDiskCache(program, cacheKey);
+ }
+ } else {
+ Q_ASSERT(cacheResult == QRhiGles2::ProgramCacheHit);
+ if (rhiD->rhiFlags.testFlag(QRhi::EnablePipelineCacheDataSave)) {
+ // just so that it ends up in the pipeline cache also when the hit was
+ // from the disk cache
+ rhiD->trySaveToPipelineCache(program, cacheKey);
}
}
- for (auto inVar : vsDesc.inputVariables()) {
- const QByteArray name = inVar.name.toUtf8();
- rhiD->f->glBindAttribLocation(program, GLuint(inVar.location), name.constData());
+ // Use the same work area for the vertex & fragment stages, thus ensuring
+ // that we will not do superfluous glUniform calls for uniforms that are
+ // present in both shaders.
+ QDuplicateTracker<int, 256> activeUniformLocations;
+
+ for (const QRhiShaderStage &shaderStage : std::as_const(m_shaderStages)) {
+ if (isGraphicsStage(shaderStage)) {
+ const int idx = descIdxForStage(shaderStage);
+ for (const QShaderDescription::UniformBlock &ub : desc[idx].uniformBlocks())
+ rhiD->gatherUniforms(program, ub, &activeUniformLocations, &uniforms);
+ for (const QShaderDescription::InOutVariable &v : desc[idx].combinedImageSamplers())
+ rhiD->gatherSamplers(program, v, &samplers);
+ for (const QShader::SeparateToCombinedImageSamplerMapping &mapping : samplerMappingList[idx])
+ rhiD->gatherGeneratedSamplers(program, mapping, &samplers);
+ }
}
- if (needsCompile && !rhiD->linkProgram(program))
- return false;
-
- if (needsCompile)
- rhiD->trySaveToDiskCache(program, diskCacheKey);
-
- for (const QShaderDescription::UniformBlock &ub : vsDesc.uniformBlocks())
- rhiD->gatherUniforms(program, ub, &uniforms);
+ std::sort(uniforms.begin(), uniforms.end(),
+ [](const QGles2UniformDescription &a, const QGles2UniformDescription &b)
+ {
+ return a.offset < b.offset;
+ });
- for (const QShaderDescription::UniformBlock &ub : fsDesc.uniformBlocks())
- rhiD->gatherUniforms(program, ub, &uniforms);
+ memset(uniformState, 0, sizeof(uniformState));
- for (const QShaderDescription::InOutVariable &v : vsDesc.combinedImageSamplers())
- rhiD->gatherSamplers(program, v, &samplers);
+ currentSrb = nullptr;
+ currentSrbGeneration = 0;
- for (const QShaderDescription::InOutVariable &v : fsDesc.combinedImageSamplers())
- rhiD->gatherSamplers(program, v, &samplers);
+ if (rhiD->glObjectLabel)
+ rhiD->glObjectLabel(GL_PROGRAM, program, -1, m_objectName.constData());
+ rhiD->pipelineCreationEnd();
generation += 1;
rhiD->registerResource(this);
return true;
@@ -3853,10 +6419,10 @@ QGles2ComputePipeline::QGles2ComputePipeline(QRhiImplementation *rhi)
QGles2ComputePipeline::~QGles2ComputePipeline()
{
- release();
+ destroy();
}
-void QGles2ComputePipeline::release()
+void QGles2ComputePipeline::destroy()
{
if (!program)
return;
@@ -3871,49 +6437,80 @@ void QGles2ComputePipeline::release()
samplers.clear();
QRHI_RES_RHI(QRhiGles2);
- rhiD->releaseQueue.append(e);
-
- rhiD->unregisterResource(this);
+ if (rhiD) {
+ rhiD->releaseQueue.append(e);
+ rhiD->unregisterResource(this);
+ }
}
-bool QGles2ComputePipeline::build()
+bool QGles2ComputePipeline::create()
{
QRHI_RES_RHI(QRhiGles2);
if (program)
- release();
+ destroy();
if (!rhiD->ensureContext())
return false;
- program = rhiD->f->glCreateProgram();
- QShaderDescription csDesc;
+ rhiD->pipelineCreationStart();
- QByteArray diskCacheKey;
- QRhiGles2::DiskCacheResult diskCacheResult = rhiD->tryLoadFromDiskCache(&m_shaderStage, 1, program, &diskCacheKey);
- if (diskCacheResult == QRhiGles2::DiskCacheError)
- return false;
+ const QShaderDescription csDesc = m_shaderStage.shader().description();
+ QShader::SeparateToCombinedImageSamplerMappingList csSamplerMappingList;
+ QShaderVersion shaderVersion;
+ if (!rhiD->shaderSource(m_shaderStage, &shaderVersion).isEmpty()) {
+ csSamplerMappingList = m_shaderStage.shader().separateToCombinedImageSamplerMappingList(
+ { QShader::GlslShader, shaderVersion, m_shaderStage.shaderVariant() });
+ }
- const bool needsCompile = diskCacheResult == QRhiGles2::DiskCacheMiss;
+ program = rhiD->f->glCreateProgram();
- if (needsCompile && !rhiD->compileShader(program, m_shaderStage, nullptr))
+ QByteArray cacheKey;
+ QRhiGles2::ProgramCacheResult cacheResult = rhiD->tryLoadFromDiskOrPipelineCache(&m_shaderStage, 1, program, {}, &cacheKey);
+ if (cacheResult == QRhiGles2::ProgramCacheError)
return false;
- csDesc = m_shaderStage.shader().description();
+ if (cacheResult == QRhiGles2::ProgramCacheMiss) {
+ if (!rhiD->compileShader(program, m_shaderStage, nullptr))
+ return false;
- if (needsCompile && !rhiD->linkProgram(program))
- return false;
+ if (!rhiD->linkProgram(program))
+ return false;
- if (needsCompile)
- rhiD->trySaveToDiskCache(program, diskCacheKey);
+ if (rhiD->rhiFlags.testFlag(QRhi::EnablePipelineCacheDataSave)) {
+ // force replacing existing cache entry (if there is one, then
+ // something is wrong with it, as there was no hit)
+ rhiD->trySaveToPipelineCache(program, cacheKey, true);
+ } else {
+ // legacy QOpenGLShaderProgram style behavior: the "pipeline cache"
+ // was not enabled, so instead store to the Qt 5 disk cache
+ rhiD->trySaveToDiskCache(program, cacheKey);
+ }
+ } else {
+ Q_ASSERT(cacheResult == QRhiGles2::ProgramCacheHit);
+ if (rhiD->rhiFlags.testFlag(QRhi::EnablePipelineCacheDataSave)) {
+ // just so that it ends up in the pipeline cache also when the hit was
+ // from the disk cache
+ rhiD->trySaveToPipelineCache(program, cacheKey);
+ }
+ }
+ QDuplicateTracker<int, 256> activeUniformLocations;
for (const QShaderDescription::UniformBlock &ub : csDesc.uniformBlocks())
- rhiD->gatherUniforms(program, ub, &uniforms);
+ rhiD->gatherUniforms(program, ub, &activeUniformLocations, &uniforms);
for (const QShaderDescription::InOutVariable &v : csDesc.combinedImageSamplers())
rhiD->gatherSamplers(program, v, &samplers);
+ for (const QShader::SeparateToCombinedImageSamplerMapping &mapping : csSamplerMappingList)
+ rhiD->gatherGeneratedSamplers(program, mapping, &samplers);
// storage images and buffers need no special steps here
+ memset(uniformState, 0, sizeof(uniformState));
+
+ currentSrb = nullptr;
+ currentSrbGeneration = 0;
+
+ rhiD->pipelineCreationEnd();
generation += 1;
rhiD->registerResource(this);
return true;
@@ -3927,30 +6524,33 @@ QGles2CommandBuffer::QGles2CommandBuffer(QRhiImplementation *rhi)
QGles2CommandBuffer::~QGles2CommandBuffer()
{
- release();
+ destroy();
}
-void QGles2CommandBuffer::release()
+void QGles2CommandBuffer::destroy()
{
// nothing to do here
}
QGles2SwapChain::QGles2SwapChain(QRhiImplementation *rhi)
: QRhiSwapChain(rhi),
- rt(rhi),
+ rt(rhi, this),
+ rtLeft(rhi, this),
+ rtRight(rhi, this),
cb(rhi)
{
}
QGles2SwapChain::~QGles2SwapChain()
{
- release();
+ destroy();
}
-void QGles2SwapChain::release()
+void QGles2SwapChain::destroy()
{
- QRHI_PROF;
- QRHI_PROF_F(releaseSwapChain(this));
+ QRHI_RES_RHI(QRhiGles2);
+ if (rhiD)
+ rhiD->unregisterResource(this);
}
QRhiCommandBuffer *QGles2SwapChain::currentFrameCommandBuffer()
@@ -3963,19 +6563,59 @@ QRhiRenderTarget *QGles2SwapChain::currentFrameRenderTarget()
return &rt;
}
+QRhiRenderTarget *QGles2SwapChain::currentFrameRenderTarget(StereoTargetBuffer targetBuffer)
+{
+ if (targetBuffer == LeftBuffer)
+ return rtLeft.d.isValid() ? &rtLeft : &rt;
+ else if (targetBuffer == RightBuffer)
+ return rtRight.d.isValid() ? &rtRight : &rt;
+ else
+ Q_UNREACHABLE_RETURN(nullptr);
+}
+
QSize QGles2SwapChain::surfacePixelSize()
{
Q_ASSERT(m_window);
- return m_window->size() * m_window->devicePixelRatio();
+ if (QPlatformWindow *platformWindow = m_window->handle())
+ // Prefer using QPlatformWindow geometry and DPR in order to avoid
+ // errors due to rounded QWindow geometry.
+ return platformWindow->geometry().size() * platformWindow->devicePixelRatio();
+ else
+ return m_window->size() * m_window->devicePixelRatio();
+}
+
+bool QGles2SwapChain::isFormatSupported(Format f)
+{
+ return f == SDR;
}
QRhiRenderPassDescriptor *QGles2SwapChain::newCompatibleRenderPassDescriptor()
{
- return new QGles2RenderPassDescriptor(m_rhi);
+ QGles2RenderPassDescriptor *rpD = new QGles2RenderPassDescriptor(m_rhi);
+ QRHI_RES_RHI(QRhiGles2);
+ rhiD->registerResource(rpD, false);
+ return rpD;
}
-bool QGles2SwapChain::buildOrResize()
+void QGles2SwapChain::initSwapChainRenderTarget(QGles2SwapChainRenderTarget *rt)
{
+ rt->setRenderPassDescriptor(m_renderPassDesc); // for the public getter in QRhiRenderTarget
+ rt->d.rp = QRHI_RES(QGles2RenderPassDescriptor, m_renderPassDesc);
+ rt->d.pixelSize = pixelSize;
+ rt->d.dpr = float(m_window->devicePixelRatio());
+ rt->d.sampleCount = qBound(1, m_sampleCount, 64);
+ rt->d.colorAttCount = 1;
+ rt->d.dsAttCount = m_depthStencil ? 1 : 0;
+ rt->d.srgbUpdateAndBlend = m_flags.testFlag(QRhiSwapChain::sRGB);
+}
+
+bool QGles2SwapChain::createOrResize()
+{
+ // can be called multiple times due to window resizes
+ const bool needsRegistration = !surface || surface != m_window;
+ if (surface && surface != m_window)
+ destroy();
+
surface = m_window;
m_currentPixelSize = surfacePixelSize();
pixelSize = m_currentPixelSize;
@@ -3984,24 +6624,73 @@ bool QGles2SwapChain::buildOrResize()
&& m_depthStencil->pixelSize() != pixelSize)
{
m_depthStencil->setPixelSize(pixelSize);
- m_depthStencil->build();
+ m_depthStencil->create();
}
- rt.d.rp = QRHI_RES(QGles2RenderPassDescriptor, m_renderPassDesc);
- rt.d.pixelSize = pixelSize;
- rt.d.dpr = float(m_window->devicePixelRatio());
- rt.d.sampleCount = qBound(1, m_sampleCount, 64);
- rt.d.colorAttCount = 1;
- rt.d.dsAttCount = m_depthStencil ? 1 : 0;
- rt.d.srgbUpdateAndBlend = m_flags.testFlag(QRhiSwapChain::sRGB);
+ initSwapChainRenderTarget(&rt);
+
+ if (m_window->format().stereo()) {
+ initSwapChainRenderTarget(&rtLeft);
+ rtLeft.d.stereoTarget = QRhiSwapChain::LeftBuffer;
+ initSwapChainRenderTarget(&rtRight);
+ rtRight.d.stereoTarget = QRhiSwapChain::RightBuffer;
+ }
frameCount = 0;
- QRHI_PROF;
- // make something up
- QRHI_PROF_F(resizeSwapChain(this, 2, m_sampleCount > 1 ? 2 : 0, m_sampleCount));
+ QRHI_RES_RHI(QRhiGles2);
+ if (rhiD->rhiFlags.testFlag(QRhi::EnableTimestamps) && rhiD->caps.timestamps)
+ timestamps.prepare(rhiD);
+
+ // The only reason to register this fairly fake gl swapchain
+ // object with no native resources underneath is to be able to
+ // implement a safe destroy().
+ if (needsRegistration)
+ rhiD->registerResource(this, false);
return true;
}
+void QGles2SwapChainTimestamps::prepare(QRhiGles2 *rhiD)
+{
+ if (!query[0])
+ rhiD->f->glGenQueries(TIMESTAMP_PAIRS * 2, query);
+}
+
+void QGles2SwapChainTimestamps::destroy(QRhiGles2 *rhiD)
+{
+ rhiD->f->glDeleteQueries(TIMESTAMP_PAIRS * 2, query);
+ memset(active, 0, sizeof(active));
+ memset(query, 0, sizeof(query));
+}
+
+bool QGles2SwapChainTimestamps::tryQueryTimestamps(int pairIndex, QRhiGles2 *rhiD, double *elapsedSec)
+{
+ if (!active[pairIndex])
+ return false;
+
+ GLuint tsStart = query[pairIndex * 2];
+ GLuint tsEnd = query[pairIndex * 2 + 1];
+
+ GLuint ready = GL_FALSE;
+ rhiD->f->glGetQueryObjectuiv(tsEnd, GL_QUERY_RESULT_AVAILABLE, &ready);
+
+ if (!ready)
+ return false;
+
+ bool result = false;
+ quint64 timestamps[2];
+ rhiD->glGetQueryObjectui64v(tsStart, GL_QUERY_RESULT, &timestamps[0]);
+ rhiD->glGetQueryObjectui64v(tsEnd, GL_QUERY_RESULT, &timestamps[1]);
+
+ if (timestamps[1] >= timestamps[0]) {
+ const quint64 nanoseconds = timestamps[1] - timestamps[0];
+ *elapsedSec = nanoseconds / 1000000000.0;
+ result = true;
+ }
+
+ active[pairIndex] = false;
+ return result;
+}
+
QT_END_NAMESPACE
diff --git a/src/gui/rhi/qrhigles2_p.h b/src/gui/rhi/qrhigles2_p.h
index 7f7c8b4c40..4139579864 100644
--- a/src/gui/rhi/qrhigles2_p.h
+++ b/src/gui/rhi/qrhigles2_p.h
@@ -1,41 +1,8 @@
-/****************************************************************************
-**
-** Copyright (C) 2019 The Qt Company Ltd.
-** Contact: http://www.qt.io/licensing/
-**
-** This file is part of the Qt Gui module
-**
-** $QT_BEGIN_LICENSE:LGPL3$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef QRHIGLES2_H
-#define QRHIGLES2_H
+// Copyright (C) 2023 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
+
+#ifndef QRHIGLES2_P_H
+#define QRHIGLES2_P_H
//
// W A R N I N G
@@ -48,37 +15,1125 @@
// We mean it.
//
-#include <private/qrhi_p.h>
-#include <QtGui/qsurfaceformat.h>
+#include "qrhi_p.h"
+#include <rhi/qshaderdescription.h>
+#include <qopengl.h>
+#include <QByteArray>
+#include <QWindow>
+#include <QPointer>
+#include <QtCore/private/qduplicatetracker_p.h>
+#include <optional>
QT_BEGIN_NAMESPACE
-class QOpenGLContext;
-class QOffscreenSurface;
-class QWindow;
+class QOpenGLExtensions;
+class QRhiGles2;
+
+struct QGles2Buffer : public QRhiBuffer
+{
+ QGles2Buffer(QRhiImplementation *rhi, Type type, UsageFlags usage, quint32 size);
+ ~QGles2Buffer();
+ void destroy() override;
+ bool create() override;
+ QRhiBuffer::NativeBuffer nativeBuffer() override;
+ char *beginFullDynamicBufferUpdateForCurrentFrame() override;
+ void endFullDynamicBufferUpdateForCurrentFrame() override;
+
+ quint32 nonZeroSize = 0;
+ GLuint buffer = 0;
+ GLenum targetForDataOps;
+ QByteArray data;
+ enum Access {
+ AccessNone,
+ AccessVertex,
+ AccessIndex,
+ AccessUniform,
+ AccessStorageRead,
+ AccessStorageWrite,
+ AccessStorageReadWrite,
+ AccessUpdate
+ };
+ struct UsageState {
+ Access access;
+ };
+ UsageState usageState;
+ friend class QRhiGles2;
+};
+
+struct QGles2RenderBuffer : public QRhiRenderBuffer
+{
+ QGles2RenderBuffer(QRhiImplementation *rhi, Type type, const QSize &pixelSize,
+ int sampleCount, QRhiRenderBuffer::Flags flags,
+ QRhiTexture::Format backingFormatHint);
+ ~QGles2RenderBuffer();
+ void destroy() override;
+ bool create() override;
+ bool createFrom(NativeRenderBuffer src) override;
+ QRhiTexture::Format backingFormat() const override;
+
+ GLuint renderbuffer = 0;
+ GLuint stencilRenderbuffer = 0; // when packed depth-stencil not supported
+ int samples;
+ bool owns = true;
+ uint generation = 0;
+ friend class QRhiGles2;
+};
+
+struct QGles2SamplerData
+{
+ GLenum glminfilter = 0;
+ GLenum glmagfilter = 0;
+ GLenum glwraps = 0;
+ GLenum glwrapt = 0;
+ GLenum glwrapr = 0;
+ GLenum gltexcomparefunc = 0;
+};
+
+inline bool operator==(const QGles2SamplerData &a, const QGles2SamplerData &b)
+{
+ return a.glminfilter == b.glminfilter
+ && a.glmagfilter == b.glmagfilter
+ && a.glwraps == b.glwraps
+ && a.glwrapt == b.glwrapt
+ && a.glwrapr == b.glwrapr
+ && a.gltexcomparefunc == b.gltexcomparefunc;
+}
+
+inline bool operator!=(const QGles2SamplerData &a, const QGles2SamplerData &b)
+{
+ return !(a == b);
+}
+
+struct QGles2Texture : public QRhiTexture
+{
+ QGles2Texture(QRhiImplementation *rhi, Format format, const QSize &pixelSize, int depth,
+ int arraySize, int sampleCount, Flags flags);
+ ~QGles2Texture();
+ void destroy() override;
+ bool create() override;
+ bool createFrom(NativeTexture src) override;
+ NativeTexture nativeTexture() override;
+
+ bool prepareCreate(QSize *adjustedSize = nullptr);
+
+ GLuint texture = 0;
+ bool owns = true;
+ GLenum target;
+ GLenum glintformat;
+ GLenum glsizedintformat;
+ GLenum glformat;
+ GLenum gltype;
+ QGles2SamplerData samplerState;
+ bool specified = false;
+ bool zeroInitialized = false;
+ int mipLevelCount = 0;
+
+ enum Access {
+ AccessNone,
+ AccessSample,
+ AccessFramebuffer,
+ AccessStorageRead,
+ AccessStorageWrite,
+ AccessStorageReadWrite,
+ AccessUpdate,
+ AccessRead
+ };
+ struct UsageState {
+ Access access;
+ };
+ UsageState usageState;
+
+ uint generation = 0;
+ friend class QRhiGles2;
+};
+
+struct QGles2Sampler : public QRhiSampler
+{
+ QGles2Sampler(QRhiImplementation *rhi, Filter magFilter, Filter minFilter, Filter mipmapMode,
+ AddressMode u, AddressMode v, AddressMode w);
+ ~QGles2Sampler();
+ void destroy() override;
+ bool create() override;
+
+ QGles2SamplerData d;
+ uint generation = 0;
+ friend class QRhiGles2;
+};
+
+struct QGles2RenderPassDescriptor : public QRhiRenderPassDescriptor
+{
+ QGles2RenderPassDescriptor(QRhiImplementation *rhi);
+ ~QGles2RenderPassDescriptor();
+ void destroy() override;
+ bool isCompatible(const QRhiRenderPassDescriptor *other) const override;
+ QRhiRenderPassDescriptor *newCompatibleRenderPassDescriptor() const override;
+ QVector<quint32> serializedFormat() const override;
+};
+
+struct QGles2RenderTargetData
+{
+ QGles2RenderTargetData(QRhiImplementation *) { }
+
+ bool isValid() const { return rp != nullptr; }
+
+ QGles2RenderPassDescriptor *rp = nullptr;
+ QSize pixelSize;
+ float dpr = 1;
+ int sampleCount = 1;
+ int colorAttCount = 0;
+ int dsAttCount = 0;
+ bool srgbUpdateAndBlend = false;
+ QRhiRenderTargetAttachmentTracker::ResIdList currentResIdList;
+ std::optional<QRhiSwapChain::StereoTargetBuffer> stereoTarget;
+};
+
+struct QGles2SwapChainRenderTarget : public QRhiSwapChainRenderTarget
+{
+ QGles2SwapChainRenderTarget(QRhiImplementation *rhi, QRhiSwapChain *swapchain);
+ ~QGles2SwapChainRenderTarget();
+ void destroy() override;
+
+ QSize pixelSize() const override;
+ float devicePixelRatio() const override;
+ int sampleCount() const override;
+
+ QGles2RenderTargetData d;
+};
+
+struct QGles2TextureRenderTarget : public QRhiTextureRenderTarget
+{
+ QGles2TextureRenderTarget(QRhiImplementation *rhi, const QRhiTextureRenderTargetDescription &desc, Flags flags);
+ ~QGles2TextureRenderTarget();
+ void destroy() override;
+
+ QSize pixelSize() const override;
+ float devicePixelRatio() const override;
+ int sampleCount() const override;
+
+ QRhiRenderPassDescriptor *newCompatibleRenderPassDescriptor() override;
+ bool create() override;
+
+ QGles2RenderTargetData d;
+ GLuint framebuffer = 0;
+ GLuint nonMsaaThrowawayDepthTexture = 0;
+ friend class QRhiGles2;
+};
+
+struct QGles2ShaderResourceBindings : public QRhiShaderResourceBindings
+{
+ QGles2ShaderResourceBindings(QRhiImplementation *rhi);
+ ~QGles2ShaderResourceBindings();
+ void destroy() override;
+ bool create() override;
+ void updateResources(UpdateFlags flags) override;
+
+ bool hasDynamicOffset = false;
+ uint generation = 0;
+ friend class QRhiGles2;
+};
+
+struct QGles2UniformDescription
+{
+ QShaderDescription::VariableType type;
+ int glslLocation;
+ int binding;
+ quint32 offset;
+ quint32 size;
+ int arrayDim;
+};
+
+Q_DECLARE_TYPEINFO(QGles2UniformDescription, Q_RELOCATABLE_TYPE);
-struct Q_GUI_EXPORT QRhiGles2InitParams : public QRhiInitParams
+struct QGles2SamplerDescription
{
- QRhiGles2InitParams();
+ int glslLocation;
+ int combinedBinding;
+ int tbinding;
+ int sbinding;
+};
+
+Q_DECLARE_TYPEINFO(QGles2SamplerDescription, Q_RELOCATABLE_TYPE);
- QSurfaceFormat format;
- QOffscreenSurface *fallbackSurface = nullptr;
- QWindow *window = nullptr;
+using QGles2UniformDescriptionVector = QVarLengthArray<QGles2UniformDescription, 8>;
+using QGles2SamplerDescriptionVector = QVarLengthArray<QGles2SamplerDescription, 4>;
- static QOffscreenSurface *newFallbackSurface(const QSurfaceFormat &format = QSurfaceFormat::defaultFormat());
- static QSurfaceFormat adjustedFormat(const QSurfaceFormat &format = QSurfaceFormat::defaultFormat());
+struct QGles2UniformState
+{
+ static constexpr int MAX_TRACKED_LOCATION = 1023;
+ int componentCount;
+ float v[4];
};
-struct Q_GUI_EXPORT QRhiGles2NativeHandles : public QRhiNativeHandles
+struct QGles2GraphicsPipeline : public QRhiGraphicsPipeline
{
- QOpenGLContext *context = nullptr;
+ QGles2GraphicsPipeline(QRhiImplementation *rhi);
+ ~QGles2GraphicsPipeline();
+ void destroy() override;
+ bool create() override;
+
+ GLuint program = 0;
+ GLenum drawMode = GL_TRIANGLES;
+ QGles2UniformDescriptionVector uniforms;
+ QGles2SamplerDescriptionVector samplers;
+ QGles2UniformState uniformState[QGles2UniformState::MAX_TRACKED_LOCATION + 1];
+ QRhiShaderResourceBindings *currentSrb = nullptr;
+ uint currentSrbGeneration = 0;
+ uint generation = 0;
+ friend class QRhiGles2;
};
-struct Q_GUI_EXPORT QRhiGles2TextureNativeHandles : public QRhiNativeHandles
+struct QGles2ComputePipeline : public QRhiComputePipeline
{
- uint texture = 0;
+ QGles2ComputePipeline(QRhiImplementation *rhi);
+ ~QGles2ComputePipeline();
+ void destroy() override;
+ bool create() override;
+
+ GLuint program = 0;
+ QGles2UniformDescriptionVector uniforms;
+ QGles2SamplerDescriptionVector samplers;
+ QGles2UniformState uniformState[QGles2UniformState::MAX_TRACKED_LOCATION + 1];
+ QRhiShaderResourceBindings *currentSrb = nullptr;
+ uint currentSrbGeneration = 0;
+ uint generation = 0;
+ friend class QRhiGles2;
};
+struct QGles2CommandBuffer : public QRhiCommandBuffer
+{
+ QGles2CommandBuffer(QRhiImplementation *rhi);
+ ~QGles2CommandBuffer();
+ void destroy() override;
+
+ // keep at a reasonably low value otherwise sizeof Command explodes
+ static const int MAX_DYNAMIC_OFFSET_COUNT = 8;
+
+ struct Command {
+ enum Cmd {
+ BeginFrame,
+ EndFrame,
+ ResetFrame,
+ Viewport,
+ Scissor,
+ BlendConstants,
+ StencilRef,
+ BindVertexBuffer,
+ BindIndexBuffer,
+ Draw,
+ DrawIndexed,
+ BindGraphicsPipeline,
+ BindShaderResources,
+ BindFramebuffer,
+ Clear,
+ BufferSubData,
+ GetBufferSubData,
+ CopyTex,
+ ReadPixels,
+ SubImage,
+ CompressedImage,
+ CompressedSubImage,
+ BlitFromRenderbuffer,
+ BlitFromTexture,
+ GenMip,
+ BindComputePipeline,
+ Dispatch,
+ BarriersForPass,
+ Barrier,
+ InvalidateFramebuffer
+ };
+ Cmd cmd;
+
+ // QRhi*/QGles2* references should be kept at minimum (so no
+ // QRhiTexture/Buffer/etc. pointers).
+ union Args {
+ struct {
+ GLuint timestampQuery;
+ } beginFrame;
+ struct {
+ GLuint timestampQuery;
+ } endFrame;
+ struct {
+ float x, y, w, h;
+ float d0, d1;
+ } viewport;
+ struct {
+ int x, y, w, h;
+ } scissor;
+ struct {
+ float r, g, b, a;
+ } blendConstants;
+ struct {
+ quint32 ref;
+ QRhiGraphicsPipeline *ps;
+ } stencilRef;
+ struct {
+ QRhiGraphicsPipeline *ps;
+ GLuint buffer;
+ quint32 offset;
+ int binding;
+ } bindVertexBuffer;
+ struct {
+ GLuint buffer;
+ quint32 offset;
+ GLenum type;
+ } bindIndexBuffer;
+ struct {
+ QRhiGraphicsPipeline *ps;
+ quint32 vertexCount;
+ quint32 firstVertex;
+ quint32 instanceCount;
+ quint32 baseInstance;
+ } draw;
+ struct {
+ QRhiGraphicsPipeline *ps;
+ quint32 indexCount;
+ quint32 firstIndex;
+ quint32 instanceCount;
+ quint32 baseInstance;
+ qint32 baseVertex;
+ } drawIndexed;
+ struct {
+ QRhiGraphicsPipeline *ps;
+ } bindGraphicsPipeline;
+ struct {
+ QRhiGraphicsPipeline *maybeGraphicsPs;
+ QRhiComputePipeline *maybeComputePs;
+ QRhiShaderResourceBindings *srb;
+ int dynamicOffsetCount;
+ uint dynamicOffsetPairs[MAX_DYNAMIC_OFFSET_COUNT * 2]; // binding, offset
+ } bindShaderResources;
+ struct {
+ GLbitfield mask;
+ float c[4];
+ float d;
+ quint32 s;
+ } clear;
+ struct {
+ GLuint fbo;
+ bool srgb;
+ int colorAttCount;
+ bool stereo;
+ QRhiSwapChain::StereoTargetBuffer stereoTarget;
+ } bindFramebuffer;
+ struct {
+ GLenum target;
+ GLuint buffer;
+ int offset;
+ int size;
+ const void *data; // must come from retainData()
+ } bufferSubData;
+ struct {
+ QRhiReadbackResult *result;
+ GLenum target;
+ GLuint buffer;
+ int offset;
+ int size;
+ } getBufferSubData;
+ struct {
+ GLenum srcTarget;
+ GLenum srcFaceTarget;
+ GLuint srcTexture;
+ int srcLevel;
+ int srcX;
+ int srcY;
+ int srcZ;
+ GLenum dstTarget;
+ GLuint dstTexture;
+ GLenum dstFaceTarget;
+ int dstLevel;
+ int dstX;
+ int dstY;
+ int dstZ;
+ int w;
+ int h;
+ } copyTex;
+ struct {
+ QRhiReadbackResult *result;
+ GLuint texture;
+ int w;
+ int h;
+ QRhiTexture::Format format;
+ GLenum readTarget;
+ int level;
+ int slice3D;
+ } readPixels;
+ struct {
+ GLenum target;
+ GLuint texture;
+ GLenum faceTarget;
+ int level;
+ int dx;
+ int dy;
+ int dz;
+ int w;
+ int h;
+ GLenum glformat;
+ GLenum gltype;
+ int rowStartAlign;
+ int rowLength;
+ const void *data; // must come from retainImage()
+ } subImage;
+ struct {
+ GLenum target;
+ GLuint texture;
+ GLenum faceTarget;
+ int level;
+ GLenum glintformat;
+ int w;
+ int h;
+ int depth;
+ int size;
+ const void *data; // must come from retainData()
+ } compressedImage;
+ struct {
+ GLenum target;
+ GLuint texture;
+ GLenum faceTarget;
+ int level;
+ int dx;
+ int dy;
+ int dz;
+ int w;
+ int h;
+ GLenum glintformat;
+ int size;
+ const void *data; // must come from retainData()
+ } compressedSubImage;
+ struct {
+ GLuint renderbuffer;
+ int w;
+ int h;
+ GLenum target;
+ GLuint dstTexture;
+ int dstLevel;
+ int dstLayer;
+ bool isDepthStencil;
+ } blitFromRenderbuffer;
+ struct {
+ GLenum srcTarget;
+ GLuint srcTexture;
+ int srcLevel;
+ int srcLayer;
+ int w;
+ int h;
+ GLenum dstTarget;
+ GLuint dstTexture;
+ int dstLevel;
+ int dstLayer;
+ bool isDepthStencil;
+ } blitFromTexture;
+ struct {
+ GLenum target;
+ GLuint texture;
+ } genMip;
+ struct {
+ QRhiComputePipeline *ps;
+ } bindComputePipeline;
+ struct {
+ GLuint x;
+ GLuint y;
+ GLuint z;
+ } dispatch;
+ struct {
+ int trackerIndex;
+ } barriersForPass;
+ struct {
+ GLbitfield barriers;
+ } barrier;
+ struct {
+ int attCount;
+ GLenum att[3];
+ } invalidateFramebuffer;
+ } args;
+ };
+
+ enum PassType {
+ NoPass,
+ RenderPass,
+ ComputePass
+ };
+
+ QRhiBackendCommandList<Command> commands;
+ QVarLengthArray<QRhiPassResourceTracker, 8> passResTrackers;
+ int currentPassResTrackerIndex;
+
+ PassType recordingPass;
+ bool passNeedsResourceTracking;
+ double lastGpuTime = 0;
+ QRhiRenderTarget *currentTarget;
+ QRhiGraphicsPipeline *currentGraphicsPipeline;
+ QRhiComputePipeline *currentComputePipeline;
+ uint currentPipelineGeneration;
+ QRhiShaderResourceBindings *currentGraphicsSrb;
+ QRhiShaderResourceBindings *currentComputeSrb;
+ uint currentSrbGeneration;
+
+ struct GraphicsPassState {
+ bool valid = false;
+ bool scissor;
+ bool cullFace;
+ GLenum cullMode;
+ GLenum frontFace;
+ bool blendEnabled;
+ struct ColorMask { bool r, g, b, a; } colorMask;
+ struct Blend {
+ GLenum srcColor;
+ GLenum dstColor;
+ GLenum srcAlpha;
+ GLenum dstAlpha;
+ GLenum opColor;
+ GLenum opAlpha;
+ } blend;
+ bool depthTest;
+ bool depthWrite;
+ GLenum depthFunc;
+ bool stencilTest;
+ GLuint stencilReadMask;
+ GLuint stencilWriteMask;
+ struct StencilFace {
+ GLenum func;
+ GLenum failOp;
+ GLenum zfailOp;
+ GLenum zpassOp;
+ } stencil[2]; // front, back
+ bool polyOffsetFill;
+ float polyOffsetFactor;
+ float polyOffsetUnits;
+ float lineWidth;
+ int cpCount;
+ GLenum polygonMode;
+ void reset() { valid = false; }
+ struct {
+ // not part of QRhiGraphicsPipeline but used by setGraphicsPipeline()
+ GLint stencilRef = 0;
+ } dynamic;
+ } graphicsPassState;
+
+ struct ComputePassState {
+ enum Access {
+ Read = 0x01,
+ Write = 0x02
+ };
+ QHash<QRhiResource *, QPair<int, bool> > writtenResources;
+ void reset() {
+ writtenResources.clear();
+ }
+ } computePassState;
+
+ struct TextureUnitState {
+ void *ps;
+ uint psGeneration;
+ uint texture;
+ } textureUnitState[16];
+
+ QVarLengthArray<QByteArray, 4> dataRetainPool;
+ QVarLengthArray<QRhiBufferData, 4> bufferDataRetainPool;
+ QVarLengthArray<QImage, 4> imageRetainPool;
+
+ // relies heavily on implicit sharing (no copies of the actual data will be made)
+ const void *retainData(const QByteArray &data) {
+ dataRetainPool.append(data);
+ return dataRetainPool.last().constData();
+ }
+ const uchar *retainBufferData(const QRhiBufferData &data) {
+ bufferDataRetainPool.append(data);
+ return reinterpret_cast<const uchar *>(bufferDataRetainPool.last().constData());
+ }
+ const void *retainImage(const QImage &image) {
+ imageRetainPool.append(image);
+ return imageRetainPool.last().constBits();
+ }
+ void resetCommands() {
+ commands.reset();
+ dataRetainPool.clear();
+ bufferDataRetainPool.clear();
+ imageRetainPool.clear();
+
+ passResTrackers.clear();
+ currentPassResTrackerIndex = -1;
+ }
+ void resetState() {
+ recordingPass = NoPass;
+ passNeedsResourceTracking = true;
+ // do not zero lastGpuTime
+ currentTarget = nullptr;
+ resetCommands();
+ resetCachedState();
+ }
+ void resetCachedState() {
+ currentGraphicsPipeline = nullptr;
+ currentComputePipeline = nullptr;
+ currentPipelineGeneration = 0;
+ currentGraphicsSrb = nullptr;
+ currentComputeSrb = nullptr;
+ currentSrbGeneration = 0;
+ graphicsPassState.reset();
+ computePassState.reset();
+ memset(textureUnitState, 0, sizeof(textureUnitState));
+ }
+};
+
+inline bool operator==(const QGles2CommandBuffer::GraphicsPassState::StencilFace &a,
+ const QGles2CommandBuffer::GraphicsPassState::StencilFace &b)
+{
+ return a.func == b.func
+ && a.failOp == b.failOp
+ && a.zfailOp == b.zfailOp
+ && a.zpassOp == b.zpassOp;
+}
+
+inline bool operator!=(const QGles2CommandBuffer::GraphicsPassState::StencilFace &a,
+ const QGles2CommandBuffer::GraphicsPassState::StencilFace &b)
+{
+ return !(a == b);
+}
+
+inline bool operator==(const QGles2CommandBuffer::GraphicsPassState::ColorMask &a,
+ const QGles2CommandBuffer::GraphicsPassState::ColorMask &b)
+{
+ return a.r == b.r && a.g == b.g && a.b == b.b && a.a == b.a;
+}
+
+inline bool operator!=(const QGles2CommandBuffer::GraphicsPassState::ColorMask &a,
+ const QGles2CommandBuffer::GraphicsPassState::ColorMask &b)
+{
+ return !(a == b);
+}
+
+inline bool operator==(const QGles2CommandBuffer::GraphicsPassState::Blend &a,
+ const QGles2CommandBuffer::GraphicsPassState::Blend &b)
+{
+ return a.srcColor == b.srcColor
+ && a.dstColor == b.dstColor
+ && a.srcAlpha == b.srcAlpha
+ && a.dstAlpha == b.dstAlpha
+ && a.opColor == b.opColor
+ && a.opAlpha == b.opAlpha;
+}
+
+inline bool operator!=(const QGles2CommandBuffer::GraphicsPassState::Blend &a,
+ const QGles2CommandBuffer::GraphicsPassState::Blend &b)
+{
+ return !(a == b);
+}
+
+struct QGles2SwapChainTimestamps
+{
+ static const int TIMESTAMP_PAIRS = 2;
+
+ bool active[TIMESTAMP_PAIRS] = {};
+ GLuint query[TIMESTAMP_PAIRS * 2] = {};
+
+ void prepare(QRhiGles2 *rhiD);
+ void destroy(QRhiGles2 *rhiD);
+ bool tryQueryTimestamps(int pairIndex, QRhiGles2 *rhiD, double *elapsedSec);
+};
+
+struct QGles2SwapChain : public QRhiSwapChain
+{
+ QGles2SwapChain(QRhiImplementation *rhi);
+ ~QGles2SwapChain();
+ void destroy() override;
+
+ QRhiCommandBuffer *currentFrameCommandBuffer() override;
+ QRhiRenderTarget *currentFrameRenderTarget() override;
+ QRhiRenderTarget *currentFrameRenderTarget(StereoTargetBuffer targetBuffer) override;
+
+ QSize surfacePixelSize() override;
+ bool isFormatSupported(Format f) override;
+
+ QRhiRenderPassDescriptor *newCompatibleRenderPassDescriptor() override;
+ bool createOrResize() override;
+
+ void initSwapChainRenderTarget(QGles2SwapChainRenderTarget *rt);
+
+ QSurface *surface = nullptr;
+ QSize pixelSize;
+ QGles2SwapChainRenderTarget rt;
+ QGles2SwapChainRenderTarget rtLeft;
+ QGles2SwapChainRenderTarget rtRight;
+ QGles2CommandBuffer cb;
+ int frameCount = 0;
+ QGles2SwapChainTimestamps timestamps;
+ int currentTimestampPairIndex = 0;
+};
+
+class QRhiGles2 : public QRhiImplementation
+{
+public:
+ QRhiGles2(QRhiGles2InitParams *params, QRhiGles2NativeHandles *importDevice = nullptr);
+
+ bool create(QRhi::Flags flags) override;
+ void destroy() override;
+
+ QRhiGraphicsPipeline *createGraphicsPipeline() override;
+ QRhiComputePipeline *createComputePipeline() override;
+ QRhiShaderResourceBindings *createShaderResourceBindings() override;
+ QRhiBuffer *createBuffer(QRhiBuffer::Type type,
+ QRhiBuffer::UsageFlags usage,
+ quint32 size) override;
+ QRhiRenderBuffer *createRenderBuffer(QRhiRenderBuffer::Type type,
+ const QSize &pixelSize,
+ int sampleCount,
+ QRhiRenderBuffer::Flags flags,
+ QRhiTexture::Format backingFormatHint) override;
+ QRhiTexture *createTexture(QRhiTexture::Format format,
+ const QSize &pixelSize,
+ int depth,
+ int arraySize,
+ int sampleCount,
+ QRhiTexture::Flags flags) override;
+ QRhiSampler *createSampler(QRhiSampler::Filter magFilter,
+ QRhiSampler::Filter minFilter,
+ QRhiSampler::Filter mipmapMode,
+ QRhiSampler:: AddressMode u,
+ QRhiSampler::AddressMode v,
+ QRhiSampler::AddressMode w) override;
+
+ QRhiTextureRenderTarget *createTextureRenderTarget(const QRhiTextureRenderTargetDescription &desc,
+ QRhiTextureRenderTarget::Flags flags) override;
+
+ QRhiSwapChain *createSwapChain() override;
+ QRhi::FrameOpResult beginFrame(QRhiSwapChain *swapChain, QRhi::BeginFrameFlags flags) override;
+ QRhi::FrameOpResult endFrame(QRhiSwapChain *swapChain, QRhi::EndFrameFlags flags) override;
+ QRhi::FrameOpResult beginOffscreenFrame(QRhiCommandBuffer **cb, QRhi::BeginFrameFlags flags) override;
+ QRhi::FrameOpResult endOffscreenFrame(QRhi::EndFrameFlags flags) override;
+ QRhi::FrameOpResult finish() override;
+
+ void resourceUpdate(QRhiCommandBuffer *cb, QRhiResourceUpdateBatch *resourceUpdates) override;
+
+ void beginPass(QRhiCommandBuffer *cb,
+ QRhiRenderTarget *rt,
+ const QColor &colorClearValue,
+ const QRhiDepthStencilClearValue &depthStencilClearValue,
+ QRhiResourceUpdateBatch *resourceUpdates,
+ QRhiCommandBuffer::BeginPassFlags flags) override;
+ void endPass(QRhiCommandBuffer *cb, QRhiResourceUpdateBatch *resourceUpdates) override;
+
+ void setGraphicsPipeline(QRhiCommandBuffer *cb,
+ QRhiGraphicsPipeline *ps) override;
+
+ void setShaderResources(QRhiCommandBuffer *cb,
+ QRhiShaderResourceBindings *srb,
+ int dynamicOffsetCount,
+ const QRhiCommandBuffer::DynamicOffset *dynamicOffsets) override;
+
+ void setVertexInput(QRhiCommandBuffer *cb,
+ int startBinding, int bindingCount, const QRhiCommandBuffer::VertexInput *bindings,
+ QRhiBuffer *indexBuf, quint32 indexOffset,
+ QRhiCommandBuffer::IndexFormat indexFormat) override;
+
+ void setViewport(QRhiCommandBuffer *cb, const QRhiViewport &viewport) override;
+ void setScissor(QRhiCommandBuffer *cb, const QRhiScissor &scissor) override;
+ void setBlendConstants(QRhiCommandBuffer *cb, const QColor &c) override;
+ void setStencilRef(QRhiCommandBuffer *cb, quint32 refValue) override;
+
+ void draw(QRhiCommandBuffer *cb, quint32 vertexCount,
+ quint32 instanceCount, quint32 firstVertex, quint32 firstInstance) override;
+
+ void drawIndexed(QRhiCommandBuffer *cb, quint32 indexCount,
+ quint32 instanceCount, quint32 firstIndex,
+ qint32 vertexOffset, quint32 firstInstance) override;
+
+ void debugMarkBegin(QRhiCommandBuffer *cb, const QByteArray &name) override;
+ void debugMarkEnd(QRhiCommandBuffer *cb) override;
+ void debugMarkMsg(QRhiCommandBuffer *cb, const QByteArray &msg) override;
+
+ void beginComputePass(QRhiCommandBuffer *cb,
+ QRhiResourceUpdateBatch *resourceUpdates,
+ QRhiCommandBuffer::BeginPassFlags flags) override;
+ void endComputePass(QRhiCommandBuffer *cb, QRhiResourceUpdateBatch *resourceUpdates) override;
+ void setComputePipeline(QRhiCommandBuffer *cb, QRhiComputePipeline *ps) override;
+ void dispatch(QRhiCommandBuffer *cb, int x, int y, int z) override;
+
+ const QRhiNativeHandles *nativeHandles(QRhiCommandBuffer *cb) override;
+ void beginExternal(QRhiCommandBuffer *cb) override;
+ void endExternal(QRhiCommandBuffer *cb) override;
+ double lastCompletedGpuTime(QRhiCommandBuffer *cb) override;
+
+ QList<int> supportedSampleCounts() const override;
+ int ubufAlignment() const override;
+ bool isYUpInFramebuffer() const override;
+ bool isYUpInNDC() const override;
+ bool isClipDepthZeroToOne() const override;
+ QMatrix4x4 clipSpaceCorrMatrix() const override;
+ bool isTextureFormatSupported(QRhiTexture::Format format, QRhiTexture::Flags flags) const override;
+ bool isFeatureSupported(QRhi::Feature feature) const override;
+ int resourceLimit(QRhi::ResourceLimit limit) const override;
+ const QRhiNativeHandles *nativeHandles() override;
+ QRhiDriverInfo driverInfo() const override;
+ QRhiStats statistics() override;
+ bool makeThreadLocalNativeContextCurrent() override;
+ void releaseCachedResources() override;
+ bool isDeviceLost() const override;
+
+ QByteArray pipelineCacheData() override;
+ void setPipelineCacheData(const QByteArray &data) override;
+
+ bool ensureContext(QSurface *surface = nullptr) const;
+ QSurface *evaluateFallbackSurface() const;
+ void executeDeferredReleases();
+ void trackedBufferBarrier(QGles2CommandBuffer *cbD, QGles2Buffer *bufD, QGles2Buffer::Access access);
+ void trackedImageBarrier(QGles2CommandBuffer *cbD, QGles2Texture *texD, QGles2Texture::Access access);
+ void enqueueSubresUpload(QGles2Texture *texD, QGles2CommandBuffer *cbD,
+ int layer, int level, const QRhiTextureSubresourceUploadDescription &subresDesc);
+ void enqueueResourceUpdates(QRhiCommandBuffer *cb, QRhiResourceUpdateBatch *resourceUpdates);
+ void trackedRegisterBuffer(QRhiPassResourceTracker *passResTracker,
+ QGles2Buffer *bufD,
+ QRhiPassResourceTracker::BufferAccess access,
+ QRhiPassResourceTracker::BufferStage stage);
+ void trackedRegisterTexture(QRhiPassResourceTracker *passResTracker,
+ QGles2Texture *texD,
+ QRhiPassResourceTracker::TextureAccess access,
+ QRhiPassResourceTracker::TextureStage stage);
+ void executeCommandBuffer(QRhiCommandBuffer *cb);
+ void executeBindGraphicsPipeline(QGles2CommandBuffer *cbD, QGles2GraphicsPipeline *psD);
+ void bindCombinedSampler(QGles2CommandBuffer *cbD, QGles2Texture *texD, QGles2Sampler *samplerD,
+ void *ps, uint psGeneration, int glslLocation,
+ int *texUnit, bool *activeTexUnitAltered);
+ void bindShaderResources(QGles2CommandBuffer *cbD,
+ QRhiGraphicsPipeline *maybeGraphicsPs, QRhiComputePipeline *maybeComputePs,
+ QRhiShaderResourceBindings *srb,
+ const uint *dynOfsPairs, int dynOfsCount);
+ QGles2RenderTargetData *enqueueBindFramebuffer(QRhiRenderTarget *rt, QGles2CommandBuffer *cbD,
+ bool *wantsColorClear = nullptr, bool *wantsDsClear = nullptr);
+ void enqueueBarriersForPass(QGles2CommandBuffer *cbD);
+ QByteArray shaderSource(const QRhiShaderStage &shaderStage, QShaderVersion *shaderVersion);
+ bool compileShader(GLuint program, const QRhiShaderStage &shaderStage, QShaderVersion *shaderVersion);
+ bool linkProgram(GLuint program);
+ void registerUniformIfActive(const QShaderDescription::BlockVariable &var,
+ const QByteArray &namePrefix, int binding, int baseOffset,
+ GLuint program,
+ QDuplicateTracker<int, 256> *activeUniformLocations,
+ QGles2UniformDescriptionVector *dst);
+ void gatherUniforms(GLuint program, const QShaderDescription::UniformBlock &ub,
+ QDuplicateTracker<int, 256> *activeUniformLocations, QGles2UniformDescriptionVector *dst);
+ void gatherSamplers(GLuint program, const QShaderDescription::InOutVariable &v,
+ QGles2SamplerDescriptionVector *dst);
+ void gatherGeneratedSamplers(GLuint program,
+ const QShader::SeparateToCombinedImageSamplerMapping &mapping,
+ QGles2SamplerDescriptionVector *dst);
+ void sanityCheckVertexFragmentInterface(const QShaderDescription &vsDesc, const QShaderDescription &fsDesc);
+ bool isProgramBinaryDiskCacheEnabled() const;
+
+ enum ProgramCacheResult {
+ ProgramCacheHit,
+ ProgramCacheMiss,
+ ProgramCacheError
+ };
+ ProgramCacheResult tryLoadFromDiskOrPipelineCache(const QRhiShaderStage *stages,
+ int stageCount,
+ GLuint program,
+ const QVector<QShaderDescription::InOutVariable> &inputVars,
+ QByteArray *cacheKey);
+ void trySaveToDiskCache(GLuint program, const QByteArray &cacheKey);
+ void trySaveToPipelineCache(GLuint program, const QByteArray &cacheKey, bool force = false);
+
+ QRhi::Flags rhiFlags;
+ QOpenGLContext *ctx = nullptr;
+ bool importedContext = false;
+ QSurfaceFormat requestedFormat;
+ QSurface *fallbackSurface = nullptr;
+ QPointer<QWindow> maybeWindow = nullptr;
+ QOpenGLContext *maybeShareContext = nullptr;
+ mutable bool needsMakeCurrentDueToSwap = false;
+ QOpenGLExtensions *f = nullptr;
+ void (QOPENGLF_APIENTRYP glPolygonMode) (GLenum, GLenum) = nullptr;
+ void(QOPENGLF_APIENTRYP glTexImage1D)(GLenum, GLint, GLint, GLsizei, GLint, GLenum, GLenum,
+ const void *) = nullptr;
+ void(QOPENGLF_APIENTRYP glTexStorage1D)(GLenum, GLint, GLenum, GLsizei) = nullptr;
+ void(QOPENGLF_APIENTRYP glTexSubImage1D)(GLenum, GLint, GLint, GLsizei, GLenum, GLenum,
+ const GLvoid *) = nullptr;
+ void(QOPENGLF_APIENTRYP glCopyTexSubImage1D)(GLenum, GLint, GLint, GLint, GLint,
+ GLsizei) = nullptr;
+ void(QOPENGLF_APIENTRYP glCompressedTexImage1D)(GLenum, GLint, GLenum, GLsizei, GLint, GLsizei,
+ const GLvoid *) = nullptr;
+ void(QOPENGLF_APIENTRYP glCompressedTexSubImage1D)(GLenum, GLint, GLint, GLsizei, GLenum,
+ GLsizei, const GLvoid *) = nullptr;
+ void(QOPENGLF_APIENTRYP glFramebufferTexture1D)(GLenum, GLenum, GLenum, GLuint,
+ GLint) = nullptr;
+ void(QOPENGLF_APIENTRYP glFramebufferTextureMultiviewOVR)(GLenum, GLenum, GLuint, GLint,
+ GLint, GLsizei) = nullptr;
+ void (QOPENGLF_APIENTRYP glQueryCounter)(GLuint, GLenum) = nullptr;
+ void (QOPENGLF_APIENTRYP glGetQueryObjectui64v)(GLuint, GLenum, quint64 *) = nullptr;
+ void (QOPENGLF_APIENTRYP glObjectLabel)(GLenum, GLuint, GLsizei, const GLchar *) = nullptr;
+ void (QOPENGLF_APIENTRYP glFramebufferTexture2DMultisampleEXT)(GLenum, GLenum, GLenum, GLuint, GLint, GLsizei) = nullptr;
+ void (QOPENGLF_APIENTRYP glFramebufferTextureMultisampleMultiviewOVR)(GLenum, GLenum, GLuint, GLint, GLsizei, GLint, GLsizei) = nullptr;
+ uint vao = 0;
+ struct Caps {
+ Caps()
+ : ctxMajor(2),
+ ctxMinor(0),
+ maxTextureSize(2048),
+ maxDrawBuffers(4),
+ maxSamples(16),
+ maxTextureArraySize(0),
+ maxThreadGroupsPerDimension(0),
+ maxThreadsPerThreadGroup(0),
+ maxThreadGroupsX(0),
+ maxThreadGroupsY(0),
+ maxThreadGroupsZ(0),
+ maxUniformVectors(4096),
+ maxVertexInputs(8),
+ maxVertexOutputs(8),
+ msaaRenderBuffer(false),
+ multisampledTexture(false),
+ npotTextureFull(true),
+ gles(false),
+ fixedIndexPrimitiveRestart(false),
+ bgraExternalFormat(false),
+ bgraInternalFormat(false),
+ r8Format(false),
+ r16Format(false),
+ floatFormats(false),
+ rgb10Formats(false),
+ depthTexture(false),
+ packedDepthStencil(false),
+ needsDepthStencilCombinedAttach(false),
+ srgbWriteControl(false),
+ coreProfile(false),
+ uniformBuffers(false),
+ elementIndexUint(false),
+ depth24(false),
+ rgba8Format(false),
+ instancing(false),
+ baseVertex(false),
+ compute(false),
+ textureCompareMode(false),
+ properMapBuffer(false),
+ nonBaseLevelFramebufferTexture(false),
+ texelFetch(false),
+ intAttributes(true),
+ screenSpaceDerivatives(false),
+ programBinary(false),
+ texture3D(false),
+ tessellation(false),
+ geometryShader(false),
+ texture1D(false),
+ hasDrawBuffersFunc(false),
+ halfAttributes(false),
+ multiView(false),
+ timestamps(false),
+ objectLabel(false),
+ glesMultisampleRenderToTexture(false),
+ glesMultiviewMultisampleRenderToTexture(false),
+ unpackRowLength(false)
+ { }
+ int ctxMajor;
+ int ctxMinor;
+ int maxTextureSize;
+ int maxDrawBuffers;
+ int maxSamples;
+ int maxTextureArraySize;
+ int maxThreadGroupsPerDimension;
+ int maxThreadsPerThreadGroup;
+ int maxThreadGroupsX;
+ int maxThreadGroupsY;
+ int maxThreadGroupsZ;
+ int maxUniformVectors;
+ int maxVertexInputs;
+ int maxVertexOutputs;
+ // Multisample fb and blit are supported (GLES 3.0 or OpenGL 3.x). Not
+ // the same as multisample textures!
+ uint msaaRenderBuffer : 1;
+ uint multisampledTexture : 1;
+ uint npotTextureFull : 1;
+ uint gles : 1;
+ uint fixedIndexPrimitiveRestart : 1;
+ uint bgraExternalFormat : 1;
+ uint bgraInternalFormat : 1;
+ uint r8Format : 1;
+ uint r16Format : 1;
+ uint floatFormats : 1;
+ uint rgb10Formats : 1;
+ uint depthTexture : 1;
+ uint packedDepthStencil : 1;
+ uint needsDepthStencilCombinedAttach : 1;
+ uint srgbWriteControl : 1;
+ uint coreProfile : 1;
+ uint uniformBuffers : 1;
+ uint elementIndexUint : 1;
+ uint depth24 : 1;
+ uint rgba8Format : 1;
+ uint instancing : 1;
+ uint baseVertex : 1;
+ uint compute : 1;
+ uint textureCompareMode : 1;
+ uint properMapBuffer : 1;
+ uint nonBaseLevelFramebufferTexture : 1;
+ uint texelFetch : 1;
+ uint intAttributes : 1;
+ uint screenSpaceDerivatives : 1;
+ uint programBinary : 1;
+ uint texture3D : 1;
+ uint tessellation : 1;
+ uint geometryShader : 1;
+ uint texture1D : 1;
+ uint hasDrawBuffersFunc : 1;
+ uint halfAttributes : 1;
+ uint multiView : 1;
+ uint timestamps : 1;
+ uint objectLabel : 1;
+ uint glesMultisampleRenderToTexture : 1;
+ uint glesMultiviewMultisampleRenderToTexture : 1;
+ uint unpackRowLength : 1;
+ } caps;
+ QGles2SwapChain *currentSwapChain = nullptr;
+ QSet<GLint> supportedCompressedFormats;
+ mutable QList<int> supportedSampleCountList;
+ QRhiGles2NativeHandles nativeHandlesStruct;
+ QRhiDriverInfo driverInfoStruct;
+ mutable bool contextLost = false;
+
+ struct DeferredReleaseEntry {
+ enum Type {
+ Buffer,
+ Pipeline,
+ Texture,
+ RenderBuffer,
+ TextureRenderTarget
+ };
+ Type type;
+ union {
+ struct {
+ GLuint buffer;
+ } buffer;
+ struct {
+ GLuint program;
+ } pipeline;
+ struct {
+ GLuint texture;
+ } texture;
+ struct {
+ GLuint renderbuffer;
+ GLuint renderbuffer2;
+ } renderbuffer;
+ struct {
+ GLuint framebuffer;
+ GLuint nonMsaaThrowawayDepthTexture;
+ } textureRenderTarget;
+ };
+ };
+ QList<DeferredReleaseEntry> releaseQueue;
+
+ struct OffscreenFrame {
+ OffscreenFrame(QRhiImplementation *rhi) : cbWrapper(rhi) { }
+ bool active = false;
+ QGles2CommandBuffer cbWrapper;
+ GLuint tsQueries[2] = {};
+ } ofr;
+
+ QHash<QRhiShaderStage, uint> m_shaderCache;
+
+ struct PipelineCacheData {
+ quint32 format;
+ QByteArray data;
+ };
+ QHash<QByteArray, PipelineCacheData> m_pipelineCache;
+};
+
+Q_DECLARE_TYPEINFO(QRhiGles2::DeferredReleaseEntry, Q_RELOCATABLE_TYPE);
+
QT_END_NAMESPACE
#endif
diff --git a/src/gui/rhi/qrhigles2_p_p.h b/src/gui/rhi/qrhigles2_p_p.h
deleted file mode 100644
index 4a98011d3d..0000000000
--- a/src/gui/rhi/qrhigles2_p_p.h
+++ /dev/null
@@ -1,851 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2019 The Qt Company Ltd.
-** Contact: http://www.qt.io/licensing/
-**
-** This file is part of the Qt Gui module
-**
-** $QT_BEGIN_LICENSE:LGPL3$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef QRHIGLES2_P_H
-#define QRHIGLES2_P_H
-
-//
-// W A R N I N G
-// -------------
-//
-// This file is not part of the Qt API. It exists purely as an
-// implementation detail. This header file may change from version to
-// version without notice, or even be removed.
-//
-// We mean it.
-//
-
-#include "qrhigles2_p.h"
-#include "qrhi_p_p.h"
-#include "qshaderdescription_p.h"
-#include <qopengl.h>
-#include <QSurface>
-
-QT_BEGIN_NAMESPACE
-
-class QOpenGLExtensions;
-
-struct QGles2Buffer : public QRhiBuffer
-{
- QGles2Buffer(QRhiImplementation *rhi, Type type, UsageFlags usage, int size);
- ~QGles2Buffer();
- void release() override;
- bool build() override;
-
- GLuint buffer = 0;
- GLenum targetForDataOps;
- QByteArray ubuf;
- enum Access {
- AccessNone,
- AccessVertex,
- AccessIndex,
- AccessUniform,
- AccessStorageRead,
- AccessStorageWrite,
- AccessStorageReadWrite,
- AccessUpdate
- };
- struct UsageState {
- Access access;
- };
- UsageState usageState;
- friend class QRhiGles2;
-};
-
-struct QGles2RenderBuffer : public QRhiRenderBuffer
-{
- QGles2RenderBuffer(QRhiImplementation *rhi, Type type, const QSize &pixelSize,
- int sampleCount, QRhiRenderBuffer::Flags flags);
- ~QGles2RenderBuffer();
- void release() override;
- bool build() override;
- QRhiTexture::Format backingFormat() const override;
-
- GLuint renderbuffer = 0;
- GLuint stencilRenderbuffer = 0; // when packed depth-stencil not supported
- int samples;
- friend class QRhiGles2;
-};
-
-struct QGles2SamplerData
-{
- GLenum glminfilter = 0;
- GLenum glmagfilter = 0;
- GLenum glwraps = 0;
- GLenum glwrapt = 0;
- GLenum glwrapr = 0;
- GLenum gltexcomparefunc = 0;
-};
-
-inline bool operator==(const QGles2SamplerData &a, const QGles2SamplerData &b)
-{
- return a.glminfilter == b.glminfilter
- && a.glmagfilter == b.glmagfilter
- && a.glwraps == b.glwraps
- && a.glwrapt == b.glwrapt
- && a.glwrapr == b.glwrapr
- && a.gltexcomparefunc == b.gltexcomparefunc;
-}
-
-inline bool operator!=(const QGles2SamplerData &a, const QGles2SamplerData &b)
-{
- return !(a == b);
-}
-
-struct QGles2Texture : public QRhiTexture
-{
- QGles2Texture(QRhiImplementation *rhi, Format format, const QSize &pixelSize,
- int sampleCount, Flags flags);
- ~QGles2Texture();
- void release() override;
- bool build() override;
- bool buildFrom(const QRhiNativeHandles *src) override;
- bool buildFrom(NativeTexture src) override;
- const QRhiNativeHandles *nativeHandles() override;
- NativeTexture nativeTexture() override;
-
- bool prepareBuild(QSize *adjustedSize = nullptr);
-
- GLuint texture = 0;
- bool owns = true;
- GLenum target;
- GLenum glintformat;
- GLenum glsizedintformat;
- GLenum glformat;
- GLenum gltype;
- QGles2SamplerData samplerState;
- bool specified = false;
- int mipLevelCount = 0;
- QRhiGles2TextureNativeHandles nativeHandlesStruct;
- enum Access {
- AccessNone,
- AccessSample,
- AccessFramebuffer,
- AccessStorageRead,
- AccessStorageWrite,
- AccessStorageReadWrite,
- AccessUpdate,
- AccessRead
- };
- struct UsageState {
- Access access;
- };
- UsageState usageState;
-
- uint generation = 0;
- friend class QRhiGles2;
-};
-
-struct QGles2Sampler : public QRhiSampler
-{
- QGles2Sampler(QRhiImplementation *rhi, Filter magFilter, Filter minFilter, Filter mipmapMode,
- AddressMode u, AddressMode v);
- ~QGles2Sampler();
- void release() override;
- bool build() override;
-
- QGles2SamplerData d;
- uint generation = 0;
- friend class QRhiGles2;
-};
-
-struct QGles2RenderPassDescriptor : public QRhiRenderPassDescriptor
-{
- QGles2RenderPassDescriptor(QRhiImplementation *rhi);
- ~QGles2RenderPassDescriptor();
- void release() override;
- bool isCompatible(const QRhiRenderPassDescriptor *other) const override;
-};
-
-struct QGles2RenderTargetData
-{
- QGles2RenderTargetData(QRhiImplementation *) { }
-
- QGles2RenderPassDescriptor *rp = nullptr;
- QSize pixelSize;
- float dpr = 1;
- int sampleCount = 1;
- int colorAttCount = 0;
- int dsAttCount = 0;
- bool srgbUpdateAndBlend = false;
-};
-
-struct QGles2ReferenceRenderTarget : public QRhiRenderTarget
-{
- QGles2ReferenceRenderTarget(QRhiImplementation *rhi);
- ~QGles2ReferenceRenderTarget();
- void release() override;
-
- QSize pixelSize() const override;
- float devicePixelRatio() const override;
- int sampleCount() const override;
-
- QGles2RenderTargetData d;
-};
-
-struct QGles2TextureRenderTarget : public QRhiTextureRenderTarget
-{
- QGles2TextureRenderTarget(QRhiImplementation *rhi, const QRhiTextureRenderTargetDescription &desc, Flags flags);
- ~QGles2TextureRenderTarget();
- void release() override;
-
- QSize pixelSize() const override;
- float devicePixelRatio() const override;
- int sampleCount() const override;
-
- QRhiRenderPassDescriptor *newCompatibleRenderPassDescriptor() override;
- bool build() override;
-
- QGles2RenderTargetData d;
- GLuint framebuffer = 0;
- friend class QRhiGles2;
-};
-
-struct QGles2ShaderResourceBindings : public QRhiShaderResourceBindings
-{
- QGles2ShaderResourceBindings(QRhiImplementation *rhi);
- ~QGles2ShaderResourceBindings();
- void release() override;
- bool build() override;
-
- uint generation = 0;
- friend class QRhiGles2;
-};
-
-struct QGles2UniformDescription
-{
- QShaderDescription::VariableType type;
- int glslLocation;
- int binding;
- uint offset;
- int size;
-};
-
-Q_DECLARE_TYPEINFO(QGles2UniformDescription, Q_MOVABLE_TYPE);
-
-struct QGles2SamplerDescription
-{
- int glslLocation;
- int binding;
-};
-
-Q_DECLARE_TYPEINFO(QGles2SamplerDescription, Q_MOVABLE_TYPE);
-
-struct QGles2GraphicsPipeline : public QRhiGraphicsPipeline
-{
- QGles2GraphicsPipeline(QRhiImplementation *rhi);
- ~QGles2GraphicsPipeline();
- void release() override;
- bool build() override;
-
- GLuint program = 0;
- GLenum drawMode = GL_TRIANGLES;
- QVector<QGles2UniformDescription> uniforms;
- QVector<QGles2SamplerDescription> samplers;
- uint generation = 0;
- friend class QRhiGles2;
-};
-
-struct QGles2ComputePipeline : public QRhiComputePipeline
-{
- QGles2ComputePipeline(QRhiImplementation *rhi);
- ~QGles2ComputePipeline();
- void release() override;
- bool build() override;
-
- GLuint program = 0;
- QVector<QGles2UniformDescription> uniforms;
- QVector<QGles2SamplerDescription> samplers;
- uint generation = 0;
- friend class QRhiGles2;
-};
-
-struct QGles2CommandBuffer : public QRhiCommandBuffer
-{
- QGles2CommandBuffer(QRhiImplementation *rhi);
- ~QGles2CommandBuffer();
- void release() override;
-
- struct Command {
- enum Cmd {
- BeginFrame,
- EndFrame,
- ResetFrame,
- Viewport,
- Scissor,
- BlendConstants,
- StencilRef,
- BindVertexBuffer,
- BindIndexBuffer,
- Draw,
- DrawIndexed,
- BindGraphicsPipeline,
- BindShaderResources,
- BindFramebuffer,
- Clear,
- BufferSubData,
- GetBufferSubData,
- CopyTex,
- ReadPixels,
- SubImage,
- CompressedImage,
- CompressedSubImage,
- BlitFromRenderbuffer,
- GenMip,
- BindComputePipeline,
- Dispatch,
- BarriersForPass,
- Barrier
- };
- Cmd cmd;
-
- static const int MAX_UBUF_BINDINGS = 32; // should be more than enough
-
- // QRhi*/QGles2* references should be kept at minimum (so no
- // QRhiTexture/Buffer/etc. pointers).
- union {
- struct {
- float x, y, w, h;
- float d0, d1;
- } viewport;
- struct {
- int x, y, w, h;
- } scissor;
- struct {
- float r, g, b, a;
- } blendConstants;
- struct {
- quint32 ref;
- QRhiGraphicsPipeline *ps;
- } stencilRef;
- struct {
- QRhiGraphicsPipeline *ps;
- GLuint buffer;
- quint32 offset;
- int binding;
- } bindVertexBuffer;
- struct {
- GLuint buffer;
- quint32 offset;
- GLenum type;
- } bindIndexBuffer;
- struct {
- QRhiGraphicsPipeline *ps;
- quint32 vertexCount;
- quint32 firstVertex;
- quint32 instanceCount;
- quint32 baseInstance;
- } draw;
- struct {
- QRhiGraphicsPipeline *ps;
- quint32 indexCount;
- quint32 firstIndex;
- quint32 instanceCount;
- quint32 baseInstance;
- qint32 baseVertex;
- } drawIndexed;
- struct {
- QRhiGraphicsPipeline *ps;
- } bindGraphicsPipeline;
- struct {
- QRhiGraphicsPipeline *maybeGraphicsPs;
- QRhiComputePipeline *maybeComputePs;
- QRhiShaderResourceBindings *srb;
- int dynamicOffsetCount;
- uint dynamicOffsetPairs[MAX_UBUF_BINDINGS * 2]; // binding, offsetInConstants
- } bindShaderResources;
- struct {
- GLbitfield mask;
- float c[4];
- float d;
- quint32 s;
- } clear;
- struct {
- GLuint fbo;
- bool srgb;
- int colorAttCount;
- } bindFramebuffer;
- struct {
- GLenum target;
- GLuint buffer;
- int offset;
- int size;
- const void *data; // must come from retainData()
- } bufferSubData;
- struct {
- QRhiBufferReadbackResult *result;
- GLenum target;
- GLuint buffer;
- int offset;
- int size;
- } getBufferSubData;
- struct {
- GLenum srcFaceTarget;
- GLuint srcTexture;
- int srcLevel;
- int srcX;
- int srcY;
- GLenum dstTarget;
- GLuint dstTexture;
- GLenum dstFaceTarget;
- int dstLevel;
- int dstX;
- int dstY;
- int w;
- int h;
- } copyTex;
- struct {
- QRhiReadbackResult *result;
- GLuint texture;
- int w;
- int h;
- QRhiTexture::Format format;
- GLenum readTarget;
- int level;
- } readPixels;
- struct {
- GLenum target;
- GLuint texture;
- GLenum faceTarget;
- int level;
- int dx;
- int dy;
- int w;
- int h;
- GLenum glformat;
- GLenum gltype;
- int rowStartAlign;
- const void *data; // must come from retainImage()
- } subImage;
- struct {
- GLenum target;
- GLuint texture;
- GLenum faceTarget;
- int level;
- GLenum glintformat;
- int w;
- int h;
- int size;
- const void *data; // must come from retainData()
- } compressedImage;
- struct {
- GLenum target;
- GLuint texture;
- GLenum faceTarget;
- int level;
- int dx;
- int dy;
- int w;
- int h;
- GLenum glintformat;
- int size;
- const void *data; // must come from retainData()
- } compressedSubImage;
- struct {
- GLuint renderbuffer;
- int w;
- int h;
- GLenum target;
- GLuint texture;
- int dstLevel;
- } blitFromRb;
- struct {
- GLenum target;
- GLuint texture;
- } genMip;
- struct {
- QRhiComputePipeline *ps;
- } bindComputePipeline;
- struct {
- GLuint x;
- GLuint y;
- GLuint z;
- } dispatch;
- struct {
- int trackerIndex;
- } barriersForPass;
- struct {
- GLbitfield barriers;
- } barrier;
- } args;
- };
-
- enum PassType {
- NoPass,
- RenderPass,
- ComputePass
- };
-
- QVector<Command> commands;
- QVarLengthArray<QRhiPassResourceTracker, 8> passResTrackers;
- int currentPassResTrackerIndex;
-
- PassType recordingPass;
- QRhiRenderTarget *currentTarget;
- QRhiGraphicsPipeline *currentGraphicsPipeline;
- QRhiComputePipeline *currentComputePipeline;
- uint currentPipelineGeneration;
- QRhiShaderResourceBindings *currentGraphicsSrb;
- QRhiShaderResourceBindings *currentComputeSrb;
- uint currentSrbGeneration;
-
- QVector<QByteArray> dataRetainPool;
- QVector<QImage> imageRetainPool;
-
- // relies heavily on implicit sharing (no copies of the actual data will be made)
- const void *retainData(const QByteArray &data) {
- dataRetainPool.append(data);
- return dataRetainPool.constLast().constData();
- }
- const void *retainImage(const QImage &image) {
- imageRetainPool.append(image);
- return imageRetainPool.constLast().constBits();
- }
- void resetCommands() {
- commands.clear();
- dataRetainPool.clear();
- imageRetainPool.clear();
-
- passResTrackers.clear();
- currentPassResTrackerIndex = -1;
- }
- void resetState() {
- recordingPass = NoPass;
- currentTarget = nullptr;
- resetCommands();
- resetCachedState();
- }
- void resetCachedState() {
- currentGraphicsPipeline = nullptr;
- currentComputePipeline = nullptr;
- currentPipelineGeneration = 0;
- currentGraphicsSrb = nullptr;
- currentComputeSrb = nullptr;
- currentSrbGeneration = 0;
- }
-};
-
-Q_DECLARE_TYPEINFO(QGles2CommandBuffer::Command, Q_MOVABLE_TYPE);
-
-struct QGles2SwapChain : public QRhiSwapChain
-{
- QGles2SwapChain(QRhiImplementation *rhi);
- ~QGles2SwapChain();
- void release() override;
-
- QRhiCommandBuffer *currentFrameCommandBuffer() override;
- QRhiRenderTarget *currentFrameRenderTarget() override;
-
- QSize surfacePixelSize() override;
-
- QRhiRenderPassDescriptor *newCompatibleRenderPassDescriptor() override;
- bool buildOrResize() override;
-
- QSurface *surface = nullptr;
- QSize pixelSize;
- QGles2ReferenceRenderTarget rt;
- QGles2CommandBuffer cb;
- int frameCount = 0;
-};
-
-class QRhiGles2 : public QRhiImplementation
-{
-public:
- QRhiGles2(QRhiGles2InitParams *params, QRhiGles2NativeHandles *importDevice = nullptr);
-
- bool create(QRhi::Flags flags) override;
- void destroy() override;
-
- QRhiGraphicsPipeline *createGraphicsPipeline() override;
- QRhiComputePipeline *createComputePipeline() override;
- QRhiShaderResourceBindings *createShaderResourceBindings() override;
- QRhiBuffer *createBuffer(QRhiBuffer::Type type,
- QRhiBuffer::UsageFlags usage,
- int size) override;
- QRhiRenderBuffer *createRenderBuffer(QRhiRenderBuffer::Type type,
- const QSize &pixelSize,
- int sampleCount,
- QRhiRenderBuffer::Flags flags) override;
- QRhiTexture *createTexture(QRhiTexture::Format format,
- const QSize &pixelSize,
- int sampleCount,
- QRhiTexture::Flags flags) override;
- QRhiSampler *createSampler(QRhiSampler::Filter magFilter, QRhiSampler::Filter minFilter,
- QRhiSampler::Filter mipmapMode,
- QRhiSampler:: AddressMode u, QRhiSampler::AddressMode v) override;
-
- QRhiTextureRenderTarget *createTextureRenderTarget(const QRhiTextureRenderTargetDescription &desc,
- QRhiTextureRenderTarget::Flags flags) override;
-
- QRhiSwapChain *createSwapChain() override;
- QRhi::FrameOpResult beginFrame(QRhiSwapChain *swapChain, QRhi::BeginFrameFlags flags) override;
- QRhi::FrameOpResult endFrame(QRhiSwapChain *swapChain, QRhi::EndFrameFlags flags) override;
- QRhi::FrameOpResult beginOffscreenFrame(QRhiCommandBuffer **cb, QRhi::BeginFrameFlags flags) override;
- QRhi::FrameOpResult endOffscreenFrame(QRhi::EndFrameFlags flags) override;
- QRhi::FrameOpResult finish() override;
-
- void resourceUpdate(QRhiCommandBuffer *cb, QRhiResourceUpdateBatch *resourceUpdates) override;
-
- void beginPass(QRhiCommandBuffer *cb,
- QRhiRenderTarget *rt,
- const QColor &colorClearValue,
- const QRhiDepthStencilClearValue &depthStencilClearValue,
- QRhiResourceUpdateBatch *resourceUpdates) override;
- void endPass(QRhiCommandBuffer *cb, QRhiResourceUpdateBatch *resourceUpdates) override;
-
- void setGraphicsPipeline(QRhiCommandBuffer *cb,
- QRhiGraphicsPipeline *ps) override;
-
- void setShaderResources(QRhiCommandBuffer *cb,
- QRhiShaderResourceBindings *srb,
- int dynamicOffsetCount,
- const QRhiCommandBuffer::DynamicOffset *dynamicOffsets) override;
-
- void setVertexInput(QRhiCommandBuffer *cb,
- int startBinding, int bindingCount, const QRhiCommandBuffer::VertexInput *bindings,
- QRhiBuffer *indexBuf, quint32 indexOffset,
- QRhiCommandBuffer::IndexFormat indexFormat) override;
-
- void setViewport(QRhiCommandBuffer *cb, const QRhiViewport &viewport) override;
- void setScissor(QRhiCommandBuffer *cb, const QRhiScissor &scissor) override;
- void setBlendConstants(QRhiCommandBuffer *cb, const QColor &c) override;
- void setStencilRef(QRhiCommandBuffer *cb, quint32 refValue) override;
-
- void draw(QRhiCommandBuffer *cb, quint32 vertexCount,
- quint32 instanceCount, quint32 firstVertex, quint32 firstInstance) override;
-
- void drawIndexed(QRhiCommandBuffer *cb, quint32 indexCount,
- quint32 instanceCount, quint32 firstIndex,
- qint32 vertexOffset, quint32 firstInstance) override;
-
- void debugMarkBegin(QRhiCommandBuffer *cb, const QByteArray &name) override;
- void debugMarkEnd(QRhiCommandBuffer *cb) override;
- void debugMarkMsg(QRhiCommandBuffer *cb, const QByteArray &msg) override;
-
- void beginComputePass(QRhiCommandBuffer *cb, QRhiResourceUpdateBatch *resourceUpdates) override;
- void endComputePass(QRhiCommandBuffer *cb, QRhiResourceUpdateBatch *resourceUpdates) override;
- void setComputePipeline(QRhiCommandBuffer *cb, QRhiComputePipeline *ps) override;
- void dispatch(QRhiCommandBuffer *cb, int x, int y, int z) override;
-
- const QRhiNativeHandles *nativeHandles(QRhiCommandBuffer *cb) override;
- void beginExternal(QRhiCommandBuffer *cb) override;
- void endExternal(QRhiCommandBuffer *cb) override;
-
- QVector<int> supportedSampleCounts() const override;
- int ubufAlignment() const override;
- bool isYUpInFramebuffer() const override;
- bool isYUpInNDC() const override;
- bool isClipDepthZeroToOne() const override;
- QMatrix4x4 clipSpaceCorrMatrix() const override;
- bool isTextureFormatSupported(QRhiTexture::Format format, QRhiTexture::Flags flags) const override;
- bool isFeatureSupported(QRhi::Feature feature) const override;
- int resourceLimit(QRhi::ResourceLimit limit) const override;
- const QRhiNativeHandles *nativeHandles() override;
- void sendVMemStatsToProfiler() override;
- bool makeThreadLocalNativeContextCurrent() override;
- void releaseCachedResources() override;
- bool isDeviceLost() const override;
-
- bool ensureContext(QSurface *surface = nullptr) const;
- void executeDeferredReleases();
- void trackedBufferBarrier(QGles2CommandBuffer *cbD, QGles2Buffer *bufD, QGles2Buffer::Access access);
- void trackedImageBarrier(QGles2CommandBuffer *cbD, QGles2Texture *texD, QGles2Texture::Access access);
- void enqueueSubresUpload(QGles2Texture *texD, QGles2CommandBuffer *cbD,
- int layer, int level, const QRhiTextureSubresourceUploadDescription &subresDesc);
- void enqueueResourceUpdates(QRhiCommandBuffer *cb, QRhiResourceUpdateBatch *resourceUpdates);
- void trackedRegisterBuffer(QRhiPassResourceTracker *passResTracker,
- QGles2Buffer *bufD,
- QRhiPassResourceTracker::BufferAccess access,
- QRhiPassResourceTracker::BufferStage stage);
- void trackedRegisterTexture(QRhiPassResourceTracker *passResTracker,
- QGles2Texture *texD,
- QRhiPassResourceTracker::TextureAccess access,
- QRhiPassResourceTracker::TextureStage stage);
- void executeCommandBuffer(QRhiCommandBuffer *cb);
- void executeBindGraphicsPipeline(QRhiGraphicsPipeline *ps);
- void bindShaderResources(QRhiGraphicsPipeline *maybeGraphicsPs, QRhiComputePipeline *maybeComputePs,
- QRhiShaderResourceBindings *srb,
- const uint *dynOfsPairs, int dynOfsCount);
- QGles2RenderTargetData *enqueueBindFramebuffer(QRhiRenderTarget *rt, QGles2CommandBuffer *cbD,
- bool *wantsColorClear = nullptr, bool *wantsDsClear = nullptr);
- void enqueueBarriersForPass(QGles2CommandBuffer *cbD);
- int effectiveSampleCount(int sampleCount) const;
- QByteArray shaderSource(const QRhiShaderStage &shaderStage, int *glslVersion);
- bool compileShader(GLuint program, const QRhiShaderStage &shaderStage, int *glslVersion);
- bool linkProgram(GLuint program);
- void registerUniformIfActive(const QShaderDescription::BlockVariable &var,
- const QByteArray &namePrefix,
- int binding,
- int baseOffset,
- GLuint program,
- QVector<QGles2UniformDescription> *dst);
- void gatherUniforms(GLuint program,
- const QShaderDescription::UniformBlock &ub,
- QVector<QGles2UniformDescription> *dst);
- void gatherSamplers(GLuint program, const QShaderDescription::InOutVariable &v,
- QVector<QGles2SamplerDescription> *dst);
- bool isProgramBinaryDiskCacheEnabled() const;
-
- enum DiskCacheResult {
- DiskCacheHit,
- DiskCacheMiss,
- DiskCacheError
- };
- DiskCacheResult tryLoadFromDiskCache(const QRhiShaderStage *stages, int stageCount,
- GLuint program, QByteArray *cacheKey);
- void trySaveToDiskCache(GLuint program, const QByteArray &cacheKey);
-
- QOpenGLContext *ctx = nullptr;
- bool importedContext = false;
- QSurfaceFormat requestedFormat;
- QSurface *fallbackSurface = nullptr;
- QWindow *maybeWindow = nullptr;
- mutable bool needsMakeCurrent = false;
- QOpenGLExtensions *f = nullptr;
- uint vao = 0;
- struct Caps {
- Caps()
- : ctxMajor(2),
- ctxMinor(0),
- maxTextureSize(2048),
- maxDrawBuffers(4),
- msaaRenderBuffer(false),
- npotTextureFull(true),
- gles(false),
- fixedIndexPrimitiveRestart(false),
- bgraExternalFormat(false),
- bgraInternalFormat(false),
- r8Format(false),
- r16Format(false),
- floatFormats(false),
- depthTexture(false),
- packedDepthStencil(false),
- needsDepthStencilCombinedAttach(false),
- srgbCapableDefaultFramebuffer(false),
- coreProfile(false),
- uniformBuffers(false),
- elementIndexUint(false),
- depth24(false),
- rgba8Format(false),
- instancing(false),
- baseVertex(false),
- compute(false),
- textureCompareMode(false),
- properMapBuffer(false),
- nonBaseLevelFramebufferTexture(false)
- { }
- int ctxMajor;
- int ctxMinor;
- int maxTextureSize;
- int maxDrawBuffers;
- int maxSamples;
- // Multisample fb and blit are supported (GLES 3.0 or OpenGL 3.x). Not
- // the same as multisample textures!
- uint msaaRenderBuffer : 1;
- uint npotTextureFull : 1;
- uint gles : 1;
- uint fixedIndexPrimitiveRestart : 1;
- uint bgraExternalFormat : 1;
- uint bgraInternalFormat : 1;
- uint r8Format : 1;
- uint r16Format : 1;
- uint floatFormats : 1;
- uint depthTexture : 1;
- uint packedDepthStencil : 1;
- uint needsDepthStencilCombinedAttach : 1;
- uint srgbCapableDefaultFramebuffer : 1;
- uint coreProfile : 1;
- uint uniformBuffers : 1;
- uint elementIndexUint : 1;
- uint depth24 : 1;
- uint rgba8Format : 1;
- uint instancing : 1;
- uint baseVertex : 1;
- uint compute : 1;
- uint textureCompareMode : 1;
- uint properMapBuffer : 1;
- uint nonBaseLevelFramebufferTexture : 1;
- } caps;
- QGles2SwapChain *currentSwapChain = nullptr;
- QVector<GLint> supportedCompressedFormats;
- mutable QVector<int> supportedSampleCountList;
- QRhiGles2NativeHandles nativeHandlesStruct;
- mutable bool contextLost = false;
-
- struct DeferredReleaseEntry {
- enum Type {
- Buffer,
- Pipeline,
- Texture,
- RenderBuffer,
- TextureRenderTarget
- };
- Type type;
- union {
- struct {
- GLuint buffer;
- } buffer;
- struct {
- GLuint program;
- } pipeline;
- struct {
- GLuint texture;
- } texture;
- struct {
- GLuint renderbuffer;
- GLuint renderbuffer2;
- } renderbuffer;
- struct {
- GLuint framebuffer;
- } textureRenderTarget;
- };
- };
- QVector<DeferredReleaseEntry> releaseQueue;
-
- struct OffscreenFrame {
- OffscreenFrame(QRhiImplementation *rhi) : cbWrapper(rhi) { }
- bool active = false;
- QGles2CommandBuffer cbWrapper;
- } ofr;
-
- QHash<QRhiShaderStage, uint> m_shaderCache;
-};
-
-Q_DECLARE_TYPEINFO(QRhiGles2::DeferredReleaseEntry, Q_MOVABLE_TYPE);
-
-QT_END_NAMESPACE
-
-#endif
diff --git a/src/gui/rhi/qrhimetal.mm b/src/gui/rhi/qrhimetal.mm
index 3aa68db585..9fadfc15fa 100644
--- a/src/gui/rhi/qrhimetal.mm
+++ b/src/gui/rhi/qrhimetal.mm
@@ -1,43 +1,18 @@
-/****************************************************************************
-**
-** Copyright (C) 2019 The Qt Company Ltd.
-** Contact: http://www.qt.io/licensing/
-**
-** This file is part of the Qt Gui module
-**
-** $QT_BEGIN_LICENSE:LGPL3$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "qrhimetal_p_p.h"
+// Copyright (C) 2023 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
+
+#include "qrhimetal_p.h"
+#include "qshader_p.h"
#include <QGuiApplication>
#include <QWindow>
+#include <QUrl>
+#include <QFile>
+#include <QTemporaryFile>
+#include <QFileInfo>
#include <qmath.h>
+#include <QOperatingSystemVersion>
+
+#include <QtCore/private/qcore_mac_p.h>
#ifdef Q_OS_MACOS
#include <AppKit/AppKit.h>
@@ -65,18 +40,28 @@ QT_BEGIN_NAMESPACE
#error ARC not supported
#endif
-// Note: we expect everything here pass the Metal API validation when running
-// in Debug mode in XCode. Some of the issues that break validation are not
-// obvious and not visible when running outside XCode.
-//
-// An exception is the nextDrawable Called Early blah blah warning, which is
-// plain and simply false.
+// Even though the macOS 13 MTLBinaryArchive problem (QTBUG-106703) seems
+// to be solved in later 13.x releases, we have reports from old Intel hardware
+// and older macOS versions where this causes problems (QTBUG-114338).
+// Thus we no longer do OS version based differentiation, but rather have a
+// single toggle that is currently on, and so QRhi::(set)pipelineCache()
+// does nothing with Metal.
+#define QRHI_METAL_DISABLE_BINARY_ARCHIVE
+
+// We should be able to operate with command buffers that do not automatically
+// retain/release the resources used by them. (since we have logic that mirrors
+// other backends such as the Vulkan one anyway)
+#define QRHI_METAL_COMMAND_BUFFERS_WITH_UNRETAINED_REFERENCES
/*!
\class QRhiMetalInitParams
\inmodule QtRhi
+ \since 6.6
\brief Metal specific initialization parameters.
+ \note This is a RHI API with limited compatibility guarantees, see \l QRhi
+ for details.
+
A Metal-based QRhi needs no special parameters for initialization.
\badcode
@@ -84,10 +69,13 @@ QT_BEGIN_NAMESPACE
rhi = QRhi::create(QRhi::Metal, &params);
\endcode
- \note Metal API validation cannot be enabled by the application. Instead,
- run the debug build of the application in XCode. Generating a
- \c{.xcodeproj} file via \c{qmake -spec macx-xcode} provides a convenient
- way to enable this.
+ \note Metal API validation cannot be enabled programmatically by the QRhi.
+ Instead, either run the debug build of the application in XCode, by
+ generating a \c{.xcodeproj} file via \c{cmake -G Xcode}, or set the
+ environment variable \c{METAL_DEVICE_WRAPPER_TYPE=1}. The variable needs to
+ be set early on in the environment, perferably before starting the process;
+ attempting to set it at QRhi creation time is not functional in practice.
+ (too late probably)
\note QRhiSwapChain can only target QWindow instances that have their
surface type set to QSurface::MetalSurface.
@@ -106,46 +94,65 @@ QT_BEGIN_NAMESPACE
/*!
\class QRhiMetalNativeHandles
\inmodule QtRhi
+ \since 6.6
\brief Holds the Metal device used by the QRhi.
- \note The class uses \c{void *} as the type since including the Objective C
- headers is not acceptable here. The actual types are \c{id<MTLDevice>} and
- \c{id<MTLCommandQueue>}.
+ \note This is a RHI API with limited compatibility guarantees, see \l QRhi
+ for details.
*/
/*!
- \class QRhiMetalTextureNativeHandles
- \inmodule QtRhi
- \brief Holds the Metal texture object that is backing a QRhiTexture instance.
+ \variable QRhiMetalNativeHandles::dev
- \note The class uses \c{void *} as the type since including the Objective C
- headers is not acceptable here. The actual type is \c{id<MTLTexture>}.
- */
+ Set to a valid MTLDevice to import an existing device.
+*/
+
+/*!
+ \variable QRhiMetalNativeHandles::cmdQueue
+
+ Set to a valid MTLCommandQueue when importing an existing command queue.
+ When \nullptr, QRhi will create a new command queue.
+*/
/*!
\class QRhiMetalCommandBufferNativeHandles
\inmodule QtRhi
+ \since 6.6
\brief Holds the MTLCommandBuffer and MTLRenderCommandEncoder objects that are backing a QRhiCommandBuffer.
\note The command buffer object is only guaranteed to be valid while
recording a frame, that is, between a \l{QRhi::beginFrame()}{beginFrame()}
- \l{QRhi::endFrame()}{endFrame()} or
\l{QRhi::beginOffscreenFrame()}{beginOffscreenFrame()} -
- \l{QRhi::endOffsrceenFrame()}{endOffscreenFrame()} pair.
+ \l{QRhi::endOffscreenFrame()}{endOffsrceenFrame()} pair.
\note The command encoder is only valid while recording a pass, that is,
between \l{QRhiCommandBuffer::beginPass()} -
\l{QRhiCommandBuffer::endPass()}.
+
+ \note This is a RHI API with limited compatibility guarantees, see \l QRhi
+ for details.
*/
+/*!
+ \variable QRhiMetalCommandBufferNativeHandles::commandBuffer
+*/
+
+/*!
+ \variable QRhiMetalCommandBufferNativeHandles::encoder
+*/
+
struct QMetalShader
{
id<MTLLibrary> lib = nil;
id<MTLFunction> func = nil;
- std::array<uint, 3> localSize;
+ std::array<uint, 3> localSize = {};
+ uint outputVertexCount = 0;
+ QShaderDescription desc;
QShader::NativeResourceBindingMap nativeResourceBindingMap;
+ QShader::NativeShaderInfo nativeShaderInfo;
- void release() {
+ void destroy() {
nativeResourceBindingMap.clear();
[lib release];
lib = nil;
@@ -156,11 +163,14 @@ struct QMetalShader
struct QRhiMetalData
{
- QRhiMetalData(QRhiImplementation *rhi) : ofr(rhi) { }
+ QRhiMetalData(QRhiMetal *rhi) : q(rhi), ofr(rhi) { }
+ QRhiMetal *q;
id<MTLDevice> dev = nil;
id<MTLCommandQueue> cmdQueue = nil;
+ API_AVAILABLE(macosx(11.0), ios(14.0)) id<MTLBinaryArchive> binArch = nil;
+ id<MTLCommandBuffer> newCommandBuffer();
MTLRenderPassDescriptor *createDefaultRenderPass(bool hasDepthStencil,
const QColor &colorClearValue,
const QRhiDepthStencilClearValue &depthStencilClearValue,
@@ -168,6 +178,11 @@ struct QRhiMetalData
id<MTLLibrary> createMetalLib(const QShader &shader, QShader::Variant shaderVariant,
QString *error, QByteArray *entryPoint, QShaderKey *activeKey);
id<MTLFunction> createMSLShaderFunction(id<MTLLibrary> lib, const QByteArray &entryPoint);
+ bool setupBinaryArchive(NSURL *sourceFileUrl = nil);
+ void addRenderPipelineToBinaryArchive(MTLRenderPipelineDescriptor *rpDesc);
+ void trySeedingRenderPipelineFromBinaryArchive(MTLRenderPipelineDescriptor *rpDesc);
+ void addComputePipelineToBinaryArchive(MTLComputePipelineDescriptor *cpDesc);
+ void trySeedingComputePipelineFromBinaryArchive(MTLComputePipelineDescriptor *cpDesc);
struct DeferredReleaseEntry {
enum Type {
@@ -175,7 +190,9 @@ struct QRhiMetalData
RenderBuffer,
Texture,
Sampler,
- StagingBuffer
+ StagingBuffer,
+ GraphicsPipeline,
+ ComputePipeline
};
Type type;
int lastActiveFrameSlot; // -1 if not used otherwise 0..FRAMES_IN_FLIGHT-1
@@ -189,7 +206,7 @@ struct QRhiMetalData
struct {
id<MTLTexture> texture;
id<MTLBuffer> stagingBuffers[QMTL_FRAMES_IN_FLIGHT];
- id<MTLTexture> views[QRhi::MAX_LEVELS];
+ id<MTLTexture> views[QRhi::MAX_MIP_LEVELS];
} texture;
struct {
id<MTLSamplerState> samplerState;
@@ -197,6 +214,15 @@ struct QRhiMetalData
struct {
id<MTLBuffer> buffer;
} stagingBuffer;
+ struct {
+ id<MTLRenderPipelineState> pipelineState;
+ id<MTLDepthStencilState> depthStencilState;
+ std::array<id<MTLComputePipelineState>, 3> tessVertexComputeState;
+ id<MTLComputePipelineState> tessTessControlComputeState;
+ } graphicsPipeline;
+ struct {
+ id<MTLComputePipelineState> pipelineState;
+ } computePipeline;
};
};
QVector<DeferredReleaseEntry> releaseQueue;
@@ -204,6 +230,7 @@ struct QRhiMetalData
struct OffscreenFrame {
OffscreenFrame(QRhiImplementation *rhi) : cbWrapper(rhi) { }
bool active = false;
+ double lastGpuTime = 0;
QMetalCommandBuffer cbWrapper;
} ofr;
@@ -216,25 +243,40 @@ struct QRhiMetalData
QSize pixelSize;
QRhiTexture::Format format;
};
- QVector<TextureReadback> activeTextureReadbacks;
+ QVarLengthArray<TextureReadback, 2> activeTextureReadbacks;
- API_AVAILABLE(macos(10.13), ios(11.0)) MTLCaptureManager *captureMgr;
- API_AVAILABLE(macos(10.13), ios(11.0)) id<MTLCaptureScope> captureScope = nil;
+ struct BufferReadback
+ {
+ int activeFrameSlot = -1;
+ QRhiReadbackResult *result;
+ quint32 offset;
+ quint32 readSize;
+ id<MTLBuffer> buf;
+ };
+
+ QVarLengthArray<BufferReadback, 2> activeBufferReadbacks;
+
+ MTLCaptureManager *captureMgr;
+ id<MTLCaptureScope> captureScope = nil;
static const int TEXBUF_ALIGN = 256; // probably not accurate
QHash<QRhiShaderStage, QMetalShader> shaderCache;
};
-Q_DECLARE_TYPEINFO(QRhiMetalData::DeferredReleaseEntry, Q_MOVABLE_TYPE);
-Q_DECLARE_TYPEINFO(QRhiMetalData::TextureReadback, Q_MOVABLE_TYPE);
+Q_DECLARE_TYPEINFO(QRhiMetalData::DeferredReleaseEntry, Q_RELOCATABLE_TYPE);
+Q_DECLARE_TYPEINFO(QRhiMetalData::TextureReadback, Q_RELOCATABLE_TYPE);
struct QMetalBufferData
{
bool managed;
bool slotted;
id<MTLBuffer> buf[QMTL_FRAMES_IN_FLIGHT];
- QVarLengthArray<QRhiResourceUpdateBatchPrivate::BufferOp, 16> pendingUpdates[QMTL_FRAMES_IN_FLIGHT];
+ struct BufferUpdate {
+ quint32 offset;
+ QRhiBufferData data;
+ };
+ QVarLengthArray<BufferUpdate, 16> pendingUpdates[QMTL_FRAMES_IN_FLIGHT];
};
struct QMetalRenderBufferData
@@ -252,7 +294,7 @@ struct QMetalTextureData
id<MTLTexture> tex = nil;
id<MTLBuffer> stagingBuf[QMTL_FRAMES_IN_FLIGHT];
bool owns = true;
- id<MTLTexture> perLevelViews[QRhi::MAX_LEVELS];
+ id<MTLTexture> perLevelViews[QRhi::MAX_MIP_LEVELS];
id<MTLTexture> viewForLevel(int level);
};
@@ -262,15 +304,45 @@ struct QMetalSamplerData
id<MTLSamplerState> samplerState = nil;
};
+struct QMetalShaderResourceBindingsData {
+ struct Stage {
+ struct Buffer {
+ int nativeBinding;
+ id<MTLBuffer> mtlbuf;
+ quint32 offset;
+ };
+ struct Texture {
+ int nativeBinding;
+ id<MTLTexture> mtltex;
+ };
+ struct Sampler {
+ int nativeBinding;
+ id<MTLSamplerState> mtlsampler;
+ };
+ QVarLengthArray<Buffer, 8> buffers;
+ QVarLengthArray<Texture, 8> textures;
+ QVarLengthArray<Sampler, 8> samplers;
+ QRhiBatchedBindings<id<MTLBuffer> > bufferBatches;
+ QRhiBatchedBindings<NSUInteger> bufferOffsetBatches;
+ QRhiBatchedBindings<id<MTLTexture> > textureBatches;
+ QRhiBatchedBindings<id<MTLSamplerState> > samplerBatches;
+ } res[QRhiMetal::SUPPORTED_STAGES];
+ enum { VERTEX = 0, FRAGMENT = 1, COMPUTE = 2, TESSCTRL = 3, TESSEVAL = 4 };
+};
+
struct QMetalCommandBufferData
{
id<MTLCommandBuffer> cb;
+ double lastGpuTime = 0;
id<MTLRenderCommandEncoder> currentRenderPassEncoder;
id<MTLComputeCommandEncoder> currentComputePassEncoder;
+ id<MTLComputeCommandEncoder> tessellationComputeEncoder;
MTLRenderPassDescriptor *currentPassRpDesc;
int currentFirstVertexBinding;
QRhiBatchedBindings<id<MTLBuffer> > currentVertexInputsBuffers;
QRhiBatchedBindings<NSUInteger> currentVertexInputOffsets;
+ id<MTLDepthStencilState> currentDepthStencilState;
+ QMetalShaderResourceBindingsData currentShaderResourceBindingState;
};
struct QMetalRenderTargetData
@@ -284,7 +356,8 @@ struct QMetalRenderTargetData
struct ColorAtt {
bool needsDrawableForTex = false;
id<MTLTexture> tex = nil;
- int layer = 0;
+ int arrayLayer = 0;
+ int slice = 0;
int level = 0;
bool needsDrawableForResolveTex = false;
id<MTLTexture> resolveTex = nil;
@@ -295,20 +368,77 @@ struct QMetalRenderTargetData
struct {
ColorAtt colorAtt[QMetalRenderPassDescriptor::MAX_COLOR_ATTACHMENTS];
id<MTLTexture> dsTex = nil;
+ id<MTLTexture> dsResolveTex = nil;
bool hasStencil = false;
bool depthNeedsStore = false;
+ bool preserveColor = false;
+ bool preserveDs = false;
} fb;
+
+ QRhiRenderTargetAttachmentTracker::ResIdList currentResIdList;
};
struct QMetalGraphicsPipelineData
{
+ QMetalGraphicsPipeline *q = nullptr;
id<MTLRenderPipelineState> ps = nil;
id<MTLDepthStencilState> ds = nil;
MTLPrimitiveType primitiveType;
MTLWinding winding;
MTLCullMode cullMode;
+ MTLTriangleFillMode triangleFillMode;
+ float depthBias;
+ float slopeScaledDepthBias;
QMetalShader vs;
QMetalShader fs;
+ struct ExtraBufferManager {
+ enum class WorkBufType {
+ DeviceLocal,
+ HostVisible
+ };
+ QMetalBuffer *acquireWorkBuffer(QRhiMetal *rhiD, quint32 size, WorkBufType type = WorkBufType::DeviceLocal);
+ QVector<QMetalBuffer *> deviceLocalWorkBuffers;
+ QVector<QMetalBuffer *> hostVisibleWorkBuffers;
+ } extraBufMgr;
+ struct Tessellation {
+ QMetalGraphicsPipelineData *q = nullptr;
+ bool enabled = false;
+ bool failed = false;
+ uint inControlPointCount;
+ uint outControlPointCount;
+ QMetalShader compVs[3];
+ std::array<id<MTLComputePipelineState>, 3> vertexComputeState = {};
+ id<MTLComputePipelineState> tessControlComputeState = nil;
+ QMetalShader compTesc;
+ QMetalShader vertTese;
+ quint32 vsCompOutputBufferSize(quint32 vertexOrIndexCount, quint32 instanceCount) const
+ {
+ // max vertex output components = resourceLimit(MaxVertexOutputs) * 4 = 60
+ return vertexOrIndexCount * instanceCount * sizeof(float) * 60;
+ }
+ quint32 tescCompOutputBufferSize(quint32 patchCount) const
+ {
+ return outControlPointCount * patchCount * sizeof(float) * 60;
+ }
+ quint32 tescCompPatchOutputBufferSize(quint32 patchCount) const
+ {
+ // assume maxTessellationControlPerPatchOutputComponents is 128
+ return patchCount * sizeof(float) * 128;
+ }
+ quint32 patchCountForDrawCall(quint32 vertexOrIndexCount, quint32 instanceCount) const
+ {
+ return ((vertexOrIndexCount + inControlPointCount - 1) / inControlPointCount) * instanceCount;
+ }
+ static int vsCompVariantToIndex(QShader::Variant vertexCompVariant);
+ id<MTLComputePipelineState> vsCompPipeline(QRhiMetal *rhiD, QShader::Variant vertexCompVariant);
+ id<MTLComputePipelineState> tescCompPipeline(QRhiMetal *rhiD);
+ id<MTLRenderPipelineState> teseFragRenderPipeline(QRhiMetal *rhiD, QMetalGraphicsPipeline *pipeline);
+ } tess;
+ void setupVertexInputDescriptor(MTLVertexDescriptor *desc);
+ void setupStageInputDescriptor(MTLStageInputOutputDescriptor *desc);
+
+ // SPIRV-Cross buffer size buffers
+ QMetalBuffer *bufferSizeBuffer = nullptr;
};
struct QMetalComputePipelineData
@@ -316,23 +446,26 @@ struct QMetalComputePipelineData
id<MTLComputePipelineState> ps = nil;
QMetalShader cs;
MTLSize localSize;
+
+ // SPIRV-Cross buffer size buffers
+ QMetalBuffer *bufferSizeBuffer = nullptr;
};
struct QMetalSwapChainData
{
- // The iOS simulator's headers mark CAMetalLayer as iOS 13.0+ only.
- // (for real device SDKs it is 8.0+)
-#ifdef TARGET_IPHONE_SIMULATOR
- API_AVAILABLE(ios(13.0)) CAMetalLayer *layer = nullptr;
-#else
CAMetalLayer *layer = nullptr;
-#endif
- id<CAMetalDrawable> curDrawable;
+ id<CAMetalDrawable> curDrawable = nil;
dispatch_semaphore_t sem[QMTL_FRAMES_IN_FLIGHT];
+ double lastGpuTime[QMTL_FRAMES_IN_FLIGHT];
MTLRenderPassDescriptor *rp = nullptr;
id<MTLTexture> msaaTex[QMTL_FRAMES_IN_FLIGHT];
QRhiTexture::Format rhiColorFormat;
MTLPixelFormat colorFormat;
+#ifdef Q_OS_MACOS
+ bool liveResizeObserverSet = false;
+ QMacNotificationObserver liveResizeStartObserver;
+ QMacNotificationObserver liveResizeEndObserver;
+#endif
};
QRhiMetal::QRhiMetal(QRhiMetalInitParams *params, QRhiMetalNativeHandles *importDevice)
@@ -343,7 +476,7 @@ QRhiMetal::QRhiMetal(QRhiMetalInitParams *params, QRhiMetalNativeHandles *import
importedDevice = importDevice != nullptr;
if (importedDevice) {
- if (d->dev) {
+ if (importDevice->dev) {
d->dev = (id<MTLDevice>) importDevice->dev;
importedCmdQueue = importDevice->cmdQueue != nullptr;
if (importedCmdQueue)
@@ -366,9 +499,55 @@ inline Int aligned(Int v, Int byteAlign)
return (v + byteAlign - 1) & ~(byteAlign - 1);
}
+bool QRhiMetal::probe(QRhiMetalInitParams *params)
+{
+ Q_UNUSED(params);
+ id<MTLDevice> dev = MTLCreateSystemDefaultDevice();
+ if (dev) {
+ [dev release];
+ return true;
+ }
+ return false;
+}
+
+id<MTLCommandBuffer> QRhiMetalData::newCommandBuffer()
+{
+#ifdef QRHI_METAL_COMMAND_BUFFERS_WITH_UNRETAINED_REFERENCES
+ // Do not let the command buffer mess with the refcount of objects. We do
+ // have a proper render loop and will manage lifetimes similarly to other
+ // backends (Vulkan).
+ return [cmdQueue commandBufferWithUnretainedReferences];
+#else
+ return [cmdQueue commandBuffer];
+#endif
+}
+
+bool QRhiMetalData::setupBinaryArchive(NSURL *sourceFileUrl)
+{
+#ifdef QRHI_METAL_DISABLE_BINARY_ARCHIVE
+ return false;
+#endif
+
+ if (@available(macOS 11.0, iOS 14.0, *)) {
+ [binArch release];
+ MTLBinaryArchiveDescriptor *binArchDesc = [MTLBinaryArchiveDescriptor new];
+ binArchDesc.url = sourceFileUrl;
+ NSError *err = nil;
+ binArch = [dev newBinaryArchiveWithDescriptor: binArchDesc error: &err];
+ [binArchDesc release];
+ if (!binArch) {
+ const QString msg = QString::fromNSString(err.localizedDescription);
+ qWarning("newBinaryArchiveWithDescriptor failed: %s", qPrintable(msg));
+ return false;
+ }
+ return true;
+ }
+ return false;
+}
+
bool QRhiMetal::create(QRhi::Flags flags)
{
- Q_UNUSED(flags);
+ rhiFlags = flags;
if (importedDevice)
[d->dev retain];
@@ -380,30 +559,66 @@ bool QRhiMetal::create(QRhi::Flags flags)
return false;
}
- qCDebug(QRHI_LOG_INFO, "Metal device: %s", qPrintable(QString::fromNSString([d->dev name])));
+ const QString deviceName = QString::fromNSString([d->dev name]);
+ qCDebug(QRHI_LOG_INFO, "Metal device: %s", qPrintable(deviceName));
+ driverInfoStruct.deviceName = deviceName.toUtf8();
+
+ // deviceId and vendorId stay unset for now. Note that registryID is not
+ // suitable as deviceId because it does not seem stable on macOS and can
+ // apparently change when the system is rebooted.
+
+#ifdef Q_OS_MACOS
+ if (@available(macOS 10.15, *)) {
+ const MTLDeviceLocation deviceLocation = [d->dev location];
+ switch (deviceLocation) {
+ case MTLDeviceLocationBuiltIn:
+ driverInfoStruct.deviceType = QRhiDriverInfo::IntegratedDevice;
+ break;
+ case MTLDeviceLocationSlot:
+ driverInfoStruct.deviceType = QRhiDriverInfo::DiscreteDevice;
+ break;
+ case MTLDeviceLocationExternal:
+ driverInfoStruct.deviceType = QRhiDriverInfo::ExternalDevice;
+ break;
+ default:
+ break;
+ }
+ }
+#else
+ driverInfoStruct.deviceType = QRhiDriverInfo::IntegratedDevice;
+#endif
+
+ const QOperatingSystemVersion ver = QOperatingSystemVersion::current();
+ osMajor = ver.majorVersion();
+ osMinor = ver.minorVersion();
if (importedCmdQueue)
[d->cmdQueue retain];
else
d->cmdQueue = [d->dev newCommandQueue];
- if (@available(macOS 10.13, iOS 11.0, *)) {
- d->captureMgr = [MTLCaptureManager sharedCaptureManager];
- // Have a custom capture scope as well which then shows up in XCode as
- // an option when capturing, and becomes especially useful when having
- // multiple windows with multiple QRhis.
- d->captureScope = [d->captureMgr newCaptureScopeWithCommandQueue: d->cmdQueue];
- const QString label = QString::asprintf("Qt capture scope for QRhi %p", this);
- d->captureScope.label = label.toNSString();
- }
+ d->captureMgr = [MTLCaptureManager sharedCaptureManager];
+ // Have a custom capture scope as well which then shows up in XCode as
+ // an option when capturing, and becomes especially useful when having
+ // multiple windows with multiple QRhis.
+ d->captureScope = [d->captureMgr newCaptureScopeWithCommandQueue: d->cmdQueue];
+ const QString label = QString::asprintf("Qt capture scope for QRhi %p", this);
+ d->captureScope.label = label.toNSString();
#if defined(Q_OS_MACOS)
caps.maxTextureSize = 16384;
+ caps.baseVertexAndInstance = true;
+ if (@available(macOS 10.15, *))
+ caps.isAppleGPU = [d->dev supportsFamily:MTLGPUFamilyApple7];
+ caps.maxThreadGroupSize = 1024;
+ caps.multiView = true;
#elif defined(Q_OS_TVOS)
if ([d->dev supportsFeatureSet: MTLFeatureSet(30003)]) // MTLFeatureSet_tvOS_GPUFamily2_v1
caps.maxTextureSize = 16384;
else
caps.maxTextureSize = 8192;
+ caps.baseVertexAndInstance = false;
+ caps.isAppleGPU = true;
#elif defined(Q_OS_IOS)
// welcome to feature set hell
if ([d->dev supportsFeatureSet: MTLFeatureSet(16)] // MTLFeatureSet_iOS_GPUFamily5_v1
@@ -411,17 +626,36 @@ bool QRhiMetal::create(QRhi::Flags flags)
|| [d->dev supportsFeatureSet: MTLFeatureSet(4)]) // MTLFeatureSet_iOS_GPUFamily3_v1
{
caps.maxTextureSize = 16384;
+ caps.baseVertexAndInstance = true;
} else if ([d->dev supportsFeatureSet: MTLFeatureSet(3)] // MTLFeatureSet_iOS_GPUFamily2_v2
|| [d->dev supportsFeatureSet: MTLFeatureSet(2)]) // MTLFeatureSet_iOS_GPUFamily1_v2
{
caps.maxTextureSize = 8192;
+ caps.baseVertexAndInstance = false;
} else {
caps.maxTextureSize = 4096;
+ caps.baseVertexAndInstance = false;
+ }
+ caps.isAppleGPU = true;
+ if (@available(iOS 13, *)) {
+ if ([d->dev supportsFamily: MTLGPUFamilyApple4])
+ caps.maxThreadGroupSize = 1024;
+ if ([d->dev supportsFamily: MTLGPUFamilyApple5])
+ caps.multiView = true;
}
#endif
- nativeHandlesStruct.dev = d->dev;
- nativeHandlesStruct.cmdQueue = d->cmdQueue;
+ caps.supportedSampleCounts = { 1 };
+ for (int sampleCount : { 2, 4, 8 }) {
+ if ([d->dev supportsTextureSampleCount: sampleCount])
+ caps.supportedSampleCounts.append(sampleCount);
+ }
+
+ if (rhiFlags.testFlag(QRhi::EnablePipelineCacheDataSave))
+ d->setupBinaryArchive();
+
+ nativeHandlesStruct.dev = (MTLDevice *) d->dev;
+ nativeHandlesStruct.cmdQueue = (MTLCommandQueue *) d->cmdQueue;
return true;
}
@@ -432,12 +666,15 @@ void QRhiMetal::destroy()
finishActiveReadbacks(true);
for (QMetalShader &s : d->shaderCache)
- s.release();
+ s.destroy();
d->shaderCache.clear();
- if (@available(macOS 10.13, iOS 11.0, *)) {
- [d->captureScope release];
- d->captureScope = nil;
+ [d->captureScope release];
+ d->captureScope = nil;
+
+ if (@available(macOS 11.0, iOS 14.0, *)) {
+ [d->binArch release];
+ d->binArch = nil;
}
[d->cmdQueue release];
@@ -451,18 +688,7 @@ void QRhiMetal::destroy()
QVector<int> QRhiMetal::supportedSampleCounts() const
{
- return { 1, 2, 4, 8 };
-}
-
-int QRhiMetal::effectiveSampleCount(int sampleCount) const
-{
- // Stay compatible with QSurfaceFormat and friends where samples == 0 means the same as 1.
- const int s = qBound(1, sampleCount, 64);
- if (!supportedSampleCounts().contains(s)) {
- qWarning("Attempted to set unsupported sample count %d", sampleCount);
- return 1;
- }
- return s;
+ return caps.supportedSampleCounts;
}
QRhiSwapChain *QRhiMetal::createSwapChain()
@@ -470,7 +696,7 @@ QRhiSwapChain *QRhiMetal::createSwapChain()
return new QMetalSwapChain(this);
}
-QRhiBuffer *QRhiMetal::createBuffer(QRhiBuffer::Type type, QRhiBuffer::UsageFlags usage, int size)
+QRhiBuffer *QRhiMetal::createBuffer(QRhiBuffer::Type type, QRhiBuffer::UsageFlags usage, quint32 size)
{
return new QMetalBuffer(this, type, usage, size);
}
@@ -513,16 +739,32 @@ bool QRhiMetal::isTextureFormatSupported(QRhiTexture::Format format, QRhiTexture
{
Q_UNUSED(flags);
+ bool supportsFamilyMac2 = false; // needed for BC* formats
+ bool supportsFamilyApple3 = false;
+
#ifdef Q_OS_MACOS
- if (format >= QRhiTexture::ETC2_RGB8 && format <= QRhiTexture::ETC2_RGBA8)
- return false;
- if (format >= QRhiTexture::ASTC_4x4 && format <= QRhiTexture::ASTC_12x12)
- return false;
+ supportsFamilyMac2 = true;
+ if (caps.isAppleGPU)
+ supportsFamilyApple3 = true;
#else
- if (format >= QRhiTexture::BC1 && format <= QRhiTexture::BC7)
- return false;
+ supportsFamilyApple3 = true;
#endif
+ // BC5 is not available for any Apple hardare
+ if (format == QRhiTexture::BC5)
+ return false;
+
+ if (!supportsFamilyApple3) {
+ if (format >= QRhiTexture::ETC2_RGB8 && format <= QRhiTexture::ETC2_RGBA8)
+ return false;
+ if (format >= QRhiTexture::ASTC_4x4 && format <= QRhiTexture::ASTC_12x12)
+ return false;
+ }
+
+ if (!supportsFamilyMac2)
+ if (format >= QRhiTexture::BC1 && format <= QRhiTexture::BC7)
+ return false;
+
return true;
}
@@ -536,7 +778,7 @@ bool QRhiMetal::isFeatureSupported(QRhi::Feature feature) const
case QRhi::DebugMarkers:
return true;
case QRhi::Timestamps:
- return false;
+ return true;
case QRhi::Instancing:
return true;
case QRhi::CustomInstanceStepRate:
@@ -560,15 +802,66 @@ bool QRhiMetal::isFeatureSupported(QRhi::Feature feature) const
case QRhi::VertexShaderPointSize:
return true;
case QRhi::BaseVertex:
- return true;
+ return caps.baseVertexAndInstance;
case QRhi::BaseInstance:
- return true;
+ return caps.baseVertexAndInstance;
case QRhi::TriangleFanTopology:
return false;
case QRhi::ReadBackNonUniformBuffer:
return true;
case QRhi::ReadBackNonBaseMipLevel:
return true;
+ case QRhi::TexelFetch:
+ return true;
+ case QRhi::RenderToNonBaseMipLevel:
+ return true;
+ case QRhi::IntAttributes:
+ return true;
+ case QRhi::ScreenSpaceDerivatives:
+ return true;
+ case QRhi::ReadBackAnyTextureFormat:
+ return true;
+ case QRhi::PipelineCacheDataLoadSave:
+ {
+ if (@available(macOS 11.0, iOS 14.0, *))
+ return true;
+ else
+ return false;
+ }
+ case QRhi::ImageDataStride:
+ return true;
+ case QRhi::RenderBufferImport:
+ return false;
+ case QRhi::ThreeDimensionalTextures:
+ return true;
+ case QRhi::RenderTo3DTextureSlice:
+ return true;
+ case QRhi::TextureArrays:
+ return true;
+ case QRhi::Tessellation:
+ return true;
+ case QRhi::GeometryShader:
+ return false;
+ case QRhi::TextureArrayRange:
+ return false;
+ case QRhi::NonFillPolygonMode:
+ return true;
+ case QRhi::OneDimensionalTextures:
+ return true;
+ case QRhi::OneDimensionalTextureMipmaps:
+ return false;
+ case QRhi::HalfAttributes:
+ return true;
+ case QRhi::RenderToOneDimensionalTexture:
+ return false;
+ case QRhi::ThreeDimensionalTextureMipmaps:
+ return true;
+ case QRhi::MultiView:
+ return caps.multiView;
+ case QRhi::TextureViewFormat:
+ return false;
+ case QRhi::ResolveDepthStencil:
+ return true;
default:
Q_UNREACHABLE();
return false;
@@ -586,6 +879,26 @@ int QRhiMetal::resourceLimit(QRhi::ResourceLimit limit) const
return 8;
case QRhi::FramesInFlight:
return QMTL_FRAMES_IN_FLIGHT;
+ case QRhi::MaxAsyncReadbackFrames:
+ return QMTL_FRAMES_IN_FLIGHT;
+ case QRhi::MaxThreadGroupsPerDimension:
+ return 65535;
+ case QRhi::MaxThreadsPerThreadGroup:
+ Q_FALLTHROUGH();
+ case QRhi::MaxThreadGroupX:
+ Q_FALLTHROUGH();
+ case QRhi::MaxThreadGroupY:
+ Q_FALLTHROUGH();
+ case QRhi::MaxThreadGroupZ:
+ return caps.maxThreadGroupSize;
+ case QRhi::TextureArraySizeMax:
+ return 2048;
+ case QRhi::MaxUniformBufferRange:
+ return 65536;
+ case QRhi::MaxVertexInputs:
+ return 31;
+ case QRhi::MaxVertexOutputs:
+ return 15; // use the minimum from MTLGPUFamily1/2/3
default:
Q_UNREACHABLE();
return 0;
@@ -597,9 +910,16 @@ const QRhiNativeHandles *QRhiMetal::nativeHandles()
return &nativeHandlesStruct;
}
-void QRhiMetal::sendVMemStatsToProfiler()
+QRhiDriverInfo QRhiMetal::driverInfo() const
{
- // nothing to do here
+ return driverInfoStruct;
+}
+
+QRhiStats QRhiMetal::statistics()
+{
+ QRhiStats result;
+ result.totalPipelineCreationTime = totalPipelineCreationTime();
+ return result;
}
bool QRhiMetal::makeThreadLocalNativeContextCurrent()
@@ -611,7 +931,7 @@ bool QRhiMetal::makeThreadLocalNativeContextCurrent()
void QRhiMetal::releaseCachedResources()
{
for (QMetalShader &s : d->shaderCache)
- s.release();
+ s.destroy();
d->shaderCache.clear();
}
@@ -621,23 +941,154 @@ bool QRhiMetal::isDeviceLost() const
return false;
}
+struct QMetalPipelineCacheDataHeader
+{
+ quint32 rhiId;
+ quint32 arch;
+ quint32 dataSize;
+ quint32 osMajor;
+ quint32 osMinor;
+ char driver[236];
+};
+
+QByteArray QRhiMetal::pipelineCacheData()
+{
+ Q_STATIC_ASSERT(sizeof(QMetalPipelineCacheDataHeader) == 256);
+ QByteArray data;
+ if (@available(macOS 11.0, iOS 14.0, *)) {
+ if (!d->binArch || !rhiFlags.testFlag(QRhi::EnablePipelineCacheDataSave))
+ return data;
+
+ QTemporaryFile tmp;
+ if (!tmp.open()) {
+ qCDebug(QRHI_LOG_INFO, "pipelineCacheData: Failed to create temporary file for Metal");
+ return data;
+ }
+ tmp.close(); // the file exists until the tmp dtor runs
+
+ const QString fn = QFileInfo(tmp.fileName()).absoluteFilePath();
+ NSURL *url = QUrl::fromLocalFile(fn).toNSURL();
+ NSError *err = nil;
+ if (![d->binArch serializeToURL: url error: &err]) {
+ const QString msg = QString::fromNSString(err.localizedDescription);
+ // Some of these "errors" are not actual errors. (think of "Nothing to serialize")
+ qCDebug(QRHI_LOG_INFO, "Failed to serialize MTLBinaryArchive: %s", qPrintable(msg));
+ return data;
+ }
+
+ QFile f(fn);
+ if (!f.open(QIODevice::ReadOnly)) {
+ qCDebug(QRHI_LOG_INFO, "pipelineCacheData: Failed to reopen temporary file");
+ return data;
+ }
+ const QByteArray blob = f.readAll();
+ f.close();
+
+ const size_t headerSize = sizeof(QMetalPipelineCacheDataHeader);
+ const quint32 dataSize = quint32(blob.size());
+
+ data.resize(headerSize + dataSize);
+
+ QMetalPipelineCacheDataHeader header = {};
+ header.rhiId = pipelineCacheRhiId();
+ header.arch = quint32(sizeof(void*));
+ header.dataSize = quint32(dataSize);
+ header.osMajor = osMajor;
+ header.osMinor = osMinor;
+ const size_t driverStrLen = qMin(sizeof(header.driver) - 1, size_t(driverInfoStruct.deviceName.length()));
+ if (driverStrLen)
+ memcpy(header.driver, driverInfoStruct.deviceName.constData(), driverStrLen);
+ header.driver[driverStrLen] = '\0';
+
+ memcpy(data.data(), &header, headerSize);
+ memcpy(data.data() + headerSize, blob.constData(), dataSize);
+ }
+ return data;
+}
+
+void QRhiMetal::setPipelineCacheData(const QByteArray &data)
+{
+ if (data.isEmpty())
+ return;
+
+ const size_t headerSize = sizeof(QMetalPipelineCacheDataHeader);
+ if (data.size() < qsizetype(headerSize)) {
+ qCDebug(QRHI_LOG_INFO, "setPipelineCacheData: Invalid blob size (header incomplete)");
+ return;
+ }
+
+ const size_t dataOffset = headerSize;
+ QMetalPipelineCacheDataHeader header;
+ memcpy(&header, data.constData(), headerSize);
+
+ const quint32 rhiId = pipelineCacheRhiId();
+ if (header.rhiId != rhiId) {
+ qCDebug(QRHI_LOG_INFO, "setPipelineCacheData: The data is for a different QRhi version or backend (%u, %u)",
+ rhiId, header.rhiId);
+ return;
+ }
+
+ const quint32 arch = quint32(sizeof(void*));
+ if (header.arch != arch) {
+ qCDebug(QRHI_LOG_INFO, "setPipelineCacheData: Architecture does not match (%u, %u)",
+ arch, header.arch);
+ return;
+ }
+
+ if (header.osMajor != osMajor || header.osMinor != osMinor) {
+ qCDebug(QRHI_LOG_INFO, "setPipelineCacheData: OS version does not match (%u.%u, %u.%u)",
+ osMajor, osMinor, header.osMajor, header.osMinor);
+ return;
+ }
+
+ const size_t driverStrLen = qMin(sizeof(header.driver) - 1, size_t(driverInfoStruct.deviceName.length()));
+ if (strncmp(header.driver, driverInfoStruct.deviceName.constData(), driverStrLen)) {
+ qCDebug(QRHI_LOG_INFO, "setPipelineCacheData: Metal device name does not match");
+ return;
+ }
+
+ if (data.size() < qsizetype(dataOffset + header.dataSize)) {
+ qCDebug(QRHI_LOG_INFO, "setPipelineCacheData: Invalid blob size (data incomplete)");
+ return;
+ }
+
+ if (@available(macOS 11.0, iOS 14.0, *)) {
+ const char *p = data.constData() + dataOffset;
+
+ QTemporaryFile tmp;
+ if (!tmp.open()) {
+ qCDebug(QRHI_LOG_INFO, "pipelineCacheData: Failed to create temporary file for Metal");
+ return;
+ }
+ tmp.write(p, header.dataSize);
+ tmp.close(); // the file exists until the tmp dtor runs
+
+ const QString fn = QFileInfo(tmp.fileName()).absoluteFilePath();
+ NSURL *url = QUrl::fromLocalFile(fn).toNSURL();
+ if (d->setupBinaryArchive(url))
+ qCDebug(QRHI_LOG_INFO, "Created MTLBinaryArchive with initial data of %u bytes", header.dataSize);
+ }
+}
+
QRhiRenderBuffer *QRhiMetal::createRenderBuffer(QRhiRenderBuffer::Type type, const QSize &pixelSize,
- int sampleCount, QRhiRenderBuffer::Flags flags)
+ int sampleCount, QRhiRenderBuffer::Flags flags,
+ QRhiTexture::Format backingFormatHint)
{
- return new QMetalRenderBuffer(this, type, pixelSize, sampleCount, flags);
+ return new QMetalRenderBuffer(this, type, pixelSize, sampleCount, flags, backingFormatHint);
}
-QRhiTexture *QRhiMetal::createTexture(QRhiTexture::Format format, const QSize &pixelSize,
+QRhiTexture *QRhiMetal::createTexture(QRhiTexture::Format format,
+ const QSize &pixelSize, int depth, int arraySize,
int sampleCount, QRhiTexture::Flags flags)
{
- return new QMetalTexture(this, format, pixelSize, sampleCount, flags);
+ return new QMetalTexture(this, format, pixelSize, depth, arraySize, sampleCount, flags);
}
QRhiSampler *QRhiMetal::createSampler(QRhiSampler::Filter magFilter, QRhiSampler::Filter minFilter,
QRhiSampler::Filter mipmapMode,
- QRhiSampler::AddressMode u, QRhiSampler::AddressMode v)
+ QRhiSampler::AddressMode u, QRhiSampler::AddressMode v, QRhiSampler::AddressMode w)
{
- return new QMetalSampler(this, magFilter, minFilter, mipmapMode, u, v);
+ return new QMetalSampler(this, magFilter, minFilter, mipmapMode, u, v, w);
}
QRhiTextureRenderTarget *QRhiMetal::createTextureRenderTarget(const QRhiTextureRenderTargetDescription &desc,
@@ -673,12 +1124,147 @@ static inline int mapBinding(int binding,
BindingType type)
{
const QShader::NativeResourceBindingMap *map = nativeResourceBindingMaps[stageIndex];
- if (map) {
- auto it = map->constFind(binding);
- if (it != map->cend())
- return type == BindingType::Sampler ? it->second : it->first;
+ if (!map || map->isEmpty())
+ return binding; // old QShader versions do not have this map, assume 1:1 mapping then
+
+ auto it = map->constFind(binding);
+ if (it != map->cend())
+ return type == BindingType::Sampler ? it->second : it->first; // may be -1, if the resource is inactive
+
+ // Hitting this path is normal too. It is not given that the resource (for
+ // example, a uniform block) is present in the shaders for all the stages
+ // specified by the visibility mask in the QRhiShaderResourceBinding.
+ return -1;
+}
+
+static inline void bindStageBuffers(QMetalCommandBuffer *cbD,
+ int stage,
+ const QRhiBatchedBindings<id<MTLBuffer>>::Batch &bufferBatch,
+ const QRhiBatchedBindings<NSUInteger>::Batch &offsetBatch)
+{
+ switch (stage) {
+ case QMetalShaderResourceBindingsData::VERTEX:
+ [cbD->d->currentRenderPassEncoder setVertexBuffers: bufferBatch.resources.constData()
+ offsets: offsetBatch.resources.constData()
+ withRange: NSMakeRange(bufferBatch.startBinding, NSUInteger(bufferBatch.resources.count()))];
+ break;
+ case QMetalShaderResourceBindingsData::FRAGMENT:
+ [cbD->d->currentRenderPassEncoder setFragmentBuffers: bufferBatch.resources.constData()
+ offsets: offsetBatch.resources.constData()
+ withRange: NSMakeRange(bufferBatch.startBinding, NSUInteger(bufferBatch.resources.count()))];
+ break;
+ case QMetalShaderResourceBindingsData::COMPUTE:
+ [cbD->d->currentComputePassEncoder setBuffers: bufferBatch.resources.constData()
+ offsets: offsetBatch.resources.constData()
+ withRange: NSMakeRange(bufferBatch.startBinding, NSUInteger(bufferBatch.resources.count()))];
+ break;
+ case QMetalShaderResourceBindingsData::TESSCTRL:
+ case QMetalShaderResourceBindingsData::TESSEVAL:
+ // do nothing. These are used later for tessellation
+ break;
+ default:
+ Q_UNREACHABLE();
+ break;
+ }
+}
+
+static inline void bindStageTextures(QMetalCommandBuffer *cbD,
+ int stage,
+ const QRhiBatchedBindings<id<MTLTexture>>::Batch &textureBatch)
+{
+ switch (stage) {
+ case QMetalShaderResourceBindingsData::VERTEX:
+ [cbD->d->currentRenderPassEncoder setVertexTextures: textureBatch.resources.constData()
+ withRange: NSMakeRange(textureBatch.startBinding, NSUInteger(textureBatch.resources.count()))];
+ break;
+ case QMetalShaderResourceBindingsData::FRAGMENT:
+ [cbD->d->currentRenderPassEncoder setFragmentTextures: textureBatch.resources.constData()
+ withRange: NSMakeRange(textureBatch.startBinding, NSUInteger(textureBatch.resources.count()))];
+ break;
+ case QMetalShaderResourceBindingsData::COMPUTE:
+ [cbD->d->currentComputePassEncoder setTextures: textureBatch.resources.constData()
+ withRange: NSMakeRange(textureBatch.startBinding, NSUInteger(textureBatch.resources.count()))];
+ break;
+ case QMetalShaderResourceBindingsData::TESSCTRL:
+ case QMetalShaderResourceBindingsData::TESSEVAL:
+ // do nothing. These are used later for tessellation
+ break;
+ default:
+ Q_UNREACHABLE();
+ break;
+ }
+}
+
+static inline void bindStageSamplers(QMetalCommandBuffer *cbD,
+ int encoderStage,
+ const QRhiBatchedBindings<id<MTLSamplerState>>::Batch &samplerBatch)
+{
+ switch (encoderStage) {
+ case QMetalShaderResourceBindingsData::VERTEX:
+ [cbD->d->currentRenderPassEncoder setVertexSamplerStates: samplerBatch.resources.constData()
+ withRange: NSMakeRange(samplerBatch.startBinding, NSUInteger(samplerBatch.resources.count()))];
+ break;
+ case QMetalShaderResourceBindingsData::FRAGMENT:
+ [cbD->d->currentRenderPassEncoder setFragmentSamplerStates: samplerBatch.resources.constData()
+ withRange: NSMakeRange(samplerBatch.startBinding, NSUInteger(samplerBatch.resources.count()))];
+ break;
+ case QMetalShaderResourceBindingsData::COMPUTE:
+ [cbD->d->currentComputePassEncoder setSamplerStates: samplerBatch.resources.constData()
+ withRange: NSMakeRange(samplerBatch.startBinding, NSUInteger(samplerBatch.resources.count()))];
+ break;
+ case QMetalShaderResourceBindingsData::TESSCTRL:
+ case QMetalShaderResourceBindingsData::TESSEVAL:
+ // do nothing. These are used later for tessellation
+ break;
+ default:
+ Q_UNREACHABLE();
+ break;
+ }
+}
+
+// Helper that is not used during the common vertex+fragment and compute
+// pipelines, but is necessary when tessellation is involved and so the
+// graphics pipeline is under the hood a combination of multiple compute and
+// render pipelines. We need to be able to set the buffers, textures, samplers
+// when a switching between render and compute encoders.
+static inline void rebindShaderResources(QMetalCommandBuffer *cbD, int resourceStage, int encoderStage,
+ const QMetalShaderResourceBindingsData *customBindingState = nullptr)
+{
+ const QMetalShaderResourceBindingsData *bindingData = customBindingState ? customBindingState : &cbD->d->currentShaderResourceBindingState;
+
+ for (int i = 0, ie = bindingData->res[resourceStage].bufferBatches.batches.count(); i != ie; ++i) {
+ const auto &bufferBatch(bindingData->res[resourceStage].bufferBatches.batches[i]);
+ const auto &offsetBatch(bindingData->res[resourceStage].bufferOffsetBatches.batches[i]);
+ bindStageBuffers(cbD, encoderStage, bufferBatch, offsetBatch);
+ }
+
+ for (int i = 0, ie = bindingData->res[resourceStage].textureBatches.batches.count(); i != ie; ++i) {
+ const auto &batch(bindingData->res[resourceStage].textureBatches.batches[i]);
+ bindStageTextures(cbD, encoderStage, batch);
+ }
+
+ for (int i = 0, ie = bindingData->res[resourceStage].samplerBatches.batches.count(); i != ie; ++i) {
+ const auto &batch(bindingData->res[resourceStage].samplerBatches.batches[i]);
+ bindStageSamplers(cbD, encoderStage, batch);
+ }
+}
+
+static inline QRhiShaderResourceBinding::StageFlag toRhiSrbStage(int stage)
+{
+ switch (stage) {
+ case QMetalShaderResourceBindingsData::VERTEX:
+ return QRhiShaderResourceBinding::StageFlag::VertexStage;
+ case QMetalShaderResourceBindingsData::TESSCTRL:
+ return QRhiShaderResourceBinding::StageFlag::TessellationControlStage;
+ case QMetalShaderResourceBindingsData::TESSEVAL:
+ return QRhiShaderResourceBinding::StageFlag::TessellationEvaluationStage;
+ case QMetalShaderResourceBindingsData::FRAGMENT:
+ return QRhiShaderResourceBinding::StageFlag::FragmentStage;
+ case QMetalShaderResourceBindingsData::COMPUTE:
+ return QRhiShaderResourceBinding::StageFlag::ComputeStage;
}
- return binding;
+
+ Q_UNREACHABLE_RETURN(QRhiShaderResourceBinding::StageFlag::VertexStage);
}
void QRhiMetal::enqueueShaderResourceBindings(QMetalShaderResourceBindings *srbD,
@@ -688,22 +1274,16 @@ void QRhiMetal::enqueueShaderResourceBindings(QMetalShaderResourceBindings *srbD
bool offsetOnlyChange,
const QShader::NativeResourceBindingMap *nativeResourceBindingMaps[SUPPORTED_STAGES])
{
- struct {
- QRhiBatchedBindings<id<MTLBuffer> > buffers;
- QRhiBatchedBindings<NSUInteger> bufferOffsets;
- QRhiBatchedBindings<id<MTLTexture> > textures;
- QRhiBatchedBindings<id<MTLSamplerState> > samplers;
- } res[SUPPORTED_STAGES];
- enum { VERTEX = 0, FRAGMENT = 1, COMPUTE = 2 };
-
- for (const QRhiShaderResourceBinding &binding : qAsConst(srbD->sortedBindings)) {
- const QRhiShaderResourceBinding::Data *b = binding.data();
+ QMetalShaderResourceBindingsData bindingData;
+
+ for (const QRhiShaderResourceBinding &binding : std::as_const(srbD->sortedBindings)) {
+ const QRhiShaderResourceBinding::Data *b = shaderResourceBindingData(binding);
switch (b->type) {
case QRhiShaderResourceBinding::UniformBuffer:
{
QMetalBuffer *bufD = QRHI_RES(QMetalBuffer, b->u.ubuf.buf);
id<MTLBuffer> mtlbuf = bufD->d->buf[bufD->d->slotted ? currentFrameSlot : 0];
- uint offset = uint(b->u.ubuf.offset);
+ quint32 offset = b->u.ubuf.offset;
for (int i = 0; i < dynamicOffsetCount; ++i) {
const QRhiCommandBuffer::DynamicOffset &dynOfs(dynamicOffsets[i]);
if (dynOfs.first == b->binding) {
@@ -711,74 +1291,72 @@ void QRhiMetal::enqueueShaderResourceBindings(QMetalShaderResourceBindings *srbD
break;
}
}
- if (b->stage.testFlag(QRhiShaderResourceBinding::VertexStage)) {
- res[VERTEX].buffers.feed(mapBinding(b->binding, VERTEX, nativeResourceBindingMaps, BindingType::Buffer), mtlbuf);
- res[VERTEX].bufferOffsets.feed(b->binding, offset);
- }
- if (b->stage.testFlag(QRhiShaderResourceBinding::FragmentStage)) {
- res[FRAGMENT].buffers.feed(mapBinding(b->binding, FRAGMENT, nativeResourceBindingMaps, BindingType::Buffer), mtlbuf);
- res[FRAGMENT].bufferOffsets.feed(b->binding, offset);
- }
- if (b->stage.testFlag(QRhiShaderResourceBinding::ComputeStage)) {
- res[COMPUTE].buffers.feed(mapBinding(b->binding, COMPUTE, nativeResourceBindingMaps, BindingType::Buffer), mtlbuf);
- res[COMPUTE].bufferOffsets.feed(b->binding, offset);
+
+ for (int stage = 0; stage < SUPPORTED_STAGES; ++stage) {
+ if (b->stage.testFlag(toRhiSrbStage(stage))) {
+ const int nativeBinding = mapBinding(b->binding, stage, nativeResourceBindingMaps, BindingType::Buffer);
+ if (nativeBinding >= 0)
+ bindingData.res[stage].buffers.append({ nativeBinding, mtlbuf, offset });
+ }
}
}
break;
case QRhiShaderResourceBinding::SampledTexture:
+ case QRhiShaderResourceBinding::Texture:
+ case QRhiShaderResourceBinding::Sampler:
{
- QMetalTexture *texD = QRHI_RES(QMetalTexture, b->u.stex.tex);
- QMetalSampler *samplerD = QRHI_RES(QMetalSampler, b->u.stex.sampler);
- if (b->stage.testFlag(QRhiShaderResourceBinding::VertexStage)) {
- res[VERTEX].textures.feed(mapBinding(b->binding, VERTEX, nativeResourceBindingMaps, BindingType::Texture), texD->d->tex);
- res[VERTEX].samplers.feed(mapBinding(b->binding, VERTEX, nativeResourceBindingMaps, BindingType::Sampler), samplerD->d->samplerState);
- }
- if (b->stage.testFlag(QRhiShaderResourceBinding::FragmentStage)) {
- res[FRAGMENT].textures.feed(mapBinding(b->binding, FRAGMENT, nativeResourceBindingMaps, BindingType::Texture), texD->d->tex);
- res[FRAGMENT].samplers.feed(mapBinding(b->binding, FRAGMENT, nativeResourceBindingMaps, BindingType::Sampler), samplerD->d->samplerState);
- }
- if (b->stage.testFlag(QRhiShaderResourceBinding::ComputeStage)) {
- res[COMPUTE].textures.feed(mapBinding(b->binding, COMPUTE, nativeResourceBindingMaps, BindingType::Texture), texD->d->tex);
- res[COMPUTE].samplers.feed(mapBinding(b->binding, COMPUTE, nativeResourceBindingMaps, BindingType::Sampler), samplerD->d->samplerState);
+ const QRhiShaderResourceBinding::Data::TextureAndOrSamplerData *data = &b->u.stex;
+ for (int elem = 0; elem < data->count; ++elem) {
+ QMetalTexture *texD = QRHI_RES(QMetalTexture, b->u.stex.texSamplers[elem].tex);
+ QMetalSampler *samplerD = QRHI_RES(QMetalSampler, b->u.stex.texSamplers[elem].sampler);
+
+ for (int stage = 0; stage < SUPPORTED_STAGES; ++stage) {
+ if (b->stage.testFlag(toRhiSrbStage(stage))) {
+ // Must handle all three cases (combined, separate, separate):
+ // first = texture binding, second = sampler binding
+ // first = texture binding
+ // first = sampler binding (i.e. BindingType::Texture...)
+ const int textureBinding = mapBinding(b->binding, stage, nativeResourceBindingMaps, BindingType::Texture);
+ const int samplerBinding = texD && samplerD ? mapBinding(b->binding, stage, nativeResourceBindingMaps, BindingType::Sampler)
+ : (samplerD ? mapBinding(b->binding, stage, nativeResourceBindingMaps, BindingType::Texture) : -1);
+ if (textureBinding >= 0 && texD)
+ bindingData.res[stage].textures.append({ textureBinding + elem, texD->d->tex });
+ if (samplerBinding >= 0)
+ bindingData.res[stage].samplers.append({ samplerBinding + elem, samplerD->d->samplerState });
+ }
+ }
}
}
break;
case QRhiShaderResourceBinding::ImageLoad:
- Q_FALLTHROUGH();
case QRhiShaderResourceBinding::ImageStore:
- Q_FALLTHROUGH();
case QRhiShaderResourceBinding::ImageLoadStore:
{
QMetalTexture *texD = QRHI_RES(QMetalTexture, b->u.simage.tex);
id<MTLTexture> t = texD->d->viewForLevel(b->u.simage.level);
- if (b->stage.testFlag(QRhiShaderResourceBinding::VertexStage))
- res[VERTEX].textures.feed(mapBinding(b->binding, VERTEX, nativeResourceBindingMaps, BindingType::Texture), t);
- if (b->stage.testFlag(QRhiShaderResourceBinding::FragmentStage))
- res[FRAGMENT].textures.feed(mapBinding(b->binding, FRAGMENT, nativeResourceBindingMaps, BindingType::Texture), t);
- if (b->stage.testFlag(QRhiShaderResourceBinding::ComputeStage))
- res[COMPUTE].textures.feed(mapBinding(b->binding, COMPUTE, nativeResourceBindingMaps, BindingType::Texture), t);
+
+ for (int stage = 0; stage < SUPPORTED_STAGES; ++stage) {
+ if (b->stage.testFlag(toRhiSrbStage(stage))) {
+ const int nativeBinding = mapBinding(b->binding, stage, nativeResourceBindingMaps, BindingType::Texture);
+ if (nativeBinding >= 0)
+ bindingData.res[stage].textures.append({ nativeBinding, t });
+ }
+ }
}
break;
case QRhiShaderResourceBinding::BufferLoad:
- Q_FALLTHROUGH();
case QRhiShaderResourceBinding::BufferStore:
- Q_FALLTHROUGH();
case QRhiShaderResourceBinding::BufferLoadStore:
{
QMetalBuffer *bufD = QRHI_RES(QMetalBuffer, b->u.sbuf.buf);
id<MTLBuffer> mtlbuf = bufD->d->buf[0];
- uint offset = uint(b->u.sbuf.offset);
- if (b->stage.testFlag(QRhiShaderResourceBinding::VertexStage)) {
- res[VERTEX].buffers.feed(mapBinding(b->binding, VERTEX, nativeResourceBindingMaps, BindingType::Buffer), mtlbuf);
- res[VERTEX].bufferOffsets.feed(b->binding, offset);
- }
- if (b->stage.testFlag(QRhiShaderResourceBinding::FragmentStage)) {
- res[FRAGMENT].buffers.feed(mapBinding(b->binding, FRAGMENT, nativeResourceBindingMaps, BindingType::Buffer), mtlbuf);
- res[FRAGMENT].bufferOffsets.feed(b->binding, offset);
- }
- if (b->stage.testFlag(QRhiShaderResourceBinding::ComputeStage)) {
- res[COMPUTE].buffers.feed(mapBinding(b->binding, COMPUTE, nativeResourceBindingMaps, BindingType::Buffer), mtlbuf);
- res[COMPUTE].bufferOffsets.feed(b->binding, offset);
+ quint32 offset = b->u.sbuf.offset;
+ for (int stage = 0; stage < SUPPORTED_STAGES; ++stage) {
+ if (b->stage.testFlag(toRhiSrbStage(stage))) {
+ const int nativeBinding = mapBinding(b->binding, stage, nativeResourceBindingMaps, BindingType::Buffer);
+ if (nativeBinding >= 0)
+ bindingData.res[stage].buffers.append({ nativeBinding, mtlbuf, offset });
+ }
}
}
break;
@@ -789,86 +1367,118 @@ void QRhiMetal::enqueueShaderResourceBindings(QMetalShaderResourceBindings *srbD
}
for (int stage = 0; stage < SUPPORTED_STAGES; ++stage) {
- if (cbD->recordingPass != QMetalCommandBuffer::RenderPass && (stage == VERTEX || stage == FRAGMENT))
+ if (cbD->recordingPass != QMetalCommandBuffer::RenderPass && (stage == QMetalShaderResourceBindingsData::VERTEX || stage == QMetalShaderResourceBindingsData::FRAGMENT
+ || stage == QMetalShaderResourceBindingsData::TESSCTRL || stage == QMetalShaderResourceBindingsData::TESSEVAL))
continue;
- if (cbD->recordingPass != QMetalCommandBuffer::ComputePass && stage == COMPUTE)
+ if (cbD->recordingPass != QMetalCommandBuffer::ComputePass && (stage == QMetalShaderResourceBindingsData::COMPUTE))
continue;
- res[stage].buffers.finish();
- res[stage].bufferOffsets.finish();
-
- for (int i = 0, ie = res[stage].buffers.batches.count(); i != ie; ++i) {
- const auto &bufferBatch(res[stage].buffers.batches[i]);
- const auto &offsetBatch(res[stage].bufferOffsets.batches[i]);
- switch (stage) {
- case VERTEX:
- [cbD->d->currentRenderPassEncoder setVertexBuffers: bufferBatch.resources.constData()
- offsets: offsetBatch.resources.constData()
- withRange: NSMakeRange(bufferBatch.startBinding, NSUInteger(bufferBatch.resources.count()))];
- break;
- case FRAGMENT:
- [cbD->d->currentRenderPassEncoder setFragmentBuffers: bufferBatch.resources.constData()
- offsets: offsetBatch.resources.constData()
- withRange: NSMakeRange(bufferBatch.startBinding, NSUInteger(bufferBatch.resources.count()))];
- break;
- case COMPUTE:
- [cbD->d->currentComputePassEncoder setBuffers: bufferBatch.resources.constData()
- offsets: offsetBatch.resources.constData()
- withRange: NSMakeRange(bufferBatch.startBinding, NSUInteger(bufferBatch.resources.count()))];
- break;
- default:
- Q_UNREACHABLE();
- break;
+ // QRhiBatchedBindings works with the native bindings and expects
+ // sorted input. The pre-sorted QRhiShaderResourceBinding list (based
+ // on the QRhi (SPIR-V) binding) is not helpful in this regard, so we
+ // have to sort here every time.
+
+ std::sort(bindingData.res[stage].buffers.begin(), bindingData.res[stage].buffers.end(), [](const QMetalShaderResourceBindingsData::Stage::Buffer &a, const QMetalShaderResourceBindingsData::Stage::Buffer &b) {
+ return a.nativeBinding < b.nativeBinding;
+ });
+
+ for (const QMetalShaderResourceBindingsData::Stage::Buffer &buf : std::as_const(bindingData.res[stage].buffers)) {
+ bindingData.res[stage].bufferBatches.feed(buf.nativeBinding, buf.mtlbuf);
+ bindingData.res[stage].bufferOffsetBatches.feed(buf.nativeBinding, buf.offset);
+ }
+
+ bindingData.res[stage].bufferBatches.finish();
+ bindingData.res[stage].bufferOffsetBatches.finish();
+
+ for (int i = 0, ie = bindingData.res[stage].bufferBatches.batches.count(); i != ie; ++i) {
+ const auto &bufferBatch(bindingData.res[stage].bufferBatches.batches[i]);
+ const auto &offsetBatch(bindingData.res[stage].bufferOffsetBatches.batches[i]);
+ // skip setting Buffer binding if the current state is already correct
+ if (cbD->d->currentShaderResourceBindingState.res[stage].bufferBatches.batches.count() > i
+ && cbD->d->currentShaderResourceBindingState.res[stage].bufferOffsetBatches.batches.count() > i
+ && bufferBatch == cbD->d->currentShaderResourceBindingState.res[stage].bufferBatches.batches[i]
+ && offsetBatch == cbD->d->currentShaderResourceBindingState.res[stage].bufferOffsetBatches.batches[i])
+ {
+ continue;
}
+ bindStageBuffers(cbD, stage, bufferBatch, offsetBatch);
}
if (offsetOnlyChange)
continue;
- res[stage].textures.finish();
- res[stage].samplers.finish();
+ std::sort(bindingData.res[stage].textures.begin(), bindingData.res[stage].textures.end(), [](const QMetalShaderResourceBindingsData::Stage::Texture &a, const QMetalShaderResourceBindingsData::Stage::Texture &b) {
+ return a.nativeBinding < b.nativeBinding;
+ });
- for (int i = 0, ie = res[stage].textures.batches.count(); i != ie; ++i) {
- const auto &batch(res[stage].textures.batches[i]);
- switch (stage) {
- case VERTEX:
- [cbD->d->currentRenderPassEncoder setVertexTextures: batch.resources.constData()
- withRange: NSMakeRange(batch.startBinding, NSUInteger(batch.resources.count()))];
- break;
- case FRAGMENT:
- [cbD->d->currentRenderPassEncoder setFragmentTextures: batch.resources.constData()
- withRange: NSMakeRange(batch.startBinding, NSUInteger(batch.resources.count()))];
- break;
- case COMPUTE:
- [cbD->d->currentComputePassEncoder setTextures: batch.resources.constData()
- withRange: NSMakeRange(batch.startBinding, NSUInteger(batch.resources.count()))];
- break;
- default:
- Q_UNREACHABLE();
- break;
+ std::sort(bindingData.res[stage].samplers.begin(), bindingData.res[stage].samplers.end(), [](const QMetalShaderResourceBindingsData::Stage::Sampler &a, const QMetalShaderResourceBindingsData::Stage::Sampler &b) {
+ return a.nativeBinding < b.nativeBinding;
+ });
+
+ for (const QMetalShaderResourceBindingsData::Stage::Texture &t : std::as_const(bindingData.res[stage].textures))
+ bindingData.res[stage].textureBatches.feed(t.nativeBinding, t.mtltex);
+
+ for (const QMetalShaderResourceBindingsData::Stage::Sampler &s : std::as_const(bindingData.res[stage].samplers))
+ bindingData.res[stage].samplerBatches.feed(s.nativeBinding, s.mtlsampler);
+
+ bindingData.res[stage].textureBatches.finish();
+ bindingData.res[stage].samplerBatches.finish();
+
+ for (int i = 0, ie = bindingData.res[stage].textureBatches.batches.count(); i != ie; ++i) {
+ const auto &batch(bindingData.res[stage].textureBatches.batches[i]);
+ // skip setting Texture binding if the current state is already correct
+ if (cbD->d->currentShaderResourceBindingState.res[stage].textureBatches.batches.count() > i
+ && batch == cbD->d->currentShaderResourceBindingState.res[stage].textureBatches.batches[i])
+ {
+ continue;
}
+ bindStageTextures(cbD, stage, batch);
}
- for (int i = 0, ie = res[stage].samplers.batches.count(); i != ie; ++i) {
- const auto &batch(res[stage].samplers.batches[i]);
- switch (stage) {
- case VERTEX:
- [cbD->d->currentRenderPassEncoder setVertexSamplerStates: batch.resources.constData()
- withRange: NSMakeRange(batch.startBinding, NSUInteger(batch.resources.count()))];
- break;
- case FRAGMENT:
- [cbD->d->currentRenderPassEncoder setFragmentSamplerStates: batch.resources.constData()
- withRange: NSMakeRange(batch.startBinding, NSUInteger(batch.resources.count()))];
- break;
- case COMPUTE:
- [cbD->d->currentComputePassEncoder setSamplerStates: batch.resources.constData()
- withRange: NSMakeRange(batch.startBinding, NSUInteger(batch.resources.count()))];
- break;
- default:
- Q_UNREACHABLE();
- break;
+
+ for (int i = 0, ie = bindingData.res[stage].samplerBatches.batches.count(); i != ie; ++i) {
+ const auto &batch(bindingData.res[stage].samplerBatches.batches[i]);
+ // skip setting Sampler State if the current state is already correct
+ if (cbD->d->currentShaderResourceBindingState.res[stage].samplerBatches.batches.count() > i
+ && batch == cbD->d->currentShaderResourceBindingState.res[stage].samplerBatches.batches[i])
+ {
+ continue;
}
+ bindStageSamplers(cbD, stage, batch);
}
}
+
+ cbD->d->currentShaderResourceBindingState = bindingData;
+}
+
+void QMetalGraphicsPipeline::makeActiveForCurrentRenderPassEncoder(QMetalCommandBuffer *cbD)
+{
+ [cbD->d->currentRenderPassEncoder setRenderPipelineState: d->ps];
+
+ if (cbD->d->currentDepthStencilState != d->ds) {
+ [cbD->d->currentRenderPassEncoder setDepthStencilState: d->ds];
+ cbD->d->currentDepthStencilState = d->ds;
+ }
+
+ if (cbD->currentCullMode == -1 || d->cullMode != uint(cbD->currentCullMode)) {
+ [cbD->d->currentRenderPassEncoder setCullMode: d->cullMode];
+ cbD->currentCullMode = int(d->cullMode);
+ }
+ if (cbD->currentTriangleFillMode == -1 || d->triangleFillMode != uint(cbD->currentTriangleFillMode)) {
+ [cbD->d->currentRenderPassEncoder setTriangleFillMode: d->triangleFillMode];
+ cbD->currentTriangleFillMode = int(d->triangleFillMode);
+ }
+ if (cbD->currentFrontFaceWinding == -1 || d->winding != uint(cbD->currentFrontFaceWinding)) {
+ [cbD->d->currentRenderPassEncoder setFrontFacingWinding: d->winding];
+ cbD->currentFrontFaceWinding = int(d->winding);
+ }
+ if (!qFuzzyCompare(d->depthBias, cbD->currentDepthBiasValues.first)
+ || !qFuzzyCompare(d->slopeScaledDepthBias, cbD->currentDepthBiasValues.second))
+ {
+ [cbD->d->currentRenderPassEncoder setDepthBias: d->depthBias
+ slopeScale: d->slopeScaledDepthBias
+ clamp: 0.0f];
+ cbD->currentDepthBiasValues = { d->depthBias, d->slopeScaledDepthBias };
+ }
}
void QRhiMetal::setGraphicsPipeline(QRhiCommandBuffer *cb, QRhiGraphicsPipeline *ps)
@@ -877,21 +1487,24 @@ void QRhiMetal::setGraphicsPipeline(QRhiCommandBuffer *cb, QRhiGraphicsPipeline
Q_ASSERT(cbD->recordingPass == QMetalCommandBuffer::RenderPass);
QMetalGraphicsPipeline *psD = QRHI_RES(QMetalGraphicsPipeline, ps);
- if (cbD->currentGraphicsPipeline != ps || cbD->currentPipelineGeneration != psD->generation) {
- cbD->currentGraphicsPipeline = ps;
- cbD->currentComputePipeline = nullptr;
- cbD->currentPipelineGeneration = psD->generation;
+ if (cbD->currentGraphicsPipeline == psD && cbD->currentPipelineGeneration == psD->generation)
+ return;
- [cbD->d->currentRenderPassEncoder setRenderPipelineState: psD->d->ps];
- [cbD->d->currentRenderPassEncoder setDepthStencilState: psD->d->ds];
+ cbD->currentGraphicsPipeline = psD;
+ cbD->currentComputePipeline = nullptr;
+ cbD->currentPipelineGeneration = psD->generation;
- if (cbD->currentCullMode == -1 || psD->d->cullMode != uint(cbD->currentCullMode)) {
- [cbD->d->currentRenderPassEncoder setCullMode: psD->d->cullMode];
- cbD->currentCullMode = int(psD->d->cullMode);
+ if (!psD->d->tess.enabled && !psD->d->tess.failed) {
+ psD->makeActiveForCurrentRenderPassEncoder(cbD);
+ } else {
+ // mark work buffers that can now be safely reused as reusable
+ for (QMetalBuffer *workBuf : psD->d->extraBufMgr.deviceLocalWorkBuffers) {
+ if (workBuf && workBuf->lastActiveFrameSlot == currentFrameSlot)
+ workBuf->lastActiveFrameSlot = -1;
}
- if (cbD->currentFrontFaceWinding == -1 || psD->d->winding != uint(cbD->currentFrontFaceWinding)) {
- [cbD->d->currentRenderPassEncoder setFrontFacingWinding: psD->d->winding];
- cbD->currentFrontFaceWinding = int(psD->d->winding);
+ for (QMetalBuffer *workBuf : psD->d->extraBufMgr.hostVisibleWorkBuffers) {
+ if (workBuf && workBuf->lastActiveFrameSlot == currentFrameSlot)
+ workBuf->lastActiveFrameSlot = -1;
}
}
@@ -904,8 +1517,8 @@ void QRhiMetal::setShaderResources(QRhiCommandBuffer *cb, QRhiShaderResourceBind
{
QMetalCommandBuffer *cbD = QRHI_RES(QMetalCommandBuffer, cb);
Q_ASSERT(cbD->recordingPass != QMetalCommandBuffer::NoPass);
- QMetalGraphicsPipeline *gfxPsD = QRHI_RES(QMetalGraphicsPipeline, cbD->currentGraphicsPipeline);
- QMetalComputePipeline *compPsD = QRHI_RES(QMetalComputePipeline, cbD->currentComputePipeline);
+ QMetalGraphicsPipeline *gfxPsD = cbD->currentGraphicsPipeline;
+ QMetalComputePipeline *compPsD = cbD->currentComputePipeline;
if (!srb) {
if (gfxPsD)
@@ -919,9 +1532,15 @@ void QRhiMetal::setShaderResources(QRhiCommandBuffer *cb, QRhiShaderResourceBind
bool hasDynamicOffsetInSrb = false;
bool resNeedsRebind = false;
+ // SPIRV-Cross buffer size buffers
+ // Need to determine storage buffer sizes here as this is the last opportunity for storage
+ // buffer bindings (offset, size) to be specified before draw / dispatch call
+ const bool needsBufferSizeBuffer = (compPsD && compPsD->d->bufferSizeBuffer) || (gfxPsD && gfxPsD->d->bufferSizeBuffer);
+ QMap<QRhiShaderResourceBinding::StageFlag, QMap<int, quint32>> storageBufferSizes;
+
// do buffer writes, figure out if we need to rebind, and mark as in-use
for (int i = 0, ie = srbD->sortedBindings.count(); i != ie; ++i) {
- const QRhiShaderResourceBinding::Data *b = srbD->sortedBindings.at(i).data();
+ const QRhiShaderResourceBinding::Data *b = shaderResourceBindingData(srbD->sortedBindings.at(i));
QMetalShaderResourceBindings::BoundResourceData &bd(srbD->boundResourceData[i]);
switch (b->type) {
case QRhiShaderResourceBinding::UniformBuffer:
@@ -942,28 +1561,42 @@ void QRhiMetal::setShaderResources(QRhiCommandBuffer *cb, QRhiShaderResourceBind
}
break;
case QRhiShaderResourceBinding::SampledTexture:
+ case QRhiShaderResourceBinding::Texture:
+ case QRhiShaderResourceBinding::Sampler:
{
- QMetalTexture *texD = QRHI_RES(QMetalTexture, b->u.stex.tex);
- QMetalSampler *samplerD = QRHI_RES(QMetalSampler, b->u.stex.sampler);
- if (texD->generation != bd.stex.texGeneration
- || texD->m_id != bd.stex.texId
- || samplerD->generation != bd.stex.samplerGeneration
- || samplerD->m_id != bd.stex.samplerId)
- {
+ const QRhiShaderResourceBinding::Data::TextureAndOrSamplerData *data = &b->u.stex;
+ if (bd.stex.count != data->count) {
+ bd.stex.count = data->count;
resNeedsRebind = true;
- bd.stex.texId = texD->m_id;
- bd.stex.texGeneration = texD->generation;
- bd.stex.samplerId = samplerD->m_id;
- bd.stex.samplerGeneration = samplerD->generation;
}
- texD->lastActiveFrameSlot = currentFrameSlot;
- samplerD->lastActiveFrameSlot = currentFrameSlot;
+ for (int elem = 0; elem < data->count; ++elem) {
+ QMetalTexture *texD = QRHI_RES(QMetalTexture, data->texSamplers[elem].tex);
+ QMetalSampler *samplerD = QRHI_RES(QMetalSampler, data->texSamplers[elem].sampler);
+ Q_ASSERT(texD || samplerD);
+ const quint64 texId = texD ? texD->m_id : 0;
+ const uint texGen = texD ? texD->generation : 0;
+ const quint64 samplerId = samplerD ? samplerD->m_id : 0;
+ const uint samplerGen = samplerD ? samplerD->generation : 0;
+ if (texGen != bd.stex.d[elem].texGeneration
+ || texId != bd.stex.d[elem].texId
+ || samplerGen != bd.stex.d[elem].samplerGeneration
+ || samplerId != bd.stex.d[elem].samplerId)
+ {
+ resNeedsRebind = true;
+ bd.stex.d[elem].texId = texId;
+ bd.stex.d[elem].texGeneration = texGen;
+ bd.stex.d[elem].samplerId = samplerId;
+ bd.stex.d[elem].samplerGeneration = samplerGen;
+ }
+ if (texD)
+ texD->lastActiveFrameSlot = currentFrameSlot;
+ if (samplerD)
+ samplerD->lastActiveFrameSlot = currentFrameSlot;
+ }
}
break;
case QRhiShaderResourceBinding::ImageLoad:
- Q_FALLTHROUGH();
case QRhiShaderResourceBinding::ImageStore:
- Q_FALLTHROUGH();
case QRhiShaderResourceBinding::ImageLoadStore:
{
QMetalTexture *texD = QRHI_RES(QMetalTexture, b->u.simage.tex);
@@ -976,13 +1609,22 @@ void QRhiMetal::setShaderResources(QRhiCommandBuffer *cb, QRhiShaderResourceBind
}
break;
case QRhiShaderResourceBinding::BufferLoad:
- Q_FALLTHROUGH();
case QRhiShaderResourceBinding::BufferStore:
- Q_FALLTHROUGH();
case QRhiShaderResourceBinding::BufferLoadStore:
{
QMetalBuffer *bufD = QRHI_RES(QMetalBuffer, b->u.sbuf.buf);
Q_ASSERT(bufD->m_usage.testFlag(QRhiBuffer::StorageBuffer));
+
+ if (needsBufferSizeBuffer) {
+ for (int i = 0; i < 6; ++i) {
+ const QRhiShaderResourceBinding::StageFlag stage =
+ QRhiShaderResourceBinding::StageFlag(1 << i);
+ if (b->stage.testFlag(stage)) {
+ storageBufferSizes[stage][b->binding] = b->u.sbuf.maybeSize ? b->u.sbuf.maybeSize : bufD->size();
+ }
+ }
+ }
+
executeBufferHostWritesForCurrentFrame(bufD);
if (bufD->generation != bd.sbuf.generation || bufD->m_id != bd.sbuf.id) {
resNeedsRebind = true;
@@ -998,26 +1640,141 @@ void QRhiMetal::setShaderResources(QRhiCommandBuffer *cb, QRhiShaderResourceBind
}
}
+ if (needsBufferSizeBuffer) {
+ QMetalBuffer *bufD = nullptr;
+ QVarLengthArray<QPair<QMetalShader *, QRhiShaderResourceBinding::StageFlag>, 4> shaders;
+
+ if (compPsD) {
+ bufD = compPsD->d->bufferSizeBuffer;
+ Q_ASSERT(compPsD->d->cs.nativeShaderInfo.extraBufferBindings.contains(QShaderPrivate::MslBufferSizeBufferBinding));
+ shaders.append(qMakePair(&compPsD->d->cs, QRhiShaderResourceBinding::StageFlag::ComputeStage));
+ } else {
+ bufD = gfxPsD->d->bufferSizeBuffer;
+ if (gfxPsD->d->tess.enabled) {
+
+ // Assumptions
+ // * We only use one of the compute vertex shader variants in a pipeline at any one time
+ // * The vertex shader variants all have the same storage block bindings
+ // * The vertex shader variants all have the same native resource binding map
+ // * The vertex shader variants all have the same MslBufferSizeBufferBinding requirement
+ // * The vertex shader variants all have the same MslBufferSizeBufferBinding binding
+ // => We only need to use one vertex shader variant to generate the identical shader
+ // resource bindings
+ Q_ASSERT(gfxPsD->d->tess.compVs[0].desc.storageBlocks() == gfxPsD->d->tess.compVs[1].desc.storageBlocks());
+ Q_ASSERT(gfxPsD->d->tess.compVs[0].desc.storageBlocks() == gfxPsD->d->tess.compVs[2].desc.storageBlocks());
+ Q_ASSERT(gfxPsD->d->tess.compVs[0].nativeResourceBindingMap == gfxPsD->d->tess.compVs[1].nativeResourceBindingMap);
+ Q_ASSERT(gfxPsD->d->tess.compVs[0].nativeResourceBindingMap == gfxPsD->d->tess.compVs[2].nativeResourceBindingMap);
+ Q_ASSERT(gfxPsD->d->tess.compVs[0].nativeShaderInfo.extraBufferBindings.contains(QShaderPrivate::MslBufferSizeBufferBinding)
+ == gfxPsD->d->tess.compVs[1].nativeShaderInfo.extraBufferBindings.contains(QShaderPrivate::MslBufferSizeBufferBinding));
+ Q_ASSERT(gfxPsD->d->tess.compVs[0].nativeShaderInfo.extraBufferBindings.contains(QShaderPrivate::MslBufferSizeBufferBinding)
+ == gfxPsD->d->tess.compVs[2].nativeShaderInfo.extraBufferBindings.contains(QShaderPrivate::MslBufferSizeBufferBinding));
+ Q_ASSERT(gfxPsD->d->tess.compVs[0].nativeShaderInfo.extraBufferBindings[QShaderPrivate::MslBufferSizeBufferBinding]
+ == gfxPsD->d->tess.compVs[1].nativeShaderInfo.extraBufferBindings[QShaderPrivate::MslBufferSizeBufferBinding]);
+ Q_ASSERT(gfxPsD->d->tess.compVs[0].nativeShaderInfo.extraBufferBindings[QShaderPrivate::MslBufferSizeBufferBinding]
+ == gfxPsD->d->tess.compVs[2].nativeShaderInfo.extraBufferBindings[QShaderPrivate::MslBufferSizeBufferBinding]);
+
+ if (gfxPsD->d->tess.compVs[0].nativeShaderInfo.extraBufferBindings.contains(QShaderPrivate::MslBufferSizeBufferBinding))
+ shaders.append(qMakePair(&gfxPsD->d->tess.compVs[0], QRhiShaderResourceBinding::StageFlag::VertexStage));
+
+ if (gfxPsD->d->tess.compTesc.nativeShaderInfo.extraBufferBindings.contains(QShaderPrivate::MslBufferSizeBufferBinding))
+ shaders.append(qMakePair(&gfxPsD->d->tess.compTesc, QRhiShaderResourceBinding::StageFlag::TessellationControlStage));
+
+ if (gfxPsD->d->tess.vertTese.nativeShaderInfo.extraBufferBindings.contains(QShaderPrivate::MslBufferSizeBufferBinding))
+ shaders.append(qMakePair(&gfxPsD->d->tess.vertTese, QRhiShaderResourceBinding::StageFlag::TessellationEvaluationStage));
+
+ } else {
+ if (gfxPsD->d->vs.nativeShaderInfo.extraBufferBindings.contains(QShaderPrivate::MslBufferSizeBufferBinding))
+ shaders.append(qMakePair(&gfxPsD->d->vs, QRhiShaderResourceBinding::StageFlag::VertexStage));
+ }
+ if (gfxPsD->d->fs.nativeShaderInfo.extraBufferBindings.contains(QShaderPrivate::MslBufferSizeBufferBinding))
+ shaders.append(qMakePair(&gfxPsD->d->fs, QRhiShaderResourceBinding::StageFlag::FragmentStage));
+ }
+
+ quint32 offset = 0;
+ for (const QPair<QMetalShader *, QRhiShaderResourceBinding::StageFlag> &shader : shaders) {
+
+ const int binding = shader.first->nativeShaderInfo.extraBufferBindings[QShaderPrivate::MslBufferSizeBufferBinding];
+
+ // if we don't have a srb entry for the buffer size buffer
+ if (!(storageBufferSizes.contains(shader.second) && storageBufferSizes[shader.second].contains(binding))) {
+
+ int maxNativeBinding = 0;
+ for (const QShaderDescription::StorageBlock &block : shader.first->desc.storageBlocks())
+ maxNativeBinding = qMax(maxNativeBinding, shader.first->nativeResourceBindingMap[block.binding].first);
+
+ const int size = (maxNativeBinding + 1) * sizeof(int);
+
+ Q_ASSERT(offset + size <= bufD->size());
+ srbD->sortedBindings.append(QRhiShaderResourceBinding::bufferLoad(binding, shader.second, bufD, offset, size));
+
+ QMetalShaderResourceBindings::BoundResourceData bd;
+ bd.sbuf.id = bufD->m_id;
+ bd.sbuf.generation = bufD->generation;
+ srbD->boundResourceData.append(bd);
+ }
+
+ // create the buffer size buffer data
+ QVarLengthArray<int, 8> bufferSizeBufferData;
+ Q_ASSERT(storageBufferSizes.contains(shader.second));
+ const QMap<int, quint32> &sizes(storageBufferSizes[shader.second]);
+ for (const QShaderDescription::StorageBlock &block : shader.first->desc.storageBlocks()) {
+ const int index = shader.first->nativeResourceBindingMap[block.binding].first;
+
+ // if the native binding is -1, the buffer is present but not accessed in the shader
+ if (index < 0)
+ continue;
+
+ if (bufferSizeBufferData.size() <= index)
+ bufferSizeBufferData.resize(index + 1);
+
+ Q_ASSERT(sizes.contains(block.binding));
+ bufferSizeBufferData[index] = sizes[block.binding];
+ }
+
+ QRhiBufferData data;
+ const quint32 size = bufferSizeBufferData.size() * sizeof(int);
+ data.assign(reinterpret_cast<const char *>(bufferSizeBufferData.constData()), size);
+ Q_ASSERT(offset + size <= bufD->size());
+ bufD->d->pendingUpdates[bufD->d->slotted ? currentFrameSlot : 0].append({ offset, data });
+
+ // buffer offsets must be 32byte aligned
+ offset += ((size + 31) / 32) * 32;
+ }
+
+ executeBufferHostWritesForCurrentFrame(bufD);
+ bufD->lastActiveFrameSlot = currentFrameSlot;
+ }
+
// make sure the resources for the correct slot get bound
const int resSlot = hasSlottedResourceInSrb ? currentFrameSlot : 0;
if (hasSlottedResourceInSrb && cbD->currentResSlot != resSlot)
resNeedsRebind = true;
- const bool srbChanged = gfxPsD ? (cbD->currentGraphicsSrb != srb) : (cbD->currentComputeSrb != srb);
+ const bool srbChanged = gfxPsD ? (cbD->currentGraphicsSrb != srbD) : (cbD->currentComputeSrb != srbD);
const bool srbRebuilt = cbD->currentSrbGeneration != srbD->generation;
// dynamic uniform buffer offsets always trigger a rebind
if (hasDynamicOffsetInSrb || resNeedsRebind || srbChanged || srbRebuilt) {
- const QShader::NativeResourceBindingMap *resBindMaps[SUPPORTED_STAGES] = { nullptr, nullptr, nullptr };
+ const QShader::NativeResourceBindingMap *resBindMaps[SUPPORTED_STAGES] = { nullptr, nullptr, nullptr, nullptr, nullptr };
if (gfxPsD) {
- cbD->currentGraphicsSrb = srb;
+ cbD->currentGraphicsSrb = srbD;
cbD->currentComputeSrb = nullptr;
- resBindMaps[0] = &gfxPsD->d->vs.nativeResourceBindingMap;
- resBindMaps[1] = &gfxPsD->d->fs.nativeResourceBindingMap;
+ if (gfxPsD->d->tess.enabled) {
+ // If tessellating, we don't know which compVs shader to use until the draw call is
+ // made. They should all have the same native resource binding map, so pick one.
+ Q_ASSERT(gfxPsD->d->tess.compVs[0].nativeResourceBindingMap == gfxPsD->d->tess.compVs[1].nativeResourceBindingMap);
+ Q_ASSERT(gfxPsD->d->tess.compVs[0].nativeResourceBindingMap == gfxPsD->d->tess.compVs[2].nativeResourceBindingMap);
+ resBindMaps[QMetalShaderResourceBindingsData::VERTEX] = &gfxPsD->d->tess.compVs[0].nativeResourceBindingMap;
+ resBindMaps[QMetalShaderResourceBindingsData::TESSCTRL] = &gfxPsD->d->tess.compTesc.nativeResourceBindingMap;
+ resBindMaps[QMetalShaderResourceBindingsData::TESSEVAL] = &gfxPsD->d->tess.vertTese.nativeResourceBindingMap;
+ } else {
+ resBindMaps[QMetalShaderResourceBindingsData::VERTEX] = &gfxPsD->d->vs.nativeResourceBindingMap;
+ }
+ resBindMaps[QMetalShaderResourceBindingsData::FRAGMENT] = &gfxPsD->d->fs.nativeResourceBindingMap;
} else {
cbD->currentGraphicsSrb = nullptr;
- cbD->currentComputeSrb = srb;
- resBindMaps[2] = &compPsD->d->cs.nativeResourceBindingMap;
+ cbD->currentComputeSrb = srbD;
+ resBindMaps[QMetalShaderResourceBindingsData::COMPUTE] = &compPsD->d->cs.nativeResourceBindingMap;
}
cbD->currentSrbGeneration = srbD->generation;
cbD->currentResSlot = resSlot;
@@ -1048,13 +1805,13 @@ void QRhiMetal::setVertexInput(QRhiCommandBuffer *cb,
offsets.finish();
// same binding space for vertex and constant buffers - work it around
- QRhiShaderResourceBindings *srb = cbD->currentGraphicsSrb;
+ QMetalShaderResourceBindings *srbD = cbD->currentGraphicsSrb;
// There's nothing guaranteeing setShaderResources() was called before
// setVertexInput()... but whatever srb will get bound will have to be
// layout-compatible anyways so maxBinding is the same.
- if (!srb)
- srb = cbD->currentGraphicsPipeline->shaderResourceBindings();
- const int firstVertexBinding = QRHI_RES(QMetalShaderResourceBindings, srb)->maxBinding + 1;
+ if (!srbD)
+ srbD = QRHI_RES(QMetalShaderResourceBindings, cbD->currentGraphicsPipeline->shaderResourceBindings());
+ const int firstVertexBinding = srbD->maxBinding + 1;
if (firstVertexBinding != cbD->d->currentFirstVertexBinding
|| buffers != cbD->d->currentVertexInputsBuffers
@@ -1078,7 +1835,7 @@ void QRhiMetal::setVertexInput(QRhiCommandBuffer *cb,
QMetalBuffer *ibufD = QRHI_RES(QMetalBuffer, indexBuf);
executeBufferHostWritesForCurrentFrame(ibufD);
ibufD->lastActiveFrameSlot = currentFrameSlot;
- cbD->currentIndexBuffer = indexBuf;
+ cbD->currentIndexBuffer = ibufD;
cbD->currentIndexOffset = indexOffset;
cbD->currentIndexFormat = indexFormat;
} else {
@@ -1094,7 +1851,7 @@ void QRhiMetal::setViewport(QRhiCommandBuffer *cb, const QRhiViewport &viewport)
// x,y is top-left in MTLViewportRect but bottom-left in QRhiViewport
float x, y, w, h;
- if (!qrhi_toTopLeftRenderTargetRect(outputSize, viewport.viewport(), &x, &y, &w, &h))
+ if (!qrhi_toTopLeftRenderTargetRect<UnBounded>(outputSize, viewport.viewport(), &x, &y, &w, &h))
return;
MTLViewport vp;
@@ -1107,8 +1864,10 @@ void QRhiMetal::setViewport(QRhiCommandBuffer *cb, const QRhiViewport &viewport)
[cbD->d->currentRenderPassEncoder setViewport: vp];
- if (!QRHI_RES(QMetalGraphicsPipeline, cbD->currentGraphicsPipeline)->m_flags.testFlag(QRhiGraphicsPipeline::UsesScissor)) {
+ if (cbD->currentGraphicsPipeline
+ && !cbD->currentGraphicsPipeline->m_flags.testFlag(QRhiGraphicsPipeline::UsesScissor)) {
MTLScissorRect s;
+ qrhi_toTopLeftRenderTargetRect<Bounded>(outputSize, viewport.viewport(), &x, &y, &w, &h);
s.x = NSUInteger(x);
s.y = NSUInteger(y);
s.width = NSUInteger(w);
@@ -1121,12 +1880,12 @@ void QRhiMetal::setScissor(QRhiCommandBuffer *cb, const QRhiScissor &scissor)
{
QMetalCommandBuffer *cbD = QRHI_RES(QMetalCommandBuffer, cb);
Q_ASSERT(cbD->recordingPass == QMetalCommandBuffer::RenderPass);
- Q_ASSERT(QRHI_RES(QMetalGraphicsPipeline, cbD->currentGraphicsPipeline)->m_flags.testFlag(QRhiGraphicsPipeline::UsesScissor));
+ Q_ASSERT(cbD->currentGraphicsPipeline->m_flags.testFlag(QRhiGraphicsPipeline::UsesScissor));
const QSize outputSize = cbD->currentTarget->pixelSize();
// x,y is top-left in MTLScissorRect but bottom-left in QRhiScissor
int x, y, w, h;
- if (!qrhi_toTopLeftRenderTargetRect(outputSize, scissor.scissor(), &x, &y, &w, &h))
+ if (!qrhi_toTopLeftRenderTargetRect<Bounded>(outputSize, scissor.scissor(), &x, &y, &w, &h))
return;
MTLScissorRect s;
@@ -1155,15 +1914,321 @@ void QRhiMetal::setStencilRef(QRhiCommandBuffer *cb, quint32 refValue)
[cbD->d->currentRenderPassEncoder setStencilReferenceValue: refValue];
}
+static id<MTLComputeCommandEncoder> tessellationComputeEncoder(QMetalCommandBuffer *cbD)
+{
+ if (cbD->d->currentRenderPassEncoder) {
+ [cbD->d->currentRenderPassEncoder endEncoding];
+ cbD->d->currentRenderPassEncoder = nil;
+ }
+
+ if (!cbD->d->tessellationComputeEncoder)
+ cbD->d->tessellationComputeEncoder = [cbD->d->cb computeCommandEncoder];
+
+ return cbD->d->tessellationComputeEncoder;
+}
+
+static void endTessellationComputeEncoding(QMetalCommandBuffer *cbD)
+{
+ if (cbD->d->tessellationComputeEncoder) {
+ [cbD->d->tessellationComputeEncoder endEncoding];
+ cbD->d->tessellationComputeEncoder = nil;
+ }
+
+ QMetalRenderTargetData * rtD = nullptr;
+
+ switch (cbD->currentTarget->resourceType()) {
+ case QRhiResource::SwapChainRenderTarget:
+ rtD = QRHI_RES(QMetalSwapChainRenderTarget, cbD->currentTarget)->d;
+ break;
+ case QRhiResource::TextureRenderTarget:
+ rtD = QRHI_RES(QMetalTextureRenderTarget, cbD->currentTarget)->d;
+ break;
+ default:
+ break;
+ }
+
+ Q_ASSERT(rtD);
+
+ QVarLengthArray<MTLLoadAction, 4> oldColorLoad;
+ for (uint i = 0; i < uint(rtD->colorAttCount); ++i) {
+ oldColorLoad.append(cbD->d->currentPassRpDesc.colorAttachments[i].loadAction);
+ if (cbD->d->currentPassRpDesc.colorAttachments[i].storeAction != MTLStoreActionDontCare)
+ cbD->d->currentPassRpDesc.colorAttachments[i].loadAction = MTLLoadActionLoad;
+ }
+
+ MTLLoadAction oldDepthLoad;
+ MTLLoadAction oldStencilLoad;
+ if (rtD->dsAttCount) {
+ oldDepthLoad = cbD->d->currentPassRpDesc.depthAttachment.loadAction;
+ if (cbD->d->currentPassRpDesc.depthAttachment.storeAction != MTLStoreActionDontCare)
+ cbD->d->currentPassRpDesc.depthAttachment.loadAction = MTLLoadActionLoad;
+
+ oldStencilLoad = cbD->d->currentPassRpDesc.stencilAttachment.loadAction;
+ if (cbD->d->currentPassRpDesc.stencilAttachment.storeAction != MTLStoreActionDontCare)
+ cbD->d->currentPassRpDesc.stencilAttachment.loadAction = MTLLoadActionLoad;
+ }
+
+ cbD->d->currentRenderPassEncoder = [cbD->d->cb renderCommandEncoderWithDescriptor: cbD->d->currentPassRpDesc];
+ cbD->resetPerPassCachedState();
+
+ for (uint i = 0; i < uint(rtD->colorAttCount); ++i) {
+ cbD->d->currentPassRpDesc.colorAttachments[i].loadAction = oldColorLoad[i];
+ }
+
+ if (rtD->dsAttCount) {
+ cbD->d->currentPassRpDesc.depthAttachment.loadAction = oldDepthLoad;
+ cbD->d->currentPassRpDesc.stencilAttachment.loadAction = oldStencilLoad;
+ }
+
+}
+
+void QRhiMetal::tessellatedDraw(const TessDrawArgs &args)
+{
+ QMetalCommandBuffer *cbD = args.cbD;
+ QMetalGraphicsPipeline *graphicsPipeline = cbD->currentGraphicsPipeline;
+ if (graphicsPipeline->d->tess.failed)
+ return;
+
+ const bool indexed = args.type != TessDrawArgs::NonIndexed;
+ const quint32 instanceCount = indexed ? args.drawIndexed.instanceCount : args.draw.instanceCount;
+ const quint32 vertexOrIndexCount = indexed ? args.drawIndexed.indexCount : args.draw.vertexCount;
+
+ QMetalGraphicsPipelineData::Tessellation &tess(graphicsPipeline->d->tess);
+ QMetalGraphicsPipelineData::ExtraBufferManager &extraBufMgr(graphicsPipeline->d->extraBufMgr);
+ const quint32 patchCount = tess.patchCountForDrawCall(vertexOrIndexCount, instanceCount);
+ QMetalBuffer *vertOutBuf = nullptr;
+ QMetalBuffer *tescOutBuf = nullptr;
+ QMetalBuffer *tescPatchOutBuf = nullptr;
+ QMetalBuffer *tescFactorBuf = nullptr;
+ QMetalBuffer *tescParamsBuf = nullptr;
+ id<MTLComputeCommandEncoder> vertTescComputeEncoder = tessellationComputeEncoder(cbD);
+
+ // Step 1: vertex shader (as compute)
+ {
+ id<MTLComputeCommandEncoder> computeEncoder = vertTescComputeEncoder;
+ QShader::Variant shaderVariant = QShader::NonIndexedVertexAsComputeShader;
+ if (args.type == TessDrawArgs::U16Indexed)
+ shaderVariant = QShader::UInt16IndexedVertexAsComputeShader;
+ else if (args.type == TessDrawArgs::U32Indexed)
+ shaderVariant = QShader::UInt32IndexedVertexAsComputeShader;
+ const int varIndex = QMetalGraphicsPipelineData::Tessellation::vsCompVariantToIndex(shaderVariant);
+ id<MTLComputePipelineState> computePipelineState = tess.vsCompPipeline(this, shaderVariant);
+ [computeEncoder setComputePipelineState: computePipelineState];
+
+ // Make uniform buffers, textures, and samplers (meant for the
+ // vertex stage from the client's point of view) visible in the
+ // "vertex as compute" shader
+ cbD->d->currentComputePassEncoder = computeEncoder;
+ rebindShaderResources(cbD, QMetalShaderResourceBindingsData::VERTEX, QMetalShaderResourceBindingsData::COMPUTE);
+ cbD->d->currentComputePassEncoder = nil;
+
+ const QMap<int, int> &ebb(tess.compVs[varIndex].nativeShaderInfo.extraBufferBindings);
+ const int outputBufferBinding = ebb.value(QShaderPrivate::MslTessVertTescOutputBufferBinding, -1);
+ const int indexBufferBinding = ebb.value(QShaderPrivate::MslTessVertIndicesBufferBinding, -1);
+
+ if (outputBufferBinding >= 0) {
+ const quint32 workBufSize = tess.vsCompOutputBufferSize(vertexOrIndexCount, instanceCount);
+ vertOutBuf = extraBufMgr.acquireWorkBuffer(this, workBufSize);
+ if (!vertOutBuf)
+ return;
+ [computeEncoder setBuffer: vertOutBuf->d->buf[0] offset: 0 atIndex: outputBufferBinding];
+ }
+
+ if (indexBufferBinding >= 0)
+ [computeEncoder setBuffer: (id<MTLBuffer>) args.drawIndexed.indexBuffer offset: 0 atIndex: indexBufferBinding];
+
+ for (int i = 0, ie = cbD->d->currentVertexInputsBuffers.batches.count(); i != ie; ++i) {
+ const auto &bufferBatch(cbD->d->currentVertexInputsBuffers.batches[i]);
+ const auto &offsetBatch(cbD->d->currentVertexInputOffsets.batches[i]);
+ [computeEncoder setBuffers: bufferBatch.resources.constData()
+ offsets: offsetBatch.resources.constData()
+ withRange: NSMakeRange(uint(cbD->d->currentFirstVertexBinding) + bufferBatch.startBinding, NSUInteger(bufferBatch.resources.count()))];
+ }
+
+ if (indexed) {
+ [computeEncoder setStageInRegion: MTLRegionMake2D(args.drawIndexed.vertexOffset, args.drawIndexed.firstInstance,
+ args.drawIndexed.indexCount, args.drawIndexed.instanceCount)];
+ } else {
+ [computeEncoder setStageInRegion: MTLRegionMake2D(args.draw.firstVertex, args.draw.firstInstance,
+ args.draw.vertexCount, args.draw.instanceCount)];
+ }
+
+ [computeEncoder dispatchThreads: MTLSizeMake(vertexOrIndexCount, instanceCount, 1)
+ threadsPerThreadgroup: MTLSizeMake(computePipelineState.threadExecutionWidth, 1, 1)];
+ }
+
+ // Step 2: tessellation control shader (as compute)
+ {
+ id<MTLComputeCommandEncoder> computeEncoder = vertTescComputeEncoder;
+ id<MTLComputePipelineState> computePipelineState = tess.tescCompPipeline(this);
+ [computeEncoder setComputePipelineState: computePipelineState];
+
+ cbD->d->currentComputePassEncoder = computeEncoder;
+ rebindShaderResources(cbD, QMetalShaderResourceBindingsData::TESSCTRL, QMetalShaderResourceBindingsData::COMPUTE);
+ cbD->d->currentComputePassEncoder = nil;
+
+ const QMap<int, int> &ebb(tess.compTesc.nativeShaderInfo.extraBufferBindings);
+ const int outputBufferBinding = ebb.value(QShaderPrivate::MslTessVertTescOutputBufferBinding, -1);
+ const int patchOutputBufferBinding = ebb.value(QShaderPrivate::MslTessTescPatchOutputBufferBinding, -1);
+ const int tessFactorBufferBinding = ebb.value(QShaderPrivate::MslTessTescTessLevelBufferBinding, -1);
+ const int paramsBufferBinding = ebb.value(QShaderPrivate::MslTessTescParamsBufferBinding, -1);
+ const int inputBufferBinding = ebb.value(QShaderPrivate::MslTessTescInputBufferBinding, -1);
+
+ if (outputBufferBinding >= 0) {
+ const quint32 workBufSize = tess.tescCompOutputBufferSize(patchCount);
+ tescOutBuf = extraBufMgr.acquireWorkBuffer(this, workBufSize);
+ if (!tescOutBuf)
+ return;
+ [computeEncoder setBuffer: tescOutBuf->d->buf[0] offset: 0 atIndex: outputBufferBinding];
+ }
+
+ if (patchOutputBufferBinding >= 0) {
+ const quint32 workBufSize = tess.tescCompPatchOutputBufferSize(patchCount);
+ tescPatchOutBuf = extraBufMgr.acquireWorkBuffer(this, workBufSize);
+ if (!tescPatchOutBuf)
+ return;
+ [computeEncoder setBuffer: tescPatchOutBuf->d->buf[0] offset: 0 atIndex: patchOutputBufferBinding];
+ }
+
+ if (tessFactorBufferBinding >= 0) {
+ tescFactorBuf = extraBufMgr.acquireWorkBuffer(this, patchCount * sizeof(MTLQuadTessellationFactorsHalf));
+ [computeEncoder setBuffer: tescFactorBuf->d->buf[0] offset: 0 atIndex: tessFactorBufferBinding];
+ }
+
+ if (paramsBufferBinding >= 0) {
+ struct {
+ quint32 inControlPointCount;
+ quint32 patchCount;
+ } params;
+ tescParamsBuf = extraBufMgr.acquireWorkBuffer(this, sizeof(params), QMetalGraphicsPipelineData::ExtraBufferManager::WorkBufType::HostVisible);
+ if (!tescParamsBuf)
+ return;
+ params.inControlPointCount = tess.inControlPointCount;
+ params.patchCount = patchCount;
+ id<MTLBuffer> paramsBuf = tescParamsBuf->d->buf[0];
+ char *p = reinterpret_cast<char *>([paramsBuf contents]);
+ memcpy(p, &params, sizeof(params));
+ [computeEncoder setBuffer: paramsBuf offset: 0 atIndex: paramsBufferBinding];
+ }
+
+ if (vertOutBuf && inputBufferBinding >= 0)
+ [computeEncoder setBuffer: vertOutBuf->d->buf[0] offset: 0 atIndex: inputBufferBinding];
+
+ int sgSize = int(computePipelineState.threadExecutionWidth);
+ int wgSize = std::lcm(tess.outControlPointCount, sgSize);
+ while (wgSize > caps.maxThreadGroupSize) {
+ sgSize /= 2;
+ wgSize = std::lcm(tess.outControlPointCount, sgSize);
+ }
+ [computeEncoder dispatchThreads: MTLSizeMake(patchCount * tess.outControlPointCount, 1, 1)
+ threadsPerThreadgroup: MTLSizeMake(wgSize, 1, 1)];
+ }
+
+ // Much of the state in the QMetalCommandBuffer is going to be reset
+ // when we get a new render encoder. Save what we need. (cheaper than
+ // starting to walk over the srb again)
+ const QMetalShaderResourceBindingsData resourceBindings = cbD->d->currentShaderResourceBindingState;
+
+ endTessellationComputeEncoding(cbD);
+
+ // Step 3: tessellation evaluation (as vertex) + fragment shader
+ {
+ // No need to call tess.teseFragRenderPipeline because it was done
+ // once and we know the result is stored in the standard place
+ // (graphicsPipeline->d->ps).
+
+ graphicsPipeline->makeActiveForCurrentRenderPassEncoder(cbD);
+ id<MTLRenderCommandEncoder> renderEncoder = cbD->d->currentRenderPassEncoder;
+
+ rebindShaderResources(cbD, QMetalShaderResourceBindingsData::TESSEVAL, QMetalShaderResourceBindingsData::VERTEX, &resourceBindings);
+ rebindShaderResources(cbD, QMetalShaderResourceBindingsData::FRAGMENT, QMetalShaderResourceBindingsData::FRAGMENT, &resourceBindings);
+
+ const QMap<int, int> &ebb(tess.compTesc.nativeShaderInfo.extraBufferBindings);
+ const int outputBufferBinding = ebb.value(QShaderPrivate::MslTessVertTescOutputBufferBinding, -1);
+ const int patchOutputBufferBinding = ebb.value(QShaderPrivate::MslTessTescPatchOutputBufferBinding, -1);
+ const int tessFactorBufferBinding = ebb.value(QShaderPrivate::MslTessTescTessLevelBufferBinding, -1);
+
+ if (outputBufferBinding >= 0 && tescOutBuf)
+ [renderEncoder setVertexBuffer: tescOutBuf->d->buf[0] offset: 0 atIndex: outputBufferBinding];
+
+ if (patchOutputBufferBinding >= 0 && tescPatchOutBuf)
+ [renderEncoder setVertexBuffer: tescPatchOutBuf->d->buf[0] offset: 0 atIndex: patchOutputBufferBinding];
+
+ if (tessFactorBufferBinding >= 0 && tescFactorBuf) {
+ [renderEncoder setTessellationFactorBuffer: tescFactorBuf->d->buf[0] offset: 0 instanceStride: 0];
+ [renderEncoder setVertexBuffer: tescFactorBuf->d->buf[0] offset: 0 atIndex: tessFactorBufferBinding];
+ }
+
+ [cbD->d->currentRenderPassEncoder drawPatches: tess.outControlPointCount
+ patchStart: 0
+ patchCount: patchCount
+ patchIndexBuffer: nil
+ patchIndexBufferOffset: 0
+ instanceCount: 1
+ baseInstance: 0];
+ }
+}
+
+void QRhiMetal::adjustForMultiViewDraw(quint32 *instanceCount, QRhiCommandBuffer *cb)
+{
+ QMetalCommandBuffer *cbD = QRHI_RES(QMetalCommandBuffer, cb);
+ const int multiViewCount = cbD->currentGraphicsPipeline->m_multiViewCount;
+ if (multiViewCount <= 1)
+ return;
+
+ const QMap<int, int> &ebb(cbD->currentGraphicsPipeline->d->vs.nativeShaderInfo.extraBufferBindings);
+ const int viewMaskBufBinding = ebb.value(QShaderPrivate::MslMultiViewMaskBufferBinding, -1);
+ if (viewMaskBufBinding == -1) {
+ qWarning("No extra buffer for multiview in the vertex shader; was it built with --view-count specified?");
+ return;
+ }
+ struct {
+ quint32 viewOffset;
+ quint32 viewCount;
+ } multiViewInfo;
+ multiViewInfo.viewOffset = 0;
+ multiViewInfo.viewCount = quint32(multiViewCount);
+ QMetalBuffer *buf = cbD->currentGraphicsPipeline->d->extraBufMgr.acquireWorkBuffer(this, sizeof(multiViewInfo),
+ QMetalGraphicsPipelineData::ExtraBufferManager::WorkBufType::HostVisible);
+ if (buf) {
+ id<MTLBuffer> mtlbuf = buf->d->buf[0];
+ char *p = reinterpret_cast<char *>([mtlbuf contents]);
+ memcpy(p, &multiViewInfo, sizeof(multiViewInfo));
+ [cbD->d->currentRenderPassEncoder setVertexBuffer: mtlbuf offset: 0 atIndex: viewMaskBufBinding];
+ // The instance count is adjusted for layered rendering. The vertex shader is expected to contain something like:
+ // uint gl_ViewIndex = spvViewMask[0] + (gl_InstanceIndex - gl_BaseInstance) % spvViewMask[1];
+ // where spvViewMask is the buffer with multiViewInfo passed in above.
+ *instanceCount *= multiViewCount;
+ }
+}
+
void QRhiMetal::draw(QRhiCommandBuffer *cb, quint32 vertexCount,
quint32 instanceCount, quint32 firstVertex, quint32 firstInstance)
{
QMetalCommandBuffer *cbD = QRHI_RES(QMetalCommandBuffer, cb);
Q_ASSERT(cbD->recordingPass == QMetalCommandBuffer::RenderPass);
- [cbD->d->currentRenderPassEncoder drawPrimitives:
- QRHI_RES(QMetalGraphicsPipeline, cbD->currentGraphicsPipeline)->d->primitiveType
- vertexStart: firstVertex vertexCount: vertexCount instanceCount: instanceCount baseInstance: firstInstance];
+ if (cbD->currentGraphicsPipeline->d->tess.enabled) {
+ TessDrawArgs a;
+ a.cbD = cbD;
+ a.type = TessDrawArgs::NonIndexed;
+ a.draw.vertexCount = vertexCount;
+ a.draw.instanceCount = instanceCount;
+ a.draw.firstVertex = firstVertex;
+ a.draw.firstInstance = firstInstance;
+ tessellatedDraw(a);
+ return;
+ }
+
+ adjustForMultiViewDraw(&instanceCount, cb);
+
+ if (caps.baseVertexAndInstance) {
+ [cbD->d->currentRenderPassEncoder drawPrimitives: cbD->currentGraphicsPipeline->d->primitiveType
+ vertexStart: firstVertex vertexCount: vertexCount instanceCount: instanceCount baseInstance: firstInstance];
+ } else {
+ [cbD->d->currentRenderPassEncoder drawPrimitives: cbD->currentGraphicsPipeline->d->primitiveType
+ vertexStart: firstVertex vertexCount: vertexCount instanceCount: instanceCount];
+ }
}
void QRhiMetal::drawIndexed(QRhiCommandBuffer *cb, quint32 indexCount,
@@ -1176,19 +2241,44 @@ void QRhiMetal::drawIndexed(QRhiCommandBuffer *cb, quint32 indexCount,
return;
const quint32 indexOffset = cbD->currentIndexOffset + firstIndex * (cbD->currentIndexFormat == QRhiCommandBuffer::IndexUInt16 ? 2 : 4);
- Q_ASSERT(indexOffset == aligned<quint32>(indexOffset, 4));
-
- QMetalBuffer *ibufD = QRHI_RES(QMetalBuffer, cbD->currentIndexBuffer);
- id<MTLBuffer> mtlbuf = ibufD->d->buf[ibufD->d->slotted ? currentFrameSlot : 0];
+ Q_ASSERT(indexOffset == aligned(indexOffset, 4u));
+
+ QMetalBuffer *ibufD = cbD->currentIndexBuffer;
+ id<MTLBuffer> mtlibuf = ibufD->d->buf[ibufD->d->slotted ? currentFrameSlot : 0];
+
+ if (cbD->currentGraphicsPipeline->d->tess.enabled) {
+ TessDrawArgs a;
+ a.cbD = cbD;
+ a.type = cbD->currentIndexFormat == QRhiCommandBuffer::IndexUInt16 ? TessDrawArgs::U16Indexed : TessDrawArgs::U32Indexed;
+ a.drawIndexed.indexCount = indexCount;
+ a.drawIndexed.instanceCount = instanceCount;
+ a.drawIndexed.firstIndex = firstIndex;
+ a.drawIndexed.vertexOffset = vertexOffset;
+ a.drawIndexed.firstInstance = firstInstance;
+ a.drawIndexed.indexBuffer = mtlibuf;
+ tessellatedDraw(a);
+ return;
+ }
- [cbD->d->currentRenderPassEncoder drawIndexedPrimitives: QRHI_RES(QMetalGraphicsPipeline, cbD->currentGraphicsPipeline)->d->primitiveType
- indexCount: indexCount
- indexType: cbD->currentIndexFormat == QRhiCommandBuffer::IndexUInt16 ? MTLIndexTypeUInt16 : MTLIndexTypeUInt32
- indexBuffer: mtlbuf
- indexBufferOffset: indexOffset
- instanceCount: instanceCount
- baseVertex: vertexOffset
- baseInstance: firstInstance];
+ adjustForMultiViewDraw(&instanceCount, cb);
+
+ if (caps.baseVertexAndInstance) {
+ [cbD->d->currentRenderPassEncoder drawIndexedPrimitives: cbD->currentGraphicsPipeline->d->primitiveType
+ indexCount: indexCount
+ indexType: cbD->currentIndexFormat == QRhiCommandBuffer::IndexUInt16 ? MTLIndexTypeUInt16 : MTLIndexTypeUInt32
+ indexBuffer: mtlibuf
+ indexBufferOffset: indexOffset
+ instanceCount: instanceCount
+ baseVertex: vertexOffset
+ baseInstance: firstInstance];
+ } else {
+ [cbD->d->currentRenderPassEncoder drawIndexedPrimitives: cbD->currentGraphicsPipeline->d->primitiveType
+ indexCount: indexCount
+ indexType: cbD->currentIndexFormat == QRhiCommandBuffer::IndexUInt16 ? MTLIndexTypeUInt16 : MTLIndexTypeUInt32
+ indexBuffer: mtlibuf
+ indexBufferOffset: indexOffset
+ instanceCount: instanceCount];
+ }
}
void QRhiMetal::debugMarkBegin(QRhiCommandBuffer *cb, const QByteArray &name)
@@ -1198,12 +2288,10 @@ void QRhiMetal::debugMarkBegin(QRhiCommandBuffer *cb, const QByteArray &name)
NSString *str = [NSString stringWithUTF8String: name.constData()];
QMetalCommandBuffer *cbD = QRHI_RES(QMetalCommandBuffer, cb);
- if (cbD->recordingPass != QMetalCommandBuffer::NoPass) {
+ if (cbD->recordingPass != QMetalCommandBuffer::NoPass)
[cbD->d->currentRenderPassEncoder pushDebugGroup: str];
- } else {
- if (@available(macOS 10.13, iOS 11.0, *))
- [cbD->d->cb pushDebugGroup: str];
- }
+ else
+ [cbD->d->cb pushDebugGroup: str];
}
void QRhiMetal::debugMarkEnd(QRhiCommandBuffer *cb)
@@ -1212,12 +2300,10 @@ void QRhiMetal::debugMarkEnd(QRhiCommandBuffer *cb)
return;
QMetalCommandBuffer *cbD = QRHI_RES(QMetalCommandBuffer, cb);
- if (cbD->recordingPass != QMetalCommandBuffer::NoPass) {
+ if (cbD->recordingPass != QMetalCommandBuffer::NoPass)
[cbD->d->currentRenderPassEncoder popDebugGroup];
- } else {
- if (@available(macOS 10.13, iOS 11.0, *))
- [cbD->d->cb popDebugGroup];
- }
+ else
+ [cbD->d->cb popDebugGroup];
}
void QRhiMetal::debugMarkMsg(QRhiCommandBuffer *cb, const QByteArray &msg)
@@ -1246,35 +2332,39 @@ void QRhiMetal::endExternal(QRhiCommandBuffer *cb)
cbD->resetPerPassCachedState();
}
+double QRhiMetal::lastCompletedGpuTime(QRhiCommandBuffer *cb)
+{
+ QMetalCommandBuffer *cbD = QRHI_RES(QMetalCommandBuffer, cb);
+ return cbD->d->lastGpuTime;
+}
+
QRhi::FrameOpResult QRhiMetal::beginFrame(QRhiSwapChain *swapChain, QRhi::BeginFrameFlags flags)
{
Q_UNUSED(flags);
QMetalSwapChain *swapChainD = QRHI_RES(QMetalSwapChain, swapChain);
+ currentSwapChain = swapChainD;
+ currentFrameSlot = swapChainD->currentFrameSlot;
- // This is a bit messed up since for this swapchain we want to wait for the
- // commands+present to complete, while for others just for the commands
- // (for this same frame slot) but not sure how to do that in a sane way so
- // wait for full cb completion for now.
- for (QMetalSwapChain *sc : qAsConst(swapchains)) {
- dispatch_semaphore_t sem = sc->d->sem[swapChainD->currentFrameSlot];
- dispatch_semaphore_wait(sem, DISPATCH_TIME_FOREVER);
+ // If we are too far ahead, block. This is also what ensures that any
+ // resource used in the previous frame for this slot is now not in use
+ // anymore by the GPU.
+ dispatch_semaphore_wait(swapChainD->d->sem[currentFrameSlot], DISPATCH_TIME_FOREVER);
+
+ // Do this also for any other swapchain's commands with the same frame slot
+ // While this reduces concurrency, it keeps resource usage safe: swapchain
+ // A starting its frame 0, followed by swapchain B starting its own frame 0
+ // will make B wait for A's frame 0 commands, so if a resource is written
+ // in B's frame or when B checks for pending resource releases, that won't
+ // mess up A's in-flight commands (as they are not in flight anymore).
+ for (QMetalSwapChain *sc : std::as_const(swapchains)) {
if (sc != swapChainD)
- dispatch_semaphore_signal(sem);
+ sc->waitUntilCompleted(currentFrameSlot); // wait+signal
}
- currentSwapChain = swapChainD;
- currentFrameSlot = swapChainD->currentFrameSlot;
- if (swapChainD->ds)
- swapChainD->ds->lastActiveFrameSlot = currentFrameSlot;
+ [d->captureScope beginScope];
- if (@available(macOS 10.13, iOS 11.0, *))
- [d->captureScope beginScope];
-
- // Do not let the command buffer mess with the refcount of objects. We do
- // have a proper render loop and will manage lifetimes similarly to other
- // backends (Vulkan).
- swapChainD->cbWrapper.d->cb = [d->cmdQueue commandBufferWithUnretainedReferences];
+ swapChainD->cbWrapper.d->cb = d->newCommandBuffer();
QMetalRenderTargetData::ColorAtt colorAtt;
if (swapChainD->samples > 1) {
@@ -1286,14 +2376,16 @@ QRhi::FrameOpResult QRhiMetal::beginFrame(QRhiSwapChain *swapChain, QRhi::BeginF
swapChainD->rtWrapper.d->fb.colorAtt[0] = colorAtt;
swapChainD->rtWrapper.d->fb.dsTex = swapChainD->ds ? swapChainD->ds->d->tex : nil;
+ swapChainD->rtWrapper.d->fb.dsResolveTex = nil;
swapChainD->rtWrapper.d->fb.hasStencil = swapChainD->ds ? true : false;
swapChainD->rtWrapper.d->fb.depthNeedsStore = false;
- QRhiProfilerPrivate *rhiP = profilerPrivateOrNull();
- QRHI_PROF_F(beginSwapChainFrame(swapChain));
+ if (swapChainD->ds)
+ swapChainD->ds->lastActiveFrameSlot = currentFrameSlot;
executeDeferredReleases();
- swapChainD->cbWrapper.resetState();
+ swapChainD->cbWrapper.resetState(swapChainD->d->lastGpuTime[currentFrameSlot]);
+ swapChainD->d->lastGpuTime[currentFrameSlot] = 0;
finishActiveReadbacks();
return QRhi::FrameOpSuccess;
@@ -1304,26 +2396,48 @@ QRhi::FrameOpResult QRhiMetal::endFrame(QRhiSwapChain *swapChain, QRhi::EndFrame
QMetalSwapChain *swapChainD = QRHI_RES(QMetalSwapChain, swapChain);
Q_ASSERT(currentSwapChain == swapChainD);
- const bool needsPresent = !flags.testFlag(QRhi::SkipPresent);
- if (needsPresent)
- [swapChainD->cbWrapper.d->cb presentDrawable: swapChainD->d->curDrawable];
-
- // Must not hold on to the drawable, regardless of needsPresent.
- // (internally it is autoreleased or something, it seems)
- swapChainD->d->curDrawable = nil;
-
__block int thisFrameSlot = currentFrameSlot;
- [swapChainD->cbWrapper.d->cb addCompletedHandler: ^(id<MTLCommandBuffer>) {
+ [swapChainD->cbWrapper.d->cb addCompletedHandler: ^(id<MTLCommandBuffer> cb) {
+ swapChainD->d->lastGpuTime[thisFrameSlot] += cb.GPUEndTime - cb.GPUStartTime;
dispatch_semaphore_signal(swapChainD->d->sem[thisFrameSlot]);
}];
+#ifdef QRHI_METAL_COMMAND_BUFFERS_WITH_UNRETAINED_REFERENCES
+ // When Metal API validation diagnostics is enabled in Xcode the texture is
+ // released before the command buffer is done with it. Manually keep it alive
+ // to work around this.
+ id<MTLTexture> drawableTexture = [swapChainD->d->curDrawable.texture retain];
+ [swapChainD->cbWrapper.d->cb addCompletedHandler:^(id<MTLCommandBuffer>) {
+ [drawableTexture release];
+ }];
+#endif
+
+ const bool needsPresent = !flags.testFlag(QRhi::SkipPresent);
+ const bool presentsWithTransaction = swapChainD->d->layer.presentsWithTransaction;
+ if (!presentsWithTransaction && needsPresent) {
+ // beginFrame-endFrame without a render pass inbetween means there is no drawable.
+ if (id<CAMetalDrawable> drawable = swapChainD->d->curDrawable)
+ [swapChainD->cbWrapper.d->cb presentDrawable: drawable];
+ }
+
[swapChainD->cbWrapper.d->cb commit];
- QRhiProfilerPrivate *rhiP = profilerPrivateOrNull();
- QRHI_PROF_F(endSwapChainFrame(swapChain, swapChainD->frameCount + 1));
+ if (presentsWithTransaction && needsPresent) {
+ // beginFrame-endFrame without a render pass inbetween means there is no drawable.
+ if (id<CAMetalDrawable> drawable = swapChainD->d->curDrawable) {
+ // The layer has presentsWithTransaction set to true to avoid flicker on resizing,
+ // so here it is important to follow what the Metal docs say when it comes to the
+ // issuing the present.
+ [swapChainD->cbWrapper.d->cb waitUntilScheduled];
+ [drawable present];
+ }
+ }
+
+ // Must not hold on to the drawable, regardless of needsPresent
+ [swapChainD->d->curDrawable release];
+ swapChainD->d->curDrawable = nil;
- if (@available(macOS 10.13, iOS 11.0, *))
- [d->captureScope endScope];
+ [d->captureScope endScope];
if (needsPresent)
swapChainD->currentFrameSlot = (swapChainD->currentFrameSlot + 1) % QMTL_FRAMES_IN_FLIGHT;
@@ -1338,23 +2452,17 @@ QRhi::FrameOpResult QRhiMetal::beginOffscreenFrame(QRhiCommandBuffer **cb, QRhi:
Q_UNUSED(flags);
currentFrameSlot = (currentFrameSlot + 1) % QMTL_FRAMES_IN_FLIGHT;
- if (swapchains.count() > 1) {
- for (QMetalSwapChain *sc : qAsConst(swapchains)) {
- // wait+signal is the general pattern to ensure the commands for a
- // given frame slot have completed (if sem is 1, we go 0 then 1; if
- // sem is 0 we go -1, block, completion increments to 0, then us to 1)
- dispatch_semaphore_t sem = sc->d->sem[currentFrameSlot];
- dispatch_semaphore_wait(sem, DISPATCH_TIME_FOREVER);
- dispatch_semaphore_signal(sem);
- }
- }
+
+ for (QMetalSwapChain *sc : std::as_const(swapchains))
+ sc->waitUntilCompleted(currentFrameSlot);
d->ofr.active = true;
*cb = &d->ofr.cbWrapper;
- d->ofr.cbWrapper.d->cb = [d->cmdQueue commandBufferWithUnretainedReferences];
+ d->ofr.cbWrapper.d->cb = d->newCommandBuffer();
executeDeferredReleases();
- d->ofr.cbWrapper.resetState();
+ d->ofr.cbWrapper.resetState(d->ofr.lastGpuTime);
+ d->ofr.lastGpuTime = 0;
finishActiveReadbacks();
return QRhi::FrameOpSuccess;
@@ -1366,10 +2474,13 @@ QRhi::FrameOpResult QRhiMetal::endOffscreenFrame(QRhi::EndFrameFlags flags)
Q_ASSERT(d->ofr.active);
d->ofr.active = false;
- [d->ofr.cbWrapper.d->cb commit];
+ id<MTLCommandBuffer> cb = d->ofr.cbWrapper.d->cb;
+ [cb commit];
// offscreen frames wait for completion, unlike swapchain ones
- [d->ofr.cbWrapper.d->cb waitUntilCompleted];
+ [cb waitUntilCompleted];
+
+ d->ofr.lastGpuTime += cb.GPUEndTime - cb.GPUStartTime;
finishActiveReadbacks(true);
@@ -1393,16 +2504,14 @@ QRhi::FrameOpResult QRhiMetal::finish()
}
}
- for (QMetalSwapChain *sc : qAsConst(swapchains)) {
+ for (QMetalSwapChain *sc : std::as_const(swapchains)) {
for (int i = 0; i < QMTL_FRAMES_IN_FLIGHT; ++i) {
if (currentSwapChain && sc == currentSwapChain && i == currentFrameSlot) {
// no wait as this is the thing we're going to be commit below and
// beginFrame decremented sem already and going to be signaled by endFrame
continue;
}
- dispatch_semaphore_t sem = sc->d->sem[i];
- dispatch_semaphore_wait(sem, DISPATCH_TIME_FOREVER);
- dispatch_semaphore_signal(sem);
+ sc->waitUntilCompleted(i);
}
}
@@ -1412,10 +2521,13 @@ QRhi::FrameOpResult QRhiMetal::finish()
}
if (inFrame) {
- if (d->ofr.active)
- d->ofr.cbWrapper.d->cb = [d->cmdQueue commandBufferWithUnretainedReferences];
- else
- swapChainD->cbWrapper.d->cb = [d->cmdQueue commandBufferWithUnretainedReferences];
+ if (d->ofr.active) {
+ d->ofr.lastGpuTime += cb.GPUEndTime - cb.GPUStartTime;
+ d->ofr.cbWrapper.d->cb = d->newCommandBuffer();
+ } else {
+ swapChainD->d->lastGpuTime[currentFrameSlot] += cb.GPUEndTime - cb.GPUStartTime;
+ swapChainD->cbWrapper.d->cb = d->newCommandBuffer();
+ }
}
executeDeferredReleases(true);
@@ -1469,6 +2581,7 @@ void QRhiMetal::enqueueSubresUpload(QMetalTexture *texD, void *mp, void *blitEnc
const QPoint dp = subresDesc.destinationTopLeft();
const QByteArray rawData = subresDesc.data();
QImage img = subresDesc.image();
+ const bool is3D = texD->m_flags.testFlag(QRhiTexture::ThreeDimensional);
id<MTLBlitCommandEncoder> blitEnc = (id<MTLBlitCommandEncoder>) blitEncPtr;
if (!img.isNull()) {
@@ -1476,7 +2589,6 @@ void QRhiMetal::enqueueSubresUpload(QMetalTexture *texD, void *mp, void *blitEnc
int w = img.width();
int h = img.height();
int bpl = img.bytesPerLine();
- int srcOffset = 0;
if (!subresDesc.sourceSize().isEmpty() || !subresDesc.sourceTopLeft().isNull()) {
const int sx = subresDesc.sourceTopLeft().x();
@@ -1485,10 +2597,12 @@ void QRhiMetal::enqueueSubresUpload(QMetalTexture *texD, void *mp, void *blitEnc
w = subresDesc.sourceSize().width();
h = subresDesc.sourceSize().height();
}
- if (img.depth() == 32) {
- memcpy(reinterpret_cast<char *>(mp) + *curOfs, img.constBits(), size_t(fullImageSizeBytes));
- srcOffset = sy * bpl + sx * 4;
- // bpl remains set to the original image's row stride
+ if (w == img.width()) {
+ const int bpc = qMax(1, img.depth() / 8);
+ Q_ASSERT(h * img.bytesPerLine() <= fullImageSizeBytes);
+ memcpy(reinterpret_cast<char *>(mp) + *curOfs,
+ img.constBits() + sy * img.bytesPerLine() + sx * bpc,
+ h * img.bytesPerLine());
} else {
img = img.copy(sx, sy, w, h);
bpl = img.bytesPerLine();
@@ -1500,14 +2614,14 @@ void QRhiMetal::enqueueSubresUpload(QMetalTexture *texD, void *mp, void *blitEnc
}
[blitEnc copyFromBuffer: texD->d->stagingBuf[currentFrameSlot]
- sourceOffset: NSUInteger(*curOfs + srcOffset)
+ sourceOffset: NSUInteger(*curOfs)
sourceBytesPerRow: NSUInteger(bpl)
sourceBytesPerImage: 0
sourceSize: MTLSizeMake(NSUInteger(w), NSUInteger(h), 1)
toTexture: texD->d->tex
- destinationSlice: NSUInteger(layer)
+ destinationSlice: NSUInteger(is3D ? 0 : layer)
destinationLevel: NSUInteger(level)
- destinationOrigin: MTLOriginMake(NSUInteger(dp.x()), NSUInteger(dp.y()), 0)
+ destinationOrigin: MTLOriginMake(NSUInteger(dp.x()), NSUInteger(dp.y()), NSUInteger(is3D ? layer : 0))
options: MTLBlitOptionNone];
*curOfs += aligned<qsizetype>(fullImageSizeBytes, QRhiMetalData::TEXBUF_ALIGN);
@@ -1543,12 +2657,12 @@ void QRhiMetal::enqueueSubresUpload(QMetalTexture *texD, void *mp, void *blitEnc
sourceBytesPerImage: 0
sourceSize: MTLSizeMake(NSUInteger(w), NSUInteger(h), 1)
toTexture: texD->d->tex
- destinationSlice: NSUInteger(layer)
+ destinationSlice: NSUInteger(is3D ? 0 : layer)
destinationLevel: NSUInteger(level)
- destinationOrigin: MTLOriginMake(NSUInteger(dx), NSUInteger(dy), 0)
+ destinationOrigin: MTLOriginMake(NSUInteger(dx), NSUInteger(dy), NSUInteger(is3D ? layer : 0))
options: MTLBlitOptionNone];
- *curOfs += aligned(rawData.size(), QRhiMetalData::TEXBUF_ALIGN);
+ *curOfs += aligned<qsizetype>(rawData.size(), QRhiMetalData::TEXBUF_ALIGN);
} else if (!rawData.isEmpty()) {
const QSize subresSize = q->sizeForMipLevel(level, texD->m_pixelSize);
const int subresw = subresSize.width();
@@ -1563,7 +2677,11 @@ void QRhiMetal::enqueueSubresUpload(QMetalTexture *texD, void *mp, void *blitEnc
}
quint32 bpl = 0;
- textureFormatInfo(texD->m_format, QSize(w, h), &bpl, nullptr);
+ if (subresDesc.dataStride())
+ bpl = subresDesc.dataStride();
+ else
+ textureFormatInfo(texD->m_format, QSize(w, h), &bpl, nullptr, nullptr);
+
memcpy(reinterpret_cast<char *>(mp) + *curOfs, rawData.constData(), size_t(rawData.size()));
[blitEnc copyFromBuffer: texD->d->stagingBuf[currentFrameSlot]
@@ -1572,12 +2690,12 @@ void QRhiMetal::enqueueSubresUpload(QMetalTexture *texD, void *mp, void *blitEnc
sourceBytesPerImage: 0
sourceSize: MTLSizeMake(NSUInteger(w), NSUInteger(h), 1)
toTexture: texD->d->tex
- destinationSlice: NSUInteger(layer)
+ destinationSlice: NSUInteger(is3D ? 0 : layer)
destinationLevel: NSUInteger(level)
- destinationOrigin: MTLOriginMake(NSUInteger(dp.x()), NSUInteger(dp.y()), 0)
+ destinationOrigin: MTLOriginMake(NSUInteger(dp.x()), NSUInteger(dp.y()), NSUInteger(is3D ? layer : 0))
options: MTLBlitOptionNone];
- *curOfs += aligned(rawData.size(), QRhiMetalData::TEXBUF_ALIGN);
+ *curOfs += aligned<qsizetype>(rawData.size(), QRhiMetalData::TEXBUF_ALIGN);
} else {
qWarning("Invalid texture upload for %p layer=%d mip=%d", texD, layer, level);
}
@@ -1587,14 +2705,26 @@ void QRhiMetal::enqueueResourceUpdates(QRhiCommandBuffer *cb, QRhiResourceUpdate
{
QMetalCommandBuffer *cbD = QRHI_RES(QMetalCommandBuffer, cb);
QRhiResourceUpdateBatchPrivate *ud = QRhiResourceUpdateBatchPrivate::get(resourceUpdates);
- QRhiProfilerPrivate *rhiP = profilerPrivateOrNull();
- for (const QRhiResourceUpdateBatchPrivate::BufferOp &u : ud->bufferOps) {
+ id<MTLBlitCommandEncoder> blitEnc = nil;
+ auto ensureBlit = [&blitEnc, cbD, this]() {
+ if (!blitEnc) {
+ blitEnc = [cbD->d->cb blitCommandEncoder];
+ if (debugMarkers)
+ [blitEnc pushDebugGroup: @"Texture upload/copy"];
+ }
+ };
+
+ for (int opIdx = 0; opIdx < ud->activeBufferOpCount; ++opIdx) {
+ const QRhiResourceUpdateBatchPrivate::BufferOp &u(ud->bufferOps[opIdx]);
if (u.type == QRhiResourceUpdateBatchPrivate::BufferOp::DynamicUpdate) {
QMetalBuffer *bufD = QRHI_RES(QMetalBuffer, u.buf);
Q_ASSERT(bufD->m_type == QRhiBuffer::Dynamic);
- for (int i = 0; i < QMTL_FRAMES_IN_FLIGHT; ++i)
- bufD->d->pendingUpdates[i].append(u);
+ for (int i = 0; i < QMTL_FRAMES_IN_FLIGHT; ++i) {
+ if (u.offset == 0 && u.data.size() == bufD->m_size)
+ bufD->d->pendingUpdates[i].clear();
+ bufD->d->pendingUpdates[i].append({ u.offset, u.data });
+ }
} else if (u.type == QRhiResourceUpdateBatchPrivate::BufferOp::StaticUpload) {
// Due to the Metal API the handling of static and dynamic buffers is
// basically the same. So go through the same pendingUpdates machinery.
@@ -1602,38 +2732,46 @@ void QRhiMetal::enqueueResourceUpdates(QRhiCommandBuffer *cb, QRhiResourceUpdate
Q_ASSERT(bufD->m_type != QRhiBuffer::Dynamic);
Q_ASSERT(u.offset + u.data.size() <= bufD->m_size);
for (int i = 0, ie = bufD->d->slotted ? QMTL_FRAMES_IN_FLIGHT : 1; i != ie; ++i)
- bufD->d->pendingUpdates[i].append(
- QRhiResourceUpdateBatchPrivate::BufferOp::dynamicUpdate(u.buf, u.offset, u.data.size(), u.data.constData()));
+ bufD->d->pendingUpdates[i].append({ u.offset, u.data });
} else if (u.type == QRhiResourceUpdateBatchPrivate::BufferOp::Read) {
QMetalBuffer *bufD = QRHI_RES(QMetalBuffer, u.buf);
executeBufferHostWritesForCurrentFrame(bufD);
const int idx = bufD->d->slotted ? currentFrameSlot : 0;
- char *p = reinterpret_cast<char *>([bufD->d->buf[idx] contents]);
- if (p) {
- u.result->data.resize(u.readSize);
- memcpy(u.result->data.data(), p + u.offset, size_t(u.readSize));
+ if (bufD->m_type == QRhiBuffer::Dynamic) {
+ char *p = reinterpret_cast<char *>([bufD->d->buf[idx] contents]);
+ if (p) {
+ u.result->data.resize(u.readSize);
+ memcpy(u.result->data.data(), p + u.offset, size_t(u.readSize));
+ }
+ if (u.result->completed)
+ u.result->completed();
+ } else {
+ QRhiMetalData::BufferReadback readback;
+ readback.activeFrameSlot = idx;
+ readback.buf = bufD->d->buf[idx];
+ readback.offset = u.offset;
+ readback.readSize = u.readSize;
+ readback.result = u.result;
+ d->activeBufferReadbacks.append(readback);
+#ifdef Q_OS_MACOS
+ if (bufD->d->managed) {
+ // On non-Apple Silicon, manually synchronize memory from GPU to CPU
+ ensureBlit();
+ [blitEnc synchronizeResource:readback.buf];
+ }
+#endif
}
- if (u.result->completed)
- u.result->completed();
}
}
- id<MTLBlitCommandEncoder> blitEnc = nil;
- auto ensureBlit = [&blitEnc, cbD, this] {
- if (!blitEnc) {
- blitEnc = [cbD->d->cb blitCommandEncoder];
- if (debugMarkers)
- [blitEnc pushDebugGroup: @"Texture upload/copy"];
- }
- };
-
- for (const QRhiResourceUpdateBatchPrivate::TextureOp &u : ud->textureOps) {
+ for (int opIdx = 0; opIdx < ud->activeTextureOpCount; ++opIdx) {
+ const QRhiResourceUpdateBatchPrivate::TextureOp &u(ud->textureOps[opIdx]);
if (u.type == QRhiResourceUpdateBatchPrivate::TextureOp::Upload) {
QMetalTexture *utexD = QRHI_RES(QMetalTexture, u.dst);
qsizetype stagingSize = 0;
- for (int layer = 0; layer < QRhi::MAX_LAYERS; ++layer) {
- for (int level = 0; level < QRhi::MAX_LEVELS; ++level) {
- for (const QRhiTextureSubresourceUploadDescription &subresDesc : qAsConst(u.subresDesc[layer][level]))
+ for (int layer = 0, maxLayer = u.subresDesc.count(); layer < maxLayer; ++layer) {
+ for (int level = 0; level < QRhi::MAX_MIP_LEVELS; ++level) {
+ for (const QRhiTextureSubresourceUploadDescription &subresDesc : std::as_const(u.subresDesc[layer][level]))
stagingSize += subresUploadByteSize(subresDesc);
}
}
@@ -1642,13 +2780,12 @@ void QRhiMetal::enqueueResourceUpdates(QRhiCommandBuffer *cb, QRhiResourceUpdate
Q_ASSERT(!utexD->d->stagingBuf[currentFrameSlot]);
utexD->d->stagingBuf[currentFrameSlot] = [d->dev newBufferWithLength: NSUInteger(stagingSize)
options: MTLResourceStorageModeShared];
- QRHI_PROF_F(newTextureStagingArea(utexD, currentFrameSlot, quint32(stagingSize)));
void *mp = [utexD->d->stagingBuf[currentFrameSlot] contents];
qsizetype curOfs = 0;
- for (int layer = 0; layer < QRhi::MAX_LAYERS; ++layer) {
- for (int level = 0; level < QRhi::MAX_LEVELS; ++level) {
- for (const QRhiTextureSubresourceUploadDescription &subresDesc : qAsConst(u.subresDesc[layer][level]))
+ for (int layer = 0, maxLayer = u.subresDesc.count(); layer < maxLayer; ++layer) {
+ for (int level = 0; level < QRhi::MAX_MIP_LEVELS; ++level) {
+ for (const QRhiTextureSubresourceUploadDescription &subresDesc : std::as_const(u.subresDesc[layer][level]))
enqueueSubresUpload(utexD, mp, blitEnc, layer, level, subresDesc, &curOfs);
}
}
@@ -1661,11 +2798,12 @@ void QRhiMetal::enqueueResourceUpdates(QRhiCommandBuffer *cb, QRhiResourceUpdate
e.stagingBuffer.buffer = utexD->d->stagingBuf[currentFrameSlot];
utexD->d->stagingBuf[currentFrameSlot] = nil;
d->releaseQueue.append(e);
- QRHI_PROF_F(releaseTextureStagingArea(utexD, currentFrameSlot));
} else if (u.type == QRhiResourceUpdateBatchPrivate::TextureOp::Copy) {
Q_ASSERT(u.src && u.dst);
QMetalTexture *srcD = QRHI_RES(QMetalTexture, u.src);
QMetalTexture *dstD = QRHI_RES(QMetalTexture, u.dst);
+ const bool srcIs3D = srcD->m_flags.testFlag(QRhiTexture::ThreeDimensional);
+ const bool dstIs3D = dstD->m_flags.testFlag(QRhiTexture::ThreeDimensional);
const QPoint dp = u.desc.destinationTopLeft();
const QSize mipSize = q->sizeForMipLevel(u.desc.sourceLevel(), srcD->m_pixelSize);
const QSize copySize = u.desc.pixelSize().isEmpty() ? mipSize : u.desc.pixelSize();
@@ -1673,14 +2811,14 @@ void QRhiMetal::enqueueResourceUpdates(QRhiCommandBuffer *cb, QRhiResourceUpdate
ensureBlit();
[blitEnc copyFromTexture: srcD->d->tex
- sourceSlice: NSUInteger(u.desc.sourceLayer())
+ sourceSlice: NSUInteger(srcIs3D ? 0 : u.desc.sourceLayer())
sourceLevel: NSUInteger(u.desc.sourceLevel())
- sourceOrigin: MTLOriginMake(NSUInteger(sp.x()), NSUInteger(sp.y()), 0)
+ sourceOrigin: MTLOriginMake(NSUInteger(sp.x()), NSUInteger(sp.y()), NSUInteger(srcIs3D ? u.desc.sourceLayer() : 0))
sourceSize: MTLSizeMake(NSUInteger(copySize.width()), NSUInteger(copySize.height()), 1)
toTexture: dstD->d->tex
- destinationSlice: NSUInteger(u.desc.destinationLayer())
+ destinationSlice: NSUInteger(dstIs3D ? 0 : u.desc.destinationLayer())
destinationLevel: NSUInteger(u.desc.destinationLevel())
- destinationOrigin: MTLOriginMake(NSUInteger(dp.x()), NSUInteger(dp.y()), 0)];
+ destinationOrigin: MTLOriginMake(NSUInteger(dp.x()), NSUInteger(dp.y()), NSUInteger(dstIs3D ? u.desc.destinationLayer() : 0))];
srcD->lastActiveFrameSlot = dstD->lastActiveFrameSlot = currentFrameSlot;
} else if (u.type == QRhiResourceUpdateBatchPrivate::TextureOp::Read) {
@@ -1693,11 +2831,13 @@ void QRhiMetal::enqueueResourceUpdates(QRhiCommandBuffer *cb, QRhiResourceUpdate
QMetalSwapChain *swapChainD = nullptr;
id<MTLTexture> src;
QSize srcSize;
+ bool is3D = false;
if (texD) {
if (texD->samples > 1) {
qWarning("Multisample texture cannot be read back");
continue;
}
+ is3D = texD->m_flags.testFlag(QRhiTexture::ThreeDimensional);
readback.pixelSize = q->sizeForMipLevel(u.rb.level(), texD->m_pixelSize);
readback.format = texD->m_format;
src = texD->d->tex;
@@ -1716,18 +2856,14 @@ void QRhiMetal::enqueueResourceUpdates(QRhiCommandBuffer *cb, QRhiResourceUpdate
}
quint32 bpl = 0;
- textureFormatInfo(readback.format, readback.pixelSize, &bpl, &readback.bufSize);
+ textureFormatInfo(readback.format, readback.pixelSize, &bpl, &readback.bufSize, nullptr);
readback.buf = [d->dev newBufferWithLength: readback.bufSize options: MTLResourceStorageModeShared];
- QRHI_PROF_F(newReadbackBuffer(qint64(qintptr(readback.buf)),
- texD ? static_cast<QRhiResource *>(texD) : static_cast<QRhiResource *>(swapChainD),
- readback.bufSize));
-
ensureBlit();
[blitEnc copyFromTexture: src
- sourceSlice: NSUInteger(u.rb.layer())
+ sourceSlice: NSUInteger(is3D ? 0 : u.rb.layer())
sourceLevel: NSUInteger(u.rb.level())
- sourceOrigin: MTLOriginMake(0, 0, 0)
+ sourceOrigin: MTLOriginMake(0, 0, is3D ? u.rb.layer() : 0)
sourceSize: MTLSizeMake(NSUInteger(srcSize.width()), NSUInteger(srcSize.height()), 1)
toBuffer: readback.buf
destinationOffset: 0
@@ -1754,29 +2890,32 @@ void QRhiMetal::enqueueResourceUpdates(QRhiCommandBuffer *cb, QRhiResourceUpdate
}
// this handles all types of buffers, not just Dynamic
-void QRhiMetal::executeBufferHostWritesForCurrentFrame(QMetalBuffer *bufD)
+void QRhiMetal::executeBufferHostWritesForSlot(QMetalBuffer *bufD, int slot)
{
- const int idx = bufD->d->slotted ? currentFrameSlot : 0;
- if (bufD->d->pendingUpdates[idx].isEmpty())
+ if (bufD->d->pendingUpdates[slot].isEmpty())
return;
- void *p = [bufD->d->buf[idx] contents];
- int changeBegin = -1;
- int changeEnd = -1;
- for (const QRhiResourceUpdateBatchPrivate::BufferOp &u : qAsConst(bufD->d->pendingUpdates[idx])) {
- Q_ASSERT(bufD == QRHI_RES(QMetalBuffer, u.buf));
+ void *p = [bufD->d->buf[slot] contents];
+ quint32 changeBegin = UINT32_MAX;
+ quint32 changeEnd = 0;
+ for (const QMetalBufferData::BufferUpdate &u : std::as_const(bufD->d->pendingUpdates[slot])) {
memcpy(static_cast<char *>(p) + u.offset, u.data.constData(), size_t(u.data.size()));
- if (changeBegin == -1 || u.offset < changeBegin)
+ if (u.offset < changeBegin)
changeBegin = u.offset;
- if (changeEnd == -1 || u.offset + u.data.size() > changeEnd)
+ if (u.offset + u.data.size() > changeEnd)
changeEnd = u.offset + u.data.size();
}
#ifdef Q_OS_MACOS
- if (changeBegin >= 0 && bufD->d->managed)
- [bufD->d->buf[idx] didModifyRange: NSMakeRange(NSUInteger(changeBegin), NSUInteger(changeEnd - changeBegin))];
+ if (changeBegin < UINT32_MAX && changeBegin < changeEnd && bufD->d->managed)
+ [bufD->d->buf[slot] didModifyRange: NSMakeRange(NSUInteger(changeBegin), NSUInteger(changeEnd - changeBegin))];
#endif
- bufD->d->pendingUpdates[idx].clear();
+ bufD->d->pendingUpdates[slot].clear();
+}
+
+void QRhiMetal::executeBufferHostWritesForCurrentFrame(QMetalBuffer *bufD)
+{
+ executeBufferHostWritesForSlot(bufD, bufD->d->slotted ? currentFrameSlot : 0);
}
void QRhiMetal::resourceUpdate(QRhiCommandBuffer *cb, QRhiResourceUpdateBatch *resourceUpdates)
@@ -1790,7 +2929,8 @@ void QRhiMetal::beginPass(QRhiCommandBuffer *cb,
QRhiRenderTarget *rt,
const QColor &colorClearValue,
const QRhiDepthStencilClearValue &depthStencilClearValue,
- QRhiResourceUpdateBatch *resourceUpdates)
+ QRhiResourceUpdateBatch *resourceUpdates,
+ QRhiCommandBuffer::BeginPassFlags)
{
QMetalCommandBuffer *cbD = QRHI_RES(QMetalCommandBuffer, cb);
Q_ASSERT(cbD->recordingPass == QMetalCommandBuffer::NoPass);
@@ -1800,8 +2940,8 @@ void QRhiMetal::beginPass(QRhiCommandBuffer *cb,
QMetalRenderTargetData *rtD = nullptr;
switch (rt->resourceType()) {
- case QRhiResource::RenderTarget:
- rtD = QRHI_RES(QMetalReferenceRenderTarget, rt)->d;
+ case QRhiResource::SwapChainRenderTarget:
+ rtD = QRHI_RES(QMetalSwapChainRenderTarget, rt)->d;
cbD->d->currentPassRpDesc = d->createDefaultRenderPass(rtD->dsAttCount, colorClearValue, depthStencilClearValue, rtD->colorAttCount);
if (rtD->colorAttCount) {
QMetalRenderTargetData::ColorAtt &color0(rtD->fb.colorAtt[0]);
@@ -1809,10 +2949,8 @@ void QRhiMetal::beginPass(QRhiCommandBuffer *cb,
Q_ASSERT(currentSwapChain);
QMetalSwapChain *swapChainD = QRHI_RES(QMetalSwapChain, currentSwapChain);
if (!swapChainD->d->curDrawable) {
-#ifdef TARGET_IPHONE_SIMULATOR
- if (@available(ios 13.0, *))
-#endif
- swapChainD->d->curDrawable = [swapChainD->d->layer nextDrawable];
+ QMacAutoReleasePool pool;
+ swapChainD->d->curDrawable = [[swapChainD->d->layer nextDrawable] retain];
}
if (!swapChainD->d->curDrawable) {
qWarning("No drawable");
@@ -1833,29 +2971,42 @@ void QRhiMetal::beginPass(QRhiCommandBuffer *cb,
{
QMetalTextureRenderTarget *rtTex = QRHI_RES(QMetalTextureRenderTarget, rt);
rtD = rtTex->d;
+ if (!QRhiRenderTargetAttachmentTracker::isUpToDate<QMetalTexture, QMetalRenderBuffer>(rtTex->description(), rtD->currentResIdList))
+ rtTex->create();
cbD->d->currentPassRpDesc = d->createDefaultRenderPass(rtD->dsAttCount, colorClearValue, depthStencilClearValue, rtD->colorAttCount);
- if (rtTex->m_flags.testFlag(QRhiTextureRenderTarget::PreserveColorContents)) {
+ if (rtD->fb.preserveColor) {
for (uint i = 0; i < uint(rtD->colorAttCount); ++i)
cbD->d->currentPassRpDesc.colorAttachments[i].loadAction = MTLLoadActionLoad;
}
- if (rtD->dsAttCount && rtTex->m_flags.testFlag(QRhiTextureRenderTarget::PreserveDepthStencilContents)) {
+ if (rtD->dsAttCount && rtD->fb.preserveDs) {
cbD->d->currentPassRpDesc.depthAttachment.loadAction = MTLLoadActionLoad;
cbD->d->currentPassRpDesc.stencilAttachment.loadAction = MTLLoadActionLoad;
}
+ int colorAttCount = 0;
for (auto it = rtTex->m_desc.cbeginColorAttachments(), itEnd = rtTex->m_desc.cendColorAttachments();
it != itEnd; ++it)
{
- if (it->texture())
+ colorAttCount += 1;
+ if (it->texture()) {
QRHI_RES(QMetalTexture, it->texture())->lastActiveFrameSlot = currentFrameSlot;
- else if (it->renderBuffer())
+ if (it->multiViewCount() >= 2)
+ cbD->d->currentPassRpDesc.renderTargetArrayLength = NSUInteger(it->multiViewCount());
+ } else if (it->renderBuffer()) {
QRHI_RES(QMetalRenderBuffer, it->renderBuffer())->lastActiveFrameSlot = currentFrameSlot;
+ }
if (it->resolveTexture())
QRHI_RES(QMetalTexture, it->resolveTexture())->lastActiveFrameSlot = currentFrameSlot;
}
if (rtTex->m_desc.depthStencilBuffer())
QRHI_RES(QMetalRenderBuffer, rtTex->m_desc.depthStencilBuffer())->lastActiveFrameSlot = currentFrameSlot;
- if (rtTex->m_desc.depthTexture())
- QRHI_RES(QMetalTexture, rtTex->m_desc.depthTexture())->lastActiveFrameSlot = currentFrameSlot;
+ if (rtTex->m_desc.depthTexture()) {
+ QMetalTexture *depthTexture = QRHI_RES(QMetalTexture, rtTex->m_desc.depthTexture());
+ depthTexture->lastActiveFrameSlot = currentFrameSlot;
+ if (colorAttCount == 0 && depthTexture->arraySize() >= 2)
+ cbD->d->currentPassRpDesc.renderTargetArrayLength = NSUInteger(depthTexture->arraySize());
+ }
+ if (rtTex->m_desc.depthResolveTexture())
+ QRHI_RES(QMetalTexture, rtTex->m_desc.depthResolveTexture())->lastActiveFrameSlot = currentFrameSlot;
}
break;
default:
@@ -1865,10 +3016,12 @@ void QRhiMetal::beginPass(QRhiCommandBuffer *cb,
for (uint i = 0; i < uint(rtD->colorAttCount); ++i) {
cbD->d->currentPassRpDesc.colorAttachments[i].texture = rtD->fb.colorAtt[i].tex;
- cbD->d->currentPassRpDesc.colorAttachments[i].slice = NSUInteger(rtD->fb.colorAtt[i].layer);
+ cbD->d->currentPassRpDesc.colorAttachments[i].slice = NSUInteger(rtD->fb.colorAtt[i].arrayLayer);
+ cbD->d->currentPassRpDesc.colorAttachments[i].depthPlane = NSUInteger(rtD->fb.colorAtt[i].slice);
cbD->d->currentPassRpDesc.colorAttachments[i].level = NSUInteger(rtD->fb.colorAtt[i].level);
if (rtD->fb.colorAtt[i].resolveTex) {
- cbD->d->currentPassRpDesc.colorAttachments[i].storeAction = MTLStoreActionMultisampleResolve;
+ cbD->d->currentPassRpDesc.colorAttachments[i].storeAction = rtD->fb.preserveColor ? MTLStoreActionStoreAndMultisampleResolve
+ : MTLStoreActionMultisampleResolve;
cbD->d->currentPassRpDesc.colorAttachments[i].resolveTexture = rtD->fb.colorAtt[i].resolveTex;
cbD->d->currentPassRpDesc.colorAttachments[i].resolveSlice = NSUInteger(rtD->fb.colorAtt[i].resolveLayer);
cbD->d->currentPassRpDesc.colorAttachments[i].resolveLevel = NSUInteger(rtD->fb.colorAtt[i].resolveLevel);
@@ -1881,6 +3034,15 @@ void QRhiMetal::beginPass(QRhiCommandBuffer *cb,
cbD->d->currentPassRpDesc.stencilAttachment.texture = rtD->fb.hasStencil ? rtD->fb.dsTex : nil;
if (rtD->fb.depthNeedsStore) // Depth/Stencil is set to DontCare by default, override if needed
cbD->d->currentPassRpDesc.depthAttachment.storeAction = MTLStoreActionStore;
+ if (rtD->fb.dsResolveTex) {
+ cbD->d->currentPassRpDesc.depthAttachment.storeAction = rtD->fb.depthNeedsStore ? MTLStoreActionStoreAndMultisampleResolve
+ : MTLStoreActionMultisampleResolve;
+ cbD->d->currentPassRpDesc.depthAttachment.resolveTexture = rtD->fb.dsResolveTex;
+ if (rtD->fb.hasStencil) {
+ cbD->d->currentPassRpDesc.stencilAttachment.resolveTexture = rtD->fb.dsResolveTex;
+ cbD->d->currentPassRpDesc.stencilAttachment.storeAction = cbD->d->currentPassRpDesc.depthAttachment.storeAction;
+ }
+ }
}
cbD->d->currentRenderPassEncoder = [cbD->d->cb renderCommandEncoderWithDescriptor: cbD->d->currentPassRpDesc];
@@ -1905,7 +3067,9 @@ void QRhiMetal::endPass(QRhiCommandBuffer *cb, QRhiResourceUpdateBatch *resource
enqueueResourceUpdates(cb, resourceUpdates);
}
-void QRhiMetal::beginComputePass(QRhiCommandBuffer *cb, QRhiResourceUpdateBatch *resourceUpdates)
+void QRhiMetal::beginComputePass(QRhiCommandBuffer *cb,
+ QRhiResourceUpdateBatch *resourceUpdates,
+ QRhiCommandBuffer::BeginPassFlags)
{
QMetalCommandBuffer *cbD = QRHI_RES(QMetalCommandBuffer, cb);
Q_ASSERT(cbD->recordingPass == QMetalCommandBuffer::NoPass);
@@ -1936,9 +3100,9 @@ void QRhiMetal::setComputePipeline(QRhiCommandBuffer *cb, QRhiComputePipeline *p
Q_ASSERT(cbD->recordingPass == QMetalCommandBuffer::ComputePass);
QMetalComputePipeline *psD = QRHI_RES(QMetalComputePipeline, ps);
- if (cbD->currentComputePipeline != ps || cbD->currentPipelineGeneration != psD->generation) {
+ if (cbD->currentComputePipeline != psD || cbD->currentPipelineGeneration != psD->generation) {
cbD->currentGraphicsPipeline = nullptr;
- cbD->currentComputePipeline = ps;
+ cbD->currentComputePipeline = psD;
cbD->currentPipelineGeneration = psD->generation;
[cbD->d->currentComputePassEncoder setComputePipelineState: psD->d->ps];
@@ -1973,7 +3137,7 @@ static void qrhimtl_releaseTexture(const QRhiMetalData::DeferredReleaseEntry &e)
[e.texture.texture release];
for (int i = 0; i < QMTL_FRAMES_IN_FLIGHT; ++i)
[e.texture.stagingBuffers[i] release];
- for (int i = 0; i < QRhi::MAX_LEVELS; ++i)
+ for (int i = 0; i < QRhi::MAX_MIP_LEVELS; ++i)
[e.texture.views[i] release];
}
@@ -2003,6 +3167,17 @@ void QRhiMetal::executeDeferredReleases(bool forced)
case QRhiMetalData::DeferredReleaseEntry::StagingBuffer:
[e.stagingBuffer.buffer release];
break;
+ case QRhiMetalData::DeferredReleaseEntry::GraphicsPipeline:
+ [e.graphicsPipeline.pipelineState release];
+ [e.graphicsPipeline.depthStencilState release];
+ [e.graphicsPipeline.tessVertexComputeState[0] release];
+ [e.graphicsPipeline.tessVertexComputeState[1] release];
+ [e.graphicsPipeline.tessVertexComputeState[2] release];
+ [e.graphicsPipeline.tessTessControlComputeState release];
+ break;
+ case QRhiMetalData::DeferredReleaseEntry::ComputePipeline:
+ [e.computePipeline.pipelineState release];
+ break;
default:
break;
}
@@ -2014,7 +3189,6 @@ void QRhiMetal::executeDeferredReleases(bool forced)
void QRhiMetal::finishActiveReadbacks(bool forced)
{
QVarLengthArray<std::function<void()>, 4> completedCallbacks;
- QRhiProfilerPrivate *rhiP = profilerPrivateOrNull();
for (int i = d->activeTextureReadbacks.count() - 1; i >= 0; --i) {
const QRhiMetalData::TextureReadback &readback(d->activeTextureReadbacks[i]);
@@ -2026,12 +3200,26 @@ void QRhiMetal::finishActiveReadbacks(bool forced)
memcpy(readback.result->data.data(), p, readback.bufSize);
[readback.buf release];
- QRHI_PROF_F(releaseReadbackBuffer(qint64(qintptr(readback.buf))));
+ if (readback.result->completed)
+ completedCallbacks.append(readback.result->completed);
+
+ d->activeTextureReadbacks.remove(i);
+ }
+ }
+
+ for (int i = d->activeBufferReadbacks.count() - 1; i >= 0; --i) {
+ const QRhiMetalData::BufferReadback &readback(d->activeBufferReadbacks[i]);
+ if (forced || currentFrameSlot == readback.activeFrameSlot
+ || readback.activeFrameSlot < 0) {
+ readback.result->data.resize(readback.readSize);
+ char *p = reinterpret_cast<char *>([readback.buf contents]);
+ Q_ASSERT(p);
+ memcpy(readback.result->data.data(), p + readback.offset, size_t(readback.readSize));
if (readback.result->completed)
completedCallbacks.append(readback.result->completed);
- d->activeTextureReadbacks.removeAt(i);
+ d->activeBufferReadbacks.remove(i);
}
}
@@ -2039,7 +3227,7 @@ void QRhiMetal::finishActiveReadbacks(bool forced)
f();
}
-QMetalBuffer::QMetalBuffer(QRhiImplementation *rhi, Type type, UsageFlags usage, int size)
+QMetalBuffer::QMetalBuffer(QRhiImplementation *rhi, Type type, UsageFlags usage, quint32 size)
: QRhiBuffer(rhi, type, usage, size),
d(new QMetalBufferData)
{
@@ -2049,11 +3237,11 @@ QMetalBuffer::QMetalBuffer(QRhiImplementation *rhi, Type type, UsageFlags usage,
QMetalBuffer::~QMetalBuffer()
{
- release();
+ destroy();
delete d;
}
-void QMetalBuffer::release()
+void QMetalBuffer::destroy()
{
if (!d->buf[0])
return;
@@ -2069,29 +3257,31 @@ void QMetalBuffer::release()
}
QRHI_RES_RHI(QRhiMetal);
- rhiD->d->releaseQueue.append(e);
- QRHI_PROF;
- QRHI_PROF_F(releaseBuffer(this));
- rhiD->unregisterResource(this);
+ if (rhiD) {
+ rhiD->d->releaseQueue.append(e);
+ rhiD->unregisterResource(this);
+ }
}
-bool QMetalBuffer::build()
+bool QMetalBuffer::create()
{
if (d->buf[0])
- release();
+ destroy();
if (m_usage.testFlag(QRhiBuffer::StorageBuffer) && m_type == Dynamic) {
qWarning("StorageBuffer cannot be combined with Dynamic");
return false;
}
- const uint nonZeroSize = m_size <= 0 ? 256 : uint(m_size);
- const uint roundedSize = m_usage.testFlag(QRhiBuffer::UniformBuffer) ? aligned<uint>(nonZeroSize, 256) : nonZeroSize;
+ const quint32 nonZeroSize = m_size <= 0 ? 256 : m_size;
+ const quint32 roundedSize = m_usage.testFlag(QRhiBuffer::UniformBuffer) ? aligned(nonZeroSize, 256u) : nonZeroSize;
d->managed = false;
MTLResourceOptions opts = MTLResourceStorageModeShared;
+
+ QRHI_RES_RHI(QRhiMetal);
#ifdef Q_OS_MACOS
- if (m_type != Dynamic) {
+ if (!rhiD->caps.isAppleGPU && m_type != Dynamic) {
opts = MTLResourceStorageModeManaged;
d->managed = true;
}
@@ -2102,8 +3292,10 @@ bool QMetalBuffer::build()
// Static maps to on macOS) is not safe when another frame reading from the
// same buffer is still in flight.
d->slotted = !m_usage.testFlag(QRhiBuffer::StorageBuffer); // except for SSBOs written in the shader
+ // and a special case for internal work buffers
+ if (int(m_usage) == WorkBufPoolUsage)
+ d->slotted = false;
- QRHI_RES_RHI(QRhiMetal);
for (int i = 0; i < QMTL_FRAMES_IN_FLIGHT; ++i) {
if (i == 0 || d->slotted) {
d->buf[i] = [rhiD->d->dev newBufferWithLength: roundedSize options: opts];
@@ -2118,161 +3310,60 @@ bool QMetalBuffer::build()
}
}
- QRHI_PROF;
- QRHI_PROF_F(newBuffer(this, roundedSize, d->slotted ? QMTL_FRAMES_IN_FLIGHT : 1, 0));
-
lastActiveFrameSlot = -1;
generation += 1;
rhiD->registerResource(this);
return true;
}
-QMetalRenderBuffer::QMetalRenderBuffer(QRhiImplementation *rhi, Type type, const QSize &pixelSize,
- int sampleCount, QRhiRenderBuffer::Flags flags)
- : QRhiRenderBuffer(rhi, type, pixelSize, sampleCount, flags),
- d(new QMetalRenderBufferData)
-{
-}
-
-QMetalRenderBuffer::~QMetalRenderBuffer()
+QRhiBuffer::NativeBuffer QMetalBuffer::nativeBuffer()
{
- release();
- delete d;
+ if (d->slotted) {
+ NativeBuffer b;
+ Q_ASSERT(sizeof(b.objects) / sizeof(b.objects[0]) >= size_t(QMTL_FRAMES_IN_FLIGHT));
+ for (int i = 0; i < QMTL_FRAMES_IN_FLIGHT; ++i) {
+ QRHI_RES_RHI(QRhiMetal);
+ rhiD->executeBufferHostWritesForSlot(this, i);
+ b.objects[i] = &d->buf[i];
+ }
+ b.slotCount = QMTL_FRAMES_IN_FLIGHT;
+ return b;
+ }
+ return { { &d->buf[0] }, 1 };
}
-void QMetalRenderBuffer::release()
+char *QMetalBuffer::beginFullDynamicBufferUpdateForCurrentFrame()
{
- if (!d->tex)
- return;
-
- QRhiMetalData::DeferredReleaseEntry e;
- e.type = QRhiMetalData::DeferredReleaseEntry::RenderBuffer;
- e.lastActiveFrameSlot = lastActiveFrameSlot;
-
- e.renderbuffer.texture = d->tex;
- d->tex = nil;
-
+ // Shortcut the entire buffer update mechanism and allow the client to do
+ // the host writes directly to the buffer. This will lead to unexpected
+ // results when combined with QRhiResourceUpdateBatch-based updates for the
+ // buffer, but provides a fast path for dynamic buffers that have all their
+ // content changed in every frame.
+ Q_ASSERT(m_type == Dynamic);
QRHI_RES_RHI(QRhiMetal);
- rhiD->d->releaseQueue.append(e);
- QRHI_PROF;
- QRHI_PROF_F(releaseRenderBuffer(this));
- rhiD->unregisterResource(this);
+ Q_ASSERT(rhiD->inFrame);
+ const int slot = rhiD->currentFrameSlot;
+ void *p = [d->buf[slot] contents];
+ return static_cast<char *>(p);
}
-bool QMetalRenderBuffer::build()
+void QMetalBuffer::endFullDynamicBufferUpdateForCurrentFrame()
{
- if (d->tex)
- release();
-
- if (m_pixelSize.isEmpty())
- return false;
-
- QRHI_RES_RHI(QRhiMetal);
- samples = rhiD->effectiveSampleCount(m_sampleCount);
-
- MTLTextureDescriptor *desc = [[MTLTextureDescriptor alloc] init];
- desc.textureType = samples > 1 ? MTLTextureType2DMultisample : MTLTextureType2D;
- desc.width = NSUInteger(m_pixelSize.width());
- desc.height = NSUInteger(m_pixelSize.height());
- if (samples > 1)
- desc.sampleCount = NSUInteger(samples);
- desc.resourceOptions = MTLResourceStorageModePrivate;
- desc.usage = MTLTextureUsageRenderTarget;
-
- bool transientBacking = false;
- switch (m_type) {
- case DepthStencil:
#ifdef Q_OS_MACOS
- desc.storageMode = MTLStorageModePrivate;
- d->format = rhiD->d->dev.depth24Stencil8PixelFormatSupported
- ? MTLPixelFormatDepth24Unorm_Stencil8 : MTLPixelFormatDepth32Float_Stencil8;
-#else
- desc.storageMode = MTLStorageModeMemoryless;
- transientBacking = true;
- d->format = MTLPixelFormatDepth32Float_Stencil8;
-#endif
- desc.pixelFormat = d->format;
- break;
- case Color:
- desc.storageMode = MTLStorageModePrivate;
- d->format = MTLPixelFormatRGBA8Unorm;
- desc.pixelFormat = d->format;
- break;
- default:
- Q_UNREACHABLE();
- break;
+ if (d->managed) {
+ QRHI_RES_RHI(QRhiMetal);
+ const int slot = rhiD->currentFrameSlot;
+ [d->buf[slot] didModifyRange: NSMakeRange(0, NSUInteger(m_size))];
}
-
- d->tex = [rhiD->d->dev newTextureWithDescriptor: desc];
- [desc release];
-
- if (!m_objectName.isEmpty())
- d->tex.label = [NSString stringWithUTF8String: m_objectName.constData()];
-
- QRHI_PROF;
- QRHI_PROF_F(newRenderBuffer(this, transientBacking, false, samples));
-
- lastActiveFrameSlot = -1;
- generation += 1;
- rhiD->registerResource(this);
- return true;
-}
-
-QRhiTexture::Format QMetalRenderBuffer::backingFormat() const
-{
- return m_type == Color ? QRhiTexture::RGBA8 : QRhiTexture::UnknownFormat;
-}
-
-QMetalTexture::QMetalTexture(QRhiImplementation *rhi, Format format, const QSize &pixelSize,
- int sampleCount, Flags flags)
- : QRhiTexture(rhi, format, pixelSize, sampleCount, flags),
- d(new QMetalTextureData(this))
-{
- for (int i = 0; i < QMTL_FRAMES_IN_FLIGHT; ++i)
- d->stagingBuf[i] = nil;
-
- for (int i = 0; i < QRhi::MAX_LEVELS; ++i)
- d->perLevelViews[i] = nil;
-}
-
-QMetalTexture::~QMetalTexture()
-{
- release();
- delete d;
+#endif
}
-void QMetalTexture::release()
+static inline MTLPixelFormat toMetalTextureFormat(QRhiTexture::Format format, QRhiTexture::Flags flags, const QRhiMetal *d)
{
- if (!d->tex)
- return;
-
- QRhiMetalData::DeferredReleaseEntry e;
- e.type = QRhiMetalData::DeferredReleaseEntry::Texture;
- e.lastActiveFrameSlot = lastActiveFrameSlot;
-
- e.texture.texture = d->owns ? d->tex : nil;
- d->tex = nil;
- nativeHandlesStruct.texture = nullptr;
-
- for (int i = 0; i < QMTL_FRAMES_IN_FLIGHT; ++i) {
- e.texture.stagingBuffers[i] = d->stagingBuf[i];
- d->stagingBuf[i] = nil;
- }
-
- for (int i = 0; i < QRhi::MAX_LEVELS; ++i) {
- e.texture.views[i] = d->perLevelViews[i];
- d->perLevelViews[i] = nil;
- }
-
- QRHI_RES_RHI(QRhiMetal);
- rhiD->d->releaseQueue.append(e);
- QRHI_PROF;
- QRHI_PROF_F(releaseTexture(this));
- rhiD->unregisterResource(this);
-}
+#ifndef Q_OS_MACOS
+ Q_UNUSED(d);
+#endif
-static inline MTLPixelFormat toMetalTextureFormat(QRhiTexture::Format format, QRhiTexture::Flags flags)
-{
const bool srgb = flags.testFlag(QRhiTexture::sRGB);
switch (format) {
case QRhiTexture::RGBA8:
@@ -2285,8 +3376,16 @@ static inline MTLPixelFormat toMetalTextureFormat(QRhiTexture::Format format, QR
#else
return srgb ? MTLPixelFormatR8Unorm_sRGB : MTLPixelFormatR8Unorm;
#endif
+ case QRhiTexture::RG8:
+#ifdef Q_OS_MACOS
+ return MTLPixelFormatRG8Unorm;
+#else
+ return srgb ? MTLPixelFormatRG8Unorm_sRGB : MTLPixelFormatRG8Unorm;
+#endif
case QRhiTexture::R16:
return MTLPixelFormatR16Unorm;
+ case QRhiTexture::RG16:
+ return MTLPixelFormatRG16Unorm;
case QRhiTexture::RED_OR_ALPHA8:
return MTLPixelFormatR8Unorm;
@@ -2294,12 +3393,28 @@ static inline MTLPixelFormat toMetalTextureFormat(QRhiTexture::Format format, QR
return MTLPixelFormatRGBA16Float;
case QRhiTexture::RGBA32F:
return MTLPixelFormatRGBA32Float;
+ case QRhiTexture::R16F:
+ return MTLPixelFormatR16Float;
+ case QRhiTexture::R32F:
+ return MTLPixelFormatR32Float;
+
+ case QRhiTexture::RGB10A2:
+ return MTLPixelFormatRGB10A2Unorm;
- case QRhiTexture::D16:
#ifdef Q_OS_MACOS
+ case QRhiTexture::D16:
return MTLPixelFormatDepth16Unorm;
+ case QRhiTexture::D24:
+ return [d->d->dev isDepth24Stencil8PixelFormatSupported] ? MTLPixelFormatDepth24Unorm_Stencil8 : MTLPixelFormatDepth32Float;
+ case QRhiTexture::D24S8:
+ return [d->d->dev isDepth24Stencil8PixelFormatSupported] ? MTLPixelFormatDepth24Unorm_Stencil8 : MTLPixelFormatDepth32Float_Stencil8;
#else
+ case QRhiTexture::D16:
+ return MTLPixelFormatDepth32Float;
+ case QRhiTexture::D24:
return MTLPixelFormatDepth32Float;
+ case QRhiTexture::D24S8:
+ return MTLPixelFormatDepth32Float_Stencil8;
#endif
case QRhiTexture::D32F:
return MTLPixelFormatDepth32Float;
@@ -2315,7 +3430,7 @@ static inline MTLPixelFormat toMetalTextureFormat(QRhiTexture::Format format, QR
return MTLPixelFormatBC4_RUnorm;
case QRhiTexture::BC5:
qWarning("QRhiMetal does not support BC5");
- return MTLPixelFormatRGBA8Unorm;
+ return MTLPixelFormatInvalid;
case QRhiTexture::BC6H:
return MTLPixelFormatBC6H_RGBUfloat;
case QRhiTexture::BC7:
@@ -2329,7 +3444,7 @@ static inline MTLPixelFormat toMetalTextureFormat(QRhiTexture::Format format, QR
case QRhiTexture::BC6H:
case QRhiTexture::BC7:
qWarning("QRhiMetal: BCx compression not supported on this platform");
- return MTLPixelFormatRGBA8Unorm;
+ return MTLPixelFormatInvalid;
#endif
#ifndef Q_OS_MACOS
@@ -2370,46 +3485,302 @@ static inline MTLPixelFormat toMetalTextureFormat(QRhiTexture::Format format, QR
return srgb ? MTLPixelFormatASTC_12x12_sRGB : MTLPixelFormatASTC_12x12_LDR;
#else
case QRhiTexture::ETC2_RGB8:
+ if (d->caps.isAppleGPU) {
+ if (@available(macOS 11.0, *))
+ return srgb ? MTLPixelFormatETC2_RGB8_sRGB : MTLPixelFormatETC2_RGB8;
+ }
+ qWarning("QRhiMetal: ETC2 compression not supported on this platform");
+ return MTLPixelFormatInvalid;
case QRhiTexture::ETC2_RGB8A1:
+ if (d->caps.isAppleGPU) {
+ if (@available(macOS 11.0, *))
+ return srgb ? MTLPixelFormatETC2_RGB8A1_sRGB : MTLPixelFormatETC2_RGB8A1;
+ }
+ qWarning("QRhiMetal: ETC2 compression not supported on this platform");
+ return MTLPixelFormatInvalid;
case QRhiTexture::ETC2_RGBA8:
+ if (d->caps.isAppleGPU) {
+ if (@available(macOS 11.0, *))
+ return srgb ? MTLPixelFormatEAC_RGBA8_sRGB : MTLPixelFormatEAC_RGBA8;
+ }
qWarning("QRhiMetal: ETC2 compression not supported on this platform");
- return MTLPixelFormatRGBA8Unorm;
-
+ return MTLPixelFormatInvalid;
case QRhiTexture::ASTC_4x4:
+ if (d->caps.isAppleGPU) {
+ if (@available(macOS 11.0, *))
+ return srgb ? MTLPixelFormatASTC_4x4_sRGB : MTLPixelFormatASTC_4x4_LDR;
+ }
+ qWarning("QRhiMetal: ASTC compression not supported on this platform");
+ return MTLPixelFormatInvalid;
case QRhiTexture::ASTC_5x4:
+ if (d->caps.isAppleGPU) {
+ if (@available(macOS 11.0, *))
+ return srgb ? MTLPixelFormatASTC_5x4_sRGB : MTLPixelFormatASTC_5x4_LDR;
+ }
+ qWarning("QRhiMetal: ASTC compression not supported on this platform");
+ return MTLPixelFormatInvalid;
case QRhiTexture::ASTC_5x5:
+ if (d->caps.isAppleGPU) {
+ if (@available(macOS 11.0, *))
+ return srgb ? MTLPixelFormatASTC_5x5_sRGB : MTLPixelFormatASTC_5x5_LDR;
+ }
+ qWarning("QRhiMetal: ASTC compression not supported on this platform");
+ return MTLPixelFormatInvalid;
case QRhiTexture::ASTC_6x5:
+ if (d->caps.isAppleGPU) {
+ if (@available(macOS 11.0, *))
+ return srgb ? MTLPixelFormatASTC_6x5_sRGB : MTLPixelFormatASTC_6x5_LDR;
+ }
+ qWarning("QRhiMetal: ASTC compression not supported on this platform");
+ return MTLPixelFormatInvalid;
case QRhiTexture::ASTC_6x6:
+ if (d->caps.isAppleGPU) {
+ if (@available(macOS 11.0, *))
+ return srgb ? MTLPixelFormatASTC_6x6_sRGB : MTLPixelFormatASTC_6x6_LDR;
+ }
+ qWarning("QRhiMetal: ASTC compression not supported on this platform");
+ return MTLPixelFormatInvalid;
case QRhiTexture::ASTC_8x5:
+ if (d->caps.isAppleGPU) {
+ if (@available(macOS 11.0, *))
+ return srgb ? MTLPixelFormatASTC_8x5_sRGB : MTLPixelFormatASTC_8x5_LDR;
+ }
+ qWarning("QRhiMetal: ASTC compression not supported on this platform");
+ return MTLPixelFormatInvalid;
case QRhiTexture::ASTC_8x6:
+ if (d->caps.isAppleGPU) {
+ if (@available(macOS 11.0, *))
+ return srgb ? MTLPixelFormatASTC_8x6_sRGB : MTLPixelFormatASTC_8x6_LDR;
+ }
+ qWarning("QRhiMetal: ASTC compression not supported on this platform");
+ return MTLPixelFormatInvalid;
case QRhiTexture::ASTC_8x8:
+ if (d->caps.isAppleGPU) {
+ if (@available(macOS 11.0, *))
+ return srgb ? MTLPixelFormatASTC_8x8_sRGB : MTLPixelFormatASTC_8x8_LDR;
+ }
+ qWarning("QRhiMetal: ASTC compression not supported on this platform");
+ return MTLPixelFormatInvalid;
case QRhiTexture::ASTC_10x5:
+ if (d->caps.isAppleGPU) {
+ if (@available(macOS 11.0, *))
+ return srgb ? MTLPixelFormatASTC_10x5_sRGB : MTLPixelFormatASTC_10x5_LDR;
+ }
+ qWarning("QRhiMetal: ASTC compression not supported on this platform");
+ return MTLPixelFormatInvalid;
case QRhiTexture::ASTC_10x6:
+ if (d->caps.isAppleGPU) {
+ if (@available(macOS 11.0, *))
+ return srgb ? MTLPixelFormatASTC_10x6_sRGB : MTLPixelFormatASTC_10x6_LDR;
+ }
+ qWarning("QRhiMetal: ASTC compression not supported on this platform");
+ return MTLPixelFormatInvalid;
case QRhiTexture::ASTC_10x8:
+ if (d->caps.isAppleGPU) {
+ if (@available(macOS 11.0, *))
+ return srgb ? MTLPixelFormatASTC_10x8_sRGB : MTLPixelFormatASTC_10x8_LDR;
+ }
+ qWarning("QRhiMetal: ASTC compression not supported on this platform");
+ return MTLPixelFormatInvalid;
case QRhiTexture::ASTC_10x10:
+ if (d->caps.isAppleGPU) {
+ if (@available(macOS 11.0, *))
+ return srgb ? MTLPixelFormatASTC_10x10_sRGB : MTLPixelFormatASTC_10x10_LDR;
+ }
+ qWarning("QRhiMetal: ASTC compression not supported on this platform");
+ return MTLPixelFormatInvalid;
case QRhiTexture::ASTC_12x10:
+ if (d->caps.isAppleGPU) {
+ if (@available(macOS 11.0, *))
+ return srgb ? MTLPixelFormatASTC_12x10_sRGB : MTLPixelFormatASTC_12x10_LDR;
+ }
+ qWarning("QRhiMetal: ASTC compression not supported on this platform");
+ return MTLPixelFormatInvalid;
case QRhiTexture::ASTC_12x12:
+ if (d->caps.isAppleGPU) {
+ if (@available(macOS 11.0, *))
+ return srgb ? MTLPixelFormatASTC_12x12_sRGB : MTLPixelFormatASTC_12x12_LDR;
+ }
qWarning("QRhiMetal: ASTC compression not supported on this platform");
- return MTLPixelFormatRGBA8Unorm;
+ return MTLPixelFormatInvalid;
#endif
default:
Q_UNREACHABLE();
- return MTLPixelFormatRGBA8Unorm;
+ return MTLPixelFormatInvalid;
+ }
+}
+
+QMetalRenderBuffer::QMetalRenderBuffer(QRhiImplementation *rhi, Type type, const QSize &pixelSize,
+ int sampleCount, QRhiRenderBuffer::Flags flags,
+ QRhiTexture::Format backingFormatHint)
+ : QRhiRenderBuffer(rhi, type, pixelSize, sampleCount, flags, backingFormatHint),
+ d(new QMetalRenderBufferData)
+{
+}
+
+QMetalRenderBuffer::~QMetalRenderBuffer()
+{
+ destroy();
+ delete d;
+}
+
+void QMetalRenderBuffer::destroy()
+{
+ if (!d->tex)
+ return;
+
+ QRhiMetalData::DeferredReleaseEntry e;
+ e.type = QRhiMetalData::DeferredReleaseEntry::RenderBuffer;
+ e.lastActiveFrameSlot = lastActiveFrameSlot;
+
+ e.renderbuffer.texture = d->tex;
+ d->tex = nil;
+
+ QRHI_RES_RHI(QRhiMetal);
+ if (rhiD) {
+ rhiD->d->releaseQueue.append(e);
+ rhiD->unregisterResource(this);
+ }
+}
+
+bool QMetalRenderBuffer::create()
+{
+ if (d->tex)
+ destroy();
+
+ if (m_pixelSize.isEmpty())
+ return false;
+
+ QRHI_RES_RHI(QRhiMetal);
+ samples = rhiD->effectiveSampleCount(m_sampleCount);
+
+ MTLTextureDescriptor *desc = [[MTLTextureDescriptor alloc] init];
+ desc.textureType = samples > 1 ? MTLTextureType2DMultisample : MTLTextureType2D;
+ desc.width = NSUInteger(m_pixelSize.width());
+ desc.height = NSUInteger(m_pixelSize.height());
+ if (samples > 1)
+ desc.sampleCount = NSUInteger(samples);
+ desc.resourceOptions = MTLResourceStorageModePrivate;
+ desc.usage = MTLTextureUsageRenderTarget;
+
+ switch (m_type) {
+ case DepthStencil:
+#ifdef Q_OS_MACOS
+ if (rhiD->caps.isAppleGPU) {
+ if (@available(macOS 11.0, *)) {
+ desc.storageMode = MTLStorageModeMemoryless;
+ d->format = MTLPixelFormatDepth32Float_Stencil8;
+ } else {
+ Q_UNREACHABLE();
+ }
+ } else {
+ desc.storageMode = MTLStorageModePrivate;
+ d->format = rhiD->d->dev.depth24Stencil8PixelFormatSupported
+ ? MTLPixelFormatDepth24Unorm_Stencil8 : MTLPixelFormatDepth32Float_Stencil8;
+ }
+#else
+ desc.storageMode = MTLStorageModeMemoryless;
+ d->format = MTLPixelFormatDepth32Float_Stencil8;
+#endif
+ desc.pixelFormat = d->format;
+ break;
+ case Color:
+ desc.storageMode = MTLStorageModePrivate;
+ if (m_backingFormatHint != QRhiTexture::UnknownFormat)
+ d->format = toMetalTextureFormat(m_backingFormatHint, {}, rhiD);
+ else
+ d->format = MTLPixelFormatRGBA8Unorm;
+ desc.pixelFormat = d->format;
+ break;
+ default:
+ Q_UNREACHABLE();
+ break;
+ }
+
+ d->tex = [rhiD->d->dev newTextureWithDescriptor: desc];
+ [desc release];
+
+ if (!m_objectName.isEmpty())
+ d->tex.label = [NSString stringWithUTF8String: m_objectName.constData()];
+
+ lastActiveFrameSlot = -1;
+ generation += 1;
+ rhiD->registerResource(this);
+ return true;
+}
+
+QRhiTexture::Format QMetalRenderBuffer::backingFormat() const
+{
+ if (m_backingFormatHint != QRhiTexture::UnknownFormat)
+ return m_backingFormatHint;
+ else
+ return m_type == Color ? QRhiTexture::RGBA8 : QRhiTexture::UnknownFormat;
+}
+
+QMetalTexture::QMetalTexture(QRhiImplementation *rhi, Format format, const QSize &pixelSize, int depth,
+ int arraySize, int sampleCount, Flags flags)
+ : QRhiTexture(rhi, format, pixelSize, depth, arraySize, sampleCount, flags),
+ d(new QMetalTextureData(this))
+{
+ for (int i = 0; i < QMTL_FRAMES_IN_FLIGHT; ++i)
+ d->stagingBuf[i] = nil;
+
+ for (int i = 0; i < QRhi::MAX_MIP_LEVELS; ++i)
+ d->perLevelViews[i] = nil;
+}
+
+QMetalTexture::~QMetalTexture()
+{
+ destroy();
+ delete d;
+}
+
+void QMetalTexture::destroy()
+{
+ if (!d->tex)
+ return;
+
+ QRhiMetalData::DeferredReleaseEntry e;
+ e.type = QRhiMetalData::DeferredReleaseEntry::Texture;
+ e.lastActiveFrameSlot = lastActiveFrameSlot;
+
+ e.texture.texture = d->owns ? d->tex : nil;
+ d->tex = nil;
+
+ for (int i = 0; i < QMTL_FRAMES_IN_FLIGHT; ++i) {
+ e.texture.stagingBuffers[i] = d->stagingBuf[i];
+ d->stagingBuf[i] = nil;
+ }
+
+ for (int i = 0; i < QRhi::MAX_MIP_LEVELS; ++i) {
+ e.texture.views[i] = d->perLevelViews[i];
+ d->perLevelViews[i] = nil;
+ }
+
+ QRHI_RES_RHI(QRhiMetal);
+ if (rhiD) {
+ rhiD->d->releaseQueue.append(e);
+ rhiD->unregisterResource(this);
}
}
-bool QMetalTexture::prepareBuild(QSize *adjustedSize)
+bool QMetalTexture::prepareCreate(QSize *adjustedSize)
{
if (d->tex)
- release();
+ destroy();
- const QSize size = m_pixelSize.isEmpty() ? QSize(1, 1) : m_pixelSize;
const bool isCube = m_flags.testFlag(CubeMap);
+ const bool is3D = m_flags.testFlag(ThreeDimensional);
+ const bool isArray = m_flags.testFlag(TextureArray);
const bool hasMipMaps = m_flags.testFlag(MipMapped);
+ const bool is1D = m_flags.testFlag(OneDimensional);
+
+ const QSize size = is1D ? QSize(qMax(1, m_pixelSize.width()), 1)
+ : (m_pixelSize.isEmpty() ? QSize(1, 1) : m_pixelSize);
QRHI_RES_RHI(QRhiMetal);
- d->format = toMetalTextureFormat(m_format, m_flags);
+ d->format = toMetalTextureFormat(m_format, m_flags, rhiD);
mipLevelCount = hasMipMaps ? rhiD->q->mipLevelsForSize(size) : 1;
samples = rhiD->effectiveSampleCount(m_sampleCount);
if (samples > 1) {
@@ -2417,11 +3788,43 @@ bool QMetalTexture::prepareBuild(QSize *adjustedSize)
qWarning("Cubemap texture cannot be multisample");
return false;
}
+ if (is3D) {
+ qWarning("3D texture cannot be multisample");
+ return false;
+ }
if (hasMipMaps) {
qWarning("Multisample texture cannot have mipmaps");
return false;
}
}
+ if (isCube && is3D) {
+ qWarning("Texture cannot be both cube and 3D");
+ return false;
+ }
+ if (isArray && is3D) {
+ qWarning("Texture cannot be both array and 3D");
+ return false;
+ }
+ if (is1D && is3D) {
+ qWarning("Texture cannot be both 1D and 3D");
+ return false;
+ }
+ if (is1D && isCube) {
+ qWarning("Texture cannot be both 1D and cube");
+ return false;
+ }
+ if (m_depth > 1 && !is3D) {
+ qWarning("Texture cannot have a depth of %d when it is not 3D", m_depth);
+ return false;
+ }
+ if (m_arraySize > 0 && !isArray) {
+ qWarning("Texture cannot have an array size of %d when it is not an array", m_arraySize);
+ return false;
+ }
+ if (m_arraySize < 1 && isArray) {
+ qWarning("Texture is an array but array size is %d", m_arraySize);
+ return false;
+ }
if (adjustedSize)
*adjustedSize = size;
@@ -2429,25 +3832,46 @@ bool QMetalTexture::prepareBuild(QSize *adjustedSize)
return true;
}
-bool QMetalTexture::build()
+bool QMetalTexture::create()
{
QSize size;
- if (!prepareBuild(&size))
+ if (!prepareCreate(&size))
return false;
MTLTextureDescriptor *desc = [[MTLTextureDescriptor alloc] init];
const bool isCube = m_flags.testFlag(CubeMap);
- if (isCube)
+ const bool is3D = m_flags.testFlag(ThreeDimensional);
+ const bool isArray = m_flags.testFlag(TextureArray);
+ const bool is1D = m_flags.testFlag(OneDimensional);
+ if (isCube) {
desc.textureType = MTLTextureTypeCube;
- else
+ } else if (is3D) {
+ desc.textureType = MTLTextureType3D;
+ } else if (is1D) {
+ desc.textureType = isArray ? MTLTextureType1DArray : MTLTextureType1D;
+ } else if (isArray) {
+#ifdef Q_OS_IOS
+ if (@available(iOS 14, *)) {
+ desc.textureType = samples > 1 ? MTLTextureType2DMultisampleArray : MTLTextureType2DArray;
+ } else {
+ desc.textureType = MTLTextureType2DArray;
+ }
+#else
+ desc.textureType = samples > 1 ? MTLTextureType2DMultisampleArray : MTLTextureType2DArray;
+#endif
+ } else {
desc.textureType = samples > 1 ? MTLTextureType2DMultisample : MTLTextureType2D;
+ }
desc.pixelFormat = d->format;
desc.width = NSUInteger(size.width());
desc.height = NSUInteger(size.height());
+ desc.depth = is3D ? qMax(1, m_depth) : 1;
desc.mipmapLevelCount = NSUInteger(mipLevelCount);
if (samples > 1)
desc.sampleCount = NSUInteger(samples);
+ if (isArray)
+ desc.arrayLength = NSUInteger(qMax(0, m_arraySize));
desc.resourceOptions = MTLResourceStorageModePrivate;
desc.storageMode = MTLStorageModePrivate;
desc.usage = MTLTextureUsageShaderRead;
@@ -2464,57 +3888,25 @@ bool QMetalTexture::build()
d->tex.label = [NSString stringWithUTF8String: m_objectName.constData()];
d->owns = true;
- nativeHandlesStruct.texture = d->tex;
-
- QRHI_PROF;
- QRHI_PROF_F(newTexture(this, true, mipLevelCount, isCube ? 6 : 1, samples));
-
- lastActiveFrameSlot = -1;
- generation += 1;
- rhiD->registerResource(this);
- return true;
-}
-
-bool QMetalTexture::buildFrom(const QRhiNativeHandles *src)
-{
- const QRhiMetalTextureNativeHandles *h = static_cast<const QRhiMetalTextureNativeHandles *>(src);
- if (!h || !h->texture)
- return false;
-
- if (!prepareBuild())
- return false;
-
- d->tex = (id<MTLTexture>) h->texture;
-
- d->owns = false;
- nativeHandlesStruct.texture = d->tex;
-
- QRHI_PROF;
- QRHI_PROF_F(newTexture(this, false, mipLevelCount, m_flags.testFlag(CubeMap) ? 6 : 1, samples));
lastActiveFrameSlot = -1;
generation += 1;
- QRHI_RES_RHI(QRhiMetal);
rhiD->registerResource(this);
return true;
}
-bool QMetalTexture::buildFrom(QRhiTexture::NativeTexture src)
+bool QMetalTexture::createFrom(QRhiTexture::NativeTexture src)
{
- void * const * tex = (void * const *) src.object;
- if (!tex || !*tex)
+ id<MTLTexture> tex = id<MTLTexture>(src.object);
+ if (tex == 0)
return false;
- if (!prepareBuild())
+ if (!prepareCreate())
return false;
- d->tex = (id<MTLTexture>) *tex;
+ d->tex = tex;
d->owns = false;
- nativeHandlesStruct.texture = d->tex;
-
- QRHI_PROF;
- QRHI_PROF_F(newTexture(this, false, mipLevelCount, m_flags.testFlag(CubeMap) ? 6 : 1, samples));
lastActiveFrameSlot = -1;
generation += 1;
@@ -2523,14 +3915,9 @@ bool QMetalTexture::buildFrom(QRhiTexture::NativeTexture src)
return true;
}
-const QRhiNativeHandles *QMetalTexture::nativeHandles()
-{
- return &nativeHandlesStruct;
-}
-
QRhiTexture::NativeTexture QMetalTexture::nativeTexture()
{
- return {&nativeHandlesStruct.texture, 0};
+ return {quint64(d->tex), 0};
}
id<MTLTexture> QMetalTextureData::viewForLevel(int level)
@@ -2541,27 +3928,29 @@ id<MTLTexture> QMetalTextureData::viewForLevel(int level)
const MTLTextureType type = [tex textureType];
const bool isCube = q->m_flags.testFlag(QRhiTexture::CubeMap);
+ const bool isArray = q->m_flags.testFlag(QRhiTexture::TextureArray);
id<MTLTexture> view = [tex newTextureViewWithPixelFormat: format textureType: type
- levels: NSMakeRange(NSUInteger(level), 1) slices: NSMakeRange(0, isCube ? 6 : 1)];
+ levels: NSMakeRange(NSUInteger(level), 1)
+ slices: NSMakeRange(0, isCube ? 6 : (isArray ? qMax(0, q->m_arraySize) : 1))];
perLevelViews[level] = view;
return view;
}
QMetalSampler::QMetalSampler(QRhiImplementation *rhi, Filter magFilter, Filter minFilter, Filter mipmapMode,
- AddressMode u, AddressMode v)
- : QRhiSampler(rhi, magFilter, minFilter, mipmapMode, u, v),
+ AddressMode u, AddressMode v, AddressMode w)
+ : QRhiSampler(rhi, magFilter, minFilter, mipmapMode, u, v, w),
d(new QMetalSamplerData)
{
}
QMetalSampler::~QMetalSampler()
{
- release();
+ destroy();
delete d;
}
-void QMetalSampler::release()
+void QMetalSampler::destroy()
{
if (!d->samplerState)
return;
@@ -2574,8 +3963,10 @@ void QMetalSampler::release()
d->samplerState = nil;
QRHI_RES_RHI(QRhiMetal);
- rhiD->d->releaseQueue.append(e);
- rhiD->unregisterResource(this);
+ if (rhiD) {
+ rhiD->d->releaseQueue.append(e);
+ rhiD->unregisterResource(this);
+ }
}
static inline MTLSamplerMinMagFilter toMetalFilter(QRhiSampler::Filter f)
@@ -2646,10 +4037,10 @@ static inline MTLCompareFunction toMetalTextureCompareFunction(QRhiSampler::Comp
}
}
-bool QMetalSampler::build()
+bool QMetalSampler::create()
{
if (d->samplerState)
- release();
+ destroy();
MTLSamplerDescriptor *desc = [[MTLSamplerDescriptor alloc] init];
desc.minFilter = toMetalFilter(m_minFilter);
@@ -2675,16 +4066,19 @@ bool QMetalSampler::build()
QMetalRenderPassDescriptor::QMetalRenderPassDescriptor(QRhiImplementation *rhi)
: QRhiRenderPassDescriptor(rhi)
{
+ serializedFormatData.reserve(16);
}
QMetalRenderPassDescriptor::~QMetalRenderPassDescriptor()
{
- release();
+ destroy();
}
-void QMetalRenderPassDescriptor::release()
+void QMetalRenderPassDescriptor::destroy()
{
- // nothing to do here
+ QRHI_RES_RHI(QRhiMetal);
+ if (rhiD)
+ rhiD->unregisterResource(this);
}
bool QMetalRenderPassDescriptor::isCompatible(const QRhiRenderPassDescriptor *other) const
@@ -2713,34 +4107,66 @@ bool QMetalRenderPassDescriptor::isCompatible(const QRhiRenderPassDescriptor *ot
return true;
}
-QMetalReferenceRenderTarget::QMetalReferenceRenderTarget(QRhiImplementation *rhi)
- : QRhiRenderTarget(rhi),
+void QMetalRenderPassDescriptor::updateSerializedFormat()
+{
+ serializedFormatData.clear();
+ auto p = std::back_inserter(serializedFormatData);
+
+ *p++ = colorAttachmentCount;
+ *p++ = hasDepthStencil;
+ for (int i = 0; i < colorAttachmentCount; ++i)
+ *p++ = colorFormat[i];
+ *p++ = hasDepthStencil ? dsFormat : 0;
+}
+
+QRhiRenderPassDescriptor *QMetalRenderPassDescriptor::newCompatibleRenderPassDescriptor() const
+{
+ QMetalRenderPassDescriptor *rpD = new QMetalRenderPassDescriptor(m_rhi);
+ rpD->colorAttachmentCount = colorAttachmentCount;
+ rpD->hasDepthStencil = hasDepthStencil;
+ memcpy(rpD->colorFormat, colorFormat, sizeof(colorFormat));
+ rpD->dsFormat = dsFormat;
+
+ rpD->updateSerializedFormat();
+
+ QRHI_RES_RHI(QRhiMetal);
+ rhiD->registerResource(rpD, false);
+ return rpD;
+}
+
+QVector<quint32> QMetalRenderPassDescriptor::serializedFormat() const
+{
+ return serializedFormatData;
+}
+
+QMetalSwapChainRenderTarget::QMetalSwapChainRenderTarget(QRhiImplementation *rhi, QRhiSwapChain *swapchain)
+ : QRhiSwapChainRenderTarget(rhi, swapchain),
d(new QMetalRenderTargetData)
{
}
-QMetalReferenceRenderTarget::~QMetalReferenceRenderTarget()
+QMetalSwapChainRenderTarget::~QMetalSwapChainRenderTarget()
{
- release();
+ destroy();
delete d;
}
-void QMetalReferenceRenderTarget::release()
+void QMetalSwapChainRenderTarget::destroy()
{
// nothing to do here
}
-QSize QMetalReferenceRenderTarget::pixelSize() const
+QSize QMetalSwapChainRenderTarget::pixelSize() const
{
return d->pixelSize;
}
-float QMetalReferenceRenderTarget::devicePixelRatio() const
+float QMetalSwapChainRenderTarget::devicePixelRatio() const
{
return d->dpr;
}
-int QMetalReferenceRenderTarget::sampleCount() const
+int QMetalSwapChainRenderTarget::sampleCount() const
{
return d->sampleCount;
}
@@ -2755,18 +4181,20 @@ QMetalTextureRenderTarget::QMetalTextureRenderTarget(QRhiImplementation *rhi,
QMetalTextureRenderTarget::~QMetalTextureRenderTarget()
{
- release();
+ destroy();
delete d;
}
-void QMetalTextureRenderTarget::release()
+void QMetalTextureRenderTarget::destroy()
{
- // nothing to do here
+ QRHI_RES_RHI(QRhiMetal);
+ if (rhiD)
+ rhiD->unregisterResource(this);
}
QRhiRenderPassDescriptor *QMetalTextureRenderTarget::newCompatibleRenderPassDescriptor()
{
- const int colorAttachmentCount = m_desc.cendColorAttachments() - m_desc.cbeginColorAttachments();
+ const int colorAttachmentCount = int(m_desc.colorAttachmentCount());
QMetalRenderPassDescriptor *rpD = new QMetalRenderPassDescriptor(m_rhi);
rpD->colorAttachmentCount = colorAttachmentCount;
rpD->hasDepthStencil = m_desc.depthStencilBuffer() || m_desc.depthTexture();
@@ -2783,13 +4211,17 @@ QRhiRenderPassDescriptor *QMetalTextureRenderTarget::newCompatibleRenderPassDesc
else if (m_desc.depthStencilBuffer())
rpD->dsFormat = int(QRHI_RES(QMetalRenderBuffer, m_desc.depthStencilBuffer())->d->format);
+ rpD->updateSerializedFormat();
+
+ QRHI_RES_RHI(QRhiMetal);
+ rhiD->registerResource(rpD, false);
return rpD;
}
-bool QMetalTextureRenderTarget::build()
+bool QMetalTextureRenderTarget::create()
{
- const bool hasColorAttachments = m_desc.cbeginColorAttachments() != m_desc.cendColorAttachments();
- Q_ASSERT(hasColorAttachments || m_desc.depthTexture());
+ QRHI_RES_RHI(QRhiMetal);
+ Q_ASSERT(m_desc.colorAttachmentCount() > 0 || m_desc.depthTexture());
Q_ASSERT(!m_desc.depthStencilBuffer() || !m_desc.depthTexture());
const bool hasDepthStencil = m_desc.depthStencilBuffer() || m_desc.depthTexture();
@@ -2801,12 +4233,14 @@ bool QMetalTextureRenderTarget::build()
QMetalRenderBuffer *rbD = QRHI_RES(QMetalRenderBuffer, it->renderBuffer());
Q_ASSERT(texD || rbD);
id<MTLTexture> dst = nil;
+ bool is3D = false;
if (texD) {
dst = texD->d->tex;
if (attIndex == 0) {
- d->pixelSize = texD->pixelSize();
+ d->pixelSize = rhiD->q->sizeForMipLevel(it->level(), texD->pixelSize());
d->sampleCount = texD->samples;
}
+ is3D = texD->flags().testFlag(QRhiTexture::ThreeDimensional);
} else if (rbD) {
dst = rbD->d->tex;
if (attIndex == 0) {
@@ -2816,7 +4250,8 @@ bool QMetalTextureRenderTarget::build()
}
QMetalRenderTargetData::ColorAtt colorAtt;
colorAtt.tex = dst;
- colorAtt.layer = it->layer();
+ colorAtt.arrayLayer = is3D ? 0 : it->layer();
+ colorAtt.slice = is3D ? it->layer() : 0;
colorAtt.level = it->level();
QMetalTexture *resTexD = QRHI_RES(QMetalTexture, it->resolveTexture());
colorAtt.resolveTex = resTexD ? resTexD->d->tex : nil;
@@ -2830,8 +4265,9 @@ bool QMetalTextureRenderTarget::build()
if (m_desc.depthTexture()) {
QMetalTexture *depthTexD = QRHI_RES(QMetalTexture, m_desc.depthTexture());
d->fb.dsTex = depthTexD->d->tex;
- d->fb.hasStencil = false;
- d->fb.depthNeedsStore = true;
+ d->fb.hasStencil = rhiD->isStencilSupportingFormat(depthTexD->format());
+ d->fb.depthNeedsStore = !m_flags.testFlag(DoNotStoreDepthStencilContents) && !m_desc.depthResolveTexture();
+ d->fb.preserveDs = m_flags.testFlag(QRhiTextureRenderTarget::PreserveDepthStencilContents);
if (d->colorAttCount == 0) {
d->pixelSize = depthTexD->pixelSize();
d->sampleCount = depthTexD->samples;
@@ -2841,21 +4277,35 @@ bool QMetalTextureRenderTarget::build()
d->fb.dsTex = depthRbD->d->tex;
d->fb.hasStencil = true;
d->fb.depthNeedsStore = false;
+ d->fb.preserveDs = false;
if (d->colorAttCount == 0) {
d->pixelSize = depthRbD->pixelSize();
d->sampleCount = depthRbD->samples;
}
}
+ if (m_desc.depthResolveTexture()) {
+ QMetalTexture *depthResolveTexD = QRHI_RES(QMetalTexture, m_desc.depthResolveTexture());
+ d->fb.dsResolveTex = depthResolveTexD->d->tex;
+ }
d->dsAttCount = 1;
} else {
d->dsAttCount = 0;
}
+ if (d->colorAttCount > 0)
+ d->fb.preserveColor = m_flags.testFlag(QRhiTextureRenderTarget::PreserveColorContents);
+
+ QRhiRenderTargetAttachmentTracker::updateResIdList<QMetalTexture, QMetalRenderBuffer>(m_desc, &d->currentResIdList);
+
+ rhiD->registerResource(this, false);
return true;
}
QSize QMetalTextureRenderTarget::pixelSize() const
{
+ if (!QRhiRenderTargetAttachmentTracker::isUpToDate<QMetalTexture, QMetalRenderBuffer>(m_desc, d->currentResIdList))
+ const_cast<QMetalTextureRenderTarget *>(this)->create();
+
return d->pixelSize;
}
@@ -2876,115 +4326,118 @@ QMetalShaderResourceBindings::QMetalShaderResourceBindings(QRhiImplementation *r
QMetalShaderResourceBindings::~QMetalShaderResourceBindings()
{
- release();
+ destroy();
}
-void QMetalShaderResourceBindings::release()
+void QMetalShaderResourceBindings::destroy()
{
sortedBindings.clear();
maxBinding = -1;
+
+ QRHI_RES_RHI(QRhiMetal);
+ if (rhiD)
+ rhiD->unregisterResource(this);
}
-bool QMetalShaderResourceBindings::build()
+bool QMetalShaderResourceBindings::create()
{
if (!sortedBindings.isEmpty())
- release();
+ destroy();
+
+ QRHI_RES_RHI(QRhiMetal);
+ if (!rhiD->sanityCheckShaderResourceBindings(this))
+ return false;
+
+ rhiD->updateLayoutDesc(this);
std::copy(m_bindings.cbegin(), m_bindings.cend(), std::back_inserter(sortedBindings));
- std::sort(sortedBindings.begin(), sortedBindings.end(),
- [](const QRhiShaderResourceBinding &a, const QRhiShaderResourceBinding &b)
- {
- return a.data()->binding < b.data()->binding;
- });
+ std::sort(sortedBindings.begin(), sortedBindings.end(), QRhiImplementation::sortedBindingLessThan);
if (!sortedBindings.isEmpty())
- maxBinding = sortedBindings.last().data()->binding;
+ maxBinding = QRhiImplementation::shaderResourceBindingData(sortedBindings.last())->binding;
else
maxBinding = -1;
boundResourceData.resize(sortedBindings.count());
- for (int i = 0, ie = sortedBindings.count(); i != ie; ++i) {
- const QRhiShaderResourceBinding::Data *b = sortedBindings.at(i).data();
- QMetalShaderResourceBindings::BoundResourceData &bd(boundResourceData[i]);
- switch (b->type) {
- case QRhiShaderResourceBinding::UniformBuffer:
- {
- QMetalBuffer *bufD = QRHI_RES(QMetalBuffer, b->u.ubuf.buf);
- bd.ubuf.id = bufD->m_id;
- bd.ubuf.generation = bufD->generation;
- }
- break;
- case QRhiShaderResourceBinding::SampledTexture:
- {
- QMetalTexture *texD = QRHI_RES(QMetalTexture, b->u.stex.tex);
- QMetalSampler *samplerD = QRHI_RES(QMetalSampler, b->u.stex.sampler);
- bd.stex.texId = texD->m_id;
- bd.stex.texGeneration = texD->generation;
- bd.stex.samplerId = samplerD->m_id;
- bd.stex.samplerGeneration = samplerD->generation;
- }
- break;
- case QRhiShaderResourceBinding::ImageLoad:
- Q_FALLTHROUGH();
- case QRhiShaderResourceBinding::ImageStore:
- Q_FALLTHROUGH();
- case QRhiShaderResourceBinding::ImageLoadStore:
- {
- QMetalTexture *texD = QRHI_RES(QMetalTexture, b->u.simage.tex);
- bd.simage.id = texD->m_id;
- bd.simage.generation = texD->generation;
- }
- break;
- case QRhiShaderResourceBinding::BufferLoad:
- Q_FALLTHROUGH();
- case QRhiShaderResourceBinding::BufferStore:
- Q_FALLTHROUGH();
- case QRhiShaderResourceBinding::BufferLoadStore:
- {
- QMetalBuffer *bufD = QRHI_RES(QMetalBuffer, b->u.sbuf.buf);
- bd.sbuf.id = bufD->m_id;
- bd.sbuf.generation = bufD->generation;
- }
- break;
- default:
- Q_UNREACHABLE();
- break;
- }
- }
+ for (BoundResourceData &bd : boundResourceData)
+ memset(&bd, 0, sizeof(BoundResourceData));
generation += 1;
+ rhiD->registerResource(this, false);
return true;
}
+void QMetalShaderResourceBindings::updateResources(UpdateFlags flags)
+{
+ sortedBindings.clear();
+ std::copy(m_bindings.cbegin(), m_bindings.cend(), std::back_inserter(sortedBindings));
+ if (!flags.testFlag(BindingsAreSorted))
+ std::sort(sortedBindings.begin(), sortedBindings.end(), QRhiImplementation::sortedBindingLessThan);
+
+ for (BoundResourceData &bd : boundResourceData)
+ memset(&bd, 0, sizeof(BoundResourceData));
+
+ generation += 1;
+}
+
QMetalGraphicsPipeline::QMetalGraphicsPipeline(QRhiImplementation *rhi)
: QRhiGraphicsPipeline(rhi),
d(new QMetalGraphicsPipelineData)
{
+ d->q = this;
+ d->tess.q = d;
}
QMetalGraphicsPipeline::~QMetalGraphicsPipeline()
{
- release();
+ destroy();
delete d;
}
-void QMetalGraphicsPipeline::release()
+void QMetalGraphicsPipeline::destroy()
{
- QRHI_RES_RHI(QRhiMetal);
+ d->vs.destroy();
+ d->fs.destroy();
- d->vs.release();
- d->fs.release();
+ d->tess.compVs[0].destroy();
+ d->tess.compVs[1].destroy();
+ d->tess.compVs[2].destroy();
- [d->ds release];
- d->ds = nil;
+ d->tess.compTesc.destroy();
+ d->tess.vertTese.destroy();
- if (!d->ps)
+ qDeleteAll(d->extraBufMgr.deviceLocalWorkBuffers);
+ d->extraBufMgr.deviceLocalWorkBuffers.clear();
+ qDeleteAll(d->extraBufMgr.hostVisibleWorkBuffers);
+ d->extraBufMgr.hostVisibleWorkBuffers.clear();
+
+ delete d->bufferSizeBuffer;
+ d->bufferSizeBuffer = nullptr;
+
+ if (!d->ps && !d->ds
+ && !d->tess.vertexComputeState[0] && !d->tess.vertexComputeState[1] && !d->tess.vertexComputeState[2]
+ && !d->tess.tessControlComputeState)
+ {
return;
+ }
- [d->ps release];
+ QRhiMetalData::DeferredReleaseEntry e;
+ e.type = QRhiMetalData::DeferredReleaseEntry::GraphicsPipeline;
+ e.lastActiveFrameSlot = lastActiveFrameSlot;
+ e.graphicsPipeline.pipelineState = d->ps;
+ e.graphicsPipeline.depthStencilState = d->ds;
+ e.graphicsPipeline.tessVertexComputeState = d->tess.vertexComputeState;
+ e.graphicsPipeline.tessTessControlComputeState = d->tess.tessControlComputeState;
d->ps = nil;
+ d->ds = nil;
+ d->tess.vertexComputeState = {};
+ d->tess.tessControlComputeState = nil;
- rhiD->unregisterResource(this);
+ QRHI_RES_RHI(QRhiMetal);
+ if (rhiD) {
+ rhiD->d->releaseQueue.append(e);
+ rhiD->unregisterResource(this);
+ }
}
static inline MTLVertexFormat toMetalAttributeFormat(QRhiVertexInputAttribute::Format format)
@@ -3003,10 +4456,47 @@ static inline MTLVertexFormat toMetalAttributeFormat(QRhiVertexInputAttribute::F
case QRhiVertexInputAttribute::UNormByte2:
return MTLVertexFormatUChar2Normalized;
case QRhiVertexInputAttribute::UNormByte:
- if (@available(macOS 10.13, iOS 11.0, *))
- return MTLVertexFormatUCharNormalized;
- else
- Q_UNREACHABLE();
+ return MTLVertexFormatUCharNormalized;
+ case QRhiVertexInputAttribute::UInt4:
+ return MTLVertexFormatUInt4;
+ case QRhiVertexInputAttribute::UInt3:
+ return MTLVertexFormatUInt3;
+ case QRhiVertexInputAttribute::UInt2:
+ return MTLVertexFormatUInt2;
+ case QRhiVertexInputAttribute::UInt:
+ return MTLVertexFormatUInt;
+ case QRhiVertexInputAttribute::SInt4:
+ return MTLVertexFormatInt4;
+ case QRhiVertexInputAttribute::SInt3:
+ return MTLVertexFormatInt3;
+ case QRhiVertexInputAttribute::SInt2:
+ return MTLVertexFormatInt2;
+ case QRhiVertexInputAttribute::SInt:
+ return MTLVertexFormatInt;
+ case QRhiVertexInputAttribute::Half4:
+ return MTLVertexFormatHalf4;
+ case QRhiVertexInputAttribute::Half3:
+ return MTLVertexFormatHalf3;
+ case QRhiVertexInputAttribute::Half2:
+ return MTLVertexFormatHalf2;
+ case QRhiVertexInputAttribute::Half:
+ return MTLVertexFormatHalf;
+ case QRhiVertexInputAttribute::UShort4:
+ return MTLVertexFormatUShort4;
+ case QRhiVertexInputAttribute::UShort3:
+ return MTLVertexFormatUShort3;
+ case QRhiVertexInputAttribute::UShort2:
+ return MTLVertexFormatUShort2;
+ case QRhiVertexInputAttribute::UShort:
+ return MTLVertexFormatUShort;
+ case QRhiVertexInputAttribute::SShort4:
+ return MTLVertexFormatShort4;
+ case QRhiVertexInputAttribute::SShort3:
+ return MTLVertexFormatShort3;
+ case QRhiVertexInputAttribute::SShort2:
+ return MTLVertexFormatShort2;
+ case QRhiVertexInputAttribute::SShort:
+ return MTLVertexFormatShort;
default:
Q_UNREACHABLE();
return MTLVertexFormatFloat4;
@@ -3162,6 +4652,24 @@ static inline MTLPrimitiveType toMetalPrimitiveType(QRhiGraphicsPipeline::Topolo
}
}
+static inline MTLPrimitiveTopologyClass toMetalPrimitiveTopologyClass(QRhiGraphicsPipeline::Topology t)
+{
+ switch (t) {
+ case QRhiGraphicsPipeline::Triangles:
+ case QRhiGraphicsPipeline::TriangleStrip:
+ case QRhiGraphicsPipeline::TriangleFan:
+ return MTLPrimitiveTopologyClassTriangle;
+ case QRhiGraphicsPipeline::Lines:
+ case QRhiGraphicsPipeline::LineStrip:
+ return MTLPrimitiveTopologyClassLine;
+ case QRhiGraphicsPipeline::Points:
+ return MTLPrimitiveTopologyClassPoint;
+ default:
+ Q_UNREACHABLE();
+ return MTLPrimitiveTopologyClassTriangle;
+ }
+}
+
static inline MTLCullMode toMetalCullMode(QRhiGraphicsPipeline::CullMode c)
{
switch (c) {
@@ -3177,10 +4685,79 @@ static inline MTLCullMode toMetalCullMode(QRhiGraphicsPipeline::CullMode c)
}
}
+static inline MTLTriangleFillMode toMetalTriangleFillMode(QRhiGraphicsPipeline::PolygonMode mode)
+{
+ switch (mode) {
+ case QRhiGraphicsPipeline::Fill:
+ return MTLTriangleFillModeFill;
+ case QRhiGraphicsPipeline::Line:
+ return MTLTriangleFillModeLines;
+ default:
+ Q_UNREACHABLE();
+ return MTLTriangleFillModeFill;
+ }
+}
+
+static inline MTLWinding toMetalTessellationWindingOrder(QShaderDescription::TessellationWindingOrder w)
+{
+ switch (w) {
+ case QShaderDescription::CwTessellationWindingOrder:
+ return MTLWindingClockwise;
+ case QShaderDescription::CcwTessellationWindingOrder:
+ return MTLWindingCounterClockwise;
+ default:
+ // this is reachable, consider a tess.eval. shader not declaring it, the value is then Unknown
+ return MTLWindingCounterClockwise;
+ }
+}
+
+static inline MTLTessellationPartitionMode toMetalTessellationPartitionMode(QShaderDescription::TessellationPartitioning p)
+{
+ switch (p) {
+ case QShaderDescription::EqualTessellationPartitioning:
+ return MTLTessellationPartitionModePow2;
+ case QShaderDescription::FractionalEvenTessellationPartitioning:
+ return MTLTessellationPartitionModeFractionalEven;
+ case QShaderDescription::FractionalOddTessellationPartitioning:
+ return MTLTessellationPartitionModeFractionalOdd;
+ default:
+ // this is reachable, consider a tess.eval. shader not declaring it, the value is then Unknown
+ return MTLTessellationPartitionModePow2;
+ }
+}
+
+static inline MTLLanguageVersion toMetalLanguageVersion(const QShaderVersion &version)
+{
+ int v = version.version();
+ return MTLLanguageVersion(((v / 10) << 16) + (v % 10));
+}
+
id<MTLLibrary> QRhiMetalData::createMetalLib(const QShader &shader, QShader::Variant shaderVariant,
QString *error, QByteArray *entryPoint, QShaderKey *activeKey)
{
- QShaderKey key = { QShader::MetalLibShader, 12, shaderVariant };
+ QVarLengthArray<int, 8> versions;
+ if (@available(macOS 13, iOS 16, *))
+ versions << 30;
+ if (@available(macOS 12, iOS 15, *))
+ versions << 24;
+ if (@available(macOS 11, iOS 14, *))
+ versions << 23;
+ if (@available(macOS 10.15, iOS 13, *))
+ versions << 22;
+ if (@available(macOS 10.14, iOS 12, *))
+ versions << 21;
+ versions << 20 << 12;
+
+ const QList<QShaderKey> shaders = shader.availableShaders();
+
+ QShaderKey key;
+
+ for (const int &version : versions) {
+ key = { QShader::Source::MetalLibShader, version, shaderVariant };
+ if (shaders.contains(key))
+ break;
+ }
+
QShaderCode mtllib = shader.shader(key);
if (!mtllib.shader().isEmpty()) {
dispatch_data_t data = dispatch_data_create(mtllib.shader().constData(),
@@ -3200,16 +4777,21 @@ id<MTLLibrary> QRhiMetalData::createMetalLib(const QShader &shader, QShader::Var
}
}
- key = { QShader::MslShader, 12, shaderVariant };
+ for (const int &version : versions) {
+ key = { QShader::Source::MslShader, version, shaderVariant };
+ if (shaders.contains(key))
+ break;
+ }
+
QShaderCode mslSource = shader.shader(key);
if (mslSource.shader().isEmpty()) {
- qWarning() << "No MSL 1.2 code found in baked shader" << shader;
+ qWarning() << "No MSL 2.0 or 1.2 code found in baked shader" << shader;
return nil;
}
NSString *src = [NSString stringWithUTF8String: mslSource.shader().constData()];
MTLCompileOptions *opts = [[MTLCompileOptions alloc] init];
- opts.languageVersion = MTLLanguageVersion1_2;
+ opts.languageVersion = toMetalLanguageVersion(key.sourceVersion());
NSError *err = nil;
id<MTLLibrary> lib = [dev newLibraryWithSource: src options: opts error: &err];
[opts release];
@@ -3231,55 +4813,192 @@ id<MTLLibrary> QRhiMetalData::createMetalLib(const QShader &shader, QShader::Var
id<MTLFunction> QRhiMetalData::createMSLShaderFunction(id<MTLLibrary> lib, const QByteArray &entryPoint)
{
- NSString *name = [NSString stringWithUTF8String: entryPoint.constData()];
- id<MTLFunction> f = [lib newFunctionWithName: name];
- [name release];
- return f;
+ return [lib newFunctionWithName:[NSString stringWithUTF8String:entryPoint.constData()]];
}
-bool QMetalGraphicsPipeline::build()
+void QMetalGraphicsPipeline::setupAttachmentsInMetalRenderPassDescriptor(void *metalRpDesc, QMetalRenderPassDescriptor *rpD)
{
- if (d->ps)
- release();
+ MTLRenderPipelineDescriptor *rpDesc = reinterpret_cast<MTLRenderPipelineDescriptor *>(metalRpDesc);
+
+ if (rpD->colorAttachmentCount) {
+ // defaults when no targetBlends are provided
+ rpDesc.colorAttachments[0].pixelFormat = MTLPixelFormat(rpD->colorFormat[0]);
+ rpDesc.colorAttachments[0].writeMask = MTLColorWriteMaskAll;
+ rpDesc.colorAttachments[0].blendingEnabled = false;
+
+ Q_ASSERT(m_targetBlends.count() == rpD->colorAttachmentCount
+ || (m_targetBlends.isEmpty() && rpD->colorAttachmentCount == 1));
+
+ for (uint i = 0, ie = uint(m_targetBlends.count()); i != ie; ++i) {
+ const QRhiGraphicsPipeline::TargetBlend &b(m_targetBlends[int(i)]);
+ rpDesc.colorAttachments[i].pixelFormat = MTLPixelFormat(rpD->colorFormat[i]);
+ rpDesc.colorAttachments[i].blendingEnabled = b.enable;
+ rpDesc.colorAttachments[i].sourceRGBBlendFactor = toMetalBlendFactor(b.srcColor);
+ rpDesc.colorAttachments[i].destinationRGBBlendFactor = toMetalBlendFactor(b.dstColor);
+ rpDesc.colorAttachments[i].rgbBlendOperation = toMetalBlendOp(b.opColor);
+ rpDesc.colorAttachments[i].sourceAlphaBlendFactor = toMetalBlendFactor(b.srcAlpha);
+ rpDesc.colorAttachments[i].destinationAlphaBlendFactor = toMetalBlendFactor(b.dstAlpha);
+ rpDesc.colorAttachments[i].alphaBlendOperation = toMetalBlendOp(b.opAlpha);
+ rpDesc.colorAttachments[i].writeMask = toMetalColorWriteMask(b.colorWrite);
+ }
+ }
+
+ if (rpD->hasDepthStencil) {
+ // Must only be set when a depth-stencil buffer will actually be bound,
+ // validation blows up otherwise.
+ MTLPixelFormat fmt = MTLPixelFormat(rpD->dsFormat);
+ rpDesc.depthAttachmentPixelFormat = fmt;
+#if defined(Q_OS_MACOS)
+ if (fmt != MTLPixelFormatDepth16Unorm && fmt != MTLPixelFormatDepth32Float)
+#else
+ if (fmt != MTLPixelFormatDepth32Float)
+#endif
+ rpDesc.stencilAttachmentPixelFormat = fmt;
+ }
QRHI_RES_RHI(QRhiMetal);
- if (!rhiD->sanityCheckGraphicsPipeline(this))
- return false;
+ rpDesc.rasterSampleCount = NSUInteger(rhiD->effectiveSampleCount(m_sampleCount));
+}
+
+void QMetalGraphicsPipeline::setupMetalDepthStencilDescriptor(void *metalDsDesc)
+{
+ MTLDepthStencilDescriptor *dsDesc = reinterpret_cast<MTLDepthStencilDescriptor *>(metalDsDesc);
+
+ dsDesc.depthCompareFunction = m_depthTest ? toMetalCompareOp(m_depthOp) : MTLCompareFunctionAlways;
+ dsDesc.depthWriteEnabled = m_depthWrite;
+ if (m_stencilTest) {
+ dsDesc.frontFaceStencil = [[MTLStencilDescriptor alloc] init];
+ dsDesc.frontFaceStencil.stencilFailureOperation = toMetalStencilOp(m_stencilFront.failOp);
+ dsDesc.frontFaceStencil.depthFailureOperation = toMetalStencilOp(m_stencilFront.depthFailOp);
+ dsDesc.frontFaceStencil.depthStencilPassOperation = toMetalStencilOp(m_stencilFront.passOp);
+ dsDesc.frontFaceStencil.stencilCompareFunction = toMetalCompareOp(m_stencilFront.compareOp);
+ dsDesc.frontFaceStencil.readMask = m_stencilReadMask;
+ dsDesc.frontFaceStencil.writeMask = m_stencilWriteMask;
+
+ dsDesc.backFaceStencil = [[MTLStencilDescriptor alloc] init];
+ dsDesc.backFaceStencil.stencilFailureOperation = toMetalStencilOp(m_stencilBack.failOp);
+ dsDesc.backFaceStencil.depthFailureOperation = toMetalStencilOp(m_stencilBack.depthFailOp);
+ dsDesc.backFaceStencil.depthStencilPassOperation = toMetalStencilOp(m_stencilBack.passOp);
+ dsDesc.backFaceStencil.stencilCompareFunction = toMetalCompareOp(m_stencilBack.compareOp);
+ dsDesc.backFaceStencil.readMask = m_stencilReadMask;
+ dsDesc.backFaceStencil.writeMask = m_stencilWriteMask;
+ }
+}
+
+void QMetalGraphicsPipeline::mapStates()
+{
+ d->winding = m_frontFace == CCW ? MTLWindingCounterClockwise : MTLWindingClockwise;
+ d->cullMode = toMetalCullMode(m_cullMode);
+ d->triangleFillMode = toMetalTriangleFillMode(m_polygonMode);
+ d->depthBias = float(m_depthBias);
+ d->slopeScaledDepthBias = m_slopeScaledDepthBias;
+}
+void QMetalGraphicsPipelineData::setupVertexInputDescriptor(MTLVertexDescriptor *desc)
+{
// same binding space for vertex and constant buffers - work it around
- const int firstVertexBinding = QRHI_RES(QMetalShaderResourceBindings, m_shaderResourceBindings)->maxBinding + 1;
+ // should be in native resource binding not SPIR-V, but this will work anyway
+ const int firstVertexBinding = QRHI_RES(QMetalShaderResourceBindings, q->shaderResourceBindings())->maxBinding + 1;
- MTLVertexDescriptor *inputLayout = [MTLVertexDescriptor vertexDescriptor];
- for (auto it = m_vertexInputLayout.cbeginAttributes(), itEnd = m_vertexInputLayout.cendAttributes();
+ QRhiVertexInputLayout vertexInputLayout = q->vertexInputLayout();
+ for (auto it = vertexInputLayout.cbeginAttributes(), itEnd = vertexInputLayout.cendAttributes();
it != itEnd; ++it)
{
const uint loc = uint(it->location());
- inputLayout.attributes[loc].format = toMetalAttributeFormat(it->format());
- inputLayout.attributes[loc].offset = NSUInteger(it->offset());
- inputLayout.attributes[loc].bufferIndex = NSUInteger(firstVertexBinding + it->binding());
+ desc.attributes[loc].format = decltype(desc.attributes[loc].format)(toMetalAttributeFormat(it->format()));
+ desc.attributes[loc].offset = NSUInteger(it->offset());
+ desc.attributes[loc].bufferIndex = NSUInteger(firstVertexBinding + it->binding());
}
int bindingIndex = 0;
- for (auto it = m_vertexInputLayout.cbeginBindings(), itEnd = m_vertexInputLayout.cendBindings();
+ const NSUInteger viewCount = qMax<NSUInteger>(1, q->multiViewCount());
+ for (auto it = vertexInputLayout.cbeginBindings(), itEnd = vertexInputLayout.cendBindings();
it != itEnd; ++it, ++bindingIndex)
{
const uint layoutIdx = uint(firstVertexBinding + bindingIndex);
- inputLayout.layouts[layoutIdx].stepFunction =
- it->classification() == QRhiVertexInputBinding::PerInstance
- ? MTLVertexStepFunctionPerInstance : MTLVertexStepFunctionPerVertex;
- inputLayout.layouts[layoutIdx].stepRate = NSUInteger(it->instanceStepRate());
- inputLayout.layouts[layoutIdx].stride = it->stride();
+ desc.layouts[layoutIdx].stepFunction =
+ it->classification() == QRhiVertexInputBinding::PerInstance
+ ? MTLVertexStepFunctionPerInstance : MTLVertexStepFunctionPerVertex;
+ desc.layouts[layoutIdx].stepRate = NSUInteger(it->instanceStepRate());
+ if (desc.layouts[layoutIdx].stepFunction == MTLVertexStepFunctionPerInstance)
+ desc.layouts[layoutIdx].stepRate *= viewCount;
+ desc.layouts[layoutIdx].stride = it->stride();
}
+}
- MTLRenderPipelineDescriptor *rpDesc = [[MTLRenderPipelineDescriptor alloc] init];
+void QMetalGraphicsPipelineData::setupStageInputDescriptor(MTLStageInputOutputDescriptor *desc)
+{
+ // same binding space for vertex and constant buffers - work it around
+ // should be in native resource binding not SPIR-V, but this will work anyway
+ const int firstVertexBinding = QRHI_RES(QMetalShaderResourceBindings, q->shaderResourceBindings())->maxBinding + 1;
+
+ QRhiVertexInputLayout vertexInputLayout = q->vertexInputLayout();
+ for (auto it = vertexInputLayout.cbeginAttributes(), itEnd = vertexInputLayout.cendAttributes();
+ it != itEnd; ++it)
+ {
+ const uint loc = uint(it->location());
+ desc.attributes[loc].format = decltype(desc.attributes[loc].format)(toMetalAttributeFormat(it->format()));
+ desc.attributes[loc].offset = NSUInteger(it->offset());
+ desc.attributes[loc].bufferIndex = NSUInteger(firstVertexBinding + it->binding());
+ }
+ int bindingIndex = 0;
+ for (auto it = vertexInputLayout.cbeginBindings(), itEnd = vertexInputLayout.cendBindings();
+ it != itEnd; ++it, ++bindingIndex)
+ {
+ const uint layoutIdx = uint(firstVertexBinding + bindingIndex);
+ if (desc.indexBufferIndex) {
+ desc.layouts[layoutIdx].stepFunction =
+ it->classification() == QRhiVertexInputBinding::PerInstance
+ ? MTLStepFunctionThreadPositionInGridY : MTLStepFunctionThreadPositionInGridXIndexed;
+ } else {
+ desc.layouts[layoutIdx].stepFunction =
+ it->classification() == QRhiVertexInputBinding::PerInstance
+ ? MTLStepFunctionThreadPositionInGridY : MTLStepFunctionThreadPositionInGridX;
+ }
+ desc.layouts[layoutIdx].stepRate = NSUInteger(it->instanceStepRate());
+ desc.layouts[layoutIdx].stride = it->stride();
+ }
+}
+
+void QRhiMetalData::trySeedingRenderPipelineFromBinaryArchive(MTLRenderPipelineDescriptor *rpDesc)
+{
+ if (@available(macOS 11.0, iOS 14.0, *)) {
+ if (binArch) {
+ NSArray *binArchArray = [NSArray arrayWithObjects: binArch, nil];
+ rpDesc.binaryArchives = binArchArray;
+ }
+ }
+}
+
+void QRhiMetalData::addRenderPipelineToBinaryArchive(MTLRenderPipelineDescriptor *rpDesc)
+{
+ if (@available(macOS 11.0, iOS 14.0, *)) {
+ if (binArch) {
+ NSError *err = nil;
+ if (![binArch addRenderPipelineFunctionsWithDescriptor: rpDesc error: &err]) {
+ const QString msg = QString::fromNSString(err.localizedDescription);
+ qWarning("Failed to collect render pipeline functions to binary archive: %s", qPrintable(msg));
+ }
+ }
+ }
+}
+
+bool QMetalGraphicsPipeline::createVertexFragmentPipeline()
+{
+ QRHI_RES_RHI(QRhiMetal);
+
+ MTLVertexDescriptor *vertexDesc = [MTLVertexDescriptor vertexDescriptor];
+ d->setupVertexInputDescriptor(vertexDesc);
- rpDesc.vertexDescriptor = inputLayout;
+ MTLRenderPipelineDescriptor *rpDesc = [[MTLRenderPipelineDescriptor alloc] init];
+ rpDesc.vertexDescriptor = vertexDesc;
- // mutability cannot be determined (slotted buffers could be set as
+ // Mutability cannot be determined (slotted buffers could be set as
// MTLMutabilityImmutable, but then we potentially need a different
// descriptor for each buffer combination as this depends on the actual
- // buffers not just the resource binding layout) so leave it at the default
+ // buffers not just the resource binding layout), so leave
+ // rpDesc.vertex/fragmentBuffers at the defaults.
- for (const QRhiShaderStage &shaderStage : qAsConst(m_shaderStages)) {
+ for (const QRhiShaderStage &shaderStage : std::as_const(m_shaderStages)) {
auto cacheIt = rhiD->d->shaderCache.constFind(shaderStage);
if (cacheIt != rhiD->d->shaderCache.constEnd()) {
switch (shaderStage.type()) {
@@ -3318,15 +5037,16 @@ bool QMetalGraphicsPipeline::build()
if (rhiD->d->shaderCache.count() >= QRhiMetal::MAX_SHADER_CACHE_ENTRIES) {
// Use the simplest strategy: too many cached shaders -> drop them all.
for (QMetalShader &s : rhiD->d->shaderCache)
- s.release();
+ s.destroy();
rhiD->d->shaderCache.clear();
}
switch (shaderStage.type()) {
case QRhiShaderStage::Vertex:
d->vs.lib = lib;
d->vs.func = func;
- if (const QShader::NativeResourceBindingMap *map = shader.nativeResourceBindingMap(activeKey))
- d->vs.nativeResourceBindingMap = *map;
+ d->vs.nativeResourceBindingMap = shader.nativeResourceBindingMap(activeKey);
+ d->vs.desc = shader.description();
+ d->vs.nativeShaderInfo = shader.nativeShaderInfo(activeKey);
rhiD->d->shaderCache.insert(shaderStage, d->vs);
[d->vs.lib retain];
[d->vs.func retain];
@@ -3335,8 +5055,9 @@ bool QMetalGraphicsPipeline::build()
case QRhiShaderStage::Fragment:
d->fs.lib = lib;
d->fs.func = func;
- if (const QShader::NativeResourceBindingMap *map = shader.nativeResourceBindingMap(activeKey))
- d->fs.nativeResourceBindingMap = *map;
+ d->fs.nativeResourceBindingMap = shader.nativeResourceBindingMap(activeKey);
+ d->fs.desc = shader.description();
+ d->fs.nativeShaderInfo = shader.nativeShaderInfo(activeKey);
rhiD->d->shaderCache.insert(shaderStage, d->fs);
[d->fs.lib retain];
[d->fs.func retain];
@@ -3351,83 +5072,838 @@ bool QMetalGraphicsPipeline::build()
}
QMetalRenderPassDescriptor *rpD = QRHI_RES(QMetalRenderPassDescriptor, m_renderPassDesc);
+ setupAttachmentsInMetalRenderPassDescriptor(rpDesc, rpD);
- if (rpD->colorAttachmentCount) {
- // defaults when no targetBlends are provided
- rpDesc.colorAttachments[0].pixelFormat = MTLPixelFormat(rpD->colorFormat[0]);
- rpDesc.colorAttachments[0].writeMask = MTLColorWriteMaskAll;
- rpDesc.colorAttachments[0].blendingEnabled = false;
+ if (m_multiViewCount >= 2)
+ rpDesc.inputPrimitiveTopology = toMetalPrimitiveTopologyClass(m_topology);
- Q_ASSERT(m_targetBlends.count() == rpD->colorAttachmentCount
- || (m_targetBlends.isEmpty() && rpD->colorAttachmentCount == 1));
+ rhiD->d->trySeedingRenderPipelineFromBinaryArchive(rpDesc);
- for (uint i = 0, ie = uint(m_targetBlends.count()); i != ie; ++i) {
- const QRhiGraphicsPipeline::TargetBlend &b(m_targetBlends[int(i)]);
- rpDesc.colorAttachments[i].pixelFormat = MTLPixelFormat(rpD->colorFormat[i]);
- rpDesc.colorAttachments[i].blendingEnabled = b.enable;
- rpDesc.colorAttachments[i].sourceRGBBlendFactor = toMetalBlendFactor(b.srcColor);
- rpDesc.colorAttachments[i].destinationRGBBlendFactor = toMetalBlendFactor(b.dstColor);
- rpDesc.colorAttachments[i].rgbBlendOperation = toMetalBlendOp(b.opColor);
- rpDesc.colorAttachments[i].sourceAlphaBlendFactor = toMetalBlendFactor(b.srcAlpha);
- rpDesc.colorAttachments[i].destinationAlphaBlendFactor = toMetalBlendFactor(b.dstAlpha);
- rpDesc.colorAttachments[i].alphaBlendOperation = toMetalBlendOp(b.opAlpha);
- rpDesc.colorAttachments[i].writeMask = toMetalColorWriteMask(b.colorWrite);
+ if (rhiD->rhiFlags.testFlag(QRhi::EnablePipelineCacheDataSave))
+ rhiD->d->addRenderPipelineToBinaryArchive(rpDesc);
+
+ NSError *err = nil;
+ d->ps = [rhiD->d->dev newRenderPipelineStateWithDescriptor: rpDesc error: &err];
+ [rpDesc release];
+ if (!d->ps) {
+ const QString msg = QString::fromNSString(err.localizedDescription);
+ qWarning("Failed to create render pipeline state: %s", qPrintable(msg));
+ return false;
+ }
+
+ MTLDepthStencilDescriptor *dsDesc = [[MTLDepthStencilDescriptor alloc] init];
+ setupMetalDepthStencilDescriptor(dsDesc);
+ d->ds = [rhiD->d->dev newDepthStencilStateWithDescriptor: dsDesc];
+ [dsDesc release];
+
+ d->primitiveType = toMetalPrimitiveType(m_topology);
+ mapStates();
+
+ return true;
+}
+
+int QMetalGraphicsPipelineData::Tessellation::vsCompVariantToIndex(QShader::Variant vertexCompVariant)
+{
+ switch (vertexCompVariant) {
+ case QShader::NonIndexedVertexAsComputeShader:
+ return 0;
+ case QShader::UInt32IndexedVertexAsComputeShader:
+ return 1;
+ case QShader::UInt16IndexedVertexAsComputeShader:
+ return 2;
+ default:
+ break;
+ }
+ return -1;
+}
+
+id<MTLComputePipelineState> QMetalGraphicsPipelineData::Tessellation::vsCompPipeline(QRhiMetal *rhiD, QShader::Variant vertexCompVariant)
+{
+ const int varIndex = vsCompVariantToIndex(vertexCompVariant);
+ if (varIndex >= 0 && vertexComputeState[varIndex])
+ return vertexComputeState[varIndex];
+
+ id<MTLFunction> func = nil;
+ if (varIndex >= 0)
+ func = compVs[varIndex].func;
+
+ if (!func) {
+ qWarning("No compute function found for vertex shader translated for tessellation, this should not happen");
+ return nil;
+ }
+
+ const QMap<int, int> &ebb(compVs[varIndex].nativeShaderInfo.extraBufferBindings);
+ const int indexBufferBinding = ebb.value(QShaderPrivate::MslTessVertIndicesBufferBinding, -1);
+
+ MTLComputePipelineDescriptor *cpDesc = [MTLComputePipelineDescriptor new];
+ cpDesc.computeFunction = func;
+ cpDesc.threadGroupSizeIsMultipleOfThreadExecutionWidth = YES;
+ cpDesc.stageInputDescriptor = [MTLStageInputOutputDescriptor stageInputOutputDescriptor];
+ if (indexBufferBinding >= 0) {
+ if (vertexCompVariant == QShader::UInt32IndexedVertexAsComputeShader) {
+ cpDesc.stageInputDescriptor.indexType = MTLIndexTypeUInt32;
+ cpDesc.stageInputDescriptor.indexBufferIndex = indexBufferBinding;
+ } else if (vertexCompVariant == QShader::UInt16IndexedVertexAsComputeShader) {
+ cpDesc.stageInputDescriptor.indexType = MTLIndexTypeUInt16;
+ cpDesc.stageInputDescriptor.indexBufferIndex = indexBufferBinding;
}
}
+ q->setupStageInputDescriptor(cpDesc.stageInputDescriptor);
- if (rpD->hasDepthStencil) {
- // Must only be set when a depth-stencil buffer will actually be bound,
- // validation blows up otherwise.
- MTLPixelFormat fmt = MTLPixelFormat(rpD->dsFormat);
- rpDesc.depthAttachmentPixelFormat = fmt;
-#ifdef Q_OS_MACOS
- if (fmt != MTLPixelFormatDepth16Unorm && fmt != MTLPixelFormatDepth32Float)
-#else
- if (fmt != MTLPixelFormatDepth32Float)
-#endif
- rpDesc.stencilAttachmentPixelFormat = fmt;
+ rhiD->d->trySeedingComputePipelineFromBinaryArchive(cpDesc);
+
+ if (rhiD->rhiFlags.testFlag(QRhi::EnablePipelineCacheDataSave))
+ rhiD->d->addComputePipelineToBinaryArchive(cpDesc);
+
+ NSError *err = nil;
+ id<MTLComputePipelineState> ps = [rhiD->d->dev newComputePipelineStateWithDescriptor: cpDesc
+ options: MTLPipelineOptionNone
+ reflection: nil
+ error: &err];
+ [cpDesc release];
+ if (!ps) {
+ const QString msg = QString::fromNSString(err.localizedDescription);
+ qWarning("Failed to create compute pipeline state: %s", qPrintable(msg));
+ } else {
+ vertexComputeState[varIndex] = ps;
}
+ // not retained, the only owner is vertexComputeState and so the QRhiGraphicsPipeline
+ return ps;
+}
- rpDesc.sampleCount = NSUInteger(rhiD->effectiveSampleCount(m_sampleCount));
+id<MTLComputePipelineState> QMetalGraphicsPipelineData::Tessellation::tescCompPipeline(QRhiMetal *rhiD)
+{
+ if (tessControlComputeState)
+ return tessControlComputeState;
+
+ MTLComputePipelineDescriptor *cpDesc = [MTLComputePipelineDescriptor new];
+ cpDesc.computeFunction = compTesc.func;
+
+ rhiD->d->trySeedingComputePipelineFromBinaryArchive(cpDesc);
+
+ if (rhiD->rhiFlags.testFlag(QRhi::EnablePipelineCacheDataSave))
+ rhiD->d->addComputePipelineToBinaryArchive(cpDesc);
NSError *err = nil;
- d->ps = [rhiD->d->dev newRenderPipelineStateWithDescriptor: rpDesc error: &err];
- if (!d->ps) {
+ id<MTLComputePipelineState> ps = [rhiD->d->dev newComputePipelineStateWithDescriptor: cpDesc
+ options: MTLPipelineOptionNone
+ reflection: nil
+ error: &err];
+ [cpDesc release];
+ if (!ps) {
const QString msg = QString::fromNSString(err.localizedDescription);
- qWarning("Failed to create render pipeline state: %s", qPrintable(msg));
- [rpDesc release];
- return false;
+ qWarning("Failed to create compute pipeline state: %s", qPrintable(msg));
+ } else {
+ tessControlComputeState = ps;
+ }
+ // not retained, the only owner is tessControlComputeState and so the QRhiGraphicsPipeline
+ return ps;
+}
+
+static inline bool indexTaken(quint32 index, quint64 indices)
+{
+ return (indices >> index) & 0x1;
+}
+
+static inline void takeIndex(quint32 index, quint64 &indices)
+{
+ indices |= 1 << index;
+}
+
+static inline int nextAttributeIndex(quint64 indices)
+{
+ // Maximum number of vertex attributes per vertex descriptor. There does
+ // not appear to be a way to query this from the implementation.
+ // https://developer.apple.com/metal/Metal-Feature-Set-Tables.pdf indicates
+ // that all GPU families have a value of 31.
+ static const int maxVertexAttributes = 31;
+
+ for (int index = 0; index < maxVertexAttributes; ++index) {
+ if (!indexTaken(index, indices))
+ return index;
+ }
+
+ Q_UNREACHABLE_RETURN(-1);
+}
+
+static inline int aligned(quint32 offset, quint32 alignment)
+{
+ return ((offset + alignment - 1) / alignment) * alignment;
+}
+
+template<typename T>
+static void addUnusedVertexAttribute(const T &variable, QRhiMetal *rhiD, quint32 &offset, quint32 &vertexAlignment)
+{
+
+ int elements = 1;
+ for (const int dim : variable.arrayDims)
+ elements *= dim;
+
+ if (variable.type == QShaderDescription::VariableType::Struct) {
+ for (int element = 0; element < elements; ++element) {
+ for (const auto &member : variable.structMembers) {
+ addUnusedVertexAttribute(member, rhiD, offset, vertexAlignment);
+ }
+ }
+ } else {
+ const QRhiVertexInputAttribute::Format format = rhiD->shaderDescVariableFormatToVertexInputFormat(variable.type);
+ const quint32 size = rhiD->byteSizePerVertexForVertexInputFormat(format);
+
+ // MSL specification 3.0 says alignment = size for non packed scalars and vectors
+ const quint32 alignment = size;
+ vertexAlignment = std::max(vertexAlignment, alignment);
+
+ for (int element = 0; element < elements; ++element) {
+ // adjust alignment
+ offset = aligned(offset, alignment);
+ offset += size;
+ }
+ }
+}
+
+template<typename T>
+static void addVertexAttribute(const T &variable, int binding, QRhiMetal *rhiD, int &index, quint32 &offset, MTLVertexAttributeDescriptorArray *attributes, quint64 &indices, quint32 &vertexAlignment)
+{
+
+ int elements = 1;
+ for (const int dim : variable.arrayDims)
+ elements *= dim;
+
+ if (variable.type == QShaderDescription::VariableType::Struct) {
+ for (int element = 0; element < elements; ++element) {
+ for (const auto &member : variable.structMembers) {
+ addVertexAttribute(member, binding, rhiD, index, offset, attributes, indices, vertexAlignment);
+ }
+ }
+ } else {
+ const QRhiVertexInputAttribute::Format format = rhiD->shaderDescVariableFormatToVertexInputFormat(variable.type);
+ const quint32 size = rhiD->byteSizePerVertexForVertexInputFormat(format);
+
+ // MSL specification 3.0 says alignment = size for non packed scalars and vectors
+ const quint32 alignment = size;
+ vertexAlignment = std::max(vertexAlignment, alignment);
+
+ for (int element = 0; element < elements; ++element) {
+ Q_ASSERT(!indexTaken(index, indices));
+
+ // adjust alignment
+ offset = aligned(offset, alignment);
+
+ attributes[index].bufferIndex = binding;
+ attributes[index].format = toMetalAttributeFormat(format);
+ attributes[index].offset = offset;
+
+ takeIndex(index, indices);
+ index++;
+ if (indexTaken(index, indices))
+ index = nextAttributeIndex(indices);
+
+ offset += size;
+ }
+ }
+}
+
+static inline bool matches(const QList<QShaderDescription::BlockVariable> &a, const QList<QShaderDescription::BlockVariable> &b)
+{
+ if (a.size() == b.size()) {
+ bool match = true;
+ for (int i = 0; i < a.size() && match; ++i) {
+ match &= a[i].type == b[i].type
+ && a[i].arrayDims == b[i].arrayDims
+ && matches(a[i].structMembers, b[i].structMembers);
+ }
+ return match;
+ }
+
+ return false;
+}
+
+static inline bool matches(const QShaderDescription::InOutVariable &a, const QShaderDescription::InOutVariable &b)
+{
+ return a.location == b.location
+ && a.type == b.type
+ && a.perPatch == b.perPatch
+ && matches(a.structMembers, b.structMembers);
+}
+
+//
+// Create the tessellation evaluation render pipeline state
+//
+// The tesc runs as a compute shader in a compute pipeline and writes per patch and per patch
+// control point data into separate storage buffers. The tese runs as a vertex shader in a render
+// pipeline. Our task is to generate a render pipeline descriptor for the tese that pulls vertices
+// from these buffers.
+//
+// As the buffers we are pulling vertices from are written by a compute pipeline, they follow the
+// MSL alignment conventions which we must take into account when generating our
+// MTLVertexDescriptor. We must include the user defined tese input attributes, and any builtins
+// that were used.
+//
+// SPIRV-Cross generates the MSL tese shader code with input attribute indices that reflect the
+// specified GLSL locations. Interface blocks are flattened with each member having an incremented
+// attribute index. SPIRV-Cross reports an error on compilation if there are clashes in the index
+// address space.
+//
+// After the user specified attributes are processed, SPIRV-Cross places the in-use builtins at the
+// next available (lowest value) attribute index. Tese builtins are processed in the following
+// order:
+//
+// in gl_PerVertex
+// {
+// vec4 gl_Position;
+// float gl_PointSize;
+// float gl_ClipDistance[];
+// };
+//
+// patch in float gl_TessLevelOuter[4];
+// patch in float gl_TessLevelInner[2];
+//
+// Enumerations in QShaderDescription::BuiltinType are defined in this order.
+//
+// For quads, SPIRV-Cross places MTLQuadTessellationFactorsHalf per patch in the tessellation
+// factor buffer. For triangles it uses MTLTriangleTessellationFactorsHalf.
+//
+// It should be noted that SPIRV-Cross handles the following builtin inputs internally, with no
+// host side support required.
+//
+// in vec3 gl_TessCoord;
+// in int gl_PatchVerticesIn;
+// in int gl_PrimitiveID;
+//
+id<MTLRenderPipelineState> QMetalGraphicsPipelineData::Tessellation::teseFragRenderPipeline(QRhiMetal *rhiD, QMetalGraphicsPipeline *pipeline)
+{
+ if (pipeline->d->ps)
+ return pipeline->d->ps;
+
+ MTLRenderPipelineDescriptor *rpDesc = [[MTLRenderPipelineDescriptor alloc] init];
+ MTLVertexDescriptor *vertexDesc = [MTLVertexDescriptor vertexDescriptor];
+
+ // tesc output buffers
+ const QMap<int, int> &ebb(compTesc.nativeShaderInfo.extraBufferBindings);
+ const int tescOutputBufferBinding = ebb.value(QShaderPrivate::MslTessVertTescOutputBufferBinding, -1);
+ const int tescPatchOutputBufferBinding = ebb.value(QShaderPrivate::MslTessTescPatchOutputBufferBinding, -1);
+ const int tessFactorBufferBinding = ebb.value(QShaderPrivate::MslTessTescTessLevelBufferBinding, -1);
+ quint32 offsetInTescOutput = 0;
+ quint32 offsetInTescPatchOutput = 0;
+ quint32 offsetInTessFactorBuffer = 0;
+ quint32 tescOutputAlignment = 0;
+ quint32 tescPatchOutputAlignment = 0;
+ quint32 tessFactorAlignment = 0;
+ QSet<int> usedBuffers;
+
+ // tesc output variables in ascending location order
+ QMap<int, QShaderDescription::InOutVariable> tescOutVars;
+ for (const auto &tescOutVar : compTesc.desc.outputVariables())
+ tescOutVars[tescOutVar.location] = tescOutVar;
+
+ // tese input variables in ascending location order
+ QMap<int, QShaderDescription::InOutVariable> teseInVars;
+ for (const auto &teseInVar : vertTese.desc.inputVariables())
+ teseInVars[teseInVar.location] = teseInVar;
+
+ // bit mask tracking usage of vertex attribute indices
+ quint64 indices = 0;
+
+ for (QShaderDescription::InOutVariable &tescOutVar : tescOutVars) {
+
+ int index = tescOutVar.location;
+ int binding = -1;
+ quint32 *offset = nullptr;
+ quint32 *alignment = nullptr;
+
+ if (tescOutVar.perPatch) {
+ binding = tescPatchOutputBufferBinding;
+ offset = &offsetInTescPatchOutput;
+ alignment = &tescPatchOutputAlignment;
+ } else {
+ tescOutVar.arrayDims.removeLast();
+ binding = tescOutputBufferBinding;
+ offset = &offsetInTescOutput;
+ alignment = &tescOutputAlignment;
+ }
+
+ if (teseInVars.contains(index)) {
+
+ if (!matches(teseInVars[index], tescOutVar)) {
+ qWarning() << "mismatched tessellation control output -> tesssellation evaluation input at location" << index;
+ qWarning() << " tesc out:" << tescOutVar;
+ qWarning() << " tese in:" << teseInVars[index];
+ }
+
+ if (binding != -1) {
+ addVertexAttribute(tescOutVar, binding, rhiD, index, *offset, vertexDesc.attributes, indices, *alignment);
+ usedBuffers << binding;
+ } else {
+ qWarning() << "baked tessellation control shader missing output buffer binding information";
+ addUnusedVertexAttribute(tescOutVar, rhiD, *offset, *alignment);
+ }
+
+ } else {
+ qWarning() << "missing tessellation evaluation input for tessellation control output:" << tescOutVar;
+ addUnusedVertexAttribute(tescOutVar, rhiD, *offset, *alignment);
+ }
+
+ teseInVars.remove(tescOutVar.location);
+ }
+
+ for (const QShaderDescription::InOutVariable &teseInVar : teseInVars)
+ qWarning() << "missing tessellation control output for tessellation evaluation input:" << teseInVar;
+
+ // tesc output builtins in ascending location order
+ QMap<QShaderDescription::BuiltinType, QShaderDescription::BuiltinVariable> tescOutBuiltins;
+ for (const auto &tescOutBuiltin : compTesc.desc.outputBuiltinVariables())
+ tescOutBuiltins[tescOutBuiltin.type] = tescOutBuiltin;
+
+ // tese input builtins in ascending location order
+ QMap<QShaderDescription::BuiltinType, QShaderDescription::BuiltinVariable> teseInBuiltins;
+ for (const auto &teseInBuiltin : vertTese.desc.inputBuiltinVariables())
+ teseInBuiltins[teseInBuiltin.type] = teseInBuiltin;
+
+ const bool trianglesMode = vertTese.desc.tessellationMode() == QShaderDescription::TrianglesTessellationMode;
+ bool tessLevelAdded = false;
+
+ for (const QShaderDescription::BuiltinVariable &builtin : tescOutBuiltins) {
+
+ QShaderDescription::InOutVariable variable;
+ int binding = -1;
+ quint32 *offset = nullptr;
+ quint32 *alignment = nullptr;
+
+ switch (builtin.type) {
+ case QShaderDescription::BuiltinType::PositionBuiltin:
+ variable.type = QShaderDescription::VariableType::Vec4;
+ binding = tescOutputBufferBinding;
+ offset = &offsetInTescOutput;
+ alignment = &tescOutputAlignment;
+ break;
+ case QShaderDescription::BuiltinType::PointSizeBuiltin:
+ variable.type = QShaderDescription::VariableType::Float;
+ binding = tescOutputBufferBinding;
+ offset = &offsetInTescOutput;
+ alignment = &tescOutputAlignment;
+ break;
+ case QShaderDescription::BuiltinType::ClipDistanceBuiltin:
+ variable.type = QShaderDescription::VariableType::Float;
+ variable.arrayDims = builtin.arrayDims;
+ binding = tescOutputBufferBinding;
+ offset = &offsetInTescOutput;
+ alignment = &tescOutputAlignment;
+ break;
+ case QShaderDescription::BuiltinType::TessLevelOuterBuiltin:
+ variable.type = QShaderDescription::VariableType::Half4;
+ binding = tessFactorBufferBinding;
+ offset = &offsetInTessFactorBuffer;
+ tessLevelAdded = trianglesMode;
+ alignment = &tessFactorAlignment;
+ break;
+ case QShaderDescription::BuiltinType::TessLevelInnerBuiltin:
+ if (trianglesMode) {
+ if (!tessLevelAdded) {
+ variable.type = QShaderDescription::VariableType::Half4;
+ binding = tessFactorBufferBinding;
+ offsetInTessFactorBuffer = 0;
+ offset = &offsetInTessFactorBuffer;
+ alignment = &tessFactorAlignment;
+ tessLevelAdded = true;
+ } else {
+ teseInBuiltins.remove(builtin.type);
+ continue;
+ }
+ } else {
+ variable.type = QShaderDescription::VariableType::Half2;
+ binding = tessFactorBufferBinding;
+ offsetInTessFactorBuffer = 8;
+ offset = &offsetInTessFactorBuffer;
+ alignment = &tessFactorAlignment;
+ }
+ break;
+ default:
+ Q_UNREACHABLE();
+ break;
+ }
+
+ if (teseInBuiltins.contains(builtin.type)) {
+ if (binding != -1) {
+ int index = nextAttributeIndex(indices);
+ addVertexAttribute(variable, binding, rhiD, index, *offset, vertexDesc.attributes, indices, *alignment);
+ usedBuffers << binding;
+ } else {
+ qWarning() << "baked tessellation control shader missing output buffer binding information";
+ addUnusedVertexAttribute(variable, rhiD, *offset, *alignment);
+ }
+ } else {
+ addUnusedVertexAttribute(variable, rhiD, *offset, *alignment);
+ }
+
+ teseInBuiltins.remove(builtin.type);
+ }
+
+ for (const QShaderDescription::BuiltinVariable &builtin : teseInBuiltins) {
+ switch (builtin.type) {
+ case QShaderDescription::BuiltinType::PositionBuiltin:
+ case QShaderDescription::BuiltinType::PointSizeBuiltin:
+ case QShaderDescription::BuiltinType::ClipDistanceBuiltin:
+ qWarning() << "missing tessellation control output for tessellation evaluation builtin input:" << builtin;
+ break;
+ default:
+ break;
+ }
+ }
+
+ if (usedBuffers.contains(tescOutputBufferBinding)) {
+ vertexDesc.layouts[tescOutputBufferBinding].stepFunction = MTLVertexStepFunctionPerPatchControlPoint;
+ vertexDesc.layouts[tescOutputBufferBinding].stride = aligned(offsetInTescOutput, tescOutputAlignment);
+ }
+
+ if (usedBuffers.contains(tescPatchOutputBufferBinding)) {
+ vertexDesc.layouts[tescPatchOutputBufferBinding].stepFunction = MTLVertexStepFunctionPerPatch;
+ vertexDesc.layouts[tescPatchOutputBufferBinding].stride = aligned(offsetInTescPatchOutput, tescPatchOutputAlignment);
}
+
+ if (usedBuffers.contains(tessFactorBufferBinding)) {
+ vertexDesc.layouts[tessFactorBufferBinding].stepFunction = MTLVertexStepFunctionPerPatch;
+ vertexDesc.layouts[tessFactorBufferBinding].stride = trianglesMode ? sizeof(MTLTriangleTessellationFactorsHalf) : sizeof(MTLQuadTessellationFactorsHalf);
+ }
+
+ rpDesc.vertexDescriptor = vertexDesc;
+ rpDesc.vertexFunction = vertTese.func;
+ rpDesc.fragmentFunction = pipeline->d->fs.func;
+
+ // The portable, cross-API approach is to use CCW, the results are then
+ // identical (assuming the applied clipSpaceCorrMatrix) for all the 3D
+ // APIs. The tess.eval. GLSL shader is thus expected to specify ccw. If it
+ // doesn't, things may not work as expected.
+ rpDesc.tessellationOutputWindingOrder = toMetalTessellationWindingOrder(vertTese.desc.tessellationWindingOrder());
+
+ rpDesc.tessellationPartitionMode = toMetalTessellationPartitionMode(vertTese.desc.tessellationPartitioning());
+
+ QMetalRenderPassDescriptor *rpD = QRHI_RES(QMetalRenderPassDescriptor, pipeline->renderPassDescriptor());
+ pipeline->setupAttachmentsInMetalRenderPassDescriptor(rpDesc, rpD);
+
+ rhiD->d->trySeedingRenderPipelineFromBinaryArchive(rpDesc);
+
+ if (rhiD->rhiFlags.testFlag(QRhi::EnablePipelineCacheDataSave))
+ rhiD->d->addRenderPipelineToBinaryArchive(rpDesc);
+
+ NSError *err = nil;
+ id<MTLRenderPipelineState> ps = [rhiD->d->dev newRenderPipelineStateWithDescriptor: rpDesc error: &err];
[rpDesc release];
+ if (!ps) {
+ const QString msg = QString::fromNSString(err.localizedDescription);
+ qWarning("Failed to create render pipeline state for tessellation: %s", qPrintable(msg));
+ } else {
+ // ps is stored in the QMetalGraphicsPipelineData so the end result in this
+ // regard is no different from what createVertexFragmentPipeline does
+ pipeline->d->ps = ps;
+ }
+ return ps;
+}
- MTLDepthStencilDescriptor *dsDesc = [[MTLDepthStencilDescriptor alloc] init];
- dsDesc.depthCompareFunction = m_depthTest ? toMetalCompareOp(m_depthOp) : MTLCompareFunctionAlways;
- dsDesc.depthWriteEnabled = m_depthWrite;
- if (m_stencilTest) {
- dsDesc.frontFaceStencil = [[MTLStencilDescriptor alloc] init];
- dsDesc.frontFaceStencil.stencilFailureOperation = toMetalStencilOp(m_stencilFront.failOp);
- dsDesc.frontFaceStencil.depthFailureOperation = toMetalStencilOp(m_stencilFront.depthFailOp);
- dsDesc.frontFaceStencil.depthStencilPassOperation = toMetalStencilOp(m_stencilFront.passOp);
- dsDesc.frontFaceStencil.stencilCompareFunction = toMetalCompareOp(m_stencilFront.compareOp);
- dsDesc.frontFaceStencil.readMask = m_stencilReadMask;
- dsDesc.frontFaceStencil.writeMask = m_stencilWriteMask;
+QMetalBuffer *QMetalGraphicsPipelineData::ExtraBufferManager::acquireWorkBuffer(QRhiMetal *rhiD, quint32 size, WorkBufType type)
+{
+ QVector<QMetalBuffer *> *workBuffers = type == WorkBufType::DeviceLocal ? &deviceLocalWorkBuffers : &hostVisibleWorkBuffers;
- dsDesc.backFaceStencil = [[MTLStencilDescriptor alloc] init];
- dsDesc.backFaceStencil.stencilFailureOperation = toMetalStencilOp(m_stencilBack.failOp);
- dsDesc.backFaceStencil.depthFailureOperation = toMetalStencilOp(m_stencilBack.depthFailOp);
- dsDesc.backFaceStencil.depthStencilPassOperation = toMetalStencilOp(m_stencilBack.passOp);
- dsDesc.backFaceStencil.stencilCompareFunction = toMetalCompareOp(m_stencilBack.compareOp);
- dsDesc.backFaceStencil.readMask = m_stencilReadMask;
- dsDesc.backFaceStencil.writeMask = m_stencilWriteMask;
+ // Check if something is reusable as-is.
+ for (QMetalBuffer *workBuf : *workBuffers) {
+ if (workBuf && workBuf->lastActiveFrameSlot == -1 && workBuf->size() >= size) {
+ workBuf->lastActiveFrameSlot = rhiD->currentFrameSlot;
+ return workBuf;
+ }
+ }
+
+ // Once the pool is above a certain threshold, see if there is something
+ // unused (but too small) and recreate that our size.
+ if (workBuffers->count() > QMTL_FRAMES_IN_FLIGHT * 8) {
+ for (QMetalBuffer *workBuf : *workBuffers) {
+ if (workBuf && workBuf->lastActiveFrameSlot == -1) {
+ workBuf->setSize(size);
+ if (workBuf->create()) {
+ workBuf->lastActiveFrameSlot = rhiD->currentFrameSlot;
+ return workBuf;
+ }
+ }
+ }
+ }
+
+ // Add a new buffer to the pool.
+ QMetalBuffer *buf;
+ if (type == WorkBufType::DeviceLocal) {
+ // for GPU->GPU data (non-slotted, not necessarily host writable)
+ buf = new QMetalBuffer(rhiD, QRhiBuffer::Static, QRhiBuffer::UsageFlags(QMetalBuffer::WorkBufPoolUsage), size);
+ } else {
+ // for CPU->GPU (non-slotted, host writable/coherent)
+ buf = new QMetalBuffer(rhiD, QRhiBuffer::Dynamic, QRhiBuffer::UsageFlags(QMetalBuffer::WorkBufPoolUsage), size);
+ }
+ if (buf->create()) {
+ buf->lastActiveFrameSlot = rhiD->currentFrameSlot;
+ workBuffers->append(buf);
+ return buf;
+ }
+
+ qWarning("Failed to acquire work buffer of size %u", size);
+ return nullptr;
+}
+
+bool QMetalGraphicsPipeline::createTessellationPipelines(const QShader &tessVert, const QShader &tesc, const QShader &tese, const QShader &tessFrag)
+{
+ QRHI_RES_RHI(QRhiMetal);
+ QString error;
+ QByteArray entryPoint;
+ QShaderKey activeKey;
+
+ const QShaderDescription tescDesc = tesc.description();
+ const QShaderDescription teseDesc = tese.description();
+ d->tess.inControlPointCount = uint(m_patchControlPointCount);
+ d->tess.outControlPointCount = tescDesc.tessellationOutputVertexCount();
+ if (!d->tess.outControlPointCount)
+ d->tess.outControlPointCount = teseDesc.tessellationOutputVertexCount();
+
+ if (!d->tess.outControlPointCount) {
+ qWarning("Failed to determine output vertex count from the tessellation control or evaluation shader, cannot tessellate");
+ d->tess.enabled = false;
+ d->tess.failed = true;
+ return false;
+ }
+
+ if (m_multiViewCount >= 2)
+ qWarning("Multiview is not supported with tessellation");
+
+ // Now the vertex shader is a compute shader.
+ // It should have three dedicated *VertexAsComputeShader variants.
+ // What the requested variant was (Standard or Batchable) plays no role here.
+ // (the Qt Quick scenegraph does not use tessellation with its materials)
+ // Create all three versions.
+
+ bool variantsPresent[3] = {};
+ const QVector<QShaderKey> tessVertKeys = tessVert.availableShaders();
+ for (const QShaderKey &k : tessVertKeys) {
+ switch (k.sourceVariant()) {
+ case QShader::NonIndexedVertexAsComputeShader:
+ variantsPresent[0] = true;
+ break;
+ case QShader::UInt32IndexedVertexAsComputeShader:
+ variantsPresent[1] = true;
+ break;
+ case QShader::UInt16IndexedVertexAsComputeShader:
+ variantsPresent[2] = true;
+ break;
+ default:
+ break;
+ }
+ }
+ if (!(variantsPresent[0] && variantsPresent[1] && variantsPresent[2])) {
+ qWarning("Vertex shader is not prepared for Metal tessellation. Cannot tessellate. "
+ "Perhaps the relevant variants (UInt32IndexedVertexAsComputeShader et al) were not generated? "
+ "Try passing --msltess to qsb.");
+ d->tess.enabled = false;
+ d->tess.failed = true;
+ return false;
+ }
+
+ int varIndex = 0; // Will map NonIndexed as 0, UInt32 as 1, UInt16 as 2. Do not change this ordering.
+ for (QShader::Variant variant : {
+ QShader::NonIndexedVertexAsComputeShader,
+ QShader::UInt32IndexedVertexAsComputeShader,
+ QShader::UInt16IndexedVertexAsComputeShader })
+ {
+ id<MTLLibrary> lib = rhiD->d->createMetalLib(tessVert, variant, &error, &entryPoint, &activeKey);
+ if (!lib) {
+ qWarning("MSL shader compilation failed for vertex-as-compute shader %d: %s", int(variant), qPrintable(error));
+ d->tess.enabled = false;
+ d->tess.failed = true;
+ return false;
+ }
+ id<MTLFunction> func = rhiD->d->createMSLShaderFunction(lib, entryPoint);
+ if (!func) {
+ qWarning("MSL function for entry point %s not found", entryPoint.constData());
+ [lib release];
+ d->tess.enabled = false;
+ d->tess.failed = true;
+ return false;
+ }
+ QMetalShader &compVs(d->tess.compVs[varIndex]);
+ compVs.lib = lib;
+ compVs.func = func;
+ compVs.desc = tessVert.description();
+ compVs.nativeResourceBindingMap = tessVert.nativeResourceBindingMap(activeKey);
+ compVs.nativeShaderInfo = tessVert.nativeShaderInfo(activeKey);
+
+ // pre-create all three MTLComputePipelineStates
+ if (!d->tess.vsCompPipeline(rhiD, variant)) {
+ qWarning("Failed to pre-generate compute pipeline for vertex compute shader (tessellation variant %d)", int(variant));
+ d->tess.enabled = false;
+ d->tess.failed = true;
+ return false;
+ }
+
+ ++varIndex;
+ }
+
+ // Pipeline #2 is a compute that runs the tessellation control (compute) shader
+ id<MTLLibrary> tessControlLib = rhiD->d->createMetalLib(tesc, QShader::StandardShader, &error, &entryPoint, &activeKey);
+ if (!tessControlLib) {
+ qWarning("MSL shader compilation failed for tessellation control compute shader: %s", qPrintable(error));
+ d->tess.enabled = false;
+ d->tess.failed = true;
+ return false;
+ }
+ id<MTLFunction> tessControlFunc = rhiD->d->createMSLShaderFunction(tessControlLib, entryPoint);
+ if (!tessControlFunc) {
+ qWarning("MSL function for entry point %s not found", entryPoint.constData());
+ [tessControlLib release];
+ d->tess.enabled = false;
+ d->tess.failed = true;
+ return false;
+ }
+ d->tess.compTesc.lib = tessControlLib;
+ d->tess.compTesc.func = tessControlFunc;
+ d->tess.compTesc.desc = tesc.description();
+ d->tess.compTesc.nativeResourceBindingMap = tesc.nativeResourceBindingMap(activeKey);
+ d->tess.compTesc.nativeShaderInfo = tesc.nativeShaderInfo(activeKey);
+ if (!d->tess.tescCompPipeline(rhiD)) {
+ qWarning("Failed to pre-generate compute pipeline for tessellation control shader");
+ d->tess.enabled = false;
+ d->tess.failed = true;
+ return false;
}
+ // Pipeline #3 is a render pipeline with the tessellation evaluation (vertex) + the fragment shader
+ id<MTLLibrary> tessEvalLib = rhiD->d->createMetalLib(tese, QShader::StandardShader, &error, &entryPoint, &activeKey);
+ if (!tessEvalLib) {
+ qWarning("MSL shader compilation failed for tessellation evaluation vertex shader: %s", qPrintable(error));
+ d->tess.enabled = false;
+ d->tess.failed = true;
+ return false;
+ }
+ id<MTLFunction> tessEvalFunc = rhiD->d->createMSLShaderFunction(tessEvalLib, entryPoint);
+ if (!tessEvalFunc) {
+ qWarning("MSL function for entry point %s not found", entryPoint.constData());
+ [tessEvalLib release];
+ d->tess.enabled = false;
+ d->tess.failed = true;
+ return false;
+ }
+ d->tess.vertTese.lib = tessEvalLib;
+ d->tess.vertTese.func = tessEvalFunc;
+ d->tess.vertTese.desc = tese.description();
+ d->tess.vertTese.nativeResourceBindingMap = tese.nativeResourceBindingMap(activeKey);
+ d->tess.vertTese.nativeShaderInfo = tese.nativeShaderInfo(activeKey);
+
+ id<MTLLibrary> fragLib = rhiD->d->createMetalLib(tessFrag, QShader::StandardShader, &error, &entryPoint, &activeKey);
+ if (!fragLib) {
+ qWarning("MSL shader compilation failed for fragment shader: %s", qPrintable(error));
+ d->tess.enabled = false;
+ d->tess.failed = true;
+ return false;
+ }
+ id<MTLFunction> fragFunc = rhiD->d->createMSLShaderFunction(fragLib, entryPoint);
+ if (!fragFunc) {
+ qWarning("MSL function for entry point %s not found", entryPoint.constData());
+ [fragLib release];
+ d->tess.enabled = false;
+ d->tess.failed = true;
+ return false;
+ }
+ d->fs.lib = fragLib;
+ d->fs.func = fragFunc;
+ d->fs.desc = tessFrag.description();
+ d->fs.nativeShaderInfo = tessFrag.nativeShaderInfo(activeKey);
+ d->fs.nativeResourceBindingMap = tessFrag.nativeResourceBindingMap(activeKey);
+
+ if (!d->tess.teseFragRenderPipeline(rhiD, this)) {
+ qWarning("Failed to pre-generate render pipeline for tessellation evaluation + fragment shader");
+ d->tess.enabled = false;
+ d->tess.failed = true;
+ return false;
+ }
+
+ MTLDepthStencilDescriptor *dsDesc = [[MTLDepthStencilDescriptor alloc] init];
+ setupMetalDepthStencilDescriptor(dsDesc);
d->ds = [rhiD->d->dev newDepthStencilStateWithDescriptor: dsDesc];
[dsDesc release];
- d->primitiveType = toMetalPrimitiveType(m_topology);
- d->winding = m_frontFace == CCW ? MTLWindingCounterClockwise : MTLWindingClockwise;
- d->cullMode = toMetalCullMode(m_cullMode);
+ // no primitiveType
+ mapStates();
+
+ return true;
+}
+
+bool QMetalGraphicsPipeline::create()
+{
+ destroy(); // no early test, always invoke and leave it to destroy to decide what to clean up
+
+ QRHI_RES_RHI(QRhiMetal);
+ rhiD->pipelineCreationStart();
+ if (!rhiD->sanityCheckGraphicsPipeline(this))
+ return false;
+ // See if tessellation is involved. Things will be very different, if so.
+ QShader tessVert;
+ QShader tesc;
+ QShader tese;
+ QShader tessFrag;
+ for (const QRhiShaderStage &shaderStage : std::as_const(m_shaderStages)) {
+ switch (shaderStage.type()) {
+ case QRhiShaderStage::Vertex:
+ tessVert = shaderStage.shader();
+ break;
+ case QRhiShaderStage::TessellationControl:
+ tesc = shaderStage.shader();
+ break;
+ case QRhiShaderStage::TessellationEvaluation:
+ tese = shaderStage.shader();
+ break;
+ case QRhiShaderStage::Fragment:
+ tessFrag = shaderStage.shader();
+ break;
+ default:
+ break;
+ }
+ }
+ d->tess.enabled = tesc.isValid() && tese.isValid() && m_topology == Patches && m_patchControlPointCount > 0;
+ d->tess.failed = false;
+
+ bool ok = d->tess.enabled ? createTessellationPipelines(tessVert, tesc, tese, tessFrag) : createVertexFragmentPipeline();
+ if (!ok)
+ return false;
+
+ // SPIRV-Cross buffer size buffers
+ int buffers = 0;
+ QVarLengthArray<QMetalShader *, 6> shaders;
+ if (d->tess.enabled) {
+ shaders.append(&d->tess.compVs[0]);
+ shaders.append(&d->tess.compVs[1]);
+ shaders.append(&d->tess.compVs[2]);
+ shaders.append(&d->tess.compTesc);
+ shaders.append(&d->tess.vertTese);
+ } else {
+ shaders.append(&d->vs);
+ }
+ shaders.append(&d->fs);
+
+ for (QMetalShader *shader : shaders) {
+ if (shader->nativeShaderInfo.extraBufferBindings.contains(QShaderPrivate::MslBufferSizeBufferBinding)) {
+ const int binding = shader->nativeShaderInfo.extraBufferBindings[QShaderPrivate::MslBufferSizeBufferBinding];
+ shader->nativeResourceBindingMap[binding] = qMakePair(binding, -1);
+ int maxNativeBinding = 0;
+ for (const QShaderDescription::StorageBlock &block : shader->desc.storageBlocks())
+ maxNativeBinding = qMax(maxNativeBinding, shader->nativeResourceBindingMap[block.binding].first);
+
+ // we use one buffer to hold data for all graphics shader stages, each with a different offset.
+ // buffer offsets must be 32byte aligned - adjust buffer count accordingly
+ buffers += ((maxNativeBinding + 1 + 7) / 8) * 8;
+ }
+ }
+
+ if (buffers) {
+ if (!d->bufferSizeBuffer)
+ d->bufferSizeBuffer = new QMetalBuffer(rhiD, QRhiBuffer::Static, QRhiBuffer::StorageBuffer, buffers * sizeof(int));
+
+ d->bufferSizeBuffer->setSize(buffers * sizeof(int));
+ d->bufferSizeBuffer->create();
+ }
+
+ rhiD->pipelineCreationEnd();
lastActiveFrameSlot = -1;
generation += 1;
rhiD->registerResource(this);
@@ -3442,31 +5918,63 @@ QMetalComputePipeline::QMetalComputePipeline(QRhiImplementation *rhi)
QMetalComputePipeline::~QMetalComputePipeline()
{
- release();
+ destroy();
delete d;
}
-void QMetalComputePipeline::release()
+void QMetalComputePipeline::destroy()
{
- QRHI_RES_RHI(QRhiMetal);
-
- d->cs.release();
+ d->cs.destroy();
if (!d->ps)
return;
- [d->ps release];
+ delete d->bufferSizeBuffer;
+ d->bufferSizeBuffer = nullptr;
+
+ QRhiMetalData::DeferredReleaseEntry e;
+ e.type = QRhiMetalData::DeferredReleaseEntry::ComputePipeline;
+ e.lastActiveFrameSlot = lastActiveFrameSlot;
+ e.computePipeline.pipelineState = d->ps;
d->ps = nil;
- rhiD->unregisterResource(this);
+ QRHI_RES_RHI(QRhiMetal);
+ if (rhiD) {
+ rhiD->d->releaseQueue.append(e);
+ rhiD->unregisterResource(this);
+ }
+}
+
+void QRhiMetalData::trySeedingComputePipelineFromBinaryArchive(MTLComputePipelineDescriptor *cpDesc)
+{
+ if (@available(macOS 11.0, iOS 14.0, *)) {
+ if (binArch) {
+ NSArray *binArchArray = [NSArray arrayWithObjects: binArch, nil];
+ cpDesc.binaryArchives = binArchArray;
+ }
+ }
+}
+
+void QRhiMetalData::addComputePipelineToBinaryArchive(MTLComputePipelineDescriptor *cpDesc)
+{
+ if (@available(macOS 11.0, iOS 14.0, *)) {
+ if (binArch) {
+ NSError *err = nil;
+ if (![binArch addComputePipelineFunctionsWithDescriptor: cpDesc error: &err]) {
+ const QString msg = QString::fromNSString(err.localizedDescription);
+ qWarning("Failed to collect compute pipeline functions to binary archive: %s", qPrintable(msg));
+ }
+ }
+ }
}
-bool QMetalComputePipeline::build()
+bool QMetalComputePipeline::create()
{
if (d->ps)
- release();
+ destroy();
QRHI_RES_RHI(QRhiMetal);
+ rhiD->pipelineCreationStart();
auto cacheIt = rhiD->d->shaderCache.constFind(m_shaderStage);
if (cacheIt != rhiD->d->shaderCache.constEnd()) {
@@ -3491,12 +5999,19 @@ bool QMetalComputePipeline::build()
d->cs.lib = lib;
d->cs.func = func;
d->cs.localSize = shader.description().computeShaderLocalSize();
- if (const QShader::NativeResourceBindingMap *map = shader.nativeResourceBindingMap(activeKey))
- d->cs.nativeResourceBindingMap = *map;
+ d->cs.nativeResourceBindingMap = shader.nativeResourceBindingMap(activeKey);
+ d->cs.desc = shader.description();
+ d->cs.nativeShaderInfo = shader.nativeShaderInfo(activeKey);
+
+ // SPIRV-Cross buffer size buffers
+ if (d->cs.nativeShaderInfo.extraBufferBindings.contains(QShaderPrivate::MslBufferSizeBufferBinding)) {
+ const int binding = d->cs.nativeShaderInfo.extraBufferBindings[QShaderPrivate::MslBufferSizeBufferBinding];
+ d->cs.nativeResourceBindingMap[binding] = qMakePair(binding, -1);
+ }
if (rhiD->d->shaderCache.count() >= QRhiMetal::MAX_SHADER_CACHE_ENTRIES) {
for (QMetalShader &s : rhiD->d->shaderCache)
- s.release();
+ s.destroy();
rhiD->d->shaderCache.clear();
}
rhiD->d->shaderCache.insert(m_shaderStage, d->cs);
@@ -3507,14 +6022,42 @@ bool QMetalComputePipeline::build()
d->localSize = MTLSizeMake(d->cs.localSize[0], d->cs.localSize[1], d->cs.localSize[2]);
+ MTLComputePipelineDescriptor *cpDesc = [MTLComputePipelineDescriptor new];
+ cpDesc.computeFunction = d->cs.func;
+
+ rhiD->d->trySeedingComputePipelineFromBinaryArchive(cpDesc);
+
+ if (rhiD->rhiFlags.testFlag(QRhi::EnablePipelineCacheDataSave))
+ rhiD->d->addComputePipelineToBinaryArchive(cpDesc);
+
NSError *err = nil;
- d->ps = [rhiD->d->dev newComputePipelineStateWithFunction: d->cs.func error: &err];
+ d->ps = [rhiD->d->dev newComputePipelineStateWithDescriptor: cpDesc
+ options: MTLPipelineOptionNone
+ reflection: nil
+ error: &err];
+ [cpDesc release];
if (!d->ps) {
const QString msg = QString::fromNSString(err.localizedDescription);
- qWarning("Failed to create render pipeline state: %s", qPrintable(msg));
+ qWarning("Failed to create compute pipeline state: %s", qPrintable(msg));
return false;
}
+ // SPIRV-Cross buffer size buffers
+ if (d->cs.nativeShaderInfo.extraBufferBindings.contains(QShaderPrivate::MslBufferSizeBufferBinding)) {
+ int buffers = 0;
+ for (const QShaderDescription::StorageBlock &block : d->cs.desc.storageBlocks())
+ buffers = qMax(buffers, d->cs.nativeResourceBindingMap[block.binding].first);
+
+ buffers += 1;
+
+ if (!d->bufferSizeBuffer)
+ d->bufferSizeBuffer = new QMetalBuffer(rhiD, QRhiBuffer::Static, QRhiBuffer::StorageBuffer, buffers * sizeof(int));
+
+ d->bufferSizeBuffer->setSize(buffers * sizeof(int));
+ d->bufferSizeBuffer->create();
+ }
+
+ rhiD->pipelineCreationEnd();
lastActiveFrameSlot = -1;
generation += 1;
rhiD->registerResource(this);
@@ -3530,26 +6073,28 @@ QMetalCommandBuffer::QMetalCommandBuffer(QRhiImplementation *rhi)
QMetalCommandBuffer::~QMetalCommandBuffer()
{
- release();
+ destroy();
delete d;
}
-void QMetalCommandBuffer::release()
+void QMetalCommandBuffer::destroy()
{
// nothing to do here, we do not own the MTL cb object
}
const QRhiNativeHandles *QMetalCommandBuffer::nativeHandles()
{
- nativeHandlesStruct.commandBuffer = d->cb;
- nativeHandlesStruct.encoder = d->currentRenderPassEncoder;
+ nativeHandlesStruct.commandBuffer = (MTLCommandBuffer *) d->cb;
+ nativeHandlesStruct.encoder = (MTLRenderCommandEncoder *) d->currentRenderPassEncoder;
return &nativeHandlesStruct;
}
-void QMetalCommandBuffer::resetState()
+void QMetalCommandBuffer::resetState(double lastGpuTime)
{
+ d->lastGpuTime = lastGpuTime;
d->currentRenderPassEncoder = nil;
d->currentComputePassEncoder = nil;
+ d->tessellationComputeEncoder = nil;
d->currentPassRpDesc = nil;
resetPerPassState();
}
@@ -3574,8 +6119,12 @@ void QMetalCommandBuffer::resetPerPassCachedState()
currentIndexOffset = 0;
currentIndexFormat = QRhiCommandBuffer::IndexUInt16;
currentCullMode = -1;
+ currentTriangleFillMode = -1;
currentFrontFaceWinding = -1;
+ currentDepthBiasValues = { 0.0f, 0.0f };
+ d->currentShaderResourceBindingState = {};
+ d->currentDepthStencilState = nil;
d->currentFirstVertexBinding = -1;
d->currentVertexInputsBuffers.clear();
d->currentVertexInputOffsets.clear();
@@ -3583,7 +6132,7 @@ void QMetalCommandBuffer::resetPerPassCachedState()
QMetalSwapChain::QMetalSwapChain(QRhiImplementation *rhi)
: QRhiSwapChain(rhi),
- rtWrapper(rhi),
+ rtWrapper(rhi, this),
cbWrapper(rhi),
d(new QMetalSwapChainData)
{
@@ -3595,24 +6144,19 @@ QMetalSwapChain::QMetalSwapChain(QRhiImplementation *rhi)
QMetalSwapChain::~QMetalSwapChain()
{
- release();
+ destroy();
delete d;
}
-void QMetalSwapChain::release()
+void QMetalSwapChain::destroy()
{
-#ifdef TARGET_IPHONE_SIMULATOR
- if (@available(ios 13.0, *)) {
-#endif
-
if (!d->layer)
return;
for (int i = 0; i < QMTL_FRAMES_IN_FLIGHT; ++i) {
if (d->sem[i]) {
// the semaphores cannot be released if they do not have the initial value
- dispatch_semaphore_wait(d->sem[i], DISPATCH_TIME_FOREVER);
- dispatch_semaphore_signal(d->sem[i]);
+ waitUntilCompleted(i);
dispatch_release(d->sem[i]);
d->sem[i] = nullptr;
@@ -3624,19 +6168,23 @@ void QMetalSwapChain::release()
d->msaaTex[i] = nil;
}
- d->layer = nullptr;
-
- QRHI_RES_RHI(QRhiMetal);
- rhiD->swapchains.remove(this);
+#ifdef Q_OS_MACOS
+ d->liveResizeStartObserver.remove();
+ d->liveResizeEndObserver.remove();
+ d->liveResizeObserverSet = false;
+#endif
- QRHI_PROF;
- QRHI_PROF_F(releaseSwapChain(this));
+ d->layer = nullptr;
+ m_proxyData = {};
- rhiD->unregisterResource(this);
+ [d->curDrawable release];
+ d->curDrawable = nil;
-#ifdef TARGET_IPHONE_SIMULATOR
+ QRHI_RES_RHI(QRhiMetal);
+ if (rhiD) {
+ rhiD->swapchains.remove(this);
+ rhiD->unregisterResource(this);
}
-#endif
}
QRhiCommandBuffer *QMetalSwapChain::currentFrameCommandBuffer()
@@ -3649,14 +6197,66 @@ QRhiRenderTarget *QMetalSwapChain::currentFrameRenderTarget()
return &rtWrapper;
}
+// view.layer should ideally be called on the main thread, otherwise the UI
+// Thread Checker in Xcode drops a warning. Hence trying to proxy it through
+// QRhiSwapChainProxyData instead of just calling this function directly.
+static inline CAMetalLayer *layerForWindow(QWindow *window)
+{
+ Q_ASSERT(window);
+#ifdef Q_OS_MACOS
+ NSView *view = reinterpret_cast<NSView *>(window->winId());
+#else
+ UIView *view = reinterpret_cast<UIView *>(window->winId());
+#endif
+ Q_ASSERT(view);
+ return static_cast<CAMetalLayer *>(view.layer);
+}
+
+// If someone calls this, it is hopefully from the main thread, and they will
+// then set the returned data on the QRhiSwapChain, so it won't need to query
+// the layer on its own later on.
+QRhiSwapChainProxyData QRhiMetal::updateSwapChainProxyData(QWindow *window)
+{
+ QRhiSwapChainProxyData d;
+ d.reserved[0] = layerForWindow(window);
+ return d;
+}
+
QSize QMetalSwapChain::surfacePixelSize()
{
Q_ASSERT(m_window);
- return m_window->size() * m_window->devicePixelRatio();
+ CAMetalLayer *layer = d->layer;
+ if (!layer)
+ layer = qrhi_objectFromProxyData<CAMetalLayer>(&m_proxyData, m_window, QRhi::Metal, 0);
+
+ Q_ASSERT(layer);
+ int height = (int)layer.bounds.size.height;
+ int width = (int)layer.bounds.size.width;
+ width *= layer.contentsScale;
+ height *= layer.contentsScale;
+ return QSize(width, height);
+}
+
+bool QMetalSwapChain::isFormatSupported(Format f)
+{
+ if (f == HDRExtendedSrgbLinear) {
+ if (@available(macOS 10.11, iOS 16.0, *))
+ return hdrInfo().limits.colorComponentValue.maxPotentialColorComponentValue > 1.0f;
+ else
+ return false;
+ } else if (f == HDRExtendedDisplayP3Linear) {
+ if (@available(macOS 11.0, iOS 14.0, *))
+ return hdrInfo().limits.colorComponentValue.maxPotentialColorComponentValue > 1.0f;
+ else
+ return false;
+ }
+ return f == SDR;
}
QRhiRenderPassDescriptor *QMetalSwapChain::newCompatibleRenderPassDescriptor()
{
+ QRHI_RES_RHI(QRhiMetal);
+
chooseFormats(); // ensure colorFormat and similar are filled out
QMetalRenderPassDescriptor *rpD = new QMetalRenderPassDescriptor(m_rhi);
@@ -3667,13 +6267,15 @@ QRhiRenderPassDescriptor *QMetalSwapChain::newCompatibleRenderPassDescriptor()
#ifdef Q_OS_MACOS
// m_depthStencil may not be built yet so cannot rely on computed fields in it
- QRHI_RES_RHI(QRhiMetal);
rpD->dsFormat = rhiD->d->dev.depth24Stencil8PixelFormatSupported
? MTLPixelFormatDepth24Unorm_Stencil8 : MTLPixelFormatDepth32Float_Stencil8;
#else
rpD->dsFormat = MTLPixelFormatDepth32Float_Stencil8;
#endif
+ rpD->updateSerializedFormat();
+
+ rhiD->registerResource(rpD, false);
return rpD;
}
@@ -3682,23 +6284,35 @@ void QMetalSwapChain::chooseFormats()
QRHI_RES_RHI(QRhiMetal);
samples = rhiD->effectiveSampleCount(m_sampleCount);
// pick a format that is allowed for CAMetalLayer.pixelFormat
+ if (m_format == HDRExtendedSrgbLinear || m_format == HDRExtendedDisplayP3Linear) {
+ d->colorFormat = MTLPixelFormatRGBA16Float;
+ d->rhiColorFormat = QRhiTexture::RGBA16F;
+ return;
+ }
d->colorFormat = m_flags.testFlag(sRGB) ? MTLPixelFormatBGRA8Unorm_sRGB : MTLPixelFormatBGRA8Unorm;
d->rhiColorFormat = QRhiTexture::BGRA8;
}
-bool QMetalSwapChain::buildOrResize()
+void QMetalSwapChain::waitUntilCompleted(int slot)
{
-#ifdef TARGET_IPHONE_SIMULATOR
- if (@available(ios 13.0, *)) {
-#endif
+ // wait+signal is the general pattern to ensure the commands for a
+ // given frame slot have completed (if sem is 1, we go 0 then 1; if
+ // sem is 0 we go -1, block, completion increments to 0, then us to 1)
+
+ dispatch_semaphore_t sem = d->sem[slot];
+ dispatch_semaphore_wait(sem, DISPATCH_TIME_FOREVER);
+ dispatch_semaphore_signal(sem);
+}
+bool QMetalSwapChain::createOrResize()
+{
Q_ASSERT(m_window);
const bool needsRegistration = !window || window != m_window;
if (window && window != m_window)
- release();
- // else no release(), this is intentional
+ destroy();
+ // else no destroy(), this is intentional
QRHI_RES_RHI(QRhiMetal);
if (needsRegistration)
@@ -3711,27 +6325,31 @@ bool QMetalSwapChain::buildOrResize()
return false;
}
-#ifdef Q_OS_MACOS
- NSView *view = reinterpret_cast<NSView *>(window->winId());
-#else
- UIView *view = reinterpret_cast<UIView *>(window->winId());
-#endif
- Q_ASSERT(view);
- d->layer = static_cast<CAMetalLayer *>(view.layer);
+ d->layer = qrhi_objectFromProxyData<CAMetalLayer>(&m_proxyData, window, QRhi::Metal, 0);
Q_ASSERT(d->layer);
chooseFormats();
if (d->colorFormat != d->layer.pixelFormat)
d->layer.pixelFormat = d->colorFormat;
+ if (m_format == HDRExtendedSrgbLinear) {
+ if (@available(macOS 10.11, iOS 16.0, *)) {
+ d->layer.colorspace = CGColorSpaceCreateWithName(kCGColorSpaceExtendedLinearSRGB);
+ d->layer.wantsExtendedDynamicRangeContent = YES;
+ }
+ } else if (m_format == HDRExtendedDisplayP3Linear) {
+ if (@available(macOS 11.0, iOS 16.0, *)) {
+ d->layer.colorspace = CGColorSpaceCreateWithName(kCGColorSpaceExtendedLinearDisplayP3);
+ d->layer.wantsExtendedDynamicRangeContent = YES;
+ }
+ }
+
if (m_flags.testFlag(UsedAsTransferSource))
d->layer.framebufferOnly = NO;
#ifdef Q_OS_MACOS
- if (m_flags.testFlag(NoVSync)) {
- if (@available(macOS 10.13, *))
- d->layer.displaySyncEnabled = NO;
- }
+ if (m_flags.testFlag(NoVSync))
+ d->layer.displaySyncEnabled = NO;
#endif
if (m_flags.testFlag(SurfaceHasPreMulAlpha)) {
@@ -3747,11 +6365,14 @@ bool QMetalSwapChain::buildOrResize()
}
// Now set the layer's drawableSize which will stay set to the same value
- // until the next buildOrResize(), thus ensuring atomicity with regards to
+ // until the next createOrResize(), thus ensuring atomicity with regards to
// the drawable size in frames.
- CGSize layerSize = d->layer.bounds.size;
- layerSize.width *= d->layer.contentsScale;
- layerSize.height *= d->layer.contentsScale;
+ int width = (int)d->layer.bounds.size.width;
+ int height = (int)d->layer.bounds.size.height;
+ CGSize layerSize = CGSizeMake(width, height);
+ const float scaleFactor = d->layer.contentsScale;
+ layerSize.width *= scaleFactor;
+ layerSize.height *= scaleFactor;
d->layer.drawableSize = layerSize;
m_currentPixelSize = QSizeF::fromCGSize(layerSize).toSize();
@@ -3759,9 +6380,39 @@ bool QMetalSwapChain::buildOrResize()
[d->layer setDevice: rhiD->d->dev];
+#ifdef Q_OS_MACOS
+ // Can only use presentsWithTransaction (to get smooth resizing) when
+ // presenting from the main (gui) thread. We predict that based on the
+ // thread this function is called on since if the QRhiSwapChain is
+ // initialied on a given thread then that's almost certainly the thread on
+ // which the QRhi renders and presents.
+ const bool canUsePresentsWithTransaction = NSThread.isMainThread;
+
+ // Have an env.var. just in case it turns out presentsWithTransaction is
+ // not desired in some specific case.
+ static bool allowPresentsWithTransaction = !qEnvironmentVariableIntValue("QT_MTL_NO_TRANSACTION");
+
+ if (allowPresentsWithTransaction && canUsePresentsWithTransaction && !d->liveResizeObserverSet) {
+ d->liveResizeObserverSet = true;
+ NSView *view = reinterpret_cast<NSView *>(window->winId());
+ NSWindow *window = view.window;
+ if (window) {
+ qCDebug(QRHI_LOG_INFO, "will set presentsWithTransaction during live resize");
+ d->liveResizeStartObserver = QMacNotificationObserver(window, NSWindowWillStartLiveResizeNotification, [this] {
+ d->layer.presentsWithTransaction = true;
+ });
+ d->liveResizeEndObserver = QMacNotificationObserver(window, NSWindowDidEndLiveResizeNotification, [this] {
+ d->layer.presentsWithTransaction = false;
+ });
+ }
+ }
+#endif
+
+ [d->curDrawable release];
d->curDrawable = nil;
for (int i = 0; i < QMTL_FRAMES_IN_FLIGHT; ++i) {
+ d->lastGpuTime[i] = 0;
if (!d->sem[i])
d->sem[i] = dispatch_semaphore_create(QMTL_FRAMES_IN_FLIGHT - 1);
}
@@ -3777,7 +6428,7 @@ bool QMetalSwapChain::buildOrResize()
if (m_depthStencil && m_depthStencil->pixelSize() != pixelSize) {
if (m_depthStencil->flags().testFlag(QRhiRenderBuffer::UsedWithSwapChainOnly)) {
m_depthStencil->setPixelSize(pixelSize);
- if (!m_depthStencil->build())
+ if (!m_depthStencil->create())
qWarning("Failed to rebuild swapchain's associated depth-stencil buffer for size %dx%d",
pixelSize.width(), pixelSize.height());
} else {
@@ -3787,13 +6438,15 @@ bool QMetalSwapChain::buildOrResize()
}
}
+ rtWrapper.setRenderPassDescriptor(m_renderPassDesc); // for the public getter in QRhiRenderTarget
rtWrapper.d->pixelSize = pixelSize;
- rtWrapper.d->dpr = float(window->devicePixelRatio());
+ rtWrapper.d->dpr = scaleFactor;
rtWrapper.d->sampleCount = samples;
rtWrapper.d->colorAttCount = 1;
rtWrapper.d->dsAttCount = ds ? 1 : 0;
- qCDebug(QRHI_LOG_INFO, "got CAMetalLayer, size %dx%d", pixelSize.width(), pixelSize.height());
+ qCDebug(QRHI_LOG_INFO, "got CAMetalLayer, pixel size %dx%d (scale %.2f)",
+ pixelSize.width(), pixelSize.height(), scaleFactor);
if (samples > 1) {
MTLTextureDescriptor *desc = [[MTLTextureDescriptor alloc] init];
@@ -3812,22 +6465,39 @@ bool QMetalSwapChain::buildOrResize()
[desc release];
}
- QRHI_PROF;
- QRHI_PROF_F(resizeSwapChain(this, QMTL_FRAMES_IN_FLIGHT, samples > 1 ? QMTL_FRAMES_IN_FLIGHT : 0, samples));
-
if (needsRegistration)
rhiD->registerResource(this);
return true;
+}
-#ifdef TARGET_IPHONE_SIMULATOR
- } else {
- // Won't ever get here in a normal app because MTLDevice creation would
- // fail too. Print a warning, just in case.
- qWarning("No CAMetalLayer support in this version of the iOS Simulator");
- return false;
- }
+QRhiSwapChainHdrInfo QMetalSwapChain::hdrInfo()
+{
+ QRhiSwapChainHdrInfo info;
+ info.limitsType = QRhiSwapChainHdrInfo::ColorComponentValue;
+ info.limits.colorComponentValue.maxColorComponentValue = 1;
+ info.limits.colorComponentValue.maxPotentialColorComponentValue = 1;
+ info.luminanceBehavior = QRhiSwapChainHdrInfo::DisplayReferred; // 1.0 = SDR white
+ info.sdrWhiteLevel = 200; // typical value, but dummy (don't know the real one); won't matter due to being display-referred
+
+ if (m_window) {
+ // Must use m_window, not window, given this may be called before createOrResize().
+#if defined(Q_OS_MACOS)
+ NSView *view = reinterpret_cast<NSView *>(m_window->winId());
+ NSScreen *screen = view.window.screen;
+ info.limits.colorComponentValue.maxColorComponentValue = screen.maximumExtendedDynamicRangeColorComponentValue;
+ info.limits.colorComponentValue.maxPotentialColorComponentValue = screen.maximumPotentialExtendedDynamicRangeColorComponentValue;
+#elif defined(Q_OS_IOS)
+ if (@available(iOS 16.0, *)) {
+ UIView *view = reinterpret_cast<UIView *>(m_window->winId());
+ UIScreen *screen = view.window.windowScene.screen;
+ info.limits.colorComponentValue.maxColorComponentValue = view.window.windowScene.screen.currentEDRHeadroom;
+ info.limits.colorComponentValue.maxPotentialColorComponentValue = screen.potentialEDRHeadroom;
+ }
#endif
+ }
+
+ return info;
}
QT_END_NAMESPACE
diff --git a/src/gui/rhi/qrhimetal_p.h b/src/gui/rhi/qrhimetal_p.h
index 094801c58c..f539148b2c 100644
--- a/src/gui/rhi/qrhimetal_p.h
+++ b/src/gui/rhi/qrhimetal_p.h
@@ -1,41 +1,8 @@
-/****************************************************************************
-**
-** Copyright (C) 2019 The Qt Company Ltd.
-** Contact: http://www.qt.io/licensing/
-**
-** This file is part of the Qt Gui module
-**
-** $QT_BEGIN_LICENSE:LGPL3$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef QRHIMETAL_H
-#define QRHIMETAL_H
+// Copyright (C) 2023 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
+
+#ifndef QRHIMETAL_P_H
+#define QRHIMETAL_P_H
//
// W A R N I N G
@@ -48,31 +15,494 @@
// We mean it.
//
-#include <private/qrhi_p.h>
-
-// no Metal includes here, the user code may be plain C++
+#include "qrhi_p.h"
+#include <QWindow>
QT_BEGIN_NAMESPACE
-struct Q_GUI_EXPORT QRhiMetalInitParams : public QRhiInitParams
+static const int QMTL_FRAMES_IN_FLIGHT = 2;
+
+// have to hide the ObjC stuff, this header cannot contain MTL* at all
+struct QMetalBufferData;
+
+struct QMetalBuffer : public QRhiBuffer
+{
+ QMetalBuffer(QRhiImplementation *rhi, Type type, UsageFlags usage, quint32 size);
+ ~QMetalBuffer();
+ void destroy() override;
+ bool create() override;
+ QRhiBuffer::NativeBuffer nativeBuffer() override;
+ char *beginFullDynamicBufferUpdateForCurrentFrame() override;
+ void endFullDynamicBufferUpdateForCurrentFrame() override;
+
+ QMetalBufferData *d;
+ uint generation = 0;
+ int lastActiveFrameSlot = -1;
+ friend class QRhiMetal;
+ friend struct QMetalShaderResourceBindings;
+
+ static constexpr int WorkBufPoolUsage = 1 << 8;
+ static_assert(WorkBufPoolUsage > QRhiBuffer::StorageBuffer);
+};
+
+struct QMetalRenderBufferData;
+
+struct QMetalRenderBuffer : public QRhiRenderBuffer
+{
+ QMetalRenderBuffer(QRhiImplementation *rhi, Type type, const QSize &pixelSize,
+ int sampleCount, QRhiRenderBuffer::Flags flags,
+ QRhiTexture::Format backingFormatHint);
+ ~QMetalRenderBuffer();
+ void destroy() override;
+ bool create() override;
+ QRhiTexture::Format backingFormat() const override;
+
+ QMetalRenderBufferData *d;
+ int samples = 1;
+ uint generation = 0;
+ int lastActiveFrameSlot = -1;
+ friend class QRhiMetal;
+};
+
+struct QMetalTextureData;
+
+struct QMetalTexture : public QRhiTexture
{
+ QMetalTexture(QRhiImplementation *rhi, Format format, const QSize &pixelSize, int depth,
+ int arraySize, int sampleCount, Flags flags);
+ ~QMetalTexture();
+ void destroy() override;
+ bool create() override;
+ bool createFrom(NativeTexture src) override;
+ NativeTexture nativeTexture() override;
+
+ bool prepareCreate(QSize *adjustedSize = nullptr);
+
+ QMetalTextureData *d;
+ int mipLevelCount = 0;
+ int samples = 1;
+ uint generation = 0;
+ int lastActiveFrameSlot = -1;
+ friend class QRhiMetal;
+ friend struct QMetalShaderResourceBindings;
+ friend struct QMetalTextureData;
};
-struct Q_GUI_EXPORT QRhiMetalNativeHandles : public QRhiNativeHandles
+struct QMetalSamplerData;
+
+struct QMetalSampler : public QRhiSampler
{
- void *dev = nullptr; // id<MTLDevice>
- void *cmdQueue = nullptr; // id<MTLCommandQueue>
+ QMetalSampler(QRhiImplementation *rhi, Filter magFilter, Filter minFilter, Filter mipmapMode,
+ AddressMode u, AddressMode v, AddressMode w);
+ ~QMetalSampler();
+ void destroy() override;
+ bool create() override;
+
+ QMetalSamplerData *d;
+ uint generation = 0;
+ int lastActiveFrameSlot = -1;
+ friend class QRhiMetal;
+ friend struct QMetalShaderResourceBindings;
};
-struct Q_GUI_EXPORT QRhiMetalTextureNativeHandles : public QRhiNativeHandles
+struct QMetalRenderPassDescriptor : public QRhiRenderPassDescriptor
{
- void *texture = nullptr; // id<MTLTexture>
+ QMetalRenderPassDescriptor(QRhiImplementation *rhi);
+ ~QMetalRenderPassDescriptor();
+ void destroy() override;
+ bool isCompatible(const QRhiRenderPassDescriptor *other) const override;
+ QRhiRenderPassDescriptor *newCompatibleRenderPassDescriptor() const override;
+ QVector<quint32> serializedFormat() const override;
+
+ void updateSerializedFormat();
+
+ // there is no MTLRenderPassDescriptor here as one will be created for each pass in beginPass()
+
+ // but the things needed for the render pipeline descriptor have to be provided
+ static const int MAX_COLOR_ATTACHMENTS = 8;
+ int colorAttachmentCount = 0;
+ bool hasDepthStencil = false;
+ int colorFormat[MAX_COLOR_ATTACHMENTS];
+ int dsFormat;
+ QVector<quint32> serializedFormatData;
};
-struct Q_GUI_EXPORT QRhiMetalCommandBufferNativeHandles : public QRhiNativeHandles
+struct QMetalRenderTargetData;
+
+struct QMetalSwapChainRenderTarget : public QRhiSwapChainRenderTarget
+{
+ QMetalSwapChainRenderTarget(QRhiImplementation *rhi, QRhiSwapChain *swapchain);
+ ~QMetalSwapChainRenderTarget();
+ void destroy() override;
+
+ QSize pixelSize() const override;
+ float devicePixelRatio() const override;
+ int sampleCount() const override;
+
+ QMetalRenderTargetData *d;
+};
+
+struct QMetalTextureRenderTarget : public QRhiTextureRenderTarget
+{
+ QMetalTextureRenderTarget(QRhiImplementation *rhi, const QRhiTextureRenderTargetDescription &desc, Flags flags);
+ ~QMetalTextureRenderTarget();
+ void destroy() override;
+
+ QSize pixelSize() const override;
+ float devicePixelRatio() const override;
+ int sampleCount() const override;
+
+ QRhiRenderPassDescriptor *newCompatibleRenderPassDescriptor() override;
+ bool create() override;
+
+ QMetalRenderTargetData *d;
+ friend class QRhiMetal;
+};
+
+struct QMetalShaderResourceBindings : public QRhiShaderResourceBindings
+{
+ QMetalShaderResourceBindings(QRhiImplementation *rhi);
+ ~QMetalShaderResourceBindings();
+ void destroy() override;
+ bool create() override;
+ void updateResources(UpdateFlags flags) override;
+
+ QVarLengthArray<QRhiShaderResourceBinding, 8> sortedBindings;
+ int maxBinding = -1;
+
+ struct BoundUniformBufferData {
+ quint64 id;
+ uint generation;
+ };
+ struct BoundSampledTextureData {
+ int count;
+ struct {
+ quint64 texId;
+ uint texGeneration;
+ quint64 samplerId;
+ uint samplerGeneration;
+ } d[QRhiShaderResourceBinding::Data::MAX_TEX_SAMPLER_ARRAY_SIZE];
+ };
+ struct BoundStorageImageData {
+ quint64 id;
+ uint generation;
+ };
+ struct BoundStorageBufferData {
+ quint64 id;
+ uint generation;
+ };
+ struct BoundResourceData {
+ union {
+ BoundUniformBufferData ubuf;
+ BoundSampledTextureData stex;
+ BoundStorageImageData simage;
+ BoundStorageBufferData sbuf;
+ };
+ };
+ QVarLengthArray<BoundResourceData, 8> boundResourceData;
+
+ uint generation = 0;
+ friend class QRhiMetal;
+};
+
+struct QMetalGraphicsPipelineData;
+struct QMetalCommandBuffer;
+
+struct QMetalGraphicsPipeline : public QRhiGraphicsPipeline
+{
+ QMetalGraphicsPipeline(QRhiImplementation *rhi);
+ ~QMetalGraphicsPipeline();
+ void destroy() override;
+ bool create() override;
+
+ void makeActiveForCurrentRenderPassEncoder(QMetalCommandBuffer *cbD);
+ void setupAttachmentsInMetalRenderPassDescriptor(void *metalRpDesc, QMetalRenderPassDescriptor *rpD);
+ void setupMetalDepthStencilDescriptor(void *metalDsDesc);
+ void mapStates();
+ bool createVertexFragmentPipeline();
+ bool createTessellationPipelines(const QShader &tessVert, const QShader &tesc, const QShader &tese, const QShader &tessFrag);
+
+ QMetalGraphicsPipelineData *d;
+ uint generation = 0;
+ int lastActiveFrameSlot = -1;
+ friend class QRhiMetal;
+};
+
+struct QMetalComputePipelineData;
+
+struct QMetalComputePipeline : public QRhiComputePipeline
{
- void *commandBuffer = nullptr; // id<MTLCommandBuffer>
- void *encoder = nullptr; // id<MTLRenderCommandEncoder>
+ QMetalComputePipeline(QRhiImplementation *rhi);
+ ~QMetalComputePipeline();
+ void destroy() override;
+ bool create() override;
+
+ QMetalComputePipelineData *d;
+ uint generation = 0;
+ int lastActiveFrameSlot = -1;
+ friend class QRhiMetal;
+};
+
+struct QMetalCommandBufferData;
+struct QMetalSwapChain;
+
+struct QMetalCommandBuffer : public QRhiCommandBuffer
+{
+ QMetalCommandBuffer(QRhiImplementation *rhi);
+ ~QMetalCommandBuffer();
+ void destroy() override;
+
+ QMetalCommandBufferData *d = nullptr;
+ QRhiMetalCommandBufferNativeHandles nativeHandlesStruct;
+
+ enum PassType {
+ NoPass,
+ RenderPass,
+ ComputePass
+ };
+
+ // per-pass (render or compute command encoder) persistent state
+ PassType recordingPass;
+ QRhiRenderTarget *currentTarget;
+
+ // per-pass (render or compute command encoder) volatile (cached) state
+ QMetalGraphicsPipeline *currentGraphicsPipeline;
+ QMetalComputePipeline *currentComputePipeline;
+ uint currentPipelineGeneration;
+ QMetalShaderResourceBindings *currentGraphicsSrb;
+ QMetalShaderResourceBindings *currentComputeSrb;
+ uint currentSrbGeneration;
+ int currentResSlot;
+ QMetalBuffer *currentIndexBuffer;
+ quint32 currentIndexOffset;
+ QRhiCommandBuffer::IndexFormat currentIndexFormat;
+ int currentCullMode;
+ int currentTriangleFillMode;
+ int currentFrontFaceWinding;
+ QPair<float, float> currentDepthBiasValues;
+
+ const QRhiNativeHandles *nativeHandles();
+ void resetState(double lastGpuTime = 0);
+ void resetPerPassState();
+ void resetPerPassCachedState();
+};
+
+struct QMetalSwapChainData;
+
+struct QMetalSwapChain : public QRhiSwapChain
+{
+ QMetalSwapChain(QRhiImplementation *rhi);
+ ~QMetalSwapChain();
+ void destroy() override;
+
+ QRhiCommandBuffer *currentFrameCommandBuffer() override;
+ QRhiRenderTarget *currentFrameRenderTarget() override;
+ QSize surfacePixelSize() override;
+ bool isFormatSupported(Format f) override;
+
+ QRhiRenderPassDescriptor *newCompatibleRenderPassDescriptor() override;
+
+ bool createOrResize() override;
+
+ virtual QRhiSwapChainHdrInfo hdrInfo() override;
+
+ void chooseFormats();
+ void waitUntilCompleted(int slot);
+
+ QWindow *window = nullptr;
+ QSize pixelSize;
+ int currentFrameSlot = 0; // 0..QMTL_FRAMES_IN_FLIGHT-1
+ int frameCount = 0;
+ int samples = 1;
+ QMetalSwapChainRenderTarget rtWrapper;
+ QMetalCommandBuffer cbWrapper;
+ QMetalRenderBuffer *ds = nullptr;
+ QMetalSwapChainData *d = nullptr;
+};
+
+struct QRhiMetalData;
+
+class QRhiMetal : public QRhiImplementation
+{
+public:
+ QRhiMetal(QRhiMetalInitParams *params, QRhiMetalNativeHandles *importDevice = nullptr);
+ ~QRhiMetal();
+
+ static bool probe(QRhiMetalInitParams *params);
+ static QRhiSwapChainProxyData updateSwapChainProxyData(QWindow *window);
+
+ bool create(QRhi::Flags flags) override;
+ void destroy() override;
+
+ QRhiGraphicsPipeline *createGraphicsPipeline() override;
+ QRhiComputePipeline *createComputePipeline() override;
+ QRhiShaderResourceBindings *createShaderResourceBindings() override;
+ QRhiBuffer *createBuffer(QRhiBuffer::Type type,
+ QRhiBuffer::UsageFlags usage,
+ quint32 size) override;
+ QRhiRenderBuffer *createRenderBuffer(QRhiRenderBuffer::Type type,
+ const QSize &pixelSize,
+ int sampleCount,
+ QRhiRenderBuffer::Flags flags,
+ QRhiTexture::Format backingFormatHint) override;
+ QRhiTexture *createTexture(QRhiTexture::Format format,
+ const QSize &pixelSize,
+ int depth,
+ int arraySize,
+ int sampleCount,
+ QRhiTexture::Flags flags) override;
+ QRhiSampler *createSampler(QRhiSampler::Filter magFilter,
+ QRhiSampler::Filter minFilter,
+ QRhiSampler::Filter mipmapMode,
+ QRhiSampler:: AddressMode u,
+ QRhiSampler::AddressMode v,
+ QRhiSampler::AddressMode w) override;
+
+ QRhiTextureRenderTarget *createTextureRenderTarget(const QRhiTextureRenderTargetDescription &desc,
+ QRhiTextureRenderTarget::Flags flags) override;
+
+ QRhiSwapChain *createSwapChain() override;
+ QRhi::FrameOpResult beginFrame(QRhiSwapChain *swapChain, QRhi::BeginFrameFlags flags) override;
+ QRhi::FrameOpResult endFrame(QRhiSwapChain *swapChain, QRhi::EndFrameFlags flags) override;
+ QRhi::FrameOpResult beginOffscreenFrame(QRhiCommandBuffer **cb, QRhi::BeginFrameFlags flags) override;
+ QRhi::FrameOpResult endOffscreenFrame(QRhi::EndFrameFlags flags) override;
+ QRhi::FrameOpResult finish() override;
+
+ void resourceUpdate(QRhiCommandBuffer *cb, QRhiResourceUpdateBatch *resourceUpdates) override;
+
+ void beginPass(QRhiCommandBuffer *cb,
+ QRhiRenderTarget *rt,
+ const QColor &colorClearValue,
+ const QRhiDepthStencilClearValue &depthStencilClearValue,
+ QRhiResourceUpdateBatch *resourceUpdates,
+ QRhiCommandBuffer::BeginPassFlags flags) override;
+ void endPass(QRhiCommandBuffer *cb, QRhiResourceUpdateBatch *resourceUpdates) override;
+
+ void setGraphicsPipeline(QRhiCommandBuffer *cb,
+ QRhiGraphicsPipeline *ps) override;
+
+ void setShaderResources(QRhiCommandBuffer *cb,
+ QRhiShaderResourceBindings *srb,
+ int dynamicOffsetCount,
+ const QRhiCommandBuffer::DynamicOffset *dynamicOffsets) override;
+
+ void setVertexInput(QRhiCommandBuffer *cb,
+ int startBinding, int bindingCount, const QRhiCommandBuffer::VertexInput *bindings,
+ QRhiBuffer *indexBuf, quint32 indexOffset,
+ QRhiCommandBuffer::IndexFormat indexFormat) override;
+
+ void setViewport(QRhiCommandBuffer *cb, const QRhiViewport &viewport) override;
+ void setScissor(QRhiCommandBuffer *cb, const QRhiScissor &scissor) override;
+ void setBlendConstants(QRhiCommandBuffer *cb, const QColor &c) override;
+ void setStencilRef(QRhiCommandBuffer *cb, quint32 refValue) override;
+
+ void draw(QRhiCommandBuffer *cb, quint32 vertexCount,
+ quint32 instanceCount, quint32 firstVertex, quint32 firstInstance) override;
+
+ void drawIndexed(QRhiCommandBuffer *cb, quint32 indexCount,
+ quint32 instanceCount, quint32 firstIndex,
+ qint32 vertexOffset, quint32 firstInstance) override;
+
+ void debugMarkBegin(QRhiCommandBuffer *cb, const QByteArray &name) override;
+ void debugMarkEnd(QRhiCommandBuffer *cb) override;
+ void debugMarkMsg(QRhiCommandBuffer *cb, const QByteArray &msg) override;
+
+ void beginComputePass(QRhiCommandBuffer *cb,
+ QRhiResourceUpdateBatch *resourceUpdates,
+ QRhiCommandBuffer::BeginPassFlags flags) override;
+ void endComputePass(QRhiCommandBuffer *cb, QRhiResourceUpdateBatch *resourceUpdates) override;
+ void setComputePipeline(QRhiCommandBuffer *cb, QRhiComputePipeline *ps) override;
+ void dispatch(QRhiCommandBuffer *cb, int x, int y, int z) override;
+
+ const QRhiNativeHandles *nativeHandles(QRhiCommandBuffer *cb) override;
+ void beginExternal(QRhiCommandBuffer *cb) override;
+ void endExternal(QRhiCommandBuffer *cb) override;
+ double lastCompletedGpuTime(QRhiCommandBuffer *cb) override;
+
+ QList<int> supportedSampleCounts() const override;
+ int ubufAlignment() const override;
+ bool isYUpInFramebuffer() const override;
+ bool isYUpInNDC() const override;
+ bool isClipDepthZeroToOne() const override;
+ QMatrix4x4 clipSpaceCorrMatrix() const override;
+ bool isTextureFormatSupported(QRhiTexture::Format format, QRhiTexture::Flags flags) const override;
+ bool isFeatureSupported(QRhi::Feature feature) const override;
+ int resourceLimit(QRhi::ResourceLimit limit) const override;
+ const QRhiNativeHandles *nativeHandles() override;
+ QRhiDriverInfo driverInfo() const override;
+ QRhiStats statistics() override;
+ bool makeThreadLocalNativeContextCurrent() override;
+ void releaseCachedResources() override;
+ bool isDeviceLost() const override;
+
+ QByteArray pipelineCacheData() override;
+ void setPipelineCacheData(const QByteArray &data) override;
+
+ void executeDeferredReleases(bool forced = false);
+ void finishActiveReadbacks(bool forced = false);
+ qsizetype subresUploadByteSize(const QRhiTextureSubresourceUploadDescription &subresDesc) const;
+ void enqueueSubresUpload(QMetalTexture *texD, void *mp, void *blitEncPtr,
+ int layer, int level, const QRhiTextureSubresourceUploadDescription &subresDesc,
+ qsizetype *curOfs);
+ void enqueueResourceUpdates(QRhiCommandBuffer *cb, QRhiResourceUpdateBatch *resourceUpdates);
+ void executeBufferHostWritesForSlot(QMetalBuffer *bufD, int slot);
+ void executeBufferHostWritesForCurrentFrame(QMetalBuffer *bufD);
+ static const int SUPPORTED_STAGES = 5;
+ void enqueueShaderResourceBindings(QMetalShaderResourceBindings *srbD,
+ QMetalCommandBuffer *cbD,
+ int dynamicOffsetCount,
+ const QRhiCommandBuffer::DynamicOffset *dynamicOffsets,
+ bool offsetOnlyChange,
+ const QShader::NativeResourceBindingMap *nativeResourceBindingMaps[SUPPORTED_STAGES]);
+ struct TessDrawArgs {
+ QMetalCommandBuffer *cbD;
+ enum {
+ NonIndexed,
+ U16Indexed,
+ U32Indexed
+ } type;
+ struct NonIndexedArgs {
+ quint32 vertexCount;
+ quint32 instanceCount;
+ quint32 firstVertex;
+ quint32 firstInstance;
+ };
+ struct IndexedArgs {
+ quint32 indexCount;
+ quint32 instanceCount;
+ quint32 firstIndex;
+ qint32 vertexOffset;
+ quint32 firstInstance;
+ void *indexBuffer;
+ };
+ union {
+ NonIndexedArgs draw;
+ IndexedArgs drawIndexed;
+ };
+ };
+ void tessellatedDraw(const TessDrawArgs &args);
+ void adjustForMultiViewDraw(quint32 *instanceCount, QRhiCommandBuffer *cb);
+
+ QRhi::Flags rhiFlags;
+ bool importedDevice = false;
+ bool importedCmdQueue = false;
+ QMetalSwapChain *currentSwapChain = nullptr;
+ QSet<QMetalSwapChain *> swapchains;
+ QRhiMetalNativeHandles nativeHandlesStruct;
+ QRhiDriverInfo driverInfoStruct;
+ quint32 osMajor = 0;
+ quint32 osMinor = 0;
+
+ struct {
+ int maxTextureSize = 4096;
+ bool baseVertexAndInstance = true;
+ QVector<int> supportedSampleCounts;
+ bool isAppleGPU = false;
+ int maxThreadGroupSize = 512;
+ bool multiView = false;
+ } caps;
+
+ QRhiMetalData *d = nullptr;
};
QT_END_NAMESPACE
diff --git a/src/gui/rhi/qrhimetal_p_p.h b/src/gui/rhi/qrhimetal_p_p.h
deleted file mode 100644
index 8e655fd98b..0000000000
--- a/src/gui/rhi/qrhimetal_p_p.h
+++ /dev/null
@@ -1,463 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2019 The Qt Company Ltd.
-** Contact: http://www.qt.io/licensing/
-**
-** This file is part of the Qt Gui module
-**
-** $QT_BEGIN_LICENSE:LGPL3$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef QRHIMETAL_P_H
-#define QRHIMETAL_P_H
-
-//
-// W A R N I N G
-// -------------
-//
-// This file is not part of the Qt API. It exists purely as an
-// implementation detail. This header file may change from version to
-// version without notice, or even be removed.
-//
-// We mean it.
-//
-
-#include "qrhimetal_p.h"
-#include "qrhi_p_p.h"
-#include <QWindow>
-
-QT_BEGIN_NAMESPACE
-
-static const int QMTL_FRAMES_IN_FLIGHT = 2;
-
-// have to hide the ObjC stuff, this header cannot contain MTL* at all
-struct QMetalBufferData;
-
-struct QMetalBuffer : public QRhiBuffer
-{
- QMetalBuffer(QRhiImplementation *rhi, Type type, UsageFlags usage, int size);
- ~QMetalBuffer();
- void release() override;
- bool build() override;
-
- QMetalBufferData *d;
- uint generation = 0;
- int lastActiveFrameSlot = -1;
- friend class QRhiMetal;
- friend struct QMetalShaderResourceBindings;
-};
-
-struct QMetalRenderBufferData;
-
-struct QMetalRenderBuffer : public QRhiRenderBuffer
-{
- QMetalRenderBuffer(QRhiImplementation *rhi, Type type, const QSize &pixelSize,
- int sampleCount, QRhiRenderBuffer::Flags flags);
- ~QMetalRenderBuffer();
- void release() override;
- bool build() override;
- QRhiTexture::Format backingFormat() const override;
-
- QMetalRenderBufferData *d;
- int samples = 1;
- uint generation = 0;
- int lastActiveFrameSlot = -1;
- friend class QRhiMetal;
-};
-
-struct QMetalTextureData;
-
-struct QMetalTexture : public QRhiTexture
-{
- QMetalTexture(QRhiImplementation *rhi, Format format, const QSize &pixelSize,
- int sampleCount, Flags flags);
- ~QMetalTexture();
- void release() override;
- bool build() override;
- bool buildFrom(const QRhiNativeHandles *src) override;
- bool buildFrom(NativeTexture src) override;
- const QRhiNativeHandles *nativeHandles() override;
- NativeTexture nativeTexture() override;
-
- bool prepareBuild(QSize *adjustedSize = nullptr);
-
- QMetalTextureData *d;
- QRhiMetalTextureNativeHandles nativeHandlesStruct;
- int mipLevelCount = 0;
- int samples = 1;
- uint generation = 0;
- int lastActiveFrameSlot = -1;
- friend class QRhiMetal;
- friend struct QMetalShaderResourceBindings;
- friend struct QMetalTextureData;
-};
-
-struct QMetalSamplerData;
-
-struct QMetalSampler : public QRhiSampler
-{
- QMetalSampler(QRhiImplementation *rhi, Filter magFilter, Filter minFilter, Filter mipmapMode,
- AddressMode u, AddressMode v);
- ~QMetalSampler();
- void release() override;
- bool build() override;
-
- QMetalSamplerData *d;
- uint generation = 0;
- int lastActiveFrameSlot = -1;
- friend class QRhiMetal;
- friend struct QMetalShaderResourceBindings;
-};
-
-struct QMetalRenderPassDescriptor : public QRhiRenderPassDescriptor
-{
- QMetalRenderPassDescriptor(QRhiImplementation *rhi);
- ~QMetalRenderPassDescriptor();
- void release() override;
- bool isCompatible(const QRhiRenderPassDescriptor *other) const override;
-
- // there is no MTLRenderPassDescriptor here as one will be created for each pass in beginPass()
-
- // but the things needed for the render pipeline descriptor have to be provided
- static const int MAX_COLOR_ATTACHMENTS = 8;
- int colorAttachmentCount = 0;
- bool hasDepthStencil = false;
- int colorFormat[MAX_COLOR_ATTACHMENTS];
- int dsFormat;
-};
-
-struct QMetalRenderTargetData;
-
-struct QMetalReferenceRenderTarget : public QRhiRenderTarget
-{
- QMetalReferenceRenderTarget(QRhiImplementation *rhi);
- ~QMetalReferenceRenderTarget();
- void release() override;
-
- QSize pixelSize() const override;
- float devicePixelRatio() const override;
- int sampleCount() const override;
-
- QMetalRenderTargetData *d;
-};
-
-struct QMetalTextureRenderTarget : public QRhiTextureRenderTarget
-{
- QMetalTextureRenderTarget(QRhiImplementation *rhi, const QRhiTextureRenderTargetDescription &desc, Flags flags);
- ~QMetalTextureRenderTarget();
- void release() override;
-
- QSize pixelSize() const override;
- float devicePixelRatio() const override;
- int sampleCount() const override;
-
- QRhiRenderPassDescriptor *newCompatibleRenderPassDescriptor() override;
- bool build() override;
-
- QMetalRenderTargetData *d;
- friend class QRhiMetal;
-};
-
-struct QMetalShaderResourceBindings : public QRhiShaderResourceBindings
-{
- QMetalShaderResourceBindings(QRhiImplementation *rhi);
- ~QMetalShaderResourceBindings();
- void release() override;
- bool build() override;
-
- QVarLengthArray<QRhiShaderResourceBinding, 8> sortedBindings;
- int maxBinding = -1;
-
- struct BoundUniformBufferData {
- quint64 id;
- uint generation;
- };
- struct BoundSampledTextureData {
- quint64 texId;
- uint texGeneration;
- quint64 samplerId;
- uint samplerGeneration;
- };
- struct BoundStorageImageData {
- quint64 id;
- uint generation;
- };
- struct BoundStorageBufferData {
- quint64 id;
- uint generation;
- };
- struct BoundResourceData {
- union {
- BoundUniformBufferData ubuf;
- BoundSampledTextureData stex;
- BoundStorageImageData simage;
- BoundStorageBufferData sbuf;
- };
- };
- QVarLengthArray<BoundResourceData, 8> boundResourceData;
-
- uint generation = 0;
- friend class QRhiMetal;
-};
-
-struct QMetalGraphicsPipelineData;
-
-struct QMetalGraphicsPipeline : public QRhiGraphicsPipeline
-{
- QMetalGraphicsPipeline(QRhiImplementation *rhi);
- ~QMetalGraphicsPipeline();
- void release() override;
- bool build() override;
-
- QMetalGraphicsPipelineData *d;
- uint generation = 0;
- int lastActiveFrameSlot = -1;
- friend class QRhiMetal;
-};
-
-struct QMetalComputePipelineData;
-
-struct QMetalComputePipeline : public QRhiComputePipeline
-{
- QMetalComputePipeline(QRhiImplementation *rhi);
- ~QMetalComputePipeline();
- void release() override;
- bool build() override;
-
- QMetalComputePipelineData *d;
- uint generation = 0;
- int lastActiveFrameSlot = -1;
- friend class QRhiMetal;
-};
-
-struct QMetalCommandBufferData;
-struct QMetalSwapChain;
-
-struct QMetalCommandBuffer : public QRhiCommandBuffer
-{
- QMetalCommandBuffer(QRhiImplementation *rhi);
- ~QMetalCommandBuffer();
- void release() override;
-
- QMetalCommandBufferData *d = nullptr;
- QRhiMetalCommandBufferNativeHandles nativeHandlesStruct;
-
- enum PassType {
- NoPass,
- RenderPass,
- ComputePass
- };
-
- // per-pass (render or compute command encoder) persistent state
- PassType recordingPass;
- QRhiRenderTarget *currentTarget;
-
- // per-pass (render or compute command encoder) volatile (cached) state
- QRhiGraphicsPipeline *currentGraphicsPipeline;
- QRhiComputePipeline *currentComputePipeline;
- uint currentPipelineGeneration;
- QRhiShaderResourceBindings *currentGraphicsSrb;
- QRhiShaderResourceBindings *currentComputeSrb;
- uint currentSrbGeneration;
- int currentResSlot;
- QRhiBuffer *currentIndexBuffer;
- quint32 currentIndexOffset;
- QRhiCommandBuffer::IndexFormat currentIndexFormat;
- int currentCullMode;
- int currentFrontFaceWinding;
-
- const QRhiNativeHandles *nativeHandles();
- void resetState();
- void resetPerPassState();
- void resetPerPassCachedState();
-};
-
-struct QMetalSwapChainData;
-
-struct QMetalSwapChain : public QRhiSwapChain
-{
- QMetalSwapChain(QRhiImplementation *rhi);
- ~QMetalSwapChain();
- void release() override;
-
- QRhiCommandBuffer *currentFrameCommandBuffer() override;
- QRhiRenderTarget *currentFrameRenderTarget() override;
- QSize surfacePixelSize() override;
-
- QRhiRenderPassDescriptor *newCompatibleRenderPassDescriptor() override;
-
- bool buildOrResize() override;
-
- void chooseFormats();
-
- QWindow *window = nullptr;
- QSize pixelSize;
- int currentFrameSlot = 0; // 0..QMTL_FRAMES_IN_FLIGHT-1
- int frameCount = 0;
- int samples = 1;
- QMetalReferenceRenderTarget rtWrapper;
- QMetalCommandBuffer cbWrapper;
- QMetalRenderBuffer *ds = nullptr;
- QMetalSwapChainData *d = nullptr;
-};
-
-struct QRhiMetalData;
-
-class QRhiMetal : public QRhiImplementation
-{
-public:
- QRhiMetal(QRhiMetalInitParams *params, QRhiMetalNativeHandles *importDevice = nullptr);
- ~QRhiMetal();
-
- bool create(QRhi::Flags flags) override;
- void destroy() override;
-
- QRhiGraphicsPipeline *createGraphicsPipeline() override;
- QRhiComputePipeline *createComputePipeline() override;
- QRhiShaderResourceBindings *createShaderResourceBindings() override;
- QRhiBuffer *createBuffer(QRhiBuffer::Type type,
- QRhiBuffer::UsageFlags usage,
- int size) override;
- QRhiRenderBuffer *createRenderBuffer(QRhiRenderBuffer::Type type,
- const QSize &pixelSize,
- int sampleCount,
- QRhiRenderBuffer::Flags flags) override;
- QRhiTexture *createTexture(QRhiTexture::Format format,
- const QSize &pixelSize,
- int sampleCount,
- QRhiTexture::Flags flags) override;
- QRhiSampler *createSampler(QRhiSampler::Filter magFilter, QRhiSampler::Filter minFilter,
- QRhiSampler::Filter mipmapMode,
- QRhiSampler:: AddressMode u, QRhiSampler::AddressMode v) override;
-
- QRhiTextureRenderTarget *createTextureRenderTarget(const QRhiTextureRenderTargetDescription &desc,
- QRhiTextureRenderTarget::Flags flags) override;
-
- QRhiSwapChain *createSwapChain() override;
- QRhi::FrameOpResult beginFrame(QRhiSwapChain *swapChain, QRhi::BeginFrameFlags flags) override;
- QRhi::FrameOpResult endFrame(QRhiSwapChain *swapChain, QRhi::EndFrameFlags flags) override;
- QRhi::FrameOpResult beginOffscreenFrame(QRhiCommandBuffer **cb, QRhi::BeginFrameFlags flags) override;
- QRhi::FrameOpResult endOffscreenFrame(QRhi::EndFrameFlags flags) override;
- QRhi::FrameOpResult finish() override;
-
- void resourceUpdate(QRhiCommandBuffer *cb, QRhiResourceUpdateBatch *resourceUpdates) override;
-
- void beginPass(QRhiCommandBuffer *cb,
- QRhiRenderTarget *rt,
- const QColor &colorClearValue,
- const QRhiDepthStencilClearValue &depthStencilClearValue,
- QRhiResourceUpdateBatch *resourceUpdates) override;
- void endPass(QRhiCommandBuffer *cb, QRhiResourceUpdateBatch *resourceUpdates) override;
-
- void setGraphicsPipeline(QRhiCommandBuffer *cb,
- QRhiGraphicsPipeline *ps) override;
-
- void setShaderResources(QRhiCommandBuffer *cb,
- QRhiShaderResourceBindings *srb,
- int dynamicOffsetCount,
- const QRhiCommandBuffer::DynamicOffset *dynamicOffsets) override;
-
- void setVertexInput(QRhiCommandBuffer *cb,
- int startBinding, int bindingCount, const QRhiCommandBuffer::VertexInput *bindings,
- QRhiBuffer *indexBuf, quint32 indexOffset,
- QRhiCommandBuffer::IndexFormat indexFormat) override;
-
- void setViewport(QRhiCommandBuffer *cb, const QRhiViewport &viewport) override;
- void setScissor(QRhiCommandBuffer *cb, const QRhiScissor &scissor) override;
- void setBlendConstants(QRhiCommandBuffer *cb, const QColor &c) override;
- void setStencilRef(QRhiCommandBuffer *cb, quint32 refValue) override;
-
- void draw(QRhiCommandBuffer *cb, quint32 vertexCount,
- quint32 instanceCount, quint32 firstVertex, quint32 firstInstance) override;
-
- void drawIndexed(QRhiCommandBuffer *cb, quint32 indexCount,
- quint32 instanceCount, quint32 firstIndex,
- qint32 vertexOffset, quint32 firstInstance) override;
-
- void debugMarkBegin(QRhiCommandBuffer *cb, const QByteArray &name) override;
- void debugMarkEnd(QRhiCommandBuffer *cb) override;
- void debugMarkMsg(QRhiCommandBuffer *cb, const QByteArray &msg) override;
-
- void beginComputePass(QRhiCommandBuffer *cb, QRhiResourceUpdateBatch *resourceUpdates) override;
- void endComputePass(QRhiCommandBuffer *cb, QRhiResourceUpdateBatch *resourceUpdates) override;
- void setComputePipeline(QRhiCommandBuffer *cb, QRhiComputePipeline *ps) override;
- void dispatch(QRhiCommandBuffer *cb, int x, int y, int z) override;
-
- const QRhiNativeHandles *nativeHandles(QRhiCommandBuffer *cb) override;
- void beginExternal(QRhiCommandBuffer *cb) override;
- void endExternal(QRhiCommandBuffer *cb) override;
-
- QVector<int> supportedSampleCounts() const override;
- int ubufAlignment() const override;
- bool isYUpInFramebuffer() const override;
- bool isYUpInNDC() const override;
- bool isClipDepthZeroToOne() const override;
- QMatrix4x4 clipSpaceCorrMatrix() const override;
- bool isTextureFormatSupported(QRhiTexture::Format format, QRhiTexture::Flags flags) const override;
- bool isFeatureSupported(QRhi::Feature feature) const override;
- int resourceLimit(QRhi::ResourceLimit limit) const override;
- const QRhiNativeHandles *nativeHandles() override;
- void sendVMemStatsToProfiler() override;
- bool makeThreadLocalNativeContextCurrent() override;
- void releaseCachedResources() override;
- bool isDeviceLost() const override;
-
- void executeDeferredReleases(bool forced = false);
- void finishActiveReadbacks(bool forced = false);
- qsizetype subresUploadByteSize(const QRhiTextureSubresourceUploadDescription &subresDesc) const;
- void enqueueSubresUpload(QMetalTexture *texD, void *mp, void *blitEncPtr,
- int layer, int level, const QRhiTextureSubresourceUploadDescription &subresDesc,
- qsizetype *curOfs);
- void enqueueResourceUpdates(QRhiCommandBuffer *cb, QRhiResourceUpdateBatch *resourceUpdates);
- void executeBufferHostWritesForCurrentFrame(QMetalBuffer *bufD);
- static const int SUPPORTED_STAGES = 3;
- void enqueueShaderResourceBindings(QMetalShaderResourceBindings *srbD,
- QMetalCommandBuffer *cbD,
- int dynamicOffsetCount,
- const QRhiCommandBuffer::DynamicOffset *dynamicOffsets,
- bool offsetOnlyChange,
- const QShader::NativeResourceBindingMap *nativeResourceBindingMaps[SUPPORTED_STAGES]);
- int effectiveSampleCount(int sampleCount) const;
-
- bool importedDevice = false;
- bool importedCmdQueue = false;
- QMetalSwapChain *currentSwapChain = nullptr;
- QSet<QMetalSwapChain *> swapchains;
- QRhiMetalNativeHandles nativeHandlesStruct;
-
- struct {
- int maxTextureSize = 4096;
- } caps;
-
- QRhiMetalData *d = nullptr;
-};
-
-QT_END_NAMESPACE
-
-#endif
diff --git a/src/gui/rhi/qrhinull.cpp b/src/gui/rhi/qrhinull.cpp
index 80f004e049..566b922c1b 100644
--- a/src/gui/rhi/qrhinull.cpp
+++ b/src/gui/rhi/qrhinull.cpp
@@ -1,40 +1,7 @@
-/****************************************************************************
-**
-** Copyright (C) 2019 The Qt Company Ltd.
-** Contact: http://www.qt.io/licensing/
-**
-** This file is part of the Qt Gui module
-**
-** $QT_BEGIN_LICENSE:LGPL3$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "qrhinull_p_p.h"
+// Copyright (C) 2023 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
+
+#include "qrhinull_p.h"
#include <qmath.h>
#include <QPainter>
@@ -42,10 +9,13 @@ QT_BEGIN_NAMESPACE
/*!
\class QRhiNullInitParams
- \internal
\inmodule QtGui
+ \since 6.6
\brief Null backend specific initialization parameters.
+ \note This is a RHI API with limited compatibility guarantees, see \l QRhi
+ for details.
+
A Null QRhi needs no special parameters for initialization.
\badcode
@@ -56,22 +26,17 @@ QT_BEGIN_NAMESPACE
The Null backend does not issue any graphics calls and creates no
resources. All QRhi operations will succeed as normal so applications can
still be run, albeit potentially at an unthrottled speed, depending on
- their frame rendering strategy. The backend reports resources to
- QRhiProfiler as usual.
+ their frame rendering strategy.
*/
/*!
\class QRhiNullNativeHandles
- \internal
\inmodule QtGui
+ \since 6.6
\brief Empty.
- */
-/*!
- \class QRhiNullTextureNativeHandles
- \internal
- \inmodule QtGui
- \brief Empty.
+ \note This is a RHI API with limited compatibility guarantees, see \l QRhi
+ for details.
*/
QRhiNull::QRhiNull(QRhiNullInitParams *params)
@@ -90,7 +55,7 @@ void QRhiNull::destroy()
{
}
-QVector<int> QRhiNull::supportedSampleCounts() const
+QList<int> QRhiNull::supportedSampleCounts() const
{
return { 1 };
}
@@ -100,7 +65,7 @@ QRhiSwapChain *QRhiNull::createSwapChain()
return new QNullSwapChain(this);
}
-QRhiBuffer *QRhiNull::createBuffer(QRhiBuffer::Type type, QRhiBuffer::UsageFlags usage, int size)
+QRhiBuffer *QRhiNull::createBuffer(QRhiBuffer::Type type, QRhiBuffer::UsageFlags usage, quint32 size)
{
return new QNullBuffer(this, type, usage, size);
}
@@ -153,11 +118,30 @@ int QRhiNull::resourceLimit(QRhi::ResourceLimit limit) const
case QRhi::MaxColorAttachments:
return 8;
case QRhi::FramesInFlight:
- return 2; // dummy
- default:
- Q_UNREACHABLE();
+ return 1;
+ case QRhi::MaxAsyncReadbackFrames:
+ return 1;
+ case QRhi::MaxThreadGroupsPerDimension:
+ return 0;
+ case QRhi::MaxThreadsPerThreadGroup:
+ return 0;
+ case QRhi::MaxThreadGroupX:
return 0;
+ case QRhi::MaxThreadGroupY:
+ return 0;
+ case QRhi::MaxThreadGroupZ:
+ return 0;
+ case QRhi::TextureArraySizeMax:
+ return 2048;
+ case QRhi::MaxUniformBufferRange:
+ return 65536;
+ case QRhi::MaxVertexInputs:
+ return 32;
+ case QRhi::MaxVertexOutputs:
+ return 32;
}
+
+ Q_UNREACHABLE_RETURN(0);
}
const QRhiNativeHandles *QRhiNull::nativeHandles()
@@ -165,9 +149,16 @@ const QRhiNativeHandles *QRhiNull::nativeHandles()
return &nativeHandlesStruct;
}
-void QRhiNull::sendVMemStatsToProfiler()
+QRhiDriverInfo QRhiNull::driverInfo() const
{
- // nothing to do here
+ QRhiDriverInfo info;
+ info.deviceName = QByteArrayLiteral("Null");
+ return info;
+}
+
+QRhiStats QRhiNull::statistics()
+{
+ return {};
}
bool QRhiNull::makeThreadLocalNativeContextCurrent()
@@ -186,23 +177,35 @@ bool QRhiNull::isDeviceLost() const
return false;
}
+QByteArray QRhiNull::pipelineCacheData()
+{
+ return QByteArray();
+}
+
+void QRhiNull::setPipelineCacheData(const QByteArray &data)
+{
+ Q_UNUSED(data);
+}
+
QRhiRenderBuffer *QRhiNull::createRenderBuffer(QRhiRenderBuffer::Type type, const QSize &pixelSize,
- int sampleCount, QRhiRenderBuffer::Flags flags)
+ int sampleCount, QRhiRenderBuffer::Flags flags,
+ QRhiTexture::Format backingFormatHint)
{
- return new QNullRenderBuffer(this, type, pixelSize, sampleCount, flags);
+ return new QNullRenderBuffer(this, type, pixelSize, sampleCount, flags, backingFormatHint);
}
-QRhiTexture *QRhiNull::createTexture(QRhiTexture::Format format, const QSize &pixelSize,
+QRhiTexture *QRhiNull::createTexture(QRhiTexture::Format format,
+ const QSize &pixelSize, int depth, int arraySize,
int sampleCount, QRhiTexture::Flags flags)
{
- return new QNullTexture(this, format, pixelSize, sampleCount, flags);
+ return new QNullTexture(this, format, pixelSize, depth, arraySize, sampleCount, flags);
}
QRhiSampler *QRhiNull::createSampler(QRhiSampler::Filter magFilter, QRhiSampler::Filter minFilter,
QRhiSampler::Filter mipmapMode,
- QRhiSampler::AddressMode u, QRhiSampler::AddressMode v)
+ QRhiSampler::AddressMode u, QRhiSampler::AddressMode v, QRhiSampler::AddressMode w)
{
- return new QNullSampler(this, magFilter, minFilter, mipmapMode, u, v);
+ return new QNullSampler(this, magFilter, minFilter, mipmapMode, u, v, w);
}
QRhiTextureRenderTarget *QRhiNull::createTextureRenderTarget(const QRhiTextureRenderTargetDescription &desc,
@@ -347,12 +350,16 @@ void QRhiNull::endExternal(QRhiCommandBuffer *cb)
Q_UNUSED(cb);
}
+double QRhiNull::lastCompletedGpuTime(QRhiCommandBuffer *cb)
+{
+ Q_UNUSED(cb);
+ return 0;
+}
+
QRhi::FrameOpResult QRhiNull::beginFrame(QRhiSwapChain *swapChain, QRhi::BeginFrameFlags flags)
{
Q_UNUSED(flags);
currentSwapChain = swapChain;
- QRhiProfilerPrivate *rhiP = profilerPrivateOrNull();
- QRHI_PROF_F(beginSwapChainFrame(swapChain));
return QRhi::FrameOpSuccess;
}
@@ -360,9 +367,6 @@ QRhi::FrameOpResult QRhiNull::endFrame(QRhiSwapChain *swapChain, QRhi::EndFrameF
{
Q_UNUSED(flags);
QNullSwapChain *swapChainD = QRHI_RES(QNullSwapChain, swapChain);
- QRhiProfilerPrivate *rhiP = profilerPrivateOrNull();
- QRHI_PROF_F(endSwapChainFrame(swapChain, swapChainD->frameCount + 1));
- QRHI_PROF_F(swapChainFrameGpuTime(swapChain, 0.000666f));
swapChainD->frameCount += 1;
currentSwapChain = nullptr;
return QRhi::FrameOpSuccess;
@@ -389,9 +393,9 @@ QRhi::FrameOpResult QRhiNull::finish()
void QRhiNull::simulateTextureUpload(const QRhiResourceUpdateBatchPrivate::TextureOp &u)
{
QNullTexture *texD = QRHI_RES(QNullTexture, u.dst);
- for (int layer = 0; layer < QRhi::MAX_LAYERS; ++layer) {
- for (int level = 0; level < QRhi::MAX_LEVELS; ++level) {
- for (const QRhiTextureSubresourceUploadDescription &subresDesc : qAsConst(u.subresDesc[layer][level])) {
+ for (int layer = 0, maxLayer = u.subresDesc.size(); layer < maxLayer; ++layer) {
+ for (int level = 0; level < QRhi::MAX_MIP_LEVELS; ++level) {
+ for (const QRhiTextureSubresourceUploadDescription &subresDesc : std::as_const(u.subresDesc[layer][level])) {
if (!subresDesc.image().isNull()) {
const QImage src = subresDesc.image();
QPainter painter(&texD->image[layer][level]);
@@ -411,12 +415,15 @@ void QRhiNull::simulateTextureUpload(const QRhiResourceUpdateBatchPrivate::Textu
// sourceTopLeft is not supported on this path as per QRhi docs
const char *src = subresDesc.data().constData();
const int srcBpl = w * 4;
+ int srcStride = srcBpl;
+ if (subresDesc.dataStride())
+ srcStride = subresDesc.dataStride();
const QPoint dstOffset = subresDesc.destinationTopLeft();
uchar *dst = texD->image[layer][level].bits();
const int dstBpl = texD->image[layer][level].bytesPerLine();
for (int y = 0; y < h; ++y) {
memcpy(dst + dstOffset.x() * 4 + (y + dstOffset.y()) * dstBpl,
- src + y * srcBpl,
+ src + y * srcStride,
size_t(srcBpl));
}
}
@@ -453,22 +460,24 @@ void QRhiNull::resourceUpdate(QRhiCommandBuffer *cb, QRhiResourceUpdateBatch *re
{
Q_UNUSED(cb);
QRhiResourceUpdateBatchPrivate *ud = QRhiResourceUpdateBatchPrivate::get(resourceUpdates);
- for (const QRhiResourceUpdateBatchPrivate::BufferOp &u : ud->bufferOps) {
+ for (int opIdx = 0; opIdx < ud->activeBufferOpCount; ++opIdx) {
+ const QRhiResourceUpdateBatchPrivate::BufferOp &u(ud->bufferOps[opIdx]);
if (u.type == QRhiResourceUpdateBatchPrivate::BufferOp::DynamicUpdate
|| u.type == QRhiResourceUpdateBatchPrivate::BufferOp::StaticUpload)
{
QNullBuffer *bufD = QRHI_RES(QNullBuffer, u.buf);
- memcpy(bufD->data.data() + u.offset, u.data.constData(), size_t(u.data.size()));
+ memcpy(bufD->data + u.offset, u.data.constData(), size_t(u.data.size()));
} else if (u.type == QRhiResourceUpdateBatchPrivate::BufferOp::Read) {
- QRhiBufferReadbackResult *result = u.result;
+ QRhiReadbackResult *result = u.result;
result->data.resize(u.readSize);
QNullBuffer *bufD = QRHI_RES(QNullBuffer, u.buf);
- memcpy(result->data.data(), bufD->data.constData() + u.offset, size_t(u.readSize));
+ memcpy(result->data.data(), bufD->data + u.offset, size_t(u.readSize));
if (result->completed)
result->completed();
}
}
- for (const QRhiResourceUpdateBatchPrivate::TextureOp &u : ud->textureOps) {
+ for (int opIdx = 0; opIdx < ud->activeTextureOpCount; ++opIdx) {
+ const QRhiResourceUpdateBatchPrivate::TextureOp &u(ud->textureOps[opIdx]);
if (u.type == QRhiResourceUpdateBatchPrivate::TextureOp::Upload) {
if (u.dst->format() == QRhiTexture::RGBA8)
simulateTextureUpload(u);
@@ -488,7 +497,7 @@ void QRhiNull::resourceUpdate(QRhiCommandBuffer *cb, QRhiResourceUpdateBatch *re
}
quint32 bytesPerLine = 0;
quint32 byteSize = 0;
- textureFormatInfo(result->format, result->pixelSize, &bytesPerLine, &byteSize);
+ textureFormatInfo(result->format, result->pixelSize, &bytesPerLine, &byteSize, nullptr);
if (texD && texD->format() == QRhiTexture::RGBA8) {
result->data.resize(int(byteSize));
const QImage &src(texD->image[u.rb.layer()][u.rb.level()]);
@@ -514,13 +523,21 @@ void QRhiNull::beginPass(QRhiCommandBuffer *cb,
QRhiRenderTarget *rt,
const QColor &colorClearValue,
const QRhiDepthStencilClearValue &depthStencilClearValue,
- QRhiResourceUpdateBatch *resourceUpdates)
+ QRhiResourceUpdateBatch *resourceUpdates,
+ QRhiCommandBuffer::BeginPassFlags flags)
{
- Q_UNUSED(rt);
Q_UNUSED(colorClearValue);
Q_UNUSED(depthStencilClearValue);
+ Q_UNUSED(flags);
+
if (resourceUpdates)
resourceUpdate(cb, resourceUpdates);
+
+ if (rt->resourceType() == QRhiRenderTarget::TextureRenderTarget) {
+ QNullTextureRenderTarget *rtTex = QRHI_RES(QNullTextureRenderTarget, rt);
+ if (!QRhiRenderTargetAttachmentTracker::isUpToDate<QNullTexture, QNullRenderBuffer>(rtTex->description(), rtTex->d.currentResIdList))
+ rtTex->create();
+ }
}
void QRhiNull::endPass(QRhiCommandBuffer *cb, QRhiResourceUpdateBatch *resourceUpdates)
@@ -529,8 +546,11 @@ void QRhiNull::endPass(QRhiCommandBuffer *cb, QRhiResourceUpdateBatch *resourceU
resourceUpdate(cb, resourceUpdates);
}
-void QRhiNull::beginComputePass(QRhiCommandBuffer *cb, QRhiResourceUpdateBatch *resourceUpdates)
+void QRhiNull::beginComputePass(QRhiCommandBuffer *cb,
+ QRhiResourceUpdateBatch *resourceUpdates,
+ QRhiCommandBuffer::BeginPassFlags flags)
{
+ Q_UNUSED(flags);
if (resourceUpdates)
resourceUpdate(cb, resourceUpdates);
}
@@ -541,54 +561,78 @@ void QRhiNull::endComputePass(QRhiCommandBuffer *cb, QRhiResourceUpdateBatch *re
resourceUpdate(cb, resourceUpdates);
}
-QNullBuffer::QNullBuffer(QRhiImplementation *rhi, Type type, UsageFlags usage, int size)
+QNullBuffer::QNullBuffer(QRhiImplementation *rhi, Type type, UsageFlags usage, quint32 size)
: QRhiBuffer(rhi, type, usage, size)
{
}
QNullBuffer::~QNullBuffer()
{
- release();
+ destroy();
}
-void QNullBuffer::release()
+void QNullBuffer::destroy()
{
- data.clear();
+ delete[] data;
+ data = nullptr;
- QRHI_PROF;
- QRHI_PROF_F(releaseBuffer(this));
+ QRHI_RES_RHI(QRhiNull);
+ if (rhiD)
+ rhiD->unregisterResource(this);
}
-bool QNullBuffer::build()
+bool QNullBuffer::create()
{
- data.fill('\0', m_size);
+ if (data)
+ destroy();
+
+ data = new char[m_size];
+ memset(data, 0, m_size);
+
+ QRHI_RES_RHI(QRhiNull);
+ rhiD->registerResource(this);
- QRHI_PROF;
- QRHI_PROF_F(newBuffer(this, uint(m_size), 1, 0));
return true;
}
+char *QNullBuffer::beginFullDynamicBufferUpdateForCurrentFrame()
+{
+ Q_ASSERT(m_type == Dynamic);
+ return data;
+}
+
QNullRenderBuffer::QNullRenderBuffer(QRhiImplementation *rhi, Type type, const QSize &pixelSize,
- int sampleCount, QRhiRenderBuffer::Flags flags)
- : QRhiRenderBuffer(rhi, type, pixelSize, sampleCount, flags)
+ int sampleCount, QRhiRenderBuffer::Flags flags,
+ QRhiTexture::Format backingFormatHint)
+ : QRhiRenderBuffer(rhi, type, pixelSize, sampleCount, flags, backingFormatHint)
{
}
QNullRenderBuffer::~QNullRenderBuffer()
{
- release();
+ destroy();
}
-void QNullRenderBuffer::release()
+void QNullRenderBuffer::destroy()
{
- QRHI_PROF;
- QRHI_PROF_F(releaseRenderBuffer(this));
+ valid = false;
+
+ QRHI_RES_RHI(QRhiNull);
+ if (rhiD)
+ rhiD->unregisterResource(this);
}
-bool QNullRenderBuffer::build()
+bool QNullRenderBuffer::create()
{
- QRHI_PROF;
- QRHI_PROF_F(newRenderBuffer(this, false, false, 1));
+ if (valid)
+ destroy();
+
+ valid = true;
+ generation += 1;
+
+ QRHI_RES_RHI(QRhiNull);
+ rhiD->registerResource(this);
+
return true;
}
@@ -597,33 +641,49 @@ QRhiTexture::Format QNullRenderBuffer::backingFormat() const
return m_type == Color ? QRhiTexture::RGBA8 : QRhiTexture::UnknownFormat;
}
-QNullTexture::QNullTexture(QRhiImplementation *rhi, Format format, const QSize &pixelSize,
- int sampleCount, Flags flags)
- : QRhiTexture(rhi, format, pixelSize, sampleCount, flags)
+QNullTexture::QNullTexture(QRhiImplementation *rhi, Format format, const QSize &pixelSize, int depth,
+ int arraySize, int sampleCount, Flags flags)
+ : QRhiTexture(rhi, format, pixelSize, depth, arraySize, sampleCount, flags)
{
}
QNullTexture::~QNullTexture()
{
- release();
+ destroy();
}
-void QNullTexture::release()
+void QNullTexture::destroy()
{
- QRHI_PROF;
- QRHI_PROF_F(releaseTexture(this));
+ valid = false;
+
+ QRHI_RES_RHI(QRhiNull);
+ if (rhiD)
+ rhiD->unregisterResource(this);
}
-bool QNullTexture::build()
+bool QNullTexture::create()
{
+ if (valid)
+ destroy();
+
+ valid = true;
+
QRHI_RES_RHI(QRhiNull);
const bool isCube = m_flags.testFlag(CubeMap);
+ const bool is3D = m_flags.testFlag(ThreeDimensional);
+ const bool isArray = m_flags.testFlag(TextureArray);
const bool hasMipMaps = m_flags.testFlag(MipMapped);
- QSize size = m_pixelSize.isEmpty() ? QSize(1, 1) : m_pixelSize;
+ const bool is1D = m_flags.testFlags(OneDimensional);
+ QSize size = is1D ? QSize(qMax(1, m_pixelSize.width()), 1)
+ : (m_pixelSize.isEmpty() ? QSize(1, 1) : m_pixelSize);
const int mipLevelCount = hasMipMaps ? rhiD->q->mipLevelsForSize(size) : 1;
- const int layerCount = isCube ? 6 : 1;
+ const int layerCount = is3D ? qMax(1, m_depth)
+ : (isCube ? 6
+ : (isArray ? qMax(0, m_arraySize)
+ : 1));
if (m_format == RGBA8) {
+ image.resize(layerCount);
for (int layer = 0; layer < layerCount; ++layer) {
for (int level = 0; level < mipLevelCount; ++level) {
image[layer][level] = QImage(rhiD->q->sizeForMipLevel(level, size),
@@ -633,52 +693,51 @@ bool QNullTexture::build()
}
}
- QRHI_PROF;
- QRHI_PROF_F(newTexture(this, true, mipLevelCount, layerCount, 1));
+ generation += 1;
+
+ rhiD->registerResource(this);
+
return true;
}
-bool QNullTexture::buildFrom(const QRhiNativeHandles *src)
+bool QNullTexture::createFrom(QRhiTexture::NativeTexture src)
{
Q_UNUSED(src);
- QRHI_RES_RHI(QRhiNull);
- const bool isCube = m_flags.testFlag(CubeMap);
- const bool hasMipMaps = m_flags.testFlag(MipMapped);
- QSize size = m_pixelSize.isEmpty() ? QSize(1, 1) : m_pixelSize;
- const int mipLevelCount = hasMipMaps ? rhiD->q->mipLevelsForSize(size) : 1;
- QRHI_PROF;
- QRHI_PROF_F(newTexture(this, false, mipLevelCount, isCube ? 6 : 1, 1));
- return true;
-}
+ if (valid)
+ destroy();
-bool QNullTexture::buildFrom(QRhiTexture::NativeTexture src)
-{
- Q_UNUSED(src)
- return buildFrom(nullptr);
-}
+ valid = true;
-const QRhiNativeHandles *QNullTexture::nativeHandles()
-{
- return &nativeHandlesStruct;
+ generation += 1;
+
+ QRHI_RES_RHI(QRhiNull);
+ rhiD->registerResource(this);
+
+ return true;
}
QNullSampler::QNullSampler(QRhiImplementation *rhi, Filter magFilter, Filter minFilter, Filter mipmapMode,
- AddressMode u, AddressMode v)
- : QRhiSampler(rhi, magFilter, minFilter, mipmapMode, u, v)
+ AddressMode u, AddressMode v, AddressMode w)
+ : QRhiSampler(rhi, magFilter, minFilter, mipmapMode, u, v, w)
{
}
QNullSampler::~QNullSampler()
{
- release();
+ destroy();
}
-void QNullSampler::release()
+void QNullSampler::destroy()
{
+ QRHI_RES_RHI(QRhiNull);
+ if (rhiD)
+ rhiD->unregisterResource(this);
}
-bool QNullSampler::build()
+bool QNullSampler::create()
{
+ QRHI_RES_RHI(QRhiNull);
+ rhiD->registerResource(this);
return true;
}
@@ -689,11 +748,14 @@ QNullRenderPassDescriptor::QNullRenderPassDescriptor(QRhiImplementation *rhi)
QNullRenderPassDescriptor::~QNullRenderPassDescriptor()
{
- release();
+ destroy();
}
-void QNullRenderPassDescriptor::release()
+void QNullRenderPassDescriptor::destroy()
{
+ QRHI_RES_RHI(QRhiNull);
+ if (rhiD)
+ rhiD->unregisterResource(this);
}
bool QNullRenderPassDescriptor::isCompatible(const QRhiRenderPassDescriptor *other) const
@@ -702,32 +764,45 @@ bool QNullRenderPassDescriptor::isCompatible(const QRhiRenderPassDescriptor *oth
return true;
}
-QNullReferenceRenderTarget::QNullReferenceRenderTarget(QRhiImplementation *rhi)
- : QRhiRenderTarget(rhi),
+QRhiRenderPassDescriptor *QNullRenderPassDescriptor::newCompatibleRenderPassDescriptor() const
+{
+ QNullRenderPassDescriptor *rpD = new QNullRenderPassDescriptor(m_rhi);
+ QRHI_RES_RHI(QRhiNull);
+ rhiD->registerResource(rpD, false);
+ return rpD;
+}
+
+QVector<quint32> QNullRenderPassDescriptor::serializedFormat() const
+{
+ return {};
+}
+
+QNullSwapChainRenderTarget::QNullSwapChainRenderTarget(QRhiImplementation *rhi, QRhiSwapChain *swapchain)
+ : QRhiSwapChainRenderTarget(rhi, swapchain),
d(rhi)
{
}
-QNullReferenceRenderTarget::~QNullReferenceRenderTarget()
+QNullSwapChainRenderTarget::~QNullSwapChainRenderTarget()
{
- release();
+ destroy();
}
-void QNullReferenceRenderTarget::release()
+void QNullSwapChainRenderTarget::destroy()
{
}
-QSize QNullReferenceRenderTarget::pixelSize() const
+QSize QNullSwapChainRenderTarget::pixelSize() const
{
return d.pixelSize;
}
-float QNullReferenceRenderTarget::devicePixelRatio() const
+float QNullSwapChainRenderTarget::devicePixelRatio() const
{
return d.dpr;
}
-int QNullReferenceRenderTarget::sampleCount() const
+int QNullSwapChainRenderTarget::sampleCount() const
{
return 1;
}
@@ -742,35 +817,48 @@ QNullTextureRenderTarget::QNullTextureRenderTarget(QRhiImplementation *rhi,
QNullTextureRenderTarget::~QNullTextureRenderTarget()
{
- release();
+ destroy();
}
-void QNullTextureRenderTarget::release()
+void QNullTextureRenderTarget::destroy()
{
+ QRHI_RES_RHI(QRhiNull);
+ if (rhiD)
+ rhiD->unregisterResource(this);
}
QRhiRenderPassDescriptor *QNullTextureRenderTarget::newCompatibleRenderPassDescriptor()
{
- return new QNullRenderPassDescriptor(m_rhi);
+ QNullRenderPassDescriptor *rpD = new QNullRenderPassDescriptor(m_rhi);
+ QRHI_RES_RHI(QRhiNull);
+ rhiD->registerResource(rpD, false);
+ return rpD;
}
-bool QNullTextureRenderTarget::build()
+bool QNullTextureRenderTarget::create()
{
+ QRHI_RES_RHI(QRhiNull);
d.rp = QRHI_RES(QNullRenderPassDescriptor, m_renderPassDesc);
if (m_desc.cbeginColorAttachments() != m_desc.cendColorAttachments()) {
- QRhiTexture *tex = m_desc.cbeginColorAttachments()->texture();
- QRhiRenderBuffer *rb = m_desc.cbeginColorAttachments()->renderBuffer();
- d.pixelSize = tex ? tex->pixelSize() : rb->pixelSize();
+ const QRhiColorAttachment *colorAtt = m_desc.cbeginColorAttachments();
+ QRhiTexture *tex = colorAtt->texture();
+ QRhiRenderBuffer *rb = colorAtt->renderBuffer();
+ d.pixelSize = tex ? rhiD->q->sizeForMipLevel(colorAtt->level(), tex->pixelSize()) : rb->pixelSize();
} else if (m_desc.depthStencilBuffer()) {
d.pixelSize = m_desc.depthStencilBuffer()->pixelSize();
} else if (m_desc.depthTexture()) {
d.pixelSize = m_desc.depthTexture()->pixelSize();
}
+ QRhiRenderTargetAttachmentTracker::updateResIdList<QNullTexture, QNullRenderBuffer>(m_desc, &d.currentResIdList);
+ rhiD->registerResource(this);
return true;
}
QSize QNullTextureRenderTarget::pixelSize() const
{
+ if (!QRhiRenderTargetAttachmentTracker::isUpToDate<QNullTexture, QNullRenderBuffer>(m_desc, d.currentResIdList))
+ const_cast<QNullTextureRenderTarget *>(this)->create();
+
return d.pixelSize;
}
@@ -791,18 +879,33 @@ QNullShaderResourceBindings::QNullShaderResourceBindings(QRhiImplementation *rhi
QNullShaderResourceBindings::~QNullShaderResourceBindings()
{
- release();
+ destroy();
}
-void QNullShaderResourceBindings::release()
+void QNullShaderResourceBindings::destroy()
{
+ QRHI_RES_RHI(QRhiNull);
+ if (rhiD)
+ rhiD->unregisterResource(this);
}
-bool QNullShaderResourceBindings::build()
+bool QNullShaderResourceBindings::create()
{
+ QRHI_RES_RHI(QRhiNull);
+ if (!rhiD->sanityCheckShaderResourceBindings(this))
+ return false;
+
+ rhiD->updateLayoutDesc(this);
+
+ rhiD->registerResource(this, false);
return true;
}
+void QNullShaderResourceBindings::updateResources(UpdateFlags flags)
+{
+ Q_UNUSED(flags);
+}
+
QNullGraphicsPipeline::QNullGraphicsPipeline(QRhiImplementation *rhi)
: QRhiGraphicsPipeline(rhi)
{
@@ -810,19 +913,23 @@ QNullGraphicsPipeline::QNullGraphicsPipeline(QRhiImplementation *rhi)
QNullGraphicsPipeline::~QNullGraphicsPipeline()
{
- release();
+ destroy();
}
-void QNullGraphicsPipeline::release()
+void QNullGraphicsPipeline::destroy()
{
+ QRHI_RES_RHI(QRhiNull);
+ if (rhiD)
+ rhiD->unregisterResource(this);
}
-bool QNullGraphicsPipeline::build()
+bool QNullGraphicsPipeline::create()
{
QRHI_RES_RHI(QRhiNull);
if (!rhiD->sanityCheckGraphicsPipeline(this))
return false;
+ rhiD->registerResource(this);
return true;
}
@@ -833,15 +940,20 @@ QNullComputePipeline::QNullComputePipeline(QRhiImplementation *rhi)
QNullComputePipeline::~QNullComputePipeline()
{
- release();
+ destroy();
}
-void QNullComputePipeline::release()
+void QNullComputePipeline::destroy()
{
+ QRHI_RES_RHI(QRhiNull);
+ if (rhiD)
+ rhiD->unregisterResource(this);
}
-bool QNullComputePipeline::build()
+bool QNullComputePipeline::create()
{
+ QRHI_RES_RHI(QRhiNull);
+ rhiD->registerResource(this);
return true;
}
@@ -852,30 +964,31 @@ QNullCommandBuffer::QNullCommandBuffer(QRhiImplementation *rhi)
QNullCommandBuffer::~QNullCommandBuffer()
{
- release();
+ destroy();
}
-void QNullCommandBuffer::release()
+void QNullCommandBuffer::destroy()
{
// nothing to do here
}
QNullSwapChain::QNullSwapChain(QRhiImplementation *rhi)
: QRhiSwapChain(rhi),
- rt(rhi),
+ rt(rhi, this),
cb(rhi)
{
}
QNullSwapChain::~QNullSwapChain()
{
- release();
+ destroy();
}
-void QNullSwapChain::release()
+void QNullSwapChain::destroy()
{
- QRHI_PROF;
- QRHI_PROF_F(releaseSwapChain(this));
+ QRHI_RES_RHI(QRhiNull);
+ if (rhiD)
+ rhiD->unregisterResource(this);
}
QRhiCommandBuffer *QNullSwapChain::currentFrameCommandBuffer()
@@ -893,19 +1006,37 @@ QSize QNullSwapChain::surfacePixelSize()
return QSize(1280, 720);
}
+bool QNullSwapChain::isFormatSupported(Format f)
+{
+ return f == SDR;
+}
+
QRhiRenderPassDescriptor *QNullSwapChain::newCompatibleRenderPassDescriptor()
{
- return new QNullRenderPassDescriptor(m_rhi);
+ QNullRenderPassDescriptor *rpD = new QNullRenderPassDescriptor(m_rhi);
+ QRHI_RES_RHI(QRhiNull);
+ rhiD->registerResource(rpD, false);
+ return rpD;
}
-bool QNullSwapChain::buildOrResize()
+bool QNullSwapChain::createOrResize()
{
+ const bool needsRegistration = !window || window != m_window;
+ if (window && window != m_window)
+ destroy();
+
+ window = m_window;
m_currentPixelSize = surfacePixelSize();
+ rt.setRenderPassDescriptor(m_renderPassDesc); // for the public getter in QRhiRenderTarget
rt.d.rp = QRHI_RES(QNullRenderPassDescriptor, m_renderPassDesc);
rt.d.pixelSize = m_currentPixelSize;
frameCount = 0;
- QRHI_PROF;
- QRHI_PROF_F(resizeSwapChain(this, 1, 0, 1));
+
+ if (needsRegistration) {
+ QRHI_RES_RHI(QRhiNull);
+ rhiD->registerResource(this);
+ }
+
return true;
}
diff --git a/src/gui/rhi/qrhinull_p.h b/src/gui/rhi/qrhinull_p.h
index 7d3ce5dbf1..fc266b4f38 100644
--- a/src/gui/rhi/qrhinull_p.h
+++ b/src/gui/rhi/qrhinull_p.h
@@ -1,41 +1,8 @@
-/****************************************************************************
-**
-** Copyright (C) 2019 The Qt Company Ltd.
-** Contact: http://www.qt.io/licensing/
-**
-** This file is part of the Qt Gui module
-**
-** $QT_BEGIN_LICENSE:LGPL3$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef QRHINULL_H
-#define QRHINULL_H
+// Copyright (C) 2023 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
+
+#ifndef QRHINULL_P_H
+#define QRHINULL_P_H
//
// W A R N I N G
@@ -48,20 +15,279 @@
// We mean it.
//
-#include <private/qrhi_p.h>
+#include "qrhi_p.h"
QT_BEGIN_NAMESPACE
-struct Q_GUI_EXPORT QRhiNullInitParams : public QRhiInitParams
+struct QNullBuffer : public QRhiBuffer
+{
+ QNullBuffer(QRhiImplementation *rhi, Type type, UsageFlags usage, quint32 size);
+ ~QNullBuffer();
+ void destroy() override;
+ bool create() override;
+ char *beginFullDynamicBufferUpdateForCurrentFrame() override;
+
+ char *data = nullptr;
+};
+
+struct QNullRenderBuffer : public QRhiRenderBuffer
+{
+ QNullRenderBuffer(QRhiImplementation *rhi, Type type, const QSize &pixelSize,
+ int sampleCount, QRhiRenderBuffer::Flags flags,
+ QRhiTexture::Format backingFormatHint);
+ ~QNullRenderBuffer();
+ void destroy() override;
+ bool create() override;
+ QRhiTexture::Format backingFormat() const override;
+
+ bool valid = false;
+ uint generation = 0;
+};
+
+struct QNullTexture : public QRhiTexture
+{
+ QNullTexture(QRhiImplementation *rhi, Format format, const QSize &pixelSize, int depth,
+ int arraySize, int sampleCount, Flags flags);
+ ~QNullTexture();
+ void destroy() override;
+ bool create() override;
+ bool createFrom(NativeTexture src) override;
+
+ bool valid = false;
+ QVarLengthArray<std::array<QImage, QRhi::MAX_MIP_LEVELS>, 6> image;
+ uint generation = 0;
+};
+
+struct QNullSampler : public QRhiSampler
+{
+ QNullSampler(QRhiImplementation *rhi, Filter magFilter, Filter minFilter, Filter mipmapMode,
+ AddressMode u, AddressMode v, AddressMode w);
+ ~QNullSampler();
+ void destroy() override;
+ bool create() override;
+};
+
+struct QNullRenderPassDescriptor : public QRhiRenderPassDescriptor
+{
+ QNullRenderPassDescriptor(QRhiImplementation *rhi);
+ ~QNullRenderPassDescriptor();
+ void destroy() override;
+ bool isCompatible(const QRhiRenderPassDescriptor *other) const override;
+ QRhiRenderPassDescriptor *newCompatibleRenderPassDescriptor() const override;
+ QVector<quint32> serializedFormat() const override;
+};
+
+struct QNullRenderTargetData
+{
+ QNullRenderTargetData(QRhiImplementation *) { }
+
+ QNullRenderPassDescriptor *rp = nullptr;
+ QSize pixelSize;
+ float dpr = 1;
+ QRhiRenderTargetAttachmentTracker::ResIdList currentResIdList;
+};
+
+struct QNullSwapChainRenderTarget : public QRhiSwapChainRenderTarget
+{
+ QNullSwapChainRenderTarget(QRhiImplementation *rhi, QRhiSwapChain *swapchain);
+ ~QNullSwapChainRenderTarget();
+ void destroy() override;
+
+ QSize pixelSize() const override;
+ float devicePixelRatio() const override;
+ int sampleCount() const override;
+
+ QNullRenderTargetData d;
+};
+
+struct QNullTextureRenderTarget : public QRhiTextureRenderTarget
+{
+ QNullTextureRenderTarget(QRhiImplementation *rhi, const QRhiTextureRenderTargetDescription &desc, Flags flags);
+ ~QNullTextureRenderTarget();
+ void destroy() override;
+
+ QSize pixelSize() const override;
+ float devicePixelRatio() const override;
+ int sampleCount() const override;
+
+ QRhiRenderPassDescriptor *newCompatibleRenderPassDescriptor() override;
+ bool create() override;
+
+ QNullRenderTargetData d;
+};
+
+struct QNullShaderResourceBindings : public QRhiShaderResourceBindings
{
+ QNullShaderResourceBindings(QRhiImplementation *rhi);
+ ~QNullShaderResourceBindings();
+ void destroy() override;
+ bool create() override;
+ void updateResources(UpdateFlags flags) override;
};
-struct Q_GUI_EXPORT QRhiNullNativeHandles : public QRhiNativeHandles
+struct QNullGraphicsPipeline : public QRhiGraphicsPipeline
{
+ QNullGraphicsPipeline(QRhiImplementation *rhi);
+ ~QNullGraphicsPipeline();
+ void destroy() override;
+ bool create() override;
};
-struct Q_GUI_EXPORT QRhiNullTextureNativeHandles : public QRhiNativeHandles
+struct QNullComputePipeline : public QRhiComputePipeline
{
+ QNullComputePipeline(QRhiImplementation *rhi);
+ ~QNullComputePipeline();
+ void destroy() override;
+ bool create() override;
+};
+
+struct QNullCommandBuffer : public QRhiCommandBuffer
+{
+ QNullCommandBuffer(QRhiImplementation *rhi);
+ ~QNullCommandBuffer();
+ void destroy() override;
+};
+
+struct QNullSwapChain : public QRhiSwapChain
+{
+ QNullSwapChain(QRhiImplementation *rhi);
+ ~QNullSwapChain();
+ void destroy() override;
+
+ QRhiCommandBuffer *currentFrameCommandBuffer() override;
+ QRhiRenderTarget *currentFrameRenderTarget() override;
+
+ QSize surfacePixelSize() override;
+ bool isFormatSupported(Format f) override;
+
+ QRhiRenderPassDescriptor *newCompatibleRenderPassDescriptor() override;
+ bool createOrResize() override;
+
+ QWindow *window = nullptr;
+ QNullSwapChainRenderTarget rt;
+ QNullCommandBuffer cb;
+ int frameCount = 0;
+};
+
+class QRhiNull : public QRhiImplementation
+{
+public:
+ QRhiNull(QRhiNullInitParams *params);
+
+ bool create(QRhi::Flags flags) override;
+ void destroy() override;
+
+ QRhiGraphicsPipeline *createGraphicsPipeline() override;
+ QRhiComputePipeline *createComputePipeline() override;
+ QRhiShaderResourceBindings *createShaderResourceBindings() override;
+ QRhiBuffer *createBuffer(QRhiBuffer::Type type,
+ QRhiBuffer::UsageFlags usage,
+ quint32 size) override;
+ QRhiRenderBuffer *createRenderBuffer(QRhiRenderBuffer::Type type,
+ const QSize &pixelSize,
+ int sampleCount,
+ QRhiRenderBuffer::Flags flags,
+ QRhiTexture::Format backingFormatHint) override;
+ QRhiTexture *createTexture(QRhiTexture::Format format,
+ const QSize &pixelSize,
+ int depth,
+ int arraySize,
+ int sampleCount,
+ QRhiTexture::Flags flags) override;
+ QRhiSampler *createSampler(QRhiSampler::Filter magFilter,
+ QRhiSampler::Filter minFilter,
+ QRhiSampler::Filter mipmapMode,
+ QRhiSampler:: AddressMode u,
+ QRhiSampler::AddressMode v,
+ QRhiSampler::AddressMode w) override;
+
+ QRhiTextureRenderTarget *createTextureRenderTarget(const QRhiTextureRenderTargetDescription &desc,
+ QRhiTextureRenderTarget::Flags flags) override;
+
+ QRhiSwapChain *createSwapChain() override;
+ QRhi::FrameOpResult beginFrame(QRhiSwapChain *swapChain, QRhi::BeginFrameFlags flags) override;
+ QRhi::FrameOpResult endFrame(QRhiSwapChain *swapChain, QRhi::EndFrameFlags flags) override;
+ QRhi::FrameOpResult beginOffscreenFrame(QRhiCommandBuffer **cb, QRhi::BeginFrameFlags flags) override;
+ QRhi::FrameOpResult endOffscreenFrame(QRhi::EndFrameFlags flags) override;
+ QRhi::FrameOpResult finish() override;
+
+ void resourceUpdate(QRhiCommandBuffer *cb, QRhiResourceUpdateBatch *resourceUpdates) override;
+
+ void beginPass(QRhiCommandBuffer *cb,
+ QRhiRenderTarget *rt,
+ const QColor &colorClearValue,
+ const QRhiDepthStencilClearValue &depthStencilClearValue,
+ QRhiResourceUpdateBatch *resourceUpdates,
+ QRhiCommandBuffer::BeginPassFlags flags) override;
+ void endPass(QRhiCommandBuffer *cb, QRhiResourceUpdateBatch *resourceUpdates) override;
+
+ void setGraphicsPipeline(QRhiCommandBuffer *cb,
+ QRhiGraphicsPipeline *ps) override;
+
+ void setShaderResources(QRhiCommandBuffer *cb,
+ QRhiShaderResourceBindings *srb,
+ int dynamicOffsetCount,
+ const QRhiCommandBuffer::DynamicOffset *dynamicOffsets) override;
+
+ void setVertexInput(QRhiCommandBuffer *cb,
+ int startBinding, int bindingCount, const QRhiCommandBuffer::VertexInput *bindings,
+ QRhiBuffer *indexBuf, quint32 indexOffset,
+ QRhiCommandBuffer::IndexFormat indexFormat) override;
+
+ void setViewport(QRhiCommandBuffer *cb, const QRhiViewport &viewport) override;
+ void setScissor(QRhiCommandBuffer *cb, const QRhiScissor &scissor) override;
+ void setBlendConstants(QRhiCommandBuffer *cb, const QColor &c) override;
+ void setStencilRef(QRhiCommandBuffer *cb, quint32 refValue) override;
+
+ void draw(QRhiCommandBuffer *cb, quint32 vertexCount,
+ quint32 instanceCount, quint32 firstVertex, quint32 firstInstance) override;
+
+ void drawIndexed(QRhiCommandBuffer *cb, quint32 indexCount,
+ quint32 instanceCount, quint32 firstIndex,
+ qint32 vertexOffset, quint32 firstInstance) override;
+
+ void debugMarkBegin(QRhiCommandBuffer *cb, const QByteArray &name) override;
+ void debugMarkEnd(QRhiCommandBuffer *cb) override;
+ void debugMarkMsg(QRhiCommandBuffer *cb, const QByteArray &msg) override;
+
+ void beginComputePass(QRhiCommandBuffer *cb,
+ QRhiResourceUpdateBatch *resourceUpdates,
+ QRhiCommandBuffer::BeginPassFlags flags) override;
+ void endComputePass(QRhiCommandBuffer *cb, QRhiResourceUpdateBatch *resourceUpdates) override;
+ void setComputePipeline(QRhiCommandBuffer *cb, QRhiComputePipeline *ps) override;
+ void dispatch(QRhiCommandBuffer *cb, int x, int y, int z) override;
+
+ const QRhiNativeHandles *nativeHandles(QRhiCommandBuffer *cb) override;
+ void beginExternal(QRhiCommandBuffer *cb) override;
+ void endExternal(QRhiCommandBuffer *cb) override;
+ double lastCompletedGpuTime(QRhiCommandBuffer *cb) override;
+
+ QList<int> supportedSampleCounts() const override;
+ int ubufAlignment() const override;
+ bool isYUpInFramebuffer() const override;
+ bool isYUpInNDC() const override;
+ bool isClipDepthZeroToOne() const override;
+ QMatrix4x4 clipSpaceCorrMatrix() const override;
+ bool isTextureFormatSupported(QRhiTexture::Format format, QRhiTexture::Flags flags) const override;
+ bool isFeatureSupported(QRhi::Feature feature) const override;
+ int resourceLimit(QRhi::ResourceLimit limit) const override;
+ const QRhiNativeHandles *nativeHandles() override;
+ QRhiDriverInfo driverInfo() const override;
+ QRhiStats statistics() override;
+ bool makeThreadLocalNativeContextCurrent() override;
+ void releaseCachedResources() override;
+ bool isDeviceLost() const override;
+
+ QByteArray pipelineCacheData() override;
+ void setPipelineCacheData(const QByteArray &data) override;
+
+ void simulateTextureUpload(const QRhiResourceUpdateBatchPrivate::TextureOp &u);
+ void simulateTextureCopy(const QRhiResourceUpdateBatchPrivate::TextureOp &u);
+ void simulateTextureGenMips(const QRhiResourceUpdateBatchPrivate::TextureOp &u);
+
+ QRhiNullNativeHandles nativeHandlesStruct;
+ QRhiSwapChain *currentSwapChain = nullptr;
+ QNullCommandBuffer offscreenCommandBuffer;
};
QT_END_NAMESPACE
diff --git a/src/gui/rhi/qrhinull_p_p.h b/src/gui/rhi/qrhinull_p_p.h
deleted file mode 100644
index 57c3de0418..0000000000
--- a/src/gui/rhi/qrhinull_p_p.h
+++ /dev/null
@@ -1,305 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2019 The Qt Company Ltd.
-** Contact: http://www.qt.io/licensing/
-**
-** This file is part of the Qt Gui module
-**
-** $QT_BEGIN_LICENSE:LGPL3$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef QRHINULL_P_H
-#define QRHINULL_P_H
-
-//
-// W A R N I N G
-// -------------
-//
-// This file is not part of the Qt API. It exists purely as an
-// implementation detail. This header file may change from version to
-// version without notice, or even be removed.
-//
-// We mean it.
-//
-
-#include "qrhinull_p.h"
-#include "qrhi_p_p.h"
-
-QT_BEGIN_NAMESPACE
-
-struct QNullBuffer : public QRhiBuffer
-{
- QNullBuffer(QRhiImplementation *rhi, Type type, UsageFlags usage, int size);
- ~QNullBuffer();
- void release() override;
- bool build() override;
-
- QByteArray data;
-};
-
-struct QNullRenderBuffer : public QRhiRenderBuffer
-{
- QNullRenderBuffer(QRhiImplementation *rhi, Type type, const QSize &pixelSize,
- int sampleCount, QRhiRenderBuffer::Flags flags);
- ~QNullRenderBuffer();
- void release() override;
- bool build() override;
- QRhiTexture::Format backingFormat() const override;
-};
-
-struct QNullTexture : public QRhiTexture
-{
- QNullTexture(QRhiImplementation *rhi, Format format, const QSize &pixelSize,
- int sampleCount, Flags flags);
- ~QNullTexture();
- void release() override;
- bool build() override;
- bool buildFrom(const QRhiNativeHandles *src) override;
- bool buildFrom(NativeTexture src) override;
- const QRhiNativeHandles *nativeHandles() override;
-
- QRhiNullTextureNativeHandles nativeHandlesStruct;
- QImage image[QRhi::MAX_LAYERS][QRhi::MAX_LEVELS];
-};
-
-struct QNullSampler : public QRhiSampler
-{
- QNullSampler(QRhiImplementation *rhi, Filter magFilter, Filter minFilter, Filter mipmapMode,
- AddressMode u, AddressMode v);
- ~QNullSampler();
- void release() override;
- bool build() override;
-};
-
-struct QNullRenderPassDescriptor : public QRhiRenderPassDescriptor
-{
- QNullRenderPassDescriptor(QRhiImplementation *rhi);
- ~QNullRenderPassDescriptor();
- void release() override;
- bool isCompatible(const QRhiRenderPassDescriptor *other) const override;
-};
-
-struct QNullRenderTargetData
-{
- QNullRenderTargetData(QRhiImplementation *) { }
-
- QNullRenderPassDescriptor *rp = nullptr;
- QSize pixelSize;
- float dpr = 1;
-};
-
-struct QNullReferenceRenderTarget : public QRhiRenderTarget
-{
- QNullReferenceRenderTarget(QRhiImplementation *rhi);
- ~QNullReferenceRenderTarget();
- void release() override;
-
- QSize pixelSize() const override;
- float devicePixelRatio() const override;
- int sampleCount() const override;
-
- QNullRenderTargetData d;
-};
-
-struct QNullTextureRenderTarget : public QRhiTextureRenderTarget
-{
- QNullTextureRenderTarget(QRhiImplementation *rhi, const QRhiTextureRenderTargetDescription &desc, Flags flags);
- ~QNullTextureRenderTarget();
- void release() override;
-
- QSize pixelSize() const override;
- float devicePixelRatio() const override;
- int sampleCount() const override;
-
- QRhiRenderPassDescriptor *newCompatibleRenderPassDescriptor() override;
- bool build() override;
-
- QNullRenderTargetData d;
-};
-
-struct QNullShaderResourceBindings : public QRhiShaderResourceBindings
-{
- QNullShaderResourceBindings(QRhiImplementation *rhi);
- ~QNullShaderResourceBindings();
- void release() override;
- bool build() override;
-};
-
-struct QNullGraphicsPipeline : public QRhiGraphicsPipeline
-{
- QNullGraphicsPipeline(QRhiImplementation *rhi);
- ~QNullGraphicsPipeline();
- void release() override;
- bool build() override;
-};
-
-struct QNullComputePipeline : public QRhiComputePipeline
-{
- QNullComputePipeline(QRhiImplementation *rhi);
- ~QNullComputePipeline();
- void release() override;
- bool build() override;
-};
-
-struct QNullCommandBuffer : public QRhiCommandBuffer
-{
- QNullCommandBuffer(QRhiImplementation *rhi);
- ~QNullCommandBuffer();
- void release() override;
-};
-
-struct QNullSwapChain : public QRhiSwapChain
-{
- QNullSwapChain(QRhiImplementation *rhi);
- ~QNullSwapChain();
- void release() override;
-
- QRhiCommandBuffer *currentFrameCommandBuffer() override;
- QRhiRenderTarget *currentFrameRenderTarget() override;
-
- QSize surfacePixelSize() override;
-
- QRhiRenderPassDescriptor *newCompatibleRenderPassDescriptor() override;
- bool buildOrResize() override;
-
- QNullReferenceRenderTarget rt;
- QNullCommandBuffer cb;
- int frameCount = 0;
-};
-
-class QRhiNull : public QRhiImplementation
-{
-public:
- QRhiNull(QRhiNullInitParams *params);
-
- bool create(QRhi::Flags flags) override;
- void destroy() override;
-
- QRhiGraphicsPipeline *createGraphicsPipeline() override;
- QRhiComputePipeline *createComputePipeline() override;
- QRhiShaderResourceBindings *createShaderResourceBindings() override;
- QRhiBuffer *createBuffer(QRhiBuffer::Type type,
- QRhiBuffer::UsageFlags usage,
- int size) override;
- QRhiRenderBuffer *createRenderBuffer(QRhiRenderBuffer::Type type,
- const QSize &pixelSize,
- int sampleCount,
- QRhiRenderBuffer::Flags flags) override;
- QRhiTexture *createTexture(QRhiTexture::Format format,
- const QSize &pixelSize,
- int sampleCount,
- QRhiTexture::Flags flags) override;
- QRhiSampler *createSampler(QRhiSampler::Filter magFilter, QRhiSampler::Filter minFilter,
- QRhiSampler::Filter mipmapMode,
- QRhiSampler:: AddressMode u, QRhiSampler::AddressMode v) override;
-
- QRhiTextureRenderTarget *createTextureRenderTarget(const QRhiTextureRenderTargetDescription &desc,
- QRhiTextureRenderTarget::Flags flags) override;
-
- QRhiSwapChain *createSwapChain() override;
- QRhi::FrameOpResult beginFrame(QRhiSwapChain *swapChain, QRhi::BeginFrameFlags flags) override;
- QRhi::FrameOpResult endFrame(QRhiSwapChain *swapChain, QRhi::EndFrameFlags flags) override;
- QRhi::FrameOpResult beginOffscreenFrame(QRhiCommandBuffer **cb, QRhi::BeginFrameFlags flags) override;
- QRhi::FrameOpResult endOffscreenFrame(QRhi::EndFrameFlags flags) override;
- QRhi::FrameOpResult finish() override;
-
- void resourceUpdate(QRhiCommandBuffer *cb, QRhiResourceUpdateBatch *resourceUpdates) override;
-
- void beginPass(QRhiCommandBuffer *cb,
- QRhiRenderTarget *rt,
- const QColor &colorClearValue,
- const QRhiDepthStencilClearValue &depthStencilClearValue,
- QRhiResourceUpdateBatch *resourceUpdates) override;
- void endPass(QRhiCommandBuffer *cb, QRhiResourceUpdateBatch *resourceUpdates) override;
-
- void setGraphicsPipeline(QRhiCommandBuffer *cb,
- QRhiGraphicsPipeline *ps) override;
-
- void setShaderResources(QRhiCommandBuffer *cb,
- QRhiShaderResourceBindings *srb,
- int dynamicOffsetCount,
- const QRhiCommandBuffer::DynamicOffset *dynamicOffsets) override;
-
- void setVertexInput(QRhiCommandBuffer *cb,
- int startBinding, int bindingCount, const QRhiCommandBuffer::VertexInput *bindings,
- QRhiBuffer *indexBuf, quint32 indexOffset,
- QRhiCommandBuffer::IndexFormat indexFormat) override;
-
- void setViewport(QRhiCommandBuffer *cb, const QRhiViewport &viewport) override;
- void setScissor(QRhiCommandBuffer *cb, const QRhiScissor &scissor) override;
- void setBlendConstants(QRhiCommandBuffer *cb, const QColor &c) override;
- void setStencilRef(QRhiCommandBuffer *cb, quint32 refValue) override;
-
- void draw(QRhiCommandBuffer *cb, quint32 vertexCount,
- quint32 instanceCount, quint32 firstVertex, quint32 firstInstance) override;
-
- void drawIndexed(QRhiCommandBuffer *cb, quint32 indexCount,
- quint32 instanceCount, quint32 firstIndex,
- qint32 vertexOffset, quint32 firstInstance) override;
-
- void debugMarkBegin(QRhiCommandBuffer *cb, const QByteArray &name) override;
- void debugMarkEnd(QRhiCommandBuffer *cb) override;
- void debugMarkMsg(QRhiCommandBuffer *cb, const QByteArray &msg) override;
-
- void beginComputePass(QRhiCommandBuffer *cb, QRhiResourceUpdateBatch *resourceUpdates) override;
- void endComputePass(QRhiCommandBuffer *cb, QRhiResourceUpdateBatch *resourceUpdates) override;
- void setComputePipeline(QRhiCommandBuffer *cb, QRhiComputePipeline *ps) override;
- void dispatch(QRhiCommandBuffer *cb, int x, int y, int z) override;
-
- const QRhiNativeHandles *nativeHandles(QRhiCommandBuffer *cb) override;
- void beginExternal(QRhiCommandBuffer *cb) override;
- void endExternal(QRhiCommandBuffer *cb) override;
-
- QVector<int> supportedSampleCounts() const override;
- int ubufAlignment() const override;
- bool isYUpInFramebuffer() const override;
- bool isYUpInNDC() const override;
- bool isClipDepthZeroToOne() const override;
- QMatrix4x4 clipSpaceCorrMatrix() const override;
- bool isTextureFormatSupported(QRhiTexture::Format format, QRhiTexture::Flags flags) const override;
- bool isFeatureSupported(QRhi::Feature feature) const override;
- int resourceLimit(QRhi::ResourceLimit limit) const override;
- const QRhiNativeHandles *nativeHandles() override;
- void sendVMemStatsToProfiler() override;
- bool makeThreadLocalNativeContextCurrent() override;
- void releaseCachedResources() override;
- bool isDeviceLost() const override;
-
- void simulateTextureUpload(const QRhiResourceUpdateBatchPrivate::TextureOp &u);
- void simulateTextureCopy(const QRhiResourceUpdateBatchPrivate::TextureOp &u);
- void simulateTextureGenMips(const QRhiResourceUpdateBatchPrivate::TextureOp &u);
-
- QRhiNullNativeHandles nativeHandlesStruct;
- QRhiSwapChain *currentSwapChain = nullptr;
- QNullCommandBuffer offscreenCommandBuffer;
-};
-
-QT_END_NAMESPACE
-
-#endif
diff --git a/src/gui/rhi/qrhiprofiler.cpp b/src/gui/rhi/qrhiprofiler.cpp
deleted file mode 100644
index 1521c0f36e..0000000000
--- a/src/gui/rhi/qrhiprofiler.cpp
+++ /dev/null
@@ -1,606 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2019 The Qt Company Ltd.
-** Contact: http://www.qt.io/licensing/
-**
-** This file is part of the Qt Gui module
-**
-** $QT_BEGIN_LICENSE:LGPL3$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "qrhiprofiler_p_p.h"
-#include "qrhi_p_p.h"
-
-QT_BEGIN_NAMESPACE
-
-/*!
- \class QRhiProfiler
- \internal
- \inmodule QtGui
-
- \brief Collects resource and timing information from an active QRhi.
-
- A QRhiProfiler is present for each QRhi. Query it via QRhi::profiler(). The
- profiler is active only when the QRhi was created with
- QRhi::EnableProfiling. No data is collected otherwise.
-
- \note GPU timings are only available when QRhi indicates that
- QRhi::Timestamps is supported.
-
- Besides collecting data from the QRhi implementations, some additional
- values are calculated. For example, for textures and similar resources the
- profiler gives an estimate of the complete amount of memory the resource
- needs.
-
- \section2 Output Format
-
- The output is comma-separated text. Each line has a number of
- comma-separated entries and each line ends with a comma.
-
- For example:
-
- \badcode
- 1,0,140446057946208,Triangle vbuf,type,0,usage,1,logical_size,84,effective_size,84,backing_gpu_buf_count,1,backing_cpu_buf_count,0,
- 1,0,140446057947376,Triangle ubuf,type,2,usage,4,logical_size,68,effective_size,256,backing_gpu_buf_count,2,backing_cpu_buf_count,0,
- 1,1,140446057950416,,type,0,usage,1,logical_size,112,effective_size,112,backing_gpu_buf_count,1,backing_cpu_buf_count,0,
- 1,1,140446057950544,,type,0,usage,2,logical_size,12,effective_size,12,backing_gpu_buf_count,1,backing_cpu_buf_count,0,
- 1,1,140446057947440,,type,2,usage,4,logical_size,68,effective_size,256,backing_gpu_buf_count,2,backing_cpu_buf_count,0,
- 1,1,140446057984784,Cube vbuf (textured),type,0,usage,1,logical_size,720,effective_size,720,backing_gpu_buf_count,1,backing_cpu_buf_count,0,
- 1,1,140446057982528,Cube ubuf (textured),type,2,usage,4,logical_size,68,effective_size,256,backing_gpu_buf_count,2,backing_cpu_buf_count,0,
- 7,8,140446058913648,Qt texture,width,256,height,256,format,1,owns_native_resource,1,mip_count,9,layer_count,1,effective_sample_count,1,approx_byte_size,349524,
- 1,8,140446058795856,Cube vbuf (textured with offscreen),type,0,usage,1,logical_size,720,effective_size,720,backing_gpu_buf_count,1,backing_cpu_buf_count,0,
- 1,8,140446058947920,Cube ubuf (textured with offscreen),type,2,usage,4,logical_size,68,effective_size,256,backing_gpu_buf_count,2,backing_cpu_buf_count,0,
- 7,8,140446058794928,Texture for offscreen content,width,512,height,512,format,1,owns_native_resource,1,mip_count,1,layer_count,1,effective_sample_count,1,approx_byte_size,1048576,
- 1,8,140446058963904,Triangle vbuf,type,0,usage,1,logical_size,84,effective_size,84,backing_gpu_buf_count,1,backing_cpu_buf_count,0,
- 1,8,140446058964560,Triangle ubuf,type,2,usage,4,logical_size,68,effective_size,256,backing_gpu_buf_count,2,backing_cpu_buf_count,0,
- 5,9,140446057945392,,type,0,width,1280,height,720,effective_sample_count,1,transient_backing,0,winsys_backing,0,approx_byte_size,3686400,
- 11,9,140446057944592,,width,1280,height,720,buffer_count,2,msaa_buffer_count,0,effective_sample_count,1,approx_total_byte_size,7372800,
- 9,9,140446058913648,Qt texture,slot,0,size,262144,
- 10,9,140446058913648,Qt texture,slot,0,
- 17,2019,140446057944592,,frames_since_resize,121,min_ms_frame_delta,9,max_ms_frame_delta,33,Favg_ms_frame_delta,16.1167,
- 18,2019,140446057944592,,frames_since_resize,121,min_ms_frame_build,0,max_ms_frame_build,1,Favg_ms_frame_build,0.00833333,
- 17,4019,140446057944592,,frames_since_resize,241,min_ms_frame_delta,15,max_ms_frame_delta,17,Favg_ms_frame_delta,16.0583,
- 18,4019,140446057944592,,frames_since_resize,241,min_ms_frame_build,0,max_ms_frame_build,0,Favg_ms_frame_build,0,
- 12,5070,140446057944592,,
- 2,5079,140446057947376,Triangle ubuf,
- 2,5079,140446057946208,Triangle vbuf,
- 2,5079,140446057947440,,
- 2,5079,140446057950544,,
- 2,5079,140446057950416,,
- 8,5079,140446058913648,Qt texture,
- 2,5079,140446057982528,Cube ubuf (textured),
- 2,5079,140446057984784,Cube vbuf (textured),
- 2,5079,140446058964560,Triangle ubuf,
- 2,5079,140446058963904,Triangle vbuf,
- 8,5079,140446058794928,Texture for offscreen content,
- 2,5079,140446058947920,Cube ubuf (textured with offscreen),
- 2,5079,140446058795856,Cube vbuf (textured with offscreen),
- 6,5079,140446057945392,,
- \endcode
-
- Each line starts with \c op, \c timestamp, \c res, \c name where op is a
- value from StreamOp, timestamp is a recording timestamp in milliseconds
- (qint64), res is a number (quint64) referring to the QRhiResource the entry
- refers to, or 0 if not applicable. \c name is the value of
- QRhiResource::name() and may be empty as well. The \c name will never
- contain a comma.
-
- This is followed by any number of \c{key, value} pairs where \c key is an
- unspecified string and \c value is a number. If \c key starts with \c F, it
- indicates the value is a float. Otherwise assume that the value is a
- qint64.
- */
-
-/*!
- \enum QRhiProfiler::StreamOp
- Describes an entry in the profiler's output stream.
-
- \value NewBuffer A buffer is created
- \value ReleaseBuffer A buffer is destroyed
- \value NewBufferStagingArea A staging buffer for buffer upload is created
- \value ReleaseBufferStagingArea A staging buffer for buffer upload is destroyed
- \value NewRenderBuffer A renderbuffer is created
- \value ReleaseRenderBuffer A renderbuffer is destroyed
- \value NewTexture A texture is created
- \value ReleaseTexture A texture is destroyed
- \value NewTextureStagingArea A staging buffer for texture upload is created
- \value ReleaseTextureStagingArea A staging buffer for texture upload is destroyed
- \value ResizeSwapChain A swapchain is created or resized
- \value ReleaseSwapChain A swapchain is destroyed
- \value NewReadbackBuffer A staging buffer for readback is created
- \value ReleaseReadbackBuffer A staging buffer for readback is destroyed
- \value GpuMemAllocStats GPU memory allocator statistics
- \value GpuFrameTime GPU frame times
- \value FrameToFrameTime CPU frame-to-frame times
- \value FrameBuildTime CPU beginFrame-endFrame times
- */
-
-/*!
- \class QRhiProfiler::CpuTime
- \internal
- \inmodule QtGui
- \brief Contains CPU-side frame timings.
-
- Once sufficient number of frames have been rendered, the minimum, maximum,
- and average values (in milliseconds) from various measurements are made
- available in this struct queriable from QRhiProfiler::frameToFrameTimes()
- and QRhiProfiler::frameBuildTimes().
-
- \sa QRhiProfiler::setFrameTimingWriteInterval()
- */
-
-/*!
- \class QRhiProfiler::GpuTime
- \internal
- \inmodule QtGui
- \brief Contains GPU-side frame timings.
-
- Once sufficient number of frames have been rendered, the minimum, maximum,
- and average values (in milliseconds) calculated from GPU command buffer
- timestamps are made available in this struct queriable from
- QRhiProfiler::gpuFrameTimes().
-
- \sa QRhiProfiler::setFrameTimingWriteInterval()
- */
-
-/*!
- \internal
- */
-QRhiProfiler::QRhiProfiler()
- : d(new QRhiProfilerPrivate)
-{
- d->ts.start();
-}
-
-/*!
- Destructor.
- */
-QRhiProfiler::~QRhiProfiler()
-{
- // Flush because there is a high chance we have writes that were made since
- // the event loop last ran. (esp. relevant for network devices like QTcpSocket)
- if (d->outputDevice)
- d->outputDevice->waitForBytesWritten(1000);
-
- delete d;
-}
-
-/*!
- Sets the output \a device.
-
- \note No output will be generated when QRhi::EnableProfiling was not set.
- */
-void QRhiProfiler::setDevice(QIODevice *device)
-{
- d->outputDevice = device;
-}
-
-/*!
- Requests writing a GpuMemAllocStats entry into the output, when applicable.
- Backends that do not support this will ignore the request. This is an
- explicit request since getting the allocator status and statistics may be
- an expensive operation.
- */
-void QRhiProfiler::addVMemAllocatorStats()
-{
- if (d->rhiDWhenEnabled)
- d->rhiDWhenEnabled->sendVMemStatsToProfiler();
-}
-
-/*!
- \return the currently set frame timing writeout interval.
- */
-int QRhiProfiler::frameTimingWriteInterval() const
-{
- return d->frameTimingWriteInterval;
-}
-
-/*!
- Sets the number of frames that need to be rendered before the collected CPU
- and GPU timings are processed (min, max, average are calculated) to \a
- frameCount.
-
- The default value is 120.
- */
-void QRhiProfiler::setFrameTimingWriteInterval(int frameCount)
-{
- if (frameCount > 0)
- d->frameTimingWriteInterval = frameCount;
-}
-
-/*!
- \return min, max, and avg in milliseconds for the time that elapsed between two
- QRhi::endFrame() calls.
-
- \note The values are all 0 until at least frameTimingWriteInterval() frames
- have been rendered.
- */
-QRhiProfiler::CpuTime QRhiProfiler::frameToFrameTimes(QRhiSwapChain *sc) const
-{
- auto it = d->swapchains.constFind(sc);
- if (it != d->swapchains.constEnd())
- return it->frameToFrameTime;
-
- return QRhiProfiler::CpuTime();
-}
-
-/*!
- \return min, max, and avg in milliseconds for the time that elapsed between
- a QRhi::beginFrame() and QRhi::endFrame().
-
- \note The values are all 0 until at least frameTimingWriteInterval() frames
- have been rendered.
- */
-QRhiProfiler::CpuTime QRhiProfiler::frameBuildTimes(QRhiSwapChain *sc) const
-{
- auto it = d->swapchains.constFind(sc);
- if (it != d->swapchains.constEnd())
- return it->beginToEndFrameTime;
-
- return QRhiProfiler::CpuTime();
-}
-
-/*!
- \return min, max, and avg in milliseconds for the GPU time that is spent on
- one frame.
-
- \note The values are all 0 until at least frameTimingWriteInterval() frames
- have been rendered.
-
- The GPU times should only be compared between runs on the same GPU of the
- same system with the same backend. Comparing times for different graphics
- cards or for different backends can give misleading results. The numbers are
- not meant to be comparable that way.
-
- \note Some backends have no support for this, and even for those that have,
- it is not guaranteed that the driver will support it at run time. Support
- can be checked via QRhi::Timestamps.
- */
-QRhiProfiler::GpuTime QRhiProfiler::gpuFrameTimes(QRhiSwapChain *sc) const
-{
- auto it = d->swapchains.constFind(sc);
- if (it != d->swapchains.constEnd())
- return it->gpuFrameTime;
-
- return QRhiProfiler::GpuTime();
-}
-
-void QRhiProfilerPrivate::startEntry(QRhiProfiler::StreamOp op, qint64 timestamp, QRhiResource *res)
-{
- buf.clear();
- buf.append(QByteArray::number(op));
- buf.append(',');
- buf.append(QByteArray::number(timestamp));
- buf.append(',');
- buf.append(QByteArray::number(quint64(quintptr(res))));
- buf.append(',');
- if (res)
- buf.append(res->name());
- buf.append(',');
-}
-
-void QRhiProfilerPrivate::writeInt(const char *key, qint64 v)
-{
- Q_ASSERT(key[0] != 'F');
- buf.append(key);
- buf.append(',');
- buf.append(QByteArray::number(v));
- buf.append(',');
-}
-
-void QRhiProfilerPrivate::writeFloat(const char *key, float f)
-{
- Q_ASSERT(key[0] == 'F');
- buf.append(key);
- buf.append(',');
- buf.append(QByteArray::number(double(f)));
- buf.append(',');
-}
-
-void QRhiProfilerPrivate::endEntry()
-{
- buf.append('\n');
- outputDevice->write(buf);
-}
-
-void QRhiProfilerPrivate::newBuffer(QRhiBuffer *buf, quint32 realSize, int backingGpuBufCount, int backingCpuBufCount)
-{
- if (!outputDevice)
- return;
-
- startEntry(QRhiProfiler::NewBuffer, ts.elapsed(), buf);
- writeInt("type", buf->type());
- writeInt("usage", buf->usage());
- writeInt("logical_size", buf->size());
- writeInt("effective_size", realSize);
- writeInt("backing_gpu_buf_count", backingGpuBufCount);
- writeInt("backing_cpu_buf_count", backingCpuBufCount);
- endEntry();
-}
-
-void QRhiProfilerPrivate::releaseBuffer(QRhiBuffer *buf)
-{
- if (!outputDevice)
- return;
-
- startEntry(QRhiProfiler::ReleaseBuffer, ts.elapsed(), buf);
- endEntry();
-}
-
-void QRhiProfilerPrivate::newBufferStagingArea(QRhiBuffer *buf, int slot, quint32 size)
-{
- if (!outputDevice)
- return;
-
- startEntry(QRhiProfiler::NewBufferStagingArea, ts.elapsed(), buf);
- writeInt("slot", slot);
- writeInt("size", size);
- endEntry();
-}
-
-void QRhiProfilerPrivate::releaseBufferStagingArea(QRhiBuffer *buf, int slot)
-{
- if (!outputDevice)
- return;
-
- startEntry(QRhiProfiler::ReleaseBufferStagingArea, ts.elapsed(), buf);
- writeInt("slot", slot);
- endEntry();
-}
-
-void QRhiProfilerPrivate::newRenderBuffer(QRhiRenderBuffer *rb, bool transientBacking, bool winSysBacking, int sampleCount)
-{
- if (!outputDevice)
- return;
-
- const QRhiRenderBuffer::Type type = rb->type();
- const QSize sz = rb->pixelSize();
- // just make up something, ds is likely D24S8 while color is RGBA8 or similar
- const QRhiTexture::Format assumedFormat = type == QRhiRenderBuffer::DepthStencil ? QRhiTexture::D32F : QRhiTexture::RGBA8;
- quint32 byteSize = rhiDWhenEnabled->approxByteSizeForTexture(assumedFormat, sz, 1, 1);
- if (sampleCount > 1)
- byteSize *= uint(sampleCount);
-
- startEntry(QRhiProfiler::NewRenderBuffer, ts.elapsed(), rb);
- writeInt("type", type);
- writeInt("width", sz.width());
- writeInt("height", sz.height());
- writeInt("effective_sample_count", sampleCount);
- writeInt("transient_backing", transientBacking);
- writeInt("winsys_backing", winSysBacking);
- writeInt("approx_byte_size", byteSize);
- endEntry();
-}
-
-void QRhiProfilerPrivate::releaseRenderBuffer(QRhiRenderBuffer *rb)
-{
- if (!outputDevice)
- return;
-
- startEntry(QRhiProfiler::ReleaseRenderBuffer, ts.elapsed(), rb);
- endEntry();
-}
-
-void QRhiProfilerPrivate::newTexture(QRhiTexture *tex, bool owns, int mipCount, int layerCount, int sampleCount)
-{
- if (!outputDevice)
- return;
-
- const QRhiTexture::Format format = tex->format();
- const QSize sz = tex->pixelSize();
- quint32 byteSize = rhiDWhenEnabled->approxByteSizeForTexture(format, sz, mipCount, layerCount);
- if (sampleCount > 1)
- byteSize *= uint(sampleCount);
-
- startEntry(QRhiProfiler::NewTexture, ts.elapsed(), tex);
- writeInt("width", sz.width());
- writeInt("height", sz.height());
- writeInt("format", format);
- writeInt("owns_native_resource", owns);
- writeInt("mip_count", mipCount);
- writeInt("layer_count", layerCount);
- writeInt("effective_sample_count", sampleCount);
- writeInt("approx_byte_size", byteSize);
- endEntry();
-}
-
-void QRhiProfilerPrivate::releaseTexture(QRhiTexture *tex)
-{
- if (!outputDevice)
- return;
-
- startEntry(QRhiProfiler::ReleaseTexture, ts.elapsed(), tex);
- endEntry();
-}
-
-void QRhiProfilerPrivate::newTextureStagingArea(QRhiTexture *tex, int slot, quint32 size)
-{
- if (!outputDevice)
- return;
-
- startEntry(QRhiProfiler::NewTextureStagingArea, ts.elapsed(), tex);
- writeInt("slot", slot);
- writeInt("size", size);
- endEntry();
-}
-
-void QRhiProfilerPrivate::releaseTextureStagingArea(QRhiTexture *tex, int slot)
-{
- if (!outputDevice)
- return;
-
- startEntry(QRhiProfiler::ReleaseTextureStagingArea, ts.elapsed(), tex);
- writeInt("slot", slot);
- endEntry();
-}
-
-void QRhiProfilerPrivate::resizeSwapChain(QRhiSwapChain *sc, int bufferCount, int msaaBufferCount, int sampleCount)
-{
- if (!outputDevice)
- return;
-
- const QSize sz = sc->currentPixelSize();
- quint32 byteSize = rhiDWhenEnabled->approxByteSizeForTexture(QRhiTexture::BGRA8, sz, 1, 1);
- byteSize = byteSize * uint(bufferCount) + byteSize * uint(msaaBufferCount) * uint(sampleCount);
-
- startEntry(QRhiProfiler::ResizeSwapChain, ts.elapsed(), sc);
- writeInt("width", sz.width());
- writeInt("height", sz.height());
- writeInt("buffer_count", bufferCount);
- writeInt("msaa_buffer_count", msaaBufferCount);
- writeInt("effective_sample_count", sampleCount);
- writeInt("approx_total_byte_size", byteSize);
- endEntry();
-}
-
-void QRhiProfilerPrivate::releaseSwapChain(QRhiSwapChain *sc)
-{
- if (!outputDevice)
- return;
-
- startEntry(QRhiProfiler::ReleaseSwapChain, ts.elapsed(), sc);
- endEntry();
-}
-
-template<typename T>
-void calcTiming(QVector<T> *vec, T *minDelta, T *maxDelta, float *avgDelta)
-{
- if (vec->isEmpty())
- return;
-
- *minDelta = *maxDelta = 0;
- float totalDelta = 0;
- for (T delta : qAsConst(*vec)) {
- totalDelta += float(delta);
- if (*minDelta == 0 || delta < *minDelta)
- *minDelta = delta;
- if (*maxDelta == 0 || delta > *maxDelta)
- *maxDelta = delta;
- }
- *avgDelta = totalDelta / vec->count();
-
- vec->clear();
-}
-
-void QRhiProfilerPrivate::beginSwapChainFrame(QRhiSwapChain *sc)
-{
- Sc &scd(swapchains[sc]);
- scd.beginToEndTimer.start();
-}
-
-void QRhiProfilerPrivate::endSwapChainFrame(QRhiSwapChain *sc, int frameCount)
-{
- Sc &scd(swapchains[sc]);
- if (!scd.frameToFrameRunning) {
- scd.frameToFrameTimer.start();
- scd.frameToFrameRunning = true;
- return;
- }
-
- scd.frameToFrameSamples.append(scd.frameToFrameTimer.restart());
- if (scd.frameToFrameSamples.count() >= frameTimingWriteInterval) {
- calcTiming(&scd.frameToFrameSamples,
- &scd.frameToFrameTime.minTime, &scd.frameToFrameTime.maxTime, &scd.frameToFrameTime.avgTime);
- if (outputDevice) {
- startEntry(QRhiProfiler::FrameToFrameTime, ts.elapsed(), sc);
- writeInt("frames_since_resize", frameCount);
- writeInt("min_ms_frame_delta", scd.frameToFrameTime.minTime);
- writeInt("max_ms_frame_delta", scd.frameToFrameTime.maxTime);
- writeFloat("Favg_ms_frame_delta", scd.frameToFrameTime.avgTime);
- endEntry();
- }
- }
-
- scd.beginToEndSamples.append(scd.beginToEndTimer.elapsed());
- if (scd.beginToEndSamples.count() >= frameTimingWriteInterval) {
- calcTiming(&scd.beginToEndSamples,
- &scd.beginToEndFrameTime.minTime, &scd.beginToEndFrameTime.maxTime, &scd.beginToEndFrameTime.avgTime);
- if (outputDevice) {
- startEntry(QRhiProfiler::FrameBuildTime, ts.elapsed(), sc);
- writeInt("frames_since_resize", frameCount);
- writeInt("min_ms_frame_build", scd.beginToEndFrameTime.minTime);
- writeInt("max_ms_frame_build", scd.beginToEndFrameTime.maxTime);
- writeFloat("Favg_ms_frame_build", scd.beginToEndFrameTime.avgTime);
- endEntry();
- }
- }
-}
-
-void QRhiProfilerPrivate::swapChainFrameGpuTime(QRhiSwapChain *sc, float gpuTime)
-{
- Sc &scd(swapchains[sc]);
- scd.gpuFrameSamples.append(gpuTime);
- if (scd.gpuFrameSamples.count() >= frameTimingWriteInterval) {
- calcTiming(&scd.gpuFrameSamples,
- &scd.gpuFrameTime.minTime, &scd.gpuFrameTime.maxTime, &scd.gpuFrameTime.avgTime);
- if (outputDevice) {
- startEntry(QRhiProfiler::GpuFrameTime, ts.elapsed(), sc);
- writeFloat("Fmin_ms_gpu_frame_time", scd.gpuFrameTime.minTime);
- writeFloat("Fmax_ms_gpu_frame_time", scd.gpuFrameTime.maxTime);
- writeFloat("Favg_ms_gpu_frame_time", scd.gpuFrameTime.avgTime);
- endEntry();
- }
- }
-}
-
-void QRhiProfilerPrivate::newReadbackBuffer(qint64 id, QRhiResource *src, quint32 size)
-{
- if (!outputDevice)
- return;
-
- startEntry(QRhiProfiler::NewReadbackBuffer, ts.elapsed(), src);
- writeInt("id", id);
- writeInt("size", size);
- endEntry();
-}
-
-void QRhiProfilerPrivate::releaseReadbackBuffer(qint64 id)
-{
- if (!outputDevice)
- return;
-
- startEntry(QRhiProfiler::ReleaseReadbackBuffer, ts.elapsed(), nullptr);
- writeInt("id", id);
- endEntry();
-}
-
-void QRhiProfilerPrivate::vmemStat(uint realAllocCount, uint subAllocCount, quint32 totalSize, quint32 unusedSize)
-{
- if (!outputDevice)
- return;
-
- startEntry(QRhiProfiler::GpuMemAllocStats, ts.elapsed(), nullptr);
- writeInt("real_alloc_count", realAllocCount);
- writeInt("sub_alloc_count", subAllocCount);
- writeInt("total_size", totalSize);
- writeInt("unused_size", unusedSize);
- endEntry();
-}
-
-QT_END_NAMESPACE
diff --git a/src/gui/rhi/qrhiprofiler_p.h b/src/gui/rhi/qrhiprofiler_p.h
deleted file mode 100644
index 89fd0a8798..0000000000
--- a/src/gui/rhi/qrhiprofiler_p.h
+++ /dev/null
@@ -1,120 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2019 The Qt Company Ltd.
-** Contact: http://www.qt.io/licensing/
-**
-** This file is part of the Qt Gui module
-**
-** $QT_BEGIN_LICENSE:LGPL3$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef QRHIPROFILER_H
-#define QRHIPROFILER_H
-
-//
-// W A R N I N G
-// -------------
-//
-// This file is not part of the Qt API. It exists purely as an
-// implementation detail. This header file may change from version to
-// version without notice, or even be removed.
-//
-// We mean it.
-//
-
-#include <private/qrhi_p.h>
-
-QT_BEGIN_NAMESPACE
-
-class QRhiProfilerPrivate;
-class QIODevice;
-
-class Q_GUI_EXPORT QRhiProfiler
-{
-public:
- enum StreamOp {
- NewBuffer = 1,
- ReleaseBuffer,
- NewBufferStagingArea,
- ReleaseBufferStagingArea,
- NewRenderBuffer,
- ReleaseRenderBuffer,
- NewTexture,
- ReleaseTexture,
- NewTextureStagingArea,
- ReleaseTextureStagingArea,
- ResizeSwapChain,
- ReleaseSwapChain,
- NewReadbackBuffer,
- ReleaseReadbackBuffer,
- GpuMemAllocStats,
- GpuFrameTime,
- FrameToFrameTime,
- FrameBuildTime
- };
-
- ~QRhiProfiler();
-
- void setDevice(QIODevice *device);
-
- void addVMemAllocatorStats();
-
- int frameTimingWriteInterval() const;
- void setFrameTimingWriteInterval(int frameCount);
-
- struct CpuTime {
- qint64 minTime = 0;
- qint64 maxTime = 0;
- float avgTime = 0;
- };
-
- struct GpuTime {
- float minTime = 0;
- float maxTime = 0;
- float avgTime = 0;
- };
-
- CpuTime frameToFrameTimes(QRhiSwapChain *sc) const;
- CpuTime frameBuildTimes(QRhiSwapChain *sc) const; // beginFrame - endFrame
- GpuTime gpuFrameTimes(QRhiSwapChain *sc) const;
-
-private:
- Q_DISABLE_COPY(QRhiProfiler)
- QRhiProfiler();
- QRhiProfilerPrivate *d;
- friend class QRhiImplementation;
- friend class QRhiProfilerPrivate;
-};
-
-Q_DECLARE_TYPEINFO(QRhiProfiler::CpuTime, Q_MOVABLE_TYPE);
-Q_DECLARE_TYPEINFO(QRhiProfiler::GpuTime, Q_MOVABLE_TYPE);
-
-QT_END_NAMESPACE
-
-#endif
diff --git a/src/gui/rhi/qrhiprofiler_p_p.h b/src/gui/rhi/qrhiprofiler_p_p.h
deleted file mode 100644
index 7d0f183fb1..0000000000
--- a/src/gui/rhi/qrhiprofiler_p_p.h
+++ /dev/null
@@ -1,121 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2019 The Qt Company Ltd.
-** Contact: http://www.qt.io/licensing/
-**
-** This file is part of the Qt Gui module
-**
-** $QT_BEGIN_LICENSE:LGPL3$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef QRHIPROFILER_P_H
-#define QRHIPROFILER_P_H
-
-//
-// W A R N I N G
-// -------------
-//
-// This file is not part of the Qt API. It exists purely as an
-// implementation detail. This header file may change from version to
-// version without notice, or even be removed.
-//
-// We mean it.
-//
-
-#include "qrhiprofiler_p.h"
-#include <QElapsedTimer>
-#include <QHash>
-
-QT_BEGIN_NAMESPACE
-
-class QRhiProfilerPrivate
-{
-public:
- static QRhiProfilerPrivate *get(QRhiProfiler *p) { return p->d; }
-
- void newBuffer(QRhiBuffer *buf, quint32 realSize, int backingGpuBufCount, int backingCpuBufCount);
- void releaseBuffer(QRhiBuffer *buf);
- void newBufferStagingArea(QRhiBuffer *buf, int slot, quint32 size);
- void releaseBufferStagingArea(QRhiBuffer *buf, int slot);
-
- void newRenderBuffer(QRhiRenderBuffer *rb, bool transientBacking, bool winSysBacking, int sampleCount);
- void releaseRenderBuffer(QRhiRenderBuffer *rb);
-
- void newTexture(QRhiTexture *tex, bool owns, int mipCount, int layerCount, int sampleCount);
- void releaseTexture(QRhiTexture *tex);
- void newTextureStagingArea(QRhiTexture *tex, int slot, quint32 size);
- void releaseTextureStagingArea(QRhiTexture *tex, int slot);
-
- void resizeSwapChain(QRhiSwapChain *sc, int bufferCount, int msaaBufferCount, int sampleCount);
- void releaseSwapChain(QRhiSwapChain *sc);
-
- void beginSwapChainFrame(QRhiSwapChain *sc);
- void endSwapChainFrame(QRhiSwapChain *sc, int frameCount);
- void swapChainFrameGpuTime(QRhiSwapChain *sc, float gpuTimeMs);
-
- void newReadbackBuffer(qint64 id, QRhiResource *src, quint32 size);
- void releaseReadbackBuffer(qint64 id);
-
- void vmemStat(uint realAllocCount, uint subAllocCount, quint32 totalSize, quint32 unusedSize);
-
- void startEntry(QRhiProfiler::StreamOp op, qint64 timestamp, QRhiResource *res);
- void writeInt(const char *key, qint64 v);
- void writeFloat(const char *key, float f);
- void endEntry();
-
- QRhiImplementation *rhiDWhenEnabled = nullptr;
- QIODevice *outputDevice = nullptr;
- QElapsedTimer ts;
- QByteArray buf;
- static const int DEFAULT_FRAME_TIMING_WRITE_INTERVAL = 120; // frames
- int frameTimingWriteInterval = DEFAULT_FRAME_TIMING_WRITE_INTERVAL;
- struct Sc {
- Sc() {
- frameToFrameSamples.reserve(DEFAULT_FRAME_TIMING_WRITE_INTERVAL);
- beginToEndSamples.reserve(DEFAULT_FRAME_TIMING_WRITE_INTERVAL);
- gpuFrameSamples.reserve(DEFAULT_FRAME_TIMING_WRITE_INTERVAL);
- }
- QElapsedTimer frameToFrameTimer;
- bool frameToFrameRunning = false;
- QElapsedTimer beginToEndTimer;
- QVector<qint64> frameToFrameSamples;
- QVector<qint64> beginToEndSamples;
- QVector<float> gpuFrameSamples;
- QRhiProfiler::CpuTime frameToFrameTime;
- QRhiProfiler::CpuTime beginToEndFrameTime;
- QRhiProfiler::GpuTime gpuFrameTime;
- };
- QHash<QRhiSwapChain *, Sc> swapchains;
-};
-
-Q_DECLARE_TYPEINFO(QRhiProfilerPrivate::Sc, Q_MOVABLE_TYPE);
-
-QT_END_NAMESPACE
-
-#endif
diff --git a/src/gui/rhi/qrhivulkan.cpp b/src/gui/rhi/qrhivulkan.cpp
index 21ae142b1d..3dd3c57bd4 100644
--- a/src/gui/rhi/qrhivulkan.cpp
+++ b/src/gui/rhi/qrhivulkan.cpp
@@ -1,54 +1,29 @@
-/****************************************************************************
-**
-** Copyright (C) 2019 The Qt Company Ltd.
-** Contact: http://www.qt.io/licensing/
-**
-** This file is part of the Qt Gui module
-**
-** $QT_BEGIN_LICENSE:LGPL3$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "qrhivulkan_p_p.h"
-#include "qrhivulkanext_p.h"
+// Copyright (C) 2023 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
+
+#include "qrhivulkan_p.h"
+#include <qpa/qplatformvulkaninstance.h>
#define VMA_IMPLEMENTATION
+#define VMA_DYNAMIC_VULKAN_FUNCTIONS 1
#define VMA_STATIC_VULKAN_FUNCTIONS 0
#define VMA_RECORDING_ENABLED 0
#define VMA_DEDICATED_ALLOCATION 0
#ifdef QT_DEBUG
#define VMA_DEBUG_INITIALIZE_ALLOCATIONS 1
#endif
+QT_WARNING_PUSH
+QT_WARNING_DISABLE_GCC("-Wsuggest-override")
+#if defined(Q_CC_CLANG) && Q_CC_CLANG >= 1100
+QT_WARNING_DISABLE_CLANG("-Wdeprecated-copy")
+#endif
#include "vk_mem_alloc.h"
+QT_WARNING_POP
#include <qmath.h>
#include <QVulkanFunctions>
#include <QtGui/qwindow.h>
+#include <optional>
QT_BEGIN_NAMESPACE
@@ -84,10 +59,13 @@ QT_BEGIN_NAMESPACE
/*!
\class QRhiVulkanInitParams
- \internal
\inmodule QtGui
+ \since 6.6
\brief Vulkan specific initialization parameters.
+ \note This is a RHI API with limited compatibility guarantees, see \l QRhi
+ for details.
+
A Vulkan-based QRhi needs at minimum a valid QVulkanInstance. It is up to
the user to ensure this is available and initialized. This is typically
done in main() similarly to the following:
@@ -98,20 +76,8 @@ QT_BEGIN_NAMESPACE
...
QVulkanInstance inst;
- #ifndef Q_OS_ANDROID
- inst.setLayers(QByteArrayList() << "VK_LAYER_LUNARG_standard_validation");
- #else
- inst.setLayers(QByteArrayList()
- << "VK_LAYER_GOOGLE_threading"
- << "VK_LAYER_LUNARG_parameter_validation"
- << "VK_LAYER_LUNARG_object_tracker"
- << "VK_LAYER_LUNARG_core_validation"
- << "VK_LAYER_LUNARG_image"
- << "VK_LAYER_LUNARG_swapchain"
- << "VK_LAYER_GOOGLE_unique_objects");
- #endif
- inst.setExtensions(QByteArrayList()
- << "VK_KHR_get_physical_device_properties2");
+ inst.setLayers({ "VK_LAYER_KHRONOS_validation" }); // for debugging only, not for release builds
+ inst.setExtensions(QRhiVulkanInitParams::preferredInstanceExtensions());
if (!inst.create())
qFatal("Vulkan not available");
@@ -119,16 +85,18 @@ QT_BEGIN_NAMESPACE
}
\endcode
- The example here has two optional aspects: it enables the
+ This example enables the
\l{https://github.com/KhronosGroup/Vulkan-ValidationLayers}{Vulkan
validation layers}, when they are available, and also enables the
- VK_KHR_get_physical_device_properties2 extension (part of Vulkan 1.1), when
- available. The former is useful during the development phase (remember that
- QVulkanInstance conveniently redirects messages and warnings to qDebug).
- Avoid enabling it in production builds, however. The latter is important in
- order to make QRhi::CustomInstanceStepRate available with Vulkan since
- VK_EXT_vertex_attribute_divisor (part of Vulkan 1.1) depends on it. It can
- be omitted when instanced drawing with a non-one step rate is not used.
+ instance-level extensions QRhi reports as desirable (such as,
+ VK_KHR_get_physical_device_properties2), as long as they are supported by
+ the Vulkan implementation at run time.
+
+ The former is optional, and is useful during the development phase
+ QVulkanInstance conveniently redirects messages and warnings to qDebug.
+ Avoid enabling it in production builds, however. The latter is strongly
+ recommended, and is important in order to make certain features functional
+ (for example, QRhi::CustomInstanceStepRate).
Once this is done, a Vulkan-based QRhi can be created by passing the
instance and a QWindow with its surface type set to
@@ -149,68 +117,172 @@ QT_BEGIN_NAMESPACE
for other windows as well, as long as they all have their
QWindow::surfaceType() set to QSurface::VulkanSurface.
+ To request additional extensions to be enabled on the Vulkan device, list them
+ in deviceExtensions. This can be relevant when integrating with native Vulkan
+ rendering code.
+
+ It is expected that the backend's desired list of instance extensions will
+ be queried by calling the static function preferredInstanceExtensions()
+ before initializing a QVulkanInstance. The returned list can be safely
+ passed to QVulkanInstance::setExtensions() as-is, because unsupported
+ extensions are filtered out automatically. If this is not done, certain
+ features, such as QRhi::CustomInstanceStepRate may be reported as
+ unsupported even when the Vulkan implementation on the system has support
+ for the relevant functionality.
+
+ For full functionality the QVulkanInstance needs to have API 1.1 enabled,
+ when available. This means calling QVulkanInstance::setApiVersion() with
+ 1.1 or higher whenever QVulkanInstance::supportedApiVersion() reports that
+ at least Vulkan 1.1 is supported. If this is not done, certain features,
+ such as QRhi::RenderTo3DTextureSlice may be reported as unsupported even
+ when the Vulkan implementation on the system supports Vulkan 1.1 or newer.
+
\section2 Working with existing Vulkan devices
When interoperating with another graphics engine, it may be necessary to
get a QRhi instance that uses the same Vulkan device. This can be achieved
by passing a pointer to a QRhiVulkanNativeHandles to QRhi::create().
- The physical device and device object must then be set to a non-null value.
- In addition, either the graphics queue family index or the graphics queue
- object itself is required. Prefer the former, whenever possible since
- deducing the index is not possible afterwards. Optionally, an existing
- command pool object can be specified as well, and, also optionally,
- vmemAllocator can be used to share the same
+ The physical device must always be set to a non-null value. If the
+ intention is to just specify a physical device, but leave the rest of the
+ VkDevice and queue creation to QRhi, then no other members need to be
+ filled out in the struct. For example, this is the case when working with
+ OpenXR.
+
+ To adopt an existing \c VkDevice, the device field must be set to a
+ non-null value as well. In addition, the graphics queue family index is
+ required. The queue index is optional, as the default of 0 is often
+ suitable.
+
+ Optionally, an existing command pool object can be specified as well. Also
+ optionally, vmemAllocator can be used to share the same
\l{https://github.com/GPUOpen-LibrariesAndSDKs/VulkanMemoryAllocator}{Vulkan
memory allocator} between two QRhi instances.
The QRhi does not take ownership of any of the external objects.
+
+ Applications are encouraged to query the list of desired device extensions
+ by calling the static function preferredExtensionsForImportedDevice(), and
+ enable them on the VkDevice. Otherwise certain QRhi features may not be
+ available.
*/
/*!
+ \variable QRhiVulkanInitParams::inst
+
+ The QVulkanInstance that has already been successfully
+ \l{QVulkanInstance::create()}{created}, required.
+*/
+
+/*!
+ \variable QRhiVulkanInitParams::window
+
+ Optional, but recommended when targeting a QWindow.
+*/
+
+/*!
+ \variable QRhiVulkanInitParams::deviceExtensions
+
+ Optional, empty by default. The list of Vulkan device extensions to enable.
+ Unsupported extensions are ignored gracefully.
+*/
+
+/*!
\class QRhiVulkanNativeHandles
- \internal
\inmodule QtGui
+ \since 6.6
\brief Collects device, queue, and other Vulkan objects that are used by the QRhi.
\note Ownership of the Vulkan objects is never transferred.
+
+ \note This is a RHI API with limited compatibility guarantees, see \l QRhi
+ for details.
*/
/*!
- \class QRhiVulkanTextureNativeHandles
- \internal
- \inmodule QtGui
- \brief Holds the Vulkan image object that is backing a QRhiTexture.
+ \variable QRhiVulkanNativeHandles::physDev
- Importing and exporting Vulkan image objects that back a QRhiTexture when
- running with the Vulkan backend is supported via this class. Ownership of
- the Vulkan object is never transferred.
+ When different from \nullptr, specifies the Vulkan physical device to use.
+*/
- \note Memory allocation details are not exposed. This is intentional since
- memory is typically suballocated from a bigger chunk of VkDeviceMemory, and
- exposing the allocator details is not desirable for now.
- */
+/*!
+ \variable QRhiVulkanNativeHandles::dev
+
+ When wanting to import not just a physical device, but also use an already
+ existing VkDevice, set this and the graphics queue index and family index.
+*/
+
+/*!
+ \variable QRhiVulkanNativeHandles::gfxQueueFamilyIdx
+
+ Graphics queue family index.
+*/
+
+/*!
+ \variable QRhiVulkanNativeHandles::gfxQueueIdx
+
+ Graphics queue index.
+*/
+
+/*!
+ \variable QRhiVulkanNativeHandles::vmemAllocator
+
+ Relevant only when importing an existing memory allocator object,
+ leave it set to \nullptr otherwise.
+*/
+
+/*!
+ \variable QRhiVulkanNativeHandles::gfxQueue
+
+ Output only, not used by QRhi::create(), only set by the
+ QRhi::nativeHandles() accessor. The graphics VkQueue used by the QRhi.
+*/
+
+/*!
+ \variable QRhiVulkanNativeHandles::inst
+
+ Output only, not used by QRhi::create(), only set by the
+ QRhi::nativeHandles() accessor. The QVulkanInstance used by the QRhi.
+*/
/*!
\class QRhiVulkanCommandBufferNativeHandles
- \internal
\inmodule QtGui
+ \since 6.6
\brief Holds the Vulkan command buffer object that is backing a QRhiCommandBuffer.
\note The Vulkan command buffer object is only guaranteed to be valid, and
in recording state, while recording a frame. That is, between a
\l{QRhi::beginFrame()}{beginFrame()} - \l{QRhi::endFrame()}{endFrame()} or
\l{QRhi::beginOffscreenFrame()}{beginOffscreenFrame()} -
- \l{QRhi::endOffsrceenFrame()}{endOffscreenFrame()} pair.
+ \l{QRhi::endOffscreenFrame()}{endOffscreenFrame()} pair.
+
+ \note This is a RHI API with limited compatibility guarantees, see \l QRhi
+ for details.
*/
/*!
+ \variable QRhiVulkanCommandBufferNativeHandles::commandBuffer
+
+ The VkCommandBuffer object.
+*/
+
+/*!
\class QRhiVulkanRenderPassNativeHandles
- \internal
\inmodule QtGui
+ \since 6.6
\brief Holds the Vulkan render pass object backing a QRhiRenderPassDescriptor.
+
+ \note This is a RHI API with limited compatibility guarantees, see \l QRhi
+ for details.
*/
+/*!
+ \variable QRhiVulkanRenderPassNativeHandles::renderPass
+
+ The VkRenderPass object.
+*/
+
template <class Int>
inline Int aligned(Int v, Int byteAlign)
{
@@ -219,160 +291,150 @@ inline Int aligned(Int v, Int byteAlign)
static QVulkanInstance *globalVulkanInstance;
-static void VKAPI_PTR wrap_vkGetPhysicalDeviceProperties(VkPhysicalDevice physicalDevice, VkPhysicalDeviceProperties* pProperties)
+static VKAPI_ATTR PFN_vkVoidFunction VKAPI_CALL wrap_vkGetInstanceProcAddr(VkInstance, const char *pName)
{
- globalVulkanInstance->functions()->vkGetPhysicalDeviceProperties(physicalDevice, pProperties);
+ return globalVulkanInstance->getInstanceProcAddr(pName);
}
-static void VKAPI_PTR wrap_vkGetPhysicalDeviceMemoryProperties(VkPhysicalDevice physicalDevice, VkPhysicalDeviceMemoryProperties* pMemoryProperties)
+static VKAPI_ATTR PFN_vkVoidFunction VKAPI_CALL wrap_vkGetDeviceProcAddr(VkDevice device, const char *pName)
{
- globalVulkanInstance->functions()->vkGetPhysicalDeviceMemoryProperties(physicalDevice, pMemoryProperties);
+ return globalVulkanInstance->functions()->vkGetDeviceProcAddr(device, pName);
}
-static VkResult VKAPI_PTR wrap_vkAllocateMemory(VkDevice device, const VkMemoryAllocateInfo* pAllocateInfo, const VkAllocationCallbacks* pAllocator, VkDeviceMemory* pMemory)
-{
- return globalVulkanInstance->deviceFunctions(device)->vkAllocateMemory(device, pAllocateInfo, pAllocator, pMemory);
-}
-
-void VKAPI_PTR wrap_vkFreeMemory(VkDevice device, VkDeviceMemory memory, const VkAllocationCallbacks* pAllocator)
-{
- globalVulkanInstance->deviceFunctions(device)->vkFreeMemory(device, memory, pAllocator);
-}
-
-VkResult VKAPI_PTR wrap_vkMapMemory(VkDevice device, VkDeviceMemory memory, VkDeviceSize offset, VkDeviceSize size, VkMemoryMapFlags flags, void** ppData)
-{
- return globalVulkanInstance->deviceFunctions(device)->vkMapMemory(device, memory, offset, size, flags, ppData);
-}
-
-void VKAPI_PTR wrap_vkUnmapMemory(VkDevice device, VkDeviceMemory memory)
-{
- globalVulkanInstance->deviceFunctions(device)->vkUnmapMemory(device, memory);
-}
-
-VkResult VKAPI_PTR wrap_vkFlushMappedMemoryRanges(VkDevice device, uint32_t memoryRangeCount, const VkMappedMemoryRange* pMemoryRanges)
-{
- return globalVulkanInstance->deviceFunctions(device)->vkFlushMappedMemoryRanges(device, memoryRangeCount, pMemoryRanges);
-}
-
-VkResult VKAPI_PTR wrap_vkInvalidateMappedMemoryRanges(VkDevice device, uint32_t memoryRangeCount, const VkMappedMemoryRange* pMemoryRanges)
-{
- return globalVulkanInstance->deviceFunctions(device)->vkInvalidateMappedMemoryRanges(device, memoryRangeCount, pMemoryRanges);
-}
-
-VkResult VKAPI_PTR wrap_vkBindBufferMemory(VkDevice device, VkBuffer buffer, VkDeviceMemory memory, VkDeviceSize memoryOffset)
-{
- return globalVulkanInstance->deviceFunctions(device)->vkBindBufferMemory(device, buffer, memory, memoryOffset);
-}
-
-VkResult VKAPI_PTR wrap_vkBindImageMemory(VkDevice device, VkImage image, VkDeviceMemory memory, VkDeviceSize memoryOffset)
-{
- return globalVulkanInstance->deviceFunctions(device)->vkBindImageMemory(device, image, memory, memoryOffset);
-}
-
-void VKAPI_PTR wrap_vkGetBufferMemoryRequirements(VkDevice device, VkBuffer buffer, VkMemoryRequirements* pMemoryRequirements)
-{
- globalVulkanInstance->deviceFunctions(device)->vkGetBufferMemoryRequirements(device, buffer, pMemoryRequirements);
-}
-
-void VKAPI_PTR wrap_vkGetImageMemoryRequirements(VkDevice device, VkImage image, VkMemoryRequirements* pMemoryRequirements)
-{
- globalVulkanInstance->deviceFunctions(device)->vkGetImageMemoryRequirements(device, image, pMemoryRequirements);
-}
-
-VkResult VKAPI_PTR wrap_vkCreateBuffer(VkDevice device, const VkBufferCreateInfo* pCreateInfo, const VkAllocationCallbacks* pAllocator, VkBuffer* pBuffer)
-{
- return globalVulkanInstance->deviceFunctions(device)->vkCreateBuffer(device, pCreateInfo, pAllocator, pBuffer);
-}
-
-void VKAPI_PTR wrap_vkDestroyBuffer(VkDevice device, VkBuffer buffer, const VkAllocationCallbacks* pAllocator)
+static inline VmaAllocation toVmaAllocation(QVkAlloc a)
{
- globalVulkanInstance->deviceFunctions(device)->vkDestroyBuffer(device, buffer, pAllocator);
+ return reinterpret_cast<VmaAllocation>(a);
}
-VkResult VKAPI_PTR wrap_vkCreateImage(VkDevice device, const VkImageCreateInfo* pCreateInfo, const VkAllocationCallbacks* pAllocator, VkImage* pImage)
+static inline VmaAllocator toVmaAllocator(QVkAllocator a)
{
- return globalVulkanInstance->deviceFunctions(device)->vkCreateImage(device, pCreateInfo, pAllocator, pImage);
+ return reinterpret_cast<VmaAllocator>(a);
}
-void VKAPI_PTR wrap_vkDestroyImage(VkDevice device, VkImage image, const VkAllocationCallbacks* pAllocator)
-{
- globalVulkanInstance->deviceFunctions(device)->vkDestroyImage(device, image, pAllocator);
-}
+/*!
+ \return the list of instance extensions that are expected to be enabled on
+ the QVulkanInstance that is used for the Vulkan-based QRhi.
-static inline VmaAllocation toVmaAllocation(QVkAlloc a)
+ The returned list can be safely passed to QVulkanInstance::setExtensions()
+ as-is, because unsupported extensions are filtered out automatically.
+ */
+QByteArrayList QRhiVulkanInitParams::preferredInstanceExtensions()
{
- return reinterpret_cast<VmaAllocation>(a);
+ return {
+ QByteArrayLiteral("VK_KHR_get_physical_device_properties2")
+ };
}
-static inline VmaAllocator toVmaAllocator(QVkAllocator a)
+/*!
+ \return the list of device extensions that are expected to be enabled on the
+ \c VkDevice when creating a Vulkan-based QRhi with an externally created
+ \c VkDevice object.
+ */
+QByteArrayList QRhiVulkanInitParams::preferredExtensionsForImportedDevice()
{
- return reinterpret_cast<VmaAllocator>(a);
+ return {
+ QByteArrayLiteral("VK_KHR_swapchain"),
+ QByteArrayLiteral("VK_EXT_vertex_attribute_divisor"),
+ QByteArrayLiteral("VK_KHR_create_renderpass2"),
+ QByteArrayLiteral("VK_KHR_depth_stencil_resolve")
+ };
}
-QRhiVulkan::QRhiVulkan(QRhiVulkanInitParams *params, QRhiVulkanNativeHandles *importDevice)
+QRhiVulkan::QRhiVulkan(QRhiVulkanInitParams *params, QRhiVulkanNativeHandles *importParams)
: ofr(this)
{
inst = params->inst;
maybeWindow = params->window; // may be null
-
- importedDevice = importDevice != nullptr;
- if (importedDevice) {
- physDev = importDevice->physDev;
- dev = importDevice->dev;
- if (physDev && dev) {
- gfxQueueFamilyIdx = importDevice->gfxQueueFamilyIdx;
- gfxQueue = importDevice->gfxQueue;
- if (importDevice->cmdPool) {
- importedCmdPool = true;
- cmdPool = importDevice->cmdPool;
- }
- if (importDevice->vmemAllocator) {
+ requestedDeviceExtensions = params->deviceExtensions;
+
+ if (importParams) {
+ physDev = importParams->physDev;
+ dev = importParams->dev;
+ if (dev && physDev) {
+ importedDevice = true;
+ gfxQueueFamilyIdx = importParams->gfxQueueFamilyIdx;
+ gfxQueueIdx = importParams->gfxQueueIdx;
+ // gfxQueue is output only, no point in accepting it as input
+ if (importParams->vmemAllocator) {
importedAllocator = true;
- allocator = importDevice->vmemAllocator;
+ allocator = importParams->vmemAllocator;
}
- } else {
- qWarning("No (physical) Vulkan device is given, cannot import");
- importedDevice = false;
}
}
}
-static bool qvk_debug_filter(VkDebugReportFlagsEXT flags, VkDebugReportObjectTypeEXT objectType, uint64_t object,
- size_t location, int32_t messageCode, const char *pLayerPrefix, const char *pMessage)
+static bool qvk_debug_filter(QVulkanInstance::DebugMessageSeverityFlags severity,
+ QVulkanInstance::DebugMessageTypeFlags type,
+ const void *callbackData)
{
- Q_UNUSED(flags);
- Q_UNUSED(objectType);
- Q_UNUSED(object);
- Q_UNUSED(location);
- Q_UNUSED(messageCode);
- Q_UNUSED(pLayerPrefix);
+ Q_UNUSED(severity);
+ Q_UNUSED(type);
+#ifdef VK_EXT_debug_utils
+ const VkDebugUtilsMessengerCallbackDataEXT *d = static_cast<const VkDebugUtilsMessengerCallbackDataEXT *>(callbackData);
// Filter out certain misleading validation layer messages, as per
// VulkanMemoryAllocator documentation.
- if (strstr(pMessage, "Mapping an image with layout")
- && strstr(pMessage, "can result in undefined behavior if this memory is used by the device"))
+ if (strstr(d->pMessage, "Mapping an image with layout")
+ && strstr(d->pMessage, "can result in undefined behavior if this memory is used by the device"))
{
return true;
}
+ // In certain cases allocateDescriptorSet() will attempt to allocate from a
+ // pool that does not have enough descriptors of a certain type. This makes
+ // the validation layer shout. However, this is not an error since we will
+ // then move on to another pool. If there is a real error, a qWarning
+ // message is shown by allocateDescriptorSet(), so the validation warning
+ // does not have any value and is just noise.
+ if (strstr(d->pMessage, "VUID-VkDescriptorSetAllocateInfo-descriptorPool-00307"))
+ return true;
+#else
+ Q_UNUSED(callbackData);
+#endif
return false;
}
+static inline QRhiDriverInfo::DeviceType toRhiDeviceType(VkPhysicalDeviceType type)
+{
+ switch (type) {
+ case VK_PHYSICAL_DEVICE_TYPE_OTHER:
+ return QRhiDriverInfo::UnknownDevice;
+ case VK_PHYSICAL_DEVICE_TYPE_INTEGRATED_GPU:
+ return QRhiDriverInfo::IntegratedDevice;
+ case VK_PHYSICAL_DEVICE_TYPE_DISCRETE_GPU:
+ return QRhiDriverInfo::DiscreteDevice;
+ case VK_PHYSICAL_DEVICE_TYPE_VIRTUAL_GPU:
+ return QRhiDriverInfo::VirtualDevice;
+ case VK_PHYSICAL_DEVICE_TYPE_CPU:
+ return QRhiDriverInfo::CpuDevice;
+ default:
+ return QRhiDriverInfo::UnknownDevice;
+ }
+}
+
bool QRhiVulkan::create(QRhi::Flags flags)
{
- Q_UNUSED(flags);
Q_ASSERT(inst);
-
if (!inst->isValid()) {
qWarning("Vulkan instance is not valid");
return false;
}
- globalVulkanInstance = inst; // assume this will not change during the lifetime of the entire application
+ rhiFlags = flags;
+ qCDebug(QRHI_LOG_INFO, "Initializing QRhi Vulkan backend %p with flags %d", this, int(rhiFlags));
+ globalVulkanInstance = inst; // used for function resolving in vkmemalloc callbacks
f = inst->functions();
+ if (QRHI_LOG_INFO().isEnabled(QtDebugMsg)) {
+ qCDebug(QRHI_LOG_INFO, "Enabled instance extensions:");
+ for (const char *ext : inst->extensions())
+ qCDebug(QRHI_LOG_INFO, " %s", ext);
+ }
+
+ caps = {};
+ caps.debugUtils = inst->extensions().contains(QByteArrayLiteral("VK_EXT_debug_utils"));
- QVector<VkQueueFamilyProperties> queueFamilyProps;
+ QList<VkQueueFamilyProperties> queueFamilyProps;
auto queryQueueFamilyProps = [this, &queueFamilyProps] {
uint32_t queueCount = 0;
f->vkGetPhysicalDeviceQueueFamilyProperties(physDev, &queueCount, nullptr);
@@ -380,7 +442,8 @@ bool QRhiVulkan::create(QRhi::Flags flags)
f->vkGetPhysicalDeviceQueueFamilyProperties(physDev, &queueCount, queueFamilyProps.data());
};
- if (!importedDevice) {
+ // Choose a physical device, unless one was provided in importParams.
+ if (!physDev) {
uint32_t physDevCount = 0;
f->vkEnumeratePhysicalDevices(inst->vkInstance(), &physDevCount, nullptr);
if (!physDevCount) {
@@ -434,151 +497,368 @@ bool QRhiVulkan::create(QRhi::Flags flags)
return false;
}
physDev = physDevs[physDevIndex];
+ f->vkGetPhysicalDeviceProperties(physDev, &physDevProperties);
+ } else {
+ f->vkGetPhysicalDeviceProperties(physDev, &physDevProperties);
+ qCDebug(QRHI_LOG_INFO, "Using imported physical device '%s' %d.%d.%d (api %d.%d.%d vendor 0x%X device 0x%X type %d)",
+ physDevProperties.deviceName,
+ VK_VERSION_MAJOR(physDevProperties.driverVersion),
+ VK_VERSION_MINOR(physDevProperties.driverVersion),
+ VK_VERSION_PATCH(physDevProperties.driverVersion),
+ VK_VERSION_MAJOR(physDevProperties.apiVersion),
+ VK_VERSION_MINOR(physDevProperties.apiVersion),
+ VK_VERSION_PATCH(physDevProperties.apiVersion),
+ physDevProperties.vendorID,
+ physDevProperties.deviceID,
+ physDevProperties.deviceType);
+ }
+
+ caps.apiVersion = inst->apiVersion();
+
+ // Check the physical device API version against the instance API version,
+ // they do not have to match, which means whatever version was set in the
+ // QVulkanInstance may not be legally used with a given device if the
+ // physical device has a lower version.
+ const QVersionNumber physDevApiVersion(VK_VERSION_MAJOR(physDevProperties.apiVersion),
+ VK_VERSION_MINOR(physDevProperties.apiVersion)); // patch version left out intentionally
+ if (physDevApiVersion < caps.apiVersion) {
+ qCDebug(QRHI_LOG_INFO) << "Instance has api version" << caps.apiVersion
+ << "whereas the chosen physical device has" << physDevApiVersion
+ << "- restricting to the latter";
+ caps.apiVersion = physDevApiVersion;
+ }
+
+ driverInfoStruct.deviceName = QByteArray(physDevProperties.deviceName);
+ driverInfoStruct.deviceId = physDevProperties.deviceID;
+ driverInfoStruct.vendorId = physDevProperties.vendorID;
+ driverInfoStruct.deviceType = toRhiDeviceType(physDevProperties.deviceType);
+
+ bool featuresQueried = false;
+#ifdef VK_VERSION_1_1
+ VkPhysicalDeviceFeatures2 physDevFeaturesChainable = {};
+ physDevFeaturesChainable.sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_FEATURES_2;
+#endif
- queryQueueFamilyProps();
+ // Vulkan >=1.2 headers at build time, >=1.2 implementation at run time
+#ifdef VK_VERSION_1_2
+ if (!featuresQueried) {
+ // Vulkan11Features, Vulkan12Features, etc. are only in Vulkan 1.2 and newer.
+ if (caps.apiVersion >= QVersionNumber(1, 2)) {
+ physDevFeatures11IfApi12OrNewer = {};
+ physDevFeatures11IfApi12OrNewer.sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_VULKAN_1_1_FEATURES;
+ physDevFeatures12 = {};
+ physDevFeatures12.sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_VULKAN_1_2_FEATURES;
+#ifdef VK_VERSION_1_3
+ physDevFeatures13 = {};
+ physDevFeatures13.sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_VULKAN_1_3_FEATURES;
+#endif
+ physDevFeaturesChainable.pNext = &physDevFeatures11IfApi12OrNewer;
+ physDevFeatures11IfApi12OrNewer.pNext = &physDevFeatures12;
+#ifdef VK_VERSION_1_3
+ if (caps.apiVersion >= QVersionNumber(1, 3))
+ physDevFeatures12.pNext = &physDevFeatures13;
+#endif
+ f->vkGetPhysicalDeviceFeatures2(physDev, &physDevFeaturesChainable);
+ memcpy(&physDevFeatures, &physDevFeaturesChainable.features, sizeof(VkPhysicalDeviceFeatures));
+ featuresQueried = true;
+ }
+ }
+#endif // VK_VERSION_1_2
+
+ // Vulkan >=1.1 headers at build time, 1.1 implementation at run time
+#ifdef VK_VERSION_1_1
+ if (!featuresQueried) {
+ // Vulkan versioning nightmares: if the runtime API version is 1.1,
+ // there is no Vulkan11Features (introduced in 1.2+, the headers might
+ // have the types and structs, but the Vulkan implementation version at
+ // run time is what matters). But there are individual feature structs.
+ // For multiview, it is important to get this right since at the time of
+ // writing Quest 3 Android is a Vulkan 1.1 implementation at run time on
+ // the headset.
+ if (caps.apiVersion == QVersionNumber(1, 1)) {
+ multiviewFeaturesIfApi11 = {};
+ multiviewFeaturesIfApi11.sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_MULTIVIEW_FEATURES;
+ physDevFeaturesChainable.pNext = &multiviewFeaturesIfApi11;
+ f->vkGetPhysicalDeviceFeatures2(physDev, &physDevFeaturesChainable);
+ memcpy(&physDevFeatures, &physDevFeaturesChainable.features, sizeof(VkPhysicalDeviceFeatures));
+ featuresQueried = true;
+ }
+ }
+#endif
- gfxQueue = VK_NULL_HANDLE;
+ if (!featuresQueried) {
+ // If the API version at run time is 1.0 (or we are building with
+ // ancient 1.0 headers), then do the Vulkan 1.0 query.
+ f->vkGetPhysicalDeviceFeatures(physDev, &physDevFeatures);
+ featuresQueried = true;
+ }
+ // Choose queue and create device, unless the device was specified in importParams.
+ if (!importedDevice) {
// We only support combined graphics+present queues. When it comes to
// compute, only combined graphics+compute queue is used, compute gets
// disabled otherwise.
- gfxQueueFamilyIdx = -1;
- int computelessGfxQueueCandidateIdx = -1;
- for (int i = 0; i < queueFamilyProps.count(); ++i) {
- qCDebug(QRHI_LOG_INFO, "queue family %d: flags=0x%x count=%d",
+ std::optional<uint32_t> gfxQueueFamilyIdxOpt;
+ std::optional<uint32_t> computelessGfxQueueCandidateIdxOpt;
+ queryQueueFamilyProps();
+ const uint32_t queueFamilyCount = uint32_t(queueFamilyProps.size());
+ for (uint32_t i = 0; i < queueFamilyCount; ++i) {
+ qCDebug(QRHI_LOG_INFO, "queue family %u: flags=0x%x count=%u",
i, queueFamilyProps[i].queueFlags, queueFamilyProps[i].queueCount);
- if (gfxQueueFamilyIdx == -1
+ if (!gfxQueueFamilyIdxOpt.has_value()
&& (queueFamilyProps[i].queueFlags & VK_QUEUE_GRAPHICS_BIT)
- && (!maybeWindow || inst->supportsPresent(physDev, uint32_t(i), maybeWindow)))
+ && (!maybeWindow || inst->supportsPresent(physDev, i, maybeWindow)))
{
if (queueFamilyProps[i].queueFlags & VK_QUEUE_COMPUTE_BIT)
- gfxQueueFamilyIdx = i;
- else if (computelessGfxQueueCandidateIdx == -1)
- computelessGfxQueueCandidateIdx = i;
+ gfxQueueFamilyIdxOpt = i;
+ else if (!computelessGfxQueueCandidateIdxOpt.has_value())
+ computelessGfxQueueCandidateIdxOpt = i;
}
}
- if (gfxQueueFamilyIdx == -1) {
- if (computelessGfxQueueCandidateIdx != -1) {
- gfxQueueFamilyIdx = computelessGfxQueueCandidateIdx;
+ if (gfxQueueFamilyIdxOpt.has_value()) {
+ gfxQueueFamilyIdx = gfxQueueFamilyIdxOpt.value();
+ } else {
+ if (computelessGfxQueueCandidateIdxOpt.has_value()) {
+ gfxQueueFamilyIdx = computelessGfxQueueCandidateIdxOpt.value();
} else {
qWarning("No graphics (or no graphics+present) queue family found");
return false;
}
}
- VkDeviceQueueCreateInfo queueInfo[2];
+ VkDeviceQueueCreateInfo queueInfo = {};
const float prio[] = { 0 };
- memset(queueInfo, 0, sizeof(queueInfo));
- queueInfo[0].sType = VK_STRUCTURE_TYPE_DEVICE_QUEUE_CREATE_INFO;
- queueInfo[0].queueFamilyIndex = uint32_t(gfxQueueFamilyIdx);
- queueInfo[0].queueCount = 1;
- queueInfo[0].pQueuePriorities = prio;
+ queueInfo.sType = VK_STRUCTURE_TYPE_DEVICE_QUEUE_CREATE_INFO;
+ queueInfo.queueFamilyIndex = gfxQueueFamilyIdx;
+ queueInfo.queueCount = 1;
+ queueInfo.pQueuePriorities = prio;
- QVector<const char *> devLayers;
- if (inst->layers().contains("VK_LAYER_LUNARG_standard_validation"))
- devLayers.append("VK_LAYER_LUNARG_standard_validation");
+ QList<const char *> devLayers;
+ if (inst->layers().contains("VK_LAYER_KHRONOS_validation"))
+ devLayers.append("VK_LAYER_KHRONOS_validation");
+ QVulkanInfoVector<QVulkanExtension> devExts;
uint32_t devExtCount = 0;
f->vkEnumerateDeviceExtensionProperties(physDev, nullptr, &devExtCount, nullptr);
- QVector<VkExtensionProperties> devExts(devExtCount);
- f->vkEnumerateDeviceExtensionProperties(physDev, nullptr, &devExtCount, devExts.data());
- qCDebug(QRHI_LOG_INFO, "%d device extensions available", devExts.count());
+ if (devExtCount) {
+ QList<VkExtensionProperties> extProps(devExtCount);
+ f->vkEnumerateDeviceExtensionProperties(physDev, nullptr, &devExtCount, extProps.data());
+ for (const VkExtensionProperties &p : std::as_const(extProps))
+ devExts.append({ p.extensionName, p.specVersion });
+ }
+ qCDebug(QRHI_LOG_INFO, "%d device extensions available", int(devExts.size()));
- QVector<const char *> requestedDevExts;
+ QList<const char *> requestedDevExts;
requestedDevExts.append("VK_KHR_swapchain");
- debugMarkersAvailable = false;
- vertexAttribDivisorAvailable = false;
- for (const VkExtensionProperties &ext : devExts) {
- if (!strcmp(ext.extensionName, VK_EXT_DEBUG_MARKER_EXTENSION_NAME)) {
- requestedDevExts.append(VK_EXT_DEBUG_MARKER_EXTENSION_NAME);
- debugMarkersAvailable = true;
- } else if (!strcmp(ext.extensionName, VK_EXT_VERTEX_ATTRIBUTE_DIVISOR_EXTENSION_NAME)) {
- if (inst->extensions().contains(QByteArrayLiteral("VK_KHR_get_physical_device_properties2"))) {
- requestedDevExts.append(VK_EXT_VERTEX_ATTRIBUTE_DIVISOR_EXTENSION_NAME);
- vertexAttribDivisorAvailable = true;
+ const bool hasPhysDevProp2 = inst->extensions().contains(QByteArrayLiteral("VK_KHR_get_physical_device_properties2"));
+
+ if (devExts.contains(QByteArrayLiteral("VK_KHR_portability_subset"))) {
+ if (hasPhysDevProp2) {
+ requestedDevExts.append("VK_KHR_portability_subset");
+ } else {
+ qWarning("VK_KHR_portability_subset should be enabled on the device "
+ "but the instance does not have VK_KHR_get_physical_device_properties2 enabled. "
+ "Expect problems.");
+ }
+ }
+
+#ifdef VK_EXT_vertex_attribute_divisor
+ if (devExts.contains(VK_EXT_VERTEX_ATTRIBUTE_DIVISOR_EXTENSION_NAME)) {
+ if (hasPhysDevProp2) {
+ requestedDevExts.append(VK_EXT_VERTEX_ATTRIBUTE_DIVISOR_EXTENSION_NAME);
+ caps.vertexAttribDivisor = true;
+ }
+ }
+#endif
+
+#ifdef VK_KHR_create_renderpass2
+ if (devExts.contains(VK_KHR_CREATE_RENDERPASS_2_EXTENSION_NAME)) {
+ requestedDevExts.append(VK_KHR_CREATE_RENDERPASS_2_EXTENSION_NAME);
+ caps.renderPass2KHR = true;
+ }
+#endif
+
+#ifdef VK_KHR_depth_stencil_resolve
+ if (devExts.contains(VK_KHR_DEPTH_STENCIL_RESOLVE_EXTENSION_NAME)) {
+ requestedDevExts.append(VK_KHR_DEPTH_STENCIL_RESOLVE_EXTENSION_NAME);
+ caps.depthStencilResolveKHR = true;
+ }
+#endif
+
+ for (const QByteArray &ext : requestedDeviceExtensions) {
+ if (!ext.isEmpty() && !requestedDevExts.contains(ext)) {
+ if (devExts.contains(ext)) {
+ requestedDevExts.append(ext.constData());
+ } else {
+ qWarning("Device extension %s requested in QRhiVulkanInitParams is not supported",
+ ext.constData());
}
}
}
- VkDeviceCreateInfo devInfo;
- memset(&devInfo, 0, sizeof(devInfo));
+ QByteArrayList envExtList = qgetenv("QT_VULKAN_DEVICE_EXTENSIONS").split(';');
+ for (const QByteArray &ext : envExtList) {
+ if (!ext.isEmpty() && !requestedDevExts.contains(ext)) {
+ if (devExts.contains(ext)) {
+ requestedDevExts.append(ext.constData());
+ } else {
+ qWarning("Device extension %s requested in QT_VULKAN_DEVICE_EXTENSIONS is not supported",
+ ext.constData());
+ }
+ }
+ }
+
+ if (QRHI_LOG_INFO().isEnabled(QtDebugMsg)) {
+ qCDebug(QRHI_LOG_INFO, "Enabling device extensions:");
+ for (const char *ext : requestedDevExts)
+ qCDebug(QRHI_LOG_INFO, " %s", ext);
+ }
+
+ VkDeviceCreateInfo devInfo = {};
devInfo.sType = VK_STRUCTURE_TYPE_DEVICE_CREATE_INFO;
devInfo.queueCreateInfoCount = 1;
- devInfo.pQueueCreateInfos = queueInfo;
- devInfo.enabledLayerCount = uint32_t(devLayers.count());
+ devInfo.pQueueCreateInfos = &queueInfo;
+ devInfo.enabledLayerCount = uint32_t(devLayers.size());
devInfo.ppEnabledLayerNames = devLayers.constData();
- devInfo.enabledExtensionCount = uint32_t(requestedDevExts.count());
+ devInfo.enabledExtensionCount = uint32_t(requestedDevExts.size());
devInfo.ppEnabledExtensionNames = requestedDevExts.constData();
- err = f->vkCreateDevice(physDev, &devInfo, nullptr, &dev);
+ // Enable all features that are reported as supported, except
+ // robustness because that potentially affects performance.
+ //
+ // Enabling all features mainly serves third-party renderers that may
+ // use the VkDevice created here. For the record, the backend here
+ // optionally relies on the following features, meaning just for our
+ // (QRhi/Quick/Quick 3D) purposes it would be sufficient to
+ // enable-if-supported only the following:
+ //
+ // wideLines, largePoints, fillModeNonSolid,
+ // tessellationShader, geometryShader
+ // textureCompressionETC2, textureCompressionASTC_LDR, textureCompressionBC
+
+#ifdef VK_VERSION_1_1
+ physDevFeaturesChainable.features.robustBufferAccess = VK_FALSE;
+#endif
+#ifdef VK_VERSION_1_3
+ physDevFeatures13.robustImageAccess = VK_FALSE;
+#endif
+
+#ifdef VK_VERSION_1_1
+ if (caps.apiVersion >= QVersionNumber(1, 1)) {
+ // For a >=1.2 implementation at run time, this will enable all
+ // (1.0-1.3) features reported as supported, except the ones we turn
+ // off explicitly above. For a 1.1 implementation at run time, this
+ // only enables the 1.0 and multiview features reported as
+ // supported. We will not be bothering with the Vulkan 1.1
+ // individual feature struct nonsense.
+ devInfo.pNext = &physDevFeaturesChainable;
+ } else
+#endif
+ {
+ physDevFeatures.robustBufferAccess = VK_FALSE;
+ devInfo.pEnabledFeatures = &physDevFeatures;
+ }
+
+ VkResult err = f->vkCreateDevice(physDev, &devInfo, nullptr, &dev);
if (err != VK_SUCCESS) {
qWarning("Failed to create device: %d", err);
return false;
}
+ } else {
+ qCDebug(QRHI_LOG_INFO, "Using imported device %p", dev);
+
+ // Here we have no way to tell if the extensions got enabled or not.
+ // Pretend it's all there and supported. If getProcAddress fails, we'll
+ // handle that gracefully.
+ caps.vertexAttribDivisor = true;
+ caps.renderPass2KHR = true;
+ caps.depthStencilResolveKHR = true;
}
+ vkGetPhysicalDeviceSurfaceCapabilitiesKHR = reinterpret_cast<PFN_vkGetPhysicalDeviceSurfaceCapabilitiesKHR>(
+ inst->getInstanceProcAddr("vkGetPhysicalDeviceSurfaceCapabilitiesKHR"));
+ vkGetPhysicalDeviceSurfaceFormatsKHR = reinterpret_cast<PFN_vkGetPhysicalDeviceSurfaceFormatsKHR>(
+ inst->getInstanceProcAddr("vkGetPhysicalDeviceSurfaceFormatsKHR"));
+ vkGetPhysicalDeviceSurfacePresentModesKHR = reinterpret_cast<PFN_vkGetPhysicalDeviceSurfacePresentModesKHR>(
+ inst->getInstanceProcAddr("vkGetPhysicalDeviceSurfacePresentModesKHR"));
+
df = inst->deviceFunctions(dev);
- if (!importedCmdPool) {
- VkCommandPoolCreateInfo poolInfo;
- memset(&poolInfo, 0, sizeof(poolInfo));
- poolInfo.sType = VK_STRUCTURE_TYPE_COMMAND_POOL_CREATE_INFO;
- poolInfo.queueFamilyIndex = uint32_t(gfxQueueFamilyIdx);
- VkResult err = df->vkCreateCommandPool(dev, &poolInfo, nullptr, &cmdPool);
+ VkCommandPoolCreateInfo poolInfo = {};
+ poolInfo.sType = VK_STRUCTURE_TYPE_COMMAND_POOL_CREATE_INFO;
+ poolInfo.queueFamilyIndex = gfxQueueFamilyIdx;
+ for (int i = 0; i < QVK_FRAMES_IN_FLIGHT; ++i) {
+ VkResult err = df->vkCreateCommandPool(dev, &poolInfo, nullptr, &cmdPool[i]);
if (err != VK_SUCCESS) {
qWarning("Failed to create command pool: %d", err);
return false;
}
}
- if (gfxQueueFamilyIdx != -1) {
- if (!gfxQueue)
- df->vkGetDeviceQueue(dev, uint32_t(gfxQueueFamilyIdx), 0, &gfxQueue);
+ qCDebug(QRHI_LOG_INFO, "Using queue family index %u and queue index %u",
+ gfxQueueFamilyIdx, gfxQueueIdx);
- if (queueFamilyProps.isEmpty())
- queryQueueFamilyProps();
+ df->vkGetDeviceQueue(dev, gfxQueueFamilyIdx, gfxQueueIdx, &gfxQueue);
- hasCompute = (queueFamilyProps[gfxQueueFamilyIdx].queueFlags & VK_QUEUE_COMPUTE_BIT) != 0;
- timestampValidBits = queueFamilyProps[gfxQueueFamilyIdx].timestampValidBits;
- }
+ if (queueFamilyProps.isEmpty())
+ queryQueueFamilyProps();
+
+ caps.compute = (queueFamilyProps[gfxQueueFamilyIdx].queueFlags & VK_QUEUE_COMPUTE_BIT) != 0;
+ timestampValidBits = queueFamilyProps[gfxQueueFamilyIdx].timestampValidBits;
- f->vkGetPhysicalDeviceProperties(physDev, &physDevProperties);
ubufAlign = physDevProperties.limits.minUniformBufferOffsetAlignment;
// helps little with an optimal offset of 1 (on some drivers) when the spec
// elsewhere states that the minimum bufferOffset is 4...
texbufAlign = qMax<VkDeviceSize>(4, physDevProperties.limits.optimalBufferCopyOffsetAlignment);
- f->vkGetPhysicalDeviceFeatures(physDev, &physDevFeatures);
- hasWideLines = physDevFeatures.wideLines;
+ caps.wideLines = physDevFeatures.wideLines;
+
+ caps.texture3DSliceAs2D = caps.apiVersion >= QVersionNumber(1, 1);
+
+ caps.tessellation = physDevFeatures.tessellationShader;
+ caps.geometryShader = physDevFeatures.geometryShader;
+
+ caps.nonFillPolygonMode = physDevFeatures.fillModeNonSolid;
+
+#ifdef VK_VERSION_1_2
+ if (caps.apiVersion >= QVersionNumber(1, 2))
+ caps.multiView = physDevFeatures11IfApi12OrNewer.multiview;
+#endif
+
+#ifdef VK_VERSION_1_1
+ if (caps.apiVersion == QVersionNumber(1, 1))
+ caps.multiView = multiviewFeaturesIfApi11.multiview;
+#endif
+
+ // With Vulkan 1.2 renderpass2 and depth_stencil_resolve are core, but we
+ // have to support the case of 1.1 + extensions, in particular for the Quest
+ // 3 (Android, Vulkan 1.1 at the time of writing). Therefore, always rely on
+ // the KHR extension for now.
+#ifdef VK_KHR_create_renderpass2
+ if (caps.renderPass2KHR) {
+ vkCreateRenderPass2KHR = reinterpret_cast<PFN_vkCreateRenderPass2KHR>(f->vkGetDeviceProcAddr(dev, "vkCreateRenderPass2KHR"));
+ if (!vkCreateRenderPass2KHR) // handle it gracefully, the caps flag may be incorrect when using an imported VkDevice
+ caps.renderPass2KHR = false;
+ }
+#endif
if (!importedAllocator) {
- VmaVulkanFunctions afuncs;
- afuncs.vkGetPhysicalDeviceProperties = wrap_vkGetPhysicalDeviceProperties;
- afuncs.vkGetPhysicalDeviceMemoryProperties = wrap_vkGetPhysicalDeviceMemoryProperties;
- afuncs.vkAllocateMemory = wrap_vkAllocateMemory;
- afuncs.vkFreeMemory = wrap_vkFreeMemory;
- afuncs.vkMapMemory = wrap_vkMapMemory;
- afuncs.vkUnmapMemory = wrap_vkUnmapMemory;
- afuncs.vkFlushMappedMemoryRanges = wrap_vkFlushMappedMemoryRanges;
- afuncs.vkInvalidateMappedMemoryRanges = wrap_vkInvalidateMappedMemoryRanges;
- afuncs.vkBindBufferMemory = wrap_vkBindBufferMemory;
- afuncs.vkBindImageMemory = wrap_vkBindImageMemory;
- afuncs.vkGetBufferMemoryRequirements = wrap_vkGetBufferMemoryRequirements;
- afuncs.vkGetImageMemoryRequirements = wrap_vkGetImageMemoryRequirements;
- afuncs.vkCreateBuffer = wrap_vkCreateBuffer;
- afuncs.vkDestroyBuffer = wrap_vkDestroyBuffer;
- afuncs.vkCreateImage = wrap_vkCreateImage;
- afuncs.vkDestroyImage = wrap_vkDestroyImage;
-
- VmaAllocatorCreateInfo allocatorInfo;
- memset(&allocatorInfo, 0, sizeof(allocatorInfo));
+ VmaVulkanFunctions funcs = {};
+ funcs.vkGetInstanceProcAddr = wrap_vkGetInstanceProcAddr;
+ funcs.vkGetDeviceProcAddr = wrap_vkGetDeviceProcAddr;
+
+ VmaAllocatorCreateInfo allocatorInfo = {};
// A QRhi is supposed to be used from one single thread only. Disable
// the allocator's own mutexes. This gives a performance boost.
allocatorInfo.flags = VMA_ALLOCATOR_CREATE_EXTERNALLY_SYNCHRONIZED_BIT;
allocatorInfo.physicalDevice = physDev;
allocatorInfo.device = dev;
- allocatorInfo.pVulkanFunctions = &afuncs;
+ allocatorInfo.pVulkanFunctions = &funcs;
+ allocatorInfo.instance = inst->vkInstance();
+ allocatorInfo.vulkanApiVersion = VK_MAKE_VERSION(caps.apiVersion.majorVersion(),
+ caps.apiVersion.minorVersion(),
+ caps.apiVersion.microVersion());
VmaAllocator vmaallocator;
VkResult err = vmaCreateAllocator(&allocatorInfo, &vmaallocator);
if (err != VK_SUCCESS) {
@@ -597,8 +877,7 @@ bool QRhiVulkan::create(QRhi::Flags flags)
else
qWarning("Failed to create initial descriptor pool: %d", err);
- VkQueryPoolCreateInfo timestampQueryPoolInfo;
- memset(&timestampQueryPoolInfo, 0, sizeof(timestampQueryPoolInfo));
+ VkQueryPoolCreateInfo timestampQueryPoolInfo = {};
timestampQueryPoolInfo.sType = VK_STRUCTURE_TYPE_QUERY_POOL_CREATE_INFO;
timestampQueryPoolInfo.queryType = VK_QUERY_TYPE_TIMESTAMP;
timestampQueryPoolInfo.queryCount = QVK_MAX_ACTIVE_TIMESTAMP_PAIRS * 2;
@@ -610,21 +889,24 @@ bool QRhiVulkan::create(QRhi::Flags flags)
timestampQueryPoolMap.resize(QVK_MAX_ACTIVE_TIMESTAMP_PAIRS); // 1 bit per pair
timestampQueryPoolMap.fill(false);
- if (debugMarkersAvailable) {
- vkCmdDebugMarkerBegin = reinterpret_cast<PFN_vkCmdDebugMarkerBeginEXT>(f->vkGetDeviceProcAddr(dev, "vkCmdDebugMarkerBeginEXT"));
- vkCmdDebugMarkerEnd = reinterpret_cast<PFN_vkCmdDebugMarkerEndEXT>(f->vkGetDeviceProcAddr(dev, "vkCmdDebugMarkerEndEXT"));
- vkCmdDebugMarkerInsert = reinterpret_cast<PFN_vkCmdDebugMarkerInsertEXT>(f->vkGetDeviceProcAddr(dev, "vkCmdDebugMarkerInsertEXT"));
- vkDebugMarkerSetObjectName = reinterpret_cast<PFN_vkDebugMarkerSetObjectNameEXT>(f->vkGetDeviceProcAddr(dev, "vkDebugMarkerSetObjectNameEXT"));
+#ifdef VK_EXT_debug_utils
+ if (caps.debugUtils) {
+ vkSetDebugUtilsObjectNameEXT = reinterpret_cast<PFN_vkSetDebugUtilsObjectNameEXT>(f->vkGetDeviceProcAddr(dev, "vkSetDebugUtilsObjectNameEXT"));
+ vkCmdBeginDebugUtilsLabelEXT = reinterpret_cast<PFN_vkCmdBeginDebugUtilsLabelEXT>(f->vkGetDeviceProcAddr(dev, "vkCmdBeginDebugUtilsLabelEXT"));
+ vkCmdEndDebugUtilsLabelEXT = reinterpret_cast<PFN_vkCmdEndDebugUtilsLabelEXT>(f->vkGetDeviceProcAddr(dev, "vkCmdEndDebugUtilsLabelEXT"));
+ vkCmdInsertDebugUtilsLabelEXT = reinterpret_cast<PFN_vkCmdInsertDebugUtilsLabelEXT>(f->vkGetDeviceProcAddr(dev, "vkCmdInsertDebugUtilsLabelEXT"));
}
+#endif
deviceLost = false;
nativeHandlesStruct.physDev = physDev;
nativeHandlesStruct.dev = dev;
nativeHandlesStruct.gfxQueueFamilyIdx = gfxQueueFamilyIdx;
+ nativeHandlesStruct.gfxQueueIdx = gfxQueueIdx;
nativeHandlesStruct.gfxQueue = gfxQueue;
- nativeHandlesStruct.cmdPool = cmdPool;
nativeHandlesStruct.vmemAllocator = allocator;
+ nativeHandlesStruct.inst = inst;
return true;
}
@@ -645,11 +927,6 @@ void QRhiVulkan::destroy()
ofr.cmdFence = VK_NULL_HANDLE;
}
- if (ofr.cbWrapper.cb) {
- df->vkFreeCommandBuffers(dev, cmdPool, 1, &ofr.cbWrapper.cb);
- ofr.cbWrapper.cb = VK_NULL_HANDLE;
- }
-
if (pipelineCache) {
df->vkDestroyPipelineCache(dev, pipelineCache, nullptr);
pipelineCache = VK_NULL_HANDLE;
@@ -670,9 +947,13 @@ void QRhiVulkan::destroy()
allocator = nullptr;
}
- if (!importedCmdPool && cmdPool) {
- df->vkDestroyCommandPool(dev, cmdPool, nullptr);
- cmdPool = VK_NULL_HANDLE;
+ for (int i = 0; i < QVK_FRAMES_IN_FLIGHT; ++i) {
+ if (cmdPool[i]) {
+ df->vkDestroyCommandPool(dev, cmdPool[i], nullptr);
+ cmdPool[i] = VK_NULL_HANDLE;
+ }
+ freeSecondaryCbs[i].clear();
+ ofr.cbWrapper[i]->cb = VK_NULL_HANDLE;
}
if (!importedDevice && dev) {
@@ -694,8 +975,7 @@ VkResult QRhiVulkan::createDescriptorPool(VkDescriptorPool *pool)
{ VK_DESCRIPTOR_TYPE_STORAGE_BUFFER, QVK_STORAGE_BUFFERS_PER_POOL },
{ VK_DESCRIPTOR_TYPE_STORAGE_IMAGE, QVK_STORAGE_IMAGES_PER_POOL }
};
- VkDescriptorPoolCreateInfo descPoolInfo;
- memset(&descPoolInfo, 0, sizeof(descPoolInfo));
+ VkDescriptorPoolCreateInfo descPoolInfo = {};
descPoolInfo.sType = VK_STRUCTURE_TYPE_DESCRIPTOR_POOL_CREATE_INFO;
// Do not enable vkFreeDescriptorSets - sets are never freed on their own
// (good so no trouble with fragmentation), they just deref their pool
@@ -717,7 +997,7 @@ bool QRhiVulkan::allocateDescriptorSet(VkDescriptorSetAllocateInfo *allocInfo, V
return r;
};
- int lastPoolIdx = descriptorPools.count() - 1;
+ int lastPoolIdx = descriptorPools.size() - 1;
for (int i = lastPoolIdx; i >= 0; --i) {
if (descriptorPools[i].refCount == 0) {
df->vkResetDescriptorPool(dev, descriptorPools[i].pool, 0);
@@ -737,7 +1017,7 @@ bool QRhiVulkan::allocateDescriptorSet(VkDescriptorSetAllocateInfo *allocInfo, V
VkResult poolErr = createDescriptorPool(&newPool);
if (poolErr == VK_SUCCESS) {
descriptorPools.append(newPool);
- lastPoolIdx = descriptorPools.count() - 1;
+ lastPoolIdx = descriptorPools.size() - 1;
VkResult err = tryAllocate(lastPoolIdx);
if (err != VK_SUCCESS) {
qWarning("Failed to allocate descriptor set from new pool too, giving up: %d", err);
@@ -762,8 +1042,12 @@ static inline VkFormat toVkTextureFormat(QRhiTexture::Format format, QRhiTexture
return srgb ? VK_FORMAT_B8G8R8A8_SRGB : VK_FORMAT_B8G8R8A8_UNORM;
case QRhiTexture::R8:
return srgb ? VK_FORMAT_R8_SRGB : VK_FORMAT_R8_UNORM;
+ case QRhiTexture::RG8:
+ return srgb ? VK_FORMAT_R8G8_SRGB : VK_FORMAT_R8G8_UNORM;
case QRhiTexture::R16:
return VK_FORMAT_R16_UNORM;
+ case QRhiTexture::RG16:
+ return VK_FORMAT_R16G16_UNORM;
case QRhiTexture::RED_OR_ALPHA8:
return VK_FORMAT_R8_UNORM;
@@ -771,9 +1055,21 @@ static inline VkFormat toVkTextureFormat(QRhiTexture::Format format, QRhiTexture
return VK_FORMAT_R16G16B16A16_SFLOAT;
case QRhiTexture::RGBA32F:
return VK_FORMAT_R32G32B32A32_SFLOAT;
+ case QRhiTexture::R16F:
+ return VK_FORMAT_R16_SFLOAT;
+ case QRhiTexture::R32F:
+ return VK_FORMAT_R32_SFLOAT;
+
+ case QRhiTexture::RGB10A2:
+ // intentionally A2B10G10R10, not A2R10G10B10
+ return VK_FORMAT_A2B10G10R10_UNORM_PACK32;
case QRhiTexture::D16:
return VK_FORMAT_D16_UNORM;
+ case QRhiTexture::D24:
+ return VK_FORMAT_X8_D24_UNORM_PACK32;
+ case QRhiTexture::D24S8:
+ return VK_FORMAT_D24_UNORM_S8_UINT;
case QRhiTexture::D32F:
return VK_FORMAT_D32_SFLOAT;
@@ -829,12 +1125,11 @@ static inline VkFormat toVkTextureFormat(QRhiTexture::Format format, QRhiTexture
return srgb ? VK_FORMAT_ASTC_12x12_SRGB_BLOCK : VK_FORMAT_ASTC_12x12_UNORM_BLOCK;
default:
- Q_UNREACHABLE();
- return VK_FORMAT_R8G8B8A8_UNORM;
+ Q_UNREACHABLE_RETURN(VK_FORMAT_R8G8B8A8_UNORM);
}
}
-static inline QRhiTexture::Format colorTextureFormatFromVkFormat(VkFormat format, QRhiTexture::Flags *flags)
+static inline QRhiTexture::Format swapchainReadbackTextureFormat(VkFormat format, QRhiTexture::Flags *flags)
{
switch (format) {
case VK_FORMAT_R8G8B8A8_UNORM:
@@ -849,26 +1144,25 @@ static inline QRhiTexture::Format colorTextureFormatFromVkFormat(VkFormat format
if (flags)
(*flags) |= QRhiTexture::sRGB;
return QRhiTexture::BGRA8;
- case VK_FORMAT_R8_UNORM:
- return QRhiTexture::R8;
- case VK_FORMAT_R8_SRGB:
- if (flags)
- (*flags) |= QRhiTexture::sRGB;
- return QRhiTexture::R8;
- case VK_FORMAT_R16_UNORM:
- return QRhiTexture::R16;
- default: // this cannot assert, must warn and return unknown
- qWarning("VkFormat %d is not a recognized uncompressed color format", format);
+ case VK_FORMAT_R16G16B16A16_SFLOAT:
+ return QRhiTexture::RGBA16F;
+ case VK_FORMAT_R32G32B32A32_SFLOAT:
+ return QRhiTexture::RGBA32F;
+ case VK_FORMAT_A2B10G10R10_UNORM_PACK32:
+ return QRhiTexture::RGB10A2;
+ default:
+ qWarning("VkFormat %d cannot be read back", format);
break;
}
return QRhiTexture::UnknownFormat;
}
-static inline bool isDepthTextureFormat(QRhiTexture::Format format)
+static constexpr inline bool isDepthTextureFormat(QRhiTexture::Format format)
{
switch (format) {
case QRhiTexture::Format::D16:
- Q_FALLTHROUGH();
+ case QRhiTexture::Format::D24:
+ case QRhiTexture::Format::D24S8:
case QRhiTexture::Format::D32F:
return true;
@@ -877,6 +1171,11 @@ static inline bool isDepthTextureFormat(QRhiTexture::Format format)
}
}
+static constexpr inline VkImageAspectFlags aspectMaskForTextureFormat(QRhiTexture::Format format)
+{
+ return isDepthTextureFormat(format) ? VK_IMAGE_ASPECT_DEPTH_BIT : VK_IMAGE_ASPECT_COLOR_BIT;
+}
+
// Transient images ("render buffers") backed by lazily allocated memory are
// managed manually without going through vk_mem_alloc since it does not offer
// any support for such images. This should be ok since in practice there
@@ -928,8 +1227,7 @@ bool QRhiVulkan::createTransientImage(VkFormat format,
VkResult err;
for (int i = 0; i < count; ++i) {
- VkImageCreateInfo imgInfo;
- memset(&imgInfo, 0, sizeof(imgInfo));
+ VkImageCreateInfo imgInfo = {};
imgInfo.sType = VK_STRUCTURE_TYPE_IMAGE_CREATE_INFO;
imgInfo.imageType = VK_IMAGE_TYPE_2D;
imgInfo.format = format;
@@ -954,8 +1252,7 @@ bool QRhiVulkan::createTransientImage(VkFormat format,
df->vkGetImageMemoryRequirements(dev, images[i], &memReq);
}
- VkMemoryAllocateInfo memInfo;
- memset(&memInfo, 0, sizeof(memInfo));
+ VkMemoryAllocateInfo memInfo = {};
memInfo.sType = VK_STRUCTURE_TYPE_MEMORY_ALLOCATE_INFO;
memInfo.allocationSize = aligned(memReq.size, memReq.alignment) * VkDeviceSize(count);
@@ -983,8 +1280,7 @@ bool QRhiVulkan::createTransientImage(VkFormat format,
}
ofs += aligned(memReq.size, memReq.alignment);
- VkImageViewCreateInfo imgViewInfo;
- memset(&imgViewInfo, 0, sizeof(imgViewInfo));
+ VkImageViewCreateInfo imgViewInfo = {};
imgViewInfo.sType = VK_STRUCTURE_TYPE_IMAGE_VIEW_CREATE_INFO;
imgViewInfo.image = images[i];
imgViewInfo.viewType = VK_IMAGE_VIEW_TYPE_2D;
@@ -1032,12 +1328,32 @@ VkFormat QRhiVulkan::optimalDepthStencilFormat()
return optimalDsFormat;
}
+static void fillRenderPassCreateInfo(VkRenderPassCreateInfo *rpInfo,
+ VkSubpassDescription *subpassDesc,
+ QVkRenderPassDescriptor *rpD)
+{
+ memset(subpassDesc, 0, sizeof(VkSubpassDescription));
+ subpassDesc->pipelineBindPoint = VK_PIPELINE_BIND_POINT_GRAPHICS;
+ subpassDesc->colorAttachmentCount = uint32_t(rpD->colorRefs.size());
+ subpassDesc->pColorAttachments = !rpD->colorRefs.isEmpty() ? rpD->colorRefs.constData() : nullptr;
+ subpassDesc->pDepthStencilAttachment = rpD->hasDepthStencil ? &rpD->dsRef : nullptr;
+ subpassDesc->pResolveAttachments = !rpD->resolveRefs.isEmpty() ? rpD->resolveRefs.constData() : nullptr;
+
+ memset(rpInfo, 0, sizeof(VkRenderPassCreateInfo));
+ rpInfo->sType = VK_STRUCTURE_TYPE_RENDER_PASS_CREATE_INFO;
+ rpInfo->attachmentCount = uint32_t(rpD->attDescs.size());
+ rpInfo->pAttachments = rpD->attDescs.constData();
+ rpInfo->subpassCount = 1;
+ rpInfo->pSubpasses = subpassDesc;
+ rpInfo->dependencyCount = uint32_t(rpD->subpassDeps.size());
+ rpInfo->pDependencies = !rpD->subpassDeps.isEmpty() ? rpD->subpassDeps.constData() : nullptr;
+}
+
bool QRhiVulkan::createDefaultRenderPass(QVkRenderPassDescriptor *rpD, bool hasDepthStencil, VkSampleCountFlagBits samples, VkFormat colorFormat)
{
// attachment list layout is color (1), ds (0-1), resolve (0-1)
- VkAttachmentDescription attDesc;
- memset(&attDesc, 0, sizeof(attDesc));
+ VkAttachmentDescription attDesc = {};
attDesc.format = colorFormat;
attDesc.samples = samples;
attDesc.loadOp = VK_ATTACHMENT_LOAD_OP_CLEAR;
@@ -1050,6 +1366,10 @@ bool QRhiVulkan::createDefaultRenderPass(QVkRenderPassDescriptor *rpD, bool hasD
rpD->colorRefs.append({ 0, VK_IMAGE_LAYOUT_COLOR_ATTACHMENT_OPTIMAL });
+ rpD->hasDepthStencil = hasDepthStencil;
+ rpD->hasDepthStencilResolve = false;
+ rpD->multiViewCount = 0;
+
if (hasDepthStencil) {
// clear on load + no store + lazy alloc + transient image should play
// nicely with tiled GPUs (no physical backing necessary for ds buffer)
@@ -1082,40 +1402,32 @@ bool QRhiVulkan::createDefaultRenderPass(QVkRenderPassDescriptor *rpD, bool hasD
rpD->resolveRefs.append({ 2, VK_IMAGE_LAYOUT_COLOR_ATTACHMENT_OPTIMAL });
}
- VkSubpassDescription subpassDesc;
- memset(&subpassDesc, 0, sizeof(subpassDesc));
- subpassDesc.pipelineBindPoint = VK_PIPELINE_BIND_POINT_GRAPHICS;
- subpassDesc.colorAttachmentCount = 1;
- subpassDesc.pColorAttachments = rpD->colorRefs.constData();
- subpassDesc.pDepthStencilAttachment = hasDepthStencil ? &rpD->dsRef : nullptr;
-
// Replace the first implicit dep (TOP_OF_PIPE / ALL_COMMANDS) with our own.
- VkSubpassDependency subpassDep;
- memset(&subpassDep, 0, sizeof(subpassDep));
+ VkSubpassDependency subpassDep = {};
subpassDep.srcSubpass = VK_SUBPASS_EXTERNAL;
subpassDep.dstSubpass = 0;
subpassDep.srcStageMask = VK_PIPELINE_STAGE_COLOR_ATTACHMENT_OUTPUT_BIT;
subpassDep.dstStageMask = VK_PIPELINE_STAGE_COLOR_ATTACHMENT_OUTPUT_BIT;
subpassDep.srcAccessMask = 0;
subpassDep.dstAccessMask = VK_ACCESS_COLOR_ATTACHMENT_WRITE_BIT;
+ rpD->subpassDeps.append(subpassDep);
+ if (hasDepthStencil) {
+ memset(&subpassDep, 0, sizeof(subpassDep));
+ subpassDep.srcSubpass = VK_SUBPASS_EXTERNAL;
+ subpassDep.dstSubpass = 0;
+ subpassDep.srcStageMask = VK_PIPELINE_STAGE_EARLY_FRAGMENT_TESTS_BIT
+ | VK_PIPELINE_STAGE_LATE_FRAGMENT_TESTS_BIT;
+ subpassDep.dstStageMask = VK_PIPELINE_STAGE_EARLY_FRAGMENT_TESTS_BIT
+ | VK_PIPELINE_STAGE_LATE_FRAGMENT_TESTS_BIT;
+ subpassDep.srcAccessMask = VK_ACCESS_DEPTH_STENCIL_ATTACHMENT_WRITE_BIT;
+ subpassDep.dstAccessMask = VK_ACCESS_DEPTH_STENCIL_ATTACHMENT_READ_BIT
+ | VK_ACCESS_DEPTH_STENCIL_ATTACHMENT_WRITE_BIT;
+ rpD->subpassDeps.append(subpassDep);
+ }
VkRenderPassCreateInfo rpInfo;
- memset(&rpInfo, 0, sizeof(rpInfo));
- rpInfo.sType = VK_STRUCTURE_TYPE_RENDER_PASS_CREATE_INFO;
- rpInfo.attachmentCount = 1;
- rpInfo.pAttachments = rpD->attDescs.constData();
- rpInfo.subpassCount = 1;
- rpInfo.pSubpasses = &subpassDesc;
- rpInfo.dependencyCount = 1;
- rpInfo.pDependencies = &subpassDep;
-
- if (hasDepthStencil)
- rpInfo.attachmentCount += 1;
-
- if (samples > VK_SAMPLE_COUNT_1_BIT) {
- rpInfo.attachmentCount += 1;
- subpassDesc.pResolveAttachments = rpD->resolveRefs.constData();
- }
+ VkSubpassDescription subpassDesc;
+ fillRenderPassCreateInfo(&rpInfo, &subpassDesc, rpD);
VkResult err = df->vkCreateRenderPass(dev, &rpInfo, nullptr, &rpD->rp);
if (err != VK_SUCCESS) {
@@ -1123,34 +1435,193 @@ bool QRhiVulkan::createDefaultRenderPass(QVkRenderPassDescriptor *rpD, bool hasD
return false;
}
- rpD->hasDepthStencil = hasDepthStencil;
-
return true;
}
+struct MultiViewRenderPassSetupHelper
+{
+ bool prepare(VkRenderPassCreateInfo *rpInfo, int multiViewCount, bool multiViewCap)
+ {
+ if (multiViewCount < 2)
+ return true;
+ if (!multiViewCap) {
+ qWarning("Cannot create multiview render pass without support for the Vulkan 1.1 multiview feature");
+ return false;
+ }
+#ifdef VK_VERSION_1_1
+ uint32_t allViewsMask = 0;
+ for (uint32_t i = 0; i < uint32_t(multiViewCount); ++i)
+ allViewsMask |= (1 << i);
+ multiViewMask = allViewsMask;
+ multiViewCorrelationMask = allViewsMask;
+ multiViewInfo.sType = VK_STRUCTURE_TYPE_RENDER_PASS_MULTIVIEW_CREATE_INFO;
+ multiViewInfo.subpassCount = 1;
+ multiViewInfo.pViewMasks = &multiViewMask;
+ multiViewInfo.correlationMaskCount = 1;
+ multiViewInfo.pCorrelationMasks = &multiViewCorrelationMask;
+ rpInfo->pNext = &multiViewInfo;
+#endif
+ return true;
+ }
+
+#ifdef VK_VERSION_1_1
+ VkRenderPassMultiviewCreateInfo multiViewInfo = {};
+ uint32_t multiViewMask = 0;
+ uint32_t multiViewCorrelationMask = 0;
+#endif
+};
+
+#ifdef VK_KHR_create_renderpass2
+// Effectively converts a VkRenderPassCreateInfo into a VkRenderPassCreateInfo2,
+// adding depth-stencil resolve support. Assumes a single subpass and no subpass
+// dependencies.
+struct RenderPass2SetupHelper
+{
+ bool prepare(VkRenderPassCreateInfo2 *rpInfo2, const VkRenderPassCreateInfo *rpInfo, const QVkRenderPassDescriptor *rpD, int multiViewCount) {
+ *rpInfo2 = {};
+
+ viewMask = 0;
+ if (multiViewCount >= 2) {
+ for (uint32_t i = 0; i < uint32_t(multiViewCount); ++i)
+ viewMask |= (1 << i);
+ }
+
+ attDescs2.resize(rpInfo->attachmentCount);
+ for (qsizetype i = 0; i < attDescs2.count(); ++i) {
+ VkAttachmentDescription2KHR &att2(attDescs2[i]);
+ const VkAttachmentDescription &att(rpInfo->pAttachments[i]);
+ att2 = {};
+ att2.sType = VK_STRUCTURE_TYPE_ATTACHMENT_DESCRIPTION_2;
+ att2.flags = att.flags;
+ att2.format = att.format;
+ att2.samples = att.samples;
+ att2.loadOp = att.loadOp;
+ att2.storeOp = att.storeOp;
+ att2.stencilLoadOp = att.stencilLoadOp;
+ att2.stencilStoreOp = att.stencilStoreOp;
+ att2.initialLayout = att.initialLayout;
+ att2.finalLayout = att.finalLayout;
+ }
+
+ attRefs2.clear();
+ subpass2 = {};
+ subpass2.sType = VK_STRUCTURE_TYPE_SUBPASS_DESCRIPTION_2_KHR;
+ const VkSubpassDescription &subpassDesc(rpInfo->pSubpasses[0]);
+ subpass2.flags = subpassDesc.flags;
+ subpass2.pipelineBindPoint = subpassDesc.pipelineBindPoint;
+ if (multiViewCount >= 2)
+ subpass2.viewMask = viewMask;
+
+ // color attachment refs
+ qsizetype startIndex = attRefs2.count();
+ for (uint32_t j = 0; j < subpassDesc.colorAttachmentCount; ++j) {
+ attRefs2.append({});
+ VkAttachmentReference2KHR &attref2(attRefs2.last());
+ const VkAttachmentReference &attref(subpassDesc.pColorAttachments[j]);
+ attref2.sType = VK_STRUCTURE_TYPE_ATTACHMENT_REFERENCE_2_KHR;
+ attref2.attachment = attref.attachment;
+ attref2.layout = attref.layout;
+ attref2.aspectMask = VK_IMAGE_ASPECT_COLOR_BIT;
+ }
+ subpass2.colorAttachmentCount = subpassDesc.colorAttachmentCount;
+ subpass2.pColorAttachments = attRefs2.constData() + startIndex;
+
+ // color resolve refs
+ if (subpassDesc.pResolveAttachments) {
+ startIndex = attRefs2.count();
+ for (uint32_t j = 0; j < subpassDesc.colorAttachmentCount; ++j) {
+ attRefs2.append({});
+ VkAttachmentReference2KHR &attref2(attRefs2.last());
+ const VkAttachmentReference &attref(subpassDesc.pResolveAttachments[j]);
+ attref2.sType = VK_STRUCTURE_TYPE_ATTACHMENT_REFERENCE_2_KHR;
+ attref2.attachment = attref.attachment;
+ attref2.layout = attref.layout;
+ attref2.aspectMask = VK_IMAGE_ASPECT_COLOR_BIT;
+ }
+ subpass2.pResolveAttachments = attRefs2.constData() + startIndex;
+ }
+
+ // depth-stencil ref
+ if (subpassDesc.pDepthStencilAttachment) {
+ startIndex = attRefs2.count();
+ attRefs2.append({});
+ VkAttachmentReference2KHR &attref2(attRefs2.last());
+ const VkAttachmentReference &attref(*subpassDesc.pDepthStencilAttachment);
+ attref2.sType = VK_STRUCTURE_TYPE_ATTACHMENT_REFERENCE_2_KHR;
+ attref2.attachment = attref.attachment;
+ attref2.layout = attref.layout;
+ attref2.aspectMask = VK_IMAGE_ASPECT_DEPTH_BIT | VK_IMAGE_ASPECT_STENCIL_BIT;
+ subpass2.pDepthStencilAttachment = attRefs2.constData() + startIndex;
+ }
+
+ // depth-stencil resolve ref
+#ifdef VK_KHR_depth_stencil_resolve
+ dsResolveDesc = {};
+ if (rpD->hasDepthStencilResolve) {
+ startIndex = attRefs2.count();
+ attRefs2.append({});
+ VkAttachmentReference2KHR &attref2(attRefs2.last());
+ attref2.sType = VK_STRUCTURE_TYPE_ATTACHMENT_REFERENCE_2_KHR;
+ attref2.attachment = rpD->dsResolveRef.attachment;
+ attref2.layout = rpD->dsResolveRef.layout;
+ attref2.aspectMask = VK_IMAGE_ASPECT_DEPTH_BIT | VK_IMAGE_ASPECT_STENCIL_BIT;
+ dsResolveDesc.sType = VK_STRUCTURE_TYPE_SUBPASS_DESCRIPTION_DEPTH_STENCIL_RESOLVE_KHR;
+ dsResolveDesc.depthResolveMode = VK_RESOLVE_MODE_SAMPLE_ZERO_BIT;
+ dsResolveDesc.stencilResolveMode = VK_RESOLVE_MODE_SAMPLE_ZERO_BIT;
+ dsResolveDesc.pDepthStencilResolveAttachment = attRefs2.constData() + startIndex;
+ subpass2.pNext = &dsResolveDesc;
+ }
+#endif
+
+ rpInfo2->sType = VK_STRUCTURE_TYPE_RENDER_PASS_CREATE_INFO_2_KHR;
+ rpInfo2->pNext = nullptr; // the 1.1 VkRenderPassMultiviewCreateInfo is part of the '2' structs
+ rpInfo2->flags = rpInfo->flags;
+ rpInfo2->attachmentCount = rpInfo->attachmentCount;
+ rpInfo2->pAttachments = attDescs2.constData();
+ rpInfo2->subpassCount = 1;
+ rpInfo2->pSubpasses = &subpass2;
+ if (multiViewCount >= 2) {
+ rpInfo2->correlatedViewMaskCount = 1;
+ rpInfo2->pCorrelatedViewMasks = &viewMask;
+ }
+ return true;
+ }
+
+ QVarLengthArray<VkAttachmentDescription2KHR, 8> attDescs2;
+ QVarLengthArray<VkAttachmentReference2KHR, 8> attRefs2;
+ VkSubpassDescription2KHR subpass2;
+#ifdef VK_KHR_depth_stencil_resolve
+ VkSubpassDescriptionDepthStencilResolveKHR dsResolveDesc;
+#endif
+ uint32_t viewMask;
+};
+#endif // VK_KHR_create_renderpass2
+
bool QRhiVulkan::createOffscreenRenderPass(QVkRenderPassDescriptor *rpD,
- const QRhiColorAttachment *firstColorAttachment,
- const QRhiColorAttachment *lastColorAttachment,
+ const QRhiColorAttachment *colorAttachmentsBegin,
+ const QRhiColorAttachment *colorAttachmentsEnd,
bool preserveColor,
bool preserveDs,
+ bool storeDs,
QRhiRenderBuffer *depthStencilBuffer,
- QRhiTexture *depthTexture)
+ QRhiTexture *depthTexture,
+ QRhiTexture *depthResolveTexture)
{
- // attachment list layout is color (0-8), ds (0-1), resolve (0-8)
+ // attachment list layout is color (0-8), ds (0-1), resolve (0-8), ds resolve (0-1)
- for (auto it = firstColorAttachment; it != lastColorAttachment; ++it) {
+ int multiViewCount = 0;
+ for (auto it = colorAttachmentsBegin; it != colorAttachmentsEnd; ++it) {
QVkTexture *texD = QRHI_RES(QVkTexture, it->texture());
QVkRenderBuffer *rbD = QRHI_RES(QVkRenderBuffer, it->renderBuffer());
Q_ASSERT(texD || rbD);
- const VkFormat vkformat = texD ? texD->vkformat : rbD->vkformat;
+ const VkFormat vkformat = texD ? texD->viewFormat : rbD->vkformat;
const VkSampleCountFlagBits samples = texD ? texD->samples : rbD->samples;
- VkAttachmentDescription attDesc;
- memset(&attDesc, 0, sizeof(attDesc));
+ VkAttachmentDescription attDesc = {};
attDesc.format = vkformat;
attDesc.samples = samples;
attDesc.loadOp = preserveColor ? VK_ATTACHMENT_LOAD_OP_LOAD : VK_ATTACHMENT_LOAD_OP_CLEAR;
- attDesc.storeOp = it->resolveTexture() ? VK_ATTACHMENT_STORE_OP_DONT_CARE : VK_ATTACHMENT_STORE_OP_STORE;
+ attDesc.storeOp = (it->resolveTexture() && !preserveColor) ? VK_ATTACHMENT_STORE_OP_DONT_CARE : VK_ATTACHMENT_STORE_OP_STORE;
attDesc.stencilLoadOp = VK_ATTACHMENT_LOAD_OP_DONT_CARE;
attDesc.stencilStoreOp = VK_ATTACHMENT_STORE_OP_DONT_CARE;
// this has to interact correctly with activateTextureRenderTarget(), hence leaving in COLOR_ATT
@@ -1158,41 +1629,66 @@ bool QRhiVulkan::createOffscreenRenderPass(QVkRenderPassDescriptor *rpD,
attDesc.finalLayout = VK_IMAGE_LAYOUT_COLOR_ATTACHMENT_OPTIMAL;
rpD->attDescs.append(attDesc);
- const VkAttachmentReference ref = { uint32_t(rpD->attDescs.count() - 1), VK_IMAGE_LAYOUT_COLOR_ATTACHMENT_OPTIMAL };
+ const VkAttachmentReference ref = { uint32_t(rpD->attDescs.size() - 1), VK_IMAGE_LAYOUT_COLOR_ATTACHMENT_OPTIMAL };
rpD->colorRefs.append(ref);
+
+ if (it->multiViewCount() >= 2) {
+ if (multiViewCount > 0 && multiViewCount != it->multiViewCount())
+ qWarning("Inconsistent multiViewCount in color attachment set");
+ else
+ multiViewCount = it->multiViewCount();
+ } else if (multiViewCount > 0) {
+ qWarning("Mixing non-multiview color attachments within a multiview render pass");
+ }
}
+ Q_ASSERT(multiViewCount == 0 || multiViewCount >= 2);
+ rpD->multiViewCount = uint32_t(multiViewCount);
rpD->hasDepthStencil = depthStencilBuffer || depthTexture;
if (rpD->hasDepthStencil) {
- const VkFormat dsFormat = depthTexture ? QRHI_RES(QVkTexture, depthTexture)->vkformat
+ const VkFormat dsFormat = depthTexture ? QRHI_RES(QVkTexture, depthTexture)->viewFormat
: QRHI_RES(QVkRenderBuffer, depthStencilBuffer)->vkformat;
const VkSampleCountFlagBits samples = depthTexture ? QRHI_RES(QVkTexture, depthTexture)->samples
: QRHI_RES(QVkRenderBuffer, depthStencilBuffer)->samples;
const VkAttachmentLoadOp loadOp = preserveDs ? VK_ATTACHMENT_LOAD_OP_LOAD : VK_ATTACHMENT_LOAD_OP_CLEAR;
- const VkAttachmentStoreOp storeOp = depthTexture ? VK_ATTACHMENT_STORE_OP_STORE : VK_ATTACHMENT_STORE_OP_DONT_CARE;
- VkAttachmentDescription attDesc;
- memset(&attDesc, 0, sizeof(attDesc));
+ const VkAttachmentStoreOp storeOp = storeDs ? VK_ATTACHMENT_STORE_OP_STORE : VK_ATTACHMENT_STORE_OP_DONT_CARE;
+ VkAttachmentDescription attDesc = {};
attDesc.format = dsFormat;
attDesc.samples = samples;
attDesc.loadOp = loadOp;
attDesc.storeOp = storeOp;
attDesc.stencilLoadOp = loadOp;
attDesc.stencilStoreOp = storeOp;
- attDesc.initialLayout = VK_IMAGE_LAYOUT_UNDEFINED;
+ attDesc.initialLayout = preserveDs ? VK_IMAGE_LAYOUT_DEPTH_STENCIL_ATTACHMENT_OPTIMAL : VK_IMAGE_LAYOUT_UNDEFINED;
attDesc.finalLayout = VK_IMAGE_LAYOUT_DEPTH_STENCIL_ATTACHMENT_OPTIMAL;
rpD->attDescs.append(attDesc);
+ if (depthTexture && depthTexture->arraySize() >= 2 && colorAttachmentsBegin == colorAttachmentsEnd) {
+ multiViewCount = depthTexture->arraySize();
+ rpD->multiViewCount = multiViewCount;
+ }
}
- rpD->dsRef = { uint32_t(rpD->attDescs.count() - 1), VK_IMAGE_LAYOUT_DEPTH_STENCIL_ATTACHMENT_OPTIMAL };
+ rpD->dsRef = { uint32_t(rpD->attDescs.size() - 1), VK_IMAGE_LAYOUT_DEPTH_STENCIL_ATTACHMENT_OPTIMAL };
- for (auto it = firstColorAttachment; it != lastColorAttachment; ++it) {
+ for (auto it = colorAttachmentsBegin; it != colorAttachmentsEnd; ++it) {
if (it->resolveTexture()) {
QVkTexture *rtexD = QRHI_RES(QVkTexture, it->resolveTexture());
+ const VkFormat dstFormat = rtexD->vkformat;
if (rtexD->samples > VK_SAMPLE_COUNT_1_BIT)
qWarning("Resolving into a multisample texture is not supported");
- VkAttachmentDescription attDesc;
- memset(&attDesc, 0, sizeof(attDesc));
- attDesc.format = rtexD->vkformat;
+ QVkTexture *texD = QRHI_RES(QVkTexture, it->texture());
+ QVkRenderBuffer *rbD = QRHI_RES(QVkRenderBuffer, it->renderBuffer());
+ const VkFormat srcFormat = texD ? texD->vkformat : rbD->vkformat;
+ if (srcFormat != dstFormat) {
+ // This is a validation error. But some implementations survive,
+ // actually. Warn about it however, because it's an error with
+ // some other backends (like D3D) as well.
+ qWarning("Multisample resolve between different formats (%d and %d) is not supported.",
+ int(srcFormat), int(dstFormat));
+ }
+
+ VkAttachmentDescription attDesc = {};
+ attDesc.format = rtexD->viewFormat;
attDesc.samples = VK_SAMPLE_COUNT_1_BIT;
attDesc.loadOp = VK_ATTACHMENT_LOAD_OP_DONT_CARE; // ignored
attDesc.storeOp = VK_ATTACHMENT_STORE_OP_STORE;
@@ -1202,38 +1698,78 @@ bool QRhiVulkan::createOffscreenRenderPass(QVkRenderPassDescriptor *rpD,
attDesc.finalLayout = VK_IMAGE_LAYOUT_COLOR_ATTACHMENT_OPTIMAL;
rpD->attDescs.append(attDesc);
- const VkAttachmentReference ref = { uint32_t(rpD->attDescs.count() - 1), VK_IMAGE_LAYOUT_COLOR_ATTACHMENT_OPTIMAL };
+ const VkAttachmentReference ref = { uint32_t(rpD->attDescs.size() - 1), VK_IMAGE_LAYOUT_COLOR_ATTACHMENT_OPTIMAL };
rpD->resolveRefs.append(ref);
} else {
const VkAttachmentReference ref = { VK_ATTACHMENT_UNUSED, VK_IMAGE_LAYOUT_COLOR_ATTACHMENT_OPTIMAL };
rpD->resolveRefs.append(ref);
}
}
+ Q_ASSERT(rpD->colorRefs.size() == rpD->resolveRefs.size());
- VkSubpassDescription subpassDesc;
- memset(&subpassDesc, 0, sizeof(subpassDesc));
- subpassDesc.pipelineBindPoint = VK_PIPELINE_BIND_POINT_GRAPHICS;
- subpassDesc.colorAttachmentCount = uint32_t(rpD->colorRefs.count());
- Q_ASSERT(rpD->colorRefs.count() == rpD->resolveRefs.count());
- subpassDesc.pColorAttachments = !rpD->colorRefs.isEmpty() ? rpD->colorRefs.constData() : nullptr;
- subpassDesc.pDepthStencilAttachment = rpD->hasDepthStencil ? &rpD->dsRef : nullptr;
- subpassDesc.pResolveAttachments = !rpD->resolveRefs.isEmpty() ? rpD->resolveRefs.constData() : nullptr;
+ rpD->hasDepthStencilResolve = rpD->hasDepthStencil && depthResolveTexture;
+ if (rpD->hasDepthStencilResolve) {
+ QVkTexture *rtexD = QRHI_RES(QVkTexture, depthResolveTexture);
+ if (rtexD->samples > VK_SAMPLE_COUNT_1_BIT)
+ qWarning("Resolving into a multisample depth texture is not supported");
+
+ QVkTexture *texD = QRHI_RES(QVkTexture, depthResolveTexture);
+ if (texD->vkformat != rtexD->vkformat) {
+ qWarning("Multisample resolve between different depth-stencil formats (%d and %d) is not supported.",
+ int(texD->vkformat), int(rtexD->vkformat));
+ }
+
+ VkAttachmentDescription attDesc = {};
+ attDesc.format = rtexD->viewFormat;
+ attDesc.samples = VK_SAMPLE_COUNT_1_BIT;
+ attDesc.loadOp = VK_ATTACHMENT_LOAD_OP_DONT_CARE; // ignored
+ attDesc.storeOp = VK_ATTACHMENT_STORE_OP_STORE;
+ attDesc.stencilLoadOp = attDesc.loadOp;
+ attDesc.stencilStoreOp = attDesc.storeOp;
+ attDesc.initialLayout = VK_IMAGE_LAYOUT_UNDEFINED;
+ attDesc.finalLayout = VK_IMAGE_LAYOUT_DEPTH_STENCIL_ATTACHMENT_OPTIMAL;
+ rpD->attDescs.append(attDesc);
+ }
+ rpD->dsResolveRef = { uint32_t(rpD->attDescs.size() - 1), VK_IMAGE_LAYOUT_DEPTH_STENCIL_ATTACHMENT_OPTIMAL };
+
+ // rpD->subpassDeps stays empty: don't yet know the correct initial/final
+ // access and stage stuff for the implicit deps at this point, so leave it
+ // to the resource tracking and activateTextureRenderTarget() to generate
+ // barriers.
VkRenderPassCreateInfo rpInfo;
- memset(&rpInfo, 0, sizeof(rpInfo));
- rpInfo.sType = VK_STRUCTURE_TYPE_RENDER_PASS_CREATE_INFO;
- rpInfo.attachmentCount = uint32_t(rpD->attDescs.count());
- rpInfo.pAttachments = rpD->attDescs.constData();
- rpInfo.subpassCount = 1;
- rpInfo.pSubpasses = &subpassDesc;
- // don't yet know the correct initial/final access and stage stuff for the
- // implicit deps at this point, so leave it to the resource tracking to
- // generate barriers
+ VkSubpassDescription subpassDesc;
+ fillRenderPassCreateInfo(&rpInfo, &subpassDesc, rpD);
- VkResult err = df->vkCreateRenderPass(dev, &rpInfo, nullptr, &rpD->rp);
- if (err != VK_SUCCESS) {
- qWarning("Failed to create renderpass: %d", err);
+ MultiViewRenderPassSetupHelper multiViewHelper;
+ if (!multiViewHelper.prepare(&rpInfo, multiViewCount, caps.multiView))
return false;
+
+#ifdef VK_KHR_create_renderpass2
+ if (rpD->hasDepthStencilResolve && caps.renderPass2KHR) {
+ // Use the KHR extension, not the 1.2 core API, in order to support Vulkan 1.1.
+ VkRenderPassCreateInfo2KHR rpInfo2;
+ RenderPass2SetupHelper rp2Helper;
+ if (!rp2Helper.prepare(&rpInfo2, &rpInfo, rpD, multiViewCount))
+ return false;
+
+ VkResult err = vkCreateRenderPass2KHR(dev, &rpInfo2, nullptr, &rpD->rp);
+ if (err != VK_SUCCESS) {
+ qWarning("Failed to create renderpass (using VkRenderPassCreateInfo2KHR): %d", err);
+ return false;
+ }
+ } else
+#endif
+ {
+ if (rpD->hasDepthStencilResolve) {
+ qWarning("Resolving multisample depth-stencil buffers is not supported without "
+ "VK_KHR_depth_stencil_resolve and VK_KHR_create_renderpass2");
+ }
+ VkResult err = df->vkCreateRenderPass(dev, &rpInfo, nullptr, &rpD->rp);
+ if (err != VK_SUCCESS) {
+ qWarning("Failed to create renderpass: %d", err);
+ return false;
+ }
}
return true;
@@ -1264,36 +1800,55 @@ bool QRhiVulkan::recreateSwapChain(QRhiSwapChain *swapChain)
VkSurfaceCapabilitiesKHR surfaceCaps;
vkGetPhysicalDeviceSurfaceCapabilitiesKHR(physDev, swapChainD->surface, &surfaceCaps);
quint32 reqBufferCount;
- if (swapChainD->m_flags.testFlag(QRhiSwapChain::MinimalBufferCount)) {
+ if (swapChainD->m_flags.testFlag(QRhiSwapChain::MinimalBufferCount) || surfaceCaps.maxImageCount == 0) {
reqBufferCount = qMax<quint32>(2, surfaceCaps.minImageCount);
} else {
- const quint32 maxBuffers = QVkSwapChain::MAX_BUFFER_COUNT;
- if (surfaceCaps.maxImageCount)
- reqBufferCount = qMax(qMin(surfaceCaps.maxImageCount, maxBuffers), surfaceCaps.minImageCount);
- else
- reqBufferCount = qMax<quint32>(2, surfaceCaps.minImageCount);
+ reqBufferCount = qMax(qMin<quint32>(surfaceCaps.maxImageCount, 3), surfaceCaps.minImageCount);
}
-
VkSurfaceTransformFlagBitsKHR preTransform =
(surfaceCaps.supportedTransforms & VK_SURFACE_TRANSFORM_IDENTITY_BIT_KHR)
? VK_SURFACE_TRANSFORM_IDENTITY_BIT_KHR
: surfaceCaps.currentTransform;
+ // This looks odd but matches how platforms work in practice.
+ //
+ // On Windows with NVIDIA for example, the only supportedCompositeAlpha
+ // value reported is OPAQUE, nothing else. Yet transparency works
+ // regardless, as long as the native window is set up correctly, so that's
+ // not something we need to handle here.
+ //
+ // On Linux with Intel and Mesa and running on xcb reports, on one
+ // particular system, INHERIT+PRE_MULTIPLIED. Tranparency works, regardless,
+ // presumably due to setting INHERIT.
+ //
+ // On the same setup with Wayland instead of xcb we see
+ // OPAQUE+PRE_MULTIPLIED reported. Here transparency won't work unless
+ // PRE_MULTIPLIED is set.
+ //
+ // Therefore our rules are:
+ // - Prefer INHERIT over OPAQUE.
+ // - Then based on the request, try the requested alpha mode, but if
+ // that's not reported as supported, try also the other (PRE/POST,
+ // POST/PRE) as that is better than nothing. This is not different from
+ // some other backends, e.g. D3D11 with DirectComposition there is also
+ // no control over being straight or pre-multiplied. Whereas with
+ // WGL/GLX/EGL we never had that sort of control.
+
VkCompositeAlphaFlagBitsKHR compositeAlpha =
(surfaceCaps.supportedCompositeAlpha & VK_COMPOSITE_ALPHA_INHERIT_BIT_KHR)
? VK_COMPOSITE_ALPHA_INHERIT_BIT_KHR
: VK_COMPOSITE_ALPHA_OPAQUE_BIT_KHR;
- if (swapChainD->m_flags.testFlag(QRhiSwapChain::SurfaceHasPreMulAlpha)
- && (surfaceCaps.supportedCompositeAlpha & VK_COMPOSITE_ALPHA_PRE_MULTIPLIED_BIT_KHR))
- {
- compositeAlpha = VK_COMPOSITE_ALPHA_PRE_MULTIPLIED_BIT_KHR;
- }
-
- if (swapChainD->m_flags.testFlag(QRhiSwapChain::SurfaceHasNonPreMulAlpha)
- && (surfaceCaps.supportedCompositeAlpha & VK_COMPOSITE_ALPHA_POST_MULTIPLIED_BIT_KHR))
- {
- compositeAlpha = VK_COMPOSITE_ALPHA_POST_MULTIPLIED_BIT_KHR;
+ if (swapChainD->m_flags.testFlag(QRhiSwapChain::SurfaceHasPreMulAlpha)) {
+ if (surfaceCaps.supportedCompositeAlpha & VK_COMPOSITE_ALPHA_PRE_MULTIPLIED_BIT_KHR)
+ compositeAlpha = VK_COMPOSITE_ALPHA_PRE_MULTIPLIED_BIT_KHR;
+ else if (surfaceCaps.supportedCompositeAlpha & VK_COMPOSITE_ALPHA_POST_MULTIPLIED_BIT_KHR)
+ compositeAlpha = VK_COMPOSITE_ALPHA_POST_MULTIPLIED_BIT_KHR;
+ } else if (swapChainD->m_flags.testFlag(QRhiSwapChain::SurfaceHasNonPreMulAlpha)) {
+ if (surfaceCaps.supportedCompositeAlpha & VK_COMPOSITE_ALPHA_POST_MULTIPLIED_BIT_KHR)
+ compositeAlpha = VK_COMPOSITE_ALPHA_POST_MULTIPLIED_BIT_KHR;
+ else if (surfaceCaps.supportedCompositeAlpha & VK_COMPOSITE_ALPHA_PRE_MULTIPLIED_BIT_KHR)
+ compositeAlpha = VK_COMPOSITE_ALPHA_PRE_MULTIPLIED_BIT_KHR;
}
VkImageUsageFlags usage = VK_IMAGE_USAGE_COLOR_ATTACHMENT_BIT;
@@ -1301,9 +1856,16 @@ bool QRhiVulkan::recreateSwapChain(QRhiSwapChain *swapChain)
if (swapChainD->supportsReadback && swapChainD->m_flags.testFlag(QRhiSwapChain::UsedAsTransferSource))
usage |= VK_IMAGE_USAGE_TRANSFER_SRC_BIT;
+ const bool stereo = bool(swapChainD->m_window) && (swapChainD->m_window->format().stereo())
+ && surfaceCaps.maxImageArrayLayers > 1;
+ swapChainD->stereo = stereo;
+
VkPresentModeKHR presentMode = VK_PRESENT_MODE_FIFO_KHR;
if (swapChainD->m_flags.testFlag(QRhiSwapChain::NoVSync)) {
- if (swapChainD->supportedPresentationModes.contains(VK_PRESENT_MODE_MAILBOX_KHR))
+ // Stereo has a weird bug, when using VK_PRESENT_MODE_MAILBOX_KHR,
+ // black screen is shown, but there is no validation error.
+ // Detected on Windows, with NVidia RTX A series (at least 4000 and 6000) driver 535.98
+ if (swapChainD->supportedPresentationModes.contains(VK_PRESENT_MODE_MAILBOX_KHR) && !stereo)
presentMode = VK_PRESENT_MODE_MAILBOX_KHR;
else if (swapChainD->supportedPresentationModes.contains(VK_PRESENT_MODE_IMMEDIATE_KHR))
presentMode = VK_PRESENT_MODE_IMMEDIATE_KHR;
@@ -1320,15 +1882,14 @@ bool QRhiVulkan::recreateSwapChain(QRhiSwapChain *swapChain)
reuseExisting ? "recycled" : "new",
reqBufferCount, swapChainD->pixelSize.width(), swapChainD->pixelSize.height(), presentMode);
- VkSwapchainCreateInfoKHR swapChainInfo;
- memset(&swapChainInfo, 0, sizeof(swapChainInfo));
+ VkSwapchainCreateInfoKHR swapChainInfo = {};
swapChainInfo.sType = VK_STRUCTURE_TYPE_SWAPCHAIN_CREATE_INFO_KHR;
swapChainInfo.surface = swapChainD->surface;
swapChainInfo.minImageCount = reqBufferCount;
swapChainInfo.imageFormat = swapChainD->colorFormat;
swapChainInfo.imageColorSpace = swapChainD->colorSpace;
swapChainInfo.imageExtent = VkExtent2D { uint32_t(swapChainD->pixelSize.width()), uint32_t(swapChainD->pixelSize.height()) };
- swapChainInfo.imageArrayLayers = 1;
+ swapChainInfo.imageArrayLayers = stereo ? 2u : 1u;
swapChainInfo.imageUsage = usage;
swapChainInfo.imageSharingMode = VK_SHARING_MODE_EXCLUSIVE;
swapChainInfo.preTransform = preTransform;
@@ -1352,28 +1913,24 @@ bool QRhiVulkan::recreateSwapChain(QRhiSwapChain *swapChain)
quint32 actualSwapChainBufferCount = 0;
err = vkGetSwapchainImagesKHR(dev, swapChainD->sc, &actualSwapChainBufferCount, nullptr);
- if (err != VK_SUCCESS || actualSwapChainBufferCount < 2) {
- qWarning("Failed to get swapchain images: %d (count=%u)", err, actualSwapChainBufferCount);
+ if (err != VK_SUCCESS || actualSwapChainBufferCount == 0) {
+ qWarning("Failed to get swapchain images: %d", err);
return false;
}
- if (actualSwapChainBufferCount > QVkSwapChain::MAX_BUFFER_COUNT) {
- qWarning("Too many swapchain buffers (%u)", actualSwapChainBufferCount);
- return false;
- }
if (actualSwapChainBufferCount != reqBufferCount)
qCDebug(QRHI_LOG_INFO, "Actual swapchain buffer count is %u", actualSwapChainBufferCount);
swapChainD->bufferCount = int(actualSwapChainBufferCount);
- VkImage swapChainImages[QVkSwapChain::MAX_BUFFER_COUNT];
- err = vkGetSwapchainImagesKHR(dev, swapChainD->sc, &actualSwapChainBufferCount, swapChainImages);
+ QVarLengthArray<VkImage, QVkSwapChain::EXPECTED_MAX_BUFFER_COUNT> swapChainImages(actualSwapChainBufferCount);
+ err = vkGetSwapchainImagesKHR(dev, swapChainD->sc, &actualSwapChainBufferCount, swapChainImages.data());
if (err != VK_SUCCESS) {
qWarning("Failed to get swapchain images: %d", err);
return false;
}
- VkImage msaaImages[QVkSwapChain::MAX_BUFFER_COUNT];
- VkImageView msaaViews[QVkSwapChain::MAX_BUFFER_COUNT];
+ QVarLengthArray<VkImage, QVkSwapChain::EXPECTED_MAX_BUFFER_COUNT> msaaImages(swapChainD->bufferCount);
+ QVarLengthArray<VkImageView, QVkSwapChain::EXPECTED_MAX_BUFFER_COUNT> msaaViews(swapChainD->bufferCount);
if (swapChainD->samples > VK_SAMPLE_COUNT_1_BIT) {
if (!createTransientImage(swapChainD->colorFormat,
swapChainD->pixelSize,
@@ -1381,8 +1938,8 @@ bool QRhiVulkan::recreateSwapChain(QRhiSwapChain *swapChain)
VK_IMAGE_ASPECT_COLOR_BIT,
swapChainD->samples,
&swapChainD->msaaImageMem,
- msaaImages,
- msaaViews,
+ msaaImages.data(),
+ msaaViews.data(),
swapChainD->bufferCount))
{
qWarning("Failed to create transient image for MSAA color buffer");
@@ -1390,11 +1947,13 @@ bool QRhiVulkan::recreateSwapChain(QRhiSwapChain *swapChain)
}
}
- VkFenceCreateInfo fenceInfo;
- memset(&fenceInfo, 0, sizeof(fenceInfo));
+ VkFenceCreateInfo fenceInfo = {};
fenceInfo.sType = VK_STRUCTURE_TYPE_FENCE_CREATE_INFO;
fenceInfo.flags = VK_FENCE_CREATE_SIGNALED_BIT;
+ // Double up for stereo
+ swapChainD->imageRes.resize(swapChainD->bufferCount * (stereo ? 2u : 1u));
+
for (int i = 0; i < swapChainD->bufferCount; ++i) {
QVkSwapChain::ImageResources &image(swapChainD->imageRes[i]);
image.image = swapChainImages[i];
@@ -1403,8 +1962,7 @@ bool QRhiVulkan::recreateSwapChain(QRhiSwapChain *swapChain)
image.msaaImageView = msaaViews[i];
}
- VkImageViewCreateInfo imgViewInfo;
- memset(&imgViewInfo, 0, sizeof(imgViewInfo));
+ VkImageViewCreateInfo imgViewInfo = {};
imgViewInfo.sType = VK_STRUCTURE_TYPE_IMAGE_VIEW_CREATE_INFO;
imgViewInfo.image = swapChainImages[i];
imgViewInfo.viewType = VK_IMAGE_VIEW_TYPE_2D;
@@ -1423,11 +1981,40 @@ bool QRhiVulkan::recreateSwapChain(QRhiSwapChain *swapChain)
image.lastUse = QVkSwapChain::ImageResources::ScImageUseNone;
}
+ if (stereo) {
+ for (int i = 0; i < swapChainD->bufferCount; ++i) {
+ QVkSwapChain::ImageResources &image(swapChainD->imageRes[i + swapChainD->bufferCount]);
+ image.image = swapChainImages[i];
+ if (swapChainD->samples > VK_SAMPLE_COUNT_1_BIT) {
+ image.msaaImage = msaaImages[i];
+ image.msaaImageView = msaaViews[i];
+ }
+
+ VkImageViewCreateInfo imgViewInfo = {};
+ imgViewInfo.sType = VK_STRUCTURE_TYPE_IMAGE_VIEW_CREATE_INFO;
+ imgViewInfo.image = swapChainImages[i];
+ imgViewInfo.viewType = VK_IMAGE_VIEW_TYPE_2D;
+ imgViewInfo.format = swapChainD->colorFormat;
+ imgViewInfo.components.r = VK_COMPONENT_SWIZZLE_R;
+ imgViewInfo.components.g = VK_COMPONENT_SWIZZLE_G;
+ imgViewInfo.components.b = VK_COMPONENT_SWIZZLE_B;
+ imgViewInfo.components.a = VK_COMPONENT_SWIZZLE_A;
+ imgViewInfo.subresourceRange.aspectMask = VK_IMAGE_ASPECT_COLOR_BIT;
+ imgViewInfo.subresourceRange.baseArrayLayer = 1;
+ imgViewInfo.subresourceRange.levelCount = imgViewInfo.subresourceRange.layerCount = 1;
+ err = df->vkCreateImageView(dev, &imgViewInfo, nullptr, &image.imageView);
+ if (err != VK_SUCCESS) {
+ qWarning("Failed to create swapchain image view %d: %d", i, err);
+ return false;
+ }
+
+ image.lastUse = QVkSwapChain::ImageResources::ScImageUseNone;
+ }
+ }
swapChainD->currentImageIndex = 0;
- VkSemaphoreCreateInfo semInfo;
- memset(&semInfo, 0, sizeof(semInfo));
+ VkSemaphoreCreateInfo semInfo = {};
semInfo.sType = VK_STRUCTURE_TYPE_SEMAPHORE_CREATE_INFO;
for (int i = 0; i < QVK_FRAMES_IN_FLIGHT; ++i) {
@@ -1489,13 +2076,9 @@ void QRhiVulkan::releaseSwapChainResources(QRhiSwapChain *swapChain)
df->vkDestroySemaphore(dev, frame.drawSem, nullptr);
frame.drawSem = VK_NULL_HANDLE;
}
- if (frame.cmdBuf) {
- df->vkFreeCommandBuffers(dev, cmdPool, 1, &frame.cmdBuf);
- frame.cmdBuf = VK_NULL_HANDLE;
- }
}
- for (int i = 0; i < swapChainD->bufferCount; ++i) {
+ for (int i = 0; i < swapChainD->bufferCount * (swapChainD->stereo ? 2 : 1); ++i) {
QVkSwapChain::ImageResources &image(swapChainD->imageRes[i]);
if (image.fb) {
df->vkDestroyFramebuffer(dev, image.fb, nullptr);
@@ -1526,11 +2109,45 @@ void QRhiVulkan::releaseSwapChainResources(QRhiSwapChain *swapChain)
// NB! surface and similar must remain intact
}
-QRhi::FrameOpResult QRhiVulkan::beginFrame(QRhiSwapChain *swapChain, QRhi::BeginFrameFlags flags)
+void QRhiVulkan::ensureCommandPoolForNewFrame()
+{
+ VkCommandPoolResetFlags flags = 0;
+
+ // While not clear what "recycles all of the resources from the command
+ // pool back to the system" really means in practice, set it when there was
+ // a call to releaseCachedResources() recently.
+ if (releaseCachedResourcesCalledBeforeFrameStart)
+ flags |= VK_COMMAND_POOL_RESET_RELEASE_RESOURCES_BIT;
+
+ // put all command buffers allocated from this slot's pool to initial state
+ df->vkResetCommandPool(dev, cmdPool[currentFrameSlot], flags);
+}
+
+double QRhiVulkan::elapsedSecondsFromTimestamp(quint64 timestamp[2], bool *ok)
+{
+ quint64 mask = 0;
+ for (quint64 i = 0; i < timestampValidBits; i += 8)
+ mask |= 0xFFULL << i;
+ const quint64 ts0 = timestamp[0] & mask;
+ const quint64 ts1 = timestamp[1] & mask;
+ const float nsecsPerTick = physDevProperties.limits.timestampPeriod;
+ if (!qFuzzyIsNull(nsecsPerTick)) {
+ const float elapsedMs = float(ts1 - ts0) * nsecsPerTick / 1000000.0f;
+ const double elapsedSec = elapsedMs / 1000.0;
+ *ok = true;
+ return elapsedSec;
+ }
+ *ok = false;
+ return 0;
+}
+
+QRhi::FrameOpResult QRhiVulkan::beginFrame(QRhiSwapChain *swapChain, QRhi::BeginFrameFlags)
{
QVkSwapChain *swapChainD = QRHI_RES(QVkSwapChain, swapChain);
- QVkSwapChain::FrameResources &frame(swapChainD->frameRes[swapChainD->currentFrameSlot]);
- QRhiProfilerPrivate *rhiP = profilerPrivateOrNull();
+ const int frameResIndex = swapChainD->bufferCount > 1 ? swapChainD->currentFrameSlot : 0;
+ QVkSwapChain::FrameResources &frame(swapChainD->frameRes[frameResIndex]);
+
+ inst->handle()->beginFrame(swapChainD->window);
if (!frame.imageAcquired) {
// Wait if we are too far ahead, i.e. the thread gets throttled based on the presentation rate
@@ -1542,10 +2159,11 @@ QRhi::FrameOpResult QRhiVulkan::beginFrame(QRhiSwapChain *swapChain, QRhi::Begin
}
// move on to next swapchain image
+ uint32_t imageIndex = 0;
VkResult err = vkAcquireNextImageKHR(dev, swapChainD->sc, UINT64_MAX,
- frame.imageSem, frame.imageFence, &frame.imageIndex);
+ frame.imageSem, frame.imageFence, &imageIndex);
if (err == VK_SUCCESS || err == VK_SUBOPTIMAL_KHR) {
- swapChainD->currentImageIndex = frame.imageIndex;
+ swapChainD->currentImageIndex = imageIndex;
frame.imageSemWaitable = true;
frame.imageAcquired = true;
frame.imageFenceWaitable = true;
@@ -1572,9 +2190,35 @@ QRhi::FrameOpResult QRhiVulkan::beginFrame(QRhiSwapChain *swapChain, QRhi::Begin
// will make B wait for A's frame 0 commands, so if a resource is written
// in B's frame or when B checks for pending resource releases, that won't
// mess up A's in-flight commands (as they are not in flight anymore).
- waitCommandCompletion(int(swapChainD->currentFrameSlot));
+ waitCommandCompletion(frameResIndex);
+
+ currentFrameSlot = int(swapChainD->currentFrameSlot);
+ currentSwapChain = swapChainD;
+ if (swapChainD->ds)
+ swapChainD->ds->lastActiveFrameSlot = currentFrameSlot;
+
+ // reset the command pool
+ ensureCommandPoolForNewFrame();
+
+ // start recording to this frame's command buffer
+ QRhi::FrameOpResult cbres = startPrimaryCommandBuffer(&frame.cmdBuf);
+ if (cbres != QRhi::FrameOpSuccess)
+ return cbres;
- // Now is the time to read the timestamps for the previous frame for this slot.
+ swapChainD->cbWrapper.cb = frame.cmdBuf;
+
+ QVkSwapChain::ImageResources &image(swapChainD->imageRes[swapChainD->currentImageIndex]);
+ swapChainD->rtWrapper.d.fb = image.fb;
+
+ if (swapChainD->stereo) {
+ QVkSwapChain::ImageResources &image(
+ swapChainD->imageRes[swapChainD->currentImageIndex + swapChainD->bufferCount]);
+ swapChainD->rtWrapperRight.d.fb = image.fb;
+ }
+
+ prepareNewFrame(&swapChainD->cbWrapper);
+
+ // Read the timestamps for the previous frame for this slot.
if (frame.timestampQueryIndex >= 0) {
quint64 timestamp[2] = { 0, 0 };
VkResult err = df->vkGetQueryPoolResults(dev, timestampQueryPool, uint32_t(frame.timestampQueryIndex), 2,
@@ -1583,61 +2227,33 @@ QRhi::FrameOpResult QRhiVulkan::beginFrame(QRhiSwapChain *swapChain, QRhi::Begin
timestampQueryPoolMap.clearBit(frame.timestampQueryIndex / 2);
frame.timestampQueryIndex = -1;
if (err == VK_SUCCESS) {
- quint64 mask = 0;
- for (quint64 i = 0; i < timestampValidBits; i += 8)
- mask |= 0xFFULL << i;
- const quint64 ts0 = timestamp[0] & mask;
- const quint64 ts1 = timestamp[1] & mask;
- const float nsecsPerTick = physDevProperties.limits.timestampPeriod;
- if (!qFuzzyIsNull(nsecsPerTick)) {
- const float elapsedMs = float(ts1 - ts0) * nsecsPerTick / 1000000.0f;
- // now we have the gpu time for the previous frame for this slot, report it
- // (does not matter that it is not for this frame)
- QRHI_PROF_F(swapChainFrameGpuTime(swapChain, elapsedMs));
- }
+ bool ok = false;
+ const double elapsedSec = elapsedSecondsFromTimestamp(timestamp, &ok);
+ if (ok)
+ swapChainD->cbWrapper.lastGpuTime = elapsedSec;
} else {
qWarning("Failed to query timestamp: %d", err);
}
}
- // build new draw command buffer
- QRhi::FrameOpResult cbres = startPrimaryCommandBuffer(&frame.cmdBuf);
- if (cbres != QRhi::FrameOpSuccess)
- return cbres;
-
- // when profiling is enabled, pick a free query (pair) from the pool
- int timestampQueryIdx = -1;
- if (profilerPrivateOrNull()) {
- for (int i = 0; i < timestampQueryPoolMap.count(); ++i) {
+ // No timestamps if the client did not opt in, or when not having at least 2 frames in flight.
+ if (rhiFlags.testFlag(QRhi::EnableTimestamps) && swapChainD->bufferCount > 1) {
+ int timestampQueryIdx = -1;
+ for (int i = 0; i < timestampQueryPoolMap.size(); ++i) {
if (!timestampQueryPoolMap.testBit(i)) {
timestampQueryPoolMap.setBit(i);
timestampQueryIdx = i * 2;
break;
}
}
+ if (timestampQueryIdx >= 0) {
+ df->vkCmdResetQueryPool(frame.cmdBuf, timestampQueryPool, uint32_t(timestampQueryIdx), 2);
+ // record timestamp at the start of the command buffer
+ df->vkCmdWriteTimestamp(frame.cmdBuf, VK_PIPELINE_STAGE_TOP_OF_PIPE_BIT,
+ timestampQueryPool, uint32_t(timestampQueryIdx));
+ frame.timestampQueryIndex = timestampQueryIdx;
+ }
}
- if (timestampQueryIdx >= 0) {
- df->vkCmdResetQueryPool(frame.cmdBuf, timestampQueryPool, uint32_t(timestampQueryIdx), 2);
- // record timestamp at the start of the command buffer
- df->vkCmdWriteTimestamp(frame.cmdBuf, VK_PIPELINE_STAGE_TOP_OF_PIPE_BIT,
- timestampQueryPool, uint32_t(timestampQueryIdx));
- frame.timestampQueryIndex = timestampQueryIdx;
- }
-
- swapChainD->cbWrapper.cb = frame.cmdBuf;
- swapChainD->cbWrapper.useSecondaryCb = flags.testFlag(QRhi::ExternalContentsInPass);
-
- QVkSwapChain::ImageResources &image(swapChainD->imageRes[swapChainD->currentImageIndex]);
- swapChainD->rtWrapper.d.fb = image.fb;
-
- currentFrameSlot = int(swapChainD->currentFrameSlot);
- currentSwapChain = swapChainD;
- if (swapChainD->ds)
- swapChainD->ds->lastActiveFrameSlot = currentFrameSlot;
-
- QRHI_PROF_F(beginSwapChainFrame(swapChain));
-
- prepareNewFrame(&swapChainD->cbWrapper);
return QRhi::FrameOpSuccess;
}
@@ -1647,14 +2263,18 @@ QRhi::FrameOpResult QRhiVulkan::endFrame(QRhiSwapChain *swapChain, QRhi::EndFram
QVkSwapChain *swapChainD = QRHI_RES(QVkSwapChain, swapChain);
Q_ASSERT(currentSwapChain == swapChainD);
+ auto cleanup = qScopeGuard([this, swapChainD] {
+ inst->handle()->endFrame(swapChainD->window);
+ });
+
recordPrimaryCommandBuffer(&swapChainD->cbWrapper);
- QVkSwapChain::FrameResources &frame(swapChainD->frameRes[swapChainD->currentFrameSlot]);
+ int frameResIndex = swapChainD->bufferCount > 1 ? swapChainD->currentFrameSlot : 0;
+ QVkSwapChain::FrameResources &frame(swapChainD->frameRes[frameResIndex]);
QVkSwapChain::ImageResources &image(swapChainD->imageRes[swapChainD->currentImageIndex]);
if (image.lastUse != QVkSwapChain::ImageResources::ScImageUseRender) {
- VkImageMemoryBarrier presTrans;
- memset(&presTrans, 0, sizeof(presTrans));
+ VkImageMemoryBarrier presTrans = {};
presTrans.sType = VK_STRUCTURE_TYPE_IMAGE_MEMORY_BARRIER;
presTrans.dstAccessMask = VK_ACCESS_COLOR_ATTACHMENT_WRITE_BIT;
presTrans.newLayout = VK_IMAGE_LAYOUT_PRESENT_SRC_KHR;
@@ -1701,14 +2321,9 @@ QRhi::FrameOpResult QRhiVulkan::endFrame(QRhiSwapChain *swapChain, QRhi::EndFram
frame.imageSemWaitable = false;
frame.cmdFenceWaitable = true;
- QRhiProfilerPrivate *rhiP = profilerPrivateOrNull();
- // this must be done before the Present
- QRHI_PROF_F(endSwapChainFrame(swapChain, swapChainD->frameCount + 1));
-
if (needsPresent) {
// add the Present to the queue
- VkPresentInfoKHR presInfo;
- memset(&presInfo, 0, sizeof(presInfo));
+ VkPresentInfoKHR presInfo = {};
presInfo.sType = VK_STRUCTURE_TYPE_PRESENT_INFO_KHR;
presInfo.swapchainCount = 1;
presInfo.pSwapchains = &swapChainD->sc;
@@ -1761,46 +2376,43 @@ void QRhiVulkan::prepareNewFrame(QRhiCommandBuffer *cb)
//
// With multiple swapchains on the same QRhi things get more convoluted
// (and currentFrameSlot strictly alternating is not true anymore) but
- // beginNonWrapperFrame() solves that by blocking as necessary so the rest
- // here is safe regardless.
+ // begin(Offscreen)Frame() blocks anyway waiting for its current frame
+ // slot's previous commands to complete so this here is safe regardless.
executeDeferredReleases();
QRHI_RES(QVkCommandBuffer, cb)->resetState();
finishActiveReadbacks(); // last, in case the readback-completed callback issues rhi calls
+
+ releaseCachedResourcesCalledBeforeFrameStart = false;
}
QRhi::FrameOpResult QRhiVulkan::startPrimaryCommandBuffer(VkCommandBuffer *cb)
{
- if (*cb) {
- df->vkFreeCommandBuffers(dev, cmdPool, 1, cb);
- *cb = VK_NULL_HANDLE;
- }
-
- VkCommandBufferAllocateInfo cmdBufInfo;
- memset(&cmdBufInfo, 0, sizeof(cmdBufInfo));
- cmdBufInfo.sType = VK_STRUCTURE_TYPE_COMMAND_BUFFER_ALLOCATE_INFO;
- cmdBufInfo.commandPool = cmdPool;
- cmdBufInfo.level = VK_COMMAND_BUFFER_LEVEL_PRIMARY;
- cmdBufInfo.commandBufferCount = 1;
+ if (!*cb) {
+ VkCommandBufferAllocateInfo cmdBufInfo = {};
+ cmdBufInfo.sType = VK_STRUCTURE_TYPE_COMMAND_BUFFER_ALLOCATE_INFO;
+ cmdBufInfo.commandPool = cmdPool[currentFrameSlot];
+ cmdBufInfo.level = VK_COMMAND_BUFFER_LEVEL_PRIMARY;
+ cmdBufInfo.commandBufferCount = 1;
- VkResult err = df->vkAllocateCommandBuffers(dev, &cmdBufInfo, cb);
- if (err != VK_SUCCESS) {
- if (err == VK_ERROR_DEVICE_LOST) {
- qWarning("Device loss detected in vkAllocateCommandBuffers()");
- deviceLost = true;
- return QRhi::FrameOpDeviceLost;
+ VkResult err = df->vkAllocateCommandBuffers(dev, &cmdBufInfo, cb);
+ if (err != VK_SUCCESS) {
+ if (err == VK_ERROR_DEVICE_LOST) {
+ qWarning("Device loss detected in vkAllocateCommandBuffers()");
+ deviceLost = true;
+ return QRhi::FrameOpDeviceLost;
+ }
+ qWarning("Failed to allocate frame command buffer: %d", err);
+ return QRhi::FrameOpError;
}
- qWarning("Failed to allocate frame command buffer: %d", err);
- return QRhi::FrameOpError;
}
- VkCommandBufferBeginInfo cmdBufBeginInfo;
- memset(&cmdBufBeginInfo, 0, sizeof(cmdBufBeginInfo));
+ VkCommandBufferBeginInfo cmdBufBeginInfo = {};
cmdBufBeginInfo.sType = VK_STRUCTURE_TYPE_COMMAND_BUFFER_BEGIN_INFO;
- err = df->vkBeginCommandBuffer(*cb, &cmdBufBeginInfo);
+ VkResult err = df->vkBeginCommandBuffer(*cb, &cmdBufBeginInfo);
if (err != VK_SUCCESS) {
if (err == VK_ERROR_DEVICE_LOST) {
qWarning("Device loss detected in vkBeginCommandBuffer()");
@@ -1828,8 +2440,7 @@ QRhi::FrameOpResult QRhiVulkan::endAndSubmitPrimaryCommandBuffer(VkCommandBuffer
return QRhi::FrameOpError;
}
- VkSubmitInfo submitInfo;
- memset(&submitInfo, 0, sizeof(submitInfo));
+ VkSubmitInfo submitInfo = {};
submitInfo.sType = VK_STRUCTURE_TYPE_SUBMIT_INFO;
submitInfo.commandBufferCount = 1;
submitInfo.pCommandBuffers = &cb;
@@ -1860,8 +2471,9 @@ QRhi::FrameOpResult QRhiVulkan::endAndSubmitPrimaryCommandBuffer(VkCommandBuffer
void QRhiVulkan::waitCommandCompletion(int frameSlot)
{
- for (QVkSwapChain *sc : qAsConst(swapchains)) {
- QVkSwapChain::FrameResources &frame(sc->frameRes[frameSlot]);
+ for (QVkSwapChain *sc : std::as_const(swapchains)) {
+ const int frameResIndex = sc->bufferCount > 1 ? frameSlot : 0;
+ QVkSwapChain::FrameResources &frame(sc->frameRes[frameResIndex]);
if (frame.cmdFenceWaitable) {
df->vkWaitForFences(dev, 1, &frame.cmdFence, VK_TRUE, UINT64_MAX);
df->vkResetFences(dev, 1, &frame.cmdFence);
@@ -1870,31 +2482,50 @@ void QRhiVulkan::waitCommandCompletion(int frameSlot)
}
}
-QRhi::FrameOpResult QRhiVulkan::beginOffscreenFrame(QRhiCommandBuffer **cb, QRhi::BeginFrameFlags flags)
+QRhi::FrameOpResult QRhiVulkan::beginOffscreenFrame(QRhiCommandBuffer **cb, QRhi::BeginFrameFlags)
{
- QRhi::FrameOpResult cbres = startPrimaryCommandBuffer(&ofr.cbWrapper.cb);
- if (cbres != QRhi::FrameOpSuccess)
- return cbres;
-
// Switch to the next slot manually. Swapchains do not know about this
- // which is good. So for example a - unusual but possible - onscreen,
- // onscreen, offscreen, onscreen, onscreen, onscreen sequence of
- // begin/endFrame leads to 0, 1, 0, 0, 1, 0. This works because the
- // offscreen frame is synchronous in the sense that we wait for execution
- // to complete in endFrame, and so no resources used in that frame are busy
+ // which is good. So for example an onscreen, onscreen, offscreen,
+ // onscreen, onscreen, onscreen sequence of frames leads to 0, 1, 0, 0, 1,
+ // 0. (no strict alternation anymore) But this is not different from what
+ // happens when multiple swapchains are involved. Offscreen frames are
+ // synchronous anyway in the sense that they wait for execution to complete
+ // in endOffscreenFrame, so no resources used in that frame are busy
// anymore in the next frame.
+
currentFrameSlot = (currentFrameSlot + 1) % QVK_FRAMES_IN_FLIGHT;
- // except that this gets complicated with multiple swapchains so make sure
- // any pending commands have finished for the frame slot we are going to use
- if (swapchains.count() > 1)
- waitCommandCompletion(currentFrameSlot);
- ofr.cbWrapper.useSecondaryCb = flags.testFlag(QRhi::ExternalContentsInPass);
+ waitCommandCompletion(currentFrameSlot);
+
+ ensureCommandPoolForNewFrame();
- prepareNewFrame(&ofr.cbWrapper);
+ QVkCommandBuffer *cbWrapper = ofr.cbWrapper[currentFrameSlot];
+ QRhi::FrameOpResult cbres = startPrimaryCommandBuffer(&cbWrapper->cb);
+ if (cbres != QRhi::FrameOpSuccess)
+ return cbres;
+
+ prepareNewFrame(cbWrapper);
ofr.active = true;
- *cb = &ofr.cbWrapper;
+ if (rhiFlags.testFlag(QRhi::EnableTimestamps)) {
+ int timestampQueryIdx = -1;
+ for (int i = 0; i < timestampQueryPoolMap.size(); ++i) {
+ if (!timestampQueryPoolMap.testBit(i)) {
+ timestampQueryPoolMap.setBit(i);
+ timestampQueryIdx = i * 2;
+ break;
+ }
+ }
+ if (timestampQueryIdx >= 0) {
+ df->vkCmdResetQueryPool(cbWrapper->cb, timestampQueryPool, uint32_t(timestampQueryIdx), 2);
+ // record timestamp at the start of the command buffer
+ df->vkCmdWriteTimestamp(cbWrapper->cb, VK_PIPELINE_STAGE_TOP_OF_PIPE_BIT,
+ timestampQueryPool, uint32_t(timestampQueryIdx));
+ ofr.timestampQueryIndex = timestampQueryIdx;
+ }
+ }
+
+ *cb = cbWrapper;
return QRhi::FrameOpSuccess;
}
@@ -1904,11 +2535,17 @@ QRhi::FrameOpResult QRhiVulkan::endOffscreenFrame(QRhi::EndFrameFlags flags)
Q_ASSERT(ofr.active);
ofr.active = false;
- recordPrimaryCommandBuffer(&ofr.cbWrapper);
+ QVkCommandBuffer *cbWrapper(ofr.cbWrapper[currentFrameSlot]);
+ recordPrimaryCommandBuffer(cbWrapper);
+
+ // record another timestamp, when enabled
+ if (ofr.timestampQueryIndex >= 0) {
+ df->vkCmdWriteTimestamp(cbWrapper->cb, VK_PIPELINE_STAGE_BOTTOM_OF_PIPE_BIT,
+ timestampQueryPool, uint32_t(ofr.timestampQueryIndex + 1));
+ }
if (!ofr.cmdFence) {
- VkFenceCreateInfo fenceInfo;
- memset(&fenceInfo, 0, sizeof(fenceInfo));
+ VkFenceCreateInfo fenceInfo = {};
fenceInfo.sType = VK_STRUCTURE_TYPE_FENCE_CREATE_INFO;
VkResult err = df->vkCreateFence(dev, &fenceInfo, nullptr, &ofr.cmdFence);
if (err != VK_SUCCESS) {
@@ -1917,7 +2554,7 @@ QRhi::FrameOpResult QRhiVulkan::endOffscreenFrame(QRhi::EndFrameFlags flags)
}
}
- QRhi::FrameOpResult submitres = endAndSubmitPrimaryCommandBuffer(ofr.cbWrapper.cb, ofr.cmdFence, nullptr, nullptr);
+ QRhi::FrameOpResult submitres = endAndSubmitPrimaryCommandBuffer(cbWrapper->cb, ofr.cmdFence, nullptr, nullptr);
if (submitres != QRhi::FrameOpSuccess)
return submitres;
@@ -1929,6 +2566,24 @@ QRhi::FrameOpResult QRhiVulkan::endOffscreenFrame(QRhi::EndFrameFlags flags)
// previous) frame is safe since we waited for completion above.
finishActiveReadbacks(true);
+ // Read the timestamps, if we wrote them.
+ if (ofr.timestampQueryIndex >= 0) {
+ quint64 timestamp[2] = { 0, 0 };
+ VkResult err = df->vkGetQueryPoolResults(dev, timestampQueryPool, uint32_t(ofr.timestampQueryIndex), 2,
+ 2 * sizeof(quint64), timestamp, sizeof(quint64),
+ VK_QUERY_RESULT_64_BIT | VK_QUERY_RESULT_WAIT_BIT);
+ timestampQueryPoolMap.clearBit(ofr.timestampQueryIndex / 2);
+ ofr.timestampQueryIndex = -1;
+ if (err == VK_SUCCESS) {
+ bool ok = false;
+ const double elapsedSec = elapsedSecondsFromTimestamp(timestamp, &ok);
+ if (ok)
+ cbWrapper->lastGpuTime = elapsedSec;
+ } else {
+ qWarning("Failed to query timestamp: %d", err);
+ }
+ }
+
return QRhi::FrameOpSuccess;
}
@@ -1941,10 +2596,11 @@ QRhi::FrameOpResult QRhiVulkan::finish()
VkCommandBuffer cb;
if (ofr.active) {
Q_ASSERT(!currentSwapChain);
- Q_ASSERT(ofr.cbWrapper.recordingPass == QVkCommandBuffer::NoPass);
- recordPrimaryCommandBuffer(&ofr.cbWrapper);
- ofr.cbWrapper.resetCommands();
- cb = ofr.cbWrapper.cb;
+ QVkCommandBuffer *cbWrapper(ofr.cbWrapper[currentFrameSlot]);
+ Q_ASSERT(cbWrapper->recordingPass == QVkCommandBuffer::NoPass);
+ recordPrimaryCommandBuffer(cbWrapper);
+ cbWrapper->resetCommands();
+ cb = cbWrapper->cb;
} else {
Q_ASSERT(currentSwapChain);
Q_ASSERT(currentSwapChain->cbWrapper.recordingPass == QVkCommandBuffer::NoPass);
@@ -1961,11 +2617,16 @@ QRhi::FrameOpResult QRhiVulkan::finish()
df->vkQueueWaitIdle(gfxQueue);
if (inFrame) {
+ // The current frame slot's command pool needs to be reset.
+ ensureCommandPoolForNewFrame();
// Allocate and begin recording on a new command buffer.
- if (ofr.active)
- startPrimaryCommandBuffer(&ofr.cbWrapper.cb);
- else
- startPrimaryCommandBuffer(&swapChainD->frameRes[swapChainD->currentFrameSlot].cmdBuf);
+ if (ofr.active) {
+ startPrimaryCommandBuffer(&ofr.cbWrapper[currentFrameSlot]->cb);
+ } else {
+ QVkSwapChain::FrameResources &frame(swapChainD->frameRes[swapChainD->currentFrameSlot]);
+ startPrimaryCommandBuffer(&frame.cmdBuf);
+ swapChainD->cbWrapper.cb = frame.cmdBuf;
+ }
}
executeDeferredReleases(true);
@@ -1994,6 +2655,9 @@ static inline QRhiPassResourceTracker::UsageState toPassTrackerUsageState(const
void QRhiVulkan::activateTextureRenderTarget(QVkCommandBuffer *cbD, QVkTextureRenderTarget *rtD)
{
+ if (!QRhiRenderTargetAttachmentTracker::isUpToDate<QVkTexture, QVkRenderBuffer>(rtD->description(), rtD->d.currentResIdList))
+ rtD->create();
+
rtD->lastActiveFrameSlot = currentFrameSlot;
rtD->d.rp->lastActiveFrameSlot = currentFrameSlot;
QRhiPassResourceTracker &passResTracker(cbD->passResTrackers[cbD->currentPassResTrackerIndex]);
@@ -2019,8 +2683,17 @@ void QRhiVulkan::activateTextureRenderTarget(QVkCommandBuffer *cbD, QVkTextureRe
resolveTexD->lastActiveFrameSlot = currentFrameSlot;
}
}
- if (rtD->m_desc.depthStencilBuffer())
- QRHI_RES(QVkRenderBuffer, rtD->m_desc.depthStencilBuffer())->lastActiveFrameSlot = currentFrameSlot;
+ if (rtD->m_desc.depthStencilBuffer()) {
+ QVkRenderBuffer *rbD = QRHI_RES(QVkRenderBuffer, rtD->m_desc.depthStencilBuffer());
+ Q_ASSERT(rbD->m_type == QRhiRenderBuffer::DepthStencil);
+ // We specify no explicit VkSubpassDependency for an offscreen render
+ // target, meaning we need an explicit barrier for the depth-stencil
+ // buffer to avoid a write-after-write hazard (as the implicit one is
+ // not sufficient). Textures are taken care of by the resource tracking
+ // but that excludes the (content-wise) throwaway depth-stencil buffer.
+ depthStencilExplicitBarrier(cbD, rbD);
+ rbD->lastActiveFrameSlot = currentFrameSlot;
+ }
if (rtD->m_desc.depthTexture()) {
QVkTexture *depthTexD = QRHI_RES(QVkTexture, rtD->m_desc.depthTexture());
trackedRegisterTexture(&passResTracker, depthTexD,
@@ -2028,6 +2701,13 @@ void QRhiVulkan::activateTextureRenderTarget(QVkCommandBuffer *cbD, QVkTextureRe
QRhiPassResourceTracker::TexDepthOutputStage);
depthTexD->lastActiveFrameSlot = currentFrameSlot;
}
+ if (rtD->m_desc.depthResolveTexture()) {
+ QVkTexture *depthResolveTexD = QRHI_RES(QVkTexture, rtD->m_desc.depthResolveTexture());
+ trackedRegisterTexture(&passResTracker, depthResolveTexD,
+ QRhiPassResourceTracker::TexDepthOutput,
+ QRhiPassResourceTracker::TexDepthOutputStage);
+ depthResolveTexD->lastActiveFrameSlot = currentFrameSlot;
+ }
}
void QRhiVulkan::resourceUpdate(QRhiCommandBuffer *cb, QRhiResourceUpdateBatch *resourceUpdates)
@@ -2042,24 +2722,27 @@ VkCommandBuffer QRhiVulkan::startSecondaryCommandBuffer(QVkRenderTargetData *rtD
{
VkCommandBuffer secondaryCb;
- VkCommandBufferAllocateInfo cmdBufInfo;
- memset(&cmdBufInfo, 0, sizeof(cmdBufInfo));
- cmdBufInfo.sType = VK_STRUCTURE_TYPE_COMMAND_BUFFER_ALLOCATE_INFO;
- cmdBufInfo.commandPool = cmdPool;
- cmdBufInfo.level = VK_COMMAND_BUFFER_LEVEL_SECONDARY;
- cmdBufInfo.commandBufferCount = 1;
- VkResult err = df->vkAllocateCommandBuffers(dev, &cmdBufInfo, &secondaryCb);
- if (err != VK_SUCCESS) {
- qWarning("Failed to create secondary command buffer: %d", err);
- return VK_NULL_HANDLE;
+ if (!freeSecondaryCbs[currentFrameSlot].isEmpty()) {
+ secondaryCb = freeSecondaryCbs[currentFrameSlot].last();
+ freeSecondaryCbs[currentFrameSlot].removeLast();
+ } else {
+ VkCommandBufferAllocateInfo cmdBufInfo = {};
+ cmdBufInfo.sType = VK_STRUCTURE_TYPE_COMMAND_BUFFER_ALLOCATE_INFO;
+ cmdBufInfo.commandPool = cmdPool[currentFrameSlot];
+ cmdBufInfo.level = VK_COMMAND_BUFFER_LEVEL_SECONDARY;
+ cmdBufInfo.commandBufferCount = 1;
+
+ VkResult err = df->vkAllocateCommandBuffers(dev, &cmdBufInfo, &secondaryCb);
+ if (err != VK_SUCCESS) {
+ qWarning("Failed to create secondary command buffer: %d", err);
+ return VK_NULL_HANDLE;
+ }
}
- VkCommandBufferBeginInfo cmdBufBeginInfo;
- memset(&cmdBufBeginInfo, 0, sizeof(cmdBufBeginInfo));
+ VkCommandBufferBeginInfo cmdBufBeginInfo = {};
cmdBufBeginInfo.sType = VK_STRUCTURE_TYPE_COMMAND_BUFFER_BEGIN_INFO;
cmdBufBeginInfo.flags = rtD ? VK_COMMAND_BUFFER_USAGE_RENDER_PASS_CONTINUE_BIT : 0;
- VkCommandBufferInheritanceInfo cmdBufInheritInfo;
- memset(&cmdBufInheritInfo, 0, sizeof(cmdBufInheritInfo));
+ VkCommandBufferInheritanceInfo cmdBufInheritInfo = {};
cmdBufInheritInfo.sType = VK_STRUCTURE_TYPE_COMMAND_BUFFER_INHERITANCE_INFO;
cmdBufInheritInfo.subpass = 0;
if (rtD) {
@@ -2068,10 +2751,9 @@ VkCommandBuffer QRhiVulkan::startSecondaryCommandBuffer(QVkRenderTargetData *rtD
}
cmdBufBeginInfo.pInheritanceInfo = &cmdBufInheritInfo;
- err = df->vkBeginCommandBuffer(secondaryCb, &cmdBufBeginInfo);
+ VkResult err = df->vkBeginCommandBuffer(secondaryCb, &cmdBufBeginInfo);
if (err != VK_SUCCESS) {
qWarning("Failed to begin secondary command buffer: %d", err);
- df->vkFreeCommandBuffers(dev, cmdPool, 1, &secondaryCb);
return VK_NULL_HANDLE;
}
@@ -2084,20 +2766,14 @@ void QRhiVulkan::endAndEnqueueSecondaryCommandBuffer(VkCommandBuffer cb, QVkComm
if (err != VK_SUCCESS)
qWarning("Failed to end secondary command buffer: %d", err);
- QVkCommandBuffer::Command cmd;
+ QVkCommandBuffer::Command &cmd(cbD->commands.get());
cmd.cmd = QVkCommandBuffer::Command::ExecuteSecondary;
cmd.args.executeSecondary.cb = cb;
- cbD->commands.append(cmd);
- deferredReleaseSecondaryCommandBuffer(cb);
-}
-
-void QRhiVulkan::deferredReleaseSecondaryCommandBuffer(VkCommandBuffer cb)
-{
QRhiVulkan::DeferredReleaseEntry e;
- e.type = QRhiVulkan::DeferredReleaseEntry::CommandBuffer;
+ e.type = QRhiVulkan::DeferredReleaseEntry::SecondaryCommandBuffer;
e.lastActiveFrameSlot = currentFrameSlot;
- e.commandBuffer.cb = cb;
+ e.secondaryCommandBuffer.cb = cb;
releaseQueue.append(e);
}
@@ -2105,7 +2781,8 @@ void QRhiVulkan::beginPass(QRhiCommandBuffer *cb,
QRhiRenderTarget *rt,
const QColor &colorClearValue,
const QRhiDepthStencilClearValue &depthStencilClearValue,
- QRhiResourceUpdateBatch *resourceUpdates)
+ QRhiResourceUpdateBatch *resourceUpdates,
+ QRhiCommandBuffer::BeginPassFlags flags)
{
QVkCommandBuffer *cbD = QRHI_RES(QVkCommandBuffer, cb);
Q_ASSERT(cbD->recordingPass == QVkCommandBuffer::NoPass);
@@ -2121,8 +2798,8 @@ void QRhiVulkan::beginPass(QRhiCommandBuffer *cb,
QVkRenderTargetData *rtD = nullptr;
switch (rt->resourceType()) {
- case QRhiResource::RenderTarget:
- rtD = &QRHI_RES(QVkReferenceRenderTarget, rt)->d;
+ case QRhiResource::SwapChainRenderTarget:
+ rtD = &QRHI_RES(QVkSwapChainRenderTarget, rt)->d;
rtD->rp->lastActiveFrameSlot = currentFrameSlot;
Q_ASSERT(currentSwapChain);
currentSwapChain->imageRes[currentSwapChain->currentImageIndex].lastUse =
@@ -2141,13 +2818,13 @@ void QRhiVulkan::beginPass(QRhiCommandBuffer *cb,
}
cbD->recordingPass = QVkCommandBuffer::RenderPass;
+ cbD->passUsesSecondaryCb = flags.testFlag(QRhiCommandBuffer::ExternalContent);
cbD->currentTarget = rt;
// No copy operations or image layout transitions allowed after this point
// (up until endPass) as we are going to begin the renderpass.
- VkRenderPassBeginInfo rpBeginInfo;
- memset(&rpBeginInfo, 0, sizeof(rpBeginInfo));
+ VkRenderPassBeginInfo rpBeginInfo = {};
rpBeginInfo.sType = VK_STRUCTURE_TYPE_RENDER_PASS_BEGIN_INFO;
rpBeginInfo.renderPass = rtD->rp->rp;
rpBeginInfo.framebuffer = rtD->fb;
@@ -2172,17 +2849,24 @@ void QRhiVulkan::beginPass(QRhiCommandBuffer *cb,
float(colorClearValue.alphaF()) } };
cvs.append(cv);
}
- rpBeginInfo.clearValueCount = uint32_t(cvs.count());
+ for (int i = 0; i < rtD->dsResolveAttCount; ++i) {
+ VkClearValue cv;
+ cv.depthStencil = { depthStencilClearValue.depthClearValue(), depthStencilClearValue.stencilClearValue() };
+ cvs.append(cv);
+ }
+ rpBeginInfo.clearValueCount = uint32_t(cvs.size());
- QVkCommandBuffer::Command cmd;
+ QVkCommandBuffer::Command &cmd(cbD->commands.get());
cmd.cmd = QVkCommandBuffer::Command::BeginRenderPass;
cmd.args.beginRenderPass.desc = rpBeginInfo;
- cmd.args.beginRenderPass.clearValueIndex = cbD->pools.clearValue.count();
- cbD->pools.clearValue.append(cvs.constData(), cvs.count());
- cbD->commands.append(cmd);
+ cmd.args.beginRenderPass.clearValueIndex = cbD->pools.clearValue.size();
+ cmd.args.beginRenderPass.useSecondaryCb = cbD->passUsesSecondaryCb;
+ cbD->pools.clearValue.append(cvs.constData(), cvs.size());
+
+ if (cbD->passUsesSecondaryCb)
+ cbD->activeSecondaryCbStack.append(startSecondaryCommandBuffer(rtD));
- if (cbD->useSecondaryCb)
- cbD->secondaryCbs.append(startSecondaryCommandBuffer(rtD));
+ cbD->resetCachedState();
}
void QRhiVulkan::endPass(QRhiCommandBuffer *cb, QRhiResourceUpdateBatch *resourceUpdates)
@@ -2190,16 +2874,14 @@ void QRhiVulkan::endPass(QRhiCommandBuffer *cb, QRhiResourceUpdateBatch *resourc
QVkCommandBuffer *cbD = QRHI_RES(QVkCommandBuffer, cb);
Q_ASSERT(cbD->recordingPass == QVkCommandBuffer::RenderPass);
- if (cbD->useSecondaryCb) {
- VkCommandBuffer secondaryCb = cbD->secondaryCbs.last();
- cbD->secondaryCbs.removeLast();
+ if (cbD->passUsesSecondaryCb) {
+ VkCommandBuffer secondaryCb = cbD->activeSecondaryCbStack.last();
+ cbD->activeSecondaryCbStack.removeLast();
endAndEnqueueSecondaryCommandBuffer(secondaryCb, cbD);
- cbD->resetCachedState();
}
- QVkCommandBuffer::Command cmd;
+ QVkCommandBuffer::Command &cmd(cbD->commands.get());
cmd.cmd = QVkCommandBuffer::Command::EndRenderPass;
- cbD->commands.append(cmd);
cbD->recordingPass = QVkCommandBuffer::NoPass;
cbD->currentTarget = nullptr;
@@ -2208,7 +2890,9 @@ void QRhiVulkan::endPass(QRhiCommandBuffer *cb, QRhiResourceUpdateBatch *resourc
enqueueResourceUpdates(cbD, resourceUpdates);
}
-void QRhiVulkan::beginComputePass(QRhiCommandBuffer *cb, QRhiResourceUpdateBatch *resourceUpdates)
+void QRhiVulkan::beginComputePass(QRhiCommandBuffer *cb,
+ QRhiResourceUpdateBatch *resourceUpdates,
+ QRhiCommandBuffer::BeginPassFlags flags)
{
QVkCommandBuffer *cbD = QRHI_RES(QVkCommandBuffer, cb);
Q_ASSERT(cbD->recordingPass == QVkCommandBuffer::NoPass);
@@ -2219,9 +2903,14 @@ void QRhiVulkan::beginComputePass(QRhiCommandBuffer *cb, QRhiResourceUpdateBatch
enqueueTransitionPassResources(cbD);
cbD->recordingPass = QVkCommandBuffer::ComputePass;
+ cbD->passUsesSecondaryCb = flags.testFlag(QRhiCommandBuffer::ExternalContent);
+
+ cbD->computePassState.reset();
+
+ if (cbD->passUsesSecondaryCb)
+ cbD->activeSecondaryCbStack.append(startSecondaryCommandBuffer());
- if (cbD->useSecondaryCb)
- cbD->secondaryCbs.append(startSecondaryCommandBuffer());
+ cbD->resetCachedState();
}
void QRhiVulkan::endComputePass(QRhiCommandBuffer *cb, QRhiResourceUpdateBatch *resourceUpdates)
@@ -2229,11 +2918,10 @@ void QRhiVulkan::endComputePass(QRhiCommandBuffer *cb, QRhiResourceUpdateBatch *
QVkCommandBuffer *cbD = QRHI_RES(QVkCommandBuffer, cb);
Q_ASSERT(cbD->recordingPass == QVkCommandBuffer::ComputePass);
- if (cbD->useSecondaryCb) {
- VkCommandBuffer secondaryCb = cbD->secondaryCbs.last();
- cbD->secondaryCbs.removeLast();
+ if (cbD->passUsesSecondaryCb) {
+ VkCommandBuffer secondaryCb = cbD->activeSecondaryCbStack.last();
+ cbD->activeSecondaryCbStack.removeLast();
endAndEnqueueSecondaryCommandBuffer(secondaryCb, cbD);
- cbD->resetCachedState();
}
cbD->recordingPass = QVkCommandBuffer::NoPass;
@@ -2250,14 +2938,13 @@ void QRhiVulkan::setComputePipeline(QRhiCommandBuffer *cb, QRhiComputePipeline *
Q_ASSERT(cbD->recordingPass == QVkCommandBuffer::ComputePass);
if (cbD->currentComputePipeline != ps || cbD->currentPipelineGeneration != psD->generation) {
- if (cbD->useSecondaryCb) {
- df->vkCmdBindPipeline(cbD->secondaryCbs.last(), VK_PIPELINE_BIND_POINT_COMPUTE, psD->pipeline);
+ if (cbD->passUsesSecondaryCb) {
+ df->vkCmdBindPipeline(cbD->activeSecondaryCbStack.last(), VK_PIPELINE_BIND_POINT_COMPUTE, psD->pipeline);
} else {
- QVkCommandBuffer::Command cmd;
+ QVkCommandBuffer::Command &cmd(cbD->commands.get());
cmd.cmd = QVkCommandBuffer::Command::BindPipeline;
cmd.args.bindPipeline.bindPoint = VK_PIPELINE_BIND_POINT_COMPUTE;
cmd.args.bindPipeline.pipeline = psD->pipeline;
- cbD->commands.append(cmd);
}
cbD->currentGraphicsPipeline = nullptr;
@@ -2268,27 +2955,160 @@ void QRhiVulkan::setComputePipeline(QRhiCommandBuffer *cb, QRhiComputePipeline *
psD->lastActiveFrameSlot = currentFrameSlot;
}
+template<typename T>
+inline void qrhivk_accumulateComputeResource(T *writtenResources, QRhiResource *resource,
+ QRhiShaderResourceBinding::Type bindingType,
+ int loadTypeVal, int storeTypeVal, int loadStoreTypeVal)
+{
+ VkAccessFlags access = 0;
+ if (bindingType == loadTypeVal) {
+ access = VK_ACCESS_SHADER_READ_BIT;
+ } else {
+ access = VK_ACCESS_SHADER_WRITE_BIT;
+ if (bindingType == loadStoreTypeVal)
+ access |= VK_ACCESS_SHADER_READ_BIT;
+ }
+ auto it = writtenResources->find(resource);
+ if (it != writtenResources->end())
+ it->first |= access;
+ else if (bindingType == storeTypeVal || bindingType == loadStoreTypeVal)
+ writtenResources->insert(resource, { access, true });
+}
+
void QRhiVulkan::dispatch(QRhiCommandBuffer *cb, int x, int y, int z)
{
QVkCommandBuffer *cbD = QRHI_RES(QVkCommandBuffer, cb);
Q_ASSERT(cbD->recordingPass == QVkCommandBuffer::ComputePass);
- if (cbD->useSecondaryCb) {
- df->vkCmdDispatch(cbD->secondaryCbs.last(), uint32_t(x), uint32_t(y), uint32_t(z));
+ // When there are multiple dispatches, read-after-write and
+ // write-after-write need a barrier.
+ QVarLengthArray<VkImageMemoryBarrier, 8> imageBarriers;
+ QVarLengthArray<VkBufferMemoryBarrier, 8> bufferBarriers;
+ if (cbD->currentComputeSrb) {
+ // The key in the writtenResources map indicates that the resource was
+ // written in a previous dispatch, whereas the value accumulates the
+ // access mask in the current one.
+ for (auto &accessAndIsNewFlag : cbD->computePassState.writtenResources)
+ accessAndIsNewFlag = { 0, false };
+
+ QVkShaderResourceBindings *srbD = QRHI_RES(QVkShaderResourceBindings, cbD->currentComputeSrb);
+ const int bindingCount = srbD->m_bindings.size();
+ for (int i = 0; i < bindingCount; ++i) {
+ const QRhiShaderResourceBinding::Data *b = shaderResourceBindingData(srbD->m_bindings.at(i));
+ switch (b->type) {
+ case QRhiShaderResourceBinding::ImageLoad:
+ case QRhiShaderResourceBinding::ImageStore:
+ case QRhiShaderResourceBinding::ImageLoadStore:
+ qrhivk_accumulateComputeResource(&cbD->computePassState.writtenResources,
+ b->u.simage.tex,
+ b->type,
+ QRhiShaderResourceBinding::ImageLoad,
+ QRhiShaderResourceBinding::ImageStore,
+ QRhiShaderResourceBinding::ImageLoadStore);
+ break;
+ case QRhiShaderResourceBinding::BufferLoad:
+ case QRhiShaderResourceBinding::BufferStore:
+ case QRhiShaderResourceBinding::BufferLoadStore:
+ qrhivk_accumulateComputeResource(&cbD->computePassState.writtenResources,
+ b->u.sbuf.buf,
+ b->type,
+ QRhiShaderResourceBinding::BufferLoad,
+ QRhiShaderResourceBinding::BufferStore,
+ QRhiShaderResourceBinding::BufferLoadStore);
+ break;
+ default:
+ break;
+ }
+ }
+
+ for (auto it = cbD->computePassState.writtenResources.begin(); it != cbD->computePassState.writtenResources.end(); ) {
+ const int accessInThisDispatch = it->first;
+ const bool isNewInThisDispatch = it->second;
+ if (accessInThisDispatch && !isNewInThisDispatch) {
+ if (it.key()->resourceType() == QRhiResource::Texture) {
+ QVkTexture *texD = QRHI_RES(QVkTexture, it.key());
+ VkImageMemoryBarrier barrier = {};
+ barrier.sType = VK_STRUCTURE_TYPE_IMAGE_MEMORY_BARRIER;
+ barrier.subresourceRange.aspectMask = VK_IMAGE_ASPECT_COLOR_BIT;
+ // won't care about subresources, pretend the whole resource was written
+ barrier.subresourceRange.baseMipLevel = 0;
+ barrier.subresourceRange.levelCount = VK_REMAINING_MIP_LEVELS;
+ barrier.subresourceRange.baseArrayLayer = 0;
+ barrier.subresourceRange.layerCount = VK_REMAINING_ARRAY_LAYERS;
+ barrier.oldLayout = texD->usageState.layout;
+ barrier.newLayout = texD->usageState.layout;
+ barrier.srcAccessMask = VK_ACCESS_SHADER_WRITE_BIT;
+ barrier.dstAccessMask = accessInThisDispatch;
+ barrier.image = texD->image;
+ imageBarriers.append(barrier);
+ } else {
+ QVkBuffer *bufD = QRHI_RES(QVkBuffer, it.key());
+ VkBufferMemoryBarrier barrier = {};
+ barrier.sType = VK_STRUCTURE_TYPE_BUFFER_MEMORY_BARRIER;
+ barrier.srcQueueFamilyIndex = VK_QUEUE_FAMILY_IGNORED;
+ barrier.dstQueueFamilyIndex = VK_QUEUE_FAMILY_IGNORED;
+ barrier.srcAccessMask = VK_ACCESS_SHADER_WRITE_BIT;
+ barrier.dstAccessMask = accessInThisDispatch;
+ barrier.buffer = bufD->buffers[bufD->m_type == QRhiBuffer::Dynamic ? currentFrameSlot : 0];
+ barrier.size = VK_WHOLE_SIZE;
+ bufferBarriers.append(barrier);
+ }
+ }
+ // Anything that was previously written, but is only read now, can be
+ // removed from the written list (because that previous write got a
+ // corresponding barrier now).
+ if (accessInThisDispatch == VK_ACCESS_SHADER_READ_BIT)
+ it = cbD->computePassState.writtenResources.erase(it);
+ else
+ ++it;
+ }
+ }
+
+ if (cbD->passUsesSecondaryCb) {
+ VkCommandBuffer secondaryCb = cbD->activeSecondaryCbStack.last();
+ if (!imageBarriers.isEmpty()) {
+ df->vkCmdPipelineBarrier(secondaryCb, VK_PIPELINE_STAGE_COMPUTE_SHADER_BIT, VK_PIPELINE_STAGE_COMPUTE_SHADER_BIT,
+ 0, 0, nullptr,
+ 0, nullptr,
+ imageBarriers.size(), imageBarriers.constData());
+ }
+ if (!bufferBarriers.isEmpty()) {
+ df->vkCmdPipelineBarrier(secondaryCb, VK_PIPELINE_STAGE_COMPUTE_SHADER_BIT, VK_PIPELINE_STAGE_COMPUTE_SHADER_BIT,
+ 0, 0, nullptr,
+ bufferBarriers.size(), bufferBarriers.constData(),
+ 0, nullptr);
+ }
+ df->vkCmdDispatch(secondaryCb, uint32_t(x), uint32_t(y), uint32_t(z));
} else {
- QVkCommandBuffer::Command cmd;
+ if (!imageBarriers.isEmpty()) {
+ QVkCommandBuffer::Command &cmd(cbD->commands.get());
+ cmd.cmd = QVkCommandBuffer::Command::ImageBarrier;
+ cmd.args.imageBarrier.srcStageMask = VK_PIPELINE_STAGE_COMPUTE_SHADER_BIT;
+ cmd.args.imageBarrier.dstStageMask = VK_PIPELINE_STAGE_COMPUTE_SHADER_BIT;
+ cmd.args.imageBarrier.count = imageBarriers.size();
+ cmd.args.imageBarrier.index = cbD->pools.imageBarrier.size();
+ cbD->pools.imageBarrier.append(imageBarriers.constData(), imageBarriers.size());
+ }
+ if (!bufferBarriers.isEmpty()) {
+ QVkCommandBuffer::Command &cmd(cbD->commands.get());
+ cmd.cmd = QVkCommandBuffer::Command::BufferBarrier;
+ cmd.args.bufferBarrier.srcStageMask = VK_PIPELINE_STAGE_COMPUTE_SHADER_BIT;
+ cmd.args.bufferBarrier.dstStageMask = VK_PIPELINE_STAGE_COMPUTE_SHADER_BIT;
+ cmd.args.bufferBarrier.count = bufferBarriers.size();
+ cmd.args.bufferBarrier.index = cbD->pools.bufferBarrier.size();
+ cbD->pools.bufferBarrier.append(bufferBarriers.constData(), bufferBarriers.size());
+ }
+ QVkCommandBuffer::Command &cmd(cbD->commands.get());
cmd.cmd = QVkCommandBuffer::Command::Dispatch;
cmd.args.dispatch.x = x;
cmd.args.dispatch.y = y;
cmd.args.dispatch.z = z;
- cbD->commands.append(cmd);
}
}
VkShaderModule QRhiVulkan::createShader(const QByteArray &spirv)
{
- VkShaderModuleCreateInfo shaderInfo;
- memset(&shaderInfo, 0, sizeof(shaderInfo));
+ VkShaderModuleCreateInfo shaderInfo = {};
shaderInfo.sType = VK_STRUCTURE_TYPE_SHADER_MODULE_CREATE_INFO;
shaderInfo.codeSize = size_t(spirv.size());
shaderInfo.pCode = reinterpret_cast<const quint32 *>(spirv.constData());
@@ -2301,14 +3121,15 @@ VkShaderModule QRhiVulkan::createShader(const QByteArray &spirv)
return shaderModule;
}
-bool QRhiVulkan::ensurePipelineCache()
+bool QRhiVulkan::ensurePipelineCache(const void *initialData, size_t initialDataSize)
{
if (pipelineCache)
return true;
- VkPipelineCacheCreateInfo pipelineCacheInfo;
- memset(&pipelineCacheInfo, 0, sizeof(pipelineCacheInfo));
+ VkPipelineCacheCreateInfo pipelineCacheInfo = {};
pipelineCacheInfo.sType = VK_STRUCTURE_TYPE_PIPELINE_CACHE_CREATE_INFO;
+ pipelineCacheInfo.initialDataSize = initialDataSize;
+ pipelineCacheInfo.pInitialData = initialData;
VkResult err = df->vkCreatePipelineCache(dev, &pipelineCacheInfo, nullptr, &pipelineCache);
if (err != VK_SUCCESS) {
qWarning("Failed to create pipeline cache: %d", err);
@@ -2321,25 +3142,28 @@ void QRhiVulkan::updateShaderResourceBindings(QRhiShaderResourceBindings *srb, i
{
QVkShaderResourceBindings *srbD = QRHI_RES(QVkShaderResourceBindings, srb);
- QVarLengthArray<VkDescriptorBufferInfo, 4> bufferInfos;
- QVarLengthArray<VkDescriptorImageInfo, 4> imageInfos;
- QVarLengthArray<VkWriteDescriptorSet, 8> writeInfos;
+ QVarLengthArray<VkDescriptorBufferInfo, 8> bufferInfos;
+ using ArrayOfImageDesc = QVarLengthArray<VkDescriptorImageInfo, 8>;
+ QVarLengthArray<ArrayOfImageDesc, 8> imageInfos;
+ QVarLengthArray<VkWriteDescriptorSet, 12> writeInfos;
+ QVarLengthArray<QPair<int, int>, 12> infoIndices;
const bool updateAll = descSetIdx < 0;
int frameSlot = updateAll ? 0 : descSetIdx;
while (frameSlot < (updateAll ? QVK_FRAMES_IN_FLIGHT : descSetIdx + 1)) {
- srbD->boundResourceData[frameSlot].resize(srbD->sortedBindings.count());
- for (int i = 0, ie = srbD->sortedBindings.count(); i != ie; ++i) {
- const QRhiShaderResourceBinding::Data *b = srbD->sortedBindings.at(i).data();
+ for (int i = 0, ie = srbD->sortedBindings.size(); i != ie; ++i) {
+ const QRhiShaderResourceBinding::Data *b = shaderResourceBindingData(srbD->sortedBindings.at(i));
QVkShaderResourceBindings::BoundResourceData &bd(srbD->boundResourceData[frameSlot][i]);
- VkWriteDescriptorSet writeInfo;
- memset(&writeInfo, 0, sizeof(writeInfo));
+ VkWriteDescriptorSet writeInfo = {};
writeInfo.sType = VK_STRUCTURE_TYPE_WRITE_DESCRIPTOR_SET;
writeInfo.dstSet = srbD->descSets[frameSlot];
writeInfo.dstBinding = uint32_t(b->binding);
writeInfo.descriptorCount = 1;
+ int bufferInfoIndex = -1;
+ int imageInfoIndex = -1;
+
switch (b->type) {
case QRhiShaderResourceBinding::UniformBuffer:
{
@@ -2351,56 +3175,94 @@ void QRhiVulkan::updateShaderResourceBindings(QRhiShaderResourceBindings *srb, i
bd.ubuf.generation = bufD->generation;
VkDescriptorBufferInfo bufInfo;
bufInfo.buffer = bufD->m_type == QRhiBuffer::Dynamic ? bufD->buffers[frameSlot] : bufD->buffers[0];
- bufInfo.offset = VkDeviceSize(b->u.ubuf.offset);
- bufInfo.range = VkDeviceSize(b->u.ubuf.maybeSize ? b->u.ubuf.maybeSize : bufD->m_size);
+ bufInfo.offset = b->u.ubuf.offset;
+ bufInfo.range = b->u.ubuf.maybeSize ? b->u.ubuf.maybeSize : bufD->m_size;
// be nice and assert when we know the vulkan device would die a horrible death due to non-aligned reads
Q_ASSERT(aligned(bufInfo.offset, ubufAlign) == bufInfo.offset);
+ bufferInfoIndex = bufferInfos.size();
bufferInfos.append(bufInfo);
- writeInfo.pBufferInfo = &bufferInfos.last();
}
break;
case QRhiShaderResourceBinding::SampledTexture:
{
- QVkTexture *texD = QRHI_RES(QVkTexture, b->u.stex.tex);
- QVkSampler *samplerD = QRHI_RES(QVkSampler, b->u.stex.sampler);
+ const QRhiShaderResourceBinding::Data::TextureAndOrSamplerData *data = &b->u.stex;
+ writeInfo.descriptorCount = data->count; // arrays of combined image samplers are supported
writeInfo.descriptorType = VK_DESCRIPTOR_TYPE_COMBINED_IMAGE_SAMPLER;
- bd.stex.texId = texD->m_id;
- bd.stex.texGeneration = texD->generation;
- bd.stex.samplerId = samplerD->m_id;
- bd.stex.samplerGeneration = samplerD->generation;
- VkDescriptorImageInfo imageInfo;
- imageInfo.sampler = samplerD->sampler;
- imageInfo.imageView = texD->imageView;
- imageInfo.imageLayout = VK_IMAGE_LAYOUT_SHADER_READ_ONLY_OPTIMAL;
+ ArrayOfImageDesc imageInfo(data->count);
+ for (int elem = 0; elem < data->count; ++elem) {
+ QVkTexture *texD = QRHI_RES(QVkTexture, data->texSamplers[elem].tex);
+ QVkSampler *samplerD = QRHI_RES(QVkSampler, data->texSamplers[elem].sampler);
+ bd.stex.d[elem].texId = texD->m_id;
+ bd.stex.d[elem].texGeneration = texD->generation;
+ bd.stex.d[elem].samplerId = samplerD->m_id;
+ bd.stex.d[elem].samplerGeneration = samplerD->generation;
+ imageInfo[elem].sampler = samplerD->sampler;
+ imageInfo[elem].imageView = texD->imageView;
+ imageInfo[elem].imageLayout = VK_IMAGE_LAYOUT_SHADER_READ_ONLY_OPTIMAL;
+ }
+ bd.stex.count = data->count;
+ imageInfoIndex = imageInfos.size();
+ imageInfos.append(imageInfo);
+ }
+ break;
+ case QRhiShaderResourceBinding::Texture:
+ {
+ const QRhiShaderResourceBinding::Data::TextureAndOrSamplerData *data = &b->u.stex;
+ writeInfo.descriptorCount = data->count; // arrays of (separate) images are supported
+ writeInfo.descriptorType = VK_DESCRIPTOR_TYPE_SAMPLED_IMAGE;
+ ArrayOfImageDesc imageInfo(data->count);
+ for (int elem = 0; elem < data->count; ++elem) {
+ QVkTexture *texD = QRHI_RES(QVkTexture, data->texSamplers[elem].tex);
+ bd.stex.d[elem].texId = texD->m_id;
+ bd.stex.d[elem].texGeneration = texD->generation;
+ bd.stex.d[elem].samplerId = 0;
+ bd.stex.d[elem].samplerGeneration = 0;
+ imageInfo[elem].sampler = VK_NULL_HANDLE;
+ imageInfo[elem].imageView = texD->imageView;
+ imageInfo[elem].imageLayout = VK_IMAGE_LAYOUT_SHADER_READ_ONLY_OPTIMAL;
+ }
+ bd.stex.count = data->count;
+ imageInfoIndex = imageInfos.size();
+ imageInfos.append(imageInfo);
+ }
+ break;
+ case QRhiShaderResourceBinding::Sampler:
+ {
+ QVkSampler *samplerD = QRHI_RES(QVkSampler, b->u.stex.texSamplers[0].sampler);
+ writeInfo.descriptorType = VK_DESCRIPTOR_TYPE_SAMPLER;
+ bd.stex.d[0].texId = 0;
+ bd.stex.d[0].texGeneration = 0;
+ bd.stex.d[0].samplerId = samplerD->m_id;
+ bd.stex.d[0].samplerGeneration = samplerD->generation;
+ ArrayOfImageDesc imageInfo(1);
+ imageInfo[0].sampler = samplerD->sampler;
+ imageInfo[0].imageView = VK_NULL_HANDLE;
+ imageInfo[0].imageLayout = VK_IMAGE_LAYOUT_GENERAL;
+ imageInfoIndex = imageInfos.size();
imageInfos.append(imageInfo);
- writeInfo.pImageInfo = &imageInfos.last();
}
break;
case QRhiShaderResourceBinding::ImageLoad:
- Q_FALLTHROUGH();
case QRhiShaderResourceBinding::ImageStore:
- Q_FALLTHROUGH();
case QRhiShaderResourceBinding::ImageLoadStore:
{
QVkTexture *texD = QRHI_RES(QVkTexture, b->u.simage.tex);
- VkImageView view = texD->imageViewForLevel(b->u.simage.level);
+ VkImageView view = texD->perLevelImageViewForLoadStore(b->u.simage.level);
if (view) {
writeInfo.descriptorType = VK_DESCRIPTOR_TYPE_STORAGE_IMAGE;
bd.simage.id = texD->m_id;
bd.simage.generation = texD->generation;
- VkDescriptorImageInfo imageInfo;
- imageInfo.sampler = VK_NULL_HANDLE;
- imageInfo.imageView = view;
- imageInfo.imageLayout = VK_IMAGE_LAYOUT_GENERAL;
+ ArrayOfImageDesc imageInfo(1);
+ imageInfo[0].sampler = VK_NULL_HANDLE;
+ imageInfo[0].imageView = view;
+ imageInfo[0].imageLayout = VK_IMAGE_LAYOUT_GENERAL;
+ imageInfoIndex = imageInfos.size();
imageInfos.append(imageInfo);
- writeInfo.pImageInfo = &imageInfos.last();
}
}
break;
case QRhiShaderResourceBinding::BufferLoad:
- Q_FALLTHROUGH();
case QRhiShaderResourceBinding::BufferStore:
- Q_FALLTHROUGH();
case QRhiShaderResourceBinding::BufferLoadStore:
{
QVkBuffer *bufD = QRHI_RES(QVkBuffer, b->u.sbuf.buf);
@@ -2409,10 +3271,10 @@ void QRhiVulkan::updateShaderResourceBindings(QRhiShaderResourceBindings *srb, i
bd.sbuf.generation = bufD->generation;
VkDescriptorBufferInfo bufInfo;
bufInfo.buffer = bufD->m_type == QRhiBuffer::Dynamic ? bufD->buffers[frameSlot] : bufD->buffers[0];
- bufInfo.offset = VkDeviceSize(b->u.ubuf.offset);
- bufInfo.range = VkDeviceSize(b->u.ubuf.maybeSize ? b->u.ubuf.maybeSize : bufD->m_size);
+ bufInfo.offset = b->u.ubuf.offset;
+ bufInfo.range = b->u.ubuf.maybeSize ? b->u.ubuf.maybeSize : bufD->m_size;
+ bufferInfoIndex = bufferInfos.size();
bufferInfos.append(bufInfo);
- writeInfo.pBufferInfo = &bufferInfos.last();
}
break;
default:
@@ -2420,11 +3282,21 @@ void QRhiVulkan::updateShaderResourceBindings(QRhiShaderResourceBindings *srb, i
}
writeInfos.append(writeInfo);
+ infoIndices.append({ bufferInfoIndex, imageInfoIndex });
}
++frameSlot;
}
- df->vkUpdateDescriptorSets(dev, uint32_t(writeInfos.count()), writeInfos.constData(), 0, nullptr);
+ for (int i = 0, writeInfoCount = writeInfos.size(); i < writeInfoCount; ++i) {
+ const int bufferInfoIndex = infoIndices[i].first;
+ const int imageInfoIndex = infoIndices[i].second;
+ if (bufferInfoIndex >= 0)
+ writeInfos[i].pBufferInfo = &bufferInfos[bufferInfoIndex];
+ else if (imageInfoIndex >= 0)
+ writeInfos[i].pImageInfo = imageInfos[imageInfoIndex].constData();
+ }
+
+ df->vkUpdateDescriptorSets(dev, uint32_t(writeInfos.size()), writeInfos.constData(), 0, nullptr);
}
static inline bool accessIsWrite(VkAccessFlags access)
@@ -2456,8 +3328,7 @@ void QRhiVulkan::trackedBufferBarrier(QVkCommandBuffer *cbD, QVkBuffer *bufD, in
return;
}
- VkBufferMemoryBarrier bufMemBarrier;
- memset(&bufMemBarrier, 0, sizeof(bufMemBarrier));
+ VkBufferMemoryBarrier bufMemBarrier = {};
bufMemBarrier.sType = VK_STRUCTURE_TYPE_BUFFER_MEMORY_BARRIER;
bufMemBarrier.srcQueueFamilyIndex = VK_QUEUE_FAMILY_IGNORED;
bufMemBarrier.dstQueueFamilyIndex = VK_QUEUE_FAMILY_IGNORED;
@@ -2466,12 +3337,13 @@ void QRhiVulkan::trackedBufferBarrier(QVkCommandBuffer *cbD, QVkBuffer *bufD, in
bufMemBarrier.buffer = bufD->buffers[slot];
bufMemBarrier.size = VK_WHOLE_SIZE;
- QVkCommandBuffer::Command cmd;
+ QVkCommandBuffer::Command &cmd(cbD->commands.get());
cmd.cmd = QVkCommandBuffer::Command::BufferBarrier;
cmd.args.bufferBarrier.srcStageMask = s.stage;
cmd.args.bufferBarrier.dstStageMask = stage;
- cmd.args.bufferBarrier.desc = bufMemBarrier;
- cbD->commands.append(cmd);
+ cmd.args.bufferBarrier.count = 1;
+ cmd.args.bufferBarrier.index = cbD->pools.bufferBarrier.size();
+ cbD->pools.bufferBarrier.append(bufMemBarrier);
s.access = access;
s.stage = stage;
@@ -2488,11 +3360,9 @@ void QRhiVulkan::trackedImageBarrier(QVkCommandBuffer *cbD, QVkTexture *texD,
return;
}
- VkImageMemoryBarrier barrier;
- memset(&barrier, 0, sizeof(barrier));
+ VkImageMemoryBarrier barrier = {};
barrier.sType = VK_STRUCTURE_TYPE_IMAGE_MEMORY_BARRIER;
- barrier.subresourceRange.aspectMask = !isDepthTextureFormat(texD->m_format)
- ? VK_IMAGE_ASPECT_COLOR_BIT : VK_IMAGE_ASPECT_DEPTH_BIT;
+ barrier.subresourceRange.aspectMask = aspectMaskForTextureFormat(texD->m_format);
barrier.subresourceRange.baseMipLevel = 0;
barrier.subresourceRange.levelCount = VK_REMAINING_MIP_LEVELS;
barrier.subresourceRange.baseArrayLayer = 0;
@@ -2508,18 +3378,49 @@ void QRhiVulkan::trackedImageBarrier(QVkCommandBuffer *cbD, QVkTexture *texD,
if (!srcStage)
srcStage = VK_PIPELINE_STAGE_TOP_OF_PIPE_BIT;
- QVkCommandBuffer::Command cmd;
+ QVkCommandBuffer::Command &cmd(cbD->commands.get());
cmd.cmd = QVkCommandBuffer::Command::ImageBarrier;
cmd.args.imageBarrier.srcStageMask = srcStage;
cmd.args.imageBarrier.dstStageMask = stage;
- cmd.args.imageBarrier.desc = barrier;
- cbD->commands.append(cmd);
+ cmd.args.imageBarrier.count = 1;
+ cmd.args.imageBarrier.index = cbD->pools.imageBarrier.size();
+ cbD->pools.imageBarrier.append(barrier);
s.layout = layout;
s.access = access;
s.stage = stage;
}
+void QRhiVulkan::depthStencilExplicitBarrier(QVkCommandBuffer *cbD, QVkRenderBuffer *rbD)
+{
+ Q_ASSERT(cbD->recordingPass == QVkCommandBuffer::NoPass);
+
+ VkImageMemoryBarrier barrier = {};
+ barrier.sType = VK_STRUCTURE_TYPE_IMAGE_MEMORY_BARRIER;
+ barrier.subresourceRange.aspectMask = VK_IMAGE_ASPECT_DEPTH_BIT | VK_IMAGE_ASPECT_STENCIL_BIT;
+ barrier.subresourceRange.baseMipLevel = 0;
+ barrier.subresourceRange.levelCount = VK_REMAINING_MIP_LEVELS;
+ barrier.subresourceRange.baseArrayLayer = 0;
+ barrier.subresourceRange.layerCount = VK_REMAINING_ARRAY_LAYERS;
+ barrier.oldLayout = VK_IMAGE_LAYOUT_UNDEFINED;
+ barrier.newLayout = VK_IMAGE_LAYOUT_DEPTH_STENCIL_ATTACHMENT_OPTIMAL;
+ barrier.srcAccessMask = VK_ACCESS_DEPTH_STENCIL_ATTACHMENT_WRITE_BIT;
+ barrier.dstAccessMask = VK_ACCESS_DEPTH_STENCIL_ATTACHMENT_READ_BIT
+ | VK_ACCESS_DEPTH_STENCIL_ATTACHMENT_WRITE_BIT;
+ barrier.image = rbD->image;
+
+ const VkPipelineStageFlags stages = VK_PIPELINE_STAGE_EARLY_FRAGMENT_TESTS_BIT
+ | VK_PIPELINE_STAGE_LATE_FRAGMENT_TESTS_BIT;
+
+ QVkCommandBuffer::Command &cmd(cbD->commands.get());
+ cmd.cmd = QVkCommandBuffer::Command::ImageBarrier;
+ cmd.args.imageBarrier.srcStageMask = stages;
+ cmd.args.imageBarrier.dstStageMask = stages;
+ cmd.args.imageBarrier.count = 1;
+ cmd.args.imageBarrier.index = cbD->pools.imageBarrier.size();
+ cbD->pools.imageBarrier.append(barrier);
+}
+
void QRhiVulkan::subresourceBarrier(QVkCommandBuffer *cbD, VkImage image,
VkImageLayout oldLayout, VkImageLayout newLayout,
VkAccessFlags srcAccess, VkAccessFlags dstAccess,
@@ -2528,8 +3429,7 @@ void QRhiVulkan::subresourceBarrier(QVkCommandBuffer *cbD, VkImage image,
int startLevel, int levelCount)
{
Q_ASSERT(cbD->recordingPass == QVkCommandBuffer::NoPass);
- VkImageMemoryBarrier barrier;
- memset(&barrier, 0, sizeof(barrier));
+ VkImageMemoryBarrier barrier = {};
barrier.sType = VK_STRUCTURE_TYPE_IMAGE_MEMORY_BARRIER;
barrier.subresourceRange.aspectMask = VK_IMAGE_ASPECT_COLOR_BIT;
barrier.subresourceRange.baseMipLevel = uint32_t(startLevel);
@@ -2542,12 +3442,13 @@ void QRhiVulkan::subresourceBarrier(QVkCommandBuffer *cbD, VkImage image,
barrier.dstAccessMask = dstAccess;
barrier.image = image;
- QVkCommandBuffer::Command cmd;
+ QVkCommandBuffer::Command &cmd(cbD->commands.get());
cmd.cmd = QVkCommandBuffer::Command::ImageBarrier;
cmd.args.imageBarrier.srcStageMask = srcStage;
cmd.args.imageBarrier.dstStageMask = dstStage;
- cmd.args.imageBarrier.desc = barrier;
- cbD->commands.append(cmd);
+ cmd.args.imageBarrier.count = 1;
+ cmd.args.imageBarrier.index = cbD->pools.imageBarrier.size();
+ cbD->pools.imageBarrier.append(barrier);
}
VkDeviceSize QRhiVulkan::subresUploadByteSize(const QRhiTextureSubresourceUploadDescription &subresDesc) const
@@ -2568,15 +3469,20 @@ void QRhiVulkan::prepareUploadSubres(QVkTexture *texD, int layer, int level,
qsizetype copySizeBytes = 0;
qsizetype imageSizeBytes = 0;
const void *src = nullptr;
+ const bool is3D = texD->m_flags.testFlag(QRhiTexture::ThreeDimensional);
+ const bool is1D = texD->m_flags.testFlag(QRhiTexture::OneDimensional);
- VkBufferImageCopy copyInfo;
- memset(&copyInfo, 0, sizeof(copyInfo));
+ VkBufferImageCopy copyInfo = {};
copyInfo.bufferOffset = *curOfs;
copyInfo.imageSubresource.aspectMask = VK_IMAGE_ASPECT_COLOR_BIT;
copyInfo.imageSubresource.mipLevel = uint32_t(level);
- copyInfo.imageSubresource.baseArrayLayer = uint32_t(layer);
+ copyInfo.imageSubresource.baseArrayLayer = is3D ? 0 : uint32_t(layer);
copyInfo.imageSubresource.layerCount = 1;
copyInfo.imageExtent.depth = 1;
+ if (is3D)
+ copyInfo.imageOffset.z = uint32_t(layer);
+ if (is1D)
+ copyInfo.imageOffset.y = uint32_t(layer);
const QByteArray rawData = subresDesc.data();
const QPoint dp = subresDesc.destinationTopLeft();
@@ -2595,12 +3501,12 @@ void QRhiVulkan::prepareUploadSubres(QVkTexture *texD, int layer, int level,
const int sy = subresDesc.sourceTopLeft().y();
if (!subresDesc.sourceSize().isEmpty())
size = subresDesc.sourceSize();
- if (image.depth() == 32) {
- // The staging buffer will get the full image
- // regardless, just adjust the vk
- // buffer-to-image copy start offset.
- copyInfo.bufferOffset += VkDeviceSize(sy * image.bytesPerLine() + sx * 4);
- // bufferRowLength remains set to the original image's width
+
+ if (size.width() == image.width()) {
+ // No need to make a QImage copy here, can copy from the source
+ // QImage into staging directly.
+ src = image.constBits() + sy * image.bytesPerLine() + sx * bpc;
+ copySizeBytes = size.height() * image.bytesPerLine();
} else {
image = image.copy(sx, sy, size.width(), size.height());
src = image.constBits();
@@ -2640,6 +3546,12 @@ void QRhiVulkan::prepareUploadSubres(QVkTexture *texD, int layer, int level,
copySizeBytes = imageSizeBytes = rawData.size();
src = rawData.constData();
QSize size = q->sizeForMipLevel(level, texD->m_pixelSize);
+ if (subresDesc.dataStride()) {
+ quint32 bytesPerPixel = 0;
+ textureFormatInfo(texD->m_format, size, nullptr, nullptr, &bytesPerPixel);
+ if (bytesPerPixel)
+ copyInfo.bufferRowLength = subresDesc.dataStride() / bytesPerPixel;
+ }
if (!subresDesc.sourceSize().isEmpty())
size = subresDesc.sourceSize();
copyInfo.imageOffset.x = dp.x();
@@ -2651,37 +3563,46 @@ void QRhiVulkan::prepareUploadSubres(QVkTexture *texD, int layer, int level,
qWarning("Invalid texture upload for %p layer=%d mip=%d", texD, layer, level);
}
- memcpy(reinterpret_cast<char *>(mp) + *curOfs, src, size_t(copySizeBytes));
- *curOfs += aligned(VkDeviceSize(imageSizeBytes), texbufAlign);
+ if (src) {
+ memcpy(reinterpret_cast<char *>(mp) + *curOfs, src, size_t(copySizeBytes));
+ *curOfs += aligned(VkDeviceSize(imageSizeBytes), texbufAlign);
+ }
+}
+
+void QRhiVulkan::printExtraErrorInfo(VkResult err)
+{
+ if (err == VK_ERROR_OUT_OF_DEVICE_MEMORY)
+ qWarning() << "Out of device memory, current allocator statistics are" << statistics();
}
void QRhiVulkan::enqueueResourceUpdates(QVkCommandBuffer *cbD, QRhiResourceUpdateBatch *resourceUpdates)
{
QRhiResourceUpdateBatchPrivate *ud = QRhiResourceUpdateBatchPrivate::get(resourceUpdates);
- QRhiProfilerPrivate *rhiP = profilerPrivateOrNull();
- for (const QRhiResourceUpdateBatchPrivate::BufferOp &u : ud->bufferOps) {
+ for (int opIdx = 0; opIdx < ud->activeBufferOpCount; ++opIdx) {
+ const QRhiResourceUpdateBatchPrivate::BufferOp &u(ud->bufferOps[opIdx]);
if (u.type == QRhiResourceUpdateBatchPrivate::BufferOp::DynamicUpdate) {
QVkBuffer *bufD = QRHI_RES(QVkBuffer, u.buf);
Q_ASSERT(bufD->m_type == QRhiBuffer::Dynamic);
- for (int i = 0; i < QVK_FRAMES_IN_FLIGHT; ++i)
- bufD->pendingDynamicUpdates[i].append(u);
+ for (int i = 0; i < QVK_FRAMES_IN_FLIGHT; ++i) {
+ if (u.offset == 0 && u.data.size() == bufD->m_size)
+ bufD->pendingDynamicUpdates[i].clear();
+ bufD->pendingDynamicUpdates[i].append({ u.offset, u.data });
+ }
} else if (u.type == QRhiResourceUpdateBatchPrivate::BufferOp::StaticUpload) {
QVkBuffer *bufD = QRHI_RES(QVkBuffer, u.buf);
Q_ASSERT(bufD->m_type != QRhiBuffer::Dynamic);
Q_ASSERT(u.offset + u.data.size() <= bufD->m_size);
if (!bufD->stagingBuffers[currentFrameSlot]) {
- VkBufferCreateInfo bufferInfo;
- memset(&bufferInfo, 0, sizeof(bufferInfo));
+ VkBufferCreateInfo bufferInfo = {};
bufferInfo.sType = VK_STRUCTURE_TYPE_BUFFER_CREATE_INFO;
// must cover the entire buffer - this way multiple, partial updates per frame
// are supported even when the staging buffer is reused (Static)
- bufferInfo.size = VkDeviceSize(bufD->m_size);
+ bufferInfo.size = bufD->m_size;
bufferInfo.usage = VK_BUFFER_USAGE_TRANSFER_SRC_BIT;
- VmaAllocationCreateInfo allocInfo;
- memset(&allocInfo, 0, sizeof(allocInfo));
+ VmaAllocationCreateInfo allocInfo = {};
allocInfo.usage = VMA_MEMORY_USAGE_CPU_ONLY;
VmaAllocation allocation;
@@ -2689,9 +3610,9 @@ void QRhiVulkan::enqueueResourceUpdates(QVkCommandBuffer *cbD, QRhiResourceUpdat
&bufD->stagingBuffers[currentFrameSlot], &allocation, nullptr);
if (err == VK_SUCCESS) {
bufD->stagingAllocations[currentFrameSlot] = allocation;
- QRHI_PROF_F(newBufferStagingArea(bufD, currentFrameSlot, quint32(bufD->m_size)));
} else {
- qWarning("Failed to create staging buffer of size %d: %d", bufD->m_size, err);
+ qWarning("Failed to create staging buffer of size %u: %d", bufD->m_size, err);
+ printExtraErrorInfo(err);
continue;
}
}
@@ -2703,25 +3624,23 @@ void QRhiVulkan::enqueueResourceUpdates(QVkCommandBuffer *cbD, QRhiResourceUpdat
qWarning("Failed to map buffer: %d", err);
continue;
}
- memcpy(static_cast<uchar *>(p) + u.offset, u.data.constData(), size_t(u.data.size()));
+ memcpy(static_cast<uchar *>(p) + u.offset, u.data.constData(), u.data.size());
+ vmaFlushAllocation(toVmaAllocator(allocator), a, u.offset, u.data.size());
vmaUnmapMemory(toVmaAllocator(allocator), a);
- vmaFlushAllocation(toVmaAllocator(allocator), a, VkDeviceSize(u.offset), VkDeviceSize(u.data.size()));
trackedBufferBarrier(cbD, bufD, 0,
VK_ACCESS_TRANSFER_WRITE_BIT, VK_PIPELINE_STAGE_TRANSFER_BIT);
- VkBufferCopy copyInfo;
- memset(&copyInfo, 0, sizeof(copyInfo));
- copyInfo.srcOffset = VkDeviceSize(u.offset);
- copyInfo.dstOffset = VkDeviceSize(u.offset);
- copyInfo.size = VkDeviceSize(u.data.size());
+ VkBufferCopy copyInfo = {};
+ copyInfo.srcOffset = u.offset;
+ copyInfo.dstOffset = u.offset;
+ copyInfo.size = u.data.size();
- QVkCommandBuffer::Command cmd;
+ QVkCommandBuffer::Command &cmd(cbD->commands.get());
cmd.cmd = QVkCommandBuffer::Command::CopyBuffer;
cmd.args.copyBuffer.src = bufD->stagingBuffers[currentFrameSlot];
cmd.args.copyBuffer.dst = bufD->buffers[0];
cmd.args.copyBuffer.desc = copyInfo;
- cbD->commands.append(cmd);
// Where's the barrier for read-after-write? (assuming the common case
// of binding this buffer as vertex/index, or, less likely, as uniform
@@ -2741,18 +3660,17 @@ void QRhiVulkan::enqueueResourceUpdates(QVkCommandBuffer *cbD, QRhiResourceUpdat
bufD->stagingBuffers[currentFrameSlot] = VK_NULL_HANDLE;
bufD->stagingAllocations[currentFrameSlot] = nullptr;
releaseQueue.append(e);
- QRHI_PROF_F(releaseBufferStagingArea(bufD, currentFrameSlot));
}
} else if (u.type == QRhiResourceUpdateBatchPrivate::BufferOp::Read) {
QVkBuffer *bufD = QRHI_RES(QVkBuffer, u.buf);
if (bufD->m_type == QRhiBuffer::Dynamic) {
- executeBufferHostWritesForCurrentFrame(bufD);
+ executeBufferHostWritesForSlot(bufD, currentFrameSlot);
void *p = nullptr;
VmaAllocation a = toVmaAllocation(bufD->allocations[currentFrameSlot]);
VkResult err = vmaMapMemory(toVmaAllocator(allocator), a, &p);
if (err == VK_SUCCESS) {
u.result->data.resize(u.readSize);
- memcpy(u.result->data.data(), reinterpret_cast<char *>(p) + u.offset, size_t(u.readSize));
+ memcpy(u.result->data.data(), reinterpret_cast<char *>(p) + u.offset, u.readSize);
vmaUnmapMemory(toVmaAllocator(allocator), a);
}
if (u.result->completed)
@@ -2769,39 +3687,35 @@ void QRhiVulkan::enqueueResourceUpdates(QVkCommandBuffer *cbD, QRhiResourceUpdat
readback.result = u.result;
readback.byteSize = u.readSize;
- VkBufferCreateInfo bufferInfo;
- memset(&bufferInfo, 0, sizeof(bufferInfo));
+ VkBufferCreateInfo bufferInfo = {};
bufferInfo.sType = VK_STRUCTURE_TYPE_BUFFER_CREATE_INFO;
- bufferInfo.size = VkDeviceSize(readback.byteSize);
+ bufferInfo.size = readback.byteSize;
bufferInfo.usage = VK_BUFFER_USAGE_TRANSFER_DST_BIT;
- VmaAllocationCreateInfo allocInfo;
- memset(&allocInfo, 0, sizeof(allocInfo));
+ VmaAllocationCreateInfo allocInfo = {};
allocInfo.usage = VMA_MEMORY_USAGE_GPU_TO_CPU;
VmaAllocation allocation;
VkResult err = vmaCreateBuffer(toVmaAllocator(allocator), &bufferInfo, &allocInfo, &readback.stagingBuf, &allocation, nullptr);
if (err == VK_SUCCESS) {
readback.stagingAlloc = allocation;
- QRHI_PROF_F(newReadbackBuffer(qint64(readback.stagingBuf), bufD, uint(readback.byteSize)));
} else {
qWarning("Failed to create readback buffer of size %u: %d", readback.byteSize, err);
+ printExtraErrorInfo(err);
continue;
}
trackedBufferBarrier(cbD, bufD, 0, VK_ACCESS_TRANSFER_READ_BIT, VK_PIPELINE_STAGE_TRANSFER_BIT);
- VkBufferCopy copyInfo;
- memset(&copyInfo, 0, sizeof(copyInfo));
- copyInfo.srcOffset = VkDeviceSize(u.offset);
- copyInfo.size = VkDeviceSize(u.readSize);
+ VkBufferCopy copyInfo = {};
+ copyInfo.srcOffset = u.offset;
+ copyInfo.size = u.readSize;
- QVkCommandBuffer::Command cmd;
+ QVkCommandBuffer::Command &cmd(cbD->commands.get());
cmd.cmd = QVkCommandBuffer::Command::CopyBuffer;
cmd.args.copyBuffer.src = bufD->buffers[0];
cmd.args.copyBuffer.dst = readback.stagingBuf;
cmd.args.copyBuffer.desc = copyInfo;
- cbD->commands.append(cmd);
bufD->lastActiveFrameSlot = currentFrameSlot;
@@ -2810,27 +3724,26 @@ void QRhiVulkan::enqueueResourceUpdates(QVkCommandBuffer *cbD, QRhiResourceUpdat
}
}
- for (const QRhiResourceUpdateBatchPrivate::TextureOp &u : ud->textureOps) {
+ for (int opIdx = 0; opIdx < ud->activeTextureOpCount; ++opIdx) {
+ const QRhiResourceUpdateBatchPrivate::TextureOp &u(ud->textureOps[opIdx]);
if (u.type == QRhiResourceUpdateBatchPrivate::TextureOp::Upload) {
QVkTexture *utexD = QRHI_RES(QVkTexture, u.dst);
// batch into a single staging buffer and a single CopyBufferToImage with multiple copyInfos
VkDeviceSize stagingSize = 0;
- for (int layer = 0; layer < QRhi::MAX_LAYERS; ++layer) {
- for (int level = 0; level < QRhi::MAX_LEVELS; ++level) {
- for (const QRhiTextureSubresourceUploadDescription &subresDesc : qAsConst(u.subresDesc[layer][level]))
+ for (int layer = 0, maxLayer = u.subresDesc.size(); layer < maxLayer; ++layer) {
+ for (int level = 0; level < QRhi::MAX_MIP_LEVELS; ++level) {
+ for (const QRhiTextureSubresourceUploadDescription &subresDesc : std::as_const(u.subresDesc[layer][level]))
stagingSize += subresUploadByteSize(subresDesc);
}
}
Q_ASSERT(!utexD->stagingBuffers[currentFrameSlot]);
- VkBufferCreateInfo bufferInfo;
- memset(&bufferInfo, 0, sizeof(bufferInfo));
+ VkBufferCreateInfo bufferInfo = {};
bufferInfo.sType = VK_STRUCTURE_TYPE_BUFFER_CREATE_INFO;
bufferInfo.size = stagingSize;
bufferInfo.usage = VK_BUFFER_USAGE_TRANSFER_SRC_BIT;
- VmaAllocationCreateInfo allocInfo;
- memset(&allocInfo, 0, sizeof(allocInfo));
+ VmaAllocationCreateInfo allocInfo = {};
allocInfo.usage = VMA_MEMORY_USAGE_CPU_TO_GPU;
VmaAllocation allocation;
@@ -2838,10 +3751,10 @@ void QRhiVulkan::enqueueResourceUpdates(QVkCommandBuffer *cbD, QRhiResourceUpdat
&utexD->stagingBuffers[currentFrameSlot], &allocation, nullptr);
if (err != VK_SUCCESS) {
qWarning("Failed to create image staging buffer of size %d: %d", int(stagingSize), err);
+ printExtraErrorInfo(err);
continue;
}
utexD->stagingAllocations[currentFrameSlot] = allocation;
- QRHI_PROF_F(newTextureStagingArea(utexD, currentFrameSlot, quint32(stagingSize)));
BufferImageCopyList copyInfos;
size_t curOfs = 0;
@@ -2853,32 +3766,31 @@ void QRhiVulkan::enqueueResourceUpdates(QVkCommandBuffer *cbD, QRhiResourceUpdat
continue;
}
- for (int layer = 0; layer < QRhi::MAX_LAYERS; ++layer) {
- for (int level = 0; level < QRhi::MAX_LEVELS; ++level) {
- const QVector<QRhiTextureSubresourceUploadDescription> &srd(u.subresDesc[layer][level]);
+ for (int layer = 0, maxLayer = u.subresDesc.size(); layer < maxLayer; ++layer) {
+ for (int level = 0; level < QRhi::MAX_MIP_LEVELS; ++level) {
+ const QList<QRhiTextureSubresourceUploadDescription> &srd(u.subresDesc[layer][level]);
if (srd.isEmpty())
continue;
- for (const QRhiTextureSubresourceUploadDescription &subresDesc : qAsConst(srd)) {
+ for (const QRhiTextureSubresourceUploadDescription &subresDesc : std::as_const(srd)) {
prepareUploadSubres(utexD, layer, level,
subresDesc, &curOfs, mp, &copyInfos);
}
}
}
- vmaUnmapMemory(toVmaAllocator(allocator), a);
vmaFlushAllocation(toVmaAllocator(allocator), a, 0, stagingSize);
+ vmaUnmapMemory(toVmaAllocator(allocator), a);
trackedImageBarrier(cbD, utexD, VK_IMAGE_LAYOUT_TRANSFER_DST_OPTIMAL,
VK_ACCESS_TRANSFER_WRITE_BIT, VK_PIPELINE_STAGE_TRANSFER_BIT);
- QVkCommandBuffer::Command cmd;
+ QVkCommandBuffer::Command &cmd(cbD->commands.get());
cmd.cmd = QVkCommandBuffer::Command::CopyBufferToImage;
cmd.args.copyBufferToImage.src = utexD->stagingBuffers[currentFrameSlot];
cmd.args.copyBufferToImage.dst = utexD->image;
cmd.args.copyBufferToImage.dstLayout = VK_IMAGE_LAYOUT_TRANSFER_DST_OPTIMAL;
- cmd.args.copyBufferToImage.count = copyInfos.count();
- cmd.args.copyBufferToImage.bufferImageCopyIndex = cbD->pools.bufferImageCopy.count();
- cbD->pools.bufferImageCopy.append(copyInfos.constData(), copyInfos.count());
- cbD->commands.append(cmd);
+ cmd.args.copyBufferToImage.count = copyInfos.size();
+ cmd.args.copyBufferToImage.bufferImageCopyIndex = cbD->pools.bufferImageCopy.size();
+ cbD->pools.bufferImageCopy.append(copyInfos.constData(), copyInfos.size());
// no reuse of staging, this is intentional
QRhiVulkan::DeferredReleaseEntry e;
@@ -2889,7 +3801,6 @@ void QRhiVulkan::enqueueResourceUpdates(QVkCommandBuffer *cbD, QRhiResourceUpdat
utexD->stagingBuffers[currentFrameSlot] = VK_NULL_HANDLE;
utexD->stagingAllocations[currentFrameSlot] = nullptr;
releaseQueue.append(e);
- QRHI_PROF_F(releaseTextureStagingArea(utexD, currentFrameSlot));
// Similarly to buffers, transitioning away from DST is done later,
// when a renderpass using the texture is encountered.
@@ -2903,25 +3814,29 @@ void QRhiVulkan::enqueueResourceUpdates(QVkCommandBuffer *cbD, QRhiResourceUpdat
}
QVkTexture *srcD = QRHI_RES(QVkTexture, u.src);
QVkTexture *dstD = QRHI_RES(QVkTexture, u.dst);
+ const bool srcIs3D = srcD->m_flags.testFlag(QRhiTexture::ThreeDimensional);
+ const bool dstIs3D = dstD->m_flags.testFlag(QRhiTexture::ThreeDimensional);
- VkImageCopy region;
- memset(&region, 0, sizeof(region));
-
+ VkImageCopy region = {};
region.srcSubresource.aspectMask = VK_IMAGE_ASPECT_COLOR_BIT;
region.srcSubresource.mipLevel = uint32_t(u.desc.sourceLevel());
- region.srcSubresource.baseArrayLayer = uint32_t(u.desc.sourceLayer());
+ region.srcSubresource.baseArrayLayer = srcIs3D ? 0 : uint32_t(u.desc.sourceLayer());
region.srcSubresource.layerCount = 1;
region.srcOffset.x = u.desc.sourceTopLeft().x();
region.srcOffset.y = u.desc.sourceTopLeft().y();
+ if (srcIs3D)
+ region.srcOffset.z = uint32_t(u.desc.sourceLayer());
region.dstSubresource.aspectMask = VK_IMAGE_ASPECT_COLOR_BIT;
region.dstSubresource.mipLevel = uint32_t(u.desc.destinationLevel());
- region.dstSubresource.baseArrayLayer = uint32_t(u.desc.destinationLayer());
+ region.dstSubresource.baseArrayLayer = dstIs3D ? 0 : uint32_t(u.desc.destinationLayer());
region.dstSubresource.layerCount = 1;
region.dstOffset.x = u.desc.destinationTopLeft().x();
region.dstOffset.y = u.desc.destinationTopLeft().y();
+ if (dstIs3D)
+ region.dstOffset.z = uint32_t(u.desc.destinationLayer());
const QSize mipSize = q->sizeForMipLevel(u.desc.sourceLevel(), srcD->m_pixelSize);
const QSize copySize = u.desc.pixelSize().isEmpty() ? mipSize : u.desc.pixelSize();
@@ -2934,14 +3849,13 @@ void QRhiVulkan::enqueueResourceUpdates(QVkCommandBuffer *cbD, QRhiResourceUpdat
trackedImageBarrier(cbD, dstD, VK_IMAGE_LAYOUT_TRANSFER_DST_OPTIMAL,
VK_ACCESS_TRANSFER_WRITE_BIT, VK_PIPELINE_STAGE_TRANSFER_BIT);
- QVkCommandBuffer::Command cmd;
+ QVkCommandBuffer::Command &cmd(cbD->commands.get());
cmd.cmd = QVkCommandBuffer::Command::CopyImage;
cmd.args.copyImage.src = srcD->image;
cmd.args.copyImage.srcLayout = srcD->usageState.layout;
cmd.args.copyImage.dst = dstD->image;
cmd.args.copyImage.dstLayout = dstD->usageState.layout;
cmd.args.copyImage.desc = region;
- cbD->commands.append(cmd);
srcD->lastActiveFrameSlot = dstD->lastActiveFrameSlot = currentFrameSlot;
} else if (u.type == QRhiResourceUpdateBatchPrivate::TextureOp::Read) {
@@ -2952,11 +3866,13 @@ void QRhiVulkan::enqueueResourceUpdates(QVkCommandBuffer *cbD, QRhiResourceUpdat
QVkTexture *texD = QRHI_RES(QVkTexture, u.rb.texture());
QVkSwapChain *swapChainD = nullptr;
+ bool is3D = false;
if (texD) {
if (texD->samples > VK_SAMPLE_COUNT_1_BIT) {
qWarning("Multisample texture cannot be read back");
continue;
}
+ is3D = texD->m_flags.testFlag(QRhiTexture::ThreeDimensional);
readback.pixelSize = q->sizeForMipLevel(u.rb.level(), texD->m_pixelSize);
readback.format = texD->m_format;
texD->lastActiveFrameSlot = currentFrameSlot;
@@ -2968,46 +3884,43 @@ void QRhiVulkan::enqueueResourceUpdates(QVkCommandBuffer *cbD, QRhiResourceUpdat
continue;
}
readback.pixelSize = swapChainD->pixelSize;
- readback.format = colorTextureFormatFromVkFormat(swapChainD->colorFormat, nullptr);
+ readback.format = swapchainReadbackTextureFormat(swapChainD->colorFormat, nullptr);
if (readback.format == QRhiTexture::UnknownFormat)
continue;
// Multisample swapchains need nothing special since resolving
// happens when ending a renderpass.
}
- textureFormatInfo(readback.format, readback.pixelSize, nullptr, &readback.byteSize);
+ textureFormatInfo(readback.format, readback.pixelSize, nullptr, &readback.byteSize, nullptr);
// Create a host visible readback buffer.
- VkBufferCreateInfo bufferInfo;
- memset(&bufferInfo, 0, sizeof(bufferInfo));
+ VkBufferCreateInfo bufferInfo = {};
bufferInfo.sType = VK_STRUCTURE_TYPE_BUFFER_CREATE_INFO;
bufferInfo.size = readback.byteSize;
bufferInfo.usage = VK_BUFFER_USAGE_TRANSFER_DST_BIT;
- VmaAllocationCreateInfo allocInfo;
- memset(&allocInfo, 0, sizeof(allocInfo));
+ VmaAllocationCreateInfo allocInfo = {};
allocInfo.usage = VMA_MEMORY_USAGE_GPU_TO_CPU;
VmaAllocation allocation;
VkResult err = vmaCreateBuffer(toVmaAllocator(allocator), &bufferInfo, &allocInfo, &readback.stagingBuf, &allocation, nullptr);
if (err == VK_SUCCESS) {
readback.stagingAlloc = allocation;
- QRHI_PROF_F(newReadbackBuffer(qint64(readback.stagingBuf),
- texD ? static_cast<QRhiResource *>(texD) : static_cast<QRhiResource *>(swapChainD),
- readback.byteSize));
} else {
qWarning("Failed to create readback buffer of size %u: %d", readback.byteSize, err);
+ printExtraErrorInfo(err);
continue;
}
// Copy from the (optimal and not host visible) image into the buffer.
- VkBufferImageCopy copyDesc;
- memset(&copyDesc, 0, sizeof(copyDesc));
+ VkBufferImageCopy copyDesc = {};
copyDesc.bufferOffset = 0;
copyDesc.imageSubresource.aspectMask = VK_IMAGE_ASPECT_COLOR_BIT;
copyDesc.imageSubresource.mipLevel = uint32_t(u.rb.level());
- copyDesc.imageSubresource.baseArrayLayer = uint32_t(u.rb.layer());
+ copyDesc.imageSubresource.baseArrayLayer = is3D ? 0 : uint32_t(u.rb.layer());
copyDesc.imageSubresource.layerCount = 1;
+ if (is3D)
+ copyDesc.imageOffset.z = u.rb.layer();
copyDesc.imageExtent.width = uint32_t(readback.pixelSize.width());
copyDesc.imageExtent.height = uint32_t(readback.pixelSize.height());
copyDesc.imageExtent.depth = 1;
@@ -3015,13 +3928,12 @@ void QRhiVulkan::enqueueResourceUpdates(QVkCommandBuffer *cbD, QRhiResourceUpdat
if (texD) {
trackedImageBarrier(cbD, texD, VK_IMAGE_LAYOUT_TRANSFER_SRC_OPTIMAL,
VK_ACCESS_TRANSFER_READ_BIT, VK_PIPELINE_STAGE_TRANSFER_BIT);
- QVkCommandBuffer::Command cmd;
+ QVkCommandBuffer::Command &cmd(cbD->commands.get());
cmd.cmd = QVkCommandBuffer::Command::CopyImageToBuffer;
cmd.args.copyImageToBuffer.src = texD->image;
cmd.args.copyImageToBuffer.srcLayout = texD->usageState.layout;
cmd.args.copyImageToBuffer.dst = readback.stagingBuf;
cmd.args.copyImageToBuffer.desc = copyDesc;
- cbD->commands.append(cmd);
} else {
// use the swapchain image
QVkSwapChain::ImageResources &imageRes(swapChainD->imageRes[swapChainD->currentImageIndex]);
@@ -3040,21 +3952,21 @@ void QRhiVulkan::enqueueResourceUpdates(QVkCommandBuffer *cbD, QRhiResourceUpdat
imageRes.lastUse = QVkSwapChain::ImageResources::ScImageUseTransferSource;
}
- QVkCommandBuffer::Command cmd;
+ QVkCommandBuffer::Command &cmd(cbD->commands.get());
cmd.cmd = QVkCommandBuffer::Command::CopyImageToBuffer;
cmd.args.copyImageToBuffer.src = image;
cmd.args.copyImageToBuffer.srcLayout = VK_IMAGE_LAYOUT_TRANSFER_SRC_OPTIMAL;
cmd.args.copyImageToBuffer.dst = readback.stagingBuf;
cmd.args.copyImageToBuffer.desc = copyDesc;
- cbD->commands.append(cmd);
}
activeTextureReadbacks.append(readback);
} else if (u.type == QRhiResourceUpdateBatchPrivate::TextureOp::GenMips) {
QVkTexture *utexD = QRHI_RES(QVkTexture, u.dst);
Q_ASSERT(utexD->m_flags.testFlag(QRhiTexture::UsedWithGenerateMips));
- int w = utexD->m_pixelSize.width();
- int h = utexD->m_pixelSize.height();
+ const bool isCube = utexD->m_flags.testFlag(QRhiTexture::CubeMap);
+ const bool isArray = utexD->m_flags.testFlag(QRhiTexture::TextureArray);
+ const bool is3D = utexD->m_flags.testFlag(QRhiTexture::ThreeDimensional);
VkImageLayout origLayout = utexD->usageState.layout;
VkAccessFlags origAccess = utexD->usageState.access;
@@ -3062,80 +3974,82 @@ void QRhiVulkan::enqueueResourceUpdates(QVkCommandBuffer *cbD, QRhiResourceUpdat
if (!origStage)
origStage = VK_PIPELINE_STAGE_TOP_OF_PIPE_BIT;
- for (int level = 1; level < int(utexD->mipLevelCount); ++level) {
- if (level == 1) {
+ for (int layer = 0; layer < (isCube ? 6 : (isArray ? qMax(0, utexD->m_arraySize) : 1)); ++layer) {
+ int w = utexD->m_pixelSize.width();
+ int h = utexD->m_pixelSize.height();
+ int depth = is3D ? qMax(1, utexD->m_depth) : 1;
+ for (int level = 1; level < int(utexD->mipLevelCount); ++level) {
+ if (level == 1) {
+ subresourceBarrier(cbD, utexD->image,
+ origLayout, VK_IMAGE_LAYOUT_TRANSFER_SRC_OPTIMAL,
+ origAccess, VK_ACCESS_TRANSFER_READ_BIT,
+ origStage, VK_PIPELINE_STAGE_TRANSFER_BIT,
+ layer, 1,
+ level - 1, 1);
+ } else {
+ subresourceBarrier(cbD, utexD->image,
+ VK_IMAGE_LAYOUT_TRANSFER_DST_OPTIMAL, VK_IMAGE_LAYOUT_TRANSFER_SRC_OPTIMAL,
+ VK_ACCESS_TRANSFER_WRITE_BIT, VK_ACCESS_TRANSFER_READ_BIT,
+ VK_PIPELINE_STAGE_TRANSFER_BIT, VK_PIPELINE_STAGE_TRANSFER_BIT,
+ layer, 1,
+ level - 1, 1);
+ }
+
subresourceBarrier(cbD, utexD->image,
- origLayout, VK_IMAGE_LAYOUT_TRANSFER_SRC_OPTIMAL,
- origAccess, VK_ACCESS_TRANSFER_READ_BIT,
+ origLayout, VK_IMAGE_LAYOUT_TRANSFER_DST_OPTIMAL,
+ origAccess, VK_ACCESS_TRANSFER_WRITE_BIT,
origStage, VK_PIPELINE_STAGE_TRANSFER_BIT,
- u.layer, 1,
- level - 1, 1);
- } else {
- subresourceBarrier(cbD, utexD->image,
- VK_IMAGE_LAYOUT_TRANSFER_DST_OPTIMAL, VK_IMAGE_LAYOUT_TRANSFER_SRC_OPTIMAL,
- VK_ACCESS_TRANSFER_WRITE_BIT, VK_ACCESS_TRANSFER_READ_BIT,
- VK_PIPELINE_STAGE_TRANSFER_BIT, VK_PIPELINE_STAGE_TRANSFER_BIT,
- u.layer, 1,
- level - 1, 1);
+ layer, 1,
+ level, 1);
+
+ VkImageBlit region = {};
+ region.srcSubresource.aspectMask = VK_IMAGE_ASPECT_COLOR_BIT;
+ region.srcSubresource.mipLevel = uint32_t(level) - 1;
+ region.srcSubresource.baseArrayLayer = uint32_t(layer);
+ region.srcSubresource.layerCount = 1;
+
+ region.srcOffsets[1].x = qMax(1, w);
+ region.srcOffsets[1].y = qMax(1, h);
+ region.srcOffsets[1].z = qMax(1, depth);
+
+ region.dstSubresource.aspectMask = VK_IMAGE_ASPECT_COLOR_BIT;
+ region.dstSubresource.mipLevel = uint32_t(level);
+ region.dstSubresource.baseArrayLayer = uint32_t(layer);
+ region.dstSubresource.layerCount = 1;
+
+ region.dstOffsets[1].x = qMax(1, w >> 1);
+ region.dstOffsets[1].y = qMax(1, h >> 1);
+ region.dstOffsets[1].z = qMax(1, depth >> 1);
+
+ QVkCommandBuffer::Command &cmd(cbD->commands.get());
+ cmd.cmd = QVkCommandBuffer::Command::BlitImage;
+ cmd.args.blitImage.src = utexD->image;
+ cmd.args.blitImage.srcLayout = VK_IMAGE_LAYOUT_TRANSFER_SRC_OPTIMAL;
+ cmd.args.blitImage.dst = utexD->image;
+ cmd.args.blitImage.dstLayout = VK_IMAGE_LAYOUT_TRANSFER_DST_OPTIMAL;
+ cmd.args.blitImage.filter = VK_FILTER_LINEAR;
+ cmd.args.blitImage.desc = region;
+
+ w >>= 1;
+ h >>= 1;
+ depth >>= 1;
}
- subresourceBarrier(cbD, utexD->image,
- origLayout, VK_IMAGE_LAYOUT_TRANSFER_DST_OPTIMAL,
- origAccess, VK_ACCESS_TRANSFER_WRITE_BIT,
- origStage, VK_PIPELINE_STAGE_TRANSFER_BIT,
- u.layer, 1,
- level, 1);
-
- VkImageBlit region;
- memset(&region, 0, sizeof(region));
-
- region.srcSubresource.aspectMask = VK_IMAGE_ASPECT_COLOR_BIT;
- region.srcSubresource.mipLevel = uint32_t(level) - 1;
- region.srcSubresource.baseArrayLayer = uint32_t(u.layer);
- region.srcSubresource.layerCount = 1;
-
- region.srcOffsets[1].x = qMax(1, w);
- region.srcOffsets[1].y = qMax(1, h);
- region.srcOffsets[1].z = 1;
-
- region.dstSubresource.aspectMask = VK_IMAGE_ASPECT_COLOR_BIT;
- region.dstSubresource.mipLevel = uint32_t(level);
- region.dstSubresource.baseArrayLayer = uint32_t(u.layer);
- region.dstSubresource.layerCount = 1;
-
- region.dstOffsets[1].x = qMax(1, w >> 1);
- region.dstOffsets[1].y = qMax(1, h >> 1);
- region.dstOffsets[1].z = 1;
-
- QVkCommandBuffer::Command cmd;
- cmd.cmd = QVkCommandBuffer::Command::BlitImage;
- cmd.args.blitImage.src = utexD->image;
- cmd.args.blitImage.srcLayout = VK_IMAGE_LAYOUT_TRANSFER_SRC_OPTIMAL;
- cmd.args.blitImage.dst = utexD->image;
- cmd.args.blitImage.dstLayout = VK_IMAGE_LAYOUT_TRANSFER_DST_OPTIMAL;
- cmd.args.blitImage.filter = VK_FILTER_LINEAR;
- cmd.args.blitImage.desc = region;
- cbD->commands.append(cmd);
-
- w >>= 1;
- h >>= 1;
- }
-
- if (utexD->mipLevelCount > 1) {
- subresourceBarrier(cbD, utexD->image,
- VK_IMAGE_LAYOUT_TRANSFER_SRC_OPTIMAL, origLayout,
- VK_ACCESS_TRANSFER_READ_BIT, origAccess,
- VK_PIPELINE_STAGE_TRANSFER_BIT, origStage,
- u.layer, 1,
- 0, int(utexD->mipLevelCount) - 1);
- subresourceBarrier(cbD, utexD->image,
- VK_IMAGE_LAYOUT_TRANSFER_DST_OPTIMAL, origLayout,
- VK_ACCESS_TRANSFER_WRITE_BIT, origAccess,
- VK_PIPELINE_STAGE_TRANSFER_BIT, origStage,
- u.layer, 1,
- int(utexD->mipLevelCount) - 1, 1);
+ if (utexD->mipLevelCount > 1) {
+ subresourceBarrier(cbD, utexD->image,
+ VK_IMAGE_LAYOUT_TRANSFER_SRC_OPTIMAL, origLayout,
+ VK_ACCESS_TRANSFER_READ_BIT, origAccess,
+ VK_PIPELINE_STAGE_TRANSFER_BIT, origStage,
+ layer, 1,
+ 0, int(utexD->mipLevelCount) - 1);
+ subresourceBarrier(cbD, utexD->image,
+ VK_IMAGE_LAYOUT_TRANSFER_DST_OPTIMAL, origLayout,
+ VK_ACCESS_TRANSFER_WRITE_BIT, origAccess,
+ VK_PIPELINE_STAGE_TRANSFER_BIT, origStage,
+ layer, 1,
+ int(utexD->mipLevelCount) - 1, 1);
+ }
}
-
utexD->lastActiveFrameSlot = currentFrameSlot;
}
}
@@ -3143,14 +4057,14 @@ void QRhiVulkan::enqueueResourceUpdates(QVkCommandBuffer *cbD, QRhiResourceUpdat
ud->free();
}
-void QRhiVulkan::executeBufferHostWritesForCurrentFrame(QVkBuffer *bufD)
+void QRhiVulkan::executeBufferHostWritesForSlot(QVkBuffer *bufD, int slot)
{
- if (bufD->pendingDynamicUpdates[currentFrameSlot].isEmpty())
+ if (bufD->pendingDynamicUpdates[slot].isEmpty())
return;
Q_ASSERT(bufD->m_type == QRhiBuffer::Dynamic);
void *p = nullptr;
- VmaAllocation a = toVmaAllocation(bufD->allocations[currentFrameSlot]);
+ VmaAllocation a = toVmaAllocation(bufD->allocations[slot]);
// The vmaMap/Unmap are basically a no-op when persistently mapped since it
// refcounts; this is great because we don't need to care if the allocation
// was created as persistently mapped or not.
@@ -3159,21 +4073,20 @@ void QRhiVulkan::executeBufferHostWritesForCurrentFrame(QVkBuffer *bufD)
qWarning("Failed to map buffer: %d", err);
return;
}
- int changeBegin = -1;
- int changeEnd = -1;
- for (const QRhiResourceUpdateBatchPrivate::BufferOp &u : qAsConst(bufD->pendingDynamicUpdates[currentFrameSlot])) {
- Q_ASSERT(bufD == QRHI_RES(QVkBuffer, u.buf));
- memcpy(static_cast<char *>(p) + u.offset, u.data.constData(), size_t(u.data.size()));
- if (changeBegin == -1 || u.offset < changeBegin)
+ quint32 changeBegin = UINT32_MAX;
+ quint32 changeEnd = 0;
+ for (const QVkBuffer::DynamicUpdate &u : std::as_const(bufD->pendingDynamicUpdates[slot])) {
+ memcpy(static_cast<char *>(p) + u.offset, u.data.constData(), u.data.size());
+ if (u.offset < changeBegin)
changeBegin = u.offset;
- if (changeEnd == -1 || u.offset + u.data.size() > changeEnd)
+ if (u.offset + u.data.size() > changeEnd)
changeEnd = u.offset + u.data.size();
}
+ if (changeBegin < UINT32_MAX && changeBegin < changeEnd)
+ vmaFlushAllocation(toVmaAllocator(allocator), a, changeBegin, changeEnd - changeBegin);
vmaUnmapMemory(toVmaAllocator(allocator), a);
- if (changeBegin >= 0)
- vmaFlushAllocation(toVmaAllocator(allocator), a, VkDeviceSize(changeBegin), VkDeviceSize(changeEnd - changeBegin));
- bufD->pendingDynamicUpdates[currentFrameSlot].clear();
+ bufD->pendingDynamicUpdates[slot].clear();
}
static void qrhivk_releaseBuffer(const QRhiVulkan::DeferredReleaseEntry &e, void *allocator)
@@ -3197,7 +4110,7 @@ static void qrhivk_releaseTexture(const QRhiVulkan::DeferredReleaseEntry &e, VkD
vmaDestroyImage(toVmaAllocator(allocator), e.texture.image, toVmaAllocation(e.texture.allocation));
for (int i = 0; i < QVK_FRAMES_IN_FLIGHT; ++i)
vmaDestroyBuffer(toVmaAllocator(allocator), e.texture.stagingBuffers[i], toVmaAllocation(e.texture.stagingAllocations[i]));
- for (int i = 0; i < QRhi::MAX_LEVELS; ++i) {
+ for (int i = 0; i < QRhi::MAX_MIP_LEVELS; ++i) {
if (e.texture.extraImageViews[i])
df->vkDestroyImageView(dev, e.texture.extraImageViews[i], nullptr);
}
@@ -3210,7 +4123,7 @@ static void qrhivk_releaseSampler(const QRhiVulkan::DeferredReleaseEntry &e, VkD
void QRhiVulkan::executeDeferredReleases(bool forced)
{
- for (int i = releaseQueue.count() - 1; i >= 0; --i) {
+ for (int i = releaseQueue.size() - 1; i >= 0; --i) {
const QRhiVulkan::DeferredReleaseEntry &e(releaseQueue[i]);
if (forced || currentFrameSlot == e.lastActiveFrameSlot || e.lastActiveFrameSlot < 0) {
switch (e.type) {
@@ -3243,6 +4156,8 @@ void QRhiVulkan::executeDeferredReleases(bool forced)
df->vkDestroyImageView(dev, e.textureRenderTarget.rtv[att], nullptr);
df->vkDestroyImageView(dev, e.textureRenderTarget.resrtv[att], nullptr);
}
+ df->vkDestroyImageView(dev, e.textureRenderTarget.dsv, nullptr);
+ df->vkDestroyImageView(dev, e.textureRenderTarget.resdsv, nullptr);
break;
case QRhiVulkan::DeferredReleaseEntry::RenderPass:
df->vkDestroyRenderPass(dev, e.renderPass.rp, nullptr);
@@ -3250,8 +4165,8 @@ void QRhiVulkan::executeDeferredReleases(bool forced)
case QRhiVulkan::DeferredReleaseEntry::StagingBuffer:
vmaDestroyBuffer(toVmaAllocator(allocator), e.stagingBuffer.stagingBuffer, toVmaAllocation(e.stagingBuffer.stagingAllocation));
break;
- case QRhiVulkan::DeferredReleaseEntry::CommandBuffer:
- df->vkFreeCommandBuffers(dev, cmdPool, 1, &e.commandBuffer.cb);
+ case QRhiVulkan::DeferredReleaseEntry::SecondaryCommandBuffer:
+ freeSecondaryCbs[e.lastActiveFrameSlot].append(e.secondaryCommandBuffer.cb);
break;
default:
Q_UNREACHABLE();
@@ -3265,9 +4180,8 @@ void QRhiVulkan::executeDeferredReleases(bool forced)
void QRhiVulkan::finishActiveReadbacks(bool forced)
{
QVarLengthArray<std::function<void()>, 4> completedCallbacks;
- QRhiProfilerPrivate *rhiP = profilerPrivateOrNull();
- for (int i = activeTextureReadbacks.count() - 1; i >= 0; --i) {
+ for (int i = activeTextureReadbacks.size() - 1; i >= 0; --i) {
const QRhiVulkan::TextureReadback &readback(activeTextureReadbacks[i]);
if (forced || currentFrameSlot == readback.activeFrameSlot || readback.activeFrameSlot < 0) {
readback.result->format = readback.format;
@@ -3284,16 +4198,15 @@ void QRhiVulkan::finishActiveReadbacks(bool forced)
}
vmaDestroyBuffer(toVmaAllocator(allocator), readback.stagingBuf, a);
- QRHI_PROF_F(releaseReadbackBuffer(qint64(readback.stagingBuf)));
if (readback.result->completed)
completedCallbacks.append(readback.result->completed);
- activeTextureReadbacks.removeAt(i);
+ activeTextureReadbacks.removeLast();
}
}
- for (int i = activeBufferReadbacks.count() - 1; i >= 0; --i) {
+ for (int i = activeBufferReadbacks.size() - 1; i >= 0; --i) {
const QRhiVulkan::BufferReadback &readback(activeBufferReadbacks[i]);
if (forced || currentFrameSlot == readback.activeFrameSlot || readback.activeFrameSlot < 0) {
VmaAllocation a = toVmaAllocation(readback.stagingAlloc);
@@ -3301,19 +4214,18 @@ void QRhiVulkan::finishActiveReadbacks(bool forced)
VkResult err = vmaMapMemory(toVmaAllocator(allocator), a, &p);
if (err == VK_SUCCESS && p) {
readback.result->data.resize(readback.byteSize);
- memcpy(readback.result->data.data(), p, size_t(readback.byteSize));
+ memcpy(readback.result->data.data(), p, readback.byteSize);
vmaUnmapMemory(toVmaAllocator(allocator), a);
} else {
qWarning("Failed to map buffer readback buffer of size %d: %d", readback.byteSize, err);
}
vmaDestroyBuffer(toVmaAllocator(allocator), readback.stagingBuf, a);
- QRHI_PROF_F(releaseReadbackBuffer(qint64(readback.stagingBuf)));
if (readback.result->completed)
completedCallbacks.append(readback.result->completed);
- activeBufferReadbacks.removeAt(i);
+ activeBufferReadbacks.removeLast();
}
}
@@ -3335,13 +4247,13 @@ static struct {
{ VK_SAMPLE_COUNT_64_BIT, 64 }
};
-QVector<int> QRhiVulkan::supportedSampleCounts() const
+QList<int> QRhiVulkan::supportedSampleCounts() const
{
const VkPhysicalDeviceLimits *limits = &physDevProperties.limits;
VkSampleCountFlags color = limits->framebufferColorSampleCounts;
VkSampleCountFlags depth = limits->framebufferDepthSampleCounts;
VkSampleCountFlags stencil = limits->framebufferStencilSampleCounts;
- QVector<int> result;
+ QList<int> result;
for (const auto &qvk_sampleCount : qvk_sampleCounts) {
if ((color & qvk_sampleCount.mask)
@@ -3355,41 +4267,34 @@ QVector<int> QRhiVulkan::supportedSampleCounts() const
return result;
}
-VkSampleCountFlagBits QRhiVulkan::effectiveSampleCount(int sampleCount)
+VkSampleCountFlagBits QRhiVulkan::effectiveSampleCountBits(int sampleCount)
{
- // Stay compatible with QSurfaceFormat and friends where samples == 0 means the same as 1.
- sampleCount = qBound(1, sampleCount, 64);
-
- if (!supportedSampleCounts().contains(sampleCount)) {
- qWarning("Attempted to set unsupported sample count %d", sampleCount);
- return VK_SAMPLE_COUNT_1_BIT;
- }
+ const int s = effectiveSampleCount(sampleCount);
for (const auto &qvk_sampleCount : qvk_sampleCounts) {
- if (qvk_sampleCount.count == sampleCount)
+ if (qvk_sampleCount.count == s)
return qvk_sampleCount.mask;
}
- Q_UNREACHABLE();
- return VK_SAMPLE_COUNT_1_BIT;
+ Q_UNREACHABLE_RETURN(VK_SAMPLE_COUNT_1_BIT);
}
void QRhiVulkan::enqueueTransitionPassResources(QVkCommandBuffer *cbD)
{
cbD->passResTrackers.append(QRhiPassResourceTracker());
- cbD->currentPassResTrackerIndex = cbD->passResTrackers.count() - 1;
+ cbD->currentPassResTrackerIndex = cbD->passResTrackers.size() - 1;
- QVkCommandBuffer::Command cmd;
+ QVkCommandBuffer::Command &cmd(cbD->commands.get());
cmd.cmd = QVkCommandBuffer::Command::TransitionPassResources;
- cmd.args.transitionResources.trackerIndex = cbD->passResTrackers.count() - 1;
- cbD->commands.append(cmd);
+ cmd.args.transitionResources.trackerIndex = cbD->passResTrackers.size() - 1;
}
void QRhiVulkan::recordPrimaryCommandBuffer(QVkCommandBuffer *cbD)
{
Q_ASSERT(cbD->recordingPass == QVkCommandBuffer::NoPass);
- for (QVkCommandBuffer::Command &cmd : cbD->commands) {
+ for (auto it = cbD->commands.begin(), end = cbD->commands.end(); it != end; ++it) {
+ QVkCommandBuffer::Command &cmd(*it);
switch (cmd.cmd) {
case QVkCommandBuffer::Command::CopyBuffer:
df->vkCmdCopyBuffer(cbD->cb, cmd.args.copyBuffer.src, cmd.args.copyBuffer.dst,
@@ -3414,12 +4319,12 @@ void QRhiVulkan::recordPrimaryCommandBuffer(QVkCommandBuffer *cbD)
case QVkCommandBuffer::Command::ImageBarrier:
df->vkCmdPipelineBarrier(cbD->cb, cmd.args.imageBarrier.srcStageMask, cmd.args.imageBarrier.dstStageMask,
0, 0, nullptr, 0, nullptr,
- 1, &cmd.args.imageBarrier.desc);
+ cmd.args.imageBarrier.count, cbD->pools.imageBarrier.constData() + cmd.args.imageBarrier.index);
break;
case QVkCommandBuffer::Command::BufferBarrier:
df->vkCmdPipelineBarrier(cbD->cb, cmd.args.bufferBarrier.srcStageMask, cmd.args.bufferBarrier.dstStageMask,
0, 0, nullptr,
- 1, &cmd.args.bufferBarrier.desc,
+ cmd.args.bufferBarrier.count, cbD->pools.bufferBarrier.constData() + cmd.args.bufferBarrier.index,
0, nullptr);
break;
case QVkCommandBuffer::Command::BlitImage:
@@ -3431,7 +4336,8 @@ void QRhiVulkan::recordPrimaryCommandBuffer(QVkCommandBuffer *cbD)
case QVkCommandBuffer::Command::BeginRenderPass:
cmd.args.beginRenderPass.desc.pClearValues = cbD->pools.clearValue.constData() + cmd.args.beginRenderPass.clearValueIndex;
df->vkCmdBeginRenderPass(cbD->cb, &cmd.args.beginRenderPass.desc,
- cbD->useSecondaryCb ? VK_SUBPASS_CONTENTS_SECONDARY_COMMAND_BUFFERS : VK_SUBPASS_CONTENTS_INLINE);
+ cmd.args.beginRenderPass.useSecondaryCb ? VK_SUBPASS_CONTENTS_SECONDARY_COMMAND_BUFFERS
+ : VK_SUBPASS_CONTENTS_INLINE);
break;
case QVkCommandBuffer::Command::EndRenderPass:
df->vkCmdEndRenderPass(cbD->cb);
@@ -3483,17 +4389,23 @@ void QRhiVulkan::recordPrimaryCommandBuffer(QVkCommandBuffer *cbD)
cmd.args.drawIndexed.firstInstance);
break;
case QVkCommandBuffer::Command::DebugMarkerBegin:
- cmd.args.debugMarkerBegin.marker.pMarkerName =
- cbD->pools.debugMarkerData[cmd.args.debugMarkerBegin.markerNameIndex].constData();
- vkCmdDebugMarkerBegin(cbD->cb, &cmd.args.debugMarkerBegin.marker);
+#ifdef VK_EXT_debug_utils
+ cmd.args.debugMarkerBegin.label.pLabelName =
+ cbD->pools.debugMarkerData[cmd.args.debugMarkerBegin.labelNameIndex].constData();
+ vkCmdBeginDebugUtilsLabelEXT(cbD->cb, &cmd.args.debugMarkerBegin.label);
+#endif
break;
case QVkCommandBuffer::Command::DebugMarkerEnd:
- vkCmdDebugMarkerEnd(cbD->cb);
+#ifdef VK_EXT_debug_utils
+ vkCmdEndDebugUtilsLabelEXT(cbD->cb);
+#endif
break;
case QVkCommandBuffer::Command::DebugMarkerInsert:
- cmd.args.debugMarkerInsert.marker.pMarkerName =
- cbD->pools.debugMarkerData[cmd.args.debugMarkerInsert.markerNameIndex].constData();
- vkCmdDebugMarkerInsert(cbD->cb, &cmd.args.debugMarkerInsert.marker);
+#ifdef VK_EXT_debug_utils
+ cmd.args.debugMarkerInsert.label.pLabelName =
+ cbD->pools.debugMarkerData[cmd.args.debugMarkerInsert.labelNameIndex].constData();
+ vkCmdInsertDebugUtilsLabelEXT(cbD->cb, &cmd.args.debugMarkerInsert.label);
+#endif
break;
case QVkCommandBuffer::Command::TransitionPassResources:
recordTransitionPassResources(cbD, cbD->passResTrackers[cmd.args.transitionResources.trackerIndex]);
@@ -3539,10 +4451,16 @@ static inline VkPipelineStageFlags toVkPipelineStage(QRhiPassResourceTracker::Bu
return VK_PIPELINE_STAGE_VERTEX_INPUT_BIT;
case QRhiPassResourceTracker::BufVertexStage:
return VK_PIPELINE_STAGE_VERTEX_SHADER_BIT;
+ case QRhiPassResourceTracker::BufTCStage:
+ return VK_PIPELINE_STAGE_TESSELLATION_CONTROL_SHADER_BIT;
+ case QRhiPassResourceTracker::BufTEStage:
+ return VK_PIPELINE_STAGE_TESSELLATION_EVALUATION_SHADER_BIT;
case QRhiPassResourceTracker::BufFragmentStage:
return VK_PIPELINE_STAGE_FRAGMENT_SHADER_BIT;
case QRhiPassResourceTracker::BufComputeStage:
return VK_PIPELINE_STAGE_COMPUTE_SHADER_BIT;
+ case QRhiPassResourceTracker::BufGeometryStage:
+ return VK_PIPELINE_STAGE_GEOMETRY_SHADER_BIT;
default:
Q_UNREACHABLE();
break;
@@ -3568,9 +4486,7 @@ static inline VkImageLayout toVkLayout(QRhiPassResourceTracker::TextureAccess ac
case QRhiPassResourceTracker::TexDepthOutput:
return VK_IMAGE_LAYOUT_DEPTH_STENCIL_ATTACHMENT_OPTIMAL;
case QRhiPassResourceTracker::TexStorageLoad:
- Q_FALLTHROUGH();
case QRhiPassResourceTracker::TexStorageStore:
- Q_FALLTHROUGH();
case QRhiPassResourceTracker::TexStorageLoadStore:
return VK_IMAGE_LAYOUT_GENERAL;
default:
@@ -3607,6 +4523,10 @@ static inline VkPipelineStageFlags toVkPipelineStage(QRhiPassResourceTracker::Te
switch (stage) {
case QRhiPassResourceTracker::TexVertexStage:
return VK_PIPELINE_STAGE_VERTEX_SHADER_BIT;
+ case QRhiPassResourceTracker::TexTCStage:
+ return VK_PIPELINE_STAGE_TESSELLATION_CONTROL_SHADER_BIT;
+ case QRhiPassResourceTracker::TexTEStage:
+ return VK_PIPELINE_STAGE_TESSELLATION_EVALUATION_SHADER_BIT;
case QRhiPassResourceTracker::TexFragmentStage:
return VK_PIPELINE_STAGE_FRAGMENT_SHADER_BIT;
case QRhiPassResourceTracker::TexColorOutputStage:
@@ -3615,6 +4535,8 @@ static inline VkPipelineStageFlags toVkPipelineStage(QRhiPassResourceTracker::Te
return VK_PIPELINE_STAGE_LATE_FRAGMENT_TESTS_BIT;
case QRhiPassResourceTracker::TexComputeStage:
return VK_PIPELINE_STAGE_COMPUTE_SHADER_BIT;
+ case QRhiPassResourceTracker::TexGeometryStage:
+ return VK_PIPELINE_STAGE_GEOMETRY_SHADER_BIT;
default:
Q_UNREACHABLE();
break;
@@ -3638,9 +4560,15 @@ void QRhiVulkan::trackedRegisterBuffer(QRhiPassResourceTracker *passResTracker,
QRhiPassResourceTracker::BufferStage stage)
{
QVkBuffer::UsageState &u(bufD->usageState[slot]);
+ const VkAccessFlags newAccess = toVkAccess(access);
+ const VkPipelineStageFlags newStage = toVkPipelineStage(stage);
+ if (u.access == newAccess && u.stage == newStage) {
+ if (!accessIsWrite(access))
+ return;
+ }
passResTracker->registerBuffer(bufD, slot, &access, &stage, toPassTrackerUsageState(u));
- u.access = toVkAccess(access);
- u.stage = toVkPipelineStage(stage);
+ u.access = newAccess;
+ u.stage = newStage;
}
void QRhiVulkan::trackedRegisterTexture(QRhiPassResourceTracker *passResTracker,
@@ -3649,10 +4577,17 @@ void QRhiVulkan::trackedRegisterTexture(QRhiPassResourceTracker *passResTracker,
QRhiPassResourceTracker::TextureStage stage)
{
QVkTexture::UsageState &u(texD->usageState);
+ const VkAccessFlags newAccess = toVkAccess(access);
+ const VkPipelineStageFlags newStage = toVkPipelineStage(stage);
+ const VkImageLayout newLayout = toVkLayout(access);
+ if (u.access == newAccess && u.stage == newStage && u.layout == newLayout) {
+ if (!accessIsWrite(access))
+ return;
+ }
passResTracker->registerTexture(texD, &access, &stage, toPassTrackerUsageState(u));
- u.layout = toVkLayout(access);
- u.access = toVkAccess(access);
- u.stage = toVkPipelineStage(stage);
+ u.layout = newLayout;
+ u.access = newAccess;
+ u.stage = newStage;
}
void QRhiVulkan::recordTransitionPassResources(QVkCommandBuffer *cbD, const QRhiPassResourceTracker &tracker)
@@ -3671,8 +4606,7 @@ void QRhiVulkan::recordTransitionPassResources(QVkCommandBuffer *cbD, const QRhi
if (!accessIsWrite(access))
continue;
}
- VkBufferMemoryBarrier bufMemBarrier;
- memset(&bufMemBarrier, 0, sizeof(bufMemBarrier));
+ VkBufferMemoryBarrier bufMemBarrier = {};
bufMemBarrier.sType = VK_STRUCTURE_TYPE_BUFFER_MEMORY_BARRIER;
bufMemBarrier.srcQueueFamilyIndex = VK_QUEUE_FAMILY_IGNORED;
bufMemBarrier.dstQueueFamilyIndex = VK_QUEUE_FAMILY_IGNORED;
@@ -3696,11 +4630,9 @@ void QRhiVulkan::recordTransitionPassResources(QVkCommandBuffer *cbD, const QRhi
if (!accessIsWrite(access))
continue;
}
- VkImageMemoryBarrier barrier;
- memset(&barrier, 0, sizeof(barrier));
+ VkImageMemoryBarrier barrier = {};
barrier.sType = VK_STRUCTURE_TYPE_IMAGE_MEMORY_BARRIER;
- barrier.subresourceRange.aspectMask = !isDepthTextureFormat(texD->m_format)
- ? VK_IMAGE_ASPECT_COLOR_BIT : VK_IMAGE_ASPECT_DEPTH_BIT;
+ barrier.subresourceRange.aspectMask = aspectMaskForTextureFormat(texD->m_format);
barrier.subresourceRange.baseMipLevel = 0;
barrier.subresourceRange.levelCount = VK_REMAINING_MIP_LEVELS;
barrier.subresourceRange.baseArrayLayer = 0;
@@ -3723,10 +4655,18 @@ void QRhiVulkan::recordTransitionPassResources(QVkCommandBuffer *cbD, const QRhi
QRhiSwapChain *QRhiVulkan::createSwapChain()
{
+ if (!vkGetPhysicalDeviceSurfaceCapabilitiesKHR
+ || !vkGetPhysicalDeviceSurfaceFormatsKHR
+ || !vkGetPhysicalDeviceSurfacePresentModesKHR)
+ {
+ qWarning("Physical device surface queries not available");
+ return nullptr;
+ }
+
return new QVkSwapChain(this);
}
-QRhiBuffer *QRhiVulkan::createBuffer(QRhiBuffer::Type type, QRhiBuffer::UsageFlags usage, int size)
+QRhiBuffer *QRhiVulkan::createBuffer(QRhiBuffer::Type type, QRhiBuffer::UsageFlags usage, quint32 size)
{
return new QVkBuffer(this, type, usage, size);
}
@@ -3800,13 +4740,13 @@ bool QRhiVulkan::isFeatureSupported(QRhi::Feature feature) const
case QRhi::MultisampleRenderBuffer:
return true;
case QRhi::DebugMarkers:
- return debugMarkersAvailable;
+ return caps.debugUtils;
case QRhi::Timestamps:
return timestampValidBits != 0;
case QRhi::Instancing:
return true;
case QRhi::CustomInstanceStepRate:
- return vertexAttribDivisorAvailable;
+ return caps.vertexAttribDivisor;
case QRhi::PrimitiveRestart:
return true;
case QRhi::NonDynamicUniformBuffers:
@@ -3820,9 +4760,9 @@ bool QRhiVulkan::isFeatureSupported(QRhi::Feature feature) const
case QRhi::ElementIndexUint:
return true;
case QRhi::Compute:
- return hasCompute;
+ return caps.compute;
case QRhi::WideLines:
- return hasWideLines;
+ return caps.wideLines;
case QRhi::VertexShaderPointSize:
return true;
case QRhi::BaseVertex:
@@ -3835,9 +4775,54 @@ bool QRhiVulkan::isFeatureSupported(QRhi::Feature feature) const
return true;
case QRhi::ReadBackNonBaseMipLevel:
return true;
- default:
- Q_UNREACHABLE();
+ case QRhi::TexelFetch:
+ return true;
+ case QRhi::RenderToNonBaseMipLevel:
+ return true;
+ case QRhi::IntAttributes:
+ return true;
+ case QRhi::ScreenSpaceDerivatives:
+ return true;
+ case QRhi::ReadBackAnyTextureFormat:
+ return true;
+ case QRhi::PipelineCacheDataLoadSave:
+ return true;
+ case QRhi::ImageDataStride:
+ return true;
+ case QRhi::RenderBufferImport:
return false;
+ case QRhi::ThreeDimensionalTextures:
+ return true;
+ case QRhi::RenderTo3DTextureSlice:
+ return caps.texture3DSliceAs2D;
+ case QRhi::TextureArrays:
+ return true;
+ case QRhi::Tessellation:
+ return caps.tessellation;
+ case QRhi::GeometryShader:
+ return caps.geometryShader;
+ case QRhi::TextureArrayRange:
+ return true;
+ case QRhi::NonFillPolygonMode:
+ return caps.nonFillPolygonMode;
+ case QRhi::OneDimensionalTextures:
+ return true;
+ case QRhi::OneDimensionalTextureMipmaps:
+ return true;
+ case QRhi::HalfAttributes:
+ return true;
+ case QRhi::RenderToOneDimensionalTexture:
+ return true;
+ case QRhi::ThreeDimensionalTextureMipmaps:
+ return true;
+ case QRhi::MultiView:
+ return caps.multiView;
+ case QRhi::TextureViewFormat:
+ return true;
+ case QRhi::ResolveDepthStencil:
+ return caps.renderPass2KHR && caps.depthStencilResolveKHR;
+ default:
+ Q_UNREACHABLE_RETURN(false);
}
}
@@ -3852,9 +4837,30 @@ int QRhiVulkan::resourceLimit(QRhi::ResourceLimit limit) const
return int(physDevProperties.limits.maxColorAttachments);
case QRhi::FramesInFlight:
return QVK_FRAMES_IN_FLIGHT;
+ case QRhi::MaxAsyncReadbackFrames:
+ return QVK_FRAMES_IN_FLIGHT;
+ case QRhi::MaxThreadGroupsPerDimension:
+ return int(qMin(physDevProperties.limits.maxComputeWorkGroupCount[0],
+ qMin(physDevProperties.limits.maxComputeWorkGroupCount[1],
+ physDevProperties.limits.maxComputeWorkGroupCount[2])));
+ case QRhi::MaxThreadsPerThreadGroup:
+ return int(physDevProperties.limits.maxComputeWorkGroupInvocations);
+ case QRhi::MaxThreadGroupX:
+ return int(physDevProperties.limits.maxComputeWorkGroupSize[0]);
+ case QRhi::MaxThreadGroupY:
+ return int(physDevProperties.limits.maxComputeWorkGroupSize[1]);
+ case QRhi::MaxThreadGroupZ:
+ return int(physDevProperties.limits.maxComputeWorkGroupSize[2]);
+ case QRhi::TextureArraySizeMax:
+ return int(physDevProperties.limits.maxImageArrayLayers);
+ case QRhi::MaxUniformBufferRange:
+ return int(qMin<uint32_t>(INT_MAX, physDevProperties.limits.maxUniformBufferRange));
+ case QRhi::MaxVertexInputs:
+ return physDevProperties.limits.maxVertexInputAttributes;
+ case QRhi::MaxVertexOutputs:
+ return physDevProperties.limits.maxVertexOutputComponents / 4;
default:
- Q_UNREACHABLE();
- return 0;
+ Q_UNREACHABLE_RETURN(0);
}
}
@@ -3863,16 +4869,29 @@ const QRhiNativeHandles *QRhiVulkan::nativeHandles()
return &nativeHandlesStruct;
}
-void QRhiVulkan::sendVMemStatsToProfiler()
+QRhiDriverInfo QRhiVulkan::driverInfo() const
{
- QRhiProfilerPrivate *rhiP = profilerPrivateOrNull();
- if (!rhiP)
- return;
+ return driverInfoStruct;
+}
- VmaStats stats;
- vmaCalculateStats(toVmaAllocator(allocator), &stats);
- QRHI_PROF_F(vmemStat(stats.total.blockCount, stats.total.allocationCount,
- quint32(stats.total.usedBytes), quint32(stats.total.unusedBytes)));
+QRhiStats QRhiVulkan::statistics()
+{
+ QRhiStats result;
+ result.totalPipelineCreationTime = totalPipelineCreationTime();
+
+ VmaBudget budgets[VK_MAX_MEMORY_HEAPS];
+ vmaGetHeapBudgets(toVmaAllocator(allocator), budgets);
+
+ uint32_t count = toVmaAllocator(allocator)->GetMemoryHeapCount();
+ for (uint32_t i = 0; i < count; ++i) {
+ const VmaStatistics &stats(budgets[i].statistics);
+ result.blockCount += stats.blockCount;
+ result.allocCount += stats.allocationCount;
+ result.usedBytes += stats.allocationBytes;
+ result.unusedBytes += stats.blockBytes - stats.allocationBytes;
+ }
+
+ return result;
}
bool QRhiVulkan::makeThreadLocalNativeContextCurrent()
@@ -3883,7 +4902,7 @@ bool QRhiVulkan::makeThreadLocalNativeContextCurrent()
void QRhiVulkan::releaseCachedResources()
{
- // nothing to do here
+ releaseCachedResourcesCalledBeforeFrameStart = true;
}
bool QRhiVulkan::isDeviceLost() const
@@ -3891,23 +4910,149 @@ bool QRhiVulkan::isDeviceLost() const
return deviceLost;
}
+struct QVkPipelineCacheDataHeader
+{
+ quint32 rhiId;
+ quint32 arch;
+ quint32 driverVersion;
+ quint32 vendorId;
+ quint32 deviceId;
+ quint32 dataSize;
+ quint32 uuidSize;
+ quint32 reserved;
+};
+
+QByteArray QRhiVulkan::pipelineCacheData()
+{
+ Q_STATIC_ASSERT(sizeof(QVkPipelineCacheDataHeader) == 32);
+
+ QByteArray data;
+ if (!pipelineCache || !rhiFlags.testFlag(QRhi::EnablePipelineCacheDataSave))
+ return data;
+
+ size_t dataSize = 0;
+ VkResult err = df->vkGetPipelineCacheData(dev, pipelineCache, &dataSize, nullptr);
+ if (err != VK_SUCCESS) {
+ qCDebug(QRHI_LOG_INFO, "Failed to get pipeline cache data size: %d", err);
+ return QByteArray();
+ }
+ const size_t headerSize = sizeof(QVkPipelineCacheDataHeader);
+ const size_t dataOffset = headerSize + VK_UUID_SIZE;
+ data.resize(dataOffset + dataSize);
+ err = df->vkGetPipelineCacheData(dev, pipelineCache, &dataSize, data.data() + dataOffset);
+ if (err != VK_SUCCESS) {
+ qCDebug(QRHI_LOG_INFO, "Failed to get pipeline cache data of %d bytes: %d", int(dataSize), err);
+ return QByteArray();
+ }
+
+ QVkPipelineCacheDataHeader header;
+ header.rhiId = pipelineCacheRhiId();
+ header.arch = quint32(sizeof(void*));
+ header.driverVersion = physDevProperties.driverVersion;
+ header.vendorId = physDevProperties.vendorID;
+ header.deviceId = physDevProperties.deviceID;
+ header.dataSize = quint32(dataSize);
+ header.uuidSize = VK_UUID_SIZE;
+ header.reserved = 0;
+ memcpy(data.data(), &header, headerSize);
+ memcpy(data.data() + headerSize, physDevProperties.pipelineCacheUUID, VK_UUID_SIZE);
+
+ return data;
+}
+
+void QRhiVulkan::setPipelineCacheData(const QByteArray &data)
+{
+ if (data.isEmpty())
+ return;
+
+ const size_t headerSize = sizeof(QVkPipelineCacheDataHeader);
+ if (data.size() < qsizetype(headerSize)) {
+ qCDebug(QRHI_LOG_INFO, "setPipelineCacheData: Invalid blob size");
+ return;
+ }
+ QVkPipelineCacheDataHeader header;
+ memcpy(&header, data.constData(), headerSize);
+
+ const quint32 rhiId = pipelineCacheRhiId();
+ if (header.rhiId != rhiId) {
+ qCDebug(QRHI_LOG_INFO, "setPipelineCacheData: The data is for a different QRhi version or backend (%u, %u)",
+ rhiId, header.rhiId);
+ return;
+ }
+ const quint32 arch = quint32(sizeof(void*));
+ if (header.arch != arch) {
+ qCDebug(QRHI_LOG_INFO, "setPipelineCacheData: Architecture does not match (%u, %u)",
+ arch, header.arch);
+ return;
+ }
+ if (header.driverVersion != physDevProperties.driverVersion) {
+ qCDebug(QRHI_LOG_INFO, "setPipelineCacheData: driverVersion does not match (%u, %u)",
+ physDevProperties.driverVersion, header.driverVersion);
+ return;
+ }
+ if (header.vendorId != physDevProperties.vendorID) {
+ qCDebug(QRHI_LOG_INFO, "setPipelineCacheData: vendorID does not match (%u, %u)",
+ physDevProperties.vendorID, header.vendorId);
+ return;
+ }
+ if (header.deviceId != physDevProperties.deviceID) {
+ qCDebug(QRHI_LOG_INFO, "setPipelineCacheData: deviceID does not match (%u, %u)",
+ physDevProperties.deviceID, header.deviceId);
+ return;
+ }
+ if (header.uuidSize != VK_UUID_SIZE) {
+ qCDebug(QRHI_LOG_INFO, "setPipelineCacheData: VK_UUID_SIZE does not match (%u, %u)",
+ quint32(VK_UUID_SIZE), header.uuidSize);
+ return;
+ }
+
+ if (data.size() < qsizetype(headerSize + VK_UUID_SIZE)) {
+ qCDebug(QRHI_LOG_INFO, "setPipelineCacheData: Invalid blob, no uuid");
+ return;
+ }
+ if (memcmp(data.constData() + headerSize, physDevProperties.pipelineCacheUUID, VK_UUID_SIZE)) {
+ qCDebug(QRHI_LOG_INFO, "setPipelineCacheData: pipelineCacheUUID does not match");
+ return;
+ }
+
+ const size_t dataOffset = headerSize + VK_UUID_SIZE;
+ if (data.size() < qsizetype(dataOffset + header.dataSize)) {
+ qCDebug(QRHI_LOG_INFO, "setPipelineCacheData: Invalid blob, data missing");
+ return;
+ }
+
+ if (pipelineCache) {
+ df->vkDestroyPipelineCache(dev, pipelineCache, nullptr);
+ pipelineCache = VK_NULL_HANDLE;
+ }
+
+ if (ensurePipelineCache(data.constData() + dataOffset, header.dataSize)) {
+ qCDebug(QRHI_LOG_INFO, "Created pipeline cache with initial data of %d bytes",
+ int(header.dataSize));
+ } else {
+ qCDebug(QRHI_LOG_INFO, "Failed to create pipeline cache with initial data specified");
+ }
+}
+
QRhiRenderBuffer *QRhiVulkan::createRenderBuffer(QRhiRenderBuffer::Type type, const QSize &pixelSize,
- int sampleCount, QRhiRenderBuffer::Flags flags)
+ int sampleCount, QRhiRenderBuffer::Flags flags,
+ QRhiTexture::Format backingFormatHint)
{
- return new QVkRenderBuffer(this, type, pixelSize, sampleCount, flags);
+ return new QVkRenderBuffer(this, type, pixelSize, sampleCount, flags, backingFormatHint);
}
-QRhiTexture *QRhiVulkan::createTexture(QRhiTexture::Format format, const QSize &pixelSize,
+QRhiTexture *QRhiVulkan::createTexture(QRhiTexture::Format format,
+ const QSize &pixelSize, int depth, int arraySize,
int sampleCount, QRhiTexture::Flags flags)
{
- return new QVkTexture(this, format, pixelSize, sampleCount, flags);
+ return new QVkTexture(this, format, pixelSize, depth, arraySize, sampleCount, flags);
}
QRhiSampler *QRhiVulkan::createSampler(QRhiSampler::Filter magFilter, QRhiSampler::Filter minFilter,
QRhiSampler::Filter mipmapMode,
- QRhiSampler::AddressMode u, QRhiSampler::AddressMode v)
+ QRhiSampler::AddressMode u, QRhiSampler::AddressMode v, QRhiSampler::AddressMode w)
{
- return new QVkSampler(this, magFilter, minFilter, mipmapMode, u, v);
+ return new QVkSampler(this, magFilter, minFilter, mipmapMode, u, v, w);
}
QRhiTextureRenderTarget *QRhiVulkan::createTextureRenderTarget(const QRhiTextureRenderTargetDescription &desc,
@@ -3939,14 +5084,13 @@ void QRhiVulkan::setGraphicsPipeline(QRhiCommandBuffer *cb, QRhiGraphicsPipeline
Q_ASSERT(cbD->recordingPass == QVkCommandBuffer::RenderPass);
if (cbD->currentGraphicsPipeline != ps || cbD->currentPipelineGeneration != psD->generation) {
- if (cbD->useSecondaryCb) {
- df->vkCmdBindPipeline(cbD->secondaryCbs.last(), VK_PIPELINE_BIND_POINT_GRAPHICS, psD->pipeline);
+ if (cbD->passUsesSecondaryCb) {
+ df->vkCmdBindPipeline(cbD->activeSecondaryCbStack.last(), VK_PIPELINE_BIND_POINT_GRAPHICS, psD->pipeline);
} else {
- QVkCommandBuffer::Command cmd;
+ QVkCommandBuffer::Command &cmd(cbD->commands.get());
cmd.cmd = QVkCommandBuffer::Command::BindPipeline;
cmd.args.bindPipeline.bindPoint = VK_PIPELINE_BIND_POINT_GRAPHICS;
cmd.args.bindPipeline.pipeline = psD->pipeline;
- cbD->commands.append(cmd);
}
cbD->currentGraphicsPipeline = ps;
@@ -3963,6 +5107,7 @@ void QRhiVulkan::setShaderResources(QRhiCommandBuffer *cb, QRhiShaderResourceBin
{
QVkCommandBuffer *cbD = QRHI_RES(QVkCommandBuffer, cb);
Q_ASSERT(cbD->recordingPass != QVkCommandBuffer::NoPass);
+ QRhiPassResourceTracker &passResTracker(cbD->passResTrackers[cbD->currentPassResTrackerIndex]);
QVkGraphicsPipeline *gfxPsD = QRHI_RES(QVkGraphicsPipeline, cbD->currentGraphicsPipeline);
QVkComputePipeline *compPsD = QRHI_RES(QVkComputePipeline, cbD->currentComputePipeline);
@@ -3974,32 +5119,15 @@ void QRhiVulkan::setShaderResources(QRhiCommandBuffer *cb, QRhiShaderResourceBin
}
QVkShaderResourceBindings *srbD = QRHI_RES(QVkShaderResourceBindings, srb);
- bool hasSlottedResourceInSrb = false;
- bool hasDynamicOffsetInSrb = false;
-
- for (const QRhiShaderResourceBinding &binding : qAsConst(srbD->sortedBindings)) {
- const QRhiShaderResourceBinding::Data *b = binding.data();
- switch (b->type) {
- case QRhiShaderResourceBinding::UniformBuffer:
- if (QRHI_RES(QVkBuffer, b->u.ubuf.buf)->m_type == QRhiBuffer::Dynamic)
- hasSlottedResourceInSrb = true;
- if (b->u.ubuf.hasDynamicOffset)
- hasDynamicOffsetInSrb = true;
- break;
- default:
- break;
- }
- }
-
- const int descSetIdx = hasSlottedResourceInSrb ? currentFrameSlot : 0;
+ const int descSetIdx = srbD->hasSlottedResource ? currentFrameSlot : 0;
+ auto &descSetBd(srbD->boundResourceData[descSetIdx]);
bool rewriteDescSet = false;
// Do host writes and mark referenced shader resources as in-use.
// Also prepare to ensure the descriptor set we are going to bind refers to up-to-date Vk objects.
- for (int i = 0, ie = srbD->sortedBindings.count(); i != ie; ++i) {
- const QRhiShaderResourceBinding::Data *b = srbD->sortedBindings.at(i).data();
- QVkShaderResourceBindings::BoundResourceData &bd(srbD->boundResourceData[descSetIdx][i]);
- QRhiPassResourceTracker &passResTracker(cbD->passResTrackers[cbD->currentPassResTrackerIndex]);
+ for (int i = 0, ie = srbD->sortedBindings.size(); i != ie; ++i) {
+ const QRhiShaderResourceBinding::Data *b = shaderResourceBindingData(srbD->sortedBindings[i]);
+ QVkShaderResourceBindings::BoundResourceData &bd(descSetBd[i]);
switch (b->type) {
case QRhiShaderResourceBinding::UniformBuffer:
{
@@ -4007,7 +5135,7 @@ void QRhiVulkan::setShaderResources(QRhiCommandBuffer *cb, QRhiShaderResourceBin
Q_ASSERT(bufD->m_usage.testFlag(QRhiBuffer::UniformBuffer));
if (bufD->m_type == QRhiBuffer::Dynamic)
- executeBufferHostWritesForCurrentFrame(bufD);
+ executeBufferHostWritesForSlot(bufD, currentFrameSlot);
bufD->lastActiveFrameSlot = currentFrameSlot;
trackedRegisterBuffer(&passResTracker, bufD, bufD->m_type == QRhiBuffer::Dynamic ? currentFrameSlot : 0,
@@ -4026,32 +5154,49 @@ void QRhiVulkan::setShaderResources(QRhiCommandBuffer *cb, QRhiShaderResourceBin
}
break;
case QRhiShaderResourceBinding::SampledTexture:
+ case QRhiShaderResourceBinding::Texture:
+ case QRhiShaderResourceBinding::Sampler:
{
- QVkTexture *texD = QRHI_RES(QVkTexture, b->u.stex.tex);
- QVkSampler *samplerD = QRHI_RES(QVkSampler, b->u.stex.sampler);
- texD->lastActiveFrameSlot = currentFrameSlot;
- samplerD->lastActiveFrameSlot = currentFrameSlot;
- trackedRegisterTexture(&passResTracker, texD,
- QRhiPassResourceTracker::TexSample,
- QRhiPassResourceTracker::toPassTrackerTextureStage(b->stage));
-
- if (texD->generation != bd.stex.texGeneration
- || texD->m_id != bd.stex.texId
- || samplerD->generation != bd.stex.samplerGeneration
- || samplerD->m_id != bd.stex.samplerId)
- {
+ const QRhiShaderResourceBinding::Data::TextureAndOrSamplerData *data = &b->u.stex;
+ if (bd.stex.count != data->count) {
+ bd.stex.count = data->count;
rewriteDescSet = true;
- bd.stex.texId = texD->m_id;
- bd.stex.texGeneration = texD->generation;
- bd.stex.samplerId = samplerD->m_id;
- bd.stex.samplerGeneration = samplerD->generation;
+ }
+ for (int elem = 0; elem < data->count; ++elem) {
+ QVkTexture *texD = QRHI_RES(QVkTexture, data->texSamplers[elem].tex);
+ QVkSampler *samplerD = QRHI_RES(QVkSampler, data->texSamplers[elem].sampler);
+ // We use the same code path for both combined and separate
+ // images and samplers, so tex or sampler (but not both) can be
+ // null here.
+ Q_ASSERT(texD || samplerD);
+ if (texD) {
+ texD->lastActiveFrameSlot = currentFrameSlot;
+ trackedRegisterTexture(&passResTracker, texD,
+ QRhiPassResourceTracker::TexSample,
+ QRhiPassResourceTracker::toPassTrackerTextureStage(b->stage));
+ }
+ if (samplerD)
+ samplerD->lastActiveFrameSlot = currentFrameSlot;
+ const quint64 texId = texD ? texD->m_id : 0;
+ const uint texGen = texD ? texD->generation : 0;
+ const quint64 samplerId = samplerD ? samplerD->m_id : 0;
+ const uint samplerGen = samplerD ? samplerD->generation : 0;
+ if (texGen != bd.stex.d[elem].texGeneration
+ || texId != bd.stex.d[elem].texId
+ || samplerGen != bd.stex.d[elem].samplerGeneration
+ || samplerId != bd.stex.d[elem].samplerId)
+ {
+ rewriteDescSet = true;
+ bd.stex.d[elem].texId = texId;
+ bd.stex.d[elem].texGeneration = texGen;
+ bd.stex.d[elem].samplerId = samplerId;
+ bd.stex.d[elem].samplerGeneration = samplerGen;
+ }
}
}
break;
case QRhiShaderResourceBinding::ImageLoad:
- Q_FALLTHROUGH();
case QRhiShaderResourceBinding::ImageStore:
- Q_FALLTHROUGH();
case QRhiShaderResourceBinding::ImageLoadStore:
{
QVkTexture *texD = QRHI_RES(QVkTexture, b->u.simage.tex);
@@ -4076,16 +5221,14 @@ void QRhiVulkan::setShaderResources(QRhiCommandBuffer *cb, QRhiShaderResourceBin
}
break;
case QRhiShaderResourceBinding::BufferLoad:
- Q_FALLTHROUGH();
case QRhiShaderResourceBinding::BufferStore:
- Q_FALLTHROUGH();
case QRhiShaderResourceBinding::BufferLoadStore:
{
QVkBuffer *bufD = QRHI_RES(QVkBuffer, b->u.sbuf.buf);
Q_ASSERT(bufD->m_usage.testFlag(QRhiBuffer::StorageBuffer));
if (bufD->m_type == QRhiBuffer::Dynamic)
- executeBufferHostWritesForCurrentFrame(bufD);
+ executeBufferHostWritesForSlot(bufD, currentFrameSlot);
bufD->lastActiveFrameSlot = currentFrameSlot;
QRhiPassResourceTracker::BufferAccess access;
@@ -4118,25 +5261,25 @@ void QRhiVulkan::setShaderResources(QRhiCommandBuffer *cb, QRhiShaderResourceBin
// make sure the descriptors for the correct slot will get bound.
// also, dynamic offsets always need a bind.
- const bool forceRebind = (hasSlottedResourceInSrb && cbD->currentDescSetSlot != descSetIdx) || hasDynamicOffsetInSrb;
+ const bool forceRebind = (srbD->hasSlottedResource && cbD->currentDescSetSlot != descSetIdx) || srbD->hasDynamicOffset;
const bool srbChanged = gfxPsD ? (cbD->currentGraphicsSrb != srb) : (cbD->currentComputeSrb != srb);
if (forceRebind || rewriteDescSet || srbChanged || cbD->currentSrbGeneration != srbD->generation) {
QVarLengthArray<uint32_t, 4> dynOfs;
- if (hasDynamicOffsetInSrb) {
+ if (srbD->hasDynamicOffset) {
// Filling out dynOfs based on the sorted bindings is important
// because dynOfs has to be ordered based on the binding numbers,
// and neither srb nor dynamicOffsets has any such ordering
// requirement.
- for (const QRhiShaderResourceBinding &binding : qAsConst(srbD->sortedBindings)) {
- const QRhiShaderResourceBinding::Data *b = binding.data();
+ for (const QRhiShaderResourceBinding &binding : std::as_const(srbD->sortedBindings)) {
+ const QRhiShaderResourceBinding::Data *b = shaderResourceBindingData(binding);
if (b->type == QRhiShaderResourceBinding::UniformBuffer && b->u.ubuf.hasDynamicOffset) {
uint32_t offset = 0;
for (int i = 0; i < dynamicOffsetCount; ++i) {
- const QRhiCommandBuffer::DynamicOffset &dynOfs(dynamicOffsets[i]);
- if (dynOfs.first == b->binding) {
- offset = dynOfs.second;
+ const QRhiCommandBuffer::DynamicOffset &bindingOffsetPair(dynamicOffsets[i]);
+ if (bindingOffsetPair.first == b->binding) {
+ offset = bindingOffsetPair.second;
break;
}
}
@@ -4145,24 +5288,23 @@ void QRhiVulkan::setShaderResources(QRhiCommandBuffer *cb, QRhiShaderResourceBin
}
}
- if (cbD->useSecondaryCb) {
- df->vkCmdBindDescriptorSets(cbD->secondaryCbs.last(),
+ if (cbD->passUsesSecondaryCb) {
+ df->vkCmdBindDescriptorSets(cbD->activeSecondaryCbStack.last(),
gfxPsD ? VK_PIPELINE_BIND_POINT_GRAPHICS : VK_PIPELINE_BIND_POINT_COMPUTE,
gfxPsD ? gfxPsD->layout : compPsD->layout,
0, 1, &srbD->descSets[descSetIdx],
- uint32_t(dynOfs.count()),
- dynOfs.count() ? dynOfs.constData() : nullptr);
+ uint32_t(dynOfs.size()),
+ dynOfs.size() ? dynOfs.constData() : nullptr);
} else {
- QVkCommandBuffer::Command cmd;
+ QVkCommandBuffer::Command &cmd(cbD->commands.get());
cmd.cmd = QVkCommandBuffer::Command::BindDescriptorSet;
cmd.args.bindDescriptorSet.bindPoint = gfxPsD ? VK_PIPELINE_BIND_POINT_GRAPHICS
: VK_PIPELINE_BIND_POINT_COMPUTE;
cmd.args.bindDescriptorSet.pipelineLayout = gfxPsD ? gfxPsD->layout : compPsD->layout;
cmd.args.bindDescriptorSet.descSet = srbD->descSets[descSetIdx];
- cmd.args.bindDescriptorSet.dynamicOffsetCount = dynOfs.count();
- cmd.args.bindDescriptorSet.dynamicOffsetIndex = cbD->pools.dynamicOffset.count();
- cbD->pools.dynamicOffset.append(dynOfs.constData(), dynOfs.count());
- cbD->commands.append(cmd);
+ cmd.args.bindDescriptorSet.dynamicOffsetCount = dynOfs.size();
+ cmd.args.bindDescriptorSet.dynamicOffsetIndex = cbD->pools.dynamicOffset.size();
+ cbD->pools.dynamicOffset.append(dynOfs.constData(), dynOfs.size());
}
if (gfxPsD) {
@@ -4194,7 +5336,7 @@ void QRhiVulkan::setVertexInput(QRhiCommandBuffer *cb,
Q_ASSERT(bufD->m_usage.testFlag(QRhiBuffer::VertexBuffer));
bufD->lastActiveFrameSlot = currentFrameSlot;
if (bufD->m_type == QRhiBuffer::Dynamic)
- executeBufferHostWritesForCurrentFrame(bufD);
+ executeBufferHostWritesForSlot(bufD, currentFrameSlot);
const VkBuffer vkvertexbuf = bufD->buffers[bufD->m_type == QRhiBuffer::Dynamic ? currentFrameSlot : 0];
if (cbD->currentVertexBuffers[inputSlot] != vkvertexbuf
@@ -4219,19 +5361,18 @@ void QRhiVulkan::setVertexInput(QRhiCommandBuffer *cb,
QRhiPassResourceTracker::BufVertexInputStage);
}
- if (cbD->useSecondaryCb) {
- df->vkCmdBindVertexBuffers(cbD->secondaryCbs.last(), uint32_t(startBinding),
- uint32_t(bufs.count()), bufs.constData(), ofs.constData());
+ if (cbD->passUsesSecondaryCb) {
+ df->vkCmdBindVertexBuffers(cbD->activeSecondaryCbStack.last(), uint32_t(startBinding),
+ uint32_t(bufs.size()), bufs.constData(), ofs.constData());
} else {
- QVkCommandBuffer::Command cmd;
+ QVkCommandBuffer::Command &cmd(cbD->commands.get());
cmd.cmd = QVkCommandBuffer::Command::BindVertexBuffer;
cmd.args.bindVertexBuffer.startBinding = startBinding;
- cmd.args.bindVertexBuffer.count = bufs.count();
- cmd.args.bindVertexBuffer.vertexBufferIndex = cbD->pools.vertexBuffer.count();
- cbD->pools.vertexBuffer.append(bufs.constData(), bufs.count());
- cmd.args.bindVertexBuffer.vertexBufferOffsetIndex = cbD->pools.vertexBufferOffset.count();
- cbD->pools.vertexBufferOffset.append(ofs.constData(), ofs.count());
- cbD->commands.append(cmd);
+ cmd.args.bindVertexBuffer.count = bufs.size();
+ cmd.args.bindVertexBuffer.vertexBufferIndex = cbD->pools.vertexBuffer.size();
+ cbD->pools.vertexBuffer.append(bufs.constData(), bufs.size());
+ cmd.args.bindVertexBuffer.vertexBufferOffsetIndex = cbD->pools.vertexBufferOffset.size();
+ cbD->pools.vertexBufferOffset.append(ofs.constData(), ofs.size());
}
}
@@ -4240,7 +5381,7 @@ void QRhiVulkan::setVertexInput(QRhiCommandBuffer *cb,
Q_ASSERT(ibufD->m_usage.testFlag(QRhiBuffer::IndexBuffer));
ibufD->lastActiveFrameSlot = currentFrameSlot;
if (ibufD->m_type == QRhiBuffer::Dynamic)
- executeBufferHostWritesForCurrentFrame(ibufD);
+ executeBufferHostWritesForSlot(ibufD, currentFrameSlot);
const int slot = ibufD->m_type == QRhiBuffer::Dynamic ? currentFrameSlot : 0;
const VkBuffer vkindexbuf = ibufD->buffers[slot];
@@ -4255,15 +5396,14 @@ void QRhiVulkan::setVertexInput(QRhiCommandBuffer *cb,
cbD->currentIndexOffset = indexOffset;
cbD->currentIndexFormat = type;
- if (cbD->useSecondaryCb) {
- df->vkCmdBindIndexBuffer(cbD->secondaryCbs.last(), vkindexbuf, indexOffset, type);
+ if (cbD->passUsesSecondaryCb) {
+ df->vkCmdBindIndexBuffer(cbD->activeSecondaryCbStack.last(), vkindexbuf, indexOffset, type);
} else {
- QVkCommandBuffer::Command cmd;
+ QVkCommandBuffer::Command &cmd(cbD->commands.get());
cmd.cmd = QVkCommandBuffer::Command::BindIndexBuffer;
cmd.args.bindIndexBuffer.buf = vkindexbuf;
cmd.args.bindIndexBuffer.ofs = indexOffset;
cmd.args.bindIndexBuffer.type = type;
- cbD->commands.append(cmd);
}
trackedRegisterBuffer(&passResTracker, ibufD, slot,
@@ -4281,10 +5421,10 @@ void QRhiVulkan::setViewport(QRhiCommandBuffer *cb, const QRhiViewport &viewport
// x,y is top-left in VkViewport but bottom-left in QRhiViewport
float x, y, w, h;
- if (!qrhi_toTopLeftRenderTargetRect(outputSize, viewport.viewport(), &x, &y, &w, &h))
+ if (!qrhi_toTopLeftRenderTargetRect<UnBounded>(outputSize, viewport.viewport(), &x, &y, &w, &h))
return;
- QVkCommandBuffer::Command cmd;
+ QVkCommandBuffer::Command &cmd(cbD->commands.get());
VkViewport *vp = &cmd.args.setViewport.viewport;
vp->x = x;
vp->y = y;
@@ -4293,24 +5433,28 @@ void QRhiVulkan::setViewport(QRhiCommandBuffer *cb, const QRhiViewport &viewport
vp->minDepth = viewport.minDepth();
vp->maxDepth = viewport.maxDepth();
- if (cbD->useSecondaryCb) {
- df->vkCmdSetViewport(cbD->secondaryCbs.last(), 0, 1, vp);
+ if (cbD->passUsesSecondaryCb) {
+ df->vkCmdSetViewport(cbD->activeSecondaryCbStack.last(), 0, 1, vp);
+ cbD->commands.unget();
} else {
cmd.cmd = QVkCommandBuffer::Command::SetViewport;
- cbD->commands.append(cmd);
}
- if (!QRHI_RES(QVkGraphicsPipeline, cbD->currentGraphicsPipeline)->m_flags.testFlag(QRhiGraphicsPipeline::UsesScissor)) {
+ if (cbD->currentGraphicsPipeline
+ && !QRHI_RES(QVkGraphicsPipeline, cbD->currentGraphicsPipeline)
+ ->m_flags.testFlag(QRhiGraphicsPipeline::UsesScissor)) {
+ QVkCommandBuffer::Command &cmd(cbD->commands.get());
VkRect2D *s = &cmd.args.setScissor.scissor;
+ qrhi_toTopLeftRenderTargetRect<Bounded>(outputSize, viewport.viewport(), &x, &y, &w, &h);
s->offset.x = int32_t(x);
s->offset.y = int32_t(y);
s->extent.width = uint32_t(w);
s->extent.height = uint32_t(h);
- if (cbD->useSecondaryCb) {
- df->vkCmdSetScissor(cbD->secondaryCbs.last(), 0, 1, s);
+ if (cbD->passUsesSecondaryCb) {
+ df->vkCmdSetScissor(cbD->activeSecondaryCbStack.last(), 0, 1, s);
+ cbD->commands.unget();
} else {
cmd.cmd = QVkCommandBuffer::Command::SetScissor;
- cbD->commands.append(cmd);
}
}
}
@@ -4324,21 +5468,21 @@ void QRhiVulkan::setScissor(QRhiCommandBuffer *cb, const QRhiScissor &scissor)
// x,y is top-left in VkRect2D but bottom-left in QRhiScissor
int x, y, w, h;
- if (!qrhi_toTopLeftRenderTargetRect(outputSize, scissor.scissor(), &x, &y, &w, &h))
+ if (!qrhi_toTopLeftRenderTargetRect<Bounded>(outputSize, scissor.scissor(), &x, &y, &w, &h))
return;
- QVkCommandBuffer::Command cmd;
+ QVkCommandBuffer::Command &cmd(cbD->commands.get());
VkRect2D *s = &cmd.args.setScissor.scissor;
s->offset.x = x;
s->offset.y = y;
s->extent.width = uint32_t(w);
s->extent.height = uint32_t(h);
- if (cbD->useSecondaryCb) {
- df->vkCmdSetScissor(cbD->secondaryCbs.last(), 0, 1, s);
+ if (cbD->passUsesSecondaryCb) {
+ df->vkCmdSetScissor(cbD->activeSecondaryCbStack.last(), 0, 1, s);
+ cbD->commands.unget();
} else {
cmd.cmd = QVkCommandBuffer::Command::SetScissor;
- cbD->commands.append(cmd);
}
}
@@ -4347,17 +5491,16 @@ void QRhiVulkan::setBlendConstants(QRhiCommandBuffer *cb, const QColor &c)
QVkCommandBuffer *cbD = QRHI_RES(QVkCommandBuffer, cb);
Q_ASSERT(cbD->recordingPass == QVkCommandBuffer::RenderPass);
- if (cbD->useSecondaryCb) {
+ if (cbD->passUsesSecondaryCb) {
float constants[] = { float(c.redF()), float(c.greenF()), float(c.blueF()), float(c.alphaF()) };
- df->vkCmdSetBlendConstants(cbD->secondaryCbs.last(), constants);
+ df->vkCmdSetBlendConstants(cbD->activeSecondaryCbStack.last(), constants);
} else {
- QVkCommandBuffer::Command cmd;
+ QVkCommandBuffer::Command &cmd(cbD->commands.get());
cmd.cmd = QVkCommandBuffer::Command::SetBlendConstants;
cmd.args.setBlendConstants.c[0] = float(c.redF());
cmd.args.setBlendConstants.c[1] = float(c.greenF());
cmd.args.setBlendConstants.c[2] = float(c.blueF());
cmd.args.setBlendConstants.c[3] = float(c.alphaF());
- cbD->commands.append(cmd);
}
}
@@ -4366,13 +5509,12 @@ void QRhiVulkan::setStencilRef(QRhiCommandBuffer *cb, quint32 refValue)
QVkCommandBuffer *cbD = QRHI_RES(QVkCommandBuffer, cb);
Q_ASSERT(cbD->recordingPass == QVkCommandBuffer::RenderPass);
- if (cbD->useSecondaryCb) {
- df->vkCmdSetStencilReference(cbD->secondaryCbs.last(), VK_STENCIL_FRONT_AND_BACK, refValue);
+ if (cbD->passUsesSecondaryCb) {
+ df->vkCmdSetStencilReference(cbD->activeSecondaryCbStack.last(), VK_STENCIL_FRONT_AND_BACK, refValue);
} else {
- QVkCommandBuffer::Command cmd;
+ QVkCommandBuffer::Command &cmd(cbD->commands.get());
cmd.cmd = QVkCommandBuffer::Command::SetStencilRef;
cmd.args.setStencilRef.ref = refValue;
- cbD->commands.append(cmd);
}
}
@@ -4382,16 +5524,15 @@ void QRhiVulkan::draw(QRhiCommandBuffer *cb, quint32 vertexCount,
QVkCommandBuffer *cbD = QRHI_RES(QVkCommandBuffer, cb);
Q_ASSERT(cbD->recordingPass == QVkCommandBuffer::RenderPass);
- if (cbD->useSecondaryCb) {
- df->vkCmdDraw(cbD->secondaryCbs.last(), vertexCount, instanceCount, firstVertex, firstInstance);
+ if (cbD->passUsesSecondaryCb) {
+ df->vkCmdDraw(cbD->activeSecondaryCbStack.last(), vertexCount, instanceCount, firstVertex, firstInstance);
} else {
- QVkCommandBuffer::Command cmd;
+ QVkCommandBuffer::Command &cmd(cbD->commands.get());
cmd.cmd = QVkCommandBuffer::Command::Draw;
cmd.args.draw.vertexCount = vertexCount;
cmd.args.draw.instanceCount = instanceCount;
cmd.args.draw.firstVertex = firstVertex;
cmd.args.draw.firstInstance = firstInstance;
- cbD->commands.append(cmd);
}
}
@@ -4401,80 +5542,88 @@ void QRhiVulkan::drawIndexed(QRhiCommandBuffer *cb, quint32 indexCount,
QVkCommandBuffer *cbD = QRHI_RES(QVkCommandBuffer, cb);
Q_ASSERT(cbD->recordingPass == QVkCommandBuffer::RenderPass);
- if (cbD->useSecondaryCb) {
- df->vkCmdDrawIndexed(cbD->secondaryCbs.last(), indexCount, instanceCount,
+ if (cbD->passUsesSecondaryCb) {
+ df->vkCmdDrawIndexed(cbD->activeSecondaryCbStack.last(), indexCount, instanceCount,
firstIndex, vertexOffset, firstInstance);
} else {
- QVkCommandBuffer::Command cmd;
+ QVkCommandBuffer::Command &cmd(cbD->commands.get());
cmd.cmd = QVkCommandBuffer::Command::DrawIndexed;
cmd.args.drawIndexed.indexCount = indexCount;
cmd.args.drawIndexed.instanceCount = instanceCount;
cmd.args.drawIndexed.firstIndex = firstIndex;
cmd.args.drawIndexed.vertexOffset = vertexOffset;
cmd.args.drawIndexed.firstInstance = firstInstance;
- cbD->commands.append(cmd);
}
}
void QRhiVulkan::debugMarkBegin(QRhiCommandBuffer *cb, const QByteArray &name)
{
- if (!debugMarkers || !debugMarkersAvailable)
+#ifdef VK_EXT_debug_utils
+ if (!debugMarkers || !caps.debugUtils)
return;
- VkDebugMarkerMarkerInfoEXT marker;
- memset(&marker, 0, sizeof(marker));
- marker.sType = VK_STRUCTURE_TYPE_DEBUG_MARKER_MARKER_INFO_EXT;
+ VkDebugUtilsLabelEXT label = {};
+ label.sType = VK_STRUCTURE_TYPE_DEBUG_UTILS_LABEL_EXT;
QVkCommandBuffer *cbD = QRHI_RES(QVkCommandBuffer, cb);
- if (cbD->recordingPass != QVkCommandBuffer::NoPass && cbD->useSecondaryCb) {
- marker.pMarkerName = name.constData();
- vkCmdDebugMarkerBegin(cbD->secondaryCbs.last(), &marker);
+ if (cbD->recordingPass != QVkCommandBuffer::NoPass && cbD->passUsesSecondaryCb) {
+ label.pLabelName = name.constData();
+ vkCmdBeginDebugUtilsLabelEXT(cbD->activeSecondaryCbStack.last(), &label);
} else {
- QVkCommandBuffer::Command cmd;
+ QVkCommandBuffer::Command &cmd(cbD->commands.get());
cmd.cmd = QVkCommandBuffer::Command::DebugMarkerBegin;
- cmd.args.debugMarkerBegin.marker = marker;
- cmd.args.debugMarkerBegin.markerNameIndex = cbD->pools.debugMarkerData.count();
+ cmd.args.debugMarkerBegin.label = label;
+ cmd.args.debugMarkerBegin.labelNameIndex = cbD->pools.debugMarkerData.size();
cbD->pools.debugMarkerData.append(name);
- cbD->commands.append(cmd);
}
+#else
+ Q_UNUSED(cb);
+ Q_UNUSED(name);
+#endif
}
void QRhiVulkan::debugMarkEnd(QRhiCommandBuffer *cb)
{
- if (!debugMarkers || !debugMarkersAvailable)
+#ifdef VK_EXT_debug_utils
+ if (!debugMarkers || !caps.debugUtils)
return;
QVkCommandBuffer *cbD = QRHI_RES(QVkCommandBuffer, cb);
- if (cbD->recordingPass != QVkCommandBuffer::NoPass && cbD->useSecondaryCb) {
- vkCmdDebugMarkerEnd(cbD->secondaryCbs.last());
+ if (cbD->recordingPass != QVkCommandBuffer::NoPass && cbD->passUsesSecondaryCb) {
+ vkCmdEndDebugUtilsLabelEXT(cbD->activeSecondaryCbStack.last());
} else {
- QVkCommandBuffer::Command cmd;
+ QVkCommandBuffer::Command &cmd(cbD->commands.get());
cmd.cmd = QVkCommandBuffer::Command::DebugMarkerEnd;
- cbD->commands.append(cmd);
}
+#else
+ Q_UNUSED(cb);
+#endif
}
void QRhiVulkan::debugMarkMsg(QRhiCommandBuffer *cb, const QByteArray &msg)
{
- if (!debugMarkers || !debugMarkersAvailable)
+#ifdef VK_EXT_debug_utils
+ if (!debugMarkers || !caps.debugUtils)
return;
- VkDebugMarkerMarkerInfoEXT marker;
- memset(&marker, 0, sizeof(marker));
- marker.sType = VK_STRUCTURE_TYPE_DEBUG_MARKER_MARKER_INFO_EXT;
+ VkDebugUtilsLabelEXT label = {};
+ label.sType = VK_STRUCTURE_TYPE_DEBUG_UTILS_LABEL_EXT;
QVkCommandBuffer *cbD = QRHI_RES(QVkCommandBuffer, cb);
- if (cbD->recordingPass != QVkCommandBuffer::NoPass && cbD->useSecondaryCb) {
- marker.pMarkerName = msg.constData();
- vkCmdDebugMarkerInsert(cbD->secondaryCbs.last(), &marker);
+ if (cbD->recordingPass != QVkCommandBuffer::NoPass && cbD->passUsesSecondaryCb) {
+ label.pLabelName = msg.constData();
+ vkCmdInsertDebugUtilsLabelEXT(cbD->activeSecondaryCbStack.last(), &label);
} else {
- QVkCommandBuffer::Command cmd;
+ QVkCommandBuffer::Command &cmd(cbD->commands.get());
cmd.cmd = QVkCommandBuffer::Command::DebugMarkerInsert;
- cmd.args.debugMarkerInsert.marker = marker;
- cmd.args.debugMarkerInsert.markerNameIndex = cbD->pools.debugMarkerData.count();
+ cmd.args.debugMarkerInsert.label = label;
+ cmd.args.debugMarkerInsert.labelNameIndex = cbD->pools.debugMarkerData.size();
cbD->pools.debugMarkerData.append(msg);
- cbD->commands.append(cmd);
}
+#else
+ Q_UNUSED(cb);
+ Q_UNUSED(msg);
+#endif
}
const QRhiNativeHandles *QRhiVulkan::nativeHandles(QRhiCommandBuffer *cb)
@@ -4488,8 +5637,8 @@ static inline QVkRenderTargetData *maybeRenderTargetData(QVkCommandBuffer *cbD)
QVkRenderTargetData *rtD = nullptr;
if (cbD->recordingPass == QVkCommandBuffer::RenderPass) {
switch (cbD->currentTarget->resourceType()) {
- case QRhiResource::RenderTarget:
- rtD = &QRHI_RES(QVkReferenceRenderTarget, cbD->currentTarget)->d;
+ case QRhiResource::SwapChainRenderTarget:
+ rtD = &QRHI_RES(QVkSwapChainRenderTarget, cbD->currentTarget)->d;
break;
case QRhiResource::TextureRenderTarget:
rtD = &QRHI_RES(QVkTextureRenderTarget, cbD->currentTarget)->d;
@@ -4522,19 +5671,19 @@ void QRhiVulkan::beginExternal(QRhiCommandBuffer *cb)
if (cbD->inExternal)
return;
- if (!cbD->useSecondaryCb) {
+ if (!cbD->passUsesSecondaryCb) {
qWarning("beginExternal() within a pass is only supported with secondary command buffers. "
- "This can be enabled by passing QRhi::ExternalContentsInPass to beginFrame().");
+ "This can be enabled by passing QRhiCommandBuffer::ExternalContent to beginPass().");
return;
}
- VkCommandBuffer secondaryCb = cbD->secondaryCbs.last();
- cbD->secondaryCbs.removeLast();
+ VkCommandBuffer secondaryCb = cbD->activeSecondaryCbStack.last();
+ cbD->activeSecondaryCbStack.removeLast();
endAndEnqueueSecondaryCommandBuffer(secondaryCb, cbD);
VkCommandBuffer extCb = startSecondaryCommandBuffer(maybeRenderTargetData(cbD));
if (extCb) {
- cbD->secondaryCbs.append(extCb);
+ cbD->activeSecondaryCbStack.append(extCb);
cbD->inExternal = true;
}
}
@@ -4546,32 +5695,44 @@ void QRhiVulkan::endExternal(QRhiCommandBuffer *cb)
if (cbD->recordingPass == QVkCommandBuffer::NoPass) {
Q_ASSERT(cbD->commands.isEmpty() && cbD->currentPassResTrackerIndex == -1);
} else if (cbD->inExternal) {
- VkCommandBuffer extCb = cbD->secondaryCbs.last();
- cbD->secondaryCbs.removeLast();
+ VkCommandBuffer extCb = cbD->activeSecondaryCbStack.last();
+ cbD->activeSecondaryCbStack.removeLast();
endAndEnqueueSecondaryCommandBuffer(extCb, cbD);
- cbD->secondaryCbs.append(startSecondaryCommandBuffer(maybeRenderTargetData(cbD)));
+ cbD->activeSecondaryCbStack.append(startSecondaryCommandBuffer(maybeRenderTargetData(cbD)));
}
cbD->resetCachedState();
}
-void QRhiVulkan::setObjectName(uint64_t object, VkDebugReportObjectTypeEXT type, const QByteArray &name, int slot)
+double QRhiVulkan::lastCompletedGpuTime(QRhiCommandBuffer *cb)
+{
+ QVkCommandBuffer *cbD = QRHI_RES(QVkCommandBuffer, cb);
+ return cbD->lastGpuTime;
+}
+
+void QRhiVulkan::setObjectName(uint64_t object, VkObjectType type, const QByteArray &name, int slot)
{
- if (!debugMarkers || !debugMarkersAvailable || name.isEmpty())
+#ifdef VK_EXT_debug_utils
+ if (!debugMarkers || !caps.debugUtils || name.isEmpty())
return;
- VkDebugMarkerObjectNameInfoEXT nameInfo;
- memset(&nameInfo, 0, sizeof(nameInfo));
- nameInfo.sType = VK_STRUCTURE_TYPE_DEBUG_MARKER_OBJECT_NAME_INFO_EXT;
+ VkDebugUtilsObjectNameInfoEXT nameInfo = {};
+ nameInfo.sType = VK_STRUCTURE_TYPE_DEBUG_UTILS_OBJECT_NAME_INFO_EXT;
nameInfo.objectType = type;
- nameInfo.object = object;
+ nameInfo.objectHandle = object;
QByteArray decoratedName = name;
if (slot >= 0) {
decoratedName += '/';
decoratedName += QByteArray::number(slot);
}
nameInfo.pObjectName = decoratedName.constData();
- vkDebugMarkerSetObjectName(dev, &nameInfo);
+ vkSetDebugUtilsObjectNameEXT(dev, &nameInfo);
+#else
+ Q_UNUSED(object);
+ Q_UNUSED(type);
+ Q_UNUSED(name);
+ Q_UNUSED(slot);
+#endif
}
static inline VkBufferUsageFlagBits toVkBufferUsage(QRhiBuffer::UsageFlags usage)
@@ -4596,8 +5757,7 @@ static inline VkFilter toVkFilter(QRhiSampler::Filter f)
case QRhiSampler::Linear:
return VK_FILTER_LINEAR;
default:
- Q_UNREACHABLE();
- return VK_FILTER_NEAREST;
+ Q_UNREACHABLE_RETURN(VK_FILTER_NEAREST);
}
}
@@ -4611,8 +5771,7 @@ static inline VkSamplerMipmapMode toVkMipmapMode(QRhiSampler::Filter f)
case QRhiSampler::Linear:
return VK_SAMPLER_MIPMAP_MODE_LINEAR;
default:
- Q_UNREACHABLE();
- return VK_SAMPLER_MIPMAP_MODE_NEAREST;
+ Q_UNREACHABLE_RETURN(VK_SAMPLER_MIPMAP_MODE_NEAREST);
}
}
@@ -4626,8 +5785,7 @@ static inline VkSamplerAddressMode toVkAddressMode(QRhiSampler::AddressMode m)
case QRhiSampler::Mirror:
return VK_SAMPLER_ADDRESS_MODE_MIRRORED_REPEAT;
default:
- Q_UNREACHABLE();
- return VK_SAMPLER_ADDRESS_MODE_CLAMP_TO_EDGE;
+ Q_UNREACHABLE_RETURN(VK_SAMPLER_ADDRESS_MODE_CLAMP_TO_EDGE);
}
}
@@ -4636,13 +5794,18 @@ static inline VkShaderStageFlagBits toVkShaderStage(QRhiShaderStage::Type type)
switch (type) {
case QRhiShaderStage::Vertex:
return VK_SHADER_STAGE_VERTEX_BIT;
+ case QRhiShaderStage::TessellationControl:
+ return VK_SHADER_STAGE_TESSELLATION_CONTROL_BIT;
+ case QRhiShaderStage::TessellationEvaluation:
+ return VK_SHADER_STAGE_TESSELLATION_EVALUATION_BIT;
case QRhiShaderStage::Fragment:
return VK_SHADER_STAGE_FRAGMENT_BIT;
case QRhiShaderStage::Compute:
return VK_SHADER_STAGE_COMPUTE_BIT;
+ case QRhiShaderStage::Geometry:
+ return VK_SHADER_STAGE_GEOMETRY_BIT;
default:
- Q_UNREACHABLE();
- return VK_SHADER_STAGE_VERTEX_BIT;
+ Q_UNREACHABLE_RETURN(VK_SHADER_STAGE_VERTEX_BIT);
}
}
@@ -4663,9 +5826,48 @@ static inline VkFormat toVkAttributeFormat(QRhiVertexInputAttribute::Format form
return VK_FORMAT_R8G8_UNORM;
case QRhiVertexInputAttribute::UNormByte:
return VK_FORMAT_R8_UNORM;
+ case QRhiVertexInputAttribute::UInt4:
+ return VK_FORMAT_R32G32B32A32_UINT;
+ case QRhiVertexInputAttribute::UInt3:
+ return VK_FORMAT_R32G32B32_UINT;
+ case QRhiVertexInputAttribute::UInt2:
+ return VK_FORMAT_R32G32_UINT;
+ case QRhiVertexInputAttribute::UInt:
+ return VK_FORMAT_R32_UINT;
+ case QRhiVertexInputAttribute::SInt4:
+ return VK_FORMAT_R32G32B32A32_SINT;
+ case QRhiVertexInputAttribute::SInt3:
+ return VK_FORMAT_R32G32B32_SINT;
+ case QRhiVertexInputAttribute::SInt2:
+ return VK_FORMAT_R32G32_SINT;
+ case QRhiVertexInputAttribute::SInt:
+ return VK_FORMAT_R32_SINT;
+ case QRhiVertexInputAttribute::Half4:
+ return VK_FORMAT_R16G16B16A16_SFLOAT;
+ case QRhiVertexInputAttribute::Half3:
+ return VK_FORMAT_R16G16B16_SFLOAT;
+ case QRhiVertexInputAttribute::Half2:
+ return VK_FORMAT_R16G16_SFLOAT;
+ case QRhiVertexInputAttribute::Half:
+ return VK_FORMAT_R16_SFLOAT;
+ case QRhiVertexInputAttribute::UShort4:
+ return VK_FORMAT_R16G16B16A16_UINT;
+ case QRhiVertexInputAttribute::UShort3:
+ return VK_FORMAT_R16G16B16_UINT;
+ case QRhiVertexInputAttribute::UShort2:
+ return VK_FORMAT_R16G16_UINT;
+ case QRhiVertexInputAttribute::UShort:
+ return VK_FORMAT_R16_UINT;
+ case QRhiVertexInputAttribute::SShort4:
+ return VK_FORMAT_R16G16B16A16_SINT;
+ case QRhiVertexInputAttribute::SShort3:
+ return VK_FORMAT_R16G16B16_SINT;
+ case QRhiVertexInputAttribute::SShort2:
+ return VK_FORMAT_R16G16_SINT;
+ case QRhiVertexInputAttribute::SShort:
+ return VK_FORMAT_R16_SINT;
default:
- Q_UNREACHABLE();
- return VK_FORMAT_R32G32B32A32_SFLOAT;
+ Q_UNREACHABLE_RETURN(VK_FORMAT_R32G32B32A32_SFLOAT);
}
}
@@ -4684,9 +5886,10 @@ static inline VkPrimitiveTopology toVkTopology(QRhiGraphicsPipeline::Topology t)
return VK_PRIMITIVE_TOPOLOGY_LINE_STRIP;
case QRhiGraphicsPipeline::Points:
return VK_PRIMITIVE_TOPOLOGY_POINT_LIST;
+ case QRhiGraphicsPipeline::Patches:
+ return VK_PRIMITIVE_TOPOLOGY_PATCH_LIST;
default:
- Q_UNREACHABLE();
- return VK_PRIMITIVE_TOPOLOGY_TRIANGLE_LIST;
+ Q_UNREACHABLE_RETURN(VK_PRIMITIVE_TOPOLOGY_TRIANGLE_LIST);
}
}
@@ -4700,8 +5903,7 @@ static inline VkCullModeFlags toVkCullMode(QRhiGraphicsPipeline::CullMode c)
case QRhiGraphicsPipeline::Back:
return VK_CULL_MODE_BACK_BIT;
default:
- Q_UNREACHABLE();
- return VK_CULL_MODE_NONE;
+ Q_UNREACHABLE_RETURN(VK_CULL_MODE_NONE);
}
}
@@ -4713,8 +5915,7 @@ static inline VkFrontFace toVkFrontFace(QRhiGraphicsPipeline::FrontFace f)
case QRhiGraphicsPipeline::CW:
return VK_FRONT_FACE_CLOCKWISE;
default:
- Q_UNREACHABLE();
- return VK_FRONT_FACE_COUNTER_CLOCKWISE;
+ Q_UNREACHABLE_RETURN(VK_FRONT_FACE_COUNTER_CLOCKWISE);
}
}
@@ -4774,8 +5975,7 @@ static inline VkBlendFactor toVkBlendFactor(QRhiGraphicsPipeline::BlendFactor f)
case QRhiGraphicsPipeline::OneMinusSrc1Alpha:
return VK_BLEND_FACTOR_ONE_MINUS_SRC1_ALPHA;
default:
- Q_UNREACHABLE();
- return VK_BLEND_FACTOR_ZERO;
+ Q_UNREACHABLE_RETURN(VK_BLEND_FACTOR_ZERO);
}
}
@@ -4793,8 +5993,7 @@ static inline VkBlendOp toVkBlendOp(QRhiGraphicsPipeline::BlendOp op)
case QRhiGraphicsPipeline::Max:
return VK_BLEND_OP_MAX;
default:
- Q_UNREACHABLE();
- return VK_BLEND_OP_ADD;
+ Q_UNREACHABLE_RETURN(VK_BLEND_OP_ADD);
}
}
@@ -4818,8 +6017,7 @@ static inline VkCompareOp toVkCompareOp(QRhiGraphicsPipeline::CompareOp op)
case QRhiGraphicsPipeline::Always:
return VK_COMPARE_OP_ALWAYS;
default:
- Q_UNREACHABLE();
- return VK_COMPARE_OP_ALWAYS;
+ Q_UNREACHABLE_RETURN(VK_COMPARE_OP_ALWAYS);
}
}
@@ -4843,8 +6041,19 @@ static inline VkStencilOp toVkStencilOp(QRhiGraphicsPipeline::StencilOp op)
case QRhiGraphicsPipeline::DecrementAndWrap:
return VK_STENCIL_OP_DECREMENT_AND_WRAP;
default:
- Q_UNREACHABLE();
- return VK_STENCIL_OP_KEEP;
+ Q_UNREACHABLE_RETURN(VK_STENCIL_OP_KEEP);
+ }
+}
+
+static inline VkPolygonMode toVkPolygonMode(QRhiGraphicsPipeline::PolygonMode mode)
+{
+ switch (mode) {
+ case QRhiGraphicsPipeline::Fill:
+ return VK_POLYGON_MODE_FILL;
+ case QRhiGraphicsPipeline::Line:
+ return VK_POLYGON_MODE_LINE;
+ default:
+ Q_UNREACHABLE_RETURN(VK_POLYGON_MODE_FILL);
}
}
@@ -4866,23 +6075,24 @@ static inline VkDescriptorType toVkDescriptorType(const QRhiShaderResourceBindin
case QRhiShaderResourceBinding::SampledTexture:
return VK_DESCRIPTOR_TYPE_COMBINED_IMAGE_SAMPLER;
+ case QRhiShaderResourceBinding::Texture:
+ return VK_DESCRIPTOR_TYPE_SAMPLED_IMAGE;
+
+ case QRhiShaderResourceBinding::Sampler:
+ return VK_DESCRIPTOR_TYPE_SAMPLER;
+
case QRhiShaderResourceBinding::ImageLoad:
- Q_FALLTHROUGH();
case QRhiShaderResourceBinding::ImageStore:
- Q_FALLTHROUGH();
case QRhiShaderResourceBinding::ImageLoadStore:
return VK_DESCRIPTOR_TYPE_STORAGE_IMAGE;
case QRhiShaderResourceBinding::BufferLoad:
- Q_FALLTHROUGH();
case QRhiShaderResourceBinding::BufferStore:
- Q_FALLTHROUGH();
case QRhiShaderResourceBinding::BufferLoadStore:
return VK_DESCRIPTOR_TYPE_STORAGE_BUFFER;
default:
- Q_UNREACHABLE();
- return VK_DESCRIPTOR_TYPE_UNIFORM_BUFFER;
+ Q_UNREACHABLE_RETURN(VK_DESCRIPTOR_TYPE_UNIFORM_BUFFER);
}
}
@@ -4895,6 +6105,12 @@ static inline VkShaderStageFlags toVkShaderStageFlags(QRhiShaderResourceBinding:
s |= VK_SHADER_STAGE_FRAGMENT_BIT;
if (stage.testFlag(QRhiShaderResourceBinding::ComputeStage))
s |= VK_SHADER_STAGE_COMPUTE_BIT;
+ if (stage.testFlag(QRhiShaderResourceBinding::TessellationControlStage))
+ s |= VK_SHADER_STAGE_TESSELLATION_CONTROL_BIT;
+ if (stage.testFlag(QRhiShaderResourceBinding::TessellationEvaluationStage))
+ s |= VK_SHADER_STAGE_TESSELLATION_EVALUATION_BIT;
+ if (stage.testFlag(QRhiShaderResourceBinding::GeometryStage))
+ s |= VK_SHADER_STAGE_GEOMETRY_BIT;
return VkShaderStageFlags(s);
}
@@ -4918,12 +6134,11 @@ static inline VkCompareOp toVkTextureCompareOp(QRhiSampler::CompareOp op)
case QRhiSampler::Always:
return VK_COMPARE_OP_ALWAYS;
default:
- Q_UNREACHABLE();
- return VK_COMPARE_OP_NEVER;
+ Q_UNREACHABLE_RETURN(VK_COMPARE_OP_NEVER);
}
}
-QVkBuffer::QVkBuffer(QRhiImplementation *rhi, Type type, UsageFlags usage, int size)
+QVkBuffer::QVkBuffer(QRhiImplementation *rhi, Type type, UsageFlags usage, quint32 size)
: QRhiBuffer(rhi, type, usage, size)
{
for (int i = 0; i < QVK_FRAMES_IN_FLIGHT; ++i) {
@@ -4934,10 +6149,10 @@ QVkBuffer::QVkBuffer(QRhiImplementation *rhi, Type type, UsageFlags usage, int s
QVkBuffer::~QVkBuffer()
{
- release();
+ destroy();
}
-void QVkBuffer::release()
+void QVkBuffer::destroy()
{
if (!buffers[0])
return;
@@ -4960,34 +6175,33 @@ void QVkBuffer::release()
}
QRHI_RES_RHI(QRhiVulkan);
- rhiD->releaseQueue.append(e);
-
- QRHI_PROF;
- QRHI_PROF_F(releaseBuffer(this));
-
- rhiD->unregisterResource(this);
+ // destroy() implementations, unlike other functions, are expected to test
+ // for m_rhi being null, to allow surviving in case one attempts to destroy
+ // a (leaked) resource after the QRhi.
+ if (rhiD) {
+ rhiD->releaseQueue.append(e);
+ rhiD->unregisterResource(this);
+ }
}
-bool QVkBuffer::build()
+bool QVkBuffer::create()
{
if (buffers[0])
- release();
+ destroy();
if (m_usage.testFlag(QRhiBuffer::StorageBuffer) && m_type == Dynamic) {
qWarning("StorageBuffer cannot be combined with Dynamic");
return false;
}
- const int nonZeroSize = m_size <= 0 ? 256 : m_size;
+ const quint32 nonZeroSize = m_size <= 0 ? 256 : m_size;
- VkBufferCreateInfo bufferInfo;
- memset(&bufferInfo, 0, sizeof(bufferInfo));
+ VkBufferCreateInfo bufferInfo = {};
bufferInfo.sType = VK_STRUCTURE_TYPE_BUFFER_CREATE_INFO;
- bufferInfo.size = uint32_t(nonZeroSize);
+ bufferInfo.size = nonZeroSize;
bufferInfo.usage = toVkBufferUsage(m_usage);
- VmaAllocationCreateInfo allocInfo;
- memset(&allocInfo, 0, sizeof(allocInfo));
+ VmaAllocationCreateInfo allocInfo = {};
if (m_type == Dynamic) {
#ifndef Q_OS_DARWIN // not for MoltenVK
@@ -5015,38 +6229,83 @@ bool QVkBuffer::build()
if (err != VK_SUCCESS)
break;
allocations[i] = allocation;
- rhiD->setObjectName(uint64_t(buffers[i]), VK_DEBUG_REPORT_OBJECT_TYPE_BUFFER_EXT, m_objectName,
+ rhiD->setObjectName(uint64_t(buffers[i]), VK_OBJECT_TYPE_BUFFER, m_objectName,
m_type == Dynamic ? i : -1);
}
}
if (err != VK_SUCCESS) {
- qWarning("Failed to create buffer: %d", err);
+ qWarning("Failed to create buffer of size %u: %d", nonZeroSize, err);
+ rhiD->printExtraErrorInfo(err);
return false;
}
- QRHI_PROF;
- QRHI_PROF_F(newBuffer(this, uint(nonZeroSize), m_type != Dynamic ? 1 : QVK_FRAMES_IN_FLIGHT, 0));
-
lastActiveFrameSlot = -1;
generation += 1;
rhiD->registerResource(this);
return true;
}
+QRhiBuffer::NativeBuffer QVkBuffer::nativeBuffer()
+{
+ if (m_type == Dynamic) {
+ QRHI_RES_RHI(QRhiVulkan);
+ NativeBuffer b;
+ Q_ASSERT(sizeof(b.objects) / sizeof(b.objects[0]) >= size_t(QVK_FRAMES_IN_FLIGHT));
+ for (int i = 0; i < QVK_FRAMES_IN_FLIGHT; ++i) {
+ rhiD->executeBufferHostWritesForSlot(this, i);
+ b.objects[i] = &buffers[i];
+ }
+ b.slotCount = QVK_FRAMES_IN_FLIGHT;
+ return b;
+ }
+ return { { &buffers[0] }, 1 };
+}
+
+char *QVkBuffer::beginFullDynamicBufferUpdateForCurrentFrame()
+{
+ // Shortcut the entire buffer update mechanism and allow the client to do
+ // the host writes directly to the buffer. This will lead to unexpected
+ // results when combined with QRhiResourceUpdateBatch-based updates for the
+ // buffer, but provides a fast path for dynamic buffers that have all their
+ // content changed in every frame.
+ Q_ASSERT(m_type == Dynamic);
+ QRHI_RES_RHI(QRhiVulkan);
+ Q_ASSERT(rhiD->inFrame);
+ const int slot = rhiD->currentFrameSlot;
+ void *p = nullptr;
+ VmaAllocation a = toVmaAllocation(allocations[slot]);
+ VkResult err = vmaMapMemory(toVmaAllocator(rhiD->allocator), a, &p);
+ if (err != VK_SUCCESS) {
+ qWarning("Failed to map buffer: %d", err);
+ return nullptr;
+ }
+ return static_cast<char *>(p);
+}
+
+void QVkBuffer::endFullDynamicBufferUpdateForCurrentFrame()
+{
+ QRHI_RES_RHI(QRhiVulkan);
+ const int slot = rhiD->currentFrameSlot;
+ VmaAllocation a = toVmaAllocation(allocations[slot]);
+ vmaFlushAllocation(toVmaAllocator(rhiD->allocator), a, 0, m_size);
+ vmaUnmapMemory(toVmaAllocator(rhiD->allocator), a);
+}
+
QVkRenderBuffer::QVkRenderBuffer(QRhiImplementation *rhi, Type type, const QSize &pixelSize,
- int sampleCount, Flags flags)
- : QRhiRenderBuffer(rhi, type, pixelSize, sampleCount, flags)
+ int sampleCount, Flags flags,
+ QRhiTexture::Format backingFormatHint)
+ : QRhiRenderBuffer(rhi, type, pixelSize, sampleCount, flags, backingFormatHint)
{
}
QVkRenderBuffer::~QVkRenderBuffer()
{
- release();
+ destroy();
delete backingTexture;
}
-void QVkRenderBuffer::release()
+void QVkRenderBuffer::destroy()
{
if (!memory && !backingTexture)
return;
@@ -5066,36 +6325,35 @@ void QVkRenderBuffer::release()
if (backingTexture) {
Q_ASSERT(backingTexture->lastActiveFrameSlot == -1);
backingTexture->lastActiveFrameSlot = e.lastActiveFrameSlot;
- backingTexture->release();
+ backingTexture->destroy();
}
QRHI_RES_RHI(QRhiVulkan);
- rhiD->releaseQueue.append(e);
-
- QRHI_PROF;
- QRHI_PROF_F(releaseRenderBuffer(this));
-
- rhiD->unregisterResource(this);
+ if (rhiD) {
+ rhiD->releaseQueue.append(e);
+ rhiD->unregisterResource(this);
+ }
}
-bool QVkRenderBuffer::build()
+bool QVkRenderBuffer::create()
{
if (memory || backingTexture)
- release();
+ destroy();
if (m_pixelSize.isEmpty())
return false;
QRHI_RES_RHI(QRhiVulkan);
- QRHI_PROF;
- samples = rhiD->effectiveSampleCount(m_sampleCount);
+ samples = rhiD->effectiveSampleCountBits(m_sampleCount);
switch (m_type) {
case QRhiRenderBuffer::Color:
{
if (!backingTexture) {
- backingTexture = QRHI_RES(QVkTexture, rhiD->createTexture(QRhiTexture::RGBA8,
+ backingTexture = QRHI_RES(QVkTexture, rhiD->createTexture(backingFormat(),
m_pixelSize,
+ 1,
+ 0,
m_sampleCount,
QRhiTexture::RenderTarget | QRhiTexture::UsedAsTransferSource));
} else {
@@ -5103,10 +6361,9 @@ bool QVkRenderBuffer::build()
backingTexture->setSampleCount(m_sampleCount);
}
backingTexture->setName(m_objectName);
- if (!backingTexture->build())
+ if (!backingTexture->create())
return false;
vkformat = backingTexture->vkformat;
- QRHI_PROF_F(newRenderBuffer(this, false, false, samples));
}
break;
case QRhiRenderBuffer::DepthStencil:
@@ -5123,8 +6380,7 @@ bool QVkRenderBuffer::build()
{
return false;
}
- rhiD->setObjectName(uint64_t(image), VK_DEBUG_REPORT_OBJECT_TYPE_IMAGE_EXT, m_objectName);
- QRHI_PROF_F(newRenderBuffer(this, true, false, samples));
+ rhiD->setObjectName(uint64_t(image), VK_OBJECT_TYPE_IMAGE, m_objectName);
break;
default:
Q_UNREACHABLE();
@@ -5132,33 +6388,37 @@ bool QVkRenderBuffer::build()
}
lastActiveFrameSlot = -1;
+ generation += 1;
rhiD->registerResource(this);
return true;
}
QRhiTexture::Format QVkRenderBuffer::backingFormat() const
{
- return m_type == Color ? QRhiTexture::RGBA8 : QRhiTexture::UnknownFormat;
+ if (m_backingFormatHint != QRhiTexture::UnknownFormat)
+ return m_backingFormatHint;
+ else
+ return m_type == Color ? QRhiTexture::RGBA8 : QRhiTexture::UnknownFormat;
}
-QVkTexture::QVkTexture(QRhiImplementation *rhi, Format format, const QSize &pixelSize,
- int sampleCount, Flags flags)
- : QRhiTexture(rhi, format, pixelSize, sampleCount, flags)
+QVkTexture::QVkTexture(QRhiImplementation *rhi, Format format, const QSize &pixelSize, int depth,
+ int arraySize, int sampleCount, Flags flags)
+ : QRhiTexture(rhi, format, pixelSize, depth, arraySize, sampleCount, flags)
{
for (int i = 0; i < QVK_FRAMES_IN_FLIGHT; ++i) {
stagingBuffers[i] = VK_NULL_HANDLE;
stagingAllocations[i] = nullptr;
}
- for (int i = 0; i < QRhi::MAX_LEVELS; ++i)
+ for (int i = 0; i < QRhi::MAX_MIP_LEVELS; ++i)
perLevelImageViews[i] = VK_NULL_HANDLE;
}
QVkTexture::~QVkTexture()
{
- release();
+ destroy();
}
-void QVkTexture::release()
+void QVkTexture::destroy()
{
if (!image)
return;
@@ -5179,7 +6439,7 @@ void QVkTexture::release()
stagingAllocations[i] = nullptr;
}
- for (int i = 0; i < QRhi::MAX_LEVELS; ++i) {
+ for (int i = 0; i < QRhi::MAX_MIP_LEVELS; ++i) {
e.texture.extraImageViews[i] = perLevelImageViews[i];
perLevelImageViews[i] = VK_NULL_HANDLE;
}
@@ -5187,24 +6447,30 @@ void QVkTexture::release()
image = VK_NULL_HANDLE;
imageView = VK_NULL_HANDLE;
imageAlloc = nullptr;
- nativeHandlesStruct.image = VK_NULL_HANDLE;
QRHI_RES_RHI(QRhiVulkan);
- rhiD->releaseQueue.append(e);
-
- QRHI_PROF;
- QRHI_PROF_F(releaseTexture(this));
-
- rhiD->unregisterResource(this);
+ if (rhiD) {
+ rhiD->releaseQueue.append(e);
+ rhiD->unregisterResource(this);
+ }
}
-bool QVkTexture::prepareBuild(QSize *adjustedSize)
+bool QVkTexture::prepareCreate(QSize *adjustedSize)
{
if (image)
- release();
+ destroy();
QRHI_RES_RHI(QRhiVulkan);
vkformat = toVkTextureFormat(m_format, m_flags);
+ if (m_writeViewFormat.format != UnknownFormat)
+ viewFormat = toVkTextureFormat(m_writeViewFormat.format, m_writeViewFormat.srgb ? sRGB : Flags());
+ else
+ viewFormat = vkformat;
+ if (m_readViewFormat.format != UnknownFormat)
+ viewFormatForSampling = toVkTextureFormat(m_readViewFormat.format, m_readViewFormat.srgb ? sRGB : Flags());
+ else
+ viewFormatForSampling = vkformat;
+
VkFormatProperties props;
rhiD->f->vkGetPhysicalDeviceFormatProperties(rhiD->physDev, vkformat, &props);
const bool canSampleOptimal = (props.optimalTilingFeatures & VK_FORMAT_FEATURE_SAMPLED_IMAGE_BIT);
@@ -5213,27 +6479,64 @@ bool QVkTexture::prepareBuild(QSize *adjustedSize)
return false;
}
- const QSize size = m_pixelSize.isEmpty() ? QSize(1, 1) : m_pixelSize;
const bool isCube = m_flags.testFlag(CubeMap);
+ const bool isArray = m_flags.testFlag(TextureArray);
+ const bool is3D = m_flags.testFlag(ThreeDimensional);
+ const bool is1D = m_flags.testFlag(OneDimensional);
const bool hasMipMaps = m_flags.testFlag(MipMapped);
+ const QSize size = is1D ? QSize(qMax(1, m_pixelSize.width()), 1)
+ : (m_pixelSize.isEmpty() ? QSize(1, 1) : m_pixelSize);
+
mipLevelCount = uint(hasMipMaps ? rhiD->q->mipLevelsForSize(size) : 1);
- const int maxLevels = QRhi::MAX_LEVELS;
+ const int maxLevels = QRhi::MAX_MIP_LEVELS;
if (mipLevelCount > maxLevels) {
qWarning("Too many mip levels (%d, max is %d), truncating mip chain", mipLevelCount, maxLevels);
mipLevelCount = maxLevels;
}
- samples = rhiD->effectiveSampleCount(m_sampleCount);
+ samples = rhiD->effectiveSampleCountBits(m_sampleCount);
if (samples > VK_SAMPLE_COUNT_1_BIT) {
if (isCube) {
qWarning("Cubemap texture cannot be multisample");
return false;
}
+ if (is3D) {
+ qWarning("3D texture cannot be multisample");
+ return false;
+ }
if (hasMipMaps) {
qWarning("Multisample texture cannot have mipmaps");
return false;
}
}
+ if (isCube && is3D) {
+ qWarning("Texture cannot be both cube and 3D");
+ return false;
+ }
+ if (isArray && is3D) {
+ qWarning("Texture cannot be both array and 3D");
+ return false;
+ }
+ if (isCube && is1D) {
+ qWarning("Texture cannot be both cube and 1D");
+ return false;
+ }
+ if (is1D && is3D) {
+ qWarning("Texture cannot be both 1D and 3D");
+ return false;
+ }
+ if (m_depth > 1 && !is3D) {
+ qWarning("Texture cannot have a depth of %d when it is not 3D", m_depth);
+ return false;
+ }
+ if (m_arraySize > 0 && !isArray) {
+ qWarning("Texture cannot have an array size of %d when it is not an array", m_arraySize);
+ return false;
+ }
+ if (m_arraySize < 1 && isArray) {
+ qWarning("Texture is an array but array size is %d", m_arraySize);
+ return false;
+ }
usageState.layout = VK_IMAGE_LAYOUT_PREINITIALIZED;
usageState.access = 0;
@@ -5245,26 +6548,37 @@ bool QVkTexture::prepareBuild(QSize *adjustedSize)
return true;
}
-bool QVkTexture::finishBuild()
+bool QVkTexture::finishCreate()
{
QRHI_RES_RHI(QRhiVulkan);
- const bool isDepth = isDepthTextureFormat(m_format);
+ const auto aspectMask = aspectMaskForTextureFormat(m_format);
const bool isCube = m_flags.testFlag(CubeMap);
+ const bool isArray = m_flags.testFlag(TextureArray);
+ const bool is3D = m_flags.testFlag(ThreeDimensional);
+ const bool is1D = m_flags.testFlag(OneDimensional);
- VkImageViewCreateInfo viewInfo;
- memset(&viewInfo, 0, sizeof(viewInfo));
+ VkImageViewCreateInfo viewInfo = {};
viewInfo.sType = VK_STRUCTURE_TYPE_IMAGE_VIEW_CREATE_INFO;
viewInfo.image = image;
- viewInfo.viewType = isCube ? VK_IMAGE_VIEW_TYPE_CUBE : VK_IMAGE_VIEW_TYPE_2D;
- viewInfo.format = vkformat;
+ viewInfo.viewType = isCube
+ ? VK_IMAGE_VIEW_TYPE_CUBE
+ : (is3D ? VK_IMAGE_VIEW_TYPE_3D
+ : (is1D ? (isArray ? VK_IMAGE_VIEW_TYPE_1D_ARRAY : VK_IMAGE_VIEW_TYPE_1D)
+ : (isArray ? VK_IMAGE_VIEW_TYPE_2D_ARRAY : VK_IMAGE_VIEW_TYPE_2D)));
+ viewInfo.format = viewFormatForSampling;
viewInfo.components.r = VK_COMPONENT_SWIZZLE_R;
viewInfo.components.g = VK_COMPONENT_SWIZZLE_G;
viewInfo.components.b = VK_COMPONENT_SWIZZLE_B;
viewInfo.components.a = VK_COMPONENT_SWIZZLE_A;
- viewInfo.subresourceRange.aspectMask = isDepth ? VK_IMAGE_ASPECT_DEPTH_BIT : VK_IMAGE_ASPECT_COLOR_BIT;
+ viewInfo.subresourceRange.aspectMask = aspectMask;
viewInfo.subresourceRange.levelCount = mipLevelCount;
- viewInfo.subresourceRange.layerCount = isCube ? 6 : 1;
+ if (isArray && m_arrayRangeStart >= 0 && m_arrayRangeLength >= 0) {
+ viewInfo.subresourceRange.baseArrayLayer = uint32_t(m_arrayRangeStart);
+ viewInfo.subresourceRange.layerCount = uint32_t(m_arrayRangeLength);
+ } else {
+ viewInfo.subresourceRange.layerCount = isCube ? 6 : (isArray ? qMax(0, m_arraySize) : 1);
+ }
VkResult err = rhiD->df->vkCreateImageView(rhiD->dev, &viewInfo, nullptr, &imageView);
if (err != VK_SUCCESS) {
@@ -5272,35 +6586,54 @@ bool QVkTexture::finishBuild()
return false;
}
- nativeHandlesStruct.image = image;
-
lastActiveFrameSlot = -1;
generation += 1;
return true;
}
-bool QVkTexture::build()
+bool QVkTexture::create()
{
QSize size;
- if (!prepareBuild(&size))
+ if (!prepareCreate(&size))
return false;
+ QRHI_RES_RHI(QRhiVulkan);
const bool isRenderTarget = m_flags.testFlag(QRhiTexture::RenderTarget);
const bool isDepth = isDepthTextureFormat(m_format);
const bool isCube = m_flags.testFlag(CubeMap);
+ const bool isArray = m_flags.testFlag(TextureArray);
+ const bool is3D = m_flags.testFlag(ThreeDimensional);
+ const bool is1D = m_flags.testFlag(OneDimensional);
- VkImageCreateInfo imageInfo;
- memset(&imageInfo, 0, sizeof(imageInfo));
+ VkImageCreateInfo imageInfo = {};
imageInfo.sType = VK_STRUCTURE_TYPE_IMAGE_CREATE_INFO;
- imageInfo.flags = isCube ? VK_IMAGE_CREATE_CUBE_COMPATIBLE_BIT : 0;
- imageInfo.imageType = VK_IMAGE_TYPE_2D;
+ imageInfo.flags = 0;
+ if (isCube)
+ imageInfo.flags |= VK_IMAGE_CREATE_CUBE_COMPATIBLE_BIT;
+
+ if (is3D && isRenderTarget) {
+ // This relies on a Vulkan 1.1 constant. For guaranteed proper behavior
+ // this also requires that at run time the VkInstance has at least API 1.1
+ // enabled. (though it works as expected with some Vulkan (1.2)
+ // implementations regardless of the requested API version, but f.ex. the
+ // validation layer complains when using this without enabling >=1.1)
+ if (!rhiD->caps.texture3DSliceAs2D)
+ qWarning("QRhiVulkan: Rendering to 3D texture slice may not be functional without API 1.1 on the VkInstance");
+#ifdef VK_VERSION_1_1
+ imageInfo.flags |= VK_IMAGE_CREATE_2D_ARRAY_COMPATIBLE_BIT;
+#else
+ imageInfo.flags |= 0x00000020;
+#endif
+ }
+
+ imageInfo.imageType = is1D ? VK_IMAGE_TYPE_1D : is3D ? VK_IMAGE_TYPE_3D : VK_IMAGE_TYPE_2D;
imageInfo.format = vkformat;
imageInfo.extent.width = uint32_t(size.width());
imageInfo.extent.height = uint32_t(size.height());
- imageInfo.extent.depth = 1;
+ imageInfo.extent.depth = is3D ? qMax(1, m_depth) : 1;
imageInfo.mipLevels = mipLevelCount;
- imageInfo.arrayLayers = isCube ? 6 : 1;
+ imageInfo.arrayLayers = isCube ? 6 : (isArray ? qMax(0, m_arraySize) : 1);
imageInfo.samples = samples;
imageInfo.tiling = VK_IMAGE_TILING_OPTIMAL;
imageInfo.initialLayout = VK_IMAGE_LAYOUT_PREINITIALIZED;
@@ -5319,74 +6652,48 @@ bool QVkTexture::build()
if (m_flags.testFlag(QRhiTexture::UsedWithLoadStore))
imageInfo.usage |= VK_IMAGE_USAGE_STORAGE_BIT;
- VmaAllocationCreateInfo allocInfo;
- memset(&allocInfo, 0, sizeof(allocInfo));
+ VmaAllocationCreateInfo allocInfo = {};
allocInfo.usage = VMA_MEMORY_USAGE_GPU_ONLY;
- QRHI_RES_RHI(QRhiVulkan);
VmaAllocation allocation;
VkResult err = vmaCreateImage(toVmaAllocator(rhiD->allocator), &imageInfo, &allocInfo, &image, &allocation, nullptr);
if (err != VK_SUCCESS) {
- qWarning("Failed to create image: %d", err);
+ qWarning("Failed to create image (with VkImageCreateInfo %ux%u depth %u vkformat 0x%X mips %u layers %u vksamples 0x%X): %d",
+ imageInfo.extent.width, imageInfo.extent.height, imageInfo.extent.depth,
+ int(imageInfo.format),
+ imageInfo.mipLevels,
+ imageInfo.arrayLayers,
+ int(imageInfo.samples),
+ err);
+ rhiD->printExtraErrorInfo(err);
return false;
}
imageAlloc = allocation;
- if (!finishBuild())
+ if (!finishCreate())
return false;
- rhiD->setObjectName(uint64_t(image), VK_DEBUG_REPORT_OBJECT_TYPE_IMAGE_EXT, m_objectName);
-
- QRHI_PROF;
- QRHI_PROF_F(newTexture(this, true, int(mipLevelCount), isCube ? 6 : 1, samples));
+ rhiD->setObjectName(uint64_t(image), VK_OBJECT_TYPE_IMAGE, m_objectName);
owns = true;
rhiD->registerResource(this);
return true;
}
-bool QVkTexture::buildFrom(const QRhiNativeHandles *src)
+bool QVkTexture::createFrom(QRhiTexture::NativeTexture src)
{
- const QRhiVulkanTextureNativeHandles *h = static_cast<const QRhiVulkanTextureNativeHandles *>(src);
- if (!h || !h->image)
+ VkImage img = VkImage(src.object);
+ if (img == 0)
return false;
- if (!prepareBuild())
+ if (!prepareCreate())
return false;
- image = h->image;
+ image = img;
- if (!finishBuild())
+ if (!finishCreate())
return false;
- QRHI_PROF;
- QRHI_PROF_F(newTexture(this, false, int(mipLevelCount), m_flags.testFlag(CubeMap) ? 6 : 1, samples));
-
- usageState.layout = h->layout;
-
- owns = false;
- QRHI_RES_RHI(QRhiVulkan);
- rhiD->registerResource(this);
- return true;
-}
-
-bool QVkTexture::buildFrom(QRhiTexture::NativeTexture src)
-{
- auto *img = static_cast<const VkImage*>(src.object);
- if (!img || !*img)
- return false;
-
- if (!prepareBuild())
- return false;
-
- image = *img;
-
- if (!finishBuild())
- return false;
-
- QRHI_PROF;
- QRHI_PROF_F(newTexture(this, false, int(mipLevelCount), m_flags.testFlag(CubeMap) ? 6 : 1, samples));
-
usageState.layout = VkImageLayout(src.layout);
owns = false;
@@ -5395,41 +6702,46 @@ bool QVkTexture::buildFrom(QRhiTexture::NativeTexture src)
return true;
}
-const QRhiNativeHandles *QVkTexture::nativeHandles()
+QRhiTexture::NativeTexture QVkTexture::nativeTexture()
{
- nativeHandlesStruct.layout = usageState.layout;
- return &nativeHandlesStruct;
+ return {quint64(image), usageState.layout};
}
-QRhiTexture::NativeTexture QVkTexture::nativeTexture()
+void QVkTexture::setNativeLayout(int layout)
{
- return {&nativeHandlesStruct.image, usageState.layout};
+ usageState.layout = VkImageLayout(layout);
}
-VkImageView QVkTexture::imageViewForLevel(int level)
+VkImageView QVkTexture::perLevelImageViewForLoadStore(int level)
{
Q_ASSERT(level >= 0 && level < int(mipLevelCount));
if (perLevelImageViews[level] != VK_NULL_HANDLE)
return perLevelImageViews[level];
- const bool isDepth = isDepthTextureFormat(m_format);
+ const VkImageAspectFlags aspectMask = aspectMaskForTextureFormat(m_format);
const bool isCube = m_flags.testFlag(CubeMap);
+ const bool isArray = m_flags.testFlag(TextureArray);
+ const bool is3D = m_flags.testFlag(ThreeDimensional);
+ const bool is1D = m_flags.testFlag(OneDimensional);
- VkImageViewCreateInfo viewInfo;
- memset(&viewInfo, 0, sizeof(viewInfo));
+ VkImageViewCreateInfo viewInfo = {};
viewInfo.sType = VK_STRUCTURE_TYPE_IMAGE_VIEW_CREATE_INFO;
viewInfo.image = image;
- viewInfo.viewType = isCube ? VK_IMAGE_VIEW_TYPE_CUBE : VK_IMAGE_VIEW_TYPE_2D;
- viewInfo.format = vkformat;
+ viewInfo.viewType = isCube
+ ? VK_IMAGE_VIEW_TYPE_CUBE
+ : (is3D ? VK_IMAGE_VIEW_TYPE_3D
+ : (is1D ? (isArray ? VK_IMAGE_VIEW_TYPE_1D_ARRAY : VK_IMAGE_VIEW_TYPE_1D)
+ : (isArray ? VK_IMAGE_VIEW_TYPE_2D_ARRAY : VK_IMAGE_VIEW_TYPE_2D)));
+ viewInfo.format = viewFormat; // this is writeViewFormat, regardless of Load, Store, or LoadStore; intentional
viewInfo.components.r = VK_COMPONENT_SWIZZLE_R;
viewInfo.components.g = VK_COMPONENT_SWIZZLE_G;
viewInfo.components.b = VK_COMPONENT_SWIZZLE_B;
viewInfo.components.a = VK_COMPONENT_SWIZZLE_A;
- viewInfo.subresourceRange.aspectMask = isDepth ? VK_IMAGE_ASPECT_DEPTH_BIT : VK_IMAGE_ASPECT_COLOR_BIT;
+ viewInfo.subresourceRange.aspectMask = aspectMask;
viewInfo.subresourceRange.baseMipLevel = uint32_t(level);
viewInfo.subresourceRange.levelCount = 1;
viewInfo.subresourceRange.baseArrayLayer = 0;
- viewInfo.subresourceRange.layerCount = isCube ? 6 : 1;
+ viewInfo.subresourceRange.layerCount = isCube ? 6 : (isArray ? qMax(0, m_arraySize) : 1);
VkImageView v = VK_NULL_HANDLE;
QRHI_RES_RHI(QRhiVulkan);
@@ -5444,17 +6756,17 @@ VkImageView QVkTexture::imageViewForLevel(int level)
}
QVkSampler::QVkSampler(QRhiImplementation *rhi, Filter magFilter, Filter minFilter, Filter mipmapMode,
- AddressMode u, AddressMode v)
- : QRhiSampler(rhi, magFilter, minFilter, mipmapMode, u, v)
+ AddressMode u, AddressMode v, AddressMode w)
+ : QRhiSampler(rhi, magFilter, minFilter, mipmapMode, u, v, w)
{
}
QVkSampler::~QVkSampler()
{
- release();
+ destroy();
}
-void QVkSampler::release()
+void QVkSampler::destroy()
{
if (!sampler)
return;
@@ -5467,17 +6779,18 @@ void QVkSampler::release()
sampler = VK_NULL_HANDLE;
QRHI_RES_RHI(QRhiVulkan);
- rhiD->releaseQueue.append(e);
- rhiD->unregisterResource(this);
+ if (rhiD) {
+ rhiD->releaseQueue.append(e);
+ rhiD->unregisterResource(this);
+ }
}
-bool QVkSampler::build()
+bool QVkSampler::create()
{
if (sampler)
- release();
+ destroy();
- VkSamplerCreateInfo samplerInfo;
- memset(&samplerInfo, 0, sizeof(samplerInfo));
+ VkSamplerCreateInfo samplerInfo = {};
samplerInfo.sType = VK_STRUCTURE_TYPE_SAMPLER_CREATE_INFO;
samplerInfo.magFilter = toVkFilter(m_magFilter);
samplerInfo.minFilter = toVkFilter(m_minFilter);
@@ -5506,14 +6819,15 @@ bool QVkSampler::build()
QVkRenderPassDescriptor::QVkRenderPassDescriptor(QRhiImplementation *rhi)
: QRhiRenderPassDescriptor(rhi)
{
+ serializedFormatData.reserve(64);
}
QVkRenderPassDescriptor::~QVkRenderPassDescriptor()
{
- release();
+ destroy();
}
-void QVkRenderPassDescriptor::release()
+void QVkRenderPassDescriptor::destroy()
{
if (!rp)
return;
@@ -5532,9 +6846,10 @@ void QVkRenderPassDescriptor::release()
rp = VK_NULL_HANDLE;
QRHI_RES_RHI(QRhiVulkan);
- rhiD->releaseQueue.append(e);
-
- rhiD->unregisterResource(this);
+ if (rhiD) {
+ rhiD->releaseQueue.append(e);
+ rhiD->unregisterResource(this);
+ }
}
static inline bool attachmentDescriptionEquals(const VkAttachmentDescription &a, const VkAttachmentDescription &b)
@@ -5551,21 +6866,28 @@ static inline bool attachmentDescriptionEquals(const VkAttachmentDescription &a,
bool QVkRenderPassDescriptor::isCompatible(const QRhiRenderPassDescriptor *other) const
{
+ if (other == this)
+ return true;
+
if (!other)
return false;
const QVkRenderPassDescriptor *o = QRHI_RES(const QVkRenderPassDescriptor, other);
- if (attDescs.count() != o->attDescs.count())
+ if (attDescs.size() != o->attDescs.size())
return false;
- if (colorRefs.count() != o->colorRefs.count())
+ if (colorRefs.size() != o->colorRefs.size())
return false;
- if (resolveRefs.count() != o->resolveRefs.count())
+ if (resolveRefs.size() != o->resolveRefs.size())
return false;
if (hasDepthStencil != o->hasDepthStencil)
return false;
+ if (hasDepthStencilResolve != o->hasDepthStencilResolve)
+ return false;
+ if (multiViewCount != o->multiViewCount)
+ return false;
- for (int i = 0, ie = colorRefs.count(); i != ie; ++i) {
+ for (int i = 0, ie = colorRefs.size(); i != ie; ++i) {
const uint32_t attIdx = colorRefs[i].attachment;
if (attIdx != o->colorRefs[i].attachment)
return false;
@@ -5581,7 +6903,7 @@ bool QVkRenderPassDescriptor::isCompatible(const QRhiRenderPassDescriptor *other
return false;
}
- for (int i = 0, ie = resolveRefs.count(); i != ie; ++i) {
+ for (int i = 0, ie = resolveRefs.size(); i != ie; ++i) {
const uint32_t attIdx = resolveRefs[i].attachment;
if (attIdx != o->resolveRefs[i].attachment)
return false;
@@ -5589,41 +6911,144 @@ bool QVkRenderPassDescriptor::isCompatible(const QRhiRenderPassDescriptor *other
return false;
}
+ if (hasDepthStencilResolve) {
+ const uint32_t attIdx = dsResolveRef.attachment;
+ if (attIdx != o->dsResolveRef.attachment)
+ return false;
+ if (attIdx != VK_ATTACHMENT_UNUSED && !attachmentDescriptionEquals(attDescs[attIdx], o->attDescs[attIdx]))
+ return false;
+ }
+
+ // subpassDeps is not included
+
return true;
}
+void QVkRenderPassDescriptor::updateSerializedFormat()
+{
+ serializedFormatData.clear();
+ auto p = std::back_inserter(serializedFormatData);
+
+ *p++ = attDescs.size();
+ *p++ = colorRefs.size();
+ *p++ = resolveRefs.size();
+ *p++ = hasDepthStencil;
+ *p++ = hasDepthStencilResolve;
+ *p++ = multiViewCount;
+
+ auto serializeAttachmentData = [this, &p](uint32_t attIdx) {
+ const bool used = attIdx != VK_ATTACHMENT_UNUSED;
+ const VkAttachmentDescription *a = used ? &attDescs[attIdx] : nullptr;
+ *p++ = used ? a->format : 0;
+ *p++ = used ? a->samples : 0;
+ *p++ = used ? a->loadOp : 0;
+ *p++ = used ? a->storeOp : 0;
+ *p++ = used ? a->stencilLoadOp : 0;
+ *p++ = used ? a->stencilStoreOp : 0;
+ *p++ = used ? a->initialLayout : 0;
+ *p++ = used ? a->finalLayout : 0;
+ };
+
+ for (int i = 0, ie = colorRefs.size(); i != ie; ++i) {
+ const uint32_t attIdx = colorRefs[i].attachment;
+ *p++ = attIdx;
+ serializeAttachmentData(attIdx);
+ }
+
+ if (hasDepthStencil) {
+ const uint32_t attIdx = dsRef.attachment;
+ *p++ = attIdx;
+ serializeAttachmentData(attIdx);
+ }
+
+ for (int i = 0, ie = resolveRefs.size(); i != ie; ++i) {
+ const uint32_t attIdx = resolveRefs[i].attachment;
+ *p++ = attIdx;
+ serializeAttachmentData(attIdx);
+ }
+
+ if (hasDepthStencilResolve) {
+ const uint32_t attIdx = dsResolveRef.attachment;
+ *p++ = attIdx;
+ serializeAttachmentData(attIdx);
+ }
+}
+
+QRhiRenderPassDescriptor *QVkRenderPassDescriptor::newCompatibleRenderPassDescriptor() const
+{
+ QVkRenderPassDescriptor *rpD = new QVkRenderPassDescriptor(m_rhi);
+
+ rpD->ownsRp = true;
+ rpD->attDescs = attDescs;
+ rpD->colorRefs = colorRefs;
+ rpD->resolveRefs = resolveRefs;
+ rpD->subpassDeps = subpassDeps;
+ rpD->hasDepthStencil = hasDepthStencil;
+ rpD->hasDepthStencilResolve = hasDepthStencilResolve;
+ rpD->multiViewCount = multiViewCount;
+ rpD->dsRef = dsRef;
+ rpD->dsResolveRef = dsResolveRef;
+
+ VkRenderPassCreateInfo rpInfo;
+ VkSubpassDescription subpassDesc;
+ fillRenderPassCreateInfo(&rpInfo, &subpassDesc, rpD);
+
+ QRHI_RES_RHI(QRhiVulkan);
+ MultiViewRenderPassSetupHelper multiViewHelper;
+ if (!multiViewHelper.prepare(&rpInfo, multiViewCount, rhiD->caps.multiView)) {
+ delete rpD;
+ return nullptr;
+ }
+
+ VkResult err = rhiD->df->vkCreateRenderPass(rhiD->dev, &rpInfo, nullptr, &rpD->rp);
+ if (err != VK_SUCCESS) {
+ qWarning("Failed to create renderpass: %d", err);
+ delete rpD;
+ return nullptr;
+ }
+
+ rpD->updateSerializedFormat();
+ rhiD->registerResource(rpD);
+ return rpD;
+}
+
+QVector<quint32> QVkRenderPassDescriptor::serializedFormat() const
+{
+ return serializedFormatData;
+}
+
const QRhiNativeHandles *QVkRenderPassDescriptor::nativeHandles()
{
nativeHandlesStruct.renderPass = rp;
return &nativeHandlesStruct;
}
-QVkReferenceRenderTarget::QVkReferenceRenderTarget(QRhiImplementation *rhi)
- : QRhiRenderTarget(rhi)
+QVkSwapChainRenderTarget::QVkSwapChainRenderTarget(QRhiImplementation *rhi, QRhiSwapChain *swapchain)
+ : QRhiSwapChainRenderTarget(rhi, swapchain)
{
}
-QVkReferenceRenderTarget::~QVkReferenceRenderTarget()
+QVkSwapChainRenderTarget::~QVkSwapChainRenderTarget()
{
- release();
+ destroy();
}
-void QVkReferenceRenderTarget::release()
+void QVkSwapChainRenderTarget::destroy()
{
// nothing to do here
}
-QSize QVkReferenceRenderTarget::pixelSize() const
+QSize QVkSwapChainRenderTarget::pixelSize() const
{
return d.pixelSize;
}
-float QVkReferenceRenderTarget::devicePixelRatio() const
+float QVkSwapChainRenderTarget::devicePixelRatio() const
{
return d.dpr;
}
-int QVkReferenceRenderTarget::sampleCount() const
+int QVkSwapChainRenderTarget::sampleCount() const
{
return d.sampleCount;
}
@@ -5641,10 +7066,10 @@ QVkTextureRenderTarget::QVkTextureRenderTarget(QRhiImplementation *rhi,
QVkTextureRenderTarget::~QVkTextureRenderTarget()
{
- release();
+ destroy();
}
-void QVkTextureRenderTarget::release()
+void QVkTextureRenderTarget::destroy()
{
if (!d.fb)
return;
@@ -5663,15 +7088,21 @@ void QVkTextureRenderTarget::release()
resrtv[att] = VK_NULL_HANDLE;
}
- QRHI_RES_RHI(QRhiVulkan);
- rhiD->releaseQueue.append(e);
+ e.textureRenderTarget.dsv = dsv;
+ dsv = VK_NULL_HANDLE;
+ e.textureRenderTarget.resdsv = resdsv;
+ resdsv = VK_NULL_HANDLE;
- rhiD->unregisterResource(this);
+ QRHI_RES_RHI(QRhiVulkan);
+ if (rhiD) {
+ rhiD->releaseQueue.append(e);
+ rhiD->unregisterResource(this);
+ }
}
QRhiRenderPassDescriptor *QVkTextureRenderTarget::newCompatibleRenderPassDescriptor()
{
- // not yet built so cannot rely on data computed in build()
+ // not yet built so cannot rely on data computed in create()
QRHI_RES_RHI(QRhiVulkan);
QVkRenderPassDescriptor *rp = new QVkRenderPassDescriptor(m_rhi);
@@ -5680,30 +7111,33 @@ QRhiRenderPassDescriptor *QVkTextureRenderTarget::newCompatibleRenderPassDescrip
m_desc.cendColorAttachments(),
m_flags.testFlag(QRhiTextureRenderTarget::PreserveColorContents),
m_flags.testFlag(QRhiTextureRenderTarget::PreserveDepthStencilContents),
+ m_desc.depthTexture() && !m_flags.testFlag(DoNotStoreDepthStencilContents) && !m_desc.depthResolveTexture(),
m_desc.depthStencilBuffer(),
- m_desc.depthTexture()))
+ m_desc.depthTexture(),
+ m_desc.depthResolveTexture()))
{
delete rp;
return nullptr;
}
rp->ownsRp = true;
+ rp->updateSerializedFormat();
rhiD->registerResource(rp);
return rp;
}
-bool QVkTextureRenderTarget::build()
+bool QVkTextureRenderTarget::create()
{
if (d.fb)
- release();
+ destroy();
- const bool hasColorAttachments = m_desc.cbeginColorAttachments() != m_desc.cendColorAttachments();
- Q_ASSERT(hasColorAttachments || m_desc.depthTexture());
+ Q_ASSERT(m_desc.colorAttachmentCount() > 0 || m_desc.depthTexture());
Q_ASSERT(!m_desc.depthStencilBuffer() || !m_desc.depthTexture());
const bool hasDepthStencil = m_desc.depthStencilBuffer() || m_desc.depthTexture();
QRHI_RES_RHI(QRhiVulkan);
QVarLengthArray<VkImageView, 8> views;
+ d.multiViewCount = 0;
d.colorAttCount = 0;
int attIndex = 0;
@@ -5714,12 +7148,17 @@ bool QVkTextureRenderTarget::build()
Q_ASSERT(texD || rbD);
if (texD) {
Q_ASSERT(texD->flags().testFlag(QRhiTexture::RenderTarget));
- VkImageViewCreateInfo viewInfo;
- memset(&viewInfo, 0, sizeof(viewInfo));
+ const bool is1D = texD->flags().testFlag(QRhiTexture::OneDimensional);
+ const bool isMultiView = it->multiViewCount() >= 2;
+ if (isMultiView && d.multiViewCount == 0)
+ d.multiViewCount = it->multiViewCount();
+ VkImageViewCreateInfo viewInfo = {};
viewInfo.sType = VK_STRUCTURE_TYPE_IMAGE_VIEW_CREATE_INFO;
viewInfo.image = texD->image;
- viewInfo.viewType = VK_IMAGE_VIEW_TYPE_2D;
- viewInfo.format = texD->vkformat;
+ viewInfo.viewType = is1D ? VK_IMAGE_VIEW_TYPE_1D
+ : (isMultiView ? VK_IMAGE_VIEW_TYPE_2D_ARRAY
+ : VK_IMAGE_VIEW_TYPE_2D);
+ viewInfo.format = texD->viewFormat;
viewInfo.components.r = VK_COMPONENT_SWIZZLE_R;
viewInfo.components.g = VK_COMPONENT_SWIZZLE_G;
viewInfo.components.b = VK_COMPONENT_SWIZZLE_B;
@@ -5728,7 +7167,7 @@ bool QVkTextureRenderTarget::build()
viewInfo.subresourceRange.baseMipLevel = uint32_t(it->level());
viewInfo.subresourceRange.levelCount = 1;
viewInfo.subresourceRange.baseArrayLayer = uint32_t(it->layer());
- viewInfo.subresourceRange.layerCount = 1;
+ viewInfo.subresourceRange.layerCount = uint32_t(isMultiView ? it->multiViewCount() : 1);
VkResult err = rhiD->df->vkCreateImageView(rhiD->dev, &viewInfo, nullptr, &rtv[attIndex]);
if (err != VK_SUCCESS) {
qWarning("Failed to create render target image view: %d", err);
@@ -5736,7 +7175,7 @@ bool QVkTextureRenderTarget::build()
}
views.append(rtv[attIndex]);
if (attIndex == 0) {
- d.pixelSize = texD->pixelSize();
+ d.pixelSize = rhiD->q->sizeForMipLevel(it->level(), texD->pixelSize());
d.sampleCount = texD->samples;
}
} else if (rbD) {
@@ -5753,7 +7192,25 @@ bool QVkTextureRenderTarget::build()
if (hasDepthStencil) {
if (m_desc.depthTexture()) {
QVkTexture *depthTexD = QRHI_RES(QVkTexture, m_desc.depthTexture());
- views.append(depthTexD->imageView);
+ // need a dedicated view just because viewFormat may differ from vkformat
+ VkImageViewCreateInfo viewInfo = {};
+ viewInfo.sType = VK_STRUCTURE_TYPE_IMAGE_VIEW_CREATE_INFO;
+ viewInfo.image = depthTexD->image;
+ viewInfo.viewType = d.multiViewCount > 1 ? VK_IMAGE_VIEW_TYPE_2D_ARRAY : VK_IMAGE_VIEW_TYPE_2D;
+ viewInfo.format = depthTexD->viewFormat;
+ viewInfo.components.r = VK_COMPONENT_SWIZZLE_R;
+ viewInfo.components.g = VK_COMPONENT_SWIZZLE_G;
+ viewInfo.components.b = VK_COMPONENT_SWIZZLE_B;
+ viewInfo.components.a = VK_COMPONENT_SWIZZLE_A;
+ viewInfo.subresourceRange.aspectMask = VK_IMAGE_ASPECT_DEPTH_BIT | VK_IMAGE_ASPECT_STENCIL_BIT;
+ viewInfo.subresourceRange.levelCount = 1;
+ viewInfo.subresourceRange.layerCount = qMax<uint32_t>(1, d.multiViewCount);
+ VkResult err = rhiD->df->vkCreateImageView(rhiD->dev, &viewInfo, nullptr, &dsv);
+ if (err != VK_SUCCESS) {
+ qWarning("Failed to create depth-stencil image view for rt: %d", err);
+ return false;
+ }
+ views.append(dsv);
if (d.colorAttCount == 0) {
d.pixelSize = depthTexD->pixelSize();
d.sampleCount = depthTexD->samples;
@@ -5773,18 +7230,19 @@ bool QVkTextureRenderTarget::build()
d.resolveAttCount = 0;
attIndex = 0;
+ Q_ASSERT(d.multiViewCount == 0 || d.multiViewCount >= 2);
for (auto it = m_desc.cbeginColorAttachments(), itEnd = m_desc.cendColorAttachments(); it != itEnd; ++it, ++attIndex) {
if (it->resolveTexture()) {
QVkTexture *resTexD = QRHI_RES(QVkTexture, it->resolveTexture());
Q_ASSERT(resTexD->flags().testFlag(QRhiTexture::RenderTarget));
d.resolveAttCount += 1;
- VkImageViewCreateInfo viewInfo;
- memset(&viewInfo, 0, sizeof(viewInfo));
+ VkImageViewCreateInfo viewInfo = {};
viewInfo.sType = VK_STRUCTURE_TYPE_IMAGE_VIEW_CREATE_INFO;
viewInfo.image = resTexD->image;
- viewInfo.viewType = VK_IMAGE_VIEW_TYPE_2D;
- viewInfo.format = resTexD->vkformat;
+ viewInfo.viewType = d.multiViewCount ? VK_IMAGE_VIEW_TYPE_2D_ARRAY
+ : VK_IMAGE_VIEW_TYPE_2D;
+ viewInfo.format = resTexD->viewFormat;
viewInfo.components.r = VK_COMPONENT_SWIZZLE_R;
viewInfo.components.g = VK_COMPONENT_SWIZZLE_G;
viewInfo.components.b = VK_COMPONENT_SWIZZLE_B;
@@ -5793,7 +7251,7 @@ bool QVkTextureRenderTarget::build()
viewInfo.subresourceRange.baseMipLevel = uint32_t(it->resolveLevel());
viewInfo.subresourceRange.levelCount = 1;
viewInfo.subresourceRange.baseArrayLayer = uint32_t(it->resolveLayer());
- viewInfo.subresourceRange.layerCount = 1;
+ viewInfo.subresourceRange.layerCount = qMax<uint32_t>(1, d.multiViewCount);
VkResult err = rhiD->df->vkCreateImageView(rhiD->dev, &viewInfo, nullptr, &resrtv[attIndex]);
if (err != VK_SUCCESS) {
qWarning("Failed to create render target resolve image view: %d", err);
@@ -5803,17 +7261,46 @@ bool QVkTextureRenderTarget::build()
}
}
+ if (m_desc.depthResolveTexture()) {
+ QVkTexture *resTexD = QRHI_RES(QVkTexture, m_desc.depthResolveTexture());
+ Q_ASSERT(resTexD->flags().testFlag(QRhiTexture::RenderTarget));
+
+ VkImageViewCreateInfo viewInfo = {};
+ viewInfo.sType = VK_STRUCTURE_TYPE_IMAGE_VIEW_CREATE_INFO;
+ viewInfo.image = resTexD->image;
+ viewInfo.viewType = d.multiViewCount ? VK_IMAGE_VIEW_TYPE_2D_ARRAY
+ : VK_IMAGE_VIEW_TYPE_2D;
+ viewInfo.format = resTexD->viewFormat;
+ viewInfo.components.r = VK_COMPONENT_SWIZZLE_R;
+ viewInfo.components.g = VK_COMPONENT_SWIZZLE_G;
+ viewInfo.components.b = VK_COMPONENT_SWIZZLE_B;
+ viewInfo.components.a = VK_COMPONENT_SWIZZLE_A;
+ viewInfo.subresourceRange.aspectMask = VK_IMAGE_ASPECT_DEPTH_BIT | VK_IMAGE_ASPECT_STENCIL_BIT;
+ viewInfo.subresourceRange.baseMipLevel = 0;
+ viewInfo.subresourceRange.levelCount = 1;
+ viewInfo.subresourceRange.baseArrayLayer = 0;
+ viewInfo.subresourceRange.layerCount = qMax<uint32_t>(1, d.multiViewCount);
+ VkResult err = rhiD->df->vkCreateImageView(rhiD->dev, &viewInfo, nullptr, &resdsv);
+ if (err != VK_SUCCESS) {
+ qWarning("Failed to create render target depth resolve image view: %d", err);
+ return false;
+ }
+ views.append(resdsv);
+ d.dsResolveAttCount = 1;
+ } else {
+ d.dsResolveAttCount = 0;
+ }
+
if (!m_renderPassDesc)
qWarning("QVkTextureRenderTarget: No renderpass descriptor set. See newCompatibleRenderPassDescriptor() and setRenderPassDescriptor().");
d.rp = QRHI_RES(QVkRenderPassDescriptor, m_renderPassDesc);
Q_ASSERT(d.rp && d.rp->rp);
- VkFramebufferCreateInfo fbInfo;
- memset(&fbInfo, 0, sizeof(fbInfo));
+ VkFramebufferCreateInfo fbInfo = {};
fbInfo.sType = VK_STRUCTURE_TYPE_FRAMEBUFFER_CREATE_INFO;
fbInfo.renderPass = d.rp->rp;
- fbInfo.attachmentCount = uint32_t(d.colorAttCount + d.dsAttCount + d.resolveAttCount);
+ fbInfo.attachmentCount = uint32_t(d.colorAttCount + d.dsAttCount + d.resolveAttCount + d.dsResolveAttCount);
fbInfo.pAttachments = views.constData();
fbInfo.width = uint32_t(d.pixelSize.width());
fbInfo.height = uint32_t(d.pixelSize.height());
@@ -5825,6 +7312,8 @@ bool QVkTextureRenderTarget::build()
return false;
}
+ QRhiRenderTargetAttachmentTracker::updateResIdList<QVkTexture, QVkRenderBuffer>(m_desc, &d.currentResIdList);
+
lastActiveFrameSlot = -1;
rhiD->registerResource(this);
return true;
@@ -5832,6 +7321,9 @@ bool QVkTextureRenderTarget::build()
QSize QVkTextureRenderTarget::pixelSize() const
{
+ if (!QRhiRenderTargetAttachmentTracker::isUpToDate<QVkTexture, QVkRenderBuffer>(m_desc, d.currentResIdList))
+ const_cast<QVkTextureRenderTarget *>(this)->create();
+
return d.pixelSize;
}
@@ -5852,10 +7344,10 @@ QVkShaderResourceBindings::QVkShaderResourceBindings(QRhiImplementation *rhi)
QVkShaderResourceBindings::~QVkShaderResourceBindings()
{
- release();
+ destroy();
}
-void QVkShaderResourceBindings::release()
+void QVkShaderResourceBindings::destroy()
{
if (!layout)
return;
@@ -5875,54 +7367,68 @@ void QVkShaderResourceBindings::release()
descSets[i] = VK_NULL_HANDLE;
QRHI_RES_RHI(QRhiVulkan);
- rhiD->releaseQueue.append(e);
-
- rhiD->unregisterResource(this);
+ if (rhiD) {
+ rhiD->releaseQueue.append(e);
+ rhiD->unregisterResource(this);
+ }
}
-bool QVkShaderResourceBindings::build()
+bool QVkShaderResourceBindings::create()
{
if (layout)
- release();
+ destroy();
+
+ QRHI_RES_RHI(QRhiVulkan);
+ if (!rhiD->sanityCheckShaderResourceBindings(this))
+ return false;
+
+ rhiD->updateLayoutDesc(this);
for (int i = 0; i < QVK_FRAMES_IN_FLIGHT; ++i)
descSets[i] = VK_NULL_HANDLE;
sortedBindings.clear();
std::copy(m_bindings.cbegin(), m_bindings.cend(), std::back_inserter(sortedBindings));
- std::sort(sortedBindings.begin(), sortedBindings.end(),
- [](const QRhiShaderResourceBinding &a, const QRhiShaderResourceBinding &b)
- {
- return a.data()->binding < b.data()->binding;
- });
+ std::sort(sortedBindings.begin(), sortedBindings.end(), QRhiImplementation::sortedBindingLessThan);
+
+ hasSlottedResource = false;
+ hasDynamicOffset = false;
+ for (const QRhiShaderResourceBinding &binding : std::as_const(sortedBindings)) {
+ const QRhiShaderResourceBinding::Data *b = QRhiImplementation::shaderResourceBindingData(binding);
+ if (b->type == QRhiShaderResourceBinding::UniformBuffer && b->u.ubuf.buf) {
+ if (QRHI_RES(QVkBuffer, b->u.ubuf.buf)->type() == QRhiBuffer::Dynamic)
+ hasSlottedResource = true;
+ if (b->u.ubuf.hasDynamicOffset)
+ hasDynamicOffset = true;
+ }
+ }
QVarLengthArray<VkDescriptorSetLayoutBinding, 4> vkbindings;
- for (const QRhiShaderResourceBinding &binding : qAsConst(sortedBindings)) {
- const QRhiShaderResourceBinding::Data *b = binding.data();
- VkDescriptorSetLayoutBinding vkbinding;
- memset(&vkbinding, 0, sizeof(vkbinding));
+ for (const QRhiShaderResourceBinding &binding : std::as_const(sortedBindings)) {
+ const QRhiShaderResourceBinding::Data *b = QRhiImplementation::shaderResourceBindingData(binding);
+ VkDescriptorSetLayoutBinding vkbinding = {};
vkbinding.binding = uint32_t(b->binding);
vkbinding.descriptorType = toVkDescriptorType(b);
- vkbinding.descriptorCount = 1; // no array support yet
+ if (b->type == QRhiShaderResourceBinding::SampledTexture || b->type == QRhiShaderResourceBinding::Texture)
+ vkbinding.descriptorCount = b->u.stex.count;
+ else
+ vkbinding.descriptorCount = 1;
vkbinding.stageFlags = toVkShaderStageFlags(b->stage);
vkbindings.append(vkbinding);
}
- VkDescriptorSetLayoutCreateInfo layoutInfo;
- memset(&layoutInfo, 0, sizeof(layoutInfo));
+ VkDescriptorSetLayoutCreateInfo layoutInfo = {};
layoutInfo.sType = VK_STRUCTURE_TYPE_DESCRIPTOR_SET_LAYOUT_CREATE_INFO;
- layoutInfo.bindingCount = uint32_t(vkbindings.count());
+ layoutInfo.bindingCount = uint32_t(vkbindings.size());
layoutInfo.pBindings = vkbindings.constData();
- QRHI_RES_RHI(QRhiVulkan);
VkResult err = rhiD->df->vkCreateDescriptorSetLayout(rhiD->dev, &layoutInfo, nullptr, &layout);
if (err != VK_SUCCESS) {
qWarning("Failed to create descriptor set layout: %d", err);
return false;
}
- VkDescriptorSetAllocateInfo allocInfo;
- memset(&allocInfo, 0, sizeof(allocInfo));
+ VkDescriptorSetAllocateInfo allocInfo = {};
allocInfo.sType = VK_STRUCTURE_TYPE_DESCRIPTOR_SET_ALLOCATE_INFO;
allocInfo.descriptorSetCount = QVK_FRAMES_IN_FLIGHT;
VkDescriptorSetLayout layouts[QVK_FRAMES_IN_FLIGHT];
@@ -5932,7 +7438,11 @@ bool QVkShaderResourceBindings::build()
if (!rhiD->allocateDescriptorSet(&allocInfo, descSets, &poolIndex))
return false;
- rhiD->updateShaderResourceBindings(this);
+ for (int i = 0; i < QVK_FRAMES_IN_FLIGHT; ++i) {
+ boundResourceData[i].resize(sortedBindings.size());
+ for (BoundResourceData &bd : boundResourceData[i])
+ memset(&bd, 0, sizeof(BoundResourceData));
+ }
lastActiveFrameSlot = -1;
generation += 1;
@@ -5940,6 +7450,31 @@ bool QVkShaderResourceBindings::build()
return true;
}
+void QVkShaderResourceBindings::updateResources(UpdateFlags flags)
+{
+ sortedBindings.clear();
+ std::copy(m_bindings.cbegin(), m_bindings.cend(), std::back_inserter(sortedBindings));
+ if (!flags.testFlag(BindingsAreSorted))
+ std::sort(sortedBindings.begin(), sortedBindings.end(), QRhiImplementation::sortedBindingLessThan);
+
+ // Reset the state tracking table too - it can deal with assigning a
+ // different QRhiBuffer/Texture/Sampler for a binding point, but it cannot
+ // detect changes in the associated data, such as the buffer offset. And
+ // just like after a create(), a call to updateResources() may lead to now
+ // specifying a different offset for the same QRhiBuffer for a given binding
+ // point. The same applies to other type of associated data that is not part
+ // of the layout, such as the mip level for a StorageImage. Instead of
+ // complicating the checks in setShaderResources(), reset the table here
+ // just like we do in create().
+ for (int i = 0; i < QVK_FRAMES_IN_FLIGHT; ++i) {
+ Q_ASSERT(boundResourceData[i].size() == sortedBindings.size());
+ for (BoundResourceData &bd : boundResourceData[i])
+ memset(&bd, 0, sizeof(BoundResourceData));
+ }
+
+ generation += 1;
+}
+
QVkGraphicsPipeline::QVkGraphicsPipeline(QRhiImplementation *rhi)
: QRhiGraphicsPipeline(rhi)
{
@@ -5947,10 +7482,10 @@ QVkGraphicsPipeline::QVkGraphicsPipeline(QRhiImplementation *rhi)
QVkGraphicsPipeline::~QVkGraphicsPipeline()
{
- release();
+ destroy();
}
-void QVkGraphicsPipeline::release()
+void QVkGraphicsPipeline::destroy()
{
if (!pipeline && !layout)
return;
@@ -5966,25 +7501,26 @@ void QVkGraphicsPipeline::release()
layout = VK_NULL_HANDLE;
QRHI_RES_RHI(QRhiVulkan);
- rhiD->releaseQueue.append(e);
-
- rhiD->unregisterResource(this);
+ if (rhiD) {
+ rhiD->releaseQueue.append(e);
+ rhiD->unregisterResource(this);
+ }
}
-bool QVkGraphicsPipeline::build()
+bool QVkGraphicsPipeline::create()
{
if (pipeline)
- release();
+ destroy();
QRHI_RES_RHI(QRhiVulkan);
+ rhiD->pipelineCreationStart();
if (!rhiD->sanityCheckGraphicsPipeline(this))
return false;
if (!rhiD->ensurePipelineCache())
return false;
- VkPipelineLayoutCreateInfo pipelineLayoutInfo;
- memset(&pipelineLayoutInfo, 0, sizeof(pipelineLayoutInfo));
+ VkPipelineLayoutCreateInfo pipelineLayoutInfo = {};
pipelineLayoutInfo.sType = VK_STRUCTURE_TYPE_PIPELINE_LAYOUT_CREATE_INFO;
pipelineLayoutInfo.setLayoutCount = 1;
QVkShaderResourceBindings *srbD = QRHI_RES(QVkShaderResourceBindings, m_shaderResourceBindings);
@@ -5996,8 +7532,7 @@ bool QVkGraphicsPipeline::build()
return false;
}
- VkGraphicsPipelineCreateInfo pipelineInfo;
- memset(&pipelineInfo, 0, sizeof(pipelineInfo));
+ VkGraphicsPipelineCreateInfo pipelineInfo = {};
pipelineInfo.sType = VK_STRUCTURE_TYPE_GRAPHICS_PIPELINE_CREATE_INFO;
QVarLengthArray<VkShaderModule, 4> shaders;
@@ -6012,8 +7547,7 @@ bool QVkGraphicsPipeline::build()
VkShaderModule shader = rhiD->createShader(spirv.shader());
if (shader) {
shaders.append(shader);
- VkPipelineShaderStageCreateInfo shaderInfo;
- memset(&shaderInfo, 0, sizeof(shaderInfo));
+ VkPipelineShaderStageCreateInfo shaderInfo = {};
shaderInfo.sType = VK_STRUCTURE_TYPE_PIPELINE_SHADER_STAGE_CREATE_INFO;
shaderInfo.stage = toVkShaderStage(shaderStage.type());
shaderInfo.module = shader;
@@ -6021,11 +7555,13 @@ bool QVkGraphicsPipeline::build()
shaderStageCreateInfos.append(shaderInfo);
}
}
- pipelineInfo.stageCount = uint32_t(shaderStageCreateInfos.count());
+ pipelineInfo.stageCount = uint32_t(shaderStageCreateInfos.size());
pipelineInfo.pStages = shaderStageCreateInfos.constData();
QVarLengthArray<VkVertexInputBindingDescription, 4> vertexBindings;
+#ifdef VK_EXT_vertex_attribute_divisor
QVarLengthArray<VkVertexInputBindingDivisorDescriptionEXT> nonOneStepRates;
+#endif
int bindingIndex = 0;
for (auto it = m_vertexInputLayout.cbeginBindings(), itEnd = m_vertexInputLayout.cendBindings();
it != itEnd; ++it, ++bindingIndex)
@@ -6037,9 +7573,12 @@ bool QVkGraphicsPipeline::build()
? VK_VERTEX_INPUT_RATE_VERTEX : VK_VERTEX_INPUT_RATE_INSTANCE
};
if (it->classification() == QRhiVertexInputBinding::PerInstance && it->instanceStepRate() != 1) {
- if (rhiD->vertexAttribDivisorAvailable) {
- nonOneStepRates.append({ uint32_t(bindingIndex), uint32_t(it->instanceStepRate()) });
- } else {
+#ifdef VK_EXT_vertex_attribute_divisor
+ if (rhiD->caps.vertexAttribDivisor) {
+ nonOneStepRates.append({ uint32_t(bindingIndex), it->instanceStepRate() });
+ } else
+#endif
+ {
qWarning("QRhiVulkan: Instance step rates other than 1 not supported without "
"VK_EXT_vertex_attribute_divisor on the device and "
"VK_KHR_get_physical_device_properties2 on the instance");
@@ -6059,21 +7598,21 @@ bool QVkGraphicsPipeline::build()
};
vertexAttributes.append(attributeInfo);
}
- VkPipelineVertexInputStateCreateInfo vertexInputInfo;
- memset(&vertexInputInfo, 0, sizeof(vertexInputInfo));
+ VkPipelineVertexInputStateCreateInfo vertexInputInfo = {};
vertexInputInfo.sType = VK_STRUCTURE_TYPE_PIPELINE_VERTEX_INPUT_STATE_CREATE_INFO;
- vertexInputInfo.vertexBindingDescriptionCount = uint32_t(vertexBindings.count());
+ vertexInputInfo.vertexBindingDescriptionCount = uint32_t(vertexBindings.size());
vertexInputInfo.pVertexBindingDescriptions = vertexBindings.constData();
- vertexInputInfo.vertexAttributeDescriptionCount = uint32_t(vertexAttributes.count());
+ vertexInputInfo.vertexAttributeDescriptionCount = uint32_t(vertexAttributes.size());
vertexInputInfo.pVertexAttributeDescriptions = vertexAttributes.constData();
- VkPipelineVertexInputDivisorStateCreateInfoEXT divisorInfo;
+#ifdef VK_EXT_vertex_attribute_divisor
+ VkPipelineVertexInputDivisorStateCreateInfoEXT divisorInfo = {};
if (!nonOneStepRates.isEmpty()) {
- memset(&divisorInfo, 0, sizeof(divisorInfo));
- divisorInfo.sType = VkStructureType(1000190001); // VK_STRUCTURE_TYPE_PIPELINE_VERTEX_INPUT_DIVISOR_STATE_CREATE_INFO_EXT
- divisorInfo.vertexBindingDivisorCount = uint32_t(nonOneStepRates.count());
+ divisorInfo.sType = VK_STRUCTURE_TYPE_PIPELINE_VERTEX_INPUT_DIVISOR_STATE_CREATE_INFO_EXT;
+ divisorInfo.vertexBindingDivisorCount = uint32_t(nonOneStepRates.size());
divisorInfo.pVertexBindingDivisors = nonOneStepRates.constData();
vertexInputInfo.pNext = &divisorInfo;
}
+#endif
pipelineInfo.pVertexInputState = &vertexInputInfo;
QVarLengthArray<VkDynamicState, 8> dynEnable;
@@ -6084,42 +7623,70 @@ bool QVkGraphicsPipeline::build()
if (m_flags.testFlag(QRhiGraphicsPipeline::UsesStencilRef))
dynEnable << VK_DYNAMIC_STATE_STENCIL_REFERENCE;
- VkPipelineDynamicStateCreateInfo dynamicInfo;
- memset(&dynamicInfo, 0, sizeof(dynamicInfo));
+ VkPipelineDynamicStateCreateInfo dynamicInfo = {};
dynamicInfo.sType = VK_STRUCTURE_TYPE_PIPELINE_DYNAMIC_STATE_CREATE_INFO;
- dynamicInfo.dynamicStateCount = uint32_t(dynEnable.count());
+ dynamicInfo.dynamicStateCount = uint32_t(dynEnable.size());
dynamicInfo.pDynamicStates = dynEnable.constData();
pipelineInfo.pDynamicState = &dynamicInfo;
- VkPipelineViewportStateCreateInfo viewportInfo;
- memset(&viewportInfo, 0, sizeof(viewportInfo));
+ VkPipelineViewportStateCreateInfo viewportInfo = {};
viewportInfo.sType = VK_STRUCTURE_TYPE_PIPELINE_VIEWPORT_STATE_CREATE_INFO;
viewportInfo.viewportCount = viewportInfo.scissorCount = 1;
pipelineInfo.pViewportState = &viewportInfo;
- VkPipelineInputAssemblyStateCreateInfo inputAsmInfo;
- memset(&inputAsmInfo, 0, sizeof(inputAsmInfo));
+ VkPipelineInputAssemblyStateCreateInfo inputAsmInfo = {};
inputAsmInfo.sType = VK_STRUCTURE_TYPE_PIPELINE_INPUT_ASSEMBLY_STATE_CREATE_INFO;
inputAsmInfo.topology = toVkTopology(m_topology);
inputAsmInfo.primitiveRestartEnable = (m_topology == TriangleStrip || m_topology == LineStrip);
pipelineInfo.pInputAssemblyState = &inputAsmInfo;
- VkPipelineRasterizationStateCreateInfo rastInfo;
- memset(&rastInfo, 0, sizeof(rastInfo));
+ VkPipelineTessellationStateCreateInfo tessInfo = {};
+#ifdef VK_VERSION_1_1
+ VkPipelineTessellationDomainOriginStateCreateInfo originInfo = {};
+#endif
+ if (m_topology == Patches) {
+ tessInfo.sType = VK_STRUCTURE_TYPE_PIPELINE_TESSELLATION_STATE_CREATE_INFO;
+ tessInfo.patchControlPoints = uint32_t(qMax(1, m_patchControlPointCount));
+
+ // To be able to use the same tess.evaluation shader with both OpenGL
+ // and Vulkan, flip the tessellation domain origin to be lower left.
+ // This allows declaring the winding order in the shader to be CCW and
+ // still have it working with both APIs. This requires Vulkan 1.1 (or
+ // VK_KHR_maintenance2 but don't bother with that).
+#ifdef VK_VERSION_1_1
+ if (rhiD->caps.apiVersion >= QVersionNumber(1, 1)) {
+ originInfo.sType = VK_STRUCTURE_TYPE_PIPELINE_TESSELLATION_DOMAIN_ORIGIN_STATE_CREATE_INFO;
+ originInfo.domainOrigin = VK_TESSELLATION_DOMAIN_ORIGIN_LOWER_LEFT;
+ tessInfo.pNext = &originInfo;
+ } else {
+ qWarning("Proper tessellation support requires Vulkan 1.1 or newer, leaving domain origin unset");
+ }
+#else
+ qWarning("QRhi was built without Vulkan 1.1 headers, this is not sufficient for proper tessellation support");
+#endif
+
+ pipelineInfo.pTessellationState = &tessInfo;
+ }
+
+ VkPipelineRasterizationStateCreateInfo rastInfo = {};
rastInfo.sType = VK_STRUCTURE_TYPE_PIPELINE_RASTERIZATION_STATE_CREATE_INFO;
rastInfo.cullMode = toVkCullMode(m_cullMode);
rastInfo.frontFace = toVkFrontFace(m_frontFace);
- rastInfo.lineWidth = rhiD->hasWideLines ? m_lineWidth : 1.0f;
+ if (m_depthBias != 0 || !qFuzzyIsNull(m_slopeScaledDepthBias)) {
+ rastInfo.depthBiasEnable = true;
+ rastInfo.depthBiasConstantFactor = float(m_depthBias);
+ rastInfo.depthBiasSlopeFactor = m_slopeScaledDepthBias;
+ }
+ rastInfo.lineWidth = rhiD->caps.wideLines ? m_lineWidth : 1.0f;
+ rastInfo.polygonMode = toVkPolygonMode(m_polygonMode);
pipelineInfo.pRasterizationState = &rastInfo;
- VkPipelineMultisampleStateCreateInfo msInfo;
- memset(&msInfo, 0, sizeof(msInfo));
+ VkPipelineMultisampleStateCreateInfo msInfo = {};
msInfo.sType = VK_STRUCTURE_TYPE_PIPELINE_MULTISAMPLE_STATE_CREATE_INFO;
- msInfo.rasterizationSamples = rhiD->effectiveSampleCount(m_sampleCount);
+ msInfo.rasterizationSamples = rhiD->effectiveSampleCountBits(m_sampleCount);
pipelineInfo.pMultisampleState = &msInfo;
- VkPipelineDepthStencilStateCreateInfo dsInfo;
- memset(&dsInfo, 0, sizeof(dsInfo));
+ VkPipelineDepthStencilStateCreateInfo dsInfo = {};
dsInfo.sType = VK_STRUCTURE_TYPE_PIPELINE_DEPTH_STENCIL_STATE_CREATE_INFO;
dsInfo.depthTestEnable = m_depthTest;
dsInfo.depthWriteEnable = m_depthWrite;
@@ -6135,13 +7702,11 @@ bool QVkGraphicsPipeline::build()
}
pipelineInfo.pDepthStencilState = &dsInfo;
- VkPipelineColorBlendStateCreateInfo blendInfo;
- memset(&blendInfo, 0, sizeof(blendInfo));
+ VkPipelineColorBlendStateCreateInfo blendInfo = {};
blendInfo.sType = VK_STRUCTURE_TYPE_PIPELINE_COLOR_BLEND_STATE_CREATE_INFO;
QVarLengthArray<VkPipelineColorBlendAttachmentState, 4> vktargetBlends;
- for (const QRhiGraphicsPipeline::TargetBlend &b : qAsConst(m_targetBlends)) {
- VkPipelineColorBlendAttachmentState blend;
- memset(&blend, 0, sizeof(blend));
+ for (const QRhiGraphicsPipeline::TargetBlend &b : std::as_const(m_targetBlends)) {
+ VkPipelineColorBlendAttachmentState blend = {};
blend.blendEnable = b.enable;
blend.srcColorBlendFactor = toVkBlendFactor(b.srcColor);
blend.dstColorBlendFactor = toVkBlendFactor(b.dstColor);
@@ -6153,13 +7718,12 @@ bool QVkGraphicsPipeline::build()
vktargetBlends.append(blend);
}
if (vktargetBlends.isEmpty()) {
- VkPipelineColorBlendAttachmentState blend;
- memset(&blend, 0, sizeof(blend));
+ VkPipelineColorBlendAttachmentState blend = {};
blend.colorWriteMask = VK_COLOR_COMPONENT_R_BIT | VK_COLOR_COMPONENT_G_BIT
| VK_COLOR_COMPONENT_B_BIT | VK_COLOR_COMPONENT_A_BIT;
vktargetBlends.append(blend);
}
- blendInfo.attachmentCount = uint32_t(vktargetBlends.count());
+ blendInfo.attachmentCount = uint32_t(vktargetBlends.size());
blendInfo.pAttachments = vktargetBlends.constData();
pipelineInfo.pColorBlendState = &blendInfo;
@@ -6178,6 +7742,7 @@ bool QVkGraphicsPipeline::build()
return false;
}
+ rhiD->pipelineCreationEnd();
lastActiveFrameSlot = -1;
generation += 1;
rhiD->registerResource(this);
@@ -6191,10 +7756,10 @@ QVkComputePipeline::QVkComputePipeline(QRhiImplementation *rhi)
QVkComputePipeline::~QVkComputePipeline()
{
- release();
+ destroy();
}
-void QVkComputePipeline::release()
+void QVkComputePipeline::destroy()
{
if (!pipeline && !layout)
return;
@@ -6210,22 +7775,23 @@ void QVkComputePipeline::release()
layout = VK_NULL_HANDLE;
QRHI_RES_RHI(QRhiVulkan);
- rhiD->releaseQueue.append(e);
-
- rhiD->unregisterResource(this);
+ if (rhiD) {
+ rhiD->releaseQueue.append(e);
+ rhiD->unregisterResource(this);
+ }
}
-bool QVkComputePipeline::build()
+bool QVkComputePipeline::create()
{
if (pipeline)
- release();
+ destroy();
QRHI_RES_RHI(QRhiVulkan);
+ rhiD->pipelineCreationStart();
if (!rhiD->ensurePipelineCache())
return false;
- VkPipelineLayoutCreateInfo pipelineLayoutInfo;
- memset(&pipelineLayoutInfo, 0, sizeof(pipelineLayoutInfo));
+ VkPipelineLayoutCreateInfo pipelineLayoutInfo = {};
pipelineLayoutInfo.sType = VK_STRUCTURE_TYPE_PIPELINE_LAYOUT_CREATE_INFO;
pipelineLayoutInfo.setLayoutCount = 1;
QVkShaderResourceBindings *srbD = QRHI_RES(QVkShaderResourceBindings, m_shaderResourceBindings);
@@ -6237,8 +7803,7 @@ bool QVkComputePipeline::build()
return false;
}
- VkComputePipelineCreateInfo pipelineInfo;
- memset(&pipelineInfo, 0, sizeof(pipelineInfo));
+ VkComputePipelineCreateInfo pipelineInfo = {};
pipelineInfo.sType = VK_STRUCTURE_TYPE_COMPUTE_PIPELINE_CREATE_INFO;
pipelineInfo.layout = layout;
@@ -6257,8 +7822,7 @@ bool QVkComputePipeline::build()
return false;
}
VkShaderModule shader = rhiD->createShader(spirv.shader());
- VkPipelineShaderStageCreateInfo shaderInfo;
- memset(&shaderInfo, 0, sizeof(shaderInfo));
+ VkPipelineShaderStageCreateInfo shaderInfo = {};
shaderInfo.sType = VK_STRUCTURE_TYPE_PIPELINE_SHADER_STAGE_CREATE_INFO;
shaderInfo.stage = VK_SHADER_STAGE_COMPUTE_BIT;
shaderInfo.module = shader;
@@ -6272,6 +7836,7 @@ bool QVkComputePipeline::build()
return false;
}
+ rhiD->pipelineCreationEnd();
lastActiveFrameSlot = -1;
generation += 1;
rhiD->registerResource(this);
@@ -6286,10 +7851,10 @@ QVkCommandBuffer::QVkCommandBuffer(QRhiImplementation *rhi)
QVkCommandBuffer::~QVkCommandBuffer()
{
- release();
+ destroy();
}
-void QVkCommandBuffer::release()
+void QVkCommandBuffer::destroy()
{
// nothing to do here, cb is not owned by us
}
@@ -6302,40 +7867,52 @@ const QRhiNativeHandles *QVkCommandBuffer::nativeHandles()
// secondary command buffer (typically the one started by beginExternal(),
// in case we are between beginExternal - endExternal inside a pass).
- if (useSecondaryCb && !secondaryCbs.isEmpty())
- nativeHandlesStruct.commandBuffer = secondaryCbs.last();
- else
+ if (recordingPass == QVkCommandBuffer::NoPass) {
nativeHandlesStruct.commandBuffer = cb;
+ } else {
+ if (passUsesSecondaryCb && !activeSecondaryCbStack.isEmpty())
+ nativeHandlesStruct.commandBuffer = activeSecondaryCbStack.last();
+ else
+ nativeHandlesStruct.commandBuffer = cb;
+ }
return &nativeHandlesStruct;
}
QVkSwapChain::QVkSwapChain(QRhiImplementation *rhi)
: QRhiSwapChain(rhi),
- rtWrapper(rhi),
+ rtWrapper(rhi, this),
+ rtWrapperRight(rhi, this),
cbWrapper(rhi)
{
}
QVkSwapChain::~QVkSwapChain()
{
- release();
+ destroy();
}
-void QVkSwapChain::release()
+void QVkSwapChain::destroy()
{
if (sc == VK_NULL_HANDLE)
return;
QRHI_RES_RHI(QRhiVulkan);
- rhiD->swapchains.remove(this);
- rhiD->releaseSwapChainResources(this);
- surface = lastConnectedSurface = VK_NULL_HANDLE;
+ if (rhiD) {
+ rhiD->swapchains.remove(this);
+ rhiD->releaseSwapChainResources(this);
+ }
+
+ for (int i = 0; i < QVK_FRAMES_IN_FLIGHT; ++i) {
+ QVkSwapChain::FrameResources &frame(frameRes[i]);
+ frame.cmdBuf = VK_NULL_HANDLE;
+ frame.timestampQueryIndex = -1;
+ }
- QRHI_PROF;
- QRHI_PROF_F(releaseSwapChain(this));
+ surface = lastConnectedSurface = VK_NULL_HANDLE;
- rhiD->unregisterResource(this);
+ if (rhiD)
+ rhiD->unregisterResource(this);
}
QRhiCommandBuffer *QVkSwapChain::currentFrameCommandBuffer()
@@ -6348,6 +7925,11 @@ QRhiRenderTarget *QVkSwapChain::currentFrameRenderTarget()
return &rtWrapper;
}
+QRhiRenderTarget *QVkSwapChain::currentFrameRenderTarget(StereoTargetBuffer targetBuffer)
+{
+ return !stereo || targetBuffer == StereoTargetBuffer::LeftBuffer ? &rtWrapper : &rtWrapperRight;
+}
+
QSize QVkSwapChain::surfacePixelSize()
{
if (!ensureSurface())
@@ -6355,8 +7937,7 @@ QSize QVkSwapChain::surfacePixelSize()
// The size from the QWindow may not exactly match the surface... so if a
// size is reported from the surface, use that.
- VkSurfaceCapabilitiesKHR surfaceCaps;
- memset(&surfaceCaps, 0, sizeof(surfaceCaps));
+ VkSurfaceCapabilitiesKHR surfaceCaps = {};
QRHI_RES_RHI(QRhiVulkan);
rhiD->vkGetPhysicalDeviceSurfaceCapabilitiesKHR(rhiD->physDev, surface, &surfaceCaps);
VkExtent2D bufferSize = surfaceCaps.currentExtent;
@@ -6367,9 +7948,55 @@ QSize QVkSwapChain::surfacePixelSize()
return QSize(int(bufferSize.width), int(bufferSize.height));
}
+static inline bool hdrFormatMatchesVkSurfaceFormat(QRhiSwapChain::Format f, const VkSurfaceFormatKHR &s)
+{
+ switch (f) {
+ case QRhiSwapChain::HDRExtendedSrgbLinear:
+ return s.format == VK_FORMAT_R16G16B16A16_SFLOAT
+ && s.colorSpace == VK_COLOR_SPACE_EXTENDED_SRGB_LINEAR_EXT;
+ case QRhiSwapChain::HDR10:
+ return (s.format == VK_FORMAT_A2B10G10R10_UNORM_PACK32 || s.format == VK_FORMAT_A2R10G10B10_UNORM_PACK32)
+ && s.colorSpace == VK_COLOR_SPACE_HDR10_ST2084_EXT;
+ case QRhiSwapChain::HDRExtendedDisplayP3Linear:
+ return s.format == VK_FORMAT_R16G16B16A16_SFLOAT
+ && s.colorSpace == VK_COLOR_SPACE_DISPLAY_P3_LINEAR_EXT;
+ default:
+ break;
+ }
+ return false;
+}
+
+bool QVkSwapChain::isFormatSupported(Format f)
+{
+ if (f == SDR)
+ return true;
+
+ if (!m_window) {
+ qWarning("Attempted to call isFormatSupported() without a window set");
+ return false;
+ }
+
+ // we may be called before create so query the surface
+ VkSurfaceKHR surf = QVulkanInstance::surfaceForWindow(m_window);
+
+ QRHI_RES_RHI(QRhiVulkan);
+ uint32_t formatCount = 0;
+ rhiD->vkGetPhysicalDeviceSurfaceFormatsKHR(rhiD->physDev, surf, &formatCount, nullptr);
+ QVarLengthArray<VkSurfaceFormatKHR, 8> formats(formatCount);
+ if (formatCount) {
+ rhiD->vkGetPhysicalDeviceSurfaceFormatsKHR(rhiD->physDev, surf, &formatCount, formats.data());
+ for (uint32_t i = 0; i < formatCount; ++i) {
+ if (hdrFormatMatchesVkSurfaceFormat(f, formats[i]))
+ return true;
+ }
+ }
+
+ return false;
+}
+
QRhiRenderPassDescriptor *QVkSwapChain::newCompatibleRenderPassDescriptor()
{
- // not yet built so cannot rely on data computed in buildOrResize()
+ // not yet built so cannot rely on data computed in createOrResize()
if (!ensureSurface()) // make sure sampleCount and colorFormat reflect what was requested
return nullptr;
@@ -6386,6 +8013,7 @@ QRhiRenderPassDescriptor *QVkSwapChain::newCompatibleRenderPassDescriptor()
}
rp->ownsRp = true;
+ rp->updateSerializedFormat();
rhiD->registerResource(rp);
return rp;
}
@@ -6394,17 +8022,11 @@ static inline bool isSrgbFormat(VkFormat format)
{
switch (format) {
case VK_FORMAT_R8_SRGB:
- Q_FALLTHROUGH();
case VK_FORMAT_R8G8_SRGB:
- Q_FALLTHROUGH();
case VK_FORMAT_R8G8B8_SRGB:
- Q_FALLTHROUGH();
case VK_FORMAT_B8G8R8_SRGB:
- Q_FALLTHROUGH();
case VK_FORMAT_R8G8B8A8_SRGB:
- Q_FALLTHROUGH();
case VK_FORMAT_B8G8R8A8_SRGB:
- Q_FALLTHROUGH();
case VK_FORMAT_A8B8G8R8_SRGB_PACK32:
return true;
default:
@@ -6431,67 +8053,56 @@ bool QVkSwapChain::ensureSurface()
surface = surf;
QRHI_RES_RHI(QRhiVulkan);
- if (rhiD->gfxQueueFamilyIdx != -1) {
- if (!rhiD->inst->supportsPresent(rhiD->physDev, uint32_t(rhiD->gfxQueueFamilyIdx), m_window)) {
- qWarning("Presenting not supported on this window");
- return false;
- }
- }
-
- if (!rhiD->vkGetPhysicalDeviceSurfaceCapabilitiesKHR) {
- rhiD->vkGetPhysicalDeviceSurfaceCapabilitiesKHR = reinterpret_cast<PFN_vkGetPhysicalDeviceSurfaceCapabilitiesKHR>(
- rhiD->inst->getInstanceProcAddr("vkGetPhysicalDeviceSurfaceCapabilitiesKHR"));
- rhiD->vkGetPhysicalDeviceSurfaceFormatsKHR = reinterpret_cast<PFN_vkGetPhysicalDeviceSurfaceFormatsKHR>(
- rhiD->inst->getInstanceProcAddr("vkGetPhysicalDeviceSurfaceFormatsKHR"));
- rhiD->vkGetPhysicalDeviceSurfacePresentModesKHR = reinterpret_cast<PFN_vkGetPhysicalDeviceSurfacePresentModesKHR>(
- rhiD->inst->getInstanceProcAddr("vkGetPhysicalDeviceSurfacePresentModesKHR"));
- if (!rhiD->vkGetPhysicalDeviceSurfaceCapabilitiesKHR
- || !rhiD->vkGetPhysicalDeviceSurfaceFormatsKHR
- || !rhiD->vkGetPhysicalDeviceSurfacePresentModesKHR)
- {
- qWarning("Physical device surface queries not available");
- return false;
- }
+ if (!rhiD->inst->supportsPresent(rhiD->physDev, rhiD->gfxQueueFamilyIdx, m_window)) {
+ qWarning("Presenting not supported on this window");
+ return false;
}
quint32 formatCount = 0;
rhiD->vkGetPhysicalDeviceSurfaceFormatsKHR(rhiD->physDev, surface, &formatCount, nullptr);
- QVector<VkSurfaceFormatKHR> formats(formatCount);
+ QList<VkSurfaceFormatKHR> formats(formatCount);
if (formatCount)
rhiD->vkGetPhysicalDeviceSurfaceFormatsKHR(rhiD->physDev, surface, &formatCount, formats.data());
+ // See if there is a better match than the default BGRA8 format. (but if
+ // not, we will stick to the default)
const bool srgbRequested = m_flags.testFlag(sRGB);
for (int i = 0; i < int(formatCount); ++i) {
- if (formats[i].format != VK_FORMAT_UNDEFINED && srgbRequested == isSrgbFormat(formats[i].format)) {
- colorFormat = formats[i].format;
- colorSpace = formats[i].colorSpace;
- break;
+ if (formats[i].format != VK_FORMAT_UNDEFINED) {
+ bool ok = srgbRequested == isSrgbFormat(formats[i].format);
+ if (m_format != SDR)
+ ok &= hdrFormatMatchesVkSurfaceFormat(m_format, formats[i]);
+ if (ok) {
+ colorFormat = formats[i].format;
+ colorSpace = formats[i].colorSpace;
+ break;
+ }
}
}
- samples = rhiD->effectiveSampleCount(m_sampleCount);
+ samples = rhiD->effectiveSampleCountBits(m_sampleCount);
quint32 presModeCount = 0;
rhiD->vkGetPhysicalDeviceSurfacePresentModesKHR(rhiD->physDev, surface, &presModeCount, nullptr);
- QVector<VkPresentModeKHR> presModes(presModeCount);
- rhiD->vkGetPhysicalDeviceSurfacePresentModesKHR(rhiD->physDev, surface, &presModeCount, presModes.data());
- supportedPresentationModes = presModes;
+ supportedPresentationModes.resize(presModeCount);
+ rhiD->vkGetPhysicalDeviceSurfacePresentModesKHR(rhiD->physDev, surface, &presModeCount,
+ supportedPresentationModes.data());
return true;
}
-bool QVkSwapChain::buildOrResize()
+bool QVkSwapChain::createOrResize()
{
QRHI_RES_RHI(QRhiVulkan);
const bool needsRegistration = !window || window != m_window;
// Can be called multiple times due to window resizes - that is not the
- // same as a simple release+build (as with other resources). Thus no
- // release() here. See recreateSwapChain().
+ // same as a simple destroy+create (as with other resources). Thus no
+ // destroy() here. See recreateSwapChain().
// except if the window actually changes
if (window && window != m_window)
- release();
+ destroy();
window = m_window;
m_currentPixelSize = surfacePixelSize();
@@ -6512,7 +8123,7 @@ bool QVkSwapChain::buildOrResize()
if (m_depthStencil && m_depthStencil->pixelSize() != pixelSize) {
if (m_depthStencil->flags().testFlag(QRhiRenderBuffer::UsedWithSwapChainOnly)) {
m_depthStencil->setPixelSize(pixelSize);
- if (!m_depthStencil->build())
+ if (!m_depthStencil->create())
qWarning("Failed to rebuild swapchain's associated depth-stencil buffer for size %dx%d",
pixelSize.width(), pixelSize.height());
} else {
@@ -6525,6 +8136,7 @@ bool QVkSwapChain::buildOrResize()
if (!m_renderPassDesc)
qWarning("QVkSwapChain: No renderpass descriptor set. See newCompatibleRenderPassDescriptor() and setRenderPassDescriptor().");
+ rtWrapper.setRenderPassDescriptor(m_renderPassDesc); // for the public getter in QRhiRenderTarget
rtWrapper.d.rp = QRHI_RES(QVkRenderPassDescriptor, m_renderPassDesc);
Q_ASSERT(rtWrapper.d.rp && rtWrapper.d.rp->rp);
@@ -6539,6 +8151,7 @@ bool QVkSwapChain::buildOrResize()
rtWrapper.d.dsAttCount = 0;
ds = nullptr;
}
+ rtWrapper.d.dsResolveAttCount = 0;
if (samples > VK_SAMPLE_COUNT_1_BIT)
rtWrapper.d.resolveAttCount = 1;
else
@@ -6552,11 +8165,10 @@ bool QVkSwapChain::buildOrResize()
samples > VK_SAMPLE_COUNT_1_BIT ? image.imageView : VK_NULL_HANDLE
};
- VkFramebufferCreateInfo fbInfo;
- memset(&fbInfo, 0, sizeof(fbInfo));
+ VkFramebufferCreateInfo fbInfo = {};
fbInfo.sType = VK_STRUCTURE_TYPE_FRAMEBUFFER_CREATE_INFO;
fbInfo.renderPass = rtWrapper.d.rp->rp;
- fbInfo.attachmentCount = uint32_t(rtWrapper.d.colorAttCount + rtWrapper.d.dsAttCount + rtWrapper.d.resolveAttCount);
+ fbInfo.attachmentCount = uint32_t(rtWrapper.d.colorAttCount + rtWrapper.d.dsAttCount + rtWrapper.d.resolveAttCount + rtWrapper.d.dsResolveAttCount);
fbInfo.pAttachments = views;
fbInfo.width = uint32_t(pixelSize.width());
fbInfo.height = uint32_t(pixelSize.height());
@@ -6569,10 +8181,57 @@ bool QVkSwapChain::buildOrResize()
}
}
- frameCount = 0;
+ if (stereo) {
+ rtWrapperRight.setRenderPassDescriptor(
+ m_renderPassDesc); // for the public getter in QRhiRenderTarget
+ rtWrapperRight.d.rp = QRHI_RES(QVkRenderPassDescriptor, m_renderPassDesc);
+ Q_ASSERT(rtWrapperRight.d.rp && rtWrapperRight.d.rp->rp);
+
+ rtWrapperRight.d.pixelSize = pixelSize;
+ rtWrapperRight.d.dpr = float(window->devicePixelRatio());
+ rtWrapperRight.d.sampleCount = samples;
+ rtWrapperRight.d.colorAttCount = 1;
+ if (m_depthStencil) {
+ rtWrapperRight.d.dsAttCount = 1;
+ ds = QRHI_RES(QVkRenderBuffer, m_depthStencil);
+ } else {
+ rtWrapperRight.d.dsAttCount = 0;
+ ds = nullptr;
+ }
+ rtWrapperRight.d.dsResolveAttCount = 0;
+ if (samples > VK_SAMPLE_COUNT_1_BIT)
+ rtWrapperRight.d.resolveAttCount = 1;
+ else
+ rtWrapperRight.d.resolveAttCount = 0;
+
+ for (int i = 0; i < bufferCount; ++i) {
+ QVkSwapChain::ImageResources &image(imageRes[i + bufferCount]);
+ VkImageView views[3] = {
+ // color, ds, resolve
+ samples > VK_SAMPLE_COUNT_1_BIT ? image.msaaImageView : image.imageView,
+ ds ? ds->imageView : VK_NULL_HANDLE,
+ samples > VK_SAMPLE_COUNT_1_BIT ? image.imageView : VK_NULL_HANDLE
+ };
+
+ VkFramebufferCreateInfo fbInfo = {};
+ fbInfo.sType = VK_STRUCTURE_TYPE_FRAMEBUFFER_CREATE_INFO;
+ fbInfo.renderPass = rtWrapperRight.d.rp->rp;
+ fbInfo.attachmentCount = uint32_t(rtWrapperRight.d.colorAttCount + rtWrapperRight.d.dsAttCount
+ + rtWrapperRight.d.resolveAttCount + rtWrapperRight.d.dsResolveAttCount);
+ fbInfo.pAttachments = views;
+ fbInfo.width = uint32_t(pixelSize.width());
+ fbInfo.height = uint32_t(pixelSize.height());
+ fbInfo.layers = 1;
+
+ VkResult err = rhiD->df->vkCreateFramebuffer(rhiD->dev, &fbInfo, nullptr, &image.fb);
+ if (err != VK_SUCCESS) {
+ qWarning("Failed to create framebuffer: %d", err);
+ return false;
+ }
+ }
+ }
- QRHI_PROF;
- QRHI_PROF_F(resizeSwapChain(this, QVK_FRAMES_IN_FLIGHT, samples > VK_SAMPLE_COUNT_1_BIT ? QVK_FRAMES_IN_FLIGHT : 0, samples));
+ frameCount = 0;
if (needsRegistration)
rhiD->registerResource(this);
diff --git a/src/gui/rhi/qrhivulkan_p.h b/src/gui/rhi/qrhivulkan_p.h
index ff19c7a54e..f23d8550f0 100644
--- a/src/gui/rhi/qrhivulkan_p.h
+++ b/src/gui/rhi/qrhivulkan_p.h
@@ -1,41 +1,8 @@
-/****************************************************************************
-**
-** Copyright (C) 2019 The Qt Company Ltd.
-** Contact: http://www.qt.io/licensing/
-**
-** This file is part of the Qt Gui module
-**
-** $QT_BEGIN_LICENSE:LGPL3$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef QRHIVULKAN_H
-#define QRHIVULKAN_H
+// Copyright (C) 2023 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
+
+#ifndef QRHIVULKAN_P_H
+#define QRHIVULKAN_P_H
//
// W A R N I N G
@@ -48,43 +15,1025 @@
// We mean it.
//
-#include <private/qrhi_p.h>
-#include <QtGui/qvulkaninstance.h> // this is where vulkan.h gets pulled in
+#include "qrhi_p.h"
QT_BEGIN_NAMESPACE
-struct Q_GUI_EXPORT QRhiVulkanInitParams : public QRhiInitParams
+class QVulkanFunctions;
+class QVulkanDeviceFunctions;
+
+static const int QVK_FRAMES_IN_FLIGHT = 2;
+
+static const int QVK_DESC_SETS_PER_POOL = 128;
+static const int QVK_UNIFORM_BUFFERS_PER_POOL = 256;
+static const int QVK_COMBINED_IMAGE_SAMPLERS_PER_POOL = 256;
+static const int QVK_STORAGE_BUFFERS_PER_POOL = 128;
+static const int QVK_STORAGE_IMAGES_PER_POOL = 128;
+
+static const int QVK_MAX_ACTIVE_TIMESTAMP_PAIRS = 16;
+
+// no vk_mem_alloc.h available here, void* is good enough
+typedef void * QVkAlloc;
+typedef void * QVkAllocator;
+
+struct QVkBuffer : public QRhiBuffer
{
- QVulkanInstance *inst = nullptr;
- QWindow *window = nullptr;
+ QVkBuffer(QRhiImplementation *rhi, Type type, UsageFlags usage, quint32 size);
+ ~QVkBuffer();
+ void destroy() override;
+ bool create() override;
+ QRhiBuffer::NativeBuffer nativeBuffer() override;
+ char *beginFullDynamicBufferUpdateForCurrentFrame() override;
+ void endFullDynamicBufferUpdateForCurrentFrame() override;
+
+ VkBuffer buffers[QVK_FRAMES_IN_FLIGHT];
+ QVkAlloc allocations[QVK_FRAMES_IN_FLIGHT];
+ struct DynamicUpdate {
+ quint32 offset;
+ QRhiBufferData data;
+ };
+ QVarLengthArray<DynamicUpdate, 16> pendingDynamicUpdates[QVK_FRAMES_IN_FLIGHT];
+ VkBuffer stagingBuffers[QVK_FRAMES_IN_FLIGHT];
+ QVkAlloc stagingAllocations[QVK_FRAMES_IN_FLIGHT];
+ struct UsageState {
+ VkAccessFlags access = 0;
+ VkPipelineStageFlags stage = 0;
+ };
+ UsageState usageState[QVK_FRAMES_IN_FLIGHT];
+ int lastActiveFrameSlot = -1;
+ uint generation = 0;
+ friend class QRhiVulkan;
};
-struct Q_GUI_EXPORT QRhiVulkanNativeHandles : public QRhiNativeHandles
+Q_DECLARE_TYPEINFO(QVkBuffer::DynamicUpdate, Q_RELOCATABLE_TYPE);
+
+struct QVkTexture;
+
+struct QVkRenderBuffer : public QRhiRenderBuffer
{
- VkPhysicalDevice physDev = VK_NULL_HANDLE;
- VkDevice dev = VK_NULL_HANDLE;
- int gfxQueueFamilyIdx = -1;
- VkQueue gfxQueue = VK_NULL_HANDLE;
- VkCommandPool cmdPool = VK_NULL_HANDLE;
- void *vmemAllocator = nullptr;
+ QVkRenderBuffer(QRhiImplementation *rhi, Type type, const QSize &pixelSize,
+ int sampleCount, Flags flags,
+ QRhiTexture::Format backingFormatHint);
+ ~QVkRenderBuffer();
+ void destroy() override;
+ bool create() override;
+ QRhiTexture::Format backingFormat() const override;
+
+ VkDeviceMemory memory = VK_NULL_HANDLE;
+ VkImage image = VK_NULL_HANDLE;
+ VkImageView imageView = VK_NULL_HANDLE;
+ VkSampleCountFlagBits samples;
+ QVkTexture *backingTexture = nullptr;
+ VkFormat vkformat;
+ int lastActiveFrameSlot = -1;
+ uint generation = 0;
+ friend class QRhiVulkan;
};
-struct Q_GUI_EXPORT QRhiVulkanTextureNativeHandles : public QRhiNativeHandles
+struct QVkTexture : public QRhiTexture
{
+ QVkTexture(QRhiImplementation *rhi, Format format, const QSize &pixelSize, int depth,
+ int arraySize, int sampleCount, Flags flags);
+ ~QVkTexture();
+ void destroy() override;
+ bool create() override;
+ bool createFrom(NativeTexture src) override;
+ NativeTexture nativeTexture() override;
+ void setNativeLayout(int layout) override;
+
+ bool prepareCreate(QSize *adjustedSize = nullptr);
+ bool finishCreate();
+ VkImageView perLevelImageViewForLoadStore(int level);
+
VkImage image = VK_NULL_HANDLE;
- VkImageLayout layout = VK_IMAGE_LAYOUT_GENERAL;
+ VkImageView imageView = VK_NULL_HANDLE;
+ QVkAlloc imageAlloc = nullptr;
+ VkBuffer stagingBuffers[QVK_FRAMES_IN_FLIGHT];
+ QVkAlloc stagingAllocations[QVK_FRAMES_IN_FLIGHT];
+ VkImageView perLevelImageViews[QRhi::MAX_MIP_LEVELS];
+ bool owns = true;
+ struct UsageState {
+ // no tracking of subresource layouts (some operations can keep
+ // subresources in different layouts for some time, but that does not
+ // need to be kept track of)
+ VkImageLayout layout;
+ VkAccessFlags access;
+ VkPipelineStageFlags stage;
+ };
+ UsageState usageState;
+ VkFormat vkformat;
+ uint mipLevelCount = 0;
+ VkSampleCountFlagBits samples;
+ VkFormat viewFormat;
+ VkFormat viewFormatForSampling;
+ int lastActiveFrameSlot = -1;
+ uint generation = 0;
+ friend class QRhiVulkan;
+};
+
+struct QVkSampler : public QRhiSampler
+{
+ QVkSampler(QRhiImplementation *rhi, Filter magFilter, Filter minFilter, Filter mipmapMode,
+ AddressMode u, AddressMode v, AddressMode w);
+ ~QVkSampler();
+ void destroy() override;
+ bool create() override;
+
+ VkSampler sampler = VK_NULL_HANDLE;
+ int lastActiveFrameSlot = -1;
+ uint generation = 0;
+ friend class QRhiVulkan;
+};
+
+struct QVkRenderPassDescriptor : public QRhiRenderPassDescriptor
+{
+ QVkRenderPassDescriptor(QRhiImplementation *rhi);
+ ~QVkRenderPassDescriptor();
+ void destroy() override;
+ bool isCompatible(const QRhiRenderPassDescriptor *other) const override;
+ QRhiRenderPassDescriptor *newCompatibleRenderPassDescriptor() const override;
+ QVector<quint32> serializedFormat() const override;
+ const QRhiNativeHandles *nativeHandles() override;
+
+ void updateSerializedFormat();
+
+ VkRenderPass rp = VK_NULL_HANDLE;
+ bool ownsRp = false;
+ QVarLengthArray<VkAttachmentDescription, 8> attDescs;
+ QVarLengthArray<VkAttachmentReference, 8> colorRefs;
+ QVarLengthArray<VkAttachmentReference, 8> resolveRefs;
+ QVarLengthArray<VkSubpassDependency, 2> subpassDeps;
+ bool hasDepthStencil = false;
+ bool hasDepthStencilResolve = false;
+ uint32_t multiViewCount = 0;
+ VkAttachmentReference dsRef;
+ VkAttachmentReference dsResolveRef;
+ QVector<quint32> serializedFormatData;
+ QRhiVulkanRenderPassNativeHandles nativeHandlesStruct;
+ int lastActiveFrameSlot = -1;
+};
+
+struct QVkRenderTargetData
+{
+ VkFramebuffer fb = VK_NULL_HANDLE;
+ QVkRenderPassDescriptor *rp = nullptr;
+ QSize pixelSize;
+ float dpr = 1;
+ int sampleCount = 1;
+ int colorAttCount = 0;
+ int dsAttCount = 0;
+ int resolveAttCount = 0;
+ int dsResolveAttCount = 0;
+ int multiViewCount = 0;
+ QRhiRenderTargetAttachmentTracker::ResIdList currentResIdList;
+ static const int MAX_COLOR_ATTACHMENTS = 8;
+};
+
+struct QVkSwapChainRenderTarget : public QRhiSwapChainRenderTarget
+{
+ QVkSwapChainRenderTarget(QRhiImplementation *rhi, QRhiSwapChain *swapchain);
+ ~QVkSwapChainRenderTarget();
+ void destroy() override;
+
+ QSize pixelSize() const override;
+ float devicePixelRatio() const override;
+ int sampleCount() const override;
+
+ QVkRenderTargetData d;
};
-struct Q_GUI_EXPORT QRhiVulkanCommandBufferNativeHandles : public QRhiNativeHandles
+struct QVkTextureRenderTarget : public QRhiTextureRenderTarget
{
- VkCommandBuffer commandBuffer = VK_NULL_HANDLE;
+ QVkTextureRenderTarget(QRhiImplementation *rhi, const QRhiTextureRenderTargetDescription &desc, Flags flags);
+ ~QVkTextureRenderTarget();
+ void destroy() override;
+
+ QSize pixelSize() const override;
+ float devicePixelRatio() const override;
+ int sampleCount() const override;
+
+ QRhiRenderPassDescriptor *newCompatibleRenderPassDescriptor() override;
+ bool create() override;
+
+ QVkRenderTargetData d;
+ VkImageView rtv[QVkRenderTargetData::MAX_COLOR_ATTACHMENTS];
+ VkImageView dsv = VK_NULL_HANDLE;
+ VkImageView resrtv[QVkRenderTargetData::MAX_COLOR_ATTACHMENTS];
+ VkImageView resdsv = VK_NULL_HANDLE;
+ int lastActiveFrameSlot = -1;
+ friend class QRhiVulkan;
};
-struct Q_GUI_EXPORT QRhiVulkanRenderPassNativeHandles : public QRhiNativeHandles
+struct QVkShaderResourceBindings : public QRhiShaderResourceBindings
{
- VkRenderPass renderPass = VK_NULL_HANDLE;
+ QVkShaderResourceBindings(QRhiImplementation *rhi);
+ ~QVkShaderResourceBindings();
+ void destroy() override;
+ bool create() override;
+ void updateResources(UpdateFlags flags) override;
+
+ QVarLengthArray<QRhiShaderResourceBinding, 8> sortedBindings;
+ bool hasSlottedResource = false;
+ bool hasDynamicOffset = false;
+ int poolIndex = -1;
+ VkDescriptorSetLayout layout = VK_NULL_HANDLE;
+ VkDescriptorSet descSets[QVK_FRAMES_IN_FLIGHT]; // multiple sets to support dynamic buffers
+ int lastActiveFrameSlot = -1;
+ uint generation = 0;
+
+ // Keep track of the generation number of each referenced QRhi* to be able
+ // to detect that the underlying descriptor set became out of date and they
+ // need to be written again with the up-to-date VkBuffer etc. objects.
+ struct BoundUniformBufferData {
+ quint64 id;
+ uint generation;
+ };
+ struct BoundSampledTextureData {
+ int count;
+ struct {
+ quint64 texId;
+ uint texGeneration;
+ quint64 samplerId;
+ uint samplerGeneration;
+ } d[QRhiShaderResourceBinding::Data::MAX_TEX_SAMPLER_ARRAY_SIZE];
+ };
+ struct BoundStorageImageData {
+ quint64 id;
+ uint generation;
+ };
+ struct BoundStorageBufferData {
+ quint64 id;
+ uint generation;
+ };
+ struct BoundResourceData {
+ union {
+ BoundUniformBufferData ubuf;
+ BoundSampledTextureData stex;
+ BoundStorageImageData simage;
+ BoundStorageBufferData sbuf;
+ };
+ };
+ QVarLengthArray<BoundResourceData, 8> boundResourceData[QVK_FRAMES_IN_FLIGHT];
+
+ friend class QRhiVulkan;
+};
+
+Q_DECLARE_TYPEINFO(QVkShaderResourceBindings::BoundResourceData, Q_RELOCATABLE_TYPE);
+
+struct QVkGraphicsPipeline : public QRhiGraphicsPipeline
+{
+ QVkGraphicsPipeline(QRhiImplementation *rhi);
+ ~QVkGraphicsPipeline();
+ void destroy() override;
+ bool create() override;
+
+ VkPipelineLayout layout = VK_NULL_HANDLE;
+ VkPipeline pipeline = VK_NULL_HANDLE;
+ int lastActiveFrameSlot = -1;
+ uint generation = 0;
+ friend class QRhiVulkan;
+};
+
+struct QVkComputePipeline : public QRhiComputePipeline
+{
+ QVkComputePipeline(QRhiImplementation *rhi);
+ ~QVkComputePipeline();
+ void destroy() override;
+ bool create() override;
+
+ VkPipelineLayout layout = VK_NULL_HANDLE;
+ VkPipeline pipeline = VK_NULL_HANDLE;
+ int lastActiveFrameSlot = -1;
+ uint generation = 0;
+ friend class QRhiVulkan;
};
+struct QVkCommandBuffer : public QRhiCommandBuffer
+{
+ QVkCommandBuffer(QRhiImplementation *rhi);
+ ~QVkCommandBuffer();
+ void destroy() override;
+
+ const QRhiNativeHandles *nativeHandles();
+
+ VkCommandBuffer cb = VK_NULL_HANDLE; // primary
+ QRhiVulkanCommandBufferNativeHandles nativeHandlesStruct;
+
+ enum PassType {
+ NoPass,
+ RenderPass,
+ ComputePass
+ };
+
+ void resetState() {
+ recordingPass = NoPass;
+ passUsesSecondaryCb = false;
+ lastGpuTime = 0;
+ currentTarget = nullptr;
+ activeSecondaryCbStack.clear();
+ resetCommands();
+ resetCachedState();
+ }
+
+ void resetCachedState() {
+ currentGraphicsPipeline = nullptr;
+ currentComputePipeline = nullptr;
+ currentPipelineGeneration = 0;
+ currentGraphicsSrb = nullptr;
+ currentComputeSrb = nullptr;
+ currentSrbGeneration = 0;
+ currentDescSetSlot = -1;
+ currentIndexBuffer = VK_NULL_HANDLE;
+ currentIndexOffset = 0;
+ currentIndexFormat = VK_INDEX_TYPE_UINT16;
+ memset(currentVertexBuffers, 0, sizeof(currentVertexBuffers));
+ memset(currentVertexOffsets, 0, sizeof(currentVertexOffsets));
+ inExternal = false;
+ }
+
+ PassType recordingPass;
+ bool passUsesSecondaryCb;
+ double lastGpuTime = 0;
+ QRhiRenderTarget *currentTarget;
+ QRhiGraphicsPipeline *currentGraphicsPipeline;
+ QRhiComputePipeline *currentComputePipeline;
+ uint currentPipelineGeneration;
+ QRhiShaderResourceBindings *currentGraphicsSrb;
+ QRhiShaderResourceBindings *currentComputeSrb;
+ uint currentSrbGeneration;
+ int currentDescSetSlot;
+ VkBuffer currentIndexBuffer;
+ quint32 currentIndexOffset;
+ VkIndexType currentIndexFormat;
+ static const int VERTEX_INPUT_RESOURCE_SLOT_COUNT = 32;
+ VkBuffer currentVertexBuffers[VERTEX_INPUT_RESOURCE_SLOT_COUNT];
+ quint32 currentVertexOffsets[VERTEX_INPUT_RESOURCE_SLOT_COUNT];
+ QVarLengthArray<VkCommandBuffer, 4> activeSecondaryCbStack;
+ bool inExternal;
+
+ struct {
+ QHash<QRhiResource *, QPair<VkAccessFlags, bool> > writtenResources;
+ void reset() {
+ writtenResources.clear();
+ }
+ } computePassState;
+
+ struct Command {
+ enum Cmd {
+ CopyBuffer,
+ CopyBufferToImage,
+ CopyImage,
+ CopyImageToBuffer,
+ ImageBarrier,
+ BufferBarrier,
+ BlitImage,
+ BeginRenderPass,
+ EndRenderPass,
+ BindPipeline,
+ BindDescriptorSet,
+ BindVertexBuffer,
+ BindIndexBuffer,
+ SetViewport,
+ SetScissor,
+ SetBlendConstants,
+ SetStencilRef,
+ Draw,
+ DrawIndexed,
+ DebugMarkerBegin,
+ DebugMarkerEnd,
+ DebugMarkerInsert,
+ TransitionPassResources,
+ Dispatch,
+ ExecuteSecondary
+ };
+ Cmd cmd;
+
+ union Args {
+ struct {
+ VkBuffer src;
+ VkBuffer dst;
+ VkBufferCopy desc;
+ } copyBuffer;
+ struct {
+ VkBuffer src;
+ VkImage dst;
+ VkImageLayout dstLayout;
+ int count;
+ int bufferImageCopyIndex;
+ } copyBufferToImage;
+ struct {
+ VkImage src;
+ VkImageLayout srcLayout;
+ VkImage dst;
+ VkImageLayout dstLayout;
+ VkImageCopy desc;
+ } copyImage;
+ struct {
+ VkImage src;
+ VkImageLayout srcLayout;
+ VkBuffer dst;
+ VkBufferImageCopy desc;
+ } copyImageToBuffer;
+ struct {
+ VkPipelineStageFlags srcStageMask;
+ VkPipelineStageFlags dstStageMask;
+ int count;
+ int index;
+ } imageBarrier;
+ struct {
+ VkPipelineStageFlags srcStageMask;
+ VkPipelineStageFlags dstStageMask;
+ int count;
+ int index;
+ } bufferBarrier;
+ struct {
+ VkImage src;
+ VkImageLayout srcLayout;
+ VkImage dst;
+ VkImageLayout dstLayout;
+ VkFilter filter;
+ VkImageBlit desc;
+ } blitImage;
+ struct {
+ VkRenderPassBeginInfo desc;
+ int clearValueIndex;
+ bool useSecondaryCb;
+ } beginRenderPass;
+ struct {
+ } endRenderPass;
+ struct {
+ VkPipelineBindPoint bindPoint;
+ VkPipeline pipeline;
+ } bindPipeline;
+ struct {
+ VkPipelineBindPoint bindPoint;
+ VkPipelineLayout pipelineLayout;
+ VkDescriptorSet descSet;
+ int dynamicOffsetCount;
+ int dynamicOffsetIndex;
+ } bindDescriptorSet;
+ struct {
+ int startBinding;
+ int count;
+ int vertexBufferIndex;
+ int vertexBufferOffsetIndex;
+ } bindVertexBuffer;
+ struct {
+ VkBuffer buf;
+ VkDeviceSize ofs;
+ VkIndexType type;
+ } bindIndexBuffer;
+ struct {
+ VkViewport viewport;
+ } setViewport;
+ struct {
+ VkRect2D scissor;
+ } setScissor;
+ struct {
+ float c[4];
+ } setBlendConstants;
+ struct {
+ uint32_t ref;
+ } setStencilRef;
+ struct {
+ uint32_t vertexCount;
+ uint32_t instanceCount;
+ uint32_t firstVertex;
+ uint32_t firstInstance;
+ } draw;
+ struct {
+ uint32_t indexCount;
+ uint32_t instanceCount;
+ uint32_t firstIndex;
+ int32_t vertexOffset;
+ uint32_t firstInstance;
+ } drawIndexed;
+ struct {
+#ifdef VK_EXT_debug_utils
+ VkDebugUtilsLabelEXT label;
+ int labelNameIndex;
+#endif
+ } debugMarkerBegin;
+ struct {
+ } debugMarkerEnd;
+ struct {
+#ifdef VK_EXT_debug_utils
+ VkDebugUtilsLabelEXT label;
+ int labelNameIndex;
+#endif
+ } debugMarkerInsert;
+ struct {
+ int trackerIndex;
+ } transitionResources;
+ struct {
+ int x, y, z;
+ } dispatch;
+ struct {
+ VkCommandBuffer cb;
+ } executeSecondary;
+ } args;
+ };
+
+ QRhiBackendCommandList<Command> commands;
+ QVarLengthArray<QRhiPassResourceTracker, 8> passResTrackers;
+ int currentPassResTrackerIndex;
+
+ void resetCommands() {
+ commands.reset();
+ resetPools();
+
+ passResTrackers.clear();
+ currentPassResTrackerIndex = -1;
+ }
+
+ void resetPools() {
+ pools.clearValue.clear();
+ pools.bufferImageCopy.clear();
+ pools.dynamicOffset.clear();
+ pools.vertexBuffer.clear();
+ pools.vertexBufferOffset.clear();
+ pools.debugMarkerData.clear();
+ pools.imageBarrier.clear();
+ pools.bufferBarrier.clear();
+ }
+
+ struct {
+ QVarLengthArray<VkClearValue, 4> clearValue;
+ QVarLengthArray<VkBufferImageCopy, 16> bufferImageCopy;
+ QVarLengthArray<uint32_t, 4> dynamicOffset;
+ QVarLengthArray<VkBuffer, 4> vertexBuffer;
+ QVarLengthArray<VkDeviceSize, 4> vertexBufferOffset;
+ QVarLengthArray<QByteArray, 4> debugMarkerData;
+ QVarLengthArray<VkImageMemoryBarrier, 8> imageBarrier;
+ QVarLengthArray<VkBufferMemoryBarrier, 8> bufferBarrier;
+ } pools;
+
+ friend class QRhiVulkan;
+};
+
+struct QVkSwapChain : public QRhiSwapChain
+{
+ QVkSwapChain(QRhiImplementation *rhi);
+ ~QVkSwapChain();
+ void destroy() override;
+
+ QRhiCommandBuffer *currentFrameCommandBuffer() override;
+ QRhiRenderTarget *currentFrameRenderTarget() override;
+ QRhiRenderTarget *currentFrameRenderTarget(StereoTargetBuffer targetBuffer) override;
+
+ QSize surfacePixelSize() override;
+ bool isFormatSupported(Format f) override;
+
+ QRhiRenderPassDescriptor *newCompatibleRenderPassDescriptor() override;
+ bool createOrResize() override;
+
+ bool ensureSurface();
+
+ static const quint32 EXPECTED_MAX_BUFFER_COUNT = 4;
+
+ QWindow *window = nullptr;
+ QSize pixelSize;
+ bool supportsReadback = false;
+ bool stereo = false;
+ VkSwapchainKHR sc = VK_NULL_HANDLE;
+ int bufferCount = 0;
+ VkSurfaceKHR surface = VK_NULL_HANDLE;
+ VkSurfaceKHR lastConnectedSurface = VK_NULL_HANDLE;
+ VkFormat colorFormat = VK_FORMAT_B8G8R8A8_UNORM;
+ VkColorSpaceKHR colorSpace = VK_COLOR_SPACE_SRGB_NONLINEAR_KHR;
+ QVkRenderBuffer *ds = nullptr;
+ VkSampleCountFlagBits samples = VK_SAMPLE_COUNT_1_BIT;
+ QVarLengthArray<VkPresentModeKHR, 8> supportedPresentationModes;
+ VkDeviceMemory msaaImageMem = VK_NULL_HANDLE;
+ QVkSwapChainRenderTarget rtWrapper;
+ QVkSwapChainRenderTarget rtWrapperRight;
+ QVkCommandBuffer cbWrapper;
+
+ struct ImageResources {
+ VkImage image = VK_NULL_HANDLE;
+ VkImageView imageView = VK_NULL_HANDLE;
+ VkFramebuffer fb = VK_NULL_HANDLE;
+ VkImage msaaImage = VK_NULL_HANDLE;
+ VkImageView msaaImageView = VK_NULL_HANDLE;
+ enum LastUse {
+ ScImageUseNone,
+ ScImageUseRender,
+ ScImageUseTransferSource
+ };
+ LastUse lastUse = ScImageUseNone;
+ };
+ QVarLengthArray<ImageResources, EXPECTED_MAX_BUFFER_COUNT> imageRes;
+
+ struct FrameResources {
+ VkFence imageFence = VK_NULL_HANDLE;
+ bool imageFenceWaitable = false;
+ VkSemaphore imageSem = VK_NULL_HANDLE;
+ VkSemaphore drawSem = VK_NULL_HANDLE;
+ bool imageAcquired = false;
+ bool imageSemWaitable = false;
+ VkFence cmdFence = VK_NULL_HANDLE;
+ bool cmdFenceWaitable = false;
+ VkCommandBuffer cmdBuf = VK_NULL_HANDLE; // primary
+ int timestampQueryIndex = -1;
+ } frameRes[QVK_FRAMES_IN_FLIGHT];
+
+ quint32 currentImageIndex = 0; // index in imageRes
+ quint32 currentFrameSlot = 0; // index in frameRes
+ int frameCount = 0;
+
+ friend class QRhiVulkan;
+};
+
+class QRhiVulkan : public QRhiImplementation
+{
+public:
+ QRhiVulkan(QRhiVulkanInitParams *params, QRhiVulkanNativeHandles *importParams = nullptr);
+
+ bool create(QRhi::Flags flags) override;
+ void destroy() override;
+
+ QRhiGraphicsPipeline *createGraphicsPipeline() override;
+ QRhiComputePipeline *createComputePipeline() override;
+ QRhiShaderResourceBindings *createShaderResourceBindings() override;
+ QRhiBuffer *createBuffer(QRhiBuffer::Type type,
+ QRhiBuffer::UsageFlags usage,
+ quint32 size) override;
+ QRhiRenderBuffer *createRenderBuffer(QRhiRenderBuffer::Type type,
+ const QSize &pixelSize,
+ int sampleCount,
+ QRhiRenderBuffer::Flags flags,
+ QRhiTexture::Format backingFormatHint) override;
+ QRhiTexture *createTexture(QRhiTexture::Format format,
+ const QSize &pixelSize,
+ int depth,
+ int arraySize,
+ int sampleCount,
+ QRhiTexture::Flags flags) override;
+ QRhiSampler *createSampler(QRhiSampler::Filter magFilter,
+ QRhiSampler::Filter minFilter,
+ QRhiSampler::Filter mipmapMode,
+ QRhiSampler:: AddressMode u,
+ QRhiSampler::AddressMode v,
+ QRhiSampler::AddressMode w) override;
+
+ QRhiTextureRenderTarget *createTextureRenderTarget(const QRhiTextureRenderTargetDescription &desc,
+ QRhiTextureRenderTarget::Flags flags) override;
+
+ QRhiSwapChain *createSwapChain() override;
+ QRhi::FrameOpResult beginFrame(QRhiSwapChain *swapChain, QRhi::BeginFrameFlags flags) override;
+ QRhi::FrameOpResult endFrame(QRhiSwapChain *swapChain, QRhi::EndFrameFlags flags) override;
+ QRhi::FrameOpResult beginOffscreenFrame(QRhiCommandBuffer **cb, QRhi::BeginFrameFlags flags) override;
+ QRhi::FrameOpResult endOffscreenFrame(QRhi::EndFrameFlags flags) override;
+ QRhi::FrameOpResult finish() override;
+
+ void resourceUpdate(QRhiCommandBuffer *cb, QRhiResourceUpdateBatch *resourceUpdates) override;
+
+ void beginPass(QRhiCommandBuffer *cb,
+ QRhiRenderTarget *rt,
+ const QColor &colorClearValue,
+ const QRhiDepthStencilClearValue &depthStencilClearValue,
+ QRhiResourceUpdateBatch *resourceUpdates,
+ QRhiCommandBuffer::BeginPassFlags flags) override;
+ void endPass(QRhiCommandBuffer *cb, QRhiResourceUpdateBatch *resourceUpdates) override;
+
+ void setGraphicsPipeline(QRhiCommandBuffer *cb,
+ QRhiGraphicsPipeline *ps) override;
+
+ void setShaderResources(QRhiCommandBuffer *cb,
+ QRhiShaderResourceBindings *srb,
+ int dynamicOffsetCount,
+ const QRhiCommandBuffer::DynamicOffset *dynamicOffsets) override;
+
+ void setVertexInput(QRhiCommandBuffer *cb,
+ int startBinding, int bindingCount, const QRhiCommandBuffer::VertexInput *bindings,
+ QRhiBuffer *indexBuf, quint32 indexOffset,
+ QRhiCommandBuffer::IndexFormat indexFormat) override;
+
+ void setViewport(QRhiCommandBuffer *cb, const QRhiViewport &viewport) override;
+ void setScissor(QRhiCommandBuffer *cb, const QRhiScissor &scissor) override;
+ void setBlendConstants(QRhiCommandBuffer *cb, const QColor &c) override;
+ void setStencilRef(QRhiCommandBuffer *cb, quint32 refValue) override;
+
+ void draw(QRhiCommandBuffer *cb, quint32 vertexCount,
+ quint32 instanceCount, quint32 firstVertex, quint32 firstInstance) override;
+
+ void drawIndexed(QRhiCommandBuffer *cb, quint32 indexCount,
+ quint32 instanceCount, quint32 firstIndex,
+ qint32 vertexOffset, quint32 firstInstance) override;
+
+ void debugMarkBegin(QRhiCommandBuffer *cb, const QByteArray &name) override;
+ void debugMarkEnd(QRhiCommandBuffer *cb) override;
+ void debugMarkMsg(QRhiCommandBuffer *cb, const QByteArray &msg) override;
+
+ void beginComputePass(QRhiCommandBuffer *cb,
+ QRhiResourceUpdateBatch *resourceUpdates,
+ QRhiCommandBuffer::BeginPassFlags flags) override;
+ void endComputePass(QRhiCommandBuffer *cb, QRhiResourceUpdateBatch *resourceUpdates) override;
+ void setComputePipeline(QRhiCommandBuffer *cb, QRhiComputePipeline *ps) override;
+ void dispatch(QRhiCommandBuffer *cb, int x, int y, int z) override;
+
+ const QRhiNativeHandles *nativeHandles(QRhiCommandBuffer *cb) override;
+ void beginExternal(QRhiCommandBuffer *cb) override;
+ void endExternal(QRhiCommandBuffer *cb) override;
+ double lastCompletedGpuTime(QRhiCommandBuffer *cb) override;
+
+ QList<int> supportedSampleCounts() const override;
+ int ubufAlignment() const override;
+ bool isYUpInFramebuffer() const override;
+ bool isYUpInNDC() const override;
+ bool isClipDepthZeroToOne() const override;
+ QMatrix4x4 clipSpaceCorrMatrix() const override;
+ bool isTextureFormatSupported(QRhiTexture::Format format, QRhiTexture::Flags flags) const override;
+ bool isFeatureSupported(QRhi::Feature feature) const override;
+ int resourceLimit(QRhi::ResourceLimit limit) const override;
+ const QRhiNativeHandles *nativeHandles() override;
+ QRhiDriverInfo driverInfo() const override;
+ QRhiStats statistics() override;
+ bool makeThreadLocalNativeContextCurrent() override;
+ void releaseCachedResources() override;
+ bool isDeviceLost() const override;
+
+ QByteArray pipelineCacheData() override;
+ void setPipelineCacheData(const QByteArray &data) override;
+
+ VkResult createDescriptorPool(VkDescriptorPool *pool);
+ bool allocateDescriptorSet(VkDescriptorSetAllocateInfo *allocInfo, VkDescriptorSet *result, int *resultPoolIndex);
+ uint32_t chooseTransientImageMemType(VkImage img, uint32_t startIndex);
+ bool createTransientImage(VkFormat format, const QSize &pixelSize, VkImageUsageFlags usage,
+ VkImageAspectFlags aspectMask, VkSampleCountFlagBits samples,
+ VkDeviceMemory *mem, VkImage *images, VkImageView *views, int count);
+
+ bool recreateSwapChain(QRhiSwapChain *swapChain);
+ void releaseSwapChainResources(QRhiSwapChain *swapChain);
+
+ VkFormat optimalDepthStencilFormat();
+ VkSampleCountFlagBits effectiveSampleCountBits(int sampleCount);
+ bool createDefaultRenderPass(QVkRenderPassDescriptor *rpD,
+ bool hasDepthStencil,
+ VkSampleCountFlagBits samples,
+ VkFormat colorFormat);
+ bool createOffscreenRenderPass(QVkRenderPassDescriptor *rpD,
+ const QRhiColorAttachment *colorAttachmentsBegin,
+ const QRhiColorAttachment *colorAttachmentsEnd,
+ bool preserveColor,
+ bool preserveDs,
+ bool storeDs,
+ QRhiRenderBuffer *depthStencilBuffer,
+ QRhiTexture *depthTexture,
+ QRhiTexture *depthResolveTexture);
+ bool ensurePipelineCache(const void *initialData = nullptr, size_t initialDataSize = 0);
+ VkShaderModule createShader(const QByteArray &spirv);
+
+ void prepareNewFrame(QRhiCommandBuffer *cb);
+ VkCommandBuffer startSecondaryCommandBuffer(QVkRenderTargetData *rtD = nullptr);
+ void endAndEnqueueSecondaryCommandBuffer(VkCommandBuffer cb, QVkCommandBuffer *cbD);
+ QRhi::FrameOpResult startPrimaryCommandBuffer(VkCommandBuffer *cb);
+ QRhi::FrameOpResult endAndSubmitPrimaryCommandBuffer(VkCommandBuffer cb, VkFence cmdFence,
+ VkSemaphore *waitSem, VkSemaphore *signalSem);
+ void waitCommandCompletion(int frameSlot);
+ VkDeviceSize subresUploadByteSize(const QRhiTextureSubresourceUploadDescription &subresDesc) const;
+ using BufferImageCopyList = QVarLengthArray<VkBufferImageCopy, 16>;
+ void prepareUploadSubres(QVkTexture *texD, int layer, int level,
+ const QRhiTextureSubresourceUploadDescription &subresDesc,
+ size_t *curOfs, void *mp,
+ BufferImageCopyList *copyInfos);
+ void enqueueResourceUpdates(QVkCommandBuffer *cbD, QRhiResourceUpdateBatch *resourceUpdates);
+ void executeBufferHostWritesForSlot(QVkBuffer *bufD, int slot);
+ void enqueueTransitionPassResources(QVkCommandBuffer *cbD);
+ void recordPrimaryCommandBuffer(QVkCommandBuffer *cbD);
+ void trackedRegisterBuffer(QRhiPassResourceTracker *passResTracker,
+ QVkBuffer *bufD,
+ int slot,
+ QRhiPassResourceTracker::BufferAccess access,
+ QRhiPassResourceTracker::BufferStage stage);
+ void trackedRegisterTexture(QRhiPassResourceTracker *passResTracker,
+ QVkTexture *texD,
+ QRhiPassResourceTracker::TextureAccess access,
+ QRhiPassResourceTracker::TextureStage stage);
+ void recordTransitionPassResources(QVkCommandBuffer *cbD, const QRhiPassResourceTracker &tracker);
+ void activateTextureRenderTarget(QVkCommandBuffer *cbD, QVkTextureRenderTarget *rtD);
+ void executeDeferredReleases(bool forced = false);
+ void finishActiveReadbacks(bool forced = false);
+
+ void setObjectName(uint64_t object, VkObjectType type, const QByteArray &name, int slot = -1);
+ void trackedBufferBarrier(QVkCommandBuffer *cbD, QVkBuffer *bufD, int slot,
+ VkAccessFlags access, VkPipelineStageFlags stage);
+ void trackedImageBarrier(QVkCommandBuffer *cbD, QVkTexture *texD,
+ VkImageLayout layout, VkAccessFlags access, VkPipelineStageFlags stage);
+ void depthStencilExplicitBarrier(QVkCommandBuffer *cbD, QVkRenderBuffer *rbD);
+ void subresourceBarrier(QVkCommandBuffer *cbD, VkImage image,
+ VkImageLayout oldLayout, VkImageLayout newLayout,
+ VkAccessFlags srcAccess, VkAccessFlags dstAccess,
+ VkPipelineStageFlags srcStage, VkPipelineStageFlags dstStage,
+ int startLayer, int layerCount,
+ int startLevel, int levelCount);
+ void updateShaderResourceBindings(QRhiShaderResourceBindings *srb, int descSetIdx = -1);
+ void ensureCommandPoolForNewFrame();
+ double elapsedSecondsFromTimestamp(quint64 timestamp[2], bool *ok);
+ void printExtraErrorInfo(VkResult err);
+
+ QVulkanInstance *inst = nullptr;
+ QWindow *maybeWindow = nullptr;
+ QByteArrayList requestedDeviceExtensions;
+ bool importedDevice = false;
+ VkPhysicalDevice physDev = VK_NULL_HANDLE;
+ VkDevice dev = VK_NULL_HANDLE;
+ VkCommandPool cmdPool[QVK_FRAMES_IN_FLIGHT] = {};
+ quint32 gfxQueueFamilyIdx = 0;
+ quint32 gfxQueueIdx = 0;
+ VkQueue gfxQueue = VK_NULL_HANDLE;
+ quint32 timestampValidBits = 0;
+ bool importedAllocator = false;
+ QVkAllocator allocator = nullptr;
+ QVulkanFunctions *f = nullptr;
+ QVulkanDeviceFunctions *df = nullptr;
+ QRhi::Flags rhiFlags;
+ VkPhysicalDeviceFeatures physDevFeatures;
+#ifdef VK_VERSION_1_1
+ VkPhysicalDeviceMultiviewFeatures multiviewFeaturesIfApi11;
+#endif
+#ifdef VK_VERSION_1_2
+ VkPhysicalDeviceVulkan11Features physDevFeatures11IfApi12OrNewer;
+ VkPhysicalDeviceVulkan12Features physDevFeatures12;
+#endif
+#ifdef VK_VERSION_1_3
+ VkPhysicalDeviceVulkan13Features physDevFeatures13;
+#endif
+ VkPhysicalDeviceProperties physDevProperties;
+ VkDeviceSize ubufAlign;
+ VkDeviceSize texbufAlign;
+ bool deviceLost = false;
+ bool releaseCachedResourcesCalledBeforeFrameStart = false;
+
+#ifdef VK_EXT_debug_utils
+ PFN_vkSetDebugUtilsObjectNameEXT vkSetDebugUtilsObjectNameEXT = nullptr;
+ PFN_vkCmdBeginDebugUtilsLabelEXT vkCmdBeginDebugUtilsLabelEXT = nullptr;
+ PFN_vkCmdEndDebugUtilsLabelEXT vkCmdEndDebugUtilsLabelEXT = nullptr;
+ PFN_vkCmdInsertDebugUtilsLabelEXT vkCmdInsertDebugUtilsLabelEXT = nullptr;
+#endif
+
+ PFN_vkCreateSwapchainKHR vkCreateSwapchainKHR = nullptr;
+ PFN_vkDestroySwapchainKHR vkDestroySwapchainKHR;
+ PFN_vkGetSwapchainImagesKHR vkGetSwapchainImagesKHR;
+ PFN_vkAcquireNextImageKHR vkAcquireNextImageKHR;
+ PFN_vkQueuePresentKHR vkQueuePresentKHR;
+ PFN_vkGetPhysicalDeviceSurfaceCapabilitiesKHR vkGetPhysicalDeviceSurfaceCapabilitiesKHR;
+ PFN_vkGetPhysicalDeviceSurfaceFormatsKHR vkGetPhysicalDeviceSurfaceFormatsKHR;
+ PFN_vkGetPhysicalDeviceSurfacePresentModesKHR vkGetPhysicalDeviceSurfacePresentModesKHR;
+
+#ifdef VK_KHR_create_renderpass2
+ PFN_vkCreateRenderPass2KHR vkCreateRenderPass2KHR = nullptr;
+#endif
+
+ struct {
+ bool compute = false;
+ bool wideLines = false;
+ bool debugUtils = false;
+ bool vertexAttribDivisor = false;
+ bool texture3DSliceAs2D = false;
+ bool tessellation = false;
+ bool geometryShader = false;
+ bool nonFillPolygonMode = false;
+ bool multiView = false;
+ bool renderPass2KHR = false;
+ bool depthStencilResolveKHR = false;
+ QVersionNumber apiVersion;
+ } caps;
+
+ VkPipelineCache pipelineCache = VK_NULL_HANDLE;
+ struct DescriptorPoolData {
+ DescriptorPoolData() { }
+ DescriptorPoolData(VkDescriptorPool pool_)
+ : pool(pool_)
+ { }
+ VkDescriptorPool pool = VK_NULL_HANDLE;
+ int refCount = 0;
+ int allocedDescSets = 0;
+ };
+ QVarLengthArray<DescriptorPoolData, 8> descriptorPools;
+ QVarLengthArray<VkCommandBuffer, 4> freeSecondaryCbs[QVK_FRAMES_IN_FLIGHT];
+
+ VkQueryPool timestampQueryPool = VK_NULL_HANDLE;
+ QBitArray timestampQueryPoolMap;
+
+ VkFormat optimalDsFormat = VK_FORMAT_UNDEFINED;
+ QMatrix4x4 clipCorrectMatrix;
+
+ QVkSwapChain *currentSwapChain = nullptr;
+ QSet<QVkSwapChain *> swapchains;
+ QRhiVulkanNativeHandles nativeHandlesStruct;
+ QRhiDriverInfo driverInfoStruct;
+
+ struct OffscreenFrame {
+ OffscreenFrame(QRhiImplementation *rhi)
+ {
+ for (int i = 0; i < QVK_FRAMES_IN_FLIGHT; ++i)
+ cbWrapper[i] = new QVkCommandBuffer(rhi);
+ }
+ ~OffscreenFrame()
+ {
+ for (int i = 0; i < QVK_FRAMES_IN_FLIGHT; ++i)
+ delete cbWrapper[i];
+ }
+ bool active = false;
+ QVkCommandBuffer *cbWrapper[QVK_FRAMES_IN_FLIGHT];
+ VkFence cmdFence = VK_NULL_HANDLE;
+ int timestampQueryIndex = -1;
+ } ofr;
+
+ struct TextureReadback {
+ int activeFrameSlot = -1;
+ QRhiReadbackDescription desc;
+ QRhiReadbackResult *result;
+ VkBuffer stagingBuf;
+ QVkAlloc stagingAlloc;
+ quint32 byteSize;
+ QSize pixelSize;
+ QRhiTexture::Format format;
+ };
+ QVarLengthArray<TextureReadback, 2> activeTextureReadbacks;
+ struct BufferReadback {
+ int activeFrameSlot = -1;
+ QRhiReadbackResult *result;
+ quint32 byteSize;
+ VkBuffer stagingBuf;
+ QVkAlloc stagingAlloc;
+ };
+ QVarLengthArray<BufferReadback, 2> activeBufferReadbacks;
+
+ struct DeferredReleaseEntry {
+ enum Type {
+ Pipeline,
+ ShaderResourceBindings,
+ Buffer,
+ RenderBuffer,
+ Texture,
+ Sampler,
+ TextureRenderTarget,
+ RenderPass,
+ StagingBuffer,
+ SecondaryCommandBuffer
+ };
+ Type type;
+ int lastActiveFrameSlot; // -1 if not used otherwise 0..FRAMES_IN_FLIGHT-1
+ union {
+ struct {
+ VkPipeline pipeline;
+ VkPipelineLayout layout;
+ } pipelineState;
+ struct {
+ int poolIndex;
+ VkDescriptorSetLayout layout;
+ } shaderResourceBindings;
+ struct {
+ VkBuffer buffers[QVK_FRAMES_IN_FLIGHT];
+ QVkAlloc allocations[QVK_FRAMES_IN_FLIGHT];
+ VkBuffer stagingBuffers[QVK_FRAMES_IN_FLIGHT];
+ QVkAlloc stagingAllocations[QVK_FRAMES_IN_FLIGHT];
+ } buffer;
+ struct {
+ VkDeviceMemory memory;
+ VkImage image;
+ VkImageView imageView;
+ } renderBuffer;
+ struct {
+ VkImage image;
+ VkImageView imageView;
+ QVkAlloc allocation;
+ VkBuffer stagingBuffers[QVK_FRAMES_IN_FLIGHT];
+ QVkAlloc stagingAllocations[QVK_FRAMES_IN_FLIGHT];
+ VkImageView extraImageViews[QRhi::MAX_MIP_LEVELS];
+ } texture;
+ struct {
+ VkSampler sampler;
+ } sampler;
+ struct {
+ VkFramebuffer fb;
+ VkImageView rtv[QVkRenderTargetData::MAX_COLOR_ATTACHMENTS];
+ VkImageView resrtv[QVkRenderTargetData::MAX_COLOR_ATTACHMENTS];
+ VkImageView dsv;
+ VkImageView resdsv;
+ } textureRenderTarget;
+ struct {
+ VkRenderPass rp;
+ } renderPass;
+ struct {
+ VkBuffer stagingBuffer;
+ QVkAlloc stagingAllocation;
+ } stagingBuffer;
+ struct {
+ VkCommandBuffer cb;
+ } secondaryCommandBuffer;
+ };
+ };
+ QList<DeferredReleaseEntry> releaseQueue;
+};
+
+Q_DECLARE_TYPEINFO(QRhiVulkan::DescriptorPoolData, Q_RELOCATABLE_TYPE);
+Q_DECLARE_TYPEINFO(QRhiVulkan::DeferredReleaseEntry, Q_RELOCATABLE_TYPE);
+Q_DECLARE_TYPEINFO(QRhiVulkan::TextureReadback, Q_RELOCATABLE_TYPE);
+Q_DECLARE_TYPEINFO(QRhiVulkan::BufferReadback, Q_RELOCATABLE_TYPE);
+
QT_END_NAMESPACE
#endif
diff --git a/src/gui/rhi/qrhivulkan_p_p.h b/src/gui/rhi/qrhivulkan_p_p.h
deleted file mode 100644
index d1b77870a1..0000000000
--- a/src/gui/rhi/qrhivulkan_p_p.h
+++ /dev/null
@@ -1,957 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2019 The Qt Company Ltd.
-** Contact: http://www.qt.io/licensing/
-**
-** This file is part of the Qt Gui module
-**
-** $QT_BEGIN_LICENSE:LGPL3$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef QRHIVULKAN_P_H
-#define QRHIVULKAN_P_H
-
-//
-// W A R N I N G
-// -------------
-//
-// This file is not part of the Qt API. It exists purely as an
-// implementation detail. This header file may change from version to
-// version without notice, or even be removed.
-//
-// We mean it.
-//
-
-#include "qrhivulkan_p.h"
-#include "qrhi_p_p.h"
-
-QT_BEGIN_NAMESPACE
-
-class QVulkanFunctions;
-class QVulkanDeviceFunctions;
-
-static const int QVK_FRAMES_IN_FLIGHT = 2;
-
-static const int QVK_DESC_SETS_PER_POOL = 128;
-static const int QVK_UNIFORM_BUFFERS_PER_POOL = 256;
-static const int QVK_COMBINED_IMAGE_SAMPLERS_PER_POOL = 256;
-static const int QVK_STORAGE_BUFFERS_PER_POOL = 128;
-static const int QVK_STORAGE_IMAGES_PER_POOL = 128;
-
-static const int QVK_MAX_ACTIVE_TIMESTAMP_PAIRS = 16;
-
-// no vk_mem_alloc.h available here, void* is good enough
-typedef void * QVkAlloc;
-typedef void * QVkAllocator;
-
-struct QVkBuffer : public QRhiBuffer
-{
- QVkBuffer(QRhiImplementation *rhi, Type type, UsageFlags usage, int size);
- ~QVkBuffer();
- void release() override;
- bool build() override;
-
- VkBuffer buffers[QVK_FRAMES_IN_FLIGHT];
- QVkAlloc allocations[QVK_FRAMES_IN_FLIGHT];
- QVarLengthArray<QRhiResourceUpdateBatchPrivate::BufferOp, 16> pendingDynamicUpdates[QVK_FRAMES_IN_FLIGHT];
- VkBuffer stagingBuffers[QVK_FRAMES_IN_FLIGHT];
- QVkAlloc stagingAllocations[QVK_FRAMES_IN_FLIGHT];
- struct UsageState {
- VkAccessFlags access = 0;
- VkPipelineStageFlags stage = 0;
- };
- UsageState usageState[QVK_FRAMES_IN_FLIGHT];
- int lastActiveFrameSlot = -1;
- uint generation = 0;
- friend class QRhiVulkan;
-};
-
-struct QVkTexture;
-
-struct QVkRenderBuffer : public QRhiRenderBuffer
-{
- QVkRenderBuffer(QRhiImplementation *rhi, Type type, const QSize &pixelSize,
- int sampleCount, Flags flags);
- ~QVkRenderBuffer();
- void release() override;
- bool build() override;
- QRhiTexture::Format backingFormat() const override;
-
- VkDeviceMemory memory = VK_NULL_HANDLE;
- VkImage image = VK_NULL_HANDLE;
- VkImageView imageView = VK_NULL_HANDLE;
- VkSampleCountFlagBits samples;
- QVkTexture *backingTexture = nullptr;
- VkFormat vkformat;
- int lastActiveFrameSlot = -1;
- friend class QRhiVulkan;
-};
-
-struct QVkTexture : public QRhiTexture
-{
- QVkTexture(QRhiImplementation *rhi, Format format, const QSize &pixelSize,
- int sampleCount, Flags flags);
- ~QVkTexture();
- void release() override;
- bool build() override;
- bool buildFrom(const QRhiNativeHandles *src) override;
- bool buildFrom(NativeTexture src) override;
- const QRhiNativeHandles *nativeHandles() override;
- NativeTexture nativeTexture() override;
-
- bool prepareBuild(QSize *adjustedSize = nullptr);
- bool finishBuild();
- VkImageView imageViewForLevel(int level);
-
- VkImage image = VK_NULL_HANDLE;
- VkImageView imageView = VK_NULL_HANDLE;
- QVkAlloc imageAlloc = nullptr;
- VkBuffer stagingBuffers[QVK_FRAMES_IN_FLIGHT];
- QVkAlloc stagingAllocations[QVK_FRAMES_IN_FLIGHT];
- VkImageView perLevelImageViews[QRhi::MAX_LEVELS];
- bool owns = true;
- QRhiVulkanTextureNativeHandles nativeHandlesStruct;
- struct UsageState {
- // no tracking of subresource layouts (some operations can keep
- // subresources in different layouts for some time, but that does not
- // need to be kept track of)
- VkImageLayout layout;
- VkAccessFlags access;
- VkPipelineStageFlags stage;
- };
- UsageState usageState;
- VkFormat vkformat;
- uint mipLevelCount = 0;
- VkSampleCountFlagBits samples;
- int lastActiveFrameSlot = -1;
- uint generation = 0;
- friend class QRhiVulkan;
-};
-
-struct QVkSampler : public QRhiSampler
-{
- QVkSampler(QRhiImplementation *rhi, Filter magFilter, Filter minFilter, Filter mipmapMode,
- AddressMode u, AddressMode v);
- ~QVkSampler();
- void release() override;
- bool build() override;
-
- VkSampler sampler = VK_NULL_HANDLE;
- int lastActiveFrameSlot = -1;
- uint generation = 0;
- friend class QRhiVulkan;
-};
-
-struct QVkRenderPassDescriptor : public QRhiRenderPassDescriptor
-{
- QVkRenderPassDescriptor(QRhiImplementation *rhi);
- ~QVkRenderPassDescriptor();
- void release() override;
- bool isCompatible(const QRhiRenderPassDescriptor *other) const override;
- const QRhiNativeHandles *nativeHandles() override;
-
- VkRenderPass rp = VK_NULL_HANDLE;
- bool ownsRp = false;
- QVarLengthArray<VkAttachmentDescription, 8> attDescs;
- QVarLengthArray<VkAttachmentReference, 8> colorRefs;
- QVarLengthArray<VkAttachmentReference, 8> resolveRefs;
- bool hasDepthStencil = false;
- VkAttachmentReference dsRef;
- QRhiVulkanRenderPassNativeHandles nativeHandlesStruct;
- int lastActiveFrameSlot = -1;
-};
-
-struct QVkRenderTargetData
-{
- VkFramebuffer fb = VK_NULL_HANDLE;
- QVkRenderPassDescriptor *rp = nullptr;
- QSize pixelSize;
- float dpr = 1;
- int sampleCount = 1;
- int colorAttCount = 0;
- int dsAttCount = 0;
- int resolveAttCount = 0;
- static const int MAX_COLOR_ATTACHMENTS = 8;
-};
-
-struct QVkReferenceRenderTarget : public QRhiRenderTarget
-{
- QVkReferenceRenderTarget(QRhiImplementation *rhi);
- ~QVkReferenceRenderTarget();
- void release() override;
-
- QSize pixelSize() const override;
- float devicePixelRatio() const override;
- int sampleCount() const override;
-
- QVkRenderTargetData d;
-};
-
-struct QVkTextureRenderTarget : public QRhiTextureRenderTarget
-{
- QVkTextureRenderTarget(QRhiImplementation *rhi, const QRhiTextureRenderTargetDescription &desc, Flags flags);
- ~QVkTextureRenderTarget();
- void release() override;
-
- QSize pixelSize() const override;
- float devicePixelRatio() const override;
- int sampleCount() const override;
-
- QRhiRenderPassDescriptor *newCompatibleRenderPassDescriptor() override;
- bool build() override;
-
- QVkRenderTargetData d;
- VkImageView rtv[QVkRenderTargetData::MAX_COLOR_ATTACHMENTS];
- VkImageView resrtv[QVkRenderTargetData::MAX_COLOR_ATTACHMENTS];
- int lastActiveFrameSlot = -1;
- friend class QRhiVulkan;
-};
-
-struct QVkShaderResourceBindings : public QRhiShaderResourceBindings
-{
- QVkShaderResourceBindings(QRhiImplementation *rhi);
- ~QVkShaderResourceBindings();
- void release() override;
- bool build() override;
-
- QVarLengthArray<QRhiShaderResourceBinding, 8> sortedBindings;
- int poolIndex = -1;
- VkDescriptorSetLayout layout = VK_NULL_HANDLE;
- VkDescriptorSet descSets[QVK_FRAMES_IN_FLIGHT]; // multiple sets to support dynamic buffers
- int lastActiveFrameSlot = -1;
- uint generation = 0;
-
- // Keep track of the generation number of each referenced QRhi* to be able
- // to detect that the underlying descriptor set became out of date and they
- // need to be written again with the up-to-date VkBuffer etc. objects.
- struct BoundUniformBufferData {
- quint64 id;
- uint generation;
- };
- struct BoundSampledTextureData {
- quint64 texId;
- uint texGeneration;
- quint64 samplerId;
- uint samplerGeneration;
- };
- struct BoundStorageImageData {
- quint64 id;
- uint generation;
- };
- struct BoundStorageBufferData {
- quint64 id;
- uint generation;
- };
- struct BoundResourceData {
- union {
- BoundUniformBufferData ubuf;
- BoundSampledTextureData stex;
- BoundStorageImageData simage;
- BoundStorageBufferData sbuf;
- };
- };
- QVarLengthArray<BoundResourceData, 8> boundResourceData[QVK_FRAMES_IN_FLIGHT];
-
- friend class QRhiVulkan;
-};
-
-Q_DECLARE_TYPEINFO(QVkShaderResourceBindings::BoundResourceData, Q_MOVABLE_TYPE);
-
-struct QVkGraphicsPipeline : public QRhiGraphicsPipeline
-{
- QVkGraphicsPipeline(QRhiImplementation *rhi);
- ~QVkGraphicsPipeline();
- void release() override;
- bool build() override;
-
- VkPipelineLayout layout = VK_NULL_HANDLE;
- VkPipeline pipeline = VK_NULL_HANDLE;
- int lastActiveFrameSlot = -1;
- uint generation = 0;
- friend class QRhiVulkan;
-};
-
-struct QVkComputePipeline : public QRhiComputePipeline
-{
- QVkComputePipeline(QRhiImplementation *rhi);
- ~QVkComputePipeline();
- void release() override;
- bool build() override;
-
- VkPipelineLayout layout = VK_NULL_HANDLE;
- VkPipeline pipeline = VK_NULL_HANDLE;
- int lastActiveFrameSlot = -1;
- uint generation = 0;
- friend class QRhiVulkan;
-};
-
-struct QVkCommandBuffer : public QRhiCommandBuffer
-{
- QVkCommandBuffer(QRhiImplementation *rhi);
- ~QVkCommandBuffer();
- void release() override;
-
- const QRhiNativeHandles *nativeHandles();
-
- VkCommandBuffer cb = VK_NULL_HANDLE; // primary
- bool useSecondaryCb = false;
- QRhiVulkanCommandBufferNativeHandles nativeHandlesStruct;
-
- enum PassType {
- NoPass,
- RenderPass,
- ComputePass
- };
-
- void resetState() {
- recordingPass = NoPass;
- currentTarget = nullptr;
-
- secondaryCbs.clear();
-
- resetCommands();
- resetCachedState();
- }
-
- void resetCachedState() {
- currentGraphicsPipeline = nullptr;
- currentComputePipeline = nullptr;
- currentPipelineGeneration = 0;
- currentGraphicsSrb = nullptr;
- currentComputeSrb = nullptr;
- currentSrbGeneration = 0;
- currentDescSetSlot = -1;
- currentIndexBuffer = VK_NULL_HANDLE;
- currentIndexOffset = 0;
- currentIndexFormat = VK_INDEX_TYPE_UINT16;
- memset(currentVertexBuffers, 0, sizeof(currentVertexBuffers));
- memset(currentVertexOffsets, 0, sizeof(currentVertexOffsets));
- inExternal = false;
- }
-
- PassType recordingPass;
- QRhiRenderTarget *currentTarget;
- QRhiGraphicsPipeline *currentGraphicsPipeline;
- QRhiComputePipeline *currentComputePipeline;
- uint currentPipelineGeneration;
- QRhiShaderResourceBindings *currentGraphicsSrb;
- QRhiShaderResourceBindings *currentComputeSrb;
- uint currentSrbGeneration;
- int currentDescSetSlot;
- VkBuffer currentIndexBuffer;
- quint32 currentIndexOffset;
- VkIndexType currentIndexFormat;
- static const int VERTEX_INPUT_RESOURCE_SLOT_COUNT = 32;
- VkBuffer currentVertexBuffers[VERTEX_INPUT_RESOURCE_SLOT_COUNT];
- quint32 currentVertexOffsets[VERTEX_INPUT_RESOURCE_SLOT_COUNT];
- QVarLengthArray<VkCommandBuffer, 4> secondaryCbs;
- bool inExternal;
-
- struct Command {
- enum Cmd {
- CopyBuffer,
- CopyBufferToImage,
- CopyImage,
- CopyImageToBuffer,
- ImageBarrier,
- BufferBarrier,
- BlitImage,
- BeginRenderPass,
- EndRenderPass,
- BindPipeline,
- BindDescriptorSet,
- BindVertexBuffer,
- BindIndexBuffer,
- SetViewport,
- SetScissor,
- SetBlendConstants,
- SetStencilRef,
- Draw,
- DrawIndexed,
- DebugMarkerBegin,
- DebugMarkerEnd,
- DebugMarkerInsert,
- TransitionPassResources,
- Dispatch,
- ExecuteSecondary
- };
- Cmd cmd;
-
- union Args {
- struct {
- VkBuffer src;
- VkBuffer dst;
- VkBufferCopy desc;
- } copyBuffer;
- struct {
- VkBuffer src;
- VkImage dst;
- VkImageLayout dstLayout;
- int count;
- int bufferImageCopyIndex;
- } copyBufferToImage;
- struct {
- VkImage src;
- VkImageLayout srcLayout;
- VkImage dst;
- VkImageLayout dstLayout;
- VkImageCopy desc;
- } copyImage;
- struct {
- VkImage src;
- VkImageLayout srcLayout;
- VkBuffer dst;
- VkBufferImageCopy desc;
- } copyImageToBuffer;
- struct {
- VkPipelineStageFlags srcStageMask;
- VkPipelineStageFlags dstStageMask;
- VkImageMemoryBarrier desc;
- } imageBarrier;
- struct {
- VkPipelineStageFlags srcStageMask;
- VkPipelineStageFlags dstStageMask;
- VkBufferMemoryBarrier desc;
- } bufferBarrier;
- struct {
- VkImage src;
- VkImageLayout srcLayout;
- VkImage dst;
- VkImageLayout dstLayout;
- VkFilter filter;
- VkImageBlit desc;
- } blitImage;
- struct {
- VkRenderPassBeginInfo desc;
- int clearValueIndex;
- } beginRenderPass;
- struct {
- } endRenderPass;
- struct {
- VkPipelineBindPoint bindPoint;
- VkPipeline pipeline;
- } bindPipeline;
- struct {
- VkPipelineBindPoint bindPoint;
- VkPipelineLayout pipelineLayout;
- VkDescriptorSet descSet;
- int dynamicOffsetCount;
- int dynamicOffsetIndex;
- } bindDescriptorSet;
- struct {
- int startBinding;
- int count;
- int vertexBufferIndex;
- int vertexBufferOffsetIndex;
- } bindVertexBuffer;
- struct {
- VkBuffer buf;
- VkDeviceSize ofs;
- VkIndexType type;
- } bindIndexBuffer;
- struct {
- VkViewport viewport;
- } setViewport;
- struct {
- VkRect2D scissor;
- } setScissor;
- struct {
- float c[4];
- } setBlendConstants;
- struct {
- uint32_t ref;
- } setStencilRef;
- struct {
- uint32_t vertexCount;
- uint32_t instanceCount;
- uint32_t firstVertex;
- uint32_t firstInstance;
- } draw;
- struct {
- uint32_t indexCount;
- uint32_t instanceCount;
- uint32_t firstIndex;
- int32_t vertexOffset;
- uint32_t firstInstance;
- } drawIndexed;
- struct {
- VkDebugMarkerMarkerInfoEXT marker;
- int markerNameIndex;
- } debugMarkerBegin;
- struct {
- } debugMarkerEnd;
- struct {
- VkDebugMarkerMarkerInfoEXT marker;
- int markerNameIndex;
- } debugMarkerInsert;
- struct {
- int trackerIndex;
- } transitionResources;
- struct {
- int x, y, z;
- } dispatch;
- struct {
- VkCommandBuffer cb;
- } executeSecondary;
- } args;
- };
- QVector<Command> commands;
- QVarLengthArray<QRhiPassResourceTracker, 8> passResTrackers;
- int currentPassResTrackerIndex;
-
- void resetCommands() {
- commands.clear();
- resetPools();
-
- passResTrackers.clear();
- currentPassResTrackerIndex = -1;
- }
-
- void resetPools() {
- pools.clearValue.clear();
- pools.bufferImageCopy.clear();
- pools.dynamicOffset.clear();
- pools.vertexBuffer.clear();
- pools.vertexBufferOffset.clear();
- pools.debugMarkerData.clear();
- }
-
- struct {
- QVarLengthArray<VkClearValue, 4> clearValue;
- QVarLengthArray<VkBufferImageCopy, 16> bufferImageCopy;
- QVarLengthArray<uint32_t, 4> dynamicOffset;
- QVarLengthArray<VkBuffer, 4> vertexBuffer;
- QVarLengthArray<VkDeviceSize, 4> vertexBufferOffset;
- QVarLengthArray<QByteArray, 4> debugMarkerData;
- } pools;
-
- friend class QRhiVulkan;
-};
-
-Q_DECLARE_TYPEINFO(QVkCommandBuffer::Command, Q_MOVABLE_TYPE);
-
-struct QVkSwapChain : public QRhiSwapChain
-{
- QVkSwapChain(QRhiImplementation *rhi);
- ~QVkSwapChain();
- void release() override;
-
- QRhiCommandBuffer *currentFrameCommandBuffer() override;
- QRhiRenderTarget *currentFrameRenderTarget() override;
-
- QSize surfacePixelSize() override;
-
- QRhiRenderPassDescriptor *newCompatibleRenderPassDescriptor() override;
- bool buildOrResize() override;
-
- bool ensureSurface();
-
- static const quint32 MAX_BUFFER_COUNT = 3;
-
- QWindow *window = nullptr;
- QSize pixelSize;
- bool supportsReadback = false;
- VkSwapchainKHR sc = VK_NULL_HANDLE;
- int bufferCount = 0;
- VkSurfaceKHR surface = VK_NULL_HANDLE;
- VkSurfaceKHR lastConnectedSurface = VK_NULL_HANDLE;
- VkFormat colorFormat = VK_FORMAT_B8G8R8A8_UNORM;
- VkColorSpaceKHR colorSpace = VK_COLOR_SPACE_SRGB_NONLINEAR_KHR;
- QVkRenderBuffer *ds = nullptr;
- VkSampleCountFlagBits samples = VK_SAMPLE_COUNT_1_BIT;
- QVector<VkPresentModeKHR> supportedPresentationModes;
- VkDeviceMemory msaaImageMem = VK_NULL_HANDLE;
- QVkReferenceRenderTarget rtWrapper;
- QVkCommandBuffer cbWrapper;
-
- struct ImageResources {
- VkImage image = VK_NULL_HANDLE;
- VkImageView imageView = VK_NULL_HANDLE;
- VkFramebuffer fb = VK_NULL_HANDLE;
- VkImage msaaImage = VK_NULL_HANDLE;
- VkImageView msaaImageView = VK_NULL_HANDLE;
- enum LastUse {
- ScImageUseNone,
- ScImageUseRender,
- ScImageUseTransferSource
- };
- LastUse lastUse = ScImageUseNone;
- } imageRes[MAX_BUFFER_COUNT];
-
- struct FrameResources {
- VkFence imageFence = VK_NULL_HANDLE;
- bool imageFenceWaitable = false;
- VkSemaphore imageSem = VK_NULL_HANDLE;
- VkSemaphore drawSem = VK_NULL_HANDLE;
- bool imageAcquired = false;
- bool imageSemWaitable = false;
- quint32 imageIndex = 0;
- VkCommandBuffer cmdBuf = VK_NULL_HANDLE; // primary
- VkFence cmdFence = VK_NULL_HANDLE;
- bool cmdFenceWaitable = false;
- int timestampQueryIndex = -1;
- } frameRes[QVK_FRAMES_IN_FLIGHT];
-
- quint32 currentImageIndex = 0; // index in imageRes
- quint32 currentFrameSlot = 0; // index in frameRes
- int frameCount = 0;
-
- friend class QRhiVulkan;
-};
-
-class QRhiVulkan : public QRhiImplementation
-{
-public:
- QRhiVulkan(QRhiVulkanInitParams *params, QRhiVulkanNativeHandles *importDevice = nullptr);
-
- bool create(QRhi::Flags flags) override;
- void destroy() override;
-
- QRhiGraphicsPipeline *createGraphicsPipeline() override;
- QRhiComputePipeline *createComputePipeline() override;
- QRhiShaderResourceBindings *createShaderResourceBindings() override;
- QRhiBuffer *createBuffer(QRhiBuffer::Type type,
- QRhiBuffer::UsageFlags usage,
- int size) override;
- QRhiRenderBuffer *createRenderBuffer(QRhiRenderBuffer::Type type,
- const QSize &pixelSize,
- int sampleCount,
- QRhiRenderBuffer::Flags flags) override;
- QRhiTexture *createTexture(QRhiTexture::Format format,
- const QSize &pixelSize,
- int sampleCount,
- QRhiTexture::Flags flags) override;
- QRhiSampler *createSampler(QRhiSampler::Filter magFilter, QRhiSampler::Filter minFilter,
- QRhiSampler::Filter mipmapMode,
- QRhiSampler:: AddressMode u, QRhiSampler::AddressMode v) override;
-
- QRhiTextureRenderTarget *createTextureRenderTarget(const QRhiTextureRenderTargetDescription &desc,
- QRhiTextureRenderTarget::Flags flags) override;
-
- QRhiSwapChain *createSwapChain() override;
- QRhi::FrameOpResult beginFrame(QRhiSwapChain *swapChain, QRhi::BeginFrameFlags flags) override;
- QRhi::FrameOpResult endFrame(QRhiSwapChain *swapChain, QRhi::EndFrameFlags flags) override;
- QRhi::FrameOpResult beginOffscreenFrame(QRhiCommandBuffer **cb, QRhi::BeginFrameFlags flags) override;
- QRhi::FrameOpResult endOffscreenFrame(QRhi::EndFrameFlags flags) override;
- QRhi::FrameOpResult finish() override;
-
- void resourceUpdate(QRhiCommandBuffer *cb, QRhiResourceUpdateBatch *resourceUpdates) override;
-
- void beginPass(QRhiCommandBuffer *cb,
- QRhiRenderTarget *rt,
- const QColor &colorClearValue,
- const QRhiDepthStencilClearValue &depthStencilClearValue,
- QRhiResourceUpdateBatch *resourceUpdates) override;
- void endPass(QRhiCommandBuffer *cb, QRhiResourceUpdateBatch *resourceUpdates) override;
-
- void setGraphicsPipeline(QRhiCommandBuffer *cb,
- QRhiGraphicsPipeline *ps) override;
-
- void setShaderResources(QRhiCommandBuffer *cb,
- QRhiShaderResourceBindings *srb,
- int dynamicOffsetCount,
- const QRhiCommandBuffer::DynamicOffset *dynamicOffsets) override;
-
- void setVertexInput(QRhiCommandBuffer *cb,
- int startBinding, int bindingCount, const QRhiCommandBuffer::VertexInput *bindings,
- QRhiBuffer *indexBuf, quint32 indexOffset,
- QRhiCommandBuffer::IndexFormat indexFormat) override;
-
- void setViewport(QRhiCommandBuffer *cb, const QRhiViewport &viewport) override;
- void setScissor(QRhiCommandBuffer *cb, const QRhiScissor &scissor) override;
- void setBlendConstants(QRhiCommandBuffer *cb, const QColor &c) override;
- void setStencilRef(QRhiCommandBuffer *cb, quint32 refValue) override;
-
- void draw(QRhiCommandBuffer *cb, quint32 vertexCount,
- quint32 instanceCount, quint32 firstVertex, quint32 firstInstance) override;
-
- void drawIndexed(QRhiCommandBuffer *cb, quint32 indexCount,
- quint32 instanceCount, quint32 firstIndex,
- qint32 vertexOffset, quint32 firstInstance) override;
-
- void debugMarkBegin(QRhiCommandBuffer *cb, const QByteArray &name) override;
- void debugMarkEnd(QRhiCommandBuffer *cb) override;
- void debugMarkMsg(QRhiCommandBuffer *cb, const QByteArray &msg) override;
-
- void beginComputePass(QRhiCommandBuffer *cb, QRhiResourceUpdateBatch *resourceUpdates) override;
- void endComputePass(QRhiCommandBuffer *cb, QRhiResourceUpdateBatch *resourceUpdates) override;
- void setComputePipeline(QRhiCommandBuffer *cb, QRhiComputePipeline *ps) override;
- void dispatch(QRhiCommandBuffer *cb, int x, int y, int z) override;
-
- const QRhiNativeHandles *nativeHandles(QRhiCommandBuffer *cb) override;
- void beginExternal(QRhiCommandBuffer *cb) override;
- void endExternal(QRhiCommandBuffer *cb) override;
-
- QVector<int> supportedSampleCounts() const override;
- int ubufAlignment() const override;
- bool isYUpInFramebuffer() const override;
- bool isYUpInNDC() const override;
- bool isClipDepthZeroToOne() const override;
- QMatrix4x4 clipSpaceCorrMatrix() const override;
- bool isTextureFormatSupported(QRhiTexture::Format format, QRhiTexture::Flags flags) const override;
- bool isFeatureSupported(QRhi::Feature feature) const override;
- int resourceLimit(QRhi::ResourceLimit limit) const override;
- const QRhiNativeHandles *nativeHandles() override;
- void sendVMemStatsToProfiler() override;
- bool makeThreadLocalNativeContextCurrent() override;
- void releaseCachedResources() override;
- bool isDeviceLost() const override;
-
- VkResult createDescriptorPool(VkDescriptorPool *pool);
- bool allocateDescriptorSet(VkDescriptorSetAllocateInfo *allocInfo, VkDescriptorSet *result, int *resultPoolIndex);
- uint32_t chooseTransientImageMemType(VkImage img, uint32_t startIndex);
- bool createTransientImage(VkFormat format, const QSize &pixelSize, VkImageUsageFlags usage,
- VkImageAspectFlags aspectMask, VkSampleCountFlagBits samples,
- VkDeviceMemory *mem, VkImage *images, VkImageView *views, int count);
-
- bool recreateSwapChain(QRhiSwapChain *swapChain);
- void releaseSwapChainResources(QRhiSwapChain *swapChain);
-
- VkFormat optimalDepthStencilFormat();
- VkSampleCountFlagBits effectiveSampleCount(int sampleCount);
- bool createDefaultRenderPass(QVkRenderPassDescriptor *rpD,
- bool hasDepthStencil,
- VkSampleCountFlagBits samples,
- VkFormat colorFormat);
- bool createOffscreenRenderPass(QVkRenderPassDescriptor *rpD,
- const QRhiColorAttachment *firstColorAttachment,
- const QRhiColorAttachment *lastColorAttachment,
- bool preserveColor,
- bool preserveDs,
- QRhiRenderBuffer *depthStencilBuffer,
- QRhiTexture *depthTexture);
- bool ensurePipelineCache();
- VkShaderModule createShader(const QByteArray &spirv);
-
- void prepareNewFrame(QRhiCommandBuffer *cb);
- VkCommandBuffer startSecondaryCommandBuffer(QVkRenderTargetData *rtD = nullptr);
- void endAndEnqueueSecondaryCommandBuffer(VkCommandBuffer cb, QVkCommandBuffer *cbD);
- void deferredReleaseSecondaryCommandBuffer(VkCommandBuffer cb);
- QRhi::FrameOpResult startPrimaryCommandBuffer(VkCommandBuffer *cb);
- QRhi::FrameOpResult endAndSubmitPrimaryCommandBuffer(VkCommandBuffer cb, VkFence cmdFence,
- VkSemaphore *waitSem, VkSemaphore *signalSem);
- void waitCommandCompletion(int frameSlot);
- VkDeviceSize subresUploadByteSize(const QRhiTextureSubresourceUploadDescription &subresDesc) const;
- using BufferImageCopyList = QVarLengthArray<VkBufferImageCopy, 16>;
- void prepareUploadSubres(QVkTexture *texD, int layer, int level,
- const QRhiTextureSubresourceUploadDescription &subresDesc,
- size_t *curOfs, void *mp,
- BufferImageCopyList *copyInfos);
- void enqueueResourceUpdates(QVkCommandBuffer *cbD, QRhiResourceUpdateBatch *resourceUpdates);
- void executeBufferHostWritesForCurrentFrame(QVkBuffer *bufD);
- void enqueueTransitionPassResources(QVkCommandBuffer *cbD);
- void recordPrimaryCommandBuffer(QVkCommandBuffer *cbD);
- void trackedRegisterBuffer(QRhiPassResourceTracker *passResTracker,
- QVkBuffer *bufD,
- int slot,
- QRhiPassResourceTracker::BufferAccess access,
- QRhiPassResourceTracker::BufferStage stage);
- void trackedRegisterTexture(QRhiPassResourceTracker *passResTracker,
- QVkTexture *texD,
- QRhiPassResourceTracker::TextureAccess access,
- QRhiPassResourceTracker::TextureStage stage);
- void recordTransitionPassResources(QVkCommandBuffer *cbD, const QRhiPassResourceTracker &tracker);
- void activateTextureRenderTarget(QVkCommandBuffer *cbD, QVkTextureRenderTarget *rtD);
- void executeDeferredReleases(bool forced = false);
- void finishActiveReadbacks(bool forced = false);
-
- void setObjectName(uint64_t object, VkDebugReportObjectTypeEXT type, const QByteArray &name, int slot = -1);
- void trackedBufferBarrier(QVkCommandBuffer *cbD, QVkBuffer *bufD, int slot,
- VkAccessFlags access, VkPipelineStageFlags stage);
- void trackedImageBarrier(QVkCommandBuffer *cbD, QVkTexture *texD,
- VkImageLayout layout, VkAccessFlags access, VkPipelineStageFlags stage);
- void subresourceBarrier(QVkCommandBuffer *cbD, VkImage image,
- VkImageLayout oldLayout, VkImageLayout newLayout,
- VkAccessFlags srcAccess, VkAccessFlags dstAccess,
- VkPipelineStageFlags srcStage, VkPipelineStageFlags dstStage,
- int startLayer, int layerCount,
- int startLevel, int levelCount);
- void updateShaderResourceBindings(QRhiShaderResourceBindings *srb, int descSetIdx = -1);
-
- QVulkanInstance *inst = nullptr;
- QWindow *maybeWindow = nullptr;
- bool importedDevice = false;
- VkPhysicalDevice physDev = VK_NULL_HANDLE;
- VkDevice dev = VK_NULL_HANDLE;
- bool importedCmdPool = false;
- VkCommandPool cmdPool = VK_NULL_HANDLE;
- int gfxQueueFamilyIdx = -1;
- VkQueue gfxQueue = VK_NULL_HANDLE;
- bool hasCompute = false;
- quint32 timestampValidBits = 0;
- bool importedAllocator = false;
- QVkAllocator allocator = nullptr;
- QVulkanFunctions *f = nullptr;
- QVulkanDeviceFunctions *df = nullptr;
- VkPhysicalDeviceFeatures physDevFeatures;
- VkPhysicalDeviceProperties physDevProperties;
- VkDeviceSize ubufAlign;
- VkDeviceSize texbufAlign;
- bool hasWideLines = false;
- bool deviceLost = false;
-
- bool debugMarkersAvailable = false;
- bool vertexAttribDivisorAvailable = false;
- PFN_vkCmdDebugMarkerBeginEXT vkCmdDebugMarkerBegin = nullptr;
- PFN_vkCmdDebugMarkerEndEXT vkCmdDebugMarkerEnd = nullptr;
- PFN_vkCmdDebugMarkerInsertEXT vkCmdDebugMarkerInsert = nullptr;
- PFN_vkDebugMarkerSetObjectNameEXT vkDebugMarkerSetObjectName = nullptr;
-
- PFN_vkCreateSwapchainKHR vkCreateSwapchainKHR = nullptr;
- PFN_vkDestroySwapchainKHR vkDestroySwapchainKHR;
- PFN_vkGetSwapchainImagesKHR vkGetSwapchainImagesKHR;
- PFN_vkAcquireNextImageKHR vkAcquireNextImageKHR;
- PFN_vkQueuePresentKHR vkQueuePresentKHR;
- PFN_vkGetPhysicalDeviceSurfaceCapabilitiesKHR vkGetPhysicalDeviceSurfaceCapabilitiesKHR = nullptr;
- PFN_vkGetPhysicalDeviceSurfaceFormatsKHR vkGetPhysicalDeviceSurfaceFormatsKHR;
- PFN_vkGetPhysicalDeviceSurfacePresentModesKHR vkGetPhysicalDeviceSurfacePresentModesKHR;
-
- VkPipelineCache pipelineCache = VK_NULL_HANDLE;
- struct DescriptorPoolData {
- DescriptorPoolData() { }
- DescriptorPoolData(VkDescriptorPool pool_)
- : pool(pool_)
- { }
- VkDescriptorPool pool = VK_NULL_HANDLE;
- int refCount = 0;
- int allocedDescSets = 0;
- };
- QVector<DescriptorPoolData> descriptorPools;
-
- VkQueryPool timestampQueryPool = VK_NULL_HANDLE;
- QBitArray timestampQueryPoolMap;
-
- VkFormat optimalDsFormat = VK_FORMAT_UNDEFINED;
- QMatrix4x4 clipCorrectMatrix;
-
- QVkSwapChain *currentSwapChain = nullptr;
- QSet<QVkSwapChain *> swapchains;
- QRhiVulkanNativeHandles nativeHandlesStruct;
-
- struct OffscreenFrame {
- OffscreenFrame(QRhiImplementation *rhi) : cbWrapper(rhi) { }
- bool active = false;
- QVkCommandBuffer cbWrapper;
- VkFence cmdFence = VK_NULL_HANDLE;
- } ofr;
-
- struct TextureReadback {
- int activeFrameSlot = -1;
- QRhiReadbackDescription desc;
- QRhiReadbackResult *result;
- VkBuffer stagingBuf;
- QVkAlloc stagingAlloc;
- quint32 byteSize;
- QSize pixelSize;
- QRhiTexture::Format format;
- };
- QVector<TextureReadback> activeTextureReadbacks;
- struct BufferReadback {
- int activeFrameSlot = -1;
- QRhiBufferReadbackResult *result;
- int byteSize;
- VkBuffer stagingBuf;
- QVkAlloc stagingAlloc;
- };
- QVector<BufferReadback> activeBufferReadbacks;
-
- struct DeferredReleaseEntry {
- enum Type {
- Pipeline,
- ShaderResourceBindings,
- Buffer,
- RenderBuffer,
- Texture,
- Sampler,
- TextureRenderTarget,
- RenderPass,
- StagingBuffer,
- CommandBuffer
- };
- Type type;
- int lastActiveFrameSlot; // -1 if not used otherwise 0..FRAMES_IN_FLIGHT-1
- union {
- struct {
- VkPipeline pipeline;
- VkPipelineLayout layout;
- } pipelineState;
- struct {
- int poolIndex;
- VkDescriptorSetLayout layout;
- } shaderResourceBindings;
- struct {
- VkBuffer buffers[QVK_FRAMES_IN_FLIGHT];
- QVkAlloc allocations[QVK_FRAMES_IN_FLIGHT];
- VkBuffer stagingBuffers[QVK_FRAMES_IN_FLIGHT];
- QVkAlloc stagingAllocations[QVK_FRAMES_IN_FLIGHT];
- } buffer;
- struct {
- VkDeviceMemory memory;
- VkImage image;
- VkImageView imageView;
- } renderBuffer;
- struct {
- VkImage image;
- VkImageView imageView;
- QVkAlloc allocation;
- VkBuffer stagingBuffers[QVK_FRAMES_IN_FLIGHT];
- QVkAlloc stagingAllocations[QVK_FRAMES_IN_FLIGHT];
- VkImageView extraImageViews[QRhi::MAX_LEVELS];
- } texture;
- struct {
- VkSampler sampler;
- } sampler;
- struct {
- VkFramebuffer fb;
- VkImageView rtv[QVkRenderTargetData::MAX_COLOR_ATTACHMENTS];
- VkImageView resrtv[QVkRenderTargetData::MAX_COLOR_ATTACHMENTS];
- } textureRenderTarget;
- struct {
- VkRenderPass rp;
- } renderPass;
- struct {
- VkBuffer stagingBuffer;
- QVkAlloc stagingAllocation;
- } stagingBuffer;
- struct {
- VkCommandBuffer cb;
- } commandBuffer;
- };
- };
- QVector<DeferredReleaseEntry> releaseQueue;
-};
-
-Q_DECLARE_TYPEINFO(QRhiVulkan::DescriptorPoolData, Q_MOVABLE_TYPE);
-Q_DECLARE_TYPEINFO(QRhiVulkan::DeferredReleaseEntry, Q_MOVABLE_TYPE);
-Q_DECLARE_TYPEINFO(QRhiVulkan::TextureReadback, Q_MOVABLE_TYPE);
-Q_DECLARE_TYPEINFO(QRhiVulkan::BufferReadback, Q_MOVABLE_TYPE);
-
-QT_END_NAMESPACE
-
-#endif
diff --git a/src/gui/rhi/qrhivulkanext_p.h b/src/gui/rhi/qrhivulkanext_p.h
deleted file mode 100644
index 67a63e07e0..0000000000
--- a/src/gui/rhi/qrhivulkanext_p.h
+++ /dev/null
@@ -1,81 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2018 The Qt Company Ltd.
-** Contact: http://www.qt.io/licensing/
-**
-** This file is part of the Qt RHI module
-**
-** $QT_BEGIN_LICENSE:LGPL3$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef QRHIVULKANEXT_P_H
-#define QRHIVULKANEXT_P_H
-
-//
-// W A R N I N G
-// -------------
-//
-// This file is not part of the Qt API. It exists purely as an
-// implementation detail. This header file may change from version to
-// version without notice, or even be removed.
-//
-// We mean it.
-//
-
-#include "qrhivulkan_p.h"
-
-QT_BEGIN_NAMESPACE
-
-#ifndef VK_EXT_vertex_attribute_divisor
-#define VK_EXT_vertex_attribute_divisor 1
-#define VK_EXT_VERTEX_ATTRIBUTE_DIVISOR_SPEC_VERSION 2
-#define VK_EXT_VERTEX_ATTRIBUTE_DIVISOR_EXTENSION_NAME "VK_EXT_vertex_attribute_divisor"
-
-typedef struct VkPhysicalDeviceVertexAttributeDivisorPropertiesEXT {
- VkStructureType sType;
- void* pNext;
- uint32_t maxVertexAttribDivisor;
-} VkPhysicalDeviceVertexAttributeDivisorPropertiesEXT;
-
-typedef struct VkVertexInputBindingDivisorDescriptionEXT {
- uint32_t binding;
- uint32_t divisor;
-} VkVertexInputBindingDivisorDescriptionEXT;
-
-typedef struct VkPipelineVertexInputDivisorStateCreateInfoEXT {
- VkStructureType sType;
- const void* pNext;
- uint32_t vertexBindingDivisorCount;
- const VkVertexInputBindingDivisorDescriptionEXT* pVertexBindingDivisors;
-} VkPipelineVertexInputDivisorStateCreateInfoEXT;
-#endif // VK_EXT_vertex_attribute_divisor
-
-QT_END_NAMESPACE
-
-#endif
diff --git a/src/gui/rhi/qshader.cpp b/src/gui/rhi/qshader.cpp
index dc6060f882..d5fb53e7e6 100644
--- a/src/gui/rhi/qshader.cpp
+++ b/src/gui/rhi/qshader.cpp
@@ -1,40 +1,7 @@
-/****************************************************************************
-**
-** Copyright (C) 2019 The Qt Company Ltd.
-** Contact: http://www.qt.io/licensing/
-**
-** This file is part of the Qt Gui module
-**
-** $QT_BEGIN_LICENSE:LGPL3$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "qshader_p_p.h"
+// Copyright (C) 2023 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
+
+#include "qshader_p.h"
#include <QDataStream>
#include <QBuffer>
@@ -42,8 +9,9 @@ QT_BEGIN_NAMESPACE
/*!
\class QShader
- \internal
+ \ingroup painting-3D
\inmodule QtGui
+ \since 6.6
\brief Contains multiple versions of a shader translated to multiple shading languages,
together with reflection metadata.
@@ -54,6 +22,16 @@ QT_BEGIN_NAMESPACE
as, Vulkan, Metal, Direct3D, and OpenGL, take QShader as their input
whenever a shader needs to be specified.
+ \warning The QRhi family of classes in the Qt Gui module, including QShader
+ and QShaderDescription, offer limited compatibility guarantees. There are
+ no source or binary compatibility guarantees for these classes, meaning the
+ API is only guaranteed to work with the Qt version the application was
+ developed against. Source incompatible changes are however aimed to be kept
+ at a minimum and will only be made in minor releases (6.7, 6.8, and so on).
+ To use these classes in an application, link to
+ \c{Qt::GuiPrivate} (if using CMake), and include the headers with the \c
+ rhi prefix, for example \c{#include <rhi/qshader.h>}.
+
A QShader instance is empty and thus invalid by default. To get a useful
instance, the two typical methods are:
@@ -101,8 +79,9 @@ QT_BEGIN_NAMESPACE
can be returned or passed by value. Detach happens implicitly when calling
a setter.
- For reference, QRhi expects that a QShader suitable for all its
- backends contains at least the following:
+ For reference, a typical, portable QRhi expects that a QShader suitable for
+ all its backends contains at least the following. (this excludes support
+ for core profile OpenGL contexts, add GLSL 150 or newer for that)
\list
@@ -110,11 +89,11 @@ QT_BEGIN_NAMESPACE
\li GLSL/ES 100 source code suitable for OpenGL ES 2.0 or newer
- \li GLSL 120 source code suitable for OpenGL 2.1
+ \li GLSL 120 source code suitable for OpenGL 2.1 or newer
- \li HLSL Shader Model 5.0 source code or the corresponding DXBC bytecode suitable for Direct3D 11
+ \li HLSL Shader Model 5.0 source code or the corresponding DXBC bytecode suitable for Direct3D 11/12
- \li Metal Shading Language 1.2 source code or the corresponding bytecode suitable for Metal
+ \li Metal Shading Language 1.2 source code or the corresponding bytecode suitable for Metal 1.2 or newer
\endlist
@@ -135,8 +114,8 @@ QT_BEGIN_NAMESPACE
/*!
\class QShaderVersion
- \internal
\inmodule QtGui
+ \since 6.6
\brief Specifies the shading language version.
@@ -161,6 +140,9 @@ QT_BEGIN_NAMESPACE
A default constructed QShaderVersion contains a version of 100 and no
flags set.
+
+ \note This is a RHI API with limited compatibility guarantees, see \l QShader
+ for details.
*/
/*!
@@ -173,13 +155,16 @@ QT_BEGIN_NAMESPACE
/*!
\class QShaderKey
- \internal
\inmodule QtGui
+ \since 6.6
\brief Specifies the shading language, the version with flags, and the variant.
A default constructed QShaderKey has source set to SpirvShader and
sourceVersion set to 100. sourceVariant defaults to StandardShader.
+
+ \note This is a RHI API with limited compatibility guarantees, see \l QShader
+ for details.
*/
/*!
@@ -193,6 +178,7 @@ QT_BEGIN_NAMESPACE
\value MslShader Metal Shading Language
\value DxilShader Direct3D bytecode (HLSL compiled by \c dxc)
\value MetalLibShader Pre-compiled Metal bytecode
+ \value WgslShader WGSL
*/
/*!
@@ -200,25 +186,74 @@ QT_BEGIN_NAMESPACE
Describes what kind of shader code an entry contains.
\value StandardShader The normal, unmodified version of the shader code.
+
\value BatchableVertexShader Vertex shader rewritten to be suitable for Qt Quick scenegraph batching.
+
+ \value UInt16IndexedVertexAsComputeShader A vertex shader meant to be used
+ in a Metal pipeline with tessellation in combination with indexed draw
+ calls sourcing index data from a uint16 index buffer. To support the Metal
+ tessellation pipeline, the vertex shader is translated to a compute shader
+ that may be dependent on the index buffer usage in the draw calls (e.g. if
+ the shader is using gl_VertexIndex), hence the need for three dedicated
+ variants.
+
+ \value UInt32IndexedVertexAsComputeShader A vertex shader meant to be used
+ in a Metal pipeline with tessellation in combination with indexed draw
+ calls sourcing index data from a uint32 index buffer. To support the Metal
+ tessellation pipeline, the vertex shader is translated to a compute shader
+ that may be dependent on the index buffer usage in the draw calls (e.g. if
+ the shader is using gl_VertexIndex), hence the need for three dedicated
+ variants.
+
+ \value NonIndexedVertexAsComputeShader A vertex shader meant to be used in
+ a Metal pipeline with tessellation in combination with non-indexed draw
+ calls. To support the Metal tessellation pipeline, the vertex shader is
+ translated to a compute shader that may be dependent on the index buffer
+ usage in the draw calls (e.g. if the shader is using gl_VertexIndex), hence
+ the need for three dedicated variants.
+ */
+
+/*!
+ \enum QShader::SerializedFormatVersion
+ Describes the desired output format when serializing the QShader.
+
+ The default value for the \c version argument of serialized() is \c Latest.
+ This is sufficient in the vast majority of cases. Specifying another value
+ is needed only when the intention is to generate serialized data that can
+ be loaded by earlier Qt versions. For example, the \c qsb tool uses these
+ enum values when the \c{--qsbversion} command-line argument is given.
+
+ \note Targeting earlier versions will make certain features disfunctional
+ with the generated asset. This is not an issue when using the asset with
+ the specified, older Qt version, given that that Qt version does not have
+ the newer features in newer Qt versions that rely on additional data
+ generated in the QShader and the serialized data stream, but may become a
+ problem if the generated asset is then used with a newer Qt version.
+
+ \value Latest The current Qt version
+ \value Qt_6_5 Qt 6.5
+ \value Qt_6_4 Qt 6.4
*/
/*!
\class QShaderCode
- \internal
\inmodule QtGui
+ \since 6.6
\brief Contains source or binary code for a shader and additional metadata.
When shader() is empty after retrieving a QShaderCode instance from
QShader, it indicates no shader code was found for the requested key.
+
+ \note This is a RHI API with limited compatibility guarantees, see \l QShader
+ for details.
*/
/*!
Constructs a new, empty (and thus invalid) QShader instance.
*/
QShader::QShader()
- : d(new QShaderPrivate)
+ : d(nullptr)
{
}
@@ -227,42 +262,87 @@ QShader::QShader()
*/
void QShader::detach()
{
- qAtomicDetach(d);
+ if (d)
+ qAtomicDetach(d);
+ else
+ d = new QShaderPrivate;
}
/*!
- \internal
+ Constructs a copy of \a other.
*/
QShader::QShader(const QShader &other)
: d(other.d)
{
- d->ref.ref();
+ if (d)
+ d->ref.ref();
}
/*!
- \internal
+ Assigns \a other to this object.
*/
QShader &QShader::operator=(const QShader &other)
{
- qAtomicAssign(d, other.d);
+ if (d) {
+ if (other.d) {
+ qAtomicAssign(d, other.d);
+ } else {
+ if (!d->ref.deref())
+ delete d;
+ d = nullptr;
+ }
+ } else if (other.d) {
+ other.d->ref.ref();
+ d = other.d;
+ }
return *this;
}
/*!
+ \fn QShader::QShader(QShader &&other) noexcept
+ \since 6.7
+
+ Move-constructs a new QShader from \a other.
+
+ \note The moved-from object \a other is placed in a
+ partially-formed state, in which the only valid operations are
+ destruction and assignment of a new value.
+*/
+
+/*!
+ \fn QShader &QShader::operator=(QShader &&other)
+ \since 6.7
+
+ Move-assigns \a other to this QShader instance.
+
+ \note The moved-from object \a other is placed in a
+ partially-formed state, in which the only valid operations are
+ destruction and assignment of a new value.
+*/
+
+/*!
Destructor.
*/
QShader::~QShader()
{
- if (!d->ref.deref())
+ if (d && !d->ref.deref())
delete d;
}
/*!
+ \fn void QShader::swap(QShader &other)
+ \since 6.7
+
+ Swaps shader \a other with this shader. This operation is very fast and
+ never fails.
+*/
+
+/*!
\return true if the QShader contains at least one shader version.
*/
bool QShader::isValid() const
{
- return !d->shaders.isEmpty();
+ return d ? !d->shaders.isEmpty() : false;
}
/*!
@@ -270,7 +350,7 @@ bool QShader::isValid() const
*/
QShader::Stage QShader::stage() const
{
- return d->stage;
+ return d ? d->stage : QShader::VertexStage;
}
/*!
@@ -278,7 +358,7 @@ QShader::Stage QShader::stage() const
*/
void QShader::setStage(Stage stage)
{
- if (stage != d->stage) {
+ if (!d || stage != d->stage) {
detach();
d->stage = stage;
}
@@ -289,7 +369,7 @@ void QShader::setStage(Stage stage)
*/
QShaderDescription QShader::description() const
{
- return d->desc;
+ return d ? d->desc : QShaderDescription();
}
/*!
@@ -304,9 +384,9 @@ void QShader::setDescription(const QShaderDescription &desc)
/*!
\return the list of available shader versions
*/
-QVector<QShaderKey> QShader::availableShaders() const
+QList<QShaderKey> QShader::availableShaders() const
{
- return d->shaders.keys().toVector();
+ return d ? d->shaders.keys().toVector() : QList<QShaderKey>();
}
/*!
@@ -314,7 +394,7 @@ QVector<QShaderKey> QShader::availableShaders() const
*/
QShaderCode QShader::shader(const QShaderKey &key) const
{
- return d->shaders.value(key);
+ return d ? d->shaders.value(key) : QShaderCode();
}
/*!
@@ -322,7 +402,7 @@ QShaderCode QShader::shader(const QShaderKey &key) const
*/
void QShader::setShader(const QShaderKey &key, const QShaderCode &shader)
{
- if (d->shaders.value(key) == shader)
+ if (d && d->shaders.value(key) == shader)
return;
detach();
@@ -335,6 +415,9 @@ void QShader::setShader(const QShaderKey &key, const QShaderCode &shader)
*/
void QShader::removeShader(const QShaderKey &key)
{
+ if (!d)
+ return;
+
auto it = d->shaders.find(key);
if (it == d->shaders.end())
return;
@@ -355,39 +438,78 @@ static void writeShaderKey(QDataStream *ds, const QShaderKey &k)
\return a serialized binary version of all the data held by the
QShader, suitable for writing to files or other I/O devices.
+ By default the latest serialization format is used. Use \a version
+ parameter to serialize for a compatibility Qt version. Only when it is
+ known that the generated data stream must be made compatible with an older
+ Qt version at the expense of making it incompatible with features
+ introduced since that Qt version, should another value (for example,
+ \l{SerializedFormatVersion}{Qt_6_5} for Qt 6.5) be used.
+
\sa fromSerialized()
*/
-QByteArray QShader::serialized() const
+QByteArray QShader::serialized(SerializedFormatVersion version) const
{
+ static QShaderPrivate sd;
+ QShaderPrivate *dd = d ? d : &sd;
+
QBuffer buf;
QDataStream ds(&buf);
ds.setVersion(QDataStream::Qt_5_10);
if (!buf.open(QIODevice::WriteOnly))
return QByteArray();
- ds << QShaderPrivate::QSB_VERSION;
- ds << int(d->stage);
- ds << d->desc.toCbor();
- ds << d->shaders.count();
- for (auto it = d->shaders.cbegin(), itEnd = d->shaders.cend(); it != itEnd; ++it) {
+ const int qsbVersion = QShaderPrivate::qtQsbVersion(version);
+ ds << qsbVersion;
+
+ ds << int(dd->stage);
+ dd->desc.serialize(&ds, qsbVersion);
+ ds << int(dd->shaders.size());
+ for (auto it = dd->shaders.cbegin(), itEnd = dd->shaders.cend(); it != itEnd; ++it) {
const QShaderKey &k(it.key());
writeShaderKey(&ds, k);
- const QShaderCode &shader(d->shaders.value(k));
+ const QShaderCode &shader(dd->shaders.value(k));
ds << shader.shader();
ds << shader.entryPoint();
}
- ds << d->bindings.count();
- for (auto it = d->bindings.cbegin(), itEnd = d->bindings.cend(); it != itEnd; ++it) {
+ ds << int(dd->bindings.size());
+ for (auto it = dd->bindings.cbegin(), itEnd = dd->bindings.cend(); it != itEnd; ++it) {
const QShaderKey &k(it.key());
writeShaderKey(&ds, k);
const NativeResourceBindingMap &map(it.value());
- ds << map.count();
+ ds << int(map.size());
for (auto mapIt = map.cbegin(), mapItEnd = map.cend(); mapIt != mapItEnd; ++mapIt) {
ds << mapIt.key();
ds << mapIt.value().first;
ds << mapIt.value().second;
}
}
+ ds << int(dd->combinedImageMap.size());
+ for (auto it = dd->combinedImageMap.cbegin(), itEnd = dd->combinedImageMap.cend(); it != itEnd; ++it) {
+ const QShaderKey &k(it.key());
+ writeShaderKey(&ds, k);
+ const SeparateToCombinedImageSamplerMappingList &list(it.value());
+ ds << int(list.size());
+ for (auto listIt = list.cbegin(), listItEnd = list.cend(); listIt != listItEnd; ++listIt) {
+ ds << listIt->combinedSamplerName;
+ ds << listIt->textureBinding;
+ ds << listIt->samplerBinding;
+ }
+ }
+ if (qsbVersion > QShaderPrivate::QSB_VERSION_WITHOUT_NATIVE_SHADER_INFO) {
+ ds << int(dd->nativeShaderInfoMap.size());
+ for (auto it = dd->nativeShaderInfoMap.cbegin(), itEnd = dd->nativeShaderInfoMap.cend(); it != itEnd; ++it) {
+ const QShaderKey &k(it.key());
+ writeShaderKey(&ds, k);
+ ds << it->flags;
+ ds << int(it->extraBufferBindings.size());
+ for (auto mapIt = it->extraBufferBindings.cbegin(), mapItEnd = it->extraBufferBindings.cend();
+ mapIt != mapItEnd; ++mapIt)
+ {
+ ds << mapIt.key();
+ ds << mapIt.value();
+ }
+ }
+ }
return qCompress(buf.buffer());
}
@@ -410,6 +532,9 @@ static void readShaderKey(QDataStream *ds, QShaderKey *k)
/*!
Creates a new QShader instance from the given \a data.
+ If \a data cannot be deserialized successfully, the result is a default
+ constructed QShader for which isValid() returns \c false.
+
\sa serialized()
*/
QShader QShader::fromSerialized(const QByteArray &data)
@@ -422,12 +547,19 @@ QShader QShader::fromSerialized(const QByteArray &data)
return QShader();
QShader bs;
+ bs.detach(); // to get d created
QShaderPrivate *d = QShaderPrivate::get(&bs);
Q_ASSERT(d->ref.loadRelaxed() == 1); // must be detached
int intVal;
ds >> intVal;
d->qsbVersion = intVal;
if (d->qsbVersion != QShaderPrivate::QSB_VERSION
+ && d->qsbVersion != QShaderPrivate::QSB_VERSION_WITHOUT_INPUT_OUTPUT_INTERFACE_BLOCKS
+ && d->qsbVersion != QShaderPrivate::QSB_VERSION_WITHOUT_EXTENDED_STORAGE_BUFFER_INFO
+ && d->qsbVersion != QShaderPrivate::QSB_VERSION_WITHOUT_NATIVE_SHADER_INFO
+ && d->qsbVersion != QShaderPrivate::QSB_VERSION_WITHOUT_SEPARATE_IMAGES_AND_SAMPLERS
+ && d->qsbVersion != QShaderPrivate::QSB_VERSION_WITHOUT_VAR_ARRAYDIMS
+ && d->qsbVersion != QShaderPrivate::QSB_VERSION_WITH_CBOR
&& d->qsbVersion != QShaderPrivate::QSB_VERSION_WITH_BINARY_JSON
&& d->qsbVersion != QShaderPrivate::QSB_VERSION_WITHOUT_BINDINGS)
{
@@ -437,12 +569,15 @@ QShader QShader::fromSerialized(const QByteArray &data)
ds >> intVal;
d->stage = Stage(intVal);
- QByteArray descBin;
- ds >> descBin;
- if (d->qsbVersion > QShaderPrivate::QSB_VERSION_WITH_BINARY_JSON)
- d->desc = QShaderDescription::fromCbor(descBin);
- else
- d->desc = QShaderDescription::fromBinaryJson(descBin);
+ if (d->qsbVersion > QShaderPrivate::QSB_VERSION_WITH_CBOR) {
+ d->desc = QShaderDescription::deserialize(&ds, d->qsbVersion);
+ } else if (d->qsbVersion > QShaderPrivate::QSB_VERSION_WITH_BINARY_JSON) {
+ qWarning("Can no longer load QShaderDescription from CBOR.");
+ d->desc = QShaderDescription();
+ } else {
+ qWarning("Can no longer load QShaderDescription from binary JSON.");
+ d->desc = QShaderDescription();
+ }
int count;
ds >> count;
for (int i = 0; i < count; ++i) {
@@ -478,19 +613,123 @@ QShader QShader::fromSerialized(const QByteArray &data)
}
}
+ if (d->qsbVersion > QShaderPrivate::QSB_VERSION_WITHOUT_SEPARATE_IMAGES_AND_SAMPLERS) {
+ ds >> count;
+ for (int i = 0; i < count; ++i) {
+ QShaderKey k;
+ readShaderKey(&ds, &k);
+ SeparateToCombinedImageSamplerMappingList list;
+ int listSize;
+ ds >> listSize;
+ for (int b = 0; b < listSize; ++b) {
+ QByteArray combinedSamplerName;
+ ds >> combinedSamplerName;
+ int textureBinding;
+ ds >> textureBinding;
+ int samplerBinding;
+ ds >> samplerBinding;
+ list.append({ combinedSamplerName, textureBinding, samplerBinding });
+ }
+ d->combinedImageMap.insert(k, list);
+ }
+ }
+
+ if (d->qsbVersion > QShaderPrivate::QSB_VERSION_WITHOUT_NATIVE_SHADER_INFO) {
+ ds >> count;
+ for (int i = 0; i < count; ++i) {
+ QShaderKey k;
+ readShaderKey(&ds, &k);
+ int flags;
+ ds >> flags;
+ QMap<int, int> extraBufferBindings;
+ int mapSize;
+ ds >> mapSize;
+ for (int b = 0; b < mapSize; ++b) {
+ int k, v;
+ ds >> k;
+ ds >> v;
+ extraBufferBindings.insert(k, v);
+ }
+ d->nativeShaderInfoMap.insert(k, { flags, extraBufferBindings });
+ }
+ }
+
return bs;
}
+/*!
+ \fn QShaderVersion::QShaderVersion() = default
+ */
+
+/*!
+ Constructs a new QShaderVersion with version \a v and flags \a f.
+ */
QShaderVersion::QShaderVersion(int v, Flags f)
: m_version(v), m_flags(f)
{
}
+/*!
+ \fn int QShaderVersion::version() const
+ \return the version.
+ */
+
+/*!
+ \fn void QShaderVersion::setVersion(int v)
+ Sets the shading language version to \a v.
+ */
+
+/*!
+ \fn QShaderVersion::Flags QShaderVersion::flags() const
+ \return the flags.
+ */
+
+/*!
+ \fn void QShaderVersion::setFlags(Flags f)
+ Sets the flags \a f.
+ */
+
+/*!
+ \fn QShaderCode::QShaderCode() = default
+ */
+
+/*!
+ Constructs a new QShaderCode with the specified shader source \a code and
+ \a entry point name.
+ */
QShaderCode::QShaderCode(const QByteArray &code, const QByteArray &entry)
: m_shader(code), m_entryPoint(entry)
{
}
+/*!
+ \fn QByteArray QShaderCode::shader() const
+ \return the shader source or bytecode.
+ */
+
+/*!
+ \fn void QShaderCode::setShader(const QByteArray &code)
+ Sets the shader source or byte \a code.
+ */
+
+/*!
+ \fn QByteArray QShaderCode::entryPoint() const
+ \return the entry point name.
+ */
+
+/*!
+ \fn void QShaderCode::setEntryPoint(const QByteArray &entry)
+ Sets the \a entry point name.
+ */
+
+/*!
+ \fn QShaderKey::QShaderKey() = default
+ */
+
+/*!
+ Constructs a new QShaderKey with shader type \a s, version \a sver, and
+ variant \a svar.
+ */
QShaderKey::QShaderKey(QShader::Source s,
const QShaderVersion &sver,
QShader::Variant svar)
@@ -501,23 +740,56 @@ QShaderKey::QShaderKey(QShader::Source s,
}
/*!
+ \fn QShader::Source QShaderKey::source() const
+ \return the shader type.
+ */
+
+/*!
+ \fn void QShaderKey::setSource(QShader::Source s)
+ Sets the shader type \a s.
+ */
+
+/*!
+ \fn QShaderVersion QShaderKey::sourceVersion() const
+ \return the shading language version.
+ */
+
+/*!
+ \fn void QShaderKey::setSourceVersion(const QShaderVersion &sver)
+ Sets the shading language version \a sver.
+ */
+
+/*!
+ \fn QShader::Variant QShaderKey::sourceVariant() const
+ \return the type of the variant to use.
+ */
+
+/*!
+ \fn void QShaderKey::setSourceVariant(QShader::Variant svar)
+ Sets the type of variant to use to \a svar.
+ */
+
+/*!
Returns \c true if the two QShader objects \a lhs and \a rhs are equal,
meaning they are for the same stage with matching sets of shader source or
binary code.
\relates QShader
*/
-bool operator==(const QShader &lhs, const QShader &rhs) Q_DECL_NOTHROW
+bool operator==(const QShader &lhs, const QShader &rhs) noexcept
{
+ if (!lhs.d || !rhs.d)
+ return lhs.d == rhs.d;
+
return lhs.d->stage == rhs.d->stage
- && lhs.d->shaders == rhs.d->shaders;
- // do not bother with desc and bindings, if the shader code is the same, the description must match too
+ && lhs.d->shaders == rhs.d->shaders
+ && lhs.d->bindings == rhs.d->bindings;
}
/*!
\fn bool operator!=(const QShader &lhs, const QShader &rhs)
- Returns \c false if the values in the two QShader objects \a a and \a b
+ Returns \c false if the values in the two QShader objects \a lhs and \a rhs
are equal; otherwise returns \c true.
\relates QShader
@@ -528,12 +800,17 @@ bool operator==(const QShader &lhs, const QShader &rhs) Q_DECL_NOTHROW
\relates QShader
*/
-uint qHash(const QShader &s, uint seed) Q_DECL_NOTHROW
+size_t qHash(const QShader &s, size_t seed) noexcept
{
- uint h = s.stage();
- for (auto it = s.d->shaders.constBegin(), itEnd = s.d->shaders.constEnd(); it != itEnd; ++it)
- h += qHash(it.key(), seed) + qHash(it.value().shader(), seed);
- return h;
+ if (s.d) {
+ QtPrivate::QHashCombine hash;
+ seed = hash(seed, s.stage());
+ if (!s.d->shaders.isEmpty()) {
+ seed = hash(seed, s.d->shaders.firstKey());
+ seed = hash(seed, std::as_const(s.d->shaders).first());
+ }
+ }
+ return seed;
}
/*!
@@ -542,16 +819,41 @@ uint qHash(const QShader &s, uint seed) Q_DECL_NOTHROW
\relates QShaderVersion
*/
-bool operator==(const QShaderVersion &lhs, const QShaderVersion &rhs) Q_DECL_NOTHROW
+bool operator==(const QShaderVersion &lhs, const QShaderVersion &rhs) noexcept
{
return lhs.version() == rhs.version() && lhs.flags() == rhs.flags();
}
+#ifdef Q_OS_INTEGRITY
+size_t qHash(const QShaderVersion &s, size_t seed) noexcept
+{
+ return qHashMulti(seed, s.version(), s.flags());
+}
+#endif
+
+/*!
+ \return true if \a lhs is smaller than \a rhs.
+
+ Establishes a sorting order between the two QShaderVersion \a lhs and \a rhs.
+
+ \relates QShaderVersion
+ */
+bool operator<(const QShaderVersion &lhs, const QShaderVersion &rhs) noexcept
+{
+ if (lhs.version() < rhs.version())
+ return true;
+
+ if (lhs.version() == rhs.version())
+ return int(lhs.flags()) < int(rhs.flags());
+
+ return false;
+}
+
/*!
\fn bool operator!=(const QShaderVersion &lhs, const QShaderVersion &rhs)
- Returns \c false if the values in the two QShaderVersion objects \a a
- and \a b are equal; otherwise returns \c true.
+ Returns \c false if the values in the two QShaderVersion objects \a lhs
+ and \a rhs are equal; otherwise returns \c true.
\relates QShaderVersion
*/
@@ -561,17 +863,41 @@ bool operator==(const QShaderVersion &lhs, const QShaderVersion &rhs) Q_DECL_NOT
\relates QShaderKey
*/
-bool operator==(const QShaderKey &lhs, const QShaderKey &rhs) Q_DECL_NOTHROW
+bool operator==(const QShaderKey &lhs, const QShaderKey &rhs) noexcept
{
return lhs.source() == rhs.source() && lhs.sourceVersion() == rhs.sourceVersion()
&& lhs.sourceVariant() == rhs.sourceVariant();
}
/*!
+ \return true if \a lhs is smaller than \a rhs.
+
+ Establishes a sorting order between the two keys \a lhs and \a rhs.
+
+ \relates QShaderKey
+ */
+bool operator<(const QShaderKey &lhs, const QShaderKey &rhs) noexcept
+{
+ if (int(lhs.source()) < int(rhs.source()))
+ return true;
+
+ if (int(lhs.source()) == int(rhs.source())) {
+ if (lhs.sourceVersion() < rhs.sourceVersion())
+ return true;
+ if (lhs.sourceVersion() == rhs.sourceVersion()) {
+ if (int(lhs.sourceVariant()) < int(rhs.sourceVariant()))
+ return true;
+ }
+ }
+
+ return false;
+}
+
+/*!
\fn bool operator!=(const QShaderKey &lhs, const QShaderKey &rhs)
- Returns \c false if the values in the two QShaderKey objects \a a
- and \a b are equal; otherwise returns \c true.
+ Returns \c false if the values in the two QShaderKey objects \a lhs
+ and \a rhs are equal; otherwise returns \c true.
\relates QShaderKey
*/
@@ -581,9 +907,13 @@ bool operator==(const QShaderKey &lhs, const QShaderKey &rhs) Q_DECL_NOTHROW
\relates QShaderKey
*/
-uint qHash(const QShaderKey &k, uint seed) Q_DECL_NOTHROW
+size_t qHash(const QShaderKey &k, size_t seed) noexcept
{
- return seed + 10 * k.source() + k.sourceVersion().version() + k.sourceVersion().flags() + k.sourceVariant();
+ return qHashMulti(seed,
+ k.source(),
+ k.sourceVersion().version(),
+ k.sourceVersion().flags(),
+ k.sourceVariant());
}
/*!
@@ -591,7 +921,7 @@ uint qHash(const QShaderKey &k, uint seed) Q_DECL_NOTHROW
\relates QShaderCode
*/
-bool operator==(const QShaderCode &lhs, const QShaderCode &rhs) Q_DECL_NOTHROW
+bool operator==(const QShaderCode &lhs, const QShaderCode &rhs) noexcept
{
return lhs.shader() == rhs.shader() && lhs.entryPoint() == rhs.entryPoint();
}
@@ -599,23 +929,37 @@ bool operator==(const QShaderCode &lhs, const QShaderCode &rhs) Q_DECL_NOTHROW
/*!
\fn bool operator!=(const QShaderCode &lhs, const QShaderCode &rhs)
- Returns \c false if the values in the two QShaderCode objects \a a
- and \a b are equal; otherwise returns \c true.
+ Returns \c false if the values in the two QShaderCode objects \a lhs
+ and \a rhs are equal; otherwise returns \c true.
\relates QShaderCode
*/
+/*!
+ Returns the hash value for \a k, using \a seed to seed the calculation.
+
+ \relates QShaderCode
+ */
+size_t qHash(const QShaderCode &k, size_t seed) noexcept
+{
+ return qHash(k.shader(), seed);
+}
+
#ifndef QT_NO_DEBUG_STREAM
QDebug operator<<(QDebug dbg, const QShader &bs)
{
const QShaderPrivate *d = bs.d;
QDebugStateSaver saver(dbg);
- dbg.nospace() << "QShader("
- << "stage=" << d->stage
- << " shaders=" << d->shaders.keys()
- << " desc.isValid=" << d->desc.isValid()
- << ')';
+ if (d) {
+ dbg.nospace() << "QShader("
+ << "stage=" << d->stage
+ << " shaders=" << d->shaders.keys()
+ << " desc.isValid=" << d->desc.isValid()
+ << ')';
+ } else {
+ dbg.nospace() << "QShader()";
+ }
return dbg;
}
@@ -640,7 +984,7 @@ QDebug operator<<(QDebug dbg, const QShaderVersion &v)
/*!
\typedef QShader::NativeResourceBindingMap
- Synonym for QHash<int, QPair<int, int>>.
+ Synonym for QMap<int, QPair<int, int>>.
The resource binding model QRhi assumes is based on SPIR-V. This means that
uniform buffers, storage buffers, combined image samplers, and storage
@@ -649,30 +993,44 @@ QDebug operator<<(QDebug dbg, const QShaderVersion &v)
\c binding layout qualifier in the Vulkan-compatible GLSL shader.
Graphics APIs other than Vulkan may use a resource binding model that is
- not fully compatible with this. In addition, the generator of the shader
- code translated from SPIR-V may choose not to take the SPIR-V binding
- qualifiers into account, for various reasons. (this is the case with the
- Metal backend of SPIRV-Cross, for example).
+ not fully compatible with this. The generator of the shader code translated
+ from SPIR-V may choose not to take the SPIR-V binding qualifiers into
+ account, for various reasons. This is the case with the Metal backend of
+ SPIRV-Cross, for example. In addition, even when an automatic, implicit
+ translation is mostly possible (e.g. by using SPIR-V binding points as HLSL
+ resource register indices), assigning resource bindings without being
+ constrained by the SPIR-V binding points can lead to better results.
Therefore, a QShader may expose an additional map that describes what the
- native binding point for a given SPIR-V binding is. The QRhi backends are
- expected to use this map automatically, as appropriate. The value is a
- pair, because combined image samplers may map to two native resources (a
- texture and a sampler) in some shading languages. In that case the second
- value refers to the sampler.
+ native binding point for a given SPIR-V binding is. The QRhi backends, for
+ which this is relevant, are expected to use this map automatically, as
+ appropriate. The value is a pair, because combined image samplers may map
+ to two native resources (a texture and a sampler) in some shading
+ languages. In that case the second value refers to the sampler.
+
+ \note The native binding may be -1, in case there is no active binding for
+ the resource in the shader. (for example, there is a uniform block
+ declared, but it is not used in the shader code) The map is always
+ complete, meaning there is an entry for all declared uniform blocks,
+ storage blocks, image objects, and combined samplers, but the value will be
+ -1 for those that are not actually referenced in the shader functions.
*/
/*!
- \return the native binding map for \a key or null if no extra mapping is
- available, or is not applicable.
+ \return the native binding map for \a key. The map is empty if no mapping
+ is available for \a key (for example, because the map is not applicable for
+ the API and shading language described by \a key).
*/
-const QShader::NativeResourceBindingMap *QShader::nativeResourceBindingMap(const QShaderKey &key) const
+QShader::NativeResourceBindingMap QShader::nativeResourceBindingMap(const QShaderKey &key) const
{
+ if (!d)
+ return {};
+
auto it = d->bindings.constFind(key);
if (it == d->bindings.cend())
- return nullptr;
+ return {};
- return &it.value();
+ return it.value();
}
/*!
@@ -691,6 +1049,9 @@ void QShader::setResourceBindingMap(const QShaderKey &key, const NativeResourceB
*/
void QShader::removeResourceBindingMap(const QShaderKey &key)
{
+ if (!d)
+ return;
+
auto it = d->bindings.find(key);
if (it == d->bindings.end())
return;
@@ -699,4 +1060,162 @@ void QShader::removeResourceBindingMap(const QShaderKey &key)
d->bindings.erase(it);
}
+/*!
+ \typedef QShader::SeparateToCombinedImageSamplerMappingList
+
+ Synonym for QList<QShader::SeparateToCombinedImageSamplerMapping>.
+ */
+
+/*!
+ \struct QShader::SeparateToCombinedImageSamplerMapping
+ \inmodule QtGui
+ \brief Mapping metadata for sampler uniforms.
+
+ Describes a mapping from a traditional combined image sampler uniform to
+ binding points for a separate texture and sampler.
+
+ For example, if \c combinedImageSampler is \c{"_54"}, \c textureBinding is
+ \c 1, and \c samplerBinding is \c 2, this means that the GLSL shader code
+ contains a \c sampler2D (or sampler3D, etc.) uniform with the name of
+ \c{_54} which corresponds to two separate resource bindings (\c 1 and \c 2)
+ in the original shader.
+
+ \note This is a RHI API with limited compatibility guarantees, see \l QShader
+ for details.
+ */
+
+/*!
+ \variable QShader::SeparateToCombinedImageSamplerMapping::combinedSamplerName
+*/
+
+/*!
+ \variable QShader::SeparateToCombinedImageSamplerMapping::textureBinding
+*/
+
+/*!
+ \variable QShader::SeparateToCombinedImageSamplerMapping::samplerBinding
+*/
+
+/*!
+ \return the combined image sampler mapping list for \a key, or an empty
+ list if there is no data available for \a key, for example because such a
+ mapping is not applicable for the shading language.
+ */
+QShader::SeparateToCombinedImageSamplerMappingList QShader::separateToCombinedImageSamplerMappingList(const QShaderKey &key) const
+{
+ if (!d)
+ return {};
+
+ auto it = d->combinedImageMap.constFind(key);
+ if (it == d->combinedImageMap.cend())
+ return {};
+
+ return it.value();
+}
+
+/*!
+ Stores the given combined image sampler mapping \a list associated with \a key.
+
+ \sa separateToCombinedImageSamplerMappingList()
+ */
+void QShader::setSeparateToCombinedImageSamplerMappingList(const QShaderKey &key,
+ const SeparateToCombinedImageSamplerMappingList &list)
+{
+ detach();
+ d->combinedImageMap[key] = list;
+}
+
+/*!
+ Removes the combined image sampler mapping list for \a key.
+ */
+void QShader::removeSeparateToCombinedImageSamplerMappingList(const QShaderKey &key)
+{
+ if (!d)
+ return;
+
+ auto it = d->combinedImageMap.find(key);
+ if (it == d->combinedImageMap.end())
+ return;
+
+ detach();
+ d->combinedImageMap.erase(it);
+}
+
+/*!
+ \struct QShader::NativeShaderInfo
+ \inmodule QtGui
+ \brief Additional metadata about the native shader code.
+
+ Describes information about the native shader code, if applicable. This
+ becomes relevant with certain shader languages for certain shader stages,
+ in case the translation from SPIR-V involves the introduction of
+ additional, "magic" inputs, outputs, or resources in the generated shader.
+ Such additions may be dependent on the original source code (i.e. the usage
+ of various GLSL language constructs or built-ins), and therefore it needs
+ to be indicated in a dynamic manner if certain features got added to the
+ generated shader code.
+
+ As an example, consider a tessellation control shader with a per-patch (not
+ per-vertex) output variable. This is translated to a Metal compute shader
+ outputting (among others) into an spvPatchOut buffer. But this buffer would
+ not be present at all if per-patch output variables were not used. The fact
+ that the shader code relies on such a buffer present can be indicated by
+ the data in this struct.
+
+ \note This is a RHI API with limited compatibility guarantees, see \l QShader
+ for details.
+ */
+
+/*!
+ \variable QShader::NativeShaderInfo::flags
+*/
+
+/*!
+ \variable QShader::NativeShaderInfo::extraBufferBindings
+*/
+
+/*!
+ \return the native shader info struct for \a key, or an empty object if
+ there is no data available for \a key, for example because such a mapping
+ is not applicable for the shading language or the shader stage.
+ */
+QShader::NativeShaderInfo QShader::nativeShaderInfo(const QShaderKey &key) const
+{
+ if (!d)
+ return {};
+
+ auto it = d->nativeShaderInfoMap.constFind(key);
+ if (it == d->nativeShaderInfoMap.cend())
+ return {};
+
+ return it.value();
+}
+
+/*!
+ Stores the given native shader \a info associated with \a key.
+
+ \sa nativeShaderInfo()
+ */
+void QShader::setNativeShaderInfo(const QShaderKey &key, const NativeShaderInfo &info)
+{
+ detach();
+ d->nativeShaderInfoMap[key] = info;
+}
+
+/*!
+ Removes the native shader information for \a key.
+ */
+void QShader::removeNativeShaderInfo(const QShaderKey &key)
+{
+ if (!d)
+ return;
+
+ auto it = d->nativeShaderInfoMap.find(key);
+ if (it == d->nativeShaderInfoMap.end())
+ return;
+
+ detach();
+ d->nativeShaderInfoMap.erase(it);
+}
+
QT_END_NAMESPACE
diff --git a/src/gui/rhi/qshader.h b/src/gui/rhi/qshader.h
new file mode 100644
index 0000000000..2465081366
--- /dev/null
+++ b/src/gui/rhi/qshader.h
@@ -0,0 +1,241 @@
+// Copyright (C) 2023 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
+
+#ifndef QSHADER_H
+#define QSHADER_H
+
+//
+// W A R N I N G
+// -------------
+//
+// This file is part of the RHI API, with limited compatibility guarantees.
+// Usage of this API may make your code source and binary incompatible with
+// future versions of Qt.
+//
+
+#include <QtGui/qtguiglobal.h>
+#include <QtCore/qhash.h>
+#include <QtCore/qmap.h>
+#include <rhi/qshaderdescription.h>
+
+QT_BEGIN_NAMESPACE
+
+struct QShaderPrivate;
+class QShaderKey;
+
+#ifdef Q_OS_INTEGRITY
+ class QShaderVersion;
+ size_t qHash(const QShaderVersion &, size_t = 0) noexcept;
+#endif
+
+class Q_GUI_EXPORT QShaderVersion
+{
+public:
+ enum Flag {
+ GlslEs = 0x01
+ };
+ Q_DECLARE_FLAGS(Flags, Flag)
+
+ QShaderVersion() = default;
+ QShaderVersion(int v, Flags f = Flags());
+
+ int version() const { return m_version; }
+ void setVersion(int v) { m_version = v; }
+
+ Flags flags() const { return m_flags; }
+ void setFlags(Flags f) { m_flags = f; }
+
+private:
+ int m_version = 100;
+ Flags m_flags;
+};
+
+Q_DECLARE_OPERATORS_FOR_FLAGS(QShaderVersion::Flags)
+Q_DECLARE_TYPEINFO(QShaderVersion, Q_RELOCATABLE_TYPE);
+
+class QShaderCode;
+Q_GUI_EXPORT size_t qHash(const QShaderCode &, size_t = 0) noexcept;
+
+class Q_GUI_EXPORT QShaderCode
+{
+public:
+ QShaderCode() = default;
+ QShaderCode(const QByteArray &code, const QByteArray &entry = QByteArray());
+
+ QByteArray shader() const { return m_shader; }
+ void setShader(const QByteArray &code) { m_shader = code; }
+
+ QByteArray entryPoint() const { return m_entryPoint; }
+ void setEntryPoint(const QByteArray &entry) { m_entryPoint = entry; }
+
+private:
+ friend Q_GUI_EXPORT size_t qHash(const QShaderCode &, size_t) noexcept;
+
+ QByteArray m_shader;
+ QByteArray m_entryPoint;
+};
+
+Q_DECLARE_TYPEINFO(QShaderCode, Q_RELOCATABLE_TYPE);
+
+class Q_GUI_EXPORT QShader
+{
+public:
+ enum Stage {
+ VertexStage = 0,
+ TessellationControlStage,
+ TessellationEvaluationStage,
+ GeometryStage,
+ FragmentStage,
+ ComputeStage
+ };
+
+ enum Source {
+ SpirvShader = 0,
+ GlslShader,
+ HlslShader,
+ DxbcShader, // fxc
+ MslShader,
+ DxilShader, // dxc
+ MetalLibShader, // xcrun metal + xcrun metallib
+ WgslShader
+ };
+
+ enum Variant {
+ StandardShader = 0,
+ BatchableVertexShader,
+ UInt16IndexedVertexAsComputeShader,
+ UInt32IndexedVertexAsComputeShader,
+ NonIndexedVertexAsComputeShader
+ };
+
+ enum class SerializedFormatVersion {
+ Latest = 0,
+ Qt_6_5,
+ Qt_6_4
+ };
+
+ QShader();
+ QShader(const QShader &other);
+ QShader &operator=(const QShader &other);
+ QShader(QShader &&other) noexcept : d(std::exchange(other.d, nullptr)) {}
+ QT_MOVE_ASSIGNMENT_OPERATOR_IMPL_VIA_PURE_SWAP(QShader)
+ ~QShader();
+
+ void swap(QShader &other) noexcept { qt_ptr_swap(d, other.d); }
+ void detach();
+
+ bool isValid() const;
+
+ Stage stage() const;
+ void setStage(Stage stage);
+
+ QShaderDescription description() const;
+ void setDescription(const QShaderDescription &desc);
+
+ QList<QShaderKey> availableShaders() const;
+ QShaderCode shader(const QShaderKey &key) const;
+ void setShader(const QShaderKey &key, const QShaderCode &shader);
+ void removeShader(const QShaderKey &key);
+
+ QByteArray serialized(SerializedFormatVersion version = SerializedFormatVersion::Latest) const;
+ static QShader fromSerialized(const QByteArray &data);
+
+ using NativeResourceBindingMap = QMap<int, QPair<int, int> >; // binding -> native_binding[, native_binding]
+ NativeResourceBindingMap nativeResourceBindingMap(const QShaderKey &key) const;
+ void setResourceBindingMap(const QShaderKey &key, const NativeResourceBindingMap &map);
+ void removeResourceBindingMap(const QShaderKey &key);
+
+ struct SeparateToCombinedImageSamplerMapping {
+ QByteArray combinedSamplerName;
+ int textureBinding;
+ int samplerBinding;
+ };
+ using SeparateToCombinedImageSamplerMappingList = QList<SeparateToCombinedImageSamplerMapping>;
+ SeparateToCombinedImageSamplerMappingList separateToCombinedImageSamplerMappingList(const QShaderKey &key) const;
+ void setSeparateToCombinedImageSamplerMappingList(const QShaderKey &key,
+ const SeparateToCombinedImageSamplerMappingList &list);
+ void removeSeparateToCombinedImageSamplerMappingList(const QShaderKey &key);
+
+ struct NativeShaderInfo {
+ int flags = 0;
+ QMap<int, int> extraBufferBindings;
+ };
+ NativeShaderInfo nativeShaderInfo(const QShaderKey &key) const;
+ void setNativeShaderInfo(const QShaderKey &key, const NativeShaderInfo &info);
+ void removeNativeShaderInfo(const QShaderKey &key);
+
+private:
+ QShaderPrivate *d;
+ friend struct QShaderPrivate;
+ friend Q_GUI_EXPORT bool operator==(const QShader &, const QShader &) noexcept;
+ friend Q_GUI_EXPORT size_t qHash(const QShader &, size_t) noexcept;
+#ifndef QT_NO_DEBUG_STREAM
+ friend Q_GUI_EXPORT QDebug operator<<(QDebug, const QShader &);
+#endif
+};
+
+class Q_GUI_EXPORT QShaderKey
+{
+public:
+ QShaderKey() = default;
+ QShaderKey(QShader::Source s,
+ const QShaderVersion &sver,
+ QShader::Variant svar = QShader::StandardShader);
+
+ QShader::Source source() const { return m_source; }
+ void setSource(QShader::Source s) { m_source = s; }
+
+ QShaderVersion sourceVersion() const { return m_sourceVersion; }
+ void setSourceVersion(const QShaderVersion &sver) { m_sourceVersion = sver; }
+
+ QShader::Variant sourceVariant() const { return m_sourceVariant; }
+ void setSourceVariant(QShader::Variant svar) { m_sourceVariant = svar; }
+
+private:
+ QShader::Source m_source = QShader::SpirvShader;
+ QShaderVersion m_sourceVersion;
+ QShader::Variant m_sourceVariant = QShader::StandardShader;
+};
+
+Q_DECLARE_TYPEINFO(QShaderKey, Q_RELOCATABLE_TYPE);
+
+Q_GUI_EXPORT bool operator==(const QShader &lhs, const QShader &rhs) noexcept;
+Q_GUI_EXPORT size_t qHash(const QShader &s, size_t seed = 0) noexcept;
+
+inline bool operator!=(const QShader &lhs, const QShader &rhs) noexcept
+{
+ return !(lhs == rhs);
+}
+
+Q_GUI_EXPORT bool operator==(const QShaderVersion &lhs, const QShaderVersion &rhs) noexcept;
+Q_GUI_EXPORT bool operator<(const QShaderVersion &lhs, const QShaderVersion &rhs) noexcept;
+Q_GUI_EXPORT bool operator==(const QShaderKey &lhs, const QShaderKey &rhs) noexcept;
+Q_GUI_EXPORT bool operator<(const QShaderKey &lhs, const QShaderKey &rhs) noexcept;
+Q_GUI_EXPORT bool operator==(const QShaderCode &lhs, const QShaderCode &rhs) noexcept;
+
+inline bool operator!=(const QShaderVersion &lhs, const QShaderVersion &rhs) noexcept
+{
+ return !(lhs == rhs);
+}
+
+inline bool operator!=(const QShaderKey &lhs, const QShaderKey &rhs) noexcept
+{
+ return !(lhs == rhs);
+}
+
+inline bool operator!=(const QShaderCode &lhs, const QShaderCode &rhs) noexcept
+{
+ return !(lhs == rhs);
+}
+
+Q_GUI_EXPORT size_t qHash(const QShaderKey &k, size_t seed = 0) noexcept;
+
+#ifndef QT_NO_DEBUG_STREAM
+Q_GUI_EXPORT QDebug operator<<(QDebug, const QShader &);
+Q_GUI_EXPORT QDebug operator<<(QDebug dbg, const QShaderKey &k);
+Q_GUI_EXPORT QDebug operator<<(QDebug dbg, const QShaderVersion &v);
+#endif
+
+QT_END_NAMESPACE
+
+#endif
diff --git a/src/gui/rhi/qshader_p.h b/src/gui/rhi/qshader_p.h
index 4b561b6fa9..f77bcb1259 100644
--- a/src/gui/rhi/qshader_p.h
+++ b/src/gui/rhi/qshader_p.h
@@ -1,38 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2019 The Qt Company Ltd.
-** Contact: http://www.qt.io/licensing/
-**
-** This file is part of the Qt Gui module
-**
-** $QT_BEGIN_LICENSE:LGPL3$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2023 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#ifndef QSHADER_P_H
#define QSHADER_P_H
@@ -48,182 +15,77 @@
// We mean it.
//
-#include <QtGui/qtguiglobal.h>
-#include <private/qshaderdescription_p.h>
+#include <rhi/qshader.h>
+#include <QtCore/QAtomicInt>
+#include <QtCore/QMap>
+#include <QtCore/QDebug>
QT_BEGIN_NAMESPACE
-struct QShaderPrivate;
-class QShaderKey;
-
-class Q_GUI_EXPORT QShaderVersion
+struct Q_GUI_EXPORT QShaderPrivate
{
-public:
- enum Flag {
- GlslEs = 0x01
+ static const int QSB_VERSION = 9;
+ static const int QSB_VERSION_WITHOUT_INPUT_OUTPUT_INTERFACE_BLOCKS = 8;
+ static const int QSB_VERSION_WITHOUT_EXTENDED_STORAGE_BUFFER_INFO = 7;
+ static const int QSB_VERSION_WITHOUT_NATIVE_SHADER_INFO = 6;
+ static const int QSB_VERSION_WITHOUT_SEPARATE_IMAGES_AND_SAMPLERS = 5;
+ static const int QSB_VERSION_WITHOUT_VAR_ARRAYDIMS = 4;
+ static const int QSB_VERSION_WITH_CBOR = 3;
+ static const int QSB_VERSION_WITH_BINARY_JSON = 2;
+ static const int QSB_VERSION_WITHOUT_BINDINGS = 1;
+
+ enum MslNativeShaderInfoExtraBufferBindings {
+ MslTessVertIndicesBufferBinding = 0,
+ MslTessVertTescOutputBufferBinding,
+ MslTessTescTessLevelBufferBinding,
+ MslTessTescPatchOutputBufferBinding,
+ MslTessTescParamsBufferBinding,
+ MslTessTescInputBufferBinding,
+ MslBufferSizeBufferBinding,
+ MslMultiViewMaskBufferBinding
};
- Q_DECLARE_FLAGS(Flags, Flag)
-
- QShaderVersion() = default;
- QShaderVersion(int v, Flags f = Flags());
-
- int version() const { return m_version; }
- void setVersion(int v) { m_version = v; }
-
- Flags flags() const { return m_flags; }
- void setFlags(Flags f) { m_flags = f; }
-
-private:
- int m_version = 100;
- Flags m_flags;
-};
-
-Q_DECLARE_OPERATORS_FOR_FLAGS(QShaderVersion::Flags)
-Q_DECLARE_TYPEINFO(QShaderVersion, Q_MOVABLE_TYPE);
-
-class Q_GUI_EXPORT QShaderCode
-{
-public:
- QShaderCode() = default;
- QShaderCode(const QByteArray &code, const QByteArray &entry = QByteArray());
-
- QByteArray shader() const { return m_shader; }
- void setShader(const QByteArray &code) { m_shader = code; }
-
- QByteArray entryPoint() const { return m_entryPoint; }
- void setEntryPoint(const QByteArray &entry) { m_entryPoint = entry; }
-
-private:
- QByteArray m_shader;
- QByteArray m_entryPoint;
-};
-
-Q_DECLARE_TYPEINFO(QShaderCode, Q_MOVABLE_TYPE);
-
-class Q_GUI_EXPORT QShader
-{
-public:
- enum Stage {
- VertexStage = 0,
- TessellationControlStage,
- TessellationEvaluationStage,
- GeometryStage,
- FragmentStage,
- ComputeStage
- };
-
- enum Source {
- SpirvShader = 0,
- GlslShader,
- HlslShader,
- DxbcShader, // fxc
- MslShader,
- DxilShader, // dxc
- MetalLibShader // xcrun metal + xcrun metallib
- };
-
- enum Variant {
- StandardShader = 0,
- BatchableVertexShader
- };
-
- QShader();
- QShader(const QShader &other);
- QShader &operator=(const QShader &other);
- ~QShader();
- void detach();
-
- bool isValid() const;
-
- Stage stage() const;
- void setStage(Stage stage);
-
- QShaderDescription description() const;
- void setDescription(const QShaderDescription &desc);
- QVector<QShaderKey> availableShaders() const;
- QShaderCode shader(const QShaderKey &key) const;
- void setShader(const QShaderKey &key, const QShaderCode &shader);
- void removeShader(const QShaderKey &key);
-
- QByteArray serialized() const;
- static QShader fromSerialized(const QByteArray &data);
-
- using NativeResourceBindingMap = QHash<int, QPair<int, int> >; // binding -> native_binding[, native_binding]
- const NativeResourceBindingMap *nativeResourceBindingMap(const QShaderKey &key) const;
- void setResourceBindingMap(const QShaderKey &key, const NativeResourceBindingMap &map);
- void removeResourceBindingMap(const QShaderKey &key);
-
-private:
- QShaderPrivate *d;
- friend struct QShaderPrivate;
- friend Q_GUI_EXPORT bool operator==(const QShader &, const QShader &) Q_DECL_NOTHROW;
- friend Q_GUI_EXPORT uint qHash(const QShader &, uint) Q_DECL_NOTHROW;
-#ifndef QT_NO_DEBUG_STREAM
- friend Q_GUI_EXPORT QDebug operator<<(QDebug, const QShader &);
-#endif
+ QShaderPrivate()
+ : ref(1)
+ {
+ }
+
+ QShaderPrivate(const QShaderPrivate &other)
+ : ref(1),
+ qsbVersion(other.qsbVersion),
+ stage(other.stage),
+ desc(other.desc),
+ shaders(other.shaders),
+ bindings(other.bindings),
+ combinedImageMap(other.combinedImageMap),
+ nativeShaderInfoMap(other.nativeShaderInfoMap)
+ {
+ }
+
+ static QShaderPrivate *get(QShader *s) { return s->d; }
+ static const QShaderPrivate *get(const QShader *s) { return s->d; }
+ static int qtQsbVersion(QShader::SerializedFormatVersion qtVersion) {
+ switch (qtVersion) {
+ case QShader::SerializedFormatVersion::Qt_6_4:
+ return (QShaderPrivate::QSB_VERSION_WITHOUT_SEPARATE_IMAGES_AND_SAMPLERS + 1);
+ case QShader::SerializedFormatVersion::Qt_6_5:
+ return (QShaderPrivate::QSB_VERSION_WITHOUT_EXTENDED_STORAGE_BUFFER_INFO + 1);
+ default:
+ return QShaderPrivate::QSB_VERSION;
+ }
+ }
+
+ QAtomicInt ref;
+ int qsbVersion = QSB_VERSION;
+ QShader::Stage stage = QShader::VertexStage;
+ QShaderDescription desc;
+ // QMap not QHash because we need to be able to iterate based on sorted keys
+ QMap<QShaderKey, QShaderCode> shaders;
+ QMap<QShaderKey, QShader::NativeResourceBindingMap> bindings;
+ QMap<QShaderKey, QShader::SeparateToCombinedImageSamplerMappingList> combinedImageMap;
+ QMap<QShaderKey, QShader::NativeShaderInfo> nativeShaderInfoMap;
};
-class Q_GUI_EXPORT QShaderKey
-{
-public:
- QShaderKey() = default;
- QShaderKey(QShader::Source s,
- const QShaderVersion &sver,
- QShader::Variant svar = QShader::StandardShader);
-
- QShader::Source source() const { return m_source; }
- void setSource(QShader::Source s) { m_source = s; }
-
- QShaderVersion sourceVersion() const { return m_sourceVersion; }
- void setSourceVersion(const QShaderVersion &sver) { m_sourceVersion = sver; }
-
- QShader::Variant sourceVariant() const { return m_sourceVariant; }
- void setSourceVariant(QShader::Variant svar) { m_sourceVariant = svar; }
-
-private:
- QShader::Source m_source = QShader::SpirvShader;
- QShaderVersion m_sourceVersion;
- QShader::Variant m_sourceVariant = QShader::StandardShader;
-};
-
-Q_DECLARE_TYPEINFO(QShaderKey, Q_MOVABLE_TYPE);
-
-Q_GUI_EXPORT bool operator==(const QShader &lhs, const QShader &rhs) Q_DECL_NOTHROW;
-Q_GUI_EXPORT uint qHash(const QShader &s, uint seed = 0) Q_DECL_NOTHROW;
-
-inline bool operator!=(const QShader &lhs, const QShader &rhs) Q_DECL_NOTHROW
-{
- return !(lhs == rhs);
-}
-
-Q_GUI_EXPORT bool operator==(const QShaderVersion &lhs, const QShaderVersion &rhs) Q_DECL_NOTHROW;
-Q_GUI_EXPORT bool operator==(const QShaderKey &lhs, const QShaderKey &rhs) Q_DECL_NOTHROW;
-Q_GUI_EXPORT bool operator==(const QShaderCode &lhs, const QShaderCode &rhs) Q_DECL_NOTHROW;
-
-inline bool operator!=(const QShaderVersion &lhs, const QShaderVersion &rhs) Q_DECL_NOTHROW
-{
- return !(lhs == rhs);
-}
-
-inline bool operator!=(const QShaderKey &lhs, const QShaderKey &rhs) Q_DECL_NOTHROW
-{
- return !(lhs == rhs);
-}
-
-inline bool operator!=(const QShaderCode &lhs, const QShaderCode &rhs) Q_DECL_NOTHROW
-{
- return !(lhs == rhs);
-}
-
-Q_GUI_EXPORT uint qHash(const QShaderKey &k, uint seed = 0) Q_DECL_NOTHROW;
-
-#ifndef QT_NO_DEBUG_STREAM
-Q_GUI_EXPORT QDebug operator<<(QDebug, const QShader &);
-Q_GUI_EXPORT QDebug operator<<(QDebug dbg, const QShaderKey &k);
-Q_GUI_EXPORT QDebug operator<<(QDebug dbg, const QShaderVersion &v);
-#endif
-
QT_END_NAMESPACE
#endif
diff --git a/src/gui/rhi/qshader_p_p.h b/src/gui/rhi/qshader_p_p.h
deleted file mode 100644
index 8c89f2b45f..0000000000
--- a/src/gui/rhi/qshader_p_p.h
+++ /dev/null
@@ -1,92 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2019 The Qt Company Ltd.
-** Contact: http://www.qt.io/licensing/
-**
-** This file is part of the Qt Gui module
-**
-** $QT_BEGIN_LICENSE:LGPL3$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef QSHADER_P_P_H
-#define QSHADER_P_P_H
-
-//
-// W A R N I N G
-// -------------
-//
-// This file is not part of the Qt API. It exists for the convenience
-// of a number of Qt sources files. This header file may change from
-// version to version without notice, or even be removed.
-//
-// We mean it.
-//
-
-#include "qshader_p.h"
-#include <QtCore/QAtomicInt>
-#include <QtCore/QHash>
-#include <QtCore/QDebug>
-
-QT_BEGIN_NAMESPACE
-
-struct Q_GUI_EXPORT QShaderPrivate
-{
- static const int QSB_VERSION = 3;
- static const int QSB_VERSION_WITH_BINARY_JSON = 2;
- static const int QSB_VERSION_WITHOUT_BINDINGS = 1;
-
- QShaderPrivate()
- : ref(1)
- {
- }
-
- QShaderPrivate(const QShaderPrivate *other)
- : ref(1),
- qsbVersion(other->qsbVersion),
- stage(other->stage),
- desc(other->desc),
- shaders(other->shaders),
- bindings(other->bindings)
- {
- }
-
- static QShaderPrivate *get(QShader *s) { return s->d; }
- static const QShaderPrivate *get(const QShader *s) { return s->d; }
-
- QAtomicInt ref;
- int qsbVersion = QSB_VERSION;
- QShader::Stage stage = QShader::VertexStage;
- QShaderDescription desc;
- QHash<QShaderKey, QShaderCode> shaders;
- QHash<QShaderKey, QShader::NativeResourceBindingMap> bindings;
-};
-
-QT_END_NAMESPACE
-
-#endif
diff --git a/src/gui/rhi/qshaderdescription.cpp b/src/gui/rhi/qshaderdescription.cpp
index d0f73f6aa7..f64daf02ef 100644
--- a/src/gui/rhi/qshaderdescription.cpp
+++ b/src/gui/rhi/qshaderdescription.cpp
@@ -1,56 +1,33 @@
-/****************************************************************************
-**
-** Copyright (C) 2019 The Qt Company Ltd.
-** Contact: http://www.qt.io/licensing/
-**
-** This file is part of the Qt Gui module
-**
-** $QT_BEGIN_LICENSE:LGPL3$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "qshaderdescription_p_p.h"
+// Copyright (C) 2023 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
+
+#include "qshaderdescription_p.h"
+#include "qshader_p.h"
#include <QDebug>
+#include <QDataStream>
#include <QJsonObject>
#include <QJsonArray>
-#include <QCborValue>
-#include <QCborMap>
-#include <QCborArray>
QT_BEGIN_NAMESPACE
/*!
\class QShaderDescription
- \internal
+ \ingroup painting-3D
\inmodule QtGui
+ \since 6.6
\brief Describes the interface of a shader.
+ \warning The QRhi family of classes in the Qt Gui module, including QShader
+ and QShaderDescription, offer limited compatibility guarantees. There are
+ no source or binary compatibility guarantees for these classes, meaning the
+ API is only guaranteed to work with the Qt version the application was
+ developed against. Source incompatible changes are however aimed to be kept
+ at a minimum and will only be made in minor releases (6.7, 6.8, and so on).
+ To use these classes in an application, link to
+ \c{Qt::GuiPrivate} (if using CMake), and include the headers with the \c
+ rhi prefix, for example \c{#include <rhi/qshaderdescription.h>}.
+
A shader typically has a set of inputs and outputs. A vertex shader for
example has a number of input variables and may use one or more uniform
buffers to access data (e.g. a modelview matrix) provided by the
@@ -85,8 +62,6 @@ QT_BEGIN_NAMESPACE
float opacity;
} ubuf;
- out gl_PerVertex { vec4 gl_Position; };
-
void main()
{
v_color = color;
@@ -101,12 +76,13 @@ QT_BEGIN_NAMESPACE
of 68 bytes and two members, a 4x4 matrix named \c mvp at offset 0, and a
float \c opacity at offset 64.
- All this is described by a QShaderDescription object. QShaderDescription
- can also be serialized to JSON and binary JSON, and can be deserialized
- from binary JSON. In practice this is rarely needed since QShader
- takes care of the associated QShaderDescription automatically, but if the
- QShaderDescription of the above shader would be written out as JSON, it
- would look like the following:
+ All this is described by a QShaderDescription object. QShaderDescription can
+ be serialized to JSON and to a binary format via QDataStream, and can be
+ deserialized from this binary format. In practice this is rarely needed
+ since QShader takes care of the associated QShaderDescription automatically,
+ but if the QShaderDescription of the above shader would be written out as
+ JSON (like it is done by the \c qsb tool's \c{-d} option), it would look
+ like the following:
\badcode
{
@@ -218,6 +194,8 @@ QT_BEGIN_NAMESPACE
\value SamplerCubeArray
\value SamplerRect
\value SamplerBuffer
+ \value SamplerExternalOES
+ \value Sampler For separate samplers.
\value Image1D
\value Image2D
\value Image2DMS
@@ -231,28 +209,179 @@ QT_BEGIN_NAMESPACE
\value ImageRect
\value ImageBuffer
\value Struct
+ \value Half
+ \value Half2
+ \value Half3
+ \value Half4
*/
/*!
- \class QShaderDescription::InOutVariable
- \internal
+ \enum QShaderDescription::ImageFormat
+ Image format.
+
+ \value ImageFormatUnknown
+ \value ImageFormatRgba32f
+ \value ImageFormatRgba16f
+ \value ImageFormatR32f
+ \value ImageFormatRgba8
+ \value ImageFormatRgba8Snorm
+ \value ImageFormatRg32f
+ \value ImageFormatRg16f
+ \value ImageFormatR11fG11fB10f
+ \value ImageFormatR16f
+ \value ImageFormatRgba16
+ \value ImageFormatRgb10A2
+ \value ImageFormatRg16
+ \value ImageFormatRg8
+ \value ImageFormatR16
+ \value ImageFormatR8
+ \value ImageFormatRgba16Snorm
+ \value ImageFormatRg16Snorm
+ \value ImageFormatRg8Snorm
+ \value ImageFormatR16Snorm
+ \value ImageFormatR8Snorm
+ \value ImageFormatRgba32i
+ \value ImageFormatRgba16i
+ \value ImageFormatRgba8i
+ \value ImageFormatR32i
+ \value ImageFormatRg32i
+ \value ImageFormatRg16i
+ \value ImageFormatRg8i
+ \value ImageFormatR16i
+ \value ImageFormatR8i
+ \value ImageFormatRgba32ui
+ \value ImageFormatRgba16ui
+ \value ImageFormatRgba8ui
+ \value ImageFormatR32ui
+ \value ImageFormatRgb10a2ui
+ \value ImageFormatRg32ui
+ \value ImageFormatRg16ui
+ \value ImageFormatRg8ui
+ \value ImageFormatR16ui
+ \value ImageFormatR8ui
+ */
+
+/*!
+ \enum QShaderDescription::ImageFlag
+ Image flags.
+
+ \value ReadOnlyImage
+ \value WriteOnlyImage
+ */
+
+/*!
+ \enum QShaderDescription::QualifierFlag
+ Qualifier flags.
+
+ \value QualifierReadOnly
+ \value QualifierWriteOnly
+ \value QualifierCoherent
+ \value QualifierVolatile
+ \value QualifierRestrict
+ */
+
+/*!
+ \struct QShaderDescription::InOutVariable
\inmodule QtGui
+ \since 6.6
\brief Describes an input or output variable in the shader.
+
+ \note This is a RHI API with limited compatibility guarantees, see \l QShaderDescription
+ for details.
*/
/*!
- \class QShaderDescription::BlockVariable
- \internal
+ \variable QShaderDescription::InOutVariable::name
+ */
+
+/*!
+ \variable QShaderDescription::InOutVariable::type
+ */
+
+/*!
+ \variable QShaderDescription::InOutVariable::location
+ */
+
+/*!
+ \variable QShaderDescription::InOutVariable::binding
+ */
+
+/*!
+ \variable QShaderDescription::InOutVariable::descriptorSet
+ */
+
+/*!
+ \variable QShaderDescription::InOutVariable::imageFormat
+ */
+
+/*!
+ \variable QShaderDescription::InOutVariable::imageFlags
+ */
+
+/*!
+ \variable QShaderDescription::InOutVariable::arrayDims
+ */
+
+/*!
+ \variable QShaderDescription::InOutVariable::perPatch
+ */
+
+/*!
+ \variable QShaderDescription::InOutVariable::structMembers
+ */
+
+/*!
+ \struct QShaderDescription::BlockVariable
\inmodule QtGui
+ \since 6.6
\brief Describes a member of a uniform or push constant block.
+
+ \note This is a RHI API with limited compatibility guarantees, see \l QShaderDescription
+ for details.
*/
/*!
- \class QShaderDescription::UniformBlock
- \internal
+ \variable QShaderDescription::BlockVariable::name
+ */
+
+/*!
+ \variable QShaderDescription::BlockVariable::type
+ */
+
+/*!
+ \variable QShaderDescription::BlockVariable::offset
+ */
+
+/*!
+ \variable QShaderDescription::BlockVariable::size
+ */
+
+/*!
+ \variable QShaderDescription::BlockVariable::arrayDims
+ */
+
+/*!
+ \variable QShaderDescription::BlockVariable::arrayStride
+ */
+
+/*!
+ \variable QShaderDescription::BlockVariable::matrixStride
+ */
+
+/*!
+ \variable QShaderDescription::BlockVariable::matrixIsRowMajor
+ */
+
+/*!
+ \variable QShaderDescription::BlockVariable::structMembers
+ */
+
+/*!
+ \struct QShaderDescription::UniformBlock
\inmodule QtGui
+ \since 6.6
\brief Describes a uniform block.
@@ -260,22 +389,157 @@ QT_BEGIN_NAMESPACE
(like GLSL 120 or GLSL/ES 100), uniform blocks are replaced with ordinary
uniforms in a struct. The name of the struct, and so the prefix for the
uniforms generated from the block members, is given by structName.
+
+ \note This is a RHI API with limited compatibility guarantees, see \l QShaderDescription
+ for details.
*/
/*!
- \class QShaderDescription::PushConstantBlock
- \internal
+ \variable QShaderDescription::UniformBlock::blockName
+ */
+
+/*!
+ \variable QShaderDescription::UniformBlock::structName
+ */
+
+/*!
+ \variable QShaderDescription::UniformBlock::size
+ */
+
+/*!
+ \variable QShaderDescription::UniformBlock::binding
+ */
+
+/*!
+ \variable QShaderDescription::UniformBlock::descriptorSet
+ */
+
+/*!
+ \variable QShaderDescription::UniformBlock::members
+ */
+
+/*!
+ \struct QShaderDescription::PushConstantBlock
\inmodule QtGui
+ \since 6.6
\brief Describes a push constant block.
+
+ \note This is a RHI API with limited compatibility guarantees, see \l QShaderDescription
+ for details.
*/
/*!
- \class QShaderDescription::StorageBlock
- \internal
+ \variable QShaderDescription::PushConstantBlock::name
+ */
+
+/*!
+ \variable QShaderDescription::PushConstantBlock::size
+ */
+
+/*!
+ \variable QShaderDescription::PushConstantBlock::members
+ */
+
+/*!
+ \struct QShaderDescription::StorageBlock
\inmodule QtGui
+ \since 6.6
\brief Describes a shader storage block.
+
+ \note This is a RHI API with limited compatibility guarantees, see \l QShaderDescription
+ for details.
+ */
+
+/*!
+ \variable QShaderDescription::StorageBlock::blockName
+ */
+
+/*!
+ \variable QShaderDescription::StorageBlock::instanceName
+ */
+
+/*!
+ \variable QShaderDescription::StorageBlock::knownSize
+ */
+
+/*!
+ \variable QShaderDescription::StorageBlock::binding
+ */
+
+/*!
+ \variable QShaderDescription::StorageBlock::descriptorSet
+ */
+
+/*!
+ \variable QShaderDescription::StorageBlock::members
+ */
+
+/*!
+ \variable QShaderDescription::StorageBlock::runtimeArrayStride
+ */
+
+/*!
+ \variable QShaderDescription::StorageBlock::qualifierFlags
+ */
+
+/*!
+ \struct QShaderDescription::BuiltinVariable
+ \inmodule QtGui
+ \since 6.6
+
+ \brief Describes a built-in variable.
+
+ \note This is a RHI API with limited compatibility guarantees, see \l QShaderDescription
+ for details.
+ */
+
+/*!
+ \variable QShaderDescription::BuiltinVariable::type
+ */
+
+/*!
+ \variable QShaderDescription::BuiltinVariable::varType
+ */
+
+/*!
+ \variable QShaderDescription::BuiltinVariable::arrayDims
+ */
+
+/*!
+ \enum QShaderDescription::BuiltinType
+ Built-in variable type.
+
+ \value PositionBuiltin
+ \value PointSizeBuiltin
+ \value ClipDistanceBuiltin
+ \value CullDistanceBuiltin
+ \value VertexIdBuiltin
+ \value InstanceIdBuiltin
+ \value PrimitiveIdBuiltin
+ \value InvocationIdBuiltin
+ \value LayerBuiltin
+ \value ViewportIndexBuiltin
+ \value TessLevelOuterBuiltin
+ \value TessLevelInnerBuiltin
+ \value TessCoordBuiltin
+ \value PatchVerticesBuiltin
+ \value FragCoordBuiltin
+ \value PointCoordBuiltin
+ \value FrontFacingBuiltin
+ \value SampleIdBuiltin
+ \value SamplePositionBuiltin
+ \value SampleMaskBuiltin
+ \value FragDepthBuiltin
+ \value NumWorkGroupsBuiltin
+ \value WorkgroupSizeBuiltin
+ \value WorkgroupIdBuiltin
+ \value LocalInvocationIdBuiltin
+ \value GlobalInvocationIdBuiltin
+ \value LocalInvocationIndexBuiltin
+ \value VertexIndexBuiltin
+ \value InstanceIndexBuiltin
*/
/*!
@@ -298,7 +562,7 @@ void QShaderDescription::detach()
}
/*!
- \internal
+ Constructs a copy of \a other.
*/
QShaderDescription::QShaderDescription(const QShaderDescription &other)
: d(other.d)
@@ -307,7 +571,7 @@ QShaderDescription::QShaderDescription(const QShaderDescription &other)
}
/*!
- \internal
+ Assigns \a other to this object.
*/
QShaderDescription &QShaderDescription::operator=(const QShaderDescription &other)
{
@@ -332,33 +596,9 @@ bool QShaderDescription::isValid() const
{
return !d->inVars.isEmpty() || !d->outVars.isEmpty()
|| !d->uniformBlocks.isEmpty() || !d->pushConstantBlocks.isEmpty() || !d->storageBlocks.isEmpty()
- || !d->combinedImageSamplers.isEmpty() || !d->storageImages.isEmpty();
-}
-
-/*!
- \return a serialized binary version of the data.
-
- \sa toJson(), toCbor()
- */
-QByteArray QShaderDescription::toBinaryJson() const
-{
-#if QT_CONFIG(binaryjson)
- return d->makeDoc().toBinaryData();
-#else
- qWarning("Cannot generate binary JSON from QShaderDescription due to disabled binaryjson feature");
- return QByteArray();
-#endif
-}
-
-/*!
- \return a serialized binary version of the data in CBOR (Concise Binary
- Object Representation) format.
-
- \sa QCborValue, toBinaryJson(), toJson()
- */
-QByteArray QShaderDescription::toCbor() const
-{
- return QCborValue::fromJsonValue(d->makeDoc().object()).toCbor();
+ || !d->combinedImageSamplers.isEmpty() || !d->storageImages.isEmpty()
+ || !d->separateImages.isEmpty() || !d->separateSamplers.isEmpty()
+ || !d->inBuiltins.isEmpty() || !d->outBuiltins.isEmpty();
}
/*!
@@ -366,7 +606,7 @@ QByteArray QShaderDescription::toCbor() const
\note There is no deserialization method provided for JSON text.
- \sa toBinaryJson(), toCbor()
+ \sa serialize()
*/
QByteArray QShaderDescription::toJson() const
{
@@ -374,40 +614,26 @@ QByteArray QShaderDescription::toJson() const
}
/*!
- Deserializes the given binary JSON \a data and returns a new
- QShaderDescription.
+ Serializes this QShaderDescription to \a stream. \a version specifies
+ the qsb version.
- \sa fromCbor()
+ \sa deserialize(), toJson()
*/
-QShaderDescription QShaderDescription::fromBinaryJson(const QByteArray &data)
+void QShaderDescription::serialize(QDataStream *stream, int version) const
{
- QShaderDescription desc;
-#if QT_CONFIG(binaryjson)
- QShaderDescriptionPrivate::get(&desc)->loadDoc(QJsonDocument::fromBinaryData(data));
-#else
- Q_UNUSED(data);
- qWarning("Cannot load QShaderDescription from binary JSON due to disabled binaryjson feature");
-#endif
- return desc;
+ d->writeToStream(stream, version);
}
/*!
- Deserializes the given CBOR \a data and returns a new QShaderDescription.
+ \return a new QShaderDescription loaded from \a stream. \a version specifies
+ the qsb version.
- \sa fromBinaryJson()
+ \sa serialize()
*/
-QShaderDescription QShaderDescription::fromCbor(const QByteArray &data)
+QShaderDescription QShaderDescription::deserialize(QDataStream *stream, int version)
{
QShaderDescription desc;
- const QCborValue cbor = QCborValue::fromCbor(data);
- if (cbor.isMap()) {
- const QJsonDocument doc(cbor.toMap().toJsonObject());
- QShaderDescriptionPrivate::get(&desc)->loadDoc(doc);
- }
- if (cbor.isArray()) {
- const QJsonDocument doc(cbor.toArray().toJsonArray());
- QShaderDescriptionPrivate::get(&desc)->loadDoc(doc);
- }
+ QShaderDescriptionPrivate::get(&desc)->loadFromStream(stream, version);
return desc;
}
@@ -416,7 +642,7 @@ QShaderDescription QShaderDescription::fromCbor(const QByteArray &data)
called attributes) for the vertex stage, and inputs for other stages
(sometimes called varyings).
*/
-QVector<QShaderDescription::InOutVariable> QShaderDescription::inputVariables() const
+QList<QShaderDescription::InOutVariable> QShaderDescription::inputVariables() const
{
return d->inVars;
}
@@ -424,7 +650,7 @@ QVector<QShaderDescription::InOutVariable> QShaderDescription::inputVariables()
/*!
\return the list of output variables.
*/
-QVector<QShaderDescription::InOutVariable> QShaderDescription::outputVariables() const
+QList<QShaderDescription::InOutVariable> QShaderDescription::outputVariables() const
{
return d->outVars;
}
@@ -432,7 +658,7 @@ QVector<QShaderDescription::InOutVariable> QShaderDescription::outputVariables()
/*!
\return the list of uniform blocks.
*/
-QVector<QShaderDescription::UniformBlock> QShaderDescription::uniformBlocks() const
+QList<QShaderDescription::UniformBlock> QShaderDescription::uniformBlocks() const
{
return d->uniformBlocks;
}
@@ -444,7 +670,7 @@ QVector<QShaderDescription::UniformBlock> QShaderDescription::uniformBlocks() co
in combination with the Qt Rendering Hardware Interface since that
currently has no support for them.
*/
-QVector<QShaderDescription::PushConstantBlock> QShaderDescription::pushConstantBlocks() const
+QList<QShaderDescription::PushConstantBlock> QShaderDescription::pushConstantBlocks() const
{
return d->pushConstantBlocks;
}
@@ -473,6 +699,7 @@ QVector<QShaderDescription::PushConstantBlock> QShaderDescription::pushConstantB
"blockName": "StuffSsbo",
"instanceName": "buf",
"knownSize": 16,
+ "runtimeArrayStride": 16
"members": [
{
"name": "whatever",
@@ -510,12 +737,15 @@ QVector<QShaderDescription::PushConstantBlock> QShaderDescription::pushConstantB
\note The size of the last member in the storage block is undefined. This shows
up as \c size 0 and an array dimension of \c{[0]}. The storage block's \c knownSize
- excludes the size of the last member since that will only be known at run time.
+ excludes the size of the last member since that will only be known at run time. The
+ stride in bytes between array items for a last member with undefined array size is
+ \c runtimeArrayStride. This value is determined according to the specified buffer
+ memory layout standard (std140, std430) rules.
\note SSBOs are not available with some graphics APIs, such as, OpenGL 2.x or
OpenGL ES older than 3.1.
*/
-QVector<QShaderDescription::StorageBlock> QShaderDescription::storageBlocks() const
+QList<QShaderDescription::StorageBlock> QShaderDescription::storageBlocks() const
{
return d->storageBlocks;
}
@@ -542,11 +772,21 @@ QVector<QShaderDescription::StorageBlock> QShaderDescription::storageBlocks() co
exist everywhere. For instance, a HLSL version will likely just use a
Texture2D and SamplerState object with registers t1 and s1, respectively.
*/
-QVector<QShaderDescription::InOutVariable> QShaderDescription::combinedImageSamplers() const
+QList<QShaderDescription::InOutVariable> QShaderDescription::combinedImageSamplers() const
{
return d->combinedImageSamplers;
}
+QList<QShaderDescription::InOutVariable> QShaderDescription::separateImages() const
+{
+ return d->separateImages;
+}
+
+QList<QShaderDescription::InOutVariable> QShaderDescription::separateSamplers() const
+{
+ return d->separateSamplers;
+}
+
/*!
\return the list of image variables.
@@ -569,13 +809,32 @@ QVector<QShaderDescription::InOutVariable> QShaderDescription::combinedImageSamp
\note Separate image objects are not compatible with some graphics APIs,
such as, OpenGL 2.x or OpenGL ES older than 3.1.
*/
-QVector<QShaderDescription::InOutVariable> QShaderDescription::storageImages() const
+QList<QShaderDescription::InOutVariable> QShaderDescription::storageImages() const
{
return d->storageImages;
}
/*!
- Returns the local size of a compute shader.
+ \return the list of active builtins used as input. For example, a
+ tessellation evaluation shader reading the value of gl_TessCoord and
+ gl_Position will have TessCoordBuiltin and PositionBuiltin listed here.
+ */
+QVector<QShaderDescription::BuiltinVariable> QShaderDescription::inputBuiltinVariables() const
+{
+ return d->inBuiltins;
+}
+
+/*!
+ \return the list of active built-in variables used as input. For example, a
+ vertex shader will very often have PositionBuiltin as an output built-in.
+ */
+QVector<QShaderDescription::BuiltinVariable> QShaderDescription::outputBuiltinVariables() const
+{
+ return d->outBuiltins;
+}
+
+/*!
+ \return the local size of a compute shader.
For example, for a compute shader with the following declaration the
function returns { 256, 16, 1}.
@@ -589,163 +848,346 @@ std::array<uint, 3> QShaderDescription::computeShaderLocalSize() const
return d->localSize;
}
-static struct TypeTab {
- QString k;
- QShaderDescription::VariableType v;
-} typeTab[] = {
- { QLatin1String("float"), QShaderDescription::Float },
- { QLatin1String("vec2"), QShaderDescription::Vec2 },
- { QLatin1String("vec3"), QShaderDescription::Vec3 },
- { QLatin1String("vec4"), QShaderDescription::Vec4 },
- { QLatin1String("mat2"), QShaderDescription::Mat2 },
- { QLatin1String("mat3"), QShaderDescription::Mat3 },
- { QLatin1String("mat4"), QShaderDescription::Mat4 },
-
- { QLatin1String("struct"), QShaderDescription::Struct },
-
- { QLatin1String("sampler1D"), QShaderDescription::Sampler1D },
- { QLatin1String("sampler2D"), QShaderDescription::Sampler2D },
- { QLatin1String("sampler2DMS"), QShaderDescription::Sampler2DMS },
- { QLatin1String("sampler3D"), QShaderDescription::Sampler3D },
- { QLatin1String("samplerCube"), QShaderDescription::SamplerCube },
- { QLatin1String("sampler1DArray"), QShaderDescription::Sampler1DArray },
- { QLatin1String("sampler2DArray"), QShaderDescription::Sampler2DArray },
- { QLatin1String("sampler2DMSArray"), QShaderDescription::Sampler2DMSArray },
- { QLatin1String("sampler3DArray"), QShaderDescription::Sampler3DArray },
- { QLatin1String("samplerCubeArray"), QShaderDescription::SamplerCubeArray },
- { QLatin1String("samplerRect"), QShaderDescription::SamplerRect },
- { QLatin1String("samplerBuffer"), QShaderDescription::SamplerBuffer },
-
- { QLatin1String("mat2x3"), QShaderDescription::Mat2x3 },
- { QLatin1String("mat2x4"), QShaderDescription::Mat2x4 },
- { QLatin1String("mat3x2"), QShaderDescription::Mat3x2 },
- { QLatin1String("mat3x4"), QShaderDescription::Mat3x4 },
- { QLatin1String("mat4x2"), QShaderDescription::Mat4x2 },
- { QLatin1String("mat4x3"), QShaderDescription::Mat4x3 },
-
- { QLatin1String("int"), QShaderDescription::Int },
- { QLatin1String("ivec2"), QShaderDescription::Int2 },
- { QLatin1String("ivec3"), QShaderDescription::Int3 },
- { QLatin1String("ivec4"), QShaderDescription::Int4 },
-
- { QLatin1String("uint"), QShaderDescription::Uint },
- { QLatin1String("uvec2"), QShaderDescription::Uint2 },
- { QLatin1String("uvec3"), QShaderDescription::Uint3 },
- { QLatin1String("uvec4"), QShaderDescription::Uint4 },
-
- { QLatin1String("bool"), QShaderDescription::Bool },
- { QLatin1String("bvec2"), QShaderDescription::Bool2 },
- { QLatin1String("bvec3"), QShaderDescription::Bool3 },
- { QLatin1String("bvec4"), QShaderDescription::Bool4 },
-
- { QLatin1String("double"), QShaderDescription::Double },
- { QLatin1String("dvec2"), QShaderDescription::Double2 },
- { QLatin1String("dvec3"), QShaderDescription::Double3 },
- { QLatin1String("dvec4"), QShaderDescription::Double4 },
- { QLatin1String("dmat2"), QShaderDescription::DMat2 },
- { QLatin1String("dmat3"), QShaderDescription::DMat3 },
- { QLatin1String("dmat4"), QShaderDescription::DMat4 },
- { QLatin1String("dmat2x3"), QShaderDescription::DMat2x3 },
- { QLatin1String("dmat2x4"), QShaderDescription::DMat2x4 },
- { QLatin1String("dmat3x2"), QShaderDescription::DMat3x2 },
- { QLatin1String("dmat3x4"), QShaderDescription::DMat3x4 },
- { QLatin1String("dmat4x2"), QShaderDescription::DMat4x2 },
- { QLatin1String("dmat4x3"), QShaderDescription::DMat4x3 },
-
- { QLatin1String("image1D"), QShaderDescription::Image1D },
- { QLatin1String("image2D"), QShaderDescription::Image2D },
- { QLatin1String("image2DMS"), QShaderDescription::Image2DMS },
- { QLatin1String("image3D"), QShaderDescription::Image3D },
- { QLatin1String("imageCube"), QShaderDescription::ImageCube },
- { QLatin1String("image1DArray"), QShaderDescription::Image1DArray },
- { QLatin1String("image2DArray"), QShaderDescription::Image2DArray },
- { QLatin1String("image2DMSArray"), QShaderDescription::Image2DMSArray },
- { QLatin1String("image3DArray"), QShaderDescription::Image3DArray },
- { QLatin1String("imageCubeArray"), QShaderDescription::ImageCubeArray },
- { QLatin1String("imageRect"), QShaderDescription::ImageRect },
- { QLatin1String("imageBuffer"), QShaderDescription::ImageBuffer }
-};
+/*!
+ \return the number of output vertices.
+
+ For example, for a tessellation control shader with the following
+ declaration the function returns 3.
-static QString typeStr(const QShaderDescription::VariableType &t)
+ \badcode
+ layout(vertices = 3) out;
+ \endcode
+ */
+uint QShaderDescription::tessellationOutputVertexCount() const
{
- for (size_t i = 0; i < sizeof(typeTab) / sizeof(TypeTab); ++i) {
- if (typeTab[i].v == t)
- return typeTab[i].k;
- }
- return QString();
+ return d->tessOutVertCount;
}
-static QShaderDescription::VariableType mapType(const QString &t)
+/*!
+ \enum QShaderDescription::TessellationMode
+
+ \value UnknownTessellationMode
+ \value TrianglesTessellationMode
+ \value QuadTessellationMode
+ \value IsolineTessellationMode
+ */
+
+/*!
+ \return the tessellation execution mode for a tessellation control or
+ evaluation shader.
+
+ When not set, the returned value is UnknownTessellationMode.
+
+ For example, for a tessellation evaluation shader with the following
+ declaration the function returns TrianglesTessellationMode.
+
+ \badcode
+ layout(triangles) in;
+ \endcode
+ */
+QShaderDescription::TessellationMode QShaderDescription::tessellationMode() const
+{
+ return d->tessMode;
+}
+
+/*!
+ \enum QShaderDescription::TessellationWindingOrder
+
+ \value UnknownTessellationWindingOrder
+ \value CwTessellationWindingOrder
+ \value CcwTessellationWindingOrder
+ */
+
+/*!
+ \return the tessellation winding order for a tessellation control or
+ evaluation shader.
+
+ When not set, the returned value is UnknownTessellationWindingOrder.
+
+ For example, for a tessellation evaluation shader with the following
+ declaration the function returns CcwTessellationWindingOrder.
+
+ \badcode
+ layout(triangles, fractional_odd_spacing, ccw) in;
+ \endcode
+ */
+QShaderDescription::TessellationWindingOrder QShaderDescription::tessellationWindingOrder() const
+{
+ return d->tessWind;
+}
+
+/*!
+ \enum QShaderDescription::TessellationPartitioning
+
+ \value UnknownTessellationPartitioning
+ \value EqualTessellationPartitioning
+ \value FractionalEvenTessellationPartitioning
+ \value FractionalOddTessellationPartitioning
+ */
+
+/*!
+ \return the tessellation partitioning mode for a tessellation control or
+ evaluation shader.
+
+ When not set, the returned value is UnknownTessellationPartitioning.
+
+ For example, for a tessellation evaluation shader with the following
+ declaration the function returns FractionalOddTessellationPartitioning.
+
+ \badcode
+ layout(triangles, fractional_odd_spacing, ccw) in;
+ \endcode
+ */
+QShaderDescription::TessellationPartitioning QShaderDescription::tessellationPartitioning() const
+{
+ return d->tessPart;
+}
+
+static const struct TypeTab {
+ const char k[20];
+ QShaderDescription::VariableType v;
+} typeTab[] = {
+ { "float", QShaderDescription::Float },
+ { "vec2", QShaderDescription::Vec2 },
+ { "vec3", QShaderDescription::Vec3 },
+ { "vec4", QShaderDescription::Vec4 },
+ { "mat2", QShaderDescription::Mat2 },
+ { "mat3", QShaderDescription::Mat3 },
+ { "mat4", QShaderDescription::Mat4 },
+
+ { "struct", QShaderDescription::Struct },
+
+ { "sampler1D", QShaderDescription::Sampler1D },
+ { "sampler2D", QShaderDescription::Sampler2D },
+ { "sampler2DMS", QShaderDescription::Sampler2DMS },
+ { "sampler3D", QShaderDescription::Sampler3D },
+ { "samplerCube", QShaderDescription::SamplerCube },
+ { "sampler1DArray", QShaderDescription::Sampler1DArray },
+ { "sampler2DArray", QShaderDescription::Sampler2DArray },
+ { "sampler2DMSArray", QShaderDescription::Sampler2DMSArray },
+ { "sampler3DArray", QShaderDescription::Sampler3DArray },
+ { "samplerCubeArray", QShaderDescription::SamplerCubeArray },
+ { "samplerRect", QShaderDescription::SamplerRect },
+ { "samplerBuffer", QShaderDescription::SamplerBuffer },
+ { "samplerExternalOES", QShaderDescription::SamplerExternalOES },
+ { "sampler", QShaderDescription::Sampler },
+
+ { "mat2x3", QShaderDescription::Mat2x3 },
+ { "mat2x4", QShaderDescription::Mat2x4 },
+ { "mat3x2", QShaderDescription::Mat3x2 },
+ { "mat3x4", QShaderDescription::Mat3x4 },
+ { "mat4x2", QShaderDescription::Mat4x2 },
+ { "mat4x3", QShaderDescription::Mat4x3 },
+
+ { "int", QShaderDescription::Int },
+ { "ivec2", QShaderDescription::Int2 },
+ { "ivec3", QShaderDescription::Int3 },
+ { "ivec4", QShaderDescription::Int4 },
+
+ { "uint", QShaderDescription::Uint },
+ { "uvec2", QShaderDescription::Uint2 },
+ { "uvec3", QShaderDescription::Uint3 },
+ { "uvec4", QShaderDescription::Uint4 },
+
+ { "bool", QShaderDescription::Bool },
+ { "bvec2", QShaderDescription::Bool2 },
+ { "bvec3", QShaderDescription::Bool3 },
+ { "bvec4", QShaderDescription::Bool4 },
+
+ { "double", QShaderDescription::Double },
+ { "dvec2", QShaderDescription::Double2 },
+ { "dvec3", QShaderDescription::Double3 },
+ { "dvec4", QShaderDescription::Double4 },
+ { "dmat2", QShaderDescription::DMat2 },
+ { "dmat3", QShaderDescription::DMat3 },
+ { "dmat4", QShaderDescription::DMat4 },
+ { "dmat2x3", QShaderDescription::DMat2x3 },
+ { "dmat2x4", QShaderDescription::DMat2x4 },
+ { "dmat3x2", QShaderDescription::DMat3x2 },
+ { "dmat3x4", QShaderDescription::DMat3x4 },
+ { "dmat4x2", QShaderDescription::DMat4x2 },
+ { "dmat4x3", QShaderDescription::DMat4x3 },
+
+ { "image1D", QShaderDescription::Image1D },
+ { "image2D", QShaderDescription::Image2D },
+ { "image2DMS", QShaderDescription::Image2DMS },
+ { "image3D", QShaderDescription::Image3D },
+ { "imageCube", QShaderDescription::ImageCube },
+ { "image1DArray", QShaderDescription::Image1DArray },
+ { "image2DArray", QShaderDescription::Image2DArray },
+ { "image2DMSArray", QShaderDescription::Image2DMSArray },
+ { "image3DArray", QShaderDescription::Image3DArray },
+ { "imageCubeArray", QShaderDescription::ImageCubeArray },
+ { "imageRect", QShaderDescription::ImageRect },
+ { "imageBuffer", QShaderDescription::ImageBuffer },
+
+ { "half", QShaderDescription::Half },
+ { "half2", QShaderDescription::Half2 },
+ { "half3", QShaderDescription::Half3 },
+ { "half4", QShaderDescription::Half4 } };
+
+static QLatin1StringView typeStr(QShaderDescription::VariableType t)
{
for (size_t i = 0; i < sizeof(typeTab) / sizeof(TypeTab); ++i) {
- if (typeTab[i].k == t)
- return typeTab[i].v;
+ if (typeTab[i].v == t)
+ return QLatin1StringView(typeTab[i].k);
}
- return QShaderDescription::Unknown;
+ return {};
}
-static struct ImageFormatTab {
- QString k;
+static const struct ImageFormatTab {
+ const char k[15];
QShaderDescription::ImageFormat v;
} imageFormatTab[] {
- { QLatin1String("unknown"), QShaderDescription::ImageFormatUnknown },
- { QLatin1String("rgba32f"), QShaderDescription::ImageFormatRgba32f },
- { QLatin1String("rgba16"), QShaderDescription::ImageFormatRgba16f },
- { QLatin1String("r32f"), QShaderDescription::ImageFormatR32f },
- { QLatin1String("rgba8"), QShaderDescription::ImageFormatRgba8 },
- { QLatin1String("rgba8_snorm"), QShaderDescription::ImageFormatRgba8Snorm },
- { QLatin1String("rg32f"), QShaderDescription::ImageFormatRg32f },
- { QLatin1String("rg16f"), QShaderDescription::ImageFormatRg16f },
- { QLatin1String("r11f_g11f_b10f"), QShaderDescription::ImageFormatR11fG11fB10f },
- { QLatin1String("r16f"), QShaderDescription::ImageFormatR16f },
- { QLatin1String("rgba16"), QShaderDescription::ImageFormatRgba16 },
- { QLatin1String("rgb10_a2"), QShaderDescription::ImageFormatRgb10A2 },
- { QLatin1String("rg16"), QShaderDescription::ImageFormatRg16 },
- { QLatin1String("rg8"), QShaderDescription::ImageFormatRg8 },
- { QLatin1String("r16"), QShaderDescription::ImageFormatR16 },
- { QLatin1String("r8"), QShaderDescription::ImageFormatR8 },
- { QLatin1String("rgba16_snorm"), QShaderDescription::ImageFormatRgba16Snorm },
- { QLatin1String("rg16_snorm"), QShaderDescription::ImageFormatRg16Snorm },
- { QLatin1String("rg8_snorm"), QShaderDescription::ImageFormatRg8Snorm },
- { QLatin1String("r16_snorm"), QShaderDescription::ImageFormatR16Snorm },
- { QLatin1String("r8_snorm"), QShaderDescription::ImageFormatR8Snorm },
- { QLatin1String("rgba32i"), QShaderDescription::ImageFormatRgba32i },
- { QLatin1String("rgba16i"), QShaderDescription::ImageFormatRgba16i },
- { QLatin1String("rgba8i"), QShaderDescription::ImageFormatRgba8i },
- { QLatin1String("r32i"), QShaderDescription::ImageFormatR32i },
- { QLatin1String("rg32i"), QShaderDescription::ImageFormatRg32i },
- { QLatin1String("rg16i"), QShaderDescription::ImageFormatRg16i },
- { QLatin1String("rg8i"), QShaderDescription::ImageFormatRg8i },
- { QLatin1String("r16i"), QShaderDescription::ImageFormatR16i },
- { QLatin1String("r8i"), QShaderDescription::ImageFormatR8i },
- { QLatin1String("rgba32ui"), QShaderDescription::ImageFormatRgba32ui },
- { QLatin1String("rgba16ui"), QShaderDescription::ImageFormatRgba16ui },
- { QLatin1String("rgba8ui"), QShaderDescription::ImageFormatRgba8ui },
- { QLatin1String("r32ui"), QShaderDescription::ImageFormatR32ui },
- { QLatin1String("rgb10_a2ui"), QShaderDescription::ImageFormatRgb10a2ui },
- { QLatin1String("rg32ui"), QShaderDescription::ImageFormatRg32ui },
- { QLatin1String("rg16ui"), QShaderDescription::ImageFormatRg16ui },
- { QLatin1String("rg8ui"), QShaderDescription::ImageFormatRg8ui },
- { QLatin1String("r16ui"), QShaderDescription::ImageFormatR16ui },
- { QLatin1String("r8ui"), QShaderDescription::ImageFormatR8ui }
+ { "unknown", QShaderDescription::ImageFormatUnknown },
+ { "rgba32f", QShaderDescription::ImageFormatRgba32f },
+ { "rgba16", QShaderDescription::ImageFormatRgba16f },
+ { "r32f", QShaderDescription::ImageFormatR32f },
+ { "rgba8", QShaderDescription::ImageFormatRgba8 },
+ { "rgba8_snorm", QShaderDescription::ImageFormatRgba8Snorm },
+ { "rg32f", QShaderDescription::ImageFormatRg32f },
+ { "rg16f", QShaderDescription::ImageFormatRg16f },
+ { "r11f_g11f_b10f", QShaderDescription::ImageFormatR11fG11fB10f },
+ { "r16f", QShaderDescription::ImageFormatR16f },
+ { "rgba16", QShaderDescription::ImageFormatRgba16 },
+ { "rgb10_a2", QShaderDescription::ImageFormatRgb10A2 },
+ { "rg16", QShaderDescription::ImageFormatRg16 },
+ { "rg8", QShaderDescription::ImageFormatRg8 },
+ { "r16", QShaderDescription::ImageFormatR16 },
+ { "r8", QShaderDescription::ImageFormatR8 },
+ { "rgba16_snorm", QShaderDescription::ImageFormatRgba16Snorm },
+ { "rg16_snorm", QShaderDescription::ImageFormatRg16Snorm },
+ { "rg8_snorm", QShaderDescription::ImageFormatRg8Snorm },
+ { "r16_snorm", QShaderDescription::ImageFormatR16Snorm },
+ { "r8_snorm", QShaderDescription::ImageFormatR8Snorm },
+ { "rgba32i", QShaderDescription::ImageFormatRgba32i },
+ { "rgba16i", QShaderDescription::ImageFormatRgba16i },
+ { "rgba8i", QShaderDescription::ImageFormatRgba8i },
+ { "r32i", QShaderDescription::ImageFormatR32i },
+ { "rg32i", QShaderDescription::ImageFormatRg32i },
+ { "rg16i", QShaderDescription::ImageFormatRg16i },
+ { "rg8i", QShaderDescription::ImageFormatRg8i },
+ { "r16i", QShaderDescription::ImageFormatR16i },
+ { "r8i", QShaderDescription::ImageFormatR8i },
+ { "rgba32ui", QShaderDescription::ImageFormatRgba32ui },
+ { "rgba16ui", QShaderDescription::ImageFormatRgba16ui },
+ { "rgba8ui", QShaderDescription::ImageFormatRgba8ui },
+ { "r32ui", QShaderDescription::ImageFormatR32ui },
+ { "rgb10_a2ui", QShaderDescription::ImageFormatRgb10a2ui },
+ { "rg32ui", QShaderDescription::ImageFormatRg32ui },
+ { "rg16ui", QShaderDescription::ImageFormatRg16ui },
+ { "rg8ui", QShaderDescription::ImageFormatRg8ui },
+ { "r16ui", QShaderDescription::ImageFormatR16ui },
+ { "r8ui", QShaderDescription::ImageFormatR8ui }
};
-static QString imageFormatStr(const QShaderDescription::ImageFormat &f)
+static QLatin1StringView imageFormatStr(QShaderDescription::ImageFormat f)
{
for (size_t i = 0; i < sizeof(imageFormatTab) / sizeof(ImageFormatTab); ++i) {
if (imageFormatTab[i].v == f)
- return imageFormatTab[i].k;
+ return QLatin1StringView(imageFormatTab[i].k);
+ }
+ return {};
+}
+
+static const struct BuiltinTypeTab {
+ const char k[21];
+ QShaderDescription::BuiltinType v;
+} builtinTypeTab[] = {
+ { "Position", QShaderDescription::PositionBuiltin },
+ { "PointSize", QShaderDescription::PointSizeBuiltin },
+ { "ClipDistance", QShaderDescription::ClipDistanceBuiltin },
+ { "CullDistance", QShaderDescription::CullDistanceBuiltin },
+ { "VertexId", QShaderDescription::VertexIdBuiltin },
+ { "InstanceId", QShaderDescription::InstanceIdBuiltin },
+ { "PrimitiveId", QShaderDescription::PrimitiveIdBuiltin },
+ { "InvocationId", QShaderDescription::InvocationIdBuiltin },
+ { "Layer", QShaderDescription::LayerBuiltin },
+ { "ViewportIndex", QShaderDescription::ViewportIndexBuiltin },
+ { "TessLevelOuter", QShaderDescription::TessLevelOuterBuiltin },
+ { "TessLevelInner", QShaderDescription::TessLevelInnerBuiltin },
+ { "TessCoord", QShaderDescription::TessCoordBuiltin },
+ { "PatchVertices", QShaderDescription::PatchVerticesBuiltin },
+ { "FragCoord", QShaderDescription::FragCoordBuiltin },
+ { "PointCoord", QShaderDescription::PointCoordBuiltin },
+ { "FrontFacing", QShaderDescription::FrontFacingBuiltin },
+ { "SampleId", QShaderDescription::SampleIdBuiltin },
+ { "SamplePosition", QShaderDescription::SamplePositionBuiltin },
+ { "SampleMask", QShaderDescription::SampleMaskBuiltin },
+ { "FragDepth", QShaderDescription::FragDepthBuiltin },
+ { "NumWorkGroups", QShaderDescription::NumWorkGroupsBuiltin },
+ { "WorkgroupSize", QShaderDescription::WorkgroupSizeBuiltin },
+ { "WorkgroupId", QShaderDescription::WorkgroupIdBuiltin },
+ { "LocalInvocationId", QShaderDescription::LocalInvocationIdBuiltin },
+ { "GlobalInvocationId", QShaderDescription::GlobalInvocationIdBuiltin },
+ { "LocalInvocationIndex", QShaderDescription::LocalInvocationIndexBuiltin },
+ { "VertexIndex", QShaderDescription::VertexIndexBuiltin },
+ { "InstanceIndex", QShaderDescription::InstanceIndexBuiltin }
+};
+
+static QLatin1StringView builtinTypeStr(QShaderDescription::BuiltinType t)
+{
+ for (size_t i = 0; i < sizeof(builtinTypeTab) / sizeof(BuiltinTypeTab); ++i) {
+ if (builtinTypeTab[i].v == t)
+ return QLatin1StringView(builtinTypeTab[i].k);
}
- return QString();
+ return {};
}
-static QShaderDescription::ImageFormat mapImageFormat(const QString &f)
+static const struct TessellationModeTab {
+ const char k[10];
+ QShaderDescription::TessellationMode v;
+} tessellationModeTab[] {
+ { "unknown", QShaderDescription::UnknownTessellationMode },
+ { "triangles", QShaderDescription::TrianglesTessellationMode },
+ { "quad", QShaderDescription::QuadTessellationMode },
+ { "isoline", QShaderDescription::IsolineTessellationMode }
+};
+
+static QLatin1StringView tessModeStr(QShaderDescription::TessellationMode mode)
{
- for (size_t i = 0; i < sizeof(imageFormatTab) / sizeof(ImageFormatTab); ++i) {
- if (imageFormatTab[i].k == f)
- return imageFormatTab[i].v;
+ for (size_t i = 0; i < sizeof(tessellationModeTab) / sizeof(TessellationModeTab); ++i) {
+ if (tessellationModeTab[i].v == mode)
+ return QLatin1StringView(tessellationModeTab[i].k);
+ }
+ return {};
+}
+
+static const struct TessellationWindingOrderTab {
+ const char k[8];
+ QShaderDescription::TessellationWindingOrder v;
+} tessellationWindingOrderTab[] {
+ { "unknown", QShaderDescription::UnknownTessellationWindingOrder },
+ { "cw", QShaderDescription::CwTessellationWindingOrder },
+ { "ccw", QShaderDescription::CcwTessellationWindingOrder }
+};
+
+static QLatin1StringView tessWindStr(QShaderDescription::TessellationWindingOrder w)
+{
+ for (size_t i = 0; i < sizeof(tessellationWindingOrderTab) / sizeof(TessellationWindingOrderTab); ++i) {
+ if (tessellationWindingOrderTab[i].v == w)
+ return QLatin1StringView(tessellationWindingOrderTab[i].k);
}
- return QShaderDescription::ImageFormatUnknown;
+ return {};
+}
+
+static const struct TessellationPartitioningTab {
+ const char k[24];
+ QShaderDescription::TessellationPartitioning v;
+} tessellationPartitioningTab[] {
+ { "unknown", QShaderDescription::UnknownTessellationPartitioning },
+ { "equal_spacing", QShaderDescription::EqualTessellationPartitioning },
+ { "fractional_even_spacing", QShaderDescription::FractionalEvenTessellationPartitioning },
+ { "fractional_odd_spacing", QShaderDescription::FractionalOddTessellationPartitioning }
+};
+
+static QLatin1StringView tessPartStr(QShaderDescription::TessellationPartitioning p)
+{
+ for (size_t i = 0; i < sizeof(tessellationPartitioningTab) / sizeof(TessellationPartitioningTab); ++i) {
+ if (tessellationPartitioningTab[i].v == p)
+ return QLatin1StringView(tessellationPartitioningTab[i].k);
+ }
+ return {};
}
#ifndef QT_NO_DEBUG_STREAM
@@ -762,7 +1204,11 @@ QDebug operator<<(QDebug dbg, const QShaderDescription &sd)
<< " pcBlocks " << d->pushConstantBlocks
<< " storageBlocks " << d->storageBlocks
<< " combinedSamplers " << d->combinedImageSamplers
- << " images " << d->storageImages
+ << " storageImages " << d->storageImages
+ << " separateImages " << d->separateImages
+ << " separateSamplers " << d->separateSamplers
+ << " inBuiltins " << d->inBuiltins
+ << " outBuiltins " << d->outBuiltins
<< ')';
} else {
dbg.nospace() << "QShaderDescription(null)";
@@ -775,6 +1221,8 @@ QDebug operator<<(QDebug dbg, const QShaderDescription::InOutVariable &var)
{
QDebugStateSaver saver(dbg);
dbg.nospace() << "InOutVariable(" << typeStr(var.type) << ' ' << var.name;
+ if (var.perPatch)
+ dbg.nospace() << " per-patch";
if (var.location >= 0)
dbg.nospace() << " location=" << var.location;
if (var.binding >= 0)
@@ -785,6 +1233,10 @@ QDebug operator<<(QDebug dbg, const QShaderDescription::InOutVariable &var)
dbg.nospace() << " imageFormat=" << imageFormatStr(var.imageFormat);
if (var.imageFlags)
dbg.nospace() << " imageFlags=" << var.imageFlags;
+ if (!var.arrayDims.isEmpty())
+ dbg.nospace() << " array=" << var.arrayDims;
+ if (!var.structMembers.isEmpty())
+ dbg.nospace() << " structMembers=" << var.structMembers;
dbg.nospace() << ')';
return dbg;
}
@@ -792,8 +1244,10 @@ QDebug operator<<(QDebug dbg, const QShaderDescription::InOutVariable &var)
QDebug operator<<(QDebug dbg, const QShaderDescription::BlockVariable &var)
{
QDebugStateSaver saver(dbg);
- dbg.nospace() << "BlockVariable(" << typeStr(var.type) << ' ' << var.name
- << " offset=" << var.offset << " size=" << var.size;
+ dbg.nospace() << "BlockVariable(" << typeStr(var.type) << ' ' << var.name;
+ if (var.offset != -1)
+ dbg.nospace() << " offset=" << var.offset;
+ dbg.nospace() << " size=" << var.size;
if (!var.arrayDims.isEmpty())
dbg.nospace() << " array=" << var.arrayDims;
if (var.arrayStride)
@@ -811,7 +1265,8 @@ QDebug operator<<(QDebug dbg, const QShaderDescription::BlockVariable &var)
QDebug operator<<(QDebug dbg, const QShaderDescription::UniformBlock &blk)
{
QDebugStateSaver saver(dbg);
- dbg.nospace() << "UniformBlock(" << blk.blockName << ' ' << blk.structName << " size=" << blk.size;
+ dbg.nospace() << "UniformBlock(" << blk.blockName << ' ' << blk.structName
+ << " size=" << blk.size;
if (blk.binding >= 0)
dbg.nospace() << " binding=" << blk.binding;
if (blk.descriptorSet >= 0)
@@ -823,346 +1278,697 @@ QDebug operator<<(QDebug dbg, const QShaderDescription::UniformBlock &blk)
QDebug operator<<(QDebug dbg, const QShaderDescription::PushConstantBlock &blk)
{
QDebugStateSaver saver(dbg);
- dbg.nospace() << "PushConstantBlock(" << blk.name << " size=" << blk.size << ' ' << blk.members << ')';
+ dbg.nospace() << "PushConstantBlock(" << blk.name << " size=" << blk.size << ' ' << blk.members
+ << ')';
return dbg;
}
QDebug operator<<(QDebug dbg, const QShaderDescription::StorageBlock &blk)
{
QDebugStateSaver saver(dbg);
- dbg.nospace() << "StorageBlock(" << blk.blockName << ' ' << blk.instanceName << " knownSize=" << blk.knownSize;
+ dbg.nospace() << "StorageBlock(" << blk.blockName << ' ' << blk.instanceName
+ << " knownSize=" << blk.knownSize;
if (blk.binding >= 0)
dbg.nospace() << " binding=" << blk.binding;
if (blk.descriptorSet >= 0)
dbg.nospace() << " set=" << blk.descriptorSet;
+ if (blk.runtimeArrayStride)
+ dbg.nospace() << " runtimeArrayStride=" << blk.runtimeArrayStride;
+ if (blk.qualifierFlags)
+ dbg.nospace() << " qualifierFlags=" << blk.qualifierFlags;
dbg.nospace() << ' ' << blk.members << ')';
return dbg;
}
+
+QDebug operator<<(QDebug dbg, const QShaderDescription::BuiltinVariable &builtin)
+{
+ QDebugStateSaver saver(dbg);
+ dbg.nospace() << "BuiltinVariable(type=" << builtinTypeStr(builtin.type);
+ dbg.nospace() << " varType=" << typeStr(builtin.varType);
+ if (!builtin.arrayDims.isEmpty())
+ dbg.nospace() << " array=" << builtin.arrayDims;
+ dbg.nospace() << ")";
+ return dbg;
+}
#endif
-static const QString nameKey = QLatin1String("name");
-static const QString typeKey = QLatin1String("type");
-static const QString locationKey = QLatin1String("location");
-static const QString bindingKey = QLatin1String("binding");
-static const QString setKey = QLatin1String("set");
-static const QString imageFormatKey = QLatin1String("imageFormat");
-static const QString imageFlagsKey = QLatin1String("imageFlags");
-static const QString offsetKey = QLatin1String("offset");
-static const QString arrayDimsKey = QLatin1String("arrayDims");
-static const QString arrayStrideKey = QLatin1String("arrayStride");
-static const QString matrixStrideKey = QLatin1String("matrixStride");
-static const QString matrixRowMajorKey = QLatin1String("matrixRowMajor");
-static const QString structMembersKey = QLatin1String("structMembers");
-static const QString membersKey = QLatin1String("members");
-static const QString inputsKey = QLatin1String("inputs");
-static const QString outputsKey = QLatin1String("outputs");
-static const QString uniformBlocksKey = QLatin1String("uniformBlocks");
-static const QString blockNameKey = QLatin1String("blockName");
-static const QString structNameKey = QLatin1String("structName");
-static const QString instanceNameKey = QLatin1String("instanceName");
-static const QString sizeKey = QLatin1String("size");
-static const QString knownSizeKey = QLatin1String("knownSize");
-static const QString pushConstantBlocksKey = QLatin1String("pushConstantBlocks");
-static const QString storageBlocksKey = QLatin1String("storageBlocks");
-static const QString combinedImageSamplersKey = QLatin1String("combinedImageSamplers");
-static const QString storageImagesKey = QLatin1String("storageImages");
-static const QString localSizeKey = QLatin1String("localSize");
+#define JSON_KEY(key) static constexpr QLatin1StringView key ## Key() noexcept { return QLatin1StringView( #key ); }
+JSON_KEY(name)
+JSON_KEY(type)
+JSON_KEY(location)
+JSON_KEY(binding)
+JSON_KEY(set)
+JSON_KEY(perPatch)
+JSON_KEY(imageFormat)
+JSON_KEY(imageFlags)
+JSON_KEY(offset)
+JSON_KEY(arrayDims)
+JSON_KEY(arrayStride)
+JSON_KEY(matrixStride)
+JSON_KEY(matrixRowMajor)
+JSON_KEY(structMembers)
+JSON_KEY(members)
+JSON_KEY(inputs)
+JSON_KEY(outputs)
+JSON_KEY(uniformBlocks)
+JSON_KEY(blockName)
+JSON_KEY(structName)
+JSON_KEY(instanceName)
+JSON_KEY(size)
+JSON_KEY(knownSize)
+JSON_KEY(pushConstantBlocks)
+JSON_KEY(storageBlocks)
+JSON_KEY(combinedImageSamplers)
+JSON_KEY(storageImages)
+JSON_KEY(inBuiltins)
+JSON_KEY(outBuiltins)
+JSON_KEY(computeLocalSize)
+JSON_KEY(tessellationOutputVertexCount)
+JSON_KEY(tessellationMode)
+JSON_KEY(tessellationWindingOrder)
+JSON_KEY(tessellationPartitioning)
+JSON_KEY(separateImages)
+JSON_KEY(separateSamplers)
+JSON_KEY(runtimeArrayStride)
+JSON_KEY(qualifierFlags)
+#undef JSON_KEY
static void addDeco(QJsonObject *obj, const QShaderDescription::InOutVariable &v)
{
if (v.location >= 0)
- (*obj)[locationKey] = v.location;
+ (*obj)[locationKey()] = v.location;
if (v.binding >= 0)
- (*obj)[bindingKey] = v.binding;
+ (*obj)[bindingKey()] = v.binding;
if (v.descriptorSet >= 0)
- (*obj)[setKey] = v.descriptorSet;
+ (*obj)[setKey()] = v.descriptorSet;
+ if (v.perPatch)
+ (*obj)[perPatchKey()] = v.perPatch;
if (v.imageFormat != QShaderDescription::ImageFormatUnknown)
- (*obj)[imageFormatKey] = imageFormatStr(v.imageFormat);
+ (*obj)[imageFormatKey()] = imageFormatStr(v.imageFormat);
if (v.imageFlags)
- (*obj)[imageFlagsKey] = int(v.imageFlags);
+ (*obj)[imageFlagsKey()] = int(v.imageFlags);
+ if (!v.arrayDims.isEmpty()) {
+ QJsonArray dimArr;
+ for (int dim : v.arrayDims)
+ dimArr.append(dim);
+ (*obj)[arrayDimsKey()] = dimArr;
+ }
}
-static QJsonObject inOutObject(const QShaderDescription::InOutVariable &v)
+static void serializeDecorations(QDataStream *stream, const QShaderDescription::InOutVariable &v, int version)
{
- QJsonObject obj;
- obj[nameKey] = v.name;
- obj[typeKey] = typeStr(v.type);
- addDeco(&obj, v);
- return obj;
+ (*stream) << v.location;
+ (*stream) << v.binding;
+ (*stream) << v.descriptorSet;
+ (*stream) << int(v.imageFormat);
+ (*stream) << int(v.imageFlags);
+ (*stream) << int(v.arrayDims.size());
+ for (int dim : v.arrayDims)
+ (*stream) << dim;
+ if (version > QShaderPrivate::QSB_VERSION_WITHOUT_NATIVE_SHADER_INFO)
+ (*stream) << quint8(v.perPatch);
+}
+
+static void serializeBuiltinVar(QDataStream *stream, const QShaderDescription::BuiltinVariable &v, int version)
+{
+ (*stream) << int(v.type);
+ if (version > QShaderPrivate::QSB_VERSION_WITHOUT_INPUT_OUTPUT_INTERFACE_BLOCKS) {
+ (*stream) << int(v.varType);
+ (*stream) << int(v.arrayDims.size());
+ for (int dim : v.arrayDims)
+ (*stream) << dim;
+ }
}
static QJsonObject blockMemberObject(const QShaderDescription::BlockVariable &v)
{
QJsonObject obj;
- obj[nameKey] = v.name;
- obj[typeKey] = typeStr(v.type);
- obj[offsetKey] = v.offset;
- obj[sizeKey] = v.size;
+ obj[nameKey()] = QString::fromUtf8(v.name);
+ obj[typeKey()] = typeStr(v.type);
+ if (v.offset != -1)
+ obj[offsetKey()] = v.offset;
+ obj[sizeKey()] = v.size;
if (!v.arrayDims.isEmpty()) {
QJsonArray dimArr;
for (int dim : v.arrayDims)
dimArr.append(dim);
- obj[arrayDimsKey] = dimArr;
+ obj[arrayDimsKey()] = dimArr;
}
if (v.arrayStride)
- obj[arrayStrideKey] = v.arrayStride;
+ obj[arrayStrideKey()] = v.arrayStride;
if (v.matrixStride)
- obj[matrixStrideKey] = v.matrixStride;
+ obj[matrixStrideKey()] = v.matrixStride;
if (v.matrixIsRowMajor)
- obj[matrixRowMajorKey] = true;
+ obj[matrixRowMajorKey()] = true;
if (!v.structMembers.isEmpty()) {
QJsonArray arr;
for (const QShaderDescription::BlockVariable &sv : v.structMembers)
arr.append(blockMemberObject(sv));
- obj[structMembersKey] = arr;
+ obj[structMembersKey()] = arr;
}
return obj;
}
+static QJsonObject inOutObject(const QShaderDescription::InOutVariable &v)
+{
+ QJsonObject obj;
+ obj[nameKey()] = QString::fromUtf8(v.name);
+ obj[typeKey()] = typeStr(v.type);
+ addDeco(&obj, v);
+ if (!v.structMembers.isEmpty()) {
+ QJsonArray arr;
+ for (const QShaderDescription::BlockVariable &sv : v.structMembers)
+ arr.append(blockMemberObject(sv));
+ obj[structMembersKey()] = arr;
+ }
+ return obj;
+}
+
+static QJsonObject builtinObject(const QShaderDescription::BuiltinVariable &v)
+{
+ QJsonObject obj;
+
+ obj[nameKey()] = builtinTypeStr(v.type);
+ obj[typeKey()] = typeStr(v.varType);
+ if (!v.arrayDims.isEmpty()) {
+ QJsonArray dimArr;
+ for (int dim : v.arrayDims)
+ dimArr.append(dim);
+ obj[arrayDimsKey()] = dimArr;
+ }
+ return obj;
+}
+
+static void serializeBlockMemberVar(QDataStream *stream, const QShaderDescription::BlockVariable &v)
+{
+ (*stream) << QString::fromUtf8(v.name);
+ (*stream) << int(v.type);
+ (*stream) << v.offset;
+ (*stream) << v.size;
+ (*stream) << int(v.arrayDims.size());
+ for (int dim : v.arrayDims)
+ (*stream) << dim;
+ (*stream) << v.arrayStride;
+ (*stream) << v.matrixStride;
+ (*stream) << v.matrixIsRowMajor;
+ (*stream) << int(v.structMembers.size());
+ for (const QShaderDescription::BlockVariable &sv : v.structMembers)
+ serializeBlockMemberVar(stream, sv);
+}
+
+static void serializeInOutVar(QDataStream *stream, const QShaderDescription::InOutVariable &v,
+ int version)
+{
+ (*stream) << QString::fromUtf8(v.name);
+ (*stream) << int(v.type);
+ serializeDecorations(stream, v, version);
+ if (version > QShaderPrivate::QSB_VERSION_WITHOUT_INPUT_OUTPUT_INTERFACE_BLOCKS) {
+ (*stream) << int(v.structMembers.size());
+ for (const QShaderDescription::BlockVariable &sv : v.structMembers)
+ serializeBlockMemberVar(stream, sv);
+ }
+}
+
QJsonDocument QShaderDescriptionPrivate::makeDoc()
{
QJsonObject root;
QJsonArray jinputs;
- for (const QShaderDescription::InOutVariable &v : qAsConst(inVars))
+ for (const QShaderDescription::InOutVariable &v : std::as_const(inVars))
jinputs.append(inOutObject(v));
if (!jinputs.isEmpty())
- root[inputsKey] = jinputs;
+ root[inputsKey()] = jinputs;
QJsonArray joutputs;
- for (const QShaderDescription::InOutVariable &v : qAsConst(outVars))
+ for (const QShaderDescription::InOutVariable &v : std::as_const(outVars))
joutputs.append(inOutObject(v));
if (!joutputs.isEmpty())
- root[outputsKey] = joutputs;
+ root[outputsKey()] = joutputs;
QJsonArray juniformBlocks;
for (const QShaderDescription::UniformBlock &b : uniformBlocks) {
QJsonObject juniformBlock;
- juniformBlock[blockNameKey] = b.blockName;
- juniformBlock[structNameKey] = b.structName;
- juniformBlock[sizeKey] = b.size;
+ juniformBlock[blockNameKey()] = QString::fromUtf8(b.blockName);
+ juniformBlock[structNameKey()] = QString::fromUtf8(b.structName);
+ juniformBlock[sizeKey()] = b.size;
if (b.binding >= 0)
- juniformBlock[bindingKey] = b.binding;
+ juniformBlock[bindingKey()] = b.binding;
if (b.descriptorSet >= 0)
- juniformBlock[setKey] = b.descriptorSet;
+ juniformBlock[setKey()] = b.descriptorSet;
QJsonArray members;
for (const QShaderDescription::BlockVariable &v : b.members)
members.append(blockMemberObject(v));
- juniformBlock[membersKey] = members;
+ juniformBlock[membersKey()] = members;
juniformBlocks.append(juniformBlock);
}
if (!juniformBlocks.isEmpty())
- root[uniformBlocksKey] = juniformBlocks;
+ root[uniformBlocksKey()] = juniformBlocks;
QJsonArray jpushConstantBlocks;
for (const QShaderDescription::PushConstantBlock &b : pushConstantBlocks) {
QJsonObject jpushConstantBlock;
- jpushConstantBlock[nameKey] = b.name;
- jpushConstantBlock[sizeKey] = b.size;
+ jpushConstantBlock[nameKey()] = QString::fromUtf8(b.name);
+ jpushConstantBlock[sizeKey()] = b.size;
QJsonArray members;
for (const QShaderDescription::BlockVariable &v : b.members)
members.append(blockMemberObject(v));
- jpushConstantBlock[membersKey] = members;
+ jpushConstantBlock[membersKey()] = members;
jpushConstantBlocks.append(jpushConstantBlock);
}
if (!jpushConstantBlocks.isEmpty())
- root[pushConstantBlocksKey] = jpushConstantBlocks;
+ root[pushConstantBlocksKey()] = jpushConstantBlocks;
QJsonArray jstorageBlocks;
for (const QShaderDescription::StorageBlock &b : storageBlocks) {
QJsonObject jstorageBlock;
- jstorageBlock[blockNameKey] = b.blockName;
- jstorageBlock[instanceNameKey] = b.instanceName;
- jstorageBlock[knownSizeKey] = b.knownSize;
+ jstorageBlock[blockNameKey()] = QString::fromUtf8(b.blockName);
+ jstorageBlock[instanceNameKey()] = QString::fromUtf8(b.instanceName);
+ jstorageBlock[knownSizeKey()] = b.knownSize;
if (b.binding >= 0)
- jstorageBlock[bindingKey] = b.binding;
+ jstorageBlock[bindingKey()] = b.binding;
if (b.descriptorSet >= 0)
- jstorageBlock[setKey] = b.descriptorSet;
+ jstorageBlock[setKey()] = b.descriptorSet;
+ if (b.runtimeArrayStride)
+ jstorageBlock[runtimeArrayStrideKey()] = b.runtimeArrayStride;
+ if (b.qualifierFlags)
+ jstorageBlock[qualifierFlagsKey()] = int(b.qualifierFlags);
QJsonArray members;
for (const QShaderDescription::BlockVariable &v : b.members)
members.append(blockMemberObject(v));
- jstorageBlock[membersKey] = members;
+ jstorageBlock[membersKey()] = members;
jstorageBlocks.append(jstorageBlock);
}
if (!jstorageBlocks.isEmpty())
- root[storageBlocksKey] = jstorageBlocks;
+ root[storageBlocksKey()] = jstorageBlocks;
QJsonArray jcombinedSamplers;
- for (const QShaderDescription::InOutVariable &v : qAsConst(combinedImageSamplers)) {
+ for (const QShaderDescription::InOutVariable &v : std::as_const(combinedImageSamplers)) {
QJsonObject sampler;
- sampler[nameKey] = v.name;
- sampler[typeKey] = typeStr(v.type);
+ sampler[nameKey()] = QString::fromUtf8(v.name);
+ sampler[typeKey()] = typeStr(v.type);
addDeco(&sampler, v);
jcombinedSamplers.append(sampler);
}
if (!jcombinedSamplers.isEmpty())
- root[combinedImageSamplersKey] = jcombinedSamplers;
+ root[combinedImageSamplersKey()] = jcombinedSamplers;
QJsonArray jstorageImages;
- for (const QShaderDescription::InOutVariable &v : qAsConst(storageImages)) {
+ for (const QShaderDescription::InOutVariable &v : std::as_const(storageImages)) {
QJsonObject image;
- image[nameKey] = v.name;
- image[typeKey] = typeStr(v.type);
+ image[nameKey()] = QString::fromUtf8(v.name);
+ image[typeKey()] = typeStr(v.type);
addDeco(&image, v);
jstorageImages.append(image);
}
if (!jstorageImages.isEmpty())
- root[storageImagesKey] = jstorageImages;
+ root[storageImagesKey()] = jstorageImages;
+
+ QJsonArray jinBuiltins;
+ for (const QShaderDescription::BuiltinVariable &v : std::as_const(inBuiltins))
+ jinBuiltins.append(builtinObject(v));
+ if (!jinBuiltins.isEmpty())
+ root[inBuiltinsKey()] = jinBuiltins;
+
+ QJsonArray joutBuiltins;
+ for (const QShaderDescription::BuiltinVariable &v : std::as_const(outBuiltins))
+ joutBuiltins.append(builtinObject(v));
+ if (!joutBuiltins.isEmpty())
+ root[outBuiltinsKey()] = joutBuiltins;
+
+ if (localSize[0] || localSize[1] || localSize[2]) {
+ QJsonArray jlocalSize;
+ for (size_t i = 0; i < 3; ++i)
+ jlocalSize.append(QJsonValue(int(localSize[i])));
+ root[computeLocalSizeKey()] = jlocalSize;
+ }
- QJsonArray jlocalSize;
- for (int i = 0; i < 3; ++i)
- jlocalSize.append(QJsonValue(int(localSize[i])));
- root[localSizeKey] = jlocalSize;
+ if (tessOutVertCount)
+ root[tessellationOutputVertexCountKey()] = int(tessOutVertCount);
+
+ if (tessMode != QShaderDescription::UnknownTessellationMode)
+ root[tessellationModeKey()] = tessModeStr(tessMode);
+
+ if (tessWind != QShaderDescription::UnknownTessellationWindingOrder)
+ root[tessellationWindingOrderKey()] = tessWindStr(tessWind);
+
+ if (tessPart != QShaderDescription::UnknownTessellationPartitioning)
+ root[tessellationPartitioningKey()] = tessPartStr(tessPart);
+
+ QJsonArray jseparateImages;
+ for (const QShaderDescription::InOutVariable &v : std::as_const(separateImages)) {
+ QJsonObject image;
+ image[nameKey()] = QString::fromUtf8(v.name);
+ image[typeKey()] = typeStr(v.type);
+ addDeco(&image, v);
+ jseparateImages.append(image);
+ }
+ if (!jseparateImages.isEmpty())
+ root[separateImagesKey()] = jseparateImages;
+
+ QJsonArray jseparateSamplers;
+ for (const QShaderDescription::InOutVariable &v : std::as_const(separateSamplers)) {
+ QJsonObject sampler;
+ sampler[nameKey()] = QString::fromUtf8(v.name);
+ sampler[typeKey()] = typeStr(v.type);
+ addDeco(&sampler, v);
+ jseparateSamplers.append(sampler);
+ }
+ if (!jseparateSamplers.isEmpty())
+ root[separateSamplersKey()] = jseparateSamplers;
return QJsonDocument(root);
}
-static QShaderDescription::InOutVariable inOutVar(const QJsonObject &obj)
+void QShaderDescriptionPrivate::writeToStream(QDataStream *stream, int version)
{
- QShaderDescription::InOutVariable var;
- var.name = obj[nameKey].toString();
- var.type = mapType(obj[typeKey].toString());
- if (obj.contains(locationKey))
- var.location = obj[locationKey].toInt();
- if (obj.contains(bindingKey))
- var.binding = obj[bindingKey].toInt();
- if (obj.contains(setKey))
- var.descriptorSet = obj[setKey].toInt();
- if (obj.contains(imageFormatKey))
- var.imageFormat = mapImageFormat(obj[imageFormatKey].toString());
- if (obj.contains(imageFlagsKey))
- var.imageFlags = QShaderDescription::ImageFlags(obj[imageFlagsKey].toInt());
- return var;
+ (*stream) << int(inVars.size());
+ for (const QShaderDescription::InOutVariable &v : std::as_const(inVars))
+ serializeInOutVar(stream, v, version);
+
+ (*stream) << int(outVars.size());
+ for (const QShaderDescription::InOutVariable &v : std::as_const(outVars))
+ serializeInOutVar(stream, v, version);
+
+ (*stream) << int(uniformBlocks.size());
+ for (const QShaderDescription::UniformBlock &b : uniformBlocks) {
+ (*stream) << QString::fromUtf8(b.blockName);
+ (*stream) << QString::fromUtf8(b.structName);
+ (*stream) << b.size;
+ (*stream) << b.binding;
+ (*stream) << b.descriptorSet;
+ (*stream) << int(b.members.size());
+ for (const QShaderDescription::BlockVariable &v : b.members)
+ serializeBlockMemberVar(stream, v);
+ }
+
+ (*stream) << int(pushConstantBlocks.size());
+ for (const QShaderDescription::PushConstantBlock &b : pushConstantBlocks) {
+ (*stream) << QString::fromUtf8(b.name);
+ (*stream) << b.size;
+ (*stream) << int(b.members.size());
+ for (const QShaderDescription::BlockVariable &v : b.members)
+ serializeBlockMemberVar(stream, v);
+ }
+
+ (*stream) << int(storageBlocks.size());
+ for (const QShaderDescription::StorageBlock &b : storageBlocks) {
+ (*stream) << QString::fromUtf8(b.blockName);
+ (*stream) << QString::fromUtf8(b.instanceName);
+ (*stream) << b.knownSize;
+ (*stream) << b.binding;
+ (*stream) << b.descriptorSet;
+ (*stream) << int(b.members.size());
+ for (const QShaderDescription::BlockVariable &v : b.members)
+ serializeBlockMemberVar(stream, v);
+ if (version > QShaderPrivate::QSB_VERSION_WITHOUT_EXTENDED_STORAGE_BUFFER_INFO) {
+ (*stream) << b.runtimeArrayStride;
+ (*stream) << b.qualifierFlags;
+ }
+ }
+
+ (*stream) << int(combinedImageSamplers.size());
+ for (const QShaderDescription::InOutVariable &v : std::as_const(combinedImageSamplers)) {
+ (*stream) << QString::fromUtf8(v.name);
+ (*stream) << int(v.type);
+ serializeDecorations(stream, v, version);
+ }
+
+ (*stream) << int(storageImages.size());
+ for (const QShaderDescription::InOutVariable &v : std::as_const(storageImages)) {
+ (*stream) << QString::fromUtf8(v.name);
+ (*stream) << int(v.type);
+ serializeDecorations(stream, v, version);
+ }
+
+ for (size_t i = 0; i < 3; ++i)
+ (*stream) << quint32(localSize[i]);
+
+ (*stream) << int(separateImages.size());
+ for (const QShaderDescription::InOutVariable &v : std::as_const(separateImages)) {
+ (*stream) << QString::fromUtf8(v.name);
+ (*stream) << int(v.type);
+ serializeDecorations(stream, v, version);
+ }
+
+ (*stream) << int(separateSamplers.size());
+ for (const QShaderDescription::InOutVariable &v : std::as_const(separateSamplers)) {
+ (*stream) << QString::fromUtf8(v.name);
+ (*stream) << int(v.type);
+ serializeDecorations(stream, v, version);
+ }
+
+ if (version > QShaderPrivate::QSB_VERSION_WITHOUT_NATIVE_SHADER_INFO) {
+ (*stream) << quint32(tessOutVertCount);
+ (*stream) << quint32(tessMode);
+ (*stream) << quint32(tessWind);
+ (*stream) << quint32(tessPart);
+
+ (*stream) << int(inBuiltins.size());
+ for (const QShaderDescription::BuiltinVariable &v : std::as_const(inBuiltins))
+ serializeBuiltinVar(stream, v, version);
+
+ (*stream) << int(outBuiltins.size());
+ for (const QShaderDescription::BuiltinVariable &v : std::as_const(outBuiltins))
+ serializeBuiltinVar(stream, v, version);
+ }
}
-static QShaderDescription::BlockVariable blockVar(const QJsonObject &obj)
+static void deserializeDecorations(QDataStream *stream, int version, QShaderDescription::InOutVariable *v)
{
- QShaderDescription::BlockVariable var;
- var.name = obj[nameKey].toString();
- var.type = mapType(obj[typeKey].toString());
- var.offset = obj[offsetKey].toInt();
- var.size = obj[sizeKey].toInt();
- if (obj.contains(arrayDimsKey)) {
- QJsonArray dimArr = obj[arrayDimsKey].toArray();
- for (int i = 0; i < dimArr.count(); ++i)
- var.arrayDims.append(dimArr.at(i).toInt());
+ (*stream) >> v->location;
+ (*stream) >> v->binding;
+ (*stream) >> v->descriptorSet;
+ int f;
+ (*stream) >> f;
+ v->imageFormat = QShaderDescription::ImageFormat(f);
+ (*stream) >> f;
+ v->imageFlags = QShaderDescription::ImageFlags(f);
+
+ if (version > QShaderPrivate::QSB_VERSION_WITHOUT_VAR_ARRAYDIMS) {
+ (*stream) >> f;
+ v->arrayDims.resize(f);
+ for (int i = 0; i < f; ++i)
+ (*stream) >> v->arrayDims[i];
}
- if (obj.contains(arrayStrideKey))
- var.arrayStride = obj[arrayStrideKey].toInt();
- if (obj.contains(matrixStrideKey))
- var.matrixStride = obj[matrixStrideKey].toInt();
- if (obj.contains(matrixRowMajorKey))
- var.matrixIsRowMajor = obj[matrixRowMajorKey].toBool();
- if (obj.contains(structMembersKey)) {
- QJsonArray arr = obj[structMembersKey].toArray();
- for (int i = 0; i < arr.count(); ++i)
- var.structMembers.append(blockVar(arr.at(i).toObject()));
+
+ if (version > QShaderPrivate::QSB_VERSION_WITHOUT_NATIVE_SHADER_INFO) {
+ quint8 b;
+ (*stream) >> b;
+ v->perPatch = b;
}
- return var;
}
-void QShaderDescriptionPrivate::loadDoc(const QJsonDocument &doc)
+static QShaderDescription::BuiltinVariable deserializeBuiltinVar(QDataStream *stream, int version)
{
- if (doc.isNull()) {
- qWarning("QShaderDescription: JSON document is empty");
- return;
+ QShaderDescription::BuiltinVariable var;
+ int t;
+ (*stream) >> t;
+ var.type = QShaderDescription::BuiltinType(t);
+ if (version > QShaderPrivate::QSB_VERSION_WITHOUT_INPUT_OUTPUT_INTERFACE_BLOCKS) {
+ (*stream) >> t;
+ var.varType = QShaderDescription::VariableType(t);
+ int count;
+ (*stream) >> count;
+ var.arrayDims.resize(count);
+ for (int i = 0; i < count; ++i)
+ (*stream) >> var.arrayDims[i];
}
+ return var;
+}
- Q_ASSERT(ref.loadRelaxed() == 1); // must be detached
+static QShaderDescription::BlockVariable deserializeBlockMemberVar(QDataStream *stream, int version)
+{
+ QShaderDescription::BlockVariable var;
+ QString tmp;
+ (*stream) >> tmp;
+ var.name = tmp.toUtf8();
+ int t;
+ (*stream) >> t;
+ var.type = QShaderDescription::VariableType(t);
+ (*stream) >> var.offset;
+ (*stream) >> var.size;
+ int count;
+ (*stream) >> count;
+ var.arrayDims.resize(count);
+ for (int i = 0; i < count; ++i)
+ (*stream) >> var.arrayDims[i];
+ (*stream) >> var.arrayStride;
+ (*stream) >> var.matrixStride;
+ (*stream) >> var.matrixIsRowMajor;
+ (*stream) >> count;
+ var.structMembers.resize(count);
+ for (int i = 0; i < count; ++i)
+ var.structMembers[i] = deserializeBlockMemberVar(stream, version);
+ return var;
+}
- inVars.clear();
- outVars.clear();
- uniformBlocks.clear();
- pushConstantBlocks.clear();
- storageBlocks.clear();
- combinedImageSamplers.clear();
- storageImages.clear();
+static QShaderDescription::InOutVariable deserializeInOutVar(QDataStream *stream, int version)
+{
+ QShaderDescription::InOutVariable var;
+ QString tmp;
+ (*stream) >> tmp;
+ var.name = tmp.toUtf8();
+ int t;
+ (*stream) >> t;
+ var.type = QShaderDescription::VariableType(t);
+ deserializeDecorations(stream, version, &var);
+ if (version > QShaderPrivate::QSB_VERSION_WITHOUT_INPUT_OUTPUT_INTERFACE_BLOCKS) {
+ int count;
+ (*stream) >> count;
+ var.structMembers.resize(count);
+ for (int i = 0; i < count; ++i)
+ var.structMembers[i] = deserializeBlockMemberVar(stream, version);
+ }
+ return var;
+}
- QJsonObject root = doc.object();
+void QShaderDescriptionPrivate::loadFromStream(QDataStream *stream, int version)
+{
+ Q_ASSERT(ref.loadRelaxed() == 1); // must be detached
- if (root.contains(inputsKey)) {
- QJsonArray inputs = root[inputsKey].toArray();
- for (int i = 0; i < inputs.count(); ++i)
- inVars.append(inOutVar(inputs[i].toObject()));
+ int count;
+ (*stream) >> count;
+ inVars.resize(count);
+ for (int i = 0; i < count; ++i)
+ inVars[i] = deserializeInOutVar(stream, version);
+
+ (*stream) >> count;
+ outVars.resize(count);
+ for (int i = 0; i < count; ++i)
+ outVars[i] = deserializeInOutVar(stream, version);
+
+ (*stream) >> count;
+ uniformBlocks.resize(count);
+ for (int i = 0; i < count; ++i) {
+ QString tmp;
+ (*stream) >> tmp;
+ uniformBlocks[i].blockName = tmp.toUtf8();
+ (*stream) >> tmp;
+ uniformBlocks[i].structName = tmp.toUtf8();
+ (*stream) >> uniformBlocks[i].size;
+ (*stream) >> uniformBlocks[i].binding;
+ (*stream) >> uniformBlocks[i].descriptorSet;
+ int memberCount;
+ (*stream) >> memberCount;
+ uniformBlocks[i].members.resize(memberCount);
+ for (int memberIdx = 0; memberIdx < memberCount; ++memberIdx)
+ uniformBlocks[i].members[memberIdx] = deserializeBlockMemberVar(stream, version);
}
- if (root.contains(outputsKey)) {
- QJsonArray outputs = root[outputsKey].toArray();
- for (int i = 0; i < outputs.count(); ++i)
- outVars.append(inOutVar(outputs[i].toObject()));
+ (*stream) >> count;
+ pushConstantBlocks.resize(count);
+ for (int i = 0; i < count; ++i) {
+ QString tmp;
+ (*stream) >> tmp;
+ pushConstantBlocks[i].name = tmp.toUtf8();
+ (*stream) >> pushConstantBlocks[i].size;
+ int memberCount;
+ (*stream) >> memberCount;
+ pushConstantBlocks[i].members.resize(memberCount);
+ for (int memberIdx = 0; memberIdx < memberCount; ++memberIdx)
+ pushConstantBlocks[i].members[memberIdx] = deserializeBlockMemberVar(stream, version);
}
- if (root.contains(uniformBlocksKey)) {
- QJsonArray ubs = root[uniformBlocksKey].toArray();
- for (int i = 0; i < ubs.count(); ++i) {
- QJsonObject ubObj = ubs[i].toObject();
- QShaderDescription::UniformBlock ub;
- ub.blockName = ubObj[blockNameKey].toString();
- ub.structName = ubObj[structNameKey].toString();
- ub.size = ubObj[sizeKey].toInt();
- if (ubObj.contains(bindingKey))
- ub.binding = ubObj[bindingKey].toInt();
- if (ubObj.contains(setKey))
- ub.descriptorSet = ubObj[setKey].toInt();
- QJsonArray members = ubObj[membersKey].toArray();
- for (const QJsonValue &member : members)
- ub.members.append(blockVar(member.toObject()));
- uniformBlocks.append(ub);
+ (*stream) >> count;
+ storageBlocks.resize(count);
+ for (int i = 0; i < count; ++i) {
+ QString tmp;
+ (*stream) >> tmp;
+ storageBlocks[i].blockName = tmp.toUtf8();
+ (*stream) >> tmp;
+ storageBlocks[i].instanceName = tmp.toUtf8();
+ (*stream) >> storageBlocks[i].knownSize;
+ (*stream) >> storageBlocks[i].binding;
+ (*stream) >> storageBlocks[i].descriptorSet;
+ int memberCount;
+ (*stream) >> memberCount;
+ storageBlocks[i].members.resize(memberCount);
+ for (int memberIdx = 0; memberIdx < memberCount; ++memberIdx)
+ storageBlocks[i].members[memberIdx] = deserializeBlockMemberVar(stream, version);
+
+ if (version > QShaderPrivate::QSB_VERSION_WITHOUT_EXTENDED_STORAGE_BUFFER_INFO) {
+ (*stream) >> storageBlocks[i].runtimeArrayStride;
+ (*stream) >> storageBlocks[i].qualifierFlags;
}
}
- if (root.contains(pushConstantBlocksKey)) {
- QJsonArray pcs = root[pushConstantBlocksKey].toArray();
- for (int i = 0; i < pcs.count(); ++i) {
- QJsonObject pcObj = pcs[i].toObject();
- QShaderDescription::PushConstantBlock pc;
- pc.name = pcObj[nameKey].toString();
- pc.size = pcObj[sizeKey].toInt();
- QJsonArray members = pcObj[membersKey].toArray();
- for (const QJsonValue &member : members)
- pc.members.append(blockVar(member.toObject()));
- pushConstantBlocks.append(pc);
- }
+ (*stream) >> count;
+ combinedImageSamplers.resize(count);
+ for (int i = 0; i < count; ++i) {
+ QString tmp;
+ (*stream) >> tmp;
+ combinedImageSamplers[i].name = tmp.toUtf8();
+ int t;
+ (*stream) >> t;
+ combinedImageSamplers[i].type = QShaderDescription::VariableType(t);
+ deserializeDecorations(stream, version, &combinedImageSamplers[i]);
}
- if (root.contains(storageBlocksKey)) {
- QJsonArray ubs = root[storageBlocksKey].toArray();
- for (int i = 0; i < ubs.count(); ++i) {
- QJsonObject sbObj = ubs[i].toObject();
- QShaderDescription::StorageBlock sb;
- sb.blockName = sbObj[blockNameKey].toString();
- sb.instanceName = sbObj[instanceNameKey].toString();
- sb.knownSize = sbObj[knownSizeKey].toInt();
- if (sbObj.contains(bindingKey))
- sb.binding = sbObj[bindingKey].toInt();
- if (sbObj.contains(setKey))
- sb.descriptorSet = sbObj[setKey].toInt();
- QJsonArray members = sbObj[membersKey].toArray();
- for (const QJsonValue &member : members)
- sb.members.append(blockVar(member.toObject()));
- storageBlocks.append(sb);
- }
+ (*stream) >> count;
+ storageImages.resize(count);
+ for (int i = 0; i < count; ++i) {
+ QString tmp;
+ (*stream) >> tmp;
+ storageImages[i].name = tmp.toUtf8();
+ int t;
+ (*stream) >> t;
+ storageImages[i].type = QShaderDescription::VariableType(t);
+ deserializeDecorations(stream, version, &storageImages[i]);
}
- if (root.contains(combinedImageSamplersKey)) {
- QJsonArray samplers = root[combinedImageSamplersKey].toArray();
- for (int i = 0; i < samplers.count(); ++i)
- combinedImageSamplers.append(inOutVar(samplers[i].toObject()));
+ for (size_t i = 0; i < 3; ++i) {
+ quint32 v;
+ (*stream) >> v;
+ localSize[i] = v;
}
- if (root.contains(storageImagesKey)) {
- QJsonArray images = root[storageImagesKey].toArray();
- for (int i = 0; i < images.count(); ++i)
- storageImages.append(inOutVar(images[i].toObject()));
- }
+ if (version > QShaderPrivate::QSB_VERSION_WITHOUT_SEPARATE_IMAGES_AND_SAMPLERS) {
+ (*stream) >> count;
+ separateImages.resize(count);
+ for (int i = 0; i < count; ++i) {
+ QString tmp;
+ (*stream) >> tmp;
+ separateImages[i].name = tmp.toUtf8();
+ int t;
+ (*stream) >> t;
+ separateImages[i].type = QShaderDescription::VariableType(t);
+ deserializeDecorations(stream, version, &separateImages[i]);
+ }
- if (root.contains(localSizeKey)) {
- QJsonArray localSizeArr = root[localSizeKey].toArray();
- if (localSizeArr.count() == 3) {
- for (int i = 0; i < 3; ++i)
- localSize[i] = localSizeArr[i].toInt();
+ (*stream) >> count;
+ separateSamplers.resize(count);
+ for (int i = 0; i < count; ++i) {
+ QString tmp;
+ (*stream) >> tmp;
+ separateSamplers[i].name = tmp.toUtf8();
+ int t;
+ (*stream) >> t;
+ separateSamplers[i].type = QShaderDescription::VariableType(t);
+ deserializeDecorations(stream, version, &separateSamplers[i]);
}
}
+
+ if (version > QShaderPrivate::QSB_VERSION_WITHOUT_NATIVE_SHADER_INFO) {
+ quint32 v;
+ (*stream) >> v;
+ tessOutVertCount = v;
+ (*stream) >> v;
+ tessMode = QShaderDescription::TessellationMode(v);
+ (*stream) >> v;
+ tessWind = QShaderDescription::TessellationWindingOrder(v);
+ (*stream) >> v;
+ tessPart = QShaderDescription::TessellationPartitioning(v);
+
+ (*stream) >> count;
+ inBuiltins.resize(count);
+ for (int i = 0; i < count; ++i)
+ inBuiltins[i] = deserializeBuiltinVar(stream, version);
+
+ (*stream) >> count;
+ outBuiltins.resize(count);
+ for (int i = 0; i < count; ++i)
+ outBuiltins[i] = deserializeBuiltinVar(stream, version);
+ }
}
/*!
@@ -1171,7 +1977,7 @@ void QShaderDescriptionPrivate::loadDoc(const QJsonDocument &doc)
\relates QShaderDescription
*/
-bool operator==(const QShaderDescription &lhs, const QShaderDescription &rhs) Q_DECL_NOTHROW
+bool operator==(const QShaderDescription &lhs, const QShaderDescription &rhs) noexcept
{
if (lhs.d == rhs.d)
return true;
@@ -1182,8 +1988,16 @@ bool operator==(const QShaderDescription &lhs, const QShaderDescription &rhs) Q_
&& lhs.d->pushConstantBlocks == rhs.d->pushConstantBlocks
&& lhs.d->storageBlocks == rhs.d->storageBlocks
&& lhs.d->combinedImageSamplers == rhs.d->combinedImageSamplers
+ && lhs.d->separateImages == rhs.d->separateImages
+ && lhs.d->separateSamplers == rhs.d->separateSamplers
&& lhs.d->storageImages == rhs.d->storageImages
- && lhs.d->localSize == rhs.d->localSize;
+ && lhs.d->inBuiltins == rhs.d->inBuiltins
+ && lhs.d->outBuiltins == rhs.d->outBuiltins
+ && lhs.d->localSize == rhs.d->localSize
+ && lhs.d->tessOutVertCount == rhs.d->tessOutVertCount
+ && lhs.d->tessMode == rhs.d->tessMode
+ && lhs.d->tessWind == rhs.d->tessWind
+ && lhs.d->tessPart == rhs.d->tessPart;
}
/*!
@@ -1192,7 +2006,7 @@ bool operator==(const QShaderDescription &lhs, const QShaderDescription &rhs) Q_
\relates QShaderDescription::InOutVariable
*/
-bool operator==(const QShaderDescription::InOutVariable &lhs, const QShaderDescription::InOutVariable &rhs) Q_DECL_NOTHROW
+bool operator==(const QShaderDescription::InOutVariable &lhs, const QShaderDescription::InOutVariable &rhs) noexcept
{
return lhs.name == rhs.name
&& lhs.type == rhs.type
@@ -1200,7 +2014,10 @@ bool operator==(const QShaderDescription::InOutVariable &lhs, const QShaderDescr
&& lhs.binding == rhs.binding
&& lhs.descriptorSet == rhs.descriptorSet
&& lhs.imageFormat == rhs.imageFormat
- && lhs.imageFlags == rhs.imageFlags;
+ && lhs.imageFlags == rhs.imageFlags
+ && lhs.arrayDims == rhs.arrayDims
+ && lhs.perPatch == rhs.perPatch
+ && lhs.structMembers == rhs.structMembers;
}
/*!
@@ -1209,7 +2026,7 @@ bool operator==(const QShaderDescription::InOutVariable &lhs, const QShaderDescr
\relates QShaderDescription::BlockVariable
*/
-bool operator==(const QShaderDescription::BlockVariable &lhs, const QShaderDescription::BlockVariable &rhs) Q_DECL_NOTHROW
+bool operator==(const QShaderDescription::BlockVariable &lhs, const QShaderDescription::BlockVariable &rhs) noexcept
{
return lhs.name == rhs.name
&& lhs.type == rhs.type
@@ -1228,7 +2045,7 @@ bool operator==(const QShaderDescription::BlockVariable &lhs, const QShaderDescr
\relates QShaderDescription::UniformBlock
*/
-bool operator==(const QShaderDescription::UniformBlock &lhs, const QShaderDescription::UniformBlock &rhs) Q_DECL_NOTHROW
+bool operator==(const QShaderDescription::UniformBlock &lhs, const QShaderDescription::UniformBlock &rhs) noexcept
{
return lhs.blockName == rhs.blockName
&& lhs.structName == rhs.structName
@@ -1244,7 +2061,7 @@ bool operator==(const QShaderDescription::UniformBlock &lhs, const QShaderDescri
\relates QShaderDescription::PushConstantBlock
*/
-bool operator==(const QShaderDescription::PushConstantBlock &lhs, const QShaderDescription::PushConstantBlock &rhs) Q_DECL_NOTHROW
+bool operator==(const QShaderDescription::PushConstantBlock &lhs, const QShaderDescription::PushConstantBlock &rhs) noexcept
{
return lhs.name == rhs.name
&& lhs.size == rhs.size
@@ -1257,14 +2074,29 @@ bool operator==(const QShaderDescription::PushConstantBlock &lhs, const QShaderD
\relates QShaderDescription::StorageBlock
*/
-bool operator==(const QShaderDescription::StorageBlock &lhs, const QShaderDescription::StorageBlock &rhs) Q_DECL_NOTHROW
+bool operator==(const QShaderDescription::StorageBlock &lhs, const QShaderDescription::StorageBlock &rhs) noexcept
{
return lhs.blockName == rhs.blockName
&& lhs.instanceName == rhs.instanceName
&& lhs.knownSize == rhs.knownSize
&& lhs.binding == rhs.binding
&& lhs.descriptorSet == rhs.descriptorSet
+ && lhs.runtimeArrayStride == rhs.runtimeArrayStride
+ && lhs.qualifierFlags == rhs.qualifierFlags
&& lhs.members == rhs.members;
}
+/*!
+ Returns \c true if the two BuiltinVariable objects \a lhs and \a rhs are
+ equal.
+
+ \relates QShaderDescription::BuiltinVariable
+ */
+bool operator==(const QShaderDescription::BuiltinVariable &lhs, const QShaderDescription::BuiltinVariable &rhs) noexcept
+{
+ return lhs.type == rhs.type
+ && lhs.varType == rhs.varType
+ && lhs.arrayDims == rhs.arrayDims;
+}
+
QT_END_NAMESPACE
diff --git a/src/gui/rhi/qshaderdescription.h b/src/gui/rhi/qshaderdescription.h
new file mode 100644
index 0000000000..02492a1598
--- /dev/null
+++ b/src/gui/rhi/qshaderdescription.h
@@ -0,0 +1,386 @@
+// Copyright (C) 2023 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
+
+#ifndef QSHADERDESCRIPTION_H
+#define QSHADERDESCRIPTION_H
+
+//
+// W A R N I N G
+// -------------
+//
+// This file is part of the RHI API, with limited compatibility guarantees.
+// Usage of this API may make your code source and binary incompatible with
+// future versions of Qt.
+//
+
+#include <QtGui/qtguiglobal.h>
+#include <QtCore/qstring.h>
+#include <QtCore/qlist.h>
+#include <array>
+
+QT_BEGIN_NAMESPACE
+
+struct QShaderDescriptionPrivate;
+class QDataStream;
+
+class Q_GUI_EXPORT QShaderDescription
+{
+public:
+ QShaderDescription();
+ QShaderDescription(const QShaderDescription &other);
+ QShaderDescription &operator=(const QShaderDescription &other);
+ ~QShaderDescription();
+ void detach();
+
+ bool isValid() const;
+
+ void serialize(QDataStream *stream, int version) const;
+ QByteArray toJson() const;
+
+ static QShaderDescription deserialize(QDataStream *stream, int version);
+
+ enum VariableType {
+ Unknown = 0,
+
+ // do not reorder
+ Float,
+ Vec2,
+ Vec3,
+ Vec4,
+ Mat2,
+ Mat2x3,
+ Mat2x4,
+ Mat3,
+ Mat3x2,
+ Mat3x4,
+ Mat4,
+ Mat4x2,
+ Mat4x3,
+
+ Int,
+ Int2,
+ Int3,
+ Int4,
+
+ Uint,
+ Uint2,
+ Uint3,
+ Uint4,
+
+ Bool,
+ Bool2,
+ Bool3,
+ Bool4,
+
+ Double,
+ Double2,
+ Double3,
+ Double4,
+ DMat2,
+ DMat2x3,
+ DMat2x4,
+ DMat3,
+ DMat3x2,
+ DMat3x4,
+ DMat4,
+ DMat4x2,
+ DMat4x3,
+
+ Sampler1D,
+ Sampler2D,
+ Sampler2DMS,
+ Sampler3D,
+ SamplerCube,
+ Sampler1DArray,
+ Sampler2DArray,
+ Sampler2DMSArray,
+ Sampler3DArray,
+ SamplerCubeArray,
+ SamplerRect,
+ SamplerBuffer,
+ SamplerExternalOES,
+ Sampler,
+
+ Image1D,
+ Image2D,
+ Image2DMS,
+ Image3D,
+ ImageCube,
+ Image1DArray,
+ Image2DArray,
+ Image2DMSArray,
+ Image3DArray,
+ ImageCubeArray,
+ ImageRect,
+ ImageBuffer,
+
+ Struct,
+
+ Half,
+ Half2,
+ Half3,
+ Half4
+ };
+
+ enum ImageFormat {
+ // must match SPIR-V's ImageFormat
+ ImageFormatUnknown = 0,
+ ImageFormatRgba32f = 1,
+ ImageFormatRgba16f = 2,
+ ImageFormatR32f = 3,
+ ImageFormatRgba8 = 4,
+ ImageFormatRgba8Snorm = 5,
+ ImageFormatRg32f = 6,
+ ImageFormatRg16f = 7,
+ ImageFormatR11fG11fB10f = 8,
+ ImageFormatR16f = 9,
+ ImageFormatRgba16 = 10,
+ ImageFormatRgb10A2 = 11,
+ ImageFormatRg16 = 12,
+ ImageFormatRg8 = 13,
+ ImageFormatR16 = 14,
+ ImageFormatR8 = 15,
+ ImageFormatRgba16Snorm = 16,
+ ImageFormatRg16Snorm = 17,
+ ImageFormatRg8Snorm = 18,
+ ImageFormatR16Snorm = 19,
+ ImageFormatR8Snorm = 20,
+ ImageFormatRgba32i = 21,
+ ImageFormatRgba16i = 22,
+ ImageFormatRgba8i = 23,
+ ImageFormatR32i = 24,
+ ImageFormatRg32i = 25,
+ ImageFormatRg16i = 26,
+ ImageFormatRg8i = 27,
+ ImageFormatR16i = 28,
+ ImageFormatR8i = 29,
+ ImageFormatRgba32ui = 30,
+ ImageFormatRgba16ui = 31,
+ ImageFormatRgba8ui = 32,
+ ImageFormatR32ui = 33,
+ ImageFormatRgb10a2ui = 34,
+ ImageFormatRg32ui = 35,
+ ImageFormatRg16ui = 36,
+ ImageFormatRg8ui = 37,
+ ImageFormatR16ui = 38,
+ ImageFormatR8ui = 39
+ };
+
+ enum ImageFlag {
+ ReadOnlyImage = 1 << 0,
+ WriteOnlyImage = 1 << 1
+ };
+ Q_DECLARE_FLAGS(ImageFlags, ImageFlag)
+
+ enum QualifierFlag {
+ QualifierReadOnly = 1 << 0,
+ QualifierWriteOnly = 1 << 1,
+ QualifierCoherent = 1 << 2,
+ QualifierVolatile = 1 << 3,
+ QualifierRestrict = 1 << 4,
+ };
+ Q_DECLARE_FLAGS(QualifierFlags, QualifierFlag)
+
+ // Optional data (like decorations) usually default to an otherwise invalid value (-1 or 0). This is intentional.
+
+ struct BlockVariable {
+ QByteArray name;
+ VariableType type = Unknown;
+ int offset = 0;
+ int size = 0;
+ QList<int> arrayDims;
+ int arrayStride = 0;
+ int matrixStride = 0;
+ bool matrixIsRowMajor = false;
+ QList<BlockVariable> structMembers;
+ };
+
+ struct InOutVariable {
+ QByteArray name;
+ VariableType type = Unknown;
+ int location = -1;
+ int binding = -1;
+ int descriptorSet = -1;
+ ImageFormat imageFormat = ImageFormatUnknown;
+ ImageFlags imageFlags;
+ QList<int> arrayDims;
+ bool perPatch = false;
+ QList<BlockVariable> structMembers;
+ };
+
+ struct UniformBlock {
+ QByteArray blockName;
+ QByteArray structName; // instanceName
+ int size = 0;
+ int binding = -1;
+ int descriptorSet = -1;
+ QList<BlockVariable> members;
+ };
+
+ struct PushConstantBlock {
+ QByteArray name;
+ int size = 0;
+ QList<BlockVariable> members;
+ };
+
+ struct StorageBlock {
+ QByteArray blockName;
+ QByteArray instanceName;
+ int knownSize = 0;
+ int binding = -1;
+ int descriptorSet = -1;
+ QList<BlockVariable> members;
+ int runtimeArrayStride = 0;
+ QualifierFlags qualifierFlags;
+ };
+
+ QList<InOutVariable> inputVariables() const;
+ QList<InOutVariable> outputVariables() const;
+ QList<UniformBlock> uniformBlocks() const;
+ QList<PushConstantBlock> pushConstantBlocks() const;
+ QList<StorageBlock> storageBlocks() const;
+ QList<InOutVariable> combinedImageSamplers() const;
+ QList<InOutVariable> separateImages() const;
+ QList<InOutVariable> separateSamplers() const;
+ QList<InOutVariable> storageImages() const;
+
+ enum BuiltinType {
+ // must match SpvBuiltIn
+ PositionBuiltin = 0,
+ PointSizeBuiltin = 1,
+ ClipDistanceBuiltin = 3,
+ CullDistanceBuiltin = 4,
+ VertexIdBuiltin = 5,
+ InstanceIdBuiltin = 6,
+ PrimitiveIdBuiltin = 7,
+ InvocationIdBuiltin = 8,
+ LayerBuiltin = 9,
+ ViewportIndexBuiltin = 10,
+ TessLevelOuterBuiltin = 11,
+ TessLevelInnerBuiltin = 12,
+ TessCoordBuiltin = 13,
+ PatchVerticesBuiltin = 14,
+ FragCoordBuiltin = 15,
+ PointCoordBuiltin = 16,
+ FrontFacingBuiltin = 17,
+ SampleIdBuiltin = 18,
+ SamplePositionBuiltin = 19,
+ SampleMaskBuiltin = 20,
+ FragDepthBuiltin = 22,
+ NumWorkGroupsBuiltin = 24,
+ WorkgroupSizeBuiltin = 25,
+ WorkgroupIdBuiltin = 26,
+ LocalInvocationIdBuiltin = 27,
+ GlobalInvocationIdBuiltin = 28,
+ LocalInvocationIndexBuiltin = 29,
+ VertexIndexBuiltin = 42,
+ InstanceIndexBuiltin = 43
+ };
+
+ struct BuiltinVariable {
+ BuiltinType type;
+ VariableType varType;
+ QList<int> arrayDims;
+ };
+
+ QList<BuiltinVariable> inputBuiltinVariables() const;
+ QList<BuiltinVariable> outputBuiltinVariables() const;
+
+ std::array<uint, 3> computeShaderLocalSize() const;
+
+ uint tessellationOutputVertexCount() const;
+
+ enum TessellationMode {
+ UnknownTessellationMode,
+ TrianglesTessellationMode,
+ QuadTessellationMode,
+ IsolineTessellationMode
+ };
+
+ TessellationMode tessellationMode() const;
+
+ enum TessellationWindingOrder {
+ UnknownTessellationWindingOrder,
+ CwTessellationWindingOrder,
+ CcwTessellationWindingOrder
+ };
+
+ TessellationWindingOrder tessellationWindingOrder() const;
+
+ enum TessellationPartitioning {
+ UnknownTessellationPartitioning,
+ EqualTessellationPartitioning,
+ FractionalEvenTessellationPartitioning,
+ FractionalOddTessellationPartitioning
+ };
+
+ TessellationPartitioning tessellationPartitioning() const;
+
+private:
+ QShaderDescriptionPrivate *d;
+ friend struct QShaderDescriptionPrivate;
+#ifndef QT_NO_DEBUG_STREAM
+ friend Q_GUI_EXPORT QDebug operator<<(QDebug, const QShaderDescription &);
+#endif
+ friend Q_GUI_EXPORT bool operator==(const QShaderDescription &lhs, const QShaderDescription &rhs) noexcept;
+};
+
+Q_DECLARE_OPERATORS_FOR_FLAGS(QShaderDescription::ImageFlags)
+Q_DECLARE_OPERATORS_FOR_FLAGS(QShaderDescription::QualifierFlags)
+
+#ifndef QT_NO_DEBUG_STREAM
+Q_GUI_EXPORT QDebug operator<<(QDebug, const QShaderDescription &);
+Q_GUI_EXPORT QDebug operator<<(QDebug, const QShaderDescription::InOutVariable &);
+Q_GUI_EXPORT QDebug operator<<(QDebug, const QShaderDescription::BlockVariable &);
+Q_GUI_EXPORT QDebug operator<<(QDebug, const QShaderDescription::UniformBlock &);
+Q_GUI_EXPORT QDebug operator<<(QDebug, const QShaderDescription::PushConstantBlock &);
+Q_GUI_EXPORT QDebug operator<<(QDebug, const QShaderDescription::StorageBlock &);
+Q_GUI_EXPORT QDebug operator<<(QDebug, const QShaderDescription::BuiltinVariable &);
+#endif
+
+Q_GUI_EXPORT bool operator==(const QShaderDescription &lhs, const QShaderDescription &rhs) noexcept;
+Q_GUI_EXPORT bool operator==(const QShaderDescription::InOutVariable &lhs, const QShaderDescription::InOutVariable &rhs) noexcept;
+Q_GUI_EXPORT bool operator==(const QShaderDescription::BlockVariable &lhs, const QShaderDescription::BlockVariable &rhs) noexcept;
+Q_GUI_EXPORT bool operator==(const QShaderDescription::UniformBlock &lhs, const QShaderDescription::UniformBlock &rhs) noexcept;
+Q_GUI_EXPORT bool operator==(const QShaderDescription::PushConstantBlock &lhs, const QShaderDescription::PushConstantBlock &rhs) noexcept;
+Q_GUI_EXPORT bool operator==(const QShaderDescription::StorageBlock &lhs, const QShaderDescription::StorageBlock &rhs) noexcept;
+Q_GUI_EXPORT bool operator==(const QShaderDescription::BuiltinVariable &lhs, const QShaderDescription::BuiltinVariable &rhs) noexcept;
+
+inline bool operator!=(const QShaderDescription &lhs, const QShaderDescription &rhs) noexcept
+{
+ return !(lhs == rhs);
+}
+
+inline bool operator!=(const QShaderDescription::InOutVariable &lhs, const QShaderDescription::InOutVariable &rhs) noexcept
+{
+ return !(lhs == rhs);
+}
+
+inline bool operator!=(const QShaderDescription::BlockVariable &lhs, const QShaderDescription::BlockVariable &rhs) noexcept
+{
+ return !(lhs == rhs);
+}
+
+inline bool operator!=(const QShaderDescription::UniformBlock &lhs, const QShaderDescription::UniformBlock &rhs) noexcept
+{
+ return !(lhs == rhs);
+}
+
+inline bool operator!=(const QShaderDescription::PushConstantBlock &lhs, const QShaderDescription::PushConstantBlock &rhs) noexcept
+{
+ return !(lhs == rhs);
+}
+
+inline bool operator!=(const QShaderDescription::StorageBlock &lhs, const QShaderDescription::StorageBlock &rhs) noexcept
+{
+ return !(lhs == rhs);
+}
+
+inline bool operator!=(const QShaderDescription::BuiltinVariable &lhs, const QShaderDescription::BuiltinVariable &rhs) noexcept
+{
+ return !(lhs == rhs);
+}
+
+QT_END_NAMESPACE
+
+#endif
diff --git a/src/gui/rhi/qshaderdescription_p.h b/src/gui/rhi/qshaderdescription_p.h
index e02a53dcb5..df694bbf40 100644
--- a/src/gui/rhi/qshaderdescription_p.h
+++ b/src/gui/rhi/qshaderdescription_p.h
@@ -1,41 +1,8 @@
-/****************************************************************************
-**
-** Copyright (C) 2019 The Qt Company Ltd.
-** Contact: http://www.qt.io/licensing/
-**
-** This file is part of the Qt Gui module
-**
-** $QT_BEGIN_LICENSE:LGPL3$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2023 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
-#ifndef QSHADERDESCRIPTION_H
-#define QSHADERDESCRIPTION_H
+#ifndef QSHADERDESCRIPTION_P_H
+#define QSHADERDESCRIPTION_P_H
//
// W A R N I N G
@@ -48,274 +15,67 @@
// We mean it.
//
-#include <QtGui/qtguiglobal.h>
-#include <QtCore/QString>
-#include <QtCore/QVector>
-#include <array>
+#include <rhi/qshaderdescription.h>
+#include <QtCore/QList>
+#include <QtCore/QAtomicInt>
+#include <QtCore/QJsonDocument>
QT_BEGIN_NAMESPACE
-struct QShaderDescriptionPrivate;
-
-class Q_GUI_EXPORT QShaderDescription
+struct Q_GUI_EXPORT QShaderDescriptionPrivate
{
-public:
- QShaderDescription();
- QShaderDescription(const QShaderDescription &other);
- QShaderDescription &operator=(const QShaderDescription &other);
- ~QShaderDescription();
- void detach();
-
- bool isValid() const;
-
- QByteArray toBinaryJson() const;
- QByteArray toCbor() const;
- QByteArray toJson() const;
-
- static QShaderDescription fromBinaryJson(const QByteArray &data);
- static QShaderDescription fromCbor(const QByteArray &data);
-
- enum VariableType {
- Unknown = 0,
-
- // do not reorder
- Float,
- Vec2,
- Vec3,
- Vec4,
- Mat2,
- Mat2x3,
- Mat2x4,
- Mat3,
- Mat3x2,
- Mat3x4,
- Mat4,
- Mat4x2,
- Mat4x3,
-
- Int,
- Int2,
- Int3,
- Int4,
-
- Uint,
- Uint2,
- Uint3,
- Uint4,
-
- Bool,
- Bool2,
- Bool3,
- Bool4,
-
- Double,
- Double2,
- Double3,
- Double4,
- DMat2,
- DMat2x3,
- DMat2x4,
- DMat3,
- DMat3x2,
- DMat3x4,
- DMat4,
- DMat4x2,
- DMat4x3,
-
- Sampler1D,
- Sampler2D,
- Sampler2DMS,
- Sampler3D,
- SamplerCube,
- Sampler1DArray,
- Sampler2DArray,
- Sampler2DMSArray,
- Sampler3DArray,
- SamplerCubeArray,
- SamplerRect,
- SamplerBuffer,
-
- Image1D,
- Image2D,
- Image2DMS,
- Image3D,
- ImageCube,
- Image1DArray,
- Image2DArray,
- Image2DMSArray,
- Image3DArray,
- ImageCubeArray,
- ImageRect,
- ImageBuffer,
-
- Struct
- };
-
- enum ImageFormat {
- // must match SPIR-V's ImageFormat
- ImageFormatUnknown = 0,
- ImageFormatRgba32f = 1,
- ImageFormatRgba16f = 2,
- ImageFormatR32f = 3,
- ImageFormatRgba8 = 4,
- ImageFormatRgba8Snorm = 5,
- ImageFormatRg32f = 6,
- ImageFormatRg16f = 7,
- ImageFormatR11fG11fB10f = 8,
- ImageFormatR16f = 9,
- ImageFormatRgba16 = 10,
- ImageFormatRgb10A2 = 11,
- ImageFormatRg16 = 12,
- ImageFormatRg8 = 13,
- ImageFormatR16 = 14,
- ImageFormatR8 = 15,
- ImageFormatRgba16Snorm = 16,
- ImageFormatRg16Snorm = 17,
- ImageFormatRg8Snorm = 18,
- ImageFormatR16Snorm = 19,
- ImageFormatR8Snorm = 20,
- ImageFormatRgba32i = 21,
- ImageFormatRgba16i = 22,
- ImageFormatRgba8i = 23,
- ImageFormatR32i = 24,
- ImageFormatRg32i = 25,
- ImageFormatRg16i = 26,
- ImageFormatRg8i = 27,
- ImageFormatR16i = 28,
- ImageFormatR8i = 29,
- ImageFormatRgba32ui = 30,
- ImageFormatRgba16ui = 31,
- ImageFormatRgba8ui = 32,
- ImageFormatR32ui = 33,
- ImageFormatRgb10a2ui = 34,
- ImageFormatRg32ui = 35,
- ImageFormatRg16ui = 36,
- ImageFormatRg8ui = 37,
- ImageFormatR16ui = 38,
- ImageFormatR8ui = 39
- };
-
- enum ImageFlag {
- ReadOnlyImage = 1 << 0,
- WriteOnlyImage = 1 << 1
- };
- Q_DECLARE_FLAGS(ImageFlags, ImageFlag)
-
- // Optional data (like decorations) usually default to an otherwise invalid value (-1 or 0). This is intentional.
-
- struct InOutVariable {
- QString name;
- VariableType type = Unknown;
- int location = -1;
- int binding = -1;
- int descriptorSet = -1;
- ImageFormat imageFormat = ImageFormatUnknown;
- ImageFlags imageFlags;
- };
-
- struct BlockVariable {
- QString name;
- VariableType type = Unknown;
- int offset = 0;
- int size = 0;
- QVector<int> arrayDims;
- int arrayStride = 0;
- int matrixStride = 0;
- bool matrixIsRowMajor = false;
- QVector<BlockVariable> structMembers;
- };
-
- struct UniformBlock {
- QString blockName;
- QString structName; // instanceName
- int size = 0;
- int binding = -1;
- int descriptorSet = -1;
- QVector<BlockVariable> members;
- };
-
- struct PushConstantBlock {
- QString name;
- int size = 0;
- QVector<BlockVariable> members;
- };
-
- struct StorageBlock {
- QString blockName;
- QString instanceName;
- int knownSize = 0;
- int binding = -1;
- int descriptorSet = -1;
- QVector<BlockVariable> members;
- };
-
- QVector<InOutVariable> inputVariables() const;
- QVector<InOutVariable> outputVariables() const;
- QVector<UniformBlock> uniformBlocks() const;
- QVector<PushConstantBlock> pushConstantBlocks() const;
- QVector<StorageBlock> storageBlocks() const;
- QVector<InOutVariable> combinedImageSamplers() const;
- QVector<InOutVariable> storageImages() const;
-
- std::array<uint, 3> computeShaderLocalSize() const;
-
-private:
- QShaderDescriptionPrivate *d;
- friend struct QShaderDescriptionPrivate;
-#ifndef QT_NO_DEBUG_STREAM
- friend Q_GUI_EXPORT QDebug operator<<(QDebug, const QShaderDescription &);
-#endif
- friend Q_GUI_EXPORT bool operator==(const QShaderDescription &lhs, const QShaderDescription &rhs) Q_DECL_NOTHROW;
+ QShaderDescriptionPrivate()
+ : ref(1)
+ {
+ }
+
+ QShaderDescriptionPrivate(const QShaderDescriptionPrivate &other)
+ : ref(1),
+ inVars(other.inVars),
+ outVars(other.outVars),
+ uniformBlocks(other.uniformBlocks),
+ pushConstantBlocks(other.pushConstantBlocks),
+ storageBlocks(other.storageBlocks),
+ combinedImageSamplers(other.combinedImageSamplers),
+ separateImages(other.separateImages),
+ separateSamplers(other.separateSamplers),
+ storageImages(other.storageImages),
+ inBuiltins(other.inBuiltins),
+ outBuiltins(other.outBuiltins),
+ localSize(other.localSize),
+ tessOutVertCount(other.tessOutVertCount),
+ tessMode(other.tessMode),
+ tessWind(other.tessWind),
+ tessPart(other.tessPart)
+ {
+ }
+
+ static QShaderDescriptionPrivate *get(QShaderDescription *desc) { return desc->d; }
+ static const QShaderDescriptionPrivate *get(const QShaderDescription *desc) { return desc->d; }
+
+ QJsonDocument makeDoc();
+ void writeToStream(QDataStream *stream, int version);
+ void loadFromStream(QDataStream *stream, int version);
+
+ QAtomicInt ref;
+ QList<QShaderDescription::InOutVariable> inVars;
+ QList<QShaderDescription::InOutVariable> outVars;
+ QList<QShaderDescription::UniformBlock> uniformBlocks;
+ QList<QShaderDescription::PushConstantBlock> pushConstantBlocks;
+ QList<QShaderDescription::StorageBlock> storageBlocks;
+ QList<QShaderDescription::InOutVariable> combinedImageSamplers;
+ QList<QShaderDescription::InOutVariable> separateImages;
+ QList<QShaderDescription::InOutVariable> separateSamplers;
+ QList<QShaderDescription::InOutVariable> storageImages;
+ QList<QShaderDescription::BuiltinVariable> inBuiltins;
+ QList<QShaderDescription::BuiltinVariable> outBuiltins;
+ std::array<uint, 3> localSize = {};
+ uint tessOutVertCount = 0;
+ QShaderDescription::TessellationMode tessMode = QShaderDescription::UnknownTessellationMode;
+ QShaderDescription::TessellationWindingOrder tessWind = QShaderDescription::UnknownTessellationWindingOrder;
+ QShaderDescription::TessellationPartitioning tessPart = QShaderDescription::UnknownTessellationPartitioning;
};
-Q_DECLARE_OPERATORS_FOR_FLAGS(QShaderDescription::ImageFlags)
-
-#ifndef QT_NO_DEBUG_STREAM
-Q_GUI_EXPORT QDebug operator<<(QDebug, const QShaderDescription &);
-Q_GUI_EXPORT QDebug operator<<(QDebug, const QShaderDescription::InOutVariable &);
-Q_GUI_EXPORT QDebug operator<<(QDebug, const QShaderDescription::BlockVariable &);
-Q_GUI_EXPORT QDebug operator<<(QDebug, const QShaderDescription::UniformBlock &);
-Q_GUI_EXPORT QDebug operator<<(QDebug, const QShaderDescription::PushConstantBlock &);
-Q_GUI_EXPORT QDebug operator<<(QDebug, const QShaderDescription::StorageBlock &);
-#endif
-
-Q_GUI_EXPORT bool operator==(const QShaderDescription &lhs, const QShaderDescription &rhs) Q_DECL_NOTHROW;
-Q_GUI_EXPORT bool operator==(const QShaderDescription::InOutVariable &lhs, const QShaderDescription::InOutVariable &rhs) Q_DECL_NOTHROW;
-Q_GUI_EXPORT bool operator==(const QShaderDescription::BlockVariable &lhs, const QShaderDescription::BlockVariable &rhs) Q_DECL_NOTHROW;
-Q_GUI_EXPORT bool operator==(const QShaderDescription::UniformBlock &lhs, const QShaderDescription::UniformBlock &rhs) Q_DECL_NOTHROW;
-Q_GUI_EXPORT bool operator==(const QShaderDescription::PushConstantBlock &lhs, const QShaderDescription::PushConstantBlock &rhs) Q_DECL_NOTHROW;
-Q_GUI_EXPORT bool operator==(const QShaderDescription::StorageBlock &lhs, const QShaderDescription::StorageBlock &rhs) Q_DECL_NOTHROW;
-
-inline bool operator!=(const QShaderDescription &lhs, const QShaderDescription &rhs) Q_DECL_NOTHROW
-{
- return !(lhs == rhs);
-}
-
-inline bool operator!=(const QShaderDescription::InOutVariable &lhs, const QShaderDescription::InOutVariable &rhs) Q_DECL_NOTHROW
-{
- return !(lhs == rhs);
-}
-
-inline bool operator!=(const QShaderDescription::BlockVariable &lhs, const QShaderDescription::BlockVariable &rhs) Q_DECL_NOTHROW
-{
- return !(lhs == rhs);
-}
-
-inline bool operator!=(const QShaderDescription::UniformBlock &lhs, const QShaderDescription::UniformBlock &rhs) Q_DECL_NOTHROW
-{
- return !(lhs == rhs);
-}
-
-inline bool operator!=(const QShaderDescription::PushConstantBlock &lhs, const QShaderDescription::PushConstantBlock &rhs) Q_DECL_NOTHROW
-{
- return !(lhs == rhs);
-}
-
-inline bool operator!=(const QShaderDescription::StorageBlock &lhs, const QShaderDescription::StorageBlock &rhs) Q_DECL_NOTHROW
-{
- return !(lhs == rhs);
-}
-
QT_END_NAMESPACE
#endif
diff --git a/src/gui/rhi/qshaderdescription_p_p.h b/src/gui/rhi/qshaderdescription_p_p.h
deleted file mode 100644
index 1caee24984..0000000000
--- a/src/gui/rhi/qshaderdescription_p_p.h
+++ /dev/null
@@ -1,98 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2019 The Qt Company Ltd.
-** Contact: http://www.qt.io/licensing/
-**
-** This file is part of the Qt Gui module
-**
-** $QT_BEGIN_LICENSE:LGPL3$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef QSHADERDESCRIPTION_P_H
-#define QSHADERDESCRIPTION_P_H
-
-//
-// W A R N I N G
-// -------------
-//
-// This file is not part of the Qt API. It exists for the convenience
-// of a number of Qt sources files. This header file may change from
-// version to version without notice, or even be removed.
-//
-// We mean it.
-//
-
-#include "qshaderdescription_p.h"
-#include <QtCore/QVector>
-#include <QtCore/QAtomicInt>
-#include <QtCore/QJsonDocument>
-
-QT_BEGIN_NAMESPACE
-
-struct Q_GUI_EXPORT QShaderDescriptionPrivate
-{
- QShaderDescriptionPrivate()
- : ref(1)
- {
- localSize[0] = localSize[1] = localSize[2] = 0;
- }
-
- QShaderDescriptionPrivate(const QShaderDescriptionPrivate *other)
- : ref(1),
- inVars(other->inVars),
- outVars(other->outVars),
- uniformBlocks(other->uniformBlocks),
- pushConstantBlocks(other->pushConstantBlocks),
- storageBlocks(other->storageBlocks),
- combinedImageSamplers(other->combinedImageSamplers),
- storageImages(other->storageImages),
- localSize(other->localSize)
- {
- }
-
- static QShaderDescriptionPrivate *get(QShaderDescription *desc) { return desc->d; }
- static const QShaderDescriptionPrivate *get(const QShaderDescription *desc) { return desc->d; }
-
- QJsonDocument makeDoc();
- void loadDoc(const QJsonDocument &doc);
-
- QAtomicInt ref;
- QVector<QShaderDescription::InOutVariable> inVars;
- QVector<QShaderDescription::InOutVariable> outVars;
- QVector<QShaderDescription::UniformBlock> uniformBlocks;
- QVector<QShaderDescription::PushConstantBlock> pushConstantBlocks;
- QVector<QShaderDescription::StorageBlock> storageBlocks;
- QVector<QShaderDescription::InOutVariable> combinedImageSamplers;
- QVector<QShaderDescription::InOutVariable> storageImages;
- std::array<uint, 3> localSize;
-};
-
-QT_END_NAMESPACE
-
-#endif
diff --git a/src/gui/rhi/qt_attribution.json b/src/gui/rhi/qt_attribution.json
new file mode 100644
index 0000000000..c356f5f087
--- /dev/null
+++ b/src/gui/rhi/qt_attribution.json
@@ -0,0 +1,16 @@
+[
+ {
+ "Id": "rhi-miniengine-d3d12-mipmap",
+ "Name": "Mipmap generator for D3D12",
+ "QDocModule": "qtgui",
+ "Description": "Compute shader for mipmap generation from MiniEngine in DirectX-Graphics-Samples",
+ "QtUsage": "Compute shader for mipmap generation with Direct 3D 12",
+
+ "Homepage": "https://github.com/microsoft/DirectX-Graphics-Samples",
+ "Version": "0aa79bad78992da0b6a8279ddb9002c1753cb849",
+ "License": "MIT License",
+ "LicenseId": "MIT",
+ "LicenseFile": "MiniEngine_LICENSE.txt",
+ "Copyright": "Copyright (c) 2015 Microsoft"
+ }
+]
diff --git a/src/gui/rhi/rhi.pri b/src/gui/rhi/rhi.pri
deleted file mode 100644
index ccd9592634..0000000000
--- a/src/gui/rhi/rhi.pri
+++ /dev/null
@@ -1,57 +0,0 @@
-HEADERS += \
- rhi/qrhi_p.h \
- rhi/qrhi_p_p.h \
- rhi/qrhiprofiler_p.h \
- rhi/qrhiprofiler_p_p.h \
- rhi/qrhinull_p.h \
- rhi/qrhinull_p_p.h \
- rhi/qshader_p.h \
- rhi/qshader_p_p.h \
- rhi/qshaderdescription_p.h \
- rhi/qshaderdescription_p_p.h
-
-SOURCES += \
- rhi/qrhi.cpp \
- rhi/qrhiprofiler.cpp \
- rhi/qrhinull.cpp \
- rhi/qshaderdescription.cpp \
- rhi/qshader.cpp
-
-qtConfig(opengl) {
- HEADERS += \
- rhi/qrhigles2_p.h \
- rhi/qrhigles2_p_p.h
- SOURCES += \
- rhi/qrhigles2.cpp
-}
-
-qtConfig(vulkan) {
- HEADERS += \
- rhi/qrhivulkan_p.h \
- rhi/qrhivulkan_p_p.h
- SOURCES += \
- rhi/qrhivulkan.cpp
-}
-
-win32 {
- HEADERS += \
- rhi/qrhid3d11_p.h \
- rhi/qrhid3d11_p_p.h
- SOURCES += \
- rhi/qrhid3d11.cpp
-
- LIBS += -ld3d11 -ldxgi -ldxguid
-}
-
-macos|ios {
- HEADERS += \
- rhi/qrhimetal_p.h \
- rhi/qrhimetal_p_p.h
- SOURCES += \
- rhi/qrhimetal.mm
-
- macos: LIBS += -framework AppKit
- LIBS += -framework Metal
-}
-
-include($$PWD/../../3rdparty/VulkanMemoryAllocator.pri)
diff --git a/src/gui/rhi/tdr.hlsl b/src/gui/rhi/tdr.hlsl
deleted file mode 100644
index f79de91c4a..0000000000
--- a/src/gui/rhi/tdr.hlsl
+++ /dev/null
@@ -1,9 +0,0 @@
-RWBuffer<uint> uav;
-cbuffer ConstantBuffer { uint zero; }
-
-[numthreads(256, 1, 1)]
-void killDeviceByTimingOut(uint3 id: SV_DispatchThreadID)
-{
- while (zero == 0)
- uav[id.x] = zero;
-}
diff --git a/src/gui/rhi/test.hlsl b/src/gui/rhi/test.hlsl
new file mode 100644
index 0000000000..2417762f83
--- /dev/null
+++ b/src/gui/rhi/test.hlsl
@@ -0,0 +1,24 @@
+struct Input
+{
+ float4 position : TEXCOORD0;
+ float3 color : TEXCOORD1;
+};
+
+struct Output
+{
+ float4 position : SV_Position;
+ float3 color : TEXCOORD0;
+};
+
+cbuffer buf : register(b0)
+{
+ row_major float4x4 ubuf_mvp;
+};
+
+Output main(Input input)
+{
+ Output output;
+ output.position = mul(input.position, ubuf_mvp);
+ output.color = input.color;
+ return output;
+}
diff --git a/src/gui/rhi/vs_test_p.h b/src/gui/rhi/vs_test_p.h
new file mode 100644
index 0000000000..5feaef7d38
--- /dev/null
+++ b/src/gui/rhi/vs_test_p.h
@@ -0,0 +1,237 @@
+// Copyright (C) 2022 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
+
+#ifndef VS_TEST_P_H
+#define VS_TEST_P_H
+
+//
+// W A R N I N G
+// -------------
+//
+// This file is not part of the Qt API. It exists for the convenience
+// of other Qt classes. This header file may change from version to
+// version without notice, or even be removed.
+//
+// We mean it.
+//
+
+#include <QtCore/private/qglobal_p.h>
+
+#ifdef Q_OS_WIN
+
+#include <qt_windows.h>
+
+#if 0
+//
+// Generated by Microsoft (R) HLSL Shader Compiler 10.1
+//
+//
+// Buffer Definitions:
+//
+// cbuffer buf
+// {
+//
+// row_major float4x4 ubuf_mvp; // Offset: 0 Size: 64
+//
+// }
+//
+//
+// Resource Bindings:
+//
+// Name Type Format Dim HLSL Bind Count
+// ------------------------------ ---------- ------- ----------- -------------- ------
+// buf cbuffer NA NA cb0 1
+//
+//
+//
+// Input signature:
+//
+// Name Index Mask Register SysValue Format Used
+// -------------------- ----- ------ -------- -------- ------- ------
+// TEXCOORD 0 xyzw 0 NONE float xyzw
+// TEXCOORD 1 xyz 1 NONE float xyz
+//
+//
+// Output signature:
+//
+// Name Index Mask Register SysValue Format Used
+// -------------------- ----- ------ -------- -------- ------- ------
+// SV_Position 0 xyzw 0 POS float xyzw
+// TEXCOORD 0 xyz 1 NONE float xyz
+//
+vs_5_0
+dcl_globalFlags refactoringAllowed
+dcl_constantbuffer CB0[4], immediateIndexed
+dcl_input v0.xyzw
+dcl_input v1.xyz
+dcl_output_siv o0.xyzw, position
+dcl_output o1.xyz
+dcl_temps 1
+mul r0.xyzw, v0.yyyy, cb0[1].xyzw
+mad r0.xyzw, v0.xxxx, cb0[0].xyzw, r0.xyzw
+mad r0.xyzw, v0.zzzz, cb0[2].xyzw, r0.xyzw
+mad o0.xyzw, v0.wwww, cb0[3].xyzw, r0.xyzw
+mov o1.xyz, v1.xyzx
+ret
+// Approximately 6 instruction slots used
+#endif
+
+inline constexpr BYTE g_testVertexShader[] =
+{
+ 68, 88, 66, 67, 75, 198,
+ 18, 149, 172, 244, 247, 123,
+ 98, 31, 128, 185, 22, 199,
+ 182, 233, 1, 0, 0, 0,
+ 140, 3, 0, 0, 5, 0,
+ 0, 0, 52, 0, 0, 0,
+ 60, 1, 0, 0, 136, 1,
+ 0, 0, 224, 1, 0, 0,
+ 240, 2, 0, 0, 82, 68,
+ 69, 70, 0, 1, 0, 0,
+ 1, 0, 0, 0, 96, 0,
+ 0, 0, 1, 0, 0, 0,
+ 60, 0, 0, 0, 0, 5,
+ 254, 255, 0, 1, 0, 0,
+ 216, 0, 0, 0, 82, 68,
+ 49, 49, 60, 0, 0, 0,
+ 24, 0, 0, 0, 32, 0,
+ 0, 0, 40, 0, 0, 0,
+ 36, 0, 0, 0, 12, 0,
+ 0, 0, 0, 0, 0, 0,
+ 92, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 1, 0, 0, 0, 1, 0,
+ 0, 0, 98, 117, 102, 0,
+ 92, 0, 0, 0, 1, 0,
+ 0, 0, 120, 0, 0, 0,
+ 64, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 160, 0, 0, 0, 0, 0,
+ 0, 0, 64, 0, 0, 0,
+ 2, 0, 0, 0, 180, 0,
+ 0, 0, 0, 0, 0, 0,
+ 255, 255, 255, 255, 0, 0,
+ 0, 0, 255, 255, 255, 255,
+ 0, 0, 0, 0, 117, 98,
+ 117, 102, 95, 109, 118, 112,
+ 0, 102, 108, 111, 97, 116,
+ 52, 120, 52, 0, 171, 171,
+ 2, 0, 3, 0, 4, 0,
+ 4, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 0, 0, 169, 0, 0, 0,
+ 77, 105, 99, 114, 111, 115,
+ 111, 102, 116, 32, 40, 82,
+ 41, 32, 72, 76, 83, 76,
+ 32, 83, 104, 97, 100, 101,
+ 114, 32, 67, 111, 109, 112,
+ 105, 108, 101, 114, 32, 49,
+ 48, 46, 49, 0, 73, 83,
+ 71, 78, 68, 0, 0, 0,
+ 2, 0, 0, 0, 8, 0,
+ 0, 0, 56, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 0, 0, 3, 0, 0, 0,
+ 0, 0, 0, 0, 15, 15,
+ 0, 0, 56, 0, 0, 0,
+ 1, 0, 0, 0, 0, 0,
+ 0, 0, 3, 0, 0, 0,
+ 1, 0, 0, 0, 7, 7,
+ 0, 0, 84, 69, 88, 67,
+ 79, 79, 82, 68, 0, 171,
+ 171, 171, 79, 83, 71, 78,
+ 80, 0, 0, 0, 2, 0,
+ 0, 0, 8, 0, 0, 0,
+ 56, 0, 0, 0, 0, 0,
+ 0, 0, 1, 0, 0, 0,
+ 3, 0, 0, 0, 0, 0,
+ 0, 0, 15, 0, 0, 0,
+ 68, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 3, 0, 0, 0, 1, 0,
+ 0, 0, 7, 8, 0, 0,
+ 83, 86, 95, 80, 111, 115,
+ 105, 116, 105, 111, 110, 0,
+ 84, 69, 88, 67, 79, 79,
+ 82, 68, 0, 171, 171, 171,
+ 83, 72, 69, 88, 8, 1,
+ 0, 0, 80, 0, 1, 0,
+ 66, 0, 0, 0, 106, 8,
+ 0, 1, 89, 0, 0, 4,
+ 70, 142, 32, 0, 0, 0,
+ 0, 0, 4, 0, 0, 0,
+ 95, 0, 0, 3, 242, 16,
+ 16, 0, 0, 0, 0, 0,
+ 95, 0, 0, 3, 114, 16,
+ 16, 0, 1, 0, 0, 0,
+ 103, 0, 0, 4, 242, 32,
+ 16, 0, 0, 0, 0, 0,
+ 1, 0, 0, 0, 101, 0,
+ 0, 3, 114, 32, 16, 0,
+ 1, 0, 0, 0, 104, 0,
+ 0, 2, 1, 0, 0, 0,
+ 56, 0, 0, 8, 242, 0,
+ 16, 0, 0, 0, 0, 0,
+ 86, 21, 16, 0, 0, 0,
+ 0, 0, 70, 142, 32, 0,
+ 0, 0, 0, 0, 1, 0,
+ 0, 0, 50, 0, 0, 10,
+ 242, 0, 16, 0, 0, 0,
+ 0, 0, 6, 16, 16, 0,
+ 0, 0, 0, 0, 70, 142,
+ 32, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 70, 14,
+ 16, 0, 0, 0, 0, 0,
+ 50, 0, 0, 10, 242, 0,
+ 16, 0, 0, 0, 0, 0,
+ 166, 26, 16, 0, 0, 0,
+ 0, 0, 70, 142, 32, 0,
+ 0, 0, 0, 0, 2, 0,
+ 0, 0, 70, 14, 16, 0,
+ 0, 0, 0, 0, 50, 0,
+ 0, 10, 242, 32, 16, 0,
+ 0, 0, 0, 0, 246, 31,
+ 16, 0, 0, 0, 0, 0,
+ 70, 142, 32, 0, 0, 0,
+ 0, 0, 3, 0, 0, 0,
+ 70, 14, 16, 0, 0, 0,
+ 0, 0, 54, 0, 0, 5,
+ 114, 32, 16, 0, 1, 0,
+ 0, 0, 70, 18, 16, 0,
+ 1, 0, 0, 0, 62, 0,
+ 0, 1, 83, 84, 65, 84,
+ 148, 0, 0, 0, 6, 0,
+ 0, 0, 1, 0, 0, 0,
+ 0, 0, 0, 0, 4, 0,
+ 0, 0, 4, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 0, 0, 1, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 0, 0, 1, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 0, 0
+};
+
+#endif // Q_OS_WIN
+
+#endif // VS_TEST_P_H
diff --git a/src/gui/text/coretext/qcoretextfontdatabase.mm b/src/gui/text/coretext/qcoretextfontdatabase.mm
new file mode 100644
index 0000000000..19f3a2b335
--- /dev/null
+++ b/src/gui/text/coretext/qcoretextfontdatabase.mm
@@ -0,0 +1,1023 @@
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
+
+#include "qglobal.h"
+
+#include <sys/param.h>
+
+#if defined(Q_OS_MACOS)
+#import <AppKit/AppKit.h>
+#import <IOKit/graphics/IOGraphicsLib.h>
+#elif defined(QT_PLATFORM_UIKIT)
+#import <UIKit/UIFont.h>
+#endif
+
+#include <QtCore/qelapsedtimer.h>
+#include <QtCore/private/qcore_mac_p.h>
+
+#include "qcoretextfontdatabase_p.h"
+#include "qfontengine_coretext_p.h"
+#if QT_CONFIG(settings)
+#include <QtCore/QSettings>
+#endif
+#include <QtCore/QtEndian>
+#ifndef QT_NO_FREETYPE
+#include <QtGui/private/qfontengine_ft_p.h>
+#endif
+
+#include <QtGui/qpa/qwindowsysteminterface.h>
+
+QT_BEGIN_NAMESPACE
+
+using namespace Qt::StringLiterals;
+
+QT_IMPL_METATYPE_EXTERN_TAGGED(QCFType<CGFontRef>, QCFType_CGFontRef)
+QT_IMPL_METATYPE_EXTERN_TAGGED(QCFType<CFURLRef>, QCFType_CFURLRef)
+
+// this could become a list of all languages used for each writing
+// system, instead of using the single most common language.
+static const char languageForWritingSystem[][8] = {
+ "", // Any
+ "en", // Latin
+ "el", // Greek
+ "ru", // Cyrillic
+ "hy", // Armenian
+ "he", // Hebrew
+ "ar", // Arabic
+ "syr", // Syriac
+ "div", // Thaana
+ "hi", // Devanagari
+ "bn", // Bengali
+ "pa", // Gurmukhi
+ "gu", // Gujarati
+ "or", // Oriya
+ "ta", // Tamil
+ "te", // Telugu
+ "kn", // Kannada
+ "ml", // Malayalam
+ "si", // Sinhala
+ "th", // Thai
+ "lo", // Lao
+ "bo", // Tibetan
+ "my", // Myanmar
+ "ka", // Georgian
+ "km", // Khmer
+ "zh-Hans", // SimplifiedChinese
+ "zh-Hant", // TraditionalChinese
+ "ja", // Japanese
+ "ko", // Korean
+ "vi", // Vietnamese
+ "", // Symbol
+ "sga", // Ogham
+ "non", // Runic
+ "man" // N'Ko
+};
+enum { LanguageCount = sizeof languageForWritingSystem / sizeof *languageForWritingSystem };
+
+QCoreTextFontDatabase::QCoreTextFontDatabase()
+ : m_hasPopulatedAliases(false)
+{
+#if defined(Q_OS_MACOS)
+ m_fontSetObserver = QMacNotificationObserver(nil, NSFontSetChangedNotification, [] {
+ qCDebug(lcQpaFonts) << "Fonts have changed";
+ QPlatformFontDatabase::repopulateFontDatabase();
+ });
+#endif
+}
+
+QCoreTextFontDatabase::~QCoreTextFontDatabase()
+{
+ qDeleteAll(m_themeFonts);
+}
+
+CTFontDescriptorRef descriptorForFamily(const QString &familyName)
+{
+ return CTFontDescriptorCreateWithAttributes(CFDictionaryRef(@{
+ (id)kCTFontFamilyNameAttribute: familyName.toNSString()
+ }));
+}
+void QCoreTextFontDatabase::populateFontDatabase()
+{
+ qCDebug(lcQpaFonts) << "Populating font database...";
+ QElapsedTimer elapsed;
+ if (lcQpaFonts().isDebugEnabled())
+ elapsed.start();
+
+ QCFType<CFArrayRef> familyNames = CTFontManagerCopyAvailableFontFamilyNames();
+ for (NSString *familyName in familyNames.as<const NSArray *>())
+ QPlatformFontDatabase::registerFontFamily(QString::fromNSString(familyName));
+
+ // Some fonts has special handling since macOS Catalina: It is available
+ // on the platform, so that it may be used by applications directly, but does not
+ // get enumerated. Since there are no alternatives, we hardcode it.
+ if (QOperatingSystemVersion::current() >= QOperatingSystemVersion::MacOSCatalina
+ && !qEnvironmentVariableIsSet("QT_NO_HARDCODED_FALLBACK_FONTS")) {
+ m_hardcodedFallbackFonts[QChar::Script_Adlam] = QStringLiteral("Noto Sans Adlam");
+ m_hardcodedFallbackFonts[QChar::Script_Ahom] = QStringLiteral("Noto Serif Ahom");
+ m_hardcodedFallbackFonts[QChar::Script_Avestan] = QStringLiteral("Noto Sans Avestan");
+ m_hardcodedFallbackFonts[QChar::Script_Balinese] = QStringLiteral("Noto Serif Balinese");
+ m_hardcodedFallbackFonts[QChar::Script_Bamum] = QStringLiteral("Noto Sans Bamum");
+ m_hardcodedFallbackFonts[QChar::Script_BassaVah] = QStringLiteral("Noto Sans Bassa Vah");
+ m_hardcodedFallbackFonts[QChar::Script_Batak] = QStringLiteral("Noto Sans Batak");
+ m_hardcodedFallbackFonts[QChar::Script_Bhaiksuki] = QStringLiteral("Noto Sans Bhaiksuki");
+ m_hardcodedFallbackFonts[QChar::Script_Brahmi] = QStringLiteral("Noto Sans Brahmi");
+ m_hardcodedFallbackFonts[QChar::Script_Buginese] = QStringLiteral("Noto Sans Buginese");
+ m_hardcodedFallbackFonts[QChar::Script_Buhid] = QStringLiteral("Noto Sans Buhid");
+ m_hardcodedFallbackFonts[QChar::Script_Carian] = QStringLiteral("Noto Sans Carian");
+ m_hardcodedFallbackFonts[QChar::Script_CaucasianAlbanian] = QStringLiteral("Noto Sans Caucasian Albanian");
+ m_hardcodedFallbackFonts[QChar::Script_Chakma] = QStringLiteral("Noto Sans Chakma");
+ m_hardcodedFallbackFonts[QChar::Script_Cham] = QStringLiteral("Noto Sans Cham");
+ m_hardcodedFallbackFonts[QChar::Script_Coptic] = QStringLiteral("Noto Sans Coptic");
+ m_hardcodedFallbackFonts[QChar::Script_Cuneiform] = QStringLiteral("Noto Sans Cuneiform");
+ m_hardcodedFallbackFonts[QChar::Script_Cypriot] = QStringLiteral("Noto Sans Cypriot");
+ m_hardcodedFallbackFonts[QChar::Script_Duployan] = QStringLiteral("Noto Sans Duployan");
+ m_hardcodedFallbackFonts[QChar::Script_EgyptianHieroglyphs] = QStringLiteral("Noto Sans Egyptian Hieroglyphs");
+ m_hardcodedFallbackFonts[QChar::Script_Elbasan] = QStringLiteral("Noto Sans Elbasan");
+ m_hardcodedFallbackFonts[QChar::Script_Glagolitic] = QStringLiteral("Noto Sans Glagolitic");
+ m_hardcodedFallbackFonts[QChar::Script_Gothic] = QStringLiteral("Noto Sans Gothic");
+ m_hardcodedFallbackFonts[QChar::Script_HanifiRohingya] = QStringLiteral("Noto Sans Hanifi Rohingya");
+ m_hardcodedFallbackFonts[QChar::Script_Hanunoo] = QStringLiteral("Noto Sans Hanunoo");
+ m_hardcodedFallbackFonts[QChar::Script_Hatran] = QStringLiteral("Noto Sans Hatran");
+ m_hardcodedFallbackFonts[QChar::Script_ImperialAramaic] = QStringLiteral("Noto Sans Imperial Aramaic");
+ m_hardcodedFallbackFonts[QChar::Script_InscriptionalPahlavi] = QStringLiteral("Noto Sans Inscriptional Pahlavi");
+ m_hardcodedFallbackFonts[QChar::Script_InscriptionalParthian] = QStringLiteral("Noto Sans Inscriptional Parthian");
+ m_hardcodedFallbackFonts[QChar::Script_Javanese] = QStringLiteral("Noto Sans Javanese");
+ m_hardcodedFallbackFonts[QChar::Script_Kaithi] = QStringLiteral("Noto Sans Kaithi");
+ m_hardcodedFallbackFonts[QChar::Script_KayahLi] = QStringLiteral("Noto Sans Kayah Li");
+ m_hardcodedFallbackFonts[QChar::Script_Kharoshthi] = QStringLiteral("Noto Sans Kharoshthi");
+ m_hardcodedFallbackFonts[QChar::Script_Khojki] = QStringLiteral("Noto Sans Khojki");
+ m_hardcodedFallbackFonts[QChar::Script_Khudawadi] = QStringLiteral("Noto Sans Khudawadi");
+ m_hardcodedFallbackFonts[QChar::Script_Lepcha] = QStringLiteral("Noto Sans Lepcha");
+ m_hardcodedFallbackFonts[QChar::Script_Limbu] = QStringLiteral("Noto Sans Limbu");
+ m_hardcodedFallbackFonts[QChar::Script_LinearA] = QStringLiteral("Noto Sans Linear A");
+ m_hardcodedFallbackFonts[QChar::Script_LinearB] = QStringLiteral("Noto Sans Linear B");
+ m_hardcodedFallbackFonts[QChar::Script_Lisu] = QStringLiteral("Noto Sans Lisu");
+ m_hardcodedFallbackFonts[QChar::Script_Lycian] = QStringLiteral("Noto Sans Lycian");
+ m_hardcodedFallbackFonts[QChar::Script_Lydian] = QStringLiteral("Noto Sans Lydian");
+ m_hardcodedFallbackFonts[QChar::Script_Mahajani] = QStringLiteral("Noto Sans Mahajani");
+ m_hardcodedFallbackFonts[QChar::Script_Mandaic] = QStringLiteral("Noto Sans Mandaic");
+ m_hardcodedFallbackFonts[QChar::Script_Manichaean] = QStringLiteral("Noto Sans Manichaean");
+ m_hardcodedFallbackFonts[QChar::Script_Marchen] = QStringLiteral("Noto Sans Marchen");
+ m_hardcodedFallbackFonts[QChar::Script_MendeKikakui] = QStringLiteral("Noto Sans Mende Kikakui");
+ m_hardcodedFallbackFonts[QChar::Script_MeroiticCursive] = QStringLiteral("Noto Sans Meroitic");
+ m_hardcodedFallbackFonts[QChar::Script_MeroiticHieroglyphs] = QStringLiteral("Noto Sans Meroitic");
+ m_hardcodedFallbackFonts[QChar::Script_Miao] = QStringLiteral("Noto Sans Miao");
+ m_hardcodedFallbackFonts[QChar::Script_Modi] = QStringLiteral("Noto Sans Modi");
+ m_hardcodedFallbackFonts[QChar::Script_Mongolian] = QStringLiteral("Noto Sans Mongolian");
+ m_hardcodedFallbackFonts[QChar::Script_Mro] = QStringLiteral("Noto Sans Mro");
+ m_hardcodedFallbackFonts[QChar::Script_MeeteiMayek] = QStringLiteral("Noto Sans Meetei Mayek");
+ m_hardcodedFallbackFonts[QChar::Script_Multani] = QStringLiteral("Noto Sans Multani");
+ m_hardcodedFallbackFonts[QChar::Script_Nabataean] = QStringLiteral("Noto Sans Nabataean");
+ m_hardcodedFallbackFonts[QChar::Script_Newa] = QStringLiteral("Noto Sans Newa");
+ m_hardcodedFallbackFonts[QChar::Script_NewTaiLue] = QStringLiteral("Noto Sans New Tai Lue");
+ m_hardcodedFallbackFonts[QChar::Script_Nko] = QStringLiteral("Noto Sans Nko");
+ m_hardcodedFallbackFonts[QChar::Script_OlChiki] = QStringLiteral("Noto Sans Ol Chiki");
+ m_hardcodedFallbackFonts[QChar::Script_OldHungarian] = QStringLiteral("Noto Sans Old Hungarian");
+ m_hardcodedFallbackFonts[QChar::Script_OldItalic] = QStringLiteral("Noto Sans Old Italic");
+ m_hardcodedFallbackFonts[QChar::Script_OldNorthArabian] = QStringLiteral("Noto Sans Old North Arabian");
+ m_hardcodedFallbackFonts[QChar::Script_OldPermic] = QStringLiteral("Noto Sans Old Permic");
+ m_hardcodedFallbackFonts[QChar::Script_OldPersian] = QStringLiteral("Noto Sans Old Persian");
+ m_hardcodedFallbackFonts[QChar::Script_OldSouthArabian] = QStringLiteral("Noto Sans Old South Arabian");
+ m_hardcodedFallbackFonts[QChar::Script_OldTurkic] = QStringLiteral("Noto Sans Old Turkic");
+ m_hardcodedFallbackFonts[QChar::Script_Osage] = QStringLiteral("Noto Sans Osage");
+ m_hardcodedFallbackFonts[QChar::Script_Osmanya] = QStringLiteral("Noto Sans Osmanya");
+ m_hardcodedFallbackFonts[QChar::Script_PahawhHmong] = QStringLiteral("Noto Sans Pahawh Hmong");
+ m_hardcodedFallbackFonts[QChar::Script_Palmyrene] = QStringLiteral("Noto Sans Palmyrene");
+ m_hardcodedFallbackFonts[QChar::Script_PauCinHau] = QStringLiteral("Noto Sans Pau Cin Hau");
+ m_hardcodedFallbackFonts[QChar::Script_PhagsPa] = QStringLiteral("Noto Sans PhagsPa");
+ m_hardcodedFallbackFonts[QChar::Script_Phoenician] = QStringLiteral("Noto Sans Phoenician");
+ m_hardcodedFallbackFonts[QChar::Script_PsalterPahlavi] = QStringLiteral("Noto Sans Psalter Pahlavi");
+ m_hardcodedFallbackFonts[QChar::Script_Rejang] = QStringLiteral("Noto Sans Rejang");
+ m_hardcodedFallbackFonts[QChar::Script_Samaritan] = QStringLiteral("Noto Sans Samaritan");
+ m_hardcodedFallbackFonts[QChar::Script_Saurashtra] = QStringLiteral("Noto Sans Saurashtra");
+ m_hardcodedFallbackFonts[QChar::Script_Sharada] = QStringLiteral("Noto Sans Sharada");
+ m_hardcodedFallbackFonts[QChar::Script_Siddham] = QStringLiteral("Noto Sans Siddham");
+ m_hardcodedFallbackFonts[QChar::Script_SoraSompeng] = QStringLiteral("Noto Sans Sora Sompeng");
+ m_hardcodedFallbackFonts[QChar::Script_Sundanese] = QStringLiteral("Noto Sans Sundanese");
+ m_hardcodedFallbackFonts[QChar::Script_SylotiNagri] = QStringLiteral("Noto Sans Syloti Nagri");
+ m_hardcodedFallbackFonts[QChar::Script_Tagalog] = QStringLiteral("Noto Sans Tagalog");
+ m_hardcodedFallbackFonts[QChar::Script_Tagbanwa] = QStringLiteral("Noto Sans Tagbanwa");
+ m_hardcodedFallbackFonts[QChar::Script_Takri] = QStringLiteral("Noto Sans Takri");
+ m_hardcodedFallbackFonts[QChar::Script_TaiLe] = QStringLiteral("Noto Sans Tai Le");
+ m_hardcodedFallbackFonts[QChar::Script_TaiTham] = QStringLiteral("Noto Sans Tai Tham");
+ m_hardcodedFallbackFonts[QChar::Script_TaiViet] = QStringLiteral("Noto Sans Tai Viet");
+ m_hardcodedFallbackFonts[QChar::Script_Thaana] = QStringLiteral("Noto Sans Thaana");
+ m_hardcodedFallbackFonts[QChar::Script_Tifinagh] = QStringLiteral("Noto Sans Tifinagh");
+ m_hardcodedFallbackFonts[QChar::Script_Tirhuta] = QStringLiteral("Noto Sans Tirhuta");
+ m_hardcodedFallbackFonts[QChar::Script_Ugaritic] = QStringLiteral("Noto Sans Ugaritic");
+ m_hardcodedFallbackFonts[QChar::Script_Vai] = QStringLiteral("Noto Sans Vai");
+ m_hardcodedFallbackFonts[QChar::Script_WarangCiti] = QStringLiteral("Noto Sans Warang Citi");
+ m_hardcodedFallbackFonts[QChar::Script_Wancho] = QStringLiteral("Noto Sans Wancho");
+ m_hardcodedFallbackFonts[QChar::Script_Yi] = QStringLiteral("Noto Sans Yi");
+ }
+
+ qCDebug(lcQpaFonts) << "Populating available families took" << elapsed.restart() << "ms";
+
+ populateThemeFonts();
+
+ for (auto familyName : m_systemFontDescriptors.keys()) {
+ for (auto fontDescriptor : m_systemFontDescriptors.value(familyName))
+ populateFromDescriptor(fontDescriptor, familyName);
+ }
+
+ // The font database now has a reference to the original descriptors
+ m_systemFontDescriptors.clear();
+
+ qCDebug(lcQpaFonts) << "Populating system descriptors took" << elapsed.restart() << "ms";
+
+ Q_ASSERT(!m_hasPopulatedAliases);
+}
+
+bool QCoreTextFontDatabase::populateFamilyAliases(const QString &missingFamily)
+{
+#if defined(Q_OS_MACOS)
+ if (isFamilyPopulated(missingFamily)) {
+ // We got here because one of the other properties of the font mismatched,
+ // for example the style, so there's no point in populating font aliases.
+ return false;
+ }
+
+ if (m_hasPopulatedAliases)
+ return false;
+
+ // There's no API to go from a localized family name to its non-localized
+ // name, so we have to resort to enumerating all the available fonts and
+ // doing a reverse lookup.
+
+ qCDebug(lcQpaFonts) << "Populating family aliases...";
+ QElapsedTimer elapsed;
+ elapsed.start();
+
+ QString nonLocalizedMatch;
+ QCFType<CFArrayRef> familyNames = CTFontManagerCopyAvailableFontFamilyNames();
+ NSFontManager *fontManager = NSFontManager.sharedFontManager;
+ for (NSString *familyName in familyNames.as<const NSArray *>()) {
+ NSString *localizedFamilyName = [fontManager localizedNameForFamily:familyName face:nil];
+ if (![localizedFamilyName isEqual:familyName]) {
+ QString nonLocalizedFamily = QString::fromNSString(familyName);
+ QString localizedFamily = QString::fromNSString(localizedFamilyName);
+ QPlatformFontDatabase::registerAliasToFontFamily(nonLocalizedFamily, localizedFamily);
+ if (localizedFamily == missingFamily)
+ nonLocalizedMatch = nonLocalizedFamily;
+ }
+ }
+ m_hasPopulatedAliases = true;
+
+ if (lcQpaFonts().isWarningEnabled()) {
+ QString warningMessage;
+ QDebug msg(&warningMessage);
+
+ msg << "Populating font family aliases took" << elapsed.restart() << "ms.";
+ if (!nonLocalizedMatch.isNull())
+ msg << "Replace uses of" << missingFamily << "with its non-localized name" << nonLocalizedMatch;
+ else
+ msg << "Replace uses of missing font family" << missingFamily << "with one that exists";
+ msg << "to avoid this cost.";
+
+ qCWarning(lcQpaFonts) << qPrintable(warningMessage);
+ }
+
+ return true;
+#else
+ Q_UNUSED(missingFamily);
+ return false;
+#endif
+}
+
+CTFontDescriptorRef descriptorForFamily(const char *familyName)
+{
+ return descriptorForFamily(QString::fromLatin1(familyName));
+}
+
+void QCoreTextFontDatabase::populateFamily(const QString &familyName)
+{
+ qCDebug(lcQpaFonts) << "Populating family" << familyName;
+
+ // A single family might match several different fonts with different styles.
+ // We need to add them all so that the font database has the full picture,
+ // as once a family has been populated we will not populate it again.
+ QCFType<CTFontDescriptorRef> familyDescriptor = descriptorForFamily(familyName);
+ QCFType<CFArrayRef> matchingFonts = CTFontDescriptorCreateMatchingFontDescriptors(familyDescriptor, nullptr);
+ if (!matchingFonts) {
+ qCWarning(lcQpaFonts) << "QCoreTextFontDatabase: Found no matching fonts for family" << familyName;
+ return;
+ }
+
+ const int numFonts = CFArrayGetCount(matchingFonts);
+ for (int i = 0; i < numFonts; ++i)
+ populateFromDescriptor(CTFontDescriptorRef(CFArrayGetValueAtIndex(matchingFonts, i)), familyName);
+}
+
+void QCoreTextFontDatabase::invalidate()
+{
+ qCDebug(lcQpaFonts) << "Invalidating font database";
+ m_hasPopulatedAliases = false;
+
+ qDeleteAll(m_themeFonts);
+ m_themeFonts.clear();
+ QWindowSystemInterface::handleThemeChange<QWindowSystemInterface::SynchronousDelivery>();
+}
+
+struct FontDescription {
+ QCFString familyName;
+ QCFString styleName;
+ QString foundryName;
+ QFont::Weight weight;
+ QFont::Style style;
+ QFont::Stretch stretch;
+ qreal pointSize;
+ bool fixedPitch;
+ QSupportedWritingSystems writingSystems;
+};
+
+#ifndef QT_NO_DEBUG_STREAM
+Q_DECL_UNUSED static inline QDebug operator<<(QDebug debug, const FontDescription &fd)
+{
+ QDebugStateSaver saver(debug);
+ return debug.nospace() << "FontDescription("
+ << "familyName=" << QString(fd.familyName)
+ << ", styleName=" << QString(fd.styleName)
+ << ", foundry=" << fd.foundryName
+ << ", weight=" << fd.weight
+ << ", style=" << fd.style
+ << ", stretch=" << fd.stretch
+ << ", pointSize=" << fd.pointSize
+ << ", fixedPitch=" << fd.fixedPitch
+ << ", writingSystems=" << fd.writingSystems
+ << ")";
+}
+#endif
+
+static void getFontDescription(CTFontDescriptorRef font, FontDescription *fd)
+{
+ QCFType<CFDictionaryRef> styles = (CFDictionaryRef) CTFontDescriptorCopyAttribute(font, kCTFontTraitsAttribute);
+
+ fd->foundryName = QStringLiteral("CoreText");
+ fd->familyName = (CFStringRef) CTFontDescriptorCopyAttribute(font, kCTFontFamilyNameAttribute);
+ fd->styleName = (CFStringRef)CTFontDescriptorCopyAttribute(font, kCTFontStyleNameAttribute);
+ fd->weight = QFont::Normal;
+ fd->style = QFont::StyleNormal;
+ fd->stretch = QFont::Unstretched;
+ fd->fixedPitch = false;
+
+ if (QCFType<CTFontRef> tempFont = CTFontCreateWithFontDescriptor(font, 0.0, 0)) {
+ uint tag = QFont::Tag("OS/2").value();
+ CTFontRef tempFontRef = tempFont;
+ void *userData = reinterpret_cast<void *>(&tempFontRef);
+ uint length = 128;
+ QVarLengthArray<uchar, 128> os2Table(length);
+ if (QCoreTextFontEngine::ct_getSfntTable(userData, tag, os2Table.data(), &length) && length >= 86) {
+ if (length > uint(os2Table.length())) {
+ os2Table.resize(length);
+ if (!QCoreTextFontEngine::ct_getSfntTable(userData, tag, os2Table.data(), &length))
+ Q_UNREACHABLE();
+ Q_ASSERT(length >= 86);
+ }
+ fd->writingSystems = QPlatformFontDatabase::writingSystemsFromOS2Table(reinterpret_cast<const char *>(os2Table.data()), length);
+ }
+ }
+
+ if (styles) {
+ if (CFNumberRef weightValue = (CFNumberRef) CFDictionaryGetValue(styles, kCTFontWeightTrait)) {
+ double normalizedWeight;
+ if (CFNumberGetValue(weightValue, kCFNumberFloat64Type, &normalizedWeight))
+ fd->weight = QCoreTextFontEngine::qtWeightFromCFWeight(float(normalizedWeight));
+ }
+ if (CFNumberRef italic = (CFNumberRef) CFDictionaryGetValue(styles, kCTFontSlantTrait)) {
+ double d;
+ if (CFNumberGetValue(italic, kCFNumberDoubleType, &d)) {
+ if (d > 0.0)
+ fd->style = QFont::StyleItalic;
+ }
+ }
+ if (CFNumberRef symbolic = (CFNumberRef) CFDictionaryGetValue(styles, kCTFontSymbolicTrait)) {
+ int d;
+ if (CFNumberGetValue(symbolic, kCFNumberSInt32Type, &d)) {
+ if (d & kCTFontMonoSpaceTrait)
+ fd->fixedPitch = true;
+ if (d & kCTFontExpandedTrait)
+ fd->stretch = QFont::Expanded;
+ else if (d & kCTFontCondensedTrait)
+ fd->stretch = QFont::Condensed;
+ }
+ }
+ }
+
+ if (QCFType<CFNumberRef> size = (CFNumberRef) CTFontDescriptorCopyAttribute(font, kCTFontSizeAttribute)) {
+ if (CFNumberIsFloatType(size)) {
+ double d;
+ CFNumberGetValue(size, kCFNumberDoubleType, &d);
+ fd->pointSize = d;
+ } else {
+ int i;
+ CFNumberGetValue(size, kCFNumberIntType, &i);
+ fd->pointSize = i;
+ }
+ }
+
+ if (QCFType<CFArrayRef> languages = (CFArrayRef) CTFontDescriptorCopyAttribute(font, kCTFontLanguagesAttribute)) {
+ CFIndex length = CFArrayGetCount(languages);
+ for (int i = 1; i < LanguageCount; ++i) {
+ if (!*languageForWritingSystem[i])
+ continue;
+ QCFString lang = CFStringCreateWithCString(NULL, languageForWritingSystem[i], kCFStringEncodingASCII);
+ if (CFArrayContainsValue(languages, CFRangeMake(0, length), lang))
+ fd->writingSystems.setSupported(QFontDatabase::WritingSystem(i));
+ }
+ }
+}
+
+void QCoreTextFontDatabase::populateFromDescriptor(CTFontDescriptorRef font, const QString &familyName, QFontDatabasePrivate::ApplicationFont *applicationFont)
+{
+ FontDescription fd;
+ getFontDescription(font, &fd);
+
+ // Note: The familyName we are registering, and the family name of the font descriptor, may not
+ // match, as CTFontDescriptorCreateMatchingFontDescriptors will return descriptors for replacement
+ // fonts if a font family does not have any fonts available on the system.
+ QString family = !familyName.isNull() ? familyName : static_cast<QString>(fd.familyName);
+
+ if (applicationFont != nullptr) {
+ QFontDatabasePrivate::ApplicationFont::Properties properties;
+ properties.familyName = family;
+ properties.styleName = fd.styleName;
+ properties.weight = fd.weight;
+ properties.stretch = fd.stretch;
+ properties.style = fd.style;
+
+ applicationFont->properties.append(properties);
+ }
+
+ CFRetain(font);
+ QPlatformFontDatabase::registerFont(family, fd.styleName, fd.foundryName, fd.weight, fd.style, fd.stretch,
+ true /* antialiased */, true /* scalable */, 0 /* pixelSize, ignored as font is scalable */,
+ fd.fixedPitch, fd.writingSystems, (void *)font);
+}
+
+static NSString * const kQtFontDataAttribute = @"QtFontDataAttribute";
+
+template <typename T>
+T *descriptorAttribute(CTFontDescriptorRef descriptor, CFStringRef name)
+{
+ return [static_cast<T *>(CTFontDescriptorCopyAttribute(descriptor, name)) autorelease];
+}
+
+void QCoreTextFontDatabase::releaseHandle(void *handle)
+{
+ CTFontDescriptorRef descriptor = static_cast<CTFontDescriptorRef>(handle);
+ if (NSValue *fontDataValue = descriptorAttribute<NSValue>(descriptor, (CFStringRef)kQtFontDataAttribute)) {
+ QByteArray *fontData = static_cast<QByteArray *>(fontDataValue.pointerValue);
+ delete fontData;
+ }
+ CFRelease(descriptor);
+}
+
+extern CGAffineTransform qt_transform_from_fontdef(const QFontDef &fontDef);
+
+template <>
+QFontEngine *QCoreTextFontDatabaseEngineFactory<QCoreTextFontEngine>::fontEngine(const QFontDef &fontDef, void *usrPtr)
+{
+ QCFType<CTFontDescriptorRef> descriptor = QCFType<CTFontDescriptorRef>::constructFromGet(
+ static_cast<CTFontDescriptorRef>(usrPtr));
+
+ // Since we do not pass in the destination DPI to CoreText when making
+ // the font, we need to pass in a point size which is scaled to include
+ // the DPI. The default DPI for the screen is 72, thus the scale factor
+ // is destinationDpi / 72, but since pixelSize = pointSize / 72 * dpi,
+ // the pixelSize is actually the scaled point size for the destination
+ // DPI, and we can use that directly.
+ qreal scaledPointSize = fontDef.pixelSize;
+
+ CGAffineTransform matrix = qt_transform_from_fontdef(fontDef);
+
+ if (!fontDef.variableAxisValues.isEmpty()) {
+ QCFType<CFMutableDictionaryRef> variations = CFDictionaryCreateMutable(nullptr,
+ fontDef.variableAxisValues.size(),
+ &kCFTypeDictionaryKeyCallBacks,
+ &kCFTypeDictionaryValueCallBacks);
+ for (auto it = fontDef.variableAxisValues.constBegin();
+ it != fontDef.variableAxisValues.constEnd();
+ ++it) {
+ const quint32 tag = it.key().value();
+ const float value = it.value();
+ QCFType<CFNumberRef> tagRef = CFNumberCreate(nullptr, kCFNumberIntType, &tag);
+ QCFType<CFNumberRef> valueRef = CFNumberCreate(nullptr, kCFNumberFloatType, &value);
+
+ CFDictionarySetValue(variations, tagRef, valueRef);
+ }
+ QCFType<CFDictionaryRef> attributes = CFDictionaryCreate(nullptr,
+ (const void **) &kCTFontVariationAttribute,
+ (const void **) &variations,
+ 1,
+ &kCFTypeDictionaryKeyCallBacks,
+ &kCFTypeDictionaryValueCallBacks);
+ descriptor = CTFontDescriptorCreateCopyWithAttributes(descriptor, attributes);
+ }
+
+ if (QCFType<CTFontRef> font = CTFontCreateWithFontDescriptor(descriptor, scaledPointSize, &matrix))
+ return new QCoreTextFontEngine(font, fontDef);
+
+ return nullptr;
+}
+
+#ifndef QT_NO_FREETYPE
+template <>
+QFontEngine *QCoreTextFontDatabaseEngineFactory<QFontEngineFT>::fontEngine(const QFontDef &fontDef, void *usrPtr)
+{
+ CTFontDescriptorRef descriptor = static_cast<CTFontDescriptorRef>(usrPtr);
+
+ if (NSValue *fontDataValue = descriptorAttribute<NSValue>(descriptor, (CFStringRef)kQtFontDataAttribute)) {
+ QByteArray *fontData = static_cast<QByteArray *>(fontDataValue.pointerValue);
+ return QFontEngineFT::create(*fontData, fontDef.pixelSize,
+ static_cast<QFont::HintingPreference>(fontDef.hintingPreference), fontDef.variableAxisValues);
+ } else if (NSURL *url = descriptorAttribute<NSURL>(descriptor, kCTFontURLAttribute)) {
+ QFontEngine::FaceId faceId;
+
+ Q_ASSERT(url.fileURL);
+ QString faceFileName{QString::fromNSString(url.path)};
+ faceId.filename = faceFileName.toUtf8();
+
+ QString styleName = QCFString(CTFontDescriptorCopyAttribute(descriptor, kCTFontStyleNameAttribute));
+ faceId.index = QFreetypeFace::getFaceIndexByStyleName(faceFileName, styleName);
+
+ faceId.variableAxes = fontDef.variableAxisValues;
+
+ return QFontEngineFT::create(fontDef, faceId);
+ }
+ // We end up here with a descriptor does not contain Qt font data or kCTFontURLAttribute.
+ // Since the FT engine can't deal with a descriptor with just a NSFontNameAttribute,
+ // we should return nullptr.
+ return nullptr;
+}
+#endif
+
+template <class T>
+QFontEngine *QCoreTextFontDatabaseEngineFactory<T>::fontEngine(const QByteArray &fontData, qreal pixelSize, QFont::HintingPreference hintingPreference)
+{
+ return T::create(fontData, pixelSize, hintingPreference, {});
+}
+
+// Explicitly instantiate so that we don't need the plugin to involve FreeType
+template class QCoreTextFontDatabaseEngineFactory<QCoreTextFontEngine>;
+#ifndef QT_NO_FREETYPE
+template class QCoreTextFontDatabaseEngineFactory<QFontEngineFT>;
+#endif
+
+CFArrayRef fallbacksForDescriptor(CTFontDescriptorRef descriptor)
+{
+ QCFType<CTFontRef> font = CTFontCreateWithFontDescriptor(descriptor, 0.0, nullptr);
+ if (!font) {
+ qCWarning(lcQpaFonts) << "Failed to create fallback font for" << descriptor;
+ return nullptr;
+ }
+
+ CFArrayRef cascadeList = CFArrayRef(CTFontCopyDefaultCascadeListForLanguages(font,
+ (CFArrayRef)NSLocale.preferredLanguages));
+
+ if (!cascadeList) {
+ qCWarning(lcQpaFonts) << "Failed to create fallback cascade list for" << descriptor;
+ return nullptr;
+ }
+
+ return cascadeList;
+}
+
+CFArrayRef QCoreTextFontDatabase::fallbacksForFamily(const QString &family)
+{
+ if (family.isEmpty())
+ return nullptr;
+
+ QCFType<CTFontDescriptorRef> fontDescriptor = descriptorForFamily(family);
+ if (!fontDescriptor) {
+ qCWarning(lcQpaFonts) << "Failed to create fallback font descriptor for" << family;
+ return nullptr;
+ }
+
+ // If the font is not available we want to fall back to the style hint.
+ // By creating a matching font descriptor we can verify whether the font
+ // is available or not, and avoid CTFontCreateWithFontDescriptor picking
+ // a default font for us based on incomplete information.
+ fontDescriptor = CTFontDescriptorCreateMatchingFontDescriptor(fontDescriptor, 0);
+ if (!fontDescriptor)
+ return nullptr;
+
+ return fallbacksForDescriptor(fontDescriptor);
+}
+
+CTFontDescriptorRef descriptorForFontType(CTFontUIFontType uiType)
+{
+ static const CGFloat kDefaultSizeForRequestedUIType = 0.0;
+ QCFType<CTFontRef> ctFont = CTFontCreateUIFontForLanguage(
+ uiType, kDefaultSizeForRequestedUIType, nullptr);
+ return CTFontCopyFontDescriptor(ctFont);
+}
+
+CTFontDescriptorRef descriptorForStyle(QFont::StyleHint styleHint)
+{
+ switch (styleHint) {
+ case QFont::SansSerif: return descriptorForFamily("Helvetica");
+ case QFont::Serif: return descriptorForFamily("Times New Roman");
+ case QFont::Monospace: return descriptorForFamily("Menlo");
+#ifdef Q_OS_MACOS
+ case QFont::Cursive: return descriptorForFamily("Apple Chancery");
+#endif
+ case QFont::Fantasy: return descriptorForFamily("Zapfino");
+ case QFont::TypeWriter: return descriptorForFamily("American Typewriter");
+ case QFont::AnyStyle: Q_FALLTHROUGH();
+ case QFont::System: return descriptorForFontType(kCTFontUIFontSystem);
+ default: return nullptr; // No matching font on this platform
+ }
+}
+
+QStringList QCoreTextFontDatabase::fallbacksForFamily(const QString &family, QFont::Style style, QFont::StyleHint styleHint, QChar::Script script) const
+{
+ Q_UNUSED(style);
+
+ qCDebug(lcQpaFonts).nospace() << "Resolving fallbacks families for"
+ << (!family.isEmpty() ? qPrintable(" family '%1' with"_L1.arg(family)) : "")
+ << " style hint " << styleHint;
+
+ QMacAutoReleasePool pool;
+
+ QStringList fallbackList;
+
+ QCFType<CFArrayRef> fallbackFonts = fallbacksForFamily(family);
+ if (!fallbackFonts || !CFArrayGetCount(fallbackFonts)) {
+ // We were not able to find a fallback for the specific family,
+ // or the family was empty, so we fall back to the style hint.
+ if (!family.isEmpty())
+ qCDebug(lcQpaFonts) << "No fallbacks found. Using style hint instead";
+
+ if (QCFType<CTFontDescriptorRef> styleDescriptor = descriptorForStyle(styleHint)) {
+ CFMutableArrayRef tmp = CFArrayCreateMutable(kCFAllocatorDefault, 0, &kCFTypeArrayCallBacks);
+ CFArrayAppendValue(tmp, styleDescriptor);
+ QCFType<CFArrayRef> styleFallbacks = fallbacksForDescriptor(styleDescriptor);
+ CFArrayAppendArray(tmp, styleFallbacks, CFRangeMake(0, CFArrayGetCount(styleFallbacks)));
+ fallbackFonts = tmp;
+ }
+ }
+
+ if (!fallbackFonts)
+ return fallbackList;
+
+ const int numberOfFallbacks = CFArrayGetCount(fallbackFonts);
+ for (int i = 0; i < numberOfFallbacks; ++i) {
+ auto fallbackDescriptor = CTFontDescriptorRef(CFArrayGetValueAtIndex(fallbackFonts, i));
+ auto fallbackFamilyName = QCFString(CTFontDescriptorCopyAttribute(fallbackDescriptor, kCTFontFamilyNameAttribute));
+
+ if (!isFamilyPopulated(fallbackFamilyName)) {
+ // We need to populate, or at least register the fallback fonts,
+ // otherwise the Qt font database may not know they exist.
+ if (isPrivateFontFamily(fallbackFamilyName))
+ const_cast<QCoreTextFontDatabase *>(this)->populateFromDescriptor(fallbackDescriptor);
+ else
+ registerFontFamily(fallbackFamilyName);
+ }
+
+ fallbackList.append(fallbackFamilyName);
+ }
+
+ // Some fallback fonts will have have an order in the list returned
+ // by Core Text that would indicate they should be preferred for e.g.
+ // Arabic, or Emoji, while in reality only supporting a tiny subset
+ // of the required glyphs, or representing them by question marks.
+ // Move these to the end, so that the proper fonts are preferred.
+ for (const char *family : { ".Apple Symbols Fallback", ".Noto Sans Universal" }) {
+ int index = fallbackList.indexOf(QLatin1StringView(family));
+ if (index >= 0)
+ fallbackList.move(index, fallbackList.size() - 1);
+ }
+
+#if defined(Q_OS_MACOS)
+ // Since we are only returning a list of default fonts for the current language, we do not
+ // cover all Unicode completely. This was especially an issue for some of the common script
+ // symbols such as mathematical symbols, currency or geometric shapes. To minimize the risk
+ // of missing glyphs, we add Arial Unicode MS as a final fail safe, since this covers most
+ // of Unicode 2.1.
+ if (!fallbackList.contains(QStringLiteral("Arial Unicode MS")))
+ fallbackList.append(QStringLiteral("Arial Unicode MS"));
+ // Since some symbols (specifically Braille) are not in Arial Unicode MS, we
+ // add Apple Symbols to cover those too.
+ if (!fallbackList.contains(QStringLiteral("Apple Symbols")))
+ fallbackList.append(QStringLiteral("Apple Symbols"));
+ // Some Noto* fonts are not automatically enumerated by system, despite being the main
+ // fonts for their writing system.
+ QString hardcodedFont = m_hardcodedFallbackFonts.value(script);
+ if (!hardcodedFont.isEmpty() && !fallbackList.contains(hardcodedFont)) {
+ if (!isFamilyPopulated(hardcodedFont)) {
+ if (!m_privateFamilies.contains(hardcodedFont)) {
+ QCFType<CTFontDescriptorRef> familyDescriptor = descriptorForFamily(hardcodedFont);
+ QCFType<CFArrayRef> matchingFonts = CTFontDescriptorCreateMatchingFontDescriptors(familyDescriptor, nullptr);
+ if (matchingFonts) {
+ const int numFonts = CFArrayGetCount(matchingFonts);
+ for (int i = 0; i < numFonts; ++i)
+ const_cast<QCoreTextFontDatabase *>(this)->populateFromDescriptor(CTFontDescriptorRef(CFArrayGetValueAtIndex(matchingFonts, i)),
+ hardcodedFont);
+
+ fallbackList.append(hardcodedFont);
+ }
+
+ // Register as private family even if the font is not found, in order to avoid
+ // redoing the check later. In later calls, the font will then just be ignored.
+ m_privateFamilies.insert(hardcodedFont);
+ }
+ } else {
+ fallbackList.append(hardcodedFont);
+ }
+ }
+#endif
+
+ extern QStringList qt_sort_families_by_writing_system(QChar::Script, const QStringList &);
+ fallbackList = qt_sort_families_by_writing_system(script, fallbackList);
+
+ qCDebug(lcQpaFonts).nospace() << "Fallback families ordered by script " << script << ": " << fallbackList;
+
+ return fallbackList;
+}
+
+QStringList QCoreTextFontDatabase::addApplicationFont(const QByteArray &fontData, const QString &fileName, QFontDatabasePrivate::ApplicationFont *applicationFont)
+{
+ QCFType<CFArrayRef> fonts;
+
+ if (!fontData.isEmpty()) {
+ QCFType<CFDataRef> fontDataReference = fontData.toRawCFData();
+ if (QCFType<CFArrayRef> descriptors = CTFontManagerCreateFontDescriptorsFromData(fontDataReference)) {
+ CFMutableArrayRef array = CFArrayCreateMutable(kCFAllocatorDefault, 0, &kCFTypeArrayCallBacks);
+ const int count = CFArrayGetCount(descriptors);
+
+ for (int i = 0; i < count; ++i) {
+ CTFontDescriptorRef descriptor = CTFontDescriptorRef(CFArrayGetValueAtIndex(descriptors, i));
+
+ // There's no way to get the data back out of a font descriptor created with
+ // CTFontManagerCreateFontDescriptorFromData, so we attach the data manually.
+ NSDictionary *attributes = @{ kQtFontDataAttribute : [NSValue valueWithPointer:new QByteArray(fontData)] };
+ descriptor = CTFontDescriptorCreateCopyWithAttributes(descriptor, (CFDictionaryRef)attributes);
+ CFArrayAppendValue(array, descriptor);
+ }
+
+ fonts = array;
+ }
+ } else {
+ QCFType<CFURLRef> fontURL = QUrl::fromLocalFile(fileName).toCFURL();
+ fonts = CTFontManagerCreateFontDescriptorsFromURL(fontURL);
+ }
+
+ if (!fonts)
+ return QStringList();
+
+ QStringList families;
+ const int numFonts = CFArrayGetCount(fonts);
+ for (int i = 0; i < numFonts; ++i) {
+ CTFontDescriptorRef fontDescriptor = CTFontDescriptorRef(CFArrayGetValueAtIndex(fonts, i));
+ populateFromDescriptor(fontDescriptor, QString(), applicationFont);
+ QCFType<CFStringRef> familyName = CFStringRef(CTFontDescriptorCopyAttribute(fontDescriptor, kCTFontFamilyNameAttribute));
+ families.append(QString::fromCFString(familyName));
+ }
+
+ // Note: We don't do font matching via CoreText for application fonts, so we don't
+ // need to enable font matching for them via CTFontManagerEnableFontDescriptors.
+
+ return families;
+}
+
+bool QCoreTextFontDatabase::isPrivateFontFamily(const QString &family) const
+{
+ if (family.startsWith(u'.') || family == "LastResort"_L1 || m_privateFamilies.contains(family))
+ return true;
+
+ return QPlatformFontDatabase::isPrivateFontFamily(family);
+}
+
+static CTFontUIFontType fontTypeFromTheme(QPlatformTheme::Font f)
+{
+ switch (f) {
+ case QPlatformTheme::SystemFont:
+ return kCTFontUIFontSystem;
+
+ case QPlatformTheme::MenuFont:
+ case QPlatformTheme::MenuBarFont:
+ case QPlatformTheme::MenuItemFont:
+ return kCTFontUIFontMenuItem;
+
+ case QPlatformTheme::MessageBoxFont:
+ return kCTFontUIFontEmphasizedSystem;
+
+ case QPlatformTheme::LabelFont:
+ return kCTFontUIFontSystem;
+
+ case QPlatformTheme::TipLabelFont:
+ return kCTFontUIFontToolTip;
+
+ case QPlatformTheme::StatusBarFont:
+ return kCTFontUIFontSystem;
+
+ case QPlatformTheme::TitleBarFont:
+ return kCTFontUIFontWindowTitle;
+
+ case QPlatformTheme::MdiSubWindowTitleFont:
+ return kCTFontUIFontSystem;
+
+ case QPlatformTheme::DockWidgetTitleFont:
+ return kCTFontUIFontSmallSystem;
+
+ case QPlatformTheme::PushButtonFont:
+ return kCTFontUIFontPushButton;
+
+ case QPlatformTheme::CheckBoxFont:
+ case QPlatformTheme::RadioButtonFont:
+ return kCTFontUIFontSystem;
+
+ case QPlatformTheme::ToolButtonFont:
+ return kCTFontUIFontSmallToolbar;
+
+ case QPlatformTheme::ItemViewFont:
+ return kCTFontUIFontSystem;
+
+ case QPlatformTheme::ListViewFont:
+ return kCTFontUIFontViews;
+
+ case QPlatformTheme::HeaderViewFont:
+ return kCTFontUIFontSmallSystem;
+
+ case QPlatformTheme::ListBoxFont:
+ return kCTFontUIFontViews;
+
+ case QPlatformTheme::ComboMenuItemFont:
+ return kCTFontUIFontSystem;
+
+ case QPlatformTheme::ComboLineEditFont:
+ return kCTFontUIFontViews;
+
+ case QPlatformTheme::SmallFont:
+ return kCTFontUIFontSmallSystem;
+
+ case QPlatformTheme::MiniFont:
+ return kCTFontUIFontMiniSystem;
+
+ case QPlatformTheme::FixedFont:
+ return kCTFontUIFontUserFixedPitch;
+
+ default:
+ return kCTFontUIFontSystem;
+ }
+}
+
+static CTFontDescriptorRef fontDescriptorFromTheme(QPlatformTheme::Font f)
+{
+#if defined(QT_PLATFORM_UIKIT)
+ // Use Dynamic Type to resolve theme fonts if possible, to get
+ // correct font sizes and style based on user configuration.
+ NSString *textStyle = 0;
+ switch (f) {
+ case QPlatformTheme::TitleBarFont:
+ case QPlatformTheme::HeaderViewFont:
+ textStyle = UIFontTextStyleHeadline;
+ break;
+ case QPlatformTheme::MdiSubWindowTitleFont:
+ textStyle = UIFontTextStyleSubheadline;
+ break;
+ case QPlatformTheme::TipLabelFont:
+ case QPlatformTheme::SmallFont:
+ textStyle = UIFontTextStyleFootnote;
+ break;
+ case QPlatformTheme::MiniFont:
+ textStyle = UIFontTextStyleCaption2;
+ break;
+ case QPlatformTheme::FixedFont:
+ // Fall back to regular code path, as iOS doesn't provide
+ // an appropriate text style for this theme font.
+ break;
+ default:
+ textStyle = UIFontTextStyleBody;
+ break;
+ }
+
+ if (textStyle) {
+ UIFontDescriptor *desc = [UIFontDescriptor preferredFontDescriptorWithTextStyle:textStyle];
+ return static_cast<CTFontDescriptorRef>(CFBridgingRetain(desc));
+ }
+#endif // QT_PLATFORM_UIKIT
+
+ // macOS default case and iOS fallback case
+ return descriptorForFontType(fontTypeFromTheme(f));
+}
+
+void QCoreTextFontDatabase::populateThemeFonts()
+{
+ QMacAutoReleasePool pool;
+
+ if (!m_themeFonts.isEmpty())
+ return;
+
+ QElapsedTimer elapsed;
+ if (lcQpaFonts().isDebugEnabled())
+ elapsed.start();
+
+ qCDebug(lcQpaFonts) << "Populating theme fonts...";
+
+ for (long f = QPlatformTheme::SystemFont; f < QPlatformTheme::NFonts; f++) {
+ QPlatformTheme::Font themeFont = static_cast<QPlatformTheme::Font>(f);
+ QCFType<CTFontDescriptorRef> fontDescriptor = fontDescriptorFromTheme(themeFont);
+ FontDescription fd;
+ getFontDescription(fontDescriptor, &fd);
+
+ // We might get here from QFontDatabase::systemFont() or QPlatformTheme::font(),
+ // before the font database has initialized itself and populated all available
+ // families. As a result, we can't populate the descriptor at this time, as that
+ // would result in the font database having > 0 families, which would result in
+ // skipping the initialization and population of all other font families. Instead
+ // we store the descriptors for later and populate them during populateFontDatabase().
+
+ bool haveRegisteredFamily = m_systemFontDescriptors.contains(fd.familyName);
+ qCDebug(lcQpaFonts) << "Got" << (haveRegisteredFamily ? "already registered" : "unseen")
+ << "family" << fd.familyName << "for" << themeFont;
+
+ if (!haveRegisteredFamily) {
+ // We need to register all weights and variants of the theme font,
+ // as the user might tweak the returned QFont before use.
+ QList<QCFType<CTFontDescriptorRef>> themeFontVariants;
+
+ auto addFontVariants = [&](CTFontDescriptorRef descriptor) {
+ QCFType<CFArrayRef> matchingDescriptors = CTFontDescriptorCreateMatchingFontDescriptors(descriptor, nullptr);
+ const int matchingDescriptorsCount = matchingDescriptors ? CFArrayGetCount(matchingDescriptors) : 0;
+ qCDebug(lcQpaFonts) << "Enumerating font variants based on" << id(descriptor)
+ << "resulted in" << matchingDescriptorsCount << "matching descriptors"
+ << matchingDescriptors.as<NSArray*>();
+
+ for (int i = 0; i < matchingDescriptorsCount; ++i) {
+ auto matchingDescriptor = CTFontDescriptorRef(CFArrayGetValueAtIndex(matchingDescriptors, i));
+ themeFontVariants.append(QCFType<CTFontDescriptorRef>::constructFromGet(matchingDescriptor));
+ }
+ };
+
+ // Try populating the font variants based on its UI design trait, if available
+ if (@available(macos 10.15, ios 13.0, *)) {
+ auto fontTraits = QCFType<CFDictionaryRef>(CTFontDescriptorCopyAttribute(fontDescriptor, kCTFontTraitsAttribute));
+ static const NSString *kUIFontDesignTrait = @"NSCTFontUIFontDesignTrait";
+ if (id uiFontDesignTrait = fontTraits.as<NSDictionary*>()[kUIFontDesignTrait]) {
+ QCFType<CTFontDescriptorRef> designTraitDescriptor = CTFontDescriptorCreateWithAttributes(
+ CFDictionaryRef(@{ (id)kCTFontTraitsAttribute: @{ kUIFontDesignTrait: uiFontDesignTrait }
+ }));
+ addFontVariants(designTraitDescriptor);
+ }
+ }
+
+ if (themeFontVariants.isEmpty()) {
+ // Fall back to populating variants based on the family name alone
+ QCFType<CTFontDescriptorRef> familyDescriptor = descriptorForFamily(fd.familyName);
+ addFontVariants(familyDescriptor);
+ }
+
+ if (themeFontVariants.isEmpty()) {
+ qCDebug(lcQpaFonts) << "No theme font variants found, falling back to single variant descriptor";
+ themeFontVariants.append(fontDescriptor);
+ }
+
+ m_systemFontDescriptors.insert(fd.familyName, themeFontVariants);
+ }
+
+ QFont *font = new QFont(fd.familyName, fd.pointSize, fd.weight, fd.style == QFont::StyleItalic);
+ m_themeFonts.insert(themeFont, font);
+ }
+
+ qCDebug(lcQpaFonts) << "Populating theme fonts took" << elapsed.restart() << "ms";
+}
+
+QFont *QCoreTextFontDatabase::themeFont(QPlatformTheme::Font f) const
+{
+ // The code paths via QFontDatabase::systemFont() or QPlatformTheme::font()
+ // do not ensure that the font database has been populated, so we need to
+ // manually populate the theme fonts lazily here just in case.
+ const_cast<QCoreTextFontDatabase*>(this)->populateThemeFonts();
+
+ return m_themeFonts.value(f, nullptr);
+}
+
+QFont QCoreTextFontDatabase::defaultFont() const
+{
+ return QFont(*themeFont(QPlatformTheme::SystemFont));
+}
+
+bool QCoreTextFontDatabase::fontsAlwaysScalable() const
+{
+ return true;
+}
+
+QList<int> QCoreTextFontDatabase::standardSizes() const
+{
+ QList<int> ret;
+ static const unsigned short standard[] =
+ { 9, 10, 11, 12, 13, 14, 18, 24, 36, 48, 64, 72, 96, 144, 288, 0 };
+ ret.reserve(int(sizeof(standard) / sizeof(standard[0])));
+ const unsigned short *sizes = standard;
+ while (*sizes) ret << *sizes++;
+ return ret;
+}
+
+bool QCoreTextFontDatabase::supportsVariableApplicationFonts() const
+{
+ return true;
+}
+
+QT_END_NAMESPACE
+
diff --git a/src/gui/text/coretext/qcoretextfontdatabase_p.h b/src/gui/text/coretext/qcoretextfontdatabase_p.h
new file mode 100644
index 0000000000..eeea9ad640
--- /dev/null
+++ b/src/gui/text/coretext/qcoretextfontdatabase_p.h
@@ -0,0 +1,84 @@
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
+
+#ifndef QCORETEXTFONTDATABASE_H
+#define QCORETEXTFONTDATABASE_H
+
+//
+// W A R N I N G
+// -------------
+//
+// This file is not part of the Qt API. It exists purely as an
+// implementation detail. This header file may change from version to
+// version without notice, or even be removed.
+//
+// We mean it.
+//
+
+#include <qglobal.h>
+
+#include <qpa/qplatformfontdatabase.h>
+#include <qpa/qplatformtheme.h>
+#include <private/qcore_mac_p.h>
+
+Q_FORWARD_DECLARE_CF_TYPE(CTFontDescriptor);
+Q_FORWARD_DECLARE_CF_TYPE(CTFont);
+
+QT_DECL_METATYPE_EXTERN_TAGGED(QCFType<CGFontRef>, QCFType_CGFontRef, Q_GUI_EXPORT)
+QT_DECL_METATYPE_EXTERN_TAGGED(QCFType<CFURLRef>, QCFType_CFURLRef, Q_GUI_EXPORT)
+
+QT_BEGIN_NAMESPACE
+
+class Q_GUI_EXPORT QCoreTextFontDatabase : public QPlatformFontDatabase
+{
+public:
+ QCoreTextFontDatabase();
+ ~QCoreTextFontDatabase();
+ void populateFontDatabase() override;
+ bool populateFamilyAliases(const QString &missingFamily) override;
+ void populateFamily(const QString &familyName) override;
+ void invalidate() override;
+
+ QStringList fallbacksForFamily(const QString &family, QFont::Style style, QFont::StyleHint styleHint, QChar::Script script) const override;
+ QStringList addApplicationFont(const QByteArray &fontData, const QString &fileName, QFontDatabasePrivate::ApplicationFont *applicationFont = nullptr) override;
+ void releaseHandle(void *handle) override;
+ bool isPrivateFontFamily(const QString &family) const override;
+ QFont defaultFont() const override;
+ bool fontsAlwaysScalable() const override;
+ QList<int> standardSizes() const override;
+ bool supportsVariableApplicationFonts() const override;
+
+ // For iOS and macOS platform themes
+ QFont *themeFont(QPlatformTheme::Font) const;
+
+private:
+ void populateThemeFonts();
+ void populateFromDescriptor(CTFontDescriptorRef font, const QString &familyName = QString(), QFontDatabasePrivate::ApplicationFont *applicationFont = nullptr);
+ static CFArrayRef fallbacksForFamily(const QString &family);
+
+ QHash<QPlatformTheme::Font, QFont *> m_themeFonts;
+ QHash<QString, QList<QCFType<CTFontDescriptorRef>>> m_systemFontDescriptors;
+ QHash<QChar::Script, QString> m_hardcodedFallbackFonts;
+ mutable QSet<QString> m_privateFamilies;
+
+ bool m_hasPopulatedAliases;
+
+#if defined(Q_OS_MACOS)
+ QMacNotificationObserver m_fontSetObserver;
+#endif
+};
+
+// Split out into separate template class so that the compiler doesn't have
+// to generate code for each override in QCoreTextFontDatabase for each T.
+
+template <class T>
+class Q_GUI_EXPORT QCoreTextFontDatabaseEngineFactory : public QCoreTextFontDatabase
+{
+public:
+ QFontEngine *fontEngine(const QFontDef &fontDef, void *handle) override;
+ QFontEngine *fontEngine(const QByteArray &fontData, qreal pixelSize, QFont::HintingPreference hintingPreference) override;
+};
+
+QT_END_NAMESPACE
+
+#endif // QCORETEXTFONTDATABASE_H
diff --git a/src/gui/text/coretext/qfontengine_coretext.mm b/src/gui/text/coretext/qfontengine_coretext.mm
new file mode 100644
index 0000000000..1050c03d75
--- /dev/null
+++ b/src/gui/text/coretext/qfontengine_coretext.mm
@@ -0,0 +1,1000 @@
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
+
+#include "qfontengine_coretext_p.h"
+
+#include <qpa/qplatformfontdatabase.h>
+#include <QtCore/qendian.h>
+#if QT_CONFIG(settings)
+#include <QtCore/qsettings.h>
+#endif
+#include <QtCore/qoperatingsystemversion.h>
+#include <QtGui/qpainterpath.h>
+#include <private/qcoregraphics_p.h>
+#include <private/qimage_p.h>
+#include <private/qguiapplication_p.h>
+#include <private/qstringiterator_p.h>
+#include <qpa/qplatformtheme.h>
+
+#include <cmath>
+
+#if defined(Q_OS_MACOS)
+#import <AppKit/AppKit.h>
+#endif
+
+#if defined(QT_PLATFORM_UIKIT)
+#import <UIKit/UIKit.h>
+#endif
+
+// These are available cross platform, exported as kCTFontWeightXXX from CoreText.framework,
+// but they are not documented and are not in public headers so are private API and exposed
+// only through the NSFontWeightXXX and UIFontWeightXXX aliases in AppKit and UIKit (rdar://26109857)
+#if defined(Q_OS_MACOS)
+#define kCTFontWeightUltraLight NSFontWeightUltraLight
+#define kCTFontWeightThin NSFontWeightThin
+#define kCTFontWeightLight NSFontWeightLight
+#define kCTFontWeightRegular NSFontWeightRegular
+#define kCTFontWeightMedium NSFontWeightMedium
+#define kCTFontWeightSemibold NSFontWeightSemibold
+#define kCTFontWeightBold NSFontWeightBold
+#define kCTFontWeightHeavy NSFontWeightHeavy
+#define kCTFontWeightBlack NSFontWeightBlack
+#elif defined(QT_PLATFORM_UIKIT)
+#define kCTFontWeightUltraLight UIFontWeightUltraLight
+#define kCTFontWeightThin UIFontWeightThin
+#define kCTFontWeightLight UIFontWeightLight
+#define kCTFontWeightRegular UIFontWeightRegular
+#define kCTFontWeightMedium UIFontWeightMedium
+#define kCTFontWeightSemibold UIFontWeightSemibold
+#define kCTFontWeightBold UIFontWeightBold
+#define kCTFontWeightHeavy UIFontWeightHeavy
+#define kCTFontWeightBlack UIFontWeightBlack
+#endif
+
+QT_BEGIN_NAMESPACE
+
+static float SYNTHETIC_ITALIC_SKEW = std::tan(14.f * std::acos(0.f) / 90.f);
+
+bool QCoreTextFontEngine::ct_getSfntTable(void *user_data, uint tag, uchar *buffer, uint *length)
+{
+ CTFontRef ctfont = *(CTFontRef *)user_data;
+
+ QCFType<CFDataRef> table = CTFontCopyTable(ctfont, tag, 0);
+ if (!table)
+ return false;
+
+ CFIndex tableLength = CFDataGetLength(table);
+ if (buffer && int(*length) >= tableLength)
+ CFDataGetBytes(table, CFRangeMake(0, tableLength), buffer);
+ *length = tableLength;
+ Q_ASSERT(int(*length) > 0);
+ return true;
+}
+
+QFont::Weight QCoreTextFontEngine::qtWeightFromCFWeight(float value)
+{
+#define COMPARE_WEIGHT_DISTANCE(ct_weight, qt_weight) \
+ { \
+ float d; \
+ if ((d = qAbs(value - ct_weight)) < distance) { \
+ distance = d; \
+ ret = qt_weight; \
+ } \
+ }
+
+ float distance = qAbs(value - kCTFontWeightBlack);
+ QFont::Weight ret = QFont::Black;
+
+ // Compare distance to system weight to find the closest match.
+ // (Note: Must go from high to low, so that midpoints are rounded up)
+ COMPARE_WEIGHT_DISTANCE(kCTFontWeightHeavy, QFont::ExtraBold);
+ COMPARE_WEIGHT_DISTANCE(kCTFontWeightBold, QFont::Bold);
+ COMPARE_WEIGHT_DISTANCE(kCTFontWeightSemibold, QFont::DemiBold);
+ COMPARE_WEIGHT_DISTANCE(kCTFontWeightMedium, QFont::Medium);
+ COMPARE_WEIGHT_DISTANCE(kCTFontWeightRegular, QFont::Normal);
+ COMPARE_WEIGHT_DISTANCE(kCTFontWeightLight, QFont::Light);
+ COMPARE_WEIGHT_DISTANCE(kCTFontWeightThin, QFont::ExtraLight);
+ COMPARE_WEIGHT_DISTANCE(kCTFontWeightUltraLight, QFont::Thin);
+
+#undef COMPARE_WEIGHT_DISTANCE
+
+ return ret;
+}
+
+CGAffineTransform qt_transform_from_fontdef(const QFontDef &fontDef)
+{
+ CGAffineTransform transform = CGAffineTransformIdentity;
+ if (fontDef.stretch && fontDef.stretch != 100)
+ transform = CGAffineTransformMakeScale(float(fontDef.stretch) / float(100), 1);
+ return transform;
+}
+
+// Keeps font data alive until engine is disposed
+class QCoreTextRawFontEngine : public QCoreTextFontEngine
+{
+public:
+ QCoreTextRawFontEngine(CGFontRef font, const QFontDef &def, const QByteArray &fontData)
+ : QCoreTextFontEngine(font, def)
+ , m_fontData(fontData)
+ {}
+ QFontEngine *cloneWithSize(qreal pixelSize) const
+ {
+ QFontDef newFontDef = fontDef;
+ newFontDef.pixelSize = pixelSize;
+ newFontDef.pointSize = pixelSize * 72.0 / qt_defaultDpi();
+
+ return new QCoreTextRawFontEngine(cgFont, newFontDef, m_fontData);
+ }
+ QByteArray m_fontData;
+};
+
+QCoreTextFontEngine *QCoreTextFontEngine::create(const QByteArray &fontData,
+ qreal pixelSize,
+ QFont::HintingPreference hintingPreference,
+ const QMap<QFont::Tag, float> &variableAxisValues)
+{
+ Q_UNUSED(hintingPreference);
+ Q_UNUSED(variableAxisValues);
+
+ QCFType<CFDataRef> fontDataReference = fontData.toRawCFData();
+ QCFType<CGDataProviderRef> dataProvider = CGDataProviderCreateWithCFData(fontDataReference);
+
+ // Note: CTFontCreateWithGraphicsFont (which we call from the QCoreTextFontEngine
+ // constructor) has a bug causing it to retain the CGFontRef but never release it.
+ // The result is that we are leaking the CGFont, CGDataProvider, and CGData, but
+ // as the CGData is created from the raw QByteArray data, which we deref in the
+ // subclass above during destruction, we're at least not leaking the font data,
+ // (unless CoreText copies it internally). http://stackoverflow.com/questions/40805382/
+ QCFType<CGFontRef> cgFont = CGFontCreateWithDataProvider(dataProvider);
+
+ if (!cgFont) {
+ qWarning("QCoreTextFontEngine::create: CGFontCreateWithDataProvider failed");
+ return nullptr;
+ }
+
+ QFontDef def;
+ def.pixelSize = pixelSize;
+ def.pointSize = pixelSize * 72.0 / qt_defaultDpi();
+ return new QCoreTextRawFontEngine(cgFont, def, fontData);
+}
+
+QCoreTextFontEngine::QCoreTextFontEngine(CTFontRef font, const QFontDef &def)
+ : QCoreTextFontEngine(def)
+{
+ ctfont = QCFType<CTFontRef>::constructFromGet(font);
+ cgFont = CTFontCopyGraphicsFont(font, nullptr);
+ init();
+}
+
+QCoreTextFontEngine::QCoreTextFontEngine(CGFontRef font, const QFontDef &def)
+ : QCoreTextFontEngine(def)
+{
+ cgFont = QCFType<CGFontRef>::constructFromGet(font);
+ ctfont = CTFontCreateWithGraphicsFont(font, fontDef.pixelSize, &transform, nullptr);
+ init();
+}
+
+QCoreTextFontEngine::QCoreTextFontEngine(const QFontDef &def)
+ : QFontEngine(Mac)
+{
+ fontDef = def;
+ transform = qt_transform_from_fontdef(fontDef);
+}
+
+QCoreTextFontEngine::~QCoreTextFontEngine()
+{
+}
+
+void QCoreTextFontEngine::init()
+{
+ Q_ASSERT(ctfont);
+ Q_ASSERT(cgFont);
+
+ face_id.index = 0;
+ QCFString name = CTFontCopyName(ctfont, kCTFontUniqueNameKey);
+ face_id.filename = QString::fromCFString(name).toUtf8();
+ face_id.variableAxes = fontDef.variableAxisValues;
+
+ QCFString family = CTFontCopyFamilyName(ctfont);
+ fontDef.families = QStringList(family);
+
+ QCFString styleName = (CFStringRef) CTFontCopyAttribute(ctfont, kCTFontStyleNameAttribute);
+ fontDef.styleName = styleName;
+
+ synthesisFlags = 0;
+ CTFontSymbolicTraits traits = CTFontGetSymbolicTraits(ctfont);
+
+ if (traits & kCTFontColorGlyphsTrait)
+ glyphFormat = QFontEngine::Format_ARGB;
+ else if (shouldSmoothFont() && fontSmoothing() == FontSmoothing::Subpixel)
+ glyphFormat = QFontEngine::Format_A32;
+ else
+ glyphFormat = QFontEngine::Format_A8;
+
+ if (traits & kCTFontItalicTrait)
+ fontDef.style = QFont::StyleItalic;
+
+ static const auto getTraitValue = [](CFDictionaryRef allTraits, CFStringRef trait) -> float {
+ if (CFDictionaryContainsKey(allTraits, trait)) {
+ CFNumberRef traitNum = (CFNumberRef) CFDictionaryGetValue(allTraits, trait);
+ float v = 0;
+ CFNumberGetValue(traitNum, kCFNumberFloatType, &v);
+ return v;
+ }
+ return 0;
+ };
+
+ QCFType<CFDictionaryRef> allTraits = CTFontCopyTraits(ctfont);
+ int slant = static_cast<int>(getTraitValue(allTraits, kCTFontSlantTrait) * 500 + 500);
+ if (slant > 500 && !(traits & kCTFontItalicTrait))
+ fontDef.style = QFont::StyleOblique;
+
+ if (fontDef.weight >= QFont::Bold && !(traits & kCTFontBoldTrait) && !qEnvironmentVariableIsSet("QT_NO_SYNTHESIZED_BOLD"))
+ synthesisFlags |= SynthesizedBold;
+ else
+ fontDef.weight = QCoreTextFontEngine::qtWeightFromCFWeight(getTraitValue(allTraits, kCTFontWeightTrait));
+
+ if (fontDef.style != QFont::StyleNormal && !(traits & kCTFontItalicTrait) && !qEnvironmentVariableIsSet("QT_NO_SYNTHESIZED_ITALIC"))
+ synthesisFlags |= SynthesizedItalic;
+
+ avgCharWidth = 0;
+ QByteArray os2Table = getSfntTable(QFont::Tag("OS/2").value());
+ unsigned emSize = CTFontGetUnitsPerEm(ctfont);
+ if (os2Table.size() >= 10) {
+ fsType = qFromBigEndian<quint16>(os2Table.constData() + 8);
+ // qAbs is a workaround for weird fonts like Lucida Grande
+ qint16 width = qAbs(qFromBigEndian<qint16>(os2Table.constData() + 2));
+ avgCharWidth = QFixed::fromReal(width * fontDef.pixelSize / emSize);
+ } else
+ avgCharWidth = QFontEngine::averageCharWidth();
+
+ underlineThickness = QFixed::fromReal(CTFontGetUnderlineThickness(ctfont));
+ underlinePos = -QFixed::fromReal(CTFontGetUnderlinePosition(ctfont));
+
+ cache_cost = (CTFontGetAscent(ctfont) + CTFontGetDescent(ctfont)) * avgCharWidth.toInt() * 2000;
+
+ kerningPairsLoaded = false;
+}
+
+glyph_t QCoreTextFontEngine::glyphIndex(uint ucs4) const
+{
+ int len = 0;
+
+ QChar str[2];
+ if (Q_UNLIKELY(QChar::requiresSurrogates(ucs4))) {
+ str[len++] = QChar(QChar::highSurrogate(ucs4));
+ str[len++] = QChar(QChar::lowSurrogate(ucs4));
+ } else {
+ str[len++] = QChar(ucs4);
+ }
+
+ CGGlyph glyphIndices[2];
+
+ CTFontGetGlyphsForCharacters(ctfont, (const UniChar *)str, glyphIndices, len);
+
+ return glyphIndices[0];
+}
+
+int QCoreTextFontEngine::stringToCMap(const QChar *str, int len, QGlyphLayout *glyphs,
+ int *nglyphs, QFontEngine::ShaperFlags flags) const
+{
+ Q_ASSERT(glyphs->numGlyphs >= *nglyphs);
+ if (*nglyphs < len) {
+ *nglyphs = len;
+ return -1;
+ }
+
+ QVarLengthArray<CGGlyph> cgGlyphs(len);
+ CTFontGetGlyphsForCharacters(ctfont, (const UniChar*)str, cgGlyphs.data(), len);
+
+ int glyph_pos = 0;
+ int mappedGlyphs = 0;
+ QStringIterator it(str, str + len);
+ while (it.hasNext()) {
+ qsizetype idx = it.index();
+ char32_t ucs4 = it.next();
+ glyphs->glyphs[glyph_pos] = cgGlyphs[idx];
+ if (glyph_pos < idx)
+ cgGlyphs[glyph_pos] = cgGlyphs[idx];
+ if (glyphs->glyphs[glyph_pos] != 0 || isIgnorableChar(ucs4))
+ mappedGlyphs++;
+ glyph_pos++;
+ }
+
+ *nglyphs = glyph_pos;
+ glyphs->numGlyphs = glyph_pos;
+
+ if (!(flags & GlyphIndicesOnly))
+ loadAdvancesForGlyphs(cgGlyphs, glyphs);
+
+ return mappedGlyphs;
+}
+
+glyph_metrics_t QCoreTextFontEngine::boundingBox(glyph_t glyph)
+{
+ glyph_metrics_t ret;
+ CGGlyph g = glyph;
+ CGRect rect = CTFontGetBoundingRectsForGlyphs(ctfont, kCTFontOrientationHorizontal, &g, 0, 1);
+ if (synthesisFlags & QFontEngine::SynthesizedItalic) {
+ rect.size.width += rect.size.height * SYNTHETIC_ITALIC_SKEW;
+ }
+ ret.width = QFixed::fromReal(rect.size.width);
+ ret.height = QFixed::fromReal(rect.size.height);
+ ret.x = QFixed::fromReal(rect.origin.x);
+ ret.y = -QFixed::fromReal(rect.origin.y) - ret.height;
+ CGSize advances[1];
+ CTFontGetAdvancesForGlyphs(ctfont, kCTFontOrientationHorizontal, &g, advances, 1);
+ ret.xoff = QFixed::fromReal(advances[0].width);
+ ret.yoff = QFixed::fromReal(advances[0].height);
+
+ return ret;
+}
+
+void QCoreTextFontEngine::initializeHeightMetrics() const
+{
+ m_ascent = QFixed::fromReal(CTFontGetAscent(ctfont));
+ m_descent = QFixed::fromReal(CTFontGetDescent(ctfont));
+ m_leading = QFixed::fromReal(CTFontGetLeading(ctfont));
+
+ m_heightMetricsQueried = true;
+}
+
+QFixed QCoreTextFontEngine::capHeight() const
+{
+ QFixed c = QFixed::fromReal(CTFontGetCapHeight(ctfont));
+ if (c <= 0)
+ return calculatedCapHeight();
+
+ return c;
+}
+
+QFixed QCoreTextFontEngine::xHeight() const
+{
+ return QFixed::fromReal(CTFontGetXHeight(ctfont));
+}
+
+QFixed QCoreTextFontEngine::averageCharWidth() const
+{
+ return avgCharWidth;
+}
+
+qreal QCoreTextFontEngine::maxCharWidth() const
+{
+ // ### FIXME: 'W' might not be the widest character, but this is better than nothing
+ const glyph_t glyph = glyphIndex('W');
+ glyph_metrics_t bb = const_cast<QCoreTextFontEngine *>(this)->boundingBox(glyph);
+ return bb.xoff.toReal();
+}
+
+bool QCoreTextFontEngine::hasColorGlyphs() const
+{
+ return glyphFormat == QFontEngine::Format_ARGB;
+}
+
+Q_GUI_EXPORT extern bool qt_scaleForTransform(const QTransform &transform, qreal *scale); // qtransform.cpp
+void QCoreTextFontEngine::draw(CGContextRef ctx, qreal x, qreal y, const QTextItemInt &ti, int paintDeviceHeight)
+{
+ QVarLengthArray<QFixedPoint> positions;
+ QVarLengthArray<glyph_t> glyphs;
+ QTransform matrix;
+ matrix.translate(x, y);
+ getGlyphPositions(ti.glyphs, matrix, ti.flags, glyphs, positions);
+ if (glyphs.size() == 0)
+ return;
+
+ CGContextSetFontSize(ctx, fontDef.pixelSize);
+
+ CGAffineTransform oldTextMatrix = CGContextGetTextMatrix(ctx);
+
+ CGAffineTransform cgMatrix = CGAffineTransformMake(1, 0, 0, -1, 0, -paintDeviceHeight);
+
+ // FIXME: Should we include the old matrix here? If so we need to assign it.
+ Q_UNUSED(CGAffineTransformConcat(cgMatrix, oldTextMatrix));
+
+ if (synthesisFlags & QFontEngine::SynthesizedItalic)
+ cgMatrix = CGAffineTransformConcat(cgMatrix, CGAffineTransformMake(1, 0, -SYNTHETIC_ITALIC_SKEW, 1, 0, 0));
+
+ cgMatrix = CGAffineTransformConcat(cgMatrix, transform);
+
+ CGContextSetTextMatrix(ctx, cgMatrix);
+
+ CGContextSetTextDrawingMode(ctx, kCGTextFill);
+
+ QVarLengthArray<CGPoint> cgPositions(glyphs.size());
+ QVarLengthArray<CGGlyph> cgGlyphs(glyphs.size());
+ const qreal firstX = positions[0].x.toReal();
+ const qreal firstY = positions[0].y.toReal();
+ for (int i = 0; i < glyphs.size(); ++i) {
+ cgPositions[i].x = positions[i].x.toReal() - firstX;
+ cgPositions[i].y = firstY - positions[i].y.toReal();
+ cgGlyphs[i] = glyphs[i];
+ }
+
+ //NSLog(@"Font inDraw %@ ctfont %@", CGFontCopyFullName(cgFont), CTFontCopyFamilyName(ctfont));
+
+ CGContextSetTextPosition(ctx, positions[0].x.toReal(), positions[0].y.toReal());
+ CTFontDrawGlyphs(ctfont, cgGlyphs.data(), cgPositions.data(), glyphs.size(), ctx);
+
+ if (synthesisFlags & QFontEngine::SynthesizedBold) {
+ QTransform matrix(cgMatrix.a, cgMatrix.b, cgMatrix.c, cgMatrix.d, cgMatrix.tx, cgMatrix.ty);
+
+ qreal boldOffset = 0.5 * lineThickness().toReal();
+ qreal scale;
+ qt_scaleForTransform(matrix, &scale);
+ boldOffset *= scale;
+
+ CGContextSetTextPosition(ctx,
+ positions[0].x.toReal() + boldOffset,
+ positions[0].y.toReal());
+ CTFontDrawGlyphs(ctfont, cgGlyphs.data(), cgPositions.data(), glyphs.size(), ctx);
+ }
+
+ CGContextSetTextMatrix(ctx, oldTextMatrix);
+}
+
+struct ConvertPathInfo
+{
+ ConvertPathInfo(QPainterPath *newPath, const QPointF &newPos, qreal newStretch = 1.0) :
+ path(newPath), pos(newPos), stretch(newStretch) {}
+ QPainterPath *path;
+ QPointF pos;
+ qreal stretch;
+};
+
+static void convertCGPathToQPainterPath(void *info, const CGPathElement *element)
+{
+ ConvertPathInfo *myInfo = static_cast<ConvertPathInfo *>(info);
+ switch(element->type) {
+ case kCGPathElementMoveToPoint:
+ myInfo->path->moveTo((element->points[0].x * myInfo->stretch) + myInfo->pos.x(),
+ element->points[0].y + myInfo->pos.y());
+ break;
+ case kCGPathElementAddLineToPoint:
+ myInfo->path->lineTo((element->points[0].x * myInfo->stretch) + myInfo->pos.x(),
+ element->points[0].y + myInfo->pos.y());
+ break;
+ case kCGPathElementAddQuadCurveToPoint:
+ myInfo->path->quadTo((element->points[0].x * myInfo->stretch) + myInfo->pos.x(),
+ element->points[0].y + myInfo->pos.y(),
+ (element->points[1].x * myInfo->stretch) + myInfo->pos.x(),
+ element->points[1].y + myInfo->pos.y());
+ break;
+ case kCGPathElementAddCurveToPoint:
+ myInfo->path->cubicTo((element->points[0].x * myInfo->stretch) + myInfo->pos.x(),
+ element->points[0].y + myInfo->pos.y(),
+ (element->points[1].x * myInfo->stretch) + myInfo->pos.x(),
+ element->points[1].y + myInfo->pos.y(),
+ (element->points[2].x * myInfo->stretch) + myInfo->pos.x(),
+ element->points[2].y + myInfo->pos.y());
+ break;
+ case kCGPathElementCloseSubpath:
+ myInfo->path->closeSubpath();
+ break;
+ default:
+ qCWarning(lcQpaFonts) << "Unhandled path transform type: " << element->type;
+ }
+
+}
+
+void QCoreTextFontEngine::addGlyphsToPath(glyph_t *glyphs, QFixedPoint *positions, int nGlyphs,
+ QPainterPath *path, QTextItem::RenderFlags)
+{
+ if (hasColorGlyphs())
+ return; // We can't convert color-glyphs to path
+
+ CGAffineTransform cgMatrix = CGAffineTransformIdentity;
+ cgMatrix = CGAffineTransformScale(cgMatrix, 1, -1);
+
+ if (synthesisFlags & QFontEngine::SynthesizedItalic)
+ cgMatrix = CGAffineTransformConcat(cgMatrix, CGAffineTransformMake(1, 0, -SYNTHETIC_ITALIC_SKEW, 1, 0, 0));
+
+ qreal stretch = fontDef.stretch ? qreal(fontDef.stretch) / 100 : 1.0;
+ for (int i = 0; i < nGlyphs; ++i) {
+ QCFType<CGPathRef> cgpath = CTFontCreatePathForGlyph(ctfont, glyphs[i], &cgMatrix);
+ ConvertPathInfo info(path, positions[i].toPointF(), stretch);
+ CGPathApply(cgpath, &info, convertCGPathToQPainterPath);
+ }
+}
+
+static void qcoretextfontengine_scaleMetrics(glyph_metrics_t &br, const QTransform &matrix)
+{
+ if (matrix.isScaling()) {
+ qreal hscale = matrix.m11();
+ qreal vscale = matrix.m22();
+ br.width = QFixed::fromReal(br.width.toReal() * hscale);
+ br.height = QFixed::fromReal(br.height.toReal() * vscale);
+ br.x = QFixed::fromReal(br.x.toReal() * hscale);
+ br.y = QFixed::fromReal(br.y.toReal() * vscale);
+ }
+}
+
+glyph_metrics_t QCoreTextFontEngine::alphaMapBoundingBox(glyph_t glyph, const QFixedPoint &subPixelPosition, const QTransform &matrix, GlyphFormat format)
+{
+ if (matrix.type() > QTransform::TxScale)
+ return QFontEngine::alphaMapBoundingBox(glyph, subPixelPosition, matrix, format);
+
+ glyph_metrics_t br = boundingBox(glyph);
+
+ QTransform xform = matrix;
+ if (fontDef.stretch != 100 && fontDef.stretch != QFont::AnyStretch)
+ xform.scale(fontDef.stretch / 100.0, 1.0);
+ qcoretextfontengine_scaleMetrics(br, xform);
+
+ // Normalize width and height
+ if (br.width < 0)
+ br.width = -br.width;
+ if (br.height < 0)
+ br.height = -br.height;
+
+ if (format == QFontEngine::Format_A8 || format == QFontEngine::Format_A32) {
+ // Drawing a glyph at x-position 0 with anti-aliasing enabled
+ // will potentially fill the pixel to the left of 0, as the
+ // coordinates are not aligned to the center of pixels. To
+ // prevent clipping of this pixel we need to shift the glyph
+ // in the bitmap one pixel to the right. The shift needs to
+ // be reflected in the glyph metrics as well, so that the final
+ // position of the glyph is correct, which is why doing the
+ // shift in imageForGlyph() is not enough.
+ br.x -= 1;
+
+ // As we've shifted the glyph one pixel to the right, we need
+ // to expand the width of the alpha map bounding box as well.
+ br.width += 1;
+
+ // But we have the same anti-aliasing problem on the right
+ // hand side of the glyph, eg. if the width of the glyph
+ // results in the bounding rect landing between two pixels.
+ // We pad the bounding rect again to account for the possible
+ // anti-aliased drawing.
+ br.width += 1;
+
+ // We also shift the glyph to right right based on the subpixel
+ // position, so we pad the bounding box to take account for the
+ // subpixel positions that may result in the glyph being drawn
+ // one pixel to the right of the 0-subpixel position.
+ br.width += 1;
+
+ // The same same logic as for the x-position needs to be applied
+ // to the y-position, except we don't need to compensate for
+ // the subpixel positioning.
+ br.y -= 1;
+ br.height += 2;
+ }
+
+ return br;
+}
+
+/*
+ Apple has gone through many iterations of its font smoothing algorithms,
+ and there are many ways to enable or disable certain aspects of it. As
+ keeping up with all the different toggles and behavior differences between
+ macOS versions is tricky, we resort to rendering a single glyph in a few
+ configurations, picking up the font smoothing algorithm from the observed
+ result.
+
+ The possible values are:
+
+ - Disabled: No font smoothing is applied.
+
+ Possibly triggered by the user unchecking the "Use font smoothing when
+ available" checkbox in the system preferences or setting AppleFontSmoothing
+ to 0. Also controlled by the CGContextSetAllowsFontSmoothing() API,
+ which gets its default from the settings above. This API overrides
+ the more granular CGContextSetShouldSmoothFonts(), which we use to
+ enable (request) or disable font smoothing.
+
+ Note that this does not exclude normal antialiasing, controlled by
+ the CGContextSetShouldAntialias() API.
+
+ - Subpixel: Font smoothing is applied, and affects subpixels.
+
+ This was the default mode on macOS versions prior to 10.14 (Mojave).
+ The font dilation (stem darkening) parameters were controlled by the
+ AppleFontSmoothing setting, ranging from 1 to 3 (light to strong).
+
+ On Mojave it is no longer supported, but can be triggered by a legacy
+ override (CGFontRenderingFontSmoothingDisabled=NO), so we need to
+ still account for it, otherwise users will have a bad time.
+
+ - Grayscale: Font smoothing is applied, but does not affect subpixels.
+
+ This is the default mode on macOS 10.14 (Mojave). The font dilation
+ (stem darkening) parameters are not affected by the AppleFontSmoothing
+ setting, but are instead computed based on the fill color used when
+ drawing the glyphs (white fill gives a lighter dilation than black
+ fill). This affects how we build our glyph cache, since we produce
+ alpha maps by drawing white on black.
+*/
+QCoreTextFontEngine::FontSmoothing QCoreTextFontEngine::fontSmoothing()
+{
+ static const FontSmoothing cachedFontSmoothing = [] {
+ static const int kSize = 10;
+ QCFType<CTFontRef> font = CTFontCreateWithName(CFSTR("Helvetica"), kSize, nullptr);
+
+ UniChar character('X'); CGGlyph glyph;
+ CTFontGetGlyphsForCharacters(font, &character, &glyph, 1);
+
+ auto drawGlyph = [&](bool smooth) -> QImage {
+ QImage image(kSize, kSize, QImage::Format_RGB32);
+ image.fill(0);
+
+ QMacCGContext ctx(&image);
+ CGContextSetTextDrawingMode(ctx, kCGTextFill);
+ CGContextSetGrayFillColor(ctx, 1, 1);
+
+ // Will be ignored if CGContextSetAllowsFontSmoothing() has been
+ // set to false by CoreGraphics based on user defaults.
+ CGContextSetShouldSmoothFonts(ctx, smooth);
+
+ CTFontDrawGlyphs(font, &glyph, &CGPointZero, 1, ctx);
+ return image;
+ };
+
+ QImage nonSmoothed = drawGlyph(false);
+ QImage smoothed = drawGlyph(true);
+
+ FontSmoothing fontSmoothing = FontSmoothing::Disabled;
+ [&] {
+ for (int x = 0; x < kSize; ++x) {
+ for (int y = 0; y < kSize; ++y) {
+ QRgb sp = smoothed.pixel(x, y);
+ if (qRed(sp) != qGreen(sp) || qRed(sp) != qBlue(sp)) {
+ fontSmoothing = FontSmoothing::Subpixel;
+ return;
+ }
+
+ if (sp != nonSmoothed.pixel(x, y))
+ fontSmoothing = FontSmoothing::Grayscale;
+ }
+ }
+ }();
+
+ auto defaults = [NSUserDefaults standardUserDefaults];
+ qCDebug(lcQpaFonts) << "Resolved font smoothing algorithm. Defaults ="
+ << [[defaults dictionaryRepresentation] dictionaryWithValuesForKeys:@[
+ @"AppleFontSmoothing",
+ @"CGFontRenderingFontSmoothingDisabled"
+ ]] << "Result =" << fontSmoothing;
+
+ return fontSmoothing;
+ }();
+
+ return cachedFontSmoothing;
+}
+
+bool QCoreTextFontEngine::shouldAntialias() const
+{
+ return !(fontDef.styleStrategy & QFont::NoAntialias);
+}
+
+bool QCoreTextFontEngine::shouldSmoothFont() const
+{
+ if (hasColorGlyphs())
+ return false;
+
+ if (!shouldAntialias())
+ return false;
+
+ switch (fontSmoothing()) {
+ case Disabled: return false;
+ case Subpixel: return !(fontDef.styleStrategy & QFont::NoSubpixelAntialias);
+ case Grayscale: return true;
+ }
+
+ Q_UNREACHABLE();
+}
+
+bool QCoreTextFontEngine::expectsGammaCorrectedBlending() const
+{
+ return shouldSmoothFont() && fontSmoothing() == Subpixel;
+}
+
+qreal QCoreTextFontEngine::fontSmoothingGamma()
+{
+ return 2.0;
+}
+
+QImage QCoreTextFontEngine::imageForGlyph(glyph_t glyph, const QFixedPoint &subPixelPosition, const QTransform &matrix, const QColor &color)
+{
+ glyph_metrics_t br = alphaMapBoundingBox(glyph, subPixelPosition, matrix, glyphFormat);
+
+ QImage::Format imageFormat = hasColorGlyphs() ? QImage::Format_ARGB32_Premultiplied : QImage::Format_RGB32;
+ QImage im(br.width.ceil().toInt(), br.height.ceil().toInt(), imageFormat);
+ if (!im.width() || !im.height())
+ return im;
+
+ QCFType<CGColorSpaceRef> colorspace = CGColorSpaceCreateWithName(kCGColorSpaceSRGB);
+ QCFType<CGContextRef> ctx = CGBitmapContextCreate(im.bits(), im.width(), im.height(),
+ 8, im.bytesPerLine(), colorspace,
+ qt_mac_bitmapInfoForImage(im));
+ Q_ASSERT(ctx);
+
+ CGContextSetShouldAntialias(ctx, shouldAntialias());
+
+ const bool shouldSmooth = shouldSmoothFont();
+ CGContextSetShouldSmoothFonts(ctx, shouldSmooth);
+
+#if defined(Q_OS_MACOS)
+ auto glyphColor = [&] {
+ if (shouldSmooth && fontSmoothing() == Grayscale) {
+ // The grayscale font smoothing algorithm introduced in macOS Mojave (10.14) adjusts
+ // its dilation (stem darkening) parameters based on the fill color. This means our
+ // default approach of drawing white on black to produce the alpha map will result
+ // in non-native looking text when then drawn as black on white during the final blit.
+ // As a workaround we use the application's current appearance to decide whether to
+ // draw with white or black fill, and then invert the glyph image in the latter case,
+ // producing an alpha map. This covers the most common use-cases, but longer term we
+ // should propagate the fill color all the way from the paint engine, and include it
+ // in the key for the glyph cache.
+
+ if (auto *platformTheme = QGuiApplicationPrivate::platformTheme()) {
+ if (platformTheme->colorScheme() != Qt::ColorScheme::Dark)
+ return kCGColorBlack;
+ }
+ }
+ return kCGColorWhite;
+ }();
+
+ const bool blackOnWhiteGlyphs = glyphColor == kCGColorBlack;
+ if (blackOnWhiteGlyphs)
+ im.fill(Qt::white);
+ else
+#endif
+ im.fill(0);
+
+ CGContextSetFontSize(ctx, fontDef.pixelSize);
+
+ CGAffineTransform cgMatrix = CGAffineTransformIdentity;
+
+ if (synthesisFlags & QFontEngine::SynthesizedItalic)
+ cgMatrix = CGAffineTransformConcat(cgMatrix, CGAffineTransformMake(1, 0, SYNTHETIC_ITALIC_SKEW, 1, 0, 0));
+
+ if (!hasColorGlyphs()) // CTFontDrawGlyphs incorporates the font's matrix already
+ cgMatrix = CGAffineTransformConcat(cgMatrix, transform);
+
+ if (matrix.isScaling())
+ cgMatrix = CGAffineTransformConcat(cgMatrix, CGAffineTransformMakeScale(matrix.m11(), matrix.m22()));
+
+ CGGlyph cgGlyph = glyph;
+
+ qreal pos_x = -br.x.truncate() + subPixelPosition.x.toReal();
+ qreal pos_y = im.height() + br.y.toReal() - subPixelPosition.y.toReal();
+
+ if (!hasColorGlyphs()) {
+ CGContextSetTextMatrix(ctx, cgMatrix);
+#if defined(Q_OS_MACOS)
+ CGContextSetFillColorWithColor(ctx, CGColorGetConstantColor(glyphColor));
+#else
+ CGContextSetRGBFillColor(ctx, 1, 1, 1, 1);
+#endif
+ CGContextSetTextDrawingMode(ctx, kCGTextFill);
+ CGContextSetTextPosition(ctx, pos_x, pos_y);
+
+ CTFontDrawGlyphs(ctfont, &cgGlyph, &CGPointZero, 1, ctx);
+
+ if (synthesisFlags & QFontEngine::SynthesizedBold) {
+ qreal boldOffset = 0.5 * lineThickness().toReal();
+
+ qreal scale;
+ qt_scaleForTransform(matrix, &scale);
+ boldOffset *= scale;
+
+ CGContextSetTextPosition(ctx, pos_x + boldOffset, pos_y);
+ CTFontDrawGlyphs(ctfont, &cgGlyph, &CGPointZero, 1, ctx);
+ }
+ } else {
+ CGContextSetRGBFillColor(ctx, color.redF(), color.greenF(), color.blueF(), color.alphaF());
+
+ // CGContextSetTextMatrix does not work with color glyphs, so we use
+ // the CTM instead. This means we must translate the CTM as well, to
+ // set the glyph position, instead of using CGContextSetTextPosition.
+ CGContextTranslateCTM(ctx, pos_x, pos_y);
+ CGContextConcatCTM(ctx, cgMatrix);
+
+ // CGContextShowGlyphsWithAdvances does not support the 'sbix' color-bitmap
+ // glyphs in the Apple Color Emoji font, so we use CTFontDrawGlyphs instead.
+ CTFontDrawGlyphs(ctfont, &cgGlyph, &CGPointZero, 1, ctx);
+ }
+
+ if (expectsGammaCorrectedBlending())
+ qGamma_correct_back_to_linear_cs(&im);
+
+#if defined(Q_OS_MACOS)
+ if (blackOnWhiteGlyphs)
+ im.invertPixels();
+#endif
+
+ return im;
+}
+
+QImage QCoreTextFontEngine::alphaMapForGlyph(glyph_t glyph, const QFixedPoint &subPixelPosition)
+{
+ return alphaMapForGlyph(glyph, subPixelPosition, QTransform());
+}
+
+QImage QCoreTextFontEngine::alphaMapForGlyph(glyph_t glyph, const QFixedPoint &subPixelPosition, const QTransform &x)
+{
+ if (x.type() > QTransform::TxScale)
+ return QFontEngine::alphaMapForGlyph(glyph, subPixelPosition, x);
+
+ QImage im = imageForGlyph(glyph, subPixelPosition, x);
+
+ QImage alphaMap(im.width(), im.height(), QImage::Format_Alpha8);
+
+ for (int y=0; y<im.height(); ++y) {
+ uint *src = (uint*) im.scanLine(y);
+ uchar *dst = alphaMap.scanLine(y);
+ for (int x=0; x<im.width(); ++x) {
+ *dst = qGray(*src);
+ ++dst;
+ ++src;
+ }
+ }
+
+ return alphaMap;
+}
+
+QImage QCoreTextFontEngine::alphaRGBMapForGlyph(glyph_t glyph, const QFixedPoint &subPixelPosition, const QTransform &x)
+{
+ if (x.type() > QTransform::TxScale)
+ return QFontEngine::alphaRGBMapForGlyph(glyph, subPixelPosition, x);
+
+ return imageForGlyph(glyph, subPixelPosition, x);
+}
+
+QImage QCoreTextFontEngine::bitmapForGlyph(glyph_t glyph, const QFixedPoint &subPixelPosition, const QTransform &t, const QColor &color)
+{
+ if (t.type() > QTransform::TxScale)
+ return QFontEngine::bitmapForGlyph(glyph, subPixelPosition, t, color);
+
+ return imageForGlyph(glyph, subPixelPosition, t, color);
+}
+
+void QCoreTextFontEngine::recalcAdvances(QGlyphLayout *glyphs, QFontEngine::ShaperFlags flags) const
+{
+ Q_UNUSED(flags);
+
+ const int numGlyphs = glyphs->numGlyphs;
+ QVarLengthArray<CGGlyph> cgGlyphs(numGlyphs);
+
+ for (int i = 0; i < numGlyphs; ++i) {
+ Q_ASSERT(!QFontEngineMulti::highByte(glyphs->glyphs[i]));
+ cgGlyphs[i] = glyphs->glyphs[i];
+ }
+
+ loadAdvancesForGlyphs(cgGlyphs, glyphs);
+}
+
+void QCoreTextFontEngine::loadAdvancesForGlyphs(QVarLengthArray<CGGlyph> &cgGlyphs, QGlyphLayout *glyphs) const
+{
+ const int numGlyphs = glyphs->numGlyphs;
+ QVarLengthArray<CGSize> advances(numGlyphs);
+ CTFontGetAdvancesForGlyphs(ctfont, kCTFontOrientationHorizontal, cgGlyphs.data(), advances.data(), numGlyphs);
+
+ qreal stretch = fontDef.stretch != QFont::AnyStretch ? fontDef.stretch / 100.0 : 1.0;
+ for (int i = 0; i < numGlyphs; ++i)
+ glyphs->advances[i] = QFixed::fromReal(advances[i].width * stretch);
+}
+
+QFontEngine::FaceId QCoreTextFontEngine::faceId() const
+{
+ return face_id;
+}
+
+bool QCoreTextFontEngine::canRender(const QChar *string, int len) const
+{
+ QVarLengthArray<CGGlyph> cgGlyphs(len);
+ return CTFontGetGlyphsForCharacters(ctfont, (const UniChar *) string, cgGlyphs.data(), len);
+}
+
+bool QCoreTextFontEngine::getSfntTableData(uint tag, uchar *buffer, uint *length) const
+{
+ return ct_getSfntTable((void *)&ctfont, tag, buffer, length);
+}
+
+void QCoreTextFontEngine::getUnscaledGlyph(glyph_t glyph, QPainterPath *path, glyph_metrics_t *metric)
+{
+ CGAffineTransform cgMatrix = CGAffineTransformIdentity;
+
+ qreal emSquare = CTFontGetUnitsPerEm(ctfont);
+ qreal scale = emSquare / CTFontGetSize(ctfont);
+ cgMatrix = CGAffineTransformScale(cgMatrix, scale, -scale);
+
+ QCFType<CGPathRef> cgpath = CTFontCreatePathForGlyph(ctfont, (CGGlyph) glyph, &cgMatrix);
+ ConvertPathInfo info(path, QPointF(0,0));
+ CGPathApply(cgpath, &info, convertCGPathToQPainterPath);
+
+ *metric = boundingBox(glyph);
+ // scale the metrics too
+ metric->width = QFixed::fromReal(metric->width.toReal() * scale);
+ metric->height = QFixed::fromReal(metric->height.toReal() * scale);
+ metric->x = QFixed::fromReal(metric->x.toReal() * scale);
+ metric->y = QFixed::fromReal(metric->y.toReal() * scale);
+ metric->xoff = QFixed::fromReal(metric->xoff.toReal() * scale);
+ metric->yoff = QFixed::fromReal(metric->yoff.toReal() * scale);
+}
+
+QFixed QCoreTextFontEngine::emSquareSize() const
+{
+ return QFixed(int(CTFontGetUnitsPerEm(ctfont)));
+}
+
+QFontEngine *QCoreTextFontEngine::cloneWithSize(qreal pixelSize) const
+{
+ QFontDef newFontDef = fontDef;
+ newFontDef.pixelSize = pixelSize;
+ newFontDef.pointSize = pixelSize * 72.0 / qt_defaultDpi();
+
+ return new QCoreTextFontEngine(cgFont, newFontDef);
+}
+
+Qt::HANDLE QCoreTextFontEngine::handle() const
+{
+ return (Qt::HANDLE)(static_cast<CTFontRef>(ctfont));
+}
+
+bool QCoreTextFontEngine::supportsTransformation(const QTransform &transform) const
+{
+ if (transform.type() < QTransform::TxScale)
+ return true;
+ else if (transform.type() == QTransform::TxScale &&
+ transform.m11() >= 0 && transform.m22() >= 0)
+ return true;
+ else
+ return false;
+}
+
+QFixed QCoreTextFontEngine::lineThickness() const
+{
+ return underlineThickness;
+}
+
+QFixed QCoreTextFontEngine::underlinePosition() const
+{
+ return underlinePos;
+}
+
+QFontEngine::Properties QCoreTextFontEngine::properties() const
+{
+ Properties result;
+
+ QCFString psName, copyright;
+ psName = CTFontCopyPostScriptName(ctfont);
+ copyright = CTFontCopyName(ctfont, kCTFontCopyrightNameKey);
+ result.postscriptName = QString::fromCFString(psName).toUtf8();
+ result.copyright = QString::fromCFString(copyright).toUtf8();
+
+ qreal emSquare = CTFontGetUnitsPerEm(ctfont);
+ qreal scale = emSquare / CTFontGetSize(ctfont);
+
+ CGRect cgRect = CTFontGetBoundingBox(ctfont);
+ result.boundingBox = QRectF(cgRect.origin.x * scale,
+ -CTFontGetAscent(ctfont) * scale,
+ cgRect.size.width * scale,
+ cgRect.size.height * scale);
+
+ result.emSquare = emSquareSize();
+ result.ascent = QFixed::fromReal(CTFontGetAscent(ctfont) * scale);
+ result.descent = QFixed::fromReal(CTFontGetDescent(ctfont) * scale);
+ result.leading = QFixed::fromReal(CTFontGetLeading(ctfont) * scale);
+ result.italicAngle = QFixed::fromReal(CTFontGetSlantAngle(ctfont));
+ result.capHeight = QFixed::fromReal(CTFontGetCapHeight(ctfont) * scale);
+ result.lineWidth = QFixed::fromReal(CTFontGetUnderlineThickness(ctfont) * scale);
+
+ return result;
+}
+
+void QCoreTextFontEngine::doKerning(QGlyphLayout *g, ShaperFlags flags) const
+{
+ if (!kerningPairsLoaded) {
+ kerningPairsLoaded = true;
+ qreal emSquare = CTFontGetUnitsPerEm(ctfont);
+ qreal scale = emSquare / CTFontGetSize(ctfont);
+
+ const_cast<QCoreTextFontEngine *>(this)->loadKerningPairs(QFixed::fromReal(scale));
+ }
+
+ QFontEngine::doKerning(g, flags);
+}
+
+QT_END_NAMESPACE
diff --git a/src/gui/text/coretext/qfontengine_coretext_p.h b/src/gui/text/coretext/qfontengine_coretext_p.h
new file mode 100644
index 0000000000..2f388c32bc
--- /dev/null
+++ b/src/gui/text/coretext/qfontengine_coretext_p.h
@@ -0,0 +1,121 @@
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
+
+#ifndef QFONTENGINE_CORETEXT_P_H
+#define QFONTENGINE_CORETEXT_P_H
+
+//
+// W A R N I N G
+// -------------
+//
+// This file is not part of the Qt API. It exists purely as an
+// implementation detail. This header file may change from version to
+// version without notice, or even be removed.
+//
+// We mean it.
+//
+
+#include <private/qfontengine_p.h>
+#include <private/qcore_mac_p.h>
+#include <QtCore/qloggingcategory.h>
+
+#ifdef Q_OS_MACOS
+#include <ApplicationServices/ApplicationServices.h>
+#else
+#include <CoreText/CoreText.h>
+#include <CoreGraphics/CoreGraphics.h>
+#endif
+
+QT_BEGIN_NAMESPACE
+
+class Q_GUI_EXPORT QCoreTextFontEngine : public QFontEngine
+{
+ Q_GADGET
+
+public:
+ QCoreTextFontEngine(CTFontRef font, const QFontDef &def);
+ QCoreTextFontEngine(CGFontRef font, const QFontDef &def);
+ ~QCoreTextFontEngine();
+
+ glyph_t glyphIndex(uint ucs4) const override;
+ int stringToCMap(const QChar *str, int len, QGlyphLayout *glyphs, int *nglyphs, ShaperFlags flags) const override;
+ void recalcAdvances(QGlyphLayout *, ShaperFlags) const override;
+
+ glyph_metrics_t boundingBox(glyph_t glyph) override;
+
+ QFixed capHeight() const override;
+ QFixed xHeight() const override;
+ qreal maxCharWidth() const override;
+ QFixed averageCharWidth() const override;
+
+ void addGlyphsToPath(glyph_t *glyphs, QFixedPoint *positions, int numGlyphs,
+ QPainterPath *path, QTextItem::RenderFlags) override;
+
+ bool canRender(const QChar *string, int len) const override;
+
+ int synthesized() const override { return synthesisFlags; }
+ bool supportsHorizontalSubPixelPositions() const override { return true; }
+ bool supportsVerticalSubPixelPositions() const override { return false; }
+
+ QFixed lineThickness() const override;
+ QFixed underlinePosition() const override;
+
+ void draw(CGContextRef ctx, qreal x, qreal y, const QTextItemInt &ti, int paintDeviceHeight);
+
+ FaceId faceId() const override;
+ bool getSfntTableData(uint /*tag*/, uchar * /*buffer*/, uint * /*length*/) const override;
+ void getUnscaledGlyph(glyph_t glyph, QPainterPath *path, glyph_metrics_t *metrics) override;
+ QImage alphaMapForGlyph(glyph_t, const QFixedPoint &subPixelPosition) override;
+ QImage alphaMapForGlyph(glyph_t glyph, const QFixedPoint &subPixelPosition, const QTransform &t) override;
+ QImage alphaRGBMapForGlyph(glyph_t, const QFixedPoint &subPixelPosition, const QTransform &t) override;
+ glyph_metrics_t alphaMapBoundingBox(glyph_t glyph, const QFixedPoint &, const QTransform &matrix, GlyphFormat) override;
+ QImage bitmapForGlyph(glyph_t, const QFixedPoint &subPixelPosition, const QTransform &t, const QColor &color) override;
+ QFixed emSquareSize() const override;
+ void doKerning(QGlyphLayout *g, ShaperFlags flags) const override;
+
+ bool supportsTransformation(const QTransform &transform) const override;
+ bool expectsGammaCorrectedBlending() const override;
+
+ QFontEngine *cloneWithSize(qreal pixelSize) const override;
+ Qt::HANDLE handle() const override;
+ int glyphMargin(QFontEngine::GlyphFormat format) override { Q_UNUSED(format); return 0; }
+
+ QFontEngine::Properties properties() const override;
+
+ enum FontSmoothing { Disabled, Subpixel, Grayscale };
+ Q_ENUM(FontSmoothing);
+
+ static FontSmoothing fontSmoothing();
+ static qreal fontSmoothingGamma();
+
+ static bool ct_getSfntTable(void *user_data, uint tag, uchar *buffer, uint *length);
+ static QFont::Weight qtWeightFromCFWeight(float value);
+
+ static QCoreTextFontEngine *create(const QByteArray &fontData, qreal pixelSize, QFont::HintingPreference hintingPreference, const QMap<QFont::Tag, float> &variableAxisValue);
+
+protected:
+ QCoreTextFontEngine(const QFontDef &def);
+ void init();
+ QImage imageForGlyph(glyph_t glyph, const QFixedPoint &subPixelPosition, const QTransform &m, const QColor &color = QColor());
+ void loadAdvancesForGlyphs(QVarLengthArray<CGGlyph> &cgGlyphs, QGlyphLayout *glyphs) const;
+ bool hasColorGlyphs() const;
+ bool shouldAntialias() const;
+ bool shouldSmoothFont() const;
+ void initializeHeightMetrics() const override;
+
+ QCFType<CTFontRef> ctfont;
+ QCFType<CGFontRef> cgFont;
+ int synthesisFlags;
+ CGAffineTransform transform;
+ QFixed avgCharWidth;
+ QFixed underlineThickness;
+ QFixed underlinePos;
+ QFontEngine::FaceId face_id;
+ mutable bool kerningPairsLoaded;
+};
+
+CGAffineTransform Q_GUI_EXPORT qt_transform_from_fontdef(const QFontDef &fontDef);
+
+QT_END_NAMESPACE
+
+#endif // QFONTENGINE_CORETEXT_P_H
diff --git a/src/gui/text/freetype/qfontengine_ft.cpp b/src/gui/text/freetype/qfontengine_ft.cpp
new file mode 100644
index 0000000000..d3791f1f6e
--- /dev/null
+++ b/src/gui/text/freetype/qfontengine_ft.cpp
@@ -0,0 +1,2318 @@
+// Copyright (C) 2021 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
+
+#include "qdir.h"
+#include "qmetatype.h"
+#include "qtextstream.h"
+#include "qvariant.h"
+#include "qfontengine_ft_p.h"
+#include "private/qimage_p.h"
+#include <private/qstringiterator_p.h>
+#include <qguiapplication.h>
+#include <qscreen.h>
+#include <qpa/qplatformscreen.h>
+#include <QtCore/QUuid>
+#include <QtCore/QLoggingCategory>
+#include <QtGui/QPainterPath>
+
+#ifndef QT_NO_FREETYPE
+
+#include "qfile.h"
+#include "qfileinfo.h"
+#include <qscopedvaluerollback.h>
+#include "qthreadstorage.h"
+#include <qmath.h>
+#include <qendian.h>
+
+#include <memory>
+
+#include <ft2build.h>
+#include FT_FREETYPE_H
+#include FT_OUTLINE_H
+#include FT_SYNTHESIS_H
+#include FT_TRUETYPE_TABLES_H
+#include FT_TYPE1_TABLES_H
+#include FT_GLYPH_H
+#include FT_MODULE_H
+#include FT_LCD_FILTER_H
+#include FT_MULTIPLE_MASTERS_H
+
+#if defined(FT_CONFIG_OPTIONS_H)
+#include FT_CONFIG_OPTIONS_H
+#endif
+
+#if defined(FT_FONT_FORMATS_H)
+#include FT_FONT_FORMATS_H
+#endif
+
+#ifdef QT_LINUXBASE
+#include FT_ERRORS_H
+#endif
+
+#if !defined(QT_MAX_CACHED_GLYPH_SIZE)
+# define QT_MAX_CACHED_GLYPH_SIZE 64
+#endif
+
+QT_BEGIN_NAMESPACE
+
+Q_DECLARE_LOGGING_CATEGORY(lcFontMatch)
+
+using namespace Qt::StringLiterals;
+
+#define FLOOR(x) ((x) & -64)
+#define CEIL(x) (((x)+63) & -64)
+#define TRUNC(x) ((x) >> 6)
+#define ROUND(x) (((x)+32) & -64)
+
+static bool ft_getSfntTable(void *user_data, uint tag, uchar *buffer, uint *length)
+{
+ FT_Face face = (FT_Face)user_data;
+
+ bool result = false;
+ if (FT_IS_SFNT(face)) {
+ FT_ULong len = *length;
+ result = FT_Load_Sfnt_Table(face, tag, 0, buffer, &len) == FT_Err_Ok;
+ *length = len;
+ Q_ASSERT(!result || int(*length) > 0);
+ }
+
+ return result;
+}
+
+static QFontEngineFT::Glyph emptyGlyph;
+
+static const QFontEngine::HintStyle ftInitialDefaultHintStyle =
+#ifdef Q_OS_WIN
+ QFontEngineFT::HintFull;
+#else
+ QFontEngineFT::HintNone;
+#endif
+
+// -------------------------- Freetype support ------------------------------
+
+class QtFreetypeData
+{
+public:
+ QtFreetypeData()
+ : library(nullptr)
+ { }
+ ~QtFreetypeData();
+
+ struct FaceStyle {
+ QString faceFileName;
+ QString styleName;
+
+ FaceStyle(QString faceFileName, QString styleName)
+ : faceFileName(std::move(faceFileName)),
+ styleName(std::move(styleName))
+ {}
+ };
+
+ FT_Library library;
+ QHash<QFontEngine::FaceId, QFreetypeFace *> faces;
+ QHash<FaceStyle, int> faceIndices;
+};
+
+QtFreetypeData::~QtFreetypeData()
+{
+ for (auto iter = faces.cbegin(); iter != faces.cend(); ++iter) {
+ iter.value()->cleanup();
+ if (!iter.value()->ref.deref())
+ delete iter.value();
+ }
+ faces.clear();
+ FT_Done_FreeType(library);
+ library = nullptr;
+}
+
+inline bool operator==(const QtFreetypeData::FaceStyle &style1, const QtFreetypeData::FaceStyle &style2)
+{
+ return style1.faceFileName == style2.faceFileName && style1.styleName == style2.styleName;
+}
+
+inline size_t qHash(const QtFreetypeData::FaceStyle &style, size_t seed)
+{
+ return qHashMulti(seed, style.faceFileName, style.styleName);
+}
+
+Q_GLOBAL_STATIC(QThreadStorage<QtFreetypeData *>, theFreetypeData)
+
+QtFreetypeData *qt_getFreetypeData()
+{
+ QtFreetypeData *&freetypeData = theFreetypeData()->localData();
+ if (!freetypeData)
+ freetypeData = new QtFreetypeData;
+ if (!freetypeData->library) {
+ FT_Init_FreeType(&freetypeData->library);
+#if defined(FT_FONT_FORMATS_H)
+ // Freetype defaults to disabling stem-darkening on CFF, we re-enable it.
+ FT_Bool no_darkening = false;
+ FT_Property_Set(freetypeData->library, "cff", "no-stem-darkening", &no_darkening);
+#endif
+ }
+ return freetypeData;
+}
+
+FT_Library qt_getFreetype()
+{
+ QtFreetypeData *freetypeData = qt_getFreetypeData();
+ Q_ASSERT(freetypeData->library);
+ return freetypeData->library;
+}
+
+int QFreetypeFace::fsType() const
+{
+ int fsType = 0;
+ TT_OS2 *os2 = (TT_OS2 *)FT_Get_Sfnt_Table(face, ft_sfnt_os2);
+ if (os2)
+ fsType = os2->fsType;
+ return fsType;
+}
+
+int QFreetypeFace::getPointInOutline(glyph_t glyph, int flags, quint32 point, QFixed *xpos, QFixed *ypos, quint32 *nPoints)
+{
+ if (int error = FT_Load_Glyph(face, glyph, flags))
+ return error;
+
+ if (face->glyph->format != FT_GLYPH_FORMAT_OUTLINE)
+ return Err_Invalid_SubTable;
+
+ *nPoints = face->glyph->outline.n_points;
+ if (!(*nPoints))
+ return Err_Ok;
+
+ if (point > *nPoints)
+ return Err_Invalid_SubTable;
+
+ *xpos = QFixed::fromFixed(face->glyph->outline.points[point].x);
+ *ypos = QFixed::fromFixed(face->glyph->outline.points[point].y);
+
+ return Err_Ok;
+}
+
+bool QFreetypeFace::isScalable() const
+{
+ return FT_IS_SCALABLE(face);
+}
+
+bool QFreetypeFace::isScalableBitmap() const
+{
+#ifdef FT_HAS_COLOR
+ return !isScalable() && FT_HAS_COLOR(face);
+#else
+ return false;
+#endif
+}
+
+extern QByteArray qt_fontdata_from_index(int);
+
+/*
+ * One font file can contain more than one font (bold/italic for example)
+ * find the right one and return it.
+ *
+ * Returns the freetype face or 0 in case of an empty file or any other problems
+ * (like not being able to open the file)
+ */
+QFreetypeFace *QFreetypeFace::getFace(const QFontEngine::FaceId &face_id,
+ const QByteArray &fontData)
+{
+ if (face_id.filename.isEmpty() && fontData.isEmpty())
+ return nullptr;
+
+ QtFreetypeData *freetypeData = qt_getFreetypeData();
+
+ QFreetypeFace *freetype = nullptr;
+ auto it = freetypeData->faces.find(face_id);
+ if (it != freetypeData->faces.end()) {
+ freetype = *it;
+
+ Q_ASSERT(freetype->ref.loadRelaxed() > 0);
+ if (freetype->ref.loadRelaxed() == 1) {
+ // If there is only one reference left to the face, it means it is only referenced by
+ // the cache itself, and thus it is in cleanup state (but the final outside reference
+ // was removed on a different thread so it could not be deleted right away). We then
+ // complete the cleanup and pretend we didn't find it, so that it can be re-created with
+ // the present state.
+ freetype->cleanup();
+ freetypeData->faces.erase(it);
+ delete freetype;
+ freetype = nullptr;
+ } else {
+ freetype->ref.ref();
+ }
+ }
+
+ if (!freetype) {
+ const auto deleter = [](QFreetypeFace *f) { delete f; };
+ std::unique_ptr<QFreetypeFace, decltype(deleter)> newFreetype(new QFreetypeFace, deleter);
+ FT_Face face;
+ if (!face_id.filename.isEmpty()) {
+ QString fileName = QFile::decodeName(face_id.filename);
+ if (const char *prefix = ":qmemoryfonts/"; face_id.filename.startsWith(prefix)) {
+ // from qfontdatabase.cpp
+ QByteArray idx = face_id.filename;
+ idx.remove(0, strlen(prefix)); // remove ':qmemoryfonts/'
+ bool ok = false;
+ newFreetype->fontData = qt_fontdata_from_index(idx.toInt(&ok));
+ if (!ok)
+ newFreetype->fontData = QByteArray();
+ } else if (!QFileInfo(fileName).isNativePath()) {
+ QFile file(fileName);
+ if (!file.open(QIODevice::ReadOnly)) {
+ return nullptr;
+ }
+ newFreetype->fontData = file.readAll();
+ }
+ } else {
+ newFreetype->fontData = fontData;
+ }
+ if (!newFreetype->fontData.isEmpty()) {
+ if (FT_New_Memory_Face(freetypeData->library, (const FT_Byte *)newFreetype->fontData.constData(), newFreetype->fontData.size(), face_id.index, &face)) {
+ return nullptr;
+ }
+ } else if (FT_New_Face(freetypeData->library, face_id.filename, face_id.index, &face)) {
+ return nullptr;
+ }
+
+#if (FREETYPE_MAJOR*10000 + FREETYPE_MINOR*100 + FREETYPE_PATCH) >= 20900
+ if (face_id.instanceIndex >= 0) {
+ qCDebug(lcFontMatch)
+ << "Selecting named instance" << (face_id.instanceIndex)
+ << "in" << face_id.filename;
+ FT_Set_Named_Instance(face, face_id.instanceIndex + 1);
+ }
+#endif
+ newFreetype->face = face;
+ newFreetype->mm_var = nullptr;
+ if (FT_IS_NAMED_INSTANCE(newFreetype->face)) {
+ FT_Error ftresult;
+ ftresult = FT_Get_MM_Var(face, &newFreetype->mm_var);
+ if (ftresult != FT_Err_Ok)
+ newFreetype->mm_var = nullptr;
+ }
+
+ newFreetype->ref.storeRelaxed(1);
+ newFreetype->xsize = 0;
+ newFreetype->ysize = 0;
+ newFreetype->matrix.xx = 0x10000;
+ newFreetype->matrix.yy = 0x10000;
+ newFreetype->matrix.xy = 0;
+ newFreetype->matrix.yx = 0;
+ newFreetype->unicode_map = nullptr;
+ newFreetype->symbol_map = nullptr;
+
+ memset(newFreetype->cmapCache, 0, sizeof(newFreetype->cmapCache));
+
+ for (int i = 0; i < newFreetype->face->num_charmaps; ++i) {
+ FT_CharMap cm = newFreetype->face->charmaps[i];
+ switch(cm->encoding) {
+ case FT_ENCODING_UNICODE:
+ newFreetype->unicode_map = cm;
+ break;
+ case FT_ENCODING_APPLE_ROMAN:
+ case FT_ENCODING_ADOBE_LATIN_1:
+ if (!newFreetype->unicode_map || newFreetype->unicode_map->encoding != FT_ENCODING_UNICODE)
+ newFreetype->unicode_map = cm;
+ break;
+ case FT_ENCODING_ADOBE_CUSTOM:
+ case FT_ENCODING_MS_SYMBOL:
+ if (!newFreetype->symbol_map)
+ newFreetype->symbol_map = cm;
+ break;
+ default:
+ break;
+ }
+ }
+
+ if (!FT_IS_SCALABLE(newFreetype->face) && newFreetype->face->num_fixed_sizes == 1)
+ FT_Set_Char_Size(face, newFreetype->face->available_sizes[0].x_ppem, newFreetype->face->available_sizes[0].y_ppem, 0, 0);
+
+ FT_Set_Charmap(newFreetype->face, newFreetype->unicode_map);
+
+ if (!face_id.variableAxes.isEmpty()) {
+ FT_MM_Var *var = nullptr;
+ FT_Get_MM_Var(newFreetype->face, &var);
+ if (var != nullptr) {
+ QVarLengthArray<FT_Fixed, 16> coords(var->num_axis);
+ FT_Get_Var_Design_Coordinates(face, var->num_axis, coords.data());
+ for (FT_UInt i = 0; i < var->num_axis; ++i) {
+ if (const auto tag = QFont::Tag::fromValue(var->axis[i].tag)) {
+ const auto it = face_id.variableAxes.constFind(*tag);
+ if (it != face_id.variableAxes.constEnd())
+ coords[i] = FT_Fixed(*it * 65536);
+ }
+ }
+ FT_Set_Var_Design_Coordinates(face, var->num_axis, coords.data());
+ FT_Done_MM_Var(qt_getFreetype(), var);
+ }
+ }
+
+ QT_TRY {
+ freetypeData->faces.insert(face_id, newFreetype.get());
+ } QT_CATCH(...) {
+ newFreetype.release()->release(face_id);
+ // we could return null in principle instead of throwing
+ QT_RETHROW;
+ }
+ freetype = newFreetype.release();
+ freetype->ref.ref();
+ }
+ return freetype;
+}
+
+void QFreetypeFace::cleanup()
+{
+ hbFace.reset();
+ if (mm_var && face && face->glyph)
+ FT_Done_MM_Var(face->glyph->library, mm_var);
+ mm_var = nullptr;
+ FT_Done_Face(face);
+ face = nullptr;
+}
+
+void QFreetypeFace::release(const QFontEngine::FaceId &face_id)
+{
+ Q_UNUSED(face_id);
+ bool deleteThis = !ref.deref();
+
+ // If the only reference left over is the cache's reference, we remove it from the cache,
+ // granted that we are on the correct thread. If not, we leave it there to be cleaned out
+ // later. While we are at it, we also purge all left over faces which are only referenced
+ // from the cache.
+ if (face && ref.loadRelaxed() == 1) {
+ QtFreetypeData *freetypeData = qt_getFreetypeData();
+ for (auto it = freetypeData->faces.constBegin(); it != freetypeData->faces.constEnd(); ) {
+ if (it.value()->ref.loadRelaxed() == 1) {
+ it.value()->cleanup();
+ if (it.value() == this)
+ deleteThis = true; // This face, delete at end of function for safety
+ else
+ delete it.value();
+ it = freetypeData->faces.erase(it);
+ } else {
+ ++it;
+ }
+ }
+
+ if (freetypeData->faces.isEmpty()) {
+ FT_Done_FreeType(freetypeData->library);
+ freetypeData->library = nullptr;
+ }
+ }
+
+ if (deleteThis)
+ delete this;
+}
+
+static int computeFaceIndex(const QString &faceFileName, const QString &styleName)
+{
+ FT_Library library = qt_getFreetype();
+
+ int faceIndex = 0;
+ int numFaces = 0;
+
+ do {
+ FT_Face face;
+
+ FT_Error error = FT_New_Face(library, faceFileName.toUtf8().constData(), faceIndex, &face);
+ if (error != FT_Err_Ok) {
+ qDebug() << "FT_New_Face failed for face index" << faceIndex << ':' << Qt::hex << error;
+ break;
+ }
+
+ const bool found = QLatin1StringView(face->style_name) == styleName;
+ numFaces = face->num_faces;
+
+ FT_Done_Face(face);
+
+ if (found)
+ return faceIndex;
+ } while (++faceIndex < numFaces);
+
+ // Fall back to the first font face in the file
+ return 0;
+}
+
+int QFreetypeFace::getFaceIndexByStyleName(const QString &faceFileName, const QString &styleName)
+{
+ QtFreetypeData *freetypeData = qt_getFreetypeData();
+
+ // Try to get from cache
+ QtFreetypeData::FaceStyle faceStyle(faceFileName, styleName);
+ int faceIndex = freetypeData->faceIndices.value(faceStyle, -1);
+
+ if (faceIndex >= 0)
+ return faceIndex;
+
+ faceIndex = computeFaceIndex(faceFileName, styleName);
+
+ freetypeData->faceIndices.insert(faceStyle, faceIndex);
+
+ return faceIndex;
+}
+
+void QFreetypeFace::computeSize(const QFontDef &fontDef, int *xsize, int *ysize, bool *outline_drawing, QFixed *scalableBitmapScaleFactor)
+{
+ *ysize = qRound(fontDef.pixelSize * 64);
+ *xsize = *ysize * fontDef.stretch / 100;
+ *scalableBitmapScaleFactor = 1;
+ *outline_drawing = false;
+
+ if (!(face->face_flags & FT_FACE_FLAG_SCALABLE)) {
+ int best = 0;
+ if (!isScalableBitmap()) {
+ /*
+ * Bitmap only faces must match exactly, so find the closest
+ * one (height dominant search)
+ */
+ for (int i = 1; i < face->num_fixed_sizes; i++) {
+ if (qAbs(*ysize - face->available_sizes[i].y_ppem) <
+ qAbs(*ysize - face->available_sizes[best].y_ppem) ||
+ (qAbs(*ysize - face->available_sizes[i].y_ppem) ==
+ qAbs(*ysize - face->available_sizes[best].y_ppem) &&
+ qAbs(*xsize - face->available_sizes[i].x_ppem) <
+ qAbs(*xsize - face->available_sizes[best].x_ppem))) {
+ best = i;
+ }
+ }
+ } else {
+ // Select the shortest bitmap strike whose height is larger than the desired height
+ for (int i = 1; i < face->num_fixed_sizes; i++) {
+ if (face->available_sizes[i].y_ppem < *ysize) {
+ if (face->available_sizes[i].y_ppem > face->available_sizes[best].y_ppem)
+ best = i;
+ } else if (face->available_sizes[best].y_ppem < *ysize) {
+ best = i;
+ } else if (face->available_sizes[i].y_ppem < face->available_sizes[best].y_ppem) {
+ best = i;
+ }
+ }
+ }
+
+ // According to freetype documentation we must use FT_Select_Size
+ // to make sure we can select the desired bitmap strike index
+ if (FT_Select_Size(face, best) == 0) {
+ if (isScalableBitmap())
+ *scalableBitmapScaleFactor = QFixed::fromReal((qreal)fontDef.pixelSize / face->available_sizes[best].height);
+ *xsize = face->available_sizes[best].x_ppem;
+ *ysize = face->available_sizes[best].y_ppem;
+ } else {
+ *xsize = *ysize = 0;
+ }
+ } else {
+ *outline_drawing = (*xsize > (QT_MAX_CACHED_GLYPH_SIZE<<6) || *ysize > (QT_MAX_CACHED_GLYPH_SIZE<<6));
+ }
+}
+
+QFontEngine::Properties QFreetypeFace::properties() const
+{
+ QFontEngine::Properties p;
+ p.postscriptName = FT_Get_Postscript_Name(face);
+ PS_FontInfoRec font_info;
+ if (FT_Get_PS_Font_Info(face, &font_info) == 0)
+ p.copyright = font_info.notice;
+ if (FT_IS_SCALABLE(face)) {
+ p.ascent = face->ascender;
+ p.descent = -face->descender;
+ p.leading = face->height - face->ascender + face->descender;
+ p.emSquare = face->units_per_EM;
+ p.boundingBox = QRectF(face->bbox.xMin, -face->bbox.yMax,
+ face->bbox.xMax - face->bbox.xMin,
+ face->bbox.yMax - face->bbox.yMin);
+ } else {
+ p.ascent = QFixed::fromFixed(face->size->metrics.ascender);
+ p.descent = QFixed::fromFixed(-face->size->metrics.descender);
+ p.leading = QFixed::fromFixed(face->size->metrics.height - face->size->metrics.ascender + face->size->metrics.descender);
+ p.emSquare = face->size->metrics.y_ppem;
+// p.boundingBox = QRectF(-p.ascent.toReal(), 0, (p.ascent + p.descent).toReal(), face->size->metrics.max_advance/64.);
+ p.boundingBox = QRectF(0, -p.ascent.toReal(),
+ face->size->metrics.max_advance/64, (p.ascent + p.descent).toReal() );
+ }
+ p.italicAngle = 0;
+ p.capHeight = p.ascent;
+ p.lineWidth = face->underline_thickness;
+
+ return p;
+}
+
+bool QFreetypeFace::getSfntTable(uint tag, uchar *buffer, uint *length) const
+{
+ return ft_getSfntTable(face, tag, buffer, length);
+}
+
+/* Some fonts (such as MingLiu rely on hinting to scale different
+ components to their correct sizes. While this is really broken (it
+ should be done in the component glyph itself, not the hinter) we
+ will have to live with it.
+
+ This means we can not use FT_LOAD_NO_HINTING to get the glyph
+ outline. All we can do is to load the unscaled glyph and scale it
+ down manually when required.
+*/
+static void scaleOutline(FT_Face face, FT_GlyphSlot g, FT_Fixed x_scale, FT_Fixed y_scale)
+{
+ x_scale = FT_MulDiv(x_scale, 1 << 10, face->units_per_EM);
+ y_scale = FT_MulDiv(y_scale, 1 << 10, face->units_per_EM);
+ FT_Vector *p = g->outline.points;
+ const FT_Vector *e = p + g->outline.n_points;
+ while (p < e) {
+ p->x = FT_MulFix(p->x, x_scale);
+ p->y = FT_MulFix(p->y, y_scale);
+ ++p;
+ }
+}
+
+#define GLYPH2PATH_DEBUG QT_NO_QDEBUG_MACRO // qDebug
+void QFreetypeFace::addGlyphToPath(FT_Face face, FT_GlyphSlot g, const QFixedPoint &point, QPainterPath *path, FT_Fixed x_scale, FT_Fixed y_scale)
+{
+ const qreal factor = 1/64.;
+ scaleOutline(face, g, x_scale, y_scale);
+
+ QPointF cp = point.toPointF();
+
+ // convert the outline to a painter path
+ int i = 0;
+ for (int j = 0; j < g->outline.n_contours; ++j) {
+ int last_point = g->outline.contours[j];
+ GLYPH2PATH_DEBUG() << "contour:" << i << "to" << last_point;
+ QPointF start = QPointF(g->outline.points[i].x*factor, -g->outline.points[i].y*factor);
+ if (!(g->outline.tags[i] & 1)) { // start point is not on curve:
+ if (!(g->outline.tags[last_point] & 1)) { // end point is not on curve:
+ GLYPH2PATH_DEBUG() << " start and end point are not on curve";
+ start = (QPointF(g->outline.points[last_point].x*factor,
+ -g->outline.points[last_point].y*factor) + start) / 2.0;
+ } else {
+ GLYPH2PATH_DEBUG() << " end point is on curve, start is not";
+ start = QPointF(g->outline.points[last_point].x*factor,
+ -g->outline.points[last_point].y*factor);
+ }
+ --i; // to use original start point as control point below
+ }
+ start += cp;
+ GLYPH2PATH_DEBUG() << " start at" << start;
+
+ path->moveTo(start);
+ QPointF c[4];
+ c[0] = start;
+ int n = 1;
+ while (i < last_point) {
+ ++i;
+ c[n] = cp + QPointF(g->outline.points[i].x*factor, -g->outline.points[i].y*factor);
+ GLYPH2PATH_DEBUG() << " " << i << c[n] << "tag =" << (int)g->outline.tags[i]
+ << ": on curve =" << (bool)(g->outline.tags[i] & 1);
+ ++n;
+ switch (g->outline.tags[i] & 3) {
+ case 2:
+ // cubic bezier element
+ if (n < 4)
+ continue;
+ c[3] = (c[3] + c[2])/2;
+ --i;
+ break;
+ case 0:
+ // quadratic bezier element
+ if (n < 3)
+ continue;
+ c[3] = (c[1] + c[2])/2;
+ c[2] = (2*c[1] + c[3])/3;
+ c[1] = (2*c[1] + c[0])/3;
+ --i;
+ break;
+ case 1:
+ case 3:
+ if (n == 2) {
+ GLYPH2PATH_DEBUG() << " lineTo" << c[1];
+ path->lineTo(c[1]);
+ c[0] = c[1];
+ n = 1;
+ continue;
+ } else if (n == 3) {
+ c[3] = c[2];
+ c[2] = (2*c[1] + c[3])/3;
+ c[1] = (2*c[1] + c[0])/3;
+ }
+ break;
+ }
+ GLYPH2PATH_DEBUG() << " cubicTo" << c[1] << c[2] << c[3];
+ path->cubicTo(c[1], c[2], c[3]);
+ c[0] = c[3];
+ n = 1;
+ }
+
+ if (n == 1) {
+ GLYPH2PATH_DEBUG() << " closeSubpath";
+ path->closeSubpath();
+ } else {
+ c[3] = start;
+ if (n == 2) {
+ c[2] = (2*c[1] + c[3])/3;
+ c[1] = (2*c[1] + c[0])/3;
+ }
+ GLYPH2PATH_DEBUG() << " close cubicTo" << c[1] << c[2] << c[3];
+ path->cubicTo(c[1], c[2], c[3]);
+ }
+ ++i;
+ }
+}
+
+extern void qt_addBitmapToPath(qreal x0, qreal y0, const uchar *image_data, int bpl, int w, int h, QPainterPath *path);
+
+void QFreetypeFace::addBitmapToPath(FT_GlyphSlot slot, const QFixedPoint &point, QPainterPath *path)
+{
+ if (slot->format != FT_GLYPH_FORMAT_BITMAP
+ || slot->bitmap.pixel_mode != FT_PIXEL_MODE_MONO)
+ return;
+
+ QPointF cp = point.toPointF();
+ qt_addBitmapToPath(cp.x() + TRUNC(slot->metrics.horiBearingX), cp.y() - TRUNC(slot->metrics.horiBearingY),
+ slot->bitmap.buffer, slot->bitmap.pitch, slot->bitmap.width, slot->bitmap.rows, path);
+}
+
+static inline void convertRGBToARGB(const uchar *src, uint *dst, int width, int height, int src_pitch, bool bgr)
+{
+ const int offs = bgr ? -1 : 1;
+ const int w = width * 3;
+ while (height--) {
+ uint *dd = dst;
+ for (int x = 0; x < w; x += 3) {
+ uchar red = src[x + 1 - offs];
+ uchar green = src[x + 1];
+ uchar blue = src[x + 1 + offs];
+ *dd++ = (0xFFU << 24) | (red << 16) | (green << 8) | blue;
+ }
+ dst += width;
+ src += src_pitch;
+ }
+}
+
+static inline void convertRGBToARGB_V(const uchar *src, uint *dst, int width, int height, int src_pitch, bool bgr)
+{
+ const int offs = bgr ? -src_pitch : src_pitch;
+ while (height--) {
+ for (int x = 0; x < width; x++) {
+ uchar red = src[x + src_pitch - offs];
+ uchar green = src[x + src_pitch];
+ uchar blue = src[x + src_pitch + offs];
+ *dst++ = (0XFFU << 24) | (red << 16) | (green << 8) | blue;
+ }
+ src += 3*src_pitch;
+ }
+}
+
+static QFontEngine::SubpixelAntialiasingType subpixelAntialiasingTypeHint()
+{
+ static int type = -1;
+ if (type == -1) {
+ if (QScreen *screen = QGuiApplication::primaryScreen())
+ type = screen->handle()->subpixelAntialiasingTypeHint();
+ }
+ return static_cast<QFontEngine::SubpixelAntialiasingType>(type);
+}
+
+QFontEngineFT *QFontEngineFT::create(const QFontDef &fontDef, FaceId faceId, const QByteArray &fontData)
+{
+ auto engine = std::make_unique<QFontEngineFT>(fontDef);
+
+ QFontEngineFT::GlyphFormat format = QFontEngineFT::Format_Mono;
+ const bool antialias = !(fontDef.styleStrategy & QFont::NoAntialias);
+
+ if (antialias) {
+ QFontEngine::SubpixelAntialiasingType subpixelType = subpixelAntialiasingTypeHint();
+ if (subpixelType == QFontEngine::Subpixel_None || (fontDef.styleStrategy & QFont::NoSubpixelAntialias)) {
+ format = QFontEngineFT::Format_A8;
+ engine->subpixelType = QFontEngine::Subpixel_None;
+ } else {
+ format = QFontEngineFT::Format_A32;
+ engine->subpixelType = subpixelType;
+ }
+ }
+
+ if (!engine->init(faceId, antialias, format, fontData) || engine->invalid()) {
+ qWarning("QFontEngineFT: Failed to create FreeType font engine");
+ return nullptr;
+ }
+
+ engine->setQtDefaultHintStyle(static_cast<QFont::HintingPreference>(fontDef.hintingPreference));
+ return engine.release();
+}
+
+namespace {
+ class QFontEngineFTRawData: public QFontEngineFT
+ {
+ public:
+ QFontEngineFTRawData(const QFontDef &fontDef) : QFontEngineFT(fontDef)
+ {
+ }
+
+ void updateFamilyNameAndStyle()
+ {
+ fontDef.families = QStringList(QString::fromLatin1(freetype->face->family_name));
+
+ if (freetype->face->style_flags & FT_STYLE_FLAG_ITALIC)
+ fontDef.style = QFont::StyleItalic;
+
+ if (freetype->face->style_flags & FT_STYLE_FLAG_BOLD)
+ fontDef.weight = QFont::Bold;
+ }
+
+ bool initFromData(const QByteArray &fontData, const QMap<QFont::Tag, float> &variableAxisValues)
+ {
+ FaceId faceId;
+ faceId.filename = "";
+ faceId.index = 0;
+ faceId.uuid = QUuid::createUuid().toByteArray();
+ faceId.variableAxes = variableAxisValues;
+
+ return init(faceId, true, Format_None, fontData);
+ }
+ };
+}
+
+QFontEngineFT *QFontEngineFT::create(const QByteArray &fontData,
+ qreal pixelSize,
+ QFont::HintingPreference hintingPreference,
+ const QMap<QFont::Tag, float> &variableAxisValues)
+{
+ QFontDef fontDef;
+ fontDef.pixelSize = pixelSize;
+ fontDef.stretch = QFont::Unstretched;
+ fontDef.hintingPreference = hintingPreference;
+ fontDef.variableAxisValues = variableAxisValues;
+
+ QFontEngineFTRawData *fe = new QFontEngineFTRawData(fontDef);
+ if (!fe->initFromData(fontData, variableAxisValues)) {
+ delete fe;
+ return nullptr;
+ }
+
+ fe->updateFamilyNameAndStyle();
+ fe->setQtDefaultHintStyle(static_cast<QFont::HintingPreference>(fontDef.hintingPreference));
+
+ return fe;
+}
+
+QFontEngineFT::QFontEngineFT(const QFontDef &fd)
+ : QFontEngine(Freetype)
+{
+ fontDef = fd;
+ matrix.xx = 0x10000;
+ matrix.yy = 0x10000;
+ matrix.xy = 0;
+ matrix.yx = 0;
+ cache_cost = 100 * 1024;
+ kerning_pairs_loaded = false;
+ transform = false;
+ embolden = false;
+ obliquen = false;
+ antialias = true;
+ freetype = nullptr;
+ default_load_flags = FT_LOAD_IGNORE_GLOBAL_ADVANCE_WIDTH;
+ default_hint_style = ftInitialDefaultHintStyle;
+ subpixelType = Subpixel_None;
+ lcdFilterType = (int)((quintptr) FT_LCD_FILTER_DEFAULT);
+ defaultFormat = Format_None;
+ embeddedbitmap = false;
+ const QByteArray env = qgetenv("QT_NO_FT_CACHE");
+ cacheEnabled = env.isEmpty() || env.toInt() == 0;
+ m_subPixelPositionCount = 4;
+ forceAutoHint = false;
+ stemDarkeningDriver = false;
+}
+
+QFontEngineFT::~QFontEngineFT()
+{
+ if (freetype)
+ freetype->release(face_id);
+}
+
+bool QFontEngineFT::init(FaceId faceId, bool antialias, GlyphFormat format,
+ const QByteArray &fontData)
+{
+ return init(faceId, antialias, format, QFreetypeFace::getFace(faceId, fontData));
+}
+
+static void dont_delete(void*) {}
+
+static FT_UShort calculateActualWeight(QFreetypeFace *freetypeFace, FT_Face face, QFontEngine::FaceId faceId)
+{
+ FT_MM_Var *var = freetypeFace->mm_var;
+ if (var != nullptr && faceId.instanceIndex >= 0 && FT_UInt(faceId.instanceIndex) < var->num_namedstyles) {
+ for (FT_UInt axis = 0; axis < var->num_axis; ++axis) {
+ if (var->axis[axis].tag == QFont::Tag("wght").value()) {
+ return var->namedstyle[faceId.instanceIndex].coords[axis] >> 16;
+ }
+ }
+ }
+ if (const TT_OS2 *os2 = reinterpret_cast<const TT_OS2 *>(FT_Get_Sfnt_Table(face, ft_sfnt_os2))) {
+ return os2->usWeightClass;
+ }
+
+ return 700;
+}
+
+static bool calculateActualItalic(QFreetypeFace *freetypeFace, FT_Face face, QFontEngine::FaceId faceId)
+{
+ FT_MM_Var *var = freetypeFace->mm_var;
+ if (var != nullptr && faceId.instanceIndex >= 0 && FT_UInt(faceId.instanceIndex) < var->num_namedstyles) {
+ for (FT_UInt axis = 0; axis < var->num_axis; ++axis) {
+ if (var->axis[axis].tag == QFont::Tag("ital").value()) {
+ return (var->namedstyle[faceId.instanceIndex].coords[axis] >> 16) == 1;
+ }
+ }
+ }
+
+ return (face->style_flags & FT_STYLE_FLAG_ITALIC);
+}
+
+bool QFontEngineFT::init(FaceId faceId, bool antialias, GlyphFormat format,
+ QFreetypeFace *freetypeFace)
+{
+ freetype = freetypeFace;
+ if (!freetype) {
+ xsize = 0;
+ ysize = 0;
+ return false;
+ }
+ defaultFormat = format;
+ this->antialias = antialias;
+
+ if (!antialias)
+ glyphFormat = QFontEngine::Format_Mono;
+ else
+ glyphFormat = defaultFormat;
+
+ face_id = faceId;
+
+ symbol = freetype->symbol_map != nullptr;
+ PS_FontInfoRec psrec;
+ // don't assume that type1 fonts are symbol fonts by default
+ if (FT_Get_PS_Font_Info(freetype->face, &psrec) == FT_Err_Ok) {
+ symbol = !fontDef.families.isEmpty() && bool(fontDef.families.constFirst().contains("symbol"_L1, Qt::CaseInsensitive));
+ }
+
+ freetype->computeSize(fontDef, &xsize, &ysize, &defaultGlyphSet.outline_drawing, &scalableBitmapScaleFactor);
+
+ FT_Face face = lockFace();
+
+ if (FT_IS_SCALABLE(face)) {
+ bool isItalic = calculateActualItalic(freetype, face, faceId);
+ bool fake_oblique = (fontDef.style != QFont::StyleNormal) && !isItalic && !qEnvironmentVariableIsSet("QT_NO_SYNTHESIZED_ITALIC");
+ if (fake_oblique)
+ obliquen = true;
+ FT_Set_Transform(face, &matrix, nullptr);
+ freetype->matrix = matrix;
+ // fake bold
+ if ((fontDef.weight >= QFont::Bold) && !(face->style_flags & FT_STYLE_FLAG_BOLD) && !FT_IS_FIXED_WIDTH(face) && !qEnvironmentVariableIsSet("QT_NO_SYNTHESIZED_BOLD")) {
+ FT_UShort actualWeight = calculateActualWeight(freetype, face, faceId);
+ if (actualWeight < 700 &&
+ (fontDef.pixelSize < 64 || qEnvironmentVariableIsSet("QT_NO_SYNTHESIZED_BOLD_LIMIT"))) {
+ embolden = true;
+ }
+ }
+ // underline metrics
+ line_thickness = QFixed::fromFixed(FT_MulFix(face->underline_thickness, face->size->metrics.y_scale));
+ QFixed center_position = QFixed::fromFixed(-FT_MulFix(face->underline_position, face->size->metrics.y_scale));
+ underline_position = center_position - line_thickness / 2;
+ } else {
+ // ad hoc algorithm
+ int score = fontDef.weight * fontDef.pixelSize;
+ line_thickness = score / 7000;
+ // looks better with thicker line for small pointsizes
+ if (line_thickness < 2 && score >= 1050)
+ line_thickness = 2;
+ underline_position = ((line_thickness * 2) + 3) / 6;
+
+ cacheEnabled = false;
+ if (isScalableBitmap())
+ glyphFormat = defaultFormat = GlyphFormat::Format_ARGB;
+ }
+ if (line_thickness < 1)
+ line_thickness = 1;
+
+ metrics = face->size->metrics;
+
+ /*
+ TrueType fonts with embedded bitmaps may have a bitmap font specific
+ ascent/descent in the EBLC table. There is no direct public API
+ to extract those values. The only way we've found is to trick freetype
+ into thinking that it's not a scalable font in FT_Select_Size so that
+ the metrics are retrieved from the bitmap strikes.
+ */
+ if (FT_IS_SCALABLE(face)) {
+ for (int i = 0; i < face->num_fixed_sizes; ++i) {
+ if (xsize == face->available_sizes[i].x_ppem && ysize == face->available_sizes[i].y_ppem) {
+ face->face_flags &= ~FT_FACE_FLAG_SCALABLE;
+
+ FT_Select_Size(face, i);
+ if (face->size->metrics.ascender + face->size->metrics.descender > 0) {
+ FT_Pos leading = metrics.height - metrics.ascender + metrics.descender;
+ metrics.ascender = face->size->metrics.ascender;
+ metrics.descender = face->size->metrics.descender;
+ if (metrics.descender > 0
+ && QString::fromUtf8(face->family_name) == "Courier New"_L1) {
+ metrics.descender *= -1;
+ }
+ metrics.height = metrics.ascender - metrics.descender + leading;
+ }
+ FT_Set_Char_Size(face, xsize, ysize, 0, 0);
+
+ face->face_flags |= FT_FACE_FLAG_SCALABLE;
+ break;
+ }
+ }
+ }
+#if defined(FT_FONT_FORMATS_H)
+ const char *fmt = FT_Get_Font_Format(face);
+ if (fmt && qstrncmp(fmt, "CFF", 4) == 0) {
+ FT_Bool no_stem_darkening = true;
+ FT_Error err = FT_Property_Get(qt_getFreetype(), "cff", "no-stem-darkening", &no_stem_darkening);
+ if (err == FT_Err_Ok)
+ stemDarkeningDriver = !no_stem_darkening;
+ else
+ stemDarkeningDriver = false;
+ }
+#endif
+
+ fontDef.styleName = QString::fromUtf8(face->style_name);
+
+ if (!freetype->hbFace) {
+ faceData.user_data = face;
+ faceData.get_font_table = ft_getSfntTable;
+ (void)harfbuzzFace(); // populates face_
+ freetype->hbFace = std::move(face_);
+ } else {
+ Q_ASSERT(!face_);
+ }
+ // we share the HB face in QFreeTypeFace, so do not let ~QFontEngine() destroy it
+ face_ = Holder(freetype->hbFace.get(), dont_delete);
+
+ unlockFace();
+
+ fsType = freetype->fsType();
+ return true;
+}
+
+void QFontEngineFT::setQtDefaultHintStyle(QFont::HintingPreference hintingPreference)
+{
+ switch (hintingPreference) {
+ case QFont::PreferNoHinting:
+ setDefaultHintStyle(HintNone);
+ break;
+ case QFont::PreferFullHinting:
+ setDefaultHintStyle(HintFull);
+ break;
+ case QFont::PreferVerticalHinting:
+ setDefaultHintStyle(HintLight);
+ break;
+ case QFont::PreferDefaultHinting:
+ setDefaultHintStyle(ftInitialDefaultHintStyle);
+ break;
+ }
+}
+
+void QFontEngineFT::setDefaultHintStyle(HintStyle style)
+{
+ default_hint_style = style;
+}
+
+bool QFontEngineFT::expectsGammaCorrectedBlending() const
+{
+ return stemDarkeningDriver;
+}
+
+int QFontEngineFT::loadFlags(QGlyphSet *set, GlyphFormat format, int flags,
+ bool &hsubpixel, int &vfactor) const
+{
+ int load_flags = FT_LOAD_DEFAULT | default_load_flags;
+ int load_target = default_hint_style == HintLight
+ ? FT_LOAD_TARGET_LIGHT
+ : FT_LOAD_TARGET_NORMAL;
+
+ if (format == Format_Mono) {
+ load_target = FT_LOAD_TARGET_MONO;
+ } else if (format == Format_A32) {
+ if (subpixelType == Subpixel_RGB || subpixelType == Subpixel_BGR)
+ hsubpixel = true;
+ else if (subpixelType == Subpixel_VRGB || subpixelType == Subpixel_VBGR)
+ vfactor = 3;
+ } else if (format == Format_ARGB) {
+#ifdef FT_LOAD_COLOR
+ load_flags |= FT_LOAD_COLOR;
+#endif
+ }
+
+ if (set && set->outline_drawing)
+ load_flags |= FT_LOAD_NO_BITMAP;
+
+ if (default_hint_style == HintNone || (flags & DesignMetrics) || (set && set->outline_drawing))
+ load_flags |= FT_LOAD_NO_HINTING;
+ else
+ load_flags |= load_target;
+
+ if (forceAutoHint)
+ load_flags |= FT_LOAD_FORCE_AUTOHINT;
+
+ return load_flags;
+}
+
+static inline bool areMetricsTooLarge(const QFontEngineFT::GlyphInfo &info)
+{
+ // false if exceeds QFontEngineFT::Glyph metrics
+ return info.width > 0xFF || info.height > 0xFF || info.linearAdvance > 0x7FFF;
+}
+
+static inline void transformBoundingBox(int *left, int *top, int *right, int *bottom, FT_Matrix *matrix)
+{
+ int l, r, t, b;
+ FT_Vector vector;
+ vector.x = *left;
+ vector.y = *top;
+ FT_Vector_Transform(&vector, matrix);
+ l = r = vector.x;
+ t = b = vector.y;
+ vector.x = *right;
+ vector.y = *top;
+ FT_Vector_Transform(&vector, matrix);
+ if (l > vector.x) l = vector.x;
+ if (r < vector.x) r = vector.x;
+ if (t < vector.y) t = vector.y;
+ if (b > vector.y) b = vector.y;
+ vector.x = *right;
+ vector.y = *bottom;
+ FT_Vector_Transform(&vector, matrix);
+ if (l > vector.x) l = vector.x;
+ if (r < vector.x) r = vector.x;
+ if (t < vector.y) t = vector.y;
+ if (b > vector.y) b = vector.y;
+ vector.x = *left;
+ vector.y = *bottom;
+ FT_Vector_Transform(&vector, matrix);
+ if (l > vector.x) l = vector.x;
+ if (r < vector.x) r = vector.x;
+ if (t < vector.y) t = vector.y;
+ if (b > vector.y) b = vector.y;
+ *left = l;
+ *right = r;
+ *top = t;
+ *bottom = b;
+}
+
+QFontEngineFT::Glyph *QFontEngineFT::loadGlyph(QGlyphSet *set, uint glyph,
+ const QFixedPoint &subPixelPosition,
+ GlyphFormat format,
+ bool fetchMetricsOnly,
+ bool disableOutlineDrawing) const
+{
+// Q_ASSERT(freetype->lock == 1);
+
+ if (format == Format_None)
+ format = defaultFormat != Format_None ? defaultFormat : Format_Mono;
+ Q_ASSERT(format != Format_None);
+
+ Glyph *g = set ? set->getGlyph(glyph, subPixelPosition) : nullptr;
+ if (g && g->format == format && (fetchMetricsOnly || g->data))
+ return g;
+
+ if (!g && set && set->isGlyphMissing(glyph))
+ return &emptyGlyph;
+
+
+ FT_Face face = freetype->face;
+
+ FT_Matrix matrix = freetype->matrix;
+
+ FT_Vector v;
+ v.x = format == Format_Mono ? 0 : FT_Pos(subPixelPosition.x.value());
+ v.y = format == Format_Mono ? 0 : FT_Pos(-subPixelPosition.y.value());
+ FT_Set_Transform(face, &matrix, &v);
+
+ bool hsubpixel = false;
+ int vfactor = 1;
+ int load_flags = loadFlags(set, format, 0, hsubpixel, vfactor);
+
+ bool transform = matrix.xx != 0x10000
+ || matrix.yy != 0x10000
+ || matrix.xy != 0
+ || matrix.yx != 0;
+
+ if (transform || obliquen || (format != Format_Mono && !isScalableBitmap()))
+ load_flags |= FT_LOAD_NO_BITMAP;
+
+ FT_Error err = FT_Load_Glyph(face, glyph, load_flags);
+ if (err && (load_flags & FT_LOAD_NO_BITMAP)) {
+ load_flags &= ~FT_LOAD_NO_BITMAP;
+ err = FT_Load_Glyph(face, glyph, load_flags);
+ }
+ if (err == FT_Err_Too_Few_Arguments) {
+ // this is an error in the bytecode interpreter, just try to run without it
+ load_flags |= FT_LOAD_FORCE_AUTOHINT;
+ err = FT_Load_Glyph(face, glyph, load_flags);
+ } else if (err == FT_Err_Execution_Too_Long) {
+ // This is an error in the bytecode, probably a web font made by someone who
+ // didn't test bytecode hinting at all so disable for it for all glyphs.
+ qWarning("load glyph failed due to broken hinting bytecode in font, switching to auto hinting");
+ default_load_flags |= FT_LOAD_FORCE_AUTOHINT;
+ load_flags |= FT_LOAD_FORCE_AUTOHINT;
+ err = FT_Load_Glyph(face, glyph, load_flags);
+ }
+ if (err != FT_Err_Ok) {
+ qWarning("load glyph failed err=%x face=%p, glyph=%d", err, face, glyph);
+ if (set)
+ set->setGlyphMissing(glyph);
+ return &emptyGlyph;
+ }
+
+ FT_GlyphSlot slot = face->glyph;
+
+ if (embolden)
+ FT_GlyphSlot_Embolden(slot);
+ if (obliquen) {
+ FT_GlyphSlot_Oblique(slot);
+
+ // While Embolden alters the metrics of the slot, oblique does not, so we need
+ // to fix this ourselves.
+ transform = true;
+ FT_Matrix m;
+ m.xx = 0x10000;
+ m.yx = 0x0;
+ m.xy = 0x6000;
+ m.yy = 0x10000;
+
+ FT_Matrix_Multiply(&m, &matrix);
+ }
+
+ GlyphInfo info;
+ info.linearAdvance = slot->linearHoriAdvance >> 10;
+ info.xOff = TRUNC(ROUND(slot->advance.x));
+ info.yOff = 0;
+
+ if ((set && set->outline_drawing && !disableOutlineDrawing) || fetchMetricsOnly) {
+ int left = slot->metrics.horiBearingX;
+ int right = slot->metrics.horiBearingX + slot->metrics.width;
+ int top = slot->metrics.horiBearingY;
+ int bottom = slot->metrics.horiBearingY - slot->metrics.height;
+
+ if (transform && slot->format != FT_GLYPH_FORMAT_BITMAP)
+ transformBoundingBox(&left, &top, &right, &bottom, &matrix);
+
+ left = FLOOR(left);
+ right = CEIL(right);
+ bottom = FLOOR(bottom);
+ top = CEIL(top);
+
+ info.x = TRUNC(left);
+ info.y = TRUNC(top);
+ info.width = TRUNC(right - left);
+ info.height = TRUNC(top - bottom);
+
+ // If any of the metrics are too large to fit, don't cache them
+ // Also, avoid integer overflow when linearAdvance is to large to fit in a signed short
+ if (areMetricsTooLarge(info))
+ return nullptr;
+
+ g = new Glyph;
+ g->data = nullptr;
+ g->linearAdvance = info.linearAdvance;
+ g->width = info.width;
+ g->height = info.height;
+ g->x = info.x;
+ g->y = info.y;
+ g->advance = info.xOff;
+ g->format = format;
+
+ if (set)
+ set->setGlyph(glyph, subPixelPosition, g);
+
+ return g;
+ }
+
+ int glyph_buffer_size = 0;
+ std::unique_ptr<uchar[]> glyph_buffer;
+ FT_Render_Mode renderMode = (default_hint_style == HintLight) ? FT_RENDER_MODE_LIGHT : FT_RENDER_MODE_NORMAL;
+ switch (format) {
+ case Format_Mono:
+ renderMode = FT_RENDER_MODE_MONO;
+ break;
+ case Format_A32:
+ if (!hsubpixel && vfactor == 1) {
+ qWarning("Format_A32 requested, but subpixel layout is unknown.");
+ return nullptr;
+ }
+
+ renderMode = hsubpixel ? FT_RENDER_MODE_LCD : FT_RENDER_MODE_LCD_V;
+ break;
+ case Format_A8:
+ case Format_ARGB:
+ break;
+ default:
+ Q_UNREACHABLE();
+ }
+ FT_Library_SetLcdFilter(slot->library, (FT_LcdFilter)lcdFilterType);
+
+ err = FT_Render_Glyph(slot, renderMode);
+ if (err != FT_Err_Ok)
+ qWarning("render glyph failed err=%x face=%p, glyph=%d", err, face, glyph);
+
+ FT_Library_SetLcdFilter(slot->library, FT_LCD_FILTER_NONE);
+
+ info.height = slot->bitmap.rows;
+ info.width = slot->bitmap.width;
+ info.x = slot->bitmap_left;
+ info.y = slot->bitmap_top;
+ if (slot->bitmap.pixel_mode == FT_PIXEL_MODE_LCD)
+ info.width = info.width / 3;
+ if (slot->bitmap.pixel_mode == FT_PIXEL_MODE_LCD_V)
+ info.height = info.height / vfactor;
+
+ int pitch = (format == Format_Mono ? ((info.width + 31) & ~31) >> 3 :
+ (format == Format_A8 ? (info.width + 3) & ~3 : info.width * 4));
+
+ glyph_buffer_size = info.height * pitch;
+ glyph_buffer.reset(new uchar[glyph_buffer_size]);
+
+ if (slot->bitmap.pixel_mode == FT_PIXEL_MODE_MONO) {
+ uchar *src = slot->bitmap.buffer;
+ uchar *dst = glyph_buffer.get();
+ int h = slot->bitmap.rows;
+ // Some fonts return bitmaps even when we requested something else:
+ if (format == Format_Mono) {
+ int bytes = ((info.width + 7) & ~7) >> 3;
+ while (h--) {
+ memcpy (dst, src, bytes);
+ dst += pitch;
+ src += slot->bitmap.pitch;
+ }
+ } else if (format == Format_A8) {
+ while (h--) {
+ for (int x = 0; x < int{info.width}; x++)
+ dst[x] = ((src[x >> 3] & (0x80 >> (x & 7))) ? 0xff : 0x00);
+ dst += pitch;
+ src += slot->bitmap.pitch;
+ }
+ } else {
+ while (h--) {
+ uint *dd = reinterpret_cast<uint *>(dst);
+ for (int x = 0; x < int{info.width}; x++)
+ dd[x] = ((src[x >> 3] & (0x80 >> (x & 7))) ? 0xffffffff : 0x00000000);
+ dst += pitch;
+ src += slot->bitmap.pitch;
+ }
+ }
+ } else if (slot->bitmap.pixel_mode == 7 /*FT_PIXEL_MODE_BGRA*/) {
+ Q_ASSERT(format == Format_ARGB);
+ uchar *src = slot->bitmap.buffer;
+ uchar *dst = glyph_buffer.get();
+ int h = slot->bitmap.rows;
+ while (h--) {
+#if Q_BYTE_ORDER == Q_BIG_ENDIAN
+ const quint32 *srcPixel = (const quint32 *)src;
+ quint32 *dstPixel = (quint32 *)dst;
+ for (int x = 0; x < static_cast<int>(slot->bitmap.width); x++, srcPixel++, dstPixel++) {
+ const quint32 pixel = *srcPixel;
+ *dstPixel = qbswap(pixel);
+ }
+#else
+ memcpy(dst, src, slot->bitmap.width * 4);
+#endif
+ dst += slot->bitmap.pitch;
+ src += slot->bitmap.pitch;
+ }
+ info.linearAdvance = info.xOff = slot->bitmap.width;
+ } else if (slot->bitmap.pixel_mode == FT_PIXEL_MODE_GRAY) {
+ Q_ASSERT(format == Format_A8);
+ uchar *src = slot->bitmap.buffer;
+ uchar *dst = glyph_buffer.get();
+ int h = slot->bitmap.rows;
+ int bytes = info.width;
+ while (h--) {
+ memcpy (dst, src, bytes);
+ dst += pitch;
+ src += slot->bitmap.pitch;
+ }
+ } else if (slot->bitmap.pixel_mode == FT_PIXEL_MODE_LCD) {
+ Q_ASSERT(format == Format_A32);
+ convertRGBToARGB(slot->bitmap.buffer, (uint *)glyph_buffer.get(), info.width, info.height, slot->bitmap.pitch, subpixelType != Subpixel_RGB);
+ } else if (slot->bitmap.pixel_mode == FT_PIXEL_MODE_LCD_V) {
+ Q_ASSERT(format == Format_A32);
+ convertRGBToARGB_V(slot->bitmap.buffer, (uint *)glyph_buffer.get(), info.width, info.height, slot->bitmap.pitch, subpixelType != Subpixel_VRGB);
+ } else {
+ qWarning("QFontEngine: Glyph rendered in unknown pixel_mode=%d", slot->bitmap.pixel_mode);
+ return nullptr;
+ }
+
+ if (!g) {
+ g = new Glyph;
+ g->data = nullptr;
+ }
+
+ g->linearAdvance = info.linearAdvance;
+ g->width = info.width;
+ g->height = info.height;
+ g->x = info.x;
+ g->y = info.y;
+ g->advance = info.xOff;
+ g->format = format;
+ delete [] g->data;
+ g->data = glyph_buffer.release();
+
+ if (set)
+ set->setGlyph(glyph, subPixelPosition, g);
+
+ return g;
+}
+
+QFontEngine::FaceId QFontEngineFT::faceId() const
+{
+ return face_id;
+}
+
+QFontEngine::Properties QFontEngineFT::properties() const
+{
+ Properties p = freetype->properties();
+ if (p.postscriptName.isEmpty()) {
+ p.postscriptName = QFontEngine::convertToPostscriptFontFamilyName(fontDef.families.constFirst().toUtf8());
+ }
+
+ return freetype->properties();
+}
+
+QFixed QFontEngineFT::emSquareSize() const
+{
+ if (FT_IS_SCALABLE(freetype->face))
+ return freetype->face->units_per_EM;
+ else
+ return freetype->face->size->metrics.y_ppem;
+}
+
+bool QFontEngineFT::getSfntTableData(uint tag, uchar *buffer, uint *length) const
+{
+ return ft_getSfntTable(freetype->face, tag, buffer, length);
+}
+
+int QFontEngineFT::synthesized() const
+{
+ int s = 0;
+ if ((fontDef.style != QFont::StyleNormal) && !(freetype->face->style_flags & FT_STYLE_FLAG_ITALIC))
+ s = SynthesizedItalic;
+ if ((fontDef.weight >= QFont::Bold) && !(freetype->face->style_flags & FT_STYLE_FLAG_BOLD))
+ s |= SynthesizedBold;
+ if (fontDef.stretch != 100 && FT_IS_SCALABLE(freetype->face))
+ s |= SynthesizedStretch;
+ return s;
+}
+
+void QFontEngineFT::initializeHeightMetrics() const
+{
+ m_ascent = QFixed::fromFixed(metrics.ascender);
+ m_descent = QFixed::fromFixed(-metrics.descender);
+ m_leading = QFixed::fromFixed(metrics.height - metrics.ascender + metrics.descender);
+
+ QFontEngine::initializeHeightMetrics();
+
+ if (scalableBitmapScaleFactor != 1) {
+ m_ascent *= scalableBitmapScaleFactor;
+ m_descent *= scalableBitmapScaleFactor;
+ m_leading *= scalableBitmapScaleFactor;
+ }
+}
+
+QFixed QFontEngineFT::capHeight() const
+{
+ TT_OS2 *os2 = (TT_OS2 *)FT_Get_Sfnt_Table(freetype->face, ft_sfnt_os2);
+ if (os2 && os2->version >= 2) {
+ lockFace();
+ QFixed answer = QFixed::fromFixed(FT_MulFix(os2->sCapHeight, freetype->face->size->metrics.y_scale));
+ unlockFace();
+ return answer;
+ }
+ return calculatedCapHeight();
+}
+
+QFixed QFontEngineFT::xHeight() const
+{
+ TT_OS2 *os2 = (TT_OS2 *)FT_Get_Sfnt_Table(freetype->face, ft_sfnt_os2);
+ if (os2 && os2->sxHeight) {
+ lockFace();
+ QFixed answer = QFixed(os2->sxHeight * freetype->face->size->metrics.y_ppem) / emSquareSize();
+ unlockFace();
+ return answer;
+ }
+
+ return QFontEngine::xHeight();
+}
+
+QFixed QFontEngineFT::averageCharWidth() const
+{
+ TT_OS2 *os2 = (TT_OS2 *)FT_Get_Sfnt_Table(freetype->face, ft_sfnt_os2);
+ if (os2 && os2->xAvgCharWidth) {
+ lockFace();
+ QFixed answer = QFixed(os2->xAvgCharWidth * freetype->face->size->metrics.x_ppem) / emSquareSize();
+ unlockFace();
+ return answer;
+ }
+
+ return QFontEngine::averageCharWidth();
+}
+
+qreal QFontEngineFT::maxCharWidth() const
+{
+ QFixed max_advance = QFixed::fromFixed(metrics.max_advance);
+ if (scalableBitmapScaleFactor != 1)
+ max_advance *= scalableBitmapScaleFactor;
+ return max_advance.toReal();
+}
+
+QFixed QFontEngineFT::lineThickness() const
+{
+ return line_thickness;
+}
+
+QFixed QFontEngineFT::underlinePosition() const
+{
+ return underline_position;
+}
+
+void QFontEngineFT::doKerning(QGlyphLayout *g, QFontEngine::ShaperFlags flags) const
+{
+ if (!kerning_pairs_loaded) {
+ kerning_pairs_loaded = true;
+ lockFace();
+ if (freetype->face->size->metrics.x_ppem != 0) {
+ QFixed scalingFactor = emSquareSize() / QFixed(freetype->face->size->metrics.x_ppem);
+ unlockFace();
+ const_cast<QFontEngineFT *>(this)->loadKerningPairs(scalingFactor);
+ } else {
+ unlockFace();
+ }
+ }
+
+ if (shouldUseDesignMetrics(flags))
+ flags |= DesignMetrics;
+ else
+ flags &= ~DesignMetrics;
+
+ QFontEngine::doKerning(g, flags);
+}
+
+static inline FT_Matrix QTransformToFTMatrix(const QTransform &matrix)
+{
+ FT_Matrix m;
+
+ m.xx = FT_Fixed(matrix.m11() * 65536);
+ m.xy = FT_Fixed(-matrix.m21() * 65536);
+ m.yx = FT_Fixed(-matrix.m12() * 65536);
+ m.yy = FT_Fixed(matrix.m22() * 65536);
+
+ return m;
+}
+
+QFontEngineFT::QGlyphSet *QFontEngineFT::TransformedGlyphSets::findSet(const QTransform &matrix, const QFontDef &fontDef)
+{
+ FT_Matrix m = QTransformToFTMatrix(matrix);
+
+ int i = 0;
+ for (; i < nSets; ++i) {
+ QGlyphSet *g = sets[i];
+ if (!g)
+ break;
+ if (g->transformationMatrix.xx == m.xx
+ && g->transformationMatrix.xy == m.xy
+ && g->transformationMatrix.yx == m.yx
+ && g->transformationMatrix.yy == m.yy) {
+
+ // found a match, move it to the front
+ moveToFront(i);
+ return g;
+ }
+ }
+
+ // don't cache more than nSets transformations
+ if (i == nSets)
+ // reuse the last set
+ --i;
+ moveToFront(nSets - 1);
+ if (!sets[0])
+ sets[0] = new QGlyphSet;
+ QGlyphSet *gs = sets[0];
+ gs->clear();
+ gs->transformationMatrix = m;
+ gs->outline_drawing = fontDef.pixelSize * fontDef.pixelSize * qAbs(matrix.determinant()) > QT_MAX_CACHED_GLYPH_SIZE * QT_MAX_CACHED_GLYPH_SIZE;
+ Q_ASSERT(gs != nullptr);
+
+ return gs;
+}
+
+void QFontEngineFT::TransformedGlyphSets::moveToFront(int i)
+{
+ QGlyphSet *g = sets[i];
+ while (i > 0) {
+ sets[i] = sets[i - 1];
+ --i;
+ }
+ sets[0] = g;
+}
+
+
+QFontEngineFT::QGlyphSet *QFontEngineFT::loadGlyphSet(const QTransform &matrix)
+{
+ if (matrix.type() > QTransform::TxShear || !cacheEnabled)
+ return nullptr;
+
+ // FT_Set_Transform only supports scalable fonts
+ if (!FT_IS_SCALABLE(freetype->face))
+ return matrix.type() <= QTransform::TxTranslate ? &defaultGlyphSet : nullptr;
+
+ return transformedGlyphSets.findSet(matrix, fontDef);
+}
+
+void QFontEngineFT::getUnscaledGlyph(glyph_t glyph, QPainterPath *path, glyph_metrics_t *metrics)
+{
+ FT_Face face = lockFace(Unscaled);
+ FT_Set_Transform(face, nullptr, nullptr);
+ FT_Load_Glyph(face, glyph, FT_LOAD_NO_BITMAP);
+
+ int left = face->glyph->metrics.horiBearingX;
+ int right = face->glyph->metrics.horiBearingX + face->glyph->metrics.width;
+ int top = face->glyph->metrics.horiBearingY;
+ int bottom = face->glyph->metrics.horiBearingY - face->glyph->metrics.height;
+
+ QFixedPoint p;
+ p.x = 0;
+ p.y = 0;
+
+ metrics->width = QFixed::fromFixed(right-left);
+ metrics->height = QFixed::fromFixed(top-bottom);
+ metrics->x = QFixed::fromFixed(left);
+ metrics->y = QFixed::fromFixed(-top);
+ metrics->xoff = QFixed::fromFixed(face->glyph->advance.x);
+
+ if (!FT_IS_SCALABLE(freetype->face))
+ QFreetypeFace::addBitmapToPath(face->glyph, p, path);
+ else
+ QFreetypeFace::addGlyphToPath(face, face->glyph, p, path, face->units_per_EM << 6, face->units_per_EM << 6);
+
+ FT_Set_Transform(face, &freetype->matrix, nullptr);
+ unlockFace();
+}
+
+bool QFontEngineFT::supportsTransformation(const QTransform &transform) const
+{
+ return transform.type() <= QTransform::TxRotate && (freetype->isScalable() || freetype->isScalableBitmap());
+}
+
+void QFontEngineFT::addOutlineToPath(qreal x, qreal y, const QGlyphLayout &glyphs, QPainterPath *path, QTextItem::RenderFlags flags)
+{
+ if (!glyphs.numGlyphs)
+ return;
+
+ if (FT_IS_SCALABLE(freetype->face)) {
+ QFontEngine::addOutlineToPath(x, y, glyphs, path, flags);
+ } else {
+ QVarLengthArray<QFixedPoint> positions;
+ QVarLengthArray<glyph_t> positioned_glyphs;
+ QTransform matrix;
+ matrix.translate(x, y);
+ getGlyphPositions(glyphs, matrix, flags, positioned_glyphs, positions);
+
+ FT_Face face = lockFace(Unscaled);
+ for (int gl = 0; gl < glyphs.numGlyphs; gl++) {
+ FT_UInt glyph = positioned_glyphs[gl];
+ FT_Load_Glyph(face, glyph, FT_LOAD_TARGET_MONO);
+ QFreetypeFace::addBitmapToPath(face->glyph, positions[gl], path);
+ }
+ unlockFace();
+ }
+}
+
+void QFontEngineFT::addGlyphsToPath(glyph_t *glyphs, QFixedPoint *positions, int numGlyphs,
+ QPainterPath *path, QTextItem::RenderFlags)
+{
+ FT_Face face = lockFace(Unscaled);
+
+ for (int gl = 0; gl < numGlyphs; gl++) {
+ FT_UInt glyph = glyphs[gl];
+
+ FT_Load_Glyph(face, glyph, FT_LOAD_NO_BITMAP);
+
+ FT_GlyphSlot g = face->glyph;
+ if (g->format != FT_GLYPH_FORMAT_OUTLINE)
+ continue;
+ if (embolden)
+ FT_GlyphSlot_Embolden(g);
+ if (obliquen)
+ FT_GlyphSlot_Oblique(g);
+ QFreetypeFace::addGlyphToPath(face, g, positions[gl], path, xsize, ysize);
+ }
+ unlockFace();
+}
+
+glyph_t QFontEngineFT::glyphIndex(uint ucs4) const
+{
+ glyph_t glyph = ucs4 < QFreetypeFace::cmapCacheSize ? freetype->cmapCache[ucs4] : 0;
+ if (glyph == 0) {
+ FT_Face face = freetype->face;
+ glyph = FT_Get_Char_Index(face, ucs4);
+ if (glyph == 0) {
+ // Certain fonts don't have no-break space and tab,
+ // while we usually want to render them as space
+ if (ucs4 == QChar::Nbsp || ucs4 == QChar::Tabulation) {
+ glyph = FT_Get_Char_Index(face, QChar::Space);
+ } else if (freetype->symbol_map) {
+ // Symbol fonts can have more than one CMAPs, FreeType should take the
+ // correct one for us by default, so we always try FT_Get_Char_Index
+ // first. If it didn't work (returns 0), we will explicitly set the
+ // CMAP to symbol font one and try again. symbol_map is not always the
+ // correct one because in certain fonts like Wingdings symbol_map only
+ // contains PUA codepoints instead of the common ones.
+ FT_Set_Charmap(face, freetype->symbol_map);
+ glyph = FT_Get_Char_Index(face, ucs4);
+ FT_Set_Charmap(face, freetype->unicode_map);
+ if (!glyph && symbol && ucs4 < 0x100)
+ glyph = FT_Get_Char_Index(face, ucs4 + 0xf000);
+ }
+ }
+ if (ucs4 < QFreetypeFace::cmapCacheSize)
+ freetype->cmapCache[ucs4] = glyph;
+ }
+
+ return glyph;
+}
+
+int QFontEngineFT::stringToCMap(const QChar *str, int len, QGlyphLayout *glyphs, int *nglyphs,
+ QFontEngine::ShaperFlags flags) const
+{
+ Q_ASSERT(glyphs->numGlyphs >= *nglyphs);
+ if (*nglyphs < len) {
+ *nglyphs = len;
+ return -1;
+ }
+
+ int mappedGlyphs = 0;
+ int glyph_pos = 0;
+ if (freetype->symbol_map) {
+ FT_Face face = freetype->face;
+ QStringIterator it(str, str + len);
+ while (it.hasNext()) {
+ uint uc = it.next();
+ glyphs->glyphs[glyph_pos] = uc < QFreetypeFace::cmapCacheSize ? freetype->cmapCache[uc] : 0;
+ if ( !glyphs->glyphs[glyph_pos] ) {
+ // Symbol fonts can have more than one CMAPs, FreeType should take the
+ // correct one for us by default, so we always try FT_Get_Char_Index
+ // first. If it didn't work (returns 0), we will explicitly set the
+ // CMAP to symbol font one and try again. symbol_map is not always the
+ // correct one because in certain fonts like Wingdings symbol_map only
+ // contains PUA codepoints instead of the common ones.
+ glyph_t glyph = FT_Get_Char_Index(face, uc);
+ // Certain symbol fonts don't have no-break space (0xa0) and tab (0x9),
+ // while we usually want to render them as space
+ if (!glyph && (uc == 0xa0 || uc == 0x9)) {
+ uc = 0x20;
+ glyph = FT_Get_Char_Index(face, uc);
+ }
+ if (!glyph) {
+ FT_Set_Charmap(face, freetype->symbol_map);
+ glyph = FT_Get_Char_Index(face, uc);
+ FT_Set_Charmap(face, freetype->unicode_map);
+ if (!glyph && symbol && uc < 0x100)
+ glyph = FT_Get_Char_Index(face, uc + 0xf000);
+ }
+ glyphs->glyphs[glyph_pos] = glyph;
+ if (uc < QFreetypeFace::cmapCacheSize)
+ freetype->cmapCache[uc] = glyph;
+ }
+ if (glyphs->glyphs[glyph_pos] || isIgnorableChar(uc))
+ mappedGlyphs++;
+ ++glyph_pos;
+ }
+ } else {
+ FT_Face face = freetype->face;
+ QStringIterator it(str, str + len);
+ while (it.hasNext()) {
+ uint uc = it.next();
+ glyphs->glyphs[glyph_pos] = uc < QFreetypeFace::cmapCacheSize ? freetype->cmapCache[uc] : 0;
+ if (!glyphs->glyphs[glyph_pos]) {
+ {
+ redo:
+ glyph_t glyph = FT_Get_Char_Index(face, uc);
+ if (!glyph && (uc == 0xa0 || uc == 0x9)) {
+ uc = 0x20;
+ goto redo;
+ }
+ glyphs->glyphs[glyph_pos] = glyph;
+ if (uc < QFreetypeFace::cmapCacheSize)
+ freetype->cmapCache[uc] = glyph;
+ }
+ }
+ if (glyphs->glyphs[glyph_pos] || isIgnorableChar(uc))
+ mappedGlyphs++;
+ ++glyph_pos;
+ }
+ }
+
+ *nglyphs = glyph_pos;
+ glyphs->numGlyphs = glyph_pos;
+
+ if (!(flags & GlyphIndicesOnly))
+ recalcAdvances(glyphs, flags);
+
+ return mappedGlyphs;
+}
+
+bool QFontEngineFT::shouldUseDesignMetrics(QFontEngine::ShaperFlags flags) const
+{
+ if (!FT_IS_SCALABLE(freetype->face))
+ return false;
+
+ return default_hint_style == HintNone || default_hint_style == HintLight || (flags & DesignMetrics);
+}
+
+QFixed QFontEngineFT::scaledBitmapMetrics(QFixed m) const
+{
+ return m * scalableBitmapScaleFactor;
+}
+
+glyph_metrics_t QFontEngineFT::scaledBitmapMetrics(const glyph_metrics_t &m, const QTransform &t) const
+{
+ QTransform trans;
+ trans.setMatrix(t.m11(), t.m12(), t.m13(),
+ t.m21(), t.m22(), t.m23(),
+ 0, 0, t.m33());
+ const qreal scaleFactor = scalableBitmapScaleFactor.toReal();
+ trans.scale(scaleFactor, scaleFactor);
+
+ QRectF rect(m.x.toReal(), m.y.toReal(), m.width.toReal(), m.height.toReal());
+ QPointF offset(m.xoff.toReal(), m.yoff.toReal());
+
+ rect = trans.mapRect(rect);
+ offset = trans.map(offset);
+
+ glyph_metrics_t metrics;
+ metrics.x = QFixed::fromReal(rect.x());
+ metrics.y = QFixed::fromReal(rect.y());
+ metrics.width = QFixed::fromReal(rect.width());
+ metrics.height = QFixed::fromReal(rect.height());
+ metrics.xoff = QFixed::fromReal(offset.x());
+ metrics.yoff = QFixed::fromReal(offset.y());
+ return metrics;
+}
+
+void QFontEngineFT::recalcAdvances(QGlyphLayout *glyphs, QFontEngine::ShaperFlags flags) const
+{
+ FT_Face face = nullptr;
+ bool design = shouldUseDesignMetrics(flags);
+ for (int i = 0; i < glyphs->numGlyphs; i++) {
+ Glyph *g = cacheEnabled ? defaultGlyphSet.getGlyph(glyphs->glyphs[i]) : nullptr;
+ // Since we are passing Format_None to loadGlyph, use same default format logic as loadGlyph
+ GlyphFormat acceptableFormat = (defaultFormat != Format_None) ? defaultFormat : Format_Mono;
+ if (g && g->format == acceptableFormat) {
+ glyphs->advances[i] = design ? QFixed::fromFixed(g->linearAdvance) : QFixed(g->advance);
+ } else {
+ if (!face)
+ face = lockFace();
+ g = loadGlyph(cacheEnabled ? &defaultGlyphSet : nullptr,
+ glyphs->glyphs[i],
+ QFixedPoint(),
+ Format_None,
+ true);
+ if (g)
+ glyphs->advances[i] = design ? QFixed::fromFixed(g->linearAdvance) : QFixed(g->advance);
+ else
+ glyphs->advances[i] = design ? QFixed::fromFixed(face->glyph->linearHoriAdvance >> 10)
+ : QFixed::fromFixed(face->glyph->metrics.horiAdvance).round();
+ if (!cacheEnabled && g != &emptyGlyph)
+ delete g;
+ }
+
+ if (scalableBitmapScaleFactor != 1)
+ glyphs->advances[i] *= scalableBitmapScaleFactor;
+ }
+ if (face)
+ unlockFace();
+}
+
+glyph_metrics_t QFontEngineFT::boundingBox(const QGlyphLayout &glyphs)
+{
+ FT_Face face = nullptr;
+
+ glyph_metrics_t overall;
+ // initialize with line height, we get the same behaviour on all platforms
+ if (!isScalableBitmap()) {
+ overall.y = -ascent();
+ overall.height = ascent() + descent();
+ } else {
+ overall.y = QFixed::fromFixed(-metrics.ascender);
+ overall.height = QFixed::fromFixed(metrics.ascender - metrics.descender);
+ }
+
+ QFixed ymax = 0;
+ QFixed xmax = 0;
+ for (int i = 0; i < glyphs.numGlyphs; i++) {
+ // If shaping has found this should be ignored, ignore it.
+ if (!glyphs.advances[i] || glyphs.attributes[i].dontPrint)
+ continue;
+ Glyph *g = cacheEnabled ? defaultGlyphSet.getGlyph(glyphs.glyphs[i]) : nullptr;
+ if (!g) {
+ if (!face)
+ face = lockFace();
+ g = loadGlyph(cacheEnabled ? &defaultGlyphSet : nullptr,
+ glyphs.glyphs[i],
+ QFixedPoint(),
+ Format_None,
+ true);
+ }
+ if (g) {
+ QFixed x = overall.xoff + glyphs.offsets[i].x + g->x;
+ QFixed y = overall.yoff + glyphs.offsets[i].y - g->y;
+ overall.x = qMin(overall.x, x);
+ overall.y = qMin(overall.y, y);
+ xmax = qMax(xmax, x.ceil() + g->width);
+ ymax = qMax(ymax, y.ceil() + g->height);
+ if (!cacheEnabled && g != &emptyGlyph)
+ delete g;
+ } else {
+ int left = FLOOR(face->glyph->metrics.horiBearingX);
+ int right = CEIL(face->glyph->metrics.horiBearingX + face->glyph->metrics.width);
+ int top = CEIL(face->glyph->metrics.horiBearingY);
+ int bottom = FLOOR(face->glyph->metrics.horiBearingY - face->glyph->metrics.height);
+
+ QFixed x = overall.xoff + glyphs.offsets[i].x - (-TRUNC(left));
+ QFixed y = overall.yoff + glyphs.offsets[i].y - TRUNC(top);
+ overall.x = qMin(overall.x, x);
+ overall.y = qMin(overall.y, y);
+ xmax = qMax(xmax, x + TRUNC(right - left));
+ ymax = qMax(ymax, y + TRUNC(top - bottom));
+ }
+ overall.xoff += glyphs.effectiveAdvance(i);
+ }
+ overall.height = qMax(overall.height, ymax - overall.y);
+ overall.width = xmax - overall.x;
+
+ if (face)
+ unlockFace();
+
+ if (isScalableBitmap())
+ overall = scaledBitmapMetrics(overall, QTransform());
+ return overall;
+}
+
+glyph_metrics_t QFontEngineFT::boundingBox(glyph_t glyph)
+{
+ FT_Face face = nullptr;
+ glyph_metrics_t overall;
+ Glyph *g = cacheEnabled ? defaultGlyphSet.getGlyph(glyph) : nullptr;
+ if (!g) {
+ face = lockFace();
+ g = loadGlyph(cacheEnabled ? &defaultGlyphSet : nullptr,
+ glyph,
+ QFixedPoint(),
+ Format_None,
+ true);
+ }
+ if (g) {
+ overall.x = g->x;
+ overall.y = -g->y;
+ overall.width = g->width;
+ overall.height = g->height;
+ overall.xoff = g->advance;
+ if (!cacheEnabled && g != &emptyGlyph)
+ delete g;
+ } else {
+ int left = FLOOR(face->glyph->metrics.horiBearingX);
+ int right = CEIL(face->glyph->metrics.horiBearingX + face->glyph->metrics.width);
+ int top = CEIL(face->glyph->metrics.horiBearingY);
+ int bottom = FLOOR(face->glyph->metrics.horiBearingY - face->glyph->metrics.height);
+
+ overall.width = TRUNC(right-left);
+ overall.height = TRUNC(top-bottom);
+ overall.x = TRUNC(left);
+ overall.y = -TRUNC(top);
+ overall.xoff = TRUNC(ROUND(face->glyph->advance.x));
+ }
+ if (face)
+ unlockFace();
+
+ if (isScalableBitmap())
+ overall = scaledBitmapMetrics(overall, QTransform());
+ return overall;
+}
+
+glyph_metrics_t QFontEngineFT::boundingBox(glyph_t glyph, const QTransform &matrix)
+{
+ return alphaMapBoundingBox(glyph, QFixedPoint(), matrix, QFontEngine::Format_None);
+}
+
+glyph_metrics_t QFontEngineFT::alphaMapBoundingBox(glyph_t glyph,
+ const QFixedPoint &subPixelPosition,
+ const QTransform &matrix,
+ QFontEngine::GlyphFormat format)
+{
+ // When rendering glyphs into a cache via the alphaMap* functions, we disable
+ // outline drawing. To ensure the bounding box matches the rendered glyph, we
+ // need to do the same here.
+
+ const bool needsImageTransform = !FT_IS_SCALABLE(freetype->face)
+ && matrix.type() > QTransform::TxTranslate;
+ if (needsImageTransform && format == QFontEngine::Format_Mono)
+ format = QFontEngine::Format_A8;
+ Glyph *g = loadGlyphFor(glyph, subPixelPosition, format, matrix, true, true);
+
+ glyph_metrics_t overall;
+ if (g) {
+ overall.x = g->x;
+ overall.y = -g->y;
+ overall.width = g->width;
+ overall.height = g->height;
+ overall.xoff = g->advance;
+ if (!cacheEnabled && g != &emptyGlyph)
+ delete g;
+ } else {
+ FT_Face face = lockFace();
+ int left = FLOOR(face->glyph->metrics.horiBearingX);
+ int right = CEIL(face->glyph->metrics.horiBearingX + face->glyph->metrics.width);
+ int top = CEIL(face->glyph->metrics.horiBearingY);
+ int bottom = FLOOR(face->glyph->metrics.horiBearingY - face->glyph->metrics.height);
+
+ overall.width = TRUNC(right-left);
+ overall.height = TRUNC(top-bottom);
+ overall.x = TRUNC(left);
+ overall.y = -TRUNC(top);
+ overall.xoff = TRUNC(ROUND(face->glyph->advance.x));
+ unlockFace();
+ }
+
+ if (isScalableBitmap() || needsImageTransform)
+ overall = scaledBitmapMetrics(overall, matrix);
+ return overall;
+}
+
+static inline QImage alphaMapFromGlyphData(QFontEngineFT::Glyph *glyph, QFontEngine::GlyphFormat glyphFormat)
+{
+ if (glyph == nullptr || glyph->height == 0 || glyph->width == 0)
+ return QImage();
+
+ QImage::Format format = QImage::Format_Invalid;
+ int bytesPerLine = -1;
+ switch (glyphFormat) {
+ case QFontEngine::Format_Mono:
+ format = QImage::Format_Mono;
+ bytesPerLine = ((glyph->width + 31) & ~31) >> 3;
+ break;
+ case QFontEngine::Format_A8:
+ format = QImage::Format_Alpha8;
+ bytesPerLine = (glyph->width + 3) & ~3;
+ break;
+ case QFontEngine::Format_A32:
+ format = QImage::Format_RGB32;
+ bytesPerLine = glyph->width * 4;
+ break;
+ default:
+ Q_UNREACHABLE();
+ };
+
+ QImage img(static_cast<const uchar *>(glyph->data), glyph->width, glyph->height, bytesPerLine, format);
+ if (format == QImage::Format_Mono)
+ img.setColor(1, QColor(Qt::white).rgba()); // Expands color table to 2 items; item 0 set to transparent.
+ return img;
+}
+
+QFontEngine::Glyph *QFontEngineFT::glyphData(glyph_t glyphIndex,
+ const QFixedPoint &subPixelPosition,
+ QFontEngine::GlyphFormat neededFormat,
+ const QTransform &t)
+{
+ Q_ASSERT(cacheEnabled);
+
+ if (isBitmapFont())
+ neededFormat = Format_Mono;
+ else if (neededFormat == Format_None && defaultFormat != Format_None)
+ neededFormat = defaultFormat;
+ else if (neededFormat == Format_None)
+ neededFormat = Format_A8;
+
+ Glyph *glyph = loadGlyphFor(glyphIndex, subPixelPosition, neededFormat, t);
+ if (!glyph || !glyph->width || !glyph->height)
+ return nullptr;
+
+ return glyph;
+}
+
+static inline bool is2dRotation(const QTransform &t)
+{
+ return qFuzzyCompare(t.m11(), t.m22()) && qFuzzyCompare(t.m12(), -t.m21())
+ && qFuzzyCompare(t.m11()*t.m22() - t.m12()*t.m21(), qreal(1.0));
+}
+
+QFontEngineFT::Glyph *QFontEngineFT::loadGlyphFor(glyph_t g,
+ const QFixedPoint &subPixelPosition,
+ GlyphFormat format,
+ const QTransform &t,
+ bool fetchBoundingBox,
+ bool disableOutlineDrawing)
+{
+ QGlyphSet *glyphSet = loadGlyphSet(t);
+ if (glyphSet != nullptr && glyphSet->outline_drawing && !disableOutlineDrawing && !fetchBoundingBox)
+ return nullptr;
+
+ Glyph *glyph = glyphSet != nullptr ? glyphSet->getGlyph(g, subPixelPosition) : nullptr;
+ if (!glyph || glyph->format != format || (!fetchBoundingBox && !glyph->data)) {
+ QScopedValueRollback<HintStyle> saved_default_hint_style(default_hint_style);
+ if (t.type() >= QTransform::TxScale && !is2dRotation(t))
+ default_hint_style = HintNone; // disable hinting if the glyphs are transformed
+
+ lockFace();
+ FT_Matrix m = this->matrix;
+ FT_Matrix ftMatrix = glyphSet != nullptr ? glyphSet->transformationMatrix : QTransformToFTMatrix(t);
+ FT_Matrix_Multiply(&ftMatrix, &m);
+ freetype->matrix = m;
+ glyph = loadGlyph(glyphSet, g, subPixelPosition, format, false, disableOutlineDrawing);
+ unlockFace();
+ }
+
+ return glyph;
+}
+
+QImage QFontEngineFT::alphaMapForGlyph(glyph_t g, const QFixedPoint &subPixelPosition)
+{
+ return alphaMapForGlyph(g, subPixelPosition, QTransform());
+}
+
+QImage QFontEngineFT::alphaMapForGlyph(glyph_t g,
+ const QFixedPoint &subPixelPosition,
+ const QTransform &t)
+{
+ const bool needsImageTransform = !FT_IS_SCALABLE(freetype->face)
+ && t.type() > QTransform::TxTranslate;
+ const GlyphFormat neededFormat = antialias || needsImageTransform ? Format_A8 : Format_Mono;
+
+ Glyph *glyph = loadGlyphFor(g, subPixelPosition, neededFormat, t, false, true);
+
+ QImage img = alphaMapFromGlyphData(glyph, neededFormat);
+ if (needsImageTransform)
+ img = img.transformed(t, Qt::SmoothTransformation);
+ else
+ img = img.copy();
+
+ if (!cacheEnabled && glyph != &emptyGlyph)
+ delete glyph;
+
+ return img;
+}
+
+QImage QFontEngineFT::alphaRGBMapForGlyph(glyph_t g,
+ const QFixedPoint &subPixelPosition,
+ const QTransform &t)
+{
+ if (t.type() > QTransform::TxRotate)
+ return QFontEngine::alphaRGBMapForGlyph(g, subPixelPosition, t);
+
+ const GlyphFormat neededFormat = Format_A32;
+
+ Glyph *glyph = loadGlyphFor(g, subPixelPosition, neededFormat, t, false, true);
+
+ QImage img = alphaMapFromGlyphData(glyph, neededFormat);
+ img = img.copy();
+
+ if (!cacheEnabled && glyph != &emptyGlyph)
+ delete glyph;
+
+ if (!img.isNull())
+ return img;
+
+ return QFontEngine::alphaRGBMapForGlyph(g, subPixelPosition, t);
+}
+
+QImage QFontEngineFT::bitmapForGlyph(glyph_t g,
+ const QFixedPoint &subPixelPosition,
+ const QTransform &t,
+ const QColor &color)
+{
+ Q_UNUSED(color);
+
+ Glyph *glyph = loadGlyphFor(g, subPixelPosition, defaultFormat, t);
+ if (glyph == nullptr)
+ return QImage();
+
+ QImage img;
+ if (defaultFormat == GlyphFormat::Format_ARGB)
+ img = QImage(glyph->data, glyph->width, glyph->height, QImage::Format_ARGB32_Premultiplied).copy();
+ else if (defaultFormat == GlyphFormat::Format_Mono)
+ img = QImage(glyph->data, glyph->width, glyph->height, QImage::Format_Mono).copy();
+
+ if (!img.isNull() && (!t.isIdentity() || scalableBitmapScaleFactor != 1)) {
+ QTransform trans(t);
+ const qreal scaleFactor = scalableBitmapScaleFactor.toReal();
+ trans.scale(scaleFactor, scaleFactor);
+ img = img.transformed(trans, Qt::SmoothTransformation);
+ }
+
+ if (!cacheEnabled && glyph != &emptyGlyph)
+ delete glyph;
+
+ return img;
+}
+
+void QFontEngineFT::removeGlyphFromCache(glyph_t glyph)
+{
+ defaultGlyphSet.removeGlyphFromCache(glyph, QFixedPoint());
+}
+
+int QFontEngineFT::glyphCount() const
+{
+ int count = 0;
+ FT_Face face = lockFace();
+ if (face) {
+ count = face->num_glyphs;
+ unlockFace();
+ }
+ return count;
+}
+
+FT_Face QFontEngineFT::lockFace(Scaling scale) const
+{
+ freetype->lock();
+ FT_Face face = freetype->face;
+ if (scale == Unscaled) {
+ if (FT_Set_Char_Size(face, face->units_per_EM << 6, face->units_per_EM << 6, 0, 0) == 0) {
+ freetype->xsize = face->units_per_EM << 6;
+ freetype->ysize = face->units_per_EM << 6;
+ }
+ } else if (freetype->xsize != xsize || freetype->ysize != ysize) {
+ FT_Set_Char_Size(face, xsize, ysize, 0, 0);
+ freetype->xsize = xsize;
+ freetype->ysize = ysize;
+ }
+ if (freetype->matrix.xx != matrix.xx ||
+ freetype->matrix.yy != matrix.yy ||
+ freetype->matrix.xy != matrix.xy ||
+ freetype->matrix.yx != matrix.yx) {
+ freetype->matrix = matrix;
+ FT_Set_Transform(face, &freetype->matrix, nullptr);
+ }
+
+ return face;
+}
+
+void QFontEngineFT::unlockFace() const
+{
+ freetype->unlock();
+}
+
+FT_Face QFontEngineFT::non_locked_face() const
+{
+ return freetype->face;
+}
+
+
+QFontEngineFT::QGlyphSet::QGlyphSet()
+ : outline_drawing(false)
+{
+ transformationMatrix.xx = 0x10000;
+ transformationMatrix.yy = 0x10000;
+ transformationMatrix.xy = 0;
+ transformationMatrix.yx = 0;
+ memset(fast_glyph_data, 0, sizeof(fast_glyph_data));
+ fast_glyph_count = 0;
+}
+
+QFontEngineFT::QGlyphSet::~QGlyphSet()
+{
+ clear();
+}
+
+void QFontEngineFT::QGlyphSet::clear()
+{
+ if (fast_glyph_count > 0) {
+ for (int i = 0; i < 256; ++i) {
+ if (fast_glyph_data[i]) {
+ delete fast_glyph_data[i];
+ fast_glyph_data[i] = nullptr;
+ }
+ }
+ fast_glyph_count = 0;
+ }
+ qDeleteAll(glyph_data);
+ glyph_data.clear();
+}
+
+void QFontEngineFT::QGlyphSet::removeGlyphFromCache(glyph_t index,
+ const QFixedPoint &subPixelPosition)
+{
+ if (useFastGlyphData(index, subPixelPosition)) {
+ if (fast_glyph_data[index]) {
+ delete fast_glyph_data[index];
+ fast_glyph_data[index] = nullptr;
+ if (fast_glyph_count > 0)
+ --fast_glyph_count;
+ }
+ } else {
+ delete glyph_data.take(GlyphAndSubPixelPosition(index, subPixelPosition));
+ }
+}
+
+void QFontEngineFT::QGlyphSet::setGlyph(glyph_t index,
+ const QFixedPoint &subPixelPosition,
+ Glyph *glyph)
+{
+ if (useFastGlyphData(index, subPixelPosition)) {
+ if (!fast_glyph_data[index])
+ ++fast_glyph_count;
+ fast_glyph_data[index] = glyph;
+ } else {
+ glyph_data.insert(GlyphAndSubPixelPosition(index, subPixelPosition), glyph);
+ }
+}
+
+int QFontEngineFT::getPointInOutline(glyph_t glyph, int flags, quint32 point, QFixed *xpos, QFixed *ypos, quint32 *nPoints)
+{
+ lockFace();
+ bool hsubpixel = true;
+ int vfactor = 1;
+ int load_flags = loadFlags(nullptr, Format_A8, flags, hsubpixel, vfactor);
+ int result = freetype->getPointInOutline(glyph, load_flags, point, xpos, ypos, nPoints);
+ unlockFace();
+ return result;
+}
+
+bool QFontEngineFT::initFromFontEngine(const QFontEngineFT *fe)
+{
+ if (!init(fe->faceId(), fe->antialias, fe->defaultFormat, fe->freetype))
+ return false;
+
+ // Increase the reference of this QFreetypeFace since one more QFontEngineFT
+ // will be using it
+ freetype->ref.ref();
+
+ default_load_flags = fe->default_load_flags;
+ default_hint_style = fe->default_hint_style;
+ antialias = fe->antialias;
+ transform = fe->transform;
+ embolden = fe->embolden;
+ obliquen = fe->obliquen;
+ subpixelType = fe->subpixelType;
+ lcdFilterType = fe->lcdFilterType;
+ embeddedbitmap = fe->embeddedbitmap;
+
+ return true;
+}
+
+QFontEngine *QFontEngineFT::cloneWithSize(qreal pixelSize) const
+{
+ QFontDef fontDef(this->fontDef);
+ fontDef.pixelSize = pixelSize;
+ QFontEngineFT *fe = new QFontEngineFT(fontDef);
+ if (!fe->initFromFontEngine(this)) {
+ delete fe;
+ return nullptr;
+ } else {
+ return fe;
+ }
+}
+
+Qt::HANDLE QFontEngineFT::handle() const
+{
+ return non_locked_face();
+}
+
+QT_END_NAMESPACE
+
+#endif // QT_NO_FREETYPE
diff --git a/src/gui/text/freetype/qfontengine_ft_p.h b/src/gui/text/freetype/qfontengine_ft_p.h
new file mode 100644
index 0000000000..bdd4549827
--- /dev/null
+++ b/src/gui/text/freetype/qfontengine_ft_p.h
@@ -0,0 +1,354 @@
+// Copyright (C) 2021 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
+#ifndef QFONTENGINE_FT_P_H
+#define QFONTENGINE_FT_P_H
+//
+// W A R N I N G
+// -------------
+//
+// This file is not part of the Qt API. It exists purely as an
+// implementation detail. This header file may change from version to
+// version without notice, or even be removed.
+//
+// We mean it.
+//
+
+#include "private/qfontengine_p.h"
+
+#ifndef QT_NO_FREETYPE
+
+#include <ft2build.h>
+#include FT_FREETYPE_H
+#include FT_MULTIPLE_MASTERS_H
+
+
+#ifndef Q_OS_WIN
+#include <unistd.h>
+#endif
+
+#include <qmutex.h>
+
+#include <string.h>
+
+QT_BEGIN_NAMESPACE
+
+class QFontEngineFTRawFont;
+class QFontconfigDatabase;
+
+/*
+ * This class represents one font file on disk (like Arial.ttf) and is shared between all the font engines
+ * that show this font file (at different pixel sizes).
+ */
+class Q_GUI_EXPORT QFreetypeFace
+{
+public:
+ void computeSize(const QFontDef &fontDef, int *xsize, int *ysize, bool *outline_drawing, QFixed *scalableBitmapScaleFactor);
+ QFontEngine::Properties properties() const;
+ bool getSfntTable(uint tag, uchar *buffer, uint *length) const;
+
+ static QFreetypeFace *getFace(const QFontEngine::FaceId &face_id,
+ const QByteArray &fontData = QByteArray());
+ void release(const QFontEngine::FaceId &face_id);
+
+ static int getFaceIndexByStyleName(const QString &faceFileName, const QString &styleName);
+
+ // locks the struct for usage. Any read/write operations require locking.
+ void lock()
+ {
+ _lock.lock();
+ }
+ void unlock()
+ {
+ _lock.unlock();
+ }
+
+ FT_Face face;
+ FT_MM_Var *mm_var;
+ int xsize; // 26.6
+ int ysize; // 26.6
+ FT_Matrix matrix;
+ FT_CharMap unicode_map;
+ FT_CharMap symbol_map;
+
+ enum { cmapCacheSize = 0x200 };
+ glyph_t cmapCache[cmapCacheSize];
+
+ int fsType() const;
+
+ int getPointInOutline(glyph_t glyph, int flags, quint32 point, QFixed *xpos, QFixed *ypos, quint32 *nPoints);
+
+ bool isScalable() const;
+ bool isScalableBitmap() const;
+
+ static void addGlyphToPath(FT_Face face, FT_GlyphSlot g, const QFixedPoint &point, QPainterPath *path, FT_Fixed x_scale, FT_Fixed y_scale);
+ static void addBitmapToPath(FT_GlyphSlot slot, const QFixedPoint &point, QPainterPath *path);
+
+private:
+ friend class QFontEngineFT;
+ friend class QtFreetypeData;
+ QFreetypeFace() = default;
+ ~QFreetypeFace() {}
+ void cleanup();
+ QAtomicInt ref;
+ QRecursiveMutex _lock;
+ QByteArray fontData;
+
+ QFontEngine::Holder hbFace;
+};
+
+class Q_GUI_EXPORT QFontEngineFT : public QFontEngine
+{
+public:
+ struct GlyphInfo {
+ int linearAdvance;
+ unsigned short width;
+ unsigned short height;
+ short x;
+ short y;
+ short xOff;
+ short yOff;
+ };
+
+ struct GlyphAndSubPixelPosition
+ {
+ GlyphAndSubPixelPosition(glyph_t g, const QFixedPoint spp) : glyph(g), subPixelPosition(spp) {}
+
+ bool operator==(const GlyphAndSubPixelPosition &other) const
+ {
+ return glyph == other.glyph && subPixelPosition == other.subPixelPosition;
+ }
+
+ glyph_t glyph;
+ QFixedPoint subPixelPosition;
+ };
+
+ struct QGlyphSet
+ {
+ QGlyphSet();
+ ~QGlyphSet();
+ FT_Matrix transformationMatrix;
+ bool outline_drawing;
+
+ void removeGlyphFromCache(glyph_t index, const QFixedPoint &subPixelPosition);
+ void clear();
+ inline bool useFastGlyphData(glyph_t index, const QFixedPoint &subPixelPosition) const {
+ return (index < 256 && subPixelPosition.x == 0 && subPixelPosition.y == 0);
+ }
+ inline Glyph *getGlyph(glyph_t index,
+ const QFixedPoint &subPixelPositionX = QFixedPoint()) const;
+ void setGlyph(glyph_t index, const QFixedPoint &spp, Glyph *glyph);
+
+ inline bool isGlyphMissing(glyph_t index) const { return missing_glyphs.contains(index); }
+ inline void setGlyphMissing(glyph_t index) const { missing_glyphs.insert(index); }
+private:
+ Q_DISABLE_COPY(QGlyphSet);
+ mutable QHash<GlyphAndSubPixelPosition, Glyph *> glyph_data; // maps from glyph index to glyph data
+ mutable QSet<glyph_t> missing_glyphs;
+ mutable Glyph *fast_glyph_data[256]; // for fast lookup of glyphs < 256
+ mutable int fast_glyph_count;
+ };
+
+ QFontEngine::FaceId faceId() const override;
+ QFontEngine::Properties properties() const override;
+ QFixed emSquareSize() const override;
+ bool supportsHorizontalSubPixelPositions() const override
+ {
+ return default_hint_style == HintLight ||
+ default_hint_style == HintNone;
+ }
+
+ bool supportsVerticalSubPixelPositions() const override
+ {
+ return supportsHorizontalSubPixelPositions();
+ }
+
+ bool getSfntTableData(uint tag, uchar *buffer, uint *length) const override;
+ int synthesized() const override;
+
+ void initializeHeightMetrics() const override;
+ QFixed capHeight() const override;
+ QFixed xHeight() const override;
+ QFixed averageCharWidth() const override;
+
+ qreal maxCharWidth() const override;
+ QFixed lineThickness() const override;
+ QFixed underlinePosition() const override;
+
+ glyph_t glyphIndex(uint ucs4) const override;
+ void doKerning(QGlyphLayout *, ShaperFlags) const override;
+
+ void getUnscaledGlyph(glyph_t glyph, QPainterPath *path, glyph_metrics_t *metrics) override;
+
+ bool supportsTransformation(const QTransform &transform) const override;
+
+ void addGlyphsToPath(glyph_t *glyphs, QFixedPoint *positions, int nglyphs,
+ QPainterPath *path, QTextItem::RenderFlags flags) override;
+ void addOutlineToPath(qreal x, qreal y, const QGlyphLayout &glyphs,
+ QPainterPath *path, QTextItem::RenderFlags flags) override;
+
+ int stringToCMap(const QChar *str, int len, QGlyphLayout *glyphs, int *nglyphs, ShaperFlags flags) const override;
+
+ glyph_metrics_t boundingBox(const QGlyphLayout &glyphs) override;
+ glyph_metrics_t boundingBox(glyph_t glyph) override;
+ glyph_metrics_t boundingBox(glyph_t glyph, const QTransform &matrix) override;
+
+ void recalcAdvances(QGlyphLayout *glyphs, ShaperFlags flags) const override;
+ QImage alphaMapForGlyph(glyph_t g) override { return alphaMapForGlyph(g, QFixedPoint()); }
+ QImage alphaMapForGlyph(glyph_t, const QFixedPoint &) override;
+ QImage alphaMapForGlyph(glyph_t glyph, const QFixedPoint &subPixelPosition, const QTransform &t) override;
+ QImage alphaRGBMapForGlyph(glyph_t, const QFixedPoint &subPixelPosition, const QTransform &t) override;
+ QImage bitmapForGlyph(glyph_t, const QFixedPoint &subPixelPosition, const QTransform &t, const QColor &color) override;
+ glyph_metrics_t alphaMapBoundingBox(glyph_t glyph,
+ const QFixedPoint &subPixelPosition,
+ const QTransform &matrix,
+ QFontEngine::GlyphFormat format) override;
+ Glyph *glyphData(glyph_t glyph,
+ const QFixedPoint &subPixelPosition,
+ GlyphFormat neededFormat,
+ const QTransform &t) override;
+ bool hasInternalCaching() const override { return cacheEnabled; }
+ bool expectsGammaCorrectedBlending() const override;
+
+ void removeGlyphFromCache(glyph_t glyph) override;
+ int glyphMargin(QFontEngine::GlyphFormat /* format */) override { return 0; }
+
+ int glyphCount() const override;
+
+ enum Scaling {
+ Scaled,
+ Unscaled
+ };
+ FT_Face lockFace(Scaling scale = Scaled) const;
+ void unlockFace() const;
+
+ FT_Face non_locked_face() const;
+
+ inline bool drawAntialiased() const { return antialias; }
+ inline bool invalid() const { return xsize == 0 && ysize == 0; }
+ inline bool isBitmapFont() const { return defaultFormat == Format_Mono; }
+ inline bool isScalableBitmap() const { return freetype->isScalableBitmap(); }
+
+ inline Glyph *loadGlyph(uint glyph,
+ const QFixedPoint &subPixelPosition,
+ GlyphFormat format = Format_None,
+ bool fetchMetricsOnly = false,
+ bool disableOutlineDrawing = false) const
+ { return loadGlyph(cacheEnabled ? &defaultGlyphSet : nullptr, glyph, subPixelPosition, format, fetchMetricsOnly, disableOutlineDrawing); }
+ Glyph *loadGlyph(QGlyphSet *set,
+ uint glyph,
+ const QFixedPoint &subPixelPosition,
+ GlyphFormat = Format_None,
+ bool fetchMetricsOnly = false,
+ bool disableOutlineDrawing = false) const;
+ Glyph *loadGlyphFor(glyph_t g,
+ const QFixedPoint &subPixelPosition,
+ GlyphFormat format,
+ const QTransform &t,
+ bool fetchBoundingBox = false,
+ bool disableOutlineDrawing = false);
+
+ QGlyphSet *loadGlyphSet(const QTransform &matrix);
+
+ QFontEngineFT(const QFontDef &fd);
+ virtual ~QFontEngineFT();
+
+ bool init(FaceId faceId, bool antiaalias, GlyphFormat defaultFormat = Format_None,
+ const QByteArray &fontData = QByteArray());
+ bool init(FaceId faceId, bool antialias, GlyphFormat format,
+ QFreetypeFace *freetypeFace);
+
+ int getPointInOutline(glyph_t glyph, int flags, quint32 point, QFixed *xpos, QFixed *ypos, quint32 *nPoints) override;
+
+ void setQtDefaultHintStyle(QFont::HintingPreference hintingPreference);
+ void setDefaultHintStyle(HintStyle style) override;
+
+ QFontEngine *cloneWithSize(qreal pixelSize) const override;
+ Qt::HANDLE handle() const override;
+ bool initFromFontEngine(const QFontEngineFT *fontEngine);
+
+ HintStyle defaultHintStyle() const { return default_hint_style; }
+
+ static QFontEngineFT *create(const QFontDef &fontDef, FaceId faceId, const QByteArray &fontData = QByteArray());
+ static QFontEngineFT *create(const QByteArray &fontData, qreal pixelSize, QFont::HintingPreference hintingPreference, const QMap<QFont::Tag, float> &variableAxisValue);
+
+protected:
+
+ QFreetypeFace *freetype;
+ mutable int default_load_flags;
+ HintStyle default_hint_style;
+ bool antialias;
+ bool transform;
+ bool embolden;
+ bool obliquen;
+ SubpixelAntialiasingType subpixelType;
+ int lcdFilterType;
+ bool embeddedbitmap;
+ bool cacheEnabled;
+ bool forceAutoHint;
+ bool stemDarkeningDriver;
+
+private:
+ friend class QFontEngineFTRawFont;
+ friend class QFontconfigDatabase;
+ friend class QFreeTypeFontDatabase;
+ friend class QFontEngineMultiFontConfig;
+
+ int loadFlags(QGlyphSet *set, GlyphFormat format, int flags, bool &hsubpixel, int &vfactor) const;
+ bool shouldUseDesignMetrics(ShaperFlags flags) const;
+ QFixed scaledBitmapMetrics(QFixed m) const;
+ glyph_metrics_t scaledBitmapMetrics(const glyph_metrics_t &m, const QTransform &matrix) const;
+
+ GlyphFormat defaultFormat;
+ FT_Matrix matrix;
+
+ struct TransformedGlyphSets {
+ enum { nSets = 10 };
+ QGlyphSet *sets[nSets];
+
+ QGlyphSet *findSet(const QTransform &matrix, const QFontDef &fontDef);
+ TransformedGlyphSets() { std::fill(&sets[0], &sets[nSets], nullptr); }
+ ~TransformedGlyphSets() { qDeleteAll(&sets[0], &sets[nSets]); }
+ private:
+ void moveToFront(int i);
+ Q_DISABLE_COPY(TransformedGlyphSets);
+ };
+ TransformedGlyphSets transformedGlyphSets;
+ mutable QGlyphSet defaultGlyphSet;
+
+ QFontEngine::FaceId face_id;
+
+ int xsize;
+ int ysize;
+
+ QFixed line_thickness;
+ QFixed underline_position;
+
+ FT_Size_Metrics metrics;
+ mutable bool kerning_pairs_loaded;
+ QFixed scalableBitmapScaleFactor;
+};
+
+
+inline size_t qHash(const QFontEngineFT::GlyphAndSubPixelPosition &g, size_t seed = 0)
+{
+ return qHashMulti(seed,
+ g.glyph,
+ g.subPixelPosition.x.value(),
+ g.subPixelPosition.y.value());
+}
+
+inline QFontEngineFT::Glyph *QFontEngineFT::QGlyphSet::getGlyph(glyph_t index,
+ const QFixedPoint &subPixelPosition) const
+{
+ if (useFastGlyphData(index, subPixelPosition))
+ return fast_glyph_data[index];
+ return glyph_data.value(GlyphAndSubPixelPosition(index, subPixelPosition));
+}
+
+Q_GUI_EXPORT FT_Library qt_getFreetype();
+
+QT_END_NAMESPACE
+
+#endif // QT_NO_FREETYPE
+
+#endif // QFONTENGINE_FT_P_H
diff --git a/src/gui/text/freetype/qfreetypefontdatabase.cpp b/src/gui/text/freetype/qfreetypefontdatabase.cpp
new file mode 100644
index 0000000000..018e590ac2
--- /dev/null
+++ b/src/gui/text/freetype/qfreetypefontdatabase.cpp
@@ -0,0 +1,361 @@
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
+
+#include "qfreetypefontdatabase_p.h"
+
+#include <QtGui/private/qguiapplication_p.h>
+#include <qpa/qplatformscreen.h>
+
+#include <QtCore/QFile>
+#include <QtCore/QLibraryInfo>
+#include <QtCore/QDir>
+#include <QtCore/QtEndian>
+#include <QtCore/QLoggingCategory>
+#include <QtCore/QUuid>
+
+#undef QT_NO_FREETYPE
+#include "qfontengine_ft_p.h"
+
+#include <ft2build.h>
+#include FT_TRUETYPE_TABLES_H
+#include FT_ERRORS_H
+
+#include FT_MULTIPLE_MASTERS_H
+#include FT_SFNT_NAMES_H
+#include FT_TRUETYPE_IDS_H
+
+QT_BEGIN_NAMESPACE
+
+Q_DECLARE_LOGGING_CATEGORY(lcFontDb)
+
+using namespace Qt::StringLiterals;
+
+void QFreeTypeFontDatabase::populateFontDatabase()
+{
+ QString fontpath = fontDir();
+ QDir dir(fontpath);
+
+ if (!dir.exists()) {
+ qWarning("QFontDatabase: Cannot find font directory %s.\n"
+ "Note that Qt no longer ships fonts. Deploy some (from https://dejavu-fonts.github.io/ for example) or switch to fontconfig.",
+ qPrintable(fontpath));
+ return;
+ }
+
+ static const QString nameFilters[] = {
+ u"*.ttf"_s,
+ u"*.pfa"_s,
+ u"*.pfb"_s,
+ u"*.otf"_s,
+ };
+
+ const auto fis = dir.entryInfoList(QStringList::fromReadOnlyData(nameFilters), QDir::Files);
+ for (const QFileInfo &fi : fis) {
+ const QByteArray file = QFile::encodeName(fi.absoluteFilePath());
+ QFreeTypeFontDatabase::addTTFile(QByteArray(), file);
+ }
+}
+
+QFontEngine *QFreeTypeFontDatabase::fontEngine(const QFontDef &fontDef, void *usrPtr)
+{
+ FontFile *fontfile = static_cast<FontFile *>(usrPtr);
+ QFontEngine::FaceId faceId;
+ faceId.filename = QFile::encodeName(fontfile->fileName);
+ faceId.index = fontfile->indexValue;
+ faceId.instanceIndex = fontfile->instanceIndex;
+ faceId.variableAxes = fontDef.variableAxisValues;
+
+ // Make sure the FaceId compares uniquely in cases where a
+ // file name is not provided.
+ if (faceId.filename.isEmpty()) {
+ QUuid::Id128Bytes id{};
+ memcpy(&id, &usrPtr, sizeof(usrPtr));
+ faceId.uuid = QUuid(id).toByteArray();
+ }
+
+ return QFontEngineFT::create(fontDef, faceId, fontfile->data);
+}
+
+QFontEngine *QFreeTypeFontDatabase::fontEngine(const QByteArray &fontData, qreal pixelSize,
+ QFont::HintingPreference hintingPreference)
+{
+ return QFontEngineFT::create(fontData, pixelSize, hintingPreference, {});
+}
+
+QStringList QFreeTypeFontDatabase::addApplicationFont(const QByteArray &fontData, const QString &fileName, QFontDatabasePrivate::ApplicationFont *applicationFont)
+{
+ return QFreeTypeFontDatabase::addTTFile(fontData, fileName.toLocal8Bit(), applicationFont);
+}
+
+void QFreeTypeFontDatabase::releaseHandle(void *handle)
+{
+ FontFile *file = static_cast<FontFile *>(handle);
+ delete file;
+}
+
+extern FT_Library qt_getFreetype();
+
+void QFreeTypeFontDatabase::addNamedInstancesForFace(void *face_,
+ int faceIndex,
+ const QString &family,
+ const QString &styleName,
+ QFont::Weight weight,
+ QFont::Stretch stretch,
+ QFont::Style style,
+ bool fixedPitch,
+ const QSupportedWritingSystems &writingSystems,
+ const QByteArray &fileName,
+ const QByteArray &fontData)
+{
+ FT_Face face = reinterpret_cast<FT_Face>(face_);
+
+ // Note: The following does not actually depend on API from 2.9, but the
+ // FT_Set_Named_Instance() was added in 2.9, so to avoid populating the database with
+ // named instances that cannot be selected, we disable the feature on older Freetype
+ // versions.
+#if (FREETYPE_MAJOR*10000 + FREETYPE_MINOR*100 + FREETYPE_PATCH) >= 20900
+ FT_MM_Var *var = nullptr;
+ FT_Get_MM_Var(face, &var);
+ if (var != nullptr) {
+ std::unique_ptr<FT_MM_Var, void(*)(FT_MM_Var*)> varGuard(var, [](FT_MM_Var *res) {
+ FT_Done_MM_Var(qt_getFreetype(), res);
+ });
+
+ for (FT_UInt i = 0; i < var->num_namedstyles; ++i) {
+ FT_UInt id = var->namedstyle[i].strid;
+
+ QFont::Weight instanceWeight = weight;
+ QFont::Stretch instanceStretch = stretch;
+ QFont::Style instanceStyle = style;
+ for (FT_UInt axis = 0; axis < var->num_axis; ++axis) {
+ if (var->axis[axis].tag == QFont::Tag("wght").value()) {
+ instanceWeight = QFont::Weight(var->namedstyle[i].coords[axis] >> 16);
+ } else if (var->axis[axis].tag == QFont::Tag("wdth").value()) {
+ instanceStretch = QFont::Stretch(var->namedstyle[i].coords[axis] >> 16);
+ } else if (var->axis[axis].tag == QFont::Tag("ital").value()) {
+ FT_UInt ital = var->namedstyle[i].coords[axis] >> 16;
+ if (ital == 1)
+ instanceStyle = QFont::StyleItalic;
+ else
+ instanceStyle = QFont::StyleNormal;
+ }
+ }
+
+ FT_UInt count = FT_Get_Sfnt_Name_Count(face);
+ for (FT_UInt j = 0; j < count; ++j) {
+ FT_SfntName name;
+ if (FT_Get_Sfnt_Name(face, j, &name))
+ continue;
+
+ if (name.name_id != id)
+ continue;
+
+ // Only support Unicode for now
+ if (name.encoding_id != TT_MS_ID_UNICODE_CS)
+ continue;
+
+ // Sfnt names stored as UTF-16BE
+ QString instanceName;
+ for (FT_UInt k = 0; k < name.string_len; k += 2)
+ instanceName += QChar((name.string[k] << 8) + name.string[k + 1]);
+ if (instanceName != styleName) {
+ FontFile *variantFontFile = new FontFile{
+ QFile::decodeName(fileName),
+ faceIndex,
+ int(i),
+ fontData
+ };
+
+ qCDebug(lcFontDb) << "Registering named instance" << i
+ << ":" << instanceName
+ << "for font family" << family
+ << "with weight" << instanceWeight
+ << ", style" << instanceStyle
+ << ", stretch" << instanceStretch;
+
+ registerFont(family,
+ instanceName,
+ QString(),
+ instanceWeight,
+ instanceStyle,
+ instanceStretch,
+ true,
+ true,
+ 0,
+ fixedPitch,
+ writingSystems,
+ variantFontFile);
+ }
+ }
+ }
+ }
+#else
+ Q_UNUSED(face);
+ Q_UNUSED(family);
+ Q_UNUSED(styleName);
+ Q_UNUSED(weight);
+ Q_UNUSED(stretch);
+ Q_UNUSED(style);
+ Q_UNUSED(fixedPitch);
+ Q_UNUSED(writingSystems);
+ Q_UNUSED(fontData);
+#endif
+
+}
+
+QStringList QFreeTypeFontDatabase::addTTFile(const QByteArray &fontData, const QByteArray &file, QFontDatabasePrivate::ApplicationFont *applicationFont)
+{
+ FT_Library library = qt_getFreetype();
+
+ int index = 0;
+ int numFaces = 0;
+ QStringList families;
+ do {
+ FT_Face face;
+ FT_Error error;
+ if (!fontData.isEmpty()) {
+ error = FT_New_Memory_Face(library, (const FT_Byte *)fontData.constData(), fontData.size(), index, &face);
+ } else {
+ error = FT_New_Face(library, file.constData(), index, &face);
+ }
+ if (error != FT_Err_Ok) {
+ qDebug() << "FT_New_Face failed with index" << index << ':' << Qt::hex << error;
+ break;
+ }
+ numFaces = face->num_faces;
+
+ QFont::Weight weight = QFont::Normal;
+
+ QFont::Style style = QFont::StyleNormal;
+ if (face->style_flags & FT_STYLE_FLAG_ITALIC)
+ style = QFont::StyleItalic;
+
+ if (face->style_flags & FT_STYLE_FLAG_BOLD)
+ weight = QFont::Bold;
+
+ bool fixedPitch = (face->face_flags & FT_FACE_FLAG_FIXED_WIDTH);
+ QSupportedWritingSystems writingSystems;
+ // detect symbol fonts
+ for (int i = 0; i < face->num_charmaps; ++i) {
+ FT_CharMap cm = face->charmaps[i];
+ if (cm->encoding == FT_ENCODING_ADOBE_CUSTOM
+ || cm->encoding == FT_ENCODING_MS_SYMBOL) {
+ writingSystems.setSupported(QFontDatabase::Symbol);
+ break;
+ }
+ }
+
+ QFont::Stretch stretch = QFont::Unstretched;
+ TT_OS2 *os2 = (TT_OS2 *)FT_Get_Sfnt_Table(face, ft_sfnt_os2);
+ if (os2) {
+ quint32 unicodeRange[4] = {
+ quint32(os2->ulUnicodeRange1),
+ quint32(os2->ulUnicodeRange2),
+ quint32(os2->ulUnicodeRange3),
+ quint32(os2->ulUnicodeRange4)
+ };
+ quint32 codePageRange[2] = {
+ quint32(os2->ulCodePageRange1),
+ quint32(os2->ulCodePageRange2)
+ };
+
+ writingSystems = QPlatformFontDatabase::writingSystemsFromTrueTypeBits(unicodeRange, codePageRange);
+
+ if (os2->usWeightClass) {
+ weight = static_cast<QFont::Weight>(os2->usWeightClass);
+ } else if (os2->panose[2]) {
+ int w = os2->panose[2];
+ if (w <= 1)
+ weight = QFont::Thin;
+ else if (w <= 2)
+ weight = QFont::ExtraLight;
+ else if (w <= 3)
+ weight = QFont::Light;
+ else if (w <= 5)
+ weight = QFont::Normal;
+ else if (w <= 6)
+ weight = QFont::Medium;
+ else if (w <= 7)
+ weight = QFont::DemiBold;
+ else if (w <= 8)
+ weight = QFont::Bold;
+ else if (w <= 9)
+ weight = QFont::ExtraBold;
+ else if (w <= 10)
+ weight = QFont::Black;
+ }
+
+ switch (os2->usWidthClass) {
+ case 1:
+ stretch = QFont::UltraCondensed;
+ break;
+ case 2:
+ stretch = QFont::ExtraCondensed;
+ break;
+ case 3:
+ stretch = QFont::Condensed;
+ break;
+ case 4:
+ stretch = QFont::SemiCondensed;
+ break;
+ case 5:
+ stretch = QFont::Unstretched;
+ break;
+ case 6:
+ stretch = QFont::SemiExpanded;
+ break;
+ case 7:
+ stretch = QFont::Expanded;
+ break;
+ case 8:
+ stretch = QFont::ExtraExpanded;
+ break;
+ case 9:
+ stretch = QFont::UltraExpanded;
+ break;
+ }
+ }
+
+ QString family = QString::fromLatin1(face->family_name);
+ FontFile *fontFile = new FontFile{
+ QFile::decodeName(file),
+ index,
+ -1,
+ fontData
+ };
+
+ QString styleName = QString::fromLatin1(face->style_name);
+
+ if (applicationFont != nullptr) {
+ QFontDatabasePrivate::ApplicationFont::Properties properties;
+ properties.familyName = family;
+ properties.styleName = styleName;
+ properties.weight = weight;
+ properties.stretch = stretch;
+ properties.style = style;
+
+ applicationFont->properties.append(properties);
+ }
+
+ registerFont(family, styleName, QString(), weight, style, stretch, true, true, 0, fixedPitch, writingSystems, fontFile);
+
+ addNamedInstancesForFace(face, index, family, styleName, weight, stretch, style, fixedPitch, writingSystems, file, fontData);
+
+ families.append(family);
+
+ FT_Done_Face(face);
+ ++index;
+ } while (index < numFaces);
+ return families;
+}
+
+bool QFreeTypeFontDatabase::supportsVariableApplicationFonts() const
+{
+#if (FREETYPE_MAJOR*10000 + FREETYPE_MINOR*100 + FREETYPE_PATCH) >= 20900
+ return true;
+#else
+ return false;
+#endif
+}
+
+QT_END_NAMESPACE
diff --git a/src/gui/text/freetype/qfreetypefontdatabase_p.h b/src/gui/text/freetype/qfreetypefontdatabase_p.h
new file mode 100644
index 0000000000..5fcec585d2
--- /dev/null
+++ b/src/gui/text/freetype/qfreetypefontdatabase_p.h
@@ -0,0 +1,59 @@
+// Copyright (C) 2020 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
+
+#ifndef QFREETYPEFONTDATABASE_H
+#define QFREETYPEFONTDATABASE_H
+
+//
+// W A R N I N G
+// -------------
+//
+// This file is not part of the Qt API. It exists purely as an
+// implementation detail. This header file may change from version to
+// version without notice, or even be removed.
+//
+// We mean it.
+//
+
+#include <qpa/qplatformfontdatabase.h>
+#include <QtCore/QByteArray>
+#include <QtCore/QString>
+#include <QtCore/private/qglobal_p.h>
+
+QT_BEGIN_NAMESPACE
+
+struct FontFile
+{
+ QString fileName;
+ int indexValue;
+ int instanceIndex = -1;
+
+ // Note: The data may be implicitly shared throughout the
+ // font database and platform font database, so be careful
+ // to never detach when accessing this member!
+ const QByteArray data;
+};
+
+class Q_GUI_EXPORT QFreeTypeFontDatabase : public QPlatformFontDatabase
+{
+public:
+ void populateFontDatabase() override;
+ QFontEngine *fontEngine(const QFontDef &fontDef, void *handle) override;
+ QFontEngine *fontEngine(const QByteArray &fontData, qreal pixelSize, QFont::HintingPreference hintingPreference) override;
+ QStringList addApplicationFont(const QByteArray &fontData, const QString &fileName, QFontDatabasePrivate::ApplicationFont *applicationFont = nullptr) override;
+ void releaseHandle(void *handle) override;
+ bool supportsVariableApplicationFonts() const override;
+
+ static void addNamedInstancesForFace(void *face, int faceIndex,
+ const QString &family, const QString &styleName,
+ QFont::Weight weight, QFont::Stretch stretch,
+ QFont::Style style, bool fixedPitch,
+ const QSupportedWritingSystems &writingSystems,
+ const QByteArray &fileName, const QByteArray &fontData);
+
+ static QStringList addTTFile(const QByteArray &fontData, const QByteArray &file, QFontDatabasePrivate::ApplicationFont *applicationFont = nullptr);
+};
+
+QT_END_NAMESPACE
+
+#endif // QFREETYPEFONTDATABASE_H
diff --git a/src/gui/text/qabstracttextdocumentlayout.cpp b/src/gui/text/qabstracttextdocumentlayout.cpp
index 8528f59844..3e5144b157 100644
--- a/src/gui/text/qabstracttextdocumentlayout.cpp
+++ b/src/gui/text/qabstracttextdocumentlayout.cpp
@@ -1,41 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the QtGui module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#include <qabstracttextdocumentlayout.h>
#include <qtextformat.h>
@@ -53,7 +17,6 @@ QAbstractTextDocumentLayoutPrivate::~QAbstractTextDocumentLayoutPrivate()
QTextObjectInterface::~QTextObjectInterface()
{
- // must be empty until ### Qt 6
}
/*!
@@ -138,7 +101,7 @@ QTextObjectInterface::~QTextObjectInterface()
\warning Copy and Paste operations ignore custom text objects.
- \sa {Text Object Example}, QTextCharFormat, QTextLayout
+ \sa QTextCharFormat, QTextLayout
*/
/*!
@@ -358,7 +321,7 @@ QTextObjectInterface::~QTextObjectInterface()
\brief the collection of selections that will be rendered when passing this
paint context to QAbstractTextDocumentLayout's draw() function.
- The default value is an empty vector indicating no selection.
+ The default value is an empty list indicating no selection.
*/
/*!
@@ -436,7 +399,8 @@ void QAbstractTextDocumentLayout::registerHandler(int objectType, QObject *compo
if (!iface)
return; // ### print error message on terminal?
- connect(component, SIGNAL(destroyed(QObject*)), this, SLOT(_q_handlerDestroyed(QObject*)));
+ QObjectPrivate::connect(component, &QObject::destroyed, d,
+ &QAbstractTextDocumentLayoutPrivate::_q_handlerDestroyed);
QTextObjectHandler h;
h.iface = iface;
@@ -457,7 +421,8 @@ void QAbstractTextDocumentLayout::unregisterHandler(int objectType, QObject *com
const auto it = d->handlers.constFind(objectType);
if (it != d->handlers.cend() && (!component || component == it->component)) {
if (component)
- disconnect(component, SIGNAL(destroyed(QObject*)), this, SLOT(_q_handlerDestroyed(QObject*)));
+ QObjectPrivate::disconnect(component, &QObject::destroyed, d,
+ &QAbstractTextDocumentLayoutPrivate::_q_handlerDestroyed);
d->handlers.erase(it);
}
}
@@ -568,7 +533,7 @@ void QAbstractTextDocumentLayoutPrivate::_q_handlerDestroyed(QObject *obj)
*/
int QAbstractTextDocumentLayout::formatIndex(int pos)
{
- QTextDocumentPrivate *pieceTable = qobject_cast<QTextDocument *>(parent())->docHandle();
+ QTextDocumentPrivate *pieceTable = QTextDocumentPrivate::get(qobject_cast<QTextDocument *>(parent()));
return pieceTable->find(pos).value()->format;
}
@@ -579,7 +544,7 @@ int QAbstractTextDocumentLayout::formatIndex(int pos)
*/
QTextCharFormat QAbstractTextDocumentLayout::format(int pos)
{
- QTextDocumentPrivate *pieceTable = qobject_cast<QTextDocument *>(parent())->docHandle();
+ QTextDocumentPrivate *pieceTable = QTextDocumentPrivate::get(qobject_cast<QTextDocument *>(parent()));
int idx = pieceTable->find(pos).value()->format;
return pieceTable->formatCollection()->charFormat(idx);
}
@@ -637,7 +602,7 @@ QTextFormat QAbstractTextDocumentLayout::formatAt(const QPointF &pos) const
if (blockBr.contains(pos)) {
QTextLayout *layout = block.layout();
int relativeCursorPos = cursorPos - block.position();
- const int preeditLength = layout ? layout->preeditAreaText().length() : 0;
+ const int preeditLength = layout ? layout->preeditAreaText().size() : 0;
if (preeditLength > 0 && relativeCursorPos > layout->preeditAreaPosition())
cursorPos -= qMin(cursorPos - layout->preeditAreaPosition(), preeditLength);
break;
@@ -645,7 +610,7 @@ QTextFormat QAbstractTextDocumentLayout::formatAt(const QPointF &pos) const
block = block.next();
}
- QTextDocumentPrivate *pieceTable = qobject_cast<const QTextDocument *>(parent())->docHandle();
+ const QTextDocumentPrivate *pieceTable = QTextDocumentPrivate::get(qobject_cast<const QTextDocument *>(parent()));
QTextDocumentPrivate::FragmentIterator it = pieceTable->find(cursorPos);
return pieceTable->formatCollection()->format(it->format);
}
diff --git a/src/gui/text/qabstracttextdocumentlayout.h b/src/gui/text/qabstracttextdocumentlayout.h
index 397dcd37d4..dfafb1098f 100644
--- a/src/gui/text/qabstracttextdocumentlayout.h
+++ b/src/gui/text/qabstracttextdocumentlayout.h
@@ -1,41 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the QtGui module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#ifndef QABSTRACTTEXTDOCUMENTLAYOUT_H
#define QABSTRACTTEXTDOCUMENTLAYOUT_H
@@ -78,7 +42,7 @@ public:
int cursorPosition;
QPalette palette;
QRectF clip;
- QVector<Selection> selections;
+ QList<Selection> selections;
};
virtual void draw(QPainter *painter, const PaintContext &context) = 0;
@@ -129,7 +93,6 @@ private:
friend class QTextEngine;
friend class QTextLayout;
friend class QTextLine;
- Q_PRIVATE_SLOT(d_func(), void _q_handlerDestroyed(QObject *obj))
Q_PRIVATE_SLOT(d_func(), int _q_dynamicPageCountSlot())
Q_PRIVATE_SLOT(d_func(), QSizeF _q_dynamicDocumentSizeSlot())
};
@@ -144,7 +107,7 @@ public:
virtual void drawObject(QPainter *painter, const QRectF &rect, QTextDocument *doc, int posInDocument, const QTextFormat &format) = 0;
};
-#ifndef Q_CLANG_QDOC
+#ifndef Q_QDOC
Q_DECLARE_INTERFACE(QTextObjectInterface, "org.qt-project.Qt.QTextObjectInterface")
#endif
diff --git a/src/gui/text/qabstracttextdocumentlayout_p.h b/src/gui/text/qabstracttextdocumentlayout_p.h
index d631ce3197..6bd42d78d8 100644
--- a/src/gui/text/qabstracttextdocumentlayout_p.h
+++ b/src/gui/text/qabstracttextdocumentlayout_p.h
@@ -1,41 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the QtGui module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#ifndef QABSTRACTTEXTDOCUMENTLAYOUT_P_H
#define QABSTRACTTEXTDOCUMENTLAYOUT_P_H
@@ -53,7 +17,11 @@
#include <QtGui/private/qtguiglobal_p.h>
#include "private/qobject_p.h"
+#include "qtextdocument_p.h"
+#include "qabstracttextdocumentlayout.h"
+
#include "QtCore/qhash.h"
+#include <QtCore/qpointer.h>
QT_BEGIN_NAMESPACE
@@ -78,7 +46,17 @@ public:
document = doc;
docPrivate = nullptr;
if (doc)
- docPrivate = doc->docHandle();
+ docPrivate = QTextDocumentPrivate::get(doc);
+ }
+
+ static QAbstractTextDocumentLayoutPrivate *get(QAbstractTextDocumentLayout *layout)
+ {
+ return layout->d_func();
+ }
+
+ bool hasHandlers() const
+ {
+ return !handlers.isEmpty();
}
inline int _q_dynamicPageCountSlot() const
diff --git a/src/gui/text/qcssparser.cpp b/src/gui/text/qcssparser.cpp
index c0b0071e4d..916e96ea63 100644
--- a/src/gui/text/qcssparser.cpp
+++ b/src/gui/text/qcssparser.cpp
@@ -1,44 +1,9 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the QtGui module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#include "qcssparser_p.h"
+#include <QtCore/qmap.h>
#include <qdebug.h>
#include <qicon.h>
#include <qcolor.h>
@@ -47,6 +12,7 @@
#include <qfontmetrics.h>
#include <qbrush.h>
#include <qimagereader.h>
+#include <qtextformat.h>
#include <algorithm>
@@ -54,6 +20,12 @@
QT_BEGIN_NAMESPACE
+using namespace Qt::StringLiterals;
+
+QT_IMPL_METATYPE_EXTERN_TAGGED(QCss::BackgroundData, QCss__BackgroundData)
+QT_IMPL_METATYPE_EXTERN_TAGGED(QCss::LengthData, QCss__LengthData)
+QT_IMPL_METATYPE_EXTERN_TAGGED(QCss::BorderData, QCss__BorderData)
+
#include "qcssscanner.cpp"
using namespace QCss;
@@ -68,14 +40,18 @@ static const QCssKnownValue properties[NumProperties - 1] = {
{ "-qt-background-role", QtBackgroundRole },
{ "-qt-block-indent", QtBlockIndent },
{ "-qt-fg-texture-cachekey", QtForegroundTextureCacheKey },
+ { "-qt-foreground", QtForeground },
{ "-qt-line-height-type", QtLineHeightType },
{ "-qt-list-indent", QtListIndent },
{ "-qt-list-number-prefix", QtListNumberPrefix },
{ "-qt-list-number-suffix", QtListNumberSuffix },
{ "-qt-paragraph-type", QtParagraphType },
+ { "-qt-stroke-color", QtStrokeColor },
+ { "-qt-stroke-width", QtStrokeWidth },
{ "-qt-style-features", QtStyleFeatures },
{ "-qt-table-type", QtTableType },
{ "-qt-user-state", QtUserState },
+ { "accent-color", QtAccent },
{ "alternate-background-color", QtAlternateBackground },
{ "background", Background },
{ "background-attachment", BackgroundAttachment },
@@ -127,6 +103,7 @@ static const QCssKnownValue properties[NumProperties - 1] = {
{ "image", QtImage },
{ "image-position", QtImageAlignment },
{ "left", Left },
+ { "letter-spacing", LetterSpacing },
{ "line-height", LineHeight },
{ "list-style", ListStyle },
{ "list-style-type", ListStyleType },
@@ -156,6 +133,7 @@ static const QCssKnownValue properties[NumProperties - 1] = {
{ "padding-top", PaddingTop },
{ "page-break-after", PageBreakAfter },
{ "page-break-before", PageBreakBefore },
+ { "placeholder-text-color", QtPlaceHolderTextColor },
{ "position", Position },
{ "right", Right },
{ "selection-background-color", QtSelectionBackground },
@@ -165,13 +143,15 @@ static const QCssKnownValue properties[NumProperties - 1] = {
{ "subcontrol-position", QtPosition },
{ "text-align", TextAlignment },
{ "text-decoration", TextDecoration },
+ { "text-decoration-color", TextDecorationColor },
{ "text-indent", TextIndent },
{ "text-transform", TextTransform },
{ "text-underline-style", TextUnderlineStyle },
{ "top", Top },
{ "vertical-align", VerticalAlignment },
{ "white-space", Whitespace },
- { "width", Width }
+ { "width", Width },
+ { "word-spacing", WordSpacing }
};
static const QCssKnownValue values[NumKnownValues - 1] = {
@@ -259,7 +239,7 @@ static const short indexOfId[NumKnownValues] = { 0, 41, 48, 42, 49, 50, 55, 35,
QString Value::toString() const
{
if (type == KnownIdentifier) {
- return QLatin1String(values[indexOfId[variant.toInt()]].name);
+ return QLatin1StringView(values[indexOfId[variant.toInt()]].name);
} else {
return variant.toString();
}
@@ -352,17 +332,17 @@ static const QCssKnownValue styleFeatures[NumKnownStyleFeatures - 1] = {
static bool operator<(const QString &name, const QCssKnownValue &prop)
{
- return QString::compare(name, QLatin1String(prop.name), Qt::CaseInsensitive) < 0;
+ return QString::compare(name, QLatin1StringView(prop.name), Qt::CaseInsensitive) < 0;
}
static bool operator<(const QCssKnownValue &prop, const QString &name)
{
- return QString::compare(QLatin1String(prop.name), name, Qt::CaseInsensitive) < 0;
+ return QString::compare(QLatin1StringView(prop.name), name, Qt::CaseInsensitive) < 0;
}
static quint64 findKnownValue(const QString &name, const QCssKnownValue *start, int numValues)
{
- const QCssKnownValue *end = &start[numValues - 1];
+ const QCssKnownValue *end = start + numValues - 1;
const QCssKnownValue *prop = std::lower_bound(start, end, name);
if ((prop == end) || (name < *prop))
return 0;
@@ -386,6 +366,8 @@ static inline bool isInheritable(Property propertyId)
case FontVariant:
case TextTransform:
case LineHeight:
+ case LetterSpacing:
+ case WordSpacing:
return true;
default:
break;
@@ -395,7 +377,7 @@ static inline bool isInheritable(Property propertyId)
///////////////////////////////////////////////////////////////////////////////
// Value Extractor
-ValueExtractor::ValueExtractor(const QVector<Declaration> &decls, const QPalette &pal)
+ValueExtractor::ValueExtractor(const QList<Declaration> &decls, const QPalette &pal)
: declarations(decls), adjustment(0), fontExtracted(false), pal(pal)
{
}
@@ -403,18 +385,20 @@ ValueExtractor::ValueExtractor(const QVector<Declaration> &decls, const QPalette
LengthData ValueExtractor::lengthValue(const Value& v)
{
const QString str = v.variant.toString();
- QStringRef s(&str);
+ QStringView s(str);
LengthData data;
data.unit = LengthData::None;
- if (s.endsWith(QLatin1String("px"), Qt::CaseInsensitive))
+ if (s.endsWith(u"px", Qt::CaseInsensitive))
data.unit = LengthData::Px;
- else if (s.endsWith(QLatin1String("ex"), Qt::CaseInsensitive))
+ else if (s.endsWith(u"ex", Qt::CaseInsensitive))
data.unit = LengthData::Ex;
- else if (s.endsWith(QLatin1String("em"), Qt::CaseInsensitive))
+ else if (s.endsWith(u"em", Qt::CaseInsensitive))
data.unit = LengthData::Em;
if (data.unit != LengthData::None)
s.chop(2);
+ else if (v.type == Value::Percentage)
+ data.unit = LengthData::Percent;
data.number = s.toDouble();
return data;
@@ -422,18 +406,26 @@ LengthData ValueExtractor::lengthValue(const Value& v)
static int lengthValueFromData(const LengthData& data, const QFont& f)
{
- if (data.unit == LengthData::Ex)
- return qRound(QFontMetrics(f).xHeight() * data.number);
- else if (data.unit == LengthData::Em)
- return qRound(QFontMetrics(f).height() * data.number);
- return qRound(data.number);
+ const int scale = (data.unit == LengthData::Ex ? QFontMetrics(f).xHeight()
+ : data.unit == LengthData::Em ? QFontMetrics(f).height() : 1);
+ // raised lower limit due to the implementation of qRound()
+ return qRound(qBound(double(INT_MIN) + 0.1, scale * data.number, double(INT_MAX)));
+}
+
+QTextLength ValueExtractor::textLength(const Declaration &decl)
+{
+ const LengthData data = lengthValue(decl.d->values.at(0));
+ if (data.unit == LengthData::Percent)
+ return QTextLength(QTextLength::PercentageLength, data.number);
+
+ return QTextLength(QTextLength::FixedLength, lengthValueFromData(data, f));
}
int ValueExtractor::lengthValue(const Declaration &decl)
{
if (decl.d->parsed.isValid())
return lengthValueFromData(qvariant_cast<LengthData>(decl.d->parsed), f);
- if (decl.d->values.count() < 1)
+ if (decl.d->values.size() < 1)
return 0;
LengthData data = lengthValue(decl.d->values.at(0));
decl.d->parsed = QVariant::fromValue<LengthData>(data);
@@ -452,7 +444,7 @@ void ValueExtractor::lengthValues(const Declaration &decl, int *m)
LengthData datas[4];
int i;
- for (i = 0; i < qMin(decl.d->values.count(), 4); i++)
+ for (i = 0; i < qMin(decl.d->values.size(), 4); i++)
datas[i] = lengthValue(decl.d->values[i]);
if (i == 0) {
@@ -480,7 +472,7 @@ bool ValueExtractor::extractGeometry(int *w, int *h, int *minw, int *minh, int *
{
extractFont();
bool hit = false;
- for (int i = 0; i < declarations.count(); i++) {
+ for (int i = 0; i < declarations.size(); i++) {
const Declaration &decl = declarations.at(i);
switch (decl.d->propertyId) {
case Width: *w = lengthValue(decl); break;
@@ -502,7 +494,7 @@ bool ValueExtractor::extractPosition(int *left, int *top, int *right, int *botto
{
extractFont();
bool hit = false;
- for (int i = 0; i < declarations.count(); i++) {
+ for (int i = 0; i < declarations.size(); i++) {
const Declaration &decl = declarations.at(i);
switch (decl.d->propertyId) {
case Left: *left = lengthValue(decl); break;
@@ -525,7 +517,7 @@ bool ValueExtractor::extractBox(int *margins, int *paddings, int *spacing)
{
extractFont();
bool hit = false;
- for (int i = 0; i < declarations.count(); i++) {
+ for (int i = 0; i < declarations.size(); i++) {
const Declaration &decl = declarations.at(i);
switch (decl.d->propertyId) {
case PaddingLeft: paddings[LeftEdge] = lengthValue(decl); break;
@@ -552,7 +544,7 @@ bool ValueExtractor::extractBox(int *margins, int *paddings, int *spacing)
int ValueExtractor::extractStyleFeatures()
{
int features = StyleFeature_None;
- for (int i = 0; i < declarations.count(); i++) {
+ for (int i = 0; i < declarations.size(); i++) {
const Declaration &decl = declarations.at(i);
if (decl.d->propertyId == QtStyleFeatures)
features = decl.styleFeaturesValue();
@@ -569,9 +561,9 @@ QSize ValueExtractor::sizeValue(const Declaration &decl)
}
LengthData x[2] = { {0, LengthData::None }, {0, LengthData::None} };
- if (decl.d->values.count() > 0)
+ if (decl.d->values.size() > 0)
x[0] = lengthValue(decl.d->values.at(0));
- if (decl.d->values.count() > 1)
+ if (decl.d->values.size() > 1)
x[1] = lengthValue(decl.d->values.at(1));
else
x[1] = x[0];
@@ -593,7 +585,7 @@ bool ValueExtractor::extractBorder(int *borders, QBrush *colors, BorderStyle *st
{
extractFont();
bool hit = false;
- for (int i = 0; i < declarations.count(); i++) {
+ for (int i = 0; i < declarations.size(); i++) {
const Declaration &decl = declarations.at(i);
switch (decl.d->propertyId) {
case BorderLeftWidth: borders[LeftEdge] = lengthValue(decl); break;
@@ -652,7 +644,7 @@ bool ValueExtractor::extractOutline(int *borders, QBrush *colors, BorderStyle *s
{
extractFont();
bool hit = false;
- for (int i = 0; i < declarations.count(); i++) {
+ for (int i = 0; i < declarations.size(); i++) {
const Declaration &decl = declarations.at(i);
switch (decl.d->propertyId) {
case OutlineWidth: lengthValues(decl, borders); break;
@@ -707,7 +699,7 @@ static Qt::Alignment parseAlignment(const QCss::Value *values, int count)
static ColorData parseColorValue(QCss::Value v)
{
if (v.type == Value::Identifier || v.type == Value::String) {
- v.variant.convert(QVariant::Color);
+ v.variant.convert(QMetaType::fromType<QColor>());
v.type = Value::Color;
}
@@ -721,11 +713,11 @@ static ColorData parseColorValue(QCss::Value v)
return ColorData();
QStringList lst = v.variant.toStringList();
- if (lst.count() != 2)
+ if (lst.size() != 2)
return ColorData();
const QString &identifier = lst.at(0);
- if ((identifier.compare(QLatin1String("palette"), Qt::CaseInsensitive)) == 0) {
+ if ((identifier.compare("palette"_L1, Qt::CaseInsensitive)) == 0) {
int role = findKnownValue(lst.at(1).trimmed(), values, NumKnownValues);
if (role >= Value_FirstColorRole && role <= Value_LastColorRole)
return (QPalette::ColorRole)(role-Value_FirstColorRole);
@@ -733,14 +725,14 @@ static ColorData parseColorValue(QCss::Value v)
return ColorData();
}
- const bool rgb = identifier.startsWith(QLatin1String("rgb"));
- const bool hsv = !rgb && identifier.startsWith(QLatin1String("hsv"));
- const bool hsl = !rgb && !hsv && identifier.startsWith(QLatin1String("hsl"));
+ const bool rgb = identifier.startsWith("rgb"_L1);
+ const bool hsv = !rgb && identifier.startsWith("hsv"_L1);
+ const bool hsl = !rgb && !hsv && identifier.startsWith("hsl"_L1);
if (!rgb && !hsv && !hsl)
return ColorData();
- const bool hasAlpha = identifier.size() == 4 && identifier.at(3) == QLatin1Char('a');
+ const bool hasAlpha = identifier.size() == 4 && identifier.at(3) == u'a';
if (identifier.size() > 3 && !hasAlpha)
return ColorData();
@@ -748,10 +740,10 @@ static ColorData parseColorValue(QCss::Value v)
if (!p.testExpr())
return ColorData();
- QVector<QCss::Value> colorDigits;
+ QList<QCss::Value> colorDigits;
if (!p.parseExpr(&colorDigits))
return ColorData();
- const int tokenCount = colorDigits.count();
+ const int tokenCount = colorDigits.size();
for (int i = 0; i < qMin(tokenCount, 7); i += 2) {
if (colorDigits.at(i).type == Value::Percentage) {
@@ -767,11 +759,14 @@ static ColorData parseColorValue(QCss::Value v)
if (tokenCount < 5)
return ColorData();
- // ### Qt6: replace this with a check and return invalid color when token count does not match
- if (hasAlpha && tokenCount != 7)
- qWarning("QCssParser::parseColorValue: Specified color with alpha value but no alpha given: '%s'", qPrintable(lst.join(QLatin1Char(' '))));
- if (!hasAlpha && tokenCount != 5)
- qWarning("QCssParser::parseColorValue: Specified color without alpha value but alpha given: '%s'", qPrintable(lst.join(QLatin1Char(' '))));
+ if (hasAlpha && tokenCount != 7) {
+ qWarning("QCssParser::parseColorValue: Specified color with alpha value but no alpha given: '%s'", qPrintable(lst.join(u' ')));
+ return ColorData();
+ }
+ if (!hasAlpha && tokenCount != 5) {
+ qWarning("QCssParser::parseColorValue: Specified color without alpha value but alpha given: '%s'", qPrintable(lst.join(u' ')));
+ return ColorData();
+ }
int v1 = colorDigits.at(0).variant.toInt();
int v2 = colorDigits.at(2).variant.toInt();
@@ -815,22 +810,26 @@ static BrushData parseBrushValue(const QCss::Value &v, const QPalette &pal)
return BrushData();
QStringList lst = v.variant.toStringList();
- if (lst.count() != 2)
+ if (lst.size() != 2)
return BrushData();
QStringList gradFuncs;
- gradFuncs << QLatin1String("qlineargradient") << QLatin1String("qradialgradient") << QLatin1String("qconicalgradient") << QLatin1String("qgradient");
+ gradFuncs << "qlineargradient"_L1 << "qradialgradient"_L1 << "qconicalgradient"_L1 << "qgradient"_L1;
int gradType = -1;
if ((gradType = gradFuncs.indexOf(lst.at(0).toLower())) == -1)
return BrushData();
QHash<QString, qreal> vars;
- QVector<QGradientStop> stops;
+ QList<QGradientStop> stops;
int spread = -1;
QStringList spreads;
- spreads << QLatin1String("pad") << QLatin1String("reflect") << QLatin1String("repeat");
+ spreads << "pad"_L1 << "reflect"_L1 << "repeat"_L1;
+
+ int coordinateMode = -1;
+ QStringList coordinateModes;
+ coordinateModes << "logical"_L1 << "stretchtodevice"_L1 << "objectbounding"_L1 << "object"_L1;
bool dependsOnThePalette = false;
Parser parser(lst.at(1));
@@ -843,7 +842,7 @@ static BrushData parseBrushValue(const QCss::Value &v, const QPalette &pal)
if (!parser.test(COLON))
return BrushData();
parser.skipSpace();
- if (attr.compare(QLatin1String("stop"), Qt::CaseInsensitive) == 0) {
+ if (attr.compare("stop"_L1, Qt::CaseInsensitive) == 0) {
QCss::Value stop, color;
parser.next();
if (!parser.parseTerm(&stop)) return BrushData();
@@ -851,27 +850,28 @@ static BrushData parseBrushValue(const QCss::Value &v, const QPalette &pal)
parser.next();
if (!parser.parseTerm(&color)) return BrushData();
ColorData cd = parseColorValue(color);
- if(cd.type == ColorData::Role)
+ if (cd.type == ColorData::Role)
dependsOnThePalette = true;
stops.append(QGradientStop(stop.variant.toReal(), colorFromData(cd, pal)));
} else {
parser.next();
QCss::Value value;
(void)parser.parseTerm(&value);
- if (attr.compare(QLatin1String("spread"), Qt::CaseInsensitive) == 0) {
+ if (attr.compare("spread"_L1, Qt::CaseInsensitive) == 0)
spread = spreads.indexOf(value.variant.toString());
- } else {
+ else if (attr.compare("coordinatemode"_L1, Qt::CaseInsensitive) == 0)
+ coordinateMode = coordinateModes.indexOf(value.variant.toString());
+ else
vars[attr] = value.variant.toReal();
- }
}
parser.skipSpace();
(void)parser.test(COMMA);
}
if (gradType == 0) {
- QLinearGradient lg(vars.value(QLatin1String("x1")), vars.value(QLatin1String("y1")),
- vars.value(QLatin1String("x2")), vars.value(QLatin1String("y2")));
- lg.setCoordinateMode(QGradient::ObjectBoundingMode);
+ QLinearGradient lg(vars.value("x1"_L1), vars.value("y1"_L1),
+ vars.value("x2"_L1), vars.value("y2"_L1));
+ lg.setCoordinateMode(coordinateMode < 0 ? QGradient::ObjectBoundingMode : QGradient::CoordinateMode(coordinateMode));
lg.setStops(stops);
if (spread != -1)
lg.setSpread(QGradient::Spread(spread));
@@ -882,10 +882,10 @@ static BrushData parseBrushValue(const QCss::Value &v, const QPalette &pal)
}
if (gradType == 1) {
- QRadialGradient rg(vars.value(QLatin1String("cx")), vars.value(QLatin1String("cy")),
- vars.value(QLatin1String("radius")), vars.value(QLatin1String("fx")),
- vars.value(QLatin1String("fy")));
- rg.setCoordinateMode(QGradient::ObjectBoundingMode);
+ QRadialGradient rg(vars.value("cx"_L1), vars.value("cy"_L1),
+ vars.value("radius"_L1), vars.value("fx"_L1),
+ vars.value("fy"_L1));
+ rg.setCoordinateMode(coordinateMode < 0 ? QGradient::ObjectBoundingMode : QGradient::CoordinateMode(coordinateMode));
rg.setStops(stops);
if (spread != -1)
rg.setSpread(QGradient::Spread(spread));
@@ -896,9 +896,8 @@ static BrushData parseBrushValue(const QCss::Value &v, const QPalette &pal)
}
if (gradType == 2) {
- QConicalGradient cg(vars.value(QLatin1String("cx")), vars.value(QLatin1String("cy")),
- vars.value(QLatin1String("angle")));
- cg.setCoordinateMode(QGradient::ObjectBoundingMode);
+ QConicalGradient cg(vars.value("cx"_L1), vars.value("cy"_L1), vars.value("angle"_L1));
+ cg.setCoordinateMode(coordinateMode < 0 ? QGradient::ObjectBoundingMode : QGradient::CoordinateMode(coordinateMode));
cg.setStops(stops);
if (spread != -1)
cg.setSpread(QGradient::Spread(spread));
@@ -982,7 +981,7 @@ void ValueExtractor::borderValue(const Declaration &decl, int *width, QCss::Bord
if (decl.d->values.at(i).type == Value::Length || decl.d->values.at(i).type == Value::Number) {
data.width = lengthValue(decl.d->values.at(i));
*width = lengthValueFromData(data.width, f);
- if (++i >= decl.d->values.count()) {
+ if (++i >= decl.d->values.size()) {
decl.d->parsed = QVariant::fromValue<BorderData>(data);
return;
}
@@ -991,7 +990,7 @@ void ValueExtractor::borderValue(const Declaration &decl, int *width, QCss::Bord
data.style = parseStyleValue(decl.d->values.at(i));
if (data.style != BorderStyle_Unknown) {
*style = data.style;
- if (++i >= decl.d->values.count()) {
+ if (++i >= decl.d->values.size()) {
decl.d->parsed = QVariant::fromValue<BorderData>(data);
return;
}
@@ -1000,19 +999,21 @@ void ValueExtractor::borderValue(const Declaration &decl, int *width, QCss::Bord
}
data.color = parseBrushValue(decl.d->values.at(i), pal);
- *color = brushFromData(data.color, pal);
- if (data.color.type != BrushData::DependsOnThePalette)
- decl.d->parsed = QVariant::fromValue<BorderData>(data);
+ if (data.color.type != BrushData::Invalid) {
+ *color = brushFromData(data.color, pal);
+ if (data.color.type != BrushData::DependsOnThePalette)
+ decl.d->parsed = QVariant::fromValue<BorderData>(data);
+ }
}
-static void parseShorthandBackgroundProperty(const QVector<QCss::Value> &values, BrushData *brush, QString *image, Repeat *repeat, Qt::Alignment *alignment, const QPalette &pal)
+static void parseShorthandBackgroundProperty(const QList<QCss::Value> &values, BrushData *brush, QString *image, Repeat *repeat, Qt::Alignment *alignment, const QPalette &pal)
{
*brush = BrushData();
*image = QString();
*repeat = Repeat_XY;
*alignment = Qt::AlignTop | Qt::AlignLeft;
- for (int i = 0; i < values.count(); ++i) {
+ for (int i = 0; i < values.size(); ++i) {
const QCss::Value &v = values.at(i);
if (v.type == Value::Uri) {
*image = v.variant.toString();
@@ -1034,7 +1035,7 @@ static void parseShorthandBackgroundProperty(const QVector<QCss::Value> &values,
if (v.type == Value::KnownIdentifier) {
const int start = i;
int count = 1;
- if (i < values.count() - 1
+ if (i < values.size() - 1
&& values.at(i + 1).type == Value::KnownIdentifier) {
++i;
++count;
@@ -1056,7 +1057,7 @@ bool ValueExtractor::extractBackground(QBrush *brush, QString *image, Repeat *re
Origin *clip)
{
bool hit = false;
- for (int i = 0; i < declarations.count(); ++i) {
+ for (int i = 0; i < declarations.size(); ++i) {
const Declaration &decl = declarations.at(i);
if (decl.d->values.isEmpty())
continue;
@@ -1133,18 +1134,18 @@ static bool setFontSizeFromValue(QCss::Value value, QFont *font, int *fontSizeAd
bool valid = false;
QString s = value.variant.toString();
- if (s.endsWith(QLatin1String("pt"), Qt::CaseInsensitive)) {
+ if (s.endsWith("pt"_L1, Qt::CaseInsensitive)) {
s.chop(2);
value.variant = s;
- if (value.variant.convert((QVariant::Type)qMetaTypeId<qreal>())) {
- font->setPointSizeF(value.variant.toReal());
+ if (value.variant.convert(QMetaType::fromType<qreal>())) {
+ font->setPointSizeF(qBound(qreal(0), value.variant.toReal(), qreal(1 << 24) - 1));
valid = true;
}
- } else if (s.endsWith(QLatin1String("px"), Qt::CaseInsensitive)) {
+ } else if (s.endsWith("px"_L1, Qt::CaseInsensitive)) {
s.chop(2);
value.variant = s;
- if (value.variant.convert(QVariant::Int)) {
- font->setPixelSize(value.variant.toInt());
+ if (value.variant.convert(QMetaType::fromType<int>())) {
+ font->setPixelSize(qBound(0, value.variant.toInt(), (1 << 24) - 1));
valid = true;
}
}
@@ -1189,7 +1190,8 @@ static bool setFontWeightFromValue(const QCss::Value &value, QFont *font)
}
if (value.type != Value::Number)
return false;
- font->setWeight(qMin(value.variant.toInt() / 8, 99));
+ // .toInt() would call qRound64() and might overflow the long long there
+ font->setWeight(QFont::Weight(qRound(qBound(0.0, value.variant.toDouble(), 1001.0))));
return true;
}
@@ -1198,12 +1200,12 @@ static bool setFontWeightFromValue(const QCss::Value &value, QFont *font)
* and set it the \a font
* The function returns \c true if a family was extracted.
*/
-static bool setFontFamilyFromValues(const QVector<QCss::Value> &values, QFont *font, int start = 0)
+static bool setFontFamilyFromValues(const QList<QCss::Value> &values, QFont *font, int start = 0)
{
QString family;
QStringList families;
bool shouldAddSpace = false;
- for (int i = start; i < values.count(); ++i) {
+ for (int i = start; i < values.size(); ++i) {
const QCss::Value &v = values.at(i);
if (v.type == Value::TermOperatorComma) {
families << family;
@@ -1215,7 +1217,7 @@ static bool setFontFamilyFromValues(const QVector<QCss::Value> &values, QFont *f
if (str.isEmpty())
break;
if (shouldAddSpace)
- family += QLatin1Char(' ');
+ family += u' ';
family += str;
shouldAddSpace = true;
}
@@ -1223,14 +1225,13 @@ static bool setFontFamilyFromValues(const QVector<QCss::Value> &values, QFont *f
families << family;
if (families.isEmpty())
return false;
- font->setFamily(families.at(0));
font->setFamilies(families);
return true;
}
-static void setTextDecorationFromValues(const QVector<QCss::Value> &values, QFont *font)
+static void setTextDecorationFromValues(const QList<QCss::Value> &values, QFont *font)
{
- for (int i = 0; i < values.count(); ++i) {
+ for (int i = 0; i < values.size(); ++i) {
if (values.at(i).type != Value::KnownIdentifier)
continue;
switch (values.at(i).variant.toInt()) {
@@ -1247,14 +1248,45 @@ static void setTextDecorationFromValues(const QVector<QCss::Value> &values, QFon
}
}
-static void parseShorthandFontProperty(const QVector<QCss::Value> &values, QFont *font, int *fontSizeAdjustment)
+static void setLetterSpacingFromValue(const QCss::Value &value, QFont *font)
+{
+ QString s = value.variant.toString();
+ qreal val;
+ bool ok = false;
+ if (s.endsWith("em"_L1, Qt::CaseInsensitive)) {
+ s.chop(2);
+ val = s.toDouble(&ok);
+ if (ok)
+ font->setLetterSpacing(QFont::PercentageSpacing, (val + 1.0) * 100);
+ } else if (s.endsWith("px"_L1, Qt::CaseInsensitive)) {
+ s.chop(2);
+ val = s.toDouble(&ok);
+ if (ok)
+ font->setLetterSpacing(QFont::AbsoluteSpacing, val);
+ }
+}
+
+static void setWordSpacingFromValue(const QCss::Value &value, QFont *font)
+{
+ QString s = value.variant.toString();
+ if (s.endsWith("px"_L1, Qt::CaseInsensitive)) {
+ s.chop(2);
+ qreal val;
+ bool ok = false;
+ val = s.toDouble(&ok);
+ if (ok)
+ font->setWordSpacing(val);
+ }
+}
+
+static void parseShorthandFontProperty(const QList<QCss::Value> &values, QFont *font, int *fontSizeAdjustment)
{
font->setStyle(QFont::StyleNormal);
font->setWeight(QFont::Normal);
*fontSizeAdjustment = -255;
int i = 0;
- while (i < values.count()) {
+ while (i < values.size()) {
if (setFontStyleFromValue(values.at(i), font)
|| setFontWeightFromValue(values.at(i), font))
++i;
@@ -1262,12 +1294,12 @@ static void parseShorthandFontProperty(const QVector<QCss::Value> &values, QFont
break;
}
- if (i < values.count()) {
+ if (i < values.size()) {
setFontSizeFromValue(values.at(i), font, fontSizeAdjustment);
++i;
}
- if (i < values.count()) {
+ if (i < values.size()) {
setFontFamilyFromValues(values, font, i);
}
}
@@ -1304,7 +1336,7 @@ bool ValueExtractor::extractFont(QFont *font, int *fontSizeAdjustment)
}
bool hit = false;
- for (int i = 0; i < declarations.count(); ++i) {
+ for (int i = 0; i < declarations.size(); ++i) {
const Declaration &decl = declarations.at(i);
if (decl.d->values.isEmpty())
continue;
@@ -1319,6 +1351,8 @@ bool ValueExtractor::extractFont(QFont *font, int *fontSizeAdjustment)
case Font: parseShorthandFontProperty(decl.d->values, font, fontSizeAdjustment); break;
case FontVariant: setFontVariantFromValue(val, font); break;
case TextTransform: setTextTransformFromValue(val, font); break;
+ case LetterSpacing: setLetterSpacingFromValue(val, font); break;
+ case WordSpacing: setWordSpacingFromValue(val, font); break;
default: continue;
}
hit = true;
@@ -1330,16 +1364,23 @@ bool ValueExtractor::extractFont(QFont *font, int *fontSizeAdjustment)
return hit;
}
-bool ValueExtractor::extractPalette(QBrush *fg, QBrush *sfg, QBrush *sbg, QBrush *abg)
+bool ValueExtractor::extractPalette(QBrush *foreground,
+ QBrush *selectedForeground,
+ QBrush *selectedBackground,
+ QBrush *alternateBackground,
+ QBrush *placeHolderTextForeground,
+ QBrush *accent)
{
bool hit = false;
- for (int i = 0; i < declarations.count(); ++i) {
+ for (int i = 0; i < declarations.size(); ++i) {
const Declaration &decl = declarations.at(i);
switch (decl.d->propertyId) {
- case Color: *fg = decl.brushValue(pal); break;
- case QtSelectionForeground: *sfg = decl.brushValue(pal); break;
- case QtSelectionBackground: *sbg = decl.brushValue(pal); break;
- case QtAlternateBackground: *abg = decl.brushValue(pal); break;
+ case Color: *foreground = decl.brushValue(pal); break;
+ case QtSelectionForeground: *selectedForeground = decl.brushValue(pal); break;
+ case QtSelectionBackground: *selectedBackground = decl.brushValue(pal); break;
+ case QtAlternateBackground: *alternateBackground = decl.brushValue(pal); break;
+ case QtPlaceHolderTextColor: *placeHolderTextForeground = decl.brushValue(pal); break;
+ case QtAccent: *accent = decl.brushValue(pal); break;
default: continue;
}
hit = true;
@@ -1358,12 +1399,12 @@ void ValueExtractor::extractFont()
bool ValueExtractor::extractImage(QIcon *icon, Qt::Alignment *a, QSize *size)
{
bool hit = false;
- for (int i = 0; i < declarations.count(); ++i) {
+ for (int i = 0; i < declarations.size(); ++i) {
const Declaration &decl = declarations.at(i);
switch (decl.d->propertyId) {
case QtImage:
*icon = decl.iconValue();
- if (decl.d->values.count() > 0 && decl.d->values.at(0).type == Value::Uri) {
+ if (decl.d->values.size() > 0 && decl.d->values.at(0).type == Value::Uri) {
// try to pull just the size from the image...
QImageReader imageReader(decl.d->values.at(0).variant.toString());
if ((*size = imageReader.size()).isNull()) {
@@ -1416,18 +1457,27 @@ bool ValueExtractor::extractIcon(QIcon *icon, QSize *size)
// Declaration
QColor Declaration::colorValue(const QPalette &pal) const
{
- if (d->values.count() != 1)
+ if (d->values.size() != 1)
return QColor();
if (d->parsed.isValid()) {
- if (d->parsed.type() == QVariant::Color)
+ switch (d->parsed.typeId()) {
+ case qMetaTypeId<QColor>():
return qvariant_cast<QColor>(d->parsed);
- if (d->parsed.type() == QVariant::Int)
+ case qMetaTypeId<int>():
return pal.color((QPalette::ColorRole)(d->parsed.toInt()));
+ case qMetaTypeId<QList<QVariant>>():
+ if (d->parsed.toList().size() == 1) {
+ auto parsedList = d->parsed.toList();
+ const auto &value = parsedList.at(0);
+ return qvariant_cast<QColor>(value);
+ }
+ break;
+ }
}
ColorData color = parseColorValue(d->values.at(0));
- if(color.type == ColorData::Role) {
+ if (color.type == ColorData::Role) {
d->parsed = QVariant::fromValue<int>(color.role);
return pal.color((QPalette::ColorRole)(color.role));
} else {
@@ -1438,19 +1488,19 @@ QColor Declaration::colorValue(const QPalette &pal) const
QBrush Declaration::brushValue(const QPalette &pal) const
{
- if (d->values.count() != 1)
+ if (d->values.size() != 1)
return QBrush();
if (d->parsed.isValid()) {
- if (d->parsed.type() == QVariant::Brush)
+ if (d->parsed.userType() == QMetaType::QBrush)
return qvariant_cast<QBrush>(d->parsed);
- if (d->parsed.type() == QVariant::Int)
+ if (d->parsed.userType() == QMetaType::Int)
return pal.color((QPalette::ColorRole)(d->parsed.toInt()));
}
BrushData data = parseBrushValue(d->values.at(0), pal);
- if(data.type == BrushData::Role) {
+ if (data.type == BrushData::Role) {
d->parsed = QVariant::fromValue<int>(data.role);
return pal.color((QPalette::ColorRole)(data.role));
} else {
@@ -1467,11 +1517,12 @@ void Declaration::brushValues(QBrush *c, const QPalette &pal) const
int i = 0;
if (d->parsed.isValid()) {
needParse = 0;
+ Q_ASSERT(d->parsed.metaType() == QMetaType::fromType<QList<QVariant>>());
QList<QVariant> v = d->parsed.toList();
- for (i = 0; i < qMin(v.count(), 4); i++) {
- if (v.at(i).type() == QVariant::Brush) {
+ for (i = 0; i < qMin(v.size(), 4); i++) {
+ if (v.at(i).userType() == QMetaType::QBrush) {
c[i] = qvariant_cast<QBrush>(v.at(i));
- } else if (v.at(i).type() == QVariant::Int) {
+ } else if (v.at(i).userType() == QMetaType::Int) {
c[i] = pal.color((QPalette::ColorRole)(v.at(i).toInt()));
} else {
needParse |= (1<<i);
@@ -1480,11 +1531,11 @@ void Declaration::brushValues(QBrush *c, const QPalette &pal) const
}
if (needParse != 0) {
QList<QVariant> v;
- for (i = 0; i < qMin(d->values.count(), 4); i++) {
+ for (i = 0; i < qMin(d->values.size(), 4); i++) {
if (!(needParse & (1<<i)))
continue;
BrushData data = parseBrushValue(d->values.at(i), pal);
- if(data.type == BrushData::Role) {
+ if (data.type == BrushData::Role) {
v += QVariant::fromValue<int>(data.role);
c[i] = pal.color((QPalette::ColorRole)(data.role));
} else {
@@ -1507,15 +1558,15 @@ void Declaration::brushValues(QBrush *c, const QPalette &pal) const
bool Declaration::realValue(qreal *real, const char *unit) const
{
- if (d->values.count() != 1)
+ if (d->values.size() != 1)
return false;
const Value &v = d->values.at(0);
if (unit && v.type != Value::Length)
return false;
const QString str = v.variant.toString();
- QStringRef s(&str);
+ QStringView s(str);
if (unit) {
- const QLatin1String unitStr(unit);
+ const QLatin1StringView unitStr(unit);
if (!s.endsWith(unitStr, Qt::CaseInsensitive))
return false;
s.chop(unitStr.size());
@@ -1532,9 +1583,9 @@ static bool intValueHelper(const QCss::Value &v, int *i, const char *unit)
if (unit && v.type != Value::Length)
return false;
const QString str = v.variant.toString();
- QStringRef s(&str);
+ QStringView s(str);
if (unit) {
- const QLatin1String unitStr(unit);
+ const QLatin1StringView unitStr(unit);
if (!s.endsWith(unitStr, Qt::CaseInsensitive))
return false;
s.chop(unitStr.size());
@@ -1548,7 +1599,7 @@ static bool intValueHelper(const QCss::Value &v, int *i, const char *unit)
bool Declaration::intValue(int *i, const char *unit) const
{
- if (d->values.count() != 1)
+ if (d->values.size() != 1)
return false;
return intValueHelper(d->values.at(0), i, unit);
}
@@ -1559,11 +1610,25 @@ QSize Declaration::sizeValue() const
return qvariant_cast<QSize>(d->parsed);
int x[2] = { 0, 0 };
- if (d->values.count() > 0)
- intValueHelper(d->values.at(0), &x[0], "px");
- if (d->values.count() > 1)
- intValueHelper(d->values.at(1), &x[1], "px");
- else
+ const int count = d->values.size();
+ for (int i = 0; i < count; ++i) {
+ if (i > 1) {
+ qWarning("QCssParser::sizeValue: Too many values provided");
+ break;
+ }
+ const auto &value = d->values.at(i);
+ const QString valueString = value.variant.toString();
+ if (valueString.endsWith(u"pt", Qt::CaseInsensitive)) {
+ intValueHelper(value, &x[i], "pt");
+ // according to https://www.w3.org/TR/css3-values/#absolute-lengths
+ // 1pt = 1/72th of 1 inch, and 1px = 1/96th of 1 inch
+ x[i] = (x[i] * 72) / 96;
+ } else {
+ // by default we use 'px'
+ intValueHelper(value, &x[i], "px");
+ }
+ }
+ if (count == 1)
x[1] = x[0];
QSize size(x[0], x[1]);
d->parsed = QVariant::fromValue<QSize>(size);
@@ -1572,7 +1637,7 @@ QSize Declaration::sizeValue() const
QRect Declaration::rectValue() const
{
- if (d->values.count() != 1)
+ if (d->values.size() != 1)
return QRect();
if (d->parsed.isValid())
@@ -1582,10 +1647,10 @@ QRect Declaration::rectValue() const
if (v.type != Value::Function)
return QRect();
const QStringList func = v.variant.toStringList();
- if (func.count() != 2 || func.at(0).compare(QLatin1String("rect")) != 0)
+ if (func.size() != 2 || func.at(0).compare("rect"_L1) != 0)
return QRect();
- const auto args = func[1].splitRef(QLatin1Char(' '), QString::SkipEmptyParts);
- if (args.count() != 4)
+ const auto args = QStringView{func[1]}.split(u' ', Qt::SkipEmptyParts);
+ if (args.size() != 4)
return QRect();
QRect rect(args[0].toInt(), args[1].toInt(), args[2].toInt(), args[3].toInt());
d->parsed = QVariant::fromValue<QRect>(rect);
@@ -1597,8 +1662,8 @@ void Declaration::colorValues(QColor *c, const QPalette &pal) const
int i;
if (d->parsed.isValid()) {
QList<QVariant> v = d->parsed.toList();
- for (i = 0; i < qMin(d->values.count(), 4); i++) {
- if (v.at(i).type() == QVariant::Color) {
+ for (i = 0; i < qMin(d->values.size(), 4); i++) {
+ if (v.at(i).userType() == QMetaType::QColor) {
c[i] = qvariant_cast<QColor>(v.at(i));
} else {
c[i] = pal.color((QPalette::ColorRole)(v.at(i).toInt()));
@@ -1606,9 +1671,9 @@ void Declaration::colorValues(QColor *c, const QPalette &pal) const
}
} else {
QList<QVariant> v;
- for (i = 0; i < qMin(d->values.count(), 4); i++) {
+ for (i = 0; i < qMin(d->values.size(), 4); i++) {
ColorData color = parseColorValue(d->values.at(i));
- if(color.type == ColorData::Role) {
+ if (color.type == ColorData::Role) {
v += QVariant::fromValue<int>(color.role);
c[i] = pal.color((QPalette::ColorRole)(color.role));
} else {
@@ -1627,7 +1692,7 @@ void Declaration::colorValues(QColor *c, const QPalette &pal) const
BorderStyle Declaration::styleValue() const
{
- if (d->values.count() != 1)
+ if (d->values.size() != 1)
return BorderStyle_None;
return parseStyleValue(d->values.at(0));
}
@@ -1635,7 +1700,7 @@ BorderStyle Declaration::styleValue() const
void Declaration::styleValues(BorderStyle *s) const
{
int i;
- for (i = 0; i < qMin(d->values.count(), 4); i++)
+ for (i = 0; i < qMin(d->values.size(), 4); i++)
s[i] = parseStyleValue(d->values.at(i));
if (i == 0) s[0] = s[1] = s[2] = s[3] = BorderStyle_None;
else if (i == 1) s[3] = s[2] = s[1] = s[0];
@@ -1647,7 +1712,7 @@ Repeat Declaration::repeatValue() const
{
if (d->parsed.isValid())
return static_cast<Repeat>(d->parsed.toInt());
- if (d->values.count() != 1)
+ if (d->values.size() != 1)
return Repeat_Unknown;
int v = findKnownValue(d->values.at(0).variant.toString(),
repeats, NumKnownRepeats);
@@ -1659,7 +1724,7 @@ Origin Declaration::originValue() const
{
if (d->parsed.isValid())
return static_cast<Origin>(d->parsed.toInt());
- if (d->values.count() != 1)
+ if (d->values.size() != 1)
return Origin_Unknown;
int v = findKnownValue(d->values.at(0).variant.toString(),
origins, NumKnownOrigins);
@@ -1671,7 +1736,7 @@ PositionMode Declaration::positionValue() const
{
if (d->parsed.isValid())
return static_cast<PositionMode>(d->parsed.toInt());
- if (d->values.count() != 1)
+ if (d->values.size() != 1)
return PositionMode_Unknown;
int v = findKnownValue(d->values.at(0).variant.toString(),
positions, NumKnownPositionModes);
@@ -1683,7 +1748,7 @@ Attachment Declaration::attachmentValue() const
{
if (d->parsed.isValid())
return static_cast<Attachment>(d->parsed.toInt());
- if (d->values.count() != 1)
+ if (d->values.size() != 1)
return Attachment_Unknown;
int v = findKnownValue(d->values.at(0).variant.toString(),
attachments, NumKnownAttachments);
@@ -1697,7 +1762,7 @@ int Declaration::styleFeaturesValue() const
if (d->parsed.isValid())
return d->parsed.toInt();
int features = StyleFeature_None;
- for (int i = 0; i < d->values.count(); i++) {
+ for (int i = 0; i < d->values.size(); i++) {
features |= static_cast<int>(findKnownValue(d->values.value(i).variant.toString(),
styleFeatures, NumKnownStyleFeatures));
}
@@ -1716,10 +1781,10 @@ Qt::Alignment Declaration::alignmentValue() const
{
if (d->parsed.isValid())
return Qt::Alignment(d->parsed.toInt());
- if (d->values.isEmpty() || d->values.count() > 2)
+ if (d->values.isEmpty() || d->values.size() > 2)
return Qt::AlignLeft | Qt::AlignTop;
- Qt::Alignment v = parseAlignment(d->values.constData(), d->values.count());
+ Qt::Alignment v = parseAlignment(d->values.constData(), d->values.size());
d->parsed = int(v);
return v;
}
@@ -1733,12 +1798,12 @@ void Declaration::borderImageValue(QString *image, int *cuts,
cuts[i] = -1;
*h = *v = TileMode_Stretch;
- if (d->values.count() < 2)
+ if (d->values.size() < 2)
return;
if (d->values.at(1).type == Value::Number) { // cuts!
int i;
- for (i = 0; i < qMin(d->values.count()-1, 4); i++) {
+ for (i = 0; i < qMin(d->values.size()-1, 4); i++) {
const Value& v = d->values.at(i+1);
if (v.type != Value::Number)
break;
@@ -1754,9 +1819,9 @@ void Declaration::borderImageValue(QString *image, int *cuts,
*v = static_cast<TileMode>(findKnownValue(d->values.last().variant.toString(),
tileModes, NumKnownTileModes));
}
- if (d->values[d->values.count() - 2].type == Value::Identifier) {
+ if (d->values[d->values.size() - 2].type == Value::Identifier) {
*h = static_cast<TileMode>
- (findKnownValue(d->values[d->values.count()-2].variant.toString(),
+ (findKnownValue(d->values[d->values.size()-2].variant.toString(),
tileModes, NumKnownTileModes));
} else
*h = *v;
@@ -1764,10 +1829,10 @@ void Declaration::borderImageValue(QString *image, int *cuts,
bool Declaration::borderCollapseValue() const
{
- if (d->values.count() != 1)
+ if (d->values.size() != 1)
return false;
else
- return d->values.at(0).toString() == QLatin1String("collapse");
+ return d->values.at(0).toString() == "collapse"_L1;
}
QIcon Declaration::iconValue() const
@@ -1776,7 +1841,7 @@ QIcon Declaration::iconValue() const
return qvariant_cast<QIcon>(d->parsed);
QIcon icon;
- for (int i = 0; i < d->values.count();) {
+ for (int i = 0; i < d->values.size();) {
const Value &value = d->values.at(i++);
if (value.type != Value::Uri)
break;
@@ -1784,7 +1849,7 @@ QIcon Declaration::iconValue() const
QIcon::Mode mode = QIcon::Normal;
QIcon::State state = QIcon::Off;
for (int j = 0; j < 2; j++) {
- if (i != d->values.count() && d->values.at(i).type == Value::KnownIdentifier) {
+ if (i != d->values.size() && d->values.at(i).type == Value::KnownIdentifier) {
switch (d->values.at(i).variant.toInt()) {
case Value_Disabled: mode = QIcon::Disabled; break;
case Value_Active: mode = QIcon::Active; break;
@@ -1806,7 +1871,7 @@ QIcon Declaration::iconValue() const
else
icon.addPixmap(uri, mode, state);
- if (i == d->values.count())
+ if (i == d->values.size())
break;
if (d->values.at(i).type == Value::TermOperatorComma)
@@ -1822,13 +1887,13 @@ QIcon Declaration::iconValue() const
int Selector::specificity() const
{
int val = 0;
- for (int i = 0; i < basicSelectors.count(); ++i) {
+ for (int i = 0; i < basicSelectors.size(); ++i) {
const BasicSelector &sel = basicSelectors.at(i);
if (!sel.elementName.isEmpty())
val += 1;
- val += (sel.pseudos.count() + sel.attributeSelectors.count()) * 0x10;
- val += sel.ids.count() * 0x100;
+ val += (sel.pseudos.size() + sel.attributeSelectors.size()) * 0x10;
+ val += sel.ids.size() * 0x100;
}
return val;
}
@@ -1847,7 +1912,7 @@ quint64 Selector::pseudoClass(quint64 *negated) const
if (bs.pseudos.isEmpty())
return PseudoClass_Unspecified;
quint64 pc = PseudoClass_Unknown;
- for (int i = !pseudoElement().isEmpty(); i < bs.pseudos.count(); i++) {
+ for (int i = !pseudoElement().isEmpty(); i < bs.pseudos.size(); i++) {
const Pseudo &pseudo = bs.pseudos.at(i);
if (pseudo.type == PseudoClass_Unknown)
return PseudoClass_Unknown;
@@ -1863,24 +1928,24 @@ quint64 Selector::pseudoClass(quint64 *negated) const
// StyleSheet
void StyleSheet::buildIndexes(Qt::CaseSensitivity nameCaseSensitivity)
{
- QVector<StyleRule> universals;
- for (int i = 0; i < styleRules.count(); ++i) {
+ QList<StyleRule> universals;
+ for (int i = 0; i < styleRules.size(); ++i) {
const StyleRule &rule = styleRules.at(i);
- QVector<Selector> universalsSelectors;
- for (int j = 0; j < rule.selectors.count(); ++j) {
+ QList<Selector> universalsSelectors;
+ for (int j = 0; j < rule.selectors.size(); ++j) {
const Selector& selector = rule.selectors.at(j);
if (selector.basicSelectors.isEmpty())
continue;
if (selector.basicSelectors.at(0).relationToNext == BasicSelector::NoRelation) {
- if (selector.basicSelectors.count() != 1)
+ if (selector.basicSelectors.size() != 1)
continue;
- } else if (selector.basicSelectors.count() <= 1) {
+ } else if (selector.basicSelectors.size() <= 1) {
continue;
}
- const BasicSelector &sel = selector.basicSelectors.at(selector.basicSelectors.count() - 1);
+ const BasicSelector &sel = selector.basicSelectors.at(selector.basicSelectors.size() - 1);
if (!sel.ids.isEmpty()) {
StyleRule nr;
@@ -1925,7 +1990,7 @@ bool StyleSelector::nodeNameEquals(NodePtr node, const QString& nodeName) const
QStringList StyleSelector::nodeIds(NodePtr node) const
{
- return QStringList(attribute(node, QLatin1String("id")));
+ return QStringList(attributeValue(node, QCss::AttributeSelector{"id"_L1, {}, AttributeSelector::NoMatch}));
}
bool StyleSelector::selectorMatches(const Selector &selector, NodePtr node)
@@ -1934,14 +1999,14 @@ bool StyleSelector::selectorMatches(const Selector &selector, NodePtr node)
return false;
if (selector.basicSelectors.at(0).relationToNext == BasicSelector::NoRelation) {
- if (selector.basicSelectors.count() != 1)
+ if (selector.basicSelectors.size() != 1)
return false;
return basicSelectorMatches(selector.basicSelectors.at(0), node);
}
- if (selector.basicSelectors.count() <= 1)
+ if (selector.basicSelectors.size() <= 1)
return false;
- int i = selector.basicSelectors.count() - 1;
+ int i = selector.basicSelectors.size() - 1;
node = duplicateNode(node);
bool match = true;
@@ -1949,7 +2014,7 @@ bool StyleSelector::selectorMatches(const Selector &selector, NodePtr node)
do {
match = basicSelectorMatches(sel, node);
if (!match) {
- if (i == selector.basicSelectors.count() - 1) // first element must always match!
+ if (i == selector.basicSelectors.size() - 1) // first element must always match!
break;
if (sel.relationToNext != BasicSelector::MatchNextSelectorIfAncestor &&
sel.relationToNext != BasicSelector::MatchNextSelectorIfIndirectAdjecent)
@@ -1994,10 +2059,10 @@ bool StyleSelector::basicSelectorMatches(const BasicSelector &sel, NodePtr node)
if (!hasAttributes(node))
return false;
- for (int i = 0; i < sel.attributeSelectors.count(); ++i) {
+ for (int i = 0; i < sel.attributeSelectors.size(); ++i) {
const QCss::AttributeSelector &a = sel.attributeSelectors.at(i);
- const QString attrValue = attribute(node, a.name);
+ const QString attrValue = attributeValue(node, a);
if (attrValue.isNull())
return false;
@@ -2009,13 +2074,20 @@ bool StyleSelector::basicSelectorMatches(const BasicSelector &sel, NodePtr node)
return false;
break;
case QCss::AttributeSelector::MatchIncludes: {
- const auto lst = attrValue.splitRef(QLatin1Char(' '));
- if (!lst.contains(QStringRef(&a.value)))
+ const auto lst = QStringView{attrValue}.tokenize(u' ');
+ bool found = false;
+ for (auto s : lst) {
+ if (s == a.value) {
+ found = true;
+ break;
+ }
+ }
+ if (!found)
return false;
break;
}
case QCss::AttributeSelector::MatchDashMatch: {
- const QString dashPrefix = a.value + QLatin1Char('-');
+ const QString dashPrefix = a.value + u'-';
if (attrValue != a.value && !attrValue.startsWith(dashPrefix))
return false;
break;
@@ -2050,14 +2122,14 @@ bool StyleSelector::basicSelectorMatches(const BasicSelector &sel, NodePtr node)
void StyleSelector::matchRule(NodePtr node, const StyleRule &rule, StyleSheetOrigin origin,
int depth, QMultiMap<uint, StyleRule> *weightedRules)
{
- for (int j = 0; j < rule.selectors.count(); ++j) {
+ for (int j = 0; j < rule.selectors.size(); ++j) {
const Selector& selector = rule.selectors.at(j);
if (selectorMatches(selector, node)) {
uint weight = rule.order
+ selector.specificity() *0x100
+ (uint(origin) + depth)*0x100000;
StyleRule newRule = rule;
- if(rule.selectors.count() > 1) {
+ if (rule.selectors.size() > 1) {
newRule.selectors.resize(1);
newRule.selectors[0] = selector;
}
@@ -2069,24 +2141,24 @@ void StyleSelector::matchRule(NodePtr node, const StyleRule &rule, StyleSheetOri
// Returns style rules that are in ascending order of specificity
// Each of the StyleRule returned will contain exactly one Selector
-QVector<StyleRule> StyleSelector::styleRulesForNode(NodePtr node)
+QList<StyleRule> StyleSelector::styleRulesForNode(NodePtr node)
{
- QVector<StyleRule> rules;
+ QList<StyleRule> rules;
if (styleSheets.isEmpty())
return rules;
QMultiMap<uint, StyleRule> weightedRules; // (spec, rule) that will be sorted below
//prune using indexed stylesheet
- for (int sheetIdx = 0; sheetIdx < styleSheets.count(); ++sheetIdx) {
+ for (int sheetIdx = 0; sheetIdx < styleSheets.size(); ++sheetIdx) {
const StyleSheet &styleSheet = styleSheets.at(sheetIdx);
- for (int i = 0; i < styleSheet.styleRules.count(); ++i) {
+ for (int i = 0; i < styleSheet.styleRules.size(); ++i) {
matchRule(node, styleSheet.styleRules.at(i), styleSheet.origin, styleSheet.depth, &weightedRules);
}
if (!styleSheet.idIndex.isEmpty()) {
QStringList ids = nodeIds(node);
- for (int i = 0; i < ids.count(); i++) {
+ for (int i = 0; i < ids.size(); i++) {
const QString &key = ids.at(i);
QMultiHash<QString, StyleRule>::const_iterator it = styleSheet.idIndex.constFind(key);
while (it != styleSheet.idIndex.constEnd() && it.key() == key) {
@@ -2097,7 +2169,7 @@ QVector<StyleRule> StyleSelector::styleRulesForNode(NodePtr node)
}
if (!styleSheet.nameIndex.isEmpty()) {
QStringList names = nodeNames(node);
- for (int i = 0; i < names.count(); i++) {
+ for (int i = 0; i < names.size(); i++) {
QString name = names.at(i);
if (nameCaseSensitivity == Qt::CaseInsensitive)
name = std::move(name).toLower();
@@ -2109,9 +2181,9 @@ QVector<StyleRule> StyleSelector::styleRulesForNode(NodePtr node)
}
}
if (!medium.isEmpty()) {
- for (int i = 0; i < styleSheet.mediaRules.count(); ++i) {
+ for (int i = 0; i < styleSheet.mediaRules.size(); ++i) {
if (styleSheet.mediaRules.at(i).media.contains(medium, Qt::CaseInsensitive)) {
- for (int j = 0; j < styleSheet.mediaRules.at(i).styleRules.count(); ++j) {
+ for (int j = 0; j < styleSheet.mediaRules.at(i).styleRules.size(); ++j) {
matchRule(node, styleSheet.mediaRules.at(i).styleRules.at(j), styleSheet.origin,
styleSheet.depth, &weightedRules);
}
@@ -2120,8 +2192,8 @@ QVector<StyleRule> StyleSelector::styleRulesForNode(NodePtr node)
}
}
- rules.reserve(weightedRules.count());
- QMap<uint, StyleRule>::const_iterator it = weightedRules.constBegin();
+ rules.reserve(weightedRules.size());
+ QMultiMap<uint, StyleRule>::const_iterator it = weightedRules.constBegin();
for ( ; it != weightedRules.constEnd() ; ++it)
rules += *it;
@@ -2130,15 +2202,15 @@ QVector<StyleRule> StyleSelector::styleRulesForNode(NodePtr node)
// for qtexthtmlparser which requires just the declarations with Enabled state
// and without pseudo elements
-QVector<Declaration> StyleSelector::declarationsForNode(NodePtr node, const char *extraPseudo)
+QList<Declaration> StyleSelector::declarationsForNode(NodePtr node, const char *extraPseudo)
{
- QVector<Declaration> decls;
- QVector<StyleRule> rules = styleRulesForNode(node);
- for (int i = 0; i < rules.count(); i++) {
+ QList<Declaration> decls;
+ QList<StyleRule> rules = styleRulesForNode(node);
+ for (int i = 0; i < rules.size(); i++) {
const Selector& selector = rules.at(i).selectors.at(0);
const QString pseudoElement = selector.pseudoElement();
- if (extraPseudo && pseudoElement == QLatin1String(extraPseudo)) {
+ if (extraPseudo && pseudoElement == QLatin1StringView(extraPseudo)) {
decls += rules.at(i).declarations;
continue;
}
@@ -2169,7 +2241,7 @@ QString Scanner::preprocess(const QString &input, bool *hasEscapeSequences)
int i = 0;
while (i < output.size()) {
- if (output.at(i) == QLatin1Char('\\')) {
+ if (output.at(i) == u'\\') {
++i;
// test for unicode hex escape
@@ -2189,9 +2261,9 @@ QString Scanner::preprocess(const QString &input, bool *hasEscapeSequences)
hexCount = qMin(hexCount, 6);
bool ok = false;
- ushort code = output.midRef(hexStart, hexCount).toUShort(&ok, 16);
+ const char16_t code = QStringView{output}.mid(hexStart, hexCount).toUShort(&ok, 16);
if (ok) {
- output.replace(hexStart - 1, hexCount + 1, QChar(code));
+ output.replace(hexStart - 1, hexCount + 1, code);
i = hexStart;
} else {
i = hexStart;
@@ -2206,8 +2278,7 @@ QString Scanner::preprocess(const QString &input, bool *hasEscapeSequences)
int QCssScanner_Generated::handleCommentStart()
{
while (pos < input.size() - 1) {
- if (input.at(pos) == QLatin1Char('*')
- && input.at(pos + 1) == QLatin1Char('/')) {
+ if (input.at(pos) == u'*' && input.at(pos + 1) == u'/') {
pos += 2;
break;
}
@@ -2216,7 +2287,7 @@ int QCssScanner_Generated::handleCommentStart()
return S;
}
-void Scanner::scan(const QString &preprocessedInput, QVector<Symbol> *symbols)
+void Scanner::scan(const QString &preprocessedInput, QList<Symbol> *symbols)
{
QCssScanner_Generated scanner(preprocessedInput);
Symbol sym;
@@ -2237,7 +2308,7 @@ QString Symbol::lexem() const
if (len > 0)
result.reserve(len);
for (int i = 0; i < len; ++i) {
- if (text.at(start + i) == QLatin1Char('\\') && i < len - 1)
+ if (text.at(start + i) == u'\\' && i < len - 1)
++i;
result += text.at(start + i);
}
@@ -2262,7 +2333,7 @@ void Parser::init(const QString &css, bool isFile)
if (isFile) {
QFile file(css);
if (file.open(QFile::ReadOnly)) {
- sourcePath = QFileInfo(styleSheet).absolutePath() + QLatin1Char('/');
+ sourcePath = QFileInfo(styleSheet).absolutePath() + u'/';
QTextStream stream(&file);
styleSheet = stream.readAll();
} else {
@@ -2283,7 +2354,7 @@ void Parser::init(const QString &css, bool isFile)
bool Parser::parse(StyleSheet *styleSheet, Qt::CaseSensitivity nameCaseSensitivity)
{
- if (testTokenAndEndsWith(ATKEYWORD_SYM, QLatin1String("charset"))) {
+ if (testTokenAndEndsWith(ATKEYWORD_SYM, "charset"_L1)) {
while (test(S) || test(CDO) || test(CDC)) {}
if (!next(STRING)) return false;
if (!next(SEMICOLON)) return false;
@@ -2330,8 +2401,7 @@ Symbol Parser::errorSymbol()
static inline void removeOptionalQuotes(QString *str)
{
- if (!str->startsWith(QLatin1Char('\''))
- && !str->startsWith(QLatin1Char('\"')))
+ if (!str->startsWith(u'\'') && !str->startsWith(u'\"'))
return;
str->remove(0, 1);
str->chop(1);
@@ -2548,7 +2618,7 @@ bool Parser::parseSimpleSelector(BasicSelector *basicSel)
} else if (testClass()) {
onceMore = true;
AttributeSelector a;
- a.name = QLatin1String("class");
+ a.name = "class"_L1;
a.valueMatchCriterium = AttributeSelector::MatchIncludes;
if (!parseClass(&a.value)) return false;
basicSel->attributeSelectors.append(a);
@@ -2659,7 +2729,7 @@ bool Parser::testPrio()
index = rewind;
return false;
}
- if (lexem().compare(QLatin1String("important"), Qt::CaseInsensitive) != 0) {
+ if (lexem().compare("important"_L1, Qt::CaseInsensitive) != 0) {
index = rewind;
return false;
}
@@ -2673,7 +2743,7 @@ bool Parser::parsePrio(Declaration *declaration)
return true;
}
-bool Parser::parseExpr(QVector<Value> *values)
+bool Parser::parseExpr(QList<Value> *values)
{
Value val;
if (!parseTerm(&val)) return false;
@@ -2723,7 +2793,7 @@ bool Parser::parseTerm(Value *value)
switch (lookup()) {
case NUMBER:
value->type = Value::Number;
- value->variant.convert(QVariant::Double);
+ value->variant.convert(QMetaType::fromType<double>());
break;
case PERCENTAGE:
value->type = Value::Percentage;
@@ -2762,7 +2832,7 @@ bool Parser::parseTerm(Value *value)
} else if (testFunction()) {
QString name, args;
if (!parseFunction(&name, &args)) return false;
- if (name == QLatin1String("url")) {
+ if (name == "url"_L1) {
value->type = Value::Uri;
removeOptionalQuotes(&args);
if (QFileInfo(args).isRelative() && !sourcePath.isEmpty()) {
@@ -2804,7 +2874,7 @@ bool Parser::parseFunction(QString *name, QString *args)
bool Parser::parseHexColor(QColor *col)
{
- col->setNamedColor(lexem());
+ *col = QColor::fromString(lexem());
if (!col->isValid()) {
qWarning("QCssParser::parseHexColor: Unknown color name '%s'",lexem().toLatin1().constData());
return false;
@@ -2823,7 +2893,7 @@ bool Parser::testAndParseUri(QString *uri)
index = rewind;
return false;
}
- if (name.compare(QLatin1String("url"), Qt::CaseInsensitive) != 0) {
+ if (name.compare("url"_L1, Qt::CaseInsensitive) != 0) {
index = rewind;
return false;
}
@@ -2850,7 +2920,7 @@ bool Parser::next(QCss::TokenType t)
bool Parser::test(QCss::TokenType t)
{
- if (index >= symbols.count())
+ if (index >= symbols.size())
return false;
if (symbols.at(index).token == t) {
++index;
@@ -2917,7 +2987,7 @@ bool Parser::until(QCss::TokenType target, QCss::TokenType target2)
return false;
}
-bool Parser::testTokenAndEndsWith(QCss::TokenType t, QLatin1String str)
+bool Parser::testTokenAndEndsWith(QCss::TokenType t, QLatin1StringView str)
{
if (!test(t)) return false;
if (!lexem().endsWith(str, Qt::CaseInsensitive)) {
diff --git a/src/gui/text/qcssparser_p.h b/src/gui/text/qcssparser_p.h
index ef5ae8c80b..7742271e41 100644
--- a/src/gui/text/qcssparser_p.h
+++ b/src/gui/text/qcssparser_p.h
@@ -1,41 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the QtGui module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#ifndef QCSSPARSER_P_H
#define QCSSPARSER_P_H
@@ -53,9 +17,8 @@
#include <QtGui/private/qtguiglobal_p.h>
#include <QtCore/QStringList>
-#include <QtCore/QVector>
+#include <QtCore/QList>
#include <QtCore/QVariant>
-#include <QtCore/QPair>
#include <QtCore/QSize>
#include <QtCore/QMultiHash>
#include <QtGui/QFont>
@@ -199,6 +162,14 @@ enum Property {
FontKerning,
QtForegroundTextureCacheKey,
QtIcon,
+ LetterSpacing,
+ WordSpacing,
+ TextDecorationColor,
+ QtPlaceHolderTextColor,
+ QtAccent,
+ QtStrokeWidth,
+ QtStrokeColor,
+ QtForeground,
NumProperties
};
@@ -389,7 +360,7 @@ struct Value
Q_GUI_EXPORT QString toString() const;
};
-QT_CSS_DECLARE_TYPEINFO(Value, Q_MOVABLE_TYPE)
+QT_CSS_DECLARE_TYPEINFO(Value, Q_RELOCATABLE_TYPE)
struct ColorData {
ColorData() : role(QPalette::NoRole), type(Invalid) {}
@@ -399,7 +370,7 @@ struct ColorData {
QPalette::ColorRole role;
enum { Invalid, Color, Role} type;
};
-QT_CSS_DECLARE_TYPEINFO(ColorData, Q_MOVABLE_TYPE)
+QT_CSS_DECLARE_TYPEINFO(ColorData, Q_RELOCATABLE_TYPE)
struct BrushData {
BrushData() : role(QPalette::NoRole), type(Invalid) {}
@@ -409,7 +380,7 @@ struct BrushData {
QPalette::ColorRole role;
enum { Invalid, Brush, Role, DependsOnThePalette } type;
};
-QT_CSS_DECLARE_TYPEINFO(BrushData, Q_MOVABLE_TYPE)
+QT_CSS_DECLARE_TYPEINFO(BrushData, Q_RELOCATABLE_TYPE)
struct BackgroundData {
BrushData brush;
@@ -417,11 +388,11 @@ struct BackgroundData {
Repeat repeat;
Qt::Alignment alignment;
};
-QT_CSS_DECLARE_TYPEINFO(BackgroundData, Q_MOVABLE_TYPE)
+QT_CSS_DECLARE_TYPEINFO(BackgroundData, Q_RELOCATABLE_TYPE)
struct LengthData {
qreal number;
- enum { None, Px, Ex, Em } unit;
+ enum { None, Px, Ex, Em, Percent } unit;
};
QT_CSS_DECLARE_TYPEINFO(LengthData, Q_PRIMITIVE_TYPE)
@@ -430,13 +401,12 @@ struct BorderData {
BorderStyle style;
BrushData color;
};
-QT_CSS_DECLARE_TYPEINFO(BorderData, Q_MOVABLE_TYPE)
-
+QT_CSS_DECLARE_TYPEINFO(BorderData, Q_RELOCATABLE_TYPE)
// 1. StyleRule - x:hover, y:clicked > z:checked { prop1: value1; prop2: value2; }
-// 2. QVector<Selector> - x:hover, y:clicked z:checked
-// 3. QVector<BasicSelector> - y:clicked z:checked
-// 4. QVector<Declaration> - { prop1: value1; prop2: value2; }
+// 2. QList<Selector> - x:hover, y:clicked z:checked
+// 3. QList<BasicSelector> - y:clicked z:checked
+// 4. QList<Declaration> - { prop1: value1; prop2: value2; }
// 5. Declaration - prop1: value1;
struct Q_GUI_EXPORT Declaration
@@ -446,7 +416,7 @@ struct Q_GUI_EXPORT Declaration
inline DeclarationData() : propertyId(UnknownProperty), important(false), inheritable(false) {}
QString property;
Property propertyId;
- QVector<Value> values;
+ QList<Value> values;
QVariant parsed;
bool important:1;
bool inheritable:1;
@@ -482,7 +452,7 @@ struct Q_GUI_EXPORT Declaration
void borderImageValue(QString *image, int *cuts, TileMode *h, TileMode *v) const;
bool borderCollapseValue() const;
};
-QT_CSS_DECLARE_TYPEINFO(Declaration, Q_MOVABLE_TYPE)
+QT_CSS_DECLARE_TYPEINFO(Declaration, Q_RELOCATABLE_TYPE)
const quint64 PseudoClass_Unknown = Q_UINT64_C(0x0000000000000000);
const quint64 PseudoClass_Enabled = Q_UINT64_C(0x0000000000000001);
@@ -542,7 +512,7 @@ struct Pseudo
QString function;
bool negated;
};
-QT_CSS_DECLARE_TYPEINFO(Pseudo, Q_MOVABLE_TYPE)
+QT_CSS_DECLARE_TYPEINFO(Pseudo, Q_RELOCATABLE_TYPE)
struct AttributeSelector
{
@@ -555,13 +525,12 @@ struct AttributeSelector
MatchEndsWith,
MatchContains
};
- inline AttributeSelector() : valueMatchCriterium(NoMatch) {}
QString name;
QString value;
- ValueMatchType valueMatchCriterium;
+ ValueMatchType valueMatchCriterium = NoMatch;
};
-QT_CSS_DECLARE_TYPEINFO(AttributeSelector, Q_MOVABLE_TYPE)
+QT_CSS_DECLARE_TYPEINFO(AttributeSelector, Q_RELOCATABLE_TYPE)
struct BasicSelector
{
@@ -578,51 +547,51 @@ struct BasicSelector
QString elementName;
QStringList ids;
- QVector<Pseudo> pseudos;
- QVector<AttributeSelector> attributeSelectors;
+ QList<Pseudo> pseudos;
+ QList<AttributeSelector> attributeSelectors;
Relation relationToNext;
};
-QT_CSS_DECLARE_TYPEINFO(BasicSelector, Q_MOVABLE_TYPE)
+QT_CSS_DECLARE_TYPEINFO(BasicSelector, Q_RELOCATABLE_TYPE)
struct Q_GUI_EXPORT Selector
{
- QVector<BasicSelector> basicSelectors;
+ QList<BasicSelector> basicSelectors;
int specificity() const;
quint64 pseudoClass(quint64 *negated = nullptr) const;
QString pseudoElement() const;
};
-QT_CSS_DECLARE_TYPEINFO(Selector, Q_MOVABLE_TYPE)
+QT_CSS_DECLARE_TYPEINFO(Selector, Q_RELOCATABLE_TYPE)
struct StyleRule
{
StyleRule() : order(0) { }
- QVector<Selector> selectors;
- QVector<Declaration> declarations;
+ QList<Selector> selectors;
+ QList<Declaration> declarations;
int order;
};
-QT_CSS_DECLARE_TYPEINFO(StyleRule, Q_MOVABLE_TYPE)
+QT_CSS_DECLARE_TYPEINFO(StyleRule, Q_RELOCATABLE_TYPE)
struct MediaRule
{
QStringList media;
- QVector<StyleRule> styleRules;
+ QList<StyleRule> styleRules;
};
-QT_CSS_DECLARE_TYPEINFO(MediaRule, Q_MOVABLE_TYPE)
+QT_CSS_DECLARE_TYPEINFO(MediaRule, Q_RELOCATABLE_TYPE)
struct PageRule
{
QString selector;
- QVector<Declaration> declarations;
+ QList<Declaration> declarations;
};
-QT_CSS_DECLARE_TYPEINFO(PageRule, Q_MOVABLE_TYPE)
+QT_CSS_DECLARE_TYPEINFO(PageRule, Q_RELOCATABLE_TYPE)
struct ImportRule
{
QString href;
QStringList media;
};
-QT_CSS_DECLARE_TYPEINFO(ImportRule, Q_MOVABLE_TYPE)
+QT_CSS_DECLARE_TYPEINFO(ImportRule, Q_RELOCATABLE_TYPE)
enum StyleSheetOrigin {
StyleSheetOrigin_Unspecified,
@@ -635,10 +604,10 @@ enum StyleSheetOrigin {
struct StyleSheet
{
StyleSheet() : origin(StyleSheetOrigin_Unspecified), depth(0) { }
- QVector<StyleRule> styleRules; //only contains rules that are not indexed
- QVector<MediaRule> mediaRules;
- QVector<PageRule> pageRules;
- QVector<ImportRule> importRules;
+ QList<StyleRule> styleRules; // only contains rules that are not indexed
+ QList<MediaRule> mediaRules;
+ QList<PageRule> pageRules;
+ QList<ImportRule> importRules;
StyleSheetOrigin origin;
int depth; // applicable only for inline style sheets
QMultiHash<QString, StyleRule> nameIndex;
@@ -646,7 +615,7 @@ struct StyleSheet
Q_GUI_EXPORT void buildIndexes(Qt::CaseSensitivity nameCaseSensitivity = Qt::CaseSensitive);
};
-QT_CSS_DECLARE_TYPEINFO(StyleSheet, Q_MOVABLE_TYPE)
+QT_CSS_DECLARE_TYPEINFO(StyleSheet, Q_RELOCATABLE_TYPE)
class Q_GUI_EXPORT StyleSelector
@@ -660,11 +629,11 @@ public:
int id;
};
- QVector<StyleRule> styleRulesForNode(NodePtr node);
- QVector<Declaration> declarationsForNode(NodePtr node, const char *extraPseudo = nullptr);
+ QList<StyleRule> styleRulesForNode(NodePtr node);
+ QList<Declaration> declarationsForNode(NodePtr node, const char *extraPseudo = nullptr);
virtual bool nodeNameEquals(NodePtr node, const QString& nodeName) const;
- virtual QString attribute(NodePtr node, const QString &name) const = 0;
+ virtual QString attributeValue(NodePtr node, const QCss::AttributeSelector &aSelector) const = 0;
virtual bool hasAttributes(NodePtr node) const = 0;
virtual QStringList nodeIds(NodePtr node) const;
virtual QStringList nodeNames(NodePtr node) const = 0;
@@ -674,7 +643,7 @@ public:
virtual NodePtr duplicateNode(NodePtr node) const = 0;
virtual void freeNode(NodePtr node) const = 0;
- QVector<StyleSheet> styleSheets;
+ QList<StyleSheet> styleSheets;
QString medium;
Qt::CaseSensitivity nameCaseSensitivity;
private:
@@ -744,13 +713,13 @@ struct Symbol
int start, len;
Q_GUI_EXPORT QString lexem() const;
};
-QT_CSS_DECLARE_TYPEINFO(Symbol, Q_MOVABLE_TYPE)
+QT_CSS_DECLARE_TYPEINFO(Symbol, Q_RELOCATABLE_TYPE)
class Q_GUI_EXPORT Scanner
{
public:
static QString preprocess(const QString &input, bool *hasEscapeSequences = nullptr);
- static void scan(const QString &preprocessedInput, QVector<Symbol> *symbols);
+ static void scan(const QString &preprocessedInput, QList<Symbol> *symbols);
};
class Q_GUI_EXPORT Parser
@@ -780,7 +749,7 @@ public:
bool parsePseudo(Pseudo *pseudo);
bool parseNextDeclaration(Declaration *declaration);
bool parsePrio(Declaration *declaration);
- bool parseExpr(QVector<Value> *values);
+ bool parseExpr(QList<Value> *values);
bool parseTerm(Value *value);
bool parseFunction(QString *name, QString *args);
bool parseHexColor(QColor *col);
@@ -798,14 +767,19 @@ public:
inline bool testMedium() { return test(IDENT); }
inline bool parseNextMedium(QStringList *media) { if (!testMedium()) return recordError(); return parseMedium(media); }
inline bool testPseudoPage() { return test(COLON); }
- inline bool testImport() { return testTokenAndEndsWith(ATKEYWORD_SYM, QLatin1String("import")); }
- inline bool testMedia() { return testTokenAndEndsWith(ATKEYWORD_SYM, QLatin1String("media")); }
- inline bool testPage() { return testTokenAndEndsWith(ATKEYWORD_SYM, QLatin1String("page")); }
+ inline bool testImport() { return testTokenAndEndsWith(ATKEYWORD_SYM, QLatin1StringView("import")); }
+ inline bool testMedia() { return testTokenAndEndsWith(ATKEYWORD_SYM, QLatin1StringView("media")); }
+ inline bool testPage() { return testTokenAndEndsWith(ATKEYWORD_SYM, QLatin1StringView("page")); }
inline bool testCombinator() { return test(PLUS) || test(GREATER) || test(TILDE) || test(S); }
inline bool testProperty() { return test(IDENT); }
bool testTerm();
inline bool testExpr() { return testTerm(); }
- inline bool parseNextExpr(QVector<Value> *values) { if (!testExpr()) return recordError(); return parseExpr(values); }
+ inline bool parseNextExpr(QList<Value> *values)
+ {
+ if (!testExpr())
+ return recordError();
+ return parseExpr(values);
+ }
bool testPrio();
inline bool testHexColor() { return test(HASH); }
inline bool testFunction() { return test(FUNCTION); }
@@ -815,7 +789,7 @@ public:
inline void skipSpace() { while (test(S)) {}; }
- inline bool hasNext() const { return index < symbols.count(); }
+ inline bool hasNext() const { return index < symbols.size(); }
inline TokenType next() { return symbols.at(index++).token; }
bool next(TokenType t);
bool test(TokenType t);
@@ -826,14 +800,14 @@ public:
QString lexemUntil(TokenType t);
bool until(TokenType target, TokenType target2 = NONE);
inline TokenType lookup() const {
- return (index - 1) < symbols.count() ? symbols.at(index - 1).token : NONE;
+ return (index - 1) < symbols.size() ? symbols.at(index - 1).token : NONE;
}
- bool testTokenAndEndsWith(TokenType t, QLatin1String str);
+ bool testTokenAndEndsWith(TokenType t, QLatin1StringView str);
inline bool recordError() { errorIndex = index; return false; }
- QVector<Symbol> symbols;
+ QList<Symbol> symbols;
int index;
int errorIndex;
bool hasEscapeSequences;
@@ -842,7 +816,7 @@ public:
struct Q_GUI_EXPORT ValueExtractor
{
- ValueExtractor(const QVector<Declaration> &declarations, const QPalette & = QPalette());
+ ValueExtractor(const QList<Declaration> &declarations, const QPalette & = QPalette());
bool extractFont(QFont *font, int *fontSizeAdjustment);
bool extractBackground(QBrush *, QString *, Repeat *, Qt::Alignment *, QCss::Origin *, QCss::Attachment *,
@@ -853,12 +827,15 @@ struct Q_GUI_EXPORT ValueExtractor
bool extractBox(int *margins, int *paddings, int *spacing = nullptr);
bool extractBorder(int *borders, QBrush *colors, BorderStyle *Styles, QSize *radii);
bool extractOutline(int *borders, QBrush *colors, BorderStyle *Styles, QSize *radii, int *offsets);
- bool extractPalette(QBrush *fg, QBrush *sfg, QBrush *sbg, QBrush *abg);
+ bool extractPalette(QBrush *foreground, QBrush *selectedForeground, QBrush *selectedBackground,
+ QBrush *alternateBackground, QBrush *placeHolderTextForeground,
+ QBrush *accent);
int extractStyleFeatures();
bool extractImage(QIcon *icon, Qt::Alignment *a, QSize *size);
bool extractIcon(QIcon *icon, QSize *size);
void lengthValues(const Declaration &decl, int *m);
+ QTextLength textLength(const Declaration &decl);
private:
void extractFont();
@@ -868,7 +845,7 @@ private:
QSize sizeValue(const Declaration &decl);
void sizeValues(const Declaration &decl, QSize *radii);
- QVector<Declaration> declarations;
+ QList<Declaration> declarations;
QFont f;
int adjustment;
int fontExtracted;
@@ -879,9 +856,9 @@ private:
QT_END_NAMESPACE
-Q_DECLARE_METATYPE( QCss::BackgroundData )
-Q_DECLARE_METATYPE( QCss::LengthData )
-Q_DECLARE_METATYPE( QCss::BorderData )
+QT_DECL_METATYPE_EXTERN_TAGGED(QCss::BackgroundData, QCss__BackgroundData, Q_GUI_EXPORT)
+QT_DECL_METATYPE_EXTERN_TAGGED(QCss::LengthData, QCss__LengthData, Q_GUI_EXPORT)
+QT_DECL_METATYPE_EXTERN_TAGGED(QCss::BorderData, QCss__BorderData, Q_GUI_EXPORT)
#undef QT_CSS_DECLARE_TYPEINFO
diff --git a/src/gui/text/qcssscanner.cpp b/src/gui/text/qcssscanner.cpp
index d48cbb71d7..7bfa797782 100644
--- a/src/gui/text/qcssscanner.cpp
+++ b/src/gui/text/qcssscanner.cpp
@@ -1,41 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2018 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the QtGui module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2018 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
// auto generated by qtbase/util/lexgen/. DO NOT EDIT.
class QCssScanner_Generated
@@ -44,7 +8,7 @@ public:
QCssScanner_Generated(const QString &inp);
inline QChar next() {
- return (pos < input.length()) ? input.at(pos++) : QChar();
+ return (pos < input.size()) ? input.at(pos++) : QChar();
}
int handleCommentStart();
int lex();
diff --git a/src/gui/text/qdistancefield.cpp b/src/gui/text/qdistancefield.cpp
index c843e3b706..fe230188c6 100644
--- a/src/gui/text/qdistancefield.cpp
+++ b/src/gui/text/qdistancefield.cpp
@@ -1,41 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the QtGui module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#include "qdistancefield_p.h"
#include <qmath.h>
@@ -45,6 +9,8 @@
QT_BEGIN_NAMESPACE
+using namespace Qt::StringLiterals;
+
Q_LOGGING_CATEGORY(lcDistanceField, "qt.distanceField");
namespace
@@ -564,14 +530,14 @@ static void makeDistanceField(QDistanceFieldData *data, const QPainterPath &path
|| (to.y() < offs << 8) || (to.y() >= (imgHeight - offs) << 8));
}
- isConvex.resize(normals.count());
- for (int next = 0, prev = normals.count() - 1; next < normals.count(); prev = next++) {
+ isConvex.resize(normals.size());
+ for (int next = 0, prev = normals.size() - 1; next < normals.size(); prev = next++) {
isConvex[prev] = normals.at(prev).x() * normals.at(next).y()
- normals.at(prev).y() * normals.at(next).x() < 0;
}
// Draw quads.
- for (int next = 0, prev = normals.count() - 1; next < normals.count(); prev = next++) {
+ for (int next = 0, prev = normals.size() - 1; next < normals.size(); prev = next++) {
QPoint n = normals.at(next);
QPoint intPrev = vertices.at(prev);
QPoint extPrev = vertices.at(prev);
@@ -780,7 +746,7 @@ bool qt_fontHasNarrowOutlines(QFontEngine *fontEngine)
const glyph_t glyph = fe->glyphIndex('O');
if (glyph != 0)
- im = fe->alphaMapForGlyph(glyph, QFixed(), QTransform());
+ im = fe->alphaMapForGlyph(glyph, QFixedPoint(), QTransform());
Q_ASSERT(fe->ref.loadRelaxed() == 0);
delete fe;
@@ -796,7 +762,7 @@ bool qt_fontHasNarrowOutlines(const QRawFont &f)
if (!font.isValid())
return false;
- QVector<quint32> glyphIndices = font.glyphIndexesForString(QLatin1String("O"));
+ QList<quint32> glyphIndices = font.glyphIndexesForString("O"_L1);
if (glyphIndices.isEmpty() || glyphIndices[0] == 0)
return false;
@@ -1092,7 +1058,7 @@ QImage QDistanceField::toImage(QImage::Format format) const
}
if (image.format() != format)
- image = image.convertToFormat(format);
+ image = std::move(image).convertToFormat(format);
}
return image;
diff --git a/src/gui/text/qdistancefield_p.h b/src/gui/text/qdistancefield_p.h
index 823bfaf1c6..dbc7a0abb5 100644
--- a/src/gui/text/qdistancefield_p.h
+++ b/src/gui/text/qdistancefield_p.h
@@ -1,41 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the QtGui module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#ifndef QDISTANCEFIELD_H
#define QDISTANCEFIELD_H
diff --git a/src/gui/text/qfont.cpp b/src/gui/text/qfont.cpp
index e162015aba..f3a35a4269 100644
--- a/src/gui/text/qfont.cpp
+++ b/src/gui/text/qfont.cpp
@@ -1,41 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2019 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the QtGui module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2019 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#include "qfont.h"
#include "qdebug.h"
@@ -67,6 +31,8 @@
#include <QtCore/QMutexLocker>
#include <QtCore/QMutex>
+#include <array>
+
// #define QFONTCACHE_DEBUG
#ifdef QFONTCACHE_DEBUG
# define FC_DEBUG qDebug
@@ -116,19 +82,16 @@ bool QFontDef::exactMatch(const QFontDef &other) const
if (stretch != 0 && other.stretch != 0 && stretch != other.stretch)
return false;
- if (families.size() != other.families.size())
- return false;
-
QString this_family, this_foundry, other_family, other_foundry;
for (int i = 0; i < families.size(); ++i) {
- QFontDatabase::parseFontName(families.at(i), this_foundry, this_family);
- QFontDatabase::parseFontName(other.families.at(i), other_foundry, other_family);
+ QFontDatabasePrivate::parseFontName(families.at(i), this_foundry, this_family);
+ QFontDatabasePrivate::parseFontName(other.families.at(i), other_foundry, other_family);
if (this_family != other_family || this_foundry != other_foundry)
return false;
}
- QFontDatabase::parseFontName(family, this_foundry, this_family);
- QFontDatabase::parseFontName(other.family, other_foundry, other_family);
+ if (variableAxisValues != other.variableAxisValues)
+ return false;
return (styleHint == other.styleHint
&& styleStrategy == other.styleStrategy
@@ -142,14 +105,14 @@ bool QFontDef::exactMatch(const QFontDef &other) const
);
}
-extern bool qt_is_gui_used;
+extern bool qt_is_tty_app;
Q_GUI_EXPORT int qt_defaultDpiX()
{
if (QCoreApplication::instance()->testAttribute(Qt::AA_Use96Dpi))
return 96;
- if (!qt_is_gui_used)
+ if (qt_is_tty_app)
return 75;
if (const QScreen *screen = QGuiApplication::primaryScreen())
@@ -164,7 +127,7 @@ Q_GUI_EXPORT int qt_defaultDpiY()
if (QCoreApplication::instance()->testAttribute(Qt::AA_Use96Dpi))
return 96;
- if (!qt_is_gui_used)
+ if (qt_is_tty_app)
return 75;
if (const QScreen *screen = QGuiApplication::primaryScreen())
@@ -179,6 +142,67 @@ Q_GUI_EXPORT int qt_defaultDpi()
return qt_defaultDpiY();
}
+/* Helper function to convert between legacy Qt and OpenType font weights. */
+static int convertWeights(int weight, bool inverted)
+{
+ static constexpr std::array<int, 2> legacyToOpenTypeMap[] = {
+ { 0, QFont::Thin }, { 12, QFont::ExtraLight }, { 25, QFont::Light },
+ { 50, QFont::Normal }, { 57, QFont::Medium }, { 63, QFont::DemiBold },
+ { 75, QFont::Bold }, { 81, QFont::ExtraBold }, { 87, QFont::Black },
+ };
+
+ int closestDist = INT_MAX;
+ int result = -1;
+
+ // Go through and find the closest mapped value
+ for (auto mapping : legacyToOpenTypeMap) {
+ const int weightOld = mapping[ inverted];
+ const int weightNew = mapping[!inverted];
+ const int dist = qAbs(weightOld - weight);
+ if (dist < closestDist) {
+ result = weightNew;
+ closestDist = dist;
+ } else {
+ // Break early since following values will be further away
+ break;
+ }
+ }
+
+ return result;
+}
+
+// Splits the family string on a comma and returns the list based on that
+static QStringList splitIntoFamilies(const QString &family)
+{
+ QStringList familyList;
+ if (family.isEmpty())
+ return familyList;
+ const auto list = QStringView{family}.split(u',');
+ const int numFamilies = list.size();
+ familyList.reserve(numFamilies);
+ for (int i = 0; i < numFamilies; ++i) {
+ auto str = list.at(i).trimmed();
+ if ((str.startsWith(u'"') && str.endsWith(u'"'))
+ || (str.startsWith(u'\'') && str.endsWith(u'\''))) {
+ str = str.mid(1, str.size() - 2);
+ }
+ familyList << str.toString();
+ }
+ return familyList;
+}
+
+/* Converts from legacy Qt font weight (Qt < 6.0) to OpenType font weight (Qt >= 6.0) */
+Q_GUI_EXPORT int qt_legacyToOpenTypeWeight(int weight)
+{
+ return convertWeights(weight, false);
+}
+
+/* Converts from OpenType font weight (Qt >= 6.0) to legacy Qt font weight (Qt < 6.0) */
+Q_GUI_EXPORT int qt_openTypeToLegacyWeight(int weight)
+{
+ return convertWeights(weight, true);
+}
+
QFontPrivate::QFontPrivate()
: engineData(nullptr), dpi(qt_defaultDpi()),
underline(false), overline(false), strikeOut(false), kerning(true),
@@ -192,7 +216,7 @@ QFontPrivate::QFontPrivate(const QFontPrivate &other)
strikeOut(other.strikeOut), kerning(other.kerning),
capital(other.capital), letterSpacingIsAbsolute(other.letterSpacingIsAbsolute),
letterSpacing(other.letterSpacing), wordSpacing(other.wordSpacing),
- scFont(other.scFont)
+ features(other.features), scFont(other.scFont)
{
if (scFont && scFont != this)
scFont->ref.ref();
@@ -203,8 +227,10 @@ QFontPrivate::~QFontPrivate()
if (engineData && !engineData->ref.deref())
delete engineData;
engineData = nullptr;
- if (scFont && scFont != this)
- scFont->ref.deref();
+ if (scFont && scFont != this) {
+ if (!scFont->ref.deref())
+ delete scFont;
+ }
scFont = nullptr;
}
@@ -224,7 +250,7 @@ QFontEngine *QFontPrivate::engineForScript(int script) const
engineData = nullptr;
}
if (!engineData || !QT_FONT_ENGINE_FROM_DATA(engineData, script))
- QFontDatabase::load(this, script);
+ QFontDatabasePrivate::load(this, script);
return QT_FONT_ENGINE_FROM_DATA(engineData, script);
}
@@ -268,16 +294,8 @@ void QFontPrivate::resolve(uint mask, const QFontPrivate *other)
if ((mask & QFont::AllPropertiesResolved) == QFont::AllPropertiesResolved) return;
// assign the unset-bits with the set-bits of the other font def
- if (! (mask & QFont::FamilyResolved))
- request.family = other->request.family;
-
- if (!(mask & QFont::FamiliesResolved)) {
+ if (!(mask & QFont::FamiliesResolved))
request.families = other->request.families;
- // Prepend the family explicitly set so it will be given
- // preference in this case
- if (mask & QFont::FamilyResolved)
- request.families.prepend(request.family);
- }
if (! (mask & QFont::StyleNameResolved))
request.styleName = other->request.styleName;
@@ -328,9 +346,38 @@ void QFontPrivate::resolve(uint mask, const QFontPrivate *other)
wordSpacing = other->wordSpacing;
if (! (mask & QFont::CapitalizationResolved))
capital = other->capital;
+
+ if (!(mask & QFont::FeaturesResolved))
+ features = other->features;
+
+ if (!(mask & QFont::VariableAxesResolved))
+ request.variableAxisValues = other->request.variableAxisValues;
+}
+
+bool QFontPrivate::hasVariableAxis(QFont::Tag tag, float value) const
+{
+ return request.variableAxisValues.contains(tag) && request.variableAxisValues.value(tag) == value;
+}
+
+void QFontPrivate::setVariableAxis(QFont::Tag tag, float value)
+{
+ request.variableAxisValues.insert(tag, value);
+}
+
+void QFontPrivate::unsetVariableAxis(QFont::Tag tag)
+{
+ request.variableAxisValues.remove(tag);
}
+void QFontPrivate::setFeature(QFont::Tag tag, quint32 value)
+{
+ features.insert(tag, value);
+}
+void QFontPrivate::unsetFeature(QFont::Tag tag)
+{
+ features.remove(tag);
+}
QFontEngineData::QFontEngineData()
@@ -400,7 +447,7 @@ QFontEngineData::~QFontEngineData()
The attributes set in the constructor can also be set later, e.g.
setFamily(), setPointSize(), setPointSizeF(), setWeight() and
setItalic(). The remaining attributes must be set after
- contstruction, e.g. setBold(), setUnderline(), setOverline(),
+ construction, e.g. setBold(), setUnderline(), setOverline(),
setStrikeOut() and setFixedPitch(). QFontInfo objects should be
created \e after the font's attributes have been set. A QFontInfo
object will not change, even if you change the font's
@@ -420,7 +467,9 @@ QFontEngineData::~QFontEngineData()
be removed with removeSubstitutions(). Use substitute() to retrieve
a family's first substitute, or the family name itself if it has
no substitutes. Use substitutes() to retrieve a list of a family's
- substitutes (which may be empty).
+ substitutes (which may be empty). After substituting a font, you must
+ trigger the updating of the font by destroying and re-creating all
+ QFont objects.
Every QFont has a key() which you can use, for example, as the key
in a cache or dictionary. If you want to store a user's font
@@ -443,8 +492,6 @@ QFontEngineData::~QFontEngineData()
The font matching algorithm works as follows:
\list 1
\li The specified font families (set by setFamilies()) are searched for.
- \li If not found, then if set the specified font family exists and can be used to represent
- the writing system in use, it will be selected.
\li If not, a replacement font that supports the writing system is
selected. The font matching algorithm will try to find the
best match for all the properties set in the QFont. How this is
@@ -511,10 +558,10 @@ QFontEngineData::~QFontEngineData()
For more general information on fonts, see the
\l{comp.fonts FAQ}{comp.fonts FAQ}.
- Information on encodings can be found from
- \l{Roman Czyborra's} page.
+ Information on encodings can be found from the
+ \l{UTR17} page.
- \sa QFontMetrics, QFontInfo, QFontDatabase, {Character Map Example}
+ \sa QFontMetrics, QFontInfo, QFontDatabase
*/
/*!
@@ -567,16 +614,6 @@ QFontEngineData::~QFontEngineData()
\since 5.2
*/
-#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
-/*!
- \obsolete
- Constructs a font from \a font for use on the paint device \a pd.
-*/
-QFont::QFont(const QFont &font, QPaintDevice *pd)
- : QFont(font, static_cast<const QPaintDevice*>(pd))
-{}
-#endif
-
/*!
\since 5.13
Constructs a font from \a font for use on the paint device \a pd.
@@ -611,8 +648,10 @@ void QFont::detach()
if (d->engineData && !d->engineData->ref.deref())
delete d->engineData;
d->engineData = nullptr;
- if (d->scFont && d->scFont != d.data())
- d->scFont->ref.deref();
+ if (d->scFont && d->scFont != d.data()) {
+ if (!d->scFont->ref.deref())
+ delete d->scFont;
+ }
d->scFont = nullptr;
return;
}
@@ -663,11 +702,15 @@ QFont::QFont()
available a family will be set using the \l{QFont}{font matching}
algorithm.
+ This will split the family string on a comma and call setFamilies() with the
+ resulting list. To preserve a font that uses a comma in its name, use
+ the constructor that takes a QStringList.
+
\sa Weight, setFamily(), setPointSize(), setWeight(), setItalic(),
- setStyleHint(), QGuiApplication::font()
+ setStyleHint(), setFamilies(), QGuiApplication::font()
*/
QFont::QFont(const QString &family, int pointSize, int weight, bool italic)
- : d(new QFontPrivate()), resolve_mask(QFont::FamilyResolved)
+ : d(new QFontPrivate()), resolve_mask(QFont::FamiliesResolved)
{
if (pointSize <= 0) {
pointSize = 12;
@@ -684,7 +727,48 @@ QFont::QFont(const QString &family, int pointSize, int weight, bool italic)
if (italic)
resolve_mask |= QFont::StyleResolved;
- d->request.family = family;
+ d->request.families = splitIntoFamilies(family);
+ d->request.pointSize = qreal(pointSize);
+ d->request.pixelSize = -1;
+ d->request.weight = weight;
+ d->request.style = italic ? QFont::StyleItalic : QFont::StyleNormal;
+}
+
+/*!
+ Constructs a font object with the specified \a families, \a
+ pointSize, \a weight and \a italic settings.
+
+ If \a pointSize is zero or negative, the point size of the font
+ is set to a system-dependent default value. Generally, this is
+ 12 points.
+
+ Each family name entry in \a families may optionally also include
+ a foundry name, e.g. "Helvetica [Cronyx]". If the family is
+ available from more than one foundry and the foundry isn't
+ specified, an arbitrary foundry is chosen. If the family isn't
+ available a family will be set using the \l{QFont}{font matching}
+ algorithm.
+
+ \sa Weight, setPointSize(), setWeight(), setItalic(),
+ setStyleHint(), setFamilies(), QGuiApplication::font()
+ */
+QFont::QFont(const QStringList &families, int pointSize, int weight, bool italic)
+ : d(new QFontPrivate()), resolve_mask(QFont::FamiliesResolved)
+{
+ if (pointSize <= 0)
+ pointSize = 12;
+ else
+ resolve_mask |= QFont::SizeResolved;
+
+ if (weight < 0)
+ weight = Normal;
+ else
+ resolve_mask |= QFont::WeightResolved | QFont::StyleResolved;
+
+ if (italic)
+ resolve_mask |= QFont::StyleResolved;
+
+ d->request.families = families;
d->request.pointSize = qreal(pointSize);
d->request.pixelSize = -1;
d->request.weight = weight;
@@ -725,14 +809,14 @@ QFont &QFont::operator=(const QFont &font)
*/
/*!
- Returns the requested font family name, i.e. the name set in the
- constructor or the last setFont() call.
+ Returns the requested font family name. This will always be the same
+ as the first entry in the families() call.
- \sa setFamily(), substitutes(), substitute()
+ \sa setFamily(), substitutes(), substitute(), setFamilies(), families()
*/
QString QFont::family() const
{
- return d->request.family;
+ return d->request.families.isEmpty() ? QString() : d->request.families.constFirst();
}
/*!
@@ -746,18 +830,11 @@ QString QFont::family() const
available a family will be set using the \l{QFont}{font matching}
algorithm.
- \sa family(), setStyleHint(), QFontInfo
+ \sa family(), setStyleHint(), setFamilies(), families(), QFontInfo
*/
void QFont::setFamily(const QString &family)
{
- if ((resolve_mask & QFont::FamilyResolved) && d->request.family == family)
- return;
-
- detach();
-
- d->request.family = family;
-
- resolve_mask |= QFont::FamilyResolved;
+ setFamilies(QStringList(family));
}
/*!
@@ -846,13 +923,7 @@ int QFont::pointSize() const
\li PreferVerticalHinting
\li PreferFullHinting
\row
- \li Windows Vista (w/o Platform Update) and earlier
- \li Full hinting
- \li Full hinting
- \li Full hinting
- \li Full hinting
- \row
- \li Windows 7 and Windows Vista (w/Platform Update) and DirectWrite enabled in Qt
+ \li Windows and DirectWrite enabled in Qt
\li Full hinting
\li Vertical hinting
\li Vertical hinting
@@ -871,12 +942,6 @@ int QFont::pointSize() const
\li No hinting
\endtable
- \note Please be aware that altering the hinting preference on Windows is available through
- the DirectWrite font engine. This is available on Windows Vista after installing the platform
- update, and on Windows 7. In order to use this extension, configure Qt using -directwrite.
- The target application will then depend on the availability of DirectWrite on the target
- system.
-
*/
/*!
@@ -972,7 +1037,8 @@ qreal QFont::pointSizeF() const
}
/*!
- Sets the font size to \a pixelSize pixels.
+ Sets the font size to \a pixelSize pixels, with a maxiumum size
+ of an unsigned 16-bit integer.
Using this function makes the font device dependent. Use
setPointSize() or setPointSizeF() to set the size of the font
@@ -1064,30 +1130,69 @@ void QFont::setStyle(Style style)
\sa setWeight(), Weight, QFontInfo
*/
-int QFont::weight() const
+QFont::Weight QFont::weight() const
{
- return d->request.weight;
+ return static_cast<Weight>(d->request.weight);
}
/*!
\enum QFont::Weight
- Qt uses a weighting scale from 0 to 99 similar to, but not the
- same as, the scales used in Windows or CSS. A weight of 0 will be
- thin, whilst 99 will be extremely black.
+ Qt uses a weighting scale from 1 to 1000 compatible with OpenType. A weight of 1 will be
+ thin, whilst 1000 will be extremely black.
This enum contains the predefined font weights:
- \value Thin 0
- \value ExtraLight 12
- \value Light 25
- \value Normal 50
- \value Medium 57
- \value DemiBold 63
- \value Bold 75
- \value ExtraBold 81
- \value Black 87
+ \value Thin 100
+ \value ExtraLight 200
+ \value Light 300
+ \value Normal 400
+ \value Medium 500
+ \value DemiBold 600
+ \value Bold 700
+ \value ExtraBold 800
+ \value Black 900
+*/
+
+#if QT_DEPRECATED_SINCE(6, 0)
+/*!
+ \deprecated [6.0] Use setWeight() instead.
+
+ Sets the weight of the font to \a legacyWeight using the legacy font
+ weight scale of Qt 5 and previous versions.
+
+ Since Qt 6, the OpenType standard's font weight scale is used instead
+ of a non-standard scale. This requires conversion from values that
+ use the old scale. For convenience, this function may be used when
+ porting from code which uses the old weight scale.
+
+ \note If styleName() is set, this value may be ignored for font selection.
+
+ \sa setWeight(), weight(), QFontInfo
*/
+void QFont::setLegacyWeight(int legacyWeight)
+{
+ setWeight(QFont::Weight(qt_legacyToOpenTypeWeight(legacyWeight)));
+}
+
+/*!
+ \deprecated [6.0] Use weight() instead.
+
+ Returns the weight of the font converted to the non-standard font
+ weight scale used in Qt 5 and earlier versions.
+
+ Since Qt 6, the OpenType standard's font weight scale is used instead
+ of a non-standard scale. This requires conversion from values that
+ use the old scale. For convenience, this function may be used when
+ porting from code which uses the old weight scale.
+
+ \sa setWeight(), weight(), QFontInfo
+*/
+int QFont::legacyWeight() const
+{
+ return qt_openTypeToLegacyWeight(weight());
+}
+#endif // QT_DEPRECATED_SINCE(6, 0)
/*!
Sets the weight of the font to \a weight, using the scale defined by
@@ -1097,16 +1202,20 @@ int QFont::weight() const
\sa weight(), QFontInfo
*/
-void QFont::setWeight(int weight)
+void QFont::setWeight(QFont::Weight weight)
{
- Q_ASSERT_X(weight >= 0 && weight <= 99, "QFont::setWeight", "Weight must be between 0 and 99");
+ const int weightValue = qBound(QFONT_WEIGHT_MIN, static_cast<int>(weight), QFONT_WEIGHT_MAX);
+ if (weightValue != static_cast<int>(weight)) {
+ qWarning() << "QFont::setWeight: Weight must be between 1 and 1000, attempted to set "
+ << static_cast<int>(weight);
+ }
- if ((resolve_mask & QFont::WeightResolved) && d->request.weight == weight)
+ if ((resolve_mask & QFont::WeightResolved) && d->request.weight == weightValue)
return;
detach();
- d->request.weight = weight;
+ d->request.weight = weightValue;
resolve_mask |= QFont::WeightResolved;
}
@@ -1353,8 +1462,14 @@ QFont::StyleHint QFont::styleHint() const
\value NoAntialias don't antialias the fonts.
\value NoSubpixelAntialias avoid subpixel antialiasing on the fonts if possible.
\value PreferAntialias antialias if possible.
- \value OpenGLCompatible forces the use of OpenGL compatible
- fonts.
+ \value [since 6.8] ContextFontMerging If the selected font does not contain a certain character,
+ then Qt automatically chooses a similar-looking fallback font that contains the
+ character. By default this is done on a character-by-character basis. This means that in
+ certain uncommon cases, multiple fonts may be used to represent one string of text even
+ if it's in the same script. Setting \c ContextFontMerging will try finding the fallback
+ font that matches the largest subset of the input string instead. This will be more
+ expensive for strings where missing glyphs occur, but may give more consistent results.
+ If \c NoFontMerging is set, then \c ContextFontMerging will have no effect.
\value NoFontMerging If the font selected for a certain writing system
does not contain a character requested to draw, then Qt automatically chooses a similar
looking font that contains the character. The NoFontMerging flag disables this feature.
@@ -1373,8 +1488,6 @@ QFont::StyleHint QFont::styleHint() const
\value PreferQuality prefer the best quality font. The font matcher
will use the nearest standard point size that the font
supports.
- \value ForceIntegerMetrics forces the use of integer values in font engines that support fractional
- font metrics.
*/
/*!
@@ -1429,7 +1542,7 @@ void QFont::setStyleStrategy(StyleStrategy s)
Predefined stretch values that follow the CSS naming convention. The higher
the value, the more stretched the text is.
- \value AnyStretch 0 Accept any stretch matched using the other QFont properties (added in Qt 5.8)
+ \value [since 5.8] AnyStretch 0 Accept any stretch matched using the other QFont properties
\value UltraCondensed 50
\value ExtraCondensed 62
\value Condensed 75
@@ -1632,31 +1745,6 @@ QFont::Capitalization QFont::capitalization() const
return static_cast<QFont::Capitalization> (d->capital);
}
-#if QT_DEPRECATED_SINCE(5, 5)
-/*!
- \fn void QFont::setRawMode(bool enable)
- \deprecated
-
- If \a enable is true, turns raw mode on; otherwise turns raw mode
- off. This function only has an effect under X11.
-
- If raw mode is enabled, Qt will search for an X font with a
- complete font name matching the family name, ignoring all other
- values set for the QFont. If the font name matches several fonts,
- Qt will use the first font returned by X. QFontInfo \e cannot be
- used to fetch information about a QFont using raw mode (it will
- return the values set in the QFont for all parameters, including
- the family name).
-
- \warning Enabling raw mode has no effect since Qt 5.0.
-
- \sa rawMode()
-*/
-void QFont::setRawMode(bool)
-{
-}
-#endif
-
/*!
Returns \c true if a window system font exactly matching the settings
of this font is available.
@@ -1692,6 +1780,7 @@ bool QFont::operator==(const QFont &f) const
&& f.d->letterSpacingIsAbsolute == d->letterSpacingIsAbsolute
&& f.d->letterSpacing == d->letterSpacing
&& f.d->wordSpacing == d->wordSpacing
+ && f.d->features == d->features
));
}
@@ -1721,7 +1810,6 @@ bool QFont::operator<(const QFont &f) const
if (r1.styleHint != r2.styleHint) return r1.styleHint < r2.styleHint;
if (r1.styleStrategy != r2.styleStrategy) return r1.styleStrategy < r2.styleStrategy;
if (r1.families != r2.families) return r1.families < r2.families;
- if (r1.family != r2.family) return r1.family < r2.family;
if (f.d->capital != d->capital) return f.d->capital < d->capital;
if (f.d->letterSpacingIsAbsolute != d->letterSpacingIsAbsolute) return f.d->letterSpacingIsAbsolute < d->letterSpacingIsAbsolute;
@@ -1730,7 +1818,37 @@ bool QFont::operator<(const QFont &f) const
int f1attrs = (f.d->underline << 3) + (f.d->overline << 2) + (f.d->strikeOut<<1) + f.d->kerning;
int f2attrs = (d->underline << 3) + (d->overline << 2) + (d->strikeOut<<1) + d->kerning;
- return f1attrs < f2attrs;
+ if (f1attrs != f2attrs) return f1attrs < f2attrs;
+
+ if (d->features.size() != f.d->features.size())
+ return f.d->features.size() < d->features.size();
+
+ {
+ auto it = d->features.constBegin();
+ auto jt = f.d->features.constBegin();
+ for (; it != d->features.constEnd(); ++it, ++jt) {
+ if (it.key() != jt.key())
+ return jt.key() < it.key();
+ if (it.value() != jt.value())
+ return jt.value() < it.value();
+ }
+ }
+
+ if (r1.variableAxisValues.size() != r2.variableAxisValues.size())
+ return r1.variableAxisValues.size() < r2.variableAxisValues.size();
+
+ {
+ auto it = r1.variableAxisValues.constBegin();
+ auto jt = r2.variableAxisValues.constBegin();
+ for (; it != r1.variableAxisValues.constEnd(); ++it, ++jt) {
+ if (it.key() != jt.key())
+ return jt.key() < it.key();
+ if (it.value() != jt.value())
+ return jt.value() < it.value();
+ }
+ }
+
+ return false;
}
@@ -1753,7 +1871,7 @@ bool QFont::operator!=(const QFont &f) const
*/
QFont::operator QVariant() const
{
- return QVariant(QVariant::Font, this);
+ return QVariant::fromValue(*this);
}
/*!
@@ -1768,21 +1886,6 @@ bool QFont::isCopyOf(const QFont & f) const
return d == f.d;
}
-#if QT_DEPRECATED_SINCE(5, 5)
-/*!
- \deprecated
-
- Returns \c true if raw mode is used for font name matching; otherwise
- returns \c false.
-
- \sa setRawMode()
-*/
-bool QFont::rawMode() const
-{
- return false;
-}
-#endif
-
/*!
Returns a new QFont that has attributes copied from \a other that
have not been previously set on this font.
@@ -1803,12 +1906,12 @@ QFont QFont::resolve(const QFont &other) const
}
/*!
- \fn uint QFont::resolve() const
+ \fn uint QFont::resolveMask() const
\internal
*/
/*!
- \fn void QFont::resolve(uint mask)
+ \fn void QFont::setResolveMask(uint mask)
\internal
*/
@@ -1864,6 +1967,9 @@ QStringList QFont::substitutes(const QString &familyName)
Inserts \a substituteName into the substitution
table for the family \a familyName.
+ After substituting a font, trigger the updating of the font by destroying
+ and re-creating all QFont objects.
+
\sa insertSubstitutions(), removeSubstitutions(), substitutions(), substitute(), substitutes()
*/
void QFont::insertSubstitution(const QString &familyName,
@@ -1882,6 +1988,10 @@ void QFont::insertSubstitution(const QString &familyName,
Inserts the list of families \a substituteNames into the
substitution list for \a familyName.
+ After substituting a font, trigger the updating of the font by destroying
+ and re-creating all QFont objects.
+
+
\sa insertSubstitution(), removeSubstitutions(), substitutions(), substitute()
*/
void QFont::insertSubstitutions(const QString &familyName,
@@ -1911,17 +2021,9 @@ void QFont::removeSubstitutions(const QString &familyName)
}
/*!
- \fn void QFont::removeSubstitution(const QString &familyName)
-
- \obsolete
-
- This function is deprecated. Use removeSubstitutions() instead.
-*/
-
-/*!
Returns a sorted list of substituted family names.
- \sa insertSubstitution(), removeSubstitution(), substitute()
+ \sa insertSubstitution(), removeSubstitutions(), substitute()
*/
QStringList QFont::substitutions()
{
@@ -2001,45 +2103,6 @@ static void set_extended_font_bits(quint8 bits, QFontPrivate *f)
}
#endif
-#if QT_DEPRECATED_SINCE(5, 3)
-/*!
- \fn QString QFont::rawName() const
- \deprecated
-
- Returns the name of the font within the underlying window system.
-
- On X11, this function will return an empty string.
-
- Using the return value of this function is usually \e not \e
- portable.
-
- \sa setRawName()
-*/
-QString QFont::rawName() const
-{
- return QLatin1String("unknown");
-}
-
-/*!
- \fn void QFont::setRawName(const QString &name)
- \deprecated
-
- Sets a font by its system specific name.
-
- A font set with setRawName() is still a full-featured QFont. It can
- be queried (for example with italic()) or modified (for example with
- setItalic()) and is therefore also suitable for rendering rich text.
-
- If Qt's internal font database cannot resolve the raw name, the
- font becomes a raw font with \a name as its family.
-
- \sa rawName(), setFamily()
-*/
-void QFont::setRawName(const QString &)
-{
-}
-#endif
-
/*!
Returns the font's key, a textual representation of a font. It is
typically used as the key for a cache or dictionary of fonts.
@@ -2054,13 +2117,32 @@ QString QFont::key() const
/*!
Returns a description of the font. The description is a
comma-separated list of the attributes, perfectly suited for use
- in QSettings.
+ in QSettings, and consists of the following:
+
+ \list
+ \li Font family
+ \li Point size
+ \li Pixel size
+ \li Style hint
+ \li Font weight
+ \li Font style
+ \li Underline
+ \li Strike out
+ \li Fixed pitch
+ \li Always \e{0}
+ \li Capitalization
+ \li Letter spacing
+ \li Word spacing
+ \li Stretch
+ \li Style strategy
+ \li Font style (omitted when unavailable)
+ \endlist
\sa fromString()
*/
QString QFont::toString() const
{
- const QChar comma(QLatin1Char(','));
+ const QChar comma(u',');
QString fontDescription = family() + comma +
QString::number( pointSizeF()) + comma +
QString::number( pixelSize()) + comma +
@@ -2070,7 +2152,13 @@ QString QFont::toString() const
QString::number((int) underline()) + comma +
QString::number((int) strikeOut()) + comma +
QString::number((int)fixedPitch()) + comma +
- QString::number((int) false);
+ QString::number((int) false) + comma +
+ QString::number((int)capitalization()) + comma +
+ QString::number((int)letterSpacingType()) + comma +
+ QString::number(letterSpacing()) + comma +
+ QString::number(wordSpacing()) + comma +
+ QString::number(stretch()) + comma +
+ QString::number((int)styleStrategy());
QString fontStyle = styleName();
if (!fontStyle.isEmpty())
@@ -2086,7 +2174,7 @@ QString QFont::toString() const
\relates QFont
\since 5.3
*/
-uint qHash(const QFont &font, uint seed) noexcept
+size_t qHash(const QFont &font, size_t seed) noexcept
{
return qHash(QFontPrivate::get(font)->request, seed);
}
@@ -2101,10 +2189,10 @@ uint qHash(const QFont &font, uint seed) noexcept
*/
bool QFont::fromString(const QString &descrip)
{
- const QStringRef sr = QStringRef(&descrip).trimmed();
- const auto l = sr.split(QLatin1Char(','));
- const int count = l.count();
- if (!count || (count > 2 && count < 9) || count > 11 ||
+ const auto sr = QStringView(descrip).trimmed();
+ const auto l = sr.split(u',');
+ const int count = l.size();
+ if (!count || (count > 2 && count < 9) || count == 9 || count > 17 ||
l.first().isEmpty()) {
qWarning("QFont::fromString: Invalid description '%s'",
descrip.isEmpty() ? "(empty)" : descrip.toLatin1().data());
@@ -2116,7 +2204,7 @@ bool QFont::fromString(const QString &descrip)
setPointSizeF(l[1].toDouble());
if (count == 9) {
setStyleHint((StyleHint) l[2].toInt());
- setWeight(qMax(qMin(99, l[3].toInt()), 0));
+ setWeight(QFont::Weight(l[3].toInt()));
setItalic(l[4].toInt());
setUnderline(l[5].toInt());
setStrikeOut(l[6].toInt());
@@ -2125,13 +2213,23 @@ bool QFont::fromString(const QString &descrip)
if (l[2].toInt() > 0)
setPixelSize(l[2].toInt());
setStyleHint((StyleHint) l[3].toInt());
- setWeight(qMax(qMin(99, l[4].toInt()), 0));
+ if (count >= 16)
+ setWeight(QFont::Weight(l[4].toInt()));
+ else
+ setWeight(QFont::Weight(qt_legacyToOpenTypeWeight(l[4].toInt())));
setStyle((QFont::Style)l[5].toInt());
setUnderline(l[6].toInt());
setStrikeOut(l[7].toInt());
setFixedPitch(l[8].toInt());
- if (count == 11)
- d->request.styleName = l[10].toString();
+ if (count >= 16) {
+ setCapitalization((Capitalization)l[10].toInt());
+ setLetterSpacing((SpacingType)l[11].toInt(), l[12].toDouble());
+ setWordSpacing(l[13].toDouble());
+ setStretch(l[14].toInt());
+ setStyleStrategy((StyleStrategy)l[15].toInt());
+ }
+ if (count == 11 || count == 17)
+ d->request.styleName = l[count - 1].toString();
else
d->request.styleName.clear();
}
@@ -2171,22 +2269,402 @@ void QFont::cacheStatistics()
{
}
-#if QT_DEPRECATED_SINCE(5, 13)
/*!
- \fn QString QFont::lastResortFamily() const
+ \class QFont::Tag
+ \brief The QFont::Tag type provides access to advanced font features.
+ \since 6.7
+ \inmodule QtGui
+
+ QFont provides access to advanced features when shaping text. A feature is defined
+ by a tag, which can be represented as a four-character string, or as a 32bit integer
+ value. This type represents such a tag in a type-safe way. It can be constructed from
+ a four-character, 8bit string literal, or from a corresponding 32bit integer value.
+ Using a shorter or longer string literal will result in a compile-time error.
+
+ \code
+ QFont font;
+ // Correct
+ font.setFeature("frac");
+
+ // Wrong - won't compile
+ font.setFeature("fraction");
+
+ // Wrong - will produce runtime warning and fail
+ font.setFeature(u"fraction"_s);
+ \endcode
+
+ The named constructors allow to create a tag from an 32bit integer or string value,
+ and will return a \c std::nullopt when the input is invalid.
+
+ \sa QFont::setFeature(), QFont::featureTags()
+*/
+
+/*!
+ \fn QFont::Tag::Tag()
+
+ Default constructor, producing an invalid tag.
+*/
+
+/*!
+ \fn template <size_t N> QFont::Tag::Tag(const char (&str)[N]) noexcept
+
+ Constructs a tag from a string literal, \a str. The literal must be exactly four
+ characters long.
+
+ \code
+ font.setFeature("frac", 1);
+ \endcode
+
+ \sa fromString(), fromValue()
+*/
+
+/*!
+ \fn bool QFont::Tag::comparesEqual(const QFont::Tag &lhs, const QFont::Tag &rhs) noexcept
+ \fn Qt::strong_ordering QFont::Tag::compareThreeWay(const QFont::Tag &lhs, const QFont::Tag &rhs) noexcept
+
+ Compare \a lhs with \a rhs for equality and ordering.
+*/
+
+/*!
+ \fn size_t QFont::Tag::qHash(QFont::Tag key, size_t seed) noexcept
+
+ Returns the hash value for \a key, using \a seed to seed the calculation.
+*/
+
+/*!
+ \fn quint32 QFont::Tag::value() const noexcept
+
+ Returns the numerical value of this tag.
+
+ \sa isValid(), fromValue()
+*/
+
+/*!
+ \fn bool QFont::Tag::isValid() const noexcept
+
+ Returns whether the tag is valid. A tag is valid if its value is not zero.
- \obsolete
+ \sa value(), fromValue(), fromString()
+*/
+
+/*!
+ \fn QByteArray QFont::Tag::toString() const noexcept
+
+ Returns the string representation of this tag as a byte array.
+
+ \sa fromString()
+*/
+
+/*!
+ \fn std::optional<QFont::Tag> QFont::Tag::fromValue(quint32 value) noexcept
- This function is deprecated and is not in use by the font
- selection algorithm in Qt 5. It always returns "helvetica".
+ Returns a tag constructed from \a value, or \c std::nullopt if the tag produced
+ would be invalid.
- \sa lastResortFont()
+ \sa isValid()
*/
-QString QFont::lastResortFamily() const
+
+/*!
+ Returns a tag constructed from the string in \a view. The string must be exactly
+ four characters long.
+
+ Returns \c std::nullopt if the input is not four characters long, or if the tag
+ produced would be invalid.
+
+ \sa isValid(), fromValue()
+*/
+std::optional<QFont::Tag> QFont::Tag::fromString(QAnyStringView view) noexcept
{
- return QStringLiteral("helvetica");
+ if (view.size() != 4) {
+ qWarning("The tag name must be exactly 4 characters long!");
+ return std::nullopt;
+ }
+ const QFont::Tag maybeTag = view.visit([](auto view) {
+ using CharType = decltype(view.at(0));
+ if constexpr (std::is_same_v<CharType, char>) {
+ const char bytes[5] = { view.at(0), view.at(1), view.at(2), view.at(3), 0 };
+ return Tag(bytes);
+ } else {
+ const char bytes[5] = { view.at(0).toLatin1(), view.at(1).toLatin1(),
+ view.at(2).toLatin1(), view.at(3).toLatin1(), 0 };
+ return Tag(bytes);
+ }
+ });
+ return maybeTag.isValid() ? std::optional<Tag>(maybeTag) : std::nullopt;
+}
+
+/*!
+ \fn QDataStream &operator<<(QDataStream &, QFont::Tag)
+ \fn QDataStream &operator>>(QDataStream &, QFont::Tag &)
+ \relates QFont::Tag
+
+ Data stream operators for QFont::Tag.
+*/
+
+/*!
+ \since 6.7
+
+ Applies a \a value to the variable axis corresponding to \a tag.
+
+ Variable fonts provide a way to store multiple variations (with different weights, widths
+ or styles) in the same font file. The variations are given as floating point values for
+ a pre-defined set of parameters, called "variable axes". Specific instances are typically
+ given names by the font designer, and, in Qt, these can be selected using setStyleName()
+ just like traditional sub-families.
+
+ In some cases, it is also useful to provide arbitrary values for the different axes. For
+ instance, if a font has a Regular and Bold sub-family, you may want a weight in-between these.
+ You could then manually request this by supplying a custom value for the "wght" axis in the
+ font.
+
+ \code
+ QFont font;
+ font.setVariableAxis("wght", (QFont::Normal + QFont::Bold) / 2.0f);
+ \endcode
+
+ If the "wght" axis is supported by the font and the given value is within its defined range,
+ a font corresponding to the weight 550.0 will be provided.
+
+ There are a few standard axes than many fonts provide, such as "wght" (weight), "wdth" (width),
+ "ital" (italic) and "opsz" (optical size). They each have indivdual ranges defined in the font
+ itself. For instance, "wght" may span from 100 to 900 (QFont::Thin to QFont::Black) whereas
+ "ital" can span from 0 to 1 (from not italic to fully italic).
+
+ A font may also choose to define custom axes; the only limitation is that the name has to
+ meet the requirements for a QFont::Tag (sequence of four latin-1 characters.)
+
+ By default, no variable axes are set.
+
+ \note On Windows, variable axes are not supported if the optional GDI font backend is in use.
+
+ \sa unsetVariableAxis
+ */
+void QFont::setVariableAxis(Tag tag, float value)
+{
+ if (tag.isValid()) {
+ if (resolve_mask & QFont::VariableAxesResolved && d->hasVariableAxis(tag, value))
+ return;
+
+ detach();
+
+ d->setVariableAxis(tag, value);
+ resolve_mask |= QFont::VariableAxesResolved;
+ }
+}
+
+/*!
+ \since 6.7
+
+ Unsets a previously set variable axis value given by \a tag.
+
+ \note If no value has previously been given for this tag, the QFont will still consider its
+ variable axes as set when resolving against other QFont values.
+
+ \sa setVariableAxis
+*/
+void QFont::unsetVariableAxis(Tag tag)
+{
+ if (tag.isValid()) {
+ detach();
+
+ d->unsetVariableAxis(tag);
+ resolve_mask |= QFont::VariableAxesResolved;
+ }
+}
+
+/*!
+ \since 6.7
+
+ Returns a list of tags for all variable axes currently set on this QFont.
+
+ See \l{QFont::}{setVariableAxis()} for more details on variable axes.
+
+ \sa QFont::Tag, setVariableAxis(), unsetVariableAxis(), isVariableAxisSet(), clearVariableAxes()
+*/
+QList<QFont::Tag> QFont::variableAxisTags() const
+{
+ return d->request.variableAxisValues.keys();
+}
+
+/*!
+ \since 6.7
+
+ Returns the value set for a specific variable axis \a tag. If the tag has not been set, 0.0 will
+ be returned instead.
+
+ See \l{QFont::}{setVariableAxis()} for more details on variable axes.
+
+ \sa QFont::Tag, setVariableAxis(), unsetVariableAxis(), isVariableAxisSet(), clearVariableAxes()
+*/
+float QFont::variableAxisValue(Tag tag) const
+{
+ return d->request.variableAxisValues.value(tag);
+}
+
+/*!
+ \since 6.7
+
+ Returns true if a value for the variable axis given by \a tag has been set on the QFont,
+ otherwise returns false.
+
+ See \l{QFont::}{setVariableAxis()} for more details on font variable axes.
+
+ \sa QFont::Tag, setVariableAxis(), unsetVariableAxis(), variableAxisValue(), clearVariableAxes()
+*/
+bool QFont::isVariableAxisSet(Tag tag) const
+{
+ return d->request.variableAxisValues.contains(tag);
+}
+
+/*!
+ \since 6.7
+
+ Clears any previously set variable axis values on the QFont.
+
+ See \l{QFont::}{setVariableAxis()} for more details on variable axes.
+
+ \sa QFont::Tag, setVariableAxis(), unsetVariableAxis(), isVariableAxisSet(), variableAxisValue()
+*/
+void QFont::clearVariableAxes()
+{
+ if (d->request.variableAxisValues.isEmpty())
+ return;
+
+ detach();
+ d->request.variableAxisValues.clear();
+}
+
+
+/*!
+ \since 6.7
+ \overload
+
+ Applies an integer value to the typographical feature specified by \a tag when shaping the
+ text. This provides advanced access to the font shaping process, and can be used to support
+ font features that are otherwise not covered in the API.
+
+ The feature is specified by a \l{QFont::Tag}{tag}, which is typically encoded from the
+ four-character feature name in the font feature map.
+
+ This integer \a value passed along with the tag in most cases represents a boolean value: A zero
+ value means the feature is disabled, and a non-zero value means it is enabled. For certain
+ font features, however, it may have other interpretations. For example, when applied to the
+ \c salt feature, the value is an index that specifies the stylistic alternative to use.
+
+ For example, the \c frac font feature will convert diagonal fractions separated with a slash
+ (such as \c 1/2) with a different representation. Typically this will involve baking the full
+ fraction into a single character width (such as \c ½).
+
+ If a font supports the \c frac feature, then it can be enabled in the shaper by setting
+ \c{features["frac"] = 1} in the font feature map.
+
+ \note By default, Qt will enable and disable certain font features based on other font
+ properties. In particular, the \c kern feature will be enabled/disabled depending on the
+ \l kerning() property of the QFont. In addition, all ligature features
+ (\c liga, \c clig, \c dlig, \c hlig) will be disabled if a \l letterSpacing() is applied,
+ but only for writing systems where the use of ligature is cosmetic. For writing systems where
+ ligatures are required, the features will remain in their default state. The values set using
+ setFeature() and related functions will override the default behavior. If, for instance,
+ the feature "kern" is set to 1, then kerning will always be enabled, regardless of whether the
+ kerning property is set to false. Similarly, if it is set to 0, then it will always be disabled.
+ To reset a font feature to its default behavior, you can unset it using unsetFeature().
+
+ \sa QFont::Tag, clearFeatures(), setFeature(), unsetFeature(), featureTags()
+*/
+void QFont::setFeature(Tag tag, quint32 value)
+{
+ if (tag.isValid()) {
+ d->detachButKeepEngineData(this);
+ d->setFeature(tag, value);
+ resolve_mask |= QFont::FeaturesResolved;
+ }
+}
+
+/*!
+ \since 6.7
+ \overload
+
+ Unsets the \a tag from the map of explicitly enabled/disabled features.
+
+ \note Even if the feature has not previously been added, this will mark the font features map
+ as modified in this QFont, so that it will take precedence when resolving against other fonts.
+
+ Unsetting an existing feature on the QFont reverts behavior to the default.
+
+ See \l setFeature() for more details on font features.
+
+ \sa QFont::Tag, clearFeatures(), setFeature(), featureTags(), featureValue()
+*/
+void QFont::unsetFeature(Tag tag)
+{
+ if (tag.isValid()) {
+ d->detachButKeepEngineData(this);
+ d->unsetFeature(tag);
+ resolve_mask |= QFont::FeaturesResolved;
+ }
+}
+
+/*!
+ \since 6.7
+
+ Returns a list of tags for all font features currently set on this QFont.
+
+ See \l{QFont::}{setFeature()} for more details on font features.
+
+ \sa QFont::Tag, setFeature(), unsetFeature(), isFeatureSet(), clearFeatures()
+*/
+QList<QFont::Tag> QFont::featureTags() const
+{
+ return d->features.keys();
+}
+
+/*!
+ \since 6.7
+
+ Returns the value set for a specific feature \a tag. If the tag has not been set, 0 will be
+ returned instead.
+
+ See \l{QFont::}{setFeature()} for more details on font features.
+
+ \sa QFont::Tag, setFeature(), unsetFeature(), featureTags(), isFeatureSet()
+*/
+quint32 QFont::featureValue(Tag tag) const
+{
+ return d->features.value(tag);
+}
+
+/*!
+ \since 6.7
+
+ Returns true if a value for the feature given by \a tag has been set on the QFont, otherwise
+ returns false.
+
+ See \l{QFont::}{setFeature()} for more details on font features.
+
+ \sa QFont::Tag, setFeature(), unsetFeature(), featureTags(), featureValue()
+*/
+bool QFont::isFeatureSet(Tag tag) const
+{
+ return d->features.contains(tag);
+}
+
+/*!
+ \since 6.7
+
+ Clears any previously set features on the QFont.
+
+ See \l{QFont::}{setFeature()} for more details on font features.
+
+ \sa QFont::Tag, setFeature(), unsetFeature(), featureTags(), featureValue()
+*/
+void QFont::clearFeatures()
+{
+ if (d->features.isEmpty())
+ return;
+
+ d->detachButKeepEngineData(this);
+ d->features.clear();
}
-#endif
extern QStringList qt_fallbacksForFamily(const QString &family, QFont::Style style,
QFont::StyleHint styleHint, QChar::Script script);
@@ -2208,24 +2686,6 @@ QString QFont::defaultFamily() const
return QString();
}
-#if QT_DEPRECATED_SINCE(5, 13)
-/*!
- \fn QString QFont::lastResortFont() const
-
- \obsolete
-
- Deprecated function. Since Qt 5.0, this is not used by the font selection algorithm. For
- compatibility it remains in the API, but will always return the same value as lastResortFamily().
-*/
-QString QFont::lastResortFont() const
-{
-QT_WARNING_PUSH
-QT_WARNING_DISABLE_DEPRECATED
- return lastResortFamily();
-QT_WARNING_POP
-}
-#endif
-
/*!
\since 5.13
@@ -2284,9 +2744,9 @@ void QFont::setFamilies(const QStringList &families)
QDataStream &operator<<(QDataStream &s, const QFont &font)
{
if (s.version() == 1) {
- s << font.d->request.family.toLatin1();
+ s << font.d->request.families.constFirst().toLatin1();
} else {
- s << font.d->request.family;
+ s << font.d->request.families.constFirst();
if (s.version() >= QDataStream::Qt_5_4)
s << font.d->request.styleName;
}
@@ -2317,9 +2777,13 @@ QDataStream &operator<<(QDataStream &s, const QFont &font)
else
s << (quint8) font.d->request.styleStrategy;
}
- s << (quint8) 0
- << (quint8) font.d->request.weight
- << get_font_bits(s.version(), font.d.data());
+
+ if (s.version() < QDataStream::Qt_6_0)
+ s << quint8(0) << quint8(qt_openTypeToLegacyWeight(font.d->request.weight));
+ else
+ s << quint16(font.d->request.weight);
+
+ s << get_font_bits(s.version(), font.d.data());
if (s.version() >= QDataStream::Qt_4_3)
s << (quint16)font.d->request.stretch;
if (s.version() >= QDataStream::Qt_4_4)
@@ -2332,8 +2796,16 @@ QDataStream &operator<<(QDataStream &s, const QFont &font)
s << (quint8)font.d->request.hintingPreference;
if (s.version() >= QDataStream::Qt_5_6)
s << (quint8)font.d->capital;
- if (s.version() >= QDataStream::Qt_5_13)
- s << font.d->request.families;
+ if (s.version() >= QDataStream::Qt_5_13) {
+ if (s.version() < QDataStream::Qt_6_0)
+ s << font.d->request.families.mid(1);
+ else
+ s << font.d->request.families;
+ }
+ if (s.version() >= QDataStream::Qt_6_6)
+ s << font.d->features;
+ if (s.version() >= QDataStream::Qt_6_7)
+ s << font.d->request.variableAxisValues;
return s;
}
@@ -2351,15 +2823,17 @@ QDataStream &operator>>(QDataStream &s, QFont &font)
font.d = new QFontPrivate;
font.resolve_mask = QFont::AllPropertiesResolved;
- quint8 styleHint, charSet, weight, bits;
+ quint8 styleHint, bits;
quint16 styleStrategy = QFont::PreferDefault;
if (s.version() == 1) {
QByteArray fam;
s >> fam;
- font.d->request.family = QString::fromLatin1(fam);
+ font.d->request.families = QStringList(QString::fromLatin1(fam));
} else {
- s >> font.d->request.family;
+ QString fam;
+ s >> fam;
+ font.d->request.families = QStringList(fam);
if (s.version() >= QDataStream::Qt_5_4)
s >> font.d->request.styleName;
}
@@ -2391,13 +2865,22 @@ QDataStream &operator>>(QDataStream &s, QFont &font)
}
}
- s >> charSet;
- s >> weight;
+ if (s.version() < QDataStream::Qt_6_0) {
+ quint8 charSet;
+ quint8 weight;
+ s >> charSet;
+ s >> weight;
+ font.d->request.weight = qt_legacyToOpenTypeWeight(weight);
+ } else {
+ quint16 weight;
+ s >> weight;
+ font.d->request.weight = weight;
+ }
+
s >> bits;
font.d->request.styleHint = styleHint;
font.d->request.styleStrategy = styleStrategy;
- font.d->request.weight = weight;
set_font_bits(s.version(), bits, font.d.data());
@@ -2432,11 +2915,40 @@ QDataStream &operator>>(QDataStream &s, QFont &font)
if (s.version() >= QDataStream::Qt_5_13) {
QStringList value;
s >> value;
- font.d->request.families = value;
+ if (s.version() < QDataStream::Qt_6_0)
+ font.d->request.families.append(value);
+ else
+ font.d->request.families = value;
+ }
+ if (s.version() >= QDataStream::Qt_6_6) {
+ font.d->features.clear();
+ s >> font.d->features;
}
+ if (s.version() >= QDataStream::Qt_6_7) {
+ font.d->request.variableAxisValues.clear();
+ s >> font.d->request.variableAxisValues;
+ }
+
return s;
}
+QDataStream &operator<<(QDataStream &stream, QFont::Tag tag)
+{
+ stream << tag.value();
+ return stream;
+}
+
+QDataStream &operator>>(QDataStream &stream, QFont::Tag &tag)
+{
+ quint32 value;
+ stream >> value;
+ if (const auto maybeTag = QFont::Tag::fromValue(value))
+ tag = *maybeTag;
+ else
+ stream.setStatus(QDataStream::ReadCorruptData);
+ return stream;
+}
+
#endif // QT_NO_DATASTREAM
@@ -2487,6 +2999,35 @@ QDataStream &operator>>(QDataStream &s, QFont &font)
info object is \e not updated.
\endlist
+ \section1 Checking for the existence of a font
+
+ Sometimes it can be useful to check if a font exists before attempting
+ to use it. The most thorough way of doing so is by using \l {exactMatch()}:
+
+ \code
+ const QFont segoeFont(QLatin1String("Segoe UI"));
+ if (QFontInfo(segoeFont).exactMatch()) {
+ // Use the font...
+ }
+ \endcode
+
+ However, this deep search of families can be expensive on some platforms.
+ \c QFontDatabase::families().contains() is a faster, but less thorough
+ alternative:
+
+ \code
+ const QLatin1String segoeUiFamilyName("Segoe UI");
+ if (QFontDatabase::families().contains(segoeUiFamilyName)) {
+ const QFont segoeFont(segoeUiFamilyName);
+ // Use the font...
+ }
+ \endcode
+
+ It's less thorough because it's not a complete search: some font family
+ aliases may be missing from the list. However, this approach results in
+ faster application startup times, and so should always be preferred if
+ possible.
+
\sa QFont, QFontMetrics, QFontDatabase
*/
@@ -2503,6 +3044,8 @@ QDataStream &operator>>(QDataStream &s, QFont &font)
Use QPainter::fontInfo() to get the font info when painting.
This will give correct results also when painting on paint device
that is not screen-compatible.
+
+ \sa {Checking for the existence of a font}
*/
QFontInfo::QFontInfo(const QFont &font)
: d(font.d)
@@ -2544,13 +3087,13 @@ QFontInfo &QFontInfo::operator=(const QFontInfo &fi)
/*!
Returns the family name of the matched window system font.
- \sa QFont::family()
+ \sa QFont::family(), {Checking for the existence of a font}
*/
QString QFontInfo::family() const
{
QFontEngine *engine = d->engineForScript(QChar::Script_Common);
Q_ASSERT(engine != nullptr);
- return engine->fontDef.family;
+ return engine->fontDef.families.isEmpty() ? QString() : engine->fontDef.families.constFirst();
}
/*!
@@ -2628,6 +3171,28 @@ QFont::Style QFontInfo::style() const
return (QFont::Style)engine->fontDef.style;
}
+
+#if QT_DEPRECATED_SINCE(6, 0)
+/*!
+ \deprecated Use weight() instead.
+
+ Returns the weight of the font converted to the non-standard font
+ weight scale used in Qt 5 and earlier versions.
+
+ Since Qt 6, the OpenType standard's font weight scale is used instead
+ of a non-standard scale. This requires conversion from values that
+ use the old scale. For convenience, this function may be used when
+ porting from code which uses the old weight scale.
+
+ \sa QFont::setWeight(), weight(), QFontInfo
+*/
+int QFontInfo::legacyWeight() const
+{
+ return qt_openTypeToLegacyWeight(weight());
+}
+#endif // QT_DEPRECATED_SINCE(6, 0)
+
+
/*!
Returns the weight of the matched window system font.
@@ -2704,10 +3269,10 @@ bool QFontInfo::fixedPitch() const
Q_ASSERT(engine != nullptr);
#ifdef Q_OS_MAC
if (!engine->fontDef.fixedPitchComputed) {
- QChar ch[2] = { QLatin1Char('i'), QLatin1Char('m') };
+ QChar ch[2] = { u'i', u'm' };
QGlyphLayoutArray<2> g;
int l = 2;
- if (!engine->stringToCMap(ch, 2, &g, &l, 0))
+ if (engine->stringToCMap(ch, 2, &g, &l, {}) < 0)
Q_UNREACHABLE();
Q_ASSERT(l == 2);
engine->fontDef.fixedPitch = g.advances[0] == g.advances[1];
@@ -2731,25 +3296,6 @@ QFont::StyleHint QFontInfo::styleHint() const
return (QFont::StyleHint) engine->fontDef.styleHint;
}
-#if QT_DEPRECATED_SINCE(5, 5)
-/*!
- \deprecated
-
- Returns \c true if the font is a raw mode font; otherwise returns
- false.
-
- If it is a raw mode font, all other functions in QFontInfo will
- return the same values set in the QFont, regardless of the font
- actually used.
-
- \sa QFont::rawMode()
-*/
-bool QFontInfo::rawMode() const
-{
- return false;
-}
-#endif
-
/*!
Returns \c true if the matched window system font is exactly the same
as the one specified by the font; otherwise returns \c false.
@@ -2770,17 +3316,21 @@ bool QFontInfo::exactMatch() const
// QFontCache
// **********************************************************************
+using namespace std::chrono_literals;
+
#ifdef QFONTCACHE_DEBUG
// fast timeouts for debugging
-static const int fast_timeout = 1000; // 1s
-static const int slow_timeout = 5000; // 5s
+static constexpr auto fast_timeout = 1s;
+static constexpr auto slow_timeout = 5s;
#else
-static const int fast_timeout = 10000; // 10s
-static const int slow_timeout = 300000; // 5m
+static constexpr auto fast_timeout = 10s;
+static constexpr auto slow_timeout = 5min;
#endif // QFONTCACHE_DEBUG
-const uint QFontCache::min_cost = 4*1024; // 4mb
-
+#ifndef QFONTCACHE_MIN_COST
+# define QFONTCACHE_MIN_COST 4*1024 // 4mb
+#endif
+const uint QFontCache::min_cost = QFONTCACHE_MIN_COST;
Q_GLOBAL_STATIC(QThreadStorage<QFontCache *>, theFontCache)
QFontCache *QFontCache::instance()
@@ -2800,14 +3350,17 @@ void QFontCache::cleanup()
// no cache - just ignore
}
if (cache && cache->hasLocalData())
- cache->setLocalData(0);
+ cache->setLocalData(nullptr);
}
-static QBasicAtomicInt font_cache_id = Q_BASIC_ATOMIC_INITIALIZER(0);
+Q_CONSTINIT static QBasicAtomicInt font_cache_id = Q_BASIC_ATOMIC_INITIALIZER(0);
QFontCache::QFontCache()
: QObject(), total_cost(0), max_cost(min_cost),
- current_timestamp(0), fast(false), timer_id(-1),
+ current_timestamp(0), fast(false),
+ autoClean(QGuiApplication::instance()
+ && (QGuiApplication::instance()->thread() == QThread::currentThread())),
+ timer_id(-1),
m_id(font_cache_id.fetchAndAddRelaxed(1) + 1)
{
}
@@ -2977,10 +3530,14 @@ void QFontCache::increaseCost(uint cost)
if (total_cost > max_cost) {
max_cost = total_cost;
+ if (!autoClean)
+ return;
+
if (timer_id == -1 || ! fast) {
- FC_DEBUG(" TIMER: starting fast timer (%d ms)", fast_timeout);
+ FC_DEBUG(" TIMER: starting fast timer (%d s)", static_cast<int>(fast_timeout.count()));
- if (timer_id != -1) killTimer(timer_id);
+ if (timer_id != -1)
+ killTimer(timer_id);
timer_id = startTimer(fast_timeout);
fast = true;
}
@@ -3071,22 +3628,26 @@ void QFontCache::decreaseCache()
FC_DEBUG(" after sweep, in use %u kb, total %u kb, max %u kb, new max %u kb",
in_use_cost, total_cost, max_cost, new_max_cost);
- if (new_max_cost == max_cost) {
- if (fast) {
- FC_DEBUG(" cannot shrink cache, slowing timer");
+ if (autoClean) {
+ if (new_max_cost == max_cost) {
+ if (fast) {
+ FC_DEBUG(" cannot shrink cache, slowing timer");
- killTimer(timer_id);
- timer_id = startTimer(slow_timeout);
- fast = false;
- }
+ if (timer_id != -1) {
+ killTimer(timer_id);
+ timer_id = startTimer(slow_timeout);
+ fast = false;
+ }
- return;
- } else if (! fast) {
- FC_DEBUG(" dropping into passing gear");
+ return;
+ } else if (! fast) {
+ FC_DEBUG(" dropping into passing gear");
- killTimer(timer_id);
- timer_id = startTimer(fast_timeout);
- fast = true;
+ if (timer_id != -1)
+ killTimer(timer_id);
+ timer_id = startTimer(fast_timeout);
+ fast = true; }
+ }
}
max_cost = new_max_cost;
@@ -3183,7 +3744,7 @@ QDebug operator<<(QDebug stream, const QFont &font)
const QFont defaultFont(new QFontPrivate);
- for (int property = QFont::FamilyResolved; property < QFont::AllPropertiesResolved; property <<= 1) {
+ for (int property = QFont::SizeResolved; property < QFont::AllPropertiesResolved; property <<= 1) {
const bool resolved = (font.resolve_mask & property) != 0;
if (!resolved && stream.verbosity() == QDebug::MinimumVerbosity)
continue;
@@ -3195,8 +3756,6 @@ QDebug operator<<(QDebug stream, const QFont &font)
QDebugStateSaver saver(debug);
switch (property) {
- case QFont::FamilyResolved:
- debug << font.family(); break;
case QFont::SizeResolved:
if (font.pointSizeF() >= 0)
debug << font.pointSizeF() << "pt";
@@ -3266,6 +3825,15 @@ QDebug operator<<(QDebug stream, const QFont &font)
return stream;
}
+
+QDebug operator<<(QDebug debug, QFont::Tag tag)
+{
+ QDebugStateSaver saver(debug);
+ debug.noquote() << tag.toString();
+ return debug;
+}
#endif
QT_END_NAMESPACE
+
+#include "moc_qfont.cpp"
diff --git a/src/gui/text/qfont.h b/src/gui/text/qfont.h
index 683aa3bf65..66a5f7c155 100644
--- a/src/gui/text/qfont.h
+++ b/src/gui/text/qfont.h
@@ -1,56 +1,21 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the QtGui module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#ifndef QFONT_H
#define QFONT_H
+#include <QtCore/qcompare.h>
+#include <QtCore/qendian.h>
+#include <QtCore/qshareddata.h>
#include <QtGui/qtguiglobal.h>
#include <QtGui/qwindowdefs.h>
#include <QtCore/qstring.h>
-#include <QtCore/qsharedpointer.h>
QT_BEGIN_NAMESPACE
class QFontPrivate; /* don't touch */
-class QStringList;
class QVariant;
class Q_GUI_EXPORT QFont
@@ -80,10 +45,9 @@ public:
PreferQuality = 0x0040,
PreferAntialias = 0x0080,
NoAntialias = 0x0100,
- OpenGLCompatible = 0x0200,
- ForceIntegerMetrics = 0x0400,
NoSubpixelAntialias = 0x0800,
PreferNoShaping = 0x1000,
+ ContextFontMerging = 0x2000,
NoFontMerging = 0x8000
};
Q_ENUM(StyleStrategy)
@@ -96,17 +60,16 @@ public:
};
Q_ENUM(HintingPreference)
- // Mapping OpenType weight value.
enum Weight {
- Thin = 0, // 100
- ExtraLight = 12, // 200
- Light = 25, // 300
- Normal = 50, // 400
- Medium = 57, // 500
- DemiBold = 63, // 600
- Bold = 75, // 700
- ExtraBold = 81, // 800
- Black = 87 // 900
+ Thin = 100,
+ ExtraLight = 200,
+ Light = 300,
+ Normal = 400,
+ Medium = 500,
+ DemiBold = 600,
+ Bold = 700,
+ ExtraBold = 800,
+ Black = 900
};
Q_ENUM(Weight)
@@ -166,21 +129,22 @@ public:
HintingPreferenceResolved = 0x8000,
StyleNameResolved = 0x10000,
FamiliesResolved = 0x20000,
- AllPropertiesResolved = 0x3ffff
+ FeaturesResolved = 0x40000,
+ VariableAxesResolved = 0x80000,
+ AllPropertiesResolved = 0xfffff
};
Q_ENUM(ResolveProperties)
QFont();
+
QFont(const QString &family, int pointSize = -1, int weight = -1, bool italic = false);
-#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
- QFont(const QFont &font, QPaintDevice *pd);
-#endif
+ explicit QFont(const QStringList &families, int pointSize = -1, int weight = -1, bool italic = false);
QFont(const QFont &font, const QPaintDevice *pd);
QFont(const QFont &font);
~QFont();
- void swap(QFont &other)
- { qSwap(d, other.d); qSwap(resolve_mask, other.resolve_mask); }
+ void swap(QFont &other) noexcept
+ { d.swap(other.d); std::swap(resolve_mask, other.resolve_mask); }
QString family() const;
void setFamily(const QString &);
@@ -199,8 +163,8 @@ public:
int pixelSize() const;
void setPixelSize(int);
- int weight() const;
- void setWeight(int);
+ Weight weight() const;
+ void setWeight(Weight weight);
inline bool bold() const;
inline void setBold(bool);
@@ -247,11 +211,75 @@ public:
void setHintingPreference(HintingPreference hintingPreference);
HintingPreference hintingPreference() const;
-#if QT_DEPRECATED_SINCE(5, 5)
- bool rawMode() const;
- void setRawMode(bool);
+ struct Tag
+ {
+ constexpr Tag() = default;
+
+ template <size_t N>
+ constexpr Q_IMPLICIT Tag(const char (&str)[N]) noexcept
+ : m_value((quint32(str[0]) << 24) | (quint32(str[1]) << 16)
+ | (quint32(str[2]) << 8) | quint32(str[3]))
+ {
+ static_assert(N == 5, "The tag name must be exactly 4 characters long!");
+ }
+
+ constexpr bool isValid() const noexcept { return m_value != 0; }
+ constexpr quint32 value() const noexcept { return m_value; }
+
+ QByteArray toString() const
+ {
+ const char data[] = {
+ char((m_value & 0xff000000) >> 24),
+ char((m_value & 0x00ff0000) >> 16),
+ char((m_value & 0x0000ff00) >> 8),
+ char((m_value & 0x000000ff)) };
+ return QByteArray(data, sizeof(data));
+ }
+
+ static constexpr std::optional<Tag> fromValue(quint32 value) noexcept
+ {
+ Tag maybeTag;
+ maybeTag.m_value = value;
+ return maybeTag.isValid() ? std::optional<Tag>(maybeTag) : std::nullopt;
+ }
+ Q_GUI_EXPORT static std::optional<Tag> fromString(QAnyStringView view) noexcept;
+
+#ifndef QT_NO_DATASTREAM
+ friend Q_GUI_EXPORT QDataStream &operator<<(QDataStream &, Tag);
+ friend Q_GUI_EXPORT QDataStream &operator>>(QDataStream &, Tag &);
+#endif
+
+#ifndef QT_NO_DEBUG_STREAM
+ friend Q_GUI_EXPORT QDebug operator<<(QDebug debug, Tag tag);
#endif
+ friend constexpr size_t qHash(Tag key, size_t seed = 0) noexcept
+ { return qHash(key.value(), seed); }
+
+ private:
+ friend constexpr bool comparesEqual(const Tag &lhs, const Tag &rhs) noexcept
+ { return lhs.m_value == rhs.m_value; }
+ friend constexpr Qt::strong_ordering compareThreeWay(const Tag &lhs, const Tag &rhs) noexcept
+ { return Qt::compareThreeWay(lhs.m_value, rhs.m_value); }
+ Q_DECLARE_STRONGLY_ORDERED_LITERAL_TYPE(QFont::Tag)
+
+ quint32 m_value = 0;
+ };
+
+ void setFeature(Tag tag, quint32 value);
+ void unsetFeature(Tag tag);
+ quint32 featureValue(Tag tag) const;
+ bool isFeatureSet(Tag tag) const;
+ QList<Tag> featureTags() const;
+ void clearFeatures();
+
+ void setVariableAxis(Tag tag, float value);
+ void unsetVariableAxis(Tag tag);
+ bool isVariableAxisSet(Tag tag) const;
+ float variableAxisValue(Tag tag) const;
+ void clearVariableAxes();
+ QList<Tag> variableAxisTags() const;
+
// dupicated from QFontInfo
bool exactMatch() const;
@@ -261,14 +289,7 @@ public:
bool operator<(const QFont &) const;
operator QVariant() const;
bool isCopyOf(const QFont &) const;
- inline QFont &operator=(QFont &&other) noexcept
- { qSwap(d, other.d); qSwap(resolve_mask, other.resolve_mask); return *this; }
-
-#if QT_DEPRECATED_SINCE(5, 3)
- // needed for X11
- QT_DEPRECATED void setRawName(const QString &);
- QT_DEPRECATED QString rawName() const;
-#endif
+ QT_MOVE_ASSIGNMENT_OPERATOR_IMPL_VIA_PURE_SWAP(QFont)
QString key() const;
@@ -281,22 +302,20 @@ public:
static void insertSubstitution(const QString&, const QString &);
static void insertSubstitutions(const QString&, const QStringList &);
static void removeSubstitutions(const QString &);
-#if QT_DEPRECATED_SINCE(5, 0)
- static QT_DEPRECATED void removeSubstitution(const QString &family) { removeSubstitutions(family); }
-#endif
static void initialize();
static void cleanup();
static void cacheStatistics();
QString defaultFamily() const;
-#if QT_DEPRECATED_SINCE(5, 13)
- QT_DEPRECATED QString lastResortFamily() const;
- QT_DEPRECATED QString lastResortFont() const;
-#endif
QFont resolve(const QFont &) const;
- inline uint resolve() const { return resolve_mask; }
- inline void resolve(uint mask) { resolve_mask = mask; }
+ inline uint resolveMask() const { return resolve_mask; }
+ inline void setResolveMask(uint mask) { resolve_mask = mask; }
+
+#if QT_DEPRECATED_SINCE(6, 0)
+ QT_DEPRECATED_VERSION_X_6_0("Use setWeight() instead") void setLegacyWeight(int legacyWeight);
+ QT_DEPRECATED_VERSION_X_6_0("Use weight() instead") int legacyWeight() const;
+#endif
private:
explicit QFont(QFontPrivate *);
@@ -345,7 +364,7 @@ private:
Q_DECLARE_SHARED(QFont)
-Q_GUI_EXPORT uint qHash(const QFont &font, uint seed = 0) noexcept;
+Q_GUI_EXPORT size_t qHash(const QFont &font, size_t seed = 0) noexcept;
inline bool QFont::bold() const
{ return weight() > Medium; }
diff --git a/src/gui/text/qfont_p.h b/src/gui/text/qfont_p.h
index adbb7a0121..b674e71103 100644
--- a/src/gui/text/qfont_p.h
+++ b/src/gui/text/qfont_p.h
@@ -1,41 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the QtGui module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#ifndef QFONT_P_H
#define QFONT_P_H
@@ -66,38 +30,48 @@ QT_BEGIN_NAMESPACE
class QFontCache;
class QFontEngine;
+#define QFONT_WEIGHT_MIN 1
+#define QFONT_WEIGHT_MAX 1000
+
struct QFontDef
{
inline QFontDef()
- : pointSize(-1.0), pixelSize(-1),
- styleStrategy(QFont::PreferDefault), styleHint(QFont::AnyStyle),
- weight(50), fixedPitch(false), style(QFont::StyleNormal), stretch(QFont::AnyStretch),
- hintingPreference(QFont::PreferDefaultHinting), ignorePitch(true),
- fixedPitchComputed(0), reserved(0)
+ : pointSize(-1.0),
+ pixelSize(-1),
+ styleStrategy(QFont::PreferDefault),
+ stretch(QFont::AnyStretch),
+ style(QFont::StyleNormal),
+ hintingPreference(QFont::PreferDefaultHinting),
+ styleHint(QFont::AnyStyle),
+ weight(QFont::Normal),
+ fixedPitch(false),
+ ignorePitch(true),
+ fixedPitchComputed(0),
+ reserved(0)
{
}
- QString family;
QStringList families;
QString styleName;
QStringList fallBackFamilies;
+ QMap<QFont::Tag, float> variableAxisValues;
qreal pointSize;
qreal pixelSize;
+ // Note: Variable ordering matters to make sure no variable overlaps two 32-bit registers.
uint styleStrategy : 16;
- uint styleHint : 8;
+ uint stretch : 12; // 0-4000
+ uint style : 2;
+ uint hintingPreference : 2;
- uint weight : 7; // 0-99
+ uint styleHint : 8;
+ uint weight : 10; // 1-1000
uint fixedPitch : 1;
- uint style : 2;
- uint stretch : 12; // 0-4000
-
- uint hintingPreference : 2;
uint ignorePitch : 1;
uint fixedPitchComputed : 1; // for Mac OS X only
- int reserved : 14; // for future extensions
+ uint reserved : 11; // for future extensions
bool exactMatch(const QFontDef &other) const;
bool operator==(const QFontDef &other) const
@@ -109,10 +83,10 @@ struct QFontDef
&& styleHint == other.styleHint
&& styleStrategy == other.styleStrategy
&& ignorePitch == other.ignorePitch && fixedPitch == other.fixedPitch
- && family == other.family
&& families == other.families
&& styleName == other.styleName
&& hintingPreference == other.hintingPreference
+ && variableAxisValues == other.variableAxisValues
;
}
inline bool operator<(const QFontDef &other) const
@@ -123,7 +97,6 @@ struct QFontDef
if (stretch != other.stretch) return stretch < other.stretch;
if (styleHint != other.styleHint) return styleHint < other.styleHint;
if (styleStrategy != other.styleStrategy) return styleStrategy < other.styleStrategy;
- if (family != other.family) return family < other.family;
if (families != other.families) return families < other.families;
if (styleName != other.styleName)
return styleName < other.styleName;
@@ -132,26 +105,42 @@ struct QFontDef
if (ignorePitch != other.ignorePitch) return ignorePitch < other.ignorePitch;
if (fixedPitch != other.fixedPitch) return fixedPitch < other.fixedPitch;
+ if (variableAxisValues != other.variableAxisValues) {
+ if (variableAxisValues.size() != other.variableAxisValues.size())
+ return variableAxisValues.size() < other.variableAxisValues.size();
+
+ {
+ auto it = variableAxisValues.constBegin();
+ auto jt = other.variableAxisValues.constBegin();
+ for (; it != variableAxisValues.constEnd(); ++it, ++jt) {
+ if (it.key() != jt.key())
+ return jt.key() < it.key();
+ if (it.value() != jt.value())
+ return jt.value() < it.value();
+ }
+ }
+ }
+
return false;
}
};
-inline uint qHash(const QFontDef &fd, uint seed = 0) noexcept
+inline size_t qHash(const QFontDef &fd, size_t seed = 0) noexcept
{
- QtPrivate::QHashCombine hash;
- seed = hash(seed, qRound64(fd.pixelSize*10000)); // use only 4 fractional digits
- seed = hash(seed, fd.weight);
- seed = hash(seed, fd.style);
- seed = hash(seed, fd.stretch);
- seed = hash(seed, fd.styleHint);
- seed = hash(seed, fd.styleStrategy);
- seed = hash(seed, fd.ignorePitch);
- seed = hash(seed, fd.fixedPitch);
- seed = hash(seed, fd.family);
- seed = hash(seed, fd.families);
- seed = hash(seed, fd.styleName);
- seed = hash(seed, fd.hintingPreference);
- return seed;
+ return qHashMulti(seed,
+ qRound64(fd.pixelSize*10000), // use only 4 fractional digits
+ fd.weight,
+ fd.style,
+ fd.stretch,
+ fd.styleHint,
+ fd.styleStrategy,
+ fd.ignorePitch,
+ fd.fixedPitch,
+ fd.families,
+ fd.styleName,
+ fd.hintingPreference,
+ fd.variableAxisValues.keys(),
+ fd.variableAxisValues.values());
}
class QFontEngineData
@@ -195,6 +184,7 @@ public:
QFixed letterSpacing;
QFixed wordSpacing;
+ QHash<QFont::Tag, quint32> features;
mutable QFontPrivate *scFont;
QFont smallCapsFont() const { return QFont(smallCapsFontPrivate()); }
@@ -209,6 +199,13 @@ public:
static void detachButKeepEngineData(QFont *font);
+ void setFeature(QFont::Tag tag, quint32 value);
+ void unsetFeature(QFont::Tag tag);
+
+ void setVariableAxis(QFont::Tag tag, float value);
+ void unsetVariableAxis(QFont::Tag tag);
+ bool hasVariableAxis(QFont::Tag tag, float value) const;
+
private:
QFontPrivate &operator=(const QFontPrivate &) { return *this; }
};
@@ -290,6 +287,7 @@ private:
uint total_cost, max_cost;
uint current_timestamp;
bool fast;
+ const bool autoClean;
int timer_id;
const int m_id;
};
@@ -298,6 +296,9 @@ Q_GUI_EXPORT int qt_defaultDpiX();
Q_GUI_EXPORT int qt_defaultDpiY();
Q_GUI_EXPORT int qt_defaultDpi();
+Q_GUI_EXPORT int qt_legacyToOpenTypeWeight(int weight);
+Q_GUI_EXPORT int qt_openTypeToLegacyWeight(int weight);
+
QT_END_NAMESPACE
#endif // QFONT_P_H
diff --git a/src/gui/text/qfontdatabase.cpp b/src/gui/text/qfontdatabase.cpp
index f2fd585835..d3a13d801b 100644
--- a/src/gui/text/qfontdatabase.cpp
+++ b/src/gui/text/qfontdatabase.cpp
@@ -1,43 +1,8 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the QtGui module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#include "qfontdatabase.h"
+#include "qfontdatabase_p.h"
#include "qloggingcategory.h"
#include "qalgorithms.h"
#include "qguiapplication.h"
@@ -61,8 +26,14 @@
#include <qtgui_tracepoints_p.h>
+#ifdef Q_OS_WIN
+#include <QtGui/private/qwindowsfontdatabasebase_p.h>
+#endif
+
QT_BEGIN_NAMESPACE
+using namespace Qt::StringLiterals;
+
Q_LOGGING_CATEGORY(lcFontDb, "qt.text.font.db")
Q_LOGGING_CATEGORY(lcFontMatch, "qt.text.font.match")
@@ -77,6 +48,11 @@ Q_AUTOTEST_EXPORT void qt_setQtEnableTestFont(bool value)
}
#endif
+Q_TRACE_POINT(qtgui, QFontDatabase_loadEngine, const QString &families, int pointSize);
+Q_TRACE_POINT(qtgui, QFontDatabasePrivate_addAppFont, const QString &fileName);
+Q_TRACE_POINT(qtgui, QFontDatabase_addApplicationFont, const QString &fileName);
+Q_TRACE_POINT(qtgui, QFontDatabase_load, const QString &family, int pointSize);
+
static int getFontWeight(const QString &weightString)
{
QString s = weightString.toLower();
@@ -89,41 +65,40 @@ static int getFontWeight(const QString &weightString)
//
// A simple string test is the cheapest, so let's do that first.
// Test in decreasing order of commonness
- if (s == QLatin1String("normal") || s == QLatin1String("regular"))
+ if (s == "normal"_L1 || s == "regular"_L1)
return QFont::Normal;
- if (s == QLatin1String("bold"))
+ if (s == "bold"_L1)
return QFont::Bold;
- if (s == QLatin1String("semibold") || s == QLatin1String("semi bold")
- || s == QLatin1String("demibold") || s == QLatin1String("demi bold"))
+ if (s == "semibold"_L1 || s == "semi bold"_L1 || s == "demibold"_L1 || s == "demi bold"_L1)
return QFont::DemiBold;
- if (s == QLatin1String("medium"))
+ if (s == "medium"_L1)
return QFont::Medium;
- if (s == QLatin1String("black"))
+ if (s == "black"_L1)
return QFont::Black;
- if (s == QLatin1String("light"))
+ if (s == "light"_L1)
return QFont::Light;
- if (s == QLatin1String("thin"))
+ if (s == "thin"_L1)
return QFont::Thin;
- const QStringRef s2 = s.midRef(2);
- if (s.startsWith(QLatin1String("ex")) || s.startsWith(QLatin1String("ul"))) {
- if (s2 == QLatin1String("tralight") || s == QLatin1String("tra light"))
+ const QStringView s2 = QStringView{s}.mid(2);
+ if (s.startsWith("ex"_L1) || s.startsWith("ul"_L1)) {
+ if (s2 == "tralight"_L1 || s == "tra light"_L1)
return QFont::ExtraLight;
- if (s2 == QLatin1String("trabold") || s2 == QLatin1String("tra bold"))
+ if (s2 == "trabold"_L1 || s2 == "tra bold"_L1)
return QFont::ExtraBold;
}
// Next up, let's see if contains() matches: slightly more expensive, but
// still fast enough.
- if (s.contains(QLatin1String("bold"))) {
- if (s.contains(QLatin1String("demi")))
+ if (s.contains("bold"_L1)) {
+ if (s.contains("demi"_L1))
return QFont::DemiBold;
return QFont::Bold;
}
- if (s.contains(QLatin1String("thin")))
+ if (s.contains("thin"_L1))
return QFont::Thin;
- if (s.contains(QLatin1String("light")))
+ if (s.contains("light"_L1))
return QFont::Light;
- if (s.contains(QLatin1String("black")))
+ if (s.contains("black"_L1))
return QFont::Black;
// Now, we perform string translations & comparisons with those.
@@ -173,71 +148,6 @@ static int getFontWeight(const QString &weightString)
}
-struct QtFontSize
-{
-
- void *handle;
-
- unsigned short pixelSize : 16;
-};
-
-
-
-struct QtFontStyle
-{
- struct Key {
- Key(const QString &styleString);
- Key() : style(QFont::StyleNormal),
- weight(QFont::Normal), stretch(0) { }
- Key(const Key &o) : style(o.style), weight(o.weight), stretch(o.stretch) { }
- uint style : 2;
- signed int weight : 8;
- signed int stretch : 12;
-
- bool operator==(const Key & other) {
- return (style == other.style && weight == other.weight &&
- (stretch == 0 || other.stretch == 0 || stretch == other.stretch));
- }
- bool operator!=(const Key &other) {
- return !operator==(other);
- }
- bool operator <(const Key &o) {
- int x = (style << 12) + (weight << 14) + stretch;
- int y = (o.style << 12) + (o.weight << 14) + o.stretch;
- return (x < y);
- }
- };
-
- QtFontStyle(const Key &k)
- : key(k), bitmapScalable(false), smoothScalable(false),
- count(0), pixelSizes(nullptr)
- {
- }
-
- ~QtFontStyle() {
- while (count) {
- // bitfield count-- in while condition does not work correctly in mwccsym2
- count--;
- QPlatformIntegration *integration = QGuiApplicationPrivate::platformIntegration();
- if (integration) {
- integration->fontDatabase()->releaseHandle(pixelSizes[count].handle);
- }
- }
- free(pixelSizes);
- }
-
- Key key;
- bool bitmapScalable : 1;
- bool smoothScalable : 1;
- signed int count : 30;
- QtFontSize *pixelSizes;
- QString styleName;
-
- bool antialiased;
-
- QtFontSize *pixelSize(unsigned short size, bool = false);
-};
-
QtFontStyle::Key::Key(const QString &styleString)
: style(QFont::StyleNormal), weight(QFont::Normal), stretch(0)
{
@@ -245,9 +155,9 @@ QtFontStyle::Key::Key(const QString &styleString)
if (!styleString.isEmpty()) {
// First the straightforward no-translation checks, these are fast.
- if (styleString.contains(QLatin1String("Italic")))
+ if (styleString.contains("Italic"_L1))
style = QFont::StyleItalic;
- else if (styleString.contains(QLatin1String("Oblique")))
+ else if (styleString.contains("Oblique"_L1))
style = QFont::StyleOblique;
// Then the translation checks. These aren't as fast.
@@ -284,22 +194,6 @@ QtFontSize *QtFontStyle::pixelSize(unsigned short size, bool add)
return pixelSizes + (count++);
}
-struct QtFontFoundry
-{
- QtFontFoundry(const QString &n) : name(n), count(0), styles(nullptr) {}
- ~QtFontFoundry() {
- while (count--)
- delete styles[count];
- free(styles);
- }
-
- QString name;
-
- int count;
- QtFontStyle **styles;
- QtFontStyle *style(const QtFontStyle::Key &, const QString & = QString(), bool = false);
-};
-
QtFontStyle *QtFontFoundry::style(const QtFontStyle::Key &key, const QString &styleName, bool create)
{
int pos = 0;
@@ -331,46 +225,6 @@ QtFontStyle *QtFontFoundry::style(const QtFontStyle::Key &key, const QString &st
return styles[pos];
}
-
-struct QtFontFamily
-{
- enum WritingSystemStatus {
- Unknown = 0,
- Supported = 1,
- UnsupportedFT = 2,
- Unsupported = UnsupportedFT
- };
-
- QtFontFamily(const QString &n)
- :
- populated(false),
- fixedPitch(false),
- name(n), count(0), foundries(nullptr)
- {
- memset(writingSystems, 0, sizeof(writingSystems));
- }
- ~QtFontFamily() {
- while (count--)
- delete foundries[count];
- free(foundries);
- }
-
- bool populated : 1;
- bool fixedPitch : 1;
-
- QString name;
- QStringList aliases;
- int count;
- QtFontFoundry **foundries;
-
- unsigned char writingSystems[QFontDatabase::WritingSystemsCount];
-
- bool matchesFamilyName(const QString &familyName) const;
- QtFontFoundry *foundry(const QString &f, bool = false);
-
- void ensurePopulated();
-};
-
QtFontFoundry *QtFontFamily::foundry(const QString &f, bool create)
{
if (f.isNull() && count == 1)
@@ -405,102 +259,40 @@ bool QtFontFamily::matchesFamilyName(const QString &familyName) const
return equalsCaseInsensitive(name, familyName) || aliases.contains(familyName, Qt::CaseInsensitive);
}
-void QtFontFamily::ensurePopulated()
+bool QtFontFamily::ensurePopulated()
{
if (populated)
- return;
+ return true;
QGuiApplicationPrivate::platformIntegration()->fontDatabase()->populateFamily(name);
- Q_ASSERT_X(populated, Q_FUNC_INFO, qPrintable(name));
+ return populated;
}
-
-struct FallbacksCacheKey {
- QString family;
- QFont::Style style;
- QFont::StyleHint styleHint;
- QChar::Script script;
-};
-
-inline bool operator==(const FallbacksCacheKey &lhs, const FallbacksCacheKey &rhs) noexcept
+void QFontDatabasePrivate::clearFamilies()
{
- return lhs.script == rhs.script &&
- lhs.styleHint == rhs.styleHint &&
- lhs.style == rhs.style &&
- lhs.family == rhs.family;
-}
+ while (count--)
+ delete families[count];
+ ::free(families);
+ families = nullptr;
+ count = 0;
-inline bool operator!=(const FallbacksCacheKey &lhs, const FallbacksCacheKey &rhs) noexcept
-{
- return !operator==(lhs, rhs);
-}
+ for (auto &font : applicationFonts)
+ font.properties.clear(); // Unpopulate
-inline uint qHash(const FallbacksCacheKey &key, uint seed = 0) noexcept
-{
- QtPrivate::QHashCombine hash;
- seed = hash(seed, key.family);
- seed = hash(seed, int(key.style));
- seed = hash(seed, int(key.styleHint));
- seed = hash(seed, int(key.script));
- return seed;
+ populated = false;
+ // don't clear the memory fonts!
}
-
-class QFontDatabasePrivate
-{
-public:
- QFontDatabasePrivate()
- : count(0), families(nullptr),
- fallbacksCache(64)
- { }
-
- ~QFontDatabasePrivate() {
- free();
- }
-
- enum FamilyRequestFlags {
- RequestFamily = 0,
- EnsureCreated,
- EnsurePopulated
- };
-
- QtFontFamily *family(const QString &f, FamilyRequestFlags flags = EnsurePopulated);
- void free() {
- while (count--)
- delete families[count];
- ::free(families);
- families = nullptr;
- count = 0;
- // don't clear the memory fonts!
- }
-
- int count;
- QtFontFamily **families;
-
- QCache<FallbacksCacheKey, QStringList> fallbacksCache;
-
-
- struct ApplicationFont {
- QString fileName;
- QByteArray data;
- QStringList families;
- };
- QVector<ApplicationFont> applicationFonts;
- int addAppFont(const QByteArray &fontData, const QString &fileName);
- bool isApplicationFont(const QString &fileName);
-
- void invalidate();
-};
-Q_DECLARE_TYPEINFO(QFontDatabasePrivate::ApplicationFont, Q_MOVABLE_TYPE);
-
void QFontDatabasePrivate::invalidate()
{
+ qCDebug(lcFontDb) << "Invalidating font database";
+
QFontCache::instance()->clear();
fallbacksCache.clear();
- free();
+ clearFamilies();
QGuiApplicationPrivate::platformIntegration()->fontDatabase()->invalidate();
- emit static_cast<QGuiApplication *>(QCoreApplication::instance())->fontDatabaseChanged();
+ emit qGuiApp->fontDatabaseChanged();
}
QtFontFamily *QFontDatabasePrivate::family(const QString &f, FamilyRequestFlags flags)
@@ -544,8 +336,10 @@ QtFontFamily *QFontDatabasePrivate::family(const QString &f, FamilyRequestFlags
fam = families[pos];
}
- if (fam && (flags & EnsurePopulated))
- fam->ensurePopulated();
+ if (fam && (flags & EnsurePopulated)) {
+ if (!fam->ensurePopulated())
+ return nullptr;
+ }
return fam;
}
@@ -589,7 +383,7 @@ static const int scriptForWritingSystem[] = {
QChar::Script_Nko // Nko
};
-Q_STATIC_ASSERT(sizeof(scriptForWritingSystem) / sizeof(scriptForWritingSystem[0]) == QFontDatabase::WritingSystemsCount);
+static_assert(sizeof(scriptForWritingSystem) / sizeof(scriptForWritingSystem[0]) == QFontDatabase::WritingSystemsCount);
Q_GUI_EXPORT int qt_script_for_writing_system(QFontDatabase::WritingSystem writingSystem)
{
@@ -597,7 +391,32 @@ Q_GUI_EXPORT int qt_script_for_writing_system(QFontDatabase::WritingSystem writi
}
+/*!
+ \internal
+ Tests if the given family \a family supports writing system \a writingSystem,
+ including the special case for Han script mapping to several subsequent writing systems
+*/
+static bool familySupportsWritingSystem(QtFontFamily *family, size_t writingSystem)
+{
+ Q_ASSERT(family != nullptr);
+ Q_ASSERT(writingSystem != QFontDatabase::Any && writingSystem < QFontDatabase::WritingSystemsCount);
+
+ size_t ws = writingSystem;
+ do {
+ if ((family->writingSystems[ws] & QtFontFamily::Supported) != 0)
+ return true;
+ } while (writingSystem >= QFontDatabase::SimplifiedChinese && writingSystem <= QFontDatabase::Japanese && ++ws <= QFontDatabase::Japanese);
+
+ return false;
+}
+
+Q_GUI_EXPORT QFontDatabase::WritingSystem qt_writing_system_for_script(int script)
+{
+ return QFontDatabase::WritingSystem(std::find(scriptForWritingSystem,
+ scriptForWritingSystem + QFontDatabase::WritingSystemsCount,
+ script) - scriptForWritingSystem);
+}
/*!
\internal
@@ -610,11 +429,11 @@ Q_GUI_EXPORT int qt_script_for_writing_system(QFontDatabase::WritingSystem writi
*/
static void parseFontName(const QString &name, QString &foundry, QString &family)
{
- int i = name.indexOf(QLatin1Char('['));
- int li = name.lastIndexOf(QLatin1Char(']'));
+ int i = name.indexOf(u'[');
+ int li = name.lastIndexOf(u']');
if (i >= 0 && li >= 0 && i < li) {
foundry = name.mid(i + 1, li - i - 1);
- if (i > 0 && name[i - 1] == QLatin1Char(' '))
+ if (i > 0 && name[i - 1] == u' ')
i--;
family = name.left(i);
} else {
@@ -625,7 +444,7 @@ static void parseFontName(const QString &name, QString &foundry, QString &family
// capitalize the family/foundry names
bool space = true;
QChar *s = family.data();
- int len = family.length();
+ int len = family.size();
while(len--) {
if (space) *s = s->toUpper();
space = s->isSpace();
@@ -634,7 +453,7 @@ static void parseFontName(const QString &name, QString &foundry, QString &family
space = true;
s = foundry.data();
- len = foundry.length();
+ len = foundry.size();
while(len--) {
if (space) *s = s->toUpper();
space = s->isSpace();
@@ -654,9 +473,11 @@ struct QtFontDesc
static void initFontDef(const QtFontDesc &desc, const QFontDef &request, QFontDef *fontDef, bool multi)
{
- fontDef->family = desc.family->name;
+ QString family;
+ family = desc.family->name;
if (! desc.foundry->name.isEmpty() && desc.family->count > 1)
- fontDef->family += QLatin1String(" [") + desc.foundry->name + QLatin1Char(']');
+ family += " ["_L1 + desc.foundry->name + u']';
+ fontDef->families = QStringList(family);
if (desc.style->smoothScalable
|| QGuiApplicationPrivate::platformIntegration()->fontDatabase()->fontsAlwaysScalable()
@@ -684,19 +505,6 @@ static QStringList familyList(const QFontDef &req)
QStringList family_list;
family_list << req.families;
- if (!req.family.isEmpty()) {
- const auto list = req.family.splitRef(QLatin1Char(','));
- const int numFamilies = list.size();
- family_list.reserve(numFamilies);
- for (int i = 0; i < numFamilies; ++i) {
- QStringRef str = list.at(i).trimmed();
- if ((str.startsWith(QLatin1Char('"')) && str.endsWith(QLatin1Char('"')))
- || (str.startsWith(QLatin1Char('\'')) && str.endsWith(QLatin1Char('\''))))
- str = str.mid(1, str.length() - 2);
- if (!family_list.contains(str))
- family_list << str.toString();
- }
- }
// append the substitute list for each family in family_list
for (int i = 0, size = family_list.size(); i < size; ++i)
family_list += QFont::substitutes(family_list.at(i));
@@ -704,17 +512,14 @@ static QStringList familyList(const QFontDef &req)
return family_list;
}
-Q_GLOBAL_STATIC(QFontDatabasePrivate, privateDb)
Q_GLOBAL_STATIC(QRecursiveMutex, fontDatabaseMutex)
// used in qguiapplication.cpp
void qt_cleanupFontDatabase()
{
- QFontDatabasePrivate *db = privateDb();
- if (db) {
- db->fallbacksCache.clear();
- db->free();
- }
+ auto *db = QFontDatabasePrivate::instance();
+ db->fallbacksCache.clear();
+ db->clearFamilies();
}
// used in qfont.cpp
@@ -723,6 +528,11 @@ QRecursiveMutex *qt_fontdatabase_mutex()
return fontDatabaseMutex();
}
+QFontDatabasePrivate *QFontDatabasePrivate::instance()
+{
+ static QFontDatabasePrivate instance;
+ return &instance;
+}
void qt_registerFont(const QString &familyName, const QString &stylename,
const QString &foundryname, int weight,
@@ -730,7 +540,7 @@ void qt_registerFont(const QString &familyName, const QString &stylename,
bool scalable, int pixelSize, bool fixedPitch,
const QSupportedWritingSystems &writingSystems, void *handle)
{
- QFontDatabasePrivate *d = privateDb();
+ auto *d = QFontDatabasePrivate::instance();
qCDebug(lcFontDb) << "Adding font: familyName" << familyName << "stylename" << stylename << "weight" << weight
<< "style" << style << "pixelSize" << pixelSize << "antialiased" << antialiased << "fixed" << fixedPitch;
QtFontStyle::Key styleKey;
@@ -761,8 +571,10 @@ void qt_registerFont(const QString &familyName, const QString &stylename,
void qt_registerFontFamily(const QString &familyName)
{
+ qCDebug(lcFontDb) << "Registering family" << familyName;
+
// Create uninitialized/unpopulated family
- privateDb()->family(familyName, QFontDatabasePrivate::EnsureCreated);
+ QFontDatabasePrivate::instance()->family(familyName, QFontDatabasePrivate::EnsureCreated);
}
void qt_registerAliasToFontFamily(const QString &familyName, const QString &alias)
@@ -770,7 +582,9 @@ void qt_registerAliasToFontFamily(const QString &familyName, const QString &alia
if (alias.isEmpty())
return;
- QFontDatabasePrivate *d = privateDb();
+ qCDebug(lcFontDb) << "Registering alias" << alias << "to family" << familyName;
+
+ auto *d = QFontDatabasePrivate::instance();
QtFontFamily *f = d->family(familyName, QFontDatabasePrivate::RequestFamily);
if (!f)
return;
@@ -784,7 +598,7 @@ void qt_registerAliasToFontFamily(const QString &familyName, const QString &alia
QString qt_resolveFontFamilyAlias(const QString &alias)
{
if (!alias.isEmpty()) {
- const QFontDatabasePrivate *d = privateDb();
+ const auto *d = QFontDatabasePrivate::instance();
for (int i = 0; i < d->count; ++i)
if (d->families[i]->matchesFamilyName(alias))
return d->families[i]->name;
@@ -794,7 +608,7 @@ QString qt_resolveFontFamilyAlias(const QString &alias)
bool qt_isFontFamilyPopulated(const QString &familyName)
{
- QFontDatabasePrivate *d = privateDb();
+ auto *d = QFontDatabasePrivate::instance();
QtFontFamily *f = d->family(familyName, QFontDatabasePrivate::RequestFamily);
return f != nullptr && f->populated;
}
@@ -814,19 +628,17 @@ QStringList QPlatformFontDatabase::fallbacksForFamily(const QString &family, QFo
QStringList preferredFallbacks;
QStringList otherFallbacks;
- size_t writingSystem = std::find(scriptForWritingSystem,
- scriptForWritingSystem + QFontDatabase::WritingSystemsCount,
- script) - scriptForWritingSystem;
+ auto writingSystem = qt_writing_system_for_script(script);
if (writingSystem >= QFontDatabase::WritingSystemsCount)
writingSystem = QFontDatabase::Any;
- QFontDatabasePrivate *db = privateDb();
+ auto *db = QFontDatabasePrivate::instance();
for (int i = 0; i < db->count; ++i) {
QtFontFamily *f = db->families[i];
f->ensurePopulated();
- if (writingSystem > QFontDatabase::Any && f->writingSystems[writingSystem] != QtFontFamily::Supported)
+ if (writingSystem != QFontDatabase::Any && !familySupportsWritingSystem(f, writingSystem))
continue;
for (int j = 0; j < f->count; ++j) {
@@ -835,7 +647,7 @@ QStringList QPlatformFontDatabase::fallbacksForFamily(const QString &family, QFo
for (int k = 0; k < foundry->count; ++k) {
QString name = foundry->name.isEmpty()
? f->name
- : f->name + QLatin1String(" [") + foundry->name + QLatin1Char(']');
+ : f->name + " ["_L1 + foundry->name + u']';
if (style == foundry->styles[k]->key.style)
preferredFallbacks.append(name);
else
@@ -847,21 +659,19 @@ QStringList QPlatformFontDatabase::fallbacksForFamily(const QString &family, QFo
return preferredFallbacks + otherFallbacks;
}
-static void initializeDb();
-
static QStringList fallbacksForFamily(const QString &family, QFont::Style style, QFont::StyleHint styleHint, QChar::Script script)
{
- QFontDatabasePrivate *db = privateDb();
- if (!db->count)
- initializeDb();
+ QMutexLocker locker(fontDatabaseMutex());
+ auto *db = QFontDatabasePrivate::ensureFontDatabase();
- const FallbacksCacheKey cacheKey = { family, style, styleHint, script };
+ const QtFontFallbacksCacheKey cacheKey = { family, style, styleHint, script };
if (const QStringList *fallbacks = db->fallbacksCache.object(cacheKey))
return *fallbacks;
// make sure that the db has all fallback families
- QStringList retList = QGuiApplicationPrivate::platformIntegration()->fontDatabase()->fallbacksForFamily(family,style,styleHint,script);
+ QStringList userFallbacks = db->applicationFallbackFontFamilies.value(script == QChar::Script_Common ? QChar::Script_Latin : script);
+ QStringList retList = userFallbacks + QGuiApplicationPrivate::platformIntegration()->fontDatabase()->fallbacksForFamily(family,style,styleHint,script);
QStringList::iterator i;
for (i = retList.begin(); i != retList.end(); ++i) {
@@ -889,31 +699,7 @@ QStringList qt_fallbacksForFamily(const QString &family, QFont::Style style, QFo
return fallbacksForFamily(family, style, styleHint, script);
}
-static void registerFont(QFontDatabasePrivate::ApplicationFont *fnt);
-
-static void initializeDb()
-{
- QFontDatabasePrivate *db = privateDb();
-
- // init by asking for the platformfontdb for the first time or after invalidation
- if (!db->count) {
- QGuiApplicationPrivate::platformIntegration()->fontDatabase()->populateFontDatabase();
- for (int i = 0; i < db->applicationFonts.count(); i++) {
- if (!db->applicationFonts.at(i).families.isEmpty())
- registerFont(&db->applicationFonts[i]);
- }
- }
-}
-
-static inline void load(const QString & = QString(), int = -1)
-{
- // Only initialize the database if it has been cleared or not initialized yet
- if (!privateDb()->count)
- initializeDb();
-}
-
-static
-QFontEngine *loadSingleEngine(int script,
+QFontEngine *QFontDatabasePrivate::loadSingleEngine(int script,
const QFontDef &request,
QtFontFamily *family, QtFontFoundry *foundry,
QtFontStyle *style, QtFontSize *size)
@@ -948,7 +734,7 @@ QFontEngine *loadSingleEngine(int script,
// Also check for OpenType tables when using complex scripts
if (Q_UNLIKELY(!engine->supportsScript(QChar::Script(script)))) {
qWarning(" OpenType support missing for \"%s\", script %d",
- qPrintable(def.family), script);
+ qPrintable(def.families.constFirst()), script);
return nullptr;
}
@@ -964,7 +750,7 @@ QFontEngine *loadSingleEngine(int script,
if (style->key.stretch != 0 && request.stretch != 0
&& (request.styleName.isEmpty() || request.styleName != style->styleName)) {
def.stretch = (request.stretch * 100 + style->key.stretch / 2) / style->key.stretch;
- } else {
+ } else if (request.stretch == QFont::AnyStretch) {
def.stretch = 100;
}
@@ -973,7 +759,7 @@ QFontEngine *loadSingleEngine(int script,
// Also check for OpenType tables when using complex scripts
if (!engine->supportsScript(QChar::Script(script))) {
qWarning(" OpenType support missing for \"%s\", script %d",
-+ qPrintable(def.family), script);
+ +qPrintable(def.families.constFirst()), script);
if (engine->ref.loadRelaxed() == 0)
delete engine;
return nullptr;
@@ -993,15 +779,14 @@ QFontEngine *loadSingleEngine(int script,
return engine;
}
-static
-QFontEngine *loadEngine(int script, const QFontDef &request,
+QFontEngine *QFontDatabasePrivate::loadEngine(int script, const QFontDef &request,
QtFontFamily *family, QtFontFoundry *foundry,
QtFontStyle *style, QtFontSize *size)
{
QFontEngine *engine = loadSingleEngine(script, request, family, foundry, style, size);
if (engine && !(request.styleStrategy & QFont::NoFontMerging) && !engine->symbol) {
- Q_TRACE(QFontDatabase_loadEngine, request.family, request.pointSize);
+ Q_TRACE(QFontDatabase_loadEngine, request.families.join(QLatin1Char(';')), request.pointSize);
QPlatformFontDatabase *pfdb = QGuiApplicationPrivate::platformIntegration()->fontDatabase();
QFontEngineMulti *pfMultiEngine = pfdb->fontEngineMulti(engine, QChar::Script(script));
@@ -1027,9 +812,17 @@ QFontEngine *loadEngine(int script, const QFontDef &request,
return engine;
}
-static void registerFont(QFontDatabasePrivate::ApplicationFont *fnt)
+QtFontStyle::~QtFontStyle()
{
- fnt->families = QGuiApplicationPrivate::platformIntegration()->fontDatabase()->addApplicationFont(fnt->data,fnt->fileName);
+ while (count) {
+ // bitfield count-- in while condition does not work correctly in mwccsym2
+ count--;
+ QPlatformIntegration *integration = QGuiApplicationPrivate::platformIntegration();
+ if (integration)
+ integration->fontDatabase()->releaseHandle(pixelSizes[count].handle);
+ }
+
+ free(pixelSizes);
}
static QtFontStyle *bestStyle(QtFontFoundry *foundry, const QtFontStyle::Key &styleKey,
@@ -1047,7 +840,7 @@ static QtFontStyle *bestStyle(QtFontFoundry *foundry, const QtFontStyle::Key &st
break;
}
- int d = qAbs( styleKey.weight - style->key.weight );
+ int d = qAbs( (int(styleKey.weight) - int(style->key.weight)) / 10 );
if ( styleKey.stretch != 0 && style->key.stretch != 0 ) {
d += qAbs( styleKey.stretch - style->key.stretch );
@@ -1072,11 +865,10 @@ static QtFontStyle *bestStyle(QtFontFoundry *foundry, const QtFontStyle::Key &st
}
-static
-unsigned int bestFoundry(int script, unsigned int score, int styleStrategy,
+unsigned int QFontDatabasePrivate::bestFoundry(int script, unsigned int score, int styleStrategy,
const QtFontFamily *family, const QString &foundry_name,
QtFontStyle::Key styleKey, int pixelSize, char pitch,
- QtFontDesc *desc, const QString &styleName = QString())
+ QtFontDesc *desc, const QString &styleName)
{
Q_UNUSED(script);
Q_UNUSED(pitch);
@@ -1219,9 +1011,9 @@ static bool matchFamilyName(const QString &familyName, QtFontFamily *f)
Tries to find the best match for a given request and family/foundry
*/
-static int match(int script, const QFontDef &request,
- const QString &family_name, const QString &foundry_name,
- QtFontDesc *desc, const QList<int> &blacklistedFamilies)
+int QFontDatabasePrivate::match(int script, const QFontDef &request, const QString &family_name,
+ const QString &foundry_name, QtFontDesc *desc, const QList<int> &blacklistedFamilies,
+ unsigned int *resultingScore)
{
int result = -1;
@@ -1233,16 +1025,18 @@ static int match(int script, const QFontDef &request,
char pitch = request.ignorePitch ? '*' : request.fixedPitch ? 'm' : 'p';
- qCDebug(lcFontMatch, "QFontDatabase::match\n"
+ qCDebug(lcFontMatch, "QFontDatabasePrivate::match\n"
" request:\n"
" family: %s [%s], script: %d\n"
+ " styleName: %s\n"
" weight: %d, style: %d\n"
" stretch: %d\n"
" pixelSize: %g\n"
" pitch: %c",
family_name.isEmpty() ? "-- first in script --" : family_name.toLatin1().constData(),
- foundry_name.isEmpty() ? "-- any --" : foundry_name.toLatin1().constData(),
- script, request.weight, request.style, request.stretch, request.pixelSize, pitch);
+ foundry_name.isEmpty() ? "-- any --" : foundry_name.toLatin1().constData(), script,
+ request.styleName.isEmpty() ? "-- any --" : request.styleName.toLatin1().constData(),
+ request.weight, request.style, request.stretch, request.pixelSize, pitch);
desc->family = nullptr;
desc->foundry = nullptr;
@@ -1251,14 +1045,14 @@ static int match(int script, const QFontDef &request,
unsigned int score = ~0u;
- load(family_name, script);
+ QMutexLocker locker(fontDatabaseMutex());
+ QFontDatabasePrivate::ensureFontDatabase();
- size_t writingSystem = std::find(scriptForWritingSystem, scriptForWritingSystem +
- QFontDatabase::WritingSystemsCount, script) - scriptForWritingSystem;
+ auto writingSystem = qt_writing_system_for_script(script);
if (writingSystem >= QFontDatabase::WritingSystemsCount)
writingSystem = QFontDatabase::Any;
- QFontDatabasePrivate *db = privateDb();
+ auto *db = QFontDatabasePrivate::instance();
for (int x = 0; x < db->count; ++x) {
if (blacklistedFamilies.contains(x))
continue;
@@ -1267,11 +1061,11 @@ static int match(int script, const QFontDef &request,
if (!matchFamilyName(family_name, test.family))
continue;
-
- test.family->ensurePopulated();
+ if (!test.family->ensurePopulated())
+ continue;
// Check if family is supported in the script we want
- if (writingSystem != QFontDatabase::Any && !(test.family->writingSystems[writingSystem] & QtFontFamily::Supported))
+ if (writingSystem != QFontDatabase::Any && !familySupportsWritingSystem(test.family, writingSystem))
continue;
// as we know the script is supported, we can be sure
@@ -1296,6 +1090,10 @@ static int match(int script, const QFontDef &request,
if (newscore < 10) // xlfd instead of FT... just accept it
break;
}
+
+ if (resultingScore != nullptr)
+ *resultingScore = score;
+
return result;
}
@@ -1323,9 +1121,9 @@ static QString styleStringHelper(int weight, QFont::Style style)
}
if (style == QFont::StyleItalic)
- result += QLatin1Char(' ') + QCoreApplication::translate("QFontDatabase", "Italic");
+ result += u' ' + QCoreApplication::translate("QFontDatabase", "Italic");
else if (style == QFont::StyleOblique)
- result += QLatin1Char(' ') + QCoreApplication::translate("QFontDatabase", "Oblique");
+ result += u' ' + QCoreApplication::translate("QFontDatabase", "Oblique");
if (result.isEmpty())
result = QCoreApplication::translate("QFontDatabase", "Normal", "The Normal or Regular font weight");
@@ -1390,36 +1188,29 @@ QString QFontDatabase::styleString(const QFontInfo &fontInfo)
Use the styleString() to obtain a text version of a style.
- The QFontDatabase class also supports some static functions, for
+ The QFontDatabase class provides some helper functions, for
example, standardSizes(). You can retrieve the description of a
writing system using writingSystemName(), and a sample of
characters in a writing system with writingSystemSample().
Example:
- \snippet qfontdatabase/main.cpp 0
- \snippet qfontdatabase/main.cpp 1
+ \snippet qfontdatabase/qfontdatabase_snippets.cpp 0
This example gets the list of font families, the list of
styles for each family, and the point sizes that are available for
each combination of family and style, displaying this information
in a tree view.
- \sa QFont, QFontInfo, QFontMetrics, {Character Map Example}
+ \sa QFont, QFontInfo, QFontMetrics
*/
/*!
+ \fn QFontDatabase::QFontDatabase()
+ \deprecated [6.0] Call the class methods as static functions instead.
+
Creates a font database object.
*/
-QFontDatabase::QFontDatabase()
-{
- if (Q_UNLIKELY(!qApp || !QGuiApplicationPrivate::platformIntegration()))
- qFatal("QFontDatabase: Must construct a QGuiApplication before accessing QFontDatabase");
-
- QMutexLocker locker(fontDatabaseMutex());
- createDatabase();
- d = privateDb();
-}
/*!
\enum QFontDatabase::WritingSystem
@@ -1475,24 +1266,109 @@ QFontDatabase::QFontDatabase()
*/
/*!
+ \class QFontDatabasePrivate
+ \internal
+
+ Singleton implementation of the public QFontDatabase APIs,
+ accessed through QFontDatabasePrivate::instance().
+
+ The database is organized in multiple levels:
+
+ - QFontDatabasePrivate::families
+ - QtFontFamily::foundries
+ - QtFontFoundry::styles
+ - QtFontStyle::sizes
+ - QtFontSize::pixelSize
+
+ The font database is the single source of truth when doing
+ font matching, so the database must be sufficiently filled
+ before attempting a match.
+
+ The database is populated (filled) from two sources:
+
+ 1. The system (platform's) view of the available fonts
+
+ Initiated via QFontDatabasePrivate::populateFontDatabase().
+
+ a. Can be registered lazily by family only, by calling
+ QPlatformFontDatabase::registerFontFamily(), and later
+ populated via QPlatformFontDatabase::populateFamily().
+
+ b. Or fully registered with all styles, by calling
+ QPlatformFontDatabase::registerFont().
+
+ 2. The fonts registered by the application via Qt APIs
+
+ Initiated via QFontDatabase::addApplicationFont() and
+ QFontDatabase::addApplicationFontFromData().
+
+ Application fonts are always fully registered when added.
+
+ Fonts can be added at any time, so the database may grow even
+ after QFontDatabasePrivate::populateFontDatabase() has been
+ completed.
+
+ The database does not support granular removal of fonts,
+ so if the system fonts change, or an application font is
+ removed, the font database will be cleared and then filled
+ from scratch, via QFontDatabasePrivate:invalidate() and
+ QFontDatabasePrivate::ensureFontDatabase().
+*/
+
+/*!
+ \internal
+
+ Initializes the font database if necessary and returns its
+ pointer. Mutex lock must be held when calling this function.
+*/
+QFontDatabasePrivate *QFontDatabasePrivate::ensureFontDatabase()
+{
+ auto *d = QFontDatabasePrivate::instance();
+ if (!d->populated) {
+ // The font database may have been partially populated, but to ensure
+ // we can answer queries for any platform- or user-provided family we
+ // need to fully populate it now.
+ qCDebug(lcFontDb) << "Populating font database";
+
+ if (Q_UNLIKELY(qGuiApp == nullptr || QGuiApplicationPrivate::platformIntegration() == nullptr))
+ qFatal("QFontDatabase: Must construct a QGuiApplication before accessing QFontDatabase");
+
+ auto *platformFontDatabase = QGuiApplicationPrivate::platformIntegration()->fontDatabase();
+ platformFontDatabase->populateFontDatabase();
+
+ for (int i = 0; i < d->applicationFonts.size(); i++) {
+ auto *font = &d->applicationFonts[i];
+ if (!font->isNull() && !font->isPopulated())
+ platformFontDatabase->addApplicationFont(font->data, font->fileName, font);
+ }
+
+ // Note: Both application fonts and platform fonts may be added
+ // after this initial population, so the only thing we are tracking
+ // is whether we've done our part in ensuring a filled font database.
+ d->populated = true;
+ }
+ return d;
+}
+
+/*!
Returns a sorted list of the available writing systems. This is
list generated from information about all installed fonts on the
system.
\sa families()
*/
-QList<QFontDatabase::WritingSystem> QFontDatabase::writingSystems() const
+QList<QFontDatabase::WritingSystem> QFontDatabase::writingSystems()
{
QMutexLocker locker(fontDatabaseMutex());
-
- QT_PREPEND_NAMESPACE(load)();
+ QFontDatabasePrivate *d = QFontDatabasePrivate::ensureFontDatabase();
quint64 writingSystemsFound = 0;
- Q_STATIC_ASSERT(WritingSystemsCount < 64);
+ static_assert(WritingSystemsCount < 64);
for (int i = 0; i < d->count; ++i) {
QtFontFamily *family = d->families[i];
- family->ensurePopulated();
+ if (!family->ensurePopulated())
+ continue;
if (family->count == 0)
continue;
@@ -1521,14 +1397,13 @@ QList<QFontDatabase::WritingSystem> QFontDatabase::writingSystems() const
\sa families()
*/
-QList<QFontDatabase::WritingSystem> QFontDatabase::writingSystems(const QString &family) const
+QList<QFontDatabase::WritingSystem> QFontDatabase::writingSystems(const QString &family)
{
QString familyName, foundryName;
parseFontName(family, foundryName, familyName);
QMutexLocker locker(fontDatabaseMutex());
-
- QT_PREPEND_NAMESPACE(load)();
+ QFontDatabasePrivate *d = QFontDatabasePrivate::ensureFontDatabase();
QList<WritingSystem> list;
QtFontFamily *f = d->family(familyName);
@@ -1554,11 +1429,10 @@ QList<QFontDatabase::WritingSystem> QFontDatabase::writingSystems(const QString
\sa writingSystems()
*/
-QStringList QFontDatabase::families(WritingSystem writingSystem) const
+QStringList QFontDatabase::families(WritingSystem writingSystem)
{
QMutexLocker locker(fontDatabaseMutex());
-
- QT_PREPEND_NAMESPACE(load)();
+ QFontDatabasePrivate *d = QFontDatabasePrivate::ensureFontDatabase();
QStringList flist;
for (int i = 0; i < d->count; i++) {
@@ -1566,7 +1440,8 @@ QStringList QFontDatabase::families(WritingSystem writingSystem) const
if (f->populated && f->count == 0)
continue;
if (writingSystem != Any) {
- f->ensurePopulated();
+ if (!f->ensurePopulated())
+ continue;
if (f->writingSystems[writingSystem] != QtFontFamily::Supported)
continue;
}
@@ -1577,9 +1452,9 @@ QStringList QFontDatabase::families(WritingSystem writingSystem) const
QString str = f->name;
QString foundry = f->foundries[j]->name;
if (!foundry.isEmpty()) {
- str += QLatin1String(" [");
+ str += " ["_L1;
str += foundry;
- str += QLatin1Char(']');
+ str += u']';
}
flist.append(str);
}
@@ -1595,14 +1470,13 @@ QStringList QFontDatabase::families(WritingSystem writingSystem) const
\sa families()
*/
-QStringList QFontDatabase::styles(const QString &family) const
+QStringList QFontDatabase::styles(const QString &family)
{
QString familyName, foundryName;
parseFontName(family, foundryName, familyName);
QMutexLocker locker(fontDatabaseMutex());
-
- QT_PREPEND_NAMESPACE(load)(familyName);
+ QFontDatabasePrivate *d = QFontDatabasePrivate::ensureFontDatabase();
QStringList l;
QtFontFamily *f = d->family(familyName);
@@ -1637,7 +1511,7 @@ QStringList QFontDatabase::styles(const QString &family) const
*/
bool QFontDatabase::isFixedPitch(const QString &family,
- const QString &style) const
+ const QString &style)
{
Q_UNUSED(style);
@@ -1645,8 +1519,7 @@ bool QFontDatabase::isFixedPitch(const QString &family,
parseFontName(family, foundryName, familyName);
QMutexLocker locker(fontDatabaseMutex());
-
- QT_PREPEND_NAMESPACE(load)(familyName);
+ QFontDatabasePrivate *d = QFontDatabasePrivate::ensureFontDatabase();
QtFontFamily *f = d->family(familyName);
return (f && f->fixedPitch);
@@ -1663,15 +1536,14 @@ bool QFontDatabase::isFixedPitch(const QString &family,
\sa isScalable(), isSmoothlyScalable()
*/
bool QFontDatabase::isBitmapScalable(const QString &family,
- const QString &style) const
+ const QString &style)
{
bool bitmapScalable = false;
QString familyName, foundryName;
parseFontName(family, foundryName, familyName);
QMutexLocker locker(fontDatabaseMutex());
-
- QT_PREPEND_NAMESPACE(load)(familyName);
+ QFontDatabasePrivate *d = QFontDatabasePrivate::ensureFontDatabase();
QtFontFamily *f = d->family(familyName);
if (!f) return bitmapScalable;
@@ -1703,39 +1575,44 @@ bool QFontDatabase::isBitmapScalable(const QString &family,
\sa isScalable(), isBitmapScalable()
*/
-bool QFontDatabase::isSmoothlyScalable(const QString &family, const QString &style) const
+bool QFontDatabase::isSmoothlyScalable(const QString &family, const QString &style)
{
bool smoothScalable = false;
QString familyName, foundryName;
parseFontName(family, foundryName, familyName);
QMutexLocker locker(fontDatabaseMutex());
-
- QT_PREPEND_NAMESPACE(load)(familyName);
+ QFontDatabasePrivate *d = QFontDatabasePrivate::ensureFontDatabase();
QtFontFamily *f = d->family(familyName);
if (!f) {
for (int i = 0; i < d->count; i++) {
if (d->families[i]->matchesFamilyName(familyName)) {
f = d->families[i];
- f->ensurePopulated();
- break;
+ if (f->ensurePopulated())
+ break;
}
}
}
if (!f) return smoothScalable;
- QtFontStyle::Key styleKey(style);
+ const QtFontStyle::Key styleKey(style);
for (int j = 0; j < f->count; j++) {
QtFontFoundry *foundry = f->foundries[j];
if (foundryName.isEmpty() || foundry->name.compare(foundryName, Qt::CaseInsensitive) == 0) {
- for (int k = 0; k < foundry->count; k++)
- if ((style.isEmpty() ||
- foundry->styles[k]->styleName == style ||
- foundry->styles[k]->key == styleKey) && foundry->styles[k]->smoothScalable) {
- smoothScalable = true;
+ for (int k = 0; k < foundry->count; k++) {
+ const QtFontStyle *fontStyle = foundry->styles[k];
+ smoothScalable =
+ fontStyle->smoothScalable
+ && ((style.isEmpty()
+ || fontStyle->styleName == style
+ || fontStyle->key == styleKey)
+ || (fontStyle->styleName.isEmpty()
+ && style == styleStringHelper(fontStyle->key.weight,
+ QFont::Style(fontStyle->key.style))));
+ if (smoothScalable)
goto end;
- }
+ }
}
}
end:
@@ -1749,7 +1626,7 @@ bool QFontDatabase::isSmoothlyScalable(const QString &family, const QString &sty
\sa isBitmapScalable(), isSmoothlyScalable()
*/
bool QFontDatabase::isScalable(const QString &family,
- const QString &style) const
+ const QString &style)
{
QMutexLocker locker(fontDatabaseMutex());
if (isSmoothlyScalable(family, style))
@@ -1765,7 +1642,7 @@ bool QFontDatabase::isScalable(const QString &family,
\sa smoothSizes(), standardSizes()
*/
QList<int> QFontDatabase::pointSizes(const QString &family,
- const QString &styleName)
+ const QString &styleName)
{
if (QGuiApplicationPrivate::platformIntegration()->fontDatabase()->fontsAlwaysScalable())
return standardSizes();
@@ -1775,8 +1652,7 @@ QList<int> QFontDatabase::pointSizes(const QString &family,
parseFontName(family, foundryName, familyName);
QMutexLocker locker(fontDatabaseMutex());
-
- QT_PREPEND_NAMESPACE(load)(familyName);
+ QFontDatabasePrivate *d = QFontDatabasePrivate::ensureFontDatabase();
QList<int> sizes;
@@ -1801,7 +1677,7 @@ QList<int> QFontDatabase::pointSizes(const QString &family,
const QtFontSize *size = style->pixelSizes + l;
if (size->pixelSize != 0 && size->pixelSize != SMOOTH_SCALABLE) {
- const uint pointSize = qRound(size->pixelSize * 72.0 / dpi);
+ const int pointSize = qRound(size->pixelSize * 72.0 / dpi);
if (! sizes.contains(pointSize))
sizes.append(pointSize);
}
@@ -1823,14 +1699,12 @@ QList<int> QFontDatabase::pointSizes(const QString &family,
returned.
*/
QFont QFontDatabase::font(const QString &family, const QString &style,
- int pointSize) const
+ int pointSize)
{
QString familyName, foundryName;
parseFontName(family, foundryName, familyName);
-
QMutexLocker locker(fontDatabaseMutex());
-
- QT_PREPEND_NAMESPACE(load)(familyName);
+ QFontDatabasePrivate *d = QFontDatabasePrivate::ensureFontDatabase();
QtFontFoundry allStyles(foundryName);
QtFontFamily *f = d->family(familyName);
@@ -1850,7 +1724,7 @@ QFont QFontDatabase::font(const QString &family, const QString &style,
if (!s) // no styles found?
return QGuiApplication::font();
- QFont fnt(family, pointSize, s->key.weight);
+ QFont fnt(QStringList{family}, pointSize, s->key.weight);
fnt.setStyle((QFont::Style)s->key.style);
if (!s->styleName.isEmpty())
fnt.setStyleName(s->styleName);
@@ -1877,8 +1751,7 @@ QList<int> QFontDatabase::smoothSizes(const QString &family,
parseFontName(family, foundryName, familyName);
QMutexLocker locker(fontDatabaseMutex());
-
- QT_PREPEND_NAMESPACE(load)(familyName);
+ QFontDatabasePrivate *d = QFontDatabasePrivate::ensureFontDatabase();
QList<int> sizes;
@@ -1903,7 +1776,7 @@ QList<int> QFontDatabase::smoothSizes(const QString &family,
const QtFontSize *size = style->pixelSizes + l;
if (size->pixelSize != 0 && size->pixelSize != SMOOTH_SCALABLE) {
- const uint pointSize = qRound(size->pixelSize * 72.0 / dpi);
+ const int pointSize = qRound(size->pixelSize * 72.0 / dpi);
if (! sizes.contains(pointSize))
sizes.append(pointSize);
}
@@ -1936,14 +1809,13 @@ QList<int> QFontDatabase::standardSizes()
\sa weight(), bold()
*/
-bool QFontDatabase::italic(const QString &family, const QString &style) const
+bool QFontDatabase::italic(const QString &family, const QString &style)
{
QString familyName, foundryName;
parseFontName(family, foundryName, familyName);
QMutexLocker locker(fontDatabaseMutex());
-
- QT_PREPEND_NAMESPACE(load)(familyName);
+ QFontDatabasePrivate *d = QFontDatabasePrivate::ensureFontDatabase();
QtFontFoundry allStyles(foundryName);
QtFontFamily *f = d->family(familyName);
@@ -1970,14 +1842,13 @@ bool QFontDatabase::italic(const QString &family, const QString &style) const
\sa italic(), weight()
*/
bool QFontDatabase::bold(const QString &family,
- const QString &style) const
+ const QString &style)
{
QString familyName, foundryName;
parseFontName(family, foundryName, familyName);
QMutexLocker locker(fontDatabaseMutex());
-
- QT_PREPEND_NAMESPACE(load)(familyName);
+ QFontDatabasePrivate *d = QFontDatabasePrivate::ensureFontDatabase();
QtFontFoundry allStyles(foundryName);
QtFontFamily *f = d->family(familyName);
@@ -2006,14 +1877,13 @@ bool QFontDatabase::bold(const QString &family,
\sa italic(), bold()
*/
int QFontDatabase::weight(const QString &family,
- const QString &style) const
+ const QString &style)
{
QString familyName, foundryName;
parseFontName(family, foundryName, familyName);
QMutexLocker locker(fontDatabaseMutex());
-
- QT_PREPEND_NAMESPACE(load)(familyName);
+ QFontDatabasePrivate *d = QFontDatabasePrivate::ensureFontDatabase();
QtFontFoundry allStyles(foundryName);
QtFontFamily *f = d->family(familyName);
@@ -2035,12 +1905,24 @@ int QFontDatabase::weight(const QString &family,
/*! \internal */
-bool QFontDatabase::hasFamily(const QString &family) const
+bool QFontDatabase::hasFamily(const QString &family)
{
QString parsedFamily, foundry;
parseFontName(family, foundry, parsedFamily);
- const QString familyAlias = resolveFontFamilyAlias(parsedFamily);
- return families().contains(familyAlias, Qt::CaseInsensitive);
+ const QString familyAlias = QFontDatabasePrivate::resolveFontFamilyAlias(parsedFamily);
+
+ QMutexLocker locker(fontDatabaseMutex());
+ QFontDatabasePrivate *d = QFontDatabasePrivate::ensureFontDatabase();
+
+ for (int i = 0; i < d->count; i++) {
+ QtFontFamily *f = d->families[i];
+ if (f->populated && f->count == 0)
+ continue;
+ if (familyAlias.compare(f->name, Qt::CaseInsensitive) == 0)
+ return true;
+ }
+
+ return false;
}
@@ -2056,7 +1938,7 @@ bool QFontDatabase::hasFamily(const QString &family) const
\sa families()
*/
-bool QFontDatabase::isPrivateFamily(const QString &family) const
+bool QFontDatabase::isPrivateFamily(const QString &family)
{
return QGuiApplicationPrivate::platformIntegration()->fontDatabase()->isPrivateFontFamily(family);
}
@@ -2179,248 +2061,99 @@ QString QFontDatabase::writingSystemName(WritingSystem writingSystem)
return QCoreApplication::translate("QFontDatabase", name);
}
-
/*!
Returns a string with sample characters from \a writingSystem.
*/
QString QFontDatabase::writingSystemSample(WritingSystem writingSystem)
{
- QString sample;
- switch (writingSystem) {
- case Any:
- case Symbol:
- // show only ascii characters
- sample += QLatin1String("AaBbzZ");
- break;
- case Latin:
- // This is cheating... we only show latin-1 characters so that we don't
- // end up loading lots of fonts - at least on X11...
- sample = QLatin1String("Aa");
- sample += QChar(0x00C3);
- sample += QChar(0x00E1);
- sample += QLatin1String("Zz");
- break;
- case Greek:
- sample += QChar(0x0393);
- sample += QChar(0x03B1);
- sample += QChar(0x03A9);
- sample += QChar(0x03C9);
- break;
- case Cyrillic:
- sample += QChar(0x0414);
- sample += QChar(0x0434);
- sample += QChar(0x0436);
- sample += QChar(0x044f);
- break;
- case Armenian:
- sample += QChar(0x053f);
- sample += QChar(0x054f);
- sample += QChar(0x056f);
- sample += QChar(0x057f);
- break;
- case Hebrew:
- sample += QChar(0x05D0);
- sample += QChar(0x05D1);
- sample += QChar(0x05D2);
- sample += QChar(0x05D3);
- break;
- case Arabic:
- sample += QChar(0x0623);
- sample += QChar(0x0628);
- sample += QChar(0x062C);
- sample += QChar(0x062F);
- sample += QChar(0x064A);
- sample += QChar(0x0629);
- sample += QChar(0x0020);
- sample += QChar(0x0639);
- sample += QChar(0x0631);
- sample += QChar(0x0628);
- sample += QChar(0x064A);
- sample += QChar(0x0629);
- break;
- case Syriac:
- sample += QChar(0x0715);
- sample += QChar(0x0725);
- sample += QChar(0x0716);
- sample += QChar(0x0726);
- break;
- case Thaana:
- sample += QChar(0x0784);
- sample += QChar(0x0794);
- sample += QChar(0x078c);
- sample += QChar(0x078d);
- break;
- case Devanagari:
- sample += QChar(0x0905);
- sample += QChar(0x0915);
- sample += QChar(0x0925);
- sample += QChar(0x0935);
- break;
- case Bengali:
- sample += QChar(0x0986);
- sample += QChar(0x0996);
- sample += QChar(0x09a6);
- sample += QChar(0x09b6);
- break;
- case Gurmukhi:
- sample += QChar(0x0a05);
- sample += QChar(0x0a15);
- sample += QChar(0x0a25);
- sample += QChar(0x0a35);
- break;
- case Gujarati:
- sample += QChar(0x0a85);
- sample += QChar(0x0a95);
- sample += QChar(0x0aa5);
- sample += QChar(0x0ab5);
- break;
- case Oriya:
- sample += QChar(0x0b06);
- sample += QChar(0x0b16);
- sample += QChar(0x0b2b);
- sample += QChar(0x0b36);
- break;
- case Tamil:
- sample += QChar(0x0b89);
- sample += QChar(0x0b99);
- sample += QChar(0x0ba9);
- sample += QChar(0x0bb9);
- break;
- case Telugu:
- sample += QChar(0x0c05);
- sample += QChar(0x0c15);
- sample += QChar(0x0c25);
- sample += QChar(0x0c35);
- break;
- case Kannada:
- sample += QChar(0x0c85);
- sample += QChar(0x0c95);
- sample += QChar(0x0ca5);
- sample += QChar(0x0cb5);
- break;
- case Malayalam:
- sample += QChar(0x0d05);
- sample += QChar(0x0d15);
- sample += QChar(0x0d25);
- sample += QChar(0x0d35);
- break;
- case Sinhala:
- sample += QChar(0x0d90);
- sample += QChar(0x0da0);
- sample += QChar(0x0db0);
- sample += QChar(0x0dc0);
- break;
- case Thai:
- sample += QChar(0x0e02);
- sample += QChar(0x0e12);
- sample += QChar(0x0e22);
- sample += QChar(0x0e32);
- break;
- case Lao:
- sample += QChar(0x0e8d);
- sample += QChar(0x0e9d);
- sample += QChar(0x0ead);
- sample += QChar(0x0ebd);
- break;
- case Tibetan:
- sample += QChar(0x0f00);
- sample += QChar(0x0f01);
- sample += QChar(0x0f02);
- sample += QChar(0x0f03);
- break;
- case Myanmar:
- sample += QChar(0x1000);
- sample += QChar(0x1001);
- sample += QChar(0x1002);
- sample += QChar(0x1003);
- break;
- case Georgian:
- sample += QChar(0x10a0);
- sample += QChar(0x10b0);
- sample += QChar(0x10c0);
- sample += QChar(0x10d0);
- break;
- case Khmer:
- sample += QChar(0x1780);
- sample += QChar(0x1790);
- sample += QChar(0x17b0);
- sample += QChar(0x17c0);
- break;
- case SimplifiedChinese:
- sample += QChar(0x4e2d);
- sample += QChar(0x6587);
- sample += QChar(0x8303);
- sample += QChar(0x4f8b);
- break;
- case TraditionalChinese:
- sample += QChar(0x4e2d);
- sample += QChar(0x6587);
- sample += QChar(0x7bc4);
- sample += QChar(0x4f8b);
- break;
- case Japanese:
- sample += QChar(0x30b5);
- sample += QChar(0x30f3);
- sample += QChar(0x30d7);
- sample += QChar(0x30eb);
- sample += QChar(0x3067);
- sample += QChar(0x3059);
- break;
- case Korean:
- sample += QChar(0xac00);
- sample += QChar(0xac11);
- sample += QChar(0xac1a);
- sample += QChar(0xac2f);
- break;
- case Vietnamese:
- {
- static const char vietnameseUtf8[] = {
- char(0xef), char(0xbb), char(0xbf), char(0xe1), char(0xbb), char(0x97),
- char(0xe1), char(0xbb), char(0x99),
- char(0xe1), char(0xbb), char(0x91),
- char(0xe1), char(0xbb), char(0x93),
- };
- sample += QString::fromUtf8(vietnameseUtf8, sizeof(vietnameseUtf8));
- break;
- }
- case Ogham:
- sample += QChar(0x1681);
- sample += QChar(0x1682);
- sample += QChar(0x1683);
- sample += QChar(0x1684);
- break;
- case Runic:
- sample += QChar(0x16a0);
- sample += QChar(0x16a1);
- sample += QChar(0x16a2);
- sample += QChar(0x16a3);
- break;
- case Nko:
- sample += QChar(0x7ca);
- sample += QChar(0x7cb);
- sample += QChar(0x7cc);
- sample += QChar(0x7cd);
- break;
- default:
- break;
- }
- return sample;
+ return [&]() -> QStringView {
+ switch (writingSystem) {
+ case QFontDatabase::Any:
+ case QFontDatabase::Symbol:
+ // show only ascii characters
+ return u"AaBbzZ";
+ case QFontDatabase::Latin:
+ // This is cheating... we only show latin-1 characters so that we don't
+ // end up loading lots of fonts - at least on X11...
+ return u"Aa\x00C3\x00E1Zz";
+ case QFontDatabase::Greek:
+ return u"\x0393\x03B1\x03A9\x03C9";
+ case QFontDatabase::Cyrillic:
+ return u"\x0414\x0434\x0436\x044f";
+ case QFontDatabase::Armenian:
+ return u"\x053f\x054f\x056f\x057f";
+ case QFontDatabase::Hebrew:
+ return u"\x05D0\x05D1\x05D2\x05D3";
+ case QFontDatabase::Arabic:
+ return u"\x0623\x0628\x062C\x062F\x064A\x0629\x0020\x0639\x0631\x0628\x064A\x0629";
+ case QFontDatabase::Syriac:
+ return u"\x0715\x0725\x0716\x0726";
+ case QFontDatabase::Thaana:
+ return u"\x0784\x0794\x078c\x078d";
+ case QFontDatabase::Devanagari:
+ return u"\x0905\x0915\x0925\x0935";
+ case QFontDatabase::Bengali:
+ return u"\x0986\x0996\x09a6\x09b6";
+ case QFontDatabase::Gurmukhi:
+ return u"\x0a05\x0a15\x0a25\x0a35";
+ case QFontDatabase::Gujarati:
+ return u"\x0a85\x0a95\x0aa5\x0ab5";
+ case QFontDatabase::Oriya:
+ return u"\x0b06\x0b16\x0b2b\x0b36";
+ case QFontDatabase::Tamil:
+ return u"\x0b89\x0b99\x0ba9\x0bb9";
+ case QFontDatabase::Telugu:
+ return u"\x0c05\x0c15\x0c25\x0c35";
+ case QFontDatabase::Kannada:
+ return u"\x0c85\x0c95\x0ca5\x0cb5";
+ case QFontDatabase::Malayalam:
+ return u"\x0d05\x0d15\x0d25\x0d35";
+ case QFontDatabase::Sinhala:
+ return u"\x0d90\x0da0\x0db0\x0dc0";
+ case QFontDatabase::Thai:
+ return u"\x0e02\x0e12\x0e22\x0e32";
+ case QFontDatabase::Lao:
+ return u"\x0e8d\x0e9d\x0ead\x0ebd";
+ case QFontDatabase::Tibetan:
+ return u"\x0f00\x0f01\x0f02\x0f03";
+ case QFontDatabase::Myanmar:
+ return u"\x1000\x1001\x1002\x1003";
+ case QFontDatabase::Georgian:
+ return u"\x10a0\x10b0\x10c0\x10d0";
+ case QFontDatabase::Khmer:
+ return u"\x1780\x1790\x17b0\x17c0";
+ case QFontDatabase::SimplifiedChinese:
+ return u"\x4e2d\x6587\x8303\x4f8b";
+ case QFontDatabase::TraditionalChinese:
+ return u"\x4e2d\x6587\x7bc4\x4f8b";
+ case QFontDatabase::Japanese:
+ return u"\x30b5\x30f3\x30d7\x30eb\x3067\x3059";
+ case QFontDatabase::Korean:
+ return u"\xac00\xac11\xac1a\xac2f";
+ case QFontDatabase::Vietnamese:
+ return u"\x1ED7\x1ED9\x1ED1\x1ED3";
+ case QFontDatabase::Ogham:
+ return u"\x1681\x1682\x1683\x1684";
+ case QFontDatabase::Runic:
+ return u"\x16a0\x16a1\x16a2\x16a3";
+ case QFontDatabase::Nko:
+ return u"\x7ca\x7cb\x7cc\x7cd";
+ default:
+ return nullptr;
+ }
+ }().toString();
}
-
-void QFontDatabase::parseFontName(const QString &name, QString &foundry, QString &family)
+void QFontDatabasePrivate::parseFontName(const QString &name, QString &foundry, QString &family)
{
QT_PREPEND_NAMESPACE(parseFontName)(name, foundry, family);
}
-void QFontDatabase::createDatabase()
-{ initializeDb(); }
-
// used from qfontengine_ft.cpp
Q_GUI_EXPORT QByteArray qt_fontdata_from_index(int index)
{
QMutexLocker locker(fontDatabaseMutex());
- return privateDb()->applicationFonts.value(index).data;
+ return QFontDatabasePrivate::instance()->applicationFonts.value(index).data;
}
int QFontDatabasePrivate::addAppFont(const QByteArray &fontData, const QString &fileName)
@@ -2432,35 +2165,36 @@ int QFontDatabasePrivate::addAppFont(const QByteArray &fontData, const QString &
Q_TRACE(QFontDatabasePrivate_addAppFont, fileName);
int i;
- for (i = 0; i < applicationFonts.count(); ++i)
- if (applicationFonts.at(i).families.isEmpty())
+ for (i = 0; i < applicationFonts.size(); ++i)
+ if (applicationFonts.at(i).isNull())
break;
- if (i >= applicationFonts.count()) {
+ if (i >= applicationFonts.size()) {
applicationFonts.append(ApplicationFont());
- i = applicationFonts.count() - 1;
+ i = applicationFonts.size() - 1;
}
if (font.fileName.isEmpty() && !fontData.isEmpty())
- font.fileName = QLatin1String(":qmemoryfonts/") + QString::number(i);
+ font.fileName = ":qmemoryfonts/"_L1 + QString::number(i);
- bool wasEmpty = privateDb()->count == 0;
- registerFont(&font);
- if (font.families.isEmpty())
+ auto *platformFontDatabase = QGuiApplicationPrivate::platformIntegration()->fontDatabase();
+ platformFontDatabase->addApplicationFont(font.data, font.fileName, &font);
+ if (font.properties.isEmpty())
return -1;
applicationFonts[i] = font;
- // If the cache has not yet been populated, we need to reload the application font later
- if (wasEmpty)
- invalidate();
- else
- emit qApp->fontDatabaseChanged();
+ // The font cache may have cached lookups for the font that was now
+ // loaded, so it has to be flushed.
+ QFontCache::instance()->clear();
+
+ emit qApp->fontDatabaseChanged();
+
return i;
}
bool QFontDatabasePrivate::isApplicationFont(const QString &fileName)
{
- for (int i = 0; i < applicationFonts.count(); ++i)
+ for (int i = 0; i < applicationFonts.size(); ++i)
if (applicationFonts.at(i).fileName == fileName)
return true;
return false;
@@ -2474,13 +2208,12 @@ bool QFontDatabasePrivate::isApplicationFont(const QString &fileName)
with removeApplicationFont() or to retrieve the list of family names contained
in the font.
+//! [add-application-font-doc]
The function returns -1 if the font could not be loaded.
Currently only TrueType fonts, TrueType font collections, and OpenType fonts are
supported.
-
- \note Adding application fonts on Unix/X11 platforms without fontconfig is
- currently not supported.
+//! [add-application-font-doc]
\sa addApplicationFontFromData(), applicationFontFamilies(), removeApplicationFont()
*/
@@ -2497,7 +2230,7 @@ int QFontDatabase::addApplicationFont(const QString &fileName)
data = f.readAll();
}
QMutexLocker locker(fontDatabaseMutex());
- return privateDb()->addAppFont(data, fileName);
+ return QFontDatabasePrivate::instance()->addAppFont(data, fileName);
}
/*!
@@ -2508,19 +2241,14 @@ int QFontDatabase::addApplicationFont(const QString &fileName)
with removeApplicationFont() or to retrieve the list of family names contained
in the font.
- The function returns -1 if the font could not be loaded.
-
- Currently only TrueType fonts and TrueType font collections are supported.
-
- \b{Note:} Adding application fonts on Unix/X11 platforms without fontconfig is
- currently not supported.
+ \include qfontdatabase.cpp add-application-font-doc
\sa addApplicationFont(), applicationFontFamilies(), removeApplicationFont()
*/
int QFontDatabase::addApplicationFontFromData(const QByteArray &fontData)
{
QMutexLocker locker(fontDatabaseMutex());
- return privateDb()->addAppFont(fontData, QString() /* fileName */);
+ return QFontDatabasePrivate::instance()->addAppFont(fontData, QString() /* fileName */);
}
/*!
@@ -2534,7 +2262,15 @@ int QFontDatabase::addApplicationFontFromData(const QByteArray &fontData)
QStringList QFontDatabase::applicationFontFamilies(int id)
{
QMutexLocker locker(fontDatabaseMutex());
- return privateDb()->applicationFonts.value(id).families;
+ auto *d = QFontDatabasePrivate::instance();
+
+ QStringList ret;
+ ret.reserve(d->applicationFonts.value(id).properties.size());
+
+ for (const auto &properties : d->applicationFonts.value(id).properties)
+ ret.append(properties.familyName);
+
+ return ret;
}
/*!
@@ -2589,8 +2325,8 @@ bool QFontDatabase::removeApplicationFont(int handle)
{
QMutexLocker locker(fontDatabaseMutex());
- QFontDatabasePrivate *db = privateDb();
- if (handle < 0 || handle >= db->applicationFonts.count())
+ auto *db = QFontDatabasePrivate::instance();
+ if (handle < 0 || handle >= db->applicationFonts.size())
return false;
db->applicationFonts[handle] = QFontDatabasePrivate::ApplicationFont();
@@ -2615,8 +2351,8 @@ bool QFontDatabase::removeAllApplicationFonts()
{
QMutexLocker locker(fontDatabaseMutex());
- QFontDatabasePrivate *db = privateDb();
- if (db->applicationFonts.isEmpty())
+ auto *db = QFontDatabasePrivate::instance();
+ if (!db || db->applicationFonts.isEmpty())
return false;
db->applicationFonts.clear();
@@ -2625,41 +2361,148 @@ bool QFontDatabase::removeAllApplicationFonts()
}
/*!
- \fn bool QFontDatabase::supportsThreadedFontRendering()
- \since 4.4
- \deprecated
+ \since 6.8
+
+ Adds \a familyName as an application-defined fallback font for \a script.
+
+ When Qt encounters characters that are not supported by the selected font, it will search
+ through a list of fallback fonts to find a match for them. This ensures that combining multiple
+ scripts in a single string is possible, even if the main font does not support them.
- Returns \c true if font rendering is supported outside the GUI
- thread, false otherwise. In other words, a return value of false
- means that all QPainter::drawText() calls outside the GUI thread
- will not produce readable output.
+ The list of fallback fonts is selected based on the script of the string as well as other
+ conditions, such as system language.
- As of 5.0, always returns \c true.
+ While the system fallback list is usually sufficient, there are cases where it is useful
+ to override the default behavior. One such case is for using application fonts as fallback to
+ ensure cross-platform consistency.
- \sa {Thread-Support in Qt Modules#Painting In Threads}{Painting In Threads}
+ In another case the application may be written in a script with regional differences and want
+ to run it untranslated in multiple regions. In this case, it might be useful to override the
+ local region's fallback with one that matches the language of the application.
+
+ By passing \a familyName to addApplicationFallbackFontFamily(), this will become the preferred
+ family when matching missing characters from \a script. The \a script must be a valid script
+ (\c QChar::Script_Latin or higher). When adding multiple fonts for the same script, they will
+ be prioritized in reverse order, so that the last family added will be checked first and so
+ on.
+
+ \sa setApplicationFallbackFontFamilies(), removeApplicationFallbackFontFamily(), applicationFallbackFontFamilies()
*/
-#if QT_DEPRECATED_SINCE(5, 2)
-bool QFontDatabase::supportsThreadedFontRendering()
+void QFontDatabase::addApplicationFallbackFontFamily(QChar::Script script, const QString &familyName)
{
- return true;
+ QMutexLocker locker(fontDatabaseMutex());
+
+ if (script < QChar::Script_Latin) {
+ qCWarning(lcFontDb) << "Invalid script passed to addApplicationFallbackFontFamily:" << script;
+ return;
+ }
+
+ auto *db = QFontDatabasePrivate::instance();
+ auto it = db->applicationFallbackFontFamilies.find(script);
+ if (it == db->applicationFallbackFontFamilies.end())
+ it = db->applicationFallbackFontFamilies.insert(script, QStringList{});
+
+ it->prepend(familyName);
+ db->fallbacksCache.clear();
}
-#endif
/*!
- \internal
+ \since 6.8
+
+ Removes \a familyName from the list of application-defined fallback fonts for \a script,
+ provided that it has previously been added with \l{addApplicationFallbackFontFamily()}.
+
+ Returns true if the family name was in the list and false if it was not.
+
+ \sa addApplicationFallbackFontFamily(), setApplicationFallbackFontFamilies(), applicationFallbackFontFamilies()
*/
-QFontEngine *QFontDatabase::findFont(const QFontDef &request, int script)
+bool QFontDatabase::removeApplicationFallbackFontFamily(QChar::Script script, const QString &familyName)
{
QMutexLocker locker(fontDatabaseMutex());
- if (!privateDb()->count)
- initializeDb();
+ auto *db = QFontDatabasePrivate::instance();
+ auto it = db->applicationFallbackFontFamilies.find(script);
+ if (it != db->applicationFallbackFontFamilies.end()) {
+ if (it->removeAll(familyName) > 0) {
+ if (it->isEmpty())
+ it = db->applicationFallbackFontFamilies.erase(it);
+ QFontCache::instance()->clear();
+ db->fallbacksCache.clear();
+ return true;
+ }
+ }
+
+ return false;
+}
+
+/*!
+ \since 6.8
+
+ Sets the list of application-defined fallback fonts for \a script to \a familyNames.
+
+ When Qt encounters a character in \a script which is not supported by the current font, it will
+ check the families in \a familyNames, in order from first to last, until it finds a match. See
+ \l{addApplicationFallbackFontFamily()} for more details.
+
+ This function overwrites the current list of application-defined fallback fonts for \a script.
+
+ \sa addApplicationFallbackFontFamily(), removeApplicationFallbackFontFamily(), applicationFallbackFontFamilies()
+*/
+void QFontDatabase::setApplicationFallbackFontFamilies(QChar::Script script, const QStringList &familyNames)
+{
+ QMutexLocker locker(fontDatabaseMutex());
+
+ if (script < QChar::Script_Latin) {
+ qCWarning(lcFontDb) << "Invalid script passed to setApplicationFallbackFontFamilies:" << script;
+ return;
+ }
+
+ auto *db = QFontDatabasePrivate::instance();
+ db->applicationFallbackFontFamilies[script] = familyNames;
+
+ QFontCache::instance()->clear();
+ db->fallbacksCache.clear();
+}
+
+/*!
+ \since 6.8
+
+ Returns the list of application-defined fallback font families previously added for \a script
+ by the \l{addApplicationFallbackFontFamily()} function.
+
+ \sa setApplicationFallbackFontFamilies(), addApplicationFallbackFontFamily(), removeApplicationFallbackFontFamily()
+*/
+QStringList QFontDatabase::applicationFallbackFontFamilies(QChar::Script script)
+{
+ QMutexLocker locker(fontDatabaseMutex());
+
+ auto *db = QFontDatabasePrivate::instance();
+ return db->applicationFallbackFontFamilies.value(script);
+}
+
+/*!
+ \internal
+*/
+QFontEngine *QFontDatabasePrivate::findFont(const QFontDef &req,
+ int script,
+ bool preferScriptOverFamily)
+{
+ QMutexLocker locker(fontDatabaseMutex());
+ ensureFontDatabase();
QFontEngine *engine;
+#ifdef Q_OS_WIN
+ const QFontDef request = static_cast<QWindowsFontDatabaseBase *>(
+ QGuiApplicationPrivate::platformIntegration()->fontDatabase())
+ ->sanitizeRequest(req);
+#else
+ const QFontDef &request = req;
+#endif
+
#if defined(QT_BUILD_INTERNAL)
// For testing purpose only, emulates an exact-matching monospace font
- if (qt_enable_test_font && request.family == QLatin1String("__Qt__Box__Engine__")) {
+ if (qt_enable_test_font && request.families.first() == "__Qt__Box__Engine__"_L1) {
engine = new QTestFontEngine(request.pixelSize);
engine->fontDef = request;
return engine;
@@ -2679,22 +2522,36 @@ QFontEngine *QFontDatabase::findFont(const QFontDef &request, int script)
return engine;
}
+ if (request.pixelSize > 0xffff) {
+ // Stop absurd requests reaching the engines; pixel size is assumed to fit ushort
+ qCDebug(lcFontMatch, "Rejecting request for pixel size %g2, returning box engine", double(request.pixelSize));
+ return new QFontEngineBox(32); // not request.pixelSize, to avoid overflow/DOS
+ }
+
QString family_name, foundry_name;
- const QString requestFamily = request.families.size() > 0 ? request.families.at(0) : request.family;
+ const QString requestFamily = request.families.at(0);
parseFontName(requestFamily, foundry_name, family_name);
QtFontDesc desc;
QList<int> blackListed;
- int index = match(multi ? QChar::Script_Common : script, request, family_name, foundry_name, &desc, blackListed);
- if (index < 0 && QGuiApplicationPrivate::platformIntegration()->fontDatabase()->populateFamilyAliases(family_name)) {
- // We populated familiy aliases (e.g. localized families), so try again
+ unsigned int score = UINT_MAX;
+ int index = match(multi ? QChar::Script_Common : script, request, family_name, foundry_name, &desc, blackListed, &score);
+ if (score > 0 && QGuiApplicationPrivate::platformIntegration()->fontDatabase()->populateFamilyAliases(family_name)) {
+ // We populated family aliases (e.g. localized families), so try again
index = match(multi ? QChar::Script_Common : script, request, family_name, foundry_name, &desc, blackListed);
}
+
+ // If we do not find a match and NoFontMerging is set, use the requested font even if it does
+ // not support the script.
+ //
+ // (we do this at the end to prefer foundries that support the script if they exist)
+ if (index < 0 && !multi && !preferScriptOverFamily)
+ index = match(QChar::Script_Common, request, family_name, foundry_name, &desc, blackListed);
+
if (index >= 0) {
QFontDef fontDef = request;
-
// Don't pass empty family names to the platform font database, since it will then invoke its own matching
// and we will be out of sync with the matched font.
- if (fontDef.families.isEmpty() && fontDef.family.isEmpty())
+ if (fontDef.families.isEmpty())
fontDef.families = QStringList(desc.family->name);
engine = loadEngine(script, fontDef, desc.family, desc.foundry, desc.style, desc.size);
@@ -2723,17 +2580,17 @@ QFontEngine *QFontDatabase::findFont(const QFontDef &request, int script)
for (int i = 0; !engine && i < fallbacks.size(); i++) {
QFontDef def = request;
- def.family = fallbacks.at(i);
+ def.families = QStringList(fallbacks.at(i));
QFontCache::Key key(def, script, multi ? 1 : 0);
engine = fontCache->findEngine(key);
if (!engine) {
QtFontDesc desc;
do {
- index = match(multi ? QChar::Script_Common : script, def, def.family, QLatin1String(""), &desc, blackListed);
+ index = match(multi ? QChar::Script_Common : script, def, def.families.constFirst(), ""_L1, &desc, blackListed);
if (index >= 0) {
QFontDef loadDef = def;
- if (loadDef.families.isEmpty() && loadDef.family.isEmpty())
- loadDef.family = desc.family->name;
+ if (loadDef.families.isEmpty())
+ loadDef.families = QStringList(desc.family->name);
engine = loadEngine(script, loadDef, desc.family, desc.foundry, desc.style, desc.size);
if (engine)
initFontDef(desc, loadDef, &engine->fontDef, multi);
@@ -2754,7 +2611,7 @@ QFontEngine *QFontDatabase::findFont(const QFontDef &request, int script)
return engine;
}
-void QFontDatabase::load(const QFontPrivate *d, int script)
+void QFontDatabasePrivate::load(const QFontPrivate *d, int script)
{
QFontDef req = d->request;
@@ -2773,8 +2630,6 @@ void QFontDatabase::load(const QFontPrivate *d, int script)
// look for the requested font in the engine data cache
// note: fallBackFamilies are not respected in the EngineData cache key;
// join them with the primary selection family to avoid cache misses
- if (!d->request.family.isEmpty())
- req.family = fallBackFamilies.join(QLatin1Char(','));
if (!d->request.families.isEmpty())
req.families = fallBackFamilies;
@@ -2793,7 +2648,7 @@ void QFontDatabase::load(const QFontPrivate *d, int script)
QFontEngine *fe = nullptr;
- Q_TRACE(QFontDatabase_load, req.family, req.pointSize);
+ Q_TRACE(QFontDatabase_load, req.families.join(QLatin1Char(';')), req.pointSize);
req.fallBackFamilies = fallBackFamilies;
if (!req.fallBackFamilies.isEmpty())
@@ -2807,9 +2662,12 @@ void QFontDatabase::load(const QFontPrivate *d, int script)
family_list << req.families.at(0);
// add the default family
- QString defaultFamily = QGuiApplication::font().family();
- if (! family_list.contains(defaultFamily))
- family_list << defaultFamily;
+ const auto families = QGuiApplication::font().families();
+ if (!families.isEmpty()) {
+ QString defaultFamily = families.first();
+ if (! family_list.contains(defaultFamily))
+ family_list << defaultFamily;
+ }
}
@@ -2820,7 +2678,7 @@ void QFontDatabase::load(const QFontPrivate *d, int script)
for (; !fe && it != end; ++it) {
req.families = QStringList(*it);
- fe = QFontDatabase::findFont(req, script);
+ fe = QFontDatabasePrivate::findFont(req, script);
if (fe) {
if (fe->type() == QFontEngine::Box && !req.families.at(0).isEmpty()) {
if (fe->ref.loadRelaxed() == 0)
@@ -2850,22 +2708,20 @@ void QFontDatabase::load(const QFontPrivate *d, int script)
}
}
-QString QFontDatabase::resolveFontFamilyAlias(const QString &family)
+QString QFontDatabasePrivate::resolveFontFamilyAlias(const QString &family)
{
return QGuiApplicationPrivate::platformIntegration()->fontDatabase()->resolveFontFamilyAlias(family);
}
Q_GUI_EXPORT QStringList qt_sort_families_by_writing_system(QChar::Script script, const QStringList &families)
{
- size_t writingSystem = std::find(scriptForWritingSystem,
- scriptForWritingSystem + QFontDatabase::WritingSystemsCount,
- script) - scriptForWritingSystem;
+ size_t writingSystem = qt_writing_system_for_script(script);
if (writingSystem == QFontDatabase::Any
|| writingSystem >= QFontDatabase::WritingSystemsCount) {
return families;
}
- QFontDatabasePrivate *db = privateDb();
+ auto *db = QFontDatabasePrivate::instance();
QMultiMap<uint, QString> supported;
for (int i = 0; i < families.size(); ++i) {
const QString &family = families.at(i);
@@ -2874,14 +2730,14 @@ Q_GUI_EXPORT QStringList qt_sort_families_by_writing_system(QChar::Script script
for (int x = 0; x < db->count; ++x) {
if (Q_UNLIKELY(matchFamilyName(family, db->families[x]))) {
testFamily = db->families[x];
- testFamily->ensurePopulated();
- break;
+ if (testFamily->ensurePopulated())
+ break;
}
}
uint order = i;
if (testFamily == nullptr
- || (testFamily->writingSystems[writingSystem] & QtFontFamily::Supported) == 0) {
+ || !familySupportsWritingSystem(testFamily, writingSystem)) {
order |= 1u << 31;
}
@@ -2893,3 +2749,5 @@ Q_GUI_EXPORT QStringList qt_sort_families_by_writing_system(QChar::Script script
QT_END_NAMESPACE
+#include "moc_qfontdatabase.cpp"
+
diff --git a/src/gui/text/qfontdatabase.h b/src/gui/text/qfontdatabase.h
index 63e6b48e4f..91a534265e 100644
--- a/src/gui/text/qfontdatabase.h
+++ b/src/gui/text/qfontdatabase.h
@@ -1,41 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the QtGui module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#ifndef QFONTDATABASE_H
#define QFONTDATABASE_H
@@ -48,18 +12,13 @@
QT_BEGIN_NAMESPACE
-class QStringList;
struct QFontDef;
class QFontEngine;
-class QFontDatabasePrivate;
-
class Q_GUI_EXPORT QFontDatabase
{
Q_GADGET
public:
- // do not re-order or delete entries from this enum without updating the
- // QPF2 format and makeqpf!!
enum WritingSystem {
Any,
@@ -114,31 +73,35 @@ public:
static QList<int> standardSizes();
- QFontDatabase();
+#if QT_DEPRECATED_SINCE(6, 0) && !defined(QT_BUILD_GUI_LIB)
+ QT_DEPRECATED_VERSION_X_6_0("Call the static functions instead") explicit QFontDatabase() = default;
+#else
+ QFontDatabase() = delete;
+#endif
- QList<WritingSystem> writingSystems() const;
- QList<WritingSystem> writingSystems(const QString &family) const;
+ static QList<WritingSystem> writingSystems();
+ static QList<WritingSystem> writingSystems(const QString &family);
- QStringList families(WritingSystem writingSystem = Any) const;
- QStringList styles(const QString &family) const;
- QList<int> pointSizes(const QString &family, const QString &style = QString());
- QList<int> smoothSizes(const QString &family, const QString &style);
- QString styleString(const QFont &font);
- QString styleString(const QFontInfo &fontInfo);
+ static QStringList families(WritingSystem writingSystem = Any);
+ static QStringList styles(const QString &family);
+ static QList<int> pointSizes(const QString &family, const QString &style = QString());
+ static QList<int> smoothSizes(const QString &family, const QString &style);
+ static QString styleString(const QFont &font);
+ static QString styleString(const QFontInfo &fontInfo);
- QFont font(const QString &family, const QString &style, int pointSize) const;
+ static QFont font(const QString &family, const QString &style, int pointSize);
- bool isBitmapScalable(const QString &family, const QString &style = QString()) const;
- bool isSmoothlyScalable(const QString &family, const QString &style = QString()) const;
- bool isScalable(const QString &family, const QString &style = QString()) const;
- bool isFixedPitch(const QString &family, const QString &style = QString()) const;
+ static bool isBitmapScalable(const QString &family, const QString &style = QString());
+ static bool isSmoothlyScalable(const QString &family, const QString &style = QString());
+ static bool isScalable(const QString &family, const QString &style = QString());
+ static bool isFixedPitch(const QString &family, const QString &style = QString());
- bool italic(const QString &family, const QString &style) const;
- bool bold(const QString &family, const QString &style) const;
- int weight(const QString &family, const QString &style) const;
+ static bool italic(const QString &family, const QString &style);
+ static bool bold(const QString &family, const QString &style);
+ static int weight(const QString &family, const QString &style);
- bool hasFamily(const QString &family) const;
- bool isPrivateFamily(const QString &family) const;
+ static bool hasFamily(const QString &family);
+ static bool isPrivateFamily(const QString &family);
static QString writingSystemName(WritingSystem writingSystem);
static QString writingSystemSample(WritingSystem writingSystem);
@@ -149,27 +112,12 @@ public:
static bool removeApplicationFont(int id);
static bool removeAllApplicationFonts();
-#if QT_DEPRECATED_SINCE(5, 2)
- QT_DEPRECATED static bool supportsThreadedFontRendering();
-#endif
+ static void addApplicationFallbackFontFamily(QChar::Script script, const QString &familyName);
+ static bool removeApplicationFallbackFontFamily(QChar::Script script, const QString &familyName);
+ static void setApplicationFallbackFontFamilies(QChar::Script, const QStringList &familyNames);
+ static QStringList applicationFallbackFontFamilies(QChar::Script script);
static QFont systemFont(SystemFont type);
-
-private:
- static void createDatabase();
- static void parseFontName(const QString &name, QString &foundry, QString &family);
- static QString resolveFontFamilyAlias(const QString &family);
- static QFontEngine *findFont(const QFontDef &request, int script /* QChar::Script */);
- static void load(const QFontPrivate *d, int script /* QChar::Script */);
-
- friend struct QFontDef;
- friend class QFontPrivate;
- friend class QFontDialog;
- friend class QFontDialogPrivate;
- friend class QFontEngineMulti;
- friend class QRawFont;
-
- QFontDatabasePrivate *d;
};
QT_END_NAMESPACE
diff --git a/src/gui/text/qfontdatabase_p.h b/src/gui/text/qfontdatabase_p.h
new file mode 100644
index 0000000000..38e1b4ad20
--- /dev/null
+++ b/src/gui/text/qfontdatabase_p.h
@@ -0,0 +1,270 @@
+// Copyright (C) 2020 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
+
+#ifndef QFONTDATABASE_P_H
+#define QFONTDATABASE_P_H
+
+//
+// W A R N I N G
+// -------------
+//
+// This file is not part of the Qt API. It exists for the convenience
+// of internal files. This header file may change from version to version
+// without notice, or even be removed.
+//
+// We mean it.
+//
+
+#include <QtCore/qcache.h>
+
+#include <QtGui/qfontdatabase.h>
+#include <QtCore/private/qglobal_p.h>
+
+QT_BEGIN_NAMESPACE
+
+struct QtFontDesc;
+
+struct QtFontFallbacksCacheKey
+{
+ QString family;
+ QFont::Style style;
+ QFont::StyleHint styleHint;
+ QChar::Script script;
+};
+
+inline bool operator==(const QtFontFallbacksCacheKey &lhs, const QtFontFallbacksCacheKey &rhs) noexcept
+{
+ return lhs.script == rhs.script &&
+ lhs.styleHint == rhs.styleHint &&
+ lhs.style == rhs.style &&
+ lhs.family == rhs.family;
+}
+
+inline bool operator!=(const QtFontFallbacksCacheKey &lhs, const QtFontFallbacksCacheKey &rhs) noexcept
+{
+ return !operator==(lhs, rhs);
+}
+
+inline size_t qHash(const QtFontFallbacksCacheKey &key, size_t seed = 0) noexcept
+{
+ QtPrivate::QHashCombine hash;
+ seed = hash(seed, key.family);
+ seed = hash(seed, int(key.style));
+ seed = hash(seed, int(key.styleHint));
+ seed = hash(seed, int(key.script));
+ return seed;
+}
+
+struct Q_GUI_EXPORT QtFontSize
+{
+ void *handle;
+ unsigned short pixelSize : 16;
+};
+
+struct Q_GUI_EXPORT QtFontStyle
+{
+ struct Key
+ {
+ Key(const QString &styleString);
+
+ Key()
+ : style(QFont::StyleNormal)
+ , weight(QFont::Normal)
+ , stretch(0)
+ {}
+
+ Key(const Key &o)
+ : style(o.style)
+ , weight(o.weight)
+ , stretch(o.stretch)
+ {}
+
+ uint style : 2;
+ uint weight : 10;
+ signed int stretch : 12;
+
+ bool operator==(const Key &other) const noexcept
+ {
+ return (style == other.style && weight == other.weight &&
+ (stretch == 0 || other.stretch == 0 || stretch == other.stretch));
+ }
+
+ bool operator!=(const Key &other) const noexcept
+ {
+ return !operator==(other);
+ }
+ };
+
+ QtFontStyle(const Key &k)
+ : key(k)
+ , bitmapScalable(false)
+ , smoothScalable(false)
+ , count(0)
+ , pixelSizes(nullptr)
+ {
+ }
+
+ ~QtFontStyle();
+
+ QtFontSize *pixelSize(unsigned short size, bool = false);
+
+ Key key;
+ bool bitmapScalable : 1;
+ bool smoothScalable : 1;
+ signed int count : 30;
+ QtFontSize *pixelSizes;
+ QString styleName;
+ bool antialiased;
+};
+
+struct Q_GUI_EXPORT QtFontFoundry
+{
+ QtFontFoundry(const QString &n)
+ : name(n)
+ , count(0)
+ , styles(nullptr)
+ {}
+
+ ~QtFontFoundry()
+ {
+ while (count--)
+ delete styles[count];
+ free(styles);
+ }
+
+ QString name;
+ int count;
+ QtFontStyle **styles;
+ QtFontStyle *style(const QtFontStyle::Key &, const QString & = QString(), bool = false);
+};
+
+struct Q_GUI_EXPORT QtFontFamily
+{
+ enum WritingSystemStatus {
+ Unknown = 0,
+ Supported = 1,
+ UnsupportedFT = 2,
+ Unsupported = UnsupportedFT
+ };
+
+ QtFontFamily(const QString &n)
+ :
+ populated(false),
+ fixedPitch(false),
+ name(n), count(0), foundries(nullptr)
+ {
+ memset(writingSystems, 0, sizeof(writingSystems));
+ }
+ ~QtFontFamily() {
+ while (count--)
+ delete foundries[count];
+ free(foundries);
+ }
+
+ bool populated : 1;
+ bool fixedPitch : 1;
+
+ QString name;
+ QStringList aliases;
+ int count;
+ QtFontFoundry **foundries;
+
+ unsigned char writingSystems[QFontDatabase::WritingSystemsCount];
+
+ bool matchesFamilyName(const QString &familyName) const;
+ QtFontFoundry *foundry(const QString &f, bool = false);
+
+ bool ensurePopulated();
+};
+
+class Q_GUI_EXPORT QFontDatabasePrivate
+{
+public:
+ QFontDatabasePrivate()
+ : count(0)
+ , families(nullptr)
+ , fallbacksCache(64)
+ { }
+
+ ~QFontDatabasePrivate() {
+ clearFamilies();
+ }
+
+ void clearFamilies();
+
+ enum FamilyRequestFlags {
+ RequestFamily = 0,
+ EnsureCreated,
+ EnsurePopulated
+ };
+
+ QtFontFamily *family(const QString &f, FamilyRequestFlags flags = EnsurePopulated);
+
+ int count;
+ QtFontFamily **families;
+ bool populated = false;
+
+ QHash<QChar::Script, QStringList> applicationFallbackFontFamilies;
+
+ QCache<QtFontFallbacksCacheKey, QStringList> fallbacksCache;
+ struct ApplicationFont {
+ QString fileName;
+
+ // Note: The data may be implicitly shared throughout the
+ // font database and platform font database, so be careful
+ // to never detach when accessing this member!
+ QByteArray data;
+
+ bool isNull() const { return fileName.isEmpty(); }
+ bool isPopulated() const { return !properties.isEmpty(); }
+
+ struct Properties {
+ QString familyName;
+ QString styleName;
+ int weight = 0;
+ QFont::Style style = QFont::StyleNormal;
+ int stretch = QFont::Unstretched;
+ };
+
+ QList<Properties> properties;
+ };
+ QList<ApplicationFont> applicationFonts;
+ int addAppFont(const QByteArray &fontData, const QString &fileName);
+ bool isApplicationFont(const QString &fileName);
+
+ static QFontDatabasePrivate *instance();
+
+ static void parseFontName(const QString &name, QString &foundry, QString &family);
+ static QString resolveFontFamilyAlias(const QString &family);
+ static QFontEngine *findFont(const QFontDef &request,
+ int script /* QChar::Script */,
+ bool preferScriptOverFamily = false);
+ static void load(const QFontPrivate *d, int script /* QChar::Script */);
+ static QFontDatabasePrivate *ensureFontDatabase();
+
+ void invalidate();
+
+private:
+ static int match(int script, const QFontDef &request, const QString &family_name,
+ const QString &foundry_name, QtFontDesc *desc, const QList<int> &blacklistedFamilies,
+ unsigned int *resultingScore = nullptr);
+
+ static unsigned int bestFoundry(int script, unsigned int score, int styleStrategy,
+ const QtFontFamily *family, const QString &foundry_name,
+ QtFontStyle::Key styleKey, int pixelSize, char pitch,
+ QtFontDesc *desc, const QString &styleName = QString());
+
+ static QFontEngine *loadSingleEngine(int script, const QFontDef &request,
+ QtFontFamily *family, QtFontFoundry *foundry,
+ QtFontStyle *style, QtFontSize *size);
+
+ static QFontEngine *loadEngine(int script, const QFontDef &request,
+ QtFontFamily *family, QtFontFoundry *foundry,
+ QtFontStyle *style, QtFontSize *size);
+
+};
+Q_DECLARE_TYPEINFO(QFontDatabasePrivate::ApplicationFont, Q_RELOCATABLE_TYPE);
+
+QT_END_NAMESPACE
+
+#endif // QFONTDATABASE_P_H
diff --git a/src/gui/text/qfontengine.cpp b/src/gui/text/qfontengine.cpp
index 3ca9e9bbde..4e78aaac2e 100644
--- a/src/gui/text/qfontengine.cpp
+++ b/src/gui/text/qfontengine.cpp
@@ -1,41 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2018 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the QtGui module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2021 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#include <qdebug.h>
#include <private/qfontengine_p.h>
@@ -49,15 +13,15 @@
#include "qpainter.h"
#include "qpainterpath.h"
#include "qvarlengtharray.h"
+#include "qtextengine_p.h"
#include <qmath.h>
#include <qendian.h>
#include <private/qstringiterator_p.h>
#if QT_CONFIG(harfbuzz)
# include "qharfbuzzng_p.h"
-# include <harfbuzz/hb-ot.h>
+# include <hb-ot.h>
#endif
-#include <private/qharfbuzz_p.h>
#include <algorithm>
#include <limits.h>
@@ -91,127 +55,17 @@ static inline bool qSafeFromBigEndian(const uchar *source, const uchar *end, T *
return true;
}
-// Harfbuzz helper functions
-
-#if QT_CONFIG(harfbuzz)
-Q_GLOBAL_STATIC_WITH_ARGS(bool, useHarfbuzzNG,(qgetenv("QT_HARFBUZZ") != "old"))
-
-bool qt_useHarfbuzzNG()
-{
- return *useHarfbuzzNG();
-}
-#endif
-
-Q_STATIC_ASSERT(sizeof(HB_Glyph) == sizeof(glyph_t));
-Q_STATIC_ASSERT(sizeof(HB_Fixed) == sizeof(QFixed));
-
-static HB_Bool hb_stringToGlyphs(HB_Font font, const HB_UChar16 *string, hb_uint32 length, HB_Glyph *glyphs, hb_uint32 *numGlyphs, HB_Bool rightToLeft)
-{
- QFontEngine *fe = (QFontEngine *)font->userData;
-
- const QChar *str = reinterpret_cast<const QChar *>(string);
-
- QGlyphLayout qglyphs;
- qglyphs.numGlyphs = *numGlyphs;
- qglyphs.glyphs = glyphs;
- int nGlyphs = *numGlyphs;
- bool result = fe->stringToCMap(str, length, &qglyphs, &nGlyphs, QFontEngine::GlyphIndicesOnly);
- *numGlyphs = nGlyphs;
-
- if (rightToLeft && result && !fe->symbol) {
- QStringIterator it(str, str + length);
- while (it.hasNext()) {
- const uint ucs4 = it.next();
- const uint mirrored = QChar::mirroredChar(ucs4);
- if (Q_UNLIKELY(mirrored != ucs4))
- *glyphs = fe->glyphIndex(mirrored);
- ++glyphs;
- }
- }
-
- return result;
-}
-
-static void hb_getAdvances(HB_Font font, const HB_Glyph *glyphs, hb_uint32 numGlyphs, HB_Fixed *advances, int flags)
-{
- QFontEngine *fe = (QFontEngine *)font->userData;
-
- QGlyphLayout qglyphs;
- qglyphs.numGlyphs = numGlyphs;
- qglyphs.glyphs = const_cast<glyph_t *>(glyphs);
- qglyphs.advances = reinterpret_cast<QFixed *>(advances);
-
- fe->recalcAdvances(&qglyphs, (flags & HB_ShaperFlag_UseDesignMetrics) ? QFontEngine::DesignMetrics : QFontEngine::ShaperFlags{});
-}
-
-static HB_Bool hb_canRender(HB_Font font, const HB_UChar16 *string, hb_uint32 length)
-{
- QFontEngine *fe = (QFontEngine *)font->userData;
- return fe->canRender(reinterpret_cast<const QChar *>(string), length);
-}
-
-static void hb_getGlyphMetrics(HB_Font font, HB_Glyph glyph, HB_GlyphMetrics *metrics)
-{
- QFontEngine *fe = (QFontEngine *)font->userData;
- glyph_metrics_t m = fe->boundingBox(glyph);
- metrics->x = m.x.value();
- metrics->y = m.y.value();
- metrics->width = m.width.value();
- metrics->height = m.height.value();
- metrics->xOffset = m.xoff.value();
- metrics->yOffset = m.yoff.value();
-}
-
-static HB_Fixed hb_getFontMetric(HB_Font font, HB_FontMetric metric)
-{
- if (metric == HB_FontAscent) {
- QFontEngine *fe = (QFontEngine *)font->userData;
- return fe->ascent().value();
- }
- return 0;
-}
-
int QFontEngine::getPointInOutline(glyph_t glyph, int flags, quint32 point, QFixed *xpos, QFixed *ypos, quint32 *nPoints)
{
- Q_UNUSED(glyph)
- Q_UNUSED(flags)
- Q_UNUSED(point)
- Q_UNUSED(xpos)
- Q_UNUSED(ypos)
- Q_UNUSED(nPoints)
+ Q_UNUSED(glyph);
+ Q_UNUSED(flags);
+ Q_UNUSED(point);
+ Q_UNUSED(xpos);
+ Q_UNUSED(ypos);
+ Q_UNUSED(nPoints);
return Err_Not_Covered;
}
-static HB_Error hb_getPointInOutline(HB_Font font, HB_Glyph glyph, int flags, hb_uint32 point, HB_Fixed *xpos, HB_Fixed *ypos, hb_uint32 *nPoints)
-{
- QFontEngine *fe = (QFontEngine *)font->userData;
- return (HB_Error)fe->getPointInOutline(glyph, flags, point, (QFixed *)xpos, (QFixed *)ypos, (quint32 *)nPoints);
-}
-
-static const HB_FontClass hb_fontClass = {
- hb_stringToGlyphs, hb_getAdvances, hb_canRender, hb_getPointInOutline,
- hb_getGlyphMetrics, hb_getFontMetric
-};
-
-static HB_Error hb_getSFntTable(void *font, HB_Tag tableTag, HB_Byte *buffer, HB_UInt *length)
-{
- QFontEngine::FaceData *data = (QFontEngine::FaceData *)font;
- Q_ASSERT(data);
-
- qt_get_font_table_func_t get_font_table = data->get_font_table;
- Q_ASSERT(get_font_table);
-
- if (!get_font_table(data->user_data, tableTag, buffer, length))
- return HB_Err_Invalid_Argument;
- return HB_Err_Ok;
-}
-
-static void hb_freeFace(void *face)
-{
- qHBFreeFace((HB_Face)face);
-}
-
-
static bool qt_get_font_table_default(void *user_data, uint tag, uchar *buffer, uint *length)
{
QFontEngine *fe = (QFontEngine *)user_data;
@@ -248,6 +102,7 @@ QFontEngine::QFontEngine(Type type)
: m_type(type), ref(0),
font_(),
face_(),
+ m_heightMetricsQueried(false),
m_minLeftBearing(kBearingNotInitialized),
m_minRightBearing(kBearingNotInitialized)
{
@@ -279,7 +134,7 @@ QFontEngine::~QFontEngine()
QFixed QFontEngine::lineThickness() const
{
// ad hoc algorithm
- int score = fontDef.weight * fontDef.pixelSize;
+ int score = fontDef.weight * fontDef.pixelSize / 10;
int lw = score / 700;
// looks better with thicker line for small pointsizes
@@ -298,57 +153,20 @@ void *QFontEngine::harfbuzzFont() const
{
Q_ASSERT(type() != QFontEngine::Multi);
#if QT_CONFIG(harfbuzz)
- if (qt_useHarfbuzzNG())
- return hb_qt_font_get_for_engine(const_cast<QFontEngine *>(this));
+ return hb_qt_font_get_for_engine(const_cast<QFontEngine *>(this));
+#else
+ return nullptr;
#endif
- if (!font_) {
- HB_Face hbFace = (HB_Face)harfbuzzFace();
- if (hbFace->font_for_init) {
- void *data = hbFace->font_for_init;
- q_check_ptr(qHBLoadFace(hbFace));
- free(data);
- }
-
- HB_FontRec *hbFont = (HB_FontRec *) malloc(sizeof(HB_FontRec));
- Q_CHECK_PTR(hbFont);
- hbFont->klass = &hb_fontClass;
- hbFont->userData = const_cast<QFontEngine *>(this);
-
- qint64 emSquare = emSquareSize().truncate();
- Q_ASSERT(emSquare == emSquareSize().toInt()); // ensure no truncation
- if (emSquare == 0)
- emSquare = 1000; // a fallback value suitable for Type1 fonts
- hbFont->y_ppem = fontDef.pixelSize;
- hbFont->x_ppem = fontDef.pixelSize * fontDef.stretch / 100;
- // same as QFixed(x)/QFixed(emSquare) but without int32 overflow for x
- hbFont->x_scale = (((qint64)hbFont->x_ppem << 6) * 0x10000L + (emSquare >> 1)) / emSquare;
- hbFont->y_scale = (((qint64)hbFont->y_ppem << 6) * 0x10000L + (emSquare >> 1)) / emSquare;
-
- font_ = Holder(hbFont, free);
- }
- return font_.get();
}
void *QFontEngine::harfbuzzFace() const
{
Q_ASSERT(type() != QFontEngine::Multi);
#if QT_CONFIG(harfbuzz)
- if (qt_useHarfbuzzNG())
- return hb_qt_face_get_for_engine(const_cast<QFontEngine *>(this));
+ return hb_qt_face_get_for_engine(const_cast<QFontEngine *>(this));
+#else
+ return nullptr;
#endif
- if (!face_) {
- QFontEngine::FaceData *data = (QFontEngine::FaceData *)malloc(sizeof(QFontEngine::FaceData));
- Q_CHECK_PTR(data);
- data->user_data = faceData.user_data;
- data->get_font_table = faceData.get_font_table;
-
- HB_Face hbFace = qHBNewFace(data, hb_getSFntTable);
- Q_CHECK_PTR(hbFace);
- hbFace->isSymbolFont = symbol;
-
- face_ = Holder(hbFace, hb_freeFace);
- }
- return face_.get();
}
bool QFontEngine::supportsScript(QChar::Script script) const
@@ -363,37 +181,26 @@ bool QFontEngine::supportsScript(QChar::Script script) const
return true;
#if QT_CONFIG(harfbuzz)
- if (qt_useHarfbuzzNG()) {
-#if defined(Q_OS_DARWIN)
- // in AAT fonts, 'gsub' table is effectively replaced by 'mort'/'morx' table
- uint len;
- if (getSfntTableData(MAKE_TAG('m','o','r','t'), 0, &len) || getSfntTableData(MAKE_TAG('m','o','r','x'), 0, &len))
- return true;
-#endif
+ // in AAT fonts, 'gsub' table is effectively replaced by 'mort'/'morx' table
+ uint lenMort = 0, lenMorx = 0;
+ if (getSfntTableData(QFont::Tag("mort").value(), nullptr, &lenMort)
+ || getSfntTableData(QFont::Tag("morx").value(), nullptr, &lenMorx)) {
+ return true;
+ }
- bool ret = false;
- if (hb_face_t *face = hb_qt_face_get_for_engine(const_cast<QFontEngine *>(this))) {
- hb_tag_t script_tag_1, script_tag_2;
- hb_ot_tags_from_script(hb_qt_script_to_script(script), &script_tag_1, &script_tag_2);
-
- unsigned int script_index;
- ret = hb_ot_layout_table_find_script(face, HB_OT_TAG_GSUB, script_tag_1, &script_index);
- if (!ret) {
- ret = hb_ot_layout_table_find_script(face, HB_OT_TAG_GSUB, script_tag_2, &script_index);
- if (!ret && script_tag_2 != HB_OT_TAG_DEFAULT_SCRIPT)
- ret = hb_ot_layout_table_find_script(face, HB_OT_TAG_GSUB, HB_OT_TAG_DEFAULT_SCRIPT, &script_index);
- }
- }
- return ret;
+ if (hb_face_t *face = hb_qt_face_get_for_engine(const_cast<QFontEngine *>(this))) {
+ unsigned int script_count = HB_OT_MAX_TAGS_PER_SCRIPT;
+ hb_tag_t script_tags[HB_OT_MAX_TAGS_PER_SCRIPT];
+
+ hb_ot_tags_from_script_and_language(hb_qt_script_to_script(script), HB_LANGUAGE_INVALID,
+ &script_count, script_tags,
+ nullptr, nullptr);
+
+ if (hb_ot_layout_table_select_script(face, HB_OT_TAG_GSUB, script_count, script_tags, nullptr, nullptr))
+ return true;
}
#endif
- HB_Face hbFace = (HB_Face)harfbuzzFace();
- if (hbFace->font_for_init) {
- void *data = hbFace->font_for_init;
- q_check_ptr(qHBLoadFace(hbFace));
- free(data);
- }
- return hbFace->supported_scripts[script_to_hbscript(script)];
+ return false;
}
bool QFontEngine::canRender(const QChar *str, int len) const
@@ -497,7 +304,7 @@ void QFontEngine::getGlyphPositions(const QGlyphLayout &glyphs, const QTransform
glyphs_out[current] = glyphs.glyphs[i];
++current;
if (glyphs.justifications[i].nKashidas) {
- QChar ch(0x640); // Kashida character
+ QChar ch = u'\x640'; // Kashida character
glyph_t kashidaGlyph = glyphIndex(ch.unicode());
QFixed kashidaWidth;
@@ -575,6 +382,114 @@ void QFontEngine::getGlyphBearings(glyph_t glyph, qreal *leftBearing, qreal *rig
*rightBearing = gi.rightBearing().toReal();
}
+bool QFontEngine::processHheaTable() const
+{
+ QByteArray hhea = getSfntTable(QFont::Tag("hhea").value());
+ if (hhea.size() >= 10) {
+ auto ptr = hhea.constData();
+ qint16 ascent = qFromBigEndian<qint16>(ptr + 4);
+ qint16 descent = qFromBigEndian<qint16>(ptr + 6);
+ qint16 leading = qFromBigEndian<qint16>(ptr + 8);
+
+ // Some fonts may have invalid HHEA data. We detect this and bail out.
+ if (ascent == 0 && descent == 0)
+ return false;
+
+ QFixed unitsPerEm = emSquareSize();
+ m_ascent = QFixed::fromReal(ascent * fontDef.pixelSize) / unitsPerEm;
+ m_descent = -QFixed::fromReal(descent * fontDef.pixelSize) / unitsPerEm;
+
+ m_leading = QFixed::fromReal(leading * fontDef.pixelSize) / unitsPerEm;
+
+ return true;
+ }
+
+ return false;
+}
+
+void QFontEngine::initializeHeightMetrics() const
+{
+ bool hasEmbeddedBitmaps =
+ !getSfntTable(QFont::Tag("EBLC").value()).isEmpty()
+ || !getSfntTable(QFont::Tag("CBLC").value()).isEmpty()
+ || !getSfntTable(QFont::Tag("bdat").value()).isEmpty();
+ if (!hasEmbeddedBitmaps) {
+ // Get HHEA table values if available
+ processHheaTable();
+
+ // Allow OS/2 metrics to override if present
+ processOS2Table();
+
+ if (!supportsSubPixelPositions()) {
+ m_ascent = m_ascent.round();
+ m_descent = m_descent.round();
+ m_leading = m_leading.round();
+ }
+ }
+
+ m_heightMetricsQueried = true;
+}
+
+bool QFontEngine::processOS2Table() const
+{
+ QByteArray os2 = getSfntTable(QFont::Tag("OS/2").value());
+ if (os2.size() >= 78) {
+ auto ptr = os2.constData();
+ quint16 fsSelection = qFromBigEndian<quint16>(ptr + 62);
+ qint16 typoAscent = qFromBigEndian<qint16>(ptr + 68);
+ qint16 typoDescent = qFromBigEndian<qint16>(ptr + 70);
+ qint16 typoLineGap = qFromBigEndian<qint16>(ptr + 72);
+ quint16 winAscent = qFromBigEndian<quint16>(ptr + 74);
+ quint16 winDescent = qFromBigEndian<quint16>(ptr + 76);
+
+ enum { USE_TYPO_METRICS = 0x80 };
+ QFixed unitsPerEm = emSquareSize();
+ if (fsSelection & USE_TYPO_METRICS) {
+ // Some fonts may have invalid OS/2 data. We detect this and bail out.
+ if (typoAscent == 0 && typoDescent == 0)
+ return false;
+ m_ascent = QFixed::fromReal(typoAscent * fontDef.pixelSize) / unitsPerEm;
+ m_descent = -QFixed::fromReal(typoDescent * fontDef.pixelSize) / unitsPerEm;
+ m_leading = QFixed::fromReal(typoLineGap * fontDef.pixelSize) / unitsPerEm;
+ } else {
+ // Some fonts may have invalid OS/2 data. We detect this and bail out.
+ if (winAscent == 0 && winDescent == 0)
+ return false;
+ m_ascent = QFixed::fromReal(winAscent * fontDef.pixelSize) / unitsPerEm;
+ m_descent = QFixed::fromReal(winDescent * fontDef.pixelSize) / unitsPerEm;
+ m_leading = QFixed{};
+ }
+
+ return true;
+ }
+
+ return false;
+}
+
+QFixed QFontEngine::leading() const
+{
+ if (!m_heightMetricsQueried)
+ initializeHeightMetrics();
+
+ return m_leading;
+}
+
+QFixed QFontEngine::ascent() const
+{
+ if (!m_heightMetricsQueried)
+ initializeHeightMetrics();
+
+ return m_ascent;
+}
+
+QFixed QFontEngine::descent() const
+{
+ if (!m_heightMetricsQueried)
+ initializeHeightMetrics();
+
+ return m_descent;
+}
+
qreal QFontEngine::minLeftBearing() const
{
if (m_minLeftBearing == kBearingNotInitialized)
@@ -593,7 +508,7 @@ qreal QFontEngine::minRightBearing() const
if (m_minRightBearing == kBearingNotInitialized) {
// Try the 'hhea' font table first, which covers the entire font
- QByteArray hheaTable = getSfntTable(MAKE_TAG('h', 'h', 'e', 'a'));
+ QByteArray hheaTable = getSfntTable(QFont::Tag("hhea").value());
if (hheaTable.size() >= int(kMinRightSideBearingOffset + sizeof(qint16))) {
const uchar *tableData = reinterpret_cast<const uchar *>(hheaTable.constData());
Q_ASSERT(q16Dot16ToFloat(qFromBigEndian<quint32>(tableData)) == 1.0);
@@ -650,12 +565,23 @@ qreal QFontEngine::minRightBearing() const
}
if (m_minLeftBearing == kBearingNotInitialized || m_minRightBearing == kBearingNotInitialized)
- qWarning() << "Failed to compute left/right minimum bearings for" << fontDef.family;
+ qWarning() << "Failed to compute left/right minimum bearings for"
+ << fontDef.families.first();
}
return m_minRightBearing;
}
+glyph_metrics_t QFontEngine::boundingBox(const QGlyphLayout &glyphs)
+{
+ QFixed w;
+ for (int i = 0; i < glyphs.numGlyphs; ++i)
+ w += glyphs.effectiveAdvance(i);
+ const QFixed leftBearing = firstLeftBearing(glyphs);
+ const QFixed rightBearing = lastRightBearing(glyphs);
+ return glyph_metrics_t(leftBearing, -(ascent()), w - leftBearing - rightBearing, ascent() + descent(), w, 0);
+}
+
glyph_metrics_t QFontEngine::tightBoundingBox(const QGlyphLayout &glyphs)
{
glyph_metrics_t overall;
@@ -663,14 +589,17 @@ glyph_metrics_t QFontEngine::tightBoundingBox(const QGlyphLayout &glyphs)
QFixed ymax = 0;
QFixed xmax = 0;
for (int i = 0; i < glyphs.numGlyphs; i++) {
+ // If shaping has found this should be ignored, ignore it.
+ if (!glyphs.advances[i] || glyphs.attributes[i].dontPrint)
+ continue;
glyph_metrics_t bb = boundingBox(glyphs.glyphs[i]);
QFixed x = overall.xoff + glyphs.offsets[i].x + bb.x;
QFixed y = overall.yoff + glyphs.offsets[i].y + bb.y;
overall.x = qMin(overall.x, x);
overall.y = qMin(overall.y, y);
- xmax = qMax(xmax, x + bb.width);
- ymax = qMax(ymax, y + bb.height);
- overall.xoff += bb.xoff;
+ xmax = qMax(xmax, x.ceil() + bb.width);
+ ymax = qMax(ymax, y.ceil() + bb.height);
+ overall.xoff += glyphs.effectiveAdvance(i);
overall.yoff += bb.yoff;
}
overall.height = qMax(overall.height, ymax - overall.y);
@@ -754,10 +683,10 @@ Q_GUI_EXPORT void qt_addBitmapToPath(qreal x0, qreal y0, const uchar *image_data
// set up edges
for (int y = 0; y <= h; ++y) {
for (int x = 0; x <= w; ++x) {
- bool topLeft = (x == 0)|(y == 0) ? false : SET(x - 1, y - 1);
- bool topRight = (x == w)|(y == 0) ? false : SET(x, y - 1);
- bool bottomLeft = (x == 0)|(y == h) ? false : SET(x - 1, y);
- bool bottomRight = (x == w)|(y == h) ? false : SET(x, y);
+ bool topLeft = (x == 0 || y == 0) ? false : SET(x - 1, y - 1);
+ bool topRight = (x == w || y == 0) ? false : SET(x, y - 1);
+ bool bottomLeft = (x == 0 || y == h) ? false : SET(x - 1, y);
+ bool bottomRight = (x == w || y == h) ? false : SET(x, y);
GRID(x, y) = 0;
if ((!topRight) & bottomRight)
@@ -804,14 +733,14 @@ void QFontEngine::addBitmapFontToPath(qreal x, qreal y, const QGlyphLayout &glyp
const int w = alphaMask.width();
const int h = alphaMask.height();
- const int srcBpl = alphaMask.bytesPerLine();
+ const qsizetype srcBpl = alphaMask.bytesPerLine();
QImage bitmap;
if (alphaMask.depth() == 1) {
bitmap = alphaMask;
} else {
bitmap = QImage(w, h, QImage::Format_Mono);
const uchar *imageData = alphaMask.bits();
- const int destBpl = bitmap.bytesPerLine();
+ const qsizetype destBpl = bitmap.bytesPerLine();
uchar *bitmapData = bitmap.bits();
for (int yi = 0; yi < h; ++yi) {
@@ -853,7 +782,7 @@ void QFontEngine::addGlyphsToPath(glyph_t *glyphs, QFixedPoint *positions, int n
addBitmapFontToPath(x, y, g, path, flags);
}
-QImage QFontEngine::alphaMapForGlyph(glyph_t glyph, QFixed /*subPixelPosition*/)
+QImage QFontEngine::alphaMapForGlyph(glyph_t glyph, const QFixedPoint &/*subPixelPosition*/)
{
// For font engines don't support subpixel positioning
return alphaMapForGlyph(glyph);
@@ -869,9 +798,9 @@ QImage QFontEngine::alphaMapForGlyph(glyph_t glyph, const QTransform &t)
return i;
}
-QImage QFontEngine::alphaMapForGlyph(glyph_t glyph, QFixed subPixelPosition, const QTransform &t)
+QImage QFontEngine::alphaMapForGlyph(glyph_t glyph, const QFixedPoint &subPixelPosition, const QTransform &t)
{
- if (! supportsSubPixelPositions())
+ if (!supportsHorizontalSubPixelPositions() && !supportsVerticalSubPixelPositions())
return alphaMapForGlyph(glyph, t);
QImage i = alphaMapForGlyph(glyph, subPixelPosition);
@@ -882,7 +811,7 @@ QImage QFontEngine::alphaMapForGlyph(glyph_t glyph, QFixed subPixelPosition, con
return i;
}
-QImage QFontEngine::alphaRGBMapForGlyph(glyph_t glyph, QFixed /*subPixelPosition*/, const QTransform &t)
+QImage QFontEngine::alphaRGBMapForGlyph(glyph_t glyph, const QFixedPoint &/*subPixelPosition*/, const QTransform &t)
{
const QImage alphaMask = alphaMapForGlyph(glyph, t);
QImage rgbMask(alphaMask.width(), alphaMask.height(), QImage::Format_RGB32);
@@ -899,32 +828,37 @@ QImage QFontEngine::alphaRGBMapForGlyph(glyph_t glyph, QFixed /*subPixelPosition
return rgbMask;
}
-QImage QFontEngine::bitmapForGlyph(glyph_t, QFixed subPixelPosition, const QTransform&, const QColor &)
+QImage QFontEngine::bitmapForGlyph(glyph_t, const QFixedPoint &subPixelPosition, const QTransform&, const QColor &)
{
Q_UNUSED(subPixelPosition);
return QImage();
}
-QFixed QFontEngine::subPixelPositionForX(QFixed x) const
+QFixedPoint QFontEngine::subPixelPositionFor(const QFixedPoint &position) const
{
- if (m_subPixelPositionCount <= 1 || !supportsSubPixelPositions())
- return QFixed();
+ if (m_subPixelPositionCount <= 1
+ || (!supportsHorizontalSubPixelPositions()
+ && !supportsVerticalSubPixelPositions())) {
+ return QFixedPoint();
+ }
- QFixed subPixelPosition;
- if (x != 0) {
- subPixelPosition = x - x.floor();
- QFixed fraction = (subPixelPosition / QFixed::fromReal(1.0 / m_subPixelPositionCount)).floor();
+ auto f = [&](QFixed v) {
+ if (v != 0) {
+ v = v - v.floor() + QFixed::fromFixed(1);
+ QFixed fraction = (v * m_subPixelPositionCount).floor();
+ v = fraction / QFixed(m_subPixelPositionCount);
+ }
+ return v;
+ };
- // Compensate for precision loss in fixed point to make sure we are always drawing at a subpixel position over
- // the lower boundary for the selected rasterization by adding 1/64.
- subPixelPosition = fraction / QFixed(m_subPixelPositionCount) + QFixed::fromReal(0.015625);
- }
- return subPixelPosition;
+ return QFixedPoint(f(position.x), f(position.y));
}
-QFontEngine::Glyph *QFontEngine::glyphData(glyph_t, QFixed,
- QFontEngine::GlyphFormat, const QTransform &)
+QFontEngine::Glyph *QFontEngine::glyphData(glyph_t,
+ const QFixedPoint &,
+ QFontEngine::GlyphFormat,
+ const QTransform &)
{
return nullptr;
}
@@ -973,12 +907,9 @@ void QFontEngine::removeGlyphFromCache(glyph_t)
QFontEngine::Properties QFontEngine::properties() const
{
Properties p;
- p.postscriptName
- = QFontEngine::convertToPostscriptFontFamilyName(fontDef.family.toUtf8())
- + '-'
- + QByteArray::number(fontDef.style)
- + '-'
- + QByteArray::number(fontDef.weight);
+ p.postscriptName =
+ QFontEngine::convertToPostscriptFontFamilyName(fontDef.families.first().toUtf8()) + '-'
+ + QByteArray::number(fontDef.style) + '-' + QByteArray::number(fontDef.weight);
p.ascent = ascent();
p.descent = descent();
p.leading = leading();
@@ -1012,9 +943,9 @@ void QFontEngine::getUnscaledGlyph(glyph_t glyph, QPainterPath *path, glyph_metr
*/
bool QFontEngine::getSfntTableData(uint tag, uchar *buffer, uint *length) const
{
- Q_UNUSED(tag)
- Q_UNUSED(buffer)
- Q_UNUSED(length)
+ Q_UNUSED(tag);
+ Q_UNUSED(buffer);
+ Q_UNUSED(length);
return false;
}
@@ -1085,7 +1016,7 @@ static inline QFixed kerning(int left, int right, const QFontEngine::KernPair *p
while (left <= right) {
int middle = left + ( ( right - left ) >> 1 );
- if(pairs[middle].left_right == left_right)
+ if (pairs[middle].left_right == left_right)
return pairs[middle].adjust;
if (pairs[middle].left_right < left_right)
@@ -1099,7 +1030,7 @@ static inline QFixed kerning(int left, int right, const QFontEngine::KernPair *p
void QFontEngine::doKerning(QGlyphLayout *glyphs, QFontEngine::ShaperFlags flags) const
{
int numPairs = kerning_pairs.size();
- if(!numPairs)
+ if (!numPairs)
return;
const KernPair *pairs = kerning_pairs.constData();
@@ -1117,7 +1048,7 @@ void QFontEngine::loadKerningPairs(QFixed scalingFactor)
{
kerning_pairs.clear();
- QByteArray tab = getSfntTable(MAKE_TAG('k', 'e', 'r', 'n'));
+ QByteArray tab = getSfntTable(QFont::Tag("kern").value());
if (tab.isEmpty())
return;
@@ -1155,7 +1086,7 @@ void QFontEngine::loadKerningPairs(QFixed scalingFactor)
goto end;
// qDebug("subtable: version=%d, coverage=%x",version, coverage);
- if(version == 0 && coverage == 0x0001) {
+ if (version == 0 && coverage == 0x0001) {
if (offset + length > tab.size()) {
// qDebug("length ouf ot bounds");
goto end;
@@ -1166,7 +1097,7 @@ void QFontEngine::loadKerningPairs(QFixed scalingFactor)
if (!qSafeFromBigEndian(data, end, &nPairs))
goto end;
- if(nPairs * 6 + 8 > length - 6) {
+ if (nPairs * 6 + 8 > length - 6) {
// qDebug("corrupt table!");
// corrupt table
goto end;
@@ -1206,7 +1137,7 @@ end:
int QFontEngine::glyphCount() const
{
- QByteArray maxpTable = getSfntTable(MAKE_TAG('m', 'a', 'x', 'p'));
+ QByteArray maxpTable = getSfntTable(QFont::Tag("maxp").value());
if (maxpTable.size() < 6)
return 0;
@@ -1253,7 +1184,7 @@ const uchar *QFontEngine::getCMap(const uchar *table, uint tableSize, bool *isSy
int tableToUse = -1;
int score = Invalid;
for (int n = 0; n < numTables; ++n) {
- quint16 platformId;
+ quint16 platformId = 0;
if (!qSafeFromBigEndian(maps + 8 * n, endPtr, &platformId))
return nullptr;
@@ -1304,11 +1235,12 @@ const uchar *QFontEngine::getCMap(const uchar *table, uint tableSize, bool *isSy
default:
break;
}
+ break;
default:
break;
}
}
- if(tableToUse < 0)
+ if (tableToUse < 0)
return nullptr;
resolveTable:
@@ -1383,7 +1315,7 @@ resolveTable:
quint32 QFontEngine::getTrueTypeGlyphIndex(const uchar *cmap, int cmapSize, uint unicode)
{
const uchar *end = cmap + cmapSize;
- quint16 format;
+ quint16 format = 0;
if (!qSafeFromBigEndian(cmap, end, &format))
return 0;
@@ -1397,10 +1329,10 @@ quint32 QFontEngine::getTrueTypeGlyphIndex(const uchar *cmap, int cmapSize, uint
Since 0xffff is never a valid Unicode char anyway, we just get rid of the issue
by returning 0 for 0xffff
*/
- if(unicode >= 0xffff)
+ if (unicode >= 0xffff)
return 0;
- quint16 segCountX2;
+ quint16 segCountX2 = 0;
if (!qSafeFromBigEndian(cmap + 6, end, &segCountX2))
return 0;
@@ -1408,7 +1340,7 @@ quint32 QFontEngine::getTrueTypeGlyphIndex(const uchar *cmap, int cmapSize, uint
int i = 0;
for (; i < segCountX2/2; ++i) {
- quint16 codePoint;
+ quint16 codePoint = 0;
if (!qSafeFromBigEndian(ends + 2 * i, end, &codePoint))
return 0;
if (codePoint >= unicode)
@@ -1417,7 +1349,7 @@ quint32 QFontEngine::getTrueTypeGlyphIndex(const uchar *cmap, int cmapSize, uint
const unsigned char *idx = ends + segCountX2 + 2 + 2*i;
- quint16 startIndex;
+ quint16 startIndex = 0;
if (!qSafeFromBigEndian(idx, end, &startIndex))
return 0;
if (startIndex > unicode)
@@ -1425,20 +1357,20 @@ quint32 QFontEngine::getTrueTypeGlyphIndex(const uchar *cmap, int cmapSize, uint
idx += segCountX2;
- quint16 tmp;
+ quint16 tmp = 0;
if (!qSafeFromBigEndian(idx, end, &tmp))
return 0;
qint16 idDelta = qint16(tmp);
idx += segCountX2;
- quint16 idRangeoffset_t;
+ quint16 idRangeoffset_t = 0;
if (!qSafeFromBigEndian(idx, end, &idRangeoffset_t))
return 0;
- quint16 glyphIndex;
+ quint16 glyphIndex = 0;
if (idRangeoffset_t) {
- quint16 id;
+ quint16 id = 0;
if (!qSafeFromBigEndian(idRangeoffset_t + 2 * (unicode - startIndex) + idx, end, &id))
return 0;
@@ -1451,17 +1383,17 @@ quint32 QFontEngine::getTrueTypeGlyphIndex(const uchar *cmap, int cmapSize, uint
}
return glyphIndex;
} else if (format == 6) {
- quint16 tableSize;
+ quint16 tableSize = 0;
if (!qSafeFromBigEndian(cmap + 2, end, &tableSize))
return 0;
- quint16 firstCode6;
+ quint16 firstCode6 = 0;
if (!qSafeFromBigEndian(cmap + 6, end, &firstCode6))
return 0;
if (unicode < firstCode6)
return 0;
- quint16 entryCount6;
+ quint16 entryCount6 = 0;
if (!qSafeFromBigEndian(cmap + 8, end, &entryCount6))
return 0;
if (entryCount6 * 2 + 10 > tableSize)
@@ -1477,7 +1409,7 @@ quint32 QFontEngine::getTrueTypeGlyphIndex(const uchar *cmap, int cmapSize, uint
qSafeFromBigEndian(cmap + 10 + (entryIndex6 * 2), end, &index);
return index;
} else if (format == 12) {
- quint32 nGroups;
+ quint32 nGroups = 0;
if (!qSafeFromBigEndian(cmap + 12, end, &nGroups))
return 0;
@@ -1487,19 +1419,19 @@ quint32 QFontEngine::getTrueTypeGlyphIndex(const uchar *cmap, int cmapSize, uint
while (left <= right) {
int middle = left + ( ( right - left ) >> 1 );
- quint32 startCharCode;
+ quint32 startCharCode = 0;
if (!qSafeFromBigEndian(cmap + 12 * middle, end, &startCharCode))
return 0;
- if(unicode < startCharCode)
+ if (unicode < startCharCode)
right = middle - 1;
else {
- quint32 endCharCode;
+ quint32 endCharCode = 0;
if (!qSafeFromBigEndian(cmap + 12 * middle + 4, end, &endCharCode))
return 0;
if (unicode <= endCharCode) {
- quint32 index;
+ quint32 index = 0;
if (!qSafeFromBigEndian(cmap + 12 * middle + 8, end, &index))
return 0;
@@ -1541,13 +1473,24 @@ bool QFontEngine::hasUnreliableGlyphOutline() const
return glyphFormat == QFontEngine::Format_ARGB;
}
-QFixed QFontEngine::lastRightBearing(const QGlyphLayout &glyphs, bool round)
+QFixed QFontEngine::firstLeftBearing(const QGlyphLayout &glyphs)
+{
+ for (int i = 0; i < glyphs.numGlyphs; ++i) {
+ glyph_t glyph = glyphs.glyphs[i];
+ glyph_metrics_t gi = boundingBox(glyph);
+ if (gi.isValid() && gi.width > 0)
+ return gi.leftBearing();
+ }
+ return 0;
+}
+
+QFixed QFontEngine::lastRightBearing(const QGlyphLayout &glyphs)
{
if (glyphs.numGlyphs >= 1) {
glyph_t glyph = glyphs.glyphs[glyphs.numGlyphs - 1];
glyph_metrics_t gi = boundingBox(glyph);
if (gi.isValid())
- return round ? qRound(gi.rightBearing()) : gi.rightBearing();
+ return gi.rightBearing();
}
return 0;
}
@@ -1596,23 +1539,23 @@ QFontEngineBox::~QFontEngineBox()
glyph_t QFontEngineBox::glyphIndex(uint ucs4) const
{
- Q_UNUSED(ucs4)
- return 0;
+ Q_UNUSED(ucs4);
+ return 1;
}
-bool QFontEngineBox::stringToCMap(const QChar *str, int len, QGlyphLayout *glyphs, int *nglyphs, QFontEngine::ShaperFlags flags) const
+int QFontEngineBox::stringToCMap(const QChar *str, int len, QGlyphLayout *glyphs, int *nglyphs, QFontEngine::ShaperFlags flags) const
{
Q_ASSERT(glyphs->numGlyphs >= *nglyphs);
if (*nglyphs < len) {
*nglyphs = len;
- return false;
+ return -1;
}
int ucs4Length = 0;
QStringIterator it(str, str + len);
while (it.hasNext()) {
it.advance();
- glyphs->glyphs[ucs4Length++] = 0;
+ glyphs->glyphs[ucs4Length++] = 1;
}
*nglyphs = ucs4Length;
@@ -1621,7 +1564,7 @@ bool QFontEngineBox::stringToCMap(const QChar *str, int len, QGlyphLayout *glyph
if (!(flags & GlyphIndicesOnly))
recalcAdvances(glyphs, flags);
- return true;
+ return *nglyphs;
}
void QFontEngineBox::recalcAdvances(QGlyphLayout *glyphs, QFontEngine::ShaperFlags) const
@@ -1728,12 +1671,12 @@ QImage QFontEngineBox::alphaMapForGlyph(glyph_t)
QImage image(_size, _size, QImage::Format_Alpha8);
image.fill(0);
- // FIXME: use qpainter
+ uchar *bits = image.bits();
for (int i=2; i <= _size-3; ++i) {
- image.setPixel(i, 2, 255);
- image.setPixel(i, _size-3, 255);
- image.setPixel(2, i, 255);
- image.setPixel(_size-3, i, 255);
+ bits[i + 2 * image.bytesPerLine()] = 255;
+ bits[i + (_size - 3) * image.bytesPerLine()] = 255;
+ bits[2 + i * image.bytesPerLine()] = 255;
+ bits[_size - 3 + i * image.bytesPerLine()] = 255;
}
return image;
}
@@ -1788,7 +1731,9 @@ void QFontEngineMulti::ensureFallbackFamiliesQueried()
if (styleHint == QFont::AnyStyle && fontDef.fixedPitch)
styleHint = QFont::TypeWriter;
- setFallbackFamiliesList(qt_fallbacksForFamily(fontDef.family, QFont::Style(fontDef.style), styleHint, QChar::Script(m_script)));
+ setFallbackFamiliesList(qt_fallbacksForFamily(fontDef.families.constFirst(),
+ QFont::Style(fontDef.style), styleHint,
+ QChar::Script(m_script)));
}
void QFontEngineMulti::setFallbackFamiliesList(const QStringList &fallbackFamilies)
@@ -1802,7 +1747,7 @@ void QFontEngineMulti::setFallbackFamiliesList(const QStringList &fallbackFamili
QFontEngine *engine = m_engines.at(0);
engine->ref.ref();
m_engines[1] = engine;
- m_fallbackFamilies << fontDef.family;
+ m_fallbackFamilies << fontDef.families.constFirst();
} else {
m_engines.resize(m_fallbackFamilies.size() + 1);
}
@@ -1812,7 +1757,7 @@ void QFontEngineMulti::setFallbackFamiliesList(const QStringList &fallbackFamili
void QFontEngineMulti::ensureEngineAt(int at)
{
- if (!m_fallbackFamiliesQueried)
+ if (!m_fallbackFamiliesQueried && at > 0)
ensureFallbackFamiliesQueried();
Q_ASSERT(at < m_engines.size());
if (!m_engines.at(at)) {
@@ -1829,15 +1774,14 @@ QFontEngine *QFontEngineMulti::loadEngine(int at)
{
QFontDef request(fontDef);
request.styleStrategy |= QFont::NoFontMerging;
- request.family = fallbackFamilyAt(at - 1);
- request.families = QStringList(request.family);
+ request.families = QStringList(fallbackFamilyAt(at - 1));
// At this point, the main script of the text has already been considered
// when fetching the list of fallback families from the database, and the
// info about the actual script of the characters may have been discarded,
// so we do not check for writing system support, but instead just load
// the family indiscriminately.
- if (QFontEngine *engine = QFontDatabase::findFont(request, QChar::Script_Common)) {
+ if (QFontEngine *engine = QFontDatabasePrivate::findFont(request, QChar::Script_Common)) {
engine->fontDef.weight = request.weight;
if (request.style > QFont::StyleNormal)
engine->fontDef.style = request.style;
@@ -1850,11 +1794,7 @@ QFontEngine *QFontEngineMulti::loadEngine(int at)
glyph_t QFontEngineMulti::glyphIndex(uint ucs4) const
{
glyph_t glyph = engine(0)->glyphIndex(ucs4);
- if (glyph == 0
- && ucs4 != QChar::LineSeparator
- && ucs4 != QChar::LineFeed
- && ucs4 != QChar::CarriageReturn
- && ucs4 != QChar::ParagraphSeparator) {
+ if (glyph == 0 && !isIgnorableChar(ucs4)) {
if (!m_fallbackFamiliesQueried)
const_cast<QFontEngineMulti *>(this)->ensureFallbackFamiliesQueried();
for (int x = 1, n = qMin(m_engines.size(), 256); x < n; ++x) {
@@ -1881,24 +1821,67 @@ glyph_t QFontEngineMulti::glyphIndex(uint ucs4) const
return glyph;
}
-bool QFontEngineMulti::stringToCMap(const QChar *str, int len,
- QGlyphLayout *glyphs, int *nglyphs,
- QFontEngine::ShaperFlags flags) const
+int QFontEngineMulti::stringToCMap(const QChar *str, int len,
+ QGlyphLayout *glyphs, int *nglyphs,
+ QFontEngine::ShaperFlags flags) const
{
- if (!engine(0)->stringToCMap(str, len, glyphs, nglyphs, flags))
- return false;
+ const int originalNumGlyphs = glyphs->numGlyphs;
+ int mappedGlyphCount = engine(0)->stringToCMap(str, len, glyphs, nglyphs, flags);
+ if (mappedGlyphCount < 0)
+ return -1;
+ // If ContextFontMerging is set and the match for the string was incomplete, we try all
+ // fallbacks on the full string until we find the best match.
+ bool contextFontMerging = mappedGlyphCount < *nglyphs && (fontDef.styleStrategy & QFont::ContextFontMerging);
+ if (contextFontMerging) {
+ QVarLengthGlyphLayoutArray tempLayout(len);
+ if (!m_fallbackFamiliesQueried)
+ const_cast<QFontEngineMulti *>(this)->ensureFallbackFamiliesQueried();
+
+ int maxGlyphCount = 0;
+ uchar engineIndex = 0;
+ for (int x = 1, n = qMin(m_engines.size(), 256); x < n; ++x) {
+ int numGlyphs = len;
+ const_cast<QFontEngineMulti *>(this)->ensureEngineAt(x);
+ maxGlyphCount = engine(x)->stringToCMap(str, len, &tempLayout, &numGlyphs, flags);
+
+ // If we found a better match, we copy data into the main QGlyphLayout
+ if (maxGlyphCount > mappedGlyphCount) {
+ *nglyphs = numGlyphs;
+ glyphs->numGlyphs = originalNumGlyphs;
+ glyphs->copy(&tempLayout);
+ engineIndex = x;
+ if (maxGlyphCount == numGlyphs)
+ break;
+ }
+ }
+
+ if (engineIndex > 0) {
+ for (int y = 0; y < glyphs->numGlyphs; ++y) {
+ if (glyphs->glyphs[y] != 0)
+ glyphs->glyphs[y] |= (engineIndex << 24);
+ }
+ } else {
+ contextFontMerging = false;
+ }
+
+ mappedGlyphCount = maxGlyphCount;
+ }
+
+ // Fill in missing glyphs by going through string one character at the time and finding
+ // the first viable fallback.
int glyph_pos = 0;
QStringIterator it(str, str + len);
int lastFallback = -1;
+ char32_t previousUcs4 = 0;
while (it.hasNext()) {
- const uint ucs4 = it.peekNext();
+ const char32_t ucs4 = it.peekNext();
// If we applied a fallback font to previous glyph, and the current is either
// ZWJ or ZWNJ, we should also try applying the same fallback font to that, in order
// to get the correct shaping rules applied.
- if (lastFallback >= 0 && (ucs4 == QChar(0x200d) || ucs4 == QChar(0x200c))) {
+ if (lastFallback >= 0 && (ucs4 == 0x200d || ucs4 == 0x200c)) {
QFontEngine *engine = m_engines.at(lastFallback);
glyph_t glyph = engine->glyphIndex(ucs4);
if (glyph != 0) {
@@ -1917,14 +1900,10 @@ bool QFontEngineMulti::stringToCMap(const QChar *str, int len,
lastFallback = -1;
}
- if (glyphs->glyphs[glyph_pos] == 0
- && ucs4 != QChar::LineSeparator
- && ucs4 != QChar::LineFeed
- && ucs4 != QChar::CarriageReturn
- && ucs4 != QChar::ParagraphSeparator) {
+ if (glyphs->glyphs[glyph_pos] == 0 && !isIgnorableChar(ucs4)) {
if (!m_fallbackFamiliesQueried)
const_cast<QFontEngineMulti *>(this)->ensureFallbackFamiliesQueried();
- for (int x = 1, n = qMin(m_engines.size(), 256); x < n; ++x) {
+ for (int x = contextFontMerging ? 0 : 1, n = qMin(m_engines.size(), 256); x < n; ++x) {
QFontEngine *engine = m_engines.at(x);
if (!engine) {
if (!shouldLoadFontEngineForCharacter(x, ucs4))
@@ -1953,16 +1932,55 @@ bool QFontEngineMulti::stringToCMap(const QChar *str, int len,
break;
}
}
+
+ // For variant-selectors, they are modifiers to the previous character. If we
+ // end up with different font selections for the selector and the character it
+ // modifies, we try applying the selector font to the preceding character as well
+ const int variantSelectorBlock = 0xFE00;
+ if ((ucs4 & 0xFFF0) == variantSelectorBlock && glyph_pos > 0) {
+ int selectorFontEngine = glyphs->glyphs[glyph_pos] >> 24;
+ int precedingCharacterFontEngine = glyphs->glyphs[glyph_pos - 1] >> 24;
+
+ if (selectorFontEngine != precedingCharacterFontEngine) {
+ // Emoji variant selectors are specially handled and should affect font
+ // selection. If VS-16 is used, then this means we want to select a color
+ // font. If the selected font is already a color font, we do not need search
+ // again. If the VS-15 is used, then this means we want to select a non-color
+ // font. If the selected font is not a color font, we don't do anything.
+ const QFontEngine *selectedEngine = m_engines.at(precedingCharacterFontEngine);
+ const bool colorFont = selectedEngine->isColorFont();
+ const char32_t vs15 = 0xFE0E;
+ const char32_t vs16 = 0xFE0F;
+ bool adaptVariantSelector = ucs4 < vs15
+ || (ucs4 == vs15 && colorFont)
+ || (ucs4 == vs16 && !colorFont);
+
+ if (adaptVariantSelector) {
+ QFontEngine *engine = m_engines.at(selectorFontEngine);
+ glyph_t glyph = engine->glyphIndex(previousUcs4);
+ if (glyph != 0) {
+ glyphs->glyphs[glyph_pos - 1] = glyph;
+ if (!(flags & GlyphIndicesOnly)) {
+ QGlyphLayout g = glyphs->mid(glyph_pos - 1, 1);
+ engine->recalcAdvances(&g, flags);
+ }
+
+ // set the high byte to indicate which engine the glyph came from
+ glyphs->glyphs[glyph_pos - 1] |= (selectorFontEngine << 24);
+ }
+ }
+ }
+ }
}
it.advance();
++glyph_pos;
+ previousUcs4 = ucs4;
}
*nglyphs = glyph_pos;
glyphs->numGlyphs = glyph_pos;
-
- return true;
+ return mappedGlyphCount;
}
bool QFontEngineMulti::shouldLoadFontEngineForCharacter(int at, uint ucs4) const
@@ -2254,7 +2272,7 @@ bool QFontEngineMulti::canRender(const QChar *string, int len) const
QGlyphLayout g;
g.numGlyphs = nglyphs;
g.glyphs = glyphs.data();
- if (!stringToCMap(string, len, &g, &nglyphs, GlyphIndicesOnly))
+ if (stringToCMap(string, len, &g, &nglyphs, GlyphIndicesOnly) < 0)
Q_UNREACHABLE();
for (int i = 0; i < nglyphs; i++) {
@@ -2265,7 +2283,7 @@ bool QFontEngineMulti::canRender(const QChar *string, int len) const
return true;
}
-/* Implement alphaMapForGlyph() which is called by Lighthouse/Windows code.
+/* Implement alphaMapForGlyph() which is called by QPA Windows code.
* Ideally, that code should be fixed to correctly handle QFontEngineMulti. */
QImage QFontEngineMulti::alphaMapForGlyph(glyph_t glyph)
@@ -2274,7 +2292,7 @@ QImage QFontEngineMulti::alphaMapForGlyph(glyph_t glyph)
return engine(which)->alphaMapForGlyph(stripped(glyph));
}
-QImage QFontEngineMulti::alphaMapForGlyph(glyph_t glyph, QFixed subPixelPosition)
+QImage QFontEngineMulti::alphaMapForGlyph(glyph_t glyph, const QFixedPoint &subPixelPosition)
{
const int which = highByte(glyph);
return engine(which)->alphaMapForGlyph(stripped(glyph), subPixelPosition);
@@ -2286,13 +2304,17 @@ QImage QFontEngineMulti::alphaMapForGlyph(glyph_t glyph, const QTransform &t)
return engine(which)->alphaMapForGlyph(stripped(glyph), t);
}
-QImage QFontEngineMulti::alphaMapForGlyph(glyph_t glyph, QFixed subPixelPosition, const QTransform &t)
+QImage QFontEngineMulti::alphaMapForGlyph(glyph_t glyph,
+ const QFixedPoint &subPixelPosition,
+ const QTransform &t)
{
const int which = highByte(glyph);
return engine(which)->alphaMapForGlyph(stripped(glyph), subPixelPosition, t);
}
-QImage QFontEngineMulti::alphaRGBMapForGlyph(glyph_t glyph, QFixed subPixelPosition, const QTransform &t)
+QImage QFontEngineMulti::alphaRGBMapForGlyph(glyph_t glyph,
+ const QFixedPoint &subPixelPosition,
+ const QTransform &t)
{
const int which = highByte(glyph);
return engine(which)->alphaRGBMapForGlyph(stripped(glyph), subPixelPosition, t);
diff --git a/src/gui/text/qfontengine_p.h b/src/gui/text/qfontengine_p.h
index 03e14c737a..a0e0801354 100644
--- a/src/gui/text/qfontengine_p.h
+++ b/src/gui/text/qfontengine_p.h
@@ -1,41 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the QtGui module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2021 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#ifndef QFONTENGINE_P_H
#define QFONTENGINE_P_H
@@ -65,13 +29,6 @@ class QFontEngineGlyphCache;
struct QGlyphLayout;
-#define MAKE_TAG(ch1, ch2, ch3, ch4) (\
- (((quint32)(ch1)) << 24) | \
- (((quint32)(ch2)) << 16) | \
- (((quint32)(ch3)) << 8) | \
- ((quint32)(ch4)) \
- )
-
// ### this only used in getPointInOutline(), refactor it and then remove these magic numbers
enum HB_Compat_Error {
Err_Ok = 0x0000,
@@ -119,17 +76,18 @@ public:
enum ShaperFlag {
DesignMetrics = 0x0002,
- GlyphIndicesOnly = 0x0004
+ GlyphIndicesOnly = 0x0004,
+ FullStringFallback = 0x008
};
Q_DECLARE_FLAGS(ShaperFlags, ShaperFlag)
- /* Used with the Freetype font engine. We don't cache glyphs that are too large anyway, so we can make this struct rather small */
+ /* Used with the Freetype font engine. */
struct Glyph {
Glyph() = default;
~Glyph() { delete [] data; }
short linearAdvance = 0;
- unsigned char width = 0;
- unsigned char height = 0;
+ unsigned short width = 0;
+ unsigned short height = 0;
short x = 0;
short y = 0;
short advance = 0;
@@ -163,11 +121,13 @@ public:
virtual bool getSfntTableData(uint tag, uchar *buffer, uint *length) const;
struct FaceId {
- FaceId() : index(0), encoding(0) {}
+ FaceId() : index(0), instanceIndex(-1), encoding(0) {}
QByteArray filename;
QByteArray uuid;
int index;
+ int instanceIndex;
int encoding;
+ QMap<QFont::Tag, float> variableAxes;
};
virtual FaceId faceId() const { return FaceId(); }
enum SynthesizedFlags {
@@ -176,14 +136,33 @@ public:
SynthesizedStretch = 0x4
};
virtual int synthesized() const { return 0; }
- virtual bool supportsSubPixelPositions() const { return false; }
- virtual QFixed subPixelPositionForX(QFixed x) const;
+ inline bool supportsSubPixelPositions() const
+ {
+ return supportsHorizontalSubPixelPositions() || supportsVerticalSubPixelPositions();
+ }
+ virtual bool supportsHorizontalSubPixelPositions() const { return false; }
+ virtual bool supportsVerticalSubPixelPositions() const { return false; }
+ virtual QFixedPoint subPixelPositionFor(const QFixedPoint &position) const;
+ QFixed subPixelPositionForX(QFixed x) const
+ {
+ return subPixelPositionFor(QFixedPoint(x, 0)).x;
+ }
+
+ bool isColorFont() const { return glyphFormat == Format_ARGB; }
+ static bool isIgnorableChar(char32_t ucs4)
+ {
+ return ucs4 == QChar::LineSeparator
+ || ucs4 == QChar::LineFeed
+ || ucs4 == QChar::CarriageReturn
+ || ucs4 == QChar::ParagraphSeparator
+ || QChar::category(ucs4) == QChar::Other_Control;
+ }
virtual QFixed emSquareSize() const { return ascent(); }
/* returns 0 as glyph index for non existent glyphs */
virtual glyph_t glyphIndex(uint ucs4) const = 0;
- virtual bool stringToCMap(const QChar *str, int len, QGlyphLayout *glyphs, int *nglyphs, ShaperFlags flags) const = 0;
+ virtual int stringToCMap(const QChar *str, int len, QGlyphLayout *glyphs, int *nglyphs, ShaperFlags flags) const = 0;
virtual void recalcAdvances(QGlyphLayout *, ShaperFlags) const {}
virtual void doKerning(QGlyphLayout *, ShaperFlags) const;
@@ -201,30 +180,30 @@ public:
*/
// ### Refactor this into a smaller and more flexible API.
virtual QImage alphaMapForGlyph(glyph_t);
- virtual QImage alphaMapForGlyph(glyph_t glyph, QFixed subPixelPosition);
+ virtual QImage alphaMapForGlyph(glyph_t glyph, const QFixedPoint &subPixelPosition);
virtual QImage alphaMapForGlyph(glyph_t, const QTransform &t);
- virtual QImage alphaMapForGlyph(glyph_t, QFixed subPixelPosition, const QTransform &t);
- virtual QImage alphaRGBMapForGlyph(glyph_t, QFixed subPixelPosition, const QTransform &t);
- virtual QImage bitmapForGlyph(glyph_t, QFixed subPixelPosition, const QTransform &t, const QColor &color = QColor());
- virtual Glyph *glyphData(glyph_t glyph, QFixed subPixelPosition, GlyphFormat neededFormat, const QTransform &t);
+ virtual QImage alphaMapForGlyph(glyph_t, const QFixedPoint &subPixelPosition, const QTransform &t);
+ virtual QImage alphaRGBMapForGlyph(glyph_t, const QFixedPoint &subPixelPosition, const QTransform &t);
+ virtual QImage bitmapForGlyph(glyph_t, const QFixedPoint &subPixelPosition, const QTransform &t, const QColor &color = QColor());
+ virtual Glyph *glyphData(glyph_t glyph, const QFixedPoint &subPixelPosition, GlyphFormat neededFormat, const QTransform &t);
virtual bool hasInternalCaching() const { return false; }
- virtual glyph_metrics_t alphaMapBoundingBox(glyph_t glyph, QFixed /*subPixelPosition*/, const QTransform &matrix, GlyphFormat /*format*/)
+ virtual glyph_metrics_t alphaMapBoundingBox(glyph_t glyph, const QFixedPoint &/*subPixelPosition*/, const QTransform &matrix, GlyphFormat /*format*/)
{
return boundingBox(glyph, matrix);
}
virtual void removeGlyphFromCache(glyph_t);
- virtual glyph_metrics_t boundingBox(const QGlyphLayout &glyphs) = 0;
+ virtual glyph_metrics_t boundingBox(const QGlyphLayout &glyphs);
virtual glyph_metrics_t boundingBox(glyph_t glyph) = 0;
virtual glyph_metrics_t boundingBox(glyph_t glyph, const QTransform &matrix);
glyph_metrics_t tightBoundingBox(const QGlyphLayout &glyphs);
- virtual QFixed ascent() const = 0;
+ virtual QFixed ascent() const;
virtual QFixed capHeight() const = 0;
- virtual QFixed descent() const = 0;
- virtual QFixed leading() const = 0;
+ virtual QFixed descent() const;
+ virtual QFixed leading() const;
virtual QFixed xHeight() const;
virtual QFixed averageCharWidth() const;
@@ -304,14 +283,11 @@ public:
explicit Holder(void *p, qt_destroy_func_t d) : ptr(p), destroy_func(d) {}
~Holder() { if (ptr && destroy_func) destroy_func(ptr); }
Holder(Holder &&other) noexcept
- : ptr(other.ptr),
- destroy_func(other.destroy_func)
+ : ptr(std::exchange(other.ptr, nullptr)),
+ destroy_func(std::exchange(other.destroy_func, nullptr))
{
- other.ptr = nullptr;
- other.destroy_func = nullptr;
}
- Holder &operator=(Holder &&other) noexcept
- { swap(other); return *this; }
+ QT_MOVE_ASSIGNMENT_OPERATOR_IMPL_VIA_PURE_SWAP(Holder)
void swap(Holder &other) noexcept
{
@@ -353,22 +329,29 @@ public:
return left_right < other.left_right;
}
};
- QVector<KernPair> kerning_pairs;
+ QList<KernPair> kerning_pairs;
void loadKerningPairs(QFixed scalingFactor);
GlyphFormat glyphFormat;
int m_subPixelPositionCount; // Number of positions within a single pixel for this cache
- inline QVariant userData() const { return m_userData; }
-
protected:
explicit QFontEngine(Type type);
- QFixed lastRightBearing(const QGlyphLayout &glyphs, bool round = false);
+ QFixed firstLeftBearing(const QGlyphLayout &glyphs);
+ QFixed lastRightBearing(const QGlyphLayout &glyphs);
- inline void setUserData(const QVariant &userData) { m_userData = userData; }
QFixed calculatedCapHeight() const;
+ mutable QFixed m_ascent;
+ mutable QFixed m_descent;
+ mutable QFixed m_leading;
+ mutable bool m_heightMetricsQueried;
+
+ virtual void initializeHeightMetrics() const;
+ bool processHheaTable() const;
+ bool processOS2Table() const;
+
private:
struct GlyphCacheEntry {
GlyphCacheEntry();
@@ -384,11 +367,8 @@ private:
mutable QHash<const void *, GlyphCaches> m_glyphCaches;
private:
- QVariant m_userData;
-
mutable qreal m_minLeftBearing;
mutable qreal m_minRightBearing;
-
};
Q_DECLARE_TYPEINFO(QFontEngine::KernPair, Q_PRIMITIVE_TYPE);
@@ -396,18 +376,18 @@ Q_DECLARE_OPERATORS_FOR_FLAGS(QFontEngine::ShaperFlags)
inline bool operator ==(const QFontEngine::FaceId &f1, const QFontEngine::FaceId &f2)
{
- return f1.index == f2.index && f1.encoding == f2.encoding && f1.filename == f2.filename && f1.uuid == f2.uuid;
+ return f1.index == f2.index
+ && f1.encoding == f2.encoding
+ && f1.filename == f2.filename
+ && f1.uuid == f2.uuid
+ && f1.instanceIndex == f2.instanceIndex
+ && f1.variableAxes == f2.variableAxes;
}
-inline uint qHash(const QFontEngine::FaceId &f, uint seed = 0)
+inline size_t qHash(const QFontEngine::FaceId &f, size_t seed = 0)
noexcept(noexcept(qHash(f.filename)))
{
- QtPrivate::QHashCombine hash;
- seed = hash(seed, f.filename);
- seed = hash(seed, f.uuid);
- seed = hash(seed, f.index);
- seed = hash(seed, f.encoding);
- return seed;
+ return qHashMulti(seed, f.filename, f.uuid, f.index, f.instanceIndex, f.encoding, f.variableAxes.keys(), f.variableAxes.values());
}
@@ -422,7 +402,7 @@ public:
~QFontEngineBox();
virtual glyph_t glyphIndex(uint ucs4) const override;
- virtual bool stringToCMap(const QChar *str, int len, QGlyphLayout *glyphs, int *nglyphs, ShaperFlags flags) const override;
+ virtual int stringToCMap(const QChar *str, int len, QGlyphLayout *glyphs, int *nglyphs, ShaperFlags flags) const override;
virtual void recalcAdvances(QGlyphLayout *, ShaperFlags) const override;
void draw(QPaintEngine *p, qreal x, qreal y, const QTextItemInt &si);
@@ -460,7 +440,7 @@ public:
~QFontEngineMulti();
virtual glyph_t glyphIndex(uint ucs4) const override;
- virtual bool stringToCMap(const QChar *str, int len, QGlyphLayout *glyphs, int *nglyphs, ShaperFlags flags) const override;
+ virtual int stringToCMap(const QChar *str, int len, QGlyphLayout *glyphs, int *nglyphs, ShaperFlags flags) const override;
virtual glyph_metrics_t boundingBox(const QGlyphLayout &glyphs) override;
virtual glyph_metrics_t boundingBox(glyph_t glyph) override;
@@ -477,10 +457,10 @@ public:
virtual QFixed xHeight() const override;
virtual QFixed averageCharWidth() const override;
virtual QImage alphaMapForGlyph(glyph_t) override;
- virtual QImage alphaMapForGlyph(glyph_t glyph, QFixed subPixelPosition) override;
+ virtual QImage alphaMapForGlyph(glyph_t glyph, const QFixedPoint &subPixelPosition) override;
virtual QImage alphaMapForGlyph(glyph_t, const QTransform &t) override;
- virtual QImage alphaMapForGlyph(glyph_t, QFixed subPixelPosition, const QTransform &t) override;
- virtual QImage alphaRGBMapForGlyph(glyph_t, QFixed subPixelPosition, const QTransform &t) override;
+ virtual QImage alphaMapForGlyph(glyph_t, const QFixedPoint &subPixelPosition, const QTransform &t) override;
+ virtual QImage alphaRGBMapForGlyph(glyph_t, const QFixedPoint &subPixelPosition, const QTransform &t) override;
virtual QFixed lineThickness() const override;
virtual QFixed underlinePosition() const override;
@@ -510,7 +490,7 @@ protected:
virtual QFontEngine *loadEngine(int at);
private:
- QVector<QFontEngine *> m_engines;
+ QList<QFontEngine *> m_engines;
QStringList m_fallbackFamilies;
const int m_script;
bool m_fallbackFamiliesQueried;
diff --git a/src/gui/text/qfontengine_qpf2.cpp b/src/gui/text/qfontengine_qpf2.cpp
deleted file mode 100644
index 68bf3f9e73..0000000000
--- a/src/gui/text/qfontengine_qpf2.cpp
+++ /dev/null
@@ -1,627 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the QtGui module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "qfontengine_qpf2_p.h"
-
-#include <QtCore/QFile>
-#include <QtCore/QFileInfo>
-#include <QtCore/QDir>
-#include <QtCore/QBuffer>
-#include <QtCore/private/qstringiterator_p.h>
-
-#include <QtGui/private/qpaintengine_raster_p.h>
-#include <QtGui/private/qguiapplication_p.h>
-#include <qpa/qplatformfontdatabase.h>
-#include <qpa/qplatformintegration.h>
-
-QT_BEGIN_NAMESPACE
-
-//#define DEBUG_HEADER
-//#define DEBUG_FONTENGINE
-
-static const QFontEngineQPF2::TagType tagTypes[QFontEngineQPF2::NumTags] = {
- QFontEngineQPF2::StringType, // FontName
- QFontEngineQPF2::StringType, // FileName
- QFontEngineQPF2::UInt32Type, // FileIndex
- QFontEngineQPF2::UInt32Type, // FontRevision
- QFontEngineQPF2::StringType, // FreeText
- QFontEngineQPF2::FixedType, // Ascent
- QFontEngineQPF2::FixedType, // Descent
- QFontEngineQPF2::FixedType, // Leading
- QFontEngineQPF2::FixedType, // XHeight
- QFontEngineQPF2::FixedType, // AverageCharWidth
- QFontEngineQPF2::FixedType, // MaxCharWidth
- QFontEngineQPF2::FixedType, // LineThickness
- QFontEngineQPF2::FixedType, // MinLeftBearing
- QFontEngineQPF2::FixedType, // MinRightBearing
- QFontEngineQPF2::FixedType, // UnderlinePosition
- QFontEngineQPF2::UInt8Type, // GlyphFormat
- QFontEngineQPF2::UInt8Type, // PixelSize
- QFontEngineQPF2::UInt8Type, // Weight
- QFontEngineQPF2::UInt8Type, // Style
- QFontEngineQPF2::StringType, // EndOfHeader
- QFontEngineQPF2::BitFieldType// WritingSystems
-};
-
-
-#if defined(DEBUG_HEADER)
-# define DEBUG_VERIFY qDebug
-#else
-# define DEBUG_VERIFY if (0) qDebug
-#endif
-
-#define READ_VERIFY(type, variable) \
- if (tagPtr + sizeof(type) > endPtr) { \
- DEBUG_VERIFY() << "read verify failed in line" << __LINE__; \
- return 0; \
- } \
- variable = qFromBigEndian<type>(tagPtr); \
- DEBUG_VERIFY() << "read value" << variable << "of type " #type; \
- tagPtr += sizeof(type)
-
-template <typename T>
-T readValue(const uchar *&data)
-{
- T value = qFromBigEndian<T>(data);
- data += sizeof(T);
- return value;
-}
-
-#define VERIFY(condition) \
- if (!(condition)) { \
- DEBUG_VERIFY() << "condition " #condition " failed in line" << __LINE__; \
- return 0; \
- }
-
-#define VERIFY_TAG(condition) \
- if (!(condition)) { \
- DEBUG_VERIFY() << "verifying tag condition " #condition " failed in line" << __LINE__ << "with tag" << tag; \
- return 0; \
- }
-
-static inline const uchar *verifyTag(const uchar *tagPtr, const uchar *endPtr)
-{
- quint16 tag, length;
- READ_VERIFY(quint16, tag);
- READ_VERIFY(quint16, length);
- if (tag == QFontEngineQPF2::Tag_EndOfHeader)
- return endPtr;
- if (tag < QFontEngineQPF2::NumTags) {
- switch (tagTypes[tag]) {
- case QFontEngineQPF2::BitFieldType:
- case QFontEngineQPF2::StringType:
- // can't do anything...
- break;
- case QFontEngineQPF2::UInt32Type:
- VERIFY_TAG(length == sizeof(quint32));
- break;
- case QFontEngineQPF2::FixedType:
- VERIFY_TAG(length == sizeof(quint32));
- break;
- case QFontEngineQPF2::UInt8Type:
- VERIFY_TAG(length == sizeof(quint8));
- break;
- }
-#if defined(DEBUG_HEADER)
- if (length == 1)
- qDebug() << "tag data" << Qt::hex << *tagPtr;
- else if (length == 4)
- qDebug() << "tag data" << Qt::hex << tagPtr[0] << tagPtr[1] << tagPtr[2] << tagPtr[3];
-#endif
- }
- return tagPtr + length;
-}
-
-const QFontEngineQPF2::Glyph *QFontEngineQPF2::findGlyph(glyph_t g) const
-{
- if (!g || g >= glyphMapEntries)
- return nullptr;
- const quint32 *gmapPtr = reinterpret_cast<const quint32 *>(fontData + glyphMapOffset);
- quint32 glyphPos = qFromBigEndian<quint32>(gmapPtr[g]);
- if (glyphPos > glyphDataSize) {
- if (glyphPos == 0xffffffff)
- return nullptr;
-#if defined(DEBUG_FONTENGINE)
- qDebug() << "glyph" << g << "outside of glyphData, remapping font file";
-#endif
- if (glyphPos > glyphDataSize)
- return nullptr;
- }
- return reinterpret_cast<const Glyph *>(fontData + glyphDataOffset + glyphPos);
-}
-
-bool QFontEngineQPF2::verifyHeader(const uchar *data, int size)
-{
- VERIFY(quintptr(data) % alignof(Header) == 0);
- VERIFY(size >= int(sizeof(Header)));
- const Header *header = reinterpret_cast<const Header *>(data);
- if (header->magic[0] != 'Q'
- || header->magic[1] != 'P'
- || header->magic[2] != 'F'
- || header->magic[3] != '2')
- return false;
-
- VERIFY(header->majorVersion <= CurrentMajorVersion);
- const quint16 dataSize = qFromBigEndian<quint16>(header->dataSize);
- VERIFY(size >= int(sizeof(Header)) + dataSize);
-
- const uchar *tagPtr = data + sizeof(Header);
- const uchar *tagEndPtr = tagPtr + dataSize;
- while (tagPtr < tagEndPtr - 3) {
- tagPtr = verifyTag(tagPtr, tagEndPtr);
- VERIFY(tagPtr);
- }
-
- VERIFY(tagPtr <= tagEndPtr);
- return true;
-}
-
-QVariant QFontEngineQPF2::extractHeaderField(const uchar *data, HeaderTag requestedTag)
-{
- const Header *header = reinterpret_cast<const Header *>(data);
- const uchar *tagPtr = data + sizeof(Header);
- const uchar *endPtr = tagPtr + qFromBigEndian<quint16>(header->dataSize);
- while (tagPtr < endPtr - 3) {
- quint16 tag = readValue<quint16>(tagPtr);
- quint16 length = readValue<quint16>(tagPtr);
- if (tag == requestedTag) {
- switch (tagTypes[requestedTag]) {
- case StringType:
- return QVariant(QString::fromUtf8(reinterpret_cast<const char *>(tagPtr), length));
- case UInt32Type:
- return QVariant(readValue<quint32>(tagPtr));
- case UInt8Type:
- return QVariant(uint(*tagPtr));
- case FixedType:
- return QVariant(QFixed::fromFixed(readValue<quint32>(tagPtr)).toReal());
- case BitFieldType:
- return QVariant(QByteArray(reinterpret_cast<const char *>(tagPtr), length));
- }
- return QVariant();
- } else if (tag == Tag_EndOfHeader) {
- break;
- }
- tagPtr += length;
- }
-
- return QVariant();
-}
-
-
-QFontEngineQPF2::QFontEngineQPF2(const QFontDef &def, const QByteArray &data)
- : QFontEngine(QPF2),
- fontData(reinterpret_cast<const uchar *>(data.constData())), dataSize(data.size())
-{
- fontDef = def;
- cache_cost = 100;
- cmap = nullptr;
- cmapOffset = 0;
- cmapSize = 0;
- glyphMapOffset = 0;
- glyphMapEntries = 0;
- glyphDataOffset = 0;
- glyphDataSize = 0;
- kerning_pairs_loaded = false;
- readOnly = true;
-
-#if defined(DEBUG_FONTENGINE)
- qDebug() << "QFontEngineQPF2::QFontEngineQPF2( fd =" << fd << ", renderingFontEngine =" << renderingFontEngine << ')';
-#endif
-
- if (!verifyHeader(fontData, dataSize)) {
-#if defined(DEBUG_FONTENGINE)
- qDebug("verifyHeader failed!");
-#endif
- return;
- }
-
- const Header *header = reinterpret_cast<const Header *>(fontData);
-
- readOnly = (header->lock == 0xffffffff);
-
- const uchar *imgData = fontData + sizeof(Header) + qFromBigEndian<quint16>(header->dataSize);
- const uchar *endPtr = fontData + dataSize;
- while (imgData <= endPtr - 8) {
- quint16 blockTag = readValue<quint16>(imgData);
- imgData += 2; // skip padding
- quint32 blockSize = readValue<quint32>(imgData);
-
- if (blockTag == CMapBlock) {
- cmapOffset = imgData - fontData;
- cmapSize = blockSize;
- } else if (blockTag == GMapBlock) {
- glyphMapOffset = imgData - fontData;
- glyphMapEntries = blockSize / 4;
- } else if (blockTag == GlyphBlock) {
- glyphDataOffset = imgData - fontData;
- glyphDataSize = blockSize;
- }
-
- imgData += blockSize;
- }
-
- face_id.filename = QFile::encodeName(extractHeaderField(fontData, Tag_FileName).toString());
- face_id.index = extractHeaderField(fontData, Tag_FileIndex).toInt();
-
- // get the real cmap
- if (cmapOffset) {
- cmap = QFontEngine::getCMap(fontData + cmapOffset, cmapSize, &symbol, &cmapSize);
- cmapOffset = cmap ? cmap - fontData : 0;
- }
-
- // verify all the positions in the glyphMap
- if (glyphMapOffset) {
- const quint32 *gmapPtr = reinterpret_cast<const quint32 *>(fontData + glyphMapOffset);
- for (uint i = 0; i < glyphMapEntries; ++i) {
- quint32 glyphDataPos = qFromBigEndian<quint32>(gmapPtr[i]);
- if (glyphDataPos == 0xffffffff)
- continue;
- if (glyphDataPos >= glyphDataSize) {
- // error
- glyphMapOffset = 0;
- glyphMapEntries = 0;
- break;
- }
- }
- }
-
-#if defined(DEBUG_FONTENGINE)
- if (!isValid())
- qDebug() << "fontData" << fontData << "dataSize" << dataSize
- << "cmap" << cmap << "cmapOffset" << cmapOffset
- << "glyphMapOffset" << glyphMapOffset << "glyphDataOffset" << glyphDataOffset
- << "fd" << fd << "glyphDataSize" << glyphDataSize;
-#endif
-}
-
-QFontEngineQPF2::~QFontEngineQPF2()
-{
-}
-
-bool QFontEngineQPF2::getSfntTableData(uint tag, uchar *buffer, uint *length) const
-{
- if (tag != MAKE_TAG('c', 'm', 'a', 'p') || !cmap)
- return false;
-
- if (buffer && int(*length) >= cmapSize)
- memcpy(buffer, cmap, cmapSize);
- *length = cmapSize;
- Q_ASSERT(int(*length) > 0);
- return true;
-}
-
-glyph_t QFontEngineQPF2::glyphIndex(uint ucs4) const
-{
- glyph_t glyph = getTrueTypeGlyphIndex(cmap, cmapSize, ucs4);
- if (glyph == 0 && symbol && ucs4 < 0x100)
- glyph = getTrueTypeGlyphIndex(cmap, cmapSize, ucs4 + 0xf000);
- if (!findGlyph(glyph))
- glyph = 0;
-
- return glyph;
-}
-
-bool QFontEngineQPF2::stringToCMap(const QChar *str, int len, QGlyphLayout *glyphs, int *nglyphs, QFontEngine::ShaperFlags flags) const
-{
- Q_ASSERT(glyphs->numGlyphs >= *nglyphs);
- if (*nglyphs < len) {
- *nglyphs = len;
- return false;
- }
-
-#if defined(DEBUG_FONTENGINE)
- QSet<QChar> seenGlyphs;
-#endif
-
- int glyph_pos = 0;
- if (symbol) {
- QStringIterator it(str, str + len);
- while (it.hasNext()) {
- const uint uc = it.next();
- glyphs->glyphs[glyph_pos] = getTrueTypeGlyphIndex(cmap, cmapSize, uc);
- if(!glyphs->glyphs[glyph_pos] && uc < 0x100)
- glyphs->glyphs[glyph_pos] = getTrueTypeGlyphIndex(cmap, cmapSize, uc + 0xf000);
- ++glyph_pos;
- }
- } else {
- QStringIterator it(str, str + len);
- while (it.hasNext()) {
- const uint uc = it.next();
- glyphs->glyphs[glyph_pos] = getTrueTypeGlyphIndex(cmap, cmapSize, uc);
-#if 0 && defined(DEBUG_FONTENGINE)
- QChar c(uc);
- if (!findGlyph(glyphs[glyph_pos].glyph) && !seenGlyphs.contains(c))
- qDebug() << "glyph for character" << c << '/' << Qt::hex << uc << "is" << Qt::dec << glyphs[glyph_pos].glyph;
-
- seenGlyphs.insert(c);
-#endif
- ++glyph_pos;
- }
- }
-
- *nglyphs = glyph_pos;
- glyphs->numGlyphs = glyph_pos;
-
- if (!(flags & GlyphIndicesOnly))
- recalcAdvances(glyphs, flags);
-
- return true;
-}
-
-void QFontEngineQPF2::recalcAdvances(QGlyphLayout *glyphs, QFontEngine::ShaperFlags) const
-{
- for (int i = 0; i < glyphs->numGlyphs; ++i) {
- const Glyph *g = findGlyph(glyphs->glyphs[i]);
- if (!g)
- continue;
- glyphs->advances[i] = g->advance;
- }
-}
-
-QImage QFontEngineQPF2::alphaMapForGlyph(glyph_t g)
-{
- const Glyph *glyph = findGlyph(g);
- if (!glyph)
- return QImage();
-
- const uchar *bits = ((const uchar *) glyph) + sizeof(Glyph);
-
- QImage image(bits,glyph->width, glyph->height, glyph->bytesPerLine, QImage::Format_Alpha8);
-
- return image;
-}
-
-void QFontEngineQPF2::addOutlineToPath(qreal x, qreal y, const QGlyphLayout &glyphs, QPainterPath *path, QTextItem::RenderFlags flags)
-{
- addBitmapFontToPath(x, y, glyphs, path, flags);
-}
-
-glyph_metrics_t QFontEngineQPF2::boundingBox(const QGlyphLayout &glyphs)
-{
- glyph_metrics_t overall;
- // initialize with line height, we get the same behaviour on all platforms
- overall.y = -ascent();
- overall.height = ascent() + descent() + 1;
-
- QFixed ymax = 0;
- QFixed xmax = 0;
- for (int i = 0; i < glyphs.numGlyphs; i++) {
- const Glyph *g = findGlyph(glyphs.glyphs[i]);
- if (!g)
- continue;
-
- QFixed x = overall.xoff + glyphs.offsets[i].x + g->x;
- QFixed y = overall.yoff + glyphs.offsets[i].y + g->y;
- overall.x = qMin(overall.x, x);
- overall.y = qMin(overall.y, y);
- xmax = qMax(xmax, x + g->width);
- ymax = qMax(ymax, y + g->height);
- overall.xoff += g->advance;
- }
- overall.height = qMax(overall.height, ymax - overall.y);
- overall.width = xmax - overall.x;
-
- return overall;
-}
-
-glyph_metrics_t QFontEngineQPF2::boundingBox(glyph_t glyph)
-{
- glyph_metrics_t overall;
- const Glyph *g = findGlyph(glyph);
- if (!g)
- return overall;
- overall.x = g->x;
- overall.y = g->y;
- overall.width = g->width;
- overall.height = g->height;
- overall.xoff = g->advance;
- return overall;
-}
-
-QFixed QFontEngineQPF2::ascent() const
-{
- return QFixed::fromReal(extractHeaderField(fontData, Tag_Ascent).value<qreal>());
-}
-
-QFixed QFontEngineQPF2::capHeight() const
-{
- return calculatedCapHeight();
-}
-
-QFixed QFontEngineQPF2::descent() const
-{
- return QFixed::fromReal(extractHeaderField(fontData, Tag_Descent).value<qreal>());
-}
-
-QFixed QFontEngineQPF2::leading() const
-{
- return QFixed::fromReal(extractHeaderField(fontData, Tag_Leading).value<qreal>());
-}
-
-qreal QFontEngineQPF2::maxCharWidth() const
-{
- return extractHeaderField(fontData, Tag_MaxCharWidth).value<qreal>();
-}
-
-qreal QFontEngineQPF2::minLeftBearing() const
-{
- return extractHeaderField(fontData, Tag_MinLeftBearing).value<qreal>();
-}
-
-qreal QFontEngineQPF2::minRightBearing() const
-{
- return extractHeaderField(fontData, Tag_MinRightBearing).value<qreal>();
-}
-
-QFixed QFontEngineQPF2::underlinePosition() const
-{
- return QFixed::fromReal(extractHeaderField(fontData, Tag_UnderlinePosition).value<qreal>());
-}
-
-QFixed QFontEngineQPF2::lineThickness() const
-{
- return QFixed::fromReal(extractHeaderField(fontData, Tag_LineThickness).value<qreal>());
-}
-
-bool QFontEngineQPF2::isValid() const
-{
- return fontData && dataSize && cmapOffset
- && glyphMapOffset && glyphDataOffset && glyphDataSize > 0;
-}
-
-void QPF2Generator::generate()
-{
- writeHeader();
- writeGMap();
- writeBlock(QFontEngineQPF2::GlyphBlock, QByteArray());
-
- dev->seek(4); // position of header.lock
- writeUInt32(0);
-}
-
-void QPF2Generator::writeHeader()
-{
- QFontEngineQPF2::Header header;
-
- header.magic[0] = 'Q';
- header.magic[1] = 'P';
- header.magic[2] = 'F';
- header.magic[3] = '2';
- header.lock = 1;
- header.majorVersion = QFontEngineQPF2::CurrentMajorVersion;
- header.minorVersion = QFontEngineQPF2::CurrentMinorVersion;
- header.dataSize = 0;
- dev->write((const char *)&header, sizeof(header));
-
- writeTaggedString(QFontEngineQPF2::Tag_FontName, fe->fontDef.family.toUtf8());
-
- QFontEngine::FaceId face = fe->faceId();
- writeTaggedString(QFontEngineQPF2::Tag_FileName, face.filename);
- writeTaggedUInt32(QFontEngineQPF2::Tag_FileIndex, face.index);
-
- {
- const QByteArray head = fe->getSfntTable(MAKE_TAG('h', 'e', 'a', 'd'));
- if (head.size() >= 4) {
- const quint32 revision = qFromBigEndian<quint32>(head.constData());
- writeTaggedUInt32(QFontEngineQPF2::Tag_FontRevision, revision);
- }
- }
-
- writeTaggedQFixed(QFontEngineQPF2::Tag_Ascent, fe->ascent());
- writeTaggedQFixed(QFontEngineQPF2::Tag_Descent, fe->descent());
- writeTaggedQFixed(QFontEngineQPF2::Tag_Leading, fe->leading());
- writeTaggedQFixed(QFontEngineQPF2::Tag_XHeight, fe->xHeight());
- writeTaggedQFixed(QFontEngineQPF2::Tag_AverageCharWidth, fe->averageCharWidth());
- writeTaggedQFixed(QFontEngineQPF2::Tag_MaxCharWidth, QFixed::fromReal(fe->maxCharWidth()));
- writeTaggedQFixed(QFontEngineQPF2::Tag_LineThickness, fe->lineThickness());
- writeTaggedQFixed(QFontEngineQPF2::Tag_MinLeftBearing, QFixed::fromReal(fe->minLeftBearing()));
- writeTaggedQFixed(QFontEngineQPF2::Tag_MinRightBearing, QFixed::fromReal(fe->minRightBearing()));
- writeTaggedQFixed(QFontEngineQPF2::Tag_UnderlinePosition, fe->underlinePosition());
- writeTaggedUInt8(QFontEngineQPF2::Tag_PixelSize, fe->fontDef.pixelSize);
- writeTaggedUInt8(QFontEngineQPF2::Tag_Weight, fe->fontDef.weight);
- writeTaggedUInt8(QFontEngineQPF2::Tag_Style, fe->fontDef.style);
-
- writeTaggedUInt8(QFontEngineQPF2::Tag_GlyphFormat, QFontEngineQPF2::AlphamapGlyphs);
-
- writeTaggedString(QFontEngineQPF2::Tag_EndOfHeader, QByteArray());
- align4();
-
- const quint64 size = dev->pos();
- header.dataSize = qToBigEndian<quint16>(size - sizeof(header));
- dev->seek(0);
- dev->write((const char *)&header, sizeof(header));
- dev->seek(size);
-}
-
-void QPF2Generator::writeGMap()
-{
- const quint16 glyphCount = fe->glyphCount();
-
- writeUInt16(QFontEngineQPF2::GMapBlock);
- writeUInt16(0); // padding
- writeUInt32(glyphCount * 4);
-
- QByteArray &buffer = dev->buffer();
- const int numBytes = glyphCount * sizeof(quint32);
- qint64 pos = buffer.size();
- buffer.resize(pos + numBytes);
- memset(buffer.data() + pos, 0xff, numBytes);
- dev->seek(pos + numBytes);
-}
-
-void QPF2Generator::writeBlock(QFontEngineQPF2::BlockTag tag, const QByteArray &data)
-{
- writeUInt16(tag);
- writeUInt16(0); // padding
- const int padSize = ((data.size() + 3) / 4) * 4 - data.size();
- writeUInt32(data.size() + padSize);
- dev->write(data);
- for (int i = 0; i < padSize; ++i)
- writeUInt8(0);
-}
-
-void QPF2Generator::writeTaggedString(QFontEngineQPF2::HeaderTag tag, const QByteArray &string)
-{
- writeUInt16(tag);
- writeUInt16(string.length());
- dev->write(string);
-}
-
-void QPF2Generator::writeTaggedUInt32(QFontEngineQPF2::HeaderTag tag, quint32 value)
-{
- writeUInt16(tag);
- writeUInt16(sizeof(value));
- writeUInt32(value);
-}
-
-void QPF2Generator::writeTaggedUInt8(QFontEngineQPF2::HeaderTag tag, quint8 value)
-{
- writeUInt16(tag);
- writeUInt16(sizeof(value));
- writeUInt8(value);
-}
-
-void QPF2Generator::writeTaggedQFixed(QFontEngineQPF2::HeaderTag tag, QFixed value)
-{
- writeUInt16(tag);
- writeUInt16(sizeof(quint32));
- writeUInt32(value.value());
-}
-
-QT_END_NAMESPACE
diff --git a/src/gui/text/qfontengine_qpf2_p.h b/src/gui/text/qfontengine_qpf2_p.h
deleted file mode 100644
index b2dc620ad1..0000000000
--- a/src/gui/text/qfontengine_qpf2_p.h
+++ /dev/null
@@ -1,241 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the QtGui module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef QFONTENGINE_QPF2_P_H
-#define QFONTENGINE_QPF2_P_H
-
-//
-// W A R N I N G
-// -------------
-//
-// This file is not part of the Qt API. It exists purely as an
-// implementation detail. This header file may change from version to
-// version without notice, or even be removed.
-//
-// We mean it.
-//
-#include <QtCore/qconfig.h>
-#include <QtCore/qglobal.h>
-#include <QtCore/qendian.h>
-#include <QtCore/QBuffer>
-
-#include "qfontengine_p.h"
-
-#include <QtCore/QFile>
-
-QT_BEGIN_NAMESPACE
-
-class QFontEngine;
-class QFreetypeFace;
-class QBuffer;
-
-class Q_GUI_EXPORT QFontEngineQPF2 : public QFontEngine
-{
-public:
- // if you add new tags please make sure to update the tables in
- // qpfutil.cpp and tools/makeqpf/qpf2.cpp
- enum HeaderTag {
- Tag_FontName, // 0 string
- Tag_FileName, // 1 string
- Tag_FileIndex, // 2 quint32
- Tag_FontRevision, // 3 quint32
- Tag_FreeText, // 4 string
- Tag_Ascent, // 5 QFixed
- Tag_Descent, // 6 QFixed
- Tag_Leading, // 7 QFixed
- Tag_XHeight, // 8 QFixed
- Tag_AverageCharWidth, // 9 QFixed
- Tag_MaxCharWidth, // 10 QFixed
- Tag_LineThickness, // 11 QFixed
- Tag_MinLeftBearing, // 12 QFixed
- Tag_MinRightBearing, // 13 QFixed
- Tag_UnderlinePosition, // 14 QFixed
- Tag_GlyphFormat, // 15 quint8
- Tag_PixelSize, // 16 quint8
- Tag_Weight, // 17 quint8
- Tag_Style, // 18 quint8
- Tag_EndOfHeader, // 19 string
- Tag_WritingSystems, // 20 bitfield
-
- NumTags
- };
-
- enum TagType {
- StringType,
- FixedType,
- UInt8Type,
- UInt32Type,
- BitFieldType
- };
-
- struct Tag
- {
- quint16 tag;
- quint16 size;
- };
-
- enum GlyphFormat {
- BitmapGlyphs = 1,
- AlphamapGlyphs = 8
- };
-
- enum {
- CurrentMajorVersion = 2,
- CurrentMinorVersion = 0
- };
-
- // The CMap is identical to the TrueType CMap table format
- // The GMap table is a normal array with the total number of
- // covered glyphs in the TrueType font
- enum BlockTag {
- CMapBlock,
- GMapBlock,
- GlyphBlock
- };
-
- struct Header
- {
- char magic[4]; // 'QPF2'
- quint32 lock; // values: 0 = unlocked, 0xffffffff = read-only, otherwise qws client id of locking process
- quint8 majorVersion;
- quint8 minorVersion;
- quint16 dataSize;
- };
-
- struct Block
- {
- quint16 tag;
- quint16 pad;
- quint32 dataSize;
- };
-
- struct Glyph
- {
- quint8 width;
- quint8 height;
- quint8 bytesPerLine;
- qint8 x;
- qint8 y;
- qint8 advance;
- };
-
- QFontEngineQPF2(const QFontDef &def, const QByteArray &data);
- ~QFontEngineQPF2();
-
- FaceId faceId() const override { return face_id; }
- bool getSfntTableData(uint tag, uchar *buffer, uint *length) const override;
-
- virtual glyph_t glyphIndex(uint ucs4) const override;
- bool stringToCMap(const QChar *str, int len, QGlyphLayout *glyphs, int *nglyphs, ShaperFlags flags) const override;
- void recalcAdvances(QGlyphLayout *, ShaperFlags) const override;
-
- void addOutlineToPath(qreal x, qreal y, const QGlyphLayout &glyphs, QPainterPath *path, QTextItem::RenderFlags flags) override;
- QImage alphaMapForGlyph(glyph_t t) override;
-
- glyph_metrics_t boundingBox(const QGlyphLayout &glyphs) override;
- glyph_metrics_t boundingBox(glyph_t glyph) override;
-
- QFixed ascent() const override;
- QFixed capHeight() const override;
- QFixed descent() const override;
- QFixed leading() const override;
- qreal maxCharWidth() const override;
- qreal minLeftBearing() const override;
- qreal minRightBearing() const override;
- QFixed underlinePosition() const override;
- QFixed lineThickness() const override;
-
- virtual int glyphCount() const override { return glyphMapEntries; }
-
- bool isValid() const;
-
- const Glyph *findGlyph(glyph_t g) const;
-
- static bool verifyHeader(const uchar *data, int size);
- static QVariant extractHeaderField(const uchar *data, HeaderTag tag);
-
-private:
-
- const uchar *fontData;
- int dataSize;
- const uchar *cmap;
- quint32 cmapOffset;
- int cmapSize;
- quint32 glyphMapOffset;
- quint32 glyphMapEntries;
- quint32 glyphDataOffset;
- quint32 glyphDataSize;
- QString internalFileName;
- QString encodedFileName;
- bool readOnly;
-
- FaceId face_id;
- QByteArray freetypeCMapTable;
- mutable bool kerning_pairs_loaded;
-};
-
-struct QPF2Generator
-{
- QPF2Generator(QBuffer *device, QFontEngine *engine)
- : dev(device), fe(engine) {}
-
- void generate();
- void writeHeader();
- void writeGMap();
- void writeBlock(QFontEngineQPF2::BlockTag tag, const QByteArray &data);
-
- void writeTaggedString(QFontEngineQPF2::HeaderTag tag, const QByteArray &string);
- void writeTaggedUInt32(QFontEngineQPF2::HeaderTag tag, quint32 value);
- void writeTaggedUInt8(QFontEngineQPF2::HeaderTag tag, quint8 value);
- void writeTaggedQFixed(QFontEngineQPF2::HeaderTag tag, QFixed value);
-
- void writeUInt16(quint16 value) { value = qToBigEndian(value); dev->write((const char *)&value, sizeof(value)); }
- void writeUInt32(quint32 value) { value = qToBigEndian(value); dev->write((const char *)&value, sizeof(value)); }
- void writeUInt8(quint8 value) { dev->write((const char *)&value, sizeof(value)); }
- void writeInt8(qint8 value) { dev->write((const char *)&value, sizeof(value)); }
-
- void align4() { while (dev->pos() & 3) { dev->putChar('\0'); } }
-
- QBuffer *dev;
- QFontEngine *fe;
-};
-
-QT_END_NAMESPACE
-
-#endif // QFONTENGINE_QPF2_P_H
diff --git a/src/gui/text/qfontengineglyphcache.cpp b/src/gui/text/qfontengineglyphcache.cpp
index c6e6499854..3555d56fa8 100644
--- a/src/gui/text/qfontengineglyphcache.cpp
+++ b/src/gui/text/qfontengineglyphcache.cpp
@@ -1,41 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the QtGui module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#include <private/qfontengineglyphcache_p.h>
diff --git a/src/gui/text/qfontengineglyphcache_p.h b/src/gui/text/qfontengineglyphcache_p.h
index 532be10a83..9054ea5950 100644
--- a/src/gui/text/qfontengineglyphcache_p.h
+++ b/src/gui/text/qfontengineglyphcache_p.h
@@ -1,41 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the QtGui module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#ifndef QFONTENGINEGLYPHCACHE_P_H
#define QFONTENGINEGLYPHCACHE_P_H
@@ -51,7 +15,7 @@
// We mean it.
//
-
+#include <QtCore/qshareddata.h>
#include <QtGui/private/qtguiglobal_p.h>
#include "QtCore/qatomic.h"
#include <QtCore/qvarlengtharray.h>
diff --git a/src/gui/text/qfontinfo.h b/src/gui/text/qfontinfo.h
index f5e05775b4..0edee5abe5 100644
--- a/src/gui/text/qfontinfo.h
+++ b/src/gui/text/qfontinfo.h
@@ -1,48 +1,13 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the QtGui module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#ifndef QFONTINFO_H
#define QFONTINFO_H
#include <QtGui/qtguiglobal.h>
#include <QtGui/qfont.h>
-#include <QtCore/qsharedpointer.h>
+
+#include <QtCore/qshareddata.h>
QT_BEGIN_NAMESPACE
@@ -56,7 +21,7 @@ public:
QFontInfo &operator=(const QFontInfo &);
- void swap(QFontInfo &other) { qSwap(d, other.d); }
+ void swap(QFontInfo &other) noexcept { d.swap(other.d); }
QString family() const;
QString styleName() const;
@@ -72,8 +37,9 @@ public:
bool strikeOut() const;
bool fixedPitch() const;
QFont::StyleHint styleHint() const;
-#if QT_DEPRECATED_SINCE(5, 5)
- bool rawMode() const;
+
+#if QT_DEPRECATED_SINCE(6, 0)
+ QT_DEPRECATED_VERSION_X_6_0("Use weight() instead") int legacyWeight() const;
#endif
bool exactMatch() const;
diff --git a/src/gui/text/qfontmetrics.cpp b/src/gui/text/qfontmetrics.cpp
index a79957797d..f7e405f0b5 100644
--- a/src/gui/text/qfontmetrics.cpp
+++ b/src/gui/text/qfontmetrics.cpp
@@ -1,41 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the QtGui module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#include "qfont.h"
#include "qpaintdevice.h"
@@ -106,20 +70,28 @@ extern void qt_format_text(const QFont& font, const QRectF &_r,
These are by necessity slow, and we recommend avoiding them if
possible.
- For each character, you can get its width(), leftBearing() and
- rightBearing() and find out whether it is in the font using
+ For each character, you can get its horizontalAdvance(), leftBearing(),
+ and rightBearing(), and find out whether it is in the font using
inFont(). You can also treat the character as a string, and use
the string functions on it.
- The string functions include width(), to return the width of a
- string in pixels (or points, for a printer), boundingRect(), to
- return a rectangle large enough to contain the rendered string,
+ The string functions include horizontalAdvance(), to return the advance
+ width of a string in pixels (or points, for a printer), boundingRect(),
+ to return a rectangle large enough to contain the rendered string,
and size(), to return the size of that rectangle.
+ \note The advance width can be different from the width of the actual
+ rendered text. It refers to the distance from the origin of the string to
+ where you would append additional characters. As text may have overhang
+ (in the case of an italic font for instance) or padding between
+ characters, the advance width can be either smaller or larger than the
+ actual rendering of the text. This is called the right bearing of the
+ text.
+
Example:
\snippet code/src_gui_text_qfontmetrics.cpp 0
- \sa QFont, QFontInfo, QFontDatabase, {Character Map Example}
+ \sa QFont, QFontInfo, QFontDatabase
*/
/*!
@@ -161,7 +133,7 @@ QFontMetrics::QFontMetrics(const QFont &font)
Constructs a font metrics object for \a font and \a paintdevice.
The font metrics will be compatible with the paintdevice passed.
- If the \a paintdevice is 0, the metrics will be screen-compatible,
+ If the \a paintdevice is \nullptr, the metrics will be screen-compatible,
ie. the metrics you get if you use the font for drawing text on a
\l{QWidget}{widgets} or \l{QPixmap}{pixmaps},
not on a QPicture or QPrinter.
@@ -170,19 +142,7 @@ QFontMetrics::QFontMetrics(const QFont &font)
passed in the constructor at the time it is created, and is not
updated if the font's attributes are changed later.
*/
-
-#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
-/*!
- \fn QFontMetrics::QFontMetrics(const QFont &font, QPaintDevice *paintdevice)
- \obsolete
- Identical to QFontMetrics::QFontMetrics(const QFont &font, const QPaintDevice *paintdevice)
-*/
-
-
-QFontMetrics::QFontMetrics(const QFont &font, QPaintDevice *paintdevice)
-#else
QFontMetrics::QFontMetrics(const QFont &font, const QPaintDevice *paintdevice)
-#endif
{
const int dpi = paintdevice ? paintdevice->logicalDpiY() : qt_defaultDpi();
if (font.d->dpi != dpi) {
@@ -273,9 +233,8 @@ bool QFontMetrics::operator ==(const QFontMetrics &other) const
The ascent of a font is the distance from the baseline to the
highest position characters extend to. In practice, some font
designers break this rule, e.g. when they put more than one accent
- on top of a character, or to accommodate an unusual character in
- an exotic language, so it is possible (though rare) that this
- value will be too small.
+ on top of a character, or to accommodate a certain character, so it
+ is possible (though rare) that this value will be too small.
\sa descent()
*/
@@ -310,8 +269,8 @@ int QFontMetrics::capHeight() const
The descent is the distance from the base line to the lowest point
characters extend to. In practice, some font designers break this rule,
- e.g. to accommodate an unusual character in an exotic language, so
- it is possible (though rare) that this value will be too small.
+ e.g. to accommodate a certain character, so it is possible (though
+ rare) that this value will be too small.
\sa ascent()
*/
@@ -464,9 +423,9 @@ bool QFontMetrics::inFontUcs4(uint ucs4) const
value is negative if the pixels of the character extend to the
left of the logical origin.
- See width() for a graphical description of this metric.
+ See horizontalAdvance() for a graphical description of this metric.
- \sa rightBearing(), minLeftBearing(), width()
+ \sa rightBearing(), minLeftBearing(), horizontalAdvance()
*/
int QFontMetrics::leftBearing(QChar ch) const
{
@@ -495,11 +454,11 @@ int QFontMetrics::leftBearing(QChar ch) const
The right bearing is the left-ward distance of the right-most
pixel of the character from the logical origin of a subsequent
character. This value is negative if the pixels of the character
- extend to the right of the width() of the character.
+ extend to the right of the horizontalAdvance() of the character.
- See width() for a graphical description of this metric.
+ See horizontalAdvance() for a graphical description of this metric.
- \sa leftBearing(), minRightBearing(), width()
+ \sa leftBearing(), minRightBearing(), horizontalAdvance()
*/
int QFontMetrics::rightBearing(QChar ch) const
{
@@ -522,117 +481,62 @@ int QFontMetrics::rightBearing(QChar ch) const
return qRound(rb);
}
-#if QT_DEPRECATED_SINCE(5, 11)
+static constexpr QLatin1Char s_variableLengthStringSeparator('\x9c');
+
/*!
- Returns the width in pixels of the first \a len characters of \a
+ Returns the horizontal advance in pixels of the first \a len characters of \a
text. If \a len is negative (the default), the entire string is
- used.
+ used. The entire length of \a text is analysed even if \a len is substantially
+ shorter.
- Note that this value is \e not equal to boundingRect().width();
- boundingRect() returns a rectangle describing the pixels this
- string will cover whereas width() returns the distance to where
- the next string should be drawn.
+ This is the distance appropriate for drawing a subsequent character
+ after \a text.
- \deprecated in Qt 5.11. Use horizontalAdvance() instead.
+ \since 5.11
\sa boundingRect()
*/
-int QFontMetrics::width(const QString &text, int len) const
-{
- return horizontalAdvance(text, len);
-}
-
-/*!
- \internal
-*/
-int QFontMetrics::width(const QString &text, int len, int flags) const
+int QFontMetrics::horizontalAdvance(const QString &text, int len) const
{
-#if QT_DEPRECATED_SINCE(5, 11) && QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
- if (flags & Qt::TextBypassShaping) {
- int pos = text.indexOf(QLatin1Char('\x9c'));
- if (pos != -1) {
- len = (len < 0) ? pos : qMin(pos, len);
- } else if (len < 0) {
- len = text.length();
- }
- if (len == 0)
- return 0;
-
- // Skip complex shaping, only use advances
- int numGlyphs = len;
- QVarLengthGlyphLayoutArray glyphs(numGlyphs);
- QFontEngine *engine = d->engineForScript(QChar::Script_Common);
- if (!engine->stringToCMap(text.data(), len, &glyphs, &numGlyphs, { }))
- Q_UNREACHABLE();
-
- QFixed width;
- for (int i = 0; i < numGlyphs; ++i)
- width += glyphs.advances[i];
- return qRound(width);
+ int pos = (len >= 0)
+ ? QStringView(text).left(len).indexOf(s_variableLengthStringSeparator)
+ : text.indexOf(s_variableLengthStringSeparator);
+ if (pos != -1) {
+ len = pos;
+ } else if (len < 0) {
+ len = text.size();
}
-#else
- Q_UNUSED(flags)
-#endif
-
- return horizontalAdvance(text, len);
-}
-
-/*!
- \overload
-
- \image bearings.png Bearings
-
- Returns the logical width of character \a ch in pixels. This is a
- distance appropriate for drawing a subsequent character after \a
- ch.
-
- Some of the metrics are described in the image to the right. The
- central dark rectangles cover the logical width() of each
- character. The outer pale rectangles cover the leftBearing() and
- rightBearing() of each character. Notice that the bearings of "f"
- in this particular font are both negative, while the bearings of
- "o" are both positive.
-
- \deprecated in Qt 5.11. Use horizontalAdvance() instead.
-
- \warning This function will produce incorrect results for Arabic
- characters or non-spacing marks in the middle of a string, as the
- glyph shaping and positioning of marks that happens when
- processing strings cannot be taken into account. When implementing
- an interactive text control, use QTextLayout instead.
+ if (len == 0)
+ return 0;
- \sa boundingRect()
-*/
-int QFontMetrics::width(QChar ch) const
-{
- return horizontalAdvance(ch);
+ QStackTextEngine layout(text, QFont(d.data()));
+ return qRound(layout.width(0, len));
}
-#endif // QT_DEPRECATED_SINCE(5, 11)
/*!
- Returns the horizontal advance in pixels of the first \a len characters of \a
- text. If \a len is negative (the default), the entire string is
- used.
+ Returns the horizontal advance in pixels of \a text laid out using \a option.
- This is the distance appropriate for drawing a subsequent character
- after \a text.
+ The advance is the distance appropriate for drawing a subsequent
+ character after \a text.
- \since 5.11
+ \since 6.3
\sa boundingRect()
*/
-int QFontMetrics::horizontalAdvance(const QString &text, int len) const
+int QFontMetrics::horizontalAdvance(const QString &text, const QTextOption &option) const
{
- int pos = text.indexOf(QLatin1Char('\x9c'));
+ int pos = text.indexOf(s_variableLengthStringSeparator);
+ int len = -1;
if (pos != -1) {
- len = (len < 0) ? pos : qMin(pos, len);
- } else if (len < 0) {
- len = text.length();
+ len = pos;
+ } else {
+ len = text.size();
}
if (len == 0)
return 0;
QStackTextEngine layout(text, QFont(d.data()));
+ layout.option = option;
return qRound(layout.width(0, len));
}
@@ -689,69 +593,48 @@ int QFontMetrics::horizontalAdvance(QChar ch) const
return qRound(advance);
}
-#if QT_VERSION < QT_VERSION_CHECK(6,0,0)
-/*! \obsolete
+/*!
+ Returns the bounding rectangle of the characters in the string
+ specified by \a text. The bounding rectangle always covers at least
+ the set of pixels the text would cover if drawn at (0, 0).
- Returns the width of the character at position \a pos in the
- string \a text.
+ Note that the bounding rectangle may extend to the left of (0, 0),
+ e.g. for italicized fonts, and that the width of the returned
+ rectangle might be different than what the horizontalAdvance() method
+ returns.
- The whole string is needed, as the glyph drawn may change
- depending on the context (the letter before and after the current
- one) for some languages (e.g. Arabic).
+ If you want to know the advance width of the string (to lay out
+ a set of strings next to each other), use horizontalAdvance() instead.
+
+ Newline characters are processed as normal characters, \e not as
+ linebreaks.
- This function also takes non spacing marks and ligatures into
- account.
+ The height of the bounding rectangle is at least as large as the
+ value returned by height().
+
+ \sa horizontalAdvance(), height(), QPainter::boundingRect(),
+ tightBoundingRect()
*/
-int QFontMetrics::charWidth(const QString &text, int pos) const
+QRect QFontMetrics::boundingRect(const QString &text) const
{
- int width = 0;
- if (pos < 0 || pos > (int)text.length())
- return width;
+ if (text.size() == 0)
+ return QRect();
- QChar ch = text.at(pos);
- const int script = ch.script();
- if (script != QChar::Script_Common) {
- // complex script shaping. Have to do some hard work
- int from = qMax(0, pos - 8);
- int to = qMin(text.length(), pos + 8);
- QString cstr = QString::fromRawData(text.unicode() + from, to - from);
- QStackTextEngine layout(cstr, QFont(d.data()));
- layout.ignoreBidi = true;
- layout.itemize();
- width = qRound(layout.width(pos-from, 1));
- } else if (ch.category() != QChar::Mark_NonSpacing) {
- QFontEngine *engine;
- if (d->capital == QFont::SmallCaps && ch.isLower())
- engine = d->smallCapsFontPrivate()->engineForScript(script);
- else
- engine = d->engineForScript(script);
- Q_ASSERT(engine != nullptr);
-
- d->alterCharForCapitalization(ch);
-
- glyph_t glyph = engine->glyphIndex(ch.unicode());
- QFixed advance;
-
- QGlyphLayout glyphs;
- glyphs.numGlyphs = 1;
- glyphs.glyphs = &glyph;
- glyphs.advances = &advance;
- engine->recalcAdvances(&glyphs, { });
-
- width = qRound(advance);
- }
- return width;
+ QStackTextEngine layout(text, QFont(d.data()));
+ layout.itemize();
+ glyph_metrics_t gm = layout.boundingBox(0, text.size());
+ return QRect(qRound(gm.x), qRound(gm.y), qRound(gm.width), qRound(gm.height));
}
-#endif
/*!
Returns the bounding rectangle of the characters in the string
- specified by \a text. The bounding rectangle always covers at least
- the set of pixels the text would cover if drawn at (0, 0).
+ specified by \a text laid out using \a option. The bounding rectangle always
+ covers at least the set of pixels the text would cover if drawn at (0, 0).
Note that the bounding rectangle may extend to the left of (0, 0),
e.g. for italicized fonts, and that the width of the returned
- rectangle might be different than what the width() method returns.
+ rectangle might be different than what the horizontalAdvance() method
+ returns.
If you want to know the advance width of the string (to lay out
a set of strings next to each other), use horizontalAdvance() instead.
@@ -762,16 +645,20 @@ int QFontMetrics::charWidth(const QString &text, int pos) const
The height of the bounding rectangle is at least as large as the
value returned by height().
- \sa width(), height(), QPainter::boundingRect(), tightBoundingRect()
+ \since 6.3
+
+ \sa horizontalAdvance(), height(), QPainter::boundingRect(),
+ tightBoundingRect()
*/
-QRect QFontMetrics::boundingRect(const QString &text) const
+QRect QFontMetrics::boundingRect(const QString &text, const QTextOption &option) const
{
- if (text.length() == 0)
+ if (text.size() == 0)
return QRect();
QStackTextEngine layout(text, QFont(d.data()));
+ layout.option = option;
layout.itemize();
- glyph_metrics_t gm = layout.boundingBox(0, text.length());
+ glyph_metrics_t gm = layout.boundingBox(0, text.size());
return QRect(qRound(gm.x), qRound(gm.y), qRound(gm.width), qRound(gm.height));
}
@@ -790,7 +677,7 @@ QRect QFontMetrics::boundingRect(const QString &text) const
\warning The width of the returned rectangle is not the advance width
of the character. Use boundingRect(const QString &) or horizontalAdvance() instead.
- \sa width()
+ \sa horizontalAdvance()
*/
QRect QFontMetrics::boundingRect(QChar ch) const
{
@@ -864,7 +751,7 @@ QRect QFontMetrics::boundingRect(QChar ch) const
fontHeight() and lineSpacing() are used to calculate the height,
rather than individual character heights.
- \sa width(), QPainter::boundingRect(), Qt::Alignment
+ \sa horizontalAdvance(), QPainter::boundingRect(), Qt::Alignment
*/
QRect QFontMetrics::boundingRect(const QRect &rect, int flags, const QString &text, int tabStops,
int *tabArray) const
@@ -911,8 +798,6 @@ QSize QFontMetrics::size(int flags, const QString &text, int tabStops, int *tabA
}
/*!
- \since 4.3
-
Returns a tight bounding rectangle around the characters in the
string specified by \a text. The bounding rectangle always covers
at least the set of pixels the text would cover if drawn at (0,
@@ -920,7 +805,8 @@ QSize QFontMetrics::size(int flags, const QString &text, int tabStops, int *tabA
Note that the bounding rectangle may extend to the left of (0, 0),
e.g. for italicized fonts, and that the width of the returned
- rectangle might be different than what the width() method returns.
+ rectangle might be different than what the horizontalAdvance() method
+ returns.
If you want to know the advance width of the string (to lay out
a set of strings next to each other), use horizontalAdvance() instead.
@@ -928,21 +814,53 @@ QSize QFontMetrics::size(int flags, const QString &text, int tabStops, int *tabA
Newline characters are processed as normal characters, \e not as
linebreaks.
- \warning Calling this method is very slow on Windows.
+ \since 4.3
- \sa width(), height(), boundingRect()
+ \sa horizontalAdvance(), height(), boundingRect()
*/
QRect QFontMetrics::tightBoundingRect(const QString &text) const
{
- if (text.length() == 0)
+ if (text.size() == 0)
return QRect();
QStackTextEngine layout(text, QFont(d.data()));
layout.itemize();
- glyph_metrics_t gm = layout.tightBoundingBox(0, text.length());
+ glyph_metrics_t gm = layout.tightBoundingBox(0, text.size());
return QRect(qRound(gm.x), qRound(gm.y), qRound(gm.width), qRound(gm.height));
}
+/*!
+ Returns a tight bounding rectangle around the characters in the
+ string specified by \a text laid out using \a option. The bounding
+ rectangle always covers at least the set of pixels the text would
+ cover if drawn at (0, 0).
+
+ Note that the bounding rectangle may extend to the left of (0, 0),
+ e.g. for italicized fonts, and that the width of the returned
+ rectangle might be different than what the horizontalAdvance() method
+ returns.
+
+ If you want to know the advance width of the string (to lay out
+ a set of strings next to each other), use horizontalAdvance() instead.
+
+ Newline characters are processed as normal characters, \e not as
+ linebreaks.
+
+ \since 6.3
+
+ \sa horizontalAdvance(), height(), boundingRect()
+*/
+QRect QFontMetrics::tightBoundingRect(const QString &text, const QTextOption &option) const
+{
+ if (text.size() == 0)
+ return QRect();
+
+ QStackTextEngine layout(text, QFont(d.data()));
+ layout.option = option;
+ layout.itemize();
+ glyph_metrics_t gm = layout.tightBoundingBox(0, text.size());
+ return QRect(qRound(gm.x), qRound(gm.y), qRound(gm.width), qRound(gm.height));
+}
/*!
\since 4.2
@@ -971,13 +889,13 @@ QString QFontMetrics::elidedText(const QString &text, Qt::TextElideMode mode, in
QString _text = text;
if (!(flags & Qt::TextLongestVariant)) {
int posA = 0;
- int posB = _text.indexOf(QLatin1Char('\x9c'));
+ int posB = _text.indexOf(s_variableLengthStringSeparator);
while (posB >= 0) {
QString portion = _text.mid(posA, posB - posA);
if (size(flags, portion).width() <= width)
return portion;
posA = posB + 1;
- posB = _text.indexOf(QLatin1Char('\x9c'), posA);
+ posB = _text.indexOf(s_variableLengthStringSeparator, posA);
}
_text = _text.mid(posA);
}
@@ -1079,12 +997,12 @@ qreal QFontMetrics::fontDpi() const
These are by necessity slow, and we recommend avoiding them if
possible.
- For each character, you can get its width(), leftBearing() and
- rightBearing() and find out whether it is in the font using
+ For each character, you can get its horizontalAdvance(), leftBearing(), and
+ rightBearing(), and find out whether it is in the font using
inFont(). You can also treat the character as a string, and use
the string functions on it.
- The string functions include width(), to return the width of a
+ The string functions include horizontalAdvance(), to return the width of a
string in pixels (or points, for a printer), boundingRect(), to
return a rectangle large enough to contain the rendered string,
and size(), to return the size of that rectangle.
@@ -1151,7 +1069,7 @@ QFontMetricsF::QFontMetricsF(const QFont &font)
Constructs a font metrics object for \a font and \a paintdevice.
The font metrics will be compatible with the paintdevice passed.
- If the \a paintdevice is 0, the metrics will be screen-compatible,
+ If the \a paintdevice is \nullptr, the metrics will be screen-compatible,
ie. the metrics you get if you use the font for drawing text on a
\l{QWidget}{widgets} or \l{QPixmap}{pixmaps},
not on a QPicture or QPrinter.
@@ -1160,20 +1078,7 @@ QFontMetricsF::QFontMetricsF(const QFont &font)
passed in the constructor at the time it is created, and is not
updated if the font's attributes are changed later.
*/
-
-
-#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
-/*!
- \fn QFontMetricsF::QFontMetricsF(const QFont &font, QPaintDevice *paintdevice)
- \obsolete
- Identical to QFontMetricsF::QFontMetricsF(const QFont &font, const QPaintDevice *paintdevice)
-*/
-
-
-QFontMetricsF::QFontMetricsF(const QFont &font, QPaintDevice *paintdevice)
-#else
QFontMetricsF::QFontMetricsF(const QFont &font, const QPaintDevice *paintdevice)
-#endif
{
int dpi = paintdevice ? paintdevice->logicalDpiY() : qt_defaultDpi();
if (font.d->dpi != dpi) {
@@ -1239,9 +1144,8 @@ bool QFontMetricsF::operator ==(const QFontMetricsF &other) const
The ascent of a font is the distance from the baseline to the
highest position characters extend to. In practice, some font
designers break this rule, e.g. when they put more than one accent
- on top of a character, or to accommodate an unusual character in
- an exotic language, so it is possible (though rare) that this
- value will be too small.
+ on top of a character, or to accommodate a certain character, so
+ it is possible (though rare) that this value will be too small.
\sa descent()
*/
@@ -1277,8 +1181,8 @@ qreal QFontMetricsF::capHeight() const
The descent is the distance from the base line to the lowest point
characters extend to. (Note that this is different from X, which
adds 1 pixel.) In practice, some font designers break this rule,
- e.g. to accommodate an unusual character in an exotic language, so
- it is possible (though rare) that this value will be too small.
+ e.g. to accommodate a certain character, so it is possible (though
+ rare) that this value will be too small.
\sa ascent()
*/
@@ -1434,9 +1338,9 @@ bool QFontMetricsF::inFontUcs4(uint ucs4) const
value is negative if the pixels of the character extend to the
left of the logical origin.
- See width() for a graphical description of this metric.
+ See horizontalAdvance() for a graphical description of this metric.
- \sa rightBearing(), minLeftBearing(), width()
+ \sa rightBearing(), minLeftBearing(), horizontalAdvance()
*/
qreal QFontMetricsF::leftBearing(QChar ch) const
{
@@ -1465,11 +1369,11 @@ qreal QFontMetricsF::leftBearing(QChar ch) const
The right bearing is the left-ward distance of the right-most
pixel of the character from the logical origin of a subsequent
character. This value is negative if the pixels of the character
- extend to the right of the width() of the character.
+ extend to the right of the horizontalAdvance() of the character.
- See width() for a graphical description of this metric.
+ See horizontalAdvance() for a graphical description of this metric.
- \sa leftBearing(), minRightBearing(), width()
+ \sa leftBearing(), minRightBearing(), horizontalAdvance()
*/
qreal QFontMetricsF::rightBearing(QChar ch) const
{
@@ -1493,80 +1397,61 @@ qreal QFontMetricsF::rightBearing(QChar ch) const
}
-#if QT_DEPRECATED_SINCE(5, 11)
/*!
- Returns the width in pixels of the characters in the given \a text.
+ Returns the horizontal advance in pixels of the first \a length characters of \a
+ text. If \a length is negative (the default), the entire string is
+ used. The entire length of \a text is analysed even if \a length is substantially
+ shorter.
- Note that this value is \e not equal to the width returned by
- boundingRect().width() because boundingRect() returns a rectangle
- describing the pixels this string will cover whereas width()
- returns the distance to where the next string should be drawn.
+ The advance is the distance appropriate for drawing a subsequent
+ character after \a text.
- \deprecated in Qt 5.11. Use horizontalAdvance() instead.
+ \since 5.11
\sa boundingRect()
*/
-qreal QFontMetricsF::width(const QString &text) const
+qreal QFontMetricsF::horizontalAdvance(const QString &text, int length) const
{
- return horizontalAdvance(text);
-}
-
-/*!
- \overload
-
- \image bearings.png Bearings
-
- Returns the logical width of character \a ch in pixels. This is a
- distance appropriate for drawing a subsequent character after \a
- ch.
-
- Some of the metrics are described in the image to the right. The
- central dark rectangles cover the logical width() of each
- character. The outer pale rectangles cover the leftBearing() and
- rightBearing() of each character. Notice that the bearings of "f"
- in this particular font are both negative, while the bearings of
- "o" are both positive.
-
- \deprecated in Qt 5.11. Use horizontalAdvance() instead.
+ int pos = (length >= 0)
+ ? QStringView(text).left(length).indexOf(s_variableLengthStringSeparator)
+ : text.indexOf(s_variableLengthStringSeparator);
+ if (pos != -1)
+ length = pos;
+ else if (length < 0)
+ length = text.size();
- \warning This function will produce incorrect results for Arabic
- characters or non-spacing marks in the middle of a string, as the
- glyph shaping and positioning of marks that happens when
- processing strings cannot be taken into account. When implementing
- an interactive text control, use QTextLayout instead.
+ if (length == 0)
+ return 0;
- \sa boundingRect()
-*/
-qreal QFontMetricsF::width(QChar ch) const
-{
- return horizontalAdvance(ch);
+ QStackTextEngine layout(text, QFont(d.data()));
+ layout.itemize();
+ return layout.width(0, length).toReal();
}
-#endif
/*!
- Returns the horizontal advance in pixels of the first \a length characters of \a
- text. If \a length is negative (the default), the entire string is
- used.
+ Returns the horizontal advance in pixels of \a text laid out using \a option.
The advance is the distance appropriate for drawing a subsequent
character after \a text.
- \since 5.11
+ \since 6.3
\sa boundingRect()
*/
-qreal QFontMetricsF::horizontalAdvance(const QString &text, int length) const
+qreal QFontMetricsF::horizontalAdvance(const QString &text, const QTextOption &option) const
{
- int pos = text.indexOf(QLatin1Char('\x9c'));
+ int pos = text.indexOf(s_variableLengthStringSeparator);
+ int length = -1;
if (pos != -1)
- length = (length < 0) ? pos : qMin(pos, length);
- else if (length < 0)
- length = text.length();
+ length = pos;
+ else
+ length = text.size();
if (length == 0)
return 0;
QStackTextEngine layout(text, QFont(d.data()));
+ layout.option = option;
layout.itemize();
return layout.width(0, length).toReal();
}
@@ -1581,7 +1466,7 @@ qreal QFontMetricsF::horizontalAdvance(const QString &text, int length) const
ch.
Some of the metrics are described in the image to the right. The
- central dark rectangles cover the logical width() of each
+ central dark rectangles cover the logical horizontalAdvance() of each
character. The outer pale rectangles cover the leftBearing() and
rightBearing() of each character. Notice that the bearings of "f"
in this particular font are both negative, while the bearings of
@@ -1632,7 +1517,7 @@ qreal QFontMetricsF::horizontalAdvance(QChar ch) const
Note that the bounding rectangle may extend to the left of (0, 0),
e.g. for italicized fonts, and that the width of the returned
- rectangle might be different than what the width() method returns.
+ rectangle might be different than what the horizontalAdvance() method returns.
If you want to know the advance width of the string (to lay out
a set of strings next to each other), use horizontalAdvance() instead.
@@ -1643,11 +1528,11 @@ qreal QFontMetricsF::horizontalAdvance(QChar ch) const
The height of the bounding rectangle is at least as large as the
value returned height().
- \sa width(), height(), QPainter::boundingRect()
+ \sa horizontalAdvance(), height(), QPainter::boundingRect()
*/
QRectF QFontMetricsF::boundingRect(const QString &text) const
{
- int len = text.length();
+ int len = text.size();
if (len == 0)
return QRectF();
@@ -1659,6 +1544,42 @@ QRectF QFontMetricsF::boundingRect(const QString &text) const
}
/*!
+ Returns the bounding rectangle of the characters in the string
+ specified by \a text laid out using \a option. The bounding
+ rectangle always covers at least the set of pixels the text
+ would cover if drawn at (0, 0).
+
+ Note that the bounding rectangle may extend to the left of (0, 0),
+ e.g. for italicized fonts, and that the width of the returned
+ rectangle might be different than what the horizontalAdvance() method returns.
+
+ If you want to know the advance width of the string (to lay out
+ a set of strings next to each other), use horizontalAdvance() instead.
+
+ Newline characters are processed as normal characters, \e not as
+ linebreaks.
+
+ The height of the bounding rectangle is at least as large as the
+ value returned height().
+
+ \since 6.3
+ \sa horizontalAdvance(), height(), QPainter::boundingRect()
+*/
+QRectF QFontMetricsF::boundingRect(const QString &text, const QTextOption &option) const
+{
+ if (text.size() == 0)
+ return QRectF();
+
+ QStackTextEngine layout(text, QFont(d.data()));
+ layout.option = option;
+ layout.itemize();
+ glyph_metrics_t gm = layout.boundingBox(0, text.size());
+ return QRectF(gm.x.toReal(), gm.y.toReal(),
+ gm.width.toReal(), gm.height.toReal());
+}
+
+
+/*!
Returns the bounding rectangle of the character \a ch relative to
the left-most point on the base line.
@@ -1669,7 +1590,7 @@ QRectF QFontMetricsF::boundingRect(const QString &text) const
Note that the rectangle usually extends both above and below the
base line.
- \sa width()
+ \sa horizontalAdvance()
*/
QRectF QFontMetricsF::boundingRect(QChar ch) const
{
@@ -1694,7 +1615,9 @@ QRectF QFontMetricsF::boundingRect(QChar ch) const
Returns the bounding rectangle of the characters in the given \a text.
This is the set of pixels the text would cover if drawn when constrained
- to the bounding rectangle specified by \a rect.
+ to the bounding rectangle specified by \a rect. If \a rect is a reference
+ to a \nullptr object, e.g. when passing a default constructed QRectF, the
+ bounding rectangle will not constrain itself to the size.
The \a flags argument is the bitwise OR of the following flags:
\list
@@ -1746,7 +1669,7 @@ QRectF QFontMetricsF::boundingRect(QChar ch) const
fontHeight() and lineSpacing() are used to calculate the height,
rather than individual character heights.
- \sa width(), QPainter::boundingRect(), Qt::Alignment
+ \sa horizontalAdvance(), QPainter::boundingRect(), Qt::Alignment
*/
QRectF QFontMetricsF::boundingRect(const QRectF &rect, int flags, const QString& text,
int tabStops, int *tabArray) const
@@ -1805,7 +1728,8 @@ QSizeF QFontMetricsF::size(int flags, const QString &text, int tabStops, int *ta
Note that the bounding rectangle may extend to the left of (0, 0),
e.g. for italicized fonts, and that the width of the returned
- rectangle might be different than what the width() method returns.
+ rectangle might be different than what the horizontalAdvance() method
+ returns.
If you want to know the advance width of the string (to lay out
a set of strings next to each other), use horizontalAdvance() instead.
@@ -1813,18 +1737,49 @@ QSizeF QFontMetricsF::size(int flags, const QString &text, int tabStops, int *ta
Newline characters are processed as normal characters, \e not as
linebreaks.
- \warning Calling this method is very slow on Windows.
-
- \sa width(), height(), boundingRect()
+ \sa horizontalAdvance(), height(), boundingRect()
*/
QRectF QFontMetricsF::tightBoundingRect(const QString &text) const
{
- if (text.length() == 0)
- return QRect();
+ if (text.size() == 0)
+ return QRectF();
+
+ QStackTextEngine layout(text, QFont(d.data()));
+ layout.itemize();
+ glyph_metrics_t gm = layout.tightBoundingBox(0, text.size());
+ return QRectF(gm.x.toReal(), gm.y.toReal(), gm.width.toReal(), gm.height.toReal());
+}
+
+/*!
+ Returns a tight bounding rectangle around the characters in the
+ string specified by \a text laid out using \a option. The bounding
+ rectangle always covers at least the set of pixels the text would
+ cover if drawn at (0,0).
+
+ Note that the bounding rectangle may extend to the left of (0, 0),
+ e.g. for italicized fonts, and that the width of the returned
+ rectangle might be different than what the horizontalAdvance() method
+ returns.
+
+ If you want to know the advance width of the string (to lay out
+ a set of strings next to each other), use horizontalAdvance() instead.
+
+ Newline characters are processed as normal characters, \e not as
+ linebreaks.
+
+ \since 6.3
+
+ \sa horizontalAdvance(), height(), boundingRect()
+*/
+QRectF QFontMetricsF::tightBoundingRect(const QString &text, const QTextOption &option) const
+{
+ if (text.size() == 0)
+ return QRectF();
QStackTextEngine layout(text, QFont(d.data()));
+ layout.option = option;
layout.itemize();
- glyph_metrics_t gm = layout.tightBoundingBox(0, text.length());
+ glyph_metrics_t gm = layout.tightBoundingBox(0, text.size());
return QRectF(gm.x.toReal(), gm.y.toReal(), gm.width.toReal(), gm.height.toReal());
}
@@ -1854,13 +1809,13 @@ QString QFontMetricsF::elidedText(const QString &text, Qt::TextElideMode mode, q
QString _text = text;
if (!(flags & Qt::TextLongestVariant)) {
int posA = 0;
- int posB = _text.indexOf(QLatin1Char('\x9c'));
+ int posB = _text.indexOf(s_variableLengthStringSeparator);
while (posB >= 0) {
QString portion = _text.mid(posA, posB - posA);
if (size(flags, portion).width() <= width)
return portion;
posA = posB + 1;
- posB = _text.indexOf(QLatin1Char('\x9c'), posA);
+ posB = _text.indexOf(s_variableLengthStringSeparator, posA);
}
_text = _text.mid(posA);
}
diff --git a/src/gui/text/qfontmetrics.h b/src/gui/text/qfontmetrics.h
index e92a1514a1..1942d1fa83 100644
--- a/src/gui/text/qfontmetrics.h
+++ b/src/gui/text/qfontmetrics.h
@@ -1,86 +1,35 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the QtGui module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#ifndef QFONTMETRICS_H
#define QFONTMETRICS_H
#include <QtGui/qtguiglobal.h>
#include <QtGui/qfont.h>
-#include <QtCore/qsharedpointer.h>
+
#ifndef QT_INCLUDE_COMPAT
#include <QtCore/qrect.h>
#endif
+#include <QtCore/qshareddata.h>
QT_BEGIN_NAMESPACE
-
-
-class QTextCodec;
class QRect;
-
+class QTextOption;
class Q_GUI_EXPORT QFontMetrics
{
public:
explicit QFontMetrics(const QFont &);
-#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
- QFontMetrics(const QFont &font, QPaintDevice *pd);
-#ifndef Q_QDOC
- // the template is necessary to make QFontMetrics(font,nullptr) and QFontMetrics(font,NULL)
- // not ambiguous. Implementation detail that should not be documented.
- template<char = 0>
-#endif
- QFontMetrics(const QFont &font, const QPaintDevice *pd)
- : QFontMetrics(font, const_cast<QPaintDevice*>(pd))
- {}
-#else
QFontMetrics(const QFont &font, const QPaintDevice *pd);
-#endif
QFontMetrics(const QFontMetrics &);
~QFontMetrics();
QFontMetrics &operator=(const QFontMetrics &);
- inline QFontMetrics &operator=(QFontMetrics &&other) noexcept
- { qSwap(d, other.d); return *this; }
+ QT_MOVE_ASSIGNMENT_OPERATOR_IMPL_VIA_PURE_SWAP(QFontMetrics)
void swap(QFontMetrics &other) noexcept
- { qSwap(d, other.d); }
+ { d.swap(other.d); }
int ascent() const;
int capHeight() const;
@@ -101,25 +50,14 @@ public:
int leftBearing(QChar) const;
int rightBearing(QChar) const;
-#if QT_DEPRECATED_SINCE(5, 11)
- QT_DEPRECATED_X("Use QFontMetrics::horizontalAdvance")
- int width(const QString &, int len = -1) const;
- QT_DEPRECATED_X("Use QFontMetrics::horizontalAdvance")
- int width(const QString &, int len, int flags) const;
- QT_DEPRECATED_X("Use QFontMetrics::horizontalAdvance")
- int width(QChar) const;
-#endif
-
int horizontalAdvance(const QString &, int len = -1) const;
+ int horizontalAdvance(const QString &, const QTextOption &textOption) const;
int horizontalAdvance(QChar) const;
-#if QT_VERSION < QT_VERSION_CHECK(6,0,0)
- QT_DEPRECATED int charWidth(const QString &str, int pos) const;
-#endif
-
QRect boundingRect(QChar) const;
QRect boundingRect(const QString &text) const;
+ QRect boundingRect(const QString &text, const QTextOption &textOption) const;
QRect boundingRect(const QRect &r, int flags, const QString &text, int tabstops = 0, int *tabarray = nullptr) const;
inline QRect boundingRect(int x, int y, int w, int h, int flags, const QString &text,
int tabstops = 0, int *tabarray = nullptr) const
@@ -127,6 +65,7 @@ public:
QSize size(int flags, const QString& str, int tabstops = 0, int *tabarray = nullptr) const;
QRect tightBoundingRect(const QString &text) const;
+ QRect tightBoundingRect(const QString &text, const QTextOption &textOption) const;
QString elidedText(const QString &text, Qt::TextElideMode mode, int width, int flags = 0) const;
@@ -153,29 +92,16 @@ class Q_GUI_EXPORT QFontMetricsF
{
public:
explicit QFontMetricsF(const QFont &font);
-#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
- QFontMetricsF(const QFont &font, QPaintDevice *pd);
-#ifndef Q_QDOC
- // the template is necessary to make QFontMetrics(font,nullptr) and QFontMetrics(font,NULL)
- // not ambiguous. Implementation detail that should not be documented.
- template<char = 0>
-#endif
- QFontMetricsF(const QFont &font, const QPaintDevice *pd)
- : QFontMetricsF(font, const_cast<QPaintDevice*>(pd))
- {}
-#else
QFontMetricsF(const QFont &font, const QPaintDevice *pd);
-#endif
QFontMetricsF(const QFontMetrics &);
QFontMetricsF(const QFontMetricsF &);
~QFontMetricsF();
QFontMetricsF &operator=(const QFontMetricsF &);
QFontMetricsF &operator=(const QFontMetrics &);
- inline QFontMetricsF &operator=(QFontMetricsF &&other) noexcept
- { qSwap(d, other.d); return *this; }
+ QT_MOVE_ASSIGNMENT_OPERATOR_IMPL_VIA_PURE_SWAP(QFontMetricsF)
- void swap(QFontMetricsF &other) noexcept { qSwap(d, other.d); }
+ void swap(QFontMetricsF &other) noexcept { d.swap(other.d); }
qreal ascent() const;
qreal capHeight() const;
@@ -196,20 +122,18 @@ public:
qreal leftBearing(QChar) const;
qreal rightBearing(QChar) const;
-#if QT_DEPRECATED_SINCE(5, 11)
- qreal width(const QString &string) const;
- qreal width(QChar) const;
-#endif
-
qreal horizontalAdvance(const QString &string, int length = -1) const;
qreal horizontalAdvance(QChar) const;
+ qreal horizontalAdvance(const QString &string, const QTextOption &textOption) const;
QRectF boundingRect(const QString &string) const;
+ QRectF boundingRect(const QString &text, const QTextOption &textOption) const;
QRectF boundingRect(QChar) const;
QRectF boundingRect(const QRectF &r, int flags, const QString& string, int tabstops = 0, int *tabarray = nullptr) const;
QSizeF size(int flags, const QString& str, int tabstops = 0, int *tabarray = nullptr) const;
QRectF tightBoundingRect(const QString &text) const;
+ QRectF tightBoundingRect(const QString &text, const QTextOption &textOption) const;
QString elidedText(const QString &text, Qt::TextElideMode mode, qreal width, int flags = 0) const;
diff --git a/src/gui/text/qfontsubset.cpp b/src/gui/text/qfontsubset.cpp
index fb12b681a4..f6c973e522 100644
--- a/src/gui/text/qfontsubset.cpp
+++ b/src/gui/text/qfontsubset.cpp
@@ -1,41 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the QtGui module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#include "qfontsubset_p.h"
#include <qdebug.h>
@@ -49,6 +13,8 @@
QT_BEGIN_NAMESPACE
+using namespace Qt::StringLiterals;
+
#ifndef QT_NO_PDF
// This map is used for symbol fonts to get the correct glyph names for the latin range
@@ -112,24 +78,6 @@ QByteArray QFontSubset::glyphName(unsigned short unicode, bool symbol)
return buffer;
}
-QByteArray QFontSubset::glyphName(unsigned int glyph, const QVector<int> &reverseMap) const
-{
- uint glyphIndex = glyph_indices[glyph];
-
- if (glyphIndex == 0)
- return "/.notdef";
-
- QByteArray ba;
- QPdf::ByteStream s(&ba);
- if (reverseMap[glyphIndex] && reverseMap[glyphIndex] < 0x10000) {
- s << '/' << glyphName(reverseMap[glyphIndex], false);
- } else {
- s << "/gl" << (int)glyphIndex;
- }
- return ba;
-}
-
-
QByteArray QFontSubset::widthArray() const
{
Q_ASSERT(!widths.isEmpty());
@@ -142,7 +90,7 @@ QByteArray QFontSubset::widthArray() const
QFixed defWidth = widths[0];
//qDebug("defWidth=%d, scale=%f", defWidth.toInt(), scale.toReal());
- for (int i = 0; i < nGlyphs(); ++i) {
+ for (qsizetype i = 0; i < nGlyphs(); ++i) {
if (defWidth != widths[i])
defWidth = 0;
}
@@ -150,10 +98,10 @@ QByteArray QFontSubset::widthArray() const
s << "/DW " << qRound(defWidth.toInt() * scale);
} else {
s << "/W [";
- for (int g = 0; g < nGlyphs();) {
+ for (qsizetype g = 0; g < nGlyphs();) {
QFixed w = widths[g];
- int start = g;
- int startLinear = 0;
+ qsizetype start = g;
+ qsizetype startLinear = 0;
++g;
while (g < nGlyphs()) {
QFixed nw = widths[g];
@@ -171,11 +119,11 @@ QByteArray QFontSubset::widthArray() const
// qDebug("start=%x startLinear=%x g-1=%x",start,startLinear,g-1);
if (g - startLinear < 10)
startLinear = 0;
- int endnonlinear = startLinear ? startLinear : g;
+ qsizetype endnonlinear = startLinear ? startLinear : g;
// qDebug(" startLinear=%x endnonlinear=%x", startLinear,endnonlinear);
if (endnonlinear > start) {
s << start << '[';
- for (int i = start; i < endnonlinear; ++i)
+ for (qsizetype i = start; i < endnonlinear; ++i)
s << qRound(widths[i].toInt() * scale);
s << "]\n";
}
@@ -197,11 +145,11 @@ static void checkRanges(QPdf::ByteStream &ts, QByteArray &ranges, int &nranges)
}
}
-QVector<int> QFontSubset::getReverseMap() const
+QList<int> QFontSubset::getReverseMap() const
{
- QVector<int> reverseMap(0x10000, 0);
+ QList<int> reverseMap(0x10000, 0);
for (uint uc = 0; uc < 0x10000; ++uc) {
- int idx = glyph_indices.indexOf(fontEngine->glyphIndex(uc));
+ auto idx = glyph_indices.indexOf(fontEngine->glyphIndex(uc));
if (idx >= 0 && !reverseMap.at(idx))
reverseMap[idx] = uc;
}
@@ -210,7 +158,7 @@ QVector<int> QFontSubset::getReverseMap() const
QByteArray QFontSubset::createToUnicodeMap() const
{
- QVector<int> reverseMap = getReverseMap();
+ QList<int> reverseMap = getReverseMap();
QByteArray touc;
QPdf::ByteStream ts(&touc);
@@ -229,14 +177,14 @@ QByteArray QFontSubset::createToUnicodeMap() const
QPdf::ByteStream s(&ranges);
char buf[5];
- for (int g = 1; g < nGlyphs(); ) {
+ for (qsizetype g = 1; g < nGlyphs(); ) {
int uc0 = reverseMap.at(g);
if (!uc0) {
++g;
continue;
}
- int start = g;
- int startLinear = 0;
+ qsizetype start = g;
+ qsizetype startLinear = 0;
++g;
while (g < nGlyphs()) {
int uc = reverseMap[g];
@@ -257,7 +205,7 @@ QByteArray QFontSubset::createToUnicodeMap() const
// qDebug("start=%x startLinear=%x g-1=%x",start,startLinear,g-1);
if (g - startLinear < 10)
startLinear = 0;
- int endnonlinear = startLinear ? startLinear : g;
+ qsizetype endnonlinear = startLinear ? startLinear : g;
// qDebug(" startLinear=%x endnonlinear=%x", startLinear,endnonlinear);
if (endnonlinear > start) {
s << '<' << QPdf::toHex((ushort)start, buf) << "> <";
@@ -266,7 +214,7 @@ QByteArray QFontSubset::createToUnicodeMap() const
s << '<' << QPdf::toHex((ushort)reverseMap[start], buf) << ">\n";
} else {
s << '[';
- for (int i = start; i < endnonlinear; ++i) {
+ for (qsizetype i = start; i < endnonlinear; ++i) {
s << '<' << QPdf::toHex((ushort)reverseMap[i], buf) << "> ";
}
s << "]\n";
@@ -275,9 +223,9 @@ QByteArray QFontSubset::createToUnicodeMap() const
}
if (startLinear) {
while (startLinear < g) {
- int len = g - startLinear;
- int uc_start = reverseMap[startLinear];
- int uc_end = uc_start + len - 1;
+ qsizetype len = g - startLinear;
+ qsizetype uc_start = reverseMap[startLinear];
+ qsizetype uc_end = uc_start + len - 1;
if ((uc_end >> 8) != (uc_start >> 8))
len = 256 - (uc_start & 0xff);
s << '<' << QPdf::toHex((ushort)startLinear, buf) << "> <";
@@ -300,9 +248,9 @@ QByteArray QFontSubset::createToUnicodeMap() const
return touc;
}
-int QFontSubset::addGlyph(int index)
+qsizetype QFontSubset::addGlyph(uint index)
{
- int idx = glyph_indices.indexOf(index);
+ qsizetype idx = glyph_indices.indexOf(index);
if (idx < 0) {
idx = glyph_indices.size();
glyph_indices.append(index);
@@ -343,7 +291,7 @@ struct QTtfTable {
Tag tag;
QByteArray data;
};
-Q_DECLARE_TYPEINFO(QTtfTable, Q_MOVABLE_TYPE);
+Q_DECLARE_TYPEINFO(QTtfTable, Q_RELOCATABLE_TYPE);
struct qttf_head_table {
@@ -391,7 +339,7 @@ struct qttf_name_table {
QString subfamily;
QString postscript_name;
};
-Q_DECLARE_TYPEINFO(qttf_name_table, Q_MOVABLE_TYPE);
+Q_DECLARE_TYPEINFO(qttf_name_table, Q_RELOCATABLE_TYPE);
static QTtfTable generateHead(const qttf_head_table &head);
@@ -419,13 +367,13 @@ struct QTtfGlyph {
quint16 numPoints;
QByteArray data;
};
-Q_DECLARE_TYPEINFO(QTtfGlyph, Q_MOVABLE_TYPE);
+Q_DECLARE_TYPEINFO(QTtfGlyph, Q_RELOCATABLE_TYPE);
static QTtfGlyph generateGlyph(int index, const QPainterPath &path, qreal advance, qreal lsb, qreal ppem);
// generates glyf, loca and hmtx
-static QVector<QTtfTable> generateGlyphTables(qttf_font_tables &tables, const QVector<QTtfGlyph> &_glyphs);
+static QList<QTtfTable> generateGlyphTables(qttf_font_tables &tables, const QList<QTtfGlyph> &_glyphs);
-static QByteArray bindFont(const QVector<QTtfTable>& _tables);
+static QByteArray bindFont(const QList<QTtfTable>& _tables);
static quint32 checksum(const QByteArray &table)
@@ -453,7 +401,7 @@ static QTtfTable generateHead(const qttf_head_table &head)
{
const int head_size = 54;
QTtfTable t;
- t.tag = MAKE_TAG('h', 'e', 'a', 'd');
+ t.tag = QFont::Tag("head").value();
t.data.resize(head_size);
QTtfStream s(t.data);
@@ -524,7 +472,7 @@ static QTtfTable generateHhea(const qttf_hhea_table &hhea)
{
const int hhea_size = 36;
QTtfTable t;
- t.tag = MAKE_TAG('h', 'h', 'e', 'a');
+ t.tag = QFont::Tag("hhea").value();
t.data.resize(hhea_size);
QTtfStream s(t.data);
@@ -575,7 +523,7 @@ static QTtfTable generateMaxp(const qttf_maxp_table &maxp)
{
const int maxp_size = 32;
QTtfTable t;
- t.tag = MAKE_TAG('m', 'a', 'x', 'p');
+ t.tag = QFont::Tag("maxp").value();
t.data.resize(maxp_size);
QTtfStream s(t.data);
@@ -619,13 +567,13 @@ struct QTtfNameRecord {
quint16 nameId;
QString value;
};
-Q_DECLARE_TYPEINFO(QTtfNameRecord, Q_MOVABLE_TYPE);
+Q_DECLARE_TYPEINFO(QTtfNameRecord, Q_RELOCATABLE_TYPE);
-static QTtfTable generateName(const QVector<QTtfNameRecord> &name);
+static QTtfTable generateName(const QList<QTtfNameRecord> &name);
static QTtfTable generateName(const qttf_name_table &name)
{
- QVector<QTtfNameRecord> list;
+ QList<QTtfNameRecord> list;
list.reserve(5);
QTtfNameRecord rec;
rec.nameId = 0;
@@ -639,8 +587,8 @@ static QTtfTable generateName(const qttf_name_table &name)
list.append(rec);
rec.nameId = 4;
rec.value = name.family;
- if (name.subfamily != QLatin1String("Regular"))
- rec.value += QLatin1Char(' ') + name.subfamily;
+ if (name.subfamily != "Regular"_L1)
+ rec.value += u' ' + name.subfamily;
list.append(rec);
rec.nameId = 6;
rec.value = name.postscript_name;
@@ -650,17 +598,17 @@ static QTtfTable generateName(const qttf_name_table &name)
}
// ####### should probably generate Macintosh/Roman name entries as well
-static QTtfTable generateName(const QVector<QTtfNameRecord> &name)
+static QTtfTable generateName(const QList<QTtfNameRecord> &name)
{
const int char_size = 2;
QTtfTable t;
- t.tag = MAKE_TAG('n', 'a', 'm', 'e');
+ t.tag = QFont::Tag("name").value();
const int name_size = 6 + 12*name.size();
int string_size = 0;
for (int i = 0; i < name.size(); ++i) {
- string_size += name.at(i).value.length()*char_size;
+ string_size += name.at(i).value.size()*char_size;
}
t.data.resize(name_size + string_size);
@@ -676,7 +624,7 @@ static QTtfTable generateName(const QVector<QTtfNameRecord> &name)
int off = 0;
for (int i = 0; i < name.size(); ++i) {
- int len = name.at(i).value.length()*char_size;
+ int len = name.at(i).value.size()*char_size;
// quint16 platformID Platform ID.
// quint16 encodingID Platform-specific encoding ID.
// quint16 languageID Language ID.
@@ -692,12 +640,8 @@ static QTtfTable generateName(const QVector<QTtfNameRecord> &name)
off += len;
}
for (int i = 0; i < name.size(); ++i) {
- const QString &n = name.at(i).value;
- const ushort *uc = n.utf16();
- for (int i = 0; i < n.length(); ++i) {
- s << quint16(*uc);
- ++uc;
- }
+ for (QChar ch : name.at(i).value)
+ s << quint16(ch.unicode());
}
return t;
}
@@ -721,7 +665,7 @@ struct TTF_POINT {
};
Q_DECLARE_TYPEINFO(TTF_POINT, Q_PRIMITIVE_TYPE);
-static void convertPath(const QPainterPath &path, QVector<TTF_POINT> *points, QVector<int> *endPoints, qreal ppem)
+static void convertPath(const QPainterPath &path, QList<TTF_POINT> *points, QList<int> *endPoints, qreal ppem)
{
int numElements = path.elementCount();
for (int i = 0; i < numElements - 1; ++i) {
@@ -790,7 +734,7 @@ static void convertPath(const QPainterPath &path, QVector<TTF_POINT> *points, QV
// see if we can optimize out the last onCurve point
int mx = (points->at(points->size() - 2).x + base[2].x) >> 1;
int my = (points->at(points->size() - 2).y + base[2].y) >> 1;
- if (qAbs(mx - base[3].x) <= split_limit && qAbs(my = base[3].y) <= split_limit)
+ if (qAbs(mx - base[3].x) <= split_limit && qAbs(my - base[3].y) <= split_limit)
points->takeLast();
try_reduce = false;
}
@@ -843,7 +787,7 @@ static void convertPath(const QPainterPath &path, QVector<TTF_POINT> *points, QV
endPoints->append(points->size() - 1);
}
-static void getBounds(const QVector<TTF_POINT> &points, qint16 *xmin, qint16 *xmax, qint16 *ymin, qint16 *ymax)
+static void getBounds(const QList<TTF_POINT> &points, qint16 *xmin, qint16 *xmax, qint16 *ymin, qint16 *ymax)
{
*xmin = points.at(0).x;
*xmax = *xmin;
@@ -858,7 +802,7 @@ static void getBounds(const QVector<TTF_POINT> &points, qint16 *xmin, qint16 *xm
}
}
-static int convertToRelative(QVector<TTF_POINT> *points)
+static int convertToRelative(QList<TTF_POINT> *points)
{
// convert points to relative and setup flags
// qDebug("relative points:");
@@ -911,13 +855,13 @@ static int convertToRelative(QVector<TTF_POINT> *points)
return point_array_size;
}
-static void getGlyphData(QTtfGlyph *glyph, const QVector<TTF_POINT> &points, const QVector<int> &endPoints, int point_array_size)
+static void getGlyphData(QTtfGlyph *glyph, const QList<TTF_POINT> &points, const QList<int> &endPoints, int point_array_size)
{
- const int max_size = 5*sizeof(qint16) // header
- + endPoints.size()*sizeof(quint16) // end points of contours
- + sizeof(quint16) // instruction length == 0
- + points.size()*(1) // flags
- + point_array_size; // coordinates
+ const int max_size = int(5 * sizeof(qint16) // header
+ + endPoints.size() * sizeof(quint16) // end points of contours
+ + sizeof(quint16) // instruction length == 0
+ + points.size()*(1) // flags
+ + point_array_size); // coordinates
glyph->data.resize(max_size);
@@ -961,8 +905,8 @@ static void getGlyphData(QTtfGlyph *glyph, const QVector<TTF_POINT> &points, con
static QTtfGlyph generateGlyph(int index, const QPainterPath &path, qreal advance, qreal lsb, qreal ppem)
{
- QVector<TTF_POINT> points;
- QVector<int> endPoints;
+ QList<TTF_POINT> points;
+ QList<int> endPoints;
QTtfGlyph glyph;
glyph.index = index;
glyph.advanceWidth = qRound(advance * 2048. / ppem);
@@ -997,10 +941,10 @@ static bool operator <(const QTtfGlyph &g1, const QTtfGlyph &g2)
return g1.index < g2.index;
}
-static QVector<QTtfTable> generateGlyphTables(qttf_font_tables &tables, const QVector<QTtfGlyph> &_glyphs)
+static QList<QTtfTable> generateGlyphTables(qttf_font_tables &tables, const QList<QTtfGlyph> &_glyphs)
{
const int max_size_small = 65536*2;
- QVector<QTtfGlyph> glyphs = _glyphs;
+ QList<QTtfGlyph> glyphs = _glyphs;
std::sort(glyphs.begin(), glyphs.end());
Q_ASSERT(tables.maxp.numGlyphs == glyphs.at(glyphs.size()-1).index + 1);
@@ -1014,15 +958,15 @@ static QVector<QTtfTable> generateGlyphTables(qttf_font_tables &tables, const QV
tables.hhea.numberOfHMetrics = nGlyphs;
QTtfTable glyf;
- glyf.tag = MAKE_TAG('g', 'l', 'y', 'f');
+ glyf.tag = QFont::Tag("glyf").value();
QTtfTable loca;
- loca.tag = MAKE_TAG('l', 'o', 'c', 'a');
+ loca.tag = QFont::Tag("loca").value();
loca.data.resize(glyf_size < max_size_small ? (nGlyphs+1)*sizeof(quint16) : (nGlyphs+1)*sizeof(quint32));
QTtfStream ls(loca.data);
QTtfTable hmtx;
- hmtx.tag = MAKE_TAG('h', 'm', 't', 'x');
+ hmtx.tag = QFont::Tag("hmtx").value();
hmtx.data.resize(nGlyphs*4);
QTtfStream hs(hmtx.data);
@@ -1063,7 +1007,7 @@ static QVector<QTtfTable> generateGlyphTables(qttf_font_tables &tables, const QV
Q_ASSERT(loca.data.size() == ls.offset());
Q_ASSERT(hmtx.data.size() == hs.offset());
- QVector<QTtfTable> list;
+ QList<QTtfTable> list;
list.reserve(3);
list.append(glyf);
list.append(loca);
@@ -1076,9 +1020,9 @@ static bool operator <(const QTtfTable &t1, const QTtfTable &t2)
return t1.tag < t2.tag;
}
-static QByteArray bindFont(const QVector<QTtfTable>& _tables)
+static QByteArray bindFont(const QList<QTtfTable>& _tables)
{
- QVector<QTtfTable> tables = _tables;
+ QList<QTtfTable> tables = _tables;
std::sort(tables.begin(), tables.end());
@@ -1122,12 +1066,12 @@ static QByteArray bindFont(const QVector<QTtfTable>& _tables)
for (int i = 0; i < tables.size(); ++i) {
const QTtfTable &t = tables.at(i);
const quint32 size = (t.data.size() + 3) & ~3;
- if (t.tag == MAKE_TAG('h', 'e', 'a', 'd'))
+ if (t.tag == QFont::Tag("head").value())
head_offset = table_offset;
f << t.tag
<< checksum(t.data)
<< table_offset
- << t.data.size();
+ << quint32(t.data.size());
table_offset += size;
#define TAG(x) char(t.tag >> 24) << char((t.tag >> 16) & 0xff) << char((t.tag >> 8) & 0xff) << char(t.tag & 0xff)
//qDebug() << "table " << TAG(t.tag) << "has size " << t.data.size() << "stream at " << f.offset();
@@ -1203,13 +1147,12 @@ QByteArray QFontSubset::toTruetype() const
font.maxp.maxCompositeContours = 0;
font.maxp.maxComponentElements = 0;
font.maxp.maxComponentDepth = 0;
- const int numGlyphs = nGlyphs();
- font.maxp.numGlyphs = numGlyphs;
- QVector<QTtfGlyph> glyphs;
+ const qsizetype numGlyphs = nGlyphs();
+ font.maxp.numGlyphs = quint16(numGlyphs);
+ QList<QTtfGlyph> glyphs;
glyphs.reserve(numGlyphs);
- uint sumAdvances = 0;
- for (int i = 0; i < numGlyphs; ++i) {
+ for (qsizetype i = 0; i < numGlyphs; ++i) {
glyph_t g = glyph_indices.at(i);
QPainterPath path;
glyph_metrics_t metric;
@@ -1231,40 +1174,37 @@ QByteArray QFontSubset::toTruetype() const
font.maxp.maxPoints = qMax(font.maxp.maxPoints, glyph.numPoints);
font.maxp.maxContours = qMax(font.maxp.maxContours, glyph.numContours);
- if (glyph.xMax > glyph.xMin)
- sumAdvances += glyph.xMax - glyph.xMin;
-
// qDebug("adding glyph %d size=%d", glyph.index, glyph.data.size());
glyphs.append(glyph);
widths[i] = glyph.advanceWidth;
}
- QVector<QTtfTable> tables = generateGlyphTables(font, glyphs);
+ QList<QTtfTable> tables = generateGlyphTables(font, glyphs);
tables.append(generateHead(font.head));
tables.append(generateHhea(font.hhea));
tables.append(generateMaxp(font.maxp));
// name
QTtfTable name_table;
- name_table.tag = MAKE_TAG('n', 'a', 'm', 'e');
+ name_table.tag = QFont::Tag("name").value();
if (!noEmbed)
name_table.data = fontEngine->getSfntTable(name_table.tag);
if (name_table.data.isEmpty()) {
qttf_name_table name;
if (noEmbed)
- name.copyright = QLatin1String("Fake font");
+ name.copyright = "Fake font"_L1;
else
- name.copyright = QLatin1String(properties.copyright);
- name.family = fontEngine->fontDef.family;
- name.subfamily = QLatin1String("Regular"); // ######
- name.postscript_name = QLatin1String(properties.postscriptName);
+ name.copyright = QLatin1StringView(properties.copyright);
+ name.family = fontEngine->fontDef.families.constFirst();
+ name.subfamily = "Regular"_L1; // ######
+ name.postscript_name = QLatin1StringView(properties.postscriptName);
name_table = generateName(name);
}
tables.append(name_table);
if (!noEmbed) {
QTtfTable os2;
- os2.tag = MAKE_TAG('O', 'S', '/', '2');
+ os2.tag = QFont::Tag("OS/2").value();
os2.data = fontEngine->getSfntTable(os2.tag);
if (!os2.data.isEmpty())
tables.append(os2);
diff --git a/src/gui/text/qfontsubset_agl.cpp b/src/gui/text/qfontsubset_agl.cpp
index d96808703a..603f277d3f 100644
--- a/src/gui/text/qfontsubset_agl.cpp
+++ b/src/gui/text/qfontsubset_agl.cpp
@@ -1,41 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the QtGui module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
/* This file is autogenerated from the Adobe Glyph List database v1.7. Do not edit */
diff --git a/src/gui/text/qfontsubset_p.h b/src/gui/text/qfontsubset_p.h
index e7c6053beb..1ec47f176d 100644
--- a/src/gui/text/qfontsubset_p.h
+++ b/src/gui/text/qfontsubset_p.h
@@ -1,41 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the QtGui module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#ifndef QFONTSUBSET_P_H
#define QFONTSUBSET_P_H
@@ -59,7 +23,7 @@ QT_BEGIN_NAMESPACE
class QFontSubset
{
public:
- explicit QFontSubset(QFontEngine *fe, int obj_id = 0)
+ explicit QFontSubset(QFontEngine *fe, uint obj_id = 0)
: object_id(obj_id), noEmbed(false), fontEngine(fe), downloaded_glyphs(0), standard_font(false)
{
fontEngine->ref.ref();
@@ -76,22 +40,21 @@ public:
#ifndef QT_NO_PDF
QByteArray widthArray() const;
QByteArray createToUnicodeMap() const;
- QVector<int> getReverseMap() const;
- QByteArray glyphName(unsigned int glyph, const QVector<int> &reverseMap) const;
+ QList<int> getReverseMap() const;
static QByteArray glyphName(unsigned short unicode, bool symbol);
- int addGlyph(int index);
+ qsizetype addGlyph(uint index);
#endif
- const int object_id;
+ const uint object_id;
bool noEmbed;
QFontEngine *fontEngine;
- QVector<int> glyph_indices;
+ QList<uint> glyph_indices;
mutable int downloaded_glyphs;
mutable bool standard_font;
- int nGlyphs() const { return glyph_indices.size(); }
+ qsizetype nGlyphs() const { return glyph_indices.size(); }
mutable QFixed emSquare;
- mutable QVector<QFixed> widths;
+ mutable QList<QFixed> widths;
};
QT_END_NAMESPACE
diff --git a/src/gui/text/qfragmentmap.cpp b/src/gui/text/qfragmentmap.cpp
index 7dd8999d58..4d55b009d7 100644
--- a/src/gui/text/qfragmentmap.cpp
+++ b/src/gui/text/qfragmentmap.cpp
@@ -1,41 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the QtGui module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#include <private/qtools_p.h>
diff --git a/src/gui/text/qfragmentmap_p.h b/src/gui/text/qfragmentmap_p.h
index 1d781352f8..af884d1f62 100644
--- a/src/gui/text/qfragmentmap_p.h
+++ b/src/gui/text/qfragmentmap_p.h
@@ -1,41 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the QtGui module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#ifndef QFRAGMENTMAP_P_H
#define QFRAGMENTMAP_P_H
diff --git a/src/gui/text/qglyphrun.cpp b/src/gui/text/qglyphrun.cpp
index f4cd839f15..4252d9e7f1 100644
--- a/src/gui/text/qglyphrun.cpp
+++ b/src/gui/text/qglyphrun.cpp
@@ -1,41 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the QtGui module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#include "qglobal.h"
@@ -222,12 +186,12 @@ void QGlyphRun::setRawFont(const QRawFont &rawFont)
\sa setGlyphIndexes(), setPositions()
*/
-QVector<quint32> QGlyphRun::glyphIndexes() const
+QList<quint32> QGlyphRun::glyphIndexes() const
{
if (d->glyphIndexes.constData() == d->glyphIndexData) {
return d->glyphIndexes;
} else {
- QVector<quint32> indexes(d->glyphIndexDataSize);
+ QList<quint32> indexes(d->glyphIndexDataSize);
memcpy(indexes.data(), d->glyphIndexData, d->glyphIndexDataSize * sizeof(quint32));
return indexes;
}
@@ -237,10 +201,10 @@ QVector<quint32> QGlyphRun::glyphIndexes() const
Set the glyph indexes for this QGlyphRun object to \a glyphIndexes. The glyph indexes must
be valid for the selected font.
*/
-void QGlyphRun::setGlyphIndexes(const QVector<quint32> &glyphIndexes)
+void QGlyphRun::setGlyphIndexes(const QList<quint32> &glyphIndexes)
{
detach();
- d->glyphIndexes = glyphIndexes; // Keep a reference to the QVector to avoid copying
+ d->glyphIndexes = glyphIndexes; // Keep a reference to the QList to avoid copying
d->glyphIndexData = glyphIndexes.constData();
d->glyphIndexDataSize = glyphIndexes.size();
}
@@ -248,12 +212,12 @@ void QGlyphRun::setGlyphIndexes(const QVector<quint32> &glyphIndexes)
/*!
Returns the position of the edge of the baseline for each glyph in this set of glyph indexes.
*/
-QVector<QPointF> QGlyphRun::positions() const
+QList<QPointF> QGlyphRun::positions() const
{
if (d->glyphPositions.constData() == d->glyphPositionData) {
return d->glyphPositions;
} else {
- QVector<QPointF> glyphPositions(d->glyphPositionDataSize);
+ QList<QPointF> glyphPositions(d->glyphPositionDataSize);
memcpy(glyphPositions.data(), d->glyphPositionData,
d->glyphPositionDataSize * sizeof(QPointF));
return glyphPositions;
@@ -264,10 +228,10 @@ QVector<QPointF> QGlyphRun::positions() const
Sets the positions of the edge of the baseline for each glyph in this set of glyph indexes to
\a positions.
*/
-void QGlyphRun::setPositions(const QVector<QPointF> &positions)
+void QGlyphRun::setPositions(const QList<QPointF> &positions)
{
detach();
- d->glyphPositions = positions; // Keep a reference to the vector to avoid copying
+ d->glyphPositions = positions; // Keep a reference to the list to avoid copying
d->glyphPositionData = positions.constData();
d->glyphPositionDataSize = positions.size();
}
@@ -281,8 +245,8 @@ void QGlyphRun::clear()
d->rawFont = QRawFont();
d->flags = { };
- setPositions(QVector<QPointF>());
- setGlyphIndexes(QVector<quint32>());
+ setPositions(QList<QPointF>());
+ setGlyphIndexes(QList<quint32>());
}
/*!
@@ -434,7 +398,7 @@ void QGlyphRun::setFlags(GlyphRunFlags flags)
/*!
Sets the bounding rect of the glyphs in this QGlyphRun to be \a boundingRect. This rectangle
- will be returned by boundingRect() unless it is empty, in which case the bounding rectangle of the
+ will be returned by boundingRect() unless it is null, in which case the bounding rectangle of the
glyphs in the glyph run will be returned instead.
\note Unless you are implementing text shaping, you should not have to use this function.
@@ -468,7 +432,7 @@ void QGlyphRun::setBoundingRect(const QRectF &boundingRect)
*/
QRectF QGlyphRun::boundingRect() const
{
- if (!d->boundingRect.isEmpty() || !d->rawFont.isValid())
+ if (!d->boundingRect.isNull() || !d->rawFont.isValid())
return d->boundingRect;
qreal minX, minY, maxX, maxY;
@@ -501,7 +465,80 @@ QRectF QGlyphRun::boundingRect() const
*/
bool QGlyphRun::isEmpty() const
{
- return d->glyphIndexDataSize == 0;
+ return d->glyphIndexDataSize == 0
+ && d->glyphPositionDataSize == 0
+ && d->stringIndexes.isEmpty()
+ && d->sourceString.isEmpty();
+}
+
+/*!
+ \since 6.5
+
+ Returns the string indexes corresponding to each glyph index, if the glyph run has been
+ constructed from a string and string indexes have been requested from the layout. In this case,
+ the length of the returned vector will correspond to the length of glyphIndexes(). In other
+ cases, it will be empty.
+
+ Since a single glyph may correspond to multiple characters in the source string, there may be
+ gaps in the list of string indexes. For instance, if the string "first" is processed by a font
+ which contains a ligature for the character pair "fi", then the five character string will
+ generate a glyph run consisting of only four glyphs. Then the glyph indexes may in this case be
+ (1, 2, 3, 4) (four arbitrary glyph indexes) whereas the string indexes would be (0, 2, 3, 4).
+ The glyphs are in the logical order of the string, thus it is implied that the first glyphs
+ spans characters 0 and 1 in this case.
+
+ Inversely, a single character may also generate multiple glyphs, in which case there will be
+ duplicate entries in the list of string indexes.
+
+ The string indexes correspond to the string, optionally available through sourceString().
+
+ \sa setStringIndexes(), sourceString(), QTextLayout::glyphRuns()
+*/
+QList<qsizetype> QGlyphRun::stringIndexes() const
+{
+ return d->stringIndexes;
+}
+
+/*!
+ \since 6.5
+
+ Sets the list of string indexes corresponding to the glyph indexes to \a stringIndexes
+
+ See stringIndexes() for more details on the conventions of this list.
+
+ \sa sourceString()
+ */
+void QGlyphRun::setStringIndexes(const QList<qsizetype> &stringIndexes)
+{
+ detach();
+ d->stringIndexes = stringIndexes;
+}
+
+/*!
+ \since 6.5
+
+ Returns the string corresponding to the glyph run, if the glyph run has been created from
+ a string and the string has been requested from the layout.
+
+ \sa setSourceString(), stringIndexes(), QTextLayout::glyphRuns()
+ */
+QString QGlyphRun::sourceString() const
+{
+ return d->sourceString;
+}
+
+/*!
+ \since 6.5
+
+ Set the string corresponding to the glyph run to \a sourceString. If set, the indexes returned
+ by stringIndexes() should be indexes into this string.
+
+ \sa sourceString(), stringIndexes()
+ */
+void QGlyphRun::setSourceString(const QString &sourceString)
+{
+ detach();
+ d->sourceString = sourceString;
}
QT_END_NAMESPACE
diff --git a/src/gui/text/qglyphrun.h b/src/gui/text/qglyphrun.h
index 15e315bea2..88f9957dd8 100644
--- a/src/gui/text/qglyphrun.h
+++ b/src/gui/text/qglyphrun.h
@@ -1,50 +1,14 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the QtGui module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#ifndef QGLYPHRUN_H
#define QGLYPHRUN_H
#include <QtGui/qtguiglobal.h>
-#include <QtCore/qsharedpointer.h>
-#include <QtCore/qvector.h>
+#include <QtCore/qlist.h>
#include <QtCore/qpoint.h>
#include <QtGui/qrawfont.h>
+#include <QtCore/qshareddata.h>
#if !defined(QT_NO_RAWFONT)
@@ -66,11 +30,11 @@ public:
QGlyphRun();
QGlyphRun(const QGlyphRun &other);
- QGlyphRun &operator=(QGlyphRun &&other) noexcept { swap(other); return *this; }
+ QT_MOVE_ASSIGNMENT_OPERATOR_IMPL_VIA_PURE_SWAP(QGlyphRun)
QGlyphRun &operator=(const QGlyphRun &other);
~QGlyphRun();
- void swap(QGlyphRun &other) noexcept { qSwap(d, other.d); }
+ void swap(QGlyphRun &other) noexcept { d.swap(other.d); }
QRawFont rawFont() const;
void setRawFont(const QRawFont &rawFont);
@@ -79,11 +43,11 @@ public:
const QPointF *glyphPositionArray,
int size);
- QVector<quint32> glyphIndexes() const;
- void setGlyphIndexes(const QVector<quint32> &glyphIndexes);
+ QList<quint32> glyphIndexes() const;
+ void setGlyphIndexes(const QList<quint32> &glyphIndexes);
- QVector<QPointF> positions() const;
- void setPositions(const QVector<QPointF> &positions);
+ QList<QPointF> positions() const;
+ void setPositions(const QList<QPointF> &positions);
void clear();
@@ -110,6 +74,12 @@ public:
void setBoundingRect(const QRectF &boundingRect);
QRectF boundingRect() const;
+ QList<qsizetype> stringIndexes() const;
+ void setStringIndexes(const QList<qsizetype> &stringIndexes);
+
+ void setSourceString(const QString &sourceString);
+ QString sourceString() const;
+
bool isEmpty() const;
private:
diff --git a/src/gui/text/qglyphrun_p.h b/src/gui/text/qglyphrun_p.h
index 46e2a8bbfb..db160344c6 100644
--- a/src/gui/text/qglyphrun_p.h
+++ b/src/gui/text/qglyphrun_p.h
@@ -1,41 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the QtGui module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#ifndef QGLYPHRUN_P_H
#define QGLYPHRUN_P_H
@@ -51,6 +15,7 @@
// We mean it.
//
+#include <QtCore/qshareddata.h>
#include <QtGui/private/qtguiglobal_p.h>
#include "qglyphrun.h"
#include "qrawfont.h"
@@ -78,8 +43,10 @@ public:
: QSharedData(other)
, glyphIndexes(other.glyphIndexes)
, glyphPositions(other.glyphPositions)
+ , stringIndexes(other.stringIndexes)
, rawFont(other.rawFont)
, boundingRect(other.boundingRect)
+ , sourceString(other.sourceString)
, flags(other.flags)
, glyphIndexData(other.glyphIndexData)
, glyphIndexDataSize(other.glyphIndexDataSize)
@@ -90,10 +57,12 @@ public:
{
}
- QVector<quint32> glyphIndexes;
- QVector<QPointF> glyphPositions;
+ QList<quint32> glyphIndexes;
+ QList<QPointF> glyphPositions;
+ QList<qsizetype> stringIndexes;
QRawFont rawFont;
QRectF boundingRect;
+ QString sourceString;
QGlyphRun::GlyphRunFlags flags;
diff --git a/src/gui/text/qharfbuzzng.cpp b/src/gui/text/qharfbuzzng.cpp
index 397e6cc49f..5db6f78319 100644
--- a/src/gui/text/qharfbuzzng.cpp
+++ b/src/gui/text/qharfbuzzng.cpp
@@ -1,47 +1,10 @@
-/****************************************************************************
-**
-** Copyright (C) 2019 The Qt Company Ltd.
-** Copyright (C) 2013 Konstantin Ritt
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the QtGui module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2020 The Qt Company Ltd.
+// Copyright (C) 2013 Konstantin Ritt
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#include "qharfbuzzng_p.h"
#include <qstring.h>
-#include <qvector.h>
#include <private/qstringiterator_p.h>
@@ -82,7 +45,7 @@ static const hb_script_t _qtscript_to_hbscript[] = {
HB_SCRIPT_HANGUL,
HB_SCRIPT_ETHIOPIC,
HB_SCRIPT_CHEROKEE,
- HB_SCRIPT_CANADIAN_ABORIGINAL,
+ HB_SCRIPT_CANADIAN_SYLLABICS,
HB_SCRIPT_OGHAM,
HB_SCRIPT_RUNIC,
HB_SCRIPT_KHMER,
@@ -218,20 +181,57 @@ static const hb_script_t _qtscript_to_hbscript[] = {
HB_SCRIPT_SOYOMBO,
HB_SCRIPT_ZANABAZAR_SQUARE,
- // Unicode 12.1 additions (not present in harfbuzz-ng 1.7.4)
- hb_script_t(HB_TAG('D', 'o', 'g', 'r')), // Script_Dogra
- hb_script_t(HB_TAG('G', 'o', 'n', 'g')), // Script_GunjalaGondi
- hb_script_t(HB_TAG('R', 'o', 'h', 'g')), // Script_HanifiRohingya
- hb_script_t(HB_TAG('M', 'a', 'k', 'a')), // Script_Makasar
- hb_script_t(HB_TAG('M', 'e', 'd', 'f')), // Script_Medefaidrin
- hb_script_t(HB_TAG('S', 'o', 'g', 'o')), // Script_OldSogdian
- hb_script_t(HB_TAG('S', 'o', 'g', 'd')), // Script_Sogdian
- hb_script_t(HB_TAG('E', 'l', 'y', 'm')), // Script_Elymaic
- hb_script_t(HB_TAG('N', 'a', 'n', 'd')), // Script_Nandinagari
- hb_script_t(HB_TAG('H', 'm', 'n', 'p')), // Script_NyiakengPuachueHmong
- hb_script_t(HB_TAG('W', 'c', 'h', 'o')), // Script_Wancho
+ // Unicode 11.0 additions
+ HB_SCRIPT_DOGRA,
+ HB_SCRIPT_GUNJALA_GONDI,
+ HB_SCRIPT_HANIFI_ROHINGYA,
+ HB_SCRIPT_MAKASAR,
+ HB_SCRIPT_MEDEFAIDRIN,
+ HB_SCRIPT_OLD_SOGDIAN,
+ HB_SCRIPT_SOGDIAN,
+
+ // Unicode 12.0 additions
+ HB_SCRIPT_ELYMAIC,
+ HB_SCRIPT_NANDINAGARI,
+ HB_SCRIPT_NYIAKENG_PUACHUE_HMONG,
+ HB_SCRIPT_WANCHO,
+
+ // Unicode 13.0 additions (not present in harfbuzz-ng 2.6.6 and earlier)
+#if !HB_VERSION_ATLEAST(2, 6, 7)
+ hb_script_t(HB_TAG('C', 'h', 'r', 's')), // Script_Chorasmian
+ hb_script_t(HB_TAG('D', 'i', 'a', 'k')), // Script_DivesAkuru
+ hb_script_t(HB_TAG('K', 'i', 't', 's')), // Script_KhitanSmallScript
+ hb_script_t(HB_TAG('Y', 'e', 'z', 'i')), // Script_Yezidi
+#else
+ HB_SCRIPT_CHORASMIAN,
+ HB_SCRIPT_DIVES_AKURU,
+ HB_SCRIPT_KHITAN_SMALL_SCRIPT,
+ HB_SCRIPT_YEZIDI,
+#endif
+ // Unicode 14.0 additions (not present in harfbuzz-ng 2.9.1 and earlier)
+#if !HB_VERSION_ATLEAST(3, 0, 0)
+ hb_script_t(HB_TAG('C','p','m','n')), // Script_CyproMinoan
+ hb_script_t(HB_TAG('O','u','g','r')), // Script_OldUyghur
+ hb_script_t(HB_TAG('T','n','s','a')), // Script_Tangsa
+ hb_script_t(HB_TAG('T','o','t','o')), // Script_Toto
+ hb_script_t(HB_TAG('V','i','t','h')), // Script_Vithkuqi
+#else
+ HB_SCRIPT_CYPRO_MINOAN,
+ HB_SCRIPT_OLD_UYGHUR,
+ HB_SCRIPT_TANGSA,
+ HB_SCRIPT_TOTO,
+ HB_SCRIPT_VITHKUQI,
+#endif
+ // Unicode 15.0 additions (not present in harfbuzz-ng 5.1.0 and earlier)
+#if !HB_VERSION_ATLEAST(5, 2, 0)
+ hb_script_t(HB_TAG('K','a','w','i')), // Script_Kawi
+ hb_script_t(HB_TAG('N','a','g','m')), // Script_NagMundari
+#else
+ HB_SCRIPT_KAWI,
+ HB_SCRIPT_NAG_MUNDARI,
+#endif
};
-Q_STATIC_ASSERT(QChar::ScriptCount == sizeof(_qtscript_to_hbscript) / sizeof(_qtscript_to_hbscript[0]));
+static_assert(QChar::ScriptCount == sizeof(_qtscript_to_hbscript) / sizeof(_qtscript_to_hbscript[0]));
hb_script_t hb_qt_script_to_script(QChar::Script script)
{
@@ -255,15 +255,6 @@ _hb_qt_unicode_combining_class(hb_unicode_funcs_t * /*ufuncs*/,
return hb_unicode_combining_class_t(QChar::combiningClass(unicode));
}
-static unsigned int
-_hb_qt_unicode_eastasian_width(hb_unicode_funcs_t * /*ufuncs*/,
- hb_codepoint_t /*unicode*/,
- void * /*user_data*/)
-{
- qCritical("hb_qt_unicode_eastasian_width: not implemented!");
- return 1;
-}
-
static const hb_unicode_general_category_t _qtcategory_to_hbcategory[] = {
HB_UNICODE_GENERAL_CATEGORY_NON_SPACING_MARK, // Mn
HB_UNICODE_GENERAL_CATEGORY_SPACING_MARK, // Mc
@@ -334,7 +325,10 @@ _hb_qt_unicode_compose(hb_unicode_funcs_t * /*ufuncs*/,
void * /*user_data*/)
{
// ### optimize
- QString s = QString::fromUcs4(&a, 1) + QString::fromUcs4(&b, 1);
+ QString s;
+ s.reserve(4);
+ s += QChar::fromUcs4(a);
+ s += QChar::fromUcs4(b);
QString normalized = s.normalized(QString::NormalizationForm_C);
QStringIterator it(normalized);
@@ -399,37 +393,17 @@ _hb_qt_unicode_decompose(hb_unicode_funcs_t * /*ufuncs*/,
return true;
}
-static unsigned int
-_hb_qt_unicode_decompose_compatibility(hb_unicode_funcs_t * /*ufuncs*/,
- hb_codepoint_t u,
- hb_codepoint_t *decomposed,
- void * /*user_data*/)
-{
- const QString normalized = QChar::decomposition(u);
-
- uint outlen = 0;
- QStringIterator it(normalized);
- while (it.hasNext()) {
- Q_ASSERT(outlen < HB_UNICODE_MAX_DECOMPOSITION_LEN);
- decomposed[outlen++] = it.next();
- }
-
- return outlen;
-}
-
struct _hb_unicode_funcs_t {
_hb_unicode_funcs_t()
{
funcs = hb_unicode_funcs_create(NULL);
hb_unicode_funcs_set_combining_class_func(funcs, _hb_qt_unicode_combining_class, NULL, NULL);
- hb_unicode_funcs_set_eastasian_width_func(funcs, _hb_qt_unicode_eastasian_width, NULL, NULL);
hb_unicode_funcs_set_general_category_func(funcs, _hb_qt_unicode_general_category, NULL, NULL);
hb_unicode_funcs_set_mirroring_func(funcs, _hb_qt_unicode_mirroring, NULL, NULL);
hb_unicode_funcs_set_script_func(funcs, _hb_qt_unicode_script, NULL, NULL);
hb_unicode_funcs_set_compose_func(funcs, _hb_qt_unicode_compose, NULL, NULL);
hb_unicode_funcs_set_decompose_func(funcs, _hb_qt_unicode_decompose, NULL, NULL);
- hb_unicode_funcs_set_decompose_compatibility_func(funcs, _hb_qt_unicode_decompose_compatibility, NULL, NULL);
}
~_hb_unicode_funcs_t()
{
@@ -613,11 +587,6 @@ struct _hb_qt_font_funcs_t {
Q_GLOBAL_STATIC(_hb_qt_font_funcs_t, qt_ffuncs)
-hb_font_funcs_t *hb_qt_get_font_funcs()
-{
- return qt_ffuncs()->funcs;
-}
-
static hb_blob_t *
_hb_qt_reference_table(hb_face_t * /*face*/, hb_tag_t tag, void *user_data)
@@ -633,13 +602,14 @@ _hb_qt_reference_table(hb_face_t * /*face*/, hb_tag_t tag, void *user_data)
return hb_blob_get_empty();
char *buffer = static_cast<char *>(malloc(length));
- Q_CHECK_PTR(buffer);
+ if (q_check_ptr(buffer) == nullptr)
+ return nullptr;
if (Q_UNLIKELY(!get_font_table(data->user_data, tag, reinterpret_cast<uchar *>(buffer), &length)))
- length = 0;
+ return nullptr;
return hb_blob_create(const_cast<const char *>(buffer), length,
- HB_MEMORY_MODE_READONLY,
+ HB_MEMORY_MODE_WRITABLE,
buffer, free);
}
@@ -652,10 +622,6 @@ _hb_qt_face_create(QFontEngine *fe)
data->get_font_table = fe->faceData.get_font_table;
hb_face_t *face = hb_face_create_for_tables(_hb_qt_reference_table, (void *)data, free);
- if (Q_UNLIKELY(hb_face_is_immutable(face))) {
- hb_face_destroy(face);
- return NULL;
- }
hb_face_set_index(face, fe->faceId().index);
hb_face_set_upem(face, fe->emSquareSize().truncate());
@@ -666,8 +632,7 @@ _hb_qt_face_create(QFontEngine *fe)
static void
_hb_qt_face_release(void *user_data)
{
- if (Q_LIKELY(user_data))
- hb_face_destroy(static_cast<hb_face_t *>(user_data));
+ hb_face_destroy(static_cast<hb_face_t *>(user_data));
}
hb_face_t *hb_qt_face_get_for_engine(QFontEngine *fe)
@@ -685,20 +650,13 @@ static inline hb_font_t *
_hb_qt_font_create(QFontEngine *fe)
{
hb_face_t *face = hb_qt_face_get_for_engine(fe);
- if (Q_UNLIKELY(!face))
- return NULL;
hb_font_t *font = hb_font_create(face);
- if (Q_UNLIKELY(hb_font_is_immutable(font))) {
- hb_font_destroy(font);
- return NULL;
- }
-
const qreal y_ppem = fe->fontDef.pixelSize;
const qreal x_ppem = (fe->fontDef.pixelSize * fe->fontDef.stretch) / 100.0;
- hb_font_set_funcs(font, hb_qt_get_font_funcs(), (void *)fe, NULL);
+ hb_font_set_funcs(font, qt_ffuncs()->funcs, fe, nullptr);
hb_font_set_scale(font, QFixed::fromReal(x_ppem).value(), -QFixed::fromReal(y_ppem).value());
hb_font_set_ppem(font, int(x_ppem), int(y_ppem));
@@ -710,8 +668,7 @@ _hb_qt_font_create(QFontEngine *fe)
static void
_hb_qt_font_release(void *user_data)
{
- if (Q_LIKELY(user_data))
- hb_font_destroy(static_cast<hb_font_t *>(user_data));
+ hb_font_destroy(static_cast<hb_font_t *>(user_data));
}
hb_font_t *hb_qt_font_get_for_engine(QFontEngine *fe)
diff --git a/src/gui/text/qharfbuzzng_p.h b/src/gui/text/qharfbuzzng_p.h
index fabf222bae..a46251a4c4 100644
--- a/src/gui/text/qharfbuzzng_p.h
+++ b/src/gui/text/qharfbuzzng_p.h
@@ -1,42 +1,6 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Copyright (C) 2013 Konstantin Ritt
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the QtGui module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// Copyright (C) 2013 Konstantin Ritt
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#ifndef QHARFBUZZNG_P_H
#define QHARFBUZZNG_P_H
@@ -58,24 +22,33 @@ QT_REQUIRE_CONFIG(harfbuzz);
#include <QtCore/qchar.h>
-#include <harfbuzz/hb.h>
+#if defined(QT_BUILD_GUI_LIB)
+# include <hb.h>
+#else
+// a minimal set of HB types required for Qt libs other than Gui
+
+typedef struct hb_face_t hb_face_t;
+typedef struct hb_font_t hb_font_t;
+
+#endif // QT_BUILD_GUI_LIB
QT_BEGIN_NAMESPACE
class QFontEngine;
+#if defined(QT_BUILD_GUI_LIB)
+
// Unicode
-Q_GUI_EXPORT hb_script_t hb_qt_script_to_script(QChar::Script script);
-Q_GUI_EXPORT QChar::Script hb_qt_script_from_script(hb_script_t script);
+hb_script_t hb_qt_script_to_script(QChar::Script script);
+QChar::Script hb_qt_script_from_script(hb_script_t script);
-Q_GUI_EXPORT hb_unicode_funcs_t *hb_qt_get_unicode_funcs();
+hb_unicode_funcs_t *hb_qt_get_unicode_funcs();
+#endif // QT_BUILD_GUI_LIB
// Font
-Q_GUI_EXPORT hb_font_funcs_t *hb_qt_get_font_funcs();
-
Q_GUI_EXPORT hb_face_t *hb_qt_face_get_for_engine(QFontEngine *fe);
Q_GUI_EXPORT hb_font_t *hb_qt_font_get_for_engine(QFontEngine *fe);
diff --git a/src/gui/text/qinputcontrol.cpp b/src/gui/text/qinputcontrol.cpp
index 3381fdb673..4edd46ff0e 100644
--- a/src/gui/text/qinputcontrol.cpp
+++ b/src/gui/text/qinputcontrol.cpp
@@ -1,41 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the QtGui module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#include "qinputcontrol_p.h"
#include <QtGui/qevent.h>
@@ -79,7 +43,10 @@ bool QInputControl::isAcceptableInput(const QKeyEvent *event) const
if (c.category() == QChar::Other_PrivateUse)
return true;
- if (m_type == TextEdit && c == QLatin1Char('\t'))
+ if (c.isHighSurrogate() && text.size() > 1 && text.at(1).isLowSurrogate())
+ return true;
+
+ if (m_type == TextEdit && c == u'\t')
return true;
return false;
@@ -137,3 +104,5 @@ bool QInputControl::isCommonTextEditShortcut(const QKeyEvent *ke)
}
QT_END_NAMESPACE
+
+#include "moc_qinputcontrol_p.cpp"
diff --git a/src/gui/text/qinputcontrol_p.h b/src/gui/text/qinputcontrol_p.h
index b4c1ca8f8f..fec73e1987 100644
--- a/src/gui/text/qinputcontrol_p.h
+++ b/src/gui/text/qinputcontrol_p.h
@@ -1,41 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the QtGui module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#ifndef QINPUTCONTROL_P_H
#define QINPUTCONTROL_P_H
@@ -53,6 +17,7 @@
#include <QtCore/qobject.h>
#include <qtguiglobal.h>
+#include <private/qglobal_p.h>
QT_BEGIN_NAMESPACE
diff --git a/src/gui/text/qplatformfontdatabase.cpp b/src/gui/text/qplatformfontdatabase.cpp
index 02e25bb6af..a146254f68 100644
--- a/src/gui/text/qplatformfontdatabase.cpp
+++ b/src/gui/text/qplatformfontdatabase.cpp
@@ -1,57 +1,26 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the QtGui module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#include "qplatformfontdatabase.h"
#include <QtGui/private/qfontengine_p.h>
-#include <QtGui/private/qfontengine_qpf2_p.h>
+#include <QtGui/private/qfontdatabase_p.h>
#include <QtGui/QGuiApplication>
#include <QtGui/QScreen>
#include <qpa/qplatformscreen.h>
#include <QtCore/QLibraryInfo>
#include <QtCore/QDir>
#include <QtCore/QMetaEnum>
+#include <QtCore/qendian.h>
#include <algorithm>
#include <iterator>
QT_BEGIN_NAMESPACE
+using namespace Qt::StringLiterals;
+
+Q_LOGGING_CATEGORY(lcQpaFonts, "qt.qpa.fonts")
+
void qt_registerFont(const QString &familyname, const QString &stylename,
const QString &foundryname, int weight,
QFont::Style style, int stretch, bool antialiased,
@@ -63,48 +32,6 @@ void qt_registerAliasToFontFamily(const QString &familyName, const QString &alia
bool qt_isFontFamilyPopulated(const QString &familyName);
/*!
- Registers the pre-rendered QPF2 font contained in the given \a dataArray.
-
- \sa registerFont()
-*/
-void QPlatformFontDatabase::registerQPF2Font(const QByteArray &dataArray, void *handle)
-{
- if (dataArray.size() == 0)
- return;
-
- const uchar *data = reinterpret_cast<const uchar *>(dataArray.constData());
- if (QFontEngineQPF2::verifyHeader(data, dataArray.size())) {
- QString fontName = QFontEngineQPF2::extractHeaderField(data, QFontEngineQPF2::Tag_FontName).toString();
- int pixelSize = QFontEngineQPF2::extractHeaderField(data, QFontEngineQPF2::Tag_PixelSize).toInt();
- QVariant weight = QFontEngineQPF2::extractHeaderField(data, QFontEngineQPF2::Tag_Weight);
- QVariant style = QFontEngineQPF2::extractHeaderField(data, QFontEngineQPF2::Tag_Style);
- QByteArray writingSystemBits = QFontEngineQPF2::extractHeaderField(data, QFontEngineQPF2::Tag_WritingSystems).toByteArray();
-
- if (!fontName.isEmpty() && pixelSize) {
- QFont::Weight fontWeight = QFont::Normal;
- if (weight.type() == QVariant::Int || weight.type() == QVariant::UInt)
- fontWeight = QFont::Weight(weight.toInt());
-
- QFont::Style fontStyle = static_cast<QFont::Style>(style.toInt());
-
- QSupportedWritingSystems writingSystems;
- for (int i = 0; i < writingSystemBits.count(); ++i) {
- uchar currentByte = writingSystemBits.at(i);
- for (int j = 0; j < 8; ++j) {
- if (currentByte & 1)
- writingSystems.setSupported(QFontDatabase::WritingSystem(i * 8 + j));
- currentByte >>= 1;
- }
- }
- QFont::Stretch stretch = QFont::Unstretched;
- registerFont(fontName,QString(),QString(),fontWeight,fontStyle,stretch,true,false,pixelSize,false,writingSystems,handle);
- }
- } else {
- qDebug("header verification of QPF2 font failed. maybe it is corrupt?");
- }
-}
-
-/*!
Registers a font with the given set of attributes describing the font's
foundry, family name, style and stretch information, pixel size, and
supported writing systems. Additional information about whether the font
@@ -123,7 +50,7 @@ void QPlatformFontDatabase::registerQPF2Font(const QByteArray &dataArray, void *
The writing systems supported by the font are specified by the
\a writingSystems argument.
- \sa registerQPF2Font(), registerFontFamily()
+ \sa registerFontFamily()
*/
void QPlatformFontDatabase::registerFont(const QString &familyname, const QString &stylename,
const QString &foundryname, QFont::Weight weight,
@@ -156,18 +83,18 @@ class QWritingSystemsPrivate
public:
QWritingSystemsPrivate()
: ref(1)
- , vector(QFontDatabase::WritingSystemsCount,false)
+ , list(QFontDatabase::WritingSystemsCount, false)
{
}
QWritingSystemsPrivate(const QWritingSystemsPrivate *other)
: ref(1)
- , vector(other->vector)
+ , list(other->list)
{
}
QAtomicInt ref;
- QVector<bool> vector;
+ QList<bool> list;
};
/*!
@@ -201,18 +128,38 @@ QSupportedWritingSystems &QSupportedWritingSystems::operator=(const QSupportedWr
return *this;
}
+bool operator==(const QSupportedWritingSystems &lhs, const QSupportedWritingSystems &rhs)
+{
+ return !(lhs != rhs);
+}
+
+bool operator!=(const QSupportedWritingSystems &lhs, const QSupportedWritingSystems &rhs)
+{
+ if (lhs.d == rhs.d)
+ return false;
+
+ Q_ASSERT(lhs.d->list.size() == rhs.d->list.size());
+ Q_ASSERT(lhs.d->list.size() == QFontDatabase::WritingSystemsCount);
+ for (int i = 0; i < QFontDatabase::WritingSystemsCount; ++i) {
+ if (lhs.d->list.at(i) != rhs.d->list.at(i))
+ return true;
+ }
+
+ return false;
+}
+
#ifndef QT_NO_DEBUG_STREAM
QDebug operator<<(QDebug debug, const QSupportedWritingSystems &sws)
{
- QMetaObject mo = QFontDatabase::staticMetaObject;
- QMetaEnum me = mo.enumerator(mo.indexOfEnumerator("WritingSystem"));
+ const QMetaObject *mo = &QFontDatabase::staticMetaObject;
+ QMetaEnum me = mo->enumerator(mo->indexOfEnumerator("WritingSystem"));
QDebugStateSaver saver(debug);
debug.nospace() << "QSupportedWritingSystems(";
- int i = sws.d->vector.indexOf(true);
+ int i = sws.d->list.indexOf(true);
while (i > 0) {
debug << me.valueToKey(i);
- i = sws.d->vector.indexOf(true, i + 1);
+ i = sws.d->list.indexOf(true, i + 1);
if (i > 0)
debug << ", ";
}
@@ -250,7 +197,7 @@ void QSupportedWritingSystems::detach()
void QSupportedWritingSystems::setSupported(QFontDatabase::WritingSystem writingSystem, bool support)
{
detach();
- d->vector[writingSystem] = support;
+ d->list[writingSystem] = support;
}
/*!
@@ -259,7 +206,7 @@ void QSupportedWritingSystems::setSupported(QFontDatabase::WritingSystem writing
*/
bool QSupportedWritingSystems::supported(QFontDatabase::WritingSystem writingSystem) const
{
- return d->vector.at(writingSystem);
+ return d->list.at(writingSystem);
}
/*!
@@ -291,30 +238,10 @@ QPlatformFontDatabase::~QPlatformFontDatabase()
when the required family needs population. You then call registerFont() to
finish population of the family.
- The default implementation looks in the fontDir() location and registers all
- QPF2 fonts.
+ The default implementation does nothing.
*/
void QPlatformFontDatabase::populateFontDatabase()
{
- QString fontpath = fontDir();
- if(!QFile::exists(fontpath)) {
- qWarning("QFontDatabase: Cannot find font directory '%s' - is Qt installed correctly?",
- qPrintable(QDir::toNativeSeparators(fontpath)));
- return;
- }
-
- QDir dir(fontpath);
- dir.setNameFilters(QStringList() << QLatin1String("*.qpf2"));
- dir.refresh();
- for (int i = 0; i < int(dir.count()); ++i) {
- const QByteArray fileName = QFile::encodeName(dir.absoluteFilePath(dir[i]));
- QFile file(QString::fromLocal8Bit(fileName));
- if (file.open(QFile::ReadOnly)) {
- const QByteArray fileData = file.readAll();
- QByteArray *fileDataPtr = new QByteArray(fileData);
- registerQPF2Font(fileData, fileDataPtr);
- }
- }
}
/*!
@@ -352,15 +279,33 @@ QFontEngineMulti *QPlatformFontDatabase::fontEngineMulti(QFontEngine *fontEngine
/*!
Returns the font engine that can be used to render the font described by
the font definition, \a fontDef, in the specified \a script.
+
+ This function is called by QFontDatabase both for system fonts provided
+ by the platform font database, as well as for application fonts added by
+ the application developer.
+
+ The handle is the QPlatformFontDatabase specific handle passed when
+ registering the font family via QPlatformFontDatabase::registerFont.
+
+ The function is called for both fonts added via a filename as well
+ as fonts added from QByteArray data. Subclasses will need to handle
+ both cases via its platform specific handle.
*/
QFontEngine *QPlatformFontDatabase::fontEngine(const QFontDef &fontDef, void *handle)
{
- QByteArray *fileDataPtr = static_cast<QByteArray *>(handle);
- QFontEngineQPF2 *engine = new QFontEngineQPF2(fontDef,*fileDataPtr);
- //qDebug() << fontDef.pixelSize << fontDef.weight << fontDef.style << fontDef.stretch << fontDef.styleHint << fontDef.styleStrategy << fontDef.family;
- return engine;
+ Q_UNUSED(fontDef);
+ Q_UNUSED(handle);
+ qWarning("This plugin does not support loading system fonts.");
+ return nullptr;
}
+/*!
+ Returns the font engine that will be used to back a QRawFont,
+ based on the given \fontData, \a pixelSize, and \a hintingPreference.
+
+ This function is called by QRawFont, and does not play a part in
+ the normal operations of QFontDatabase.
+*/
QFontEngine *QPlatformFontDatabase::fontEngine(const QByteArray &fontData, qreal pixelSize,
QFont::HintingPreference hintingPreference)
{
@@ -376,16 +321,27 @@ QFontEngine *QPlatformFontDatabase::fontEngine(const QByteArray &fontData, qreal
or using the font contained in the file referenced by \a fileName. Returns
a list of family names, or an empty list if the font could not be added.
+ If \a applicationFont is non-null, its \c properties list should be filled
+ with information from the loaded fonts. This is exposed through FontLoader in
+ Qt Quick where it is needed for disambiguating fonts in the same family. When
+ the function exits, the \a applicationFont should contain an entry of properties
+ per font in the file, or it should be empty if no font was loaded.
+
\note The default implementation of this function does not add an application
font. Subclasses should reimplement this function to perform the necessary
loading and registration of fonts.
*/
-QStringList QPlatformFontDatabase::addApplicationFont(const QByteArray &fontData, const QString &fileName)
+QStringList QPlatformFontDatabase::addApplicationFont(const QByteArray &fontData, const QString &fileName, QFontDatabasePrivate::ApplicationFont *applicationFont)
{
Q_UNUSED(fontData);
Q_UNUSED(fileName);
+ Q_UNUSED(applicationFont);
+
+ if (applicationFont != nullptr)
+ applicationFont->properties.clear();
qWarning("This plugin does not support application fonts");
+
return QStringList();
}
@@ -405,7 +361,7 @@ QString QPlatformFontDatabase::fontDir() const
{
QString fontpath = QString::fromLocal8Bit(qgetenv("QT_QPA_FONTDIR"));
if (fontpath.isEmpty())
- fontpath = QLibraryInfo::location(QLibraryInfo::LibrariesPath) + QLatin1String("/fonts");
+ fontpath = QLibraryInfo::path(QLibraryInfo::LibrariesPath) + "/fonts"_L1;
return fontpath;
}
@@ -429,7 +385,7 @@ bool QPlatformFontDatabase::isPrivateFontFamily(const QString &family) const
QFont QPlatformFontDatabase::defaultFont() const
{
- return QFont(QLatin1String("Helvetica"));
+ return QFont("Helvetica"_L1);
}
@@ -474,8 +430,6 @@ bool QPlatformFontDatabase::fontsAlwaysScalable() const
return ret;
}
-// ### copied to tools/makeqpf/qpf2.cpp
-
// see the Unicode subset bitfields in the MSDN docs
static const quint8 requiredUnicodeBits[QFontDatabase::WritingSystemsCount][2] = {
{ 127, 127 }, // Any
@@ -534,6 +488,32 @@ enum CsbBits {
};
/*!
+ Helper function that determines the writing system support based on the contents of the OS/2 table
+ in the font.
+
+ \since 6.0
+*/
+QSupportedWritingSystems QPlatformFontDatabase::writingSystemsFromOS2Table(const char *os2Table, size_t length)
+{
+ if (length >= 86) {
+ quint32 unicodeRange[4] = {
+ qFromBigEndian<quint32>(os2Table + 42),
+ qFromBigEndian<quint32>(os2Table + 46),
+ qFromBigEndian<quint32>(os2Table + 50),
+ qFromBigEndian<quint32>(os2Table + 54)
+ };
+ quint32 codePageRange[2] = {
+ qFromBigEndian<quint32>(os2Table + 78),
+ qFromBigEndian<quint32>(os2Table + 82)
+ };
+
+ return writingSystemsFromTrueTypeBits(unicodeRange, codePageRange);
+ }
+
+ return QSupportedWritingSystems();
+}
+
+/*!
Helper function that determines the writing systems support by a given
\a unicodeRange and \a codePageRange.
@@ -627,43 +607,32 @@ QSupportedWritingSystems QPlatformFontDatabase::writingSystemsFromTrueTypeBits(q
}
/*!
- Helper function that returns the Qt font weight matching
- a given opentype integer value. Converts the integer
- \a weight (0 ~ 1000) to QFont::Weight and returns it.
+ Helper function that register the \a alias for the \a familyName.
- \since 5.5
+ \since 5.2
*/
-QFont::Weight QPlatformFontDatabase::weightFromInteger(int weight)
+void QPlatformFontDatabase::registerAliasToFontFamily(const QString &familyName, const QString &alias)
{
- if (weight < 150)
- return QFont::Thin;
- if (weight < 250)
- return QFont::ExtraLight;
- if (weight < 350)
- return QFont::Light;
- if (weight < 450)
- return QFont::Normal;
- if (weight < 550)
- return QFont::Medium;
- if (weight < 650)
- return QFont::DemiBold;
- if (weight < 750)
- return QFont::Bold;
- if (weight < 850)
- return QFont::ExtraBold;
- return QFont::Black;
+ qt_registerAliasToFontFamily(familyName, alias);
}
/*!
- Helper function that register the \a alias for the \a familyName.
+ Requests that the platform font database should be repopulated.
- \since 5.2
-*/
+ This will result in invalidating the entire font database.
-void QPlatformFontDatabase::registerAliasToFontFamily(const QString &familyName, const QString &alias)
+ The next time the font database is accessed it will be repopulated
+ via a call to QPlatformFontDatabase::populate().
+
+ Application fonts will not be removed, and will be automatically
+ populated when the font database is repopulated.
+
+ \since 6.4
+*/
+void QPlatformFontDatabase::repopulateFontDatabase()
{
- qt_registerAliasToFontFamily(familyName, alias);
+ QFontDatabasePrivate::instance()->invalidate();
}
/*!
@@ -677,6 +646,18 @@ bool QPlatformFontDatabase::isFamilyPopulated(const QString &familyName)
}
/*!
+ Returns true if this font database supports loading named instances from variable application
+ fonts.
+
+ \since 6.7
+*/
+bool QPlatformFontDatabase::supportsVariableApplicationFonts() const
+{
+ return false;
+}
+
+
+/*!
\class QPlatformFontDatabase
\since 5.0
\internal
diff --git a/src/gui/text/qplatformfontdatabase.h b/src/gui/text/qplatformfontdatabase.h
index f79c5db625..3007a11838 100644
--- a/src/gui/text/qplatformfontdatabase.h
+++ b/src/gui/text/qplatformfontdatabase.h
@@ -1,41 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the QtGui module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#ifndef QPLATFORMFONTDATABASE_H
#define QPLATFORMFONTDATABASE_H
@@ -50,18 +14,18 @@
//
#include <QtGui/qtguiglobal.h>
+#include <QtCore/qloggingcategory.h>
#include <QtCore/QString>
#include <QtCore/QStringList>
#include <QtCore/QList>
-#if QT_DEPRECATED_SINCE(5, 5)
-#include <QtCore/QHash>
-#endif
#include <QtGui/QFontDatabase>
#include <QtGui/private/qfontengine_p.h>
#include <QtGui/private/qfont_p.h>
+#include <QtGui/private/qfontdatabase_p.h>
QT_BEGIN_NAMESPACE
+Q_DECLARE_EXPORTED_LOGGING_CATEGORY(lcQpaFonts, Q_GUI_EXPORT)
class QWritingSystemsPrivate;
@@ -108,13 +72,13 @@ public:
virtual void populateFamily(const QString &familyName);
virtual void invalidate();
- virtual QFontEngineMulti *fontEngineMulti(QFontEngine *fontEngine, QChar::Script script);
- virtual QFontEngine *fontEngine(const QFontDef &fontDef, void *handle);
virtual QStringList fallbacksForFamily(const QString &family, QFont::Style style, QFont::StyleHint styleHint, QChar::Script script) const;
- virtual QStringList addApplicationFont(const QByteArray &fontData, const QString &fileName);
- virtual void releaseHandle(void *handle);
+ virtual QStringList addApplicationFont(const QByteArray &fontData, const QString &fileName, QFontDatabasePrivate::ApplicationFont *font = nullptr);
+ virtual QFontEngine *fontEngine(const QFontDef &fontDef, void *handle);
virtual QFontEngine *fontEngine(const QByteArray &fontData, qreal pixelSize, QFont::HintingPreference hintingPreference);
+ virtual QFontEngineMulti *fontEngineMulti(QFontEngine *fontEngine, QChar::Script script);
+ virtual void releaseHandle(void *handle);
virtual QString fontDir() const;
@@ -125,12 +89,13 @@ public:
virtual bool fontsAlwaysScalable() const;
virtual QList<int> standardSizes() const;
+ virtual bool supportsVariableApplicationFonts() const;
+
// helper
static QSupportedWritingSystems writingSystemsFromTrueTypeBits(quint32 unicodeRange[4], quint32 codePageRange[2]);
- static QFont::Weight weightFromInteger(int weight);
+ static QSupportedWritingSystems writingSystemsFromOS2Table(const char *os2Table, size_t length);
//callback
- static void registerQPF2Font(const QByteArray &dataArray, void *handle);
static void registerFont(const QString &familyname, const QString &stylename,
const QString &foundryname, QFont::Weight weight,
QFont::Style style, QFont::Stretch stretch, bool antialiased,
@@ -140,6 +105,8 @@ public:
static void registerFontFamily(const QString &familyName);
static void registerAliasToFontFamily(const QString &familyName, const QString &alias);
+ static void repopulateFontDatabase();
+
static bool isFamilyPopulated(const QString &familyName);
};
diff --git a/src/gui/text/qrawfont.cpp b/src/gui/text/qrawfont.cpp
index 884525bd76..54676b3560 100644
--- a/src/gui/text/qrawfont.cpp
+++ b/src/gui/text/qrawfont.cpp
@@ -1,41 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the QtGui module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#include "qglobal.h"
@@ -51,6 +15,7 @@
#include <QtCore/qendian.h>
#include <QtCore/qfile.h>
+#include <QtGui/qpainterpath.h>
QT_BEGIN_NAMESPACE
@@ -280,12 +245,12 @@ QImage QRawFont::alphaMapForGlyph(quint32 glyphIndex, AntialiasingType antialias
return QImage();
if (d->fontEngine->glyphFormat == QFontEngine::Format_ARGB)
- return d->fontEngine->bitmapForGlyph(glyphIndex, QFixed(), transform);
+ return d->fontEngine->bitmapForGlyph(glyphIndex, QFixedPoint(), transform);
if (antialiasingType == SubPixelAntialiasing)
- return d->fontEngine->alphaRGBMapForGlyph(glyphIndex, QFixed(), transform);
+ return d->fontEngine->alphaRGBMapForGlyph(glyphIndex, QFixedPoint(), transform);
- return d->fontEngine->alphaMapForGlyph(glyphIndex, QFixed(), transform);
+ return d->fontEngine->alphaMapForGlyph(glyphIndex, QFixedPoint(), transform);
}
/*!
@@ -322,7 +287,7 @@ bool QRawFont::operator==(const QRawFont &other) const
\relates QRawFont
\since 5.8
*/
-uint qHash(const QRawFont &font, uint seed) noexcept
+size_t qHash(const QRawFont &font, size_t seed) noexcept
{
return qHash(QRawFontPrivate::get(font)->fontEngine, seed);
}
@@ -475,7 +440,7 @@ qreal QRawFont::underlinePosition() const
*/
QString QRawFont::familyName() const
{
- return d->isValid() ? d->fontEngine->fontDef.family : QString();
+ return d->isValid() ? d->fontEngine->fontDef.families.constFirst() : QString();
}
/*!
@@ -510,7 +475,7 @@ int QRawFont::weight() const
/*!
Converts the string of unicode points given by \a text to glyph indexes
- using the CMAP table in the underlying font, and returns a vector containing
+ using the CMAP table in the underlying font, and returns a list containing
the result.
Note that, in cases where there are other tables in the font that affect the
@@ -521,9 +486,9 @@ int QRawFont::weight() const
\sa advancesForGlyphIndexes(), glyphIndexesForChars(), QGlyphRun, QTextLayout::glyphRuns(), QTextFragment::glyphRuns()
*/
-QVector<quint32> QRawFont::glyphIndexesForString(const QString &text) const
+QList<quint32> QRawFont::glyphIndexesForString(const QString &text) const
{
- QVector<quint32> glyphIndexes;
+ QList<quint32> glyphIndexes;
if (!d->isValid() || text.isEmpty())
return glyphIndexes;
@@ -533,7 +498,7 @@ QVector<quint32> QRawFont::glyphIndexesForString(const QString &text) const
QGlyphLayout glyphs;
glyphs.numGlyphs = numGlyphs;
glyphs.glyphs = glyphIndexes.data();
- if (!d->fontEngine->stringToCMap(text.data(), text.size(), &glyphs, &numGlyphs, QFontEngine::GlyphIndicesOnly))
+ if (d->fontEngine->stringToCMap(text.data(), text.size(), &glyphs, &numGlyphs, QFontEngine::GlyphIndicesOnly) < 0)
Q_UNREACHABLE();
glyphIndexes.resize(numGlyphs);
@@ -566,11 +531,11 @@ bool QRawFont::glyphIndexesForChars(const QChar *chars, int numChars, quint32 *g
QGlyphLayout glyphs;
glyphs.numGlyphs = *numGlyphs;
glyphs.glyphs = glyphIndexes;
- return d->fontEngine->stringToCMap(chars, numChars, &glyphs, numGlyphs, QFontEngine::GlyphIndicesOnly);
+ return d->fontEngine->stringToCMap(chars, numChars, &glyphs, numGlyphs, QFontEngine::GlyphIndicesOnly) >= 0;
}
/*!
- \fn QVector<QPointF> QRawFont::advancesForGlyphIndexes(const QVector<quint32> &glyphIndexes, LayoutFlags layoutFlags) const
+ \fn QList<QPointF> QRawFont::advancesForGlyphIndexes(const QList<quint32> &glyphIndexes, LayoutFlags layoutFlags) const
\since 5.1
Returns the QRawFont's advances for each of the \a glyphIndexes in pixel units. The advances
@@ -578,11 +543,16 @@ bool QRawFont::glyphIndexesForChars(const QChar *chars, int numChars, quint32 *g
to make it appear as if the two glyphs are unspaced. How the advances are calculated is
controlled by \a layoutFlags.
- \sa QTextLine::horizontalAdvance(), QFontMetricsF::width()
+ \note When \c KernedAdvances is requested, this function will apply kerning rules from the
+ TrueType table \c{KERN}, if this is available in the font. In many modern fonts, kerning is
+ handled through OpenType rules or AAT rules, which requires a full shaping step to be applied.
+ To get the results of fully shaping the text, use \l{QTextLayout}.
+
+ \sa QTextLine::horizontalAdvance(), QFontMetricsF::horizontalAdvance(), QTextLayout::glyphRuns()
*/
/*!
- \fn QVector<QPointF> QRawFont::advancesForGlyphIndexes(const QVector<quint32> &glyphIndexes) const
+ \fn QList<QPointF> QRawFont::advancesForGlyphIndexes(const QList<quint32> &glyphIndexes) const
\overload
@@ -591,7 +561,7 @@ bool QRawFont::glyphIndexesForChars(const QChar *chars, int numChars, quint32 *g
to make it appear as if the two glyphs are unspaced. The advance of each glyph is calculated
separately.
- \sa QTextLine::horizontalAdvance(), QFontMetricsF::width()
+ \sa QTextLine::horizontalAdvance(), QFontMetricsF::horizontalAdvance()
*/
/*!
@@ -603,13 +573,18 @@ bool QRawFont::glyphIndexesForChars(const QChar *chars, int numChars, quint32 *g
array \a glyphIndexes while the results are returned through \a advances, both of them must
have \a numGlyphs elements. How the advances are calculated is controlled by \a layoutFlags.
- \sa QTextLine::horizontalAdvance(), QFontMetricsF::width()
+ \note When \c KernedAdvances is requested, this function will apply kerning rules from the
+ TrueType table \c{KERN}, if this is available in the font. In many modern fonts, kerning is
+ handled through OpenType rules or AAT rules, which requires a full shaping step to be applied.
+ To get the results of fully shaping the text, use \l{QTextLayout}.
+
+ \sa QTextLine::horizontalAdvance(), QFontMetricsF::horizontalAdvance(), QTextLayout::glyphRuns()
*/
bool QRawFont::advancesForGlyphIndexes(const quint32 *glyphIndexes, QPointF *advances, int numGlyphs, LayoutFlags layoutFlags) const
{
- Q_ASSERT(glyphIndexes && advances);
if (!d->isValid() || numGlyphs <= 0)
return false;
+ Q_ASSERT(glyphIndexes && advances);
QVarLengthArray<QFixed> tmpAdvances(numGlyphs);
@@ -639,7 +614,7 @@ bool QRawFont::advancesForGlyphIndexes(const quint32 *glyphIndexes, QPointF *adv
array \a glyphIndexes while the results are returned through \a advances, both of them must
have \a numGlyphs elements. The advance of each glyph is calculated separately
- \sa QTextLine::horizontalAdvance(), QFontMetricsF::width()
+ \sa QTextLine::horizontalAdvance(), QFontMetricsF::horizontalAdvance()
*/
bool QRawFont::advancesForGlyphIndexes(const quint32 *glyphIndexes, QPointF *advances, int numGlyphs) const
{
@@ -657,17 +632,33 @@ QFont::HintingPreference QRawFont::hintingPreference() const
}
/*!
- Retrieves the sfnt table named \a tagName from the underlying physical font, or an empty
- byte array if no such table was found. The returned font table's byte order is Big Endian, like
- the sfnt format specifies. The \a tagName must be four characters long and should be formatted
- in the default endianness of the current platform.
+ \fn QByteArray QRawFont::fontTable(const char *tag) const
+ \overload fontTable(QFont::Tag)
+
+ The name must be a four-character string.
+*/
+
+/*!
+ \fn QByteArray QRawFont::fontTable(QFont::Tag tag) const
+ \since 6.7
+
+ Retrieves the sfnt table specified by \a tag from the underlying physical font,
+ or an empty byte array if no such table was found. The returned font table's byte order is
+ Big Endian, like the sfnt format specifies.
*/
-QByteArray QRawFont::fontTable(const char *tagName) const
+QByteArray QRawFont::fontTable(const char *tag) const
+{
+ if (auto maybeTag = QFont::Tag::fromString(tag))
+ return fontTable(*maybeTag);
+ return QByteArray();
+}
+
+QByteArray QRawFont::fontTable(QFont::Tag tag) const
{
if (!d->isValid())
return QByteArray();
- return d->fontEngine->getSfntTable(MAKE_TAG(tagName[0], tagName[1], tagName[2], tagName[3]));
+ return d->fontEngine->getSfntTable(tag.value());
}
/*!
@@ -759,7 +750,7 @@ QRawFont QRawFont::fromFont(const QFont &font, QFontDatabase::WritingSystem writ
QFontDef request(multiEngine->fontDef);
request.styleStrategy |= QFont::NoFontMerging;
- if (QFontEngine *engine = QFontDatabase::findFont(request, script)) {
+ if (QFontEngine *engine = QFontDatabasePrivate::findFont(request, script, true)) {
if (request.weight > QFont::Normal)
engine->fontDef.weight = request.weight;
if (request.style > QFont::StyleNormal)
diff --git a/src/gui/text/qrawfont.h b/src/gui/text/qrawfont.h
index c6289d6c93..d23d0c1493 100644
--- a/src/gui/text/qrawfont.h
+++ b/src/gui/text/qrawfont.h
@@ -1,41 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the QtGui module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#ifndef QRAWFONT_H
#define QRAWFONT_H
@@ -79,11 +43,11 @@ public:
qreal pixelSize,
QFont::HintingPreference hintingPreference = QFont::PreferDefaultHinting);
QRawFont(const QRawFont &other);
- QRawFont &operator=(QRawFont &&other) noexcept { swap(other); return *this; }
+ QT_MOVE_ASSIGNMENT_OPERATOR_IMPL_VIA_PURE_SWAP(QRawFont)
QRawFont &operator=(const QRawFont &other);
~QRawFont();
- void swap(QRawFont &other) noexcept { qSwap(d, other.d); }
+ void swap(QRawFont &other) noexcept { d.swap(other.d); }
bool isValid() const;
@@ -97,9 +61,10 @@ public:
QFont::Style style() const;
int weight() const;
- QVector<quint32> glyphIndexesForString(const QString &text) const;
- inline QVector<QPointF> advancesForGlyphIndexes(const QVector<quint32> &glyphIndexes) const;
- inline QVector<QPointF> advancesForGlyphIndexes(const QVector<quint32> &glyphIndexes, LayoutFlags layoutFlags) const;
+ QList<quint32> glyphIndexesForString(const QString &text) const;
+ inline QList<QPointF> advancesForGlyphIndexes(const QList<quint32> &glyphIndexes) const;
+ inline QList<QPointF> advancesForGlyphIndexes(const QList<quint32> &glyphIndexes,
+ LayoutFlags layoutFlags) const;
bool glyphIndexesForChars(const QChar *chars, int numChars, quint32 *glyphIndexes, int *numGlyphs) const;
bool advancesForGlyphIndexes(const quint32 *glyphIndexes, QPointF *advances, int numGlyphs) const;
bool advancesForGlyphIndexes(const quint32 *glyphIndexes, QPointF *advances, int numGlyphs, LayoutFlags layoutFlags) const;
@@ -140,6 +105,7 @@ public:
QList<QFontDatabase::WritingSystem> supportedWritingSystems() const;
QByteArray fontTable(const char *tagName) const;
+ QByteArray fontTable(QFont::Tag tag) const;
static QRawFont fromFont(const QFont &font,
QFontDatabase::WritingSystem writingSystem = QFontDatabase::Any);
@@ -156,17 +122,18 @@ Q_DECLARE_SHARED(QRawFont)
Q_DECLARE_OPERATORS_FOR_FLAGS(QRawFont::LayoutFlags)
-Q_GUI_EXPORT uint qHash(const QRawFont &font, uint seed = 0) noexcept;
+Q_GUI_EXPORT size_t qHash(const QRawFont &font, size_t seed = 0) noexcept;
-inline QVector<QPointF> QRawFont::advancesForGlyphIndexes(const QVector<quint32> &glyphIndexes, QRawFont::LayoutFlags layoutFlags) const
+inline QList<QPointF> QRawFont::advancesForGlyphIndexes(const QList<quint32> &glyphIndexes,
+ QRawFont::LayoutFlags layoutFlags) const
{
- QVector<QPointF> advances(glyphIndexes.size());
- if (advancesForGlyphIndexes(glyphIndexes.constData(), advances.data(), glyphIndexes.size(), layoutFlags))
+ QList<QPointF> advances(glyphIndexes.size());
+ if (advancesForGlyphIndexes(glyphIndexes.constData(), advances.data(), int(glyphIndexes.size()), layoutFlags))
return advances;
- return QVector<QPointF>();
+ return QList<QPointF>();
}
-inline QVector<QPointF> QRawFont::advancesForGlyphIndexes(const QVector<quint32> &glyphIndexes) const
+inline QList<QPointF> QRawFont::advancesForGlyphIndexes(const QList<quint32> &glyphIndexes) const
{
return advancesForGlyphIndexes(glyphIndexes, QRawFont::SeparateAdvances);
}
diff --git a/src/gui/text/qrawfont_p.h b/src/gui/text/qrawfont_p.h
index 03259a94ed..c69ea6dad2 100644
--- a/src/gui/text/qrawfont_p.h
+++ b/src/gui/text/qrawfont_p.h
@@ -1,41 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the QtGui module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#ifndef QRAWFONTPRIVATE_P_H
#define QRAWFONTPRIVATE_P_H
diff --git a/src/gui/text/qstatictext.cpp b/src/gui/text/qstatictext.cpp
index e588b44efd..eb7d19d64e 100644
--- a/src/gui/text/qstatictext.cpp
+++ b/src/gui/text/qstatictext.cpp
@@ -1,41 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the QtGui module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#include "qstatictext.h"
#include "qstatictext_p.h"
@@ -46,6 +10,8 @@
QT_BEGIN_NAMESPACE
+QT_IMPL_METATYPE_EXTERN(QStaticText)
+
QStaticTextUserData::~QStaticTextUserData()
{
}
@@ -84,7 +50,7 @@ QStaticTextUserData::~QStaticTextUserData()
class MyWidget: public QWidget
{
public:
- MyWidget(QWidget *parent = 0) : QWidget(parent), m_staticText("This is static text")
+ MyWidget(QWidget *parent = nullptr) : QWidget(parent), m_staticText("This is static text")
protected:
void paintEvent(QPaintEvent *)
@@ -207,7 +173,7 @@ void QStaticText::detach()
making changes, you can use the prepare() function and pass in the \a matrix and \a font you
expect to use when drawing the text.
- \sa QPainter::setFont(), QPainter::setMatrix()
+ \sa QPainter::setFont(), QPainter::setWorldTransform()
*/
void QStaticText::prepare(const QTransform &matrix, const QFont &font)
{
@@ -498,25 +464,25 @@ namespace {
return User;
}
- QVector<QStaticTextItem> items() const
+ QList<QStaticTextItem> items() const
{
return m_items;
}
- QVector<QFixedPoint> positions() const
+ QList<QFixedPoint> positions() const
{
return m_positions;
}
- QVector<glyph_t> glyphs() const
+ QList<glyph_t> glyphs() const
{
return m_glyphs;
}
private:
- QVector<QStaticTextItem> m_items;
- QVector<QFixedPoint> m_positions;
- QVector<glyph_t> m_glyphs;
+ QList<QStaticTextItem> m_items;
+ QList<QFixedPoint> m_positions;
+ QList<glyph_t> m_glyphs;
bool m_dirtyPen;
bool m_useBackendOptimizations;
@@ -580,17 +546,17 @@ namespace {
return m_paintEngine;
}
- QVector<glyph_t> glyphs() const
+ QList<glyph_t> glyphs() const
{
return m_paintEngine->glyphs();
}
- QVector<QFixedPoint> positions() const
+ QList<QFixedPoint> positions() const
{
return m_paintEngine->positions();
}
- QVector<QStaticTextItem> items() const
+ QList<QStaticTextItem> items() const
{
return m_paintEngine->items();
}
@@ -684,9 +650,9 @@ void QStaticTextPrivate::init()
paintText(QPointF(0, 0), &painter, QColor(0, 0, 0, 0));
}
- QVector<QStaticTextItem> deviceItems = device.items();
- QVector<QFixedPoint> positions = device.positions();
- QVector<glyph_t> glyphs = device.glyphs();
+ QList<QStaticTextItem> deviceItems = device.items();
+ QList<QFixedPoint> positions = device.positions();
+ QList<glyph_t> glyphs = device.glyphs();
itemCount = deviceItems.size();
items = new QStaticTextItem[itemCount];
diff --git a/src/gui/text/qstatictext.h b/src/gui/text/qstatictext.h
index e8c94a6add..7c8d8f8734 100644
--- a/src/gui/text/qstatictext.h
+++ b/src/gui/text/qstatictext.h
@@ -1,41 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the QtGui module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#ifndef QSTATICTEXT_H
#define QSTATICTEXT_H
@@ -64,11 +28,11 @@ public:
QStaticText();
explicit QStaticText(const QString &text);
QStaticText(const QStaticText &other);
- QStaticText &operator=(QStaticText &&other) noexcept { swap(other); return *this; }
+ QT_MOVE_ASSIGNMENT_OPERATOR_IMPL_VIA_PURE_SWAP(QStaticText)
QStaticText &operator=(const QStaticText &);
~QStaticText();
- void swap(QStaticText &other) noexcept { qSwap(data, other.data); }
+ void swap(QStaticText &other) noexcept { data.swap(other.data); }
void setText(const QString &text);
QString text() const;
@@ -103,6 +67,6 @@ Q_DECLARE_SHARED(QStaticText)
QT_END_NAMESPACE
-Q_DECLARE_METATYPE(QStaticText)
+QT_DECL_METATYPE_EXTERN(QStaticText, Q_GUI_EXPORT)
#endif // QSTATICTEXT_H
diff --git a/src/gui/text/qstatictext_p.h b/src/gui/text/qstatictext_p.h
index 8d6792216d..cbf13e7b06 100644
--- a/src/gui/text/qstatictext_p.h
+++ b/src/gui/text/qstatictext_p.h
@@ -1,41 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the QtGui module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#ifndef QSTATICTEXT_P_H
#define QSTATICTEXT_P_H
@@ -59,7 +23,6 @@
QT_BEGIN_NAMESPACE
-// ### Qt 6: Unexport again, if QOpenGLStaticTextUserData (the one from QtOpenGL) is gone by then
class Q_GUI_EXPORT QStaticTextUserData
{
public:
@@ -120,7 +83,7 @@ private: // private to avoid abuse
// ================
// 43 bytes per item
};
-Q_DECLARE_TYPEINFO(QStaticTextItem, Q_MOVABLE_TYPE);
+Q_DECLARE_TYPEINFO(QStaticTextItem, Q_RELOCATABLE_TYPE);
class QStaticText;
class Q_AUTOTEST_EXPORT QStaticTextPrivate
diff --git a/src/gui/text/qsyntaxhighlighter.cpp b/src/gui/text/qsyntaxhighlighter.cpp
index c345e89a21..6c1e2e74fc 100644
--- a/src/gui/text/qsyntaxhighlighter.cpp
+++ b/src/gui/text/qsyntaxhighlighter.cpp
@@ -1,41 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the QtGui module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#include "qsyntaxhighlighter.h"
@@ -87,7 +51,7 @@ public:
}
void applyFormatChanges();
- QVector<QTextCharFormat> formatChanges;
+ QList<QTextCharFormat> formatChanges;
QTextBlock currentBlock;
bool rehighlightPending;
bool inReformatBlocks;
@@ -99,44 +63,40 @@ void QSyntaxHighlighterPrivate::applyFormatChanges()
QTextLayout *layout = currentBlock.layout();
- QVector<QTextLayout::FormatRange> ranges = layout->formats();
+ QList<QTextLayout::FormatRange> ranges = layout->formats();
const int preeditAreaStart = layout->preeditAreaPosition();
- const int preeditAreaLength = layout->preeditAreaText().length();
+ const int preeditAreaLength = layout->preeditAreaText().size();
if (preeditAreaLength != 0) {
auto isOutsidePreeditArea = [=](const QTextLayout::FormatRange &range) {
return range.start < preeditAreaStart
|| range.start + range.length > preeditAreaStart + preeditAreaLength;
};
- const auto it = std::remove_if(ranges.begin(), ranges.end(),
- isOutsidePreeditArea);
- if (it != ranges.end()) {
- ranges.erase(it, ranges.end());
+ if (ranges.removeIf(isOutsidePreeditArea) > 0)
formatsChanged = true;
- }
} else if (!ranges.isEmpty()) {
ranges.clear();
formatsChanged = true;
}
int i = 0;
- while (i < formatChanges.count()) {
+ while (i < formatChanges.size()) {
QTextLayout::FormatRange r;
- while (i < formatChanges.count() && formatChanges.at(i) == r.format)
+ while (i < formatChanges.size() && formatChanges.at(i) == r.format)
++i;
- if (i == formatChanges.count())
+ if (i == formatChanges.size())
break;
r.start = i;
r.format = formatChanges.at(i);
- while (i < formatChanges.count() && formatChanges.at(i) == r.format)
+ while (i < formatChanges.size() && formatChanges.at(i) == r.format)
++i;
- Q_ASSERT(i <= formatChanges.count());
+ Q_ASSERT(i <= formatChanges.size());
r.length = i - r.start;
if (preeditAreaLength != 0) {
@@ -173,7 +133,7 @@ void QSyntaxHighlighterPrivate::reformatBlocks(int from, int charsRemoved, int c
if (lastBlock.isValid())
endPosition = lastBlock.position() + lastBlock.length();
else
- endPosition = doc->docHandle()->length();
+ endPosition = QTextDocumentPrivate::get(doc)->length();
bool forceHighlightOfNextBlock = false;
@@ -259,7 +219,7 @@ void QSyntaxHighlighterPrivate::reformatBlock(const QTextBlock &block)
an int value. If no state is set, the returned value is -1. You
can designate any other value to identify any given state using
the setCurrentBlockState() function. Once the state is set the
- QTextBlock keeps that value until it is set set again or until the
+ QTextBlock keeps that value until it is set again or until the
corresponding paragraph of text is deleted.
For example, if you're writing a simple C++ syntax highlighter,
@@ -299,7 +259,7 @@ QSyntaxHighlighter::QSyntaxHighlighter(QObject *parent)
: QObject(*new QSyntaxHighlighterPrivate, parent)
{
if (parent && parent->inherits("QTextEdit")) {
- QTextDocument *doc = parent->property("document").value<QTextDocument *>();
+ QTextDocument *doc = qvariant_cast<QTextDocument *>(parent->property("document"));
if (doc)
setDocument(doc);
}
@@ -443,10 +403,10 @@ void QSyntaxHighlighter::rehighlightBlock(const QTextBlock &block)
void QSyntaxHighlighter::setFormat(int start, int count, const QTextCharFormat &format)
{
Q_D(QSyntaxHighlighter);
- if (start < 0 || start >= d->formatChanges.count())
+ if (start < 0 || start >= d->formatChanges.size())
return;
- const int end = qMin(start + count, d->formatChanges.count());
+ const int end = qMin(start + count, d->formatChanges.size());
for (int i = start; i < end; ++i)
d->formatChanges[i] = format;
}
@@ -496,7 +456,7 @@ void QSyntaxHighlighter::setFormat(int start, int count, const QFont &font)
QTextCharFormat QSyntaxHighlighter::format(int pos) const
{
Q_D(const QSyntaxHighlighter);
- if (pos < 0 || pos >= d->formatChanges.count())
+ if (pos < 0 || pos >= d->formatChanges.size())
return QTextCharFormat();
return d->formatChanges.at(pos);
}
diff --git a/src/gui/text/qsyntaxhighlighter.h b/src/gui/text/qsyntaxhighlighter.h
index ad0d50a4c0..3ce0e60e15 100644
--- a/src/gui/text/qsyntaxhighlighter.h
+++ b/src/gui/text/qsyntaxhighlighter.h
@@ -1,41 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the QtGui module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#ifndef QSYNTAXHIGHLIGHTER_H
#define QSYNTAXHIGHLIGHTER_H
diff --git a/src/gui/text/qt_attribution.json b/src/gui/text/qt_attribution.json
index c3a57267e2..f4998da6ea 100644
--- a/src/gui/text/qt_attribution.json
+++ b/src/gui/text/qt_attribution.json
@@ -5,7 +5,7 @@
"QDocModule": "qtgui",
"Description": "Provides standardized names for glyphs.",
"QtUsage": "Used by PDF generator to make it easier for reader applications to resolve the original contents of rendered text.",
- "Path": "qfontsubset_agl.cpp",
+ "Files": "qfontsubset_agl.cpp",
"Homepage": "https://github.com/adobe-type-tools/agl-aglfn",
"Version": "1.7",
diff --git a/src/gui/text/qtextcursor.cpp b/src/gui/text/qtextcursor.cpp
index fa323ef4bd..5730f55e6a 100644
--- a/src/gui/text/qtextcursor.cpp
+++ b/src/gui/text/qtextcursor.cpp
@@ -1,41 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the QtGui module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#include "qtextcursor.h"
#include "qtextcursor_p.h"
@@ -612,7 +576,7 @@ bool QTextCursorPrivate::movePosition(QTextCursor::MoveOperation op, QTextCursor
++row;
}
cell = table->cellAt(row, column);
- // note we also continue while we have not reached a cell thats not merged with one above us
+ // note we also continue while we have not reached a cell that's not merged with one above us
} while (cell.isValid()
&& ((op == QTextCursor::NextRow && currentRow == cell.row())
|| cell.row() < row));
@@ -625,7 +589,7 @@ bool QTextCursorPrivate::movePosition(QTextCursor::MoveOperation op, QTextCursor
--row;
}
cell = table->cellAt(row, column);
- // note we also continue while we have not reached a cell thats not merged with one above us
+ // note we also continue while we have not reached a cell that's not merged with one above us
} while (cell.isValid()
&& ((op == QTextCursor::PreviousRow && currentRow == cell.row())
|| cell.row() < row));
@@ -1052,7 +1016,7 @@ QTextCursor::QTextCursor()
Constructs a cursor pointing to the beginning of the \a document.
*/
QTextCursor::QTextCursor(QTextDocument *document)
- : d(new QTextCursorPrivate(document->docHandle()))
+ : d(new QTextCursorPrivate(QTextDocumentPrivate::get(document)))
{
}
@@ -1060,7 +1024,7 @@ QTextCursor::QTextCursor(QTextDocument *document)
Constructs a cursor pointing to the beginning of the \a frame.
*/
QTextCursor::QTextCursor(QTextFrame *frame)
- : d(new QTextCursorPrivate(frame->document()->docHandle()))
+ : d(new QTextCursorPrivate(QTextDocumentPrivate::get(frame->document())))
{
d->adjusted_anchor = d->anchor = d->position = frame->firstPosition();
}
@@ -1070,7 +1034,7 @@ QTextCursor::QTextCursor(QTextFrame *frame)
Constructs a cursor pointing to the beginning of the \a block.
*/
QTextCursor::QTextCursor(const QTextBlock &block)
- : d(new QTextCursorPrivate(block.docHandle()))
+ : d(new QTextCursorPrivate(const_cast<QTextDocumentPrivate *>(QTextDocumentPrivate::get(block))))
{
d->adjusted_anchor = d->anchor = d->position = block.position();
}
@@ -1459,28 +1423,28 @@ void QTextCursor::insertText(const QString &text, const QTextCharFormat &_format
QTextBlockFormat blockFmt = blockFormat();
- int textStart = d->priv->text.length();
+ int textStart = d->priv->text.size();
int blockStart = 0;
d->priv->text += text;
- int textEnd = d->priv->text.length();
+ int textEnd = d->priv->text.size();
- for (int i = 0; i < text.length(); ++i) {
+ for (int i = 0; i < text.size(); ++i) {
QChar ch = text.at(i);
const int blockEnd = i;
- if (ch == QLatin1Char('\r')
- && (i + 1) < text.length()
- && text.at(i + 1) == QLatin1Char('\n')) {
+ if (ch == u'\r'
+ && (i + 1) < text.size()
+ && text.at(i + 1) == u'\n') {
++i;
ch = text.at(i);
}
- if (ch == QLatin1Char('\n')
+ if (ch == u'\n'
|| ch == QChar::ParagraphSeparator
|| ch == QTextBeginningOfFrame
|| ch == QTextEndOfFrame
- || ch == QLatin1Char('\r')) {
+ || ch == u'\r') {
if (!hasEditBlock) {
hasEditBlock = true;
@@ -1715,7 +1679,7 @@ static void getText(QString &text, QTextDocumentPrivate *priv, const QString &do
const int offsetInFragment = qMax(0, pos - fragIt.position());
const int len = qMin(int(frag->size_array[0] - offsetInFragment), end - pos);
- text += QString(docText.constData() + frag->stringPosition + offsetInFragment, len);
+ text += QStringView(docText.constData() + frag->stringPosition + offsetInFragment, len);
pos += len;
}
}
@@ -2185,7 +2149,7 @@ QTextTable *QTextCursor::insertTable(int rows, int cols)
*/
QTextTable *QTextCursor::insertTable(int rows, int cols, const QTextTableFormat &format)
{
- if(!d || !d->priv || rows == 0 || cols == 0)
+ if (!d || !d->priv || rows == 0 || cols == 0)
return nullptr;
int pos = d->position;
@@ -2205,7 +2169,7 @@ QTextTable *QTextCursor::insertTable(int rows, int cols, const QTextTableFormat
*/
QTextTable *QTextCursor::currentTable() const
{
- if(!d || !d->priv)
+ if (!d || !d->priv)
return nullptr;
QTextFrame *frame = d->priv->frameAt(d->position);
@@ -2242,7 +2206,7 @@ QTextFrame *QTextCursor::insertFrame(const QTextFrameFormat &format)
*/
QTextFrame *QTextCursor::currentFrame() const
{
- if(!d || !d->priv)
+ if (!d || !d->priv)
return nullptr;
return d->priv->frameAt(d->position);
@@ -2264,7 +2228,7 @@ void QTextCursor::insertFragment(const QTextDocumentFragment &fragment)
d->setX();
if (fragment.d && fragment.d->doc)
- d->priv->mergeCachedResources(fragment.d->doc->docHandle());
+ d->priv->mergeCachedResources(QTextDocumentPrivate::get(fragment.d->doc));
}
/*!
@@ -2291,6 +2255,28 @@ void QTextCursor::insertHtml(const QString &html)
#endif // QT_NO_TEXTHTMLPARSER
/*!
+ \since 6.4
+ Inserts the \a markdown text at the current position(),
+ with the specified Markdown \a features. The default is GitHub dialect.
+*/
+
+#if QT_CONFIG(textmarkdownreader)
+
+void QTextCursor::insertMarkdown(const QString &markdown, QTextDocument::MarkdownFeatures features)
+{
+ if (!d || !d->priv)
+ return;
+ QTextDocumentFragment fragment = QTextDocumentFragment::fromMarkdown(markdown, features);
+ if (markdown.startsWith(QLatin1Char('\n')))
+ insertBlock(fragment.d->doc->firstBlock().blockFormat());
+ insertFragment(fragment);
+ if (!atEnd() && markdown.endsWith(QLatin1Char('\n')))
+ insertText(QLatin1String("\n"));
+}
+
+#endif // textmarkdownreader
+
+/*!
\overload
\since 4.2
@@ -2314,7 +2300,7 @@ void QTextCursor::insertImage(const QTextImageFormat &format, QTextFrameFormat::
d->priv->beginEditBlock();
d->remove();
const int idx = d->priv->formatCollection()->indexForFormat(fmt);
- d->priv->insert(d->position, QString(QChar(QChar::ObjectReplacementCharacter)), idx);
+ d->priv->insert(d->position, QChar(QChar::ObjectReplacementCharacter), idx);
d->priv->endEditBlock();
}
diff --git a/src/gui/text/qtextcursor.h b/src/gui/text/qtextcursor.h
index 7cad3cc5e8..92c00c0189 100644
--- a/src/gui/text/qtextcursor.h
+++ b/src/gui/text/qtextcursor.h
@@ -1,41 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the QtGui module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#ifndef QTEXTCURSOR_H
#define QTEXTCURSOR_H
@@ -43,12 +7,11 @@
#include <QtGui/qtguiglobal.h>
#include <QtCore/qstring.h>
#include <QtCore/qshareddata.h>
+#include <QtGui/qtextdocument.h>
#include <QtGui/qtextformat.h>
QT_BEGIN_NAMESPACE
-
-class QTextDocument;
class QTextCursorPrivate;
class QTextDocumentFragment;
class QTextCharFormat;
@@ -73,11 +36,11 @@ public:
explicit QTextCursor(QTextFrame *frame);
explicit QTextCursor(const QTextBlock &block);
QTextCursor(const QTextCursor &cursor);
- QTextCursor &operator=(QTextCursor &&other) noexcept { swap(other); return *this; }
+ QT_MOVE_ASSIGNMENT_OPERATOR_IMPL_VIA_PURE_SWAP(QTextCursor)
QTextCursor &operator=(const QTextCursor &other);
~QTextCursor();
- void swap(QTextCursor &other) noexcept { qSwap(d, other.d); }
+ void swap(QTextCursor &other) noexcept { d.swap(other.d); }
bool isNull() const;
@@ -201,6 +164,10 @@ public:
#ifndef QT_NO_TEXTHTMLPARSER
void insertHtml(const QString &html);
#endif // QT_NO_TEXTHTMLPARSER
+#if QT_CONFIG(textmarkdownreader)
+ void insertMarkdown(const QString &markdown,
+ QTextDocument::MarkdownFeatures features = QTextDocument::MarkdownDialectGitHub);
+#endif // textmarkdownreader
void insertImage(const QTextImageFormat &format, QTextFrameFormat::Position alignment);
void insertImage(const QTextImageFormat &format);
diff --git a/src/gui/text/qtextcursor_p.h b/src/gui/text/qtextcursor_p.h
index 3569317b6d..f035ba6acf 100644
--- a/src/gui/text/qtextcursor_p.h
+++ b/src/gui/text/qtextcursor_p.h
@@ -1,41 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the QtGui module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#ifndef QTEXTCURSOR_P_H
#define QTEXTCURSOR_P_H
diff --git a/src/gui/text/qtextdocument.cpp b/src/gui/text/qtextdocument.cpp
index 1d27cc30eb..ab788a5f9b 100644
--- a/src/gui/text/qtextdocument.cpp
+++ b/src/gui/text/qtextdocument.cpp
@@ -1,59 +1,21 @@
-/****************************************************************************
-**
-** Copyright (C) 2019 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the QtGui module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2019 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#include "qtextdocument.h"
#include <qtextformat.h>
#include "qtextcursor_p.h"
+#include "qtextdocument_p.h"
#include "qtextdocumentlayout_p.h"
#include "qtextdocumentfragment.h"
#include "qtextdocumentfragment_p.h"
#include "qtexttable.h"
#include "qtextlist.h"
#include <qdebug.h>
-#include <qregexp.h>
+#include <qloggingcategory.h>
#if QT_CONFIG(regularexpression)
#include <qregularexpression.h>
#endif
#include <qvarlengtharray.h>
-#if QT_CONFIG(textcodec)
-#include <qtextcodec.h>
-#endif
#include <qthread.h>
#include <qcoreapplication.h>
#include <qmetaobject.h>
@@ -81,10 +43,19 @@
QT_BEGIN_NAMESPACE
+Q_DECLARE_LOGGING_CATEGORY(lcLayout);
+
+using namespace Qt::StringLiterals;
+
Q_CORE_EXPORT Q_DECL_CONST_FUNCTION unsigned int qt_int_sqrt(unsigned int n);
+namespace {
+ QTextDocument::ResourceProvider qt_defaultResourceProvider;
+};
/*!
+ \fn bool Qt::mightBeRichText(QAnyStringView text)
+
Returns \c true if the string \a text is likely to be rich text;
otherwise returns \c false.
@@ -94,57 +65,61 @@ Q_CORE_EXPORT Q_DECL_CONST_FUNCTION unsigned int qt_int_sqrt(unsigned int n);
for common cases, there is no guarantee.
This function is defined in the \c <QTextDocument> header file.
-*/
-bool Qt::mightBeRichText(const QString& text)
+
+ \note In Qt versions prior to 6.7, this function took QString only.
+ */
+template <typename T>
+static bool mightBeRichTextImpl(T text)
{
if (text.isEmpty())
return false;
- int start = 0;
+ qsizetype start = 0;
- while (start < text.length() && text.at(start).isSpace())
+ while (start < text.size() && QChar(text.at(start)).isSpace())
++start;
// skip a leading <?xml ... ?> as for example with xhtml
- if (text.midRef(start, 5).compare(QLatin1String("<?xml")) == 0) {
- while (start < text.length()) {
- if (text.at(start) == QLatin1Char('?')
- && start + 2 < text.length()
- && text.at(start + 1) == QLatin1Char('>')) {
+ if (text.mid(start, 5).compare("<?xml"_L1) == 0) {
+ while (start < text.size()) {
+ if (text.at(start) == u'?'
+ && start + 2 < text.size()
+ && text.at(start + 1) == u'>') {
start += 2;
break;
}
++start;
}
- while (start < text.length() && text.at(start).isSpace())
+ while (start < text.size() && QChar(text.at(start)).isSpace())
++start;
}
- if (text.midRef(start, 5).compare(QLatin1String("<!doc"), Qt::CaseInsensitive) == 0)
+ if (text.mid(start, 5).compare("<!doc"_L1, Qt::CaseInsensitive) == 0)
return true;
- int open = start;
- while (open < text.length() && text.at(open) != QLatin1Char('<')
- && text.at(open) != QLatin1Char('\n')) {
- if (text.at(open) == QLatin1Char('&') && text.midRef(open + 1, 3) == QLatin1String("lt;"))
+ qsizetype open = start;
+ while (open < text.size() && text.at(open) != u'<'
+ && text.at(open) != u'\n') {
+ if (text.at(open) == u'&' && text.mid(open + 1, 3) == "lt;"_L1)
return true; // support desperate attempt of user to see <...>
++open;
}
- if (open < text.length() && text.at(open) == QLatin1Char('<')) {
- const int close = text.indexOf(QLatin1Char('>'), open);
+ if (open < text.size() && text.at(open) == u'<') {
+ const qsizetype close = text.indexOf(u'>', open);
if (close > -1) {
- QString tag;
- for (int i = open+1; i < close; ++i) {
- if (text[i].isDigit() || text[i].isLetter())
- tag += text[i];
- else if (!tag.isEmpty() && text[i].isSpace())
+ QVarLengthArray<char16_t> tag;
+ for (qsizetype i = open + 1; i < close; ++i) {
+ const auto current = QChar(text[i]);
+ if (current.isDigit() || current.isLetter())
+ tag.append(current.toLower().unicode());
+ else if (!tag.isEmpty() && current.isSpace())
break;
- else if (!tag.isEmpty() && text[i] == QLatin1Char('/') && i + 1 == close)
+ else if (!tag.isEmpty() && current == u'/' && i + 1 == close)
break;
- else if (!text[i].isSpace() && (!tag.isEmpty() || text[i] != QLatin1Char('!')))
+ else if (!current.isSpace() && (!tag.isEmpty() || current != u'!'))
return false; // that's not a tag
}
#ifndef QT_NO_TEXTHTMLPARSER
- return QTextHtmlParser::lookupElement(std::move(tag).toLower()) != -1;
+ return QTextHtmlParser::lookupElement(tag) != -1;
#else
return false;
#endif // QT_NO_TEXTHTMLPARSER
@@ -153,6 +128,16 @@ bool Qt::mightBeRichText(const QString& text)
return false;
}
+static bool mightBeRichTextImpl(QUtf8StringView text)
+{
+ return mightBeRichTextImpl(QLatin1StringView(QByteArrayView(text)));
+}
+
+bool Qt::mightBeRichText(QAnyStringView text)
+{
+ return text.visit([](auto text) { return mightBeRichTextImpl(text); });
+}
+
/*!
Converts the plain text string \a plain to an HTML-formatted
paragraph while preserving most of its look.
@@ -165,66 +150,53 @@ bool Qt::mightBeRichText(const QString& text)
*/
QString Qt::convertFromPlainText(const QString &plain, Qt::WhiteSpaceMode mode)
{
- int col = 0;
+ qsizetype col = 0;
QString rich;
- rich += QLatin1String("<p>");
- for (int i = 0; i < plain.length(); ++i) {
- if (plain[i] == QLatin1Char('\n')){
- int c = 1;
- while (i+1 < plain.length() && plain[i+1] == QLatin1Char('\n')) {
+ rich += "<p>"_L1;
+ for (qsizetype i = 0; i < plain.size(); ++i) {
+ if (plain[i] == u'\n'){
+ qsizetype c = 1;
+ while (i+1 < plain.size() && plain[i+1] == u'\n') {
i++;
c++;
}
if (c == 1)
- rich += QLatin1String("<br>\n");
+ rich += "<br>\n"_L1;
else {
- rich += QLatin1String("</p>\n");
+ rich += "</p>\n"_L1;
while (--c > 1)
- rich += QLatin1String("<br>\n");
- rich += QLatin1String("<p>");
+ rich += "<br>\n"_L1;
+ rich += "<p>"_L1;
}
col = 0;
} else {
- if (mode == Qt::WhiteSpacePre && plain[i] == QLatin1Char('\t')){
- rich += QChar(0x00a0U);
+ if (mode == Qt::WhiteSpacePre && plain[i] == u'\t'){
+ rich += QChar::Nbsp;
++col;
while (col % 8) {
- rich += QChar(0x00a0U);
+ rich += QChar::Nbsp;
++col;
}
}
else if (mode == Qt::WhiteSpacePre && plain[i].isSpace())
- rich += QChar(0x00a0U);
- else if (plain[i] == QLatin1Char('<'))
- rich += QLatin1String("&lt;");
- else if (plain[i] == QLatin1Char('>'))
- rich += QLatin1String("&gt;");
- else if (plain[i] == QLatin1Char('&'))
- rich += QLatin1String("&amp;");
+ rich += QChar::Nbsp;
+ else if (plain[i] == u'<')
+ rich += "&lt;"_L1;
+ else if (plain[i] == u'>')
+ rich += "&gt;"_L1;
+ else if (plain[i] == u'&')
+ rich += "&amp;"_L1;
else
rich += plain[i];
++col;
}
}
if (col != 0)
- rich += QLatin1String("</p>");
+ rich += "</p>"_L1;
return rich;
}
/*!
- \fn QTextCodec *Qt::codecForHtml(const QByteArray &ba)
- \internal
-
- This function is defined in the \c <QTextDocument> header file.
-*/
-#if QT_CONFIG(textcodec)
-QTextCodec *Qt::codecForHtml(const QByteArray &ba)
-{
- return QTextCodec::codecForHtml(ba);
-}
-#endif
-
-/*!
\class QTextDocument
\reentrant
\inmodule QtGui
@@ -282,7 +254,7 @@ QTextCodec *Qt::codecForHtml(const QByteArray &ba)
\li Text block group format changes.
\endlist
- \sa QTextCursor, QTextEdit, {Rich Text Processing}, {Text Object Example}
+ \sa QTextCursor, QTextEdit, {Rich Text Processing}
*/
/*!
@@ -364,12 +336,14 @@ QTextDocument *QTextDocument::clone(QObject *parent) const
QTextDocumentPrivate *priv = doc->d_func();
priv->title = d->title;
priv->url = d->url;
+ priv->cssMedia = d->cssMedia;
priv->pageSize = d->pageSize;
priv->indentWidth = d->indentWidth;
priv->defaultTextOption = d->defaultTextOption;
priv->setDefaultFont(d->defaultFont());
priv->resources = d->resources;
priv->cachedResources.clear();
+ priv->resourceProvider = d->resourceProvider;
#ifndef QT_NO_CSSPARSER
priv->defaultStyleSheet = d->defaultStyleSheet;
priv->parsedDefaultStyleSheet = d->parsedDefaultStyleSheet;
@@ -680,6 +654,40 @@ bool QTextDocument::useDesignMetrics() const
}
/*!
+ \property QTextDocument::layoutEnabled
+ \since 6.4
+ \brief whether QTextDocument should recalculate the layout after every change
+
+ If this property is set to true, any change to the document triggers a layout,
+ which makes everything work as expected but takes time.
+
+ Temporarily disabling the layout can save time when making multiple changes
+ (not just text content, but also default font, default text option....)
+ so that the document is only laid out once at the end. This can be useful when
+ the text width or page size isn't yet known, for instance.
+
+ By default, this property is \c true.
+
+ \sa setTextWidth
+*/
+
+void QTextDocument::setLayoutEnabled(bool b)
+{
+ Q_D(QTextDocument);
+ if (d->layoutEnabled == b)
+ return;
+ d->layoutEnabled = b;
+ if (b && d->lout)
+ d->lout->documentChanged(0, 0, d->length());
+}
+
+bool QTextDocument::isLayoutEnabled() const
+{
+ Q_D(const QTextDocument);
+ return d->layoutEnabled;
+}
+
+/*!
\since 4.2
Draws the content of the document with painter \a p, clipped to \a rect.
@@ -722,6 +730,8 @@ void QTextDocument::setTextWidth(qreal width)
{
Q_D(QTextDocument);
QSizeF sz = d->pageSize;
+
+ qCDebug(lcLayout) << "page size" << sz << "-> width" << width;
sz.setWidth(width);
sz.setHeight(-1);
setPageSize(sz);
@@ -828,7 +838,7 @@ void QTextDocument::adjustSize()
// Pull this private function in from qglobal.cpp
QFont f = defaultFont();
QFontMetrics fm(f);
- int mw = fm.horizontalAdvance(QLatin1Char('x')) * 80;
+ int mw = fm.horizontalAdvance(u'x') * 80;
int w = mw;
setTextWidth(w);
QSizeF size = documentLayout()->documentSize();
@@ -849,7 +859,7 @@ void QTextDocument::adjustSize()
\property QTextDocument::size
\since 4.2
- Returns the actual size of the document.
+ \brief the actual size of the document.
This is equivalent to documentLayout()->documentSize();
The size of the document can be changed either by setting
@@ -871,7 +881,7 @@ QSizeF QTextDocument::size() const
\property QTextDocument::blockCount
\since 4.2
- Returns the number of text blocks in the document.
+ \brief the number of text blocks in the document.
The value of this property is undefined in documents with tables or frames.
@@ -904,6 +914,9 @@ int QTextDocument::lineCount() const
Returns the number of characters of this document.
+ \note As a QTextDocument always contains at least one
+ QChar::ParagraphSeparator, this method will return at least 1.
+
\sa blockCount(), characterAt()
*/
int QTextDocument::characterCount() const
@@ -1144,6 +1157,10 @@ QString QTextDocument::metaInformation(MetaInformation info) const
return d->title;
case DocumentUrl:
return d->url;
+ case CssMedia:
+ return d->cssMedia;
+ case FrontMatter:
+ return d->frontMatter;
}
return QString();
}
@@ -1164,6 +1181,12 @@ void QTextDocument::setMetaInformation(MetaInformation info, const QString &stri
case DocumentUrl:
d->url = string;
break;
+ case CssMedia:
+ d->cssMedia = string;
+ break;
+ case FrontMatter:
+ d->frontMatter = string;
+ break;
}
}
@@ -1203,19 +1226,27 @@ QString QTextDocument::toPlainText() const
Q_D(const QTextDocument);
QString txt = d->plainText();
+ constexpr char16_t delims[] = { 0xfdd0, 0xfdd1,
+ QChar::ParagraphSeparator, QChar::LineSeparator, QChar::Nbsp };
+
+ const size_t pos = std::u16string_view(txt).find_first_of(
+ std::u16string_view(delims, std::size(delims)));
+ if (pos == std::u16string_view::npos)
+ return txt;
+
QChar *uc = txt.data();
- QChar *e = uc + txt.size();
+ QChar *const e = uc + txt.size();
- for (; uc != e; ++uc) {
+ for (uc += pos; uc != e; ++uc) {
switch (uc->unicode()) {
case 0xfdd0: // QTextBeginningOfFrame
case 0xfdd1: // QTextEndOfFrame
case QChar::ParagraphSeparator:
case QChar::LineSeparator:
- *uc = QLatin1Char('\n');
+ *uc = u'\n';
break;
case QChar::Nbsp:
- *uc = QLatin1Char(' ');
+ *uc = u' ';
break;
default:
;
@@ -1251,11 +1282,14 @@ void QTextDocument::setPlainText(const QString &text)
"<b>bold</b> text" will produce text where the first word has a font
weight that gives it a bold appearance: "\b{bold} text".
+ To select a css media rule other than the default "screen" rule,
+ use setMetaInformation() with 'CssMedia' as "info" parameter.
+
\note It is the responsibility of the caller to make sure that the
text is correctly decoded when a QString containing HTML is created
and passed to setHtml().
- \sa setPlainText(), {Supported HTML Subset}
+ \sa setPlainText(), {Supported HTML Subset}, setMetaInformation()
*/
#ifndef QT_NO_TEXTHTMLPARSER
@@ -1267,6 +1301,8 @@ void QTextDocument::setHtml(const QString &html)
d->enableUndoRedo(false);
d->beginEditBlock();
d->clear();
+ // ctor calls parse() to build up QTextHtmlParser::nodes list
+ // then import() populates the QTextDocument from those
QTextHtmlImporter(this, html, QTextHtmlImporter::ImportToDocument).import();
d->endEditBlock();
d->enableUndoRedo(previousState);
@@ -1295,19 +1331,26 @@ void QTextDocument::setHtml(const QString &html)
\value DocumentTitle The title of the document.
\value DocumentUrl The url of the document. The loadResource() function uses
this url as the base when loading relative resources.
+ \value CssMedia This value is used to select the corresponding '@media'
+ rule, if any, from a specified CSS stylesheet when setHtml()
+ is called. This enum value has been introduced in Qt 6.3.
+ \value FrontMatter This value is used to select header material, if any was
+ extracted during parsing of the source file (currently
+ only from Markdown format). This enum value has been
+ introduced in Qt 6.8.
- \sa metaInformation(), setMetaInformation()
+ \sa metaInformation(), setMetaInformation(), setHtml()
*/
static bool findInBlock(const QTextBlock &block, const QString &expression, int offset,
QTextDocument::FindFlags options, QTextCursor *cursor)
{
QString text = block.text();
- text.replace(QChar::Nbsp, QLatin1Char(' '));
+ text.replace(QChar::Nbsp, u' ');
Qt::CaseSensitivity sensitivity = options & QTextDocument::FindCaseSensitively ? Qt::CaseSensitive : Qt::CaseInsensitive;
int idx = -1;
- while (offset >= 0 && offset <= text.length()) {
+ while (offset >= 0 && offset <= text.size()) {
idx = (options & QTextDocument::FindBackward) ?
text.lastIndexOf(expression, offset, sensitivity) : text.indexOf(expression, offset, sensitivity);
if (idx == -1)
@@ -1315,9 +1358,9 @@ static bool findInBlock(const QTextBlock &block, const QString &expression, int
if (options & QTextDocument::FindWholeWords) {
const int start = idx;
- const int end = start + expression.length();
+ const int end = start + expression.size();
if ((start != 0 && text.at(start - 1).isLetterOrNumber())
- || (end != text.length() && text.at(end).isLetterOrNumber())) {
+ || (end != text.size() && text.at(end).isLetterOrNumber())) {
//if this is not a whole word, continue the search in the string
offset = (options & QTextDocument::FindBackward) ? idx-1 : end+1;
idx = -1;
@@ -1325,8 +1368,9 @@ static bool findInBlock(const QTextBlock &block, const QString &expression, int
}
}
//we have a hit, return the cursor for that.
- *cursor = QTextCursorPrivate::fromPosition(block.docHandle(), block.position() + idx);
- cursor->setPosition(cursor->position() + expression.length(), QTextCursor::KeepAnchor);
+ *cursor = QTextCursorPrivate::fromPosition(const_cast<QTextDocumentPrivate *>(QTextDocumentPrivate::get(block)),
+ block.position() + idx);
+ cursor->setPosition(cursor->position() + expression.size(), QTextCursor::KeepAnchor);
return true;
}
return false;
@@ -1417,145 +1461,16 @@ QTextCursor QTextDocument::find(const QString &subString, const QTextCursor &cur
return find(subString, pos, options);
}
-
-#ifndef QT_NO_REGEXP
-static bool findInBlock(const QTextBlock &block, const QRegExp &expression, int offset,
- QTextDocument::FindFlags options, QTextCursor *cursor)
-{
- QRegExp expr(expression);
- QString text = block.text();
- text.replace(QChar::Nbsp, QLatin1Char(' '));
-
- int idx = -1;
- while (offset >=0 && offset <= text.length()) {
- idx = (options & QTextDocument::FindBackward) ?
- expr.lastIndexIn(text, offset) : expr.indexIn(text, offset);
- if (idx == -1)
- return false;
-
- if (options & QTextDocument::FindWholeWords) {
- const int start = idx;
- const int end = start + expr.matchedLength();
- if ((start != 0 && text.at(start - 1).isLetterOrNumber())
- || (end != text.length() && text.at(end).isLetterOrNumber())) {
- //if this is not a whole word, continue the search in the string
- offset = (options & QTextDocument::FindBackward) ? idx-1 : end+1;
- idx = -1;
- continue;
- }
- }
- //we have a hit, return the cursor for that.
- *cursor = QTextCursorPrivate::fromPosition(block.docHandle(), block.position() + idx);
- cursor->setPosition(cursor->position() + expr.matchedLength(), QTextCursor::KeepAnchor);
- return true;
- }
- return false;
-}
-
-/*!
- \overload
-
- Finds the next occurrence that matches the given regular expression,
- \a expr, within the same paragraph in the document.
-
- The search starts at the given \a from position, and proceeds forwards
- through the document unless specified otherwise in the search options.
- The \a options control the type of search performed. The FindCaseSensitively
- option is ignored for this overload, use QRegExp::caseSensitivity instead.
-
- Returns a cursor with the match selected if a match was found; otherwise
- returns a null cursor.
-
- If the \a from position is 0 (the default) the search begins from the beginning
- of the document; otherwise it begins at the specified position.
-*/
-QTextCursor QTextDocument::find(const QRegExp & expr, int from, FindFlags options) const
-{
- Q_D(const QTextDocument);
-
- if (expr.isEmpty())
- return QTextCursor();
-
- int pos = from;
- //the cursor is positioned between characters, so for a backward search
- //do not include the character given in the position.
- if (options & FindBackward) {
- --pos ;
- if(pos < 0)
- return QTextCursor();
- }
-
- QTextCursor cursor;
- QTextBlock block = d->blocksFind(pos);
- int blockOffset = pos - block.position();
- if (!(options & FindBackward)) {
- while (block.isValid()) {
- if (findInBlock(block, expr, blockOffset, options, &cursor))
- return cursor;
- block = block.next();
- blockOffset = 0;
- }
- } else {
- while (block.isValid()) {
- if (findInBlock(block, expr, blockOffset, options, &cursor))
- return cursor;
- block = block.previous();
- blockOffset = block.length() - 1;
- }
- }
-
- return QTextCursor();
-}
-
-/*!
- \overload
-
- Finds the next occurrence that matches the given regular expression,
- \a expr, within the same paragraph in the document.
-
- The search starts at the position of the given from \a cursor, and proceeds
- forwards through the document unless specified otherwise in the search
- options. The \a options control the type of search performed. The FindCaseSensitively
- option is ignored for this overload, use QRegExp::caseSensitivity instead.
-
- Returns a cursor with the match selected if a match was found; otherwise
- returns a null cursor.
-
- If the given \a cursor has a selection, the search begins after the
- selection; otherwise it begins at the cursor's position.
-
- By default the search is case insensitive, and can match text anywhere in the
- document.
-*/
-QTextCursor QTextDocument::find(const QRegExp &expr, const QTextCursor &cursor, FindFlags options) const
-{
- int pos = 0;
- if (!cursor.isNull()) {
- if (options & QTextDocument::FindBackward)
- pos = cursor.selectionStart();
- else
- pos = cursor.selectionEnd();
- }
- return find(expr, pos, options);
-}
-#endif // QT_REGEXP
-
#if QT_CONFIG(regularexpression)
-static bool findInBlock(const QTextBlock &block, const QRegularExpression &expression, int offset,
+static bool findInBlock(const QTextBlock &block, const QRegularExpression &expr, int offset,
QTextDocument::FindFlags options, QTextCursor *cursor)
{
- QRegularExpression expr(expression);
- if (!(options & QTextDocument::FindCaseSensitively))
- expr.setPatternOptions(expr.patternOptions() | QRegularExpression::CaseInsensitiveOption);
- else
- expr.setPatternOptions(expr.patternOptions() & ~QRegularExpression::CaseInsensitiveOption);
-
QString text = block.text();
- text.replace(QChar::Nbsp, QLatin1Char(' '));
+ text.replace(QChar::Nbsp, u' ');
QRegularExpressionMatch match;
int idx = -1;
- while (offset >= 0 && offset <= text.length()) {
+ while (offset >= 0 && offset <= text.size()) {
idx = (options & QTextDocument::FindBackward) ?
text.lastIndexOf(expr, offset, &match) : text.indexOf(expr, offset, &match);
if (idx == -1)
@@ -1565,7 +1480,7 @@ static bool findInBlock(const QTextBlock &block, const QRegularExpression &expre
const int start = idx;
const int end = start + match.capturedLength();
if ((start != 0 && text.at(start - 1).isLetterOrNumber())
- || (end != text.length() && text.at(end).isLetterOrNumber())) {
+ || (end != text.size() && text.at(end).isLetterOrNumber())) {
//if this is not a whole word, continue the search in the string
offset = (options & QTextDocument::FindBackward) ? idx-1 : end+1;
idx = -1;
@@ -1573,7 +1488,8 @@ static bool findInBlock(const QTextBlock &block, const QRegularExpression &expre
}
}
//we have a hit, return the cursor for that.
- *cursor = QTextCursorPrivate::fromPosition(block.docHandle(), block.position() + idx);
+ *cursor = QTextCursorPrivate::fromPosition(const_cast<QTextDocumentPrivate *>(QTextDocumentPrivate::get(block)),
+ block.position() + idx);
cursor->setPosition(cursor->position() + match.capturedLength(), QTextCursor::KeepAnchor);
return true;
}
@@ -1595,6 +1511,10 @@ static bool findInBlock(const QTextBlock &block, const QRegularExpression &expre
If the \a from position is 0 (the default) the search begins from the beginning
of the document; otherwise it begins at the specified position.
+
+ \warning For historical reasons, the case sensitivity option set on
+ \a expr is ignored. Instead, the \a options are used to determine
+ if the search is case sensitive or not.
*/
QTextCursor QTextDocument::find(const QRegularExpression &expr, int from, FindFlags options) const
{
@@ -1616,16 +1536,22 @@ QTextCursor QTextDocument::find(const QRegularExpression &expr, int from, FindFl
QTextBlock block = d->blocksFind(pos);
int blockOffset = pos - block.position();
+ QRegularExpression expression(expr);
+ if (!(options & QTextDocument::FindCaseSensitively))
+ expression.setPatternOptions(expr.patternOptions() | QRegularExpression::CaseInsensitiveOption);
+ else
+ expression.setPatternOptions(expr.patternOptions() & ~QRegularExpression::CaseInsensitiveOption);
+
if (!(options & FindBackward)) {
while (block.isValid()) {
- if (findInBlock(block, expr, blockOffset, options, &cursor))
+ if (findInBlock(block, expression, blockOffset, options, &cursor))
return cursor;
block = block.next();
blockOffset = 0;
}
} else {
while (block.isValid()) {
- if (findInBlock(block, expr, blockOffset, options, &cursor))
+ if (findInBlock(block, expression, blockOffset, options, &cursor))
return cursor;
block = block.previous();
blockOffset = block.length() - 1;
@@ -1734,7 +1660,7 @@ QTextObject *QTextDocument::objectForFormat(const QTextFormat &f) const
QTextBlock QTextDocument::findBlock(int pos) const
{
Q_D(const QTextDocument);
- return QTextBlock(docHandle(), d->blockMap().findNode(pos));
+ return QTextBlock(const_cast<QTextDocumentPrivate *>(d), d->blockMap().findNode(pos));
}
/*!
@@ -1746,7 +1672,7 @@ QTextBlock QTextDocument::findBlock(int pos) const
QTextBlock QTextDocument::findBlockByNumber(int blockNumber) const
{
Q_D(const QTextDocument);
- return QTextBlock(docHandle(), d->blockMap().findNode(blockNumber, 1));
+ return QTextBlock(const_cast<QTextDocumentPrivate *>(d), d->blockMap().findNode(blockNumber, 1));
}
/*!
@@ -1758,7 +1684,7 @@ QTextBlock QTextDocument::findBlockByNumber(int blockNumber) const
QTextBlock QTextDocument::findBlockByLineNumber(int lineNumber) const
{
Q_D(const QTextDocument);
- return QTextBlock(docHandle(), d->blockMap().findNode(lineNumber, 2));
+ return QTextBlock(const_cast<QTextDocumentPrivate *>(d), d->blockMap().findNode(lineNumber, 2));
}
/*!
@@ -1769,14 +1695,14 @@ QTextBlock QTextDocument::findBlockByLineNumber(int lineNumber) const
QTextBlock QTextDocument::begin() const
{
Q_D(const QTextDocument);
- return QTextBlock(docHandle(), d->blockMap().begin().n);
+ return QTextBlock(const_cast<QTextDocumentPrivate *>(d), d->blockMap().begin().n);
}
/*!
This function returns a block to test for the end of the document
while iterating over it.
- \snippet textdocumentendsnippet.cpp 0
+ \snippet textdocument-end/textdocumentendsnippet.cpp 0
The block returned is invalid and represents the block after the
last block in the document. You can use lastBlock() to retrieve the
@@ -1786,7 +1712,8 @@ QTextBlock QTextDocument::begin() const
*/
QTextBlock QTextDocument::end() const
{
- return QTextBlock(docHandle(), 0);
+ Q_D(const QTextDocument);
+ return QTextBlock(const_cast<QTextDocumentPrivate *>(d), 0);
}
/*!
@@ -1796,7 +1723,7 @@ QTextBlock QTextDocument::end() const
QTextBlock QTextDocument::firstBlock() const
{
Q_D(const QTextDocument);
- return QTextBlock(docHandle(), d->blockMap().begin().n);
+ return QTextBlock(const_cast<QTextDocumentPrivate *>(d), d->blockMap().begin().n);
}
/*!
@@ -1806,7 +1733,7 @@ QTextBlock QTextDocument::firstBlock() const
QTextBlock QTextDocument::lastBlock() const
{
Q_D(const QTextDocument);
- return QTextBlock(docHandle(), d->blockMap().last().n);
+ return QTextBlock(const_cast<QTextDocumentPrivate *>(d), d->blockMap().last().n);
}
/*!
@@ -1866,6 +1793,95 @@ QFont QTextDocument::defaultFont() const
}
/*!
+ \fn void QTextDocument::setSuperScriptBaseline(qreal baseline)
+ \since 6.0
+
+ Sets the default superscript's base line as a % of font height to use in the document
+ layout to \a baseline. The default value is 50% (1/2 of height).
+
+ \sa superScriptBaseline(), setSubScriptBaseline(), subScriptBaseline(), setBaselineOffset(), baselineOffset()
+*/
+void QTextDocument::setSuperScriptBaseline(qreal baseline)
+{
+ Q_D(QTextDocument);
+ d->formats.setSuperScriptBaseline(baseline);
+}
+
+/*!
+ \fn qreal QTextDocument::superScriptBaseline() const
+ \since 6.0
+
+ Returns the superscript's base line as a % of font height used in the document layout.
+
+ \sa setSuperScriptBaseline(), setSubScriptBaseline(), subScriptBaseline(), setBaselineOffset(), baselineOffset()
+*/
+qreal QTextDocument::superScriptBaseline() const
+{
+ Q_D(const QTextDocument);
+ return d->formats.defaultTextFormat().superScriptBaseline();
+}
+
+/*!
+ \fn void QTextDocument::setSubScriptBaseline(qreal baseline)
+ \since 6.0
+
+ Sets the default subscript's base line as a % of font height to use in the document layout
+ to \a baseline. The default value is 16.67% (1/6 of height).
+
+ \sa subScriptBaseline(), setSuperScriptBaseline(), superScriptBaseline(), setBaselineOffset(), baselineOffset()
+*/
+void QTextDocument::setSubScriptBaseline(qreal baseline)
+{
+ Q_D(QTextDocument);
+ d->formats.setSubScriptBaseline(baseline);
+}
+
+/*!
+ \fn qreal QTextDocument::subScriptBaseline() const
+ \since 6.0
+
+ Returns the superscript's base line as a % of font height used in the document layout.
+
+ \sa setSubScriptBaseline(), setSuperScriptBaseline(), superScriptBaseline(), setBaselineOffset(), baselineOffset()
+*/
+qreal QTextDocument::subScriptBaseline() const
+{
+ Q_D(const QTextDocument);
+ return d->formats.defaultTextFormat().subScriptBaseline();
+}
+
+/*!
+ \fn void QTextDocument::setBaselineOffset(qreal baseline)
+ \since 6.0
+
+ Sets the base line as a% of font height to use in the document layout to \a baseline.
+ The default value is 0.
+ A positive value moves up the text, by the corresponding %; a negative value moves it down.
+
+ \sa baselineOffset(), setSubScriptBaseline(), subScriptBaseline(), setSuperScriptBaseline(), superScriptBaseline()
+*/
+void QTextDocument::setBaselineOffset(qreal baseline)
+{
+ Q_D(QTextDocument);
+ d->formats.setBaselineOffset(baseline);
+}
+
+/*!
+ \fn qreal QTextDocument::baselineOffset() const
+ \since 6.0
+
+ Returns the baseline offset in % used in the document layout.
+
+ \sa setBaselineOffset(), setSubScriptBaseline(), subScriptBaseline(), setSuperScriptBaseline(),
+ superScriptBaseline()
+*/
+qreal QTextDocument::baselineOffset() const
+{
+ Q_D(const QTextDocument);
+ return d->formats.defaultTextFormat().baselineOffset();
+}
+
+/*!
\fn void QTextDocument::modificationChanged(bool changed)
This signal is emitted whenever the content of the document
@@ -1890,12 +1906,14 @@ QFont QTextDocument::defaultFont() const
bool QTextDocument::isModified() const
{
- return docHandle()->isModified();
+ Q_D(const QTextDocument);
+ return d->isModified();
}
void QTextDocument::setModified(bool m)
{
- docHandle()->setModified(m);
+ Q_D(QTextDocument);
+ d->setModified(m);
}
#ifndef QT_NO_PRINTER
@@ -1959,13 +1977,14 @@ void QTextDocument::print(QPagedPaintDevice *printer) const
bool documentPaginated = d->pageSize.isValid() && !d->pageSize.isNull()
&& d->pageSize.height() != INT_MAX;
- QPagedPaintDevicePrivate *pd = QPagedPaintDevicePrivate::get(printer);
-
// ### set page size to paginated size?
- QPagedPaintDevice::Margins m = printer->margins();
- if (!documentPaginated && m.left == 0. && m.right == 0. && m.top == 0. && m.bottom == 0.) {
- m.left = m.right = m.top = m.bottom = 2.;
- printer->setMargins(m);
+ QMarginsF m = printer->pageLayout().margins(QPageLayout::Millimeter);
+ if (!documentPaginated && m.left() == 0. && m.right() == 0. && m.top() == 0. && m.bottom() == 0.) {
+ m.setLeft(2);
+ m.setRight(2);
+ m.setTop(2);
+ m.setBottom(2);
+ printer->setPageMargins(m, QPageLayout::Millimeter);
}
// ### use the margins correctly
@@ -2043,8 +2062,9 @@ void QTextDocument::print(QPagedPaintDevice *printer) const
clonedDoc->setPageSize(body.size());
}
- int fromPage = pd->fromPage;
- int toPage = pd->toPage;
+ const QPageRanges pageRanges = printer->pageRanges();
+ int fromPage = pageRanges.firstPage();
+ int toPage = pageRanges.lastPage();
if (fromPage == 0 && toPage == 0) {
fromPage = 1;
@@ -2070,7 +2090,8 @@ void QTextDocument::print(QPagedPaintDevice *printer) const
int page = fromPage;
while (true) {
- printPage(page, &p, doc, body, pageNumberPos);
+ if (pageRanges.isEmpty() || pageRanges.contains(page))
+ printPage(page, &p, doc, body, pageNumberPos);
if (page == toPage)
break;
@@ -2090,10 +2111,10 @@ void QTextDocument::print(QPagedPaintDevice *printer) const
\value UnknownResource No resource is loaded, or the resource type is not known.
\value HtmlResource The resource contains HTML.
\value ImageResource The resource contains image data.
- Currently supported data types are QVariant::Pixmap and
- QVariant::Image. If the corresponding variant is of type
- QVariant::ByteArray then Qt attempts to load the image using
- QImage::loadFromData. QVariant::Icon is currently not supported.
+ Currently supported data types are QMetaType::QPixmap and
+ QMetaType::QImage. If the corresponding variant is of type
+ QMetaType::QByteArray then Qt attempts to load the image using
+ QImage::loadFromData. QMetaType::QIcon is currently not supported.
The icon needs to be converted to one of the supported types first,
for example using QIcon::pixmap.
\value StyleSheetResource The resource contains CSS.
@@ -2118,7 +2139,11 @@ void QTextDocument::print(QPagedPaintDevice *printer) const
the resource. loadResource should then use addResource to add the
resource to the cache.
- \sa QTextDocument::ResourceType
+ If loadResource does not load the resource, then the resourceProvider and
+ lastly the defaultResourceProvider will be called, if set. Note that the
+ result from the provider will not be added automatically to the cache.
+
+ \sa QTextDocument::ResourceType, resourceProvider()
*/
QVariant QTextDocument::resource(int type, const QUrl &name) const
{
@@ -2127,8 +2152,15 @@ QVariant QTextDocument::resource(int type, const QUrl &name) const
QVariant r = d->resources.value(url);
if (!r.isValid()) {
r = d->cachedResources.value(url);
- if (!r.isValid())
+ if (!r.isValid()) {
r = const_cast<QTextDocument *>(this)->loadResource(type, url);
+ if (!r.isValid()) {
+ if (d->resourceProvider)
+ r = d->resourceProvider(url);
+ else if (auto defaultProvider = defaultResourceProvider())
+ r = defaultProvider(url);
+ }
+ }
}
return r;
}
@@ -2159,6 +2191,66 @@ void QTextDocument::addResource(int type, const QUrl &name, const QVariant &reso
}
/*!
+ \since 6.1
+
+ Returns the resource provider for this text document.
+
+ \sa setResourceProvider(), defaultResourceProvider(), loadResource()
+*/
+QTextDocument::ResourceProvider QTextDocument::resourceProvider() const
+{
+ Q_D(const QTextDocument);
+ return d->resourceProvider;
+}
+
+/*!
+ \since 6.1
+ \typealias QTextDocument::ResourceProvider
+
+ Type alias for std::function\<QVariant(const QUrl&)\>.
+*/
+
+/*!
+ \since 6.1
+
+ Sets the provider of resources for the text document to \a provider.
+
+ \sa resourceProvider(), loadResource()
+*/
+void QTextDocument::setResourceProvider(const ResourceProvider &provider)
+{
+ Q_D(QTextDocument);
+ d->resourceProvider = provider;
+}
+
+/*!
+ \since 6.1
+
+ Sets the default resource provider to \a provider.
+
+ The default provider will be used by all QTextDocuments that don't have an
+ explicit provider set.
+
+ \sa setResourceProvider(), loadResource()
+*/
+void QTextDocument::setDefaultResourceProvider(const ResourceProvider &provider)
+{
+ qt_defaultResourceProvider = provider;
+}
+
+/*!
+ \since 6.1
+
+ Returns the default resource provider.
+
+ \sa resourceProvider(), loadResource()
+*/
+QTextDocument::ResourceProvider QTextDocument::defaultResourceProvider()
+{
+ return qt_defaultResourceProvider;
+}
+
+/*!
Loads data of the specified \a type from the resource with the
given \a name.
@@ -2174,6 +2266,8 @@ void QTextDocument::addResource(int type, const QUrl &name, const QVariant &reso
loadResource method such as QTextEdit, QTextBrowser
or a QTextDocument itself then the default implementation tries
to retrieve the data from the parent.
+
+ \sa QTextDocument::ResourceProvider
*/
QVariant QTextDocument::loadResource(int type, const QUrl &name)
{
@@ -2186,12 +2280,13 @@ QVariant QTextDocument::loadResource(int type, const QUrl &name)
int index = me->indexOfMethod("loadResource(int,QUrl)");
if (index >= 0) {
QMetaMethod loader = me->method(index);
- loader.invoke(p, Q_RETURN_ARG(QVariant, r), Q_ARG(int, type), Q_ARG(QUrl, name));
+ // don't invoke() via a queued connection: this function needs to return a value
+ loader.invoke(p, Qt::DirectConnection, Q_RETURN_ARG(QVariant, r), Q_ARG(int, type), Q_ARG(QUrl, name));
}
}
// handle data: URLs
- if (r.isNull() && name.scheme().compare(QLatin1String("data"), Qt::CaseInsensitive) == 0) {
+ if (r.isNull() && name.scheme().compare("data"_L1, Qt::CaseInsensitive) == 0) {
QString mimetype;
QByteArray payload;
if (qDecodeDataUrl(name, mimetype, payload))
@@ -2207,7 +2302,7 @@ QVariant QTextDocument::loadResource(int type, const QUrl &name)
// For the second case QUrl can merge "#someanchor" with "foo.html"
// correctly to "foo.html#someanchor"
if (!(currentURL.isRelative()
- || (currentURL.scheme() == QLatin1String("file")
+ || (currentURL.scheme() == "file"_L1
&& !QFileInfo(currentURL.toLocalFile()).isAbsolute()))
|| (name.hasFragment() && name.path().isEmpty())) {
resourceUrl = currentURL.resolved(name);
@@ -2220,7 +2315,7 @@ QVariant QTextDocument::loadResource(int type, const QUrl &name)
resourceUrl =
QUrl::fromLocalFile(fi.absolutePath() + QDir::separator()).resolved(name);
} else if (currentURL.isEmpty()) {
- resourceUrl.setScheme(QLatin1String("file"));
+ resourceUrl.setScheme("file"_L1);
}
}
}
@@ -2234,7 +2329,7 @@ QVariant QTextDocument::loadResource(int type, const QUrl &name)
}
if (!r.isNull()) {
- if (type == ImageResource && r.type() == QVariant::ByteArray) {
+ if (type == ImageResource && r.userType() == QMetaType::QByteArray) {
if (qApp->thread() != QThread::currentThread()) {
// must use images in non-GUI threads
QImage image;
@@ -2273,13 +2368,17 @@ static QString colorValue(QColor color)
if (color.alpha() == 255) {
result = color.name();
} else if (color.alpha()) {
- QString alphaValue = QString::number(color.alphaF(), 'f', 6).remove(QRegExp(QLatin1String("\\.?0*$")));
+ QString alphaValue = QString::number(color.alphaF(), 'f', 6);
+ while (alphaValue.size() > 1 && alphaValue.at(alphaValue.size() - 1) == u'0')
+ alphaValue.chop(1);
+ if (alphaValue.at(alphaValue.size() - 1) == u'.')
+ alphaValue.chop(1);
result = QString::fromLatin1("rgba(%1,%2,%3,%4)").arg(color.red())
.arg(color.green())
.arg(color.blue())
.arg(alphaValue);
} else {
- result = QLatin1String("transparent");
+ result = "transparent"_L1;
}
return result;
@@ -2290,11 +2389,11 @@ QTextHtmlExporter::QTextHtmlExporter(const QTextDocument *_doc)
{
const QFont defaultFont = doc->defaultFont();
defaultCharFormat.setFont(defaultFont);
- // don't export those for the default font since we cannot turn them off with CSS
- defaultCharFormat.clearProperty(QTextFormat::FontUnderline);
- defaultCharFormat.clearProperty(QTextFormat::FontOverline);
- defaultCharFormat.clearProperty(QTextFormat::FontStrikeOut);
- defaultCharFormat.clearProperty(QTextFormat::TextUnderlineStyle);
+}
+
+static QStringList resolvedFontFamilies(const QTextCharFormat &format)
+{
+ return format.fontFamilies().toStringList();
}
/*!
@@ -2302,57 +2401,96 @@ QTextHtmlExporter::QTextHtmlExporter(const QTextDocument *_doc)
perfect, especially for complex documents, due to the limitations
of HTML.
*/
-QString QTextHtmlExporter::toHtml(const QByteArray &encoding, ExportMode mode)
+QString QTextHtmlExporter::toHtml(ExportMode mode)
{
- html = QLatin1String("<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.0//EN\" "
- "\"http://www.w3.org/TR/REC-html40/strict.dtd\">\n"
- "<html><head><meta name=\"qrichtext\" content=\"1\" />");
- html.reserve(doc->docHandle()->length());
+ html = "<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.0//EN\" "
+ "\"http://www.w3.org/TR/REC-html40/strict.dtd\">\n"
+ "<html><head><meta name=\"qrichtext\" content=\"1\" />"_L1;
+ html.reserve(QTextDocumentPrivate::get(doc)->length());
fragmentMarkers = (mode == ExportFragment);
- if (!encoding.isEmpty())
- html += QString::fromLatin1("<meta http-equiv=\"Content-Type\" content=\"text/html; charset=%1\" />").arg(QString::fromLatin1(encoding));
+ html += "<meta charset=\"utf-8\" />"_L1;
QString title = doc->metaInformation(QTextDocument::DocumentTitle);
- if (!title.isEmpty())
- html += QString::fromLatin1("<title>") + title + QString::fromLatin1("</title>");
- html += QLatin1String("<style type=\"text/css\">\n");
- html += QLatin1String("p, li { white-space: pre-wrap; }\n");
- html += QLatin1String("</style>");
- html += QLatin1String("</head><body");
+ if (!title.isEmpty()) {
+ html += "<title>"_L1;
+ html += title;
+ html += "</title>"_L1;
+ }
+ html += "<style type=\"text/css\">\n"_L1;
+ html += "p, li { white-space: pre-wrap; }\n"_L1;
+ html += "hr { height: 1px; border-width: 0; }\n"_L1;
+ html += "li.unchecked::marker { content: \"\\2610\"; }\n"_L1;
+ html += "li.checked::marker { content: \"\\2612\"; }\n"_L1;
+ html += "</style>"_L1;
+ html += "</head><body"_L1;
if (mode == ExportEntireDocument) {
- html += QLatin1String(" style=\"");
+ html += " style=\""_L1;
- QStringList fontFamilies = defaultCharFormat.fontFamilies().toStringList();
- if (!fontFamilies.isEmpty())
- emitFontFamily(fontFamilies);
- else
- emitFontFamily(defaultCharFormat.fontFamily());
+ emitFontFamily(resolvedFontFamilies(defaultCharFormat));
if (defaultCharFormat.hasProperty(QTextFormat::FontPointSize)) {
- html += QLatin1String(" font-size:");
+ html += " font-size:"_L1;
html += QString::number(defaultCharFormat.fontPointSize());
- html += QLatin1String("pt;");
+ html += "pt;"_L1;
} else if (defaultCharFormat.hasProperty(QTextFormat::FontPixelSize)) {
- html += QLatin1String(" font-size:");
+ html += " font-size:"_L1;
html += QString::number(defaultCharFormat.intProperty(QTextFormat::FontPixelSize));
- html += QLatin1String("px;");
+ html += "px;"_L1;
}
- html += QLatin1String(" font-weight:");
- html += QString::number(defaultCharFormat.fontWeight() * 8);
- html += QLatin1Char(';');
+ html += " font-weight:"_L1;
+ html += QString::number(defaultCharFormat.fontWeight());
+ html += u';';
+
+ html += " font-style:"_L1;
+ html += (defaultCharFormat.fontItalic() ? "italic"_L1 : "normal"_L1);
+ html += u';';
+
+ const bool percentSpacing = (defaultCharFormat.fontLetterSpacingType() == QFont::PercentageSpacing);
+ if (defaultCharFormat.hasProperty(QTextFormat::FontLetterSpacing) &&
+ (!percentSpacing || defaultCharFormat.fontLetterSpacing() != 0.0)) {
+ html += " letter-spacing:"_L1;
+ qreal value = defaultCharFormat.fontLetterSpacing();
+ if (percentSpacing) // Map to em (100% == 0em)
+ value = (value / 100) - 1;
+ html += QString::number(value);
+ html += percentSpacing ? "em;"_L1 : "px;"_L1;
+ }
- html += QLatin1String(" font-style:");
- html += (defaultCharFormat.fontItalic() ? QLatin1String("italic") : QLatin1String("normal"));
- html += QLatin1Char(';');
+ if (defaultCharFormat.hasProperty(QTextFormat::FontWordSpacing) &&
+ defaultCharFormat.fontWordSpacing() != 0.0) {
+ html += " word-spacing:"_L1;
+ html += QString::number(defaultCharFormat.fontWordSpacing());
+ html += "px;"_L1;
+ }
- // do not set text-decoration on the default font since those values are /always/ propagated
- // and cannot be turned off with CSS
+ QString decorationTag(" text-decoration:"_L1);
+ bool atLeastOneDecorationSet = false;
+ if (defaultCharFormat.hasProperty(QTextFormat::FontUnderline) || defaultCharFormat.hasProperty(QTextFormat::TextUnderlineStyle)) {
+ if (defaultCharFormat.fontUnderline()) {
+ decorationTag += " underline"_L1;
+ atLeastOneDecorationSet = true;
+ }
+ }
+ if (defaultCharFormat.hasProperty(QTextFormat::FontOverline)) {
+ if (defaultCharFormat.fontOverline()) {
+ decorationTag += " overline"_L1;
+ atLeastOneDecorationSet = true;
+ }
+ }
+ if (defaultCharFormat.hasProperty(QTextFormat::FontStrikeOut)) {
+ if (defaultCharFormat.fontStrikeOut()) {
+ decorationTag += " line-through"_L1;
+ atLeastOneDecorationSet = true;
+ }
+ }
+ if (atLeastOneDecorationSet)
+ html += decorationTag + u';';
- html += QLatin1Char('\"');
+ html += u'\"';
const QTextFrameFormat fmt = doc->rootFrame()->frameFormat();
emitBackgroundAttribute(fmt);
@@ -2360,7 +2498,7 @@ QString QTextHtmlExporter::toHtml(const QByteArray &encoding, ExportMode mode)
} else {
defaultCharFormat = QTextCharFormat();
}
- html += QLatin1Char('>');
+ html += u'>';
QTextFrameFormat rootFmt = doc->rootFrame()->frameFormat();
rootFmt.clearProperty(QTextFormat::BackgroundBrush);
@@ -2373,17 +2511,17 @@ QString QTextHtmlExporter::toHtml(const QByteArray &encoding, ExportMode mode)
else
emitTextFrame(doc->rootFrame());
- html += QLatin1String("</body></html>");
+ html += "</body></html>"_L1;
return html;
}
void QTextHtmlExporter::emitAttribute(const char *attribute, const QString &value)
{
- html += QLatin1Char(' ');
- html += QLatin1String(attribute);
- html += QLatin1String("=\"");
+ html += u' ';
+ html += QLatin1StringView(attribute);
+ html += "=\""_L1;
html += value.toHtmlEscaped();
- html += QLatin1Char('"');
+ html += u'"';
}
bool QTextHtmlExporter::emitCharFormatStyle(const QTextCharFormat &format)
@@ -2391,22 +2529,18 @@ bool QTextHtmlExporter::emitCharFormatStyle(const QTextCharFormat &format)
bool attributesEmitted = false;
{
- const QStringList families = format.fontFamilies().toStringList();
- const QString family = format.fontFamily();
- if (!families.isEmpty() && families != defaultCharFormat.fontFamilies().toStringList()) {
+ const QStringList families = resolvedFontFamilies(format);
+ if (!families.isEmpty() && families != resolvedFontFamilies(defaultCharFormat)) {
emitFontFamily(families);
attributesEmitted = true;
- } else if (!family.isEmpty() && family != defaultCharFormat.fontFamily()) {
- emitFontFamily(family);
- attributesEmitted = true;
}
}
if (format.hasProperty(QTextFormat::FontPointSize)
&& format.fontPointSize() != defaultCharFormat.fontPointSize()) {
- html += QLatin1String(" font-size:");
+ html += " font-size:"_L1;
html += QString::number(format.fontPointSize());
- html += QLatin1String("pt;");
+ html += "pt;"_L1;
attributesEmitted = true;
} else if (format.hasProperty(QTextFormat::FontSizeAdjustment)) {
static const char sizeNameData[] =
@@ -2426,35 +2560,37 @@ bool QTextHtmlExporter::emitCharFormatStyle(const QTextCharFormat &format)
name = sizeNameData + sizeNameOffsets[idx];
}
if (name) {
- html += QLatin1String(" font-size:");
- html += QLatin1String(name);
- html += QLatin1Char(';');
+ html += " font-size:"_L1;
+ html += QLatin1StringView(name);
+ html += u';';
attributesEmitted = true;
}
- } else if (format.hasProperty(QTextFormat::FontPixelSize)) {
- html += QLatin1String(" font-size:");
+ } else if (format.hasProperty(QTextFormat::FontPixelSize)
+ && format.property(QTextFormat::FontPixelSize)
+ != defaultCharFormat.property(QTextFormat::FontPixelSize)) {
+ html += " font-size:"_L1;
html += QString::number(format.intProperty(QTextFormat::FontPixelSize));
- html += QLatin1String("px;");
+ html += "px;"_L1;
attributesEmitted = true;
}
if (format.hasProperty(QTextFormat::FontWeight)
&& format.fontWeight() != defaultCharFormat.fontWeight()) {
- html += QLatin1String(" font-weight:");
- html += QString::number(format.fontWeight() * 8);
- html += QLatin1Char(';');
+ html += " font-weight:"_L1;
+ html += QString::number(format.fontWeight());
+ html += u';';
attributesEmitted = true;
}
if (format.hasProperty(QTextFormat::FontItalic)
&& format.fontItalic() != defaultCharFormat.fontItalic()) {
- html += QLatin1String(" font-style:");
- html += (format.fontItalic() ? QLatin1String("italic") : QLatin1String("normal"));
- html += QLatin1Char(';');
+ html += " font-style:"_L1;
+ html += (format.fontItalic() ? "italic"_L1 : "normal"_L1);
+ html += u';';
attributesEmitted = true;
}
- QLatin1String decorationTag(" text-decoration:");
+ const auto decorationTag = " text-decoration:"_L1;
html += decorationTag;
bool hasDecoration = false;
bool atLeastOneDecorationSet = false;
@@ -2463,7 +2599,7 @@ bool QTextHtmlExporter::emitCharFormatStyle(const QTextCharFormat &format)
&& format.fontUnderline() != defaultCharFormat.fontUnderline()) {
hasDecoration = true;
if (format.fontUnderline()) {
- html += QLatin1String(" underline");
+ html += " underline"_L1;
atLeastOneDecorationSet = true;
}
}
@@ -2472,7 +2608,7 @@ bool QTextHtmlExporter::emitCharFormatStyle(const QTextCharFormat &format)
&& format.fontOverline() != defaultCharFormat.fontOverline()) {
hasDecoration = true;
if (format.fontOverline()) {
- html += QLatin1String(" overline");
+ html += " overline"_L1;
atLeastOneDecorationSet = true;
}
}
@@ -2481,15 +2617,20 @@ bool QTextHtmlExporter::emitCharFormatStyle(const QTextCharFormat &format)
&& format.fontStrikeOut() != defaultCharFormat.fontStrikeOut()) {
hasDecoration = true;
if (format.fontStrikeOut()) {
- html += QLatin1String(" line-through");
+ html += " line-through"_L1;
atLeastOneDecorationSet = true;
}
}
if (hasDecoration) {
if (!atLeastOneDecorationSet)
- html += QLatin1String("none");
- html += QLatin1Char(';');
+ html += "none"_L1;
+ html += u';';
+ if (format.hasProperty(QTextFormat::TextUnderlineColor)) {
+ html += " text-decoration-color:"_L1;
+ html += colorValue(format.underlineColor());
+ html += u';';
+ }
attributesEmitted = true;
} else {
html.chop(decorationTag.size());
@@ -2502,61 +2643,120 @@ bool QTextHtmlExporter::emitCharFormatStyle(const QTextCharFormat &format)
const bool isPixmap = qHasPixmapTexture(brush);
const qint64 cacheKey = isPixmap ? brush.texture().cacheKey() : brush.textureImage().cacheKey();
- html += QLatin1String(" -qt-fg-texture-cachekey:");
+ html += " -qt-fg-texture-cachekey:"_L1;
html += QString::number(cacheKey);
- html += QLatin1String(";");
+ html += ";"_L1;
+ } else if (brush.style() == Qt::LinearGradientPattern
+ || brush.style() == Qt::RadialGradientPattern
+ || brush.style() == Qt::ConicalGradientPattern) {
+ const QGradient *gradient = brush.gradient();
+ if (gradient->type() == QGradient::LinearGradient) {
+ const QLinearGradient *linearGradient = static_cast<const QLinearGradient *>(brush.gradient());
+
+ html += " -qt-foreground: qlineargradient("_L1;
+ html += "x1:"_L1 + QString::number(linearGradient->start().x()) + u',';
+ html += "y1:"_L1 + QString::number(linearGradient->start().y()) + u',';
+ html += "x2:"_L1 + QString::number(linearGradient->finalStop().x()) + u',';
+ html += "y2:"_L1 + QString::number(linearGradient->finalStop().y()) + u',';
+ } else if (gradient->type() == QGradient::RadialGradient) {
+ const QRadialGradient *radialGradient = static_cast<const QRadialGradient *>(brush.gradient());
+
+ html += " -qt-foreground: qradialgradient("_L1;
+ html += "cx:"_L1 + QString::number(radialGradient->center().x()) + u',';
+ html += "cy:"_L1 + QString::number(radialGradient->center().y()) + u',';
+ html += "fx:"_L1 + QString::number(radialGradient->focalPoint().x()) + u',';
+ html += "fy:"_L1 + QString::number(radialGradient->focalPoint().y()) + u',';
+ html += "radius:"_L1 + QString::number(radialGradient->radius()) + u',';
+ } else {
+ const QConicalGradient *conicalGradient = static_cast<const QConicalGradient *>(brush.gradient());
+
+ html += " -qt-foreground: qconicalgradient("_L1;
+ html += "cx:"_L1 + QString::number(conicalGradient->center().x()) + u',';
+ html += "cy:"_L1 + QString::number(conicalGradient->center().y()) + u',';
+ html += "angle:"_L1 + QString::number(conicalGradient->angle()) + u',';
+ }
+
+ const QStringList coordinateModes = { "logical"_L1, "stretchtodevice"_L1, "objectbounding"_L1, "object"_L1 };
+ html += "coordinatemode:"_L1;
+ html += coordinateModes.at(int(gradient->coordinateMode()));
+ html += u',';
+
+ const QStringList spreads = { "pad"_L1, "reflect"_L1, "repeat"_L1 };
+ html += "spread:"_L1;
+ html += spreads.at(int(gradient->spread()));
+
+ for (const QGradientStop &stop : gradient->stops()) {
+ html += ",stop:"_L1;
+ html += QString::number(stop.first);
+ html += u' ';
+ html += colorValue(stop.second);
+ }
+
+ html += ");"_L1;
} else {
- html += QLatin1String(" color:");
+ html += " color:"_L1;
html += colorValue(brush.color());
- html += QLatin1Char(';');
+ html += u';';
}
attributesEmitted = true;
}
if (format.background() != defaultCharFormat.background()
&& format.background().style() == Qt::SolidPattern) {
- html += QLatin1String(" background-color:");
+ html += " background-color:"_L1;
html += colorValue(format.background().color());
- html += QLatin1Char(';');
+ html += u';';
attributesEmitted = true;
}
if (format.verticalAlignment() != defaultCharFormat.verticalAlignment()
&& format.verticalAlignment() != QTextCharFormat::AlignNormal)
{
- html += QLatin1String(" vertical-align:");
+ html += " vertical-align:"_L1;
QTextCharFormat::VerticalAlignment valign = format.verticalAlignment();
if (valign == QTextCharFormat::AlignSubScript)
- html += QLatin1String("sub");
+ html += "sub"_L1;
else if (valign == QTextCharFormat::AlignSuperScript)
- html += QLatin1String("super");
+ html += "super"_L1;
else if (valign == QTextCharFormat::AlignMiddle)
- html += QLatin1String("middle");
+ html += "middle"_L1;
else if (valign == QTextCharFormat::AlignTop)
- html += QLatin1String("top");
+ html += "top"_L1;
else if (valign == QTextCharFormat::AlignBottom)
- html += QLatin1String("bottom");
+ html += "bottom"_L1;
- html += QLatin1Char(';');
+ html += u';';
attributesEmitted = true;
}
if (format.fontCapitalization() != QFont::MixedCase) {
const QFont::Capitalization caps = format.fontCapitalization();
if (caps == QFont::AllUppercase)
- html += QLatin1String(" text-transform:uppercase;");
+ html += " text-transform:uppercase;"_L1;
else if (caps == QFont::AllLowercase)
- html += QLatin1String(" text-transform:lowercase;");
+ html += " text-transform:lowercase;"_L1;
else if (caps == QFont::SmallCaps)
- html += QLatin1String(" font-variant:small-caps;");
+ html += " font-variant:small-caps;"_L1;
attributesEmitted = true;
}
if (format.fontWordSpacing() != 0.0) {
- html += QLatin1String(" word-spacing:");
+ html += " word-spacing:"_L1;
html += QString::number(format.fontWordSpacing());
- html += QLatin1String("px;");
+ html += "px;"_L1;
+ attributesEmitted = true;
+ }
+
+ if (format.hasProperty(QTextFormat::TextOutline)) {
+ QPen outlinePen = format.textOutline();
+ html += " -qt-stroke-color:"_L1;
+ html += colorValue(outlinePen.color());
+ html += u';';
+
+ html += " -qt-stroke-width:"_L1;
+ html += QString::number(outlinePen.widthF());
+ html += "px;"_L1;
attributesEmitted = true;
}
@@ -2568,15 +2768,15 @@ void QTextHtmlExporter::emitTextLength(const char *attribute, const QTextLength
if (length.type() == QTextLength::VariableLength) // default
return;
- html += QLatin1Char(' ');
- html += QLatin1String(attribute);
- html += QLatin1String("=\"");
+ html += u' ';
+ html += QLatin1StringView(attribute);
+ html += "=\""_L1;
html += QString::number(length.rawValue());
if (length.type() == QTextLength::PercentageLength)
- html += QLatin1String("%\"");
+ html += "%\""_L1;
else
- html += QLatin1Char('\"');
+ html += u'\"';
}
void QTextHtmlExporter::emitAlignment(Qt::Alignment align)
@@ -2584,11 +2784,11 @@ void QTextHtmlExporter::emitAlignment(Qt::Alignment align)
if (align & Qt::AlignLeft)
return;
else if (align & Qt::AlignRight)
- html += QLatin1String(" align=\"right\"");
+ html += " align=\"right\""_L1;
else if (align & Qt::AlignHCenter)
- html += QLatin1String(" align=\"center\"");
+ html += " align=\"center\""_L1;
else if (align & Qt::AlignJustify)
- html += QLatin1String(" align=\"justify\"");
+ html += " align=\"justify\""_L1;
}
void QTextHtmlExporter::emitFloatStyle(QTextFrameFormat::Position pos, StyleMode mode)
@@ -2597,122 +2797,108 @@ void QTextHtmlExporter::emitFloatStyle(QTextFrameFormat::Position pos, StyleMode
return;
if (mode == EmitStyleTag)
- html += QLatin1String(" style=\"float:");
+ html += " style=\"float:"_L1;
else
- html += QLatin1String(" float:");
+ html += " float:"_L1;
if (pos == QTextFrameFormat::FloatLeft)
- html += QLatin1String(" left;");
+ html += " left;"_L1;
else if (pos == QTextFrameFormat::FloatRight)
- html += QLatin1String(" right;");
+ html += " right;"_L1;
else
Q_ASSERT_X(0, "QTextHtmlExporter::emitFloatStyle()", "pos should be a valid enum type");
if (mode == EmitStyleTag)
- html += QLatin1Char('\"');
+ html += u'\"';
}
-static QLatin1String richtextBorderStyleToHtmlBorderStyle(QTextFrameFormat::BorderStyle style)
+static QLatin1StringView richtextBorderStyleToHtmlBorderStyle(QTextFrameFormat::BorderStyle style)
{
switch (style) {
case QTextFrameFormat::BorderStyle_None:
- return QLatin1String("none");
+ return "none"_L1;
case QTextFrameFormat::BorderStyle_Dotted:
- return QLatin1String("dotted");
+ return "dotted"_L1;
case QTextFrameFormat::BorderStyle_Dashed:
- return QLatin1String("dashed");
+ return "dashed"_L1;
case QTextFrameFormat::BorderStyle_Solid:
- return QLatin1String("solid");
+ return "solid"_L1;
case QTextFrameFormat::BorderStyle_Double:
- return QLatin1String("double");
+ return "double"_L1;
case QTextFrameFormat::BorderStyle_DotDash:
- return QLatin1String("dot-dash");
+ return "dot-dash"_L1;
case QTextFrameFormat::BorderStyle_DotDotDash:
- return QLatin1String("dot-dot-dash");
+ return "dot-dot-dash"_L1;
case QTextFrameFormat::BorderStyle_Groove:
- return QLatin1String("groove");
+ return "groove"_L1;
case QTextFrameFormat::BorderStyle_Ridge:
- return QLatin1String("ridge");
+ return "ridge"_L1;
case QTextFrameFormat::BorderStyle_Inset:
- return QLatin1String("inset");
+ return "inset"_L1;
case QTextFrameFormat::BorderStyle_Outset:
- return QLatin1String("outset");
+ return "outset"_L1;
default:
Q_UNREACHABLE();
};
- return QLatin1String("");
+ return ""_L1;
}
void QTextHtmlExporter::emitBorderStyle(QTextFrameFormat::BorderStyle style)
{
Q_ASSERT(style <= QTextFrameFormat::BorderStyle_Outset);
- html += QLatin1String(" border-style:");
+ html += " border-style:"_L1;
html += richtextBorderStyleToHtmlBorderStyle(style);
- html += QLatin1Char(';');
+ html += u';';
}
void QTextHtmlExporter::emitPageBreakPolicy(QTextFormat::PageBreakFlags policy)
{
if (policy & QTextFormat::PageBreak_AlwaysBefore)
- html += QLatin1String(" page-break-before:always;");
+ html += " page-break-before:always;"_L1;
if (policy & QTextFormat::PageBreak_AlwaysAfter)
- html += QLatin1String(" page-break-after:always;");
-}
-
-void QTextHtmlExporter::emitFontFamily(const QString &family)
-{
- html += QLatin1String(" font-family:");
-
- QLatin1String quote("\'");
- if (family.contains(QLatin1Char('\'')))
- quote = QLatin1String("&quot;");
-
- html += quote;
- html += family.toHtmlEscaped();
- html += quote;
- html += QLatin1Char(';');
+ html += " page-break-after:always;"_L1;
}
void QTextHtmlExporter::emitFontFamily(const QStringList &families)
{
- html += QLatin1String(" font-family:");
+ html += " font-family:"_L1;
bool first = true;
for (const QString &family : families) {
- QLatin1String quote("\'");
- if (family.contains(QLatin1Char('\'')))
- quote = QLatin1String("&quot;");
+ auto quote = "\'"_L1;
+ if (family.contains(u'\''))
+ quote = "&quot;"_L1;
if (!first)
- html += QLatin1String(",");
+ html += ","_L1;
else
first = false;
html += quote;
html += family.toHtmlEscaped();
html += quote;
}
- html += QLatin1Char(';');
+ html += u';';
}
void QTextHtmlExporter::emitMargins(const QString &top, const QString &bottom, const QString &left, const QString &right)
{
- html += QLatin1String(" margin-top:");
+ html += " margin-top:"_L1;
html += top;
- html += QLatin1String("px;");
+ html += "px;"_L1;
- html += QLatin1String(" margin-bottom:");
+ html += " margin-bottom:"_L1;
html += bottom;
- html += QLatin1String("px;");
+ html += "px;"_L1;
- html += QLatin1String(" margin-left:");
+ html += " margin-left:"_L1;
html += left;
- html += QLatin1String("px;");
+ html += "px;"_L1;
- html += QLatin1String(" margin-right:");
+ html += " margin-right:"_L1;
html += right;
- html += QLatin1String("px;");
+ html += "px;"_L1;
}
void QTextHtmlExporter::emitFragment(const QTextFragment &fragment)
@@ -2724,15 +2910,15 @@ void QTextHtmlExporter::emitFragment(const QTextFragment &fragment)
if (format.isAnchor()) {
const auto names = format.anchorNames();
if (!names.isEmpty()) {
- html += QLatin1String("<a name=\"");
+ html += "<a name=\""_L1;
html += names.constFirst().toHtmlEscaped();
- html += QLatin1String("\"></a>");
+ html += "\"></a>"_L1;
}
const QString href = format.anchorHref();
if (!href.isEmpty()) {
- html += QLatin1String("<a href=\"");
+ html += "<a href=\""_L1;
html += href.toHtmlEscaped();
- html += QLatin1String("\">");
+ html += "\">"_L1;
closeAnchor = true;
}
}
@@ -2741,22 +2927,33 @@ void QTextHtmlExporter::emitFragment(const QTextFragment &fragment)
const bool isObject = txt.contains(QChar::ObjectReplacementCharacter);
const bool isImage = isObject && format.isImageFormat();
- QLatin1String styleTag("<span style=\"");
+ const auto styleTag = "<span style=\""_L1;
html += styleTag;
bool attributesEmitted = false;
if (!isImage)
attributesEmitted = emitCharFormatStyle(format);
if (attributesEmitted)
- html += QLatin1String("\">");
+ html += "\">"_L1;
else
html.chop(styleTag.size());
if (isObject) {
- for (int i = 0; isImage && i < txt.length(); ++i) {
+ for (int i = 0; isImage && i < txt.size(); ++i) {
QTextImageFormat imgFmt = format.toImageFormat();
- html += QLatin1String("<img");
+ html += "<img"_L1;
+
+ QString maxWidthCss;
+
+ if (imgFmt.hasProperty(QTextFormat::ImageMaxWidth)) {
+ auto length = imgFmt.lengthProperty(QTextFormat::ImageMaxWidth);
+ maxWidthCss += "max-width:"_L1;
+ if (length.type() == QTextLength::PercentageLength)
+ maxWidthCss += QString::number(length.rawValue()) + "%;"_L1;
+ else if (length.type() == QTextLength::FixedLength)
+ maxWidthCss += QString::number(length.rawValue()) + "px;"_L1;
+ }
if (imgFmt.hasProperty(QTextFormat::ImageName))
emitAttribute("src", imgFmt.name());
@@ -2774,14 +2971,16 @@ void QTextHtmlExporter::emitFragment(const QTextFragment &fragment)
emitAttribute("height", QString::number(imgFmt.height()));
if (imgFmt.verticalAlignment() == QTextCharFormat::AlignMiddle)
- html += QLatin1String(" style=\"vertical-align: middle;\"");
+ html += " style=\"vertical-align: middle;"_L1 + maxWidthCss + u'\"';
else if (imgFmt.verticalAlignment() == QTextCharFormat::AlignTop)
- html += QLatin1String(" style=\"vertical-align: top;\"");
+ html += " style=\"vertical-align: top;"_L1 + maxWidthCss + u'\"';
+ else if (!maxWidthCss.isEmpty())
+ html += " style=\""_L1 + maxWidthCss + u'\"';
if (QTextFrame *imageFrame = qobject_cast<QTextFrame *>(doc->objectForFormat(imgFmt)))
emitFloatStyle(imageFrame->frameFormat().position());
- html += QLatin1String(" />");
+ html += " />"_L1;
}
} else {
Q_ASSERT(!txt.contains(QChar::ObjectReplacementCharacter));
@@ -2789,17 +2988,17 @@ void QTextHtmlExporter::emitFragment(const QTextFragment &fragment)
txt = txt.toHtmlEscaped();
// split for [\n{LineSeparator}]
- QString forcedLineBreakRegExp = QString::fromLatin1("[\\na]");
- forcedLineBreakRegExp[3] = QChar::LineSeparator;
// space in BR on purpose for compatibility with old-fashioned browsers
- html += txt.replace(QRegExp(forcedLineBreakRegExp), QLatin1String("<br />"));
+ txt.replace(u'\n', "<br />"_L1);
+ txt.replace(QChar::LineSeparator, "<br />"_L1);
+ html += txt;
}
if (attributesEmitted)
- html += QLatin1String("</span>");
+ html += "</span>"_L1;
if (closeAnchor)
- html += QLatin1String("</a>");
+ html += "</a>"_L1;
}
static bool isOrderedList(int style)
@@ -2817,16 +3016,16 @@ void QTextHtmlExporter::emitBlockAttributes(const QTextBlock &block)
emitAlignment(format.alignment());
// assume default to not bloat the html too much
- // html += QLatin1String(" dir='ltr'");
+ // html += " dir='ltr'"_L1;
if (block.textDirection() == Qt::RightToLeft)
- html += QLatin1String(" dir='rtl'");
+ html += " dir='rtl'"_L1;
- QLatin1String style(" style=\"");
+ const auto style = " style=\""_L1;
html += style;
const bool emptyBlock = block.begin().atEnd();
if (emptyBlock) {
- html += QLatin1String("-qt-paragraph-type:empty;");
+ html += "-qt-paragraph-type:empty;"_L1;
}
emitMargins(QString::number(format.topMargin()),
@@ -2834,38 +3033,38 @@ void QTextHtmlExporter::emitBlockAttributes(const QTextBlock &block)
QString::number(format.leftMargin()),
QString::number(format.rightMargin()));
- html += QLatin1String(" -qt-block-indent:");
+ html += " -qt-block-indent:"_L1;
html += QString::number(format.indent());
- html += QLatin1Char(';');
+ html += u';';
- html += QLatin1String(" text-indent:");
+ html += " text-indent:"_L1;
html += QString::number(format.textIndent());
- html += QLatin1String("px;");
+ html += "px;"_L1;
if (block.userState() != -1) {
- html += QLatin1String(" -qt-user-state:");
+ html += " -qt-user-state:"_L1;
html += QString::number(block.userState());
- html += QLatin1Char(';');
+ html += u';';
}
if (format.lineHeightType() != QTextBlockFormat::SingleHeight) {
- html += QLatin1String(" line-height:")
+ html += " line-height:"_L1
+ QString::number(format.lineHeight());
switch (format.lineHeightType()) {
case QTextBlockFormat::ProportionalHeight:
- html += QLatin1String("%;");
+ html += "%;"_L1;
break;
case QTextBlockFormat::FixedHeight:
- html += QLatin1String("; -qt-line-height-type: fixed;");
+ html += "; -qt-line-height-type: fixed;"_L1;
break;
case QTextBlockFormat::MinimumHeight:
- html += QLatin1String("px;");
+ html += "px;"_L1;
break;
case QTextBlockFormat::LineDistanceHeight:
- html += QLatin1String("; -qt-line-height-type: line-distance;");
+ html += "; -qt-line-height-type: line-distance;"_L1;
break;
default:
- html += QLatin1String(";");
+ html += ";"_L1;
break; // Should never reach here
}
}
@@ -2888,7 +3087,7 @@ void QTextHtmlExporter::emitBlockAttributes(const QTextBlock &block)
if (!diff.properties().isEmpty())
emitCharFormatStyle(diff);
- html += QLatin1Char('"');
+ html += u'"';
}
@@ -2899,14 +3098,15 @@ void QTextHtmlExporter::emitBlock(const QTextBlock &block)
int p = block.position();
if (p > 0)
--p;
- QTextDocumentPrivate::FragmentIterator frag = doc->docHandle()->find(p);
- QChar ch = doc->docHandle()->buffer().at(frag->stringPosition);
+
+ QTextDocumentPrivate::FragmentIterator frag = QTextDocumentPrivate::get(doc)->find(p);
+ QChar ch = QTextDocumentPrivate::get(doc)->buffer().at(frag->stringPosition);
if (ch == QTextBeginningOfFrame
|| ch == QTextEndOfFrame)
return;
}
- html += QLatin1Char('\n');
+ html += u'\n';
// save and later restore, in case we 'change' the default format by
// emitting block char format information
@@ -2917,128 +3117,178 @@ void QTextHtmlExporter::emitBlock(const QTextBlock &block)
if (list->itemNumber(block) == 0) { // first item? emit <ul> or appropriate
const QTextListFormat format = list->format();
const int style = format.style();
+ bool ordered = false;
switch (style) {
- case QTextListFormat::ListDecimal: html += QLatin1String("<ol"); break;
- case QTextListFormat::ListDisc: html += QLatin1String("<ul"); break;
- case QTextListFormat::ListCircle: html += QLatin1String("<ul type=\"circle\""); break;
- case QTextListFormat::ListSquare: html += QLatin1String("<ul type=\"square\""); break;
- case QTextListFormat::ListLowerAlpha: html += QLatin1String("<ol type=\"a\""); break;
- case QTextListFormat::ListUpperAlpha: html += QLatin1String("<ol type=\"A\""); break;
- case QTextListFormat::ListLowerRoman: html += QLatin1String("<ol type=\"i\""); break;
- case QTextListFormat::ListUpperRoman: html += QLatin1String("<ol type=\"I\""); break;
- default: html += QLatin1String("<ul"); // ### should not happen
+ case QTextListFormat::ListDisc: html += "<ul"_L1; break;
+ case QTextListFormat::ListCircle: html += "<ul type=\"circle\""_L1; break;
+ case QTextListFormat::ListSquare: html += "<ul type=\"square\""_L1; break;
+ case QTextListFormat::ListDecimal: html += "<ol"_L1; ordered = true; break;
+ case QTextListFormat::ListLowerAlpha: html += "<ol type=\"a\""_L1; ordered = true; break;
+ case QTextListFormat::ListUpperAlpha: html += "<ol type=\"A\""_L1; ordered = true; break;
+ case QTextListFormat::ListLowerRoman: html += "<ol type=\"i\""_L1; ordered = true; break;
+ case QTextListFormat::ListUpperRoman: html += "<ol type=\"I\""_L1; ordered = true; break;
+ default: html += "<ul"_L1; // ### should not happen
}
- QString styleString = QString::fromLatin1("margin-top: 0px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px;");
+ if (ordered && format.start() != 1) {
+ html += " start=\""_L1;
+ html += QString::number(format.start());
+ html += u'"';
+ }
+
+ QString styleString;
+ styleString += "margin-top: 0px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px;"_L1;
if (format.hasProperty(QTextFormat::ListIndent)) {
- styleString += QLatin1String(" -qt-list-indent: ");
+ styleString += " -qt-list-indent: "_L1;
styleString += QString::number(format.indent());
- styleString += QLatin1Char(';');
+ styleString += u';';
}
if (format.hasProperty(QTextFormat::ListNumberPrefix)) {
QString numberPrefix = format.numberPrefix();
- numberPrefix.replace(QLatin1Char('"'), QLatin1String("\\22"));
- numberPrefix.replace(QLatin1Char('\''), QLatin1String("\\27")); // FIXME: There's a problem in the CSS parser the prevents this from being correctly restored
- styleString += QLatin1String(" -qt-list-number-prefix: ");
- styleString += QLatin1Char('\'');
+ numberPrefix.replace(u'"', "\\22"_L1);
+ numberPrefix.replace(u'\'', "\\27"_L1); // FIXME: There's a problem in the CSS parser the prevents this from being correctly restored
+ styleString += " -qt-list-number-prefix: "_L1;
+ styleString += u'\'';
styleString += numberPrefix;
- styleString += QLatin1Char('\'');
- styleString += QLatin1Char(';');
+ styleString += u'\'';
+ styleString += u';';
}
if (format.hasProperty(QTextFormat::ListNumberSuffix)) {
- if (format.numberSuffix() != QLatin1String(".")) { // this is our default
+ if (format.numberSuffix() != "."_L1) { // this is our default
QString numberSuffix = format.numberSuffix();
- numberSuffix.replace(QLatin1Char('"'), QLatin1String("\\22"));
- numberSuffix.replace(QLatin1Char('\''), QLatin1String("\\27")); // see above
- styleString += QLatin1String(" -qt-list-number-suffix: ");
- styleString += QLatin1Char('\'');
+ numberSuffix.replace(u'"', "\\22"_L1);
+ numberSuffix.replace(u'\'', "\\27"_L1); // see above
+ styleString += " -qt-list-number-suffix: "_L1;
+ styleString += u'\'';
styleString += numberSuffix;
- styleString += QLatin1Char('\'');
- styleString += QLatin1Char(';');
+ styleString += u'\'';
+ styleString += u';';
}
}
- html += QLatin1String(" style=\"");
+ html += " style=\""_L1;
html += styleString;
- html += QLatin1String("\">");
+ html += "\">\n"_L1;
}
- html += QLatin1String("<li");
+ html += "<li"_L1;
const QTextCharFormat blockFmt = formatDifference(defaultCharFormat, block.charFormat()).toCharFormat();
if (!blockFmt.properties().isEmpty()) {
- html += QLatin1String(" style=\"");
+ html += " style=\""_L1;
emitCharFormatStyle(blockFmt);
- html += QLatin1Char('\"');
+ html += u'\"';
defaultCharFormat.merge(block.charFormat());
}
+ if (block.blockFormat().hasProperty(QTextFormat::BlockMarker)) {
+ switch (block.blockFormat().marker()) {
+ case QTextBlockFormat::MarkerType::Checked:
+ html += " class=\"checked\""_L1;
+ break;
+ case QTextBlockFormat::MarkerType::Unchecked:
+ html += " class=\"unchecked\""_L1;
+ break;
+ case QTextBlockFormat::MarkerType::NoMarker:
+ break;
+ }
+ }
}
const QTextBlockFormat blockFormat = block.blockFormat();
if (blockFormat.hasProperty(QTextFormat::BlockTrailingHorizontalRulerWidth)) {
- html += QLatin1String("<hr");
+ html += "<hr"_L1;
QTextLength width = blockFormat.lengthProperty(QTextFormat::BlockTrailingHorizontalRulerWidth);
if (width.type() != QTextLength::VariableLength)
emitTextLength("width", width);
- else
- html += QLatin1Char(' ');
+ html += u' ';
+
+ if (blockFormat.hasProperty(QTextFormat::BackgroundBrush)) {
+ html += "style=\""_L1;
+ html += "background-color:"_L1;
+ html += colorValue(qvariant_cast<QBrush>(blockFormat.property(QTextFormat::BackgroundBrush)).color());
+ html += u';';
+ html += u'\"';
+ }
- html += QLatin1String("/>");
+ html += "/>"_L1;
return;
}
const bool pre = blockFormat.nonBreakableLines();
if (pre) {
if (list)
- html += QLatin1Char('>');
- html += QLatin1String("<pre");
+ html += u'>';
+ html += "<pre"_L1;
} else if (!list) {
int headingLevel = blockFormat.headingLevel();
if (headingLevel > 0 && headingLevel <= 6)
- html += QLatin1String("<h") + QString::number(headingLevel);
+ html += "<h"_L1 + QString::number(headingLevel);
else
- html += QLatin1String("<p");
+ html += "<p"_L1;
}
emitBlockAttributes(block);
- html += QLatin1Char('>');
+ html += u'>';
if (block.begin().atEnd())
- html += QLatin1String("<br />");
+ html += "<br />"_L1;
QTextBlock::Iterator it = block.begin();
if (fragmentMarkers && !it.atEnd() && block == doc->begin())
- html += QLatin1String("<!--StartFragment-->");
+ html += "<!--StartFragment-->"_L1;
for (; !it.atEnd(); ++it)
emitFragment(it.fragment());
- if (fragmentMarkers && block.position() + block.length() == doc->docHandle()->length())
- html += QLatin1String("<!--EndFragment-->");
+ if (fragmentMarkers && block.position() + block.length() == QTextDocumentPrivate::get(doc)->length())
+ html += "<!--EndFragment-->"_L1;
+
+ QString closeTags;
if (pre)
- html += QLatin1String("</pre>");
+ html += "</pre>"_L1;
else if (list)
- html += QLatin1String("</li>");
+ closeTags += "</li>"_L1;
else {
int headingLevel = blockFormat.headingLevel();
if (headingLevel > 0 && headingLevel <= 6)
- html += QLatin1String("</h") + QString::number(headingLevel) + QLatin1Char('>');
+ html += QString::asprintf("</h%d>", headingLevel);
else
- html += QLatin1String("</p>");
+ html += "</p>"_L1;
}
if (list) {
if (list->itemNumber(block) == list->count() - 1) { // last item? close list
if (isOrderedList(list->format().style()))
- html += QLatin1String("</ol>");
+ closeTags += "</ol>"_L1;
else
- html += QLatin1String("</ul>");
+ closeTags += "</ul>"_L1;
+ }
+ const QTextBlock nextBlock = block.next();
+ // If the next block is the beginning of a new deeper nested list, then we don't
+ // want to close the current list item just yet. This should be closed when this
+ // item is fully finished
+ if (nextBlock.isValid() && nextBlock.textList() &&
+ nextBlock.textList()->itemNumber(nextBlock) == 0 &&
+ nextBlock.textList()->format().indent() > list->format().indent()) {
+ QString lastTag;
+ if (!closingTags.isEmpty() && list->itemNumber(block) == list->count() - 1)
+ lastTag = closingTags.takeLast();
+ lastTag.prepend(closeTags);
+ closingTags << lastTag;
+ } else if (list->itemNumber(block) == list->count() - 1) {
+ // If we are at the end of the list now then we can add in the closing tags for that
+ // current block
+ html += closeTags;
+ if (!closingTags.isEmpty())
+ html += closingTags.takeLast();
+ } else {
+ html += closeTags;
}
}
@@ -3056,27 +3306,27 @@ QString QTextHtmlExporter::findUrlForImage(const QTextDocument *doc, qint64 cach
if (QTextDocument *parent = qobject_cast<QTextDocument *>(doc->parent()))
return findUrlForImage(parent, cacheKey, isPixmap);
- if (doc && doc->docHandle()) {
- QTextDocumentPrivate *priv = doc->docHandle();
- QMap<QUrl, QVariant>::const_iterator it = priv->cachedResources.constBegin();
- for (; it != priv->cachedResources.constEnd(); ++it) {
+ const QTextDocumentPrivate *priv = QTextDocumentPrivate::get(doc);
+ Q_ASSERT(priv != nullptr);
- const QVariant &v = it.value();
- if (v.type() == QVariant::Image && !isPixmap) {
- if (qvariant_cast<QImage>(v).cacheKey() == cacheKey)
- break;
- }
+ QMap<QUrl, QVariant>::const_iterator it = priv->cachedResources.constBegin();
+ for (; it != priv->cachedResources.constEnd(); ++it) {
- if (v.type() == QVariant::Pixmap && isPixmap) {
- if (qvariant_cast<QPixmap>(v).cacheKey() == cacheKey)
- break;
- }
+ const QVariant &v = it.value();
+ if (v.userType() == QMetaType::QImage && !isPixmap) {
+ if (qvariant_cast<QImage>(v).cacheKey() == cacheKey)
+ break;
}
- if (it != priv->cachedResources.constEnd())
- url = it.key().toString();
+ if (v.userType() == QMetaType::QPixmap && isPixmap) {
+ if (qvariant_cast<QPixmap>(v).cacheKey() == cacheKey)
+ break;
+ }
}
+ if (it != priv->cachedResources.constEnd())
+ url = it.key().toString();
+
return url;
}
@@ -3085,7 +3335,7 @@ void QTextDocumentPrivate::mergeCachedResources(const QTextDocumentPrivate *priv
if (!priv)
return;
- cachedResources.unite(priv->cachedResources);
+ cachedResources.insert(priv->cachedResources);
}
void QTextHtmlExporter::emitBackgroundAttribute(const QTextFormat &format)
@@ -3113,7 +3363,7 @@ void QTextHtmlExporter::emitTable(const QTextTable *table)
{
QTextTableFormat format = table->format();
- html += QLatin1String("\n<table");
+ html += "\n<table"_L1;
if (format.hasProperty(QTextFormat::FrameBorder))
emitAttribute("border", QString::number(format.border()));
@@ -3130,17 +3380,17 @@ void QTextHtmlExporter::emitTable(const QTextTable *table)
emitBackgroundAttribute(format);
- html += QLatin1Char('>');
+ html += u'>';
const int rows = table->rows();
const int columns = table->columns();
- QVector<QTextLength> columnWidths = format.columnWidthConstraints();
+ QList<QTextLength> columnWidths = format.columnWidthConstraints();
if (columnWidths.isEmpty()) {
columnWidths.resize(columns);
columnWidths.fill(QTextLength());
}
- Q_ASSERT(columnWidths.count() == columns);
+ Q_ASSERT(columnWidths.size() == columns);
QVarLengthArray<bool> widthEmittedForColumn(columns);
for (int i = 0; i < columns; ++i)
@@ -3148,10 +3398,10 @@ void QTextHtmlExporter::emitTable(const QTextTable *table)
const int headerRowCount = qMin(format.headerRowCount(), rows);
if (headerRowCount > 0)
- html += QLatin1String("<thead>");
+ html += "<thead>"_L1;
for (int row = 0; row < rows; ++row) {
- html += QLatin1String("\n<tr>");
+ html += "\n<tr>"_L1;
for (int col = 0; col < columns; ++col) {
const QTextTableCell cell = table->cellAt(row, col);
@@ -3163,7 +3413,7 @@ void QTextHtmlExporter::emitTable(const QTextTable *table)
if (cell.column() != col)
continue;
- html += QLatin1String("\n<td");
+ html += "\n<td"_L1;
if (!widthEmittedForColumn[col] && cell.columnSpan() == 1) {
emitTextLength("width", columnWidths.at(col));
@@ -3185,21 +3435,21 @@ void QTextHtmlExporter::emitTable(const QTextTable *table)
QString styleString;
if (valign >= QTextCharFormat::AlignMiddle && valign <= QTextCharFormat::AlignBottom) {
- styleString += QLatin1String(" vertical-align:");
+ styleString += " vertical-align:"_L1;
switch (valign) {
case QTextCharFormat::AlignMiddle:
- styleString += QLatin1String("middle");
+ styleString += "middle"_L1;
break;
case QTextCharFormat::AlignTop:
- styleString += QLatin1String("top");
+ styleString += "top"_L1;
break;
case QTextCharFormat::AlignBottom:
- styleString += QLatin1String("bottom");
+ styleString += "bottom"_L1;
break;
default:
break;
}
- styleString += QLatin1Char(';');
+ styleString += u';';
QTextCharFormat temp;
temp.setVerticalAlignment(valign);
@@ -3207,59 +3457,59 @@ void QTextHtmlExporter::emitTable(const QTextTable *table)
}
if (cellFormat.hasProperty(QTextFormat::TableCellLeftPadding))
- styleString += QLatin1String(" padding-left:") + QString::number(cellFormat.leftPadding()) + QLatin1Char(';');
+ styleString += " padding-left:"_L1 + QString::number(cellFormat.leftPadding()) + u';';
if (cellFormat.hasProperty(QTextFormat::TableCellRightPadding))
- styleString += QLatin1String(" padding-right:") + QString::number(cellFormat.rightPadding()) + QLatin1Char(';');
+ styleString += " padding-right:"_L1 + QString::number(cellFormat.rightPadding()) + u';';
if (cellFormat.hasProperty(QTextFormat::TableCellTopPadding))
- styleString += QLatin1String(" padding-top:") + QString::number(cellFormat.topPadding()) + QLatin1Char(';');
+ styleString += " padding-top:"_L1 + QString::number(cellFormat.topPadding()) + u';';
if (cellFormat.hasProperty(QTextFormat::TableCellBottomPadding))
- styleString += QLatin1String(" padding-bottom:") + QString::number(cellFormat.bottomPadding()) + QLatin1Char(';');
+ styleString += " padding-bottom:"_L1 + QString::number(cellFormat.bottomPadding()) + u';';
if (cellFormat.hasProperty(QTextFormat::TableCellTopBorder))
- styleString += QLatin1String(" border-top:") + QString::number(cellFormat.topBorder()) + QLatin1String("px;");
+ styleString += " border-top:"_L1 + QString::number(cellFormat.topBorder()) + "px;"_L1;
if (cellFormat.hasProperty(QTextFormat::TableCellRightBorder))
- styleString += QLatin1String(" border-right:") + QString::number(cellFormat.rightBorder()) + QLatin1String("px;");
+ styleString += " border-right:"_L1 + QString::number(cellFormat.rightBorder()) + "px;"_L1;
if (cellFormat.hasProperty(QTextFormat::TableCellBottomBorder))
- styleString += QLatin1String(" border-bottom:") + QString::number(cellFormat.bottomBorder()) + QLatin1String("px;");
+ styleString += " border-bottom:"_L1 + QString::number(cellFormat.bottomBorder()) + "px;"_L1;
if (cellFormat.hasProperty(QTextFormat::TableCellLeftBorder))
- styleString += QLatin1String(" border-left:") + QString::number(cellFormat.leftBorder()) + QLatin1String("px;");
+ styleString += " border-left:"_L1 + QString::number(cellFormat.leftBorder()) + "px;"_L1;
if (cellFormat.hasProperty(QTextFormat::TableCellTopBorderBrush))
- styleString += QLatin1String(" border-top-color:") + cellFormat.topBorderBrush().color().name() + QLatin1Char(';');
+ styleString += " border-top-color:"_L1 + cellFormat.topBorderBrush().color().name() + u';';
if (cellFormat.hasProperty(QTextFormat::TableCellRightBorderBrush))
- styleString += QLatin1String(" border-right-color:") + cellFormat.rightBorderBrush().color().name() + QLatin1Char(';');
+ styleString += " border-right-color:"_L1 + cellFormat.rightBorderBrush().color().name() + u';';
if (cellFormat.hasProperty(QTextFormat::TableCellBottomBorderBrush))
- styleString += QLatin1String(" border-bottom-color:") + cellFormat.bottomBorderBrush().color().name() + QLatin1Char(';');
+ styleString += " border-bottom-color:"_L1 + cellFormat.bottomBorderBrush().color().name() + u';';
if (cellFormat.hasProperty(QTextFormat::TableCellLeftBorderBrush))
- styleString += QLatin1String(" border-left-color:") + cellFormat.leftBorderBrush().color().name() + QLatin1Char(';');
+ styleString += " border-left-color:"_L1 + cellFormat.leftBorderBrush().color().name() + u';';
if (cellFormat.hasProperty(QTextFormat::TableCellTopBorderStyle))
- styleString += QLatin1String(" border-top-style:") + richtextBorderStyleToHtmlBorderStyle(cellFormat.topBorderStyle()) + QLatin1Char(';');
+ styleString += " border-top-style:"_L1 + richtextBorderStyleToHtmlBorderStyle(cellFormat.topBorderStyle()) + u';';
if (cellFormat.hasProperty(QTextFormat::TableCellRightBorderStyle))
- styleString += QLatin1String(" border-right-style:") + richtextBorderStyleToHtmlBorderStyle(cellFormat.rightBorderStyle()) + QLatin1Char(';');
+ styleString += " border-right-style:"_L1 + richtextBorderStyleToHtmlBorderStyle(cellFormat.rightBorderStyle()) + u';';
if (cellFormat.hasProperty(QTextFormat::TableCellBottomBorderStyle))
- styleString += QLatin1String(" border-bottom-style:") + richtextBorderStyleToHtmlBorderStyle(cellFormat.bottomBorderStyle()) + QLatin1Char(';');
+ styleString += " border-bottom-style:"_L1 + richtextBorderStyleToHtmlBorderStyle(cellFormat.bottomBorderStyle()) + u';';
if (cellFormat.hasProperty(QTextFormat::TableCellLeftBorderStyle))
- styleString += QLatin1String(" border-left-style:") + richtextBorderStyleToHtmlBorderStyle(cellFormat.leftBorderStyle()) + QLatin1Char(';');
+ styleString += " border-left-style:"_L1 + richtextBorderStyleToHtmlBorderStyle(cellFormat.leftBorderStyle()) + u';';
if (!styleString.isEmpty())
- html += QLatin1String(" style=\"") + styleString + QLatin1Char('\"');
+ html += " style=\""_L1 + styleString + u'\"';
- html += QLatin1Char('>');
+ html += u'>';
emitFrame(cell.begin());
- html += QLatin1String("</td>");
+ html += "</td>"_L1;
defaultCharFormat = oldDefaultCharFormat;
}
- html += QLatin1String("</tr>");
+ html += "</tr>"_L1;
if (headerRowCount > 0 && row == headerRowCount - 1)
- html += QLatin1String("</thead>");
+ html += "</thead>"_L1;
}
- html += QLatin1String("</table>");
+ html += "</table>"_L1;
}
void QTextHtmlExporter::emitFrame(const QTextFrame::Iterator &frameIt)
@@ -3292,7 +3542,7 @@ void QTextHtmlExporter::emitTextFrame(const QTextFrame *f)
{
FrameType frameType = f->parentFrame() ? TextFrame : RootFrame;
- html += QLatin1String("\n<table");
+ html += "\n<table"_L1;
QTextFrameFormat format = f->frameFormat();
if (format.hasProperty(QTextFormat::FrameBorder))
@@ -3307,22 +3557,22 @@ void QTextHtmlExporter::emitTextFrame(const QTextFrame *f)
if (frameType != RootFrame)
emitBackgroundAttribute(format);
- html += QLatin1Char('>');
- html += QLatin1String("\n<tr>\n<td style=\"border: none;\">");
+ html += u'>';
+ html += "\n<tr>\n<td style=\"border: none;\">"_L1;
emitFrame(f->begin());
- html += QLatin1String("</td></tr></table>");
+ html += "</td></tr></table>"_L1;
}
void QTextHtmlExporter::emitFrameStyle(const QTextFrameFormat &format, FrameType frameType)
{
- QLatin1String styleAttribute(" style=\"");
+ const auto styleAttribute = " style=\""_L1;
html += styleAttribute;
- const int originalHtmlLength = html.length();
+ const qsizetype originalHtmlLength = html.size();
if (frameType == TextFrame)
- html += QLatin1String("-qt-table-type: frame;");
+ html += "-qt-table-type: frame;"_L1;
else if (frameType == RootFrame)
- html += QLatin1String("-qt-table-type: root;");
+ html += "-qt-table-type: root;"_L1;
const QTextFrameFormat defaultFormat;
@@ -3330,9 +3580,9 @@ void QTextHtmlExporter::emitFrameStyle(const QTextFrameFormat &format, FrameType
emitPageBreakPolicy(format.pageBreakPolicy());
if (format.borderBrush() != defaultFormat.borderBrush()) {
- html += QLatin1String(" border-color:");
+ html += " border-color:"_L1;
html += colorValue(format.borderBrush().color());
- html += QLatin1Char(';');
+ html += u';';
}
if (format.borderStyle() != defaultFormat.borderStyle())
@@ -3349,34 +3599,28 @@ void QTextHtmlExporter::emitFrameStyle(const QTextFrameFormat &format, FrameType
QString::number(format.rightMargin()));
if (format.property(QTextFormat::TableBorderCollapse).toBool())
- html += QLatin1String(" border-collapse:collapse;");
+ html += " border-collapse:collapse;"_L1;
- if (html.length() == originalHtmlLength) // nothing emitted?
+ if (html.size() == originalHtmlLength) // nothing emitted?
html.chop(styleAttribute.size());
else
- html += QLatin1Char('\"');
+ html += u'\"';
}
/*!
Returns a string containing an HTML representation of the document.
- The \a encoding parameter specifies the value for the charset attribute
- in the html header. For example if 'utf-8' is specified then the
- beginning of the generated html will look like this:
- \snippet code/src_gui_text_qtextdocument.cpp 0
-
- If no encoding is specified then no such meta information is generated.
-
+ The content of the document specifies its encoding to be UTF-8.
If you later on convert the returned html string into a byte array for
- transmission over a network or when saving to disk you should specify
- the encoding you're going to use for the conversion to a byte array here.
+ transmission over a network or when saving to disk you should use
+ QString::toUtf8() to convert the string to a QByteArray.
\sa {Supported HTML Subset}
*/
#ifndef QT_NO_TEXTHTMLPARSER
-QString QTextDocument::toHtml(const QByteArray &encoding) const
+QString QTextDocument::toHtml() const
{
- return QTextHtmlExporter(this).toHtml(encoding);
+ return QTextHtmlExporter(this).toHtml();
}
#endif // QT_NO_TEXTHTMLPARSER
@@ -3432,31 +3676,19 @@ QString QTextDocument::toMarkdown(QTextDocument::MarkdownFeatures features) cons
#if QT_CONFIG(textmarkdownreader)
void QTextDocument::setMarkdown(const QString &markdown, QTextDocument::MarkdownFeatures features)
{
- QTextMarkdownImporter(features).import(this, markdown);
+ QTextMarkdownImporter(this, features).import(markdown);
}
#endif
/*!
- Returns a vector of text formats for all the formats used in the document.
+ Returns a list of text formats for all the formats used in the document.
*/
-QVector<QTextFormat> QTextDocument::allFormats() const
+QList<QTextFormat> QTextDocument::allFormats() const
{
Q_D(const QTextDocument);
return d->formatCollection()->formats;
}
-
-/*!
- \internal
-
- So that not all classes have to be friends of each other...
-*/
-QTextDocumentPrivate *QTextDocument::docHandle() const
-{
- Q_D(const QTextDocument);
- return const_cast<QTextDocumentPrivate *>(d);
-}
-
/*!
\since 4.4
\fn QTextDocument::undoCommandAdded()
@@ -3465,3 +3697,5 @@ QTextDocumentPrivate *QTextDocument::docHandle() const
*/
QT_END_NAMESPACE
+
+#include "moc_qtextdocument.cpp"
diff --git a/src/gui/text/qtextdocument.h b/src/gui/text/qtextdocument.h
index 7d46238257..b6253bfa46 100644
--- a/src/gui/text/qtextdocument.h
+++ b/src/gui/text/qtextdocument.h
@@ -1,41 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2019 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the QtGui module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2019 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#ifndef QTEXTDOCUMENT_H
#define QTEXTDOCUMENT_H
@@ -47,6 +11,8 @@
#include <QtCore/qvariant.h>
#include <QtGui/qfont.h>
#include <QtCore/qurl.h>
+#include <QtCore/qcontainerfwd.h>
+Q_MOC_INCLUDE(<QtGui/qtextcursor.h>)
QT_BEGIN_NAMESPACE
@@ -62,22 +28,18 @@ class QTextObject;
class QTextFormat;
class QTextFrame;
class QTextBlock;
-class QTextCodec;
class QVariant;
class QRectF;
class QTextOption;
class QTextCursor;
-template<typename T> class QVector;
-
namespace Qt
{
+#if QT_GUI_REMOVED_SINCE(6, 7)
Q_GUI_EXPORT bool mightBeRichText(const QString&);
- Q_GUI_EXPORT QString convertFromPlainText(const QString &plain, WhiteSpaceMode mode = WhiteSpacePre);
-
-#if QT_CONFIG(textcodec) || defined(Q_CLANG_QDOC)
- Q_GUI_EXPORT QTextCodec *codecForHtml(const QByteArray &ba);
#endif
+ Q_GUI_EXPORT bool mightBeRichText(QAnyStringView);
+ Q_GUI_EXPORT QString convertFromPlainText(const QString &plain, WhiteSpaceMode mode = WhiteSpacePre);
}
class Q_GUI_EXPORT QAbstractUndoItem
@@ -103,6 +65,7 @@ class Q_GUI_EXPORT QTextDocument : public QObject
Q_PROPERTY(QSizeF pageSize READ pageSize WRITE setPageSize)
Q_PROPERTY(QFont defaultFont READ defaultFont WRITE setDefaultFont)
Q_PROPERTY(bool useDesignMetrics READ useDesignMetrics WRITE setUseDesignMetrics)
+ Q_PROPERTY(bool layoutEnabled READ isLayoutEnabled WRITE setLayoutEnabled)
Q_PROPERTY(QSizeF size READ size)
Q_PROPERTY(qreal textWidth READ textWidth WRITE setTextWidth)
Q_PROPERTY(int blockCount READ blockCount)
@@ -141,13 +104,15 @@ public:
enum MetaInformation {
DocumentTitle,
- DocumentUrl
+ DocumentUrl,
+ CssMedia,
+ FrontMatter,
};
void setMetaInformation(MetaInformation info, const QString &);
QString metaInformation(MetaInformation info) const;
#ifndef QT_NO_TEXTHTMLPARSER
- QString toHtml(const QByteArray &encoding = QByteArray()) const;
+ QString toHtml() const;
void setHtml(const QString &html);
#endif
@@ -155,7 +120,7 @@ public:
enum MarkdownFeature {
MarkdownNoHTML = 0x0020 | 0x0040,
MarkdownDialectCommonMark = 0,
- MarkdownDialectGitHub = 0x0004 | 0x0008 | 0x0400 | 0x0100 | 0x0200 | 0x0800
+ MarkdownDialectGitHub = 0x0004 | 0x0008 | 0x0400 | 0x0100 | 0x0200 | 0x0800 | 0x4000 | 0x100000
};
Q_DECLARE_FLAGS(MarkdownFeatures, MarkdownFeature)
Q_FLAG(MarkdownFeatures)
@@ -186,11 +151,6 @@ public:
QTextCursor find(const QString &subString, int from = 0, FindFlags options = FindFlags()) const;
QTextCursor find(const QString &subString, const QTextCursor &cursor, FindFlags options = FindFlags()) const;
-#ifndef QT_NO_REGEXP
- QTextCursor find(const QRegExp &expr, int from = 0, FindFlags options = FindFlags()) const;
- QTextCursor find(const QRegExp &expr, const QTextCursor &cursor, FindFlags options = FindFlags()) const;
-#endif
-
#if QT_CONFIG(regularexpression)
QTextCursor find(const QRegularExpression &expr, int from = 0, FindFlags options = FindFlags()) const;
QTextCursor find(const QRegularExpression &expr, const QTextCursor &cursor, FindFlags options = FindFlags()) const;
@@ -217,11 +177,22 @@ public:
void setDefaultFont(const QFont &font);
QFont defaultFont() const;
+ void setSuperScriptBaseline(qreal baseline);
+ qreal superScriptBaseline() const;
+
+ void setSubScriptBaseline(qreal baseline);
+ qreal subScriptBaseline() const;
+
+ void setBaselineOffset(qreal baseline);
+ qreal baselineOffset() const;
+
int pageCount() const;
bool isModified() const;
+#ifndef QT_NO_PRINTER
void print(QPagedPaintDevice *printer) const;
+#endif
enum ResourceType {
UnknownResource = 0,
@@ -237,13 +208,24 @@ public:
QVariant resource(int type, const QUrl &name) const;
void addResource(int type, const QUrl &name, const QVariant &resource);
- QVector<QTextFormat> allFormats() const;
+ using ResourceProvider = std::function<QVariant(const QUrl&)>;
+
+ QTextDocument::ResourceProvider resourceProvider() const;
+ void setResourceProvider(const ResourceProvider &provider);
+
+ static QTextDocument::ResourceProvider defaultResourceProvider();
+ static void setDefaultResourceProvider(const ResourceProvider &provider);
+
+ QList<QTextFormat> allFormats() const;
void markContentsDirty(int from, int length);
void setUseDesignMetrics(bool b);
bool useDesignMetrics() const;
+ void setLayoutEnabled(bool b);
+ bool isLayoutEnabled() const;
+
void drawContents(QPainter *painter, const QRectF &rect = QRectF());
void setTextWidth(qreal width);
@@ -314,8 +296,6 @@ protected:
Q_INVOKABLE virtual QVariant loadResource(int type, const QUrl &name);
QTextDocument(QTextDocumentPrivate &dd, QObject *parent);
-public:
- QTextDocumentPrivate *docHandle() const;
private:
Q_DISABLE_COPY(QTextDocument)
Q_DECLARE_PRIVATE(QTextDocument)
diff --git a/src/gui/text/qtextdocument_p.cpp b/src/gui/text/qtextdocument_p.cpp
index 524931ebde..3c1fc04d4b 100644
--- a/src/gui/text/qtextdocument_p.cpp
+++ b/src/gui/text/qtextdocument_p.cpp
@@ -1,41 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the QtGui module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#include <private/qtools_p.h>
#include <qdebug.h>
@@ -59,7 +23,7 @@ QT_BEGIN_NAMESPACE
#define PMDEBUG if(0) qDebug
-// The VxWorks DIAB compiler crashes when initializing the anonymouse union with { a7 }
+// The VxWorks DIAB compiler crashes when initializing the anonymous union with { a7 }
#if !defined(Q_CC_DIAB)
# define QT_INIT_TEXTUNDOCOMMAND(c, a1, a2, a3, a4, a5, a6, a7, a8) \
QTextUndoCommand c = { a1, a2, 0, 0, quint8(a3), a4, quint32(a5), quint32(a6), { int(a7) }, quint32(a8) }
@@ -132,7 +96,7 @@ static bool isValidBlockSeparator(QChar ch)
|| ch == QTextEndOfFrame;
}
-static bool noBlockInString(const QStringRef &str)
+static bool noBlockInString(QStringView str)
{
return !str.contains(QChar::ParagraphSeparator)
&& !str.contains(QTextBeginningOfFrame)
@@ -186,7 +150,9 @@ QTextDocumentPrivate::QTextDocumentPrivate()
docChangeLength(0),
framesDirty(true),
rtFrame(nullptr),
- initialBlockCharFormatIndex(-1) // set correctly later in init()
+ initialBlockCharFormatIndex(-1), // set correctly later in init()
+ resourceProvider(nullptr),
+ cssMedia(QStringLiteral("screen"))
{
editBlock = 0;
editBlockCursorPosition = -1;
@@ -236,7 +202,7 @@ void QTextDocumentPrivate::clear()
{
Q_Q(QTextDocument);
- for (QTextCursorPrivate *curs : qAsConst(cursors)) {
+ for (QTextCursorPrivate *curs : std::as_const(cursors)) {
curs->setPosition(0);
curs->currentCharFormat = -1;
curs->anchor = 0;
@@ -289,7 +255,7 @@ void QTextDocumentPrivate::clear()
QTextDocumentPrivate::~QTextDocumentPrivate()
{
- for (QTextCursorPrivate *curs : qAsConst(cursors))
+ for (QTextCursorPrivate *curs : std::as_const(cursors))
curs->priv = nullptr;
cursors.clear();
undoState = 0;
@@ -323,7 +289,7 @@ void QTextDocumentPrivate::setLayout(QAbstractTextDocumentLayout *layout)
void QTextDocumentPrivate::insert_string(int pos, uint strPos, uint length, int format, QTextUndoCommand::Operation op)
{
// ##### optimize when only appending to the fragment!
- Q_ASSERT(noBlockInString(text.midRef(strPos, length)));
+ Q_ASSERT(noBlockInString(QStringView{text}.mid(strPos, length)));
split(pos);
uint x = fragments.insert_single(pos, length);
@@ -381,8 +347,13 @@ int QTextDocumentPrivate::insert_block(int pos, uint strPos, int format, int blo
Q_ASSERT(blocks.length() == fragments.length());
QTextBlockGroup *group = qobject_cast<QTextBlockGroup *>(objectForFormat(blockFormat));
- if (group)
+ if (group) {
group->blockInserted(QTextBlock(this, b));
+ if (command != QTextUndoCommand::BlockDeleted) {
+ docChangeOldLength--;
+ docChangeLength--;
+ }
+ }
QTextFrame *frame = qobject_cast<QTextFrame *>(objectForFormat(formats.format(format)));
if (frame) {
@@ -404,7 +375,7 @@ int QTextDocumentPrivate::insertBlock(QChar blockSeparator,
beginEditBlock();
- int strPos = text.length();
+ int strPos = text.size();
text.append(blockSeparator);
int ob = blocks.findNode(pos);
@@ -474,16 +445,16 @@ void QTextDocumentPrivate::insert(int pos, int strPos, int strLength, int format
finishEdit();
}
-void QTextDocumentPrivate::insert(int pos, const QString &str, int format)
+void QTextDocumentPrivate::insert(int pos, QStringView str, int format)
{
if (str.size() == 0)
return;
- Q_ASSERT(noBlockInString(QStringRef(&str)));
+ Q_ASSERT(noBlockInString(str));
- int strPos = text.length();
+ int strPos = text.size();
text.append(str);
- insert(pos, strPos, str.length(), format);
+ insert(pos, strPos, str.size(), format);
}
int QTextDocumentPrivate::remove_string(int pos, uint length, QTextUndoCommand::Operation op)
@@ -497,7 +468,7 @@ int QTextDocumentPrivate::remove_string(int pos, uint length, QTextUndoCommand::
Q_ASSERT(blocks.size(b) > length);
Q_ASSERT(x && fragments.position(x) == (uint)pos && fragments.size(x) == length);
- Q_ASSERT(noBlockInString(text.midRef(fragments.fragment(x)->stringPosition, length)));
+ Q_ASSERT(noBlockInString(QStringView{text}.mid(fragments.fragment(x)->stringPosition, length)));
blocks.setSize(b, blocks.size(b)-length);
@@ -632,7 +603,7 @@ void QTextDocumentPrivate::move(int pos, int to, int length, QTextUndoCommand::O
if (key+1 != blocks.position(b)) {
// qDebug("remove_string from %d length %d", key, X->size_array[0]);
- Q_ASSERT(noBlockInString(text.midRef(X->stringPosition, X->size_array[0])));
+ Q_ASSERT(noBlockInString(QStringView{text}.mid(X->stringPosition, X->size_array[0])));
w = remove_string(key, X->size_array[0], op);
if (needsInsert) {
@@ -677,7 +648,7 @@ void QTextDocumentPrivate::remove(int pos, int length, QTextUndoCommand::Operati
blockCursorAdjustment = true;
move(pos, -1, length, op);
blockCursorAdjustment = false;
- for (QTextCursorPrivate *curs : qAsConst(cursors)) {
+ for (QTextCursorPrivate *curs : std::as_const(cursors)) {
if (curs->adjustPosition(pos, -length, op) == QTextCursorPrivate::CursorMoved) {
curs->changed = true;
}
@@ -877,7 +848,7 @@ bool QTextDocumentPrivate::unite(uint f)
int QTextDocumentPrivate::undoRedo(bool undo)
{
- PMDEBUG("%s, undoState=%d, undoStack size=%d", undo ? "undo:" : "redo:", undoState, undoStack.size());
+ PMDEBUG("%s, undoState=%d, undoStack size=%d", undo ? "undo:" : "redo:", undoState, int(undoStack.size()));
if (!undoEnabled || (undo && undoState == 0) || (!undo && undoState == undoStack.size()))
return -1;
@@ -1235,13 +1206,13 @@ void QTextDocumentPrivate::finishEdit()
}
QList<QTextCursor> changedCursors;
- for (QTextCursorPrivate *curs : qAsConst(cursors)) {
+ for (QTextCursorPrivate *curs : std::as_const(cursors)) {
if (curs->changed) {
curs->changed = false;
changedCursors.append(QTextCursor(curs));
}
}
- for (const QTextCursor &cursor : qAsConst(changedCursors))
+ for (const QTextCursor &cursor : std::as_const(changedCursors))
emit q->cursorPositionChanged(cursor);
contentsChanged();
@@ -1287,7 +1258,7 @@ void QTextDocumentPrivate::adjustDocumentChangesAndCursors(int from, int addedOr
if (blockCursorAdjustment) {
; // postpone, will be called again from QTextDocumentPrivate::remove()
} else {
- for (QTextCursorPrivate *curs : qAsConst(cursors)) {
+ for (QTextCursorPrivate *curs : std::as_const(cursors)) {
if (curs->adjustPosition(from, addedOrRemoved, op) == QTextCursorPrivate::CursorMoved) {
curs->changed = true;
}
@@ -1450,6 +1421,16 @@ QTextFrame *QTextDocumentPrivate::rootFrame() const
return rtFrame;
}
+void QTextDocumentPrivate::addCursor(QTextCursorPrivate *c)
+{
+ cursors.insert(c);
+}
+
+void QTextDocumentPrivate::removeCursor(QTextCursorPrivate *c)
+{
+ cursors.remove(c);
+}
+
QTextFrame *QTextDocumentPrivate::frameAt(int pos) const
{
QTextFrame *f = rootFrame();
@@ -1464,7 +1445,7 @@ QTextFrame *QTextDocumentPrivate::frameAt(int pos) const
void QTextDocumentPrivate::clearFrame(QTextFrame *f)
{
- for (int i = 0; i < f->d_func()->childFrames.count(); ++i)
+ for (int i = 0; i < f->d_func()->childFrames.size(); ++i)
clearFrame(f->d_func()->childFrames.at(i));
f->d_func()->childFrames.clear();
f->d_func()->parentFrame = nullptr;
@@ -1601,7 +1582,7 @@ QTextObject *QTextDocumentPrivate::objectForIndex(int objectIndex) const
if (objectIndex < 0)
return nullptr;
- QTextObject *object = objects.value(objectIndex, 0);
+ QTextObject *object = objects.value(objectIndex, nullptr);
if (!object) {
QTextDocumentPrivate *that = const_cast<QTextDocumentPrivate *>(this);
QTextFormat fmt = formats.objectFormat(objectIndex);
@@ -1734,7 +1715,7 @@ bool QTextDocumentPrivate::ensureMaximumBlockCount()
void QTextDocumentPrivate::aboutToRemoveCell(int from, int to)
{
Q_ASSERT(from <= to);
- for (QTextCursorPrivate *curs : qAsConst(cursors))
+ for (QTextCursorPrivate *curs : std::as_const(cursors))
curs->aboutToRemoveCell(from, to);
}
diff --git a/src/gui/text/qtextdocument_p.h b/src/gui/text/qtextdocument_p.h
index 94c67b3264..1c4edc4329 100644
--- a/src/gui/text/qtextdocument_p.h
+++ b/src/gui/text/qtextdocument_p.h
@@ -1,41 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the QtGui module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#ifndef QTEXTDOCUMENT_P_H
#define QTEXTDOCUMENT_P_H
@@ -52,21 +16,25 @@
//
#include <QtGui/private/qtguiglobal_p.h>
-#include "QtCore/qstring.h"
-#include "QtCore/qvector.h"
-#include "QtCore/qlist.h"
-#include "private/qobject_p.h"
-#include "private/qfragmentmap_p.h"
-#include "QtGui/qtextlayout.h"
-#include "QtGui/qtextoption.h"
-#include "private/qtextformat_p.h"
+#include "QtGui/qtextcursor.h"
#include "QtGui/qtextdocument.h"
+#include "QtGui/qtextlayout.h"
#include "QtGui/qtextobject.h"
-#include "QtGui/qtextcursor.h"
+#include "QtGui/qtextoption.h"
+
+#include "QtCore/qlist.h"
#include "QtCore/qmap.h"
-#include "QtCore/qvariant.h"
+#include "QtCore/qset.h"
+#include "QtCore/qstring.h"
#include "QtCore/qurl.h"
+#include "QtCore/qvariant.h"
+
+#if QT_CONFIG(cssparser)
#include "private/qcssparser_p.h"
+#endif
+#include "private/qfragmentmap_p.h"
+#include "private/qobject_p.h"
+#include "private/qtextformat_p.h"
// #define QT_QMAP_DEBUG
@@ -84,8 +52,8 @@ class QAbstractTextDocumentLayout;
class QTextDocument;
class QTextFrame;
-#define QTextBeginningOfFrame QChar(0xfdd0)
-#define QTextEndOfFrame QChar(0xfdd1)
+#define QTextBeginningOfFrame QChar(u'\xfdd0')
+#define QTextEndOfFrame QChar(u'\xfdd1')
class QTextFragmentData : public QFragment<>
{
@@ -111,7 +79,7 @@ public:
mutable QTextLayout *layout;
mutable QTextBlockUserData *userData;
mutable int userState;
- mutable int revision : 31;
+ mutable signed int revision : 31;
mutable uint hidden : 1;
};
@@ -174,7 +142,9 @@ public:
void setLayout(QAbstractTextDocumentLayout *layout);
- void insert(int pos, const QString &text, int format);
+ void insert(int pos, QStringView text, int format);
+ void insert(int pos, QChar c, int format)
+ { insert(pos, QStringView(&c, 1), format); }
void insert(int pos, int strPos, int strLength, int format);
int insertBlock(int pos, int blockFormat, int charFormat, QTextUndoCommand::Operation = QTextUndoCommand::MoveCursor);
int insertBlock(QChar blockSeparator, int pos, int blockFormat, int charFormat,
@@ -277,8 +247,8 @@ private:
public:
void documentChange(int from, int length);
- inline void addCursor(QTextCursorPrivate *c) { cursors.insert(c); }
- inline void removeCursor(QTextCursorPrivate *c) { cursors.remove(c); }
+ void addCursor(QTextCursorPrivate *c);
+ void removeCursor(QTextCursorPrivate *c);
QTextFrame *frameAt(int pos) const;
QTextFrame *rootFrame() const;
@@ -295,6 +265,38 @@ public:
bool ensureMaximumBlockCount();
+ static inline const QTextDocumentPrivate *get(const QTextDocument *document)
+ {
+ return document->d_func();
+ }
+
+ static inline QTextDocumentPrivate *get(QTextDocument *document)
+ {
+ return document->d_func();
+ }
+
+ static inline QTextDocumentPrivate *get(QTextBlock &block)
+ {
+ return block.p;
+ }
+
+ static inline const QTextDocumentPrivate *get(const QTextBlock &block)
+ {
+ return block.p;
+ }
+
+ static inline QTextDocumentPrivate *get(QTextObject *object)
+ {
+ return get(object->document());
+ }
+
+ static inline const QTextDocumentPrivate *get(const QTextObject *object)
+ {
+ return get(object->document());
+ }
+
+ bool canLayout() const { return layoutEnabled && !pageSize.isNull(); }
+
private:
QTextDocumentPrivate(const QTextDocumentPrivate& m);
QTextDocumentPrivate& operator= (const QTextDocumentPrivate& m);
@@ -308,7 +310,7 @@ private:
QString text;
uint unreachableCharacterCount;
- QVector<QTextUndoCommand> undoStack;
+ QList<QTextUndoCommand> undoStack;
bool undoEnabled;
int undoState;
int revision;
@@ -334,12 +336,14 @@ private:
QMap<int, QTextObject *> objects;
QMap<QUrl, QVariant> resources;
QMap<QUrl, QVariant> cachedResources;
+ QTextDocument::ResourceProvider resourceProvider;
QString defaultStyleSheet;
int lastBlockCount;
public:
bool inContentsChange;
+ bool layoutEnabled = true;
QTextOption defaultTextOption;
Qt::CursorMoveStyle defaultCursorMoveStyle;
#ifndef QT_NO_CSSPARSER
@@ -351,6 +355,8 @@ public:
QSizeF pageSize;
QString title;
QString url;
+ QString cssMedia;
+ QString frontMatter;
qreal indentWidth;
qreal documentMargin;
QUrl baseUrl;
@@ -373,7 +379,7 @@ public:
ExportFragment
};
- QString toHtml(const QByteArray &encoding, ExportMode mode = ExportEntireDocument);
+ QString toHtml(ExportMode mode = ExportEntireDocument);
private:
enum StyleMode { EmitStyleTag, OmitStyleTag };
@@ -396,7 +402,6 @@ private:
void emitBorderStyle(QTextFrameFormat::BorderStyle style);
void emitPageBreakPolicy(QTextFormat::PageBreakFlags policy);
- void emitFontFamily(const QString &family);
void emitFontFamily(const QStringList &families);
void emitBackgroundAttribute(const QTextFormat &format);
@@ -406,6 +411,7 @@ private:
QTextCharFormat defaultCharFormat;
const QTextDocument *doc;
bool fragmentMarkers;
+ QStringList closingTags;
};
QT_END_NAMESPACE
diff --git a/src/gui/text/qtextdocumentfragment.cpp b/src/gui/text/qtextdocumentfragment.cpp
index d7bc707491..1b6e76c201 100644
--- a/src/gui/text/qtextdocumentfragment.cpp
+++ b/src/gui/text/qtextdocumentfragment.cpp
@@ -1,46 +1,16 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the QtGui module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#include "qtextdocumentfragment.h"
#include "qtextdocumentfragment_p.h"
#include "qtextcursor_p.h"
#include "qtextlist.h"
+#if QT_CONFIG(textmarkdownreader)
+#include "qtextmarkdownimporter_p.h"
+#endif
+#if QT_CONFIG(textmarkdownwriter)
+#include "qtextmarkdownwriter_p.h"
+#endif
#include <qdebug.h>
#include <qbytearray.h>
@@ -49,6 +19,8 @@
QT_BEGIN_NAMESPACE
+using namespace Qt::StringLiterals;
+
QTextCopyHelper::QTextCopyHelper(const QTextCursor &_source, const QTextCursor &_destination, bool forceCharFormat, const QTextCharFormat &fmt)
#if defined(Q_CC_DIAB) // compiler bug
: formatCollection(*_destination.d->priv->formatCollection()), originalText((const QString)_source.d->priv->buffer())
@@ -112,7 +84,7 @@ int QTextCopyHelper::appendFragment(int pos, int endPos, int objectIndex)
}
QString txtToInsert(originalText.constData() + frag->stringPosition + inFragmentOffset, charsToCopy);
- if (txtToInsert.length() == 1
+ if (txtToInsert.size() == 1
&& (txtToInsert.at(0) == QChar::ParagraphSeparator
|| txtToInsert.at(0) == QTextBeginningOfFrame
|| txtToInsert.at(0) == QTextEndOfFrame
@@ -137,7 +109,7 @@ int QTextCopyHelper::appendFragment(int pos, int endPos, int objectIndex)
const int userState = nextBlock.userState();
if (userState != -1)
dst->blocksFind(insertPos).setUserState(userState);
- insertPos += txtToInsert.length();
+ insertPos += txtToInsert.size();
}
return charsToCopy;
@@ -224,13 +196,14 @@ QTextDocumentFragmentPrivate::QTextDocumentFragmentPrivate(const QTextCursor &_c
if (!_cursor.hasSelection())
return;
- doc->docHandle()->beginEditBlock();
+ QTextDocumentPrivate *p = QTextDocumentPrivate::get(doc);
+ p->beginEditBlock();
QTextCursor destCursor(doc);
QTextCopyHelper(_cursor, destCursor).copy();
- doc->docHandle()->endEditBlock();
+ p->endEditBlock();
if (_cursor.d)
- doc->docHandle()->mergeCachedResources(_cursor.d->priv);
+ p->mergeCachedResources(_cursor.d->priv);
}
void QTextDocumentFragmentPrivate::insert(QTextCursor &_cursor) const
@@ -265,12 +238,11 @@ void QTextDocumentFragmentPrivate::insert(QTextCursor &_cursor) const
document fragment. Document fragments can also be created by the
static functions, fromPlainText() and fromHtml().
- The contents of a document fragment can be obtained as plain text
- by using the toPlainText() function, or it can be obtained as HTML
- with toHtml().
+ The contents of a document fragment can be obtained as raw text
+ by using the toRawText() function, as ASCII with toPlainText(),
+ as HTML with toHtml(), or as Markdown with toMarkdown().
*/
-
/*!
Constructs an empty QTextDocumentFragment.
@@ -353,14 +325,19 @@ QTextDocumentFragment::~QTextDocumentFragment()
*/
bool QTextDocumentFragment::isEmpty() const
{
- return !d || !d->doc || d->doc->docHandle()->length() <= 1;
+ return d == nullptr || d->doc == nullptr || QTextDocumentPrivate::get(d->doc)->length() <= 1;
}
/*!
- Returns the document fragment's text as plain text (i.e. with no
- formatting information).
-
- \sa toHtml()
+ This function returns the same as toRawText(), but will replace
+ some unicode characters with ASCII alternatives.
+ In particular, no-break space (U+00A0) is replaced by a regular
+ space (U+0020), and both paragraph (U+2029) and line (U+2028)
+ separators are replaced by line feed (U+000A).
+ If you need the precise contents of the document, use toRawText()
+ instead.
+
+ \sa toHtml(), toMarkdown(), toRawText()
*/
QString QTextDocumentFragment::toPlainText() const
{
@@ -370,26 +347,60 @@ QString QTextDocumentFragment::toPlainText() const
return d->doc->toPlainText();
}
+/*!
+ Returns the document fragment's text as raw text (i.e. with no
+ formatting information).
+
+ \since 6.4
+ \sa toHtml(), toMarkdown(), toPlainText()
+*/
+QString QTextDocumentFragment::toRawText() const
+{
+ if (!d)
+ return QString();
+
+ return d->doc->toRawText();
+}
+
#ifndef QT_NO_TEXTHTMLPARSER
/*!
\since 4.2
- Returns the contents of the document fragment as HTML,
- using the specified \a encoding (e.g., "UTF-8", "ISO 8859-1").
+ Returns the contents of the document fragment as HTML.
- \sa toPlainText(), QTextDocument::toHtml(), QTextCodec
+ \sa toPlainText(), toMarkdown(), QTextDocument::toHtml()
*/
-QString QTextDocumentFragment::toHtml(const QByteArray &encoding) const
+QString QTextDocumentFragment::toHtml() const
{
if (!d)
return QString();
- return QTextHtmlExporter(d->doc).toHtml(encoding, QTextHtmlExporter::ExportFragment);
+ return QTextHtmlExporter(d->doc).toHtml(QTextHtmlExporter::ExportFragment);
}
#endif // QT_NO_TEXTHTMLPARSER
+#if QT_CONFIG(textmarkdownwriter)
+
+/*!
+ \since 6.4
+
+ Returns the contents of the document fragment as Markdown,
+ with the specified \a features. The default is GitHub dialect.
+
+ \sa toPlainText(), QTextDocument::toMarkdown()
+*/
+QString QTextDocumentFragment::toMarkdown(QTextDocument::MarkdownFeatures features) const
+{
+ if (!d)
+ return QString();
+
+ return d->doc->toMarkdown(features);
+}
+
+#endif // textmarkdownwriter
+
/*!
Returns a document fragment that contains the given \a plainText.
@@ -425,14 +436,14 @@ QTextHtmlImporter::QTextHtmlImporter(QTextDocument *_doc, const QString &_html,
wsm = QTextHtmlParserNode::WhiteSpaceNormal;
QString html = _html;
- const int startFragmentPos = html.indexOf(QLatin1String("<!--StartFragment-->"));
+ const int startFragmentPos = html.indexOf("<!--StartFragment-->"_L1);
if (startFragmentPos != -1) {
- const QLatin1String qt3RichTextHeader("<meta name=\"qrichtext\" content=\"1\" />");
+ const auto qt3RichTextHeader = "<meta name=\"qrichtext\" content=\"1\" />"_L1;
// Hack for Qt3
const bool hasQtRichtextMetaTag = html.contains(qt3RichTextHeader);
- const int endFragmentPos = html.indexOf(QLatin1String("<!--EndFragment-->"));
+ const int endFragmentPos = html.indexOf("<!--EndFragment-->"_L1);
if (startFragmentPos < endFragmentPos)
html = html.mid(startFragmentPos, endFragmentPos - startFragmentPos);
else
@@ -477,7 +488,8 @@ void QTextHtmlImporter::import()
* means there was a tag closing in the input html
*/
if (currentNodeIdx > 0 && (currentNode->parent != currentNodeIdx - 1)) {
- blockTagClosed = closeTag();
+ const bool lastBlockTagClosed = closeTag();
+ blockTagClosed = blockTagClosed || lastBlockTagClosed;
// visually collapse subsequent block tags, but if the element after the closed block tag
// is for example an inline element (!isBlock) we have to make sure we start a new paragraph by setting
// hasBlock to false.
@@ -529,6 +541,7 @@ void QTextHtmlImporter::import()
appendBlock(block, currentNode->charFormat);
+ blockTagClosed = false;
hasBlock = true;
}
@@ -561,56 +574,54 @@ bool QTextHtmlImporter::appendNodeText()
const int initialCursorPosition = cursor.position();
QTextCharFormat format = currentNode->charFormat;
- if(wsm == QTextHtmlParserNode::WhiteSpacePre || wsm == QTextHtmlParserNode::WhiteSpacePreWrap)
+ if (wsm == QTextHtmlParserNode::WhiteSpacePre || wsm == QTextHtmlParserNode::WhiteSpacePreWrap)
compressNextWhitespace = PreserveWhiteSpace;
- QString text = currentNode->text;
+ const QString text = currentNode->text;
QString textToInsert;
textToInsert.reserve(text.size());
- for (int i = 0; i < text.length(); ++i) {
- QChar ch = text.at(i);
-
+ for (QChar ch : text) {
if (ch.isSpace()
&& ch != QChar::Nbsp
&& ch != QChar::ParagraphSeparator) {
- if (wsm == QTextHtmlParserNode::WhiteSpacePreLine && (ch == QLatin1Char('\n') || ch == QLatin1Char('\r')))
+ if (wsm == QTextHtmlParserNode::WhiteSpacePreLine && (ch == u'\n' || ch == u'\r'))
compressNextWhitespace = PreserveWhiteSpace;
if (compressNextWhitespace == CollapseWhiteSpace)
compressNextWhitespace = RemoveWhiteSpace; // allow this one, and remove the ones coming next.
- else if(compressNextWhitespace == RemoveWhiteSpace)
+ else if (compressNextWhitespace == RemoveWhiteSpace)
continue;
if (wsm == QTextHtmlParserNode::WhiteSpacePre
|| textEditMode
) {
- if (ch == QLatin1Char('\n')) {
+ if (ch == u'\n') {
if (textEditMode)
continue;
- } else if (ch == QLatin1Char('\r')) {
+ } else if (ch == u'\r') {
continue;
}
} else if (wsm != QTextHtmlParserNode::WhiteSpacePreWrap) {
compressNextWhitespace = RemoveWhiteSpace;
- if (wsm == QTextHtmlParserNode::WhiteSpacePreLine && (ch == QLatin1Char('\n') || ch == QLatin1Char('\r')))
+ if (wsm == QTextHtmlParserNode::WhiteSpacePreLine && (ch == u'\n' || ch == u'\r'))
{ }
else if (wsm == QTextHtmlParserNode::WhiteSpaceNoWrap)
ch = QChar::Nbsp;
else
- ch = QLatin1Char(' ');
+ ch = u' ';
}
} else {
compressNextWhitespace = PreserveWhiteSpace;
}
- if (ch == QLatin1Char('\n')
+ if (ch == u'\n'
|| ch == QChar::ParagraphSeparator) {
if (!textToInsert.isEmpty()) {
- if (wsm == QTextHtmlParserNode::WhiteSpacePreLine && textToInsert.at(textToInsert.length() - 1) == QLatin1Char(' '))
+ if (wsm == QTextHtmlParserNode::WhiteSpacePreLine && textToInsert.at(textToInsert.size() - 1) == u' ')
textToInsert = textToInsert.chopped(1);
cursor.insertText(textToInsert, format);
textToInsert.clear();
@@ -688,6 +699,8 @@ QTextHtmlImporter::ProcessNodeResult QTextHtmlImporter::processSpecialNodes()
listFmt.setNumberPrefix(currentNode->textListNumberPrefix);
if (!currentNode->textListNumberSuffix.isNull())
listFmt.setNumberSuffix(currentNode->textListNumberSuffix);
+ if (currentNode->listStart != 1)
+ listFmt.setStart(currentNode->listStart);
++indent;
if (currentNode->hasCssListIndent)
@@ -891,11 +904,11 @@ QTextHtmlImporter::Table QTextHtmlImporter::scanTable(int tableNodeIdx)
Table table;
table.columns = 0;
- QVector<QTextLength> columnWidths;
+ QList<QTextLength> columnWidths;
int tableHeaderRowCount = 0;
- QVector<int> rowNodes;
- rowNodes.reserve(at(tableNodeIdx).children.count());
+ QList<int> rowNodes;
+ rowNodes.reserve(at(tableNodeIdx).children.size());
for (int row : at(tableNodeIdx).children) {
switch (at(row).id) {
case Html_tr:
@@ -916,11 +929,11 @@ QTextHtmlImporter::Table QTextHtmlImporter::scanTable(int tableNodeIdx)
}
}
- QVector<RowColSpanInfo> rowColSpans;
- QVector<RowColSpanInfo> rowColSpanForColumn;
+ QList<RowColSpanInfo> rowColSpans;
+ QList<RowColSpanInfo> rowColSpanForColumn;
int effectiveRow = 0;
- for (int row : qAsConst(rowNodes)) {
+ for (int row : std::as_const(rowNodes)) {
int colsInRow = 0;
for (int cell : at(row).children) {
@@ -948,7 +961,7 @@ QTextHtmlImporter::Table QTextHtmlImporter::scanTable(int tableNodeIdx)
if (spanInfo.colSpan > 1 || spanInfo.rowSpan > 1)
rowColSpans.append(spanInfo);
- columnWidths.resize(qMax(columnWidths.count(), colsInRow));
+ columnWidths.resize(qMax(columnWidths.size(), colsInRow));
rowColSpanForColumn.resize(columnWidths.size());
for (int i = currentColumn; i < currentColumn + c.tableCellColSpan; ++i) {
if (columnWidths.at(i).type() == QTextLength::VariableLength) {
@@ -1030,7 +1043,7 @@ QTextHtmlImporter::Table QTextHtmlImporter::scanTable(int tableNodeIdx)
QTextTable *textTable = cursor.insertTable(table.rows, table.columns, fmt.toTableFormat());
table.frame = textTable;
- for (int i = 0; i < rowColSpans.count(); ++i) {
+ for (int i = 0; i < rowColSpans.size(); ++i) {
const RowColSpanInfo &nfo = rowColSpans.at(i);
textTable->mergeCells(nfo.row, nfo.col, nfo.rowSpan, nfo.colSpan);
}
@@ -1255,24 +1268,6 @@ void QTextHtmlImporter::appendBlock(const QTextBlockFormat &format, QTextCharFor
compressNextWhitespace = RemoveWhiteSpace;
}
-#endif // QT_NO_TEXTHTMLPARSER
-
-/*!
- \fn QTextDocumentFragment QTextDocumentFragment::fromHtml(const QString &text)
-
- Returns a QTextDocumentFragment based on the arbitrary piece of
- HTML in the given \a text. The formatting is preserved as much as
- possible; for example, "<b>bold</b>" will become a document
- fragment with the text "bold" with a bold character format.
-*/
-
-#ifndef QT_NO_TEXTHTMLPARSER
-
-QTextDocumentFragment QTextDocumentFragment::fromHtml(const QString &html)
-{
- return fromHtml(html, nullptr);
-}
-
/*!
\fn QTextDocumentFragment QTextDocumentFragment::fromHtml(const QString &text, const QTextDocument *resourceProvider)
\since 4.2
@@ -1296,5 +1291,32 @@ QTextDocumentFragment QTextDocumentFragment::fromHtml(const QString &html, const
return res;
}
-QT_END_NAMESPACE
#endif // QT_NO_TEXTHTMLPARSER
+
+#if QT_CONFIG(textmarkdownreader)
+
+/*!
+ \fn QTextDocumentFragment QTextDocumentFragment::fromMarkdown(const QString &markdown, QTextDocument::MarkdownFeatures features)
+ \since 6.4
+
+ Returns a QTextDocumentFragment based on the given \a markdown text with
+ the specified \a features. The default is GitHub dialect.
+
+ The formatting is preserved as much as possible; for example, \c {**bold**}
+ will become a document fragment containing the text "bold" with a bold
+ character style.
+
+ \note Loading external resources is not supported.
+*/
+QTextDocumentFragment QTextDocumentFragment::fromMarkdown(const QString &markdown, QTextDocument::MarkdownFeatures features)
+{
+ QTextDocumentFragment res;
+ res.d = new QTextDocumentFragmentPrivate;
+
+ QTextMarkdownImporter(res.d->doc, features).import(markdown);
+ return res;
+}
+
+#endif // textmarkdownreader
+
+QT_END_NAMESPACE
diff --git a/src/gui/text/qtextdocumentfragment.h b/src/gui/text/qtextdocumentfragment.h
index a56f6d06d6..a618ff15ff 100644
--- a/src/gui/text/qtextdocumentfragment.h
+++ b/src/gui/text/qtextdocumentfragment.h
@@ -1,53 +1,17 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the QtGui module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#ifndef QTEXTDOCUMENTFRAGMENT_H
#define QTEXTDOCUMENTFRAGMENT_H
#include <QtGui/qtguiglobal.h>
+#include <QtGui/qtextdocument.h>
#include <QtCore/qstring.h>
QT_BEGIN_NAMESPACE
class QTextStream;
-class QTextDocument;
class QTextDocumentFragmentPrivate;
class QTextCursor;
@@ -64,15 +28,22 @@ public:
bool isEmpty() const;
QString toPlainText() const;
+ QString toRawText() const;
#ifndef QT_NO_TEXTHTMLPARSER
- QString toHtml(const QByteArray &encoding = QByteArray()) const;
+ QString toHtml() const;
#endif // QT_NO_TEXTHTMLPARSER
+#if QT_CONFIG(textmarkdownwriter)
+ QString toMarkdown(QTextDocument::MarkdownFeatures features = QTextDocument::MarkdownDialectGitHub) const;
+#endif
static QTextDocumentFragment fromPlainText(const QString &plainText);
#ifndef QT_NO_TEXTHTMLPARSER
- static QTextDocumentFragment fromHtml(const QString &html);
- static QTextDocumentFragment fromHtml(const QString &html, const QTextDocument *resourceProvider);
+ static QTextDocumentFragment fromHtml(const QString &html, const QTextDocument *resourceProvider = nullptr);
#endif // QT_NO_TEXTHTMLPARSER
+#if QT_CONFIG(textmarkdownreader)
+ static QTextDocumentFragment fromMarkdown(const QString &markdown,
+ QTextDocument::MarkdownFeatures features = QTextDocument::MarkdownDialectGitHub);
+#endif
private:
QTextDocumentFragmentPrivate *d;
diff --git a/src/gui/text/qtextdocumentfragment_p.h b/src/gui/text/qtextdocumentfragment_p.h
index 67b0c2c600..0d130003bc 100644
--- a/src/gui/text/qtextdocumentfragment_p.h
+++ b/src/gui/text/qtextdocumentfragment_p.h
@@ -1,41 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the QtGui module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#ifndef QTEXTDOCUMENTFRAGMENT_P_H
#define QTEXTDOCUMENTFRAGMENT_P_H
@@ -150,7 +114,7 @@ private:
QPointer<QTextList> list;
};
friend class QTypeInfo<List>;
- QVector<List> lists;
+ QList<List> lists;
int indent;
int headingLevel;
@@ -205,7 +169,7 @@ private:
int lastIndent;
};
friend class QTypeInfo<Table>;
- QVector<Table> tables;
+ QList<Table> tables;
struct RowColSpanInfo
{
@@ -233,9 +197,9 @@ private:
int currentNodeIdx;
const QTextHtmlParserNode *currentNode;
};
-Q_DECLARE_TYPEINFO(QTextHtmlImporter::List, Q_MOVABLE_TYPE);
+Q_DECLARE_TYPEINFO(QTextHtmlImporter::List, Q_RELOCATABLE_TYPE);
Q_DECLARE_TYPEINFO(QTextHtmlImporter::TableCellIterator, Q_PRIMITIVE_TYPE);
-Q_DECLARE_TYPEINFO(QTextHtmlImporter::Table, Q_MOVABLE_TYPE);
+Q_DECLARE_TYPEINFO(QTextHtmlImporter::Table, Q_RELOCATABLE_TYPE);
Q_DECLARE_TYPEINFO(QTextHtmlImporter::RowColSpanInfo, Q_PRIMITIVE_TYPE);
QT_END_NAMESPACE
diff --git a/src/gui/text/qtextdocumentlayout.cpp b/src/gui/text/qtextdocumentlayout.cpp
index e21a8d8d52..452f814231 100644
--- a/src/gui/text/qtextdocumentlayout.cpp
+++ b/src/gui/text/qtextdocumentlayout.cpp
@@ -1,41 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the QtGui module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#include "qtextdocumentlayout_p.h"
#include "qtextdocument_p.h"
@@ -43,7 +7,9 @@
#include "qtexttable.h"
#include "qtextlist.h"
#include "qtextengine_p.h"
+#if QT_CONFIG(cssparser)
#include "private/qcssutil_p.h"
+#endif
#include "private/qguiapplication_p.h"
#include "qabstracttextdocumentlayout_p.h"
@@ -59,6 +25,7 @@
#include <qbasictimer.h>
#include "private/qfunctions_p.h"
#include <qloggingcategory.h>
+#include <QtCore/qpointer.h>
#include <algorithm>
@@ -106,7 +73,7 @@ public:
bool sizeDirty;
bool layoutDirty;
- QVector<QPointer<QTextFrame> > floats;
+ QList<QPointer<QTextFrame>> floats;
};
QTextFrameData::QTextFrameData()
@@ -204,14 +171,14 @@ class QTextTableData : public QTextFrameData
public:
QFixed cellSpacing, cellPadding;
qreal deviceScale;
- QVector<QFixed> minWidths;
- QVector<QFixed> maxWidths;
- QVector<QFixed> widths;
- QVector<QFixed> heights;
- QVector<QFixed> columnPositions;
- QVector<QFixed> rowPositions;
+ QList<QFixed> minWidths;
+ QList<QFixed> maxWidths;
+ QList<QFixed> widths;
+ QList<QFixed> heights;
+ QList<QFixed> columnPositions;
+ QList<QFixed> rowPositions;
- QVector<QFixed> cellVerticalOffsets;
+ QList<QFixed> cellVerticalOffsets;
// without borderCollapse, those equal QTextFrameData::border;
// otherwise the widest outermost cell edge will be used
@@ -248,7 +215,7 @@ public:
if (v.isNull()) {
return cellPadding;
} else {
- Q_ASSERT(v.userType() == QVariant::Double || v.userType() == QMetaType::Float);
+ Q_ASSERT(v.userType() == QMetaType::Double || v.userType() == QMetaType::Float);
return QFixed::fromReal(v.toReal() * deviceScale);
}
}
@@ -581,10 +548,10 @@ public:
QTextLayoutStruct *layoutStruct, int layoutFrom, int layoutTo, const QTextBlockFormat *previousBlockFormat);
void layoutFlow(QTextFrame::Iterator it, QTextLayoutStruct *layoutStruct, int layoutFrom, int layoutTo, QFixed width = 0);
- void floatMargins(const QFixed &y, const QTextLayoutStruct *layoutStruct, QFixed *left, QFixed *right) const;
+ void floatMargins(QFixed y, const QTextLayoutStruct *layoutStruct, QFixed *left, QFixed *right) const;
QFixed findY(QFixed yFrom, const QTextLayoutStruct *layoutStruct, QFixed requiredWidth) const;
- QVector<QCheckPoint> checkPoints;
+ QList<QCheckPoint> checkPoints;
QTextFrame::Iterator frameIteratorForYPosition(QFixed y) const;
QTextFrame::Iterator frameIteratorForTextPosition(int position) const;
@@ -622,7 +589,7 @@ QTextFrame::Iterator QTextDocumentLayoutPrivate::frameIteratorForYPosition(QFixe
|| y < 0 || y > data(rootFrame)->size.height)
return rootFrame->begin();
- QVector<QCheckPoint>::ConstIterator checkPoint = std::lower_bound(checkPoints.begin(), checkPoints.end(), y);
+ auto checkPoint = std::lower_bound(checkPoints.begin(), checkPoints.end(), y);
if (checkPoint == checkPoints.end())
return rootFrame->begin();
@@ -791,14 +758,14 @@ QTextDocumentLayoutPrivate::hitTest(QTextTable *table, const QFixedPoint &point,
{
QTextTableData *td = static_cast<QTextTableData *>(data(table));
- QVector<QFixed>::ConstIterator rowIt = std::lower_bound(td->rowPositions.constBegin(), td->rowPositions.constEnd(), point.y);
+ auto rowIt = std::lower_bound(td->rowPositions.constBegin(), td->rowPositions.constEnd(), point.y);
if (rowIt == td->rowPositions.constEnd()) {
rowIt = td->rowPositions.constEnd() - 1;
} else if (rowIt != td->rowPositions.constBegin()) {
--rowIt;
}
- QVector<QFixed>::ConstIterator colIt = std::lower_bound(td->columnPositions.constBegin(), td->columnPositions.constEnd(), point.x);
+ auto colIt = std::lower_bound(td->columnPositions.constBegin(), td->columnPositions.constEnd(), point.x);
if (colIt == td->columnPositions.constEnd()) {
colIt = td->columnPositions.constEnd() - 1;
} else if (colIt != td->columnPositions.constBegin()) {
@@ -830,7 +797,7 @@ QTextDocumentLayoutPrivate::hitTest(const QTextBlock &bl, const QFixedPoint &poi
textrect.translate(tl->position());
qCDebug(lcHit) << " checking block" << bl.position() << "point=" << point.toPointF() << " tlrect" << textrect;
*position = bl.position();
- if (point.y.toReal() < textrect.top()) {
+ if (point.y.toReal() < textrect.top() - bl.blockFormat().topMargin()) {
qCDebug(lcHit) << " before pos=" << *position;
return PointBefore;
} else if (point.y.toReal() > textrect.bottom()) {
@@ -1168,7 +1135,7 @@ void QTextDocumentLayoutPrivate::drawFrame(const QPointF &offset, QPainter *pain
int lastRow = rows;
if (context.clip.isValid()) {
- QVector<QFixed>::ConstIterator rowIt = std::lower_bound(td->rowPositions.constBegin(), td->rowPositions.constEnd(), QFixed::fromReal(context.clip.top() - off.y()));
+ auto rowIt = std::lower_bound(td->rowPositions.constBegin(), td->rowPositions.constEnd(), QFixed::fromReal(context.clip.top() - off.y()));
if (rowIt != td->rowPositions.constEnd() && rowIt != td->rowPositions.constBegin()) {
--rowIt;
firstRow = rowIt - td->rowPositions.constBegin();
@@ -1211,7 +1178,7 @@ void QTextDocumentLayoutPrivate::drawFrame(const QPointF &offset, QPainter *pain
it = frameIteratorForYPosition(QFixed::fromReal(context.clip.top()));
QList<QTextFrame *> floats;
- const int numFloats = fd->floats.count();
+ const int numFloats = fd->floats.size();
floats.reserve(numFloats);
for (int i = 0; i < numFloats; ++i)
floats.append(fd->floats.at(i));
@@ -1245,8 +1212,7 @@ static inline QTextFormat::Property borderPropertyForEdge(QCss::Edge edge)
case QCss::RightEdge:
return QTextFormat::TableCellRightBorder;
default:
- Q_UNREACHABLE();
- return QTextFormat::UserProperty;
+ Q_UNREACHABLE_RETURN(QTextFormat::UserProperty);
}
}
@@ -1262,8 +1228,7 @@ static inline QTextFormat::Property borderStylePropertyForEdge(QCss::Edge edge)
case QCss::RightEdge:
return QTextFormat::TableCellRightBorderStyle;
default:
- Q_UNREACHABLE();
- return QTextFormat::UserProperty;
+ Q_UNREACHABLE_RETURN(QTextFormat::UserProperty);
}
}
@@ -1279,8 +1244,7 @@ static inline QCss::Edge adjacentEdge(QCss::Edge edge)
case QCss::LeftEdge:
return QCss::RightEdge;
default:
- Q_UNREACHABLE();
- return QCss::NumEdges;
+ Q_UNREACHABLE_RETURN(QCss::NumEdges);
}
}
@@ -1359,8 +1323,7 @@ static inline bool sharesAxis(const QTextTableCell &cell, QCss::Edge edge,
return cell.column() + cell.columnSpan() ==
competingCell.column() + (competingCellEdge == QCss::LeftEdge ? 0 : competingCell.columnSpan());
default:
- Q_UNREACHABLE();
- return false;
+ Q_UNREACHABLE_RETURN(false);
}
}
@@ -1519,7 +1482,7 @@ static inline qreal collapseOffset(const QTextDocumentLayoutPrivate *p, const Ed
// there was no edge B (due to a rowspan or the axis C-D being the table's right
// border).
//
-// ignoreEdgesAbove: true if an egde (left, right or top) for the first row
+// ignoreEdgesAbove: true if an edge (left, right or top) for the first row
// after a table page break should be painted. In this case the edges of the
// row above must be ignored.
static inline double prioritizedEdgeAnchorOffset(const QTextDocumentLayoutPrivate *p,
@@ -1615,7 +1578,7 @@ void drawCellBorder(const QTextDocumentLayoutPrivate *p, QPainter *painter,
QBrush brush;
if (edgeData.edgeClass != EdgeData::ClassExplicit && td->drawGrid) {
- borderStyle = QTextFrameFormat::BorderStyle_Solid;
+ borderStyle = table->format().borderStyle();
brush = table->format().borderBrush();
}
else {
@@ -1855,11 +1818,20 @@ void QTextDocumentLayoutPrivate::drawTableCell(const QRectF &cellRect, QPainter
if (r >= headerRowCount)
topMargin += td->headerHeight.toReal();
- if (!td->borderCollapse && td->border != 0) {
+ // If cell border configured, don't draw default border for cells. It will be taken care later by
+ // drawTableCellBorder().
+ bool cellBorderConfigured = (cell.format().hasProperty(QTextFormat::TableCellLeftBorder) ||
+ cell.format().hasProperty(QTextFormat::TableCellTopBorder) ||
+ cell.format().hasProperty(QTextFormat::TableCellRightBorder) ||
+ cell.format().hasProperty(QTextFormat::TableCellBottomBorder));
+
+ if (!td->borderCollapse && td->border != 0 && !cellBorderConfigured) {
const QBrush oldBrush = painter->brush();
const QPen oldPen = painter->pen();
- const qreal border = td->border.toReal();
+ // If border is configured for the table (and not explicitly for the cell), then
+ // always draw 1px border around the cell
+ const qreal border = 1;
QRectF borderRect(cellRect.left() - border, cellRect.top() - border, cellRect.width() + border, cellRect.height() + border);
@@ -1922,7 +1894,8 @@ void QTextDocumentLayoutPrivate::drawTableCell(const QRectF &cellRect, QPainter
}
// paint over the background - otherwise we would have to adjust the background paint cellRect for the border values
- drawTableCellBorder(cellRect, painter, table, td, cell);
+ if (cellBorderConfigured)
+ drawTableCellBorder(cellRect, painter, table, td, cell);
const QFixed verticalOffset = td->cellVerticalOffsets.at(c + r * table->columns());
@@ -1948,7 +1921,7 @@ void QTextDocumentLayoutPrivate::drawFlow(const QPointF &offset, QPainter *paint
Q_Q(const QTextDocumentLayout);
const bool inRootFrame = (!it.atEnd() && it.parentFrame() && it.parentFrame()->parentFrame() == nullptr);
- QVector<QCheckPoint>::ConstIterator lastVisibleCheckPoint = checkPoints.end();
+ auto lastVisibleCheckPoint = checkPoints.end();
if (inRootFrame && context.clip.isValid()) {
lastVisibleCheckPoint = std::lower_bound(checkPoints.begin(), checkPoints.end(), QFixed::fromReal(context.clip.bottom()));
}
@@ -2003,7 +1976,7 @@ void QTextDocumentLayoutPrivate::drawFlow(const QPointF &offset, QPainter *paint
previousFrame = c;
}
- for (int i = 0; i < floats.count(); ++i) {
+ for (int i = 0; i < floats.size(); ++i) {
QTextFrame *frame = floats.at(i);
if (!isFrameFromInlineObject(frame)
|| frame->frameFormat().position() == QTextFrameFormat::InFlow)
@@ -2044,10 +2017,12 @@ void QTextDocumentLayoutPrivate::drawBlock(const QPointF &offset, QPainter *pain
rect.setRight((fd->size.width - fd->rightMargin).toReal());
}
- fillBackground(painter, rect, bg, r.topLeft());
+ // in the case of <hr>, the background-color CSS style fills only the rule's thickness instead of the whole line
+ if (!blockFormat.hasProperty(QTextFormat::BlockTrailingHorizontalRulerWidth))
+ fillBackground(painter, rect, bg, r.topLeft());
}
- QVector<QTextLayout::FormatRange> selections;
+ QList<QTextLayout::FormatRange> selections;
int blpos = bl.position();
int bllen = bl.length();
const QTextCharFormat *selFormat = nullptr;
@@ -2104,7 +2079,10 @@ void QTextDocumentLayoutPrivate::drawBlock(const QPointF &offset, QPainter *pain
if (blockFormat.hasProperty(QTextFormat::BlockTrailingHorizontalRulerWidth)) {
const qreal width = blockFormat.lengthProperty(QTextFormat::BlockTrailingHorizontalRulerWidth).value(r.width());
- painter->setPen(context.palette.color(QPalette::Dark));
+ const auto color = blockFormat.hasProperty(QTextFormat::BackgroundBrush)
+ ? qvariant_cast<QBrush>(blockFormat.property(QTextFormat::BackgroundBrush)).color()
+ : context.palette.color(QPalette::Inactive, QPalette::WindowText);
+ painter->setPen(color);
qreal y = r.bottom();
if (bl.length() == 1)
y = r.top() + r.height() / 2;
@@ -2123,7 +2101,7 @@ void QTextDocumentLayoutPrivate::drawListItem(const QPointF &offset, QPainter *p
{
Q_Q(const QTextDocumentLayout);
const QTextBlockFormat blockFormat = bl.blockFormat();
- const QTextCharFormat charFormat = QTextCursor(bl).charFormat();
+ const QTextCharFormat charFormat = bl.charFormat();
QFont font(charFormat.font());
if (q->paintDevice())
font = QFont(font, q->paintDevice());
@@ -2177,7 +2155,7 @@ void QTextDocumentLayoutPrivate::drawListItem(const QPointF &offset, QPainter *p
QRectF r(pos, size);
- qreal xoff = fontMetrics.horizontalAdvance(QLatin1Char(' '));
+ qreal xoff = fontMetrics.horizontalAdvance(u' ');
if (dir == Qt::LeftToRight)
xoff = -xoff - size.width();
r.translate( xoff, (fontMetrics.height() / 2) - (size.height() / 2));
@@ -2186,9 +2164,11 @@ void QTextDocumentLayoutPrivate::drawListItem(const QPointF &offset, QPainter *p
painter->setRenderHint(QPainter::Antialiasing);
+ const bool marker = bl.blockFormat().marker() != QTextBlockFormat::MarkerType::NoMarker;
if (selectionFormat) {
painter->setPen(QPen(selectionFormat->foreground(), 0));
- painter->fillRect(r, selectionFormat->background());
+ if (!marker)
+ painter->fillRect(r, selectionFormat->background());
} else {
QBrush fg = charFormat.foreground();
if (fg == Qt::NoBrush)
@@ -2198,19 +2178,21 @@ void QTextDocumentLayoutPrivate::drawListItem(const QPointF &offset, QPainter *p
QBrush brush = context.palette.brush(QPalette::Text);
- bool marker = bl.blockFormat().marker() != QTextBlockFormat::MarkerType::NoMarker;
if (marker) {
int adj = fontMetrics.lineSpacing() / 6;
r.adjust(-adj, 0, -adj, 0);
+ const QRectF outer = r.adjusted(-adj, -adj, adj, adj);
+ if (selectionFormat)
+ painter->fillRect(outer, selectionFormat->background());
if (bl.blockFormat().marker() == QTextBlockFormat::MarkerType::Checked) {
- // ### Qt6: render with QStyle / PE_IndicatorCheckBox. We don't currently
+ // ### Qt7: render with QStyle / PE_IndicatorCheckBox. We don't currently
// have access to that here, because it would be a widget dependency.
painter->setPen(QPen(painter->pen().color(), 2));
painter->drawLine(r.topLeft(), r.bottomRight());
painter->drawLine(r.topRight(), r.bottomLeft());
painter->setPen(QPen(painter->pen().color(), 0));
}
- painter->drawRect(r.adjusted(-adj, -adj, adj, adj));
+ painter->drawRect(outer);
}
switch (style) {
@@ -2234,17 +2216,15 @@ void QTextDocumentLayoutPrivate::drawListItem(const QPointF &offset, QPainter *p
}
case QTextListFormat::ListSquare:
if (!marker)
- painter->fillRect(r, brush);
+ painter->fillRect(r, painter->pen().brush());
break;
case QTextListFormat::ListCircle:
- if (!marker) {
- painter->setPen(QPen(brush, 0));
+ if (!marker)
painter->drawEllipse(r.translated(0.5, 0.5)); // pixel align for sharper rendering
- }
break;
case QTextListFormat::ListDisc:
if (!marker) {
- painter->setBrush(brush);
+ painter->setBrush(painter->pen().brush());
painter->setPen(Qt::NoPen);
painter->drawEllipse(r);
}
@@ -2357,9 +2337,10 @@ QTextLayoutStruct QTextDocumentLayoutPrivate::layoutCell(QTextTable *t, const QT
floatMinWidth = qMax(floatMinWidth, cd->minimumWidth);
}
- // constraint the maximumWidth by the minimum width of the fixed size floats, to
- // keep them visible
+ // constraint the maximum/minimumWidth by the minimum width of the fixed size floats,
+ // to keep them visible
layoutStruct.maximumWidth = qMax(layoutStruct.maximumWidth, floatMinWidth);
+ layoutStruct.minimumWidth = qMax(layoutStruct.minimumWidth, floatMinWidth);
// as floats in cells get added to the table's float list but must not affect
// floats in other cells we must clear the list here.
@@ -2394,17 +2375,17 @@ QRectF QTextDocumentLayoutPrivate::layoutTable(QTextTable *table, int layoutFrom
td->childFrameMap.clear();
{
const QList<QTextFrame *> children = table->childFrames();
- for (int i = 0; i < children.count(); ++i) {
+ for (int i = 0; i < children.size(); ++i) {
QTextFrame *frame = children.at(i);
QTextTableCell cell = table->cellAt(frame->firstPosition());
td->childFrameMap.insert(cell.row() + cell.column() * rows, frame);
}
}
- QVector<QTextLength> columnWidthConstraints = fmt.columnWidthConstraints();
+ QList<QTextLength> columnWidthConstraints = fmt.columnWidthConstraints();
if (columnWidthConstraints.size() != columns)
columnWidthConstraints.resize(columns);
- Q_ASSERT(columnWidthConstraints.count() == columns);
+ Q_ASSERT(columnWidthConstraints.size() == columns);
// borderCollapse will disable drawing the html4 style table cell borders
// and draw a 1px grid instead. This also sets a fixed cellspacing
@@ -2536,6 +2517,8 @@ recalc_minmax_widths:
for (int n = 0; n < cspan; ++n) {
const int col = i + n;
QFixed w = widthToDistribute / (cspan - n);
+ if (td->maxWidths[col] != QFIXED_MAX)
+ w = qMax(td->maxWidths[col], w);
td->maxWidths[col] = qMax(td->minWidths.at(col), w);
widthToDistribute -= td->maxWidths.at(col);
if (widthToDistribute <= 0)
@@ -2577,8 +2560,9 @@ recalc_minmax_widths:
const QFixed allottedPercentage = QFixed::fromReal(columnWidthConstraints.at(i).rawValue());
const QFixed percentWidth = totalPercentagedWidth * allottedPercentage / totalPercentage;
- if (percentWidth >= td->minWidths.at(i)) {
- td->widths[i] = qBound(td->minWidths.at(i), percentWidth, remainingWidth - remainingMinWidths);
+ QFixed maxWidth = remainingWidth - remainingMinWidths;
+ if (percentWidth >= td->minWidths.at(i) && maxWidth > td->minWidths.at(i)) {
+ td->widths[i] = qBound(td->minWidths.at(i), percentWidth, maxWidth);
} else {
td->widths[i] = td->minWidths.at(i);
}
@@ -2599,9 +2583,9 @@ recalc_minmax_widths:
QFixed lastRemainingWidth = remainingWidth;
while (remainingWidth > 0) {
- for (int k = 0; k < columnsWithProperMaxSize.count(); ++k) {
+ for (int k = 0; k < columnsWithProperMaxSize.size(); ++k) {
const int col = columnsWithProperMaxSize[k];
- const int colsLeft = columnsWithProperMaxSize.count() - k;
+ const int colsLeft = columnsWithProperMaxSize.size() - k;
const QFixed w = qMin(td->maxWidths.at(col) - td->widths.at(col), remainingWidth / colsLeft);
td->widths[col] += w;
remainingWidth -= w;
@@ -2665,14 +2649,14 @@ recalc_minmax_widths:
bool haveRowSpannedCells = false;
// need to keep track of cell heights for vertical alignment
- QVector<QFixed> cellHeights;
+ QList<QFixed> cellHeights;
cellHeights.reserve(rows * columns);
QFixed pageHeight = QFixed::fromReal(document->pageSize().height());
if (pageHeight <= 0)
pageHeight = QFIXED_MAX;
- QVector<QFixed> heightToDistribute;
+ QList<QFixed> heightToDistribute;
heightToDistribute.resize(columns);
td->headerHeight = 0;
@@ -2908,7 +2892,7 @@ void QTextDocumentLayoutPrivate::positionFloat(QTextFrame *frame, QTextLine *cur
// If the frame is a table, then positioning it will affect the size if it covers more than
// one page, because of page breaks and repeating the header.
- if (qobject_cast<QTextTable *>(frame) != 0)
+ if (qobject_cast<QTextTable *>(frame) != nullptr)
fd->sizeDirty = frameSpansIntoNextPage;
}
@@ -3092,7 +3076,7 @@ void QTextDocumentLayoutPrivate::layoutFlow(QTextFrame::Iterator it, QTextLayout
bool redoCheckPoints = layoutStruct->fullLayout || checkPoints.isEmpty();
if (!redoCheckPoints) {
- QVector<QCheckPoint>::Iterator checkPoint = std::lower_bound(checkPoints.begin(), checkPoints.end(), layoutFrom);
+ auto checkPoint = std::lower_bound(checkPoints.begin(), checkPoints.end(), layoutFrom);
if (checkPoint != checkPoints.end()) {
if (checkPoint != checkPoints.begin())
--checkPoint;
@@ -3136,7 +3120,7 @@ void QTextDocumentLayoutPrivate::layoutFlow(QTextFrame::Iterator it, QTextLayout
QTextBlockFormat previousBlockFormat = previousIt.currentBlock().blockFormat();
QFixed maximumBlockWidth = 0;
- while (!it.atEnd()) {
+ while (!it.atEnd() && layoutStruct->absoluteY() < QFIXED_MAX) {
QTextFrame *c = it.currentFrame();
int docPos;
@@ -3373,7 +3357,7 @@ void QTextDocumentLayoutPrivate::layoutFlow(QTextFrame::Iterator it, QTextLayout
// and not per cell and layoutCell already takes care of doing the same as we do here
if (!qobject_cast<QTextTable *>(layoutStruct->frame)) {
QList<QTextFrame *> children = layoutStruct->frame->childFrames();
- for (int i = 0; i < children.count(); ++i) {
+ for (int i = 0; i < children.size(); ++i) {
QTextFrameData *fd = data(children.at(i));
if (!fd->layoutDirty && children.at(i)->frameFormat().position() != QTextFrameFormat::InFlow)
layoutStruct->y = qMax(layoutStruct->y, fd->position.y + fd->size.height);
@@ -3386,7 +3370,7 @@ void QTextDocumentLayoutPrivate::layoutFlow(QTextFrame::Iterator it, QTextLayout
if (!fd->floats.isEmpty())
contentHasAlignment = true;
- if (it.atEnd()) {
+ if (it.atEnd() || layoutStruct->absoluteY() >= QFIXED_MAX) {
//qDebug("layout done!");
currentLazyLayoutPosition = -1;
QCheckPoint cp;
@@ -3400,7 +3384,7 @@ void QTextDocumentLayoutPrivate::layoutFlow(QTextFrame::Iterator it, QTextLayout
} else {
currentLazyLayoutPosition = checkPoints.constLast().positionInFrame;
// #######
- //checkPoints.last().positionInFrame = q->document()->docHandle()->length();
+ //checkPoints.last().positionInFrame = QTextDocumentPrivate::get(q->document())->length();
}
}
@@ -3411,19 +3395,21 @@ void QTextDocumentLayoutPrivate::layoutFlow(QTextFrame::Iterator it, QTextLayout
static inline void getLineHeightParams(const QTextBlockFormat &blockFormat, const QTextLine &line, qreal scaling,
QFixed *lineAdjustment, QFixed *lineBreakHeight, QFixed *lineHeight, QFixed *lineBottom)
{
+ const qreal height = line.height();
+ const int lineHeightType = blockFormat.lineHeightType();
qreal rawHeight = qCeil(line.ascent() + line.descent() + line.leading());
*lineHeight = QFixed::fromReal(blockFormat.lineHeight(rawHeight, scaling));
- *lineBottom = QFixed::fromReal(blockFormat.lineHeight(line.height(), scaling));
+ *lineBottom = QFixed::fromReal(blockFormat.lineHeight(height, scaling));
- if (blockFormat.lineHeightType() == QTextBlockFormat::FixedHeight || blockFormat.lineHeightType() == QTextBlockFormat::MinimumHeight) {
+ if (lineHeightType == QTextBlockFormat::FixedHeight || lineHeightType == QTextBlockFormat::MinimumHeight) {
*lineBreakHeight = *lineBottom;
- if (blockFormat.lineHeightType() == QTextBlockFormat::FixedHeight)
+ if (lineHeightType == QTextBlockFormat::FixedHeight)
*lineAdjustment = QFixed::fromReal(line.ascent() + qMax(line.leading(), qreal(0.0))) - ((*lineHeight * 4) / 5);
else
- *lineAdjustment = QFixed::fromReal(line.height()) - *lineHeight;
+ *lineAdjustment = QFixed::fromReal(height) - *lineHeight;
}
else {
- *lineBreakHeight = QFixed::fromReal(line.height());
+ *lineBreakHeight = QFixed::fromReal(height);
*lineAdjustment = 0;
}
}
@@ -3456,7 +3442,7 @@ void QTextDocumentLayoutPrivate::layoutBlock(const QTextBlock &bl, int blockPosi
QFixed extraMargin;
if (docPrivate->defaultTextOption.flags() & QTextOption::AddSpaceForLineAndParagraphSeparators) {
QFontMetricsF fm(bl.charFormat().font());
- extraMargin = QFixed::fromReal(fm.horizontalAdvance(QChar(QChar(0x21B5))));
+ extraMargin = QFixed::fromReal(fm.horizontalAdvance(u'\x21B5'));
}
const QFixed indent = this->blockIndent(blockFormat);
@@ -3570,6 +3556,11 @@ void QTextDocumentLayoutPrivate::layoutBlock(const QTextBlock &bl, int blockPosi
while (layoutStruct->pageHeight > 0 && layoutStruct->absoluteY() + lineBreakHeight > layoutStruct->pageBottom &&
layoutStruct->contentHeight() >= lineBreakHeight) {
+ if (layoutStruct->pageHeight == QFIXED_MAX) {
+ layoutStruct->y = QFIXED_MAX - layoutStruct->frameY;
+ break;
+ }
+
layoutStruct->newPage();
floatMargins(layoutStruct->y, layoutStruct, &left, &right);
@@ -3653,7 +3644,7 @@ void QTextDocumentLayoutPrivate::layoutBlock(const QTextBlock &bl, int blockPosi
}
}
-void QTextDocumentLayoutPrivate::floatMargins(const QFixed &y, const QTextLayoutStruct *layoutStruct,
+void QTextDocumentLayoutPrivate::floatMargins(QFixed y, const QTextLayoutStruct *layoutStruct,
QFixed *left, QFixed *right) const
{
// qDebug() << "floatMargins y=" << y;
@@ -3717,7 +3708,7 @@ void QTextDocumentLayout::draw(QPainter *painter, const PaintContext &context)
QTextFrame *frame = d->document->rootFrame();
QTextFrameData *fd = data(frame);
- if(fd->sizeDirty)
+ if (fd->sizeDirty)
return;
if (context.clip.isValid()) {
@@ -3754,11 +3745,7 @@ static void markFrames(QTextFrame *current, int from, int oldLength, int length)
QTextFrameData *fd = data(current);
// float got removed in editing operation
- QTextFrame *null = nullptr; // work-around for (at least) MSVC 2012 emitting
- // warning C4100 for its own header <algorithm>
- // when passing nullptr directly to std::remove
- fd->floats.erase(std::remove(fd->floats.begin(), fd->floats.end(), null),
- fd->floats.end());
+ fd->floats.removeAll(nullptr);
fd->layoutDirty = true;
fd->sizeDirty = true;
@@ -3780,7 +3767,7 @@ void QTextDocumentLayout::documentChanged(int from, int oldLength, int length)
for (; blockIt.isValid() && blockIt != endIt; blockIt = blockIt.next())
blockIt.clearLayout();
- if (d->docPrivate->pageSize.isNull())
+ if (!d->docPrivate->canLayout())
return;
QRectF updateRect;
@@ -3847,7 +3834,7 @@ QRectF QTextDocumentLayout::doLayout(int from, int oldLength, int length)
QRectF updateRect;
QTextFrame *root = d->docPrivate->rootFrame();
- if(data(root)->sizeDirty)
+ if (data(root)->sizeDirty)
updateRect = d->layoutFrame(root, from, from + length);
data(root)->layoutDirty = false;
@@ -3876,7 +3863,7 @@ int QTextDocumentLayout::hitTest(const QPointF &point, Qt::HitTestAccuracy accur
// ensure we stay within document bounds
int lastPos = f->lastPosition();
if (l && !l->preeditAreaText().isEmpty())
- lastPos += l->preeditAreaText().length();
+ lastPos += l->preeditAreaText().size();
if (position > lastPos)
position = lastPos;
else if (position < 0)
@@ -4058,7 +4045,7 @@ QRectF QTextDocumentLayout::tableCellBoundingRect(QTextTable *table, const QText
QRectF QTextDocumentLayout::tableBoundingRect(QTextTable *table) const
{
Q_D(const QTextDocumentLayout);
- if (d->docPrivate->pageSize.isNull())
+ if (!d->docPrivate->canLayout())
return QRectF();
d->ensureLayoutFinished();
@@ -4085,7 +4072,7 @@ QRectF QTextDocumentLayout::tableBoundingRect(QTextTable *table) const
QRectF QTextDocumentLayout::frameBoundingRect(QTextFrame *frame) const
{
Q_D(const QTextDocumentLayout);
- if (d->docPrivate->pageSize.isNull())
+ if (!d->docPrivate->canLayout())
return QRectF();
d->ensureLayoutFinished();
return d->frameBoundingRectInternal(frame);
@@ -4114,7 +4101,7 @@ QRectF QTextDocumentLayoutPrivate::frameBoundingRectInternal(QTextFrame *frame)
QRectF QTextDocumentLayout::blockBoundingRect(const QTextBlock &block) const
{
Q_D(const QTextDocumentLayout);
- if (d->docPrivate->pageSize.isNull() || !block.isValid() || !block.isVisible())
+ if (!d->docPrivate->canLayout() || !block.isValid() || !block.isVisible())
return QRectF();
d->ensureLayoutedByPosition(block.position() + block.length());
QTextFrame *frame = d->document->frameAt(block.position());
@@ -4146,7 +4133,7 @@ int QTextDocumentLayout::layoutStatus() const
int pos = d->currentLazyLayoutPosition;
if (pos == -1)
return 100;
- return pos * 100 / d->document->docHandle()->length();
+ return pos * 100 / QTextDocumentPrivate::get(d->document)->length();
}
void QTextDocumentLayout::timerEvent(QTimerEvent *e)
diff --git a/src/gui/text/qtextdocumentlayout_p.h b/src/gui/text/qtextdocumentlayout_p.h
index 2054ebaa35..9f21d8ed39 100644
--- a/src/gui/text/qtextdocumentlayout_p.h
+++ b/src/gui/text/qtextdocumentlayout_p.h
@@ -1,41 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the QtGui module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#ifndef QTEXTDOCUMENTLAYOUT_P_H
#define QTEXTDOCUMENTLAYOUT_P_H
diff --git a/src/gui/text/qtextdocumentwriter.cpp b/src/gui/text/qtextdocumentwriter.cpp
index 0bafa5d9ff..55f8414bd5 100644
--- a/src/gui/text/qtextdocumentwriter.cpp
+++ b/src/gui/text/qtextdocumentwriter.cpp
@@ -1,49 +1,10 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the QtGui module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#include "qtextdocumentwriter.h"
#include <QtCore/qfile.h>
#include <QtCore/qbytearray.h>
#include <QtCore/qfileinfo.h>
-#if QT_CONFIG(textcodec)
-#include <QtCore/qtextcodec.h>
-#endif
#include <QtCore/qtextstream.h>
#include <QtCore/qdebug.h>
#include "qtextdocument.h"
@@ -68,9 +29,6 @@ public:
QByteArray format;
QIODevice *device;
bool deleteDevice;
-#if QT_CONFIG(textcodec)
- QTextCodec *codec;
-#endif
QTextDocumentWriter *q;
};
@@ -83,7 +41,6 @@ public:
\inmodule QtGui
\ingroup richtext-processing
- \ingroup io
To write a document, construct a QTextDocumentWriter object with either a
file name or a device object, and specify the document format to be
@@ -109,9 +66,6 @@ public:
QTextDocumentWriterPrivate::QTextDocumentWriterPrivate(QTextDocumentWriter *qq)
: device(nullptr),
deleteDevice(false),
-#if QT_CONFIG(textcodec)
- codec(QTextCodec::codecForName("utf-8")),
-#endif
q(qq)
{
}
@@ -191,7 +145,7 @@ QByteArray QTextDocumentWriter::format () const
unchanged.
If the device is not already open, QTextDocumentWriter will attempt to
- open the device in \l QIODevice::WriteOnly mode by calling open().
+ open the device in \l {QIODeviceBase::}{WriteOnly} mode by calling open().
\note This will not work for certain devices, such as QProcess,
QTcpSocket and QUdpSocket, where some configuration is required before
@@ -220,7 +174,8 @@ QIODevice *QTextDocumentWriter::device () const
/*!
Sets the name of the file to be written to \a fileName. Internally,
QTextDocumentWriter will create a QFile and open it in \l
- QIODevice::WriteOnly mode, and use this file when writing the document.
+ {QIODeviceBase::}{WriteOnly} mode, and use this file when writing the
+ document.
\sa fileName(), setDevice()
*/
@@ -249,9 +204,11 @@ QString QTextDocumentWriter::fileName () const
*/
bool QTextDocumentWriter::write(const QTextDocument *document)
{
- QByteArray suffix;
+ if (!d->device)
+ return false;
- if (d->device && d->format.isEmpty()) {
+ QByteArray suffix;
+ if (d->format.isEmpty()) {
// if there's no format, see if device is a file, and if so, find
// the file suffix
if (QFile *file = qobject_cast<QFile *>(d->device))
@@ -263,9 +220,6 @@ bool QTextDocumentWriter::write(const QTextDocument *document)
#ifndef QT_NO_TEXTODFWRITER
if (format == "odf" || format == "opendocumentformat" || format == "odt") {
QTextOdfWriter writer(*document, d->device);
-#if QT_CONFIG(textcodec)
- writer.setCodec(d->codec);
-#endif
return writer.writeAll();
}
#endif // QT_NO_TEXTODFWRITER
@@ -288,11 +242,7 @@ bool QTextDocumentWriter::write(const QTextDocument *document)
qWarning("QTextDocumentWriter::write: the device cannot be opened for writing");
return false;
}
- QTextStream ts(d->device);
-#if QT_CONFIG(textcodec)
- ts.setCodec(d->codec);
- ts << document->toHtml(d->codec->name());
-#endif
+ d->device->write(document->toHtml().toUtf8());
d->device->close();
return true;
}
@@ -302,11 +252,7 @@ bool QTextDocumentWriter::write(const QTextDocument *document)
qWarning("QTextDocumentWriter::write: the device cannot be opened for writing");
return false;
}
- QTextStream ts(d->device);
-#if QT_CONFIG(textcodec)
- ts.setCodec(d->codec);
-#endif
- ts << document->toPlainText();
+ d->device->write(document->toPlainText().toUtf8());
d->device->close();
return true;
}
@@ -329,32 +275,6 @@ bool QTextDocumentWriter::write(const QTextDocumentFragment &fragment)
}
/*!
- Sets the codec for this stream to \a codec. The codec is used for
- encoding any data that is written. By default, QTextDocumentWriter
- uses UTF-8.
-*/
-
-#if QT_CONFIG(textcodec)
-void QTextDocumentWriter::setCodec(QTextCodec *codec)
-{
- if (codec == nullptr)
- codec = QTextCodec::codecForName("UTF-8");
- Q_ASSERT(codec);
- d->codec = codec;
-}
-#endif
-
-/*!
- Returns the codec that is currently assigned to the writer.
-*/
-#if QT_CONFIG(textcodec)
-QTextCodec *QTextDocumentWriter::codec() const
-{
- return d->codec;
-}
-#endif
-
-/*!
Returns the list of document formats supported by QTextDocumentWriter.
By default, Qt can write the following formats:
diff --git a/src/gui/text/qtextdocumentwriter.h b/src/gui/text/qtextdocumentwriter.h
index 4a57b181b4..c52c681f7d 100644
--- a/src/gui/text/qtextdocumentwriter.h
+++ b/src/gui/text/qtextdocumentwriter.h
@@ -1,41 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the QtGui module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#ifndef QTEXTDOCUMENTWRITER_H
#define QTEXTDOCUMENTWRITER_H
@@ -70,11 +34,6 @@ public:
bool write(const QTextDocument *document);
bool write(const QTextDocumentFragment &fragment);
-#if QT_CONFIG(textcodec)
- void setCodec(QTextCodec *codec);
- QTextCodec *codec() const;
-#endif
-
static QList<QByteArray> supportedDocumentFormats();
private:
diff --git a/src/gui/text/qtextengine.cpp b/src/gui/text/qtextengine.cpp
index 0024f070ea..08512bead5 100644
--- a/src/gui/text/qtextengine.cpp
+++ b/src/gui/text/qtextengine.cpp
@@ -1,41 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the QtGui module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2021 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#include <QtGui/private/qtguiglobal_p.h>
#include "qdebug.h"
@@ -43,6 +7,7 @@
#include "qtextformat_p.h"
#include "qtextengine_p.h"
#include "qabstracttextdocumentlayout.h"
+#include "qabstracttextdocumentlayout_p.h"
#include "qtextlayout.h"
#include "qtextboundaryfinder.h"
#include <QtCore/private/qunicodetables_p.h>
@@ -71,24 +36,19 @@ public:
Itemizer(const QString &string, const QScriptAnalysis *analysis, QScriptItemArray &items)
: m_string(string),
m_analysis(analysis),
- m_items(items),
- m_splitter(nullptr)
+ m_items(items)
{
}
- ~Itemizer()
- {
- delete m_splitter;
- }
-
+ ~Itemizer() = default;
/// generate the script items
- /// The caps parameter is used to choose the algoritm of splitting text and assiging roles to the textitems
+ /// The caps parameter is used to choose the algorithm of splitting text and assigning roles to the textitems
void generate(int start, int length, QFont::Capitalization caps)
{
if (caps == QFont::SmallCaps)
generateScriptItemsSmallCaps(reinterpret_cast<const ushort *>(m_string.unicode()), start, length);
- else if(caps == QFont::Capitalize)
+ else if (caps == QFont::Capitalize)
generateScriptItemsCapitalize(start, length);
- else if(caps != QFont::MixedCase) {
+ else if (caps != QFont::MixedCase) {
generateScriptItemsAndChangeCase(start, length,
caps == QFont::AllLowercase ? QScriptAnalysis::Lowercase : QScriptAnalysis::Uppercase);
}
@@ -120,7 +80,7 @@ private:
for (int i = start + 1; i < end; ++i) {
if (m_analysis[i].bidiLevel == m_analysis[start].bidiLevel
&& m_analysis[i].flags == m_analysis[start].flags
- && (m_analysis[i].script == m_analysis[start].script || m_string[i] == QLatin1Char('.'))
+ && (m_analysis[i].script == m_analysis[start].script || m_string[i] == u'.')
&& m_analysis[i].flags < QScriptAnalysis::SpaceTabOrObject
&& i - start < MaxItemLength)
continue;
@@ -136,8 +96,8 @@ private:
return;
if (!m_splitter)
- m_splitter = new QTextBoundaryFinder(QTextBoundaryFinder::Word,
- m_string.constData(), m_string.length(),
+ m_splitter = std::make_unique<QTextBoundaryFinder>(QTextBoundaryFinder::Word,
+ m_string.constData(), m_string.size(),
/*buffer*/nullptr, /*buffer size*/0);
m_splitter->setPosition(start);
@@ -206,7 +166,7 @@ private:
const QString &m_string;
const QScriptAnalysis * const m_analysis;
QScriptItemArray &m_items;
- QTextBoundaryFinder *m_splitter;
+ std::unique_ptr<QTextBoundaryFinder> m_splitter;
};
// -----------------------------------------------------------------------------------------------------
@@ -257,8 +217,8 @@ struct QBidiAlgorithm {
// load directions of string, and determine isolate pairs
for (int i = 0; i < length; ++i) {
int pos = i;
- uint uc = text[i].unicode();
- if (QChar::isHighSurrogate(uc) && i < length - 1) {
+ char32_t uc = text[i].unicode();
+ if (QChar::isHighSurrogate(uc) && i < length - 1 && text[i + 1].isLowSurrogate()) {
++i;
analysis[i].bidiDirection = QChar::DirNSM;
uc = QChar::surrogateToUcs4(ushort(uc), text[i].unicode());
@@ -712,9 +672,8 @@ struct QBidiAlgorithm {
analysis[pos].bidiDirection = QChar::DirEN;
++it;
}
- } else {
- lastETPosition.clear();
}
+ lastETPosition.clear();
}
last = current;
lastPos = pos;
@@ -830,7 +789,7 @@ struct QBidiAlgorithm {
int pos = *it;
QChar::Direction dir = analysis[pos].bidiDirection;
if (dir == QChar::DirON) {
- const QUnicodeTables::Properties *p = QUnicodeTables::properties(text[pos].unicode());
+ const QUnicodeTables::Properties *p = QUnicodeTables::properties(char16_t{text[pos].unicode()});
if (p->mirrorDiff) {
// either opening or closing bracket
if (p->category == QChar::Punctuation_Open) {
@@ -1193,7 +1152,7 @@ void QTextEngine::bidiReorder(int numItems, const quint8 *levels, int *visualOrd
// reverse any contiguous sequence of characters that are at that level or higher.
// reversing is only done up to the lowest odd level
- if(!(levelLow%2)) levelLow++;
+ if (!(levelLow%2)) levelLow++;
BIDI_DEBUG() << "reorderLine: lineLow = " << (uint)levelLow << ", lineHigh = " << (uint)levelHigh;
@@ -1209,7 +1168,7 @@ void QTextEngine::bidiReorder(int numItems, const quint8 *levels, int *visualOrd
while(i <= count && levels[i] >= levelHigh) i++;
int end = i-1;
- if(start != end) {
+ if (start != end) {
//qDebug() << "reversing from " << start << " to " << end;
for(int j = 0; j < (end-start+1)/2; j++) {
int tmp = visualOrder[start+j];
@@ -1248,9 +1207,9 @@ enum JustificationClass {
Adds an inter character justification opportunity after the number or letter
character and a space justification opportunity after the space character.
*/
-static inline void qt_getDefaultJustificationOpportunities(const ushort *string, int length, const QGlyphLayout &g, ushort *log_clusters, int spaceAs)
+static inline void qt_getDefaultJustificationOpportunities(const ushort *string, qsizetype length, const QGlyphLayout &g, ushort *log_clusters, int spaceAs)
{
- int str_pos = 0;
+ qsizetype str_pos = 0;
while (str_pos < length) {
int glyph_pos = log_clusters[str_pos];
@@ -1282,7 +1241,7 @@ static inline void qt_getDefaultJustificationOpportunities(const ushort *string,
}
}
-static inline void qt_getJustificationOpportunities(const ushort *string, int length, const QScriptItem &si, const QGlyphLayout &g, ushort *log_clusters)
+static inline void qt_getJustificationOpportunities(const ushort *string, qsizetype length, const QScriptItem &si, const QGlyphLayout &g, ushort *log_clusters)
{
Q_ASSERT(length > 0 && g.numGlyphs > 0);
@@ -1355,9 +1314,42 @@ void QTextEngine::shapeLine(const QScriptLine &line)
}
}
-#if QT_CONFIG(harfbuzz)
-extern bool qt_useHarfbuzzNG(); // defined in qfontengine.cpp
-#endif
+static void applyVisibilityRules(ushort ucs, QGlyphLayout *glyphs, uint glyphPosition, QFontEngine *fontEngine)
+{
+ // hide characters that should normally be invisible
+ switch (ucs) {
+ case QChar::LineFeed:
+ case 0x000c: // FormFeed
+ case QChar::CarriageReturn:
+ case QChar::LineSeparator:
+ case QChar::ParagraphSeparator:
+ glyphs->attributes[glyphPosition].dontPrint = true;
+ break;
+ case QChar::SoftHyphen:
+ if (!fontEngine->symbol) {
+ // U+00AD [SOFT HYPHEN] is a default ignorable codepoint,
+ // so we replace its glyph and metrics with ones for
+ // U+002D [HYPHEN-MINUS] or U+2010 [HYPHEN] and make
+ // it visible if it appears at line-break
+ const uint engineIndex = glyphs->glyphs[glyphPosition] & 0xff000000;
+ glyph_t glyph = fontEngine->glyphIndex(0x002d);
+ if (glyph == 0)
+ glyph = fontEngine->glyphIndex(0x2010);
+ if (glyph == 0)
+ glyph = fontEngine->glyphIndex(0x00ad);
+ glyphs->glyphs[glyphPosition] = glyph;
+ if (Q_LIKELY(glyphs->glyphs[glyphPosition] != 0)) {
+ glyphs->glyphs[glyphPosition] |= engineIndex;
+ QGlyphLayout tmp = glyphs->mid(glyphPosition, 1);
+ fontEngine->recalcAdvances(&tmp, { });
+ }
+ glyphs->attributes[glyphPosition].dontPrint = true;
+ }
+ break;
+ default:
+ break;
+ }
+}
void QTextEngine::shapeText(int item) const
{
@@ -1399,36 +1391,44 @@ void QTextEngine::shapeText(int item) const
}
if (Q_UNLIKELY(!ensureSpace(itemLength))) {
- Q_UNREACHABLE(); // ### report OOM error somehow
- return;
+ Q_UNREACHABLE_RETURN(); // ### report OOM error somehow
}
QFontEngine *fontEngine = this->fontEngine(si, &si.ascent, &si.descent, &si.leading);
+#if QT_CONFIG(harfbuzz)
bool kerningEnabled;
+#endif
bool letterSpacingIsAbsolute;
- bool shapingEnabled;
+ bool shapingEnabled = false;
+ QHash<QFont::Tag, quint32> features;
QFixed letterSpacing, wordSpacing;
#ifndef QT_NO_RAWFONT
if (useRawFont) {
QTextCharFormat f = format(&si);
QFont font = f.font();
+# if QT_CONFIG(harfbuzz)
kerningEnabled = font.kerning();
shapingEnabled = QFontEngine::scriptRequiresOpenType(QChar::Script(si.analysis.script))
|| (font.styleStrategy() & QFont::PreferNoShaping) == 0;
+# endif
wordSpacing = QFixed::fromReal(font.wordSpacing());
letterSpacing = QFixed::fromReal(font.letterSpacing());
letterSpacingIsAbsolute = true;
+ features = font.d->features;
} else
#endif
{
QFont font = this->font(si);
+#if QT_CONFIG(harfbuzz)
kerningEnabled = font.d->kerning;
shapingEnabled = QFontEngine::scriptRequiresOpenType(QChar::Script(si.analysis.script))
|| (font.d->request.styleStrategy & QFont::PreferNoShaping) == 0;
+#endif
letterSpacingIsAbsolute = font.d->letterSpacingIsAbsolute;
letterSpacing = font.d->letterSpacing;
wordSpacing = font.d->wordSpacing;
+ features = font.d->features;
if (letterSpacingIsAbsolute && letterSpacing.value())
letterSpacing *= font.d->dpi / qt_defaultDpiY();
@@ -1436,8 +1436,7 @@ void QTextEngine::shapeText(int item) const
// split up the item into parts that come from different font engines
// k * 3 entries, array[k] == index in string, array[k + 1] == index in glyphs, array[k + 2] == engine index
- QVector<uint> itemBoundaries;
- itemBoundaries.reserve(24);
+ QVarLengthArray<uint, 24> itemBoundaries;
QGlyphLayout initialGlyphs = availableGlyphs(&si);
int nGlyphs = initialGlyphs.numGlyphs;
@@ -1448,7 +1447,7 @@ void QTextEngine::shapeText(int item) const
shapingEnabled
? QFontEngine::GlyphIndicesOnly
: QFontEngine::ShaperFlag(0);
- if (!fontEngine->stringToCMap(reinterpret_cast<const QChar *>(string), itemLength, &initialGlyphs, &nGlyphs, shaperFlags))
+ if (fontEngine->stringToCMap(reinterpret_cast<const QChar *>(string), itemLength, &initialGlyphs, &nGlyphs, shaperFlags) < 0)
Q_UNREACHABLE();
}
@@ -1457,9 +1456,9 @@ void QTextEngine::shapeText(int item) const
for (int i = 0, glyph_pos = 0; i < itemLength; ++i, ++glyph_pos) {
const uint engineIdx = initialGlyphs.glyphs[glyph_pos] >> 24;
if (lastEngine != engineIdx) {
- itemBoundaries.append(i);
- itemBoundaries.append(glyph_pos);
- itemBoundaries.append(engineIdx);
+ itemBoundaries.push_back(i);
+ itemBoundaries.push_back(glyph_pos);
+ itemBoundaries.push_back(engineIdx);
if (engineIdx != 0) {
QFontEngine *actualFontEngine = static_cast<QFontEngineMulti *>(fontEngine)->engine(engineIdx);
@@ -1475,12 +1474,24 @@ void QTextEngine::shapeText(int item) const
++i;
}
} else {
- itemBoundaries.append(0);
- itemBoundaries.append(0);
- itemBoundaries.append(0);
+ itemBoundaries.push_back(0);
+ itemBoundaries.push_back(0);
+ itemBoundaries.push_back(0);
}
- if (Q_UNLIKELY(!shapingEnabled)) {
+#if QT_CONFIG(harfbuzz)
+ if (Q_LIKELY(shapingEnabled)) {
+ si.num_glyphs = shapeTextWithHarfbuzzNG(si,
+ string,
+ itemLength,
+ fontEngine,
+ itemBoundaries,
+ kerningEnabled,
+ letterSpacing != 0,
+ features);
+ } else
+#endif
+ {
ushort *log_clusters = logClusters(&si);
int glyph_pos = 0;
@@ -1490,32 +1501,54 @@ void QTextEngine::shapeText(int item) const
if (QChar::isHighSurrogate(string[i])
&& i + 1 < itemLength
&& QChar::isLowSurrogate(string[i + 1])) {
+ initialGlyphs.attributes[glyph_pos].dontPrint = !QChar::isPrint(QChar::surrogateToUcs4(string[i], string[i + 1]));
++i;
log_clusters[i] = glyph_pos;
+
+ } else {
+ initialGlyphs.attributes[glyph_pos].dontPrint = !QChar::isPrint(string[i]);
+ }
+
+ if (Q_UNLIKELY(!initialGlyphs.attributes[glyph_pos].dontPrint)) {
+ QFontEngine *actualFontEngine = fontEngine;
+ if (actualFontEngine->type() == QFontEngine::Multi) {
+ const uint engineIdx = initialGlyphs.glyphs[glyph_pos] >> 24;
+ actualFontEngine = static_cast<QFontEngineMulti *>(fontEngine)->engine(engineIdx);
+ }
+
+ applyVisibilityRules(string[i], &initialGlyphs, glyph_pos, actualFontEngine);
}
}
si.num_glyphs = glyph_pos;
-#if QT_CONFIG(harfbuzz)
- } else if (Q_LIKELY(qt_useHarfbuzzNG())) {
- si.num_glyphs = shapeTextWithHarfbuzzNG(si, string, itemLength, fontEngine, itemBoundaries, kerningEnabled, letterSpacing != 0);
-#endif
- } else {
- si.num_glyphs = shapeTextWithHarfbuzz(si, string, itemLength, fontEngine, itemBoundaries, kerningEnabled);
}
+
if (Q_UNLIKELY(si.num_glyphs == 0)) {
- Q_UNREACHABLE(); // ### report shaping errors somehow
+ if (Q_UNLIKELY(!ensureSpace(si.glyph_data_offset + 1))) {
+ qWarning() << "Unable to allocate space for place-holder glyph";
+ return;
+ }
+
+ si.num_glyphs = 1;
+
+ // Overwrite with 0 token to indicate failure
+ QGlyphLayout g = availableGlyphs(&si);
+ g.glyphs[0] = 0;
+ g.attributes[0].clusterStart = true;
+
+ ushort *log_clusters = logClusters(&si);
+ for (int i = 0; i < itemLength; ++i)
+ log_clusters[i] = 0;
+
return;
}
-
layoutData->used += si.num_glyphs;
QGlyphLayout glyphs = shapedGlyphs(&si);
#if QT_CONFIG(harfbuzz)
- if (Q_LIKELY(qt_useHarfbuzzNG()))
- qt_getJustificationOpportunities(string, itemLength, si, glyphs, logClusters(&si));
+ qt_getJustificationOpportunities(string, itemLength, si, glyphs, logClusters(&si));
#endif
if (letterSpacing != 0) {
@@ -1565,9 +1598,10 @@ int QTextEngine::shapeTextWithHarfbuzzNG(const QScriptItem &si,
const ushort *string,
int itemLength,
QFontEngine *fontEngine,
- const QVector<uint> &itemBoundaries,
+ QSpan<uint> itemBoundaries,
bool kerningEnabled,
- bool hasLetterSpacing) const
+ bool hasLetterSpacing,
+ const QHash<QFont::Tag, quint32> &fontFeatures) const
{
uint glyphs_shaped = 0;
@@ -1583,9 +1617,10 @@ int QTextEngine::shapeTextWithHarfbuzzNG(const QScriptItem &si,
props.direction = si.analysis.bidiLevel % 2 ? HB_DIRECTION_RTL : HB_DIRECTION_LTR;
QChar::Script script = QChar::Script(si.analysis.script);
props.script = hb_qt_script_to_script(script);
- // ### props.language = hb_language_get_default_for_script(props.script);
+ // ### TODO get_default_for_script?
+ props.language = hb_language_get_default(); // use default language from locale
- for (int k = 0; k < itemBoundaries.size(); k += 3) {
+ for (qsizetype k = 0; k < itemBoundaries.size(); k += 3) {
const uint item_pos = itemBoundaries[k];
const uint item_length = (k + 4 < itemBoundaries.size() ? itemBoundaries[k + 3] : itemLength) - item_pos;
const uint engineIdx = itemBoundaries[k + 2];
@@ -1598,22 +1633,7 @@ int QTextEngine::shapeTextWithHarfbuzzNG(const QScriptItem &si,
hb_buffer_clear_contents(buffer);
hb_buffer_add_utf16(buffer, reinterpret_cast<const uint16_t *>(string) + item_pos, item_length, 0, item_length);
-#if defined(Q_OS_DARWIN)
- // ### temporary workaround for QTBUG-38113
- // CoreText throws away the PDF token, while the OpenType backend will replace it with
- // a zero-advance glyph. This becomes a real issue when PDF is the last character,
- // since it gets treated like if it were a grapheme extender, so we
- // temporarily replace it with some visible grapheme starter.
- bool endsWithPDF = actualFontEngine->type() == QFontEngine::Mac && string[item_pos + item_length - 1] == 0x202c;
- if (Q_UNLIKELY(endsWithPDF)) {
- uint num_glyphs;
- hb_glyph_info_t *infos = hb_buffer_get_glyph_infos(buffer, &num_glyphs);
- infos[num_glyphs - 1].codepoint = '.';
- }
-#endif
-
hb_buffer_set_segment_properties(buffer, &props);
- hb_buffer_guess_segment_properties(buffer);
uint buffer_flags = HB_BUFFER_FLAG_DEFAULT;
// Symbol encoding used to encode various crap in the 32..255 character code range,
@@ -1635,31 +1655,38 @@ int QTextEngine::shapeTextWithHarfbuzzNG(const QScriptItem &si,
|| script == QChar::Script_Khmer || script == QChar::Script_Nko);
bool dontLigate = hasLetterSpacing && !scriptRequiresOpenType;
- const hb_feature_t features[5] = {
- { HB_TAG('k','e','r','n'), !!kerningEnabled, 0, uint(-1) },
- { HB_TAG('l','i','g','a'), !dontLigate, 0, uint(-1) },
- { HB_TAG('c','l','i','g'), !dontLigate, 0, uint(-1) },
- { HB_TAG('d','l','i','g'), !dontLigate, 0, uint(-1) },
- { HB_TAG('h','l','i','g'), !dontLigate, 0, uint(-1) } };
- const int num_features = dontLigate ? 5 : 1;
-
- const char *const *shaper_list = nullptr;
-#if defined(Q_OS_DARWIN)
- // What's behind QFontEngine::FaceData::user_data isn't compatible between different font engines
- // - specifically functions in hb-coretext.cc would run into undefined behavior with data
- // from non-CoreText engine. The other shapers works with that engine just fine.
- if (actualFontEngine->type() != QFontEngine::Mac) {
- static const char *s_shaper_list_without_coretext[] = {
- "graphite2",
- "ot",
- "fallback",
- nullptr
- };
- shaper_list = s_shaper_list_without_coretext;
- }
-#endif
- bool shapedOk = hb_shape_full(hb_font, buffer, features, num_features, shaper_list);
+ QHash<QFont::Tag, quint32> features;
+ features.insert(QFont::Tag("kern"), !!kerningEnabled);
+ if (dontLigate) {
+ features.insert(QFont::Tag("liga"), false);
+ features.insert(QFont::Tag("clig"), false);
+ features.insert(QFont::Tag("dlig"), false);
+ features.insert(QFont::Tag("hlig"), false);
+ }
+ features.insert(fontFeatures);
+
+ QVarLengthArray<hb_feature_t, 16> featureArray;
+ for (auto it = features.constBegin(); it != features.constEnd(); ++it) {
+ featureArray.append({ it.key().value(),
+ it.value(),
+ HB_FEATURE_GLOBAL_START,
+ HB_FEATURE_GLOBAL_END });
+ }
+
+ // whitelist cross-platforms shapers only
+ static const char *shaper_list[] = {
+ "graphite2",
+ "ot",
+ "fallback",
+ nullptr
+ };
+
+ bool shapedOk = hb_shape_full(hb_font,
+ buffer,
+ featureArray.constData(),
+ features.size(),
+ shaper_list);
if (Q_UNLIKELY(!shapedOk)) {
hb_buffer_destroy(buffer);
return 0;
@@ -1669,9 +1696,14 @@ int QTextEngine::shapeTextWithHarfbuzzNG(const QScriptItem &si,
hb_buffer_reverse(buffer);
}
- const uint num_glyphs = hb_buffer_get_length(buffer);
+ uint num_glyphs = hb_buffer_get_length(buffer);
+ const bool has_glyphs = num_glyphs > 0;
+ // If Harfbuzz returns zero glyphs, we have to manually add a missing glyph
+ if (Q_UNLIKELY(!has_glyphs))
+ num_glyphs = 1;
+
// ensure we have enough space for shaped glyphs and metrics
- if (Q_UNLIKELY(num_glyphs == 0 || !ensureSpace(glyphs_shaped + num_glyphs))) {
+ if (Q_UNLIKELY(!ensureSpace(glyphs_shaped + num_glyphs))) {
hb_buffer_destroy(buffer);
return 0;
}
@@ -1679,92 +1711,55 @@ int QTextEngine::shapeTextWithHarfbuzzNG(const QScriptItem &si,
// fetch the shaped glyphs and metrics
QGlyphLayout g = availableGlyphs(&si).mid(glyphs_shaped, num_glyphs);
ushort *log_clusters = logClusters(&si) + item_pos;
-
- hb_glyph_info_t *infos = hb_buffer_get_glyph_infos(buffer, nullptr);
- hb_glyph_position_t *positions = hb_buffer_get_glyph_positions(buffer, nullptr);
- uint str_pos = 0;
- uint last_cluster = ~0u;
- uint last_glyph_pos = glyphs_shaped;
- for (uint i = 0; i < num_glyphs; ++i, ++infos, ++positions) {
- g.glyphs[i] = infos->codepoint;
-
- g.advances[i] = QFixed::fromFixed(positions->x_advance);
- g.offsets[i].x = QFixed::fromFixed(positions->x_offset);
- g.offsets[i].y = QFixed::fromFixed(positions->y_offset);
-
- uint cluster = infos->cluster;
- if (Q_LIKELY(last_cluster != cluster)) {
- g.attributes[i].clusterStart = true;
-
- // fix up clusters so that the cluster indices will be monotonic
- // and thus we never return out-of-order indices
- while (last_cluster++ < cluster && str_pos < item_length)
- log_clusters[str_pos++] = last_glyph_pos;
- last_glyph_pos = i + glyphs_shaped;
- last_cluster = cluster;
-
- // hide characters that should normally be invisible
- switch (string[item_pos + str_pos]) {
- case QChar::LineFeed:
- case 0x000c: // FormFeed
- case QChar::CarriageReturn:
- case QChar::LineSeparator:
- case QChar::ParagraphSeparator:
- g.attributes[i].dontPrint = true;
- break;
- case QChar::SoftHyphen:
- if (!actualFontEngine->symbol) {
- // U+00AD [SOFT HYPHEN] is a default ignorable codepoint,
- // so we replace its glyph and metrics with ones for
- // U+002D [HYPHEN-MINUS] and make it visible if it appears at line-break
- g.glyphs[i] = actualFontEngine->glyphIndex('-');
- if (Q_LIKELY(g.glyphs[i] != 0)) {
- QGlyphLayout tmp = g.mid(i, 1);
- actualFontEngine->recalcAdvances(&tmp, { });
- }
- g.attributes[i].dontPrint = true;
- }
- break;
- default:
- break;
+ if (Q_LIKELY(has_glyphs)) {
+ hb_glyph_info_t *infos = hb_buffer_get_glyph_infos(buffer, nullptr);
+ hb_glyph_position_t *positions = hb_buffer_get_glyph_positions(buffer, nullptr);
+ uint str_pos = 0;
+ uint last_cluster = ~0u;
+ uint last_glyph_pos = glyphs_shaped;
+ for (uint i = 0; i < num_glyphs; ++i, ++infos, ++positions) {
+ g.glyphs[i] = infos->codepoint;
+
+ g.advances[i] = QFixed::fromFixed(positions->x_advance);
+ g.offsets[i].x = QFixed::fromFixed(positions->x_offset);
+ g.offsets[i].y = QFixed::fromFixed(positions->y_offset);
+
+ uint cluster = infos->cluster;
+ if (Q_LIKELY(last_cluster != cluster)) {
+ g.attributes[i].clusterStart = true;
+
+ // fix up clusters so that the cluster indices will be monotonic
+ // and thus we never return out-of-order indices
+ while (last_cluster++ < cluster && str_pos < item_length)
+ log_clusters[str_pos++] = last_glyph_pos;
+ last_glyph_pos = i + glyphs_shaped;
+ last_cluster = cluster;
+
+ applyVisibilityRules(string[item_pos + str_pos], &g, i, actualFontEngine);
}
}
+ while (str_pos < item_length)
+ log_clusters[str_pos++] = last_glyph_pos;
+ } else { // Harfbuzz did not return a glyph for the character, so we add a placeholder
+ g.glyphs[0] = 0;
+ g.advances[0] = QFixed{};
+ g.offsets[0].x = QFixed{};
+ g.offsets[0].y = QFixed{};
+ g.attributes[0].clusterStart = true;
+ g.attributes[0].dontPrint = true;
+ log_clusters[0] = glyphs_shaped;
}
- while (str_pos < item_length)
- log_clusters[str_pos++] = last_glyph_pos;
-
-#if defined(Q_OS_DARWIN)
- if (Q_UNLIKELY(endsWithPDF)) {
- int last_glyph_idx = num_glyphs - 1;
- g.glyphs[last_glyph_idx] = 0xffff;
- g.advances[last_glyph_idx] = QFixed();
- g.offsets[last_glyph_idx].x = QFixed();
- g.offsets[last_glyph_idx].y = QFixed();
- g.attributes[last_glyph_idx].clusterStart = true;
- g.attributes[last_glyph_idx].dontPrint = true;
-
- log_clusters[item_length - 1] = glyphs_shaped + last_glyph_idx;
- }
-#endif
if (Q_UNLIKELY(engineIdx != 0)) {
for (quint32 i = 0; i < num_glyphs; ++i)
g.glyphs[i] |= (engineIdx << 24);
}
-#ifdef Q_OS_DARWIN
- if (actualFontEngine->type() == QFontEngine::Mac) {
- if (actualFontEngine->fontDef.stretch != 100 && actualFontEngine->fontDef.stretch != QFont::AnyStretch) {
- QFixed stretch = QFixed(int(actualFontEngine->fontDef.stretch)) / QFixed(100);
- for (uint i = 0; i < num_glyphs; ++i)
- g.advances[i] *= stretch;
- }
- }
-#endif
-
- if (!actualFontEngine->supportsSubPixelPositions() || (actualFontEngine->fontDef.styleStrategy & QFont::ForceIntegerMetrics)) {
- for (uint i = 0; i < num_glyphs; ++i)
+ if (!actualFontEngine->supportsHorizontalSubPixelPositions()) {
+ for (uint i = 0; i < num_glyphs; ++i) {
g.advances[i] = g.advances[i].round();
+ g.offsets[i].x = g.offsets[i].x.round();
+ }
}
glyphs_shaped += num_glyphs;
@@ -1777,138 +1772,6 @@ int QTextEngine::shapeTextWithHarfbuzzNG(const QScriptItem &si,
#endif // harfbuzz
-
-QT_BEGIN_INCLUDE_NAMESPACE
-
-#include <private/qharfbuzz_p.h>
-
-QT_END_INCLUDE_NAMESPACE
-
-Q_STATIC_ASSERT(sizeof(HB_Glyph) == sizeof(glyph_t));
-Q_STATIC_ASSERT(sizeof(HB_Fixed) == sizeof(QFixed));
-Q_STATIC_ASSERT(sizeof(HB_FixedPoint) == sizeof(QFixedPoint));
-
-static inline void moveGlyphData(const QGlyphLayout &destination, const QGlyphLayout &source, int num)
-{
- if (num > 0 && destination.glyphs != source.glyphs)
- memmove(destination.glyphs, source.glyphs, num * sizeof(glyph_t));
-}
-
-int QTextEngine::shapeTextWithHarfbuzz(const QScriptItem &si, const ushort *string, int itemLength, QFontEngine *fontEngine, const QVector<uint> &itemBoundaries, bool kerningEnabled) const
-{
- HB_ShaperItem entire_shaper_item;
- memset(&entire_shaper_item, 0, sizeof(entire_shaper_item));
- entire_shaper_item.string = reinterpret_cast<const HB_UChar16 *>(string);
- entire_shaper_item.stringLength = itemLength;
- entire_shaper_item.item.script = script_to_hbscript(si.analysis.script);
- entire_shaper_item.item.pos = 0;
- entire_shaper_item.item.length = itemLength;
- entire_shaper_item.item.bidiLevel = si.analysis.bidiLevel;
-
- entire_shaper_item.shaperFlags = 0;
- if (!kerningEnabled)
- entire_shaper_item.shaperFlags |= HB_ShaperFlag_NoKerning;
- if (option.useDesignMetrics())
- entire_shaper_item.shaperFlags |= HB_ShaperFlag_UseDesignMetrics;
-
- // ensure we are not asserting in HB_HeuristicSetGlyphAttributes()
- entire_shaper_item.num_glyphs = 0;
- for (int i = 0; i < itemLength; ++i, ++entire_shaper_item.num_glyphs) {
- if (QChar::isHighSurrogate(string[i]) && i + 1 < itemLength && QChar::isLowSurrogate(string[i + 1]))
- ++i;
- }
-
-
- int remaining_glyphs = entire_shaper_item.num_glyphs;
- int glyph_pos = 0;
- // for each item shape using harfbuzz and store the results in our layoutData's glyphs array.
- for (int k = 0; k < itemBoundaries.size(); k += 3) {
- HB_ShaperItem shaper_item = entire_shaper_item;
- shaper_item.item.pos = itemBoundaries[k];
- if (k + 4 < itemBoundaries.size()) {
- shaper_item.item.length = itemBoundaries[k + 3] - shaper_item.item.pos;
- shaper_item.num_glyphs = itemBoundaries[k + 4] - itemBoundaries[k + 1];
- } else { // last combo in the list, avoid out of bounds access.
- shaper_item.item.length -= shaper_item.item.pos - entire_shaper_item.item.pos;
- shaper_item.num_glyphs -= itemBoundaries[k + 1];
- }
- shaper_item.initialGlyphCount = shaper_item.num_glyphs;
- if (shaper_item.num_glyphs < shaper_item.item.length)
- shaper_item.num_glyphs = shaper_item.item.length;
-
- uint engineIdx = itemBoundaries[k + 2];
- QFontEngine *actualFontEngine = fontEngine;
- if (fontEngine->type() == QFontEngine::Multi) {
- actualFontEngine = static_cast<QFontEngineMulti *>(fontEngine)->engine(engineIdx);
-
- if ((si.analysis.bidiLevel % 2) == 0)
- shaper_item.glyphIndicesPresent = true;
- }
-
- shaper_item.font = (HB_Font)actualFontEngine->harfbuzzFont();
- shaper_item.face = (HB_Face)actualFontEngine->harfbuzzFace();
-
- remaining_glyphs -= shaper_item.initialGlyphCount;
-
- QVarLengthArray<HB_GlyphAttributes, 128> hbGlyphAttributes;
- do {
- if (!ensureSpace(glyph_pos + shaper_item.num_glyphs + remaining_glyphs))
- return 0;
- if (hbGlyphAttributes.size() < int(shaper_item.num_glyphs)) {
- hbGlyphAttributes.resize(shaper_item.num_glyphs);
- memset(hbGlyphAttributes.data(), 0, hbGlyphAttributes.size() * sizeof(HB_GlyphAttributes));
- }
-
- const QGlyphLayout g = availableGlyphs(&si).mid(glyph_pos);
- if (fontEngine->type() == QFontEngine::Multi && shaper_item.num_glyphs > shaper_item.item.length)
- moveGlyphData(g.mid(shaper_item.num_glyphs), g.mid(shaper_item.initialGlyphCount), remaining_glyphs);
-
- shaper_item.glyphs = reinterpret_cast<HB_Glyph *>(g.glyphs);
- shaper_item.advances = reinterpret_cast<HB_Fixed *>(g.advances);
- shaper_item.offsets = reinterpret_cast<HB_FixedPoint *>(g.offsets);
- shaper_item.attributes = hbGlyphAttributes.data();
-
- if (engineIdx != 0 && shaper_item.glyphIndicesPresent) {
- for (quint32 i = 0; i < shaper_item.initialGlyphCount; ++i)
- shaper_item.glyphs[i] &= 0x00ffffff;
- }
-
- shaper_item.log_clusters = logClusters(&si) + shaper_item.item.pos - entire_shaper_item.item.pos;
- } while (!qShapeItem(&shaper_item)); // this does the actual shaping via harfbuzz.
-
- QGlyphLayout g = availableGlyphs(&si).mid(glyph_pos, shaper_item.num_glyphs);
- if (fontEngine->type() == QFontEngine::Multi)
- moveGlyphData(g.mid(shaper_item.num_glyphs), g.mid(shaper_item.initialGlyphCount), remaining_glyphs);
-
- for (quint32 i = 0; i < shaper_item.num_glyphs; ++i) {
- HB_GlyphAttributes hbAttrs = hbGlyphAttributes.at(i);
- QGlyphAttributes &attrs = g.attributes[i];
- attrs.clusterStart = hbAttrs.clusterStart;
- attrs.dontPrint = hbAttrs.dontPrint;
- attrs.justification = hbAttrs.justification;
- }
-
- for (quint32 i = 0; i < shaper_item.item.length; ++i) {
- // Workaround wrong log_clusters for surrogates (i.e. QTBUG-39875)
- if (shaper_item.log_clusters[i] >= shaper_item.num_glyphs)
- shaper_item.log_clusters[i] = shaper_item.num_glyphs - 1;
- shaper_item.log_clusters[i] += glyph_pos;
- }
-
- if (kerningEnabled && !shaper_item.kerning_applied)
- actualFontEngine->doKerning(&g, option.useDesignMetrics() ? QFontEngine::DesignMetrics : QFontEngine::ShaperFlags{});
-
- if (engineIdx != 0) {
- for (quint32 i = 0; i < shaper_item.num_glyphs; ++i)
- g.glyphs[i] |= (engineIdx << 24);
- }
-
- glyph_pos += shaper_item.num_glyphs;
- }
-
- return glyph_pos;
-}
-
void QTextEngine::init(QTextEngine *e)
{
e->ignoreBidi = false;
@@ -1955,22 +1818,24 @@ const QCharAttributes *QTextEngine::attributes() const
return (QCharAttributes *) layoutData->memory;
itemize();
- if (! ensureSpace(layoutData->string.length()))
+ if (! ensureSpace(layoutData->string.size()))
return nullptr;
QVarLengthArray<QUnicodeTools::ScriptItem> scriptItems(layoutData->items.size());
for (int i = 0; i < layoutData->items.size(); ++i) {
const QScriptItem &si = layoutData->items.at(i);
scriptItems[i].position = si.position;
- scriptItems[i].script = si.analysis.script;
+ scriptItems[i].script = QChar::Script(si.analysis.script);
}
- QUnicodeTools::initCharAttributes(reinterpret_cast<const ushort *>(layoutData->string.constData()),
- layoutData->string.length(),
- scriptItems.data(), scriptItems.size(),
- (QCharAttributes *)layoutData->memory,
- QUnicodeTools::CharAttributeOptions(QUnicodeTools::DefaultOptionsCompat
- | QUnicodeTools::HangulLineBreakTailoring));
+ QUnicodeTools::initCharAttributes(
+ layoutData->string,
+ scriptItems.data(), scriptItems.size(),
+ reinterpret_cast<QCharAttributes *>(layoutData->memory),
+ QUnicodeTools::CharAttributeOptions(QUnicodeTools::GraphemeBreaks
+ | QUnicodeTools::LineBreaks
+ | QUnicodeTools::WhiteSpaces
+ | QUnicodeTools::HangulLineBreakTailoring));
layoutData->haveCharAttributes = true;
@@ -1982,7 +1847,7 @@ void QTextEngine::shape(int item) const
auto &li = layoutData->items[item];
if (li.analysis.flags == QScriptAnalysis::Object) {
ensureSpace(1);
- if (block.docHandle()) {
+ if (QTextDocumentPrivate::get(block) != nullptr) {
docLayout()->resizeInlineObject(QTextInlineObject(item, const_cast<QTextEngine *>(this)),
li.position + block.position(),
format(&li));
@@ -2038,13 +1903,13 @@ void QTextEngine::validate() const
if (layoutData)
return;
layoutData = new LayoutData();
- if (block.docHandle()) {
+ if (QTextDocumentPrivate::get(block) != nullptr) {
layoutData->string = block.text();
const bool nextBlockValid = block.next().isValid();
if (!nextBlockValid && option.flags() & QTextOption::ShowDocumentTerminator) {
- layoutData->string += QChar(0xA7);
+ layoutData->string += QLatin1Char('\xA7');
} else if (option.flags() & QTextOption::ShowLineAndParagraphSeparators) {
- layoutData->string += QLatin1Char(nextBlockValid ? 0xb6 : 0x20);
+ layoutData->string += QLatin1Char(nextBlockValid ? '\xB6' : '\x20');
}
} else {
@@ -2060,7 +1925,7 @@ void QTextEngine::itemize() const
if (layoutData->items.size())
return;
- int length = layoutData->string.length();
+ int length = layoutData->string.size();
if (!length)
return;
@@ -2075,10 +1940,14 @@ void QTextEngine::itemize() const
layoutData->hasBidi = bidi.process();
{
- QVarLengthArray<uchar> scripts(length);
- QUnicodeTools::initScripts(string, length, scripts.data());
- for (int i = 0; i < length; ++i)
- analysis[i].script = scripts.at(i);
+ QUnicodeTools::ScriptItemArray scriptItems;
+ QUnicodeTools::initScripts(layoutData->string, &scriptItems);
+ for (int i = 0; i < scriptItems.size(); ++i) {
+ const auto &item = scriptItems.at(i);
+ int end = i < scriptItems.size() - 1 ? scriptItems.at(i + 1).position : length;
+ for (int j = item.position; j < end; ++j)
+ analysis[j].script = item.script;
+ }
}
const ushort *uc = string;
@@ -2086,7 +1955,17 @@ void QTextEngine::itemize() const
while (uc < e) {
switch (*uc) {
case QChar::ObjectReplacementCharacter:
- analysis->flags = QScriptAnalysis::Object;
+ {
+ const QTextDocumentPrivate *doc_p = QTextDocumentPrivate::get(block);
+ if (doc_p != nullptr
+ && doc_p->layout() != nullptr
+ && QAbstractTextDocumentLayoutPrivate::get(doc_p->layout()) != nullptr
+ && QAbstractTextDocumentLayoutPrivate::get(doc_p->layout())->hasHandlers()) {
+ analysis->flags = QScriptAnalysis::Object;
+ } else {
+ analysis->flags = QScriptAnalysis::None;
+ }
+ }
break;
case QChar::LineSeparator:
analysis->flags = QScriptAnalysis::LineOrParagraphSeparator;
@@ -2114,26 +1993,16 @@ void QTextEngine::itemize() const
analysis->flags = QScriptAnalysis::None;
break;
}
-#if !QT_CONFIG(harfbuzz)
- analysis->script = hbscript_to_script(script_to_hbscript(analysis->script));
-#endif
++uc;
++analysis;
}
if (option.flags() & QTextOption::ShowLineAndParagraphSeparators) {
(analysis-1)->flags = QScriptAnalysis::LineOrParagraphSeparator; // to exclude it from width
}
-#if QT_CONFIG(harfbuzz)
- analysis = scriptAnalysis.data();
- if (!qt_useHarfbuzzNG()) {
- for (int i = 0; i < length; ++i)
- analysis[i].script = hbscript_to_script(script_to_hbscript(analysis[i].script));
- }
-#endif
Itemizer itemizer(layoutData->string, scriptAnalysis.data(), layoutData->items);
- const QTextDocumentPrivate *p = block.docHandle();
+ const QTextDocumentPrivate *p = QTextDocumentPrivate::get(block);
if (p) {
SpecialData *s = specialData;
@@ -2141,20 +2010,35 @@ void QTextEngine::itemize() const
QTextDocumentPrivate::FragmentIterator end = p->find(block.position() + block.length() - 1); // -1 to omit the block separator char
int format = it.value()->format;
+ int preeditPosition = s ? s->preeditPosition : INT_MAX;
int prevPosition = 0;
int position = prevPosition;
while (1) {
const QTextFragmentData * const frag = it.value();
if (it == end || format != frag->format) {
- if (s && position >= s->preeditPosition) {
- position += s->preeditText.length();
- s = nullptr;
+ if (s && position >= preeditPosition) {
+ position += s->preeditText.size();
+ preeditPosition = INT_MAX;
}
Q_ASSERT(position <= length);
QFont::Capitalization capitalization =
formatCollection()->charFormat(format).hasProperty(QTextFormat::FontCapitalization)
? formatCollection()->charFormat(format).fontCapitalization()
: formatCollection()->defaultFont().capitalization();
+ if (s) {
+ for (const auto &range : std::as_const(s->formats)) {
+ if (range.start + range.length <= prevPosition || range.start >= position)
+ continue;
+ if (range.format.hasProperty(QTextFormat::FontCapitalization)) {
+ if (range.start > prevPosition)
+ itemizer.generate(prevPosition, range.start - prevPosition, capitalization);
+ int newStart = std::max(prevPosition, range.start);
+ int newEnd = std::min(position, range.start + range.length);
+ itemizer.generate(newStart, newEnd - newStart, range.format.fontCapitalization());
+ prevPosition = newEnd;
+ }
+ }
+ }
itemizer.generate(prevPosition, position - prevPosition, capitalization);
if (it == end) {
if (position < length)
@@ -2230,35 +2114,30 @@ int QTextEngine::findItem(int strPos, int firstItem) const
return right;
}
-QFixed QTextEngine::width(int from, int len) const
+namespace {
+template<typename InnerFunc>
+void textIterator(const QTextEngine *textEngine, int from, int len, QFixed &width, InnerFunc &&innerFunc)
{
- itemize();
-
- QFixed w = 0;
-
-// qDebug("QTextEngine::width(from = %d, len = %d), numItems=%d, strleng=%d", from, len, items.size(), string.length());
- for (int i = 0; i < layoutData->items.size(); i++) {
- const QScriptItem *si = layoutData->items.constData() + i;
+ for (int i = 0; i < textEngine->layoutData->items.size(); i++) {
+ const QScriptItem *si = textEngine->layoutData->items.constData() + i;
int pos = si->position;
- int ilen = length(i);
+ int ilen = textEngine->length(i);
// qDebug("item %d: from %d len %d", i, pos, ilen);
if (pos >= from + len)
break;
if (pos + ilen > from) {
if (!si->num_glyphs)
- shape(i);
+ textEngine->shape(i);
if (si->analysis.flags == QScriptAnalysis::Object) {
- w += si->width;
+ width += si->width;
continue;
} else if (si->analysis.flags == QScriptAnalysis::Tab) {
- w += calculateTabWidth(i, w);
+ width += textEngine->calculateTabWidth(i, width);
continue;
}
-
- QGlyphLayout glyphs = shapedGlyphs(si);
- unsigned short *logClusters = this->logClusters(si);
+ unsigned short *logClusters = textEngine->logClusters(si);
// fprintf(stderr, " logclusters:");
// for (int k = 0; k < ilen; k++)
@@ -2283,11 +2162,24 @@ QFixed QTextEngine::width(int from, int len) const
glyphEnd = (charEnd == ilen) ? si->num_glyphs : logClusters[charEnd];
// qDebug("char: start=%d end=%d / glyph: start = %d, end = %d", charFrom, charEnd, glyphStart, glyphEnd);
- for (int i = glyphStart; i < glyphEnd; i++)
- w += glyphs.advances[i] * !glyphs.attributes[i].dontPrint;
+ innerFunc(glyphStart, glyphEnd, si);
}
}
}
+}
+} // namespace
+
+QFixed QTextEngine::width(int from, int len) const
+{
+ itemize();
+
+ QFixed w = 0;
+// qDebug("QTextEngine::width(from = %d, len = %d), numItems=%d, strleng=%d", from, len, items.size(), string.length());
+ textIterator(this, from, len, w, [this, &w](int glyphStart, int glyphEnd, const QScriptItem *si) {
+ QGlyphLayout glyphs = this->shapedGlyphs(si);
+ for (int j = glyphStart; j < glyphEnd; j++)
+ w += glyphs.advances[j] * !glyphs.attributes[j].dontPrint;
+ });
// qDebug(" --> w= %d ", w);
return w;
}
@@ -2298,58 +2190,20 @@ glyph_metrics_t QTextEngine::boundingBox(int from, int len) const
glyph_metrics_t gm;
- for (int i = 0; i < layoutData->items.size(); i++) {
- const QScriptItem *si = layoutData->items.constData() + i;
-
- int pos = si->position;
- int ilen = length(i);
- if (pos > from + len)
- break;
- if (pos + ilen > from) {
- if (!si->num_glyphs)
- shape(i);
-
- if (si->analysis.flags == QScriptAnalysis::Object) {
- gm.width += si->width;
- continue;
- } else if (si->analysis.flags == QScriptAnalysis::Tab) {
- gm.width += calculateTabWidth(i, gm.width);
- continue;
- }
-
- unsigned short *logClusters = this->logClusters(si);
- QGlyphLayout glyphs = shapedGlyphs(si);
-
- // do the simple thing for now and give the first glyph in a cluster the full width, all other ones 0.
- int charFrom = from - pos;
- if (charFrom < 0)
- charFrom = 0;
- int glyphStart = logClusters[charFrom];
- if (charFrom > 0 && logClusters[charFrom-1] == glyphStart)
- while (charFrom < ilen && logClusters[charFrom] == glyphStart)
- charFrom++;
- if (charFrom < ilen) {
- QFontEngine *fe = fontEngine(*si);
- glyphStart = logClusters[charFrom];
- int charEnd = from + len - 1 - pos;
- if (charEnd >= ilen)
- charEnd = ilen-1;
- int glyphEnd = logClusters[charEnd];
- while (charEnd < ilen && logClusters[charEnd] == glyphEnd)
- charEnd++;
- glyphEnd = (charEnd == ilen) ? si->num_glyphs : logClusters[charEnd];
- if (glyphStart <= glyphEnd ) {
- glyph_metrics_t m = fe->boundingBox(glyphs.mid(glyphStart, glyphEnd - glyphStart));
- gm.x = qMin(gm.x, m.x + gm.xoff);
- gm.y = qMin(gm.y, m.y + gm.yoff);
- gm.width = qMax(gm.width, m.width+gm.xoff);
- gm.height = qMax(gm.height, m.height+gm.yoff);
- gm.xoff += m.xoff;
- gm.yoff += m.yoff;
- }
- }
+ textIterator(this, from, len, gm.width, [this, &gm](int glyphStart, int glyphEnd, const QScriptItem *si) {
+ if (glyphStart <= glyphEnd) {
+ QGlyphLayout glyphs = this->shapedGlyphs(si);
+ QFontEngine *fe = this->fontEngine(*si);
+ glyph_metrics_t m = fe->boundingBox(glyphs.mid(glyphStart, glyphEnd - glyphStart));
+ gm.x = qMin(gm.x, m.x + gm.xoff);
+ gm.y = qMin(gm.y, m.y + gm.yoff);
+ gm.width = qMax(gm.width, m.width + gm.xoff);
+ gm.height = qMax(gm.height, m.height + gm.yoff);
+ gm.xoff += m.xoff;
+ gm.yoff += m.yoff;
}
- }
+ });
+
return gm;
}
@@ -2359,48 +2213,19 @@ glyph_metrics_t QTextEngine::tightBoundingBox(int from, int len) const
glyph_metrics_t gm;
- for (int i = 0; i < layoutData->items.size(); i++) {
- const QScriptItem *si = layoutData->items.constData() + i;
- int pos = si->position;
- int ilen = length(i);
- if (pos > from + len)
- break;
- if (pos + len > from) {
- if (!si->num_glyphs)
- shape(i);
- unsigned short *logClusters = this->logClusters(si);
- QGlyphLayout glyphs = shapedGlyphs(si);
-
- // do the simple thing for now and give the first glyph in a cluster the full width, all other ones 0.
- int charFrom = from - pos;
- if (charFrom < 0)
- charFrom = 0;
- int glyphStart = logClusters[charFrom];
- if (charFrom > 0 && logClusters[charFrom-1] == glyphStart)
- while (charFrom < ilen && logClusters[charFrom] == glyphStart)
- charFrom++;
- if (charFrom < ilen) {
- glyphStart = logClusters[charFrom];
- int charEnd = from + len - 1 - pos;
- if (charEnd >= ilen)
- charEnd = ilen-1;
- int glyphEnd = logClusters[charEnd];
- while (charEnd < ilen && logClusters[charEnd] == glyphEnd)
- charEnd++;
- glyphEnd = (charEnd == ilen) ? si->num_glyphs : logClusters[charEnd];
- if (glyphStart <= glyphEnd ) {
- QFontEngine *fe = fontEngine(*si);
- glyph_metrics_t m = fe->tightBoundingBox(glyphs.mid(glyphStart, glyphEnd - glyphStart));
- gm.x = qMin(gm.x, m.x + gm.xoff);
- gm.y = qMin(gm.y, m.y + gm.yoff);
- gm.width = qMax(gm.width, m.width+gm.xoff);
- gm.height = qMax(gm.height, m.height+gm.yoff);
- gm.xoff += m.xoff;
- gm.yoff += m.yoff;
- }
- }
- }
- }
+ textIterator(this, from, len, gm.width, [this, &gm](int glyphStart, int glyphEnd, const QScriptItem *si) {
+ if (glyphStart <= glyphEnd) {
+ QGlyphLayout glyphs = this->shapedGlyphs(si);
+ QFontEngine *fe = fontEngine(*si);
+ glyph_metrics_t m = fe->tightBoundingBox(glyphs.mid(glyphStart, glyphEnd - glyphStart));
+ gm.x = qMin(gm.x, m.x + gm.xoff);
+ gm.y = qMin(gm.y, m.y + gm.yoff);
+ gm.width = qMax(gm.width, m.width + gm.xoff);
+ gm.height = qMax(gm.height, m.height + gm.yoff);
+ gm.xoff += m.xoff;
+ gm.yoff += m.yoff;
+ }
+ });
return gm;
}
@@ -2411,9 +2236,10 @@ QFont QTextEngine::font(const QScriptItem &si) const
QTextCharFormat f = format(&si);
font = f.font();
- if (block.docHandle() && block.docHandle()->layout()) {
+ const QTextDocumentPrivate *document_d = QTextDocumentPrivate::get(block);
+ if (document_d != nullptr && document_d->layout() != nullptr) {
// Make sure we get the right dpi on printers
- QPaintDevice *pdev = block.docHandle()->layout()->paintDevice();
+ QPaintDevice *pdev = document_d->layout()->paintDevice();
if (pdev)
font = QFont(font, pdev);
} else {
@@ -2466,6 +2292,12 @@ QFontEngine *QTextEngine::fontEngine(const QScriptItem &si, QFixed *ascent, QFix
if (feCache.prevScaledFontEngine) {
scaledEngine = feCache.prevScaledFontEngine;
} else {
+ // GCC 12 gets confused about QFontEngine::ref, for some non-obvious reason
+ // warning: ‘unsigned int __atomic_or_fetch_4(volatile void*, unsigned int, int)’ writing 4 bytes
+ // into a region of size 0 overflows the destination [-Wstringop-overflow=]
+ QT_WARNING_PUSH
+ QT_WARNING_DISABLE_GCC("-Wstringop-overflow")
+
QFontEngine *scEngine = rawFont.d->fontEngine->cloneWithSize(smallCapsFraction * rawFont.pixelSize());
scEngine->ref.ref();
scaledEngine = QFontEngineMulti::createMultiFontEngine(scEngine, script);
@@ -2475,6 +2307,7 @@ QFontEngine *QTextEngine::fontEngine(const QScriptItem &si, QFixed *ascent, QFix
if (!scEngine->ref.deref())
delete scEngine;
+ QT_WARNING_POP
}
}
} else
@@ -2488,17 +2321,17 @@ QFontEngine *QTextEngine::fontEngine(const QScriptItem &si, QFixed *ascent, QFix
QTextCharFormat f = format(&si);
font = f.font();
- if (block.docHandle() && block.docHandle()->layout()) {
+ if (QTextDocumentPrivate::get(block) != nullptr && QTextDocumentPrivate::get(block)->layout() != nullptr) {
// Make sure we get the right dpi on printers
- QPaintDevice *pdev = block.docHandle()->layout()->paintDevice();
+ QPaintDevice *pdev = QTextDocumentPrivate::get(block)->layout()->paintDevice();
if (pdev)
font = QFont(font, pdev);
} else {
font = font.resolve(fnt);
}
engine = font.d->engineForScript(script);
- if (engine)
- engine->ref.ref();
+ Q_ASSERT(engine);
+ engine->ref.ref();
QTextCharFormat::VerticalAlignment valign = f.verticalAlignment();
if (valign == QTextCharFormat::AlignSuperScript || valign == QTextCharFormat::AlignSubScript) {
@@ -2524,13 +2357,12 @@ QFontEngine *QTextEngine::fontEngine(const QScriptItem &si, QFixed *ascent, QFix
feCache.prevLength = length(&si);
}
} else {
- if (feCache.prevFontEngine && feCache.prevScript == script && feCache.prevPosition == -1)
+ if (feCache.prevFontEngine && feCache.prevScript == script && feCache.prevPosition == -1) {
engine = feCache.prevFontEngine;
- else {
+ } else {
engine = font.d->engineForScript(script);
-
- if (engine)
- engine->ref.ref();
+ Q_ASSERT(engine);
+ engine->ref.ref();
if (feCache.prevFontEngine)
releaseCachedFontEngine(feCache.prevFontEngine);
feCache.prevFontEngine = engine;
@@ -2548,7 +2380,10 @@ QFontEngine *QTextEngine::fontEngine(const QScriptItem &si, QFixed *ascent, QFix
}
}
- if (ascent) {
+ if (leading) {
+ Q_ASSERT(engine);
+ Q_ASSERT(ascent);
+ Q_ASSERT(descent);
*ascent = engine->ascent();
*descent = engine->descent();
*leading = engine->leading();
@@ -2573,9 +2408,9 @@ static void set(QJustificationPoint *point, int type, const QGlyphLayout &glyph,
point->glyph = glyph;
if (type >= Justification_Arabic_Normal) {
- QChar ch(0x640); // Kashida character
+ const char32_t ch = U'\x640'; // Kashida character
- glyph_t kashidaGlyph = fe->glyphIndex(ch.unicode());
+ glyph_t kashidaGlyph = fe->glyphIndex(ch);
if (kashidaGlyph != 0) {
QGlyphLayout g;
g.numGlyphs = 1;
@@ -2611,7 +2446,7 @@ void QTextEngine::justify(const QScriptLine &line)
if (!forceJustification) {
int end = line.from + (int)line.length + line.trailingSpaces;
- if (end == layoutData->string.length())
+ if (end == layoutData->string.size())
return; // no justification at end of paragraph
if (end && layoutData->items.at(findItem(end - 1)).analysis.flags == QScriptAnalysis::LineOrParagraphSeparator)
return; // no justification at the end of an explicitly separated line
@@ -2787,10 +2622,10 @@ void QScriptLine::setDefaultHeight(QTextEngine *eng)
QFont f;
QFontEngine *e;
- if (eng->block.docHandle() && eng->block.docHandle()->layout()) {
+ if (QTextDocumentPrivate::get(eng->block) != nullptr && QTextDocumentPrivate::get(eng->block)->layout() != nullptr) {
f = eng->block.charFormat().font();
// Make sure we get the right dpi on printers
- QPaintDevice *pdev = eng->block.docHandle()->layout()->paintDevice();
+ QPaintDevice *pdev = QTextDocumentPrivate::get(eng->block)->layout()->paintDevice();
if (pdev)
f = QFont(f, pdev);
e = f.d->engineForScript(QChar::Script_Common);
@@ -2817,18 +2652,20 @@ QTextEngine::LayoutData::LayoutData()
haveCharAttributes = false;
logClustersPtr = nullptr;
available_glyphs = 0;
+ currentMaxWidth = 0;
}
-QTextEngine::LayoutData::LayoutData(const QString &str, void **stack_memory, int _allocated)
+QTextEngine::LayoutData::LayoutData(const QString &str, void **stack_memory, qsizetype _allocated)
: string(str)
{
allocated = _allocated;
- int space_charAttributes = sizeof(QCharAttributes)*string.length()/sizeof(void*) + 1;
- int space_logClusters = sizeof(unsigned short)*string.length()/sizeof(void*) + 1;
- available_glyphs = ((int)allocated - space_charAttributes - space_logClusters)*(int)sizeof(void*)/(int)QGlyphLayout::SpaceNeeded;
+ constexpr qsizetype voidSize = sizeof(void*);
+ qsizetype space_charAttributes = sizeof(QCharAttributes) * string.size() / voidSize + 1;
+ qsizetype space_logClusters = sizeof(unsigned short) * string.size() / voidSize + 1;
+ available_glyphs = (allocated - space_charAttributes - space_logClusters) * voidSize / QGlyphLayout::SpaceNeeded;
- if (available_glyphs < str.length()) {
+ if (available_glyphs < str.size()) {
// need to allocate on the heap
allocated = 0;
@@ -2841,7 +2678,7 @@ QTextEngine::LayoutData::LayoutData(const QString &str, void **stack_memory, int
logClustersPtr = (unsigned short *)(memory + space_charAttributes);
void *m = memory + space_charAttributes + space_logClusters;
- glyphLayout = QGlyphLayout(reinterpret_cast<char *>(m), str.length());
+ glyphLayout = QGlyphLayout(reinterpret_cast<char *>(m), str.size());
glyphLayout.clear();
memset(memory, 0, space_charAttributes*sizeof(void *));
}
@@ -2849,6 +2686,7 @@ QTextEngine::LayoutData::LayoutData(const QString &str, void **stack_memory, int
hasBidi = false;
layoutState = LayoutEmpty;
haveCharAttributes = false;
+ currentMaxWidth = 0;
}
QTextEngine::LayoutData::~LayoutData()
@@ -2866,15 +2704,16 @@ bool QTextEngine::LayoutData::reallocate(int totalGlyphs)
return true;
}
- int space_charAttributes = sizeof(QCharAttributes)*string.length()/sizeof(void*) + 1;
- int space_logClusters = sizeof(unsigned short)*string.length()/sizeof(void*) + 1;
- int space_glyphs = (totalGlyphs * QGlyphLayout::SpaceNeeded) / sizeof(void *) + 2;
+ const qsizetype space_charAttributes = (sizeof(QCharAttributes) * string.size() / sizeof(void*) + 1);
+ const qsizetype space_logClusters = (sizeof(unsigned short) * string.size() / sizeof(void*) + 1);
+ const qsizetype space_glyphs = qsizetype(totalGlyphs) * QGlyphLayout::SpaceNeeded / sizeof(void *) + 2;
- int newAllocated = space_charAttributes + space_glyphs + space_logClusters;
- // These values can be negative if the length of string/glyphs causes overflow,
+ const qsizetype newAllocated = space_charAttributes + space_glyphs + space_logClusters;
+ // Check if the length of string/glyphs causes int overflow,
// we can't layout such a long string all at once, so return false here to
// indicate there is a failure
- if (space_charAttributes < 0 || space_logClusters < 0 || space_glyphs < 0 || newAllocated < allocated) {
+ if (size_t(space_charAttributes) > INT_MAX || size_t(space_logClusters) > INT_MAX || totalGlyphs < 0
+ || size_t(space_glyphs) > INT_MAX || size_t(newAllocated) > INT_MAX || newAllocated < allocated) {
layoutState = LayoutFailed;
return false;
}
@@ -2894,7 +2733,7 @@ bool QTextEngine::LayoutData::reallocate(int totalGlyphs)
logClustersPtr = (unsigned short *) m;
m += space_logClusters;
- const int space_preGlyphLayout = space_charAttributes + space_logClusters;
+ const qsizetype space_preGlyphLayout = space_charAttributes + space_logClusters;
if (allocated < space_preGlyphLayout)
memset(memory + allocated, 0, (space_preGlyphLayout - allocated)*sizeof(void *));
@@ -2904,6 +2743,21 @@ bool QTextEngine::LayoutData::reallocate(int totalGlyphs)
return true;
}
+void QGlyphLayout::copy(QGlyphLayout *oldLayout)
+{
+ Q_ASSERT(offsets != oldLayout->offsets);
+
+ int n = std::min(numGlyphs, oldLayout->numGlyphs);
+
+ memcpy(offsets, oldLayout->offsets, n * sizeof(QFixedPoint));
+ memcpy(attributes, oldLayout->attributes, n * sizeof(QGlyphAttributes));
+ memcpy(justifications, oldLayout->justifications, n * sizeof(QGlyphJustification));
+ memcpy(advances, oldLayout->advances, n * sizeof(QFixed));
+ memcpy(glyphs, oldLayout->glyphs, n * sizeof(glyph_t));
+
+ numGlyphs = n;
+}
+
// grow to the new size, copying the existing data to the new layout
void QGlyphLayout::grow(char *address, int totalGlyphs)
{
@@ -2934,6 +2788,7 @@ void QTextEngine::freeMemory()
layoutData->hasBidi = false;
layoutData->layoutState = LayoutEmpty;
layoutData->haveCharAttributes = false;
+ layoutData->currentMaxWidth = 0;
layoutData->items.clear();
}
if (specialData)
@@ -2952,15 +2807,15 @@ int QTextEngine::formatIndex(const QScriptItem *si) const
return collection->indexForFormat(specialData->resolvedFormats.at(si - &layoutData->items.at(0)));
}
- QTextDocumentPrivate *p = block.docHandle();
+ const QTextDocumentPrivate *p = QTextDocumentPrivate::get(block);
if (!p)
return -1;
int pos = si->position;
if (specialData && si->position >= specialData->preeditPosition) {
- if (si->position < specialData->preeditPosition + specialData->preeditText.length())
+ if (si->position < specialData->preeditPosition + specialData->preeditText.size())
pos = qMax(qMin(block.length(), specialData->preeditPosition) - 1, 0);
else
- pos -= specialData->preeditText.length();
+ pos -= specialData->preeditText.size();
}
QTextDocumentPrivate::FragmentIterator it = p->find(block.position() + pos);
return it.value()->format;
@@ -3050,7 +2905,7 @@ void QTextEngine::setPreeditArea(int position, const QString &preeditText)
clearLineData();
}
-void QTextEngine::setFormats(const QVector<QTextLayout::FormatRange> &formats)
+void QTextEngine::setFormats(const QList<QTextLayout::FormatRange> &formats)
{
if (formats.isEmpty()) {
if (!specialData)
@@ -3077,7 +2932,7 @@ void QTextEngine::indexFormats()
{
QTextFormatCollection *collection = formatCollection();
if (!collection) {
- Q_ASSERT(!block.docHandle());
+ Q_ASSERT(QTextDocumentPrivate::get(block) == nullptr);
specialData->formatCollection.reset(new QTextFormatCollection);
collection = specialData->formatCollection.data();
}
@@ -3095,9 +2950,9 @@ void QTextEngine::indexFormats()
*/
static inline bool nextCharJoins(const QString &string, int pos)
{
- while (pos < string.length() && string.at(pos).category() == QChar::Mark_NonSpacing)
+ while (pos < string.size() && string.at(pos).category() == QChar::Mark_NonSpacing)
++pos;
- if (pos == string.length())
+ if (pos == string.size())
return false;
QChar::JoiningType joining = string.at(pos).joiningType();
return joining != QChar::Joining_None && joining != QChar::Joining_Transparent;
@@ -3113,11 +2968,11 @@ static inline bool prevCharJoins(const QString &string, int pos)
return joining == QChar::Joining_Dual || joining == QChar::Joining_Causing;
}
-static inline bool isRetainableControlCode(QChar c)
+static constexpr bool isRetainableControlCode(char16_t c) noexcept
{
- return (c.unicode() >= 0x202a && c.unicode() <= 0x202e) // LRE, RLE, PDF, LRO, RLO
- || (c.unicode() >= 0x200e && c.unicode() <= 0x200f) // LRM, RLM
- || (c.unicode() >= 0x2066 && c.unicode() <= 0x2069); // LRI, RLI, FSI, PDI
+ return (c >= 0x202a && c <= 0x202e) // LRE, RLE, PDF, LRO, RLO
+ || (c >= 0x200e && c <= 0x200f) // LRM, RLM
+ || (c >= 0x2066 && c <= 0x2069); // LRI, RLI, FSI, PDI
}
static QString stringMidRetainingBidiCC(const QString &string,
@@ -3130,22 +2985,22 @@ static QString stringMidRetainingBidiCC(const QString &string,
{
QString prefix;
for (int i=subStringFrom; i<midStart; ++i) {
- QChar c = string.at(i);
+ char16_t c = string.at(i).unicode();
if (isRetainableControlCode(c))
prefix += c;
}
QString suffix;
for (int i=midStart + midLength; i<subStringTo; ++i) {
- QChar c = string.at(i);
+ char16_t c = string.at(i).unicode();
if (isRetainableControlCode(c))
suffix += c;
}
- return prefix + ellidePrefix + string.midRef(midStart, midLength) + ellideSuffix + suffix;
+ return prefix + ellidePrefix + QStringView{string}.mid(midStart, midLength) + ellideSuffix + suffix;
}
-QString QTextEngine::elidedText(Qt::TextElideMode mode, const QFixed &width, int flags, int from, int count) const
+QString QTextEngine::elidedText(Qt::TextElideMode mode, QFixed width, int flags, int from, int count) const
{
// qDebug() << "elidedText; available width" << width.toReal() << "text width:" << this->width(0, layoutData->string.length()).toReal();
@@ -3164,14 +3019,14 @@ QString QTextEngine::elidedText(Qt::TextElideMode mode, const QFixed &width, int
const int end = si.position + length(&si);
for (int i = si.position; i < end - 1; ++i) {
- if (layoutData->string.at(i) == QLatin1Char('&')
+ if (layoutData->string.at(i) == u'&'
&& !attributes[i + 1].whiteSpace && attributes[i + 1].graphemeBoundary) {
const int gp = logClusters[i - si.position];
glyphs.attributes[gp].dontPrint = true;
// emulate grapheme cluster
attributes[i] = attributes[i + 1];
memset(attributes + i + 1, 0, sizeof(QCharAttributes));
- if (layoutData->string.at(i + 1) == QLatin1Char('&'))
+ if (layoutData->string.at(i + 1) == u'&')
++i;
}
}
@@ -3180,12 +3035,12 @@ QString QTextEngine::elidedText(Qt::TextElideMode mode, const QFixed &width, int
validate();
- const int to = count >= 0 && count <= layoutData->string.length() - from
+ const int to = count >= 0 && count <= layoutData->string.size() - from
? from + count
- : layoutData->string.length();
+ : layoutData->string.size();
if (mode == Qt::ElideNone
- || this->width(from, layoutData->string.length()) <= width
+ || this->width(from, layoutData->string.size()) <= width
|| to - from <= 1)
return layoutData->string.mid(from, from - to);
@@ -3194,7 +3049,7 @@ QString QTextEngine::elidedText(Qt::TextElideMode mode, const QFixed &width, int
{
QFontEngine *engine = fnt.d->engineForScript(QChar::Script_Common);
- QChar ellipsisChar(0x2026);
+ constexpr char16_t ellipsisChar = u'\x2026';
// We only want to use the ellipsis character if it is from the main
// font (not one of the fallbacks), since using a fallback font
@@ -3206,7 +3061,7 @@ QString QTextEngine::elidedText(Qt::TextElideMode mode, const QFixed &width, int
engine = multiEngine->engine(0);
}
- glyph_t glyph = engine->glyphIndex(ellipsisChar.unicode());
+ glyph_t glyph = engine->glyphIndex(ellipsisChar);
QGlyphLayout glyphs;
glyphs.numGlyphs = 1;
@@ -3224,6 +3079,11 @@ QString QTextEngine::elidedText(Qt::TextElideMode mode, const QFixed &width, int
ellipsisWidth *= 3;
ellipsisText = QStringLiteral("...");
+ } else {
+ engine = fnt.d->engineForScript(QChar::Script_Common);
+ glyph = engine->glyphIndex(ellipsisChar);
+ engine->recalcAdvances(&glyphs, { });
+ ellipsisText = ellipsisChar;
}
}
}
@@ -3236,6 +3096,8 @@ QString QTextEngine::elidedText(Qt::TextElideMode mode, const QFixed &width, int
if (!attributes)
return QString();
+ constexpr char16_t ZWJ = u'\x200d'; // ZERO-WIDTH JOINER
+
if (mode == Qt::ElideRight) {
QFixed currentWidth;
int pos;
@@ -3245,7 +3107,7 @@ QString QTextEngine::elidedText(Qt::TextElideMode mode, const QFixed &width, int
pos = nextBreak;
++nextBreak;
- while (nextBreak < layoutData->string.length() && !attributes[nextBreak].graphemeBoundary)
+ while (nextBreak < layoutData->string.size() && !attributes[nextBreak].graphemeBoundary)
++nextBreak;
currentWidth += this->width(pos, nextBreak - pos);
@@ -3253,7 +3115,7 @@ QString QTextEngine::elidedText(Qt::TextElideMode mode, const QFixed &width, int
&& currentWidth < availableWidth);
if (nextCharJoins(layoutData->string, pos))
- ellipsisText.prepend(QChar(0x200d) /* ZWJ */);
+ ellipsisText.prepend(ZWJ);
return stringMidRetainingBidiCC(layoutData->string,
QString(), ellipsisText,
@@ -3276,7 +3138,7 @@ QString QTextEngine::elidedText(Qt::TextElideMode mode, const QFixed &width, int
&& currentWidth < availableWidth);
if (prevCharJoins(layoutData->string, pos))
- ellipsisText.append(QChar(0x200d) /* ZWJ */);
+ ellipsisText.append(ZWJ);
return stringMidRetainingBidiCC(layoutData->string,
ellipsisText, QString(),
@@ -3297,7 +3159,7 @@ QString QTextEngine::elidedText(Qt::TextElideMode mode, const QFixed &width, int
rightPos = nextRightBreak;
++nextLeftBreak;
- while (nextLeftBreak < layoutData->string.length() && !attributes[nextLeftBreak].graphemeBoundary)
+ while (nextLeftBreak < layoutData->string.size() && !attributes[nextLeftBreak].graphemeBoundary)
++nextLeftBreak;
--nextRightBreak;
@@ -3311,11 +3173,11 @@ QString QTextEngine::elidedText(Qt::TextElideMode mode, const QFixed &width, int
&& leftWidth + rightWidth < availableWidth);
if (nextCharJoins(layoutData->string, leftPos))
- ellipsisText.prepend(QChar(0x200d) /* ZWJ */);
+ ellipsisText.prepend(ZWJ);
if (prevCharJoins(layoutData->string, rightPos))
- ellipsisText.append(QChar(0x200d) /* ZWJ */);
+ ellipsisText.append(ZWJ);
- return layoutData->string.midRef(from, leftPos - from) + ellipsisText + layoutData->string.midRef(rightPos, to - rightPos);
+ return QStringView{layoutData->string}.mid(from, leftPos - from) + ellipsisText + QStringView{layoutData->string}.mid(rightPos, to - rightPos);
}
return layoutData->string.mid(from, to - from);
@@ -3336,11 +3198,11 @@ void QTextEngine::setBoundary(int strPos) const
QFixed QTextEngine::calculateTabWidth(int item, QFixed x) const
{
- const QScriptItem &si = layoutData->items[item];
+ const QScriptItem &si = layoutData->items.at(item);
QFixed dpiScale = 1;
- if (block.docHandle() && block.docHandle()->layout()) {
- QPaintDevice *pdev = block.docHandle()->layout()->paintDevice();
+ if (QTextDocumentPrivate::get(block) != nullptr && QTextDocumentPrivate::get(block)->layout() != nullptr) {
+ QPaintDevice *pdev = QTextDocumentPrivate::get(block)->layout()->paintDevice();
if (pdev)
dpiScale = QFixed::fromReal(pdev->logicalDpiY() / qreal(qt_defaultDpiY()));
} else {
@@ -3370,15 +3232,15 @@ QFixed QTextEngine::calculateTabWidth(int item, QFixed x) const
}
}
}
- for (const QTextOption::Tab &tabSpec : qAsConst(tabArray)) {
+ for (const QTextOption::Tab &tabSpec : std::as_const(tabArray)) {
QFixed tab = QFixed::fromReal(tabSpec.position) * dpiScale;
if (tab > x) { // this is the tab we need.
- int tabSectionEnd = layoutData->string.count();
+ int tabSectionEnd = layoutData->string.size();
if (tabSpec.type == QTextOption::RightTab || tabSpec.type == QTextOption::CenterTab) {
// find next tab to calculate the width required.
tab = QFixed::fromReal(tabSpec.position);
- for (int i=item + 1; i < layoutData->items.count(); i++) {
- const QScriptItem &item = layoutData->items[i];
+ for (int i=item + 1; i < layoutData->items.size(); i++) {
+ const QScriptItem &item = layoutData->items.at(i);
if (item.analysis.flags == QScriptAnalysis::TabOrObject) { // found it.
tabSectionEnd = item.position;
break;
@@ -3386,13 +3248,13 @@ QFixed QTextEngine::calculateTabWidth(int item, QFixed x) const
}
}
else if (tabSpec.type == QTextOption::DelimiterTab)
- // find delimitor character to calculate the width required
+ // find delimiter character to calculate the width required
tabSectionEnd = qMax(si.position, layoutData->string.indexOf(tabSpec.delimiter, si.position) + 1);
if (tabSectionEnd > si.position) {
QFixed length;
// Calculate the length of text between this tab and the tabSectionEnd
- for (int i=item; i < layoutData->items.count(); i++) {
+ for (int i=item; i < layoutData->items.size(); i++) {
const QScriptItem &item = layoutData->items.at(i);
if (item.position > tabSectionEnd || item.position <= si.position)
continue;
@@ -3439,17 +3301,17 @@ QFixed QTextEngine::calculateTabWidth(int item, QFixed x) const
namespace {
class FormatRangeComparatorByStart {
- const QVector<QTextLayout::FormatRange> &list;
+ const QList<QTextLayout::FormatRange> &list;
public:
- FormatRangeComparatorByStart(const QVector<QTextLayout::FormatRange> &list) : list(list) { }
+ FormatRangeComparatorByStart(const QList<QTextLayout::FormatRange> &list) : list(list) { }
bool operator()(int a, int b) {
return list.at(a).start < list.at(b).start;
}
};
class FormatRangeComparatorByEnd {
- const QVector<QTextLayout::FormatRange> &list;
+ const QList<QTextLayout::FormatRange> &list;
public:
- FormatRangeComparatorByEnd(const QVector<QTextLayout::FormatRange> &list) : list(list) { }
+ FormatRangeComparatorByEnd(const QList<QTextLayout::FormatRange> &list) : list(list) { }
bool operator()(int a, int b) {
return list.at(a).start + list.at(a).length < list.at(b).start + list.at(b).length;
}
@@ -3464,7 +3326,7 @@ void QTextEngine::resolveFormats() const
QTextFormatCollection *collection = formatCollection();
- QVector<QTextCharFormat> resolvedFormats(layoutData->items.count());
+ QList<QTextCharFormat> resolvedFormats(layoutData->items.size());
QVarLengthArray<int, 64> formatsSortedByStart;
formatsSortedByStart.reserve(specialData->formats.size());
@@ -3482,7 +3344,7 @@ void QTextEngine::resolveFormats() const
const int *startIt = formatsSortedByStart.constBegin();
const int *endIt = formatsSortedByEnd.constBegin();
- for (int i = 0; i < layoutData->items.count(); ++i) {
+ for (int i = 0; i < layoutData->items.size(); ++i) {
const QScriptItem *si = &layoutData->items.at(i);
int end = si->position + length(si);
@@ -3502,8 +3364,8 @@ void QTextEngine::resolveFormats() const
}
QTextCharFormat &format = resolvedFormats[i];
- if (block.docHandle()) {
- // when we have a docHandle, formatIndex might still return a valid index based
+ if (QTextDocumentPrivate::get(block) != nullptr) {
+ // when we have a QTextDocumentPrivate, formatIndex might still return a valid index based
// on the preeditPosition. for all other cases, we cleared the resolved format indices
format = collection->charFormat(formatIndex(si));
}
@@ -3658,8 +3520,8 @@ int QTextEngine::previousLogicalPosition(int oldPos) const
{
const QCharAttributes *attrs = attributes();
int len = block.isValid() ? block.length() - 1
- : layoutData->string.length();
- Q_ASSERT(len <= layoutData->string.length());
+ : layoutData->string.size();
+ Q_ASSERT(len <= layoutData->string.size());
if (!attrs || oldPos <= 0 || oldPos > len)
return oldPos;
@@ -3673,8 +3535,8 @@ int QTextEngine::nextLogicalPosition(int oldPos) const
{
const QCharAttributes *attrs = attributes();
int len = block.isValid() ? block.length() - 1
- : layoutData->string.length();
- Q_ASSERT(len <= layoutData->string.length());
+ : layoutData->string.size();
+ Q_ASSERT(len <= layoutData->string.size());
if (!attrs || oldPos < 0 || oldPos >= len)
return oldPos;
@@ -3688,7 +3550,7 @@ int QTextEngine::lineNumberForTextPosition(int pos)
{
if (!layoutData)
itemize();
- if (pos == layoutData->string.length() && lines.size())
+ if (pos == layoutData->string.size() && lines.size())
return lines.size() - 1;
for (int i = 0; i < lines.size(); ++i) {
const QScriptLine& line = lines[i];
@@ -3820,12 +3682,6 @@ void QTextEngine::drawDecorations(QPainter *painter)
{
QPen oldPen = painter->pen();
- bool wasCompatiblePainting = painter->renderHints()
- & QPainter::Qt4CompatiblePainting;
-
- if (wasCompatiblePainting)
- painter->setRenderHint(QPainter::Qt4CompatiblePainting, false);
-
adjustUnderlines();
drawItemDecorationList(painter, underlineList);
drawItemDecorationList(painter, strikeOutList);
@@ -3833,9 +3689,6 @@ void QTextEngine::drawDecorations(QPainter *painter)
clearDecorations();
- if (wasCompatiblePainting)
- painter->setRenderHint(QPainter::Qt4CompatiblePainting);
-
painter->setPen(oldPen);
}
@@ -4021,10 +3874,12 @@ QTextLineItemIterator::QTextLineItemIterator(QTextEngine *_eng, int _lineNum, co
x += eng->alignLine(line);
- QVarLengthArray<uchar> levels(nItems);
- for (int i = 0; i < nItems; ++i)
- levels[i] = eng->layoutData->items.at(i + firstItem).analysis.bidiLevel;
- QTextEngine::bidiReorder(nItems, levels.data(), visualOrder.data());
+ if (nItems > 0) {
+ QVarLengthArray<uchar> levels(nItems);
+ for (int i = 0; i < nItems; ++i)
+ levels[i] = eng->layoutData->items.at(i + firstItem).analysis.bidiLevel;
+ QTextEngine::bidiReorder(nItems, levels.data(), visualOrder.data());
+ }
eng->shapeLine(line);
}
diff --git a/src/gui/text/qtextengine_p.h b/src/gui/text/qtextengine_p.h
index f069951ce5..c01d3a0711 100644
--- a/src/gui/text/qtextengine_p.h
+++ b/src/gui/text/qtextengine_p.h
@@ -1,41 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the QtGui module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#ifndef QTEXTENGINE_P_H
#define QTEXTENGINE_P_H
@@ -52,27 +16,28 @@
//
#include <QtGui/private/qtguiglobal_p.h>
-#include "QtCore/qstring.h"
-#include "QtCore/qvarlengtharray.h"
-#include "QtCore/qnamespace.h"
-#include "QtGui/qtextlayout.h"
-#include "private/qtextformat_p.h"
-#include "private/qfont_p.h"
-#include "QtCore/qvector.h"
#include "QtGui/qpaintengine.h"
+#include "QtGui/qtextcursor.h"
#include "QtGui/qtextobject.h"
#include "QtGui/qtextoption.h"
-#include "QtGui/qtextcursor.h"
-#include "QtCore/qset.h"
+#include "QtGui/qtextlayout.h"
+
#include "QtCore/qdebug.h"
+#include "QtCore/qlist.h"
+#include "QtCore/qnamespace.h"
+#include "QtCore/qset.h"
+#include <QtCore/qspan.h>
+#include "QtCore/qstring.h"
+#include "QtCore/qvarlengtharray.h"
+
+#include "private/qfixed_p.h"
+#include "private/qfont_p.h"
+#include "private/qtextformat_p.h"
+#include "private/qunicodetools_p.h"
#ifndef QT_BUILD_COMPAT_LIB
#include "private/qtextdocument_p.h"
#endif
-#include "private/qfixed_p.h"
-
-#include <private/qunicodetools_p.h>
-
#include <stdlib.h>
#include <vector>
@@ -189,15 +154,13 @@ struct QGlyphAttributes {
uchar justification : 4;
uchar reserved : 2;
};
-Q_STATIC_ASSERT(sizeof(QGlyphAttributes) == 1);
+static_assert(sizeof(QGlyphAttributes) == 1);
Q_DECLARE_TYPEINFO(QGlyphAttributes, Q_PRIMITIVE_TYPE);
struct QGlyphLayout
{
- enum {
- SpaceNeeded = sizeof(glyph_t) + sizeof(QFixed) + sizeof(QFixedPoint)
- + sizeof(QGlyphAttributes) + sizeof(QGlyphJustification)
- };
+ static constexpr qsizetype SpaceNeeded = sizeof(glyph_t) + sizeof(QFixed) + sizeof(QFixedPoint)
+ + sizeof(QGlyphAttributes) + sizeof(QGlyphJustification);
// init to 0 not needed, done when shaping
QFixedPoint *offsets; // 8 bytes per element
@@ -213,7 +176,7 @@ struct QGlyphLayout
inline explicit QGlyphLayout(char *address, int totalGlyphs)
{
offsets = reinterpret_cast<QFixedPoint *>(address);
- int offset = totalGlyphs * sizeof(QFixedPoint);
+ qsizetype offset = totalGlyphs * sizeof(QFixedPoint);
glyphs = reinterpret_cast<glyph_t *>(address + offset);
offset += totalGlyphs * sizeof(glyph_t);
advances = reinterpret_cast<QFixed *>(address + offset);
@@ -246,7 +209,7 @@ struct QGlyphLayout
last = numGlyphs;
if (first == 0 && last == numGlyphs
&& reinterpret_cast<char *>(offsets + numGlyphs) == reinterpret_cast<char *>(glyphs)) {
- memset(static_cast<void *>(offsets), 0, (numGlyphs * SpaceNeeded));
+ memset(static_cast<void *>(offsets), 0, qsizetype(numGlyphs) * SpaceNeeded);
} else {
const int num = last - first;
memset(static_cast<void *>(offsets + first), 0, num * sizeof(QFixedPoint));
@@ -261,6 +224,7 @@ struct QGlyphLayout
return reinterpret_cast<char *>(offsets);
}
+ void copy(QGlyphLayout *other);
void grow(char *address, int totalGlyphs);
};
@@ -332,7 +296,7 @@ public:
struct QScriptItem
{
- Q_DECL_CONSTEXPR QScriptItem(int p, QScriptAnalysis a) noexcept
+ constexpr QScriptItem(int p, QScriptAnalysis a) noexcept
: position(p), analysis(a),
num_glyphs(0), descent(-1), ascent(-1), leading(-1), width(-1),
glyph_data_offset(0) {}
@@ -345,14 +309,14 @@ struct QScriptItem
QFixed leading;
QFixed width;
int glyph_data_offset;
- Q_DECL_CONSTEXPR QFixed height() const noexcept { return ascent + descent; }
+ constexpr QFixed height() const noexcept { return ascent + descent; }
private:
- friend class QVector<QScriptItem>;
- QScriptItem() {} // for QVector, don't use
+ friend class QList<QScriptItem>;
+ QScriptItem() {} // for QList, don't use
};
Q_DECLARE_TYPEINFO(QScriptItem, Q_PRIMITIVE_TYPE);
-typedef QVector<QScriptItem> QScriptItemArray;
+typedef QList<QScriptItem> QScriptItemArray;
struct Q_AUTOTEST_EXPORT QScriptLine
{
@@ -394,7 +358,7 @@ inline void QScriptLine::operator+=(const QScriptLine &other)
length += other.length;
}
-typedef QVector<QScriptLine> QScriptLineArray;
+typedef QList<QScriptLine> QScriptLineArray;
class QFontPrivate;
class QTextFormatCollection;
@@ -407,12 +371,12 @@ public:
LayoutFailed
};
struct Q_GUI_EXPORT LayoutData {
- LayoutData(const QString &str, void **stack_memory, int mem_size);
+ LayoutData(const QString &str, void **stack_memory, qsizetype mem_size);
LayoutData();
~LayoutData();
mutable QScriptItemArray items;
- int allocated;
- int available_glyphs;
+ qsizetype allocated;
+ qsizetype available_glyphs;
void **memory;
unsigned short *logClustersPtr;
QGlyphLayout glyphLayout;
@@ -421,12 +385,13 @@ public:
uint layoutState : 2;
uint memory_on_stack : 1;
uint haveCharAttributes : 1;
+ QFixed currentMaxWidth;
QString string;
bool reallocate(int totalGlyphs);
};
struct ItemDecoration {
- ItemDecoration() {} // for QVector, don't use
+ ItemDecoration() { } // for QList, don't use
ItemDecoration(qreal x1, qreal x2, qreal y, const QPen &pen):
x1(x1), x2(x2), y(y), pen(pen) {}
@@ -436,7 +401,7 @@ public:
QPen pen;
};
- typedef QVector<ItemDecoration> ItemDecorationList;
+ typedef QList<ItemDecoration> ItemDecorationList;
QTextEngine();
QTextEngine(const QString &str, const QFont &f);
@@ -470,14 +435,14 @@ public:
const QScriptItem &si = layoutData->items[item];
int from = si.position;
item++;
- return (item < layoutData->items.size() ? layoutData->items[item].position : layoutData->string.length()) - from;
+ return (item < layoutData->items.size() ? layoutData->items[item].position : layoutData->string.size()) - from;
}
int length(const QScriptItem *si) const {
int end;
if (si + 1 < layoutData->items.constData()+ layoutData->items.size())
end = (si+1)->position;
else
- end = layoutData->string.length();
+ end = layoutData->string.size();
return end - si->position;
}
@@ -525,14 +490,14 @@ public:
int findItem(int strPos, int firstItem = 0) const;
inline QTextFormatCollection *formatCollection() const {
- if (block.docHandle())
- return block.docHandle()->formatCollection();
+ if (QTextDocumentPrivate::get(block) != nullptr)
+ return const_cast<QTextFormatCollection *>(QTextDocumentPrivate::get(block)->formatCollection());
return specialData ? specialData->formatCollection.data() : nullptr;
}
QTextCharFormat format(const QScriptItem *si) const;
inline QAbstractTextDocumentLayout *docLayout() const {
- Q_ASSERT(block.docHandle());
- return block.docHandle()->document()->documentLayout();
+ Q_ASSERT(QTextDocumentPrivate::get(block) != nullptr);
+ return QTextDocumentPrivate::get(block)->document()->documentLayout();
}
int formatIndex(const QScriptItem *si) const;
@@ -589,17 +554,19 @@ public:
ItemDecorationList overlineList;
inline bool visualCursorMovement() const
- { return visualMovement || (block.docHandle() && block.docHandle()->defaultCursorMoveStyle == Qt::VisualMoveStyle); }
+ { return visualMovement || (QTextDocumentPrivate::get(block) != nullptr && QTextDocumentPrivate::get(block)->defaultCursorMoveStyle == Qt::VisualMoveStyle); }
inline int preeditAreaPosition() const { return specialData ? specialData->preeditPosition : -1; }
inline QString preeditAreaText() const { return specialData ? specialData->preeditText : QString(); }
void setPreeditArea(int position, const QString &text);
inline bool hasFormats() const
- { return block.docHandle() || (specialData && !specialData->formats.isEmpty()); }
- inline QVector<QTextLayout::FormatRange> formats() const
- { return specialData ? specialData->formats : QVector<QTextLayout::FormatRange>(); }
- void setFormats(const QVector<QTextLayout::FormatRange> &formats);
+ { return QTextDocumentPrivate::get(block) != nullptr || (specialData && !specialData->formats.isEmpty()); }
+ inline QList<QTextLayout::FormatRange> formats() const
+ {
+ return specialData ? specialData->formats : QList<QTextLayout::FormatRange>();
+ }
+ void setFormats(const QList<QTextLayout::FormatRange> &formats);
private:
static void init(QTextEngine *e);
@@ -607,9 +574,9 @@ private:
struct SpecialData {
int preeditPosition;
QString preeditText;
- QVector<QTextLayout::FormatRange> formats;
- QVector<QTextCharFormat> resolvedFormats;
- // only used when no docHandle is available
+ QList<QTextLayout::FormatRange> formats;
+ QList<QTextCharFormat> resolvedFormats;
+ // only used when no QTextDocumentPrivate is available
QScopedPointer<QTextFormatCollection> formatCollection;
};
SpecialData *specialData;
@@ -620,7 +587,7 @@ private:
public:
bool atWordSeparator(int position) const;
- QString elidedText(Qt::TextElideMode mode, const QFixed &width, int flags = 0, int from = 0, int count = -1) const;
+ QString elidedText(Qt::TextElideMode mode, QFixed width, int flags = 0, int from = 0, int count = -1) const;
void shapeLine(const QScriptLine &line);
QFixed leadingSpaceWidth(const QScriptLine &line);
@@ -658,11 +625,11 @@ private:
const ushort *string,
int itemLength,
QFontEngine *fontEngine,
- const QVector<uint> &itemBoundaries,
+ QSpan<uint> itemBoundaries,
bool kerningEnabled,
- bool hasLetterSpacing) const;
+ bool hasLetterSpacing,
+ const QHash<QFont::Tag, quint32> &features) const;
#endif
- int shapeTextWithHarfbuzz(const QScriptItem &si, const ushort *string, int itemLength, QFontEngine *fontEngine, const QVector<uint> &itemBoundaries, bool kerningEnabled) const;
int endOfLine(int lineNum);
int beginningOfLine(int lineNum);
@@ -676,7 +643,7 @@ public:
LayoutData _layoutData;
void *_memory[MemSize];
};
-Q_DECLARE_TYPEINFO(QTextEngine::ItemDecoration, Q_MOVABLE_TYPE);
+Q_DECLARE_TYPEINFO(QTextEngine::ItemDecoration, Q_RELOCATABLE_TYPE);
struct QTextLineItemIterator
{
diff --git a/src/gui/text/qtextformat.cpp b/src/gui/text/qtextformat.cpp
index e3bd49a15e..dacef70812 100644
--- a/src/gui/text/qtextformat.cpp
+++ b/src/gui/text/qtextformat.cpp
@@ -1,41 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the QtGui module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2021 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#include "qtextformat.h"
#include "qtextformat_p.h"
@@ -144,7 +108,7 @@ QT_BEGIN_NAMESPACE
*/
QTextLength::operator QVariant() const
{
- return QVariant(QVariant::TextLength, this);
+ return QVariant::fromValue(*this);
}
#ifndef QT_NO_DATASTREAM
@@ -177,14 +141,14 @@ struct Property
{ return key == other.key && value == other.value; }
};
}
-Q_DECLARE_TYPEINFO(Property, Q_MOVABLE_TYPE);
+Q_DECLARE_TYPEINFO(Property, Q_RELOCATABLE_TYPE);
class QTextFormatPrivate : public QSharedData
{
public:
QTextFormatPrivate() : hashDirty(true), fontDirty(true), hashValue(0) {}
- inline uint hash() const
+ inline size_t hash() const
{
if (!hashDirty)
return hashValue;
@@ -201,11 +165,10 @@ public:
inline void insertProperty(qint32 key, const QVariant &value)
{
hashDirty = true;
- if ((key >= QTextFormat::FirstFontProperty && key <= QTextFormat::LastFontProperty)
- || key == QTextFormat::FontLetterSpacingType) {
+ if (key >= QTextFormat::FirstFontProperty && key <= QTextFormat::LastFontProperty)
fontDirty = true;
- }
- for (int i = 0; i < props.count(); ++i)
+
+ for (int i = 0; i < props.size(); ++i)
if (props.at(i).key == key) {
props[i].value = value;
return;
@@ -215,13 +178,11 @@ public:
inline void clearProperty(qint32 key)
{
- for (int i = 0; i < props.count(); ++i)
+ for (int i = 0; i < props.size(); ++i)
if (props.at(i).key == key) {
hashDirty = true;
- if ((key >= QTextFormat::FirstFontProperty && key <= QTextFormat::LastFontProperty)
- || key == QTextFormat::FontLetterSpacingType) {
+ if (key >= QTextFormat::FirstFontProperty && key <= QTextFormat::LastFontProperty)
fontDirty = true;
- }
props.remove(i);
return;
}
@@ -229,7 +190,7 @@ public:
inline int propertyIndex(qint32 key) const
{
- for (int i = 0; i < props.count(); ++i)
+ for (int i = 0; i < props.size(); ++i)
if (props.at(i).key == key)
return i;
return -1;
@@ -254,68 +215,69 @@ public:
return fnt;
}
- QVector<Property> props;
+ QList<Property> props;
private:
- uint recalcHash() const;
+ size_t recalcHash() const;
void recalcFont() const;
mutable bool hashDirty;
mutable bool fontDirty;
- mutable uint hashValue;
+ mutable size_t hashValue;
mutable QFont fnt;
friend QDataStream &operator<<(QDataStream &, const QTextFormat &);
friend QDataStream &operator>>(QDataStream &, QTextFormat &);
};
-static inline uint hash(const QColor &color)
+static inline size_t hash(const QColor &color)
{
return (color.isValid()) ? color.rgba() : 0x234109;
}
-static inline uint hash(const QPen &pen)
+static inline size_t hash(const QPen &pen)
{
return hash(pen.color()) + qHash(pen.widthF());
}
-static inline uint hash(const QBrush &brush)
+static inline size_t hash(const QBrush &brush)
{
return hash(brush.color()) + (brush.style() << 3);
}
-static inline uint variantHash(const QVariant &variant)
+static inline size_t variantHash(const QVariant &variant)
{
// simple and fast hash functions to differentiate between type and value
switch (variant.userType()) { // sorted by occurrence frequency
- case QVariant::String: return qHash(variant.toString());
- case QVariant::Double: return qHash(variant.toDouble());
- case QVariant::Int: return 0x811890 + variant.toInt();
- case QVariant::Brush:
+ case QMetaType::QString: return qHash(variant.toString());
+ case QMetaType::Double: return qHash(variant.toDouble());
+ case QMetaType::Int: return 0x811890U + variant.toInt();
+ case QMetaType::QBrush:
return 0x01010101 + hash(qvariant_cast<QBrush>(variant));
- case QVariant::Bool: return 0x371818 + variant.toBool();
- case QVariant::Pen: return 0x02020202 + hash(qvariant_cast<QPen>(variant));
- case QVariant::List:
- return 0x8377 + qvariant_cast<QVariantList>(variant).count();
- case QVariant::Color: return hash(qvariant_cast<QColor>(variant));
- case QVariant::TextLength:
+ case QMetaType::Bool: return 0x371818 + variant.toBool();
+ case QMetaType::QPen: return 0x02020202 + hash(qvariant_cast<QPen>(variant));
+ case QMetaType::QVariantList:
+ return 0x8377U + qvariant_cast<QVariantList>(variant).size();
+ case QMetaType::QColor: return hash(qvariant_cast<QColor>(variant));
+ case QMetaType::QTextLength:
return 0x377 + hash(qvariant_cast<QTextLength>(variant).rawValue());
case QMetaType::Float: return qHash(variant.toFloat());
- case QVariant::Invalid: return 0;
+ case QMetaType::UnknownType: return 0;
default: break;
}
return qHash(variant.typeName());
}
-static inline int getHash(const QTextFormatPrivate *d, int format)
+static inline size_t getHash(const QTextFormatPrivate *d, int format)
{
return (d ? d->hash() : 0) + format;
}
-uint QTextFormatPrivate::recalcHash() const
+size_t QTextFormatPrivate::recalcHash() const
{
hashValue = 0;
- for (QVector<Property>::ConstIterator it = props.constBegin(); it != props.constEnd(); ++it)
+ const auto end = props.constEnd();
+ for (auto it = props.constBegin(); it != end; ++it)
hashValue += (static_cast<quint32>(it->key) << 16) + variantHash(it->value);
hashDirty = false;
@@ -326,7 +288,7 @@ uint QTextFormatPrivate::recalcHash() const
void QTextFormatPrivate::resolveFont(const QFont &defaultFont)
{
recalcFont();
- const uint oldMask = fnt.resolve();
+ const uint oldMask = fnt.resolveMask();
fnt = fnt.resolve(defaultFont);
if (hasProperty(QTextFormat::FontSizeAdjustment)) {
@@ -344,7 +306,7 @@ void QTextFormatPrivate::resolveFont(const QFont &defaultFont)
}
}
- fnt.resolve(oldMask);
+ fnt.setResolveMask(oldMask);
}
void QTextFormatPrivate::recalcFont() const
@@ -356,11 +318,8 @@ void QTextFormatPrivate::recalcFont() const
QFont::SpacingType spacingType = QFont::PercentageSpacing;
qreal letterSpacing = 0.0;
- for (int i = 0; i < props.count(); ++i) {
+ for (int i = 0; i < props.size(); ++i) {
switch (props.at(i).key) {
- case QTextFormat::FontFamily:
- f.setFamily(props.at(i).value.toString());
- break;
case QTextFormat::FontFamilies:
f.setFamilies(props.at(i).value.toStringList());
break;
@@ -377,7 +336,7 @@ void QTextFormatPrivate::recalcFont() const
const QVariant weightValue = props.at(i).value;
int weight = weightValue.toInt();
if (weight >= 0 && weightValue.isValid())
- f.setWeight(weight);
+ f.setWeight(QFont::Weight(weight));
break; }
case QTextFormat::FontItalic:
f.setItalic(props.at(i).value.toBool());
@@ -444,7 +403,34 @@ void QTextFormatPrivate::recalcFont() const
#ifndef QT_NO_DATASTREAM
Q_GUI_EXPORT QDataStream &operator<<(QDataStream &stream, const QTextFormat &fmt)
{
- stream << fmt.format_type << fmt.properties();
+ QMap<int, QVariant> properties = fmt.properties();
+ if (stream.version() < QDataStream::Qt_6_0) {
+ auto it = properties.constFind(QTextFormat::FontLetterSpacingType);
+ if (it != properties.cend()) {
+ properties[QTextFormat::OldFontLetterSpacingType] = it.value();
+ properties.erase(it);
+ }
+
+ it = properties.constFind(QTextFormat::FontStretch);
+ if (it != properties.cend()) {
+ properties[QTextFormat::OldFontStretch] = it.value();
+ properties.erase(it);
+ }
+
+ it = properties.constFind(QTextFormat::TextUnderlineColor);
+ if (it != properties.cend()) {
+ properties[QTextFormat::OldTextUnderlineColor] = it.value();
+ properties.erase(it);
+ }
+
+ it = properties.constFind(QTextFormat::FontFamilies);
+ if (it != properties.cend()) {
+ properties[QTextFormat::OldFontFamily] = QVariant(it.value().toStringList().constFirst());
+ properties.erase(it);
+ }
+ }
+
+ stream << fmt.format_type << properties;
return stream;
}
@@ -455,15 +441,75 @@ Q_GUI_EXPORT QDataStream &operator>>(QDataStream &stream, QTextFormat &fmt)
// QTextFormat's default constructor doesn't allocate the private structure, so
// we have to do this, in case fmt is a default constructed value.
- if(!fmt.d)
+ if (!fmt.d)
fmt.d = new QTextFormatPrivate();
for (QMap<qint32, QVariant>::ConstIterator it = properties.constBegin();
- it != properties.constEnd(); ++it)
- fmt.d->insertProperty(it.key(), it.value());
+ it != properties.constEnd(); ++it) {
+ qint32 key = it.key();
+ if (key == QTextFormat::OldFontLetterSpacingType)
+ key = QTextFormat::FontLetterSpacingType;
+ else if (key == QTextFormat::OldFontStretch)
+ key = QTextFormat::FontStretch;
+ else if (key == QTextFormat::OldTextUnderlineColor)
+ key = QTextFormat::TextUnderlineColor;
+ else if (key == QTextFormat::OldFontFamily)
+ key = QTextFormat::FontFamilies;
+ fmt.d->insertProperty(key, it.value());
+ }
return stream;
}
+
+Q_GUI_EXPORT QDataStream &operator<<(QDataStream &stream, const QTextCharFormat &fmt)
+{
+ return stream << static_cast<const QTextFormat &>(fmt);
+}
+
+Q_GUI_EXPORT QDataStream &operator>>(QDataStream &stream, QTextCharFormat &fmt)
+{
+ return stream >> static_cast<QTextFormat &>(fmt);
+}
+
+Q_GUI_EXPORT QDataStream &operator<<(QDataStream &stream, const QTextBlockFormat &fmt)
+{
+ return stream << static_cast<const QTextFormat &>(fmt);
+}
+
+Q_GUI_EXPORT QDataStream &operator>>(QDataStream &stream, QTextBlockFormat &fmt)
+{
+ return stream >> static_cast<QTextFormat &>(fmt);
+}
+
+Q_GUI_EXPORT QDataStream &operator<<(QDataStream &stream, const QTextListFormat &fmt)
+{
+ return stream << static_cast<const QTextFormat &>(fmt);
+}
+
+Q_GUI_EXPORT QDataStream &operator>>(QDataStream &stream, QTextListFormat &fmt)
+{
+ return stream >> static_cast<QTextFormat &>(fmt);
+}
+
+Q_GUI_EXPORT QDataStream &operator<<(QDataStream &stream, const QTextFrameFormat &fmt)
+{
+ return stream << static_cast<const QTextFormat &>(fmt);
+}
+
+Q_GUI_EXPORT QDataStream &operator>>(QDataStream &stream, QTextFrameFormat &fmt)
+{
+ return stream >> static_cast<QTextFormat &>(fmt);
+}
+
+Q_GUI_EXPORT QDataStream &operator<<(QDataStream &stream, const QTextTableCellFormat &fmt)
+{
+ return stream << static_cast<const QTextFormat &>(fmt);
+}
+
+Q_GUI_EXPORT QDataStream &operator>>(QDataStream &stream, QTextTableCellFormat &fmt)
+{
+ return stream >> static_cast<QTextFormat &>(fmt);
+}
#endif // QT_NO_DATASTREAM
/*!
@@ -520,7 +566,6 @@ Q_GUI_EXPORT QDataStream &operator>>(QDataStream &stream, QTextFormat &fmt)
\value BlockFormat The object formats a text block
\value CharFormat The object formats a single character
\value ListFormat The object formats a list
- \omitvalue TableFormat \omit Unused Value, a table's FormatType is FrameFormat. \endomit
\value FrameFormat The object formats a frame
\value UserFormat
@@ -579,7 +624,8 @@ Q_GUI_EXPORT QDataStream &operator>>(QDataStream &stream, QTextFormat &fmt)
Character properties
- \value FontFamily
+ \value FontFamily e{This property has been deprecated.} Use QTextFormat::FontFamilies instead.
+ \omitvalue OldFontFamily
\value FontFamilies
\value FontStyleName
\value FontPointSize
@@ -611,15 +657,22 @@ Q_GUI_EXPORT QDataStream &operator>>(QDataStream &stream, QTextFormat &fmt)
\omitvalue FirstFontProperty
\omitvalue LastFontProperty
- \value TextUnderlineColor
+ \value TextUnderlineColor Specifies the color to draw underlines, overlines and strikeouts.
\value TextVerticalAlignment
\value TextOutline
\value TextUnderlineStyle
\value TextToolTip Specifies the (optional) tool tip to be displayed for a fragment of text.
+ \value TextSuperScriptBaseline Specifies the baseline (in % of height) of superscript texts.
+ \value TextSubScriptBaseline Specifies the baseline (in % of height) of subscript texts.
+ \value TextBaselineOffset Specifies the baseline (in % of height) of text. A positive value moves up the text,
+ by the corresponding %; a negative value moves it down.
\value IsAnchor
\value AnchorHref
\value AnchorName
+ \omitvalue OldFontLetterSpacingType
+ \omitvalue OldFontStretch
+ \omitvalue OldTextUnderlineColor
\value ObjectType
List properties
@@ -631,6 +684,8 @@ Q_GUI_EXPORT QDataStream &operator>>(QDataStream &stream, QTextFormat &fmt)
numeric lists.
\value ListNumberSuffix Defines the text which is appended to item numbers in
numeric lists.
+ \value [since 6.6] ListStart
+ Defines the first value of a list.
Table and frame properties
@@ -690,6 +745,7 @@ Q_GUI_EXPORT QDataStream &operator>>(QDataStream &stream, QTextFormat &fmt)
\value ImageWidth
\value ImageHeight
\value ImageQuality
+ \value ImageMaxWidth This enum value has been added in Qt 6.8.
Selection properties
@@ -874,7 +930,7 @@ QTextFormat::~QTextFormat()
*/
QTextFormat::operator QVariant() const
{
- return QVariant(QVariant::TextFormat, this);
+ return QVariant::fromValue(*this);
}
/*!
@@ -894,13 +950,17 @@ void QTextFormat::merge(const QTextFormat &other)
if (!other.d)
return;
- QTextFormatPrivate *d = this->d;
+ QTextFormatPrivate *p = d.data();
- const QVector<QT_PREPEND_NAMESPACE(Property)> &otherProps = other.d->props;
- d->props.reserve(d->props.size() + otherProps.size());
- for (int i = 0; i < otherProps.count(); ++i) {
- const QT_PREPEND_NAMESPACE(Property) &p = otherProps.at(i);
- d->insertProperty(p.key, p.value);
+ const QList<QT_PREPEND_NAMESPACE(Property)> &otherProps = other.d.constData()->props;
+ p->props.reserve(p->props.size() + otherProps.size());
+ for (int i = 0; i < otherProps.size(); ++i) {
+ const QT_PREPEND_NAMESPACE(Property) &prop = otherProps.at(i);
+ if (prop.value.isValid()) {
+ p->insertProperty(prop.key, prop.value);
+ } else {
+ p->clearProperty(prop.key);
+ }
}
}
@@ -984,7 +1044,7 @@ bool QTextFormat::boolProperty(int propertyId) const
if (!d)
return false;
const QVariant prop = d->property(propertyId);
- if (prop.userType() != QVariant::Bool)
+ if (prop.userType() != QMetaType::Bool)
return false;
return prop.toBool();
}
@@ -1004,14 +1064,14 @@ int QTextFormat::intProperty(int propertyId) const
if (!d)
return def;
const QVariant prop = d->property(propertyId);
- if (prop.userType() != QVariant::Int)
+ if (prop.userType() != QMetaType::Int)
return def;
return prop.toInt();
}
/*!
Returns the value of the property specified by \a propertyId. If the
- property isn't of QVariant::Double or QMetaType::Float type, 0 is
+ property isn't of QMetaType::Double or QMetaType::Float type, 0 is
returned instead.
\sa setProperty(), boolProperty(), intProperty(), stringProperty(), colorProperty(),
@@ -1022,14 +1082,14 @@ qreal QTextFormat::doubleProperty(int propertyId) const
if (!d)
return 0.;
const QVariant prop = d->property(propertyId);
- if (prop.userType() != QVariant::Double && prop.userType() != QMetaType::Float)
+ if (prop.userType() != QMetaType::Double && prop.userType() != QMetaType::Float)
return 0.;
return qvariant_cast<qreal>(prop);
}
/*!
Returns the value of the property given by \a propertyId; if the
- property isn't of QVariant::String type, an empty string is
+ property isn't of QMetaType::QString type, an empty string is
returned instead.
\sa setProperty(), boolProperty(), intProperty(), doubleProperty(), colorProperty(),
@@ -1040,14 +1100,14 @@ QString QTextFormat::stringProperty(int propertyId) const
if (!d)
return QString();
const QVariant prop = d->property(propertyId);
- if (prop.userType() != QVariant::String)
+ if (prop.userType() != QMetaType::QString)
return QString();
return prop.toString();
}
/*!
Returns the value of the property given by \a propertyId; if the
- property isn't of QVariant::Color type, an invalid color is
+ property isn't of QMetaType::QColor type, an invalid color is
returned instead.
\sa setProperty(), boolProperty(), intProperty(), doubleProperty(),
@@ -1058,14 +1118,14 @@ QColor QTextFormat::colorProperty(int propertyId) const
if (!d)
return QColor();
const QVariant prop = d->property(propertyId);
- if (prop.userType() != QVariant::Color)
+ if (prop.userType() != QMetaType::QColor)
return QColor();
return qvariant_cast<QColor>(prop);
}
/*!
Returns the value of the property given by \a propertyId; if the
- property isn't of QVariant::Pen type, Qt::NoPen is
+ property isn't of QMetaType::QPen type, Qt::NoPen is
returned instead.
\sa setProperty(), boolProperty(), intProperty(), doubleProperty(), stringProperty(),
@@ -1076,14 +1136,14 @@ QPen QTextFormat::penProperty(int propertyId) const
if (!d)
return QPen(Qt::NoPen);
const QVariant prop = d->property(propertyId);
- if (prop.userType() != QVariant::Pen)
+ if (prop.userType() != QMetaType::QPen)
return QPen(Qt::NoPen);
return qvariant_cast<QPen>(prop);
}
/*!
Returns the value of the property given by \a propertyId; if the
- property isn't of QVariant::Brush type, Qt::NoBrush is
+ property isn't of QMetaType::QBrush type, Qt::NoBrush is
returned instead.
\sa setProperty(), boolProperty(), intProperty(), doubleProperty(), stringProperty(),
@@ -1094,7 +1154,7 @@ QBrush QTextFormat::brushProperty(int propertyId) const
if (!d)
return QBrush(Qt::NoBrush);
const QVariant prop = d->property(propertyId);
- if (prop.userType() != QVariant::Brush)
+ if (prop.userType() != QMetaType::QBrush)
return QBrush(Qt::NoBrush);
return qvariant_cast<QBrush>(prop);
}
@@ -1114,29 +1174,28 @@ QTextLength QTextFormat::lengthProperty(int propertyId) const
/*!
Returns the value of the property given by \a propertyId. If the
- property isn't of QTextFormat::LengthVector type, an empty length
- vector is returned instead.
+ property isn't of QTextFormat::LengthVector type, an empty
+ list is returned instead.
\sa setProperty(), boolProperty(), intProperty(), doubleProperty(), stringProperty(),
colorProperty(), lengthProperty(), Property
*/
-QVector<QTextLength> QTextFormat::lengthVectorProperty(int propertyId) const
+QList<QTextLength> QTextFormat::lengthVectorProperty(int propertyId) const
{
- QVector<QTextLength> vector;
+ QList<QTextLength> list;
if (!d)
- return vector;
+ return list;
const QVariant prop = d->property(propertyId);
- if (prop.userType() != QVariant::List)
- return vector;
-
- QList<QVariant> propertyList = prop.toList();
- for (int i=0; i<propertyList.size(); ++i) {
- QVariant var = propertyList.at(i);
- if (var.userType() == QVariant::TextLength)
- vector.append(qvariant_cast<QTextLength>(var));
+ if (prop.userType() != QMetaType::QVariantList)
+ return list;
+
+ const QList<QVariant> propertyList = prop.toList();
+ for (const auto &var : propertyList) {
+ if (var.userType() == QMetaType::QTextLength)
+ list.append(qvariant_cast<QTextLength>(var));
}
- return vector;
+ return list;
}
/*!
@@ -1158,10 +1217,8 @@ void QTextFormat::setProperty(int propertyId, const QVariant &value)
{
if (!d)
d = new QTextFormatPrivate;
- if (!value.isValid())
- clearProperty(propertyId);
- else
- d->insertProperty(propertyId, value);
+
+ d->insertProperty(propertyId, value);
}
/*!
@@ -1169,7 +1226,7 @@ void QTextFormat::setProperty(int propertyId, const QVariant &value)
\sa lengthVectorProperty(), Property
*/
-void QTextFormat::setProperty(int propertyId, const QVector<QTextLength> &value)
+void QTextFormat::setProperty(int propertyId, const QList<QTextLength> &value)
{
if (!d)
d = new QTextFormatPrivate;
@@ -1222,7 +1279,7 @@ int QTextFormat::objectIndex() const
if (!d)
return -1;
const QVariant prop = d->property(ObjectIndex);
- if (prop.userType() != QVariant::Int) // ####
+ if (prop.userType() != QMetaType::Int) // ####
return -1;
return prop.toInt();
}
@@ -1237,10 +1294,10 @@ int QTextFormat::objectIndex() const
void QTextFormat::setObjectIndex(int o)
{
if (o == -1) {
- if (d)
+ if (d.constData())
d->clearProperty(ObjectIndex);
} else {
- if (!d)
+ if (!d.constData())
d = new QTextFormatPrivate;
// ### type
d->insertProperty(ObjectIndex, o);
@@ -1271,7 +1328,7 @@ QMap<int, QVariant> QTextFormat::properties() const
{
QMap<int, QVariant> map;
if (d) {
- for (int i = 0; i < d->props.count(); ++i)
+ for (int i = 0; i < d->props.size(); ++i)
map.insert(d->props.at(i).key, d->props.at(i).value);
}
return map;
@@ -1283,7 +1340,7 @@ QMap<int, QVariant> QTextFormat::properties() const
*/
int QTextFormat::propertyCount() const
{
- return d ? d->props.count() : 0;
+ return d ? d->props.size() : 0;
}
/*!
@@ -1336,7 +1393,7 @@ bool QTextFormat::operator==(const QTextFormat &rhs) const
The font used can be set by supplying a font to the setFont() function, and
each aspect of its appearance can be adjusted to give the desired effect.
- setFontFamily() and setFontPointSize() define the font's family (e.g. Times)
+ setFontFamilies() and setFontPointSize() define the font's family (e.g. Times)
and printed size; setFontWeight() and setFontItalic() provide control over
the style of the font. setFontUnderline(), setFontOverline(),
setFontStrikeOut(), and setFontFixedPitch() provide additional effects for
@@ -1381,7 +1438,7 @@ bool QTextFormat::operator==(const QTextFormat &rhs) const
\value SingleUnderline A line is drawn using Qt::SolidLine.
\value DashUnderline Dashes are drawn using Qt::DashLine.
\value DotLine Dots are drawn using Qt::DotLine;
- \value DashDotLine Dashs and dots are drawn using Qt::DashDotLine.
+ \value DashDotLine Dashes and dots are drawn using Qt::DashDotLine.
\value DashDotDotLine Underlines draw drawn using Qt::DashDotDotLine.
\value WaveUnderline The text is underlined using a wave shaped line.
\value SpellCheckUnderline The underline is drawn depending on the SpellCheckUnderlineStyle
@@ -1420,6 +1477,7 @@ QTextCharFormat::QTextCharFormat(const QTextFormat &fmt)
/*!
\fn void QTextCharFormat::setFontFamily(const QString &family)
+ \deprecated [6.1] Use setFontFamilies() instead.
Sets the text format's font \a family.
@@ -1429,6 +1487,7 @@ QTextCharFormat::QTextCharFormat(const QTextFormat &fmt)
/*!
\fn QString QTextCharFormat::fontFamily() const
+ \deprecated [6.1] Use fontFamilies() instead.
Returns the text format's font family.
@@ -1444,7 +1503,21 @@ QTextCharFormat::QTextCharFormat(const QTextFormat &fmt)
\sa setFont()
*/
+#if QT_VERSION < QT_VERSION_CHECK(7, 0, 0)
/*!
+ \fn QVariant QTextCharFormat::fontFamilies() const
+ \since 5.13
+
+ Returns the text format's font families.
+
+ \note This function returns a QVariant for historical reasons. It will be
+ corrected to return QStringList in Qt 7. The variant contains a QStringList
+ object, which can be extracted by calling \c{toStringList()} on it.
+
+ \sa font()
+*/
+#else
+/* // Qt 7 documents this function
\fn QStringList QTextCharFormat::fontFamilies() const
\since 5.13
@@ -1452,6 +1525,7 @@ QTextCharFormat::QTextCharFormat(const QTextFormat &fmt)
\sa font()
*/
+#endif
/*!
\fn void QTextCharFormat::setFontStyleName(const QString &styleName)
@@ -1462,7 +1536,21 @@ QTextCharFormat::QTextCharFormat(const QTextFormat &fmt)
\sa setFont(), QFont::setStyleName()
*/
+#if QT_VERSION < QT_VERSION_CHECK(7, 0, 0)
/*!
+ \fn QVariant QTextCharFormat::fontStyleName() const
+ \since 5.13
+
+ Returns the text format's font style name.
+
+ \note This function returns a QVariant for historical reasons. It will be
+ corrected to return QStringList in Qt 7. The variant contains a QStringList
+ object, which can be extracted by calling \c{toStringList()} on it.
+
+ \sa font(), QFont::styleName()
+*/
+#else
+/* // Qt 7 documents this function
\fn QStringList QTextCharFormat::fontStyleName() const
\since 5.13
@@ -1470,6 +1558,7 @@ QTextCharFormat::QTextCharFormat(const QTextFormat &fmt)
\sa font(), QFont::styleName()
*/
+#endif
/*!
\fn void QTextCharFormat::setFontPointSize(qreal size)
@@ -1775,6 +1864,62 @@ void QTextCharFormat::setUnderlineStyle(UnderlineStyle style)
\sa foreground(), setForeground(), clearBackground()
*/
+/*!
+ \fn void QTextCharFormat::setSuperScriptBaseline(qreal baseline)
+ \since 6.0
+
+ Sets the superscript's base line as a % of font height to \a baseline.
+ The default value is 50% (1/2 of height).
+
+ \sa superScriptBaseline(), setSubScriptBaseline(), subScriptBaseline(), setBaselineOffset(), baselineOffset()
+*/
+
+/*!
+ \fn qreal QTextCharFormat::superScriptBaseline() const
+ \since 6.0
+
+ Returns the superscript's base line as a % of font height.
+
+ \sa setSuperScriptBaseline(), setSubScriptBaseline(), subScriptBaseline(), setBaselineOffset(), baselineOffset()
+*/
+
+/*!
+ \fn void QTextCharFormat::setSubScriptBaseline(qreal baseline)
+ \since 6.0
+
+ Sets the subscript's base line as a % of font height to \a baseline.
+ The default value is 16.67% (1/6 of height)
+
+ \sa subScriptBaseline(), setSuperScriptBaseline(), superScriptBaseline(), setBaselineOffset(), baselineOffset()
+*/
+
+/*!
+ \fn qreal QTextCharFormat::subScriptBaseline() const
+ \since 6.0
+
+ Returns the subscript's base line as a % of font height.
+
+ \sa setSubScriptBaseline(), setSuperScriptBaseline(), superScriptBaseline(), setBaselineOffset(), baselineOffset()
+*/
+
+/*!
+ \fn void QTextCharFormat::setBaselineOffset(qreal baseline)
+ \since 6.0
+
+ Sets the base line (in % of height) of text to \a baseline. A positive value moves the text
+ up, by the corresponding %; a negative value moves it down. The default value is 0.
+
+ \sa baselineOffset(), setSubScriptBaseline(), subScriptBaseline(), setSuperScriptBaseline(), superScriptBaseline()
+*/
+
+/*!
+ \fn qreal QTextCharFormat::baselineOffset() const
+ \since 6.0
+
+ Returns the the baseline offset in %.
+
+ \sa setBaselineOffset(), setSubScriptBaseline(), subScriptBaseline(), setSuperScriptBaseline(), superScriptBaseline()
+*/
/*!
\fn void QTextCharFormat::setAnchor(bool anchor)
@@ -1822,20 +1967,6 @@ void QTextCharFormat::setUnderlineStyle(UnderlineStyle style)
none has been set.
*/
-
-#if QT_DEPRECATED_SINCE(5, 13)
-/*!
- \fn void QTextCharFormat::setAnchorName(const QString &name)
- \obsolete
-
- This function is deprecated. Use setAnchorNames() instead.
-
- Sets the text format's anchor \a name. For the anchor to work as a
- hyperlink, the destination must be set with setAnchorHref() and
- the anchor must be enabled with setAnchor().
-*/
-#endif
-
/*!
\fn void QTextCharFormat::setAnchorNames(const QStringList &names)
\since 4.3
@@ -1845,28 +1976,6 @@ void QTextCharFormat::setUnderlineStyle(UnderlineStyle style)
the anchor must be enabled with setAnchor().
*/
-#if QT_DEPRECATED_SINCE(5, 13)
-/*!
- \fn QString QTextCharFormat::anchorName() const
- \obsolete
-
- This function is deprecated. Use anchorNames() instead.
-
- Returns the anchor name associated with this text format, or an empty
- string if none has been set. If the anchor name is set, text with this
- format can be the destination of a hypertext link.
-*/
-QString QTextCharFormat::anchorName() const
-{
- QVariant prop = property(AnchorName);
- if (prop.userType() == QVariant::StringList)
- return prop.toStringList().value(0);
- else if (prop.userType() != QVariant::String)
- return QString();
- return prop.toString();
-}
-#endif
-
/*!
\fn QStringList QTextCharFormat::anchorNames() const
\since 4.3
@@ -1878,9 +1987,9 @@ QString QTextCharFormat::anchorName() const
QStringList QTextCharFormat::anchorNames() const
{
QVariant prop = property(AnchorName);
- if (prop.userType() == QVariant::StringList)
+ if (prop.userType() == QMetaType::QStringList)
return prop.toStringList();
- else if (prop.userType() != QVariant::String)
+ else if (prop.userType() != QMetaType::QString)
return QStringList();
return QStringList(prop.toString());
}
@@ -1925,8 +2034,8 @@ QStringList QTextCharFormat::anchorNames() const
/*!
\fn void QTextCharFormat::setUnderlineColor(const QColor &color)
- Sets the underline color used for the characters with this format to
- the \a color specified.
+ Sets the color used to draw underlines, overlines and strikeouts on the
+ characters with this format to the \a color specified.
\sa underlineColor()
*/
@@ -1934,7 +2043,8 @@ QStringList QTextCharFormat::anchorNames() const
/*!
\fn QColor QTextCharFormat::underlineColor() const
- Returns the color used to underline the characters with this format.
+ Returns the color used to draw underlines, overlines and strikeouts
+ on the characters with this format.
\sa setUnderlineColor()
*/
@@ -1972,18 +2082,6 @@ QStringList QTextCharFormat::anchorNames() const
*/
/*!
- \overload
-
- Sets the text format's \a font.
-
- \sa font()
-*/
-void QTextCharFormat::setFont(const QFont &font)
-{
- setFont(font, FontPropertiesAll);
-}
-
-/*!
\since 5.3
Sets the text format's \a font.
@@ -1999,10 +2097,8 @@ void QTextCharFormat::setFont(const QFont &font)
void QTextCharFormat::setFont(const QFont &font, FontPropertiesInheritanceBehavior behavior)
{
const uint mask = behavior == FontPropertiesAll ? uint(QFont::AllPropertiesResolved)
- : font.resolve();
+ : font.resolveMask();
- if (mask & QFont::FamilyResolved)
- setFontFamily(font.family());
if (mask & QFont::FamiliesResolved)
setFontFamilies(font.families());
if (mask & QFont::StyleNameResolved)
@@ -2076,7 +2172,7 @@ QFont QTextCharFormat::font() const
associated QTextBlockFormat that specifies its characteristics.
To cater for left-to-right and right-to-left languages you can set
- a block's direction with setDirection(). Paragraph alignment is
+ a block's direction with setLayoutDirection(). Paragraph alignment is
set with setAlignment(). Margins are controlled by setTopMargin(),
setBottomMargin(), setLeftMargin(), setRightMargin(). Overall
indentation is set with setIndent(), the indentation of the first
@@ -2146,14 +2242,9 @@ QTextBlockFormat::QTextBlockFormat(const QTextFormat &fmt)
void QTextBlockFormat::setTabPositions(const QList<QTextOption::Tab> &tabs)
{
QList<QVariant> list;
- list.reserve(tabs.count());
- QList<QTextOption::Tab>::ConstIterator iter = tabs.constBegin();
- while (iter != tabs.constEnd()) {
- QVariant v;
- v.setValue<QTextOption::Tab>(*iter);
- list.append(v);
- ++iter;
- }
+ list.reserve(tabs.size());
+ for (const auto &e : tabs)
+ list.append(QVariant::fromValue(e));
setProperty(TabPositions, list);
}
@@ -2166,16 +2257,13 @@ void QTextBlockFormat::setTabPositions(const QList<QTextOption::Tab> &tabs)
QList<QTextOption::Tab> QTextBlockFormat::tabPositions() const
{
QVariant variant = property(TabPositions);
- if(variant.isNull())
+ if (variant.isNull())
return QList<QTextOption::Tab>();
QList<QTextOption::Tab> answer;
- QList<QVariant> variantsList = qvariant_cast<QList<QVariant> >(variant);
- QList<QVariant>::Iterator iter = variantsList.begin();
- answer.reserve(variantsList.count());
- while(iter != variantsList.end()) {
- answer.append( qvariant_cast<QTextOption::Tab>(*iter));
- ++iter;
- }
+ const QList<QVariant> variantsList = qvariant_cast<QList<QVariant> >(variant);
+ answer.reserve(variantsList.size());
+ for (const auto &e: variantsList)
+ answer.append(qvariant_cast<QTextOption::Tab>(e));
return answer;
}
@@ -2519,7 +2607,8 @@ QList<QTextOption::Tab> QTextBlockFormat::tabPositions() const
The style used to decorate each item is set with setStyle() and can be read
with the style() function. The style controls the type of bullet points and
numbering scheme used for items in the list. Note that lists that use the
- decimal numbering scheme begin counting at 1 rather than 0.
+ decimal numbering scheme begin counting at 1 rather than 0, unless it has
+ been overridden via setStart().
Style properties can be set to further configure the appearance of list
items; for example, the ListNumberPrefix and ListNumberSuffix properties
@@ -2556,6 +2645,7 @@ QTextListFormat::QTextListFormat()
: QTextFormat(ListFormat)
{
setIndent(1);
+ setStart(1);
}
/*!
@@ -2660,6 +2750,32 @@ QTextListFormat::QTextListFormat(const QTextFormat &fmt)
*/
/*!
+ \fn void QTextListFormat::setStart(int start)
+ \since 6.6
+
+ Sets the list format's \a start index.
+
+ This allows you to start a list with an index other than 1. This can be
+ used with all sorted list types: for example if the style() is
+ QTextListFormat::ListLowerAlpha and start() is \c 4, the first list item
+ begins with "d". It does not have any effect on unsorted list types.
+
+ The default start is \c 1.
+
+ \sa start()
+*/
+
+/*!
+ \fn int QTextListFormat::start() const
+ \since 6.6
+
+ Returns the number to be shown by the first list item, if the style() is
+ QTextListFormat::ListDecimal, or to offset other sorted list types.
+
+ \sa setStart()
+*/
+
+/*!
\class QTextFrameFormat
\reentrant
@@ -3026,7 +3142,7 @@ qreal QTextFrameFormat::rightMargin() const
returns the number of columns with constraints, and the
columnWidthConstraints() function returns the constraints defined for the
table. These quantities can also be set by calling setColumnWidthConstraints()
- with a vector containing new constraints. If no constraints are
+ with a list containing new constraints. If no constraints are
required, clearColumnWidthConstraints() can be used to remove them.
\sa QTextTable, QTextTableCell, QTextLength
@@ -3041,7 +3157,8 @@ QTextTableFormat::QTextTableFormat()
: QTextFrameFormat()
{
setObjectType(TableObject);
- setCellSpacing(2);
+ setCellPadding(4);
+ setBorderCollapse(true);
setBorder(1);
}
@@ -3090,7 +3207,7 @@ QTextTableFormat::QTextTableFormat(const QTextFormat &fmt)
*/
/*!
- \fn void QTextTableFormat::setColumnWidthConstraints(const QVector<QTextLength> &constraints)
+ \fn void QTextTableFormat::setColumnWidthConstraints(const QList<QTextLength> &constraints)
Sets the column width \a constraints for the table.
@@ -3098,7 +3215,7 @@ QTextTableFormat::QTextTableFormat(const QTextFormat &fmt)
*/
/*!
- \fn QVector<QTextLength> QTextTableFormat::columnWidthConstraints() const
+ \fn QList<QTextLength> QTextTableFormat::columnWidthConstraints() const
Returns a list of constraints used by this table format to control the
appearance of columns in a table.
@@ -3310,7 +3427,7 @@ QTextImageFormat::QTextImageFormat(const QTextFormat &fmt)
Sets the \a width of the rectangle occupied by the image.
- \sa width(), setHeight()
+ \sa width(), setHeight(), maximumWidth()
*/
@@ -3322,6 +3439,24 @@ QTextImageFormat::QTextImageFormat(const QTextFormat &fmt)
\sa height(), setWidth()
*/
+/*!
+ \fn void QTextImageFormat::setMaximumWidth(QTextLength maximumWidth)
+
+ Sets the \a maximumWidth of the rectangle occupied by the image. This
+ can be an absolute number or a percentage of the available document size.
+
+ \sa width(), setHeight()
+*/
+
+
+/*!
+ \fn QTextLength QTextImageFormat::maximumWidth() const
+
+ Returns the maximum width of the rectangle occupied by the image.
+
+ \sa width(), setMaximumWidth()
+*/
+
/*!
\fn void QTextImageFormat::setHeight(qreal height)
@@ -3366,7 +3501,7 @@ QTextImageFormat::QTextImageFormat(const QTextFormat &fmt)
\fn void QTextCharFormat::setFontCapitalization(QFont::Capitalization capitalization)
\since 4.4
- Sets the capitalization of the text that apppears in this font to \a capitalization.
+ Sets the capitalization of the text that appears in this font to \a capitalization.
A font's capitalization makes the text appear in the selected capitalization mode.
@@ -3836,8 +3971,8 @@ void QTextFormatCollection::clear()
int QTextFormatCollection::indexForFormat(const QTextFormat &format)
{
- uint hash = getHash(format.d, format.format_type);
- QMultiHash<uint, int>::const_iterator i = hashes.constFind(hash);
+ size_t hash = getHash(format.d, format.format_type);
+ auto i = hashes.constFind(hash);
while (i != hashes.constEnd() && i.key() == hash) {
if (formats.value(i.value()) == format) {
return i.value();
@@ -3865,8 +4000,8 @@ int QTextFormatCollection::indexForFormat(const QTextFormat &format)
bool QTextFormatCollection::hasFormatCached(const QTextFormat &format) const
{
- uint hash = getHash(format.d, format.format_type);
- QMultiHash<uint, int>::const_iterator i = hashes.constFind(hash);
+ size_t hash = getHash(format.d, format.format_type);
+ auto i = hashes.constFind(hash);
while (i != hashes.constEnd() && i.key() == hash) {
if (formats.value(i.value()) == format) {
return true;
@@ -3878,7 +4013,7 @@ bool QTextFormatCollection::hasFormatCached(const QTextFormat &format) const
int QTextFormatCollection::objectFormatIndex(int objectIndex) const
{
- if (objectIndex == -1)
+ if (objectIndex == -1 || objectIndex >= objFormats.size())
return -1;
return objFormats.at(objectIndex);
}
@@ -3897,7 +4032,7 @@ int QTextFormatCollection::createObjectIndex(const QTextFormat &f)
QTextFormat QTextFormatCollection::format(int idx) const
{
- if (idx < 0 || idx >= formats.count())
+ if (idx < 0 || idx >= formats.size())
return QTextFormat();
return formats.at(idx);
@@ -3906,7 +4041,7 @@ QTextFormat QTextFormatCollection::format(int idx) const
void QTextFormatCollection::setDefaultFont(const QFont &f)
{
defaultFnt = f;
- for (int i = 0; i < formats.count(); ++i)
+ for (int i = 0; i < formats.size(); ++i)
if (formats.at(i).d)
formats[i].d->resolveFont(defaultFnt);
}
@@ -3929,3 +4064,5 @@ QDebug operator<<(QDebug dbg, const QTextFormat &f)
#endif
QT_END_NAMESPACE
+
+#include "moc_qtextformat.cpp"
diff --git a/src/gui/text/qtextformat.h b/src/gui/text/qtextformat.h
index 28da0fe344..2fa86ed0d1 100644
--- a/src/gui/text/qtextformat.h
+++ b/src/gui/text/qtextformat.h
@@ -1,54 +1,19 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the QtGui module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2021 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#ifndef QTEXTFORMAT_H
#define QTEXTFORMAT_H
-#include <QtGui/qtguiglobal.h>
+#include <QtGui/qbrush.h>
#include <QtGui/qcolor.h>
#include <QtGui/qfont.h>
-#include <QtCore/qshareddata.h>
-#include <QtCore/qvector.h>
-#include <QtCore/qvariant.h>
#include <QtGui/qpen.h>
-#include <QtGui/qbrush.h>
#include <QtGui/qtextoption.h>
+#include <QtGui/qtguiglobal.h>
+
+#include <QtCore/qlist.h>
+#include <QtCore/qshareddata.h>
+#include <QtCore/qvariant.h>
QT_BEGIN_NAMESPACE
@@ -72,11 +37,6 @@ class QTextCursor;
class QTextDocument;
class QTextLength;
-#ifndef QT_NO_DATASTREAM
-Q_GUI_EXPORT QDataStream &operator<<(QDataStream &, const QTextLength &);
-Q_GUI_EXPORT QDataStream &operator>>(QDataStream &, QTextLength &);
-#endif
-
#ifndef QT_NO_DEBUG_STREAM
Q_GUI_EXPORT QDebug operator<<(QDebug, const QTextLength &);
#endif
@@ -117,16 +77,11 @@ private:
friend Q_GUI_EXPORT QDataStream &operator<<(QDataStream &, const QTextLength &);
friend Q_GUI_EXPORT QDataStream &operator>>(QDataStream &, QTextLength &);
};
-Q_DECLARE_TYPEINFO(QTextLength, QT_VERSION >= QT_VERSION_CHECK(6,0,0) ? Q_PRIMITIVE_TYPE : Q_RELOCATABLE_TYPE);
+Q_DECLARE_TYPEINFO(QTextLength, Q_PRIMITIVE_TYPE);
inline QTextLength::QTextLength(Type atype, qreal avalue)
: lengthType(atype), fixedValueOrPercentage(avalue) {}
-#ifndef QT_NO_DATASTREAM
-Q_GUI_EXPORT QDataStream &operator<<(QDataStream &, const QTextFormat &);
-Q_GUI_EXPORT QDataStream &operator>>(QDataStream &, QTextFormat &);
-#endif
-
#ifndef QT_NO_DEBUG_STREAM
Q_GUI_EXPORT QDebug operator<<(QDebug, const QTextFormat &);
#endif
@@ -140,9 +95,6 @@ public:
BlockFormat = 1,
CharFormat = 2,
ListFormat = 3,
-#if QT_DEPRECATED_SINCE(5, 3)
- TableFormat = 4,
-#endif
FrameFormat = 5,
UserFormat = 100
@@ -184,17 +136,19 @@ public:
// character properties
FirstFontProperty = 0x1FE0,
FontCapitalization = FirstFontProperty,
- FontLetterSpacingType = 0x2033,
FontLetterSpacing = 0x1FE1,
FontWordSpacing = 0x1FE2,
- FontStretch = 0x2034,
FontStyleHint = 0x1FE3,
FontStyleStrategy = 0x1FE4,
FontKerning = 0x1FE5,
FontHintingPreference = 0x1FE6,
FontFamilies = 0x1FE7,
FontStyleName = 0x1FE8,
+ FontLetterSpacingType = 0x1FE9,
+ FontStretch = 0x1FEA,
+#if QT_DEPRECATED_SINCE(6, 0)
FontFamily = 0x2000,
+#endif
FontPointSize = 0x2001,
FontSizeAdjustment = 0x2002,
FontSizeIncrement = FontSizeAdjustment, // old name, compat
@@ -207,15 +161,26 @@ public:
FontPixelSize = 0x2009,
LastFontProperty = FontPixelSize,
- TextUnderlineColor = 0x2010,
+ TextUnderlineColor = 0x2020,
TextVerticalAlignment = 0x2021,
TextOutline = 0x2022,
TextUnderlineStyle = 0x2023,
TextToolTip = 0x2024,
+ TextSuperScriptBaseline = 0x2025,
+ TextSubScriptBaseline = 0x2026,
+ TextBaselineOffset = 0x2027,
IsAnchor = 0x2030,
AnchorHref = 0x2031,
AnchorName = 0x2032,
+
+ // Included for backwards compatibility with old QDataStreams.
+ // Should not be referenced in user code.
+ OldFontLetterSpacingType = 0x2033,
+ OldFontStretch = 0x2034,
+ OldTextUnderlineColor = 0x2010,
+ OldFontFamily = 0x2000, // same as FontFamily
+
ObjectType = 0x2f00,
// list properties
@@ -223,6 +188,7 @@ public:
ListIndent = 0x3001,
ListNumberPrefix = 0x3002,
ListNumberSuffix = 0x3003,
+ ListStart = 0x3004,
// table and frame properties
FrameBorder = 0x4000,
@@ -275,6 +241,7 @@ public:
ImageWidth = 0x5010,
ImageHeight = 0x5011,
ImageQuality = 0x5014,
+ ImageMaxWidth = 0x5015,
// internal
/*
@@ -320,7 +287,7 @@ public:
~QTextFormat();
void swap(QTextFormat &other)
- { qSwap(d, other.d); qSwap(format_type, other.format_type); }
+ { d.swap(other.d); std::swap(format_type, other.format_type); }
void merge(const QTextFormat &other);
@@ -345,9 +312,9 @@ public:
QPen penProperty(int propertyId) const;
QBrush brushProperty(int propertyId) const;
QTextLength lengthProperty(int propertyId) const;
- QVector<QTextLength> lengthVectorProperty(int propertyId) const;
+ QList<QTextLength> lengthVectorProperty(int propertyId) const;
- void setProperty(int propertyId, const QVector<QTextLength> &lengths);
+ void setProperty(int propertyId, const QList<QTextLength> &lengths);
QMap<int, QVariant> properties() const;
int propertyCount() const;
@@ -443,24 +410,35 @@ public:
FontPropertiesSpecifiedOnly,
FontPropertiesAll
};
- void setFont(const QFont &font, FontPropertiesInheritanceBehavior behavior);
- void setFont(const QFont &font); // ### Qt6: Merge with above
+ void setFont(const QFont &font, FontPropertiesInheritanceBehavior behavior = FontPropertiesAll);
QFont font() const;
- inline void setFontFamily(const QString &family)
- { setProperty(FontFamily, family); }
- inline QString fontFamily() const
- { return stringProperty(FontFamily); }
+#if QT_DEPRECATED_SINCE(6, 1)
+ QT_DEPRECATED_VERSION_X_6_1("Use setFontFamilies instead") inline void setFontFamily(const QString &family)
+ { setProperty(FontFamilies, QVariant(QStringList(family))); }
+ QT_DEPRECATED_VERSION_X_6_1("Use fontFamilies instead") inline QString fontFamily() const
+ { return property(FontFamilies).toStringList().first(); }
+#endif
inline void setFontFamilies(const QStringList &families)
{ setProperty(FontFamilies, QVariant(families)); }
+#if QT_VERSION < QT_VERSION_CHECK(7, 0, 0)
inline QVariant fontFamilies() const
{ return property(FontFamilies); }
+#else
+ inline QStringList fontFamilies() const
+ { return property(FontFamilies).toStringList(); }
+#endif
inline void setFontStyleName(const QString &styleName)
{ setProperty(FontStyleName, styleName); }
+#if QT_VERSION < QT_VERSION_CHECK(7, 0, 0)
inline QVariant fontStyleName() const
{ return property(FontStyleName); }
+#else
+ inline QStringList fontStyleName() const
+ { return property(FontStyleName).toStringList(); }
+#endif
inline void setFontPointSize(qreal size)
{ setProperty(FontPointSize, size); }
@@ -564,6 +542,21 @@ public:
inline QString toolTip() const
{ return stringProperty(TextToolTip); }
+ inline void setSuperScriptBaseline(qreal baseline)
+ { setProperty(TextSuperScriptBaseline, baseline); }
+ inline qreal superScriptBaseline() const
+ { return hasProperty(TextSuperScriptBaseline) ? doubleProperty(TextSuperScriptBaseline) : 50.0; }
+
+ inline void setSubScriptBaseline(qreal baseline)
+ { setProperty(TextSubScriptBaseline, baseline); }
+ inline qreal subScriptBaseline() const
+ { return hasProperty(TextSubScriptBaseline) ? doubleProperty(TextSubScriptBaseline) : 100.0 / 6.0; }
+
+ inline void setBaselineOffset(qreal baseline)
+ { setProperty(TextBaselineOffset, baseline); }
+ inline qreal baselineOffset() const
+ { return hasProperty(TextBaselineOffset) ? doubleProperty(TextBaselineOffset) : 0.0; }
+
inline void setAnchor(bool anchor)
{ setProperty(IsAnchor, anchor); }
inline bool isAnchor() const
@@ -574,14 +567,6 @@ public:
inline QString anchorHref() const
{ return stringProperty(AnchorHref); }
-#if QT_DEPRECATED_SINCE(5, 13)
- QT_DEPRECATED_X("Use setAnchorNames() instead")
- inline void setAnchorName(const QString &name)
- { setAnchorNames(QStringList(name)); }
- QT_DEPRECATED_X("Use anchorNames() instead")
- QString anchorName() const;
-#endif
-
inline void setAnchorNames(const QStringList &names)
{ setProperty(AnchorName, names); }
QStringList anchorNames() const;
@@ -596,6 +581,8 @@ public:
protected:
explicit QTextCharFormat(const QTextFormat &fmt);
friend class QTextFormat;
+ friend Q_GUI_EXPORT QDataStream &operator<<(QDataStream &, const QTextCharFormat &);
+ friend Q_GUI_EXPORT QDataStream &operator>>(QDataStream &, QTextCharFormat &);
};
Q_DECLARE_SHARED(QTextCharFormat)
@@ -689,7 +676,7 @@ public:
{ return boolProperty(BlockNonBreakableLines); }
inline void setPageBreakPolicy(PageBreakFlags flags)
- { setProperty(PageBreakPolicy, int(flags)); }
+ { setProperty(PageBreakPolicy, int(flags.toInt())); }
inline PageBreakFlags pageBreakPolicy() const
{ return PageBreakFlags(intProperty(PageBreakPolicy)); }
@@ -704,12 +691,14 @@ public:
protected:
explicit QTextBlockFormat(const QTextFormat &fmt);
friend class QTextFormat;
+ friend Q_GUI_EXPORT QDataStream &operator<<(QDataStream &, const QTextBlockFormat &);
+ friend Q_GUI_EXPORT QDataStream &operator>>(QDataStream &, QTextBlockFormat &);
};
Q_DECLARE_SHARED(QTextBlockFormat)
inline void QTextBlockFormat::setAlignment(Qt::Alignment aalignment)
-{ setProperty(BlockAlignment, int(aalignment)); }
+{ setProperty(BlockAlignment, int(aalignment.toInt())); }
inline void QTextBlockFormat::setIndent(int aindent)
{ setProperty(BlockIndent, aindent); }
@@ -766,6 +755,9 @@ public:
inline QString numberSuffix() const
{ return stringProperty(ListNumberSuffix); }
+ inline void setStart(int indent);
+ inline int start() const { return intProperty(ListStart); }
+
protected:
explicit QTextListFormat(const QTextFormat &fmt);
friend class QTextFormat;
@@ -785,6 +777,11 @@ inline void QTextListFormat::setNumberPrefix(const QString &np)
inline void QTextListFormat::setNumberSuffix(const QString &ns)
{ setProperty(ListNumberSuffix, ns); }
+inline void QTextListFormat::setStart(int astart)
+{
+ setProperty(ListStart, astart);
+}
+
class Q_GUI_EXPORT QTextImageFormat : public QTextCharFormat
{
public:
@@ -800,17 +797,27 @@ public:
inline qreal width() const
{ return doubleProperty(ImageWidth); }
+ inline void setMaximumWidth(QTextLength maxWidth);
+ inline QTextLength maximumWidth() const
+ { return lengthProperty(ImageMaxWidth); }
+
inline void setHeight(qreal height);
inline qreal height() const
{ return doubleProperty(ImageHeight); }
- inline void setQuality(int quality = 100);
+ inline void setQuality(int quality);
+#if QT_DEPRECATED_SINCE(6, 3)
+ QT_DEPRECATED_VERSION_X_6_3("Pass a quality value, the default is 100") inline void setQuality()
+ { setQuality(100); }
+#endif
inline int quality() const
{ return intProperty(ImageQuality); }
protected:
explicit QTextImageFormat(const QTextFormat &format);
friend class QTextFormat;
+ friend Q_GUI_EXPORT QDataStream &operator<<(QDataStream &, const QTextListFormat &);
+ friend Q_GUI_EXPORT QDataStream &operator>>(QDataStream &, QTextListFormat &);
};
Q_DECLARE_SHARED(QTextImageFormat)
@@ -821,6 +828,9 @@ inline void QTextImageFormat::setName(const QString &aname)
inline void QTextImageFormat::setWidth(qreal awidth)
{ setProperty(ImageWidth, awidth); }
+inline void QTextImageFormat::setMaximumWidth(QTextLength maxWidth)
+{ setProperty(ImageMaxWidth, maxWidth); }
+
inline void QTextImageFormat::setHeight(qreal aheight)
{ setProperty(ImageHeight, aheight); }
@@ -907,13 +917,15 @@ public:
{ return lengthProperty(FrameHeight); }
inline void setPageBreakPolicy(PageBreakFlags flags)
- { setProperty(PageBreakPolicy, int(flags)); }
+ { setProperty(PageBreakPolicy, int(flags.toInt())); }
inline PageBreakFlags pageBreakPolicy() const
{ return PageBreakFlags(intProperty(PageBreakPolicy)); }
protected:
explicit QTextFrameFormat(const QTextFormat &fmt);
friend class QTextFormat;
+ friend Q_GUI_EXPORT QDataStream &operator<<(QDataStream &, const QTextFrameFormat &);
+ friend Q_GUI_EXPORT QDataStream &operator>>(QDataStream &, QTextFrameFormat &);
};
Q_DECLARE_SHARED(QTextFrameFormat)
@@ -955,10 +967,10 @@ public:
{ int cols = intProperty(TableColumns); if (cols == 0) cols = 1; return cols; }
inline void setColumns(int columns);
- inline void setColumnWidthConstraints(const QVector<QTextLength> &constraints)
+ inline void setColumnWidthConstraints(const QList<QTextLength> &constraints)
{ setProperty(TableColumnWidthConstraints, constraints); }
- inline QVector<QTextLength> columnWidthConstraints() const
+ inline QList<QTextLength> columnWidthConstraints() const
{ return lengthVectorProperty(TableColumnWidthConstraints); }
inline void clearColumnWidthConstraints()
@@ -1005,7 +1017,7 @@ inline void QTextTableFormat::setCellPadding(qreal apadding)
{ setProperty(TableCellPadding, apadding); }
inline void QTextTableFormat::setAlignment(Qt::Alignment aalignment)
-{ setProperty(BlockAlignment, int(aalignment)); }
+{ setProperty(BlockAlignment, int(aalignment.toInt())); }
class Q_GUI_EXPORT QTextTableCellFormat : public QTextCharFormat
{
@@ -1096,6 +1108,8 @@ public:
protected:
explicit QTextTableCellFormat(const QTextFormat &fmt);
+ friend Q_GUI_EXPORT QDataStream &operator<<(QDataStream &, const QTextTableCellFormat &);
+ friend Q_GUI_EXPORT QDataStream &operator>>(QDataStream &, QTextTableCellFormat &);
friend class QTextFormat;
};
diff --git a/src/gui/text/qtextformat_p.h b/src/gui/text/qtextformat_p.h
index 001a243e84..1bd9120513 100644
--- a/src/gui/text/qtextformat_p.h
+++ b/src/gui/text/qtextformat_p.h
@@ -1,41 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the QtGui module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#ifndef QTEXTFORMAT_P_H
#define QTEXTFORMAT_P_H
@@ -53,7 +17,8 @@
#include <QtGui/private/qtguiglobal_p.h>
#include "QtGui/qtextformat.h"
-#include "QtCore/qvector.h"
+#include "QtCore/qlist.h"
+#include <QtCore/qhash.h> // QMultiHash
QT_BEGIN_NAMESPACE
@@ -90,19 +55,26 @@ public:
inline QTextImageFormat imageFormat(int index) const
{ return format(index).toImageFormat(); }
- inline int numFormats() const { return formats.count(); }
+ inline int numFormats() const { return formats.size(); }
- typedef QVector<QTextFormat> FormatVector;
+ typedef QList<QTextFormat> FormatVector;
FormatVector formats;
- QVector<qint32> objFormats;
- QMultiHash<uint,int> hashes;
+ QList<qint32> objFormats;
+ QMultiHash<size_t,int> hashes;
inline QFont defaultFont() const { return defaultFnt; }
void setDefaultFont(const QFont &f);
+ inline void setSuperScriptBaseline(qreal baseline) { defaultFormat.setSuperScriptBaseline(baseline); }
+ inline void setSubScriptBaseline(qreal baseline) { defaultFormat.setSubScriptBaseline(baseline); }
+ inline void setBaselineOffset(qreal baseline) { defaultFormat.setBaselineOffset(baseline); }
+
+ inline QTextCharFormat defaultTextFormat() const { return defaultFormat; }
+
private:
QFont defaultFnt;
+ QTextCharFormat defaultFormat;
Q_DISABLE_COPY_MOVE(QTextFormatCollection)
};
diff --git a/src/gui/text/qtexthtmlparser.cpp b/src/gui/text/qtexthtmlparser.cpp
index 3b9f2d253e..bc2200697d 100644
--- a/src/gui/text/qtexthtmlparser.cpp
+++ b/src/gui/text/qtexthtmlparser.cpp
@@ -1,41 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the QtGui module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#include "qtexthtmlparser_p.h"
@@ -57,9 +21,11 @@
QT_BEGIN_NAMESPACE
+using namespace Qt::StringLiterals;
+
// see also tst_qtextdocumentfragment.cpp
#define MAX_ENTITY 258
-static const struct QTextHtmlEntity { const char name[9]; quint16 code; } entities[]= {
+static const struct QTextHtmlEntity { const char name[9]; char16_t code; } entities[]= {
{ "AElig", 0x00c6 },
{ "AMP", 38 },
{ "Aacute", 0x00c1 },
@@ -319,26 +285,26 @@ static const struct QTextHtmlEntity { const char name[9]; quint16 code; } entiti
{ "zwj", 0x200d },
{ "zwnj", 0x200c }
};
-Q_STATIC_ASSERT(MAX_ENTITY == sizeof entities / sizeof *entities);
+static_assert(MAX_ENTITY == sizeof entities / sizeof *entities);
-#if defined(Q_CC_MSVC) && _MSC_VER < 1600
+#if defined(Q_CC_MSVC_ONLY) && _MSC_VER < 1600
bool operator<(const QTextHtmlEntity &entity1, const QTextHtmlEntity &entity2)
{
- return QLatin1String(entity1.name) < QLatin1String(entity2.name);
+ return QLatin1StringView(entity1.name) < QLatin1StringView(entity2.name);
}
#endif
-static bool operator<(const QStringRef &entityStr, const QTextHtmlEntity &entity)
+static bool operator<(QStringView entityStr, const QTextHtmlEntity &entity)
{
- return entityStr < QLatin1String(entity.name);
+ return entityStr < QLatin1StringView(entity.name);
}
-static bool operator<(const QTextHtmlEntity &entity, const QStringRef &entityStr)
+static bool operator<(const QTextHtmlEntity &entity, QStringView entityStr)
{
- return QLatin1String(entity.name) < entityStr;
+ return QLatin1StringView(entity.name) < entityStr;
}
-static QChar resolveEntity(const QStringRef &entity)
+static QChar resolveEntity(QStringView entity)
{
const QTextHtmlEntity *start = &entities[0];
const QTextHtmlEntity *end = &entities[MAX_ENTITY];
@@ -447,17 +413,17 @@ static const QTextHtmlElement elements[Html_NumElements]= {
{ "var", Html_var, QTextHtmlElement::DisplayInline },
};
-static bool operator<(const QString &str, const QTextHtmlElement &e)
+static bool operator<(QStringView str, const QTextHtmlElement &e)
{
- return str < QLatin1String(e.name);
+ return str < QLatin1StringView(e.name);
}
-static bool operator<(const QTextHtmlElement &e, const QString &str)
+static bool operator<(const QTextHtmlElement &e, QStringView str)
{
- return QLatin1String(e.name) < str;
+ return QLatin1StringView(e.name) < str;
}
-static const QTextHtmlElement *lookupElementHelper(const QString &element)
+static const QTextHtmlElement *lookupElementHelper(QStringView element)
{
const QTextHtmlElement *start = &elements[0];
const QTextHtmlElement *end = &elements[Html_NumElements];
@@ -467,7 +433,7 @@ static const QTextHtmlElement *lookupElementHelper(const QString &element)
return e;
}
-int QTextHtmlParser::lookupElement(const QString &element)
+int QTextHtmlParser::lookupElement(QStringView element)
{
const QTextHtmlElement *e = lookupElementHelper(element);
if (!e)
@@ -479,7 +445,7 @@ int QTextHtmlParser::lookupElement(const QString &element)
static QString quoteNewline(const QString &s)
{
QString n = s;
- n.replace(QLatin1Char('\n'), QLatin1String("\\n"));
+ n.replace(u'\n', "\\n"_L1);
return n;
}
@@ -509,21 +475,20 @@ QTextHtmlParserNode::QTextHtmlParserNode()
void QTextHtmlParser::dumpHtml()
{
for (int i = 0; i < count(); ++i) {
- qDebug().nospace() << qPrintable(QString(depth(i)*4, QLatin1Char(' ')))
+ qDebug().nospace() << qPrintable(QString(depth(i) * 4, u' '))
<< qPrintable(at(i).tag) << ':'
<< quoteNewline(at(i).text);
- ;
}
}
QTextHtmlParserNode *QTextHtmlParser::newNode(int parent)
{
- QTextHtmlParserNode *lastNode = &nodes.last();
+ QTextHtmlParserNode *lastNode = nodes.last();
QTextHtmlParserNode *newNode = nullptr;
bool reuseLastNode = true;
- if (nodes.count() == 1) {
+ if (nodes.size() == 1) {
reuseLastNode = false;
} else if (lastNode->tag.isEmpty()) {
@@ -531,7 +496,7 @@ QTextHtmlParserNode *QTextHtmlParser::newNode(int parent)
reuseLastNode = true;
} else { // last node is a text node (empty tag) with some text
- if (lastNode->text.length() == 1 && lastNode->text.at(0).isSpace()) {
+ if (lastNode->text.size() == 1 && lastNode->text.at(0).isSpace()) {
int lastSibling = count() - 2;
while (lastSibling
@@ -563,8 +528,8 @@ QTextHtmlParserNode *QTextHtmlParser::newNode(int parent)
newNode->text.clear();
newNode->id = Html_unknown;
} else {
- nodes.resize(nodes.size() + 1);
- newNode = &nodes.last();
+ nodes.append(new QTextHtmlParserNode);
+ newNode = nodes.last();
}
newNode->parent = parent;
@@ -573,11 +538,12 @@ QTextHtmlParserNode *QTextHtmlParser::newNode(int parent)
void QTextHtmlParser::parse(const QString &text, const QTextDocument *_resourceProvider)
{
+ qDeleteAll(nodes);
nodes.clear();
- nodes.resize(1);
+ nodes.append(new QTextHtmlParserNode);
txt = text;
pos = 0;
- len = txt.length();
+ len = txt.size();
textEditMode = false;
resourceProvider = _resourceProvider;
parse();
@@ -636,12 +602,12 @@ void QTextHtmlParser::parse()
{
while (pos < len) {
QChar c = txt.at(pos++);
- if (c == QLatin1Char('<')) {
+ if (c == u'<') {
parseTag();
- } else if (c == QLatin1Char('&')) {
- nodes.last().text += parseEntity();
+ } else if (c == u'&') {
+ nodes.last()->text += parseEntity();
} else {
- nodes.last().text += c;
+ nodes.last()->text += c;
}
}
}
@@ -652,20 +618,20 @@ void QTextHtmlParser::parseTag()
eatSpace();
// handle comments and other exclamation mark declarations
- if (hasPrefix(QLatin1Char('!'))) {
+ if (hasPrefix(u'!')) {
parseExclamationTag();
- if (nodes.last().wsm != QTextHtmlParserNode::WhiteSpacePre
- && nodes.last().wsm != QTextHtmlParserNode::WhiteSpacePreWrap
+ if (nodes.last()->wsm != QTextHtmlParserNode::WhiteSpacePre
+ && nodes.last()->wsm != QTextHtmlParserNode::WhiteSpacePreWrap
&& !textEditMode)
eatSpace();
return;
}
// if close tag just close
- if (hasPrefix(QLatin1Char('/'))) {
- if (nodes.last().id == Html_style) {
+ if (hasPrefix(u'/')) {
+ if (nodes.last()->id == Html_style) {
#ifndef QT_NO_CSSPARSER
- QCss::Parser parser(nodes.constLast().text);
+ QCss::Parser parser(nodes.constLast()->text);
QCss::StyleSheet sheet;
sheet.origin = QCss::StyleSheetOrigin_Author;
parser.parse(&sheet, Qt::CaseInsensitive);
@@ -706,15 +672,15 @@ void QTextHtmlParser::parseTag()
resolveNode();
#ifndef QT_NO_CSSPARSER
- const int nodeIndex = nodes.count() - 1; // this new node is always the last
+ const int nodeIndex = nodes.size() - 1; // this new node is always the last
node->applyCssDeclarations(declarationsForNode(nodeIndex), resourceProvider);
#endif
applyAttributes(node->attributes);
// finish tag
bool tagClosed = false;
- while (pos < len && txt.at(pos) != QLatin1Char('>')) {
- if (txt.at(pos) == QLatin1Char('/'))
+ while (pos < len && txt.at(pos) != u'>') {
+ if (txt.at(pos) == u'/')
tagClosed = true;
pos++;
@@ -727,7 +693,7 @@ void QTextHtmlParser::parseTag()
|| node->wsm == QTextHtmlParserNode::WhiteSpacePreWrap
|| node->wsm == QTextHtmlParserNode::WhiteSpacePreLine)
&& node->isBlock()) {
- if (pos < len - 1 && txt.at(pos) == QLatin1Char('\n'))
+ if (pos < len - 1 && txt.at(pos) == u'\n')
++pos;
}
@@ -744,7 +710,7 @@ void QTextHtmlParser::parseCloseTag()
QString tag = parseWord().toLower().trimmed();
while (pos < len) {
QChar c = txt.at(pos++);
- if (c == QLatin1Char('>'))
+ if (c == u'>')
break;
}
@@ -772,8 +738,8 @@ void QTextHtmlParser::parseCloseTag()
|| at(p).wsm == QTextHtmlParserNode::WhiteSpacePreWrap
|| at(p).wsm == QTextHtmlParserNode::WhiteSpacePreLine)
&& at(p).isBlock()) {
- if (at(last()).text.endsWith(QLatin1Char('\n')))
- nodes[last()].text.chop(1);
+ if (at(last()).text.endsWith(u'\n'))
+ nodes[last()]->text.chop(1);
}
newNode(at(p).parent);
@@ -784,94 +750,95 @@ void QTextHtmlParser::parseCloseTag()
void QTextHtmlParser::parseExclamationTag()
{
++pos;
- if (hasPrefix(QLatin1Char('-'),1) && hasPrefix(QLatin1Char('-'),2)) {
- pos += 3;
+ if (hasPrefix(u'-') && hasPrefix(u'-', 1)) {
+ pos += 2;
// eat comments
- int end = txt.indexOf(QLatin1String("-->"), pos);
+ int end = txt.indexOf("-->"_L1, pos);
pos = (end >= 0 ? end + 3 : len);
} else {
// eat internal tags
while (pos < len) {
QChar c = txt.at(pos++);
- if (c == QLatin1Char('>'))
+ if (c == u'>')
break;
}
}
}
+QString QTextHtmlParser::parseEntity(QStringView entity)
+{
+ QChar resolved = resolveEntity(entity);
+ if (!resolved.isNull())
+ return QString(resolved);
+
+ if (entity.size() > 1 && entity.at(0) == u'#') {
+ entity = entity.mid(1); // removing leading #
+
+ int base = 10;
+ bool ok = false;
+
+ if (entity.at(0).toLower() == u'x') { // hex entity?
+ entity = entity.mid(1);
+ base = 16;
+ }
+
+ uint uc = entity.toUInt(&ok, base);
+ if (ok) {
+ if (uc >= 0x80 && uc < 0x80 + (sizeof(windowsLatin1ExtendedCharacters)/sizeof(windowsLatin1ExtendedCharacters[0])))
+ uc = windowsLatin1ExtendedCharacters[uc - 0x80];
+ return QStringView{QChar::fromUcs4(uc)}.toString();
+ }
+ }
+ return {};
+}
+
// parses an entity after "&", and returns it
QString QTextHtmlParser::parseEntity()
{
const int recover = pos;
int entityLen = 0;
- QStringRef entity;
while (pos < len) {
QChar c = txt.at(pos++);
if (c.isSpace() || pos - recover > 9) {
goto error;
}
- if (c == QLatin1Char(';'))
+ if (c == u';')
break;
++entityLen;
}
if (entityLen) {
- entity = QStringRef(&txt, recover, entityLen);
- QChar resolved = resolveEntity(entity);
- if (!resolved.isNull())
- return QString(resolved);
-
- if (entityLen > 1 && entity.at(0) == QLatin1Char('#')) {
- entity = entity.mid(1); // removing leading #
-
- int base = 10;
- bool ok = false;
-
- if (entity.at(0).toLower() == QLatin1Char('x')) { // hex entity?
- entity = entity.mid(1);
- base = 16;
- }
-
- uint uc = entity.toUInt(&ok, base);
- if (ok) {
- if (uc >= 0x80 && uc < 0x80 + (sizeof(windowsLatin1ExtendedCharacters)/sizeof(windowsLatin1ExtendedCharacters[0])))
- uc = windowsLatin1ExtendedCharacters[uc - 0x80];
- QString str;
- if (QChar::requiresSurrogates(uc)) {
- str += QChar(QChar::highSurrogate(uc));
- str += QChar(QChar::lowSurrogate(uc));
- } else {
- str = QChar(uc);
- }
- return str;
- }
+ const QStringView entity = QStringView(txt).mid(recover, entityLen);
+ QString parsedEntity = parseEntity(entity);
+ if (!parsedEntity.isNull()) {
+ return parsedEntity;
}
}
error:
pos = recover;
- return QLatin1String("&");
+ return "&"_L1;
}
// parses one word, possibly quoted, and returns it
QString QTextHtmlParser::parseWord()
{
QString word;
- if (hasPrefix(QLatin1Char('\"'))) { // double quotes
+ if (hasPrefix(u'\"')) { // double quotes
++pos;
while (pos < len) {
QChar c = txt.at(pos++);
- if (c == QLatin1Char('\"'))
+ if (c == u'\"')
break;
- else if (c == QLatin1Char('&'))
+ else if (c == u'&')
word += parseEntity();
else
word += c;
}
- } else if (hasPrefix(QLatin1Char('\''))) { // single quotes
+ } else if (hasPrefix(u'\'')) { // single quotes
++pos;
while (pos < len) {
QChar c = txt.at(pos++);
// Allow for escaped single quotes as they may be part of the string
- if (c == QLatin1Char('\'') && (txt.length() > 1 && txt.at(pos - 2) != QLatin1Char('\\')))
+ if (c == u'\'' && (txt.size() > 1 && txt.at(pos - 2) != u'\\'))
break;
else
word += c;
@@ -879,15 +846,12 @@ QString QTextHtmlParser::parseWord()
} else { // normal text
while (pos < len) {
QChar c = txt.at(pos++);
- if (c == QLatin1Char('>')
- || (c == QLatin1Char('/') && hasPrefix(QLatin1Char('>'), 1))
- || c == QLatin1Char('<')
- || c == QLatin1Char('=')
- || c.isSpace()) {
+ if (c == u'>' || (c == u'/' && hasPrefix(u'>'))
+ || c == u'<' || c == u'=' || c.isSpace()) {
--pos;
break;
}
- if (c == QLatin1Char('&'))
+ if (c == u'&')
word += parseEntity();
else
word += c;
@@ -899,7 +863,7 @@ QString QTextHtmlParser::parseWord()
// gives the new node the right parent
QTextHtmlParserNode *QTextHtmlParser::resolveParent()
{
- QTextHtmlParserNode *node = &nodes.last();
+ QTextHtmlParserNode *node = nodes.last();
int p = node->parent;
@@ -912,22 +876,22 @@ QTextHtmlParserNode *QTextHtmlParser::resolveParent()
n = at(n).parent;
if (!n) {
- nodes.insert(nodes.count() - 1, QTextHtmlParserNode());
- nodes.insert(nodes.count() - 1, QTextHtmlParserNode());
+ nodes.insert(nodes.size() - 1, new QTextHtmlParserNode);
+ nodes.insert(nodes.size() - 1, new QTextHtmlParserNode);
- QTextHtmlParserNode *table = &nodes[nodes.count() - 3];
+ QTextHtmlParserNode *table = nodes[nodes.size() - 3];
table->parent = p;
table->id = Html_table;
- table->tag = QLatin1String("table");
- table->children.append(nodes.count() - 2); // add row as child
+ table->tag = "table"_L1;
+ table->children.append(nodes.size() - 2); // add row as child
- QTextHtmlParserNode *row = &nodes[nodes.count() - 2];
- row->parent = nodes.count() - 3; // table as parent
+ QTextHtmlParserNode *row = nodes[nodes.size() - 2];
+ row->parent = nodes.size() - 3; // table as parent
row->id = Html_tr;
- row->tag = QLatin1String("tr");
+ row->tag = "tr"_L1;
- p = nodes.count() - 2;
- node = &nodes.last(); // re-initialize pointer
+ p = nodes.size() - 2;
+ node = nodes.last(); // re-initialize pointer
}
}
@@ -937,13 +901,13 @@ QTextHtmlParserNode *QTextHtmlParser::resolveParent()
n = at(n).parent;
if (!n) {
- nodes.insert(nodes.count() - 1, QTextHtmlParserNode());
- QTextHtmlParserNode *table = &nodes[nodes.count() - 2];
+ nodes.insert(nodes.size() - 1, new QTextHtmlParserNode);
+ QTextHtmlParserNode *table = nodes[nodes.size() - 2];
table->parent = p;
table->id = Html_table;
- table->tag = QLatin1String("table");
- p = nodes.count() - 2;
- node = &nodes.last(); // re-initialize pointer
+ table->tag = "table"_L1;
+ p = nodes.size() - 2;
+ node = nodes.last(); // re-initialize pointer
}
}
@@ -990,15 +954,15 @@ QTextHtmlParserNode *QTextHtmlParser::resolveParent()
node->parent = p;
// makes it easier to traverse the tree, later
- nodes[p].children.append(nodes.count() - 1);
+ nodes[p]->children.append(nodes.size() - 1);
return node;
}
// sets all properties on the new node
void QTextHtmlParser::resolveNode()
{
- QTextHtmlParserNode *node = &nodes.last();
- const QTextHtmlParserNode *parent = &nodes.at(node->parent);
+ QTextHtmlParserNode *node = nodes.last();
+ const QTextHtmlParserNode *parent = nodes.at(node->parent);
node->initializeProperties(parent, this);
}
@@ -1038,8 +1002,11 @@ void QTextHtmlParserNode::initializeProperties(const QTextHtmlParserNode *parent
// we don't paint per-row background colors, yet. so as an
// exception inherit the background color here
// we also inherit the background between inline elements
+ // we also inherit from non-body block elements since we merge them together
if ((parent->id != Html_tr || !isTableCell())
- && (displayMode != QTextHtmlElement::DisplayInline || parent->displayMode != QTextHtmlElement::DisplayInline)) {
+ && (displayMode != QTextHtmlElement::DisplayInline || parent->displayMode != QTextHtmlElement::DisplayInline)
+ && (parent->id == Html_body || displayMode != QTextHtmlElement::DisplayBlock || parent->displayMode != QTextHtmlElement::DisplayBlock)
+ ) {
charFormat.clearProperty(QTextFormat::BackgroundBrush);
}
@@ -1062,9 +1029,9 @@ void QTextHtmlParserNode::initializeProperties(const QTextHtmlParserNode *parent
// set element specific attributes
switch (id) {
case Html_a:
- for (int i = 0; i < attributes.count(); i += 2) {
+ for (int i = 0; i < attributes.size(); i += 2) {
const QString key = attributes.at(i);
- if (key.compare(QLatin1String("href"), Qt::CaseInsensitive) == 0
+ if (key.compare("href"_L1, Qt::CaseInsensitive) == 0
&& !attributes.at(i + 1).isEmpty()) {
hasHref = true;
}
@@ -1148,9 +1115,9 @@ void QTextHtmlParserNode::initializeProperties(const QTextHtmlParserNode *parent
}
#ifndef QT_NO_CSSPARSER
-void QTextHtmlParserNode::setListStyle(const QVector<QCss::Value> &cssValues)
+void QTextHtmlParserNode::setListStyle(const QList<QCss::Value> &cssValues)
{
- for (int i = 0; i < cssValues.count(); ++i) {
+ for (int i = 0; i < cssValues.size(); ++i) {
if (cssValues.at(i).type == QCss::Value::KnownIdentifier) {
switch (static_cast<QCss::KnownValue>(cssValues.at(i).variant.toInt())) {
case QCss::Value_None: hasOwnListStyle = true; listStyle = QTextListFormat::ListStyleUndefined; break;
@@ -1171,12 +1138,50 @@ void QTextHtmlParserNode::setListStyle(const QVector<QCss::Value> &cssValues)
blockFormat.setProperty(QTextFormat::ListStyle, listStyle);
}
-void QTextHtmlParserNode::applyCssDeclarations(const QVector<QCss::Declaration> &declarations, const QTextDocument *resourceProvider)
+static QTextFrameFormat::BorderStyle toQTextFrameFormat(QCss::BorderStyle cssStyle)
+{
+ switch (cssStyle) {
+ case QCss::BorderStyle::BorderStyle_Dotted:
+ return QTextFrameFormat::BorderStyle::BorderStyle_Dotted;
+ case QCss::BorderStyle::BorderStyle_Dashed:
+ return QTextFrameFormat::BorderStyle::BorderStyle_Dashed;
+ case QCss::BorderStyle::BorderStyle_Solid:
+ return QTextFrameFormat::BorderStyle::BorderStyle_Solid;
+ case QCss::BorderStyle::BorderStyle_Double:
+ return QTextFrameFormat::BorderStyle::BorderStyle_Double;
+ case QCss::BorderStyle::BorderStyle_DotDash:
+ return QTextFrameFormat::BorderStyle::BorderStyle_DotDash;
+ case QCss::BorderStyle::BorderStyle_DotDotDash:
+ return QTextFrameFormat::BorderStyle::BorderStyle_DotDotDash;
+ case QCss::BorderStyle::BorderStyle_Groove:
+ return QTextFrameFormat::BorderStyle::BorderStyle_Groove;
+ case QCss::BorderStyle::BorderStyle_Ridge:
+ return QTextFrameFormat::BorderStyle::BorderStyle_Ridge;
+ case QCss::BorderStyle::BorderStyle_Inset:
+ return QTextFrameFormat::BorderStyle::BorderStyle_Inset;
+ case QCss::BorderStyle::BorderStyle_Outset:
+ return QTextFrameFormat::BorderStyle::BorderStyle_Outset;
+ case QCss::BorderStyle::BorderStyle_Unknown:
+ case QCss::BorderStyle::BorderStyle_None:
+ case QCss::BorderStyle::BorderStyle_Native:
+ return QTextFrameFormat::BorderStyle::BorderStyle_None;
+ case QCss::BorderStyle::NumKnownBorderStyles:
+ break;
+ // Intentionally no "default" to allow a compiler warning when extending the enum
+ // without updating this here. clang gives such a warning.
+ }
+ // Must not happen, intentionally trigger undefined behavior which sanitizers will detect.
+ // Having all cases covered in switch is not sufficient:
+ // MSVC would warn when there is no "default".
+ return static_cast<QTextFrameFormat::BorderStyle>(-1);
+}
+
+void QTextHtmlParserNode::applyCssDeclarations(const QList<QCss::Declaration> &declarations, const QTextDocument *resourceProvider)
{
QCss::ValueExtractor extractor(declarations);
extractor.extractBox(margin, padding);
- if (id == Html_td || id == Html_th) {
+ auto getBorderValues = [&extractor](qreal *borderWidth, QBrush *borderBrush, QTextFrameFormat::BorderStyle *borderStyles) {
QCss::BorderStyle cssStyles[4];
int cssBorder[4];
QSize cssRadii[4]; // unused
@@ -1188,20 +1193,24 @@ void QTextHtmlParserNode::applyCssDeclarations(const QVector<QCss::Declaration>
// QCss::BorderWidth parsing below which expects a single value
// will not work as expected - which in this case does not matter
// because tableBorder is not relevant for cells.
- extractor.extractBorder(cssBorder, tableCellBorderBrush, cssStyles, cssRadii);
+ bool hit = extractor.extractBorder(cssBorder, borderBrush, cssStyles, cssRadii);
for (int i = 0; i < 4; ++i) {
- tableCellBorderStyle[i] = static_cast<QTextFrameFormat::BorderStyle>(cssStyles[i] - 1);
- tableCellBorder[i] = static_cast<qreal>(cssBorder[i]);
+ borderStyles[i] = toQTextFrameFormat(cssStyles[i]);
+ borderWidth[i] = static_cast<qreal>(cssBorder[i]);
}
- }
+ return hit;
+ };
+
+ if (id == Html_td || id == Html_th)
+ getBorderValues(tableCellBorder, tableCellBorderBrush, tableCellBorderStyle);
- for (int i = 0; i < declarations.count(); ++i) {
+ for (int i = 0; i < declarations.size(); ++i) {
const QCss::Declaration &decl = declarations.at(i);
if (decl.d->values.isEmpty()) continue;
QCss::KnownValue identifier = QCss::UnknownValue;
- if (decl.d->values.first().type == QCss::Value::KnownIdentifier)
- identifier = static_cast<QCss::KnownValue>(decl.d->values.first().variant.toInt());
+ if (decl.d->values.constFirst().type == QCss::Value::KnownIdentifier)
+ identifier = static_cast<QCss::KnownValue>(decl.d->values.constFirst().variant.toInt());
switch (decl.d->propertyId) {
case QCss::BorderColor: borderBrush = QBrush(decl.colorValue()); break;
@@ -1215,6 +1224,19 @@ void QTextHtmlParserNode::applyCssDeclarations(const QVector<QCss::Declaration>
tableBorder = borders[0];
}
break;
+ case QCss::Border: {
+ qreal tblBorder[4];
+ QBrush tblBorderBrush[4];
+ QTextFrameFormat::BorderStyle tblBorderStyle[4];
+ if (getBorderValues(tblBorder, tblBorderBrush, tblBorderStyle)) {
+ tableBorder = tblBorder[0];
+ if (tblBorderBrush[0].color().isValid())
+ borderBrush = tblBorderBrush[0];
+ if (tblBorderStyle[0] != static_cast<QTextFrameFormat::BorderStyle>(-1))
+ borderStyle = tblBorderStyle[0];
+ }
+ }
+ break;
case QCss::BorderCollapse:
borderCollapse = decl.borderCollapseValue();
break;
@@ -1228,18 +1250,18 @@ void QTextHtmlParserNode::applyCssDeclarations(const QVector<QCss::Declaration>
}
break;
case QCss::QtBlockIndent:
- blockFormat.setIndent(decl.d->values.first().variant.toInt());
+ blockFormat.setIndent(decl.d->values.constFirst().variant.toInt());
break;
case QCss::QtLineHeightType: {
- QString lineHeightTypeName = decl.d->values.first().variant.toString();
+ QString lineHeightTypeName = decl.d->values.constFirst().variant.toString();
QTextBlockFormat::LineHeightTypes lineHeightType;
- if (lineHeightTypeName.compare(QLatin1String("proportional"), Qt::CaseInsensitive) == 0)
+ if (lineHeightTypeName.compare("proportional"_L1, Qt::CaseInsensitive) == 0)
lineHeightType = QTextBlockFormat::ProportionalHeight;
- else if (lineHeightTypeName.compare(QLatin1String("fixed"), Qt::CaseInsensitive) == 0)
+ else if (lineHeightTypeName.compare("fixed"_L1, Qt::CaseInsensitive) == 0)
lineHeightType = QTextBlockFormat::FixedHeight;
- else if (lineHeightTypeName.compare(QLatin1String("minimum"), Qt::CaseInsensitive) == 0)
+ else if (lineHeightTypeName.compare("minimum"_L1, Qt::CaseInsensitive) == 0)
lineHeightType = QTextBlockFormat::MinimumHeight;
- else if (lineHeightTypeName.compare(QLatin1String("line-distance"), Qt::CaseInsensitive) == 0)
+ else if (lineHeightTypeName.compare("line-distance"_L1, Qt::CaseInsensitive) == 0)
lineHeightType = QTextBlockFormat::LineDistanceHeight;
else
lineHeightType = QTextBlockFormat::SingleHeight;
@@ -1260,7 +1282,7 @@ void QTextHtmlParserNode::applyCssDeclarations(const QVector<QCss::Declaration>
lineHeightType = QTextBlockFormat::MinimumHeight;
} else {
bool ok;
- QCss::Value cssValue = decl.d->values.first();
+ QCss::Value cssValue = decl.d->values.constFirst();
QString value = cssValue.toString();
lineHeight = value.toDouble(&ok);
if (ok) {
@@ -1292,19 +1314,19 @@ void QTextHtmlParserNode::applyCssDeclarations(const QVector<QCss::Declaration>
hasCssListIndent = true;
break;
case QCss::QtParagraphType:
- if (decl.d->values.first().variant.toString().compare(QLatin1String("empty"), Qt::CaseInsensitive) == 0)
+ if (decl.d->values.constFirst().variant.toString().compare("empty"_L1, Qt::CaseInsensitive) == 0)
isEmptyParagraph = true;
break;
case QCss::QtTableType:
- if (decl.d->values.first().variant.toString().compare(QLatin1String("frame"), Qt::CaseInsensitive) == 0)
+ if (decl.d->values.constFirst().variant.toString().compare("frame"_L1, Qt::CaseInsensitive) == 0)
isTextFrame = true;
- else if (decl.d->values.first().variant.toString().compare(QLatin1String("root"), Qt::CaseInsensitive) == 0) {
+ else if (decl.d->values.constFirst().variant.toString().compare("root"_L1, Qt::CaseInsensitive) == 0) {
isTextFrame = true;
isRootFrame = true;
}
break;
case QCss::QtUserState:
- userState = decl.d->values.first().variant.toInt();
+ userState = decl.d->values.constFirst().variant.toInt();
break;
case QCss::Whitespace:
switch (identifier) {
@@ -1352,15 +1374,16 @@ void QTextHtmlParserNode::applyCssDeclarations(const QVector<QCss::Declaration>
default: break;
}
break;
+ case QCss::TextDecorationColor: charFormat.setUnderlineColor(decl.colorValue()); break;
case QCss::ListStyleType:
case QCss::ListStyle:
setListStyle(decl.d->values);
break;
case QCss::QtListNumberPrefix:
- textListNumberPrefix = decl.d->values.first().variant.toString();
+ textListNumberPrefix = decl.d->values.constFirst().variant.toString();
break;
case QCss::QtListNumberSuffix:
- textListNumberSuffix = decl.d->values.first().variant.toString();
+ textListNumberSuffix = decl.d->values.constFirst().variant.toString();
break;
case QCss::TextAlignment:
switch (identifier) {
@@ -1373,14 +1396,45 @@ void QTextHtmlParserNode::applyCssDeclarations(const QVector<QCss::Declaration>
case QCss::QtForegroundTextureCacheKey:
{
- if (resourceProvider != nullptr && resourceProvider->docHandle() != nullptr) {
+ if (resourceProvider != nullptr && QTextDocumentPrivate::get(resourceProvider) != nullptr) {
bool ok;
- qint64 searchKey = decl.d->values.first().variant.toLongLong(&ok);
+ qint64 searchKey = decl.d->values.constFirst().variant.toLongLong(&ok);
if (ok)
applyForegroundImage(searchKey, resourceProvider);
}
break;
}
+ case QCss::QtStrokeColor:
+ {
+ QPen pen = charFormat.textOutline();
+ pen.setStyle(Qt::SolidLine);
+ pen.setColor(decl.colorValue());
+ charFormat.setTextOutline(pen);
+ break;
+ }
+ case QCss::QtStrokeWidth:
+ {
+ qreal width;
+ if (decl.realValue(&width, "px")) {
+ QPen pen = charFormat.textOutline();
+ pen.setWidthF(width);
+ charFormat.setTextOutline(pen);
+ }
+ break;
+ }
+ case QCss::QtForeground:
+ {
+ QBrush brush = decl.brushValue();
+ charFormat.setForeground(brush);
+ break;
+ }
+ case QCss::MaximumWidth:
+ if (id == Html_img) {
+ auto imageFormat = charFormat.toImageFormat();
+ imageFormat.setMaximumWidth(extractor.textLength(decl));
+ charFormat = imageFormat;
+ }
+ break;
default: break;
}
}
@@ -1388,6 +1442,8 @@ void QTextHtmlParserNode::applyCssDeclarations(const QVector<QCss::Declaration>
QFont f;
int adjustment = -255;
extractor.extractFont(&f, &adjustment);
+ if (f.pixelSize() > INT32_MAX / 2)
+ f.setPixelSize(INT32_MAX / 2); // avoid even more extreme values
charFormat.setFont(f, QTextCharFormat::FontPropertiesSpecifiedOnly);
if (adjustment >= -1)
@@ -1407,6 +1463,8 @@ void QTextHtmlParserNode::applyCssDeclarations(const QVector<QCss::Declaration>
applyBackgroundImage(bgImage, resourceProvider);
} else if (bgBrush.style() != Qt::NoBrush) {
charFormat.setBackground(bgBrush);
+ if (id == Html_hr)
+ blockFormat.setProperty(QTextFormat::BackgroundBrush, bgBrush);
}
}
}
@@ -1415,7 +1473,7 @@ void QTextHtmlParserNode::applyCssDeclarations(const QVector<QCss::Declaration>
void QTextHtmlParserNode::applyForegroundImage(qint64 searchKey, const QTextDocument *resourceProvider)
{
- QTextDocumentPrivate *priv = resourceProvider->docHandle();
+ const QTextDocumentPrivate *priv = QTextDocumentPrivate::get(resourceProvider);
for (int i = 0; i < priv->formats.numFormats(); ++i) {
QTextCharFormat format = priv->formats.charFormat(i);
if (format.isValid()) {
@@ -1451,19 +1509,19 @@ void QTextHtmlParserNode::applyBackgroundImage(const QString &url, const QTextDo
if (QCoreApplication::instance()->thread() != QThread::currentThread()) {
// must use images in non-GUI threads
- if (val.type() == QVariant::Image) {
+ if (val.userType() == QMetaType::QImage) {
QImage image = qvariant_cast<QImage>(val);
charFormat.setBackground(image);
- } else if (val.type() == QVariant::ByteArray) {
+ } else if (val.userType() == QMetaType::QByteArray) {
QImage image;
if (image.loadFromData(val.toByteArray())) {
charFormat.setBackground(image);
}
}
} else {
- if (val.type() == QVariant::Image || val.type() == QVariant::Pixmap) {
+ if (val.userType() == QMetaType::QImage || val.userType() == QMetaType::QPixmap) {
charFormat.setBackground(qvariant_cast<QPixmap>(val));
- } else if (val.type() == QVariant::ByteArray) {
+ } else if (val.userType() == QMetaType::QByteArray) {
QPixmap pm;
if (pm.loadFromData(val.toByteArray())) {
charFormat.setBackground(pm);
@@ -1477,7 +1535,7 @@ void QTextHtmlParserNode::applyBackgroundImage(const QString &url, const QTextDo
bool QTextHtmlParserNode::hasOnlyWhitespace() const
{
- for (int i = 0; i < text.count(); ++i)
+ for (int i = 0; i < text.size(); ++i)
if (!text.at(i).isSpace() || text.at(i) == QChar::LineSeparator)
return false;
return true;
@@ -1510,8 +1568,8 @@ static void setWidthAttribute(QTextLength *width, const QString &valueStr)
if (ok) {
*width = QTextLength(QTextLength::FixedLength, realVal);
} else {
- QStringRef value = QStringRef(&valueStr).trimmed();
- if (!value.isEmpty() && value.endsWith(QLatin1Char('%'))) {
+ auto value = QStringView(valueStr).trimmed();
+ if (!value.isEmpty() && value.endsWith(u'%')) {
value.truncate(value.size() - 1);
realVal = value.toDouble(&ok);
if (ok)
@@ -1523,11 +1581,11 @@ static void setWidthAttribute(QTextLength *width, const QString &valueStr)
#ifndef QT_NO_CSSPARSER
void QTextHtmlParserNode::parseStyleAttribute(const QString &value, const QTextDocument *resourceProvider)
{
- const QString css = QLatin1String("* {") + value + QLatin1Char('}');
+ const QString css = "* {"_L1 + value + u'}';
QCss::Parser parser(css);
QCss::StyleSheet sheet;
parser.parse(&sheet, Qt::CaseInsensitive);
- if (sheet.styleRules.count() != 1) return;
+ if (sheet.styleRules.size() != 1) return;
applyCssDeclarations(sheet.styleRules.at(0).declarations, resourceProvider);
}
#endif
@@ -1538,14 +1596,14 @@ QStringList QTextHtmlParser::parseAttributes()
while (pos < len) {
eatSpace();
- if (hasPrefix(QLatin1Char('>')) || hasPrefix(QLatin1Char('/')))
+ if (hasPrefix(u'>') || hasPrefix(u'/'))
break;
QString key = parseWord().toLower();
- QString value = QLatin1String("1");
+ QString value = "1"_L1;
if (key.size() == 0)
break;
eatSpace();
- if (hasPrefix(QLatin1Char('='))){
+ if (hasPrefix(u'=')){
pos++;
eatSpace();
value = parseWord();
@@ -1565,36 +1623,34 @@ void QTextHtmlParser::applyAttributes(const QStringList &attributes)
QString linkHref;
QString linkType;
- if (attributes.count() % 2 == 1)
+ if (attributes.size() % 2 == 1)
return;
- QTextHtmlParserNode *node = &nodes.last();
+ QTextHtmlParserNode *node = nodes.last();
- for (int i = 0; i < attributes.count(); i += 2) {
+ for (int i = 0; i < attributes.size(); i += 2) {
QString key = attributes.at(i);
QString value = attributes.at(i + 1);
switch (node->id) {
case Html_font:
// the infamous font tag
- if (key == QLatin1String("size") && value.size()) {
+ if (key == "size"_L1 && value.size()) {
int n = value.toInt();
- if (value.at(0) != QLatin1Char('+') && value.at(0) != QLatin1Char('-'))
+ if (value.at(0) != u'+' && value.at(0) != u'-')
n -= 3;
node->charFormat.setProperty(QTextFormat::FontSizeAdjustment, n);
- } else if (key == QLatin1String("face")) {
- if (value.contains(QLatin1Char(','))) {
- const QStringList values = value.split(QLatin1Char(','));
+ } else if (key == "face"_L1) {
+ if (value.contains(u',')) {
QStringList families;
- for (const QString &family : values)
- families << family.trimmed();
+ for (auto family : value.tokenize(u','))
+ families << family.trimmed().toString();
node->charFormat.setFontFamilies(families);
- node->charFormat.setFontFamily(families.at(0));
} else {
- node->charFormat.setFontFamily(value);
+ node->charFormat.setFontFamilies(QStringList(value));
}
- } else if (key == QLatin1String("color")) {
- QColor c; c.setNamedColor(value);
+ } else if (key == "color"_L1) {
+ QColor c = QColor::fromString(value);
if (!c.isValid())
qWarning("QTextHtmlParser::applyAttributes: Unknown color name '%s'",value.toLatin1().constData());
node->charFormat.setForeground(c);
@@ -1602,153 +1658,158 @@ void QTextHtmlParser::applyAttributes(const QStringList &attributes)
break;
case Html_ol:
case Html_ul:
- if (key == QLatin1String("type")) {
+ if (key == "type"_L1) {
node->hasOwnListStyle = true;
- if (value == QLatin1String("1")) {
+ if (value == "1"_L1) {
node->listStyle = QTextListFormat::ListDecimal;
- } else if (value == QLatin1String("a")) {
+ } else if (value == "a"_L1) {
node->listStyle = QTextListFormat::ListLowerAlpha;
- } else if (value == QLatin1String("A")) {
+ } else if (value == "A"_L1) {
node->listStyle = QTextListFormat::ListUpperAlpha;
- } else if (value == QLatin1String("i")) {
+ } else if (value == "i"_L1) {
node->listStyle = QTextListFormat::ListLowerRoman;
- } else if (value == QLatin1String("I")) {
+ } else if (value == "I"_L1) {
node->listStyle = QTextListFormat::ListUpperRoman;
} else {
value = std::move(value).toLower();
- if (value == QLatin1String("square"))
+ if (value == "square"_L1)
node->listStyle = QTextListFormat::ListSquare;
- else if (value == QLatin1String("disc"))
+ else if (value == "disc"_L1)
node->listStyle = QTextListFormat::ListDisc;
- else if (value == QLatin1String("circle"))
+ else if (value == "circle"_L1)
node->listStyle = QTextListFormat::ListCircle;
- else if (value == QLatin1String("none"))
+ else if (value == "none"_L1)
node->listStyle = QTextListFormat::ListStyleUndefined;
}
+ } else if (key == "start"_L1) {
+ setIntAttribute(&node->listStart, value);
+ }
+ break;
+ case Html_li:
+ if (key == "class"_L1) {
+ if (value == "unchecked"_L1)
+ node->blockFormat.setMarker(QTextBlockFormat::MarkerType::Unchecked);
+ else if (value == "checked"_L1)
+ node->blockFormat.setMarker(QTextBlockFormat::MarkerType::Checked);
}
break;
case Html_a:
- if (key == QLatin1String("href"))
+ if (key == "href"_L1)
node->charFormat.setAnchorHref(value);
- else if (key == QLatin1String("name"))
+ else if (key == "name"_L1)
node->charFormat.setAnchorNames({value});
break;
case Html_img:
- if (key == QLatin1String("src") || key == QLatin1String("source")) {
+ if (key == "src"_L1 || key == "source"_L1) {
node->imageName = value;
- } else if (key == QLatin1String("width")) {
+ } else if (key == "width"_L1) {
node->imageWidth = -2; // register that there is a value for it.
setFloatAttribute(&node->imageWidth, value);
- } else if (key == QLatin1String("height")) {
+ } else if (key == "height"_L1) {
node->imageHeight = -2; // register that there is a value for it.
setFloatAttribute(&node->imageHeight, value);
- } else if (key == QLatin1String("alt")) {
+ } else if (key == "alt"_L1) {
node->imageAlt = value;
- } else if (key == QLatin1String("title")) {
+ } else if (key == "title"_L1) {
node->text = value;
}
break;
case Html_tr:
case Html_body:
- if (key == QLatin1String("bgcolor")) {
- QColor c; c.setNamedColor(value);
+ if (key == "bgcolor"_L1) {
+ QColor c = QColor::fromString(value);
if (!c.isValid())
qWarning("QTextHtmlParser::applyAttributes: Unknown color name '%s'",value.toLatin1().constData());
node->charFormat.setBackground(c);
- } else if (key == QLatin1String("background")) {
+ } else if (key == "background"_L1) {
node->applyBackgroundImage(value, resourceProvider);
}
break;
case Html_th:
case Html_td:
- if (key == QLatin1String("width")) {
+ if (key == "width"_L1) {
setWidthAttribute(&node->width, value);
- } else if (key == QLatin1String("bgcolor")) {
- QColor c; c.setNamedColor(value);
+ } else if (key == "bgcolor"_L1) {
+ QColor c = QColor::fromString(value);
if (!c.isValid())
qWarning("QTextHtmlParser::applyAttributes: Unknown color name '%s'",value.toLatin1().constData());
node->charFormat.setBackground(c);
- } else if (key == QLatin1String("background")) {
+ } else if (key == "background"_L1) {
node->applyBackgroundImage(value, resourceProvider);
- } else if (key == QLatin1String("rowspan")) {
+ } else if (key == "rowspan"_L1) {
if (setIntAttribute(&node->tableCellRowSpan, value))
node->tableCellRowSpan = qMax(1, node->tableCellRowSpan);
- } else if (key == QLatin1String("colspan")) {
+ } else if (key == "colspan"_L1) {
if (setIntAttribute(&node->tableCellColSpan, value))
- node->tableCellColSpan = qMax(1, node->tableCellColSpan);
+ node->tableCellColSpan = qBound(1, node->tableCellColSpan, 20480);
}
break;
case Html_table:
- if (key == QLatin1String("border")) {
+ // If table border already set through css style, prefer that one otherwise consider this value
+ if (key == "border"_L1 && !node->tableBorder) {
setFloatAttribute(&node->tableBorder, value);
- } else if (key == QLatin1String("bgcolor")) {
- QColor c; c.setNamedColor(value);
+ } else if (key == "bgcolor"_L1) {
+ QColor c = QColor::fromString(value);
if (!c.isValid())
qWarning("QTextHtmlParser::applyAttributes: Unknown color name '%s'",value.toLatin1().constData());
node->charFormat.setBackground(c);
- } else if (key == QLatin1String("bordercolor")) {
- QColor c; c.setNamedColor(value);
+ } else if (key == "bordercolor"_L1) {
+ QColor c = QColor::fromString(value);
if (!c.isValid())
qWarning("QTextHtmlParser::applyAttributes: Unknown color name '%s'",value.toLatin1().constData());
node->borderBrush = c;
- } else if (key == QLatin1String("background")) {
+ } else if (key == "background"_L1) {
node->applyBackgroundImage(value, resourceProvider);
- } else if (key == QLatin1String("cellspacing")) {
+ } else if (key == "cellspacing"_L1) {
setFloatAttribute(&node->tableCellSpacing, value);
- } else if (key == QLatin1String("cellpadding")) {
+ } else if (key == "cellpadding"_L1) {
setFloatAttribute(&node->tableCellPadding, value);
- } else if (key == QLatin1String("width")) {
+ } else if (key == "width"_L1) {
setWidthAttribute(&node->width, value);
- } else if (key == QLatin1String("height")) {
+ } else if (key == "height"_L1) {
setWidthAttribute(&node->height, value);
}
break;
case Html_meta:
- if (key == QLatin1String("name")
- && value == QLatin1String("qrichtext")) {
+ if (key == "name"_L1 && value == "qrichtext"_L1)
seenQt3Richtext = true;
- }
-
- if (key == QLatin1String("content")
- && value == QLatin1String("1")
- && seenQt3Richtext) {
+ if (key == "content"_L1 && value == "1"_L1 && seenQt3Richtext)
textEditMode = true;
- }
break;
case Html_hr:
- if (key == QLatin1String("width"))
+ if (key == "width"_L1)
setWidthAttribute(&node->width, value);
break;
case Html_link:
- if (key == QLatin1String("href"))
+ if (key == "href"_L1)
linkHref = value;
- else if (key == QLatin1String("type"))
+ else if (key == "type"_L1)
linkType = value;
break;
case Html_pre:
- if (key == QLatin1String("class") && value.startsWith(QLatin1String("language-")))
+ if (key == "class"_L1 && value.startsWith("language-"_L1))
node->blockFormat.setProperty(QTextFormat::BlockCodeLanguage, value.mid(9));
break;
default:
break;
}
- if (key == QLatin1String("style")) {
+ if (key == "style"_L1) {
#ifndef QT_NO_CSSPARSER
node->parseStyleAttribute(value, resourceProvider);
#endif
- } else if (key == QLatin1String("align")) {
+ } else if (key == "align"_L1) {
value = std::move(value).toLower();
bool alignmentSet = true;
- if (value == QLatin1String("left"))
+ if (value == "left"_L1)
node->blockFormat.setAlignment(Qt::AlignLeft|Qt::AlignAbsolute);
- else if (value == QLatin1String("right"))
+ else if (value == "right"_L1)
node->blockFormat.setAlignment(Qt::AlignRight|Qt::AlignAbsolute);
- else if (value == QLatin1String("center"))
+ else if (value == "center"_L1)
node->blockFormat.setAlignment(Qt::AlignHCenter);
- else if (value == QLatin1String("justify"))
+ else if (value == "justify"_L1)
node->blockFormat.setAlignment(Qt::AlignJustify);
else
alignmentSet = false;
@@ -1760,36 +1821,36 @@ void QTextHtmlParser::applyAttributes(const QStringList &attributes)
node->cssFloat = QTextFrameFormat::FloatLeft;
else if (node->blockFormat.alignment() & Qt::AlignRight)
node->cssFloat = QTextFrameFormat::FloatRight;
- } else if (value == QLatin1String("middle")) {
+ } else if (value == "middle"_L1) {
node->charFormat.setVerticalAlignment(QTextCharFormat::AlignMiddle);
- } else if (value == QLatin1String("top")) {
+ } else if (value == "top"_L1) {
node->charFormat.setVerticalAlignment(QTextCharFormat::AlignTop);
}
}
- } else if (key == QLatin1String("valign")) {
+ } else if (key == "valign"_L1) {
value = std::move(value).toLower();
- if (value == QLatin1String("top"))
+ if (value == "top"_L1)
node->charFormat.setVerticalAlignment(QTextCharFormat::AlignTop);
- else if (value == QLatin1String("middle"))
+ else if (value == "middle"_L1)
node->charFormat.setVerticalAlignment(QTextCharFormat::AlignMiddle);
- else if (value == QLatin1String("bottom"))
+ else if (value == "bottom"_L1)
node->charFormat.setVerticalAlignment(QTextCharFormat::AlignBottom);
- } else if (key == QLatin1String("dir")) {
+ } else if (key == "dir"_L1) {
value = std::move(value).toLower();
- if (value == QLatin1String("ltr"))
+ if (value == "ltr"_L1)
node->blockFormat.setLayoutDirection(Qt::LeftToRight);
- else if (value == QLatin1String("rtl"))
+ else if (value == "rtl"_L1)
node->blockFormat.setLayoutDirection(Qt::RightToLeft);
- } else if (key == QLatin1String("title")) {
+ } else if (key == "title"_L1) {
node->charFormat.setToolTip(value);
- } else if (key == QLatin1String("id")) {
+ } else if (key == "id"_L1) {
node->charFormat.setAnchor(true);
node->charFormat.setAnchorNames({value});
}
}
#ifndef QT_NO_CSSPARSER
- if (resourceProvider && !linkHref.isEmpty() && linkType == QLatin1String("text/css"))
+ if (resourceProvider && !linkHref.isEmpty() && linkType == "text/css"_L1)
importStyleSheet(linkHref);
#endif
}
@@ -1801,14 +1862,14 @@ public:
inline QTextHtmlStyleSelector(const QTextHtmlParser *parser)
: parser(parser) { nameCaseSensitivity = Qt::CaseInsensitive; }
- virtual QStringList nodeNames(NodePtr node) const override;
- virtual QString attribute(NodePtr node, const QString &name) const override;
- virtual bool hasAttributes(NodePtr node) const override;
- virtual bool isNullNode(NodePtr node) const override;
- virtual NodePtr parentNode(NodePtr node) const override;
- virtual NodePtr previousSiblingNode(NodePtr node) const override;
- virtual NodePtr duplicateNode(NodePtr node) const override;
- virtual void freeNode(NodePtr node) const override;
+ QStringList nodeNames(NodePtr node) const override;
+ QString attributeValue(NodePtr node, const QCss::AttributeSelector &aSelector) const override;
+ bool hasAttributes(NodePtr node) const override;
+ bool isNullNode(NodePtr node) const override;
+ NodePtr parentNode(NodePtr node) const override;
+ NodePtr previousSiblingNode(NodePtr node) const override;
+ NodePtr duplicateNode(NodePtr node) const override;
+ void freeNode(NodePtr node) const override;
private:
const QTextHtmlParser *parser;
@@ -1832,10 +1893,10 @@ static inline int findAttribute(const QStringList &attributes, const QString &na
return idx;
}
-QString QTextHtmlStyleSelector::attribute(NodePtr node, const QString &name) const
+QString QTextHtmlStyleSelector::attributeValue(NodePtr node, const QCss::AttributeSelector &aSelector) const
{
const QStringList &attributes = parser->at(node.id).attributes;
- const int idx = findAttribute(attributes, name);
+ const int idx = findAttribute(attributes, aSelector.name);
if (idx == -1)
return QString();
return attributes.at(idx + 1);
@@ -1889,10 +1950,9 @@ void QTextHtmlStyleSelector::freeNode(NodePtr) const
void QTextHtmlParser::resolveStyleSheetImports(const QCss::StyleSheet &sheet)
{
- for (int i = 0; i < sheet.importRules.count(); ++i) {
+ for (int i = 0; i < sheet.importRules.size(); ++i) {
const QCss::ImportRule &rule = sheet.importRules.at(i);
- if (rule.media.isEmpty()
- || rule.media.contains(QLatin1String("screen"), Qt::CaseInsensitive))
+ if (rule.media.isEmpty() || rule.media.contains("screen"_L1, Qt::CaseInsensitive))
importStyleSheet(rule.href);
}
}
@@ -1901,15 +1961,15 @@ void QTextHtmlParser::importStyleSheet(const QString &href)
{
if (!resourceProvider)
return;
- for (int i = 0; i < externalStyleSheets.count(); ++i)
+ for (int i = 0; i < externalStyleSheets.size(); ++i)
if (externalStyleSheets.at(i).url == href)
return;
QVariant res = resourceProvider->resource(QTextDocument::StyleSheetResource, href);
QString css;
- if (res.type() == QVariant::String) {
+ if (res.userType() == QMetaType::QString) {
css = res.toString();
- } else if (res.type() == QVariant::ByteArray) {
+ } else if (res.userType() == QMetaType::QByteArray) {
// #### detect @charset
css = QString::fromUtf8(res.toByteArray());
}
@@ -1922,9 +1982,9 @@ void QTextHtmlParser::importStyleSheet(const QString &href)
}
}
-QVector<QCss::Declaration> standardDeclarationForNode(const QTextHtmlParserNode &node)
+QList<QCss::Declaration> standardDeclarationForNode(const QTextHtmlParserNode &node)
{
- QVector<QCss::Declaration> decls;
+ QList<QCss::Declaration> decls;
QCss::Declaration decl;
QCss::Value val;
switch (node.id) {
@@ -1932,16 +1992,16 @@ QVector<QCss::Declaration> standardDeclarationForNode(const QTextHtmlParserNode
case Html_u: {
bool needsUnderline = (node.id == Html_u) ? true : false;
if (node.id == Html_a) {
- for (int i = 0; i < node.attributes.count(); i += 2) {
+ for (int i = 0; i < node.attributes.size(); i += 2) {
const QString key = node.attributes.at(i);
- if (key.compare(QLatin1String("href"), Qt::CaseInsensitive) == 0
+ if (key.compare("href"_L1, Qt::CaseInsensitive) == 0
&& !node.attributes.at(i + 1).isEmpty()) {
needsUnderline = true;
- decl.d->property = QLatin1String("color");
+ decl.d->property = "color"_L1;
decl.d->propertyId = QCss::Color;
- val.type = QCss::Value::Color;
- val.variant = QVariant(QGuiApplication::palette().link());
- decl.d->values = QVector<QCss::Value>() << val;
+ val.type = QCss::Value::Function;
+ val.variant = QStringList() << "palette"_L1 << "link"_L1;
+ decl.d->values = QList<QCss::Value> { val };
decl.d->inheritable = true;
decls << decl;
break;
@@ -1950,11 +2010,11 @@ QVector<QCss::Declaration> standardDeclarationForNode(const QTextHtmlParserNode
}
if (needsUnderline) {
decl = QCss::Declaration();
- decl.d->property = QLatin1String("text-decoration");
+ decl.d->property = "text-decoration"_L1;
decl.d->propertyId = QCss::TextDecoration;
val.type = QCss::Value::KnownIdentifier;
val.variant = QVariant(QCss::Value_Underline);
- decl.d->values = QVector<QCss::Value>() << val;
+ decl.d->values = QList<QCss::Value> { val };
decl.d->inheritable = true;
decls << decl;
}
@@ -1969,11 +2029,11 @@ QVector<QCss::Declaration> standardDeclarationForNode(const QTextHtmlParserNode
case Html_h5:
case Html_th:
decl = QCss::Declaration();
- decl.d->property = QLatin1String("font-weight");
+ decl.d->property = "font-weight"_L1;
decl.d->propertyId = QCss::FontWeight;
val.type = QCss::Value::KnownIdentifier;
val.variant = QVariant(QCss::Value_Bold);
- decl.d->values = QVector<QCss::Value>() << val;
+ decl.d->values = QList<QCss::Value> { val };
decl.d->inheritable = true;
decls << decl;
if (node.id == Html_b || node.id == Html_strong)
@@ -1983,7 +2043,7 @@ QVector<QCss::Declaration> standardDeclarationForNode(const QTextHtmlParserNode
case Html_small:
if (node.id != Html_th) {
decl = QCss::Declaration();
- decl.d->property = QLatin1String("font-size");
+ decl.d->property = "font-size"_L1;
decl.d->propertyId = QCss::FontSize;
decl.d->inheritable = false;
val.type = QCss::Value::KnownIdentifier;
@@ -1995,7 +2055,7 @@ QVector<QCss::Declaration> standardDeclarationForNode(const QTextHtmlParserNode
case Html_h5: case Html_small: val.variant = QVariant(QCss::Value_Small); break;
default: break;
}
- decl.d->values = QVector<QCss::Value>() << val;
+ decl.d->values = QList<QCss::Value> { val };
decls << decl;
break;
}
@@ -2003,21 +2063,21 @@ QVector<QCss::Declaration> standardDeclarationForNode(const QTextHtmlParserNode
case Html_center:
case Html_td:
decl = QCss::Declaration();
- decl.d->property = QLatin1String("text-align");
+ decl.d->property = "text-align"_L1;
decl.d->propertyId = QCss::TextAlignment;
val.type = QCss::Value::KnownIdentifier;
val.variant = (node.id == Html_td) ? QVariant(QCss::Value_Left) : QVariant(QCss::Value_Center);
- decl.d->values = QVector<QCss::Value>() << val;
+ decl.d->values = QList<QCss::Value> { val };
decl.d->inheritable = true;
decls << decl;
break;
case Html_s:
decl = QCss::Declaration();
- decl.d->property = QLatin1String("text-decoration");
+ decl.d->property = "text-decoration"_L1;
decl.d->propertyId = QCss::TextDecoration;
val.type = QCss::Value::KnownIdentifier;
val.variant = QVariant(QCss::Value_LineThrough);
- decl.d->values = QVector<QCss::Value>() << val;
+ decl.d->values = QList<QCss::Value> { val };
decl.d->inheritable = true;
decls << decl;
break;
@@ -2028,33 +2088,33 @@ QVector<QCss::Declaration> standardDeclarationForNode(const QTextHtmlParserNode
case Html_var:
case Html_dfn:
decl = QCss::Declaration();
- decl.d->property = QLatin1String("font-style");
+ decl.d->property = "font-style"_L1;
decl.d->propertyId = QCss::FontStyle;
val.type = QCss::Value::KnownIdentifier;
val.variant = QVariant(QCss::Value_Italic);
- decl.d->values = QVector<QCss::Value>() << val;
+ decl.d->values = QList<QCss::Value> { val };
decl.d->inheritable = true;
decls << decl;
break;
case Html_sub:
case Html_sup:
decl = QCss::Declaration();
- decl.d->property = QLatin1String("vertical-align");
+ decl.d->property = "vertical-align"_L1;
decl.d->propertyId = QCss::VerticalAlignment;
val.type = QCss::Value::KnownIdentifier;
val.variant = (node.id == Html_sub) ? QVariant(QCss::Value_Sub) : QVariant(QCss::Value_Super);
- decl.d->values = QVector<QCss::Value>() << val;
+ decl.d->values = QList<QCss::Value> { val };
decl.d->inheritable = true;
decls << decl;
break;
case Html_ul:
case Html_ol:
decl = QCss::Declaration();
- decl.d->property = QLatin1String("list-style");
+ decl.d->property = "list-style"_L1;
decl.d->propertyId = QCss::ListStyle;
val.type = QCss::Value::KnownIdentifier;
val.variant = (node.id == Html_ul) ? QVariant(QCss::Value_Disc) : QVariant(QCss::Value_Decimal);
- decl.d->values = QVector<QCss::Value>() << val;
+ decl.d->values = QList<QCss::Value> { val };
decl.d->inheritable = true;
decls << decl;
break;
@@ -2064,11 +2124,11 @@ QVector<QCss::Declaration> standardDeclarationForNode(const QTextHtmlParserNode
case Html_samp:
case Html_pre: {
decl = QCss::Declaration();
- decl.d->property = QLatin1String("font-family");
+ decl.d->property = "font-family"_L1;
decl.d->propertyId = QCss::FontFamily;
- QVector<QCss::Value> values;
+ QList<QCss::Value> values;
val.type = QCss::Value::String;
- val.variant = QFontDatabase::systemFont(QFontDatabase::FixedFont).family();
+ val.variant = QFontDatabase::systemFont(QFontDatabase::FixedFont).families().constFirst();
values << val;
decl.d->values = values;
decl.d->inheritable = true;
@@ -2080,7 +2140,7 @@ QVector<QCss::Declaration> standardDeclarationForNode(const QTextHtmlParserNode
case Html_br:
case Html_nobr:
decl = QCss::Declaration();
- decl.d->property = QLatin1String("whitespace");
+ decl.d->property = "whitespace"_L1;
decl.d->propertyId = QCss::Whitespace;
val.type = QCss::Value::KnownIdentifier;
switch (node.id) {
@@ -2089,7 +2149,7 @@ QVector<QCss::Declaration> standardDeclarationForNode(const QTextHtmlParserNode
case Html_pre: val.variant = QVariant(QCss::Value_Pre); break;
default: break;
}
- decl.d->values = QVector<QCss::Value>() << val;
+ decl.d->values = QList<QCss::Value> { val };
decl.d->inheritable = true;
decls << decl;
break;
@@ -2099,39 +2159,39 @@ QVector<QCss::Declaration> standardDeclarationForNode(const QTextHtmlParserNode
return decls;
}
-QVector<QCss::Declaration> QTextHtmlParser::declarationsForNode(int node) const
+QList<QCss::Declaration> QTextHtmlParser::declarationsForNode(int node) const
{
- QVector<QCss::Declaration> decls;
+ QList<QCss::Declaration> decls;
QTextHtmlStyleSelector selector(this);
int idx = 0;
selector.styleSheets.resize((resourceProvider ? 1 : 0)
- + externalStyleSheets.count()
- + inlineStyleSheets.count());
+ + externalStyleSheets.size()
+ + inlineStyleSheets.size());
if (resourceProvider)
- selector.styleSheets[idx++] = resourceProvider->docHandle()->parsedDefaultStyleSheet;
+ selector.styleSheets[idx++] = QTextDocumentPrivate::get(resourceProvider)->parsedDefaultStyleSheet;
- for (int i = 0; i < externalStyleSheets.count(); ++i, ++idx)
+ for (int i = 0; i < externalStyleSheets.size(); ++i, ++idx)
selector.styleSheets[idx] = externalStyleSheets.at(i).sheet;
- for (int i = 0; i < inlineStyleSheets.count(); ++i, ++idx)
+ for (int i = 0; i < inlineStyleSheets.size(); ++i, ++idx)
selector.styleSheets[idx] = inlineStyleSheets.at(i);
- selector.medium = QLatin1String("screen");
+ selector.medium = resourceProvider ? resourceProvider->metaInformation(QTextDocument::CssMedia) : "screen"_L1;
QCss::StyleSelector::NodePtr n;
n.id = node;
const char *extraPseudo = nullptr;
- if (nodes.at(node).id == Html_a && nodes.at(node).hasHref)
+ if (nodes.at(node)->id == Html_a && nodes.at(node)->hasHref)
extraPseudo = "link";
// Ensure that our own style is taken into consideration
- decls = standardDeclarationForNode(nodes.at(node));
+ decls = standardDeclarationForNode(*nodes.at(node));
decls += selector.declarationsForNode(n, extraPseudo);
n = selector.parentNode(n);
while (!selector.isNullNode(n)) {
- QVector<QCss::Declaration> inheritedDecls;
+ QList<QCss::Declaration> inheritedDecls;
inheritedDecls = selector.declarationsForNode(n, extraPseudo);
for (int i = 0; i < inheritedDecls.size(); ++i) {
const QCss::Declaration &decl = inheritedDecls.at(i);
diff --git a/src/gui/text/qtexthtmlparser_p.h b/src/gui/text/qtexthtmlparser_p.h
index 31f558709f..dd52baa23e 100644
--- a/src/gui/text/qtexthtmlparser_p.h
+++ b/src/gui/text/qtexthtmlparser_p.h
@@ -1,41 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the QtGui module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#ifndef QTEXTHTMLPARSER_P_H
#define QTEXTHTMLPARSER_P_H
@@ -52,15 +16,19 @@
//
#include <QtGui/private/qtguiglobal_p.h>
-#include "QtCore/qvector.h"
#include "QtGui/qbrush.h"
#include "QtGui/qcolor.h"
#include "QtGui/qfont.h"
#include "QtGui/qtextdocument.h"
#include "QtGui/qtextcursor.h"
+
+#include "QtCore/qlist.h"
+
#include "private/qtextformat_p.h"
#include "private/qtextdocument_p.h"
+#if QT_CONFIG(cssparser)
#include "private/qcssparser_p.h"
+#endif
#ifndef QT_NO_TEXTHTMLPARSER
@@ -167,7 +135,7 @@ struct QTextHtmlParserNode {
QString text;
QStringList attributes;
int parent;
- QVector<int> children;
+ QList<int> children;
QTextHTMLElements id;
QTextCharFormat charFormat;
QTextBlockFormat blockFormat;
@@ -182,6 +150,7 @@ struct QTextHtmlParserNode {
uint displayMode : 3; // QTextHtmlElement::DisplayMode
uint hasHref : 1;
QTextListFormat::Style listStyle;
+ int listStart = 1;
QString textListNumberPrefix;
QString textListNumberSuffix;
QString imageName;
@@ -251,10 +220,11 @@ struct QTextHtmlParserNode {
void parseStyleAttribute(const QString &value, const QTextDocument *resourceProvider);
#if QT_CONFIG(cssparser)
- void applyCssDeclarations(const QVector<QCss::Declaration> &declarations, const QTextDocument *resourceProvider);
+ void applyCssDeclarations(const QList<QCss::Declaration> &declarations,
+ const QTextDocument *resourceProvider);
- void setListStyle(const QVector<QCss::Value> &cssValues);
-#endif
+ void setListStyle(const QList<QCss::Value> &cssValues);
+# endif
void applyForegroundImage(qint64 cacheKey, const QTextDocument *resourceProvider);
void applyBackgroundImage(const QString &url, const QTextDocument *resourceProvider);
@@ -266,7 +236,7 @@ struct QTextHtmlParserNode {
friend class QTextHtmlParser;
};
-Q_DECLARE_TYPEINFO(QTextHtmlParserNode, Q_MOVABLE_TYPE);
+Q_DECLARE_TYPEINFO(QTextHtmlParserNode, Q_RELOCATABLE_TYPE);
class QTextHtmlParser
@@ -278,11 +248,15 @@ public:
MarginBottom,
MarginLeft
};
+ ~QTextHtmlParser()
+ {
+ qDeleteAll(nodes);
+ }
- inline const QTextHtmlParserNode &at(int i) const { return nodes.at(i); }
- inline QTextHtmlParserNode &operator[](int i) { return nodes[i]; }
- inline int count() const { return nodes.count(); }
- inline int last() const { return nodes.count()-1; }
+ inline const QTextHtmlParserNode &at(int i) const { return *nodes.at(i); }
+ inline QTextHtmlParserNode &operator[](int i) { return *nodes[i]; }
+ inline int count() const { return nodes.size(); }
+ inline int last() const { return nodes.size()-1; }
int depth(int i) const;
int topMargin(int i) const;
int bottomMargin(int i) const;
@@ -302,10 +276,13 @@ public:
void parse(const QString &text, const QTextDocument *resourceProvider);
- static int lookupElement(const QString &element);
+ static int lookupElement(QStringView element);
+
+ Q_GUI_EXPORT static QString parseEntity(QStringView entity);
+
protected:
QTextHtmlParserNode *newNode(int parent);
- QVector<QTextHtmlParserNode> nodes;
+ QList<QTextHtmlParserNode *> nodes;
QString txt;
int pos, len;
@@ -323,14 +300,16 @@ protected:
void applyAttributes(const QStringList &attributes);
void eatSpace();
inline bool hasPrefix(QChar c, int lookahead = 0) const
- {return pos + lookahead < len && txt.at(pos) == c; }
+ {
+ return pos + lookahead < len && txt.at(pos + lookahead) == c;
+ }
int margin(int i, int mar) const;
bool nodeIsChildOf(int i, QTextHTMLElements id) const;
#if QT_CONFIG(cssparser)
- QVector<QCss::Declaration> declarationsForNode(int node) const;
+ QList<QCss::Declaration> declarationsForNode(int node) const;
void resolveStyleSheetImports(const QCss::StyleSheet &sheet);
void importStyleSheet(const QString &href);
@@ -343,14 +322,14 @@ protected:
QCss::StyleSheet sheet;
};
friend class QTypeInfo<ExternalStyleSheet>;
- QVector<ExternalStyleSheet> externalStyleSheets;
- QVector<QCss::StyleSheet> inlineStyleSheets;
-#endif
+ QList<ExternalStyleSheet> externalStyleSheets;
+ QList<QCss::StyleSheet> inlineStyleSheets;
+# endif
const QTextDocument *resourceProvider;
};
#if QT_CONFIG(cssparser)
-Q_DECLARE_TYPEINFO(QTextHtmlParser::ExternalStyleSheet, Q_MOVABLE_TYPE);
+Q_DECLARE_TYPEINFO(QTextHtmlParser::ExternalStyleSheet, Q_RELOCATABLE_TYPE);
#endif
QT_END_NAMESPACE
diff --git a/src/gui/text/qtextimagehandler.cpp b/src/gui/text/qtextimagehandler.cpp
index 14018f34da..920e6c689c 100644
--- a/src/gui/text/qtextimagehandler.cpp
+++ b/src/gui/text/qtextimagehandler.cpp
@@ -1,41 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the QtGui module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#include "qtextimagehandler_p.h"
@@ -48,184 +12,119 @@
#include <private/qtextengine_p.h>
#include <qpalette.h>
#include <qthread.h>
+#include <limits>
QT_BEGIN_NAMESPACE
-extern QString qt_findAtNxFile(const QString &baseFileName, qreal targetDevicePixelRatio,
- qreal *sourceDevicePixelRatio);
-static QString resolveFileName(QString fileName, QUrl *url, qreal targetDevicePixelRatio,
- qreal *sourceDevicePixelRatio)
-{
- // We might use the fileName for loading if url loading fails
- // try to make sure it is a valid file path.
- // Also, QFile{Info}::exists works only on filepaths (not urls)
-
- if (url->isValid()) {
- if (url->scheme() == QLatin1String("qrc")) {
- fileName = fileName.right(fileName.length() - 3);
- }
- else if (url->scheme() == QLatin1String("file")) {
- fileName = url->toLocalFile();
- }
- }
-
- if (targetDevicePixelRatio <= 1.0)
- return fileName;
+using namespace Qt::StringLiterals;
- // try to find a Nx version
- return qt_findAtNxFile(fileName, targetDevicePixelRatio, sourceDevicePixelRatio);
+static inline QString findAtNxFileOrResource(const QString &baseFileName,
+ qreal targetDevicePixelRatio,
+ qreal *sourceDevicePixelRatio)
+{
+ // qt_findAtNxFile expects a file name that can be tested with QFile::exists.
+ // so if the format.name() is a file:/ or qrc:/ URL, then we need to strip away the schema.
+ QString localFile;
+ const QUrl url(baseFileName);
+ if (url.isLocalFile())
+ localFile = url.toLocalFile();
+ else if (baseFileName.startsWith("qrc:/"_L1))
+ localFile = baseFileName.sliced(3);
+ else
+ localFile = baseFileName;
+ extern QString qt_findAtNxFile(const QString &baseFileName, qreal targetDevicePixelRatio,
+ qreal *sourceDevicePixelRatio);
+ return qt_findAtNxFile(localFile, targetDevicePixelRatio, sourceDevicePixelRatio);
}
-
-static QPixmap getPixmap(QTextDocument *doc, const QTextImageFormat &format, const qreal devicePixelRatio = 1.0)
+static inline QUrl fromLocalfileOrResources(QString path)
{
- QPixmap pm;
+ if (path.startsWith(":/"_L1)) // auto-detect resources and convert them to url
+ path = path.prepend("qrc"_L1);
+ return QUrl(path);
+}
- QString name = format.name();
- if (name.startsWith(QLatin1String(":/"))) // auto-detect resources and convert them to url
- name.prepend(QLatin1String("qrc"));
- QUrl url = QUrl(name);
+template<typename T>
+static T getAs(QTextDocument *doc, const QTextImageFormat &format, const qreal devicePixelRatio = 1.0)
+{
qreal sourcePixelRatio = 1.0;
- name = resolveFileName(name, &url, devicePixelRatio, &sourcePixelRatio);
- const QVariant data = doc->resource(QTextDocument::ImageResource, url);
- if (data.type() == QVariant::Pixmap || data.type() == QVariant::Image) {
- pm = qvariant_cast<QPixmap>(data);
- } else if (data.type() == QVariant::ByteArray) {
- pm.loadFromData(data.toByteArray());
- }
+ const QString name = findAtNxFileOrResource(format.name(), devicePixelRatio, &sourcePixelRatio);
+ const QUrl url = fromLocalfileOrResources(name);
- if (pm.isNull()) {
-#if 0
- QString context;
- // ### Qt5
- QTextBrowser *browser = qobject_cast<QTextBrowser *>(doc->parent());
- if (browser)
- context = browser->source().toString();
-#endif
- // try direct loading
- QImage img;
- if (name.isEmpty() || !img.load(name))
- return QPixmap(QLatin1String(":/qt-project.org/styles/commonstyle/images/file-16.png"));
-
- pm = QPixmap::fromImage(img);
- doc->addResource(QTextDocument::ImageResource, url, pm);
+ const QVariant data = doc->resource(QTextDocument::ImageResource, url);
+ T result;
+ if (data.userType() == QMetaType::QPixmap || data.userType() == QMetaType::QImage)
+ result = data.value<T>();
+ else if (data.metaType() == QMetaType::fromType<QByteArray>())
+ result.loadFromData(data.toByteArray());
+
+ if (result.isNull()) {
+ if (name.isEmpty() || !result.load(name))
+ return T(":/qt-project.org/styles/commonstyle/images/file-16.png"_L1);
+ doc->addResource(QTextDocument::ImageResource, url, result);
}
- if (name.contains(QLatin1String("@2x")))
- pm.setDevicePixelRatio(sourcePixelRatio);
-
- return pm;
+ if (sourcePixelRatio != 1.0)
+ result.setDevicePixelRatio(sourcePixelRatio);
+ return result;
}
-static QSize getPixmapSize(QTextDocument *doc, const QTextImageFormat &format)
+template<typename T>
+static QSize getSize(QTextDocument *doc, const QTextImageFormat &format)
{
- QPixmap pm;
-
const bool hasWidth = format.hasProperty(QTextFormat::ImageWidth);
- const int width = qRound(format.width());
+ int width = qRound(format.width());
const bool hasHeight = format.hasProperty(QTextFormat::ImageHeight);
const int height = qRound(format.height());
+ const bool hasMaxWidth = format.hasProperty(QTextFormat::ImageMaxWidth);
+ const auto maxWidth = format.maximumWidth();
+
+ int effectiveMaxWidth = std::numeric_limits<int>::max();
+ if (hasMaxWidth) {
+ if (maxWidth.type() == QTextLength::PercentageLength)
+ effectiveMaxWidth = (doc->pageSize().width() - 2 * doc->documentMargin()) * maxWidth.value(100) / 100;
+ else
+ effectiveMaxWidth = maxWidth.rawValue();
+
+ width = qMin(effectiveMaxWidth, width);
+ }
+
+ T source;
QSize size(width, height);
if (!hasWidth || !hasHeight) {
- pm = getPixmap(doc, format);
- const int pmWidth = pm.width() / pm.devicePixelRatio();
- const int pmHeight = pm.height() / pm.devicePixelRatio();
+ source = getAs<T>(doc, format);
+ QSizeF sourceSize = source.deviceIndependentSize();
+
+ if (sourceSize.width() > effectiveMaxWidth) {
+ // image is bigger than effectiveMaxWidth, scale it down
+ sourceSize.setHeight(effectiveMaxWidth * (sourceSize.height() / qreal(sourceSize.width())));
+ sourceSize.setWidth(effectiveMaxWidth);
+ }
if (!hasWidth) {
if (!hasHeight)
- size.setWidth(pmWidth);
+ size.setWidth(sourceSize.width());
else
- size.setWidth(qRound(height * (pmWidth / (qreal) pmHeight)));
+ size.setWidth(qMin(effectiveMaxWidth, qRound(height * (sourceSize.width() / qreal(sourceSize.height())))));
}
if (!hasHeight) {
if (!hasWidth)
- size.setHeight(pmHeight);
+ size.setHeight(sourceSize.height());
else
- size.setHeight(qRound(width * (pmHeight / (qreal) pmWidth)));
+ size.setHeight(qRound(width * (sourceSize.height() / qreal(sourceSize.width()))));
}
}
qreal scale = 1.0;
QPaintDevice *pdev = doc->documentLayout()->paintDevice();
if (pdev) {
- if (pm.isNull())
- pm = getPixmap(doc, format);
- if (!pm.isNull())
+ if (source.isNull())
+ source = getAs<T>(doc, format);
+ if (!source.isNull())
scale = qreal(pdev->logicalDpiY()) / qreal(qt_defaultDpi());
}
size *= scale;
-
- return size;
-}
-
-static QImage getImage(QTextDocument *doc, const QTextImageFormat &format, const qreal devicePixelRatio = 1.0)
-{
- QImage image;
-
- QString name = format.name();
- if (name.startsWith(QLatin1String(":/"))) // auto-detect resources
- name.prepend(QLatin1String("qrc"));
- QUrl url = QUrl(name);
- qreal sourcePixelRatio = 1.0;
- name = resolveFileName(name, &url, devicePixelRatio, &sourcePixelRatio);
- const QVariant data = doc->resource(QTextDocument::ImageResource, url);
- if (data.type() == QVariant::Image) {
- image = qvariant_cast<QImage>(data);
- } else if (data.type() == QVariant::ByteArray) {
- image.loadFromData(data.toByteArray());
- }
-
- if (image.isNull()) {
-#if 0
- QString context;
- // ### Qt5
- QTextBrowser *browser = qobject_cast<QTextBrowser *>(doc->parent());
- if (browser)
- context = browser->source().toString();
-#endif
- // try direct loading
-
- if (name.isEmpty() || !image.load(name))
- return QImage(QLatin1String(":/qt-project.org/styles/commonstyle/images/file-16.png"));
-
- doc->addResource(QTextDocument::ImageResource, url, image);
- }
-
- if (sourcePixelRatio != 1.0)
- image.setDevicePixelRatio(sourcePixelRatio);
-
- return image;
-}
-
-static QSize getImageSize(QTextDocument *doc, const QTextImageFormat &format)
-{
- QImage image;
-
- const bool hasWidth = format.hasProperty(QTextFormat::ImageWidth);
- const int width = qRound(format.width());
- const bool hasHeight = format.hasProperty(QTextFormat::ImageHeight);
- const int height = qRound(format.height());
-
- QSize size(width, height);
- if (!hasWidth || !hasHeight) {
- image = getImage(doc, format);
- if (!hasWidth)
- size.setWidth(image.width() / image.devicePixelRatio());
- if (!hasHeight)
- size.setHeight(image.height() / image.devicePixelRatio());
- }
-
- qreal scale = 1.0;
- QPaintDevice *pdev = doc->documentLayout()->paintDevice();
- if (pdev) {
- if (image.isNull())
- image = getImage(doc, format);
- if (!image.isNull())
- scale = qreal(pdev->logicalDpiY()) / qreal(qt_defaultDpi());
- }
- size *= scale;
-
return size;
}
@@ -236,33 +135,35 @@ QTextImageHandler::QTextImageHandler(QObject *parent)
QSizeF QTextImageHandler::intrinsicSize(QTextDocument *doc, int posInDocument, const QTextFormat &format)
{
- Q_UNUSED(posInDocument)
+ Q_UNUSED(posInDocument);
const QTextImageFormat imageFormat = format.toImageFormat();
if (QCoreApplication::instance()->thread() != QThread::currentThread())
- return getImageSize(doc, imageFormat);
- return getPixmapSize(doc, imageFormat);
+ return getSize<QImage>(doc, imageFormat);
+ return getSize<QPixmap>(doc, imageFormat);
}
QImage QTextImageHandler::image(QTextDocument *doc, const QTextImageFormat &imageFormat)
{
Q_ASSERT(doc != nullptr);
- return getImage(doc, imageFormat);
+ return getAs<QImage>(doc, imageFormat);
}
void QTextImageHandler::drawObject(QPainter *p, const QRectF &rect, QTextDocument *doc, int posInDocument, const QTextFormat &format)
{
- Q_UNUSED(posInDocument)
+ Q_UNUSED(posInDocument);
const QTextImageFormat imageFormat = format.toImageFormat();
if (QCoreApplication::instance()->thread() != QThread::currentThread()) {
- const QImage image = getImage(doc, imageFormat, p->device()->devicePixelRatioF());
+ const QImage image = getAs<QImage>(doc, imageFormat, p->device()->devicePixelRatio());
p->drawImage(rect, image, image.rect());
} else {
- const QPixmap pixmap = getPixmap(doc, imageFormat, p->device()->devicePixelRatioF());
+ const QPixmap pixmap = getAs<QPixmap>(doc, imageFormat, p->device()->devicePixelRatio());
p->drawPixmap(rect, pixmap, pixmap.rect());
}
}
QT_END_NAMESPACE
+
+#include "moc_qtextimagehandler_p.cpp"
diff --git a/src/gui/text/qtextimagehandler_p.h b/src/gui/text/qtextimagehandler_p.h
index fafd394ad3..d28f474c67 100644
--- a/src/gui/text/qtextimagehandler_p.h
+++ b/src/gui/text/qtextimagehandler_p.h
@@ -1,41 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the QtGui module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#ifndef QTEXTIMAGEHANDLER_P_H
#define QTEXTIMAGEHANDLER_P_H
diff --git a/src/gui/text/qtextlayout.cpp b/src/gui/text/qtextlayout.cpp
index fc256d72f3..f0c7dd24e5 100644
--- a/src/gui/text/qtextlayout.cpp
+++ b/src/gui/text/qtextlayout.cpp
@@ -1,41 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the QtGui module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#include "qtextlayout.h"
#include "qtextengine_p.h"
@@ -85,7 +49,7 @@ QT_BEGIN_NAMESPACE
/*!
\variable QTextLayout::FormatRange::length
- Specifies the numer of characters the format range spans.
+ Specifies the number of characters the format range spans.
*/
/*!
@@ -93,15 +57,13 @@ QT_BEGIN_NAMESPACE
Specifies the format to apply.
*/
-/*! \fn bool operator==(const QTextLayout::FormatRange &lhs, const QTextLayout::FormatRange &rhs)
- \relates QTextLayout::FormatRange
+/*! \fn bool QTextLayout::FormatRange::operator==(const QTextLayout::FormatRange &lhs, const QTextLayout::FormatRange &rhs)
Returns true if the \c {start}, \c {length}, and \c {format} fields
in \a lhs and \a rhs contain the same values respectively.
*/
-/*! \fn bool operator!=(const QTextLayout::FormatRange &lhs, const QTextLayout::FormatRange &rhs)
- \relates QTextLayout::FormatRange
+/*! \fn bool QTextLayout::FormatRange::operator!=(const QTextLayout::FormatRange &lhs, const QTextLayout::FormatRange &rhs)
Returns true if any of the \c {start}, \c {length}, or \c {format} fields
in \a lhs and \a rhs contain different values respectively.
@@ -303,6 +265,10 @@ Qt::LayoutDirection QTextInlineObject::textDirection() const
The text can then be rendered by calling the layout's draw() function:
\snippet code/src_gui_text_qtextlayout.cpp 1
+ It is also possible to draw each line individually, for instance to draw
+ the last line that fits into a widget elided:
+ \snippet code/src_gui_text_qtextlayout.cpp elided
+
For a given position in the text you can find a valid cursor position with
isValidCursorPosition(), nextCursorPosition(), and previousCursorPosition().
@@ -320,6 +286,26 @@ Qt::LayoutDirection QTextInlineObject::textDirection() const
*/
/*!
+ \enum QTextLayout::GlyphRunRetrievalFlag
+ \since 6.5
+
+ GlyphRunRetrievalFlag specifies flags passed to the glyphRuns() functions to determine
+ which properties of the layout are returned in the QGlyphRun objects. Since each property
+ will consume memory and may require additional allocations, it is a good practice to only
+ request the properties you will need to access later.
+
+ \value RetrieveGlyphIndexes Retrieves the indexes in the font which correspond to the glyphs.
+ \value RetrieveGlyphPositions Retrieves the relative positions of the glyphs in the layout.
+ \value RetrieveStringIndexes Retrieves the indexes in the original string that correspond to
+ each of the glyphs.
+ \value RetrieveString Retrieves the original source string from the layout.
+ \value RetrieveAll Retrieves all available properties of the layout.
+ \omitvalue DefaultRetrievalFlags
+
+ \sa glyphRuns(), QTextLine::glyphRuns()
+*/
+
+/*!
\fn QTextEngine *QTextLayout::engine() const
\internal
@@ -350,21 +336,11 @@ QTextLayout::QTextLayout(const QString& text)
\a font.
All the metric and layout calculations will be done in terms of
- the paint device, \a paintdevice. If \a paintdevice is 0 the
+ the paint device, \a paintdevice. If \a paintdevice is \nullptr the
calculations will be done in screen metrics.
*/
-#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
-/*!
- \fn QTextLayout::QTextLayout(const QString &text, const QFont &font, QPaintDevice *paintdevice)
- \obsolete
- Identical to QTextLayout::QTextLayout(const QString &text, const QFont &font, const QPaintDevice *paintdevice)
-*/
-
-QTextLayout::QTextLayout(const QString &text, const QFont &font, QPaintDevice *paintdevice)
-#else
QTextLayout::QTextLayout(const QString &text, const QFont &font, const QPaintDevice *paintdevice)
-#endif
{
const QFont f(paintdevice ? QFont(font, paintdevice) : font);
d = new QTextEngine((text.isNull() ? (const QString&)QString::fromLatin1("") : text), f);
@@ -491,8 +467,8 @@ void QTextLayout::setPreeditArea(int position, const QString &text)
return;
d->setPreeditArea(position, text);
- if (d->block.docHandle())
- d->block.docHandle()->documentChange(d->block.position(), d->block.length());
+ if (QTextDocumentPrivate::get(d->block) != nullptr)
+ QTextDocumentPrivate::get(d->block)->documentChange(d->block.position(), d->block.length());
}
/*!
@@ -516,16 +492,6 @@ QString QTextLayout::preeditAreaText() const
return d->preeditAreaText();
}
-#if QT_DEPRECATED_SINCE(5, 6)
-/*!
- \obsolete Use setFormats() instead.
-*/
-void QTextLayout::setAdditionalFormats(const QList<FormatRange> &formatList)
-{
- setFormats(formatList.toVector());
-}
-#endif // deprecated since 5.6
-
/*!
\since 5.6
@@ -534,25 +500,13 @@ void QTextLayout::setAdditionalFormats(const QList<FormatRange> &formatList)
\sa formats(), clearFormats()
*/
-void QTextLayout::setFormats(const QVector<FormatRange> &formats)
+void QTextLayout::setFormats(const QList<FormatRange> &formats)
{
d->setFormats(formats);
- if (d->block.docHandle())
- d->block.docHandle()->documentChange(d->block.position(), d->block.length());
-}
-
-#if QT_DEPRECATED_SINCE(5, 6)
-/*!
- \obsolete Use formats() instead.
-
- \sa setAdditionalFormats(), clearAdditionalFormats()
-*/
-QList<QTextLayout::FormatRange> QTextLayout::additionalFormats() const
-{
- return formats().toList();
+ if (QTextDocumentPrivate::get(d->block) != nullptr)
+ QTextDocumentPrivate::get(d->block)->documentChange(d->block.position(), d->block.length());
}
-#endif // deprecated since 5.6
/*!
\since 5.6
@@ -561,21 +515,11 @@ QList<QTextLayout::FormatRange> QTextLayout::additionalFormats() const
\sa setFormats(), clearFormats()
*/
-QVector<QTextLayout::FormatRange> QTextLayout::formats() const
+QList<QTextLayout::FormatRange> QTextLayout::formats() const
{
return d->formats();
}
-#if QT_DEPRECATED_SINCE(5, 6)
-/*!
- \obsolete Use clearFormats() instead.
-*/
-void QTextLayout::clearAdditionalFormats()
-{
- clearFormats();
-}
-#endif // deprecated since 5.6
-
/*!
\since 5.6
@@ -585,7 +529,7 @@ void QTextLayout::clearAdditionalFormats()
*/
void QTextLayout::clearFormats()
{
- setFormats(QVector<FormatRange>());
+ setFormats(QList<FormatRange>());
}
/*!
@@ -707,8 +651,8 @@ int QTextLayout::nextCursorPosition(int oldPos, CursorMode mode) const
{
const QCharAttributes *attributes = d->attributes();
int len = d->block.isValid() ? d->block.length() - 1
- : d->layoutData->string.length();
- Q_ASSERT(len <= d->layoutData->string.length());
+ : d->layoutData->string.size();
+ Q_ASSERT(len <= d->layoutData->string.size());
if (!attributes || oldPos < 0 || oldPos >= len)
return oldPos;
@@ -743,8 +687,8 @@ int QTextLayout::previousCursorPosition(int oldPos, CursorMode mode) const
{
const QCharAttributes *attributes = d->attributes();
int len = d->block.isValid() ? d->block.length() - 1
- : d->layoutData->string.length();
- Q_ASSERT(len <= d->layoutData->string.length());
+ : d->layoutData->string.size();
+ Q_ASSERT(len <= d->layoutData->string.size());
if (!attributes || oldPos <= 0 || oldPos > len)
return oldPos;
@@ -797,7 +741,7 @@ int QTextLayout::leftCursorPosition(int oldPos) const
return newPos;
}
-/*!/
+/*!
Returns \c true if position \a pos is a valid cursor position.
In a Unicode context some positions in the text are not valid
@@ -807,7 +751,7 @@ int QTextLayout::leftCursorPosition(int oldPos) const
A grapheme cluster is a sequence of two or more Unicode characters
that form one indivisible entity on the screen. For example the
latin character `\unicode{0xC4}' can be represented in Unicode by two
- characters, `A' (0x41), and the combining diaresis (0x308). A text
+ characters, `A' (0x41), and the combining diaeresis (0x308). A text
cursor can only validly be positioned before or after these two
characters, never between them since that wouldn't make sense. In
indic languages every syllable forms a grapheme cluster.
@@ -815,7 +759,7 @@ int QTextLayout::leftCursorPosition(int oldPos) const
bool QTextLayout::isValidCursorPosition(int pos) const
{
const QCharAttributes *attributes = d->attributes();
- if (!attributes || pos < 0 || pos > (int)d->layoutData->string.length())
+ if (!attributes || pos < 0 || pos > (int)d->layoutData->string.size())
return false;
return attributes[pos].graphemeBoundary;
}
@@ -850,9 +794,13 @@ QTextLine QTextLayout::createLine()
int l = d->lines.size();
if (l && d->lines.at(l-1).length < 0) {
QTextLine(l-1, d).setNumColumns(INT_MAX);
+ if (d->maxWidth > QFIXED_MAX / 2) {
+ qWarning("QTextLayout: text too long, truncated.");
+ return QTextLine();
+ }
}
int from = l > 0 ? d->lines.at(l-1).from + d->lines.at(l-1).length + d->lines.at(l-1).trailingSpaces : 0;
- int strlen = d->layoutData->string.length();
+ int strlen = d->layoutData->string.size();
if (l && from >= strlen) {
if (!d->lines.at(l-1).length || d->layoutData->string.at(strlen - 1) != QChar::LineSeparator)
return QTextLine();
@@ -1037,7 +985,9 @@ static inline QRectF clipIfValid(const QRectF &rect, const QRectF &clip)
}
+#if QT_VERSION < QT_VERSION_CHECK(7, 0, 0)
/*!
+ \overload
Returns the glyph indexes and positions for all glyphs corresponding to the \a length characters
starting at the position \a from in this QTextLayout. This is an expensive function, and should
not be called in a time sensitive context.
@@ -1045,27 +995,57 @@ static inline QRectF clipIfValid(const QRectF &rect, const QRectF &clip)
If \a from is less than zero, then the glyph run will begin at the first character in the
layout. If \a length is less than zero, it will span the entire string from the start position.
+ \note This is equivalent to calling
+ glyphRuns(from,
+ length,
+ QTextLayout::GlyphRunRetrievalFlag::GlyphIndexes |
+ QTextLayout::GlyphRunRetrievalFlag::GlyphPositions).
+
\since 4.8
\sa draw(), QPainter::drawGlyphRun()
*/
-#if !defined(QT_NO_RAWFONT)
+# if !defined(QT_NO_RAWFONT)
QList<QGlyphRun> QTextLayout::glyphRuns(int from, int length) const
{
+ return glyphRuns(from, length, QTextLayout::GlyphRunRetrievalFlag::DefaultRetrievalFlags);
+}
+# endif
+#endif
+
+/*!
+ \overload
+ Returns the glyph indexes and positions for all glyphs corresponding to the \a length characters
+ starting at the position \a from in this QTextLayout. This is an expensive function, and should
+ not be called in a time sensitive context.
+
+ If \a from is less than zero, then the glyph run will begin at the first character in the
+ layout. If \a length is less than zero, it will span the entire string from the start position.
+
+ The \a retrievalFlags specifies which properties of the QGlyphRun will be retrieved from the
+ layout. To minimize allocations and memory consumption, this should be set to include only the
+ properties that you need to access later.
+
+ \since 6.5
+ \sa draw(), QPainter::drawGlyphRun()
+*/
+#if !defined(QT_NO_RAWFONT)
+QList<QGlyphRun> QTextLayout::glyphRuns(int from,
+ int length,
+ QTextLayout::GlyphRunRetrievalFlags retrievalFlags) const
+{
if (from < 0)
from = 0;
if (length < 0)
- length = text().length();
+ length = text().size();
QHash<QPair<QFontEngine *, int>, QGlyphRun> glyphRunHash;
for (int i=0; i<d->lines.size(); ++i) {
if (d->lines.at(i).from > from + length)
break;
- else if (d->lines.at(i).from + d->lines[i].length >= from) {
- QList<QGlyphRun> glyphRuns = QTextLine(i, d).glyphRuns(from, length);
-
- for (int j = 0; j < glyphRuns.size(); j++) {
- const QGlyphRun &glyphRun = glyphRuns.at(j);
+ else if (d->lines.at(i).from + d->lines.at(i).length >= from) {
+ const QList<QGlyphRun> glyphRuns = QTextLine(i, d).glyphRuns(from, length, retrievalFlags);
+ for (const QGlyphRun &glyphRun : glyphRuns) {
QRawFont rawFont = glyphRun.rawFont();
QFontEngine *fontEngine = rawFont.d->fontEngine;
@@ -1076,16 +1056,19 @@ QList<QGlyphRun> QTextLayout::glyphRuns(int from, int length) const
if (oldGlyphRun.isEmpty()) {
oldGlyphRun = glyphRun;
} else {
- QVector<quint32> indexes = oldGlyphRun.glyphIndexes();
- QVector<QPointF> positions = oldGlyphRun.positions();
+ QList<quint32> indexes = oldGlyphRun.glyphIndexes();
+ QList<QPointF> positions = oldGlyphRun.positions();
+ QList<qsizetype> stringIndexes = oldGlyphRun.stringIndexes();
QRectF boundingRect = oldGlyphRun.boundingRect();
indexes += glyphRun.glyphIndexes();
positions += glyphRun.positions();
+ stringIndexes += glyphRun.stringIndexes();
boundingRect = boundingRect.united(glyphRun.boundingRect());
oldGlyphRun.setGlyphIndexes(indexes);
oldGlyphRun.setPositions(positions);
+ oldGlyphRun.setStringIndexes(stringIndexes);
oldGlyphRun.setBoundingRect(boundingRect);
}
}
@@ -1101,7 +1084,7 @@ QList<QGlyphRun> QTextLayout::glyphRuns(int from, int length) const
The rendered layout includes the given \a selections and is clipped within
the rectangle specified by \a clip.
*/
-void QTextLayout::draw(QPainter *p, const QPointF &pos, const QVector<FormatRange> &selections, const QRectF &clip) const
+void QTextLayout::draw(QPainter *p, const QPointF &pos, const QList<FormatRange> &selections, const QRectF &clip) const
{
if (d->lines.isEmpty())
return;
@@ -1121,7 +1104,6 @@ void QTextLayout::draw(QPainter *p, const QPointF &pos, const QVector<FormatRang
int firstLine = 0;
int lastLine = d->lines.size();
for (int i = 0; i < d->lines.size(); ++i) {
- QTextLine l(i, d);
const QScriptLine &sl = d->lines.at(i);
if (sl.y > clipe) {
@@ -1148,6 +1130,7 @@ void QTextLayout::draw(QPainter *p, const QPointF &pos, const QVector<FormatRang
QRectF lineRect(tl.naturalTextRect());
lineRect.translate(position);
lineRect.adjust(0, 0, d->leadingSpaceWidth(sl).toReal(), 0);
+ lineRect.setBottom(qCeil(lineRect.bottom()));
bool isLastLineInBlock = (line == d->lines.size()-1);
int sl_length = sl.length + (isLastLineInBlock? 1 : 0); // the infamous newline
@@ -1169,10 +1152,18 @@ void QTextLayout::draw(QPainter *p, const QPointF &pos, const QVector<FormatRang
QRectF fullLineRect(tl.rect());
fullLineRect.translate(position);
fullLineRect.setRight(QFIXED_MAX);
- if (!selectionEndInLine)
- region.addRect(clipIfValid(QRectF(lineRect.topRight(), fullLineRect.bottomRight()), clip));
- if (!selectionStartInLine)
- region.addRect(clipIfValid(QRectF(fullLineRect.topLeft(), lineRect.bottomLeft()), clip));
+ fullLineRect.setBottom(qCeil(fullLineRect.bottom()));
+
+ const bool rightToLeft = d->isRightToLeft();
+
+ if (!selectionEndInLine) {
+ region.addRect(clipIfValid(rightToLeft ? QRectF(fullLineRect.topLeft(), lineRect.bottomLeft())
+ : QRectF(lineRect.topRight(), fullLineRect.bottomRight()), clip));
+ }
+ if (!selectionStartInLine) {
+ region.addRect(clipIfValid(rightToLeft ? QRectF(lineRect.topRight(), fullLineRect.bottomRight())
+ : QRectF(fullLineRect.topLeft(), lineRect.bottomLeft()), clip));
+ }
} else if (!selectionEndInLine
&& isLastLineInBlock
&&!(d->option.flags() & QTextOption::ShowLineAndParagraphSeparators)) {
@@ -1216,7 +1207,7 @@ void QTextLayout::draw(QPainter *p, const QPointF &pos, const QVector<FormatRang
for (int line = firstLine; line < lastLine; ++line) {
QTextLine l(line, d);
- l.draw(p, position, &selection);
+ l.draw_internal(p, position, &selection);
}
p->restore();
@@ -1240,7 +1231,7 @@ void QTextLayout::draw(QPainter *p, const QPointF &pos, const QVector<FormatRang
selection.format.setProperty(SuppressBackground, true);
for (int line = firstLine; line < lastLine; ++line) {
QTextLine l(line, d);
- l.draw(p, position, &selection);
+ l.draw_internal(p, position, &selection);
}
p->restore();
}
@@ -1299,7 +1290,7 @@ void QTextLayout::drawCursor(QPainter *p, const QPointF &pos, int cursorPosition
QPointF position = pos + d->position;
- cursorPosition = qBound(0, cursorPosition, d->layoutData->string.length());
+ cursorPosition = qBound(0, cursorPosition, d->layoutData->string.size());
int line = d->lineNumberForTextPosition(cursorPosition);
if (line < 0)
line = 0;
@@ -1311,25 +1302,44 @@ void QTextLayout::drawCursor(QPainter *p, const QPointF &pos, int cursorPosition
qreal x = position.x() + l.cursorToX(cursorPosition);
- int itm;
+ QFixed base = sl.base();
+ QFixed descent = sl.descent;
+ bool rightToLeft = d->isRightToLeft();
+ const int realCursorPosition = cursorPosition;
if (d->visualCursorMovement()) {
if (cursorPosition == sl.from + sl.length)
- cursorPosition--;
- itm = d->findItem(cursorPosition);
- } else
- itm = d->findItem(cursorPosition - 1);
+ --cursorPosition;
+ } else {
+ --cursorPosition;
+ }
+ int itm = d->findItem(cursorPosition);
- QFixed base = sl.base();
- QFixed descent = sl.descent;
- bool rightToLeft = d->isRightToLeft();
if (itm >= 0) {
- const QScriptItem &si = d->layoutData->items.at(itm);
- if (si.ascent > 0)
- base = si.ascent;
- if (si.descent > 0)
- descent = si.descent;
- rightToLeft = si.analysis.bidiLevel % 2;
+ const QScriptItem *si = &d->layoutData->items.at(itm);
+ // Same logic as in cursorToX to handle edges between writing directions to prioritise the script item
+ // that matches the writing direction of the paragraph.
+ if (d->layoutData->hasBidi && !d->visualCursorMovement() && si->analysis.bidiLevel % 2 != rightToLeft) {
+ int neighborItem = itm;
+ if (neighborItem > 0 && si->position == realCursorPosition)
+ --neighborItem;
+ else if (neighborItem < d->layoutData->items.size() - 1 && si->position + si->num_glyphs == realCursorPosition)
+ ++neighborItem;
+ const bool onBoundary = neighborItem != itm
+ && si->analysis.bidiLevel != d->layoutData->items[neighborItem].analysis.bidiLevel;
+ if (onBoundary && rightToLeft != si->analysis.bidiLevel % 2) {
+ itm = neighborItem;
+ si = &d->layoutData->items[itm];
+ }
+ }
+ // objects need some special treatment as they can have special alignment or be floating
+ if (si->analysis.flags != QScriptAnalysis::Object) {
+ if (si->ascent > 0)
+ base = si->ascent;
+ if (si->descent > 0)
+ descent = si->descent;
+ }
+ rightToLeft = si->analysis.bidiLevel % 2;
}
qreal y = position.y() + (sl.y + sl.base() - base).toReal();
bool toggleAntialiasing = !(p->renderHints() & QPainter::Antialiasing)
@@ -1339,7 +1349,20 @@ void QTextLayout::drawCursor(QPainter *p, const QPointF &pos, int cursorPosition
QPainter::CompositionMode origCompositionMode = p->compositionMode();
if (p->paintEngine()->hasFeature(QPaintEngine::RasterOpModes))
p->setCompositionMode(QPainter::RasterOp_NotDestination);
- p->fillRect(QRectF(x, y, qreal(width), (base + descent).toReal()), p->pen().brush());
+ const QTransform &deviceTransform = p->deviceTransform();
+ const qreal xScale = deviceTransform.m11();
+ if (deviceTransform.type() != QTransform::TxScale || std::trunc(xScale) == xScale) {
+ p->fillRect(QRectF(x, y, qreal(width), (base + descent).toReal()), p->pen().brush());
+ } else {
+ // Ensure consistently rendered cursor width under fractional scaling
+ const QPen origPen = p->pen();
+ QPen pen(origPen.brush(), qRound(width * xScale), Qt::SolidLine, Qt::FlatCap);
+ pen.setCosmetic(true);
+ const qreal center = x + qreal(width) / 2;
+ p->setPen(pen);
+ p->drawLine(QPointF(center, y), QPointF(center, qCeil(y + (base + descent).toReal())));
+ p->setPen(origPen);
+ }
p->setCompositionMode(origCompositionMode);
if (toggleAntialiasing)
p->setRenderHint(QPainter::Antialiasing, false);
@@ -1589,13 +1612,10 @@ void QTextLine::setLineWidth(qreal width)
return;
}
- if (width > QFIXED_MAX)
- width = QFIXED_MAX;
-
- line.width = QFixed::fromReal(width);
+ line.width = QFixed::fromReal(qBound(0.0, width, qreal(QFIXED_MAX)));
if (line.length
&& line.textWidth <= line.width
- && line.from + line.length == eng->layoutData->string.length())
+ && line.from + line.length == eng->layoutData->string.size())
// no need to do anything if the line is already layouted and the last one. This optimization helps
// when using things in a single line layout.
return;
@@ -1632,7 +1652,7 @@ void QTextLine::setNumColumns(int numColumns)
void QTextLine::setNumColumns(int numColumns, qreal alignmentWidth)
{
QScriptLine &line = eng->lines[index];
- line.width = QFixed::fromReal(alignmentWidth);
+ line.width = QFixed::fromReal(qBound(0.0, alignmentWidth, qreal(QFIXED_MAX)));
line.length = 0;
line.textWidth = 0;
layout_helper(numColumns);
@@ -1648,40 +1668,36 @@ namespace {
struct LineBreakHelper
{
- LineBreakHelper()
- : glyphCount(0), maxGlyphs(0), currentPosition(0), fontEngine(nullptr), logClusters(nullptr),
- manualWrap(false), whiteSpaceOrObject(true)
- {
- }
-
+ LineBreakHelper() = default;
QScriptLine tmpData;
QScriptLine spaceData;
QGlyphLayout glyphs;
- int glyphCount;
- int maxGlyphs;
- int currentPosition;
- glyph_t previousGlyph;
- QFontEngine *previousGlyphFontEngine;
+ int glyphCount = 0;
+ int maxGlyphs = 0;
+ int currentPosition = 0;
+ glyph_t previousGlyph = 0;
+ QExplicitlySharedDataPointer<QFontEngine> previousGlyphFontEngine;
QFixed minw;
- QFixed softHyphenWidth;
+ QFixed currentSoftHyphenWidth;
+ QFixed commitedSoftHyphenWidth;
QFixed rightBearing;
QFixed minimumRightBearing;
- QFontEngine *fontEngine;
- const unsigned short *logClusters;
+ QExplicitlySharedDataPointer<QFontEngine> fontEngine;
+ const unsigned short *logClusters = nullptr;
- bool manualWrap;
- bool whiteSpaceOrObject;
+ bool manualWrap = false;
+ bool whiteSpaceOrObject = true;
bool checkFullOtherwiseExtend(QScriptLine &line);
QFixed calculateNewWidth(const QScriptLine &line) const {
return line.textWidth + tmpData.textWidth + spaceData.textWidth
- + softHyphenWidth + negativeRightBearing();
+ + (line.textWidth > 0 ? currentSoftHyphenWidth : QFixed()) + negativeRightBearing();
}
inline glyph_t currentGlyph() const
@@ -1704,6 +1720,7 @@ namespace {
inline void calculateRightBearing(QFontEngine *engine, glyph_t glyph)
{
+ Q_ASSERT(engine);
qreal rb;
engine->getGlyphBearings(glyph, nullptr, &rb);
@@ -1718,13 +1735,13 @@ namespace {
{
if (currentPosition <= 0)
return;
- calculateRightBearing(fontEngine, currentGlyph());
+ calculateRightBearing(fontEngine.data(), currentGlyph());
}
inline void calculateRightBearingForPreviousGlyph()
{
if (previousGlyph > 0)
- calculateRightBearing(previousGlyphFontEngine, previousGlyph);
+ calculateRightBearing(previousGlyphFontEngine.data(), previousGlyph);
}
static const QFixed RightBearingNotCalculated;
@@ -1745,7 +1762,7 @@ namespace {
}
};
-const QFixed LineBreakHelper::RightBearingNotCalculated = QFixed(1);
+Q_CONSTINIT const QFixed LineBreakHelper::RightBearingNotCalculated = QFixed(1);
inline bool LineBreakHelper::checkFullOtherwiseExtend(QScriptLine &line)
{
@@ -1755,7 +1772,7 @@ inline bool LineBreakHelper::checkFullOtherwiseExtend(QScriptLine &line)
if (line.length && !manualWrap && (newWidth > line.width || glyphCount > maxGlyphs))
return true;
- minw = qMax(minw, tmpData.textWidth);
+ const QFixed oldTextWidth = line.textWidth;
line += tmpData;
line.textWidth += spaceData.textWidth;
@@ -1765,6 +1782,11 @@ inline bool LineBreakHelper::checkFullOtherwiseExtend(QScriptLine &line)
spaceData.textWidth = 0;
spaceData.length = 0;
+ if (oldTextWidth != line.textWidth || currentSoftHyphenWidth > 0) {
+ commitedSoftHyphenWidth = currentSoftHyphenWidth;
+ currentSoftHyphenWidth = 0;
+ }
+
return false;
}
@@ -1773,13 +1795,14 @@ inline bool LineBreakHelper::checkFullOtherwiseExtend(QScriptLine &line)
static inline void addNextCluster(int &pos, int end, QScriptLine &line, int &glyphCount,
const QScriptItem &current, const unsigned short *logClusters,
- const QGlyphLayout &glyphs)
+ const QGlyphLayout &glyphs, QFixed *clusterWidth = nullptr)
{
int glyphPosition = logClusters[pos];
do { // got to the first next cluster
++pos;
++line.length;
} while (pos < end && logClusters[pos] == glyphPosition);
+ QFixed clusterWid = line.textWidth;
do { // calculate the textWidth for the rest of the current cluster.
if (!glyphs.attributes[glyphPosition].dontPrint)
line.textWidth += glyphs.advances[glyphPosition];
@@ -1788,6 +1811,8 @@ static inline void addNextCluster(int &pos, int end, QScriptLine &line, int &gly
Q_ASSERT((pos == end && glyphPosition == current.num_glyphs) || logClusters[pos] == glyphPosition);
+ if (clusterWidth)
+ *clusterWidth += (line.textWidth - clusterWid);
++glyphCount;
}
@@ -1801,12 +1826,12 @@ void QTextLine::layout_helper(int maxGlyphs)
line.textWidth = 0;
line.hasTrailingSpaces = false;
- if (!eng->layoutData->items.size() || line.from >= eng->layoutData->string.length()) {
+ if (!eng->layoutData->items.size() || line.from >= eng->layoutData->string.size()) {
line.setDefaultHeight(eng);
return;
}
- Q_ASSERT(line.from < eng->layoutData->string.length());
+ Q_ASSERT(line.from < eng->layoutData->string.size());
LineBreakHelper lbh;
@@ -1814,13 +1839,14 @@ void QTextLine::layout_helper(int maxGlyphs)
QTextOption::WrapMode wrapMode = eng->option.wrapMode();
bool breakany = (wrapMode == QTextOption::WrapAnywhere);
+ const bool breakWordOrAny = breakany || (wrapMode == QTextOption::WrapAtWordBoundaryOrAnywhere);
lbh.manualWrap = (wrapMode == QTextOption::ManualWrap || wrapMode == QTextOption::NoWrap);
int item = -1;
int newItem = eng->findItem(line.from);
Q_ASSERT(newItem >= 0);
- LB_DEBUG("from: %d: item=%d, total %d, width available %f", line.from, newItem, eng->layoutData->items.size(), line.width.toReal());
+ LB_DEBUG("from: %d: item=%d, total %d, width available %f", line.from, newItem, int(eng->layoutData->items.size()), line.width.toReal());
Qt::Alignment alignment = eng->option.alignment();
@@ -1832,12 +1858,12 @@ void QTextLine::layout_helper(int maxGlyphs)
lbh.logClusters = eng->layoutData->logClustersPtr;
lbh.previousGlyph = 0;
+ bool manuallyWrapped = false;
bool hasInlineObject = false;
QFixed maxInlineObjectHeight = 0;
while (newItem < eng->layoutData->items.size()) {
lbh.resetRightBearing();
- lbh.softHyphenWidth = 0;
if (newItem != item) {
item = newItem;
const QScriptItem &current = eng->layoutData->items.at(item);
@@ -1908,12 +1934,13 @@ void QTextLine::layout_helper(int maxGlyphs)
lbh.calculateRightBearingForPreviousGlyph();
}
line += lbh.tmpData;
+ manuallyWrapped = true;
goto found;
} else if (current.analysis.flags == QScriptAnalysis::Object) {
lbh.whiteSpaceOrObject = true;
lbh.tmpData.length++;
- if (eng->block.docHandle()) {
+ if (QTextDocumentPrivate::get(eng->block) != nullptr) {
QTextInlineObject inlineObject(item, eng);
QTextFormat f = inlineObject.format();
eng->docLayout()->positionInlineObject(inlineObject, eng->block.position() + current.position, f);
@@ -1942,42 +1969,47 @@ void QTextLine::layout_helper(int maxGlyphs)
addNextCluster(lbh.currentPosition, end, lbh.spaceData, lbh.glyphCount,
current, lbh.logClusters, lbh.glyphs);
}
-
- if (!lbh.manualWrap && lbh.spaceData.textWidth > line.width) {
- lbh.spaceData.textWidth = line.width; // ignore spaces that fall out of the line.
- goto found;
- }
} else {
+ if (!lbh.manualWrap && lbh.spaceData.textWidth > line.width)
+ goto found;
+
lbh.whiteSpaceOrObject = false;
bool sb_or_ws = false;
lbh.saveCurrentGlyph();
+ QFixed accumulatedTextWidth;
do {
addNextCluster(lbh.currentPosition, end, lbh.tmpData, lbh.glyphCount,
- current, lbh.logClusters, lbh.glyphs);
+ current, lbh.logClusters, lbh.glyphs, &accumulatedTextWidth);
// This is a hack to fix a regression caused by the introduction of the
// whitespace flag to non-breakable spaces and will cause the non-breakable
// spaces to behave as in previous Qt versions in the line breaking algorithm.
// The line breaks do not currently follow the Unicode specs, but fixing this would
// require refactoring the code and would cause behavioral regressions.
- bool isBreakableSpace = lbh.currentPosition < eng->layoutData->string.length()
+ const bool isBreakableSpace = lbh.currentPosition < eng->layoutData->string.size()
&& attributes[lbh.currentPosition].whiteSpace
&& eng->layoutData->string.at(lbh.currentPosition).decompositionTag() != QChar::NoBreak;
- if (lbh.currentPosition >= eng->layoutData->string.length()
+ if (lbh.currentPosition >= eng->layoutData->string.size()
|| isBreakableSpace
- || attributes[lbh.currentPosition].lineBreak) {
+ || attributes[lbh.currentPosition].lineBreak
+ || lbh.tmpData.textWidth >= QFIXED_MAX) {
sb_or_ws = true;
break;
- } else if (breakany && attributes[lbh.currentPosition].graphemeBoundary) {
- break;
+ } else if (attributes[lbh.currentPosition].graphemeBoundary) {
+ if (breakWordOrAny) {
+ lbh.minw = qMax(accumulatedTextWidth, lbh.minw);
+ accumulatedTextWidth = 0;
+ }
+ if (breakany)
+ break;
}
} while (lbh.currentPosition < end);
- lbh.minw = qMax(lbh.tmpData.textWidth, lbh.minw);
+ lbh.minw = qMax(accumulatedTextWidth, lbh.minw);
- if (lbh.currentPosition > 0 && lbh.currentPosition < end
- && attributes[lbh.currentPosition].lineBreak
- && eng->layoutData->string.at(lbh.currentPosition - 1).unicode() == QChar::SoftHyphen) {
+ if (lbh.currentPosition > 0 && lbh.currentPosition <= end
+ && (lbh.currentPosition == end || attributes[lbh.currentPosition].lineBreak)
+ && eng->layoutData->string.at(lbh.currentPosition - 1) == QChar::SoftHyphen) {
// if we are splitting up a word because of
// a soft hyphen then we ...
//
@@ -1994,10 +2026,7 @@ void QTextLine::layout_helper(int maxGlyphs)
// want the soft-hyphen to slip into the next line
// and thus become invisible again.
//
- if (line.length)
- lbh.softHyphenWidth = lbh.glyphs.advances[lbh.logClusters[lbh.currentPosition - 1]];
- else if (breakany)
- lbh.tmpData.textWidth += lbh.glyphs.advances[lbh.logClusters[lbh.currentPosition - 1]];
+ lbh.currentSoftHyphenWidth = lbh.glyphs.advances[lbh.logClusters[lbh.currentPosition - 1]];
}
if (sb_or_ws|breakany) {
@@ -2018,11 +2047,12 @@ void QTextLine::layout_helper(int maxGlyphs)
// and when we then end up breaking on the next glyph we compute the right bearing
// and end up with a line width that is slightly larger width than what was requested.
// Unfortunately we can't remove this optimization as it will slow down text
- // layouting significantly, so we accept the slight correctnes issue.
+ // layouting significantly, so we accept the slight correctness issue.
if ((lbh.calculateNewWidth(line) + qAbs(lbh.minimumRightBearing)) > line.width)
lbh.calculateRightBearing();
if (lbh.checkFullOtherwiseExtend(line)) {
+
// We are too wide to accept the next glyph with its bearing, so we restore the
// right bearing to that of the previous glyph (the one that was already accepted),
// so that the bearing can be be applied to the final width of the text below.
@@ -2031,9 +2061,7 @@ void QTextLine::layout_helper(int maxGlyphs)
else
lbh.calculateRightBearingForPreviousGlyph();
- if (!breakany) {
- line.textWidth += lbh.softHyphenWidth;
- }
+ line.textWidth += lbh.commitedSoftHyphenWidth;
goto found;
}
@@ -2045,6 +2073,7 @@ void QTextLine::layout_helper(int maxGlyphs)
}
LB_DEBUG("reached end of line");
lbh.checkFullOtherwiseExtend(line);
+ line.textWidth += lbh.commitedSoftHyphenWidth;
found:
line.textAdvance = line.textWidth;
@@ -2062,7 +2091,7 @@ found:
line += lbh.tmpData;
}
- if (hasInlineObject && eng->block.docHandle()) {
+ if (hasInlineObject && QTextDocumentPrivate::get(eng->block) != nullptr) {
// position top/bottom aligned inline objects
if (maxInlineObjectHeight > line.ascent + line.descent) {
// extend line height if required
@@ -2085,6 +2114,10 @@ found:
current.ascent = line.ascent;
current.descent = height - line.ascent;
break;
+ case QTextCharFormat::AlignMiddle:
+ current.ascent = (line.ascent + line.descent) / 2 - line.descent + height / 2;
+ current.descent = height - line.ascent;
+ break;
case QTextCharFormat::AlignBottom:
current.descent = line.descent;
current.ascent = height - line.descent;
@@ -2103,18 +2136,37 @@ found:
line.descent.toReal(), line.textWidth.toReal(), lbh.spaceData.width.toReal());
LB_DEBUG(" : '%s'", eng->layoutData->string.mid(line.from, line.length).toUtf8().data());
+ const QFixed trailingSpace = (eng->option.flags() & QTextOption::IncludeTrailingSpaces
+ ? lbh.spaceData.textWidth
+ : QFixed(0));
+ if (eng->option.wrapMode() == QTextOption::WrapAtWordBoundaryOrAnywhere) {
+ if ((lbh.maxGlyphs != INT_MAX && lbh.glyphCount > lbh.maxGlyphs)
+ || (lbh.maxGlyphs == INT_MAX && line.textWidth > (line.width - trailingSpace))) {
+
+ eng->option.setWrapMode(QTextOption::WrapAnywhere);
+ layout_helper(lbh.maxGlyphs);
+ eng->option.setWrapMode(QTextOption::WrapAtWordBoundaryOrAnywhere);
+ return;
+ }
+ }
+
if (lbh.manualWrap) {
eng->minWidth = qMax(eng->minWidth, line.textWidth);
eng->maxWidth = qMax(eng->maxWidth, line.textWidth);
} else {
eng->minWidth = qMax(eng->minWidth, lbh.minw);
- eng->maxWidth += line.textWidth;
+ if (qAddOverflow(eng->layoutData->currentMaxWidth, line.textWidth, &eng->layoutData->currentMaxWidth))
+ eng->layoutData->currentMaxWidth = QFIXED_MAX;
+ if (!manuallyWrapped) {
+ if (qAddOverflow(eng->layoutData->currentMaxWidth, lbh.spaceData.textWidth, &eng->layoutData->currentMaxWidth))
+ eng->layoutData->currentMaxWidth = QFIXED_MAX;
+ }
+ eng->maxWidth = qMax(eng->maxWidth, eng->layoutData->currentMaxWidth);
+ if (manuallyWrapped)
+ eng->layoutData->currentMaxWidth = 0;
}
- if (line.textWidth > 0 && item < eng->layoutData->items.size())
- eng->maxWidth += lbh.spaceData.textWidth;
- if (eng->option.flags() & QTextOption::IncludeTrailingSpaces)
- line.textWidth += lbh.spaceData.textWidth;
+ line.textWidth += trailingSpace;
if (lbh.spaceData.length) {
line.trailingSpaces = lbh.spaceData.length;
line.hasTrailingSpaces = true;
@@ -2122,18 +2174,6 @@ found:
line.justified = false;
line.gridfitted = false;
-
- if (eng->option.wrapMode() == QTextOption::WrapAtWordBoundaryOrAnywhere) {
- if ((lbh.maxGlyphs != INT_MAX && lbh.glyphCount > lbh.maxGlyphs)
- || (lbh.maxGlyphs == INT_MAX && line.textWidth > line.width)) {
-
- eng->option.setWrapMode(QTextOption::WrapAnywhere);
- line.length = 0;
- line.textWidth = 0;
- layout_helper(lbh.maxGlyphs);
- eng->option.setWrapMode(QTextOption::WrapAtWordBoundaryOrAnywhere);
- }
- }
}
/*!
@@ -2177,35 +2217,37 @@ int QTextLine::textStart() const
int QTextLine::textLength() const
{
if (eng->option.flags() & QTextOption::ShowLineAndParagraphSeparators
- && eng->block.isValid() && index == eng->lines.count()-1) {
+ && eng->block.isValid() && index == eng->lines.size()-1) {
return eng->lines.at(index).length - 1;
}
return eng->lines.at(index).length + eng->lines.at(index).trailingSpaces;
}
-static void setPenAndDrawBackground(QPainter *p, const QPen &defaultPen, const QTextCharFormat &chf, const QRectF &r)
+static void drawBackground(QPainter *p, const QTextCharFormat &chf, const QRectF &r)
{
- QBrush c = chf.foreground();
- if (c.style() == Qt::NoBrush) {
- p->setPen(defaultPen);
- }
-
QBrush bg = chf.background();
if (bg.style() != Qt::NoBrush && !chf.property(SuppressBackground).toBool())
p->fillRect(r.toAlignedRect(), bg);
- if (c.style() != Qt::NoBrush) {
- p->setPen(QPen(c, 0));
- }
+}
+static void setPen(QPainter *p, const QPen &defaultPen, const QTextCharFormat &chf)
+{
+ QBrush c = chf.foreground();
+ if (c.style() == Qt::NoBrush)
+ p->setPen(defaultPen);
+ else
+ p->setPen(QPen(c, 0));
}
#if !defined(QT_NO_RAWFONT)
static QGlyphRun glyphRunWithInfo(QFontEngine *fontEngine,
+ const QString &text,
const QGlyphLayout &glyphLayout,
const QPointF &pos,
const QGlyphRun::GlyphRunFlags &flags,
- const QFixed &selectionX,
- const QFixed &selectionWidth,
+ QTextLayout::GlyphRunRetrievalFlags retrievalFlags,
+ QFixed selectionX,
+ QFixed selectionWidth,
int glyphsStart,
int glyphsEnd,
unsigned short *logClusters,
@@ -2219,14 +2261,15 @@ static QGlyphRun glyphRunWithInfo(QFontEngine *fontEngine,
QGlyphRunPrivate *d = QGlyphRunPrivate::get(glyphRun);
int rangeStart = textPosition;
- while (*logClusters != glyphsStart && rangeStart < textPosition + textLength) {
- ++logClusters;
+ int logClusterIndex = 0;
+ while (logClusters[logClusterIndex] != glyphsStart && rangeStart < textPosition + textLength) {
+ ++logClusterIndex;
++rangeStart;
}
int rangeEnd = rangeStart;
- while (*logClusters != glyphsEnd && rangeEnd < textPosition + textLength) {
- ++logClusters;
+ while (logClusters[logClusterIndex] != glyphsEnd && rangeEnd < textPosition + textLength) {
+ ++logClusterIndex;
++rangeEnd;
}
@@ -2258,15 +2301,44 @@ static QGlyphRun glyphRunWithInfo(QFontEngine *fontEngine,
qreal fontHeight = font.ascent() + font.descent();
qreal minY = 0;
qreal maxY = 0;
- QVector<quint32> glyphs;
- glyphs.reserve(glyphsArray.size());
- QVector<QPointF> positions;
- positions.reserve(glyphsArray.size());
- for (int i=0; i<glyphsArray.size(); ++i) {
- glyphs.append(glyphsArray.at(i) & 0xffffff);
+ QList<quint32> glyphs;
+ if (retrievalFlags & QTextLayout::RetrieveGlyphIndexes)
+ glyphs.reserve(glyphsArray.size());
+ QList<QPointF> positions;
+ if (retrievalFlags & QTextLayout::RetrieveGlyphPositions)
+ positions.reserve(glyphsArray.size());
+ QList<qsizetype> stringIndexes;
+ if (retrievalFlags & QTextLayout::RetrieveStringIndexes)
+ stringIndexes.reserve(glyphsArray.size());
+
+ int nextClusterIndex = 0;
+ int currentClusterIndex = 0;
+ for (int i = 0; i < glyphsArray.size(); ++i) {
+ const int glyphArrayIndex = i + glyphsStart;
+ // Search for the next cluster in the string (or the end of string if there are no
+ // more clusters)
+ if (retrievalFlags & QTextLayout::RetrieveStringIndexes) {
+ if (nextClusterIndex < textLength && logClusters[nextClusterIndex] == glyphArrayIndex) {
+ currentClusterIndex = nextClusterIndex; // Store current cluster
+ while (logClusters[nextClusterIndex] == glyphArrayIndex && nextClusterIndex < textLength)
+ ++nextClusterIndex;
+ }
+
+ // We are now either at end of string (no more clusters) or we are not yet at the
+ // next cluster in glyph array. We fill in current cluster so that there is always one
+ // entry in stringIndexes for each glyph.
+ Q_ASSERT(nextClusterIndex == textLength || logClusters[nextClusterIndex] != glyphArrayIndex);
+ stringIndexes.append(textPosition + currentClusterIndex);
+ }
+
+ if (retrievalFlags & QTextLayout::RetrieveGlyphIndexes) {
+ glyph_t glyphIndex = glyphsArray.at(i) & 0xffffff;
+ glyphs.append(glyphIndex);
+ }
QPointF position = positionsArray.at(i).toPointF() + pos;
- positions.append(position);
+ if (retrievalFlags & QTextLayout::RetrieveGlyphPositions)
+ positions.append(position);
if (i == 0) {
maxY = minY = position.y();
@@ -2278,8 +2350,14 @@ static QGlyphRun glyphRunWithInfo(QFontEngine *fontEngine,
qreal height = maxY + fontHeight - minY;
- glyphRun.setGlyphIndexes(glyphs);
- glyphRun.setPositions(positions);
+ if (retrievalFlags & QTextLayout::RetrieveGlyphIndexes)
+ glyphRun.setGlyphIndexes(glyphs);
+ if (retrievalFlags & QTextLayout::RetrieveGlyphPositions)
+ glyphRun.setPositions(positions);
+ if (retrievalFlags & QTextLayout::RetrieveStringIndexes)
+ glyphRun.setStringIndexes(stringIndexes);
+ if (retrievalFlags & QTextLayout::RetrieveString)
+ glyphRun.setSourceString(text);
glyphRun.setFlags(flags);
glyphRun.setRawFont(font);
@@ -2289,7 +2367,9 @@ static QGlyphRun glyphRunWithInfo(QFontEngine *fontEngine,
return glyphRun;
}
+# if QT_VERSION < QT_VERSION_CHECK(7, 0, 0)
/*!
+ \overload
Returns the glyph indexes and positions for all glyphs in this QTextLine for characters
in the range defined by \a from and \a length. The \a from index is relative to the beginning
of the text in the containing QTextLayout, and the range must be within the range of QTextLine
@@ -2298,12 +2378,43 @@ static QGlyphRun glyphRunWithInfo(QFontEngine *fontEngine,
If \a from is negative, it will default to textStart(), and if \a length is negative it will
default to the return value of textLength().
+ \note This is equivalent to calling
+ glyphRuns(from,
+ length,
+ QTextLayout::GlyphRunRetrievalFlag::GlyphIndexes |
+ QTextLayout::GlyphRunRetrievalFlag::GlyphPositions).
+
\since 5.0
\sa QTextLayout::glyphRuns()
*/
QList<QGlyphRun> QTextLine::glyphRuns(int from, int length) const
{
+ return glyphRuns(from, length, QTextLayout::GlyphRunRetrievalFlag::DefaultRetrievalFlags);
+}
+# endif
+
+/*!
+ Returns the glyph indexes and positions for all glyphs in this QTextLine for characters
+ in the range defined by \a from and \a length. The \a from index is relative to the beginning
+ of the text in the containing QTextLayout, and the range must be within the range of QTextLine
+ as given by functions textStart() and textLength().
+
+ The \a retrievalFlags specifies which properties of the QGlyphRun will be retrieved from the
+ layout. To minimize allocations and memory consumption, this should be set to include only the
+ properties that you need to access later.
+
+ If \a from is negative, it will default to textStart(), and if \a length is negative it will
+ default to the return value of textLength().
+
+ \since 6.5
+
+ \sa QTextLayout::glyphRuns()
+*/
+QList<QGlyphRun> QTextLine::glyphRuns(int from,
+ int length,
+ QTextLayout::GlyphRunRetrievalFlags retrievalFlags) const
+{
const QScriptLine &line = eng->lines.at(index);
if (line.length == 0)
@@ -2375,14 +2486,18 @@ QList<QGlyphRun> QTextLine::glyphRuns(int from, int length) const
// when we're breaking a RTL script item, since the expected position passed into
// getGlyphPositions() is the left-most edge of the left-most glyph in an RTL run.
if (relativeFrom != (iterator.itemStart - si.position) && !rtl) {
- for (int i=itemGlyphsStart; i<glyphsStart; ++i) {
- QFixed justification = QFixed::fromFixed(glyphLayout.justifications[i].space_18d6);
- pos.rx() += (glyphLayout.advances[i] + justification).toReal();
+ for (int i = itemGlyphsStart; i < glyphsStart; ++i) {
+ if (!glyphLayout.attributes[i].dontPrint) {
+ QFixed justification = QFixed::fromFixed(glyphLayout.justifications[i].space_18d6);
+ pos.rx() += (glyphLayout.advances[i] + justification).toReal();
+ }
}
} else if (relativeTo != (iterator.itemEnd - si.position - 1) && rtl) {
- for (int i=itemGlyphsEnd; i>glyphsEnd; --i) {
- QFixed justification = QFixed::fromFixed(glyphLayout.justifications[i].space_18d6);
- pos.rx() += (glyphLayout.advances[i] + justification).toReal();
+ for (int i = itemGlyphsEnd; i > glyphsEnd; --i) {
+ if (!glyphLayout.attributes[i].dontPrint) {
+ QFixed justification = QFixed::fromFixed(glyphLayout.justifications[i].space_18d6);
+ pos.rx() += (glyphLayout.advances[i] + justification).toReal();
+ }
}
}
@@ -2419,20 +2534,28 @@ QList<QGlyphRun> QTextLine::glyphRuns(int from, int length) const
if (start == 0 && startsInsideLigature)
subFlags |= QGlyphRun::SplitLigature;
- glyphRuns.append(glyphRunWithInfo(multiFontEngine->engine(which),
- subLayout,
- pos,
- subFlags,
- x,
- width,
- glyphsStart + start,
- glyphsStart + end,
- logClusters + relativeFrom,
- relativeFrom + si.position,
- relativeTo - relativeFrom + 1));
+ {
+ QGlyphRun glyphRun = glyphRunWithInfo(multiFontEngine->engine(which),
+ eng->text,
+ subLayout,
+ pos,
+ subFlags,
+ retrievalFlags,
+ x,
+ width,
+ glyphsStart + start,
+ glyphsStart + end,
+ logClusters + relativeFrom,
+ relativeFrom + si.position,
+ relativeTo - relativeFrom + 1);
+ if (!glyphRun.isEmpty())
+ glyphRuns.append(glyphRun);
+ }
for (int i = 0; i < subLayout.numGlyphs; ++i) {
- QFixed justification = QFixed::fromFixed(subLayout.justifications[i].space_18d6);
- pos.rx() += (subLayout.advances[i] + justification).toReal();
+ if (!subLayout.attributes[i].dontPrint) {
+ QFixed justification = QFixed::fromFixed(subLayout.justifications[i].space_18d6);
+ pos.rx() += (subLayout.advances[i] + justification).toReal();
+ }
}
if (rtl)
@@ -2450,9 +2573,11 @@ QList<QGlyphRun> QTextLine::glyphRuns(int from, int length) const
subFlags |= QGlyphRun::SplitLigature;
QGlyphRun glyphRun = glyphRunWithInfo(multiFontEngine->engine(which),
+ eng->text,
subLayout,
pos,
subFlags,
+ retrievalFlags,
x,
width,
glyphsStart + start,
@@ -2466,9 +2591,11 @@ QList<QGlyphRun> QTextLine::glyphRuns(int from, int length) const
if (startsInsideLigature || endsInsideLigature)
flags |= QGlyphRun::SplitLigature;
QGlyphRun glyphRun = glyphRunWithInfo(mainFontEngine,
+ eng->text,
glyphLayout,
pos,
flags,
+ retrievalFlags,
x,
width,
glyphsStart,
@@ -2487,19 +2614,23 @@ QList<QGlyphRun> QTextLine::glyphRuns(int from, int length) const
#endif // QT_NO_RAWFONT
/*!
- \fn void QTextLine::draw(QPainter *painter, const QPointF &position, const QTextLayout::FormatRange *selection) const
+ \fn void QTextLine::draw(QPainter *painter, const QPointF &position) const
Draws a line on the given \a painter at the specified \a position.
- The \a selection is reserved for internal use.
*/
-void QTextLine::draw(QPainter *p, const QPointF &pos, const QTextLayout::FormatRange *selection) const
+void QTextLine::draw(QPainter *painter, const QPointF &position) const
+{
+ draw_internal(painter, position, nullptr);
+}
+
+void QTextLine::draw_internal(QPainter *p, const QPointF &origPos,
+ const QTextLayout::FormatRange *selection) const
{
#ifndef QT_NO_RAWFONT
// Not intended to work with rawfont
Q_ASSERT(!eng->useRawFont);
#endif
const QScriptLine &line = eng->lines[index];
- QPen pen = p->pen();
bool noText = (selection && selection->format.property(SuppressText).toBool());
@@ -2509,187 +2640,239 @@ void QTextLine::draw(QPainter *p, const QPointF &pos, const QTextLayout::FormatR
&& selection->start + selection->length > line.from) {
const qreal lineHeight = line.height().toReal();
- QRectF r(pos.x() + line.x.toReal(), pos.y() + line.y.toReal(),
- lineHeight / 2, QFontMetrics(eng->font()).horizontalAdvance(QLatin1Char(' ')));
- setPenAndDrawBackground(p, QPen(), selection->format, r);
- p->setPen(pen);
+ QRectF r(origPos.x() + line.x.toReal(), origPos.y() + line.y.toReal(),
+ lineHeight / 2, QFontMetrics(eng->font()).horizontalAdvance(u' '));
+ drawBackground(p, selection->format, r);
}
return;
}
+ Q_CONSTINIT static QRectF maxFixedRect(-QFIXED_MAX / 2, -QFIXED_MAX / 2, QFIXED_MAX, QFIXED_MAX);
+ const bool xlateToFixedRange = !maxFixedRect.contains(origPos);
+ QPointF pos;
+ if (Q_LIKELY(!xlateToFixedRange))
+ pos = origPos;
+ else
+ p->translate(origPos);
+
- QTextLineItemIterator iterator(eng, index, pos, selection);
QFixed lineBase = line.base();
eng->clearDecorations();
eng->enableDelayDecorations();
const QFixed y = QFixed::fromReal(pos.y()) + line.y + lineBase;
- bool suppressColors = (eng->option.flags() & QTextOption::SuppressColors);
- while (!iterator.atEnd()) {
- QScriptItem &si = iterator.next();
+ const QTextFormatCollection *formatCollection = eng->formatCollection();
- if (selection && selection->start >= 0 && iterator.isOutsideSelection())
- continue;
+ bool suppressColors = (eng->option.flags() & QTextOption::SuppressColors);
- if (si.analysis.flags == QScriptAnalysis::LineOrParagraphSeparator
- && !(eng->option.flags() & QTextOption::ShowLineAndParagraphSeparators))
- continue;
+ auto prepareFormat = [suppressColors, selection, this](QTextCharFormat &format,
+ QScriptItem *si) {
+ format.merge(eng->format(si));
- QFixed itemBaseLine = y;
- QFont f = eng->font(si);
- QTextCharFormat format;
+ if (suppressColors) {
+ format.clearForeground();
+ format.clearBackground();
+ format.clearProperty(QTextFormat::TextUnderlineColor);
+ }
+ if (selection)
+ format.merge(selection->format);
+ };
- if (eng->hasFormats() || selection) {
- format = eng->format(&si);
- if (suppressColors) {
- format.clearForeground();
- format.clearBackground();
- format.clearProperty(QTextFormat::TextUnderlineColor);
- }
- if (selection)
- format.merge(selection->format);
-
- setPenAndDrawBackground(p, pen, format, QRectF(iterator.x.toReal(), (y - lineBase).toReal(),
- iterator.itemWidth.toReal(), line.height().toReal()));
-
- QTextCharFormat::VerticalAlignment valign = format.verticalAlignment();
- if (valign == QTextCharFormat::AlignSuperScript || valign == QTextCharFormat::AlignSubScript) {
- QFontEngine *fe = f.d->engineForScript(si.analysis.script);
- QFixed height = fe->ascent() + fe->descent();
- if (valign == QTextCharFormat::AlignSubScript)
- itemBaseLine += height / 6;
- else if (valign == QTextCharFormat::AlignSuperScript)
- itemBaseLine -= height / 2;
+ {
+ QTextLineItemIterator iterator(eng, index, pos, selection);
+ while (!iterator.atEnd()) {
+ QScriptItem &si = iterator.next();
+
+ if (eng->hasFormats() || selection || formatCollection) {
+ QTextCharFormat format;
+ if (formatCollection != nullptr)
+ format = formatCollection->defaultTextFormat();
+ prepareFormat(format, &si);
+ drawBackground(p, format, QRectF(iterator.x.toReal(), (y - lineBase).toReal(),
+ iterator.itemWidth.toReal(), line.height().toReal()));
}
}
+ }
- if (si.analysis.flags >= QScriptAnalysis::TabOrObject) {
+ QPen pen = p->pen();
+ {
+ QTextLineItemIterator iterator(eng, index, pos, selection);
+ while (!iterator.atEnd()) {
+ QScriptItem &si = iterator.next();
- if (eng->hasFormats()) {
- p->save();
- if (si.analysis.flags == QScriptAnalysis::Object && eng->block.docHandle()) {
- QFixed itemY = y - si.ascent;
- if (format.verticalAlignment() == QTextCharFormat::AlignTop) {
- itemY = y - lineBase;
- } else if (format.verticalAlignment() == QTextCharFormat::AlignBottom) {
- itemY = y + line.descent - si.ascent - si.descent;
- }
+ if (selection && selection->start >= 0 && iterator.isOutsideSelection())
+ continue;
- QRectF itemRect(iterator.x.toReal(), itemY.toReal(), iterator.itemWidth.toReal(), si.height().toReal());
-
- eng->docLayout()->drawInlineObject(p, itemRect,
- QTextInlineObject(iterator.item, eng),
- si.position + eng->block.position(),
- format);
- if (selection) {
- QBrush bg = format.brushProperty(ObjectSelectionBrush);
- if (bg.style() != Qt::NoBrush) {
- QColor c = bg.color();
- c.setAlpha(128);
- p->fillRect(itemRect, c);
- }
- }
- } else { // si.isTab
- QFont f = eng->font(si);
- QTextItemInt gf(si, &f, format);
- gf.chars = nullptr;
- gf.num_chars = 0;
- gf.width = iterator.itemWidth;
- QPainterPrivate::get(p)->drawTextItem(QPointF(iterator.x.toReal(), y.toReal()), gf, eng);
- if (eng->option.flags() & QTextOption::ShowTabsAndSpaces) {
- QChar visualTab(0x2192);
- int w = QFontMetrics(f).horizontalAdvance(visualTab);
- qreal x = iterator.itemWidth.toReal() - w; // Right-aligned
- if (x < 0)
- p->setClipRect(QRectF(iterator.x.toReal(), line.y.toReal(),
- iterator.itemWidth.toReal(), line.height().toReal()),
- Qt::IntersectClip);
- else
- x /= 2; // Centered
- p->setFont(f);
- p->drawText(QPointF(iterator.x.toReal() + x,
- y.toReal()), visualTab);
- }
+ if (si.analysis.flags == QScriptAnalysis::LineOrParagraphSeparator
+ && !(eng->option.flags() & QTextOption::ShowLineAndParagraphSeparators))
+ continue;
+ QFixed itemBaseLine = y;
+ QFont f = eng->font(si);
+ QTextCharFormat format;
+ if (formatCollection != nullptr)
+ format = formatCollection->defaultTextFormat();
+
+ if (eng->hasFormats() || selection || formatCollection) {
+ prepareFormat(format, &si);
+ setPen(p, pen, format);
+
+ const qreal baseLineOffset = format.baselineOffset() / 100.0;
+ QTextCharFormat::VerticalAlignment valign = format.verticalAlignment();
+ if (valign == QTextCharFormat::AlignSuperScript
+ || valign == QTextCharFormat::AlignSubScript
+ || !qFuzzyIsNull(baseLineOffset))
+ {
+ QFontEngine *fe = f.d->engineForScript(si.analysis.script);
+ QFixed height = fe->ascent() + fe->descent();
+ itemBaseLine -= height * QFixed::fromReal(baseLineOffset);
+
+ if (valign == QTextCharFormat::AlignSubScript)
+ itemBaseLine += height * QFixed::fromReal(format.subScriptBaseline() / 100.0);
+ else if (valign == QTextCharFormat::AlignSuperScript)
+ itemBaseLine -= height * QFixed::fromReal(format.superScriptBaseline() / 100.0);
}
- p->restore();
}
- continue;
- }
+ if (si.analysis.flags >= QScriptAnalysis::TabOrObject) {
- unsigned short *logClusters = eng->logClusters(&si);
- QGlyphLayout glyphs = eng->shapedGlyphs(&si);
+ if (eng->hasFormats()) {
+ p->save();
+ if (si.analysis.flags == QScriptAnalysis::Object && QTextDocumentPrivate::get(eng->block)) {
+ QFixed itemY = y - si.ascent;
+ switch (format.verticalAlignment()) {
+ case QTextCharFormat::AlignTop:
+ itemY = y - lineBase;
+ break;
+ case QTextCharFormat::AlignMiddle:
+ itemY = y - lineBase + (line.height() - si.height()) / 2;
+ break;
+ case QTextCharFormat::AlignBottom:
+ itemY = y - lineBase + line.height() - si.height();
+ break;
+ default:
+ break;
+ }
- QTextItemInt gf(glyphs.mid(iterator.glyphsStart, iterator.glyphsEnd - iterator.glyphsStart),
- &f, eng->layoutData->string.unicode() + iterator.itemStart,
- iterator.itemEnd - iterator.itemStart, eng->fontEngine(si), format);
- gf.logClusters = logClusters + iterator.itemStart - si.position;
- gf.width = iterator.itemWidth;
- gf.justified = line.justified;
- gf.initWithScriptItem(si);
-
- Q_ASSERT(gf.fontEngine);
-
- QPointF pos(iterator.x.toReal(), itemBaseLine.toReal());
- if (format.penProperty(QTextFormat::TextOutline).style() != Qt::NoPen) {
- QPainterPath path;
- path.setFillRule(Qt::WindingFill);
-
- if (gf.glyphs.numGlyphs)
- gf.fontEngine->addOutlineToPath(pos.x(), pos.y(), gf.glyphs, &path, gf.flags);
- if (gf.flags) {
- const QFontEngine *fe = gf.fontEngine;
- const qreal lw = fe->lineThickness().toReal();
- if (gf.flags & QTextItem::Underline) {
- qreal offs = fe->underlinePosition().toReal();
- path.addRect(pos.x(), pos.y() + offs, gf.width.toReal(), lw);
- }
- if (gf.flags & QTextItem::Overline) {
- qreal offs = fe->ascent().toReal() + 1;
- path.addRect(pos.x(), pos.y() - offs, gf.width.toReal(), lw);
- }
- if (gf.flags & QTextItem::StrikeOut) {
- qreal offs = fe->ascent().toReal() / 3;
- path.addRect(pos.x(), pos.y() - offs, gf.width.toReal(), lw);
+ QRectF itemRect(iterator.x.toReal(), itemY.toReal(), iterator.itemWidth.toReal(), si.height().toReal());
+
+ eng->docLayout()->drawInlineObject(p, itemRect,
+ QTextInlineObject(iterator.item, eng),
+ si.position + eng->block.position(),
+ format);
+ if (selection) {
+ QBrush bg = format.brushProperty(ObjectSelectionBrush);
+ if (bg.style() != Qt::NoBrush) {
+ QColor c = bg.color();
+ c.setAlpha(128);
+ p->fillRect(itemRect, c);
+ }
+ }
+ } else { // si.isTab
+ QFont f = eng->font(si);
+ QTextItemInt gf(si, &f, format);
+ gf.chars = nullptr;
+ gf.num_chars = 0;
+ gf.width = iterator.itemWidth;
+ QPainterPrivate::get(p)->drawTextItem(QPointF(iterator.x.toReal(), y.toReal()), gf, eng);
+ if (eng->option.flags() & QTextOption::ShowTabsAndSpaces) {
+ const QChar visualTab = QChar(QChar::VisualTabCharacter);
+ int w = QFontMetrics(f).horizontalAdvance(visualTab);
+ qreal x = iterator.itemWidth.toReal() - w; // Right-aligned
+ if (x < 0)
+ p->setClipRect(QRectF(iterator.x.toReal(), line.y.toReal(),
+ iterator.itemWidth.toReal(), line.height().toReal()),
+ Qt::IntersectClip);
+ else
+ x /= 2; // Centered
+ p->setFont(f);
+ p->drawText(QPointF(iterator.x.toReal() + x,
+ y.toReal()), visualTab);
+ }
+
+ }
+ p->restore();
}
+
+ continue;
}
- p->save();
- p->setRenderHint(QPainter::Antialiasing);
- //Currently QPen with a Qt::NoPen style still returns a default
- //QBrush which != Qt::NoBrush so we need this specialcase to reset it
- if (p->pen().style() == Qt::NoPen)
- p->setBrush(Qt::NoBrush);
- else
- p->setBrush(p->pen().brush());
+ unsigned short *logClusters = eng->logClusters(&si);
+ QGlyphLayout glyphs = eng->shapedGlyphs(&si);
- p->setPen(format.textOutline());
- p->drawPath(path);
- p->restore();
- } else {
- if (noText)
- gf.glyphs.numGlyphs = 0; // slightly less elegant than it should be
- QPainterPrivate::get(p)->drawTextItem(pos, gf, eng);
- }
+ QTextItemInt gf(glyphs.mid(iterator.glyphsStart, iterator.glyphsEnd - iterator.glyphsStart),
+ &f, eng->layoutData->string.unicode() + iterator.itemStart,
+ iterator.itemEnd - iterator.itemStart, eng->fontEngine(si), format);
+ gf.logClusters = logClusters + iterator.itemStart - si.position;
+ gf.width = iterator.itemWidth;
+ gf.justified = line.justified;
+ gf.initWithScriptItem(si);
+
+ Q_ASSERT(gf.fontEngine);
+
+ QPointF pos(iterator.x.toReal(), itemBaseLine.toReal());
+ if (format.penProperty(QTextFormat::TextOutline).style() != Qt::NoPen) {
+ QPainterPath path;
+ path.setFillRule(Qt::WindingFill);
+
+ if (gf.glyphs.numGlyphs)
+ gf.fontEngine->addOutlineToPath(pos.x(), pos.y(), gf.glyphs, &path, gf.flags);
+ if (gf.flags) {
+ const QFontEngine *fe = gf.fontEngine;
+ const qreal lw = fe->lineThickness().toReal();
+ if (gf.flags & QTextItem::Underline) {
+ qreal offs = fe->underlinePosition().toReal();
+ path.addRect(pos.x(), pos.y() + offs, gf.width.toReal(), lw);
+ }
+ if (gf.flags & QTextItem::Overline) {
+ qreal offs = fe->ascent().toReal() + 1;
+ path.addRect(pos.x(), pos.y() - offs, gf.width.toReal(), lw);
+ }
+ if (gf.flags & QTextItem::StrikeOut) {
+ qreal offs = fe->ascent().toReal() / 3;
+ path.addRect(pos.x(), pos.y() - offs, gf.width.toReal(), lw);
+ }
+ }
+
+ p->save();
+ p->setRenderHint(QPainter::Antialiasing);
+ //Currently QPen with a Qt::NoPen style still returns a default
+ //QBrush which != Qt::NoBrush so we need this specialcase to reset it
+ if (p->pen().style() == Qt::NoPen)
+ p->setBrush(Qt::NoBrush);
+ else
+ p->setBrush(p->pen().brush());
+
+ p->setPen(format.textOutline());
+ p->drawPath(path);
+ p->restore();
+ } else {
+ if (noText)
+ gf.glyphs.numGlyphs = 0; // slightly less elegant than it should be
+ QPainterPrivate::get(p)->drawTextItem(pos, gf, eng);
+ }
- if ((si.analysis.flags == QScriptAnalysis::Space
- || si.analysis.flags == QScriptAnalysis::Nbsp)
- && (eng->option.flags() & QTextOption::ShowTabsAndSpaces)) {
- QBrush c = format.foreground();
- if (c.style() != Qt::NoBrush)
- p->setPen(c.color());
- QChar visualSpace(si.analysis.flags == QScriptAnalysis::Space ? (ushort)0xb7 : (ushort)0xb0);
- QFont oldFont = p->font();
- p->setFont(eng->font(si));
- p->drawText(QPointF(iterator.x.toReal(), itemBaseLine.toReal()), visualSpace);
- p->setPen(pen);
- p->setFont(oldFont);
+ if ((si.analysis.flags == QScriptAnalysis::Space
+ || si.analysis.flags == QScriptAnalysis::Nbsp)
+ && (eng->option.flags() & QTextOption::ShowTabsAndSpaces)) {
+ QBrush c = format.foreground();
+ if (c.style() != Qt::NoBrush)
+ p->setPen(c.color());
+ const QChar visualSpace = si.analysis.flags == QScriptAnalysis::Space ? u'\xb7' : u'\xb0';
+ QFont oldFont = p->font();
+ p->setFont(eng->font(si));
+ p->drawText(QPointF(iterator.x.toReal(), itemBaseLine.toReal()), visualSpace);
+ p->setPen(pen);
+ p->setFont(oldFont);
+ }
}
}
eng->drawDecorations(p);
+ if (xlateToFixedRange)
+ p->translate(-origPos);
+
if (eng->hasFormats())
p->setPen(pen);
}
@@ -2726,7 +2909,6 @@ qreal QTextLine::cursorToX(int *cursorPos, Edge edge) const
int lineEnd = line.from + line.length + line.trailingSpaces;
int pos = qBound(line.from, *cursorPos, lineEnd);
- int itm;
const QCharAttributes *attributes = eng->attributes();
if (!attributes) {
*cursorPos = line.from;
@@ -2734,38 +2916,54 @@ qreal QTextLine::cursorToX(int *cursorPos, Edge edge) const
}
while (pos < lineEnd && !attributes[pos].graphemeBoundary)
pos++;
- if (pos == lineEnd) {
- // end of line ensure we have the last item on the line
- itm = eng->findItem(pos-1);
- }
- else
- itm = eng->findItem(pos);
+ // end of line ensure we have the last item on the line
+ int itm = pos == lineEnd ? eng->findItem(pos-1) : eng->findItem(pos);
if (itm < 0) {
*cursorPos = line.from;
return x.toReal();
}
eng->shapeLine(line);
- const QScriptItem *si = &eng->layoutData->items[itm];
- if (!si->num_glyphs)
+ const QScriptItem *scriptItem = &eng->layoutData->items[itm];
+ if (!scriptItem->num_glyphs)
eng->shape(itm);
+ if ((scriptItem->analysis.bidiLevel % 2 != eng->isRightToLeft()) && !eng->visualCursorMovement()) {
+ // If the item we found has a different writing direction than the engine,
+ // check if the cursor is between two items with different writing direction
+ int neighborItem = itm;
+ if (neighborItem > 0 && scriptItem->position == pos)
+ --neighborItem;
+ else if (neighborItem < eng->layoutData->items.size() - 1 && scriptItem->position + scriptItem->num_glyphs == pos)
+ ++neighborItem;
+ const bool onBoundary = neighborItem != itm && scriptItem->analysis.bidiLevel != eng->layoutData->items[neighborItem].analysis.bidiLevel;
+ // If we are, prioritise the neighbor item that has the same direction as the engine
+ if (onBoundary) {
+ if (eng->isRightToLeft() != scriptItem->analysis.bidiLevel % 2) {
+ itm = neighborItem;
+ scriptItem = &eng->layoutData->items[itm];
+ if (!scriptItem->num_glyphs)
+ eng->shape(itm);
+ }
+ }
+ }
+
const int l = eng->length(itm);
- pos = qBound(0, pos - si->position, l);
+ pos = qBound(0, pos - scriptItem->position, l);
- QGlyphLayout glyphs = eng->shapedGlyphs(si);
- unsigned short *logClusters = eng->logClusters(si);
+ QGlyphLayout glyphs = eng->shapedGlyphs(scriptItem);
+ unsigned short *logClusters = eng->logClusters(scriptItem);
Q_ASSERT(logClusters);
- int glyph_pos = pos == l ? si->num_glyphs : logClusters[pos];
- if (edge == Trailing && glyph_pos < si->num_glyphs) {
+ int glyph_pos = pos == l ? scriptItem->num_glyphs : logClusters[pos];
+ if (edge == Trailing && glyph_pos < scriptItem->num_glyphs) {
// trailing edge is leading edge of next cluster
glyph_pos++;
- while (glyph_pos < si->num_glyphs && !glyphs.attributes[glyph_pos].clusterStart)
+ while (glyph_pos < scriptItem->num_glyphs && !glyphs.attributes[glyph_pos].clusterStart)
glyph_pos++;
}
- bool reverse = si->analysis.bidiLevel % 2;
+ bool reverse = scriptItem->analysis.bidiLevel % 2;
// add the items left of the cursor
@@ -2810,32 +3008,32 @@ qreal QTextLine::cursorToX(int *cursorPos, Edge edge) const
}
}
- logClusters = eng->logClusters(si);
- glyphs = eng->shapedGlyphs(si);
- if (si->analysis.flags >= QScriptAnalysis::TabOrObject) {
+ logClusters = eng->logClusters(scriptItem);
+ glyphs = eng->shapedGlyphs(scriptItem);
+ if (scriptItem->analysis.flags >= QScriptAnalysis::TabOrObject) {
if (pos == (reverse ? 0 : l))
- x += si->width;
+ x += scriptItem->width;
} else {
bool rtl = eng->isRightToLeft();
bool visual = eng->visualCursorMovement();
- int end = qMin(lineEnd, si->position + l) - si->position;
+ int end = qMin(lineEnd, scriptItem->position + l) - scriptItem->position;
if (reverse) {
- int glyph_end = end == l ? si->num_glyphs : logClusters[end];
+ int glyph_end = end == l ? scriptItem->num_glyphs : logClusters[end];
int glyph_start = glyph_pos;
if (visual && !rtl && !(lastLine && itm == (visualOrder[nItems - 1] + firstItem)))
glyph_start++;
for (int i = glyph_end - 1; i >= glyph_start; i--)
x += glyphs.effectiveAdvance(i);
- x -= eng->offsetInLigature(si, pos, end, glyph_pos);
+ x -= eng->offsetInLigature(scriptItem, pos, end, glyph_pos);
} else {
- int start = qMax(line.from - si->position, 0);
+ int start = qMax(line.from - scriptItem->position, 0);
int glyph_start = logClusters[start];
int glyph_end = glyph_pos;
if (!visual || !rtl || (lastLine && itm == visualOrder[0] + firstItem))
glyph_end--;
for (int i = glyph_start; i <= glyph_end; i++)
x += glyphs.effectiveAdvance(i);
- x += eng->offsetInLigature(si, pos, end, glyph_pos);
+ x += eng->offsetInLigature(scriptItem, pos, end, glyph_pos);
}
}
@@ -2844,7 +3042,7 @@ qreal QTextLine::cursorToX(int *cursorPos, Edge edge) const
if (eng->option.wrapMode() != QTextOption::NoWrap && x < 0)
x = 0;
- *cursorPos = pos + si->position;
+ *cursorPos = pos + scriptItem->position;
return x.toReal();
}
@@ -2892,18 +3090,10 @@ int QTextLine::xToCursor(qreal _x, CursorPosition cpos) const
bool visual = eng->visualCursorMovement();
if (x <= 0) {
// left of first item
- int item = visualOrder[0]+firstItem;
- QScriptItem &si = eng->layoutData->items[item];
- if (!si.num_glyphs)
- eng->shape(item);
- int pos = si.position;
- if (si.analysis.bidiLevel % 2)
- pos += eng->length(item);
- pos = qMax(line.from, pos);
- pos = qMin(line.from + line_length, pos);
- return pos;
- } else if (x < line.textWidth
- || (line.justified && x < line.width)) {
+ if (eng->isRightToLeft())
+ return line.from + line_length;
+ return line.from;
+ } else if (x < line.textWidth || (line.justified && x < line.width)) {
// has to be in one of the runs
QFixed pos;
bool rtl = eng->isRightToLeft();
@@ -3053,26 +3243,17 @@ int QTextLine::xToCursor(qreal _x, CursorPosition cpos) const
}
}
// right of last item
-// qDebug("right of last");
- int item = visualOrder[nItems-1]+firstItem;
- QScriptItem &si = eng->layoutData->items[item];
- if (!si.num_glyphs)
- eng->shape(item);
- int pos = si.position;
- if (!(si.analysis.bidiLevel % 2))
- pos += eng->length(item);
- pos = qMax(line.from, pos);
-
- int maxPos = line.from + line_length;
+ int pos = line.from;
+ if (!eng->isRightToLeft())
+ pos += line_length;
// except for the last line we assume that the
// character between lines is a space and we want
// to position the cursor to the left of that
// character.
- if (this->index < eng->lines.count() - 1)
- maxPos = eng->previousLogicalPosition(maxPos);
+ if (index < eng->lines.size() - 1)
+ pos = qMin(eng->previousLogicalPosition(pos), pos);
- pos = qMin(pos, maxPos);
return pos;
}
diff --git a/src/gui/text/qtextlayout.h b/src/gui/text/qtextlayout.h
index 2fc0fcd55a..5b1b64d7ee 100644
--- a/src/gui/text/qtextlayout.h
+++ b/src/gui/text/qtextlayout.h
@@ -1,55 +1,20 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the QtGui module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#ifndef QTEXTLAYOUT_H
#define QTEXTLAYOUT_H
-#include <QtGui/qtguiglobal.h>
-#include <QtCore/qstring.h>
-#include <QtCore/qnamespace.h>
-#include <QtCore/qrect.h>
-#include <QtCore/qvector.h>
#include <QtGui/qcolor.h>
-#include <QtCore/qobject.h>
#include <QtGui/qevent.h>
-#include <QtGui/qtextformat.h>
#include <QtGui/qglyphrun.h>
#include <QtGui/qtextcursor.h>
+#include <QtGui/qtextformat.h>
+#include <QtGui/qtguiglobal.h>
+
+#include <QtCore/qlist.h>
+#include <QtCore/qnamespace.h>
+#include <QtCore/qobject.h>
+#include <QtCore/qrect.h>
+#include <QtCore/qstring.h>
QT_BEGIN_NAMESPACE
@@ -104,22 +69,21 @@ class QTextOption;
class Q_GUI_EXPORT QTextLayout
{
public:
+ enum GlyphRunRetrievalFlag : quint16 {
+ RetrieveGlyphIndexes = 0x1,
+ RetrieveGlyphPositions = 0x2,
+ RetrieveStringIndexes = 0x4,
+ RetrieveString = 0x8,
+
+ DefaultRetrievalFlags = RetrieveGlyphIndexes | RetrieveGlyphPositions,
+ RetrieveAll = 0xffff
+ };
+ Q_DECLARE_FLAGS(GlyphRunRetrievalFlags, GlyphRunRetrievalFlag)
+
// does itemization
QTextLayout();
QTextLayout(const QString& text);
-#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
- QTextLayout(const QString &text, const QFont &font, QPaintDevice *paintdevice = nullptr);
-#ifndef Q_QDOC
- // the template is necessary to make QTextLayout(font,text,nullptr) and QTextLayout(font,text,NULL)
- // not ambiguous. Implementation detail that should not be documented.
- template<char = 0>
-#endif
- QTextLayout(const QString &textData, const QFont &textFont, const QPaintDevice *paintdevice)
- : QTextLayout(textData, textFont, const_cast<QPaintDevice*>(paintdevice))
- {}
-#else
QTextLayout(const QString &text, const QFont &font, const QPaintDevice *paintdevice = nullptr);
-#endif
QTextLayout(const QTextBlock &b);
~QTextLayout();
@@ -150,13 +114,8 @@ public:
friend bool operator!=(const FormatRange &lhs, const FormatRange &rhs)
{ return !operator==(lhs, rhs); }
};
-#if QT_DEPRECATED_SINCE(5, 6)
- QT_DEPRECATED_X("Use setFormats()") void setAdditionalFormats(const QList<FormatRange> &overrides);
- QT_DEPRECATED_X("Use formats()") QList<FormatRange> additionalFormats() const;
- QT_DEPRECATED_X("Use clearFormats()") void clearAdditionalFormats();
-#endif
- void setFormats(const QVector<FormatRange> &overrides);
- QVector<FormatRange> formats() const;
+ void setFormats(const QList<FormatRange> &overrides);
+ QList<FormatRange> formats() const;
void clearFormats();
void setCacheEnabled(bool enable);
@@ -185,7 +144,8 @@ public:
int leftCursorPosition(int oldPos) const;
int rightCursorPosition(int oldPos) const;
- void draw(QPainter *p, const QPointF &pos, const QVector<FormatRange> &selections = QVector<FormatRange>(),
+ void draw(QPainter *p, const QPointF &pos,
+ const QList<FormatRange> &selections = QList<FormatRange>(),
const QRectF &clip = QRectF()) const;
void drawCursor(QPainter *p, const QPointF &pos, int cursorPosition) const;
void drawCursor(QPainter *p, const QPointF &pos, int cursorPosition, int width) const;
@@ -199,7 +159,15 @@ public:
qreal maximumWidth() const;
#if !defined(QT_NO_RAWFONT)
+
+# if QT_VERSION < QT_VERSION_CHECK(7, 0, 0)
+ QList<QGlyphRun> glyphRuns(int from, int length, GlyphRunRetrievalFlags flags) const;
QList<QGlyphRun> glyphRuns(int from = -1, int length = -1) const;
+# else
+ QList<QGlyphRun> glyphRuns(int from = -1,
+ int length = -1,
+ GlyphRunRetrievalFlags flags = DefaultRetrievalFlags) const;
+# endif
#endif
QTextEngine *engine() const { return d; }
@@ -217,7 +185,7 @@ private:
QTextEngine *d;
};
Q_DECLARE_TYPEINFO(QTextLayout::FormatRange, Q_RELOCATABLE_TYPE);
-
+Q_DECLARE_OPERATORS_FOR_FLAGS(QTextLayout::GlyphRunRetrievalFlags)
class Q_GUI_EXPORT QTextLine
{
@@ -267,15 +235,24 @@ public:
int lineNumber() const { return index; }
- void draw(QPainter *p, const QPointF &point, const QTextLayout::FormatRange *selection = nullptr) const;
+ void draw(QPainter *painter, const QPointF &position) const;
#if !defined(QT_NO_RAWFONT)
+# if QT_VERSION < QT_VERSION_CHECK(7, 0, 0)
+ QList<QGlyphRun> glyphRuns(int from, int length, QTextLayout::GlyphRunRetrievalFlags flags) const;
QList<QGlyphRun> glyphRuns(int from = -1, int length = -1) const;
+# else
+ QList<QGlyphRun> glyphRuns(int from = -1,
+ int length = -1,
+ QTextLayout::GlyphRunRetrievalFlags flags = QTextLayout::DefaultRetrievalFlags) const;
+# endif
#endif
private:
QTextLine(int line, QTextEngine *e) : index(line), eng(e) {}
void layout_helper(int numGlyphs);
+ void draw_internal(QPainter *p, const QPointF &pos,
+ const QTextLayout::FormatRange *selection) const;
friend class QTextLayout;
friend class QTextFragment;
diff --git a/src/gui/text/qtextlist.cpp b/src/gui/text/qtextlist.cpp
index 5857afa048..7ec8b6215e 100644
--- a/src/gui/text/qtextlist.cpp
+++ b/src/gui/text/qtextlist.cpp
@@ -1,41 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the QtGui module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#include "qtextlist.h"
@@ -46,6 +10,8 @@
QT_BEGIN_NAMESPACE
+using namespace Qt::StringLiterals;
+
class QTextListPrivate : public QTextBlockGroupPrivate
{
public:
@@ -100,20 +66,6 @@ public:
\sa QTextBlock, QTextListFormat, QTextCursor
*/
-#if QT_DEPRECATED_SINCE(5, 13)
-/*!
- \fn bool QTextList::isEmpty() const
- \obsolete
-
- Returns \c true if the list has no items; otherwise returns \c false.
-
- \b{Note:} Empty lists are automatically deleted by the QTextDocument that owns
- them.
-
- \sa count()
-*/
-#endif
-
/*! \internal
*/
QTextList::QTextList(QTextDocument *doc)
@@ -134,7 +86,7 @@ QTextList::~QTextList()
int QTextList::count() const
{
Q_D(const QTextList);
- return d->blocks.count();
+ return d->blocks.size();
}
/*!
@@ -193,7 +145,10 @@ QString QTextList::itemText(const QTextBlock &blockIt) const
const int style = format().style();
QString numberPrefix;
- QString numberSuffix = QLatin1String(".");
+ QString numberSuffix = u"."_s;
+
+ // the number of the item might be offset by start, which defaults to 1
+ const int itemNumber = item + format().start() - 1;
if (format().hasProperty(QTextFormat::ListNumberPrefix))
numberPrefix = format().numberPrefix();
@@ -202,18 +157,24 @@ QString QTextList::itemText(const QTextBlock &blockIt) const
switch (style) {
case QTextListFormat::ListDecimal:
- result = QString::number(item);
+ result = QString::number(itemNumber);
break;
// from the old richtext
case QTextListFormat::ListLowerAlpha:
case QTextListFormat::ListUpperAlpha:
{
+ // match the html default behavior of falling back to decimal numbers
+ if (itemNumber < 1) {
+ result = QString::number(itemNumber);
+ break;
+ }
+
const char baseChar = style == QTextListFormat::ListUpperAlpha ? 'A' : 'a';
- int c = item;
+ int c = itemNumber;
while (c > 0) {
c--;
- result.prepend(QChar(baseChar + (c % 26)));
+ result.prepend(QChar::fromUcs2(baseChar + (c % 26)));
c /= 26;
}
}
@@ -221,20 +182,21 @@ QString QTextList::itemText(const QTextBlock &blockIt) const
case QTextListFormat::ListLowerRoman:
case QTextListFormat::ListUpperRoman:
{
- if (item < 5000) {
- QByteArray romanNumeral;
+ // match the html default behavior of falling back to decimal numbers
+ if (itemNumber < 1) {
+ result = QString::number(itemNumber);
+ } else if (itemNumber < 5000) {
+ QString romanNumeral;
// works for up to 4999 items
- static const char romanSymbolsLower[] = "iiivixxxlxcccdcmmmm";
- static const char romanSymbolsUpper[] = "IIIVIXXXLXCCCDCMMMM";
- QByteArray romanSymbols; // wrap to have "mid"
+ QLatin1StringView romanSymbols;
if (style == QTextListFormat::ListLowerRoman)
- romanSymbols = QByteArray::fromRawData(romanSymbolsLower, sizeof(romanSymbolsLower));
+ romanSymbols = "iiivixxxlxcccdcmmmm"_L1;
else
- romanSymbols = QByteArray::fromRawData(romanSymbolsUpper, sizeof(romanSymbolsUpper));
+ romanSymbols = "IIIVIXXXLXCCCDCMMMM"_L1;
int c[] = { 1, 4, 5, 9, 10, 40, 50, 90, 100, 400, 500, 900, 1000 };
- int n = item;
+ int n = itemNumber;
for (int i = 12; i >= 0; n %= c[i], i--) {
int q = n / c[i];
if (q > 0) {
@@ -256,13 +218,12 @@ QString QTextList::itemText(const QTextBlock &blockIt) const
numDigits = q;
}
- romanNumeral.append(romanSymbols.mid(startDigit, numDigits));
+ romanNumeral.append(romanSymbols.sliced(startDigit, numDigits));
}
}
- result = QString::fromLatin1(romanNumeral);
- }
- else {
- result = QLatin1String("?");
+ result = std::move(romanNumeral);
+ } else {
+ result = u"?"_s;
}
}
@@ -304,7 +265,7 @@ void QTextList::remove(const QTextBlock &block)
QTextBlockFormat fmt = block.blockFormat();
fmt.setIndent(fmt.indent() + format().indent());
fmt.setObjectIndex(-1);
- block.docHandle()->setBlockFormat(block, block, fmt, QTextDocumentPrivate::SetFormat);
+ const_cast<QTextDocumentPrivate *>(QTextDocumentPrivate::get(block))->setBlockFormat(block, block, fmt, QTextDocumentPrivate::SetFormat);
}
/*!
@@ -316,7 +277,9 @@ void QTextList::add(const QTextBlock &block)
{
QTextBlockFormat fmt = block.blockFormat();
fmt.setObjectIndex(objectIndex());
- block.docHandle()->setBlockFormat(block, block, fmt, QTextDocumentPrivate::SetFormat);
+ const_cast<QTextDocumentPrivate *>(QTextDocumentPrivate::get(block))->setBlockFormat(block, block, fmt, QTextDocumentPrivate::SetFormat);
}
QT_END_NAMESPACE
+
+#include "moc_qtextlist.cpp"
diff --git a/src/gui/text/qtextlist.h b/src/gui/text/qtextlist.h
index cfb9f9456f..025213c2f9 100644
--- a/src/gui/text/qtextlist.h
+++ b/src/gui/text/qtextlist.h
@@ -1,41 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the QtGui module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#ifndef QTEXTLIST_H
#define QTEXTLIST_H
@@ -59,12 +23,6 @@ public:
int count() const;
-#if QT_DEPRECATED_SINCE(5, 13)
- QT_DEPRECATED_X("Use count() instead")
- inline bool isEmpty() const
- { return count() == 0; }
-#endif
-
QTextBlock item(int i) const;
int itemNumber(const QTextBlock &) const;
diff --git a/src/gui/text/qtextmarkdownimporter.cpp b/src/gui/text/qtextmarkdownimporter.cpp
index 78d18a714b..e7fcad67b5 100644
--- a/src/gui/text/qtextmarkdownimporter.cpp
+++ b/src/gui/text/qtextmarkdownimporter.cpp
@@ -1,41 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2019 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the QtGui module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2019 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#include "qtextmarkdownimporter_p.h"
#include "qtextdocumentfragment_p.h"
@@ -48,33 +12,44 @@
#include <QTextDocumentFragment>
#include <QTextList>
#include <QTextTable>
+#if QT_CONFIG(system_textmarkdownreader)
+#include <md4c.h>
+#else
#include "../../3rdparty/md4c/md4c.h"
+#endif
QT_BEGIN_NAMESPACE
+using namespace Qt::StringLiterals;
+
Q_LOGGING_CATEGORY(lcMD, "qt.text.markdown")
-static const QChar Newline = QLatin1Char('\n');
-static const QChar Space = QLatin1Char(' ');
+static const QChar qtmi_Newline = u'\n';
+static const QChar qtmi_Space = u' ';
+
+static constexpr auto markerString() noexcept { return "---"_L1; }
// TODO maybe eliminate the margins after all views recognize BlockQuoteLevel, CSS can format it, etc.
-static const int BlockQuoteIndent = 40; // pixels, same as in QTextHtmlParserNode::initializeProperties
-
-Q_STATIC_ASSERT(int(QTextMarkdownImporter::FeatureCollapseWhitespace) == MD_FLAG_COLLAPSEWHITESPACE);
-Q_STATIC_ASSERT(int(QTextMarkdownImporter::FeaturePermissiveATXHeaders) == MD_FLAG_PERMISSIVEATXHEADERS);
-Q_STATIC_ASSERT(int(QTextMarkdownImporter::FeaturePermissiveURLAutoLinks) == MD_FLAG_PERMISSIVEURLAUTOLINKS);
-Q_STATIC_ASSERT(int(QTextMarkdownImporter::FeaturePermissiveMailAutoLinks) == MD_FLAG_PERMISSIVEEMAILAUTOLINKS);
-Q_STATIC_ASSERT(int(QTextMarkdownImporter::FeatureNoIndentedCodeBlocks) == MD_FLAG_NOINDENTEDCODEBLOCKS);
-Q_STATIC_ASSERT(int(QTextMarkdownImporter::FeatureNoHTMLBlocks) == MD_FLAG_NOHTMLBLOCKS);
-Q_STATIC_ASSERT(int(QTextMarkdownImporter::FeatureNoHTMLSpans) == MD_FLAG_NOHTMLSPANS);
-Q_STATIC_ASSERT(int(QTextMarkdownImporter::FeatureTables) == MD_FLAG_TABLES);
-Q_STATIC_ASSERT(int(QTextMarkdownImporter::FeatureStrikeThrough) == MD_FLAG_STRIKETHROUGH);
-Q_STATIC_ASSERT(int(QTextMarkdownImporter::FeaturePermissiveWWWAutoLinks) == MD_FLAG_PERMISSIVEWWWAUTOLINKS);
-Q_STATIC_ASSERT(int(QTextMarkdownImporter::FeaturePermissiveAutoLinks) == MD_FLAG_PERMISSIVEAUTOLINKS);
-Q_STATIC_ASSERT(int(QTextMarkdownImporter::FeatureTasklists) == MD_FLAG_TASKLISTS);
-Q_STATIC_ASSERT(int(QTextMarkdownImporter::FeatureNoHTML) == MD_FLAG_NOHTML);
-Q_STATIC_ASSERT(int(QTextMarkdownImporter::DialectCommonMark) == MD_DIALECT_COMMONMARK);
-Q_STATIC_ASSERT(int(QTextMarkdownImporter::DialectGitHub) == MD_DIALECT_GITHUB);
+static const int qtmi_BlockQuoteIndent =
+ 40; // pixels, same as in QTextHtmlParserNode::initializeProperties
+
+static_assert(int(QTextMarkdownImporter::FeatureCollapseWhitespace) == MD_FLAG_COLLAPSEWHITESPACE);
+static_assert(int(QTextMarkdownImporter::FeaturePermissiveATXHeaders) == MD_FLAG_PERMISSIVEATXHEADERS);
+static_assert(int(QTextMarkdownImporter::FeaturePermissiveURLAutoLinks) == MD_FLAG_PERMISSIVEURLAUTOLINKS);
+static_assert(int(QTextMarkdownImporter::FeaturePermissiveMailAutoLinks) == MD_FLAG_PERMISSIVEEMAILAUTOLINKS);
+static_assert(int(QTextMarkdownImporter::FeatureNoIndentedCodeBlocks) == MD_FLAG_NOINDENTEDCODEBLOCKS);
+static_assert(int(QTextMarkdownImporter::FeatureNoHTMLBlocks) == MD_FLAG_NOHTMLBLOCKS);
+static_assert(int(QTextMarkdownImporter::FeatureNoHTMLSpans) == MD_FLAG_NOHTMLSPANS);
+static_assert(int(QTextMarkdownImporter::FeatureTables) == MD_FLAG_TABLES);
+static_assert(int(QTextMarkdownImporter::FeatureStrikeThrough) == MD_FLAG_STRIKETHROUGH);
+static_assert(int(QTextMarkdownImporter::FeatureUnderline) == MD_FLAG_UNDERLINE);
+static_assert(int(QTextMarkdownImporter::FeaturePermissiveWWWAutoLinks) == MD_FLAG_PERMISSIVEWWWAUTOLINKS);
+static_assert(int(QTextMarkdownImporter::FeaturePermissiveAutoLinks) == MD_FLAG_PERMISSIVEAUTOLINKS);
+static_assert(int(QTextMarkdownImporter::FeatureTasklists) == MD_FLAG_TASKLISTS);
+static_assert(int(QTextMarkdownImporter::FeatureNoHTML) == MD_FLAG_NOHTML);
+static_assert(int(QTextMarkdownImporter::DialectCommonMark) == MD_DIALECT_COMMONMARK);
+static_assert(int(QTextMarkdownImporter::DialectGitHub) ==
+ (MD_DIALECT_GITHUB | MD_FLAG_UNDERLINE | QTextMarkdownImporter::FeatureFrontMatter));
// --------------------------------------------------------
// MD4C callback function wrappers
@@ -111,7 +86,7 @@ static int CbText(MD_TEXTTYPE type, const MD_CHAR *text, MD_SIZE size, void *use
static void CbDebugLog(const char *msg, void *userdata)
{
- Q_UNUSED(userdata)
+ Q_UNUSED(userdata);
qCDebug(lcMD) << msg;
}
@@ -132,18 +107,19 @@ static Qt::Alignment MdAlignment(MD_ALIGN a, Qt::Alignment defaultAlignment = Qt
}
}
-QTextMarkdownImporter::QTextMarkdownImporter(QTextMarkdownImporter::Features features)
- : m_monoFont(QFontDatabase::systemFont(QFontDatabase::FixedFont))
+QTextMarkdownImporter::QTextMarkdownImporter(QTextDocument *doc, QTextMarkdownImporter::Features features)
+ : m_cursor(doc)
+ , m_monoFont(QFontDatabase::systemFont(QFontDatabase::FixedFont))
, m_features(features)
{
}
-QTextMarkdownImporter::QTextMarkdownImporter(QTextDocument::MarkdownFeatures features)
- : QTextMarkdownImporter(static_cast<QTextMarkdownImporter::Features>(int(features)))
+QTextMarkdownImporter::QTextMarkdownImporter(QTextDocument *doc, QTextDocument::MarkdownFeatures features)
+ : QTextMarkdownImporter(doc, static_cast<QTextMarkdownImporter::Features>(int(features)))
{
}
-void QTextMarkdownImporter::import(QTextDocument *doc, const QString &markdown)
+void QTextMarkdownImporter::import(const QString &markdown)
{
MD_PARSER callbacks = {
0, // abi_version
@@ -156,19 +132,36 @@ void QTextMarkdownImporter::import(QTextDocument *doc, const QString &markdown)
&CbDebugLog,
nullptr // syntax
};
- m_doc = doc;
- m_paragraphMargin = m_doc->defaultFont().pointSize() * 2 / 3;
- m_cursor = new QTextCursor(doc);
+ QTextDocument *doc = m_cursor.document();
+ const auto defaultFont = doc->defaultFont();
+ m_paragraphMargin = defaultFont.pointSize() * 2 / 3;
doc->clear();
- if (doc->defaultFont().pointSize() != -1)
- m_monoFont.setPointSize(doc->defaultFont().pointSize());
+ if (defaultFont.pointSize() != -1)
+ m_monoFont.setPointSize(defaultFont.pointSize());
else
- m_monoFont.setPixelSize(doc->defaultFont().pixelSize());
- qCDebug(lcMD) << "default font" << doc->defaultFont() << "mono font" << m_monoFont;
- QByteArray md = markdown.toUtf8();
- md_parse(md.constData(), MD_SIZE(md.size()), &callbacks, this);
- delete m_cursor;
- m_cursor = nullptr;
+ m_monoFont.setPixelSize(defaultFont.pixelSize());
+ qCDebug(lcMD) << "default font" << defaultFont << "mono font" << m_monoFont;
+ QStringView md = markdown;
+
+ if (m_features.testFlag(QTextMarkdownImporter::FeatureFrontMatter) && md.startsWith(markerString())) {
+ qsizetype endMarkerPos = md.indexOf(markerString(), markerString().size() + 1);
+ if (endMarkerPos > 4) {
+ qsizetype firstLinePos = 4; // first line of yaml
+ while (md.at(firstLinePos) == '\n'_L1 || md.at(firstLinePos) == '\r'_L1)
+ ++firstLinePos;
+ auto frontMatter = md.sliced(firstLinePos, endMarkerPos - firstLinePos);
+ firstLinePos = endMarkerPos + 4; // first line of markdown after yaml
+ while (md.size() > firstLinePos && (md.at(firstLinePos) == '\n'_L1 || md.at(firstLinePos) == '\r'_L1))
+ ++firstLinePos;
+ md = md.sliced(firstLinePos);
+ doc->setMetaInformation(QTextDocument::FrontMatter, frontMatter.toString());
+ qCDebug(lcMD) << "extracted FrontMatter: size" << frontMatter.size();
+ }
+ }
+ const auto mdUtf8 = md.toUtf8();
+ m_cursor.beginEditBlock();
+ md_parse(mdUtf8.constData(), MD_SIZE(mdUtf8.size()), &callbacks, this);
+ m_cursor.endEditBlock();
}
int QTextMarkdownImporter::cbEnterBlock(int blockType, void *det)
@@ -177,7 +170,7 @@ int QTextMarkdownImporter::cbEnterBlock(int blockType, void *det)
switch (blockType) {
case MD_BLOCK_P:
if (!m_listStack.isEmpty())
- qCDebug(lcMD, m_listItem ? "P of LI at level %d" : "P continuation inside LI at level %d", m_listStack.count());
+ qCDebug(lcMD, m_listItem ? "P of LI at level %d" : "P continuation inside LI at level %d", int(m_listStack.size()));
else
qCDebug(lcMD, "P");
m_needsInsertBlock = true;
@@ -189,9 +182,9 @@ int QTextMarkdownImporter::cbEnterBlock(int blockType, void *det)
case MD_BLOCK_CODE: {
MD_BLOCK_CODE_DETAIL *detail = static_cast<MD_BLOCK_CODE_DETAIL *>(det);
m_codeBlock = true;
- m_blockCodeLanguage = QLatin1String(detail->lang.text, int(detail->lang.size));
+ m_blockCodeLanguage = QLatin1StringView(detail->lang.text, int(detail->lang.size));
m_blockCodeFence = detail->fence_char;
- QString info = QLatin1String(detail->info.text, int(detail->info.size));
+ QString info = QLatin1StringView(detail->info.text, int(detail->info.size));
m_needsInsertBlock = true;
if (m_blockQuoteDepth)
qCDebug(lcMD, "CODE lang '%s' info '%s' fenced with '%c' inside QUOTE %d", qPrintable(m_blockCodeLanguage), qPrintable(info), m_blockCodeFence, m_blockQuoteDepth);
@@ -207,7 +200,12 @@ int QTextMarkdownImporter::cbEnterBlock(int blockType, void *det)
charFmt.setFontWeight(QFont::Bold);
blockFmt.setHeadingLevel(int(detail->level));
m_needsInsertBlock = false;
- m_cursor->insertBlock(blockFmt, charFmt);
+ if (m_cursor.document()->isEmpty()) {
+ m_cursor.setBlockFormat(blockFmt);
+ m_cursor.setCharFormat(charFmt);
+ } else {
+ m_cursor.insertBlock(blockFmt, charFmt);
+ }
qCDebug(lcMD, "H%d", detail->level);
} break;
case MD_BLOCK_LI: {
@@ -221,12 +219,12 @@ int QTextMarkdownImporter::cbEnterBlock(int blockType, void *det)
} break;
case MD_BLOCK_UL: {
if (m_needsInsertList) // list nested in an empty list
- m_listStack.push(m_cursor->insertList(m_listFormat));
+ m_listStack.push(m_cursor.insertList(m_listFormat));
else
m_needsInsertList = true;
MD_BLOCK_UL_DETAIL *detail = static_cast<MD_BLOCK_UL_DETAIL *>(det);
m_listFormat = QTextListFormat();
- m_listFormat.setIndent(m_listStack.count() + 1);
+ m_listFormat.setIndent(m_listStack.size() + 1);
switch (detail->mark) {
case '*':
m_listFormat.setStyle(QTextListFormat::ListCircle);
@@ -238,19 +236,20 @@ int QTextMarkdownImporter::cbEnterBlock(int blockType, void *det)
m_listFormat.setStyle(QTextListFormat::ListDisc);
break;
}
- qCDebug(lcMD, "UL %c level %d", detail->mark, m_listStack.count() + 1);
+ qCDebug(lcMD, "UL %c level %d", detail->mark, int(m_listStack.size()) + 1);
} break;
case MD_BLOCK_OL: {
if (m_needsInsertList) // list nested in an empty list
- m_listStack.push(m_cursor->insertList(m_listFormat));
+ m_listStack.push(m_cursor.insertList(m_listFormat));
else
m_needsInsertList = true;
MD_BLOCK_OL_DETAIL *detail = static_cast<MD_BLOCK_OL_DETAIL *>(det);
m_listFormat = QTextListFormat();
- m_listFormat.setIndent(m_listStack.count() + 1);
+ m_listFormat.setIndent(m_listStack.size() + 1);
m_listFormat.setNumberSuffix(QChar::fromLatin1(detail->mark_delimiter));
m_listFormat.setStyle(QTextListFormat::ListDecimal);
- qCDebug(lcMD, "OL xx%d level %d", detail->mark_delimiter, m_listStack.count() + 1);
+ m_listFormat.setStart(detail->start);
+ qCDebug(lcMD, "OL xx%d level %d start %d", detail->mark_delimiter, int(m_listStack.size()) + 1, detail->start);
} break;
case MD_BLOCK_TD: {
MD_BLOCK_TD_DETAIL *detail = static_cast<MD_BLOCK_TD_DETAIL *>(det);
@@ -262,10 +261,10 @@ int QTextMarkdownImporter::cbEnterBlock(int blockType, void *det)
qWarning("malformed table in Markdown input");
return 1;
}
- *m_cursor = cell.firstCursorPosition();
- QTextBlockFormat blockFmt = m_cursor->blockFormat();
+ m_cursor = cell.firstCursorPosition();
+ QTextBlockFormat blockFmt = m_cursor.blockFormat();
blockFmt.setAlignment(MdAlignment(detail->align));
- m_cursor->setBlockFormat(blockFmt);
+ m_cursor.setBlockFormat(blockFmt);
qCDebug(lcMD) << "TD; align" << detail->align << MdAlignment(detail->align) << "col" << m_tableCol;
} break;
case MD_BLOCK_TH: {
@@ -293,13 +292,13 @@ int QTextMarkdownImporter::cbEnterBlock(int blockType, void *det)
case MD_BLOCK_TABLE:
m_tableColumnCount = 0;
m_tableRowCount = 0;
- m_currentTable = m_cursor->insertTable(1, 1); // we don't know the dimensions yet
+ m_currentTable = m_cursor.insertTable(1, 1); // we don't know the dimensions yet
break;
case MD_BLOCK_HR: {
qCDebug(lcMD, "HR");
QTextBlockFormat blockFmt;
blockFmt.setProperty(QTextFormat::BlockTrailingHorizontalRulerWidth, 1);
- m_cursor->insertBlock(blockFmt, QTextCharFormat());
+ m_cursor.insertBlock(blockFmt, QTextCharFormat());
} break;
default:
break; // nothing to do for now
@@ -309,7 +308,7 @@ int QTextMarkdownImporter::cbEnterBlock(int blockType, void *det)
int QTextMarkdownImporter::cbLeaveBlock(int blockType, void *detail)
{
- Q_UNUSED(detail)
+ Q_UNUSED(detail);
switch (blockType) {
case MD_BLOCK_P:
m_listItem = false;
@@ -317,11 +316,11 @@ int QTextMarkdownImporter::cbLeaveBlock(int blockType, void *detail)
case MD_BLOCK_UL:
case MD_BLOCK_OL:
if (Q_UNLIKELY(m_needsInsertList))
- m_listStack.push(m_cursor->createList(m_listFormat));
+ m_listStack.push(m_cursor.createList(m_listFormat));
if (Q_UNLIKELY(m_listStack.isEmpty())) {
qCWarning(lcMD, "list ended unexpectedly");
} else {
- qCDebug(lcMD, "list at level %d ended", m_listStack.count());
+ qCDebug(lcMD, "list at level %d ended", int(m_listStack.size()));
m_listStack.pop();
}
break;
@@ -355,10 +354,10 @@ int QTextMarkdownImporter::cbLeaveBlock(int blockType, void *detail)
case MD_BLOCK_TABLE:
qCDebug(lcMD) << "table ended with" << m_currentTable->columns() << "cols and" << m_currentTable->rows() << "rows";
m_currentTable = nullptr;
- m_cursor->movePosition(QTextCursor::End);
+ m_cursor.movePosition(QTextCursor::End);
break;
case MD_BLOCK_LI:
- qCDebug(lcMD, "LI at level %d ended", m_listStack.count());
+ qCDebug(lcMD, "LI at level %d ended", int(m_listStack.size()));
m_listItem = false;
break;
case MD_BLOCK_CODE: {
@@ -372,7 +371,7 @@ int QTextMarkdownImporter::cbLeaveBlock(int blockType, void *detail)
m_needsInsertBlock = true;
} break;
case MD_BLOCK_H:
- m_cursor->setCharFormat(QTextCharFormat());
+ m_cursor.setCharFormat(QTextCharFormat());
break;
default:
break;
@@ -383,6 +382,8 @@ int QTextMarkdownImporter::cbLeaveBlock(int blockType, void *detail)
int QTextMarkdownImporter::cbEnterSpan(int spanType, void *det)
{
QTextCharFormat charFmt;
+ if (!m_spanFormatStack.isEmpty())
+ charFmt = m_spanFormatStack.top();
switch (spanType) {
case MD_SPAN_EM:
charFmt.setFontItalic(true);
@@ -390,12 +391,17 @@ int QTextMarkdownImporter::cbEnterSpan(int spanType, void *det)
case MD_SPAN_STRONG:
charFmt.setFontWeight(QFont::Bold);
break;
+ case MD_SPAN_U:
+ charFmt.setFontUnderline(true);
+ break;
case MD_SPAN_A: {
MD_SPAN_A_DETAIL *detail = static_cast<MD_SPAN_A_DETAIL *>(det);
- QString url = QString::fromLatin1(detail->href.text, int(detail->href.size));
- QString title = QString::fromLatin1(detail->title.text, int(detail->title.size));
+ QString url = QString::fromUtf8(detail->href.text, int(detail->href.size));
+ QString title = QString::fromUtf8(detail->title.text, int(detail->title.size));
+ charFmt.setAnchor(true);
charFmt.setAnchorHref(url);
- charFmt.setAnchorNames(QStringList(title));
+ if (!title.isEmpty())
+ charFmt.setToolTip(title);
charFmt.setForeground(m_palette.link());
qCDebug(lcMD) << "anchor" << url << title;
} break;
@@ -409,30 +415,33 @@ int QTextMarkdownImporter::cbEnterSpan(int spanType, void *det)
}
case MD_SPAN_CODE:
charFmt.setFont(m_monoFont);
+ charFmt.setFontFixedPitch(true);
break;
case MD_SPAN_DEL:
charFmt.setFontStrikeOut(true);
break;
}
m_spanFormatStack.push(charFmt);
- qCDebug(lcMD) << spanType << "setCharFormat" << charFmt.font().family() << charFmt.fontWeight()
- << (charFmt.fontItalic() ? "italic" : "") << charFmt.foreground().color().name();
- m_cursor->setCharFormat(charFmt);
+ qCDebug(lcMD) << spanType << "setCharFormat" << charFmt.font().families().constFirst()
+ << charFmt.fontWeight() << (charFmt.fontItalic() ? "italic" : "")
+ << charFmt.foreground().color().name();
+ m_cursor.setCharFormat(charFmt);
return 0; // no error
}
int QTextMarkdownImporter::cbLeaveSpan(int spanType, void *detail)
{
- Q_UNUSED(detail)
+ Q_UNUSED(detail);
QTextCharFormat charFmt;
if (!m_spanFormatStack.isEmpty()) {
m_spanFormatStack.pop();
if (!m_spanFormatStack.isEmpty())
charFmt = m_spanFormatStack.top();
}
- m_cursor->setCharFormat(charFmt);
- qCDebug(lcMD) << spanType << "setCharFormat" << charFmt.font().family() << charFmt.fontWeight()
- << (charFmt.fontItalic() ? "italic" : "") << charFmt.foreground().color().name();
+ m_cursor.setCharFormat(charFmt);
+ qCDebug(lcMD) << spanType << "setCharFormat" << charFmt.font().families().constFirst()
+ << charFmt.fontWeight() << (charFmt.fontItalic() ? "italic" : "")
+ << charFmt.foreground().color().name();
if (spanType == int(MD_SPAN_IMG))
m_imageSpan = false;
return 0; // no error
@@ -458,20 +467,23 @@ int QTextMarkdownImporter::cbText(int textType, const char *text, unsigned size)
#endif
break;
case MD_TEXT_NULLCHAR:
- s = QString(QChar(0xFFFD)); // CommonMark-required replacement for null
+ s = QString(QChar(u'\xFFFD')); // CommonMark-required replacement for null
break;
case MD_TEXT_BR:
- s = QString(Newline);
+ s = QString(qtmi_Newline);
break;
case MD_TEXT_SOFTBR:
- s = QString(Space);
+ s = QString(qtmi_Space);
break;
case MD_TEXT_CODE:
// We'll see MD_SPAN_CODE too, which will set the char format, and that's enough.
break;
#if QT_CONFIG(texthtmlparser)
case MD_TEXT_ENTITY:
- m_cursor->insertHtml(s);
+ if (m_htmlTagDepth)
+ m_htmlAccumulator += s;
+ else
+ m_cursor.insertHtml(s);
s = QString();
break;
#endif
@@ -493,11 +505,11 @@ int QTextMarkdownImporter::cbText(int textType, const char *text, unsigned size)
m_htmlAccumulator += s;
if (!m_htmlTagDepth) { // all open tags are now closed
qCDebug(lcMD) << "HTML" << m_htmlAccumulator;
- m_cursor->insertHtml(m_htmlAccumulator);
+ m_cursor.insertHtml(m_htmlAccumulator);
if (m_spanFormatStack.isEmpty())
- m_cursor->setCharFormat(QTextCharFormat());
+ m_cursor.setCharFormat(QTextCharFormat());
else
- m_cursor->setCharFormat(m_spanFormatStack.top());
+ m_cursor.setCharFormat(m_spanFormatStack.top());
m_htmlAccumulator = QString();
}
#endif
@@ -509,6 +521,14 @@ int QTextMarkdownImporter::cbText(int textType, const char *text, unsigned size)
case MD_BLOCK_TD:
m_nonEmptyTableCells.append(m_tableCol);
break;
+ case MD_BLOCK_CODE:
+ if (s == qtmi_Newline) {
+ // defer a blank line until we see something else in the code block,
+ // to avoid ending every code block with a gratuitous blank line
+ m_needsInsertBlock = true;
+ s = QString();
+ }
+ break;
default:
break;
}
@@ -519,35 +539,33 @@ int QTextMarkdownImporter::cbText(int textType, const char *text, unsigned size)
m_imageFormat.setProperty(QTextFormat::ImageAltText, s);
qCDebug(lcMD) << "image" << m_imageFormat.name()
<< "title" << m_imageFormat.stringProperty(QTextFormat::ImageTitle)
- << "alt" << s << "relative to" << m_doc->baseUrl();
- m_cursor->insertImage(m_imageFormat);
+ << "alt" << s << "relative to" << m_cursor.document()->baseUrl();
+ m_cursor.insertImage(m_imageFormat);
return 0; // no error
}
if (!s.isEmpty())
- m_cursor->insertText(s);
- if (m_cursor->currentList()) {
+ m_cursor.insertText(s);
+ if (m_cursor.currentList()) {
// The list item will indent the list item's text, so we don't need indentation on the block.
- QTextBlockFormat bfmt = m_cursor->blockFormat();
+ QTextBlockFormat bfmt = m_cursor.blockFormat();
bfmt.setIndent(0);
- m_cursor->setBlockFormat(bfmt);
+ m_cursor.setBlockFormat(bfmt);
}
if (lcMD().isEnabled(QtDebugMsg)) {
- QTextBlockFormat bfmt = m_cursor->blockFormat();
+ QTextBlockFormat bfmt = m_cursor.blockFormat();
QString debugInfo;
- if (m_cursor->currentList())
- debugInfo = QLatin1String("in list at depth ") + QString::number(m_cursor->currentList()->format().indent());
+ if (m_cursor.currentList())
+ debugInfo = "in list at depth "_L1 + QString::number(m_cursor.currentList()->format().indent());
if (bfmt.hasProperty(QTextFormat::BlockQuoteLevel))
- debugInfo += QLatin1String("in blockquote at depth ") +
+ debugInfo += "in blockquote at depth "_L1 +
QString::number(bfmt.intProperty(QTextFormat::BlockQuoteLevel));
if (bfmt.hasProperty(QTextFormat::BlockCodeLanguage))
- debugInfo += QLatin1String("in a code block");
+ debugInfo += "in a code block"_L1;
qCDebug(lcMD) << textType << "in block" << m_blockType << s << qPrintable(debugInfo)
<< "bindent" << bfmt.indent() << "tindent" << bfmt.textIndent()
<< "margins" << bfmt.leftMargin() << bfmt.topMargin() << bfmt.bottomMargin() << bfmt.rightMargin();
}
- qCDebug(lcMD) << textType << "in block" << m_blockType << s << "in list?" << m_cursor->currentList()
- << "indent" << m_cursor->blockFormat().indent();
return 0; // no error
}
@@ -555,7 +573,7 @@ int QTextMarkdownImporter::cbText(int textType, const char *text, unsigned size)
Insert a new block based on stored state.
m_cursor cannot store the state for the _next_ block ahead of time, because
- m_cursor->setBlockFormat() controls the format of the block that the cursor
+ m_cursor.setBlockFormat() controls the format of the block that the cursor
is already in; so cbLeaveBlock() cannot call setBlockFormat() without
altering the block that was just added. Therefore cbLeaveBlock() and the
following cbEnterBlock() set variables to remember what formatting should
@@ -570,17 +588,22 @@ void QTextMarkdownImporter::insertBlock()
QTextBlockFormat blockFormat;
if (!m_listStack.isEmpty() && !m_needsInsertList && m_listItem) {
QTextList *list = m_listStack.top();
- blockFormat = list->item(list->count() - 1).blockFormat();
+ if (list)
+ blockFormat = list->item(list->count() - 1).blockFormat();
+ else
+ qWarning() << "attempted to insert into a list that no longer exists";
}
if (m_blockQuoteDepth) {
blockFormat.setProperty(QTextFormat::BlockQuoteLevel, m_blockQuoteDepth);
- blockFormat.setLeftMargin(BlockQuoteIndent * m_blockQuoteDepth);
- blockFormat.setRightMargin(BlockQuoteIndent);
+ blockFormat.setLeftMargin(qtmi_BlockQuoteIndent * m_blockQuoteDepth);
+ blockFormat.setRightMargin(qtmi_BlockQuoteIndent);
}
if (m_codeBlock) {
blockFormat.setProperty(QTextFormat::BlockCodeLanguage, m_blockCodeLanguage);
- if (m_blockCodeFence)
+ if (m_blockCodeFence) {
+ blockFormat.setNonBreakableLines(true);
blockFormat.setProperty(QTextFormat::BlockCodeFence, QString(QLatin1Char(m_blockCodeFence)));
+ }
charFormat.setFont(m_monoFont);
} else {
blockFormat.setTopMargin(m_paragraphMargin);
@@ -591,12 +614,20 @@ void QTextMarkdownImporter::insertBlock()
else
blockFormat.setMarker(m_markerType);
if (!m_listStack.isEmpty())
- blockFormat.setIndent(m_listStack.count());
- m_cursor->insertBlock(blockFormat, charFormat);
+ blockFormat.setIndent(m_listStack.size());
+ if (m_cursor.document()->isEmpty()) {
+ m_cursor.setBlockFormat(blockFormat);
+ m_cursor.setCharFormat(charFormat);
+ } else if (m_listItem) {
+ m_cursor.insertBlock(blockFormat, QTextCharFormat());
+ m_cursor.setCharFormat(charFormat);
+ } else {
+ m_cursor.insertBlock(blockFormat, charFormat);
+ }
if (m_needsInsertList) {
- m_listStack.push(m_cursor->createList(m_listFormat));
- } else if (!m_listStack.isEmpty() && m_listItem) {
- m_listStack.top()->add(m_cursor->block());
+ m_listStack.push(m_cursor.createList(m_listFormat));
+ } else if (!m_listStack.isEmpty() && m_listItem && m_listStack.top()) {
+ m_listStack.top()->add(m_cursor.block());
}
m_needsInsertList = false;
m_needsInsertBlock = false;
diff --git a/src/gui/text/qtextmarkdownimporter_p.h b/src/gui/text/qtextmarkdownimporter_p.h
index f450da5eb3..8b8f4ec9bb 100644
--- a/src/gui/text/qtextmarkdownimporter_p.h
+++ b/src/gui/text/qtextmarkdownimporter_p.h
@@ -1,41 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2019 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the QtGui module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2019 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#ifndef QTEXTMARKDOWNIMPORTER_H
#define QTEXTMARKDOWNIMPORTER_H
@@ -56,7 +20,9 @@
#include <QtGui/qpalette.h>
#include <QtGui/qtextdocument.h>
#include <QtGui/qtextlist.h>
+#include <QtCore/qpointer.h>
#include <QtCore/qstack.h>
+#include <QtCore/private/qglobal_p.h>
QT_BEGIN_NAMESPACE
@@ -79,6 +45,8 @@ public:
FeatureStrikeThrough = 0x0200,
FeaturePermissiveWWWAutoLinks = 0x0400,
FeatureTasklists = 0x0800,
+ FeatureUnderline = 0x4000,
+ FeatureFrontMatter = 0x100000, // Qt feature, not yet in MD4C
// composite flags
FeaturePermissiveAutoLinks = FeaturePermissiveMailAutoLinks
| FeaturePermissiveURLAutoLinks | FeaturePermissiveWWWAutoLinks,
@@ -88,10 +56,10 @@ public:
};
Q_DECLARE_FLAGS(Features, Feature)
- QTextMarkdownImporter(Features features);
- QTextMarkdownImporter(QTextDocument::MarkdownFeatures features);
+ QTextMarkdownImporter(QTextDocument *doc, Features features);
+ QTextMarkdownImporter(QTextDocument *doc, QTextDocument::MarkdownFeatures features);
- void import(QTextDocument *doc, const QString &markdown);
+ void import(const QString &markdown);
public:
// MD4C callbacks
@@ -105,15 +73,14 @@ private:
void insertBlock();
private:
- QTextDocument *m_doc = nullptr;
- QTextCursor *m_cursor = nullptr;
+ QTextCursor m_cursor;
QTextTable *m_currentTable = nullptr; // because m_cursor->currentTable() doesn't work
#if QT_CONFIG(regularexpression)
QString m_htmlAccumulator;
#endif
QString m_blockCodeLanguage;
- QVector<int> m_nonEmptyTableCells; // in the current row
- QStack<QTextList *> m_listStack;
+ QList<int> m_nonEmptyTableCells; // in the current row
+ QStack<QPointer<QTextList>> m_listStack;
QStack<QTextCharFormat> m_spanFormatStack;
QFont m_monoFont;
QPalette m_palette;
diff --git a/src/gui/text/qtextmarkdownwriter.cpp b/src/gui/text/qtextmarkdownwriter.cpp
index c9a63920c3..361158e722 100644
--- a/src/gui/text/qtextmarkdownwriter.cpp
+++ b/src/gui/text/qtextmarkdownwriter.cpp
@@ -1,41 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2019 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the QtGui module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2019 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#include "qtextmarkdownwriter_p.h"
#include "qtextdocumentlayout_p.h"
@@ -46,21 +10,28 @@
#include "qtexttable.h"
#include "qtextcursor.h"
#include "qtextimagehandler_p.h"
+#include "qtextmarkdownimporter_p.h"
#include "qloggingcategory.h"
+#include <QtCore/QRegularExpression>
#if QT_CONFIG(itemmodel)
#include "qabstractitemmodel.h"
#endif
QT_BEGIN_NAMESPACE
+using namespace Qt::StringLiterals;
+
Q_LOGGING_CATEGORY(lcMDW, "qt.text.markdown.writer")
-static const QChar Space = QLatin1Char(' ');
-static const QChar Newline = QLatin1Char('\n');
-static const QChar LineBreak = QChar(0x2028);
-static const QChar DoubleQuote = QLatin1Char('"');
-static const QChar Backtick = QLatin1Char('`');
-static const QChar Period = QLatin1Char('.');
+static const QChar qtmw_Space = u' ';
+static const QChar qtmw_Tab = u'\t';
+static const QChar qtmw_Newline = u'\n';
+static const QChar qtmw_CarriageReturn = u'\r';
+static const QChar qtmw_LineBreak = u'\x2028';
+static const QChar qtmw_DoubleQuote = u'"';
+static const QChar qtmw_Backtick = u'`';
+static const QChar qtmw_Backslash = u'\\';
+static const QChar qtmw_Period = u'.';
QTextMarkdownWriter::QTextMarkdownWriter(QTextStream &stream, QTextDocument::MarkdownFeatures features)
: m_stream(stream), m_features(features)
@@ -69,6 +40,7 @@ QTextMarkdownWriter::QTextMarkdownWriter(QTextStream &stream, QTextDocument::Mar
bool QTextMarkdownWriter::writeAll(const QTextDocument *document)
{
+ writeFrontMatter(document->metaInformation(QTextDocument::FrontMatter));
writeFrame(document->rootFrame());
return true;
}
@@ -76,30 +48,30 @@ bool QTextMarkdownWriter::writeAll(const QTextDocument *document)
#if QT_CONFIG(itemmodel)
void QTextMarkdownWriter::writeTable(const QAbstractItemModel *table)
{
- QVector<int> tableColumnWidths(table->columnCount());
+ QList<int> tableColumnWidths(table->columnCount());
for (int col = 0; col < table->columnCount(); ++col) {
- tableColumnWidths[col] = table->headerData(col, Qt::Horizontal).toString().length();
+ tableColumnWidths[col] = table->headerData(col, Qt::Horizontal).toString().size();
for (int row = 0; row < table->rowCount(); ++row) {
tableColumnWidths[col] = qMax(tableColumnWidths[col],
- table->data(table->index(row, col)).toString().length());
+ table->data(table->index(row, col)).toString().size());
}
}
// write the header and separator
for (int col = 0; col < table->columnCount(); ++col) {
QString s = table->headerData(col, Qt::Horizontal).toString();
- m_stream << "|" << s << QString(tableColumnWidths[col] - s.length(), Space);
+ m_stream << '|' << s << QString(tableColumnWidths[col] - s.size(), qtmw_Space);
}
m_stream << "|" << Qt::endl;
- for (int col = 0; col < tableColumnWidths.length(); ++col)
- m_stream << '|' << QString(tableColumnWidths[col], QLatin1Char('-'));
+ for (int col = 0; col < tableColumnWidths.size(); ++col)
+ m_stream << '|' << QString(tableColumnWidths[col], u'-');
m_stream << '|'<< Qt::endl;
// write the body
for (int row = 0; row < table->rowCount(); ++row) {
for (int col = 0; col < table->columnCount(); ++col) {
QString s = table->data(table->index(row, col)).toString();
- m_stream << "|" << s << QString(tableColumnWidths[col] - s.length(), Space);
+ m_stream << '|' << s << QString(tableColumnWidths[col] - s.size(), qtmw_Space);
}
m_stream << '|'<< Qt::endl;
}
@@ -107,6 +79,19 @@ void QTextMarkdownWriter::writeTable(const QAbstractItemModel *table)
}
#endif
+void QTextMarkdownWriter::writeFrontMatter(const QString &fm)
+{
+ const bool featureEnabled = m_features.testFlag(
+ static_cast<QTextDocument::MarkdownFeature>(QTextMarkdownImporter::FeatureFrontMatter));
+ qCDebug(lcMDW) << "writing FrontMatter?" << featureEnabled << "size" << fm.size();
+ if (fm.isEmpty() || !featureEnabled)
+ return;
+ m_stream << "---\n"_L1 << fm;
+ if (!fm.endsWith(qtmw_Newline))
+ m_stream << qtmw_Newline;
+ m_stream << "---\n"_L1;
+}
+
void QTextMarkdownWriter::writeFrame(const QTextFrame *frame)
{
Q_ASSERT(frame);
@@ -115,7 +100,7 @@ void QTextMarkdownWriter::writeFrame(const QTextFrame *frame)
QTextFrame *child = nullptr;
int tableRow = -1;
bool lastWasList = false;
- QVector<int> tableColumnWidths;
+ QList<int> tableColumnWidths;
if (table) {
tableColumnWidths.resize(table->columns());
for (int col = 0; col < table->columns(); ++col) {
@@ -126,7 +111,7 @@ void QTextMarkdownWriter::writeFrame(const QTextFrame *frame)
while (it != cell.end()) {
QTextBlock block = it.currentBlock();
if (block.isValid())
- cellTextLen += block.text().length();
+ cellTextLen += block.text().size();
++it;
}
if (cell.columnSpan() == 1 && tableColumnWidths[col] < cellTextLen)
@@ -143,17 +128,22 @@ void QTextMarkdownWriter::writeFrame(const QTextFrame *frame)
// suppress needless blank lines, when there will be a big change in block format
bool nextIsDifferent = false;
bool ending = false;
+ int blockQuoteIndent = 0;
+ int nextBlockQuoteIndent = 0;
{
QTextFrame::iterator next = iterator;
++next;
+ QTextBlockFormat format = iterator.currentBlock().blockFormat();
+ QTextBlockFormat nextFormat = next.currentBlock().blockFormat();
+ blockQuoteIndent = format.intProperty(QTextFormat::BlockQuoteLevel);
+ nextBlockQuoteIndent = nextFormat.intProperty(QTextFormat::BlockQuoteLevel);
if (next.atEnd()) {
nextIsDifferent = true;
ending = true;
} else {
- QTextBlockFormat format = iterator.currentBlock().blockFormat();
- QTextBlockFormat nextFormat = next.currentBlock().blockFormat();
if (nextFormat.indent() != format.indent() ||
- nextFormat.property(QTextFormat::BlockCodeLanguage) != format.property(QTextFormat::BlockCodeLanguage))
+ nextFormat.property(QTextFormat::BlockCodeLanguage) !=
+ format.property(QTextFormat::BlockCodeLanguage))
nextIsDifferent = true;
}
}
@@ -161,17 +151,19 @@ void QTextMarkdownWriter::writeFrame(const QTextFrame *frame)
QTextTableCell cell = table->cellAt(block.position());
if (tableRow < cell.row()) {
if (tableRow == 0) {
- m_stream << Newline;
- for (int col = 0; col < tableColumnWidths.length(); ++col)
- m_stream << '|' << QString(tableColumnWidths[col], QLatin1Char('-'));
+ m_stream << qtmw_Newline;
+ for (int col = 0; col < tableColumnWidths.size(); ++col)
+ m_stream << '|' << QString(tableColumnWidths[col], u'-');
m_stream << '|';
}
- m_stream << Newline << "|";
+ m_stream << qtmw_Newline << '|';
tableRow = cell.row();
}
} else if (!block.textList()) {
- if (lastWasList)
- m_stream << Newline;
+ if (lastWasList) {
+ m_stream << qtmw_Newline;
+ m_linePrefixWritten = false;
+ }
}
int endingCol = writeBlock(block, !table, table && tableRow == 0,
nextIsDifferent && !block.textList());
@@ -183,20 +175,28 @@ void QTextMarkdownWriter::writeFrame(const QTextFrame *frame)
for (int col = cell.column(); col < spanEndCol; ++col)
paddingLen += tableColumnWidths[col];
if (paddingLen > 0)
- m_stream << QString(paddingLen, Space);
+ m_stream << QString(paddingLen, qtmw_Space);
for (int col = cell.column(); col < spanEndCol; ++col)
m_stream << "|";
} else if (m_fencedCodeBlock && ending) {
- m_stream << m_linePrefix << QString(m_wrappedLineIndent, Space)
- << m_codeBlockFence << Newline << Newline;
+ m_stream << qtmw_Newline << m_linePrefix << QString(m_wrappedLineIndent, qtmw_Space)
+ << m_codeBlockFence << qtmw_Newline << qtmw_Newline;
m_codeBlockFence.clear();
} else if (m_indentedCodeBlock && nextIsDifferent) {
- m_stream << Newline;
+ m_stream << qtmw_Newline << qtmw_Newline;
} else if (endingCol > 0) {
if (block.textList() || block.blockFormat().hasProperty(QTextFormat::BlockCodeLanguage)) {
- m_stream << Newline;
+ m_stream << qtmw_Newline;
+ if (block.textList()) {
+ m_stream << m_linePrefix;
+ m_linePrefixWritten = true;
+ }
} else {
- m_stream << Newline << Newline;
+ m_stream << qtmw_Newline;
+ if (nextBlockQuoteIndent < blockQuoteIndent)
+ setLinePrefixForBlockQuote(nextBlockQuoteIndent);
+ m_stream << m_linePrefix;
+ m_stream << qtmw_Newline;
m_doubleNewlineWritten = true;
}
}
@@ -206,7 +206,7 @@ void QTextMarkdownWriter::writeFrame(const QTextFrame *frame)
++iterator;
}
if (table) {
- m_stream << Newline << Newline;
+ m_stream << qtmw_Newline << qtmw_Newline;
m_doubleNewlineWritten = true;
}
m_listInfo.clear();
@@ -242,18 +242,28 @@ QTextMarkdownWriter::ListInfo QTextMarkdownWriter::listInfo(QTextList *list)
return m_listInfo.value(list);
}
+void QTextMarkdownWriter::setLinePrefixForBlockQuote(int level)
+{
+ m_linePrefix.clear();
+ if (level > 0) {
+ m_linePrefix.reserve(level * 2);
+ for (int i = 0; i < level; ++i)
+ m_linePrefix += u"> ";
+ }
+}
+
static int nearestWordWrapIndex(const QString &s, int before)
{
- before = qMin(before, s.length());
+ before = qMin(before, s.size());
int fragBegin = qMax(before - 15, 0);
if (lcMDW().isDebugEnabled()) {
QString frag = s.mid(fragBegin, 30);
qCDebug(lcMDW) << frag << before;
- qCDebug(lcMDW) << QString(before - fragBegin, Period) + QLatin1Char('<');
+ qCDebug(lcMDW) << QString(before - fragBegin, qtmw_Period) + u'<';
}
for (int i = before - 1; i >= 0; --i) {
if (s.at(i).isSpace()) {
- qCDebug(lcMDW) << QString(i - fragBegin, Period) + QLatin1Char('^') << i;
+ qCDebug(lcMDW) << QString(i - fragBegin, qtmw_Period) + u'^' << i;
return i;
}
}
@@ -263,10 +273,10 @@ static int nearestWordWrapIndex(const QString &s, int before)
static int adjacentBackticksCount(const QString &s)
{
- int start = -1, len = s.length();
+ int start = -1, len = s.size();
int ret = 0;
for (int i = 0; i < len; ++i) {
- if (s.at(i) == Backtick) {
+ if (s.at(i) == qtmw_Backtick) {
if (start < 0)
start = i;
} else if (start >= 0) {
@@ -274,23 +284,127 @@ static int adjacentBackticksCount(const QString &s)
start = -1;
}
}
- if (s.at(len - 1) == Backtick)
+ if (s.at(len - 1) == qtmw_Backtick)
ret = qMax(ret, len - start);
return ret;
}
+/*! \internal
+ Escape anything at the beginning of a line of markdown that would be
+ misinterpreted by a markdown parser, including any period that follows a
+ number (to avoid misinterpretation as a numbered list item).
+ https://spec.commonmark.org/0.31.2/#backslash-escapes
+*/
static void maybeEscapeFirstChar(QString &s)
{
+ static const QRegularExpression numericListRe(uR"(\d+([\.)])\s)"_s);
+ static const QLatin1StringView specialFirstCharacters("#*+-");
+
QString sTrimmed = s.trimmed();
if (sTrimmed.isEmpty())
return;
- char firstChar = sTrimmed.at(0).toLatin1();
- if (firstChar == '*' || firstChar == '+' || firstChar == '-') {
- int i = s.indexOf(QLatin1Char(firstChar));
- s.insert(i, QLatin1Char('\\'));
+ QChar firstChar = sTrimmed.at(0);
+ if (specialFirstCharacters.contains(firstChar)) {
+ int i = s.indexOf(firstChar); // == 0 unless s got trimmed
+ s.insert(i, u'\\');
+ } else {
+ auto match = numericListRe.match(s, 0, QRegularExpression::NormalMatch,
+ QRegularExpression::AnchorAtOffsetMatchOption);
+ if (match.hasMatch())
+ s.insert(match.capturedStart(1), qtmw_Backslash);
+ }
+}
+
+/*! \internal
+ Escape all backslashes. Then escape any special character that stands
+ alone or prefixes a "word", including the \c < that starts an HTML tag.
+ https://spec.commonmark.org/0.31.2/#backslash-escapes
+*/
+static void escapeSpecialCharacters(QString &s)
+{
+ static const QRegularExpression spaceRe(uR"(\s+)"_s);
+ static const QRegularExpression specialRe(uR"([<!*[`&]+[/\w])"_s);
+
+ s.replace("\\"_L1, "\\\\"_L1);
+
+ int i = 0;
+ while (i >= 0) {
+ if (int j = s.indexOf(specialRe, i); j >= 0) {
+ s.insert(j, qtmw_Backslash);
+ i = j + 3;
+ }
+ i = s.indexOf(spaceRe, i);
+ if (i >= 0)
+ ++i; // past the whitespace, if found
}
}
+struct LineEndPositions {
+ const QChar *lineEnd;
+ const QChar *nextLineBegin;
+};
+
+static LineEndPositions findLineEnd(const QChar *begin, const QChar *end)
+{
+ LineEndPositions result{ end, end };
+
+ while (begin < end) {
+ if (*begin == qtmw_Newline) {
+ result.lineEnd = begin;
+ result.nextLineBegin = begin + 1;
+ break;
+ } else if (*begin == qtmw_CarriageReturn) {
+ result.lineEnd = begin;
+ result.nextLineBegin = begin + 1;
+ if (((begin + 1) < end) && begin[1] == qtmw_Newline)
+ ++result.nextLineBegin;
+ break;
+ }
+
+ ++begin;
+ }
+
+ return result;
+}
+
+static bool isBlankLine(const QChar *begin, const QChar *end)
+{
+ while (begin < end) {
+ if (*begin != qtmw_Space && *begin != qtmw_Tab)
+ return false;
+ ++begin;
+ }
+ return true;
+}
+
+static QString createLinkTitle(const QString &title)
+{
+ QString result;
+ result.reserve(title.size() + 2);
+ result += qtmw_DoubleQuote;
+
+ const QChar *data = title.data();
+ const QChar *end = data + title.size();
+
+ while (data < end) {
+ const auto lineEndPositions = findLineEnd(data, end);
+
+ if (!isBlankLine(data, lineEndPositions.lineEnd)) {
+ while (data < lineEndPositions.nextLineBegin) {
+ if (*data == qtmw_DoubleQuote)
+ result += qtmw_Backslash;
+ result += *data;
+ ++data;
+ }
+ }
+
+ data = lineEndPositions.nextLineBegin;
+ }
+
+ result += qtmw_DoubleQuote;
+ return result;
+}
+
int QTextMarkdownWriter::writeBlock(const QTextBlock &block, bool wrap, bool ignoreFormat, bool ignoreEmpty)
{
if (block.text().isEmpty() && ignoreEmpty)
@@ -298,10 +412,30 @@ int QTextMarkdownWriter::writeBlock(const QTextBlock &block, bool wrap, bool ign
const int ColumnLimit = 80;
QTextBlockFormat blockFmt = block.blockFormat();
bool missedBlankCodeBlockLine = false;
+ const bool codeBlock = blockFmt.hasProperty(QTextFormat::BlockCodeFence) ||
+ blockFmt.stringProperty(QTextFormat::BlockCodeLanguage).size() > 0 ||
+ blockFmt.nonBreakableLines();
+ const int blockQuoteLevel = blockFmt.intProperty(QTextFormat::BlockQuoteLevel);
+ if (m_fencedCodeBlock && !codeBlock) {
+ m_stream << m_linePrefix << m_codeBlockFence << qtmw_Newline;
+ m_fencedCodeBlock = false;
+ m_codeBlockFence.clear();
+ m_linePrefixWritten = m_linePrefix.size() > 0;
+ }
+ m_linePrefix.clear();
+ if (!blockFmt.headingLevel() && blockQuoteLevel > 0) {
+ setLinePrefixForBlockQuote(blockQuoteLevel);
+ if (!m_linePrefixWritten) {
+ m_stream << m_linePrefix;
+ m_linePrefixWritten = true;
+ }
+ }
if (block.textList()) { // it's a list-item
auto fmt = block.textList()->format();
const int listLevel = fmt.indent();
- const int number = block.textList()->itemNumber(block) + 1;
+ // Negative numbers don't start a list in Markdown, so ignore them.
+ const int start = fmt.start() >= 0 ? fmt.start() : 1;
+ const int number = block.textList()->itemNumber(block) + start;
QByteArray bullet = " ";
bool numeric = false;
switch (fmt.style()) {
@@ -340,25 +474,25 @@ int QTextMarkdownWriter::writeBlock(const QTextBlock &block, bool wrap, bool ign
int indentFirstLine = (listLevel - 1) * (numeric ? 4 : 2);
m_wrappedLineIndent += indentFirstLine;
if (m_lastListIndent != listLevel && !m_doubleNewlineWritten && listInfo(block.textList()).loose)
- m_stream << Newline;
+ m_stream << qtmw_Newline;
m_lastListIndent = listLevel;
- QString prefix(indentFirstLine, Space);
+ QString prefix(indentFirstLine, qtmw_Space);
if (numeric) {
QString suffix = fmt.numberSuffix();
if (suffix.isEmpty())
- suffix = QString(Period);
- QString numberStr = QString::number(number) + suffix + Space;
- if (numberStr.length() == 3)
- numberStr += Space;
+ suffix = QString(qtmw_Period);
+ QString numberStr = QString::number(number) + suffix + qtmw_Space;
+ if (numberStr.size() == 3)
+ numberStr += qtmw_Space;
prefix += numberStr;
} else {
- prefix += QLatin1String(bullet) + Space;
+ prefix += QLatin1StringView(bullet) + qtmw_Space;
}
m_stream << prefix;
} else if (blockFmt.hasProperty(QTextFormat::BlockTrailingHorizontalRulerWidth)) {
m_stream << "- - -\n"; // unambiguous horizontal rule, not an underline under a heading
return 0;
- } else if (blockFmt.hasProperty(QTextFormat::BlockCodeFence) || blockFmt.stringProperty(QTextFormat::BlockCodeLanguage).length() > 0) {
+ } else if (codeBlock) {
// It's important to preserve blank lines in code blocks. But blank lines in code blocks
// inside block quotes are getting preserved anyway (along with the "> " prefix).
if (!blockFmt.hasProperty(QTextFormat::BlockQuoteLevel))
@@ -366,136 +500,159 @@ int QTextMarkdownWriter::writeBlock(const QTextBlock &block, bool wrap, bool ign
if (!m_fencedCodeBlock) {
QString fenceChar = blockFmt.stringProperty(QTextFormat::BlockCodeFence);
if (fenceChar.isEmpty())
- fenceChar = QLatin1String("`");
+ fenceChar = "`"_L1;
m_codeBlockFence = QString(3, fenceChar.at(0));
+ if (blockFmt.hasProperty(QTextFormat::BlockIndent))
+ m_codeBlockFence = QString(m_wrappedLineIndent, qtmw_Space) + m_codeBlockFence;
// A block quote can contain an indented code block, but not vice-versa.
- m_stream << m_linePrefix << QString(m_wrappedLineIndent, Space) << m_codeBlockFence
- << Space << blockFmt.stringProperty(QTextFormat::BlockCodeLanguage) << Newline;
+ m_stream << m_codeBlockFence << blockFmt.stringProperty(QTextFormat::BlockCodeLanguage)
+ << qtmw_Newline << m_linePrefix;
m_fencedCodeBlock = true;
}
+ wrap = false;
} else if (!blockFmt.indent()) {
- if (m_fencedCodeBlock) {
- m_stream << m_linePrefix << QString(m_wrappedLineIndent, Space)
- << m_codeBlockFence << Newline;
- m_fencedCodeBlock = false;
- m_codeBlockFence.clear();
- }
m_wrappedLineIndent = 0;
- m_linePrefix.clear();
- if (blockFmt.hasProperty(QTextFormat::BlockQuoteLevel)) {
- int level = blockFmt.intProperty(QTextFormat::BlockQuoteLevel);
- QString quoteMarker = QStringLiteral("> ");
- m_linePrefix.reserve(level * 2);
- for (int i = 0; i < level; ++i)
- m_linePrefix += quoteMarker;
- }
if (blockFmt.hasProperty(QTextFormat::BlockCodeLanguage)) {
// A block quote can contain an indented code block, but not vice-versa.
- m_linePrefix += QString(4, Space);
+ m_linePrefix += QString(4, qtmw_Space);
m_indentedCodeBlock = true;
}
+ if (!m_linePrefixWritten) {
+ m_stream << m_linePrefix;
+ m_linePrefixWritten = true;
+ }
}
- if (blockFmt.headingLevel())
+ if (blockFmt.headingLevel()) {
m_stream << QByteArray(blockFmt.headingLevel(), '#') << ' ';
- else
- m_stream << m_linePrefix;
+ wrap = false;
+ }
- QString wrapIndentString = m_linePrefix + QString(m_wrappedLineIndent, Space);
+ QString wrapIndentString = m_linePrefix + QString(m_wrappedLineIndent, qtmw_Space);
// It would be convenient if QTextStream had a lineCharPos() accessor,
// to keep track of how many characters (not bytes) have been written on the current line,
// but it doesn't. So we have to keep track with this col variable.
- int col = wrapIndentString.length();
+ int col = wrapIndentString.size();
bool mono = false;
bool startsOrEndsWithBacktick = false;
bool bold = false;
bool italic = false;
bool underline = false;
bool strikeOut = false;
- QString backticks(Backtick);
+ bool endingMarkers = false;
+ QString backticks(qtmw_Backtick);
for (QTextBlock::Iterator frag = block.begin(); !frag.atEnd(); ++frag) {
missedBlankCodeBlockLine = false;
QString fragmentText = frag.fragment().text();
- while (fragmentText.endsWith(Newline))
+ while (fragmentText.endsWith(qtmw_Newline))
fragmentText.chop(1);
+ if (!(m_fencedCodeBlock || m_indentedCodeBlock)) {
+ escapeSpecialCharacters(fragmentText);
+ maybeEscapeFirstChar(fragmentText);
+ }
if (block.textList()) { // <li>first line</br>continuation</li>
- QString newlineIndent = QString(Newline) + QString(m_wrappedLineIndent, Space);
- fragmentText.replace(QString(LineBreak), newlineIndent);
+ QString newlineIndent =
+ QString(qtmw_Newline) + QString(m_wrappedLineIndent, qtmw_Space);
+ fragmentText.replace(QString(qtmw_LineBreak), newlineIndent);
} else if (blockFmt.indent() > 0) { // <li>first line<p>continuation</p></li>
- m_stream << QString(m_wrappedLineIndent, Space);
+ m_stream << QString(m_wrappedLineIndent, qtmw_Space);
} else {
- fragmentText.replace(LineBreak, Newline);
+ fragmentText.replace(qtmw_LineBreak, qtmw_Newline);
}
- startsOrEndsWithBacktick |= fragmentText.startsWith(Backtick) || fragmentText.endsWith(Backtick);
+ startsOrEndsWithBacktick |=
+ fragmentText.startsWith(qtmw_Backtick) || fragmentText.endsWith(qtmw_Backtick);
QTextCharFormat fmt = frag.fragment().charFormat();
if (fmt.isImageFormat()) {
QTextImageFormat ifmt = fmt.toImageFormat();
QString desc = ifmt.stringProperty(QTextFormat::ImageAltText);
if (desc.isEmpty())
- desc = QLatin1String("image");
- QString s = QLatin1String("![") + desc + QLatin1String("](") + ifmt.name();
+ desc = "image"_L1;
+ QString s = "!["_L1 + desc + "]("_L1 + ifmt.name();
QString title = ifmt.stringProperty(QTextFormat::ImageTitle);
if (!title.isEmpty())
- s += Space + DoubleQuote + title + DoubleQuote;
- s += QLatin1Char(')');
- if (wrap && col + s.length() > ColumnLimit) {
- m_stream << Newline << wrapIndentString;
+ s += qtmw_Space + qtmw_DoubleQuote + title + qtmw_DoubleQuote;
+ s += u')';
+ if (wrap && col + s.size() > ColumnLimit) {
+ m_stream << qtmw_Newline << wrapIndentString;
col = m_wrappedLineIndent;
}
m_stream << s;
- col += s.length();
+ col += s.size();
} else if (fmt.hasProperty(QTextFormat::AnchorHref)) {
- QString s = QLatin1Char('[') + fragmentText + QLatin1String("](") +
- fmt.property(QTextFormat::AnchorHref).toString() + QLatin1Char(')');
- if (wrap && col + s.length() > ColumnLimit) {
- m_stream << Newline << wrapIndentString;
+ const auto href = fmt.property(QTextFormat::AnchorHref).toString();
+ const bool hasToolTip = fmt.hasProperty(QTextFormat::TextToolTip);
+ QString s;
+ if (!hasToolTip && href == fragmentText && !QUrl(href, QUrl::StrictMode).scheme().isEmpty()) {
+ s = u'<' + href + u'>';
+ } else {
+ s = u'[' + fragmentText + "]("_L1 + href;
+ if (hasToolTip) {
+ s += qtmw_Space;
+ s += createLinkTitle(fmt.property(QTextFormat::TextToolTip).toString());
+ }
+ s += u')';
+ }
+ if (wrap && col + s.size() > ColumnLimit) {
+ m_stream << qtmw_Newline << wrapIndentString;
col = m_wrappedLineIndent;
}
m_stream << s;
- col += s.length();
+ col += s.size();
} else {
QFontInfo fontInfo(fmt.font());
- bool monoFrag = fontInfo.fixedPitch();
+ bool monoFrag = fontInfo.fixedPitch() || fmt.fontFixedPitch();
QString markers;
if (!ignoreFormat) {
if (monoFrag != mono && !m_indentedCodeBlock && !m_fencedCodeBlock) {
if (monoFrag)
- backticks = QString(adjacentBackticksCount(fragmentText) + 1, Backtick);
+ backticks =
+ QString(adjacentBackticksCount(fragmentText) + 1, qtmw_Backtick);
markers += backticks;
if (startsOrEndsWithBacktick)
- markers += Space;
+ markers += qtmw_Space;
mono = monoFrag;
+ if (!mono)
+ endingMarkers = true;
}
if (!blockFmt.headingLevel() && !mono) {
if (fontInfo.bold() != bold) {
- markers += QLatin1String("**");
+ markers += "**"_L1;
bold = fontInfo.bold();
+ if (!bold)
+ endingMarkers = true;
}
if (fontInfo.italic() != italic) {
- markers += QLatin1Char('*');
+ markers += u'*';
italic = fontInfo.italic();
+ if (!italic)
+ endingMarkers = true;
}
if (fontInfo.strikeOut() != strikeOut) {
- markers += QLatin1String("~~");
+ markers += "~~"_L1;
strikeOut = fontInfo.strikeOut();
+ if (!strikeOut)
+ endingMarkers = true;
}
if (fontInfo.underline() != underline) {
- // Markdown doesn't support underline, but the parser will treat a single underline
- // the same as a single asterisk, and the marked fragment will be rendered in italics.
- // That will have to do.
- markers += QLatin1Char('_');
+ // CommonMark specifies underline as another way to get emphasis (italics):
+ // https://spec.commonmark.org/0.31.2/#example-148
+ // but md4c allows us to distinguish them; so we support underlining (in GitHub dialect).
+ markers += u'_';
underline = fontInfo.underline();
+ if (!underline)
+ endingMarkers = true;
}
}
}
- if (wrap && col + markers.length() * 2 + fragmentText.length() > ColumnLimit) {
+ if (wrap && col + markers.size() * 2 + fragmentText.size() > ColumnLimit) {
int i = 0;
- int fragLen = fragmentText.length();
+ const int fragLen = fragmentText.size();
bool breakingLine = false;
while (i < fragLen) {
if (col >= ColumnLimit) {
- m_stream << Newline << wrapIndentString;
+ m_stream << markers << qtmw_Newline << wrapIndentString;
+ markers.clear();
col = m_wrappedLineIndent;
- while (fragmentText[i].isSpace())
+ while (i < fragLen && fragmentText[i].isSpace())
++i;
}
int j = i + ColumnLimit - col;
@@ -503,6 +660,13 @@ int QTextMarkdownWriter::writeBlock(const QTextBlock &block, bool wrap, bool ign
int wi = nearestWordWrapIndex(fragmentText, j);
if (wi < 0) {
j = fragLen;
+ // can't break within the fragment: we need to break already _before_ it
+ if (endingMarkers) {
+ m_stream << markers;
+ markers.clear();
+ }
+ m_stream << qtmw_Newline << wrapIndentString;
+ col = m_wrappedLineIndent;
} else if (wi >= i) {
j = wi;
breakingLine = true;
@@ -514,28 +678,32 @@ int QTextMarkdownWriter::writeBlock(const QTextBlock &block, bool wrap, bool ign
QString subfrag = fragmentText.mid(i, j - i);
if (!i) {
m_stream << markers;
- col += markers.length();
+ col += markers.size();
}
if (col == m_wrappedLineIndent)
maybeEscapeFirstChar(subfrag);
m_stream << subfrag;
if (breakingLine) {
- m_stream << Newline << wrapIndentString;
+ m_stream << qtmw_Newline << wrapIndentString;
col = m_wrappedLineIndent;
} else {
- col += subfrag.length();
+ col += subfrag.size();
}
i = j + 1;
- }
+ } // loop over fragment characters (we know we need to break somewhere)
} else {
+ if (!m_linePrefixWritten && col == wrapIndentString.size()) {
+ m_stream << m_linePrefix;
+ col += m_linePrefix.size();
+ }
m_stream << markers << fragmentText;
- col += markers.length() + fragmentText.length();
+ col += markers.size() + fragmentText.size();
}
}
}
if (mono) {
if (startsOrEndsWithBacktick) {
- m_stream << Space;
+ m_stream << qtmw_Space;
col += 1;
}
m_stream << backticks;
@@ -558,7 +726,8 @@ int QTextMarkdownWriter::writeBlock(const QTextBlock &block, bool wrap, bool ign
col += 2;
}
if (missedBlankCodeBlockLine)
- m_stream << Newline;
+ m_stream << qtmw_Newline;
+ m_linePrefixWritten = false;
return col;
}
diff --git a/src/gui/text/qtextmarkdownwriter_p.h b/src/gui/text/qtextmarkdownwriter_p.h
index c3076155d0..c0989b8f72 100644
--- a/src/gui/text/qtextmarkdownwriter_p.h
+++ b/src/gui/text/qtextmarkdownwriter_p.h
@@ -1,41 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2019 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the QtGui module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2019 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#ifndef QTEXTMARKDOWNWRITER_P_H
#define QTEXTMARKDOWNWRITER_P_H
@@ -72,6 +36,7 @@ public:
int writeBlock(const QTextBlock &block, bool table, bool ignoreFormat, bool ignoreEmpty);
void writeFrame(const QTextFrame *frame);
+ void writeFrontMatter(const QString &fm);
private:
struct ListInfo {
@@ -79,6 +44,7 @@ private:
};
ListInfo listInfo(QTextList *list);
+ void setLinePrefixForBlockQuote(int level);
private:
QTextStream &m_stream;
@@ -89,6 +55,7 @@ private:
int m_wrappedLineIndent = 0;
int m_lastListIndent = 1;
bool m_doubleNewlineWritten = false;
+ bool m_linePrefixWritten = false;
bool m_indentedCodeBlock = false;
bool m_fencedCodeBlock = false;
};
diff --git a/src/gui/text/qtextobject.cpp b/src/gui/text/qtextobject.cpp
index 77dcae0dc8..6aafdc1a25 100644
--- a/src/gui/text/qtextobject.cpp
+++ b/src/gui/text/qtextobject.cpp
@@ -1,41 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the QtGui module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#include "qtextobject.h"
#include "qtextobject_p.h"
@@ -78,7 +42,7 @@ QT_BEGIN_NAMESPACE
objects, you will also need to reimplement QTextDocument::createObject()
which acts as a factory method for creating text objects.
- \sa QTextDocument, {Text Object Example}
+ \sa QTextDocument
*/
/*!
@@ -171,14 +135,6 @@ QTextDocument *QTextObject::document() const
}
/*!
- \internal
-*/
-QTextDocumentPrivate *QTextObject::docHandle() const
-{
- return static_cast<const QTextDocument *>(parent())->docHandle();
-}
-
-/*!
\class QTextBlockGroup
\reentrant
@@ -209,7 +165,7 @@ QTextDocumentPrivate *QTextObject::docHandle() const
void QTextBlockGroupPrivate::markBlocksDirty()
{
- for (int i = 0; i < blocks.count(); ++i) {
+ for (int i = 0; i < blocks.size(); ++i) {
const QTextBlock &block = blocks.at(i);
pieceTable->documentChange(block.position(), block.length());
}
@@ -218,7 +174,7 @@ void QTextBlockGroupPrivate::markBlocksDirty()
/*!
\fn QTextBlockGroup::QTextBlockGroup(QTextDocument *document)
- Creates a new new block group for the given \a document.
+ Creates a new block group for the given \a document.
\warning This function should only be called from
QTextDocument::createObject().
@@ -270,7 +226,7 @@ void QTextBlockGroup::blockRemoved(const QTextBlock &block)
d->blocks.removeAll(block);
d->markBlocksDirty();
if (d->blocks.isEmpty()) {
- document()->docHandle()->deleteObject(this);
+ QTextDocumentPrivate::get(document())->deleteObject(this);
return;
}
}
@@ -367,28 +323,28 @@ QTextFrameLayoutData::~QTextFrameLayoutData()
/*!
\fn bool QTextFrame::iterator::operator==(const iterator &other) const
- Retuns true if the iterator is the same as the \a other iterator;
+ Returns true if the iterator is the same as the \a other iterator;
otherwise returns \c false.
*/
/*!
\fn bool QTextFrame::iterator::operator!=(const iterator &other) const
- Retuns true if the iterator is different from the \a other iterator;
+ Returns true if the iterator is different from the \a other iterator;
otherwise returns \c false.
*/
/*!
\fn QTextFrame::iterator QTextFrame::iterator::operator++(int)
- The postfix ++ operator (\c{i++}) advances the iterator to the
+ The postfix \c{++} operator (\c{i++}) advances the iterator to the
next item in the text frame, and returns an iterator to the old item.
*/
/*!
\fn QTextFrame::iterator QTextFrame::iterator::operator--(int)
- The postfix -- operator (\c{i--}) makes the preceding item in the
+ The postfix \c{--} operator (\c{i--}) makes the preceding item in the
current frame, and returns an iterator to the old item.
*/
@@ -576,7 +532,7 @@ void QTextFramePrivate::remove_me()
Q_Q(QTextFrame);
if (fragment_start == 0 && fragment_end == 0
&& !parentFrame) {
- q->document()->docHandle()->deleteObject(q);
+ QTextDocumentPrivate::get(q->document())->deleteObject(q);
return;
}
@@ -630,7 +586,7 @@ void QTextFramePrivate::remove_me()
*/
QTextFrame::iterator QTextFrame::begin() const
{
- const QTextDocumentPrivate *priv = docHandle();
+ const QTextDocumentPrivate *priv = QTextDocumentPrivate::get(this);
int b = priv->blockMap().findNode(firstPosition());
int e = priv->blockMap().findNode(lastPosition()+1);
return iterator(const_cast<QTextFrame *>(this), b, b, e);
@@ -643,76 +599,25 @@ QTextFrame::iterator QTextFrame::begin() const
*/
QTextFrame::iterator QTextFrame::end() const
{
- const QTextDocumentPrivate *priv = docHandle();
+ const QTextDocumentPrivate *priv = QTextDocumentPrivate::get(this);
int b = priv->blockMap().findNode(firstPosition());
int e = priv->blockMap().findNode(lastPosition()+1);
return iterator(const_cast<QTextFrame *>(this), e, b, e);
}
/*!
- Constructs an invalid iterator.
-*/
-QTextFrame::iterator::iterator()
-{
- f = nullptr;
- b = 0;
- e = 0;
- cf = nullptr;
- cb = 0;
-}
+ \fn QTextFrame::iterator::iterator()
-/*!
- \internal
-*/
-QTextFrame::iterator::iterator(QTextFrame *frame, int block, int begin, int end)
-{
- f = frame;
- b = begin;
- e = end;
- cf = nullptr;
- cb = block;
-}
-
-#if QT_VERSION < QT_VERSION_CHECK(6,0,0)
-
-/*!
- Copy constructor. Constructs a copy of the \a other iterator.
-*/
-QTextFrame::iterator::iterator(const iterator &other) noexcept
-{
- f = other.f;
- b = other.b;
- e = other.e;
- cf = other.cf;
- cb = other.cb;
-}
-
-/*!
- Assigns \a other to this iterator and returns a reference to
- this iterator.
+ Constructs an invalid iterator.
*/
-QTextFrame::iterator &QTextFrame::iterator::operator=(const iterator &other) noexcept
-{
- f = other.f;
- b = other.b;
- e = other.e;
- cf = other.cf;
- cb = other.cb;
- return *this;
-}
-
-#endif
/*!
+ \fn QTextFrame *QTextFrame::iterator::currentFrame() const
Returns the current frame pointed to by the iterator, or \nullptr
if the iterator currently points to a block.
\sa currentBlock()
*/
-QTextFrame *QTextFrame::iterator::currentFrame() const
-{
- return cf;
-}
/*!
Returns the current block the iterator points to. If the iterator
@@ -724,7 +629,7 @@ QTextBlock QTextFrame::iterator::currentBlock() const
{
if (!f)
return QTextBlock();
- return QTextBlock(f->docHandle(), cb);
+ return QTextBlock(QTextDocumentPrivate::get(f), cb);
}
/*!
@@ -734,7 +639,7 @@ QTextBlock QTextFrame::iterator::currentBlock() const
*/
QTextFrame::iterator &QTextFrame::iterator::operator++()
{
- const QTextDocumentPrivate *priv = f->docHandle();
+ const QTextDocumentPrivate *priv = QTextDocumentPrivate::get(f);
const QTextDocumentPrivate::BlockMap &map = priv->blockMap();
if (cf) {
int end = cf->lastPosition() + 1;
@@ -772,7 +677,7 @@ QTextFrame::iterator &QTextFrame::iterator::operator++()
*/
QTextFrame::iterator &QTextFrame::iterator::operator--()
{
- const QTextDocumentPrivate *priv = f->docHandle();
+ const QTextDocumentPrivate *priv = QTextDocumentPrivate::get(f);
const QTextDocumentPrivate::BlockMap &map = priv->blockMap();
if (cf) {
int start = cf->firstPosition() - 1;
@@ -973,12 +878,6 @@ bool QTextBlock::isValid() const
*/
/*!
- \fn QTextBlock::iterator::iterator(const iterator &other)
-
- Copy constructor. Constructs a copy of the \a other iterator.
-*/
-
-/*!
\fn bool QTextBlock::iterator::atEnd() const
Returns \c true if the current item is the last item in the text block.
@@ -987,14 +886,14 @@ bool QTextBlock::isValid() const
/*!
\fn bool QTextBlock::iterator::operator==(const iterator &other) const
- Retuns true if this iterator is the same as the \a other iterator;
+ Returns true if this iterator is the same as the \a other iterator;
otherwise returns \c false.
*/
/*!
\fn bool QTextBlock::iterator::operator!=(const iterator &other) const
- Retuns true if this iterator is different from the \a other iterator;
+ Returns true if this iterator is different from the \a other iterator;
otherwise returns \c false.
*/
@@ -1014,12 +913,6 @@ bool QTextBlock::isValid() const
*/
/*!
- \fn QTextDocumentPrivate *QTextBlock::docHandle() const
-
- \internal
-*/
-
-/*!
\fn int QTextBlock::fragmentIndex() const
\internal
@@ -1233,7 +1126,7 @@ QString QTextBlock::text() const
QTextDocumentPrivate::FragmentIterator end = p->find(pos + length() - 1); // -1 to omit the block separator char
for (; it != end; ++it) {
const QTextFragmentData * const frag = it.value();
- text += QString::fromRawData(buffer.constData() + frag->stringPosition, frag->size_array[0]);
+ text += QStringView(buffer.constData() + frag->stringPosition, frag->size_array[0]);
}
return text;
@@ -1248,9 +1141,9 @@ QString QTextBlock::text() const
\sa charFormat(), blockFormat()
*/
-QVector<QTextLayout::FormatRange> QTextBlock::textFormats() const
+QList<QTextLayout::FormatRange> QTextBlock::textFormats() const
{
- QVector<QTextLayout::FormatRange> formats;
+ QList<QTextLayout::FormatRange> formats;
if (!p || !n)
return formats;
@@ -1863,3 +1756,5 @@ QString QTextFragment::text() const
}
QT_END_NAMESPACE
+
+#include "moc_qtextobject.cpp"
diff --git a/src/gui/text/qtextobject.h b/src/gui/text/qtextobject.h
index 215a76fb4d..875886f825 100644
--- a/src/gui/text/qtextobject.h
+++ b/src/gui/text/qtextobject.h
@@ -1,41 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the QtGui module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#ifndef QTEXTOBJECT_H
#define QTEXTOBJECT_H
@@ -75,8 +39,6 @@ public:
int objectIndex() const;
- QTextDocumentPrivate *docHandle() const;
-
protected:
QTextObject(QTextObjectPrivate &p, QTextDocument *doc);
@@ -137,40 +99,33 @@ public:
QList<QTextFrame *> childFrames() const;
QTextFrame *parentFrame() const;
- class Q_GUI_EXPORT iterator {
- QTextFrame *f;
- int b;
- int e;
- QTextFrame *cf;
- int cb;
+ class iterator {
+ QTextFrame *f = nullptr;
+ int b = 0;
+ int e = 0;
+ QTextFrame *cf = nullptr;
+ int cb = 0;
friend class QTextFrame;
friend class QTextTableCell;
friend class QTextDocumentLayoutPrivate;
- iterator(QTextFrame *frame, int block, int begin, int end);
+ inline iterator(QTextFrame *frame, int block, int begin, int end)
+ : f(frame), b(begin), e(end), cb(block)
+ {}
public:
- iterator(); // ### Qt 6: inline
-#if QT_VERSION < QT_VERSION_CHECK(6,0,0)
- iterator(const iterator &o) noexcept; // = default
- iterator &operator=(const iterator &o) noexcept; // = default
- iterator(iterator &&other) noexcept // = default
- { memcpy(static_cast<void *>(this), static_cast<void *>(&other), sizeof(iterator)); }
- iterator &operator=(iterator &&other) noexcept // = default
- { memcpy(static_cast<void *>(this), static_cast<void *>(&other), sizeof(iterator)); return *this; }
-#endif
-
+ constexpr iterator() noexcept = default;
QTextFrame *parentFrame() const { return f; }
- QTextFrame *currentFrame() const;
- QTextBlock currentBlock() const;
+ QTextFrame *currentFrame() const { return cf; }
+ Q_GUI_EXPORT QTextBlock currentBlock() const;
bool atEnd() const { return !cf && cb == e; }
inline bool operator==(const iterator &o) const { return f == o.f && cf == o.cf && cb == o.cb; }
inline bool operator!=(const iterator &o) const { return f != o.f || cf != o.cf || cb != o.cb; }
- iterator &operator++();
+ Q_GUI_EXPORT iterator &operator++();
inline iterator operator++(int) { iterator tmp = *this; operator++(); return tmp; }
- iterator &operator--();
+ Q_GUI_EXPORT iterator &operator--();
inline iterator operator--(int) { iterator tmp = *this; operator--(); return tmp; }
};
@@ -188,7 +143,7 @@ private:
Q_DECLARE_PRIVATE(QTextFrame)
Q_DISABLE_COPY(QTextFrame)
};
-Q_DECLARE_TYPEINFO(QTextFrame::iterator, Q_MOVABLE_TYPE);
+Q_DECLARE_TYPEINFO(QTextFrame::iterator, Q_RELOCATABLE_TYPE);
inline void QTextFrame::setFrameFormat(const QTextFrameFormat &aformat)
{ QTextObject::setFormat(aformat); }
@@ -228,7 +183,7 @@ public:
QString text() const;
- QVector<QTextLayout::FormatRange> textFormats() const;
+ QList<QTextLayout::FormatRange> textFormats() const;
const QTextDocument *document() const;
@@ -252,29 +207,26 @@ public:
void setLineCount(int count);
int lineCount() const;
- class Q_GUI_EXPORT iterator {
- const QTextDocumentPrivate *p;
- int b;
- int e;
- int n;
+ class iterator {
+ const QTextDocumentPrivate *p = nullptr;
+ int b = 0;
+ int e = 0;
+ int n = 0;
friend class QTextBlock;
- iterator(const QTextDocumentPrivate *priv, int begin, int end, int f) : p(priv), b(begin), e(end), n(f) {}
+ iterator(const QTextDocumentPrivate *priv, int begin, int end, int f)
+ : p(priv), b(begin), e(end), n(f) {}
public:
- iterator() : p(nullptr), b(0), e(0), n(0) {}
-#if QT_VERSION < QT_VERSION_CHECK(6,0,0)
- iterator(const iterator &o) : p(o.p), b(o.b), e(o.e), n(o.n) {}
- iterator &operator=(const iterator &o) = default;
-#endif
+ constexpr iterator() = default;
- QTextFragment fragment() const;
+ Q_GUI_EXPORT QTextFragment fragment() const;
bool atEnd() const { return n == e; }
inline bool operator==(const iterator &o) const { return p == o.p && n == o.n; }
inline bool operator!=(const iterator &o) const { return p != o.p || n != o.n; }
- iterator &operator++();
+ Q_GUI_EXPORT iterator &operator++();
inline iterator operator++(int) { iterator tmp = *this; operator++(); return tmp; }
- iterator &operator--();
+ Q_GUI_EXPORT iterator &operator--();
inline iterator operator--(int) { iterator tmp = *this; operator--(); return tmp; }
};
@@ -287,7 +239,6 @@ public:
QTextBlock next() const;
QTextBlock previous() const;
- inline QTextDocumentPrivate *docHandle() const { return p; }
inline int fragmentIndex() const { return n; }
private:
@@ -297,8 +248,8 @@ private:
friend class QTextLayout;
};
-Q_DECLARE_TYPEINFO(QTextBlock, Q_MOVABLE_TYPE);
-Q_DECLARE_TYPEINFO(QTextBlock::iterator, Q_MOVABLE_TYPE);
+Q_DECLARE_TYPEINFO(QTextBlock, Q_RELOCATABLE_TYPE);
+Q_DECLARE_TYPEINFO(QTextBlock::iterator, Q_RELOCATABLE_TYPE);
class Q_GUI_EXPORT QTextFragment
@@ -333,7 +284,7 @@ private:
int ne;
};
-Q_DECLARE_TYPEINFO(QTextFragment, Q_MOVABLE_TYPE);
+Q_DECLARE_TYPEINFO(QTextFragment, Q_RELOCATABLE_TYPE);
QT_END_NAMESPACE
diff --git a/src/gui/text/qtextobject_p.h b/src/gui/text/qtextobject_p.h
index 87c83868da..8dad4d7ef4 100644
--- a/src/gui/text/qtextobject_p.h
+++ b/src/gui/text/qtextobject_p.h
@@ -1,41 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the QtGui module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#ifndef QTEXTOBJECT_P_H
#define QTEXTOBJECT_P_H
diff --git a/src/gui/text/qtextodfwriter.cpp b/src/gui/text/qtextodfwriter.cpp
index 408e3ec167..b50771c12f 100644
--- a/src/gui/text/qtextodfwriter.cpp
+++ b/src/gui/text/qtextodfwriter.cpp
@@ -1,41 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the QtGui module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#include <qglobal.h>
@@ -54,17 +18,20 @@
#include "qtexttable.h"
#include "qtextcursor.h"
#include "qtextimagehandler_p.h"
-#include "qzipwriter_p.h"
#include <QDebug>
+#include <QtCore/private/qzipwriter_p.h>
+
QT_BEGIN_NAMESPACE
+using namespace Qt::StringLiterals;
+
/// Convert pixels to postscript point units
static QString pixelToPoint(qreal pixels)
{
// we hardcode 96 DPI, we do the same in the ODF importer to have a perfect roundtrip.
- return QString::number(pixels * 72 / 96) + QLatin1String("pt");
+ return QString::number(pixels * 72 / 96) + "pt"_L1;
}
// strategies
@@ -159,29 +126,32 @@ private:
QString manifestNS;
};
+static QStringView bullet_char(QTextListFormat::Style style)
+{
+ static_assert(int(QTextListFormat::ListDisc) == -1);
+ static_assert(int(QTextListFormat::ListUpperRoman) == -8);
+ static const char16_t chars[] = {
+ u'\x25cf', // bullet character
+ u'\x25cb', // white circle
+ u'\x25a1', // white square
+ u'1',
+ u'a',
+ u'A',
+ u'i',
+ u'I',
+ };
+ const auto map = [](QTextListFormat::Style s) { return -int(s) - 1; };
+ static_assert(uint(map(QTextListFormat::ListUpperRoman)) == std::size(chars) - 1);
+ const auto idx = map(style);
+ if (idx < 0)
+ return nullptr;
+ else
+ return {chars + idx, 1};
+}
+
static QString bulletChar(QTextListFormat::Style style)
{
- switch(style) {
- case QTextListFormat::ListDisc:
- return QChar(0x25cf); // bullet character
- case QTextListFormat::ListCircle:
- return QChar(0x25cb); // white circle
- case QTextListFormat::ListSquare:
- return QChar(0x25a1); // white square
- case QTextListFormat::ListDecimal:
- return QString::fromLatin1("1");
- case QTextListFormat::ListLowerAlpha:
- return QString::fromLatin1("a");
- case QTextListFormat::ListUpperAlpha:
- return QString::fromLatin1("A");
- case QTextListFormat::ListLowerRoman:
- return QString::fromLatin1("i");
- case QTextListFormat::ListUpperRoman:
- return QString::fromLatin1("I");
- default:
- case QTextListFormat::ListStyleUndefined:
- return QString();
- }
+ return bullet_char(style).toString();
}
static QString borderStyleName(QTextFrameFormat::BorderStyle style)
@@ -293,23 +263,23 @@ void QTextOdfWriter::writeBlock(QXmlStreamWriter &writer, const QTextBlock &bloc
const int listLevel = block.textList()->format().indent();
if (m_listStack.isEmpty() || m_listStack.top() != block.textList()) {
// not the same list we were in.
- while (m_listStack.count() >= listLevel && !m_listStack.isEmpty() && m_listStack.top() != block.textList() ) { // we need to close tags
+ while (m_listStack.size() >= listLevel && !m_listStack.isEmpty() && m_listStack.top() != block.textList() ) { // we need to close tags
m_listStack.pop();
writer.writeEndElement(); // list
- if (m_listStack.count())
+ if (m_listStack.size())
writer.writeEndElement(); // list-item
}
- while (m_listStack.count() < listLevel) {
- if (m_listStack.count())
+ while (m_listStack.size() < listLevel) {
+ if (m_listStack.size())
writer.writeStartElement(textNS, QString::fromLatin1("list-item"));
writer.writeStartElement(textNS, QString::fromLatin1("list"));
- if (m_listStack.count() == listLevel - 1) {
+ if (m_listStack.size() == listLevel - 1) {
m_listStack.push(block.textList());
writer.writeAttribute(textNS, QString::fromLatin1("style-name"), QString::fromLatin1("L%1")
.arg(block.textList()->formatIndex()));
}
else {
- m_listStack.push(0);
+ m_listStack.push(nullptr);
}
}
}
@@ -319,7 +289,7 @@ void QTextOdfWriter::writeBlock(QXmlStreamWriter &writer, const QTextBlock &bloc
while (! m_listStack.isEmpty()) {
m_listStack.pop();
writer.writeEndElement(); // list
- if (m_listStack.count())
+ if (m_listStack.size())
writer.writeEndElement(); // list-item
}
}
@@ -346,7 +316,7 @@ void QTextOdfWriter::writeBlock(QXmlStreamWriter &writer, const QTextBlock &bloc
writer.writeStartElement(textNS, QString::fromLatin1("span"));
QString fragmentText = frag.fragment().text();
- if (fragmentText.length() == 1 && fragmentText[0] == QChar(0xFFFC)) { // its an inline character.
+ if (fragmentText.size() == 1 && fragmentText[0] == u'\xFFFC') { // its an inline character.
writeInlineCharacter(writer, frag.fragment());
writer.writeEndElement(); // span
continue;
@@ -357,8 +327,8 @@ void QTextOdfWriter::writeBlock(QXmlStreamWriter &writer, const QTextBlock &bloc
bool escapeNextSpace = true;
int precedingSpaces = 0;
int exportedIndex = 0;
- for (int i=0; i <= fragmentText.count(); ++i) {
- QChar character = (i == fragmentText.count() ? QChar() : fragmentText.at(i));
+ for (int i=0; i <= fragmentText.size(); ++i) {
+ QChar character = (i == fragmentText.size() ? QChar() : fragmentText.at(i));
bool isSpace = character.unicode() == ' ';
// find more than one space. -> <text:s text:c="2" />
@@ -374,7 +344,7 @@ void QTextOdfWriter::writeBlock(QXmlStreamWriter &writer, const QTextBlock &bloc
exportedIndex = i;
}
- if (i < fragmentText.count()) {
+ if (i < fragmentText.size()) {
if (character.unicode() == 0x2028) { // soft-return
//if (exportedIndex < i)
writer.writeCharacters(fragmentText.mid(exportedIndex, i - exportedIndex));
@@ -451,13 +421,13 @@ void QTextOdfWriter::writeInlineCharacter(QXmlStreamWriter &writer, const QTextF
QImage image;
QString name = imageFormat.name();
- if (name.startsWith(QLatin1String(":/"))) // auto-detect resources
- name.prepend(QLatin1String("qrc"));
+ if (name.startsWith(":/"_L1)) // auto-detect resources
+ name.prepend("qrc"_L1);
QUrl url = QUrl(name);
const QVariant variant = m_document->resource(QTextDocument::ImageResource, url);
- if (variant.type() == QVariant::Image) {
+ if (variant.userType() == QMetaType::QPixmap || variant.userType() == QMetaType::QImage) {
image = qvariant_cast<QImage>(variant);
- } else if (variant.type() == QVariant::ByteArray) {
+ } else if (variant.userType() == QMetaType::QByteArray) {
data = variant.toByteArray();
QBuffer buffer(&data);
@@ -476,7 +446,7 @@ void QTextOdfWriter::writeInlineCharacter(QXmlStreamWriter &writer, const QTextF
QBuffer imageBytes;
int imgQuality = imageFormat.quality();
- if (imgQuality >= 100 || imgQuality < 0 || image.hasAlphaChannel()) {
+ if (imgQuality >= 100 || imgQuality <= 0 || image.hasAlphaChannel()) {
QImageWriter imageWriter(&imageBytes, "png");
imageWriter.write(image);
@@ -522,7 +492,7 @@ void QTextOdfWriter::writeInlineCharacter(QXmlStreamWriter &writer, const QTextF
void QTextOdfWriter::writeFormats(QXmlStreamWriter &writer, const QSet<int> &formats) const
{
writer.writeStartElement(officeNS, QString::fromLatin1("automatic-styles"));
- QVector<QTextFormat> allStyles = m_document->allFormats();
+ QList<QTextFormat> allStyles = m_document->allFormats();
for (int formatIndex : formats) {
QTextFormat textFormat = allStyles.at(formatIndex);
switch (textFormat.type()) {
@@ -544,12 +514,6 @@ void QTextOdfWriter::writeFormats(QXmlStreamWriter &writer, const QSet<int> &for
else
writeFrameFormat(writer, textFormat.toFrameFormat(), formatIndex);
break;
-#if QT_DEPRECATED_SINCE(5, 3)
- case QTextFormat::TableFormat:
- // this case never happens, because TableFormat is a FrameFormat
- Q_UNREACHABLE();
- break;
-#endif
}
}
@@ -678,11 +642,11 @@ void QTextOdfWriter::writeCharacterFormat(QXmlStreamWriter &writer, QTextCharFor
if (format.fontWeight() == QFont::Bold)
value = QString::fromLatin1("bold");
else
- value = QString::number(format.fontWeight() * 10);
+ value = QString::number(format.fontWeight());
writer.writeAttribute(foNS, QString::fromLatin1("font-weight"), value);
}
- if (format.hasProperty(QTextFormat::FontFamily))
- writer.writeAttribute(foNS, QString::fromLatin1("font-family"), format.fontFamily());
+ if (format.hasProperty(QTextFormat::OldFontFamily))
+ writer.writeAttribute(foNS, QString::fromLatin1("font-family"), format.fontFamilies().toStringList().value(0, QString()));
else
writer.writeAttribute(foNS, QString::fromLatin1("font-family"), QString::fromLatin1("Sans")); // Qt default
if (format.hasProperty(QTextFormat::FontPointSize))
@@ -870,7 +834,7 @@ void QTextOdfWriter::writeTableFormat(QXmlStreamWriter &writer, QTextTableFormat
writer.writeAttribute(tableNS, QString::fromLatin1("align"), QString::fromLatin1(align));
if (format.width().rawValue()) {
writer.writeAttribute(styleNS, QString::fromLatin1("width"),
- QString::number(format.width().rawValue()) + QLatin1String("pt"));
+ QString::number(format.width().rawValue()) + "pt"_L1);
}
writer.writeEndElement();
// start writing table-column style element
@@ -886,14 +850,14 @@ void QTextOdfWriter::writeTableFormat(QXmlStreamWriter &writer, QTextTableFormat
QString columnWidth;
if (format.columnWidthConstraints().at(colit).type() == QTextLength::PercentageLength) {
columnWidth = QString::number(format.columnWidthConstraints().at(colit).rawValue())
- + QLatin1String("%");
+ + "%"_L1;
} else if (format.columnWidthConstraints().at(colit).type() == QTextLength::FixedLength) {
columnWidth = QString::number(format.columnWidthConstraints().at(colit).rawValue())
- + QLatin1String("pt");
+ + "pt"_L1;
} else {
//!! HARD-CODING variableWidth Constraints to 100% / nr constraints
columnWidth = QString::number(100 / format.columnWidthConstraints().size())
- + QLatin1String("%");
+ + "%"_L1;
}
writer.writeAttribute(styleNS, QString::fromLatin1("column-width"), columnWidth);
writer.writeEndElement();
@@ -902,11 +866,11 @@ void QTextOdfWriter::writeTableFormat(QXmlStreamWriter &writer, QTextTableFormat
}
void QTextOdfWriter::writeTableCellFormat(QXmlStreamWriter &writer, QTextTableCellFormat format,
- int formatIndex, QVector<QTextFormat> &styles) const
+ int formatIndex, QList<QTextFormat> &styles) const
{
// check for all table cells here if they are in a table with border
if (m_cellFormatsInTablesWithBorders.contains(formatIndex)) {
- const QVector<int> tableIdVector = m_cellFormatsInTablesWithBorders.value(formatIndex);
+ const QList<int> tableIdVector = m_cellFormatsInTablesWithBorders.value(formatIndex);
for (const auto &tableId : tableIdVector) {
const auto &tmpStyle = styles.at(tableId);
if (tmpStyle.isTableFormat()) {
@@ -935,8 +899,8 @@ void QTextOdfWriter::tableCellStyleElement(QXmlStreamWriter &writer, const int &
writer.writeEmptyElement(styleNS, QString::fromLatin1("table-cell-properties"));
if (hasBorder) {
writer.writeAttribute(foNS, QString::fromLatin1("border"),
- pixelToPoint(tableFormatTmp.border()) + QLatin1String(" ")
- + borderStyleName(tableFormatTmp.borderStyle()) + QLatin1String(" ")
+ pixelToPoint(tableFormatTmp.border()) + " "_L1
+ + borderStyleName(tableFormatTmp.borderStyle()) + " "_L1
+ tableFormatTmp.borderBrush().color().name(QColor::HexRgb));
}
qreal topPadding = format.topPadding();
@@ -987,18 +951,17 @@ void QTextOdfWriter::tableCellStyleElement(QXmlStreamWriter &writer, const int &
///////////////////////
QTextOdfWriter::QTextOdfWriter(const QTextDocument &document, QIODevice *device)
- : officeNS (QLatin1String("urn:oasis:names:tc:opendocument:xmlns:office:1.0")),
- textNS (QLatin1String("urn:oasis:names:tc:opendocument:xmlns:text:1.0")),
- styleNS (QLatin1String("urn:oasis:names:tc:opendocument:xmlns:style:1.0")),
- foNS (QLatin1String("urn:oasis:names:tc:opendocument:xmlns:xsl-fo-compatible:1.0")),
- tableNS (QLatin1String("urn:oasis:names:tc:opendocument:xmlns:table:1.0")),
- drawNS (QLatin1String("urn:oasis:names:tc:opendocument:xmlns:drawing:1.0")),
- xlinkNS (QLatin1String("http://www.w3.org/1999/xlink")),
- svgNS (QLatin1String("urn:oasis:names:tc:opendocument:xmlns:svg-compatible:1.0")),
+ : officeNS ("urn:oasis:names:tc:opendocument:xmlns:office:1.0"_L1),
+ textNS ("urn:oasis:names:tc:opendocument:xmlns:text:1.0"_L1),
+ styleNS ("urn:oasis:names:tc:opendocument:xmlns:style:1.0"_L1),
+ foNS ("urn:oasis:names:tc:opendocument:xmlns:xsl-fo-compatible:1.0"_L1),
+ tableNS ("urn:oasis:names:tc:opendocument:xmlns:table:1.0"_L1),
+ drawNS ("urn:oasis:names:tc:opendocument:xmlns:drawing:1.0"_L1),
+ xlinkNS ("http://www.w3.org/1999/xlink"_L1),
+ svgNS ("urn:oasis:names:tc:opendocument:xmlns:svg-compatible:1.0"_L1),
m_document(&document),
m_device(device),
m_strategy(nullptr),
- m_codec(nullptr),
m_createArchive(true)
{
}
@@ -1015,10 +978,6 @@ bool QTextOdfWriter::writeAll()
return false;
}
QXmlStreamWriter writer(m_strategy->contentStream);
-#if QT_CONFIG(textcodec)
- if (m_codec)
- writer.setCodec(m_codec);
-#endif
// prettyfy
writer.setAutoFormatting(true);
writer.setAutoFormattingIndent(2);
@@ -1036,16 +995,16 @@ bool QTextOdfWriter::writeAll()
writer.writeAttribute(officeNS, QString::fromLatin1("version"), QString::fromLatin1("1.2"));
// add fragments. (for character formats)
- QTextDocumentPrivate::FragmentIterator fragIt = m_document->docHandle()->begin();
+ QTextDocumentPrivate::FragmentIterator fragIt = QTextDocumentPrivate::get(m_document)->begin();
QSet<int> formats;
- while (fragIt != m_document->docHandle()->end()) {
+ while (fragIt != QTextDocumentPrivate::get(m_document)->end()) {
const QTextFragmentData * const frag = fragIt.value();
formats << frag->format;
++fragIt;
}
// add blocks (for blockFormats)
- QTextDocumentPrivate::BlockMap &blocks = m_document->docHandle()->blockMap();
+ QTextDocumentPrivate::BlockMap &blocks = const_cast<QTextDocumentPrivate *>(QTextDocumentPrivate::get(m_document))->blockMap();
QTextDocumentPrivate::BlockMap::Iterator blockIt = blocks.begin();
while (blockIt != blocks.end()) {
const QTextBlockData * const block = blockIt.value();
@@ -1054,7 +1013,7 @@ bool QTextOdfWriter::writeAll()
}
// add objects for lists, frames and tables
- const QVector<QTextFormat> allFormats = m_document->allFormats();
+ const QList<QTextFormat> allFormats = m_document->allFormats();
const QList<int> copy = formats.values();
for (auto index : copy) {
QTextObject *object = m_document->objectForFormat(allFormats[index]);
@@ -1069,7 +1028,7 @@ bool QTextOdfWriter::writeAll()
for (int rowindex = 0; rowindex < tableobject->rows(); ++rowindex) {
for (int colindex = 0; colindex < tableobject->columns(); ++colindex) {
const int cellFormatID = tableobject->cellAt(rowindex, colindex).tableCellFormatIndex();
- QVector<int> tableIdsTmp;
+ QList<int> tableIdsTmp;
if (m_cellFormatsInTablesWithBorders.contains(cellFormatID))
tableIdsTmp = m_cellFormatsInTablesWithBorders.value(cellFormatID);
if (!tableIdsTmp.contains(tableID))
diff --git a/src/gui/text/qtextodfwriter_p.h b/src/gui/text/qtextodfwriter_p.h
index 98a6fdfa96..e02297da98 100644
--- a/src/gui/text/qtextodfwriter_p.h
+++ b/src/gui/text/qtextodfwriter_p.h
@@ -1,41 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the QtGui module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#ifndef QTEXTODFWRITER_H
#define QTEXTODFWRITER_H
@@ -55,11 +19,11 @@
// We mean it.
//
-#include <QtCore/QXmlStreamWriter>
#include <QtCore/qhash.h>
+#include <QtCore/qlist.h>
#include <QtCore/qset.h>
#include <QtCore/qstack.h>
-#include <QtCore/qvector.h>
+#include <QtCore/QXmlStreamWriter>
#include "qtextdocument_p.h"
#include "qtextdocumentwriter.h"
@@ -86,7 +50,6 @@ public:
QTextOdfWriter(const QTextDocument &document, QIODevice *device);
bool writeAll();
- void setCodec(QTextCodec *codec) { m_codec = codec; }
void setCreateArchive(bool on) { m_createArchive = on; }
bool createArchive() const { return m_createArchive; }
@@ -97,8 +60,8 @@ public:
void writeListFormat(QXmlStreamWriter &writer, QTextListFormat format, int formatIndex) const;
void writeFrameFormat(QXmlStreamWriter &writer, QTextFrameFormat format, int formatIndex) const;
void writeTableFormat(QXmlStreamWriter &writer, QTextTableFormat format, int formatIndex) const;
- void writeTableCellFormat(QXmlStreamWriter &writer, QTextTableCellFormat format, int formatIndex,
- QVector<QTextFormat> &styles) const;
+ void writeTableCellFormat(QXmlStreamWriter &writer, QTextTableCellFormat format,
+ int formatIndex, QList<QTextFormat> &styles) const;
void writeFrame(QXmlStreamWriter &writer, const QTextFrame *frame);
void writeInlineCharacter(QXmlStreamWriter &writer, const QTextFragment &fragment) const;
@@ -116,12 +79,11 @@ private:
QIODevice *m_device;
QOutputStrategy *m_strategy;
- QTextCodec *m_codec;
bool m_createArchive;
QStack<QTextList *> m_listStack;
- QHash<int, QVector<int>> m_cellFormatsInTablesWithBorders;
+ QHash<int, QList<int>> m_cellFormatsInTablesWithBorders;
QSet<int> m_tableFormatsWithBorders;
mutable QSet<int> m_tableFormatsWithColWidthConstraints;
};
diff --git a/src/gui/text/qtextoption.cpp b/src/gui/text/qtextoption.cpp
index 2f195599f0..b6beadbe91 100644
--- a/src/gui/text/qtextoption.cpp
+++ b/src/gui/text/qtextoption.cpp
@@ -1,41 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the QtGui module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#include "qtextoption.h"
#include "qguiapplication.h"
@@ -43,6 +7,8 @@
QT_BEGIN_NAMESPACE
+QT_IMPL_METATYPE_EXTERN_TAGGED(QTextOption::Tab, QTextOption_Tab)
+
struct QTextOptionPrivate
{
QList<QTextOption::Tab> tabStops;
@@ -55,14 +21,7 @@ struct QTextOptionPrivate
using of design metrics flag is set to false.
*/
QTextOption::QTextOption()
- : align(Qt::AlignLeft),
- wordWrap(QTextOption::WordWrap),
- design(false),
- unused(0),
- unused2(0),
- f(0),
- tab(-1),
- d(nullptr)
+ : QTextOption(Qt::AlignLeft)
{
direction = Qt::LayoutDirectionAuto;
}
@@ -77,7 +36,6 @@ QTextOption::QTextOption(Qt::Alignment alignment)
wordWrap(QTextOption::WordWrap),
design(false),
unused(0),
- unused2(0),
f(0),
tab(-1),
d(nullptr)
@@ -104,7 +62,6 @@ QTextOption::QTextOption(const QTextOption &o)
design(o.design),
direction(o.direction),
unused(o.unused),
- unused2(o.unused2),
f(o.f),
tab(o.tab),
d(nullptr)
@@ -152,7 +109,7 @@ void QTextOption::setTabArray(const QList<qreal> &tabStops)
d = new QTextOptionPrivate;
QList<QTextOption::Tab> tabs;
QTextOption::Tab tab;
- tabs.reserve(tabStops.count());
+ tabs.reserve(tabStops.size());
for (qreal pos : tabStops) {
tab.position = pos;
tabs.append(tab);
@@ -165,7 +122,7 @@ void QTextOption::setTabArray(const QList<qreal> &tabStops)
Sets the tab positions for the text layout to those specified by
\a tabStops.
- \sa tabStop()
+ \sa tabStopDistance()
*/
void QTextOption::setTabs(const QList<QTextOption::Tab> &tabStops)
{
@@ -177,7 +134,7 @@ void QTextOption::setTabs(const QList<QTextOption::Tab> &tabStops)
/*!
Returns a list of tab positions defined for the text layout.
- \sa setTabArray(), tabStop()
+ \sa setTabArray(), tabStopDistance()
*/
QList<qreal> QTextOption::tabArray() const
{
@@ -185,7 +142,7 @@ QList<qreal> QTextOption::tabArray() const
if (!d)
return answer;
- answer.reserve(d->tabStops.count());
+ answer.reserve(d->tabStops.size());
QList<QTextOption::Tab>::ConstIterator iter = d->tabStops.constBegin();
while(iter != d->tabStops.constEnd()) {
answer.append( (*iter).position);
@@ -333,28 +290,6 @@ QList<QTextOption::Tab> QTextOption::tabs() const
\sa flags()
*/
-#if QT_DEPRECATED_SINCE(5, 10)
-/*!
- \fn qreal QTextOption::tabStop() const
- \deprecated in Qt 5.10. Use tabStopDistance() instead.
-
- Returns the distance in device units between tab stops.
- Convenient function for the above method
-
- \sa setTabStopDistance(), tabArray(), setTabs(), tabs()
-*/
-
-/*!
- \fn void QTextOption::setTabStop(qreal tabStop)
- \deprecated in Qt 5.10. Use setTabStopDistance() instead.
-
- Sets the default distance in device units between tab stops to the value specified
- by \a tabStop.
-
- \sa tabStopDistance(), setTabArray(), setTabs(), tabs()
-*/
-#endif
-
/*!
\fn qreal QTextOption::tabStopDistance() const
\since 5.10
@@ -394,11 +329,11 @@ QList<QTextOption::Tab> QTextOption::tabs() const
*/
/*!
- \variable Tab::position
+ \variable QTextOption::Tab::position
Distance from the start of the paragraph.
The position of a tab is from the start of the paragraph which implies that when
the alignment of the paragraph is set to centered, the tab is interpreted to be
- moved the same distance as the left ege of the paragraph does.
+ moved the same distance as the left edge of the paragraph does.
In case the paragraph is set to have a layoutDirection() RightToLeft the position
is interpreted to be from the right side of the paragraph with higher numbers moving
the tab to the left.
@@ -451,7 +386,7 @@ QList<QTextOption::Tab> QTextOption::tabs() const
\fn QList<QTextOption::Tab> QTextOption::tabs() const
Returns a list of tab positions defined for the text layout.
- \sa tabStopDistance(), setTabs(), setTabStop()
+ \sa tabStopDistance(), setTabs(), setTabStopDistance()
*/
diff --git a/src/gui/text/qtextoption.h b/src/gui/text/qtextoption.h
index a90d73dc43..dcff41584f 100644
--- a/src/gui/text/qtextoption.h
+++ b/src/gui/text/qtextoption.h
@@ -1,41 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the QtGui module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#ifndef QTEXTOPTION_H
#define QTEXTOPTION_H
@@ -81,7 +45,7 @@ public:
};
QTextOption();
- /*implicit*/ QTextOption(Qt::Alignment alignment);
+ Q_IMPLICIT QTextOption(Qt::Alignment alignment);
~QTextOption();
QTextOption(const QTextOption &o);
@@ -115,11 +79,6 @@ public:
inline void setFlags(Flags flags);
inline Flags flags() const { return Flags(f); }
-#if QT_DEPRECATED_SINCE(5, 10)
- QT_DEPRECATED inline void setTabStop(qreal tabStop);
- QT_DEPRECATED inline qreal tabStop() const { return tabStopDistance(); }
-#endif
-
inline void setTabStopDistance(qreal tabStopDistance);
inline qreal tabStopDistance() const { return tab; }
@@ -133,12 +92,11 @@ public:
bool useDesignMetrics() const { return design; }
private:
- uint align : 8;
+ uint align : 9;
uint wordWrap : 4;
uint design : 1;
uint direction : 2;
- uint unused : 17;
- uint unused2; // ### Qt 6: remove unnecessary, extra 32 bits
+ uint unused : 16;
uint f;
qreal tab;
QTextOptionPrivate *d;
@@ -147,21 +105,16 @@ private:
Q_DECLARE_OPERATORS_FOR_FLAGS(QTextOption::Flags)
inline void QTextOption::setAlignment(Qt::Alignment aalignment)
-{ align = aalignment; }
+{ align = uint(aalignment.toInt()); }
inline void QTextOption::setFlags(Flags aflags)
-{ f = aflags; }
-
-#if QT_DEPRECATED_SINCE(5, 10)
-inline void QTextOption::setTabStop(qreal atabStop)
-{ setTabStopDistance(atabStop); }
-#endif
+{ f = uint(aflags.toInt()); }
inline void QTextOption::setTabStopDistance(qreal atabStop)
{ tab = atabStop; }
QT_END_NAMESPACE
-Q_DECLARE_METATYPE( QTextOption::Tab )
+QT_DECL_METATYPE_EXTERN_TAGGED(QTextOption::Tab, QTextOption_Tab, Q_GUI_EXPORT)
#endif // QTEXTOPTION_H
diff --git a/src/gui/text/qtexttable.cpp b/src/gui/text/qtexttable.cpp
index 39f26d5d42..64b7aa6765 100644
--- a/src/gui/text/qtexttable.cpp
+++ b/src/gui/text/qtexttable.cpp
@@ -1,41 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the QtGui module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#include "qtexttable.h"
#include "qtextcursor.h"
@@ -50,6 +14,8 @@
QT_BEGIN_NAMESPACE
+using namespace Qt::StringLiterals;
+
/*!
\class QTextTableCell
\reentrant
@@ -121,7 +87,7 @@ void QTextTableCell::setFormat(const QTextCharFormat &format)
QTextCharFormat fmt = format;
fmt.clearProperty(QTextFormat::ObjectIndex);
fmt.setObjectType(QTextFormat::TableCellObject);
- QTextDocumentPrivate *p = table->docHandle();
+ QTextDocumentPrivate *p = const_cast<QTextDocumentPrivate *>(QTextDocumentPrivate::get(table));
QTextDocumentPrivate::FragmentIterator frag(&p->fragmentMap(), fragment);
QTextFormatCollection *c = p->formatCollection();
@@ -137,8 +103,8 @@ void QTextTableCell::setFormat(const QTextCharFormat &format)
*/
QTextCharFormat QTextTableCell::format() const
{
- QTextDocumentPrivate *p = table->docHandle();
- QTextFormatCollection *c = p->formatCollection();
+ const QTextDocumentPrivate *p = QTextDocumentPrivate::get(table);
+ const QTextFormatCollection *c = p->formatCollection();
QTextCharFormat fmt = c->charFormat(tableCellFormatIndex());
fmt.setObjectType(QTextFormat::TableCellObject);
@@ -154,7 +120,7 @@ QTextCharFormat QTextTableCell::format() const
*/
int QTextTableCell::tableCellFormatIndex() const
{
- QTextDocumentPrivate *p = table->docHandle();
+ const QTextDocumentPrivate *p = QTextDocumentPrivate::get(table);
return QTextDocumentPrivate::FragmentIterator(&p->fragmentMap(), fragment)->format;
}
@@ -248,7 +214,7 @@ QTextCursor QTextTableCell::lastCursorPosition() const
*/
int QTextTableCell::firstPosition() const
{
- QTextDocumentPrivate *p = table->docHandle();
+ const QTextDocumentPrivate *p = QTextDocumentPrivate::get(table);
return p->fragmentMap().position(fragment) + 1;
}
@@ -259,7 +225,7 @@ int QTextTableCell::firstPosition() const
*/
int QTextTableCell::lastPosition() const
{
- QTextDocumentPrivate *p = table->docHandle();
+ const QTextDocumentPrivate *p = QTextDocumentPrivate::get(table);
const QTextTablePrivate *td = table->d_func();
int index = table->d_func()->findCellIndex(fragment);
int f;
@@ -278,7 +244,7 @@ int QTextTableCell::lastPosition() const
*/
QTextFrame::iterator QTextTableCell::begin() const
{
- QTextDocumentPrivate *p = table->docHandle();
+ const QTextDocumentPrivate *p = QTextDocumentPrivate::get(table);
int b = p->blockMap().findNode(firstPosition());
int e = p->blockMap().findNode(lastPosition()+1);
return QTextFrame::iterator(const_cast<QTextTable *>(table), b, b, e);
@@ -291,7 +257,7 @@ QTextFrame::iterator QTextTableCell::begin() const
*/
QTextFrame::iterator QTextTableCell::end() const
{
- QTextDocumentPrivate *p = table->docHandle();
+ const QTextDocumentPrivate *p = QTextDocumentPrivate::get(table);
int b = p->blockMap().findNode(firstPosition());
int e = p->blockMap().findNode(lastPosition()+1);
return QTextFrame::iterator(const_cast<QTextTable *>(table), e, b, e);
@@ -318,13 +284,6 @@ QTextFrame::iterator QTextTableCell::end() const
Destroys the table cell.
*/
-QTextTablePrivate::~QTextTablePrivate()
-{
- if (grid)
- free(grid);
-}
-
-
QTextTable *QTextTablePrivate::createTable(QTextDocumentPrivate *pieceTable, int pos, int rows, int cols, const QTextTableFormat &tableFormat)
{
QTextTableFormat fmt = tableFormat;
@@ -403,7 +362,7 @@ void QTextTablePrivate::fragmentAdded(QChar type, uint fragment)
if (blockFragmentUpdates)
return;
if (type == QTextBeginningOfFrame) {
- Q_ASSERT(cells.indexOf(fragment) == -1);
+ Q_ASSERT(cells.indexOf(int(fragment)) == -1);
const uint pos = pieceTable->fragmentMap().position(fragment);
QFragmentFindHelper helper(pos, pieceTable->fragmentMap());
auto it = std::lower_bound(cells.begin(), cells.end(), helper);
@@ -421,8 +380,8 @@ void QTextTablePrivate::fragmentRemoved(QChar type, uint fragment)
if (blockFragmentUpdates)
return;
if (type == QTextBeginningOfFrame) {
- Q_ASSERT(cells.indexOf(fragment) != -1);
- cells.removeAll(fragment);
+ Q_ASSERT(cells.indexOf(int(fragment)) != -1);
+ cells.removeAll(int(fragment));
if (fragment_start == fragment && cells.size()) {
fragment_start = cells.at(0);
}
@@ -446,8 +405,7 @@ void QTextTablePrivate::update() const
nRows = (cells.size() + nCols-1)/nCols;
// qDebug(">>>> QTextTablePrivate::update, nRows=%d, nCols=%d", nRows, nCols);
- grid = q_check_ptr((int *)realloc(grid, nRows*nCols*sizeof(int)));
- memset(grid, 0, nRows*nCols*sizeof(int));
+ grid.assign(nRows * nCols, 0);
QTextDocumentPrivate *p = pieceTable;
QTextFormatCollection *c = p->formatCollection();
@@ -470,8 +428,7 @@ void QTextTablePrivate::update() const
cellIndices[i] = cell;
if (r + rowspan > nRows) {
- grid = q_check_ptr((int *)realloc(grid, sizeof(int)*(r + rowspan)*nCols));
- memset(grid + (nRows*nCols), 0, sizeof(int)*(r+rowspan-nRows)*nCols);
+ grid.resize((r + rowspan) * nCols, 0);
nRows = r + rowspan;
}
@@ -759,7 +716,7 @@ void QTextTable::insertColumns(int pos, int num)
QTextFormatCollection *c = p->formatCollection();
p->beginEditBlock();
- QVector<int> extendedSpans;
+ QList<int> extendedSpans;
for (int i = 0; i < d->nRows; ++i) {
int cell;
if (i == d->nRows - 1 && pos == d->nCols) {
@@ -825,7 +782,7 @@ void QTextTable::insertColumns(int pos, int num)
QTextTableFormat tfmt = format();
tfmt.setColumns(tfmt.columns()+num);
- QVector<QTextLength> columnWidths = tfmt.columnWidthConstraints();
+ QList<QTextLength> columnWidths = tfmt.columnWidthConstraints();
if (! columnWidths.isEmpty()) {
for (int i = num; i > 0; --i)
columnWidths.insert(pos, columnWidths.at(qMax(0, pos - 1)));
@@ -894,7 +851,7 @@ void QTextTable::removeRows(int pos, int num)
p->aboutToRemoveCell(cellAt(pos, 0).firstPosition(), cellAt(pos + num - 1, d->nCols - 1).lastPosition());
- QVector<int> touchedCells;
+ QList<int> touchedCells;
for (int r = pos; r < pos + num; ++r) {
for (int c = 0; c < d->nCols; ++c) {
int cell = d->grid[r*d->nCols + c];
@@ -956,7 +913,7 @@ void QTextTable::removeColumns(int pos, int num)
p->aboutToRemoveCell(cellAt(0, pos).firstPosition(), cellAt(d->nRows - 1, pos + num - 1).lastPosition());
- QVector<int> touchedCells;
+ QList<int> touchedCells;
for (int r = 0; r < d->nRows; ++r) {
for (int c = pos; c < pos + num; ++c) {
int cell = d->grid[r*d->nCols + c];
@@ -981,8 +938,8 @@ void QTextTable::removeColumns(int pos, int num)
QTextTableFormat tfmt = format();
tfmt.setColumns(tfmt.columns()-num);
- QVector<QTextLength> columnWidths = tfmt.columnWidthConstraints();
- if (columnWidths.count() > pos) {
+ QList<QTextLength> columnWidths = tfmt.columnWidthConstraints();
+ if (columnWidths.size() > pos) {
columnWidths.remove(pos, num);
tfmt.setColumnWidthConstraints (columnWidths);
}
@@ -1119,7 +1076,7 @@ void QTextTable::mergeCells(int row, int column, int numRows, int numCols)
QTextCursorPrivate::fromPosition(p, insertPos++).insertBlock();
p->move(pos + 1, insertPos, nextPos - pos);
} else if (rowHasText) {
- QTextCursorPrivate::fromPosition(p, insertPos++).insertText(QLatin1String(" "));
+ QTextCursorPrivate::fromPosition(p, insertPos++).insertText(" "_L1);
p->move(pos + 1, insertPos, nextPos - pos);
} else {
p->move(pos, insertPos, nextPos - pos);
@@ -1344,3 +1301,5 @@ void QTextTable::setFormat(const QTextTableFormat &format)
*/
QT_END_NAMESPACE
+
+#include "moc_qtexttable.cpp"
diff --git a/src/gui/text/qtexttable.h b/src/gui/text/qtexttable.h
index 156b091b05..49f606d429 100644
--- a/src/gui/text/qtexttable.h
+++ b/src/gui/text/qtexttable.h
@@ -1,41 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the QtGui module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#ifndef QTEXTTABLE_H
#define QTEXTTABLE_H
diff --git a/src/gui/text/qtexttable_p.h b/src/gui/text/qtexttable_p.h
index 5c05611009..3a652af046 100644
--- a/src/gui/text/qtexttable_p.h
+++ b/src/gui/text/qtexttable_p.h
@@ -1,41 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the QtGui module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#ifndef QTEXTTABLE_P_H
#define QTEXTTABLE_P_H
@@ -55,14 +19,15 @@
#include "private/qtextobject_p.h"
#include "private/qtextdocument_p.h"
+#include <vector>
+
QT_BEGIN_NAMESPACE
class QTextTablePrivate : public QTextFramePrivate
{
Q_DECLARE_PUBLIC(QTextTable)
public:
- QTextTablePrivate(QTextDocument *document) : QTextFramePrivate(document), grid(nullptr), nRows(0), nCols(0), dirty(true), blockFragmentUpdates(false) {}
- ~QTextTablePrivate();
+ QTextTablePrivate(QTextDocument *document) : QTextFramePrivate(document), nRows(0), nCols(0), dirty(true), blockFragmentUpdates(false) {}
static QTextTable *createTable(QTextDocumentPrivate *, int pos, int rows, int cols, const QTextTableFormat &tableFormat);
void fragmentAdded(QChar type, uint fragment) override;
@@ -72,11 +37,11 @@ public:
int findCellIndex(int fragment) const;
- QVector<int> cells;
+ QList<int> cells;
// symmetric to cells array and maps to indecs in grid,
// used for fast-lookup for row/column by fragment
- mutable QVector<int> cellIndices;
- mutable int *grid;
+ mutable QList<int> cellIndices;
+ mutable std::vector<int> grid;
mutable int nRows;
mutable int nCols;
mutable bool dirty;
diff --git a/src/gui/text/qzip.cpp b/src/gui/text/qzip.cpp
deleted file mode 100644
index 80c0f122e8..0000000000
--- a/src/gui/text/qzip.cpp
+++ /dev/null
@@ -1,1366 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the QtGui module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include <qglobal.h>
-
-#ifndef QT_NO_TEXTODFWRITER
-
-#include "qzipreader_p.h"
-#include "qzipwriter_p.h"
-#include <qdatetime.h>
-#include <qendian.h>
-#include <qdebug.h>
-#include <qdir.h>
-
-#include <zlib.h>
-
-// Zip standard version for archives handled by this API
-// (actually, the only basic support of this version is implemented but it is enough for now)
-#define ZIP_VERSION 20
-
-#if 0
-#define ZDEBUG qDebug
-#else
-#define ZDEBUG if (0) qDebug
-#endif
-
-QT_BEGIN_NAMESPACE
-
-static inline uint readUInt(const uchar *data)
-{
- return (data[0]) + (data[1]<<8) + (data[2]<<16) + (data[3]<<24);
-}
-
-static inline ushort readUShort(const uchar *data)
-{
- return (data[0]) + (data[1]<<8);
-}
-
-static inline void writeUInt(uchar *data, uint i)
-{
- data[0] = i & 0xff;
- data[1] = (i>>8) & 0xff;
- data[2] = (i>>16) & 0xff;
- data[3] = (i>>24) & 0xff;
-}
-
-static inline void writeUShort(uchar *data, ushort i)
-{
- data[0] = i & 0xff;
- data[1] = (i>>8) & 0xff;
-}
-
-static inline void copyUInt(uchar *dest, const uchar *src)
-{
- dest[0] = src[0];
- dest[1] = src[1];
- dest[2] = src[2];
- dest[3] = src[3];
-}
-
-static inline void copyUShort(uchar *dest, const uchar *src)
-{
- dest[0] = src[0];
- dest[1] = src[1];
-}
-
-static void writeMSDosDate(uchar *dest, const QDateTime& dt)
-{
- if (dt.isValid()) {
- quint16 time =
- (dt.time().hour() << 11) // 5 bit hour
- | (dt.time().minute() << 5) // 6 bit minute
- | (dt.time().second() >> 1); // 5 bit double seconds
-
- dest[0] = time & 0xff;
- dest[1] = time >> 8;
-
- quint16 date =
- ((dt.date().year() - 1980) << 9) // 7 bit year 1980-based
- | (dt.date().month() << 5) // 4 bit month
- | (dt.date().day()); // 5 bit day
-
- dest[2] = char(date);
- dest[3] = char(date >> 8);
- } else {
- dest[0] = 0;
- dest[1] = 0;
- dest[2] = 0;
- dest[3] = 0;
- }
-}
-
-static int inflate(Bytef *dest, ulong *destLen, const Bytef *source, ulong sourceLen)
-{
- z_stream stream;
- int err;
-
- stream.next_in = const_cast<Bytef*>(source);
- stream.avail_in = (uInt)sourceLen;
- if ((uLong)stream.avail_in != sourceLen)
- return Z_BUF_ERROR;
-
- stream.next_out = dest;
- stream.avail_out = (uInt)*destLen;
- if ((uLong)stream.avail_out != *destLen)
- return Z_BUF_ERROR;
-
- stream.zalloc = (alloc_func)nullptr;
- stream.zfree = (free_func)nullptr;
-
- err = inflateInit2(&stream, -MAX_WBITS);
- if (err != Z_OK)
- return err;
-
- err = inflate(&stream, Z_FINISH);
- if (err != Z_STREAM_END) {
- inflateEnd(&stream);
- if (err == Z_NEED_DICT || (err == Z_BUF_ERROR && stream.avail_in == 0))
- return Z_DATA_ERROR;
- return err;
- }
- *destLen = stream.total_out;
-
- err = inflateEnd(&stream);
- return err;
-}
-
-static int deflate (Bytef *dest, ulong *destLen, const Bytef *source, ulong sourceLen)
-{
- z_stream stream;
- int err;
-
- stream.next_in = const_cast<Bytef*>(source);
- stream.avail_in = (uInt)sourceLen;
- stream.next_out = dest;
- stream.avail_out = (uInt)*destLen;
- if ((uLong)stream.avail_out != *destLen) return Z_BUF_ERROR;
-
- stream.zalloc = (alloc_func)nullptr;
- stream.zfree = (free_func)nullptr;
- stream.opaque = (voidpf)nullptr;
-
- err = deflateInit2(&stream, Z_DEFAULT_COMPRESSION, Z_DEFLATED, -MAX_WBITS, 8, Z_DEFAULT_STRATEGY);
- if (err != Z_OK) return err;
-
- err = deflate(&stream, Z_FINISH);
- if (err != Z_STREAM_END) {
- deflateEnd(&stream);
- return err == Z_OK ? Z_BUF_ERROR : err;
- }
- *destLen = stream.total_out;
-
- err = deflateEnd(&stream);
- return err;
-}
-
-
-namespace WindowsFileAttributes {
-enum {
- Dir = 0x10, // FILE_ATTRIBUTE_DIRECTORY
- File = 0x80, // FILE_ATTRIBUTE_NORMAL
- TypeMask = 0x90,
-
- ReadOnly = 0x01, // FILE_ATTRIBUTE_READONLY
- PermMask = 0x01
-};
-}
-
-namespace UnixFileAttributes {
-enum {
- Dir = 0040000, // __S_IFDIR
- File = 0100000, // __S_IFREG
- SymLink = 0120000, // __S_IFLNK
- TypeMask = 0170000, // __S_IFMT
-
- ReadUser = 0400, // __S_IRUSR
- WriteUser = 0200, // __S_IWUSR
- ExeUser = 0100, // __S_IXUSR
- ReadGroup = 0040, // __S_IRGRP
- WriteGroup = 0020, // __S_IWGRP
- ExeGroup = 0010, // __S_IXGRP
- ReadOther = 0004, // __S_IROTH
- WriteOther = 0002, // __S_IWOTH
- ExeOther = 0001, // __S_IXOTH
- PermMask = 0777
-};
-}
-
-static QFile::Permissions modeToPermissions(quint32 mode)
-{
- QFile::Permissions ret;
- if (mode & UnixFileAttributes::ReadUser)
- ret |= QFile::ReadOwner | QFile::ReadUser;
- if (mode & UnixFileAttributes::WriteUser)
- ret |= QFile::WriteOwner | QFile::WriteUser;
- if (mode & UnixFileAttributes::ExeUser)
- ret |= QFile::ExeOwner | QFile::ExeUser;
- if (mode & UnixFileAttributes::ReadGroup)
- ret |= QFile::ReadGroup;
- if (mode & UnixFileAttributes::WriteGroup)
- ret |= QFile::WriteGroup;
- if (mode & UnixFileAttributes::ExeGroup)
- ret |= QFile::ExeGroup;
- if (mode & UnixFileAttributes::ReadOther)
- ret |= QFile::ReadOther;
- if (mode & UnixFileAttributes::WriteOther)
- ret |= QFile::WriteOther;
- if (mode & UnixFileAttributes::ExeOther)
- ret |= QFile::ExeOther;
- return ret;
-}
-
-static quint32 permissionsToMode(QFile::Permissions perms)
-{
- quint32 mode = 0;
- if (perms & (QFile::ReadOwner | QFile::ReadUser))
- mode |= UnixFileAttributes::ReadUser;
- if (perms & (QFile::WriteOwner | QFile::WriteUser))
- mode |= UnixFileAttributes::WriteUser;
- if (perms & (QFile::ExeOwner | QFile::ExeUser))
- mode |= UnixFileAttributes::WriteUser;
- if (perms & QFile::ReadGroup)
- mode |= UnixFileAttributes::ReadGroup;
- if (perms & QFile::WriteGroup)
- mode |= UnixFileAttributes::WriteGroup;
- if (perms & QFile::ExeGroup)
- mode |= UnixFileAttributes::ExeGroup;
- if (perms & QFile::ReadOther)
- mode |= UnixFileAttributes::ReadOther;
- if (perms & QFile::WriteOther)
- mode |= UnixFileAttributes::WriteOther;
- if (perms & QFile::ExeOther)
- mode |= UnixFileAttributes::ExeOther;
- return mode;
-}
-
-static QDateTime readMSDosDate(const uchar *src)
-{
- uint dosDate = readUInt(src);
- quint64 uDate;
- uDate = (quint64)(dosDate >> 16);
- uint tm_mday = (uDate & 0x1f);
- uint tm_mon = ((uDate & 0x1E0) >> 5);
- uint tm_year = (((uDate & 0x0FE00) >> 9) + 1980);
- uint tm_hour = ((dosDate & 0xF800) >> 11);
- uint tm_min = ((dosDate & 0x7E0) >> 5);
- uint tm_sec = ((dosDate & 0x1f) << 1);
-
- return QDateTime(QDate(tm_year, tm_mon, tm_mday), QTime(tm_hour, tm_min, tm_sec));
-}
-
-// for details, see http://www.pkware.com/documents/casestudies/APPNOTE.TXT
-
-enum HostOS {
- HostFAT = 0,
- HostAMIGA = 1,
- HostVMS = 2, // VAX/VMS
- HostUnix = 3,
- HostVM_CMS = 4,
- HostAtari = 5, // what if it's a minix filesystem? [cjh]
- HostHPFS = 6, // filesystem used by OS/2 (and NT 3.x)
- HostMac = 7,
- HostZ_System = 8,
- HostCPM = 9,
- HostTOPS20 = 10, // pkzip 2.50 NTFS
- HostNTFS = 11, // filesystem used by Windows NT
- HostQDOS = 12, // SMS/QDOS
- HostAcorn = 13, // Archimedes Acorn RISC OS
- HostVFAT = 14, // filesystem used by Windows 95, NT
- HostMVS = 15,
- HostBeOS = 16, // hybrid POSIX/database filesystem
- HostTandem = 17,
- HostOS400 = 18,
- HostOSX = 19
-};
-Q_DECLARE_TYPEINFO(HostOS, Q_PRIMITIVE_TYPE);
-
-enum GeneralPurposeFlag {
- Encrypted = 0x01,
- AlgTune1 = 0x02,
- AlgTune2 = 0x04,
- HasDataDescriptor = 0x08,
- PatchedData = 0x20,
- StrongEncrypted = 0x40,
- Utf8Names = 0x0800,
- CentralDirectoryEncrypted = 0x2000
-};
-Q_DECLARE_TYPEINFO(GeneralPurposeFlag, Q_PRIMITIVE_TYPE);
-
-enum CompressionMethod {
- CompressionMethodStored = 0,
- CompressionMethodShrunk = 1,
- CompressionMethodReduced1 = 2,
- CompressionMethodReduced2 = 3,
- CompressionMethodReduced3 = 4,
- CompressionMethodReduced4 = 5,
- CompressionMethodImploded = 6,
- CompressionMethodReservedTokenizing = 7, // reserved for tokenizing
- CompressionMethodDeflated = 8,
- CompressionMethodDeflated64 = 9,
- CompressionMethodPKImploding = 10,
-
- CompressionMethodBZip2 = 12,
-
- CompressionMethodLZMA = 14,
-
- CompressionMethodTerse = 18,
- CompressionMethodLz77 = 19,
-
- CompressionMethodJpeg = 96,
- CompressionMethodWavPack = 97,
- CompressionMethodPPMd = 98,
- CompressionMethodWzAES = 99
-};
-Q_DECLARE_TYPEINFO(CompressionMethod, Q_PRIMITIVE_TYPE);
-
-struct LocalFileHeader
-{
- uchar signature[4]; // 0x04034b50
- uchar version_needed[2];
- uchar general_purpose_bits[2];
- uchar compression_method[2];
- uchar last_mod_file[4];
- uchar crc_32[4];
- uchar compressed_size[4];
- uchar uncompressed_size[4];
- uchar file_name_length[2];
- uchar extra_field_length[2];
-};
-Q_DECLARE_TYPEINFO(LocalFileHeader, Q_PRIMITIVE_TYPE);
-
-struct DataDescriptor
-{
- uchar crc_32[4];
- uchar compressed_size[4];
- uchar uncompressed_size[4];
-};
-Q_DECLARE_TYPEINFO(DataDescriptor, Q_PRIMITIVE_TYPE);
-
-struct CentralFileHeader
-{
- uchar signature[4]; // 0x02014b50
- uchar version_made[2];
- uchar version_needed[2];
- uchar general_purpose_bits[2];
- uchar compression_method[2];
- uchar last_mod_file[4];
- uchar crc_32[4];
- uchar compressed_size[4];
- uchar uncompressed_size[4];
- uchar file_name_length[2];
- uchar extra_field_length[2];
- uchar file_comment_length[2];
- uchar disk_start[2];
- uchar internal_file_attributes[2];
- uchar external_file_attributes[4];
- uchar offset_local_header[4];
-};
-Q_DECLARE_TYPEINFO(CentralFileHeader, Q_PRIMITIVE_TYPE);
-
-struct EndOfDirectory
-{
- uchar signature[4]; // 0x06054b50
- uchar this_disk[2];
- uchar start_of_directory_disk[2];
- uchar num_dir_entries_this_disk[2];
- uchar num_dir_entries[2];
- uchar directory_size[4];
- uchar dir_start_offset[4];
- uchar comment_length[2];
-};
-Q_DECLARE_TYPEINFO(EndOfDirectory, Q_PRIMITIVE_TYPE);
-
-struct FileHeader
-{
- CentralFileHeader h;
- QByteArray file_name;
- QByteArray extra_field;
- QByteArray file_comment;
-};
-Q_DECLARE_TYPEINFO(FileHeader, Q_MOVABLE_TYPE);
-
-class QZipPrivate
-{
-public:
- QZipPrivate(QIODevice *device, bool ownDev)
- : device(device), ownDevice(ownDev), dirtyFileTree(true), start_of_directory(0)
- {
- }
-
- ~QZipPrivate()
- {
- if (ownDevice)
- delete device;
- }
-
- QZipReader::FileInfo fillFileInfo(int index) const;
-
- QIODevice *device;
- bool ownDevice;
- bool dirtyFileTree;
- QVector<FileHeader> fileHeaders;
- QByteArray comment;
- uint start_of_directory;
-};
-
-QZipReader::FileInfo QZipPrivate::fillFileInfo(int index) const
-{
- QZipReader::FileInfo fileInfo;
- FileHeader header = fileHeaders.at(index);
- quint32 mode = readUInt(header.h.external_file_attributes);
- const HostOS hostOS = HostOS(readUShort(header.h.version_made) >> 8);
- switch (hostOS) {
- case HostUnix:
- mode = (mode >> 16) & 0xffff;
- switch (mode & UnixFileAttributes::TypeMask) {
- case UnixFileAttributes::SymLink:
- fileInfo.isSymLink = true;
- break;
- case UnixFileAttributes::Dir:
- fileInfo.isDir = true;
- break;
- case UnixFileAttributes::File:
- default: // ### just for the case; should we warn?
- fileInfo.isFile = true;
- break;
- }
- fileInfo.permissions = modeToPermissions(mode);
- break;
- case HostFAT:
- case HostNTFS:
- case HostHPFS:
- case HostVFAT:
- switch (mode & WindowsFileAttributes::TypeMask) {
- case WindowsFileAttributes::Dir:
- fileInfo.isDir = true;
- break;
- case WindowsFileAttributes::File:
- default:
- fileInfo.isFile = true;
- break;
- }
- fileInfo.permissions |= QFile::ReadOwner | QFile::ReadUser | QFile::ReadGroup | QFile::ReadOther;
- if ((mode & WindowsFileAttributes::ReadOnly) == 0)
- fileInfo.permissions |= QFile::WriteOwner | QFile::WriteUser | QFile::WriteGroup | QFile::WriteOther;
- if (fileInfo.isDir)
- fileInfo.permissions |= QFile::ExeOwner | QFile::ExeUser | QFile::ExeGroup | QFile::ExeOther;
- break;
- default:
- qWarning("QZip: Zip entry format at %d is not supported.", index);
- return fileInfo; // we don't support anything else
- }
-
- ushort general_purpose_bits = readUShort(header.h.general_purpose_bits);
- // if bit 11 is set, the filename and comment fields must be encoded using UTF-8
- const bool inUtf8 = (general_purpose_bits & Utf8Names) != 0;
- fileInfo.filePath = inUtf8 ? QString::fromUtf8(header.file_name) : QString::fromLocal8Bit(header.file_name);
- fileInfo.crc = readUInt(header.h.crc_32);
- fileInfo.size = readUInt(header.h.uncompressed_size);
- fileInfo.lastModified = readMSDosDate(header.h.last_mod_file);
-
- // fix the file path, if broken (convert separators, eat leading and trailing ones)
- fileInfo.filePath = QDir::fromNativeSeparators(fileInfo.filePath);
- QStringRef filePathRef(&fileInfo.filePath);
- while (filePathRef.startsWith(QLatin1Char('.')) || filePathRef.startsWith(QLatin1Char('/')))
- filePathRef = filePathRef.mid(1);
- while (filePathRef.endsWith(QLatin1Char('/')))
- filePathRef.chop(1);
-
- fileInfo.filePath = filePathRef.toString();
- return fileInfo;
-}
-
-class QZipReaderPrivate : public QZipPrivate
-{
-public:
- QZipReaderPrivate(QIODevice *device, bool ownDev)
- : QZipPrivate(device, ownDev), status(QZipReader::NoError)
- {
- }
-
- void scanFiles();
-
- QZipReader::Status status;
-};
-
-class QZipWriterPrivate : public QZipPrivate
-{
-public:
- QZipWriterPrivate(QIODevice *device, bool ownDev)
- : QZipPrivate(device, ownDev),
- status(QZipWriter::NoError),
- permissions(QFile::ReadOwner | QFile::WriteOwner),
- compressionPolicy(QZipWriter::AlwaysCompress)
- {
- }
-
- QZipWriter::Status status;
- QFile::Permissions permissions;
- QZipWriter::CompressionPolicy compressionPolicy;
-
- enum EntryType { Directory, File, Symlink };
-
- void addEntry(EntryType type, const QString &fileName, const QByteArray &contents);
-};
-
-static LocalFileHeader toLocalHeader(const CentralFileHeader &ch)
-{
- LocalFileHeader h;
- writeUInt(h.signature, 0x04034b50);
- copyUShort(h.version_needed, ch.version_needed);
- copyUShort(h.general_purpose_bits, ch.general_purpose_bits);
- copyUShort(h.compression_method, ch.compression_method);
- copyUInt(h.last_mod_file, ch.last_mod_file);
- copyUInt(h.crc_32, ch.crc_32);
- copyUInt(h.compressed_size, ch.compressed_size);
- copyUInt(h.uncompressed_size, ch.uncompressed_size);
- copyUShort(h.file_name_length, ch.file_name_length);
- copyUShort(h.extra_field_length, ch.extra_field_length);
- return h;
-}
-
-void QZipReaderPrivate::scanFiles()
-{
- if (!dirtyFileTree)
- return;
-
- if (! (device->isOpen() || device->open(QIODevice::ReadOnly))) {
- status = QZipReader::FileOpenError;
- return;
- }
-
- if ((device->openMode() & QIODevice::ReadOnly) == 0) { // only read the index from readable files.
- status = QZipReader::FileReadError;
- return;
- }
-
- dirtyFileTree = false;
- uchar tmp[4];
- device->read((char *)tmp, 4);
- if (readUInt(tmp) != 0x04034b50) {
- qWarning("QZip: not a zip file!");
- return;
- }
-
- // find EndOfDirectory header
- int i = 0;
- int start_of_directory = -1;
- int num_dir_entries = 0;
- EndOfDirectory eod;
- while (start_of_directory == -1) {
- const int pos = device->size() - int(sizeof(EndOfDirectory)) - i;
- if (pos < 0 || i > 65535) {
- qWarning("QZip: EndOfDirectory not found");
- return;
- }
-
- device->seek(pos);
- device->read((char *)&eod, sizeof(EndOfDirectory));
- if (readUInt(eod.signature) == 0x06054b50)
- break;
- ++i;
- }
-
- // have the eod
- start_of_directory = readUInt(eod.dir_start_offset);
- num_dir_entries = readUShort(eod.num_dir_entries);
- ZDEBUG("start_of_directory at %d, num_dir_entries=%d", start_of_directory, num_dir_entries);
- int comment_length = readUShort(eod.comment_length);
- if (comment_length != i)
- qWarning("QZip: failed to parse zip file.");
- comment = device->read(qMin(comment_length, i));
-
-
- device->seek(start_of_directory);
- for (i = 0; i < num_dir_entries; ++i) {
- FileHeader header;
- int read = device->read((char *) &header.h, sizeof(CentralFileHeader));
- if (read < (int)sizeof(CentralFileHeader)) {
- qWarning("QZip: Failed to read complete header, index may be incomplete");
- break;
- }
- if (readUInt(header.h.signature) != 0x02014b50) {
- qWarning("QZip: invalid header signature, index may be incomplete");
- break;
- }
-
- int l = readUShort(header.h.file_name_length);
- header.file_name = device->read(l);
- if (header.file_name.length() != l) {
- qWarning("QZip: Failed to read filename from zip index, index may be incomplete");
- break;
- }
- l = readUShort(header.h.extra_field_length);
- header.extra_field = device->read(l);
- if (header.extra_field.length() != l) {
- qWarning("QZip: Failed to read extra field in zip file, skipping file, index may be incomplete");
- break;
- }
- l = readUShort(header.h.file_comment_length);
- header.file_comment = device->read(l);
- if (header.file_comment.length() != l) {
- qWarning("QZip: Failed to read read file comment, index may be incomplete");
- break;
- }
-
- ZDEBUG("found file '%s'", header.file_name.data());
- fileHeaders.append(header);
- }
-}
-
-void QZipWriterPrivate::addEntry(EntryType type, const QString &fileName, const QByteArray &contents/*, QFile::Permissions permissions, QZip::Method m*/)
-{
-#ifndef NDEBUG
- static const char *const entryTypes[] = {
- "directory",
- "file ",
- "symlink " };
- ZDEBUG() << "adding" << entryTypes[type] <<":" << fileName.toUtf8().data() << (type == 2 ? QByteArray(" -> " + contents).constData() : "");
-#endif
-
- if (! (device->isOpen() || device->open(QIODevice::WriteOnly))) {
- status = QZipWriter::FileOpenError;
- return;
- }
- device->seek(start_of_directory);
-
- // don't compress small files
- QZipWriter::CompressionPolicy compression = compressionPolicy;
- if (compressionPolicy == QZipWriter::AutoCompress) {
- if (contents.length() < 64)
- compression = QZipWriter::NeverCompress;
- else
- compression = QZipWriter::AlwaysCompress;
- }
-
- FileHeader header;
- memset(&header.h, 0, sizeof(CentralFileHeader));
- writeUInt(header.h.signature, 0x02014b50);
-
- writeUShort(header.h.version_needed, ZIP_VERSION);
- writeUInt(header.h.uncompressed_size, contents.length());
- writeMSDosDate(header.h.last_mod_file, QDateTime::currentDateTime());
- QByteArray data = contents;
- if (compression == QZipWriter::AlwaysCompress) {
- writeUShort(header.h.compression_method, CompressionMethodDeflated);
-
- ulong len = contents.length();
- // shamelessly copied form zlib
- len += (len >> 12) + (len >> 14) + 11;
- int res;
- do {
- data.resize(len);
- res = deflate((uchar*)data.data(), &len, (const uchar*)contents.constData(), contents.length());
-
- switch (res) {
- case Z_OK:
- data.resize(len);
- break;
- case Z_MEM_ERROR:
- qWarning("QZip: Z_MEM_ERROR: Not enough memory to compress file, skipping");
- data.resize(0);
- break;
- case Z_BUF_ERROR:
- len *= 2;
- break;
- }
- } while (res == Z_BUF_ERROR);
- }
-// TODO add a check if data.length() > contents.length(). Then try to store the original and revert the compression method to be uncompressed
- writeUInt(header.h.compressed_size, data.length());
- uint crc_32 = ::crc32(0, nullptr, 0);
- crc_32 = ::crc32(crc_32, (const uchar *)contents.constData(), contents.length());
- writeUInt(header.h.crc_32, crc_32);
-
- // if bit 11 is set, the filename and comment fields must be encoded using UTF-8
- ushort general_purpose_bits = Utf8Names; // always use utf-8
- writeUShort(header.h.general_purpose_bits, general_purpose_bits);
-
- const bool inUtf8 = (general_purpose_bits & Utf8Names) != 0;
- header.file_name = inUtf8 ? fileName.toUtf8() : fileName.toLocal8Bit();
- if (header.file_name.size() > 0xffff) {
- qWarning("QZip: Filename is too long, chopping it to 65535 bytes");
- header.file_name = header.file_name.left(0xffff); // ### don't break the utf-8 sequence, if any
- }
- if (header.file_comment.size() + header.file_name.size() > 0xffff) {
- qWarning("QZip: File comment is too long, chopping it to 65535 bytes");
- header.file_comment.truncate(0xffff - header.file_name.size()); // ### don't break the utf-8 sequence, if any
- }
- writeUShort(header.h.file_name_length, header.file_name.length());
- //h.extra_field_length[2];
-
- writeUShort(header.h.version_made, HostUnix << 8);
- //uchar internal_file_attributes[2];
- //uchar external_file_attributes[4];
- quint32 mode = permissionsToMode(permissions);
- switch (type) {
- case Symlink:
- mode |= UnixFileAttributes::SymLink;
- break;
- case Directory:
- mode |= UnixFileAttributes::Dir;
- break;
- case File:
- mode |= UnixFileAttributes::File;
- break;
- default:
- Q_UNREACHABLE();
- break;
- }
- writeUInt(header.h.external_file_attributes, mode << 16);
- writeUInt(header.h.offset_local_header, start_of_directory);
-
-
- fileHeaders.append(header);
-
- LocalFileHeader h = toLocalHeader(header.h);
- device->write((const char *)&h, sizeof(LocalFileHeader));
- device->write(header.file_name);
- device->write(data);
- start_of_directory = device->pos();
- dirtyFileTree = true;
-}
-
-////////////////////////////// Reader
-
-/*!
- \class QZipReader::FileInfo
- \internal
- Represents one entry in the zip table of contents.
-*/
-
-/*!
- \variable FileInfo::filePath
- The full filepath inside the archive.
-*/
-
-/*!
- \variable FileInfo::isDir
- A boolean type indicating if the entry is a directory.
-*/
-
-/*!
- \variable FileInfo::isFile
- A boolean type, if it is one this entry is a file.
-*/
-
-/*!
- \variable FileInfo::isSymLink
- A boolean type, if it is one this entry is symbolic link.
-*/
-
-/*!
- \variable FileInfo::permissions
- A list of flags for the permissions of this entry.
-*/
-
-/*!
- \variable FileInfo::crc
- The calculated checksum as a crc type.
-*/
-
-/*!
- \variable FileInfo::size
- The total size of the unpacked content.
-*/
-
-/*!
- \class QZipReader
- \internal
- \since 4.5
-
- \brief the QZipReader class provides a way to inspect the contents of a zip
- archive and extract individual files from it.
-
- QZipReader can be used to read a zip archive either from a file or from any
- device. An in-memory QBuffer for instance. The reader can be used to read
- which files are in the archive using fileInfoList() and entryInfoAt() but
- also to extract individual files using fileData() or even to extract all
- files in the archive using extractAll()
-*/
-
-/*!
- Create a new zip archive that operates on the \a fileName. The file will be
- opened with the \a mode.
-*/
-QZipReader::QZipReader(const QString &archive, QIODevice::OpenMode mode)
-{
- QScopedPointer<QFile> f(new QFile(archive));
- const bool result = f->open(mode);
- QZipReader::Status status;
- const QFileDevice::FileError error = f->error();
- if (result && error == QFile::NoError) {
- status = NoError;
- } else {
- if (error == QFile::ReadError)
- status = FileReadError;
- else if (error == QFile::OpenError)
- status = FileOpenError;
- else if (error == QFile::PermissionsError)
- status = FilePermissionsError;
- else
- status = FileError;
- }
-
- d = new QZipReaderPrivate(f.data(), /*ownDevice=*/true);
- f.take();
- d->status = status;
-}
-
-/*!
- Create a new zip archive that operates on the archive found in \a device.
- You have to open the device previous to calling the constructor and only a
- device that is readable will be scanned for zip filecontent.
- */
-QZipReader::QZipReader(QIODevice *device)
- : d(new QZipReaderPrivate(device, /*ownDevice=*/false))
-{
- Q_ASSERT(device);
-}
-
-/*!
- Desctructor
-*/
-QZipReader::~QZipReader()
-{
- close();
- delete d;
-}
-
-/*!
- Returns device used for reading zip archive.
-*/
-QIODevice* QZipReader::device() const
-{
- return d->device;
-}
-
-/*!
- Returns \c true if the user can read the file; otherwise returns \c false.
-*/
-bool QZipReader::isReadable() const
-{
- return d->device->isReadable();
-}
-
-/*!
- Returns \c true if the file exists; otherwise returns \c false.
-*/
-bool QZipReader::exists() const
-{
- QFile *f = qobject_cast<QFile*> (d->device);
- if (f == nullptr)
- return true;
- return f->exists();
-}
-
-/*!
- Returns the list of files the archive contains.
-*/
-QVector<QZipReader::FileInfo> QZipReader::fileInfoList() const
-{
- d->scanFiles();
- QVector<FileInfo> files;
- const int numFileHeaders = d->fileHeaders.size();
- files.reserve(numFileHeaders);
- for (int i = 0; i < numFileHeaders; ++i)
- files.append(d->fillFileInfo(i));
- return files;
-
-}
-
-/*!
- Return the number of items in the zip archive.
-*/
-int QZipReader::count() const
-{
- d->scanFiles();
- return d->fileHeaders.count();
-}
-
-/*!
- Returns a FileInfo of an entry in the zipfile.
- The \a index is the index into the directory listing of the zipfile.
- Returns an invalid FileInfo if \a index is out of boundaries.
-
- \sa fileInfoList()
-*/
-QZipReader::FileInfo QZipReader::entryInfoAt(int index) const
-{
- d->scanFiles();
- if (index >= 0 && index < d->fileHeaders.count())
- return d->fillFileInfo(index);
- return QZipReader::FileInfo();
-}
-
-/*!
- Fetch the file contents from the zip archive and return the uncompressed bytes.
-*/
-QByteArray QZipReader::fileData(const QString &fileName) const
-{
- d->scanFiles();
- int i;
- for (i = 0; i < d->fileHeaders.size(); ++i) {
- if (QString::fromLocal8Bit(d->fileHeaders.at(i).file_name) == fileName)
- break;
- }
- if (i == d->fileHeaders.size())
- return QByteArray();
-
- FileHeader header = d->fileHeaders.at(i);
-
- ushort version_needed = readUShort(header.h.version_needed);
- if (version_needed > ZIP_VERSION) {
- qWarning("QZip: .ZIP specification version %d implementationis needed to extract the data.", version_needed);
- return QByteArray();
- }
-
- ushort general_purpose_bits = readUShort(header.h.general_purpose_bits);
- int compressed_size = readUInt(header.h.compressed_size);
- int uncompressed_size = readUInt(header.h.uncompressed_size);
- int start = readUInt(header.h.offset_local_header);
- //qDebug("uncompressing file %d: local header at %d", i, start);
-
- d->device->seek(start);
- LocalFileHeader lh;
- d->device->read((char *)&lh, sizeof(LocalFileHeader));
- uint skip = readUShort(lh.file_name_length) + readUShort(lh.extra_field_length);
- d->device->seek(d->device->pos() + skip);
-
- int compression_method = readUShort(lh.compression_method);
- //qDebug("file=%s: compressed_size=%d, uncompressed_size=%d", fileName.toLocal8Bit().data(), compressed_size, uncompressed_size);
-
- if ((general_purpose_bits & Encrypted) != 0) {
- qWarning("QZip: Unsupported encryption method is needed to extract the data.");
- return QByteArray();
- }
-
- //qDebug("file at %lld", d->device->pos());
- QByteArray compressed = d->device->read(compressed_size);
- if (compression_method == CompressionMethodStored) {
- // no compression
- compressed.truncate(uncompressed_size);
- return compressed;
- } else if (compression_method == CompressionMethodDeflated) {
- // Deflate
- //qDebug("compressed=%d", compressed.size());
- compressed.truncate(compressed_size);
- QByteArray baunzip;
- ulong len = qMax(uncompressed_size, 1);
- int res;
- do {
- baunzip.resize(len);
- res = inflate((uchar*)baunzip.data(), &len,
- (const uchar*)compressed.constData(), compressed_size);
-
- switch (res) {
- case Z_OK:
- if ((int)len != baunzip.size())
- baunzip.resize(len);
- break;
- case Z_MEM_ERROR:
- qWarning("QZip: Z_MEM_ERROR: Not enough memory");
- break;
- case Z_BUF_ERROR:
- len *= 2;
- break;
- case Z_DATA_ERROR:
- qWarning("QZip: Z_DATA_ERROR: Input data is corrupted");
- break;
- }
- } while (res == Z_BUF_ERROR);
- return baunzip;
- }
-
- qWarning("QZip: Unsupported compression method %d is needed to extract the data.", compression_method);
- return QByteArray();
-}
-
-/*!
- Extracts the full contents of the zip file into \a destinationDir on
- the local filesystem.
- In case writing or linking a file fails, the extraction will be aborted.
-*/
-bool QZipReader::extractAll(const QString &destinationDir) const
-{
- QDir baseDir(destinationDir);
-
- // create directories first
- const QVector<FileInfo> allFiles = fileInfoList();
- for (const FileInfo &fi : allFiles) {
- const QString absPath = destinationDir + QDir::separator() + fi.filePath;
- if (fi.isDir) {
- if (!baseDir.mkpath(fi.filePath))
- return false;
- if (!QFile::setPermissions(absPath, fi.permissions))
- return false;
- }
- }
-
- // set up symlinks
- for (const FileInfo &fi : allFiles) {
- const QString absPath = destinationDir + QDir::separator() + fi.filePath;
- if (fi.isSymLink) {
- QString destination = QFile::decodeName(fileData(fi.filePath));
- if (destination.isEmpty())
- return false;
- QFileInfo linkFi(absPath);
- if (!QFile::exists(linkFi.absolutePath()))
- QDir::root().mkpath(linkFi.absolutePath());
- if (!QFile::link(destination, absPath))
- return false;
- /* cannot change permission of links
- if (!QFile::setPermissions(absPath, fi.permissions))
- return false;
- */
- }
- }
-
- for (const FileInfo &fi : allFiles) {
- const QString absPath = destinationDir + QDir::separator() + fi.filePath;
- if (fi.isFile) {
- QFile f(absPath);
- if (!f.open(QIODevice::WriteOnly))
- return false;
- f.write(fileData(fi.filePath));
- f.setPermissions(fi.permissions);
- f.close();
- }
- }
-
- return true;
-}
-
-/*!
- \enum QZipReader::Status
-
- The following status values are possible:
-
- \value NoError No error occurred.
- \value FileReadError An error occurred when reading from the file.
- \value FileOpenError The file could not be opened.
- \value FilePermissionsError The file could not be accessed.
- \value FileError Another file error occurred.
-*/
-
-/*!
- Returns a status code indicating the first error that was met by QZipReader,
- or QZipReader::NoError if no error occurred.
-*/
-QZipReader::Status QZipReader::status() const
-{
- return d->status;
-}
-
-/*!
- Close the zip file.
-*/
-void QZipReader::close()
-{
- d->device->close();
-}
-
-////////////////////////////// Writer
-
-/*!
- \class QZipWriter
- \internal
- \since 4.5
-
- \brief the QZipWriter class provides a way to create a new zip archive.
-
- QZipWriter can be used to create a zip archive containing any number of files
- and directories. The files in the archive will be compressed in a way that is
- compatible with common zip reader applications.
-*/
-
-
-/*!
- Create a new zip archive that operates on the \a archive filename. The file will
- be opened with the \a mode.
- \sa isValid()
-*/
-QZipWriter::QZipWriter(const QString &fileName, QIODevice::OpenMode mode)
-{
- QScopedPointer<QFile> f(new QFile(fileName));
- QZipWriter::Status status;
- if (f->open(mode) && f->error() == QFile::NoError)
- status = QZipWriter::NoError;
- else {
- if (f->error() == QFile::WriteError)
- status = QZipWriter::FileWriteError;
- else if (f->error() == QFile::OpenError)
- status = QZipWriter::FileOpenError;
- else if (f->error() == QFile::PermissionsError)
- status = QZipWriter::FilePermissionsError;
- else
- status = QZipWriter::FileError;
- }
-
- d = new QZipWriterPrivate(f.data(), /*ownDevice=*/true);
- f.take();
- d->status = status;
-}
-
-/*!
- Create a new zip archive that operates on the archive found in \a device.
- You have to open the device previous to calling the constructor and
- only a device that is readable will be scanned for zip filecontent.
- */
-QZipWriter::QZipWriter(QIODevice *device)
- : d(new QZipWriterPrivate(device, /*ownDevice=*/false))
-{
- Q_ASSERT(device);
-}
-
-QZipWriter::~QZipWriter()
-{
- close();
- delete d;
-}
-
-/*!
- Returns device used for writing zip archive.
-*/
-QIODevice* QZipWriter::device() const
-{
- return d->device;
-}
-
-/*!
- Returns \c true if the user can write to the archive; otherwise returns \c false.
-*/
-bool QZipWriter::isWritable() const
-{
- return d->device->isWritable();
-}
-
-/*!
- Returns \c true if the file exists; otherwise returns \c false.
-*/
-bool QZipWriter::exists() const
-{
- QFile *f = qobject_cast<QFile*> (d->device);
- if (f == nullptr)
- return true;
- return f->exists();
-}
-
-/*!
- \enum QZipWriter::Status
-
- The following status values are possible:
-
- \value NoError No error occurred.
- \value FileWriteError An error occurred when writing to the device.
- \value FileOpenError The file could not be opened.
- \value FilePermissionsError The file could not be accessed.
- \value FileError Another file error occurred.
-*/
-
-/*!
- Returns a status code indicating the first error that was met by QZipWriter,
- or QZipWriter::NoError if no error occurred.
-*/
-QZipWriter::Status QZipWriter::status() const
-{
- return d->status;
-}
-
-/*!
- \enum QZipWriter::CompressionPolicy
-
- \value AlwaysCompress A file that is added is compressed.
- \value NeverCompress A file that is added will be stored without changes.
- \value AutoCompress A file that is added will be compressed only if that will give a smaller file.
-*/
-
-/*!
- Sets the policy for compressing newly added files to the new \a policy.
-
- \note the default policy is AlwaysCompress
-
- \sa compressionPolicy()
- \sa addFile()
-*/
-void QZipWriter::setCompressionPolicy(CompressionPolicy policy)
-{
- d->compressionPolicy = policy;
-}
-
-/*!
- Returns the currently set compression policy.
- \sa setCompressionPolicy()
- \sa addFile()
-*/
-QZipWriter::CompressionPolicy QZipWriter::compressionPolicy() const
-{
- return d->compressionPolicy;
-}
-
-/*!
- Sets the permissions that will be used for newly added files.
-
- \note the default permissions are QFile::ReadOwner | QFile::WriteOwner.
-
- \sa creationPermissions()
- \sa addFile()
-*/
-void QZipWriter::setCreationPermissions(QFile::Permissions permissions)
-{
- d->permissions = permissions;
-}
-
-/*!
- Returns the currently set creation permissions.
-
- \sa setCreationPermissions()
- \sa addFile()
-*/
-QFile::Permissions QZipWriter::creationPermissions() const
-{
- return d->permissions;
-}
-
-/*!
- Add a file to the archive with \a data as the file contents.
- The file will be stored in the archive using the \a fileName which
- includes the full path in the archive.
-
- The new file will get the file permissions based on the current
- creationPermissions and it will be compressed using the zip compression
- based on the current compression policy.
-
- \sa setCreationPermissions()
- \sa setCompressionPolicy()
-*/
-void QZipWriter::addFile(const QString &fileName, const QByteArray &data)
-{
- d->addEntry(QZipWriterPrivate::File, QDir::fromNativeSeparators(fileName), data);
-}
-
-/*!
- Add a file to the archive with \a device as the source of the contents.
- The contents returned from QIODevice::readAll() will be used as the
- filedata.
- The file will be stored in the archive using the \a fileName which
- includes the full path in the archive.
-*/
-void QZipWriter::addFile(const QString &fileName, QIODevice *device)
-{
- Q_ASSERT(device);
- QIODevice::OpenMode mode = device->openMode();
- bool opened = false;
- if ((mode & QIODevice::ReadOnly) == 0) {
- opened = true;
- if (! device->open(QIODevice::ReadOnly)) {
- d->status = FileOpenError;
- return;
- }
- }
- d->addEntry(QZipWriterPrivate::File, QDir::fromNativeSeparators(fileName), device->readAll());
- if (opened)
- device->close();
-}
-
-/*!
- Create a new directory in the archive with the specified \a dirName and
- the \a permissions;
-*/
-void QZipWriter::addDirectory(const QString &dirName)
-{
- QString name(QDir::fromNativeSeparators(dirName));
- // separator is mandatory
- if (!name.endsWith(QLatin1Char('/')))
- name.append(QLatin1Char('/'));
- d->addEntry(QZipWriterPrivate::Directory, name, QByteArray());
-}
-
-/*!
- Create a new symbolic link in the archive with the specified \a dirName
- and the \a permissions;
- A symbolic link contains the destination (relative) path and name.
-*/
-void QZipWriter::addSymLink(const QString &fileName, const QString &destination)
-{
- d->addEntry(QZipWriterPrivate::Symlink, QDir::fromNativeSeparators(fileName), QFile::encodeName(destination));
-}
-
-/*!
- Closes the zip file.
-*/
-void QZipWriter::close()
-{
- if (!(d->device->openMode() & QIODevice::WriteOnly)) {
- d->device->close();
- return;
- }
-
- //qDebug("QZip::close writing directory, %d entries", d->fileHeaders.size());
- d->device->seek(d->start_of_directory);
- // write new directory
- for (int i = 0; i < d->fileHeaders.size(); ++i) {
- const FileHeader &header = d->fileHeaders.at(i);
- d->device->write((const char *)&header.h, sizeof(CentralFileHeader));
- d->device->write(header.file_name);
- d->device->write(header.extra_field);
- d->device->write(header.file_comment);
- }
- int dir_size = d->device->pos() - d->start_of_directory;
- // write end of directory
- EndOfDirectory eod;
- memset(&eod, 0, sizeof(EndOfDirectory));
- writeUInt(eod.signature, 0x06054b50);
- //uchar this_disk[2];
- //uchar start_of_directory_disk[2];
- writeUShort(eod.num_dir_entries_this_disk, d->fileHeaders.size());
- writeUShort(eod.num_dir_entries, d->fileHeaders.size());
- writeUInt(eod.directory_size, dir_size);
- writeUInt(eod.dir_start_offset, d->start_of_directory);
- writeUShort(eod.comment_length, d->comment.length());
-
- d->device->write((const char *)&eod, sizeof(EndOfDirectory));
- d->device->write(d->comment);
- d->device->close();
-}
-
-QT_END_NAMESPACE
-
-#endif // QT_NO_TEXTODFWRITER
diff --git a/src/gui/text/qzipreader_p.h b/src/gui/text/qzipreader_p.h
deleted file mode 100644
index 6fec8d7719..0000000000
--- a/src/gui/text/qzipreader_p.h
+++ /dev/null
@@ -1,127 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the QtGui module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef QZIPREADER_H
-#define QZIPREADER_H
-
-#include <QtGui/private/qtguiglobal_p.h>
-#include <QtCore/qglobal.h>
-
-#ifndef QT_NO_TEXTODFWRITER
-
-//
-// W A R N I N G
-// -------------
-//
-// This file is not part of the Qt API. It exists for the convenience
-// of the QZipReader class. This header file may change from
-// version to version without notice, or even be removed.
-//
-// We mean it.
-//
-
-#include <QtCore/qdatetime.h>
-#include <QtCore/qfile.h>
-#include <QtCore/qstring.h>
-
-QT_BEGIN_NAMESPACE
-
-class QZipReaderPrivate;
-
-class Q_GUI_EXPORT QZipReader
-{
-public:
- explicit QZipReader(const QString &fileName, QIODevice::OpenMode mode = QIODevice::ReadOnly );
-
- explicit QZipReader(QIODevice *device);
- ~QZipReader();
-
- QIODevice* device() const;
-
- bool isReadable() const;
- bool exists() const;
-
- struct FileInfo
- {
- FileInfo() noexcept
- : isDir(false), isFile(false), isSymLink(false), crc(0), size(0)
- {}
-
- bool isValid() const noexcept { return isDir || isFile || isSymLink; }
-
- QString filePath;
- uint isDir : 1;
- uint isFile : 1;
- uint isSymLink : 1;
- QFile::Permissions permissions;
- uint crc;
- qint64 size;
- QDateTime lastModified;
- };
-
- QVector<FileInfo> fileInfoList() const;
- int count() const;
-
- FileInfo entryInfoAt(int index) const;
- QByteArray fileData(const QString &fileName) const;
- bool extractAll(const QString &destinationDir) const;
-
- enum Status {
- NoError,
- FileReadError,
- FileOpenError,
- FilePermissionsError,
- FileError
- };
-
- Status status() const;
-
- void close();
-
-private:
- QZipReaderPrivate *d;
- Q_DISABLE_COPY_MOVE(QZipReader)
-};
-Q_DECLARE_TYPEINFO(QZipReader::FileInfo, Q_MOVABLE_TYPE);
-Q_DECLARE_TYPEINFO(QZipReader::Status, Q_PRIMITIVE_TYPE);
-
-QT_END_NAMESPACE
-
-#endif // QT_NO_TEXTODFWRITER
-#endif // QZIPREADER_H
diff --git a/src/gui/text/qzipwriter_p.h b/src/gui/text/qzipwriter_p.h
deleted file mode 100644
index b3bb5929cf..0000000000
--- a/src/gui/text/qzipwriter_p.h
+++ /dev/null
@@ -1,117 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the QtGui module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-#ifndef QZIPWRITER_H
-#define QZIPWRITER_H
-
-#include <QtGui/private/qtguiglobal_p.h>
-
-#ifndef QT_NO_TEXTODFWRITER
-
-//
-// W A R N I N G
-// -------------
-//
-// This file is not part of the Qt API. It exists for the convenience
-// of the QZipWriter class. This header file may change from
-// version to version without notice, or even be removed.
-//
-// We mean it.
-//
-
-#include <QtCore/qstring.h>
-#include <QtCore/qfile.h>
-
-QT_BEGIN_NAMESPACE
-
-class QZipWriterPrivate;
-
-
-class Q_GUI_EXPORT QZipWriter
-{
-public:
- explicit QZipWriter(const QString &fileName, QIODevice::OpenMode mode = (QIODevice::WriteOnly | QIODevice::Truncate) );
-
- explicit QZipWriter(QIODevice *device);
- ~QZipWriter();
-
- QIODevice* device() const;
-
- bool isWritable() const;
- bool exists() const;
-
- enum Status {
- NoError,
- FileWriteError,
- FileOpenError,
- FilePermissionsError,
- FileError
- };
-
- Status status() const;
-
- enum CompressionPolicy {
- AlwaysCompress,
- NeverCompress,
- AutoCompress
- };
-
- void setCompressionPolicy(CompressionPolicy policy);
- CompressionPolicy compressionPolicy() const;
-
- void setCreationPermissions(QFile::Permissions permissions);
- QFile::Permissions creationPermissions() const;
-
- void addFile(const QString &fileName, const QByteArray &data);
-
- void addFile(const QString &fileName, QIODevice *device);
-
- void addDirectory(const QString &dirName);
-
- void addSymLink(const QString &fileName, const QString &destination);
-
- void close();
-private:
- QZipWriterPrivate *d;
- Q_DISABLE_COPY_MOVE(QZipWriter)
-};
-
-QT_END_NAMESPACE
-
-#endif // QT_NO_TEXTODFWRITER
-#endif // QZIPWRITER_H
diff --git a/src/gui/text/text.pri b/src/gui/text/text.pri
deleted file mode 100644
index 5e97b312f1..0000000000
--- a/src/gui/text/text.pri
+++ /dev/null
@@ -1,124 +0,0 @@
-# Qt kernel module
-
-HEADERS += \
- text/qfont.h \
- text/qfontdatabase.h \
- text/qfontengine_p.h \
- text/qfontengineglyphcache_p.h \
- text/qfontinfo.h \
- text/qfontmetrics.h \
- text/qfont_p.h \
- text/qfontsubset_p.h \
- text/qtextengine_p.h \
- text/qtextlayout.h \
- text/qtextformat.h \
- text/qtextformat_p.h \
- text/qtextobject.h \
- text/qtextobject_p.h \
- text/qtextoption.h \
- text/qfragmentmap_p.h \
- text/qtextdocument.h \
- text/qtextdocument_p.h \
- text/qtexthtmlparser_p.h \
- text/qabstracttextdocumentlayout.h \
- text/qabstracttextdocumentlayout_p.h \
- text/qtextdocumentlayout_p.h \
- text/qtextcursor.h \
- text/qtextcursor_p.h \
- text/qtextdocumentfragment.h \
- text/qtextdocumentfragment_p.h \
- text/qtextimagehandler_p.h \
- text/qtexttable.h \
- text/qtextlist.h \
- text/qsyntaxhighlighter.h \
- text/qtextdocumentwriter.h \
- text/qtexttable_p.h \
- text/qstatictext_p.h \
- text/qstatictext.h \
- text/qrawfont.h \
- text/qrawfont_p.h \
- text/qglyphrun.h \
- text/qglyphrun_p.h \
- text/qdistancefield_p.h \
- text/qinputcontrol_p.h
-
-SOURCES += \
- text/qfont.cpp \
- text/qfontengine.cpp \
- text/qfontengineglyphcache.cpp \
- text/qfontsubset.cpp \
- text/qfontmetrics.cpp \
- text/qfontdatabase.cpp \
- text/qtextengine.cpp \
- text/qtextlayout.cpp \
- text/qtextformat.cpp \
- text/qtextobject.cpp \
- text/qtextoption.cpp \
- text/qfragmentmap.cpp \
- text/qtextdocument.cpp \
- text/qtextdocument_p.cpp \
- text/qtexthtmlparser.cpp \
- text/qabstracttextdocumentlayout.cpp \
- text/qtextdocumentlayout.cpp \
- text/qtextcursor.cpp \
- text/qtextdocumentfragment.cpp \
- text/qtextimagehandler.cpp \
- text/qtexttable.cpp \
- text/qtextlist.cpp \
- text/qtextdocumentwriter.cpp \
- text/qsyntaxhighlighter.cpp \
- text/qstatictext.cpp \
- text/qrawfont.cpp \
- text/qglyphrun.cpp \
- text/qdistancefield.cpp \
- text/qinputcontrol.cpp
-
-SOURCES += \
- text/qfontengine_qpf2.cpp \
- text/qplatformfontdatabase.cpp
-
-HEADERS += \
- text/qplatformfontdatabase.h
-
-qtConfig(harfbuzz) {
- QMAKE_USE_PRIVATE += harfbuzz
-
- SOURCES += text/qharfbuzzng.cpp
- HEADERS += text/qharfbuzzng_p.h
-}
-
-qtConfig(textodfwriter) {
- HEADERS += \
- text/qtextodfwriter_p.h \
- text/qzipreader_p.h \
- text/qzipwriter_p.h
- SOURCES += \
- text/qtextodfwriter.cpp \
- text/qzip.cpp
-}
-
-qtConfig(textmarkdownreader) {
- qtConfig(system-textmarkdownreader) {
- QMAKE_USE += libmd4c
- } else {
- include($$PWD/../../3rdparty/md4c.pri)
- }
- HEADERS += \
- text/qtextmarkdownimporter_p.h
- SOURCES += \
- text/qtextmarkdownimporter.cpp
-}
-
-qtConfig(textmarkdownwriter) {
- HEADERS += \
- text/qtextmarkdownwriter_p.h
- SOURCES += \
- text/qtextmarkdownwriter.cpp
-}
-
-qtConfig(cssparser) {
- HEADERS += \
- text/qcssparser_p.h
- SOURCES += \
- text/qcssparser.cpp
-}
diff --git a/src/gui/text/unix/qfontconfigdatabase.cpp b/src/gui/text/unix/qfontconfigdatabase.cpp
new file mode 100644
index 0000000000..d607d38235
--- /dev/null
+++ b/src/gui/text/unix/qfontconfigdatabase.cpp
@@ -0,0 +1,1136 @@
+// Copyright (C) 2019 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
+
+#include "qfontconfigdatabase_p.h"
+#include "qfontenginemultifontconfig_p.h"
+
+#include <QtGui/private/qfontengine_ft_p.h>
+
+#include <QtCore/QList>
+#include <QtCore/QElapsedTimer>
+#include <QtCore/QFile>
+
+#include <qpa/qplatformnativeinterface.h>
+#include <qpa/qplatformscreen.h>
+#include <qpa/qplatformintegration.h>
+#include <qpa/qplatformservices.h>
+
+#include <QtGui/private/qguiapplication_p.h>
+
+#include <QtGui/qguiapplication.h>
+
+#include <QtCore/private/qduplicatetracker_p.h>
+
+#include <fontconfig/fontconfig.h>
+#if FC_VERSION >= 20402
+#include <fontconfig/fcfreetype.h>
+#endif
+
+QT_BEGIN_NAMESPACE
+
+Q_DECLARE_LOGGING_CATEGORY(lcFontDb)
+
+static inline int mapToQtWeightForRange(int fcweight, int fcLower, int fcUpper, int qtLower, int qtUpper)
+{
+ return qtLower + ((fcweight - fcLower) * (qtUpper - qtLower)) / (fcUpper - fcLower);
+}
+
+static inline int weightFromFcWeight(int fcweight)
+{
+ // Font Config uses weights from 0 to 215 (the highest enum value) while QFont ranges from
+ // 1 to 1000. The spacing between the values for the enums are uneven so a linear mapping from
+ // Font Config values to Qt would give surprising results. So, we do a piecewise linear
+ // mapping. This ensures that where there is a corresponding enum on both sides (for example
+ // FC_WEIGHT_DEMIBOLD and QFont::DemiBold) we map one to the other but other values map
+ // to intermediate Qt weights.
+
+ if (fcweight <= FC_WEIGHT_THIN)
+ return QFont::Thin;
+ if (fcweight <= FC_WEIGHT_ULTRALIGHT)
+ return mapToQtWeightForRange(fcweight, FC_WEIGHT_THIN, FC_WEIGHT_ULTRALIGHT, QFont::Thin, QFont::ExtraLight);
+ if (fcweight <= FC_WEIGHT_LIGHT)
+ return mapToQtWeightForRange(fcweight, FC_WEIGHT_ULTRALIGHT, FC_WEIGHT_LIGHT, QFont::ExtraLight, QFont::Light);
+ if (fcweight <= FC_WEIGHT_NORMAL)
+ return mapToQtWeightForRange(fcweight, FC_WEIGHT_LIGHT, FC_WEIGHT_NORMAL, QFont::Light, QFont::Normal);
+ if (fcweight <= FC_WEIGHT_MEDIUM)
+ return mapToQtWeightForRange(fcweight, FC_WEIGHT_NORMAL, FC_WEIGHT_MEDIUM, QFont::Normal, QFont::Medium);
+ if (fcweight <= FC_WEIGHT_DEMIBOLD)
+ return mapToQtWeightForRange(fcweight, FC_WEIGHT_MEDIUM, FC_WEIGHT_DEMIBOLD, QFont::Medium, QFont::DemiBold);
+ if (fcweight <= FC_WEIGHT_BOLD)
+ return mapToQtWeightForRange(fcweight, FC_WEIGHT_DEMIBOLD, FC_WEIGHT_BOLD, QFont::DemiBold, QFont::Bold);
+ if (fcweight <= FC_WEIGHT_ULTRABOLD)
+ return mapToQtWeightForRange(fcweight, FC_WEIGHT_BOLD, FC_WEIGHT_ULTRABOLD, QFont::Bold, QFont::ExtraBold);
+ if (fcweight <= FC_WEIGHT_BLACK)
+ return mapToQtWeightForRange(fcweight, FC_WEIGHT_ULTRABOLD, FC_WEIGHT_BLACK, QFont::ExtraBold, QFont::Black);
+ if (fcweight <= FC_WEIGHT_ULTRABLACK)
+ return mapToQtWeightForRange(fcweight, FC_WEIGHT_BLACK, FC_WEIGHT_ULTRABLACK, QFont::Black,
+ QFONT_WEIGHT_MAX);
+ return QFONT_WEIGHT_MAX;
+}
+
+static inline int stretchFromFcWidth(int fcwidth)
+{
+ // Font Config enums for width match pretty closely with those used by Qt so just use
+ // Font Config values directly while enforcing the same limits imposed by QFont.
+ const int maxStretch = 4000;
+ int qtstretch;
+ if (fcwidth < 1)
+ qtstretch = 1;
+ else if (fcwidth > maxStretch)
+ qtstretch = maxStretch;
+ else
+ qtstretch = fcwidth;
+
+ return qtstretch;
+}
+
+static const char specialLanguages[][6] = {
+ "", // Unknown
+ "", // Inherited
+ "", // Common
+ "en", // Latin
+ "el", // Greek
+ "ru", // Cyrillic
+ "hy", // Armenian
+ "he", // Hebrew
+ "ar", // Arabic
+ "syr", // Syriac
+ "dv", // Thaana
+ "hi", // Devanagari
+ "bn", // Bengali
+ "pa", // Gurmukhi
+ "gu", // Gujarati
+ "or", // Oriya
+ "ta", // Tamil
+ "te", // Telugu
+ "kn", // Kannada
+ "ml", // Malayalam
+ "si", // Sinhala
+ "th", // Thai
+ "lo", // Lao
+ "bo", // Tibetan
+ "my", // Myanmar
+ "ka", // Georgian
+ "ko", // Hangul
+ "am", // Ethiopic
+ "chr", // Cherokee
+ "cr", // CanadianAboriginal
+ "sga", // Ogham
+ "non", // Runic
+ "km", // Khmer
+ "mn", // Mongolian
+ "ja", // Hiragana
+ "ja", // Katakana
+ "zh-TW", // Bopomofo
+ "", // Han
+ "ii", // Yi
+ "ett", // OldItalic
+ "got", // Gothic
+ "en", // Deseret
+ "fil", // Tagalog
+ "hnn", // Hanunoo
+ "bku", // Buhid
+ "tbw", // Tagbanwa
+ "cop", // Coptic
+ "lif", // Limbu
+ "tdd", // TaiLe
+ "grc", // LinearB
+ "uga", // Ugaritic
+ "en", // Shavian
+ "so", // Osmanya
+ "grc", // Cypriot
+ "", // Braille
+ "bug", // Buginese
+ "khb", // NewTaiLue
+ "cu", // Glagolitic
+ "shi", // Tifinagh
+ "syl", // SylotiNagri
+ "peo", // OldPersian
+ "pra", // Kharoshthi
+ "ban", // Balinese
+ "akk", // Cuneiform
+ "phn", // Phoenician
+ "lzh", // PhagsPa
+ "man", // Nko
+ "su", // Sundanese
+ "lep", // Lepcha
+ "sat", // OlChiki
+ "vai", // Vai
+ "saz", // Saurashtra
+ "eky", // KayahLi
+ "rej", // Rejang
+ "xlc", // Lycian
+ "xcr", // Carian
+ "xld", // Lydian
+ "cjm", // Cham
+ "nod", // TaiTham
+ "blt", // TaiViet
+ "ae", // Avestan
+ "egy", // EgyptianHieroglyphs
+ "smp", // Samaritan
+ "lis", // Lisu
+ "bax", // Bamum
+ "jv", // Javanese
+ "mni", // MeeteiMayek
+ "arc", // ImperialAramaic
+ "xsa", // OldSouthArabian
+ "xpr", // InscriptionalParthian
+ "pal", // InscriptionalPahlavi
+ "otk", // OldTurkic
+ "bh", // Kaithi
+ "bbc", // Batak
+ "pra", // Brahmi
+ "myz", // Mandaic
+ "ccp", // Chakma
+ "xmr", // MeroiticCursive
+ "xmr", // MeroiticHieroglyphs
+ "hmd", // Miao
+ "sa", // Sharada
+ "srb", // SoraSompeng
+ "doi", // Takri
+ "lez", // CaucasianAlbanian
+ "bsq", // BassaVah
+ "fr", // Duployan
+ "sq", // Elbasan
+ "sa", // Grantha
+ "hnj", // PahawhHmong
+ "sd", // Khojki
+ "lab", // LinearA
+ "hi", // Mahajani
+ "xmn", // Manichaean
+ "men", // MendeKikakui
+ "mr", // Modi
+ "mru", // Mro
+ "xna", // OldNorthArabian
+ "arc", // Nabataean
+ "arc", // Palmyrene
+ "ctd", // PauCinHau
+ "kv", // OldPermic
+ "pal", // PsalterPahlavi
+ "sa", // Siddham
+ "sd", // Khudawadi
+ "mai", // Tirhuta
+ "hoc", // WarangCiti
+ "", // Ahom
+ "", // AnatolianHieroglyphs
+ "", // Hatran
+ "", // Multani
+ "", // OldHungarian
+ "", // SignWriting
+ "", // Adlam
+ "", // Bhaiksuki
+ "", // Marchen
+ "", // Newa
+ "", // Osage
+ "", // Tangut
+ "", // MasaramGondi
+ "", // Nushu
+ "", // Soyombo
+ "", // ZanabazarSquare
+ "", // Dogra
+ "", // GunjalaGondi
+ "", // HanifiRohingya
+ "", // Makasar
+ "", // Medefaidrin
+ "", // OldSogdian
+ "", // Sogdian
+ "", // Elymaic
+ "", // Nandinagari
+ "", // NyiakengPuachueHmong
+ "", // Wancho
+ "", // Chorasmian
+ "", // DivesAkuru
+ "", // KhitanSmallScript
+ "", // Yezidi
+ "", // CyproMinoan
+ "", // OldUyghur
+ "", // Tangsa
+ "", // Toto
+ "", // Vithkuqi
+ "", // Kawi
+ "", // NagMundari
+};
+static_assert(sizeof specialLanguages / sizeof *specialLanguages == QChar::ScriptCount);
+
+// this could become a list of all languages used for each writing
+// system, instead of using the single most common language.
+static const char languageForWritingSystem[][6] = {
+ "", // Any
+ "en", // Latin
+ "el", // Greek
+ "ru", // Cyrillic
+ "hy", // Armenian
+ "he", // Hebrew
+ "ar", // Arabic
+ "syr", // Syriac
+ "div", // Thaana
+ "hi", // Devanagari
+ "bn", // Bengali
+ "pa", // Gurmukhi
+ "gu", // Gujarati
+ "or", // Oriya
+ "ta", // Tamil
+ "te", // Telugu
+ "kn", // Kannada
+ "ml", // Malayalam
+ "si", // Sinhala
+ "th", // Thai
+ "lo", // Lao
+ "bo", // Tibetan
+ "my", // Myanmar
+ "ka", // Georgian
+ "km", // Khmer
+ "zh-cn", // SimplifiedChinese
+ "zh-tw", // TraditionalChinese
+ "ja", // Japanese
+ "ko", // Korean
+ "vi", // Vietnamese
+ "", // Symbol
+ "sga", // Ogham
+ "non", // Runic
+ "man" // N'Ko
+};
+static_assert(sizeof languageForWritingSystem / sizeof *languageForWritingSystem == QFontDatabase::WritingSystemsCount);
+
+#if FC_VERSION >= 20297
+// Newer FontConfig let's us sort out fonts that report certain scripts support,
+// but no open type tables for handling them correctly.
+// Check the reported script presence in the FC_CAPABILITY's "otlayout:" section.
+static const char capabilityForWritingSystem[][5] = {
+ "", // Any
+ "", // Latin
+ "", // Greek
+ "", // Cyrillic
+ "", // Armenian
+ "", // Hebrew
+ "", // Arabic
+ "syrc", // Syriac
+ "thaa", // Thaana
+ "deva", // Devanagari
+ "beng", // Bengali
+ "guru", // Gurmukhi
+ "gujr", // Gujarati
+ "orya", // Oriya
+ "taml", // Tamil
+ "telu", // Telugu
+ "knda", // Kannada
+ "mlym", // Malayalam
+ "sinh", // Sinhala
+ "", // Thai
+ "", // Lao
+ "tibt", // Tibetan
+ "mymr", // Myanmar
+ "", // Georgian
+ "khmr", // Khmer
+ "", // SimplifiedChinese
+ "", // TraditionalChinese
+ "", // Japanese
+ "", // Korean
+ "", // Vietnamese
+ "", // Symbol
+ "", // Ogham
+ "", // Runic
+ "nko " // N'Ko
+};
+static_assert(sizeof(capabilityForWritingSystem) / sizeof(*capabilityForWritingSystem) == QFontDatabase::WritingSystemsCount);
+#endif
+
+static const char *getFcFamilyForStyleHint(const QFont::StyleHint style)
+{
+ const char *stylehint = nullptr;
+ switch (style) {
+ case QFont::SansSerif:
+ stylehint = "sans-serif";
+ break;
+ case QFont::Serif:
+ stylehint = "serif";
+ break;
+ case QFont::TypeWriter:
+ case QFont::Monospace:
+ stylehint = "monospace";
+ break;
+ case QFont::Cursive:
+ stylehint = "cursive";
+ break;
+ case QFont::Fantasy:
+ stylehint = "fantasy";
+ break;
+ default:
+ break;
+ }
+ return stylehint;
+}
+
+static inline bool requiresOpenType(int writingSystem)
+{
+ return ((writingSystem >= QFontDatabase::Syriac && writingSystem <= QFontDatabase::Sinhala)
+ || writingSystem == QFontDatabase::Khmer || writingSystem == QFontDatabase::Nko);
+}
+
+static void populateFromPattern(FcPattern *pattern,
+ QFontDatabasePrivate::ApplicationFont *applicationFont = nullptr,
+ FT_Face face = nullptr,
+ QFontconfigDatabase *db = nullptr)
+{
+ QString familyName;
+ QString familyNameLang;
+ FcChar8 *value = nullptr;
+ int weight_value;
+ int slant_value;
+ int spacing_value;
+ int width_value;
+ FcChar8 *file_value;
+ int indexValue;
+ FcChar8 *foundry_value;
+ FcChar8 *style_value;
+ FcBool scalable;
+ FcBool antialias;
+
+ if (FcPatternGetString(pattern, FC_FAMILY, 0, &value) != FcResultMatch)
+ return;
+
+ familyName = QString::fromUtf8((const char *)value);
+
+ if (FcPatternGetString(pattern, FC_FAMILYLANG, 0, &value) == FcResultMatch)
+ familyNameLang = QString::fromUtf8((const char *)value);
+
+ slant_value = FC_SLANT_ROMAN;
+ weight_value = FC_WEIGHT_REGULAR;
+ spacing_value = FC_PROPORTIONAL;
+ file_value = nullptr;
+ indexValue = 0;
+ scalable = FcTrue;
+
+
+ if (FcPatternGetInteger(pattern, FC_SLANT, 0, &slant_value) != FcResultMatch)
+ slant_value = FC_SLANT_ROMAN;
+ if (FcPatternGetInteger(pattern, FC_WEIGHT, 0, &weight_value) != FcResultMatch)
+ weight_value = FC_WEIGHT_REGULAR;
+ if (FcPatternGetInteger(pattern, FC_WIDTH, 0, &width_value) != FcResultMatch)
+ width_value = FC_WIDTH_NORMAL;
+ if (FcPatternGetInteger(pattern, FC_SPACING, 0, &spacing_value) != FcResultMatch)
+ spacing_value = FC_PROPORTIONAL;
+ if (FcPatternGetString(pattern, FC_FILE, 0, &file_value) != FcResultMatch)
+ file_value = nullptr;
+ if (FcPatternGetInteger(pattern, FC_INDEX, 0, &indexValue) != FcResultMatch)
+ indexValue = 0;
+ if (FcPatternGetBool(pattern, FC_SCALABLE, 0, &scalable) != FcResultMatch)
+ scalable = FcTrue;
+ if (FcPatternGetString(pattern, FC_FOUNDRY, 0, &foundry_value) != FcResultMatch)
+ foundry_value = nullptr;
+ if (FcPatternGetString(pattern, FC_STYLE, 0, &style_value) != FcResultMatch)
+ style_value = nullptr;
+ if (FcPatternGetBool(pattern,FC_ANTIALIAS,0,&antialias) != FcResultMatch)
+ antialias = true;
+
+ QSupportedWritingSystems writingSystems;
+ FcLangSet *langset = nullptr;
+ FcResult res = FcPatternGetLangSet(pattern, FC_LANG, 0, &langset);
+ if (res == FcResultMatch) {
+ bool hasLang = false;
+#if FC_VERSION >= 20297
+ FcChar8 *cap = nullptr;
+ FcResult capRes = FcResultNoMatch;
+#endif
+ for (int j = 1; j < QFontDatabase::WritingSystemsCount; ++j) {
+ const FcChar8 *lang = (const FcChar8*) languageForWritingSystem[j];
+ if (lang) {
+ FcLangResult langRes = FcLangSetHasLang(langset, lang);
+ if (langRes != FcLangDifferentLang) {
+#if FC_VERSION >= 20297
+ if (*capabilityForWritingSystem[j] && requiresOpenType(j)) {
+ if (cap == nullptr)
+ capRes = FcPatternGetString(pattern, FC_CAPABILITY, 0, &cap);
+ if (capRes == FcResultMatch && strstr(reinterpret_cast<const char *>(cap), capabilityForWritingSystem[j]) == nullptr)
+ continue;
+ }
+#endif
+ writingSystems.setSupported(QFontDatabase::WritingSystem(j));
+ hasLang = true;
+ }
+ }
+ }
+ if (!hasLang)
+ // none of our known languages, add it to the other set
+ writingSystems.setSupported(QFontDatabase::Other);
+ } else {
+ // we set Other to supported for symbol fonts. It makes no
+ // sense to merge these with other ones, as they are
+ // special in a way.
+ writingSystems.setSupported(QFontDatabase::Other);
+ }
+
+ FontFile *fontFile = new FontFile;
+ fontFile->fileName = QString::fromLocal8Bit((const char *)file_value);
+ fontFile->indexValue = indexValue;
+
+ QFont::Style style = (slant_value == FC_SLANT_ITALIC)
+ ? QFont::StyleItalic
+ : ((slant_value == FC_SLANT_OBLIQUE)
+ ? QFont::StyleOblique
+ : QFont::StyleNormal);
+ // Note: weight should really be an int but registerFont incorrectly uses an enum
+ QFont::Weight weight = QFont::Weight(weightFromFcWeight(weight_value));
+
+ double pixel_size = 0;
+ if (!scalable)
+ FcPatternGetDouble (pattern, FC_PIXEL_SIZE, 0, &pixel_size);
+
+ bool fixedPitch = spacing_value >= FC_MONO;
+ // Note: stretch should really be an int but registerFont incorrectly uses an enum
+ QFont::Stretch stretch = QFont::Stretch(stretchFromFcWidth(width_value));
+ QString styleName = style_value ? QString::fromUtf8((const char *) style_value) : QString();
+
+ if (applicationFont != nullptr) {
+ QFontDatabasePrivate::ApplicationFont::Properties properties;
+ properties.familyName = familyName;
+ properties.styleName = styleName;
+ properties.weight = weight;
+ properties.style = style;
+ properties.stretch = stretch;
+
+ applicationFont->properties.append(properties);
+ }
+
+ QPlatformFontDatabase::registerFont(familyName,styleName,QLatin1StringView((const char *)foundry_value),weight,style,stretch,antialias,scalable,pixel_size,fixedPitch,writingSystems,fontFile);
+ if (applicationFont != nullptr && face != nullptr && db != nullptr) {
+ db->addNamedInstancesForFace(face,
+ indexValue,
+ familyName,
+ styleName,
+ weight,
+ stretch,
+ style,
+ fixedPitch,
+ writingSystems,
+ QByteArray((const char*)file_value),
+ applicationFont->data);
+ }
+
+// qDebug() << familyName << (const char *)foundry_value << weight << style << &writingSystems << scalable << true << pixel_size;
+
+ for (int k = 1; FcPatternGetString(pattern, FC_FAMILY, k, &value) == FcResultMatch; ++k) {
+ const QString altFamilyName = QString::fromUtf8((const char *)value);
+ // Extra family names can be aliases or subfamilies.
+ // If it is a subfamily, register it as a separate font, so only members of the subfamily are
+ // matched when the subfamily is requested.
+ QString altStyleName;
+ if (FcPatternGetString(pattern, FC_STYLE, k, &value) == FcResultMatch)
+ altStyleName = QString::fromUtf8((const char *)value);
+ else
+ altStyleName = styleName;
+
+ QString altFamilyNameLang;
+ if (FcPatternGetString(pattern, FC_FAMILYLANG, k, &value) == FcResultMatch)
+ altFamilyNameLang = QString::fromUtf8((const char *)value);
+ else
+ altFamilyNameLang = familyNameLang;
+
+ if (familyNameLang == altFamilyNameLang && altStyleName != styleName) {
+ if (applicationFont != nullptr) {
+ QFontDatabasePrivate::ApplicationFont::Properties properties;
+ properties.familyName = altFamilyName;
+ properties.styleName = altStyleName;
+ properties.weight = weight;
+ properties.style = style;
+ properties.stretch = stretch;
+
+ applicationFont->properties.append(properties);
+ }
+ FontFile *altFontFile = new FontFile(*fontFile);
+ QPlatformFontDatabase::registerFont(altFamilyName, altStyleName, QLatin1StringView((const char *)foundry_value),weight,style,stretch,antialias,scalable,pixel_size,fixedPitch,writingSystems,altFontFile);
+ } else {
+ QPlatformFontDatabase::registerAliasToFontFamily(familyName, altFamilyName);
+ }
+ }
+
+}
+
+static bool isDprScaling()
+{
+ return !qFuzzyCompare(qApp->devicePixelRatio(), 1.0);
+}
+
+QFontconfigDatabase::~QFontconfigDatabase()
+{
+ FcConfigDestroy(FcConfigGetCurrent());
+}
+
+void QFontconfigDatabase::populateFontDatabase()
+{
+ FcInit();
+ FcFontSet *fonts;
+
+ {
+ FcObjectSet *os = FcObjectSetCreate();
+ FcPattern *pattern = FcPatternCreate();
+ const char *properties [] = {
+ FC_FAMILY, FC_STYLE, FC_WEIGHT, FC_SLANT,
+ FC_SPACING, FC_FILE, FC_INDEX,
+ FC_LANG, FC_CHARSET, FC_FOUNDRY, FC_SCALABLE, FC_PIXEL_SIZE,
+ FC_WIDTH, FC_FAMILYLANG,
+#if FC_VERSION >= 20297
+ FC_CAPABILITY,
+#endif
+ (const char *)nullptr
+ };
+ const char **p = properties;
+ while (*p) {
+ FcObjectSetAdd(os, *p);
+ ++p;
+ }
+
+#ifdef FC_VARIABLE
+ /* Support the named instance of Variable Fonts. */
+ FcPatternAddBool(pattern, FC_VARIABLE, FcFalse);
+#endif
+
+ fonts = FcFontList(nullptr, pattern, os);
+ FcObjectSetDestroy(os);
+ FcPatternDestroy(pattern);
+ if (!fonts)
+ return;
+ }
+
+ for (int i = 0; i < fonts->nfont; i++)
+ populateFromPattern(fonts->fonts[i]);
+
+ FcFontSetDestroy (fonts);
+
+ struct FcDefaultFont {
+ const char *qtname;
+ const char *rawname;
+ bool fixed;
+ };
+ const FcDefaultFont defaults[] = {
+ { "Serif", "serif", false },
+ { "Sans Serif", "sans-serif", false },
+ { "Monospace", "monospace", true },
+ { nullptr, nullptr, false }
+ };
+ const FcDefaultFont *f = defaults;
+ // aliases only make sense for 'common', not for any of the specials
+ QSupportedWritingSystems ws;
+ ws.setSupported(QFontDatabase::Latin);
+
+ while (f->qtname) {
+ QString familyQtName = QString::fromLatin1(f->qtname);
+ registerFont(familyQtName,QString(),QString(),QFont::Normal,QFont::StyleNormal,QFont::Unstretched,true,true,0,f->fixed,ws,nullptr);
+ registerFont(familyQtName,QString(),QString(),QFont::Normal,QFont::StyleItalic,QFont::Unstretched,true,true,0,f->fixed,ws,nullptr);
+ registerFont(familyQtName,QString(),QString(),QFont::Normal,QFont::StyleOblique,QFont::Unstretched,true,true,0,f->fixed,ws,nullptr);
+ ++f;
+ }
+
+ //QPA has very lazy population of the font db. We want it to be initialized when
+ //QApplication is constructed, so that the population procedure can do something like this to
+ //set the default font
+// const FcDefaultFont *s = defaults;
+// QFont font("Sans Serif");
+// font.setPointSize(9);
+// QApplication::setFont(font);
+}
+
+void QFontconfigDatabase::invalidate()
+{
+ // Clear app fonts.
+ FcConfigAppFontClear(nullptr);
+}
+
+QFontEngineMulti *QFontconfigDatabase::fontEngineMulti(QFontEngine *fontEngine, QChar::Script script)
+{
+ return new QFontEngineMultiFontConfig(fontEngine, script);
+}
+
+namespace {
+QFontEngine::HintStyle defaultHintStyleFromMatch(QFont::HintingPreference hintingPreference, FcPattern *match, bool preferXftConf)
+{
+ switch (hintingPreference) {
+ case QFont::PreferNoHinting:
+ return QFontEngine::HintNone;
+ case QFont::PreferVerticalHinting:
+ return QFontEngine::HintLight;
+ case QFont::PreferFullHinting:
+ return QFontEngine::HintFull;
+ case QFont::PreferDefaultHinting:
+ break;
+ }
+
+ if (isDprScaling())
+ return QFontEngine::HintNone;
+
+ void *hintStyleResource =
+ QGuiApplication::platformNativeInterface()->nativeResourceForScreen("hintstyle",
+ QGuiApplication::primaryScreen());
+ int xftHintStyle = int(reinterpret_cast<qintptr>(hintStyleResource));
+ if (preferXftConf && xftHintStyle > 0)
+ return QFontEngine::HintStyle(xftHintStyle - 1);
+
+ int hint_style = 0;
+ if (FcPatternGetInteger (match, FC_HINT_STYLE, 0, &hint_style) == FcResultMatch) {
+ switch (hint_style) {
+ case FC_HINT_NONE:
+ return QFontEngine::HintNone;
+ case FC_HINT_SLIGHT:
+ return QFontEngine::HintLight;
+ case FC_HINT_MEDIUM:
+ return QFontEngine::HintMedium;
+ case FC_HINT_FULL:
+ return QFontEngine::HintFull;
+ default:
+ Q_UNREACHABLE();
+ break;
+ }
+ }
+ if (xftHintStyle > 0)
+ return QFontEngine::HintStyle(xftHintStyle - 1);
+
+ return QFontEngine::HintFull;
+}
+
+QFontEngine::SubpixelAntialiasingType subpixelTypeFromMatch(FcPattern *match, bool preferXftConf)
+{
+ void *subpixelTypeResource =
+ QGuiApplication::platformNativeInterface()->nativeResourceForScreen("subpixeltype",
+ QGuiApplication::primaryScreen());
+ int xftSubpixelType = int(reinterpret_cast<qintptr>(subpixelTypeResource));
+ if (preferXftConf && xftSubpixelType > 0)
+ return QFontEngine::SubpixelAntialiasingType(xftSubpixelType - 1);
+
+ int subpixel = FC_RGBA_UNKNOWN;
+ if (FcPatternGetInteger(match, FC_RGBA, 0, &subpixel) == FcResultMatch) {
+ switch (subpixel) {
+ case FC_RGBA_UNKNOWN:
+ case FC_RGBA_NONE:
+ return QFontEngine::Subpixel_None;
+ case FC_RGBA_RGB:
+ return QFontEngine::Subpixel_RGB;
+ case FC_RGBA_BGR:
+ return QFontEngine::Subpixel_BGR;
+ case FC_RGBA_VRGB:
+ return QFontEngine::Subpixel_VRGB;
+ case FC_RGBA_VBGR:
+ return QFontEngine::Subpixel_VBGR;
+ default:
+ Q_UNREACHABLE();
+ break;
+ }
+ }
+
+ if (xftSubpixelType > 0)
+ return QFontEngine::SubpixelAntialiasingType(xftSubpixelType - 1);
+
+ return QFontEngine::Subpixel_None;
+}
+} // namespace
+
+QFontEngine *QFontconfigDatabase::fontEngine(const QFontDef &f, void *usrPtr)
+{
+ if (!usrPtr)
+ return nullptr;
+
+ FontFile *fontfile = static_cast<FontFile *> (usrPtr);
+ QFontEngine::FaceId fid;
+ fid.filename = QFile::encodeName(fontfile->fileName);
+ fid.index = fontfile->indexValue;
+ fid.instanceIndex = fontfile->instanceIndex;
+ fid.variableAxes = f.variableAxisValues;
+
+ // FIXME: Unify with logic in QFontEngineFT::create()
+ QFontEngineFT *engine = new QFontEngineFT(f);
+ engine->face_id = fid;
+
+ setupFontEngine(engine, f);
+
+ if (!engine->init(fid, engine->antialias, engine->defaultFormat) || engine->invalid()) {
+ delete engine;
+ engine = nullptr;
+ }
+
+ return engine;
+}
+
+QFontEngine *QFontconfigDatabase::fontEngine(const QByteArray &fontData, qreal pixelSize, QFont::HintingPreference hintingPreference)
+{
+ QFontEngineFT *engine = static_cast<QFontEngineFT*>(QFreeTypeFontDatabase::fontEngine(fontData, pixelSize, hintingPreference));
+ if (engine == nullptr)
+ return nullptr;
+
+ setupFontEngine(engine, engine->fontDef);
+
+ return engine;
+}
+
+QStringList QFontconfigDatabase::fallbacksForFamily(const QString &family, QFont::Style style, QFont::StyleHint styleHint, QChar::Script script) const
+{
+ QStringList fallbackFamilies;
+ FcPattern *pattern = FcPatternCreate();
+ if (!pattern)
+ return fallbackFamilies;
+
+ FcValue value;
+ value.type = FcTypeString;
+ const QByteArray cs = family.toUtf8();
+ value.u.s = (const FcChar8 *)cs.data();
+ FcPatternAdd(pattern,FC_FAMILY,value,true);
+
+ int slant_value = FC_SLANT_ROMAN;
+ if (style == QFont::StyleItalic)
+ slant_value = FC_SLANT_ITALIC;
+ else if (style == QFont::StyleOblique)
+ slant_value = FC_SLANT_OBLIQUE;
+ FcPatternAddInteger(pattern, FC_SLANT, slant_value);
+
+ Q_ASSERT(uint(script) < QChar::ScriptCount);
+ if (*specialLanguages[script] != '\0') {
+ FcLangSet *ls = FcLangSetCreate();
+ FcLangSetAdd(ls, (const FcChar8*)specialLanguages[script]);
+ FcPatternAddLangSet(pattern, FC_LANG, ls);
+ FcLangSetDestroy(ls);
+ } else if (!family.isEmpty()) {
+ // If script is Common or Han, then it may include languages like CJK,
+ // we should attach system default language set to the pattern
+ // to obtain correct font fallback list (i.e. if LANG=zh_CN
+ // then we normally want to use a Chinese font for CJK text;
+ // while a Japanese font should be used for that if LANG=ja)
+ FcPattern *dummy = FcPatternCreate();
+ FcDefaultSubstitute(dummy);
+ FcChar8 *lang = nullptr;
+ FcResult res = FcPatternGetString(dummy, FC_LANG, 0, &lang);
+ if (res == FcResultMatch)
+ FcPatternAddString(pattern, FC_LANG, lang);
+ FcPatternDestroy(dummy);
+ }
+
+ const char *stylehint = getFcFamilyForStyleHint(styleHint);
+ if (stylehint) {
+ value.u.s = (const FcChar8 *)stylehint;
+ FcPatternAddWeak(pattern, FC_FAMILY, value, FcTrue);
+ }
+
+ FcConfigSubstitute(nullptr, pattern, FcMatchPattern);
+ FcDefaultSubstitute(pattern);
+
+ FcResult result = FcResultMatch;
+ FcFontSet *fontSet = FcFontSort(nullptr,pattern,FcFalse,nullptr,&result);
+ FcPatternDestroy(pattern);
+
+ if (fontSet) {
+ QDuplicateTracker<QString> duplicates(fontSet->nfont + 1);
+ (void)duplicates.hasSeen(family.toCaseFolded());
+ for (int i = 0; i < fontSet->nfont; i++) {
+ FcChar8 *value = nullptr;
+ if (FcPatternGetString(fontSet->fonts[i], FC_FAMILY, 0, &value) != FcResultMatch)
+ continue;
+ // capitalize(value);
+ const QString familyName = QString::fromUtf8((const char *)value);
+ const QString familyNameCF = familyName.toCaseFolded();
+ if (!duplicates.hasSeen(familyNameCF)) {
+ fallbackFamilies << familyName;
+ }
+ }
+ FcFontSetDestroy(fontSet);
+ }
+// qDebug() << "fallbackFamilies for:" << family << style << styleHint << script << fallbackFamilies;
+
+ return fallbackFamilies;
+}
+
+static FcPattern *queryFont(const FcChar8 *file, const QByteArray &data, int id, FcBlanks *blanks, int *count, FT_Face *face)
+{
+#if FC_VERSION < 20402
+ Q_UNUSED(data);
+ *face = nullptr;
+ return FcFreeTypeQuery(file, id, blanks, count);
+#else
+ if (data.isEmpty()) {
+ *face = nullptr;
+ return FcFreeTypeQuery(file, id, blanks, count);
+ }
+
+ FT_Library lib = qt_getFreetype();
+
+ FcPattern *pattern = nullptr;
+
+ if (!FT_New_Memory_Face(lib, (const FT_Byte *)data.constData(), data.size(), id, face)) {
+ *count = (*face)->num_faces;
+
+ pattern = FcFreeTypeQueryFace(*face, file, id, blanks);
+ } else {
+ *face = nullptr;
+ }
+
+ return pattern;
+#endif
+}
+
+QStringList QFontconfigDatabase::addApplicationFont(const QByteArray &fontData, const QString &fileName, QFontDatabasePrivate::ApplicationFont *applicationFont)
+{
+ QStringList families;
+
+ if (applicationFont != nullptr)
+ applicationFont->properties.clear();
+
+ FcFontSet *set = FcConfigGetFonts(nullptr, FcSetApplication);
+ if (!set) {
+ FcConfigAppFontAddFile(nullptr, (const FcChar8 *)":/non-existent");
+ set = FcConfigGetFonts(nullptr, FcSetApplication); // try again
+ if (!set)
+ return families;
+ }
+
+ int id = 0;
+ FcBlanks *blanks = FcConfigGetBlanks(nullptr);
+ int count = 0;
+
+ FcPattern *pattern;
+ do {
+ FT_Face face;
+ pattern = queryFont((const FcChar8 *)QFile::encodeName(fileName).constData(),
+ fontData, id, blanks, &count, &face);
+ if (!pattern)
+ return families;
+
+ FcChar8 *fam = nullptr;
+ if (FcPatternGetString(pattern, FC_FAMILY, 0, &fam) == FcResultMatch) {
+ QString family = QString::fromUtf8(reinterpret_cast<const char *>(fam));
+ families << family;
+ }
+ populateFromPattern(pattern, applicationFont, face, this);
+
+ if (face)
+ FT_Done_Face(face);
+
+ FcFontSetAdd(set, pattern);
+
+ ++id;
+ } while (id < count);
+
+ return families;
+}
+
+QString QFontconfigDatabase::resolveFontFamilyAlias(const QString &family) const
+{
+ QString resolved = QFreeTypeFontDatabase::resolveFontFamilyAlias(family);
+ if (!resolved.isEmpty() && resolved != family)
+ return resolved;
+ FcPattern *pattern = FcPatternCreate();
+ if (!pattern)
+ return family;
+
+ if (!family.isEmpty()) {
+ const QByteArray cs = family.toUtf8();
+ FcPatternAddString(pattern, FC_FAMILY, (const FcChar8 *) cs.constData());
+ }
+ FcConfigSubstitute(nullptr, pattern, FcMatchPattern);
+ FcDefaultSubstitute(pattern);
+
+ FcChar8 *familyAfterSubstitution = nullptr;
+ FcPatternGetString(pattern, FC_FAMILY, 0, &familyAfterSubstitution);
+ resolved = QString::fromUtf8((const char *) familyAfterSubstitution);
+ FcPatternDestroy(pattern);
+
+ return resolved;
+}
+
+QFont QFontconfigDatabase::defaultFont() const
+{
+ // Hack to get system default language until FcGetDefaultLangs()
+ // is exported (https://bugs.freedesktop.org/show_bug.cgi?id=32853)
+ // or https://bugs.freedesktop.org/show_bug.cgi?id=35482 is fixed
+ FcPattern *dummy = FcPatternCreate();
+ FcDefaultSubstitute(dummy);
+ FcChar8 *lang = nullptr;
+ FcResult res = FcPatternGetString(dummy, FC_LANG, 0, &lang);
+
+ FcPattern *pattern = FcPatternCreate();
+ if (res == FcResultMatch) {
+ // Make defaultFont pattern matching locale language aware, because
+ // certain FC_LANG based custom rules may happen in FcConfigSubstitute()
+ FcPatternAddString(pattern, FC_LANG, lang);
+ }
+ FcConfigSubstitute(nullptr, pattern, FcMatchPattern);
+ FcDefaultSubstitute(pattern);
+
+ FcChar8 *familyAfterSubstitution = nullptr;
+ FcPatternGetString(pattern, FC_FAMILY, 0, &familyAfterSubstitution);
+ QString resolved = QString::fromUtf8((const char *) familyAfterSubstitution);
+ FcPatternDestroy(pattern);
+ FcPatternDestroy(dummy);
+
+ return QFont(resolved);
+}
+
+void QFontconfigDatabase::setupFontEngine(QFontEngineFT *engine, const QFontDef &fontDef) const
+{
+ bool antialias = !(fontDef.styleStrategy & QFont::NoAntialias);
+ bool forcedAntialiasSetting = !antialias || isDprScaling();
+
+ const QPlatformServices *services = QGuiApplicationPrivate::platformIntegration()->services();
+ bool preferXftConf = false;
+
+ if (services) {
+ const QList<QByteArray> desktopEnv = services->desktopEnvironment().split(':');
+ preferXftConf = !(desktopEnv.contains("KDE") || desktopEnv.contains("LXQT") || desktopEnv.contains("UKUI"));
+ }
+
+ QFontEngine::GlyphFormat format;
+ // try and get the pattern
+ FcPattern *pattern = FcPatternCreate();
+ FcPattern *match = nullptr;
+
+ FcValue value;
+ value.type = FcTypeString;
+ QByteArray cs = fontDef.families.first().toUtf8();
+ value.u.s = (const FcChar8 *)cs.data();
+ FcPatternAdd(pattern,FC_FAMILY,value,true);
+
+ QFontEngine::FaceId fid = engine->faceId();
+
+ if (!fid.filename.isEmpty()) {
+ value.u.s = (const FcChar8 *)fid.filename.data();
+ FcPatternAdd(pattern,FC_FILE,value,true);
+
+ value.type = FcTypeInteger;
+ value.u.i = fid.index;
+ FcPatternAdd(pattern,FC_INDEX,value,true);
+ }
+
+ if (!qFuzzyIsNull(fontDef.pixelSize))
+ FcPatternAddDouble(pattern, FC_PIXEL_SIZE, fontDef.pixelSize);
+
+ FcResult result;
+
+ FcConfigSubstitute(nullptr, pattern, FcMatchPattern);
+ FcDefaultSubstitute(pattern);
+
+#ifdef FC_VARIABLE
+ if (!fid.filename.isEmpty()) {
+ // FC_INDEX is ignored during processing in FcFontMatch.
+ // So iterate FcPatterns directly and find it out.
+ FcFontSet *fcsets[2], *fcfs;
+
+ fcsets[0] = FcConfigGetFonts(nullptr, FcSetSystem);
+ fcsets[1] = FcConfigGetFonts(nullptr, FcSetApplication);
+ for (int nset = 0; nset < 2; nset++) {
+ fcfs = fcsets[nset];
+ if (fcfs == nullptr)
+ continue;
+ for (int fnum = 0; fnum < fcfs->nfont; fnum++) {
+ FcPattern *fcpat = fcfs->fonts[fnum];
+ FcChar8 *fcfile;
+ FcBool variable;
+ double fcpixelsize;
+ int fcindex;
+
+ // Skip the variable font itself, only to use the named instances and normal fonts here
+ if (FcPatternGetBool(fcpat, FC_VARIABLE, 0, &variable) == FcResultMatch &&
+ variable == FcTrue)
+ continue;
+
+ if (!qFuzzyIsNull(fontDef.pixelSize)) {
+ if (FcPatternGetDouble(fcpat, FC_PIXEL_SIZE, 0, &fcpixelsize) == FcResultMatch &&
+ fontDef.pixelSize != fcpixelsize)
+ continue;
+ }
+
+ if (FcPatternGetString(fcpat, FC_FILE, 0, &fcfile) == FcResultMatch &&
+ FcPatternGetInteger(fcpat, FC_INDEX, 0, &fcindex) == FcResultMatch) {
+ QByteArray f = QByteArray::fromRawData((const char *)fcfile,
+ qstrlen((const char *)fcfile));
+ if (f == fid.filename && fcindex == fid.index) {
+ // We found it.
+ match = FcFontRenderPrepare(nullptr, pattern, fcpat);
+ goto bail;
+ }
+ }
+ }
+ }
+ }
+bail:
+#endif
+
+ if (!match)
+ match = FcFontMatch(nullptr, pattern, &result);
+
+ int xftAntialias = 0;
+ if (!forcedAntialiasSetting) {
+ void *antialiasResource =
+ QGuiApplication::platformNativeInterface()->nativeResourceForScreen("antialiasingEnabled",
+ QGuiApplication::primaryScreen());
+ xftAntialias = int(reinterpret_cast<qintptr>(antialiasResource));
+ if ((preferXftConf || !match) && xftAntialias > 0) {
+ antialias = xftAntialias - 1;
+ forcedAntialiasSetting = true;
+ }
+ }
+ if (match) {
+ engine->setDefaultHintStyle(defaultHintStyleFromMatch((QFont::HintingPreference)fontDef.hintingPreference, match, preferXftConf));
+
+ FcBool fc_autohint;
+ if (FcPatternGetBool(match, FC_AUTOHINT,0, &fc_autohint) == FcResultMatch)
+ engine->forceAutoHint = fc_autohint;
+
+#if defined(FT_LCD_FILTER_H)
+ int lcdFilter;
+ if (FcPatternGetInteger(match, FC_LCD_FILTER, 0, &lcdFilter) == FcResultMatch)
+ engine->lcdFilterType = lcdFilter;
+#endif
+
+ if (!forcedAntialiasSetting) {
+ FcBool fc_antialias;
+ if (FcPatternGetBool(match, FC_ANTIALIAS,0, &fc_antialias) == FcResultMatch)
+ antialias = fc_antialias;
+ }
+
+ if (antialias) {
+ QFontEngine::SubpixelAntialiasingType subpixelType = QFontEngine::Subpixel_None;
+ if (!(fontDef.styleStrategy & QFont::NoSubpixelAntialias))
+ subpixelType = subpixelTypeFromMatch(match, preferXftConf);
+ engine->subpixelType = subpixelType;
+ }
+
+ FcPatternDestroy(match);
+ } else {
+ void *hintStyleResource =
+ QGuiApplication::platformNativeInterface()->nativeResourceForScreen("hintstyle",
+ QGuiApplication::primaryScreen());
+ int xftHintStyle = int(reinterpret_cast<qintptr>(hintStyleResource));
+ if (xftHintStyle > 0)
+ engine->setDefaultHintStyle(QFontEngine::HintStyle(xftHintStyle - 1));
+ if (antialias) {
+ engine->subpixelType = QFontEngine::Subpixel_None;
+ if (!(fontDef.styleStrategy & QFont::NoSubpixelAntialias)) {
+ void *subpixelTypeResource =
+ QGuiApplication::platformNativeInterface()->nativeResourceForScreen("subpixeltype",
+ QGuiApplication::primaryScreen());
+ int xftSubpixelType = int(reinterpret_cast<qintptr>(subpixelTypeResource));
+ if (xftSubpixelType > 1)
+ engine->subpixelType = QFontEngine::SubpixelAntialiasingType(xftSubpixelType - 1);
+ }
+ }
+ }
+ if (antialias) {
+ format = (engine->subpixelType == QFontEngine::Subpixel_None)
+ ? QFontEngine::Format_A8
+ : QFontEngine::Format_A32;
+ } else {
+ format = QFontEngine::Format_Mono;
+ }
+
+ FcPatternDestroy(pattern);
+
+ engine->antialias = antialias;
+ engine->defaultFormat = format;
+ engine->glyphFormat = format;
+}
+
+bool QFontconfigDatabase::supportsVariableApplicationFonts() const
+{
+#if (FREETYPE_MAJOR*10000 + FREETYPE_MINOR*100 + FREETYPE_PATCH) >= 20900
+ return true;
+#else
+ return false;
+#endif
+}
+
+QT_END_NAMESPACE
diff --git a/src/gui/text/unix/qfontconfigdatabase_p.h b/src/gui/text/unix/qfontconfigdatabase_p.h
new file mode 100644
index 0000000000..dd7a70a375
--- /dev/null
+++ b/src/gui/text/unix/qfontconfigdatabase_p.h
@@ -0,0 +1,46 @@
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
+
+#ifndef QFONTCONFIGDATABASE_H
+#define QFONTCONFIGDATABASE_H
+
+//
+// W A R N I N G
+// -------------
+//
+// This file is not part of the Qt API. It exists purely as an
+// implementation detail. This header file may change from version to
+// version without notice, or even be removed.
+//
+// We mean it.
+//
+
+#include <qpa/qplatformfontdatabase.h>
+#include <QtGui/private/qfreetypefontdatabase_p.h>
+
+QT_BEGIN_NAMESPACE
+
+class QFontEngineFT;
+
+class Q_GUI_EXPORT QFontconfigDatabase : public QFreeTypeFontDatabase
+{
+public:
+ ~QFontconfigDatabase() override;
+ void populateFontDatabase() override;
+ void invalidate() override;
+ bool supportsVariableApplicationFonts() const override;
+ QFontEngineMulti *fontEngineMulti(QFontEngine *fontEngine, QChar::Script script) override;
+ QFontEngine *fontEngine(const QFontDef &fontDef, void *handle) override;
+ QFontEngine *fontEngine(const QByteArray &fontData, qreal pixelSize, QFont::HintingPreference hintingPreference) override;
+ QStringList fallbacksForFamily(const QString &family, QFont::Style style, QFont::StyleHint styleHint, QChar::Script script) const override;
+ QStringList addApplicationFont(const QByteArray &fontData, const QString &fileName, QFontDatabasePrivate::ApplicationFont *applicationFont = nullptr) override;
+ QString resolveFontFamilyAlias(const QString &family) const override;
+ QFont defaultFont() const override;
+
+private:
+ void setupFontEngine(QFontEngineFT *engine, const QFontDef &fontDef) const;
+};
+
+QT_END_NAMESPACE
+
+#endif // QFONTCONFIGDATABASE_H
diff --git a/src/gui/text/unix/qfontenginemultifontconfig.cpp b/src/gui/text/unix/qfontenginemultifontconfig.cpp
new file mode 100644
index 0000000000..6419a764f7
--- /dev/null
+++ b/src/gui/text/unix/qfontenginemultifontconfig.cpp
@@ -0,0 +1,58 @@
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
+
+#include "qfontenginemultifontconfig_p.h"
+
+#include <QtGui/private/qfontengine_ft_p.h>
+
+QT_BEGIN_NAMESPACE
+
+QFontEngineMultiFontConfig::QFontEngineMultiFontConfig(QFontEngine *fe, int script)
+ : QFontEngineMulti(fe, script)
+{
+}
+
+QFontEngineMultiFontConfig::~QFontEngineMultiFontConfig()
+{
+ for (FcPattern *pattern : std::as_const(cachedMatchPatterns)) {
+ if (pattern)
+ FcPatternDestroy(pattern);
+ }
+}
+
+bool QFontEngineMultiFontConfig::shouldLoadFontEngineForCharacter(int at, uint ucs4) const
+{
+ bool charSetHasChar = true;
+ FcPattern *matchPattern = getMatchPatternForFallback(at - 1);
+ if (matchPattern != nullptr) {
+ FcCharSet *charSet;
+ FcPatternGetCharSet(matchPattern, FC_CHARSET, 0, &charSet);
+ charSetHasChar = FcCharSetHasChar(charSet, ucs4);
+ }
+
+ return charSetHasChar;
+}
+
+
+FcPattern * QFontEngineMultiFontConfig::getMatchPatternForFallback(int fallBackIndex) const
+{
+ Q_ASSERT(fallBackIndex < fallbackFamilyCount());
+ if (fallbackFamilyCount() > cachedMatchPatterns.size())
+ cachedMatchPatterns.resize(fallbackFamilyCount());
+ FcPattern *ret = cachedMatchPatterns.at(fallBackIndex);
+ if (ret)
+ return ret;
+ FcPattern *requestPattern = FcPatternCreate();
+ FcValue value;
+ value.type = FcTypeString;
+ QByteArray cs = fallbackFamilyAt(fallBackIndex).toUtf8();
+ value.u.s = reinterpret_cast<const FcChar8 *>(cs.data());
+ FcPatternAdd(requestPattern, FC_FAMILY, value, true);
+ FcResult result;
+ ret = FcFontMatch(nullptr, requestPattern, &result);
+ cachedMatchPatterns.insert(fallBackIndex, ret);
+ FcPatternDestroy(requestPattern);
+ return ret;
+}
+
+QT_END_NAMESPACE
diff --git a/src/gui/text/unix/qfontenginemultifontconfig_p.h b/src/gui/text/unix/qfontenginemultifontconfig_p.h
new file mode 100644
index 0000000000..9ab96123ae
--- /dev/null
+++ b/src/gui/text/unix/qfontenginemultifontconfig_p.h
@@ -0,0 +1,39 @@
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
+
+#ifndef QFONTENGINEMULTIFONTCONFIG_H
+#define QFONTENGINEMULTIFONTCONFIG_H
+
+//
+// W A R N I N G
+// -------------
+//
+// This file is not part of the Qt API. It exists purely as an
+// implementation detail. This header file may change from version to
+// version without notice, or even be removed.
+//
+// We mean it.
+//
+
+#include <QtGui/private/qfontengine_p.h>
+#include <fontconfig/fontconfig.h>
+
+QT_BEGIN_NAMESPACE
+
+class Q_GUI_EXPORT QFontEngineMultiFontConfig : public QFontEngineMulti
+{
+public:
+ explicit QFontEngineMultiFontConfig(QFontEngine *fe, int script);
+
+ ~QFontEngineMultiFontConfig();
+
+ bool shouldLoadFontEngineForCharacter(int at, uint ucs4) const override;
+private:
+ FcPattern* getMatchPatternForFallback(int at) const;
+
+ mutable QList<FcPattern *> cachedMatchPatterns;
+};
+
+QT_END_NAMESPACE
+
+#endif // QFONTENGINEMULTIFONTCONFIG_H
diff --git a/src/gui/text/unix/qgenericunixfontdatabase_p.h b/src/gui/text/unix/qgenericunixfontdatabase_p.h
new file mode 100644
index 0000000000..96124d025b
--- /dev/null
+++ b/src/gui/text/unix/qgenericunixfontdatabase_p.h
@@ -0,0 +1,31 @@
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
+
+#ifndef QGENERICUNIXFONTDATABASE_H
+#define QGENERICUNIXFONTDATABASE_H
+
+//
+// W A R N I N G
+// -------------
+//
+// This file is not part of the Qt API. It exists purely as an
+// implementation detail. This header file may change from version to
+// version without notice, or even be removed.
+//
+// We mean it.
+//
+
+#include <QtGui/private/qtguiglobal_p.h>
+
+#if QT_CONFIG(fontconfig)
+#include <QtGui/private/qfontconfigdatabase_p.h>
+using QGenericUnixFontDatabase = QFontconfigDatabase;
+#elif QT_CONFIG(freetype)
+#include <QtGui/private/qfreetypefontdatabase_p.h>
+using QGenericUnixFontDatabase = QFreeTypeFontDatabase;
+#else
+#include <qpa/qplatformfontdatabase.h>
+using QGenericUnixFontDatabase = QPlatformFontDatabase;
+#endif
+
+#endif // QGENERICUNIXFONTDATABASE_H
diff --git a/src/gui/text/windows/qwindowsdirectwritefontdatabase.cpp b/src/gui/text/windows/qwindowsdirectwritefontdatabase.cpp
new file mode 100644
index 0000000000..2e15fbb1ac
--- /dev/null
+++ b/src/gui/text/windows/qwindowsdirectwritefontdatabase.cpp
@@ -0,0 +1,809 @@
+// Copyright (C) 2020 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
+
+#include "qwindowsdirectwritefontdatabase_p.h"
+#include "qwindowsfontenginedirectwrite_p.h"
+#include "qwindowsfontdatabase_p.h"
+
+#include <QtCore/qendian.h>
+#include <QtCore/qfile.h>
+#include <QtCore/qstringbuilder.h>
+#include <QtCore/qvarlengtharray.h>
+
+#include <dwrite_3.h>
+#include <d2d1.h>
+
+QT_BEGIN_NAMESPACE
+
+// Defined in gui/text/qfontdatabase.cpp
+Q_GUI_EXPORT QFontDatabase::WritingSystem qt_writing_system_for_script(int script);
+
+template<typename T>
+struct DirectWriteScope {
+ DirectWriteScope(T *res = nullptr) : m_res(res) {}
+ ~DirectWriteScope() {
+ if (m_res != nullptr)
+ m_res->Release();
+ }
+
+ T **operator&()
+ {
+ return &m_res;
+ }
+
+ T *operator->()
+ {
+ return m_res;
+ }
+
+ T *operator*() {
+ return m_res;
+ }
+
+private:
+ T *m_res;
+};
+
+QWindowsDirectWriteFontDatabase::QWindowsDirectWriteFontDatabase()
+{
+ qCDebug(lcQpaFonts) << "Creating DirectWrite database";
+}
+
+QWindowsDirectWriteFontDatabase::~QWindowsDirectWriteFontDatabase()
+{
+ for (auto it = m_populatedFonts.begin(); it != m_populatedFonts.end(); ++it)
+ it.value()->Release();
+}
+
+QString QWindowsDirectWriteFontDatabase::localeString(IDWriteLocalizedStrings *names,
+ wchar_t localeName[])
+{
+ uint index;
+ BOOL exists;
+ if (SUCCEEDED(names->FindLocaleName(localeName, &index, &exists)) && exists) {
+ uint length;
+ if (SUCCEEDED(names->GetStringLength(index, &length)) && length > 0) {
+ QVarLengthArray<wchar_t> buffer(int(length) + 1);
+ if (SUCCEEDED(names->GetString(index, buffer.data(), length + 1)))
+ return QString::fromWCharArray(buffer.data());
+ }
+ }
+
+ return QString();
+}
+
+static QFont::Stretch fromDirectWriteStretch(DWRITE_FONT_STRETCH stretch)
+{
+ switch (stretch) {
+ case DWRITE_FONT_STRETCH_ULTRA_CONDENSED: return QFont::UltraCondensed;
+ case DWRITE_FONT_STRETCH_EXTRA_CONDENSED: return QFont::ExtraCondensed;
+ case DWRITE_FONT_STRETCH_CONDENSED: return QFont::Condensed;
+ case DWRITE_FONT_STRETCH_SEMI_CONDENSED: return QFont::SemiCondensed;
+ case DWRITE_FONT_STRETCH_NORMAL: return QFont::Unstretched;
+ case DWRITE_FONT_STRETCH_SEMI_EXPANDED: return QFont::SemiExpanded;
+ case DWRITE_FONT_STRETCH_EXPANDED: return QFont::Expanded;
+ case DWRITE_FONT_STRETCH_EXTRA_EXPANDED: return QFont::ExtraExpanded;
+ case DWRITE_FONT_STRETCH_ULTRA_EXPANDED: return QFont::UltraExpanded;
+ default: return QFont::AnyStretch;
+ }
+}
+
+static QFont::Weight fromDirectWriteWeight(DWRITE_FONT_WEIGHT weight)
+{
+ return static_cast<QFont::Weight>(weight);
+}
+
+static QFont::Style fromDirectWriteStyle(DWRITE_FONT_STYLE style)
+{
+ switch (style) {
+ case DWRITE_FONT_STYLE_NORMAL: return QFont::StyleNormal;
+ case DWRITE_FONT_STYLE_OBLIQUE: return QFont::StyleOblique;
+ case DWRITE_FONT_STYLE_ITALIC: return QFont::StyleItalic;
+ default: return QFont::StyleNormal;
+ }
+}
+
+void QWindowsDirectWriteFontDatabase::populateFamily(const QString &familyName)
+{
+ auto it = m_populatedFonts.find(familyName);
+ if (it == m_populatedFonts.end() && m_populatedBitmapFonts.contains(familyName)) {
+ qCDebug(lcQpaFonts) << "Populating bitmap font" << familyName;
+ QWindowsFontDatabase::populateFamily(familyName);
+ return;
+ }
+
+ IDWriteFontFamily *fontFamily = it != m_populatedFonts.end() ? it.value() : nullptr;
+ if (fontFamily == nullptr) {
+ qCWarning(lcQpaFonts) << "Cannot find" << familyName << "in list of fonts";
+ return;
+ }
+
+ qCDebug(lcQpaFonts) << "Populate family:" << familyName;
+
+ wchar_t defaultLocale[LOCALE_NAME_MAX_LENGTH];
+ bool hasDefaultLocale = GetUserDefaultLocaleName(defaultLocale, LOCALE_NAME_MAX_LENGTH) != 0;
+ wchar_t englishLocale[] = L"en-us";
+
+ static const int SMOOTH_SCALABLE = 0xffff;
+ const QString foundryName; // No such concept.
+ const bool scalable = true;
+ const bool antialias = false;
+ const int size = SMOOTH_SCALABLE;
+
+ DirectWriteScope<IDWriteFontList> matchingFonts;
+ if (SUCCEEDED(fontFamily->GetMatchingFonts(DWRITE_FONT_WEIGHT_REGULAR,
+ DWRITE_FONT_STRETCH_NORMAL,
+ DWRITE_FONT_STYLE_NORMAL,
+ &matchingFonts))) {
+ for (uint j = 0; j < matchingFonts->GetFontCount(); ++j) {
+ IDWriteFont *font;
+ if (SUCCEEDED(matchingFonts->GetFont(j, &font))) {
+ DirectWriteScope<IDWriteFont1> font1;
+ if (!SUCCEEDED(font->QueryInterface(__uuidof(IDWriteFont1),
+ reinterpret_cast<void **>(&font1)))) {
+ qCWarning(lcQpaFonts) << "COM object does not support IDWriteFont1";
+ continue;
+ }
+
+ QString defaultLocaleFamilyName;
+ QString englishLocaleFamilyName;
+
+ DirectWriteScope<IDWriteFontFamily> fontFamily2;
+ if (SUCCEEDED(font1->GetFontFamily(&fontFamily2))) {
+ DirectWriteScope<IDWriteLocalizedStrings> names;
+ if (SUCCEEDED(fontFamily2->GetFamilyNames(&names))) {
+ defaultLocaleFamilyName = hasDefaultLocale ? localeString(*names, defaultLocale) : QString();
+ englishLocaleFamilyName = localeString(*names, englishLocale);
+ }
+ }
+
+ if (defaultLocaleFamilyName.isEmpty() && englishLocaleFamilyName.isEmpty())
+ englishLocaleFamilyName = familyName;
+
+ {
+ DirectWriteScope<IDWriteLocalizedStrings> names;
+ if (SUCCEEDED(font1->GetFaceNames(&names))) {
+ QString defaultLocaleStyleName = hasDefaultLocale ? localeString(*names, defaultLocale) : QString();
+ QString englishLocaleStyleName = localeString(*names, englishLocale);
+
+ QFont::Stretch stretch = fromDirectWriteStretch(font1->GetStretch());
+ QFont::Style style = fromDirectWriteStyle(font1->GetStyle());
+ QFont::Weight weight = fromDirectWriteWeight(font1->GetWeight());
+ bool fixed = font1->IsMonospacedFont();
+
+ qCDebug(lcQpaFonts) << "Family" << familyName << "has english variant" << englishLocaleStyleName << ", in default locale:" << defaultLocaleStyleName << stretch << style << weight << fixed;
+
+ DirectWriteScope<IDWriteFontFace> face;
+ if (SUCCEEDED(font->CreateFontFace(&face))) {
+ QSupportedWritingSystems writingSystems = supportedWritingSystems(*face);
+
+ if (!englishLocaleStyleName.isEmpty() || defaultLocaleStyleName.isEmpty()) {
+ qCDebug(lcQpaFonts) << "Font" << englishLocaleFamilyName << englishLocaleStyleName << "supports writing systems:" << writingSystems;
+
+ QPlatformFontDatabase::registerFont(englishLocaleFamilyName,
+ englishLocaleStyleName,
+ QString(),
+ weight,
+ style,
+ stretch,
+ antialias,
+ scalable,
+ size,
+ fixed,
+ writingSystems,
+ new FontHandle(*face, englishLocaleFamilyName));
+ }
+
+ if (!defaultLocaleFamilyName.isEmpty() && defaultLocaleFamilyName != englishLocaleFamilyName) {
+ QPlatformFontDatabase::registerFont(defaultLocaleFamilyName,
+ defaultLocaleStyleName,
+ QString(),
+ weight,
+ style,
+ stretch,
+ antialias,
+ scalable,
+ size,
+ fixed,
+ writingSystems,
+ new FontHandle(*face, defaultLocaleFamilyName));
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+}
+
+QSupportedWritingSystems QWindowsDirectWriteFontDatabase::supportedWritingSystems(IDWriteFontFace *face) const
+{
+ QSupportedWritingSystems writingSystems;
+ writingSystems.setSupported(QFontDatabase::Any);
+
+ DirectWriteScope<IDWriteFontFace1> face1;
+ if (SUCCEEDED(face->QueryInterface(__uuidof(IDWriteFontFace1),
+ reinterpret_cast<void **>(&face1)))) {
+ const void *tableData = nullptr;
+ UINT32 tableSize;
+ void *tableContext = nullptr;
+ BOOL exists;
+ HRESULT hr = face->TryGetFontTable(qFromBigEndian(QFont::Tag("OS/2").value()),
+ &tableData,
+ &tableSize,
+ &tableContext,
+ &exists);
+ if (SUCCEEDED(hr) && exists) {
+ writingSystems = QPlatformFontDatabase::writingSystemsFromOS2Table(reinterpret_cast<const char *>(tableData), tableSize);
+ } else { // Fall back to checking first character of each Unicode range in font (may include too many writing systems)
+ quint32 rangeCount;
+ hr = face1->GetUnicodeRanges(0, nullptr, &rangeCount);
+
+ if (rangeCount > 0) {
+ QVarLengthArray<DWRITE_UNICODE_RANGE, QChar::ScriptCount> ranges(rangeCount);
+
+ hr = face1->GetUnicodeRanges(rangeCount, ranges.data(), &rangeCount);
+ if (SUCCEEDED(hr)) {
+ for (uint i = 0; i < rangeCount; ++i) {
+ QChar::Script script = QChar::script(ranges.at(i).first);
+
+ QFontDatabase::WritingSystem writingSystem = qt_writing_system_for_script(script);
+
+ if (writingSystem > QFontDatabase::Any && writingSystem < QFontDatabase::WritingSystemsCount)
+ writingSystems.setSupported(writingSystem);
+ }
+ } else {
+ const QString errorString = qt_error_string(int(hr));
+ qCWarning(lcQpaFonts) << "Failed to get unicode ranges for font:" << errorString;
+ }
+ }
+ }
+ }
+
+ return writingSystems;
+}
+
+bool QWindowsDirectWriteFontDatabase::populateFamilyAliases(const QString &missingFamily)
+{
+ // If the font has not been populated, it is possible this is a legacy font family supported
+ // by GDI. We make an attempt at loading it via GDI and then add this face directly to the
+ // database.
+ if (!missingFamily.isEmpty()
+ && missingFamily.size() < LF_FACESIZE
+ && !m_populatedFonts.contains(missingFamily)
+ && !m_populatedBitmapFonts.contains(missingFamily)) {
+ qCDebug(lcQpaFonts) << "Loading unpopulated" << missingFamily << ". Trying GDI.";
+
+ LOGFONT lf;
+ memset(&lf, 0, sizeof(LOGFONT));
+ memcpy(lf.lfFaceName, missingFamily.utf16(), missingFamily.size() * sizeof(wchar_t));
+
+ HFONT hfont = CreateFontIndirect(&lf);
+ if (hfont) {
+ HDC dummy = GetDC(0);
+ HGDIOBJ oldFont = SelectObject(dummy, hfont);
+
+ DirectWriteScope<IDWriteFontFace> directWriteFontFace;
+ if (SUCCEEDED(data()->directWriteGdiInterop->CreateFontFaceFromHdc(dummy, &directWriteFontFace))) {
+ DirectWriteScope<IDWriteFontCollection> fontCollection;
+ if (SUCCEEDED(data()->directWriteFactory->GetSystemFontCollection(&fontCollection))) {
+ DirectWriteScope<IDWriteFont> font;
+ if (SUCCEEDED(fontCollection->GetFontFromFontFace(*directWriteFontFace, &font))) {
+
+ DirectWriteScope<IDWriteFont1> font1;
+ if (SUCCEEDED(font->QueryInterface(__uuidof(IDWriteFont1),
+ reinterpret_cast<void **>(&font1)))) {
+ DirectWriteScope<IDWriteLocalizedStrings> names;
+ if (SUCCEEDED(font1->GetFaceNames(&names))) {
+ wchar_t englishLocale[] = L"en-us";
+ QString englishLocaleStyleName = localeString(*names, englishLocale);
+
+ QFont::Stretch stretch = fromDirectWriteStretch(font1->GetStretch());
+ QFont::Style style = fromDirectWriteStyle(font1->GetStyle());
+ QFont::Weight weight = fromDirectWriteWeight(font1->GetWeight());
+ bool fixed = font1->IsMonospacedFont();
+
+ QSupportedWritingSystems writingSystems = supportedWritingSystems(*directWriteFontFace);
+
+ qCDebug(lcQpaFonts) << "Registering legacy font family" << missingFamily;
+ QPlatformFontDatabase::registerFont(missingFamily,
+ englishLocaleStyleName,
+ QString(),
+ weight,
+ style,
+ stretch,
+ false,
+ true,
+ 0xffff,
+ fixed,
+ writingSystems,
+ new FontHandle(*directWriteFontFace, missingFamily));
+
+ SelectObject(dummy, oldFont);
+ DeleteObject(hfont);
+
+ return true;
+ }
+ }
+ }
+ }
+ }
+
+ SelectObject(dummy, oldFont);
+ DeleteObject(hfont);
+ }
+ }
+
+ // Skip over implementation in QWindowsFontDatabase
+ return QWindowsFontDatabaseBase::populateFamilyAliases(missingFamily);
+}
+
+QFontEngine *QWindowsDirectWriteFontDatabase::fontEngine(const QByteArray &fontData,
+ qreal pixelSize,
+ QFont::HintingPreference hintingPreference)
+{
+ // Skip over implementation in QWindowsFontDatabase
+ return QWindowsFontDatabaseBase::fontEngine(fontData, pixelSize, hintingPreference);
+}
+
+QFontEngine *QWindowsDirectWriteFontDatabase::fontEngine(const QFontDef &fontDef, void *handle)
+{
+ const FontHandle *fontHandle = static_cast<const FontHandle *>(handle);
+ IDWriteFontFace *face = fontHandle->fontFace;
+ if (face == nullptr) {
+ qCDebug(lcQpaFonts) << "Falling back to GDI";
+ return QWindowsFontDatabase::fontEngine(fontDef, handle);
+ }
+
+ DWRITE_FONT_SIMULATIONS simulations = DWRITE_FONT_SIMULATIONS_NONE;
+ if (fontDef.weight >= QFont::DemiBold || fontDef.style != QFont::StyleNormal) {
+ DirectWriteScope<IDWriteFontFace3> face3;
+ if (SUCCEEDED(face->QueryInterface(__uuidof(IDWriteFontFace3),
+ reinterpret_cast<void **>(&face3)))) {
+ if (fontDef.weight >= QFont::DemiBold && face3->GetWeight() < DWRITE_FONT_WEIGHT_DEMI_BOLD)
+ simulations |= DWRITE_FONT_SIMULATIONS_BOLD;
+
+ if (fontDef.style != QFont::StyleNormal && face3->GetStyle() == DWRITE_FONT_STYLE_NORMAL)
+ simulations |= DWRITE_FONT_SIMULATIONS_OBLIQUE;
+ }
+ }
+
+ DirectWriteScope<IDWriteFontFace5> newFace;
+ if (!fontDef.variableAxisValues.isEmpty() || simulations != DWRITE_FONT_SIMULATIONS_NONE) {
+ DirectWriteScope<IDWriteFontFace5> face5;
+ if (SUCCEEDED(face->QueryInterface(__uuidof(IDWriteFontFace5),
+ reinterpret_cast<void **>(&face5)))) {
+ DirectWriteScope<IDWriteFontResource> font;
+ if (SUCCEEDED(face5->GetFontResource(&font))) {
+ UINT32 fontAxisCount = font->GetFontAxisCount();
+ QVarLengthArray<DWRITE_FONT_AXIS_VALUE, 8> fontAxisValues(fontAxisCount);
+
+ if (!fontDef.variableAxisValues.isEmpty()) {
+ if (SUCCEEDED(face5->GetFontAxisValues(fontAxisValues.data(), fontAxisCount))) {
+ for (UINT32 i = 0; i < fontAxisCount; ++i) {
+ if (auto maybeTag = QFont::Tag::fromValue(qToBigEndian<UINT32>(fontAxisValues[i].axisTag))) {
+ if (fontDef.variableAxisValues.contains(*maybeTag))
+ fontAxisValues[i].value = fontDef.variableAxisValues.value(*maybeTag);
+ }
+ }
+ }
+ }
+
+ if (SUCCEEDED(font->CreateFontFace(simulations,
+ !fontDef.variableAxisValues.isEmpty() ? fontAxisValues.data() : nullptr,
+ !fontDef.variableAxisValues.isEmpty() ? fontAxisCount : 0,
+ &newFace))) {
+ face = *newFace;
+ } else {
+ qCWarning(lcQpaFonts) << "DirectWrite: Can't create font face for variable axis values";
+ }
+ }
+ }
+ }
+
+ QWindowsFontEngineDirectWrite *fontEngine = new QWindowsFontEngineDirectWrite(face, fontDef.pixelSize, data());
+ fontEngine->initFontInfo(fontDef, defaultVerticalDPI());
+
+ return fontEngine;
+}
+
+QStringList QWindowsDirectWriteFontDatabase::fallbacksForFamily(const QString &family, QFont::Style style, QFont::StyleHint styleHint, QChar::Script script) const
+{
+ QStringList result;
+ result.append(familyForStyleHint(styleHint));
+ result.append(extraTryFontsForFamily(family));
+ result.append(QPlatformFontDatabase::fallbacksForFamily(family, style, styleHint, script));
+
+ qCDebug(lcQpaFonts) << __FUNCTION__ << family << style << styleHint
+ << script << result;
+ return result;
+}
+
+QStringList QWindowsDirectWriteFontDatabase::addApplicationFont(const QByteArray &fontData, const QString &fileName, QFontDatabasePrivate::ApplicationFont *applicationFont)
+{
+ qCDebug(lcQpaFonts) << "Adding application font" << fileName;
+
+ QByteArray loadedData = fontData;
+ if (loadedData.isEmpty()) {
+ QFile file(fileName);
+ if (!file.open(QIODevice::ReadOnly)) {
+ qCWarning(lcQpaFonts) << "Cannot open" << fileName << "for reading.";
+ return QStringList();
+ }
+ loadedData = file.readAll();
+ }
+
+ QList<IDWriteFontFace *> faces = createDirectWriteFaces(loadedData);
+ if (faces.isEmpty()) {
+ qCWarning(lcQpaFonts) << "Failed to create DirectWrite face from font data. Font may be unsupported.";
+ return QStringList();
+ }
+
+ QSet<QString> ret;
+ for (int i = 0; i < faces.size(); ++i) {
+ IDWriteFontFace *face = faces.at(i);
+ wchar_t defaultLocale[LOCALE_NAME_MAX_LENGTH];
+ bool hasDefaultLocale = GetUserDefaultLocaleName(defaultLocale, LOCALE_NAME_MAX_LENGTH) != 0;
+ wchar_t englishLocale[] = L"en-us";
+
+ static const int SMOOTH_SCALABLE = 0xffff;
+ const bool scalable = true;
+ const bool antialias = false;
+ const int size = SMOOTH_SCALABLE;
+
+ QSupportedWritingSystems writingSystems = supportedWritingSystems(face);
+ DirectWriteScope<IDWriteFontFace3> face3;
+ if (SUCCEEDED(face->QueryInterface(__uuidof(IDWriteFontFace3),
+ reinterpret_cast<void **>(&face3)))) {
+ QString defaultLocaleFamilyName;
+ QString englishLocaleFamilyName;
+
+ IDWriteLocalizedStrings *names = nullptr;
+ if (SUCCEEDED(face3->GetFamilyNames(&names))) {
+ defaultLocaleFamilyName = hasDefaultLocale ? localeString(names, defaultLocale) : QString();
+ englishLocaleFamilyName = localeString(names, englishLocale);
+
+ names->Release();
+ }
+
+ QString defaultLocaleStyleName;
+ QString englishLocaleStyleName;
+ if (SUCCEEDED(face3->GetFaceNames(&names))) {
+ defaultLocaleStyleName = hasDefaultLocale ? localeString(names, defaultLocale) : QString();
+ englishLocaleStyleName = localeString(names, englishLocale);
+
+ names->Release();
+ }
+
+ BOOL ok;
+ QString defaultLocaleGdiCompatibleFamilyName;
+ QString englishLocaleGdiCompatibleFamilyName;
+ if (SUCCEEDED(face3->GetInformationalStrings(DWRITE_INFORMATIONAL_STRING_WIN32_FAMILY_NAMES, &names, &ok)) && ok) {
+ defaultLocaleGdiCompatibleFamilyName = hasDefaultLocale ? localeString(names, defaultLocale) : QString();
+ englishLocaleGdiCompatibleFamilyName = localeString(names, englishLocale);
+
+ names->Release();
+ }
+
+ QString defaultLocaleGdiCompatibleStyleName;
+ QString englishLocaleGdiCompatibleStyleName;
+ if (SUCCEEDED(face3->GetInformationalStrings(DWRITE_INFORMATIONAL_STRING_WIN32_SUBFAMILY_NAMES, &names, &ok)) && ok) {
+ defaultLocaleGdiCompatibleStyleName = hasDefaultLocale ? localeString(names, defaultLocale) : QString();
+ englishLocaleGdiCompatibleStyleName = localeString(names, englishLocale);
+
+ names->Release();
+ }
+
+ QString defaultLocaleTypographicFamilyName;
+ QString englishLocaleTypographicFamilyName;
+ if (SUCCEEDED(face3->GetInformationalStrings(DWRITE_INFORMATIONAL_STRING_TYPOGRAPHIC_FAMILY_NAMES, &names, &ok)) && ok) {
+ defaultLocaleTypographicFamilyName = hasDefaultLocale ? localeString(names, defaultLocale) : QString();
+ englishLocaleTypographicFamilyName = localeString(names, englishLocale);
+
+ names->Release();
+ }
+
+ QString defaultLocaleTypographicStyleName;
+ QString englishLocaleTypographicStyleName;
+ if (SUCCEEDED(face3->GetInformationalStrings(DWRITE_INFORMATIONAL_STRING_TYPOGRAPHIC_SUBFAMILY_NAMES, &names, &ok)) && ok) {
+ defaultLocaleTypographicStyleName = hasDefaultLocale ? localeString(names, defaultLocale) : QString();
+ englishLocaleTypographicStyleName = localeString(names, englishLocale);
+
+ names->Release();
+ }
+
+ QFont::Stretch stretch = fromDirectWriteStretch(face3->GetStretch());
+ QFont::Style style = fromDirectWriteStyle(face3->GetStyle());
+ QFont::Weight weight = fromDirectWriteWeight(face3->GetWeight());
+ bool fixed = face3->IsMonospacedFont();
+
+ qCDebug(lcQpaFonts) << "\tFont names:" << englishLocaleFamilyName << ", " << defaultLocaleFamilyName
+ << ", style names:" << englishLocaleStyleName << ", " << defaultLocaleStyleName
+ << ", stretch:" << stretch
+ << ", style:" << style
+ << ", weight:" << weight
+ << ", fixed:" << fixed;
+
+ if (!englishLocaleFamilyName.isEmpty()) {
+ if (applicationFont != nullptr) {
+ QFontDatabasePrivate::ApplicationFont::Properties properties;
+ properties.style = style;
+ properties.weight = weight;
+ properties.familyName = englishLocaleFamilyName;
+ properties.styleName = englishLocaleStyleName;
+ applicationFont->properties.append(properties);
+ }
+
+ ret.insert(englishLocaleFamilyName);
+ QPlatformFontDatabase::registerFont(englishLocaleFamilyName,
+ englishLocaleStyleName,
+ QString(),
+ weight,
+ style,
+ stretch,
+ antialias,
+ scalable,
+ size,
+ fixed,
+ writingSystems,
+ new FontHandle(face, englishLocaleFamilyName));
+ }
+
+ if (!defaultLocaleFamilyName.isEmpty() && !ret.contains(defaultLocaleFamilyName)) {
+ if (applicationFont != nullptr) {
+ QFontDatabasePrivate::ApplicationFont::Properties properties;
+ properties.style = style;
+ properties.weight = weight;
+ properties.familyName = englishLocaleFamilyName;
+ properties.styleName = englishLocaleStyleName;
+ applicationFont->properties.append(properties);
+ }
+
+ ret.insert(defaultLocaleFamilyName);
+ QPlatformFontDatabase::registerFont(defaultLocaleFamilyName,
+ defaultLocaleStyleName,
+ QString(),
+ weight,
+ style,
+ stretch,
+ antialias,
+ scalable,
+ size,
+ fixed,
+ writingSystems,
+ new FontHandle(face, defaultLocaleFamilyName));
+ }
+
+ if (!englishLocaleGdiCompatibleFamilyName.isEmpty() &&
+ !ret.contains(englishLocaleGdiCompatibleFamilyName)) {
+ if (applicationFont != nullptr) {
+ QFontDatabasePrivate::ApplicationFont::Properties properties;
+ properties.style = style;
+ properties.weight = weight;
+ properties.familyName = englishLocaleGdiCompatibleFamilyName;
+ applicationFont->properties.append(properties);
+ }
+
+ ret.insert(englishLocaleGdiCompatibleFamilyName);
+ QPlatformFontDatabase::registerFont(englishLocaleGdiCompatibleFamilyName,
+ englishLocaleGdiCompatibleStyleName,
+ QString(),
+ weight,
+ style,
+ stretch,
+ antialias,
+ scalable,
+ size,
+ fixed,
+ writingSystems,
+ new FontHandle(face, englishLocaleGdiCompatibleFamilyName));
+ }
+
+ if (!defaultLocaleGdiCompatibleFamilyName.isEmpty()
+ && !ret.contains(defaultLocaleGdiCompatibleFamilyName)) {
+ if (applicationFont != nullptr) {
+ QFontDatabasePrivate::ApplicationFont::Properties properties;
+ properties.style = style;
+ properties.weight = weight;
+ properties.familyName = defaultLocaleGdiCompatibleFamilyName;
+ applicationFont->properties.append(properties);
+ }
+
+ ret.insert(defaultLocaleGdiCompatibleFamilyName);
+ QPlatformFontDatabase::registerFont(defaultLocaleGdiCompatibleFamilyName,
+ defaultLocaleGdiCompatibleStyleName,
+ QString(),
+ weight,
+ style,
+ stretch,
+ antialias,
+ scalable,
+ size,
+ fixed,
+ writingSystems,
+ new FontHandle(face, defaultLocaleGdiCompatibleFamilyName));
+ }
+
+ if (!englishLocaleTypographicFamilyName.isEmpty()
+ && !ret.contains(englishLocaleTypographicFamilyName)) {
+ if (applicationFont != nullptr) {
+ QFontDatabasePrivate::ApplicationFont::Properties properties;
+ properties.style = style;
+ properties.weight = weight;
+ properties.familyName = englishLocaleTypographicFamilyName;
+ applicationFont->properties.append(properties);
+ }
+
+ ret.insert(englishLocaleTypographicFamilyName);
+ QPlatformFontDatabase::registerFont(englishLocaleTypographicFamilyName,
+ englishLocaleTypographicStyleName,
+ QString(),
+ weight,
+ style,
+ stretch,
+ antialias,
+ scalable,
+ size,
+ fixed,
+ writingSystems,
+ new FontHandle(face, englishLocaleTypographicFamilyName));
+ }
+
+ if (!defaultLocaleTypographicFamilyName.isEmpty()
+ && !ret.contains(defaultLocaleTypographicFamilyName)) {
+ if (applicationFont != nullptr) {
+ QFontDatabasePrivate::ApplicationFont::Properties properties;
+ properties.style = style;
+ properties.weight = weight;
+ properties.familyName = defaultLocaleTypographicFamilyName;
+ applicationFont->properties.append(properties);
+ }
+
+ ret.insert(defaultLocaleTypographicFamilyName);
+ QPlatformFontDatabase::registerFont(defaultLocaleTypographicFamilyName,
+ defaultLocaleTypographicStyleName,
+ QString(),
+ weight,
+ style,
+ stretch,
+ antialias,
+ scalable,
+ size,
+ fixed,
+ writingSystems,
+ new FontHandle(face, defaultLocaleTypographicFamilyName));
+ }
+
+ } else {
+ qCWarning(lcQpaFonts) << "Unable to query IDWriteFontFace3 interface from font face.";
+ }
+
+ face->Release();
+ }
+
+ return ret.values();
+}
+
+bool QWindowsDirectWriteFontDatabase::isPrivateFontFamily(const QString &family) const
+{
+ Q_UNUSED(family);
+ return false;
+}
+
+static int QT_WIN_CALLBACK populateBitmapFonts(const LOGFONT *logFont,
+ const TEXTMETRIC *textmetric,
+ DWORD type,
+ LPARAM lparam)
+{
+ Q_UNUSED(textmetric);
+
+ // the "@family" fonts are just the same as "family". Ignore them.
+ const ENUMLOGFONTEX *f = reinterpret_cast<const ENUMLOGFONTEX *>(logFont);
+ const wchar_t *faceNameW = f->elfLogFont.lfFaceName;
+ if (faceNameW[0] && faceNameW[0] != L'@' && wcsncmp(faceNameW, L"WST_", 4)) {
+ const QString faceName = QString::fromWCharArray(faceNameW);
+ if (type & RASTER_FONTTYPE || type == 0) {
+ QWindowsDirectWriteFontDatabase *db = reinterpret_cast<QWindowsDirectWriteFontDatabase *>(lparam);
+ if (!db->hasPopulatedFont(faceName)) {
+ db->registerFontFamily(faceName);
+ db->registerBitmapFont(faceName);
+ }
+ }
+ }
+ return 1; // continue
+}
+
+void QWindowsDirectWriteFontDatabase::populateFontDatabase()
+{
+ wchar_t defaultLocale[LOCALE_NAME_MAX_LENGTH];
+ bool hasDefaultLocale = GetUserDefaultLocaleName(defaultLocale, LOCALE_NAME_MAX_LENGTH) != 0;
+ wchar_t englishLocale[] = L"en-us";
+
+ const QString defaultFontName = defaultFont().families().constFirst();
+ const QString systemDefaultFontName = systemDefaultFont().families().constFirst();
+
+ DirectWriteScope<IDWriteFontCollection2> fontCollection;
+ DirectWriteScope<IDWriteFactory6> factory6;
+ if (FAILED(data()->directWriteFactory->QueryInterface(__uuidof(IDWriteFactory6),
+ reinterpret_cast<void **>(&factory6)))) {
+ qCWarning(lcQpaFonts) << "Can't initialize IDWriteFactory6. Use GDI font engine instead.";
+ return;
+ }
+
+ if (SUCCEEDED(factory6->GetSystemFontCollection(false,
+ DWRITE_FONT_FAMILY_MODEL_TYPOGRAPHIC,
+ &fontCollection))) {
+ for (uint i = 0; i < fontCollection->GetFontFamilyCount(); ++i) {
+ DirectWriteScope<IDWriteFontFamily2> fontFamily;
+ if (SUCCEEDED(fontCollection->GetFontFamily(i, &fontFamily))) {
+ QString defaultLocaleName;
+ QString englishLocaleName;
+
+ DirectWriteScope<IDWriteLocalizedStrings> names;
+ if (SUCCEEDED(fontFamily->GetFamilyNames(&names))) {
+ if (hasDefaultLocale)
+ defaultLocaleName = localeString(*names, defaultLocale);
+
+ englishLocaleName = localeString(*names, englishLocale);
+ }
+
+ qCDebug(lcQpaFonts) << "Registering font, english name = " << englishLocaleName << ", name in current locale = " << defaultLocaleName;
+ if (!defaultLocaleName.isEmpty()) {
+ registerFontFamily(defaultLocaleName);
+ m_populatedFonts.insert(defaultLocaleName, *fontFamily);
+ fontFamily->AddRef();
+
+ if (defaultLocaleName == defaultFontName && defaultFontName != systemDefaultFontName) {
+ qDebug(lcQpaFonts) << "Adding default font" << systemDefaultFontName << "as alternative to" << defaultLocaleName;
+
+ m_populatedFonts.insert(systemDefaultFontName, *fontFamily);
+ fontFamily->AddRef();
+ }
+ }
+
+ if (!englishLocaleName.isEmpty() && englishLocaleName != defaultLocaleName) {
+ registerFontFamily(englishLocaleName);
+ m_populatedFonts.insert(englishLocaleName, *fontFamily);
+ fontFamily->AddRef();
+
+ if (englishLocaleName == defaultFontName && defaultFontName != systemDefaultFontName) {
+ qDebug(lcQpaFonts) << "Adding default font" << systemDefaultFontName << "as alternative to" << englishLocaleName;
+
+ m_populatedFonts.insert(systemDefaultFontName, *fontFamily);
+ fontFamily->AddRef();
+ }
+ }
+ }
+ }
+ }
+
+ // Since bitmap fonts are not supported by DirectWrite, we need to populate these as well
+ {
+ HDC dummy = GetDC(0);
+ LOGFONT lf;
+ lf.lfCharSet = DEFAULT_CHARSET;
+ lf.lfFaceName[0] = 0;
+ lf.lfPitchAndFamily = 0;
+ EnumFontFamiliesEx(dummy, &lf, populateBitmapFonts, reinterpret_cast<intptr_t>(this), 0);
+ ReleaseDC(0, dummy);
+ }
+}
+
+QFont QWindowsDirectWriteFontDatabase::defaultFont() const
+{
+ return QFont(QStringLiteral("Segoe UI"));
+}
+
+bool QWindowsDirectWriteFontDatabase::supportsVariableApplicationFonts() const
+{
+ QSharedPointer<QWindowsFontEngineData> fontEngineData = data();
+ DirectWriteScope<IDWriteFactory5> factory5;
+ if (SUCCEEDED(fontEngineData->directWriteFactory->QueryInterface(__uuidof(IDWriteFactory5),
+ reinterpret_cast<void **>(&factory5)))) {
+ return true;
+ }
+
+ return false;
+}
+
+QT_END_NAMESPACE
diff --git a/src/gui/text/windows/qwindowsdirectwritefontdatabase_p.h b/src/gui/text/windows/qwindowsdirectwritefontdatabase_p.h
new file mode 100644
index 0000000000..093c629a16
--- /dev/null
+++ b/src/gui/text/windows/qwindowsdirectwritefontdatabase_p.h
@@ -0,0 +1,75 @@
+// Copyright (C) 2020 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
+
+#ifndef QWINDOWSDIRECTWRITEFONTDATABASE_P_H
+#define QWINDOWSDIRECTWRITEFONTDATABASE_P_H
+
+//
+// W A R N I N G
+// -------------
+//
+// This file is not part of the Qt API. It exists purely as an
+// implementation detail. This header file may change from version to
+// version without notice, or even be removed.
+//
+// We mean it.
+//
+
+#include <QtGui/qtguiglobal.h>
+#include <QtGui/private/qtgui-config_p.h>
+
+QT_REQUIRE_CONFIG(directwrite3);
+
+#include "qwindowsfontdatabase_p.h"
+#include <QtCore/qloggingcategory.h>
+
+struct IDWriteFactory;
+struct IDWriteFont;
+struct IDWriteFont1;
+struct IDWriteFontFamily;
+struct IDWriteLocalizedStrings;
+
+QT_BEGIN_NAMESPACE
+
+class Q_GUI_EXPORT QWindowsDirectWriteFontDatabase : public QWindowsFontDatabase
+{
+ Q_DISABLE_COPY_MOVE(QWindowsDirectWriteFontDatabase)
+public:
+ QWindowsDirectWriteFontDatabase();
+ ~QWindowsDirectWriteFontDatabase() override;
+
+ void populateFontDatabase() override;
+ void populateFamily(const QString &familyName) override;
+ bool populateFamilyAliases(const QString &missingFamily) override;
+ QFontEngine *fontEngine(const QFontDef &fontDef, void *handle) override;
+ QFontEngine *fontEngine(const QByteArray &fontData, qreal pixelSize, QFont::HintingPreference hintingPreference) override;
+ QStringList fallbacksForFamily(const QString &family, QFont::Style style, QFont::StyleHint styleHint, QChar::Script script) const override;
+ QStringList addApplicationFont(const QByteArray &fontData, const QString &fileName, QFontDatabasePrivate::ApplicationFont *font = nullptr) override;
+ QFont defaultFont() const override;
+
+ bool isPrivateFontFamily(const QString &family) const override;
+ bool supportsVariableApplicationFonts() const override;
+
+ void registerBitmapFont(const QString &bitmapFont)
+ {
+ m_populatedBitmapFonts.insert(bitmapFont);
+ }
+
+ bool hasPopulatedFont(const QString &fontFamily) const
+ {
+ return m_populatedFonts.contains(fontFamily);
+ }
+
+private:
+ friend class QWindowsFontEngineDirectWrite;
+ static QString localeString(IDWriteLocalizedStrings *names, wchar_t localeName[]);
+
+ QSupportedWritingSystems supportedWritingSystems(IDWriteFontFace *face) const;
+
+ QHash<QString, IDWriteFontFamily *> m_populatedFonts;
+ QSet<QString> m_populatedBitmapFonts;
+};
+
+QT_END_NAMESPACE
+
+#endif // QWINDOWSDIRECTWRITEFONTDATABASE_P_H
diff --git a/src/gui/text/windows/qwindowsfontdatabase.cpp b/src/gui/text/windows/qwindowsfontdatabase.cpp
new file mode 100644
index 0000000000..adc06a6c2a
--- /dev/null
+++ b/src/gui/text/windows/qwindowsfontdatabase.cpp
@@ -0,0 +1,1291 @@
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
+
+#include "qwindowsfontdatabase_p.h"
+#ifndef QT_NO_FREETYPE
+# include "qwindowsfontdatabase_ft_p.h" // for default font
+#endif
+#include "qwindowsfontengine_p.h"
+#include <QtCore/qt_windows.h>
+
+#include <QtGui/QFont>
+#include <QtGui/QGuiApplication>
+#include <QtGui/private/qtgui-config_p.h>
+
+#include <QtCore/qmath.h>
+#include <QtCore/QDebug>
+#include <QtCore/QFile>
+#include <QtCore/QtEndian>
+#include <QtCore/QStandardPaths>
+#include <QtCore/private/qduplicatetracker_p.h>
+#include <QtCore/private/qwinregistry_p.h>
+
+#include <wchar.h>
+
+#if QT_CONFIG(directwrite)
+# if QT_CONFIG(directwrite3)
+# include "qwindowsdirectwritefontdatabase_p.h"
+# endif
+# include <dwrite_2.h>
+# include <d2d1.h>
+# include "qwindowsfontenginedirectwrite_p.h"
+#endif
+
+#include <mutex>
+
+QT_BEGIN_NAMESPACE
+
+using namespace Qt::StringLiterals;
+
+#if QT_CONFIG(directwrite)
+static inline bool useDirectWrite(QFont::HintingPreference hintingPreference,
+ const QString &familyName = QString(),
+ bool isColorFont = false)
+{
+ const unsigned options = QWindowsFontDatabase::fontOptions();
+ if (Q_UNLIKELY(options & QWindowsFontDatabase::DontUseDirectWriteFonts))
+ return false;
+
+ // At some scales, GDI will misrender the MingLiU font, so we force use of
+ // DirectWrite to work around the issue.
+ if (Q_UNLIKELY(familyName.startsWith("MingLiU"_L1)))
+ return true;
+
+ if (isColorFont)
+ return (options & QWindowsFontDatabase::DontUseColorFonts) == 0;
+
+ return hintingPreference == QFont::PreferNoHinting
+ || hintingPreference == QFont::PreferVerticalHinting
+ || (!qFuzzyCompare(qApp->devicePixelRatio(), 1.0) && hintingPreference == QFont::PreferDefaultHinting);
+}
+#endif // !QT_NO_DIRECTWRITE
+
+/*!
+ \class QWindowsFontEngineData
+ \brief Static constant data shared by the font engines.
+ \internal
+*/
+
+QWindowsFontEngineData::QWindowsFontEngineData()
+ : fontSmoothingGamma(QWindowsFontDatabase::fontSmoothingGamma())
+{
+ // from qapplication_win.cpp
+ UINT result = 0;
+ if (SystemParametersInfo(SPI_GETFONTSMOOTHINGTYPE, 0, &result, 0))
+ clearTypeEnabled = (result == FE_FONTSMOOTHINGCLEARTYPE);
+
+ const qreal gray_gamma = 2.31;
+ for (int i=0; i<256; ++i)
+ pow_gamma[i] = uint(qRound(qPow(i / qreal(255.), gray_gamma) * 2047));
+
+ HDC displayDC = GetDC(0);
+ hdc = CreateCompatibleDC(displayDC);
+ ReleaseDC(0, displayDC);
+}
+
+unsigned QWindowsFontDatabase::m_fontOptions = 0;
+
+void QWindowsFontDatabase::setFontOptions(unsigned options)
+{
+ m_fontOptions = options & (QWindowsFontDatabase::DontUseDirectWriteFonts |
+ QWindowsFontDatabase::DontUseColorFonts);
+}
+
+unsigned QWindowsFontDatabase::fontOptions()
+{
+ return m_fontOptions;
+}
+
+qreal QWindowsFontDatabase::fontSmoothingGamma()
+{
+ int winSmooth;
+ qreal result = 1;
+ if (SystemParametersInfo(0x200C /* SPI_GETFONTSMOOTHINGCONTRAST */, 0, &winSmooth, 0))
+ result = qreal(winSmooth) / qreal(1000.0);
+
+ // Safeguard ourselves against corrupt registry values...
+ if (result > 5 || result < 1)
+ result = qreal(1.4);
+ return result;
+}
+
+/*!
+ \class QWindowsFontDatabase
+ \brief Font database for Windows
+
+ \note The Qt 4.8 WIndows font database employed a mechanism of
+ delayed population of the database again passing a font name
+ to EnumFontFamiliesEx(), working around the fact that
+ EnumFontFamiliesEx() does not list all fonts by default.
+ This should be introduced to QPA as well?
+
+ \internal
+*/
+
+#ifndef QT_NO_DEBUG_STREAM
+QDebug operator<<(QDebug d, const QFontDef &def)
+{
+ QDebugStateSaver saver(d);
+ d.nospace();
+ d.noquote();
+ d << "QFontDef(Family=\"" << def.families.first() << '"';
+ if (!def.styleName.isEmpty())
+ d << ", stylename=" << def.styleName;
+ d << ", pointsize=" << def.pointSize << ", pixelsize=" << def.pixelSize
+ << ", styleHint=" << def.styleHint << ", weight=" << def.weight
+ << ", stretch=" << def.stretch << ", hintingPreference="
+ << def.hintingPreference << ')';
+ return d;
+}
+
+void QWindowsFontDatabase::debugFormat(QDebug &d, const LOGFONT &lf)
+{
+ d << "LOGFONT(\"" << QString::fromWCharArray(lf.lfFaceName)
+ << "\", lfWidth=" << lf.lfWidth << ", lfHeight=" << lf.lfHeight << ')';
+}
+
+QDebug operator<<(QDebug d, const LOGFONT &lf)
+{
+ QDebugStateSaver saver(d);
+ d.nospace();
+ d.noquote();
+ QWindowsFontDatabase::debugFormat(d, lf);
+ return d;
+}
+#endif // !QT_NO_DEBUG_STREAM
+
+static inline QFontDatabase::WritingSystem writingSystemFromCharSet(uchar charSet)
+{
+ switch (charSet) {
+ case ANSI_CHARSET:
+ case EASTEUROPE_CHARSET:
+ case BALTIC_CHARSET:
+ case TURKISH_CHARSET:
+ return QFontDatabase::Latin;
+ case GREEK_CHARSET:
+ return QFontDatabase::Greek;
+ case RUSSIAN_CHARSET:
+ return QFontDatabase::Cyrillic;
+ case HEBREW_CHARSET:
+ return QFontDatabase::Hebrew;
+ case ARABIC_CHARSET:
+ return QFontDatabase::Arabic;
+ case THAI_CHARSET:
+ return QFontDatabase::Thai;
+ case GB2312_CHARSET:
+ return QFontDatabase::SimplifiedChinese;
+ case CHINESEBIG5_CHARSET:
+ return QFontDatabase::TraditionalChinese;
+ case SHIFTJIS_CHARSET:
+ return QFontDatabase::Japanese;
+ case HANGUL_CHARSET:
+ case JOHAB_CHARSET:
+ return QFontDatabase::Korean;
+ case VIETNAMESE_CHARSET:
+ return QFontDatabase::Vietnamese;
+ case SYMBOL_CHARSET:
+ return QFontDatabase::Symbol;
+ default:
+ break;
+ }
+ return QFontDatabase::Any;
+}
+
+bool qt_localizedName(const QString &name)
+{
+ const QChar *c = name.unicode();
+ for (int i = 0; i < name.length(); ++i) {
+ if (c[i].unicode() >= 0x100)
+ return true;
+ }
+ return false;
+}
+
+namespace {
+
+static QString readName(bool unicode, const uchar *string, int length)
+{
+ QString out;
+ if (unicode) {
+ // utf16
+
+ length /= 2;
+ out.resize(length);
+ QChar *uc = out.data();
+ for (int i = 0; i < length; ++i)
+ uc[i] = qt_getUShort(string + 2*i);
+ } else {
+ // Apple Roman
+
+ out.resize(length);
+ QChar *uc = out.data();
+ for (int i = 0; i < length; ++i)
+ uc[i] = QLatin1Char(char(string[i]));
+ }
+ return out;
+}
+
+enum FieldTypeValue {
+ FamilyId = 1,
+ StyleId = 2,
+ PreferredFamilyId = 16,
+ PreferredStyleId = 17,
+};
+
+enum PlatformFieldValue {
+ PlatformId_Unicode = 0,
+ PlatformId_Apple = 1,
+ PlatformId_Microsoft = 3
+};
+
+QFontNames qt_getCanonicalFontNames(const uchar *table, quint32 bytes)
+{
+ QFontNames out;
+ const int NameRecordSize = 12;
+ const int MS_LangIdEnglish = 0x009;
+
+ // get the name table
+ quint16 count;
+ quint16 string_offset;
+ const unsigned char *names;
+
+ if (bytes < 8)
+ return out;
+
+ if (qt_getUShort(table) != 0)
+ return out;
+
+ count = qt_getUShort(table + 2);
+ string_offset = qt_getUShort(table + 4);
+ names = table + 6;
+
+ if (string_offset >= bytes || 6 + count*NameRecordSize > string_offset)
+ return out;
+
+ enum PlatformIdType {
+ NotFound = 0,
+ Unicode = 1,
+ Apple = 2,
+ Microsoft = 3
+ };
+
+ PlatformIdType idStatus[4] = { NotFound, NotFound, NotFound, NotFound };
+ int ids[4] = { -1, -1, -1, -1 };
+
+ for (int i = 0; i < count; ++i) {
+ // search for the correct name entries
+
+ quint16 platform_id = qt_getUShort(names + i*NameRecordSize);
+ quint16 encoding_id = qt_getUShort(names + 2 + i*NameRecordSize);
+ quint16 language_id = qt_getUShort(names + 4 + i*NameRecordSize);
+ quint16 name_id = qt_getUShort(names + 6 + i*NameRecordSize);
+
+ PlatformIdType *idType = nullptr;
+ int *id = nullptr;
+
+ switch (name_id) {
+ case FamilyId:
+ idType = &idStatus[0];
+ id = &ids[0];
+ break;
+ case StyleId:
+ idType = &idStatus[1];
+ id = &ids[1];
+ break;
+ case PreferredFamilyId:
+ idType = &idStatus[2];
+ id = &ids[2];
+ break;
+ case PreferredStyleId:
+ idType = &idStatus[3];
+ id = &ids[3];
+ break;
+ default:
+ continue;
+ }
+
+ quint16 length = qt_getUShort(names + 8 + i*NameRecordSize);
+ quint16 offset = qt_getUShort(names + 10 + i*NameRecordSize);
+ if (DWORD(string_offset + offset + length) > bytes)
+ continue;
+
+ if ((platform_id == PlatformId_Microsoft
+ && (encoding_id == 0 || encoding_id == 1))
+ && ((language_id & 0x3ff) == MS_LangIdEnglish
+ || *idType < Microsoft)) {
+ *id = i;
+ *idType = Microsoft;
+ }
+ // not sure if encoding id 4 for Unicode is utf16 or ucs4...
+ else if (platform_id == PlatformId_Unicode && encoding_id < 4 && *idType < Unicode) {
+ *id = i;
+ *idType = Unicode;
+ }
+ else if (platform_id == PlatformId_Apple && encoding_id == 0 && language_id == 0 && *idType < Apple) {
+ *id = i;
+ *idType = Apple;
+ }
+ }
+
+ QString strings[4];
+ for (int i = 0; i < 4; ++i) {
+ if (idStatus[i] == NotFound)
+ continue;
+ int id = ids[i];
+ quint16 length = qt_getUShort(names + 8 + id * NameRecordSize);
+ quint16 offset = qt_getUShort(names + 10 + id * NameRecordSize);
+ const unsigned char *string = table + string_offset + offset;
+ strings[i] = readName(idStatus[i] != Apple, string, length);
+ }
+
+ out.name = strings[0];
+ out.style = strings[1];
+ out.preferredName = strings[2];
+ out.preferredStyle = strings[3];
+ return out;
+}
+
+} // namespace
+
+QString qt_getEnglishName(const QString &familyName, bool includeStyle)
+{
+ QString i18n_name;
+ QString faceName = familyName;
+ faceName.truncate(LF_FACESIZE - 1);
+
+ HDC hdc = GetDC( 0 );
+ LOGFONT lf;
+ memset(&lf, 0, sizeof(LOGFONT));
+ faceName.toWCharArray(lf.lfFaceName);
+ lf.lfFaceName[faceName.size()] = 0;
+ lf.lfCharSet = DEFAULT_CHARSET;
+ HFONT hfont = CreateFontIndirect(&lf);
+
+ if (!hfont) {
+ ReleaseDC(0, hdc);
+ return QString();
+ }
+
+ HGDIOBJ oldobj = SelectObject( hdc, hfont );
+
+ const DWORD name_tag = qFromBigEndian(QFont::Tag("name").value());
+
+ // get the name table
+ unsigned char *table = 0;
+
+ DWORD bytes = GetFontData( hdc, name_tag, 0, 0, 0 );
+ if ( bytes == GDI_ERROR ) {
+ // ### Unused variable
+ // int err = GetLastError();
+ goto error;
+ }
+
+ table = new unsigned char[bytes];
+ GetFontData(hdc, name_tag, 0, table, bytes);
+ if ( bytes == GDI_ERROR )
+ goto error;
+
+ {
+ const QFontNames names = qt_getCanonicalFontNames(table, bytes);
+ i18n_name = names.name;
+ if (includeStyle)
+ i18n_name += u' ' + names.style;
+ }
+error:
+ delete [] table;
+ SelectObject( hdc, oldobj );
+ DeleteObject( hfont );
+ ReleaseDC( 0, hdc );
+
+ //qDebug("got i18n name of '%s' for font '%s'", i18n_name.latin1(), familyName.toLocal8Bit().data());
+ return i18n_name;
+}
+
+// Note this duplicates parts of qt_getEnglishName, we should try to unify the two functions.
+QFontNames qt_getCanonicalFontNames(const LOGFONT &lf)
+{
+ QFontNames fontNames;
+ HDC hdc = GetDC(0);
+ HFONT hfont = CreateFontIndirect(&lf);
+
+ if (!hfont) {
+ ReleaseDC(0, hdc);
+ return fontNames;
+ }
+
+ HGDIOBJ oldobj = SelectObject(hdc, hfont);
+
+ // get the name table
+ QByteArray table;
+ const DWORD name_tag = qFromBigEndian(QFont::Tag("name").value());
+ DWORD bytes = GetFontData(hdc, name_tag, 0, 0, 0);
+ if (bytes != GDI_ERROR) {
+ table.resize(bytes);
+
+ if (GetFontData(hdc, name_tag, 0, table.data(), bytes) != GDI_ERROR)
+ fontNames = qt_getCanonicalFontNames(reinterpret_cast<const uchar*>(table.constData()), bytes);
+ }
+
+ SelectObject(hdc, oldobj);
+ DeleteObject(hfont);
+ ReleaseDC(0, hdc);
+
+ return fontNames;
+}
+
+namespace {
+ struct StoreFontPayload {
+ StoreFontPayload(const QString &family,
+ QWindowsFontDatabase *fontDatabase)
+ : populatedFontFamily(family)
+ , windowsFontDatabase(fontDatabase)
+ {}
+
+ QString populatedFontFamily;
+ QDuplicateTracker<FontAndStyle> foundFontAndStyles;
+ QWindowsFontDatabase *windowsFontDatabase;
+ };
+}
+
+static bool addFontToDatabase(QString familyName,
+ QString styleName,
+ const LOGFONT &logFont,
+ const TEXTMETRIC *textmetric,
+ const FONTSIGNATURE *signature,
+ int type,
+ StoreFontPayload *sfp)
+{
+ // the "@family" fonts are just the same as "family". Ignore them.
+ if (familyName.isEmpty() || familyName.at(0) == u'@' || familyName.startsWith("WST_"_L1))
+ return false;
+
+ uchar charSet = logFont.lfCharSet;
+
+ static const int SMOOTH_SCALABLE = 0xffff;
+ const QString foundryName; // No such concept.
+ const bool fixed = !(textmetric->tmPitchAndFamily & TMPF_FIXED_PITCH);
+ const bool ttf = (textmetric->tmPitchAndFamily & TMPF_TRUETYPE);
+ const bool unreliableTextMetrics = type == 0;
+ const bool scalable = (textmetric->tmPitchAndFamily & (TMPF_VECTOR|TMPF_TRUETYPE))
+ && !unreliableTextMetrics;
+ const int size = scalable ? SMOOTH_SCALABLE : textmetric->tmHeight;
+ const QFont::Style style = textmetric->tmItalic ? QFont::StyleItalic : QFont::StyleNormal;
+ const bool antialias = false;
+ const QFont::Weight weight = static_cast<QFont::Weight>(textmetric->tmWeight);
+ const QFont::Stretch stretch = QFont::Unstretched;
+
+#ifndef QT_NO_DEBUG_OUTPUT
+ if (lcQpaFonts().isDebugEnabled()) {
+ QString message;
+ QTextStream str(&message);
+ str << __FUNCTION__ << ' ' << familyName << ' ' << charSet << " TTF=" << ttf;
+ if (type & DEVICE_FONTTYPE)
+ str << " DEVICE";
+ if (type & RASTER_FONTTYPE)
+ str << " RASTER";
+ if (type & TRUETYPE_FONTTYPE)
+ str << " TRUETYPE";
+ str << " scalable=" << scalable << " Size=" << size
+ << " Style=" << style << " Weight=" << weight
+ << " stretch=" << stretch << " styleName=" << styleName;
+ qCDebug(lcQpaFonts) << message;
+ }
+#endif
+ QString englishName;
+ QString faceName;
+
+ QString subFamilyName;
+ QString subFamilyStyle;
+ // Look-up names registered in the font
+ QFontNames canonicalNames = qt_getCanonicalFontNames(logFont);
+ if (qt_localizedName(familyName) && !canonicalNames.name.isEmpty())
+ englishName = canonicalNames.name;
+ if (!canonicalNames.preferredName.isEmpty()) {
+ subFamilyName = familyName;
+ subFamilyStyle = styleName;
+ faceName = familyName; // Remember the original name for later lookups
+ familyName = canonicalNames.preferredName;
+ // Preferred style / typographic subfamily name:
+ // "If it is absent, then name ID 2 is considered to be the typographic subfamily name."
+ // From: https://docs.microsoft.com/en-us/windows/win32/directwrite/opentype-variable-fonts
+ // Name ID 2 is already stored in the styleName variable. Furthermore, for variable fonts,
+ // styleName holds the variation instance name, which should be used over name ID 2.
+ if (!canonicalNames.preferredStyle.isEmpty())
+ styleName = canonicalNames.preferredStyle;
+ }
+
+ QSupportedWritingSystems writingSystems;
+ if (type & TRUETYPE_FONTTYPE) {
+ Q_ASSERT(signature);
+ quint32 unicodeRange[4] = {
+ signature->fsUsb[0], signature->fsUsb[1],
+ signature->fsUsb[2], signature->fsUsb[3]
+ };
+ quint32 codePageRange[2] = {
+ signature->fsCsb[0], signature->fsCsb[1]
+ };
+ writingSystems = QPlatformFontDatabase::writingSystemsFromTrueTypeBits(unicodeRange, codePageRange);
+ // ### Hack to work around problem with Thai text on Windows 7. Segoe UI contains
+ // the symbol for Baht, and Windows thus reports that it supports the Thai script.
+ // Since it's the default UI font on this platform, most widgets will be unable to
+ // display Thai text by default. As a temporary work around, we special case Segoe UI
+ // and remove the Thai script from its list of supported writing systems.
+ if (writingSystems.supported(QFontDatabase::Thai) &&
+ familyName == "Segoe UI"_L1)
+ writingSystems.setSupported(QFontDatabase::Thai, false);
+ } else {
+ const QFontDatabase::WritingSystem ws = writingSystemFromCharSet(charSet);
+ if (ws != QFontDatabase::Any)
+ writingSystems.setSupported(ws);
+ }
+
+ const bool wasPopulated = QPlatformFontDatabase::isFamilyPopulated(familyName);
+ QPlatformFontDatabase::registerFont(familyName, styleName, foundryName, weight,
+ style, stretch, antialias, scalable, size, fixed, writingSystems, new QWindowsFontDatabase::FontHandle(faceName));
+
+
+ // add fonts windows can generate for us:
+ if (weight <= QFont::DemiBold && styleName.isEmpty())
+ QPlatformFontDatabase::registerFont(familyName, QString(), foundryName, QFont::Bold,
+ style, stretch, antialias, scalable, size, fixed, writingSystems, new QWindowsFontDatabase::FontHandle(faceName));
+ if (style != QFont::StyleItalic && styleName.isEmpty())
+ QPlatformFontDatabase::registerFont(familyName, QString(), foundryName, weight,
+ QFont::StyleItalic, stretch, antialias, scalable, size, fixed, writingSystems, new QWindowsFontDatabase::FontHandle(faceName));
+ if (weight <= QFont::DemiBold && style != QFont::StyleItalic && styleName.isEmpty())
+ QPlatformFontDatabase::registerFont(familyName, QString(), foundryName, QFont::Bold,
+ QFont::StyleItalic, stretch, antialias, scalable, size, fixed, writingSystems, new QWindowsFontDatabase::FontHandle(faceName));
+
+ // We came here from populating a different font family, so we have
+ // to ensure the entire typographic family is populated before we
+ // mark it as such inside registerFont()
+ if (!subFamilyName.isEmpty()
+ && familyName != subFamilyName
+ && sfp->populatedFontFamily != familyName
+ && !wasPopulated) {
+ sfp->windowsFontDatabase->populateFamily(familyName);
+ }
+
+ if (!subFamilyName.isEmpty() && familyName != subFamilyName) {
+ QPlatformFontDatabase::registerFont(subFamilyName, subFamilyStyle, foundryName, weight,
+ style, stretch, antialias, scalable, size, fixed, writingSystems, new QWindowsFontDatabase::FontHandle(faceName));
+ }
+
+ if (!englishName.isEmpty() && englishName != familyName)
+ QPlatformFontDatabase::registerAliasToFontFamily(familyName, englishName);
+
+ return true;
+}
+
+static int QT_WIN_CALLBACK storeFont(const LOGFONT *logFont, const TEXTMETRIC *textmetric,
+ DWORD type, LPARAM lparam)
+{
+ const ENUMLOGFONTEX *f = reinterpret_cast<const ENUMLOGFONTEX *>(logFont);
+ const QString familyName = QString::fromWCharArray(f->elfLogFont.lfFaceName);
+ const QString styleName = QString::fromWCharArray(f->elfStyle);
+
+ // NEWTEXTMETRICEX (passed for TT fonts) is a NEWTEXTMETRIC, which according
+ // to the documentation is identical to a TEXTMETRIC except for the last four
+ // members, which we don't use anyway
+ const FONTSIGNATURE *signature = nullptr;
+ StoreFontPayload *sfp = reinterpret_cast<StoreFontPayload *>(lparam);
+ Q_ASSERT(sfp != nullptr);
+ if (type & TRUETYPE_FONTTYPE) {
+ signature = &reinterpret_cast<const NEWTEXTMETRICEX *>(textmetric)->ntmFontSig;
+ // We get a callback for each script-type supported, but we register them all
+ // at once using the signature, so we only need one call to addFontToDatabase().
+ if (sfp->foundFontAndStyles.hasSeen({familyName, styleName}))
+ return 1;
+ }
+ addFontToDatabase(familyName, styleName, *logFont, textmetric, signature, type, sfp);
+
+ // keep on enumerating
+ return 1;
+}
+
+bool QWindowsFontDatabase::populateFamilyAliases(const QString &missingFamily)
+{
+ Q_UNUSED(missingFamily);
+
+ if (m_hasPopulatedAliases)
+ return false;
+
+ QStringList families = QFontDatabase::families();
+ for (const QString &family : families)
+ populateFamily(family);
+ m_hasPopulatedAliases = true;
+
+ return true;
+}
+
+void QWindowsFontDatabase::populateFamily(const QString &familyName)
+{
+ qCDebug(lcQpaFonts) << familyName;
+ if (familyName.size() >= LF_FACESIZE) { // Field length of LOGFONT::lfFaceName
+ qCDebug(lcQpaFonts) << "Unable to enumerate family '" << familyName << '\'';
+ return;
+ }
+ HDC dummy = GetDC(0);
+ LOGFONT lf;
+ lf.lfCharSet = DEFAULT_CHARSET;
+ familyName.toWCharArray(lf.lfFaceName);
+ lf.lfFaceName[familyName.size()] = 0;
+ lf.lfPitchAndFamily = 0;
+ StoreFontPayload sfp(familyName, this);
+ EnumFontFamiliesEx(dummy, &lf, storeFont, reinterpret_cast<intptr_t>(&sfp), 0);
+ ReleaseDC(0, dummy);
+}
+
+static int QT_WIN_CALLBACK populateFontFamilies(const LOGFONT *logFont, const TEXTMETRIC *textmetric,
+ DWORD, LPARAM)
+{
+ // the "@family" fonts are just the same as "family". Ignore them.
+ const ENUMLOGFONTEX *f = reinterpret_cast<const ENUMLOGFONTEX *>(logFont);
+ const wchar_t *faceNameW = f->elfLogFont.lfFaceName;
+ if (faceNameW[0] && faceNameW[0] != L'@' && wcsncmp(faceNameW, L"WST_", 4)) {
+ const QString faceName = QString::fromWCharArray(faceNameW);
+ QPlatformFontDatabase::registerFontFamily(faceName);
+ // Register current font's english name as alias
+ const bool ttf = (textmetric->tmPitchAndFamily & TMPF_TRUETYPE);
+ if (ttf && qt_localizedName(faceName)) {
+ const QString englishName = qt_getEnglishName(faceName);
+ if (!englishName.isEmpty())
+ QPlatformFontDatabase::registerAliasToFontFamily(faceName, englishName);
+ }
+ }
+ return 1; // continue
+}
+
+namespace {
+
+QString resolveFontPath(const QString &fontPath)
+{
+ if (fontPath.isEmpty())
+ return QString();
+
+ if (QFile::exists(fontPath))
+ return fontPath;
+
+ // resolve the path relatively to Windows Fonts directory
+ return QStandardPaths::locate(QStandardPaths::FontsLocation, fontPath);
+}
+
+}
+
+void QWindowsFontDatabase::addDefaultEUDCFont()
+{
+ const QString path = QWinRegistryKey(HKEY_CURRENT_USER, LR"(EUDC\1252)")
+ .stringValue(L"SystemDefaultEUDCFont");
+ if (path.isEmpty()) {
+ qCDebug(lcQpaFonts) << "There's no default EUDC font specified";
+ return;
+ }
+
+ const QString absolutePath = resolveFontPath(path);
+ if (absolutePath.isEmpty()) {
+ qCDebug(lcQpaFonts) << "Unable to locate default EUDC font:" << path;
+ return;
+ }
+
+ QFile file(absolutePath);
+ if (!file.open(QIODevice::ReadOnly)) {
+ qCWarning(lcQpaFonts) << "Unable to open default EUDC font:" << absolutePath;
+ return;
+ }
+
+ m_eudcFonts = addApplicationFont(file.readAll(), absolutePath);
+}
+
+void QWindowsFontDatabase::populateFontDatabase()
+{
+ HDC dummy = GetDC(0);
+ LOGFONT lf;
+ lf.lfCharSet = DEFAULT_CHARSET;
+ lf.lfFaceName[0] = 0;
+ lf.lfPitchAndFamily = 0;
+ EnumFontFamiliesEx(dummy, &lf, populateFontFamilies, 0, 0);
+ ReleaseDC(0, dummy);
+ // Work around EnumFontFamiliesEx() not listing the system font.
+ const QString systemDefaultFamily = QWindowsFontDatabase::systemDefaultFont().families().constFirst();
+ if (QPlatformFontDatabase::resolveFontFamilyAlias(systemDefaultFamily) == systemDefaultFamily)
+ QPlatformFontDatabase::registerFontFamily(systemDefaultFamily);
+ addDefaultEUDCFont();
+}
+
+void QWindowsFontDatabase::invalidate()
+{
+ QWindowsFontDatabaseBase::invalidate();
+ removeApplicationFonts();
+}
+
+QWindowsFontDatabase::QWindowsFontDatabase()
+{
+ // Properties accessed by QWin32PrintEngine (Qt Print Support)
+ static const int hfontMetaTypeId = qRegisterMetaType<HFONT>();
+ static const int logFontMetaTypeId = qRegisterMetaType<LOGFONT>();
+ Q_UNUSED(hfontMetaTypeId);
+ Q_UNUSED(logFontMetaTypeId);
+
+ if (lcQpaFonts().isDebugEnabled()) {
+ QSharedPointer<QWindowsFontEngineData> d = data();
+ qCDebug(lcQpaFonts) << __FUNCTION__ << "Clear type: "
+ << d->clearTypeEnabled << "gamma: " << d->fontSmoothingGamma;
+ }
+}
+
+QWindowsFontDatabase::~QWindowsFontDatabase()
+{
+ removeApplicationFonts();
+}
+
+QFontEngine * QWindowsFontDatabase::fontEngine(const QFontDef &fontDef, void *handle)
+{
+ FontHandle *fontHandle = static_cast<FontHandle *>(handle);
+ const QString faceName = fontHandle->faceName.left(LF_FACESIZE - 1);
+ QFontEngine *fe = QWindowsFontDatabase::createEngine(fontDef, faceName,
+ defaultVerticalDPI(),
+ data());
+ qCDebug(lcQpaFonts) << __FUNCTION__ << "FONTDEF" << fontDef << fe << handle;
+ return fe;
+}
+
+QFontEngine *QWindowsFontDatabase::fontEngine(const QByteArray &fontData, qreal pixelSize, QFont::HintingPreference hintingPreference)
+{
+ EmbeddedFont font(fontData);
+ QFontEngine *fontEngine = 0;
+
+#if QT_CONFIG(directwrite)
+ if (!useDirectWrite(hintingPreference))
+#endif
+ {
+ GUID guid;
+ CoCreateGuid(&guid);
+
+QT_WARNING_PUSH
+QT_WARNING_DISABLE_GCC("-Wstrict-aliasing")
+ QString uniqueFamilyName = u'f'
+ + QString::number(guid.Data1, 36) + u'-'
+ + QString::number(guid.Data2, 36) + u'-'
+ + QString::number(guid.Data3, 36) + u'-'
+ + QString::number(*reinterpret_cast<quint64 *>(guid.Data4), 36);
+QT_WARNING_POP
+
+ QString actualFontName = font.changeFamilyName(uniqueFamilyName);
+ if (actualFontName.isEmpty()) {
+ qWarning("%s: Can't change family name of font", __FUNCTION__);
+ return 0;
+ }
+
+ DWORD count = 0;
+ QByteArray newFontData = font.data();
+ HANDLE fontHandle =
+ AddFontMemResourceEx(const_cast<char *>(newFontData.constData()),
+ DWORD(newFontData.size()), 0, &count);
+ if (count == 0 && fontHandle != 0) {
+ RemoveFontMemResourceEx(fontHandle);
+ fontHandle = 0;
+ }
+
+ if (fontHandle == 0) {
+ qWarning("%s: AddFontMemResourceEx failed", __FUNCTION__);
+ } else {
+ QFontDef request;
+ request.families = QStringList(uniqueFamilyName);
+ request.pixelSize = pixelSize;
+ request.styleStrategy = QFont::PreferMatch;
+ request.hintingPreference = hintingPreference;
+ request.stretch = QFont::Unstretched;
+
+ fontEngine = QWindowsFontDatabase::createEngine(request, QString(),
+ defaultVerticalDPI(),
+ data());
+
+ if (fontEngine) {
+ if (request.families != fontEngine->fontDef.families) {
+ qWarning("%s: Failed to load font. Got fallback instead: %s", __FUNCTION__,
+ qPrintable(fontEngine->fontDef.families.constFirst()));
+ if (fontEngine->ref.loadRelaxed() == 0)
+ delete fontEngine;
+ fontEngine = 0;
+ } else {
+ Q_ASSERT(fontEngine->ref.loadRelaxed() == 0);
+
+ // Override the generated font name
+ switch (fontEngine->type()) {
+ case QFontEngine::Win:
+ static_cast<QWindowsFontEngine *>(fontEngine)->setUniqueFamilyName(uniqueFamilyName);
+ fontEngine->fontDef.families = QStringList(actualFontName);
+ break;
+#if QT_CONFIG(directwrite) && QT_CONFIG(direct2d)
+ case QFontEngine::DirectWrite:
+ static_cast<QWindowsFontEngineDirectWrite *>(fontEngine)->setUniqueFamilyName(uniqueFamilyName);
+ fontEngine->fontDef.families = QStringList(actualFontName);
+ break;
+#endif // directwrite && direct2d
+
+ default:
+ Q_ASSERT_X(false, Q_FUNC_INFO, "Unhandled font engine.");
+ }
+
+ UniqueFontData uniqueData{};
+ uniqueData.handle = fontHandle;
+ ++uniqueData.refCount;
+ {
+ const std::scoped_lock lock(m_uniqueFontDataMutex);
+ m_uniqueFontData[uniqueFamilyName] = uniqueData;
+ }
+ }
+ } else {
+ RemoveFontMemResourceEx(fontHandle);
+ }
+ }
+
+ // Get style and weight info
+ if (fontEngine != nullptr)
+ font.updateFromOS2Table(fontEngine);
+ }
+#if QT_CONFIG(directwrite) && QT_CONFIG(direct2d)
+ else {
+ fontEngine = QWindowsFontDatabaseBase::fontEngine(fontData, pixelSize, hintingPreference);
+ }
+#endif // directwrite && direct2d
+
+ qCDebug(lcQpaFonts) << __FUNCTION__ << "FONTDATA" << fontData << pixelSize << hintingPreference << fontEngine;
+ return fontEngine;
+}
+
+static QList<quint32> getTrueTypeFontOffsets(const uchar *fontData, const uchar *fileEndSentinel)
+{
+ QList<quint32> offsets;
+ if (fileEndSentinel - fontData < 12) {
+ qCWarning(lcQpaFonts) << "Corrupted font data detected";
+ return offsets;
+ }
+
+ const quint32 headerTag = qFromUnaligned<quint32>(fontData);
+ if (headerTag != qFromBigEndian(QFont::Tag("ttcf").value())) {
+ if (headerTag != qFromBigEndian(QFont::Tag("\0\1\0\0").value())
+ && headerTag != qFromBigEndian(QFont::Tag("OTTO").value())
+ && headerTag != qFromBigEndian(QFont::Tag("true").value())
+ && headerTag != qFromBigEndian(QFont::Tag("typ1").value())) {
+ return offsets;
+ }
+ offsets << 0;
+ return offsets;
+ }
+
+ const quint32 maximumNumFonts = 0xffff;
+ const quint32 numFonts = qFromBigEndian<quint32>(fontData + 8);
+ if (numFonts > maximumNumFonts) {
+ qCWarning(lcQpaFonts) << "Font collection of" << numFonts << "fonts is too large. Aborting.";
+ return offsets;
+ }
+
+ if (quintptr(fileEndSentinel - fontData) > 12 + (numFonts - 1) * 4) {
+ for (quint32 i = 0; i < numFonts; ++i)
+ offsets << qFromBigEndian<quint32>(fontData + 12 + i * 4);
+ } else {
+ qCWarning(lcQpaFonts) << "Corrupted font data detected";
+ }
+
+ return offsets;
+}
+
+static void getFontTable(const uchar *fileBegin, const uchar *fileEndSentinel, const uchar *data, quint32 tag, const uchar **table, quint32 *length)
+{
+ if (fileEndSentinel - data >= 6) {
+ const quint16 numTables = qFromBigEndian<quint16>(data + 4);
+ if (fileEndSentinel - data >= 28 + 16 * (numTables - 1)) {
+ for (quint32 i = 0; i < numTables; ++i) {
+ const quint32 offset = 12 + 16 * i;
+ if (qFromUnaligned<quint32>(data + offset) == tag) {
+ const quint32 tableOffset = qFromBigEndian<quint32>(data + offset + 8);
+ if (quintptr(fileEndSentinel - fileBegin) <= tableOffset) {
+ qCWarning(lcQpaFonts) << "Corrupted font data detected";
+ break;
+ }
+ *table = fileBegin + tableOffset;
+ *length = qFromBigEndian<quint32>(data + offset + 12);
+ if (quintptr(fileEndSentinel - *table) < *length) {
+ qCWarning(lcQpaFonts) << "Corrupted font data detected";
+ break;
+ }
+ return;
+ }
+ }
+ } else {
+ qCWarning(lcQpaFonts) << "Corrupted font data detected";
+ }
+ } else {
+ qCWarning(lcQpaFonts) << "Corrupted font data detected";
+ }
+ *table = 0;
+ *length = 0;
+ return;
+}
+
+static void getFamiliesAndSignatures(const QByteArray &fontData,
+ QList<QFontNames> *families,
+ QList<FONTSIGNATURE> *signatures,
+ QList<QFontValues> *values)
+{
+ const uchar *data = reinterpret_cast<const uchar *>(fontData.constData());
+ const uchar *dataEndSentinel = data + fontData.size();
+
+ QList<quint32> offsets = getTrueTypeFontOffsets(data, dataEndSentinel);
+ if (offsets.isEmpty())
+ return;
+
+ for (int i = 0; i < offsets.count(); ++i) {
+ const uchar *font = data + offsets.at(i);
+ const uchar *table;
+ quint32 length;
+ getFontTable(data, dataEndSentinel, font,
+ qFromBigEndian(QFont::Tag("name").value()),
+ &table, &length);
+ if (!table)
+ continue;
+ QFontNames names = qt_getCanonicalFontNames(table, length);
+ if (names.name.isEmpty())
+ continue;
+
+ families->append(std::move(names));
+
+ if (values || signatures) {
+ getFontTable(data, dataEndSentinel, font,
+ qFromBigEndian(QFont::Tag("OS/2").value()),
+ &table, &length);
+ }
+
+ if (values) {
+ QFontValues fontValues;
+ if (table && length >= 64) {
+ // Read in some details about the font, offset calculated based on the specification
+ fontValues.weight = qFromBigEndian<quint16>(table + 4);
+
+ quint16 fsSelection = qFromBigEndian<quint16>(table + 62);
+ fontValues.isItalic = (fsSelection & 1) != 0;
+ fontValues.isUnderlined = (fsSelection & (1 << 1)) != 0;
+ fontValues.isOverstruck = (fsSelection & (1 << 4)) != 0;
+ }
+ values->append(std::move(fontValues));
+ }
+
+ if (signatures) {
+ FONTSIGNATURE signature;
+ if (table && length >= 86) {
+ // Offsets taken from OS/2 table in the TrueType spec
+ signature.fsUsb[0] = qFromBigEndian<quint32>(table + 42);
+ signature.fsUsb[1] = qFromBigEndian<quint32>(table + 46);
+ signature.fsUsb[2] = qFromBigEndian<quint32>(table + 50);
+ signature.fsUsb[3] = qFromBigEndian<quint32>(table + 54);
+
+ signature.fsCsb[0] = qFromBigEndian<quint32>(table + 78);
+ signature.fsCsb[1] = qFromBigEndian<quint32>(table + 82);
+ } else {
+ memset(&signature, 0, sizeof(signature));
+ }
+ signatures->append(signature);
+ }
+ }
+}
+
+QStringList QWindowsFontDatabase::addApplicationFont(const QByteArray &fontData, const QString &fileName, QFontDatabasePrivate::ApplicationFont *applicationFont)
+{
+ WinApplicationFont font;
+ font.fileName = fileName;
+ QList<FONTSIGNATURE> signatures;
+ QList<QFontValues> fontValues;
+ QList<QFontNames> families;
+ QStringList familyNames;
+
+ if (!fontData.isEmpty()) {
+ getFamiliesAndSignatures(fontData, &families, &signatures, &fontValues);
+ if (families.isEmpty())
+ return familyNames;
+
+ DWORD dummy = 0;
+ font.handle =
+ AddFontMemResourceEx(const_cast<char *>(fontData.constData()),
+ DWORD(fontData.size()), 0, &dummy);
+ if (font.handle == 0)
+ return QStringList();
+
+ // Memory fonts won't show up in enumeration, so do add them the hard way.
+ for (int j = 0; j < families.count(); ++j) {
+ const auto &family = families.at(j);
+ const QString &familyName = family.name;
+ const QString &styleName = family.style;
+ familyNames << familyName;
+ HDC hdc = GetDC(0);
+ LOGFONT lf;
+ memset(&lf, 0, sizeof(LOGFONT));
+ memcpy(lf.lfFaceName, familyName.data(), sizeof(wchar_t) * qMin(LF_FACESIZE - 1, familyName.size()));
+ lf.lfCharSet = DEFAULT_CHARSET;
+ const QFontValues &values = fontValues.at(j);
+ lf.lfWeight = values.weight;
+ if (values.isItalic)
+ lf.lfItalic = TRUE;
+ if (values.isOverstruck)
+ lf.lfStrikeOut = TRUE;
+ if (values.isUnderlined)
+ lf.lfUnderline = TRUE;
+ HFONT hfont = CreateFontIndirect(&lf);
+ HGDIOBJ oldobj = SelectObject(hdc, hfont);
+
+ if (applicationFont != nullptr) {
+ QFontDatabasePrivate::ApplicationFont::Properties properties;
+ properties.style = values.isItalic ? QFont::StyleItalic : QFont::StyleNormal;
+ properties.weight = static_cast<int>(values.weight);
+ properties.familyName = familyName;
+ properties.styleName = styleName;
+
+ applicationFont->properties.append(properties);
+ }
+
+ TEXTMETRIC textMetrics;
+ GetTextMetrics(hdc, &textMetrics);
+
+ StoreFontPayload sfp(familyName, this);
+ addFontToDatabase(familyName, styleName, lf, &textMetrics, &signatures.at(j),
+ TRUETYPE_FONTTYPE, &sfp);
+
+ SelectObject(hdc, oldobj);
+ DeleteObject(hfont);
+ ReleaseDC(0, hdc);
+ }
+ } else {
+ QFile f(fileName);
+ if (!f.open(QIODevice::ReadOnly))
+ return QStringList();
+ QByteArray data = f.readAll();
+ f.close();
+
+
+ getFamiliesAndSignatures(data, &families, nullptr, applicationFont != nullptr ? &fontValues : nullptr);
+
+ if (families.isEmpty())
+ return QStringList();
+
+ if (AddFontResourceExW((wchar_t*)fileName.utf16(), FR_PRIVATE, 0) == 0)
+ return QStringList();
+
+ font.handle = 0;
+
+ // Fonts based on files are added via populate, as they will show up in font enumeration.
+ for (int j = 0; j < families.count(); ++j) {
+ const QString familyName = families.at(j).name;
+ familyNames << familyName;
+
+ if (applicationFont != nullptr) {
+ const QString &styleName = families.at(j).style;
+ const QFontValues &values = fontValues.at(j);
+
+ QFontDatabasePrivate::ApplicationFont::Properties properties;
+ properties.style = values.isItalic ? QFont::StyleItalic : QFont::StyleNormal;
+ properties.weight = static_cast<int>(values.weight);
+ properties.familyName = familyName;
+ properties.styleName = styleName;
+
+ applicationFont->properties.append(properties);
+ }
+
+ populateFamily(familyName);
+ }
+ }
+
+ m_applicationFonts << font;
+
+ return familyNames;
+}
+
+void QWindowsFontDatabase::removeApplicationFonts()
+{
+ for (const WinApplicationFont &font : std::as_const(m_applicationFonts)) {
+ if (font.handle) {
+ RemoveFontMemResourceEx(font.handle);
+ } else {
+ RemoveFontResourceExW(reinterpret_cast<LPCWSTR>(font.fileName.utf16()),
+ FR_PRIVATE, nullptr);
+ }
+ }
+ m_applicationFonts.clear();
+ m_eudcFonts.clear();
+}
+
+QWindowsFontDatabase::FontHandle::FontHandle(IDWriteFontFace *face, const QString &name)
+ : fontFace(face), faceName(name)
+{
+ fontFace->AddRef();
+}
+
+
+QWindowsFontDatabase::FontHandle::~FontHandle()
+{
+ if (fontFace != nullptr)
+ fontFace->Release();
+}
+
+void QWindowsFontDatabase::releaseHandle(void *handle)
+{
+ delete static_cast<FontHandle *>(handle);
+}
+
+QString QWindowsFontDatabase::fontDir() const
+{
+ const QString result = QPlatformFontDatabase::fontDir();
+ qCDebug(lcQpaFonts) << __FUNCTION__ << result;
+ return result;
+}
+
+bool QWindowsFontDatabase::fontsAlwaysScalable() const
+{
+ return false;
+}
+
+void QWindowsFontDatabase::derefUniqueFont(const QString &uniqueFont)
+{
+ const std::scoped_lock lock(m_uniqueFontDataMutex);
+ const auto it = m_uniqueFontData.find(uniqueFont);
+ if (it != m_uniqueFontData.end()) {
+ if (--it->refCount == 0) {
+ RemoveFontMemResourceEx(it->handle);
+ m_uniqueFontData.erase(it);
+ }
+ }
+}
+
+void QWindowsFontDatabase::refUniqueFont(const QString &uniqueFont)
+{
+ const std::scoped_lock lock(m_uniqueFontDataMutex);
+ const auto it = m_uniqueFontData.find(uniqueFont);
+ if (it != m_uniqueFontData.end())
+ ++it->refCount;
+}
+
+QStringList QWindowsFontDatabase::fallbacksForFamily(const QString &family, QFont::Style style, QFont::StyleHint styleHint, QChar::Script script) const
+{
+ QStringList result;
+ result.append(familyForStyleHint(styleHint));
+ result.append(m_eudcFonts);
+ result.append(extraTryFontsForFamily(family));
+ result.append(QPlatformFontDatabase::fallbacksForFamily(family, style, styleHint, script));
+
+ qCDebug(lcQpaFonts) << __FUNCTION__ << family << style << styleHint
+ << script << result;
+ return result;
+}
+
+
+QFontEngine *QWindowsFontDatabase::createEngine(const QFontDef &request, const QString &faceName,
+ int dpi,
+ const QSharedPointer<QWindowsFontEngineData> &data)
+{
+ QFontEngine *fe = nullptr;
+
+ LOGFONT lf = fontDefToLOGFONT(request, faceName);
+ const bool preferClearTypeAA = lf.lfQuality == CLEARTYPE_QUALITY;
+
+ if (request.stretch != 100) {
+ HFONT hfont = CreateFontIndirect(&lf);
+ if (!hfont) {
+ qErrnoWarning("%s: CreateFontIndirect failed", __FUNCTION__);
+ hfont = QWindowsFontDatabase::systemFont();
+ }
+
+ HGDIOBJ oldObj = SelectObject(data->hdc, hfont);
+ TEXTMETRIC tm;
+ if (!GetTextMetrics(data->hdc, &tm))
+ qErrnoWarning("%s: GetTextMetrics failed", __FUNCTION__);
+ else
+ lf.lfWidth = tm.tmAveCharWidth * request.stretch / 100;
+ SelectObject(data->hdc, oldObj);
+
+ DeleteObject(hfont);
+ }
+
+#if QT_CONFIG(directwrite) && QT_CONFIG(direct2d)
+ if (data->directWriteFactory != nullptr) {
+ const QString fam = QString::fromWCharArray(lf.lfFaceName);
+ const QString nameSubstitute = QWindowsFontEngineDirectWrite::fontNameSubstitute(fam);
+ if (nameSubstitute != fam) {
+ const int nameSubstituteLength = qMin(nameSubstitute.length(), LF_FACESIZE - 1);
+ memcpy(lf.lfFaceName, nameSubstitute.data(), nameSubstituteLength * sizeof(wchar_t));
+ lf.lfFaceName[nameSubstituteLength] = 0;
+ }
+
+ HFONT hfont = CreateFontIndirect(&lf);
+ if (!hfont) {
+ qErrnoWarning("%s: CreateFontIndirect failed", __FUNCTION__);
+ } else {
+ HGDIOBJ oldFont = SelectObject(data->hdc, hfont);
+
+ const QFont::HintingPreference hintingPreference =
+ static_cast<QFont::HintingPreference>(request.hintingPreference);
+ bool useDw = useDirectWrite(hintingPreference, fam);
+
+ IDWriteFontFace *directWriteFontFace = NULL;
+ HRESULT hr = data->directWriteGdiInterop->CreateFontFaceFromHdc(data->hdc, &directWriteFontFace);
+ if (SUCCEEDED(hr)) {
+ bool isColorFont = false;
+ bool needsSimulation = false;
+#if QT_CONFIG(direct2d)
+ IDWriteFontFace2 *directWriteFontFace2 = nullptr;
+ if (SUCCEEDED(directWriteFontFace->QueryInterface(__uuidof(IDWriteFontFace2),
+ reinterpret_cast<void **>(&directWriteFontFace2)))) {
+ if (directWriteFontFace2->IsColorFont())
+ isColorFont = directWriteFontFace2->GetPaletteEntryCount() > 0;
+
+ needsSimulation = directWriteFontFace2->GetSimulations() != DWRITE_FONT_SIMULATIONS_NONE;
+
+ directWriteFontFace2->Release();
+ }
+#endif // direct2d
+ useDw = useDw || useDirectWrite(hintingPreference, fam, isColorFont) || needsSimulation;
+ qCDebug(lcQpaFonts)
+ << __FUNCTION__ << request.families.first() << request.pointSize << "pt"
+ << "hintingPreference=" << hintingPreference << "color=" << isColorFont
+ << dpi << "dpi"
+ << "useDirectWrite=" << useDw;
+ if (useDw) {
+ QWindowsFontEngineDirectWrite *fedw = new QWindowsFontEngineDirectWrite(directWriteFontFace,
+ request.pixelSize,
+ data);
+
+ wchar_t n[64];
+ GetTextFace(data->hdc, 64, n);
+
+ QFontDef fontDef = request;
+ fontDef.families = QStringList(QString::fromWCharArray(n));
+ fedw->initFontInfo(fontDef, dpi);
+ fe = fedw;
+ }
+ directWriteFontFace->Release();
+ } else if (useDw) {
+ const QString errorString = qt_error_string(int(hr));
+ qWarning().noquote().nospace() << "DirectWrite: CreateFontFaceFromHDC() failed ("
+ << errorString << ") for " << request << ' ' << lf << " dpi=" << dpi;
+ }
+
+ SelectObject(data->hdc, oldFont);
+ DeleteObject(hfont);
+ }
+ }
+#endif // directwrite direct2d
+
+ if (!fe) {
+ QWindowsFontEngine *few = new QWindowsFontEngine(request.families.first(), lf, data);
+ if (preferClearTypeAA)
+ few->glyphFormat = QFontEngine::Format_A32;
+ few->initFontInfo(request, dpi);
+ fe = few;
+ }
+
+ return fe;
+}
+
+bool QWindowsFontDatabase::isPrivateFontFamily(const QString &family) const
+{
+ return m_eudcFonts.contains(family) || QPlatformFontDatabase::isPrivateFontFamily(family);
+}
+
+QT_END_NAMESPACE
diff --git a/src/gui/text/windows/qwindowsfontdatabase_ft.cpp b/src/gui/text/windows/qwindowsfontdatabase_ft.cpp
new file mode 100644
index 0000000000..0604a85e35
--- /dev/null
+++ b/src/gui/text/windows/qwindowsfontdatabase_ft.cpp
@@ -0,0 +1,424 @@
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
+
+#include "qwindowsfontdatabase_ft_p.h"
+#include "qwindowsfontdatabase_p.h"
+
+#include <QtGui/private/qfontengine_ft_p.h>
+
+#include <ft2build.h>
+#include FT_TRUETYPE_TABLES_H
+
+#include <QtCore/QDir>
+#include <QtCore/QDirIterator>
+#include <QtCore/QSettings>
+#if QT_CONFIG(regularexpression)
+#include <QtCore/QRegularExpression>
+#endif
+#include <QtCore/private/qduplicatetracker_p.h>
+
+#include <QtGui/QGuiApplication>
+#include <QtGui/QFontDatabase>
+
+#include <wchar.h>
+
+QT_BEGIN_NAMESPACE
+
+using namespace Qt::StringLiterals;
+
+static inline QFontDatabase::WritingSystem writingSystemFromCharSet(uchar charSet)
+{
+ switch (charSet) {
+ case ANSI_CHARSET:
+ case EASTEUROPE_CHARSET:
+ case BALTIC_CHARSET:
+ case TURKISH_CHARSET:
+ return QFontDatabase::Latin;
+ case GREEK_CHARSET:
+ return QFontDatabase::Greek;
+ case RUSSIAN_CHARSET:
+ return QFontDatabase::Cyrillic;
+ case HEBREW_CHARSET:
+ return QFontDatabase::Hebrew;
+ case ARABIC_CHARSET:
+ return QFontDatabase::Arabic;
+ case THAI_CHARSET:
+ return QFontDatabase::Thai;
+ case GB2312_CHARSET:
+ return QFontDatabase::SimplifiedChinese;
+ case CHINESEBIG5_CHARSET:
+ return QFontDatabase::TraditionalChinese;
+ case SHIFTJIS_CHARSET:
+ return QFontDatabase::Japanese;
+ case HANGUL_CHARSET:
+ case JOHAB_CHARSET:
+ return QFontDatabase::Korean;
+ case VIETNAMESE_CHARSET:
+ return QFontDatabase::Vietnamese;
+ case SYMBOL_CHARSET:
+ return QFontDatabase::Symbol;
+ default:
+ break;
+ }
+ return QFontDatabase::Any;
+}
+
+static FontFile * createFontFile(const QString &fileName, int index)
+{
+ FontFile *fontFile = new FontFile;
+ fontFile->fileName = fileName;
+ fontFile->indexValue = index;
+ return fontFile;
+}
+
+namespace {
+struct FontKey
+{
+ QString fileName;
+ QStringList fontNames;
+};
+} // namespace
+
+using FontKeys = QList<FontKey>;
+
+static FontKeys &fontKeys()
+{
+ static FontKeys result;
+ if (result.isEmpty()) {
+ const QStringList keys = { QStringLiteral("HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion\\Fonts"),
+ QStringLiteral("HKEY_CURRENT_USER\\SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion\\Fonts") };
+ for (const auto &key : keys) {
+ const QSettings fontRegistry(key, QSettings::NativeFormat);
+ const QStringList allKeys = fontRegistry.allKeys();
+ const QString trueType = QStringLiteral("(TrueType)");
+#if QT_CONFIG(regularexpression)
+ const QRegularExpression sizeListMatch(QStringLiteral("\\s(\\d+,)+\\d+"));
+ Q_ASSERT(sizeListMatch.isValid());
+#endif
+ const int size = allKeys.size();
+ result.reserve(result.size() + size);
+ for (int i = 0; i < size; ++i) {
+ FontKey fontKey;
+ const QString &registryFontKey = allKeys.at(i);
+ fontKey.fileName = fontRegistry.value(registryFontKey).toString();
+ QString realKey = registryFontKey;
+ realKey.remove(trueType);
+#if QT_CONFIG(regularexpression)
+ realKey.remove(sizeListMatch);
+#endif
+ const auto fontNames = QStringView(realKey).trimmed().split(u'&');
+ fontKey.fontNames.reserve(fontNames.size());
+ for (const auto &fontName : fontNames)
+ fontKey.fontNames.append(fontName.trimmed().toString());
+ result.append(fontKey);
+ }
+ }
+ }
+ return result;
+}
+
+static const FontKey *findFontKey(const QString &name, int *indexIn = nullptr)
+{
+ const FontKeys &keys = fontKeys();
+ for (auto it = keys.constBegin(), cend = keys.constEnd(); it != cend; ++it) {
+ const int index = it->fontNames.indexOf(name);
+ if (index >= 0) {
+ if (indexIn)
+ *indexIn = index;
+ return &(*it);
+ }
+ }
+ if (indexIn)
+ *indexIn = -1;
+ return nullptr;
+}
+
+static bool addFontToDatabase(QString familyName,
+ QString styleName,
+ const QString &fullName,
+ const LOGFONT &logFont,
+ const TEXTMETRIC *textmetric,
+ const FONTSIGNATURE *signature,
+ int type)
+{
+ // the "@family" fonts are just the same as "family". Ignore them.
+ if (familyName.isEmpty() || familyName.at(0) == u'@' || familyName.startsWith("WST_"_L1))
+ return false;
+
+ uchar charSet = logFont.lfCharSet;
+
+ static const int SMOOTH_SCALABLE = 0xffff;
+ const QString foundryName; // No such concept.
+ const bool fixed = !(textmetric->tmPitchAndFamily & TMPF_FIXED_PITCH);
+ const bool ttf = (textmetric->tmPitchAndFamily & TMPF_TRUETYPE);
+ const bool scalable = textmetric->tmPitchAndFamily & (TMPF_VECTOR|TMPF_TRUETYPE);
+ const int size = scalable ? SMOOTH_SCALABLE : textmetric->tmHeight;
+ const QFont::Style style = textmetric->tmItalic ? QFont::StyleItalic : QFont::StyleNormal;
+ const bool antialias = false;
+ const QFont::Weight weight = static_cast<QFont::Weight>(textmetric->tmWeight);
+ const QFont::Stretch stretch = QFont::Unstretched;
+
+#ifndef QT_NO_DEBUG_STREAM
+ if (lcQpaFonts().isDebugEnabled()) {
+ QString message;
+ QTextStream str(&message);
+ str << __FUNCTION__ << ' ' << familyName << "::" << fullName << ' ' << charSet << " TTF=" << ttf;
+ if (type & DEVICE_FONTTYPE)
+ str << " DEVICE";
+ if (type & RASTER_FONTTYPE)
+ str << " RASTER";
+ if (type & TRUETYPE_FONTTYPE)
+ str << " TRUETYPE";
+ str << " scalable=" << scalable << " Size=" << size
+ << " Style=" << style << " Weight=" << weight
+ << " stretch=" << stretch;
+ qCDebug(lcQpaFonts) << message;
+ }
+#endif
+
+ QString englishName;
+ QString faceName = familyName;
+
+ QString subFamilyName;
+ QString subFamilyStyle;
+ // Look-up names registered in the font
+ QFontNames canonicalNames = qt_getCanonicalFontNames(logFont);
+ if (qt_localizedName(familyName) && !canonicalNames.name.isEmpty())
+ englishName = canonicalNames.name;
+ if (!canonicalNames.preferredName.isEmpty()) {
+ subFamilyName = familyName;
+ subFamilyStyle = styleName;
+ familyName = canonicalNames.preferredName;
+ styleName = canonicalNames.preferredStyle;
+ }
+
+ QSupportedWritingSystems writingSystems;
+ if (type & TRUETYPE_FONTTYPE) {
+ Q_ASSERT(signature);
+ quint32 unicodeRange[4] = {
+ signature->fsUsb[0], signature->fsUsb[1],
+ signature->fsUsb[2], signature->fsUsb[3]
+ };
+ quint32 codePageRange[2] = {
+ signature->fsCsb[0], signature->fsCsb[1]
+ };
+ writingSystems = QPlatformFontDatabase::writingSystemsFromTrueTypeBits(unicodeRange, codePageRange);
+ // ### Hack to work around problem with Thai text on Windows 7. Segoe UI contains
+ // the symbol for Baht, and Windows thus reports that it supports the Thai script.
+ // Since it's the default UI font on this platform, most widgets will be unable to
+ // display Thai text by default. As a temporary work around, we special case Segoe UI
+ // and remove the Thai script from its list of supported writing systems.
+ if (writingSystems.supported(QFontDatabase::Thai) && faceName == "Segoe UI"_L1)
+ writingSystems.setSupported(QFontDatabase::Thai, false);
+ } else {
+ const QFontDatabase::WritingSystem ws = writingSystemFromCharSet(charSet);
+ if (ws != QFontDatabase::Any)
+ writingSystems.setSupported(ws);
+ }
+
+ int index = 0;
+ const FontKey *key = findFontKey(fullName, &index);
+ if (!key) {
+ // On non-English locales, the styles of the font may be localized in enumeration, but
+ // not in the registry.
+ QLocale systemLocale = QLocale::system();
+ if (systemLocale.language() != QLocale::C
+ && systemLocale.language() != QLocale::English
+ && styleName != "Italic"_L1
+ && styleName != "Bold"_L1) {
+ key = findFontKey(qt_getEnglishName(fullName, true), &index);
+ }
+ if (!key)
+ key = findFontKey(faceName, &index);
+ if (!key && !englishName.isEmpty())
+ key = findFontKey(englishName, &index);
+ if (!key)
+ return false;
+ }
+ QString value = key->fileName;
+ if (value.isEmpty())
+ return false;
+
+ if (!QDir::isAbsolutePath(value))
+ value.prepend(QFile::decodeName(qgetenv("windir") + "\\Fonts\\"));
+
+ QPlatformFontDatabase::registerFont(familyName, styleName, foundryName, weight, style, stretch,
+ antialias, scalable, size, fixed, writingSystems, createFontFile(value, index));
+
+ // add fonts windows can generate for us:
+ if (weight <= QFont::DemiBold && styleName.isEmpty())
+ QPlatformFontDatabase::registerFont(familyName, QString(), foundryName, QFont::Bold, style, stretch,
+ antialias, scalable, size, fixed, writingSystems, createFontFile(value, index));
+
+ if (style != QFont::StyleItalic && styleName.isEmpty())
+ QPlatformFontDatabase::registerFont(familyName, QString(), foundryName, weight, QFont::StyleItalic, stretch,
+ antialias, scalable, size, fixed, writingSystems, createFontFile(value, index));
+
+ if (weight <= QFont::DemiBold && style != QFont::StyleItalic && styleName.isEmpty())
+ QPlatformFontDatabase::registerFont(familyName, QString(), foundryName, QFont::Bold, QFont::StyleItalic, stretch,
+ antialias, scalable, size, fixed, writingSystems, createFontFile(value, index));
+
+ if (!subFamilyName.isEmpty() && familyName != subFamilyName) {
+ QPlatformFontDatabase::registerFont(subFamilyName, subFamilyStyle, foundryName, weight,
+ style, stretch, antialias, scalable, size, fixed, writingSystems, createFontFile(value, index));
+ }
+
+ if (!englishName.isEmpty() && englishName != familyName)
+ QPlatformFontDatabase::registerAliasToFontFamily(familyName, englishName);
+
+ return true;
+}
+
+static int QT_WIN_CALLBACK storeFont(const LOGFONT *logFont, const TEXTMETRIC *textmetric,
+ DWORD type, LPARAM lparam)
+{
+ const ENUMLOGFONTEX *f = reinterpret_cast<const ENUMLOGFONTEX *>(logFont);
+ const QString faceName = QString::fromWCharArray(f->elfLogFont.lfFaceName);
+ const QString styleName = QString::fromWCharArray(f->elfStyle);
+ const QString fullName = QString::fromWCharArray(f->elfFullName);
+
+ // NEWTEXTMETRICEX (passed for TT fonts) is a NEWTEXTMETRIC, which according
+ // to the documentation is identical to a TEXTMETRIC except for the last four
+ // members, which we don't use anyway
+ const FONTSIGNATURE *signature = nullptr;
+ if (type & TRUETYPE_FONTTYPE) {
+ signature = &reinterpret_cast<const NEWTEXTMETRICEX *>(textmetric)->ntmFontSig;
+ // We get a callback for each script-type supported, but we register them all
+ // at once using the signature, so we only need one call to addFontToDatabase().
+ auto foundFontAndStyles = reinterpret_cast<QDuplicateTracker<FontAndStyle> *>(lparam);
+ if (foundFontAndStyles->hasSeen({faceName, styleName}))
+ return 1;
+ }
+ addFontToDatabase(faceName, styleName, fullName, *logFont, textmetric, signature, type);
+
+ // keep on enumerating
+ return 1;
+}
+
+bool QWindowsFontDatabaseFT::populateFamilyAliases(const QString &missingFamily)
+{
+ Q_UNUSED(missingFamily);
+
+ if (m_hasPopulatedAliases)
+ return false;
+
+ QStringList families = QFontDatabase::families();
+ for (const QString &family : families)
+ populateFamily(family);
+ m_hasPopulatedAliases = true;
+
+ return true;
+}
+
+/*
+ \brief Populates the font database using EnumFontFamiliesEx().
+
+ Normally, leaving the name empty should enumerate
+ all fonts, however, system fonts like "MS Shell Dlg 2"
+ are only found when specifying the name explicitly.
+*/
+
+void QWindowsFontDatabaseFT::populateFamily(const QString &familyName)
+{
+ qCDebug(lcQpaFonts) << familyName;
+ if (familyName.size() >= LF_FACESIZE) {
+ qCWarning(lcQpaFonts) << "Unable to enumerate family '" << familyName << '\'';
+ return;
+ }
+ HDC dummy = GetDC(0);
+ LOGFONT lf;
+ memset(&lf, 0, sizeof(LOGFONT));
+ familyName.toWCharArray(lf.lfFaceName);
+ lf.lfFaceName[familyName.size()] = 0;
+ lf.lfCharSet = DEFAULT_CHARSET;
+ lf.lfPitchAndFamily = 0;
+ QDuplicateTracker<FontAndStyle> foundFontAndStyles;
+ EnumFontFamiliesEx(dummy, &lf, storeFont, reinterpret_cast<intptr_t>(&foundFontAndStyles), 0);
+ ReleaseDC(0, dummy);
+}
+
+// Delayed population of font families
+
+static int QT_WIN_CALLBACK populateFontFamilies(const LOGFONT *logFont, const TEXTMETRIC *textmetric,
+ DWORD, LPARAM)
+{
+ const ENUMLOGFONTEX *f = reinterpret_cast<const ENUMLOGFONTEX *>(logFont);
+ // the "@family" fonts are just the same as "family". Ignore them.
+ const wchar_t *faceNameW = f->elfLogFont.lfFaceName;
+ if (faceNameW[0] && faceNameW[0] != L'@' && wcsncmp(faceNameW, L"WST_", 4)) {
+ // Register only font families for which a font file exists for delayed population
+ const bool ttf = textmetric->tmPitchAndFamily & TMPF_TRUETYPE;
+ const QString faceName = QString::fromWCharArray(faceNameW);
+ const FontKey *key = findFontKey(faceName);
+ if (!key) {
+ key = findFontKey(QString::fromWCharArray(f->elfFullName));
+ if (!key && ttf && qt_localizedName(faceName))
+ key = findFontKey(qt_getEnglishName(faceName));
+ }
+ if (key) {
+ QPlatformFontDatabase::registerFontFamily(faceName);
+ // Register current font's english name as alias
+ if (ttf && qt_localizedName(faceName)) {
+ const QString englishName = qt_getEnglishName(faceName);
+ if (!englishName.isEmpty())
+ QPlatformFontDatabase::registerAliasToFontFamily(faceName, englishName);
+ }
+ }
+ }
+ return 1; // continue
+}
+
+void QWindowsFontDatabaseFT::populateFontDatabase()
+{
+ HDC dummy = GetDC(0);
+ LOGFONT lf;
+ lf.lfCharSet = DEFAULT_CHARSET;
+ lf.lfFaceName[0] = 0;
+ lf.lfPitchAndFamily = 0;
+ EnumFontFamiliesEx(dummy, &lf, populateFontFamilies, 0, 0);
+ ReleaseDC(0, dummy);
+ // Work around EnumFontFamiliesEx() not listing the system font
+ const QString systemDefaultFamily = QWindowsFontDatabase::systemDefaultFont().families().constFirst();
+ if (QPlatformFontDatabase::resolveFontFamilyAlias(systemDefaultFamily) == systemDefaultFamily)
+ QPlatformFontDatabase::registerFontFamily(systemDefaultFamily);
+}
+
+QFontEngine * QWindowsFontDatabaseFT::fontEngine(const QFontDef &fontDef, void *handle)
+{
+ QFontEngine *fe = QFreeTypeFontDatabase::fontEngine(fontDef, handle);
+ qCDebug(lcQpaFonts) << __FUNCTION__ << "FONTDEF" << fontDef.families.constFirst() << fe << handle;
+ return fe;
+}
+
+QFontEngine *QWindowsFontDatabaseFT::fontEngine(const QByteArray &fontData, qreal pixelSize, QFont::HintingPreference hintingPreference)
+{
+ QFontEngine *fe = QFreeTypeFontDatabase::fontEngine(fontData, pixelSize, hintingPreference);
+ qCDebug(lcQpaFonts) << __FUNCTION__ << "FONTDATA" << fontData << pixelSize << hintingPreference << fe;
+ return fe;
+}
+
+QStringList QWindowsFontDatabaseFT::fallbacksForFamily(const QString &family, QFont::Style style, QFont::StyleHint styleHint, QChar::Script script) const
+{
+ QStringList result;
+ result.append(QWindowsFontDatabaseBase::familyForStyleHint(styleHint));
+ result.append(QWindowsFontDatabaseBase::extraTryFontsForFamily(family));
+ result.append(QFreeTypeFontDatabase::fallbacksForFamily(family, style, styleHint, script));
+
+ qCDebug(lcQpaFonts) << __FUNCTION__ << family << style << styleHint
+ << script << result;
+
+ return result;
+}
+QString QWindowsFontDatabaseFT::fontDir() const
+{
+ const QString result = QLatin1StringView(qgetenv("windir")) + "/Fonts"_L1;//QPlatformFontDatabase::fontDir();
+ qCDebug(lcQpaFonts) << __FUNCTION__ << result;
+ return result;
+}
+
+QFont QWindowsFontDatabaseFT::defaultFont() const
+{
+ return QWindowsFontDatabase::systemDefaultFont();
+}
+
+QT_END_NAMESPACE
diff --git a/src/gui/text/windows/qwindowsfontdatabase_ft_p.h b/src/gui/text/windows/qwindowsfontdatabase_ft_p.h
new file mode 100644
index 0000000000..381a7be4e7
--- /dev/null
+++ b/src/gui/text/windows/qwindowsfontdatabase_ft_p.h
@@ -0,0 +1,46 @@
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
+
+#ifndef QWINDOWSFONTDATABASEFT_H
+#define QWINDOWSFONTDATABASEFT_H
+
+//
+// W A R N I N G
+// -------------
+//
+// This file is not part of the Qt API. It exists purely as an
+// implementation detail. This header file may change from version to
+// version without notice, or even be removed.
+//
+// We mean it.
+//
+
+#include <QtGui/private/qfreetypefontdatabase_p.h>
+#include <QtCore/QSharedPointer>
+#include <QtCore/qt_windows.h>
+
+QT_BEGIN_NAMESPACE
+
+class Q_GUI_EXPORT QWindowsFontDatabaseFT : public QFreeTypeFontDatabase
+{
+public:
+ void populateFontDatabase() override;
+ bool populateFamilyAliases(const QString &familyName) override;
+ void populateFamily(const QString &familyName) override;
+ QFontEngine *fontEngine(const QFontDef &fontDef, void *handle) override;
+ QFontEngine *fontEngine(const QByteArray &fontData, qreal pixelSize,
+ QFont::HintingPreference hintingPreference) override;
+
+ QStringList fallbacksForFamily(const QString &family, QFont::Style style,
+ QFont::StyleHint styleHint,
+ QChar::Script script) const override;
+
+ QString fontDir() const override;
+ QFont defaultFont() const override;
+
+ bool m_hasPopulatedAliases = false;
+};
+
+QT_END_NAMESPACE
+
+#endif // QWINDOWSFONTDATABASEFT_H
diff --git a/src/gui/text/windows/qwindowsfontdatabase_p.h b/src/gui/text/windows/qwindowsfontdatabase_p.h
new file mode 100644
index 0000000000..0c99c91fde
--- /dev/null
+++ b/src/gui/text/windows/qwindowsfontdatabase_p.h
@@ -0,0 +1,159 @@
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
+
+#ifndef QWINDOWSFONTDATABASE_H
+#define QWINDOWSFONTDATABASE_H
+
+//
+// W A R N I N G
+// -------------
+//
+// This file is not part of the Qt API. It exists purely as an
+// implementation detail. This header file may change from version to
+// version without notice, or even be removed.
+//
+// We mean it.
+//
+
+#include "qwindowsfontdatabasebase_p.h"
+
+#include <qpa/qplatformfontdatabase.h>
+#include <QtCore/QSharedPointer>
+#include <QtCore/QLoggingCategory>
+#include <QtCore/qhashfunctions.h>
+#include <QtCore/qmutex.h>
+#include <QtCore/qt_windows.h>
+
+QT_BEGIN_NAMESPACE
+
+class QDebug;
+
+class Q_GUI_EXPORT QWindowsFontDatabase : public QWindowsFontDatabaseBase
+{
+ Q_DISABLE_COPY_MOVE(QWindowsFontDatabase)
+public:
+ enum FontOptions {
+ // Relevant bits from QWindowsIntegration::Options
+ DontUseDirectWriteFonts = 0x40,
+ DontUseColorFonts = 0x80
+ };
+
+ QWindowsFontDatabase();
+ ~QWindowsFontDatabase() override;
+
+ void ensureFamilyPopulated(const QString &familyName);
+
+ void populateFontDatabase() override;
+ void invalidate() override;
+ void removeApplicationFonts();
+
+ void populateFamily(const QString &familyName) override;
+ bool populateFamilyAliases(const QString &missingFamily) override;
+ QFontEngine *fontEngine(const QFontDef &fontDef, void *handle) override;
+ QFontEngine *fontEngine(const QByteArray &fontData, qreal pixelSize, QFont::HintingPreference hintingPreference) override;
+ QStringList fallbacksForFamily(const QString &family, QFont::Style style, QFont::StyleHint styleHint, QChar::Script script) const override;
+ QStringList addApplicationFont(const QByteArray &fontData, const QString &fileName, QFontDatabasePrivate::ApplicationFont *applicationFont = nullptr) override;
+ void releaseHandle(void *handle) override;
+ QString fontDir() const override;
+
+ QFont defaultFont() const override { return systemDefaultFont(); }
+ bool fontsAlwaysScalable() const override;
+ void derefUniqueFont(const QString &uniqueFont);
+ void refUniqueFont(const QString &uniqueFont);
+ bool isPrivateFontFamily(const QString &family) const override;
+
+ static QFontEngine *createEngine(const QFontDef &request, const QString &faceName,
+ int dpi,
+ const QSharedPointer<QWindowsFontEngineData> &data);
+
+ static qreal fontSmoothingGamma();
+
+ static void setFontOptions(unsigned options);
+ static unsigned fontOptions();
+
+#ifndef QT_NO_DEBUG_STREAM
+ static void debugFormat(QDebug &d, const LOGFONT &lf);
+#endif // !QT_NO_DEBUG_STREAM
+
+ struct FontHandle {
+ FontHandle(const QString &name) : faceName(name) {}
+ FontHandle(IDWriteFontFace *face, const QString &name);
+ ~FontHandle();
+
+ IDWriteFontFace *fontFace = nullptr;
+ QString faceName;
+ };
+
+private:
+ void addDefaultEUDCFont();
+
+ struct WinApplicationFont {
+ HANDLE handle;
+ QString fileName;
+ };
+
+ QList<WinApplicationFont> m_applicationFonts;
+
+ struct UniqueFontData {
+ HANDLE handle;
+ int refCount;
+ };
+
+ QMutex m_uniqueFontDataMutex; // protects m_uniqueFontData
+ QMap<QString, UniqueFontData> m_uniqueFontData;
+
+ static unsigned m_fontOptions;
+ QStringList m_eudcFonts;
+ bool m_hasPopulatedAliases = false;
+};
+
+#ifndef QT_NO_DEBUG_STREAM
+QDebug operator<<(QDebug, const QFontDef &def);
+#endif
+
+inline quint16 qt_getUShort(const unsigned char *p)
+{
+ quint16 val;
+ val = *p++ << 8;
+ val |= *p;
+
+ return val;
+}
+
+struct QFontNames
+{
+ QString name; // e.g. "DejaVu Sans Condensed"
+ QString style; // e.g. "Italic"
+ QString preferredName; // e.g. "DejaVu Sans"
+ QString preferredStyle; // e.g. "Condensed Italic"
+};
+
+struct QFontValues
+{
+ quint16 weight = 0;
+ bool isItalic = false;
+ bool isOverstruck = false;
+ bool isUnderlined = false;
+};
+
+bool qt_localizedName(const QString &name);
+QString qt_getEnglishName(const QString &familyName, bool includeStyle = false);
+QFontNames qt_getCanonicalFontNames(const LOGFONT &lf);
+
+struct FontAndStyle {
+ QString font;
+ QString style;
+
+ friend inline bool operator==(const FontAndStyle &lhs, const FontAndStyle &rhs) noexcept
+ { return lhs.font == rhs.font && lhs.style == rhs.style; }
+ friend inline bool operator!=(const FontAndStyle &lhs, const FontAndStyle &rhs) noexcept
+ { return !operator==(lhs, rhs); }
+};
+inline size_t qHash(const FontAndStyle &key, size_t seed) noexcept
+{
+ return qHashMulti(seed, key.font, key.style);
+}
+
+QT_END_NAMESPACE
+
+#endif // QWINDOWSFONTDATABASE_H
diff --git a/src/gui/text/windows/qwindowsfontdatabasebase.cpp b/src/gui/text/windows/qwindowsfontdatabasebase.cpp
new file mode 100644
index 0000000000..84e619b0d9
--- /dev/null
+++ b/src/gui/text/windows/qwindowsfontdatabasebase.cpp
@@ -0,0 +1,1013 @@
+// Copyright (C) 2020 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
+
+#include "qwindowsfontdatabasebase_p.h"
+#include "qwindowsfontdatabase_p.h"
+
+#include <QtCore/QThreadStorage>
+#include <QtCore/QtEndian>
+
+#if QT_CONFIG(directwrite)
+# if QT_CONFIG(directwrite3)
+# include <dwrite_3.h>
+# else
+# include <dwrite_2.h>
+# endif
+# include <d2d1.h>
+# include "qwindowsfontenginedirectwrite_p.h"
+#endif
+
+QT_BEGIN_NAMESPACE
+
+using namespace Qt::StringLiterals;
+
+// Helper classes for creating font engines directly from font data
+namespace {
+
+# pragma pack(1)
+
+ // Common structure for all formats of the "name" table
+ struct NameTable
+ {
+ quint16 format;
+ quint16 count;
+ quint16 stringOffset;
+ };
+
+ struct NameRecord
+ {
+ quint16 platformID;
+ quint16 encodingID;
+ quint16 languageID;
+ quint16 nameID;
+ quint16 length;
+ quint16 offset;
+ };
+
+ struct OffsetSubTable
+ {
+ quint32 scalerType;
+ quint16 numTables;
+ quint16 searchRange;
+ quint16 entrySelector;
+ quint16 rangeShift;
+ };
+
+ struct TableDirectory : public QWindowsFontDatabaseBase::FontTable
+ {
+ quint32 identifier;
+ quint32 checkSum;
+ quint32 offset;
+ quint32 length;
+ };
+
+ struct OS2Table
+ {
+ quint16 version;
+ qint16 avgCharWidth;
+ quint16 weightClass;
+ quint16 widthClass;
+ quint16 type;
+ qint16 subscriptXSize;
+ qint16 subscriptYSize;
+ qint16 subscriptXOffset;
+ qint16 subscriptYOffset;
+ qint16 superscriptXSize;
+ qint16 superscriptYSize;
+ qint16 superscriptXOffset;
+ qint16 superscriptYOffset;
+ qint16 strikeOutSize;
+ qint16 strikeOutPosition;
+ qint16 familyClass;
+ quint8 panose[10];
+ quint32 unicodeRanges[4];
+ quint8 vendorID[4];
+ quint16 selection;
+ quint16 firstCharIndex;
+ quint16 lastCharIndex;
+ qint16 typoAscender;
+ qint16 typoDescender;
+ qint16 typoLineGap;
+ quint16 winAscent;
+ quint16 winDescent;
+ quint32 codepageRanges[2];
+ qint16 height;
+ qint16 capHeight;
+ quint16 defaultChar;
+ quint16 breakChar;
+ quint16 maxContext;
+ };
+
+# pragma pack()
+
+} // Anonymous namespace
+
+QWindowsFontDatabaseBase::FontTable *QWindowsFontDatabaseBase::EmbeddedFont::tableDirectoryEntry(const QByteArray &tagName)
+{
+ Q_ASSERT(tagName.size() == 4);
+ quint32 tagId = *(reinterpret_cast<const quint32 *>(tagName.constData()));
+ const size_t fontDataSize = m_fontData.size();
+ if (Q_UNLIKELY(fontDataSize < sizeof(OffsetSubTable)))
+ return nullptr;
+
+ OffsetSubTable *offsetSubTable = reinterpret_cast<OffsetSubTable *>(m_fontData.data());
+ TableDirectory *tableDirectory = reinterpret_cast<TableDirectory *>(offsetSubTable + 1);
+
+ const size_t tableCount = qFromBigEndian<quint16>(offsetSubTable->numTables);
+ if (Q_UNLIKELY(fontDataSize < sizeof(OffsetSubTable) + sizeof(TableDirectory) * tableCount))
+ return nullptr;
+
+ TableDirectory *tableDirectoryEnd = tableDirectory + tableCount;
+ for (TableDirectory *entry = tableDirectory; entry < tableDirectoryEnd; ++entry) {
+ if (entry->identifier == tagId)
+ return entry;
+ }
+
+ return nullptr;
+}
+
+QString QWindowsFontDatabaseBase::EmbeddedFont::familyName(QWindowsFontDatabaseBase::FontTable *directoryEntry)
+{
+ QString name;
+
+ TableDirectory *nameTableDirectoryEntry = static_cast<TableDirectory *>(directoryEntry);
+ if (nameTableDirectoryEntry == nullptr)
+ nameTableDirectoryEntry = static_cast<TableDirectory *>(tableDirectoryEntry("name"));
+
+ if (nameTableDirectoryEntry != nullptr) {
+ quint32 offset = qFromBigEndian<quint32>(nameTableDirectoryEntry->offset);
+ if (Q_UNLIKELY(quint32(m_fontData.size()) < offset + sizeof(NameTable)))
+ return QString();
+
+ NameTable *nameTable = reinterpret_cast<NameTable *>(m_fontData.data() + offset);
+ NameRecord *nameRecord = reinterpret_cast<NameRecord *>(nameTable + 1);
+
+ quint16 nameTableCount = qFromBigEndian<quint16>(nameTable->count);
+ if (Q_UNLIKELY(quint32(m_fontData.size()) < offset + sizeof(NameRecord) * nameTableCount))
+ return QString();
+
+ for (int i = 0; i < nameTableCount; ++i, ++nameRecord) {
+ if (qFromBigEndian<quint16>(nameRecord->nameID) == 1
+ && qFromBigEndian<quint16>(nameRecord->platformID) == 3 // Windows
+ && qFromBigEndian<quint16>(nameRecord->languageID) == 0x0409) { // US English
+ quint16 stringOffset = qFromBigEndian<quint16>(nameTable->stringOffset);
+ quint16 nameOffset = qFromBigEndian<quint16>(nameRecord->offset);
+ quint16 nameLength = qFromBigEndian<quint16>(nameRecord->length);
+
+ if (Q_UNLIKELY(quint32(m_fontData.size()) < offset + stringOffset + nameOffset + nameLength))
+ return QString();
+
+ const void *ptr = reinterpret_cast<const quint8 *>(nameTable)
+ + stringOffset
+ + nameOffset;
+
+ const quint16 *s = reinterpret_cast<const quint16 *>(ptr);
+ const quint16 *e = s + nameLength / sizeof(quint16);
+ while (s != e)
+ name += QChar( qFromBigEndian<quint16>(*s++));
+ break;
+ }
+ }
+ }
+
+ return name;
+}
+
+void QWindowsFontDatabaseBase::EmbeddedFont::updateFromOS2Table(QFontEngine *fontEngine)
+{
+ TableDirectory *os2TableEntry = static_cast<TableDirectory *>(tableDirectoryEntry("OS/2"));
+ if (os2TableEntry != nullptr) {
+ const OS2Table *os2Table =
+ reinterpret_cast<const OS2Table *>(m_fontData.constData()
+ + qFromBigEndian<quint32>(os2TableEntry->offset));
+
+ bool italic = qFromBigEndian<quint16>(os2Table->selection) & (1 << 0);
+ bool oblique = qFromBigEndian<quint16>(os2Table->selection) & (1 << 9);
+
+ if (italic)
+ fontEngine->fontDef.style = QFont::StyleItalic;
+ else if (oblique)
+ fontEngine->fontDef.style = QFont::StyleOblique;
+ else
+ fontEngine->fontDef.style = QFont::StyleNormal;
+
+ fontEngine->fontDef.weight = qFromBigEndian<quint16>(os2Table->weightClass);
+ }
+}
+
+QString QWindowsFontDatabaseBase::EmbeddedFont::changeFamilyName(const QString &newFamilyName)
+{
+ TableDirectory *nameTableDirectoryEntry = static_cast<TableDirectory *>(tableDirectoryEntry("name"));
+ if (nameTableDirectoryEntry == nullptr)
+ return QString();
+
+ QString oldFamilyName = familyName(nameTableDirectoryEntry);
+
+ // Reserve size for name table header, five required name records and string
+ const int requiredRecordCount = 5;
+ quint16 nameIds[requiredRecordCount] = { 1, 2, 3, 4, 6 };
+
+ int sizeOfHeader = sizeof(NameTable) + sizeof(NameRecord) * requiredRecordCount;
+ int newFamilyNameSize = newFamilyName.size() * int(sizeof(quint16));
+
+ const QString regularString = QString::fromLatin1("Regular");
+ int regularStringSize = regularString.size() * int(sizeof(quint16));
+
+ // Align table size of table to 32 bits (pad with 0)
+ int fullSize = ((sizeOfHeader + newFamilyNameSize + regularStringSize) & ~3) + 4;
+
+ QByteArray newNameTable(fullSize, char(0));
+
+ {
+ NameTable *nameTable = reinterpret_cast<NameTable *>(newNameTable.data());
+ nameTable->count = qbswap<quint16>(requiredRecordCount);
+ nameTable->stringOffset = qbswap<quint16>(sizeOfHeader);
+
+ NameRecord *nameRecord = reinterpret_cast<NameRecord *>(nameTable + 1);
+ for (int i = 0; i < requiredRecordCount; ++i, nameRecord++) {
+ nameRecord->nameID = qbswap<quint16>(nameIds[i]);
+ nameRecord->encodingID = qbswap<quint16>(1);
+ nameRecord->languageID = qbswap<quint16>(0x0409);
+ nameRecord->platformID = qbswap<quint16>(3);
+ nameRecord->length = qbswap<quint16>(newFamilyNameSize);
+
+ // Special case for sub-family
+ if (nameIds[i] == 4) {
+ nameRecord->offset = qbswap<quint16>(newFamilyNameSize);
+ nameRecord->length = qbswap<quint16>(regularStringSize);
+ }
+ }
+
+ // nameRecord now points to string data
+ quint16 *stringStorage = reinterpret_cast<quint16 *>(nameRecord);
+ for (QChar ch : newFamilyName)
+ *stringStorage++ = qbswap<quint16>(quint16(ch.unicode()));
+
+ for (QChar ch : regularString)
+ *stringStorage++ = qbswap<quint16>(quint16(ch.unicode()));
+ }
+
+ quint32 *p = reinterpret_cast<quint32 *>(newNameTable.data());
+ quint32 *tableEnd = reinterpret_cast<quint32 *>(newNameTable.data() + fullSize);
+
+ quint32 checkSum = 0;
+ while (p < tableEnd)
+ checkSum += qFromBigEndian<quint32>(*(p++));
+
+ nameTableDirectoryEntry->checkSum = qbswap<quint32>(checkSum);
+ nameTableDirectoryEntry->offset = qbswap<quint32>(m_fontData.size());
+ nameTableDirectoryEntry->length = qbswap<quint32>(fullSize);
+
+ m_fontData.append(newNameTable);
+
+ return oldFamilyName;
+}
+
+#if QT_CONFIG(directwrite) && QT_CONFIG(direct2d)
+
+namespace {
+ class DirectWriteFontFileStream: public IDWriteFontFileStream
+ {
+ Q_DISABLE_COPY(DirectWriteFontFileStream)
+ public:
+ DirectWriteFontFileStream(const QByteArray &fontData)
+ : m_fontData(fontData)
+ , m_referenceCount(0)
+ {
+ }
+ virtual ~DirectWriteFontFileStream()
+ {
+ }
+
+ HRESULT STDMETHODCALLTYPE QueryInterface(REFIID iid, void **object) override;
+ ULONG STDMETHODCALLTYPE AddRef() override;
+ ULONG STDMETHODCALLTYPE Release() override;
+
+ HRESULT STDMETHODCALLTYPE ReadFileFragment(const void **fragmentStart, UINT64 fileOffset,
+ UINT64 fragmentSize, OUT void **fragmentContext) override;
+ void STDMETHODCALLTYPE ReleaseFileFragment(void *fragmentContext) override;
+ HRESULT STDMETHODCALLTYPE GetFileSize(OUT UINT64 *fileSize) override;
+ HRESULT STDMETHODCALLTYPE GetLastWriteTime(OUT UINT64 *lastWriteTime) override;
+
+ private:
+ QByteArray m_fontData;
+ ULONG m_referenceCount;
+ };
+
+ HRESULT STDMETHODCALLTYPE DirectWriteFontFileStream::QueryInterface(REFIID iid, void **object)
+ {
+ if (iid == IID_IUnknown || iid == __uuidof(IDWriteFontFileStream)) {
+ *object = this;
+ AddRef();
+ return S_OK;
+ } else {
+ *object = NULL;
+ return E_NOINTERFACE;
+ }
+ }
+
+ ULONG STDMETHODCALLTYPE DirectWriteFontFileStream::AddRef()
+ {
+ return InterlockedIncrement(&m_referenceCount);
+ }
+
+ ULONG STDMETHODCALLTYPE DirectWriteFontFileStream::Release()
+ {
+ ULONG newCount = InterlockedDecrement(&m_referenceCount);
+ if (newCount == 0)
+ delete this;
+ return newCount;
+ }
+
+ HRESULT STDMETHODCALLTYPE DirectWriteFontFileStream::ReadFileFragment(
+ const void **fragmentStart,
+ UINT64 fileOffset,
+ UINT64 fragmentSize,
+ OUT void **fragmentContext)
+ {
+ *fragmentContext = NULL;
+ if (fileOffset + fragmentSize <= quint64(m_fontData.size())) {
+ *fragmentStart = m_fontData.data() + fileOffset;
+ return S_OK;
+ } else {
+ *fragmentStart = NULL;
+ return E_FAIL;
+ }
+ }
+
+ void STDMETHODCALLTYPE DirectWriteFontFileStream::ReleaseFileFragment(void *)
+ {
+ }
+
+ HRESULT STDMETHODCALLTYPE DirectWriteFontFileStream::GetFileSize(UINT64 *fileSize)
+ {
+ *fileSize = m_fontData.size();
+ return S_OK;
+ }
+
+ HRESULT STDMETHODCALLTYPE DirectWriteFontFileStream::GetLastWriteTime(UINT64 *lastWriteTime)
+ {
+ *lastWriteTime = 0;
+ return E_NOTIMPL;
+ }
+
+ class DirectWriteFontFileLoader: public IDWriteFontFileLoader
+ {
+ public:
+ DirectWriteFontFileLoader() : m_referenceCount(0) {}
+ virtual ~DirectWriteFontFileLoader()
+ {
+ }
+
+ inline void addKey(const QByteArray &fontData)
+ {
+ if (!m_fontDatas.contains(fontData.data()))
+ m_fontDatas.insert(fontData.data(), fontData);
+ }
+
+ inline void removeKey(const void *key)
+ {
+ m_fontDatas.remove(key);
+ }
+
+ HRESULT STDMETHODCALLTYPE QueryInterface(REFIID iid, void **object) override;
+ ULONG STDMETHODCALLTYPE AddRef() override;
+ ULONG STDMETHODCALLTYPE Release() override;
+
+ HRESULT STDMETHODCALLTYPE CreateStreamFromKey(void const *fontFileReferenceKey,
+ UINT32 fontFileReferenceKeySize,
+ OUT IDWriteFontFileStream **fontFileStream) override;
+
+ void clear()
+ {
+ m_fontDatas.clear();
+ }
+
+ private:
+ ULONG m_referenceCount;
+ QHash<const void *, QByteArray> m_fontDatas;
+ };
+
+ HRESULT STDMETHODCALLTYPE DirectWriteFontFileLoader::QueryInterface(const IID &iid,
+ void **object)
+ {
+ if (iid == IID_IUnknown || iid == __uuidof(IDWriteFontFileLoader)) {
+ *object = this;
+ AddRef();
+ return S_OK;
+ } else {
+ *object = NULL;
+ return E_NOINTERFACE;
+ }
+ }
+
+ ULONG STDMETHODCALLTYPE DirectWriteFontFileLoader::AddRef()
+ {
+ return InterlockedIncrement(&m_referenceCount);
+ }
+
+ ULONG STDMETHODCALLTYPE DirectWriteFontFileLoader::Release()
+ {
+ ULONG newCount = InterlockedDecrement(&m_referenceCount);
+ if (newCount == 0)
+ delete this;
+ return newCount;
+ }
+
+ HRESULT STDMETHODCALLTYPE DirectWriteFontFileLoader::CreateStreamFromKey(
+ void const *fontFileReferenceKey,
+ UINT32 fontFileReferenceKeySize,
+ IDWriteFontFileStream **fontFileStream)
+ {
+ Q_UNUSED(fontFileReferenceKeySize);
+
+ if (fontFileReferenceKeySize != sizeof(const void *)) {
+ qWarning("%s: Wrong key size", __FUNCTION__);
+ return E_FAIL;
+ }
+
+ const void *key = *reinterpret_cast<void * const *>(fontFileReferenceKey);
+ *fontFileStream = NULL;
+ auto it = m_fontDatas.constFind(key);
+ if (it == m_fontDatas.constEnd())
+ return E_FAIL;
+
+ QByteArray fontData = it.value();
+ DirectWriteFontFileStream *stream = new DirectWriteFontFileStream(fontData);
+ stream->AddRef();
+ *fontFileStream = stream;
+
+ return S_OK;
+ }
+
+} // Anonymous namespace
+
+class QCustomFontFileLoader
+{
+public:
+ QCustomFontFileLoader(IDWriteFactory *factory)
+ {
+ m_directWriteFactory = factory;
+
+ if (m_directWriteFactory) {
+ m_directWriteFactory->AddRef();
+
+ m_directWriteFontFileLoader = new DirectWriteFontFileLoader();
+ m_directWriteFactory->RegisterFontFileLoader(m_directWriteFontFileLoader);
+ }
+ }
+
+ ~QCustomFontFileLoader()
+ {
+ clear();
+
+ if (m_directWriteFactory != nullptr && m_directWriteFontFileLoader != nullptr)
+ m_directWriteFactory->UnregisterFontFileLoader(m_directWriteFontFileLoader);
+
+ if (m_directWriteFactory != nullptr)
+ m_directWriteFactory->Release();
+ }
+
+ void addKey(const QByteArray &fontData)
+ {
+ if (m_directWriteFontFileLoader != nullptr)
+ m_directWriteFontFileLoader->addKey(fontData);
+ }
+
+ void removeKey(const void *key)
+ {
+ if (m_directWriteFontFileLoader != nullptr)
+ m_directWriteFontFileLoader->removeKey(key);
+ }
+
+ IDWriteFontFileLoader *loader() const
+ {
+ return m_directWriteFontFileLoader;
+ }
+
+ void clear()
+ {
+ if (m_directWriteFontFileLoader != nullptr)
+ m_directWriteFontFileLoader->clear();
+ }
+
+private:
+ IDWriteFactory *m_directWriteFactory = nullptr;
+ DirectWriteFontFileLoader *m_directWriteFontFileLoader = nullptr;
+};
+
+
+#endif // directwrite && direct2d
+
+
+QWindowsFontEngineData::~QWindowsFontEngineData()
+{
+ if (hdc)
+ DeleteDC(hdc);
+
+#if QT_CONFIG(directwrite) && QT_CONFIG(direct2d)
+ if (directWriteGdiInterop)
+ directWriteGdiInterop->Release();
+ if (directWriteFactory)
+ directWriteFactory->Release();
+#endif
+}
+
+QWindowsFontDatabaseBase::QWindowsFontDatabaseBase()
+{
+}
+
+QWindowsFontDatabaseBase::~QWindowsFontDatabaseBase()
+{
+}
+
+typedef QSharedPointer<QWindowsFontEngineData> QWindowsFontEngineDataPtr;
+typedef QThreadStorage<QWindowsFontEngineDataPtr> FontEngineThreadLocalData;
+Q_GLOBAL_STATIC(FontEngineThreadLocalData, fontEngineThreadLocalData)
+
+QSharedPointer<QWindowsFontEngineData> QWindowsFontDatabaseBase::data()
+{
+ FontEngineThreadLocalData *data = fontEngineThreadLocalData();
+ if (!data->hasLocalData())
+ data->setLocalData(QSharedPointer<QWindowsFontEngineData>::create());
+
+ if (!init(data->localData()))
+ qCWarning(lcQpaFonts) << "Cannot initialize common font database data";
+
+ return data->localData();
+}
+
+bool QWindowsFontDatabaseBase::init(QSharedPointer<QWindowsFontEngineData> d)
+{
+#if QT_CONFIG(directwrite) && QT_CONFIG(direct2d)
+ if (!d->directWriteFactory) {
+ createDirectWriteFactory(&d->directWriteFactory);
+ if (!d->directWriteFactory)
+ return false;
+ }
+ if (!d->directWriteGdiInterop) {
+ const HRESULT hr = d->directWriteFactory->GetGdiInterop(&d->directWriteGdiInterop);
+ if (FAILED(hr)) {
+ qErrnoWarning("%s: GetGdiInterop failed", __FUNCTION__);
+ return false;
+ }
+ }
+#else
+ Q_UNUSED(d);
+#endif // directwrite && direct2d
+ return true;
+}
+
+#if QT_CONFIG(directwrite) && QT_CONFIG(direct2d)
+void QWindowsFontDatabaseBase::createDirectWriteFactory(IDWriteFactory **factory)
+{
+ *factory = nullptr;
+ IUnknown *result = nullptr;
+
+# if QT_CONFIG(directwrite3)
+ qCDebug(lcQpaFonts) << "Trying to create IDWriteFactory6";
+ DWriteCreateFactory(DWRITE_FACTORY_TYPE_SHARED, __uuidof(IDWriteFactory6), &result);
+
+ if (result == nullptr) {
+ qCDebug(lcQpaFonts) << "Trying to create IDWriteFactory5";
+ DWriteCreateFactory(DWRITE_FACTORY_TYPE_SHARED, __uuidof(IDWriteFactory5), &result);
+ }
+
+ if (result == nullptr) {
+ qCDebug(lcQpaFonts) << "Trying to create IDWriteFactory3";
+ DWriteCreateFactory(DWRITE_FACTORY_TYPE_SHARED, __uuidof(IDWriteFactory3), &result);
+ }
+# endif
+
+ if (result == nullptr) {
+ qCDebug(lcQpaFonts) << "Trying to create IDWriteFactory2";
+ DWriteCreateFactory(DWRITE_FACTORY_TYPE_SHARED, __uuidof(IDWriteFactory2), &result);
+ }
+
+ if (result == nullptr) {
+ qCDebug(lcQpaFonts) << "Trying to create plain IDWriteFactory";
+ if (FAILED(DWriteCreateFactory(DWRITE_FACTORY_TYPE_SHARED, __uuidof(IDWriteFactory), &result))) {
+ qErrnoWarning("DWriteCreateFactory failed");
+ return;
+ }
+ }
+
+ *factory = static_cast<IDWriteFactory *>(result);
+}
+#endif // directwrite && direct2d
+
+int QWindowsFontDatabaseBase::defaultVerticalDPI()
+{
+ return 96;
+}
+
+LOGFONT QWindowsFontDatabaseBase::fontDefToLOGFONT(const QFontDef &request, const QString &faceName)
+{
+ LOGFONT lf;
+ memset(&lf, 0, sizeof(LOGFONT));
+
+ lf.lfHeight = -qRound(request.pixelSize);
+ lf.lfWidth = 0;
+ lf.lfEscapement = 0;
+ lf.lfOrientation = 0;
+ if (request.weight == QFont::Normal)
+ lf.lfWeight = FW_DONTCARE;
+ else
+ lf.lfWeight = request.weight;
+ lf.lfItalic = request.style != QFont::StyleNormal;
+ lf.lfCharSet = DEFAULT_CHARSET;
+
+ int strat = OUT_DEFAULT_PRECIS;
+ if (request.styleStrategy & QFont::PreferBitmap) {
+ strat = OUT_RASTER_PRECIS;
+ } else if (request.styleStrategy & QFont::PreferDevice) {
+ strat = OUT_DEVICE_PRECIS;
+ } else if (request.styleStrategy & QFont::PreferOutline) {
+ strat = OUT_OUTLINE_PRECIS;
+ } else if (request.styleStrategy & QFont::ForceOutline) {
+ strat = OUT_TT_ONLY_PRECIS;
+ }
+
+ lf.lfOutPrecision = strat;
+
+ int qual = DEFAULT_QUALITY;
+
+ if (request.styleStrategy & QFont::PreferMatch)
+ qual = DRAFT_QUALITY;
+ else if (request.styleStrategy & QFont::PreferQuality)
+ qual = PROOF_QUALITY;
+
+ if (request.styleStrategy & QFont::PreferAntialias) {
+ qual = (request.styleStrategy & QFont::NoSubpixelAntialias) == 0
+ ? CLEARTYPE_QUALITY : ANTIALIASED_QUALITY;
+ } else if (request.styleStrategy & QFont::NoAntialias) {
+ qual = NONANTIALIASED_QUALITY;
+ } else if ((request.styleStrategy & QFont::NoSubpixelAntialias) && data()->clearTypeEnabled) {
+ qual = ANTIALIASED_QUALITY;
+ }
+
+ lf.lfQuality = qual;
+
+ lf.lfClipPrecision = CLIP_DEFAULT_PRECIS;
+
+ int hint = FF_DONTCARE;
+ switch (request.styleHint) {
+ case QFont::Helvetica:
+ hint = FF_SWISS;
+ break;
+ case QFont::Times:
+ hint = FF_ROMAN;
+ break;
+ case QFont::Courier:
+ hint = FF_MODERN;
+ break;
+ case QFont::OldEnglish:
+ hint = FF_DECORATIVE;
+ break;
+ case QFont::System:
+ hint = FF_MODERN;
+ break;
+ default:
+ break;
+ }
+
+ lf.lfPitchAndFamily = DEFAULT_PITCH | hint;
+
+ QString fam = faceName;
+ if (fam.isEmpty())
+ fam = request.families.first();
+ if (Q_UNLIKELY(fam.size() >= LF_FACESIZE)) {
+ qCritical("%s: Family name '%s' is too long.", __FUNCTION__, qPrintable(fam));
+ fam.truncate(LF_FACESIZE - 1);
+ }
+
+ memcpy(lf.lfFaceName, fam.utf16(), fam.size() * sizeof(wchar_t));
+
+ return lf;
+}
+
+QFont QWindowsFontDatabaseBase::LOGFONT_to_QFont(const LOGFONT& logFont, int verticalDPI_In)
+{
+ if (verticalDPI_In <= 0)
+ verticalDPI_In = defaultVerticalDPI();
+ QFont qFont(QString::fromWCharArray(logFont.lfFaceName));
+ qFont.setItalic(logFont.lfItalic);
+ if (logFont.lfWeight != FW_DONTCARE)
+ qFont.setWeight(QFont::Weight(logFont.lfWeight));
+ const qreal logFontHeight = qAbs(logFont.lfHeight);
+ qFont.setPointSizeF(logFontHeight * 72.0 / qreal(verticalDPI_In));
+ qFont.setUnderline(logFont.lfUnderline);
+ qFont.setOverline(false);
+ qFont.setStrikeOut(logFont.lfStrikeOut);
+ return qFont;
+}
+
+// ### fixme Qt 6 (QTBUG-58610): See comment at QWindowsFontDatabase::systemDefaultFont()
+HFONT QWindowsFontDatabaseBase::systemFont()
+{
+ static const auto stock_sysfont =
+ reinterpret_cast<HFONT>(GetStockObject(DEFAULT_GUI_FONT));
+ return stock_sysfont;
+}
+
+QFont QWindowsFontDatabaseBase::systemDefaultFont()
+{
+ // Qt 6: Obtain default GUI font (typically "Segoe UI, 9pt", see QTBUG-58610)
+ NONCLIENTMETRICS ncm = {};
+ ncm.cbSize = sizeof(ncm);
+ SystemParametersInfoForDpi(SPI_GETNONCLIENTMETRICS, ncm.cbSize, &ncm, 0, defaultVerticalDPI());
+ const QFont systemFont = QWindowsFontDatabase::LOGFONT_to_QFont(ncm.lfMessageFont);
+ qCDebug(lcQpaFonts) << __FUNCTION__ << systemFont;
+ return systemFont;
+}
+
+void QWindowsFontDatabaseBase::invalidate()
+{
+#if QT_CONFIG(directwrite)
+ m_fontFileLoader.reset(nullptr);
+#endif
+}
+
+#if QT_CONFIG(directwrite) && QT_CONFIG(direct2d)
+IDWriteFontFace *QWindowsFontDatabaseBase::createDirectWriteFace(const QByteArray &fontData)
+{
+ QList<IDWriteFontFace *> faces = createDirectWriteFaces(fontData, false);
+ Q_ASSERT(faces.size() <= 1);
+
+ return faces.isEmpty() ? nullptr : faces.first();
+}
+
+QList<IDWriteFontFace *> QWindowsFontDatabaseBase::createDirectWriteFaces(const QByteArray &fontData,
+ bool queryVariations) const
+{
+ QList<IDWriteFontFace *> ret;
+ QSharedPointer<QWindowsFontEngineData> fontEngineData = data();
+ if (fontEngineData->directWriteFactory == nullptr) {
+ qCWarning(lcQpaFonts) << "DirectWrite factory not created in QWindowsFontDatabaseBase::createDirectWriteFace()";
+ return ret;
+ }
+
+ if (m_fontFileLoader == nullptr)
+ m_fontFileLoader.reset(new QCustomFontFileLoader(fontEngineData->directWriteFactory));
+
+ m_fontFileLoader->addKey(fontData);
+
+ IDWriteFontFile *fontFile = nullptr;
+ const void *key = fontData.data();
+
+ HRESULT hres = fontEngineData->directWriteFactory->CreateCustomFontFileReference(&key,
+ sizeof(void *),
+ m_fontFileLoader->loader(),
+ &fontFile);
+ if (FAILED(hres)) {
+ qErrnoWarning(hres, "%s: CreateCustomFontFileReference failed", __FUNCTION__);
+ return ret;
+ }
+
+ BOOL isSupportedFontType;
+ DWRITE_FONT_FILE_TYPE fontFileType;
+ DWRITE_FONT_FACE_TYPE fontFaceType;
+ UINT32 numberOfFaces;
+ fontFile->Analyze(&isSupportedFontType, &fontFileType, &fontFaceType, &numberOfFaces);
+ if (!isSupportedFontType) {
+ fontFile->Release();
+ return ret;
+ }
+
+#if QT_CONFIG(directwrite3)
+ IDWriteFactory5 *factory5 = nullptr;
+ if (queryVariations && SUCCEEDED(fontEngineData->directWriteFactory->QueryInterface(__uuidof(IDWriteFactory5),
+ reinterpret_cast<void **>(&factory5)))) {
+
+ IDWriteFontSetBuilder1 *builder;
+ if (SUCCEEDED(factory5->CreateFontSetBuilder(&builder))) {
+ if (SUCCEEDED(builder->AddFontFile(fontFile))) {
+ IDWriteFontSet *fontSet;
+ if (SUCCEEDED(builder->CreateFontSet(&fontSet))) {
+ int count = fontSet->GetFontCount();
+ qCDebug(lcQpaFonts) << "Found" << count << "variations in font file";
+ for (int i = 0; i < count; ++i) {
+ IDWriteFontFaceReference *ref;
+ if (SUCCEEDED(fontSet->GetFontFaceReference(i, &ref))) {
+ IDWriteFontFace3 *face;
+ if (SUCCEEDED(ref->CreateFontFace(&face))) {
+ ret.append(face);
+ }
+ ref->Release();
+ }
+ }
+ fontSet->Release();
+ }
+ }
+
+ builder->Release();
+ }
+
+ factory5->Release();
+ }
+#else
+ Q_UNUSED(queryVariations);
+#endif
+
+ // ### Currently no support for .ttc, but we could easily return a list here.
+ if (ret.isEmpty()) {
+ IDWriteFontFace *directWriteFontFace = nullptr;
+ hres = fontEngineData->directWriteFactory->CreateFontFace(fontFaceType,
+ 1,
+ &fontFile,
+ 0,
+ DWRITE_FONT_SIMULATIONS_NONE,
+ &directWriteFontFace);
+ if (FAILED(hres)) {
+ qErrnoWarning(hres, "%s: CreateFontFace failed", __FUNCTION__);
+ fontFile->Release();
+ return ret;
+ } else {
+ ret.append(directWriteFontFace);
+ }
+ }
+
+ fontFile->Release();
+
+ return ret;
+}
+#endif // directwrite && direct2d
+
+QFontEngine *QWindowsFontDatabaseBase::fontEngine(const QFontDef &fontDef, void *handle)
+{
+ // This function was apparently not used before, and probably isn't now either,
+ // call the base implementation which just prints that it's not supported.
+ return QPlatformFontDatabase::fontEngine(fontDef, handle);
+}
+
+QFontEngine *QWindowsFontDatabaseBase::fontEngine(const QByteArray &fontData, qreal pixelSize, QFont::HintingPreference hintingPreference)
+{
+ QFontEngine *fontEngine = nullptr;
+
+#if QT_CONFIG(directwrite) && QT_CONFIG(direct2d)
+ QSharedPointer<QWindowsFontEngineData> fontEngineData = data();
+ if (fontEngineData->directWriteFactory == nullptr)
+ return nullptr;
+
+ IDWriteFontFace * directWriteFontFace = createDirectWriteFace(fontData);
+ if (directWriteFontFace == nullptr)
+ return nullptr;
+
+ fontEngine = new QWindowsFontEngineDirectWrite(directWriteFontFace,
+ pixelSize,
+ fontEngineData);
+
+ // Get font family from font data
+ EmbeddedFont font(fontData);
+ font.updateFromOS2Table(fontEngine);
+ fontEngine->fontDef.families = QStringList(font.familyName());
+ fontEngine->fontDef.hintingPreference = hintingPreference;
+
+ directWriteFontFace->Release();
+#else // directwrite && direct2d
+ Q_UNUSED(fontData);
+ Q_UNUSED(pixelSize);
+ Q_UNUSED(hintingPreference);
+#endif
+
+ return fontEngine;
+}
+
+QString QWindowsFontDatabaseBase::familyForStyleHint(QFont::StyleHint styleHint)
+{
+ switch (styleHint) {
+ case QFont::Times:
+ return QStringLiteral("Times New Roman");
+ case QFont::Courier:
+ return QStringLiteral("Courier New");
+ case QFont::Monospace:
+ return QStringLiteral("Courier New");
+ case QFont::Cursive:
+ return QStringLiteral("Comic Sans MS");
+ case QFont::Fantasy:
+ return QStringLiteral("Impact");
+ case QFont::Decorative:
+ return QStringLiteral("Old English");
+ case QFont::Helvetica:
+ return QStringLiteral("Arial");
+ case QFont::System:
+ default:
+ break;
+ }
+ return QStringLiteral("Tahoma");
+}
+
+// Creation functions
+
+static const char *other_tryFonts[] = {
+ "Arial",
+ "MS UI Gothic",
+ "Gulim",
+ "SimSun",
+ "PMingLiU",
+ "Arial Unicode MS",
+ 0
+};
+
+static const char *jp_tryFonts [] = {
+ "Yu Gothic UI",
+ "MS UI Gothic",
+ "Arial",
+ "Gulim",
+ "SimSun",
+ "PMingLiU",
+ "Arial Unicode MS",
+ 0
+};
+
+static const char *ch_CN_tryFonts [] = {
+ "SimSun",
+ "Arial",
+ "PMingLiU",
+ "Gulim",
+ "MS UI Gothic",
+ "Arial Unicode MS",
+ 0
+};
+
+static const char *ch_TW_tryFonts [] = {
+ "PMingLiU",
+ "Arial",
+ "SimSun",
+ "Gulim",
+ "MS UI Gothic",
+ "Arial Unicode MS",
+ 0
+};
+
+static const char *kr_tryFonts[] = {
+ "Gulim",
+ "Arial",
+ "PMingLiU",
+ "SimSun",
+ "MS UI Gothic",
+ "Arial Unicode MS",
+ 0
+};
+
+static const char **tryFonts = nullptr;
+
+QStringList QWindowsFontDatabaseBase::extraTryFontsForFamily(const QString &family)
+{
+ QStringList result;
+ if (!QFontDatabase::writingSystems(family).contains(QFontDatabase::Symbol)) {
+ if (!tryFonts) {
+ LANGID lid = GetUserDefaultLangID();
+ switch (lid&0xff) {
+ case LANG_CHINESE: // Chinese
+ if ( lid == 0x0804 || lid == 0x1004) // China mainland and Singapore
+ tryFonts = ch_CN_tryFonts;
+ else
+ tryFonts = ch_TW_tryFonts; // Taiwan, Hong Kong and Macau
+ break;
+ case LANG_JAPANESE:
+ tryFonts = jp_tryFonts;
+ break;
+ case LANG_KOREAN:
+ tryFonts = kr_tryFonts;
+ break;
+ default:
+ tryFonts = other_tryFonts;
+ break;
+ }
+ }
+ const QStringList families = QFontDatabase::families();
+ const char **tf = tryFonts;
+ while (tf && *tf) {
+ // QTBUG-31689, family might be an English alias for a localized font name.
+ const QString family = QString::fromLatin1(*tf);
+ if (families.contains(family) || QFontDatabase::hasFamily(family))
+ result << family;
+ ++tf;
+ }
+ }
+ result.append(QStringLiteral("Segoe UI Emoji"));
+ result.append(QStringLiteral("Segoe UI Symbol"));
+ return result;
+}
+
+QFontDef QWindowsFontDatabaseBase::sanitizeRequest(QFontDef request) const
+{
+ QFontDef req = request;
+ const QString fam = request.families.front();
+ if (fam.isEmpty())
+ req.families[0] = QStringLiteral("MS Sans Serif");
+
+ if (fam == "MS Sans Serif"_L1) {
+ int height = -qRound(request.pixelSize);
+ // MS Sans Serif has bearing problems in italic, and does not scale
+ if (request.style == QFont::StyleItalic || (height > 18 && height != 24))
+ req.families[0] = QStringLiteral("Arial");
+ }
+
+ if (!(request.styleStrategy & QFont::StyleStrategy::PreferBitmap) && fam == u"Courier")
+ req.families[0] = QStringLiteral("Courier New");
+ return req;
+}
+
+QT_END_NAMESPACE
diff --git a/src/gui/text/windows/qwindowsfontdatabasebase_p.h b/src/gui/text/windows/qwindowsfontdatabasebase_p.h
new file mode 100644
index 0000000000..55a3363551
--- /dev/null
+++ b/src/gui/text/windows/qwindowsfontdatabasebase_p.h
@@ -0,0 +1,115 @@
+// Copyright (C) 2020 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
+
+#ifndef QWINDOWSFONTDATABASEBASE_P_H
+#define QWINDOWSFONTDATABASEBASE_P_H
+
+//
+// W A R N I N G
+// -------------
+//
+// This file is not part of the Qt API. It exists purely as an
+// implementation detail. This header file may change from version to
+// version without notice, or even be removed.
+//
+// We mean it.
+//
+
+#include <qpa/qplatformfontdatabase.h>
+#include <QtGui/private/qtgui-config_p.h>
+#include <QtCore/QSharedPointer>
+#include <QtCore/QLoggingCategory>
+#include <QtCore/qt_windows.h>
+
+#if QT_CONFIG(directwrite)
+ struct IDWriteFactory;
+ struct IDWriteGdiInterop;
+ struct IDWriteFontFace;
+#endif
+
+QT_BEGIN_NAMESPACE
+
+#if QT_CONFIG(directwrite)
+ class QCustomFontFileLoader;
+#endif
+
+class QWindowsFontEngineData
+{
+ Q_DISABLE_COPY_MOVE(QWindowsFontEngineData)
+public:
+ QWindowsFontEngineData();
+ ~QWindowsFontEngineData();
+
+ uint pow_gamma[256];
+
+ bool clearTypeEnabled = false;
+ qreal fontSmoothingGamma;
+ HDC hdc = 0;
+#if QT_CONFIG(directwrite)
+ IDWriteFactory *directWriteFactory = nullptr;
+ IDWriteGdiInterop *directWriteGdiInterop = nullptr;
+#endif
+};
+
+class Q_GUI_EXPORT QWindowsFontDatabaseBase : public QPlatformFontDatabase
+{
+public:
+ QWindowsFontDatabaseBase();
+ ~QWindowsFontDatabaseBase() override;
+
+ QFontEngine *fontEngine(const QFontDef &fontDef, void *handle) override;
+ QFontEngine *fontEngine(const QByteArray &fontData, qreal pixelSize, QFont::HintingPreference hintingPreference) override;
+
+ void invalidate() override;
+
+ static int defaultVerticalDPI();
+
+ static QSharedPointer<QWindowsFontEngineData> data();
+#if QT_CONFIG(directwrite)
+ static void createDirectWriteFactory(IDWriteFactory **factory);
+#endif
+ static QFont systemDefaultFont();
+ static HFONT systemFont();
+ static LOGFONT fontDefToLOGFONT(const QFontDef &fontDef, const QString &faceName);
+ static QFont LOGFONT_to_QFont(const LOGFONT& lf, int verticalDPI = 0);
+
+ static QString familyForStyleHint(QFont::StyleHint styleHint);
+ static QStringList extraTryFontsForFamily(const QString &family);
+
+ class FontTable{};
+ class EmbeddedFont
+ {
+ public:
+ EmbeddedFont(const QByteArray &fontData) : m_fontData(fontData) {}
+
+ QString changeFamilyName(const QString &newFamilyName);
+ QByteArray data() const { return m_fontData; }
+ void updateFromOS2Table(QFontEngine *fontEngine);
+ FontTable *tableDirectoryEntry(const QByteArray &tagName);
+ QString familyName(FontTable *nameTableDirectory = nullptr);
+
+ private:
+ QByteArray m_fontData;
+ };
+
+ QFontDef sanitizeRequest(QFontDef request) const;
+
+protected:
+
+#if QT_CONFIG(directwrite)
+ QList<IDWriteFontFace *> createDirectWriteFaces(const QByteArray &fontData,
+ bool queryVariations = true) const;
+ IDWriteFontFace *createDirectWriteFace(const QByteArray &fontData);
+#endif
+
+private:
+ static bool init(QSharedPointer<QWindowsFontEngineData> data);
+
+#if QT_CONFIG(directwrite)
+ mutable std::unique_ptr<QCustomFontFileLoader> m_fontFileLoader;
+#endif
+};
+
+QT_END_NAMESPACE
+
+#endif // QWINDOWSFONTDATABASEBASE_P_H
diff --git a/src/gui/text/windows/qwindowsfontengine.cpp b/src/gui/text/windows/qwindowsfontengine.cpp
new file mode 100644
index 0000000000..5de80dc8a3
--- /dev/null
+++ b/src/gui/text/windows/qwindowsfontengine.cpp
@@ -0,0 +1,1151 @@
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
+
+#include "qwindowsfontengine_p.h"
+#include "qwindowsnativeimage_p.h"
+#include "qwindowsfontdatabase_p.h"
+#include <QtCore/qt_windows.h>
+#if QT_CONFIG(directwrite)
+# include "qwindowsfontenginedirectwrite_p.h"
+#endif
+#include <QtGui/qpa/qplatformintegration.h>
+#include <QtGui/private/qtextengine_p.h> // glyph_metrics_t
+#include <QtGui/private/qguiapplication_p.h>
+#include <QtGui/QPaintDevice>
+#include <QtGui/QBitmap>
+#include <QtGui/QPainter>
+#include <QtGui/private/qpainter_p.h>
+#include <QtGui/QPaintEngine>
+#include <QtGui/private/qpaintengine_raster_p.h>
+#include <QtGui/private/qtgui-config_p.h>
+
+#include <QtCore/QtEndian>
+#include <QtCore/QFile>
+#include <QtCore/qmath.h>
+#include <QtCore/QTextStream>
+#include <QtCore/QThreadStorage>
+#include <QtCore/private/qsystemlibrary_p.h>
+#include <QtCore/private/qstringiterator_p.h>
+
+#include <QtCore/QDebug>
+
+#include <limits.h>
+
+#if QT_CONFIG(directwrite)
+# include <dwrite.h>
+# include <comdef.h>
+#endif
+
+QT_BEGIN_NAMESPACE
+
+QT_IMPL_METATYPE_EXTERN(HFONT)
+QT_IMPL_METATYPE_EXTERN(LOGFONT)
+
+//### mingw needed define
+#ifndef TT_PRIM_CSPLINE
+#define TT_PRIM_CSPLINE 3
+#endif
+
+// GetFontData expects the tags in little endian ;(
+#define MAKE_LITTLE_ENDIAN_TAG(ch1, ch2, ch3, ch4) (\
+ (((quint32)(ch4)) << 24) | \
+ (((quint32)(ch3)) << 16) | \
+ (((quint32)(ch2)) << 8) | \
+ ((quint32)(ch1)) \
+ )
+
+// common DC for all fonts
+
+// general font engine
+
+QFixed QWindowsFontEngine::lineThickness() const
+{
+ if (lineWidth > 0)
+ return lineWidth;
+
+ return QFontEngine::lineThickness();
+}
+
+static OUTLINETEXTMETRIC *getOutlineTextMetric(HDC hdc)
+{
+ const auto size = GetOutlineTextMetrics(hdc, 0, nullptr);
+ auto otm = reinterpret_cast<OUTLINETEXTMETRIC *>(malloc(size));
+ GetOutlineTextMetrics(hdc, size, otm);
+ return otm;
+}
+
+bool QWindowsFontEngine::hasCFFTable() const
+{
+ HDC hdc = m_fontEngineData->hdc;
+ SelectObject(hdc, hfont);
+ return GetFontData(hdc, MAKE_LITTLE_ENDIAN_TAG('C', 'F', 'F', ' '), 0, 0, 0) != GDI_ERROR;
+}
+
+bool QWindowsFontEngine::hasCMapTable() const
+{
+ HDC hdc = m_fontEngineData->hdc;
+ SelectObject(hdc, hfont);
+ return GetFontData(hdc, MAKE_LITTLE_ENDIAN_TAG('c', 'm', 'a', 'p'), 0, 0, 0) != GDI_ERROR;
+}
+
+static inline QString stringFromOutLineTextMetric(const OUTLINETEXTMETRIC *otm, PSTR offset)
+{
+ const uchar *p = reinterpret_cast<const uchar *>(otm) + quintptr(offset);
+ return QString::fromWCharArray(reinterpret_cast<const wchar_t *>(p));
+}
+
+void QWindowsFontEngine::getCMap()
+{
+ ttf = (bool)(tm.tmPitchAndFamily & TMPF_TRUETYPE) || hasCMapTable();
+
+ cffTable = hasCFFTable();
+
+ HDC hdc = m_fontEngineData->hdc;
+ SelectObject(hdc, hfont);
+ bool symb = false;
+ if (ttf) {
+ cmapTable = getSfntTable(QFont::Tag("cmap").value());
+ cmap = QFontEngine::getCMap(reinterpret_cast<const uchar *>(cmapTable.constData()),
+ cmapTable.size(), &symb, &cmapSize);
+ }
+ if (!cmap) {
+ ttf = false;
+ symb = false;
+ }
+ symbol = symb;
+ designToDevice = 1;
+ _faceId.index = 0;
+ if (cmap) {
+ OUTLINETEXTMETRIC *otm = getOutlineTextMetric(hdc);
+ unitsPerEm = int(otm->otmEMSquare);
+ const QFixed unitsPerEmF(unitsPerEm);
+ designToDevice = unitsPerEmF / QFixed::fromReal(fontDef.pixelSize);
+ x_height = int(otm->otmsXHeight);
+ loadKerningPairs(designToDevice);
+ _faceId.filename = QFile::encodeName(stringFromOutLineTextMetric(otm, otm->otmpFullName));
+ lineWidth = otm->otmsUnderscoreSize;
+ fsType = otm->otmfsType;
+ free(otm);
+
+ } else {
+ unitsPerEm = tm.tmHeight;
+ }
+}
+
+int QWindowsFontEngine::getGlyphIndexes(const QChar *str, int numChars, QGlyphLayout *glyphs, int *mappedGlyphs) const
+{
+ *mappedGlyphs = 0;
+ int glyph_pos = 0;
+ {
+ if (symbol) {
+ QStringIterator it(str, str + numChars);
+ while (it.hasNext()) {
+ const uint uc = it.next();
+ glyphs->glyphs[glyph_pos] = getTrueTypeGlyphIndex(cmap, cmapSize, uc);
+ if (!glyphs->glyphs[glyph_pos] && uc < 0x100)
+ glyphs->glyphs[glyph_pos] = getTrueTypeGlyphIndex(cmap, cmapSize, uc + 0xf000);
+ if (glyphs->glyphs[glyph_pos] || isIgnorableChar(uc))
+ (*mappedGlyphs)++;
+ ++glyph_pos;
+ }
+ } else if (ttf) {
+ QStringIterator it(str, str + numChars);
+ while (it.hasNext()) {
+ const uint uc = it.next();
+ glyphs->glyphs[glyph_pos] = getTrueTypeGlyphIndex(cmap, cmapSize, uc);
+ if (glyphs->glyphs[glyph_pos] || isIgnorableChar(uc))
+ (*mappedGlyphs)++;
+ ++glyph_pos;
+ }
+ } else {
+ QStringIterator it(str, str + numChars);
+ while (it.hasNext()) {
+ const uint uc = it.next();
+ if (uc >= tm.tmFirstChar && uc <= tm.tmLastChar)
+ glyphs->glyphs[glyph_pos] = uc;
+ else
+ glyphs->glyphs[glyph_pos] = 0;
+ if (glyphs->glyphs[glyph_pos] || isIgnorableChar(uc))
+ (*mappedGlyphs)++;
+ ++glyph_pos;
+ }
+ }
+ }
+ glyphs->numGlyphs = glyph_pos;
+ return glyph_pos;
+}
+
+/*!
+ \class QWindowsFontEngine
+ \brief Standard Windows font engine.
+ \internal
+
+ Will probably be superseded by a common Free Type font engine in Qt 5.X.
+*/
+
+QWindowsFontEngine::QWindowsFontEngine(const QString &name,
+ LOGFONT lf,
+ const QSharedPointer<QWindowsFontEngineData> &fontEngineData)
+ : QFontEngine(Win),
+ m_fontEngineData(fontEngineData),
+ _name(name),
+ m_logfont(lf),
+ ttf(0),
+ hasOutline(0)
+{
+ qCDebug(lcQpaFonts) << __FUNCTION__ << name << lf.lfHeight;
+ hfont = CreateFontIndirect(&m_logfont);
+ if (!hfont) {
+ qErrnoWarning("%s: CreateFontIndirect failed for family '%s'", __FUNCTION__, qPrintable(name));
+ hfont = QWindowsFontDatabase::systemFont();
+ }
+
+ HDC hdc = m_fontEngineData->hdc;
+ SelectObject(hdc, hfont);
+ const BOOL res = GetTextMetrics(hdc, &tm);
+ if (!res) {
+ qErrnoWarning("%s: GetTextMetrics failed", __FUNCTION__);
+ ZeroMemory(&tm, sizeof(TEXTMETRIC));
+ }
+
+ fontDef.pixelSize = -lf.lfHeight;
+ fontDef.fixedPitch = !(tm.tmPitchAndFamily & TMPF_FIXED_PITCH);
+
+ cache_cost = tm.tmHeight * tm.tmAveCharWidth * 2000;
+ getCMap();
+
+ hasUnreliableOutline = (tm.tmPitchAndFamily & (TMPF_TRUETYPE | TMPF_VECTOR)) == 0;
+}
+
+QWindowsFontEngine::~QWindowsFontEngine()
+{
+ if (designAdvances)
+ free(designAdvances);
+
+ if (widthCache)
+ free(widthCache);
+
+ // make sure we aren't by accident still selected
+ SelectObject(m_fontEngineData->hdc, QWindowsFontDatabase::systemFont());
+
+ if (!DeleteObject(hfont))
+ qErrnoWarning("%s: QFontEngineWin: failed to delete font...", __FUNCTION__);
+ qCDebug(lcQpaFonts) << __FUNCTION__ << _name;
+
+ if (!uniqueFamilyName.isEmpty()) {
+ if (QPlatformIntegration *pi = QGuiApplicationPrivate::platformIntegration()) {
+ QPlatformFontDatabase *pfdb = pi->fontDatabase();
+ static_cast<QWindowsFontDatabase *>(pfdb)->derefUniqueFont(uniqueFamilyName);
+ }
+ }
+}
+
+glyph_t QWindowsFontEngine::glyphIndex(uint ucs4) const
+{
+ glyph_t glyph = 0;
+
+ if (symbol) {
+ glyph = getTrueTypeGlyphIndex(cmap, cmapSize, ucs4);
+ if (glyph == 0 && ucs4 < 0x100)
+ glyph = getTrueTypeGlyphIndex(cmap, cmapSize, ucs4 + 0xf000);
+ } else if (ttf) {
+ glyph = getTrueTypeGlyphIndex(cmap, cmapSize, ucs4);
+ } else if (ucs4 >= tm.tmFirstChar && ucs4 <= tm.tmLastChar) {
+ glyph = ucs4;
+ }
+
+ return glyph;
+}
+
+HGDIOBJ QWindowsFontEngine::selectDesignFont() const
+{
+ LOGFONT f = m_logfont;
+ f.lfHeight = -unitsPerEm;
+ f.lfWidth = 0;
+ HFONT designFont = CreateFontIndirect(&f);
+ return SelectObject(m_fontEngineData->hdc, designFont);
+}
+
+int QWindowsFontEngine::stringToCMap(const QChar *str, int len, QGlyphLayout *glyphs, int *nglyphs, QFontEngine::ShaperFlags flags) const
+{
+ Q_ASSERT(glyphs->numGlyphs >= *nglyphs);
+ if (*nglyphs < len) {
+ *nglyphs = len;
+ return false;
+ }
+
+ glyphs->numGlyphs = *nglyphs;
+ int mappedGlyphs;
+ *nglyphs = getGlyphIndexes(str, len, glyphs, &mappedGlyphs);
+
+ if (!(flags & GlyphIndicesOnly))
+ recalcAdvances(glyphs, flags);
+
+ return mappedGlyphs;
+}
+
+inline void calculateTTFGlyphWidth(HDC hdc, UINT glyph, int &width)
+{
+ GetCharWidthI(hdc, glyph, 1, 0, &width);
+}
+
+void QWindowsFontEngine::recalcAdvances(QGlyphLayout *glyphs, QFontEngine::ShaperFlags flags) const
+{
+ HGDIOBJ oldFont = 0;
+ HDC hdc = m_fontEngineData->hdc;
+ if (ttf && (flags & DesignMetrics)) {
+ for(int i = 0; i < glyphs->numGlyphs; i++) {
+ unsigned int glyph = glyphs->glyphs[i];
+ if (int(glyph) >= designAdvancesSize) {
+ const int newSize = int(glyph + 256) >> 8 << 8;
+ designAdvances = reinterpret_cast<QFixed *>(realloc(designAdvances, size_t(newSize) * sizeof(QFixed)));
+ Q_CHECK_PTR(designAdvances);
+ for(int i = designAdvancesSize; i < newSize; ++i)
+ designAdvances[i] = -1000000;
+ designAdvancesSize = newSize;
+ }
+ if (designAdvances[glyph] < -999999) {
+ if (!oldFont)
+ oldFont = selectDesignFont();
+
+ int width = 0;
+ calculateTTFGlyphWidth(hdc, glyph, width);
+ designAdvances[glyph] = QFixed(width) / designToDevice;
+ }
+ glyphs->advances[i] = designAdvances[glyph];
+ }
+ if (oldFont)
+ DeleteObject(SelectObject(hdc, oldFont));
+ } else {
+ for(int i = 0; i < glyphs->numGlyphs; i++) {
+ unsigned int glyph = glyphs->glyphs[i];
+
+ if (glyph >= widthCacheSize) {
+ const uint newSize = (glyph + 256) >> 8 << 8;
+ widthCache = reinterpret_cast<unsigned char *>(realloc(widthCache, newSize * sizeof(QFixed)));
+ Q_CHECK_PTR(widthCache);
+ memset(widthCache + widthCacheSize, 0, newSize - widthCacheSize);
+ widthCacheSize = newSize;
+ }
+ glyphs->advances[i] = widthCache[glyph];
+ // font-width cache failed
+ if (glyphs->advances[i].value() == 0) {
+ int width = 0;
+ if (!oldFont)
+ oldFont = SelectObject(hdc, hfont);
+
+ if (!ttf) {
+ QChar ch[2] = { ushort(glyph), u'\0' };
+ int chrLen = 1;
+ if (QChar::requiresSurrogates(glyph)) {
+ ch[0] = QChar::highSurrogate(glyph);
+ ch[1] = QChar::lowSurrogate(glyph);
+ ++chrLen;
+ }
+ SIZE size = {0, 0};
+ GetTextExtentPoint32(hdc, reinterpret_cast<const wchar_t *>(ch), chrLen, &size);
+ width = size.cx;
+ } else {
+ calculateTTFGlyphWidth(hdc, glyph, width);
+ }
+ glyphs->advances[i] = width;
+ // if glyph's within cache range, store it for later
+ if (width > 0 && width < 0x100)
+ widthCache[glyph] = uchar(width);
+ }
+ }
+
+ if (oldFont)
+ SelectObject(hdc, oldFont);
+ }
+}
+
+bool QWindowsFontEngine::getOutlineMetrics(glyph_t glyph, const QTransform &t, glyph_metrics_t *metrics) const
+{
+ Q_ASSERT(metrics != 0);
+
+ HDC hdc = m_fontEngineData->hdc;
+
+ GLYPHMETRICS gm;
+ DWORD res = 0;
+ MAT2 mat;
+ mat.eM11.value = mat.eM22.value = 1;
+ mat.eM11.fract = mat.eM22.fract = 0;
+ mat.eM21.value = mat.eM12.value = 0;
+ mat.eM21.fract = mat.eM12.fract = 0;
+
+ if (t.type() > QTransform::TxTranslate) {
+ // We need to set the transform using the HDC's world
+ // matrix rather than using the MAT2 above, because the
+ // results provided when transforming via MAT2 does not
+ // match the glyphs that are drawn using a WorldTransform
+ XFORM xform;
+ xform.eM11 = FLOAT(t.m11());
+ xform.eM12 = FLOAT(t.m12());
+ xform.eM21 = FLOAT(t.m21());
+ xform.eM22 = FLOAT(t.m22());
+ xform.eDx = 0;
+ xform.eDy = 0;
+ SetGraphicsMode(hdc, GM_ADVANCED);
+ SetWorldTransform(hdc, &xform);
+ }
+
+ uint format = GGO_METRICS;
+ if (ttf)
+ format |= GGO_GLYPH_INDEX;
+ res = GetGlyphOutline(hdc, glyph, format, &gm, 0, 0, &mat);
+
+ if (t.type() > QTransform::TxTranslate) {
+ XFORM xform;
+ xform.eM11 = xform.eM22 = 1;
+ xform.eM12 = xform.eM21 = xform.eDx = xform.eDy = 0;
+ SetWorldTransform(hdc, &xform);
+ SetGraphicsMode(hdc, GM_COMPATIBLE);
+ }
+
+ if (res != GDI_ERROR) {
+ *metrics = glyph_metrics_t(gm.gmptGlyphOrigin.x, -gm.gmptGlyphOrigin.y,
+ int(gm.gmBlackBoxX), int(gm.gmBlackBoxY),
+ gm.gmCellIncX, gm.gmCellIncY);
+ return true;
+ } else {
+ return false;
+ }
+}
+
+glyph_metrics_t QWindowsFontEngine::boundingBox(glyph_t glyph, const QTransform &t)
+{
+ HDC hdc = m_fontEngineData->hdc;
+ SelectObject(hdc, hfont);
+
+ glyph_metrics_t glyphMetrics;
+ bool success = getOutlineMetrics(glyph, t, &glyphMetrics);
+
+ if (!ttf && !success) {
+ // Bitmap fonts
+ wchar_t ch = wchar_t(glyph);
+ ABCFLOAT abc;
+ GetCharABCWidthsFloat(hdc, ch, ch, &abc);
+ int width = qRound(abc.abcfB);
+
+ return glyph_metrics_t(QFixed::fromReal(abc.abcfA), -tm.tmAscent, width, tm.tmHeight, width, 0).transformed(t);
+ }
+
+ return glyphMetrics;
+}
+
+namespace {
+# pragma pack(1)
+
+ struct OS2Table
+ {
+ quint16 version;
+ qint16 avgCharWidth;
+ quint16 weightClass;
+ quint16 widthClass;
+ quint16 type;
+ qint16 subscriptXSize;
+ qint16 subscriptYSize;
+ qint16 subscriptXOffset;
+ qint16 subscriptYOffset;
+ qint16 superscriptXSize;
+ qint16 superscriptYSize;
+ qint16 superscriptXOffset;
+ qint16 superscriptYOffset;
+ qint16 strikeOutSize;
+ qint16 strikeOutPosition;
+ qint16 familyClass;
+ quint8 panose[10];
+ quint32 unicodeRanges[4];
+ quint8 vendorID[4];
+ quint16 selection;
+ quint16 firstCharIndex;
+ quint16 lastCharIndex;
+ qint16 typoAscender;
+ qint16 typoDescender;
+ qint16 typoLineGap;
+ quint16 winAscent;
+ quint16 winDescent;
+ quint32 codepageRanges[2];
+ qint16 height;
+ qint16 capHeight;
+ quint16 defaultChar;
+ quint16 breakChar;
+ quint16 maxContext;
+ };
+
+# pragma pack()
+}
+
+QFixed QWindowsFontEngine::capHeight() const
+{
+ const QByteArray tableData = getSfntTable(QFont::Tag("OS/2").value());
+ if (size_t(tableData.size()) >= sizeof(OS2Table)) {
+ const OS2Table *table = reinterpret_cast<const OS2Table *>(tableData.constData());
+ if (qFromBigEndian<quint16>(table->version) >= 2) {
+ qint16 capHeight = qFromBigEndian<qint16>(table->capHeight);
+ if (capHeight > 0)
+ return QFixed(capHeight) / designToDevice;
+ }
+ }
+ return calculatedCapHeight();
+}
+
+QFixed QWindowsFontEngine::xHeight() const
+{
+ if (x_height >= 0)
+ return x_height;
+ return QFontEngine::xHeight();
+}
+
+QFixed QWindowsFontEngine::averageCharWidth() const
+{
+ return tm.tmAveCharWidth;
+}
+
+qreal QWindowsFontEngine::maxCharWidth() const
+{
+ return tm.tmMaxCharWidth;
+}
+
+enum { max_font_count = 256 };
+static const ushort char_table[] = {
+ 40,
+ 67,
+ 70,
+ 75,
+ 86,
+ 88,
+ 89,
+ 91,
+ 102,
+ 114,
+ 124,
+ 127,
+ 205,
+ 645,
+ 884,
+ 922,
+ 1070,
+ 12386,
+ 0
+};
+
+static const int char_table_entries = sizeof(char_table)/sizeof(ushort);
+
+#ifndef Q_CC_MINGW
+void QWindowsFontEngine::getGlyphBearings(glyph_t glyph, qreal *leftBearing, qreal *rightBearing)
+{
+ HDC hdc = m_fontEngineData->hdc;
+ SelectObject(hdc, hfont);
+
+ if (ttf) {
+ ABC abcWidths;
+ GetCharABCWidthsI(hdc, glyph, 1, 0, &abcWidths);
+ if (leftBearing)
+ *leftBearing = abcWidths.abcA;
+ if (rightBearing)
+ *rightBearing = abcWidths.abcC;
+ } else {
+ QFontEngine::getGlyphBearings(glyph, leftBearing, rightBearing);
+ }
+}
+#endif // Q_CC_MINGW
+
+void QWindowsFontEngine::initializeHeightMetrics() const
+{
+ m_ascent = tm.tmAscent;
+ m_descent = tm.tmDescent;
+ m_leading = tm.tmExternalLeading;
+
+ QFontEngine::initializeHeightMetrics();
+}
+
+bool QWindowsFontEngine::hasUnreliableGlyphOutline() const
+{
+ return hasUnreliableOutline || QFontEngine::hasUnreliableGlyphOutline();
+}
+
+qreal QWindowsFontEngine::minLeftBearing() const
+{
+ if (lbearing == SHRT_MIN)
+ minRightBearing(); // calculates both
+
+ return lbearing;
+}
+
+qreal QWindowsFontEngine::minRightBearing() const
+{
+ if (rbearing == SHRT_MIN) {
+ int ml = 0;
+ int mr = 0;
+ HDC hdc = m_fontEngineData->hdc;
+ SelectObject(hdc, hfont);
+ if (ttf) {
+ ABC *abc = nullptr;
+ int n = tm.tmLastChar - tm.tmFirstChar;
+ if (n <= max_font_count) {
+ abc = new ABC[n+1];
+ GetCharABCWidths(hdc, tm.tmFirstChar, tm.tmLastChar, abc);
+ } else {
+ abc = new ABC[char_table_entries+1];
+ for(int i = 0; i < char_table_entries; i++)
+ GetCharABCWidths(hdc, char_table[i], char_table[i], abc + i);
+ n = char_table_entries;
+ }
+ ml = abc[0].abcA;
+ mr = abc[0].abcC;
+ for (int i = 1; i < n; i++) {
+ if (abc[i].abcA + abc[i].abcB + abc[i].abcC != 0) {
+ ml = qMin(ml,abc[i].abcA);
+ mr = qMin(mr,abc[i].abcC);
+ }
+ }
+ delete [] abc;
+ } else {
+ ABCFLOAT *abc = 0;
+ int n = tm.tmLastChar - tm.tmFirstChar+1;
+ if (n <= max_font_count) {
+ abc = new ABCFLOAT[n];
+ GetCharABCWidthsFloat(hdc, tm.tmFirstChar, tm.tmLastChar, abc);
+ } else {
+ abc = new ABCFLOAT[char_table_entries];
+ for(int i = 0; i < char_table_entries; i++)
+ GetCharABCWidthsFloat(hdc, char_table[i], char_table[i], abc+i);
+ n = char_table_entries;
+ }
+ float fml = abc[0].abcfA;
+ float fmr = abc[0].abcfC;
+ for (int i=1; i<n; i++) {
+ if (abc[i].abcfA + abc[i].abcfB + abc[i].abcfC != 0) {
+ fml = qMin(fml,abc[i].abcfA);
+ fmr = qMin(fmr,abc[i].abcfC);
+ }
+ }
+ ml = qFloor(fml);
+ mr = qFloor(fmr);
+ delete [] abc;
+ }
+ lbearing = ml;
+ rbearing = mr;
+ }
+
+ return rbearing;
+}
+
+static inline double qt_fixed_to_double(const FIXED &p) {
+ return ((p.value << 16) + p.fract) / 65536.0;
+}
+
+static inline QPointF qt_to_qpointf(const POINTFX &pt, qreal scale, qreal stretch) {
+ return QPointF(qt_fixed_to_double(pt.x) * scale * stretch, -qt_fixed_to_double(pt.y) * scale);
+}
+
+#ifndef GGO_UNHINTED
+#define GGO_UNHINTED 0x0100
+#endif
+
+static bool addGlyphToPath(glyph_t glyph, const QFixedPoint &position, HDC hdc,
+ QPainterPath *path, bool ttf, glyph_metrics_t *metric = nullptr,
+ qreal scale = 1.0, qreal stretch = 1.0)
+{
+ MAT2 mat;
+ mat.eM11.value = mat.eM22.value = 1;
+ mat.eM11.fract = mat.eM22.fract = 0;
+ mat.eM21.value = mat.eM12.value = 0;
+ mat.eM21.fract = mat.eM12.fract = 0;
+
+ GLYPHMETRICS gMetric;
+ memset(&gMetric, 0, sizeof(GLYPHMETRICS));
+
+ if (metric) {
+ // If metrics requested, retrieve first using GGO_METRICS, because the returned
+ // values are incorrect for OpenType PS fonts if obtained at the same time as the
+ // glyph paths themselves (ie. with GGO_NATIVE as the format).
+ uint format = GGO_METRICS;
+ if (ttf)
+ format |= GGO_GLYPH_INDEX;
+ if (GetGlyphOutline(hdc, glyph, format, &gMetric, 0, 0, &mat) == GDI_ERROR)
+ return false;
+ // #### obey scale
+ *metric = glyph_metrics_t(gMetric.gmptGlyphOrigin.x, -gMetric.gmptGlyphOrigin.y,
+ int(gMetric.gmBlackBoxX), int(gMetric.gmBlackBoxY),
+ gMetric.gmCellIncX, gMetric.gmCellIncY);
+ }
+
+ uint glyphFormat = GGO_NATIVE;
+
+ if (ttf)
+ glyphFormat |= GGO_GLYPH_INDEX;
+
+ const DWORD bufferSize = GetGlyphOutline(hdc, glyph, glyphFormat, &gMetric, 0, 0, &mat);
+ if (bufferSize == GDI_ERROR)
+ return false;
+
+ char *dataBuffer = new char[bufferSize];
+ DWORD ret = GDI_ERROR;
+ ret = GetGlyphOutline(hdc, glyph, glyphFormat, &gMetric, bufferSize, dataBuffer, &mat);
+ if (ret == GDI_ERROR) {
+ delete [] dataBuffer;
+ return false;
+ }
+
+ DWORD offset = 0;
+ DWORD headerOffset = 0;
+
+ QPointF oset = position.toPointF();
+ while (headerOffset < bufferSize) {
+ const TTPOLYGONHEADER *ttph = reinterpret_cast<const TTPOLYGONHEADER *>(dataBuffer + headerOffset);
+
+ QPointF lastPoint(qt_to_qpointf(ttph->pfxStart, scale, stretch));
+ path->moveTo(lastPoint + oset);
+ offset += sizeof(TTPOLYGONHEADER);
+ while (offset < headerOffset + ttph->cb) {
+ const TTPOLYCURVE *curve = reinterpret_cast<const TTPOLYCURVE *>(dataBuffer + offset);
+ switch (curve->wType) {
+ case TT_PRIM_LINE: {
+ for (int i=0; i<curve->cpfx; ++i) {
+ QPointF p = qt_to_qpointf(curve->apfx[i], scale, stretch) + oset;
+ path->lineTo(p);
+ }
+ break;
+ }
+ case TT_PRIM_QSPLINE: {
+ const QPainterPath::Element &elm = path->elementAt(path->elementCount()-1);
+ QPointF prev(elm.x, elm.y);
+ QPointF endPoint;
+ for (int i=0; i<curve->cpfx - 1; ++i) {
+ QPointF p1 = qt_to_qpointf(curve->apfx[i], scale, stretch) + oset;
+ QPointF p2 = qt_to_qpointf(curve->apfx[i+1], scale, stretch) + oset;
+ if (i < curve->cpfx - 2) {
+ endPoint = QPointF((p1.x() + p2.x()) / 2, (p1.y() + p2.y()) / 2);
+ } else {
+ endPoint = p2;
+ }
+
+ path->quadTo(p1, endPoint);
+ prev = endPoint;
+ }
+
+ break;
+ }
+ case TT_PRIM_CSPLINE: {
+ for (int i=0; i<curve->cpfx; ) {
+ QPointF p2 = qt_to_qpointf(curve->apfx[i++], scale, stretch) + oset;
+ QPointF p3 = qt_to_qpointf(curve->apfx[i++], scale, stretch) + oset;
+ QPointF p4 = qt_to_qpointf(curve->apfx[i++], scale, stretch) + oset;
+ path->cubicTo(p2, p3, p4);
+ }
+ break;
+ }
+ default:
+ qWarning("QFontEngineWin::addOutlineToPath, unhandled switch case");
+ }
+ offset += sizeof(TTPOLYCURVE) + (curve->cpfx-1) * sizeof(POINTFX);
+ }
+ path->closeSubpath();
+ headerOffset += ttph->cb;
+ }
+ delete [] dataBuffer;
+
+ return true;
+}
+
+void QWindowsFontEngine::addGlyphsToPath(glyph_t *glyphs, QFixedPoint *positions, int nglyphs,
+ QPainterPath *path, QTextItem::RenderFlags)
+{
+ LOGFONT lf = m_logfont;
+ // The sign must be negative here to make sure we match against character height instead of
+ // hinted cell height. This ensures that we get linear matching, and we need this for
+ // paths since we later on apply a scaling transform to the glyph outline to get the
+ // font at the correct pixel size.
+ lf.lfHeight = -unitsPerEm;
+ lf.lfWidth = 0;
+ HFONT hf = CreateFontIndirect(&lf);
+ HDC hdc = m_fontEngineData->hdc;
+ HGDIOBJ oldfont = SelectObject(hdc, hf);
+
+ qreal scale = qreal(fontDef.pixelSize) / unitsPerEm;
+ qreal stretch = fontDef.stretch ? qreal(fontDef.stretch) / 100 : 1.0;
+ for(int i = 0; i < nglyphs; ++i) {
+ if (!addGlyphToPath(glyphs[i], positions[i], hdc, path, ttf, /*metric*/0,
+ scale, stretch)) {
+ // Some windows fonts, like "Modern", are vector stroke
+ // fonts, which are reported as TMPF_VECTOR but do not
+ // support GetGlyphOutline, and thus we set this bit so
+ // that addOutLineToPath can check it and return safely...
+ hasOutline = false;
+ break;
+ }
+ }
+ DeleteObject(SelectObject(hdc, oldfont));
+}
+
+void QWindowsFontEngine::addOutlineToPath(qreal x, qreal y, const QGlyphLayout &glyphs,
+ QPainterPath *path, QTextItem::RenderFlags flags)
+{
+ if (tm.tmPitchAndFamily & (TMPF_TRUETYPE | TMPF_VECTOR)) {
+ hasOutline = true;
+ QFontEngine::addOutlineToPath(x, y, glyphs, path, flags);
+ if (hasOutline) {
+ // has_outline is set to false if addGlyphToPath gets
+ // false from GetGlyphOutline, meaning its not an outline
+ // font.
+ return;
+ }
+ }
+ QFontEngine::addBitmapFontToPath(x, y, glyphs, path, flags);
+}
+
+QFontEngine::FaceId QWindowsFontEngine::faceId() const
+{
+ return _faceId;
+}
+
+QT_BEGIN_INCLUDE_NAMESPACE
+#include <qdebug.h>
+QT_END_INCLUDE_NAMESPACE
+
+int QWindowsFontEngine::synthesized() const
+{
+ if (synthesized_flags == -1) {
+ synthesized_flags = 0;
+ if (ttf) {
+ const DWORD HEAD = MAKE_LITTLE_ENDIAN_TAG('h', 'e', 'a', 'd');
+ HDC hdc = m_fontEngineData->hdc;
+ SelectObject(hdc, hfont);
+ uchar data[4];
+ GetFontData(hdc, HEAD, 44, &data, 4);
+ USHORT macStyle = qt_getUShort(data);
+ if (tm.tmItalic && !(macStyle & 2))
+ synthesized_flags = SynthesizedItalic;
+ if (fontDef.stretch != 100 && ttf)
+ synthesized_flags |= SynthesizedStretch;
+ if (tm.tmWeight >= 500 && tm.tmWeight < 750 && !(macStyle & 1))
+ synthesized_flags |= SynthesizedBold;
+ //qDebug() << "font is" << _name <<
+ // "it=" << (macStyle & 2) << fontDef.style << "flags=" << synthesized_flags;
+ }
+ }
+ return synthesized_flags;
+}
+
+QFixed QWindowsFontEngine::emSquareSize() const
+{
+ return unitsPerEm;
+}
+
+QFontEngine::Properties QWindowsFontEngine::properties() const
+{
+ LOGFONT lf = m_logfont;
+ lf.lfHeight = unitsPerEm;
+ HFONT hf = CreateFontIndirect(&lf);
+ HDC hdc = m_fontEngineData->hdc;
+ HGDIOBJ oldfont = SelectObject(hdc, hf);
+ OUTLINETEXTMETRIC *otm = getOutlineTextMetric(hdc);
+ Properties p;
+ p.emSquare = unitsPerEm;
+ p.italicAngle = otm->otmItalicAngle;
+ const QByteArray name = stringFromOutLineTextMetric(otm, otm->otmpFamilyName).toLatin1()
+ + stringFromOutLineTextMetric(otm, otm->otmpStyleName).toLatin1();
+ p.postscriptName = QFontEngine::convertToPostscriptFontFamilyName(name);
+ p.boundingBox = QRectF(otm->otmrcFontBox.left, -otm->otmrcFontBox.top,
+ otm->otmrcFontBox.right - otm->otmrcFontBox.left,
+ otm->otmrcFontBox.top - otm->otmrcFontBox.bottom);
+ p.ascent = otm->otmAscent;
+ p.descent = -otm->otmDescent;
+ p.leading = int(otm->otmLineGap);
+ p.capHeight = 0;
+ p.lineWidth = otm->otmsUnderscoreSize;
+ free(otm);
+ DeleteObject(SelectObject(hdc, oldfont));
+ return p;
+}
+
+void QWindowsFontEngine::getUnscaledGlyph(glyph_t glyph, QPainterPath *path, glyph_metrics_t *metrics)
+{
+ LOGFONT lf = m_logfont;
+ lf.lfHeight = -unitsPerEm;
+ int flags = synthesized();
+ if (flags & SynthesizedItalic)
+ lf.lfItalic = false;
+ lf.lfWidth = 0;
+ HFONT hf = CreateFontIndirect(&lf);
+ HDC hdc = m_fontEngineData->hdc;
+ HGDIOBJ oldfont = SelectObject(hdc, hf);
+ QFixedPoint p;
+ p.x = 0;
+ p.y = 0;
+ addGlyphToPath(glyph, p, hdc, path, ttf, metrics);
+ DeleteObject(SelectObject(hdc, oldfont));
+}
+
+bool QWindowsFontEngine::getSfntTableData(uint tag, uchar *buffer, uint *length) const
+{
+ if (!ttf && !cffTable)
+ return false;
+ HDC hdc = m_fontEngineData->hdc;
+ SelectObject(hdc, hfont);
+ DWORD t = qbswap<quint32>(tag);
+ *length = GetFontData(hdc, t, 0, buffer, *length);
+ Q_ASSERT(*length == GDI_ERROR || int(*length) > 0);
+ return *length != GDI_ERROR;
+}
+
+#if !defined(CLEARTYPE_QUALITY)
+# define CLEARTYPE_QUALITY 5
+#endif
+
+QWindowsNativeImage *QWindowsFontEngine::drawGDIGlyph(HFONT font, glyph_t glyph, int margin,
+ const QTransform &t,
+ QImage::Format mask_format)
+{
+ Q_UNUSED(mask_format);
+ glyph_metrics_t gm = boundingBox(glyph);
+
+// printf(" -> for glyph %4x\n", glyph);
+
+ int gx = gm.x.toInt();
+ int gy = gm.y.toInt();
+ int iw = gm.width.toInt();
+ int ih = gm.height.toInt();
+
+ if (iw <= 0 || ih <= 0)
+ return 0;
+
+ bool has_transformation = t.type() > QTransform::TxTranslate;
+
+ unsigned int options = ttf ? ETO_GLYPH_INDEX : 0;
+ XFORM xform;
+
+ if (has_transformation) {
+ xform.eM11 = FLOAT(t.m11());
+ xform.eM12 = FLOAT(t.m12());
+ xform.eM21 = FLOAT(t.m21());
+ xform.eM22 = FLOAT(t.m22());
+ xform.eDx = margin;
+ xform.eDy = margin;
+
+ const HDC hdc = m_fontEngineData->hdc;
+
+ SetGraphicsMode(hdc, GM_ADVANCED);
+ SetWorldTransform(hdc, &xform);
+ HGDIOBJ old_font = SelectObject(hdc, font);
+
+ const UINT ggo_options = GGO_METRICS | (ttf ? GGO_GLYPH_INDEX : 0);
+ GLYPHMETRICS tgm;
+ MAT2 mat;
+ memset(&mat, 0, sizeof(mat));
+ mat.eM11.value = mat.eM22.value = 1;
+
+ const DWORD result = GetGlyphOutline(hdc, glyph, ggo_options, &tgm, 0, 0, &mat);
+
+ XFORM identity = {1, 0, 0, 1, 0, 0};
+ SetWorldTransform(hdc, &identity);
+ SetGraphicsMode(hdc, GM_COMPATIBLE);
+ SelectObject(hdc, old_font);
+
+ if (result == GDI_ERROR) {
+ const int errorCode = int(GetLastError());
+ qErrnoWarning(errorCode, "QWinFontEngine: unable to query transformed glyph metrics (GetGlyphOutline() failed, error %d)...", errorCode);
+ return 0;
+ }
+
+ iw = int(tgm.gmBlackBoxX);
+ ih = int(tgm.gmBlackBoxY);
+
+ xform.eDx -= tgm.gmptGlyphOrigin.x;
+ xform.eDy += tgm.gmptGlyphOrigin.y;
+ }
+
+ // The padding here needs to be kept in sync with the values in alphaMapBoundingBox.
+ QWindowsNativeImage *ni = new QWindowsNativeImage(iw + 2 * margin,
+ ih + 2 * margin,
+ QWindowsNativeImage::systemFormat());
+
+ /*If cleartype is enabled we use the standard system format even on Windows CE
+ and not the special textbuffer format we have to use if cleartype is disabled*/
+
+ ni->image().fill(0xffffffff);
+
+ HDC hdc = ni->hdc();
+
+ SelectObject(hdc, GetStockObject(NULL_BRUSH));
+ SelectObject(hdc, GetStockObject(BLACK_PEN));
+ SetTextColor(hdc, RGB(0,0,0));
+ SetBkMode(hdc, TRANSPARENT);
+ SetTextAlign(hdc, TA_BASELINE);
+
+ HGDIOBJ old_font = SelectObject(hdc, font);
+
+ if (has_transformation) {
+ SetGraphicsMode(hdc, GM_ADVANCED);
+ SetWorldTransform(hdc, &xform);
+ ExtTextOut(hdc, 0, 0, options, 0, reinterpret_cast<LPCWSTR>(&glyph), 1, 0);
+ } else {
+ ExtTextOut(hdc, -gx + margin, -gy + margin, options, 0, reinterpret_cast<LPCWSTR>(&glyph), 1, 0);
+ }
+
+ SelectObject(hdc, old_font);
+ return ni;
+}
+
+glyph_metrics_t QWindowsFontEngine::alphaMapBoundingBox(glyph_t glyph,
+ const QFixedPoint &,
+ const QTransform &matrix,
+ GlyphFormat format)
+{
+ int margin = 0;
+ if (format == QFontEngine::Format_A32 || format == QFontEngine::Format_ARGB)
+ margin = glyphMargin(QFontEngine::Format_A32);
+ glyph_metrics_t gm = boundingBox(glyph, matrix);
+ gm.width += margin * 2;
+ gm.height += margin * 2;
+ return gm;
+}
+
+QImage QWindowsFontEngine::alphaMapForGlyph(glyph_t glyph, const QTransform &xform)
+{
+ HFONT font = hfont;
+
+ bool clearTypeTemporarilyDisabled = (m_fontEngineData->clearTypeEnabled && m_logfont.lfQuality != NONANTIALIASED_QUALITY);
+ if (clearTypeTemporarilyDisabled) {
+ LOGFONT lf = m_logfont;
+ lf.lfQuality = ANTIALIASED_QUALITY;
+ font = CreateFontIndirect(&lf);
+ }
+ QImage::Format mask_format = QWindowsNativeImage::systemFormat();
+ mask_format = QImage::Format_RGB32;
+
+ const QWindowsNativeImage *mask = drawGDIGlyph(font, glyph, 0, xform, mask_format);
+ if (mask == 0) {
+ if (m_fontEngineData->clearTypeEnabled)
+ DeleteObject(font);
+ return QImage();
+ }
+
+ QImage alphaMap(mask->width(), mask->height(), QImage::Format_Alpha8);
+
+
+ // Copy data... Cannot use QPainter here as GDI has messed up the
+ // Alpha channel of the ni.image pixels...
+ for (int y=0; y<mask->height(); ++y) {
+ uchar *dest = alphaMap.scanLine(y);
+ if (mask->image().format() == QImage::Format_RGB16) {
+ const qint16 *src = reinterpret_cast<const qint16 *>(mask->image().constScanLine(y));
+ for (int x=0; x<mask->width(); ++x)
+ dest[x] = 255 - qGray(src[x]);
+ } else {
+ const uint *src = reinterpret_cast<const uint *>(mask->image().constScanLine(y));
+ for (int x=0; x<mask->width(); ++x) {
+ if (QWindowsNativeImage::systemFormat() == QImage::Format_RGB16)
+ dest[x] = 255 - qGray(src[x]);
+ else
+ dest[x] = 255 - (m_fontEngineData->pow_gamma[qGray(src[x])] * 255. / 2047.);
+ }
+ }
+ }
+
+ // Cleanup...
+ delete mask;
+ if (clearTypeTemporarilyDisabled) {
+ DeleteObject(font);
+ }
+
+ return alphaMap;
+}
+
+#define SPI_GETFONTSMOOTHINGCONTRAST 0x200C
+#define SPI_SETFONTSMOOTHINGCONTRAST 0x200D
+
+QImage QWindowsFontEngine::alphaRGBMapForGlyph(glyph_t glyph,
+ const QFixedPoint &,
+ const QTransform &t)
+{
+ HFONT font = hfont;
+
+ UINT contrast;
+ SystemParametersInfo(SPI_GETFONTSMOOTHINGCONTRAST, 0, &contrast, 0);
+ SystemParametersInfo(SPI_SETFONTSMOOTHINGCONTRAST, 0, reinterpret_cast<void *>(quintptr(1000)), 0);
+
+ int margin = glyphMargin(QFontEngine::Format_A32);
+ QWindowsNativeImage *mask = drawGDIGlyph(font, glyph, margin, t, QImage::Format_RGB32);
+ SystemParametersInfo(SPI_SETFONTSMOOTHINGCONTRAST, 0, reinterpret_cast<void *>(quintptr(contrast)), 0);
+
+ if (mask == 0)
+ return QImage();
+
+ // Gracefully handle the odd case when the display is 16-bit
+ const QImage source = mask->image().depth() == 32
+ ? mask->image()
+ : mask->image().convertToFormat(QImage::Format_RGB32);
+
+ QImage rgbMask(mask->width(), mask->height(), QImage::Format_RGB32);
+ for (int y=0; y<mask->height(); ++y) {
+ auto dest = reinterpret_cast<uint *>(rgbMask.scanLine(y));
+ const uint *src = reinterpret_cast<const uint *>(source.constScanLine(y));
+ for (int x=0; x<mask->width(); ++x) {
+ dest[x] = 0xffffffff - (0x00ffffff & src[x]);
+ }
+ }
+
+ delete mask;
+
+ return rgbMask;
+}
+
+QFontEngine *QWindowsFontEngine::cloneWithSize(qreal pixelSize) const
+{
+ QFontDef request = fontDef;
+ QString actualFontName = request.families.constFirst();
+ if (!uniqueFamilyName.isEmpty())
+ request.families = QStringList(uniqueFamilyName);
+ request.pixelSize = pixelSize;
+ const QString faceName = QString::fromWCharArray(m_logfont.lfFaceName);
+
+ QFontEngine *fontEngine =
+ QWindowsFontDatabase::createEngine(request, faceName,
+ QWindowsFontDatabase::defaultVerticalDPI(),
+ m_fontEngineData);
+ if (fontEngine) {
+ fontEngine->fontDef.families = QStringList(actualFontName);
+ if (!uniqueFamilyName.isEmpty()) {
+ static_cast<QWindowsFontEngine *>(fontEngine)->setUniqueFamilyName(uniqueFamilyName);
+ if (QPlatformIntegration *pi = QGuiApplicationPrivate::platformIntegration()) {
+ QPlatformFontDatabase *pfdb = pi->fontDatabase();
+ static_cast<QWindowsFontDatabase *>(pfdb)->refUniqueFont(uniqueFamilyName);
+ }
+ }
+ }
+ return fontEngine;
+}
+
+Qt::HANDLE QWindowsFontEngine::handle() const
+{
+ return hfont;
+}
+
+void QWindowsFontEngine::initFontInfo(const QFontDef &request,
+ int dpi)
+{
+ fontDef = request; // most settings are equal
+ HDC dc = m_fontEngineData->hdc;
+ SelectObject(dc, hfont);
+ wchar_t n[64];
+ GetTextFace(dc, 64, n);
+ fontDef.families = QStringList(QString::fromWCharArray(n));
+ fontDef.fixedPitch = !(tm.tmPitchAndFamily & TMPF_FIXED_PITCH);
+ if (fontDef.pointSize < 0) {
+ fontDef.pointSize = fontDef.pixelSize * 72. / dpi;
+ } else if (fontDef.pixelSize == -1) {
+ fontDef.pixelSize = qRound(fontDef.pointSize * dpi / 72.);
+ }
+}
+
+bool QWindowsFontEngine::supportsTransformation(const QTransform &transform) const
+{
+ // Support all transformations for ttf files, and translations for raster fonts
+ return ttf || transform.type() <= QTransform::TxTranslate;
+}
+
+QT_END_NAMESPACE
diff --git a/src/gui/text/windows/qwindowsfontengine_p.h b/src/gui/text/windows/qwindowsfontengine_p.h
new file mode 100644
index 0000000000..07f4db3c4a
--- /dev/null
+++ b/src/gui/text/windows/qwindowsfontengine_p.h
@@ -0,0 +1,143 @@
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
+
+#ifndef QWINDOWSFONTENGINE_H
+#define QWINDOWSFONTENGINE_H
+
+//
+// W A R N I N G
+// -------------
+//
+// This file is not part of the Qt API. It exists purely as an
+// implementation detail. This header file may change from version to
+// version without notice, or even be removed.
+//
+// We mean it.
+//
+
+#include <QtGui/private/qfontengine_p.h>
+
+#include <QtGui/QImage>
+#include <QtCore/QSharedPointer>
+#include <QtCore/QMetaType>
+
+#include <QtCore/qt_windows.h>
+
+QT_BEGIN_NAMESPACE
+
+class QWindowsNativeImage;
+class QWindowsFontEngineData;
+
+class QWindowsFontEngine : public QFontEngine
+{
+ Q_DISABLE_COPY_MOVE(QWindowsFontEngine)
+public:
+ QWindowsFontEngine(const QString &name, LOGFONT lf,
+ const QSharedPointer<QWindowsFontEngineData> &fontEngineData);
+
+ ~QWindowsFontEngine() override;
+ void initFontInfo(const QFontDef &request,
+ int dpi);
+
+ QFixed lineThickness() const override;
+ Properties properties() const override;
+ void getUnscaledGlyph(glyph_t glyph, QPainterPath *path, glyph_metrics_t *metrics) override;
+ FaceId faceId() const override;
+ bool getSfntTableData(uint tag, uchar *buffer, uint *length) const override;
+ int synthesized() const override;
+ QFixed emSquareSize() const override;
+
+ glyph_t glyphIndex(uint ucs4) const override;
+ int stringToCMap(const QChar *str, int len, QGlyphLayout *glyphs, int *nglyphs, ShaperFlags flags) const override;
+ void recalcAdvances(QGlyphLayout *glyphs, ShaperFlags) const override;
+
+ void addOutlineToPath(qreal x, qreal y, const QGlyphLayout &glyphs, QPainterPath *path, QTextItem::RenderFlags flags) override;
+ void addGlyphsToPath(glyph_t *glyphs, QFixedPoint *positions, int nglyphs,
+ QPainterPath *path, QTextItem::RenderFlags flags) override;
+
+ HGDIOBJ selectDesignFont() const;
+
+ glyph_metrics_t boundingBox(glyph_t g) override { return boundingBox(g, QTransform()); }
+ glyph_metrics_t boundingBox(glyph_t g, const QTransform &t) override;
+
+
+ QFixed xHeight() const override;
+ QFixed capHeight() const override;
+ QFixed averageCharWidth() const override;
+ qreal maxCharWidth() const override;
+ qreal minLeftBearing() const override;
+ qreal minRightBearing() const override;
+
+ QImage alphaMapForGlyph(glyph_t t) override { return alphaMapForGlyph(t, QTransform()); }
+ QImage alphaMapForGlyph(glyph_t, const QTransform &xform) override;
+ QImage alphaRGBMapForGlyph(glyph_t t,
+ const QFixedPoint &subPixelPosition,
+ const QTransform &xform) override;
+ glyph_metrics_t alphaMapBoundingBox(glyph_t glyph,
+ const QFixedPoint &,
+ const QTransform &matrix,
+ GlyphFormat) override;
+
+ QFontEngine *cloneWithSize(qreal pixelSize) const override;
+ Qt::HANDLE handle() const override;
+ bool supportsTransformation(const QTransform &transform) const override;
+
+#ifndef Q_CC_MINGW
+ void getGlyphBearings(glyph_t glyph, qreal *leftBearing = nullptr, qreal *rightBearing = nullptr) override;
+#endif
+
+ bool hasUnreliableGlyphOutline() const override;
+
+ int getGlyphIndexes(const QChar *ch, int numChars, QGlyphLayout *glyphs, int *mappedGlyphs) const;
+ void getCMap();
+
+ bool getOutlineMetrics(glyph_t glyph, const QTransform &t, glyph_metrics_t *metrics) const;
+
+ const QSharedPointer<QWindowsFontEngineData> &fontEngineData() const { return m_fontEngineData; }
+
+ void setUniqueFamilyName(const QString &newName) { uniqueFamilyName = newName; }
+
+protected:
+ void initializeHeightMetrics() const override;
+
+private:
+ QWindowsNativeImage *drawGDIGlyph(HFONT font, glyph_t, int margin, const QTransform &xform,
+ QImage::Format mask_format);
+ bool hasCFFTable() const;
+ bool hasCMapTable() const;
+
+ const QSharedPointer<QWindowsFontEngineData> m_fontEngineData;
+
+ const QString _name;
+ QString uniqueFamilyName;
+ HFONT hfont = 0;
+ const LOGFONT m_logfont;
+ uint ttf : 1;
+ uint hasOutline : 1;
+ uint hasUnreliableOutline : 1;
+ uint cffTable : 1;
+ TEXTMETRIC tm;
+ const unsigned char *cmap = nullptr;
+ int cmapSize = 0;
+ QByteArray cmapTable;
+ mutable qreal lbearing = SHRT_MIN;
+ mutable qreal rbearing = SHRT_MIN;
+ QFixed designToDevice;
+ int unitsPerEm = 0;
+ QFixed x_height = -1;
+ FaceId _faceId;
+
+ mutable int synthesized_flags = -1;
+ mutable QFixed lineWidth = -1;
+ mutable unsigned char *widthCache = nullptr;
+ mutable uint widthCacheSize = 0;
+ mutable QFixed *designAdvances = nullptr;
+ mutable int designAdvancesSize = 0;
+};
+
+QT_END_NAMESPACE
+
+QT_DECL_METATYPE_EXTERN(HFONT, Q_GUI_EXPORT)
+QT_DECL_METATYPE_EXTERN(LOGFONT, Q_GUI_EXPORT)
+
+#endif // QWINDOWSFONTENGINE_H
diff --git a/src/gui/text/windows/qwindowsfontenginedirectwrite.cpp b/src/gui/text/windows/qwindowsfontenginedirectwrite.cpp
new file mode 100644
index 0000000000..47b8a7ee3c
--- /dev/null
+++ b/src/gui/text/windows/qwindowsfontenginedirectwrite.cpp
@@ -0,0 +1,1180 @@
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
+
+#include "qwindowsfontenginedirectwrite_p.h"
+#include "qwindowsfontdatabase_p.h"
+
+#include <QtCore/QtEndian>
+#include <QtCore/QVarLengthArray>
+#include <QtCore/QFile>
+#include <private/qstringiterator_p.h>
+#include <QtCore/private/qsystemlibrary_p.h>
+#include <QtCore/private/qwinregistry_p.h>
+#include <QtGui/private/qguiapplication_p.h>
+#include <qpa/qplatformintegration.h>
+#include <QtGui/qpainterpath.h>
+
+#if QT_CONFIG(directwrite3)
+# include "qwindowsdirectwritefontdatabase_p.h"
+# include <dwrite_3.h>
+#else
+# include <dwrite_2.h>
+#endif
+
+#include <d2d1.h>
+
+QT_BEGIN_NAMESPACE
+
+// Clang does not consider __declspec(nothrow) as nothrow
+QT_WARNING_DISABLE_CLANG("-Wmicrosoft-exception-spec")
+
+// Convert from design units to logical pixels
+#define DESIGN_TO_LOGICAL(DESIGN_UNIT_VALUE) \
+ QFixed::fromReal((qreal(DESIGN_UNIT_VALUE) / qreal(m_unitsPerEm)) * fontDef.pixelSize)
+
+namespace {
+
+ class GeometrySink: public IDWriteGeometrySink
+ {
+ Q_DISABLE_COPY_MOVE(GeometrySink)
+ public:
+ GeometrySink(QPainterPath *path)
+ : m_refCount(0), m_path(path)
+ {
+ Q_ASSERT(m_path != 0);
+ }
+ virtual ~GeometrySink() = default;
+
+ IFACEMETHOD_(void, AddBeziers)(const D2D1_BEZIER_SEGMENT *beziers, UINT bezierCount) override;
+ IFACEMETHOD_(void, AddLines)(const D2D1_POINT_2F *points, UINT pointCount) override;
+ IFACEMETHOD_(void, BeginFigure)(D2D1_POINT_2F startPoint, D2D1_FIGURE_BEGIN figureBegin) override;
+ IFACEMETHOD(Close)() override;
+ IFACEMETHOD_(void, EndFigure)(D2D1_FIGURE_END figureEnd) override;
+ IFACEMETHOD_(void, SetFillMode)(D2D1_FILL_MODE fillMode) override;
+ IFACEMETHOD_(void, SetSegmentFlags)(D2D1_PATH_SEGMENT vertexFlags) override;
+
+ IFACEMETHOD_(unsigned long, AddRef)() override;
+ IFACEMETHOD_(unsigned long, Release)() override;
+ IFACEMETHOD(QueryInterface)(IID const &riid, void **ppvObject) override;
+
+ private:
+ inline static QPointF fromD2D1_POINT_2F(const D2D1_POINT_2F &inp)
+ {
+ return QPointF(inp.x, inp.y);
+ }
+
+ unsigned long m_refCount;
+ QPointF m_startPoint;
+ QPainterPath *m_path;
+ };
+
+ void GeometrySink::AddBeziers(const D2D1_BEZIER_SEGMENT *beziers,
+ UINT bezierCount) noexcept
+ {
+ for (uint i=0; i<bezierCount; ++i) {
+ QPointF c1 = fromD2D1_POINT_2F(beziers[i].point1);
+ QPointF c2 = fromD2D1_POINT_2F(beziers[i].point2);
+ QPointF p2 = fromD2D1_POINT_2F(beziers[i].point3);
+
+ m_path->cubicTo(c1, c2, p2);
+ }
+ }
+
+ void GeometrySink::AddLines(const D2D1_POINT_2F *points, UINT pointsCount) noexcept
+ {
+ for (uint i=0; i<pointsCount; ++i)
+ m_path->lineTo(fromD2D1_POINT_2F(points[i]));
+ }
+
+ void GeometrySink::BeginFigure(D2D1_POINT_2F startPoint,
+ D2D1_FIGURE_BEGIN /*figureBegin*/) noexcept
+ {
+ m_startPoint = fromD2D1_POINT_2F(startPoint);
+ m_path->moveTo(m_startPoint);
+ }
+
+ IFACEMETHODIMP GeometrySink::Close() noexcept
+ {
+ return E_NOTIMPL;
+ }
+
+ void GeometrySink::EndFigure(D2D1_FIGURE_END figureEnd) noexcept
+ {
+ if (figureEnd == D2D1_FIGURE_END_CLOSED)
+ m_path->closeSubpath();
+ }
+
+ void GeometrySink::SetFillMode(D2D1_FILL_MODE fillMode) noexcept
+ {
+ m_path->setFillRule(fillMode == D2D1_FILL_MODE_ALTERNATE
+ ? Qt::OddEvenFill
+ : Qt::WindingFill);
+ }
+
+ void GeometrySink::SetSegmentFlags(D2D1_PATH_SEGMENT /*vertexFlags*/) noexcept
+ {
+ /* Not implemented */
+ }
+
+ IFACEMETHODIMP_(unsigned long) GeometrySink::AddRef() noexcept
+ {
+ return InterlockedIncrement(&m_refCount);
+ }
+
+ IFACEMETHODIMP_(unsigned long) GeometrySink::Release() noexcept
+ {
+ unsigned long newCount = InterlockedDecrement(&m_refCount);
+ if (newCount == 0)
+ {
+ delete this;
+ return 0;
+ }
+
+ return newCount;
+ }
+
+ IFACEMETHODIMP GeometrySink::QueryInterface(IID const &riid, void **ppvObject) noexcept
+ {
+ if (__uuidof(IDWriteGeometrySink) == riid) {
+ *ppvObject = this;
+ } else if (__uuidof(IUnknown) == riid) {
+ *ppvObject = this;
+ } else {
+ *ppvObject = NULL;
+ return E_FAIL;
+ }
+
+ AddRef();
+ return S_OK;
+ }
+
+}
+
+static DWRITE_MEASURING_MODE renderModeToMeasureMode(DWRITE_RENDERING_MODE renderMode)
+{
+ switch (renderMode) {
+ case DWRITE_RENDERING_MODE_GDI_CLASSIC:
+ return DWRITE_MEASURING_MODE_GDI_CLASSIC;
+ case DWRITE_RENDERING_MODE_GDI_NATURAL:
+ return DWRITE_MEASURING_MODE_GDI_NATURAL;
+ default:
+ return DWRITE_MEASURING_MODE_NATURAL;
+ }
+}
+
+DWRITE_RENDERING_MODE QWindowsFontEngineDirectWrite::hintingPreferenceToRenderingMode(const QFontDef &fontDef) const
+{
+ if ((fontDef.styleStrategy & QFont::NoAntialias) && glyphFormat != QFontEngine::Format_ARGB)
+ return DWRITE_RENDERING_MODE_ALIASED;
+
+ QFont::HintingPreference hintingPreference = QFont::HintingPreference(fontDef.hintingPreference);
+ if (!qFuzzyCompare(qApp->devicePixelRatio(), 1.0) && hintingPreference == QFont::PreferDefaultHinting) {
+ // Microsoft documentation recommends using asymmetric rendering for small fonts
+ // at pixel size 16 and less, and symmetric for larger fonts.
+ hintingPreference = fontDef.pixelSize > 16.0
+ ? QFont::PreferNoHinting
+ : QFont::PreferVerticalHinting;
+ }
+
+ switch (hintingPreference) {
+ case QFont::PreferNoHinting:
+ return DWRITE_RENDERING_MODE_CLEARTYPE_NATURAL_SYMMETRIC;
+ case QFont::PreferVerticalHinting:
+ return DWRITE_RENDERING_MODE_CLEARTYPE_NATURAL;
+ default:
+ return DWRITE_RENDERING_MODE_CLEARTYPE_GDI_CLASSIC;
+ }
+}
+
+/*!
+ \class QWindowsFontEngineDirectWrite
+ \brief Windows font engine using Direct Write.
+ \internal
+
+ Font engine for subpixel positioned text on Windows Vista
+ (with platform update) and later. If selected during
+ configuration, the engine will be selected only when the hinting
+ preference of a font is set to None or Vertical hinting, or
+ when fontengine=directwrite is selected as platform option.
+*/
+
+QWindowsFontEngineDirectWrite::QWindowsFontEngineDirectWrite(IDWriteFontFace *directWriteFontFace,
+ qreal pixelSize,
+ const QSharedPointer<QWindowsFontEngineData> &d)
+ : QFontEngine(DirectWrite)
+ , m_fontEngineData(d)
+ , m_directWriteFontFace(directWriteFontFace)
+ , m_directWriteBitmapRenderTarget(0)
+ , m_lineThickness(-1)
+ , m_unitsPerEm(-1)
+ , m_capHeight(-1)
+ , m_xHeight(-1)
+{
+ qCDebug(lcQpaFonts) << __FUNCTION__ << pixelSize;
+
+ Q_ASSERT(m_directWriteFontFace);
+
+ m_fontEngineData->directWriteFactory->AddRef();
+ m_directWriteFontFace->AddRef();
+
+ fontDef.pixelSize = pixelSize;
+ collectMetrics();
+ cache_cost = m_xHeight.toInt() * m_xHeight.toInt() * 2000;
+}
+
+QWindowsFontEngineDirectWrite::~QWindowsFontEngineDirectWrite()
+{
+ qCDebug(lcQpaFonts) << __FUNCTION__;
+
+ m_fontEngineData->directWriteFactory->Release();
+ m_directWriteFontFace->Release();
+
+ if (m_directWriteBitmapRenderTarget != 0)
+ m_directWriteBitmapRenderTarget->Release();
+
+ if (!m_uniqueFamilyName.isEmpty()) {
+ QPlatformFontDatabase *pfdb = QGuiApplicationPrivate::platformIntegration()->fontDatabase();
+ static_cast<QWindowsFontDatabase *>(pfdb)->derefUniqueFont(m_uniqueFamilyName);
+ }
+}
+
+#ifndef Q_CC_MINGW
+typedef IDWriteLocalFontFileLoader QIdWriteLocalFontFileLoader;
+
+static UUID uuidIdWriteLocalFontFileLoader()
+{
+ return __uuidof(IDWriteLocalFontFileLoader);
+}
+#else // !Q_CC_MINGW
+DECLARE_INTERFACE_(QIdWriteLocalFontFileLoader, IDWriteFontFileLoader)
+{
+ STDMETHOD(GetFilePathLengthFromKey)(THIS_ void const *, UINT32, UINT32*) PURE;
+ STDMETHOD(GetFilePathFromKey)(THIS_ void const *, UINT32, WCHAR *, UINT32) PURE;
+ STDMETHOD(GetLastWriteTimeFromKey)(THIS_ void const *, UINT32, FILETIME *) PURE;
+};
+
+static UUID uuidIdWriteLocalFontFileLoader()
+{
+ static const UUID result = { 0xb2d9f3ec, 0xc9fe, 0x4a11, {0xa2, 0xec, 0xd8, 0x62, 0x8, 0xf7, 0xc0, 0xa2}};
+ return result;
+}
+#endif // Q_CC_MINGW
+
+QString QWindowsFontEngineDirectWrite::filenameFromFontFile(IDWriteFontFile *fontFile)
+{
+ IDWriteFontFileLoader *loader = nullptr;
+
+ HRESULT hr = fontFile->GetLoader(&loader);
+ if (FAILED(hr)) {
+ qErrnoWarning("%s: GetLoader failed", __FUNCTION__);
+ return QString();
+ }
+
+ QIdWriteLocalFontFileLoader *localLoader = nullptr;
+ hr = loader->QueryInterface(uuidIdWriteLocalFontFileLoader(),
+ reinterpret_cast<void **>(&localLoader));
+
+ const void *fontFileReferenceKey = nullptr;
+ UINT32 fontFileReferenceKeySize = 0;
+ if (SUCCEEDED(hr)) {
+ hr = fontFile->GetReferenceKey(&fontFileReferenceKey,
+ &fontFileReferenceKeySize);
+ if (FAILED(hr))
+ qErrnoWarning(hr, "%s: GetReferenceKey failed", __FUNCTION__);
+ }
+
+ UINT32 filePathLength = 0;
+ if (SUCCEEDED(hr)) {
+ hr = localLoader->GetFilePathLengthFromKey(fontFileReferenceKey,
+ fontFileReferenceKeySize,
+ &filePathLength);
+ if (FAILED(hr))
+ qErrnoWarning(hr, "GetFilePathLength failed", __FUNCTION__);
+ }
+
+ QString ret;
+ if (SUCCEEDED(hr) && filePathLength > 0) {
+ QVarLengthArray<wchar_t> filePath(filePathLength + 1);
+
+ hr = localLoader->GetFilePathFromKey(fontFileReferenceKey,
+ fontFileReferenceKeySize,
+ filePath.data(),
+ filePathLength + 1);
+ if (FAILED(hr))
+ qErrnoWarning(hr, "%s: GetFilePathFromKey failed", __FUNCTION__);
+ else
+ ret = QString::fromWCharArray(filePath.data());
+ }
+
+ if (localLoader != nullptr)
+ localLoader->Release();
+
+ if (loader != nullptr)
+ loader->Release();
+ return ret;
+}
+
+HFONT QWindowsFontEngineDirectWrite::createHFONT() const
+{
+ if (m_fontEngineData == nullptr || m_directWriteFontFace == nullptr)
+ return NULL;
+
+ LOGFONT lf;
+ HRESULT hr = m_fontEngineData->directWriteGdiInterop->ConvertFontFaceToLOGFONT(m_directWriteFontFace,
+ &lf);
+ if (SUCCEEDED(hr)) {
+ lf.lfHeight = -qRound(fontDef.pixelSize);
+ return CreateFontIndirect(&lf);
+ } else {
+ return NULL;
+ }
+}
+
+void QWindowsFontEngineDirectWrite::initializeHeightMetrics() const
+{
+ DWRITE_FONT_METRICS metrics;
+ m_directWriteFontFace->GetMetrics(&metrics);
+
+ m_ascent = DESIGN_TO_LOGICAL(metrics.ascent);
+ m_descent = DESIGN_TO_LOGICAL(metrics.descent);
+ m_leading = DESIGN_TO_LOGICAL(metrics.lineGap);
+
+ QFontEngine::initializeHeightMetrics();
+}
+
+void QWindowsFontEngineDirectWrite::collectMetrics()
+{
+ DWRITE_FONT_METRICS metrics;
+
+ m_directWriteFontFace->GetMetrics(&metrics);
+ m_unitsPerEm = metrics.designUnitsPerEm;
+
+ m_lineThickness = DESIGN_TO_LOGICAL(metrics.underlineThickness);
+ m_capHeight = DESIGN_TO_LOGICAL(metrics.capHeight);
+ m_xHeight = DESIGN_TO_LOGICAL(metrics.xHeight);
+ m_underlinePosition = DESIGN_TO_LOGICAL(metrics.underlinePosition);
+
+ IDWriteFontFile *fontFile = nullptr;
+ UINT32 numberOfFiles = 1;
+ if (SUCCEEDED(m_directWriteFontFace->GetFiles(&numberOfFiles, &fontFile))) {
+ m_faceId.filename = QFile::encodeName(filenameFromFontFile(fontFile));
+ fontFile->Release();
+ }
+
+ QByteArray table = getSfntTable(QFont::Tag("hhea").value());
+ const int advanceWidthMaxLocation = 10;
+ if (table.size() >= advanceWidthMaxLocation + int(sizeof(quint16))) {
+ quint16 advanceWidthMax = qFromBigEndian<quint16>(table.constData() + advanceWidthMaxLocation);
+ m_maxAdvanceWidth = DESIGN_TO_LOGICAL(advanceWidthMax);
+ }
+
+ loadKerningPairs(emSquareSize() / QFixed::fromReal(fontDef.pixelSize));
+}
+
+QFixed QWindowsFontEngineDirectWrite::underlinePosition() const
+{
+ if (m_underlinePosition > 0)
+ return m_underlinePosition;
+ else
+ return QFontEngine::underlinePosition();
+}
+
+QFixed QWindowsFontEngineDirectWrite::lineThickness() const
+{
+ if (m_lineThickness > 0)
+ return m_lineThickness;
+ else
+ return QFontEngine::lineThickness();
+}
+
+bool QWindowsFontEngineDirectWrite::getSfntTableData(uint tag, uchar *buffer, uint *length) const
+{
+ bool ret = false;
+
+ const void *tableData = 0;
+ UINT32 tableSize;
+ void *tableContext = 0;
+ BOOL exists;
+ HRESULT hr = m_directWriteFontFace->TryGetFontTable(qbswap<quint32>(tag),
+ &tableData, &tableSize,
+ &tableContext, &exists);
+ if (SUCCEEDED(hr)) {
+ if (exists) {
+ ret = true;
+ if (buffer && *length >= tableSize)
+ memcpy(buffer, tableData, tableSize);
+ *length = tableSize;
+ Q_ASSERT(int(*length) > 0);
+ }
+ m_directWriteFontFace->ReleaseFontTable(tableContext);
+ } else {
+ qErrnoWarning("%s: TryGetFontTable failed", __FUNCTION__);
+ }
+
+ return ret;
+}
+
+QFixed QWindowsFontEngineDirectWrite::emSquareSize() const
+{
+ if (m_unitsPerEm > 0)
+ return m_unitsPerEm;
+ else
+ return QFontEngine::emSquareSize();
+}
+
+glyph_t QWindowsFontEngineDirectWrite::glyphIndex(uint ucs4) const
+{
+ UINT16 glyphIndex;
+
+ HRESULT hr = m_directWriteFontFace->GetGlyphIndicesW(&ucs4, 1, &glyphIndex);
+ if (FAILED(hr)) {
+ qErrnoWarning("%s: glyphIndex failed", __FUNCTION__);
+ glyphIndex = 0;
+ }
+
+ return glyphIndex;
+}
+
+int QWindowsFontEngineDirectWrite::stringToCMap(const QChar *str, int len, QGlyphLayout *glyphs,
+ int *nglyphs, QFontEngine::ShaperFlags flags) const
+{
+ Q_ASSERT(glyphs->numGlyphs >= *nglyphs);
+ if (*nglyphs < len) {
+ *nglyphs = len;
+ return -1;
+ }
+
+ QVarLengthArray<UINT32> codePoints(len);
+ int actualLength = 0;
+ QStringIterator it(str, str + len);
+ while (it.hasNext())
+ codePoints[actualLength++] = it.next();
+
+ QVarLengthArray<UINT16> glyphIndices(actualLength);
+ HRESULT hr = m_directWriteFontFace->GetGlyphIndicesW(codePoints.data(), actualLength,
+ glyphIndices.data());
+ if (FAILED(hr)) {
+ qErrnoWarning("%s: GetGlyphIndicesW failed", __FUNCTION__);
+ return -1;
+ }
+
+ int mappedGlyphs = 0;
+ for (int i = 0; i < actualLength; ++i) {
+ glyphs->glyphs[i] = glyphIndices.at(i);
+ if (glyphs->glyphs[i] != 0 || isIgnorableChar(codePoints.at(i)))
+ mappedGlyphs++;
+ }
+
+ *nglyphs = actualLength;
+ glyphs->numGlyphs = actualLength;
+
+ if (!(flags & GlyphIndicesOnly))
+ recalcAdvances(glyphs, {});
+
+ return mappedGlyphs;
+}
+
+QFontEngine::FaceId QWindowsFontEngineDirectWrite::faceId() const
+{
+ return m_faceId;
+}
+
+void QWindowsFontEngineDirectWrite::recalcAdvances(QGlyphLayout *glyphs, QFontEngine::ShaperFlags shaperFlags) const
+{
+ QVarLengthArray<UINT16> glyphIndices(glyphs->numGlyphs);
+
+ // ### Caching?
+ for(int i=0; i<glyphs->numGlyphs; i++)
+ glyphIndices[i] = UINT16(glyphs->glyphs[i]);
+
+ QVarLengthArray<DWRITE_GLYPH_METRICS> glyphMetrics(glyphIndices.size());
+
+ HRESULT hr;
+ DWRITE_RENDERING_MODE renderMode = hintingPreferenceToRenderingMode(fontDef);
+ bool needsDesignMetrics = shaperFlags & QFontEngine::DesignMetrics;
+ if (!needsDesignMetrics && (renderMode == DWRITE_RENDERING_MODE_GDI_CLASSIC
+ || renderMode == DWRITE_RENDERING_MODE_GDI_NATURAL
+ || renderMode == DWRITE_RENDERING_MODE_ALIASED)) {
+ hr = m_directWriteFontFace->GetGdiCompatibleGlyphMetrics(float(fontDef.pixelSize),
+ 1.0f,
+ NULL,
+ renderMode == DWRITE_RENDERING_MODE_GDI_NATURAL,
+ glyphIndices.data(),
+ glyphIndices.size(),
+ glyphMetrics.data());
+ } else {
+ hr = m_directWriteFontFace->GetDesignGlyphMetrics(glyphIndices.data(),
+ glyphIndices.size(),
+ glyphMetrics.data());
+ }
+ if (SUCCEEDED(hr)) {
+ qreal stretch = fontDef.stretch != QFont::AnyStretch ? fontDef.stretch / 100.0 : 1.0;
+ for (int i = 0; i < glyphs->numGlyphs; ++i)
+ glyphs->advances[i] = DESIGN_TO_LOGICAL(glyphMetrics[i].advanceWidth * stretch);
+ } else {
+ qErrnoWarning("%s: GetDesignGlyphMetrics failed", __FUNCTION__);
+ }
+}
+
+void QWindowsFontEngineDirectWrite::getUnscaledGlyph(glyph_t glyph,
+ QPainterPath *path,
+ glyph_metrics_t *metric)
+{
+ float advance = 0.0f;
+ UINT16 g = glyph;
+ DWRITE_GLYPH_OFFSET offset;
+ offset.advanceOffset = 0;
+ offset.ascenderOffset = 0;
+ GeometrySink geometrySink(path);
+ HRESULT hr = m_directWriteFontFace->GetGlyphRunOutline(m_unitsPerEm,
+ &g,
+ &advance,
+ &offset,
+ 1,
+ false,
+ false,
+ &geometrySink);
+ if (FAILED(hr)) {
+ qErrnoWarning("%s: GetGlyphRunOutline failed", __FUNCTION__);
+ return;
+ }
+
+ DWRITE_GLYPH_METRICS glyphMetrics;
+ hr = m_directWriteFontFace->GetDesignGlyphMetrics(&g, 1, &glyphMetrics);
+ if (FAILED(hr)) {
+ qErrnoWarning("%s: GetDesignGlyphMetrics failed", __FUNCTION__);
+ return;
+ }
+
+ QFixed advanceWidth = QFixed(int(glyphMetrics.advanceWidth));
+ QFixed leftSideBearing = QFixed(glyphMetrics.leftSideBearing);
+ QFixed rightSideBearing = QFixed(glyphMetrics.rightSideBearing);
+ QFixed advanceHeight = QFixed(int(glyphMetrics.advanceHeight));
+ QFixed verticalOriginY = QFixed(glyphMetrics.verticalOriginY);
+ QFixed topSideBearing = QFixed(glyphMetrics.topSideBearing);
+ QFixed bottomSideBearing = QFixed(glyphMetrics.bottomSideBearing);
+ QFixed width = advanceWidth - leftSideBearing - rightSideBearing;
+ QFixed height = advanceHeight - topSideBearing - bottomSideBearing;
+ *metric = glyph_metrics_t(leftSideBearing,
+ -verticalOriginY + topSideBearing,
+ width,
+ height,
+ advanceWidth,
+ 0);
+}
+
+void QWindowsFontEngineDirectWrite::addGlyphsToPath(glyph_t *glyphs, QFixedPoint *positions, int nglyphs,
+ QPainterPath *path, QTextItem::RenderFlags flags)
+{
+ Q_UNUSED(flags);
+ QVarLengthArray<UINT16> glyphIndices(nglyphs);
+ QVarLengthArray<DWRITE_GLYPH_OFFSET> glyphOffsets(nglyphs);
+ QVarLengthArray<FLOAT> glyphAdvances(nglyphs);
+
+ for (int i=0; i<nglyphs; ++i) {
+ glyphIndices[i] = glyphs[i];
+ glyphOffsets[i].advanceOffset = positions[i].x.toReal();
+ glyphOffsets[i].ascenderOffset = -positions[i].y.toReal();
+ glyphAdvances[i] = 0.0;
+ }
+
+ GeometrySink geometrySink(path);
+ HRESULT hr = m_directWriteFontFace->GetGlyphRunOutline(
+ fontDef.pixelSize,
+ glyphIndices.data(),
+ glyphAdvances.data(),
+ glyphOffsets.data(),
+ nglyphs,
+ false,
+ false,
+ &geometrySink
+ );
+
+ if (FAILED(hr))
+ qErrnoWarning("%s: GetGlyphRunOutline failed", __FUNCTION__);
+}
+
+glyph_metrics_t QWindowsFontEngineDirectWrite::boundingBox(const QGlyphLayout &glyphs)
+{
+ if (glyphs.numGlyphs == 0)
+ return glyph_metrics_t();
+ QFixed w = 0;
+ for (int i = 0; i < glyphs.numGlyphs; ++i)
+ w += glyphs.effectiveAdvance(i);
+
+ const QFixed leftBearing = firstLeftBearing(glyphs);
+ return glyph_metrics_t(leftBearing, -ascent(), w - leftBearing - lastRightBearing(glyphs),
+ ascent() + descent(), w, 0);
+}
+
+glyph_metrics_t QWindowsFontEngineDirectWrite::boundingBox(glyph_t g)
+{
+ UINT16 glyphIndex = g;
+
+ DWRITE_GLYPH_METRICS glyphMetrics;
+ HRESULT hr = m_directWriteFontFace->GetDesignGlyphMetrics(&glyphIndex, 1, &glyphMetrics);
+ if (SUCCEEDED(hr)) {
+ QFixed advanceWidth = DESIGN_TO_LOGICAL(glyphMetrics.advanceWidth);
+ QFixed leftSideBearing = DESIGN_TO_LOGICAL(glyphMetrics.leftSideBearing);
+ QFixed rightSideBearing = DESIGN_TO_LOGICAL(glyphMetrics.rightSideBearing);
+ QFixed advanceHeight = DESIGN_TO_LOGICAL(glyphMetrics.advanceHeight);
+ QFixed verticalOriginY = DESIGN_TO_LOGICAL(glyphMetrics.verticalOriginY);
+ QFixed topSideBearing = DESIGN_TO_LOGICAL(glyphMetrics.topSideBearing);
+ QFixed bottomSideBearing = DESIGN_TO_LOGICAL(glyphMetrics.bottomSideBearing);
+ QFixed width = advanceWidth - leftSideBearing - rightSideBearing;
+ QFixed height = advanceHeight - topSideBearing - bottomSideBearing;
+ return glyph_metrics_t(leftSideBearing,
+ -verticalOriginY + topSideBearing,
+ width,
+ height,
+ advanceWidth,
+ 0);
+ } else {
+ qErrnoWarning("%s: GetDesignGlyphMetrics failed", __FUNCTION__);
+ }
+
+ return glyph_metrics_t();
+}
+
+QFixed QWindowsFontEngineDirectWrite::capHeight() const
+{
+ if (m_capHeight <= 0)
+ return calculatedCapHeight();
+
+ return m_capHeight;
+}
+
+QFixed QWindowsFontEngineDirectWrite::xHeight() const
+{
+ return m_xHeight;
+}
+
+qreal QWindowsFontEngineDirectWrite::maxCharWidth() const
+{
+ return m_maxAdvanceWidth.toReal();
+}
+
+QImage QWindowsFontEngineDirectWrite::alphaMapForGlyph(glyph_t glyph,
+ const QFixedPoint &subPixelPosition,
+ const QTransform &t)
+{
+ QImage im = imageForGlyph(glyph, subPixelPosition, glyphMargin(Format_A8), t);
+
+ QImage alphaMap(im.width(), im.height(), QImage::Format_Alpha8);
+
+ for (int y=0; y<im.height(); ++y) {
+ const uint *src = reinterpret_cast<const uint *>(im.constScanLine(y));
+ uchar *dst = alphaMap.scanLine(y);
+ for (int x=0; x<im.width(); ++x) {
+ *dst = 255 - (m_fontEngineData->pow_gamma[qGray(0xffffffff - *src)] * 255. / 2047.);
+ ++dst;
+ ++src;
+ }
+ }
+
+ return alphaMap;
+}
+
+QImage QWindowsFontEngineDirectWrite::alphaMapForGlyph(glyph_t glyph,
+ const QFixedPoint &subPixelPosition)
+{
+ return alphaMapForGlyph(glyph, subPixelPosition, QTransform());
+}
+
+bool QWindowsFontEngineDirectWrite::supportsHorizontalSubPixelPositions() const
+{
+ DWRITE_RENDERING_MODE renderMode = hintingPreferenceToRenderingMode(fontDef);
+ return (renderMode != DWRITE_RENDERING_MODE_GDI_CLASSIC
+ && renderMode != DWRITE_RENDERING_MODE_GDI_NATURAL
+ && renderMode != DWRITE_RENDERING_MODE_ALIASED);
+}
+
+QFontEngine::Properties QWindowsFontEngineDirectWrite::properties() const
+{
+ IDWriteFontFace2 *directWriteFontFace2;
+ if (SUCCEEDED(m_directWriteFontFace->QueryInterface(__uuidof(IDWriteFontFace2),
+ reinterpret_cast<void **>(&directWriteFontFace2)))) {
+ DWRITE_FONT_METRICS1 metrics;
+ directWriteFontFace2->GetMetrics(&metrics);
+
+ Properties p = QFontEngine::properties();
+ p.emSquare = metrics.designUnitsPerEm;
+ p.boundingBox = QRectF(metrics.glyphBoxLeft,
+ -metrics.glyphBoxTop,
+ metrics.glyphBoxRight - metrics.glyphBoxLeft,
+ metrics.glyphBoxTop - metrics.glyphBoxBottom);
+ p.ascent = metrics.ascent;
+ p.descent = metrics.descent;
+ p.leading = metrics.lineGap;
+ p.capHeight = metrics.capHeight;
+ p.lineWidth = metrics.underlineThickness;
+
+ directWriteFontFace2->Release();
+ return p;
+ } else {
+ return QFontEngine::properties();
+ }
+}
+
+QImage QWindowsFontEngineDirectWrite::imageForGlyph(glyph_t t,
+ const QFixedPoint &subPixelPosition,
+ int margin,
+ const QTransform &originalTransform,
+ const QColor &color)
+{
+ UINT16 glyphIndex = t;
+ FLOAT glyphAdvance = 0;
+
+ DWRITE_GLYPH_OFFSET glyphOffset;
+ glyphOffset.advanceOffset = 0;
+ glyphOffset.ascenderOffset = 0;
+
+ DWRITE_GLYPH_RUN glyphRun;
+ glyphRun.fontFace = m_directWriteFontFace;
+ glyphRun.fontEmSize = fontDef.pixelSize;
+ glyphRun.glyphCount = 1;
+ glyphRun.glyphIndices = &glyphIndex;
+ glyphRun.glyphAdvances = &glyphAdvance;
+ glyphRun.isSideways = false;
+ glyphRun.bidiLevel = 0;
+ glyphRun.glyphOffsets = &glyphOffset;
+
+ QTransform xform = originalTransform;
+ if (fontDef.stretch != 100 && fontDef.stretch != QFont::AnyStretch)
+ xform.scale(fontDef.stretch / 100.0, 1.0);
+
+ DWRITE_MATRIX transform;
+ transform.dx = subPixelPosition.x.toReal();
+ transform.dy = 0;
+ transform.m11 = xform.m11();
+ transform.m12 = xform.m12();
+ transform.m21 = xform.m21();
+ transform.m22 = xform.m22();
+
+ DWRITE_RENDERING_MODE renderMode = hintingPreferenceToRenderingMode(fontDef);
+ DWRITE_MEASURING_MODE measureMode =
+ renderModeToMeasureMode(renderMode);
+
+ DWRITE_GRID_FIT_MODE gridFitMode = fontDef.hintingPreference == QFont::PreferNoHinting
+ ? DWRITE_GRID_FIT_MODE_DISABLED
+ : DWRITE_GRID_FIT_MODE_DEFAULT;
+
+ IDWriteFactory2 *factory2 = nullptr;
+ HRESULT hr = m_fontEngineData->directWriteFactory->QueryInterface(__uuidof(IDWriteFactory2),
+ reinterpret_cast<void **>(&factory2));
+ IDWriteGlyphRunAnalysis *glyphAnalysis = NULL;
+ if (!SUCCEEDED(hr)) {
+ qErrnoWarning(hr, "%s: Failed to query IDWriteFactory2 interface.", __FUNCTION__);
+ hr = m_fontEngineData->directWriteFactory->CreateGlyphRunAnalysis(
+ &glyphRun,
+ 1.0f,
+ &transform,
+ renderMode,
+ measureMode,
+ 0.0, 0.0,
+ &glyphAnalysis
+ );
+ } else {
+ hr = factory2->CreateGlyphRunAnalysis(
+ &glyphRun,
+ &transform,
+ renderMode,
+ measureMode,
+ gridFitMode,
+ DWRITE_TEXT_ANTIALIAS_MODE_CLEARTYPE,
+ 0.0, 0.0,
+ &glyphAnalysis
+ );
+ }
+
+ if (SUCCEEDED(hr)) {
+ RECT rect;
+ glyphAnalysis->GetAlphaTextureBounds(renderMode == DWRITE_RENDERING_MODE_ALIASED
+ ? DWRITE_TEXTURE_ALIASED_1x1
+ : DWRITE_TEXTURE_CLEARTYPE_3x1,
+ &rect);
+
+ if (rect.top == rect.bottom || rect.left == rect.right)
+ return QImage();
+
+ QRect boundingRect = QRect(QPoint(rect.left - margin,
+ rect.top - margin),
+ QPoint(rect.right + margin,
+ rect.bottom + margin));
+
+
+ const int width = boundingRect.width() - 1; // -1 due to Qt's off-by-one definition of a QRect
+ const int height = boundingRect.height() - 1;
+
+ QImage image;
+ HRESULT hr = DWRITE_E_NOCOLOR;
+ IDWriteColorGlyphRunEnumerator *enumerator = 0;
+ if (glyphFormat == QFontEngine::Format_ARGB && factory2 != nullptr) {
+ hr = factory2->TranslateColorGlyphRun(0.0f,
+ 0.0f,
+ &glyphRun,
+ NULL,
+ measureMode,
+ NULL,
+ 0,
+ &enumerator);
+ image = QImage(width, height, QImage::Format_ARGB32_Premultiplied);
+ image.fill(0);
+ } else {
+ image = QImage(width, height, QImage::Format_RGB32);
+ image.fill(0xffffffff);
+ }
+
+ BOOL ok = true;
+
+ if (SUCCEEDED(hr)) {
+ while (SUCCEEDED(hr) && ok) {
+ const DWRITE_COLOR_GLYPH_RUN *colorGlyphRun = 0;
+ hr = enumerator->GetCurrentRun(&colorGlyphRun);
+ if (FAILED(hr)) { // No colored runs, only outline
+ qErrnoWarning(hr, "%s: IDWriteColorGlyphRunEnumerator::GetCurrentRun failed", __FUNCTION__);
+ break;
+ }
+
+ IDWriteGlyphRunAnalysis *colorGlyphsAnalysis = NULL;
+ hr = factory2->CreateGlyphRunAnalysis(
+ &colorGlyphRun->glyphRun,
+ &transform,
+ renderMode,
+ measureMode,
+ gridFitMode,
+ DWRITE_TEXT_ANTIALIAS_MODE_CLEARTYPE,
+ 0.0, 0.0,
+ &colorGlyphsAnalysis
+ );
+
+ if (FAILED(hr)) {
+ qErrnoWarning(hr, "%s: CreateGlyphRunAnalysis failed for color run", __FUNCTION__);
+ break;
+ }
+
+ float r, g, b, a;
+ if (colorGlyphRun->paletteIndex == 0xFFFF) {
+ r = float(color.redF());
+ g = float(color.greenF());
+ b = float(color.blueF());
+ a = float(color.alphaF());
+ } else {
+ r = qBound(0.0f, colorGlyphRun->runColor.r, 1.0f);
+ g = qBound(0.0f, colorGlyphRun->runColor.g, 1.0f);
+ b = qBound(0.0f, colorGlyphRun->runColor.b, 1.0f);
+ a = qBound(0.0f, colorGlyphRun->runColor.a, 1.0f);
+ }
+
+ if (!qFuzzyIsNull(a)) {
+ renderGlyphRun(&image,
+ r,
+ g,
+ b,
+ a,
+ colorGlyphsAnalysis,
+ boundingRect,
+ renderMode);
+ }
+ colorGlyphsAnalysis->Release();
+
+ hr = enumerator->MoveNext(&ok);
+ if (FAILED(hr)) {
+ qErrnoWarning(hr, "%s: IDWriteColorGlyphRunEnumerator::MoveNext failed", __FUNCTION__);
+ break;
+ }
+ }
+ } else {
+ float r, g, b, a;
+ if (glyphFormat == QFontEngine::Format_ARGB) {
+ r = float(color.redF());
+ g = float(color.greenF());
+ b = float(color.blueF());
+ a = float(color.alphaF());
+ } else {
+ r = g = b = a = 0.0;
+ }
+
+ renderGlyphRun(&image,
+ r,
+ g,
+ b,
+ a,
+ glyphAnalysis,
+ boundingRect,
+ renderMode);
+ }
+
+ glyphAnalysis->Release();
+ return image;
+ } else {
+ qErrnoWarning(hr, "%s: CreateGlyphRunAnalysis failed", __FUNCTION__);
+ return QImage();
+ }
+}
+
+
+void QWindowsFontEngineDirectWrite::renderGlyphRun(QImage *destination,
+ float r,
+ float g,
+ float b,
+ float a,
+ IDWriteGlyphRunAnalysis *glyphAnalysis,
+ const QRect &boundingRect,
+ DWRITE_RENDERING_MODE renderMode)
+{
+ const int width = destination->width();
+ const int height = destination->height();
+
+ r *= 255.0;
+ g *= 255.0;
+ b *= 255.0;
+
+ const int size = width * height * 3;
+ if (size > 0) {
+ RECT rect;
+ rect.left = boundingRect.left();
+ rect.top = boundingRect.top();
+ rect.right = boundingRect.right();
+ rect.bottom = boundingRect.bottom();
+
+ QVarLengthArray<BYTE, 1024> alphaValueArray(size);
+ BYTE *alphaValues = alphaValueArray.data();
+ memset(alphaValues, 0, size);
+
+ HRESULT hr = glyphAnalysis->CreateAlphaTexture(renderMode == DWRITE_RENDERING_MODE_ALIASED
+ ? DWRITE_TEXTURE_ALIASED_1x1
+ : DWRITE_TEXTURE_CLEARTYPE_3x1,
+ &rect,
+ alphaValues,
+ size);
+ if (SUCCEEDED(hr)) {
+ if (destination->hasAlphaChannel()) { // Color glyphs
+ for (int y = 0; y < height; ++y) {
+ uint *dest = reinterpret_cast<uint *>(destination->scanLine(y));
+ BYTE *src = alphaValues + width * 3 * y;
+
+ for (int x = 0; x < width; ++x) {
+ float redAlpha = a * *src++ / 255.0;
+ float greenAlpha = a * *src++ / 255.0;
+ float blueAlpha = a * *src++ / 255.0;
+ float averageAlpha = (redAlpha + greenAlpha + blueAlpha) / 3.0;
+
+ QRgb currentRgb = dest[x];
+ dest[x] = qRgba(qRound(qRed(currentRgb) * (1.0 - averageAlpha) + averageAlpha * r),
+ qRound(qGreen(currentRgb) * (1.0 - averageAlpha) + averageAlpha * g),
+ qRound(qBlue(currentRgb) * (1.0 - averageAlpha) + averageAlpha * b),
+ qRound(qAlpha(currentRgb) * (1.0 - averageAlpha) + averageAlpha * 255));
+ }
+ }
+ } else if (renderMode == DWRITE_RENDERING_MODE_ALIASED) {
+ for (int y = 0; y < height; ++y) {
+ uint *dest = reinterpret_cast<uint *>(destination->scanLine(y));
+ BYTE *src = alphaValues + width * y;
+
+ for (int x = 0; x < width; ++x) {
+ int alpha = *(src++);
+ dest[x] = (alpha << 16) + (alpha << 8) + alpha;
+ }
+ }
+ } else {
+ for (int y = 0; y < height; ++y) {
+ uint *dest = reinterpret_cast<uint *>(destination->scanLine(y));
+ BYTE *src = alphaValues + width * 3 * y;
+
+ for (int x = 0; x < width; ++x) {
+ dest[x] = *(src + 0) << 16
+ | *(src + 1) << 8
+ | *(src + 2);
+
+ src += 3;
+ }
+ }
+ }
+ } else {
+ qErrnoWarning("%s: CreateAlphaTexture failed", __FUNCTION__);
+ }
+ } else {
+ glyphAnalysis->Release();
+ qWarning("%s: Glyph has no bounds", __FUNCTION__);
+ }
+}
+
+QImage QWindowsFontEngineDirectWrite::alphaRGBMapForGlyph(glyph_t t,
+ const QFixedPoint &subPixelPosition,
+ const QTransform &xform)
+{
+ QImage mask = imageForGlyph(t,
+ subPixelPosition,
+ glyphMargin(QFontEngine::Format_A32),
+ xform);
+
+ return mask.depth() == 32
+ ? mask
+ : mask.convertToFormat(QImage::Format_RGB32);
+}
+
+QFontEngine *QWindowsFontEngineDirectWrite::cloneWithSize(qreal pixelSize) const
+{
+ QWindowsFontEngineDirectWrite *fontEngine = new QWindowsFontEngineDirectWrite(m_directWriteFontFace,
+ pixelSize,
+ m_fontEngineData);
+
+ fontEngine->fontDef = fontDef;
+ fontEngine->fontDef.pixelSize = pixelSize;
+ if (!m_uniqueFamilyName.isEmpty()) {
+ fontEngine->setUniqueFamilyName(m_uniqueFamilyName);
+ QPlatformFontDatabase *pfdb = QGuiApplicationPrivate::platformIntegration()->fontDatabase();
+ static_cast<QWindowsFontDatabase *>(pfdb)->refUniqueFont(m_uniqueFamilyName);
+ }
+
+ return fontEngine;
+}
+
+Qt::HANDLE QWindowsFontEngineDirectWrite::handle() const
+{
+ return m_directWriteFontFace;
+}
+
+void QWindowsFontEngineDirectWrite::initFontInfo(const QFontDef &request,
+ int dpi)
+{
+ fontDef = request;
+
+ if (fontDef.pointSize < 0)
+ fontDef.pointSize = fontDef.pixelSize * 72. / dpi;
+ else if (fontDef.pixelSize == -1)
+ fontDef.pixelSize = qRound(fontDef.pointSize * dpi / 72.);
+
+ m_faceId.variableAxes = request.variableAxisValues;
+
+#if QT_CONFIG(directwrite3)
+ IDWriteFontFace3 *face3 = nullptr;
+ if (SUCCEEDED(m_directWriteFontFace->QueryInterface(__uuidof(IDWriteFontFace3),
+ reinterpret_cast<void **>(&face3)))) {
+ IDWriteLocalizedStrings *names;
+ if (SUCCEEDED(face3->GetFaceNames(&names))) {
+ wchar_t englishLocale[] = L"en-us";
+ fontDef.styleName = QWindowsDirectWriteFontDatabase::localeString(names, englishLocale);
+ names->Release();
+ }
+
+ // Color font
+ if (face3->GetPaletteEntryCount() > 0)
+ glyphFormat = QFontEngine::Format_ARGB;
+
+ face3->Release();
+ }
+#endif
+}
+
+QString QWindowsFontEngineDirectWrite::fontNameSubstitute(const QString &familyName)
+{
+ const QString substitute =
+ QWinRegistryKey(HKEY_LOCAL_MACHINE,
+ LR"(Software\Microsoft\Windows NT\CurrentVersion\FontSubstitutes)")
+ .stringValue(familyName);
+ return substitute.isEmpty() ? familyName : substitute;
+}
+
+glyph_metrics_t QWindowsFontEngineDirectWrite::alphaMapBoundingBox(glyph_t glyph,
+ const QFixedPoint &subPixelPosition,
+ const QTransform &originalTransform,
+ GlyphFormat format)
+{
+ Q_UNUSED(format);
+
+ QTransform matrix = originalTransform;
+ if (fontDef.stretch != 100 && fontDef.stretch != QFont::AnyStretch)
+ matrix.scale(fontDef.stretch / 100.0, 1.0);
+
+ glyph_metrics_t bbox = QFontEngine::boundingBox(glyph, matrix); // To get transformed advance
+
+ UINT16 glyphIndex = glyph;
+ FLOAT glyphAdvance = 0;
+
+ DWRITE_GLYPH_OFFSET glyphOffset;
+ glyphOffset.advanceOffset = 0;
+ glyphOffset.ascenderOffset = 0;
+
+ DWRITE_GLYPH_RUN glyphRun;
+ glyphRun.fontFace = m_directWriteFontFace;
+ glyphRun.fontEmSize = fontDef.pixelSize;
+ glyphRun.glyphCount = 1;
+ glyphRun.glyphIndices = &glyphIndex;
+ glyphRun.glyphAdvances = &glyphAdvance;
+ glyphRun.isSideways = false;
+ glyphRun.bidiLevel = 0;
+ glyphRun.glyphOffsets = &glyphOffset;
+
+ DWRITE_MATRIX transform;
+ transform.dx = subPixelPosition.x.toReal();
+ transform.dy = 0;
+ transform.m11 = matrix.m11();
+ transform.m12 = matrix.m12();
+ transform.m21 = matrix.m21();
+ transform.m22 = matrix.m22();
+
+ DWRITE_RENDERING_MODE renderMode = hintingPreferenceToRenderingMode(fontDef);
+ DWRITE_MEASURING_MODE measureMode = renderModeToMeasureMode(renderMode);
+ DWRITE_GRID_FIT_MODE gridFitMode = fontDef.hintingPreference == QFont::PreferNoHinting
+ ? DWRITE_GRID_FIT_MODE_DISABLED
+ : DWRITE_GRID_FIT_MODE_DEFAULT;
+
+ IDWriteFactory2 *factory2 = nullptr;
+ HRESULT hr = m_fontEngineData->directWriteFactory->QueryInterface(__uuidof(IDWriteFactory2),
+ reinterpret_cast<void **>(&factory2));
+
+ IDWriteGlyphRunAnalysis *glyphAnalysis = NULL;
+ if (SUCCEEDED(hr)) {
+ hr = factory2->CreateGlyphRunAnalysis(
+ &glyphRun,
+ &transform,
+ renderMode,
+ measureMode,
+ gridFitMode,
+ DWRITE_TEXT_ANTIALIAS_MODE_CLEARTYPE,
+ 0.0, 0.0,
+ &glyphAnalysis
+ );
+ } else {
+ hr = m_fontEngineData->directWriteFactory->CreateGlyphRunAnalysis(
+ &glyphRun,
+ 1.0f,
+ &transform,
+ renderMode,
+ measureMode,
+ 0.0, 0.0,
+ &glyphAnalysis
+ );
+ }
+
+ if (SUCCEEDED(hr)) {
+ RECT rect;
+ glyphAnalysis->GetAlphaTextureBounds(renderMode == DWRITE_RENDERING_MODE_ALIASED ? DWRITE_TEXTURE_ALIASED_1x1 : DWRITE_TEXTURE_CLEARTYPE_3x1, &rect);
+ glyphAnalysis->Release();
+
+ int margin = glyphMargin(format);
+
+ if (rect.left == rect.right || rect.top == rect.bottom)
+ return glyph_metrics_t();
+
+ return glyph_metrics_t(rect.left,
+ rect.top,
+ rect.right - rect.left + margin * 2,
+ rect.bottom - rect.top + margin * 2,
+ bbox.xoff, bbox.yoff);
+ } else {
+ return glyph_metrics_t();
+ }
+}
+
+QImage QWindowsFontEngineDirectWrite::bitmapForGlyph(glyph_t glyph,
+ const QFixedPoint &subPixelPosition,
+ const QTransform &t,
+ const QColor &color)
+{
+ return imageForGlyph(glyph, subPixelPosition, glyphMargin(QFontEngine::Format_ARGB), t, color);
+}
+
+QT_END_NAMESPACE
diff --git a/src/gui/text/windows/qwindowsfontenginedirectwrite_p.h b/src/gui/text/windows/qwindowsfontenginedirectwrite_p.h
new file mode 100644
index 0000000000..d7c9a79267
--- /dev/null
+++ b/src/gui/text/windows/qwindowsfontenginedirectwrite_p.h
@@ -0,0 +1,140 @@
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
+
+#ifndef QWINDOWSFONTENGINEDIRECTWRITE_H
+#define QWINDOWSFONTENGINEDIRECTWRITE_H
+
+//
+// W A R N I N G
+// -------------
+//
+// This file is not part of the Qt API. It exists purely as an
+// implementation detail. This header file may change from version to
+// version without notice, or even be removed.
+//
+// We mean it.
+//
+
+#include <QtGui/qtguiglobal.h>
+#include <QtGui/private/qtgui-config_p.h>
+
+QT_REQUIRE_CONFIG(directwrite);
+
+#include <QtGui/private/qfontengine_p.h>
+#include <QtCore/QSharedPointer>
+#include <dwrite.h>
+
+struct IDWriteFont;
+struct IDWriteFontFace;
+struct IDWriteFontFile;
+struct IDWriteFactory;
+struct IDWriteBitmapRenderTarget;
+struct IDWriteGdiInterop;
+struct IDWriteGlyphRunAnalysis;
+
+QT_BEGIN_NAMESPACE
+
+class QWindowsFontEngineData;
+
+class Q_GUI_EXPORT QWindowsFontEngineDirectWrite : public QFontEngine
+{
+ Q_DISABLE_COPY_MOVE(QWindowsFontEngineDirectWrite)
+public:
+ explicit QWindowsFontEngineDirectWrite(IDWriteFontFace *directWriteFontFace,
+ qreal pixelSize,
+ const QSharedPointer<QWindowsFontEngineData> &d);
+ ~QWindowsFontEngineDirectWrite() override;
+
+ void initFontInfo(const QFontDef &request, int dpi);
+
+ QFixed lineThickness() const override;
+ QFixed underlinePosition() const override;
+ bool getSfntTableData(uint tag, uchar *buffer, uint *length) const override;
+ QFixed emSquareSize() const override;
+
+ glyph_t glyphIndex(uint ucs4) const override;
+ int stringToCMap(const QChar *str, int len, QGlyphLayout *glyphs, int *nglyphs,
+ ShaperFlags flags) const override;
+ void recalcAdvances(QGlyphLayout *glyphs, ShaperFlags) const override;
+
+ void addGlyphsToPath(glyph_t *glyphs, QFixedPoint *positions, int nglyphs,
+ QPainterPath *path, QTextItem::RenderFlags flags) override;
+
+ glyph_metrics_t boundingBox(const QGlyphLayout &glyphs) override;
+ glyph_metrics_t boundingBox(glyph_t g) override;
+ glyph_metrics_t alphaMapBoundingBox(glyph_t glyph, const QFixedPoint&,
+ const QTransform &matrix, GlyphFormat) override;
+
+ QFixed capHeight() const override;
+ QFixed xHeight() const override;
+ qreal maxCharWidth() const override;
+ FaceId faceId() const override;
+
+ bool supportsHorizontalSubPixelPositions() const override;
+
+ HFONT createHFONT() const;
+
+ QImage alphaMapForGlyph(glyph_t glyph, const QFixedPoint &subPixelPosition) override;
+ QImage alphaMapForGlyph(glyph_t glyph,
+ const QFixedPoint &subPixelPosition,
+ const QTransform &t) override;
+ QImage alphaRGBMapForGlyph(glyph_t t,
+ const QFixedPoint &subPixelPosition,
+ const QTransform &xform) override;
+ QImage bitmapForGlyph(glyph_t,
+ const QFixedPoint &subPixelPosition,
+ const QTransform &t,
+ const QColor &color) override;
+
+ QFontEngine *cloneWithSize(qreal pixelSize) const override;
+ Qt::HANDLE handle() const override;
+
+ const QSharedPointer<QWindowsFontEngineData> &fontEngineData() const { return m_fontEngineData; }
+
+ static QString fontNameSubstitute(const QString &familyName);
+
+ IDWriteFontFace *directWriteFontFace() const { return m_directWriteFontFace; }
+
+ void setUniqueFamilyName(const QString &newName) { m_uniqueFamilyName = newName; }
+
+ void initializeHeightMetrics() const override;
+
+ Properties properties() const override;
+ void getUnscaledGlyph(glyph_t glyph, QPainterPath *path, glyph_metrics_t *metrics) override;
+
+private:
+ QImage imageForGlyph(glyph_t t,
+ const QFixedPoint &subPixelPosition,
+ int margin,
+ const QTransform &xform,
+ const QColor &color = QColor());
+ void collectMetrics();
+ void renderGlyphRun(QImage *destination,
+ float r,
+ float g,
+ float b,
+ float a,
+ IDWriteGlyphRunAnalysis *glyphAnalysis,
+ const QRect &boundingRect,
+ DWRITE_RENDERING_MODE renderMode);
+ static QString filenameFromFontFile(IDWriteFontFile *fontFile);
+ DWRITE_RENDERING_MODE hintingPreferenceToRenderingMode(const QFontDef &fontDef) const;
+
+ const QSharedPointer<QWindowsFontEngineData> m_fontEngineData;
+
+ IDWriteFontFace *m_directWriteFontFace;
+ IDWriteBitmapRenderTarget *m_directWriteBitmapRenderTarget;
+
+ QFixed m_lineThickness;
+ QFixed m_underlinePosition;
+ int m_unitsPerEm;
+ QFixed m_capHeight;
+ QFixed m_xHeight;
+ QFixed m_maxAdvanceWidth;
+ FaceId m_faceId;
+ QString m_uniqueFamilyName;
+};
+
+QT_END_NAMESPACE
+
+#endif // QWINDOWSFONTENGINEDIRECTWRITE_H
diff --git a/src/gui/text/windows/qwindowsnativeimage.cpp b/src/gui/text/windows/qwindowsnativeimage.cpp
new file mode 100644
index 0000000000..eca51ccfd4
--- /dev/null
+++ b/src/gui/text/windows/qwindowsnativeimage.cpp
@@ -0,0 +1,122 @@
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
+
+#include "qwindowsnativeimage_p.h"
+
+#include <QtGui/private/qpaintengine_p.h>
+#include <QtGui/private/qpaintengine_raster_p.h>
+
+QT_BEGIN_NAMESPACE
+
+typedef struct {
+ BITMAPINFOHEADER bmiHeader;
+ DWORD redMask;
+ DWORD greenMask;
+ DWORD blueMask;
+} BITMAPINFO_MASK;
+
+/*!
+ \class QWindowsNativeImage
+ \brief Windows Native image
+
+ Note that size can be 0 (widget autotests with zero size), which
+ causes CreateDIBSection() to fail.
+
+ \sa QWindowsBackingStore
+ \internal
+*/
+
+static inline HDC createDC()
+{
+ HDC display_dc = GetDC(0);
+ HDC hdc = CreateCompatibleDC(display_dc);
+ ReleaseDC(0, display_dc);
+ Q_ASSERT(hdc);
+ return hdc;
+}
+
+static inline HBITMAP createDIB(HDC hdc, int width, int height,
+ QImage::Format format,
+ uchar **bitsIn)
+{
+ BITMAPINFO_MASK bmi;
+ memset(&bmi, 0, sizeof(bmi));
+ bmi.bmiHeader.biSize = sizeof(BITMAPINFOHEADER);
+ bmi.bmiHeader.biWidth = width;
+ bmi.bmiHeader.biHeight = -height; // top-down.
+ bmi.bmiHeader.biPlanes = 1;
+ bmi.bmiHeader.biSizeImage = 0;
+
+ if (format == QImage::Format_RGB16) {
+ bmi.bmiHeader.biBitCount = 16;
+ bmi.bmiHeader.biCompression = BI_BITFIELDS;
+ bmi.redMask = 0xF800;
+ bmi.greenMask = 0x07E0;
+ bmi.blueMask = 0x001F;
+ } else {
+ bmi.bmiHeader.biBitCount = 32;
+ bmi.bmiHeader.biCompression = BI_RGB;
+ bmi.redMask = 0;
+ bmi.greenMask = 0;
+ bmi.blueMask = 0;
+ }
+
+ uchar *bits = nullptr;
+ HBITMAP bitmap = CreateDIBSection(hdc, reinterpret_cast<BITMAPINFO *>(&bmi),
+ DIB_RGB_COLORS, reinterpret_cast<void **>(&bits), 0, 0);
+ if (Q_UNLIKELY(!bitmap || !bits)) {
+ qFatal("%s: CreateDIBSection failed (%dx%d, format: %d)", __FUNCTION__,
+ width, height, int(format));
+ }
+
+ *bitsIn = bits;
+ return bitmap;
+}
+
+QWindowsNativeImage::QWindowsNativeImage(int width, int height,
+ QImage::Format format) :
+ m_hdc(createDC())
+{
+ if (width != 0 && height != 0) {
+ uchar *bits;
+ m_bitmap = createDIB(m_hdc, width, height, format, &bits);
+ m_null_bitmap = static_cast<HBITMAP>(SelectObject(m_hdc, m_bitmap));
+ m_image = QImage(bits, width, height, format);
+ Q_ASSERT(m_image.paintEngine()->type() == QPaintEngine::Raster);
+ static_cast<QRasterPaintEngine *>(m_image.paintEngine())->setDC(m_hdc);
+ } else {
+ m_image = QImage(width, height, format);
+ }
+
+ GdiFlush();
+}
+
+QWindowsNativeImage::~QWindowsNativeImage()
+{
+ if (m_hdc) {
+ if (m_bitmap) {
+ if (m_null_bitmap)
+ SelectObject(m_hdc, m_null_bitmap);
+ DeleteObject(m_bitmap);
+ }
+ DeleteDC(m_hdc);
+ }
+}
+
+QImage::Format QWindowsNativeImage::systemFormat()
+{
+ static int depth = -1;
+ if (depth == -1) {
+ if (HDC defaultDC = GetDC(0)) {
+ depth = GetDeviceCaps(defaultDC, BITSPIXEL);
+ ReleaseDC(0, defaultDC);
+ } else {
+ // FIXME Same remark as in QWindowsFontDatabase::defaultVerticalDPI()
+ // BONUS FIXME: Is 32 too generous/optimistic?
+ depth = 32;
+ }
+ }
+ return depth == 16 ? QImage::Format_RGB16 : QImage::Format_RGB32;
+}
+
+QT_END_NAMESPACE
diff --git a/src/gui/text/windows/qwindowsnativeimage_p.h b/src/gui/text/windows/qwindowsnativeimage_p.h
new file mode 100644
index 0000000000..d223aabf45
--- /dev/null
+++ b/src/gui/text/windows/qwindowsnativeimage_p.h
@@ -0,0 +1,54 @@
+// Copyright (C) 2020 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
+
+#ifndef QWINDOWSNATIVEIMAGE_H
+#define QWINDOWSNATIVEIMAGE_H
+
+//
+// W A R N I N G
+// -------------
+//
+// This file is not part of the Qt API. It exists purely as an
+// implementation detail. This header file may change from version to
+// version without notice, or even be removed.
+//
+// We mean it.
+//
+
+#include <QtCore/QtGlobal>
+#include <QtCore/qt_windows.h>
+#include <QtGui/QImage>
+#include <QtCore/private/qglobal_p.h>
+
+QT_BEGIN_NAMESPACE
+
+class Q_GUI_EXPORT QWindowsNativeImage
+{
+ Q_DISABLE_COPY_MOVE(QWindowsNativeImage)
+public:
+ QWindowsNativeImage(int width, int height,
+ QImage::Format format);
+
+ ~QWindowsNativeImage();
+
+ inline int width() const { return m_image.width(); }
+ inline int height() const { return m_image.height(); }
+
+ QImage &image() { return m_image; }
+ const QImage &image() const { return m_image; }
+
+ HDC hdc() const { return m_hdc; }
+
+ static QImage::Format systemFormat();
+
+private:
+ const HDC m_hdc;
+ QImage m_image;
+
+ HBITMAP m_bitmap = 0;
+ HBITMAP m_null_bitmap = 0;
+};
+
+QT_END_NAMESPACE
+
+#endif // QWINDOWSNATIVEIMAGE_H
diff --git a/src/gui/util/qabstractlayoutstyleinfo.cpp b/src/gui/util/qabstractlayoutstyleinfo.cpp
index 40ad51452a..51d569f814 100644
--- a/src/gui/util/qabstractlayoutstyleinfo.cpp
+++ b/src/gui/util/qabstractlayoutstyleinfo.cpp
@@ -1,41 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the QtGui module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#include "qabstractlayoutstyleinfo_p.h"
diff --git a/src/gui/util/qabstractlayoutstyleinfo_p.h b/src/gui/util/qabstractlayoutstyleinfo_p.h
index bf1e1fc852..42578c58ca 100644
--- a/src/gui/util/qabstractlayoutstyleinfo_p.h
+++ b/src/gui/util/qabstractlayoutstyleinfo_p.h
@@ -1,41 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the QtGui module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#ifndef QABSTRACTLAYOUTSTYLEINFO_P_H
#define QABSTRACTLAYOUTSTYLEINFO_P_H
diff --git a/src/gui/util/qastchandler.cpp b/src/gui/util/qastchandler.cpp
index 6d163c6701..ec8b92f557 100644
--- a/src/gui/util/qastchandler.cpp
+++ b/src/gui/util/qastchandler.cpp
@@ -1,41 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2019 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the QtGui module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2019 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#include "qastchandler_p.h"
#include "qtexturefiledata_p.h"
@@ -59,9 +23,11 @@ struct AstcHeader
quint8 zSize[3];
};
+QAstcHandler::~QAstcHandler() = default;
+
bool QAstcHandler::canRead(const QByteArray &suffix, const QByteArray &block)
{
- Q_UNUSED(suffix)
+ Q_UNUSED(suffix);
return block.startsWith("\x13\xAB\xA1\x5C");
}
@@ -71,7 +37,7 @@ quint32 QAstcHandler::astcGLFormat(quint8 xBlockDim, quint8 yBlockDim) const
static const quint32 glFormatRGBABase = 0x93B0; // GL_COMPRESSED_RGBA_ASTC_4x4_KHR
static const quint32 glFormatSRGBBase = 0x93D0; // GL_COMPRESSED_SRGB8_ALPHA8_ASTC_4x4_KHR
- static QSize dims[14] = {
+ Q_CONSTINIT static QSize dims[14] = {
{ 4, 4 }, // GL_COMPRESSED_xxx_ASTC_4x4_KHR
{ 5, 4 }, // GL_COMPRESSED_xxx_ASTC_5x4_KHR
{ 5, 5 }, // GL_COMPRESSED_xxx_ASTC_5x5_KHR
@@ -143,13 +109,14 @@ QTextureFileData QAstcHandler::read()
int zBlocks = (zSz + header->blockDimZ - 1) / header->blockDimZ;
int byteCount = 0;
- bool oob = mul_overflow(xBlocks, yBlocks, &byteCount)
- || mul_overflow(byteCount, zBlocks, &byteCount)
- || mul_overflow(byteCount, 16, &byteCount);
+ bool oob = qMulOverflow(xBlocks, yBlocks, &byteCount)
+ || qMulOverflow(byteCount, zBlocks, &byteCount)
+ || qMulOverflow(byteCount, 16, &byteCount);
res.setDataOffset(sizeof(AstcHeader));
res.setNumLevels(1);
+ res.setNumFaces(1);
res.setDataLength(byteCount);
if (oob || !res.isValid()) {
diff --git a/src/gui/util/qastchandler_p.h b/src/gui/util/qastchandler_p.h
index 398f1833b6..5dd7f7a524 100644
--- a/src/gui/util/qastchandler_p.h
+++ b/src/gui/util/qastchandler_p.h
@@ -1,41 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2019 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the QtGui module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2019 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#ifndef QASTCHANDLER_H
#define QASTCHANDLER_H
@@ -59,6 +23,7 @@ class QAstcHandler : public QTextureFileHandler
{
public:
using QTextureFileHandler::QTextureFileHandler;
+ ~QAstcHandler() override;
static bool canRead(const QByteArray &suffix, const QByteArray &block);
diff --git a/src/gui/util/qdesktopservices.cpp b/src/gui/util/qdesktopservices.cpp
index 763f309fc7..379d18dd60 100644
--- a/src/gui/util/qdesktopservices.cpp
+++ b/src/gui/util/qdesktopservices.cpp
@@ -1,41 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the QtGui module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#include "qdesktopservices.h"
@@ -54,11 +18,12 @@
#include <qpa/qplatformintegration.h>
#include <qdir.h>
+#include <QtCore/private/qlocking_p.h>
+
QT_BEGIN_NAMESPACE
-class QOpenUrlHandlerRegistry : public QObject
+class QOpenUrlHandlerRegistry
{
- Q_OBJECT
public:
QOpenUrlHandlerRegistry() = default;
@@ -72,24 +37,34 @@ public:
typedef QHash<QString, Handler> HandlerHash;
HandlerHash handlers;
-public Q_SLOTS:
+#if QT_VERSION < QT_VERSION_CHECK(6, 6, 0)
+ QObject context;
+
void handlerDestroyed(QObject *handler);
+#endif
};
Q_GLOBAL_STATIC(QOpenUrlHandlerRegistry, handlerRegistry)
+#if QT_VERSION < QT_VERSION_CHECK(6, 6, 0)
void QOpenUrlHandlerRegistry::handlerDestroyed(QObject *handler)
{
+ const auto lock = qt_scoped_lock(mutex);
HandlerHash::Iterator it = handlers.begin();
while (it != handlers.end()) {
if (it->receiver == handler) {
it = handlers.erase(it);
+ qWarning("Please call QDesktopServices::unsetUrlHandler() before destroying a "
+ "registered URL handler object.\n"
+ "Support for destroying a registered URL handler object is deprecated, "
+ "and will be removed in Qt 6.6.");
} else {
++it;
}
}
}
+#endif
/*!
\class QDesktopServices
@@ -135,6 +110,7 @@ void QOpenUrlHandlerRegistry::handlerDestroyed(QObject *handler)
inside the application:
\snippet code/src_gui_util_qdesktopservices.cpp 0
+ \snippet code/src_gui_util_qdesktopservices.cpp setUrlHandler
If inside the handler you decide that you can't open the requested
URL, you can just call QDesktopServices::openUrl() again with the
@@ -145,9 +121,6 @@ void QOpenUrlHandlerRegistry::handlerDestroyed(QObject *handler)
openUrl() function can also be exposed to other applications, opening up
for application deep linking or a very basic URL-based IPC mechanism.
- \note Since Qt 5, storageLocation() and displayName() are replaced by functionality
- provided by the QStandardPaths class.
-
\sa QSystemTrayIcon, QProcess, QStandardPaths
*/
@@ -184,11 +157,18 @@ void QOpenUrlHandlerRegistry::handlerDestroyed(QObject *handler)
\warning URLs passed to this function on iOS will not load unless their schemes are
listed in the \c LSApplicationQueriesSchemes key of the application's Info.plist file.
For more information, see the Apple Developer Documentation for
- \l{https://developer.apple.com/documentation/uikit/uiapplication/1622952-canopenurl}{canOpenURL(_:)}.
+ \l {iOS: canOpenURL:}{canOpenURL:}.
For example, the following lines enable URLs with the HTTPS scheme:
\snippet code/src_gui_util_qdesktopservices.cpp 3
+ \note For Android Nougat (SDK 24) and above, URLs with a \c file scheme
+ are opened using \l {Android: FileProvider}{FileProvider} which tries to obtain
+ a shareable \c content scheme URI first. For that reason, Qt for Android defines
+ a file provider with the authority \c ${applicationId}.qtprovider, with \c applicationId
+ being the app's package name to avoid name conflicts. For more information, also see
+ \l {Android: Setting up file sharing}{Setting up file sharing}.
+
\sa setUrlHandler()
*/
bool QDesktopServices::openUrl(const QUrl &url)
@@ -246,14 +226,6 @@ bool QDesktopServices::openUrl(const QUrl &url)
\snippet code/src_gui_util_qdesktopservices.cpp 0
- To use this function for receiving data from other apps on iOS you also need to
- add the custom scheme to the \c CFBundleURLSchemes list in your Info.plist file:
-
- \snippet code/src_gui_util_qdesktopservices.cpp 4
-
- For more information, see the Apple Developer Documentation for
- \l{https://developer.apple.com/documentation/uikit/core_app/allowing_apps_and_websites_to_link_to_your_content/communicating_with_other_apps_using_custom_urls?language=objc}{Communicating with Other Apps Using Custom URLs}.
-
If setUrlHandler() is used to set a new handler for a scheme which already
has a handler, the existing handler is simply replaced with the new one.
Since QDesktopServices does not take ownership of handlers, no objects are
@@ -262,6 +234,65 @@ bool QDesktopServices::openUrl(const QUrl &url)
Note that the handler will always be called from within the same thread that
calls QDesktopServices::openUrl().
+ You must call unsetUrlHandler() before destroying the handler object, so
+ the destruction of the handler object does not overlap with concurrent
+ invocations of openUrl() using it.
+
+ \section1 iOS and \macos
+
+ To use this function for receiving data from other apps on iOS/\macos
+ you also need to add the custom scheme to the \c CFBundleURLSchemes
+ list in your Info.plist file:
+
+ \snippet code/src_gui_util_qdesktopservices.cpp 4
+
+ For more information, see the Apple Developer Documentation for
+ \l {iOS: Defining a Custom URL Scheme for Your App}{Defining a Custom URL Scheme for Your App}.
+ \warning It is not possible to claim support for some well known URL schemes, including http and
+ https. This is only allowed for Universal Links.
+
+ To claim support for http and https the above entry in the Info.plist file
+ is not allowed. This is only possible when you add your domain to the
+ Entitlements file:
+
+ \snippet code/src_gui_util_qdesktopservices.cpp 7
+
+ iOS/\macos will search for /.well-known/apple-app-site-association on your domain,
+ when the application is installed. If you want to listen to
+ \c{https://your.domain.com/help?topic=ABCDEF} you need to provide the following
+ content there:
+
+ \snippet code/src_gui_util_qdesktopservices.cpp 8
+
+ For more information, see the Apple Developer Documentation for
+ \l {iOS: Supporting Associated Domains}{Supporting Associated Domains}.
+
+ \section1 Android
+
+ To use this function for receiving data from other apps on Android, you
+ need to add one or more intent filter to the \c activity in your app manifest:
+
+ \snippet code/src_gui_util_qdesktopservices.cpp 9
+
+ For more information, see the Android Developer Documentation for
+ \l {Android: Create Deep Links to App Content}{Create Deep Links to App Content}.
+
+ To immediately open the corresponding content in your Android app, without
+ requiring the user to select the app, you need to verify your link. To
+ enable the verification, add an additional parameter to your intent filter:
+
+ \snippet code/src_gui_util_qdesktopservices.cpp 10
+
+ Android will look for \c{https://your.domain.com/.well-known/assetlinks.json},
+ when the application is installed. If you want to listen to
+ \c{https://your.domain.com:1337/help}, you need to provide the following
+ content there:
+
+ \snippet code/src_gui_util_qdesktopservices.cpp 11
+
+ For more information, see the Android Developer Documentation for
+ \l {Android: Verify Android App Links}{Verify Android App Links}.
+
\sa openUrl(), unsetUrlHandler()
*/
void QDesktopServices::setUrlHandler(const QString &scheme, QObject *receiver, const char *method)
@@ -276,13 +307,20 @@ void QDesktopServices::setUrlHandler(const QString &scheme, QObject *receiver, c
h.receiver = receiver;
h.name = method;
registry->handlers.insert(scheme.toLower(), h);
- QObject::connect(receiver, SIGNAL(destroyed(QObject*)),
- registry, SLOT(handlerDestroyed(QObject*)));
+#if QT_VERSION < QT_VERSION_CHECK(6, 6, 0)
+ QObject::connect(receiver, &QObject::destroyed, &registry->context,
+ [registry](QObject *obj) { registry->handlerDestroyed(obj); },
+ Qt::DirectConnection);
+#endif
}
/*!
Removes a previously set URL handler for the specified \a scheme.
+ Call this function before the handler object that was registered for \a scheme
+ is destroyed, to prevent concurrent openUrl() calls from continuing to call
+ the destroyed handler object.
+
\sa setUrlHandler()
*/
void QDesktopServices::unsetUrlHandler(const QString &scheme)
@@ -290,91 +328,6 @@ void QDesktopServices::unsetUrlHandler(const QString &scheme)
setUrlHandler(scheme, nullptr, nullptr);
}
-#if QT_DEPRECATED_SINCE(5, 0)
-/*!
- \enum QDesktopServices::StandardLocation
- \since 4.4
- \obsolete
- Use QStandardPaths::StandardLocation (see storageLocation() for porting notes)
-
- This enum describes the different locations that can be queried by
- QDesktopServices::storageLocation and QDesktopServices::displayName.
-
- \value DesktopLocation Returns the user's desktop directory.
- \value DocumentsLocation Returns the user's document.
- \value FontsLocation Returns the user's fonts.
- \value ApplicationsLocation Returns the user's applications.
- \value MusicLocation Returns the users music.
- \value MoviesLocation Returns the user's movies.
- \value PicturesLocation Returns the user's pictures.
- \value TempLocation Returns the system's temporary directory.
- \value HomeLocation Returns the user's home directory.
- \value DataLocation Returns a directory location where persistent
- application data can be stored. QCoreApplication::applicationName
- and QCoreApplication::organizationName should work on all
- platforms.
- \value CacheLocation Returns a directory location where user-specific
- non-essential (cached) data should be written.
-
- \sa storageLocation(), displayName()
-*/
-
-/*!
- \fn QString QDesktopServices::storageLocation(StandardLocation type)
- \obsolete
- Use QStandardPaths::writableLocation()
-
- \note when porting QDesktopServices::DataLocation to QStandardPaths::DataLocation,
- a different path will be returned.
-
- \c{QDesktopServices::DataLocation} was \c{GenericDataLocation + "/data/organization/application"},
- while QStandardPaths::DataLocation is \c{GenericDataLocation + "/organization/application"}.
-
- Also note that \c{application} could be empty in Qt 4, if QCoreApplication::setApplicationName()
- wasn't called, while in Qt 5 it defaults to the name of the executable.
-
- Therefore, if you still need to access the Qt 4 path (for example for data migration to Qt 5), replace
- \snippet code/src_gui_util_qdesktopservices.cpp 5
- with
- \snippet code/src_gui_util_qdesktopservices.cpp 6
- (assuming an organization name and an application name were set).
-*/
-
-/*!
- \fn QString QDesktopServices::displayName(StandardLocation type)
- \obsolete
- Use QStandardPaths::displayName()
-*/
-#endif
-
-extern Q_CORE_EXPORT QString qt_applicationName_noFallback();
-
-QString QDesktopServices::storageLocationImpl(QStandardPaths::StandardLocation type)
-{
- if (type == QStandardPaths::AppLocalDataLocation) {
- // Preserve Qt 4 compatibility:
- // * QCoreApplication::applicationName() must default to empty
- // * Unix data location is under the "data/" subdirectory
- const QString compatAppName = qt_applicationName_noFallback();
- const QString baseDir = QStandardPaths::writableLocation(QStandardPaths::GenericDataLocation);
- const QString organizationName = QCoreApplication::organizationName();
-#if defined(Q_OS_WIN) || defined(Q_OS_MAC)
- QString result = baseDir;
- if (!organizationName.isEmpty())
- result += QLatin1Char('/') + organizationName;
- if (!compatAppName.isEmpty())
- result += QLatin1Char('/') + compatAppName;
- return result;
-#elif defined(Q_OS_UNIX)
- return baseDir + QLatin1String("/data/")
- + organizationName + QLatin1Char('/') + compatAppName;
-#endif
- }
- return QStandardPaths::writableLocation(type);
-}
-
QT_END_NAMESPACE
-#include "qdesktopservices.moc"
-
#endif // QT_NO_DESKTOPSERVICES
diff --git a/src/gui/util/qdesktopservices.h b/src/gui/util/qdesktopservices.h
index 21705e2757..476b84691e 100644
--- a/src/gui/util/qdesktopservices.h
+++ b/src/gui/util/qdesktopservices.h
@@ -1,55 +1,17 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the QtGui module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2020 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#ifndef QDESKTOPSERVICES_H
#define QDESKTOPSERVICES_H
#include <QtGui/qtguiglobal.h>
#include <QtCore/qstring.h>
-#include <QtCore/qstandardpaths.h>
QT_BEGIN_NAMESPACE
#ifndef QT_NO_DESKTOPSERVICES
-class QStringList;
class QUrl;
class QObject;
@@ -59,32 +21,6 @@ public:
static bool openUrl(const QUrl &url);
static void setUrlHandler(const QString &scheme, QObject *receiver, const char *method);
static void unsetUrlHandler(const QString &scheme);
-
-#if QT_DEPRECATED_SINCE(5, 0)
- //Must match QStandardPaths::StandardLocation
- enum StandardLocation {
- DesktopLocation,
- DocumentsLocation,
- FontsLocation,
- ApplicationsLocation,
- MusicLocation,
- MoviesLocation,
- PicturesLocation,
- TempLocation,
- HomeLocation,
- DataLocation,
- CacheLocation
- };
-
- QT_DEPRECATED static QString storageLocation(StandardLocation type) {
- return storageLocationImpl(static_cast<QStandardPaths::StandardLocation>(type));
- }
- QT_DEPRECATED static QString displayName(StandardLocation type) {
- return QStandardPaths::displayName(static_cast<QStandardPaths::StandardLocation>(type));
- }
-#endif
-private:
- static QString storageLocationImpl(QStandardPaths::StandardLocation type);
};
#endif // QT_NO_DESKTOPSERVICES
diff --git a/src/gui/util/qedidparser.cpp b/src/gui/util/qedidparser.cpp
new file mode 100644
index 0000000000..4dae151e6a
--- /dev/null
+++ b/src/gui/util/qedidparser.cpp
@@ -0,0 +1,256 @@
+// Copyright (C) 2017 Pier Luigi Fiorini <pierluigi.fiorini@gmail.com>
+// Copyright (C) 2021 Klarälvdalens Datakonsult AB, a KDAB Group company, info@kdab.com, author Giuseppe D'Angelo <giuseppe.dangelo@kdab.com>
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
+
+#include <QtCore/QFile>
+#include <QtCore/QByteArrayView>
+
+#include "qedidparser_p.h"
+#include "qedidvendortable_p.h"
+
+#define EDID_DESCRIPTOR_ALPHANUMERIC_STRING 0xfe
+#define EDID_DESCRIPTOR_PRODUCT_NAME 0xfc
+#define EDID_DESCRIPTOR_SERIAL_NUMBER 0xff
+
+#define EDID_DATA_BLOCK_COUNT 4
+#define EDID_OFFSET_DATA_BLOCKS 0x36
+#define EDID_OFFSET_LAST_BLOCK 0x6c
+#define EDID_OFFSET_PNP_ID 0x08
+#define EDID_OFFSET_SERIAL 0x0c
+#define EDID_PHYSICAL_WIDTH 0x15
+#define EDID_OFFSET_PHYSICAL_HEIGHT 0x16
+#define EDID_TRANSFER_FUNCTION 0x17
+#define EDID_FEATURE_SUPPORT 0x18
+#define EDID_CHROMATICITIES_BLOCK 0x19
+
+QT_BEGIN_NAMESPACE
+
+using namespace Qt::StringLiterals;
+
+static QString lookupVendorIdInSystemDatabase(QByteArrayView id)
+{
+ QString result;
+
+ const QString fileName = "/usr/share/hwdata/pnp.ids"_L1;
+ QFile file(fileName);
+ if (!file.open(QFile::ReadOnly))
+ return result;
+
+ // On Ubuntu 20.04 the longest line in the file is 85 bytes, so this
+ // leaves plenty of room...
+ constexpr int MaxLineSize = 512;
+ char buf[MaxLineSize];
+
+ while (!file.atEnd()) {
+ auto read = file.readLine(buf, MaxLineSize);
+ if (read < 0 || read == MaxLineSize) // read error
+ break;
+
+ QByteArrayView line(buf, read - 1); // -1 to remove the trailing newline
+ if (line.isEmpty())
+ continue;
+
+ if (line.startsWith('#'))
+ continue;
+
+ auto tabPosition = line.indexOf('\t');
+ if (tabPosition <= 0) // no vendor id
+ continue;
+ if (tabPosition + 1 == line.size()) // no vendor name
+ continue;
+
+ if (line.first(tabPosition) == id) {
+ auto vendor = line.sliced(tabPosition + 1);
+ result = QString::fromUtf8(vendor.data(), vendor.size());
+ break;
+ }
+ }
+
+ return result;
+}
+
+bool QEdidParser::parse(const QByteArray &blob)
+{
+ const quint8 *data = reinterpret_cast<const quint8 *>(blob.constData());
+ const size_t length = blob.size();
+
+ // Verify header
+ if (length < 128)
+ return false;
+ if (data[0] != 0x00 || data[1] != 0xff)
+ return false;
+
+ /* Decode the PNP ID from three 5 bit words packed into 2 bytes
+ * /--08--\/--09--\
+ * 7654321076543210
+ * |\---/\---/\---/
+ * R C1 C2 C3 */
+ char pnpId[3];
+ pnpId[0] = 'A' + ((data[EDID_OFFSET_PNP_ID] & 0x7c) / 4) - 1;
+ pnpId[1] = 'A' + ((data[EDID_OFFSET_PNP_ID] & 0x3) * 8) + ((data[EDID_OFFSET_PNP_ID + 1] & 0xe0) / 32) - 1;
+ pnpId[2] = 'A' + (data[EDID_OFFSET_PNP_ID + 1] & 0x1f) - 1;
+
+ // Clear manufacturer
+ manufacturer = QString();
+
+ // Serial number, will be overwritten by an ASCII descriptor
+ // when and if it will be found
+ quint32 serial = data[EDID_OFFSET_SERIAL]
+ + (data[EDID_OFFSET_SERIAL + 1] << 8)
+ + (data[EDID_OFFSET_SERIAL + 2] << 16)
+ + (data[EDID_OFFSET_SERIAL + 3] << 24);
+ if (serial > 0)
+ serialNumber = QString::number(serial);
+ else
+ serialNumber = QString();
+
+ // Parse EDID data
+ for (int i = 0; i < EDID_DATA_BLOCK_COUNT; ++i) {
+ const uint offset = EDID_OFFSET_DATA_BLOCKS + i * 18;
+
+ if (data[offset] != 0 || data[offset + 1] != 0 || data[offset + 2] != 0)
+ continue;
+
+ if (data[offset + 3] == EDID_DESCRIPTOR_PRODUCT_NAME)
+ model = parseEdidString(&data[offset + 5]);
+ else if (data[offset + 3] == EDID_DESCRIPTOR_ALPHANUMERIC_STRING)
+ identifier = parseEdidString(&data[offset + 5]);
+ else if (data[offset + 3] == EDID_DESCRIPTOR_SERIAL_NUMBER)
+ serialNumber = parseEdidString(&data[offset + 5]);
+ }
+
+ // Try to use cache first because it is potentially more updated
+ manufacturer = lookupVendorIdInSystemDatabase(pnpId);
+
+ if (manufacturer.isEmpty()) {
+ // Find the manufacturer from the vendor lookup table
+ const auto compareVendorId = [](const VendorTable &vendor, const char *str)
+ {
+ return strncmp(vendor.id, str, 3) < 0;
+ };
+
+ const auto b = std::begin(q_edidVendorTable);
+ const auto e = std::end(q_edidVendorTable);
+ auto it = std::lower_bound(b,
+ e,
+ pnpId,
+ compareVendorId);
+
+ if (it != e && strncmp(it->id, pnpId, 3) == 0)
+ manufacturer = QString::fromUtf8(it->name);
+ }
+
+ // If we don't know the manufacturer, fallback to PNP ID
+ if (manufacturer.isEmpty())
+ manufacturer = QString::fromUtf8(pnpId, std::size(pnpId));
+
+ // Physical size
+ physicalSize = QSizeF(data[EDID_PHYSICAL_WIDTH], data[EDID_OFFSET_PHYSICAL_HEIGHT]) * 10;
+
+ // Gamma and transfer function
+ const uint igamma = data[EDID_TRANSFER_FUNCTION];
+ if (igamma != 0xff) {
+ gamma = 1.0 + (igamma / 100.0f);
+ useTables = false;
+ } else {
+ gamma = 0.0; // Defined in DI-EXT
+ useTables = true;
+ }
+ sRgb = data[EDID_FEATURE_SUPPORT] & 0x04;
+
+ // Chromaticities
+ int rx = (data[EDID_CHROMATICITIES_BLOCK] >> 6) & 0x03;
+ int ry = (data[EDID_CHROMATICITIES_BLOCK] >> 4) & 0x03;
+ int gx = (data[EDID_CHROMATICITIES_BLOCK] >> 2) & 0x03;
+ int gy = (data[EDID_CHROMATICITIES_BLOCK] >> 0) & 0x03;
+ int bx = (data[EDID_CHROMATICITIES_BLOCK + 1] >> 6) & 0x03;
+ int by = (data[EDID_CHROMATICITIES_BLOCK + 1] >> 4) & 0x03;
+ int wx = (data[EDID_CHROMATICITIES_BLOCK + 1] >> 2) & 0x03;
+ int wy = (data[EDID_CHROMATICITIES_BLOCK + 1] >> 0) & 0x03;
+ rx |= data[EDID_CHROMATICITIES_BLOCK + 2] << 2;
+ ry |= data[EDID_CHROMATICITIES_BLOCK + 3] << 2;
+ gx |= data[EDID_CHROMATICITIES_BLOCK + 4] << 2;
+ gy |= data[EDID_CHROMATICITIES_BLOCK + 5] << 2;
+ bx |= data[EDID_CHROMATICITIES_BLOCK + 6] << 2;
+ by |= data[EDID_CHROMATICITIES_BLOCK + 7] << 2;
+ wx |= data[EDID_CHROMATICITIES_BLOCK + 8] << 2;
+ wy |= data[EDID_CHROMATICITIES_BLOCK + 9] << 2;
+
+ redChromaticity.setX(rx * (1.0f / 1024.0f));
+ redChromaticity.setY(ry * (1.0f / 1024.0f));
+ greenChromaticity.setX(gx * (1.0f / 1024.0f));
+ greenChromaticity.setY(gy * (1.0f / 1024.0f));
+ blueChromaticity.setX(bx * (1.0f / 1024.0f));
+ blueChromaticity.setY(by * (1.0f / 1024.0f));
+ whiteChromaticity.setX(wx * (1.0f / 1024.0f));
+ whiteChromaticity.setY(wy * (1.0f / 1024.0f));
+
+ // Find extensions
+ for (uint i = 1; i < length / 128; ++i) {
+ uint extensionId = data[i * 128];
+ if (extensionId == 0x40) { // DI-EXT
+ // 0x0E (sub-pixel layout)
+ // 0x20->0x22 (bits per color)
+ // 0x51->0x7e Transfer characteristics
+ const uchar desc = data[i * 128 + 0x51];
+ const uchar len = desc & 0x3f;
+ if ((desc & 0xc0) == 0x40) {
+ if (len > 45)
+ return false;
+ QList<uint16_t> whiteTRC;
+ whiteTRC.reserve(len + 1);
+ for (uint j = 0; j < len; ++j)
+ whiteTRC[j] = data[0x52 + j] * 0x101;
+ whiteTRC[len] = 0xffff;
+ tables.append(whiteTRC);
+ } else if ((desc & 0xc0) == 0x80) {
+ if (len > 15)
+ return false;
+ QList<uint16_t> redTRC;
+ QList<uint16_t> greenTRC;
+ QList<uint16_t> blueTRC;
+ blueTRC.reserve(len + 1);
+ greenTRC.reserve(len + 1);
+ redTRC.reserve(len + 1);
+ for (uint j = 0; j < len; ++j)
+ blueTRC[j] = data[0x52 + j] * 0x101;
+ blueTRC[len] = 0xffff;
+ for (uint j = 0; j < len; ++j)
+ greenTRC[j] = data[0x61 + j] * 0x101;
+ greenTRC[len] = 0xffff;
+ for (uint j = 0; j < len; ++j)
+ redTRC[j] = data[0x70 + j] * 0x101;
+ redTRC[len] = 0xffff;
+ tables.append(redTRC);
+ tables.append(greenTRC);
+ tables.append(blueTRC);
+ }
+ }
+ }
+
+ return true;
+}
+
+QString QEdidParser::parseEdidString(const quint8 *data)
+{
+ QByteArray buffer(reinterpret_cast<const char *>(data), 13);
+
+ for (int i = 0; i < buffer.size(); ++i) {
+ // If there are less than 13 characters in the string, the string
+ // is terminated with the ASCII code ‘0Ah’ (line feed) and padded
+ // with ASCII code ‘20h’ (space). See EDID 1.4, sections 3.10.3.1,
+ // 3.10.3.2, and 3.10.3.4.
+ if (buffer[i] == '\n') {
+ buffer.truncate(i);
+ break;
+ }
+
+ // Replace non-printable characters with dash
+ if (buffer[i] < '\040' || buffer[i] > '\176')
+ buffer[i] = '-';
+ }
+
+ return QString::fromLatin1(buffer);
+}
+
+QT_END_NAMESPACE
diff --git a/src/gui/util/qedidparser_p.h b/src/gui/util/qedidparser_p.h
new file mode 100644
index 0000000000..99352b03b0
--- /dev/null
+++ b/src/gui/util/qedidparser_p.h
@@ -0,0 +1,57 @@
+// Copyright (C) 2017 Pier Luigi Fiorini <pierluigi.fiorini@gmail.com>
+// Copyright (C) 2021 Klarälvdalens Datakonsult AB, a KDAB Group company, info@kdab.com, author Giuseppe D'Angelo <giuseppe.dangelo@kdab.com>
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
+
+#ifndef QEDIDPARSER_P_H
+#define QEDIDPARSER_P_H
+
+#include <QtCore/QMap>
+#include <QtCore/QPointF>
+#include <QtCore/QSize>
+
+//
+// W A R N I N G
+// -------------
+//
+// This file is not part of the Qt API. It exists purely as an
+// implementation detail. This header file may change from version to
+// version without notice, or even be removed.
+//
+// We mean it.
+//
+
+#include <QtGui/qtguiglobal.h>
+#include <QtCore/qlist.h>
+#include <QtCore/qpoint.h>
+#include <QtCore/qsize.h>
+#include <QtCore/qstring.h>
+#include <QtCore/private/qglobal_p.h>
+
+QT_BEGIN_NAMESPACE
+
+class Q_GUI_EXPORT QEdidParser
+{
+public:
+ bool parse(const QByteArray &blob);
+
+ QString identifier;
+ QString manufacturer;
+ QString model;
+ QString serialNumber;
+ QSizeF physicalSize;
+ qreal gamma;
+ QPointF redChromaticity;
+ QPointF greenChromaticity;
+ QPointF blueChromaticity;
+ QPointF whiteChromaticity;
+ QList<QList<uint16_t>> tables;
+ bool sRgb;
+ bool useTables;
+
+private:
+ QString parseEdidString(const quint8 *data);
+};
+
+QT_END_NAMESPACE
+
+#endif // QEDIDPARSER_P_H
diff --git a/src/gui/util/qedidvendortable_p.h b/src/gui/util/qedidvendortable_p.h
new file mode 100644
index 0000000000..0a6132e4d7
--- /dev/null
+++ b/src/gui/util/qedidvendortable_p.h
@@ -0,0 +1,2507 @@
+// Copyright (C) 2017 Pier Luigi Fiorini <pierluigi.fiorini@gmail.com>
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
+
+/*
+ * This lookup table was generated from https://github.com/vcrhonek/hwdata/raw/master/pnp.ids
+ *
+ * Do not change this file directly, instead edit the
+ * qtbase/util/edid/qedidvendortable.py script and regenerate this file.
+ */
+
+#ifndef QEDIDVENDORTABLE_P_H
+#define QEDIDVENDORTABLE_P_H
+
+//
+// W A R N I N G
+// -------------
+//
+// This file is not part of the Qt API. It exists purely as an
+// implementation detail. This header file may change from version to
+// version without notice, or even be removed.
+//
+// We mean it.
+//
+
+#include <QtCore/private/qglobal_p.h>
+
+QT_BEGIN_NAMESPACE
+
+struct VendorTable {
+ const char id[4];
+ const char name[78];
+};
+
+static const VendorTable q_edidVendorTable[] = {
+ { "AAA", "Avolites Ltd" },
+ { "AAE", "Anatek Electronics Inc." },
+ { "AAM", "Aava Mobile Oy" },
+ { "AAN", "AAEON Technology Inc." },
+ { "AAT", "Ann Arbor Technologies" },
+ { "ABA", "ABBAHOME INC." },
+ { "ABC", "AboCom System Inc." },
+ { "ABD", "Allen Bradley Company" },
+ { "ABE", "Alcatel Bell" },
+ { "ABO", "D-Link Systems Inc" },
+ { "ABS", "Abaco Systems, Inc." },
+ { "ABT", "Anchor Bay Technologies, Inc." },
+ { "ABV", "Advanced Research Technology" },
+ { "ACA", "Ariel Corporation" },
+ { "ACB", "Aculab Ltd" },
+ { "ACC", "Accton Technology Corporation" },
+ { "ACD", "AWETA BV" },
+ { "ACE", "Actek Engineering Pty Ltd" },
+ { "ACG", "A&R Cambridge Ltd." },
+ { "ACH", "Archtek Telecom Corporation" },
+ { "ACI", "Ancor Communications Inc" },
+ { "ACK", "Acksys" },
+ { "ACL", "Apricot Computers" },
+ { "ACM", "Acroloop Motion Control Systems Inc" },
+ { "ACO", "Allion Computer Inc." },
+ { "ACP", "Aspen Tech Inc" },
+ { "ACR", "Acer Technologies" },
+ { "ACS", "Altos Computer Systems" },
+ { "ACT", "Applied Creative Technology" },
+ { "ACU", "Acculogic" },
+ { "ACV", "ActivCard S.A" },
+ { "ADA", "Addi-Data GmbH" },
+ { "ADB", "Aldebbaron" },
+ { "ADC", "Acnhor Datacomm" },
+ { "ADD", "Advanced Peripheral Devices Inc" },
+ { "ADE", "Arithmos, Inc." },
+ { "ADH", "Aerodata Holdings Ltd" },
+ { "ADI", "ADI Systems Inc" },
+ { "ADK", "Adtek System Science Company Ltd" },
+ { "ADL", "ASTRA Security Products Ltd" },
+ { "ADM", "Ad Lib MultiMedia Inc" },
+ { "ADN", "Analog & Digital Devices Tel. Inc" },
+ { "ADP", "Adaptec Inc" },
+ { "ADR", "Nasa Ames Research Center" },
+ { "ADS", "Analog Devices Inc" },
+ { "ADT", "Adtek" },
+ { "ADV", "Advanced Micro Devices Inc" },
+ { "ADX", "Adax Inc" },
+ { "ADZ", "ADDER TECHNOLOGY LTD" },
+ { "AEC", "Antex Electronics Corporation" },
+ { "AED", "Advanced Electronic Designs, Inc." },
+ { "AEI", "Actiontec Electric Inc" },
+ { "AEJ", "Alpha Electronics Company" },
+ { "AEM", "ASEM S.p.A." },
+ { "AEN", "Avencall" },
+ { "AEP", "Aetas Peripheral International" },
+ { "AET", "Aethra Telecomunicazioni S.r.l." },
+ { "AFA", "Alfa Inc" },
+ { "AGC", "Beijing Aerospace Golden Card Electronic Engineering Co.,Ltd." },
+ { "AGI", "Artish Graphics Inc" },
+ { "AGL", "Argolis" },
+ { "AGM", "Advan Int'l Corporation" },
+ { "AGO", "AlgolTek, Inc." },
+ { "AGT", "Agilent Technologies" },
+ { "AHC", "Advantech Co., Ltd." },
+ { "AHQ", "Astro HQ LLC" },
+ { "AHS", "Beijing AnHeng SecoTech Information Technology Co., Ltd." },
+ { "AIC", "Arnos Insturments & Computer Systems" },
+ { "AIE", "Altmann Industrieelektronik" },
+ { "AII", "Amptron International Inc." },
+ { "AIK", "Dongguan Alllike Electronics Co., Ltd." },
+ { "AIL", "Altos India Ltd" },
+ { "AIM", "AIMS Lab Inc" },
+ { "AIR", "Advanced Integ. Research Inc" },
+ { "AIS", "Alien Internet Services" },
+ { "AIW", "Aiwa Company Ltd" },
+ { "AIX", "ALTINEX, INC." },
+ { "AJA", "AJA Video Systems, Inc." },
+ { "AKB", "Akebia Ltd" },
+ { "AKE", "AKAMI Electric Co.,Ltd" },
+ { "AKI", "AKIA Corporation" },
+ { "AKL", "AMiT Ltd" },
+ { "AKM", "Asahi Kasei Microsystems Company Ltd" },
+ { "AKP", "Atom Komplex Prylad" },
+ { "AKY", "Askey Computer Corporation" },
+ { "ALA", "Alacron Inc" },
+ { "ALC", "Altec Corporation" },
+ { "ALD", "In4S Inc" },
+ { "ALE", "Alenco BV" },
+ { "ALG", "Realtek Semiconductor Corp." },
+ { "ALH", "AL Systems" },
+ { "ALI", "Acer Labs" },
+ { "ALJ", "Altec Lansing" },
+ { "ALK", "Acrolink Inc" },
+ { "ALL", "Alliance Semiconductor Corporation" },
+ { "ALM", "Acutec Ltd." },
+ { "ALN", "Alana Technologies" },
+ { "ALO", "Algolith Inc." },
+ { "ALP", "ALPS ALPINE CO., LTD." },
+ { "ALR", "Advanced Logic" },
+ { "ALS", "Avance Logic Inc" },
+ { "ALT", "Altra" },
+ { "ALV", "AlphaView LCD" },
+ { "ALX", "ALEXON Co.,Ltd." },
+ { "AMA", "Asia Microelectronic Development Inc" },
+ { "AMB", "Ambient Technologies, Inc." },
+ { "AMC", "Attachmate Corporation" },
+ { "AMD", "Amdek Corporation" },
+ { "AMI", "American Megatrends Inc" },
+ { "AML", "Anderson Multimedia Communications (HK) Limited" },
+ { "AMN", "Amimon LTD." },
+ { "AMO", "Amino Technologies PLC and Amino Communications Limited" },
+ { "AMP", "AMP Inc" },
+ { "AMR", "AmTRAN Technology Co., Ltd." },
+ { "AMS", "ARMSTEL, Inc." },
+ { "AMT", "AMT International Industry" },
+ { "AMX", "AMX LLC" },
+ { "ANA", "Anakron" },
+ { "ANC", "Ancot" },
+ { "AND", "Adtran Inc" },
+ { "ANI", "Anigma Inc" },
+ { "ANK", "Anko Electronic Company Ltd" },
+ { "ANL", "Analogix Semiconductor, Inc" },
+ { "ANO", "Anorad Corporation" },
+ { "ANP", "Andrew Network Production" },
+ { "ANR", "ANR Ltd" },
+ { "ANS", "Ansel Communication Company" },
+ { "ANT", "Ace CAD Enterprise Company Ltd" },
+ { "ANV", "Beijing ANTVR Technology Co., Ltd." },
+ { "ANW", "Analog Way SAS" },
+ { "ANX", "Acer Netxus Inc" },
+ { "AOA", "AOpen Inc." },
+ { "AOE", "Advanced Optics Electronics, Inc." },
+ { "AOL", "America OnLine" },
+ { "AOT", "Alcatel" },
+ { "APC", "American Power Conversion" },
+ { "APD", "AppliAdata" },
+ { "APE", "ALPS ALPINE CO., LTD." },
+ { "APG", "Horner Electric Inc" },
+ { "API", "A Plus Info Corporation" },
+ { "APL", "Aplicom Oy" },
+ { "APM", "Applied Memory Tech" },
+ { "APN", "Appian Tech Inc" },
+ { "APP", "Apple Computer Inc" },
+ { "APR", "Aprilia s.p.a." },
+ { "APS", "Autologic Inc" },
+ { "APT", "Audio Processing Technology Ltd" },
+ { "APV", "A+V Link" },
+ { "APX", "AP Designs Ltd" },
+ { "ARC", "Alta Research Corporation" },
+ { "ARD", "AREC Inc." },
+ { "ARE", "ICET S.p.A." },
+ { "ARG", "Argus Electronics Co., LTD" },
+ { "ARI", "Argosy Research Inc" },
+ { "ARK", "Ark Logic Inc" },
+ { "ARL", "Arlotto Comnet Inc" },
+ { "ARM", "Arima" },
+ { "ARO", "Poso International B.V." },
+ { "ARR", "ARRIS Group, Inc." },
+ { "ARS", "Arescom Inc" },
+ { "ART", "Corion Industrial Corporation" },
+ { "ASC", "Ascom Strategic Technology Unit" },
+ { "ASD", "USC Information Sciences Institute" },
+ { "ASE", "AseV Display Labs" },
+ { "ASH", "Ashton Bentley Concepts" },
+ { "ASI", "Ahead Systems" },
+ { "ASK", "Ask A/S" },
+ { "ASL", "AccuScene Corporation Ltd" },
+ { "ASM", "ASEM S.p.A." },
+ { "ASN", "Asante Tech Inc" },
+ { "ASP", "ASP Microelectronics Ltd" },
+ { "AST", "AST Research Inc" },
+ { "ASU", "Asuscom Network Inc" },
+ { "ASX", "AudioScience" },
+ { "ASY", "Rockwell Collins / Airshow Systems" },
+ { "ATA", "Allied Telesyn International (Asia) Pte Ltd" },
+ { "ATC", "Ably-Tech Corporation" },
+ { "ATD", "Alpha Telecom Inc" },
+ { "ATE", "Innovate Ltd" },
+ { "ATH", "Athena Informatica S.R.L." },
+ { "ATI", "Allied Telesis KK" },
+ { "ATJ", "ArchiTek Corporation" },
+ { "ATK", "Allied Telesyn Int'l" },
+ { "ATL", "Arcus Technology Ltd" },
+ { "ATM", "ATM Ltd" },
+ { "ATN", "Athena Smartcard Solutions Ltd." },
+ { "ATO", "ASTRO DESIGN, INC." },
+ { "ATP", "Alpha-Top Corporation" },
+ { "ATT", "AT&T" },
+ { "ATV", "Office Depot, Inc." },
+ { "ATX", "Athenix Corporation" },
+ { "AUG", "August Home, Inc." },
+ { "AUI", "ALPS ALPINE CO., LTD." },
+ { "AUO", "AU Optronics" },
+ { "AUR", "Aureal Semiconductor" },
+ { "AUS", "ASUSTek COMPUTER INC" },
+ { "AUT", "Autotime Corporation" },
+ { "AUV", "Auvidea GmbH" },
+ { "AVA", "Avaya Communication" },
+ { "AVC", "Auravision Corporation" },
+ { "AVD", "Avid Electronics Corporation" },
+ { "AVE", "Add Value Enterpises (Asia) Pte Ltd" },
+ { "AVG", "Avegant Corporation" },
+ { "AVI", "Nippon Avionics Co.,Ltd" },
+ { "AVJ", "Atelier Vision Corporation" },
+ { "AVL", "Avalue Technology Inc." },
+ { "AVM", "AVM GmbH" },
+ { "AVN", "Advance Computer Corporation" },
+ { "AVO", "Avocent Corporation" },
+ { "AVR", "AVer Information Inc." },
+ { "AVS", "Avatron Software Inc." },
+ { "AVT", "Avtek (Electronics) Pty Ltd" },
+ { "AVV", "SBS Technologies (Canada), Inc. (was Avvida Systems, Inc.)" },
+ { "AVX", "A/Vaux Electronics" },
+ { "AWC", "Access Works Comm Inc" },
+ { "AWL", "Aironet Wireless Communications, Inc" },
+ { "AWS", "Wave Systems" },
+ { "AXB", "Adrienne Electronics Corporation" },
+ { "AXC", "AXIOMTEK CO., LTD." },
+ { "AXE", "Axell Corporation" },
+ { "AXI", "American Magnetics" },
+ { "AXL", "Axel" },
+ { "AXO", "Axonic Labs LLC" },
+ { "AXP", "American Express" },
+ { "AXT", "Axtend Technologies Inc" },
+ { "AXX", "Axxon Computer Corporation" },
+ { "AXY", "AXYZ Automation Services, Inc" },
+ { "AYD", "Aydin Displays" },
+ { "AYR", "Airlib, Inc" },
+ { "AZH", "Shenzhen three Connaught Information Technology Co., Ltd. (3nod Group)" },
+ { "AZM", "AZ Middelheim - Radiotherapy" },
+ { "AZT", "Aztech Systems Ltd" },
+ { "BAC", "Biometric Access Corporation" },
+ { "BAN", "Banyan" },
+ { "BBB", "an-najah university" },
+ { "BBH", "B&Bh" },
+ { "BBL", "Brain Boxes Limited" },
+ { "BBV", "BlueBox Video Limited" },
+ { "BBX", "Black Box Corporation" },
+ { "BCC", "Beaver Computer Corporaton" },
+ { "BCD", "Barco GmbH" },
+ { "BCI", "Broadata Communications Inc." },
+ { "BCM", "Broadcom" },
+ { "BCQ", "Deutsche Telekom Berkom GmbH" },
+ { "BCS", "Booria CAD/CAM systems" },
+ { "BDO", "Brahler ICS" },
+ { "BDR", "Blonder Tongue Labs, Inc." },
+ { "BDS", "Barco Display Systems" },
+ { "BEC", "Beckhoff Automation" },
+ { "BEI", "Beckworth Enterprises Inc" },
+ { "BEK", "Beko Elektronik A.S." },
+ { "BEL", "Beltronic Industrieelektronik GmbH" },
+ { "BEO", "Baug & Olufsen" },
+ { "BFE", "B.F. Engineering Corporation" },
+ { "BGB", "Barco Graphics N.V" },
+ { "BGT", "Budzetron Inc" },
+ { "BHZ", "BitHeadz, Inc." },
+ { "BIA", "Biamp Systems Corporation" },
+ { "BIC", "Big Island Communications" },
+ { "BII", "Boeckeler Instruments Inc" },
+ { "BIL", "Billion Electric Company Ltd" },
+ { "BIO", "BioLink Technologies International, Inc." },
+ { "BIT", "Bit 3 Computer" },
+ { "BLD", "BILD INNOVATIVE TECHNOLOGY LLC" },
+ { "BLI", "Busicom" },
+ { "BLN", "BioLink Technologies" },
+ { "BLP", "Bloomberg L.P." },
+ { "BMD", "Blackmagic Design" },
+ { "BMI", "Benson Medical Instruments Company" },
+ { "BML", "BIOMED Lab" },
+ { "BMS", "BIOMEDISYS" },
+ { "BNE", "Bull AB" },
+ { "BNK", "Banksia Tech Pty Ltd" },
+ { "BNO", "Bang & Olufsen" },
+ { "BNS", "Boulder Nonlinear Systems" },
+ { "BOB", "Rainy Orchard" },
+ { "BOE", "BOE" },
+ { "BOI", "NINGBO BOIGLE DIGITAL TECHNOLOGY CO.,LTD" },
+ { "BOS", "BOS" },
+ { "BPD", "Micro Solutions, Inc." },
+ { "BPS", "Barco, N.V." },
+ { "BPU", "Best Power" },
+ { "BRA", "Braemac Pty Ltd" },
+ { "BRC", "BARC" },
+ { "BRG", "Bridge Information Co., Ltd" },
+ { "BRI", "Boca Research Inc" },
+ { "BRM", "Braemar Inc" },
+ { "BRO", "BROTHER INDUSTRIES,LTD." },
+ { "BSE", "Bose Corporation" },
+ { "BSG", "Robert Bosch GmbH" },
+ { "BSL", "Biomedical Systems Laboratory" },
+ { "BSN", "BRIGHTSIGN, LLC" },
+ { "BST", "BodySound Technologies, Inc." },
+ { "BTC", "Bit 3 Computer" },
+ { "BTE", "Brilliant Technology" },
+ { "BTF", "Bitfield Oy" },
+ { "BTI", "BusTech Inc" },
+ { "BTO", "BioTao Ltd" },
+ { "BUF", "Yasuhiko Shirai Melco Inc" },
+ { "BUG", "B.U.G., Inc." },
+ { "BUJ", "ATI Tech Inc" },
+ { "BUL", "Bull" },
+ { "BUR", "Bernecker & Rainer Ind-Eletronik GmbH" },
+ { "BUS", "BusTek" },
+ { "BUT", "21ST CENTURY ENTERTAINMENT" },
+ { "BWK", "Bitworks Inc." },
+ { "BXE", "Buxco Electronics" },
+ { "BYD", "byd:sign corporation" },
+ { "CAA", "Castles Automation Co., Ltd" },
+ { "CAC", "CA & F Elettronica" },
+ { "CAG", "CalComp" },
+ { "CAI", "Canon Inc." },
+ { "CAL", "Acon" },
+ { "CAM", "Cambridge Audio" },
+ { "CAN", "Canopus Company Ltd" },
+ { "CAR", "Cardinal Company Ltd" },
+ { "CAS", "CASIO COMPUTER CO.,LTD" },
+ { "CAT", "Consultancy in Advanced Technology" },
+ { "CAV", "Cavium Networks, Inc" },
+ { "CBI", "ComputerBoards Inc" },
+ { "CBR", "Cebra Tech A/S" },
+ { "CBT", "Cabletime Ltd" },
+ { "CBX", "Cybex Computer Products Corporation" },
+ { "CCC", "C-Cube Microsystems" },
+ { "CCI", "Cache" },
+ { "CCJ", "CONTEC CO.,LTD." },
+ { "CCL", "CCL/ITRI" },
+ { "CCP", "Capetronic USA Inc" },
+ { "CDC", "Core Dynamics Corporation" },
+ { "CDD", "Convergent Data Devices" },
+ { "CDE", "Colin.de" },
+ { "CDG", "Christie Digital Systems Inc" },
+ { "CDI", "Concept Development Inc" },
+ { "CDK", "Cray Communications" },
+ { "CDN", "Codenoll Technical Corporation" },
+ { "CDP", "CalComp" },
+ { "CDS", "Computer Diagnostic Systems" },
+ { "CDT", "IBM Corporation" },
+ { "CDV", "Convergent Design Inc." },
+ { "CEA", "Consumer Electronics Association" },
+ { "CEC", "Chicony Electronics Company Ltd" },
+ { "CED", "Cambridge Electronic Design Ltd" },
+ { "CEF", "Cefar Digital Vision" },
+ { "CEI", "Crestron Electronics, Inc." },
+ { "CEM", "MEC Electronics GmbH" },
+ { "CEN", "Centurion Technologies P/L" },
+ { "CEP", "C-DAC" },
+ { "CER", "Ceronix" },
+ { "CET", "TEC CORPORATION" },
+ { "CFG", "Atlantis" },
+ { "CFR", "Meta View, Inc." },
+ { "CGA", "Chunghwa Picture Tubes, LTD" },
+ { "CGS", "Chyron Corp" },
+ { "CGT", "congatec AG" },
+ { "CHA", "Chase Research PLC" },
+ { "CHD", "ChangHong Electric Co.,Ltd" },
+ { "CHE", "Acer Inc" },
+ { "CHG", "Sichuan Changhong Electric CO, LTD." },
+ { "CHI", "Chrontel Inc" },
+ { "CHL", "Chloride-R&D" },
+ { "CHM", "CHIC TECHNOLOGY CORP." },
+ { "CHO", "Sichuang Changhong Corporation" },
+ { "CHP", "CH Products" },
+ { "CHR", "christmann informationstechnik + medien GmbH & Co. KG" },
+ { "CHS", "Agentur Chairos" },
+ { "CHT", "Chunghwa Picture Tubes,LTD." },
+ { "CHY", "Cherry GmbH" },
+ { "CIC", "Comm. Intelligence Corporation" },
+ { "CIE", "Convergent Engineering, Inc." },
+ { "CII", "Cromack Industries Inc" },
+ { "CIL", "Citicom Infotech Private Limited" },
+ { "CIN", "Citron GmbH" },
+ { "CIP", "Ciprico Inc" },
+ { "CIR", "Cirrus Logic Inc" },
+ { "CIS", "Cisco Systems Inc" },
+ { "CIT", "Citifax Limited" },
+ { "CKC", "The Concept Keyboard Company Ltd" },
+ { "CKJ", "Carina System Co., Ltd." },
+ { "CLA", "Clarion Company Ltd" },
+ { "CLD", "COMMAT L.t.d." },
+ { "CLE", "Classe Audio" },
+ { "CLG", "CoreLogic" },
+ { "CLI", "Cirrus Logic Inc" },
+ { "CLM", "CrystaLake Multimedia" },
+ { "CLO", "Clone Computers" },
+ { "CLR", "Clover Electronics" },
+ { "CLT", "automated computer control systems" },
+ { "CLV", "Clevo Company" },
+ { "CLX", "CardLogix" },
+ { "CMC", "CMC Ltd" },
+ { "CMD", "Colorado MicroDisplay, Inc." },
+ { "CMG", "Chenming Mold Ind. Corp." },
+ { "CMI", "C-Media Electronics" },
+ { "CMK", "Comark LLC" },
+ { "CMM", "Comtime GmbH" },
+ { "CMN", "Chimei Innolux Corporation" },
+ { "CMO", "Chi Mei Optoelectronics corp." },
+ { "CMR", "Cambridge Research Systems Ltd" },
+ { "CMS", "CompuMaster Srl" },
+ { "CMX", "Comex Electronics AB" },
+ { "CNB", "American Power Conversion" },
+ { "CNC", "Alvedon Computers Ltd" },
+ { "CND", "Micro-Star Int'l Co., Ltd." },
+ { "CNE", "Cine-tal" },
+ { "CNI", "Connect Int'l A/S" },
+ { "CNN", "Canon Inc" },
+ { "CNT", "COINT Multimedia Systems" },
+ { "COB", "COBY Electronics Co., Ltd" },
+ { "COD", "CODAN Pty. Ltd." },
+ { "COI", "Codec Inc." },
+ { "COL", "Rockwell Collins, Inc." },
+ { "COM", "Comtrol Corporation" },
+ { "CON", "Contec Company Ltd" },
+ { "COO", "coolux GmbH" },
+ { "COR", "Corollary Inc" },
+ { "COS", "CoStar Corporation" },
+ { "COT", "Core Technology Inc" },
+ { "COW", "Polycow Productions" },
+ { "COX", "Comrex" },
+ { "CPC", "Ciprico Inc" },
+ { "CPD", "CompuAdd" },
+ { "CPI", "Computer Peripherals Inc" },
+ { "CPL", "Compal Electronics Inc" },
+ { "CPM", "Capella Microsystems Inc." },
+ { "CPP", "Compound Photonics" },
+ { "CPQ", "Compaq Computer Company" },
+ { "CPT", "cPATH" },
+ { "CPX", "Powermatic Data Systems" },
+ { "CRA", "CRALTECH ELECTRONICA, S.L." },
+ { "CRC", "CONRAC GmbH" },
+ { "CRD", "Cardinal Technical Inc" },
+ { "CRE", "Creative Labs Inc" },
+ { "CRH", "Contemporary Research Corp." },
+ { "CRI", "Crio Inc." },
+ { "CRL", "Creative Logic" },
+ { "CRM", "CORSAIR MEMORY Inc." },
+ { "CRN", "Cornerstone Imaging" },
+ { "CRO", "Extraordinary Technologies PTY Limited" },
+ { "CRQ", "Cirque Corporation" },
+ { "CRS", "Crescendo Communication Inc" },
+ { "CRV", "Cerevo Inc." },
+ { "CRW", "Cammegh Limited" },
+ { "CRX", "Cyrix Corporation" },
+ { "CSB", "Transtex SA" },
+ { "CSC", "Crystal Semiconductor" },
+ { "CSD", "Cresta Systems Inc" },
+ { "CSE", "Concept Solutions & Engineering" },
+ { "CSI", "Cabletron System Inc" },
+ { "CSL", "Cloudium Systems Ltd." },
+ { "CSM", "Cosmic Engineering Inc." },
+ { "CSO", "California Institute of Technology" },
+ { "CSS", "CSS Laboratories" },
+ { "CST", "CSTI Inc" },
+ { "CTA", "CoSystems Inc" },
+ { "CTC", "CTC Communication Development Company Ltd" },
+ { "CTE", "Chunghwa Telecom Co., Ltd." },
+ { "CTL", "Creative Technology Ltd" },
+ { "CTM", "Computerm Corporation" },
+ { "CTN", "Computone Products" },
+ { "CTP", "Computer Technology Corporation" },
+ { "CTR", "Control4 Corporation" },
+ { "CTS", "Comtec Systems Co., Ltd." },
+ { "CTX", "Creatix Polymedia GmbH" },
+ { "CUB", "Cubix Corporation" },
+ { "CUK", "Calibre UK Ltd" },
+ { "CVA", "Covia Inc." },
+ { "CVI", "Colorado Video, Inc." },
+ { "CVP", "Chromatec Video Products Ltd" },
+ { "CVS", "Clarity Visual Systems" },
+ { "CWC", "Curtiss-Wright Controls, Inc." },
+ { "CWR", "Connectware Inc" },
+ { "CXT", "Conexant Systems" },
+ { "CYB", "CyberVision" },
+ { "CYC", "Cylink Corporation" },
+ { "CYD", "Cyclades Corporation" },
+ { "CYL", "Cyberlabs" },
+ { "CYP", "CYPRESS SEMICONDUCTOR CORPORATION" },
+ { "CYT", "Cytechinfo Inc" },
+ { "CYV", "Cyviz AS" },
+ { "CYW", "Cyberware" },
+ { "CYX", "Cyrix Corporation" },
+ { "CZC", "Shenzhen ChuangZhiCheng Technology Co., Ltd." },
+ { "CZE", "Carl Zeiss AG" },
+ { "DAC", "Digital Acoustics Corporation" },
+ { "DAE", "Digatron Industrie Elektronik GmbH" },
+ { "DAI", "DAIS SET Ltd." },
+ { "DAK", "Daktronics" },
+ { "DAL", "Digital Audio Labs Inc" },
+ { "DAN", "Danelec Marine A/S" },
+ { "DAS", "DAVIS AS" },
+ { "DAT", "Datel Inc" },
+ { "DAU", "Daou Tech Inc" },
+ { "DAV", "Davicom Semiconductor Inc" },
+ { "DAW", "DA2 Technologies Inc" },
+ { "DAX", "Data Apex Ltd" },
+ { "DBD", "Diebold Inc." },
+ { "DBI", "DigiBoard Inc" },
+ { "DBK", "Databook Inc" },
+ { "DBL", "Doble Engineering Company" },
+ { "DBN", "DB Networks Inc" },
+ { "DCA", "Digital Communications Association" },
+ { "DCC", "Dale Computer Corporation" },
+ { "DCD", "Datacast LLC" },
+ { "DCE", "dSPACE GmbH" },
+ { "DCI", "Concepts Inc" },
+ { "DCL", "Dynamic Controls Ltd" },
+ { "DCM", "DCM Data Products" },
+ { "DCO", "Dialogue Technology Corporation" },
+ { "DCR", "Decros Ltd" },
+ { "DCS", "Diamond Computer Systems Inc" },
+ { "DCT", "Dancall Telecom A/S" },
+ { "DCV", "Datatronics Technology Inc" },
+ { "DDA", "DA2 Technologies Corporation" },
+ { "DDD", "Danka Data Devices" },
+ { "DDE", "Datasat Digital Entertainment" },
+ { "DDI", "Data Display AG" },
+ { "DDS", "Barco, N.V." },
+ { "DDT", "Datadesk Technologies Inc" },
+ { "DDV", "Delta Information Systems, Inc" },
+ { "DEC", "Digital Equipment Corporation" },
+ { "DEI", "Deico Electronics" },
+ { "DEL", "Dell Inc." },
+ { "DEN", "Densitron Computers Ltd" },
+ { "DEX", "idex displays" },
+ { "DFI", "DFI" },
+ { "DFK", "SharkTec A/S" },
+ { "DFT", "DEI Holdings dba Definitive Technology" },
+ { "DGA", "Digiital Arts Inc" },
+ { "DGC", "Data General Corporation" },
+ { "DGI", "DIGI International" },
+ { "DGK", "DugoTech Co., LTD" },
+ { "DGP", "Digicorp European sales S.A." },
+ { "DGS", "Diagsoft Inc" },
+ { "DGT", "Dearborn Group Technology" },
+ { "DHD", "Dension Audio Systems" },
+ { "DHP", "DH Print" },
+ { "DHQ", "Quadram" },
+ { "DHT", "Projectavision Inc" },
+ { "DIA", "Diadem" },
+ { "DIG", "Digicom S.p.A." },
+ { "DII", "Dataq Instruments Inc" },
+ { "DIM", "dPict Imaging, Inc." },
+ { "DIN", "Daintelecom Co., Ltd" },
+ { "DIS", "Diseda S.A." },
+ { "DIT", "Dragon Information Technology" },
+ { "DJE", "Capstone Visual Product Development" },
+ { "DJP", "Maygay Machines, Ltd" },
+ { "DKY", "Datakey Inc" },
+ { "DLB", "Dolby Laboratories Inc." },
+ { "DLC", "Diamond Lane Comm. Corporation" },
+ { "DLG", "Digital-Logic GmbH" },
+ { "DLK", "D-Link Systems Inc" },
+ { "DLL", "Dell Inc" },
+ { "DLO", "Shenzhen Dlodlo Technologies Co., Ltd." },
+ { "DLT", "Digitelec Informatique Park Cadera" },
+ { "DMB", "Digicom Systems Inc" },
+ { "DMC", "Dune Microsystems Corporation" },
+ { "DMM", "Dimond Multimedia Systems Inc" },
+ { "DMN", "Dimension Engineering LLC" },
+ { "DMO", "Data Modul AG" },
+ { "DMP", "D&M Holdings Inc, Professional Business Company" },
+ { "DMS", "DOME imaging systems" },
+ { "DMT", "Distributed Management Task Force, Inc. (DMTF)" },
+ { "DMV", "NDS Ltd" },
+ { "DNA", "DNA Enterprises, Inc." },
+ { "DNG", "Apache Micro Peripherals Inc" },
+ { "DNI", "Deterministic Networks Inc." },
+ { "DNT", "Dr. Neuhous Telekommunikation GmbH" },
+ { "DNV", "DiCon" },
+ { "DOL", "Dolman Technologies Group Inc" },
+ { "DOM", "Dome Imaging Systems" },
+ { "DON", "DENON, Ltd." },
+ { "DOT", "Dotronic Mikroelektronik GmbH" },
+ { "DPA", "DigiTalk Pro AV" },
+ { "DPC", "Delta Electronics Inc" },
+ { "DPH", "Delphi Automotive LLP" },
+ { "DPI", "DocuPoint" },
+ { "DPL", "Digital Projection Limited" },
+ { "DPM", "ADPM Synthesis sas" },
+ { "DPN", "Shanghai Lexiang Technology Limited" },
+ { "DPS", "Digital Processing Systems" },
+ { "DPT", "DPT" },
+ { "DPX", "DpiX, Inc." },
+ { "DQB", "Datacube Inc" },
+ { "DRB", "Dr. Bott KG" },
+ { "DRC", "Data Ray Corp." },
+ { "DRD", "DIGITAL REFLECTION INC." },
+ { "DRI", "Data Race Inc" },
+ { "DRS", "DRS Defense Solutions, LLC" },
+ { "DSA", "Display Solution AG" },
+ { "DSD", "DS Multimedia Pte Ltd" },
+ { "DSG", "Disguise Technologies" },
+ { "DSI", "Digitan Systems Inc" },
+ { "DSJ", "VR Technology Holdings Limited" },
+ { "DSM", "DSM Digital Services GmbH" },
+ { "DSP", "Domain Technology Inc" },
+ { "DTA", "DELTATEC" },
+ { "DTC", "DTC Tech Corporation" },
+ { "DTE", "Dimension Technologies, Inc." },
+ { "DTI", "Diversified Technology, Inc." },
+ { "DTK", "Dynax Electronics (HK) Ltd" },
+ { "DTL", "e-Net Inc" },
+ { "DTN", "Datang Telephone Co" },
+ { "DTO", "Deutsche Thomson OHG" },
+ { "DTT", "Design & Test Technology, Inc." },
+ { "DTX", "Data Translation" },
+ { "DUA", "Dosch & Amand GmbH & Company KG" },
+ { "DUN", "NCR Corporation" },
+ { "DVD", "Dictaphone Corporation" },
+ { "DVL", "Devolo AG" },
+ { "DVS", "Digital Video System" },
+ { "DVT", "Data Video" },
+ { "DWE", "Daewoo Electronics Company Ltd" },
+ { "DXC", "Digipronix Control Systems" },
+ { "DXD", "DECIMATOR DESIGN PTY LTD" },
+ { "DXL", "Dextera Labs Inc" },
+ { "DXP", "Data Expert Corporation" },
+ { "DXS", "Signet" },
+ { "DYC", "Dycam Inc" },
+ { "DYM", "Dymo-CoStar Corporation" },
+ { "DYN", "Askey Computer Corporation" },
+ { "DYX", "Dynax Electronics (HK) Ltd" },
+ { "EAG", "ELTEC Elektronik AG" },
+ { "EAS", "Evans and Sutherland Computer" },
+ { "EBH", "Data Price Informatica" },
+ { "EBS", "EBS Euchner Büro- und Schulsysteme GmbH" },
+ { "EBT", "HUALONG TECHNOLOGY CO., LTD" },
+ { "ECA", "Electro Cam Corp." },
+ { "ECC", "ESSential Comm. Corporation" },
+ { "ECH", "EchoStar Corporation" },
+ { "ECI", "Enciris Technologies" },
+ { "ECK", "Eugene Chukhlomin Sole Proprietorship, d.b.a." },
+ { "ECL", "Excel Company Ltd" },
+ { "ECM", "E-Cmos Tech Corporation" },
+ { "ECO", "Echo Speech Corporation" },
+ { "ECP", "Elecom Company Ltd" },
+ { "ECS", "Elitegroup Computer Systems Company Ltd" },
+ { "ECT", "Enciris Technologies" },
+ { "EDC", "e.Digital Corporation" },
+ { "EDG", "Electronic-Design GmbH" },
+ { "EDI", "Edimax Tech. Company Ltd" },
+ { "EDM", "EDMI" },
+ { "EDT", "Emerging Display Technologies Corp" },
+ { "EEE", "ET&T Technology Company Ltd" },
+ { "EEH", "EEH Datalink GmbH" },
+ { "EEP", "E.E.P.D. GmbH" },
+ { "EES", "EE Solutions, Inc." },
+ { "EGA", "Elgato Systems LLC" },
+ { "EGD", "EIZO GmbH Display Technologies" },
+ { "EGL", "Eagle Technology" },
+ { "EGN", "Egenera, Inc." },
+ { "EGO", "Ergo Electronics" },
+ { "EHJ", "Epson Research" },
+ { "EHN", "Enhansoft" },
+ { "EIC", "Eicon Technology Corporation" },
+ { "EIN", "Elegant Invention" },
+ { "EKA", "MagTek Inc." },
+ { "EKC", "Eastman Kodak Company" },
+ { "EKS", "EKSEN YAZILIM" },
+ { "ELA", "ELAD srl" },
+ { "ELC", "Electro Scientific Ind" },
+ { "ELD", "Express Luck, Inc." },
+ { "ELE", "Elecom Company Ltd" },
+ { "ELG", "Elmeg GmbH Kommunikationstechnik" },
+ { "ELI", "Edsun Laboratories" },
+ { "ELL", "Electrosonic Ltd" },
+ { "ELM", "Elmic Systems Inc" },
+ { "ELO", "Elo TouchSystems Inc" },
+ { "ELS", "ELSA GmbH" },
+ { "ELT", "Element Labs, Inc." },
+ { "ELU", "Express Industrial, Ltd." },
+ { "ELX", "Elonex PLC" },
+ { "EMB", "Embedded computing inc ltd" },
+ { "EMC", "eMicro Corporation" },
+ { "EMD", "Embrionix Design Inc." },
+ { "EME", "EMiNE TECHNOLOGY COMPANY, LTD." },
+ { "EMG", "EMG Consultants Inc" },
+ { "EMI", "Ex Machina Inc" },
+ { "EMK", "Emcore Corporation" },
+ { "EMO", "ELMO COMPANY, LIMITED" },
+ { "EMU", "Emulex Corporation" },
+ { "ENC", "Eizo Nanao Corporation" },
+ { "END", "ENIDAN Technologies Ltd" },
+ { "ENE", "ENE Technology Inc." },
+ { "ENI", "Efficient Networks" },
+ { "ENS", "Ensoniq Corporation" },
+ { "ENT", "Enterprise Comm. & Computing Inc" },
+ { "EON", "Eon Instrumentation, Inc." },
+ { "EPC", "Empac" },
+ { "EPH", "Epiphan Systems Inc." },
+ { "EPI", "Envision Peripherals, Inc" },
+ { "EPN", "EPiCON Inc." },
+ { "EPS", "KEPS" },
+ { "EQP", "Equipe Electronics Ltd." },
+ { "EQX", "Equinox Systems Inc" },
+ { "ERG", "Ergo System" },
+ { "ERI", "Ericsson Mobile Communications AB" },
+ { "ERN", "Ericsson, Inc." },
+ { "ERP", "Euraplan GmbH" },
+ { "ERS", "Eizo Rugged Solutions" },
+ { "ERT", "Escort Insturments Corporation" },
+ { "ESA", "Elbit Systems of America" },
+ { "ESB", "Esterline Belgium BVBA" },
+ { "ESC", "Eden Sistemas de Computacao S/A" },
+ { "ESD", "Ensemble Designs, Inc" },
+ { "ESG", "ELCON Systemtechnik GmbH" },
+ { "ESI", "Extended Systems, Inc." },
+ { "ESK", "ES&S" },
+ { "ESL", "Esterline Technologies" },
+ { "ESN", "eSATURNUS" },
+ { "ESS", "ESS Technology Inc" },
+ { "EST", "Embedded Solution Technology" },
+ { "ESY", "E-Systems Inc" },
+ { "ETC", "Everton Technology Company Ltd" },
+ { "ETD", "ELAN MICROELECTRONICS CORPORATION" },
+ { "ETH", "Etherboot Project" },
+ { "ETI", "Eclipse Tech Inc" },
+ { "ETK", "eTEK Labs Inc." },
+ { "ETL", "Evertz Microsystems Ltd." },
+ { "ETS", "Electronic Trade Solutions Ltd" },
+ { "ETT", "E-Tech Inc" },
+ { "EUT", "Ericsson Mobile Networks B.V." },
+ { "EVE", "Advanced Micro Peripherals Ltd" },
+ { "EVI", "eviateg GmbH" },
+ { "EVX", "Everex" },
+ { "EXA", "Exabyte" },
+ { "EXC", "Excession Audio" },
+ { "EXI", "Exide Electronics" },
+ { "EXN", "RGB Systems, Inc. dba Extron Electronics" },
+ { "EXP", "Data Export Corporation" },
+ { "EXR", "Explorer Inc." },
+ { "EXT", "Exatech Computadores & Servicos Ltda" },
+ { "EXX", "Exxact GmbH" },
+ { "EXY", "Exterity Ltd" },
+ { "EYE", "eyevis GmbH" },
+ { "EYF", "eyefactive Gmbh" },
+ { "EZE", "EzE Technologies" },
+ { "EZP", "Storm Technology" },
+ { "FAN", "Fantalooks Co., Ltd." },
+ { "FAR", "Farallon Computing" },
+ { "FBI", "Interface Corporation" },
+ { "FCB", "Furukawa Electric Company Ltd" },
+ { "FCG", "First International Computer Ltd" },
+ { "FCS", "Focus Enhancements, Inc." },
+ { "FDC", "Future Domain" },
+ { "FDD", "Forth Dimension Displays Ltd" },
+ { "FDI", "Future Designs, Inc." },
+ { "FDT", "Fujitsu Display Technologies Corp." },
+ { "FDX", "Findex, Inc." },
+ { "FEC", "FURUNO ELECTRIC CO., LTD." },
+ { "FEL", "Fellowes & Questec" },
+ { "FEN", "Fen Systems Ltd." },
+ { "FER", "Ferranti Int'L" },
+ { "FFC", "FUJIFILM Corporation" },
+ { "FFI", "Fairfield Industries" },
+ { "FGD", "Lisa Draexlmaier GmbH" },
+ { "FGL", "Fujitsu General Limited." },
+ { "FHL", "FHLP" },
+ { "FIC", "Formosa Industrial Computing Inc" },
+ { "FIL", "Forefront Int'l Ltd" },
+ { "FIN", "Finecom Co., Ltd." },
+ { "FIR", "Chaplet Systems Inc" },
+ { "FIS", "FLY-IT Simulators" },
+ { "FIT", "Feature Integration Technology Inc." },
+ { "FJC", "Fujitsu Takamisawa Component Limited" },
+ { "FJS", "Fujitsu Spain" },
+ { "FJT", "F.J. Tieman BV" },
+ { "FLE", "ADTI Media, Inc" },
+ { "FLI", "Faroudja Laboratories" },
+ { "FLY", "Butterfly Communications" },
+ { "FMA", "Fast Multimedia AG" },
+ { "FMC", "Ford Microelectronics Inc" },
+ { "FMI", "Fellowes, Inc." },
+ { "FML", "Fujitsu Microelect Ltd" },
+ { "FMZ", "Formoza-Altair" },
+ { "FNC", "Fanuc LTD" },
+ { "FNI", "Funai Electric Co., Ltd." },
+ { "FOA", "FOR-A Company Limited" },
+ { "FOK", "Fokus Technologies GmbH" },
+ { "FOS", "Foss Tecator" },
+ { "FOV", "FOVE INC" },
+ { "FOX", "HON HAI PRECISON IND.CO.,LTD." },
+ { "FPC", "Fingerprint Cards AB" },
+ { "FPE", "Fujitsu Peripherals Ltd" },
+ { "FPS", "Deltec Corporation" },
+ { "FPX", "Cirel Systemes" },
+ { "FRC", "Force Computers" },
+ { "FRD", "Freedom Scientific BLV" },
+ { "FRE", "Forvus Research Inc" },
+ { "FRI", "Fibernet Research Inc" },
+ { "FRO", "FARO Technologies" },
+ { "FRS", "South Mountain Technologies, LTD" },
+ { "FSC", "Future Systems Consulting KK" },
+ { "FSI", "Fore Systems Inc" },
+ { "FST", "Modesto PC Inc" },
+ { "FTC", "Futuretouch Corporation" },
+ { "FTE", "Frontline Test Equipment Inc." },
+ { "FTG", "FTG Data Systems" },
+ { "FTI", "FastPoint Technologies, Inc." },
+ { "FTL", "FUJITSU TEN LIMITED" },
+ { "FTN", "Fountain Technologies Inc" },
+ { "FTR", "Mediasonic" },
+ { "FTS", "FocalTech Systems Co., Ltd." },
+ { "FTW", "MindTribe Product Engineering, Inc." },
+ { "FUJ", "Fujitsu Ltd" },
+ { "FUN", "sisel muhendislik" },
+ { "FUS", "Fujitsu Siemens Computers GmbH" },
+ { "FVC", "First Virtual Corporation" },
+ { "FVX", "C-C-C Group Plc" },
+ { "FWA", "Attero Tech, LLC" },
+ { "FWR", "Flat Connections Inc" },
+ { "FXX", "Fuji Xerox" },
+ { "FZC", "Founder Group Shenzhen Co." },
+ { "FZI", "FZI Forschungszentrum Informatik" },
+ { "GAC", "GreenArrays, Inc." },
+ { "GAG", "Gage Applied Sciences Inc" },
+ { "GAL", "Galil Motion Control" },
+ { "GAU", "Gaudi Co., Ltd." },
+ { "GBT", "GIGA-BYTE TECHNOLOGY CO., LTD." },
+ { "GCC", "GCC Technologies Inc" },
+ { "GCI", "Gateway Comm. Inc" },
+ { "GCS", "Grey Cell Systems Ltd" },
+ { "GDC", "General Datacom" },
+ { "GDI", "G. Diehl ISDN GmbH" },
+ { "GDS", "GDS" },
+ { "GDT", "Vortex Computersysteme GmbH" },
+ { "GEC", "Gechic Corporation" },
+ { "GED", "General Dynamics C4 Systems" },
+ { "GEF", "GE Fanuc Embedded Systems" },
+ { "GEH", "Abaco Systems, Inc." },
+ { "GEM", "Gem Plus" },
+ { "GEN", "Genesys ATE Inc" },
+ { "GEO", "GEO Sense" },
+ { "GER", "GERMANEERS GmbH" },
+ { "GES", "GES Singapore Pte Ltd" },
+ { "GET", "Getac Technology Corporation" },
+ { "GFM", "GFMesstechnik GmbH" },
+ { "GFN", "Gefen Inc." },
+ { "GGL", "Google Inc." },
+ { "GGT", "G2TOUCH KOREA" },
+ { "GIC", "General Inst. Corporation" },
+ { "GIM", "Guillemont International" },
+ { "GIP", "GI Provision Ltd" },
+ { "GIS", "AT&T Global Info Solutions" },
+ { "GJN", "Grand Junction Networks" },
+ { "GLD", "Goldmund - Digital Audio SA" },
+ { "GLE", "AD electronics" },
+ { "GLM", "Genesys Logic" },
+ { "GLS", "Gadget Labs LLC" },
+ { "GMK", "GMK Electronic Design GmbH" },
+ { "GML", "General Information Systems" },
+ { "GMM", "GMM Research Inc" },
+ { "GMN", "GEMINI 2000 Ltd" },
+ { "GMX", "GMX Inc" },
+ { "GND", "Gennum Corporation" },
+ { "GNN", "GN Nettest Inc" },
+ { "GNZ", "Gunze Ltd" },
+ { "GOE", "GOEPEL electronic GmbH" },
+ { "GPR", "GoPro, Inc." },
+ { "GRA", "Graphica Computer" },
+ { "GRE", "GOLD RAIN ENTERPRISES CORP." },
+ { "GRH", "Granch Ltd" },
+ { "GRM", "Garmin International" },
+ { "GRV", "Advanced Gravis" },
+ { "GRY", "Robert Gray Company" },
+ { "GSB", "NIPPONDENCHI CO,.LTD" },
+ { "GSC", "General Standards Corporation" },
+ { "GSM", "LG Electronics" },
+ { "GSN", "Grandstream Networks, Inc." },
+ { "GST", "Graphic SystemTechnology" },
+ { "GSY", "Grossenbacher Systeme AG" },
+ { "GTC", "Graphtec Corporation" },
+ { "GTI", "Goldtouch" },
+ { "GTK", "G-Tech Corporation" },
+ { "GTM", "Garnet System Company Ltd" },
+ { "GTS", "Geotest Marvin Test Systems Inc" },
+ { "GTT", "General Touch Technology Co., Ltd." },
+ { "GUD", "Guntermann & Drunck GmbH" },
+ { "GUZ", "Guzik Technical Enterprises" },
+ { "GVC", "GVC Corporation" },
+ { "GVL", "Global Village Communication" },
+ { "GWI", "GW Instruments" },
+ { "GWK", "Gateworks Corporation" },
+ { "GWY", "Gateway 2000" },
+ { "GZE", "GUNZE Limited" },
+ { "HAE", "Haider electronics" },
+ { "HAI", "Haivision Systems Inc." },
+ { "HAL", "Halberthal" },
+ { "HAN", "Hanchang System Corporation" },
+ { "HAR", "Harris Corporation" },
+ { "HAY", "Hayes Microcomputer Products Inc" },
+ { "HCA", "DAT" },
+ { "HCE", "Hitachi Consumer Electronics Co., Ltd" },
+ { "HCL", "HCL America Inc" },
+ { "HCM", "HCL Peripherals" },
+ { "HCP", "Hitachi Computer Products Inc" },
+ { "HCW", "Hauppauge Computer Works Inc" },
+ { "HDC", "HardCom Elektronik & Datateknik" },
+ { "HDI", "HD-INFO d.o.o." },
+ { "HDV", "Holografika kft." },
+ { "HEC", "Hisense Electric Co., Ltd." },
+ { "HEL", "Hitachi Micro Systems Europe Ltd" },
+ { "HER", "Ascom Business Systems" },
+ { "HET", "HETEC Datensysteme GmbH" },
+ { "HHC", "HIRAKAWA HEWTECH CORP." },
+ { "HHI", "Fraunhofer Heinrich-Hertz-Institute" },
+ { "HIB", "Hibino Corporation" },
+ { "HIC", "Hitachi Information Technology Co., Ltd." },
+ { "HII", "Harman International Industries, Inc" },
+ { "HIK", "Hikom Co., Ltd." },
+ { "HIL", "Hilevel Technology" },
+ { "HIQ", "Kaohsiung Opto Electronics Americas, Inc." },
+ { "HIS", "Hope Industrial Systems, Inc." },
+ { "HIT", "Hitachi America Ltd" },
+ { "HJI", "Harris & Jeffries Inc" },
+ { "HKA", "HONKO MFG. CO., LTD." },
+ { "HKC", "HKC OVERSEAS LIMITED" },
+ { "HKG", "Josef Heim KG" },
+ { "HLG", "China Hualu Group Co., Ltd." },
+ { "HMC", "Hualon Microelectric Corporation" },
+ { "HMK", "hmk Daten-System-Technik BmbH" },
+ { "HMX", "HUMAX Co., Ltd." },
+ { "HNS", "Hughes Network Systems" },
+ { "HOB", "HOB Electronic GmbH" },
+ { "HOE", "Hosiden Corporation" },
+ { "HOL", "Holoeye Photonics AG" },
+ { "HON", "Sonitronix" },
+ { "HPA", "Zytor Communications" },
+ { "HPC", "Hewlett-Packard Co." },
+ { "HPD", "Hewlett Packard" },
+ { "HPE", "Hewlett Packard Enterprise" },
+ { "HPI", "Headplay, Inc." },
+ { "HPK", "HAMAMATSU PHOTONICS K.K." },
+ { "HPN", "HP Inc." },
+ { "HPQ", "Hewlett-Packard Co." },
+ { "HPR", "H.P.R. Electronics GmbH" },
+ { "HRC", "Hercules" },
+ { "HRE", "Qingdao Haier Electronics Co., Ltd." },
+ { "HRI", "Hall Research" },
+ { "HRL", "Herolab GmbH" },
+ { "HRS", "Harris Semiconductor" },
+ { "HRT", "HERCULES" },
+ { "HSC", "Hagiwara Sys-Com Company Ltd" },
+ { "HSD", "HannStar Display Corp" },
+ { "HSM", "AT&T Microelectronics" },
+ { "HSP", "HannStar Display Corp" },
+ { "HST", "Horsent Technology Co., Ltd." },
+ { "HTC", "Hitachi Ltd" },
+ { "HTI", "Hampshire Company, Inc." },
+ { "HTK", "Holtek Microelectronics Inc" },
+ { "HTL", "HTBLuVA Mödling" },
+ { "HTR", "Shenzhen ZhuoYi HengTong Computer Technology Limited" },
+ { "HTX", "Hitex Systementwicklung GmbH" },
+ { "HUB", "GAI-Tronics, A Hubbell Company" },
+ { "HUK", "Hoffmann + Krippner GmbH" },
+ { "HUM", "IMP Electronics Ltd." },
+ { "HVR", "HTC Corportation" },
+ { "HWA", "Harris Canada Inc" },
+ { "HWC", "DBA Hans Wedemeyer" },
+ { "HWD", "Highwater Designs Ltd" },
+ { "HWP", "Hewlett Packard" },
+ { "HWV", "Huawei Technologies Co., Inc." },
+ { "HXM", "Hexium Ltd." },
+ { "HYC", "Hypercope Gmbh Aachen" },
+ { "HYD", "Hydis Technologies.Co.,LTD" },
+ { "HYL", "Shanghai Chai Ming Huang Info&Tech Co, Ltd" },
+ { "HYO", "HYC CO., LTD." },
+ { "HYP", "Hyphen Ltd" },
+ { "HYR", "Hypertec Pty Ltd" },
+ { "HYT", "Heng Yu Technology (HK) Limited" },
+ { "HYV", "Hynix Semiconductor" },
+ { "IAD", "IAdea Corporation" },
+ { "IAF", "Institut f r angewandte Funksystemtechnik GmbH" },
+ { "IAI", "Integration Associates, Inc." },
+ { "IAT", "IAT Germany GmbH" },
+ { "IBC", "Integrated Business Systems" },
+ { "IBI", "INBINE.CO.LTD" },
+ { "IBM", "IBM Brasil" },
+ { "IBP", "IBP Instruments GmbH" },
+ { "IBR", "IBR GmbH" },
+ { "ICA", "ICA Inc" },
+ { "ICC", "BICC Data Networks Ltd" },
+ { "ICD", "ICD Inc" },
+ { "ICE", "IC Ensemble" },
+ { "ICI", "Infotek Communication Inc" },
+ { "ICM", "Intracom SA" },
+ { "ICN", "Sanyo Icon" },
+ { "ICO", "Intel Corp" },
+ { "ICP", "ICP Electronics, Inc./iEi Technology Corp." },
+ { "ICR", "Icron" },
+ { "ICS", "Integrated Circuit Systems" },
+ { "ICV", "Inside Contactless" },
+ { "ICX", "ICCC A/S" },
+ { "IDC", "International Datacasting Corporation" },
+ { "IDE", "IDE Associates" },
+ { "IDK", "IDK Corporation" },
+ { "IDN", "Idneo Technologies" },
+ { "IDO", "IDEO Product Development" },
+ { "IDP", "Integrated Device Technology, Inc." },
+ { "IDS", "Interdigital Sistemas de Informacao" },
+ { "IDT", "International Display Technology" },
+ { "IDX", "IDEXX Labs" },
+ { "IEC", "Interlace Engineering Corporation" },
+ { "IEE", "IEE" },
+ { "IEI", "Interlink Electronics" },
+ { "IFS", "In Focus Systems Inc" },
+ { "IFT", "Informtech" },
+ { "IFX", "Infineon Technologies AG" },
+ { "IFZ", "Infinite Z" },
+ { "IGC", "Intergate Pty Ltd" },
+ { "IGM", "IGM Communi" },
+ { "IHE", "InHand Electronics" },
+ { "IIC", "ISIC Innoscan Industrial Computers A/S" },
+ { "III", "Intelligent Instrumentation" },
+ { "IIN", "IINFRA Co., Ltd" },
+ { "IIT", "Informatik Information Technologies" },
+ { "IKE", "Ikegami Tsushinki Co. Ltd." },
+ { "IKS", "Ikos Systems Inc" },
+ { "ILC", "Image Logic Corporation" },
+ { "ILS", "Innotech Corporation" },
+ { "IMA", "Imagraph" },
+ { "IMB", "ART s.r.l." },
+ { "IMC", "IMC Networks" },
+ { "IMD", "ImasDe Canarias S.A." },
+ { "IME", "Imagraph" },
+ { "IMF", "Immersive Audio Technologies France" },
+ { "IMG", "IMAGENICS Co., Ltd." },
+ { "IMI", "International Microsystems Inc" },
+ { "IMM", "Immersion Corporation" },
+ { "IMN", "Impossible Production" },
+ { "IMP", "Impinj" },
+ { "IMT", "Inmax Technology Corporation" },
+ { "INA", "Inventec Corporation" },
+ { "INC", "Home Row Inc" },
+ { "IND", "ILC" },
+ { "INE", "Inventec Electronics (M) Sdn. Bhd." },
+ { "INF", "Inframetrics Inc" },
+ { "ING", "Integraph Corporation" },
+ { "INI", "Initio Corporation" },
+ { "INK", "Indtek Co., Ltd." },
+ { "INL", "InnoLux Display Corporation" },
+ { "INM", "InnoMedia Inc" },
+ { "INN", "Innovent Systems, Inc." },
+ { "INO", "Innolab Pte Ltd" },
+ { "INP", "Interphase Corporation" },
+ { "INS", "Ines GmbH" },
+ { "INT", "Interphase Corporation" },
+ { "INU", "Inovatec S.p.A." },
+ { "INV", "Inviso, Inc." },
+ { "INX", "Communications Supply Corporation (A division of WESCO)" },
+ { "INZ", "Best Buy" },
+ { "IOA", "CRE Technology Corporation" },
+ { "IOD", "I-O Data Device Inc" },
+ { "IOM", "Iomega" },
+ { "ION", "Inside Out Networks" },
+ { "IOS", "i-O Display System" },
+ { "IOT", "I/OTech Inc" },
+ { "IPC", "IPC Corporation" },
+ { "IPD", "Industrial Products Design, Inc." },
+ { "IPI", "Intelligent Platform Management Interface (IPMI) forum (Intel, HP, NEC, Dell)" },
+ { "IPM", "IPM Industria Politecnica Meridionale SpA" },
+ { "IPN", "Performance Technologies" },
+ { "IPP", "IP Power Technologies GmbH" },
+ { "IPQ", "IP3 Technology Ltd." },
+ { "IPR", "Ithaca Peripherals" },
+ { "IPS", "IPS, Inc. (Intellectual Property Solutions, Inc.)" },
+ { "IPT", "International Power Technologies" },
+ { "IPW", "IPWireless, Inc" },
+ { "IQI", "IneoQuest Technologies, Inc" },
+ { "IQT", "IMAGEQUEST Co., Ltd" },
+ { "IRD", "Irdata" },
+ { "ISA", "Symbol Technologies" },
+ { "ISC", "Id3 Semiconductors" },
+ { "ISG", "Insignia Solutions Inc" },
+ { "ISI", "Interface Solutions" },
+ { "ISL", "Isolation Systems" },
+ { "ISM", "Image Stream Medical" },
+ { "ISP", "IntreSource Systems Pte Ltd" },
+ { "ISR", "INSIS Co., LTD." },
+ { "ISS", "ISS Inc" },
+ { "IST", "Intersolve Technologies" },
+ { "ISY", "International Integrated Systems,Inc.(IISI)" },
+ { "ITA", "Itausa Export North America" },
+ { "ITC", "Intercom Inc" },
+ { "ITD", "Internet Technology Corporation" },
+ { "ITE", "Integrated Tech Express Inc" },
+ { "ITI", "VanErum Group" },
+ { "ITK", "ITK Telekommunikation AG" },
+ { "ITL", "Inter-Tel" },
+ { "ITM", "ITM inc." },
+ { "ITN", "The NTI Group" },
+ { "ITP", "IT-PRO Consulting und Systemhaus GmbH" },
+ { "ITR", "Infotronic America, Inc." },
+ { "ITS", "IDTECH" },
+ { "ITT", "I&T Telecom." },
+ { "ITX", "integrated Technology Express Inc" },
+ { "IUC", "ICSL" },
+ { "IVI", "Intervoice Inc" },
+ { "IVM", "Iiyama North America" },
+ { "IVR", "Inlife-Handnet Co., Ltd." },
+ { "IVS", "Intevac Photonics Inc." },
+ { "IWR", "Icuiti Corporation" },
+ { "IWX", "Intelliworxx, Inc." },
+ { "IXD", "Intertex Data AB" },
+ { "IXN", "Shenzhen Inet Mobile Internet Technology Co., LTD" },
+ { "JAC", "Astec Inc" },
+ { "JAE", "Japan Aviation Electronics Industry, Limited" },
+ { "JAS", "Janz Automationssysteme AG" },
+ { "JAT", "Jaton Corporation" },
+ { "JAZ", "Carrera Computer Inc" },
+ { "JCE", "Jace Tech Inc" },
+ { "JDI", "Japan Display Inc." },
+ { "JDL", "Japan Digital Laboratory Co.,Ltd." },
+ { "JEM", "Japan E.M.Solutions Co., Ltd." },
+ { "JEN", "N-Vision" },
+ { "JET", "JET POWER TECHNOLOGY CO., LTD." },
+ { "JFX", "Jones Futurex Inc" },
+ { "JGD", "University College" },
+ { "JIC", "Jaeik Information & Communication Co., Ltd." },
+ { "JKC", "JVC KENWOOD Corporation" },
+ { "JMT", "Micro Technical Company Ltd" },
+ { "JPC", "JPC Technology Limited" },
+ { "JPW", "Wallis Hamilton Industries" },
+ { "JQE", "CNet Technical Inc" },
+ { "JSD", "JS DigiTech, Inc" },
+ { "JSI", "Jupiter Systems, Inc." },
+ { "JSK", "SANKEN ELECTRIC CO., LTD" },
+ { "JTS", "JS Motorsports" },
+ { "JTY", "jetway security micro,inc" },
+ { "JUK", "Janich & Klass Computertechnik GmbH" },
+ { "JUP", "Jupiter Systems" },
+ { "JVC", "JVC" },
+ { "JWD", "Video International Inc." },
+ { "JWL", "Jewell Instruments, LLC" },
+ { "JWS", "JWSpencer & Co." },
+ { "JWY", "Jetway Information Co., Ltd" },
+ { "KAR", "Karna" },
+ { "KBI", "Kidboard Inc" },
+ { "KBL", "Kobil Systems GmbH" },
+ { "KCD", "Chunichi Denshi Co.,LTD." },
+ { "KCL", "Keycorp Ltd" },
+ { "KDE", "KDE" },
+ { "KDK", "Kodiak Tech" },
+ { "KDM", "Korea Data Systems Co., Ltd." },
+ { "KDS", "KDS USA" },
+ { "KDT", "KDDI Technology Corporation" },
+ { "KEC", "Kyushu Electronics Systems Inc" },
+ { "KEM", "Kontron Embedded Modules GmbH" },
+ { "KES", "Kesa Corporation" },
+ { "KEU", "Kontron Europe GmbH" },
+ { "KEY", "Key Tech Inc" },
+ { "KFC", "SCD Tech" },
+ { "KFE", "Komatsu Forest" },
+ { "KFX", "Kofax Image Products" },
+ { "KGI", "Klipsch Group, Inc" },
+ { "KGL", "KEISOKU GIKEN Co.,Ltd." },
+ { "KIO", "Kionix, Inc." },
+ { "KIS", "KiSS Technology A/S" },
+ { "KMC", "Mitsumi Company Ltd" },
+ { "KME", "KIMIN Electronics Co., Ltd." },
+ { "KML", "Kensington Microware Ltd" },
+ { "KMR", "Kramer Electronics Ltd. International" },
+ { "KNC", "Konica corporation" },
+ { "KNX", "Nutech Marketing PTL" },
+ { "KOB", "Kobil Systems GmbH" },
+ { "KOD", "Eastman Kodak Company" },
+ { "KOE", "KOLTER ELECTRONIC" },
+ { "KOL", "Kollmorgen Motion Technologies Group" },
+ { "KOM", "Kontron GmbH" },
+ { "KOU", "KOUZIRO Co.,Ltd." },
+ { "KOW", "KOWA Company,LTD." },
+ { "KPC", "King Phoenix Company" },
+ { "KPT", "TPK Holding Co., Ltd" },
+ { "KRL", "Krell Industries Inc." },
+ { "KRM", "Kroma Telecom" },
+ { "KRY", "Kroy LLC" },
+ { "KSC", "Kinetic Systems Corporation" },
+ { "KSG", "KUPA China Shenzhen Micro Technology Co., Ltd. Gold Institute" },
+ { "KSL", "Karn Solutions Ltd." },
+ { "KSX", "King Tester Corporation" },
+ { "KTC", "Kingston Tech Corporation" },
+ { "KTD", "Takahata Electronics Co.,Ltd." },
+ { "KTE", "K-Tech" },
+ { "KTG", "Kayser-Threde GmbH" },
+ { "KTI", "Konica Technical Inc" },
+ { "KTK", "Key Tronic Corporation" },
+ { "KTN", "Katron Tech Inc" },
+ { "KTS", "Kyokko Communication System Co., Ltd." },
+ { "KUR", "Kurta Corporation" },
+ { "KVA", "Kvaser AB" },
+ { "KVX", "KeyView" },
+ { "KWD", "Kenwood Corporation" },
+ { "KYC", "Kyocera Corporation" },
+ { "KYE", "KYE Syst Corporation" },
+ { "KYK", "Samsung Electronics America Inc" },
+ { "KYN", "KEYENCE CORPORATION" },
+ { "KZI", "K-Zone International co. Ltd." },
+ { "KZN", "K-Zone International" },
+ { "LAB", "ACT Labs Ltd" },
+ { "LAC", "LaCie" },
+ { "LAF", "Microline" },
+ { "LAG", "Laguna Systems" },
+ { "LAN", "Sodeman Lancom Inc" },
+ { "LAS", "LASAT Comm. A/S" },
+ { "LAV", "Lava Computer MFG Inc" },
+ { "LBO", "Lubosoft" },
+ { "LCC", "LCI" },
+ { "LCD", "Toshiba Matsushita Display Technology Co., Ltd" },
+ { "LCE", "La Commande Electronique" },
+ { "LCI", "Lite-On Communication Inc" },
+ { "LCM", "Latitude Comm." },
+ { "LCN", "LEXICON" },
+ { "LCS", "Longshine Electronics Company" },
+ { "LCT", "Labcal Technologies" },
+ { "LDN", "Laserdyne Technologies" },
+ { "LDT", "LogiDataTech Electronic GmbH" },
+ { "LEC", "Lectron Company Ltd" },
+ { "LED", "Long Engineering Design Inc" },
+ { "LEG", "Legerity, Inc" },
+ { "LEN", "Lenovo Group Limited" },
+ { "LEO", "First International Computer Inc" },
+ { "LEX", "Lexical Ltd" },
+ { "LGC", "Logic Ltd" },
+ { "LGI", "Logitech Inc" },
+ { "LGS", "LG Semicom Company Ltd" },
+ { "LGX", "Lasergraphics, Inc." },
+ { "LHA", "Lars Haagh ApS" },
+ { "LHC", "Beihai Century Joint Innovation Technology Co.,Ltd" },
+ { "LHE", "Lung Hwa Electronics Company Ltd" },
+ { "LHT", "Lighthouse Technologies Limited" },
+ { "LIN", "Lenovo Beijing Co. Ltd." },
+ { "LIP", "Linked IP GmbH" },
+ { "LIT", "Lithics Silicon Technology" },
+ { "LJX", "Datalogic Corporation" },
+ { "LKM", "Likom Technology Sdn. Bhd." },
+ { "LLL", "L-3 Communications" },
+ { "LMG", "Lucent Technologies" },
+ { "LMI", "Lexmark Int'l Inc" },
+ { "LMP", "Leda Media Products" },
+ { "LMT", "Laser Master" },
+ { "LND", "Land Computer Company Ltd" },
+ { "LNK", "Link Tech Inc" },
+ { "LNR", "Linear Systems Ltd." },
+ { "LNT", "LANETCO International" },
+ { "LNV", "Lenovo" },
+ { "LNX", "The Linux Foundation" },
+ { "LOC", "Locamation B.V." },
+ { "LOE", "Loewe Opta GmbH" },
+ { "LOG", "Logicode Technology Inc" },
+ { "LOL", "Litelogic Operations Ltd" },
+ { "LPE", "El-PUSK Co., Ltd." },
+ { "LPI", "Design Technology" },
+ { "LPL", "LG Philips" },
+ { "LSC", "LifeSize Communications" },
+ { "LSD", "Intersil Corporation" },
+ { "LSI", "Loughborough Sound Images" },
+ { "LSJ", "LSI Japan Company Ltd" },
+ { "LSL", "Logical Solutions" },
+ { "LSP", "Lightspace Technologies" },
+ { "LSY", "LSI Systems Inc" },
+ { "LTC", "Labtec Inc" },
+ { "LTI", "Jongshine Tech Inc" },
+ { "LTK", "Lucidity Technology Company Ltd" },
+ { "LTN", "Litronic Inc" },
+ { "LTS", "LTS Scale LLC" },
+ { "LTV", "Leitch Technology International Inc." },
+ { "LTW", "Lightware, Inc" },
+ { "LUC", "Lucent Technologies" },
+ { "LUM", "Lumagen, Inc." },
+ { "LUX", "Luxxell Research Inc" },
+ { "LVI", "LVI Low Vision International AB" },
+ { "LWC", "Labway Corporation" },
+ { "LWR", "Lightware Visual Engineering" },
+ { "LWW", "Lanier Worldwide" },
+ { "LXC", "LXCO Technologies AG" },
+ { "LXN", "Luxeon" },
+ { "LXS", "ELEA CardWare" },
+ { "LZX", "Lightwell Company Ltd" },
+ { "MAC", "MAC System Company Ltd" },
+ { "MAD", "Xedia Corporation" },
+ { "MAE", "Maestro Pty Ltd" },
+ { "MAG", "MAG InnoVision" },
+ { "MAI", "Mutoh America Inc" },
+ { "MAL", "Meridian Audio Ltd" },
+ { "MAN", "LGIC" },
+ { "MAS", "Mass Inc." },
+ { "MAT", "Matsushita Electric Ind. Company Ltd" },
+ { "MAX", "Rogen Tech Distribution Inc" },
+ { "MAY", "Maynard Electronics" },
+ { "MAZ", "MAZeT GmbH" },
+ { "MBC", "MBC" },
+ { "MBD", "Microbus PLC" },
+ { "MBM", "Marshall Electronics" },
+ { "MBV", "Moreton Bay" },
+ { "MCA", "American Nuclear Systems Inc" },
+ { "MCC", "Micro Industries" },
+ { "MCD", "McDATA Corporation" },
+ { "MCE", "Metz-Werke GmbH & Co KG" },
+ { "MCG", "Motorola Computer Group" },
+ { "MCI", "Micronics Computers" },
+ { "MCJ", "Medicaroid Corporation" },
+ { "MCL", "Motorola Communications Israel" },
+ { "MCM", "Metricom Inc" },
+ { "MCN", "Micron Electronics Inc" },
+ { "MCO", "Motion Computing Inc." },
+ { "MCP", "Magni Systems Inc" },
+ { "MCQ", "Mat's Computers" },
+ { "MCR", "Marina Communicaitons" },
+ { "MCS", "Micro Computer Systems" },
+ { "MCT", "Microtec" },
+ { "MCX", "Millson Custom Solutions Inc." },
+ { "MDA", "Media4 Inc" },
+ { "MDC", "Midori Electronics" },
+ { "MDD", "MODIS" },
+ { "MDF", "MILDEF AB" },
+ { "MDG", "Madge Networks" },
+ { "MDI", "Micro Design Inc" },
+ { "MDK", "Mediatek Corporation" },
+ { "MDO", "Panasonic" },
+ { "MDR", "Medar Inc" },
+ { "MDS", "Micro Display Systems Inc" },
+ { "MDT", "Magus Data Tech" },
+ { "MDV", "MET Development Inc" },
+ { "MDX", "MicroDatec GmbH" },
+ { "MDY", "Microdyne Inc" },
+ { "MEC", "Mega System Technologies Inc" },
+ { "MED", "Messeltronik Dresden GmbH" },
+ { "MEE", "Mitsubishi Electric Engineering Co., Ltd." },
+ { "MEG", "Abeam Tech Ltd." },
+ { "MEI", "Panasonic Industry Company" },
+ { "MEJ", "Mac-Eight Co., LTD." },
+ { "MEK", "Mediaedge Corporation" },
+ { "MEL", "Mitsubishi Electric Corporation" },
+ { "MEN", "MEN Mikroelectronik Nueruberg GmbH" },
+ { "MEP", "Meld Technology" },
+ { "MEQ", "Matelect Ltd." },
+ { "MET", "Metheus Corporation" },
+ { "MEU", "MPL AG, Elektronik-Unternehmen" },
+ { "MEX", "MSC Vertriebs GmbH" },
+ { "MFG", "MicroField Graphics Inc" },
+ { "MFI", "Micro Firmware" },
+ { "MFR", "MediaFire Corp." },
+ { "MGA", "Mega System Technologies, Inc." },
+ { "MGC", "Mentor Graphics Corporation" },
+ { "MGE", "Schneider Electric S.A." },
+ { "MGL", "M-G Technology Ltd" },
+ { "MGT", "Megatech R & D Company" },
+ { "MHQ", "Moxa Inc." },
+ { "MIC", "Micom Communications Inc" },
+ { "MID", "miro Displays" },
+ { "MII", "Mitec Inc" },
+ { "MIL", "Marconi Instruments Ltd" },
+ { "MIM", "Mimio – A Newell Rubbermaid Company" },
+ { "MIN", "Minicom Digital Signage" },
+ { "MIP", "micronpc.com" },
+ { "MIR", "Miro Computer Prod." },
+ { "MIS", "Modular Industrial Solutions Inc" },
+ { "MIT", "MCM Industrial Technology GmbH" },
+ { "MIV", "MicroImage Video Systems" },
+ { "MJI", "MARANTZ JAPAN, INC." },
+ { "MJS", "MJS Designs" },
+ { "MKC", "Media Tek Inc." },
+ { "MKS", "MK Seiko Co., Ltd." },
+ { "MKT", "MICROTEK Inc." },
+ { "MKV", "Trtheim Technology" },
+ { "MLC", "MILCOTS" },
+ { "MLD", "Deep Video Imaging Ltd" },
+ { "MLG", "Micrologica AG" },
+ { "MLI", "McIntosh Laboratory Inc." },
+ { "MLL", "Millogic Ltd." },
+ { "MLM", "Millennium Engineering Inc" },
+ { "MLN", "Mark Levinson" },
+ { "MLP", "Magic Leap" },
+ { "MLS", "Milestone EPE" },
+ { "MLT", "Wanlida Group Co., Ltd." },
+ { "MLX", "Mylex Corporation" },
+ { "MMA", "Micromedia AG" },
+ { "MMD", "Micromed Biotecnologia Ltd" },
+ { "MMF", "Minnesota Mining and Manufacturing" },
+ { "MMI", "Multimax" },
+ { "MMM", "Electronic Measurements" },
+ { "MMN", "MiniMan Inc" },
+ { "MMS", "MMS Electronics" },
+ { "MMT", "MIMO Monitors" },
+ { "MNC", "Mini Micro Methods Ltd" },
+ { "MNI", "Marseille, Inc." },
+ { "MNL", "Monorail Inc" },
+ { "MNP", "Microcom" },
+ { "MOC", "Matrix Orbital Corporation" },
+ { "MOD", "Modular Technology" },
+ { "MOM", "Momentum Data Systems" },
+ { "MOS", "Moses Corporation" },
+ { "MOT", "Motorola UDS" },
+ { "MPC", "M-Pact Inc" },
+ { "MPI", "Mediatrix Peripherals Inc" },
+ { "MPJ", "Microlab" },
+ { "MPL", "Maple Research Inst. Company Ltd" },
+ { "MPN", "Mainpine Limited" },
+ { "MPS", "mps Software GmbH" },
+ { "MPV", "Megapixel Visual Realty" },
+ { "MPX", "Micropix Technologies, Ltd." },
+ { "MQP", "MultiQ Products AB" },
+ { "MRA", "Miranda Technologies Inc" },
+ { "MRC", "Marconi Simulation & Ty-Coch Way Training" },
+ { "MRD", "MicroDisplay Corporation" },
+ { "MRK", "Maruko & Company Ltd" },
+ { "MRL", "Miratel" },
+ { "MRO", "Medikro Oy" },
+ { "MRT", "Merging Technologies" },
+ { "MSA", "Micro Systemation AB" },
+ { "MSC", "Mouse Systems Corporation" },
+ { "MSD", "Datenerfassungs- und Informationssysteme" },
+ { "MSF", "M-Systems Flash Disk Pioneers" },
+ { "MSG", "MSI GmbH" },
+ { "MSH", "Microsoft" },
+ { "MSI", "Microstep" },
+ { "MSK", "Megasoft Inc" },
+ { "MSL", "MicroSlate Inc." },
+ { "MSM", "Advanced Digital Systems" },
+ { "MSP", "Mistral Solutions [P] Ltd." },
+ { "MSR", "MASPRO DENKOH Corp." },
+ { "MST", "MS Telematica" },
+ { "MSU", "motorola" },
+ { "MSV", "Mosgi Corporation" },
+ { "MSX", "Micomsoft Co., Ltd." },
+ { "MSY", "MicroTouch Systems Inc" },
+ { "MTA", "Meta Watch Ltd" },
+ { "MTB", "Media Technologies Ltd." },
+ { "MTC", "Mars-Tech Corporation" },
+ { "MTD", "MindTech Display Co. Ltd" },
+ { "MTE", "MediaTec GmbH" },
+ { "MTH", "Micro-Tech Hearing Instruments" },
+ { "MTI", "MaxCom Technical Inc" },
+ { "MTJ", "MicroTechnica Co.,Ltd." },
+ { "MTK", "Microtek International Inc." },
+ { "MTL", "Mitel Corporation" },
+ { "MTM", "Motium" },
+ { "MTN", "Mtron Storage Technology Co., Ltd." },
+ { "MTR", "Mitron computer Inc" },
+ { "MTS", "Multi-Tech Systems" },
+ { "MTU", "Mark of the Unicorn Inc" },
+ { "MTX", "Matrox" },
+ { "MUD", "Multi-Dimension Institute" },
+ { "MUK", "Mainpine Limited" },
+ { "MVD", "Microvitec PLC" },
+ { "MVI", "Media Vision Inc" },
+ { "MVM", "SOBO VISION" },
+ { "MVN", "Meta Company" },
+ { "MVR", "MediCapture, Inc." },
+ { "MVS", "Microvision" },
+ { "MVX", "COM 1" },
+ { "MWI", "Multiwave Innovation Pte Ltd" },
+ { "MWR", "mware" },
+ { "MWY", "Microway Inc" },
+ { "MXD", "MaxData Computer GmbH & Co.KG" },
+ { "MXI", "Macronix Inc" },
+ { "MXL", "Hitachi Maxell, Ltd." },
+ { "MXP", "Maxpeed Corporation" },
+ { "MXT", "Maxtech Corporation" },
+ { "MXV", "MaxVision Corporation" },
+ { "MYA", "Monydata" },
+ { "MYR", "Myriad Solutions Ltd" },
+ { "MYX", "Micronyx Inc" },
+ { "NAC", "Ncast Corporation" },
+ { "NAD", "NAD Electronics" },
+ { "NAK", "Nakano Engineering Co.,Ltd." },
+ { "NAL", "Network Alchemy" },
+ { "NAT", "NaturalPoint Inc." },
+ { "NAV", "Navigation Corporation" },
+ { "NAX", "Naxos Tecnologia" },
+ { "NBL", "N*Able Technologies Inc" },
+ { "NBS", "National Key Lab. on ISN" },
+ { "NBT", "NingBo Bestwinning Technology CO., Ltd" },
+ { "NCA", "Nixdorf Company" },
+ { "NCC", "NCR Corporation" },
+ { "NCE", "Norcent Technology, Inc." },
+ { "NCI", "NewCom Inc" },
+ { "NCL", "NetComm Ltd" },
+ { "NCP", "Najing CEC Panda FPD Technology CO. ltd" },
+ { "NCR", "NCR Electronics" },
+ { "NCS", "Northgate Computer Systems" },
+ { "NCT", "NEC CustomTechnica, Ltd." },
+ { "NDC", "National DataComm Corporaiton" },
+ { "NDF", "NDF Special Light Products B.V." },
+ { "NDI", "National Display Systems" },
+ { "NDK", "Naitoh Densei CO., LTD." },
+ { "NDL", "Network Designers" },
+ { "NDS", "Nokia Data" },
+ { "NEC", "NEC Corporation" },
+ { "NEO", "NEO TELECOM CO.,LTD." },
+ { "NES", "INNES" },
+ { "NET", "Mettler Toledo" },
+ { "NEU", "NEUROTEC - EMPRESA DE PESQUISA E DESENVOLVIMENTO EM BIOMEDICINA" },
+ { "NEX", "Nexgen Mediatech Inc.," },
+ { "NFC", "BTC Korea Co., Ltd" },
+ { "NFS", "Number Five Software" },
+ { "NGC", "Network General" },
+ { "NGS", "A D S Exports" },
+ { "NHT", "Vinci Labs" },
+ { "NIC", "National Instruments Corporation" },
+ { "NIS", "Nissei Electric Company" },
+ { "NIT", "Network Info Technology" },
+ { "NIX", "Seanix Technology Inc" },
+ { "NLC", "Next Level Communications" },
+ { "NME", "Navico, Inc." },
+ { "NMP", "Nokia Mobile Phones" },
+ { "NMS", "Natural Micro System" },
+ { "NMV", "NEC-Mitsubishi Electric Visual Systems Corporation" },
+ { "NMX", "Neomagic" },
+ { "NNC", "NNC" },
+ { "NOD", "3NOD Digital Technology Co. Ltd." },
+ { "NOE", "NordicEye AB" },
+ { "NOI", "North Invent A/S" },
+ { "NOK", "Nokia Display Products" },
+ { "NOR", "Norand Corporation" },
+ { "NOT", "Not Limited Inc" },
+ { "NPA", "Arvanics" },
+ { "NPI", "Network Peripherals Inc" },
+ { "NRI", "Noritake Itron Corporation" },
+ { "NRL", "U.S. Naval Research Lab" },
+ { "NRT", "Beijing Northern Radiantelecom Co." },
+ { "NRV", "Taugagreining hf" },
+ { "NSA", "NeuroSky, Inc." },
+ { "NSC", "National Semiconductor Corporation" },
+ { "NSI", "NISSEI ELECTRIC CO.,LTD" },
+ { "NSP", "Nspire System Inc." },
+ { "NSS", "Newport Systems Solutions" },
+ { "NST", "Network Security Technology Co" },
+ { "NTC", "NeoTech S.R.L" },
+ { "NTI", "New Tech Int'l Company" },
+ { "NTK", "NewTek" },
+ { "NTL", "National Transcomm. Ltd" },
+ { "NTN", "Nuvoton Technology Corporation" },
+ { "NTR", "N-trig Innovative Technologies, Inc." },
+ { "NTS", "Nits Technology Inc." },
+ { "NTT", "NTT Advanced Technology Corporation" },
+ { "NTW", "Networth Inc" },
+ { "NTX", "Netaccess Inc" },
+ { "NUG", "NU Technology, Inc." },
+ { "NUI", "NU Inc." },
+ { "NVC", "NetVision Corporation" },
+ { "NVD", "Nvidia" },
+ { "NVI", "NuVision US, Inc." },
+ { "NVL", "Novell Inc" },
+ { "NVT", "Navatek Engineering Corporation" },
+ { "NWC", "NW Computer Engineering" },
+ { "NWL", "Newline Interactive Inc." },
+ { "NWP", "NovaWeb Technologies Inc" },
+ { "NWS", "Newisys, Inc." },
+ { "NXC", "NextCom K.K." },
+ { "NXG", "Nexgen" },
+ { "NXP", "NXP Semiconductors bv." },
+ { "NXQ", "Nexiq Technologies, Inc." },
+ { "NXS", "Technology Nexus Secure Open Systems AB" },
+ { "NXT", "NZXT (PNP same EDID)_" },
+ { "NYC", "Nakayo Relecommunications, Inc." },
+ { "OAK", "Oak Tech Inc" },
+ { "OAS", "Oasys Technology Company" },
+ { "OBS", "Optibase Technologies" },
+ { "OCD", "Macraigor Systems Inc" },
+ { "OCN", "Olfan" },
+ { "OCS", "Open Connect Solutions" },
+ { "ODM", "ODME Inc." },
+ { "ODR", "Odrac" },
+ { "OEC", "ORION ELECTRIC CO.,LTD" },
+ { "OEI", "Optum Engineering Inc." },
+ { "OHW", "M-Labs Limited" },
+ { "OIC", "Option Industrial Computers" },
+ { "OIM", "Option International" },
+ { "OIN", "Option International" },
+ { "OKI", "OKI Electric Industrial Company Ltd" },
+ { "OLC", "Olicom A/S" },
+ { "OLD", "Olidata S.p.A." },
+ { "OLI", "Olivetti" },
+ { "OLT", "Olitec S.A." },
+ { "OLV", "Olitec S.A." },
+ { "OLY", "OLYMPUS CORPORATION" },
+ { "OMC", "OBJIX Multimedia Corporation" },
+ { "OMN", "Omnitel" },
+ { "OMR", "Omron Corporation" },
+ { "ONE", "Oneac Corporation" },
+ { "ONK", "ONKYO Corporation" },
+ { "ONL", "OnLive, Inc" },
+ { "ONS", "On Systems Inc" },
+ { "ONW", "OPEN Networks Ltd" },
+ { "ONX", "SOMELEC Z.I. Du Vert Galanta" },
+ { "OOS", "OSRAM" },
+ { "OPC", "Opcode Inc" },
+ { "OPI", "D.N.S. Corporation" },
+ { "OPP", "OPPO Digital, Inc." },
+ { "OPT", "OPTi Inc" },
+ { "OPV", "Optivision Inc" },
+ { "OQI", "Oksori Company Ltd" },
+ { "ORG", "ORGA Kartensysteme GmbH" },
+ { "ORI", "OSR Open Systems Resources, Inc." },
+ { "ORN", "ORION ELECTRIC CO., LTD." },
+ { "OSA", "OSAKA Micro Computer, Inc." },
+ { "OSD", "Optical Systems Design Pty Ltd" },
+ { "OSI", "Open Stack, Inc." },
+ { "OSP", "OPTI-UPS Corporation" },
+ { "OSR", "Oksori Company Ltd" },
+ { "OTB", "outsidetheboxstuff.com" },
+ { "OTI", "Orchid Technology" },
+ { "OTK", "OmniTek" },
+ { "OTM", "Optoma Corporation" },
+ { "OTT", "OPTO22, Inc." },
+ { "OUK", "OUK Company Ltd" },
+ { "OVR", "Oculus VR, Inc." },
+ { "OWL", "Mediacom Technologies Pte Ltd" },
+ { "OXU", "Oxus Research S.A." },
+ { "OYO", "Shadow Systems" },
+ { "OZC", "OZ Corporation" },
+ { "OZO", "Tribe Computer Works Inc" },
+ { "PAC", "Pacific Avionics Corporation" },
+ { "PAD", "Promotion and Display Technology Ltd." },
+ { "PAK", "Many CNC System Co., Ltd." },
+ { "PAM", "Peter Antesberger Messtechnik" },
+ { "PAN", "The Panda Project" },
+ { "PAR", "Parallan Comp Inc" },
+ { "PBI", "Pitney Bowes" },
+ { "PBL", "Packard Bell Electronics" },
+ { "PBN", "Packard Bell NEC" },
+ { "PBV", "Pitney Bowes" },
+ { "PCA", "Philips BU Add On Card" },
+ { "PCB", "OCTAL S.A." },
+ { "PCC", "PowerCom Technology Company Ltd" },
+ { "PCG", "First Industrial Computer Inc" },
+ { "PCI", "Pioneer Computer Inc" },
+ { "PCK", "PCBANK21" },
+ { "PCL", "pentel.co.,ltd" },
+ { "PCM", "PCM Systems Corporation" },
+ { "PCO", "Performance Concepts Inc.," },
+ { "PCP", "Procomp USA Inc" },
+ { "PCS", "TOSHIBA PERSONAL COMPUTER SYSTEM CORPRATION" },
+ { "PCT", "PC-Tel Inc" },
+ { "PCW", "Pacific CommWare Inc" },
+ { "PCX", "PC Xperten" },
+ { "PDM", "Psion Dacom Plc." },
+ { "PDN", "AT&T Paradyne" },
+ { "PDR", "Pure Data Inc" },
+ { "PDS", "PD Systems International Ltd" },
+ { "PDT", "PDTS - Prozessdatentechnik und Systeme" },
+ { "PDV", "Prodrive B.V." },
+ { "PEC", "POTRANS Electrical Corp." },
+ { "PEG", "Pegatron Corporation" },
+ { "PEI", "PEI Electronics Inc" },
+ { "PEL", "Primax Electric Ltd" },
+ { "PEN", "Interactive Computer Products Inc" },
+ { "PEP", "Peppercon AG" },
+ { "PER", "Perceptive Signal Technologies" },
+ { "PET", "Practical Electronic Tools" },
+ { "PFT", "Telia ProSoft AB" },
+ { "PGI", "PACSGEAR, Inc." },
+ { "PGM", "Paradigm Advanced Research Centre" },
+ { "PGP", "propagamma kommunikation" },
+ { "PGS", "Princeton Graphic Systems" },
+ { "PHC", "Pijnenburg Beheer N.V." },
+ { "PHE", "Philips Medical Systems Boeblingen GmbH" },
+ { "PHI", "DO NOT USE - PHI" },
+ { "PHL", "Philips Consumer Electronics Company" },
+ { "PHO", "Photonics Systems Inc." },
+ { "PHS", "Philips Communication Systems" },
+ { "PHY", "Phylon Communications" },
+ { "PIC", "Picturall Ltd." },
+ { "PIE", "Pacific Image Electronics Company Ltd" },
+ { "PIM", "Prism, LLC" },
+ { "PIO", "Pioneer Electronic Corporation" },
+ { "PIS", "TECNART CO.,LTD." },
+ { "PIX", "Pixie Tech Inc" },
+ { "PJA", "Projecta" },
+ { "PJD", "Projectiondesign AS" },
+ { "PJT", "Pan Jit International Inc." },
+ { "PKA", "Acco UK Ltd." },
+ { "PLC", "Pro-Log Corporation" },
+ { "PLF", "Panasonic Avionics Corporation" },
+ { "PLM", "PROLINK Microsystems Corp." },
+ { "PLT", "PT Hartono Istana Teknologi" },
+ { "PLV", "PLUS Vision Corp." },
+ { "PLX", "Parallax Graphics" },
+ { "PLY", "Polycom Inc." },
+ { "PMC", "PMC Consumer Electronics Ltd" },
+ { "PMD", "TDK USA Corporation" },
+ { "PMM", "Point Multimedia System" },
+ { "PMS", "Pabian Embedded Systems" },
+ { "PMT", "Promate Electronic Co., Ltd." },
+ { "PMX", "Photomatrix" },
+ { "PNG", "Microsoft" },
+ { "PNL", "Panelview, Inc." },
+ { "PNP", "Microsoft" },
+ { "PNR", "Planar Systems, Inc." },
+ { "PNS", "PanaScope" },
+ { "PNT", "HOYA Corporation PENTAX Lifecare Division" },
+ { "PNX", "Phoenix Technologies, Ltd." },
+ { "POL", "PolyComp (PTY) Ltd." },
+ { "PON", "Perpetual Technologies, LLC" },
+ { "POR", "Portalis LC" },
+ { "POS", "Positivo Tecnologia S.A." },
+ { "POT", "Parrot" },
+ { "PPC", "Phoenixtec Power Company Ltd" },
+ { "PPD", "MEPhI" },
+ { "PPI", "Practical Peripherals" },
+ { "PPM", "Clinton Electronics Corp." },
+ { "PPP", "Purup Prepress AS" },
+ { "PPR", "PicPro" },
+ { "PPX", "Perceptive Pixel Inc." },
+ { "PQI", "Pixel Qi" },
+ { "PRA", "PRO/AUTOMATION" },
+ { "PRC", "PerComm" },
+ { "PRD", "Praim S.R.L." },
+ { "PRF", "Schneider Electric Japan Holdings, Ltd." },
+ { "PRG", "The Phoenix Research Group Inc" },
+ { "PRI", "Priva Hortimation BV" },
+ { "PRM", "Prometheus" },
+ { "PRO", "Proteon" },
+ { "PRP", "UEFI Forum" },
+ { "PRS", "Leutron Vision" },
+ { "PRT", "Parade Technologies, Ltd." },
+ { "PRX", "Proxima Corporation" },
+ { "PSA", "Advanced Signal Processing Technologies" },
+ { "PSC", "Philips Semiconductors" },
+ { "PSD", "Peus-Systems GmbH" },
+ { "PSE", "Practical Solutions Pte., Ltd." },
+ { "PSI", "PSI-Perceptive Solutions Inc" },
+ { "PSL", "Perle Systems Limited" },
+ { "PSM", "Prosum" },
+ { "PST", "Global Data SA" },
+ { "PSY", "Prodea Systems Inc." },
+ { "PTA", "PAR Tech Inc." },
+ { "PTC", "PS Technology Corporation" },
+ { "PTG", "Cipher Systems Inc" },
+ { "PTH", "Pathlight Technology Inc" },
+ { "PTI", "Promise Technology Inc" },
+ { "PTL", "Pantel Inc" },
+ { "PTS", "Plain Tree Systems Inc" },
+ { "PTW", "DO NOT USE - PTW" },
+ { "PUL", "Pulse-Eight Ltd" },
+ { "PVC", "DO NOT USE - PVC" },
+ { "PVG", "Proview Global Co., Ltd" },
+ { "PVI", "Prime view international Co., Ltd" },
+ { "PVM", "Penta Studiotechnik GmbH" },
+ { "PVN", "Pixel Vision" },
+ { "PVP", "Klos Technologies, Inc." },
+ { "PVR", "Pimax Tech. CO., LTD" },
+ { "PXC", "Phoenix Contact" },
+ { "PXE", "PIXELA CORPORATION" },
+ { "PXL", "The Moving Pixel Company" },
+ { "PXM", "Proxim Inc" },
+ { "PXN", "PixelNext Inc" },
+ { "QCC", "QuakeCom Company Ltd" },
+ { "QCH", "Metronics Inc" },
+ { "QCI", "Quanta Computer Inc" },
+ { "QCK", "Quick Corporation" },
+ { "QCL", "Quadrant Components Inc" },
+ { "QCP", "Qualcomm Inc" },
+ { "QDI", "Quantum Data Incorporated" },
+ { "QDL", "QD Laser, Inc." },
+ { "QDM", "Quadram" },
+ { "QDS", "Quanta Display Inc." },
+ { "QFF", "Padix Co., Inc." },
+ { "QFI", "Quickflex, Inc" },
+ { "QLC", "Q-Logic" },
+ { "QQQ", "Chuomusen Co., Ltd." },
+ { "QSC", "QSC, LLC" },
+ { "QSI", "Quantum Solutions, Inc." },
+ { "QTD", "Quantum 3D Inc" },
+ { "QTH", "Questech Ltd" },
+ { "QTI", "Quicknet Technologies Inc" },
+ { "QTM", "Quantum" },
+ { "QTR", "Qtronix Corporation" },
+ { "QUA", "Quatographic AG" },
+ { "QUE", "Questra Consulting" },
+ { "QVU", "Quartics" },
+ { "RAC", "Racore Computer Products Inc" },
+ { "RAD", "Radisys Corporation" },
+ { "RAI", "Rockwell Automation/Intecolor" },
+ { "RAN", "Rancho Tech Inc" },
+ { "RAR", "Raritan, Inc." },
+ { "RAS", "RAScom Inc" },
+ { "RAT", "Rent-A-Tech" },
+ { "RAY", "Raylar Design, Inc." },
+ { "RCE", "Parc d'Activite des Bellevues" },
+ { "RCH", "Reach Technology Inc" },
+ { "RCI", "RC International" },
+ { "RCN", "Radio Consult SRL" },
+ { "RCO", "Rockwell Collins" },
+ { "RDI", "Rainbow Displays, Inc." },
+ { "RDM", "Tremon Enterprises Company Ltd" },
+ { "RDN", "RADIODATA GmbH" },
+ { "RDS", "Radius Inc" },
+ { "REA", "Real D" },
+ { "REC", "ReCom" },
+ { "RED", "Research Electronics Development Inc" },
+ { "REF", "Reflectivity, Inc." },
+ { "REH", "Rehan Electronics Ltd." },
+ { "REL", "Reliance Electric Ind Corporation" },
+ { "REM", "SCI Systems Inc." },
+ { "REN", "Renesas Technology Corp." },
+ { "RES", "ResMed Pty Ltd" },
+ { "RET", "Resonance Technology, Inc." },
+ { "REV", "Revolution Display, Inc." },
+ { "REX", "RATOC Systems, Inc." },
+ { "RFI", "RAFI GmbH & Co. KG" },
+ { "RFX", "Redfox Technologies Inc." },
+ { "RGB", "RGB Spectrum" },
+ { "RGL", "Robertson Geologging Ltd" },
+ { "RHD", "RightHand Technologies" },
+ { "RHM", "Rohm Company Ltd" },
+ { "RHT", "Red Hat, Inc." },
+ { "RIC", "RICOH COMPANY, LTD." },
+ { "RII", "Racal Interlan Inc" },
+ { "RIO", "Rios Systems Company Ltd" },
+ { "RIT", "Ritech Inc" },
+ { "RIV", "Rivulet Communications" },
+ { "RJA", "Roland Corporation" },
+ { "RJS", "Advanced Engineering" },
+ { "RKC", "Reakin Technolohy Corporation" },
+ { "RLD", "MEPCO" },
+ { "RLN", "RadioLAN Inc" },
+ { "RMC", "Raritan Computer, Inc" },
+ { "RMP", "Research Machines" },
+ { "RMS", "Shenzhen Ramos Digital Technology Co., Ltd" },
+ { "RMT", "Roper Mobile" },
+ { "RNB", "Rainbow Technologies" },
+ { "ROB", "Robust Electronics GmbH" },
+ { "ROH", "Rohm Co., Ltd." },
+ { "ROK", "Rockwell International" },
+ { "ROP", "Roper International Ltd" },
+ { "ROS", "Rohde & Schwarz" },
+ { "RPI", "RoomPro Technologies" },
+ { "RPT", "R.P.T.Intergroups" },
+ { "RRI", "Radicom Research Inc" },
+ { "RSC", "PhotoTelesis" },
+ { "RSH", "ADC-Centre" },
+ { "RSI", "Rampage Systems Inc" },
+ { "RSN", "Radiospire Networks, Inc." },
+ { "RSQ", "R Squared" },
+ { "RSR", "Zhong Shan City Richsound Electronic Industrial Ltd." },
+ { "RSS", "Rockwell Semiconductor Systems" },
+ { "RSV", "Ross Video Ltd" },
+ { "RSX", "Rapid Tech Corporation" },
+ { "RTC", "Relia Technologies" },
+ { "RTI", "Rancho Tech Inc" },
+ { "RTK", "DO NOT USE - RTK" },
+ { "RTL", "Realtek Semiconductor Company Ltd" },
+ { "RTS", "Raintree Systems" },
+ { "RUN", "RUNCO International" },
+ { "RUP", "Ups Manufactoring s.r.l." },
+ { "RVC", "RSI Systems Inc" },
+ { "RVI", "Realvision Inc" },
+ { "RVL", "Reveal Computer Prod" },
+ { "RWC", "Red Wing Corporation" },
+ { "RXT", "Tectona SoftSolutions (P) Ltd.," },
+ { "RZR", "Razer Taiwan Co. Ltd." },
+ { "RZS", "Rozsnyó, s.r.o." },
+ { "SAA", "Sanritz Automation Co.,Ltd." },
+ { "SAE", "Saab Aerotech" },
+ { "SAG", "Sedlbauer" },
+ { "SAI", "Sage Inc" },
+ { "SAK", "Saitek Ltd" },
+ { "SAM", "Samsung Electric Company" },
+ { "SAN", "Sanyo Electric Co.,Ltd." },
+ { "SAS", "Stores Automated Systems Inc" },
+ { "SAT", "Shuttle Tech" },
+ { "SBC", "Shanghai Bell Telephone Equip Mfg Co" },
+ { "SBD", "Softbed - Consulting & Development Ltd" },
+ { "SBI", "SMART Technologies Inc." },
+ { "SBS", "SBS-or Industrial Computers GmbH" },
+ { "SBT", "Senseboard Technologies AB" },
+ { "SCB", "SeeCubic B.V." },
+ { "SCC", "SORD Computer Corporation" },
+ { "SCD", "Sanyo Electric Company Ltd" },
+ { "SCE", "Sun Corporation" },
+ { "SCH", "Schlumberger Cards" },
+ { "SCI", "System Craft" },
+ { "SCL", "Sigmacom Co., Ltd." },
+ { "SCM", "SCM Microsystems Inc" },
+ { "SCN", "Scanport, Inc." },
+ { "SCO", "SORCUS Computer GmbH" },
+ { "SCP", "Scriptel Corporation" },
+ { "SCR", "Systran Corporation" },
+ { "SCS", "Nanomach Anstalt" },
+ { "SCT", "Smart Card Technology" },
+ { "SCX", "Socionext Inc." },
+ { "SDA", "SAT (Societe Anonyme)" },
+ { "SDD", "Intrada-SDD Ltd" },
+ { "SDE", "Sherwood Digital Electronics Corporation" },
+ { "SDF", "SODIFF E&T CO., Ltd." },
+ { "SDH", "Communications Specialies, Inc." },
+ { "SDI", "Samtron Displays Inc" },
+ { "SDK", "SAIT-Devlonics" },
+ { "SDR", "SDR Systems" },
+ { "SDS", "SunRiver Data System" },
+ { "SDT", "Siemens AG" },
+ { "SDX", "SDX Business Systems Ltd" },
+ { "SEA", "Seanix Technology Inc." },
+ { "SEB", "system elektronik GmbH" },
+ { "SEC", "Seiko Epson Corporation" },
+ { "SEE", "SeeColor Corporation" },
+ { "SEG", "DO NOT USE - SEG" },
+ { "SEI", "Seitz & Associates Inc" },
+ { "SEL", "Way2Call Communications" },
+ { "SEM", "Samsung Electronics Company Ltd" },
+ { "SEN", "Sencore" },
+ { "SEO", "SEOS Ltd" },
+ { "SEP", "SEP Eletronica Ltda." },
+ { "SER", "Sony Ericsson Mobile Communications Inc." },
+ { "SES", "Session Control LLC" },
+ { "SET", "SendTek Corporation" },
+ { "SFM", "TORNADO Company" },
+ { "SFT", "Mikroforum Ring 3" },
+ { "SGC", "Spectragraphics Corporation" },
+ { "SGD", "Sigma Designs, Inc." },
+ { "SGE", "Kansai Electric Company Ltd" },
+ { "SGI", "Scan Group Ltd" },
+ { "SGL", "Super Gate Technology Company Ltd" },
+ { "SGM", "SAGEM" },
+ { "SGO", "Logos Design A/S" },
+ { "SGT", "Stargate Technology" },
+ { "SGW", "Shanghai Guowei Science and Technology Co., Ltd." },
+ { "SGX", "Silicon Graphics Inc" },
+ { "SGZ", "Systec Computer GmbH" },
+ { "SHC", "ShibaSoku Co., Ltd." },
+ { "SHG", "Soft & Hardware development Goldammer GmbH" },
+ { "SHI", "Jiangsu Shinco Electronic Group Co., Ltd" },
+ { "SHP", "Sharp Corporation" },
+ { "SHR", "Digital Discovery" },
+ { "SHT", "Shin Ho Tech" },
+ { "SIA", "SIEMENS AG" },
+ { "SIB", "Sanyo Electric Company Ltd" },
+ { "SIC", "Sysmate Corporation" },
+ { "SID", "Seiko Instruments Information Devices Inc" },
+ { "SIE", "Siemens" },
+ { "SIG", "Sigma Designs Inc" },
+ { "SII", "Silicon Image, Inc." },
+ { "SIL", "Silicon Laboratories, Inc" },
+ { "SIM", "S3 Inc" },
+ { "SIN", "Singular Technology Co., Ltd." },
+ { "SIR", "Sirius Technologies Pty Ltd" },
+ { "SIS", "Silicon Integrated Systems Corporation" },
+ { "SIT", "Sitintel" },
+ { "SIU", "Seiko Instruments USA Inc" },
+ { "SIX", "Zuniq Data Corporation" },
+ { "SJE", "Sejin Electron Inc" },
+ { "SKD", "Schneider & Koch" },
+ { "SKI", "LLC SKTB “SKIT”" },
+ { "SKM", "Guangzhou Teclast Information Technology Limited" },
+ { "SKT", "Samsung Electro-Mechanics Company Ltd" },
+ { "SKW", "Skyworth" },
+ { "SKY", "SKYDATA S.P.A." },
+ { "SLA", "Systeme Lauer GmbH&Co KG" },
+ { "SLB", "Shlumberger Ltd" },
+ { "SLC", "Syslogic Datentechnik AG" },
+ { "SLF", "StarLeaf" },
+ { "SLH", "Silicon Library Inc." },
+ { "SLI", "Symbios Logic Inc" },
+ { "SLK", "Silitek Corporation" },
+ { "SLM", "Solomon Technology Corporation" },
+ { "SLR", "Schlumberger Technology Corporate" },
+ { "SLS", "Schnick-Schnack-Systems GmbH" },
+ { "SLT", "Salt Internatioinal Corp." },
+ { "SLX", "Specialix" },
+ { "SMA", "SMART Modular Technologies" },
+ { "SMB", "Schlumberger" },
+ { "SMC", "Standard Microsystems Corporation" },
+ { "SME", "Sysmate Company" },
+ { "SMI", "SpaceLabs Medical Inc" },
+ { "SMK", "SMK CORPORATION" },
+ { "SML", "Sumitomo Metal Industries, Ltd." },
+ { "SMM", "Shark Multimedia Inc" },
+ { "SMO", "STMicroelectronics" },
+ { "SMP", "Simple Computing" },
+ { "SMR", "B.& V. s.r.l." },
+ { "SMS", "Silicom Multimedia Systems Inc" },
+ { "SMT", "Silcom Manufacturing Tech Inc" },
+ { "SNC", "Sentronic International Corp." },
+ { "SNI", "Siemens Microdesign GmbH" },
+ { "SNK", "S&K Electronics" },
+ { "SNN", "SUNNY ELEKTRONIK" },
+ { "SNO", "SINOSUN TECHNOLOGY CO., LTD" },
+ { "SNP", "Siemens Nixdorf Info Systems" },
+ { "SNS", "Cirtech (UK) Ltd" },
+ { "SNT", "SuperNet Inc" },
+ { "SNV", "SONOVE GmbH" },
+ { "SNW", "Snell & Wilcox" },
+ { "SNX", "Sonix Comm. Ltd" },
+ { "SNY", "Sony" },
+ { "SOC", "Santec Corporation" },
+ { "SOI", "Silicon Optix Corporation" },
+ { "SOL", "Solitron Technologies Inc" },
+ { "SON", "Sony" },
+ { "SOR", "Sorcus Computer GmbH" },
+ { "SOT", "Sotec Company Ltd" },
+ { "SOY", "SOYO Group, Inc" },
+ { "SPC", "SpinCore Technologies, Inc" },
+ { "SPE", "SPEA Software AG" },
+ { "SPH", "G&W Instruments GmbH" },
+ { "SPI", "SPACE-I Co., Ltd." },
+ { "SPK", "SpeakerCraft" },
+ { "SPL", "Smart Silicon Systems Pty Ltd" },
+ { "SPN", "Sapience Corporation" },
+ { "SPR", "pmns GmbH" },
+ { "SPS", "Synopsys Inc" },
+ { "SPT", "Sceptre Tech Inc" },
+ { "SPU", "SIM2 Multimedia S.P.A." },
+ { "SPX", "Simplex Time Recorder Co." },
+ { "SQT", "Sequent Computer Systems Inc" },
+ { "SRC", "Integrated Tech Express Inc" },
+ { "SRD", "Setred" },
+ { "SRF", "Surf Communication Solutions Ltd" },
+ { "SRG", "Intuitive Surgical, Inc." },
+ { "SRS", "SR-Systems e.K." },
+ { "SRT", "SeeReal Technologies GmbH" },
+ { "SSC", "Sierra Semiconductor Inc" },
+ { "SSD", "FlightSafety International" },
+ { "SSE", "Samsung Electronic Co." },
+ { "SSI", "S-S Technology Inc" },
+ { "SSJ", "Sankyo Seiki Mfg.co., Ltd" },
+ { "SSL", "Shenzhen South-Top Computer Co., Ltd." },
+ { "SSP", "Spectrum Signal Proecessing Inc" },
+ { "SSS", "S3 Inc" },
+ { "SST", "SystemSoft Corporation" },
+ { "STA", "ST Electronics Systems Assembly Pte Ltd" },
+ { "STB", "STB Systems Inc" },
+ { "STC", "STAC Electronics" },
+ { "STD", "STD Computer Inc" },
+ { "STE", "SII Ido-Tsushin Inc" },
+ { "STF", "Starflight Electronics" },
+ { "STG", "StereoGraphics Corp." },
+ { "STH", "Semtech Corporation" },
+ { "STI", "Smart Tech Inc" },
+ { "STK", "SANTAK CORP." },
+ { "STL", "SigmaTel Inc" },
+ { "STM", "SGS Thomson Microelectronics" },
+ { "STN", "Samsung Electronics America" },
+ { "STO", "Stollmann E+V GmbH" },
+ { "STP", "StreamPlay Ltd" },
+ { "STQ", "Synthetel Corporation" },
+ { "STR", "Starlight Networks Inc" },
+ { "STS", "SITECSYSTEM CO., LTD." },
+ { "STT", "Star Paging Telecom Tech (Shenzhen) Co. Ltd." },
+ { "STU", "Sentelic Corporation" },
+ { "STW", "Starwin Inc." },
+ { "STX", "ST-Ericsson" },
+ { "STY", "SDS Technologies" },
+ { "SUB", "Subspace Comm. Inc" },
+ { "SUM", "Summagraphics Corporation" },
+ { "SUN", "Sun Electronics Corporation" },
+ { "SUP", "Supra Corporation" },
+ { "SUR", "Surenam Computer Corporation" },
+ { "SVA", "SGEG" },
+ { "SVC", "Intellix Corp." },
+ { "SVD", "SVD Computer" },
+ { "SVI", "Sun Microsystems" },
+ { "SVR", "Sensics, Inc." },
+ { "SVS", "SVSI" },
+ { "SVT", "SEVIT Co., Ltd." },
+ { "SWC", "Software Café" },
+ { "SWI", "Sierra Wireless Inc." },
+ { "SWL", "Sharedware Ltd" },
+ { "SWO", "Guangzhou Shirui Electronics Co., Ltd." },
+ { "SWS", "Static" },
+ { "SWT", "Software Technologies Group,Inc." },
+ { "SXB", "Syntax-Brillian" },
+ { "SXD", "Silex technology, Inc." },
+ { "SXG", "SELEX GALILEO" },
+ { "SXI", "Silex Inside" },
+ { "SXL", "SolutionInside" },
+ { "SXT", "SHARP TAKAYA ELECTRONIC INDUSTRY CO.,LTD." },
+ { "SYC", "Sysmic" },
+ { "SYE", "SY Electronics Ltd" },
+ { "SYK", "Stryker Communications" },
+ { "SYL", "Sylvania Computer Products" },
+ { "SYM", "Symicron Computer Communications Ltd." },
+ { "SYN", "Synaptics Inc" },
+ { "SYP", "SYPRO Co Ltd" },
+ { "SYS", "Sysgration Ltd" },
+ { "SYT", "Seyeon Tech Company Ltd" },
+ { "SYV", "SYVAX Inc" },
+ { "SYX", "Prime Systems, Inc." },
+ { "SZM", "Shenzhen MTC Co., Ltd" },
+ { "TAA", "Tandberg" },
+ { "TAB", "Todos Data System AB" },
+ { "TAG", "Teles AG" },
+ { "TAI", "Toshiba America Info Systems Inc" },
+ { "TAM", "Tamura Seisakusyo Ltd" },
+ { "TAS", "Taskit Rechnertechnik GmbH" },
+ { "TAT", "Teleliaison Inc" },
+ { "TAV", "Thales Avionics" },
+ { "TAX", "Taxan (Europe) Ltd" },
+ { "TBB", "Triple S Engineering Inc" },
+ { "TBC", "Turbo Communication, Inc" },
+ { "TBS", "Turtle Beach System" },
+ { "TCC", "Tandon Corporation" },
+ { "TCD", "Taicom Data Systems Co., Ltd." },
+ { "TCE", "Century Corporation" },
+ { "TCF", "Televic Conference" },
+ { "TCH", "Interaction Systems, Inc" },
+ { "TCI", "Tulip Computers Int'l B.V." },
+ { "TCJ", "TEAC America Inc" },
+ { "TCL", "Technical Concepts Ltd" },
+ { "TCM", "3Com Corporation" },
+ { "TCN", "Tecnetics (PTY) Ltd" },
+ { "TCO", "Thomas-Conrad Corporation" },
+ { "TCR", "Thomson Consumer Electronics" },
+ { "TCS", "Tatung Company of America Inc" },
+ { "TCT", "Telecom Technology Centre Co. Ltd." },
+ { "TCX", "FREEMARS Heavy Industries" },
+ { "TDC", "Teradici" },
+ { "TDD", "Tandberg Data Display AS" },
+ { "TDG", "Six15 Technologies" },
+ { "TDM", "Tandem Computer Europe Inc" },
+ { "TDP", "3D Perception" },
+ { "TDS", "Tri-Data Systems Inc" },
+ { "TDT", "TDT" },
+ { "TDV", "TDVision Systems, Inc." },
+ { "TDY", "Tandy Electronics" },
+ { "TEA", "TEAC System Corporation" },
+ { "TEC", "Tecmar Inc" },
+ { "TEK", "Tektronix Inc" },
+ { "TEL", "Promotion and Display Technology Ltd." },
+ { "TEN", "Tencent" },
+ { "TER", "TerraTec Electronic GmbH" },
+ { "TET", "TETRADYNE CO., LTD." },
+ { "TEV", "Televés, S.A." },
+ { "TEZ", "Tech Source Inc." },
+ { "TGC", "Toshiba Global Commerce Solutions, Inc." },
+ { "TGI", "TriGem Computer Inc" },
+ { "TGM", "TriGem Computer,Inc." },
+ { "TGS", "Torus Systems Ltd" },
+ { "TGV", "Grass Valley Germany GmbH" },
+ { "TGW", "TECHNOGYM S.p.A." },
+ { "THN", "Thundercom Holdings Sdn. Bhd." },
+ { "TIC", "Trigem KinfoComm" },
+ { "TIL", "Technical Illusions Inc." },
+ { "TIP", "TIPTEL AG" },
+ { "TIV", "OOO Technoinvest" },
+ { "TIX", "Tixi.Com GmbH" },
+ { "TKC", "Taiko Electric Works.LTD" },
+ { "TKG", "Tek Gear" },
+ { "TKN", "Teknor Microsystem Inc" },
+ { "TKO", "TouchKo, Inc." },
+ { "TKS", "TimeKeeping Systems, Inc." },
+ { "TLA", "Ferrari Electronic GmbH" },
+ { "TLD", "Telindus" },
+ { "TLE", "Zhejiang Tianle Digital Electric Co., Ltd." },
+ { "TLF", "Teleforce.,co,ltd" },
+ { "TLI", "TOSHIBA TELI CORPORATION" },
+ { "TLK", "Telelink AG" },
+ { "TLL", "Thinklogical" },
+ { "TLN", "Techlogix Networx" },
+ { "TLS", "Teleste Educational OY" },
+ { "TLT", "Dai Telecom S.p.A." },
+ { "TLV", "S3 Inc" },
+ { "TLX", "Telxon Corporation" },
+ { "TMC", "Techmedia Computer Systems Corporation" },
+ { "TME", "AT&T Microelectronics" },
+ { "TMI", "Texas Microsystem" },
+ { "TMM", "Time Management, Inc." },
+ { "TMO", "Terumo Corporation" },
+ { "TMR", "Taicom International Inc" },
+ { "TMS", "Trident Microsystems Ltd" },
+ { "TMT", "T-Metrics Inc." },
+ { "TMX", "Thermotrex Corporation" },
+ { "TNC", "TNC Industrial Company Ltd" },
+ { "TNJ", "DO NOT USE - TNJ" },
+ { "TNM", "TECNIMAGEN SA" },
+ { "TNY", "Tennyson Tech Pty Ltd" },
+ { "TOE", "TOEI Electronics Co., Ltd." },
+ { "TOG", "The OPEN Group" },
+ { "TOL", "TCL Corporation" },
+ { "TOM", "Ceton Corporation" },
+ { "TON", "TONNA" },
+ { "TOP", "Orion Communications Co., Ltd." },
+ { "TOS", "Dynabook Inc." },
+ { "TOU", "Touchstone Technology" },
+ { "TPC", "Touch Panel Systems Corporation" },
+ { "TPD", "Times (Shanghai) Computer Co., Ltd." },
+ { "TPE", "Technology Power Enterprises Inc" },
+ { "TPJ", "Junnila" },
+ { "TPK", "TOPRE CORPORATION" },
+ { "TPR", "Topro Technology Inc" },
+ { "TPS", "Teleprocessing Systeme GmbH" },
+ { "TPT", "Thruput Ltd" },
+ { "TPV", "Top Victory Electronics ( Fujian ) Company Ltd" },
+ { "TPZ", "Ypoaz Systems Inc" },
+ { "TRA", "TriTech Microelectronics International" },
+ { "TRB", "Triumph Board a.s." },
+ { "TRC", "Trioc AB" },
+ { "TRD", "Trident Microsystem Inc" },
+ { "TRE", "Tremetrics" },
+ { "TRI", "Tricord Systems" },
+ { "TRL", "Royal Information" },
+ { "TRM", "Tekram Technology Company Ltd" },
+ { "TRN", "Datacommunicatie Tron B.V." },
+ { "TRP", "TRAPEZE GROUP" },
+ { "TRS", "Torus Systems Ltd" },
+ { "TRT", "Tritec Electronic AG" },
+ { "TRU", "Aashima Technology B.V." },
+ { "TRV", "Trivisio Prototyping GmbH" },
+ { "TRX", "Trex Enterprises" },
+ { "TSB", "Toshiba America Info Systems Inc" },
+ { "TSC", "Sanyo Electric Company Ltd" },
+ { "TSD", "TechniSat Digital GmbH" },
+ { "TSE", "Tottori Sanyo Electric" },
+ { "TSF", "Racal-Airtech Software Forge Ltd" },
+ { "TSG", "The Software Group Ltd" },
+ { "TSH", "ELAN MICROELECTRONICS CORPORATION" },
+ { "TSI", "TeleVideo Systems" },
+ { "TSL", "Tottori SANYO Electric Co., Ltd." },
+ { "TSP", "U.S. Navy" },
+ { "TST", "Transtream Inc" },
+ { "TSV", "TRANSVIDEO" },
+ { "TSW", "VRSHOW Technology Limited" },
+ { "TSY", "TouchSystems" },
+ { "TTA", "Topson Technology Co., Ltd." },
+ { "TTB", "National Semiconductor Japan Ltd" },
+ { "TTC", "Telecommunications Techniques Corporation" },
+ { "TTE", "TTE, Inc." },
+ { "TTI", "Trenton Terminals Inc" },
+ { "TTK", "Totoku Electric Company Ltd" },
+ { "TTL", "2-Tel B.V" },
+ { "TTP", "Toshiba Corporation" },
+ { "TTS", "TechnoTrend Systemtechnik GmbH" },
+ { "TTX", "Taitex Corporation" },
+ { "TTY", "TRIDELITY Display Solutions GmbH" },
+ { "TUA", "T+A elektroakustik GmbH" },
+ { "TUT", "Tut Systems" },
+ { "TVD", "Tecnovision" },
+ { "TVI", "Truevision" },
+ { "TVL", "Total Vision LTD" },
+ { "TVM", "Taiwan Video & Monitor Corporation" },
+ { "TVO", "TV One Ltd" },
+ { "TVR", "TV Interactive Corporation" },
+ { "TVS", "TVS Electronics Limited" },
+ { "TVV", "TV1 GmbH" },
+ { "TWA", "Tidewater Association" },
+ { "TWE", "Kontron Electronik" },
+ { "TWH", "Twinhead International Corporation" },
+ { "TWI", "Easytel oy" },
+ { "TWK", "TOWITOKO electronics GmbH" },
+ { "TWX", "TEKWorx Limited" },
+ { "TXL", "Trixel Ltd" },
+ { "TXN", "Texas Insturments" },
+ { "TXT", "Textron Defense System" },
+ { "TYN", "Tyan Computer Corporation" },
+ { "UAS", "Ultima Associates Pte Ltd" },
+ { "UBI", "Ungermann-Bass Inc" },
+ { "UBL", "Ubinetics Ltd." },
+ { "UBU", "Canonical Ltd." },
+ { "UDN", "Uniden Corporation" },
+ { "UEC", "Ultima Electronics Corporation" },
+ { "UEG", "Elitegroup Computer Systems Company Ltd" },
+ { "UEI", "Universal Electronics Inc" },
+ { "UET", "Universal Empowering Technologies" },
+ { "UFG", "UNIGRAF-USA" },
+ { "UFO", "UFO Systems Inc" },
+ { "UHB", "XOCECO" },
+ { "UIC", "Uniform Industrial Corporation" },
+ { "UJR", "Ueda Japan Radio Co., Ltd." },
+ { "ULT", "Ultra Network Tech" },
+ { "UMC", "United Microelectr Corporation" },
+ { "UMG", "Umezawa Giken Co.,Ltd" },
+ { "UMM", "Universal Multimedia" },
+ { "UMT", "UltiMachine" },
+ { "UNA", "Unisys DSD" },
+ { "UNB", "Unisys Corporation" },
+ { "UNC", "Unisys Corporation" },
+ { "UND", "Unisys Corporation" },
+ { "UNE", "Unisys Corporation" },
+ { "UNF", "Unisys Corporation" },
+ { "UNI", "Uniform Industry Corp." },
+ { "UNM", "Unisys Corporation" },
+ { "UNO", "Unisys Corporation" },
+ { "UNP", "Unitop" },
+ { "UNS", "Unisys Corporation" },
+ { "UNT", "Unisys Corporation" },
+ { "UNY", "Unicate" },
+ { "UPP", "UPPI" },
+ { "UPS", "Systems Enhancement" },
+ { "URD", "Video Computer S.p.A." },
+ { "USA", "Utimaco Safeware AG" },
+ { "USD", "U.S. Digital Corporation" },
+ { "USE", "U. S. Electronics Inc." },
+ { "USI", "Universal Scientific Industrial Co., Ltd." },
+ { "USR", "U.S. Robotics Inc" },
+ { "UTC", "Unicompute Technology Co., Ltd." },
+ { "UTD", "Up to Date Tech" },
+ { "UWC", "Uniwill Computer Corp." },
+ { "VAD", "Vaddio, LLC" },
+ { "VAI", "VAIO Corporation" },
+ { "VAL", "Valence Computing Corporation" },
+ { "VAR", "Varian Australia Pty Ltd" },
+ { "VAT", "VADATECH INC" },
+ { "VBR", "VBrick Systems Inc." },
+ { "VBT", "Valley Board Ltda" },
+ { "VCC", "Virtual Computer Corporation" },
+ { "VCI", "VistaCom Inc" },
+ { "VCJ", "Victor Company of Japan, Limited" },
+ { "VCM", "Vector Magnetics, LLC" },
+ { "VCX", "VCONEX" },
+ { "VDA", "Victor Data Systems" },
+ { "VDC", "VDC Display Systems" },
+ { "VDM", "Vadem" },
+ { "VDO", "Video & Display Oriented Corporation" },
+ { "VDS", "Vidisys GmbH & Company" },
+ { "VDT", "Viditec, Inc." },
+ { "VEC", "Vector Informatik GmbH" },
+ { "VEK", "Vektrex" },
+ { "VES", "Vestel Elektronik Sanayi ve Ticaret A. S." },
+ { "VFI", "VeriFone Inc" },
+ { "VHI", "Macrocad Development Inc." },
+ { "VIA", "VIA Tech Inc" },
+ { "VIB", "Tatung UK Ltd" },
+ { "VIC", "Victron B.V." },
+ { "VID", "Ingram Macrotron Germany" },
+ { "VIK", "Viking Connectors" },
+ { "VIM", "Via Mons Ltd." },
+ { "VIN", "Vine Micros Ltd" },
+ { "VIR", "Visual Interface, Inc" },
+ { "VIS", "Visioneer" },
+ { "VIT", "Visitech AS" },
+ { "VIZ", "VIZIO, Inc" },
+ { "VLB", "ValleyBoard Ltda." },
+ { "VLC", "VersaLogic Corporation" },
+ { "VLK", "Vislink International Ltd" },
+ { "VLM", "LENOVO BEIJING CO. LTD." },
+ { "VLT", "VideoLan Technologies" },
+ { "VLV", "Valve Corporation" },
+ { "VMI", "Vermont Microsystems" },
+ { "VML", "Vine Micros Limited" },
+ { "VMW", "VMware Inc.," },
+ { "VNC", "Vinca Corporation" },
+ { "VOB", "MaxData Computer AG" },
+ { "VPI", "Video Products Inc" },
+ { "VPR", "Best Buy" },
+ { "VPX", "VPixx Technologies Inc." },
+ { "VQ@", "Vision Quest" },
+ { "VRC", "Virtual Resources Corporation" },
+ { "VRG", "VRgineers, Inc." },
+ { "VRM", "VRmagic Holding AG" },
+ { "VRS", "VRstudios, Inc." },
+ { "VRT", "Varjo Technologies" },
+ { "VSC", "ViewSonic Corporation" },
+ { "VSD", "3M" },
+ { "VSI", "VideoServer" },
+ { "VSN", "Ingram Macrotron" },
+ { "VSP", "Vision Systems GmbH" },
+ { "VSR", "V-Star Electronics Inc." },
+ { "VTB", "Videotechnik Breithaupt" },
+ { "VTC", "VTel Corporation" },
+ { "VTG", "Voice Technologies Group Inc" },
+ { "VTI", "VLSI Tech Inc" },
+ { "VTK", "Viewteck Co., Ltd." },
+ { "VTL", "Vivid Technology Pte Ltd" },
+ { "VTM", "Miltope Corporation" },
+ { "VTN", "VIDEOTRON CORP." },
+ { "VTS", "VTech Computers Ltd" },
+ { "VTV", "VATIV Technologies" },
+ { "VTX", "Vestax Corporation" },
+ { "VUT", "Vutrix (UK) Ltd" },
+ { "VWB", "Vweb Corp." },
+ { "WAC", "Wacom Tech" },
+ { "WAL", "Wave Access" },
+ { "WAN", "DO NOT USE - WAN" },
+ { "WAV", "Wavephore" },
+ { "WBN", "MicroSoftWare" },
+ { "WBS", "WB Systemtechnik GmbH" },
+ { "WCI", "Wisecom Inc" },
+ { "WCS", "Woodwind Communications Systems Inc" },
+ { "WDC", "Western Digital" },
+ { "WDE", "Westinghouse Digital Electronics" },
+ { "WEB", "WebGear Inc" },
+ { "WEC", "Winbond Electronics Corporation" },
+ { "WEL", "W-DEV" },
+ { "WEY", "WEY Design AG" },
+ { "WHI", "Whistle Communications" },
+ { "WII", "Innoware Inc" },
+ { "WIL", "WIPRO Information Technology Ltd" },
+ { "WIN", "Wintop Technology Inc" },
+ { "WIP", "Wipro Infotech" },
+ { "WKH", "Uni-Take Int'l Inc." },
+ { "WLD", "Wildfire Communications Inc" },
+ { "WLF", "WOLF Advanced Technology" },
+ { "WML", "Wolfson Microelectronics Ltd" },
+ { "WMO", "Westermo Teleindustri AB" },
+ { "WMT", "Winmate Communication Inc" },
+ { "WNI", "WillNet Inc." },
+ { "WNV", "Winnov L.P." },
+ { "WNX", "Diebold Nixdorf Systems GmbH" },
+ { "WPA", "Matsushita Communication Industrial Co., Ltd." },
+ { "WPI", "Wearnes Peripherals International (Pte) Ltd" },
+ { "WRC", "WiNRADiO Communications" },
+ { "WSC", "CIS Technology Inc" },
+ { "WSP", "Wireless And Smart Products Inc." },
+ { "WST", "Wistron Corporation" },
+ { "WTC", "ACC Microelectronics" },
+ { "WTI", "WorkStation Tech" },
+ { "WTK", "Wearnes Thakral Pte" },
+ { "WTS", "Restek Electric Company Ltd" },
+ { "WVM", "Wave Systems Corporation" },
+ { "WVV", "WolfVision GmbH" },
+ { "WWP", "Wipotec Wiege- und Positioniersysteme GmbH" },
+ { "WWV", "World Wide Video, Inc." },
+ { "WXT", "Woxter Technology Co. Ltd" },
+ { "WYR", "WyreStorm Technologies LLC" },
+ { "WYS", "Wyse Technology" },
+ { "WYT", "Wooyoung Image & Information Co.,Ltd." },
+ { "XAC", "XAC Automation Corp" },
+ { "XAD", "Alpha Data" },
+ { "XDM", "XDM Ltd." },
+ { "XER", "DO NOT USE - XER" },
+ { "XES", "Extreme Engineering Solutions, Inc." },
+ { "XFG", "Jan Strapko - FOTO" },
+ { "XFO", "EXFO Electro Optical Engineering" },
+ { "XIN", "Xinex Networks Inc" },
+ { "XIO", "Xiotech Corporation" },
+ { "XIR", "Xirocm Inc" },
+ { "XIT", "Xitel Pty ltd" },
+ { "XLX", "Xilinx, Inc." },
+ { "XMM", "C3PO S.L." },
+ { "XNT", "XN Technologies, Inc." },
+ { "XOC", "DO NOT USE - XOC" },
+ { "XQU", "SHANGHAI SVA-DAV ELECTRONICS CO., LTD" },
+ { "XRC", "Xircom Inc" },
+ { "XRO", "XORO ELECTRONICS (CHENGDU) LIMITED" },
+ { "XSN", "Xscreen AS" },
+ { "XST", "XS Technologies Inc" },
+ { "XSY", "XSYS" },
+ { "XTD", "Icuiti Corporation" },
+ { "XTE", "X2E GmbH" },
+ { "XTL", "Crystal Computer" },
+ { "XTN", "X-10 (USA) Inc" },
+ { "XYC", "Xycotec Computer GmbH" },
+ { "XYE", "Shenzhen Zhuona Technology Co., Ltd." },
+ { "YED", "Y-E Data Inc" },
+ { "YHQ", "Yokogawa Electric Corporation" },
+ { "YHW", "Exacom SA" },
+ { "YMH", "Yamaha Corporation" },
+ { "YOW", "American Biometric Company" },
+ { "ZAN", "Zandar Technologies plc" },
+ { "ZAX", "Zefiro Acoustics" },
+ { "ZAZ", "ZeeVee, Inc." },
+ { "ZBR", "Zebra Technologies International, LLC" },
+ { "ZBX", "Zebax Technologies" },
+ { "ZCT", "ZeitControl cardsystems GmbH" },
+ { "ZDS", "Zenith Data Systems" },
+ { "ZEN", "ZENIC Inc." },
+ { "ZGT", "Zenith Data Systems" },
+ { "ZIC", "Nationz Technologies Inc." },
+ { "ZMC", "HangZhou ZMCHIVIN" },
+ { "ZMT", "Zalman Tech Co., Ltd." },
+ { "ZMZ", "Z Microsystems" },
+ { "ZNI", "Zetinet Inc" },
+ { "ZNX", "Znyx Adv. Systems" },
+ { "ZOW", "Zowie Intertainment, Inc" },
+ { "ZRN", "Zoran Corporation" },
+ { "ZSE", "Zenith Data Systems" },
+ { "ZTC", "ZyDAS Technology Corporation" },
+ { "ZTE", "ZTE Corporation" },
+ { "ZTI", "Zoom Telephonics Inc" },
+ { "ZTM", "ZT Group Int'l Inc." },
+ { "ZTT", "Z3 Technology" },
+ { "ZWE", "Shenzhen Zowee Technology Co., LTD" },
+ { "ZYD", "Zydacron Inc" },
+ { "ZYP", "Zypcom Inc" },
+ { "ZYT", "Zytex Computers" },
+ { "ZYX", "Zyxel" },
+ { "ZZZ", "Boca Research Inc" },
+};
+
+QT_END_NAMESPACE
+
+#endif // QEDIDVENDORTABLE_P_H
diff --git a/src/gui/util/qgraphicsframecapture.cpp b/src/gui/util/qgraphicsframecapture.cpp
new file mode 100644
index 0000000000..e49fb83008
--- /dev/null
+++ b/src/gui/util/qgraphicsframecapture.cpp
@@ -0,0 +1,123 @@
+// Copyright (C) 2023 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
+
+#include "qgraphicsframecapture_p.h"
+#if (defined (Q_OS_WIN) || defined(Q_OS_LINUX)) && QT_CONFIG(library)
+#include "qgraphicsframecapturerenderdoc_p_p.h"
+#elif QT_CONFIG(metal)
+#include "qgraphicsframecapturemetal_p_p.h"
+#else
+#include "qgraphicsframecapture_p_p.h"
+#endif
+
+#include <QtCore/qstandardpaths.h>
+#include <QtCore/qcoreapplication.h>
+
+QT_BEGIN_NAMESPACE
+
+QGraphicsFrameCapturePrivate::QGraphicsFrameCapturePrivate()
+ : m_capturePath(QStandardPaths::writableLocation(QStandardPaths::TempLocation) +
+ QStringLiteral("/") + QCoreApplication::applicationName() +
+ QStringLiteral("/captures")),
+ m_capturePrefix(QCoreApplication::applicationName())
+{
+
+}
+
+QGraphicsFrameCapture::QGraphicsFrameCapture()
+{
+#if (defined (Q_OS_WIN) || defined(Q_OS_LINUX)) && QT_CONFIG(library)
+ d.reset(new QGraphicsFrameCaptureRenderDoc);
+#elif QT_CONFIG(metal)
+ d.reset(new QGraphicsFrameCaptureMetal);
+#endif
+}
+
+QGraphicsFrameCapture::~QGraphicsFrameCapture()
+{
+
+}
+
+void QGraphicsFrameCapture::setRhi(QRhi *rhi)
+{
+ if (!d.isNull())
+ d->setRhi(rhi);
+}
+
+void QGraphicsFrameCapture::startCaptureFrame()
+{
+ if (!d.isNull())
+ d->startCaptureFrame();
+}
+
+void QGraphicsFrameCapture::endCaptureFrame()
+{
+ if (!d.isNull())
+ d->endCaptureFrame();
+}
+
+QString QGraphicsFrameCapture::capturePath() const
+{
+ if (!d.isNull())
+ return d->capturePath();
+ return QString();
+}
+
+void QGraphicsFrameCapture::setCapturePath(const QString &path)
+{
+ if (!d.isNull())
+ d->setCapturePath(path);
+}
+
+QString QGraphicsFrameCapture::capturePrefix() const
+{
+ if (!d.isNull())
+ return d->capturePrefix();
+ return QString();
+}
+
+void QGraphicsFrameCapture::setCapturePrefix(const QString &prefix)
+{
+ if (!d.isNull())
+ d->setCapturePrefix(prefix);
+}
+
+QString QGraphicsFrameCapture::capturedFileName()
+{
+ if (!d.isNull())
+ return d->capturedFileName();
+
+ return QString();
+}
+
+QStringList QGraphicsFrameCapture::capturedFilesNames()
+{
+ if (!d.isNull())
+ return d->capturedFilesNames();
+
+ return QStringList();
+}
+
+bool QGraphicsFrameCapture::isLoaded() const
+{
+ if (!d.isNull())
+ return d->initialized();
+
+ return false;
+}
+
+bool QGraphicsFrameCapture::isCapturing() const
+{
+ if (!d.isNull())
+ return d->isCapturing();
+
+ return false;
+}
+
+void QGraphicsFrameCapture::openCapture() const
+{
+ if (!d.isNull())
+ d->openCapture();
+}
+
+QT_END_NAMESPACE
diff --git a/src/gui/util/qgraphicsframecapture_p.h b/src/gui/util/qgraphicsframecapture_p.h
new file mode 100644
index 0000000000..fef37d2869
--- /dev/null
+++ b/src/gui/util/qgraphicsframecapture_p.h
@@ -0,0 +1,55 @@
+// Copyright (C) 2023 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
+
+#ifndef QGRAPHICSFRAMECAPTURE_P_H
+#define QGRAPHICSFRAMECAPTURE_P_H
+
+//
+// W A R N I N G
+// -------------
+//
+// This file is not part of the Qt API. It exists purely as an
+// implementation detail. This header file may change from version to
+// version without notice, or even be removed.
+//
+// We mean it.
+//
+
+#include <QtCore/qscopedpointer.h>
+#include <QtGui/qtguiglobal.h>
+
+QT_BEGIN_NAMESPACE
+
+class QGraphicsFrameCapturePrivate;
+class QRhi;
+
+class Q_GUI_EXPORT QGraphicsFrameCapture
+{
+public:
+ QGraphicsFrameCapture();
+ ~QGraphicsFrameCapture();
+
+ void setRhi(QRhi *rhi);
+ void startCaptureFrame();
+ void endCaptureFrame();
+
+ QString capturePath() const;
+ void setCapturePath(const QString &path);
+
+ QString capturePrefix() const;
+ void setCapturePrefix(const QString &prefix);
+
+ QString capturedFileName();
+ QStringList capturedFilesNames();
+
+ bool isLoaded() const;
+ bool isCapturing() const;
+ void openCapture() const;
+
+private:
+ QScopedPointer<QGraphicsFrameCapturePrivate> d;
+};
+
+QT_END_NAMESPACE
+
+#endif // QGRAPHICSFRAMECAPTURE_P_H
diff --git a/src/gui/util/qgraphicsframecapture_p_p.h b/src/gui/util/qgraphicsframecapture_p_p.h
new file mode 100644
index 0000000000..f8dbd2ca1d
--- /dev/null
+++ b/src/gui/util/qgraphicsframecapture_p_p.h
@@ -0,0 +1,67 @@
+// Copyright (C) 2023 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
+
+#ifndef QGRAPHICSFRAMECAPTURE_P_P_H
+#define QGRAPHICSFRAMECAPTURE_P_P_H
+
+//
+// W A R N I N G
+// -------------
+//
+// This file is not part of the Qt API. It exists purely as an
+// implementation detail. This header file may change from version to
+// version without notice, or even be removed.
+//
+// We mean it.
+//
+
+#include <QtCore/qnamespace.h>
+#include <QtCore/qstring.h>
+#include <QtCore/qloggingcategory.h>
+#include <QtCore/qstringlist.h>
+
+QT_BEGIN_NAMESPACE
+
+Q_DECLARE_LOGGING_CATEGORY(lcGraphicsFrameCapture)
+
+class QRhi;
+struct QRhiNativeHandles;
+
+class QGraphicsFrameCapturePrivate
+{
+public:
+ QGraphicsFrameCapturePrivate() ;
+ virtual ~QGraphicsFrameCapturePrivate() = default;
+
+ virtual void setRhi(QRhi *rhi) = 0;
+ virtual void startCaptureFrame() = 0;
+ virtual void endCaptureFrame() = 0;
+
+ QString capturePath() const { return m_capturePath; };
+ virtual void setCapturePath(const QString &path) { m_capturePath = path; }
+
+ QString capturePrefix() const { return m_capturePrefix; }
+ virtual void setCapturePrefix(const QString &prefix) { m_capturePrefix = prefix; }
+
+ virtual QString capturedFileName() const
+ {
+ return !m_capturedFilesNames.isEmpty() ? m_capturedFilesNames.last() : QString();
+ }
+ virtual QStringList capturedFilesNames() const { return m_capturedFilesNames; }
+
+ virtual bool initialized() const = 0;
+ virtual bool isCapturing() const = 0;
+ virtual void openCapture() = 0;
+
+protected:
+ QRhi *m_rhi = nullptr;
+ QRhiNativeHandles *m_rhiHandles = nullptr;
+ void *m_nativeHandle = nullptr;
+ QString m_capturePath;
+ QString m_capturePrefix;
+ QStringList m_capturedFilesNames;
+};
+
+QT_END_NAMESPACE
+
+#endif // QGRAPHICSFRAMECAPTURE_P_P_H
diff --git a/src/gui/util/qgraphicsframecapturemetal.mm b/src/gui/util/qgraphicsframecapturemetal.mm
new file mode 100644
index 0000000000..b0ff0bab2b
--- /dev/null
+++ b/src/gui/util/qgraphicsframecapturemetal.mm
@@ -0,0 +1,169 @@
+// Copyright (C) 2023 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
+
+#include "qgraphicsframecapturemetal_p_p.h"
+#include <QtCore/qurl.h>
+#include "Metal/Metal.h"
+#include "qglobal.h"
+#include <QtGui/rhi/qrhi.h>
+#include <QtGui/rhi/qrhi_platform.h>
+
+QT_BEGIN_NAMESPACE
+
+Q_LOGGING_CATEGORY(lcGraphicsFrameCapture, "qt.gui.graphicsframecapture")
+
+#if __has_feature(objc_arc)
+#error ARC not supported
+#endif
+
+uint QGraphicsFrameCaptureMetal::frameNumber = 0;
+
+QGraphicsFrameCaptureMetal::QGraphicsFrameCaptureMetal()
+{
+ qputenv("METAL_CAPTURE_ENABLED", QByteArrayLiteral("1"));
+
+ m_captureDescriptor = [MTLCaptureDescriptor new];
+}
+
+QGraphicsFrameCaptureMetal::~QGraphicsFrameCaptureMetal()
+{
+#if defined(Q_OS_MACOS) && QT_CONFIG(process)
+ if (m_process) {
+ m_process->terminate();
+ delete m_process;
+ }
+#endif
+ [m_captureDescriptor release];
+}
+
+void QGraphicsFrameCaptureMetal::setRhi(QRhi *rhi)
+{
+ if (!rhi)
+ return;
+
+ QRhi::Implementation backend = rhi->backend();
+ const QRhiNativeHandles *nh = rhi->nativeHandles();
+
+ switch (backend) {
+ case QRhi::Implementation::Metal: {
+ const QRhiMetalNativeHandles *mtlnh = static_cast<const QRhiMetalNativeHandles *>(nh);
+ if (mtlnh->cmdQueue) {
+ m_captureDescriptor.captureObject = mtlnh->cmdQueue;
+ } else if (mtlnh->dev) {
+ m_captureDescriptor.captureObject = mtlnh->dev;
+ } else {
+ qCWarning(lcGraphicsFrameCapture) << "No valid Metal Device or Metal Command Queue found";
+ m_initialized = false;
+ return;
+ }
+ break;
+ }
+ default: {
+ qCWarning(lcGraphicsFrameCapture) << "Invalid handles were provided. MTLCaptureManager works only with Metal API";
+ m_initialized = false;
+ return;
+ break;
+ }
+ }
+
+ if (!m_captureManager) {
+ m_captureManager = MTLCaptureManager.sharedCaptureManager;
+ bool supportDocs = [m_captureManager supportsDestination:MTLCaptureDestinationGPUTraceDocument];
+ if (supportDocs) {
+ m_captureDescriptor.destination = MTLCaptureDestinationGPUTraceDocument;
+ m_initialized = true;
+ }
+ }
+}
+
+void QGraphicsFrameCaptureMetal::startCaptureFrame()
+{
+ if (!initialized()) {
+ qCWarning(lcGraphicsFrameCapture) << "Capturing on Metal was not initialized. Starting capturing can not be done.";
+ return;
+ }
+
+ if (isCapturing()) {
+ qCWarning(lcGraphicsFrameCapture) << "A frame capture is already in progress,"
+ "will not initiate another one until QGraphicsFrameCapture::endCaptureFrame is called.";
+ return;
+ }
+
+ updateCaptureFileName();
+ NSError *error;
+ if (![m_captureManager startCaptureWithDescriptor:m_captureDescriptor error:&error]) {
+ QString errorMsg = QString::fromNSString(error.localizedDescription);
+ qCWarning(lcGraphicsFrameCapture, "Failed to start capture : %s", qPrintable(errorMsg));
+ }
+}
+
+void QGraphicsFrameCaptureMetal::endCaptureFrame()
+{
+ if (!initialized()) {
+ qCWarning(lcGraphicsFrameCapture) << "Capturing on Metal was not initialized. End capturing can not be done.";
+ return;
+ }
+
+ if (!isCapturing()) {
+ qCWarning(lcGraphicsFrameCapture) << "A call to QGraphicsFrameCapture::endCaptureFrame can not be done"
+ " without a call to QGraphicsFrameCapture::startCaptureFrame";
+ return;
+ }
+
+ [m_captureManager stopCapture];
+ m_capturedFilesNames.append(QString::fromNSString(m_traceURL.path));
+ frameNumber++;
+}
+
+bool QGraphicsFrameCaptureMetal::initialized() const
+{
+ return m_initialized;
+}
+
+bool QGraphicsFrameCaptureMetal::isCapturing() const
+{
+ if (!initialized()) {
+ qCWarning(lcGraphicsFrameCapture) << "Capturing on Metal was not initialized. Can not query if capturing is in progress or not.";
+ return false;
+ }
+
+ return [m_captureManager isCapturing];
+}
+
+void QGraphicsFrameCaptureMetal::openCapture()
+{
+#if defined(Q_OS_MACOS)
+#if !QT_CONFIG(process)
+ qFatal("QGraphicsFrameCapture requires QProcess on macOS");
+#else
+ if (!initialized()) {
+ qCWarning(lcGraphicsFrameCapture) << "Capturing on Metal was not initialized. Can not open XCode with a valid capture.";
+ return;
+ }
+
+ if (!m_process) {
+ m_process = new QProcess();
+ m_process->setProgram(QStringLiteral("xed"));
+ QStringList args;
+ args.append(QUrl::fromNSURL(m_traceURL).toLocalFile());
+ m_process->setArguments(args);
+ }
+
+ m_process->kill();
+ m_process->start();
+#endif
+#endif
+}
+
+void QGraphicsFrameCaptureMetal::updateCaptureFileName()
+{
+ m_traceURL = QUrl::fromLocalFile(m_capturePath + "/" + m_capturePrefix + "_" + QString::number(frameNumber) + ".gputrace").toNSURL();
+ // We need to remove the trace file if it already existed else MTLCaptureManager
+ // will fail to.
+ if ([NSFileManager.defaultManager fileExistsAtPath:m_traceURL.path])
+ [NSFileManager.defaultManager removeItemAtURL:m_traceURL error:nil];
+
+ m_captureDescriptor.outputURL = m_traceURL;
+}
+
+QT_END_NAMESPACE
diff --git a/src/gui/util/qgraphicsframecapturemetal_p_p.h b/src/gui/util/qgraphicsframecapturemetal_p_p.h
new file mode 100644
index 0000000000..d703949de2
--- /dev/null
+++ b/src/gui/util/qgraphicsframecapturemetal_p_p.h
@@ -0,0 +1,57 @@
+// Copyright (C) 2023 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
+
+#ifndef QGRAPHICSFRAMEDECAPTUREMETAL_P_P_H
+#define QGRAPHICSFRAMEDECAPTUREMETAL_P_P_H
+
+//
+// W A R N I N G
+// -------------
+//
+// This file is not part of the Qt API. It exists purely as an
+// implementation detail. This header file may change from version to
+// version without notice, or even be removed.
+//
+// We mean it.
+//
+
+#include "qgraphicsframecapture_p_p.h"
+#include <QtCore/qmutex.h>
+#ifdef Q_OS_MACOS
+#include <QtCore/qprocess.h>
+#endif
+
+Q_FORWARD_DECLARE_OBJC_CLASS(MTLCaptureManager);
+Q_FORWARD_DECLARE_OBJC_CLASS(MTLCaptureDescriptor);
+Q_FORWARD_DECLARE_OBJC_CLASS(NSURL);
+
+QT_BEGIN_NAMESPACE
+
+class QGraphicsFrameCaptureMetal : public QGraphicsFrameCapturePrivate
+{
+public:
+ QGraphicsFrameCaptureMetal();
+ ~QGraphicsFrameCaptureMetal();
+
+ void setRhi(QRhi *rhi) override;
+ void startCaptureFrame() override;
+ void endCaptureFrame() override;
+ bool initialized() const override;
+ bool isCapturing() const override;
+ void openCapture() override;
+
+private:
+ void updateCaptureFileName();
+#if defined(Q_OS_MACOS) && QT_CONFIG(process)
+ QProcess *m_process = nullptr;
+#endif
+ MTLCaptureManager *m_captureManager = nullptr;
+ MTLCaptureDescriptor *m_captureDescriptor = nullptr;
+ NSURL *m_traceURL = nullptr;
+ bool m_initialized = false;
+ static uint frameNumber;
+};
+
+QT_END_NAMESPACE
+
+#endif // QGRAPHICSFRAMEDECAPTUREMETAL_P_P_H
diff --git a/src/gui/util/qgraphicsframecapturerenderdoc.cpp b/src/gui/util/qgraphicsframecapturerenderdoc.cpp
new file mode 100644
index 0000000000..88ba9d839f
--- /dev/null
+++ b/src/gui/util/qgraphicsframecapturerenderdoc.cpp
@@ -0,0 +1,310 @@
+// Copyright (C) 2023 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
+
+#include "qgraphicsframecapturerenderdoc_p_p.h"
+#include <QtCore/qcoreapplication.h>
+#include <QtCore/qfile.h>
+#include <QtCore/qlibrary.h>
+#include <QtCore/qmutex.h>
+#include "QtGui/rhi/qrhi.h"
+#include "QtGui/rhi/qrhi_platform.h"
+#include "QtGui/qopenglcontext.h"
+
+QT_BEGIN_NAMESPACE
+
+Q_LOGGING_CATEGORY(lcGraphicsFrameCapture, "qt.gui.graphicsframecapture")
+
+RENDERDOC_API_1_6_0 *QGraphicsFrameCaptureRenderDoc::s_rdocApi = nullptr;
+#if QT_CONFIG(thread)
+QBasicMutex QGraphicsFrameCaptureRenderDoc::s_frameCaptureMutex;
+#endif
+
+#if QT_CONFIG(opengl)
+static void *glNativeContext(QOpenGLContext *context) {
+ void *nctx = nullptr;
+ if (context != nullptr && context->isValid()) {
+#ifdef Q_OS_WIN
+ nctx = context->nativeInterface<QNativeInterface::QWGLContext>()->nativeContext();
+#endif
+
+#ifdef Q_OS_LINUX
+#if QT_CONFIG(egl)
+ QNativeInterface::QEGLContext *eglItf = context->nativeInterface<QNativeInterface::QEGLContext>();
+ if (eglItf)
+ nctx = eglItf->nativeContext();
+#endif
+
+#if QT_CONFIG(xcb_glx_plugin)
+ QNativeInterface::QGLXContext *glxItf = context->nativeInterface<QNativeInterface::QGLXContext>();
+ if (glxItf)
+ nctx = glxItf->nativeContext();
+#endif
+#endif
+
+#if QT_CONFIG(metal)
+ nctx = context->nativeInterface<QNativeInterface::QCocoaGLContext>()->nativeContext();
+#endif
+ }
+ return nctx;
+}
+#endif // QT_CONFIG(opengl)
+
+/*!
+ \class QGraphicsFrameCaptureRenderDoc
+ \internal
+ \brief The QGraphicsFrameCaptureRenderDoc class provides a way to capture a record of draw calls
+ for different graphics APIs.
+ \since 6.6
+ \inmodule QtGui
+
+ For applications that render using graphics APIs like Vulkan or OpenGL, it would be
+ convenient to have a way to check the draw calls done by the application. Specially
+ for applications that make a large amount of draw calls and the output is different
+ from what is expected.
+
+ This class acts as a wrapper over \l {https://renderdoc.org/}{RenderDoc} that allows
+ applications to capture a rendered frame either programmatically, by clicking a key
+ on the keyboard or both. The captured frame could be viewed later using RenderDoc GUI.
+
+ Read the \l {https://renderdoc.org/docs/index.html} {RenderDoc Documentation}
+ for more information.
+
+ \section1 API device handle
+
+ The functions that capture a frame like QGraphicsFrameCaptureRenderDoc::startCaptureFrame takes a device
+ pointer as argument. This pointer is unique for each graphics API and is associated
+ with the window that will be captured. This pointer has a default value of \c nullptr.
+ If no value is passed to the function the underlying API will try to find the device to
+ use, but it is not guaranteed specially in a multi-window applications.
+
+ For OpenGL, the pointer should be the OpenGL context on the platform OpenGL is being
+ used. For example, on Windows it should be \c HGLRC.
+
+ For Vulkan, the pointer should point to the dispatch table within the \c VkInstance.
+*/
+
+
+
+/*!
+ Creates a new object of this class. The constructor will load RenderDoc library
+ from the default path.
+
+ Only one instance of RenderDoc library is loaded at runtime which means creating
+ several instances of this class will not affect the RenderDoc initialization.
+*/
+
+QGraphicsFrameCaptureRenderDoc::QGraphicsFrameCaptureRenderDoc()
+ : m_nativeHandlesSet(false)
+{
+ if (!s_rdocApi)
+ init();
+}
+
+void QGraphicsFrameCaptureRenderDoc::setRhi(QRhi *rhi)
+{
+ if (!rhi)
+ return;
+
+ QRhi::Implementation backend = rhi->backend();
+ const QRhiNativeHandles *nh = rhi->nativeHandles();
+
+ switch (backend) {
+ case QRhi::Implementation::D3D11: {
+#ifdef Q_OS_WIN
+ const QRhiD3D11NativeHandles *d3d11nh = static_cast<const QRhiD3D11NativeHandles *>(nh);
+ m_nativeHandle = d3d11nh->dev;
+ break;
+#endif
+ qCWarning(lcGraphicsFrameCapture) << "Could not find valid handles for D3D11. Check platform support";
+ break;
+ }
+ case QRhi::Implementation::D3D12: {
+#ifdef Q_OS_WIN
+ const QRhiD3D12NativeHandles *d3d12nh = static_cast<const QRhiD3D12NativeHandles *>(nh);
+ m_nativeHandle = d3d12nh->dev;
+ break;
+#endif
+ qCWarning(lcGraphicsFrameCapture) << "Could not find valid handles for D3D12. Check platform support";
+ break;
+ }
+ case QRhi::Implementation::Vulkan: {
+#if QT_CONFIG(vulkan)
+ const QRhiVulkanNativeHandles *vknh = static_cast<const QRhiVulkanNativeHandles *>(nh);
+ m_nativeHandle = RENDERDOC_DEVICEPOINTER_FROM_VKINSTANCE(vknh->inst->vkInstance());
+ break;
+#endif
+ qCWarning(lcGraphicsFrameCapture) << "Could not find valid handles for Vulkan. Check platform support";
+ break;
+ }
+ case QRhi::Implementation::OpenGLES2: {
+#ifndef QT_NO_OPENGL
+ const QRhiGles2NativeHandles *glnh = static_cast<const QRhiGles2NativeHandles *>(nh);
+ m_nativeHandle = glNativeContext(glnh->context);
+ if (m_nativeHandle)
+ break;
+#endif
+ qCWarning(lcGraphicsFrameCapture) << "Could not find valid handles for OpenGL. Check platform support";
+ break;
+ }
+ case QRhi::Implementation::Metal:
+ case QRhi::Implementation::Null:
+ qCWarning(lcGraphicsFrameCapture) << "Invalid handles were provided."
+ " Metal and Null backends are not supported with RenderDoc";
+ break;
+ }
+
+ if (m_nativeHandle)
+ m_nativeHandlesSet = true;
+}
+
+/*!
+ Starts a frame capture using the set native handles provided through QGraphicsFrameCaptureRenderDoc::setRhi
+ \a device. This function must be called before QGraphicsFrameCaptureRenderDoc::endCaptureFrame.
+ \sa {API device handle}
+*/
+void QGraphicsFrameCaptureRenderDoc::startCaptureFrame()
+{
+
+ if (!initialized()) {
+ qCWarning(lcGraphicsFrameCapture) << "RenderDoc was not initialized."
+ " Starting capturing can not be done.";
+ return;
+ }
+
+#if QT_CONFIG(thread)
+ // There is a single instance of RenderDoc library and it needs mutex for multithreading access.
+ QMutexLocker locker(&s_frameCaptureMutex);
+#endif
+ if (s_rdocApi->IsFrameCapturing()) {
+ qCWarning(lcGraphicsFrameCapture) << "A frame capture is already in progress, "
+ "will not initiate another one until"
+ " QGraphicsFrameCapture::endCaptureFrame is called.";
+ return;
+ }
+
+ qCInfo(lcGraphicsFrameCapture) << "A frame capture is going to start.";
+ updateCapturePathAndTemplate();
+ s_rdocApi->StartFrameCapture(m_nativeHandle, nullptr);
+}
+
+/*!
+ Ends a frame capture started by a call to QGraphicsFrameCaptureRenderDoc::startCaptureFrame
+ using the set native handles provided through QGraphicsFrameCaptureRenderDoc::setRhi.
+ This function must be called after QGraphicsFrameCaptureRenderDoc::startCaptureFrame.
+ Otherwise, a warning message will be printend and nothing will happen.
+ \sa {API device handle}
+*/
+void QGraphicsFrameCaptureRenderDoc::endCaptureFrame()
+{
+ if (!initialized()) {
+ qCWarning(lcGraphicsFrameCapture) << "RenderDoc was not initialized."
+ " End capturing can not be done.";
+ return;
+ }
+
+#if QT_CONFIG(thread)
+ // There is a single instance of RenderDoc library and it needs mutex for multithreading access.
+ QMutexLocker locker(&s_frameCaptureMutex);
+#endif
+ if (!s_rdocApi->IsFrameCapturing()) {
+ qCWarning(lcGraphicsFrameCapture) << "A call to QGraphicsFrameCapture::endCaptureFrame can not be done"
+ " without a call to QGraphicsFrameCapture::startCaptureFrame";
+ return;
+ }
+
+ qCInfo(lcGraphicsFrameCapture) << "A frame capture is going to end.";
+ uint32_t result = s_rdocApi->EndFrameCapture(m_nativeHandle, nullptr);
+
+ if (result) {
+ uint32_t count = s_rdocApi->GetNumCaptures();
+ uint32_t pathLength = 0;
+ s_rdocApi->GetCapture(count - 1, nullptr, &pathLength, nullptr);
+ if (pathLength > 0) {
+ QVarLengthArray<char> name(pathLength, 0);
+ s_rdocApi->GetCapture(count - 1, name.data(), &pathLength, nullptr);
+ m_capturedFilesNames.append(QString::fromUtf8(name.data(), -1));
+ }
+ }
+}
+
+void QGraphicsFrameCaptureRenderDoc::updateCapturePathAndTemplate()
+{
+ if (!initialized()) {
+ qCWarning(lcGraphicsFrameCapture) << "RenderDoc was not initialized."
+ " Updating save location can not be done.";
+ return;
+ }
+
+
+ QString rdocFilePathTemplate = m_capturePath + QStringLiteral("/") + m_capturePrefix;
+ s_rdocApi->SetCaptureFilePathTemplate(rdocFilePathTemplate.toUtf8().constData());
+}
+
+/*!
+ Returns true if the API is loaded and can capture frames or not.
+*/
+bool QGraphicsFrameCaptureRenderDoc::initialized() const
+{
+ return s_rdocApi && m_nativeHandlesSet;
+}
+
+bool QGraphicsFrameCaptureRenderDoc::isCapturing() const
+{
+ if (!initialized()) {
+ qCWarning(lcGraphicsFrameCapture) << "RenderDoc was not initialized."
+ " Can not query if capturing is in progress or not.";
+ return false;
+ }
+
+ return s_rdocApi->IsFrameCapturing();
+}
+
+void QGraphicsFrameCaptureRenderDoc::openCapture()
+{
+ if (!initialized()) {
+ qCWarning(lcGraphicsFrameCapture) << "RenderDoc was not initialized."
+ " Can not open RenderDoc UI tool.";
+ return;
+ }
+
+#if QT_CONFIG(thread)
+ // There is a single instance of RenderDoc library and it needs mutex for multithreading access.
+ QMutexLocker locker(&s_frameCaptureMutex);
+#endif
+ if (s_rdocApi->IsTargetControlConnected())
+ s_rdocApi->ShowReplayUI();
+ else
+ s_rdocApi->LaunchReplayUI(1, nullptr);
+}
+
+void QGraphicsFrameCaptureRenderDoc::init()
+{
+#if QT_CONFIG(thread)
+ // There is a single instance of RenderDoc library and it needs mutex for multithreading access.
+ QMutexLocker locker(&s_frameCaptureMutex);
+#endif
+
+ QLibrary renderDocLib(QStringLiteral("renderdoc"));
+ pRENDERDOC_GetAPI RENDERDOC_GetAPI = (pRENDERDOC_GetAPI) renderDocLib.resolve("RENDERDOC_GetAPI");
+ if (!renderDocLib.isLoaded() || (RENDERDOC_GetAPI == nullptr)) {
+ qCWarning(lcGraphicsFrameCapture) << renderDocLib.errorString().toLatin1();
+ return;
+ }
+
+ int ret = RENDERDOC_GetAPI(eRENDERDOC_API_Version_1_6_0, static_cast<void **>(static_cast<void *>(&s_rdocApi)));
+
+ if (ret == 0) {
+ qCWarning(lcGraphicsFrameCapture) << "The requested RenderDoc API is invalid or not supported";
+ return;
+ }
+
+ s_rdocApi->MaskOverlayBits(RENDERDOC_OverlayBits::eRENDERDOC_Overlay_None,
+ RENDERDOC_OverlayBits::eRENDERDOC_Overlay_None);
+ s_rdocApi->SetCaptureKeys(nullptr, 0);
+ s_rdocApi->SetFocusToggleKeys(nullptr, 0);
+
+ QString rdocFilePathTemplate = m_capturePath + QStringLiteral("/") + m_capturePrefix;
+ s_rdocApi->SetCaptureFilePathTemplate(rdocFilePathTemplate.toUtf8().constData());
+}
+
+QT_END_NAMESPACE
diff --git a/src/gui/util/qgraphicsframecapturerenderdoc_p_p.h b/src/gui/util/qgraphicsframecapturerenderdoc_p_p.h
new file mode 100644
index 0000000000..c0d92ea733
--- /dev/null
+++ b/src/gui/util/qgraphicsframecapturerenderdoc_p_p.h
@@ -0,0 +1,53 @@
+// Copyright (C) 2023 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
+
+#ifndef QGRAPHICSFRAMECAPTURERENDERDOC_P_P_H
+#define QGRAPHICSFRAMECAPTURERENDERDOC_P_P_H
+
+//
+// W A R N I N G
+// -------------
+//
+// This file is not part of the Qt API. It exists purely as an
+// implementation detail. This header file may change from version to
+// version without notice, or even be removed.
+//
+// We mean it.
+//
+
+
+#include <renderdoc_app.h>
+#include "qgraphicsframecapture_p_p.h"
+
+QT_BEGIN_NAMESPACE
+
+#if QT_CONFIG(thread)
+class QBasicMutex;
+#endif
+
+class QGraphicsFrameCaptureRenderDoc : public QGraphicsFrameCapturePrivate
+{
+public:
+ QGraphicsFrameCaptureRenderDoc();
+ ~QGraphicsFrameCaptureRenderDoc() = default;
+
+ void setRhi(QRhi *rhi) override;
+ void startCaptureFrame() override;
+ void endCaptureFrame() override;
+ bool initialized() const override;
+ bool isCapturing() const override;
+ void openCapture() override;
+
+private:
+ void init();
+ void updateCapturePathAndTemplate();
+ static RENDERDOC_API_1_5_0 *s_rdocApi;
+#if QT_CONFIG(thread)
+ static QBasicMutex s_frameCaptureMutex;
+#endif
+ bool m_nativeHandlesSet;
+};
+
+QT_END_NAMESPACE
+
+#endif // QGRAPHICSFRAMECAPTURERENDERDOC_P_P_H
diff --git a/src/gui/util/qgridlayoutengine.cpp b/src/gui/util/qgridlayoutengine.cpp
index 2b81d34848..07981e8388 100644
--- a/src/gui/util/qgridlayoutengine.cpp
+++ b/src/gui/util/qgridlayoutengine.cpp
@@ -1,41 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the QtGui module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#include "qglobal.h"
@@ -47,10 +11,14 @@
QT_BEGIN_NAMESPACE
-template <typename T>
-static void insertOrRemoveItems(QVector<T> &items, int index, int delta)
+using namespace Qt::StringLiterals;
+
+#define LAYOUTITEMSIZE_MAX (1 << 24)
+
+template<typename T>
+static void insertOrRemoveItems(QList<T> &items, int index, int delta)
{
- int count = items.count();
+ int count = items.size();
if (index < count) {
if (delta > 0) {
items.insert(index, delta, T());
@@ -228,7 +196,8 @@ void QGridLayoutRowData::calculateGeometries(int start, int end, qreal targetSiz
sumAvailable = targetSize - totalBox.q_minimumSize;
if (sumAvailable > 0.0) {
- qreal sumDesired = totalBox.q_preferredSize - totalBox.q_minimumSize;
+ const qreal totalBox_preferredSize = qMin(totalBox.q_preferredSize, qreal(LAYOUTITEMSIZE_MAX));
+ qreal sumDesired = totalBox_preferredSize - totalBox.q_minimumSize;
for (int i = 0; i < n; ++i) {
if (ignore.testBit(start + i)) {
@@ -237,7 +206,8 @@ void QGridLayoutRowData::calculateGeometries(int start, int end, qreal targetSiz
}
const QGridLayoutBox &box = boxes.at(start + i);
- qreal desired = box.q_preferredSize - box.q_minimumSize;
+ const qreal box_preferredSize = qMin(box.q_preferredSize, qreal(LAYOUTITEMSIZE_MAX));
+ qreal desired = box_preferredSize - box.q_minimumSize;
factors[i] = growthFactorBelowPreferredSize(desired, sumAvailable, sumDesired);
sumFactors += factors[i];
}
@@ -355,7 +325,7 @@ void QGridLayoutRowData::calculateGeometries(int start, int end, qreal targetSiz
if (newSizes[i] >= 0.0)
continue;
- const QVector<QGridLayoutBox> &rBoxes = isLargerThanMaximum ? rowInfo.boxes : boxes;
+ const QList<QGridLayoutBox> &rBoxes = isLargerThanMaximum ? rowInfo.boxes : boxes;
const QGridLayoutBox &box = rBoxes.value(start + i);
qreal maxBoxSize = box.q_maximumSize;
@@ -507,24 +477,21 @@ void QGridLayoutRowData::dump(int indent) const
QGridLayoutItem::QGridLayoutItem(int row, int column, int rowSpan, int columnSpan,
Qt::Alignment alignment)
- : q_alignment(alignment)
+ : q_firstRows{column, row},
+ q_rowSpans{columnSpan, rowSpan},
+ q_stretches{-1, -1},
+ q_alignment(alignment)
{
- q_firstRows[Hor] = column;
- q_firstRows[Ver] = row;
- q_rowSpans[Hor] = columnSpan;
- q_rowSpans[Ver] = rowSpan;
- q_stretches[Hor] = -1;
- q_stretches[Ver] = -1;
}
int QGridLayoutItem::firstRow(Qt::Orientation orientation) const
{
- return q_firstRows[orientation == Qt::Vertical];
+ return q_firstRows[orientation];
}
int QGridLayoutItem::firstColumn(Qt::Orientation orientation) const
{
- return q_firstRows[orientation == Qt::Horizontal];
+ return q_firstRows.transposed()[orientation];
}
int QGridLayoutItem::lastRow(Qt::Orientation orientation) const
@@ -539,27 +506,27 @@ int QGridLayoutItem::lastColumn(Qt::Orientation orientation) const
int QGridLayoutItem::rowSpan(Qt::Orientation orientation) const
{
- return q_rowSpans[orientation == Qt::Vertical];
+ return q_rowSpans[orientation];
}
int QGridLayoutItem::columnSpan(Qt::Orientation orientation) const
{
- return q_rowSpans[orientation == Qt::Horizontal];
+ return q_rowSpans.transposed()[orientation];
}
void QGridLayoutItem::setFirstRow(int row, Qt::Orientation orientation)
{
- q_firstRows[orientation == Qt::Vertical] = row;
+ q_firstRows[orientation] = row;
}
void QGridLayoutItem::setRowSpan(int rowSpan, Qt::Orientation orientation)
{
- q_rowSpans[orientation == Qt::Vertical] = rowSpan;
+ q_rowSpans[orientation] = rowSpan;
}
int QGridLayoutItem::stretchFactor(Qt::Orientation orientation) const
{
- int stretch = q_stretches[orientation == Qt::Vertical];
+ int stretch = q_stretches[orientation];
if (stretch >= 0)
return stretch;
@@ -577,7 +544,7 @@ int QGridLayoutItem::stretchFactor(Qt::Orientation orientation) const
void QGridLayoutItem::setStretchFactor(int stretch, Qt::Orientation orientation)
{
Q_ASSERT(stretch >= 0); // ### deal with too big stretches
- q_stretches[orientation == Qt::Vertical] = stretch;
+ q_stretches[orientation] = stretch;
}
QLayoutPolicy::ControlTypes QGridLayoutItem::controlTypes(LayoutSide /*side*/) const
@@ -695,9 +662,9 @@ QRectF QGridLayoutItem::geometryWithin(qreal x, qreal y, qreal width, qreal heig
void QGridLayoutItem::transpose()
{
- qSwap(q_firstRows[Hor], q_firstRows[Ver]);
- qSwap(q_rowSpans[Hor], q_rowSpans[Ver]);
- qSwap(q_stretches[Hor], q_stretches[Ver]);
+ q_firstRows.transpose();
+ q_rowSpans.transpose();
+ q_stretches.transpose();
}
void QGridLayoutItem::insertOrRemoveRows(int row, int delta, Qt::Orientation orientation)
@@ -746,14 +713,14 @@ void QGridLayoutItem::dump(int indent) const
qDebug("%*s (%d, %d) %d x %d", indent, "", firstRow(), firstColumn(), //###
rowSpan(), columnSpan());
- if (q_stretches[Hor] >= 0)
- qDebug("%*s Horizontal stretch: %d", indent, "", q_stretches[Hor]);
- if (q_stretches[Ver] >= 0)
- qDebug("%*s Vertical stretch: %d", indent, "", q_stretches[Ver]);
+ if (q_stretches[Qt::Horizontal] >= 0)
+ qDebug("%*s Horizontal stretch: %d", indent, "", q_stretches[Qt::Horizontal]);
+ if (q_stretches[Qt::Vertical] >= 0)
+ qDebug("%*s Vertical stretch: %d", indent, "", q_stretches[Qt::Vertical]);
if (q_alignment != 0)
qDebug("%*s Alignment: %x", indent, "", uint(q_alignment));
qDebug("%*s Horizontal size policy: %x Vertical size policy: %x",
- indent, "", sizePolicy(Qt::Horizontal), sizePolicy(Qt::Vertical));
+ indent, "", (unsigned int)sizePolicy(Qt::Horizontal), (unsigned int)sizePolicy(Qt::Vertical));
}
#endif
@@ -795,22 +762,24 @@ QGridLayoutEngine::QGridLayoutEngine(Qt::Alignment defaultAlignment, bool snapTo
m_visualDirection = Qt::LeftToRight;
m_defaultAlignment = defaultAlignment;
m_snapToPixelGrid = snapToPixelGrid;
+ m_uniformCellWidths = false;
+ m_uniformCellHeights = false;
invalidate();
}
int QGridLayoutEngine::rowCount(Qt::Orientation orientation) const
{
- return q_infos[orientation == Qt::Vertical].count;
+ return q_infos[orientation].count;
}
int QGridLayoutEngine::columnCount(Qt::Orientation orientation) const
{
- return q_infos[orientation == Qt::Horizontal].count;
+ return q_infos.transposed()[orientation].count;
}
int QGridLayoutEngine::itemCount() const
{
- return q_items.count();
+ return q_items.size();
}
QGridLayoutItem *QGridLayoutEngine::itemAt(int index) const
@@ -822,40 +791,40 @@ QGridLayoutItem *QGridLayoutEngine::itemAt(int index) const
int QGridLayoutEngine::effectiveFirstRow(Qt::Orientation orientation) const
{
ensureEffectiveFirstAndLastRows();
- return q_cachedEffectiveFirstRows[orientation == Qt::Vertical];
+ return q_cachedEffectiveFirstRows[orientation];
}
int QGridLayoutEngine::effectiveLastRow(Qt::Orientation orientation) const
{
ensureEffectiveFirstAndLastRows();
- return q_cachedEffectiveLastRows[orientation == Qt::Vertical];
+ return q_cachedEffectiveLastRows[orientation];
}
void QGridLayoutEngine::setSpacing(qreal spacing, Qt::Orientations orientations)
{
if (orientations & Qt::Horizontal)
- q_defaultSpacings[Hor].setUserValue(spacing);
+ q_defaultSpacings[Qt::Horizontal].setUserValue(spacing);
if (orientations & Qt::Vertical)
- q_defaultSpacings[Ver].setUserValue(spacing);
+ q_defaultSpacings[Qt::Vertical].setUserValue(spacing);
invalidate();
}
qreal QGridLayoutEngine::spacing(Qt::Orientation orientation, const QAbstractLayoutStyleInfo *styleInfo) const
{
- if (!q_defaultSpacings[orientation == Qt::Vertical].isUser()) {
+ if (!q_defaultSpacings[orientation].isUser()) {
qreal defaultSpacing = styleInfo->spacing(orientation);
- q_defaultSpacings[orientation == Qt::Vertical].setCachedValue(defaultSpacing);
+ q_defaultSpacings[orientation].setCachedValue(defaultSpacing);
}
- return q_defaultSpacings[orientation == Qt::Vertical].value();
+ return q_defaultSpacings[orientation].value();
}
void QGridLayoutEngine::setRowSpacing(int row, qreal spacing, Qt::Orientation orientation)
{
Q_ASSERT(row >= 0);
- QGridLayoutRowInfo &rowInfo = q_infos[orientation == Qt::Vertical];
- if (row >= rowInfo.spacings.count())
+ QGridLayoutRowInfo &rowInfo = q_infos[orientation];
+ if (row >= rowInfo.spacings.size())
rowInfo.spacings.resize(row + 1);
if (spacing >= 0)
rowInfo.spacings[row].setUserValue(spacing);
@@ -866,10 +835,10 @@ void QGridLayoutEngine::setRowSpacing(int row, qreal spacing, Qt::Orientation or
qreal QGridLayoutEngine::rowSpacing(int row, Qt::Orientation orientation) const
{
- QLayoutParameter<qreal> spacing = q_infos[orientation == Qt::Vertical].spacings.value(row);
+ QLayoutParameter<qreal> spacing = q_infos[orientation].spacings.value(row);
if (!spacing.isDefault())
return spacing.value();
- return q_defaultSpacings[orientation == Qt::Vertical].value();
+ return q_defaultSpacings[orientation].value();
}
void QGridLayoutEngine::setRowStretchFactor(int row, int stretch, Qt::Orientation orientation)
@@ -879,15 +848,15 @@ void QGridLayoutEngine::setRowStretchFactor(int row, int stretch, Qt::Orientatio
maybeExpandGrid(row, -1, orientation);
- QGridLayoutRowInfo &rowInfo = q_infos[orientation == Qt::Vertical];
- if (row >= rowInfo.stretches.count())
+ QGridLayoutRowInfo &rowInfo = q_infos[orientation];
+ if (row >= rowInfo.stretches.size())
rowInfo.stretches.resize(row + 1);
rowInfo.stretches[row].setUserValue(stretch);
}
int QGridLayoutEngine::rowStretchFactor(int row, Qt::Orientation orientation) const
{
- QStretchParameter stretch = q_infos[orientation == Qt::Vertical].stretches.value(row);
+ QStretchParameter stretch = q_infos[orientation].stretches.value(row);
if (!stretch.isDefault())
return stretch.value();
return 0;
@@ -901,15 +870,43 @@ void QGridLayoutEngine::setRowSizeHint(Qt::SizeHint which, int row, qreal size,
maybeExpandGrid(row, -1, orientation);
- QGridLayoutRowInfo &rowInfo = q_infos[orientation == Qt::Vertical];
- if (row >= rowInfo.boxes.count())
+ QGridLayoutRowInfo &rowInfo = q_infos[orientation];
+ if (row >= rowInfo.boxes.size())
rowInfo.boxes.resize(row + 1);
rowInfo.boxes[row].q_sizes(which) = size;
}
qreal QGridLayoutEngine::rowSizeHint(Qt::SizeHint which, int row, Qt::Orientation orientation) const
{
- return q_infos[orientation == Qt::Vertical].boxes.value(row).q_sizes(which);
+ return q_infos[orientation].boxes.value(row).q_sizes(which);
+}
+
+bool QGridLayoutEngine::uniformCellWidths() const
+{
+ return m_uniformCellWidths;
+}
+
+void QGridLayoutEngine::setUniformCellWidths(bool uniformCellWidths)
+{
+ if (m_uniformCellWidths == uniformCellWidths)
+ return;
+
+ m_uniformCellWidths = uniformCellWidths;
+ invalidate();
+}
+
+bool QGridLayoutEngine::uniformCellHeights() const
+{
+ return m_uniformCellHeights;
+}
+
+void QGridLayoutEngine::setUniformCellHeights(bool uniformCellHeights)
+{
+ if (m_uniformCellHeights == uniformCellHeights)
+ return;
+
+ m_uniformCellHeights = uniformCellHeights;
+ invalidate();
}
void QGridLayoutEngine::setRowAlignment(int row, Qt::Alignment alignment,
@@ -919,8 +916,8 @@ void QGridLayoutEngine::setRowAlignment(int row, Qt::Alignment alignment,
maybeExpandGrid(row, -1, orientation);
- QGridLayoutRowInfo &rowInfo = q_infos[orientation == Qt::Vertical];
- if (row >= rowInfo.alignments.count())
+ QGridLayoutRowInfo &rowInfo = q_infos[orientation];
+ if (row >= rowInfo.alignments.size())
rowInfo.alignments.resize(row + 1);
rowInfo.alignments[row] = alignment;
}
@@ -928,7 +925,7 @@ void QGridLayoutEngine::setRowAlignment(int row, Qt::Alignment alignment,
Qt::Alignment QGridLayoutEngine::rowAlignment(int row, Qt::Orientation orientation) const
{
Q_ASSERT(row >= 0);
- return q_infos[orientation == Qt::Vertical].alignments.value(row);
+ return q_infos[orientation].alignments.value(row);
}
Qt::Alignment QGridLayoutEngine::effectiveAlignment(const QGridLayoutItem *layoutItem) const
@@ -967,8 +964,11 @@ void QGridLayoutEngine::insertItem(QGridLayoutItem *item, int index)
for (int i = item->firstRow(); i <= item->lastRow(); ++i) {
for (int j = item->firstColumn(); j <= item->lastColumn(); ++j) {
- if (itemAt(i, j))
- qWarning("QGridLayoutEngine::addItem: Cell (%d, %d) already taken", i, j);
+ const auto existingItem = itemAt(i, j);
+ if (existingItem) {
+ qWarning("QGridLayoutEngine::addItem: Can't add %s at cell (%d, %d) because it's already taken by %s",
+ qPrintable(item->toString()), i, j, qPrintable(existingItem->toString()));
+ }
setItemAt(i, j, item);
}
}
@@ -1007,13 +1007,10 @@ QGridLayoutItem *QGridLayoutEngine::itemAt(int row, int column, Qt::Orientation
void QGridLayoutEngine::invalidate()
{
- q_cachedEffectiveFirstRows[Hor] = -1;
- q_cachedEffectiveFirstRows[Ver] = -1;
- q_cachedEffectiveLastRows[Hor] = -1;
- q_cachedEffectiveLastRows[Ver] = -1;
+ q_cachedEffectiveFirstRows = {-1, -1};
+ q_cachedEffectiveLastRows = {-1, -1};
- q_totalBoxCachedConstraints[Hor] = NotCached;
- q_totalBoxCachedConstraints[Ver] = NotCached;
+ q_totalBoxCachedConstraints = {NotCached, NotCached};
q_cachedSize = QSizeF();
q_cachedConstraintOrientation = UnknownConstraint;
@@ -1032,7 +1029,7 @@ void QGridLayoutEngine::setGeometries(const QRectF &contentsGeometry, const QAbs
ensureGeometries(contentsGeometry.size(), styleInfo);
- for (int i = q_items.count() - 1; i >= 0; --i) {
+ for (int i = q_items.size() - 1; i >= 0; --i) {
QGridLayoutItem *item = q_items.at(i);
qreal x = q_xx.at(item->firstColumn());
@@ -1095,14 +1092,14 @@ QSizeF QGridLayoutEngine::sizeHint(Qt::SizeHint which, const QSizeF &constraint,
if (hasDynamicConstraint() && rowCount() > 0 && columnCount() > 0) {
- QGridLayoutBox sizehint_totalBoxes[NOrientations];
+ QHVContainer<QGridLayoutBox> sizehint_totalBoxes;
bool sizeHintCalculated = false;
if (constraintOrientation() == Qt::Vertical) {
//We have items whose height depends on their width
if (constraint.width() >= 0) {
- ensureColumnAndRowData(&q_columnData, &sizehint_totalBoxes[Hor], nullptr, nullptr, Qt::Horizontal, styleInfo);
- QVector<qreal> sizehint_xx;
- QVector<qreal> sizehint_widths;
+ ensureColumnAndRowData(&q_columnData, &sizehint_totalBoxes[Qt::Horizontal], nullptr, nullptr, Qt::Horizontal, styleInfo);
+ QList<qreal> sizehint_xx;
+ QList<qreal> sizehint_widths;
sizehint_xx.resize(columnCount());
sizehint_widths.resize(columnCount());
@@ -1110,16 +1107,16 @@ QSizeF QGridLayoutEngine::sizeHint(Qt::SizeHint which, const QSizeF &constraint,
//Calculate column widths and positions, and put results in q_xx.data() and q_widths.data() so that we can use this information as
//constraints to find the row heights
q_columnData.calculateGeometries(0, columnCount(), width, sizehint_xx.data(), sizehint_widths.data(),
- nullptr, sizehint_totalBoxes[Hor], q_infos[Hor], m_snapToPixelGrid);
- ensureColumnAndRowData(&q_rowData, &sizehint_totalBoxes[Ver], sizehint_xx.data(), sizehint_widths.data(), Qt::Vertical, styleInfo);
+ nullptr, sizehint_totalBoxes[Qt::Horizontal], q_infos[Qt::Horizontal], m_snapToPixelGrid);
+ ensureColumnAndRowData(&q_rowData, &sizehint_totalBoxes[Qt::Vertical], sizehint_xx.data(), sizehint_widths.data(), Qt::Vertical, styleInfo);
sizeHintCalculated = true;
}
} else {
if (constraint.height() >= 0) {
//We have items whose width depends on their height
- ensureColumnAndRowData(&q_rowData, &sizehint_totalBoxes[Ver], nullptr, nullptr, Qt::Vertical, styleInfo);
- QVector<qreal> sizehint_yy;
- QVector<qreal> sizehint_heights;
+ ensureColumnAndRowData(&q_rowData, &sizehint_totalBoxes[Qt::Vertical], nullptr, nullptr, Qt::Vertical, styleInfo);
+ QList<qreal> sizehint_yy;
+ QList<qreal> sizehint_heights;
sizehint_yy.resize(rowCount());
sizehint_heights.resize(rowCount());
@@ -1127,19 +1124,20 @@ QSizeF QGridLayoutEngine::sizeHint(Qt::SizeHint which, const QSizeF &constraint,
//Calculate row heights and positions, and put results in q_yy.data() and q_heights.data() so that we can use this information as
//constraints to find the column widths
q_rowData.calculateGeometries(0, rowCount(), height, sizehint_yy.data(), sizehint_heights.data(),
- nullptr, sizehint_totalBoxes[Ver], q_infos[Ver], m_snapToPixelGrid);
- ensureColumnAndRowData(&q_columnData, &sizehint_totalBoxes[Hor], sizehint_yy.data(), sizehint_heights.data(), Qt::Horizontal, styleInfo);
+ nullptr, sizehint_totalBoxes[Qt::Vertical], q_infos[Qt::Vertical], m_snapToPixelGrid);
+ ensureColumnAndRowData(&q_columnData, &sizehint_totalBoxes[Qt::Horizontal], sizehint_yy.data(), sizehint_heights.data(), Qt::Horizontal, styleInfo);
sizeHintCalculated = true;
}
}
if (sizeHintCalculated)
- return QSizeF(sizehint_totalBoxes[Hor].q_sizes(which), sizehint_totalBoxes[Ver].q_sizes(which));
+ return QSizeF{sizehint_totalBoxes[Qt::Horizontal].q_sizes(which),
+ sizehint_totalBoxes[Qt::Vertical].q_sizes(which)};
}
//No items with height for width, so it doesn't matter which order we do these in
- ensureColumnAndRowData(&q_columnData, &q_totalBoxes[Hor], nullptr, nullptr, Qt::Horizontal, styleInfo);
- ensureColumnAndRowData(&q_rowData, &q_totalBoxes[Ver], nullptr, nullptr, Qt::Vertical, styleInfo);
- return QSizeF(q_totalBoxes[Hor].q_sizes(which), q_totalBoxes[Ver].q_sizes(which));
+ ensureColumnAndRowData(&q_columnData, &q_totalBoxes[Qt::Horizontal], nullptr, nullptr, Qt::Horizontal, styleInfo);
+ ensureColumnAndRowData(&q_rowData, &q_totalBoxes[Qt::Vertical], nullptr, nullptr, Qt::Vertical, styleInfo);
+ return QSizeF(q_totalBoxes[Qt::Horizontal].q_sizes(which), q_totalBoxes[Qt::Vertical].q_sizes(which));
}
QLayoutPolicy::ControlTypes QGridLayoutEngine::controlTypes(LayoutSide side) const
@@ -1160,11 +1158,11 @@ void QGridLayoutEngine::transpose()
{
invalidate();
- for (int i = q_items.count() - 1; i >= 0; --i)
+ for (int i = q_items.size() - 1; i >= 0; --i)
q_items.at(i)->transpose();
- qSwap(q_defaultSpacings[Hor], q_defaultSpacings[Ver]);
- qSwap(q_infos[Hor], q_infos[Ver]);
+ q_defaultSpacings.transpose();
+ q_infos.transpose();
regenerateGrid();
}
@@ -1184,7 +1182,7 @@ void QGridLayoutEngine::dump(int indent) const
{
qDebug("%*sEngine", indent, "");
- qDebug("%*s Items (%d)", indent, "", q_items.count());
+ qDebug("%*s Items (%lld)", indent, "", q_items.count());
int i;
for (i = 0; i < q_items.count(); ++i)
q_items.at(i)->dump(indent + 2);
@@ -1192,36 +1190,37 @@ void QGridLayoutEngine::dump(int indent) const
qDebug("%*s Grid (%d x %d)", indent, "", internalGridRowCount(),
internalGridColumnCount());
for (int row = 0; row < internalGridRowCount(); ++row) {
- QString message = QLatin1String("[ ");
+ QString message = "[ "_L1;
for (int column = 0; column < internalGridColumnCount(); ++column) {
message += QString::number(q_items.indexOf(itemAt(row, column))).rightJustified(3);
- message += QLatin1Char(' ');
+ message += u' ';
}
- message += QLatin1Char(']');
+ message += u']';
qDebug("%*s %s", indent, "", qPrintable(message));
}
- if (q_defaultSpacings[Hor].value() >= 0.0 || q_defaultSpacings[Ver].value() >= 0.0)
- qDebug("%*s Default spacings: %g %g", indent, "", q_defaultSpacings[Hor].value(),
- q_defaultSpacings[Ver].value());
+ if (q_defaultSpacings[Qt::Horizontal].value() >= 0.0 || q_defaultSpacings[Qt::Vertical].value() >= 0.0)
+ qDebug("%*s Default spacings: %g %g", indent, "",
+ q_defaultSpacings[Qt::Horizontal].value(),
+ q_defaultSpacings[Qt::Vertical].value());
qDebug("%*s Column and row info", indent, "");
- q_infos[Hor].dump(indent + 2);
- q_infos[Ver].dump(indent + 2);
+ q_infos[Qt::Horizontal].dump(indent + 2);
+ q_infos[Qt::Vertical].dump(indent + 2);
qDebug("%*s Column and row data", indent, "");
q_columnData.dump(indent + 2);
q_rowData.dump(indent + 2);
qDebug("%*s Geometries output", indent, "");
- QVector<qreal> *cellPos = &q_yy;
+ QList<qreal> *cellPos = &q_yy;
for (int pass = 0; pass < 2; ++pass) {
QString message;
for (i = 0; i < cellPos->count(); ++i) {
- message += QLatin1String((message.isEmpty() ? "[" : ", "));
+ message += (message.isEmpty() ? "["_L1 : ", "_L1);
message += QString::number(cellPos->at(i));
}
- message += QLatin1Char(']');
+ message += u']';
qDebug("%*s %s %s", indent, "", (pass == 0 ? "rows:" : "columns:"), qPrintable(message));
cellPos = &q_xx;
}
@@ -1241,14 +1240,14 @@ void QGridLayoutEngine::maybeExpandGrid(int row, int column, Qt::Orientation ori
int oldGridRowCount = internalGridRowCount();
int oldGridColumnCount = internalGridColumnCount();
- q_infos[Ver].count = qMax(row + 1, rowCount());
- q_infos[Hor].count = qMax(column + 1, columnCount());
+ q_infos[Qt::Vertical].count = qMax(row + 1, rowCount());
+ q_infos[Qt::Horizontal].count = qMax(column + 1, columnCount());
int newGridRowCount = internalGridRowCount();
int newGridColumnCount = internalGridColumnCount();
int newGridSize = newGridRowCount * newGridColumnCount;
- if (newGridSize != q_grid.count()) {
+ if (newGridSize != q_grid.size()) {
q_grid.resize(newGridSize);
if (newGridColumnCount != oldGridColumnCount) {
@@ -1259,7 +1258,7 @@ void QGridLayoutEngine::maybeExpandGrid(int row, int column, Qt::Orientation ori
Q_ASSERT(newIndex > oldIndex);
q_grid[newIndex] = q_grid[oldIndex];
- q_grid[oldIndex] = 0;
+ q_grid[oldIndex] = nullptr;
}
}
}
@@ -1268,9 +1267,9 @@ void QGridLayoutEngine::maybeExpandGrid(int row, int column, Qt::Orientation ori
void QGridLayoutEngine::regenerateGrid()
{
- q_grid.fill(0);
+ q_grid.fill(nullptr);
- for (int i = q_items.count() - 1; i >= 0; --i) {
+ for (int i = q_items.size() - 1; i >= 0; --i) {
QGridLayoutItem *item = q_items.at(i);
for (int j = item->firstRow(); j <= item->lastRow(); ++j) {
@@ -1301,9 +1300,9 @@ void QGridLayoutEngine::insertOrRemoveRows(int row, int delta, Qt::Orientation o
return;
}
- q_infos[orientation == Qt::Vertical].insertOrRemoveRows(row, delta);
+ q_infos[orientation].insertOrRemoveRows(row, delta);
- for (int i = q_items.count() - 1; i >= 0; --i)
+ for (int i = q_items.size() - 1; i >= 0; --i)
q_items.at(i)->insertOrRemoveRows(row, delta, orientation);
q_grid.resize(internalGridRowCount() * internalGridColumnCount());
@@ -1316,12 +1315,12 @@ void QGridLayoutEngine::fillRowData(QGridLayoutRowData *rowData,
const QAbstractLayoutStyleInfo *styleInfo) const
{
const int ButtonMask = QLayoutPolicy::ButtonBox | QLayoutPolicy::PushButton;
- const QGridLayoutRowInfo &rowInfo = q_infos[orientation == Qt::Vertical];
- const QGridLayoutRowInfo &columnInfo = q_infos[orientation == Qt::Horizontal];
+ const QGridLayoutRowInfo &rowInfo = q_infos[orientation];
+ const QGridLayoutRowInfo &columnInfo = q_infos.other(orientation);
LayoutSide top = (orientation == Qt::Vertical) ? Top : Left;
LayoutSide bottom = (orientation == Qt::Vertical) ? Bottom : Right;
- const QLayoutParameter<qreal> &defaultSpacing = q_defaultSpacings[orientation == Qt::Vertical];
+ const QLayoutParameter<qreal> &defaultSpacing = q_defaultSpacings[orientation];
qreal innerSpacing = styleInfo->spacing(orientation);
if (innerSpacing >= 0.0)
defaultSpacing.setCachedValue(innerSpacing);
@@ -1336,7 +1335,7 @@ void QGridLayoutEngine::fillRowData(QGridLayoutRowData *rowData,
if (rowIsIdenticalToPrevious && item != itemAt(row - 1, column, orientation))
rowIsIdenticalToPrevious = false;
- if (item && !item->isIgnored())
+ if (item && !item->isEmpty())
rowIsEmpty = false;
}
@@ -1444,7 +1443,7 @@ void QGridLayoutEngine::fillRowData(QGridLayoutRowData *rowData,
}
}
}
- if (row < rowInfo.boxes.count()) {
+ if (row < rowInfo.boxes.size()) {
QGridLayoutBox rowBoxInfo = rowInfo.boxes.at(row);
rowBoxInfo.normalize();
rowBox.q_minimumSize = qMax(rowBox.q_minimumSize, rowBoxInfo.q_minimumSize);
@@ -1537,28 +1536,46 @@ void QGridLayoutEngine::fillRowData(QGridLayoutRowData *rowData,
rowSpacing = qMax(windowMargin, rowSpacing);
}
}
+
+ if (rowData->boxes.size() > 1 &&
+ ((orientation == Qt::Horizontal && m_uniformCellWidths) ||
+ (orientation == Qt::Vertical && m_uniformCellHeights))) {
+ qreal averagePreferredSize = 0.;
+ qreal minimumMaximumSize = std::numeric_limits<qreal>::max();
+ qreal maximumMinimumSize = 0.;
+ for (const auto &box : rowData->boxes) {
+ averagePreferredSize += box.q_preferredSize;
+ minimumMaximumSize = qMin(minimumMaximumSize, box.q_maximumSize);
+ maximumMinimumSize = qMax(maximumMinimumSize, box.q_minimumSize);
+ }
+ averagePreferredSize /= rowData->boxes.size();
+ minimumMaximumSize = qMax(minimumMaximumSize, maximumMinimumSize);
+ averagePreferredSize = qBound(maximumMinimumSize, averagePreferredSize, minimumMaximumSize);
+ for (auto &box : rowData->boxes) {
+ box.q_preferredSize = averagePreferredSize;
+ box.q_minimumSize = maximumMinimumSize;
+ box.q_maximumSize = minimumMaximumSize;
+ }
+ }
}
void QGridLayoutEngine::ensureEffectiveFirstAndLastRows() const
{
- if (q_cachedEffectiveFirstRows[Hor] == -1 && !q_items.isEmpty()) {
+ if (q_cachedEffectiveFirstRows[Qt::Horizontal] == -1 && !q_items.isEmpty()) {
int rowCount = this->rowCount();
int columnCount = this->columnCount();
- q_cachedEffectiveFirstRows[Ver] = rowCount;
- q_cachedEffectiveFirstRows[Hor] = columnCount;
- q_cachedEffectiveLastRows[Ver] = -1;
- q_cachedEffectiveLastRows[Hor] = -1;
+ q_cachedEffectiveFirstRows = {columnCount, rowCount};
+ q_cachedEffectiveLastRows = {-1, -1};
- for (int i = q_items.count() - 1; i >= 0; --i) {
+ for (int i = q_items.size() - 1; i >= 0; --i) {
const QGridLayoutItem *item = q_items.at(i);
- for (int j = 0; j < NOrientations; ++j) {
- Qt::Orientation orientation = (j == Hor) ? Qt::Horizontal : Qt::Vertical;
- if (item->firstRow(orientation) < q_cachedEffectiveFirstRows[j])
- q_cachedEffectiveFirstRows[j] = item->firstRow(orientation);
- if (item->lastRow(orientation) > q_cachedEffectiveLastRows[j])
- q_cachedEffectiveLastRows[j] = item->lastRow(orientation);
+ for (Qt::Orientation o : {Qt::Horizontal, Qt::Vertical}) {
+ if (item->firstRow(o) < q_cachedEffectiveFirstRows[o])
+ q_cachedEffectiveFirstRows[o] = item->firstRow(o);
+ if (item->lastRow(o) > q_cachedEffectiveLastRows[o])
+ q_cachedEffectiveLastRows[o] = item->lastRow(o);
}
}
}
@@ -1569,24 +1586,23 @@ void QGridLayoutEngine::ensureColumnAndRowData(QGridLayoutRowData *rowData, QGri
Qt::Orientation orientation,
const QAbstractLayoutStyleInfo *styleInfo) const
{
- const int o = (orientation == Qt::Vertical ? Ver : Hor);
const int cc = columnCount(orientation);
const qreal constraint = (colPositions && colSizes && hasDynamicConstraint()) ? (colPositions[cc - 1] + colSizes[cc - 1]) : qreal(CachedWithNoConstraint);
- qreal &cachedConstraint = q_totalBoxCachedConstraints[o];
+ qreal &cachedConstraint = q_totalBoxCachedConstraints[orientation];
if (cachedConstraint == constraint) {
- if (totalBox != &q_totalBoxes[o])
- *totalBox = q_totalBoxes[o];
+ if (totalBox != &q_totalBoxes[orientation])
+ *totalBox = q_totalBoxes[orientation];
return;
}
rowData->reset(rowCount(orientation));
fillRowData(rowData, colPositions, colSizes, orientation, styleInfo);
- const QGridLayoutRowInfo &rowInfo = q_infos[orientation == Qt::Vertical];
+ const QGridLayoutRowInfo &rowInfo = q_infos[orientation];
rowData->distributeMultiCells(rowInfo, m_snapToPixelGrid);
*totalBox = rowData->totalBox(0, rowCount(orientation));
- if (totalBox != &q_totalBoxes[o])
- q_totalBoxes[o] = *totalBox;
+ if (totalBox != &q_totalBoxes[orientation])
+ q_totalBoxes[orientation] = *totalBox;
cachedConstraint = constraint;
}
@@ -1598,7 +1614,7 @@ void QGridLayoutEngine::ensureColumnAndRowData(QGridLayoutRowData *rowData, QGri
bool QGridLayoutEngine::ensureDynamicConstraint() const
{
if (q_cachedConstraintOrientation == UnknownConstraint) {
- for (int i = q_items.count() - 1; i >= 0; --i) {
+ for (int i = q_items.size() - 1; i >= 0; --i) {
QGridLayoutItem *item = q_items.at(i);
if (item->hasDynamicConstraint()) {
Qt::Orientation itemConstraintOrientation = item->dynamicConstraintOrientation();
@@ -1650,26 +1666,26 @@ void QGridLayoutEngine::ensureGeometries(const QSizeF &size,
if (constraintOrientation() != Qt::Horizontal) {
//We might have items whose height depends on their width (HFW)
- ensureColumnAndRowData(&q_columnData, &q_totalBoxes[Hor], nullptr, nullptr, Qt::Horizontal, styleInfo);
+ ensureColumnAndRowData(&q_columnData, &q_totalBoxes[Qt::Horizontal], nullptr, nullptr, Qt::Horizontal, styleInfo);
//Calculate column widths and positions, and put results in q_xx.data() and q_widths.data() so that we can use this information as
//constraints to find the row heights
q_columnData.calculateGeometries(0, columnCount(), size.width(), q_xx.data(), q_widths.data(),
- nullptr, q_totalBoxes[Hor], q_infos[Hor], m_snapToPixelGrid);
- ensureColumnAndRowData(&q_rowData, &q_totalBoxes[Ver], q_xx.data(), q_widths.data(), Qt::Vertical, styleInfo);
+ nullptr, q_totalBoxes[Qt::Horizontal], q_infos[Qt::Horizontal], m_snapToPixelGrid);
+ ensureColumnAndRowData(&q_rowData, &q_totalBoxes[Qt::Vertical], q_xx.data(), q_widths.data(), Qt::Vertical, styleInfo);
//Calculate row heights and positions, and put results in q_yy.data() and q_heights.data()
q_rowData.calculateGeometries(0, rowCount(), size.height(), q_yy.data(), q_heights.data(),
- q_descents.data(), q_totalBoxes[Ver], q_infos[Ver], m_snapToPixelGrid);
+ q_descents.data(), q_totalBoxes[Qt::Vertical], q_infos[Qt::Vertical], m_snapToPixelGrid);
} else {
//We have items whose width depends on their height (WFH)
- ensureColumnAndRowData(&q_rowData, &q_totalBoxes[Ver], nullptr, nullptr, Qt::Vertical, styleInfo);
+ ensureColumnAndRowData(&q_rowData, &q_totalBoxes[Qt::Vertical], nullptr, nullptr, Qt::Vertical, styleInfo);
//Calculate row heights and positions, and put results in q_yy.data() and q_heights.data() so that we can use this information as
//constraints to find the column widths
q_rowData.calculateGeometries(0, rowCount(), size.height(), q_yy.data(), q_heights.data(),
- q_descents.data(), q_totalBoxes[Ver], q_infos[Ver], m_snapToPixelGrid);
- ensureColumnAndRowData(&q_columnData, &q_totalBoxes[Hor], q_yy.data(), q_heights.data(), Qt::Horizontal, styleInfo);
+ q_descents.data(), q_totalBoxes[Qt::Vertical], q_infos[Qt::Vertical], m_snapToPixelGrid);
+ ensureColumnAndRowData(&q_columnData, &q_totalBoxes[Qt::Horizontal], q_yy.data(), q_heights.data(), Qt::Horizontal, styleInfo);
//Calculate row heights and positions, and put results in q_yy.data() and q_heights.data()
q_columnData.calculateGeometries(0, columnCount(), size.width(), q_xx.data(), q_widths.data(),
- nullptr, q_totalBoxes[Hor], q_infos[Hor], m_snapToPixelGrid);
+ nullptr, q_totalBoxes[Qt::Horizontal], q_infos[Qt::Horizontal], m_snapToPixelGrid);
}
}
diff --git a/src/gui/util/qgridlayoutengine_p.h b/src/gui/util/qgridlayoutengine_p.h
index 181326103b..2f60cb99fd 100644
--- a/src/gui/util/qgridlayoutengine_p.h
+++ b/src/gui/util/qgridlayoutengine_p.h
@@ -1,41 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the QtGui module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#ifndef QGRIDLAYOUTENGINE_P_H
#define QGRIDLAYOUTENGINE_P_H
@@ -52,14 +16,16 @@
//
#include <QtGui/private/qtguiglobal_p.h>
-#include "qalgorithms.h"
-#include "qbitarray.h"
-#include "qlist.h"
-#include "qmap.h"
-#include "qpair.h"
-#include <QtCore/qvector.h>
+
+#include <QtCore/qalgorithms.h>
+#include <QtCore/qbitarray.h>
+#include <QtCore/qlist.h>
+#include <QtCore/qmap.h>
+#include <QtCore/qpair.h>
#include <QtCore/qsize.h>
#include <QtCore/qrect.h>
+#include <QtCore/qdebug.h>
+
#include <float.h>
#include "qlayoutpolicy_p.h"
#include "qabstractlayoutstyleinfo_p.h"
@@ -80,13 +46,6 @@ enum {
};
// do not reorder
-enum {
- Hor,
- Ver,
- NOrientations
-};
-
-// do not reorder
enum LayoutSide {
Left,
Top,
@@ -102,6 +61,44 @@ enum {
UnfeasibleConstraint // not feasible, it be has some items with Vertical and others with Horizontal constraints
};
+/*
+ Minimal container to store Qt::Orientation-discriminated values.
+
+ The salient feature is the indexing operator, which takes
+ Qt::Orientation (and assumes it's passed only Qt::Horizontal or Qt::Vertical).
+*/
+template <typename T>
+class QHVContainer {
+ T m_data[2];
+
+ static_assert(Qt::Horizontal == 0x1);
+ static_assert(Qt::Vertical == 0x2);
+ static constexpr int map(Qt::Orientation o) noexcept
+ {
+ return int(o) - 1;
+ }
+ static constexpr int mapOther(Qt::Orientation o) noexcept
+ {
+ return 2 - int(o);
+ }
+public:
+ constexpr QHVContainer(const T &h, const T &v)
+ noexcept(std::is_nothrow_copy_constructible_v<T>)
+ : m_data{h, v} {}
+ QHVContainer() = default;
+
+ constexpr T &operator[](Qt::Orientation o) noexcept { return m_data[map(o)]; }
+ constexpr const T &operator[](Qt::Orientation o) const noexcept { return m_data[map(o)]; }
+
+ constexpr T &other(Qt::Orientation o) noexcept { return m_data[mapOther(o)]; }
+ constexpr const T &other(Qt::Orientation o) const noexcept { return m_data[mapOther(o)]; }
+
+ constexpr void transpose() noexcept { qSwap(m_data[0], m_data[1]); }
+ constexpr QHVContainer transposed() const
+ noexcept(std::is_nothrow_copy_constructible_v<T>)
+ { return {m_data[1], m_data[0]}; }
+};
+
template <typename T>
class QLayoutParameter
{
@@ -162,56 +159,27 @@ public:
qreal q_minimumAscent;
inline qreal &q_sizes(int which)
{
- qreal *t;
- switch (which) {
- case Qt::MinimumSize:
- t = &q_minimumSize;
- break;
- case Qt::PreferredSize:
- t = &q_preferredSize;
- break;
- case Qt::MaximumSize:
- t = &q_maximumSize;
- break;
- case Qt::MinimumDescent:
- t = &q_minimumDescent;
- break;
- case (Qt::MinimumDescent + 1):
- t = &q_minimumAscent;
- break;
- default:
- t = nullptr;
- break;
- }
- return *t;
+ return const_cast<qreal&>(static_cast<const QGridLayoutBox*>(this)->q_sizes(which));
}
inline const qreal &q_sizes(int which) const
{
- const qreal *t;
switch (which) {
case Qt::MinimumSize:
- t = &q_minimumSize;
- break;
+ return q_minimumSize;
case Qt::PreferredSize:
- t = &q_preferredSize;
- break;
+ return q_preferredSize;
case Qt::MaximumSize:
- t = &q_maximumSize;
- break;
+ return q_maximumSize;
case Qt::MinimumDescent:
- t = &q_minimumDescent;
- break;
+ return q_minimumDescent;
case (Qt::MinimumDescent + 1):
- t = &q_minimumAscent;
- break;
+ return q_minimumAscent;
default:
- t = nullptr;
- break;
+ Q_UNREACHABLE();
}
- return *t;
}
};
-Q_DECLARE_TYPEINFO(QGridLayoutBox, Q_MOVABLE_TYPE); // cannot be Q_PRIMITIVE_TYPE, as q_maximumSize, say, is != 0
+Q_DECLARE_TYPEINFO(QGridLayoutBox, Q_RELOCATABLE_TYPE); // cannot be Q_PRIMITIVE_TYPE, as q_maximumSize, say, is != 0
bool operator==(const QGridLayoutBox &box1, const QGridLayoutBox &box2);
inline bool operator!=(const QGridLayoutBox &box1, const QGridLayoutBox &box2)
@@ -246,10 +214,10 @@ public:
#endif
QBitArray ignore; // ### rename q_
- QVector<QGridLayoutBox> boxes;
+ QList<QGridLayoutBox> boxes;
MultiCellMap multiCellMap;
- QVector<int> stretches;
- QVector<qreal> spacings;
+ QList<int> stretches;
+ QList<qreal> spacings;
bool hasIgnoreFlag;
};
@@ -265,10 +233,10 @@ public:
#endif
int count;
- QVector<QStretchParameter> stretches;
- QVector<QLayoutParameter<qreal> > spacings;
- QVector<Qt::Alignment> alignments;
- QVector<QGridLayoutBox> boxes;
+ QList<QStretchParameter> stretches;
+ QList<QLayoutParameter<qreal>> spacings;
+ QList<Qt::Alignment> alignments;
+ QList<QGridLayoutBox> boxes;
};
@@ -279,10 +247,10 @@ public:
Qt::Alignment alignment = { });
virtual ~QGridLayoutItem() {}
- inline int firstRow() const { return q_firstRows[Ver]; }
- inline int firstColumn() const { return q_firstRows[Hor]; }
- inline int rowSpan() const { return q_rowSpans[Ver]; }
- inline int columnSpan() const { return q_rowSpans[Hor]; }
+ inline int firstRow() const { return q_firstRows[Qt::Vertical]; }
+ inline int firstColumn() const { return q_firstRows[Qt::Horizontal]; }
+ inline int rowSpan() const { return q_rowSpans[Qt::Vertical]; }
+ inline int columnSpan() const { return q_rowSpans[Qt::Horizontal]; }
inline int lastRow() const { return firstRow() + rowSpan() - 1; }
inline int lastColumn() const { return firstColumn() + columnSpan() - 1; }
@@ -303,7 +271,7 @@ public:
virtual QLayoutPolicy::Policy sizePolicy(Qt::Orientation orientation) const = 0;
virtual QSizeF sizeHint(Qt::SizeHint which, const QSizeF &constraint) const = 0;
- virtual bool isIgnored() const { return false; }
+ virtual bool isEmpty() const { return false; }
virtual void setGeometry(const QRectF &rect) = 0;
/*
@@ -316,6 +284,8 @@ public:
virtual QLayoutPolicy::ControlTypes controlTypes(LayoutSide side) const;
+ inline virtual QString toString() const { return QDebug::toString(this); }
+
QRectF geometryWithin(qreal x, qreal y, qreal width, qreal height, qreal rowDescent, Qt::Alignment align, bool snapToPixelGrid) const;
QGridLayoutBox box(Qt::Orientation orientation, bool snapToPixelGrid, qreal constraint = -1.0) const;
@@ -329,9 +299,9 @@ public:
#endif
private:
- int q_firstRows[NOrientations];
- int q_rowSpans[NOrientations];
- int q_stretches[NOrientations];
+ QHVContainer<int> q_firstRows;
+ QHVContainer<int> q_rowSpans;
+ QHVContainer<int> q_stretches;
Qt::Alignment q_alignment;
};
@@ -344,8 +314,8 @@ public:
int rowCount(Qt::Orientation orientation) const;
int columnCount(Qt::Orientation orientation) const;
- inline int rowCount() const { return q_infos[Ver].count; }
- inline int columnCount() const { return q_infos[Hor].count; }
+ inline int rowCount() const { return q_infos[Qt::Vertical].count; }
+ inline int columnCount() const { return q_infos[Qt::Horizontal].count; }
// returns the number of items inserted, which may be less than (rowCount * columnCount)
int itemCount() const;
QGridLayoutItem *itemAt(int index) const;
@@ -367,6 +337,12 @@ public:
qreal rowSizeHint(Qt::SizeHint which, int row,
Qt::Orientation orientation = Qt::Vertical) const;
+ bool uniformCellWidths() const;
+ void setUniformCellWidths(bool uniformCellWidths);
+
+ bool uniformCellHeights() const;
+ void setUniformCellHeights(bool uniformCellHeights);
+
void setRowAlignment(int row, Qt::Alignment alignment, Qt::Orientation orientation);
Qt::Alignment rowAlignment(int row, Qt::Orientation orientation) const;
@@ -440,28 +416,30 @@ protected:
QList<QGridLayoutItem *> q_items;
private:
// User input
- QVector<QGridLayoutItem *> q_grid;
- QLayoutParameter<qreal> q_defaultSpacings[NOrientations];
- QGridLayoutRowInfo q_infos[NOrientations];
+ QList<QGridLayoutItem *> q_grid;
+ QHVContainer<QLayoutParameter<qreal>> q_defaultSpacings;
+ QHVContainer<QGridLayoutRowInfo> q_infos;
Qt::LayoutDirection m_visualDirection;
// Configuration
Qt::Alignment m_defaultAlignment;
unsigned m_snapToPixelGrid : 1;
+ unsigned m_uniformCellWidths : 1;
+ unsigned m_uniformCellHeights : 1;
// Lazily computed from the above user input
- mutable int q_cachedEffectiveFirstRows[NOrientations];
- mutable int q_cachedEffectiveLastRows[NOrientations];
+ mutable QHVContainer<int> q_cachedEffectiveFirstRows;
+ mutable QHVContainer<int> q_cachedEffectiveLastRows;
mutable quint8 q_cachedConstraintOrientation : 3;
// this is useful to cache
- mutable QGridLayoutBox q_totalBoxes[NOrientations];
+ mutable QHVContainer<QGridLayoutBox> q_totalBoxes;
enum {
NotCached = -2, // Cache is empty. Happens when the engine is invalidated.
CachedWithNoConstraint = -1 // cache has a totalBox without any HFW/WFH constraints.
// >= 0 // cache has a totalBox with this specific constraint.
};
- mutable qreal q_totalBoxCachedConstraints[NOrientations]; // holds the constraint used for the cached totalBox
+ mutable QHVContainer<qreal> q_totalBoxCachedConstraints; // holds the constraint used for the cached totalBox
// Layout item input
mutable QGridLayoutRowData q_columnData;
@@ -469,11 +447,11 @@ private:
// Output
mutable QSizeF q_cachedSize;
- mutable QVector<qreal> q_xx;
- mutable QVector<qreal> q_yy;
- mutable QVector<qreal> q_widths;
- mutable QVector<qreal> q_heights;
- mutable QVector<qreal> q_descents;
+ mutable QList<qreal> q_xx;
+ mutable QList<qreal> q_yy;
+ mutable QList<qreal> q_widths;
+ mutable QList<qreal> q_heights;
+ mutable QList<qreal> q_descents;
friend class QGridLayoutItem;
};
diff --git a/src/gui/util/qhexstring_p.h b/src/gui/util/qhexstring_p.h
index d30a8eeee8..2b42e6c43e 100644
--- a/src/gui/util/qhexstring_p.h
+++ b/src/gui/util/qhexstring_p.h
@@ -1,41 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the QtGui module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#include <QtGui/private/qtguiglobal_p.h>
#include <QtCore/qpoint.h>
@@ -69,7 +33,7 @@ template <typename T>
inline void write(QChar *&dest) const
{
- const ushort hexChars[] = { '0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'a', 'b', 'c', 'd', 'e', 'f' };
+ const char16_t hexChars[] = { '0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'a', 'b', 'c', 'd', 'e', 'f' };
const char *c = reinterpret_cast<const char *>(&val);
for (uint i = 0; i < sizeof(T); ++i) {
*dest++ = hexChars[*c & 0xf];
diff --git a/src/gui/util/qktxhandler.cpp b/src/gui/util/qktxhandler.cpp
index 7eda4c46fb..35f1df1185 100644
--- a/src/gui/util/qktxhandler.cpp
+++ b/src/gui/util/qktxhandler.cpp
@@ -1,46 +1,12 @@
-/****************************************************************************
-**
-** Copyright (C) 2017 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the QtGui module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2017 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#include "qktxhandler_p.h"
#include "qtexturefiledata_p.h"
#include <QtEndian>
#include <QSize>
+#include <QMap>
+#include <QtCore/qiodevice.h>
//#define KTX_DEBUG
#ifdef KTX_DEBUG
@@ -51,6 +17,8 @@
QT_BEGIN_NAMESPACE
+using namespace Qt::StringLiterals;
+
#define KTX_IDENTIFIER_LENGTH 12
static const char ktxIdentifier[KTX_IDENTIFIER_LENGTH] = { '\xAB', 'K', 'T', 'X', ' ', '1', '1', '\xBB', '\r', '\n', '\x1A', '\n' };
static const quint32 platformEndianIdentifier = 0x04030201;
@@ -73,7 +41,7 @@ struct KTXHeader {
quint32 bytesOfKeyValueData;
};
-static const quint32 headerSize = sizeof(KTXHeader);
+static constexpr quint32 qktxh_headerSize = sizeof(KTXHeader);
// Currently unused, declared for future reference
struct KTXKeyValuePairItem {
@@ -103,11 +71,32 @@ struct KTXMipmapLevel {
*/
};
-bool QKtxHandler::canRead(const QByteArray &suffix, const QByteArray &block)
+// Returns the nearest multiple of 4 greater than or equal to 'value'
+static const std::optional<quint32> nearestMultipleOf4(quint32 value)
{
- Q_UNUSED(suffix)
+ constexpr quint32 rounding = 4;
+ quint32 result = 0;
+ if (qAddOverflow(value, rounding - 1, &result))
+ return std::nullopt;
+ result &= ~(rounding - 1);
+ return result;
+}
- return (qstrncmp(block.constData(), ktxIdentifier, KTX_IDENTIFIER_LENGTH) == 0);
+// Returns a view with prechecked bounds
+static QByteArrayView safeView(QByteArrayView view, quint32 start, quint32 length)
+{
+ quint32 end = 0;
+ if (qAddOverflow(start, length, &end) || end > quint32(view.length()))
+ return {};
+ return view.sliced(start, length);
+}
+
+QKtxHandler::~QKtxHandler() = default;
+
+bool QKtxHandler::canRead(const QByteArray &suffix, const QByteArray &block)
+{
+ Q_UNUSED(suffix);
+ return block.startsWith(ktxIdentifier);
}
QTextureFileData QKtxHandler::read()
@@ -115,42 +104,123 @@ QTextureFileData QKtxHandler::read()
if (!device())
return QTextureFileData();
- QByteArray buf = device()->readAll();
- const quint32 dataSize = quint32(buf.size());
- if (dataSize < headerSize || !canRead(QByteArray(), buf)) {
- qCDebug(lcQtGuiTextureIO, "Invalid KTX file %s", logName().constData());
+ const QByteArray buf = device()->readAll();
+ if (static_cast<size_t>(buf.size()) > std::numeric_limits<quint32>::max()) {
+ qWarning(lcQtGuiTextureIO, "Too big KTX file %s", logName().constData());
+ return QTextureFileData();
+ }
+
+ if (!canRead(QByteArray(), buf)) {
+ qWarning(lcQtGuiTextureIO, "Invalid KTX file %s", logName().constData());
+ return QTextureFileData();
+ }
+
+ if (buf.size() < qsizetype(qktxh_headerSize)) {
+ qWarning(lcQtGuiTextureIO, "Invalid KTX header size in %s", logName().constData());
return QTextureFileData();
}
- const KTXHeader *header = reinterpret_cast<const KTXHeader *>(buf.constData());
- if (!checkHeader(*header)) {
- qCDebug(lcQtGuiTextureIO, "Unsupported KTX file format in %s", logName().constData());
+ KTXHeader header;
+ memcpy(&header, buf.data(), qktxh_headerSize);
+ if (!checkHeader(header)) {
+ qWarning(lcQtGuiTextureIO, "Unsupported KTX file format in %s", logName().constData());
return QTextureFileData();
}
QTextureFileData texData;
texData.setData(buf);
- texData.setSize(QSize(decode(header->pixelWidth), decode(header->pixelHeight)));
- texData.setGLFormat(decode(header->glFormat));
- texData.setGLInternalFormat(decode(header->glInternalFormat));
- texData.setGLBaseInternalFormat(decode(header->glBaseInternalFormat));
-
- texData.setNumLevels(decode(header->numberOfMipmapLevels));
- quint32 offset = headerSize + decode(header->bytesOfKeyValueData);
- const int maxLevels = qMin(texData.numLevels(), 32); // Cap iterations in case of corrupt file.
- for (int i = 0; i < maxLevels; i++) {
- if (offset + sizeof(KTXMipmapLevel) > dataSize) // Corrupt file; avoid oob read
- break;
- const KTXMipmapLevel *level = reinterpret_cast<const KTXMipmapLevel *>(buf.constData() + offset);
- quint32 levelLen = decode(level->imageSize);
- texData.setDataOffset(offset + sizeof(KTXMipmapLevel::imageSize), i);
- texData.setDataLength(levelLen, i);
- offset += sizeof(KTXMipmapLevel::imageSize) + levelLen + (3 - ((levelLen + 3) % 4));
+ texData.setSize(QSize(decode(header.pixelWidth), decode(header.pixelHeight)));
+ texData.setGLFormat(decode(header.glFormat));
+ texData.setGLInternalFormat(decode(header.glInternalFormat));
+ texData.setGLBaseInternalFormat(decode(header.glBaseInternalFormat));
+
+ texData.setNumLevels(decode(header.numberOfMipmapLevels));
+ texData.setNumFaces(decode(header.numberOfFaces));
+
+ const quint32 bytesOfKeyValueData = decode(header.bytesOfKeyValueData);
+ quint32 headerKeyValueSize;
+ if (qAddOverflow(qktxh_headerSize, bytesOfKeyValueData, &headerKeyValueSize)) {
+ qWarning(lcQtGuiTextureIO, "Overflow in size of key value data in header of KTX file %s",
+ logName().constData());
+ return QTextureFileData();
+ }
+
+ if (headerKeyValueSize >= quint32(buf.size())) {
+ qWarning(lcQtGuiTextureIO, "OOB request in KTX file %s", logName().constData());
+ return QTextureFileData();
+ }
+
+ // File contains key/values
+ if (bytesOfKeyValueData > 0) {
+ auto keyValueDataView = safeView(buf, qktxh_headerSize, bytesOfKeyValueData);
+ if (keyValueDataView.isEmpty()) {
+ qWarning(lcQtGuiTextureIO, "Invalid view in KTX file %s", logName().constData());
+ return QTextureFileData();
+ }
+
+ auto keyValues = decodeKeyValues(keyValueDataView);
+ if (!keyValues) {
+ qWarning(lcQtGuiTextureIO, "Could not parse key values in KTX file %s",
+ logName().constData());
+ return QTextureFileData();
+ }
+
+ texData.setKeyValueMetadata(*keyValues);
+ }
+
+ // Technically, any number of levels is allowed but if the value is bigger than
+ // what is possible in KTX V2 (and what makes sense) we return an error.
+ // maxLevels = log2(max(width, height, depth))
+ const int maxLevels = (sizeof(quint32) * 8)
+ - qCountLeadingZeroBits(std::max(
+ { header.pixelWidth, header.pixelHeight, header.pixelDepth }));
+
+ if (texData.numLevels() > maxLevels) {
+ qWarning(lcQtGuiTextureIO, "Too many levels in KTX file %s", logName().constData());
+ return QTextureFileData();
+ }
+
+ if (texData.numFaces() != 1 && texData.numFaces() != 6) {
+ qWarning(lcQtGuiTextureIO, "Invalid number of faces in KTX file %s", logName().constData());
+ return QTextureFileData();
+ }
+
+ quint32 offset = headerKeyValueSize;
+ for (int level = 0; level < texData.numLevels(); level++) {
+ const auto imageSizeView = safeView(buf, offset, sizeof(quint32));
+ if (imageSizeView.isEmpty()) {
+ qWarning(lcQtGuiTextureIO, "OOB request in KTX file %s", logName().constData());
+ return QTextureFileData();
+ }
+
+ const quint32 imageSize = decode(qFromUnaligned<quint32>(imageSizeView.data()));
+ offset += sizeof(quint32); // overflow checked indirectly above
+
+ for (int face = 0; face < texData.numFaces(); face++) {
+ texData.setDataOffset(offset, level, face);
+ texData.setDataLength(imageSize, level, face);
+
+ // Add image data and padding to offset
+ const auto padded = nearestMultipleOf4(imageSize);
+ if (!padded) {
+ qWarning(lcQtGuiTextureIO, "Overflow in KTX file %s", logName().constData());
+ return QTextureFileData();
+ }
+
+ quint32 offsetNext;
+ if (qAddOverflow(offset, *padded, &offsetNext)) {
+ qWarning(lcQtGuiTextureIO, "OOB request in KTX file %s", logName().constData());
+ return QTextureFileData();
+ }
+
+ offset = offsetNext;
+ }
}
if (!texData.isValid()) {
- qCDebug(lcQtGuiTextureIO, "Invalid values in header of KTX file %s", logName().constData());
+ qWarning(lcQtGuiTextureIO, "Invalid values in header of KTX file %s",
+ logName().constData());
return QTextureFileData();
}
@@ -174,9 +244,12 @@ bool QKtxHandler::checkHeader(const KTXHeader &header)
qDebug("Header of %s:", logName().constData());
qDebug(" glType: 0x%x (%s)", decode(header.glType), ptme.valueToKey(decode(header.glType)));
qDebug(" glTypeSize: %u", decode(header.glTypeSize));
- qDebug(" glFormat: 0x%x (%s)", decode(header.glFormat), tfme.valueToKey(decode(header.glFormat)));
- qDebug(" glInternalFormat: 0x%x (%s)", decode(header.glInternalFormat), tfme.valueToKey(decode(header.glInternalFormat)));
- qDebug(" glBaseInternalFormat: 0x%x (%s)", decode(header.glBaseInternalFormat), tfme.valueToKey(decode(header.glBaseInternalFormat)));
+ qDebug(" glFormat: 0x%x (%s)", decode(header.glFormat),
+ tfme.valueToKey(decode(header.glFormat)));
+ qDebug(" glInternalFormat: 0x%x (%s)", decode(header.glInternalFormat),
+ tfme.valueToKey(decode(header.glInternalFormat)));
+ qDebug(" glBaseInternalFormat: 0x%x (%s)", decode(header.glBaseInternalFormat),
+ tfme.valueToKey(decode(header.glBaseInternalFormat)));
qDebug(" pixelWidth: %u", decode(header.pixelWidth));
qDebug(" pixelHeight: %u", decode(header.pixelHeight));
qDebug(" pixelDepth: %u", decode(header.pixelDepth));
@@ -185,13 +258,97 @@ bool QKtxHandler::checkHeader(const KTXHeader &header)
qDebug(" numberOfMipmapLevels: %u", decode(header.numberOfMipmapLevels));
qDebug(" bytesOfKeyValueData: %u", decode(header.bytesOfKeyValueData));
#endif
- return ((decode(header.glType) == 0) &&
- (decode(header.glFormat) == 0) &&
- (decode(header.pixelDepth) == 0) &&
- (decode(header.numberOfFaces) == 1));
+ const bool isCompressedImage = decode(header.glType) == 0 && decode(header.glFormat) == 0
+ && decode(header.pixelDepth) == 0;
+ const bool isCubeMap = decode(header.numberOfFaces) == 6;
+ const bool is2D = decode(header.pixelDepth) == 0 && decode(header.numberOfArrayElements) == 0;
+
+ return is2D && (isCubeMap || isCompressedImage);
+}
+
+std::optional<QMap<QByteArray, QByteArray>> QKtxHandler::decodeKeyValues(QByteArrayView view) const
+{
+ QMap<QByteArray, QByteArray> output;
+ quint32 offset = 0;
+ while (offset < quint32(view.size())) {
+ const auto keyAndValueByteSizeView = safeView(view, offset, sizeof(quint32));
+ if (keyAndValueByteSizeView.isEmpty()) {
+ qWarning(lcQtGuiTextureIO, "Invalid view in KTX key-value");
+ return std::nullopt;
+ }
+
+ const quint32 keyAndValueByteSize =
+ decode(qFromUnaligned<quint32>(keyAndValueByteSizeView.data()));
+
+ quint32 offsetKeyAndValueStart;
+ if (qAddOverflow(offset, quint32(sizeof(quint32)), &offsetKeyAndValueStart)) {
+ qWarning(lcQtGuiTextureIO, "Overflow in KTX key-value");
+ return std::nullopt;
+ }
+
+ quint32 offsetKeyAndValueEnd;
+ if (qAddOverflow(offsetKeyAndValueStart, keyAndValueByteSize, &offsetKeyAndValueEnd)) {
+ qWarning(lcQtGuiTextureIO, "Overflow in KTX key-value");
+ return std::nullopt;
+ }
+
+ const auto keyValueView = safeView(view, offsetKeyAndValueStart, keyAndValueByteSize);
+ if (keyValueView.isEmpty()) {
+ qWarning(lcQtGuiTextureIO, "Invalid view in KTX key-value");
+ return std::nullopt;
+ }
+
+ // 'key' is a UTF-8 string ending with a null terminator, 'value' is the rest.
+ // To separate the key and value we convert the complete data to utf-8 and find the first
+ // null terminator from the left, here we split the data into two.
+
+ const int idx = keyValueView.indexOf('\0');
+ if (idx == -1) {
+ qWarning(lcQtGuiTextureIO, "Invalid key in KTX key-value");
+ return std::nullopt;
+ }
+
+ const QByteArrayView keyView = safeView(view, offsetKeyAndValueStart, idx);
+ if (keyView.isEmpty()) {
+ qWarning(lcQtGuiTextureIO, "Overflow in KTX key-value");
+ return std::nullopt;
+ }
+
+ const quint32 keySize = idx + 1; // Actual data size
+
+ quint32 offsetValueStart;
+ if (qAddOverflow(offsetKeyAndValueStart, keySize, &offsetValueStart)) {
+ qWarning(lcQtGuiTextureIO, "Overflow in KTX key-value");
+ return std::nullopt;
+ }
+
+ quint32 valueSize;
+ if (qSubOverflow(keyAndValueByteSize, keySize, &valueSize)) {
+ qWarning(lcQtGuiTextureIO, "Underflow in KTX key-value");
+ return std::nullopt;
+ }
+
+ const QByteArrayView valueView = safeView(view, offsetValueStart, valueSize);
+ if (valueView.isEmpty()) {
+ qWarning(lcQtGuiTextureIO, "Invalid view in KTX key-value");
+ return std::nullopt;
+ }
+
+ output.insert(keyView.toByteArray(), valueView.toByteArray());
+
+ const auto offsetNext = nearestMultipleOf4(offsetKeyAndValueEnd);
+ if (!offsetNext) {
+ qWarning(lcQtGuiTextureIO, "Overflow in KTX key-value");
+ return std::nullopt;
+ }
+
+ offset = *offsetNext;
+ }
+
+ return output;
}
-quint32 QKtxHandler::decode(quint32 val)
+quint32 QKtxHandler::decode(quint32 val) const
{
return inverseEndian ? qbswap<quint32>(val) : val;
}
diff --git a/src/gui/util/qktxhandler_p.h b/src/gui/util/qktxhandler_p.h
index 19f7b0e79a..3a0b8fcf7e 100644
--- a/src/gui/util/qktxhandler_p.h
+++ b/src/gui/util/qktxhandler_p.h
@@ -1,41 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2017 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the QtGui module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2017 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#ifndef QKTXHANDLER_H
#define QKTXHANDLER_H
@@ -53,6 +17,8 @@
#include "qtexturefilehandler_p.h"
+#include <optional>
+
QT_BEGIN_NAMESPACE
struct KTXHeader;
@@ -61,6 +27,7 @@ class QKtxHandler : public QTextureFileHandler
{
public:
using QTextureFileHandler::QTextureFileHandler;
+ ~QKtxHandler() override;
static bool canRead(const QByteArray &suffix, const QByteArray &block);
@@ -68,7 +35,8 @@ public:
private:
bool checkHeader(const KTXHeader &header);
- quint32 decode(quint32 val);
+ std::optional<QMap<QByteArray, QByteArray>> decodeKeyValues(QByteArrayView view) const;
+ quint32 decode(quint32 val) const;
bool inverseEndian = false;
};
diff --git a/src/gui/util/qlayoutpolicy.cpp b/src/gui/util/qlayoutpolicy.cpp
index 507df44a45..2e3a0b32cb 100644
--- a/src/gui/util/qlayoutpolicy.cpp
+++ b/src/gui/util/qlayoutpolicy.cpp
@@ -1,41 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the QtGui module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#include "qlayoutpolicy_p.h"
#include <QtCore/qdebug.h>
@@ -133,3 +97,5 @@ QDebug operator<<(QDebug dbg, const QLayoutPolicy &p)
#endif
QT_END_NAMESPACE
+
+#include "moc_qlayoutpolicy_p.cpp"
diff --git a/src/gui/util/qlayoutpolicy_p.h b/src/gui/util/qlayoutpolicy_p.h
index 6457aeb653..bbdabd0c7b 100644
--- a/src/gui/util/qlayoutpolicy_p.h
+++ b/src/gui/util/qlayoutpolicy_p.h
@@ -1,41 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the QtGui module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#ifndef QLAYOUTPOLICY_H
#define QLAYOUTPOLICY_H
@@ -64,10 +28,9 @@ QT_BEGIN_NAMESPACE
class QVariant;
-class Q_GUI_EXPORT QLayoutPolicy
+class QLayoutPolicy
{
- Q_GADGET
- Q_ENUMS(Policy)
+ Q_GADGET_EXPORT(Q_GUI_EXPORT)
public:
enum PolicyFlag {
@@ -76,16 +39,16 @@ public:
ShrinkFlag = 4,
IgnoreFlag = 8
};
+ Q_DECLARE_FLAGS(Policy, PolicyFlag)
+ Q_FLAG(Policy)
- enum Policy {
- Fixed = 0,
- Minimum = GrowFlag,
- Maximum = ShrinkFlag,
- Preferred = GrowFlag | ShrinkFlag,
- MinimumExpanding = GrowFlag | ExpandFlag,
- Expanding = GrowFlag | ShrinkFlag | ExpandFlag,
- Ignored = ShrinkFlag | GrowFlag | IgnoreFlag
- };
+ static constexpr inline Policy Fixed = {};
+ static constexpr inline Policy Minimum = GrowFlag;
+ static constexpr inline Policy Maximum = ShrinkFlag;
+ static constexpr inline Policy Preferred = Minimum | Maximum;
+ static constexpr inline Policy MinimumExpanding = Minimum | ExpandFlag;
+ static constexpr inline Policy Expanding = Preferred | ExpandFlag;
+ static constexpr inline Policy Ignored = Preferred | IgnoreFlag;
enum ControlType {
DefaultType = 0x00000001,
@@ -116,11 +79,11 @@ public:
}
Policy horizontalPolicy() const { return static_cast<Policy>(bits.horPolicy); }
Policy verticalPolicy() const { return static_cast<Policy>(bits.verPolicy); }
- ControlType controlType() const;
+ Q_GUI_EXPORT ControlType controlType() const;
void setHorizontalPolicy(Policy d) { bits.horPolicy = d; }
void setVerticalPolicy(Policy d) { bits.verPolicy = d; }
- void setControlType(ControlType type);
+ Q_GUI_EXPORT void setControlType(ControlType type);
Qt::Orientations expandingDirections() const {
Qt::Orientations result;
@@ -144,7 +107,7 @@ public:
void setHorizontalStretch(int stretchFactor) { bits.horStretch = static_cast<quint32>(qBound(0, stretchFactor, 255)); }
void setVerticalStretch(int stretchFactor) { bits.verStretch = static_cast<quint32>(qBound(0, stretchFactor, 255)); }
- void transpose();
+ inline void transpose();
private:
@@ -169,6 +132,7 @@ private:
};
};
+Q_DECLARE_OPERATORS_FOR_FLAGS(QLayoutPolicy::Policy)
Q_DECLARE_OPERATORS_FOR_FLAGS(QLayoutPolicy::ControlTypes)
#ifndef QT_NO_DATASTREAM
diff --git a/src/gui/util/qpkmhandler.cpp b/src/gui/util/qpkmhandler.cpp
index e0c3b75efe..d84ce2ce7f 100644
--- a/src/gui/util/qpkmhandler.cpp
+++ b/src/gui/util/qpkmhandler.cpp
@@ -1,41 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2017 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the QtGui module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2017 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#include "qpkmhandler_p.h"
#include "qtexturefiledata_p.h"
@@ -49,7 +13,7 @@
QT_BEGIN_NAMESPACE
-static const int headerSize = 16;
+static const int qpkmh_headerSize = 16;
struct PkmType
{
@@ -57,7 +21,7 @@ struct PkmType
quint32 bytesPerBlock;
};
-static PkmType typeMap[5] = {
+static constexpr PkmType typeMap[5] = {
{ 0x8D64, 8 }, // GL_ETC1_RGB8_OES
{ 0x9274, 8 }, // GL_COMPRESSED_RGB8_ETC2
{ 0, 0 }, // unused (obsolete)
@@ -65,9 +29,11 @@ static PkmType typeMap[5] = {
{ 0x9276, 8 } // GL_COMPRESSED_RGB8_PUNCHTHROUGH_ALPHA1_ETC2
};
+QPkmHandler::~QPkmHandler() = default;
+
bool QPkmHandler::canRead(const QByteArray &suffix, const QByteArray &block)
{
- Q_UNUSED(suffix)
+ Q_UNUSED(suffix);
return block.startsWith("PKM ");
}
@@ -80,7 +46,7 @@ QTextureFileData QPkmHandler::read()
return texData;
QByteArray fileData = device()->readAll();
- if (fileData.size() < headerSize || !canRead(QByteArray(), fileData)) {
+ if (fileData.size() < qpkmh_headerSize || !canRead(QByteArray(), fileData)) {
qCDebug(lcQtGuiTextureIO, "Invalid PKM file %s", logName().constData());
return QTextureFileData();
}
@@ -102,13 +68,14 @@ QTextureFileData QPkmHandler::read()
// texture size
texData.setNumLevels(1);
+ texData.setNumFaces(1);
const int bpb = typeMap[type].bytesPerBlock;
QSize paddedSize(qFromBigEndian<quint16>(rawData + 8), qFromBigEndian<quint16>(rawData + 10));
texData.setDataLength((paddedSize.width() / 4) * (paddedSize.height() / 4) * bpb);
QSize texSize(qFromBigEndian<quint16>(rawData + 12), qFromBigEndian<quint16>(rawData + 14));
texData.setSize(texSize);
- texData.setDataOffset(headerSize);
+ texData.setDataOffset(qpkmh_headerSize);
if (!texData.isValid()) {
qCDebug(lcQtGuiTextureIO, "Invalid values in header of PKM file %s", logName().constData());
diff --git a/src/gui/util/qpkmhandler_p.h b/src/gui/util/qpkmhandler_p.h
index 2f7618bc53..a773b44fb2 100644
--- a/src/gui/util/qpkmhandler_p.h
+++ b/src/gui/util/qpkmhandler_p.h
@@ -1,41 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2017 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the QtGui module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2017 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#ifndef QPKMHANDLER_H
#define QPKMHANDLER_H
@@ -59,6 +23,7 @@ class QPkmHandler : public QTextureFileHandler
{
public:
using QTextureFileHandler::QTextureFileHandler;
+ ~QPkmHandler() override;
static bool canRead(const QByteArray &suffix, const QByteArray &block);
diff --git a/src/gui/util/qshaderformat.cpp b/src/gui/util/qshaderformat.cpp
deleted file mode 100644
index ea86dd6ca5..0000000000
--- a/src/gui/util/qshaderformat.cpp
+++ /dev/null
@@ -1,145 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2017 Klaralvdalens Datakonsult AB (KDAB).
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the QtGui module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "qshaderformat_p.h"
-
-QT_BEGIN_NAMESPACE
-
-QShaderFormat::QShaderFormat() noexcept
- : m_api(NoApi)
- , m_shaderType(Fragment)
-{
-}
-
-QShaderFormat::Api QShaderFormat::api() const noexcept
-{
- return m_api;
-}
-
-void QShaderFormat::setApi(QShaderFormat::Api api) noexcept
-{
- m_api = api;
-}
-
-QVersionNumber QShaderFormat::version() const noexcept
-{
- return m_version;
-}
-
-void QShaderFormat::setVersion(const QVersionNumber &version) noexcept
-{
- m_version = version;
-}
-
-QStringList QShaderFormat::extensions() const noexcept
-{
- return m_extensions;
-}
-
-void QShaderFormat::setExtensions(const QStringList &extensions) noexcept
-{
- m_extensions = extensions;
- m_extensions.sort();
-}
-
-QString QShaderFormat::vendor() const noexcept
-{
- return m_vendor;
-}
-
-void QShaderFormat::setVendor(const QString &vendor) noexcept
-{
- m_vendor = vendor;
-}
-
-bool QShaderFormat::isValid() const noexcept
-{
- return m_api != NoApi && m_version.majorVersion() > 0;
-}
-
-bool QShaderFormat::supports(const QShaderFormat &other) const noexcept
-{
- if (!isValid() || !other.isValid())
- return false;
-
- if (m_api == OpenGLES && m_api != other.m_api)
- return false;
-
- if (m_api == OpenGLCoreProfile && m_api != other.m_api)
- return false;
-
- if (m_version < other.m_version)
- return false;
-
- if (m_shaderType != other.m_shaderType)
- return false;
-
- const auto containsAllExtensionsFromOther = std::includes(m_extensions.constBegin(),
- m_extensions.constEnd(),
- other.m_extensions.constBegin(),
- other.m_extensions.constEnd());
- if (!containsAllExtensionsFromOther)
- return false;
-
- if (!other.m_vendor.isEmpty() && m_vendor != other.m_vendor)
- return false;
-
- return true;
-}
-
-QShaderFormat::ShaderType QShaderFormat::shaderType() const Q_DECL_NOTHROW
-{
- return m_shaderType;
-}
-
-void QShaderFormat::setShaderType(QShaderFormat::ShaderType shaderType) Q_DECL_NOTHROW
-{
- m_shaderType = shaderType;
-}
-
-bool operator==(const QShaderFormat &lhs, const QShaderFormat &rhs) noexcept
-{
- return lhs.api() == rhs.api()
- && lhs.version() == rhs.version()
- && lhs.extensions() == rhs.extensions()
- && lhs.vendor() == rhs.vendor()
- && lhs.shaderType() == rhs.shaderType();
-}
-
-QT_END_NAMESPACE
diff --git a/src/gui/util/qshaderformat_p.h b/src/gui/util/qshaderformat_p.h
deleted file mode 100644
index c50d7d5729..0000000000
--- a/src/gui/util/qshaderformat_p.h
+++ /dev/null
@@ -1,122 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2017 Klaralvdalens Datakonsult AB (KDAB).
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the QtGui module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef QSHADERFORMAT_P_H
-#define QSHADERFORMAT_P_H
-
-//
-// W A R N I N G
-// -------------
-//
-// This file is not part of the Qt API. It exists purely as an
-// implementation detail. This header file may change from version to
-// version without notice, or even be removed.
-//
-// We mean it.
-//
-
-#include <QtGui/private/qtguiglobal_p.h>
-
-#include <QtCore/qstringlist.h>
-#include <QtCore/qversionnumber.h>
-
-QT_BEGIN_NAMESPACE
-
-class QShaderFormat
-{
-public:
- enum Api : int {
- NoApi,
- OpenGLNoProfile,
- OpenGLCoreProfile,
- OpenGLCompatibilityProfile,
- OpenGLES
- };
-
- enum ShaderType : int {
- Vertex = 0,
- TessellationControl,
- TessellationEvaluation,
- Geometry,
- Fragment,
- Compute
- };
-
- Q_GUI_EXPORT QShaderFormat() noexcept;
-
- Q_GUI_EXPORT Api api() const noexcept;
- Q_GUI_EXPORT void setApi(Api api) noexcept;
-
- Q_GUI_EXPORT QVersionNumber version() const noexcept;
- Q_GUI_EXPORT void setVersion(const QVersionNumber &version) noexcept;
-
- Q_GUI_EXPORT QStringList extensions() const noexcept;
- Q_GUI_EXPORT void setExtensions(const QStringList &extensions) noexcept;
-
- Q_GUI_EXPORT QString vendor() const noexcept;
- Q_GUI_EXPORT void setVendor(const QString &vendor) noexcept;
-
- Q_GUI_EXPORT bool isValid() const noexcept;
- Q_GUI_EXPORT bool supports(const QShaderFormat &other) const noexcept;
-
- Q_GUI_EXPORT ShaderType shaderType() const Q_DECL_NOTHROW;
- Q_GUI_EXPORT void setShaderType(ShaderType shaderType) Q_DECL_NOTHROW;
-
-private:
- Api m_api;
- QVersionNumber m_version;
- QStringList m_extensions;
- QString m_vendor;
- ShaderType m_shaderType;
-};
-
-Q_GUI_EXPORT bool operator==(const QShaderFormat &lhs, const QShaderFormat &rhs) noexcept;
-
-inline bool operator!=(const QShaderFormat &lhs, const QShaderFormat &rhs) noexcept
-{
- return !(lhs == rhs);
-}
-
-Q_DECLARE_TYPEINFO(QShaderFormat, Q_MOVABLE_TYPE);
-
-QT_END_NAMESPACE
-
-Q_DECLARE_METATYPE(QShaderFormat)
-
-#endif // QSHADERFORMAT_P_H
diff --git a/src/gui/util/qshadergenerator.cpp b/src/gui/util/qshadergenerator.cpp
deleted file mode 100644
index bcb985de54..0000000000
--- a/src/gui/util/qshadergenerator.cpp
+++ /dev/null
@@ -1,594 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2017 Klaralvdalens Datakonsult AB (KDAB).
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the QtGui module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "qshadergenerator_p.h"
-
-#include "qshaderlanguage_p.h"
-#include <QRegularExpression>
-
-QT_BEGIN_NAMESPACE
-
-Q_LOGGING_CATEGORY(ShaderGenerator, "ShaderGenerator", QtWarningMsg)
-
-namespace
-{
- QByteArray toGlsl(QShaderLanguage::StorageQualifier qualifier, const QShaderFormat &format)
- {
- if (format.version().majorVersion() <= 2) {
- // Note we're assuming fragment shader only here, it'd be different
- // values for vertex shader, will need to be fixed properly at some
- // point but isn't necessary yet (this problem already exists in past
- // commits anyway)
- switch (qualifier) {
- case QShaderLanguage::Const:
- return "const";
- case QShaderLanguage::Input:
- if (format.shaderType() == QShaderFormat::Vertex)
- return "attribute";
- else
- return "varying";
- case QShaderLanguage::Output:
- return ""; // Although fragment shaders for <=2 only have fixed outputs
- case QShaderLanguage::Uniform:
- return "uniform";
- case QShaderLanguage::BuiltIn:
- return "//";
- }
- } else {
- switch (qualifier) {
- case QShaderLanguage::Const:
- return "const";
- case QShaderLanguage::Input:
- return "in";
- case QShaderLanguage::Output:
- return "out";
- case QShaderLanguage::Uniform:
- return "uniform";
- case QShaderLanguage::BuiltIn:
- return "//";
- }
- }
-
- Q_UNREACHABLE();
- }
-
- QByteArray toGlsl(QShaderLanguage::VariableType type)
- {
- switch (type) {
- case QShaderLanguage::Bool:
- return "bool";
- case QShaderLanguage::Int:
- return "int";
- case QShaderLanguage::Uint:
- return "uint";
- case QShaderLanguage::Float:
- return "float";
- case QShaderLanguage::Double:
- return "double";
- case QShaderLanguage::Vec2:
- return "vec2";
- case QShaderLanguage::Vec3:
- return "vec3";
- case QShaderLanguage::Vec4:
- return "vec4";
- case QShaderLanguage::DVec2:
- return "dvec2";
- case QShaderLanguage::DVec3:
- return "dvec3";
- case QShaderLanguage::DVec4:
- return "dvec4";
- case QShaderLanguage::BVec2:
- return "bvec2";
- case QShaderLanguage::BVec3:
- return "bvec3";
- case QShaderLanguage::BVec4:
- return "bvec4";
- case QShaderLanguage::IVec2:
- return "ivec2";
- case QShaderLanguage::IVec3:
- return "ivec3";
- case QShaderLanguage::IVec4:
- return "ivec4";
- case QShaderLanguage::UVec2:
- return "uvec2";
- case QShaderLanguage::UVec3:
- return "uvec3";
- case QShaderLanguage::UVec4:
- return "uvec4";
- case QShaderLanguage::Mat2:
- return "mat2";
- case QShaderLanguage::Mat3:
- return "mat3";
- case QShaderLanguage::Mat4:
- return "mat4";
- case QShaderLanguage::Mat2x2:
- return "mat2x2";
- case QShaderLanguage::Mat2x3:
- return "mat2x3";
- case QShaderLanguage::Mat2x4:
- return "mat2x4";
- case QShaderLanguage::Mat3x2:
- return "mat3x2";
- case QShaderLanguage::Mat3x3:
- return "mat3x3";
- case QShaderLanguage::Mat3x4:
- return "mat3x4";
- case QShaderLanguage::Mat4x2:
- return "mat4x2";
- case QShaderLanguage::Mat4x3:
- return "mat4x3";
- case QShaderLanguage::Mat4x4:
- return "mat4x4";
- case QShaderLanguage::DMat2:
- return "dmat2";
- case QShaderLanguage::DMat3:
- return "dmat3";
- case QShaderLanguage::DMat4:
- return "dmat4";
- case QShaderLanguage::DMat2x2:
- return "dmat2x2";
- case QShaderLanguage::DMat2x3:
- return "dmat2x3";
- case QShaderLanguage::DMat2x4:
- return "dmat2x4";
- case QShaderLanguage::DMat3x2:
- return "dmat3x2";
- case QShaderLanguage::DMat3x3:
- return "dmat3x3";
- case QShaderLanguage::DMat3x4:
- return "dmat3x4";
- case QShaderLanguage::DMat4x2:
- return "dmat4x2";
- case QShaderLanguage::DMat4x3:
- return "dmat4x3";
- case QShaderLanguage::DMat4x4:
- return "dmat4x4";
- case QShaderLanguage::Sampler1D:
- return "sampler1D";
- case QShaderLanguage::Sampler2D:
- return "sampler2D";
- case QShaderLanguage::Sampler3D:
- return "sampler3D";
- case QShaderLanguage::SamplerCube:
- return "samplerCube";
- case QShaderLanguage::Sampler2DRect:
- return "sampler2DRect";
- case QShaderLanguage::Sampler2DMs:
- return "sampler2DMS";
- case QShaderLanguage::SamplerBuffer:
- return "samplerBuffer";
- case QShaderLanguage::Sampler1DArray:
- return "sampler1DArray";
- case QShaderLanguage::Sampler2DArray:
- return "sampler2DArray";
- case QShaderLanguage::Sampler2DMsArray:
- return "sampler2DMSArray";
- case QShaderLanguage::SamplerCubeArray:
- return "samplerCubeArray";
- case QShaderLanguage::Sampler1DShadow:
- return "sampler1DShadow";
- case QShaderLanguage::Sampler2DShadow:
- return "sampler2DShadow";
- case QShaderLanguage::Sampler2DRectShadow:
- return "sampler2DRectShadow";
- case QShaderLanguage::Sampler1DArrayShadow:
- return "sampler1DArrayShadow";
- case QShaderLanguage::Sampler2DArrayShadow:
- return "sample2DArrayShadow";
- case QShaderLanguage::SamplerCubeShadow:
- return "samplerCubeShadow";
- case QShaderLanguage::SamplerCubeArrayShadow:
- return "samplerCubeArrayShadow";
- case QShaderLanguage::ISampler1D:
- return "isampler1D";
- case QShaderLanguage::ISampler2D:
- return "isampler2D";
- case QShaderLanguage::ISampler3D:
- return "isampler3D";
- case QShaderLanguage::ISamplerCube:
- return "isamplerCube";
- case QShaderLanguage::ISampler2DRect:
- return "isampler2DRect";
- case QShaderLanguage::ISampler2DMs:
- return "isampler2DMS";
- case QShaderLanguage::ISamplerBuffer:
- return "isamplerBuffer";
- case QShaderLanguage::ISampler1DArray:
- return "isampler1DArray";
- case QShaderLanguage::ISampler2DArray:
- return "isampler2DArray";
- case QShaderLanguage::ISampler2DMsArray:
- return "isampler2DMSArray";
- case QShaderLanguage::ISamplerCubeArray:
- return "isamplerCubeArray";
- case QShaderLanguage::USampler1D:
- return "usampler1D";
- case QShaderLanguage::USampler2D:
- return "usampler2D";
- case QShaderLanguage::USampler3D:
- return "usampler3D";
- case QShaderLanguage::USamplerCube:
- return "usamplerCube";
- case QShaderLanguage::USampler2DRect:
- return "usampler2DRect";
- case QShaderLanguage::USampler2DMs:
- return "usampler2DMS";
- case QShaderLanguage::USamplerBuffer:
- return "usamplerBuffer";
- case QShaderLanguage::USampler1DArray:
- return "usampler1DArray";
- case QShaderLanguage::USampler2DArray:
- return "usampler2DArray";
- case QShaderLanguage::USampler2DMsArray:
- return "usampler2DMSArray";
- case QShaderLanguage::USamplerCubeArray:
- return "usamplerCubeArray";
- }
-
- Q_UNREACHABLE();
- }
-
- QByteArray replaceParameters(const QByteArray &original, const QShaderNode &node, const QShaderFormat &format)
- {
- QByteArray result = original;
-
- const QStringList parameterNames = node.parameterNames();
- for (const QString &parameterName : parameterNames) {
- const QByteArray placeholder = QByteArray(QByteArrayLiteral("$") + parameterName.toUtf8());
- const QVariant parameter = node.parameter(parameterName);
- if (parameter.userType() == qMetaTypeId<QShaderLanguage::StorageQualifier>()) {
- const QShaderLanguage::StorageQualifier qualifier = parameter.value<QShaderLanguage::StorageQualifier>();
- const QByteArray value = toGlsl(qualifier, format);
- result.replace(placeholder, value);
- } else if (parameter.userType() == qMetaTypeId<QShaderLanguage::VariableType>()) {
- const QShaderLanguage::VariableType type = parameter.value<QShaderLanguage::VariableType>();
- const QByteArray value = toGlsl(type);
- result.replace(placeholder, value);
- } else {
- const QByteArray value = parameter.toString().toUtf8();
- result.replace(placeholder, value);
- }
- }
-
- return result;
- }
-}
-
-QByteArray QShaderGenerator::createShaderCode(const QStringList &enabledLayers) const
-{
- auto code = QByteArrayList();
-
- if (format.isValid()) {
- const bool isGLES = format.api() == QShaderFormat::OpenGLES;
- const int major = format.version().majorVersion();
- const int minor = format.version().minorVersion();
-
- const int version = major == 2 && isGLES ? 100
- : major == 3 && isGLES ? 300
- : major == 2 ? 100 + 10 * (minor + 1)
- : major == 3 && minor <= 2 ? 100 + 10 * (minor + 3)
- : major * 100 + minor * 10;
-
- const QByteArray profile = isGLES && version > 100 ? QByteArrayLiteral(" es")
- : version >= 150 && format.api() == QShaderFormat::OpenGLCoreProfile ? QByteArrayLiteral(" core")
- : version >= 150 && format.api() == QShaderFormat::OpenGLCompatibilityProfile ? QByteArrayLiteral(" compatibility")
- : QByteArray();
-
- code << (QByteArrayLiteral("#version ") + QByteArray::number(version) + profile);
- code << QByteArray();
- }
-
- const auto intersectsEnabledLayers = [enabledLayers] (const QStringList &layers) {
- return layers.isEmpty()
- || std::any_of(layers.cbegin(), layers.cend(),
- [enabledLayers] (const QString &s) { return enabledLayers.contains(s); });
- };
-
- QVector<QString> globalInputVariables;
- const QRegularExpression globalInputExtractRegExp(QStringLiteral("^.*\\s+(\\w+).*;$"));
-
- const QVector<QShaderNode> nodes = graph.nodes();
- for (const QShaderNode &node : nodes) {
- if (intersectsEnabledLayers(node.layers())) {
- const QByteArrayList headerSnippets = node.rule(format).headerSnippets;
- for (const QByteArray &snippet : headerSnippets) {
- code << replaceParameters(snippet, node, format);
-
- // If node is an input, record the variable name into the globalInputVariables vector
- if (node.type() == QShaderNode::Input) {
- const QRegularExpressionMatch match = globalInputExtractRegExp.match(QString::fromUtf8(code.last()));
- if (match.hasMatch())
- globalInputVariables.push_back(match.captured(1));
- }
- }
- }
- }
-
- code << QByteArray();
- code << QByteArrayLiteral("void main()");
- code << QByteArrayLiteral("{");
-
- const QRegularExpression localToGlobalRegExp(QStringLiteral("^.*\\s+(\\w+)\\s*=\\s*((?:\\w+\\(.*\\))|(?:\\w+)).*;$"));
- const QRegularExpression temporaryVariableToAssignmentRegExp(QStringLiteral("^(.*\\s+(v\\d+))\\s*=\\s*(.*);$"));
- const QRegularExpression temporaryVariableInAssignmentRegExp(QStringLiteral("\\W*(v\\d+)\\W*"));
- const QRegularExpression outputToTemporaryAssignmentRegExp(QStringLiteral("^\\s*(\\w+)\\s*=\\s*(.*);$"));
-
- struct Variable;
-
- struct Assignment
- {
- QString expression;
- QVector<Variable *> referencedVariables;
- };
-
- struct Variable
- {
- enum Type {
- GlobalInput,
- TemporaryAssignment,
- Output
- };
-
- QString name;
- QString declaration;
- int referenceCount = 0;
- Assignment assignment;
- Type type = TemporaryAssignment;
- bool substituted = false;
-
- static void substitute(Variable *v)
- {
- if (v->substituted)
- return;
-
- qCDebug(ShaderGenerator) << "Begin Substituting " << v->name << " = " << v->assignment.expression;
- for (Variable *ref : qAsConst(v->assignment.referencedVariables)) {
- // Recursively substitute
- Variable::substitute(ref);
-
- // Replace all variables referenced only once in the assignment
- // by their actual expression
- if (ref->referenceCount == 1 || ref->type == Variable::GlobalInput) {
- const QRegularExpression r(QStringLiteral("(.*\\b)(%1)(\\b.*)").arg(ref->name));
- if (v->assignment.referencedVariables.size() == 1)
- v->assignment.expression.replace(r,
- QStringLiteral("\\1%2\\3").arg(ref->assignment.expression));
- else
- v->assignment.expression.replace(r,
- QStringLiteral("(\\1%2\\3)").arg(ref->assignment.expression));
- }
- }
- qCDebug(ShaderGenerator) << "Done Substituting " << v->name << " = " << v->assignment.expression;
- v->substituted = true;
- }
- };
-
- struct LineContent
- {
- QByteArray rawContent;
- Variable *var = nullptr;
- };
-
- // Table to store temporary variables that should be replaced:
- // - If variable references a a global variables
- // -> we will use the global variable directly
- // - If variable references a function results
- // -> will be kept only if variable is referenced more than once.
- // This avoids having vec3 v56 = vertexPosition; when we could
- // just use vertexPosition directly.
- // The added benefit is when having arrays, we don't try to create
- // mat4 v38 = skinningPalelette[100] which would be invalid
- QVector<Variable> temporaryVariables;
- // Reserve more than enough space to ensure no reallocation will take place
- temporaryVariables.reserve(nodes.size() * 8);
-
- QVector<LineContent> lines;
-
- auto createVariable = [&] () -> Variable * {
- Q_ASSERT(temporaryVariables.capacity() > 0);
- temporaryVariables.resize(temporaryVariables.size() + 1);
- return &temporaryVariables.last();
- };
-
- auto findVariable = [&] (const QString &name) -> Variable * {
- const auto end = temporaryVariables.end();
- auto it = std::find_if(temporaryVariables.begin(), end,
- [=] (const Variable &a) { return a.name == name; });
- if (it != end)
- return &(*it);
- return nullptr;
- };
-
- auto gatherTemporaryVariablesFromAssignment = [&] (Variable *v, const QString &assignmentContent) {
- QRegularExpressionMatchIterator subMatchIt = temporaryVariableInAssignmentRegExp.globalMatch(assignmentContent);
- while (subMatchIt.hasNext()) {
- const QRegularExpressionMatch subMatch = subMatchIt.next();
- const QString variableName = subMatch.captured(1);
-
- // Variable we care about should already exists -> an expression cannot reference a variable that hasn't been defined
- Variable *u = findVariable(variableName);
- Q_ASSERT(u);
-
- // Increase reference count for u
- ++u->referenceCount;
- // Insert u as reference for variable v
- v->assignment.referencedVariables.push_back(u);
- }
- };
-
- for (const QShaderGraph::Statement &statement : graph.createStatements(enabledLayers)) {
- const QShaderNode node = statement.node;
- QByteArray line = node.rule(format).substitution;
- const QVector<QShaderNodePort> ports = node.ports();
-
- // Generate temporary variable names vN
- for (const QShaderNodePort &port : ports) {
- const QString portName = port.name;
- const QShaderNodePort::Direction portDirection = port.direction;
- const bool isInput = port.direction == QShaderNodePort::Input;
-
- const int portIndex = statement.portIndex(portDirection, portName);
-
- Q_ASSERT(portIndex >= 0);
-
- const int variableIndex = isInput ? statement.inputs.at(portIndex)
- : statement.outputs.at(portIndex);
- if (variableIndex < 0)
- continue;
-
- const auto placeholder = QByteArray(QByteArrayLiteral("$") + portName.toUtf8());
- const auto variable = QByteArray(QByteArrayLiteral("v") + QByteArray::number(variableIndex));
-
- line.replace(placeholder, variable);
- }
-
- // Substitute variable names by generated vN variable names
- const QByteArray substitutionedLine = replaceParameters(line, node, format);
-
- Variable *v = nullptr;
-
- switch (node.type()) {
- // Record name of temporary variable that possibly references a global input
- // We will replace the temporary variables by the matching global variables later
- case QShaderNode::Input: {
- const QRegularExpressionMatch match = localToGlobalRegExp.match(QString::fromUtf8(substitutionedLine));
- if (match.hasMatch()) {
- const QString localVariable = match.captured(1);
- const QString globalVariable = match.captured(2);
-
- v = createVariable();
- v->name = localVariable;
- v->type = Variable::GlobalInput;
-
- Assignment assignment;
- assignment.expression = globalVariable;
- v->assignment = assignment;
- }
- break;
- }
-
- case QShaderNode::Function: {
- const QRegularExpressionMatch match = temporaryVariableToAssignmentRegExp.match(QString::fromUtf8(substitutionedLine));
- if (match.hasMatch()) {
- const QString localVariableDeclaration = match.captured(1);
- const QString localVariableName = match.captured(2);
- const QString assignmentContent = match.captured(3);
-
- // Add new variable -> it cannot exist already
- v = createVariable();
- v->name = localVariableName;
- v->declaration = localVariableDeclaration;
- v->assignment.expression = assignmentContent;
-
- // Find variables that may be referenced in the assignment
- gatherTemporaryVariablesFromAssignment(v, assignmentContent);
- }
- break;
- }
-
- case QShaderNode::Output: {
- const QRegularExpressionMatch match = outputToTemporaryAssignmentRegExp.match(QString::fromUtf8(substitutionedLine));
- if (match.hasMatch()) {
- const QString outputDeclaration = match.captured(1);
- const QString assignmentContent = match.captured(2);
-
- v = createVariable();
- v->name = outputDeclaration;
- v->declaration = outputDeclaration;
- v->type = Variable::Output;
-
- Assignment assignment;
- assignment.expression = assignmentContent;
- v->assignment = assignment;
-
- // Find variables that may be referenced in the assignment
- gatherTemporaryVariablesFromAssignment(v, assignmentContent);
- }
- break;
- }
- case QShaderNode::Invalid:
- break;
- }
-
- LineContent lineContent;
- lineContent.rawContent = QByteArray(QByteArrayLiteral(" ") + substitutionedLine);
- lineContent.var = v;
- lines << lineContent;
- }
-
- // Go through all lines
- // Perform substitution of line with temporary variables substitution
- for (LineContent &lineContent : lines) {
- Variable *v = lineContent.var;
- qCDebug(ShaderGenerator) << lineContent.rawContent;
- if (v != nullptr) {
- Variable::substitute(v);
-
- qCDebug(ShaderGenerator) << "Line " << lineContent.rawContent << "is assigned to temporary" << v->name;
-
- // Check number of occurrences a temporary variable is referenced
- if (v->referenceCount == 1 || v->type == Variable::GlobalInput) {
- // If it is referenced only once, no point in creating a temporary
- // Clear content for current line
- lineContent.rawContent.clear();
- // We assume expression that were referencing vN will have vN properly substituted
- } else {
- lineContent.rawContent = QStringLiteral(" %1 = %2;").arg(v->declaration)
- .arg(v->assignment.expression)
- .toUtf8();
- }
-
- qCDebug(ShaderGenerator) << "Updated Line is " << lineContent.rawContent;
- }
- }
-
- // Go throug all lines and insert content
- for (const LineContent &lineContent : qAsConst(lines)) {
- if (!lineContent.rawContent.isEmpty()) {
- code << lineContent.rawContent;
- }
- }
-
- code << QByteArrayLiteral("}");
- code << QByteArray();
-
- return code.join('\n');
-}
-
-QT_END_NAMESPACE
diff --git a/src/gui/util/qshadergenerator_p.h b/src/gui/util/qshadergenerator_p.h
deleted file mode 100644
index 1f6f9d2532..0000000000
--- a/src/gui/util/qshadergenerator_p.h
+++ /dev/null
@@ -1,79 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2017 Klaralvdalens Datakonsult AB (KDAB).
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the QtGui module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef QSHADERGENERATOR_P_H
-#define QSHADERGENERATOR_P_H
-
-//
-// W A R N I N G
-// -------------
-//
-// This file is not part of the Qt API. It exists purely as an
-// implementation detail. This header file may change from version to
-// version without notice, or even be removed.
-//
-// We mean it.
-//
-
-#include <QtGui/private/qtguiglobal_p.h>
-
-#include <QtGui/private/qshadergraph_p.h>
-#include <QtCore/QLoggingCategory>
-
-
-QT_BEGIN_NAMESPACE
-
-Q_DECLARE_LOGGING_CATEGORY(ShaderGenerator)
-
-class QShaderGenerator
-{
-public:
- Q_GUI_EXPORT QByteArray createShaderCode(const QStringList &enabledLayers = QStringList()) const;
-
- QShaderGraph graph;
- QShaderFormat format;
-};
-
-Q_DECLARE_TYPEINFO(QShaderGenerator, Q_MOVABLE_TYPE);
-
-QT_END_NAMESPACE
-
-Q_DECLARE_METATYPE(QShaderGenerator)
-
-#endif // QSHADERGENERATOR_P_H
diff --git a/src/gui/util/qshadergraph.cpp b/src/gui/util/qshadergraph.cpp
deleted file mode 100644
index b05b710713..0000000000
--- a/src/gui/util/qshadergraph.cpp
+++ /dev/null
@@ -1,262 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2017 Klaralvdalens Datakonsult AB (KDAB).
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the QtGui module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "qshadergraph_p.h"
-
-QT_BEGIN_NAMESPACE
-
-
-namespace
-{
- QVector<QShaderNode> copyOutputNodes(const QVector<QShaderNode> &nodes)
- {
- auto res = QVector<QShaderNode>();
- std::copy_if(nodes.cbegin(), nodes.cend(),
- std::back_inserter(res),
- [] (const QShaderNode &node) {
- return node.type() == QShaderNode::Output;
- });
- return res;
- }
-
- QVector<QShaderGraph::Edge> incomingEdges(const QVector<QShaderGraph::Edge> &edges, const QUuid &uuid)
- {
- auto res = QVector<QShaderGraph::Edge>();
- std::copy_if(edges.cbegin(), edges.cend(),
- std::back_inserter(res),
- [uuid] (const QShaderGraph::Edge &edge) {
- return edge.sourceNodeUuid == uuid;
- });
- return res;
- }
-
- QVector<QShaderGraph::Edge> outgoingEdges(const QVector<QShaderGraph::Edge> &edges, const QUuid &uuid)
- {
- auto res = QVector<QShaderGraph::Edge>();
- std::copy_if(edges.cbegin(), edges.cend(),
- std::back_inserter(res),
- [uuid] (const QShaderGraph::Edge &edge) {
- return edge.targetNodeUuid == uuid;
- });
- return res;
- }
-
- QShaderGraph::Statement nodeToStatement(const QShaderNode &node, int &nextVarId)
- {
- auto statement = QShaderGraph::Statement();
- statement.node = node;
-
- const QVector<QShaderNodePort> ports = node.ports();
- for (const QShaderNodePort &port : ports) {
- if (port.direction == QShaderNodePort::Input) {
- statement.inputs.append(-1);
- } else {
- statement.outputs.append(nextVarId);
- nextVarId++;
- }
- }
- return statement;
- }
-
- QShaderGraph::Statement completeStatement(const QHash<QUuid, QShaderGraph::Statement> &idHash,
- const QVector<QShaderGraph::Edge> edges,
- const QUuid &uuid)
- {
- auto targetStatement = idHash.value(uuid);
- for (const QShaderGraph::Edge &edge : edges) {
- if (edge.targetNodeUuid != uuid)
- continue;
-
- const QShaderGraph::Statement sourceStatement = idHash.value(edge.sourceNodeUuid);
- const int sourcePortIndex = sourceStatement.portIndex(QShaderNodePort::Output, edge.sourcePortName);
- const int targetPortIndex = targetStatement.portIndex(QShaderNodePort::Input, edge.targetPortName);
-
- if (sourcePortIndex < 0 || targetPortIndex < 0)
- continue;
-
- const QVector<int> sourceOutputs = sourceStatement.outputs;
- QVector<int> &targetInputs = targetStatement.inputs;
- targetInputs[targetPortIndex] = sourceOutputs[sourcePortIndex];
- }
- return targetStatement;
- }
-}
-
-QUuid QShaderGraph::Statement::uuid() const noexcept
-{
- return node.uuid();
-}
-
-int QShaderGraph::Statement::portIndex(QShaderNodePort::Direction direction, const QString &portName) const noexcept
-{
- const QVector<QShaderNodePort> ports = node.ports();
- int index = 0;
- for (const QShaderNodePort &port : ports) {
- if (port.name == portName && port.direction == direction)
- return index;
- else if (port.direction == direction)
- index++;
- }
- return -1;
-}
-
-void QShaderGraph::addNode(const QShaderNode &node)
-{
- removeNode(node);
- m_nodes.append(node);
-}
-
-void QShaderGraph::removeNode(const QShaderNode &node)
-{
- const auto it = std::find_if(m_nodes.begin(), m_nodes.end(),
- [node] (const QShaderNode &n) { return n.uuid() == node.uuid(); });
- if (it != m_nodes.end())
- m_nodes.erase(it);
-}
-
-QVector<QShaderNode> QShaderGraph::nodes() const noexcept
-{
- return m_nodes;
-}
-
-void QShaderGraph::addEdge(const QShaderGraph::Edge &edge)
-{
- if (m_edges.contains(edge))
- return;
- m_edges.append(edge);
-}
-
-void QShaderGraph::removeEdge(const QShaderGraph::Edge &edge)
-{
- m_edges.removeAll(edge);
-}
-
-QVector<QShaderGraph::Edge> QShaderGraph::edges() const noexcept
-{
- return m_edges;
-}
-
-QVector<QShaderGraph::Statement> QShaderGraph::createStatements(const QStringList &enabledLayers) const
-{
- const auto intersectsEnabledLayers = [enabledLayers] (const QStringList &layers) {
- return layers.isEmpty()
- || std::any_of(layers.cbegin(), layers.cend(),
- [enabledLayers] (const QString &s) { return enabledLayers.contains(s); });
- };
-
- const QVector<QShaderNode> enabledNodes = [this, intersectsEnabledLayers] {
- auto res = QVector<QShaderNode>();
- std::copy_if(m_nodes.cbegin(), m_nodes.cend(),
- std::back_inserter(res),
- [intersectsEnabledLayers] (const QShaderNode &node) {
- return intersectsEnabledLayers(node.layers());
- });
- return res;
- }();
-
- const QVector<Edge> enabledEdges = [this, intersectsEnabledLayers] {
- auto res = QVector<Edge>();
- std::copy_if(m_edges.cbegin(), m_edges.cend(),
- std::back_inserter(res),
- [intersectsEnabledLayers] (const Edge &edge) {
- return intersectsEnabledLayers(edge.layers);
- });
- return res;
- }();
-
- const QHash<QUuid, Statement> idHash = [enabledNodes] {
- auto nextVarId = 0;
- auto res = QHash<QUuid, Statement>();
- for (const QShaderNode &node : enabledNodes)
- res.insert(node.uuid(), nodeToStatement(node, nextVarId));
- return res;
- }();
-
- auto result = QVector<Statement>();
- QVector<Edge> currentEdges = enabledEdges;
- QVector<QUuid> currentUuids = [enabledNodes] {
- const QVector<QShaderNode> inputs = copyOutputNodes(enabledNodes);
- auto res = QVector<QUuid>();
- std::transform(inputs.cbegin(), inputs.cend(),
- std::back_inserter(res),
- [](const QShaderNode &node) { return node.uuid(); });
- return res;
- }();
-
- // Implements Kahn's algorithm to flatten the graph
- // https://en.wikipedia.org/wiki/Topological_sorting#Kahn.27s_algorithm
- //
- // We implement it with a small twist though, we follow the edges backward
- // because we want to track the dependencies from the output nodes and not the
- // input nodes
- while (!currentUuids.isEmpty()) {
- const QUuid uuid = currentUuids.takeFirst();
- result.append(completeStatement(idHash, enabledEdges, uuid));
-
- const QVector<QShaderGraph::Edge> outgoing = outgoingEdges(currentEdges, uuid);
- for (const QShaderGraph::Edge &outgoingEdge : outgoing) {
- currentEdges.removeAll(outgoingEdge);
- const QUuid nextUuid = outgoingEdge.sourceNodeUuid;
- const QVector<QShaderGraph::Edge> incoming = incomingEdges(currentEdges, nextUuid);
- if (incoming.isEmpty()) {
- currentUuids.append(nextUuid);
- }
- }
- }
-
- std::reverse(result.begin(), result.end());
- return result;
-}
-
-bool operator==(const QShaderGraph::Edge &lhs, const QShaderGraph::Edge &rhs) noexcept
-{
- return lhs.sourceNodeUuid == rhs.sourceNodeUuid
- && lhs.sourcePortName == rhs.sourcePortName
- && lhs.targetNodeUuid == rhs.targetNodeUuid
- && lhs.targetPortName == rhs.targetPortName;
-}
-
-bool operator==(const QShaderGraph::Statement &lhs, const QShaderGraph::Statement &rhs) noexcept
-{
- return lhs.inputs == rhs.inputs
- && lhs.outputs == rhs.outputs
- && lhs.node.uuid() == rhs.node.uuid();
-}
-
-QT_END_NAMESPACE
diff --git a/src/gui/util/qshadergraph_p.h b/src/gui/util/qshadergraph_p.h
deleted file mode 100644
index 9367a3783c..0000000000
--- a/src/gui/util/qshadergraph_p.h
+++ /dev/null
@@ -1,123 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2017 Klaralvdalens Datakonsult AB (KDAB).
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the QtGui module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef QSHADERGRAPH_P_H
-#define QSHADERGRAPH_P_H
-
-//
-// W A R N I N G
-// -------------
-//
-// This file is not part of the Qt API. It exists purely as an
-// implementation detail. This header file may change from version to
-// version without notice, or even be removed.
-//
-// We mean it.
-//
-
-#include <QtGui/private/qtguiglobal_p.h>
-
-#include <QtGui/private/qshadernode_p.h>
-
-QT_BEGIN_NAMESPACE
-
-class QShaderGraph
-{
-public:
- class Edge
- {
- public:
- QStringList layers;
- QUuid sourceNodeUuid;
- QString sourcePortName;
- QUuid targetNodeUuid;
- QString targetPortName;
- };
-
- class Statement
- {
- public:
- Q_GUI_EXPORT QUuid uuid() const noexcept;
- Q_GUI_EXPORT int portIndex(QShaderNodePort::Direction direction, const QString &portName) const noexcept;
-
- QShaderNode node;
- QVector<int> inputs;
- QVector<int> outputs;
- };
-
- Q_GUI_EXPORT void addNode(const QShaderNode &node);
- Q_GUI_EXPORT void removeNode(const QShaderNode &node);
- Q_GUI_EXPORT QVector<QShaderNode> nodes() const noexcept;
-
- Q_GUI_EXPORT void addEdge(const Edge &edge);
- Q_GUI_EXPORT void removeEdge(const Edge &edge);
- Q_GUI_EXPORT QVector<Edge> edges() const noexcept;
-
- Q_GUI_EXPORT QVector<Statement> createStatements(const QStringList &enabledLayers = QStringList()) const;
-
-private:
- QVector<QShaderNode> m_nodes;
- QVector<Edge> m_edges;
-};
-
-Q_GUI_EXPORT bool operator==(const QShaderGraph::Edge &lhs, const QShaderGraph::Edge &rhs) noexcept;
-
-inline bool operator!=(const QShaderGraph::Edge &lhs, const QShaderGraph::Edge &rhs) noexcept
-{
- return !(lhs == rhs);
-}
-
-Q_GUI_EXPORT bool operator==(const QShaderGraph::Statement &lhs, const QShaderGraph::Statement &rhs) noexcept;
-
-inline bool operator!=(const QShaderGraph::Statement &lhs, const QShaderGraph::Statement &rhs) noexcept
-{
- return !(lhs == rhs);
-}
-
-Q_DECLARE_TYPEINFO(QShaderGraph, Q_MOVABLE_TYPE);
-Q_DECLARE_TYPEINFO(QShaderGraph::Edge, Q_MOVABLE_TYPE);
-Q_DECLARE_TYPEINFO(QShaderGraph::Statement, Q_MOVABLE_TYPE);
-
-QT_END_NAMESPACE
-
-Q_DECLARE_METATYPE(QShaderGraph)
-Q_DECLARE_METATYPE(QShaderGraph::Edge)
-Q_DECLARE_METATYPE(QShaderGraph::Statement)
-
-#endif // QSHADERGRAPH_P_H
diff --git a/src/gui/util/qshadergraphloader.cpp b/src/gui/util/qshadergraphloader.cpp
deleted file mode 100644
index 26848020f2..0000000000
--- a/src/gui/util/qshadergraphloader.cpp
+++ /dev/null
@@ -1,269 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2017 Klaralvdalens Datakonsult AB (KDAB).
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the QtGui module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "qshadergraphloader_p.h"
-
-#include "qshadernodesloader_p.h"
-
-#include <QtCore/qdebug.h>
-#include <QtCore/qiodevice.h>
-#include <QtCore/qjsonarray.h>
-#include <QtCore/qjsondocument.h>
-#include <QtCore/qjsonobject.h>
-#include <QtCore/qmetaobject.h>
-
-QT_BEGIN_NAMESPACE
-
-void qt_register_ShaderLanguage_enums();
-
-QShaderGraphLoader::QShaderGraphLoader() noexcept
- : m_status(Null),
- m_device(nullptr)
-{
- qt_register_ShaderLanguage_enums();
-}
-
-QShaderGraphLoader::Status QShaderGraphLoader::status() const noexcept
-{
- return m_status;
-}
-
-QShaderGraph QShaderGraphLoader::graph() const noexcept
-{
- return m_graph;
-}
-
-QIODevice *QShaderGraphLoader::device() const noexcept
-{
- return m_device;
-}
-
-void QShaderGraphLoader::setDevice(QIODevice *device) noexcept
-{
- m_device = device;
- m_graph = QShaderGraph();
- m_status = !m_device ? Null
- : (m_device->openMode() & QIODevice::ReadOnly) ? Waiting
- : Error;
-}
-
-QHash<QString, QShaderNode> QShaderGraphLoader::prototypes() const noexcept
-{
- return m_prototypes;
-}
-
-void QShaderGraphLoader::setPrototypes(const QHash<QString, QShaderNode> &prototypes) noexcept
-{
- m_prototypes = prototypes;
-}
-
-void QShaderGraphLoader::load()
-{
- if (m_status == Error)
- return;
-
- auto error = QJsonParseError();
- const QJsonDocument document = QJsonDocument::fromJson(m_device->readAll(), &error);
-
- if (error.error != QJsonParseError::NoError) {
- qWarning() << "Invalid JSON document:" << error.errorString();
- m_status = Error;
- return;
- }
-
- if (document.isEmpty() || !document.isObject()) {
- qWarning() << "Invalid JSON document, root should be an object";
- m_status = Error;
- return;
- }
-
- const QJsonObject root = document.object();
-
- const QJsonValue nodesValue = root.value(QStringLiteral("nodes"));
- if (!nodesValue.isArray()) {
- qWarning() << "Invalid nodes property, should be an array";
- m_status = Error;
- return;
- }
-
- const QJsonValue edgesValue = root.value(QStringLiteral("edges"));
- if (!edgesValue.isArray()) {
- qWarning() << "Invalid edges property, should be an array";
- m_status = Error;
- return;
- }
-
- bool hasError = false;
-
- const QJsonValue prototypesValue = root.value(QStringLiteral("prototypes"));
- if (!prototypesValue.isUndefined()) {
- if (prototypesValue.isObject()) {
- QShaderNodesLoader loader;
- loader.load(prototypesValue.toObject());
- m_prototypes.insert(loader.nodes());
- } else {
- qWarning() << "Invalid prototypes property, should be an object";
- m_status = Error;
- return;
- }
- }
-
- const QJsonArray nodes = nodesValue.toArray();
- for (const QJsonValue &nodeValue : nodes) {
- if (!nodeValue.isObject()) {
- qWarning() << "Invalid node found";
- hasError = true;
- continue;
- }
-
- const QJsonObject nodeObject = nodeValue.toObject();
-
- const QString uuidString = nodeObject.value(QStringLiteral("uuid")).toString();
- const QUuid uuid = QUuid(uuidString);
- if (uuid.isNull()) {
- qWarning() << "Invalid UUID found in node:" << uuidString;
- hasError = true;
- continue;
- }
-
- const QString type = nodeObject.value(QStringLiteral("type")).toString();
- if (!m_prototypes.contains(type)) {
- qWarning() << "Unsupported node type found:" << type;
- hasError = true;
- continue;
- }
-
- const QJsonArray layersArray = nodeObject.value(QStringLiteral("layers")).toArray();
- auto layers = QStringList();
- for (const QJsonValue &layerValue : layersArray) {
- layers.append(layerValue.toString());
- }
-
- QShaderNode node = m_prototypes.value(type);
- node.setUuid(uuid);
- node.setLayers(layers);
-
- const QJsonValue parametersValue = nodeObject.value(QStringLiteral("parameters"));
- if (parametersValue.isObject()) {
- const QJsonObject parametersObject = parametersValue.toObject();
- for (const QString &parameterName : parametersObject.keys()) {
- const QJsonValue parameterValue = parametersObject.value(parameterName);
- if (parameterValue.isObject()) {
- const QJsonObject parameterObject = parameterValue.toObject();
- const QString type = parameterObject.value(QStringLiteral("type")).toString();
- const int typeId = QMetaType::type(type.toUtf8());
-
- const QString value = parameterObject.value(QStringLiteral("value")).toString();
- auto variant = QVariant(value);
-
- if (QMetaType::typeFlags(typeId) & QMetaType::IsEnumeration) {
- const QMetaObject *metaObject = QMetaType::metaObjectForType(typeId);
- const char *className = metaObject->className();
- const QByteArray enumName = type.mid(static_cast<int>(qstrlen(className)) + 2).toUtf8();
- const QMetaEnum metaEnum = metaObject->enumerator(metaObject->indexOfEnumerator(enumName));
- const int enumValue = metaEnum.keyToValue(value.toUtf8());
- variant = QVariant(enumValue);
- variant.convert(typeId);
- } else {
- variant.convert(typeId);
- }
- node.setParameter(parameterName, variant);
- } else {
- node.setParameter(parameterName, parameterValue.toVariant());
- }
- }
- }
-
- m_graph.addNode(node);
- }
-
- const QJsonArray edges = edgesValue.toArray();
- for (const QJsonValue &edgeValue : edges) {
- if (!edgeValue.isObject()) {
- qWarning() << "Invalid edge found";
- hasError = true;
- continue;
- }
-
- const QJsonObject edgeObject = edgeValue.toObject();
-
- const QString sourceUuidString = edgeObject.value(QStringLiteral("sourceUuid")).toString();
- const QUuid sourceUuid = QUuid(sourceUuidString);
- if (sourceUuid.isNull()) {
- qWarning() << "Invalid source UUID found in edge:" << sourceUuidString;
- hasError = true;
- continue;
- }
-
- const QString sourcePort = edgeObject.value(QStringLiteral("sourcePort")).toString();
-
- const QString targetUuidString = edgeObject.value(QStringLiteral("targetUuid")).toString();
- const QUuid targetUuid = QUuid(targetUuidString);
- if (targetUuid.isNull()) {
- qWarning() << "Invalid target UUID found in edge:" << targetUuidString;
- hasError = true;
- continue;
- }
-
- const QString targetPort = edgeObject.value(QStringLiteral("targetPort")).toString();
-
- const QJsonArray layersArray = edgeObject.value(QStringLiteral("layers")).toArray();
- auto layers = QStringList();
- for (const QJsonValue &layerValue : layersArray) {
- layers.append(layerValue.toString());
- }
-
- auto edge = QShaderGraph::Edge();
- edge.sourceNodeUuid = sourceUuid;
- edge.sourcePortName = sourcePort;
- edge.targetNodeUuid = targetUuid;
- edge.targetPortName = targetPort;
- edge.layers = layers;
- m_graph.addEdge(edge);
- }
-
- if (hasError) {
- m_status = Error;
- m_graph = QShaderGraph();
- } else {
- m_status = Ready;
- }
-}
-
-QT_END_NAMESPACE
diff --git a/src/gui/util/qshadergraphloader_p.h b/src/gui/util/qshadergraphloader_p.h
deleted file mode 100644
index e7aa19fa2d..0000000000
--- a/src/gui/util/qshadergraphloader_p.h
+++ /dev/null
@@ -1,99 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2017 Klaralvdalens Datakonsult AB (KDAB).
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the QtGui module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef QSHADERGRAPHLOADER_P_H
-#define QSHADERGRAPHLOADER_P_H
-
-//
-// W A R N I N G
-// -------------
-//
-// This file is not part of the Qt API. It exists purely as an
-// implementation detail. This header file may change from version to
-// version without notice, or even be removed.
-//
-// We mean it.
-//
-
-#include <QtGui/private/qtguiglobal_p.h>
-
-#include <QtGui/private/qshadergraph_p.h>
-
-QT_BEGIN_NAMESPACE
-
-class QIODevice;
-
-class QShaderGraphLoader
-{
-public:
- enum Status : char {
- Null,
- Waiting,
- Ready,
- Error
- };
-
- Q_GUI_EXPORT QShaderGraphLoader() noexcept;
-
- Q_GUI_EXPORT Status status() const noexcept;
- Q_GUI_EXPORT QShaderGraph graph() const noexcept;
-
- Q_GUI_EXPORT QIODevice *device() const noexcept;
- Q_GUI_EXPORT void setDevice(QIODevice *device) noexcept;
-
- Q_GUI_EXPORT QHash<QString, QShaderNode> prototypes() const noexcept;
- Q_GUI_EXPORT void setPrototypes(const QHash<QString, QShaderNode> &prototypes) noexcept;
-
- Q_GUI_EXPORT void load();
-
-private:
- Status m_status;
- QIODevice *m_device;
- QHash<QString, QShaderNode> m_prototypes;
- QShaderGraph m_graph;
-};
-
-Q_DECLARE_TYPEINFO(QShaderGraphLoader, Q_MOVABLE_TYPE);
-
-QT_END_NAMESPACE
-
-Q_DECLARE_METATYPE(QShaderGraphLoader)
-Q_DECLARE_METATYPE(QShaderGraphLoader::Status)
-
-#endif // QSHADERGRAPHLOADER_P_H
diff --git a/src/gui/util/qshaderlanguage.cpp b/src/gui/util/qshaderlanguage.cpp
deleted file mode 100644
index efd607ba60..0000000000
--- a/src/gui/util/qshaderlanguage.cpp
+++ /dev/null
@@ -1,54 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2017 Klaralvdalens Datakonsult AB (KDAB).
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the QtGui module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "qshaderlanguage_p.h"
-
-#include <QtCore/qcoreapplication.h>
-
-QT_BEGIN_NAMESPACE
-
-// Note: to be invoked explicitly. Relying for example on
-// Q_COREAPP_STARTUP_FUNCTION would not be acceptable in static builds.
-void qt_register_ShaderLanguage_enums()
-{
- qRegisterMetaType<QShaderLanguage::StorageQualifier>();
- qRegisterMetaType<QShaderLanguage::VariableType>();
-}
-
-QT_END_NAMESPACE
diff --git a/src/gui/util/qshaderlanguage_p.h b/src/gui/util/qshaderlanguage_p.h
deleted file mode 100644
index 193f797cc3..0000000000
--- a/src/gui/util/qshaderlanguage_p.h
+++ /dev/null
@@ -1,164 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2017 Klaralvdalens Datakonsult AB (KDAB).
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the QtGui module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef QSHADERLANGUAGE_P_H
-#define QSHADERLANGUAGE_P_H
-
-//
-// W A R N I N G
-// -------------
-//
-// This file is not part of the Qt API. It exists purely as an
-// implementation detail. This header file may change from version to
-// version without notice, or even be removed.
-//
-// We mean it.
-//
-
-#include <QtGui/private/qtguiglobal_p.h>
-
-#include <QtCore/qmetatype.h>
-
-QT_BEGIN_NAMESPACE
-
-namespace QShaderLanguage
-{
- Q_NAMESPACE_EXPORT(Q_GUI_EXPORT)
-
- enum StorageQualifier : char {
- Const = 1,
- Input,
- BuiltIn,
- Output,
- Uniform
- };
- Q_ENUM_NS(StorageQualifier)
-
- enum VariableType : int {
- Bool = 1,
- Int,
- Uint,
- Float,
- Double,
- Vec2,
- Vec3,
- Vec4,
- DVec2,
- DVec3,
- DVec4,
- BVec2,
- BVec3,
- BVec4,
- IVec2,
- IVec3,
- IVec4,
- UVec2,
- UVec3,
- UVec4,
- Mat2,
- Mat3,
- Mat4,
- Mat2x2,
- Mat2x3,
- Mat2x4,
- Mat3x2,
- Mat3x3,
- Mat3x4,
- Mat4x2,
- Mat4x3,
- Mat4x4,
- DMat2,
- DMat3,
- DMat4,
- DMat2x2,
- DMat2x3,
- DMat2x4,
- DMat3x2,
- DMat3x3,
- DMat3x4,
- DMat4x2,
- DMat4x3,
- DMat4x4,
- Sampler1D,
- Sampler2D,
- Sampler3D,
- SamplerCube,
- Sampler2DRect,
- Sampler2DMs,
- SamplerBuffer,
- Sampler1DArray,
- Sampler2DArray,
- Sampler2DMsArray,
- SamplerCubeArray,
- Sampler1DShadow,
- Sampler2DShadow,
- Sampler2DRectShadow,
- Sampler1DArrayShadow,
- Sampler2DArrayShadow,
- SamplerCubeShadow,
- SamplerCubeArrayShadow,
- ISampler1D,
- ISampler2D,
- ISampler3D,
- ISamplerCube,
- ISampler2DRect,
- ISampler2DMs,
- ISamplerBuffer,
- ISampler1DArray,
- ISampler2DArray,
- ISampler2DMsArray,
- ISamplerCubeArray,
- USampler1D,
- USampler2D,
- USampler3D,
- USamplerCube,
- USampler2DRect,
- USampler2DMs,
- USamplerBuffer,
- USampler1DArray,
- USampler2DArray,
- USampler2DMsArray,
- USamplerCubeArray
- };
- Q_ENUM_NS(VariableType)
-}
-
-QT_END_NAMESPACE
-
-#endif // QSHADERLANGUAGE_P_H
diff --git a/src/gui/util/qshadernode.cpp b/src/gui/util/qshadernode.cpp
deleted file mode 100644
index 547e5c51a8..0000000000
--- a/src/gui/util/qshadernode.cpp
+++ /dev/null
@@ -1,172 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2017 Klaralvdalens Datakonsult AB (KDAB).
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the QtGui module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "qshadernode_p.h"
-
-QT_BEGIN_NAMESPACE
-
-QShaderNode::Type QShaderNode::type() const noexcept
-{
- int inputCount = 0;
- int outputCount = 0;
- for (const auto &port : qAsConst(m_ports)) {
- switch (port.direction) {
- case QShaderNodePort::Input:
- inputCount++;
- break;
- case QShaderNodePort::Output:
- outputCount++;
- break;
- }
- }
-
- return (inputCount == 0 && outputCount == 0) ? Invalid
- : (inputCount > 0 && outputCount == 0) ? Output
- : (inputCount == 0 && outputCount > 0) ? Input
- : Function;
-}
-
-QUuid QShaderNode::uuid() const noexcept
-{
- return m_uuid;
-}
-
-void QShaderNode::setUuid(const QUuid &uuid) noexcept
-{
- m_uuid = uuid;
-}
-
-QStringList QShaderNode::layers() const noexcept
-{
- return m_layers;
-}
-
-void QShaderNode::setLayers(const QStringList &layers) noexcept
-{
- m_layers = layers;
-}
-
-QVector<QShaderNodePort> QShaderNode::ports() const noexcept
-{
- return m_ports;
-}
-
-void QShaderNode::addPort(const QShaderNodePort &port)
-{
- removePort(port);
- m_ports.append(port);
-}
-
-void QShaderNode::removePort(const QShaderNodePort &port)
-{
- const auto it = std::find_if(m_ports.begin(), m_ports.end(),
- [port](const QShaderNodePort &p) {
- return p.name == port.name;
- });
- if (it != m_ports.end())
- m_ports.erase(it);
-}
-
-QStringList QShaderNode::parameterNames() const
-{
- return m_parameters.keys();
-}
-
-QVariant QShaderNode::parameter(const QString &name) const
-{
- return m_parameters.value(name);
-}
-
-void QShaderNode::setParameter(const QString &name, const QVariant &value)
-{
- m_parameters.insert(name, value);
-}
-
-void QShaderNode::clearParameter(const QString &name)
-{
- m_parameters.remove(name);
-}
-
-void QShaderNode::addRule(const QShaderFormat &format, const QShaderNode::Rule &rule)
-{
- removeRule(format);
- m_rules << qMakePair(format, rule);
-}
-
-void QShaderNode::removeRule(const QShaderFormat &format)
-{
- const auto it = std::find_if(m_rules.begin(), m_rules.end(),
- [format](const QPair<QShaderFormat, Rule> &entry) {
- return entry.first == format;
- });
- if (it != m_rules.end())
- m_rules.erase(it);
-}
-
-QVector<QShaderFormat> QShaderNode::availableFormats() const
-{
- auto res = QVector<QShaderFormat>();
- std::transform(m_rules.cbegin(), m_rules.cend(),
- std::back_inserter(res),
- [](const QPair<QShaderFormat, Rule> &entry) { return entry.first; });
- return res;
-}
-
-QShaderNode::Rule QShaderNode::rule(const QShaderFormat &format) const
-{
- const auto it = std::find_if(m_rules.crbegin(), m_rules.crend(),
- [format](const QPair<QShaderFormat, Rule> &entry) {
- return format.supports(entry.first);
- });
- return it != m_rules.crend() ? it->second : Rule();
-}
-
-QShaderNode::Rule::Rule(const QByteArray &subs, const QByteArrayList &snippets) noexcept
- : substitution(subs),
- headerSnippets(snippets)
-{
-}
-
-bool operator==(const QShaderNode::Rule &lhs, const QShaderNode::Rule &rhs) noexcept
-{
- return lhs.substitution == rhs.substitution
- && lhs.headerSnippets == rhs.headerSnippets;
-}
-
-QT_END_NAMESPACE
diff --git a/src/gui/util/qshadernode_p.h b/src/gui/util/qshadernode_p.h
deleted file mode 100644
index c3d149d8a5..0000000000
--- a/src/gui/util/qshadernode_p.h
+++ /dev/null
@@ -1,128 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2017 Klaralvdalens Datakonsult AB (KDAB).
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the QtGui module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef QSHADERNODE_P_H
-#define QSHADERNODE_P_H
-
-//
-// W A R N I N G
-// -------------
-//
-// This file is not part of the Qt API. It exists purely as an
-// implementation detail. This header file may change from version to
-// version without notice, or even be removed.
-//
-// We mean it.
-//
-
-#include <QtGui/private/qtguiglobal_p.h>
-
-#include <QtGui/private/qshaderformat_p.h>
-#include <QtGui/private/qshadernodeport_p.h>
-
-#include <QtCore/quuid.h>
-
-QT_BEGIN_NAMESPACE
-
-class QShaderNode
-{
-public:
- enum Type : char {
- Invalid,
- Input,
- Output,
- Function
- };
-
- class Rule
- {
- public:
- Q_GUI_EXPORT Rule(const QByteArray &substitution = QByteArray(), const QByteArrayList &headerSnippets = QByteArrayList()) noexcept;
-
- QByteArray substitution;
- QByteArrayList headerSnippets;
- };
-
- Q_GUI_EXPORT Type type() const noexcept;
-
- Q_GUI_EXPORT QUuid uuid() const noexcept;
- Q_GUI_EXPORT void setUuid(const QUuid &uuid) noexcept;
-
- Q_GUI_EXPORT QStringList layers() const noexcept;
- Q_GUI_EXPORT void setLayers(const QStringList &layers) noexcept;
-
- Q_GUI_EXPORT QVector<QShaderNodePort> ports() const noexcept;
- Q_GUI_EXPORT void addPort(const QShaderNodePort &port);
- Q_GUI_EXPORT void removePort(const QShaderNodePort &port);
-
- Q_GUI_EXPORT QStringList parameterNames() const;
- Q_GUI_EXPORT QVariant parameter(const QString &name) const;
- Q_GUI_EXPORT void setParameter(const QString &name, const QVariant &value);
- Q_GUI_EXPORT void clearParameter(const QString &name);
-
- Q_GUI_EXPORT void addRule(const QShaderFormat &format, const Rule &rule);
- Q_GUI_EXPORT void removeRule(const QShaderFormat &format);
-
- Q_GUI_EXPORT QVector<QShaderFormat> availableFormats() const;
- Q_GUI_EXPORT Rule rule(const QShaderFormat &format) const;
-
-private:
- QUuid m_uuid;
- QStringList m_layers;
- QVector<QShaderNodePort> m_ports;
- QHash<QString, QVariant> m_parameters;
- QVector<QPair<QShaderFormat, QShaderNode::Rule>> m_rules;
-};
-
-Q_GUI_EXPORT bool operator==(const QShaderNode::Rule &lhs, const QShaderNode::Rule &rhs) noexcept;
-
-inline bool operator!=(const QShaderNode::Rule &lhs, const QShaderNode::Rule &rhs) noexcept
-{
- return !(lhs == rhs);
-}
-
-Q_DECLARE_TYPEINFO(QShaderNode, Q_MOVABLE_TYPE);
-Q_DECLARE_TYPEINFO(QShaderNode::Rule, Q_MOVABLE_TYPE);
-
-QT_END_NAMESPACE
-
-Q_DECLARE_METATYPE(QShaderNode)
-Q_DECLARE_METATYPE(QShaderNode::Rule)
-
-#endif // QSHADERNODE_P_H
diff --git a/src/gui/util/qshadernodeport.cpp b/src/gui/util/qshadernodeport.cpp
deleted file mode 100644
index 15dbc4160e..0000000000
--- a/src/gui/util/qshadernodeport.cpp
+++ /dev/null
@@ -1,55 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2017 Klaralvdalens Datakonsult AB (KDAB).
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the QtGui module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "qshadernodeport_p.h"
-
-QT_BEGIN_NAMESPACE
-
-QShaderNodePort::QShaderNodePort() noexcept
- : direction(Output)
-{
-}
-
-bool operator==(const QShaderNodePort &lhs, const QShaderNodePort &rhs) noexcept
-{
- return lhs.direction == rhs.direction
- && lhs.name == rhs.name;
-}
-
-QT_END_NAMESPACE
diff --git a/src/gui/util/qshadernodeport_p.h b/src/gui/util/qshadernodeport_p.h
deleted file mode 100644
index c69ba23a3f..0000000000
--- a/src/gui/util/qshadernodeport_p.h
+++ /dev/null
@@ -1,88 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2017 Klaralvdalens Datakonsult AB (KDAB).
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the QtGui module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef QSHADERNODEPORT_P_H
-#define QSHADERNODEPORT_P_H
-
-//
-// W A R N I N G
-// -------------
-//
-// This file is not part of the Qt API. It exists purely as an
-// implementation detail. This header file may change from version to
-// version without notice, or even be removed.
-//
-// We mean it.
-//
-
-#include <QtGui/private/qtguiglobal_p.h>
-
-#include <QtCore/qstring.h>
-#include <QtCore/qvariant.h>
-
-QT_BEGIN_NAMESPACE
-
-class QShaderNodePort
-{
-public:
- enum Direction : char {
- Input,
- Output
- };
-
- Q_GUI_EXPORT QShaderNodePort() noexcept;
-
- QShaderNodePort::Direction direction;
- QString name;
-};
-
-Q_GUI_EXPORT bool operator==(const QShaderNodePort &lhs, const QShaderNodePort &rhs) noexcept;
-
-inline bool operator!=(const QShaderNodePort &lhs, const QShaderNodePort &rhs) noexcept
-{
- return !(lhs == rhs);
-}
-
-Q_DECLARE_TYPEINFO(QShaderNodePort, Q_MOVABLE_TYPE);
-
-QT_END_NAMESPACE
-
-Q_DECLARE_METATYPE(QShaderNodePort)
-
-#endif // QSHADERNODEPORT_P_H
diff --git a/src/gui/util/qshadernodesloader.cpp b/src/gui/util/qshadernodesloader.cpp
deleted file mode 100644
index 922479332c..0000000000
--- a/src/gui/util/qshadernodesloader.cpp
+++ /dev/null
@@ -1,289 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2017 Klaralvdalens Datakonsult AB (KDAB).
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the QtGui module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "qshadernodesloader_p.h"
-
-#include <QtCore/qdebug.h>
-#include <QtCore/qiodevice.h>
-#include <QtCore/qjsonarray.h>
-#include <QtCore/qjsondocument.h>
-#include <QtCore/qjsonobject.h>
-#include <QtCore/qmetaobject.h>
-
-QT_BEGIN_NAMESPACE
-
-QShaderNodesLoader::QShaderNodesLoader() noexcept
- : m_status(Null),
- m_device(nullptr)
-{
-}
-
-QShaderNodesLoader::Status QShaderNodesLoader::status() const noexcept
-{
- return m_status;
-}
-
-QHash<QString, QShaderNode> QShaderNodesLoader::nodes() const noexcept
-{
- return m_nodes;
-}
-
-QIODevice *QShaderNodesLoader::device() const noexcept
-{
- return m_device;
-}
-
-void QShaderNodesLoader::setDevice(QIODevice *device) noexcept
-{
- m_device = device;
- m_nodes.clear();
- m_status = !m_device ? Null
- : (m_device->openMode() & QIODevice::ReadOnly) ? Waiting
- : Error;
-}
-
-void QShaderNodesLoader::load()
-{
- if (m_status == Error)
- return;
-
- auto error = QJsonParseError();
- const QJsonDocument document = QJsonDocument::fromJson(m_device->readAll(), &error);
-
- if (error.error != QJsonParseError::NoError) {
- qWarning() << "Invalid JSON document:" << error.errorString();
- m_status = Error;
- return;
- }
-
- if (document.isEmpty() || !document.isObject()) {
- qWarning() << "Invalid JSON document, root should be an object";
- m_status = Error;
- return;
- }
-
- const QJsonObject root = document.object();
- load(root);
-}
-
-void QShaderNodesLoader::load(const QJsonObject &prototypesObject)
-{
- bool hasError = false;
-
- for (const QString &property : prototypesObject.keys()) {
- const QJsonValue nodeValue = prototypesObject.value(property);
- if (!nodeValue.isObject()) {
- qWarning() << "Invalid node found";
- hasError = true;
- break;
- }
-
- const QJsonObject nodeObject = nodeValue.toObject();
-
- auto node = QShaderNode();
-
- const QJsonValue inputsValue = nodeObject.value(QStringLiteral("inputs"));
- if (inputsValue.isArray()) {
- const QJsonArray inputsArray = inputsValue.toArray();
- for (const QJsonValue &inputValue : inputsArray) {
- if (!inputValue.isString()) {
- qWarning() << "Non-string value in inputs";
- hasError = true;
- break;
- }
-
- auto input = QShaderNodePort();
- input.direction = QShaderNodePort::Input;
- input.name = inputValue.toString();
- node.addPort(input);
- }
- }
-
- const QJsonValue outputsValue = nodeObject.value(QStringLiteral("outputs"));
- if (outputsValue.isArray()) {
- const QJsonArray outputsArray = outputsValue.toArray();
- for (const QJsonValue &outputValue : outputsArray) {
- if (!outputValue.isString()) {
- qWarning() << "Non-string value in outputs";
- hasError = true;
- break;
- }
-
- auto output = QShaderNodePort();
- output.direction = QShaderNodePort::Output;
- output.name = outputValue.toString();
- node.addPort(output);
- }
- }
-
- const QJsonValue parametersValue = nodeObject.value(QStringLiteral("parameters"));
- if (parametersValue.isObject()) {
- const QJsonObject parametersObject = parametersValue.toObject();
- for (const QString &parameterName : parametersObject.keys()) {
- const QJsonValue parameterValue = parametersObject.value(parameterName);
- if (parameterValue.isObject()) {
- const QJsonObject parameterObject = parameterValue.toObject();
- const QString type = parameterObject.value(QStringLiteral("type")).toString();
- const int typeId = QMetaType::type(type.toUtf8());
-
- const QString value = parameterObject.value(QStringLiteral("value")).toString();
- auto variant = QVariant(value);
-
- if (QMetaType::typeFlags(typeId) & QMetaType::IsEnumeration) {
- const QMetaObject *metaObject = QMetaType::metaObjectForType(typeId);
- const char *className = metaObject->className();
- const QByteArray enumName = type.mid(static_cast<int>(qstrlen(className)) + 2).toUtf8();
- const QMetaEnum metaEnum = metaObject->enumerator(metaObject->indexOfEnumerator(enumName));
- const int enumValue = metaEnum.keyToValue(value.toUtf8());
- variant = QVariant(enumValue);
- variant.convert(typeId);
- } else {
- variant.convert(typeId);
- }
- node.setParameter(parameterName, variant);
- } else {
- node.setParameter(parameterName, parameterValue.toVariant());
- }
- }
- }
-
- const QJsonValue rulesValue = nodeObject.value(QStringLiteral("rules"));
- if (rulesValue.isArray()) {
- const QJsonArray rulesArray = rulesValue.toArray();
- for (const QJsonValue &ruleValue : rulesArray) {
- if (!ruleValue.isObject()) {
- qWarning() << "Rules should be objects";
- hasError = true;
- break;
- }
-
- const QJsonObject ruleObject = ruleValue.toObject();
-
- const QJsonValue formatValue = ruleObject.value(QStringLiteral("format"));
- if (!formatValue.isObject()) {
- qWarning() << "Format is mandatory in rules and should be an object";
- hasError = true;
- break;
- }
-
- const QJsonObject formatObject = formatValue.toObject();
- auto format = QShaderFormat();
-
- const QJsonValue apiValue = formatObject.value(QStringLiteral("api"));
- if (!apiValue.isString()) {
- qWarning() << "Format API must be a string";
- hasError = true;
- break;
- }
-
- const QString api = apiValue.toString();
- format.setApi(api == QStringLiteral("OpenGLES") ? QShaderFormat::OpenGLES
- : api == QStringLiteral("OpenGLNoProfile") ? QShaderFormat::OpenGLNoProfile
- : api == QStringLiteral("OpenGLCoreProfile") ? QShaderFormat::OpenGLCoreProfile
- : api == QStringLiteral("OpenGLCompatibilityProfile") ? QShaderFormat::OpenGLCompatibilityProfile
- : QShaderFormat::NoApi);
- if (format.api() == QShaderFormat::NoApi) {
- qWarning() << "Format API must be one of: OpenGLES, OpenGLNoProfile, OpenGLCoreProfile or OpenGLCompatibilityProfile";
- hasError = true;
- break;
- }
-
- const QJsonValue majorValue = formatObject.value(QStringLiteral("major"));
- const QJsonValue minorValue = formatObject.value(QStringLiteral("minor"));
- if (!majorValue.isDouble() || !minorValue.isDouble()) {
- qWarning() << "Format major and minor version must be values";
- hasError = true;
- break;
- }
- format.setVersion(QVersionNumber(majorValue.toInt(), minorValue.toInt()));
-
- const QJsonValue extensionsValue = formatObject.value(QStringLiteral("extensions"));
- const QJsonArray extensionsArray = extensionsValue.toArray();
- auto extensions = QStringList();
- std::transform(extensionsArray.constBegin(), extensionsArray.constEnd(),
- std::back_inserter(extensions),
- [] (const QJsonValue &extensionValue) { return extensionValue.toString(); });
- format.setExtensions(extensions);
-
- const QString vendor = formatObject.value(QStringLiteral("vendor")).toString();
- format.setVendor(vendor);
-
- const QJsonValue substitutionValue = ruleObject.value(QStringLiteral("substitution"));
- if (!substitutionValue.isString()) {
- qWarning() << "Substitution needs to be a string";
- hasError = true;
- break;
- }
-
- // We default out to a Fragment ShaderType if nothing is specified
- // as that was the initial behavior we introduced
- const QString shaderType = formatObject.value(QStringLiteral("shaderType")).toString();
- format.setShaderType(shaderType == QStringLiteral("Fragment") ? QShaderFormat::Fragment
- : shaderType == QStringLiteral("Vertex") ? QShaderFormat::Vertex
- : shaderType == QStringLiteral("TessellationControl") ? QShaderFormat::TessellationControl
- : shaderType == QStringLiteral("TessellationEvaluation") ? QShaderFormat::TessellationEvaluation
- : shaderType == QStringLiteral("Geometry") ? QShaderFormat::Geometry
- : shaderType == QStringLiteral("Compute") ? QShaderFormat::Compute
- : QShaderFormat::Fragment);
-
- const QByteArray substitution = substitutionValue.toString().toUtf8();
-
- const QJsonValue snippetsValue = ruleObject.value(QStringLiteral("headerSnippets"));
- const QJsonArray snippetsArray = snippetsValue.toArray();
- auto snippets = QByteArrayList();
- std::transform(snippetsArray.constBegin(), snippetsArray.constEnd(),
- std::back_inserter(snippets),
- [] (const QJsonValue &snippetValue) { return snippetValue.toString().toUtf8(); });
-
- node.addRule(format, QShaderNode::Rule(substitution, snippets));
- }
- }
-
- m_nodes.insert(property, node);
- }
-
- if (hasError) {
- m_status = Error;
- m_nodes.clear();
- } else {
- m_status = Ready;
- }
-}
-
-QT_END_NAMESPACE
diff --git a/src/gui/util/qshadernodesloader_p.h b/src/gui/util/qshadernodesloader_p.h
deleted file mode 100644
index 432d7d4494..0000000000
--- a/src/gui/util/qshadernodesloader_p.h
+++ /dev/null
@@ -1,96 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2017 Klaralvdalens Datakonsult AB (KDAB).
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the QtGui module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef QSHADERNODESLOADER_P_H
-#define QSHADERNODESLOADER_P_H
-
-//
-// W A R N I N G
-// -------------
-//
-// This file is not part of the Qt API. It exists purely as an
-// implementation detail. This header file may change from version to
-// version without notice, or even be removed.
-//
-// We mean it.
-//
-
-#include <QtGui/private/qtguiglobal_p.h>
-
-#include <QtGui/private/qshadergraph_p.h>
-
-QT_BEGIN_NAMESPACE
-
-class QIODevice;
-
-class QShaderNodesLoader
-{
-public:
- enum Status : char {
- Null,
- Waiting,
- Ready,
- Error
- };
-
- Q_GUI_EXPORT QShaderNodesLoader() noexcept;
-
- Q_GUI_EXPORT Status status() const noexcept;
- Q_GUI_EXPORT QHash<QString, QShaderNode> nodes() const noexcept;
-
- Q_GUI_EXPORT QIODevice *device() const noexcept;
- Q_GUI_EXPORT void setDevice(QIODevice *device) noexcept;
-
- Q_GUI_EXPORT void load();
- Q_GUI_EXPORT void load(const QJsonObject &prototypesObject);
-
-private:
- Status m_status;
- QIODevice *m_device;
- QHash<QString, QShaderNode> m_nodes;
-};
-
-Q_DECLARE_TYPEINFO(QShaderNodesLoader, Q_MOVABLE_TYPE);
-
-QT_END_NAMESPACE
-
-Q_DECLARE_METATYPE(QShaderNodesLoader)
-Q_DECLARE_METATYPE(QShaderNodesLoader::Status)
-
-#endif // QSHADERNODESLOADER_P_H
diff --git a/src/gui/util/qtexturefiledata.cpp b/src/gui/util/qtexturefiledata.cpp
index 41cbd1b15a..e1fa900b84 100644
--- a/src/gui/util/qtexturefiledata.cpp
+++ b/src/gui/util/qtexturefiledata.cpp
@@ -1,53 +1,18 @@
-/****************************************************************************
-**
-** Copyright (C) 2018 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the QtGui module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2018 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
+#include "QtGui/qimage.h"
#include "qtexturefiledata_p.h"
-#include <QMetaEnum>
-#include <QSize>
-#if QT_CONFIG(opengl)
-#include <QOpenGLTexture>
-#endif
+#include <QtCore/qsize.h>
+#include <QtCore/qvarlengtharray.h>
+#include <QtCore/qmap.h>
QT_BEGIN_NAMESPACE
Q_LOGGING_CATEGORY(lcQtGuiTextureIO, "qt.gui.textureio");
+constexpr size_t MAX_FACES = 6;
+
class QTextureFileDataPrivate : public QSharedData
{
public:
@@ -57,12 +22,17 @@ public:
QTextureFileDataPrivate(const QTextureFileDataPrivate &other)
: QSharedData(other),
+ mode(other.mode),
logName(other.logName),
data(other.data),
offsets(other.offsets),
lengths(other.lengths),
+ images(other.images),
size(other.size),
- format(other.format)
+ format(other.format),
+ numFaces(other.numFaces),
+ numLevels(other.numLevels),
+ keyValues(other.keyValues)
{
}
@@ -70,27 +40,50 @@ public:
{
}
- void ensureLevels(int num, bool force = false)
+ void ensureSize(int levels, int faces, bool force = false)
{
- const int newSize = force ? num : qMax(offsets.size(), num);
- offsets.resize(newSize);
- lengths.resize(newSize);
+ numLevels = force ? levels : qMax(numLevels, levels);
+ numFaces = force ? faces : qMax(numFaces, faces);
+ if (mode == QTextureFileData::ByteArrayMode) {
+ offsets.resize(numFaces);
+ lengths.resize(numFaces);
+
+ for (auto faceList : { &offsets, &lengths })
+ for (auto &levelList : *faceList)
+ levelList.resize(numLevels);
+ } else {
+ images.resize(numFaces);
+ for (auto &levelList : images)
+ levelList.resize(numLevels);
+ }
}
+ bool isValid(int level, int face) const { return level < numLevels && face < numFaces; }
+
+ int getOffset(int level, int face) const { return offsets[face][level]; }
+ void setOffset(int value, int level, int face) { offsets[face][level] = value; }
+ int getLength(int level, int face) const { return lengths[face][level]; }
+ void setLength(int value, int level, int face) { lengths[face][level] = value; }
+
+ QTextureFileData::Mode mode = QTextureFileData::ByteArrayMode;
QByteArray logName;
QByteArray data;
- QVector<int> offsets;
- QVector<int> lengths;
+ QVarLengthArray<QList<int>, MAX_FACES> offsets; // [Face][Level] = offset
+ QVarLengthArray<QList<int>, MAX_FACES> lengths; // [Face][Level] = length
+ QVarLengthArray<QList<QImage>, MAX_FACES> images; // [Face][Level] = length
QSize size;
quint32 format = 0;
quint32 internalFormat = 0;
quint32 baseInternalFormat = 0;
+ int numFaces = 0;
+ int numLevels = 0;
+ QMap<QByteArray, QByteArray> keyValues;
};
-
-
-QTextureFileData::QTextureFileData()
+QTextureFileData::QTextureFileData(Mode mode)
{
+ d = new QTextureFileDataPrivate;
+ d->mode = mode;
}
QTextureFileData::QTextureFileData(const QTextureFileData &other)
@@ -118,19 +111,34 @@ bool QTextureFileData::isValid() const
if (!d)
return false;
+ if (d->mode == ImageMode)
+ return true; // Manually populated: the caller needs to do verification at that time.
+
if (d->data.isEmpty() || d->size.isEmpty() || (!d->format && !d->internalFormat))
return false;
- const int numChunks = d->offsets.size();
- if (numChunks == 0 || (d->lengths.size() != numChunks))
- return false;
+ const int numFacesOffset = d->offsets.size();
+ const int numFacesLength = d->lengths.size();
+ if (numFacesOffset == 0 || numFacesLength == 0 || d->numFaces != numFacesOffset
+ || d->numFaces != numFacesLength)
+ return false;
+
+ const qint64 dataSize = d->data.size();
- const qint64 sz = d->data.size();
- for (int i = 0; i < numChunks; i++) {
- qint64 offi = d->offsets.at(i);
- qint64 leni = d->lengths.at(i);
- if (offi < 0 || offi >= sz || leni <= 0 || (offi + leni > sz))
+ // Go through all faces and levels and check that the range is inside the data size.
+ for (int face = 0; face < d->numFaces; face++) {
+ const int numLevelsOffset = d->offsets.at(face).size();
+ const int numLevelsLength = d->lengths.at(face).size();
+ if (numLevelsOffset == 0 || numLevelsLength == 0 || d->numLevels != numLevelsOffset
+ || d->numLevels != numLevelsLength)
return false;
+
+ for (int level = 0; level < d->numLevels; level++) {
+ const qint64 offset = d->getOffset(level, face);
+ const qint64 length = d->getLength(level, face);
+ if (offset < 0 || offset >= dataSize || length <= 0 || (offset + length > dataSize))
+ return false;
+ }
}
return true;
}
@@ -147,47 +155,85 @@ QByteArray QTextureFileData::data() const
void QTextureFileData::setData(const QByteArray &data)
{
- if (!d.constData()) //### uh think about this design, this is the only way to create; should be constructor instead at least
- d = new QTextureFileDataPrivate;
-
+ Q_ASSERT(d->mode == ByteArrayMode);
d->data = data;
}
-int QTextureFileData::dataOffset(int level) const
+void QTextureFileData::setData(const QImage &image, int level, int face)
+{
+ Q_ASSERT(d->mode == ImageMode);
+ d->ensureSize(level + 1, face + 1);
+ d->images[face][level] = image;
+}
+
+int QTextureFileData::dataOffset(int level, int face) const
{
- return (d && d->offsets.size() > level) ? d->offsets.at(level) : 0;
+ Q_ASSERT(d->mode == ByteArrayMode);
+ return (d && d->isValid(level, face)) ? d->getOffset(level, face) : 0;
}
-void QTextureFileData::setDataOffset(int offset, int level)
+void QTextureFileData::setDataOffset(int offset, int level, int face)
{
+ Q_ASSERT(d->mode == ByteArrayMode);
if (d.constData() && level >= 0) {
- d->ensureLevels(level + 1);
- d->offsets[level] = offset;
+ d->ensureSize(level + 1, face + 1);
+ d->setOffset(offset, level, face);
}
}
-int QTextureFileData::dataLength(int level) const
+int QTextureFileData::dataLength(int level, int face) const
+{
+ Q_ASSERT(d->mode == ByteArrayMode);
+ return (d && d->isValid(level, face)) ? d->getLength(level, face) : 0;
+}
+
+QByteArrayView QTextureFileData::getDataView(int level, int face) const
{
- return (d && d->lengths.size() > level) ? d->lengths.at(level) : 0;
+ if (d->mode == ByteArrayMode) {
+ const int dataLength = this->dataLength(level, face);
+ const int dataOffset = this->dataOffset(level, face);
+
+ if (d == nullptr || dataLength == 0)
+ return QByteArrayView();
+
+ return QByteArrayView(d->data.constData() + dataOffset, dataLength);
+ } else {
+ if (!d->isValid(level, face))
+ return QByteArrayView();
+ const QImage &img = d->images[face][level];
+ return img.isNull() ? QByteArrayView() : QByteArrayView(img.constBits(), img.sizeInBytes());
+ }
}
-void QTextureFileData::setDataLength(int length, int level)
+void QTextureFileData::setDataLength(int length, int level, int face)
{
+ Q_ASSERT(d->mode == ByteArrayMode);
if (d.constData() && level >= 0) {
- d->ensureLevels(level + 1);
- d->lengths[level] = length;
+ d->ensureSize(level + 1, face + 1);
+ d->setLength(length, level, face);
}
}
int QTextureFileData::numLevels() const
{
- return d ? d->offsets.size() : 0;
+ return d ? d->numLevels : 0;
+}
+
+void QTextureFileData::setNumLevels(int numLevels)
+{
+ if (d && numLevels >= 0)
+ d->ensureSize(numLevels, d->numFaces, true);
+}
+
+int QTextureFileData::numFaces() const
+{
+ return d ? d->numFaces : 0;
}
-void QTextureFileData::setNumLevels(int num)
+void QTextureFileData::setNumFaces(int numFaces)
{
- if (d && num >= 0)
- d->ensureLevels(num, true);
+ if (d && numFaces >= 0)
+ d->ensureSize(d->numLevels, numFaces, true);
}
QSize QTextureFileData::size() const
@@ -245,15 +291,20 @@ void QTextureFileData::setLogName(const QByteArray &name)
d->logName = name;
}
+QMap<QByteArray, QByteArray> QTextureFileData::keyValueMetadata() const
+{
+ return d ? d->keyValues : QMap<QByteArray, QByteArray>();
+}
+
+void QTextureFileData::setKeyValueMetadata(const QMap<QByteArray, QByteArray> &keyValues)
+{
+ if (d)
+ d->keyValues = keyValues;
+}
+
static QByteArray glFormatName(quint32 fmt)
{
- const char *id = nullptr;
-#if QT_CONFIG(opengl)
- id = QMetaEnum::fromType<QOpenGLTexture::TextureFormat>().valueToKey(fmt);
-#endif
- QByteArray res(id ? id : "(?)");
- res += " [0x" + QByteArray::number(fmt, 16).rightJustified(4, '0') + ']';
- return res;
+ return QByteArray("0x" + QByteArray::number(fmt, 16).rightJustified(4, '0'));
}
QDebug operator<<(QDebug dbg, const QTextureFileData &d)
@@ -267,9 +318,11 @@ QDebug operator<<(QDebug dbg, const QTextureFileData &d)
dbg << "glInternalFormat:" << glFormatName(d.glInternalFormat());
dbg << "glBaseInternalFormat:" << glFormatName(d.glBaseInternalFormat());
dbg.nospace() << "Levels: " << d.numLevels();
+ dbg.nospace() << "Faces: " << d.numFaces();
if (!d.isValid())
dbg << " {Invalid}";
dbg << ")";
+ dbg << (d.d->mode ? "[bytearray-based]" : "[image-based]");
} else {
dbg << "null)";
}
diff --git a/src/gui/util/qtexturefiledata_p.h b/src/gui/util/qtexturefiledata_p.h
index 2df23de33c..cd0dbe171c 100644
--- a/src/gui/util/qtexturefiledata_p.h
+++ b/src/gui/util/qtexturefiledata_p.h
@@ -1,41 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2018 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the QtGui module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2021 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#ifndef QTEXTUREFILEDATA_P_H
#define QTEXTUREFILEDATA_P_H
@@ -55,6 +19,7 @@
#include <QSharedDataPointer>
#include <QLoggingCategory>
#include <QDebug>
+#include <private/qglobal_p.h>
QT_BEGIN_NAMESPACE
@@ -65,7 +30,9 @@ class QTextureFileDataPrivate;
class Q_GUI_EXPORT QTextureFileData
{
public:
- QTextureFileData();
+ enum Mode { ByteArrayMode, ImageMode };
+
+ QTextureFileData(Mode mode = ByteArrayMode);
QTextureFileData(const QTextureFileData &other);
QTextureFileData &operator=(const QTextureFileData &other);
~QTextureFileData();
@@ -77,16 +44,22 @@ public:
QByteArray data() const;
void setData(const QByteArray &data);
+ void setData(const QImage &image, int level = 0, int face = 0);
+
+ int dataOffset(int level = 0, int face = 0) const;
+ void setDataOffset(int offset, int level = 0, int face = 0);
- int dataOffset(int level = 0) const;
- void setDataOffset(int offset, int level = 0);
+ int dataLength(int level = 0, int face = 0) const;
+ void setDataLength(int length, int level = 0, int face = 0);
- int dataLength(int level = 0) const;
- void setDataLength(int length, int level = 0);
+ QByteArrayView getDataView(int level = 0, int face = 0) const;
int numLevels() const;
void setNumLevels(int num);
+ int numFaces() const;
+ void setNumFaces(int num);
+
QSize size() const;
void setSize(const QSize &size);
@@ -102,11 +75,15 @@ public:
QByteArray logName() const;
void setLogName(const QByteArray &name);
+ QMap<QByteArray, QByteArray> keyValueMetadata() const;
+ void setKeyValueMetadata(const QMap<QByteArray, QByteArray> &keyValues);
+
private:
QSharedDataPointer<QTextureFileDataPrivate> d;
+ friend Q_GUI_EXPORT QDebug operator<<(QDebug dbg, const QTextureFileData &d);
};
-Q_DECLARE_TYPEINFO(QTextureFileData, Q_MOVABLE_TYPE);
+Q_DECLARE_TYPEINFO(QTextureFileData, Q_RELOCATABLE_TYPE);
Q_GUI_EXPORT QDebug operator<<(QDebug dbg, const QTextureFileData &d);
diff --git a/src/gui/util/qtexturefilehandler_p.h b/src/gui/util/qtexturefilehandler_p.h
index 3d4f42526f..9fb3130f0b 100644
--- a/src/gui/util/qtexturefilehandler_p.h
+++ b/src/gui/util/qtexturefilehandler_p.h
@@ -1,41 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2017 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the QtGui module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2017 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#ifndef QTEXTUREFILEHANDLER_P_H
#define QTEXTUREFILEHANDLER_P_H
@@ -63,7 +27,7 @@ public:
{
m_logName = !logName.isEmpty() ? logName : QByteArrayLiteral("(unknown)");
}
- virtual ~QTextureFileHandler() {}
+ virtual ~QTextureFileHandler();
virtual QTextureFileData read() = 0;
QIODevice *device() const { return m_device; }
diff --git a/src/gui/util/qtexturefilereader.cpp b/src/gui/util/qtexturefilereader.cpp
index fefb957323..596c30d2f7 100644
--- a/src/gui/util/qtexturefilereader.cpp
+++ b/src/gui/util/qtexturefilereader.cpp
@@ -1,41 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2018 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the QtGui module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2018 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#include "qtexturefilereader_p.h"
@@ -47,6 +11,8 @@
QT_BEGIN_NAMESPACE
+QTextureFileHandler::~QTextureFileHandler() = default;
+
QTextureFileReader::QTextureFileReader(QIODevice *device, const QString &fileName)
: m_device(device), m_fileName(fileName)
{
diff --git a/src/gui/util/qtexturefilereader_p.h b/src/gui/util/qtexturefilereader_p.h
index 2ec0b0cc49..5f7b31ee32 100644
--- a/src/gui/util/qtexturefilereader_p.h
+++ b/src/gui/util/qtexturefilereader_p.h
@@ -1,41 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2018 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the QtGui module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2018 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#ifndef QTEXTUREFILEREADER_H
#define QTEXTUREFILEREADER_H
diff --git a/src/gui/util/qundogroup.cpp b/src/gui/util/qundogroup.cpp
new file mode 100644
index 0000000000..db5d009ca6
--- /dev/null
+++ b/src/gui/util/qundogroup.cpp
@@ -0,0 +1,479 @@
+// Copyright (C) 2020 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
+
+#include "qundogroup.h"
+#include "qundostack.h"
+#include "qundostack_p.h"
+
+QT_BEGIN_NAMESPACE
+
+class QUndoGroupPrivate : public QObjectPrivate
+{
+ Q_DECLARE_PUBLIC(QUndoGroup)
+public:
+ QUndoGroupPrivate() : active(nullptr) {}
+
+ QUndoStack *active;
+ QList<QUndoStack*> stack_list;
+};
+
+/*!
+ \class QUndoGroup
+ \brief The QUndoGroup class is a group of QUndoStack objects.
+ \since 4.2
+ \inmodule QtGui
+
+ For an overview of the Qt's undo framework, see the
+ \l{qundo.html}{overview}.
+
+ An application often has multiple undo stacks, one for each opened document. At the
+ same time, an application usually has one undo action and one redo action, which
+ triggers undo or redo in the active document.
+
+ QUndoGroup is a group of QUndoStack objects, one of which may be active. It has
+ an undo() and redo() slot, which calls QUndoStack::undo() and QUndoStack::redo()
+ for the active stack. It also has the functions createUndoAction() and createRedoAction().
+ The actions returned by these functions behave in the same way as those returned by
+ QUndoStack::createUndoAction() and QUndoStack::createRedoAction() of the active
+ stack.
+
+ Stacks are added to a group with addStack() and removed with removeStack(). A stack
+ is implicitly added to a group when it is created with the group as its parent
+ QObject.
+
+ It is the programmer's responsibility to specify which stack is active by
+ calling QUndoStack::setActive(), usually when the associated document window receives focus.
+ The active stack may also be set with setActiveStack(), and is returned by activeStack().
+
+ When a stack is added to a group using addStack(), the group does not take ownership
+ of the stack. This means the stack has to be deleted separately from the group. When
+ a stack is deleted, it is automatically removed from a group. A stack may belong to
+ only one group. Adding it to another group will cause it to be removed from the previous
+ group.
+
+ A QUndoGroup is also useful in conjunction with QUndoView. If a QUndoView is
+ set to watch a group using QUndoView::setGroup(), it will update itself to display
+ the active stack.
+*/
+
+/*!
+ Creates an empty QUndoGroup object with parent \a parent.
+
+ \sa addStack()
+*/
+
+QUndoGroup::QUndoGroup(QObject *parent)
+ : QObject(*new QUndoGroupPrivate(), parent)
+{
+}
+
+/*!
+ Destroys the QUndoGroup.
+*/
+QUndoGroup::~QUndoGroup()
+{
+ // Ensure all QUndoStacks no longer refer to this group.
+ Q_D(QUndoGroup);
+ QList<QUndoStack *>::iterator it = d->stack_list.begin();
+ QList<QUndoStack *>::iterator end = d->stack_list.end();
+ while (it != end) {
+ (*it)->d_func()->group = nullptr;
+ ++it;
+ }
+}
+
+/*!
+ Adds \a stack to this group. The group does not take ownership of the stack. Another
+ way of adding a stack to a group is by specifying the group as the stack's parent
+ QObject in QUndoStack::QUndoStack(). In this case, the stack is deleted when the
+ group is deleted, in the usual manner of QObjects.
+
+ \sa removeStack(), stacks(), QUndoStack::QUndoStack()
+*/
+
+void QUndoGroup::addStack(QUndoStack *stack)
+{
+ Q_D(QUndoGroup);
+
+ if (d->stack_list.contains(stack))
+ return;
+ d->stack_list.append(stack);
+
+ if (QUndoGroup *other = stack->d_func()->group)
+ other->removeStack(stack);
+ stack->d_func()->group = this;
+}
+
+/*!
+ Removes \a stack from this group. If the stack was the active stack in the group,
+ the active stack becomes 0.
+
+ \sa addStack(), stacks(), QUndoStack::~QUndoStack()
+*/
+
+void QUndoGroup::removeStack(QUndoStack *stack)
+{
+ Q_D(QUndoGroup);
+
+ if (d->stack_list.removeAll(stack) == 0)
+ return;
+ if (stack == d->active)
+ setActiveStack(nullptr);
+ stack->d_func()->group = nullptr;
+}
+
+/*!
+ Returns a list of stacks in this group.
+
+ \sa addStack(), removeStack()
+*/
+
+QList<QUndoStack*> QUndoGroup::stacks() const
+{
+ Q_D(const QUndoGroup);
+ return d->stack_list;
+}
+
+/*!
+ Sets the active stack of this group to \a stack.
+
+ If the stack is not a member of this group, this function does nothing.
+
+ Synonymous with calling QUndoStack::setActive() on \a stack.
+
+ The actions returned by createUndoAction() and createRedoAction() will now behave
+ in the same way as those returned by \a stack's QUndoStack::createUndoAction()
+ and QUndoStack::createRedoAction().
+
+ \sa QUndoStack::setActive(), activeStack()
+*/
+
+void QUndoGroup::setActiveStack(QUndoStack *stack)
+{
+ Q_D(QUndoGroup);
+ if (d->active == stack)
+ return;
+
+ if (d->active != nullptr) {
+ disconnect(d->active, SIGNAL(canUndoChanged(bool)),
+ this, SIGNAL(canUndoChanged(bool)));
+ disconnect(d->active, SIGNAL(undoTextChanged(QString)),
+ this, SIGNAL(undoTextChanged(QString)));
+ disconnect(d->active, SIGNAL(canRedoChanged(bool)),
+ this, SIGNAL(canRedoChanged(bool)));
+ disconnect(d->active, SIGNAL(redoTextChanged(QString)),
+ this, SIGNAL(redoTextChanged(QString)));
+ disconnect(d->active, SIGNAL(indexChanged(int)),
+ this, SIGNAL(indexChanged(int)));
+ disconnect(d->active, SIGNAL(cleanChanged(bool)),
+ this, SIGNAL(cleanChanged(bool)));
+ }
+
+ d->active = stack;
+
+ if (d->active == nullptr) {
+ emit canUndoChanged(false);
+ emit undoTextChanged(QString());
+ emit canRedoChanged(false);
+ emit redoTextChanged(QString());
+ emit cleanChanged(true);
+ emit indexChanged(0);
+ } else {
+ connect(d->active, SIGNAL(canUndoChanged(bool)),
+ this, SIGNAL(canUndoChanged(bool)));
+ connect(d->active, SIGNAL(undoTextChanged(QString)),
+ this, SIGNAL(undoTextChanged(QString)));
+ connect(d->active, SIGNAL(canRedoChanged(bool)),
+ this, SIGNAL(canRedoChanged(bool)));
+ connect(d->active, SIGNAL(redoTextChanged(QString)),
+ this, SIGNAL(redoTextChanged(QString)));
+ connect(d->active, SIGNAL(indexChanged(int)),
+ this, SIGNAL(indexChanged(int)));
+ connect(d->active, SIGNAL(cleanChanged(bool)),
+ this, SIGNAL(cleanChanged(bool)));
+ emit canUndoChanged(d->active->canUndo());
+ emit undoTextChanged(d->active->undoText());
+ emit canRedoChanged(d->active->canRedo());
+ emit redoTextChanged(d->active->redoText());
+ emit cleanChanged(d->active->isClean());
+ emit indexChanged(d->active->index());
+ }
+
+ emit activeStackChanged(d->active);
+}
+
+/*!
+ Returns the active stack of this group.
+
+ If none of the stacks are active, or if the group is empty, this function
+ returns \nullptr.
+
+ \sa setActiveStack(), QUndoStack::setActive()
+*/
+
+QUndoStack *QUndoGroup::activeStack() const
+{
+ Q_D(const QUndoGroup);
+ return d->active;
+}
+
+#ifndef QT_NO_ACTION
+
+/*!
+ Creates an undo QAction object with parent \a parent.
+
+ Triggering this action will cause a call to QUndoStack::undo() on the active stack.
+ The text of this action will always be the text of the command which will be undone
+ in the next call to undo(), prefixed by \a prefix. If there is no command available
+ for undo, if the group is empty or if none of the stacks are active, this action will
+ be disabled.
+
+ If \a prefix is empty, the default template "Undo %1" is used instead of prefix.
+ Before Qt 4.8, the prefix "Undo" was used by default.
+
+ \sa createRedoAction(), canUndo(), QUndoCommand::text()
+*/
+
+QAction *QUndoGroup::createUndoAction(QObject *parent, const QString &prefix) const
+{
+ QAction *action = new QAction(parent);
+ action->setEnabled(canUndo());
+
+ QString effectivePrefix = prefix;
+ QString defaultText;
+ if (prefix.isEmpty()) {
+ effectivePrefix = tr("Undo %1");
+ defaultText = tr("Undo", "Default text for undo action");
+ }
+
+ QUndoStackPrivate::setPrefixedText(action, effectivePrefix, defaultText, undoText());
+
+ connect(this, &QUndoGroup::canUndoChanged, action, &QAction::setEnabled);
+ connect(this, &QUndoGroup::undoTextChanged, action, [=](const QString &text) {
+ QUndoStackPrivate::setPrefixedText(action, effectivePrefix, defaultText, text);
+ });
+ connect(action, &QAction::triggered, this, &QUndoGroup::undo);
+
+ return action;
+}
+
+/*!
+ Creates an redo QAction object with parent \a parent.
+
+ Triggering this action will cause a call to QUndoStack::redo() on the active stack.
+ The text of this action will always be the text of the command which will be redone
+ in the next call to redo(), prefixed by \a prefix. If there is no command available
+ for redo, if the group is empty or if none of the stacks are active, this action will
+ be disabled.
+
+ If \a prefix is empty, the default template "Redo %1" is used instead of prefix.
+ Before Qt 4.8, the prefix "Redo" was used by default.
+
+ \sa createUndoAction(), canRedo(), QUndoCommand::text()
+*/
+
+QAction *QUndoGroup::createRedoAction(QObject *parent, const QString &prefix) const
+{
+ QAction *action = new QAction(parent);
+ action->setEnabled(canRedo());
+
+ QString effectivePrefix = prefix;
+ QString defaultText;
+ if (prefix.isEmpty()) {
+ effectivePrefix = tr("Redo %1");
+ defaultText = tr("Redo", "Default text for redo action");
+ }
+
+ QUndoStackPrivate::setPrefixedText(action, effectivePrefix, defaultText, redoText());
+
+ connect(this, &QUndoGroup::canRedoChanged, action, &QAction::setEnabled);
+ connect(this, &QUndoGroup::redoTextChanged, action, [=](const QString &text) {
+ QUndoStackPrivate::setPrefixedText(action, effectivePrefix, defaultText, text);
+ });
+ connect(action, &QAction::triggered, this, &QUndoGroup::redo);
+ return action;
+}
+
+#endif // QT_NO_ACTION
+
+/*!
+ Calls QUndoStack::undo() on the active stack.
+
+ If none of the stacks are active, or if the group is empty, this function
+ does nothing.
+
+ \sa redo(), canUndo(), setActiveStack()
+*/
+
+void QUndoGroup::undo()
+{
+ Q_D(QUndoGroup);
+ if (d->active != nullptr)
+ d->active->undo();
+}
+
+/*!
+ Calls QUndoStack::redo() on the active stack.
+
+ If none of the stacks are active, or if the group is empty, this function
+ does nothing.
+
+ \sa undo(), canRedo(), setActiveStack()
+*/
+
+
+void QUndoGroup::redo()
+{
+ Q_D(QUndoGroup);
+ if (d->active != nullptr)
+ d->active->redo();
+}
+
+/*!
+ Returns the value of the active stack's QUndoStack::canUndo().
+
+ If none of the stacks are active, or if the group is empty, this function
+ returns \c false.
+
+ \sa canRedo(), setActiveStack()
+*/
+
+bool QUndoGroup::canUndo() const
+{
+ Q_D(const QUndoGroup);
+ return d->active != nullptr && d->active->canUndo();
+}
+
+/*!
+ Returns the value of the active stack's QUndoStack::canRedo().
+
+ If none of the stacks are active, or if the group is empty, this function
+ returns \c false.
+
+ \sa canUndo(), setActiveStack()
+*/
+
+bool QUndoGroup::canRedo() const
+{
+ Q_D(const QUndoGroup);
+ return d->active != nullptr && d->active->canRedo();
+}
+
+/*!
+ Returns the value of the active stack's QUndoStack::undoText().
+
+ If none of the stacks are active, or if the group is empty, this function
+ returns an empty string.
+
+ \sa redoText(), setActiveStack()
+*/
+
+QString QUndoGroup::undoText() const
+{
+ Q_D(const QUndoGroup);
+ return d->active == nullptr ? QString() : d->active->undoText();
+}
+
+/*!
+ Returns the value of the active stack's QUndoStack::redoText().
+
+ If none of the stacks are active, or if the group is empty, this function
+ returns an empty string.
+
+ \sa undoText(), setActiveStack()
+*/
+
+QString QUndoGroup::redoText() const
+{
+ Q_D(const QUndoGroup);
+ return d->active == nullptr ? QString() : d->active->redoText();
+}
+
+/*!
+ Returns the value of the active stack's QUndoStack::isClean().
+
+ If none of the stacks are active, or if the group is empty, this function
+ returns \c true.
+
+ \sa setActiveStack()
+*/
+
+bool QUndoGroup::isClean() const
+{
+ Q_D(const QUndoGroup);
+ return d->active == nullptr || d->active->isClean();
+}
+
+/*! \fn void QUndoGroup::activeStackChanged(QUndoStack *stack)
+
+ This signal is emitted whenever the active stack of the group changes. This can happen
+ when setActiveStack() or QUndoStack::setActive() is called, or when the active stack
+ is removed form the group. \a stack is the new active stack. If no stack is active,
+ \a stack is 0.
+
+ \sa setActiveStack(), QUndoStack::setActive()
+*/
+
+/*! \fn void QUndoGroup::indexChanged(int idx)
+
+ This signal is emitted whenever the active stack emits QUndoStack::indexChanged()
+ or the active stack changes.
+
+ \a idx is the new current index, or 0 if the active stack is 0.
+
+ \sa QUndoStack::indexChanged(), setActiveStack()
+*/
+
+/*! \fn void QUndoGroup::cleanChanged(bool clean)
+
+ This signal is emitted whenever the active stack emits QUndoStack::cleanChanged()
+ or the active stack changes.
+
+ \a clean is the new state, or true if the active stack is 0.
+
+ \sa QUndoStack::cleanChanged(), setActiveStack()
+*/
+
+/*! \fn void QUndoGroup::canUndoChanged(bool canUndo)
+
+ This signal is emitted whenever the active stack emits QUndoStack::canUndoChanged()
+ or the active stack changes.
+
+ \a canUndo is the new state, or false if the active stack is 0.
+
+ \sa QUndoStack::canUndoChanged(), setActiveStack()
+*/
+
+/*! \fn void QUndoGroup::canRedoChanged(bool canRedo)
+
+ This signal is emitted whenever the active stack emits QUndoStack::canRedoChanged()
+ or the active stack changes.
+
+ \a canRedo is the new state, or false if the active stack is 0.
+
+ \sa QUndoStack::canRedoChanged(), setActiveStack()
+*/
+
+/*! \fn void QUndoGroup::undoTextChanged(const QString &undoText)
+
+ This signal is emitted whenever the active stack emits QUndoStack::undoTextChanged()
+ or the active stack changes.
+
+ \a undoText is the new state, or an empty string if the active stack is 0.
+
+ \sa QUndoStack::undoTextChanged(), setActiveStack()
+*/
+
+/*! \fn void QUndoGroup::redoTextChanged(const QString &redoText)
+
+ This signal is emitted whenever the active stack emits QUndoStack::redoTextChanged()
+ or the active stack changes.
+
+ \a redoText is the new state, or an empty string if the active stack is 0.
+
+ \sa QUndoStack::redoTextChanged(), setActiveStack()
+*/
+
+QT_END_NAMESPACE
+
+#include "moc_qundogroup.cpp"
diff --git a/src/gui/util/qundogroup.h b/src/gui/util/qundogroup.h
new file mode 100644
index 0000000000..e92f4f46b0
--- /dev/null
+++ b/src/gui/util/qundogroup.h
@@ -0,0 +1,64 @@
+// Copyright (C) 2020 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
+
+#ifndef QUNDOGROUP_H
+#define QUNDOGROUP_H
+
+#include <QtGui/qtguiglobal.h>
+#include <QtCore/qobject.h>
+#include <QtCore/qstring.h>
+
+QT_REQUIRE_CONFIG(undogroup);
+
+QT_BEGIN_NAMESPACE
+
+class QUndoGroupPrivate;
+class QUndoStack;
+class QAction;
+
+class Q_GUI_EXPORT QUndoGroup : public QObject
+{
+ Q_OBJECT
+ Q_DECLARE_PRIVATE(QUndoGroup)
+
+public:
+ explicit QUndoGroup(QObject *parent = nullptr);
+ ~QUndoGroup();
+
+ void addStack(QUndoStack *stack);
+ void removeStack(QUndoStack *stack);
+ QList<QUndoStack*> stacks() const;
+ QUndoStack *activeStack() const;
+
+#ifndef QT_NO_ACTION
+ QAction *createUndoAction(QObject *parent, const QString &prefix = QString()) const;
+ QAction *createRedoAction(QObject *parent, const QString &prefix = QString()) const;
+#endif // QT_NO_ACTION
+
+ bool canUndo() const;
+ bool canRedo() const;
+ QString undoText() const;
+ QString redoText() const;
+ bool isClean() const;
+
+public Q_SLOTS:
+ void undo();
+ void redo();
+ void setActiveStack(QUndoStack *stack);
+
+Q_SIGNALS:
+ void activeStackChanged(QUndoStack *stack);
+ void indexChanged(int idx);
+ void cleanChanged(bool clean);
+ void canUndoChanged(bool canUndo);
+ void canRedoChanged(bool canRedo);
+ void undoTextChanged(const QString &undoText);
+ void redoTextChanged(const QString &redoText);
+
+private:
+ Q_DISABLE_COPY(QUndoGroup)
+};
+
+QT_END_NAMESPACE
+
+#endif // QUNDOGROUP_H
diff --git a/src/gui/util/qundostack.cpp b/src/gui/util/qundostack.cpp
new file mode 100644
index 0000000000..403833d421
--- /dev/null
+++ b/src/gui/util/qundostack.cpp
@@ -0,0 +1,1354 @@
+// Copyright (C) 2020 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
+
+#include <QtCore/qdebug.h>
+#include "qundostack.h"
+#if QT_CONFIG(undogroup)
+#include "qundogroup.h"
+#endif
+#include "qundostack_p.h"
+
+QT_BEGIN_NAMESPACE
+
+/*!
+ \class QUndoCommand
+ \brief The QUndoCommand class is the base class of all commands stored on a QUndoStack.
+ \since 4.2
+
+ \inmodule QtGui
+
+ For an overview of Qt's Undo Framework, see the
+ \l{Overview of Qt's Undo Framework}{overview document}.
+
+ A QUndoCommand represents a single editing action on a document; for example,
+ inserting or deleting a block of text in a text editor. QUndoCommand can apply
+ a change to the document with redo() and undo the change with undo(). The
+ implementations for these functions must be provided in a derived class.
+
+ \snippet code/src_gui_util_qundostack.cpp 0
+
+ A QUndoCommand has an associated text(). This is a short string
+ describing what the command does. It is used to update the text
+ properties of the stack's undo and redo actions; see
+ QUndoStack::createUndoAction() and QUndoStack::createRedoAction().
+
+ QUndoCommand objects are owned by the stack they were pushed on.
+ QUndoStack deletes a command if it has been undone and a new command is pushed. For example:
+
+\snippet code/src_gui_util_qundostack.cpp 1
+
+ In effect, when a command is pushed, it becomes the top-most command
+ on the stack.
+
+ To support command compression, QUndoCommand has an id() and the virtual function
+ mergeWith(). These functions are used by QUndoStack::push().
+
+ To support command macros, a QUndoCommand object can have any number of child
+ commands. Undoing or redoing the parent command will cause the child
+ commands to be undone or redone. A command can be assigned
+ to a parent explicitly in the constructor. In this case, the command
+ will be owned by the parent.
+
+ The parent in this case is usually an empty command, in that it doesn't
+ provide its own implementation of undo() and redo(). Instead, it uses
+ the base implementations of these functions, which simply call undo() or
+ redo() on all its children. The parent should, however, have a meaningful
+ text().
+
+ \snippet code/src_gui_util_qundostack.cpp 2
+
+ Another way to create macros is to use the convenience functions
+ QUndoStack::beginMacro() and QUndoStack::endMacro().
+
+ \sa QUndoStack
+*/
+
+/*!
+ Constructs a QUndoCommand object with the given \a parent and \a text.
+
+ If \a parent is not \nullptr, this command is appended to parent's
+ child list. The parent command then owns this command and will delete
+ it in its destructor.
+
+ \sa ~QUndoCommand()
+*/
+
+QUndoCommand::QUndoCommand(const QString &text, QUndoCommand *parent)
+ : QUndoCommand(parent)
+{
+ setText(text);
+}
+
+/*!
+ Constructs a QUndoCommand object with parent \a parent.
+
+ If \a parent is not \nullptr, this command is appended to parent's
+ child list. The parent command then owns this command and will delete
+ it in its destructor.
+
+ \sa ~QUndoCommand()
+*/
+
+QUndoCommand::QUndoCommand(QUndoCommand *parent)
+{
+ d = new QUndoCommandPrivate;
+ if (parent != nullptr)
+ parent->d->child_list.append(this);
+}
+
+/*!
+ Destroys the QUndoCommand object and all child commands.
+
+ \sa QUndoCommand()
+*/
+
+QUndoCommand::~QUndoCommand()
+{
+ qDeleteAll(d->child_list);
+ delete d;
+}
+
+/*!
+ \since 5.9
+
+ Returns whether the command is obsolete.
+
+ The boolean is used for the automatic removal of commands that are not necessary in the
+ stack anymore. The isObsolete function is checked in the functions QUndoStack::push(),
+ QUndoStack::undo(), QUndoStack::redo(), and QUndoStack::setIndex().
+
+ \sa setObsolete(), mergeWith(), QUndoStack::push(), QUndoStack::undo(), QUndoStack::redo()
+*/
+
+bool QUndoCommand::isObsolete() const
+{
+ return d->obsolete;
+}
+
+/*!
+ \since 5.9
+
+ Sets whether the command is obsolete to \a obsolete.
+
+ \sa isObsolete(), mergeWith(), QUndoStack::push(), QUndoStack::undo(), QUndoStack::redo()
+*/
+
+void QUndoCommand::setObsolete(bool obsolete)
+{
+ d->obsolete = obsolete;
+}
+
+/*!
+ Returns the ID of this command.
+
+ A command ID is used in command compression. It must be an integer unique to
+ this command's class, or -1 if the command doesn't support compression.
+
+ If the command supports compression this function must be overridden in the
+ derived class to return the correct ID. The base implementation returns -1.
+
+ QUndoStack::push() will only try to merge two commands if they have the
+ same ID, and the ID is not -1.
+
+ \sa mergeWith(), QUndoStack::push()
+*/
+
+int QUndoCommand::id() const
+{
+ return -1;
+}
+
+/*!
+ Attempts to merge this command with \a command. Returns \c true on
+ success; otherwise returns \c false.
+
+ If this function returns \c true, calling this command's redo() must have the same
+ effect as redoing both this command and \a command.
+ Similarly, calling this command's undo() must have the same effect as undoing
+ \a command and this command.
+
+ QUndoStack will only try to merge two commands if they have the same id, and
+ the id is not -1.
+
+ The default implementation returns \c false.
+
+ \snippet code/src_gui_util_qundostack.cpp 3
+
+ \sa id(), QUndoStack::push()
+*/
+
+bool QUndoCommand::mergeWith(const QUndoCommand *command)
+{
+ Q_UNUSED(command);
+ return false;
+}
+
+/*!
+ Applies a change to the document. This function must be implemented in
+ the derived class. Calling QUndoStack::push(),
+ QUndoStack::undo() or QUndoStack::redo() from this function leads to
+ undefined beahavior.
+
+ The default implementation calls redo() on all child commands.
+
+ \sa undo()
+*/
+
+void QUndoCommand::redo()
+{
+ for (int i = 0; i < d->child_list.size(); ++i)
+ d->child_list.at(i)->redo();
+}
+
+/*!
+ Reverts a change to the document. After undo() is called, the state of
+ the document should be the same as before redo() was called. This function must
+ be implemented in the derived class. Calling QUndoStack::push(),
+ QUndoStack::undo() or QUndoStack::redo() from this function leads to
+ undefined beahavior.
+
+ The default implementation calls undo() on all child commands in reverse order.
+
+ \sa redo()
+*/
+
+void QUndoCommand::undo()
+{
+ for (int i = d->child_list.size() - 1; i >= 0; --i)
+ d->child_list.at(i)->undo();
+}
+
+/*!
+ Returns a short text string describing what this command does; for example,
+ "insert text".
+
+ The text is used for names of items in QUndoView.
+
+ \sa actionText(), setText(), QUndoStack::createUndoAction(), QUndoStack::createRedoAction()
+*/
+
+QString QUndoCommand::text() const
+{
+ return d->text;
+}
+
+/*!
+ \since 4.8
+
+ Returns a short text string describing what this command does; for example,
+ "insert text".
+
+ The text is used when the text properties of the stack's undo and redo
+ actions are updated.
+
+ \sa text(), setText(), QUndoStack::createUndoAction(), QUndoStack::createRedoAction()
+*/
+
+QString QUndoCommand::actionText() const
+{
+ return d->actionText;
+}
+
+/*!
+ Sets the command's text to be the \a text specified.
+
+ The specified text should be a short user-readable string describing what this
+ command does.
+
+ If you need to have two different strings for text() and actionText(), separate
+ them with "\\n" and pass into this function. Even if you do not use this feature
+ for English strings during development, you can still let translators use two
+ different strings in order to match specific languages' needs.
+ The described feature and the function actionText() are available since Qt 4.8.
+
+ \sa text(), actionText(), QUndoStack::createUndoAction(), QUndoStack::createRedoAction()
+*/
+
+void QUndoCommand::setText(const QString &text)
+{
+ int cdpos = text.indexOf(u'\n');
+ if (cdpos > 0) {
+ d->text = text.left(cdpos);
+ d->actionText = text.mid(cdpos + 1);
+ } else {
+ d->text = text;
+ d->actionText = text;
+ }
+}
+
+/*!
+ \since 4.4
+
+ Returns the number of child commands in this command.
+
+ \sa child()
+*/
+
+int QUndoCommand::childCount() const
+{
+ return d->child_list.size();
+}
+
+/*!
+ \since 4.4
+
+ Returns the child command at \a index.
+
+ \sa childCount(), QUndoStack::command()
+*/
+
+const QUndoCommand *QUndoCommand::child(int index) const
+{
+ if (index < 0 || index >= d->child_list.size())
+ return nullptr;
+ return d->child_list.at(index);
+}
+
+#if QT_CONFIG(undostack)
+
+/*!
+ \class QUndoStack
+ \brief The QUndoStack class is a stack of QUndoCommand objects.
+ \since 4.2
+
+ \inmodule QtGui
+
+ For an overview of Qt's Undo Framework, see the
+ \l{Overview of Qt's Undo Framework}{overview document}.
+
+ An undo stack maintains a stack of commands that have been applied to a
+ document.
+
+ New commands are pushed on the stack using push(). Commands can be
+ undone and redone using undo() and redo(), or by triggering the
+ actions returned by createUndoAction() and createRedoAction().
+
+ QUndoStack keeps track of the \a current command. This is the command
+ which will be executed by the next call to redo(). The index of this
+ command is returned by index(). The state of the edited object can be
+ rolled forward or back using setIndex(). If the top-most command on the
+ stack has already been redone, index() is equal to count().
+
+ QUndoStack provides support for undo and redo actions, command
+ compression, command macros, and supports the concept of a
+ \e{clean state}.
+
+ \section1 Undo and Redo Actions
+
+ QUndoStack provides convenient undo and redo QAction objects, which
+ can be inserted into a menu or a toolbar. When commands are undone or
+ redone, QUndoStack updates the text properties of these actions
+ to reflect what change they will trigger. The actions are also disabled
+ when no command is available for undo or redo. These actions
+ are returned by QUndoStack::createUndoAction() and QUndoStack::createRedoAction().
+
+ \section1 Command Compression and Macros
+
+ Command compression is useful when several commands can be compressed
+ into a single command that can be undone and redone in a single operation.
+ For example, when a user types a character in a text editor, a new command
+ is created. This command inserts the character into the document at the
+ cursor position. However, it is more convenient for the user to be able
+ to undo or redo typing of whole words, sentences, or paragraphs.
+ Command compression allows these single-character commands to be merged
+ into a single command which inserts or deletes sections of text.
+ For more information, see QUndoCommand::mergeWith() and push().
+
+ A command macro is a sequence of commands, all of which are undone and
+ redone in one go. Command macros are created by giving a command a list
+ of child commands.
+ Undoing or redoing the parent command will cause the child commands to
+ be undone or redone. Command macros may be created explicitly
+ by specifying a parent in the QUndoCommand constructor, or by using the
+ convenience functions beginMacro() and endMacro().
+
+ Although command compression and macros appear to have the same effect to the
+ user, they often have different uses in an application. Commands that
+ perform small changes to a document may be usefully compressed if there is
+ no need to individually record them, and if only larger changes are relevant
+ to the user.
+ However, for commands that need to be recorded individually, or those that
+ cannot be compressed, it is useful to use macros to provide a more convenient
+ user experience while maintaining a record of each command.
+
+ \section1 Clean State
+
+ QUndoStack supports the concept of a clean state. When the
+ document is saved to disk, the stack can be marked as clean using
+ setClean(). Whenever the stack returns to this state through undoing and
+ redoing commands, it emits the signal cleanChanged(). This signal
+ is also emitted when the stack leaves the clean state. This signal is
+ usually used to enable and disable the save actions in the application,
+ and to update the document's title to reflect that it contains unsaved
+ changes.
+
+ \section1 Obsolete Commands
+
+ QUndoStack is able to delete commands from the stack if the command is no
+ longer needed. One example may be to delete a command when two commands are
+ merged together in such a way that the merged command has no function. This
+ can be seen with move commands where the user moves their mouse to one part
+ of the screen and then moves it to the original position. The merged command
+ results in a mouse movement of 0. This command can be deleted since it serves
+ no purpose. Another example is with networking commands that fail due to connection
+ issues. In this case, the command is to be removed from the stack because the redo()
+ and undo() functions have no function since there was connection issues.
+
+ A command can be marked obsolete with the QUndoCommand::setObsolete() function.
+ The QUndoCommand::isObsolete() flag is checked in QUndoStack::push(),
+ QUndoStack::undo(), QUndoStack::redo(), and QUndoStack::setIndex() after calling
+ QUndoCommand::undo(), QUndoCommand::redo() and QUndoCommand:mergeWith() where
+ applicable.
+
+ If a command is set obsolete and the clean index is greater than or equal to the
+ current command index, then the clean index will be reset when the command is
+ deleted from the stack.
+
+ \sa QUndoCommand, QUndoView
+*/
+
+/*! \internal
+ Sets the current index to \a idx, emitting appropriate signals. If \a clean is true,
+ makes \a idx the clean index as well.
+*/
+
+void QUndoStackPrivate::setIndex(int idx, bool clean)
+{
+ Q_Q(QUndoStack);
+
+ bool was_clean = index == clean_index;
+
+ if (idx != index) {
+ index = idx;
+ emit q->indexChanged(index);
+ emit q->canUndoChanged(q->canUndo());
+ emit q->undoTextChanged(q->undoText());
+ emit q->canRedoChanged(q->canRedo());
+ emit q->redoTextChanged(q->redoText());
+ }
+
+ if (clean)
+ clean_index = index;
+
+ bool is_clean = index == clean_index;
+ if (is_clean != was_clean)
+ emit q->cleanChanged(is_clean);
+}
+
+/*! \internal
+ If the number of commands on the stack exceedes the undo limit, deletes commands from
+ the bottom of the stack.
+
+ Returns \c true if commands were deleted.
+*/
+
+bool QUndoStackPrivate::checkUndoLimit()
+{
+ if (undo_limit <= 0 || !macro_stack.isEmpty() || undo_limit >= command_list.size())
+ return false;
+
+ int del_count = command_list.size() - undo_limit;
+
+ for (int i = 0; i < del_count; ++i)
+ delete command_list.takeFirst();
+
+ index -= del_count;
+ if (clean_index != -1) {
+ if (clean_index < del_count)
+ clean_index = -1; // we've deleted the clean command
+ else
+ clean_index -= del_count;
+ }
+
+ return true;
+}
+
+/*!
+ Constructs an empty undo stack with the parent \a parent. The
+ stack will initially be in the clean state. If \a parent is a
+ QUndoGroup object, the stack is automatically added to the group.
+
+ \sa push()
+*/
+
+QUndoStack::QUndoStack(QObject *parent)
+ : QObject(*(new QUndoStackPrivate), parent)
+{
+#if QT_CONFIG(undogroup)
+ if (QUndoGroup *group = qobject_cast<QUndoGroup*>(parent))
+ group->addStack(this);
+#endif
+}
+
+/*!
+ Destroys the undo stack, deleting any commands that are on it. If the
+ stack is in a QUndoGroup, the stack is automatically removed from the group.
+
+ \sa QUndoStack()
+*/
+
+QUndoStack::~QUndoStack()
+{
+#if QT_CONFIG(undogroup)
+ Q_D(QUndoStack);
+ if (d->group != nullptr)
+ d->group->removeStack(this);
+#endif
+ clear();
+}
+
+/*!
+ Clears the command stack by deleting all commands on it, and returns the stack
+ to the clean state.
+
+ Commands are not undone or redone; the state of the edited object remains
+ unchanged.
+
+ This function is usually used when the contents of the document are
+ abandoned.
+
+ \sa QUndoStack()
+*/
+
+void QUndoStack::clear()
+{
+ Q_D(QUndoStack);
+
+ if (d->command_list.isEmpty())
+ return;
+
+ bool was_clean = isClean();
+
+ d->macro_stack.clear();
+ qDeleteAll(d->command_list);
+ d->command_list.clear();
+
+ d->index = 0;
+ d->clean_index = 0;
+
+ emit indexChanged(0);
+ emit canUndoChanged(false);
+ emit undoTextChanged(QString());
+ emit canRedoChanged(false);
+ emit redoTextChanged(QString());
+
+ if (!was_clean)
+ emit cleanChanged(true);
+}
+
+/*!
+ Pushes \a cmd on the stack or merges it with the most recently executed command.
+ In either case, executes \a cmd by calling its redo() function.
+
+ If \a cmd's id is not -1, and if the id is the same as that of the
+ most recently executed command, QUndoStack will attempt to merge the two
+ commands by calling QUndoCommand::mergeWith() on the most recently executed
+ command. If QUndoCommand::mergeWith() returns \c true, \a cmd is deleted.
+
+ After calling QUndoCommand::redo() and, if applicable, QUndoCommand::mergeWith(),
+ QUndoCommand::isObsolete() will be called for \a cmd or the merged command.
+ If QUndoCommand::isObsolete() returns \c true, then \a cmd or the merged command
+ will be deleted from the stack.
+
+ In all other cases \a cmd is simply pushed on the stack.
+
+ If commands were undone before \a cmd was pushed, the current command and
+ all commands above it are deleted. Hence \a cmd always ends up being the
+ top-most on the stack.
+
+ Once a command is pushed, the stack takes ownership of it. There
+ are no getters to return the command, since modifying it after it has
+ been executed will almost always lead to corruption of the document's
+ state.
+
+ \sa QUndoCommand::id(), QUndoCommand::mergeWith()
+*/
+
+void QUndoStack::push(QUndoCommand *cmd)
+{
+ Q_D(QUndoStack);
+ if (!cmd->isObsolete())
+ cmd->redo();
+
+ bool macro = !d->macro_stack.isEmpty();
+
+ QUndoCommand *cur = nullptr;
+ if (macro) {
+ QUndoCommand *macro_cmd = d->macro_stack.constLast();
+ if (!macro_cmd->d->child_list.isEmpty())
+ cur = macro_cmd->d->child_list.constLast();
+ } else {
+ if (d->index > 0)
+ cur = d->command_list.at(d->index - 1);
+ while (d->index < d->command_list.size())
+ delete d->command_list.takeLast();
+ if (d->clean_index > d->index)
+ d->clean_index = -1; // we've deleted the clean state
+ }
+
+ bool try_merge = cur != nullptr
+ && cur->id() != -1
+ && cur->id() == cmd->id()
+ && (macro || d->index != d->clean_index);
+
+ if (try_merge && cur->mergeWith(cmd)) {
+ delete cmd;
+
+ if (macro) {
+ if (cur->isObsolete())
+ delete d->macro_stack.constLast()->d->child_list.takeLast();
+ } else {
+ if (cur->isObsolete()) {
+ delete d->command_list.takeLast();
+
+ d->setIndex(d->index - 1, false);
+ } else {
+ emit indexChanged(d->index);
+ emit canUndoChanged(canUndo());
+ emit undoTextChanged(undoText());
+ emit canRedoChanged(canRedo());
+ emit redoTextChanged(redoText());
+ }
+ }
+ } else if (cmd->isObsolete()) {
+ delete cmd; // command should be deleted and NOT added to the stack
+ } else {
+ if (macro) {
+ d->macro_stack.constLast()->d->child_list.append(cmd);
+ } else {
+ d->command_list.append(cmd);
+ d->checkUndoLimit();
+ d->setIndex(d->index + 1, false);
+ }
+ }
+}
+
+/*!
+ Marks the stack as clean and emits cleanChanged() if the stack was
+ not already clean.
+
+ This is typically called when a document is saved, for example.
+
+ Whenever the stack returns to this state through the use of undo/redo
+ commands, it emits the signal cleanChanged(). This signal is also
+ emitted when the stack leaves the clean state.
+
+ \sa isClean(), resetClean(), cleanIndex()
+*/
+
+void QUndoStack::setClean()
+{
+ Q_D(QUndoStack);
+ if (Q_UNLIKELY(!d->macro_stack.isEmpty())) {
+ qWarning("QUndoStack::setClean(): cannot set clean in the middle of a macro");
+ return;
+ }
+
+ d->setIndex(d->index, true);
+}
+
+/*!
+ \since 5.8
+
+ Leaves the clean state and emits cleanChanged() if the stack was clean.
+ This method resets the clean index to -1.
+
+ This is typically called in the following cases, when a document has been:
+ \list
+ \li created basing on some template and has not been saved,
+ so no filename has been associated with the document yet.
+ \li restored from a backup file.
+ \li changed outside of the editor and the user did not reload it.
+ \endlist
+
+ \sa isClean(), setClean(), cleanIndex()
+*/
+
+void QUndoStack::resetClean()
+{
+ Q_D(QUndoStack);
+ const bool was_clean = isClean();
+ d->clean_index = -1;
+ if (was_clean)
+ emit cleanChanged(false);
+}
+
+/*!
+ \since 5.12
+ \property QUndoStack::clean
+ \brief the clean status of this stack.
+
+ This property indicates whether or not the stack is clean. For example, a
+ stack is clean when a document has been saved.
+
+ \sa isClean(), setClean(), resetClean(), cleanIndex()
+*/
+
+/*!
+ If the stack is in the clean state, returns \c true; otherwise returns \c false.
+
+ \sa setClean(), cleanIndex()
+*/
+
+bool QUndoStack::isClean() const
+{
+ Q_D(const QUndoStack);
+ if (!d->macro_stack.isEmpty())
+ return false;
+ return d->clean_index == d->index;
+}
+
+/*!
+ Returns the clean index. This is the index at which setClean() was called.
+
+ A stack may not have a clean index. This happens if a document is saved,
+ some commands are undone, then a new command is pushed. Since
+ push() deletes all the undone commands before pushing the new command, the stack
+ can't return to the clean state again. In this case, this function returns -1.
+ The -1 may also be returned after an explicit call to resetClean().
+
+ \sa isClean(), setClean()
+*/
+
+int QUndoStack::cleanIndex() const
+{
+ Q_D(const QUndoStack);
+ return d->clean_index;
+}
+
+/*!
+ Undoes the command below the current command by calling QUndoCommand::undo().
+ Decrements the current command index.
+
+ If the stack is empty, or if the bottom command on the stack has already been
+ undone, this function does nothing.
+
+ After the command is undone, if QUndoCommand::isObsolete() returns \c true,
+ then the command will be deleted from the stack. Additionally, if the clean
+ index is greater than or equal to the current command index, then the clean
+ index is reset.
+
+ \sa redo(), index()
+*/
+
+void QUndoStack::undo()
+{
+ Q_D(QUndoStack);
+ if (d->index == 0)
+ return;
+
+ if (Q_UNLIKELY(!d->macro_stack.isEmpty())) {
+ qWarning("QUndoStack::undo(): cannot undo in the middle of a macro");
+ return;
+ }
+
+ int idx = d->index - 1;
+ QUndoCommand *cmd = d->command_list.at(idx);
+
+ if (!cmd->isObsolete())
+ cmd->undo();
+
+ if (cmd->isObsolete()) { // A separate check is done b/c the undo command may set obsolete flag
+ delete d->command_list.takeAt(idx);
+
+ if (d->clean_index > idx)
+ resetClean();
+ }
+
+ d->setIndex(idx, false);
+}
+
+/*!
+ Redoes the current command by calling QUndoCommand::redo(). Increments the current
+ command index.
+
+ If the stack is empty, or if the top command on the stack has already been
+ redone, this function does nothing.
+
+ If QUndoCommand::isObsolete() returns true for the current command, then
+ the command will be deleted from the stack. Additionally, if the clean
+ index is greater than or equal to the current command index, then the clean
+ index is reset.
+
+ \sa undo(), index()
+*/
+
+void QUndoStack::redo()
+{
+ Q_D(QUndoStack);
+ if (d->index == d->command_list.size())
+ return;
+
+ if (Q_UNLIKELY(!d->macro_stack.isEmpty())) {
+ qWarning("QUndoStack::redo(): cannot redo in the middle of a macro");
+ return;
+ }
+
+ int idx = d->index;
+ QUndoCommand *cmd = d->command_list.at(idx);
+
+ if (!cmd->isObsolete())
+ cmd->redo(); // A separate check is done b/c the undo command may set obsolete flag
+
+ if (cmd->isObsolete()) {
+ delete d->command_list.takeAt(idx);
+
+ if (d->clean_index > idx)
+ resetClean();
+ } else {
+ d->setIndex(d->index + 1, false);
+ }
+}
+
+/*!
+ Returns the number of commands on the stack. Macro commands are counted as
+ one command.
+
+ \sa index(), setIndex(), command()
+*/
+
+int QUndoStack::count() const
+{
+ Q_D(const QUndoStack);
+ return d->command_list.size();
+}
+
+/*!
+ Returns the index of the current command. This is the command that will be
+ executed on the next call to redo(). It is not always the top-most command
+ on the stack, since a number of commands may have been undone.
+
+ \sa undo(), redo(), count()
+*/
+
+int QUndoStack::index() const
+{
+ Q_D(const QUndoStack);
+ return d->index;
+}
+
+/*!
+ Repeatedly calls undo() or redo() until the current command index reaches
+ \a idx. This function can be used to roll the state of the document forwards
+ of backwards. indexChanged() is emitted only once.
+
+ \sa index(), count(), undo(), redo()
+*/
+
+void QUndoStack::setIndex(int idx)
+{
+ Q_D(QUndoStack);
+ if (Q_UNLIKELY(!d->macro_stack.isEmpty())) {
+ qWarning("QUndoStack::setIndex(): cannot set index in the middle of a macro");
+ return;
+ }
+
+ if (idx < 0)
+ idx = 0;
+ else if (idx > d->command_list.size())
+ idx = d->command_list.size();
+
+ int i = d->index;
+ while (i < idx) {
+ QUndoCommand *cmd = d->command_list.at(i);
+
+ if (!cmd->isObsolete())
+ cmd->redo(); // A separate check is done b/c the undo command may set obsolete flag
+
+ if (cmd->isObsolete()) {
+ delete d->command_list.takeAt(i);
+
+ if (d->clean_index > i)
+ resetClean();
+
+ idx--; // Subtract from idx because we removed a command
+ } else {
+ i++;
+ }
+ }
+
+ while (i > idx) {
+ QUndoCommand *cmd = d->command_list.at(--i);
+
+ cmd->undo();
+ if (cmd->isObsolete()) {
+ delete d->command_list.takeAt(i);
+
+ if (d->clean_index > i)
+ resetClean();
+ }
+ }
+
+ d->setIndex(idx, false);
+}
+
+/*!
+ \since 5.12
+ \property QUndoStack::canUndo
+ \brief whether this stack can undo.
+
+ This property indicates whether or not there is a command that can be
+ undone.
+
+ \sa canUndo(), index(), canRedo()
+*/
+
+/*!
+ Returns \c true if there is a command available for undo; otherwise returns \c false.
+
+ This function returns \c false if the stack is empty, or if the bottom command
+ on the stack has already been undone.
+
+ Synonymous with index() == 0.
+
+ \sa index(), canRedo()
+*/
+
+bool QUndoStack::canUndo() const
+{
+ Q_D(const QUndoStack);
+ if (!d->macro_stack.isEmpty())
+ return false;
+ return d->index > 0;
+}
+
+/*!
+ \since 5.12
+ \property QUndoStack::canRedo
+ \brief whether this stack can redo.
+
+ This property indicates whether or not there is a command that can be
+ redone.
+
+ \sa canRedo(), index(), canUndo()
+*/
+
+/*!
+ Returns \c true if there is a command available for redo; otherwise returns \c false.
+
+ This function returns \c false if the stack is empty or if the top command
+ on the stack has already been redone.
+
+ Synonymous with index() == count().
+
+ \sa index(), canUndo()
+*/
+
+bool QUndoStack::canRedo() const
+{
+ Q_D(const QUndoStack);
+ if (!d->macro_stack.isEmpty())
+ return false;
+ return d->index < d->command_list.size();
+}
+
+/*!
+ \since 5.12
+ \property QUndoStack::undoText
+ \brief the undo text of the next command that is undone.
+
+ This property holds the text of the command which will be undone in the
+ next call to undo().
+
+ \sa undoText(), QUndoCommand::actionText(), redoText()
+*/
+
+/*!
+ Returns the text of the command which will be undone in the next call to undo().
+
+ \sa QUndoCommand::actionText(), redoText()
+*/
+
+QString QUndoStack::undoText() const
+{
+ Q_D(const QUndoStack);
+ if (!d->macro_stack.isEmpty())
+ return QString();
+ if (d->index > 0)
+ return d->command_list.at(d->index - 1)->actionText();
+ return QString();
+}
+
+/*!
+ \since 5.12
+ \property QUndoStack::redoText
+ \brief the redo text of the next command that is redone.
+
+ This property holds the text of the command which will be redone in the
+ next call to redo().
+
+ \sa redoText(), QUndoCommand::actionText(), undoText()
+*/
+
+/*!
+ Returns the text of the command which will be redone in the next call to redo().
+
+ \sa QUndoCommand::actionText(), undoText()
+*/
+
+QString QUndoStack::redoText() const
+{
+ Q_D(const QUndoStack);
+ if (!d->macro_stack.isEmpty())
+ return QString();
+ if (d->index < d->command_list.size())
+ return d->command_list.at(d->index)->actionText();
+ return QString();
+}
+
+#ifndef QT_NO_ACTION
+
+/*!
+ \internal
+
+ Sets the text property of \a action to \a text, applying \a prefix, and falling back to \a defaultText if \a text is empty.
+*/
+void QUndoStackPrivate::setPrefixedText(QAction *action, const QString &prefix, const QString &defaultText, const QString &text)
+{
+ if (defaultText.isEmpty()) {
+ QString s = prefix;
+ if (!prefix.isEmpty() && !text.isEmpty())
+ s.append(u' ');
+ s.append(text);
+ action->setText(s);
+ } else {
+ if (text.isEmpty())
+ action->setText(defaultText);
+ else
+ action->setText(prefix.arg(text));
+ }
+};
+
+/*!
+ Creates an undo QAction object with the given \a parent.
+
+ Triggering this action will cause a call to undo(). The text of this action
+ is the text of the command which will be undone in the next call to undo(),
+ prefixed by the specified \a prefix. If there is no command available for undo,
+ this action will be disabled.
+
+ If \a prefix is empty, the default template "Undo %1" is used instead of prefix.
+ Before Qt 4.8, the prefix "Undo" was used by default.
+
+ \sa createRedoAction(), canUndo(), QUndoCommand::text()
+*/
+
+QAction *QUndoStack::createUndoAction(QObject *parent, const QString &prefix) const
+{
+ QAction *action = new QAction(parent);
+ action->setEnabled(canUndo());
+
+ QString effectivePrefix = prefix;
+ QString defaultText;
+ if (prefix.isEmpty()) {
+ effectivePrefix = tr("Undo %1");
+ defaultText = tr("Undo", "Default text for undo action");
+ }
+
+ QUndoStackPrivate::setPrefixedText(action, effectivePrefix, defaultText, undoText());
+
+ connect(this, &QUndoStack::canUndoChanged, action, &QAction::setEnabled);
+ connect(this, &QUndoStack::undoTextChanged, action, [=](const QString &text) {
+ QUndoStackPrivate::setPrefixedText(action, effectivePrefix, defaultText, text);
+ });
+ connect(action, &QAction::triggered, this, &QUndoStack::undo);
+
+ return action;
+}
+
+/*!
+ Creates an redo QAction object with the given \a parent.
+
+ Triggering this action will cause a call to redo(). The text of this action
+ is the text of the command which will be redone in the next call to redo(),
+ prefixed by the specified \a prefix. If there is no command available for redo,
+ this action will be disabled.
+
+ If \a prefix is empty, the default template "Redo %1" is used instead of prefix.
+ Before Qt 4.8, the prefix "Redo" was used by default.
+
+ \sa createUndoAction(), canRedo(), QUndoCommand::text()
+*/
+
+QAction *QUndoStack::createRedoAction(QObject *parent, const QString &prefix) const
+{
+ QAction *action = new QAction(parent);
+ action->setEnabled(canRedo());
+
+ QString effectivePrefix = prefix;
+ QString defaultText;
+ if (prefix.isEmpty()) {
+ effectivePrefix = tr("Redo %1");
+ defaultText = tr("Redo", "Default text for redo action");
+ }
+
+ QUndoStackPrivate::setPrefixedText(action, effectivePrefix, defaultText, redoText());
+
+ connect(this, &QUndoStack::canRedoChanged, action, &QAction::setEnabled);
+ connect(this, &QUndoStack::redoTextChanged, action, [=](const QString &text) {
+ QUndoStackPrivate::setPrefixedText(action, effectivePrefix, defaultText, text);
+ });
+ connect(action, &QAction::triggered, this, &QUndoStack::redo);
+
+ return action;
+}
+
+#endif // QT_NO_ACTION
+
+/*!
+ Begins composition of a macro command with the given \a text description.
+
+ An empty command described by the specified \a text is pushed on the stack.
+ Any subsequent commands pushed on the stack will be appended to the empty
+ command's children until endMacro() is called.
+
+ Calls to beginMacro() and endMacro() may be nested, but every call to
+ beginMacro() must have a matching call to endMacro().
+
+ While a macro is being composed, the stack is disabled. This means that:
+ \list
+ \li indexChanged() and cleanChanged() are not emitted,
+ \li canUndo() and canRedo() return false,
+ \li calling undo() or redo() has no effect,
+ \li the undo/redo actions are disabled.
+ \endlist
+
+ The stack becomes enabled and appropriate signals are emitted when endMacro()
+ is called for the outermost macro.
+
+ \snippet code/src_gui_util_qundostack.cpp 4
+
+ This code is equivalent to:
+
+ \snippet code/src_gui_util_qundostack.cpp 5
+
+ \sa endMacro()
+*/
+
+void QUndoStack::beginMacro(const QString &text)
+{
+ Q_D(QUndoStack);
+ QUndoCommand *cmd = new QUndoCommand();
+ cmd->setText(text);
+
+ if (d->macro_stack.isEmpty()) {
+ while (d->index < d->command_list.size())
+ delete d->command_list.takeLast();
+ if (d->clean_index > d->index)
+ d->clean_index = -1; // we've deleted the clean state
+ d->command_list.append(cmd);
+ } else {
+ d->macro_stack.constLast()->d->child_list.append(cmd);
+ }
+ d->macro_stack.append(cmd);
+
+ if (d->macro_stack.size() == 1) {
+ emit canUndoChanged(false);
+ emit undoTextChanged(QString());
+ emit canRedoChanged(false);
+ emit redoTextChanged(QString());
+ }
+}
+
+/*!
+ Ends composition of a macro command.
+
+ If this is the outermost macro in a set nested macros, this function emits
+ indexChanged() once for the entire macro command.
+
+ \sa beginMacro()
+*/
+
+void QUndoStack::endMacro()
+{
+ Q_D(QUndoStack);
+ if (Q_UNLIKELY(d->macro_stack.isEmpty())) {
+ qWarning("QUndoStack::endMacro(): no matching beginMacro()");
+ return;
+ }
+
+ d->macro_stack.removeLast();
+
+ if (d->macro_stack.isEmpty()) {
+ d->checkUndoLimit();
+ d->setIndex(d->index + 1, false);
+ }
+}
+
+/*!
+ \since 4.4
+
+ Returns a const pointer to the command at \a index.
+
+ This function returns a const pointer, because modifying a command,
+ once it has been pushed onto the stack and executed, almost always
+ causes corruption of the state of the document, if the command is
+ later undone or redone.
+
+ \sa QUndoCommand::child()
+*/
+const QUndoCommand *QUndoStack::command(int index) const
+{
+ Q_D(const QUndoStack);
+
+ if (index < 0 || index >= d->command_list.size())
+ return nullptr;
+ return d->command_list.at(index);
+}
+
+/*!
+ Returns the text of the command at index \a idx.
+
+ \sa beginMacro()
+*/
+
+QString QUndoStack::text(int idx) const
+{
+ Q_D(const QUndoStack);
+
+ if (idx < 0 || idx >= d->command_list.size())
+ return QString();
+ return d->command_list.at(idx)->text();
+}
+
+/*!
+ \property QUndoStack::undoLimit
+ \brief the maximum number of commands on this stack.
+ \since 4.3
+
+ When the number of commands on a stack exceedes the stack's undoLimit, commands are
+ deleted from the bottom of the stack. Macro commands (commands with child commands)
+ are treated as one command. The default value is 0, which means that there is no
+ limit.
+
+ This property may only be set when the undo stack is empty, since setting it on a
+ non-empty stack might delete the command at the current index. Calling setUndoLimit()
+ on a non-empty stack prints a warning and does nothing.
+*/
+
+void QUndoStack::setUndoLimit(int limit)
+{
+ Q_D(QUndoStack);
+
+ if (Q_UNLIKELY(!d->command_list.isEmpty())) {
+ qWarning("QUndoStack::setUndoLimit(): an undo limit can only be set when the stack is empty");
+ return;
+ }
+
+ if (limit == d->undo_limit)
+ return;
+ d->undo_limit = limit;
+ d->checkUndoLimit();
+}
+
+int QUndoStack::undoLimit() const
+{
+ Q_D(const QUndoStack);
+
+ return d->undo_limit;
+}
+
+/*!
+ \property QUndoStack::active
+ \brief the active status of this stack.
+
+ An application often has multiple undo stacks, one for each opened document. The active
+ stack is the one associated with the currently active document. If the stack belongs
+ to a QUndoGroup, calls to QUndoGroup::undo() or QUndoGroup::redo() will be forwarded
+ to this stack when it is active. If the QUndoGroup is watched by a QUndoView, the view
+ will display the contents of this stack when it is active. If the stack does not belong to
+ a QUndoGroup, making it active has no effect.
+
+ It is the programmer's responsibility to specify which stack is active by
+ calling setActive(), usually when the associated document window receives focus.
+
+ \sa QUndoGroup
+*/
+
+void QUndoStack::setActive(bool active)
+{
+#if !QT_CONFIG(undogroup)
+ Q_UNUSED(active);
+#else
+ Q_D(QUndoStack);
+
+ if (d->group != nullptr) {
+ if (active)
+ d->group->setActiveStack(this);
+ else if (d->group->activeStack() == this)
+ d->group->setActiveStack(nullptr);
+ }
+#endif
+}
+
+bool QUndoStack::isActive() const
+{
+#if !QT_CONFIG(undogroup)
+ return true;
+#else
+ Q_D(const QUndoStack);
+ return d->group == nullptr || d->group->activeStack() == this;
+#endif
+}
+
+/*!
+ \fn void QUndoStack::indexChanged(int idx)
+
+ This signal is emitted whenever a command modifies the state of the document.
+ This happens when a command is undone or redone. When a macro
+ command is undone or redone, or setIndex() is called, this signal
+ is emitted only once.
+
+ \a idx specifies the index of the current command, ie. the command which will be
+ executed on the next call to redo().
+
+ \sa index(), setIndex()
+*/
+
+/*!
+ \fn void QUndoStack::cleanChanged(bool clean)
+
+ This signal is emitted whenever the stack enters or leaves the clean state.
+ If \a clean is true, the stack is in a clean state; otherwise this signal
+ indicates that it has left the clean state.
+
+ \sa isClean(), setClean()
+*/
+
+/*!
+ \fn void QUndoStack::undoTextChanged(const QString &undoText)
+
+ This signal is emitted whenever the value of undoText() changes. It is
+ used to update the text property of the undo action returned by createUndoAction().
+ \a undoText specifies the new text.
+*/
+
+/*!
+ \fn void QUndoStack::canUndoChanged(bool canUndo)
+
+ This signal is emitted whenever the value of canUndo() changes. It is
+ used to enable or disable the undo action returned by createUndoAction().
+ \a canUndo specifies the new value.
+*/
+
+/*!
+ \fn void QUndoStack::redoTextChanged(const QString &redoText)
+
+ This signal is emitted whenever the value of redoText() changes. It is
+ used to update the text property of the redo action returned by createRedoAction().
+ \a redoText specifies the new text.
+*/
+
+/*!
+ \fn void QUndoStack::canRedoChanged(bool canRedo)
+
+ This signal is emitted whenever the value of canRedo() changes. It is
+ used to enable or disable the redo action returned by createRedoAction().
+ \a canRedo specifies the new value.
+*/
+
+QT_END_NAMESPACE
+
+#include "moc_qundostack.cpp"
+
+#endif // QT_CONFIG(undostack)
diff --git a/src/gui/util/qundostack.h b/src/gui/util/qundostack.h
new file mode 100644
index 0000000000..7b18485509
--- /dev/null
+++ b/src/gui/util/qundostack.h
@@ -0,0 +1,121 @@
+// Copyright (C) 2020 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
+
+#ifndef QUNDOSTACK_H
+#define QUNDOSTACK_H
+
+#include <QtGui/qtguiglobal.h>
+#include <QtCore/qobject.h>
+#include <QtCore/qstring.h>
+
+QT_REQUIRE_CONFIG(undocommand);
+
+QT_BEGIN_NAMESPACE
+
+class QAction;
+class QUndoCommandPrivate;
+class QUndoStackPrivate;
+
+class Q_GUI_EXPORT QUndoCommand
+{
+ QUndoCommandPrivate *d;
+
+public:
+ explicit QUndoCommand(QUndoCommand *parent = nullptr);
+ explicit QUndoCommand(const QString &text, QUndoCommand *parent = nullptr);
+ virtual ~QUndoCommand();
+
+ virtual void undo();
+ virtual void redo();
+
+ QString text() const;
+ QString actionText() const;
+ void setText(const QString &text);
+
+ bool isObsolete() const;
+ void setObsolete(bool obsolete);
+
+ virtual int id() const;
+ virtual bool mergeWith(const QUndoCommand *other);
+
+ int childCount() const;
+ const QUndoCommand *child(int index) const;
+
+private:
+ Q_DISABLE_COPY(QUndoCommand)
+ friend class QUndoStack;
+};
+
+#if QT_CONFIG(undostack)
+
+class Q_GUI_EXPORT QUndoStack : public QObject
+{
+ Q_OBJECT
+ Q_DECLARE_PRIVATE(QUndoStack)
+ Q_PROPERTY(bool active READ isActive WRITE setActive)
+ Q_PROPERTY(int undoLimit READ undoLimit WRITE setUndoLimit)
+ Q_PROPERTY(bool canUndo READ canUndo NOTIFY canUndoChanged)
+ Q_PROPERTY(bool canRedo READ canRedo NOTIFY canRedoChanged)
+ Q_PROPERTY(QString undoText READ undoText NOTIFY undoTextChanged)
+ Q_PROPERTY(QString redoText READ redoText NOTIFY redoTextChanged)
+ Q_PROPERTY(bool clean READ isClean NOTIFY cleanChanged)
+
+public:
+ explicit QUndoStack(QObject *parent = nullptr);
+ ~QUndoStack();
+ void clear();
+
+ void push(QUndoCommand *cmd);
+
+ bool canUndo() const;
+ bool canRedo() const;
+ QString undoText() const;
+ QString redoText() const;
+
+ int count() const;
+ int index() const;
+ QString text(int idx) const;
+
+#ifndef QT_NO_ACTION
+ QAction *createUndoAction(QObject *parent, const QString &prefix = QString()) const;
+ QAction *createRedoAction(QObject *parent, const QString &prefix = QString()) const;
+#endif // QT_NO_ACTION
+
+ bool isActive() const;
+ bool isClean() const;
+ int cleanIndex() const;
+
+ void beginMacro(const QString &text);
+ void endMacro();
+
+ void setUndoLimit(int limit);
+ int undoLimit() const;
+
+ const QUndoCommand *command(int index) const;
+
+public Q_SLOTS:
+ void setClean();
+ void resetClean();
+ void setIndex(int idx);
+ void undo();
+ void redo();
+ void setActive(bool active = true);
+
+Q_SIGNALS:
+ void indexChanged(int idx);
+ void cleanChanged(bool clean);
+ void canUndoChanged(bool canUndo);
+ void canRedoChanged(bool canRedo);
+ void undoTextChanged(const QString &undoText);
+ void redoTextChanged(const QString &redoText);
+
+private:
+ Q_DISABLE_COPY(QUndoStack)
+ friend class QUndoGroup;
+};
+
+#endif // QT_CONFIG(undostack)
+
+QT_END_NAMESPACE
+
+#endif // QUNDOSTACK_H
diff --git a/src/gui/util/qundostack_p.h b/src/gui/util/qundostack_p.h
new file mode 100644
index 0000000000..d655d5fdf5
--- /dev/null
+++ b/src/gui/util/qundostack_p.h
@@ -0,0 +1,68 @@
+// Copyright (C) 2020 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
+
+#ifndef QUNDOSTACK_P_H
+#define QUNDOSTACK_P_H
+
+#include <QtGui/private/qtguiglobal_p.h>
+#include <private/qobject_p.h>
+#include <QtCore/qlist.h>
+#include <QtCore/qstring.h>
+#if QT_CONFIG(action)
+# include <QtGui/qaction.h>
+#endif
+
+#include "qundostack.h"
+
+QT_BEGIN_NAMESPACE
+class QUndoCommand;
+class QUndoGroup;
+
+//
+// W A R N I N G
+// -------------
+//
+// This file is not part of the Qt API. It exists purely as an
+// implementation detail. This header file may change from version to
+// version without notice, or even be removed.
+//
+// We mean it.
+//
+
+class QUndoCommandPrivate
+{
+public:
+ QUndoCommandPrivate() : id(-1), obsolete(false) {}
+ QList<QUndoCommand*> child_list;
+ QString text;
+ QString actionText;
+ int id;
+ bool obsolete;
+};
+
+#if QT_CONFIG(undostack)
+
+class QUndoStackPrivate : public QObjectPrivate
+{
+ Q_DECLARE_PUBLIC(QUndoStack)
+public:
+ QUndoStackPrivate() : index(0), clean_index(0), group(nullptr), undo_limit(0) {}
+
+ QList<QUndoCommand*> command_list;
+ QList<QUndoCommand*> macro_stack;
+ int index;
+ int clean_index;
+ QUndoGroup *group;
+ int undo_limit;
+
+ void setIndex(int idx, bool clean);
+ bool checkUndoLimit();
+
+#ifndef QT_NO_ACTION
+ static void setPrefixedText(QAction *action, const QString &prefix, const QString &defaultText, const QString &text);
+#endif
+};
+
+QT_END_NAMESPACE
+#endif // QT_CONFIG(undostack)
+#endif // QUNDOSTACK_P_H
diff --git a/src/gui/util/qvalidator.cpp b/src/gui/util/qvalidator.cpp
index 54cbb28ffa..2a81006657 100644
--- a/src/gui/util/qvalidator.cpp
+++ b/src/gui/util/qvalidator.cpp
@@ -1,42 +1,6 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Copyright (C) 2012 Klarälvdalens Datakonsult AB, a KDAB Group company, info@kdab.com, author Giuseppe D'Angelo <giuseppe.dangelo@kdab.com>
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the QtGui module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2021 The Qt Company Ltd.
+// Copyright (C) 2012 Klarälvdalens Datakonsult AB, a KDAB Group company, info@kdab.com, author Giuseppe D'Angelo <giuseppe.dangelo@kdab.com>
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#include <qdebug.h>
@@ -58,7 +22,7 @@ QT_BEGIN_NAMESPACE
The class itself is abstract. Two subclasses, \l QIntValidator and
\l QDoubleValidator, provide basic numeric-range checking, and \l
- QRegExpValidator provides general checking using a custom regular
+ QRegularExpressionValidator provides general checking using a custom regular
expression.
If the built-in validators aren't sufficient, you can subclass
@@ -84,8 +48,8 @@ QT_BEGIN_NAMESPACE
\list
\li For a line edit that accepts integers from 10 to 1000 inclusive,
- 42 and 123 are \l Acceptable, the empty string and 5 are \l
- Intermediate, and "asdf" and 1114 is \l Invalid.
+ 42 and 123 are \l Acceptable, the empty string, 5, or 1234 are \l
+ Intermediate, and "asdf" and 10114 is \l Invalid.
\li For an editable combobox that accepts URLs, any well-formed URL
is \l Acceptable, "http://example.com/," is \l Intermediate
@@ -114,7 +78,7 @@ QT_BEGIN_NAMESPACE
QValidator is typically used with QLineEdit, QSpinBox and
QComboBox.
- \sa QIntValidator, QDoubleValidator, QRegExpValidator, {Line Edits Example}
+ \sa QIntValidator, QDoubleValidator, QRegularExpressionValidator, {Line Edits Example}
*/
@@ -192,13 +156,6 @@ QT_BEGIN_NAMESPACE
\internal
*/
-/*!
- \fn void QRegExpValidator::regExpChanged(const QRegExp &regExp)
-
- This signal is emitted after the regExp property changed.
- \internal
-*/
-
class QValidatorPrivate : public QObjectPrivate{
Q_DECLARE_PUBLIC(QValidator)
public:
@@ -328,7 +285,7 @@ void QValidator::fixup(QString &) const
is not set by default, the validator will accept group separators. It is thus
recommended to use QLocale::toInt() to obtain the numeric value.
- \sa QDoubleValidator, QRegExpValidator, QLocale::toInt(), {Line Edits Example}
+ \sa QDoubleValidator, QRegularExpressionValidator, QLocale::toInt(), {Line Edits Example}
*/
/*!
@@ -370,15 +327,20 @@ QIntValidator::~QIntValidator()
\fn QValidator::State QIntValidator::validate(QString &input, int &pos) const
Returns \l Acceptable if the \a input is an integer within the
- valid range, \l Intermediate if the \a input is a prefix of an integer in the
- valid range, and \l Invalid otherwise.
+ valid range. If \a input has at most as many digits as the top of the range,
+ or is a prefix of an integer in the valid range, returns \l Intermediate.
+ Otherwise, returns \l Invalid.
- If the valid range consists of just positive integers (e.g., 32 to 100)
- and \a input is a negative integer, then Invalid is returned. (On the other
- hand, if the range consists of negative integers (e.g., -100 to -32) and
- \a input is a positive integer, then Intermediate is returned, because
- the user might be just about to type the minus (especially for right-to-left
- languages).
+ If the valid range consists of just positive integers (e.g., 32 to 100) and
+ \a input is a negative integer, then Invalid is returned. (On the other
+ hand, if the range consists of negative integers (e.g., -100 to -32) and \a
+ input is a positive integer without leading plus sign, then Intermediate is
+ returned, because the user might be just about to type the minus (especially
+ for right-to-left languages).
+
+ Similarly, if the valid range is between 46 and 53, then 41 and 59 will be
+ evaluated as \l Intermediate, as otherwise the user wouldn't be able to
+ change a value from 49 to 51.
\snippet code/src_gui_util_qvalidator.cpp 2
@@ -400,34 +362,45 @@ static qlonglong pow10(int exp)
return result;
}
-QValidator::State QIntValidator::validate(QString & input, int&) const
+template <typename T> static inline
+std::optional<QValidator::State> initialResultCheck(T min, T max, const ParsingResult &result)
{
- QByteArray buff;
- if (!locale().d->m_data->validateChars(input, QLocaleData::IntegerMode, &buff, -1,
- locale().numberOptions())) {
- return Invalid;
- }
+ if (result.state == ParsingResult::Invalid)
+ return QValidator::Invalid;
+ const CharBuff &buff = result.buff;
if (buff.isEmpty())
- return Intermediate;
+ return QValidator::Intermediate;
- const bool startsWithMinus(buff[0] == '-');
- if (b >= 0 && startsWithMinus)
- return Invalid;
+ char ch = buff[0];
+ const bool signConflicts = (min >= 0 && ch == '-') || (max < 0 && ch == '+');
+ if (signConflicts)
+ return QValidator::Invalid;
- const bool startsWithPlus(buff[0] == '+');
- if (t < 0 && startsWithPlus)
- return Invalid;
+ if (result.state == ParsingResult::Intermediate)
+ return QValidator::Intermediate;
- if (buff.size() == 1 && (startsWithPlus || startsWithMinus))
- return Intermediate;
+ return std::nullopt;
+}
- bool ok;
- qlonglong entered = QLocaleData::bytearrayToLongLong(buff.constData(), 10, &ok);
- if (!ok)
+QValidator::State QIntValidator::validate(QString & input, int&) const
+{
+ ParsingResult result =
+ locale().d->m_data->validateChars(input, QLocaleData::IntegerMode, -1,
+ locale().numberOptions());
+
+ std::optional<State> opt = initialResultCheck(b, t, result);
+ if (opt)
+ return *opt;
+
+ const CharBuff &buff = result.buff;
+ QSimpleParsedNumber r = QLocaleData::bytearrayToLongLong(buff, 10);
+ if (!r.ok())
return Invalid;
+ qint64 entered = r.result;
if (entered >= b && entered <= t) {
+ bool ok = false;
locale().toInt(input, &ok);
return ok ? Acceptable : Intermediate;
}
@@ -439,7 +412,7 @@ QValidator::State QIntValidator::validate(QString & input, int&) const
// of a number of digits equal to or less than the max value as intermediate.
int buffLength = buff.size();
- if (startsWithPlus)
+ if (buff[0] == '+')
buffLength--;
const int tLength = t != 0 ? static_cast<int>(std::log10(qAbs(t))) + 1 : 1;
@@ -452,18 +425,16 @@ QValidator::State QIntValidator::validate(QString & input, int&) const
/*! \reimp */
void QIntValidator::fixup(QString &input) const
{
- QByteArray buff;
- if (!locale().d->m_data->validateChars(input, QLocaleData::IntegerMode, &buff, -1,
- locale().numberOptions())) {
+ auto [parseState, buff] =
+ locale().d->m_data->validateChars(input, QLocaleData::IntegerMode, -1,
+ locale().numberOptions());
+ if (parseState == ParsingResult::Invalid)
return;
- }
- bool ok;
- qlonglong entered = QLocaleData::bytearrayToLongLong(buff.constData(), 10, &ok);
- if (ok)
- input = locale().toString(entered);
-}
-// FIXME: Qt 6: Make QIntValidator::setRange() non-virtual
+ QSimpleParsedNumber r = QLocaleData::bytearrayToLongLong(buff, 10);
+ if (r.ok())
+ input = locale().toString(r.result);
+}
/*!
Sets the range of the validator to only accept integers between \a
@@ -495,7 +466,7 @@ void QIntValidator::setRange(int bottom, int top)
\brief the validator's lowest acceptable value
By default, this property's value is derived from the lowest signed
- integer available (typically -2147483647).
+ integer available (-2147483648).
\sa setRange()
*/
@@ -509,7 +480,7 @@ void QIntValidator::setBottom(int bottom)
\brief the validator's highest acceptable value
By default, this property's value is derived from the highest signed
- integer available (typically 2147483647).
+ integer available (2147483647).
\sa setRange()
*/
@@ -534,8 +505,6 @@ QValidator::QValidator(QValidatorPrivate &d, QObject *parent)
{
}
-#ifndef QT_NO_REGEXP
-
class QDoubleValidatorPrivate : public QValidatorPrivate
{
Q_DECLARE_PUBLIC(QDoubleValidator)
@@ -549,6 +518,8 @@ public:
QDoubleValidator::Notation notation;
QValidator::State validateWithLocale(QString & input, QLocaleData::NumberMode numMode, const QLocale &locale) const;
+ void fixupWithLocale(QString &input, QLocaleData::NumberMode numMode,
+ const QLocale &locale) const;
};
@@ -560,8 +531,7 @@ public:
\inmodule QtGui
QDoubleValidator provides an upper bound, a lower bound, and a
- limit on the number of digits after the decimal point. It does not
- provide a fixup() function.
+ limit on the number of digits after the decimal point.
You can set the acceptable range in one call with setRange(), or
with setBottom() and setTop(). Set the number of decimal places
@@ -572,12 +542,13 @@ public:
in the German locale, "1,234" will be accepted as the fractional number
1.234. In Arabic locales, QDoubleValidator will accept Arabic digits.
- \note The QLocale::NumberOptions set on the locale() also affect the
- way the number is interpreted. For example, since QLocale::RejectGroupSeparator
- is not set by default, the validator will accept group separators. It is thus
- recommended to use QLocale::toDouble() to obtain the numeric value.
+ \note The QLocale::NumberOptions set on the locale() also affect the way the
+ number is interpreted. For example, since QLocale::RejectGroupSeparator is
+ not set by default (except on the \c "C" locale), the validator will accept
+ group separators. If the string passes validation, pass it to
+ locale().toDouble() to obtain its numeric value.
- \sa QIntValidator, QRegExpValidator, QLocale::toDouble(), {Line Edits Example}
+ \sa QIntValidator, QRegularExpressionValidator, QLocale::toDouble(), {Line Edits Example}
*/
/*!
@@ -585,10 +556,23 @@ public:
\since 4.3
This enum defines the allowed notations for entering a double.
- \value StandardNotation The string is written as a standard number
- (i.e. 0.015).
- \value ScientificNotation The string is written in scientific
- form. It may have an exponent part(i.e. 1.5E-2).
+ \value StandardNotation The string is written in the standard format, a
+ whole number part optionally followed by a separator
+ and fractional part, for example \c{"0.015"}.
+
+ \value ScientificNotation The string is written in scientific form, which
+ optionally appends an exponent part to the
+ standard format, for example \c{"1.5E-2"}.
+
+ The whole number part may, as usual, include a sign. This, along with the
+ separators for fractional part, exponent and any digit-grouping, depend on
+ locale. QDoubleValidator doesn't check the placement (which would also
+ depend on locale) of any digit-grouping separators it finds, but it will
+ reject input that contains them if \l QLocale::RejectGroupSeparator is set
+ in \c locale().numberOptions().
+
+ \sa QLocale::numberOptions(), QLocale::decimalPoint(),
+ QLocale::exponential(), QLocale::negativeSign()
*/
/*!
@@ -596,8 +580,8 @@ public:
that accepts any double.
*/
-QDoubleValidator::QDoubleValidator(QObject * parent)
- : QDoubleValidator(-HUGE_VAL, HUGE_VAL, 1000, parent)
+QDoubleValidator::QDoubleValidator(QObject *parent)
+ : QDoubleValidator(-HUGE_VAL, HUGE_VAL, -1, parent)
{
}
@@ -630,14 +614,14 @@ QDoubleValidator::~QDoubleValidator()
/*!
\fn QValidator::State QDoubleValidator::validate(QString &input, int &pos) const
- Returns \l Acceptable if the string \a input contains a double
- that is within the valid range and is in the correct format.
+ Returns \l Acceptable if the string \a input is in the correct format and
+ contains a double within the valid range.
- Returns \l Intermediate if \a input contains a double that is
- outside the range or is in the wrong format; e.g. is empty.
+ Returns \l Intermediate if \a input is in the wrong format or contains a
+ double outside the range.
- Returns \l Invalid if the \a input is not a double or with too many
- digits after the decimal point.
+ Returns \l Invalid if the \a input doesn't represent a double or has too
+ many digits after the decimal point.
Note: If the valid range consists of just positive doubles (e.g. 0.0 to 100.0)
and \a input is a negative double then \l Invalid is returned. If notation()
@@ -673,24 +657,16 @@ QValidator::State QDoubleValidator::validate(QString & input, int &) const
QValidator::State QDoubleValidatorPrivate::validateWithLocale(QString &input, QLocaleData::NumberMode numMode, const QLocale &locale) const
{
Q_Q(const QDoubleValidator);
- QByteArray buff;
- if (!locale.d->m_data->validateChars(input, numMode, &buff, q->dec, locale.numberOptions())) {
- return QValidator::Invalid;
- }
+ ParsingResult result =
+ locale.d->m_data->validateChars(input, numMode, q->dec, locale.numberOptions());
- if (buff.isEmpty())
- return QValidator::Intermediate;
-
- if (q->b >= 0 && buff.startsWith('-'))
- return QValidator::Invalid;
-
- if (q->t < 0 && buff.startsWith('+'))
- return QValidator::Invalid;
+ std::optional<QValidator::State> opt = initialResultCheck(q->b, q->t, result);
+ if (opt)
+ return *opt;
bool ok = false;
double i = locale.toDouble(input, &ok); // returns 0.0 if !ok
- if (i == qt_qnan())
- return QValidator::Invalid;
+ Q_ASSERT(!qIsNaN(i)); // Would be caught by validateChars()
if (!ok)
return QValidator::Intermediate;
@@ -699,8 +675,13 @@ QValidator::State QDoubleValidatorPrivate::validateWithLocale(QString &input, QL
if (notation == QDoubleValidator::StandardNotation) {
double max = qMax(qAbs(q->b), qAbs(q->t));
- if (max < LLONG_MAX) {
- qlonglong n = pow10(numDigits(qlonglong(max)));
+ qlonglong v;
+ // Need a whole number to pass to convertDoubleTo() or it fails. Use
+ // floor, as max is positive so this has the same number of digits
+ // before the decimal point, where qCeil() might take us up to a power
+ // of ten, adding a digit.
+ if (convertDoubleTo(qFloor(max), &v)) {
+ qlonglong n = pow10(numDigits(v));
// In order to get the highest possible number in the intermediate
// range we need to get 10 to the power of the number of digits
// after the decimal's and subtract that from the top number.
@@ -717,12 +698,99 @@ QValidator::State QDoubleValidatorPrivate::validateWithLocale(QString &input, QL
return QValidator::Intermediate;
}
-// FIXME: Qt 6: Make QDoubleValidator::setRange() non-virtual
+/*!
+ \since 6.3
+ \overload
+
+ Attempts to fix the \a input string to an \l Acceptable representation of a
+ double.
+
+ The format of the number is determined by \l notation(), \l decimals(),
+ \l locale() and the latter's \l {QLocale::}{numberOptions()}.
+
+ To comply with \l notation(), when \l ScientificNotation is used, the fixed
+ value will be represented in its normalized form, which means that any
+ non-zero value will have one non-zero digit before the decimal point.
+
+ \snippet code/src_gui_util_qvalidator.cpp 7
+
+ To comply with \l decimals(), when it is \c {-1} the number of digits used
+ will be determined by \l QLocale::FloatingPointShortest. Otherwise, the
+ fractional part of the number is truncated (with rounding, as appropriate)
+ if its length exceeds \l decimals(). When \l notation() is
+ \l ScientificNotation this is done after the number has been put into its
+ normalized form.
+
+ \snippet code/src_gui_util_qvalidator.cpp 8
+
+ \note If \l decimals() is set to, and the string provides, more than
+ \c {std::numeric_limits<double>::digits10}, digits beyond that many in the
+ fractional part may be changed. The resulting string shall encode the same
+ floating-point number, when parsed to a \c double.
+*/
+void QDoubleValidator::fixup(QString &input) const
+{
+ Q_D(const QDoubleValidator);
+ const auto numberMode = d->notation == StandardNotation ? QLocaleData::DoubleStandardMode
+ : QLocaleData::DoubleScientificMode;
+
+ d->fixupWithLocale(input, numberMode, locale());
+}
+
+void QDoubleValidatorPrivate::fixupWithLocale(QString &input, QLocaleData::NumberMode numMode,
+ const QLocale &locale) const
+{
+ Q_Q(const QDoubleValidator);
+ // Passing -1 as the number of decimals, because fixup() exists to improve
+ // an Intermediate value, if it can.
+ auto [parseState, buff] =
+ locale.d->m_data->validateChars(input, numMode, -1, locale.numberOptions());
+ if (parseState == ParsingResult::Invalid)
+ return;
+
+ // buff contains data in C locale.
+ bool ok = false;
+ const double entered = QByteArrayView(buff).toDouble(&ok);
+ if (ok) {
+ // Here we need to adjust the output format accordingly
+ char mode;
+ if (numMode == QLocaleData::DoubleStandardMode) {
+ mode = 'f';
+ } else {
+ // scientific mode can be either 'e' or 'E'
+ mode = input.contains(QChar::fromLatin1('E')) ? 'E' : 'e';
+ }
+ int precision;
+ if (q->dec < 0) {
+ precision = QLocale::FloatingPointShortest;
+ } else {
+ if (mode == 'f') {
+ const auto decimalPointIndex = buff.indexOf('.');
+ precision = decimalPointIndex >= 0 ? buff.size() - decimalPointIndex - 1 : 0;
+ } else {
+ auto eIndex = buff.indexOf('e');
+ // No need to check for 'E' because we can get only 'e' after a
+ // call to validateChars()
+ if (eIndex < 0)
+ eIndex = buff.size();
+ precision = eIndex - (buff.contains('.') ? 1 : 0)
+ - (buff[0] == '-' || buff[0] == '+' ? 1 : 0);
+ }
+ // Use q->dec to limit the number of decimals, because we want the
+ // fixup() result to pass validate().
+ precision = qMin(precision, q->dec);
+ }
+ input = locale.toString(entered, mode, precision);
+ }
+}
/*!
Sets the validator to accept doubles from \a minimum to \a maximum
inclusive, with at most \a decimals digits after the decimal
point.
+
+ \note Setting the number of decimals to -1 effectively sets it to unlimited.
+ This is also the value used by a default-constructed validator.
*/
void QDoubleValidator::setRange(double minimum, double maximum, int decimals)
@@ -750,6 +818,17 @@ void QDoubleValidator::setRange(double minimum, double maximum, int decimals)
}
/*!
+ \overload
+
+ Sets the validator to accept doubles from \a minimum to \a maximum
+ inclusive without changing the number of digits after the decimal point.
+*/
+void QDoubleValidator::setRange(double minimum, double maximum)
+{
+ setRange(minimum, maximum, decimals());
+}
+
+/*!
\property QDoubleValidator::bottom
\brief the validator's minimum acceptable value
@@ -782,7 +861,8 @@ void QDoubleValidator::setTop(double top)
\property QDoubleValidator::decimals
\brief the validator's maximum number of digits after the decimal point
- By default, this property contains a value of 1000.
+ By default, this property contains a value of -1, which means any number
+ of digits is accepted.
\sa setRange()
*/
@@ -818,126 +898,11 @@ QDoubleValidator::Notation QDoubleValidator::notation() const
return d->notation;
}
-/*!
- \class QRegExpValidator
- \brief The QRegExpValidator class is used to check a string
- against a regular expression.
- \inmodule QtGui
-
- QRegExpValidator uses a regular expression (regexp) to
- determine whether an input string is \l Acceptable, \l
- Intermediate, or \l Invalid. The regexp can either be supplied
- when the QRegExpValidator is constructed, or at a later time.
-
- When QRegExpValidator determines whether a string is \l Acceptable
- or not, the regexp is treated as if it begins with the start of string
- assertion (\b{^}) and ends with the end of string assertion
- (\b{$}); the match is against the entire input string, or from
- the given position if a start position greater than zero is given.
-
- If a string is a prefix of an \l Acceptable string, it is considered
- \l Intermediate. For example, "" and "A" are \l Intermediate for the
- regexp \b{[A-Z][0-9]} (whereas "_" would be \l Invalid).
-
- For a brief introduction to Qt's regexp engine, see \l QRegExp.
-
- Example of use:
- \snippet code/src_gui_util_qvalidator.cpp 3
-
- Below we present some examples of validators. In practice they would
- normally be associated with a widget as in the example above.
-
- \snippet code/src_gui_util_qvalidator.cpp 4
-
- \sa QRegExp, QIntValidator, QDoubleValidator, {Settings Editor Example}
-*/
-
-/*!
- Constructs a validator with a \a parent object that accepts
- any string (including an empty one) as valid.
-*/
-
-QRegExpValidator::QRegExpValidator(QObject *parent)
- : QRegExpValidator(QRegExp(QString::fromLatin1(".*")), parent)
-{
-}
-
-/*!
- Constructs a validator with a \a parent object that
- accepts all strings that match the regular expression \a rx.
-
- The match is made against the entire string; e.g. if the regexp is
- \b{[A-Fa-f0-9]+} it will be treated as \b{^[A-Fa-f0-9]+$}.
-*/
-
-QRegExpValidator::QRegExpValidator(const QRegExp& rx, QObject *parent)
- : QValidator(parent), r(rx)
-{
-}
-
-
-/*!
- Destroys the validator.
-*/
-
-QRegExpValidator::~QRegExpValidator()
-{
-}
-
-/*!
- Returns \l Acceptable if \a input is matched by the regular
- expression for this validator, \l Intermediate if it has matched
- partially (i.e. could be a valid match if additional valid
- characters are added), and \l Invalid if \a input is not matched.
-
- Additionally, if \a input is not matched, the \a pos parameter is set to
- the length of the \a input parameter.
-
- For example, if the regular expression is \b{\\w\\d\\d}
- (word-character, digit, digit) then "A57" is \l Acceptable,
- "E5" is \l Intermediate, and "+9" is \l Invalid.
-
- \sa QRegExp::exactMatch()
-*/
-
-QValidator::State QRegExpValidator::validate(QString &input, int& pos) const
-{
- QRegExp copy = r;
- if (copy.exactMatch(input)) {
- return Acceptable;
- } else {
- if (copy.matchedLength() == input.size()) {
- return Intermediate;
- } else {
- pos = input.size();
- return Invalid;
- }
- }
-}
-
-/*!
- \property QRegExpValidator::regExp
- \brief the regular expression used for validation
-
- By default, this property contains a regular expression with the pattern \c{.*}
- that matches any string.
-*/
-
-void QRegExpValidator::setRegExp(const QRegExp& rx)
-{
- if (r != rx) {
- r = rx;
- emit regExpChanged(r);
- emit changed();
- }
-}
-
-#endif
-
#if QT_CONFIG(regularexpression)
/*!
\class QRegularExpressionValidator
+ \inmodule QtGui
\brief The QRegularExpressionValidator class is used to check a string
against a regular expression.
@@ -964,7 +929,7 @@ void QRegExpValidator::setRegExp(const QRegExp& rx)
\snippet code/src_gui_util_qvalidator.cpp 6
- \sa QRegularExpression, QIntValidator, QDoubleValidator, QRegExpValidator
+ \sa QRegularExpression, QIntValidator, QDoubleValidator
*/
class QRegularExpressionValidatorPrivate : public QValidatorPrivate
@@ -1089,4 +1054,6 @@ void QRegularExpressionValidatorPrivate::setRegularExpression(const QRegularExpr
QT_END_NAMESPACE
+#include "moc_qvalidator.cpp"
+
#endif // QT_NO_VALIDATOR
diff --git a/src/gui/util/qvalidator.h b/src/gui/util/qvalidator.h
index f0e72e3814..cd757c612d 100644
--- a/src/gui/util/qvalidator.h
+++ b/src/gui/util/qvalidator.h
@@ -1,42 +1,6 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Copyright (C) 2012 Klarälvdalens Datakonsult AB, a KDAB Group company, info@kdab.com, author Giuseppe D'Angelo <giuseppe.dangelo@kdab.com>
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the QtGui module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// Copyright (C) 2012 Klarälvdalens Datakonsult AB, a KDAB Group company, info@kdab.com, author Giuseppe D'Angelo <giuseppe.dangelo@kdab.com>
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#ifndef QVALIDATOR_H
#define QVALIDATOR_H
@@ -44,7 +8,6 @@
#include <QtGui/qtguiglobal.h>
#include <QtCore/qobject.h>
#include <QtCore/qstring.h>
-#include <QtCore/qregexp.h>
#if QT_CONFIG(regularexpression)
# include <QtCore/qregularexpression.h>
#endif
@@ -105,7 +68,7 @@ public:
void setBottom(int);
void setTop(int);
- virtual void setRange(int bottom, int top);
+ void setRange(int bottom, int top);
int bottom() const { return b; }
int top() const { return t; }
@@ -120,8 +83,6 @@ private:
int t;
};
-#ifndef QT_NO_REGEXP
-
class QDoubleValidatorPrivate;
class Q_GUI_EXPORT QDoubleValidator : public QValidator
@@ -143,8 +104,10 @@ public:
};
Q_ENUM(Notation)
QValidator::State validate(QString &, int &) const override;
+ void fixup(QString &input) const override;
- virtual void setRange(double bottom, double top, int decimals = 0);
+ void setRange(double bottom, double top, int decimals);
+ void setRange(double bottom, double top);
void setBottom(double);
void setTop(double);
void setDecimals(int);
@@ -170,33 +133,6 @@ private:
int dec;
};
-
-class Q_GUI_EXPORT QRegExpValidator : public QValidator
-{
- Q_OBJECT
- Q_PROPERTY(QRegExp regExp READ regExp WRITE setRegExp NOTIFY regExpChanged)
-
-public:
- explicit QRegExpValidator(QObject *parent = nullptr);
- explicit QRegExpValidator(const QRegExp& rx, QObject *parent = nullptr);
- ~QRegExpValidator();
-
- virtual QValidator::State validate(QString& input, int& pos) const override;
-
- void setRegExp(const QRegExp& rx);
- const QRegExp& regExp() const { return r; }
-
-Q_SIGNALS:
- void regExpChanged(const QRegExp& regExp);
-
-private:
- Q_DISABLE_COPY(QRegExpValidator)
-
- QRegExp r;
-};
-
-#endif // QT_NO_REGEXP
-
#if QT_CONFIG(regularexpression)
class QRegularExpressionValidatorPrivate;
@@ -211,7 +147,7 @@ public:
explicit QRegularExpressionValidator(const QRegularExpression &re, QObject *parent = nullptr);
~QRegularExpressionValidator();
- virtual QValidator::State validate(QString &input, int &pos) const override;
+ QValidator::State validate(QString &input, int &pos) const override;
QRegularExpression regularExpression() const;
diff --git a/src/gui/util/util.pri b/src/gui/util/util.pri
deleted file mode 100644
index d3402133d6..0000000000
--- a/src/gui/util/util.pri
+++ /dev/null
@@ -1,48 +0,0 @@
-# Qt util module
-
-HEADERS += \
- util/qdesktopservices.h \
- util/qhexstring_p.h \
- util/qvalidator.h \
- util/qgridlayoutengine_p.h \
- util/qabstractlayoutstyleinfo_p.h \
- util/qlayoutpolicy_p.h \
- util/qshaderformat_p.h \
- util/qshadergraph_p.h \
- util/qshadergraphloader_p.h \
- util/qshaderlanguage_p.h \
- util/qshadernode_p.h \
- util/qshadernodeport_p.h \
- util/qshadernodesloader_p.h \
- util/qtexturefiledata_p.h \
- util/qtexturefilereader_p.h \
- util/qtexturefilehandler_p.h \
- util/qpkmhandler_p.h \
- util/qktxhandler_p.h \
- util/qastchandler_p.h
-
-SOURCES += \
- util/qdesktopservices.cpp \
- util/qvalidator.cpp \
- util/qgridlayoutengine.cpp \
- util/qabstractlayoutstyleinfo.cpp \
- util/qlayoutpolicy.cpp \
- util/qshaderformat.cpp \
- util/qshadergraph.cpp \
- util/qshadergraphloader.cpp \
- util/qshaderlanguage.cpp \
- util/qshadernode.cpp \
- util/qshadernodeport.cpp \
- util/qshadernodesloader.cpp \
- util/qtexturefiledata.cpp \
- util/qtexturefilereader.cpp \
- util/qpkmhandler.cpp \
- util/qktxhandler.cpp \
- util/qastchandler.cpp
-
-qtConfig(regularexpression) {
- HEADERS += \
- util/qshadergenerator_p.h
- SOURCES += \
- util/qshadergenerator.cpp
-}
diff --git a/src/gui/vulkan/KHRONOS_LICENSE.txt b/src/gui/vulkan/KHRONOS_LICENSE.txt
deleted file mode 100644
index 7f6672d50e..0000000000
--- a/src/gui/vulkan/KHRONOS_LICENSE.txt
+++ /dev/null
@@ -1,20 +0,0 @@
-Copyright (c) 2015-2017 The Khronos Group Inc.
-
-Permission is hereby granted, free of charge, to any person obtaining a
-copy of this software and/or associated documentation files (the
-"Materials"), to deal in the Materials without restriction, including
-without limitation the rights to use, copy, modify, merge, publish,
-distribute, sublicense, and/or sell copies of the Materials, and to
-permit persons to whom the Materials are furnished to do so, subject to
-the following conditions:
-
-The above copyright notice and this permission notice shall be included
-in all copies or substantial portions of the Materials.
-
-THE MATERIALS ARE PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
-IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
-CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
-TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
-MATERIALS OR THE USE OR OTHER DEALINGS IN THE MATERIALS.
diff --git a/src/gui/vulkan/LICENSE.txt b/src/gui/vulkan/LICENSE.txt
new file mode 100644
index 0000000000..21dd179fc9
--- /dev/null
+++ b/src/gui/vulkan/LICENSE.txt
@@ -0,0 +1,83 @@
+Copyright (c) 2015-2020 The Khronos Group Inc.
+
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the "Software"), to deal
+in the Software without restriction, including without limitation the rights
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the Software is
+furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+THE SOFTWARE.
+
+
+
+Apache License
+Version 2.0, January 2004
+http://www.apache.org/licenses/
+
+TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
+
+ 1. Definitions.
+
+ "License" shall mean the terms and conditions for use, reproduction, and distribution as defined by Sections 1 through 9 of this document.
+
+ "Licensor" shall mean the copyright owner or entity authorized by the copyright owner that is granting the License.
+
+ "Legal Entity" shall mean the union of the acting entity and all other entities that control, are controlled by, or are under common control with that entity. For the purposes of this definition, "control" means (i) the power, direct or indirect, to cause the direction or management of such entity, whether by contract or otherwise, or (ii) ownership of fifty percent (50%) or more of the outstanding shares, or (iii) beneficial ownership of such entity.
+
+ "You" (or "Your") shall mean an individual or Legal Entity exercising permissions granted by this License.
+
+ "Source" form shall mean the preferred form for making modifications, including but not limited to software source code, documentation source, and configuration files.
+
+ "Object" form shall mean any form resulting from mechanical transformation or translation of a Source form, including but not limited to compiled object code, generated documentation, and conversions to other media types.
+
+ "Work" shall mean the work of authorship, whether in Source or Object form, made available under the License, as indicated by a copyright notice that is included in or attached to the work (an example is provided in the Appendix below).
+
+ "Derivative Works" shall mean any work, whether in Source or Object form, that is based on (or derived from) the Work and for which the editorial revisions, annotations, elaborations, or other modifications represent, as a whole, an original work of authorship. For the purposes of this License, Derivative Works shall not include works that remain separable from, or merely link (or bind by name) to the interfaces of, the Work and Derivative Works thereof.
+
+ "Contribution" shall mean any work of authorship, including the original version of the Work and any modifications or additions to that Work or Derivative Works thereof, that is intentionally submitted to Licensor for inclusion in the Work by the copyright owner or by an individual or Legal Entity authorized to submit on behalf of the copyright owner. For the purposes of this definition, "submitted" means any form of electronic, verbal, or written communication sent to the Licensor or its representatives, including but not limited to communication on electronic mailing lists, source code control systems, and issue tracking systems that are managed by, or on behalf of, the Licensor for the purpose of discussing and improving the Work, but excluding communication that is conspicuously marked or otherwise designated in writing by the copyright owner as "Not a Contribution."
+
+ "Contributor" shall mean Licensor and any individual or Legal Entity on behalf of whom a Contribution has been received by Licensor and subsequently incorporated within the Work.
+ 2. Grant of Copyright License. Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable copyright license to reproduce, prepare Derivative Works of, publicly display, publicly perform, sublicense, and distribute the Work and such Derivative Works in Source or Object form.
+ 3. Grant of Patent License. Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable (except as stated in this section) patent license to make, have made, use, offer to sell, sell, import, and otherwise transfer the Work, where such license applies only to those patent claims licensable by such Contributor that are necessarily infringed by their Contribution(s) alone or by combination of their Contribution(s) with the Work to which such Contribution(s) was submitted. If You institute patent litigation against any entity (including a cross-claim or counterclaim in a lawsuit) alleging that the Work or a Contribution incorporated within the Work constitutes direct or contributory patent infringement, then any patent licenses granted to You under this License for that Work shall terminate as of the date such litigation is filed.
+ 4. Redistribution. You may reproduce and distribute copies of the Work or Derivative Works thereof in any medium, with or without modifications, and in Source or Object form, provided that You meet the following conditions:
+ (a) You must give any other recipients of the Work or Derivative Works a copy of this License; and
+ (b) You must cause any modified files to carry prominent notices stating that You changed the files; and
+ (c) You must retain, in the Source form of any Derivative Works that You distribute, all copyright, patent, trademark, and attribution notices from the Source form of the Work, excluding those notices that do not pertain to any part of the Derivative Works; and
+ (d) If the Work includes a "NOTICE" text file as part of its distribution, then any Derivative Works that You distribute must include a readable copy of the attribution notices contained within such NOTICE file, excluding those notices that do not pertain to any part of the Derivative Works, in at least one of the following places: within a NOTICE text file distributed as part of the Derivative Works; within the Source form or documentation, if provided along with the Derivative Works; or, within a display generated by the Derivative Works, if and wherever such third-party notices normally appear. The contents of the NOTICE file are for informational purposes only and do not modify the License. You may add Your own attribution notices within Derivative Works that You distribute, alongside or as an addendum to the NOTICE text from the Work, provided that such additional attribution notices cannot be construed as modifying the License.
+
+ You may add Your own copyright statement to Your modifications and may provide additional or different license terms and conditions for use, reproduction, or distribution of Your modifications, or for any such Derivative Works as a whole, provided Your use, reproduction, and distribution of the Work otherwise complies with the conditions stated in this License.
+ 5. Submission of Contributions. Unless You explicitly state otherwise, any Contribution intentionally submitted for inclusion in the Work by You to the Licensor shall be under the terms and conditions of this License, without any additional terms or conditions. Notwithstanding the above, nothing herein shall supersede or modify the terms of any separate license agreement you may have executed with Licensor regarding such Contributions.
+ 6. Trademarks. This License does not grant permission to use the trade names, trademarks, service marks, or product names of the Licensor, except as required for reasonable and customary use in describing the origin of the Work and reproducing the content of the NOTICE file.
+ 7. Disclaimer of Warranty. Unless required by applicable law or agreed to in writing, Licensor provides the Work (and each Contributor provides its Contributions) on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied, including, without limitation, any warranties or conditions of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A PARTICULAR PURPOSE. You are solely responsible for determining the appropriateness of using or redistributing the Work and assume any risks associated with Your exercise of permissions under this License.
+ 8. Limitation of Liability. In no event and under no legal theory, whether in tort (including negligence), contract, or otherwise, unless required by applicable law (such as deliberate and grossly negligent acts) or agreed to in writing, shall any Contributor be liable to You for damages, including any direct, indirect, special, incidental, or consequential damages of any character arising as a result of this License or out of the use or inability to use the Work (including but not limited to damages for loss of goodwill, work stoppage, computer failure or malfunction, or any and all other commercial damages or losses), even if such Contributor has been advised of the possibility of such damages.
+ 9. Accepting Warranty or Additional Liability. While redistributing the Work or Derivative Works thereof, You may choose to offer, and charge a fee for, acceptance of support, warranty, indemnity, or other liability obligations and/or rights consistent with this License. However, in accepting such obligations, You may act only on Your own behalf and on Your sole responsibility, not on behalf of any other Contributor, and only if You agree to indemnify, defend, and hold each Contributor harmless for any liability incurred by, or claims asserted against, such Contributor by reason of your accepting any such warranty or additional liability.
+
+END OF TERMS AND CONDITIONS
+
+APPENDIX: How to apply the Apache License to your work.
+
+To apply the Apache License to your work, attach the following boilerplate notice, with the fields enclosed by brackets "[]" replaced with your own identifying information. (Don't include the brackets!) The text should be enclosed in the appropriate comment syntax for the file format. We also recommend that a file or class name and description of purpose be included on the same "printed page" as the copyright notice for easier identification within third-party archives.
+
+Copyright [yyyy] [name of copyright owner]
+
+Licensed under the Apache License, Version 2.0 (the "License");
+you may not use this file except in compliance with the License.
+You may obtain a copy of the License at
+
+http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
diff --git a/src/gui/vulkan/licenseheader.h.in b/src/gui/vulkan/licenseheader.h.in
new file mode 100644
index 0000000000..3b6a0ea72a
--- /dev/null
+++ b/src/gui/vulkan/licenseheader.h.in
@@ -0,0 +1,2 @@
+// Copyright (C) 2021 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
diff --git a/src/gui/vulkan/qbasicvulkanplatforminstance.cpp b/src/gui/vulkan/qbasicvulkanplatforminstance.cpp
new file mode 100644
index 0000000000..bbe9f9e1cb
--- /dev/null
+++ b/src/gui/vulkan/qbasicvulkanplatforminstance.cpp
@@ -0,0 +1,460 @@
+// Copyright (C) 2017 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
+
+#include "qbasicvulkanplatforminstance_p.h"
+#include <QCoreApplication>
+#include <QList>
+#include <QLoggingCategory>
+#include <QVarLengthArray>
+
+QT_BEGIN_NAMESPACE
+
+Q_LOGGING_CATEGORY(lcPlatVk, "qt.vulkan")
+
+/*!
+ \class QBasicPlatformVulkanInstance
+ \brief A generic platform Vulkan instance implementation.
+ \since 5.10
+ \internal
+ \ingroup qpa
+
+ Implements QPlatformVulkanInstance, serving as a base for platform-specific
+ implementations. The library loading and any WSI-specifics are excluded.
+
+ Subclasses are expected to call init() from their constructor and
+ initInstance() from their createOrAdoptInstance() implementation.
+ */
+
+QBasicPlatformVulkanInstance::QBasicPlatformVulkanInstance()
+{
+}
+
+QBasicPlatformVulkanInstance::~QBasicPlatformVulkanInstance()
+{
+ if (!m_vkInst)
+ return;
+
+#ifdef VK_EXT_debug_utils
+ if (m_debugMessenger)
+ m_vkDestroyDebugUtilsMessengerEXT(m_vkInst, m_debugMessenger, nullptr);
+#endif
+
+ if (m_ownsVkInst)
+ m_vkDestroyInstance(m_vkInst, nullptr);
+}
+
+void QBasicPlatformVulkanInstance::loadVulkanLibrary(const QString &defaultLibraryName, int defaultLibraryVersion)
+{
+ QVarLengthArray<std::pair<QString, int>, 3> loadList;
+
+ // First in the list of libraries to try is the manual override, relevant on
+ // embedded systems without a Vulkan loader and possibly with custom vendor
+ // library names.
+ if (qEnvironmentVariableIsSet("QT_VULKAN_LIB"))
+ loadList.append({ QString::fromUtf8(qgetenv("QT_VULKAN_LIB")), -1 });
+
+ // Then what the platform specified. On Linux the version is likely 1, thus
+ // preferring libvulkan.so.1 over libvulkan.so.
+ loadList.append({ defaultLibraryName, defaultLibraryVersion });
+
+ // If there was a version given, we must still try without it if the first
+ // attempt fails, so that libvulkan.so is picked up if the .so.1 is not
+ // present on the system (so loaderless embedded systems still work).
+ if (defaultLibraryVersion >= 0)
+ loadList.append({ defaultLibraryName, -1 });
+
+ bool ok = false;
+ for (const auto &lib : loadList) {
+ m_vulkanLib.reset(new QLibrary);
+ if (lib.second >= 0)
+ m_vulkanLib->setFileNameAndVersion(lib.first, lib.second);
+ else
+ m_vulkanLib->setFileName(lib.first);
+ if (m_vulkanLib->load()) {
+ ok = true;
+ break;
+ }
+ }
+
+ if (!ok) {
+ qWarning("Failed to load %s: %s", qPrintable(m_vulkanLib->fileName()), qPrintable(m_vulkanLib->errorString()));
+ return;
+ }
+
+ init(m_vulkanLib.get());
+}
+
+void QBasicPlatformVulkanInstance::init(QLibrary *lib)
+{
+ if (m_vkGetInstanceProcAddr)
+ return;
+
+ qCDebug(lcPlatVk, "Vulkan init (%s)", qPrintable(lib->fileName()));
+
+ // While not strictly required with every implementation, try to follow the spec
+ // and do not rely on core functions being exported.
+ //
+ // 1. dlsym vkGetInstanceProcAddr
+ // 2. with a special null instance resolve vkCreateInstance and vkEnumerateInstance*
+ // 3. all other core functions are resolved with the created instance
+
+ m_vkGetInstanceProcAddr = reinterpret_cast<PFN_vkGetInstanceProcAddr>(lib->resolve("vkGetInstanceProcAddr"));
+ if (!m_vkGetInstanceProcAddr) {
+ qWarning("Failed to find vkGetInstanceProcAddr");
+ return;
+ }
+
+ m_vkCreateInstance = reinterpret_cast<PFN_vkCreateInstance>(m_vkGetInstanceProcAddr(VK_NULL_HANDLE, "vkCreateInstance"));
+ if (!m_vkCreateInstance) {
+ qWarning("Failed to find vkCreateInstance");
+ return;
+ }
+ m_vkEnumerateInstanceLayerProperties = reinterpret_cast<PFN_vkEnumerateInstanceLayerProperties>(
+ m_vkGetInstanceProcAddr(VK_NULL_HANDLE, "vkEnumerateInstanceLayerProperties"));
+ if (!m_vkEnumerateInstanceLayerProperties) {
+ qWarning("Failed to find vkEnumerateInstanceLayerProperties");
+ return;
+ }
+ m_vkEnumerateInstanceExtensionProperties = reinterpret_cast<PFN_vkEnumerateInstanceExtensionProperties>(
+ m_vkGetInstanceProcAddr(VK_NULL_HANDLE, "vkEnumerateInstanceExtensionProperties"));
+ if (!m_vkEnumerateInstanceExtensionProperties) {
+ qWarning("Failed to find vkEnumerateInstanceExtensionProperties");
+ return;
+ }
+
+ // Do not rely on non-1.0 header typedefs here.
+ typedef VkResult (VKAPI_PTR *T_enumerateInstanceVersion)(uint32_t* pApiVersion);
+ // Determine instance-level version as described in the Vulkan 1.2 spec.
+ T_enumerateInstanceVersion enumerateInstanceVersion = reinterpret_cast<T_enumerateInstanceVersion>(
+ m_vkGetInstanceProcAddr(VK_NULL_HANDLE, "vkEnumerateInstanceVersion"));
+ if (enumerateInstanceVersion) {
+ uint32_t ver = 0;
+ if (enumerateInstanceVersion(&ver) == VK_SUCCESS) {
+ m_supportedApiVersion = QVersionNumber(VK_VERSION_MAJOR(ver),
+ VK_VERSION_MINOR(ver),
+ VK_VERSION_PATCH(ver));
+ } else {
+ m_supportedApiVersion = QVersionNumber(1, 0, 0);
+ }
+ } else {
+ // Vulkan 1.0
+ m_supportedApiVersion = QVersionNumber(1, 0, 0);
+ }
+
+ uint32_t layerCount = 0;
+ m_vkEnumerateInstanceLayerProperties(&layerCount, nullptr);
+ if (layerCount) {
+ QList<VkLayerProperties> layerProps(layerCount);
+ m_vkEnumerateInstanceLayerProperties(&layerCount, layerProps.data());
+ m_supportedLayers.reserve(layerCount);
+ for (const VkLayerProperties &p : std::as_const(layerProps)) {
+ QVulkanLayer layer;
+ layer.name = p.layerName;
+ layer.version = p.implementationVersion;
+ layer.specVersion = QVersionNumber(VK_VERSION_MAJOR(p.specVersion),
+ VK_VERSION_MINOR(p.specVersion),
+ VK_VERSION_PATCH(p.specVersion));
+ layer.description = p.description;
+ m_supportedLayers.append(layer);
+ }
+ }
+ qCDebug(lcPlatVk) << "Supported Vulkan instance layers:" << m_supportedLayers;
+
+ uint32_t extCount = 0;
+ m_vkEnumerateInstanceExtensionProperties(nullptr, &extCount, nullptr);
+ if (extCount) {
+ QList<VkExtensionProperties> extProps(extCount);
+ m_vkEnumerateInstanceExtensionProperties(nullptr, &extCount, extProps.data());
+ m_supportedExtensions.reserve(extCount);
+ for (const VkExtensionProperties &p : std::as_const(extProps)) {
+ QVulkanExtension ext;
+ ext.name = p.extensionName;
+ ext.version = p.specVersion;
+ m_supportedExtensions.append(ext);
+ }
+ }
+ qDebug(lcPlatVk) << "Supported Vulkan instance extensions:" << m_supportedExtensions;
+}
+
+QVulkanInfoVector<QVulkanLayer> QBasicPlatformVulkanInstance::supportedLayers() const
+{
+ return m_supportedLayers;
+}
+
+QVulkanInfoVector<QVulkanExtension> QBasicPlatformVulkanInstance::supportedExtensions() const
+{
+ return m_supportedExtensions;
+}
+
+QVersionNumber QBasicPlatformVulkanInstance::supportedApiVersion() const
+{
+ return m_supportedApiVersion;
+}
+
+void QBasicPlatformVulkanInstance::initInstance(QVulkanInstance *instance, const QByteArrayList &extraExts)
+{
+ if (!m_vkGetInstanceProcAddr) {
+ qWarning("initInstance: No Vulkan library available");
+ return;
+ }
+
+ m_vkInst = instance->vkInstance(); // when non-null we are adopting an existing instance
+
+ QVulkanInstance::Flags flags = instance->flags();
+ m_enabledLayers = instance->layers();
+ m_enabledExtensions = instance->extensions();
+
+ if (!m_vkInst) {
+ VkApplicationInfo appInfo = {};
+ appInfo.sType = VK_STRUCTURE_TYPE_APPLICATION_INFO;
+ QByteArray appName = QCoreApplication::applicationName().toUtf8();
+ appInfo.pApplicationName = appName.constData();
+ const QVersionNumber apiVersion = instance->apiVersion();
+ if (!apiVersion.isNull()) {
+ appInfo.apiVersion = VK_MAKE_VERSION(apiVersion.majorVersion(),
+ apiVersion.minorVersion(),
+ apiVersion.microVersion());
+ }
+
+ m_enabledExtensions.append("VK_KHR_surface");
+ if (!flags.testFlag(QVulkanInstance::NoPortabilityDrivers))
+ m_enabledExtensions.append("VK_KHR_portability_enumeration");
+ if (!flags.testFlag(QVulkanInstance::NoDebugOutputRedirect))
+ m_enabledExtensions.append("VK_EXT_debug_utils");
+
+ for (const QByteArray &ext : extraExts)
+ m_enabledExtensions.append(ext);
+
+ QByteArray envExts = qgetenv("QT_VULKAN_INSTANCE_EXTENSIONS");
+ if (!envExts.isEmpty()) {
+ QByteArrayList envExtList = envExts.split(';');
+ for (auto ext : m_enabledExtensions)
+ envExtList.removeAll(ext);
+ m_enabledExtensions.append(envExtList);
+ }
+
+ QByteArray envLayers = qgetenv("QT_VULKAN_INSTANCE_LAYERS");
+ if (!envLayers.isEmpty()) {
+ QByteArrayList envLayerList = envLayers.split(';');
+ for (auto ext : m_enabledLayers)
+ envLayerList.removeAll(ext);
+ m_enabledLayers.append(envLayerList);
+ }
+
+ // No clever stuff with QSet and friends: the order for layers matters
+ // and the user-provided order must be kept.
+ for (int i = 0; i < m_enabledLayers.size(); ++i) {
+ const QByteArray &layerName(m_enabledLayers[i]);
+ if (!m_supportedLayers.contains(layerName))
+ m_enabledLayers.removeAt(i--);
+ }
+ qDebug(lcPlatVk) << "Enabling Vulkan instance layers:" << m_enabledLayers;
+ for (int i = 0; i < m_enabledExtensions.size(); ++i) {
+ const QByteArray &extName(m_enabledExtensions[i]);
+ if (!m_supportedExtensions.contains(extName))
+ m_enabledExtensions.removeAt(i--);
+ }
+ qDebug(lcPlatVk) << "Enabling Vulkan instance extensions:" << m_enabledExtensions;
+
+ VkInstanceCreateInfo instInfo = {};
+ instInfo.sType = VK_STRUCTURE_TYPE_INSTANCE_CREATE_INFO;
+ instInfo.pApplicationInfo = &appInfo;
+ if (!flags.testFlag(QVulkanInstance::NoPortabilityDrivers)) {
+ // With old Vulkan SDKs setting a non-zero flags gives a validation error.
+ // Whereas from 1.3.216 on the portability bit is required for MoltenVK to function.
+ // Hence the version check.
+ if (m_supportedApiVersion >= QVersionNumber(1, 3, 216))
+ instInfo.flags |= 0x00000001; // VK_INSTANCE_CREATE_ENUMERATE_PORTABILITY_BIT_KHR
+ }
+
+ QList<const char *> layerNameVec;
+ for (const QByteArray &ba : std::as_const(m_enabledLayers))
+ layerNameVec.append(ba.constData());
+ if (!layerNameVec.isEmpty()) {
+ instInfo.enabledLayerCount = layerNameVec.size();
+ instInfo.ppEnabledLayerNames = layerNameVec.constData();
+ }
+
+ QList<const char *> extNameVec;
+ for (const QByteArray &ba : std::as_const(m_enabledExtensions))
+ extNameVec.append(ba.constData());
+ if (!extNameVec.isEmpty()) {
+ instInfo.enabledExtensionCount = extNameVec.size();
+ instInfo.ppEnabledExtensionNames = extNameVec.constData();
+ }
+
+ m_errorCode = m_vkCreateInstance(&instInfo, nullptr, &m_vkInst);
+ if (m_errorCode != VK_SUCCESS || !m_vkInst) {
+ qWarning("Failed to create Vulkan instance: %d", m_errorCode);
+ return;
+ }
+
+ m_vkDestroyInstance = reinterpret_cast<PFN_vkDestroyInstance>(m_vkGetInstanceProcAddr(m_vkInst, "vkDestroyInstance"));
+ if (!m_vkDestroyInstance) {
+ qWarning("Failed to find vkDestroyInstance");
+ m_vkInst = VK_NULL_HANDLE;
+ return;
+ }
+
+ m_ownsVkInst = true;
+ }
+
+ m_getPhysDevSurfaceSupport = reinterpret_cast<PFN_vkGetPhysicalDeviceSurfaceSupportKHR>(
+ m_vkGetInstanceProcAddr(m_vkInst, "vkGetPhysicalDeviceSurfaceSupportKHR"));
+ if (!m_getPhysDevSurfaceSupport)
+ qWarning("Failed to find vkGetPhysicalDeviceSurfaceSupportKHR");
+
+ m_destroySurface = reinterpret_cast<PFN_vkDestroySurfaceKHR>(
+ m_vkGetInstanceProcAddr(m_vkInst, "vkDestroySurfaceKHR"));
+ if (!m_destroySurface)
+ qWarning("Failed to find vkDestroySurfaceKHR");
+
+ if (!flags.testFlag(QVulkanInstance::NoDebugOutputRedirect))
+ setupDebugOutput();
+}
+
+bool QBasicPlatformVulkanInstance::isValid() const
+{
+ return m_vkInst != VK_NULL_HANDLE;
+}
+
+VkResult QBasicPlatformVulkanInstance::errorCode() const
+{
+ return m_errorCode;
+}
+
+VkInstance QBasicPlatformVulkanInstance::vkInstance() const
+{
+ return m_vkInst;
+}
+
+QByteArrayList QBasicPlatformVulkanInstance::enabledLayers() const
+{
+ return m_enabledLayers;
+}
+
+QByteArrayList QBasicPlatformVulkanInstance::enabledExtensions() const
+{
+ return m_enabledExtensions;
+}
+
+PFN_vkVoidFunction QBasicPlatformVulkanInstance::getInstanceProcAddr(const char *name)
+{
+ if (!name)
+ return nullptr;
+
+ const bool needsNullInstance = !strcmp(name, "vkEnumerateInstanceLayerProperties")
+ || !strcmp(name, "vkEnumerateInstanceExtensionProperties");
+
+ return m_vkGetInstanceProcAddr(needsNullInstance ? 0 : m_vkInst, name);
+}
+
+bool QBasicPlatformVulkanInstance::supportsPresent(VkPhysicalDevice physicalDevice,
+ uint32_t queueFamilyIndex,
+ QWindow *window)
+{
+ if (!m_getPhysDevSurfaceSupport)
+ return true;
+
+ VkSurfaceKHR surface = QVulkanInstance::surfaceForWindow(window);
+ VkBool32 supported = false;
+ m_getPhysDevSurfaceSupport(physicalDevice, queueFamilyIndex, surface, &supported);
+
+ return supported;
+}
+
+void QBasicPlatformVulkanInstance::setDebugFilters(const QList<QVulkanInstance::DebugFilter> &filters)
+{
+ m_debugFilters = filters;
+}
+
+void QBasicPlatformVulkanInstance::setDebugUtilsFilters(const QList<QVulkanInstance::DebugUtilsFilter> &filters)
+{
+ m_debugUtilsFilters = filters;
+}
+
+void QBasicPlatformVulkanInstance::destroySurface(VkSurfaceKHR surface) const
+{
+ if (m_destroySurface && surface)
+ m_destroySurface(m_vkInst, surface, nullptr);
+}
+
+#ifdef VK_EXT_debug_utils
+static VKAPI_ATTR VkBool32 VKAPI_CALL defaultDebugCallbackFunc(VkDebugUtilsMessageSeverityFlagBitsEXT messageSeverity,
+ VkDebugUtilsMessageTypeFlagsEXT messageType,
+ const VkDebugUtilsMessengerCallbackDataEXT *pCallbackData,
+ void *pUserData)
+{
+ QBasicPlatformVulkanInstance *self = static_cast<QBasicPlatformVulkanInstance *>(pUserData);
+
+ // legacy filters
+ for (QVulkanInstance::DebugFilter filter : *self->debugFilters()) {
+ // As per docs in qvulkaninstance.cpp we pass object, messageCode,
+ // pMessage to the callback with the legacy signature.
+ uint64_t object = 0;
+ if (pCallbackData->objectCount > 0)
+ object = pCallbackData->pObjects[0].objectHandle;
+ if (filter(0, VK_DEBUG_REPORT_OBJECT_TYPE_UNKNOWN_EXT, object, 0,
+ pCallbackData->messageIdNumber, "", pCallbackData->pMessage))
+ {
+ return VK_FALSE;
+ }
+ }
+
+ // filters with new signature
+ for (QVulkanInstance::DebugUtilsFilter filter : *self->debugUtilsFilters()) {
+ QVulkanInstance::DebugMessageSeverityFlags severity;
+ if (messageSeverity & VK_DEBUG_UTILS_MESSAGE_SEVERITY_VERBOSE_BIT_EXT)
+ severity |= QVulkanInstance::VerboseSeverity;
+ if (messageSeverity & VK_DEBUG_UTILS_MESSAGE_SEVERITY_INFO_BIT_EXT)
+ severity |= QVulkanInstance::InfoSeverity;
+ if (messageSeverity & VK_DEBUG_UTILS_MESSAGE_SEVERITY_WARNING_BIT_EXT)
+ severity |= QVulkanInstance::WarningSeverity;
+ if (messageSeverity & VK_DEBUG_UTILS_MESSAGE_SEVERITY_ERROR_BIT_EXT)
+ severity |= QVulkanInstance::ErrorSeverity;
+ QVulkanInstance::DebugMessageTypeFlags type;
+ if (messageType & VK_DEBUG_UTILS_MESSAGE_TYPE_GENERAL_BIT_EXT)
+ type |= QVulkanInstance::GeneralMessage;
+ if (messageType & VK_DEBUG_UTILS_MESSAGE_TYPE_VALIDATION_BIT_EXT)
+ type |= QVulkanInstance::ValidationMessage;
+ if (messageType & VK_DEBUG_UTILS_MESSAGE_TYPE_PERFORMANCE_BIT_EXT)
+ type |= QVulkanInstance::PerformanceMessage;
+ if (filter(severity, type, pCallbackData))
+ return VK_FALSE;
+ }
+
+ // not categorized, just route to plain old qDebug
+ qDebug("vkDebug: %s", pCallbackData->pMessage);
+
+ return VK_FALSE;
+}
+#endif
+
+void QBasicPlatformVulkanInstance::setupDebugOutput()
+{
+#ifdef VK_EXT_debug_utils
+ if (!m_enabledExtensions.contains("VK_EXT_debug_utils"))
+ return;
+
+ PFN_vkCreateDebugUtilsMessengerEXT vkCreateDebugUtilsMessengerEXT = reinterpret_cast<PFN_vkCreateDebugUtilsMessengerEXT>(
+ m_vkGetInstanceProcAddr(m_vkInst, "vkCreateDebugUtilsMessengerEXT"));
+
+ m_vkDestroyDebugUtilsMessengerEXT = reinterpret_cast<PFN_vkDestroyDebugUtilsMessengerEXT>(
+ m_vkGetInstanceProcAddr(m_vkInst, "vkDestroyDebugUtilsMessengerEXT"));
+
+ VkDebugUtilsMessengerCreateInfoEXT messengerInfo = {};
+ messengerInfo.sType = VK_STRUCTURE_TYPE_DEBUG_UTILS_MESSENGER_CREATE_INFO_EXT;
+ messengerInfo.messageSeverity = VK_DEBUG_UTILS_MESSAGE_SEVERITY_WARNING_BIT_EXT
+ | VK_DEBUG_UTILS_MESSAGE_SEVERITY_ERROR_BIT_EXT;
+ messengerInfo.messageType = VK_DEBUG_UTILS_MESSAGE_TYPE_GENERAL_BIT_EXT
+ | VK_DEBUG_UTILS_MESSAGE_TYPE_VALIDATION_BIT_EXT
+ | VK_DEBUG_UTILS_MESSAGE_TYPE_PERFORMANCE_BIT_EXT;
+ messengerInfo.pfnUserCallback = defaultDebugCallbackFunc;
+ messengerInfo.pUserData = this;
+ VkResult err = vkCreateDebugUtilsMessengerEXT(m_vkInst, &messengerInfo, nullptr, &m_debugMessenger);
+ if (err != VK_SUCCESS)
+ qWarning("Failed to create debug report callback: %d", err);
+#endif
+}
+
+QT_END_NAMESPACE
diff --git a/src/gui/vulkan/qbasicvulkanplatforminstance_p.h b/src/gui/vulkan/qbasicvulkanplatforminstance_p.h
new file mode 100644
index 0000000000..dfa5003f16
--- /dev/null
+++ b/src/gui/vulkan/qbasicvulkanplatforminstance_p.h
@@ -0,0 +1,88 @@
+// Copyright (C) 2021 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
+
+#ifndef QBASICVULKANPLATFORMINSTANCE_P_H
+#define QBASICVULKANPLATFORMINSTANCE_P_H
+
+//
+// W A R N I N G
+// -------------
+//
+// This file is not part of the Qt API. It exists purely as an
+// implementation detail. This header file may change from version to
+// version without notice, or even be removed.
+//
+// We mean it.
+//
+
+#include <QtGui/qtguiglobal.h>
+
+#include <QtCore/QLibrary>
+#include <qpa/qplatformvulkaninstance.h>
+#include <private/qglobal_p.h>
+
+QT_BEGIN_NAMESPACE
+
+class Q_GUI_EXPORT QBasicPlatformVulkanInstance : public QPlatformVulkanInstance
+{
+public:
+ QBasicPlatformVulkanInstance();
+ ~QBasicPlatformVulkanInstance();
+
+ QVulkanInfoVector<QVulkanLayer> supportedLayers() const override;
+ QVulkanInfoVector<QVulkanExtension> supportedExtensions() const override;
+ QVersionNumber supportedApiVersion() const override;
+ bool isValid() const override;
+ VkResult errorCode() const override;
+ VkInstance vkInstance() const override;
+ QByteArrayList enabledLayers() const override;
+ QByteArrayList enabledExtensions() const override;
+ PFN_vkVoidFunction getInstanceProcAddr(const char *name) override;
+ bool supportsPresent(VkPhysicalDevice physicalDevice, uint32_t queueFamilyIndex, QWindow *window) override;
+ void setDebugFilters(const QList<QVulkanInstance::DebugFilter> &filters) override;
+ void setDebugUtilsFilters(const QList<QVulkanInstance::DebugUtilsFilter> &filters) override;
+
+ void destroySurface(VkSurfaceKHR surface) const;
+ const QList<QVulkanInstance::DebugFilter> *debugFilters() const { return &m_debugFilters; }
+ const QList<QVulkanInstance::DebugUtilsFilter> *debugUtilsFilters() const { return &m_debugUtilsFilters; }
+
+protected:
+ void loadVulkanLibrary(const QString &defaultLibraryName, int defaultLibraryVersion = -1);
+ void init(QLibrary *lib);
+ void initInstance(QVulkanInstance *instance, const QByteArrayList &extraExts);
+
+ VkInstance m_vkInst = VK_NULL_HANDLE;
+ PFN_vkGetInstanceProcAddr m_vkGetInstanceProcAddr = nullptr;
+ PFN_vkGetPhysicalDeviceSurfaceSupportKHR m_getPhysDevSurfaceSupport;
+ PFN_vkDestroySurfaceKHR m_destroySurface;
+
+private:
+ void setupDebugOutput();
+
+ std::unique_ptr<QLibrary> m_vulkanLib;
+
+ bool m_ownsVkInst = false;
+ VkResult m_errorCode = VK_SUCCESS;
+ QVulkanInfoVector<QVulkanLayer> m_supportedLayers;
+ QVulkanInfoVector<QVulkanExtension> m_supportedExtensions;
+ QVersionNumber m_supportedApiVersion;
+ QByteArrayList m_enabledLayers;
+ QByteArrayList m_enabledExtensions;
+
+ PFN_vkCreateInstance m_vkCreateInstance;
+ PFN_vkEnumerateInstanceLayerProperties m_vkEnumerateInstanceLayerProperties;
+ PFN_vkEnumerateInstanceExtensionProperties m_vkEnumerateInstanceExtensionProperties;
+
+ PFN_vkDestroyInstance m_vkDestroyInstance;
+
+#ifdef VK_EXT_debug_utils
+ VkDebugUtilsMessengerEXT m_debugMessenger = VK_NULL_HANDLE;
+ PFN_vkDestroyDebugUtilsMessengerEXT m_vkDestroyDebugUtilsMessengerEXT;
+#endif
+ QList<QVulkanInstance::DebugFilter> m_debugFilters;
+ QList<QVulkanInstance::DebugUtilsFilter> m_debugUtilsFilters;
+};
+
+QT_END_NAMESPACE
+
+#endif // QBASICVULKANPLATFORMINSTANCE_P_H
diff --git a/src/gui/vulkan/qplatformvulkaninstance.cpp b/src/gui/vulkan/qplatformvulkaninstance.cpp
index 1b5d3370f0..2685a5c6f8 100644
--- a/src/gui/vulkan/qplatformvulkaninstance.cpp
+++ b/src/gui/vulkan/qplatformvulkaninstance.cpp
@@ -1,41 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2017 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the QtGui module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2017 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#include "qplatformvulkaninstance.h"
@@ -90,9 +54,25 @@ void QPlatformVulkanInstance::presentQueued(QWindow *window)
Q_UNUSED(window);
}
-void QPlatformVulkanInstance::setDebugFilters(const QVector<QVulkanInstance::DebugFilter> &filters)
+void QPlatformVulkanInstance::setDebugFilters(const QList<QVulkanInstance::DebugFilter> &filters)
{
Q_UNUSED(filters);
}
+void QPlatformVulkanInstance::setDebugUtilsFilters(const QList<QVulkanInstance::DebugUtilsFilter> &filters)
+{
+ Q_UNUSED(filters);
+}
+
+void QPlatformVulkanInstance::beginFrame(QWindow *window)
+{
+ Q_UNUSED(window);
+}
+
+void QPlatformVulkanInstance::endFrame(QWindow *window)
+{
+ Q_UNUSED(window);
+}
+
+
QT_END_NAMESPACE
diff --git a/src/gui/vulkan/qplatformvulkaninstance.h b/src/gui/vulkan/qplatformvulkaninstance.h
index f96f1720fb..d34cb77d1b 100644
--- a/src/gui/vulkan/qplatformvulkaninstance.h
+++ b/src/gui/vulkan/qplatformvulkaninstance.h
@@ -1,41 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2017 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the QtGui module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2017 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#ifndef QPLATFORMVULKANINSTANCE_H
#define QPLATFORMVULKANINSTANCE_H
@@ -51,7 +15,7 @@
#include <QtGui/qtguiglobal.h>
-#if QT_CONFIG(vulkan) || defined(Q_CLANG_QDOC)
+#if QT_CONFIG(vulkan) || defined(Q_QDOC)
#include <qvulkaninstance.h>
@@ -69,6 +33,7 @@ public:
virtual QVulkanInfoVector<QVulkanLayer> supportedLayers() const = 0;
virtual QVulkanInfoVector<QVulkanExtension> supportedExtensions() const = 0;
+ virtual QVersionNumber supportedApiVersion() const = 0;
virtual void createOrAdoptInstance() = 0;
virtual bool isValid() const = 0;
virtual VkResult errorCode() const = 0;
@@ -79,7 +44,10 @@ public:
virtual bool supportsPresent(VkPhysicalDevice physicalDevice, uint32_t queueFamilyIndex, QWindow *window) = 0;
virtual void presentAboutToBeQueued(QWindow *window);
virtual void presentQueued(QWindow *window);
- virtual void setDebugFilters(const QVector<QVulkanInstance::DebugFilter> &filters);
+ virtual void setDebugFilters(const QList<QVulkanInstance::DebugFilter> &filters);
+ virtual void setDebugUtilsFilters(const QList<QVulkanInstance::DebugUtilsFilter> &filters);
+ virtual void beginFrame(QWindow *window);
+ virtual void endFrame(QWindow *window);
private:
QScopedPointer<QPlatformVulkanInstancePrivate> d_ptr;
@@ -90,7 +58,7 @@ QT_END_NAMESPACE
#endif // QT_CONFIG(vulkan)
-#if defined(Q_CLANG_QDOC)
+#if defined(Q_QDOC)
/*
The following include file did not exist for clang-qdoc running
in macOS, but the classes are documented in qvulkanfunctions.cpp.
@@ -104,7 +72,7 @@ QT_END_NAMESPACE
#include <QtGui/qtguiglobal.h>
-#if QT_CONFIG(vulkan) || defined(Q_CLANG_QDOC)
+#if QT_CONFIG(vulkan) || defined(Q_QDOC)
#ifndef VK_NO_PROTOTYPES
#define VK_NO_PROTOTYPES
@@ -147,8 +115,8 @@ private:
QT_END_NAMESPACE
-#endif // QT_CONFIG(vulkan) || defined(Q_CLANG_QDOC)
+#endif // QT_CONFIG(vulkan) || defined(Q_QDOC)
#endif // QVULKANFUNCTIONS_H;
-#endif // Q_CLANG_QDOC
+#endif // Q_QDOC
#endif // QPLATFORMVULKANINSTANCE_H
diff --git a/src/gui/vulkan/qt_attribution.json b/src/gui/vulkan/qt_attribution.json
index 3c09e9f498..b49e59954d 100644
--- a/src/gui/vulkan/qt_attribution.json
+++ b/src/gui/vulkan/qt_attribution.json
@@ -5,13 +5,13 @@
"QDocModule": "qtgui",
"Description": "Vulkan XML API Registry.",
"QtUsage": "Used to dynamically generate the sources for the QVulkan(Device)Functions classes.",
- "Path": "vk.xml",
+ "Files": "vk.xml",
"Homepage": "https://www.khronos.org/",
- "Version": "1.0.39",
- "License": "MIT License",
- "LicenseId": "MIT",
- "LicenseFile": "KHRONOS_LICENSE.txt",
- "Copyright": "Copyright (c) 2015-2017 The Khronos Group Inc."
+ "Version": "1.3.223",
+ "License": "Apache License 2.0 or MIT License",
+ "LicenseId": "Apache-2.0 OR MIT",
+ "LicenseFile": "LICENSE.txt",
+ "Copyright": "Copyright (c) 2015-2022 The Khronos Group Inc."
}
]
diff --git a/src/gui/vulkan/qvulkandefaultinstance.cpp b/src/gui/vulkan/qvulkandefaultinstance.cpp
new file mode 100644
index 0000000000..b4f343cf17
--- /dev/null
+++ b/src/gui/vulkan/qvulkandefaultinstance.cpp
@@ -0,0 +1,85 @@
+// Copyright (C) 2022 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
+
+#include "qvulkandefaultinstance_p.h"
+#include <rhi/qrhi.h>
+#include <QLoggingCategory>
+
+QT_BEGIN_NAMESPACE
+
+Q_LOGGING_CATEGORY(lcGuiVk, "qt.vulkan")
+
+static QVulkanInstance *s_vulkanInstance;
+Q_CONSTINIT static QVulkanDefaultInstance::Flags s_vulkanInstanceFlags;
+
+QVulkanDefaultInstance::Flags QVulkanDefaultInstance::flags()
+{
+ return s_vulkanInstanceFlags;
+}
+
+// As always, calling this when hasInstance() is already true has no effect. (unless cleanup() is called)
+void QVulkanDefaultInstance::setFlag(Flag flag, bool on)
+{
+ s_vulkanInstanceFlags.setFlag(flag, on);
+}
+
+bool QVulkanDefaultInstance::hasInstance()
+{
+ return s_vulkanInstance != nullptr;
+}
+
+QVulkanInstance *QVulkanDefaultInstance::instance()
+{
+ if (s_vulkanInstance)
+ return s_vulkanInstance;
+
+ s_vulkanInstance = new QVulkanInstance;
+
+ // With a Vulkan implementation >= 1.1 we can check what
+ // vkEnumerateInstanceVersion() says and request 1.3/1.2/1.1 based on the
+ // result. To prevent future surprises, be conservative and ignore any > 1.3
+ // versions for now. For 1.0 implementations nothing will be requested, the
+ // default 0 in VkApplicationInfo means 1.0.
+ //
+ // Vulkan 1.0 is actually sufficient for 99% of Qt Quick (3D)'s
+ // functionality. In addition, Vulkan implementations tend to enable 1.1+
+ // functionality regardless of the VkInstance API request. However, the
+ // validation layer seems to take this fairly seriously, so we should be
+ // prepared for using 1.1+ features in a fully correct manner. This also
+ // helps custom Vulkan code in applications, which is not under out
+ // control; it is ideal if Vulkan 1.1+ versions are usable without
+ // requiring such applications to create their own QVulkanInstance just to
+ // be able to make an appropriate setApiVersion() call on it.
+
+ const QVersionNumber supportedVersion = s_vulkanInstance->supportedApiVersion();
+ if (supportedVersion >= QVersionNumber(1, 3))
+ s_vulkanInstance->setApiVersion(QVersionNumber(1, 3));
+ else if (supportedVersion >= QVersionNumber(1, 2))
+ s_vulkanInstance->setApiVersion(QVersionNumber(1, 2));
+ else if (supportedVersion >= QVersionNumber(1, 1))
+ s_vulkanInstance->setApiVersion(QVersionNumber(1, 1));
+ qCDebug(lcGuiVk) << "QVulkanDefaultInstance: Creating Vulkan instance"
+ << "Requesting Vulkan API" << s_vulkanInstance->apiVersion()
+ << "Instance-level version was reported as" << supportedVersion;
+
+ if (s_vulkanInstanceFlags.testFlag(EnableValidation))
+ s_vulkanInstance->setLayers({ "VK_LAYER_KHRONOS_validation" });
+
+ s_vulkanInstance->setExtensions(QRhiVulkanInitParams::preferredInstanceExtensions());
+
+ if (!s_vulkanInstance->create()) {
+ qWarning("QVulkanDefaultInstance: Failed to create Vulkan instance");
+ delete s_vulkanInstance;
+ s_vulkanInstance = nullptr;
+ }
+
+ return s_vulkanInstance;
+}
+
+void QVulkanDefaultInstance::cleanup()
+{
+ delete s_vulkanInstance;
+ s_vulkanInstance = nullptr;
+}
+
+QT_END_NAMESPACE
diff --git a/src/gui/vulkan/qvulkandefaultinstance_p.h b/src/gui/vulkan/qvulkandefaultinstance_p.h
new file mode 100644
index 0000000000..8550f63d6c
--- /dev/null
+++ b/src/gui/vulkan/qvulkandefaultinstance_p.h
@@ -0,0 +1,46 @@
+// Copyright (C) 2022 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
+
+#ifndef QVULKANDEFAULTINSTANCE_P_H
+#define QVULKANDEFAULTINSTANCE_P_H
+
+//
+// W A R N I N G
+// -------------
+//
+// This file is not part of the Qt API. It exists for the convenience
+// of a number of Qt sources files. This header file may change from
+// version to version without notice, or even be removed.
+//
+// We mean it.
+//
+
+#include <QtGui/private/qtguiglobal_p.h>
+
+#if QT_CONFIG(vulkan)
+
+#include <QtGui/qvulkaninstance.h>
+
+QT_BEGIN_NAMESPACE
+
+struct Q_GUI_EXPORT QVulkanDefaultInstance
+{
+ enum Flag {
+ EnableValidation = 0x01
+ };
+ Q_DECLARE_FLAGS(Flags, Flag)
+
+ static Flags flags();
+ static void setFlag(Flag flag, bool on = true);
+ static bool hasInstance();
+ static QVulkanInstance *instance();
+ static void cleanup();
+};
+
+Q_DECLARE_OPERATORS_FOR_FLAGS(QVulkanDefaultInstance::Flags)
+
+QT_END_NAMESPACE
+
+#endif // QT_CONFIG(vulkan)
+
+#endif
diff --git a/src/gui/vulkan/qvulkanfunctions.cpp b/src/gui/vulkan/qvulkanfunctions.cpp
index 73dbeb9ab6..6a30799502 100644
--- a/src/gui/vulkan/qvulkanfunctions.cpp
+++ b/src/gui/vulkan/qvulkanfunctions.cpp
@@ -1,41 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2017 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the QtGui module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2017 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#include <private/qvulkanfunctions_p.h>
@@ -49,7 +13,7 @@ QT_BEGIN_NAMESPACE
\wrapper
\brief The QVulkanFunctions class provides cross-platform access to the
- instance level core Vulkan 1.0 API.
+ instance level core Vulkan 1.3 API.
Qt and Qt applications do not link to any Vulkan libraries by default.
Instead, all functions are resolved dynamically at run time. Each
@@ -81,6 +45,18 @@ QT_BEGIN_NAMESPACE
\l{https://www.khronos.org/registry/vulkan/specs/1.0/man/html/vkGetInstanceProcAddr.html}{the
man page for vkGetInstanceProcAddr} for more information.
+ \note The member function prototypes for Vulkan 1.1, 1.2, and 1.3 commands
+ are \c ifdefed with the appropriate \c{VK_VERSION_1_x} that is defined by
+ the Vulkan headers. As such, these functions will only be callable by an
+ application when the system's (on which the application is built) Vulkan
+ header is new enough and it contains 1.1, 1.2, or 1.3 Vulkan API
+ definitions. When building Qt from source, this has an additional
+ consequence: the Vulkan headers on the build environment must also be 1.1,
+ 1.2, and 1.3 compatible to get a Qt build that supports resolving
+ the 1.1, 1.2, and 1.3 API commands. If neither of these conditions is met,
+ applications will only be able to call the Vulkan 1.0 commands through
+ QVulkanFunctions and QVulkanDeviceFunctions.
+
\sa QVulkanInstance, QVulkanDeviceFunctions, QWindow::setVulkanInstance(), QWindow::setSurfaceType()
*/
@@ -92,7 +68,7 @@ QT_BEGIN_NAMESPACE
\wrapper
\brief The QVulkanDeviceFunctions class provides cross-platform access to
- the device level core Vulkan 1.0 API.
+ the device level core Vulkan 1.3 API.
Qt and Qt applications do not link to any Vulkan libraries by default.
Instead, all functions are resolved dynamically at run time. Each
diff --git a/src/gui/vulkan/qvulkaninstance.cpp b/src/gui/vulkan/qvulkaninstance.cpp
index 4b961a6f20..6d3020d62d 100644
--- a/src/gui/vulkan/qvulkaninstance.cpp
+++ b/src/gui/vulkan/qvulkaninstance.cpp
@@ -1,44 +1,7 @@
-/****************************************************************************
-**
-** Copyright (C) 2017 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the QtGui module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "qvulkaninstance.h"
-#include <private/qvulkanfunctions_p.h>
+// Copyright (C) 2017 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
+
+#include "qvulkaninstance_p.h"
#include <qpa/qplatformvulkaninstance.h>
#include <qpa/qplatformintegration.h>
#include <qpa/qplatformnativeinterface.h>
@@ -49,6 +12,7 @@ QT_BEGIN_NAMESPACE
/*!
\class QVulkanInstance
\since 5.10
+ \ingroup painting-3D
\inmodule QtGui
\brief The QVulkanInstance class represents a native Vulkan instance, enabling
@@ -141,7 +105,7 @@ QT_BEGIN_NAMESPACE
\note It is up to the component creating the external instance to ensure
the necessary extensions are enabled on it. These are: \c{VK_KHR_surface},
the WSI-specific \c{VK_KHR_*_surface} that is appropriate for the platform
- in question, and \c{VK_EXT_debug_report} in case QVulkanInstance's debug
+ in question, and \c{VK_EXT_debug_utils} in case QVulkanInstance's debug
output redirection is desired.
\section1 Accessing Core Vulkan Commands
@@ -154,9 +118,9 @@ QT_BEGIN_NAMESPACE
\note QVulkanFunctions and QVulkanDeviceFunctions are generated from the
Vulkan API XML specifications when building the Qt libraries. Therefore no
- documentation is provided for them. They contain the Vulkan 1.0 functions
+ documentation is provided for them. They contain the Vulkan 1.2 functions
with the same signatures as described in the
- \l{https://www.khronos.org/registry/vulkan/specs/1.0/html/}{Vulkan API
+ \l{https://www.khronos.org/registry/vulkan/specs/1.2/html/}{Vulkan API
documentation}.
\section1 Getting a Native Vulkan Surface for a Window
@@ -242,35 +206,10 @@ QT_BEGIN_NAMESPACE
This enum describes the flags that can be passed to setFlags(). These control
the behavior of create().
- \value NoDebugOutputRedirect Disables Vulkan debug output (\c{VK_EXT_debug_report}) redirection to qDebug.
+ \value NoDebugOutputRedirect Disables Vulkan debug output (\c{VK_EXT_debug_utils}) redirection to qDebug.
+ \value [since 6.5] NoPortabilityDrivers Disables enumerating physical devices marked as Vulkan Portability.
*/
-class QVulkanInstancePrivate
-{
-public:
- QVulkanInstancePrivate(QVulkanInstance *q)
- : q_ptr(q),
- vkInst(VK_NULL_HANDLE),
- errorCode(VK_SUCCESS)
- { }
- ~QVulkanInstancePrivate() { reset(); }
-
- bool ensureVulkan();
- void reset();
-
- QVulkanInstance *q_ptr;
- QScopedPointer<QPlatformVulkanInstance> platformInst;
- VkInstance vkInst;
- QVulkanInstance::Flags flags;
- QByteArrayList layers;
- QByteArrayList extensions;
- QVersionNumber apiVersion;
- VkResult errorCode;
- QScopedPointer<QVulkanFunctions> funcs;
- QHash<VkDevice, QVulkanDeviceFunctions *> deviceFuncs;
- QVector<QVulkanInstance::DebugFilter> debugFilters;
-};
-
bool QVulkanInstancePrivate::ensureVulkan()
{
if (!platformInst) {
@@ -306,7 +245,8 @@ QVulkanInstance::QVulkanInstance()
/*!
Destructor.
- \note current() will return \nullptr once the instance is destroyed.
+ \note \l {QVulkanInstance::}{vkInstance()} will return \nullptr once the
+ instance is destroyed.
*/
QVulkanInstance::~QVulkanInstance()
{
@@ -315,6 +255,7 @@ QVulkanInstance::~QVulkanInstance()
/*!
\class QVulkanLayer
+ \inmodule QtGui
\brief Represents information about a Vulkan layer.
*/
@@ -358,7 +299,7 @@ QVulkanInstance::~QVulkanInstance()
*/
/*!
- \fn uint qHash(const QVulkanLayer &key, uint seed)
+ \fn size_t qHash(const QVulkanLayer &key, size_t seed = 0)
\since 5.10
\relates QVulkanLayer
@@ -368,6 +309,7 @@ QVulkanInstance::~QVulkanInstance()
/*!
\class QVulkanExtension
+ \inmodule QtGui
\brief Represents information about a Vulkan extension.
*/
@@ -401,7 +343,7 @@ QVulkanInstance::~QVulkanInstance()
*/
/*!
- \fn uint qHash(const QVulkanExtension &key, uint seed)
+ \fn size_t qHash(const QVulkanExtension &key, size_t seed = 0)
\since 5.10
\relates QVulkanExtension
@@ -411,49 +353,82 @@ QVulkanInstance::~QVulkanInstance()
/*!
\class QVulkanInfoVector
- \brief A specialized QVector for QVulkanLayer and QVulkanExtension.
+ \inmodule QtGui
+ \brief A specialized QList for QVulkanLayer and QVulkanExtension.
*/
/*!
\fn template<typename T> bool QVulkanInfoVector<T>::contains(const QByteArray &name) const
- \return true if the vector contains a layer or extension with the given \a name.
+ \return true if the list contains a layer or extension with the given \a name.
*/
/*!
\fn template<typename T> bool QVulkanInfoVector<T>::contains(const QByteArray &name, int minVersion) const
- \return true if the vector contains a layer or extension with the given
+ \return true if the list contains a layer or extension with the given
\a name and a version same as or newer than \a minVersion.
*/
/*!
+ \fn QVulkanInfoVector<QVulkanLayer> QVulkanInstance::supportedLayers() const
\return the list of supported instance-level layers.
\note This function can be called before create().
*/
+
+/*!
+ \internal
+ */
QVulkanInfoVector<QVulkanLayer> QVulkanInstance::supportedLayers()
{
return d_ptr->ensureVulkan() ? d_ptr->platformInst->supportedLayers() : QVulkanInfoVector<QVulkanLayer>();
}
/*!
+ \fn QVulkanInfoVector<QVulkanExtension> QVulkanInstance::supportedExtensions() const
\return the list of supported instance-level extensions.
\note This function can be called before create().
*/
+
+/*!
+ \internal
+ */
QVulkanInfoVector<QVulkanExtension> QVulkanInstance::supportedExtensions()
{
return d_ptr->ensureVulkan() ? d_ptr->platformInst->supportedExtensions() : QVulkanInfoVector<QVulkanExtension>();
}
/*!
+ \return the version of instance-level functionality supported by the Vulkan
+ implementation.
+
+ In practice this is either the value returned from
+ vkEnumerateInstanceVersion, if that function is available (with Vulkan 1.1
+ and newer), or 1.0.
+
+ Applications that want to branch in their Vulkan feature and API usage
+ based on what Vulkan version is available at run time, can use this function
+ to determine what version to pass in to setApiVersion() before calling
+ create().
+
+ \note This function can be called before create().
+
+ \sa setApiVersion()
+ */
+QVersionNumber QVulkanInstance::supportedApiVersion() const
+{
+ return d_ptr->ensureVulkan() ? d_ptr->platformInst->supportedApiVersion() : QVersionNumber();
+}
+
+/*!
Makes QVulkanInstance adopt an existing VkInstance handle instead of
creating a new one.
\note \a existingVkInstance must have at least \c{VK_KHR_surface} and the
appropriate WSI-specific \c{VK_KHR_*_surface} extensions enabled. To ensure
- debug output redirection is functional, \c{VK_EXT_debug_report} is needed as
+ debug output redirection is functional, \c{VK_EXT_debug_utils} is needed as
well.
\note This function can only be called before create() and has no effect if
@@ -506,9 +481,14 @@ void QVulkanInstance::setLayers(const QByteArrayList &layers)
/*!
Specifies the list of additional instance \a extensions to enable. It is
safe to specify unsupported extensions as well because these get ignored
- when not supported at run time. The surface-related extensions required by
- Qt will always be added automatically, no need to include them in this
- list.
+ when not supported at run time.
+
+ \note The surface-related extensions required by Qt (for example, \c
+ VK_KHR_win32_surface) will always be added automatically, no need to
+ include them in this list.
+
+ \note \c VK_KHR_portability_enumeration is added automatically unless the
+ NoPortabilityDrivers flag is set. This value was introduced in Qt 6.5.
\note This function can only be called before create() and has no effect if
called afterwards.
@@ -524,13 +504,26 @@ void QVulkanInstance::setExtensions(const QByteArrayList &extensions)
}
/*!
- Specifies the Vulkan API against which the application expects to run.
+ Specifies the highest Vulkan API version the application is designed to use.
- By default no \a vulkanVersion is specified, and so no version check is performed
- during Vulkan instance creation.
+ By default \a vulkanVersion is 0, which maps to Vulkan 1.0.
\note This function can only be called before create() and has no effect if
called afterwards.
+
+ \note Be aware that Vulkan 1.1 changes the behavior with regards to the
+ Vulkan API version field. In Vulkan 1.0 specifying an unsupported \a
+ vulkanVersion led to failing create() with \c VK_ERROR_INCOMPATIBLE_DRIVER,
+ as was mandated by the specification. Starting with Vulkan 1.1, the
+ specification disallows this, the driver must accept any version without
+ failing the instance creation.
+
+ Application developers are advised to familiarize themselves with the \c
+ apiVersion notes in
+ \l{https://www.khronos.org/registry/vulkan/specs/1.2-extensions/man/html/VkApplicationInfo.html}{the
+ Vulkan specification}.
+
+ \sa supportedApiVersion()
*/
void QVulkanInstance::setApiVersion(const QVersionNumber &vulkanVersion)
{
@@ -548,11 +541,16 @@ void QVulkanInstance::setApiVersion(const QVersionNumber &vulkanVersion)
\return true if successful, false on error or when Vulkan is not supported.
- When successful, the pointer to this QVulkanInstance is retrievable via the
- static function current().
+ When successful, the pointer to this QVulkanInstance is retrievable via
+ \l {QVulkanInstance::}{vkInstance()}.
The Vulkan instance and library is available as long as this
QVulkanInstance exists, or until destroy() is called.
+
+ By default the VkInstance is created with the flag
+ \l{https://registry.khronos.org/vulkan/specs/1.3-extensions/man/html/VkInstanceCreateFlagBits.html}{VK_INSTANCE_CREATE_ENUMERATE_PORTABILITY_BIT_KHR}
+ set. This means that Vulkan Portability physical devices get enumerated as
+ well. If this is not desired, set the NoPortabilityDrivers flag.
*/
bool QVulkanInstance::create()
{
@@ -571,6 +569,7 @@ bool QVulkanInstance::create()
d_ptr->errorCode = VK_SUCCESS;
d_ptr->funcs.reset(new QVulkanFunctions(this));
d_ptr->platformInst->setDebugFilters(d_ptr->debugFilters);
+ d_ptr->platformInst->setDebugUtilsFilters(d_ptr->debugUtilsFilters);
return true;
}
@@ -691,7 +690,17 @@ QPlatformVulkanInstance *QVulkanInstance::handle() const
\note The returned object is owned and managed by the QVulkanInstance. Do
not destroy or alter it.
- \sa deviceFunctions()
+ The functions from the core Vulkan 1.0 API will be available always. When it
+ comes to higher Vulkan versions, such as, 1.1 and 1.2, the QVulkanFunctions
+ object will try to resolve the core API functions for those as well, but if
+ the Vulkan instance implementation at run time has no support for those,
+ calling any such unsupported function will lead to unspecified behavior. In
+ addition, to properly enable support for Vulkan versions higher than 1.0, an
+ appropriate instance API version may need to be set by calling
+ setApiVersion() before create(). To query the Vulkan implementation's
+ instance-level version, call supportedApiVersion().
+
+ \sa deviceFunctions(), supportedApiVersion()
*/
QVulkanFunctions *QVulkanInstance::functions() const
{
@@ -716,6 +725,16 @@ QVulkanFunctions *QVulkanInstance::functions() const
to the application to notify the QVulkanInstance by calling
resetDeviceFunctions().
+ The functions from the core Vulkan 1.0 API will be available always. When
+ it comes to higher Vulkan versions, such as, 1.1 and 1.2, the
+ QVulkanDeviceFunctions object will try to resolve the core API functions
+ for those as well, but if the Vulkan physical device at run time has no
+ support for those, calling any such unsupported function will lead to
+ unspecified behavior. To properly enable support for Vulkan versions higher
+ than 1.0, an appropriate instance API version may need to be set by calling
+ setApiVersion() before create(). In addition, applications are expected to
+ check the physical device's apiVersion in VkPhysicalDeviceProperties.
+
\sa functions(), resetDeviceFunctions()
*/
QVulkanDeviceFunctions *QVulkanInstance::deviceFunctions(VkDevice device)
@@ -781,6 +800,8 @@ bool QVulkanInstance::supportsPresent(VkPhysicalDevice physicalDevice, uint32_t
system dependent synchronization. For example, on Wayland this will
add send a wl_surface.frame request in order to prevent the driver from
blocking for minimized windows.
+
+ \since 5.15
*/
void QVulkanInstance::presentAboutToBeQueued(QWindow *window)
{
@@ -803,12 +824,28 @@ void QVulkanInstance::presentQueued(QWindow *window)
/*!
\typedef QVulkanInstance::DebugFilter
- Typedef for debug filtering callback functions.
+ Typedef for debug filtering callback functions, with the following signature:
+
+ \code
+ bool myDebugFilter(VkDebugReportFlagsEXT flags, VkDebugReportObjectTypeEXT objectType, uint64_t object,
+ size_t location, int32_t messageCode, const char *pLayerPrefix, const char *pMessage)
+ \endcode
+
+ Returning \c true suppresses the printing of the message.
+
+ \note Starting with Qt 6.5 \c{VK_EXT_debug_utils} is used instead of the
+ deprecated \c{VK_EXT_debug_report}. The callback signature is based on
+ VK_EXT_debug_report. Therefore, not all arguments can be expected to be
+ valid anymore. Avoid relying on arguments other than \c pMessage, \c
+ messageCode, and \c object. Applications wishing to access all the callback
+ data as specified in VK_EXT_debug_utils should migrate to DebugUtilsFilter.
\sa installDebugOutputFilter(), removeDebugOutputFilter()
*/
/*!
+ \overload
+
Installs a \a filter function that is called for every Vulkan debug
message. When the callback returns \c true, the message is stopped (filtered
out) and will not appear on the debug output.
@@ -830,6 +867,8 @@ void QVulkanInstance::installDebugOutputFilter(DebugFilter filter)
}
/*!
+ \overload
+
Removes a \a filter function previously installed by
installDebugOutputFilter().
@@ -844,6 +883,84 @@ void QVulkanInstance::removeDebugOutputFilter(DebugFilter filter)
d_ptr->platformInst->setDebugFilters(d_ptr->debugFilters);
}
+/*!
+ \typedef QVulkanInstance::DebugUtilsFilter
+
+ Typedef for debug filtering callback functions, with the following signature:
+
+ \code
+ std::function<bool(DebugMessageSeverityFlags severity, DebugMessageTypeFlags type, const void *message)>;
+ \endcode
+
+ The \c message argument is a pointer to the
+ VkDebugUtilsMessengerCallbackDataEXT structure. Refer to the documentation
+ of \c{VK_EXT_debug_utils} for details. The Qt headers do not use the real
+ type in order to avoid introducing a dependency on post-1.0 Vulkan headers.
+
+ Returning \c true suppresses the printing of the message.
+
+ \sa installDebugOutputFilter(), removeDebugOutputFilter()
+ \since 6.5
+ */
+
+/*!
+ \enum QVulkanInstance::DebugMessageSeverityFlag
+ \since 6.5
+
+ \value VerboseSeverity
+ \value InfoSeverity
+ \value WarningSeverity
+ \value ErrorSeverity
+ */
+
+/*!
+ \enum QVulkanInstance::DebugMessageTypeFlag
+ \since 6.5
+
+ \value GeneralMessage
+ \value ValidationMessage
+ \value PerformanceMessage
+ */
+
+/*!
+ Installs a \a filter function that is called for every Vulkan debug
+ message. When the callback returns \c true, the message is stopped (filtered
+ out) and will not appear on the debug output.
+
+ \note Filtering is only effective when NoDebugOutputRedirect is not
+ \l{setFlags()}{set}. Installing filters has no effect otherwise.
+
+ \note This function can be called before create().
+
+ \sa clearDebugOutputFilters()
+ \since 6.5
+ */
+void QVulkanInstance::installDebugOutputFilter(DebugUtilsFilter filter)
+{
+ d_ptr->debugUtilsFilters.append(filter);
+ if (d_ptr->platformInst)
+ d_ptr->platformInst->setDebugUtilsFilters(d_ptr->debugUtilsFilters);
+}
+
+/*!
+ Removes all filter functions installed previously by
+ installDebugOutputFilter().
+
+ \note This function can be called before create().
+
+ \sa installDebugOutputFilter()
+ \since 6.5
+ */
+void QVulkanInstance::clearDebugOutputFilters()
+{
+ d_ptr->debugFilters.clear();
+ d_ptr->debugUtilsFilters.clear();
+ if (d_ptr->platformInst) {
+ d_ptr->platformInst->setDebugFilters(d_ptr->debugFilters);
+ d_ptr->platformInst->setDebugUtilsFilters(d_ptr->debugUtilsFilters);
+ }
+}
+
#ifndef QT_NO_DEBUG_STREAM
QDebug operator<<(QDebug dbg, const QVulkanLayer &layer)
{
diff --git a/src/gui/vulkan/qvulkaninstance.h b/src/gui/vulkan/qvulkaninstance.h
index 5b3db9a4c8..221f605fa2 100644
--- a/src/gui/vulkan/qvulkaninstance.h
+++ b/src/gui/vulkan/qvulkaninstance.h
@@ -1,41 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2017 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the QtGui module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2017 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#ifndef QVULKANINSTANCE_H
#define QVULKANINSTANCE_H
@@ -44,28 +8,51 @@
#if 0
#pragma qt_no_master_include
+#pragma qt_sync_skip_header_check
#endif
-#if QT_CONFIG(vulkan) || defined(Q_CLANG_QDOC)
+#if QT_CONFIG(vulkan) || defined(Q_QDOC)
#ifndef VK_NO_PROTOTYPES
#define VK_NO_PROTOTYPES
#endif
-#ifndef Q_CLANG_QDOC
+#if !defined(Q_QDOC) && __has_include(<vulkan/vulkan.h>)
#include <vulkan/vulkan.h>
#else
+// QT_CONFIG(vulkan) implies vulkan.h being available at Qt build time, but it
+// does not guarantee vulkan.h is available at *application* build time. Both
+// for qdoc and for apps built on systems without Vulkan SDK we provide a set
+// of typedefs to keep things compiling since this header may be included from
+// Qt Quick and elsewhere just to get types like VkImage and friends defined.
+
typedef void* PFN_vkVoidFunction;
-typedef unsigned long VkSurfaceKHR;
-typedef unsigned long VkImage;
-typedef unsigned long VkImageView;
+// non-dispatchable handles (64-bit regardless of arch)
+typedef quint64 VkSurfaceKHR;
+typedef quint64 VkImage;
+typedef quint64 VkImageView;
+// dispatchable handles (32 or 64-bit depending on arch)
+typedef void* VkInstance;
+typedef void* VkPhysicalDevice;
+typedef void* VkDevice;
+// enums
+typedef int VkResult;
+typedef int VkFormat;
+typedef int VkImageLayout;
+typedef int VkDebugReportFlagsEXT;
+typedef int VkDebugReportObjectTypeEXT;
#endif
+// QVulkanInstance itself is only applicable if vulkan.h is available, or if
+// it's qdoc. An application that is built on a vulkan.h-less system against a
+// Vulkan-enabled Qt gets the dummy typedefs but not QVulkan*.
+#if __has_include(<vulkan/vulkan.h>) || defined(Q_QDOC)
+
+#include <QtCore/qbytearraylist.h>
+#include <QtCore/qdebug.h>
#include <QtCore/qhashfunctions.h>
+#include <QtCore/qlist.h>
#include <QtCore/qscopedpointer.h>
-#include <QtCore/qvector.h>
-#include <QtCore/qbytearraylist.h>
#include <QtCore/qversionnumber.h>
-#include <QtCore/qdebug.h>
QT_BEGIN_NAMESPACE
@@ -82,7 +69,7 @@ struct QVulkanLayer
QVersionNumber specVersion;
QByteArray description;
};
-Q_DECLARE_TYPEINFO(QVulkanLayer, Q_MOVABLE_TYPE);
+Q_DECLARE_TYPEINFO(QVulkanLayer, Q_RELOCATABLE_TYPE);
inline bool operator==(const QVulkanLayer &lhs, const QVulkanLayer &rhs) noexcept
{
@@ -91,7 +78,7 @@ inline bool operator==(const QVulkanLayer &lhs, const QVulkanLayer &rhs) noexcep
inline bool operator!=(const QVulkanLayer &lhs, const QVulkanLayer &rhs) noexcept
{ return !(lhs == rhs); }
-inline uint qHash(const QVulkanLayer &key, uint seed = 0) noexcept
+inline size_t qHash(const QVulkanLayer &key, size_t seed = 0) noexcept
{
QtPrivate::QHashCombine hash;
seed = hash(seed, key.name);
@@ -105,7 +92,7 @@ struct QVulkanExtension
QByteArray name;
uint32_t version;
};
-Q_DECLARE_TYPEINFO(QVulkanExtension, Q_MOVABLE_TYPE);
+Q_DECLARE_TYPEINFO(QVulkanExtension, Q_RELOCATABLE_TYPE);
inline bool operator==(const QVulkanExtension &lhs, const QVulkanExtension &rhs) noexcept
{
@@ -114,7 +101,7 @@ inline bool operator==(const QVulkanExtension &lhs, const QVulkanExtension &rhs)
inline bool operator!=(const QVulkanExtension &lhs, const QVulkanExtension &rhs) noexcept
{ return !(lhs == rhs); }
-inline uint qHash(const QVulkanExtension &key, uint seed = 0) noexcept
+inline size_t qHash(const QVulkanExtension &key, size_t seed = 0) noexcept
{
QtPrivate::QHashCombine hash;
seed = hash(seed, key.name);
@@ -128,7 +115,7 @@ Q_GUI_EXPORT QDebug operator<<(QDebug, const QVulkanExtension &);
#endif
template<typename T>
-class QVulkanInfoVector : public QVector<T>
+class QVulkanInfoVector : public QList<T>
{
public:
bool contains(const QByteArray &name) const {
@@ -148,12 +135,19 @@ public:
~QVulkanInstance();
enum Flag {
- NoDebugOutputRedirect = 0x01
+ NoDebugOutputRedirect = 0x01,
+ NoPortabilityDrivers = 0x02
};
Q_DECLARE_FLAGS(Flags, Flag)
+ // ### Qt 7: remove non-const overloads
QVulkanInfoVector<QVulkanLayer> supportedLayers();
+ inline QVulkanInfoVector<QVulkanLayer> supportedLayers() const
+ { return const_cast<QVulkanInstance*>(this)->supportedLayers(); }
QVulkanInfoVector<QVulkanExtension> supportedExtensions();
+ inline QVulkanInfoVector<QVulkanExtension> supportedExtensions() const
+ { return const_cast<QVulkanInstance*>(this)->supportedExtensions(); }
+ QVersionNumber supportedApiVersion() const;
void setVkInstance(VkInstance existingVkInstance);
@@ -194,15 +188,39 @@ public:
void installDebugOutputFilter(DebugFilter filter);
void removeDebugOutputFilter(DebugFilter filter);
+ enum DebugMessageSeverityFlag {
+ VerboseSeverity = 0x01,
+ InfoSeverity = 0x02,
+ WarningSeverity = 0x04,
+ ErrorSeverity = 0x08
+ };
+ Q_DECLARE_FLAGS(DebugMessageSeverityFlags, DebugMessageSeverityFlag)
+
+ enum DebugMessageTypeFlag {
+ GeneralMessage = 0x01,
+ ValidationMessage = 0x02,
+ PerformanceMessage = 0x04
+ };
+ Q_DECLARE_FLAGS(DebugMessageTypeFlags, DebugMessageTypeFlag)
+
+ using DebugUtilsFilter = std::function<bool(DebugMessageSeverityFlags severity, DebugMessageTypeFlags type, const void *message)>;
+ void installDebugOutputFilter(DebugUtilsFilter filter);
+ void clearDebugOutputFilters();
+
private:
+ friend class QVulkanInstancePrivate;
QScopedPointer<QVulkanInstancePrivate> d_ptr;
Q_DISABLE_COPY(QVulkanInstance)
};
Q_DECLARE_OPERATORS_FOR_FLAGS(QVulkanInstance::Flags)
+Q_DECLARE_OPERATORS_FOR_FLAGS(QVulkanInstance::DebugMessageTypeFlags)
+Q_DECLARE_OPERATORS_FOR_FLAGS(QVulkanInstance::DebugMessageSeverityFlags)
QT_END_NAMESPACE
-#endif // QT_CONFIG(vulkan)
+#endif // __has_include(<vulkan/vulkan.h>) || defined(Q_QDOC)
+
+#endif // QT_CONFIG(vulkan) || defined(Q_QDOC)
#endif // QVULKANINSTANCE_H
diff --git a/src/gui/vulkan/qvulkaninstance_p.h b/src/gui/vulkan/qvulkaninstance_p.h
new file mode 100644
index 0000000000..d707b301c6
--- /dev/null
+++ b/src/gui/vulkan/qvulkaninstance_p.h
@@ -0,0 +1,60 @@
+// Copyright (C) 2022 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
+
+#ifndef QVULKANINSTANCE_P_H
+#define QVULKANINSTANCE_P_H
+
+#include <QtGui/private/qtguiglobal_p.h>
+
+#if QT_CONFIG(vulkan) || defined(Q_QDOC)
+
+#include "qvulkaninstance.h"
+#include <private/qvulkanfunctions_p.h>
+#include <QtCore/QHash>
+
+//
+// W A R N I N G
+// -------------
+//
+// This file is not part of the Qt API. It exists for the convenience
+// of a number of Qt sources files. This header file may change from
+// version to version without notice, or even be removed.
+//
+// We mean it.
+//
+
+QT_BEGIN_NAMESPACE
+
+class Q_GUI_EXPORT QVulkanInstancePrivate
+{
+public:
+ QVulkanInstancePrivate(QVulkanInstance *q)
+ : q_ptr(q),
+ vkInst(VK_NULL_HANDLE),
+ errorCode(VK_SUCCESS)
+ { }
+ ~QVulkanInstancePrivate() { reset(); }
+ static QVulkanInstancePrivate *get(QVulkanInstance *q) { return q->d_ptr.data(); }
+
+ bool ensureVulkan();
+ void reset();
+
+ QVulkanInstance *q_ptr;
+ QScopedPointer<QPlatformVulkanInstance> platformInst;
+ VkInstance vkInst;
+ QVulkanInstance::Flags flags;
+ QByteArrayList layers;
+ QByteArrayList extensions;
+ QVersionNumber apiVersion;
+ VkResult errorCode;
+ QScopedPointer<QVulkanFunctions> funcs;
+ QHash<VkDevice, QVulkanDeviceFunctions *> deviceFuncs;
+ QList<QVulkanInstance::DebugFilter> debugFilters; // legacy filters based on VK_EXT_debug_report
+ QList<QVulkanInstance::DebugUtilsFilter> debugUtilsFilters; // the modern version based on VK_EXT_debug_utils
+};
+
+QT_END_NAMESPACE
+
+#endif // QT_CONFIG(vulkan)
+
+#endif // QVULKANINSTANCE_P_H
diff --git a/src/gui/vulkan/qvulkanwindow.cpp b/src/gui/vulkan/qvulkanwindow.cpp
index ed73a77683..00a5c5f869 100644
--- a/src/gui/vulkan/qvulkanwindow.cpp
+++ b/src/gui/vulkan/qvulkanwindow.cpp
@@ -1,41 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2017 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the QtGui module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2017 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#include "qvulkanwindow_p.h"
#include "qvulkanfunctions.h"
@@ -47,7 +11,7 @@
QT_BEGIN_NAMESPACE
-Q_LOGGING_CATEGORY(lcGuiVk, "qt.vulkan")
+Q_DECLARE_LOGGING_CATEGORY(lcGuiVk)
/*!
\class QVulkanWindow
@@ -195,6 +159,31 @@ Q_LOGGING_CATEGORY(lcGuiVk, "qt.vulkan")
\note QVulkanWindow does not expose device layers since this functionality
has been deprecated since version 1.0.13 of the Vulkan API.
+ \section1 Layers, device features, and extensions
+
+ To enable instance layers, call QVulkanInstance::setLayers() before creating
+ the QVulkanInstance. To query what instance layer are available, call
+ QVulkanInstance::supportedLayers().
+
+ To enable device extensions, call setDeviceExtensions() early on when setting
+ up the QVulkanWindow. To query what device extensions are available, call
+ supportedDeviceExtensions().
+
+ Specifying an unsupported layer or extension is handled gracefully: this will
+ not fail instance or device creation, but the layer or extension request is
+ rather ignored.
+
+ When it comes to device features, QVulkanWindow enables all Vulkan 1.0
+ features that are reported as supported from vkGetPhysicalDeviceFeatures().
+ As an exception to this rule, \c robustBufferAccess is never enabled. Use the
+ callback mechanism described below, if enabling that feature is desired.
+
+ This is not always desirable, and may be insufficient with Vulkan 1.1 and
+ higher. Therefore, full control over the VkPhysicalDeviceFeatures used for
+ device creation is possible too by registering a callback function with
+ setEnabledFeaturesModifier(). When set, the callback function is invoked,
+ letting it alter the VkPhysicalDeviceFeatures or VkPhysicalDeviceFeatures2.
+
\sa QVulkanInstance, QWindow
*/
@@ -284,7 +273,7 @@ QVulkanWindow::Flags QVulkanWindow::flags() const
\note This function can be called before making the window visible.
*/
-QVector<VkPhysicalDeviceProperties> QVulkanWindow::availablePhysicalDevices()
+QList<VkPhysicalDeviceProperties> QVulkanWindow::availablePhysicalDevices()
{
Q_D(QVulkanWindow);
if (!d->physDevs.isEmpty() && !d->physDevProps.isEmpty())
@@ -308,7 +297,7 @@ QVector<VkPhysicalDeviceProperties> QVulkanWindow::availablePhysicalDevices()
if (!count)
return d->physDevProps;
- QVector<VkPhysicalDevice> devs(count);
+ QList<VkPhysicalDevice> devs(count);
err = f->vkEnumeratePhysicalDevices(inst->vkInstance(), &count, devs.data());
if (err != VK_SUCCESS) {
qWarning("QVulkanWindow: Failed to enumerate physical devices: %d", err);
@@ -345,7 +334,7 @@ void QVulkanWindow::setPhysicalDeviceIndex(int idx)
qWarning("QVulkanWindow: Attempted to set physical device when already initialized");
return;
}
- const int count = availablePhysicalDevices().count();
+ const int count = availablePhysicalDevices().size();
if (idx < 0 || idx >= count) {
qWarning("QVulkanWindow: Invalid physical device index %d (total physical devices: %d)", idx, count);
return;
@@ -378,7 +367,7 @@ QVulkanInfoVector<QVulkanExtension> QVulkanWindow::supportedDeviceExtensions()
uint32_t count = 0;
VkResult err = f->vkEnumerateDeviceExtensionProperties(physDev, nullptr, &count, nullptr);
if (err == VK_SUCCESS) {
- QVector<VkExtensionProperties> extProps(count);
+ QList<VkExtensionProperties> extProps(count);
err = f->vkEnumerateDeviceExtensionProperties(physDev, nullptr, &count, extProps.data());
if (err == VK_SUCCESS) {
QVulkanInfoVector<QVulkanExtension> exts;
@@ -445,7 +434,7 @@ void QVulkanWindow::setDeviceExtensions(const QByteArrayList &extensions)
\sa colorFormat()
*/
-void QVulkanWindow::setPreferredColorFormats(const QVector<VkFormat> &formats)
+void QVulkanWindow::setPreferredColorFormats(const QList<VkFormat> &formats)
{
Q_D(QVulkanWindow);
if (d->status != QVulkanWindowPrivate::StatusUninitialized) {
@@ -458,7 +447,7 @@ void QVulkanWindow::setPreferredColorFormats(const QVector<VkFormat> &formats)
static struct {
VkSampleCountFlagBits mask;
int count;
-} qvk_sampleCounts[] = {
+} q_vk_sampleCounts[] = {
// keep this sorted by 'count'
{ VK_SAMPLE_COUNT_1_BIT, 1 },
{ VK_SAMPLE_COUNT_2_BIT, 2 },
@@ -471,7 +460,7 @@ static struct {
/*!
Returns the set of supported sample counts when using the physical device
- selected by setPhysicalDeviceIndex(), as a sorted vector.
+ selected by setPhysicalDeviceIndex(), as a sorted list.
By default QVulkanWindow uses a sample count of 1. By calling setSampleCount()
with a different value (2, 4, 8, ...) from the set returned by this
@@ -481,10 +470,10 @@ static struct {
\sa setSampleCount()
*/
-QVector<int> QVulkanWindow::supportedSampleCounts()
+QList<int> QVulkanWindow::supportedSampleCounts()
{
Q_D(const QVulkanWindow);
- QVector<int> result;
+ QList<int> result;
availablePhysicalDevices();
@@ -498,7 +487,7 @@ QVector<int> QVulkanWindow::supportedSampleCounts()
VkSampleCountFlags depth = limits->framebufferDepthSampleCounts;
VkSampleCountFlags stencil = limits->framebufferStencilSampleCounts;
- for (const auto &qvk_sampleCount : qvk_sampleCounts) {
+ for (const auto &qvk_sampleCount : q_vk_sampleCounts) {
if ((color & qvk_sampleCount.mask)
&& (depth & qvk_sampleCount.mask)
&& (stencil & qvk_sampleCount.mask))
@@ -547,7 +536,7 @@ void QVulkanWindow::setSampleCount(int sampleCount)
return;
}
- for (const auto &qvk_sampleCount : qvk_sampleCounts) {
+ for (const auto &qvk_sampleCount : q_vk_sampleCounts) {
if (qvk_sampleCount.count == sampleCount) {
d->sampleCount = qvk_sampleCount.mask;
return;
@@ -591,7 +580,7 @@ void QVulkanWindowPrivate::init()
return;
}
- if (physDevIndex < 0 || physDevIndex >= physDevs.count()) {
+ if (physDevIndex < 0 || physDevIndex >= physDevs.size()) {
qWarning("QVulkanWindow: Invalid physical device index; defaulting to 0");
physDevIndex = 0;
}
@@ -606,11 +595,11 @@ void QVulkanWindowPrivate::init()
uint32_t queueCount = 0;
f->vkGetPhysicalDeviceQueueFamilyProperties(physDev, &queueCount, nullptr);
- QVector<VkQueueFamilyProperties> queueFamilyProps(queueCount);
+ QList<VkQueueFamilyProperties> queueFamilyProps(queueCount);
f->vkGetPhysicalDeviceQueueFamilyProperties(physDev, &queueCount, queueFamilyProps.data());
gfxQueueFamilyIdx = uint32_t(-1);
presQueueFamilyIdx = uint32_t(-1);
- for (int i = 0; i < queueFamilyProps.count(); ++i) {
+ for (int i = 0; i < queueFamilyProps.size(); ++i) {
const bool supportsPresent = inst->supportsPresent(physDev, i, q);
qCDebug(lcGuiVk, "queue family %d: flags=0x%x count=%d supportsPresent=%d", i,
queueFamilyProps[i].queueFlags, queueFamilyProps[i].queueCount, supportsPresent);
@@ -623,7 +612,7 @@ void QVulkanWindowPrivate::init()
presQueueFamilyIdx = gfxQueueFamilyIdx;
} else {
qCDebug(lcGuiVk, "No queue with graphics+present; trying separate queues");
- for (int i = 0; i < queueFamilyProps.count(); ++i) {
+ for (int i = 0; i < queueFamilyProps.size(); ++i) {
if (gfxQueueFamilyIdx == uint32_t(-1) && (queueFamilyProps[i].queueFlags & VK_QUEUE_GRAPHICS_BIT))
gfxQueueFamilyIdx = i;
if (presQueueFamilyIdx == uint32_t(-1) && inst->supportsPresent(physDev, i, q))
@@ -647,7 +636,7 @@ void QVulkanWindowPrivate::init()
#endif
qCDebug(lcGuiVk, "Using queue families: graphics = %u present = %u", gfxQueueFamilyIdx, presQueueFamilyIdx);
- QVector<VkDeviceQueueCreateInfo> queueInfo;
+ QList<VkDeviceQueueCreateInfo> queueInfo;
queueInfo.reserve(2);
const float prio[] = { 0 };
VkDeviceQueueCreateInfo addQueueInfo;
@@ -667,7 +656,7 @@ void QVulkanWindowPrivate::init()
queueCreateInfoModifier(queueFamilyProps.constData(), queueCount, queueInfo);
bool foundGfxQueue = false;
bool foundPresQueue = false;
- for (const VkDeviceQueueCreateInfo& createInfo : qAsConst(queueInfo)) {
+ for (const VkDeviceQueueCreateInfo& createInfo : std::as_const(queueInfo)) {
foundGfxQueue |= createInfo.queueFamilyIndex == gfxQueueFamilyIdx;
foundPresQueue |= createInfo.queueFamilyIndex == presQueueFamilyIdx;
}
@@ -685,10 +674,19 @@ void QVulkanWindowPrivate::init()
// Filter out unsupported extensions in order to keep symmetry
// with how QVulkanInstance behaves. Add the swapchain extension.
- QVector<const char *> devExts;
+ QList<const char *> devExts;
QVulkanInfoVector<QVulkanExtension> supportedExtensions = q->supportedDeviceExtensions();
QByteArrayList reqExts = requestedDevExtensions;
reqExts.append("VK_KHR_swapchain");
+
+ QByteArray envExts = qgetenv("QT_VULKAN_DEVICE_EXTENSIONS");
+ if (!envExts.isEmpty()) {
+ QByteArrayList envExtList = envExts.split(';');
+ for (auto ext : reqExts)
+ envExtList.removeAll(ext);
+ reqExts.append(envExtList);
+ }
+
for (const QByteArray &ext : reqExts) {
if (supportedExtensions.contains(ext))
devExts.append(ext.constData());
@@ -700,9 +698,26 @@ void QVulkanWindowPrivate::init()
devInfo.sType = VK_STRUCTURE_TYPE_DEVICE_CREATE_INFO;
devInfo.queueCreateInfoCount = queueInfo.size();
devInfo.pQueueCreateInfos = queueInfo.constData();
- devInfo.enabledExtensionCount = devExts.count();
+ devInfo.enabledExtensionCount = devExts.size();
devInfo.ppEnabledExtensionNames = devExts.constData();
+ VkPhysicalDeviceFeatures features = {};
+ VkPhysicalDeviceFeatures2 features2 = {};
+ if (enabledFeatures2Modifier) {
+ features2.sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_FEATURES_2;
+ enabledFeatures2Modifier(features2);
+ devInfo.pNext = &features2;
+ } else if (enabledFeaturesModifier) {
+ enabledFeaturesModifier(features);
+ devInfo.pEnabledFeatures = &features;
+ } else {
+ // Enable all supported 1.0 core features, except ones that likely
+ // involve a performance penalty.
+ f->vkGetPhysicalDeviceFeatures(physDev, &features);
+ features.robustBufferAccess = VK_FALSE;
+ devInfo.pEnabledFeatures = &features;
+ }
+
// Device layers are not supported by QVulkanWindow since that's an already deprecated
// API. However, have a workaround for systems with older API and layers (f.ex. L4T
// 24.2 for the Jetson TX1 provides API 1.0.13 and crashes when the validation layer
@@ -713,17 +728,17 @@ void QVulkanWindowPrivate::init()
&& VK_VERSION_PATCH(apiVersion) <= 13)
{
// Make standard validation work at least.
- const QByteArray stdValName = QByteArrayLiteral("VK_LAYER_LUNARG_standard_validation");
+ const QByteArray stdValName = QByteArrayLiteral("VK_LAYER_KHRONOS_validation");
const char *stdValNamePtr = stdValName.constData();
if (inst->layers().contains(stdValName)) {
uint32_t count = 0;
VkResult err = f->vkEnumerateDeviceLayerProperties(physDev, &count, nullptr);
if (err == VK_SUCCESS) {
- QVector<VkLayerProperties> layerProps(count);
+ QList<VkLayerProperties> layerProps(count);
err = f->vkEnumerateDeviceLayerProperties(physDev, &count, layerProps.data());
if (err == VK_SUCCESS) {
for (const VkLayerProperties &prop : layerProps) {
- if (!strncmp(prop.layerName, stdValNamePtr, stdValName.count())) {
+ if (!strncmp(prop.layerName, stdValNamePtr, stdValName.size())) {
devInfo.enabledLayerCount = 1;
devInfo.ppEnabledLayerNames = &stdValNamePtr;
break;
@@ -831,7 +846,7 @@ void QVulkanWindowPrivate::init()
uint32_t formatCount = 0;
vkGetPhysicalDeviceSurfaceFormatsKHR(physDev, surface, &formatCount, nullptr);
- QVector<VkSurfaceFormatKHR> formats(formatCount);
+ QList<VkSurfaceFormatKHR> formats(formatCount);
if (formatCount)
vkGetPhysicalDeviceSurfaceFormatsKHR(physDev, surface, &formatCount, formats.data());
@@ -846,7 +861,7 @@ void QVulkanWindowPrivate::init()
// Try to honor the user request.
if (!formats.isEmpty() && !requestedColorFormats.isEmpty()) {
- for (VkFormat reqFmt : qAsConst(requestedColorFormats)) {
+ for (VkFormat reqFmt : std::as_const(requestedColorFormats)) {
auto r = std::find_if(formats.cbegin(), formats.cend(),
[reqFmt](const VkSurfaceFormatKHR &sfmt) { return sfmt.format == reqFmt; });
if (r != formats.cend()) {
@@ -1034,9 +1049,11 @@ void QVulkanWindowPrivate::recreateSwapChain()
VkPhysicalDevice physDev = physDevs.at(physDevIndex);
VkSurfaceCapabilitiesKHR surfaceCaps;
vkGetPhysicalDeviceSurfaceCapabilitiesKHR(physDev, surface, &surfaceCaps);
- uint32_t reqBufferCount = swapChainBufferCount;
- if (surfaceCaps.maxImageCount)
- reqBufferCount = qBound(surfaceCaps.minImageCount, reqBufferCount, surfaceCaps.maxImageCount);
+ uint32_t reqBufferCount;
+ if (surfaceCaps.maxImageCount == 0)
+ reqBufferCount = qMax<uint32_t>(2, surfaceCaps.minImageCount);
+ else
+ reqBufferCount = qMax(qMin<uint32_t>(surfaceCaps.maxImageCount, 3), surfaceCaps.minImageCount);
VkExtent2D bufferSize = surfaceCaps.currentExtent;
if (bufferSize.width == uint32_t(-1)) {
@@ -1319,6 +1336,7 @@ bool QVulkanWindowPrivate::createTransientImage(VkFormat format,
VkMemoryRequirements memReq;
VkResult err;
+ Q_ASSERT(count > 0);
for (int i = 0; i < count; ++i) {
VkImageCreateInfo imgInfo;
memset(&imgInfo, 0, sizeof(imgInfo));
@@ -1570,8 +1588,8 @@ bool QVulkanWindow::event(QEvent *e)
/*!
\typedef QVulkanWindow::QueueCreateInfoModifier
- A function function that is called during graphics initialization to add
- additAional queues that should be created.
+ A function that is called during graphics initialization to add
+ additional queues that should be created.
Set if the renderer needs additional queues besides the default graphics
queue (e.g. a transfer queue).
@@ -1579,39 +1597,104 @@ bool QVulkanWindow::event(QEvent *e)
the additional queues.
The renderer can subsequently request the actual queue in initResources().
- Note when requesting additional graphics queues: Qt itself always requests
- a graphics queue, you'll need to search queueCreateInfo for the appropriate
+ \note When requesting additional graphics queues, Qt itself always requests
+ a graphics queue. You'll need to search queueCreateInfo for the appropriate
entry and manipulate it to obtain the additional queue.
\sa setQueueCreateInfoModifier()
*/
/*!
- Return a previously set queue create info modification function.
+ Sets the queue create info modification function \a modifier.
- \sa setQueueCreateInfoModifier()
+ \sa QueueCreateInfoModifier
\since 5.15
*/
-QVulkanWindow::QueueCreateInfoModifier QVulkanWindow::queueCreateInfoModifier() const
+void QVulkanWindow::setQueueCreateInfoModifier(const QueueCreateInfoModifier &modifier)
{
- Q_D(const QVulkanWindow);
- return d->queueCreateInfoModifier;
+ Q_D(QVulkanWindow);
+ d->queueCreateInfoModifier = modifier;
}
/*!
- Set a queue create info modification function.
+ \typedef QVulkanWindow::EnabledFeaturesModifier
- \sa queueCreateInfoModifier()
+ A function that is called during graphics initialization to alter the
+ VkPhysicalDeviceFeatures that is passed in when creating a Vulkan device
+ object.
- \since 5.15
+ By default QVulkanWindow enables all Vulkan 1.0 core features that the
+ physical device reports as supported, with certain exceptions. In
+ praticular, \c robustBufferAccess is always disabled in order to avoid
+ unexpected performance hits.
+
+ The VkPhysicalDeviceFeatures reference passed in is all zeroed out at the
+ point when the function is invoked. It is up to the function to change
+ members as it sees fit.
+
+ \note To control Vulkan 1.1, 1.2, or 1.3 features, use
+ EnabledFeatures2Modifier instead.
+
+ \sa setEnabledFeaturesModifier()
+ */
+
+/*!
+ Sets the enabled device features modification function \a modifier.
+
+ \note To control Vulkan 1.1, 1.2, or 1.3 features, use
+ the overload taking a EnabledFeatures2Modifier instead.
+
+ \note \a modifier is passed to the callback function with all members set
+ to false. It is up to the function to change members as it sees fit.
+
+ \since 6.7
+ \sa EnabledFeaturesModifier
*/
-void QVulkanWindow::setQueueCreateInfoModifier(QueueCreateInfoModifier modifier)
+void QVulkanWindow::setEnabledFeaturesModifier(const EnabledFeaturesModifier &modifier)
{
Q_D(QVulkanWindow);
- d->queueCreateInfoModifier = modifier;
+ d->enabledFeaturesModifier = modifier;
}
+/*!
+ \typedef QVulkanWindow::EnabledFeatures2Modifier
+
+ A function that is called during graphics initialization to alter the
+ VkPhysicalDeviceFeatures2 that is changed to the VkDeviceCreateInfo.
+
+ By default QVulkanWindow enables all Vulkan 1.0 core features that the
+ physical device reports as supported, with certain exceptions. In
+ praticular, \c robustBufferAccess is always disabled in order to avoid
+ unexpected performance hits.
+
+ This however is not always sufficient when working with Vulkan 1.1, 1.2, or
+ 1.3 features and extensions. Hence this callback mechanism. If only Vulkan
+ 1.0 is relevant at run time, use setEnabledFeaturesModifier() instead.
+
+ The VkPhysicalDeviceFeatures2 reference passed to the callback function
+ with \c sType set, but the rest zeroed out. It is up to the function to
+ change members to true, or set up \c pNext chains as it sees fit.
+
+ \note When setting up \c pNext chains, make sure the referenced objects
+ have a long enough lifetime, for example by storing them as member
+ variables in the QVulkanWindow subclass.
+
+ \since 6.7
+ \sa setEnabledFeaturesModifier()
+ */
+
+/*!
+ Sets the enabled device features modification function \a modifier.
+ \overload
+ \since 6.7
+ \sa EnabledFeatures2Modifier
+*/
+void QVulkanWindow::setEnabledFeaturesModifier(EnabledFeatures2Modifier modifier)
+{
+ Q_D(QVulkanWindow);
+ d->enabledFeatures2Modifier = std::move(modifier);
+}
/*!
Returns true if this window has successfully initialized all Vulkan
@@ -1750,7 +1833,7 @@ void QVulkanWindowRenderer::releaseResources()
}
/*!
- \fn QVulkanWindowRenderer::startNextFrame()
+ \fn void QVulkanWindowRenderer::startNextFrame()
This virtual function is called when the draw calls for the next frame are
to be added to the command buffer.
@@ -1813,13 +1896,26 @@ void QVulkanWindowRenderer::logicalDeviceLost()
{
}
+QSize QVulkanWindowPrivate::surfacePixelSize() const
+{
+ Q_Q(const QVulkanWindow);
+ VkSurfaceCapabilitiesKHR surfaceCaps = {};
+ vkGetPhysicalDeviceSurfaceCapabilitiesKHR(physDevs.at(physDevIndex), surface, &surfaceCaps);
+ VkExtent2D bufferSize = surfaceCaps.currentExtent;
+ if (bufferSize.width == uint32_t(-1)) {
+ Q_ASSERT(bufferSize.height == uint32_t(-1));
+ return q->size() * q->devicePixelRatio();
+ }
+ return QSize(int(bufferSize.width), int(bufferSize.height));
+}
+
void QVulkanWindowPrivate::beginFrame()
{
if (!swapChain || framePending)
return;
Q_Q(QVulkanWindow);
- if (q->size() * q->devicePixelRatio() != swapChainImageSize) {
+ if (swapChainImageSize != surfacePixelSize()) {
recreateSwapChain();
if (!swapChain)
return;
@@ -1888,7 +1984,7 @@ void QVulkanWindowPrivate::beginFrame()
}
if (frameGrabbing)
- frameGrabTargetImage = QImage(swapChainImageSize, QImage::Format_RGBA8888);
+ frameGrabTargetImage = QImage(swapChainImageSize, QImage::Format_RGBA8888); // the format is as documented
if (renderer) {
framePending = true;
@@ -2022,7 +2118,7 @@ void QVulkanWindowPrivate::endFrame()
// order to circumvent driver frame callbacks
inst->presentAboutToBeQueued(q);
- err = vkQueuePresentKHR(gfxQueue, &presInfo);
+ err = vkQueuePresentKHR(presQueue, &presInfo);
if (err != VK_SUCCESS) {
if (err == VK_ERROR_OUT_OF_DATE_KHR) {
recreateSwapChain();
@@ -2234,7 +2330,7 @@ void QVulkanWindowPrivate::finishBlockingReadback()
VkPhysicalDevice QVulkanWindow::physicalDevice() const
{
Q_D(const QVulkanWindow);
- if (d->physDevIndex < d->physDevs.count())
+ if (d->physDevIndex < d->physDevs.size())
return d->physDevs[d->physDevIndex];
qWarning("QVulkanWindow: Physical device not available");
return VK_NULL_HANDLE;
@@ -2250,7 +2346,7 @@ VkPhysicalDevice QVulkanWindow::physicalDevice() const
const VkPhysicalDeviceProperties *QVulkanWindow::physicalDeviceProperties() const
{
Q_D(const QVulkanWindow);
- if (d->physDevIndex < d->physDevProps.count())
+ if (d->physDevIndex < d->physDevProps.size())
return &d->physDevProps[d->physDevIndex];
qWarning("QVulkanWindow: Physical device properties not available");
return nullptr;
@@ -2404,6 +2500,19 @@ VkFormat QVulkanWindow::depthStencilFormat() const
This usually matches the size of the window, but may also differ in case
\c vkGetPhysicalDeviceSurfaceCapabilitiesKHR reports a fixed size.
+ In addition, it has been observed on some platforms that the
+ Vulkan-reported surface size is different with high DPI scaling active,
+ meaning the QWindow-reported
+ \l{QWindow::}{size()} multiplied with the \l{QWindow::}{devicePixelRatio()}
+ was 1 pixel less or more when compared to the value returned from here,
+ presumably due to differences in rounding. Rendering code should be aware
+ of this, and any related rendering logic must be based in the value returned
+ from here, never on the QWindow-reported size. Regardless of which pixel size
+ is correct in theory, Vulkan rendering must only ever rely on the Vulkan
+ API-reported surface size. Otherwise validation errors may occur, e.g. when
+ setting the viewport, because the application-provided values may become
+ out-of-bounds from Vulkan's perspective.
+
\note Calling this function is only valid from the invocation of
QVulkanWindowRenderer::initSwapChainResources() up until
QVulkanWindowRenderer::releaseSwapChainResources().
@@ -2675,6 +2784,12 @@ bool QVulkanWindow::supportsGrab() const
incomplete image, that has the correct size but not the content yet. The
content will be delivered via the frameGrabbed() signal in the latter case.
+ The returned QImage always has a format of QImage::Format_RGBA8888. If the
+ colorFormat() is \c VK_FORMAT_B8G8R8A8_UNORM, the red and blue channels are
+ swapped automatically since this format is commonly used as the default
+ choice for swapchain color buffers. With any other color buffer format,
+ there is no conversion performed by this function.
+
\note This function should not be called when a frame is in progress
(that is, frameReady() has not yet been called back by the application).
@@ -2703,6 +2818,9 @@ QImage QVulkanWindow::grab()
d->frameGrabbing = true;
d->beginFrame();
+ if (d->colorFormat == VK_FORMAT_B8G8R8A8_UNORM)
+ d->frameGrabTargetImage = std::move(d->frameGrabTargetImage).rgbSwapped();
+
return d->frameGrabTargetImage;
}
@@ -2731,3 +2849,5 @@ QMatrix4x4 QVulkanWindow::clipCorrectionMatrix()
}
QT_END_NAMESPACE
+
+#include "moc_qvulkanwindow.cpp"
diff --git a/src/gui/vulkan/qvulkanwindow.h b/src/gui/vulkan/qvulkanwindow.h
index 530b6c0744..537dbc4ae1 100644
--- a/src/gui/vulkan/qvulkanwindow.h
+++ b/src/gui/vulkan/qvulkanwindow.h
@@ -1,41 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2017 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the QtGui module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2017 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#ifndef QVULKANWINDOW_H
#define QVULKANWINDOW_H
@@ -44,9 +8,10 @@
#if 0
#pragma qt_no_master_include
+#pragma qt_sync_skip_header_check
#endif
-#if QT_CONFIG(vulkan) || defined(Q_CLANG_QDOC)
+#if QT_CONFIG(vulkan) || defined(Q_QDOC)
#include <QtGui/qvulkaninstance.h>
#include <QtGui/qwindow.h>
@@ -54,6 +19,20 @@
#include <QtGui/qmatrix4x4.h>
#include <QtCore/qset.h>
+#ifdef Q_QDOC
+typedef void* VkQueue;
+typedef void* VkCommandPool;
+typedef void* VkRenderPass;
+typedef void* VkCommandBuffer;
+typedef void* VkFramebuffer;
+typedef int VkPhysicalDeviceProperties;
+typedef int VkFormat;
+typedef int VkQueueFamilyProperties;
+typedef int VkDeviceQueueCreateInfo;
+typedef int VkFormat;
+typedef int VkSampleCountFlagBits;
+#endif
+
QT_BEGIN_NAMESPACE
class QVulkanWindowPrivate;
@@ -75,6 +54,14 @@ public:
virtual void logicalDeviceLost();
};
+#ifndef VK_VERSION_1_1
+typedef struct VkPhysicalDeviceFeatures2 {
+ VkStructureType sType;
+ void* pNext;
+ VkPhysicalDeviceFeatures features;
+} VkPhysicalDeviceFeatures2;
+#endif
+
class Q_GUI_EXPORT QVulkanWindow : public QWindow
{
Q_OBJECT
@@ -92,22 +79,26 @@ public:
void setFlags(Flags flags);
Flags flags() const;
- QVector<VkPhysicalDeviceProperties> availablePhysicalDevices();
+ QList<VkPhysicalDeviceProperties> availablePhysicalDevices();
void setPhysicalDeviceIndex(int idx);
QVulkanInfoVector<QVulkanExtension> supportedDeviceExtensions();
void setDeviceExtensions(const QByteArrayList &extensions);
- void setPreferredColorFormats(const QVector<VkFormat> &formats);
+ typedef std::function<void(VkPhysicalDeviceFeatures &)> EnabledFeaturesModifier;
+ void setEnabledFeaturesModifier(const EnabledFeaturesModifier &modifier);
+ typedef std::function<void(VkPhysicalDeviceFeatures2 &)> EnabledFeatures2Modifier;
+ void setEnabledFeaturesModifier(EnabledFeatures2Modifier modifier);
+
+ void setPreferredColorFormats(const QList<VkFormat> &formats);
- QVector<int> supportedSampleCounts();
+ QList<int> supportedSampleCounts();
void setSampleCount(int sampleCount);
- typedef std::function<void(const VkQueueFamilyProperties *,
- uint32_t,
- QVector<VkDeviceQueueCreateInfo> &)> QueueCreateInfoModifier;
- QueueCreateInfoModifier queueCreateInfoModifier() const;
- void setQueueCreateInfoModifier(QueueCreateInfoModifier modifier);
+ typedef std::function<void(const VkQueueFamilyProperties *, uint32_t,
+ QList<VkDeviceQueueCreateInfo> &)>
+ QueueCreateInfoModifier;
+ void setQueueCreateInfoModifier(const QueueCreateInfoModifier &modifier);
bool isValid() const;
diff --git a/src/gui/vulkan/qvulkanwindow_p.h b/src/gui/vulkan/qvulkanwindow_p.h
index 915e359673..7a0ee091e6 100644
--- a/src/gui/vulkan/qvulkanwindow_p.h
+++ b/src/gui/vulkan/qvulkanwindow_p.h
@@ -1,48 +1,12 @@
-/****************************************************************************
-**
-** Copyright (C) 2017 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the QtGui module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2017 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#ifndef QVULKANWINDOW_P_H
#define QVULKANWINDOW_P_H
#include <QtGui/private/qtguiglobal_p.h>
-#if QT_CONFIG(vulkan) || defined(Q_CLANG_QDOC)
+#if QT_CONFIG(vulkan) || defined(Q_QDOC)
#include "qvulkanwindow.h"
#include <QtCore/QHash>
@@ -61,7 +25,7 @@
QT_BEGIN_NAMESPACE
-class QVulkanWindowPrivate : public QWindowPrivate
+class Q_GUI_EXPORT QVulkanWindowPrivate : public QWindowPrivate
{
Q_DECLARE_PUBLIC(QVulkanWindow)
@@ -72,6 +36,7 @@ public:
void init();
void reset();
bool createDefaultRenderPass();
+ QSize surfacePixelSize() const;
void recreateSwapChain();
uint32_t chooseTransientImageMemType(VkImage img, uint32_t startIndex);
bool createTransientImage(VkFormat format, VkImageUsageFlags usage, VkImageAspectFlags aspectMask,
@@ -95,14 +60,16 @@ public:
QVulkanInstance *inst = nullptr;
VkSurfaceKHR surface = VK_NULL_HANDLE;
int physDevIndex = 0;
- QVector<VkPhysicalDevice> physDevs;
- QVector<VkPhysicalDeviceProperties> physDevProps;
+ QList<VkPhysicalDevice> physDevs;
+ QList<VkPhysicalDeviceProperties> physDevProps;
QVulkanWindow::Flags flags;
QByteArrayList requestedDevExtensions;
QHash<VkPhysicalDevice, QVulkanInfoVector<QVulkanExtension> > supportedDevExtensions;
- QVector<VkFormat> requestedColorFormats;
+ QList<VkFormat> requestedColorFormats;
VkSampleCountFlagBits sampleCount = VK_SAMPLE_COUNT_1_BIT;
QVulkanWindow::QueueCreateInfoModifier queueCreateInfoModifier;
+ QVulkanWindow::EnabledFeaturesModifier enabledFeaturesModifier;
+ QVulkanWindow::EnabledFeatures2Modifier enabledFeatures2Modifier;
VkDevice dev = VK_NULL_HANDLE;
QVulkanDeviceFunctions *devFuncs;
@@ -126,13 +93,13 @@ public:
PFN_vkGetPhysicalDeviceSurfaceCapabilitiesKHR vkGetPhysicalDeviceSurfaceCapabilitiesKHR = nullptr;
PFN_vkGetPhysicalDeviceSurfaceFormatsKHR vkGetPhysicalDeviceSurfaceFormatsKHR;
- static const int MAX_SWAPCHAIN_BUFFER_COUNT = 3;
+ static const int MAX_SWAPCHAIN_BUFFER_COUNT = 4;
static const int MAX_FRAME_LAG = QVulkanWindow::MAX_CONCURRENT_FRAME_COUNT;
// QVulkanWindow only supports the always available FIFO mode. The
// rendering thread will get throttled to the presentation rate (vsync).
// This is in effect Example 5 from the VK_KHR_swapchain spec.
VkPresentModeKHR presentMode = VK_PRESENT_MODE_FIFO_KHR;
- int swapChainBufferCount = 2;
+ int swapChainBufferCount = 0;
int frameLag = 2;
QSize swapChainImageSize;
diff --git a/src/gui/vulkan/vk.xml b/src/gui/vulkan/vk.xml
index 779875b819..84690f07b2 100644
--- a/src/gui/vulkan/vk.xml
+++ b/src/gui/vulkan/vk.xml
@@ -1,265 +1,532 @@
<?xml version="1.0" encoding="UTF-8"?>
<registry>
<comment>
-Copyright (c) 2015-2017 The Khronos Group Inc.
+Copyright 2015-2022 The Khronos Group Inc.
-Permission is hereby granted, free of charge, to any person obtaining a
-copy of this software and/or associated documentation files (the
-"Materials"), to deal in the Materials without restriction, including
-without limitation the rights to use, copy, modify, merge, publish,
-distribute, sublicense, and/or sell copies of the Materials, and to
-permit persons to whom the Materials are furnished to do so, subject to
-the following conditions:
-
-The above copyright notice and this permission notice shall be included
-in all copies or substantial portions of the Materials.
-
-THE MATERIALS ARE PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
-IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
-CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
-TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
-MATERIALS OR THE USE OR OTHER DEALINGS IN THE MATERIALS.
-
-------------------------------------------------------------------------
+SPDX-License-Identifier: Apache-2.0 OR MIT
+ </comment>
+ <comment>
This file, vk.xml, is the Vulkan API Registry. It is a critically important
and normative part of the Vulkan Specification, including a canonical
machine-readable definition of the API, parameter and member validation
language incorporated into the Specification and reference pages, and other
material which is registered by Khronos, such as tags used by extension and
-layer authors. The only authoritative version of vk.xml is the one
-maintained in the master branch of the Khronos Vulkan GitHub project.
+layer authors. The authoritative public version of vk.xml is maintained in
+the default branch (currently named main) of the Khronos Vulkan GitHub
+project. The authoritative private version is maintained in the default
+branch of the member gitlab server.
</comment>
- <!-- SECTION: Vulkan vendor IDs for physical devices without PCI vendor IDs -->
- <vendorids>
- <vendorid name="KHR" id="0x10000" comment="This is the next available Khronos vendor ID"/>
- <vendorid name="VIV" id="0x10001" comment="Vivante vendor ID"/>
- <vendorid name="VSI" id="0x10002" comment="VeriSilicon vendor ID"/>
- </vendorids>
+ <platforms comment="Vulkan platform names, reserved for use with platform- and window system-specific extensions">
+ <platform name="xlib" protect="VK_USE_PLATFORM_XLIB_KHR" comment="X Window System, Xlib client library"/>
+ <platform name="xlib_xrandr" protect="VK_USE_PLATFORM_XLIB_XRANDR_EXT" comment="X Window System, Xlib client library, XRandR extension"/>
+ <platform name="xcb" protect="VK_USE_PLATFORM_XCB_KHR" comment="X Window System, Xcb client library"/>
+ <platform name="wayland" protect="VK_USE_PLATFORM_WAYLAND_KHR" comment="Wayland display server protocol"/>
+ <platform name="directfb" protect="VK_USE_PLATFORM_DIRECTFB_EXT" comment="DirectFB library"/>
+ <platform name="android" protect="VK_USE_PLATFORM_ANDROID_KHR" comment="Android OS"/>
+ <platform name="win32" protect="VK_USE_PLATFORM_WIN32_KHR" comment="Microsoft Win32 API (also refers to Win64 apps)"/>
+ <platform name="vi" protect="VK_USE_PLATFORM_VI_NN" comment="Nintendo Vi"/>
+ <platform name="ios" protect="VK_USE_PLATFORM_IOS_MVK" comment="Apple IOS"/>
+ <platform name="macos" protect="VK_USE_PLATFORM_MACOS_MVK" comment="Apple MacOS"/>
+ <platform name="metal" protect="VK_USE_PLATFORM_METAL_EXT" comment="Metal on CoreAnimation on Apple platforms"/>
+ <platform name="fuchsia" protect="VK_USE_PLATFORM_FUCHSIA" comment="Fuchsia"/>
+ <platform name="ggp" protect="VK_USE_PLATFORM_GGP" comment="Google Games Platform"/>
+ <platform name="provisional" protect="VK_ENABLE_BETA_EXTENSIONS" comment="Enable declarations for beta/provisional extensions"/>
+ <platform name="screen" protect="VK_USE_PLATFORM_SCREEN_QNX" comment="QNX Screen Graphics Subsystem"/>
+ </platforms>
- <!-- SECTION: Vulkan vendor/author tags for extensions and layers -->
- <tags>
+ <tags comment="Vulkan vendor/author tags for extensions and layers">
<tag name="IMG" author="Imagination Technologies" contact="Michael Worcester @michaelworcester"/>
- <tag name="AMD" author="Advanced Micro Devices, Inc." contact="Daniel Rakos @aqnuep"/>
- <tag name="ARM" author="ARM Limited" contact="Jan-Harald Fredriksen @janharald"/>
+ <tag name="AMD" author="Advanced Micro Devices, Inc." contact="Daniel Rakos @drakos-amd"/>
+ <tag name="AMDX" author="Advanced Micro Devices, Inc." contact="Daniel Rakos @drakos-amd"/>
+ <tag name="ARM" author="ARM Limited" contact="Jan-Harald Fredriksen @janharaldfredriksen-arm"/>
<tag name="FSL" author="Freescale Semiconductor, Inc." contact="Norbert Nopper @FslNopper"/>
<tag name="BRCM" author="Broadcom Corporation" contact="Graeme Leese @gnl21"/>
<tag name="NXP" author="NXP Semiconductors N.V." contact="Norbert Nopper @FslNopper"/>
<tag name="NV" author="NVIDIA Corporation" contact="Daniel Koch @dgkoch"/>
<tag name="NVX" author="NVIDIA Corporation" contact="Daniel Koch @dgkoch"/>
- <tag name="VIV" author="Vivante Corporation" contact="Yanjun Zhang @yanjunzhang"/>
- <tag name="VSI" author="VeriSilicon Holdings Co., Ltd." contact="Yanjun Zhang @yanjunzhang"/>
+ <tag name="VIV" author="Vivante Corporation" contact="Yanjun Zhang gitlab:@yanjunzhang"/>
+ <tag name="VSI" author="VeriSilicon Holdings Co., Ltd." contact="Yanjun Zhang gitlab:@yanjunzhang"/>
<tag name="KDAB" author="KDAB" contact="Sean Harmer @seanharmer"/>
- <tag name="ANDROID" author="Google, Inc." contact="Jesse Hall @jessehall"/>
- <tag name="CHROMIUM" author="Google, Inc." contact="Jesse Hall @jessehall"/>
- <tag name="GOOGLE" author="Google, Inc." contact="Jesse Hall @jessehall"/>
- <tag name="QCOM" author="Qualcomm Technologies, Inc." contact="Maurice Ribble @mribble"/>
- <tag name="LUNARG" author="LunarG, Inc." contact="Karen Ghavam @KarenGhavam"/>
+ <tag name="ANDROID" author="Google LLC" contact="Jesse Hall @critsec"/>
+ <tag name="CHROMIUM" author="Google LLC" contact="Jesse Hall @critsec"/>
+ <tag name="FUCHSIA" author="Google LLC" contact="Craig Stout @cdotstout, Jesse Hall @critsec, John Rosasco @rosasco"/>
+ <tag name="GGP" author="Google, LLC" contact="Jean-Francois Roy @jfroy, Hai Nguyen @chaoticbob, Jesse Hall @critsec"/>
+ <tag name="GOOGLE" author="Google LLC" contact="Jesse Hall @critsec"/>
+ <tag name="QCOM" author="Qualcomm Technologies, Inc." contact="Jeff Leger @jackohounhd"/>
+ <tag name="LUNARG" author="LunarG, Inc." contact="Karen Ghavam @karenghavam-lunarg"/>
+ <tag name="NZXT" author="NZXT Inc." contact="Jacob Kiesel @xaeroxe"/>
<tag name="SAMSUNG" author="Samsung Electronics Co., Ltd." contact="Alon Or-bach @alonorbach"/>
<tag name="SEC" author="Samsung Electronics Co., Ltd." contact="Alon Or-bach @alonorbach"/>
<tag name="TIZEN" author="Samsung Electronics Co., Ltd." contact="Alon Or-bach @alonorbach"/>
- <tag name="RENDERDOC" author="RenderDoc (renderdoc.org)" contact="baldurk@baldurk.org"/>
- <tag name="NN" author="Nintendo Co., Ltd." contact="Yasuhiro Yoshioka @yoshioka_yasuhiro"/>
+ <tag name="RENDERDOC" author="RenderDoc (renderdoc.org)" contact="Baldur Karlsson @baldurk"/>
+ <tag name="NN" author="Nintendo Co., Ltd." contact="Yasuhiro Yoshioka gitlab:@yoshioka_yasuhiro"/>
+ <tag name="MVK" author="The Brenwill Workshop Ltd." contact="Bill Hollings @billhollings"/>
+ <tag name="KHR" author="Khronos" contact="Tom Olson @tomolson"/>
+ <tag name="KHX" author="Khronos" contact="Tom Olson @tomolson"/>
+ <tag name="EXT" author="Multivendor" contact="Jon Leech @oddhack"/>
+ <tag name="MESA" author="Mesa open source project" contact="Chad Versace @chadversary, Daniel Stone @fooishbar, David Airlie @airlied, Jason Ekstrand @jekstrand"/>
+ <tag name="INTEL" author="Intel Corporation" contact="Slawek Grajewski @sgrajewski"/>
+ <tag name="HUAWEI" author="Huawei Technologies Co. Ltd." contact="Pan Gao @PanGao-h, Juntao Li @Lawrenceleehw"/>
+ <tag name="VALVE" author="Valve Corporation" contact="Pierre-Loup Griffais @plagman, Joshua Ashton @Joshua-Ashton, Hans-Kristian Arntzen @HansKristian-Work"/>
+ <tag name="QNX" author="BlackBerry Limited" contact="Mike Gorchak @mgorchak-blackberry"/>
+ <tag name="JUICE" author="Juice Technologies, Inc." contact="David McCloskey @damcclos, Dean Beeler @canadacow"/>
+ <tag name="FB" author="Facebook, Inc" contact="Artem Bolgar @artyom17"/>
+ <tag name="RASTERGRID" author="RasterGrid Kft." contact="Daniel Rakos @aqnuep1"/>
</tags>
- <!-- SECTION: Vulkan type definitions -->
- <types>
+ <types comment="Vulkan type definitions">
<type name="vk_platform" category="include">#include "vk_platform.h"</type>
- <!-- WSI extensions -->
- <type category="include">#include "<name>vulkan.h</name>"</type>
- <type category="include">#include &lt;<name>X11/Xlib.h</name>&gt;</type>
- <type category="include">#include &lt;<name>X11/extensions/Xrandr.h</name>&gt;</type>
- <type category="include">#include &lt;<name>android/native_window.h</name>&gt;</type>
- <type category="include">#include &lt;<name>mir_toolkit/client_types.h</name>&gt;</type>
- <type category="include">#include &lt;<name>wayland-client.h</name>&gt;</type>
- <type category="include">#include &lt;<name>windows.h</name>&gt;</type>
- <type category="include">#include &lt;<name>xcb/xcb.h</name>&gt;</type>
+
+ <comment>WSI extensions</comment>
+
+ <type category="include" name="X11/Xlib.h"/>
+ <type category="include" name="X11/extensions/Xrandr.h"/>
+ <type category="include" name="wayland-client.h"/>
+ <type category="include" name="windows.h"/>
+ <type category="include" name="xcb/xcb.h"/>
+ <type category="include" name="directfb.h"/>
+ <type category="include" name="zircon/types.h"/>
+ <type category="include" name="ggp_c/vulkan_types.h"/>
+ <type category="include" name="screen/screen.h"/>
+ <comment>
+ In the current header structure, each platform's interfaces
+ are confined to a platform-specific header (vulkan_xlib.h,
+ vulkan_win32.h, etc.). These headers are not self-contained,
+ and should not include native headers (X11/Xlib.h,
+ windows.h, etc.). Code should either include vulkan.h after
+ defining the appropriate VK_USE_PLATFORM_platform
+ macros, or include the required native headers prior to
+ explicitly including the corresponding platform header.
+
+ To accomplish this, the dependencies of native types require
+ native headers, but the XML defines the content for those
+ native headers as empty. The actual native header includes
+ can be restored by modifying the native header tags above
+ to #include the header file in the 'name' attribute.
+ </comment>
<type requires="X11/Xlib.h" name="Display"/>
<type requires="X11/Xlib.h" name="VisualID"/>
<type requires="X11/Xlib.h" name="Window"/>
<type requires="X11/extensions/Xrandr.h" name="RROutput"/>
- <type requires="android/native_window.h" name="ANativeWindow"/>
- <type requires="mir_toolkit/client_types.h" name="MirConnection"/>
- <type requires="mir_toolkit/client_types.h" name="MirSurface"/>
<type requires="wayland-client.h" name="wl_display"/>
<type requires="wayland-client.h" name="wl_surface"/>
<type requires="windows.h" name="HINSTANCE"/>
<type requires="windows.h" name="HWND"/>
+ <type requires="windows.h" name="HMONITOR"/>
<type requires="windows.h" name="HANDLE"/>
<type requires="windows.h" name="SECURITY_ATTRIBUTES"/>
<type requires="windows.h" name="DWORD"/>
+ <type requires="windows.h" name="LPCWSTR"/>
<type requires="xcb/xcb.h" name="xcb_connection_t"/>
<type requires="xcb/xcb.h" name="xcb_visualid_t"/>
<type requires="xcb/xcb.h" name="xcb_window_t"/>
+ <type requires="directfb.h" name="IDirectFB"/>
+ <type requires="directfb.h" name="IDirectFBSurface"/>
+ <type requires="zircon/types.h" name="zx_handle_t"/>
+ <type requires="ggp_c/vulkan_types.h" name="GgpStreamDescriptor"/>
+ <type requires="ggp_c/vulkan_types.h" name="GgpFrameToken"/>
+ <type requires="screen/screen.h" name="_screen_context"/>
+ <type requires="screen/screen.h" name="_screen_window"/>
+
+ <type category="define">// DEPRECATED: This define is deprecated. VK_MAKE_API_VERSION should be used instead.
+#define <name>VK_MAKE_VERSION</name>(major, minor, patch) \
+ ((((uint32_t)(major)) &lt;&lt; 22) | (((uint32_t)(minor)) &lt;&lt; 12) | ((uint32_t)(patch)))</type>
+ <type category="define">// DEPRECATED: This define is deprecated. VK_API_VERSION_MAJOR should be used instead.
+#define <name>VK_VERSION_MAJOR</name>(version) ((uint32_t)(version) &gt;&gt; 22)</type>
+ <type category="define">// DEPRECATED: This define is deprecated. VK_API_VERSION_MINOR should be used instead.
+#define <name>VK_VERSION_MINOR</name>(version) (((uint32_t)(version) &gt;&gt; 12) &amp; 0x3FFU)</type>
+ <type category="define">// DEPRECATED: This define is deprecated. VK_API_VERSION_PATCH should be used instead.
+#define <name>VK_VERSION_PATCH</name>(version) ((uint32_t)(version) &amp; 0xFFFU)</type>
- <type category="define">#define <name>VK_MAKE_VERSION</name>(major, minor, patch) \
- (((major) &lt;&lt; 22) | ((minor) &lt;&lt; 12) | (patch))</type>
- <type category="define">#define <name>VK_VERSION_MAJOR</name>(version) ((uint32_t)(version) &gt;&gt; 22)</type>
- <type category="define">#define <name>VK_VERSION_MINOR</name>(version) (((uint32_t)(version) &gt;&gt; 12) &amp; 0x3ff)</type>
- <type category="define">#define <name>VK_VERSION_PATCH</name>(version) ((uint32_t)(version) &amp; 0xfff)</type>
+ <type category="define">#define <name>VK_MAKE_API_VERSION</name>(variant, major, minor, patch) \
+ ((((uint32_t)(variant)) &lt;&lt; 29) | (((uint32_t)(major)) &lt;&lt; 22) | (((uint32_t)(minor)) &lt;&lt; 12) | ((uint32_t)(patch)))</type>
+ <type category="define">#define <name>VK_API_VERSION_VARIANT</name>(version) ((uint32_t)(version) &gt;&gt; 29)</type>
+ <type category="define">#define <name>VK_API_VERSION_MAJOR</name>(version) (((uint32_t)(version) &gt;&gt; 22) &amp; 0x7FU)</type>
+ <type category="define">#define <name>VK_API_VERSION_MINOR</name>(version) (((uint32_t)(version) &gt;&gt; 12) &amp; 0x3FFU)</type>
+ <type category="define">#define <name>VK_API_VERSION_PATCH</name>(version) ((uint32_t)(version) &amp; 0xFFFU)</type>
<type category="define">// DEPRECATED: This define has been removed. Specific version defines (e.g. VK_API_VERSION_1_0), or the VK_MAKE_VERSION macro, should be used instead.
-//#define <name>VK_API_VERSION</name> <type>VK_MAKE_VERSION</type>(1, 0, 0)</type> <!-- The patch version here should never be set to anything other than 0 -->
- <type category="define">// Vulkan 1.0 version number
-#define <name>VK_API_VERSION_1_0</name> <type>VK_MAKE_VERSION</type>(1, 0, 0)</type> <!-- The patch version here should never be set to anything other than 0 -->
+//#define <name>VK_API_VERSION</name> <type>VK_MAKE_VERSION</type>(1, 0, 0) // Patch version should always be set to 0</type>
+ <type category="define" requires="VK_MAKE_API_VERSION">// Vulkan 1.0 version number
+#define <name>VK_API_VERSION_1_0</name> <type>VK_MAKE_API_VERSION</type>(0, 1, 0, 0)// Patch version should always be set to 0</type>
+ <type category="define" requires="VK_MAKE_API_VERSION">// Vulkan 1.1 version number
+#define <name>VK_API_VERSION_1_1</name> <type>VK_MAKE_API_VERSION</type>(0, 1, 1, 0)// Patch version should always be set to 0</type>
+ <type category="define" requires="VK_MAKE_API_VERSION">// Vulkan 1.2 version number
+#define <name>VK_API_VERSION_1_2</name> <type>VK_MAKE_API_VERSION</type>(0, 1, 2, 0)// Patch version should always be set to 0</type>
+ <type category="define" requires="VK_MAKE_API_VERSION">// Vulkan 1.3 version number
+#define <name>VK_API_VERSION_1_3</name> <type>VK_MAKE_API_VERSION</type>(0, 1, 3, 0)// Patch version should always be set to 0</type>
<type category="define">// Version of this file
-#define <name>VK_HEADER_VERSION</name> 39</type>
+#define <name>VK_HEADER_VERSION</name> 223</type>
+ <type category="define" requires="VK_HEADER_VERSION">// Complete version of this file
+#define <name>VK_HEADER_VERSION_COMPLETE</name> <type>VK_MAKE_API_VERSION</type>(0, 1, 3, VK_HEADER_VERSION)</type>
<type category="define">
#define <name>VK_DEFINE_HANDLE</name>(object) typedef struct object##_T* object;</type>
- <type category="define" name="VK_DEFINE_NON_DISPATCHABLE_HANDLE">
-#if !defined(VK_DEFINE_NON_DISPATCHABLE_HANDLE)
-#if defined(__LP64__) || defined(_WIN64) || (defined(__x86_64__) &amp;&amp; !defined(__ILP32__) ) || defined(_M_X64) || defined(__ia64) || defined (_M_IA64) || defined(__aarch64__) || defined(__powerpc64__)
+ <type category="define" name="VK_USE_64_BIT_PTR_DEFINES">
+#ifndef VK_USE_64_BIT_PTR_DEFINES
+ #if defined(__LP64__) || defined(_WIN64) || (defined(__x86_64__) &amp;&amp; !defined(__ILP32__) ) || defined(_M_X64) || defined(__ia64) || defined (_M_IA64) || defined(__aarch64__) || defined(__powerpc64__)
+ #define VK_USE_64_BIT_PTR_DEFINES 1
+ #else
+ #define VK_USE_64_BIT_PTR_DEFINES 0
+ #endif
+#endif</type>
+ <type category="define" requires="VK_USE_64_BIT_PTR_DEFINES" name="VK_NULL_HANDLE">
+#ifndef VK_DEFINE_NON_DISPATCHABLE_HANDLE
+ #if (VK_USE_64_BIT_PTR_DEFINES==1)
+ #if (defined(__cplusplus) &amp;&amp; (__cplusplus >= 201103L)) || (defined(_MSVC_LANG) &amp;&amp; (_MSVC_LANG >= 201103L))
+ #define VK_NULL_HANDLE nullptr
+ #else
+ #define VK_NULL_HANDLE ((void*)0)
+ #endif
+ #else
+ #define VK_NULL_HANDLE 0ULL
+ #endif
+#endif
+#ifndef VK_NULL_HANDLE
+ #define VK_NULL_HANDLE 0
+#endif</type>
+ <type category="define" requires="VK_NULL_HANDLE" name="VK_DEFINE_NON_DISPATCHABLE_HANDLE">
+#ifndef VK_DEFINE_NON_DISPATCHABLE_HANDLE
+ #if (VK_USE_64_BIT_PTR_DEFINES==1)
#define VK_DEFINE_NON_DISPATCHABLE_HANDLE(object) typedef struct object##_T *object;
-#else
+ #else
#define VK_DEFINE_NON_DISPATCHABLE_HANDLE(object) typedef uint64_t object;
-#endif
-#endif
- </type>
+ #endif
+#endif</type>
- <type category="define">
-#define <name>VK_NULL_HANDLE</name> 0
- </type>
+ <type category="basetype">struct <name>ANativeWindow</name>;</type>
+ <type category="basetype">struct <name>AHardwareBuffer</name>;</type>
+ <type category="basetype">#ifdef __OBJC__
+@class CAMetalLayer;
+#else
+typedef void <name>CAMetalLayer</name>;
+#endif</type>
+ <type category="basetype">#ifdef __OBJC__
+@protocol MTLDevice;
+typedef id&lt;MTLDevice&gt; MTLDevice_id;
+#else
+typedef void* <name>MTLDevice_id</name>;
+#endif</type>
+ <type category="basetype">#ifdef __OBJC__
+@protocol MTLCommandQueue;
+typedef id&lt;MTLCommandQueue&gt; MTLCommandQueue_id;
+#else
+typedef void* <name>MTLCommandQueue_id</name>;
+#endif</type>
+ <type category="basetype">#ifdef __OBJC__
+@protocol MTLBuffer;
+typedef id&lt;MTLBuffer&gt; MTLBuffer_id;
+#else
+typedef void* <name>MTLBuffer_id</name>;
+#endif</type>
+ <type category="basetype">#ifdef __OBJC__
+@protocol MTLTexture;
+typedef id&lt;MTLTexture&gt; MTLTexture_id;
+#else
+typedef void* <name>MTLTexture_id</name>;
+#endif</type>
+ <type category="basetype">#ifdef __OBJC__
+@protocol MTLSharedEvent;
+typedef id&lt;MTLSharedEvent&gt; MTLSharedEvent_id;
+#else
+typedef void* <name>MTLSharedEvent_id</name>;
+#endif</type>
+ <type category="basetype">typedef struct __IOSurface* <name>IOSurfaceRef</name>;</type>
<type category="basetype">typedef <type>uint32_t</type> <name>VkSampleMask</name>;</type>
<type category="basetype">typedef <type>uint32_t</type> <name>VkBool32</name>;</type>
<type category="basetype">typedef <type>uint32_t</type> <name>VkFlags</name>;</type>
+ <type category="basetype">typedef <type>uint64_t</type> <name>VkFlags64</name>;</type>
<type category="basetype">typedef <type>uint64_t</type> <name>VkDeviceSize</name>;</type>
- <!-- Basic C types, pulled in via vk_platform.h -->
+ <type category="basetype">typedef <type>uint64_t</type> <name>VkDeviceAddress</name>;</type>
+
+ <comment>Basic C types, pulled in via vk_platform.h</comment>
<type requires="vk_platform" name="void"/>
<type requires="vk_platform" name="char"/>
<type requires="vk_platform" name="float"/>
+ <type requires="vk_platform" name="double"/>
+ <type requires="vk_platform" name="int8_t"/>
<type requires="vk_platform" name="uint8_t"/>
+ <type requires="vk_platform" name="int16_t"/>
+ <type requires="vk_platform" name="uint16_t"/>
<type requires="vk_platform" name="uint32_t"/>
<type requires="vk_platform" name="uint64_t"/>
<type requires="vk_platform" name="int32_t"/>
+ <type requires="vk_platform" name="int64_t"/>
<type requires="vk_platform" name="size_t"/>
- <!-- Bitmask types -->
- <type category="bitmask">typedef <type>VkFlags</type> <name>VkFramebufferCreateFlags</name>;</type> <!-- creation flags -->
- <type category="bitmask">typedef <type>VkFlags</type> <name>VkQueryPoolCreateFlags</name>;</type> <!-- creation flags -->
- <type category="bitmask">typedef <type>VkFlags</type> <name>VkRenderPassCreateFlags</name>;</type> <!-- creation flags -->
- <type category="bitmask">typedef <type>VkFlags</type> <name>VkSamplerCreateFlags</name>;</type> <!-- creation flags -->
- <type category="bitmask">typedef <type>VkFlags</type> <name>VkPipelineLayoutCreateFlags</name>;</type> <!-- creation flags -->
- <type category="bitmask">typedef <type>VkFlags</type> <name>VkPipelineCacheCreateFlags</name>;</type> <!-- creation flags -->
- <type category="bitmask">typedef <type>VkFlags</type> <name>VkPipelineDepthStencilStateCreateFlags</name>;</type> <!-- creation flags -->
- <type category="bitmask">typedef <type>VkFlags</type> <name>VkPipelineDynamicStateCreateFlags</name>;</type> <!-- creation flags -->
- <type category="bitmask">typedef <type>VkFlags</type> <name>VkPipelineColorBlendStateCreateFlags</name>;</type> <!-- creation flags -->
- <type category="bitmask">typedef <type>VkFlags</type> <name>VkPipelineMultisampleStateCreateFlags</name>;</type> <!-- creation flags -->
- <type category="bitmask">typedef <type>VkFlags</type> <name>VkPipelineRasterizationStateCreateFlags</name>;</type> <!-- creation flags -->
- <type category="bitmask">typedef <type>VkFlags</type> <name>VkPipelineViewportStateCreateFlags</name>;</type> <!-- creation flags -->
- <type category="bitmask">typedef <type>VkFlags</type> <name>VkPipelineTessellationStateCreateFlags</name>;</type> <!-- creation flags -->
- <type category="bitmask">typedef <type>VkFlags</type> <name>VkPipelineInputAssemblyStateCreateFlags</name>;</type><!-- creation flags -->
- <type category="bitmask">typedef <type>VkFlags</type> <name>VkPipelineVertexInputStateCreateFlags</name>;</type> <!-- creation flags -->
- <type category="bitmask">typedef <type>VkFlags</type> <name>VkPipelineShaderStageCreateFlags</name>;</type> <!-- creation flags -->
- <type category="bitmask">typedef <type>VkFlags</type> <name>VkDescriptorSetLayoutCreateFlags</name>;</type> <!-- creation flags -->
- <type category="bitmask">typedef <type>VkFlags</type> <name>VkBufferViewCreateFlags</name>;</type> <!-- creation flags -->
- <type category="bitmask">typedef <type>VkFlags</type> <name>VkInstanceCreateFlags</name>;</type> <!-- creation flags -->
- <type category="bitmask">typedef <type>VkFlags</type> <name>VkDeviceCreateFlags</name>;</type> <!-- creation flags -->
- <type category="bitmask">typedef <type>VkFlags</type> <name>VkDeviceQueueCreateFlags</name>;</type> <!-- creation flags -->
- <type requires="VkQueueFlagBits" category="bitmask">typedef <type>VkFlags</type> <name>VkQueueFlags</name>;</type> <!-- Queue capabilities -->
- <type requires="VkMemoryPropertyFlagBits" category="bitmask">typedef <type>VkFlags</type> <name>VkMemoryPropertyFlags</name>;</type> <!-- Memory properties passed into vkAllocateMemory(). -->
- <type requires="VkMemoryHeapFlagBits" category="bitmask">typedef <type>VkFlags</type> <name>VkMemoryHeapFlags</name>;</type> <!-- Memory heap flags -->
- <type requires="VkAccessFlagBits" category="bitmask">typedef <type>VkFlags</type> <name>VkAccessFlags</name>;</type> <!-- Memory access flags passed to barrier/dependency operations -->
- <type requires="VkBufferUsageFlagBits" category="bitmask">typedef <type>VkFlags</type> <name>VkBufferUsageFlags</name>;</type> <!-- Buffer usage flags -->
- <type requires="VkBufferCreateFlagBits" category="bitmask">typedef <type>VkFlags</type> <name>VkBufferCreateFlags</name>;</type> <!-- Buffer creation flags -->
- <type requires="VkShaderStageFlagBits" category="bitmask">typedef <type>VkFlags</type> <name>VkShaderStageFlags</name>;</type> <!-- Shader stage flags -->
- <type requires="VkImageUsageFlagBits" category="bitmask">typedef <type>VkFlags</type> <name>VkImageUsageFlags</name>;</type> <!-- Image usage flags -->
- <type requires="VkImageCreateFlagBits" category="bitmask">typedef <type>VkFlags</type> <name>VkImageCreateFlags</name>;</type> <!-- Image creation flags -->
- <type category="bitmask">typedef <type>VkFlags</type> <name>VkImageViewCreateFlags</name>;</type> <!-- Image view creation flags (no bits yet) -->
- <type requires="VkPipelineCreateFlagBits" category="bitmask">typedef <type>VkFlags</type> <name>VkPipelineCreateFlags</name>;</type> <!-- Pipeline creation flags -->
- <type requires="VkColorComponentFlagBits" category="bitmask">typedef <type>VkFlags</type> <name>VkColorComponentFlags</name>;</type> <!-- Color component flags -->
- <type requires="VkFenceCreateFlagBits" category="bitmask">typedef <type>VkFlags</type> <name>VkFenceCreateFlags</name>;</type> <!-- Fence creation flags -->
- <type category="bitmask">typedef <type>VkFlags</type> <name>VkSemaphoreCreateFlags</name>;</type> <!-- Semaphore creation flags -->
- <type requires="VkFormatFeatureFlagBits" category="bitmask">typedef <type>VkFlags</type> <name>VkFormatFeatureFlags</name>;</type> <!-- Format capability flags -->
- <type requires="VkQueryControlFlagBits" category="bitmask">typedef <type>VkFlags</type> <name>VkQueryControlFlags</name>;</type> <!-- Query control flags -->
- <type requires="VkQueryResultFlagBits" category="bitmask">typedef <type>VkFlags</type> <name>VkQueryResultFlags</name>;</type> <!-- Query result flags -->
- <type category="bitmask">typedef <type>VkFlags</type> <name>VkShaderModuleCreateFlags</name>;</type> <!-- Shader module creation flags (no bits yet) -->
- <type category="bitmask">typedef <type>VkFlags</type> <name>VkEventCreateFlags</name>;</type> <!-- Event creation flags (no bits yet) -->
- <type requires="VkCommandPoolCreateFlagBits" category="bitmask">typedef <type>VkFlags</type> <name>VkCommandPoolCreateFlags</name>;</type> <!-- Command pool creation flags -->
- <type requires="VkCommandPoolResetFlagBits" category="bitmask">typedef <type>VkFlags</type> <name>VkCommandPoolResetFlags</name>;</type> <!-- Command pool reset flags -->
- <type requires="VkCommandBufferResetFlagBits" category="bitmask">typedef <type>VkFlags</type> <name>VkCommandBufferResetFlags</name>;</type> <!-- Command buffer reset flags -->
- <type requires="VkCommandBufferUsageFlagBits" category="bitmask">typedef <type>VkFlags</type> <name>VkCommandBufferUsageFlags</name>;</type> <!-- Command buffer usage flags -->
- <type requires="VkQueryPipelineStatisticFlagBits" category="bitmask">typedef <type>VkFlags</type> <name>VkQueryPipelineStatisticFlags</name>;</type> <!-- Pipeline statistics flags -->
- <type category="bitmask">typedef <type>VkFlags</type> <name>VkMemoryMapFlags</name>;</type> <!-- Memory mapping flags (no bits yet) -->
- <type requires="VkImageAspectFlagBits" category="bitmask">typedef <type>VkFlags</type> <name>VkImageAspectFlags</name>;</type> <!-- Bitmask of image aspects -->
- <type requires="VkSparseMemoryBindFlagBits" category="bitmask">typedef <type>VkFlags</type> <name>VkSparseMemoryBindFlags</name>;</type> <!-- Sparse memory bind flags -->
- <type requires="VkSparseImageFormatFlagBits" category="bitmask">typedef <type>VkFlags</type> <name>VkSparseImageFormatFlags</name>;</type> <!-- Sparse image memory requirements flags -->
- <type category="bitmask">typedef <type>VkFlags</type> <name>VkSubpassDescriptionFlags</name>;</type> <!-- Subpass description flags -->
- <type requires="VkPipelineStageFlagBits" category="bitmask">typedef <type>VkFlags</type> <name>VkPipelineStageFlags</name>;</type> <!-- Pipeline stages -->
- <type requires="VkSampleCountFlagBits" category="bitmask">typedef <type>VkFlags</type> <name>VkSampleCountFlags</name>;</type> <!-- Pipeline stages -->
- <type requires="VkAttachmentDescriptionFlagBits" category="bitmask">typedef <type>VkFlags</type> <name>VkAttachmentDescriptionFlags</name>;</type> <!-- Render pass attachment description flags -->
- <type requires="VkStencilFaceFlagBits" category="bitmask">typedef <type>VkFlags</type> <name>VkStencilFaceFlags</name>;</type> <!-- Stencil face flags -->
- <type requires="VkCullModeFlagBits" category="bitmask">typedef <type>VkFlags</type> <name>VkCullModeFlags</name>;</type> <!-- Cull mode flags -->
- <type requires="VkDescriptorPoolCreateFlagBits" category="bitmask">typedef <type>VkFlags</type> <name>VkDescriptorPoolCreateFlags</name>;</type> <!-- Descriptor pool creation flags -->
- <type category="bitmask">typedef <type>VkFlags</type> <name>VkDescriptorPoolResetFlags</name>;</type> <!-- Descriptor pool reset flags -->
- <type requires="VkDependencyFlagBits" category="bitmask">typedef <type>VkFlags</type> <name>VkDependencyFlags</name>;</type> <!-- Pipeline barrier and subpass dependency flags -->
+ <type name="int"/>
- <type requires="VkIndirectCommandsLayoutUsageFlagBitsNVX" category="bitmask">typedef <type>VkFlags</type> <name>VkIndirectCommandsLayoutUsageFlagsNVX</name>;</type> <!-- Device generated commands usage flags -->
- <type requires="VkObjectEntryUsageFlagBitsNVX" category="bitmask">typedef <type>VkFlags</type> <name>VkObjectEntryUsageFlagsNVX</name>;</type> <!-- Object usage flags -->
+ <comment>Bitmask types</comment>
+ <type requires="VkFramebufferCreateFlagBits" category="bitmask">typedef <type>VkFlags</type> <name>VkFramebufferCreateFlags</name>;</type>
+ <type category="bitmask">typedef <type>VkFlags</type> <name>VkQueryPoolCreateFlags</name>;</type>
+ <type requires="VkRenderPassCreateFlagBits" category="bitmask">typedef <type>VkFlags</type> <name>VkRenderPassCreateFlags</name>;</type>
+ <type requires="VkSamplerCreateFlagBits" category="bitmask">typedef <type>VkFlags</type> <name>VkSamplerCreateFlags</name>;</type>
+ <type requires="VkPipelineLayoutCreateFlagBits" category="bitmask">typedef <type>VkFlags</type> <name>VkPipelineLayoutCreateFlags</name>;</type>
+ <type requires="VkPipelineCacheCreateFlagBits" category="bitmask">typedef <type>VkFlags</type> <name>VkPipelineCacheCreateFlags</name>;</type>
+ <type requires="VkPipelineDepthStencilStateCreateFlagBits" category="bitmask">typedef <type>VkFlags</type> <name>VkPipelineDepthStencilStateCreateFlags</name>;</type>
+ <type category="bitmask">typedef <type>VkFlags</type> <name>VkPipelineDynamicStateCreateFlags</name>;</type>
+ <type requires="VkPipelineColorBlendStateCreateFlagBits" category="bitmask">typedef <type>VkFlags</type> <name>VkPipelineColorBlendStateCreateFlags</name>;</type>
+ <type category="bitmask">typedef <type>VkFlags</type> <name>VkPipelineMultisampleStateCreateFlags</name>;</type>
+ <type category="bitmask">typedef <type>VkFlags</type> <name>VkPipelineRasterizationStateCreateFlags</name>;</type>
+ <type category="bitmask">typedef <type>VkFlags</type> <name>VkPipelineViewportStateCreateFlags</name>;</type>
+ <type category="bitmask">typedef <type>VkFlags</type> <name>VkPipelineTessellationStateCreateFlags</name>;</type>
+ <type category="bitmask">typedef <type>VkFlags</type> <name>VkPipelineInputAssemblyStateCreateFlags</name>;</type>
+ <type category="bitmask">typedef <type>VkFlags</type> <name>VkPipelineVertexInputStateCreateFlags</name>;</type>
+ <type requires="VkPipelineShaderStageCreateFlagBits" category="bitmask">typedef <type>VkFlags</type> <name>VkPipelineShaderStageCreateFlags</name>;</type>
+ <type requires="VkDescriptorSetLayoutCreateFlagBits" category="bitmask">typedef <type>VkFlags</type> <name>VkDescriptorSetLayoutCreateFlags</name>;</type>
+ <type category="bitmask">typedef <type>VkFlags</type> <name>VkBufferViewCreateFlags</name>;</type>
+ <type requires="VkInstanceCreateFlagBits" category="bitmask">typedef <type>VkFlags</type> <name>VkInstanceCreateFlags</name>;</type>
+ <type category="bitmask">typedef <type>VkFlags</type> <name>VkDeviceCreateFlags</name>;</type>
+ <type requires="VkDeviceQueueCreateFlagBits" category="bitmask">typedef <type>VkFlags</type> <name>VkDeviceQueueCreateFlags</name>;</type>
+ <type requires="VkQueueFlagBits" category="bitmask">typedef <type>VkFlags</type> <name>VkQueueFlags</name>;</type>
+ <type requires="VkMemoryPropertyFlagBits" category="bitmask">typedef <type>VkFlags</type> <name>VkMemoryPropertyFlags</name>;</type>
+ <type requires="VkMemoryHeapFlagBits" category="bitmask">typedef <type>VkFlags</type> <name>VkMemoryHeapFlags</name>;</type>
+ <type requires="VkAccessFlagBits" category="bitmask">typedef <type>VkFlags</type> <name>VkAccessFlags</name>;</type>
+ <type requires="VkBufferUsageFlagBits" category="bitmask">typedef <type>VkFlags</type> <name>VkBufferUsageFlags</name>;</type>
+ <type requires="VkBufferCreateFlagBits" category="bitmask">typedef <type>VkFlags</type> <name>VkBufferCreateFlags</name>;</type>
+ <type requires="VkShaderStageFlagBits" category="bitmask">typedef <type>VkFlags</type> <name>VkShaderStageFlags</name>;</type>
+ <type requires="VkImageUsageFlagBits" category="bitmask">typedef <type>VkFlags</type> <name>VkImageUsageFlags</name>;</type>
+ <type requires="VkImageCreateFlagBits" category="bitmask">typedef <type>VkFlags</type> <name>VkImageCreateFlags</name>;</type>
+ <type requires="VkImageViewCreateFlagBits" category="bitmask">typedef <type>VkFlags</type> <name>VkImageViewCreateFlags</name>;</type>
+ <type requires="VkPipelineCreateFlagBits" category="bitmask">typedef <type>VkFlags</type> <name>VkPipelineCreateFlags</name>;</type>
+ <type requires="VkColorComponentFlagBits" category="bitmask">typedef <type>VkFlags</type> <name>VkColorComponentFlags</name>;</type>
+ <type requires="VkFenceCreateFlagBits" category="bitmask">typedef <type>VkFlags</type> <name>VkFenceCreateFlags</name>;</type>
+ <type category="bitmask">typedef <type>VkFlags</type> <name>VkSemaphoreCreateFlags</name>;</type>
+ <type requires="VkFormatFeatureFlagBits" category="bitmask">typedef <type>VkFlags</type> <name>VkFormatFeatureFlags</name>;</type>
+ <type requires="VkQueryControlFlagBits" category="bitmask">typedef <type>VkFlags</type> <name>VkQueryControlFlags</name>;</type>
+ <type requires="VkQueryResultFlagBits" category="bitmask">typedef <type>VkFlags</type> <name>VkQueryResultFlags</name>;</type>
+ <type category="bitmask">typedef <type>VkFlags</type> <name>VkShaderModuleCreateFlags</name>;</type>
+ <type requires="VkEventCreateFlagBits" category="bitmask">typedef <type>VkFlags</type> <name>VkEventCreateFlags</name>;</type>
+ <type requires="VkCommandPoolCreateFlagBits" category="bitmask">typedef <type>VkFlags</type> <name>VkCommandPoolCreateFlags</name>;</type>
+ <type requires="VkCommandPoolResetFlagBits" category="bitmask">typedef <type>VkFlags</type> <name>VkCommandPoolResetFlags</name>;</type>
+ <type requires="VkCommandBufferResetFlagBits" category="bitmask">typedef <type>VkFlags</type> <name>VkCommandBufferResetFlags</name>;</type>
+ <type requires="VkCommandBufferUsageFlagBits" category="bitmask">typedef <type>VkFlags</type> <name>VkCommandBufferUsageFlags</name>;</type>
+ <type requires="VkQueryPipelineStatisticFlagBits" category="bitmask">typedef <type>VkFlags</type> <name>VkQueryPipelineStatisticFlags</name>;</type>
+ <type category="bitmask">typedef <type>VkFlags</type> <name>VkMemoryMapFlags</name>;</type>
+ <type requires="VkImageAspectFlagBits" category="bitmask">typedef <type>VkFlags</type> <name>VkImageAspectFlags</name>;</type>
+ <type requires="VkSparseMemoryBindFlagBits" category="bitmask">typedef <type>VkFlags</type> <name>VkSparseMemoryBindFlags</name>;</type>
+ <type requires="VkSparseImageFormatFlagBits" category="bitmask">typedef <type>VkFlags</type> <name>VkSparseImageFormatFlags</name>;</type>
+ <type requires="VkSubpassDescriptionFlagBits" category="bitmask">typedef <type>VkFlags</type> <name>VkSubpassDescriptionFlags</name>;</type>
+ <type requires="VkPipelineStageFlagBits" category="bitmask">typedef <type>VkFlags</type> <name>VkPipelineStageFlags</name>;</type>
+ <type requires="VkSampleCountFlagBits" category="bitmask">typedef <type>VkFlags</type> <name>VkSampleCountFlags</name>;</type>
+ <type requires="VkAttachmentDescriptionFlagBits" category="bitmask">typedef <type>VkFlags</type> <name>VkAttachmentDescriptionFlags</name>;</type>
+ <type requires="VkStencilFaceFlagBits" category="bitmask">typedef <type>VkFlags</type> <name>VkStencilFaceFlags</name>;</type>
+ <type requires="VkCullModeFlagBits" category="bitmask">typedef <type>VkFlags</type> <name>VkCullModeFlags</name>;</type>
+ <type requires="VkDescriptorPoolCreateFlagBits" category="bitmask">typedef <type>VkFlags</type> <name>VkDescriptorPoolCreateFlags</name>;</type>
+ <type category="bitmask">typedef <type>VkFlags</type> <name>VkDescriptorPoolResetFlags</name>;</type>
+ <type requires="VkDependencyFlagBits" category="bitmask">typedef <type>VkFlags</type> <name>VkDependencyFlags</name>;</type>
+ <type requires="VkSubgroupFeatureFlagBits" category="bitmask">typedef <type>VkFlags</type> <name>VkSubgroupFeatureFlags</name>;</type>
+ <type requires="VkIndirectCommandsLayoutUsageFlagBitsNV" category="bitmask">typedef <type>VkFlags</type> <name>VkIndirectCommandsLayoutUsageFlagsNV</name>;</type>
+ <type requires="VkIndirectStateFlagBitsNV" category="bitmask">typedef <type>VkFlags</type> <name>VkIndirectStateFlagsNV</name>;</type>
+ <type requires="VkGeometryFlagBitsKHR" category="bitmask">typedef <type>VkFlags</type> <name>VkGeometryFlagsKHR</name>;</type>
+ <type category="bitmask" name="VkGeometryFlagsNV" alias="VkGeometryFlagsKHR"/>
+ <type requires="VkGeometryInstanceFlagBitsKHR" category="bitmask">typedef <type>VkFlags</type> <name>VkGeometryInstanceFlagsKHR</name>;</type>
+ <type category="bitmask" name="VkGeometryInstanceFlagsNV" alias="VkGeometryInstanceFlagsKHR"/>
+ <type requires="VkBuildAccelerationStructureFlagBitsKHR" category="bitmask">typedef <type>VkFlags</type> <name>VkBuildAccelerationStructureFlagsKHR</name>;</type>
+ <type category="bitmask" name="VkBuildAccelerationStructureFlagsNV" alias="VkBuildAccelerationStructureFlagsKHR"/>
+ <type category="bitmask">typedef <type>VkFlags</type> <name>VkPrivateDataSlotCreateFlags</name>;</type>
+ <type category="bitmask" name="VkPrivateDataSlotCreateFlagsEXT" alias="VkPrivateDataSlotCreateFlags"/>
+ <type requires="VkAccelerationStructureCreateFlagBitsKHR" category="bitmask">typedef <type>VkFlags</type> <name>VkAccelerationStructureCreateFlagsKHR</name>;</type>
+ <type category="bitmask">typedef <type>VkFlags</type> <name>VkDescriptorUpdateTemplateCreateFlags</name>;</type>
+ <type category="bitmask" name="VkDescriptorUpdateTemplateCreateFlagsKHR" alias="VkDescriptorUpdateTemplateCreateFlags"/>
+ <type requires="VkPipelineCreationFeedbackFlagBits" category="bitmask">typedef <type>VkFlags</type> <name>VkPipelineCreationFeedbackFlags</name>;</type>
+ <type category="bitmask" name="VkPipelineCreationFeedbackFlagsEXT" alias="VkPipelineCreationFeedbackFlags"/>
+ <type requires="VkPerformanceCounterDescriptionFlagBitsKHR" category="bitmask">typedef <type>VkFlags</type> <name>VkPerformanceCounterDescriptionFlagsKHR</name>;</type>
+ <type requires="VkAcquireProfilingLockFlagBitsKHR" category="bitmask">typedef <type>VkFlags</type> <name>VkAcquireProfilingLockFlagsKHR</name>;</type>
+ <type requires="VkSemaphoreWaitFlagBits" category="bitmask">typedef <type>VkFlags</type> <name>VkSemaphoreWaitFlags</name>;</type>
+ <type category="bitmask" name="VkSemaphoreWaitFlagsKHR" alias="VkSemaphoreWaitFlags"/>
+ <type requires="VkPipelineCompilerControlFlagBitsAMD" category="bitmask">typedef <type>VkFlags</type> <name>VkPipelineCompilerControlFlagsAMD</name>;</type>
+ <type requires="VkShaderCorePropertiesFlagBitsAMD" category="bitmask">typedef <type>VkFlags</type> <name>VkShaderCorePropertiesFlagsAMD</name>;</type>
+ <type requires="VkDeviceDiagnosticsConfigFlagBitsNV" category="bitmask">typedef <type>VkFlags</type> <name>VkDeviceDiagnosticsConfigFlagsNV</name>;</type>
+ <type bitvalues="VkAccessFlagBits2" category="bitmask">typedef <type>VkFlags64</type> <name>VkAccessFlags2</name>;</type>
+ <type category="bitmask" name="VkAccessFlags2KHR" alias="VkAccessFlags2"/>
+ <type bitvalues="VkPipelineStageFlagBits2" category="bitmask">typedef <type>VkFlags64</type> <name>VkPipelineStageFlags2</name>;</type>
+ <type category="bitmask" name="VkPipelineStageFlags2KHR" alias="VkPipelineStageFlags2"/>
+ <type category="bitmask">typedef <type>VkFlags</type> <name>VkAccelerationStructureMotionInfoFlagsNV</name>;</type>
+ <type category="bitmask">typedef <type>VkFlags</type> <name>VkAccelerationStructureMotionInstanceFlagsNV</name>;</type>
+ <type bitvalues="VkFormatFeatureFlagBits2" category="bitmask">typedef <type>VkFlags64</type> <name>VkFormatFeatureFlags2</name>;</type>
+ <type category="bitmask" name="VkFormatFeatureFlags2KHR" alias="VkFormatFeatureFlags2"/>
+ <type requires="VkRenderingFlagBits" category="bitmask">typedef <type>VkFlags</type> <name>VkRenderingFlags</name>;</type>
+ <type category="bitmask" name="VkRenderingFlagsKHR" alias="VkRenderingFlags"/>
- <!-- WSI extensions -->
+
+ <comment>WSI extensions</comment>
<type requires="VkCompositeAlphaFlagBitsKHR" category="bitmask">typedef <type>VkFlags</type> <name>VkCompositeAlphaFlagsKHR</name>;</type>
<type requires="VkDisplayPlaneAlphaFlagBitsKHR" category="bitmask">typedef <type>VkFlags</type> <name>VkDisplayPlaneAlphaFlagsKHR</name>;</type>
<type requires="VkSurfaceTransformFlagBitsKHR" category="bitmask">typedef <type>VkFlags</type> <name>VkSurfaceTransformFlagsKHR</name>;</type>
- <type category="bitmask">typedef <type>VkFlags</type> <name>VkSwapchainCreateFlagsKHR</name>;</type> <!-- creation flags -->
- <type category="bitmask">typedef <type>VkFlags</type> <name>VkDisplayModeCreateFlagsKHR</name>;</type> <!-- creation flags -->
- <type category="bitmask">typedef <type>VkFlags</type> <name>VkDisplaySurfaceCreateFlagsKHR</name>;</type> <!-- creation flags -->
- <type category="bitmask">typedef <type>VkFlags</type> <name>VkAndroidSurfaceCreateFlagsKHR</name>;</type> <!-- creation flags -->
- <type category="bitmask">typedef <type>VkFlags</type> <name>VkMirSurfaceCreateFlagsKHR</name>;</type> <!-- creation flags -->
- <type category="bitmask">typedef <type>VkFlags</type> <name>VkViSurfaceCreateFlagsNN</name>;</type> <!-- creation flags -->
- <type category="bitmask">typedef <type>VkFlags</type> <name>VkWaylandSurfaceCreateFlagsKHR</name>;</type> <!-- creation flags -->
- <type category="bitmask">typedef <type>VkFlags</type> <name>VkWin32SurfaceCreateFlagsKHR</name>;</type> <!-- creation flags -->
- <type category="bitmask">typedef <type>VkFlags</type> <name>VkXlibSurfaceCreateFlagsKHR</name>;</type> <!-- creation flags -->
- <type category="bitmask">typedef <type>VkFlags</type> <name>VkXcbSurfaceCreateFlagsKHR</name>;</type> <!-- creation flags -->
+ <type requires="VkSwapchainCreateFlagBitsKHR" category="bitmask">typedef <type>VkFlags</type> <name>VkSwapchainCreateFlagsKHR</name>;</type>
+ <type category="bitmask">typedef <type>VkFlags</type> <name>VkDisplayModeCreateFlagsKHR</name>;</type>
+ <type category="bitmask">typedef <type>VkFlags</type> <name>VkDisplaySurfaceCreateFlagsKHR</name>;</type>
+ <type category="bitmask">typedef <type>VkFlags</type> <name>VkAndroidSurfaceCreateFlagsKHR</name>;</type>
+ <type category="bitmask">typedef <type>VkFlags</type> <name>VkViSurfaceCreateFlagsNN</name>;</type>
+ <type category="bitmask">typedef <type>VkFlags</type> <name>VkWaylandSurfaceCreateFlagsKHR</name>;</type>
+ <type category="bitmask">typedef <type>VkFlags</type> <name>VkWin32SurfaceCreateFlagsKHR</name>;</type>
+ <type category="bitmask">typedef <type>VkFlags</type> <name>VkXlibSurfaceCreateFlagsKHR</name>;</type>
+ <type category="bitmask">typedef <type>VkFlags</type> <name>VkXcbSurfaceCreateFlagsKHR</name>;</type>
+ <type category="bitmask">typedef <type>VkFlags</type> <name>VkDirectFBSurfaceCreateFlagsEXT</name>;</type>
+ <type category="bitmask">typedef <type>VkFlags</type> <name>VkIOSSurfaceCreateFlagsMVK</name>;</type>
+ <type category="bitmask">typedef <type>VkFlags</type> <name>VkMacOSSurfaceCreateFlagsMVK</name>;</type>
+ <type category="bitmask">typedef <type>VkFlags</type> <name>VkMetalSurfaceCreateFlagsEXT</name>;</type>
+ <type category="bitmask">typedef <type>VkFlags</type> <name>VkImagePipeSurfaceCreateFlagsFUCHSIA</name>;</type>
+ <type category="bitmask">typedef <type>VkFlags</type> <name>VkStreamDescriptorSurfaceCreateFlagsGGP</name>;</type>
+ <type category="bitmask">typedef <type>VkFlags</type> <name>VkHeadlessSurfaceCreateFlagsEXT</name>;</type>
+ <type category="bitmask">typedef <type>VkFlags</type> <name>VkScreenSurfaceCreateFlagsQNX</name>;</type>
+ <type requires="VkPeerMemoryFeatureFlagBits" category="bitmask">typedef <type>VkFlags</type> <name>VkPeerMemoryFeatureFlags</name>;</type>
+ <type category="bitmask" name="VkPeerMemoryFeatureFlagsKHR" alias="VkPeerMemoryFeatureFlags"/>
+ <type requires="VkMemoryAllocateFlagBits" category="bitmask">typedef <type>VkFlags</type> <name>VkMemoryAllocateFlags</name>;</type>
+ <type category="bitmask" name="VkMemoryAllocateFlagsKHR" alias="VkMemoryAllocateFlags"/>
+ <type requires="VkDeviceGroupPresentModeFlagBitsKHR" category="bitmask">typedef <type>VkFlags</type> <name>VkDeviceGroupPresentModeFlagsKHR</name>;</type>
- <type requires="VkDebugReportFlagBitsEXT" category="bitmask">typedef <type>VkFlags</type> <name>VkDebugReportFlagsEXT</name>;</type>
- <type category="bitmask">typedef <type>VkFlags</type> <name>VkCommandPoolTrimFlagsKHR</name>;</type>
+ <type requires="VkDebugReportFlagBitsEXT" category="bitmask">typedef <type>VkFlags</type> <name>VkDebugReportFlagsEXT</name>;</type>
+ <type category="bitmask">typedef <type>VkFlags</type> <name>VkCommandPoolTrimFlags</name>;</type>
+ <type category="bitmask" name="VkCommandPoolTrimFlagsKHR" alias="VkCommandPoolTrimFlags"/>
<type requires="VkExternalMemoryHandleTypeFlagBitsNV" category="bitmask">typedef <type>VkFlags</type> <name>VkExternalMemoryHandleTypeFlagsNV</name>;</type>
<type requires="VkExternalMemoryFeatureFlagBitsNV" category="bitmask">typedef <type>VkFlags</type> <name>VkExternalMemoryFeatureFlagsNV</name>;</type>
+ <type requires="VkExternalMemoryHandleTypeFlagBits" category="bitmask">typedef <type>VkFlags</type> <name>VkExternalMemoryHandleTypeFlags</name>;</type>
+ <type category="bitmask" name="VkExternalMemoryHandleTypeFlagsKHR" alias="VkExternalMemoryHandleTypeFlags"/>
+ <type requires="VkExternalMemoryFeatureFlagBits" category="bitmask">typedef <type>VkFlags</type> <name>VkExternalMemoryFeatureFlags</name>;</type>
+ <type category="bitmask" name="VkExternalMemoryFeatureFlagsKHR" alias="VkExternalMemoryFeatureFlags"/>
+ <type requires="VkExternalSemaphoreHandleTypeFlagBits" category="bitmask">typedef <type>VkFlags</type> <name>VkExternalSemaphoreHandleTypeFlags</name>;</type>
+ <type category="bitmask" name="VkExternalSemaphoreHandleTypeFlagsKHR" alias="VkExternalSemaphoreHandleTypeFlags"/>
+ <type requires="VkExternalSemaphoreFeatureFlagBits" category="bitmask">typedef <type>VkFlags</type> <name>VkExternalSemaphoreFeatureFlags</name>;</type>
+ <type category="bitmask" name="VkExternalSemaphoreFeatureFlagsKHR" alias="VkExternalSemaphoreFeatureFlags"/>
+ <type requires="VkSemaphoreImportFlagBits" category="bitmask">typedef <type>VkFlags</type> <name>VkSemaphoreImportFlags</name>;</type>
+ <type category="bitmask" name="VkSemaphoreImportFlagsKHR" alias="VkSemaphoreImportFlags"/>
+ <type requires="VkExternalFenceHandleTypeFlagBits" category="bitmask">typedef <type>VkFlags</type> <name>VkExternalFenceHandleTypeFlags</name>;</type>
+ <type category="bitmask" name="VkExternalFenceHandleTypeFlagsKHR" alias="VkExternalFenceHandleTypeFlags"/>
+ <type requires="VkExternalFenceFeatureFlagBits" category="bitmask">typedef <type>VkFlags</type> <name>VkExternalFenceFeatureFlags</name>;</type>
+ <type category="bitmask" name="VkExternalFenceFeatureFlagsKHR" alias="VkExternalFenceFeatureFlags"/>
+ <type requires="VkFenceImportFlagBits" category="bitmask">typedef <type>VkFlags</type> <name>VkFenceImportFlags</name>;</type>
+ <type category="bitmask" name="VkFenceImportFlagsKHR" alias="VkFenceImportFlags"/>
<type requires="VkSurfaceCounterFlagBitsEXT" category="bitmask">typedef <type>VkFlags</type> <name>VkSurfaceCounterFlagsEXT</name>;</type>
+ <type category="bitmask">typedef <type>VkFlags</type> <name>VkPipelineViewportSwizzleStateCreateFlagsNV</name>;</type>
+ <type category="bitmask">typedef <type>VkFlags</type> <name>VkPipelineDiscardRectangleStateCreateFlagsEXT</name>;</type>
+ <type category="bitmask">typedef <type>VkFlags</type> <name>VkPipelineCoverageToColorStateCreateFlagsNV</name>;</type>
+ <type category="bitmask">typedef <type>VkFlags</type> <name>VkPipelineCoverageModulationStateCreateFlagsNV</name>;</type>
+ <type category="bitmask">typedef <type>VkFlags</type> <name>VkPipelineCoverageReductionStateCreateFlagsNV</name>;</type>
+ <type category="bitmask">typedef <type>VkFlags</type> <name>VkValidationCacheCreateFlagsEXT</name>;</type>
+ <type requires="VkDebugUtilsMessageSeverityFlagBitsEXT" category="bitmask">typedef <type>VkFlags</type> <name>VkDebugUtilsMessageSeverityFlagsEXT</name>;</type>
+ <type requires="VkDebugUtilsMessageTypeFlagBitsEXT" category="bitmask">typedef <type>VkFlags</type> <name>VkDebugUtilsMessageTypeFlagsEXT</name>;</type>
+ <type category="bitmask">typedef <type>VkFlags</type> <name>VkDebugUtilsMessengerCreateFlagsEXT</name>;</type>
+ <type category="bitmask">typedef <type>VkFlags</type> <name>VkDebugUtilsMessengerCallbackDataFlagsEXT</name>;</type>
+ <type category="bitmask">typedef <type>VkFlags</type> <name>VkDeviceMemoryReportFlagsEXT</name>;</type>
+ <type category="bitmask">typedef <type>VkFlags</type> <name>VkPipelineRasterizationConservativeStateCreateFlagsEXT</name>;</type>
+ <type requires="VkDescriptorBindingFlagBits" category="bitmask">typedef <type>VkFlags</type> <name>VkDescriptorBindingFlags</name>;</type>
+ <type category="bitmask" name="VkDescriptorBindingFlagsEXT" alias="VkDescriptorBindingFlags"/>
+ <type requires="VkConditionalRenderingFlagBitsEXT" category="bitmask">typedef <type>VkFlags</type> <name>VkConditionalRenderingFlagsEXT</name>;</type>
+ <type requires="VkResolveModeFlagBits" category="bitmask">typedef <type>VkFlags</type> <name>VkResolveModeFlags</name>;</type>
+ <type category="bitmask" name="VkResolveModeFlagsKHR" alias="VkResolveModeFlags"/>
+ <type category="bitmask">typedef <type>VkFlags</type> <name>VkPipelineRasterizationStateStreamCreateFlagsEXT</name>;</type>
+ <type category="bitmask">typedef <type>VkFlags</type> <name>VkPipelineRasterizationDepthClipStateCreateFlagsEXT</name>;</type>
+ <type requires="VkSwapchainImageUsageFlagBitsANDROID" category="bitmask">typedef <type>VkFlags</type> <name>VkSwapchainImageUsageFlagsANDROID</name>;</type>
+ <type requires="VkToolPurposeFlagBits" category="bitmask">typedef <type>VkFlags</type> <name>VkToolPurposeFlags</name>;</type>
+ <type category="bitmask" name="VkToolPurposeFlagsEXT" alias="VkToolPurposeFlags"/>
+ <type requires="VkSubmitFlagBits" category="bitmask">typedef <type>VkFlags</type> <name>VkSubmitFlags</name>;</type>
+ <type category="bitmask" name="VkSubmitFlagsKHR" alias="VkSubmitFlags"/>
+ <type category="bitmask">typedef <type>VkFlags</type> <name>VkImageFormatConstraintsFlagsFUCHSIA</name>;</type>
+ <type requires="VkImageConstraintsInfoFlagBitsFUCHSIA" category="bitmask">typedef <type>VkFlags</type> <name>VkImageConstraintsInfoFlagsFUCHSIA</name>;</type>
+ <type requires="VkGraphicsPipelineLibraryFlagBitsEXT" category="bitmask">typedef <type>VkFlags</type> <name>VkGraphicsPipelineLibraryFlagsEXT</name>;</type>
+ <type requires="VkImageCompressionFlagBitsEXT" category="bitmask">typedef <type>VkFlags</type> <name>VkImageCompressionFlagsEXT</name>;</type>
+ <type requires="VkImageCompressionFixedRateFlagBitsEXT" category="bitmask">typedef <type>VkFlags</type> <name>VkImageCompressionFixedRateFlagsEXT</name>;</type>
+ <type requires="VkExportMetalObjectTypeFlagBitsEXT" category="bitmask">typedef <type>VkFlags</type> <name>VkExportMetalObjectTypeFlagsEXT</name>;</type>
+
+ <comment>Video Core extension</comment>
+ <type requires="VkVideoCodecOperationFlagBitsKHR" category="bitmask">typedef <type>VkFlags</type> <name>VkVideoCodecOperationFlagsKHR</name>;</type>
+ <type requires="VkVideoCapabilityFlagBitsKHR" category="bitmask">typedef <type>VkFlags</type> <name>VkVideoCapabilityFlagsKHR</name>;</type>
+ <type requires="VkVideoSessionCreateFlagBitsKHR" category="bitmask">typedef <type>VkFlags</type> <name>VkVideoSessionCreateFlagsKHR</name>;</type>
+ <type category="bitmask">typedef <type>VkFlags</type> <name>VkVideoBeginCodingFlagsKHR</name>;</type>
+ <type category="bitmask">typedef <type>VkFlags</type> <name>VkVideoEndCodingFlagsKHR</name>;</type>
+ <type requires="VkVideoCodingQualityPresetFlagBitsKHR" category="bitmask">typedef <type>VkFlags</type> <name>VkVideoCodingQualityPresetFlagsKHR</name>;</type>
+ <type requires="VkVideoCodingControlFlagBitsKHR" category="bitmask">typedef <type>VkFlags</type> <name>VkVideoCodingControlFlagsKHR</name>;</type>
+
+ <comment>Video Decode Core extension</comment>
+ <type requires="VkVideoDecodeCapabilityFlagBitsKHR" category="bitmask">typedef <type>VkFlags</type> <name>VkVideoDecodeCapabilityFlagsKHR</name>;</type>
+ <type requires="VkVideoDecodeFlagBitsKHR" category="bitmask">typedef <type>VkFlags</type> <name>VkVideoDecodeFlagsKHR</name>;</type>
- <!-- Types which can be void pointers or class pointers, selected at compile time -->
- <type category="handle"><type>VK_DEFINE_HANDLE</type>(<name>VkInstance</name>)</type>
- <type category="handle" parent="VkInstance"><type>VK_DEFINE_HANDLE</type>(<name>VkPhysicalDevice</name>)</type>
- <type category="handle" parent="VkPhysicalDevice"><type>VK_DEFINE_HANDLE</type>(<name>VkDevice</name>)</type>
- <type category="handle" parent="VkDevice"><type>VK_DEFINE_HANDLE</type>(<name>VkQueue</name>)</type>
- <type category="handle" parent="VkCommandPool"><type>VK_DEFINE_HANDLE</type>(<name>VkCommandBuffer</name>)</type>
- <type category="handle" parent="VkDevice"><type>VK_DEFINE_NON_DISPATCHABLE_HANDLE</type>(<name>VkDeviceMemory</name>)</type>
- <type category="handle" parent="VkDevice"><type>VK_DEFINE_NON_DISPATCHABLE_HANDLE</type>(<name>VkCommandPool</name>)</type>
- <type category="handle" parent="VkDevice"><type>VK_DEFINE_NON_DISPATCHABLE_HANDLE</type>(<name>VkBuffer</name>)</type>
- <type category="handle" parent="VkDevice"><type>VK_DEFINE_NON_DISPATCHABLE_HANDLE</type>(<name>VkBufferView</name>)</type>
- <type category="handle" parent="VkDevice"><type>VK_DEFINE_NON_DISPATCHABLE_HANDLE</type>(<name>VkImage</name>)</type>
- <type category="handle" parent="VkDevice"><type>VK_DEFINE_NON_DISPATCHABLE_HANDLE</type>(<name>VkImageView</name>)</type>
- <type category="handle" parent="VkDevice"><type>VK_DEFINE_NON_DISPATCHABLE_HANDLE</type>(<name>VkShaderModule</name>)</type>
- <type category="handle" parent="VkDevice"><type>VK_DEFINE_NON_DISPATCHABLE_HANDLE</type>(<name>VkPipeline</name>)</type>
- <type category="handle" parent="VkDevice"><type>VK_DEFINE_NON_DISPATCHABLE_HANDLE</type>(<name>VkPipelineLayout</name>)</type>
- <type category="handle" parent="VkDevice"><type>VK_DEFINE_NON_DISPATCHABLE_HANDLE</type>(<name>VkSampler</name>)</type>
- <type category="handle" parent="VkDescriptorPool"><type>VK_DEFINE_NON_DISPATCHABLE_HANDLE</type>(<name>VkDescriptorSet</name>)</type>
- <type category="handle" parent="VkDevice"><type>VK_DEFINE_NON_DISPATCHABLE_HANDLE</type>(<name>VkDescriptorSetLayout</name>)</type>
- <type category="handle" parent="VkDevice"><type>VK_DEFINE_NON_DISPATCHABLE_HANDLE</type>(<name>VkDescriptorPool</name>)</type>
- <type category="handle" parent="VkDevice"><type>VK_DEFINE_NON_DISPATCHABLE_HANDLE</type>(<name>VkFence</name>)</type>
- <type category="handle" parent="VkDevice"><type>VK_DEFINE_NON_DISPATCHABLE_HANDLE</type>(<name>VkSemaphore</name>)</type>
- <type category="handle" parent="VkDevice"><type>VK_DEFINE_NON_DISPATCHABLE_HANDLE</type>(<name>VkEvent</name>)</type>
- <type category="handle" parent="VkDevice"><type>VK_DEFINE_NON_DISPATCHABLE_HANDLE</type>(<name>VkQueryPool</name>)</type>
- <type category="handle" parent="VkDevice"><type>VK_DEFINE_NON_DISPATCHABLE_HANDLE</type>(<name>VkFramebuffer</name>)</type>
- <type category="handle" parent="VkDevice"><type>VK_DEFINE_NON_DISPATCHABLE_HANDLE</type>(<name>VkRenderPass</name>)</type>
- <type category="handle" parent="VkDevice"><type>VK_DEFINE_NON_DISPATCHABLE_HANDLE</type>(<name>VkPipelineCache</name>)</type>
- <type category="handle" parent="VkDevice"><type>VK_DEFINE_NON_DISPATCHABLE_HANDLE</type>(<name>VkObjectTableNVX</name>)</type>
- <type category="handle" parent="VkDevice"><type>VK_DEFINE_NON_DISPATCHABLE_HANDLE</type>(<name>VkIndirectCommandsLayoutNVX</name>)</type>
+ <comment>Video Decode H.264 extension</comment>
+ <type requires="VkVideoDecodeH264PictureLayoutFlagBitsEXT" category="bitmask">typedef <type>VkFlags</type> <name>VkVideoDecodeH264PictureLayoutFlagsEXT</name>;</type>
- <!-- WSI extensions -->
- <type category="handle"><type>VK_DEFINE_NON_DISPATCHABLE_HANDLE</type>(<name>VkDisplayKHR</name>)</type>
- <type category="handle" parent="VkPhysicalDevice,VkDisplayKHR"><type>VK_DEFINE_NON_DISPATCHABLE_HANDLE</type>(<name>VkDisplayModeKHR</name>)</type>
- <type category="handle" parent="VkInstance"><type>VK_DEFINE_NON_DISPATCHABLE_HANDLE</type>(<name>VkSurfaceKHR</name>)</type>
- <type category="handle" parent="VkSurfaceKHR"><type>VK_DEFINE_NON_DISPATCHABLE_HANDLE</type>(<name>VkSwapchainKHR</name>)</type>
- <type category="handle" parent="VkInstance"><type>VK_DEFINE_NON_DISPATCHABLE_HANDLE</type>(<name>VkDebugReportCallbackEXT</name>)</type>
+ <comment>Video Encode Core extension</comment>
+ <type requires="VkVideoEncodeFlagBitsKHR" category="bitmask">typedef <type>VkFlags</type> <name>VkVideoEncodeFlagsKHR</name>;</type>
+ <type requires="VkVideoEncodeCapabilityFlagBitsKHR" category="bitmask">typedef <type>VkFlags</type> <name>VkVideoEncodeCapabilityFlagsKHR</name>;</type>
+ <type requires="VkVideoEncodeRateControlFlagBitsKHR" category="bitmask">typedef <type>VkFlags</type> <name>VkVideoEncodeRateControlFlagsKHR</name>;</type>
+ <type requires="VkVideoEncodeRateControlModeFlagBitsKHR" category="bitmask">typedef <type>VkFlags</type> <name>VkVideoEncodeRateControlModeFlagsKHR</name>;</type>
+ <type requires="VkVideoChromaSubsamplingFlagBitsKHR" category="bitmask">typedef <type>VkFlags</type> <name>VkVideoChromaSubsamplingFlagsKHR</name>;</type>
+ <type requires="VkVideoComponentBitDepthFlagBitsKHR" category="bitmask">typedef <type>VkFlags</type> <name>VkVideoComponentBitDepthFlagsKHR</name>;</type>
- <!-- Types generated from corresponding <enums> tags below -->
+ <comment>Video Encode H.264 extension</comment>
+ <type requires="VkVideoEncodeH264CapabilityFlagBitsEXT" category="bitmask">typedef <type>VkFlags</type> <name>VkVideoEncodeH264CapabilityFlagsEXT</name>;</type>
+ <type requires="VkVideoEncodeH264InputModeFlagBitsEXT" category="bitmask">typedef <type>VkFlags</type> <name>VkVideoEncodeH264InputModeFlagsEXT</name>;</type>
+ <type requires="VkVideoEncodeH264OutputModeFlagBitsEXT" category="bitmask">typedef <type>VkFlags</type> <name>VkVideoEncodeH264OutputModeFlagsEXT</name>;</type>
+ <type requires="VkVideoEncodeH264RateControlStructureFlagBitsEXT" category="bitmask">typedef <type>VkFlags</type> <name>VkVideoEncodeH264RateControlStructureFlagsEXT</name>;</type>
+
+ <comment>Video Encode H.265 extension</comment>
+ <type requires="VkVideoEncodeH265CapabilityFlagBitsEXT" category="bitmask">typedef <type>VkFlags</type> <name>VkVideoEncodeH265CapabilityFlagsEXT</name>;</type>
+ <type requires="VkVideoEncodeH265InputModeFlagBitsEXT" category="bitmask">typedef <type>VkFlags</type> <name>VkVideoEncodeH265InputModeFlagsEXT</name>;</type>
+ <type requires="VkVideoEncodeH265OutputModeFlagBitsEXT" category="bitmask">typedef <type>VkFlags</type> <name>VkVideoEncodeH265OutputModeFlagsEXT</name>;</type>
+ <type requires="VkVideoEncodeH265RateControlStructureFlagBitsEXT" category="bitmask">typedef <type>VkFlags</type> <name>VkVideoEncodeH265RateControlStructureFlagsEXT</name>;</type>
+ <type requires="VkVideoEncodeH265CtbSizeFlagBitsEXT" category="bitmask">typedef <type>VkFlags</type> <name>VkVideoEncodeH265CtbSizeFlagsEXT</name>;</type>
+ <type requires="VkVideoEncodeH265TransformBlockSizeFlagBitsEXT" category="bitmask">typedef <type>VkFlags</type> <name>VkVideoEncodeH265TransformBlockSizeFlagsEXT</name>;</type>
+
+ <comment>Types which can be void pointers or class pointers, selected at compile time</comment>
+ <type category="handle" objtypeenum="VK_OBJECT_TYPE_INSTANCE"><type>VK_DEFINE_HANDLE</type>(<name>VkInstance</name>)</type>
+ <type category="handle" parent="VkInstance" objtypeenum="VK_OBJECT_TYPE_PHYSICAL_DEVICE"><type>VK_DEFINE_HANDLE</type>(<name>VkPhysicalDevice</name>)</type>
+ <type category="handle" parent="VkPhysicalDevice" objtypeenum="VK_OBJECT_TYPE_DEVICE"><type>VK_DEFINE_HANDLE</type>(<name>VkDevice</name>)</type>
+ <type category="handle" parent="VkDevice" objtypeenum="VK_OBJECT_TYPE_QUEUE"><type>VK_DEFINE_HANDLE</type>(<name>VkQueue</name>)</type>
+ <type category="handle" parent="VkCommandPool" objtypeenum="VK_OBJECT_TYPE_COMMAND_BUFFER"><type>VK_DEFINE_HANDLE</type>(<name>VkCommandBuffer</name>)</type>
+ <type category="handle" parent="VkDevice" objtypeenum="VK_OBJECT_TYPE_DEVICE_MEMORY"><type>VK_DEFINE_NON_DISPATCHABLE_HANDLE</type>(<name>VkDeviceMemory</name>)</type>
+ <type category="handle" parent="VkDevice" objtypeenum="VK_OBJECT_TYPE_COMMAND_POOL"><type>VK_DEFINE_NON_DISPATCHABLE_HANDLE</type>(<name>VkCommandPool</name>)</type>
+ <type category="handle" parent="VkDevice" objtypeenum="VK_OBJECT_TYPE_BUFFER"><type>VK_DEFINE_NON_DISPATCHABLE_HANDLE</type>(<name>VkBuffer</name>)</type>
+ <type category="handle" parent="VkDevice" objtypeenum="VK_OBJECT_TYPE_BUFFER_VIEW"><type>VK_DEFINE_NON_DISPATCHABLE_HANDLE</type>(<name>VkBufferView</name>)</type>
+ <type category="handle" parent="VkDevice" objtypeenum="VK_OBJECT_TYPE_IMAGE"><type>VK_DEFINE_NON_DISPATCHABLE_HANDLE</type>(<name>VkImage</name>)</type>
+ <type category="handle" parent="VkDevice" objtypeenum="VK_OBJECT_TYPE_IMAGE_VIEW"><type>VK_DEFINE_NON_DISPATCHABLE_HANDLE</type>(<name>VkImageView</name>)</type>
+ <type category="handle" parent="VkDevice" objtypeenum="VK_OBJECT_TYPE_SHADER_MODULE"><type>VK_DEFINE_NON_DISPATCHABLE_HANDLE</type>(<name>VkShaderModule</name>)</type>
+ <type category="handle" parent="VkDevice" objtypeenum="VK_OBJECT_TYPE_PIPELINE"><type>VK_DEFINE_NON_DISPATCHABLE_HANDLE</type>(<name>VkPipeline</name>)</type>
+ <type category="handle" parent="VkDevice" objtypeenum="VK_OBJECT_TYPE_PIPELINE_LAYOUT"><type>VK_DEFINE_NON_DISPATCHABLE_HANDLE</type>(<name>VkPipelineLayout</name>)</type>
+ <type category="handle" parent="VkDevice" objtypeenum="VK_OBJECT_TYPE_SAMPLER"><type>VK_DEFINE_NON_DISPATCHABLE_HANDLE</type>(<name>VkSampler</name>)</type>
+ <type category="handle" parent="VkDescriptorPool" objtypeenum="VK_OBJECT_TYPE_DESCRIPTOR_SET"><type>VK_DEFINE_NON_DISPATCHABLE_HANDLE</type>(<name>VkDescriptorSet</name>)</type>
+ <type category="handle" parent="VkDevice" objtypeenum="VK_OBJECT_TYPE_DESCRIPTOR_SET_LAYOUT"><type>VK_DEFINE_NON_DISPATCHABLE_HANDLE</type>(<name>VkDescriptorSetLayout</name>)</type>
+ <type category="handle" parent="VkDevice" objtypeenum="VK_OBJECT_TYPE_DESCRIPTOR_POOL"><type>VK_DEFINE_NON_DISPATCHABLE_HANDLE</type>(<name>VkDescriptorPool</name>)</type>
+ <type category="handle" parent="VkDevice" objtypeenum="VK_OBJECT_TYPE_FENCE"><type>VK_DEFINE_NON_DISPATCHABLE_HANDLE</type>(<name>VkFence</name>)</type>
+ <type category="handle" parent="VkDevice" objtypeenum="VK_OBJECT_TYPE_SEMAPHORE"><type>VK_DEFINE_NON_DISPATCHABLE_HANDLE</type>(<name>VkSemaphore</name>)</type>
+ <type category="handle" parent="VkDevice" objtypeenum="VK_OBJECT_TYPE_EVENT"><type>VK_DEFINE_NON_DISPATCHABLE_HANDLE</type>(<name>VkEvent</name>)</type>
+ <type category="handle" parent="VkDevice" objtypeenum="VK_OBJECT_TYPE_QUERY_POOL"><type>VK_DEFINE_NON_DISPATCHABLE_HANDLE</type>(<name>VkQueryPool</name>)</type>
+ <type category="handle" parent="VkDevice" objtypeenum="VK_OBJECT_TYPE_FRAMEBUFFER"><type>VK_DEFINE_NON_DISPATCHABLE_HANDLE</type>(<name>VkFramebuffer</name>)</type>
+ <type category="handle" parent="VkDevice" objtypeenum="VK_OBJECT_TYPE_RENDER_PASS"><type>VK_DEFINE_NON_DISPATCHABLE_HANDLE</type>(<name>VkRenderPass</name>)</type>
+ <type category="handle" parent="VkDevice" objtypeenum="VK_OBJECT_TYPE_PIPELINE_CACHE"><type>VK_DEFINE_NON_DISPATCHABLE_HANDLE</type>(<name>VkPipelineCache</name>)</type>
+ <type category="handle" parent="VkDevice" objtypeenum="VK_OBJECT_TYPE_INDIRECT_COMMANDS_LAYOUT_NV"><type>VK_DEFINE_NON_DISPATCHABLE_HANDLE</type>(<name>VkIndirectCommandsLayoutNV</name>)</type>
+ <type category="handle" parent="VkDevice" objtypeenum="VK_OBJECT_TYPE_DESCRIPTOR_UPDATE_TEMPLATE"><type>VK_DEFINE_NON_DISPATCHABLE_HANDLE</type>(<name>VkDescriptorUpdateTemplate</name>)</type>
+ <type category="handle" name="VkDescriptorUpdateTemplateKHR" alias="VkDescriptorUpdateTemplate"/>
+ <type category="handle" parent="VkDevice" objtypeenum="VK_OBJECT_TYPE_SAMPLER_YCBCR_CONVERSION"><type>VK_DEFINE_NON_DISPATCHABLE_HANDLE</type>(<name>VkSamplerYcbcrConversion</name>)</type>
+ <type category="handle" name="VkSamplerYcbcrConversionKHR" alias="VkSamplerYcbcrConversion"/>
+ <type category="handle" parent="VkDevice" objtypeenum="VK_OBJECT_TYPE_VALIDATION_CACHE_EXT"><type>VK_DEFINE_NON_DISPATCHABLE_HANDLE</type>(<name>VkValidationCacheEXT</name>)</type>
+ <type category="handle" parent="VkDevice" objtypeenum="VK_OBJECT_TYPE_ACCELERATION_STRUCTURE_KHR"><type>VK_DEFINE_NON_DISPATCHABLE_HANDLE</type>(<name>VkAccelerationStructureKHR</name>)</type>
+ <type category="handle" parent="VkDevice" objtypeenum="VK_OBJECT_TYPE_ACCELERATION_STRUCTURE_NV"><type>VK_DEFINE_NON_DISPATCHABLE_HANDLE</type>(<name>VkAccelerationStructureNV</name>)</type>
+ <type category="handle" parent="VkDevice" objtypeenum="VK_OBJECT_TYPE_PERFORMANCE_CONFIGURATION_INTEL"><type>VK_DEFINE_NON_DISPATCHABLE_HANDLE</type>(<name>VkPerformanceConfigurationINTEL</name>)</type>
+ <type category="handle" parent="VkDevice" objtypeenum="VK_OBJECT_TYPE_BUFFER_COLLECTION_FUCHSIA"><type>VK_DEFINE_NON_DISPATCHABLE_HANDLE</type>(<name>VkBufferCollectionFUCHSIA</name>)</type>
+ <type category="handle" parent="VkDevice" objtypeenum="VK_OBJECT_TYPE_DEFERRED_OPERATION_KHR"><type>VK_DEFINE_NON_DISPATCHABLE_HANDLE</type>(<name>VkDeferredOperationKHR</name>)</type>
+ <type category="handle" parent="VkDevice" objtypeenum="VK_OBJECT_TYPE_PRIVATE_DATA_SLOT"><type>VK_DEFINE_NON_DISPATCHABLE_HANDLE</type>(<name>VkPrivateDataSlot</name>)</type>
+ <type category="handle" name="VkPrivateDataSlotEXT" alias="VkPrivateDataSlot"/>
+ <type category="handle" parent="VkDevice" objtypeenum="VK_OBJECT_TYPE_CU_MODULE_NVX"><type>VK_DEFINE_NON_DISPATCHABLE_HANDLE</type>(<name>VkCuModuleNVX</name>)</type>
+ <type category="handle" parent="VkDevice" objtypeenum="VK_OBJECT_TYPE_CU_FUNCTION_NVX"><type>VK_DEFINE_NON_DISPATCHABLE_HANDLE</type>(<name>VkCuFunctionNVX</name>)</type>
+
+ <comment>WSI extensions</comment>
+ <type category="handle" parent="VkPhysicalDevice" objtypeenum="VK_OBJECT_TYPE_DISPLAY_KHR"><type>VK_DEFINE_NON_DISPATCHABLE_HANDLE</type>(<name>VkDisplayKHR</name>)</type>
+ <type category="handle" parent="VkDisplayKHR" objtypeenum="VK_OBJECT_TYPE_DISPLAY_MODE_KHR"><type>VK_DEFINE_NON_DISPATCHABLE_HANDLE</type>(<name>VkDisplayModeKHR</name>)</type>
+ <type category="handle" parent="VkInstance" objtypeenum="VK_OBJECT_TYPE_SURFACE_KHR"><type>VK_DEFINE_NON_DISPATCHABLE_HANDLE</type>(<name>VkSurfaceKHR</name>)</type>
+ <type category="handle" parent="VkSurfaceKHR" objtypeenum="VK_OBJECT_TYPE_SWAPCHAIN_KHR"><type>VK_DEFINE_NON_DISPATCHABLE_HANDLE</type>(<name>VkSwapchainKHR</name>)</type>
+ <type category="handle" parent="VkInstance" objtypeenum="VK_OBJECT_TYPE_DEBUG_REPORT_CALLBACK_EXT"><type>VK_DEFINE_NON_DISPATCHABLE_HANDLE</type>(<name>VkDebugReportCallbackEXT</name>)</type>
+ <type category="handle" parent="VkInstance" objtypeenum="VK_OBJECT_TYPE_DEBUG_UTILS_MESSENGER_EXT"><type>VK_DEFINE_NON_DISPATCHABLE_HANDLE</type>(<name>VkDebugUtilsMessengerEXT</name>)</type>
+
+ <comment>Video extensions</comment>
+ <type category="handle" parent="VkDevice" objtypeenum="VK_OBJECT_TYPE_VIDEO_SESSION_KHR"><type>VK_DEFINE_NON_DISPATCHABLE_HANDLE</type>(<name>VkVideoSessionKHR</name>)</type>
+ <type category="handle" parent="VkVideoSessionKHR" objtypeenum="VK_OBJECT_TYPE_VIDEO_SESSION_PARAMETERS_KHR"><type>VK_DEFINE_NON_DISPATCHABLE_HANDLE</type>(<name>VkVideoSessionParametersKHR</name>)</type>
+
+ <comment>Types generated from corresponding enums tags below</comment>
<type name="VkAttachmentLoadOp" category="enum"/>
<type name="VkAttachmentStoreOp" category="enum"/>
<type name="VkBlendFactor" category="enum"/>
@@ -270,20 +537,9 @@ maintained in the master branch of the Khronos Vulkan GitHub project.
<type name="VkRenderPassCreateFlagBits" category="enum"/>
<type name="VkSamplerCreateFlagBits" category="enum"/>
<type name="VkPipelineCacheHeaderVersion" category="enum"/>
- <type name="VkPipelineLayoutCreateFlagBits" category="enum"/>
<type name="VkPipelineCacheCreateFlagBits" category="enum"/>
- <type name="VkPipelineDepthStencilStateCreateFlagBits" category="enum"/>
- <type name="VkPipelineDynamicStateCreateFlagBits" category="enum"/>
- <type name="VkPipelineColorBlendStateCreateFlagBits" category="enum"/>
- <type name="VkPipelineMultisampleStateCreateFlagBits" category="enum"/>
- <type name="VkPipelineRasterizationStateCreateFlagBits" category="enum"/>
- <type name="VkPipelineViewportStateCreateFlagBits" category="enum"/>
- <type name="VkPipelineTessellationStateCreateFlagBits" category="enum"/>
- <type name="VkPipelineInputAssemblyStateCreateFlagBits" category="enum"/>
- <type name="VkPipelineVertexInputStateCreateFlagBits" category="enum"/>
<type name="VkPipelineShaderStageCreateFlagBits" category="enum"/>
<type name="VkDescriptorSetLayoutCreateFlagBits" category="enum"/>
- <type name="VkBufferViewCreateFlagBits" category="enum"/>
<type name="VkInstanceCreateFlagBits" category="enum"/>
<type name="VkDeviceQueueCreateFlagBits" category="enum"/>
<type name="VkBufferCreateFlagBits" category="enum"/>
@@ -311,6 +567,7 @@ maintained in the master branch of the Khronos Vulkan GitHub project.
<type name="VkImageTiling" category="enum"/>
<type name="VkImageType" category="enum"/>
<type name="VkImageUsageFlagBits" category="enum"/>
+ <type name="VkImageViewCreateFlagBits" category="enum"/>
<type name="VkImageViewType" category="enum"/>
<type name="VkSharingMode" category="enum"/>
<type name="VkIndexType" category="enum"/>
@@ -346,11 +603,106 @@ maintained in the master branch of the Khronos Vulkan GitHub project.
<type name="VkAttachmentDescriptionFlagBits" category="enum"/>
<type name="VkDescriptorPoolCreateFlagBits" category="enum"/>
<type name="VkDependencyFlagBits" category="enum"/>
- <type name="VkIndirectCommandsLayoutUsageFlagBitsNVX" category="enum"/>
- <type name="VkIndirectCommandsTokenTypeNVX" category="enum"/>
- <type name="VkObjectEntryUsageFlagBitsNVX" category="enum"/>
- <type name="VkObjectEntryTypeNVX" category="enum"/>
- <!-- WSI extensions -->
+ <type name="VkObjectType" category="enum"/>
+ <type name="VkEventCreateFlagBits" category="enum"/>
+ <type name="VkPipelineLayoutCreateFlagBits" category="enum"/>
+ <type name="VkSemaphoreCreateFlagBits" category="enum"/>
+
+ <comment>Extensions</comment>
+ <type name="VkIndirectCommandsLayoutUsageFlagBitsNV" category="enum"/>
+ <type name="VkIndirectCommandsTokenTypeNV" category="enum"/>
+ <type name="VkIndirectStateFlagBitsNV" category="enum"/>
+ <type name="VkPrivateDataSlotCreateFlagBits" category="enum"/>
+ <type category="enum" name="VkPrivateDataSlotCreateFlagBitsEXT" alias="VkPrivateDataSlotCreateFlagBits"/>
+ <type name="VkDescriptorUpdateTemplateType" category="enum"/>
+ <type category="enum" name="VkDescriptorUpdateTemplateTypeKHR" alias="VkDescriptorUpdateTemplateType"/>
+ <type name="VkViewportCoordinateSwizzleNV" category="enum"/>
+ <type name="VkDiscardRectangleModeEXT" category="enum"/>
+ <type name="VkSubpassDescriptionFlagBits" category="enum"/>
+ <type name="VkPointClippingBehavior" category="enum"/>
+ <type category="enum" name="VkPointClippingBehaviorKHR" alias="VkPointClippingBehavior"/>
+ <type name="VkCoverageModulationModeNV" category="enum"/>
+ <type name="VkCoverageReductionModeNV" category="enum"/>
+ <type name="VkValidationCacheHeaderVersionEXT" category="enum"/>
+ <type name="VkShaderInfoTypeAMD" category="enum"/>
+ <type name="VkQueueGlobalPriorityKHR" category="enum"/>
+ <type name="VkQueueGlobalPriorityEXT" category="enum" alias="VkQueueGlobalPriorityKHR"/>
+ <type name="VkTimeDomainEXT" category="enum"/>
+ <type name="VkConservativeRasterizationModeEXT" category="enum"/>
+ <type name="VkResolveModeFlagBits" category="enum"/>
+ <type category="enum" name="VkResolveModeFlagBitsKHR" alias="VkResolveModeFlagBits"/>
+ <type name="VkDescriptorBindingFlagBits" category="enum"/>
+ <type category="enum" name="VkDescriptorBindingFlagBitsEXT" alias="VkDescriptorBindingFlagBits"/>
+ <type name="VkConditionalRenderingFlagBitsEXT" category="enum"/>
+ <type name="VkSemaphoreType" category="enum"/>
+ <type category="enum" name="VkSemaphoreTypeKHR" alias="VkSemaphoreType"/>
+ <type name="VkGeometryFlagBitsKHR" category="enum"/>
+ <type category="enum" name="VkGeometryFlagBitsNV" alias="VkGeometryFlagBitsKHR"/>
+ <type name="VkGeometryInstanceFlagBitsKHR" category="enum"/>
+ <type category="enum" name="VkGeometryInstanceFlagBitsNV" alias="VkGeometryInstanceFlagBitsKHR"/>
+ <type name="VkBuildAccelerationStructureFlagBitsKHR" category="enum"/>
+ <type category="enum" name="VkBuildAccelerationStructureFlagBitsNV" alias="VkBuildAccelerationStructureFlagBitsKHR"/>
+ <type name="VkAccelerationStructureCreateFlagBitsKHR" category="enum"/>
+ <type name="VkBuildAccelerationStructureModeKHR" category="enum"/>
+ <type name="VkCopyAccelerationStructureModeKHR" category="enum"/>
+ <type category="enum" name="VkCopyAccelerationStructureModeNV" alias="VkCopyAccelerationStructureModeKHR"/>
+ <type name="VkAccelerationStructureTypeKHR" category="enum"/>
+ <type category="enum" name="VkAccelerationStructureTypeNV" alias="VkAccelerationStructureTypeKHR"/>
+ <type name="VkGeometryTypeKHR" category="enum"/>
+ <type category="enum" name="VkGeometryTypeNV" alias="VkGeometryTypeKHR"/>
+ <type name="VkRayTracingShaderGroupTypeKHR" category="enum"/>
+ <type category="enum" name="VkRayTracingShaderGroupTypeNV" alias="VkRayTracingShaderGroupTypeKHR"/>
+ <type name="VkAccelerationStructureMemoryRequirementsTypeNV" category="enum"/>
+ <type name="VkAccelerationStructureBuildTypeKHR" category="enum"/>
+ <type name="VkAccelerationStructureCompatibilityKHR" category="enum"/>
+ <type name="VkShaderGroupShaderKHR" category="enum"/>
+ <type name="VkMemoryOverallocationBehaviorAMD" category="enum"/>
+ <type name="VkScopeNV" category="enum"/>
+ <type name="VkComponentTypeNV" category="enum"/>
+ <type name="VkDeviceDiagnosticsConfigFlagBitsNV" category="enum"/>
+ <type name="VkPipelineCreationFeedbackFlagBits" category="enum"/>
+ <type category="enum" name="VkPipelineCreationFeedbackFlagBitsEXT" alias="VkPipelineCreationFeedbackFlagBits"/>
+ <type name="VkPerformanceCounterScopeKHR" category="enum"/>
+ <type name="VkPerformanceCounterUnitKHR" category="enum"/>
+ <type name="VkPerformanceCounterStorageKHR" category="enum"/>
+ <type name="VkPerformanceCounterDescriptionFlagBitsKHR" category="enum"/>
+ <type name="VkAcquireProfilingLockFlagBitsKHR" category="enum"/>
+ <type name="VkSemaphoreWaitFlagBits" category="enum"/>
+ <type category="enum" name="VkSemaphoreWaitFlagBitsKHR" alias="VkSemaphoreWaitFlagBits"/>
+ <type name="VkPerformanceConfigurationTypeINTEL" category="enum"/>
+ <type name="VkQueryPoolSamplingModeINTEL" category="enum"/>
+ <type name="VkPerformanceOverrideTypeINTEL" category="enum"/>
+ <type name="VkPerformanceParameterTypeINTEL" category="enum"/>
+ <type name="VkPerformanceValueTypeINTEL" category="enum"/>
+ <type name="VkLineRasterizationModeEXT" category="enum"/>
+ <type name="VkShaderModuleCreateFlagBits" category="enum"/>
+ <type name="VkPipelineCompilerControlFlagBitsAMD" category="enum"/>
+ <type name="VkShaderCorePropertiesFlagBitsAMD" category="enum"/>
+ <type name="VkToolPurposeFlagBits" category="enum"/>
+ <type category="enum" name="VkToolPurposeFlagBitsEXT" alias="VkToolPurposeFlagBits"/>
+ <type name="VkFragmentShadingRateNV" category="enum"/>
+ <type name="VkFragmentShadingRateTypeNV" category="enum"/>
+ <type name="VkSubpassMergeStatusEXT" category="enum"/>
+ <type name="VkAccessFlagBits2" category="enum"/>
+ <type category="enum" name="VkAccessFlagBits2KHR" alias="VkAccessFlagBits2"/>
+ <type name="VkPipelineStageFlagBits2" category="enum"/>
+ <type category="enum" name="VkPipelineStageFlagBits2KHR" alias="VkPipelineStageFlagBits2"/>
+ <type name="VkProvokingVertexModeEXT" category="enum"/>
+ <type name="VkImageFormatConstraintsFlagBitsFUCHSIA" category="enum"/>
+ <type name="VkImageConstraintsInfoFlagBitsFUCHSIA" category="enum"/>
+ <type name="VkFormatFeatureFlagBits2" category="enum"/>
+ <type category="enum" name="VkFormatFeatureFlagBits2KHR" alias="VkFormatFeatureFlagBits2"/>
+ <type name="VkRenderingFlagBits" category="enum"/>
+ <type category="enum" name="VkRenderingFlagBitsKHR" alias="VkRenderingFlagBits"/>
+ <type name="VkPipelineDepthStencilStateCreateFlagBits" category="enum"/>
+ <type name="VkPipelineColorBlendStateCreateFlagBits" category="enum"/>
+ <type name="VkImageCompressionFlagBitsEXT" category="enum"/>
+ <type name="VkImageCompressionFixedRateFlagBitsEXT" category="enum"/>
+ <type name="VkExportMetalObjectTypeFlagBitsEXT" category="enum"/>
+ <type name="VkPipelineRobustnessBufferBehaviorEXT" category="enum"/>
+ <type name="VkPipelineRobustnessImageBehaviorEXT" category="enum"/>
+
+ <comment>WSI extensions</comment>
<type name="VkColorSpaceKHR" category="enum"/>
<type name="VkCompositeAlphaFlagBitsKHR" category="enum"/>
<type name="VkDisplayPlaneAlphaFlagBitsKHR" category="enum"/>
@@ -358,17 +710,110 @@ maintained in the master branch of the Khronos Vulkan GitHub project.
<type name="VkSurfaceTransformFlagBitsKHR" category="enum"/>
<type name="VkDebugReportFlagBitsEXT" category="enum"/>
<type name="VkDebugReportObjectTypeEXT" category="enum"/>
- <type name="VkDebugReportErrorEXT" category="enum"/>
+ <type name="VkDeviceMemoryReportEventTypeEXT" category="enum"/>
<type name="VkRasterizationOrderAMD" category="enum"/>
<type name="VkExternalMemoryHandleTypeFlagBitsNV" category="enum"/>
<type name="VkExternalMemoryFeatureFlagBitsNV" category="enum"/>
<type name="VkValidationCheckEXT" category="enum"/>
+ <type name="VkValidationFeatureEnableEXT" category="enum"/>
+ <type name="VkValidationFeatureDisableEXT" category="enum"/>
+ <type name="VkExternalMemoryHandleTypeFlagBits" category="enum"/>
+ <type category="enum" name="VkExternalMemoryHandleTypeFlagBitsKHR" alias="VkExternalMemoryHandleTypeFlagBits"/>
+ <type name="VkExternalMemoryFeatureFlagBits" category="enum"/>
+ <type category="enum" name="VkExternalMemoryFeatureFlagBitsKHR" alias="VkExternalMemoryFeatureFlagBits"/>
+ <type name="VkExternalSemaphoreHandleTypeFlagBits" category="enum"/>
+ <type category="enum" name="VkExternalSemaphoreHandleTypeFlagBitsKHR" alias="VkExternalSemaphoreHandleTypeFlagBits"/>
+ <type name="VkExternalSemaphoreFeatureFlagBits" category="enum"/>
+ <type category="enum" name="VkExternalSemaphoreFeatureFlagBitsKHR" alias="VkExternalSemaphoreFeatureFlagBits"/>
+ <type name="VkSemaphoreImportFlagBits" category="enum"/>
+ <type category="enum" name="VkSemaphoreImportFlagBitsKHR" alias="VkSemaphoreImportFlagBits"/>
+ <type name="VkExternalFenceHandleTypeFlagBits" category="enum"/>
+ <type category="enum" name="VkExternalFenceHandleTypeFlagBitsKHR" alias="VkExternalFenceHandleTypeFlagBits"/>
+ <type name="VkExternalFenceFeatureFlagBits" category="enum"/>
+ <type category="enum" name="VkExternalFenceFeatureFlagBitsKHR" alias="VkExternalFenceFeatureFlagBits"/>
+ <type name="VkFenceImportFlagBits" category="enum"/>
+ <type category="enum" name="VkFenceImportFlagBitsKHR" alias="VkFenceImportFlagBits"/>
<type name="VkSurfaceCounterFlagBitsEXT" category="enum"/>
<type name="VkDisplayPowerStateEXT" category="enum"/>
<type name="VkDeviceEventTypeEXT" category="enum"/>
<type name="VkDisplayEventTypeEXT" category="enum"/>
+ <type name="VkPeerMemoryFeatureFlagBits" category="enum"/>
+ <type category="enum" name="VkPeerMemoryFeatureFlagBitsKHR" alias="VkPeerMemoryFeatureFlagBits"/>
+ <type name="VkMemoryAllocateFlagBits" category="enum"/>
+ <type category="enum" name="VkMemoryAllocateFlagBitsKHR" alias="VkMemoryAllocateFlagBits"/>
+ <type name="VkDeviceGroupPresentModeFlagBitsKHR" category="enum"/>
+ <type name="VkSwapchainCreateFlagBitsKHR" category="enum"/>
+ <type name="VkSubgroupFeatureFlagBits" category="enum"/>
+ <type name="VkTessellationDomainOrigin" category="enum"/>
+ <type category="enum" name="VkTessellationDomainOriginKHR" alias="VkTessellationDomainOrigin"/>
+ <type name="VkSamplerYcbcrModelConversion" category="enum"/>
+ <type category="enum" name="VkSamplerYcbcrModelConversionKHR" alias="VkSamplerYcbcrModelConversion"/>
+ <type name="VkSamplerYcbcrRange" category="enum"/>
+ <type category="enum" name="VkSamplerYcbcrRangeKHR" alias="VkSamplerYcbcrRange"/>
+ <type name="VkChromaLocation" category="enum"/>
+ <type category="enum" name="VkChromaLocationKHR" alias="VkChromaLocation"/>
+ <type name="VkSamplerReductionMode" category="enum"/>
+ <type category="enum" name="VkSamplerReductionModeEXT" alias="VkSamplerReductionMode"/>
+ <type name="VkBlendOverlapEXT" category="enum"/>
+ <type name="VkDebugUtilsMessageSeverityFlagBitsEXT" category="enum"/>
+ <type name="VkDebugUtilsMessageTypeFlagBitsEXT" category="enum"/>
+ <type name="VkFullScreenExclusiveEXT" category="enum"/>
+ <type name="VkShaderFloatControlsIndependence" category="enum"/>
+ <type category="enum" name="VkShaderFloatControlsIndependenceKHR" alias="VkShaderFloatControlsIndependence"/>
+ <type name="VkSwapchainImageUsageFlagBitsANDROID" category="enum"/>
+ <type name="VkFragmentShadingRateCombinerOpKHR" category="enum"/>
+ <type name="VkSubmitFlagBits" category="enum"/>
+ <type category="enum" name="VkSubmitFlagBitsKHR" alias="VkSubmitFlagBits"/>
+ <type name="VkGraphicsPipelineLibraryFlagBitsEXT" category="enum"/>
- <!-- The PFN_vk*Function types are used by VkAllocationCallbacks below -->
+ <comment>Enumerated types in the header, but not used by the API</comment>
+ <type name="VkVendorId" category="enum"/>
+ <type name="VkDriverId" category="enum"/>
+ <type category="enum" name="VkDriverIdKHR" alias="VkDriverId"/>
+ <type name="VkShadingRatePaletteEntryNV" category="enum"/>
+ <type name="VkCoarseSampleOrderTypeNV" category="enum"/>
+ <type name="VkPipelineExecutableStatisticFormatKHR" category="enum"/>
+
+ <comment>Video Core extensions</comment>
+ <type name="VkVideoCodecOperationFlagBitsKHR" category="enum"/>
+ <type name="VkVideoChromaSubsamplingFlagBitsKHR" category="enum"/>
+ <type name="VkVideoComponentBitDepthFlagBitsKHR" category="enum"/>
+ <type name="VkVideoCapabilityFlagBitsKHR" category="enum"/>
+ <type name="VkVideoSessionCreateFlagBitsKHR" category="enum"/>
+ <type name="VkVideoCodingQualityPresetFlagBitsKHR" category="enum"/>
+ <type name="VkVideoCodingControlFlagBitsKHR" category="enum"/>
+ <type name="VkQueryResultStatusKHR" category="enum"/>
+
+ <comment>Video Decode extensions</comment>
+ <type name="VkVideoDecodeCapabilityFlagBitsKHR" category="enum"/>
+ <type name="VkVideoDecodeFlagBitsKHR" category="enum"/>
+
+ <comment>Video H.264 Decode extensions</comment>
+ <type name="VkVideoDecodeH264PictureLayoutFlagBitsEXT" category="enum"/>
+
+ <comment>Video H.265 Decode extensions</comment>
+
+ <comment>Video Encode extensions</comment>
+ <type name="VkVideoEncodeFlagBitsKHR" category="enum"/>
+ <type name="VkVideoEncodeCapabilityFlagBitsKHR" category="enum"/>
+ <type name="VkVideoEncodeRateControlFlagBitsKHR" category="enum"/>
+ <type name="VkVideoEncodeRateControlModeFlagBitsKHR" category="enum"/>
+
+ <comment>Video H.264 Encode extensions</comment>
+ <type name="VkVideoEncodeH264CapabilityFlagBitsEXT" category="enum"/>
+ <type name="VkVideoEncodeH264InputModeFlagBitsEXT" category="enum"/>
+ <type name="VkVideoEncodeH264OutputModeFlagBitsEXT" category="enum"/>
+ <type name="VkVideoEncodeH264RateControlStructureFlagBitsEXT" category="enum"/>
+
+ <comment>Video H.265 Encode extensions</comment>
+ <type name="VkVideoEncodeH265CapabilityFlagBitsEXT" category="enum"/>
+ <type name="VkVideoEncodeH265InputModeFlagBitsEXT" category="enum"/>
+ <type name="VkVideoEncodeH265OutputModeFlagBitsEXT" category="enum"/>
+ <type name="VkVideoEncodeH265RateControlStructureFlagBitsEXT" category="enum"/>
+ <type name="VkVideoEncodeH265CtbSizeFlagBitsEXT" category="enum"/>
+ <type name="VkVideoEncodeH265TransformBlockSizeFlagBitsEXT" category="enum"/>
+
+ <comment>The PFN_vk*Function types are used by VkAllocationCallbacks below</comment>
<type category="funcpointer">typedef void (VKAPI_PTR *<name>PFN_vkInternalAllocationNotification</name>)(
<type>void</type>* pUserData,
<type>size_t</type> size,
@@ -394,10 +839,10 @@ maintained in the master branch of the Khronos Vulkan GitHub project.
<type>void</type>* pUserData,
<type>void</type>* pMemory);</type>
- <!-- The PFN_vkVoidFunction type are used by VkGet*ProcAddr below -->
+ <comment>The PFN_vkVoidFunction type are used by VkGet*ProcAddr below</comment>
<type category="funcpointer">typedef void (VKAPI_PTR *<name>PFN_vkVoidFunction</name>)(void);</type>
- <!-- The PFN_vkDebugReportCallbackEXT type are used by the DEBUG_REPORT extension-->
+ <comment>The PFN_vkDebugReportCallbackEXT type are used by the DEBUG_REPORT extension</comment>
<type category="funcpointer">typedef VkBool32 (VKAPI_PTR *<name>PFN_vkDebugReportCallbackEXT</name>)(
<type>VkDebugReportFlagsEXT</type> flags,
<type>VkDebugReportObjectTypeEXT</type> objectType,
@@ -408,7 +853,27 @@ maintained in the master branch of the Khronos Vulkan GitHub project.
const <type>char</type>* pMessage,
<type>void</type>* pUserData);</type>
- <!-- Struct types -->
+ <comment>The PFN_vkDebugUtilsMessengerCallbackEXT type are used by the VK_EXT_debug_utils extension</comment>
+ <type category="funcpointer" requires="VkDebugUtilsMessengerCallbackDataEXT">typedef VkBool32 (VKAPI_PTR *<name>PFN_vkDebugUtilsMessengerCallbackEXT</name>)(
+ <type>VkDebugUtilsMessageSeverityFlagBitsEXT</type> messageSeverity,
+ <type>VkDebugUtilsMessageTypeFlagsEXT</type> messageTypes,
+ const <type>VkDebugUtilsMessengerCallbackDataEXT</type>* pCallbackData,
+ <type>void</type>* pUserData);</type>
+
+ <comment>The PFN_vkDeviceMemoryReportCallbackEXT type is used by the VK_EXT_device_memory_report extension</comment>
+ <type category="funcpointer" requires="VkDeviceMemoryReportCallbackDataEXT">typedef void (VKAPI_PTR *<name>PFN_vkDeviceMemoryReportCallbackEXT</name>)(
+ const <type>VkDeviceMemoryReportCallbackDataEXT</type>* pCallbackData,
+ <type>void</type>* pUserData);</type>
+
+ <comment>Struct types</comment>
+ <type category="struct" name="VkBaseOutStructure">
+ <member><type>VkStructureType</type> <name>sType</name></member>
+ <member optional="true">struct <type>VkBaseOutStructure</type>* <name>pNext</name></member>
+ </type>
+ <type category="struct" name="VkBaseInStructure">
+ <member><type>VkStructureType</type> <name>sType</name></member>
+ <member optional="true">const struct <type>VkBaseInStructure</type>* <name>pNext</name></member>
+ </type>
<type category="struct" name="VkOffset2D">
<member><type>int32_t</type> <name>x</name></member>
<member><type>int32_t</type> <name>y</name></member>
@@ -428,21 +893,17 @@ maintained in the master branch of the Khronos Vulkan GitHub project.
<member><type>uint32_t</type> <name>depth</name></member>
</type>
<type category="struct" name="VkViewport">
- <member><type>float</type> <name>x</name></member>
- <member><type>float</type> <name>y</name></member>
- <member><type>float</type> <name>width</name></member>
- <member><type>float</type> <name>height</name></member>
- <member><type>float</type> <name>minDepth</name></member>
- <member><type>float</type> <name>maxDepth</name></member>
+ <member noautovalidity="true"><type>float</type> <name>x</name></member>
+ <member noautovalidity="true"><type>float</type> <name>y</name></member>
+ <member noautovalidity="true"><type>float</type> <name>width</name></member>
+ <member noautovalidity="true"><type>float</type> <name>height</name></member>
+ <member><type>float</type> <name>minDepth</name></member>
+ <member><type>float</type> <name>maxDepth</name></member>
</type>
<type category="struct" name="VkRect2D">
<member><type>VkOffset2D</type> <name>offset</name></member>
<member><type>VkExtent2D</type> <name>extent</name></member>
</type>
- <type category="struct" name="VkRect3D">
- <member><type>VkOffset3D</type> <name>offset</name></member>
- <member><type>VkExtent3D</type> <name>extent</name></member>
- </type>
<type category="struct" name="VkClearRect">
<member><type>VkRect2D</type> <name>rect</name></member>
<member><type>uint32_t</type> <name>baseArrayLayer</name></member>
@@ -455,29 +916,29 @@ maintained in the master branch of the Khronos Vulkan GitHub project.
<member><type>VkComponentSwizzle</type> <name>a</name></member>
</type>
<type category="struct" name="VkPhysicalDeviceProperties" returnedonly="true">
- <member><type>uint32_t</type> <name>apiVersion</name></member>
- <member><type>uint32_t</type> <name>driverVersion</name></member>
- <member><type>uint32_t</type> <name>vendorID</name></member>
- <member><type>uint32_t</type> <name>deviceID</name></member>
- <member><type>VkPhysicalDeviceType</type> <name>deviceType</name></member>
- <member><type>char</type> <name>deviceName</name>[<enum>VK_MAX_PHYSICAL_DEVICE_NAME_SIZE</enum>]</member>
- <member><type>uint8_t</type> <name>pipelineCacheUUID</name>[<enum>VK_UUID_SIZE</enum>]</member>
- <member><type>VkPhysicalDeviceLimits</type> <name>limits</name></member>
- <member><type>VkPhysicalDeviceSparseProperties</type> <name>sparseProperties</name></member>
+ <member limittype="noauto"><type>uint32_t</type> <name>apiVersion</name></member>
+ <member limittype="noauto"><type>uint32_t</type> <name>driverVersion</name></member>
+ <member limittype="noauto"><type>uint32_t</type> <name>vendorID</name></member>
+ <member limittype="noauto"><type>uint32_t</type> <name>deviceID</name></member>
+ <member limittype="noauto"><type>VkPhysicalDeviceType</type> <name>deviceType</name></member>
+ <member limittype="noauto"><type>char</type> <name>deviceName</name>[<enum>VK_MAX_PHYSICAL_DEVICE_NAME_SIZE</enum>]</member>
+ <member limittype="noauto"><type>uint8_t</type> <name>pipelineCacheUUID</name>[<enum>VK_UUID_SIZE</enum>]</member>
+ <member limittype="struct"><type>VkPhysicalDeviceLimits</type> <name>limits</name></member>
+ <member limittype="struct"><type>VkPhysicalDeviceSparseProperties</type> <name>sparseProperties</name></member>
</type>
<type category="struct" name="VkExtensionProperties" returnedonly="true">
- <member><type>char</type> <name>extensionName</name>[<enum>VK_MAX_EXTENSION_NAME_SIZE</enum>]</member> <!-- extension name -->
- <member><type>uint32_t</type> <name>specVersion</name></member> <!-- version of the extension specification implemented -->
+ <member><type>char</type> <name>extensionName</name>[<enum>VK_MAX_EXTENSION_NAME_SIZE</enum>]<comment>extension name</comment></member>
+ <member><type>uint32_t</type> <name>specVersion</name><comment>version of the extension specification implemented</comment></member>
</type>
<type category="struct" name="VkLayerProperties" returnedonly="true">
- <member><type>char</type> <name>layerName</name>[<enum>VK_MAX_EXTENSION_NAME_SIZE</enum>]</member> <!-- layer name -->
- <member><type>uint32_t</type> <name>specVersion</name></member> <!-- version of the layer specification implemented -->
- <member><type>uint32_t</type> <name>implementationVersion</name></member> <!-- build or release version of the layer's library -->
- <member><type>char</type> <name>description</name>[<enum>VK_MAX_DESCRIPTION_SIZE</enum>]</member> <!-- Free-form description of the layer -->
+ <member><type>char</type> <name>layerName</name>[<enum>VK_MAX_EXTENSION_NAME_SIZE</enum>]<comment>layer name</comment></member>
+ <member><type>uint32_t</type> <name>specVersion</name><comment>version of the layer specification implemented</comment></member>
+ <member><type>uint32_t</type> <name>implementationVersion</name><comment>build or release version of the layer's library</comment></member>
+ <member><type>char</type> <name>description</name>[<enum>VK_MAX_DESCRIPTION_SIZE</enum>]<comment>Free-form description of the layer</comment></member>
</type>
<type category="struct" name="VkApplicationInfo">
<member values="VK_STRUCTURE_TYPE_APPLICATION_INFO"><type>VkStructureType</type> <name>sType</name></member>
- <member>const <type>void</type>* <name>pNext</name></member> <!-- Pointer to next structure -->
+ <member optional="true">const <type>void</type>* <name>pNext</name></member>
<member optional="true" len="null-terminated">const <type>char</type>* <name>pApplicationName</name></member>
<member><type>uint32_t</type> <name>applicationVersion</name></member>
<member optional="true" len="null-terminated">const <type>char</type>* <name>pEngineName</name></member>
@@ -486,47 +947,47 @@ maintained in the master branch of the Khronos Vulkan GitHub project.
</type>
<type category="struct" name="VkAllocationCallbacks">
<member optional="true"><type>void</type>* <name>pUserData</name></member>
- <member><type>PFN_vkAllocationFunction</type> <name>pfnAllocation</name></member>
- <member><type>PFN_vkReallocationFunction</type> <name>pfnReallocation</name></member>
- <member><type>PFN_vkFreeFunction</type> <name>pfnFree</name></member>
- <member optional="true"><type>PFN_vkInternalAllocationNotification</type> <name>pfnInternalAllocation</name></member>
- <member optional="true"><type>PFN_vkInternalFreeNotification</type> <name>pfnInternalFree</name></member>
+ <member noautovalidity="true"><type>PFN_vkAllocationFunction</type> <name>pfnAllocation</name></member>
+ <member noautovalidity="true"><type>PFN_vkReallocationFunction</type> <name>pfnReallocation</name></member>
+ <member noautovalidity="true"><type>PFN_vkFreeFunction</type> <name>pfnFree</name></member>
+ <member optional="true" noautovalidity="true"><type>PFN_vkInternalAllocationNotification</type> <name>pfnInternalAllocation</name></member>
+ <member optional="true" noautovalidity="true"><type>PFN_vkInternalFreeNotification</type> <name>pfnInternalFree</name></member>
</type>
<type category="struct" name="VkDeviceQueueCreateInfo">
<member values="VK_STRUCTURE_TYPE_DEVICE_QUEUE_CREATE_INFO"><type>VkStructureType</type> <name>sType</name></member>
- <member>const <type>void</type>* <name>pNext</name></member> <!-- Pointer to next structure -->
- <member optional="true"><type>VkDeviceQueueCreateFlags</type> <name>flags</name></member> <!-- Reserved -->
+ <member optional="true">const <type>void</type>* <name>pNext</name></member>
+ <member optional="true"><type>VkDeviceQueueCreateFlags</type> <name>flags</name></member>
<member><type>uint32_t</type> <name>queueFamilyIndex</name></member>
<member><type>uint32_t</type> <name>queueCount</name></member>
<member len="queueCount">const <type>float</type>* <name>pQueuePriorities</name></member>
</type>
<type category="struct" name="VkDeviceCreateInfo">
<member values="VK_STRUCTURE_TYPE_DEVICE_CREATE_INFO"><type>VkStructureType</type> <name>sType</name></member>
- <member validextensionstructs="VkPhysicalDeviceFeatures2KHR">const <type>void</type>* <name>pNext</name></member> <!-- Pointer to next structure -->
- <member optional="true"><type>VkDeviceCreateFlags</type> <name>flags</name></member> <!-- Reserved -->
+ <member optional="true">const <type>void</type>* <name>pNext</name></member>
+ <member optional="true"><type>VkDeviceCreateFlags</type> <name>flags</name></member>
<member><type>uint32_t</type> <name>queueCreateInfoCount</name></member>
<member len="queueCreateInfoCount">const <type>VkDeviceQueueCreateInfo</type>* <name>pQueueCreateInfos</name></member>
<member optional="true"><type>uint32_t</type> <name>enabledLayerCount</name></member>
- <member len="enabledLayerCount,null-terminated">const <type>char</type>* const* <name>ppEnabledLayerNames</name></member> <!-- Ordered list of layer names to be enabled -->
+ <member len="enabledLayerCount,null-terminated">const <type>char</type>* const* <name>ppEnabledLayerNames</name><comment>Ordered list of layer names to be enabled</comment></member>
<member optional="true"><type>uint32_t</type> <name>enabledExtensionCount</name></member>
<member len="enabledExtensionCount,null-terminated">const <type>char</type>* const* <name>ppEnabledExtensionNames</name></member>
<member optional="true">const <type>VkPhysicalDeviceFeatures</type>* <name>pEnabledFeatures</name></member>
</type>
<type category="struct" name="VkInstanceCreateInfo">
<member values="VK_STRUCTURE_TYPE_INSTANCE_CREATE_INFO"><type>VkStructureType</type> <name>sType</name></member>
- <member>const <type>void</type>* <name>pNext</name></member> <!-- Pointer to next structure -->
- <member optional="true"><type>VkInstanceCreateFlags</type> <name>flags</name></member> <!-- Reserved -->
+ <member optional="true">const <type>void</type>* <name>pNext</name></member>
+ <member optional="true"><type>VkInstanceCreateFlags</type> <name>flags</name></member>
<member optional="true">const <type>VkApplicationInfo</type>* <name>pApplicationInfo</name></member>
<member optional="true"><type>uint32_t</type> <name>enabledLayerCount</name></member>
- <member len="enabledLayerCount,null-terminated">const <type>char</type>* const* <name>ppEnabledLayerNames</name></member> <!-- Ordered list of layer names to be enabled -->
+ <member len="enabledLayerCount,null-terminated">const <type>char</type>* const* <name>ppEnabledLayerNames</name><comment>Ordered list of layer names to be enabled</comment></member>
<member optional="true"><type>uint32_t</type> <name>enabledExtensionCount</name></member>
- <member len="enabledExtensionCount,null-terminated">const <type>char</type>* const* <name>ppEnabledExtensionNames</name></member> <!-- Extension names to be enabled -->
+ <member len="enabledExtensionCount,null-terminated">const <type>char</type>* const* <name>ppEnabledExtensionNames</name><comment>Extension names to be enabled</comment></member>
</type>
<type category="struct" name="VkQueueFamilyProperties" returnedonly="true">
- <member optional="true"><type>VkQueueFlags</type> <name>queueFlags</name></member> <!-- Queue flags -->
- <member><type>uint32_t</type> <name>queueCount</name></member>
- <member><type>uint32_t</type> <name>timestampValidBits</name></member>
- <member><type>VkExtent3D</type> <name>minImageTransferGranularity</name></member> <!-- Minimum alignment requirement for image transfers -->
+ <member optional="true" limittype="bitmask"><type>VkQueueFlags</type> <name>queueFlags</name><comment>Queue flags</comment></member>
+ <member limittype="max"><type>uint32_t</type> <name>queueCount</name></member>
+ <member limittype="bits"><type>uint32_t</type> <name>timestampValidBits</name></member>
+ <member limittype="min,mul"><type>VkExtent3D</type> <name>minImageTransferGranularity</name><comment>Minimum alignment requirement for image transfers</comment></member>
</type>
<type category="struct" name="VkPhysicalDeviceMemoryProperties" returnedonly="true">
<member><type>uint32_t</type> <name>memoryTypeCount</name></member>
@@ -536,105 +997,105 @@ maintained in the master branch of the Khronos Vulkan GitHub project.
</type>
<type category="struct" name="VkMemoryAllocateInfo">
<member values="VK_STRUCTURE_TYPE_MEMORY_ALLOCATE_INFO"><type>VkStructureType</type> <name>sType</name></member>
- <member validextensionstructs="VkDedicatedAllocationMemoryAllocateInfoNV">const <type>void</type>* <name>pNext</name></member> <!-- Pointer to next structure -->
- <member><type>VkDeviceSize</type> <name>allocationSize</name></member> <!-- Size of memory allocation -->
- <member><type>uint32_t</type> <name>memoryTypeIndex</name></member> <!-- Index of the of the memory type to allocate from -->
+ <member optional="true">const <type>void</type>* <name>pNext</name></member>
+ <member><type>VkDeviceSize</type> <name>allocationSize</name><comment>Size of memory allocation</comment></member>
+ <member><type>uint32_t</type> <name>memoryTypeIndex</name><comment>Index of the of the memory type to allocate from</comment></member>
</type>
<type category="struct" name="VkMemoryRequirements" returnedonly="true">
- <member><type>VkDeviceSize</type> <name>size</name></member> <!-- Specified in bytes -->
- <member><type>VkDeviceSize</type> <name>alignment</name></member> <!-- Specified in bytes -->
- <member><type>uint32_t</type> <name>memoryTypeBits</name></member> <!-- Bitmask of the allowed memory type indices into memoryTypes[] for this object -->
+ <member><type>VkDeviceSize</type> <name>size</name><comment>Specified in bytes</comment></member>
+ <member><type>VkDeviceSize</type> <name>alignment</name><comment>Specified in bytes</comment></member>
+ <member><type>uint32_t</type> <name>memoryTypeBits</name><comment>Bitmask of the allowed memory type indices into memoryTypes[] for this object</comment></member>
</type>
<type category="struct" name="VkSparseImageFormatProperties" returnedonly="true">
- <member optional="true"><type>VkImageAspectFlags</type> <name>aspectMask</name></member>
- <member><type>VkExtent3D</type> <name>imageGranularity</name></member>
- <member optional="true"><type>VkSparseImageFormatFlags</type> <name>flags</name></member>
+ <member limittype="bitmask" optional="true"><type>VkImageAspectFlags</type> <name>aspectMask</name></member>
+ <member limittype="min,mul"><type>VkExtent3D</type> <name>imageGranularity</name></member>
+ <member limittype="bitmask" optional="true"><type>VkSparseImageFormatFlags</type> <name>flags</name></member>
</type>
<type category="struct" name="VkSparseImageMemoryRequirements" returnedonly="true">
<member><type>VkSparseImageFormatProperties</type> <name>formatProperties</name></member>
<member><type>uint32_t</type> <name>imageMipTailFirstLod</name></member>
- <member><type>VkDeviceSize</type> <name>imageMipTailSize</name></member> <!-- Specified in bytes, must be a multiple of sparse block size in bytes / alignment -->
- <member><type>VkDeviceSize</type> <name>imageMipTailOffset</name></member> <!-- Specified in bytes, must be a multiple of sparse block size in bytes / alignment -->
- <member><type>VkDeviceSize</type> <name>imageMipTailStride</name></member> <!-- Specified in bytes, must be a multiple of sparse block size in bytes / alignment -->
+ <member><type>VkDeviceSize</type> <name>imageMipTailSize</name><comment>Specified in bytes, must be a multiple of sparse block size in bytes / alignment</comment></member>
+ <member><type>VkDeviceSize</type> <name>imageMipTailOffset</name><comment>Specified in bytes, must be a multiple of sparse block size in bytes / alignment</comment></member>
+ <member><type>VkDeviceSize</type> <name>imageMipTailStride</name><comment>Specified in bytes, must be a multiple of sparse block size in bytes / alignment</comment></member>
</type>
<type category="struct" name="VkMemoryType" returnedonly="true">
- <member optional="true"><type>VkMemoryPropertyFlags</type> <name>propertyFlags</name></member> <!-- Memory properties of this memory type -->
- <member><type>uint32_t</type> <name>heapIndex</name></member> <!-- Index of the memory heap allocations of this memory type are taken from -->
+ <member optional="true"><type>VkMemoryPropertyFlags</type> <name>propertyFlags</name><comment>Memory properties of this memory type</comment></member>
+ <member><type>uint32_t</type> <name>heapIndex</name><comment>Index of the memory heap allocations of this memory type are taken from</comment></member>
</type>
<type category="struct" name="VkMemoryHeap" returnedonly="true">
- <member><type>VkDeviceSize</type> <name>size</name></member> <!-- Available memory in the heap-->
- <member optional="true"><type>VkMemoryHeapFlags</type> <name>flags</name></member> <!-- Flags for the heap-->
+ <member><type>VkDeviceSize</type> <name>size</name><comment>Available memory in the heap</comment></member>
+ <member optional="true"><type>VkMemoryHeapFlags</type> <name>flags</name><comment>Flags for the heap</comment></member>
</type>
<type category="struct" name="VkMappedMemoryRange">
<member values="VK_STRUCTURE_TYPE_MAPPED_MEMORY_RANGE"><type>VkStructureType</type> <name>sType</name></member>
- <member>const <type>void</type>* <name>pNext</name></member> <!-- Pointer to next structure -->
- <member><type>VkDeviceMemory</type> <name>memory</name></member> <!-- Mapped memory object -->
- <member><type>VkDeviceSize</type> <name>offset</name></member> <!-- Offset within the memory object where the range starts -->
- <member><type>VkDeviceSize</type> <name>size</name></member> <!-- Size of the range within the memory object -->
+ <member optional="true">const <type>void</type>* <name>pNext</name></member>
+ <member><type>VkDeviceMemory</type> <name>memory</name><comment>Mapped memory object</comment></member>
+ <member><type>VkDeviceSize</type> <name>offset</name><comment>Offset within the memory object where the range starts</comment></member>
+ <member><type>VkDeviceSize</type> <name>size</name><comment>Size of the range within the memory object</comment></member>
</type>
<type category="struct" name="VkFormatProperties" returnedonly="true">
- <member optional="true"><type>VkFormatFeatureFlags</type> <name>linearTilingFeatures</name></member> <!-- Format features in case of linear tiling -->
- <member optional="true"><type>VkFormatFeatureFlags</type> <name>optimalTilingFeatures</name></member> <!-- Format features in case of optimal tiling -->
- <member optional="true"><type>VkFormatFeatureFlags</type> <name>bufferFeatures</name></member> <!-- Format features supported by buffers -->
+ <member optional="true" limittype="bitmask"><type>VkFormatFeatureFlags</type> <name>linearTilingFeatures</name><comment>Format features in case of linear tiling</comment></member>
+ <member optional="true" limittype="bitmask"><type>VkFormatFeatureFlags</type> <name>optimalTilingFeatures</name><comment>Format features in case of optimal tiling</comment></member>
+ <member optional="true" limittype="bitmask"><type>VkFormatFeatureFlags</type> <name>bufferFeatures</name><comment>Format features supported by buffers</comment></member>
</type>
<type category="struct" name="VkImageFormatProperties" returnedonly="true">
- <member><type>VkExtent3D</type> <name>maxExtent</name></member> <!-- max image dimensions for this resource type -->
- <member><type>uint32_t</type> <name>maxMipLevels</name></member> <!-- max number of mipmap levels for this resource type -->
- <member><type>uint32_t</type> <name>maxArrayLayers</name></member> <!-- max array size for this resource type -->
- <member optional="true"><type>VkSampleCountFlags</type> <name>sampleCounts</name></member> <!-- supported sample counts for this resource type -->
- <member><type>VkDeviceSize</type> <name>maxResourceSize</name></member> <!-- max size (in bytes) of this resource type -->
+ <member><type>VkExtent3D</type> <name>maxExtent</name><comment>max image dimensions for this resource type</comment></member>
+ <member><type>uint32_t</type> <name>maxMipLevels</name><comment>max number of mipmap levels for this resource type</comment></member>
+ <member><type>uint32_t</type> <name>maxArrayLayers</name><comment>max array size for this resource type</comment></member>
+ <member optional="true"><type>VkSampleCountFlags</type> <name>sampleCounts</name><comment>supported sample counts for this resource type</comment></member>
+ <member><type>VkDeviceSize</type> <name>maxResourceSize</name><comment>max size (in bytes) of this resource type</comment></member>
</type>
<type category="struct" name="VkDescriptorBufferInfo">
- <member><type>VkBuffer</type> <name>buffer</name></member> <!-- Buffer used for this descriptor slot when the descriptor is UNIFORM_BUFFER[_DYNAMIC] or STORAGE_BUFFER[_DYNAMIC]. VK_NULL_HANDLE otherwise. -->
- <member><type>VkDeviceSize</type> <name>offset</name></member> <!-- Base offset from buffer start in bytes to update in the descriptor set. -->
- <member><type>VkDeviceSize</type> <name>range</name></member> <!-- Size in bytes of the buffer resource for this descriptor update. -->
+ <member optional="true"><type>VkBuffer</type> <name>buffer</name><comment>Buffer used for this descriptor slot.</comment></member>
+ <member><type>VkDeviceSize</type> <name>offset</name><comment>Base offset from buffer start in bytes to update in the descriptor set.</comment></member>
+ <member><type>VkDeviceSize</type> <name>range</name><comment>Size in bytes of the buffer resource for this descriptor update.</comment></member>
</type>
<type category="struct" name="VkDescriptorImageInfo">
- <member noautovalidity="true"><type>VkSampler</type> <name>sampler</name></member> <!-- Sampler to write to the descriptor in case it is a SAMPLER or COMBINED_IMAGE_SAMPLER descriptor. Ignored otherwise. -->
- <member noautovalidity="true"><type>VkImageView</type> <name>imageView</name></member> <!-- Image view to write to the descriptor in case it is a SAMPLED_IMAGE, STORAGE_IMAGE, COMBINED_IMAGE_SAMPLER, or INPUT_ATTACHMENT descriptor. Ignored otherwise. -->
- <member noautovalidity="true"><type>VkImageLayout</type> <name>imageLayout</name></member> <!-- Layout the image is expected to be in when accessed using this descriptor (only used if imageView is not VK_NULL_HANDLE). -->
+ <member noautovalidity="true"><type>VkSampler</type> <name>sampler</name><comment>Sampler to write to the descriptor in case it is a SAMPLER or COMBINED_IMAGE_SAMPLER descriptor. Ignored otherwise.</comment></member>
+ <member noautovalidity="true"><type>VkImageView</type> <name>imageView</name><comment>Image view to write to the descriptor in case it is a SAMPLED_IMAGE, STORAGE_IMAGE, COMBINED_IMAGE_SAMPLER, or INPUT_ATTACHMENT descriptor. Ignored otherwise.</comment></member>
+ <member noautovalidity="true"><type>VkImageLayout</type> <name>imageLayout</name><comment>Layout the image is expected to be in when accessed using this descriptor (only used if imageView is not VK_NULL_HANDLE).</comment></member>
</type>
<type category="struct" name="VkWriteDescriptorSet">
<member values="VK_STRUCTURE_TYPE_WRITE_DESCRIPTOR_SET"><type>VkStructureType</type> <name>sType</name></member>
- <member>const <type>void</type>* <name>pNext</name></member> <!-- Pointer to next structure -->
- <member><type>VkDescriptorSet</type> <name>dstSet</name></member> <!-- Destination descriptor set -->
- <member><type>uint32_t</type> <name>dstBinding</name></member> <!-- Binding within the destination descriptor set to write -->
- <member><type>uint32_t</type> <name>dstArrayElement</name></member> <!-- Array element within the destination binding to write -->
- <member><type>uint32_t</type> <name>descriptorCount</name></member> <!-- Number of descriptors to write (determines the size of the array pointed by pDescriptors) -->
- <member><type>VkDescriptorType</type> <name>descriptorType</name></member> <!-- Descriptor type to write (determines which members of the array pointed by pDescriptors are going to be used) -->
- <member noautovalidity="true" len="descriptorCount">const <type>VkDescriptorImageInfo</type>* <name>pImageInfo</name></member> <!-- Sampler, image view, and layout for SAMPLER, COMBINED_IMAGE_SAMPLER, {SAMPLED,STORAGE}_IMAGE, and INPUT_ATTACHMENT descriptor types. -->
- <member noautovalidity="true" len="descriptorCount">const <type>VkDescriptorBufferInfo</type>* <name>pBufferInfo</name></member> <!-- Raw buffer, size, and offset for {UNIFORM,STORAGE}_BUFFER[_DYNAMIC] descriptor types. -->
- <member noautovalidity="true" len="descriptorCount">const <type>VkBufferView</type>* <name>pTexelBufferView</name></member> <!-- Buffer view to write to the descriptor for {UNIFORM,STORAGE}_TEXEL_BUFFER descriptor types. -->
+ <member optional="true">const <type>void</type>* <name>pNext</name></member>
+ <member noautovalidity="true"><type>VkDescriptorSet</type> <name>dstSet</name><comment>Destination descriptor set</comment></member>
+ <member><type>uint32_t</type> <name>dstBinding</name><comment>Binding within the destination descriptor set to write</comment></member>
+ <member><type>uint32_t</type> <name>dstArrayElement</name><comment>Array element within the destination binding to write</comment></member>
+ <member><type>uint32_t</type> <name>descriptorCount</name><comment>Number of descriptors to write (determines the size of the array pointed by pDescriptors)</comment></member>
+ <member><type>VkDescriptorType</type> <name>descriptorType</name><comment>Descriptor type to write (determines which members of the array pointed by pDescriptors are going to be used)</comment></member>
+ <member noautovalidity="true" len="descriptorCount">const <type>VkDescriptorImageInfo</type>* <name>pImageInfo</name><comment>Sampler, image view, and layout for SAMPLER, COMBINED_IMAGE_SAMPLER, {SAMPLED,STORAGE}_IMAGE, and INPUT_ATTACHMENT descriptor types.</comment></member>
+ <member noautovalidity="true" len="descriptorCount">const <type>VkDescriptorBufferInfo</type>* <name>pBufferInfo</name><comment>Raw buffer, size, and offset for {UNIFORM,STORAGE}_BUFFER[_DYNAMIC] descriptor types.</comment></member>
+ <member noautovalidity="true" len="descriptorCount">const <type>VkBufferView</type>* <name>pTexelBufferView</name><comment>Buffer view to write to the descriptor for {UNIFORM,STORAGE}_TEXEL_BUFFER descriptor types.</comment></member>
</type>
<type category="struct" name="VkCopyDescriptorSet">
<member values="VK_STRUCTURE_TYPE_COPY_DESCRIPTOR_SET"><type>VkStructureType</type> <name>sType</name></member>
- <member>const <type>void</type>* <name>pNext</name></member> <!-- Pointer to next structure -->
- <member><type>VkDescriptorSet</type> <name>srcSet</name></member> <!-- Source descriptor set -->
- <member><type>uint32_t</type> <name>srcBinding</name></member> <!-- Binding within the source descriptor set to copy from -->
- <member><type>uint32_t</type> <name>srcArrayElement</name></member> <!-- Array element within the source binding to copy from -->
- <member><type>VkDescriptorSet</type> <name>dstSet</name></member> <!-- Destination descriptor set -->
- <member><type>uint32_t</type> <name>dstBinding</name></member> <!-- Binding within the destination descriptor set to copy to -->
- <member><type>uint32_t</type> <name>dstArrayElement</name></member> <!-- Array element within the destination binding to copy to -->
- <member><type>uint32_t</type> <name>descriptorCount</name></member> <!-- Number of descriptors to write (determines the size of the array pointed by pDescriptors) -->
+ <member optional="true">const <type>void</type>* <name>pNext</name></member>
+ <member><type>VkDescriptorSet</type> <name>srcSet</name><comment>Source descriptor set</comment></member>
+ <member><type>uint32_t</type> <name>srcBinding</name><comment>Binding within the source descriptor set to copy from</comment></member>
+ <member><type>uint32_t</type> <name>srcArrayElement</name><comment>Array element within the source binding to copy from</comment></member>
+ <member><type>VkDescriptorSet</type> <name>dstSet</name><comment>Destination descriptor set</comment></member>
+ <member><type>uint32_t</type> <name>dstBinding</name><comment>Binding within the destination descriptor set to copy to</comment></member>
+ <member><type>uint32_t</type> <name>dstArrayElement</name><comment>Array element within the destination binding to copy to</comment></member>
+ <member><type>uint32_t</type> <name>descriptorCount</name><comment>Number of descriptors to write (determines the size of the array pointed by pDescriptors)</comment></member>
</type>
<type category="struct" name="VkBufferCreateInfo">
<member values="VK_STRUCTURE_TYPE_BUFFER_CREATE_INFO"><type>VkStructureType</type> <name>sType</name></member>
- <member validextensionstructs="VkDedicatedAllocationBufferCreateInfoNV">const <type>void</type>* <name>pNext</name></member> <!-- Pointer to next structure. -->
- <member optional="true"><type>VkBufferCreateFlags</type> <name>flags</name></member> <!-- Buffer creation flags -->
- <member><type>VkDeviceSize</type> <name>size</name></member> <!-- Specified in bytes -->
- <member><type>VkBufferUsageFlags</type> <name>usage</name></member> <!-- Buffer usage flags -->
+ <member optional="true">const <type>void</type>* <name>pNext</name></member>
+ <member optional="true"><type>VkBufferCreateFlags</type> <name>flags</name><comment>Buffer creation flags</comment></member>
+ <member><type>VkDeviceSize</type> <name>size</name><comment>Specified in bytes</comment></member>
+ <member><type>VkBufferUsageFlags</type> <name>usage</name><comment>Buffer usage flags</comment></member>
<member><type>VkSharingMode</type> <name>sharingMode</name></member>
<member optional="true"><type>uint32_t</type> <name>queueFamilyIndexCount</name></member>
<member noautovalidity="true" len="queueFamilyIndexCount">const <type>uint32_t</type>* <name>pQueueFamilyIndices</name></member>
</type>
<type category="struct" name="VkBufferViewCreateInfo">
<member values="VK_STRUCTURE_TYPE_BUFFER_VIEW_CREATE_INFO"><type>VkStructureType</type> <name>sType</name></member>
- <member>const <type>void</type>* <name>pNext</name></member> <!-- Pointer to next structure. -->
- <member optional="true"><type>VkBufferViewCreateFlags</type><name>flags</name></member> <!-- Reserved -->
+ <member optional="true">const <type>void</type>* <name>pNext</name></member>
+ <member optional="true"><type>VkBufferViewCreateFlags</type> <name>flags</name></member>
<member><type>VkBuffer</type> <name>buffer</name></member>
- <member><type>VkFormat</type> <name>format</name></member> <!-- Optionally specifies format of elements -->
- <member><type>VkDeviceSize</type> <name>offset</name></member> <!-- Specified in bytes -->
- <member><type>VkDeviceSize</type> <name>range</name></member> <!-- View size specified in bytes -->
+ <member><type>VkFormat</type> <name>format</name><comment>Optionally specifies format of elements</comment></member>
+ <member><type>VkDeviceSize</type> <name>offset</name><comment>Specified in bytes</comment></member>
+ <member><type>VkDeviceSize</type> <name>range</name><comment>View size specified in bytes</comment></member>
</type>
<type category="struct" name="VkImageSubresource">
<member><type>VkImageAspectFlags</type> <name>aspectMask</name></member>
@@ -656,37 +1117,37 @@ maintained in the master branch of the Khronos Vulkan GitHub project.
</type>
<type category="struct" name="VkMemoryBarrier">
<member values="VK_STRUCTURE_TYPE_MEMORY_BARRIER"><type>VkStructureType</type> <name>sType</name></member>
- <member>const <type>void</type>* <name>pNext</name></member> <!-- Pointer to next structure. -->
- <member optional="true"><type>VkAccessFlags</type> <name>srcAccessMask</name></member> <!-- Memory accesses from the source of the dependency to synchronize -->
- <member optional="true"><type>VkAccessFlags</type> <name>dstAccessMask</name></member> <!-- Memory accesses from the destination of the dependency to synchronize -->
+ <member optional="true">const <type>void</type>* <name>pNext</name></member>
+ <member optional="true"><type>VkAccessFlags</type> <name>srcAccessMask</name><comment>Memory accesses from the source of the dependency to synchronize</comment></member>
+ <member optional="true"><type>VkAccessFlags</type> <name>dstAccessMask</name><comment>Memory accesses from the destination of the dependency to synchronize</comment></member>
</type>
<type category="struct" name="VkBufferMemoryBarrier">
<member values="VK_STRUCTURE_TYPE_BUFFER_MEMORY_BARRIER"><type>VkStructureType</type> <name>sType</name></member>
- <member>const <type>void</type>* <name>pNext</name></member> <!-- Pointer to next structure. -->
- <member optional="true"><type>VkAccessFlags</type> <name>srcAccessMask</name></member> <!-- Memory accesses from the source of the dependency to synchronize -->
- <member optional="true"><type>VkAccessFlags</type> <name>dstAccessMask</name></member> <!-- Memory accesses from the destination of the dependency to synchronize -->
- <member><type>uint32_t</type> <name>srcQueueFamilyIndex</name></member> <!-- Queue family to transition ownership from -->
- <member><type>uint32_t</type> <name>dstQueueFamilyIndex</name></member> <!-- Queue family to transition ownership to -->
- <member><type>VkBuffer</type> <name>buffer</name></member> <!-- Buffer to sync -->
- <member><type>VkDeviceSize</type> <name>offset</name></member> <!-- Offset within the buffer to sync -->
- <member><type>VkDeviceSize</type> <name>size</name></member> <!-- Amount of bytes to sync -->
+ <member optional="true">const <type>void</type>* <name>pNext</name></member>
+ <member noautovalidity="true"><type>VkAccessFlags</type> <name>srcAccessMask</name><comment>Memory accesses from the source of the dependency to synchronize</comment></member>
+ <member noautovalidity="true"><type>VkAccessFlags</type> <name>dstAccessMask</name><comment>Memory accesses from the destination of the dependency to synchronize</comment></member>
+ <member><type>uint32_t</type> <name>srcQueueFamilyIndex</name><comment>Queue family to transition ownership from</comment></member>
+ <member><type>uint32_t</type> <name>dstQueueFamilyIndex</name><comment>Queue family to transition ownership to</comment></member>
+ <member><type>VkBuffer</type> <name>buffer</name><comment>Buffer to sync</comment></member>
+ <member><type>VkDeviceSize</type> <name>offset</name><comment>Offset within the buffer to sync</comment></member>
+ <member><type>VkDeviceSize</type> <name>size</name><comment>Amount of bytes to sync</comment></member>
</type>
<type category="struct" name="VkImageMemoryBarrier">
<member values="VK_STRUCTURE_TYPE_IMAGE_MEMORY_BARRIER"><type>VkStructureType</type> <name>sType</name></member>
- <member>const <type>void</type>* <name>pNext</name></member> <!-- Pointer to next structure. -->
- <member optional="true"><type>VkAccessFlags</type> <name>srcAccessMask</name></member> <!-- Memory accesses from the source of the dependency to synchronize -->
- <member optional="true"><type>VkAccessFlags</type> <name>dstAccessMask</name></member> <!-- Memory accesses from the destination of the dependency to synchronize -->
- <member><type>VkImageLayout</type> <name>oldLayout</name></member> <!-- Current layout of the image -->
- <member><type>VkImageLayout</type> <name>newLayout</name></member> <!-- New layout to transition the image to -->
- <member><type>uint32_t</type> <name>srcQueueFamilyIndex</name></member> <!-- Queue family to transition ownership from -->
- <member><type>uint32_t</type> <name>dstQueueFamilyIndex</name></member> <!-- Queue family to transition ownership to -->
- <member><type>VkImage</type> <name>image</name></member> <!-- Image to sync -->
- <member><type>VkImageSubresourceRange</type> <name>subresourceRange</name></member> <!-- Subresource range to sync -->
+ <member optional="true">const <type>void</type>* <name>pNext</name></member>
+ <member noautovalidity="true"><type>VkAccessFlags</type> <name>srcAccessMask</name><comment>Memory accesses from the source of the dependency to synchronize</comment></member>
+ <member noautovalidity="true"><type>VkAccessFlags</type> <name>dstAccessMask</name><comment>Memory accesses from the destination of the dependency to synchronize</comment></member>
+ <member><type>VkImageLayout</type> <name>oldLayout</name><comment>Current layout of the image</comment></member>
+ <member><type>VkImageLayout</type> <name>newLayout</name><comment>New layout to transition the image to</comment></member>
+ <member><type>uint32_t</type> <name>srcQueueFamilyIndex</name><comment>Queue family to transition ownership from</comment></member>
+ <member><type>uint32_t</type> <name>dstQueueFamilyIndex</name><comment>Queue family to transition ownership to</comment></member>
+ <member><type>VkImage</type> <name>image</name><comment>Image to sync</comment></member>
+ <member><type>VkImageSubresourceRange</type> <name>subresourceRange</name><comment>Subresource range to sync</comment></member>
</type>
<type category="struct" name="VkImageCreateInfo">
<member values="VK_STRUCTURE_TYPE_IMAGE_CREATE_INFO"><type>VkStructureType</type> <name>sType</name></member>
- <member validextensionstructs="VkDedicatedAllocationImageCreateInfoNV">const <type>void</type>* <name>pNext</name></member> <!-- Pointer to next structure. -->
- <member optional="true"><type>VkImageCreateFlags</type> <name>flags</name></member> <!-- Image creation flags -->
+ <member optional="true">const <type>void</type>* <name>pNext</name></member>
+ <member optional="true"><type>VkImageCreateFlags</type> <name>flags</name><comment>Image creation flags</comment></member>
<member><type>VkImageType</type> <name>imageType</name></member>
<member><type>VkFormat</type> <name>format</name></member>
<member><type>VkExtent3D</type> <name>extent</name></member>
@@ -694,23 +1155,23 @@ maintained in the master branch of the Khronos Vulkan GitHub project.
<member><type>uint32_t</type> <name>arrayLayers</name></member>
<member><type>VkSampleCountFlagBits</type> <name>samples</name></member>
<member><type>VkImageTiling</type> <name>tiling</name></member>
- <member><type>VkImageUsageFlags</type> <name>usage</name></member> <!-- Image usage flags -->
- <member><type>VkSharingMode</type> <name>sharingMode</name></member> <!-- Cross-queue-family sharing mode -->
- <member optional="true"><type>uint32_t</type> <name>queueFamilyIndexCount</name></member> <!-- Number of queue families to share across -->
- <member noautovalidity="true" len="queueFamilyIndexCount">const <type>uint32_t</type>* <name>pQueueFamilyIndices</name></member> <!-- Array of queue family indices to share across -->
- <member><type>VkImageLayout</type> <name>initialLayout</name></member> <!-- Initial image layout for all subresources -->
+ <member><type>VkImageUsageFlags</type> <name>usage</name><comment>Image usage flags</comment></member>
+ <member><type>VkSharingMode</type> <name>sharingMode</name><comment>Cross-queue-family sharing mode</comment></member>
+ <member optional="true"><type>uint32_t</type> <name>queueFamilyIndexCount</name><comment>Number of queue families to share across</comment></member>
+ <member noautovalidity="true" len="queueFamilyIndexCount">const <type>uint32_t</type>* <name>pQueueFamilyIndices</name><comment>Array of queue family indices to share across</comment></member>
+ <member><type>VkImageLayout</type> <name>initialLayout</name><comment>Initial image layout for all subresources</comment></member>
</type>
<type category="struct" name="VkSubresourceLayout" returnedonly="true">
- <member><type>VkDeviceSize</type> <name>offset</name></member> <!-- Specified in bytes -->
- <member><type>VkDeviceSize</type> <name>size</name></member> <!-- Specified in bytes -->
- <member><type>VkDeviceSize</type> <name>rowPitch</name></member> <!-- Specified in bytes -->
- <member><type>VkDeviceSize</type> <name>arrayPitch</name></member> <!-- Specified in bytes -->
- <member><type>VkDeviceSize</type> <name>depthPitch</name></member> <!-- Specified in bytes -->
+ <member><type>VkDeviceSize</type> <name>offset</name><comment>Specified in bytes</comment></member>
+ <member><type>VkDeviceSize</type> <name>size</name><comment>Specified in bytes</comment></member>
+ <member><type>VkDeviceSize</type> <name>rowPitch</name><comment>Specified in bytes</comment></member>
+ <member><type>VkDeviceSize</type> <name>arrayPitch</name><comment>Specified in bytes</comment></member>
+ <member><type>VkDeviceSize</type> <name>depthPitch</name><comment>Specified in bytes</comment></member>
</type>
<type category="struct" name="VkImageViewCreateInfo">
<member values="VK_STRUCTURE_TYPE_IMAGE_VIEW_CREATE_INFO"><type>VkStructureType</type> <name>sType</name></member>
- <member>const <type>void</type>* <name>pNext</name></member> <!-- Pointer to next structure -->
- <member optional="true"><type>VkImageViewCreateFlags</type> <name>flags</name></member> <!-- Reserved -->
+ <member optional="true">const <type>void</type>* <name>pNext</name></member>
+ <member optional="true"><type>VkImageViewCreateFlags</type> <name>flags</name></member>
<member><type>VkImage</type> <name>image</name></member>
<member><type>VkImageViewType</type> <name>viewType</name></member>
<member><type>VkFormat</type> <name>format</name></member>
@@ -718,24 +1179,24 @@ maintained in the master branch of the Khronos Vulkan GitHub project.
<member><type>VkImageSubresourceRange</type> <name>subresourceRange</name></member>
</type>
<type category="struct" name="VkBufferCopy">
- <member><type>VkDeviceSize</type> <name>srcOffset</name></member> <!-- Specified in bytes -->
- <member><type>VkDeviceSize</type> <name>dstOffset</name></member> <!-- Specified in bytes -->
- <member><type>VkDeviceSize</type> <name>size</name></member> <!-- Specified in bytes -->
+ <member><type>VkDeviceSize</type> <name>srcOffset</name><comment>Specified in bytes</comment></member>
+ <member><type>VkDeviceSize</type> <name>dstOffset</name><comment>Specified in bytes</comment></member>
+ <member noautovalidity="true"><type>VkDeviceSize</type> <name>size</name><comment>Specified in bytes</comment></member>
</type>
<type category="struct" name="VkSparseMemoryBind">
- <member><type>VkDeviceSize</type> <name>resourceOffset</name></member> <!-- Specified in bytes -->
- <member><type>VkDeviceSize</type> <name>size</name></member> <!-- Specified in bytes -->
+ <member><type>VkDeviceSize</type> <name>resourceOffset</name><comment>Specified in bytes</comment></member>
+ <member><type>VkDeviceSize</type> <name>size</name><comment>Specified in bytes</comment></member>
<member optional="true"><type>VkDeviceMemory</type> <name>memory</name></member>
- <member><type>VkDeviceSize</type> <name>memoryOffset</name></member> <!-- Specified in bytes -->
- <member optional="true"><type>VkSparseMemoryBindFlags</type><name>flags</name></member> <!-- Reserved for future -->
+ <member><type>VkDeviceSize</type> <name>memoryOffset</name><comment>Specified in bytes</comment></member>
+ <member optional="true"><type>VkSparseMemoryBindFlags</type> <name>flags</name></member>
</type>
<type category="struct" name="VkSparseImageMemoryBind">
<member><type>VkImageSubresource</type> <name>subresource</name></member>
<member><type>VkOffset3D</type> <name>offset</name></member>
<member><type>VkExtent3D</type> <name>extent</name></member>
<member optional="true"><type>VkDeviceMemory</type> <name>memory</name></member>
- <member><type>VkDeviceSize</type> <name>memoryOffset</name></member> <!-- Specified in bytes -->
- <member optional="true"><type>VkSparseMemoryBindFlags</type><name>flags</name></member> <!-- Reserved for future -->
+ <member><type>VkDeviceSize</type> <name>memoryOffset</name><comment>Specified in bytes</comment></member>
+ <member optional="true"><type>VkSparseMemoryBindFlags</type> <name>flags</name></member>
</type>
<type category="struct" name="VkSparseBufferMemoryBindInfo">
<member><type>VkBuffer</type> <name>buffer</name></member>
@@ -754,7 +1215,7 @@ maintained in the master branch of the Khronos Vulkan GitHub project.
</type>
<type category="struct" name="VkBindSparseInfo">
<member values="VK_STRUCTURE_TYPE_BIND_SPARSE_INFO"><type>VkStructureType</type> <name>sType</name></member>
- <member>const <type>void</type>* <name>pNext</name></member> <!-- Pointer to next structure. -->
+ <member optional="true">const <type>void</type>* <name>pNext</name></member>
<member optional="true"><type>uint32_t</type> <name>waitSemaphoreCount</name></member>
<member len="waitSemaphoreCount">const <type>VkSemaphore</type>* <name>pWaitSemaphores</name></member>
<member optional="true"><type>uint32_t</type> <name>bufferBindCount</name></member>
@@ -768,24 +1229,24 @@ maintained in the master branch of the Khronos Vulkan GitHub project.
</type>
<type category="struct" name="VkImageCopy">
<member><type>VkImageSubresourceLayers</type> <name>srcSubresource</name></member>
- <member><type>VkOffset3D</type> <name>srcOffset</name></member> <!-- Specified in pixels for both compressed and uncompressed images -->
+ <member><type>VkOffset3D</type> <name>srcOffset</name><comment>Specified in pixels for both compressed and uncompressed images</comment></member>
<member><type>VkImageSubresourceLayers</type> <name>dstSubresource</name></member>
- <member><type>VkOffset3D</type> <name>dstOffset</name></member> <!-- Specified in pixels for both compressed and uncompressed images -->
- <member><type>VkExtent3D</type> <name>extent</name></member> <!-- Specified in pixels for both compressed and uncompressed images -->
+ <member><type>VkOffset3D</type> <name>dstOffset</name><comment>Specified in pixels for both compressed and uncompressed images</comment></member>
+ <member><type>VkExtent3D</type> <name>extent</name><comment>Specified in pixels for both compressed and uncompressed images</comment></member>
</type>
<type category="struct" name="VkImageBlit">
<member><type>VkImageSubresourceLayers</type> <name>srcSubresource</name></member>
- <member><type>VkOffset3D</type> <name>srcOffsets</name>[2]</member> <!-- Specified in pixels for both compressed and uncompressed images -->
+ <member><type>VkOffset3D</type> <name>srcOffsets</name>[2]<comment>Specified in pixels for both compressed and uncompressed images</comment></member>
<member><type>VkImageSubresourceLayers</type> <name>dstSubresource</name></member>
- <member><type>VkOffset3D</type> <name>dstOffsets</name>[2]</member> <!-- Specified in pixels for both compressed and uncompressed images -->
+ <member><type>VkOffset3D</type> <name>dstOffsets</name>[2]<comment>Specified in pixels for both compressed and uncompressed images</comment></member>
</type>
<type category="struct" name="VkBufferImageCopy">
- <member><type>VkDeviceSize</type> <name>bufferOffset</name></member> <!-- Specified in bytes -->
- <member><type>uint32_t</type> <name>bufferRowLength</name></member> <!-- Specified in texels -->
+ <member><type>VkDeviceSize</type> <name>bufferOffset</name><comment>Specified in bytes</comment></member>
+ <member><type>uint32_t</type> <name>bufferRowLength</name><comment>Specified in texels</comment></member>
<member><type>uint32_t</type> <name>bufferImageHeight</name></member>
<member><type>VkImageSubresourceLayers</type> <name>imageSubresource</name></member>
- <member><type>VkOffset3D</type> <name>imageOffset</name></member> <!-- Specified in pixels for both compressed and uncompressed images -->
- <member><type>VkExtent3D</type> <name>imageExtent</name></member> <!-- Specified in pixels for both compressed and uncompressed images -->
+ <member><type>VkOffset3D</type> <name>imageOffset</name><comment>Specified in pixels for both compressed and uncompressed images</comment></member>
+ <member><type>VkExtent3D</type> <name>imageExtent</name><comment>Specified in pixels for both compressed and uncompressed images</comment></member>
</type>
<type category="struct" name="VkImageResolve">
<member><type>VkImageSubresourceLayers</type> <name>srcSubresource</name></member>
@@ -794,26 +1255,26 @@ maintained in the master branch of the Khronos Vulkan GitHub project.
<member><type>VkOffset3D</type> <name>dstOffset</name></member>
<member><type>VkExtent3D</type> <name>extent</name></member>
</type>
- <type category="struct" name="VkShaderModuleCreateInfo">
+ <type category="struct" name="VkShaderModuleCreateInfo" structextends="VkPipelineShaderStageCreateInfo">
<member values="VK_STRUCTURE_TYPE_SHADER_MODULE_CREATE_INFO"><type>VkStructureType</type> <name>sType</name></member>
- <member>const <type>void</type>* <name>pNext</name></member> <!-- Pointer to next structure -->
- <member optional="true"><type>VkShaderModuleCreateFlags</type> <name>flags</name></member> <!-- Reserved -->
- <member><type>size_t</type> <name>codeSize</name></member> <!-- Specified in bytes -->
- <member len="latexmath:[$codeSize \over 4$]">const <type>uint32_t</type>* <name>pCode</name></member> <!-- Binary code of size codeSize -->
+ <member noautovalidity="true" optional="true">const <type>void</type>* <name>pNext</name><comment>noautovalidity because this structure can be either an explicit parameter, or passed in a pNext chain</comment></member>
+ <member optional="true"><type>VkShaderModuleCreateFlags</type> <name>flags</name></member>
+ <member><type>size_t</type> <name>codeSize</name><comment>Specified in bytes</comment></member>
+ <member len="latexmath:[\textrm{codeSize} \over 4]" altlen="codeSize / 4">const <type>uint32_t</type>* <name>pCode</name><comment>Binary code of size codeSize</comment></member>
</type>
<type category="struct" name="VkDescriptorSetLayoutBinding">
- <member><type>uint32_t</type> <name>binding</name></member> <!-- Binding number for this entry -->
- <member><type>VkDescriptorType</type> <name>descriptorType</name></member> <!-- Type of the descriptors in this binding -->
- <member optional="true"><type>uint32_t</type> <name>descriptorCount</name></member> <!-- Number of descriptors in this binding -->
- <member noautovalidity="true"><type>VkShaderStageFlags</type> <name>stageFlags</name></member> <!-- Shader stages this binding is visible to -->
- <member noautovalidity="true" optional="true" len="descriptorCount">const <type>VkSampler</type>* <name>pImmutableSamplers</name></member> <!-- Immutable samplers (used if descriptor type is SAMPLER or COMBINED_IMAGE_SAMPLER, is either NULL or contains count number of elements) -->
+ <member><type>uint32_t</type> <name>binding</name><comment>Binding number for this entry</comment></member>
+ <member><type>VkDescriptorType</type> <name>descriptorType</name><comment>Type of the descriptors in this binding</comment></member>
+ <member optional="true"><type>uint32_t</type> <name>descriptorCount</name><comment>Number of descriptors in this binding</comment></member>
+ <member noautovalidity="true"><type>VkShaderStageFlags</type> <name>stageFlags</name><comment>Shader stages this binding is visible to</comment></member>
+ <member noautovalidity="true" optional="true" len="descriptorCount">const <type>VkSampler</type>* <name>pImmutableSamplers</name><comment>Immutable samplers (used if descriptor type is SAMPLER or COMBINED_IMAGE_SAMPLER, is either NULL or contains count number of elements)</comment></member>
</type>
<type category="struct" name="VkDescriptorSetLayoutCreateInfo">
<member values="VK_STRUCTURE_TYPE_DESCRIPTOR_SET_LAYOUT_CREATE_INFO"><type>VkStructureType</type> <name>sType</name></member>
- <member>const <type>void</type>* <name>pNext</name></member> <!-- Pointer to next structure -->
- <member optional="true"><type>VkDescriptorSetLayoutCreateFlags</type> <name>flags</name></member> <!-- Reserved -->
- <member optional="true"><type>uint32_t</type> <name>bindingCount</name></member> <!-- Number of bindings in the descriptor set layout -->
- <member len="bindingCount">const <type>VkDescriptorSetLayoutBinding</type>* <name>pBindings</name></member> <!-- Array of descriptor set layout bindings -->
+ <member optional="true">const <type>void</type>* <name>pNext</name></member>
+ <member optional="true"><type>VkDescriptorSetLayoutCreateFlags</type> <name>flags</name></member>
+ <member optional="true"><type>uint32_t</type> <name>bindingCount</name><comment>Number of bindings in the descriptor set layout</comment></member>
+ <member len="bindingCount">const <type>VkDescriptorSetLayoutBinding</type>* <name>pBindings</name><comment>Array of descriptor set layout bindings</comment></member>
</type>
<type category="struct" name="VkDescriptorPoolSize">
<member><type>VkDescriptorType</type> <name>type</name></member>
@@ -821,97 +1282,97 @@ maintained in the master branch of the Khronos Vulkan GitHub project.
</type>
<type category="struct" name="VkDescriptorPoolCreateInfo">
<member values="VK_STRUCTURE_TYPE_DESCRIPTOR_POOL_CREATE_INFO"><type>VkStructureType</type> <name>sType</name></member>
- <member>const <type>void</type>* <name>pNext</name></member> <!-- Pointer to next structure -->
+ <member optional="true">const <type>void</type>* <name>pNext</name></member>
<member optional="true"><type>VkDescriptorPoolCreateFlags</type> <name>flags</name></member>
<member><type>uint32_t</type> <name>maxSets</name></member>
- <member><type>uint32_t</type> <name>poolSizeCount</name></member>
+ <member optional="true"><type>uint32_t</type> <name>poolSizeCount</name></member>
<member len="poolSizeCount">const <type>VkDescriptorPoolSize</type>* <name>pPoolSizes</name></member>
</type>
<type category="struct" name="VkDescriptorSetAllocateInfo">
<member values="VK_STRUCTURE_TYPE_DESCRIPTOR_SET_ALLOCATE_INFO"><type>VkStructureType</type> <name>sType</name></member>
- <member>const <type>void</type>* <name>pNext</name></member> <!-- Pointer to next structure -->
+ <member optional="true">const <type>void</type>* <name>pNext</name></member>
<member><type>VkDescriptorPool</type> <name>descriptorPool</name></member>
<member><type>uint32_t</type> <name>descriptorSetCount</name></member>
<member len="descriptorSetCount">const <type>VkDescriptorSetLayout</type>* <name>pSetLayouts</name></member>
</type>
<type category="struct" name="VkSpecializationMapEntry">
- <member><type>uint32_t</type> <name>constantID</name></member> <!-- The SpecConstant ID specified in the BIL -->
- <member><type>uint32_t</type> <name>offset</name></member> <!-- Offset of the value in the data block -->
- <member><type>size_t</type> <name>size</name></member> <!-- Size in bytes of the SpecConstant -->
+ <member><type>uint32_t</type> <name>constantID</name><comment>The SpecConstant ID specified in the BIL</comment></member>
+ <member><type>uint32_t</type> <name>offset</name><comment>Offset of the value in the data block</comment></member>
+ <member noautovalidity="true"><type>size_t</type> <name>size</name><comment>Size in bytes of the SpecConstant</comment></member>
</type>
<type category="struct" name="VkSpecializationInfo">
- <member optional="true"><type>uint32_t</type> <name>mapEntryCount</name></member> <!-- Number of entries in the map -->
- <member len="mapEntryCount" noautovalidity="true">const <type>VkSpecializationMapEntry</type>* <name>pMapEntries</name></member> <!-- Array of map entries -->
- <member optional="true"><type>size_t</type> <name>dataSize</name></member> <!-- Size in bytes of pData -->
- <member len="dataSize">const <type>void</type>* <name>pData</name></member> <!-- Pointer to SpecConstant data -->
+ <member optional="true"><type>uint32_t</type> <name>mapEntryCount</name><comment>Number of entries in the map</comment></member>
+ <member len="mapEntryCount">const <type>VkSpecializationMapEntry</type>* <name>pMapEntries</name><comment>Array of map entries</comment></member>
+ <member optional="true"><type>size_t</type> <name>dataSize</name><comment>Size in bytes of pData</comment></member>
+ <member len="dataSize">const <type>void</type>* <name>pData</name><comment>Pointer to SpecConstant data</comment></member>
</type>
<type category="struct" name="VkPipelineShaderStageCreateInfo">
<member values="VK_STRUCTURE_TYPE_PIPELINE_SHADER_STAGE_CREATE_INFO"><type>VkStructureType</type> <name>sType</name></member>
- <member>const <type>void</type>* <name>pNext</name></member> <!-- Pointer to next structure -->
- <member optional="true"><type>VkPipelineShaderStageCreateFlags</type> <name>flags</name></member> <!-- Reserved -->
- <member><type>VkShaderStageFlagBits</type> <name>stage</name></member> <!-- Shader stage -->
- <member><type>VkShaderModule</type> <name>module</name></member> <!-- Module containing entry point -->
- <member len="null-terminated">const <type>char</type>* <name>pName</name></member> <!-- Null-terminated entry point name -->
+ <member optional="true">const <type>void</type>* <name>pNext</name></member>
+ <member optional="true"><type>VkPipelineShaderStageCreateFlags</type> <name>flags</name></member>
+ <member><type>VkShaderStageFlagBits</type> <name>stage</name><comment>Shader stage</comment></member>
+ <member optional="true"><type>VkShaderModule</type> <name>module</name><comment>Module containing entry point</comment></member>
+ <member len="null-terminated">const <type>char</type>* <name>pName</name><comment>Null-terminated entry point name</comment></member>
<member optional="true">const <type>VkSpecializationInfo</type>* <name>pSpecializationInfo</name></member>
</type>
<type category="struct" name="VkComputePipelineCreateInfo">
<member values="VK_STRUCTURE_TYPE_COMPUTE_PIPELINE_CREATE_INFO"><type>VkStructureType</type> <name>sType</name></member>
- <member>const <type>void</type>* <name>pNext</name></member> <!-- Pointer to next structure -->
- <member optional="true"><type>VkPipelineCreateFlags</type> <name>flags</name></member> <!-- Pipeline creation flags -->
+ <member optional="true">const <type>void</type>* <name>pNext</name></member>
+ <member optional="true"><type>VkPipelineCreateFlags</type> <name>flags</name><comment>Pipeline creation flags</comment></member>
<member><type>VkPipelineShaderStageCreateInfo</type> <name>stage</name></member>
- <member><type>VkPipelineLayout</type> <name>layout</name></member> <!-- Interface layout of the pipeline -->
- <member noautovalidity="true" optional="true"><type>VkPipeline</type> <name>basePipelineHandle</name></member> <!-- If VK_PIPELINE_CREATE_DERIVATIVE_BIT is set and this value is nonzero, it specifies the handle of the base pipeline this is a derivative of -->
- <member><type>int32_t</type> <name>basePipelineIndex</name></member> <!-- If VK_PIPELINE_CREATE_DERIVATIVE_BIT is set and this value is not -1, it specifies an index into pCreateInfos of the base pipeline this is a derivative of -->
+ <member><type>VkPipelineLayout</type> <name>layout</name><comment>Interface layout of the pipeline</comment></member>
+ <member noautovalidity="true" optional="true"><type>VkPipeline</type> <name>basePipelineHandle</name><comment>If VK_PIPELINE_CREATE_DERIVATIVE_BIT is set and this value is nonzero, it specifies the handle of the base pipeline this is a derivative of</comment></member>
+ <member><type>int32_t</type> <name>basePipelineIndex</name><comment>If VK_PIPELINE_CREATE_DERIVATIVE_BIT is set and this value is not -1, it specifies an index into pCreateInfos of the base pipeline this is a derivative of</comment></member>
</type>
<type category="struct" name="VkVertexInputBindingDescription">
- <member><type>uint32_t</type> <name>binding</name></member> <!-- Vertex buffer binding id -->
- <member><type>uint32_t</type> <name>stride</name></member> <!-- Distance between vertices in bytes (0 = no advancement) -->
- <member><type>VkVertexInputRate</type> <name>inputRate</name></member> <!-- The rate at which the vertex data is consumed -->
+ <member><type>uint32_t</type> <name>binding</name><comment>Vertex buffer binding id</comment></member>
+ <member><type>uint32_t</type> <name>stride</name><comment>Distance between vertices in bytes (0 = no advancement)</comment></member>
+ <member><type>VkVertexInputRate</type> <name>inputRate</name><comment>The rate at which the vertex data is consumed</comment></member>
</type>
<type category="struct" name="VkVertexInputAttributeDescription">
- <member><type>uint32_t</type> <name>location</name></member> <!-- location of the shader vertex attrib -->
- <member><type>uint32_t</type> <name>binding</name></member> <!-- Vertex buffer binding id -->
- <member><type>VkFormat</type> <name>format</name></member> <!-- format of source data -->
- <member><type>uint32_t</type> <name>offset</name></member> <!-- Offset of first element in bytes from base of vertex -->
+ <member><type>uint32_t</type> <name>location</name><comment>location of the shader vertex attrib</comment></member>
+ <member><type>uint32_t</type> <name>binding</name><comment>Vertex buffer binding id</comment></member>
+ <member><type>VkFormat</type> <name>format</name><comment>format of source data</comment></member>
+ <member><type>uint32_t</type> <name>offset</name><comment>Offset of first element in bytes from base of vertex</comment></member>
</type>
<type category="struct" name="VkPipelineVertexInputStateCreateInfo">
<member values="VK_STRUCTURE_TYPE_PIPELINE_VERTEX_INPUT_STATE_CREATE_INFO"><type>VkStructureType</type> <name>sType</name></member>
- <member>const <type>void</type>* <name>pNext</name></member> <!-- Pointer to next structure -->
- <member optional="true"><type>VkPipelineVertexInputStateCreateFlags</type> <name>flags</name></member> <!-- Reserved -->
- <member optional="true"><type>uint32_t</type> <name>vertexBindingDescriptionCount</name></member> <!-- number of bindings -->
+ <member optional="true">const <type>void</type>* <name>pNext</name></member>
+ <member optional="true"><type>VkPipelineVertexInputStateCreateFlags</type> <name>flags</name></member>
+ <member optional="true"><type>uint32_t</type> <name>vertexBindingDescriptionCount</name><comment>number of bindings</comment></member>
<member len="vertexBindingDescriptionCount">const <type>VkVertexInputBindingDescription</type>* <name>pVertexBindingDescriptions</name></member>
- <member optional="true"><type>uint32_t</type> <name>vertexAttributeDescriptionCount</name></member> <!-- number of attributes -->
+ <member optional="true"><type>uint32_t</type> <name>vertexAttributeDescriptionCount</name><comment>number of attributes</comment></member>
<member len="vertexAttributeDescriptionCount">const <type>VkVertexInputAttributeDescription</type>* <name>pVertexAttributeDescriptions</name></member>
</type>
<type category="struct" name="VkPipelineInputAssemblyStateCreateInfo">
<member values="VK_STRUCTURE_TYPE_PIPELINE_INPUT_ASSEMBLY_STATE_CREATE_INFO"><type>VkStructureType</type> <name>sType</name></member>
- <member>const <type>void</type>* <name>pNext</name></member> <!-- Pointer to next structure -->
- <member optional="true"><type>VkPipelineInputAssemblyStateCreateFlags</type> <name>flags</name></member> <!-- Reserved -->
+ <member optional="true">const <type>void</type>* <name>pNext</name></member>
+ <member optional="true"><type>VkPipelineInputAssemblyStateCreateFlags</type> <name>flags</name></member>
<member><type>VkPrimitiveTopology</type> <name>topology</name></member>
<member><type>VkBool32</type> <name>primitiveRestartEnable</name></member>
</type>
<type category="struct" name="VkPipelineTessellationStateCreateInfo">
<member values="VK_STRUCTURE_TYPE_PIPELINE_TESSELLATION_STATE_CREATE_INFO"><type>VkStructureType</type> <name>sType</name></member>
- <member>const <type>void</type>* <name>pNext</name></member> <!-- Pointer to next structure -->
- <member optional="true"><type>VkPipelineTessellationStateCreateFlags</type> <name>flags</name></member> <!-- Reserved -->
+ <member optional="true">const <type>void</type>* <name>pNext</name></member>
+ <member optional="true"><type>VkPipelineTessellationStateCreateFlags</type> <name>flags</name></member>
<member><type>uint32_t</type> <name>patchControlPoints</name></member>
</type>
<type category="struct" name="VkPipelineViewportStateCreateInfo">
<member values="VK_STRUCTURE_TYPE_PIPELINE_VIEWPORT_STATE_CREATE_INFO"><type>VkStructureType</type> <name>sType</name></member>
- <member>const <type>void</type>* <name>pNext</name></member> <!-- Pointer to next structure -->
- <member optional="true"><type>VkPipelineViewportStateCreateFlags</type> <name>flags</name></member> <!-- Reserved -->
- <member><type>uint32_t</type> <name>viewportCount</name></member>
+ <member optional="true">const <type>void</type>* <name>pNext</name></member>
+ <member optional="true"><type>VkPipelineViewportStateCreateFlags</type> <name>flags</name></member>
+ <member optional="true"><type>uint32_t</type> <name>viewportCount</name></member>
<member noautovalidity="true" optional="true" len="viewportCount">const <type>VkViewport</type>* <name>pViewports</name></member>
- <member><type>uint32_t</type> <name>scissorCount</name></member>
+ <member optional="true"><type>uint32_t</type> <name>scissorCount</name></member>
<member noautovalidity="true" optional="true" len="scissorCount">const <type>VkRect2D</type>* <name>pScissors</name></member>
</type>
<type category="struct" name="VkPipelineRasterizationStateCreateInfo">
<member values="VK_STRUCTURE_TYPE_PIPELINE_RASTERIZATION_STATE_CREATE_INFO"><type>VkStructureType</type> <name>sType</name></member>
- <member validextensionstructs="VkPipelineRasterizationStateRasterizationOrderAMD">const <type>void</type>* <name>pNext</name></member> <!-- Pointer to next structure -->
- <member optional="true"><type>VkPipelineRasterizationStateCreateFlags</type> <name>flags</name></member> <!-- Reserved -->
+ <member optional="true">const <type>void</type>* <name>pNext</name></member>
+ <member optional="true"><type>VkPipelineRasterizationStateCreateFlags</type> <name>flags</name></member>
<member><type>VkBool32</type> <name>depthClampEnable</name></member>
<member><type>VkBool32</type> <name>rasterizerDiscardEnable</name></member>
- <member><type>VkPolygonMode</type> <name>polygonMode</name></member> <!-- optional (GL45) -->
+ <member><type>VkPolygonMode</type> <name>polygonMode</name><comment>optional (GL45)</comment></member>
<member optional="true"><type>VkCullModeFlags</type> <name>cullMode</name></member>
<member><type>VkFrontFace</type> <name>frontFace</name></member>
<member><type>VkBool32</type> <name>depthBiasEnable</name></member>
@@ -922,12 +1383,12 @@ maintained in the master branch of the Khronos Vulkan GitHub project.
</type>
<type category="struct" name="VkPipelineMultisampleStateCreateInfo">
<member values="VK_STRUCTURE_TYPE_PIPELINE_MULTISAMPLE_STATE_CREATE_INFO"><type>VkStructureType</type> <name>sType</name></member>
- <member>const <type>void</type>* <name>pNext</name></member> <!-- Pointer to next structure -->
- <member optional="true"><type>VkPipelineMultisampleStateCreateFlags</type> <name>flags</name></member> <!-- Reserved -->
- <member><type>VkSampleCountFlagBits</type> <name>rasterizationSamples</name></member> <!-- Number of samples used for rasterization -->
- <member><type>VkBool32</type> <name>sampleShadingEnable</name></member> <!-- optional (GL45) -->
- <member><type>float</type> <name>minSampleShading</name></member> <!-- optional (GL45) -->
- <member optional="true" len="latexmath:[$\lceil{\mathit{rasterizationSamples} \over 32}\rceil$]">const <type>VkSampleMask</type>* <name>pSampleMask</name></member> <!-- Array of sampleMask words -->
+ <member optional="true">const <type>void</type>* <name>pNext</name></member>
+ <member optional="true"><type>VkPipelineMultisampleStateCreateFlags</type> <name>flags</name></member>
+ <member><type>VkSampleCountFlagBits</type> <name>rasterizationSamples</name><comment>Number of samples used for rasterization</comment></member>
+ <member><type>VkBool32</type> <name>sampleShadingEnable</name><comment>optional (GL45)</comment></member>
+ <member><type>float</type> <name>minSampleShading</name><comment>optional (GL45)</comment></member>
+ <member optional="true" len="latexmath:[\lceil{\mathit{rasterizationSamples} \over 32}\rceil]" altlen="(rasterizationSamples + 31) / 32">const <type>VkSampleMask</type>* <name>pSampleMask</name><comment>Array of sampleMask words</comment></member>
<member><type>VkBool32</type> <name>alphaToCoverageEnable</name></member>
<member><type>VkBool32</type> <name>alphaToOneEnable</name></member>
</type>
@@ -943,19 +1404,19 @@ maintained in the master branch of the Khronos Vulkan GitHub project.
</type>
<type category="struct" name="VkPipelineColorBlendStateCreateInfo">
<member values="VK_STRUCTURE_TYPE_PIPELINE_COLOR_BLEND_STATE_CREATE_INFO"><type>VkStructureType</type> <name>sType</name></member>
- <member>const <type>void</type>* <name>pNext</name></member> <!-- Pointer to next structure -->
- <member optional="true"><type>VkPipelineColorBlendStateCreateFlags</type> <name>flags</name></member> <!-- Reserved -->
+ <member optional="true">const <type>void</type>* <name>pNext</name></member>
+ <member optional="true"><type>VkPipelineColorBlendStateCreateFlags</type> <name>flags</name></member>
<member><type>VkBool32</type> <name>logicOpEnable</name></member>
<member noautovalidity="true"><type>VkLogicOp</type> <name>logicOp</name></member>
- <member optional="true"><type>uint32_t</type> <name>attachmentCount</name></member> <!-- # of pAttachments -->
+ <member optional="true"><type>uint32_t</type> <name>attachmentCount</name><comment># of pAttachments</comment></member>
<member len="attachmentCount">const <type>VkPipelineColorBlendAttachmentState</type>* <name>pAttachments</name></member>
<member><type>float</type> <name>blendConstants</name>[4]</member>
</type>
<type category="struct" name="VkPipelineDynamicStateCreateInfo">
<member values="VK_STRUCTURE_TYPE_PIPELINE_DYNAMIC_STATE_CREATE_INFO"><type>VkStructureType</type> <name>sType</name></member>
- <member>const <type>void</type>* <name>pNext</name></member> <!-- Pointer to next structure -->
- <member optional="true"><type>VkPipelineDynamicStateCreateFlags</type> <name>flags</name></member> <!-- Reserved -->
- <member><type>uint32_t</type> <name>dynamicStateCount</name></member>
+ <member optional="true">const <type>void</type>* <name>pNext</name></member>
+ <member optional="true"><type>VkPipelineDynamicStateCreateFlags</type> <name>flags</name></member>
+ <member optional="true"><type>uint32_t</type> <name>dynamicStateCount</name></member>
<member len="dynamicStateCount">const <type>VkDynamicState</type>* <name>pDynamicStates</name></member>
</type>
<type category="struct" name="VkStencilOpState">
@@ -969,12 +1430,12 @@ maintained in the master branch of the Khronos Vulkan GitHub project.
</type>
<type category="struct" name="VkPipelineDepthStencilStateCreateInfo">
<member values="VK_STRUCTURE_TYPE_PIPELINE_DEPTH_STENCIL_STATE_CREATE_INFO"><type>VkStructureType</type> <name>sType</name></member>
- <member>const <type>void</type>* <name>pNext</name></member> <!-- Pointer to next structure -->
- <member optional="true"><type>VkPipelineDepthStencilStateCreateFlags</type> <name>flags</name></member> <!-- Reserved -->
+ <member optional="true">const <type>void</type>* <name>pNext</name></member>
+ <member optional="true"><type>VkPipelineDepthStencilStateCreateFlags</type> <name>flags</name></member>
<member><type>VkBool32</type> <name>depthTestEnable</name></member>
<member><type>VkBool32</type> <name>depthWriteEnable</name></member>
<member><type>VkCompareOp</type> <name>depthCompareOp</name></member>
- <member><type>VkBool32</type> <name>depthBoundsTestEnable</name></member> <!-- optional (depth_bounds_test) -->
+ <member><type>VkBool32</type> <name>depthBoundsTestEnable</name><comment>optional (depth_bounds_test)</comment></member>
<member><type>VkBool32</type> <name>stencilTestEnable</name></member>
<member><type>VkStencilOpState</type> <name>front</name></member>
<member><type>VkStencilOpState</type> <name>back</name></member>
@@ -983,53 +1444,61 @@ maintained in the master branch of the Khronos Vulkan GitHub project.
</type>
<type category="struct" name="VkGraphicsPipelineCreateInfo">
<member values="VK_STRUCTURE_TYPE_GRAPHICS_PIPELINE_CREATE_INFO"><type>VkStructureType</type> <name>sType</name></member>
- <member>const <type>void</type>* <name>pNext</name></member> <!-- Pointer to next structure -->
- <member optional="true"><type>VkPipelineCreateFlags</type> <name>flags</name></member> <!-- Pipeline creation flags -->
- <member><type>uint32_t</type> <name>stageCount</name></member>
- <member len="stageCount">const <type>VkPipelineShaderStageCreateInfo</type>* <name>pStages</name></member> <!-- One entry for each active shader stage -->
- <member>const <type>VkPipelineVertexInputStateCreateInfo</type>* <name>pVertexInputState</name></member>
- <member>const <type>VkPipelineInputAssemblyStateCreateInfo</type>* <name>pInputAssemblyState</name></member>
+ <member optional="true">const <type>void</type>* <name>pNext</name></member>
+ <member optional="true"><type>VkPipelineCreateFlags</type> <name>flags</name><comment>Pipeline creation flags</comment></member>
+ <member noautovalidity="true" optional="true"><type>uint32_t</type> <name>stageCount</name></member>
+ <member noautovalidity="true" len="stageCount" optional="true">const <type>VkPipelineShaderStageCreateInfo</type>* <name>pStages</name><comment>One entry for each active shader stage</comment></member>
+ <member noautovalidity="true" optional="true">const <type>VkPipelineVertexInputStateCreateInfo</type>* <name>pVertexInputState</name></member>
+ <member noautovalidity="true" optional="true">const <type>VkPipelineInputAssemblyStateCreateInfo</type>* <name>pInputAssemblyState</name></member>
<member noautovalidity="true" optional="true">const <type>VkPipelineTessellationStateCreateInfo</type>* <name>pTessellationState</name></member>
<member noautovalidity="true" optional="true">const <type>VkPipelineViewportStateCreateInfo</type>* <name>pViewportState</name></member>
- <member>const <type>VkPipelineRasterizationStateCreateInfo</type>* <name>pRasterizationState</name></member>
+ <member noautovalidity="true" optional="true">const <type>VkPipelineRasterizationStateCreateInfo</type>* <name>pRasterizationState</name></member>
<member noautovalidity="true" optional="true">const <type>VkPipelineMultisampleStateCreateInfo</type>* <name>pMultisampleState</name></member>
<member noautovalidity="true" optional="true">const <type>VkPipelineDepthStencilStateCreateInfo</type>* <name>pDepthStencilState</name></member>
<member noautovalidity="true" optional="true">const <type>VkPipelineColorBlendStateCreateInfo</type>* <name>pColorBlendState</name></member>
<member optional="true">const <type>VkPipelineDynamicStateCreateInfo</type>* <name>pDynamicState</name></member>
- <member><type>VkPipelineLayout</type> <name>layout</name></member> <!-- Interface layout of the pipeline -->
- <member><type>VkRenderPass</type> <name>renderPass</name></member>
- <member><type>uint32_t</type> <name>subpass</name></member>
- <member noautovalidity="true" optional="true"><type>VkPipeline</type> <name>basePipelineHandle</name></member> <!-- If VK_PIPELINE_CREATE_DERIVATIVE_BIT is set and this value is nonzero, it specifies the handle of the base pipeline this is a derivative of -->
- <member><type>int32_t</type> <name>basePipelineIndex</name></member> <!-- If VK_PIPELINE_CREATE_DERIVATIVE_BIT is set and this value is not -1, it specifies an index into pCreateInfos of the base pipeline this is a derivative of -->
+ <member noautovalidity="true" optional="true"><type>VkPipelineLayout</type> <name>layout</name><comment>Interface layout of the pipeline</comment></member>
+ <member noautovalidity="true" optional="true"><type>VkRenderPass</type> <name>renderPass</name></member>
+ <member noautovalidity="true"><type>uint32_t</type> <name>subpass</name></member>
+ <member noautovalidity="true" optional="true"><type>VkPipeline</type> <name>basePipelineHandle</name><comment>If VK_PIPELINE_CREATE_DERIVATIVE_BIT is set and this value is nonzero, it specifies the handle of the base pipeline this is a derivative of</comment></member>
+ <member><type>int32_t</type> <name>basePipelineIndex</name><comment>If VK_PIPELINE_CREATE_DERIVATIVE_BIT is set and this value is not -1, it specifies an index into pCreateInfos of the base pipeline this is a derivative of</comment></member>
</type>
<type category="struct" name="VkPipelineCacheCreateInfo">
<member values="VK_STRUCTURE_TYPE_PIPELINE_CACHE_CREATE_INFO"><type>VkStructureType</type> <name>sType</name></member>
- <member>const <type>void</type>* <name>pNext</name></member> <!-- Pointer to next structure -->
- <member optional="true"><type>VkPipelineCacheCreateFlags</type> <name>flags</name></member> <!-- Reserved -->
- <member optional="true"><type>size_t</type> <name>initialDataSize</name></member> <!-- Size of initial data to populate cache, in bytes -->
- <member len="initialDataSize">const <type>void</type>* <name>pInitialData</name></member> <!-- Initial data to populate cache -->
+ <member optional="true">const <type>void</type>* <name>pNext</name></member>
+ <member optional="true"><type>VkPipelineCacheCreateFlags</type> <name>flags</name></member>
+ <member optional="true"><type>size_t</type> <name>initialDataSize</name><comment>Size of initial data to populate cache, in bytes</comment></member>
+ <member len="initialDataSize">const <type>void</type>* <name>pInitialData</name><comment>Initial data to populate cache</comment></member>
+ </type>
+ <type category="struct" name="VkPipelineCacheHeaderVersionOne">
+ <comment>The fields in this structure are non-normative since structure packing is implementation-defined in C. The specification defines the normative layout.</comment>
+ <member><type>uint32_t</type> <name>headerSize</name></member>
+ <member><type>VkPipelineCacheHeaderVersion</type> <name>headerVersion</name></member>
+ <member><type>uint32_t</type> <name>vendorID</name></member>
+ <member><type>uint32_t</type> <name>deviceID</name></member>
+ <member><type>uint8_t</type> <name>pipelineCacheUUID</name>[<enum>VK_UUID_SIZE</enum>]</member>
</type>
<type category="struct" name="VkPushConstantRange">
- <member><type>VkShaderStageFlags</type> <name>stageFlags</name></member> <!-- Which stages use the range -->
- <member><type>uint32_t</type> <name>offset</name></member> <!-- Start of the range, in bytes -->
- <member><type>uint32_t</type> <name>size</name></member> <!-- Size of the range, in bytes -->
+ <member><type>VkShaderStageFlags</type> <name>stageFlags</name><comment>Which stages use the range</comment></member>
+ <member><type>uint32_t</type> <name>offset</name><comment>Start of the range, in bytes</comment></member>
+ <member><type>uint32_t</type> <name>size</name><comment>Size of the range, in bytes</comment></member>
</type>
<type category="struct" name="VkPipelineLayoutCreateInfo">
<member values="VK_STRUCTURE_TYPE_PIPELINE_LAYOUT_CREATE_INFO"><type>VkStructureType</type> <name>sType</name></member>
- <member>const <type>void</type>* <name>pNext</name></member> <!-- Pointer to next structure -->
- <member optional="true"><type>VkPipelineLayoutCreateFlags</type> <name>flags</name></member> <!-- Reserved -->
- <member optional="true"><type>uint32_t</type> <name>setLayoutCount</name></member> <!-- Number of descriptor sets interfaced by the pipeline -->
- <member len="setLayoutCount">const <type>VkDescriptorSetLayout</type>* <name>pSetLayouts</name></member> <!-- Array of setCount number of descriptor set layout objects defining the layout of the -->
- <member optional="true"><type>uint32_t</type> <name>pushConstantRangeCount</name></member> <!-- Number of push-constant ranges used by the pipeline -->
- <member len="pushConstantRangeCount">const <type>VkPushConstantRange</type>* <name>pPushConstantRanges</name></member> <!-- Array of pushConstantRangeCount number of ranges used by various shader stages -->
+ <member optional="true">const <type>void</type>* <name>pNext</name></member>
+ <member optional="true"><type>VkPipelineLayoutCreateFlags</type> <name>flags</name></member>
+ <member optional="true"><type>uint32_t</type> <name>setLayoutCount</name><comment>Number of descriptor sets interfaced by the pipeline</comment></member>
+ <member optional="false,true" len="setLayoutCount">const <type>VkDescriptorSetLayout</type>* <name>pSetLayouts</name><comment>Array of setCount number of descriptor set layout objects defining the layout of the</comment></member>
+ <member optional="true"><type>uint32_t</type> <name>pushConstantRangeCount</name><comment>Number of push-constant ranges used by the pipeline</comment></member>
+ <member len="pushConstantRangeCount">const <type>VkPushConstantRange</type>* <name>pPushConstantRanges</name><comment>Array of pushConstantRangeCount number of ranges used by various shader stages</comment></member>
</type>
<type category="struct" name="VkSamplerCreateInfo">
<member values="VK_STRUCTURE_TYPE_SAMPLER_CREATE_INFO"><type>VkStructureType</type> <name>sType</name></member>
- <member>const <type>void</type>* <name>pNext</name></member> <!-- Pointer to next structure -->
- <member optional="true"><type>VkSamplerCreateFlags</type> <name>flags</name></member> <!-- Reserved -->
- <member><type>VkFilter</type> <name>magFilter</name></member> <!-- Filter mode for magnification -->
- <member><type>VkFilter</type> <name>minFilter</name></member> <!-- Filter mode for minifiation -->
- <member><type>VkSamplerMipmapMode</type> <name>mipmapMode</name></member> <!-- Mipmap selection mode -->
+ <member optional="true">const <type>void</type>* <name>pNext</name></member>
+ <member optional="true"><type>VkSamplerCreateFlags</type> <name>flags</name></member>
+ <member><type>VkFilter</type> <name>magFilter</name><comment>Filter mode for magnification</comment></member>
+ <member><type>VkFilter</type> <name>minFilter</name><comment>Filter mode for minifiation</comment></member>
+ <member><type>VkSamplerMipmapMode</type> <name>mipmapMode</name><comment>Mipmap selection mode</comment></member>
<member><type>VkSamplerAddressMode</type> <name>addressModeU</name></member>
<member><type>VkSamplerAddressMode</type> <name>addressModeV</name></member>
<member><type>VkSamplerAddressMode</type> <name>addressModeW</name></member>
@@ -1045,36 +1514,36 @@ maintained in the master branch of the Khronos Vulkan GitHub project.
</type>
<type category="struct" name="VkCommandPoolCreateInfo">
<member values="VK_STRUCTURE_TYPE_COMMAND_POOL_CREATE_INFO"><type>VkStructureType</type> <name>sType</name></member>
- <member>const <type>void</type>* <name>pNext</name></member> <!-- Pointer to next structure -->
- <member optional="true"><type>VkCommandPoolCreateFlags</type> <name>flags</name></member> <!-- Command pool creation flags -->
+ <member optional="true">const <type>void</type>* <name>pNext</name></member>
+ <member optional="true"><type>VkCommandPoolCreateFlags</type> <name>flags</name><comment>Command pool creation flags</comment></member>
<member><type>uint32_t</type> <name>queueFamilyIndex</name></member>
</type>
<type category="struct" name="VkCommandBufferAllocateInfo">
<member values="VK_STRUCTURE_TYPE_COMMAND_BUFFER_ALLOCATE_INFO"><type>VkStructureType</type> <name>sType</name></member>
- <member>const <type>void</type>* <name>pNext</name></member> <!-- Pointer to next structure -->
+ <member optional="true">const <type>void</type>* <name>pNext</name></member>
<member><type>VkCommandPool</type> <name>commandPool</name></member>
<member><type>VkCommandBufferLevel</type> <name>level</name></member>
<member><type>uint32_t</type> <name>commandBufferCount</name></member>
</type>
<type category="struct" name="VkCommandBufferInheritanceInfo">
<member values="VK_STRUCTURE_TYPE_COMMAND_BUFFER_INHERITANCE_INFO"><type>VkStructureType</type> <name>sType</name></member>
- <member>const <type>void</type>* <name>pNext</name></member> <!-- Pointer to next structure -->
- <member optional="true" noautovalidity="true"><type>VkRenderPass</type> <name>renderPass</name></member> <!-- Render pass for secondary command buffers -->
+ <member optional="true">const <type>void</type>* <name>pNext</name></member>
+ <member optional="true" noautovalidity="true"><type>VkRenderPass</type> <name>renderPass</name><comment>Render pass for secondary command buffers</comment></member>
<member><type>uint32_t</type> <name>subpass</name></member>
- <member optional="true" noautovalidity="true"><type>VkFramebuffer</type> <name>framebuffer</name></member> <!-- Framebuffer for secondary command buffers -->
- <member><type>VkBool32</type> <name>occlusionQueryEnable</name></member> <!-- Whether this secondary command buffer may be executed during an occlusion query -->
- <member optional="true" noautovalidity="true"><type>VkQueryControlFlags</type> <name>queryFlags</name></member> <!-- Query flags used by this secondary command buffer, if executed during an occlusion query -->
- <member optional="true" noautovalidity="true"><type>VkQueryPipelineStatisticFlags</type> <name>pipelineStatistics</name></member> <!-- Pipeline statistics that may be counted for this secondary command buffer -->
+ <member optional="true" noautovalidity="true"><type>VkFramebuffer</type> <name>framebuffer</name><comment>Framebuffer for secondary command buffers</comment></member>
+ <member><type>VkBool32</type> <name>occlusionQueryEnable</name><comment>Whether this secondary command buffer may be executed during an occlusion query</comment></member>
+ <member optional="true" noautovalidity="true"><type>VkQueryControlFlags</type> <name>queryFlags</name><comment>Query flags used by this secondary command buffer, if executed during an occlusion query</comment></member>
+ <member optional="true" noautovalidity="true"><type>VkQueryPipelineStatisticFlags</type> <name>pipelineStatistics</name><comment>Pipeline statistics that may be counted for this secondary command buffer</comment></member>
</type>
<type category="struct" name="VkCommandBufferBeginInfo">
<member values="VK_STRUCTURE_TYPE_COMMAND_BUFFER_BEGIN_INFO"><type>VkStructureType</type> <name>sType</name></member>
- <member>const <type>void</type>* <name>pNext</name></member> <!-- Pointer to next structure -->
- <member optional="true"><type>VkCommandBufferUsageFlags</type> <name>flags</name></member> <!-- Command buffer usage flags -->
- <member optional="true" noautovalidity="true">const <type>VkCommandBufferInheritanceInfo</type>* <name>pInheritanceInfo</name></member> <!-- Pointer to inheritance info for secondary command buffers -->
+ <member optional="true">const <type>void</type>* <name>pNext</name></member>
+ <member optional="true"><type>VkCommandBufferUsageFlags</type> <name>flags</name><comment>Command buffer usage flags</comment></member>
+ <member optional="true" noautovalidity="true">const <type>VkCommandBufferInheritanceInfo</type>* <name>pInheritanceInfo</name><comment>Pointer to inheritance info for secondary command buffers</comment></member>
</type>
<type category="struct" name="VkRenderPassBeginInfo">
<member values="VK_STRUCTURE_TYPE_RENDER_PASS_BEGIN_INFO"><type>VkStructureType</type> <name>sType</name></member>
- <member>const <type>void</type>* <name>pNext</name></member> <!-- Pointer to next structure -->
+ <member optional="true">const <type>void</type>* <name>pNext</name></member>
<member><type>VkRenderPass</type> <name>renderPass</name></member>
<member><type>VkFramebuffer</type> <name>framebuffer</name></member>
<member><type>VkRect2D</type> <name>renderArea</name></member>
@@ -1091,22 +1560,22 @@ maintained in the master branch of the Khronos Vulkan GitHub project.
<member><type>uint32_t</type> <name>stencil</name></member>
</type>
<type category="union" name="VkClearValue" comment="// Union allowing specification of color or depth and stencil values. Actual value selected is based on attachment being cleared.">
- <member><type>VkClearColorValue</type> <name>color</name></member>
+ <member noautovalidity="true"><type>VkClearColorValue</type> <name>color</name></member>
<member><type>VkClearDepthStencilValue</type> <name>depthStencil</name></member>
</type>
<type category="struct" name="VkClearAttachment">
<member><type>VkImageAspectFlags</type> <name>aspectMask</name></member>
<member><type>uint32_t</type> <name>colorAttachment</name></member>
- <member><type>VkClearValue</type> <name>clearValue</name></member>
+ <member noautovalidity="true"><type>VkClearValue</type> <name>clearValue</name></member>
</type>
<type category="struct" name="VkAttachmentDescription">
<member optional="true"><type>VkAttachmentDescriptionFlags</type> <name>flags</name></member>
<member><type>VkFormat</type> <name>format</name></member>
<member><type>VkSampleCountFlagBits</type> <name>samples</name></member>
- <member><type>VkAttachmentLoadOp</type> <name>loadOp</name></member> <!-- Load operation for color or depth data -->
- <member><type>VkAttachmentStoreOp</type> <name>storeOp</name></member> <!-- Store operation for color or depth data -->
- <member><type>VkAttachmentLoadOp</type> <name>stencilLoadOp</name></member> <!-- Load operation for stencil data -->
- <member><type>VkAttachmentStoreOp</type> <name>stencilStoreOp</name></member> <!-- Store operation for stencil data -->
+ <member><type>VkAttachmentLoadOp</type> <name>loadOp</name><comment>Load operation for color or depth data</comment></member>
+ <member><type>VkAttachmentStoreOp</type> <name>storeOp</name><comment>Store operation for color or depth data</comment></member>
+ <member><type>VkAttachmentLoadOp</type> <name>stencilLoadOp</name><comment>Load operation for stencil data</comment></member>
+ <member><type>VkAttachmentStoreOp</type> <name>stencilStoreOp</name><comment>Store operation for stencil data</comment></member>
<member><type>VkImageLayout</type> <name>initialLayout</name></member>
<member><type>VkImageLayout</type> <name>finalLayout</name></member>
</type>
@@ -1116,7 +1585,7 @@ maintained in the master branch of the Khronos Vulkan GitHub project.
</type>
<type category="struct" name="VkSubpassDescription">
<member optional="true"><type>VkSubpassDescriptionFlags</type> <name>flags</name></member>
- <member><type>VkPipelineBindPoint</type> <name>pipelineBindPoint</name></member> <!-- Must be VK_PIPELINE_BIND_POINT_GRAPHICS for now -->
+ <member><type>VkPipelineBindPoint</type> <name>pipelineBindPoint</name><comment>Must be VK_PIPELINE_BIND_POINT_GRAPHICS for now</comment></member>
<member optional="true"><type>uint32_t</type> <name>inputAttachmentCount</name></member>
<member len="inputAttachmentCount">const <type>VkAttachmentReference</type>* <name>pInputAttachments</name></member>
<member optional="true"><type>uint32_t</type> <name>colorAttachmentCount</name></member>
@@ -1129,16 +1598,16 @@ maintained in the master branch of the Khronos Vulkan GitHub project.
<type category="struct" name="VkSubpassDependency">
<member><type>uint32_t</type> <name>srcSubpass</name></member>
<member><type>uint32_t</type> <name>dstSubpass</name></member>
- <member><type>VkPipelineStageFlags</type> <name>srcStageMask</name></member>
- <member><type>VkPipelineStageFlags</type> <name>dstStageMask</name></member>
- <member optional="true"><type>VkAccessFlags</type> <name>srcAccessMask</name></member> <!-- Memory accesses from the source of the dependency to synchronize -->
- <member optional="true"><type>VkAccessFlags</type> <name>dstAccessMask</name></member> <!-- Memory accesses from the destination of the dependency to synchronize -->
+ <member optional="true"><type>VkPipelineStageFlags</type> <name>srcStageMask</name></member>
+ <member optional="true"><type>VkPipelineStageFlags</type> <name>dstStageMask</name></member>
+ <member optional="true"><type>VkAccessFlags</type> <name>srcAccessMask</name><comment>Memory accesses from the source of the dependency to synchronize</comment></member>
+ <member optional="true"><type>VkAccessFlags</type> <name>dstAccessMask</name><comment>Memory accesses from the destination of the dependency to synchronize</comment></member>
<member optional="true"><type>VkDependencyFlags</type> <name>dependencyFlags</name></member>
</type>
<type category="struct" name="VkRenderPassCreateInfo">
<member values="VK_STRUCTURE_TYPE_RENDER_PASS_CREATE_INFO"><type>VkStructureType</type> <name>sType</name></member>
- <member>const <type>void</type>* <name>pNext</name></member> <!-- Pointer to next structure -->
- <member optional="true"><type>VkRenderPassCreateFlags</type> <name>flags</name></member> <!-- Reserved -->
+ <member optional="true">const <type>void</type>* <name>pNext</name></member>
+ <member optional="true"><type>VkRenderPassCreateFlags</type> <name>flags</name></member>
<member optional="true"><type>uint32_t</type> <name>attachmentCount</name></member>
<member len="attachmentCount">const <type>VkAttachmentDescription</type>* <name>pAttachments</name></member>
<member><type>uint32_t</type> <name>subpassCount</name></member>
@@ -1148,240 +1617,249 @@ maintained in the master branch of the Khronos Vulkan GitHub project.
</type>
<type category="struct" name="VkEventCreateInfo">
<member values="VK_STRUCTURE_TYPE_EVENT_CREATE_INFO"><type>VkStructureType</type> <name>sType</name></member>
- <member>const <type>void</type>* <name>pNext</name></member> <!-- Pointer to next structure -->
- <member optional="true"><type>VkEventCreateFlags</type> <name>flags</name></member> <!-- Event creation flags -->
+ <member optional="true">const <type>void</type>* <name>pNext</name></member>
+ <member optional="true"><type>VkEventCreateFlags</type> <name>flags</name><comment>Event creation flags</comment></member>
</type>
<type category="struct" name="VkFenceCreateInfo">
<member values="VK_STRUCTURE_TYPE_FENCE_CREATE_INFO"><type>VkStructureType</type> <name>sType</name></member>
- <member>const <type>void</type>* <name>pNext</name></member> <!-- Pointer to next structure -->
- <member optional="true"><type>VkFenceCreateFlags</type> <name>flags</name></member> <!-- Fence creation flags -->
+ <member optional="true">const <type>void</type>* <name>pNext</name></member>
+ <member optional="true"><type>VkFenceCreateFlags</type> <name>flags</name><comment>Fence creation flags</comment></member>
</type>
<type category="struct" name="VkPhysicalDeviceFeatures">
- <member><type>VkBool32</type> <name>robustBufferAccess</name></member> <!-- out of bounds buffer accesses are well defined -->
- <member><type>VkBool32</type> <name>fullDrawIndexUint32</name></member> <!-- full 32-bit range of indices for indexed draw calls -->
- <member><type>VkBool32</type> <name>imageCubeArray</name></member> <!-- image views which are arrays of cube maps -->
- <member><type>VkBool32</type> <name>independentBlend</name></member> <!-- blending operations are controlled per-attachment -->
- <member><type>VkBool32</type> <name>geometryShader</name></member> <!-- geometry stage -->
- <member><type>VkBool32</type> <name>tessellationShader</name></member> <!-- tessellation control and evaluation stage -->
- <member><type>VkBool32</type> <name>sampleRateShading</name></member> <!-- per-sample shading and interpolation -->
- <member><type>VkBool32</type> <name>dualSrcBlend</name></member> <!-- blend operations which take two sources -->
- <member><type>VkBool32</type> <name>logicOp</name></member> <!-- logic operations -->
- <member><type>VkBool32</type> <name>multiDrawIndirect</name></member> <!-- multi draw indirect -->
- <member><type>VkBool32</type> <name>drawIndirectFirstInstance</name></member> <!-- indirect draws can use non-zero firstInstance -->
- <member><type>VkBool32</type> <name>depthClamp</name></member> <!-- depth clamping -->
- <member><type>VkBool32</type> <name>depthBiasClamp</name></member> <!-- depth bias clamping -->
- <member><type>VkBool32</type> <name>fillModeNonSolid</name></member> <!-- point and wireframe fill modes -->
- <member><type>VkBool32</type> <name>depthBounds</name></member> <!-- depth bounds test -->
- <member><type>VkBool32</type> <name>wideLines</name></member> <!-- lines with width greater than 1 -->
- <member><type>VkBool32</type> <name>largePoints</name></member> <!-- points with size greater than 1 -->
- <member><type>VkBool32</type> <name>alphaToOne</name></member> <!-- the fragment alpha component can be forced to maximum representable alpha value -->
- <member><type>VkBool32</type> <name>multiViewport</name></member> <!-- viewport arrays -->
- <member><type>VkBool32</type> <name>samplerAnisotropy</name></member> <!-- anisotropic sampler filtering -->
- <member><type>VkBool32</type> <name>textureCompressionETC2</name></member> <!-- ETC texture compression formats -->
- <member><type>VkBool32</type> <name>textureCompressionASTC_LDR</name></member> <!-- ASTC LDR texture compression formats -->
- <member><type>VkBool32</type> <name>textureCompressionBC</name></member> <!-- BC1-7 texture compressed formats -->
- <member><type>VkBool32</type> <name>occlusionQueryPrecise</name></member> <!-- precise occlusion queries returning actual sample counts -->
- <member><type>VkBool32</type> <name>pipelineStatisticsQuery</name></member> <!-- pipeline statistics query -->
- <member><type>VkBool32</type> <name>vertexPipelineStoresAndAtomics</name></member> <!-- stores and atomic ops on storage buffers and images are supported in vertex, tessellation, and geometry stages -->
- <member><type>VkBool32</type> <name>fragmentStoresAndAtomics</name></member> <!-- stores and atomic ops on storage buffers and images are supported in the fragment stage -->
- <member><type>VkBool32</type> <name>shaderTessellationAndGeometryPointSize</name></member><!-- tessellation and geometry stages can export point size -->
- <member><type>VkBool32</type> <name>shaderImageGatherExtended</name></member> <!-- image gather with run-time values and independent offsets -->
- <member><type>VkBool32</type> <name>shaderStorageImageExtendedFormats</name></member> <!-- the extended set of formats can be used for storage images -->
- <member><type>VkBool32</type> <name>shaderStorageImageMultisample</name></member> <!-- multisample images can be used for storage images -->
- <member><type>VkBool32</type> <name>shaderStorageImageReadWithoutFormat</name></member> <!-- read from storage image does not require format qualifier -->
- <member><type>VkBool32</type> <name>shaderStorageImageWriteWithoutFormat</name></member> <!-- write to storage image does not require format qualifier -->
- <member><type>VkBool32</type> <name>shaderUniformBufferArrayDynamicIndexing</name></member> <!-- arrays of uniform buffers can be accessed with dynamically uniform indices -->
- <member><type>VkBool32</type> <name>shaderSampledImageArrayDynamicIndexing</name></member> <!-- arrays of sampled images can be accessed with dynamically uniform indices -->
- <member><type>VkBool32</type> <name>shaderStorageBufferArrayDynamicIndexing</name></member> <!-- arrays of storage buffers can be accessed with dynamically uniform indices -->
- <member><type>VkBool32</type> <name>shaderStorageImageArrayDynamicIndexing</name></member> <!-- arrays of storage images can be accessed with dynamically uniform indices -->
- <member><type>VkBool32</type> <name>shaderClipDistance</name></member> <!-- clip distance in shaders -->
- <member><type>VkBool32</type> <name>shaderCullDistance</name></member> <!-- cull distance in shaders -->
- <member><type>VkBool32</type> <name>shaderFloat64</name></member> <!-- 64-bit floats (doubles) in shaders -->
- <member><type>VkBool32</type> <name>shaderInt64</name></member> <!-- 64-bit integers in shaders -->
- <member><type>VkBool32</type> <name>shaderInt16</name></member> <!-- 16-bit integers in shaders -->
- <member><type>VkBool32</type> <name>shaderResourceResidency</name></member> <!-- shader can use texture operations that return resource residency information (requires sparseNonResident support) -->
- <member><type>VkBool32</type> <name>shaderResourceMinLod</name></member> <!-- shader can use texture operations that specify minimum resource level of detail -->
- <member><type>VkBool32</type> <name>sparseBinding</name></member> <!-- Sparse resources support: Resource memory can be managed at opaque page level rather than object level -->
- <member><type>VkBool32</type> <name>sparseResidencyBuffer</name></member> <!-- Sparse resources support: GPU can access partially resident buffers -->
- <member><type>VkBool32</type> <name>sparseResidencyImage2D</name></member> <!-- Sparse resources support: GPU can access partially resident 2D (non-MSAA non-depth/stencil) images -->
- <member><type>VkBool32</type> <name>sparseResidencyImage3D</name></member> <!-- Sparse resources support: GPU can access partially resident 3D images -->
- <member><type>VkBool32</type> <name>sparseResidency2Samples</name></member> <!-- Sparse resources support: GPU can access partially resident MSAA 2D images with 2 samples -->
- <member><type>VkBool32</type> <name>sparseResidency4Samples</name></member> <!-- Sparse resources support: GPU can access partially resident MSAA 2D images with 4 samples -->
- <member><type>VkBool32</type> <name>sparseResidency8Samples</name></member> <!-- Sparse resources support: GPU can access partially resident MSAA 2D images with 8 samples -->
- <member><type>VkBool32</type> <name>sparseResidency16Samples</name></member> <!-- Sparse resources support: GPU can access partially resident MSAA 2D images with 16 samples -->
- <member><type>VkBool32</type> <name>sparseResidencyAliased</name></member> <!-- Sparse resources support: GPU can correctly access data aliased into multiple locations (opt-in) -->
- <member><type>VkBool32</type> <name>variableMultisampleRate</name></member> <!-- multisample rate must be the same for all pipelines in a subpass -->
- <member><type>VkBool32</type> <name>inheritedQueries</name></member> <!-- Queries may be inherited from primary to secondary command buffers -->
+ <member><type>VkBool32</type> <name>robustBufferAccess</name><comment>out of bounds buffer accesses are well defined</comment></member>
+ <member><type>VkBool32</type> <name>fullDrawIndexUint32</name><comment>full 32-bit range of indices for indexed draw calls</comment></member>
+ <member><type>VkBool32</type> <name>imageCubeArray</name><comment>image views which are arrays of cube maps</comment></member>
+ <member><type>VkBool32</type> <name>independentBlend</name><comment>blending operations are controlled per-attachment</comment></member>
+ <member><type>VkBool32</type> <name>geometryShader</name><comment>geometry stage</comment></member>
+ <member><type>VkBool32</type> <name>tessellationShader</name><comment>tessellation control and evaluation stage</comment></member>
+ <member><type>VkBool32</type> <name>sampleRateShading</name><comment>per-sample shading and interpolation</comment></member>
+ <member><type>VkBool32</type> <name>dualSrcBlend</name><comment>blend operations which take two sources</comment></member>
+ <member><type>VkBool32</type> <name>logicOp</name><comment>logic operations</comment></member>
+ <member><type>VkBool32</type> <name>multiDrawIndirect</name><comment>multi draw indirect</comment></member>
+ <member><type>VkBool32</type> <name>drawIndirectFirstInstance</name><comment>indirect drawing can use non-zero firstInstance</comment></member>
+ <member><type>VkBool32</type> <name>depthClamp</name><comment>depth clamping</comment></member>
+ <member><type>VkBool32</type> <name>depthBiasClamp</name><comment>depth bias clamping</comment></member>
+ <member><type>VkBool32</type> <name>fillModeNonSolid</name><comment>point and wireframe fill modes</comment></member>
+ <member><type>VkBool32</type> <name>depthBounds</name><comment>depth bounds test</comment></member>
+ <member><type>VkBool32</type> <name>wideLines</name><comment>lines with width greater than 1</comment></member>
+ <member><type>VkBool32</type> <name>largePoints</name><comment>points with size greater than 1</comment></member>
+ <member><type>VkBool32</type> <name>alphaToOne</name><comment>the fragment alpha component can be forced to maximum representable alpha value</comment></member>
+ <member><type>VkBool32</type> <name>multiViewport</name><comment>viewport arrays</comment></member>
+ <member><type>VkBool32</type> <name>samplerAnisotropy</name><comment>anisotropic sampler filtering</comment></member>
+ <member><type>VkBool32</type> <name>textureCompressionETC2</name><comment>ETC texture compression formats</comment></member>
+ <member><type>VkBool32</type> <name>textureCompressionASTC_LDR</name><comment>ASTC LDR texture compression formats</comment></member>
+ <member><type>VkBool32</type> <name>textureCompressionBC</name><comment>BC1-7 texture compressed formats</comment></member>
+ <member><type>VkBool32</type> <name>occlusionQueryPrecise</name><comment>precise occlusion queries returning actual sample counts</comment></member>
+ <member><type>VkBool32</type> <name>pipelineStatisticsQuery</name><comment>pipeline statistics query</comment></member>
+ <member><type>VkBool32</type> <name>vertexPipelineStoresAndAtomics</name><comment>stores and atomic ops on storage buffers and images are supported in vertex, tessellation, and geometry stages</comment></member>
+ <member><type>VkBool32</type> <name>fragmentStoresAndAtomics</name><comment>stores and atomic ops on storage buffers and images are supported in the fragment stage</comment></member>
+ <member><type>VkBool32</type> <name>shaderTessellationAndGeometryPointSize</name><comment>tessellation and geometry stages can export point size</comment></member>
+ <member><type>VkBool32</type> <name>shaderImageGatherExtended</name><comment>image gather with run-time values and independent offsets</comment></member>
+ <member><type>VkBool32</type> <name>shaderStorageImageExtendedFormats</name><comment>the extended set of formats can be used for storage images</comment></member>
+ <member><type>VkBool32</type> <name>shaderStorageImageMultisample</name><comment>multisample images can be used for storage images</comment></member>
+ <member><type>VkBool32</type> <name>shaderStorageImageReadWithoutFormat</name><comment>read from storage image does not require format qualifier</comment></member>
+ <member><type>VkBool32</type> <name>shaderStorageImageWriteWithoutFormat</name><comment>write to storage image does not require format qualifier</comment></member>
+ <member><type>VkBool32</type> <name>shaderUniformBufferArrayDynamicIndexing</name><comment>arrays of uniform buffers can be accessed with dynamically uniform indices</comment></member>
+ <member><type>VkBool32</type> <name>shaderSampledImageArrayDynamicIndexing</name><comment>arrays of sampled images can be accessed with dynamically uniform indices</comment></member>
+ <member><type>VkBool32</type> <name>shaderStorageBufferArrayDynamicIndexing</name><comment>arrays of storage buffers can be accessed with dynamically uniform indices</comment></member>
+ <member><type>VkBool32</type> <name>shaderStorageImageArrayDynamicIndexing</name><comment>arrays of storage images can be accessed with dynamically uniform indices</comment></member>
+ <member><type>VkBool32</type> <name>shaderClipDistance</name><comment>clip distance in shaders</comment></member>
+ <member><type>VkBool32</type> <name>shaderCullDistance</name><comment>cull distance in shaders</comment></member>
+ <member><type>VkBool32</type> <name>shaderFloat64</name><comment>64-bit floats (doubles) in shaders</comment></member>
+ <member><type>VkBool32</type> <name>shaderInt64</name><comment>64-bit integers in shaders</comment></member>
+ <member><type>VkBool32</type> <name>shaderInt16</name><comment>16-bit integers in shaders</comment></member>
+ <member><type>VkBool32</type> <name>shaderResourceResidency</name><comment>shader can use texture operations that return resource residency information (requires sparseNonResident support)</comment></member>
+ <member><type>VkBool32</type> <name>shaderResourceMinLod</name><comment>shader can use texture operations that specify minimum resource LOD</comment></member>
+ <member><type>VkBool32</type> <name>sparseBinding</name><comment>Sparse resources support: Resource memory can be managed at opaque page level rather than object level</comment></member>
+ <member><type>VkBool32</type> <name>sparseResidencyBuffer</name><comment>Sparse resources support: GPU can access partially resident buffers </comment></member>
+ <member><type>VkBool32</type> <name>sparseResidencyImage2D</name><comment>Sparse resources support: GPU can access partially resident 2D (non-MSAA non-depth/stencil) images </comment></member>
+ <member><type>VkBool32</type> <name>sparseResidencyImage3D</name><comment>Sparse resources support: GPU can access partially resident 3D images </comment></member>
+ <member><type>VkBool32</type> <name>sparseResidency2Samples</name><comment>Sparse resources support: GPU can access partially resident MSAA 2D images with 2 samples</comment></member>
+ <member><type>VkBool32</type> <name>sparseResidency4Samples</name><comment>Sparse resources support: GPU can access partially resident MSAA 2D images with 4 samples</comment></member>
+ <member><type>VkBool32</type> <name>sparseResidency8Samples</name><comment>Sparse resources support: GPU can access partially resident MSAA 2D images with 8 samples</comment></member>
+ <member><type>VkBool32</type> <name>sparseResidency16Samples</name><comment>Sparse resources support: GPU can access partially resident MSAA 2D images with 16 samples</comment></member>
+ <member><type>VkBool32</type> <name>sparseResidencyAliased</name><comment>Sparse resources support: GPU can correctly access data aliased into multiple locations (opt-in)</comment></member>
+ <member><type>VkBool32</type> <name>variableMultisampleRate</name><comment>multisample rate must be the same for all pipelines in a subpass</comment></member>
+ <member><type>VkBool32</type> <name>inheritedQueries</name><comment>Queries may be inherited from primary to secondary command buffers</comment></member>
</type>
<type category="struct" name="VkPhysicalDeviceSparseProperties" returnedonly="true">
- <member><type>VkBool32</type> <name>residencyStandard2DBlockShape</name></member> <!-- Sparse resources support: GPU will access all 2D (single sample) sparse resources using the standard sparse image block shapes (based on pixel format) -->
- <member><type>VkBool32</type> <name>residencyStandard2DMultisampleBlockShape</name></member> <!-- Sparse resources support: GPU will access all 2D (multisample) sparse resources using the standard sparse image block shapes (based on pixel format) -->
- <member><type>VkBool32</type> <name>residencyStandard3DBlockShape</name></member> <!-- Sparse resources support: GPU will access all 3D sparse resources using the standard sparse image block shapes (based on pixel format) -->
- <member><type>VkBool32</type> <name>residencyAlignedMipSize</name></member> <!-- Sparse resources support: Images with mip level dimensions that are NOT a multiple of the sparse image block dimensions will be placed in the mip tail -->
- <member><type>VkBool32</type> <name>residencyNonResidentStrict</name></member> <!-- Sparse resources support: GPU can consistently access non-resident regions of a resource, all reads return as if data is 0, writes are discarded -->
+ <member limittype="bitmask"><type>VkBool32</type> <name>residencyStandard2DBlockShape</name><comment>Sparse resources support: GPU will access all 2D (single sample) sparse resources using the standard sparse image block shapes (based on pixel format)</comment></member>
+ <member limittype="bitmask"><type>VkBool32</type> <name>residencyStandard2DMultisampleBlockShape</name><comment>Sparse resources support: GPU will access all 2D (multisample) sparse resources using the standard sparse image block shapes (based on pixel format)</comment></member>
+ <member limittype="bitmask"><type>VkBool32</type> <name>residencyStandard3DBlockShape</name><comment>Sparse resources support: GPU will access all 3D sparse resources using the standard sparse image block shapes (based on pixel format)</comment></member>
+ <member limittype="bitmask"><type>VkBool32</type> <name>residencyAlignedMipSize</name><comment>Sparse resources support: Images with mip level dimensions that are NOT a multiple of the sparse image block dimensions will be placed in the mip tail</comment></member>
+ <member limittype="bitmask"><type>VkBool32</type> <name>residencyNonResidentStrict</name><comment>Sparse resources support: GPU can consistently access non-resident regions of a resource, all reads return as if data is 0, writes are discarded</comment></member>
</type>
<type category="struct" name="VkPhysicalDeviceLimits" returnedonly="true">
- <!-- resource maximum sizes -->
- <member><type>uint32_t</type> <name>maxImageDimension1D</name></member> <!-- max 1D image dimension -->
- <member><type>uint32_t</type> <name>maxImageDimension2D</name></member> <!-- max 2D image dimension -->
- <member><type>uint32_t</type> <name>maxImageDimension3D</name></member> <!-- max 3D image dimension -->
- <member><type>uint32_t</type> <name>maxImageDimensionCube</name></member> <!-- max cubemap image dimension -->
- <member><type>uint32_t</type> <name>maxImageArrayLayers</name></member> <!-- max layers for image arrays -->
- <member><type>uint32_t</type> <name>maxTexelBufferElements</name></member> <!-- max texel buffer size (fstexels) -->
- <member><type>uint32_t</type> <name>maxUniformBufferRange</name></member> <!-- max uniform buffer range (bytes) -->
- <member><type>uint32_t</type> <name>maxStorageBufferRange</name></member> <!-- max storage buffer range (bytes) -->
- <member><type>uint32_t</type> <name>maxPushConstantsSize</name></member> <!-- max size of the push constants pool (bytes) -->
- <!-- memory limits -->
- <member><type>uint32_t</type> <name>maxMemoryAllocationCount</name></member> <!-- max number of device memory allocations supported -->
- <member><type>uint32_t</type> <name>maxSamplerAllocationCount</name></member> <!-- max number of samplers that can be allocated on a device -->
- <member><type>VkDeviceSize</type> <name>bufferImageGranularity</name></member> <!-- Granularity (in bytes) at which buffers and images can be bound to adjacent memory for simultaneous usage -->
- <member><type>VkDeviceSize</type> <name>sparseAddressSpaceSize</name></member> <!-- Total address space available for sparse allocations (bytes) -->
- <!-- descriptor set limits -->
- <member><type>uint32_t</type> <name>maxBoundDescriptorSets</name></member> <!-- max number of descriptors sets that can be bound to a pipeline -->
- <member><type>uint32_t</type> <name>maxPerStageDescriptorSamplers</name></member> <!-- max number of samplers allowed per-stage in a descriptor set -->
- <member><type>uint32_t</type> <name>maxPerStageDescriptorUniformBuffers</name></member> <!-- max number of uniform buffers allowed per-stage in a descriptor set -->
- <member><type>uint32_t</type> <name>maxPerStageDescriptorStorageBuffers</name></member> <!-- max number of storage buffers allowed per-stage in a descriptor set -->
- <member><type>uint32_t</type> <name>maxPerStageDescriptorSampledImages</name></member> <!-- max number of sampled images allowed per-stage in a descriptor set -->
- <member><type>uint32_t</type> <name>maxPerStageDescriptorStorageImages</name></member> <!-- max number of storage images allowed per-stage in a descriptor set -->
- <member><type>uint32_t</type> <name>maxPerStageDescriptorInputAttachments</name></member> <!-- max number of input attachments allowed per-stage in a descriptor set -->
- <member><type>uint32_t</type> <name>maxPerStageResources</name></member> <!-- max number of resources allowed by a single stage -->
- <member><type>uint32_t</type> <name>maxDescriptorSetSamplers</name></member> <!-- max number of samplers allowed in all stages in a descriptor set -->
- <member><type>uint32_t</type> <name>maxDescriptorSetUniformBuffers</name></member> <!-- max number of uniform buffers allowed in all stages in a descriptor set -->
- <member><type>uint32_t</type> <name>maxDescriptorSetUniformBuffersDynamic</name></member> <!-- max number of dynamic uniform buffers allowed in all stages in a descriptor set -->
- <member><type>uint32_t</type> <name>maxDescriptorSetStorageBuffers</name></member> <!-- max number of storage buffers allowed in all stages in a descriptor set -->
- <member><type>uint32_t</type> <name>maxDescriptorSetStorageBuffersDynamic</name></member> <!-- max number of dynamic storage buffers allowed in all stages in a descriptor set -->
- <member><type>uint32_t</type> <name>maxDescriptorSetSampledImages</name></member> <!-- max number of sampled images allowed in all stages in a descriptor set -->
- <member><type>uint32_t</type> <name>maxDescriptorSetStorageImages</name></member> <!-- max number of storage images allowed in all stages in a descriptor set -->
- <member><type>uint32_t</type> <name>maxDescriptorSetInputAttachments</name></member> <!-- max number of input attachments allowed in all stages in a descriptor set -->
- <!-- vertex stage limits -->
- <member><type>uint32_t</type> <name>maxVertexInputAttributes</name></member> <!-- max number of vertex input attribute slots -->
- <member><type>uint32_t</type> <name>maxVertexInputBindings</name></member> <!-- max number of vertex input binding slots -->
- <member><type>uint32_t</type> <name>maxVertexInputAttributeOffset</name></member> <!-- max vertex input attribute offset added to vertex buffer offset -->
- <member><type>uint32_t</type> <name>maxVertexInputBindingStride</name></member> <!-- max vertex input binding stride -->
- <member><type>uint32_t</type> <name>maxVertexOutputComponents</name></member> <!-- max number of output components written by vertex shader -->
- <!-- tessellation control stage limits -->
- <member><type>uint32_t</type> <name>maxTessellationGenerationLevel</name></member> <!-- max level supported by tessellation primitive generator -->
- <member><type>uint32_t</type> <name>maxTessellationPatchSize</name></member> <!-- max patch size (vertices) -->
- <member><type>uint32_t</type> <name>maxTessellationControlPerVertexInputComponents</name></member> <!-- max number of input components per-vertex in TCS -->
- <member><type>uint32_t</type> <name>maxTessellationControlPerVertexOutputComponents</name></member> <!-- max number of output components per-vertex in TCS -->
- <member><type>uint32_t</type> <name>maxTessellationControlPerPatchOutputComponents</name></member> <!-- max number of output components per-patch in TCS -->
- <member><type>uint32_t</type> <name>maxTessellationControlTotalOutputComponents</name></member> <!-- max total number of per-vertex and per-patch output components in TCS -->
- <!-- tessellation evaluation stage limits -->
- <member><type>uint32_t</type> <name>maxTessellationEvaluationInputComponents</name></member> <!-- max number of input components per vertex in TES -->
- <member><type>uint32_t</type> <name>maxTessellationEvaluationOutputComponents</name></member> <!-- max number of output components per vertex in TES -->
- <!-- geometry stage limits -->
- <member><type>uint32_t</type> <name>maxGeometryShaderInvocations</name></member> <!-- max invocation count supported in geometry shader -->
- <member><type>uint32_t</type> <name>maxGeometryInputComponents</name></member> <!-- max number of input components read in geometry stage -->
- <member><type>uint32_t</type> <name>maxGeometryOutputComponents</name></member> <!-- max number of output components written in geometry stage -->
- <member><type>uint32_t</type> <name>maxGeometryOutputVertices</name></member> <!-- max number of vertices that can be emitted in geometry stage -->
- <member><type>uint32_t</type> <name>maxGeometryTotalOutputComponents</name></member> <!-- max total number of components (all vertices) written in geometry stage -->
- <!-- fragment stage limits -->
- <member><type>uint32_t</type> <name>maxFragmentInputComponents</name></member> <!-- max number of input compontents read in fragment stage -->
- <member><type>uint32_t</type> <name>maxFragmentOutputAttachments</name></member> <!-- max number of output attachments written in fragment stage -->
- <member><type>uint32_t</type> <name>maxFragmentDualSrcAttachments</name></member> <!-- max number of output attachments written when using dual source blending -->
- <member><type>uint32_t</type> <name>maxFragmentCombinedOutputResources</name></member><!-- max total number of storage buffers, storage images and output buffers -->
- <!-- compute stage limits -->
- <member><type>uint32_t</type> <name>maxComputeSharedMemorySize</name></member> <!-- max total storage size of work group local storage (bytes) -->
- <member><type>uint32_t</type> <name>maxComputeWorkGroupCount</name>[3]</member> <!-- max num of compute work groups that may be dispatched by a single command (x,y,z) -->
- <member><type>uint32_t</type> <name>maxComputeWorkGroupInvocations</name></member> <!-- max total compute invocations in a single local work group -->
- <member><type>uint32_t</type> <name>maxComputeWorkGroupSize</name>[3]</member> <!-- max local size of a compute work group (x,y,z) -->
- <member><type>uint32_t</type> <name>subPixelPrecisionBits</name></member> <!-- number bits of subpixel precision in screen x and y-->
- <member><type>uint32_t</type> <name>subTexelPrecisionBits</name></member> <!-- number bits of precision for selecting texel weights-->
- <member><type>uint32_t</type> <name>mipmapPrecisionBits</name></member> <!-- number bits of precision for selecting mipmap weights -->
- <member><type>uint32_t</type> <name>maxDrawIndexedIndexValue</name></member> <!-- max index value for indexed draw calls (for 32-bit indices) -->
- <member><type>uint32_t</type> <name>maxDrawIndirectCount</name></member> <!-- max draw count for indirect draw calls -->
- <member><type>float</type> <name>maxSamplerLodBias</name></member> <!-- max absolute sampler level of detail bias -->
- <member><type>float</type> <name>maxSamplerAnisotropy</name></member> <!-- max degree of sampler anisotropy -->
- <member><type>uint32_t</type> <name>maxViewports</name></member> <!-- max number of active viewports -->
- <member><type>uint32_t</type> <name>maxViewportDimensions</name>[2]</member> <!-- max viewport dimensions (x,y) -->
- <member><type>float</type> <name>viewportBoundsRange</name>[2]</member> <!-- viewport bounds range (min,max) -->
- <member><type>uint32_t</type> <name>viewportSubPixelBits</name></member> <!-- number bits of subpixel precision for viewport -->
- <member><type>size_t</type> <name>minMemoryMapAlignment</name></member> <!-- min required alignment of pointers returned by MapMemory (bytes) -->
- <member><type>VkDeviceSize</type> <name>minTexelBufferOffsetAlignment</name></member> <!-- min required alignment for texel buffer offsets (bytes) -->
- <member><type>VkDeviceSize</type> <name>minUniformBufferOffsetAlignment</name></member> <!-- min required alignment for uniform buffer sizes and offsets (bytes) -->
- <member><type>VkDeviceSize</type> <name>minStorageBufferOffsetAlignment</name></member> <!-- min required alignment for storage buffer offsets (bytes) -->
- <member><type>int32_t</type> <name>minTexelOffset</name></member> <!-- min texel offset for OpTextureSampleOffset -->
- <member><type>uint32_t</type> <name>maxTexelOffset</name></member> <!-- max texel offset for OpTextureSampleOffset -->
- <member><type>int32_t</type> <name>minTexelGatherOffset</name></member> <!-- min texel offset for OpTextureGatherOffset -->
- <member><type>uint32_t</type> <name>maxTexelGatherOffset</name></member> <!-- max texel offset for OpTextureGatherOffset -->
- <member><type>float</type> <name>minInterpolationOffset</name></member> <!-- furthest negative offset for interpolateAtOffset -->
- <member><type>float</type> <name>maxInterpolationOffset</name></member> <!-- furthest positive offset for interpolateAtOffset -->
- <member><type>uint32_t</type> <name>subPixelInterpolationOffsetBits</name></member> <!-- number of subpixel bits for interpolateAtOffset -->
- <member><type>uint32_t</type> <name>maxFramebufferWidth</name></member> <!-- max width for a framebuffer -->
- <member><type>uint32_t</type> <name>maxFramebufferHeight</name></member> <!-- max height for a framebuffer -->
- <member><type>uint32_t</type> <name>maxFramebufferLayers</name></member> <!-- max layer count for a layered framebuffer -->
- <member optional="true"><type>VkSampleCountFlags</type> <name>framebufferColorSampleCounts</name></member> <!-- supported color sample counts for a framebuffer -->
- <member optional="true"><type>VkSampleCountFlags</type> <name>framebufferDepthSampleCounts</name></member> <!-- supported depth sample counts for a framebuffer -->
- <member optional="true"><type>VkSampleCountFlags</type> <name>framebufferStencilSampleCounts</name></member> <!-- supported stencil sample counts for a framebuffer -->
- <member optional="true"><type>VkSampleCountFlags</type> <name>framebufferNoAttachmentsSampleCounts</name></member> <!-- supported sample counts for a framebuffer with no attachments -->
- <member><type>uint32_t</type> <name>maxColorAttachments</name></member> <!-- max number of color attachments per subpass -->
- <member optional="true"><type>VkSampleCountFlags</type> <name>sampledImageColorSampleCounts</name></member> <!-- supported color sample counts for a non-integer sampled image -->
- <member optional="true"><type>VkSampleCountFlags</type> <name>sampledImageIntegerSampleCounts</name></member> <!-- supported sample counts for an integer image -->
- <member optional="true"><type>VkSampleCountFlags</type> <name>sampledImageDepthSampleCounts</name></member> <!-- supported depth sample counts for a sampled image -->
- <member optional="true"><type>VkSampleCountFlags</type> <name>sampledImageStencilSampleCounts</name></member> <!-- supported stencil sample counts for a sampled image -->
- <member optional="true"><type>VkSampleCountFlags</type> <name>storageImageSampleCounts</name></member> <!-- supported sample counts for a storage image -->
- <member><type>uint32_t</type> <name>maxSampleMaskWords</name></member> <!-- max number of sample mask words -->
- <member><type>VkBool32</type> <name>timestampComputeAndGraphics</name></member> <!-- timestamps on graphics and compute queues -->
- <member><type>float</type> <name>timestampPeriod</name></member> <!-- number of nanoseconds it takes for timestamp query value to increment by 1 -->
- <member><type>uint32_t</type> <name>maxClipDistances</name></member> <!-- max number of clip distances -->
- <member><type>uint32_t</type> <name>maxCullDistances</name></member> <!-- max number of cull distances -->
- <member><type>uint32_t</type> <name>maxCombinedClipAndCullDistances</name></member> <!-- max combined number of user clipping -->
- <member><type>uint32_t</type> <name>discreteQueuePriorities</name></member> <!-- distinct queue priorities available -->
- <member><type>float</type> <name>pointSizeRange</name>[2]</member> <!-- range (min,max) of supported point sizes -->
- <member><type>float</type> <name>lineWidthRange</name>[2]</member> <!-- range (min,max) of supported line widths -->
- <member><type>float</type> <name>pointSizeGranularity</name></member> <!-- granularity of supported point sizes -->
- <member><type>float</type> <name>lineWidthGranularity</name></member> <!-- granularity of supported line widths -->
- <member><type>VkBool32</type> <name>strictLines</name></member> <!-- line rasterization follows preferred rules -->
- <member><type>VkBool32</type> <name>standardSampleLocations</name></member> <!-- supports standard sample locations for all supported sample counts -->
- <member><type>VkDeviceSize</type> <name>optimalBufferCopyOffsetAlignment</name></member> <!-- optimal offset of buffer copies -->
- <member><type>VkDeviceSize</type> <name>optimalBufferCopyRowPitchAlignment</name></member><!-- optimal pitch of buffer copies -->
- <member><type>VkDeviceSize</type> <name>nonCoherentAtomSize</name></member> <!-- minimum size and alignment for non-coherent host-mapped device memory access -->
+ <comment>resource maximum sizes</comment>
+ <member limittype="max"><type>uint32_t</type> <name>maxImageDimension1D</name><comment>max 1D image dimension</comment></member>
+ <member limittype="max"><type>uint32_t</type> <name>maxImageDimension2D</name><comment>max 2D image dimension</comment></member>
+ <member limittype="max"><type>uint32_t</type> <name>maxImageDimension3D</name><comment>max 3D image dimension</comment></member>
+ <member limittype="max"><type>uint32_t</type> <name>maxImageDimensionCube</name><comment>max cubemap image dimension</comment></member>
+ <member limittype="max"><type>uint32_t</type> <name>maxImageArrayLayers</name><comment>max layers for image arrays</comment></member>
+ <member limittype="max"><type>uint32_t</type> <name>maxTexelBufferElements</name><comment>max texel buffer size (fstexels)</comment></member>
+ <member limittype="max"><type>uint32_t</type> <name>maxUniformBufferRange</name><comment>max uniform buffer range (bytes)</comment></member>
+ <member limittype="max"><type>uint32_t</type> <name>maxStorageBufferRange</name><comment>max storage buffer range (bytes)</comment></member>
+ <member limittype="max"><type>uint32_t</type> <name>maxPushConstantsSize</name><comment>max size of the push constants pool (bytes)</comment></member>
+ <comment>memory limits</comment>
+ <member limittype="max"><type>uint32_t</type> <name>maxMemoryAllocationCount</name><comment>max number of device memory allocations supported</comment></member>
+ <member limittype="max"><type>uint32_t</type> <name>maxSamplerAllocationCount</name><comment>max number of samplers that can be allocated on a device</comment></member>
+ <member limittype="min,mul"><type>VkDeviceSize</type> <name>bufferImageGranularity</name><comment>Granularity (in bytes) at which buffers and images can be bound to adjacent memory for simultaneous usage</comment></member>
+ <member limittype="max"><type>VkDeviceSize</type> <name>sparseAddressSpaceSize</name><comment>Total address space available for sparse allocations (bytes)</comment></member>
+ <comment>descriptor set limits</comment>
+ <member limittype="max"><type>uint32_t</type> <name>maxBoundDescriptorSets</name><comment>max number of descriptors sets that can be bound to a pipeline</comment></member>
+ <member limittype="max"><type>uint32_t</type> <name>maxPerStageDescriptorSamplers</name><comment>max number of samplers allowed per-stage in a descriptor set</comment></member>
+ <member limittype="max"><type>uint32_t</type> <name>maxPerStageDescriptorUniformBuffers</name><comment>max number of uniform buffers allowed per-stage in a descriptor set</comment></member>
+ <member limittype="max"><type>uint32_t</type> <name>maxPerStageDescriptorStorageBuffers</name><comment>max number of storage buffers allowed per-stage in a descriptor set</comment></member>
+ <member limittype="max"><type>uint32_t</type> <name>maxPerStageDescriptorSampledImages</name><comment>max number of sampled images allowed per-stage in a descriptor set</comment></member>
+ <member limittype="max"><type>uint32_t</type> <name>maxPerStageDescriptorStorageImages</name><comment>max number of storage images allowed per-stage in a descriptor set</comment></member>
+ <member limittype="max"><type>uint32_t</type> <name>maxPerStageDescriptorInputAttachments</name><comment>max number of input attachments allowed per-stage in a descriptor set</comment></member>
+ <member limittype="max"><type>uint32_t</type> <name>maxPerStageResources</name><comment>max number of resources allowed by a single stage</comment></member>
+ <member limittype="max"><type>uint32_t</type> <name>maxDescriptorSetSamplers</name><comment>max number of samplers allowed in all stages in a descriptor set</comment></member>
+ <member limittype="max"><type>uint32_t</type> <name>maxDescriptorSetUniformBuffers</name><comment>max number of uniform buffers allowed in all stages in a descriptor set</comment></member>
+ <member limittype="max"><type>uint32_t</type> <name>maxDescriptorSetUniformBuffersDynamic</name><comment>max number of dynamic uniform buffers allowed in all stages in a descriptor set</comment></member>
+ <member limittype="max"><type>uint32_t</type> <name>maxDescriptorSetStorageBuffers</name><comment>max number of storage buffers allowed in all stages in a descriptor set</comment></member>
+ <member limittype="max"><type>uint32_t</type> <name>maxDescriptorSetStorageBuffersDynamic</name><comment>max number of dynamic storage buffers allowed in all stages in a descriptor set</comment></member>
+ <member limittype="max"><type>uint32_t</type> <name>maxDescriptorSetSampledImages</name><comment>max number of sampled images allowed in all stages in a descriptor set</comment></member>
+ <member limittype="max"><type>uint32_t</type> <name>maxDescriptorSetStorageImages</name><comment>max number of storage images allowed in all stages in a descriptor set</comment></member>
+ <member limittype="max"><type>uint32_t</type> <name>maxDescriptorSetInputAttachments</name><comment>max number of input attachments allowed in all stages in a descriptor set</comment></member>
+ <comment>vertex stage limits</comment>
+ <member limittype="max"><type>uint32_t</type> <name>maxVertexInputAttributes</name><comment>max number of vertex input attribute slots</comment></member>
+ <member limittype="max"><type>uint32_t</type> <name>maxVertexInputBindings</name><comment>max number of vertex input binding slots</comment></member>
+ <member limittype="max"><type>uint32_t</type> <name>maxVertexInputAttributeOffset</name><comment>max vertex input attribute offset added to vertex buffer offset</comment></member>
+ <member limittype="max"><type>uint32_t</type> <name>maxVertexInputBindingStride</name><comment>max vertex input binding stride</comment></member>
+ <member limittype="max"><type>uint32_t</type> <name>maxVertexOutputComponents</name><comment>max number of output components written by vertex shader</comment></member>
+ <comment>tessellation control stage limits</comment>
+ <member limittype="max"><type>uint32_t</type> <name>maxTessellationGenerationLevel</name><comment>max level supported by tessellation primitive generator</comment></member>
+ <member limittype="max"><type>uint32_t</type> <name>maxTessellationPatchSize</name><comment>max patch size (vertices)</comment></member>
+ <member limittype="max"><type>uint32_t</type> <name>maxTessellationControlPerVertexInputComponents</name><comment>max number of input components per-vertex in TCS</comment></member>
+ <member limittype="max"><type>uint32_t</type> <name>maxTessellationControlPerVertexOutputComponents</name><comment>max number of output components per-vertex in TCS</comment></member>
+ <member limittype="max"><type>uint32_t</type> <name>maxTessellationControlPerPatchOutputComponents</name><comment>max number of output components per-patch in TCS</comment></member>
+ <member limittype="max"><type>uint32_t</type> <name>maxTessellationControlTotalOutputComponents</name><comment>max total number of per-vertex and per-patch output components in TCS</comment></member>
+ <comment>tessellation evaluation stage limits</comment>
+ <member limittype="max"><type>uint32_t</type> <name>maxTessellationEvaluationInputComponents</name><comment>max number of input components per vertex in TES</comment></member>
+ <member limittype="max"><type>uint32_t</type> <name>maxTessellationEvaluationOutputComponents</name><comment>max number of output components per vertex in TES</comment></member>
+ <comment>geometry stage limits</comment>
+ <member limittype="max"><type>uint32_t</type> <name>maxGeometryShaderInvocations</name><comment>max invocation count supported in geometry shader</comment></member>
+ <member limittype="max"><type>uint32_t</type> <name>maxGeometryInputComponents</name><comment>max number of input components read in geometry stage</comment></member>
+ <member limittype="max"><type>uint32_t</type> <name>maxGeometryOutputComponents</name><comment>max number of output components written in geometry stage</comment></member>
+ <member limittype="max"><type>uint32_t</type> <name>maxGeometryOutputVertices</name><comment>max number of vertices that can be emitted in geometry stage</comment></member>
+ <member limittype="max"><type>uint32_t</type> <name>maxGeometryTotalOutputComponents</name><comment>max total number of components (all vertices) written in geometry stage</comment></member>
+ <comment>fragment stage limits</comment>
+ <member limittype="max"><type>uint32_t</type> <name>maxFragmentInputComponents</name><comment>max number of input components read in fragment stage</comment></member>
+ <member limittype="max"><type>uint32_t</type> <name>maxFragmentOutputAttachments</name><comment>max number of output attachments written in fragment stage</comment></member>
+ <member limittype="max"><type>uint32_t</type> <name>maxFragmentDualSrcAttachments</name><comment>max number of output attachments written when using dual source blending</comment></member>
+ <member limittype="max"><type>uint32_t</type> <name>maxFragmentCombinedOutputResources</name><comment>max total number of storage buffers, storage images and output buffers</comment></member>
+ <comment>compute stage limits</comment>
+ <member limittype="max"><type>uint32_t</type> <name>maxComputeSharedMemorySize</name><comment>max total storage size of work group local storage (bytes)</comment></member>
+ <member limittype="max"><type>uint32_t</type> <name>maxComputeWorkGroupCount</name>[3]<comment>max num of compute work groups that may be dispatched by a single command (x,y,z)</comment></member>
+ <member limittype="max"><type>uint32_t</type> <name>maxComputeWorkGroupInvocations</name><comment>max total compute invocations in a single local work group</comment></member>
+ <member limittype="max"><type>uint32_t</type> <name>maxComputeWorkGroupSize</name>[3]<comment>max local size of a compute work group (x,y,z)</comment></member>
+ <member limittype="bits"><type>uint32_t</type> <name>subPixelPrecisionBits</name><comment>number bits of subpixel precision in screen x and y</comment></member>
+ <member limittype="bits"><type>uint32_t</type> <name>subTexelPrecisionBits</name><comment>number bits of precision for selecting texel weights</comment></member>
+ <member limittype="bits"><type>uint32_t</type> <name>mipmapPrecisionBits</name><comment>number bits of precision for selecting mipmap weights</comment></member>
+ <member limittype="max"><type>uint32_t</type> <name>maxDrawIndexedIndexValue</name><comment>max index value for indexed draw calls (for 32-bit indices)</comment></member>
+ <member limittype="max"><type>uint32_t</type> <name>maxDrawIndirectCount</name><comment>max draw count for indirect drawing calls</comment></member>
+ <member limittype="max"><type>float</type> <name>maxSamplerLodBias</name><comment>max absolute sampler LOD bias</comment></member>
+ <member limittype="max"><type>float</type> <name>maxSamplerAnisotropy</name><comment>max degree of sampler anisotropy</comment></member>
+ <member limittype="max"><type>uint32_t</type> <name>maxViewports</name><comment>max number of active viewports</comment></member>
+ <member limittype="max"><type>uint32_t</type> <name>maxViewportDimensions</name>[2]<comment>max viewport dimensions (x,y)</comment></member>
+ <member limittype="range"><type>float</type> <name>viewportBoundsRange</name>[2]<comment>viewport bounds range (min,max)</comment></member>
+ <member limittype="bits"><type>uint32_t</type> <name>viewportSubPixelBits</name><comment>number bits of subpixel precision for viewport</comment></member>
+ <member limittype="min,pot"><type>size_t</type> <name>minMemoryMapAlignment</name><comment>min required alignment of pointers returned by MapMemory (bytes)</comment></member>
+ <member limittype="min,pot"><type>VkDeviceSize</type> <name>minTexelBufferOffsetAlignment</name><comment>min required alignment for texel buffer offsets (bytes) </comment></member>
+ <member limittype="min,pot"><type>VkDeviceSize</type> <name>minUniformBufferOffsetAlignment</name><comment>min required alignment for uniform buffer sizes and offsets (bytes)</comment></member>
+ <member limittype="min,pot"><type>VkDeviceSize</type> <name>minStorageBufferOffsetAlignment</name><comment>min required alignment for storage buffer offsets (bytes)</comment></member>
+ <member limittype="min"><type>int32_t</type> <name>minTexelOffset</name><comment>min texel offset for OpTextureSampleOffset</comment></member>
+ <member limittype="max"><type>uint32_t</type> <name>maxTexelOffset</name><comment>max texel offset for OpTextureSampleOffset</comment></member>
+ <member limittype="min"><type>int32_t</type> <name>minTexelGatherOffset</name><comment>min texel offset for OpTextureGatherOffset</comment></member>
+ <member limittype="max"><type>uint32_t</type> <name>maxTexelGatherOffset</name><comment>max texel offset for OpTextureGatherOffset</comment></member>
+ <member limittype="min"><type>float</type> <name>minInterpolationOffset</name><comment>furthest negative offset for interpolateAtOffset</comment></member>
+ <member limittype="max"><type>float</type> <name>maxInterpolationOffset</name><comment>furthest positive offset for interpolateAtOffset</comment></member>
+ <member limittype="bits"><type>uint32_t</type> <name>subPixelInterpolationOffsetBits</name><comment>number of subpixel bits for interpolateAtOffset</comment></member>
+ <member limittype="max"><type>uint32_t</type> <name>maxFramebufferWidth</name><comment>max width for a framebuffer</comment></member>
+ <member limittype="max"><type>uint32_t</type> <name>maxFramebufferHeight</name><comment>max height for a framebuffer</comment></member>
+ <member limittype="max"><type>uint32_t</type> <name>maxFramebufferLayers</name><comment>max layer count for a layered framebuffer</comment></member>
+ <member limittype="bitmask" optional="true"><type>VkSampleCountFlags</type> <name>framebufferColorSampleCounts</name><comment>supported color sample counts for a framebuffer</comment></member>
+ <member limittype="bitmask" optional="true"><type>VkSampleCountFlags</type> <name>framebufferDepthSampleCounts</name><comment>supported depth sample counts for a framebuffer</comment></member>
+ <member limittype="bitmask" optional="true"><type>VkSampleCountFlags</type> <name>framebufferStencilSampleCounts</name><comment>supported stencil sample counts for a framebuffer</comment></member>
+ <member limittype="bitmask" optional="true"><type>VkSampleCountFlags</type> <name>framebufferNoAttachmentsSampleCounts</name><comment>supported sample counts for a subpass which uses no attachments</comment></member>
+ <member limittype="max"><type>uint32_t</type> <name>maxColorAttachments</name><comment>max number of color attachments per subpass</comment></member>
+ <member limittype="bitmask" optional="true"><type>VkSampleCountFlags</type> <name>sampledImageColorSampleCounts</name><comment>supported color sample counts for a non-integer sampled image</comment></member>
+ <member limittype="bitmask" optional="true"><type>VkSampleCountFlags</type> <name>sampledImageIntegerSampleCounts</name><comment>supported sample counts for an integer image</comment></member>
+ <member limittype="bitmask" optional="true"><type>VkSampleCountFlags</type> <name>sampledImageDepthSampleCounts</name><comment>supported depth sample counts for a sampled image</comment></member>
+ <member limittype="bitmask" optional="true"><type>VkSampleCountFlags</type> <name>sampledImageStencilSampleCounts</name><comment>supported stencil sample counts for a sampled image</comment></member>
+ <member limittype="bitmask" optional="true"><type>VkSampleCountFlags</type> <name>storageImageSampleCounts</name><comment>supported sample counts for a storage image</comment></member>
+ <member limittype="max"><type>uint32_t</type> <name>maxSampleMaskWords</name><comment>max number of sample mask words</comment></member>
+ <member limittype="bitmask"><type>VkBool32</type> <name>timestampComputeAndGraphics</name><comment>timestamps on graphics and compute queues</comment></member>
+ <member limittype="min,mul"><type>float</type> <name>timestampPeriod</name><comment>number of nanoseconds it takes for timestamp query value to increment by 1</comment></member>
+ <member limittype="max"><type>uint32_t</type> <name>maxClipDistances</name><comment>max number of clip distances</comment></member>
+ <member limittype="max"><type>uint32_t</type> <name>maxCullDistances</name><comment>max number of cull distances</comment></member>
+ <member limittype="max"><type>uint32_t</type> <name>maxCombinedClipAndCullDistances</name><comment>max combined number of user clipping</comment></member>
+ <member limittype="max"><type>uint32_t</type> <name>discreteQueuePriorities</name><comment>distinct queue priorities available </comment></member>
+ <member limittype="range"><type>float</type> <name>pointSizeRange</name>[2]<comment>range (min,max) of supported point sizes</comment></member>
+ <member limittype="range"><type>float</type> <name>lineWidthRange</name>[2]<comment>range (min,max) of supported line widths</comment></member>
+ <member limittype="min,mul"><type>float</type> <name>pointSizeGranularity</name><comment>granularity of supported point sizes</comment></member>
+ <member limittype="min,mul"><type>float</type> <name>lineWidthGranularity</name><comment>granularity of supported line widths</comment></member>
+ <member limittype="bitmask"><type>VkBool32</type> <name>strictLines</name><comment>line rasterization follows preferred rules</comment></member>
+ <member limittype="bitmask"><type>VkBool32</type> <name>standardSampleLocations</name><comment>supports standard sample locations for all supported sample counts</comment></member>
+ <member limittype="min,pot"><type>VkDeviceSize</type> <name>optimalBufferCopyOffsetAlignment</name><comment>optimal offset of buffer copies</comment></member>
+ <member limittype="min,pot"><type>VkDeviceSize</type> <name>optimalBufferCopyRowPitchAlignment</name><comment>optimal pitch of buffer copies</comment></member>
+ <member limittype="min,pot"><type>VkDeviceSize</type> <name>nonCoherentAtomSize</name><comment>minimum size and alignment for non-coherent host-mapped device memory access</comment></member>
</type>
<type category="struct" name="VkSemaphoreCreateInfo">
<member values="VK_STRUCTURE_TYPE_SEMAPHORE_CREATE_INFO"><type>VkStructureType</type> <name>sType</name></member>
- <member>const <type>void</type>* <name>pNext</name></member> <!-- Pointer to next structure -->
- <member optional="true"><type>VkSemaphoreCreateFlags</type> <name>flags</name></member> <!-- Semaphore creation flags -->
+ <member optional="true">const <type>void</type>* <name>pNext</name></member>
+ <member optional="true"><type>VkSemaphoreCreateFlags</type> <name>flags</name><comment>Semaphore creation flags</comment></member>
</type>
<type category="struct" name="VkQueryPoolCreateInfo">
<member values="VK_STRUCTURE_TYPE_QUERY_POOL_CREATE_INFO"><type>VkStructureType</type> <name>sType</name></member>
- <member>const <type>void</type>* <name>pNext</name></member> <!-- Pointer to next structure -->
- <member optional="true"><type>VkQueryPoolCreateFlags</type> <name>flags</name></member> <!-- Reserved -->
+ <member optional="true">const <type>void</type>* <name>pNext</name></member>
+ <member optional="true"><type>VkQueryPoolCreateFlags</type> <name>flags</name></member>
<member><type>VkQueryType</type> <name>queryType</name></member>
<member><type>uint32_t</type> <name>queryCount</name></member>
- <member optional="true" noautovalidity="true"><type>VkQueryPipelineStatisticFlags</type> <name>pipelineStatistics</name></member> <!-- Optional -->
+ <member optional="true" noautovalidity="true"><type>VkQueryPipelineStatisticFlags</type> <name>pipelineStatistics</name><comment>Optional</comment></member>
</type>
<type category="struct" name="VkFramebufferCreateInfo">
<member values="VK_STRUCTURE_TYPE_FRAMEBUFFER_CREATE_INFO"><type>VkStructureType</type> <name>sType</name></member>
- <member>const <type>void</type>* <name>pNext</name></member> <!-- Pointer to next structure -->
- <member optional="true"><type>VkFramebufferCreateFlags</type> <name>flags</name></member> <!-- Reserved -->
- <member><type>VkRenderPass</type> <name>renderPass</name></member>
+ <member optional="true">const <type>void</type>* <name>pNext</name></member>
+ <member optional="true"><type>VkFramebufferCreateFlags</type> <name>flags</name></member>
+ <member><type>VkRenderPass</type> <name>renderPass</name></member>
<member optional="true"><type>uint32_t</type> <name>attachmentCount</name></member>
- <member len="attachmentCount">const <type>VkImageView</type>* <name>pAttachments</name></member>
+ <member noautovalidity="true" len="attachmentCount">const <type>VkImageView</type>* <name>pAttachments</name></member>
<member><type>uint32_t</type> <name>width</name></member>
<member><type>uint32_t</type> <name>height</name></member>
<member><type>uint32_t</type> <name>layers</name></member>
</type>
<type category="struct" name="VkDrawIndirectCommand">
- <member><type>uint32_t</type> <name>vertexCount</name></member>
- <member><type>uint32_t</type> <name>instanceCount</name></member>
- <member><type>uint32_t</type> <name>firstVertex</name></member>
- <member><type>uint32_t</type> <name>firstInstance</name></member>
+ <member><type>uint32_t</type> <name>vertexCount</name></member>
+ <member><type>uint32_t</type> <name>instanceCount</name></member>
+ <member><type>uint32_t</type> <name>firstVertex</name></member>
+ <member noautovalidity="true"><type>uint32_t</type> <name>firstInstance</name></member>
</type>
<type category="struct" name="VkDrawIndexedIndirectCommand">
- <member><type>uint32_t</type> <name>indexCount</name></member>
- <member><type>uint32_t</type> <name>instanceCount</name></member>
- <member><type>uint32_t</type> <name>firstIndex</name></member>
- <member><type>int32_t</type> <name>vertexOffset</name></member>
- <member><type>uint32_t</type> <name>firstInstance</name></member>
+ <member><type>uint32_t</type> <name>indexCount</name></member>
+ <member><type>uint32_t</type> <name>instanceCount</name></member>
+ <member><type>uint32_t</type> <name>firstIndex</name></member>
+ <member><type>int32_t</type> <name>vertexOffset</name></member>
+ <member noautovalidity="true"><type>uint32_t</type> <name>firstInstance</name></member>
</type>
<type category="struct" name="VkDispatchIndirectCommand">
- <member><type>uint32_t</type> <name>x</name></member>
- <member><type>uint32_t</type> <name>y</name></member>
- <member><type>uint32_t</type> <name>z</name></member>
+ <member noautovalidity="true"><type>uint32_t</type> <name>x</name></member>
+ <member noautovalidity="true"><type>uint32_t</type> <name>y</name></member>
+ <member noautovalidity="true"><type>uint32_t</type> <name>z</name></member>
+ </type>
+ <type category="struct" name="VkMultiDrawInfoEXT">
+ <member><type>uint32_t</type> <name>firstVertex</name></member>
+ <member><type>uint32_t</type> <name>vertexCount</name></member>
+ </type>
+ <type category="struct" name="VkMultiDrawIndexedInfoEXT">
+ <member><type>uint32_t</type> <name>firstIndex</name></member>
+ <member><type>uint32_t</type> <name>indexCount</name></member>
+ <member><type>int32_t</type> <name>vertexOffset</name></member>
</type>
<type category="struct" name="VkSubmitInfo">
<member values="VK_STRUCTURE_TYPE_SUBMIT_INFO"><type>VkStructureType</type> <name>sType</name></member>
- <member>const <type>void</type>* <name>pNext</name></member> <!-- Pointer to next structure -->
+ <member optional="true">const <type>void</type>* <name>pNext</name></member>
<member optional="true"><type>uint32_t</type> <name>waitSemaphoreCount</name></member>
<member len="waitSemaphoreCount">const <type>VkSemaphore</type>* <name>pWaitSemaphores</name></member>
<member len="waitSemaphoreCount">const <type>VkPipelineStageFlags</type>* <name>pWaitDstStageMask</name></member>
@@ -1390,37 +1868,37 @@ maintained in the master branch of the Khronos Vulkan GitHub project.
<member optional="true"><type>uint32_t</type> <name>signalSemaphoreCount</name></member>
<member len="signalSemaphoreCount">const <type>VkSemaphore</type>* <name>pSignalSemaphores</name></member>
</type>
- <!-- WSI extensions -->
+ <comment>WSI extensions</comment>
<type category="struct" name="VkDisplayPropertiesKHR" returnedonly="true">
- <member><type>VkDisplayKHR</type> <name>display</name></member> <!-- Handle of the display object -->
- <member len="null-terminated">const <type>char</type>* <name>displayName</name></member> <!-- Name of the display -->
- <member><type>VkExtent2D</type> <name>physicalDimensions</name></member> <!-- In millimeters? -->
- <member><type>VkExtent2D</type> <name>physicalResolution</name></member> <!-- Max resolution for CRT? -->
- <member optional="true"><type>VkSurfaceTransformFlagsKHR</type> <name>supportedTransforms</name></member> <!-- one or more bits from VkSurfaceTransformFlagsKHR -->
- <member><type>VkBool32</type> <name>planeReorderPossible</name></member> <!-- VK_TRUE if the overlay plane's z-order can be changed on this display. -->
- <member><type>VkBool32</type> <name>persistentContent</name></member> <!-- VK_TRUE if this is a "smart" display that supports self-refresh/internal buffering. -->
+ <member><type>VkDisplayKHR</type> <name>display</name><comment>Handle of the display object</comment></member>
+ <member len="null-terminated">const <type>char</type>* <name>displayName</name><comment>Name of the display</comment></member>
+ <member><type>VkExtent2D</type> <name>physicalDimensions</name><comment>In millimeters?</comment></member>
+ <member><type>VkExtent2D</type> <name>physicalResolution</name><comment>Max resolution for CRT?</comment></member>
+ <member optional="true"><type>VkSurfaceTransformFlagsKHR</type> <name>supportedTransforms</name><comment>one or more bits from VkSurfaceTransformFlagsKHR</comment></member>
+ <member><type>VkBool32</type> <name>planeReorderPossible</name><comment>VK_TRUE if the overlay plane's z-order can be changed on this display.</comment></member>
+ <member><type>VkBool32</type> <name>persistentContent</name><comment>VK_TRUE if this is a "smart" display that supports self-refresh/internal buffering.</comment></member>
</type>
<type category="struct" name="VkDisplayPlanePropertiesKHR" returnedonly="true">
- <member><type>VkDisplayKHR</type> <name>currentDisplay</name></member> <!-- Display the plane is currently associated with. Will be VK_NULL_HANDLE if the plane is not in use. -->
- <member><type>uint32_t</type> <name>currentStackIndex</name></member> <!-- Current z-order of the plane. -->
+ <member><type>VkDisplayKHR</type> <name>currentDisplay</name><comment>Display the plane is currently associated with. Will be VK_NULL_HANDLE if the plane is not in use.</comment></member>
+ <member><type>uint32_t</type> <name>currentStackIndex</name><comment>Current z-order of the plane.</comment></member>
</type>
<type category="struct" name="VkDisplayModeParametersKHR">
- <member><type>VkExtent2D</type> <name>visibleRegion</name></member> <!-- Visible scanout region. -->
- <member><type>uint32_t</type> <name>refreshRate</name></member> <!-- Number of times per second the display is updated. -->
+ <member><type>VkExtent2D</type> <name>visibleRegion</name><comment>Visible scanout region.</comment></member>
+ <member noautovalidity="true"><type>uint32_t</type> <name>refreshRate</name><comment>Number of times per second the display is updated.</comment></member>
</type>
<type category="struct" name="VkDisplayModePropertiesKHR" returnedonly="true">
- <member><type>VkDisplayModeKHR</type> <name>displayMode</name></member> <!-- Handle of this display mode. -->
- <member><type>VkDisplayModeParametersKHR</type> <name>parameters</name></member> <!-- The parameters this mode uses. -->
+ <member><type>VkDisplayModeKHR</type> <name>displayMode</name><comment>Handle of this display mode.</comment></member>
+ <member><type>VkDisplayModeParametersKHR</type> <name>parameters</name><comment>The parameters this mode uses.</comment></member>
</type>
<type category="struct" name="VkDisplayModeCreateInfoKHR">
<member values="VK_STRUCTURE_TYPE_DISPLAY_MODE_CREATE_INFO_KHR"><type>VkStructureType</type> <name>sType</name></member>
- <member>const <type>void</type>* <name>pNext</name></member> <!-- Pointer to next structure -->
- <member optional="true"><type>VkDisplayModeCreateFlagsKHR</type> <name>flags</name></member> <!-- Reserved -->
- <member><type>VkDisplayModeParametersKHR</type> <name>parameters</name></member> <!-- The parameters this mode uses. -->
+ <member optional="true">const <type>void</type>* <name>pNext</name></member>
+ <member optional="true"><type>VkDisplayModeCreateFlagsKHR</type> <name>flags</name></member>
+ <member><type>VkDisplayModeParametersKHR</type> <name>parameters</name><comment>The parameters this mode uses.</comment></member>
</type>
<type category="struct" name="VkDisplayPlaneCapabilitiesKHR" returnedonly="true">
- <member optional="true"><type>VkDisplayPlaneAlphaFlagsKHR</type> <name>supportedAlpha</name></member> <!-- Types of alpha blending supported, if any. -->
- <member><type>VkOffset2D</type> <name>minSrcPosition</name></member> <!-- Does the plane have any position and extent restrictions? -->
+ <member optional="true"><type>VkDisplayPlaneAlphaFlagsKHR</type> <name>supportedAlpha</name><comment>Types of alpha blending supported, if any.</comment></member>
+ <member><type>VkOffset2D</type> <name>minSrcPosition</name><comment>Does the plane have any position and extent restrictions?</comment></member>
<member><type>VkOffset2D</type> <name>maxSrcPosition</name></member>
<member><type>VkExtent2D</type> <name>minSrcExtent</name></member>
<member><type>VkExtent2D</type> <name>maxSrcExtent</name></member>
@@ -1431,171 +1909,198 @@ maintained in the master branch of the Khronos Vulkan GitHub project.
</type>
<type category="struct" name="VkDisplaySurfaceCreateInfoKHR">
<member values="VK_STRUCTURE_TYPE_DISPLAY_SURFACE_CREATE_INFO_KHR"><type>VkStructureType</type> <name>sType</name></member>
- <member>const <type>void</type>* <name>pNext</name></member> <!-- Pointer to next structure -->
- <member optional="true"><type>VkDisplaySurfaceCreateFlagsKHR</type> <name>flags</name></member> <!-- Reserved -->
- <member><type>VkDisplayModeKHR</type> <name>displayMode</name></member> <!-- The mode to use when displaying this surface -->
- <member><type>uint32_t</type> <name>planeIndex</name></member> <!-- The plane on which this surface appears. Must be between 0 and the value returned by vkGetPhysicalDeviceDisplayPlanePropertiesKHR() in pPropertyCount. -->
- <member><type>uint32_t</type> <name>planeStackIndex</name></member> <!-- The z-order of the plane. -->
- <member><type>VkSurfaceTransformFlagBitsKHR</type> <name>transform</name></member> <!-- Transform to apply to the images as part of the scanout operation -->
- <member><type>float</type> <name>globalAlpha</name></member> <!-- Global alpha value. Must be between 0 and 1, inclusive. Ignored if alphaMode is not VK_DISPLAY_PLANE_ALPHA_GLOBAL_BIT_KHR -->
- <member><type>VkDisplayPlaneAlphaFlagBitsKHR</type> <name>alphaMode</name></member> <!-- What type of alpha blending to use. Must be a bit from vkGetDisplayPlanePropertiesKHR::supportedAlpha. -->
- <member><type>VkExtent2D</type> <name>imageExtent</name></member> <!-- size of the images to use with this surface -->
- </type>
- <type category="struct" name="VkDisplayPresentInfoKHR">
+ <member optional="true">const <type>void</type>* <name>pNext</name></member>
+ <member optional="true"><type>VkDisplaySurfaceCreateFlagsKHR</type> <name>flags</name></member>
+ <member><type>VkDisplayModeKHR</type> <name>displayMode</name><comment>The mode to use when displaying this surface</comment></member>
+ <member><type>uint32_t</type> <name>planeIndex</name><comment>The plane on which this surface appears. Must be between 0 and the value returned by vkGetPhysicalDeviceDisplayPlanePropertiesKHR() in pPropertyCount.</comment></member>
+ <member><type>uint32_t</type> <name>planeStackIndex</name><comment>The z-order of the plane.</comment></member>
+ <member><type>VkSurfaceTransformFlagBitsKHR</type> <name>transform</name><comment>Transform to apply to the images as part of the scanout operation</comment></member>
+ <member><type>float</type> <name>globalAlpha</name><comment>Global alpha value. Must be between 0 and 1, inclusive. Ignored if alphaMode is not VK_DISPLAY_PLANE_ALPHA_GLOBAL_BIT_KHR</comment></member>
+ <member><type>VkDisplayPlaneAlphaFlagBitsKHR</type> <name>alphaMode</name><comment>What type of alpha blending to use. Must be a bit from vkGetDisplayPlanePropertiesKHR::supportedAlpha.</comment></member>
+ <member><type>VkExtent2D</type> <name>imageExtent</name><comment>size of the images to use with this surface</comment></member>
+ </type>
+ <type category="struct" name="VkDisplayPresentInfoKHR" structextends="VkPresentInfoKHR">
<member values="VK_STRUCTURE_TYPE_DISPLAY_PRESENT_INFO_KHR"><type>VkStructureType</type> <name>sType</name></member>
- <member>const <type>void</type>* <name>pNext</name></member> <!-- Pointer to next structure -->
- <member><type>VkRect2D</type> <name>srcRect</name></member> <!-- Rectangle within the presentable image to read pixel data from when presenting to the display. -->
- <member><type>VkRect2D</type> <name>dstRect</name></member> <!-- Rectangle within the current display mode's visible region to display srcRectangle in. -->
- <member><type>VkBool32</type> <name>persistent</name></member> <!-- For smart displays, use buffered mode. If the display properties member "persistentMode" is VK_FALSE, this member must always be VK_FALSE. -->
+ <member optional="true">const <type>void</type>* <name>pNext</name></member>
+ <member><type>VkRect2D</type> <name>srcRect</name><comment>Rectangle within the presentable image to read pixel data from when presenting to the display.</comment></member>
+ <member><type>VkRect2D</type> <name>dstRect</name><comment>Rectangle within the current display mode's visible region to display srcRectangle in.</comment></member>
+ <member><type>VkBool32</type> <name>persistent</name><comment>For smart displays, use buffered mode. If the display properties member "persistentMode" is VK_FALSE, this member must always be VK_FALSE.</comment></member>
</type>
<type category="struct" name="VkSurfaceCapabilitiesKHR" returnedonly="true">
- <member><type>uint32_t</type> <name>minImageCount</name></member> <!-- Supported minimum number of images for the surface -->
- <member><type>uint32_t</type> <name>maxImageCount</name></member> <!-- Supported maximum number of images for the surface, 0 for unlimited -->
- <member><type>VkExtent2D</type> <name>currentExtent</name></member> <!-- Current image width and height for the surface, (0, 0) if undefined -->
- <member><type>VkExtent2D</type> <name>minImageExtent</name></member> <!-- Supported minimum image width and height for the surface -->
- <member><type>VkExtent2D</type> <name>maxImageExtent</name></member> <!-- Supported maximum image width and height for the surface -->
- <member><type>uint32_t</type> <name>maxImageArrayLayers</name></member> <!-- Supported maximum number of image layers for the surface -->
- <member optional="true"><type>VkSurfaceTransformFlagsKHR</type> <name>supportedTransforms</name></member> <!-- 1 or more bits representing the transforms supported -->
- <member><type>VkSurfaceTransformFlagBitsKHR</type> <name>currentTransform</name></member> <!-- The surface's current transform relative to the device's natural orientation -->
- <member optional="true"><type>VkCompositeAlphaFlagsKHR</type> <name>supportedCompositeAlpha</name></member> <!-- 1 or more bits representing the alpha compositing modes supported -->
- <member optional="true"><type>VkImageUsageFlags</type> <name>supportedUsageFlags</name></member> <!-- Supported image usage flags for the surface -->
+ <member><type>uint32_t</type> <name>minImageCount</name><comment>Supported minimum number of images for the surface</comment></member>
+ <member><type>uint32_t</type> <name>maxImageCount</name><comment>Supported maximum number of images for the surface, 0 for unlimited</comment></member>
+ <member><type>VkExtent2D</type> <name>currentExtent</name><comment>Current image width and height for the surface, (0, 0) if undefined</comment></member>
+ <member><type>VkExtent2D</type> <name>minImageExtent</name><comment>Supported minimum image width and height for the surface</comment></member>
+ <member><type>VkExtent2D</type> <name>maxImageExtent</name><comment>Supported maximum image width and height for the surface</comment></member>
+ <member><type>uint32_t</type> <name>maxImageArrayLayers</name><comment>Supported maximum number of image layers for the surface</comment></member>
+ <member><type>VkSurfaceTransformFlagsKHR</type> <name>supportedTransforms</name><comment>1 or more bits representing the transforms supported</comment></member>
+ <member><type>VkSurfaceTransformFlagBitsKHR</type> <name>currentTransform</name><comment>The surface's current transform relative to the device's natural orientation</comment></member>
+ <member><type>VkCompositeAlphaFlagsKHR</type> <name>supportedCompositeAlpha</name><comment>1 or more bits representing the alpha compositing modes supported</comment></member>
+ <member><type>VkImageUsageFlags</type> <name>supportedUsageFlags</name><comment>Supported image usage flags for the surface</comment></member>
</type>
<type category="struct" name="VkAndroidSurfaceCreateInfoKHR">
<member values="VK_STRUCTURE_TYPE_ANDROID_SURFACE_CREATE_INFO_KHR"><type>VkStructureType</type> <name>sType</name></member>
- <member>const <type>void</type>* <name>pNext</name></member> <!-- Pointer to next structure -->
- <member optional="true"><type>VkAndroidSurfaceCreateFlagsKHR</type> <name>flags</name></member> <!-- Reserved -->
- <member noautovalidity="true"><type>ANativeWindow</type>* <name>window</name></member>
- </type>
- <type category="struct" name="VkMirSurfaceCreateInfoKHR">
- <member values="VK_STRUCTURE_TYPE_MIR_SURFACE_CREATE_INFO_KHR"><type>VkStructureType</type> <name>sType</name></member>
- <member>const <type>void</type>* <name>pNext</name></member> <!-- Pointer to next structure -->
- <member optional="true"><type>VkMirSurfaceCreateFlagsKHR</type> <name>flags</name></member> <!-- Reserved -->
- <member noautovalidity="true"><type>MirConnection</type>* <name>connection</name></member>
- <member noautovalidity="true"><type>MirSurface</type>* <name>mirSurface</name></member>
+ <member optional="true">const <type>void</type>* <name>pNext</name></member>
+ <member optional="true"><type>VkAndroidSurfaceCreateFlagsKHR</type> <name>flags</name></member>
+ <member noautovalidity="true">struct <type>ANativeWindow</type>* <name>window</name></member>
</type>
<type category="struct" name="VkViSurfaceCreateInfoNN">
<member values="VK_STRUCTURE_TYPE_VI_SURFACE_CREATE_INFO_NN"><type>VkStructureType</type> <name>sType</name></member>
- <member>const <type>void</type>* <name>pNext</name></member> <!-- Pointer to next structure -->
- <member optional="true"><type>VkViSurfaceCreateFlagsNN</type> <name>flags</name></member> <!-- Reserved -->
- <member><type>void</type>* <name>window</name></member>
+ <member optional="true">const <type>void</type>* <name>pNext</name></member>
+ <member optional="true"><type>VkViSurfaceCreateFlagsNN</type> <name>flags</name></member>
+ <member noautovalidity="true"><type>void</type>* <name>window</name></member>
</type>
<type category="struct" name="VkWaylandSurfaceCreateInfoKHR">
<member values="VK_STRUCTURE_TYPE_WAYLAND_SURFACE_CREATE_INFO_KHR"><type>VkStructureType</type> <name>sType</name></member>
- <member>const <type>void</type>* <name>pNext</name></member> <!-- Pointer to next structure -->
- <member optional="true"><type>VkWaylandSurfaceCreateFlagsKHR</type> <name>flags</name></member> <!-- Reserved -->
+ <member optional="true">const <type>void</type>* <name>pNext</name></member>
+ <member optional="true"><type>VkWaylandSurfaceCreateFlagsKHR</type> <name>flags</name></member>
<member noautovalidity="true">struct <type>wl_display</type>* <name>display</name></member>
<member noautovalidity="true">struct <type>wl_surface</type>* <name>surface</name></member>
</type>
<type category="struct" name="VkWin32SurfaceCreateInfoKHR">
<member values="VK_STRUCTURE_TYPE_WIN32_SURFACE_CREATE_INFO_KHR"><type>VkStructureType</type> <name>sType</name></member>
- <member>const <type>void</type>* <name>pNext</name></member> <!-- Pointer to next structure -->
- <member optional="true"><type>VkWin32SurfaceCreateFlagsKHR</type> <name>flags</name></member> <!-- Reserved -->
+ <member optional="true">const <type>void</type>* <name>pNext</name></member>
+ <member optional="true"><type>VkWin32SurfaceCreateFlagsKHR</type> <name>flags</name></member>
<member><type>HINSTANCE</type> <name>hinstance</name></member>
<member><type>HWND</type> <name>hwnd</name></member>
</type>
<type category="struct" name="VkXlibSurfaceCreateInfoKHR">
<member values="VK_STRUCTURE_TYPE_XLIB_SURFACE_CREATE_INFO_KHR"><type>VkStructureType</type> <name>sType</name></member>
- <member>const <type>void</type>* <name>pNext</name></member> <!-- Pointer to next structure -->
- <member optional="true"><type>VkXlibSurfaceCreateFlagsKHR</type> <name>flags</name></member> <!-- Reserved -->
+ <member optional="true">const <type>void</type>* <name>pNext</name></member>
+ <member optional="true"><type>VkXlibSurfaceCreateFlagsKHR</type> <name>flags</name></member>
<member noautovalidity="true"><type>Display</type>* <name>dpy</name></member>
<member><type>Window</type> <name>window</name></member>
</type>
<type category="struct" name="VkXcbSurfaceCreateInfoKHR">
<member values="VK_STRUCTURE_TYPE_XCB_SURFACE_CREATE_INFO_KHR"><type>VkStructureType</type> <name>sType</name></member>
- <member>const <type>void</type>* <name>pNext</name></member> <!-- Pointer to next structure -->
- <member optional="true"><type>VkXcbSurfaceCreateFlagsKHR</type> <name>flags</name></member> <!-- Reserved -->
+ <member optional="true">const <type>void</type>* <name>pNext</name></member>
+ <member optional="true"><type>VkXcbSurfaceCreateFlagsKHR</type> <name>flags</name></member>
<member noautovalidity="true"><type>xcb_connection_t</type>* <name>connection</name></member>
<member><type>xcb_window_t</type> <name>window</name></member>
</type>
+ <type category="struct" name="VkDirectFBSurfaceCreateInfoEXT">
+ <member values="VK_STRUCTURE_TYPE_DIRECTFB_SURFACE_CREATE_INFO_EXT"><type>VkStructureType</type> <name>sType</name></member>
+ <member optional="true">const <type>void</type>* <name>pNext</name></member>
+ <member optional="true"><type>VkDirectFBSurfaceCreateFlagsEXT</type> <name>flags</name></member>
+ <member noautovalidity="true"><type>IDirectFB</type>* <name>dfb</name></member>
+ <member noautovalidity="true"><type>IDirectFBSurface</type>* <name>surface</name></member>
+ </type>
+ <type category="struct" name="VkImagePipeSurfaceCreateInfoFUCHSIA">
+ <member values="VK_STRUCTURE_TYPE_IMAGEPIPE_SURFACE_CREATE_INFO_FUCHSIA"><type>VkStructureType</type> <name>sType</name></member>
+ <member optional="true">const <type>void</type>* <name>pNext</name></member>
+ <member optional="true"><type>VkImagePipeSurfaceCreateFlagsFUCHSIA</type> <name>flags</name></member>
+ <member><type>zx_handle_t</type> <name>imagePipeHandle</name></member>
+ </type>
+ <type category="struct" name="VkStreamDescriptorSurfaceCreateInfoGGP">
+ <member values="VK_STRUCTURE_TYPE_STREAM_DESCRIPTOR_SURFACE_CREATE_INFO_GGP"><type>VkStructureType</type> <name>sType</name></member>
+ <member optional="true">const <type>void</type>* <name>pNext</name></member>
+ <member optional="true"><type>VkStreamDescriptorSurfaceCreateFlagsGGP</type> <name>flags</name></member>
+ <member><type>GgpStreamDescriptor</type> <name>streamDescriptor</name></member>
+ </type>
+ <type category="struct" name="VkScreenSurfaceCreateInfoQNX">
+ <member values="VK_STRUCTURE_TYPE_SCREEN_SURFACE_CREATE_INFO_QNX"><type>VkStructureType</type> <name>sType</name></member>
+ <member optional="true">const <type>void</type>* <name>pNext</name></member>
+ <member optional="true"><type>VkScreenSurfaceCreateFlagsQNX</type> <name>flags</name></member>
+ <member noautovalidity="true">struct <type>_screen_context</type>* <name>context</name></member>
+ <member noautovalidity="true">struct <type>_screen_window</type>* <name>window</name></member>
+ </type>
<type category="struct" name="VkSurfaceFormatKHR" returnedonly="true">
- <member><type>VkFormat</type> <name>format</name></member> <!-- Supported pair of rendering format -->
- <member><type>VkColorSpaceKHR</type> <name>colorSpace</name></member> <!-- and color space for the surface -->
+ <member><type>VkFormat</type> <name>format</name><comment>Supported pair of rendering format</comment></member>
+ <member><type>VkColorSpaceKHR</type> <name>colorSpace</name><comment>and color space for the surface</comment></member>
</type>
<type category="struct" name="VkSwapchainCreateInfoKHR">
<member values="VK_STRUCTURE_TYPE_SWAPCHAIN_CREATE_INFO_KHR"><type>VkStructureType</type> <name>sType</name></member>
- <member>const <type>void</type>* <name>pNext</name></member> <!-- Pointer to next structure -->
- <member optional="true"><type>VkSwapchainCreateFlagsKHR</type> <name>flags</name></member> <!-- Reserved -->
- <member><type>VkSurfaceKHR</type> <name>surface</name></member> <!-- The swapchain's target surface -->
- <member><type>uint32_t</type> <name>minImageCount</name></member> <!-- Minimum number of presentation images the application needs -->
- <member><type>VkFormat</type> <name>imageFormat</name></member> <!-- Format of the presentation images -->
- <member><type>VkColorSpaceKHR</type> <name>imageColorSpace</name></member> <!-- Colorspace of the presentation images -->
- <member><type>VkExtent2D</type> <name>imageExtent</name></member> <!-- Dimensions of the presentation images -->
- <member><type>uint32_t</type> <name>imageArrayLayers</name></member> <!-- Determines the number of views for multiview/stereo presentation -->
- <member><type>VkImageUsageFlags</type> <name>imageUsage</name></member> <!-- Bits indicating how the presentation images will be used -->
- <member><type>VkSharingMode</type> <name>imageSharingMode</name></member> <!-- Sharing mode used for the presentation images -->
- <member optional="true"><type>uint32_t</type> <name>queueFamilyIndexCount</name></member> <!-- Number of queue families having access to the images in case of concurrent sharing mode -->
- <member noautovalidity="true" len="queueFamilyIndexCount">const <type>uint32_t</type>* <name>pQueueFamilyIndices</name></member> <!-- Array of queue family indices having access to the images in case of concurrent sharing mode -->
- <member><type>VkSurfaceTransformFlagBitsKHR</type> <name>preTransform</name></member> <!-- The transform, relative to the device's natural orientation, applied to the image content prior to presentation -->
- <member><type>VkCompositeAlphaFlagBitsKHR</type> <name>compositeAlpha</name></member> <!-- The alpha blending mode used when compositing this surface with other surfaces in the window system -->
- <member><type>VkPresentModeKHR</type> <name>presentMode</name></member> <!-- Which presentation mode to use for presents on this swap chain -->
- <member><type>VkBool32</type> <name>clipped</name></member> <!-- Specifies whether presentable images may be affected by window clip regions -->
- <member optional="true"><type>VkSwapchainKHR</type> <name>oldSwapchain</name></member> <!-- Existing swap chain to replace, if any -->
+ <member optional="true">const <type>void</type>* <name>pNext</name></member>
+ <member optional="true"><type>VkSwapchainCreateFlagsKHR</type> <name>flags</name></member>
+ <member><type>VkSurfaceKHR</type> <name>surface</name><comment>The swapchain's target surface</comment></member>
+ <member><type>uint32_t</type> <name>minImageCount</name><comment>Minimum number of presentation images the application needs</comment></member>
+ <member><type>VkFormat</type> <name>imageFormat</name><comment>Format of the presentation images</comment></member>
+ <member><type>VkColorSpaceKHR</type> <name>imageColorSpace</name><comment>Colorspace of the presentation images</comment></member>
+ <member><type>VkExtent2D</type> <name>imageExtent</name><comment>Dimensions of the presentation images</comment></member>
+ <member><type>uint32_t</type> <name>imageArrayLayers</name><comment>Determines the number of views for multiview/stereo presentation</comment></member>
+ <member><type>VkImageUsageFlags</type> <name>imageUsage</name><comment>Bits indicating how the presentation images will be used</comment></member>
+ <member><type>VkSharingMode</type> <name>imageSharingMode</name><comment>Sharing mode used for the presentation images</comment></member>
+ <member optional="true"><type>uint32_t</type> <name>queueFamilyIndexCount</name><comment>Number of queue families having access to the images in case of concurrent sharing mode</comment></member>
+ <member noautovalidity="true" len="queueFamilyIndexCount">const <type>uint32_t</type>* <name>pQueueFamilyIndices</name><comment>Array of queue family indices having access to the images in case of concurrent sharing mode</comment></member>
+ <member><type>VkSurfaceTransformFlagBitsKHR</type> <name>preTransform</name><comment>The transform, relative to the device's natural orientation, applied to the image content prior to presentation</comment></member>
+ <member><type>VkCompositeAlphaFlagBitsKHR</type> <name>compositeAlpha</name><comment>The alpha blending mode used when compositing this surface with other surfaces in the window system</comment></member>
+ <member><type>VkPresentModeKHR</type> <name>presentMode</name><comment>Which presentation mode to use for presents on this swap chain</comment></member>
+ <member><type>VkBool32</type> <name>clipped</name><comment>Specifies whether presentable images may be affected by window clip regions</comment></member>
+ <member optional="true"><type>VkSwapchainKHR</type> <name>oldSwapchain</name><comment>Existing swap chain to replace, if any</comment></member>
</type>
<type category="struct" name="VkPresentInfoKHR">
<member values="VK_STRUCTURE_TYPE_PRESENT_INFO_KHR"><type>VkStructureType</type> <name>sType</name></member>
- <member validextensionstructs="VkDisplayPresentInfoKHR">const <type>void</type>* <name>pNext</name></member> <!-- Pointer to next structure -->
- <member optional="true"><type>uint32_t</type> <name>waitSemaphoreCount</name></member> <!-- Number of semaphores to wait for before presenting -->
- <member optional="true" len="waitSemaphoreCount">const <type>VkSemaphore</type>* <name>pWaitSemaphores</name></member> <!-- Semaphores to wait for before presenting -->
- <member><type>uint32_t</type> <name>swapchainCount</name></member> <!-- Number of swap chains to present in this call -->
- <member len="swapchainCount">const <type>VkSwapchainKHR</type>* <name>pSwapchains</name></member> <!-- Swapchains to present an image from -->
- <member len="swapchainCount">const <type>uint32_t</type>* <name>pImageIndices</name></member> <!-- Indices of which swapchain images to present -->
- <member optional="true" len="swapchainCount"><type>VkResult</type>* <name>pResults</name></member> <!-- Optional (i.e. if non-NULL) VkResult for each swapchain -->
- </type>
- <type category="struct" name="VkDebugReportCallbackCreateInfoEXT">
+ <member optional="true">const <type>void</type>* <name>pNext</name></member>
+ <member optional="true"><type>uint32_t</type> <name>waitSemaphoreCount</name><comment>Number of semaphores to wait for before presenting</comment></member>
+ <member len="waitSemaphoreCount">const <type>VkSemaphore</type>* <name>pWaitSemaphores</name><comment>Semaphores to wait for before presenting</comment></member>
+ <member><type>uint32_t</type> <name>swapchainCount</name><comment>Number of swapchains to present in this call</comment></member>
+ <member len="swapchainCount">const <type>VkSwapchainKHR</type>* <name>pSwapchains</name><comment>Swapchains to present an image from</comment></member>
+ <member len="swapchainCount">const <type>uint32_t</type>* <name>pImageIndices</name><comment>Indices of which presentable images to present</comment></member>
+ <member optional="true" len="swapchainCount"><type>VkResult</type>* <name>pResults</name><comment>Optional (i.e. if non-NULL) VkResult for each swapchain</comment></member>
+ </type>
+ <type category="struct" name="VkDebugReportCallbackCreateInfoEXT" structextends="VkInstanceCreateInfo">
<member values="VK_STRUCTURE_TYPE_DEBUG_REPORT_CALLBACK_CREATE_INFO_EXT"><type>VkStructureType</type> <name>sType</name></member>
- <member>const <type>void</type>* <name>pNext</name></member> <!-- Pointer to next structure -->
- <member><type>VkDebugReportFlagsEXT</type> <name>flags</name></member> <!-- Indicates which events call this callback-->
- <member><type>PFN_vkDebugReportCallbackEXT</type> <name>pfnCallback</name></member> <!-- Function pointer of a callback function-->
- <member optional="true"><type>void</type>* <name>pUserData</name></member> <!-- User data provided to callback function -->
- </type>
- <type category="struct" name="VkValidationFlagsEXT">
- <member><type>VkStructureType</type> <name>sType</name></member> <!-- Must be VK_STRUCTURE_TYPE_VALIDATION_FLAGS_EXT -->
- <member>const <type>void</type>* <name>pNext</name></member> <!-- Pointer to next structure -->
- <member><type>uint32_t</type> <name>disabledValidationCheckCount</name></member> <!-- Number of validation checks to disable -->
- <member len="disabledValidationCheckCount"><type>VkValidationCheckEXT</type>* <name>pDisabledValidationChecks</name></member> <!-- Validation checks to disable -->
- </type>
- <type category="struct" name="VkPipelineRasterizationStateRasterizationOrderAMD">
+ <member optional="true">const <type>void</type>* <name>pNext</name></member>
+ <member optional="true"><type>VkDebugReportFlagsEXT</type> <name>flags</name><comment>Indicates which events call this callback</comment></member>
+ <member><type>PFN_vkDebugReportCallbackEXT</type> <name>pfnCallback</name><comment>Function pointer of a callback function</comment></member>
+ <member optional="true"><type>void</type>* <name>pUserData</name><comment>User data provided to callback function</comment></member>
+ </type>
+ <type category="struct" name="VkValidationFlagsEXT" structextends="VkInstanceCreateInfo">
+ <member values="VK_STRUCTURE_TYPE_VALIDATION_FLAGS_EXT"><type>VkStructureType</type> <name>sType</name><comment>Must be VK_STRUCTURE_TYPE_VALIDATION_FLAGS_EXT</comment></member>
+ <member optional="true">const <type>void</type>* <name>pNext</name></member>
+ <member><type>uint32_t</type> <name>disabledValidationCheckCount</name><comment>Number of validation checks to disable</comment></member>
+ <member len="disabledValidationCheckCount">const <type>VkValidationCheckEXT</type>* <name>pDisabledValidationChecks</name><comment>Validation checks to disable</comment></member>
+ </type>
+ <type category="struct" name="VkValidationFeaturesEXT" structextends="VkInstanceCreateInfo">
+ <member values="VK_STRUCTURE_TYPE_VALIDATION_FEATURES_EXT"><type>VkStructureType</type> <name>sType</name><comment>Must be VK_STRUCTURE_TYPE_VALIDATION_FEATURES_EXT</comment></member>
+ <member optional="true">const <type>void</type>* <name>pNext</name></member>
+ <member optional="true"><type>uint32_t</type> <name>enabledValidationFeatureCount</name><comment>Number of validation features to enable</comment></member>
+ <member len="enabledValidationFeatureCount">const <type>VkValidationFeatureEnableEXT</type>* <name>pEnabledValidationFeatures</name><comment>Validation features to enable</comment></member>
+ <member optional="true"><type>uint32_t</type> <name>disabledValidationFeatureCount</name><comment>Number of validation features to disable</comment></member>
+ <member len="disabledValidationFeatureCount">const <type>VkValidationFeatureDisableEXT</type>* <name>pDisabledValidationFeatures</name><comment>Validation features to disable</comment></member>
+ </type>
+ <type category="struct" name="VkPipelineRasterizationStateRasterizationOrderAMD" structextends="VkPipelineRasterizationStateCreateInfo">
<member values="VK_STRUCTURE_TYPE_PIPELINE_RASTERIZATION_STATE_RASTERIZATION_ORDER_AMD"><type>VkStructureType</type> <name>sType</name></member>
- <member>const <type>void</type>* <name>pNext</name></member> <!-- Pointer to next structure -->
- <member><type>VkRasterizationOrderAMD</type> <name>rasterizationOrder</name></member> <!-- Rasterization order to use for the pipeline -->
+ <member optional="true">const <type>void</type>* <name>pNext</name></member>
+ <member><type>VkRasterizationOrderAMD</type> <name>rasterizationOrder</name><comment>Rasterization order to use for the pipeline</comment></member>
</type>
<type category="struct" name="VkDebugMarkerObjectNameInfoEXT">
<member values="VK_STRUCTURE_TYPE_DEBUG_MARKER_OBJECT_NAME_INFO_EXT"><type>VkStructureType</type> <name>sType</name></member>
- <member>const <type>void</type>* <name>pNext</name></member> <!-- Pointer to next structure -->
- <member><type>VkDebugReportObjectTypeEXT</type> <name>objectType</name></member> <!-- The type of the object -->
- <member><type>uint64_t</type> <name>object</name></member> <!-- The handle of the object, cast to uint64_t -->
- <member len="null-terminated">const <type>char</type>* <name>pObjectName</name></member> <!-- Name to apply to the object -->
+ <member optional="true">const <type>void</type>* <name>pNext</name></member>
+ <member><type>VkDebugReportObjectTypeEXT</type> <name>objectType</name><comment>The type of the object</comment></member>
+ <member objecttype="objectType"><type>uint64_t</type> <name>object</name><comment>The handle of the object, cast to uint64_t</comment></member>
+ <member len="null-terminated">const <type>char</type>* <name>pObjectName</name><comment>Name to apply to the object</comment></member>
</type>
<type category="struct" name="VkDebugMarkerObjectTagInfoEXT">
<member values="VK_STRUCTURE_TYPE_DEBUG_MARKER_OBJECT_TAG_INFO_EXT"><type>VkStructureType</type> <name>sType</name></member>
- <member>const <type>void</type>* <name>pNext</name></member> <!-- Pointer to next structure -->
- <member><type>VkDebugReportObjectTypeEXT</type> <name>objectType</name></member> <!-- The type of the object -->
- <member><type>uint64_t</type> <name>object</name></member> <!-- The handle of the object, cast to uint64_t -->
- <member><type>uint64_t</type> <name>tagName</name></member> <!-- The name of the tag to set on the object -->
- <member><type>size_t</type> <name>tagSize</name></member> <!-- The length in bytes of the tag data -->
- <member len="tagSize">const <type>void</type>* <name>pTag</name></member> <!-- Tag data to attach to the object -->
+ <member optional="true">const <type>void</type>* <name>pNext</name></member>
+ <member><type>VkDebugReportObjectTypeEXT</type> <name>objectType</name><comment>The type of the object</comment></member>
+ <member objecttype="objectType"><type>uint64_t</type> <name>object</name><comment>The handle of the object, cast to uint64_t</comment></member>
+ <member><type>uint64_t</type> <name>tagName</name><comment>The name of the tag to set on the object</comment></member>
+ <member><type>size_t</type> <name>tagSize</name><comment>The length in bytes of the tag data</comment></member>
+ <member len="tagSize">const <type>void</type>* <name>pTag</name><comment>Tag data to attach to the object</comment></member>
</type>
<type category="struct" name="VkDebugMarkerMarkerInfoEXT">
<member values="VK_STRUCTURE_TYPE_DEBUG_MARKER_MARKER_INFO_EXT"><type>VkStructureType</type> <name>sType</name></member>
- <member>const <type>void</type>* <name>pNext</name></member> <!-- Pointer to next structure -->
- <member len="null-terminated">const <type>char</type>* <name>pMarkerName</name></member> <!-- Name of the debug marker -->
- <member optional="true"><type>float</type> <name>color</name>[4]</member> <!-- Optional color for debug marker -->
+ <member optional="true">const <type>void</type>* <name>pNext</name></member>
+ <member len="null-terminated">const <type>char</type>* <name>pMarkerName</name><comment>Name of the debug marker</comment></member>
+ <member><type>float</type> <name>color</name>[4]<comment>Optional color for debug marker</comment></member>
</type>
- <type category="struct" name="VkDedicatedAllocationImageCreateInfoNV">
+ <type category="struct" name="VkDedicatedAllocationImageCreateInfoNV" structextends="VkImageCreateInfo">
<member values="VK_STRUCTURE_TYPE_DEDICATED_ALLOCATION_IMAGE_CREATE_INFO_NV"><type>VkStructureType</type> <name>sType</name></member>
- <member>const <type>void</type>* <name>pNext</name></member> <!-- Pointer to next structure -->
- <member><type>VkBool32</type> <name>dedicatedAllocation</name></member> <!-- Whether this image uses a dedicated allocation -->
+ <member optional="true">const <type>void</type>* <name>pNext</name></member>
+ <member><type>VkBool32</type> <name>dedicatedAllocation</name><comment>Whether this image uses a dedicated allocation</comment></member>
</type>
- <type category="struct" name="VkDedicatedAllocationBufferCreateInfoNV">
+ <type category="struct" name="VkDedicatedAllocationBufferCreateInfoNV" structextends="VkBufferCreateInfo">
<member values="VK_STRUCTURE_TYPE_DEDICATED_ALLOCATION_BUFFER_CREATE_INFO_NV"><type>VkStructureType</type> <name>sType</name></member>
- <member>const <type>void</type>* <name>pNext</name></member> <!-- Pointer to next structure -->
- <member><type>VkBool32</type> <name>dedicatedAllocation</name></member> <!-- Whether this buffer uses a dedicated allocation -->
+ <member optional="true">const <type>void</type>* <name>pNext</name></member>
+ <member><type>VkBool32</type> <name>dedicatedAllocation</name><comment>Whether this buffer uses a dedicated allocation</comment></member>
</type>
- <type category="struct" name="VkDedicatedAllocationMemoryAllocateInfoNV">
+ <type category="struct" name="VkDedicatedAllocationMemoryAllocateInfoNV" structextends="VkMemoryAllocateInfo">
<member values="VK_STRUCTURE_TYPE_DEDICATED_ALLOCATION_MEMORY_ALLOCATE_INFO_NV"><type>VkStructureType</type> <name>sType</name></member>
- <member>const <type>void</type>* <name>pNext</name></member> <!-- Pointer to next structure -->
- <member optional="true"><type>VkImage</type> <name>image</name></member> <!-- Image that this allocation will be bound to -->
- <member optional="true"><type>VkBuffer</type> <name>buffer</name></member> <!-- Buffer that this allocation will be bound to -->
+ <member optional="true">const <type>void</type>* <name>pNext</name></member>
+ <member optional="true"><type>VkImage</type> <name>image</name><comment>Image that this allocation will be bound to</comment></member>
+ <member optional="true"><type>VkBuffer</type> <name>buffer</name><comment>Buffer that this allocation will be bound to</comment></member>
</type>
<type category="struct" name="VkExternalImageFormatPropertiesNV" returnedonly="true">
<member><type>VkImageFormatProperties</type> <name>imageFormatProperties</name></member>
@@ -1603,31 +2108,31 @@ maintained in the master branch of the Khronos Vulkan GitHub project.
<member optional="true"><type>VkExternalMemoryHandleTypeFlagsNV</type> <name>exportFromImportedHandleTypes</name></member>
<member optional="true"><type>VkExternalMemoryHandleTypeFlagsNV</type> <name>compatibleHandleTypes</name></member>
</type>
- <type category="struct" name="VkExternalMemoryImageCreateInfoNV">
+ <type category="struct" name="VkExternalMemoryImageCreateInfoNV" structextends="VkImageCreateInfo">
<member values="VK_STRUCTURE_TYPE_EXTERNAL_MEMORY_IMAGE_CREATE_INFO_NV"><type>VkStructureType</type> <name>sType</name></member>
- <member>const <type>void</type>* <name>pNext</name></member>
+ <member optional="true">const <type>void</type>* <name>pNext</name></member>
<member optional="true"><type>VkExternalMemoryHandleTypeFlagsNV</type> <name>handleTypes</name></member>
</type>
- <type category="struct" name="VkExportMemoryAllocateInfoNV">
+ <type category="struct" name="VkExportMemoryAllocateInfoNV" structextends="VkMemoryAllocateInfo">
<member values="VK_STRUCTURE_TYPE_EXPORT_MEMORY_ALLOCATE_INFO_NV"><type>VkStructureType</type> <name>sType</name></member>
- <member>const <type>void</type>* <name>pNext</name></member>
+ <member optional="true">const <type>void</type>* <name>pNext</name></member>
<member optional="true"><type>VkExternalMemoryHandleTypeFlagsNV</type> <name>handleTypes</name></member>
</type>
- <type category="struct" name="VkImportMemoryWin32HandleInfoNV">
+ <type category="struct" name="VkImportMemoryWin32HandleInfoNV" structextends="VkMemoryAllocateInfo">
<member values="VK_STRUCTURE_TYPE_IMPORT_MEMORY_WIN32_HANDLE_INFO_NV"><type>VkStructureType</type> <name>sType</name></member>
- <member>const <type>void</type>* <name>pNext</name></member>
+ <member optional="true">const <type>void</type>* <name>pNext</name></member>
<member optional="true"><type>VkExternalMemoryHandleTypeFlagsNV</type> <name>handleType</name></member>
<member optional="true"><type>HANDLE</type> <name>handle</name></member>
</type>
- <type category="struct" name="VkExportMemoryWin32HandleInfoNV">
+ <type category="struct" name="VkExportMemoryWin32HandleInfoNV" structextends="VkMemoryAllocateInfo">
<member values="VK_STRUCTURE_TYPE_EXPORT_MEMORY_WIN32_HANDLE_INFO_NV"><type>VkStructureType</type> <name>sType</name></member>
- <member>const <type>void</type>* <name>pNext</name></member>
+ <member optional="true">const <type>void</type>* <name>pNext</name></member>
<member optional="true">const <type>SECURITY_ATTRIBUTES</type>* <name>pAttributes</name></member>
<member optional="true"><type>DWORD</type> <name>dwAccess</name></member>
</type>
- <type category="struct" name="VkWin32KeyedMutexAcquireReleaseInfoNV">
+ <type category="struct" name="VkWin32KeyedMutexAcquireReleaseInfoNV" structextends="VkSubmitInfo,VkSubmitInfo2">
<member values="VK_STRUCTURE_TYPE_WIN32_KEYED_MUTEX_ACQUIRE_RELEASE_INFO_NV"><type>VkStructureType</type> <name>sType</name></member>
- <member>const <type>void</type>* <name>pNext</name></member>
+ <member optional="true">const <type>void</type>* <name>pNext</name></member>
<member optional="true"><type>uint32_t</type> <name>acquireCount</name></member>
<member len="acquireCount">const <type>VkDeviceMemory</type>* <name>pAcquireSyncs</name></member>
<member len="acquireCount">const <type>uint64_t</type>* <name>pAcquireKeys</name></member>
@@ -1636,224 +2141,4999 @@ maintained in the master branch of the Khronos Vulkan GitHub project.
<member len="releaseCount">const <type>VkDeviceMemory</type>* <name>pReleaseSyncs</name></member>
<member len="releaseCount">const <type>uint64_t</type>* <name>pReleaseKeys</name></member>
</type>
-
- <type category="struct" name="VkDeviceGeneratedCommandsFeaturesNVX">
- <member values="VK_STRUCTURE_TYPE_DEVICE_GENERATED_COMMANDS_FEATURES_NVX"><type>VkStructureType</type> <name>sType</name></member>
- <member>const <type>void</type>* <name>pNext</name></member>
- <member><type>VkBool32</type> <name>computeBindingPointSupport</name></member>
- </type>
- <type category="struct" name="VkDeviceGeneratedCommandsLimitsNVX">
- <member values="VK_STRUCTURE_TYPE_DEVICE_GENERATED_COMMANDS_LIMITS_NVX"><type>VkStructureType</type> <name>sType</name></member>
- <member>const <type>void</type>* <name>pNext</name></member>
- <member><type>uint32_t</type> <name>maxIndirectCommandsLayoutTokenCount</name></member>
- <member><type>uint32_t</type> <name>maxObjectEntryCounts</name></member>
- <member><type>uint32_t</type> <name>minSequenceCountBufferOffsetAlignment</name></member>
- <member><type>uint32_t</type> <name>minSequenceIndexBufferOffsetAlignment</name></member>
- <member><type>uint32_t</type> <name>minCommandsTokenBufferOffsetAlignment</name></member>
- </type>
- <type category="struct" name="VkIndirectCommandsTokenNVX">
- <member><type>VkIndirectCommandsTokenTypeNVX</type> <name>tokenType</name></member>
- <member><type>VkBuffer</type> <name>buffer</name></member> <!-- buffer containing tableEntries and additional data for indirectCommands -->
- <member><type>VkDeviceSize</type> <name>offset</name></member> <!-- offset from the base address of the buffer -->
- </type>
- <type category="struct" name="VkIndirectCommandsLayoutTokenNVX">
- <member><type>VkIndirectCommandsTokenTypeNVX</type> <name>tokenType</name></member>
- <member><type>uint32_t</type> <name>bindingUnit</name></member> <!-- Binding unit for vertex attribute / descriptor set, offset for pushconstants -->
- <member><type>uint32_t</type> <name>dynamicCount</name></member> <!-- Number of variable dynamic values for descriptor set / push constants -->
- <member><type>uint32_t</type> <name>divisor</name></member> <!-- Rate the which the array is advanced per element (must be power of 2, minimum 1) -->
- </type>
- <type category="struct" name="VkIndirectCommandsLayoutCreateInfoNVX">
- <member values="VK_STRUCTURE_TYPE_INDIRECT_COMMANDS_LAYOUT_CREATE_INFO_NVX"><type>VkStructureType</type> <name>sType</name></member>
- <member>const <type>void</type>* <name>pNext</name></member>
- <member><type>VkPipelineBindPoint</type> <name>pipelineBindPoint</name></member>
- <member><type>VkIndirectCommandsLayoutUsageFlagsNVX</type> <name>flags</name></member>
- <member><type>uint32_t</type> <name>tokenCount</name></member>
- <member len="tokenCount">const <type>VkIndirectCommandsLayoutTokenNVX</type>* <name>pTokens</name></member>
- </type>
- <type category="struct" name="VkCmdProcessCommandsInfoNVX">
- <member values="VK_STRUCTURE_TYPE_CMD_PROCESS_COMMANDS_INFO_NVX"><type>VkStructureType</type> <name>sType</name></member>
- <member>const <type>void</type>* <name>pNext</name></member>
- <member externsync="true"><type>VkObjectTableNVX</type> <name>objectTable</name></member>
- <member><type>VkIndirectCommandsLayoutNVX</type> <name>indirectCommandsLayout</name></member>
- <member><type>uint32_t</type> <name>indirectCommandsTokenCount</name></member>
- <member len="indirectCommandsTokenCount">const <type>VkIndirectCommandsTokenNVX</type>* <name>pIndirectCommandsTokens</name></member>
- <member><type>uint32_t</type> <name>maxSequencesCount</name></member>
- <member optional="true" externsync="true"><type>VkCommandBuffer</type> <name>targetCommandBuffer</name></member>
- <member optional="true"><type>VkBuffer</type> <name>sequencesCountBuffer</name></member>
- <member optional="true"><type>VkDeviceSize</type> <name>sequencesCountOffset</name></member>
- <member optional="true"><type>VkBuffer</type> <name>sequencesIndexBuffer</name></member>
- <member optional="true"><type>VkDeviceSize</type> <name>sequencesIndexOffset</name></member>
- </type>
- <type category="struct" name="VkCmdReserveSpaceForCommandsInfoNVX">
- <member values="VK_STRUCTURE_TYPE_CMD_RESERVE_SPACE_FOR_COMMANDS_INFO_NVX"><type>VkStructureType</type> <name>sType</name></member>
- <member>const <type>void</type>* <name>pNext</name></member>
- <member externsync="true"><type>VkObjectTableNVX</type> <name>objectTable</name></member>
- <member><type>VkIndirectCommandsLayoutNVX</type> <name>indirectCommandsLayout</name></member>
- <member><type>uint32_t</type> <name>maxSequencesCount</name></member>
- </type>
- <type category="struct" name="VkObjectTableCreateInfoNVX">
- <member values="VK_STRUCTURE_TYPE_OBJECT_TABLE_CREATE_INFO_NVX"><type>VkStructureType</type> <name>sType</name></member>
- <member>const <type>void</type>* <name>pNext</name></member>
- <member><type>uint32_t</type> <name>objectCount</name></member>
- <member len="objectCount">const <type>VkObjectEntryTypeNVX</type>* <name>pObjectEntryTypes</name></member>
- <member len="objectCount">const <type>uint32_t</type>* <name>pObjectEntryCounts</name></member>
- <member len="objectCount">const <type>VkObjectEntryUsageFlagsNVX</type>* <name>pObjectEntryUsageFlags</name></member>
-
- <member><type>uint32_t</type> <name>maxUniformBuffersPerDescriptor</name></member>
- <member><type>uint32_t</type> <name>maxStorageBuffersPerDescriptor</name></member>
- <member><type>uint32_t</type> <name>maxStorageImagesPerDescriptor</name></member>
- <member><type>uint32_t</type> <name>maxSampledImagesPerDescriptor</name></member>
- <member><type>uint32_t</type> <name>maxPipelineLayouts</name></member>
- </type>
- <type category="struct" name="VkObjectTableEntryNVX">
- <member><type>VkObjectEntryTypeNVX</type> <name>type</name></member>
- <member><type>VkObjectEntryUsageFlagsNVX</type> <name>flags</name></member>
- </type>
- <type category="struct" name="VkObjectTablePipelineEntryNVX">
- <member><type>VkObjectEntryTypeNVX</type> <name>type</name></member>
- <member><type>VkObjectEntryUsageFlagsNVX</type> <name>flags</name></member>
- <member><type>VkPipeline</type> <name>pipeline</name></member>
- </type>
- <type category="struct" name="VkObjectTableDescriptorSetEntryNVX">
- <member><type>VkObjectEntryTypeNVX</type> <name>type</name></member>
- <member><type>VkObjectEntryUsageFlagsNVX</type> <name>flags</name></member>
- <member><type>VkPipelineLayout</type> <name>pipelineLayout</name></member>
- <member><type>VkDescriptorSet</type> <name>descriptorSet</name></member>
- </type>
- <type category="struct" name="VkObjectTableVertexBufferEntryNVX">
- <member><type>VkObjectEntryTypeNVX</type> <name>type</name></member>
- <member><type>VkObjectEntryUsageFlagsNVX</type> <name>flags</name></member>
- <member><type>VkBuffer</type> <name>buffer</name></member>
- </type>
- <type category="struct" name="VkObjectTableIndexBufferEntryNVX">
- <member><type>VkObjectEntryTypeNVX</type> <name>type</name></member>
- <member><type>VkObjectEntryUsageFlagsNVX</type> <name>flags</name></member>
- <member><type>VkBuffer</type> <name>buffer</name></member>
- <member><type>VkIndexType</type> <name>indexType</name></member>
- </type>
- <type category="struct" name="VkObjectTablePushConstantEntryNVX">
- <member><type>VkObjectEntryTypeNVX</type> <name>type</name></member>
- <member><type>VkObjectEntryUsageFlagsNVX</type> <name>flags</name></member>
- <member><type>VkPipelineLayout</type> <name>pipelineLayout</name></member>
- <member><type>VkShaderStageFlags</type> <name>stageFlags</name></member>
- </type>
- <type category="struct" name="VkPhysicalDeviceFeatures2KHR">
- <member values="VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_FEATURES_2_KHR"><type>VkStructureType</type> <name>sType</name></member>
- <member><type>void</type>* <name>pNext</name></member> <!-- Pointer to next structure -->
+ <type category="struct" name="VkPhysicalDeviceDeviceGeneratedCommandsFeaturesNV" structextends="VkPhysicalDeviceFeatures2,VkDeviceCreateInfo">
+ <member values="VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_DEVICE_GENERATED_COMMANDS_FEATURES_NV"><type>VkStructureType</type> <name>sType</name></member>
+ <member optional="true"><type>void</type>* <name>pNext</name></member>
+ <member><type>VkBool32</type> <name>deviceGeneratedCommands</name></member>
+ </type>
+ <type category="struct" name="VkDevicePrivateDataCreateInfo" allowduplicate="true" structextends="VkDeviceCreateInfo">
+ <member values="VK_STRUCTURE_TYPE_DEVICE_PRIVATE_DATA_CREATE_INFO"><type>VkStructureType</type> <name>sType</name></member>
+ <member optional="true">const <type>void</type>* <name>pNext</name></member>
+ <member><type>uint32_t</type> <name>privateDataSlotRequestCount</name></member>
+ </type>
+ <type category="struct" name="VkDevicePrivateDataCreateInfoEXT" alias="VkDevicePrivateDataCreateInfo"/>
+ <type category="struct" name="VkPrivateDataSlotCreateInfo">
+ <member values="VK_STRUCTURE_TYPE_PRIVATE_DATA_SLOT_CREATE_INFO"><type>VkStructureType</type> <name>sType</name></member>
+ <member optional="true">const <type>void</type>* <name>pNext</name></member>
+ <member><type>VkPrivateDataSlotCreateFlags</type> <name>flags</name></member>
+ </type>
+ <type category="struct" name="VkPrivateDataSlotCreateInfoEXT" alias="VkPrivateDataSlotCreateInfo"/>
+ <type category="struct" name="VkPhysicalDevicePrivateDataFeatures" structextends="VkPhysicalDeviceFeatures2,VkDeviceCreateInfo">
+ <member values="VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_PRIVATE_DATA_FEATURES"><type>VkStructureType</type> <name>sType</name></member>
+ <member optional="true"><type>void</type>* <name>pNext</name></member>
+ <member><type>VkBool32</type> <name>privateData</name></member>
+ </type>
+ <type category="struct" name="VkPhysicalDevicePrivateDataFeaturesEXT" alias="VkPhysicalDevicePrivateDataFeatures"/>
+ <type category="struct" name="VkPhysicalDeviceDeviceGeneratedCommandsPropertiesNV" structextends="VkPhysicalDeviceProperties2" returnedonly="true">
+ <member values="VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_DEVICE_GENERATED_COMMANDS_PROPERTIES_NV"><type>VkStructureType</type> <name>sType</name></member>
+ <member optional="true"><type>void</type>* <name>pNext</name></member>
+ <member limittype="max"><type>uint32_t</type> <name>maxGraphicsShaderGroupCount</name></member>
+ <member limittype="max"><type>uint32_t</type> <name>maxIndirectSequenceCount</name></member>
+ <member limittype="max"><type>uint32_t</type> <name>maxIndirectCommandsTokenCount</name></member>
+ <member limittype="max"><type>uint32_t</type> <name>maxIndirectCommandsStreamCount</name></member>
+ <member limittype="max"><type>uint32_t</type> <name>maxIndirectCommandsTokenOffset</name></member>
+ <member limittype="max"><type>uint32_t</type> <name>maxIndirectCommandsStreamStride</name></member>
+ <member limittype="min"><type>uint32_t</type> <name>minSequencesCountBufferOffsetAlignment</name></member>
+ <member limittype="min"><type>uint32_t</type> <name>minSequencesIndexBufferOffsetAlignment</name></member>
+ <member limittype="min"><type>uint32_t</type> <name>minIndirectCommandsBufferOffsetAlignment</name></member>
+ </type>
+ <type category="struct" name="VkPhysicalDeviceMultiDrawPropertiesEXT" structextends="VkPhysicalDeviceProperties2" returnedonly="true">
+ <member values="VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_MULTI_DRAW_PROPERTIES_EXT"><type>VkStructureType</type> <name>sType</name></member>
+ <member optional="true"><type>void</type>* <name>pNext</name></member>
+ <member limittype="max"><type>uint32_t</type> <name>maxMultiDrawCount</name></member>
+ </type>
+ <type category="struct" name="VkGraphicsShaderGroupCreateInfoNV">
+ <member values="VK_STRUCTURE_TYPE_GRAPHICS_SHADER_GROUP_CREATE_INFO_NV"><type>VkStructureType</type> <name>sType</name></member>
+ <member optional="true">const <type>void</type>* <name>pNext</name></member>
+ <member><type>uint32_t</type> <name>stageCount</name></member>
+ <member len="stageCount">const <type>VkPipelineShaderStageCreateInfo</type>* <name>pStages</name></member>
+ <member noautovalidity="true" optional="true">const <type>VkPipelineVertexInputStateCreateInfo</type>* <name>pVertexInputState</name></member>
+ <member noautovalidity="true" optional="true">const <type>VkPipelineTessellationStateCreateInfo</type>* <name>pTessellationState</name></member>
+ </type>
+ <type category="struct" name="VkGraphicsPipelineShaderGroupsCreateInfoNV" structextends="VkGraphicsPipelineCreateInfo">
+ <member values="VK_STRUCTURE_TYPE_GRAPHICS_PIPELINE_SHADER_GROUPS_CREATE_INFO_NV"><type>VkStructureType</type> <name>sType</name></member>
+ <member optional="true">const <type>void</type>* <name>pNext</name></member>
+ <member optional="true"><type>uint32_t</type> <name>groupCount</name></member>
+ <member len="groupCount">const <type>VkGraphicsShaderGroupCreateInfoNV</type>* <name>pGroups</name></member>
+ <member optional="true"><type>uint32_t</type> <name>pipelineCount</name></member>
+ <member len="pipelineCount">const <type>VkPipeline</type>* <name>pPipelines</name></member>
+ </type>
+ <type category="struct" name="VkBindShaderGroupIndirectCommandNV">
+ <member><type>uint32_t</type> <name>groupIndex</name></member>
+ </type>
+ <type category="struct" name="VkBindIndexBufferIndirectCommandNV">
+ <member><type>VkDeviceAddress</type> <name>bufferAddress</name></member>
+ <member><type>uint32_t</type> <name>size</name></member>
+ <member><type>VkIndexType</type> <name>indexType</name></member>
+ </type>
+ <type category="struct" name="VkBindVertexBufferIndirectCommandNV">
+ <member><type>VkDeviceAddress</type> <name>bufferAddress</name></member>
+ <member><type>uint32_t</type> <name>size</name></member>
+ <member><type>uint32_t</type> <name>stride</name></member>
+ </type>
+ <type category="struct" name="VkSetStateFlagsIndirectCommandNV">
+ <member><type>uint32_t</type> <name>data</name></member>
+ </type>
+ <type category="struct" name="VkIndirectCommandsStreamNV">
+ <member><type>VkBuffer</type> <name>buffer</name></member>
+ <member><type>VkDeviceSize</type> <name>offset</name></member>
+ </type>
+ <type category="struct" name="VkIndirectCommandsLayoutTokenNV">
+ <member values="VK_STRUCTURE_TYPE_INDIRECT_COMMANDS_LAYOUT_TOKEN_NV"><type>VkStructureType</type> <name>sType</name></member>
+ <member optional="true">const <type>void</type>* <name>pNext</name></member>
+ <member><type>VkIndirectCommandsTokenTypeNV</type> <name>tokenType</name></member>
+ <member><type>uint32_t</type> <name>stream</name></member>
+ <member><type>uint32_t</type> <name>offset</name></member>
+ <member><type>uint32_t</type> <name>vertexBindingUnit</name></member>
+ <member><type>VkBool32</type> <name>vertexDynamicStride</name></member>
+ <member optional="true"><type>VkPipelineLayout</type> <name>pushconstantPipelineLayout</name></member>
+ <member optional="true"><type>VkShaderStageFlags</type> <name>pushconstantShaderStageFlags</name></member>
+ <member><type>uint32_t</type> <name>pushconstantOffset</name></member>
+ <member><type>uint32_t</type> <name>pushconstantSize</name></member>
+ <member optional="true"><type>VkIndirectStateFlagsNV</type> <name>indirectStateFlags</name></member>
+ <member optional="true"><type>uint32_t</type> <name>indexTypeCount</name></member>
+ <member len="indexTypeCount">const <type>VkIndexType</type>* <name>pIndexTypes</name></member>
+ <member len="indexTypeCount">const <type>uint32_t</type>* <name>pIndexTypeValues</name></member>
+ </type>
+ <type category="struct" name="VkIndirectCommandsLayoutCreateInfoNV">
+ <member values="VK_STRUCTURE_TYPE_INDIRECT_COMMANDS_LAYOUT_CREATE_INFO_NV"><type>VkStructureType</type> <name>sType</name></member>
+ <member optional="true">const <type>void</type>* <name>pNext</name></member>
+ <member optional="true"><type>VkIndirectCommandsLayoutUsageFlagsNV</type> <name>flags</name></member>
+ <member><type>VkPipelineBindPoint</type> <name>pipelineBindPoint</name></member>
+ <member><type>uint32_t</type> <name>tokenCount</name></member>
+ <member len="tokenCount">const <type>VkIndirectCommandsLayoutTokenNV</type>* <name>pTokens</name></member>
+ <member><type>uint32_t</type> <name>streamCount</name></member>
+ <member len="streamCount">const <type>uint32_t</type>* <name>pStreamStrides</name></member>
+ </type>
+ <type category="struct" name="VkGeneratedCommandsInfoNV">
+ <member values="VK_STRUCTURE_TYPE_GENERATED_COMMANDS_INFO_NV"><type>VkStructureType</type> <name>sType</name></member>
+ <member optional="true">const <type>void</type>* <name>pNext</name></member>
+ <member><type>VkPipelineBindPoint</type> <name>pipelineBindPoint</name></member>
+ <member><type>VkPipeline</type> <name>pipeline</name></member>
+ <member><type>VkIndirectCommandsLayoutNV</type> <name>indirectCommandsLayout</name></member>
+ <member><type>uint32_t</type> <name>streamCount</name></member>
+ <member len="streamCount">const <type>VkIndirectCommandsStreamNV</type>* <name>pStreams</name></member>
+ <member><type>uint32_t</type> <name>sequencesCount</name></member>
+ <member><type>VkBuffer</type> <name>preprocessBuffer</name></member>
+ <member><type>VkDeviceSize</type> <name>preprocessOffset</name></member>
+ <member><type>VkDeviceSize</type> <name>preprocessSize</name></member>
+ <member optional="true"><type>VkBuffer</type> <name>sequencesCountBuffer</name></member>
+ <member><type>VkDeviceSize</type> <name>sequencesCountOffset</name></member>
+ <member optional="true"><type>VkBuffer</type> <name>sequencesIndexBuffer</name></member>
+ <member><type>VkDeviceSize</type> <name>sequencesIndexOffset</name></member>
+ </type>
+ <type category="struct" name="VkGeneratedCommandsMemoryRequirementsInfoNV">
+ <member values="VK_STRUCTURE_TYPE_GENERATED_COMMANDS_MEMORY_REQUIREMENTS_INFO_NV"><type>VkStructureType</type> <name>sType</name></member>
+ <member optional="true">const <type>void</type>* <name>pNext</name></member>
+ <member><type>VkPipelineBindPoint</type> <name>pipelineBindPoint</name></member>
+ <member><type>VkPipeline</type> <name>pipeline</name></member>
+ <member><type>VkIndirectCommandsLayoutNV</type> <name>indirectCommandsLayout</name></member>
+ <member><type>uint32_t</type> <name>maxSequencesCount</name></member>
+ </type>
+ <type category="struct" name="VkPhysicalDeviceFeatures2" structextends="VkDeviceCreateInfo">
+ <member values="VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_FEATURES_2"><type>VkStructureType</type> <name>sType</name></member>
+ <member optional="true"><type>void</type>* <name>pNext</name></member>
<member><type>VkPhysicalDeviceFeatures</type> <name>features</name></member>
</type>
- <type category="struct" name="VkPhysicalDeviceProperties2KHR" returnedonly="true">
- <member values="VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_PROPERTIES_2_KHR"><type>VkStructureType</type> <name>sType</name></member>
- <member><type>void</type>* <name>pNext</name></member> <!-- Pointer to next structure -->
- <member><type>VkPhysicalDeviceProperties</type> <name>properties</name></member>
+ <type category="struct" name="VkPhysicalDeviceFeatures2KHR" alias="VkPhysicalDeviceFeatures2"/>
+ <type category="struct" name="VkPhysicalDeviceProperties2" returnedonly="true">
+ <member values="VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_PROPERTIES_2"><type>VkStructureType</type> <name>sType</name></member>
+ <member optional="true"><type>void</type>* <name>pNext</name></member>
+ <member limittype="struct"><type>VkPhysicalDeviceProperties</type> <name>properties</name></member>
</type>
- <type category="struct" name="VkFormatProperties2KHR" returnedonly="true">
- <member values="VK_STRUCTURE_TYPE_FORMAT_PROPERTIES_2_KHR"><type>VkStructureType</type> <name>sType</name></member>
- <member><type>void</type>* <name>pNext</name></member> <!-- Pointer to next structure -->
+ <type category="struct" name="VkPhysicalDeviceProperties2KHR" alias="VkPhysicalDeviceProperties2"/>
+ <type category="struct" name="VkFormatProperties2" returnedonly="true">
+ <member values="VK_STRUCTURE_TYPE_FORMAT_PROPERTIES_2"><type>VkStructureType</type> <name>sType</name></member>
+ <member optional="true"><type>void</type>* <name>pNext</name></member>
<member><type>VkFormatProperties</type> <name>formatProperties</name></member>
</type>
- <type category="struct" name="VkImageFormatProperties2KHR" returnedonly="true">
- <member values="VK_STRUCTURE_TYPE_IMAGE_FORMAT_PROPERTIES_2_KHR"><type>VkStructureType</type> <name>sType</name></member>
- <member><type>void</type>* <name>pNext</name></member> <!-- Pointer to next structure -->
+ <type category="struct" name="VkFormatProperties2KHR" alias="VkFormatProperties2"/>
+ <type category="struct" name="VkImageFormatProperties2" returnedonly="true">
+ <member values="VK_STRUCTURE_TYPE_IMAGE_FORMAT_PROPERTIES_2"><type>VkStructureType</type> <name>sType</name></member>
+ <member optional="true"><type>void</type>* <name>pNext</name></member>
<member><type>VkImageFormatProperties</type> <name>imageFormatProperties</name></member>
</type>
- <type category="struct" name="VkPhysicalDeviceImageFormatInfo2KHR">
- <member values="VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_IMAGE_FORMAT_INFO_2_KHR"><type>VkStructureType</type> <name>sType</name></member>
- <member>const <type>void</type>* <name>pNext</name></member> <!-- Pointer to next structure -->
+ <type category="struct" name="VkImageFormatProperties2KHR" alias="VkImageFormatProperties2"/>
+ <type category="struct" name="VkPhysicalDeviceImageFormatInfo2">
+ <member values="VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_IMAGE_FORMAT_INFO_2"><type>VkStructureType</type> <name>sType</name></member>
+ <member optional="true">const <type>void</type>* <name>pNext</name></member>
<member><type>VkFormat</type> <name>format</name></member>
<member><type>VkImageType</type> <name>type</name></member>
<member><type>VkImageTiling</type> <name>tiling</name></member>
<member><type>VkImageUsageFlags</type> <name>usage</name></member>
<member optional="true"><type>VkImageCreateFlags</type> <name>flags</name></member>
</type>
- <type category="struct" name="VkQueueFamilyProperties2KHR" returnedonly="true">
- <member values="VK_STRUCTURE_TYPE_QUEUE_FAMILY_PROPERTIES_2_KHR"><type>VkStructureType</type> <name>sType</name></member>
- <member><type>void</type>* <name>pNext</name></member> <!-- Pointer to next structure -->
- <member><type>VkQueueFamilyProperties</type> <name>queueFamilyProperties</name></member>
+ <type category="struct" name="VkPhysicalDeviceImageFormatInfo2KHR" alias="VkPhysicalDeviceImageFormatInfo2"/>
+ <type category="struct" name="VkQueueFamilyProperties2" returnedonly="true">
+ <member values="VK_STRUCTURE_TYPE_QUEUE_FAMILY_PROPERTIES_2"><type>VkStructureType</type> <name>sType</name></member>
+ <member optional="true"><type>void</type>* <name>pNext</name></member>
+ <member limittype="struct"><type>VkQueueFamilyProperties</type> <name>queueFamilyProperties</name></member>
</type>
- <type category="struct" name="VkPhysicalDeviceMemoryProperties2KHR" returnedonly="true">
- <member values="VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_MEMORY_PROPERTIES_2_KHR"><type>VkStructureType</type> <name>sType</name></member>
- <member><type>void</type>* <name>pNext</name></member> <!-- Pointer to next structure -->
+ <type category="struct" name="VkQueueFamilyProperties2KHR" alias="VkQueueFamilyProperties2"/>
+ <type category="struct" name="VkPhysicalDeviceMemoryProperties2" returnedonly="true">
+ <member values="VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_MEMORY_PROPERTIES_2"><type>VkStructureType</type> <name>sType</name></member>
+ <member optional="true"><type>void</type>* <name>pNext</name></member>
<member><type>VkPhysicalDeviceMemoryProperties</type> <name>memoryProperties</name></member>
</type>
- <type category="struct" name="VkSparseImageFormatProperties2KHR" returnedonly="true">
- <member values="VK_STRUCTURE_TYPE_SPARSE_IMAGE_FORMAT_PROPERTIES_2_KHR"><type>VkStructureType</type> <name>sType</name></member>
- <member><type>void</type>* <name>pNext</name></member> <!-- Pointer to next structure -->
- <member><type>VkSparseImageFormatProperties</type> <name>properties</name></member>
+ <type category="struct" name="VkPhysicalDeviceMemoryProperties2KHR" alias="VkPhysicalDeviceMemoryProperties2"/>
+ <type category="struct" name="VkSparseImageFormatProperties2" returnedonly="true">
+ <member values="VK_STRUCTURE_TYPE_SPARSE_IMAGE_FORMAT_PROPERTIES_2"><type>VkStructureType</type> <name>sType</name></member>
+ <member optional="true"><type>void</type>* <name>pNext</name></member>
+ <member limittype="struct"><type>VkSparseImageFormatProperties</type> <name>properties</name></member>
</type>
- <type category="struct" name="VkPhysicalDeviceSparseImageFormatInfo2KHR">
- <member values="VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_SPARSE_IMAGE_FORMAT_INFO_2_KHR"><type>VkStructureType</type> <name>sType</name></member>
- <member>const <type>void</type>* <name>pNext</name></member> <!-- Pointer to next structure -->
+ <type category="struct" name="VkSparseImageFormatProperties2KHR" alias="VkSparseImageFormatProperties2"/>
+ <type category="struct" name="VkPhysicalDeviceSparseImageFormatInfo2">
+ <member values="VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_SPARSE_IMAGE_FORMAT_INFO_2"><type>VkStructureType</type> <name>sType</name></member>
+ <member optional="true">const <type>void</type>* <name>pNext</name></member>
<member><type>VkFormat</type> <name>format</name></member>
<member><type>VkImageType</type> <name>type</name></member>
<member><type>VkSampleCountFlagBits</type> <name>samples</name></member>
<member><type>VkImageUsageFlags</type> <name>usage</name></member>
<member><type>VkImageTiling</type> <name>tiling</name></member>
</type>
+ <type category="struct" name="VkPhysicalDeviceSparseImageFormatInfo2KHR" alias="VkPhysicalDeviceSparseImageFormatInfo2"/>
+ <type category="struct" name="VkPhysicalDevicePushDescriptorPropertiesKHR" returnedonly="true" structextends="VkPhysicalDeviceProperties2">
+ <member values="VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_PUSH_DESCRIPTOR_PROPERTIES_KHR"><type>VkStructureType</type> <name>sType</name></member>
+ <member optional="true"><type>void</type>* <name>pNext</name></member>
+ <member limittype="max"><type>uint32_t</type> <name>maxPushDescriptors</name></member>
+ </type>
+ <type category="struct" name="VkConformanceVersion">
+ <member><type>uint8_t</type> <name>major</name></member>
+ <member><type>uint8_t</type> <name>minor</name></member>
+ <member><type>uint8_t</type> <name>subminor</name></member>
+ <member><type>uint8_t</type> <name>patch</name></member>
+ </type>
+ <type category="struct" name="VkConformanceVersionKHR" alias="VkConformanceVersion"/>
+ <type category="struct" name="VkPhysicalDeviceDriverProperties" structextends="VkPhysicalDeviceProperties2" returnedonly="true">
+ <member values="VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_DRIVER_PROPERTIES"><type>VkStructureType</type> <name>sType</name></member>
+ <member optional="true"><type>void</type>* <name>pNext</name></member>
+ <member limittype="exact"><type>VkDriverId</type> <name>driverID</name></member>
+ <member limittype="exact"><type>char</type> <name>driverName</name>[<enum>VK_MAX_DRIVER_NAME_SIZE</enum>]</member>
+ <member limittype="exact"><type>char</type> <name>driverInfo</name>[<enum>VK_MAX_DRIVER_INFO_SIZE</enum>]</member>
+ <member limittype="exact"><type>VkConformanceVersion</type> <name>conformanceVersion</name></member>
+ </type>
+ <type category="struct" name="VkPhysicalDeviceDriverPropertiesKHR" alias="VkPhysicalDeviceDriverProperties"/>
+ <type category="struct" name="VkPresentRegionsKHR" structextends="VkPresentInfoKHR">
+ <member values="VK_STRUCTURE_TYPE_PRESENT_REGIONS_KHR"><type>VkStructureType</type> <name>sType</name></member>
+ <member optional="true">const <type>void</type>* <name>pNext</name></member>
+ <member><type>uint32_t</type> <name>swapchainCount</name><comment>Copy of VkPresentInfoKHR::swapchainCount</comment></member>
+ <member len="swapchainCount" optional="true">const <type>VkPresentRegionKHR</type>* <name>pRegions</name><comment>The regions that have changed</comment></member>
+ </type>
+ <type category="struct" name="VkPresentRegionKHR">
+ <member optional="true"><type>uint32_t</type> <name>rectangleCount</name><comment>Number of rectangles in pRectangles</comment></member>
+ <member optional="true" len="rectangleCount">const <type>VkRectLayerKHR</type>* <name>pRectangles</name><comment>Array of rectangles that have changed in a swapchain's image(s)</comment></member>
+ </type>
+ <type category="struct" name="VkRectLayerKHR">
+ <member><type>VkOffset2D</type> <name>offset</name><comment>upper-left corner of a rectangle that has not changed, in pixels of a presentation images</comment></member>
+ <member noautovalidity="true"><type>VkExtent2D</type> <name>extent</name><comment>Dimensions of a rectangle that has not changed, in pixels of a presentation images</comment></member>
+ <member><type>uint32_t</type> <name>layer</name><comment>Layer of a swapchain's image(s), for stereoscopic-3D images</comment></member>
+ </type>
+ <type category="struct" name="VkPhysicalDeviceVariablePointersFeatures" structextends="VkPhysicalDeviceFeatures2,VkDeviceCreateInfo">
+ <member values="VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_VARIABLE_POINTERS_FEATURES"><type>VkStructureType</type> <name>sType</name></member>
+ <member optional="true"><type>void</type>* <name>pNext</name></member>
+ <member><type>VkBool32</type> <name>variablePointersStorageBuffer</name></member>
+ <member><type>VkBool32</type> <name>variablePointers</name></member>
+ </type>
+ <type category="struct" name="VkPhysicalDeviceVariablePointersFeaturesKHR" alias="VkPhysicalDeviceVariablePointersFeatures"/>
+ <type category="struct" name="VkPhysicalDeviceVariablePointerFeaturesKHR" alias="VkPhysicalDeviceVariablePointersFeatures"/>
+ <type category="struct" name="VkPhysicalDeviceVariablePointerFeatures" alias="VkPhysicalDeviceVariablePointersFeatures"/>
+ <type category="struct" name="VkExternalMemoryProperties" returnedonly="true">
+ <member><type>VkExternalMemoryFeatureFlags</type> <name>externalMemoryFeatures</name></member>
+ <member optional="true"><type>VkExternalMemoryHandleTypeFlags</type> <name>exportFromImportedHandleTypes</name></member>
+ <member><type>VkExternalMemoryHandleTypeFlags</type> <name>compatibleHandleTypes</name></member>
+ </type>
+ <type category="struct" name="VkExternalMemoryPropertiesKHR" alias="VkExternalMemoryProperties"/>
+ <type category="struct" name="VkPhysicalDeviceExternalImageFormatInfo" structextends="VkPhysicalDeviceImageFormatInfo2">
+ <member values="VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_EXTERNAL_IMAGE_FORMAT_INFO"><type>VkStructureType</type> <name>sType</name></member>
+ <member optional="true">const <type>void</type>* <name>pNext</name></member>
+ <member optional="true"><type>VkExternalMemoryHandleTypeFlagBits</type> <name>handleType</name></member>
+ </type>
+ <type category="struct" name="VkPhysicalDeviceExternalImageFormatInfoKHR" alias="VkPhysicalDeviceExternalImageFormatInfo"/>
+ <type category="struct" name="VkExternalImageFormatProperties" returnedonly="true" structextends="VkImageFormatProperties2">
+ <member values="VK_STRUCTURE_TYPE_EXTERNAL_IMAGE_FORMAT_PROPERTIES"><type>VkStructureType</type> <name>sType</name></member>
+ <member optional="true"><type>void</type>* <name>pNext</name></member>
+ <member><type>VkExternalMemoryProperties</type> <name>externalMemoryProperties</name></member>
+ </type>
+ <type category="struct" name="VkExternalImageFormatPropertiesKHR" alias="VkExternalImageFormatProperties"/>
+ <type category="struct" name="VkPhysicalDeviceExternalBufferInfo">
+ <member values="VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_EXTERNAL_BUFFER_INFO"><type>VkStructureType</type> <name>sType</name></member>
+ <member optional="true">const <type>void</type>* <name>pNext</name></member>
+ <member optional="true"><type>VkBufferCreateFlags</type> <name>flags</name></member>
+ <member><type>VkBufferUsageFlags</type> <name>usage</name></member>
+ <member><type>VkExternalMemoryHandleTypeFlagBits</type> <name>handleType</name></member>
+ </type>
+ <type category="struct" name="VkPhysicalDeviceExternalBufferInfoKHR" alias="VkPhysicalDeviceExternalBufferInfo"/>
+ <type category="struct" name="VkExternalBufferProperties" returnedonly="true">
+ <member values="VK_STRUCTURE_TYPE_EXTERNAL_BUFFER_PROPERTIES"><type>VkStructureType</type> <name>sType</name></member>
+ <member optional="true"><type>void</type>* <name>pNext</name></member>
+ <member><type>VkExternalMemoryProperties</type> <name>externalMemoryProperties</name></member>
+ </type>
+ <type category="struct" name="VkExternalBufferPropertiesKHR" alias="VkExternalBufferProperties"/>
+ <type category="struct" name="VkPhysicalDeviceIDProperties" returnedonly="true" structextends="VkPhysicalDeviceProperties2">
+ <member values="VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_ID_PROPERTIES"><type>VkStructureType</type> <name>sType</name></member>
+ <member optional="true"><type>void</type>* <name>pNext</name></member>
+ <member limittype="noauto"><type>uint8_t</type> <name>deviceUUID</name>[<enum>VK_UUID_SIZE</enum>]</member>
+ <member limittype="noauto"><type>uint8_t</type> <name>driverUUID</name>[<enum>VK_UUID_SIZE</enum>]</member>
+ <member limittype="noauto"><type>uint8_t</type> <name>deviceLUID</name>[<enum>VK_LUID_SIZE</enum>]</member>
+ <member limittype="noauto"><type>uint32_t</type> <name>deviceNodeMask</name></member>
+ <member limittype="noauto"><type>VkBool32</type> <name>deviceLUIDValid</name></member>
+ </type>
+ <type category="struct" name="VkPhysicalDeviceIDPropertiesKHR" alias="VkPhysicalDeviceIDProperties"/>
+ <type category="struct" name="VkExternalMemoryImageCreateInfo" structextends="VkImageCreateInfo">
+ <member values="VK_STRUCTURE_TYPE_EXTERNAL_MEMORY_IMAGE_CREATE_INFO"><type>VkStructureType</type> <name>sType</name></member>
+ <member optional="true">const <type>void</type>* <name>pNext</name></member>
+ <member optional="true"><type>VkExternalMemoryHandleTypeFlags</type> <name>handleTypes</name></member>
+ </type>
+ <type category="struct" name="VkExternalMemoryImageCreateInfoKHR" alias="VkExternalMemoryImageCreateInfo"/>
+ <type category="struct" name="VkExternalMemoryBufferCreateInfo" structextends="VkBufferCreateInfo">
+ <member values="VK_STRUCTURE_TYPE_EXTERNAL_MEMORY_BUFFER_CREATE_INFO"><type>VkStructureType</type> <name>sType</name></member>
+ <member optional="true">const <type>void</type>* <name>pNext</name></member>
+ <member optional="true"><type>VkExternalMemoryHandleTypeFlags</type> <name>handleTypes</name></member>
+ </type>
+ <type category="struct" name="VkExternalMemoryBufferCreateInfoKHR" alias="VkExternalMemoryBufferCreateInfo"/>
+ <type category="struct" name="VkExportMemoryAllocateInfo" structextends="VkMemoryAllocateInfo">
+ <member values="VK_STRUCTURE_TYPE_EXPORT_MEMORY_ALLOCATE_INFO"><type>VkStructureType</type> <name>sType</name></member>
+ <member optional="true">const <type>void</type>* <name>pNext</name></member>
+ <member optional="true"><type>VkExternalMemoryHandleTypeFlags</type> <name>handleTypes</name></member>
+ </type>
+ <type category="struct" name="VkExportMemoryAllocateInfoKHR" alias="VkExportMemoryAllocateInfo"/>
+ <type category="struct" name="VkImportMemoryWin32HandleInfoKHR" structextends="VkMemoryAllocateInfo">
+ <member values="VK_STRUCTURE_TYPE_IMPORT_MEMORY_WIN32_HANDLE_INFO_KHR"><type>VkStructureType</type> <name>sType</name></member>
+ <member optional="true">const <type>void</type>* <name>pNext</name></member>
+ <member optional="true"><type>VkExternalMemoryHandleTypeFlagBits</type> <name>handleType</name></member>
+ <member optional="true"><type>HANDLE</type> <name>handle</name></member>
+ <member optional="true"><type>LPCWSTR</type> <name>name</name></member>
+ </type>
+ <type category="struct" name="VkExportMemoryWin32HandleInfoKHR" structextends="VkMemoryAllocateInfo">
+ <member values="VK_STRUCTURE_TYPE_EXPORT_MEMORY_WIN32_HANDLE_INFO_KHR"><type>VkStructureType</type> <name>sType</name></member>
+ <member optional="true">const <type>void</type>* <name>pNext</name></member>
+ <member optional="true">const <type>SECURITY_ATTRIBUTES</type>* <name>pAttributes</name></member>
+ <member><type>DWORD</type> <name>dwAccess</name></member>
+ <member><type>LPCWSTR</type> <name>name</name></member>
+ </type>
+ <type category="struct" name="VkImportMemoryZirconHandleInfoFUCHSIA" structextends="VkMemoryAllocateInfo">
+ <member values="VK_STRUCTURE_TYPE_IMPORT_MEMORY_ZIRCON_HANDLE_INFO_FUCHSIA"><type>VkStructureType</type> <name>sType</name></member>
+ <member optional="true">const <type>void</type>* <name>pNext</name></member>
+ <member optional="true"><type>VkExternalMemoryHandleTypeFlagBits</type> <name>handleType</name></member>
+ <member optional="true"><type>zx_handle_t</type> <name>handle</name></member>
+ </type>
+ <type category="struct" name="VkMemoryZirconHandlePropertiesFUCHSIA" returnedonly="true">
+ <member values="VK_STRUCTURE_TYPE_MEMORY_ZIRCON_HANDLE_PROPERTIES_FUCHSIA"><type>VkStructureType</type> <name>sType</name></member>
+ <member optional="true"><type>void</type>* <name>pNext</name></member>
+ <member><type>uint32_t</type> <name>memoryTypeBits</name></member>
+ </type>
+ <type category="struct" name="VkMemoryGetZirconHandleInfoFUCHSIA">
+ <member values="VK_STRUCTURE_TYPE_MEMORY_GET_ZIRCON_HANDLE_INFO_FUCHSIA"><type>VkStructureType</type> <name>sType</name></member>
+ <member optional="true">const <type>void</type>* <name>pNext</name></member>
+ <member><type>VkDeviceMemory</type> <name>memory</name></member>
+ <member><type>VkExternalMemoryHandleTypeFlagBits</type> <name>handleType</name></member>
+ </type>
+ <type category="struct" name="VkMemoryWin32HandlePropertiesKHR" returnedonly="true">
+ <member values="VK_STRUCTURE_TYPE_MEMORY_WIN32_HANDLE_PROPERTIES_KHR"><type>VkStructureType</type> <name>sType</name></member>
+ <member optional="true"><type>void</type>* <name>pNext</name></member>
+ <member><type>uint32_t</type> <name>memoryTypeBits</name></member>
+ </type>
+ <type category="struct" name="VkMemoryGetWin32HandleInfoKHR">
+ <member values="VK_STRUCTURE_TYPE_MEMORY_GET_WIN32_HANDLE_INFO_KHR"><type>VkStructureType</type> <name>sType</name></member>
+ <member optional="true">const <type>void</type>* <name>pNext</name></member>
+ <member><type>VkDeviceMemory</type> <name>memory</name></member>
+ <member><type>VkExternalMemoryHandleTypeFlagBits</type> <name>handleType</name></member>
+ </type>
+ <type category="struct" name="VkImportMemoryFdInfoKHR" structextends="VkMemoryAllocateInfo">
+ <member values="VK_STRUCTURE_TYPE_IMPORT_MEMORY_FD_INFO_KHR"><type>VkStructureType</type> <name>sType</name></member>
+ <member optional="true">const <type>void</type>* <name>pNext</name></member>
+ <member optional="true"><type>VkExternalMemoryHandleTypeFlagBits</type> <name>handleType</name></member>
+ <member><type>int</type> <name>fd</name></member>
+ </type>
+ <type category="struct" name="VkMemoryFdPropertiesKHR" returnedonly="true">
+ <member values="VK_STRUCTURE_TYPE_MEMORY_FD_PROPERTIES_KHR"><type>VkStructureType</type> <name>sType</name></member>
+ <member optional="true"><type>void</type>* <name>pNext</name></member>
+ <member><type>uint32_t</type> <name>memoryTypeBits</name></member>
+ </type>
+ <type category="struct" name="VkMemoryGetFdInfoKHR">
+ <member values="VK_STRUCTURE_TYPE_MEMORY_GET_FD_INFO_KHR"><type>VkStructureType</type> <name>sType</name></member>
+ <member optional="true">const <type>void</type>* <name>pNext</name></member>
+ <member><type>VkDeviceMemory</type> <name>memory</name></member>
+ <member><type>VkExternalMemoryHandleTypeFlagBits</type> <name>handleType</name></member>
+ </type>
+ <type category="struct" name="VkWin32KeyedMutexAcquireReleaseInfoKHR" structextends="VkSubmitInfo,VkSubmitInfo2">
+ <member values="VK_STRUCTURE_TYPE_WIN32_KEYED_MUTEX_ACQUIRE_RELEASE_INFO_KHR"><type>VkStructureType</type> <name>sType</name></member>
+ <member optional="true">const <type>void</type>* <name>pNext</name></member>
+ <member optional="true"><type>uint32_t</type> <name>acquireCount</name></member>
+ <member len="acquireCount">const <type>VkDeviceMemory</type>* <name>pAcquireSyncs</name></member>
+ <member len="acquireCount">const <type>uint64_t</type>* <name>pAcquireKeys</name></member>
+ <member len="acquireCount">const <type>uint32_t</type>* <name>pAcquireTimeouts</name></member>
+ <member optional="true"><type>uint32_t</type> <name>releaseCount</name></member>
+ <member len="releaseCount">const <type>VkDeviceMemory</type>* <name>pReleaseSyncs</name></member>
+ <member len="releaseCount">const <type>uint64_t</type>* <name>pReleaseKeys</name></member>
+ </type>
+ <type category="struct" name="VkPhysicalDeviceExternalSemaphoreInfo">
+ <member values="VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_EXTERNAL_SEMAPHORE_INFO"><type>VkStructureType</type> <name>sType</name></member>
+ <member optional="true">const <type>void</type>* <name>pNext</name></member>
+ <member><type>VkExternalSemaphoreHandleTypeFlagBits</type> <name>handleType</name></member>
+ </type>
+ <type category="struct" name="VkPhysicalDeviceExternalSemaphoreInfoKHR" alias="VkPhysicalDeviceExternalSemaphoreInfo"/>
+ <type category="struct" name="VkExternalSemaphoreProperties" returnedonly="true">
+ <member values="VK_STRUCTURE_TYPE_EXTERNAL_SEMAPHORE_PROPERTIES"><type>VkStructureType</type> <name>sType</name></member>
+ <member optional="true"><type>void</type>* <name>pNext</name></member>
+ <member><type>VkExternalSemaphoreHandleTypeFlags</type> <name>exportFromImportedHandleTypes</name></member>
+ <member><type>VkExternalSemaphoreHandleTypeFlags</type> <name>compatibleHandleTypes</name></member>
+ <member optional="true"><type>VkExternalSemaphoreFeatureFlags</type> <name>externalSemaphoreFeatures</name></member>
+ </type>
+ <type category="struct" name="VkExternalSemaphorePropertiesKHR" alias="VkExternalSemaphoreProperties"/>
+ <type category="struct" name="VkExportSemaphoreCreateInfo" structextends="VkSemaphoreCreateInfo">
+ <member values="VK_STRUCTURE_TYPE_EXPORT_SEMAPHORE_CREATE_INFO"><type>VkStructureType</type> <name>sType</name></member>
+ <member optional="true">const <type>void</type>* <name>pNext</name></member>
+ <member optional="true"><type>VkExternalSemaphoreHandleTypeFlags</type> <name>handleTypes</name></member>
+ </type>
+ <type category="struct" name="VkExportSemaphoreCreateInfoKHR" alias="VkExportSemaphoreCreateInfo"/>
+ <type category="struct" name="VkImportSemaphoreWin32HandleInfoKHR">
+ <member values="VK_STRUCTURE_TYPE_IMPORT_SEMAPHORE_WIN32_HANDLE_INFO_KHR"><type>VkStructureType</type> <name>sType</name></member>
+ <member optional="true">const <type>void</type>* <name>pNext</name></member>
+ <member externsync="true"><type>VkSemaphore</type> <name>semaphore</name></member>
+ <member optional="true"><type>VkSemaphoreImportFlags</type> <name>flags</name></member>
+ <member noautovalidity="true"><type>VkExternalSemaphoreHandleTypeFlagBits</type> <name>handleType</name></member>
+ <member optional="true"><type>HANDLE</type> <name>handle</name></member>
+ <member optional="true"><type>LPCWSTR</type> <name>name</name></member>
+ </type>
+ <type category="struct" name="VkExportSemaphoreWin32HandleInfoKHR" structextends="VkSemaphoreCreateInfo">
+ <member values="VK_STRUCTURE_TYPE_EXPORT_SEMAPHORE_WIN32_HANDLE_INFO_KHR"><type>VkStructureType</type> <name>sType</name></member>
+ <member optional="true">const <type>void</type>* <name>pNext</name></member>
+ <member optional="true">const <type>SECURITY_ATTRIBUTES</type>* <name>pAttributes</name></member>
+ <member><type>DWORD</type> <name>dwAccess</name></member>
+ <member><type>LPCWSTR</type> <name>name</name></member>
+ </type>
+ <type category="struct" name="VkD3D12FenceSubmitInfoKHR" structextends="VkSubmitInfo">
+ <member values="VK_STRUCTURE_TYPE_D3D12_FENCE_SUBMIT_INFO_KHR"><type>VkStructureType</type> <name>sType</name></member>
+ <member optional="true">const <type>void</type>* <name>pNext</name></member>
+ <member optional="true"><type>uint32_t</type> <name>waitSemaphoreValuesCount</name></member>
+ <member optional="true" len="waitSemaphoreValuesCount">const <type>uint64_t</type>* <name>pWaitSemaphoreValues</name></member>
+ <member optional="true"><type>uint32_t</type> <name>signalSemaphoreValuesCount</name></member>
+ <member optional="true" len="signalSemaphoreValuesCount">const <type>uint64_t</type>* <name>pSignalSemaphoreValues</name></member>
+ </type>
+ <type category="struct" name="VkSemaphoreGetWin32HandleInfoKHR">
+ <member values="VK_STRUCTURE_TYPE_SEMAPHORE_GET_WIN32_HANDLE_INFO_KHR"><type>VkStructureType</type> <name>sType</name></member>
+ <member optional="true">const <type>void</type>* <name>pNext</name></member>
+ <member><type>VkSemaphore</type> <name>semaphore</name></member>
+ <member><type>VkExternalSemaphoreHandleTypeFlagBits</type> <name>handleType</name></member>
+ </type>
+ <type category="struct" name="VkImportSemaphoreFdInfoKHR">
+ <member values="VK_STRUCTURE_TYPE_IMPORT_SEMAPHORE_FD_INFO_KHR"><type>VkStructureType</type> <name>sType</name></member>
+ <member optional="true">const <type>void</type>* <name>pNext</name></member>
+ <member externsync="true"><type>VkSemaphore</type> <name>semaphore</name></member>
+ <member optional="true"><type>VkSemaphoreImportFlags</type> <name>flags</name></member>
+ <member><type>VkExternalSemaphoreHandleTypeFlagBits</type> <name>handleType</name></member>
+ <member><type>int</type> <name>fd</name></member>
+ </type>
+ <type category="struct" name="VkSemaphoreGetFdInfoKHR">
+ <member values="VK_STRUCTURE_TYPE_SEMAPHORE_GET_FD_INFO_KHR"><type>VkStructureType</type> <name>sType</name></member>
+ <member optional="true">const <type>void</type>* <name>pNext</name></member>
+ <member><type>VkSemaphore</type> <name>semaphore</name></member>
+ <member><type>VkExternalSemaphoreHandleTypeFlagBits</type> <name>handleType</name></member>
+ </type>
+ <type category="struct" name="VkImportSemaphoreZirconHandleInfoFUCHSIA">
+ <member values="VK_STRUCTURE_TYPE_IMPORT_SEMAPHORE_ZIRCON_HANDLE_INFO_FUCHSIA"><type>VkStructureType</type> <name>sType</name></member>
+ <member optional="true">const <type>void</type>* <name>pNext</name></member>
+ <member externsync="true"><type>VkSemaphore</type> <name>semaphore</name></member>
+ <member optional="true"><type>VkSemaphoreImportFlags</type> <name>flags</name></member>
+ <member><type>VkExternalSemaphoreHandleTypeFlagBits</type> <name>handleType</name></member>
+ <member><type>zx_handle_t</type> <name>zirconHandle</name></member>
+ </type>
+ <type category="struct" name="VkSemaphoreGetZirconHandleInfoFUCHSIA">
+ <member values="VK_STRUCTURE_TYPE_SEMAPHORE_GET_ZIRCON_HANDLE_INFO_FUCHSIA"><type>VkStructureType</type> <name>sType</name></member>
+ <member optional="true">const <type>void</type>* <name>pNext</name></member>
+ <member><type>VkSemaphore</type> <name>semaphore</name></member>
+ <member><type>VkExternalSemaphoreHandleTypeFlagBits</type> <name>handleType</name></member>
+ </type>
+ <type category="struct" name="VkPhysicalDeviceExternalFenceInfo">
+ <member values="VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_EXTERNAL_FENCE_INFO"><type>VkStructureType</type> <name>sType</name></member>
+ <member optional="true">const <type>void</type>* <name>pNext</name></member>
+ <member><type>VkExternalFenceHandleTypeFlagBits</type> <name>handleType</name></member>
+ </type>
+ <type category="struct" name="VkPhysicalDeviceExternalFenceInfoKHR" alias="VkPhysicalDeviceExternalFenceInfo"/>
+ <type category="struct" name="VkExternalFenceProperties" returnedonly="true">
+ <member values="VK_STRUCTURE_TYPE_EXTERNAL_FENCE_PROPERTIES"><type>VkStructureType</type> <name>sType</name></member>
+ <member optional="true"><type>void</type>* <name>pNext</name></member>
+ <member><type>VkExternalFenceHandleTypeFlags</type> <name>exportFromImportedHandleTypes</name></member>
+ <member><type>VkExternalFenceHandleTypeFlags</type> <name>compatibleHandleTypes</name></member>
+ <member optional="true"><type>VkExternalFenceFeatureFlags</type> <name>externalFenceFeatures</name></member>
+ </type>
+ <type category="struct" name="VkExternalFencePropertiesKHR" alias="VkExternalFenceProperties"/>
+ <type category="struct" name="VkExportFenceCreateInfo" structextends="VkFenceCreateInfo">
+ <member values="VK_STRUCTURE_TYPE_EXPORT_FENCE_CREATE_INFO"><type>VkStructureType</type> <name>sType</name></member>
+ <member optional="true">const <type>void</type>* <name>pNext</name></member>
+ <member optional="true"><type>VkExternalFenceHandleTypeFlags</type> <name>handleTypes</name></member>
+ </type>
+ <type category="struct" name="VkExportFenceCreateInfoKHR" alias="VkExportFenceCreateInfo"/>
+ <type category="struct" name="VkImportFenceWin32HandleInfoKHR">
+ <member values="VK_STRUCTURE_TYPE_IMPORT_FENCE_WIN32_HANDLE_INFO_KHR"><type>VkStructureType</type> <name>sType</name></member>
+ <member optional="true">const <type>void</type>* <name>pNext</name></member>
+ <member externsync="true"><type>VkFence</type> <name>fence</name></member>
+ <member optional="true"><type>VkFenceImportFlags</type> <name>flags</name></member>
+ <member noautovalidity="true"><type>VkExternalFenceHandleTypeFlagBits</type> <name>handleType</name></member>
+ <member optional="true"><type>HANDLE</type> <name>handle</name></member>
+ <member optional="true"><type>LPCWSTR</type> <name>name</name></member>
+ </type>
+ <type category="struct" name="VkExportFenceWin32HandleInfoKHR" structextends="VkFenceCreateInfo">
+ <member values="VK_STRUCTURE_TYPE_EXPORT_FENCE_WIN32_HANDLE_INFO_KHR"><type>VkStructureType</type> <name>sType</name></member>
+ <member optional="true">const <type>void</type>* <name>pNext</name></member>
+ <member optional="true">const <type>SECURITY_ATTRIBUTES</type>* <name>pAttributes</name></member>
+ <member><type>DWORD</type> <name>dwAccess</name></member>
+ <member><type>LPCWSTR</type> <name>name</name></member>
+ </type>
+ <type category="struct" name="VkFenceGetWin32HandleInfoKHR">
+ <member values="VK_STRUCTURE_TYPE_FENCE_GET_WIN32_HANDLE_INFO_KHR"><type>VkStructureType</type> <name>sType</name></member>
+ <member optional="true">const <type>void</type>* <name>pNext</name></member>
+ <member><type>VkFence</type> <name>fence</name></member>
+ <member><type>VkExternalFenceHandleTypeFlagBits</type> <name>handleType</name></member>
+ </type>
+ <type category="struct" name="VkImportFenceFdInfoKHR">
+ <member values="VK_STRUCTURE_TYPE_IMPORT_FENCE_FD_INFO_KHR"><type>VkStructureType</type> <name>sType</name></member>
+ <member optional="true">const <type>void</type>* <name>pNext</name></member>
+ <member externsync="true"><type>VkFence</type> <name>fence</name></member>
+ <member optional="true"><type>VkFenceImportFlags</type> <name>flags</name></member>
+ <member><type>VkExternalFenceHandleTypeFlagBits</type> <name>handleType</name></member>
+ <member><type>int</type> <name>fd</name></member>
+ </type>
+ <type category="struct" name="VkFenceGetFdInfoKHR">
+ <member values="VK_STRUCTURE_TYPE_FENCE_GET_FD_INFO_KHR"><type>VkStructureType</type> <name>sType</name></member>
+ <member optional="true">const <type>void</type>* <name>pNext</name></member>
+ <member><type>VkFence</type> <name>fence</name></member>
+ <member><type>VkExternalFenceHandleTypeFlagBits</type> <name>handleType</name></member>
+ </type>
+ <type category="struct" name="VkPhysicalDeviceMultiviewFeatures" structextends="VkPhysicalDeviceFeatures2,VkDeviceCreateInfo">
+ <member values="VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_MULTIVIEW_FEATURES"><type>VkStructureType</type> <name>sType</name></member>
+ <member optional="true"><type>void</type>* <name>pNext</name></member>
+ <member><type>VkBool32</type> <name>multiview</name><comment>Multiple views in a renderpass</comment></member>
+ <member><type>VkBool32</type> <name>multiviewGeometryShader</name><comment>Multiple views in a renderpass w/ geometry shader</comment></member>
+ <member><type>VkBool32</type> <name>multiviewTessellationShader</name><comment>Multiple views in a renderpass w/ tessellation shader</comment></member>
+ </type>
+ <type category="struct" name="VkPhysicalDeviceMultiviewFeaturesKHR" alias="VkPhysicalDeviceMultiviewFeatures"/>
+ <type category="struct" name="VkPhysicalDeviceMultiviewProperties" returnedonly="true" structextends="VkPhysicalDeviceProperties2">
+ <member values="VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_MULTIVIEW_PROPERTIES"><type>VkStructureType</type> <name>sType</name></member>
+ <member optional="true"><type>void</type>* <name>pNext</name></member>
+ <member limittype="max"><type>uint32_t</type> <name>maxMultiviewViewCount</name><comment>max number of views in a subpass</comment></member>
+ <member limittype="max"><type>uint32_t</type> <name>maxMultiviewInstanceIndex</name><comment>max instance index for a draw in a multiview subpass</comment></member>
+ </type>
+ <type category="struct" name="VkPhysicalDeviceMultiviewPropertiesKHR" alias="VkPhysicalDeviceMultiviewProperties"/>
+ <type category="struct" name="VkRenderPassMultiviewCreateInfo" structextends="VkRenderPassCreateInfo">
+ <member values="VK_STRUCTURE_TYPE_RENDER_PASS_MULTIVIEW_CREATE_INFO"><type>VkStructureType</type> <name>sType</name></member>
+ <member optional="true">const <type>void</type>* <name>pNext</name></member>
+ <member optional="true"><type>uint32_t</type> <name>subpassCount</name></member>
+ <member len="subpassCount">const <type>uint32_t</type>* <name>pViewMasks</name></member>
+ <member optional="true"><type>uint32_t</type> <name>dependencyCount</name></member>
+ <member len="dependencyCount">const <type>int32_t</type>* <name>pViewOffsets</name></member>
+ <member optional="true"><type>uint32_t</type> <name>correlationMaskCount</name></member>
+ <member len="correlationMaskCount">const <type>uint32_t</type>* <name>pCorrelationMasks</name></member>
+ </type>
+ <type category="struct" name="VkRenderPassMultiviewCreateInfoKHR" alias="VkRenderPassMultiviewCreateInfo"/>
<type category="struct" name="VkSurfaceCapabilities2EXT" returnedonly="true">
- <member values="VK_STRUCTURE_TYPE_SURFACE_CAPABILITIES2_EXT"><type>VkStructureType</type> <name>sType</name></member>
- <member><type>void</type>* <name>pNext</name></member>
- <member><type>uint32_t</type> <name>minImageCount</name></member> <!-- Supported minimum number of images for the surface -->
- <member><type>uint32_t</type> <name>maxImageCount</name></member> <!-- Supported maximum number of images for the surface, 0 for unlimited -->
- <member><type>VkExtent2D</type> <name>currentExtent</name></member> <!-- Current image width and height for the surface, (0, 0) if undefined -->
- <member><type>VkExtent2D</type> <name>minImageExtent</name></member> <!-- Supported minimum image width and height for the surface -->
- <member><type>VkExtent2D</type> <name>maxImageExtent</name></member> <!-- Supported maximum image width and height for the surface -->
- <member><type>uint32_t</type> <name>maxImageArrayLayers</name></member> <!-- Supported maximum number of image layers for the surface -->
- <member optional="true"><type>VkSurfaceTransformFlagsKHR</type> <name>supportedTransforms</name></member> <!-- 1 or more bits representing the transforms supported -->
- <member><type>VkSurfaceTransformFlagBitsKHR</type> <name>currentTransform</name></member> <!-- The surface's current transform relative to the device's natural orientation -->
- <member optional="true"><type>VkCompositeAlphaFlagsKHR</type> <name>supportedCompositeAlpha</name></member> <!-- 1 or more bits representing the alpha compositing modes supported -->
- <member optional="true"><type>VkImageUsageFlags</type> <name>supportedUsageFlags</name></member> <!-- Supported image usage flags for the surface -->
+ <member values="VK_STRUCTURE_TYPE_SURFACE_CAPABILITIES_2_EXT"><type>VkStructureType</type> <name>sType</name></member>
+ <member optional="true"><type>void</type>* <name>pNext</name></member>
+ <member><type>uint32_t</type> <name>minImageCount</name><comment>Supported minimum number of images for the surface</comment></member>
+ <member><type>uint32_t</type> <name>maxImageCount</name><comment>Supported maximum number of images for the surface, 0 for unlimited</comment></member>
+ <member><type>VkExtent2D</type> <name>currentExtent</name><comment>Current image width and height for the surface, (0, 0) if undefined</comment></member>
+ <member><type>VkExtent2D</type> <name>minImageExtent</name><comment>Supported minimum image width and height for the surface</comment></member>
+ <member><type>VkExtent2D</type> <name>maxImageExtent</name><comment>Supported maximum image width and height for the surface</comment></member>
+ <member><type>uint32_t</type> <name>maxImageArrayLayers</name><comment>Supported maximum number of image layers for the surface</comment></member>
+ <member><type>VkSurfaceTransformFlagsKHR</type> <name>supportedTransforms</name><comment>1 or more bits representing the transforms supported</comment></member>
+ <member><type>VkSurfaceTransformFlagBitsKHR</type> <name>currentTransform</name><comment>The surface's current transform relative to the device's natural orientation</comment></member>
+ <member><type>VkCompositeAlphaFlagsKHR</type> <name>supportedCompositeAlpha</name><comment>1 or more bits representing the alpha compositing modes supported</comment></member>
+ <member><type>VkImageUsageFlags</type> <name>supportedUsageFlags</name><comment>Supported image usage flags for the surface</comment></member>
<member optional="true"><type>VkSurfaceCounterFlagsEXT</type> <name>supportedSurfaceCounters</name></member>
</type>
<type category="struct" name="VkDisplayPowerInfoEXT">
<member values="VK_STRUCTURE_TYPE_DISPLAY_POWER_INFO_EXT"><type>VkStructureType</type> <name>sType</name></member>
- <member>const <type>void</type>* <name>pNext</name></member>
+ <member optional="true">const <type>void</type>* <name>pNext</name></member>
<member><type>VkDisplayPowerStateEXT</type> <name>powerState</name></member>
</type>
<type category="struct" name="VkDeviceEventInfoEXT">
<member values="VK_STRUCTURE_TYPE_DEVICE_EVENT_INFO_EXT"><type>VkStructureType</type> <name>sType</name></member>
- <member>const <type>void</type>* <name>pNext</name></member>
+ <member optional="true">const <type>void</type>* <name>pNext</name></member>
<member><type>VkDeviceEventTypeEXT</type> <name>deviceEvent</name></member>
</type>
<type category="struct" name="VkDisplayEventInfoEXT">
<member values="VK_STRUCTURE_TYPE_DISPLAY_EVENT_INFO_EXT"><type>VkStructureType</type> <name>sType</name></member>
- <member>const <type>void</type>* <name>pNext</name></member>
+ <member optional="true">const <type>void</type>* <name>pNext</name></member>
<member><type>VkDisplayEventTypeEXT</type> <name>displayEvent</name></member>
</type>
- <type category="struct" name="VkSwapchainCounterCreateInfoEXT">
+ <type category="struct" name="VkSwapchainCounterCreateInfoEXT" structextends="VkSwapchainCreateInfoKHR">
<member values="VK_STRUCTURE_TYPE_SWAPCHAIN_COUNTER_CREATE_INFO_EXT"><type>VkStructureType</type> <name>sType</name></member>
- <member>const <type>void</type>* <name>pNext</name></member>
+ <member optional="true">const <type>void</type>* <name>pNext</name></member>
<member optional="true"><type>VkSurfaceCounterFlagsEXT</type> <name>surfaceCounters</name></member>
</type>
+ <type category="struct" name="VkPhysicalDeviceGroupProperties" returnedonly="true">
+ <member values="VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_GROUP_PROPERTIES"><type>VkStructureType</type> <name>sType</name></member>
+ <member optional="true"><type>void</type>* <name>pNext</name></member>
+ <member><type>uint32_t</type> <name>physicalDeviceCount</name></member>
+ <member><type>VkPhysicalDevice</type> <name>physicalDevices</name>[<enum>VK_MAX_DEVICE_GROUP_SIZE</enum>]</member>
+ <member><type>VkBool32</type> <name>subsetAllocation</name></member>
+ </type>
+ <type category="struct" name="VkPhysicalDeviceGroupPropertiesKHR" alias="VkPhysicalDeviceGroupProperties"/>
+ <type category="struct" name="VkMemoryAllocateFlagsInfo" structextends="VkMemoryAllocateInfo">
+ <member values="VK_STRUCTURE_TYPE_MEMORY_ALLOCATE_FLAGS_INFO"><type>VkStructureType</type> <name>sType</name></member>
+ <member optional="true">const <type>void</type>* <name>pNext</name></member>
+ <member optional="true"><type>VkMemoryAllocateFlags</type> <name>flags</name></member>
+ <member><type>uint32_t</type> <name>deviceMask</name></member>
+ </type>
+ <type category="struct" name="VkMemoryAllocateFlagsInfoKHR" alias="VkMemoryAllocateFlagsInfo"/>
+ <type category="struct" name="VkBindBufferMemoryInfo">
+ <member values="VK_STRUCTURE_TYPE_BIND_BUFFER_MEMORY_INFO"><type>VkStructureType</type> <name>sType</name></member>
+ <member optional="true">const <type>void</type>* <name>pNext</name></member>
+ <member><type>VkBuffer</type> <name>buffer</name></member>
+ <member><type>VkDeviceMemory</type> <name>memory</name></member>
+ <member><type>VkDeviceSize</type> <name>memoryOffset</name></member>
+ </type>
+ <type category="struct" name="VkBindBufferMemoryInfoKHR" alias="VkBindBufferMemoryInfo"/>
+ <type category="struct" name="VkBindBufferMemoryDeviceGroupInfo" structextends="VkBindBufferMemoryInfo">
+ <member values="VK_STRUCTURE_TYPE_BIND_BUFFER_MEMORY_DEVICE_GROUP_INFO"><type>VkStructureType</type> <name>sType</name></member>
+ <member optional="true">const <type>void</type>* <name>pNext</name></member>
+ <member optional="true"><type>uint32_t</type> <name>deviceIndexCount</name></member>
+ <member len="deviceIndexCount">const <type>uint32_t</type>* <name>pDeviceIndices</name></member>
+ </type>
+ <type category="struct" name="VkBindBufferMemoryDeviceGroupInfoKHR" alias="VkBindBufferMemoryDeviceGroupInfo"/>
+ <type category="struct" name="VkBindImageMemoryInfo">
+ <member values="VK_STRUCTURE_TYPE_BIND_IMAGE_MEMORY_INFO"><type>VkStructureType</type> <name>sType</name></member>
+ <member optional="true">const <type>void</type>* <name>pNext</name></member>
+ <member><type>VkImage</type> <name>image</name></member>
+ <member noautovalidity="true"><type>VkDeviceMemory</type> <name>memory</name></member>
+ <member><type>VkDeviceSize</type> <name>memoryOffset</name></member>
+ </type>
+ <type category="struct" name="VkBindImageMemoryInfoKHR" alias="VkBindImageMemoryInfo"/>
+ <type category="struct" name="VkBindImageMemoryDeviceGroupInfo" structextends="VkBindImageMemoryInfo">
+ <member values="VK_STRUCTURE_TYPE_BIND_IMAGE_MEMORY_DEVICE_GROUP_INFO"><type>VkStructureType</type> <name>sType</name></member>
+ <member optional="true">const <type>void</type>* <name>pNext</name></member>
+ <member optional="true"><type>uint32_t</type> <name>deviceIndexCount</name></member>
+ <member len="deviceIndexCount">const <type>uint32_t</type>* <name>pDeviceIndices</name></member>
+ <member optional="true"><type>uint32_t</type> <name>splitInstanceBindRegionCount</name></member>
+ <member len="splitInstanceBindRegionCount">const <type>VkRect2D</type>* <name>pSplitInstanceBindRegions</name></member>
+ </type>
+ <type category="struct" name="VkBindImageMemoryDeviceGroupInfoKHR" alias="VkBindImageMemoryDeviceGroupInfo"/>
+ <type category="struct" name="VkDeviceGroupRenderPassBeginInfo" structextends="VkRenderPassBeginInfo,VkRenderingInfo">
+ <member values="VK_STRUCTURE_TYPE_DEVICE_GROUP_RENDER_PASS_BEGIN_INFO"><type>VkStructureType</type> <name>sType</name></member>
+ <member optional="true">const <type>void</type>* <name>pNext</name></member>
+ <member><type>uint32_t</type> <name>deviceMask</name></member>
+ <member optional="true"><type>uint32_t</type> <name>deviceRenderAreaCount</name></member>
+ <member len="deviceRenderAreaCount">const <type>VkRect2D</type>* <name>pDeviceRenderAreas</name></member>
+ </type>
+ <type category="struct" name="VkDeviceGroupRenderPassBeginInfoKHR" alias="VkDeviceGroupRenderPassBeginInfo"/>
+ <type category="struct" name="VkDeviceGroupCommandBufferBeginInfo" structextends="VkCommandBufferBeginInfo">
+ <member values="VK_STRUCTURE_TYPE_DEVICE_GROUP_COMMAND_BUFFER_BEGIN_INFO"><type>VkStructureType</type> <name>sType</name></member>
+ <member optional="true">const <type>void</type>* <name>pNext</name></member>
+ <member><type>uint32_t</type> <name>deviceMask</name></member>
+ </type>
+ <type category="struct" name="VkDeviceGroupCommandBufferBeginInfoKHR" alias="VkDeviceGroupCommandBufferBeginInfo"/>
+ <type category="struct" name="VkDeviceGroupSubmitInfo" structextends="VkSubmitInfo">
+ <member values="VK_STRUCTURE_TYPE_DEVICE_GROUP_SUBMIT_INFO"><type>VkStructureType</type> <name>sType</name></member>
+ <member optional="true">const <type>void</type>* <name>pNext</name></member>
+ <member optional="true"><type>uint32_t</type> <name>waitSemaphoreCount</name></member>
+ <member len="waitSemaphoreCount">const <type>uint32_t</type>* <name>pWaitSemaphoreDeviceIndices</name></member>
+ <member optional="true"><type>uint32_t</type> <name>commandBufferCount</name></member>
+ <member len="commandBufferCount">const <type>uint32_t</type>* <name>pCommandBufferDeviceMasks</name></member>
+ <member optional="true"><type>uint32_t</type> <name>signalSemaphoreCount</name></member>
+ <member len="signalSemaphoreCount">const <type>uint32_t</type>* <name>pSignalSemaphoreDeviceIndices</name></member>
+ </type>
+ <type category="struct" name="VkDeviceGroupSubmitInfoKHR" alias="VkDeviceGroupSubmitInfo"/>
+ <type category="struct" name="VkDeviceGroupBindSparseInfo" structextends="VkBindSparseInfo">
+ <member values="VK_STRUCTURE_TYPE_DEVICE_GROUP_BIND_SPARSE_INFO"><type>VkStructureType</type> <name>sType</name></member>
+ <member optional="true">const <type>void</type>* <name>pNext</name></member>
+ <member><type>uint32_t</type> <name>resourceDeviceIndex</name></member>
+ <member><type>uint32_t</type> <name>memoryDeviceIndex</name></member>
+ </type>
+ <type category="struct" name="VkDeviceGroupBindSparseInfoKHR" alias="VkDeviceGroupBindSparseInfo"/>
+ <type category="struct" name="VkDeviceGroupPresentCapabilitiesKHR" returnedonly="true">
+ <member values="VK_STRUCTURE_TYPE_DEVICE_GROUP_PRESENT_CAPABILITIES_KHR"><type>VkStructureType</type> <name>sType</name></member>
+ <member optional="true"><type>void</type>* <name>pNext</name></member>
+ <member><type>uint32_t</type> <name>presentMask</name>[<enum>VK_MAX_DEVICE_GROUP_SIZE</enum>]</member>
+ <member><type>VkDeviceGroupPresentModeFlagsKHR</type> <name>modes</name></member>
+ </type>
+ <type category="struct" name="VkImageSwapchainCreateInfoKHR" structextends="VkImageCreateInfo">
+ <member values="VK_STRUCTURE_TYPE_IMAGE_SWAPCHAIN_CREATE_INFO_KHR"><type>VkStructureType</type> <name>sType</name></member>
+ <member optional="true">const <type>void</type>* <name>pNext</name></member>
+ <member optional="true"><type>VkSwapchainKHR</type> <name>swapchain</name></member>
+ </type>
+ <type category="struct" name="VkBindImageMemorySwapchainInfoKHR" structextends="VkBindImageMemoryInfo">
+ <member values="VK_STRUCTURE_TYPE_BIND_IMAGE_MEMORY_SWAPCHAIN_INFO_KHR"><type>VkStructureType</type> <name>sType</name></member>
+ <member optional="true">const <type>void</type>* <name>pNext</name></member>
+ <member externsync="true"><type>VkSwapchainKHR</type> <name>swapchain</name></member>
+ <member><type>uint32_t</type> <name>imageIndex</name></member>
+ </type>
+ <type category="struct" name="VkAcquireNextImageInfoKHR">
+ <member values="VK_STRUCTURE_TYPE_ACQUIRE_NEXT_IMAGE_INFO_KHR"><type>VkStructureType</type> <name>sType</name></member>
+ <member optional="true">const <type>void</type>* <name>pNext</name></member>
+ <member externsync="true"><type>VkSwapchainKHR</type> <name>swapchain</name></member>
+ <member><type>uint64_t</type> <name>timeout</name></member>
+ <member optional="true" externsync="true"><type>VkSemaphore</type> <name>semaphore</name></member>
+ <member optional="true" externsync="true"><type>VkFence</type> <name>fence</name></member>
+ <member><type>uint32_t</type> <name>deviceMask</name></member>
+ </type>
+ <type category="struct" name="VkDeviceGroupPresentInfoKHR" structextends="VkPresentInfoKHR">
+ <member values="VK_STRUCTURE_TYPE_DEVICE_GROUP_PRESENT_INFO_KHR"><type>VkStructureType</type> <name>sType</name></member>
+ <member optional="true">const <type>void</type>* <name>pNext</name></member>
+ <member optional="true"><type>uint32_t</type> <name>swapchainCount</name></member>
+ <member len="swapchainCount">const <type>uint32_t</type>* <name>pDeviceMasks</name></member>
+ <member><type>VkDeviceGroupPresentModeFlagBitsKHR</type> <name>mode</name></member>
+ </type>
+ <type category="struct" name="VkDeviceGroupDeviceCreateInfo" structextends="VkDeviceCreateInfo">
+ <member values="VK_STRUCTURE_TYPE_DEVICE_GROUP_DEVICE_CREATE_INFO"><type>VkStructureType</type> <name>sType</name></member>
+ <member optional="true">const <type>void</type>* <name>pNext</name></member>
+ <member optional="true"><type>uint32_t</type> <name>physicalDeviceCount</name></member>
+ <member len="physicalDeviceCount">const <type>VkPhysicalDevice</type>* <name>pPhysicalDevices</name></member>
+ </type>
+ <type category="struct" name="VkDeviceGroupDeviceCreateInfoKHR" alias="VkDeviceGroupDeviceCreateInfo"/>
+ <type category="struct" name="VkDeviceGroupSwapchainCreateInfoKHR" structextends="VkSwapchainCreateInfoKHR">
+ <member values="VK_STRUCTURE_TYPE_DEVICE_GROUP_SWAPCHAIN_CREATE_INFO_KHR"><type>VkStructureType</type> <name>sType</name></member>
+ <member optional="true">const <type>void</type>* <name>pNext</name></member>
+ <member><type>VkDeviceGroupPresentModeFlagsKHR</type> <name>modes</name></member>
+ </type>
+ <type category="struct" name="VkDescriptorUpdateTemplateEntry">
+ <member><type>uint32_t</type> <name>dstBinding</name><comment>Binding within the destination descriptor set to write</comment></member>
+ <member><type>uint32_t</type> <name>dstArrayElement</name><comment>Array element within the destination binding to write</comment></member>
+ <member><type>uint32_t</type> <name>descriptorCount</name><comment>Number of descriptors to write</comment></member>
+ <member><type>VkDescriptorType</type> <name>descriptorType</name><comment>Descriptor type to write</comment></member>
+ <member><type>size_t</type> <name>offset</name><comment>Offset into pData where the descriptors to update are stored</comment></member>
+ <member><type>size_t</type> <name>stride</name><comment>Stride between two descriptors in pData when writing more than one descriptor</comment></member>
+ </type>
+ <type category="struct" name="VkDescriptorUpdateTemplateEntryKHR" alias="VkDescriptorUpdateTemplateEntry"/>
+ <type category="struct" name="VkDescriptorUpdateTemplateCreateInfo">
+ <member values="VK_STRUCTURE_TYPE_DESCRIPTOR_UPDATE_TEMPLATE_CREATE_INFO"><type>VkStructureType</type> <name>sType</name></member>
+ <member optional="true">const <type>void</type>* <name>pNext</name></member>
+ <member optional="true"><type>VkDescriptorUpdateTemplateCreateFlags</type> <name>flags</name></member>
+ <member><type>uint32_t</type> <name>descriptorUpdateEntryCount</name><comment>Number of descriptor update entries to use for the update template</comment></member>
+ <member len="descriptorUpdateEntryCount">const <type>VkDescriptorUpdateTemplateEntry</type>* <name>pDescriptorUpdateEntries</name><comment>Descriptor update entries for the template</comment></member>
+ <member><type>VkDescriptorUpdateTemplateType</type> <name>templateType</name></member>
+ <member noautovalidity="true"><type>VkDescriptorSetLayout</type> <name>descriptorSetLayout</name></member>
+ <member noautovalidity="true"><type>VkPipelineBindPoint</type> <name>pipelineBindPoint</name></member>
+ <member noautovalidity="true"><type>VkPipelineLayout</type> <name>pipelineLayout</name><comment>If used for push descriptors, this is the only allowed layout</comment></member>
+ <member noautovalidity="true"><type>uint32_t</type> <name>set</name></member>
+ </type>
+ <type category="struct" name="VkDescriptorUpdateTemplateCreateInfoKHR" alias="VkDescriptorUpdateTemplateCreateInfo"/>
+ <type category="struct" name="VkXYColorEXT" comment="Chromaticity coordinate">
+ <member><type>float</type> <name>x</name></member>
+ <member><type>float</type> <name>y</name></member>
+ </type>
+ <type category="struct" name="VkPhysicalDevicePresentIdFeaturesKHR" structextends="VkPhysicalDeviceFeatures2,VkDeviceCreateInfo">
+ <member values="VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_PRESENT_ID_FEATURES_KHR"><type>VkStructureType</type> <name>sType</name></member>
+ <member optional="true"><type>void</type>* <name>pNext</name></member>
+ <member><type>VkBool32</type> <name>presentId</name><comment>Present ID in VkPresentInfoKHR</comment></member>
+ </type>
+ <type category="struct" name="VkPresentIdKHR" structextends="VkPresentInfoKHR">
+ <member values="VK_STRUCTURE_TYPE_PRESENT_ID_KHR"><type>VkStructureType</type> <name>sType</name></member>
+ <member optional="true">const <type>void</type>* <name>pNext</name></member>
+ <member><type>uint32_t</type> <name>swapchainCount</name><comment>Copy of VkPresentInfoKHR::swapchainCount</comment></member>
+ <member len="swapchainCount" optional="true">const <type>uint64_t</type>* <name>pPresentIds</name><comment>Present ID values for each swapchain</comment></member>
+ </type>
+ <type category="struct" name="VkPhysicalDevicePresentWaitFeaturesKHR" structextends="VkPhysicalDeviceFeatures2,VkDeviceCreateInfo">
+ <member values="VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_PRESENT_WAIT_FEATURES_KHR"><type>VkStructureType</type> <name>sType</name></member>
+ <member optional="true"><type>void</type>* <name>pNext</name></member>
+ <member><type>VkBool32</type> <name>presentWait</name><comment>vkWaitForPresentKHR is supported</comment></member>
+ </type>
+ <type category="struct" name="VkHdrMetadataEXT">
+ <comment>Display primary in chromaticity coordinates</comment>
+ <member values="VK_STRUCTURE_TYPE_HDR_METADATA_EXT"><type>VkStructureType</type> <name>sType</name></member>
+ <member optional="true">const <type>void</type>* <name>pNext</name></member>
+ <comment> From SMPTE 2086</comment>
+ <member noautovalidity="true"><type>VkXYColorEXT</type> <name>displayPrimaryRed</name><comment>Display primary's Red</comment></member>
+ <member noautovalidity="true"><type>VkXYColorEXT</type> <name>displayPrimaryGreen</name><comment>Display primary's Green</comment></member>
+ <member noautovalidity="true"><type>VkXYColorEXT</type> <name>displayPrimaryBlue</name><comment>Display primary's Blue</comment></member>
+ <member noautovalidity="true"><type>VkXYColorEXT</type> <name>whitePoint</name><comment>Display primary's Blue</comment></member>
+ <member noautovalidity="true"><type>float</type> <name>maxLuminance</name><comment>Display maximum luminance</comment></member>
+ <member noautovalidity="true"><type>float</type> <name>minLuminance</name><comment>Display minimum luminance</comment></member>
+ <comment> From CTA 861.3</comment>
+ <member noautovalidity="true"><type>float</type> <name>maxContentLightLevel</name><comment>Content maximum luminance</comment></member>
+ <member noautovalidity="true"><type>float</type> <name>maxFrameAverageLightLevel</name></member>
+ </type>
+ <type category="struct" name="VkDisplayNativeHdrSurfaceCapabilitiesAMD" returnedonly="true" structextends="VkSurfaceCapabilities2KHR">
+ <member values="VK_STRUCTURE_TYPE_DISPLAY_NATIVE_HDR_SURFACE_CAPABILITIES_AMD"><type>VkStructureType</type> <name>sType</name></member>
+ <member optional="true"><type>void</type>* <name>pNext</name></member>
+ <member><type>VkBool32</type> <name>localDimmingSupport</name></member>
+ </type>
+ <type category="struct" name="VkSwapchainDisplayNativeHdrCreateInfoAMD" structextends="VkSwapchainCreateInfoKHR">
+ <member values="VK_STRUCTURE_TYPE_SWAPCHAIN_DISPLAY_NATIVE_HDR_CREATE_INFO_AMD"><type>VkStructureType</type> <name>sType</name></member>
+ <member optional="true">const <type>void</type>* <name>pNext</name></member>
+ <member><type>VkBool32</type> <name>localDimmingEnable</name></member>
+ </type>
+ <type category="struct" name="VkRefreshCycleDurationGOOGLE" returnedonly="true">
+ <member><type>uint64_t</type> <name>refreshDuration</name><comment>Number of nanoseconds from the start of one refresh cycle to the next</comment></member>
+ </type>
+ <type category="struct" name="VkPastPresentationTimingGOOGLE" returnedonly="true">
+ <member><type>uint32_t</type> <name>presentID</name><comment>Application-provided identifier, previously given to vkQueuePresentKHR</comment></member>
+ <member><type>uint64_t</type> <name>desiredPresentTime</name><comment>Earliest time an image should have been presented, previously given to vkQueuePresentKHR</comment></member>
+ <member><type>uint64_t</type> <name>actualPresentTime</name><comment>Time the image was actually displayed</comment></member>
+ <member><type>uint64_t</type> <name>earliestPresentTime</name><comment>Earliest time the image could have been displayed</comment></member>
+ <member><type>uint64_t</type> <name>presentMargin</name><comment>How early vkQueuePresentKHR was processed vs. how soon it needed to be and make earliestPresentTime</comment></member>
+ </type>
+ <type category="struct" name="VkPresentTimesInfoGOOGLE" structextends="VkPresentInfoKHR">
+ <member values="VK_STRUCTURE_TYPE_PRESENT_TIMES_INFO_GOOGLE"><type>VkStructureType</type> <name>sType</name></member>
+ <member optional="true">const <type>void</type>* <name>pNext</name></member>
+ <member><type>uint32_t</type> <name>swapchainCount</name><comment>Copy of VkPresentInfoKHR::swapchainCount</comment></member>
+ <member len="swapchainCount" optional="true">const <type>VkPresentTimeGOOGLE</type>* <name>pTimes</name><comment>The earliest times to present images</comment></member>
+ </type>
+ <type category="struct" name="VkPresentTimeGOOGLE">
+ <member><type>uint32_t</type> <name>presentID</name><comment>Application-provided identifier</comment></member>
+ <member><type>uint64_t</type> <name>desiredPresentTime</name><comment>Earliest time an image should be presented</comment></member>
+ </type>
+ <type category="struct" name="VkIOSSurfaceCreateInfoMVK">
+ <member values="VK_STRUCTURE_TYPE_IOS_SURFACE_CREATE_INFO_MVK"><type>VkStructureType</type> <name>sType</name></member>
+ <member optional="true">const <type>void</type>* <name>pNext</name></member>
+ <member optional="true"><type>VkIOSSurfaceCreateFlagsMVK</type> <name>flags</name></member>
+ <member noautovalidity="true">const <type>void</type>* <name>pView</name></member>
+ </type>
+ <type category="struct" name="VkMacOSSurfaceCreateInfoMVK">
+ <member values="VK_STRUCTURE_TYPE_MACOS_SURFACE_CREATE_INFO_MVK"><type>VkStructureType</type> <name>sType</name></member>
+ <member optional="true">const <type>void</type>* <name>pNext</name></member>
+ <member optional="true"><type>VkMacOSSurfaceCreateFlagsMVK</type> <name>flags</name></member>
+ <member noautovalidity="true">const <type>void</type>* <name>pView</name></member>
+ </type>
+ <type category="struct" name="VkMetalSurfaceCreateInfoEXT">
+ <member values="VK_STRUCTURE_TYPE_METAL_SURFACE_CREATE_INFO_EXT"><type>VkStructureType</type> <name>sType</name></member>
+ <member optional="true">const <type>void</type>* <name>pNext</name></member>
+ <member optional="true"><type>VkMetalSurfaceCreateFlagsEXT</type> <name>flags</name></member>
+ <member noautovalidity="true">const <type>CAMetalLayer</type>* <name>pLayer</name></member>
+ </type>
+ <type category="struct" name="VkViewportWScalingNV">
+ <member><type>float</type> <name>xcoeff</name></member>
+ <member><type>float</type> <name>ycoeff</name></member>
+ </type>
+ <type category="struct" name="VkPipelineViewportWScalingStateCreateInfoNV" structextends="VkPipelineViewportStateCreateInfo">
+ <member values="VK_STRUCTURE_TYPE_PIPELINE_VIEWPORT_W_SCALING_STATE_CREATE_INFO_NV"><type>VkStructureType</type> <name>sType</name></member>
+ <member optional="true">const <type>void</type>* <name>pNext</name></member>
+ <member><type>VkBool32</type> <name>viewportWScalingEnable</name></member>
+ <member><type>uint32_t</type> <name>viewportCount</name></member>
+ <member noautovalidity="true" optional="true" len="viewportCount">const <type>VkViewportWScalingNV</type>* <name>pViewportWScalings</name></member>
+ </type>
+ <type category="struct" name="VkViewportSwizzleNV">
+ <member><type>VkViewportCoordinateSwizzleNV</type> <name>x</name></member>
+ <member><type>VkViewportCoordinateSwizzleNV</type> <name>y</name></member>
+ <member><type>VkViewportCoordinateSwizzleNV</type> <name>z</name></member>
+ <member><type>VkViewportCoordinateSwizzleNV</type> <name>w</name></member>
+ </type>
+ <type category="struct" name="VkPipelineViewportSwizzleStateCreateInfoNV" structextends="VkPipelineViewportStateCreateInfo">
+ <member values="VK_STRUCTURE_TYPE_PIPELINE_VIEWPORT_SWIZZLE_STATE_CREATE_INFO_NV"><type>VkStructureType</type> <name>sType</name></member>
+ <member optional="true">const <type>void</type>* <name>pNext</name></member>
+ <member optional="true"><type>VkPipelineViewportSwizzleStateCreateFlagsNV</type> <name>flags</name></member>
+ <member><type>uint32_t</type> <name>viewportCount</name></member>
+ <member len="viewportCount">const <type>VkViewportSwizzleNV</type>* <name>pViewportSwizzles</name></member>
+ </type>
+ <type category="struct" name="VkPhysicalDeviceDiscardRectanglePropertiesEXT" returnedonly="true" structextends="VkPhysicalDeviceProperties2">
+ <member values="VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_DISCARD_RECTANGLE_PROPERTIES_EXT"><type>VkStructureType</type> <name>sType</name></member>
+ <member optional="true"><type>void</type>* <name>pNext</name></member>
+ <member limittype="max"><type>uint32_t</type> <name>maxDiscardRectangles</name><comment>max number of active discard rectangles</comment></member>
+ </type>
+ <type category="struct" name="VkPipelineDiscardRectangleStateCreateInfoEXT" structextends="VkGraphicsPipelineCreateInfo">
+ <member values="VK_STRUCTURE_TYPE_PIPELINE_DISCARD_RECTANGLE_STATE_CREATE_INFO_EXT"><type>VkStructureType</type> <name>sType</name></member>
+ <member optional="true">const <type>void</type>* <name>pNext</name></member>
+ <member optional="true"><type>VkPipelineDiscardRectangleStateCreateFlagsEXT</type> <name>flags</name></member>
+ <member><type>VkDiscardRectangleModeEXT</type> <name>discardRectangleMode</name></member>
+ <member optional="true"><type>uint32_t</type> <name>discardRectangleCount</name></member>
+ <member noautovalidity="true" len="discardRectangleCount">const <type>VkRect2D</type>* <name>pDiscardRectangles</name></member>
+ </type>
+ <type category="struct" name="VkPhysicalDeviceMultiviewPerViewAttributesPropertiesNVX" returnedonly="true" structextends="VkPhysicalDeviceProperties2">
+ <member values="VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_MULTIVIEW_PER_VIEW_ATTRIBUTES_PROPERTIES_NVX"><type>VkStructureType</type> <name>sType</name></member>
+ <member optional="true"><type>void</type>* <name>pNext</name></member>
+ <member limittype="bitmask"><type>VkBool32</type> <name>perViewPositionAllComponents</name></member>
+ </type>
+ <type category="struct" name="VkInputAttachmentAspectReference">
+ <member><type>uint32_t</type> <name>subpass</name></member>
+ <member><type>uint32_t</type> <name>inputAttachmentIndex</name></member>
+ <member><type>VkImageAspectFlags</type> <name>aspectMask</name></member>
+ </type>
+ <type category="struct" name="VkInputAttachmentAspectReferenceKHR" alias="VkInputAttachmentAspectReference"/>
+ <type category="struct" name="VkRenderPassInputAttachmentAspectCreateInfo" structextends="VkRenderPassCreateInfo">
+ <member values="VK_STRUCTURE_TYPE_RENDER_PASS_INPUT_ATTACHMENT_ASPECT_CREATE_INFO"><type>VkStructureType</type> <name>sType</name></member>
+ <member optional="true">const <type>void</type>* <name>pNext</name></member>
+ <member><type>uint32_t</type> <name>aspectReferenceCount</name></member>
+ <member len="aspectReferenceCount">const <type>VkInputAttachmentAspectReference</type>* <name>pAspectReferences</name></member>
+ </type>
+ <type category="struct" name="VkRenderPassInputAttachmentAspectCreateInfoKHR" alias="VkRenderPassInputAttachmentAspectCreateInfo"/>
+ <type category="struct" name="VkPhysicalDeviceSurfaceInfo2KHR">
+ <member values="VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_SURFACE_INFO_2_KHR"><type>VkStructureType</type> <name>sType</name></member>
+ <member optional="true">const <type>void</type>* <name>pNext</name></member>
+ <member optional="true"><type>VkSurfaceKHR</type> <name>surface</name></member>
+ </type>
+ <type category="struct" name="VkSurfaceCapabilities2KHR" returnedonly="true">
+ <member values="VK_STRUCTURE_TYPE_SURFACE_CAPABILITIES_2_KHR"><type>VkStructureType</type> <name>sType</name></member>
+ <member optional="true"><type>void</type>* <name>pNext</name></member>
+ <member><type>VkSurfaceCapabilitiesKHR</type> <name>surfaceCapabilities</name></member>
+ </type>
+ <type category="struct" name="VkSurfaceFormat2KHR" returnedonly="true">
+ <member values="VK_STRUCTURE_TYPE_SURFACE_FORMAT_2_KHR"><type>VkStructureType</type> <name>sType</name></member>
+ <member optional="true"><type>void</type>* <name>pNext</name></member>
+ <member><type>VkSurfaceFormatKHR</type> <name>surfaceFormat</name></member>
+ </type>
+ <type category="struct" name="VkDisplayProperties2KHR" returnedonly="true">
+ <member values="VK_STRUCTURE_TYPE_DISPLAY_PROPERTIES_2_KHR"><type>VkStructureType</type> <name>sType</name></member>
+ <member optional="true"><type>void</type>* <name>pNext</name></member>
+ <member><type>VkDisplayPropertiesKHR</type> <name>displayProperties</name></member>
+ </type>
+ <type category="struct" name="VkDisplayPlaneProperties2KHR" returnedonly="true">
+ <member values="VK_STRUCTURE_TYPE_DISPLAY_PLANE_PROPERTIES_2_KHR"><type>VkStructureType</type> <name>sType</name></member>
+ <member optional="true"><type>void</type>* <name>pNext</name></member>
+ <member><type>VkDisplayPlanePropertiesKHR</type> <name>displayPlaneProperties</name></member>
+ </type>
+ <type category="struct" name="VkDisplayModeProperties2KHR" returnedonly="true">
+ <member values="VK_STRUCTURE_TYPE_DISPLAY_MODE_PROPERTIES_2_KHR"><type>VkStructureType</type> <name>sType</name></member>
+ <member optional="true"><type>void</type>* <name>pNext</name></member>
+ <member><type>VkDisplayModePropertiesKHR</type> <name>displayModeProperties</name></member>
+ </type>
+ <type category="struct" name="VkDisplayPlaneInfo2KHR">
+ <member values="VK_STRUCTURE_TYPE_DISPLAY_PLANE_INFO_2_KHR"><type>VkStructureType</type> <name>sType</name></member>
+ <member optional="true">const <type>void</type>* <name>pNext</name></member>
+ <member externsync="true"><type>VkDisplayModeKHR</type> <name>mode</name></member>
+ <member><type>uint32_t</type> <name>planeIndex</name></member>
+ </type>
+ <type category="struct" name="VkDisplayPlaneCapabilities2KHR" returnedonly="true">
+ <member values="VK_STRUCTURE_TYPE_DISPLAY_PLANE_CAPABILITIES_2_KHR"><type>VkStructureType</type> <name>sType</name></member>
+ <member optional="true"><type>void</type>* <name>pNext</name></member>
+ <member><type>VkDisplayPlaneCapabilitiesKHR</type> <name>capabilities</name></member>
+ </type>
+ <type category="struct" name="VkSharedPresentSurfaceCapabilitiesKHR" returnedonly="true" structextends="VkSurfaceCapabilities2KHR">
+ <member values="VK_STRUCTURE_TYPE_SHARED_PRESENT_SURFACE_CAPABILITIES_KHR"><type>VkStructureType</type> <name>sType</name></member>
+ <member optional="true"><type>void</type>* <name>pNext</name></member>
+ <member optional="true"><type>VkImageUsageFlags</type> <name>sharedPresentSupportedUsageFlags</name><comment>Supported image usage flags if swapchain created using a shared present mode</comment></member>
+ </type>
+ <type category="struct" name="VkPhysicalDevice16BitStorageFeatures" structextends="VkPhysicalDeviceFeatures2,VkDeviceCreateInfo">
+ <member values="VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_16BIT_STORAGE_FEATURES"><type>VkStructureType</type> <name>sType</name></member>
+ <member optional="true"><type>void</type>* <name>pNext</name></member>
+ <member><type>VkBool32</type> <name>storageBuffer16BitAccess</name><comment>16-bit integer/floating-point variables supported in BufferBlock</comment></member>
+ <member><type>VkBool32</type> <name>uniformAndStorageBuffer16BitAccess</name><comment>16-bit integer/floating-point variables supported in BufferBlock and Block</comment></member>
+ <member><type>VkBool32</type> <name>storagePushConstant16</name><comment>16-bit integer/floating-point variables supported in PushConstant</comment></member>
+ <member><type>VkBool32</type> <name>storageInputOutput16</name><comment>16-bit integer/floating-point variables supported in shader inputs and outputs</comment></member>
+ </type>
+ <type category="struct" name="VkPhysicalDevice16BitStorageFeaturesKHR" alias="VkPhysicalDevice16BitStorageFeatures"/>
+ <type category="struct" name="VkPhysicalDeviceSubgroupProperties" returnedonly="true" structextends="VkPhysicalDeviceProperties2">
+ <member values="VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_SUBGROUP_PROPERTIES"><type>VkStructureType</type> <name>sType</name></member>
+ <member optional="true"><type>void</type>* <name>pNext</name></member>
+ <member limittype="min,pot" noautovalidity="true"><type>uint32_t</type> <name>subgroupSize</name><comment>The size of a subgroup for this queue.</comment></member>
+ <member limittype="bitmask" noautovalidity="true"><type>VkShaderStageFlags</type> <name>supportedStages</name><comment>Bitfield of what shader stages support subgroup operations</comment></member>
+ <member limittype="bitmask" noautovalidity="true"><type>VkSubgroupFeatureFlags</type> <name>supportedOperations</name><comment>Bitfield of what subgroup operations are supported.</comment></member>
+ <member limittype="bitmask" noautovalidity="true"><type>VkBool32</type> <name>quadOperationsInAllStages</name><comment>Flag to specify whether quad operations are available in all stages.</comment></member>
+ </type>
+ <type category="struct" name="VkPhysicalDeviceShaderSubgroupExtendedTypesFeatures" structextends="VkPhysicalDeviceFeatures2,VkDeviceCreateInfo">
+ <member values="VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_SHADER_SUBGROUP_EXTENDED_TYPES_FEATURES"><type>VkStructureType</type> <name>sType</name></member>
+ <member optional="true"><type>void</type>* <name>pNext</name></member>
+ <member noautovalidity="true"><type>VkBool32</type> <name>shaderSubgroupExtendedTypes</name><comment>Flag to specify whether subgroup operations with extended types are supported</comment></member>
+ </type>
+ <type category="struct" name="VkPhysicalDeviceShaderSubgroupExtendedTypesFeaturesKHR" alias="VkPhysicalDeviceShaderSubgroupExtendedTypesFeatures"/>
+ <type category="struct" name="VkBufferMemoryRequirementsInfo2">
+ <member values="VK_STRUCTURE_TYPE_BUFFER_MEMORY_REQUIREMENTS_INFO_2"><type>VkStructureType</type> <name>sType</name></member>
+ <member optional="true">const <type>void</type>* <name>pNext</name></member>
+ <member><type>VkBuffer</type> <name>buffer</name></member>
+ </type>
+ <type category="struct" name="VkBufferMemoryRequirementsInfo2KHR" alias="VkBufferMemoryRequirementsInfo2"/>
+ <type category="struct" name="VkDeviceBufferMemoryRequirements">
+ <member values="VK_STRUCTURE_TYPE_DEVICE_BUFFER_MEMORY_REQUIREMENTS"><type>VkStructureType</type> <name>sType</name></member>
+ <member optional="true">const <type>void</type>* <name>pNext</name></member>
+ <member>const <type>VkBufferCreateInfo</type>* <name>pCreateInfo</name></member>
+ </type>
+ <type category="struct" name="VkDeviceBufferMemoryRequirementsKHR" alias="VkDeviceBufferMemoryRequirements"/>
+ <type category="struct" name="VkImageMemoryRequirementsInfo2">
+ <member values="VK_STRUCTURE_TYPE_IMAGE_MEMORY_REQUIREMENTS_INFO_2"><type>VkStructureType</type> <name>sType</name></member>
+ <member optional="true">const <type>void</type>* <name>pNext</name></member>
+ <member><type>VkImage</type> <name>image</name></member>
+ </type>
+ <type category="struct" name="VkImageMemoryRequirementsInfo2KHR" alias="VkImageMemoryRequirementsInfo2"/>
+ <type category="struct" name="VkImageSparseMemoryRequirementsInfo2">
+ <member values="VK_STRUCTURE_TYPE_IMAGE_SPARSE_MEMORY_REQUIREMENTS_INFO_2"><type>VkStructureType</type> <name>sType</name></member>
+ <member optional="true">const <type>void</type>* <name>pNext</name></member>
+ <member><type>VkImage</type> <name>image</name></member>
+ </type>
+ <type category="struct" name="VkImageSparseMemoryRequirementsInfo2KHR" alias="VkImageSparseMemoryRequirementsInfo2"/>
+ <type category="struct" name="VkDeviceImageMemoryRequirements">
+ <member values="VK_STRUCTURE_TYPE_DEVICE_IMAGE_MEMORY_REQUIREMENTS"><type>VkStructureType</type> <name>sType</name></member>
+ <member optional="true">const <type>void</type>* <name>pNext</name></member>
+ <member>const <type>VkImageCreateInfo</type>* <name>pCreateInfo</name></member>
+ <member optional="true"><type>VkImageAspectFlagBits</type> <name>planeAspect</name></member>
+ </type>
+ <type category="struct" name="VkDeviceImageMemoryRequirementsKHR" alias="VkDeviceImageMemoryRequirements"/>
+ <type category="struct" name="VkMemoryRequirements2" returnedonly="true">
+ <member values="VK_STRUCTURE_TYPE_MEMORY_REQUIREMENTS_2"><type>VkStructureType</type> <name>sType</name></member>
+ <member optional="true"><type>void</type>* <name>pNext</name></member>
+ <member><type>VkMemoryRequirements</type> <name>memoryRequirements</name></member>
+ </type>
+ <type category="struct" name="VkMemoryRequirements2KHR" alias="VkMemoryRequirements2"/>
+ <type category="struct" name="VkSparseImageMemoryRequirements2" returnedonly="true">
+ <member values="VK_STRUCTURE_TYPE_SPARSE_IMAGE_MEMORY_REQUIREMENTS_2"><type>VkStructureType</type> <name>sType</name></member>
+ <member optional="true"><type>void</type>* <name>pNext</name></member>
+ <member><type>VkSparseImageMemoryRequirements</type> <name>memoryRequirements</name></member>
+ </type>
+ <type category="struct" name="VkSparseImageMemoryRequirements2KHR" alias="VkSparseImageMemoryRequirements2"/>
+ <type category="struct" name="VkPhysicalDevicePointClippingProperties" returnedonly="true" structextends="VkPhysicalDeviceProperties2">
+ <member values="VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_POINT_CLIPPING_PROPERTIES"><type>VkStructureType</type> <name>sType</name></member>
+ <member optional="true"><type>void</type>* <name>pNext</name></member>
+ <member limittype="exact"><type>VkPointClippingBehavior</type> <name>pointClippingBehavior</name></member>
+ </type>
+ <type category="struct" name="VkPhysicalDevicePointClippingPropertiesKHR" alias="VkPhysicalDevicePointClippingProperties"/>
+ <type category="struct" name="VkMemoryDedicatedRequirements" returnedonly="true" structextends="VkMemoryRequirements2">
+ <member values="VK_STRUCTURE_TYPE_MEMORY_DEDICATED_REQUIREMENTS"><type>VkStructureType</type> <name>sType</name></member>
+ <member optional="true"><type>void</type>* <name>pNext</name></member>
+ <member><type>VkBool32</type> <name>prefersDedicatedAllocation</name></member>
+ <member><type>VkBool32</type> <name>requiresDedicatedAllocation</name></member>
+ </type>
+ <type category="struct" name="VkMemoryDedicatedRequirementsKHR" alias="VkMemoryDedicatedRequirements"/>
+ <type category="struct" name="VkMemoryDedicatedAllocateInfo" structextends="VkMemoryAllocateInfo">
+ <member values="VK_STRUCTURE_TYPE_MEMORY_DEDICATED_ALLOCATE_INFO"><type>VkStructureType</type> <name>sType</name></member>
+ <member optional="true">const <type>void</type>* <name>pNext</name></member>
+ <member optional="true"><type>VkImage</type> <name>image</name><comment>Image that this allocation will be bound to</comment></member>
+ <member optional="true"><type>VkBuffer</type> <name>buffer</name><comment>Buffer that this allocation will be bound to</comment></member>
+ </type>
+ <type category="struct" name="VkMemoryDedicatedAllocateInfoKHR" alias="VkMemoryDedicatedAllocateInfo"/>
+ <type category="struct" name="VkImageViewUsageCreateInfo" structextends="VkImageViewCreateInfo">
+ <member values="VK_STRUCTURE_TYPE_IMAGE_VIEW_USAGE_CREATE_INFO"><type>VkStructureType</type> <name>sType</name></member>
+ <member optional="true">const <type>void</type>* <name>pNext</name></member>
+ <member><type>VkImageUsageFlags</type> <name>usage</name></member>
+ </type>
+ <type category="struct" name="VkImageViewUsageCreateInfoKHR" alias="VkImageViewUsageCreateInfo"/>
+ <type category="struct" name="VkPipelineTessellationDomainOriginStateCreateInfo" structextends="VkPipelineTessellationStateCreateInfo">
+ <member values="VK_STRUCTURE_TYPE_PIPELINE_TESSELLATION_DOMAIN_ORIGIN_STATE_CREATE_INFO"><type>VkStructureType</type> <name>sType</name></member>
+ <member optional="true">const <type>void</type>* <name>pNext</name></member>
+ <member><type>VkTessellationDomainOrigin</type> <name>domainOrigin</name></member>
+ </type>
+ <type category="struct" name="VkPipelineTessellationDomainOriginStateCreateInfoKHR" alias="VkPipelineTessellationDomainOriginStateCreateInfo"/>
+ <type category="struct" name="VkSamplerYcbcrConversionInfo" structextends="VkSamplerCreateInfo,VkImageViewCreateInfo">
+ <member values="VK_STRUCTURE_TYPE_SAMPLER_YCBCR_CONVERSION_INFO"><type>VkStructureType</type> <name>sType</name></member>
+ <member optional="true">const <type>void</type>* <name>pNext</name></member>
+ <member><type>VkSamplerYcbcrConversion</type> <name>conversion</name></member>
+ </type>
+ <type category="struct" name="VkSamplerYcbcrConversionInfoKHR" alias="VkSamplerYcbcrConversionInfo"/>
+ <type category="struct" name="VkSamplerYcbcrConversionCreateInfo">
+ <member values="VK_STRUCTURE_TYPE_SAMPLER_YCBCR_CONVERSION_CREATE_INFO"><type>VkStructureType</type> <name>sType</name></member>
+ <member optional="true">const <type>void</type>* <name>pNext</name></member>
+ <member><type>VkFormat</type> <name>format</name></member>
+ <member><type>VkSamplerYcbcrModelConversion</type> <name>ycbcrModel</name></member>
+ <member><type>VkSamplerYcbcrRange</type> <name>ycbcrRange</name></member>
+ <member><type>VkComponentMapping</type> <name>components</name></member>
+ <member><type>VkChromaLocation</type> <name>xChromaOffset</name></member>
+ <member><type>VkChromaLocation</type> <name>yChromaOffset</name></member>
+ <member><type>VkFilter</type> <name>chromaFilter</name></member>
+ <member><type>VkBool32</type> <name>forceExplicitReconstruction</name></member>
+ </type>
+ <type category="struct" name="VkSamplerYcbcrConversionCreateInfoKHR" alias="VkSamplerYcbcrConversionCreateInfo"/>
+ <type category="struct" name="VkBindImagePlaneMemoryInfo" structextends="VkBindImageMemoryInfo">
+ <member values="VK_STRUCTURE_TYPE_BIND_IMAGE_PLANE_MEMORY_INFO"><type>VkStructureType</type> <name>sType</name></member>
+ <member optional="true">const <type>void</type>* <name>pNext</name></member>
+ <member><type>VkImageAspectFlagBits</type> <name>planeAspect</name></member>
+ </type>
+ <type category="struct" name="VkBindImagePlaneMemoryInfoKHR" alias="VkBindImagePlaneMemoryInfo"/>
+ <type category="struct" name="VkImagePlaneMemoryRequirementsInfo" structextends="VkImageMemoryRequirementsInfo2">
+ <member values="VK_STRUCTURE_TYPE_IMAGE_PLANE_MEMORY_REQUIREMENTS_INFO"><type>VkStructureType</type> <name>sType</name></member>
+ <member optional="true">const <type>void</type>* <name>pNext</name></member>
+ <member><type>VkImageAspectFlagBits</type> <name>planeAspect</name></member>
+ </type>
+ <type category="struct" name="VkImagePlaneMemoryRequirementsInfoKHR" alias="VkImagePlaneMemoryRequirementsInfo"/>
+ <type category="struct" name="VkPhysicalDeviceSamplerYcbcrConversionFeatures" structextends="VkPhysicalDeviceFeatures2,VkDeviceCreateInfo">
+ <member values="VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_SAMPLER_YCBCR_CONVERSION_FEATURES"><type>VkStructureType</type> <name>sType</name></member>
+ <member optional="true"><type>void</type>* <name>pNext</name></member>
+ <member><type>VkBool32</type> <name>samplerYcbcrConversion</name><comment>Sampler color conversion supported</comment></member>
+ </type>
+ <type category="struct" name="VkPhysicalDeviceSamplerYcbcrConversionFeaturesKHR" alias="VkPhysicalDeviceSamplerYcbcrConversionFeatures"/>
+ <type category="struct" name="VkSamplerYcbcrConversionImageFormatProperties" returnedonly="true" structextends="VkImageFormatProperties2">
+ <member values="VK_STRUCTURE_TYPE_SAMPLER_YCBCR_CONVERSION_IMAGE_FORMAT_PROPERTIES"><type>VkStructureType</type> <name>sType</name></member>
+ <member optional="true"><type>void</type>* <name>pNext</name></member>
+ <member><type>uint32_t</type> <name>combinedImageSamplerDescriptorCount</name></member>
+ </type>
+ <type category="struct" name="VkSamplerYcbcrConversionImageFormatPropertiesKHR" alias="VkSamplerYcbcrConversionImageFormatProperties"/>
+ <type category="struct" name="VkTextureLODGatherFormatPropertiesAMD" returnedonly="true" structextends="VkImageFormatProperties2">
+ <member values="VK_STRUCTURE_TYPE_TEXTURE_LOD_GATHER_FORMAT_PROPERTIES_AMD"><type>VkStructureType</type> <name>sType</name></member>
+ <member optional="true"><type>void</type>* <name>pNext</name></member>
+ <member><type>VkBool32</type> <name>supportsTextureGatherLODBiasAMD</name></member>
+ </type>
+ <type category="struct" name="VkConditionalRenderingBeginInfoEXT">
+ <member values="VK_STRUCTURE_TYPE_CONDITIONAL_RENDERING_BEGIN_INFO_EXT"><type>VkStructureType</type> <name>sType</name></member>
+ <member optional="true">const <type>void</type>* <name>pNext</name></member>
+ <member><type>VkBuffer</type> <name>buffer</name></member>
+ <member><type>VkDeviceSize</type> <name>offset</name></member>
+ <member optional="true"><type>VkConditionalRenderingFlagsEXT</type> <name>flags</name></member>
+ </type>
+ <type category="struct" name="VkProtectedSubmitInfo" structextends="VkSubmitInfo">
+ <member values="VK_STRUCTURE_TYPE_PROTECTED_SUBMIT_INFO"><type>VkStructureType</type> <name>sType</name></member>
+ <member optional="true">const <type>void</type>* <name>pNext</name></member>
+ <member><type>VkBool32</type> <name>protectedSubmit</name><comment>Submit protected command buffers</comment></member>
+ </type>
+ <type category="struct" name="VkPhysicalDeviceProtectedMemoryFeatures" structextends="VkPhysicalDeviceFeatures2,VkDeviceCreateInfo">
+ <member values="VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_PROTECTED_MEMORY_FEATURES"><type>VkStructureType</type> <name>sType</name></member>
+ <member optional="true"><type>void</type>* <name>pNext</name></member>
+ <member><type>VkBool32</type> <name>protectedMemory</name></member>
+ </type>
+ <type category="struct" name="VkPhysicalDeviceProtectedMemoryProperties" returnedonly="true" structextends="VkPhysicalDeviceProperties2">
+ <member values="VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_PROTECTED_MEMORY_PROPERTIES"><type>VkStructureType</type> <name>sType</name></member>
+ <member optional="true"><type>void</type>* <name>pNext</name></member>
+ <member limittype="exact"><type>VkBool32</type> <name>protectedNoFault</name></member>
+ </type>
+ <type category="struct" name="VkDeviceQueueInfo2">
+ <member values="VK_STRUCTURE_TYPE_DEVICE_QUEUE_INFO_2"><type>VkStructureType</type> <name>sType</name></member>
+ <member optional="true">const <type>void</type>* <name>pNext</name></member>
+ <member optional="true"><type>VkDeviceQueueCreateFlags</type> <name>flags</name></member>
+ <member><type>uint32_t</type> <name>queueFamilyIndex</name></member>
+ <member><type>uint32_t</type> <name>queueIndex</name></member>
+ </type>
+ <type category="struct" name="VkPipelineCoverageToColorStateCreateInfoNV" structextends="VkPipelineMultisampleStateCreateInfo">
+ <member values="VK_STRUCTURE_TYPE_PIPELINE_COVERAGE_TO_COLOR_STATE_CREATE_INFO_NV"><type>VkStructureType</type> <name>sType</name></member>
+ <member optional="true">const <type>void</type>* <name>pNext</name></member>
+ <member optional="true"><type>VkPipelineCoverageToColorStateCreateFlagsNV</type> <name>flags</name></member>
+ <member><type>VkBool32</type> <name>coverageToColorEnable</name></member>
+ <member optional="true"><type>uint32_t</type> <name>coverageToColorLocation</name></member>
+ </type>
+ <type category="struct" name="VkPhysicalDeviceSamplerFilterMinmaxProperties" returnedonly="true" structextends="VkPhysicalDeviceProperties2">
+ <member values="VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_SAMPLER_FILTER_MINMAX_PROPERTIES"><type>VkStructureType</type> <name>sType</name></member>
+ <member optional="true"><type>void</type>* <name>pNext</name></member>
+ <member limittype="bitmask"><type>VkBool32</type> <name>filterMinmaxSingleComponentFormats</name></member>
+ <member limittype="bitmask"><type>VkBool32</type> <name>filterMinmaxImageComponentMapping</name></member>
+ </type>
+ <type category="struct" name="VkPhysicalDeviceSamplerFilterMinmaxPropertiesEXT" alias="VkPhysicalDeviceSamplerFilterMinmaxProperties"/>
+ <type category="struct" name="VkSampleLocationEXT">
+ <member><type>float</type> <name>x</name></member>
+ <member><type>float</type> <name>y</name></member>
+ </type>
+ <type category="struct" name="VkSampleLocationsInfoEXT" structextends="VkImageMemoryBarrier,VkImageMemoryBarrier2">
+ <member values="VK_STRUCTURE_TYPE_SAMPLE_LOCATIONS_INFO_EXT"><type>VkStructureType</type> <name>sType</name></member>
+ <member optional="true">const <type>void</type>* <name>pNext</name></member>
+ <member noautovalidity="true"><type>VkSampleCountFlagBits</type> <name>sampleLocationsPerPixel</name></member>
+ <member><type>VkExtent2D</type> <name>sampleLocationGridSize</name></member>
+ <member optional="true"><type>uint32_t</type> <name>sampleLocationsCount</name></member>
+ <member len="sampleLocationsCount">const <type>VkSampleLocationEXT</type>* <name>pSampleLocations</name></member>
+ </type>
+ <type category="struct" name="VkAttachmentSampleLocationsEXT">
+ <member><type>uint32_t</type> <name>attachmentIndex</name></member>
+ <member><type>VkSampleLocationsInfoEXT</type> <name>sampleLocationsInfo</name></member>
+ </type>
+ <type category="struct" name="VkSubpassSampleLocationsEXT">
+ <member><type>uint32_t</type> <name>subpassIndex</name></member>
+ <member><type>VkSampleLocationsInfoEXT</type> <name>sampleLocationsInfo</name></member>
+ </type>
+ <type category="struct" name="VkRenderPassSampleLocationsBeginInfoEXT" structextends="VkRenderPassBeginInfo">
+ <member values="VK_STRUCTURE_TYPE_RENDER_PASS_SAMPLE_LOCATIONS_BEGIN_INFO_EXT"><type>VkStructureType</type> <name>sType</name></member>
+ <member optional="true">const <type>void</type>* <name>pNext</name></member>
+ <member optional="true"><type>uint32_t</type> <name>attachmentInitialSampleLocationsCount</name></member>
+ <member len="attachmentInitialSampleLocationsCount">const <type>VkAttachmentSampleLocationsEXT</type>* <name>pAttachmentInitialSampleLocations</name></member>
+ <member optional="true"><type>uint32_t</type> <name>postSubpassSampleLocationsCount</name></member>
+ <member len="postSubpassSampleLocationsCount">const <type>VkSubpassSampleLocationsEXT</type>* <name>pPostSubpassSampleLocations</name></member>
+ </type>
+ <type category="struct" name="VkPipelineSampleLocationsStateCreateInfoEXT" structextends="VkPipelineMultisampleStateCreateInfo">
+ <member values="VK_STRUCTURE_TYPE_PIPELINE_SAMPLE_LOCATIONS_STATE_CREATE_INFO_EXT"><type>VkStructureType</type> <name>sType</name></member>
+ <member optional="true">const <type>void</type>* <name>pNext</name></member>
+ <member><type>VkBool32</type> <name>sampleLocationsEnable</name></member>
+ <member><type>VkSampleLocationsInfoEXT</type> <name>sampleLocationsInfo</name></member>
+ </type>
+ <type category="struct" name="VkPhysicalDeviceSampleLocationsPropertiesEXT" returnedonly="true" structextends="VkPhysicalDeviceProperties2">
+ <member values="VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_SAMPLE_LOCATIONS_PROPERTIES_EXT"><type>VkStructureType</type> <name>sType</name></member>
+ <member optional="true"><type>void</type>* <name>pNext</name></member>
+ <member limittype="bitmask"><type>VkSampleCountFlags</type> <name>sampleLocationSampleCounts</name></member>
+ <member limittype="max"><type>VkExtent2D</type> <name>maxSampleLocationGridSize</name></member>
+ <member limittype="range"><type>float</type> <name>sampleLocationCoordinateRange</name>[2]</member>
+ <member limittype="bits"><type>uint32_t</type> <name>sampleLocationSubPixelBits</name></member>
+ <member limittype="bitmask"><type>VkBool32</type> <name>variableSampleLocations</name></member>
+ </type>
+ <type category="struct" name="VkMultisamplePropertiesEXT" returnedonly="true">
+ <member values="VK_STRUCTURE_TYPE_MULTISAMPLE_PROPERTIES_EXT"><type>VkStructureType</type> <name>sType</name></member>
+ <member optional="true"><type>void</type>* <name>pNext</name></member>
+ <member><type>VkExtent2D</type> <name>maxSampleLocationGridSize</name></member>
+ </type>
+ <type category="struct" name="VkSamplerReductionModeCreateInfo" structextends="VkSamplerCreateInfo">
+ <member values="VK_STRUCTURE_TYPE_SAMPLER_REDUCTION_MODE_CREATE_INFO"><type>VkStructureType</type> <name>sType</name></member>
+ <member optional="true">const <type>void</type>* <name>pNext</name></member>
+ <member><type>VkSamplerReductionMode</type> <name>reductionMode</name></member>
+ </type>
+ <type category="struct" name="VkSamplerReductionModeCreateInfoEXT" alias="VkSamplerReductionModeCreateInfo"/>
+ <type category="struct" name="VkPhysicalDeviceBlendOperationAdvancedFeaturesEXT" structextends="VkPhysicalDeviceFeatures2,VkDeviceCreateInfo">
+ <member values="VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_BLEND_OPERATION_ADVANCED_FEATURES_EXT"><type>VkStructureType</type> <name>sType</name></member>
+ <member optional="true"><type>void</type>* <name>pNext</name></member>
+ <member><type>VkBool32</type> <name>advancedBlendCoherentOperations</name></member>
+ </type>
+ <type category="struct" name="VkPhysicalDeviceMultiDrawFeaturesEXT" structextends="VkPhysicalDeviceFeatures2,VkDeviceCreateInfo">
+ <member values="VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_MULTI_DRAW_FEATURES_EXT"><type>VkStructureType</type> <name>sType</name></member>
+ <member optional="true" noautovalidity="true"><type>void</type>* <name>pNext</name></member>
+ <member><type>VkBool32</type> <name>multiDraw</name></member>
+ </type>
+ <type category="struct" name="VkPhysicalDeviceBlendOperationAdvancedPropertiesEXT" returnedonly="true" structextends="VkPhysicalDeviceProperties2">
+ <member values="VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_BLEND_OPERATION_ADVANCED_PROPERTIES_EXT"><type>VkStructureType</type> <name>sType</name></member>
+ <member optional="true"><type>void</type>* <name>pNext</name></member>
+ <member limittype="max"><type>uint32_t</type> <name>advancedBlendMaxColorAttachments</name></member>
+ <member limittype="bitmask"><type>VkBool32</type> <name>advancedBlendIndependentBlend</name></member>
+ <member limittype="bitmask"><type>VkBool32</type> <name>advancedBlendNonPremultipliedSrcColor</name></member>
+ <member limittype="bitmask"><type>VkBool32</type> <name>advancedBlendNonPremultipliedDstColor</name></member>
+ <member limittype="bitmask"><type>VkBool32</type> <name>advancedBlendCorrelatedOverlap</name></member>
+ <member limittype="bitmask"><type>VkBool32</type> <name>advancedBlendAllOperations</name></member>
+ </type>
+ <type category="struct" name="VkPipelineColorBlendAdvancedStateCreateInfoEXT" structextends="VkPipelineColorBlendStateCreateInfo">
+ <member values="VK_STRUCTURE_TYPE_PIPELINE_COLOR_BLEND_ADVANCED_STATE_CREATE_INFO_EXT"><type>VkStructureType</type> <name>sType</name></member>
+ <member optional="true">const <type>void</type>* <name>pNext</name></member>
+ <member><type>VkBool32</type> <name>srcPremultiplied</name></member>
+ <member><type>VkBool32</type> <name>dstPremultiplied</name></member>
+ <member><type>VkBlendOverlapEXT</type> <name>blendOverlap</name></member>
+ </type>
+ <type category="struct" name="VkPhysicalDeviceInlineUniformBlockFeatures" structextends="VkPhysicalDeviceFeatures2,VkDeviceCreateInfo">
+ <member values="VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_INLINE_UNIFORM_BLOCK_FEATURES"><type>VkStructureType</type> <name>sType</name></member>
+ <member optional="true"><type>void</type>* <name>pNext</name></member>
+ <member><type>VkBool32</type> <name>inlineUniformBlock</name></member>
+ <member><type>VkBool32</type> <name>descriptorBindingInlineUniformBlockUpdateAfterBind</name></member>
+ </type>
+ <type category="struct" name="VkPhysicalDeviceInlineUniformBlockFeaturesEXT" alias="VkPhysicalDeviceInlineUniformBlockFeatures"/>
+ <type category="struct" name="VkPhysicalDeviceInlineUniformBlockProperties" returnedonly="true" structextends="VkPhysicalDeviceProperties2">
+ <member values="VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_INLINE_UNIFORM_BLOCK_PROPERTIES"><type>VkStructureType</type> <name>sType</name></member>
+ <member optional="true"><type>void</type>* <name>pNext</name></member>
+ <member limittype="max"><type>uint32_t</type> <name>maxInlineUniformBlockSize</name></member>
+ <member limittype="max"><type>uint32_t</type> <name>maxPerStageDescriptorInlineUniformBlocks</name></member>
+ <member limittype="max"><type>uint32_t</type> <name>maxPerStageDescriptorUpdateAfterBindInlineUniformBlocks</name></member>
+ <member limittype="max"><type>uint32_t</type> <name>maxDescriptorSetInlineUniformBlocks</name></member>
+ <member limittype="max"><type>uint32_t</type> <name>maxDescriptorSetUpdateAfterBindInlineUniformBlocks</name></member>
+ </type>
+ <type category="struct" name="VkPhysicalDeviceInlineUniformBlockPropertiesEXT" alias="VkPhysicalDeviceInlineUniformBlockProperties"/>
+ <type category="struct" name="VkWriteDescriptorSetInlineUniformBlock" structextends="VkWriteDescriptorSet">
+ <member values="VK_STRUCTURE_TYPE_WRITE_DESCRIPTOR_SET_INLINE_UNIFORM_BLOCK"><type>VkStructureType</type> <name>sType</name></member>
+ <member optional="true">const <type>void</type>* <name>pNext</name></member>
+ <member><type>uint32_t</type> <name>dataSize</name></member>
+ <member len="dataSize">const <type>void</type>* <name>pData</name></member>
+ </type>
+ <type category="struct" name="VkWriteDescriptorSetInlineUniformBlockEXT" alias="VkWriteDescriptorSetInlineUniformBlock"/>
+ <type category="struct" name="VkDescriptorPoolInlineUniformBlockCreateInfo" structextends="VkDescriptorPoolCreateInfo">
+ <member values="VK_STRUCTURE_TYPE_DESCRIPTOR_POOL_INLINE_UNIFORM_BLOCK_CREATE_INFO"><type>VkStructureType</type> <name>sType</name></member>
+ <member optional="true">const <type>void</type>* <name>pNext</name></member>
+ <member><type>uint32_t</type> <name>maxInlineUniformBlockBindings</name></member>
+ </type>
+ <type category="struct" name="VkDescriptorPoolInlineUniformBlockCreateInfoEXT" alias="VkDescriptorPoolInlineUniformBlockCreateInfo"/>
+ <type category="struct" name="VkPipelineCoverageModulationStateCreateInfoNV" structextends="VkPipelineMultisampleStateCreateInfo">
+ <member values="VK_STRUCTURE_TYPE_PIPELINE_COVERAGE_MODULATION_STATE_CREATE_INFO_NV"><type>VkStructureType</type> <name>sType</name></member>
+ <member optional="true">const <type>void</type>* <name>pNext</name></member>
+ <member optional="true"><type>VkPipelineCoverageModulationStateCreateFlagsNV</type> <name>flags</name></member>
+ <member><type>VkCoverageModulationModeNV</type> <name>coverageModulationMode</name></member>
+ <member><type>VkBool32</type> <name>coverageModulationTableEnable</name></member>
+ <member optional="true"><type>uint32_t</type> <name>coverageModulationTableCount</name></member>
+ <member noautovalidity="true" optional="true" len="coverageModulationTableCount">const <type>float</type>* <name>pCoverageModulationTable</name></member>
+ </type>
+ <type category="struct" name="VkImageFormatListCreateInfo" structextends="VkImageCreateInfo,VkSwapchainCreateInfoKHR,VkPhysicalDeviceImageFormatInfo2">
+ <member values="VK_STRUCTURE_TYPE_IMAGE_FORMAT_LIST_CREATE_INFO"><type>VkStructureType</type> <name>sType</name></member>
+ <member optional="true">const <type>void</type>* <name>pNext</name></member>
+ <member optional="true"><type>uint32_t</type> <name>viewFormatCount</name></member>
+ <member len="viewFormatCount">const <type>VkFormat</type>* <name>pViewFormats</name></member>
+ </type>
+ <type category="struct" name="VkImageFormatListCreateInfoKHR" alias="VkImageFormatListCreateInfo"/>
+ <type category="struct" name="VkValidationCacheCreateInfoEXT">
+ <member values="VK_STRUCTURE_TYPE_VALIDATION_CACHE_CREATE_INFO_EXT"><type>VkStructureType</type> <name>sType</name></member>
+ <member optional="true">const <type>void</type>* <name>pNext</name></member>
+ <member optional="true"><type>VkValidationCacheCreateFlagsEXT</type> <name>flags</name></member>
+ <member optional="true"><type>size_t</type> <name>initialDataSize</name></member>
+ <member len="initialDataSize">const <type>void</type>* <name>pInitialData</name></member>
+ </type>
+ <type category="struct" name="VkShaderModuleValidationCacheCreateInfoEXT" structextends="VkShaderModuleCreateInfo,VkPipelineShaderStageCreateInfo">
+ <member values="VK_STRUCTURE_TYPE_SHADER_MODULE_VALIDATION_CACHE_CREATE_INFO_EXT"><type>VkStructureType</type> <name>sType</name></member>
+ <member optional="true">const <type>void</type>* <name>pNext</name></member>
+ <member><type>VkValidationCacheEXT</type> <name>validationCache</name></member>
+ </type>
+ <type category="struct" name="VkPhysicalDeviceMaintenance3Properties" returnedonly="true" structextends="VkPhysicalDeviceProperties2">
+ <member values="VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_MAINTENANCE_3_PROPERTIES"><type>VkStructureType</type> <name>sType</name></member>
+ <member optional="true"><type>void</type>* <name>pNext</name></member>
+ <member limittype="max"><type>uint32_t</type> <name>maxPerSetDescriptors</name></member>
+ <member limittype="max"><type>VkDeviceSize</type> <name>maxMemoryAllocationSize</name></member>
+ </type>
+ <type category="struct" name="VkPhysicalDeviceMaintenance3PropertiesKHR" alias="VkPhysicalDeviceMaintenance3Properties"/>
+ <type category="struct" name="VkPhysicalDeviceMaintenance4Features" structextends="VkPhysicalDeviceFeatures2,VkDeviceCreateInfo">
+ <member values="VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_MAINTENANCE_4_FEATURES"><type>VkStructureType</type> <name>sType</name></member>
+ <member optional="true"><type>void</type>* <name>pNext</name></member>
+ <member><type>VkBool32</type> <name>maintenance4</name></member>
+ </type>
+ <type category="struct" name="VkPhysicalDeviceMaintenance4FeaturesKHR" alias="VkPhysicalDeviceMaintenance4Features"/>
+ <type category="struct" name="VkPhysicalDeviceMaintenance4Properties" returnedonly="true" structextends="VkPhysicalDeviceProperties2">
+ <member values="VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_MAINTENANCE_4_PROPERTIES"><type>VkStructureType</type> <name>sType</name></member>
+ <member optional="true"><type>void</type>* <name>pNext</name></member>
+ <member limittype="max"><type>VkDeviceSize</type> <name>maxBufferSize</name></member>
+ </type>
+ <type category="struct" name="VkPhysicalDeviceMaintenance4PropertiesKHR" alias="VkPhysicalDeviceMaintenance4Properties"/>
+ <type category="struct" name="VkDescriptorSetLayoutSupport" returnedonly="true">
+ <member values="VK_STRUCTURE_TYPE_DESCRIPTOR_SET_LAYOUT_SUPPORT"><type>VkStructureType</type> <name>sType</name></member>
+ <member optional="true"><type>void</type>* <name>pNext</name></member>
+ <member><type>VkBool32</type> <name>supported</name></member>
+ </type>
+ <type category="struct" name="VkDescriptorSetLayoutSupportKHR" alias="VkDescriptorSetLayoutSupport"/>
+ <type category="struct" name="VkPhysicalDeviceShaderDrawParametersFeatures" structextends="VkPhysicalDeviceFeatures2,VkDeviceCreateInfo">
+ <member values="VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_SHADER_DRAW_PARAMETERS_FEATURES"><type>VkStructureType</type> <name>sType</name></member>
+ <member optional="true"><type>void</type>* <name>pNext</name></member>
+ <member><type>VkBool32</type> <name>shaderDrawParameters</name></member>
+ </type>
+ <type category="struct" name="VkPhysicalDeviceShaderDrawParameterFeatures" alias="VkPhysicalDeviceShaderDrawParametersFeatures"/>
+ <type category="struct" name="VkPhysicalDeviceShaderFloat16Int8Features" structextends="VkPhysicalDeviceFeatures2,VkDeviceCreateInfo">
+ <member values="VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_SHADER_FLOAT16_INT8_FEATURES"><type>VkStructureType</type> <name>sType</name></member>
+ <member optional="true"><type>void</type>* <name>pNext</name></member>
+ <member><type>VkBool32</type> <name>shaderFloat16</name><comment>16-bit floats (halfs) in shaders</comment></member>
+ <member><type>VkBool32</type> <name>shaderInt8</name><comment>8-bit integers in shaders</comment></member>
+ </type>
+ <type category="struct" name="VkPhysicalDeviceShaderFloat16Int8FeaturesKHR" alias="VkPhysicalDeviceShaderFloat16Int8Features"/>
+ <type category="struct" name="VkPhysicalDeviceFloat16Int8FeaturesKHR" alias="VkPhysicalDeviceShaderFloat16Int8Features"/>
+ <type category="struct" name="VkPhysicalDeviceFloatControlsProperties" returnedonly="true" structextends="VkPhysicalDeviceProperties2">
+ <member values="VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_FLOAT_CONTROLS_PROPERTIES"><type>VkStructureType</type> <name>sType</name></member>
+ <member optional="true"><type>void</type>* <name>pNext</name></member>
+ <member limittype="exact"><type>VkShaderFloatControlsIndependence</type> <name>denormBehaviorIndependence</name></member>
+ <member limittype="exact"><type>VkShaderFloatControlsIndependence</type> <name>roundingModeIndependence</name></member>
+ <member limittype="bitmask"><type>VkBool32</type> <name>shaderSignedZeroInfNanPreserveFloat16</name><comment>An implementation can preserve signed zero, nan, inf</comment></member>
+ <member limittype="bitmask"><type>VkBool32</type> <name>shaderSignedZeroInfNanPreserveFloat32</name><comment>An implementation can preserve signed zero, nan, inf</comment></member>
+ <member limittype="bitmask"><type>VkBool32</type> <name>shaderSignedZeroInfNanPreserveFloat64</name><comment>An implementation can preserve signed zero, nan, inf</comment></member>
+ <member limittype="bitmask"><type>VkBool32</type> <name>shaderDenormPreserveFloat16</name><comment>An implementation can preserve denormals</comment></member>
+ <member limittype="bitmask"><type>VkBool32</type> <name>shaderDenormPreserveFloat32</name><comment>An implementation can preserve denormals</comment></member>
+ <member limittype="bitmask"><type>VkBool32</type> <name>shaderDenormPreserveFloat64</name><comment>An implementation can preserve denormals</comment></member>
+ <member limittype="bitmask"><type>VkBool32</type> <name>shaderDenormFlushToZeroFloat16</name><comment>An implementation can flush to zero denormals</comment></member>
+ <member limittype="bitmask"><type>VkBool32</type> <name>shaderDenormFlushToZeroFloat32</name><comment>An implementation can flush to zero denormals</comment></member>
+ <member limittype="bitmask"><type>VkBool32</type> <name>shaderDenormFlushToZeroFloat64</name><comment>An implementation can flush to zero denormals</comment></member>
+ <member limittype="bitmask"><type>VkBool32</type> <name>shaderRoundingModeRTEFloat16</name><comment>An implementation can support RTE</comment></member>
+ <member limittype="bitmask"><type>VkBool32</type> <name>shaderRoundingModeRTEFloat32</name><comment>An implementation can support RTE</comment></member>
+ <member limittype="bitmask"><type>VkBool32</type> <name>shaderRoundingModeRTEFloat64</name><comment>An implementation can support RTE</comment></member>
+ <member limittype="bitmask"><type>VkBool32</type> <name>shaderRoundingModeRTZFloat16</name><comment>An implementation can support RTZ</comment></member>
+ <member limittype="bitmask"><type>VkBool32</type> <name>shaderRoundingModeRTZFloat32</name><comment>An implementation can support RTZ</comment></member>
+ <member limittype="bitmask"><type>VkBool32</type> <name>shaderRoundingModeRTZFloat64</name><comment>An implementation can support RTZ</comment></member>
+ </type>
+ <type category="struct" name="VkPhysicalDeviceFloatControlsPropertiesKHR" alias="VkPhysicalDeviceFloatControlsProperties"/>
+ <type category="struct" name="VkPhysicalDeviceHostQueryResetFeatures" structextends="VkPhysicalDeviceFeatures2,VkDeviceCreateInfo">
+ <member values="VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_HOST_QUERY_RESET_FEATURES"><type>VkStructureType</type> <name>sType</name></member>
+ <member optional="true"><type>void</type>* <name>pNext</name></member>
+ <member><type>VkBool32</type> <name>hostQueryReset</name></member>
+ </type>
+ <type category="struct" name="VkPhysicalDeviceHostQueryResetFeaturesEXT" alias="VkPhysicalDeviceHostQueryResetFeatures"/>
+ <type category="struct" name="VkNativeBufferUsage2ANDROID">
+ <member><type>uint64_t</type> <name>consumer</name></member>
+ <member><type>uint64_t</type> <name>producer</name></member>
+ </type>
+ <type category="struct" name="VkNativeBufferANDROID">
+ <member values="VK_STRUCTURE_TYPE_NATIVE_BUFFER_ANDROID"><type>VkStructureType</type> <name>sType</name></member>
+ <member optional="true">const <type>void</type>* <name>pNext</name></member>
+ <member>const <type>void</type>* <name>handle</name></member>
+ <member><type>int</type> <name>stride</name></member>
+ <member><type>int</type> <name>format</name></member>
+ <member><type>int</type> <name>usage</name></member>
+ <member><type>VkNativeBufferUsage2ANDROID</type> <name>usage2</name></member>
+ </type>
+ <type category="struct" name="VkSwapchainImageCreateInfoANDROID">
+ <member values="VK_STRUCTURE_TYPE_SWAPCHAIN_IMAGE_CREATE_INFO_ANDROID"><type>VkStructureType</type> <name>sType</name></member>
+ <member optional="true">const <type>void</type>* <name>pNext</name></member>
+ <member><type>VkSwapchainImageUsageFlagsANDROID</type> <name>usage</name></member>
+ </type>
+ <type category="struct" name="VkPhysicalDevicePresentationPropertiesANDROID">
+ <member values="VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_PRESENTATION_PROPERTIES_ANDROID"><type>VkStructureType</type> <name>sType</name></member>
+ <member optional="true">const <type>void</type>* <name>pNext</name></member>
+ <member><type>VkBool32</type> <name>sharedImage</name></member>
+ </type>
+ <type category="struct" name="VkShaderResourceUsageAMD" returnedonly="true">
+ <member><type>uint32_t</type> <name>numUsedVgprs</name></member>
+ <member><type>uint32_t</type> <name>numUsedSgprs</name></member>
+ <member><type>uint32_t</type> <name>ldsSizePerLocalWorkGroup</name></member>
+ <member><type>size_t</type> <name>ldsUsageSizeInBytes</name></member>
+ <member><type>size_t</type> <name>scratchMemUsageInBytes</name></member>
+ </type>
+ <type category="struct" name="VkShaderStatisticsInfoAMD" returnedonly="true">
+ <member><type>VkShaderStageFlags</type> <name>shaderStageMask</name></member>
+ <member><type>VkShaderResourceUsageAMD</type> <name>resourceUsage</name></member>
+ <member><type>uint32_t</type> <name>numPhysicalVgprs</name></member>
+ <member><type>uint32_t</type> <name>numPhysicalSgprs</name></member>
+ <member><type>uint32_t</type> <name>numAvailableVgprs</name></member>
+ <member><type>uint32_t</type> <name>numAvailableSgprs</name></member>
+ <member><type>uint32_t</type> <name>computeWorkGroupSize</name>[3]</member>
+ </type>
+ <type category="struct" name="VkDeviceQueueGlobalPriorityCreateInfoKHR" structextends="VkDeviceQueueCreateInfo">
+ <member values="VK_STRUCTURE_TYPE_DEVICE_QUEUE_GLOBAL_PRIORITY_CREATE_INFO_KHR"><type>VkStructureType</type> <name>sType</name></member>
+ <member optional="true">const <type>void</type>* <name>pNext</name></member>
+ <member><type>VkQueueGlobalPriorityKHR</type> <name>globalPriority</name></member>
+ </type>
+ <type category="struct" name="VkDeviceQueueGlobalPriorityCreateInfoEXT" alias="VkDeviceQueueGlobalPriorityCreateInfoKHR"/>
+ <type category="struct" name="VkPhysicalDeviceGlobalPriorityQueryFeaturesKHR" structextends="VkPhysicalDeviceFeatures2,VkDeviceCreateInfo">
+ <member values="VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_GLOBAL_PRIORITY_QUERY_FEATURES_KHR"><type>VkStructureType</type> <name>sType</name></member>
+ <member optional="true" noautovalidity="true"><type>void</type>* <name>pNext</name></member>
+ <member><type>VkBool32</type> <name>globalPriorityQuery</name></member>
+ </type>
+ <type category="struct" name="VkPhysicalDeviceGlobalPriorityQueryFeaturesEXT" alias="VkPhysicalDeviceGlobalPriorityQueryFeaturesKHR"/>
+ <type category="struct" name="VkQueueFamilyGlobalPriorityPropertiesKHR" structextends="VkQueueFamilyProperties2">
+ <member values="VK_STRUCTURE_TYPE_QUEUE_FAMILY_GLOBAL_PRIORITY_PROPERTIES_KHR"><type>VkStructureType</type> <name>sType</name></member>
+ <member optional="true"><type>void</type>* <name>pNext</name></member>
+ <member limittype="max"><type>uint32_t</type> <name>priorityCount</name></member>
+ <member limittype="bitmask"><type>VkQueueGlobalPriorityKHR</type> <name>priorities</name>[<enum>VK_MAX_GLOBAL_PRIORITY_SIZE_KHR</enum>]</member>
+ </type>
+ <type category="struct" name="VkQueueFamilyGlobalPriorityPropertiesEXT" alias="VkQueueFamilyGlobalPriorityPropertiesKHR"/>
+ <type category="struct" name="VkDebugUtilsObjectNameInfoEXT" structextends="VkPipelineShaderStageCreateInfo">
+ <member values="VK_STRUCTURE_TYPE_DEBUG_UTILS_OBJECT_NAME_INFO_EXT"><type>VkStructureType</type> <name>sType</name></member>
+ <member optional="true">const <type>void</type>* <name>pNext</name></member>
+ <member><type>VkObjectType</type> <name>objectType</name></member>
+ <member objecttype="objectType"><type>uint64_t</type> <name>objectHandle</name></member>
+ <member optional="true" len="null-terminated">const <type>char</type>* <name>pObjectName</name></member>
+ </type>
+ <type category="struct" name="VkDebugUtilsObjectTagInfoEXT">
+ <member values="VK_STRUCTURE_TYPE_DEBUG_UTILS_OBJECT_TAG_INFO_EXT"><type>VkStructureType</type> <name>sType</name></member>
+ <member optional="true">const <type>void</type>* <name>pNext</name></member>
+ <member><type>VkObjectType</type> <name>objectType</name></member>
+ <member objecttype="objectType"><type>uint64_t</type> <name>objectHandle</name></member>
+ <member><type>uint64_t</type> <name>tagName</name></member>
+ <member><type>size_t</type> <name>tagSize</name></member>
+ <member len="tagSize">const <type>void</type>* <name>pTag</name></member>
+ </type>
+ <type category="struct" name="VkDebugUtilsLabelEXT">
+ <member values="VK_STRUCTURE_TYPE_DEBUG_UTILS_LABEL_EXT"><type>VkStructureType</type> <name>sType</name></member>
+ <member optional="true">const <type>void</type>* <name>pNext</name></member>
+ <member len="null-terminated">const <type>char</type>* <name>pLabelName</name></member>
+ <member><type>float</type> <name>color</name>[4]</member>
+ </type>
+ <type category="struct" name="VkDebugUtilsMessengerCreateInfoEXT" allowduplicate="true" structextends="VkInstanceCreateInfo">
+ <member values="VK_STRUCTURE_TYPE_DEBUG_UTILS_MESSENGER_CREATE_INFO_EXT"><type>VkStructureType</type> <name>sType</name></member>
+ <member optional="true">const <type>void</type>* <name>pNext</name></member>
+ <member optional="true"><type>VkDebugUtilsMessengerCreateFlagsEXT</type> <name>flags</name></member>
+ <member><type>VkDebugUtilsMessageSeverityFlagsEXT</type> <name>messageSeverity</name></member>
+ <member><type>VkDebugUtilsMessageTypeFlagsEXT</type> <name>messageType</name></member>
+ <member><type>PFN_vkDebugUtilsMessengerCallbackEXT</type> <name>pfnUserCallback</name></member>
+ <member optional="true"><type>void</type>* <name>pUserData</name></member>
+ </type>
+ <type category="struct" name="VkDebugUtilsMessengerCallbackDataEXT">
+ <member values="VK_STRUCTURE_TYPE_DEBUG_UTILS_MESSENGER_CALLBACK_DATA_EXT"><type>VkStructureType</type> <name>sType</name></member>
+ <member optional="true">const <type>void</type>* <name>pNext</name></member>
+ <member optional="true"><type>VkDebugUtilsMessengerCallbackDataFlagsEXT</type> <name>flags</name></member>
+ <member optional="true" len="null-terminated">const <type>char</type>* <name>pMessageIdName</name></member>
+ <member><type>int32_t</type> <name>messageIdNumber</name></member>
+ <member len="null-terminated">const <type>char</type>* <name>pMessage</name></member>
+ <member optional="true"><type>uint32_t</type> <name>queueLabelCount</name></member>
+ <member len="queueLabelCount">const <type>VkDebugUtilsLabelEXT</type>* <name>pQueueLabels</name></member>
+ <member optional="true"><type>uint32_t</type> <name>cmdBufLabelCount</name></member>
+ <member len="cmdBufLabelCount">const <type>VkDebugUtilsLabelEXT</type>* <name>pCmdBufLabels</name></member>
+ <member optional="true"><type>uint32_t</type> <name>objectCount</name></member>
+ <member len="objectCount">const <type>VkDebugUtilsObjectNameInfoEXT</type>* <name>pObjects</name></member>
+ </type>
+ <type category="struct" name="VkPhysicalDeviceDeviceMemoryReportFeaturesEXT" structextends="VkPhysicalDeviceFeatures2,VkDeviceCreateInfo">
+ <member values="VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_DEVICE_MEMORY_REPORT_FEATURES_EXT"><type>VkStructureType</type> <name>sType</name></member>
+ <member optional="true"><type>void</type>* <name>pNext</name></member>
+ <member><type>VkBool32</type> <name>deviceMemoryReport</name></member>
+ </type>
+ <type category="struct" name="VkDeviceDeviceMemoryReportCreateInfoEXT" allowduplicate="true" structextends="VkDeviceCreateInfo">
+ <member values="VK_STRUCTURE_TYPE_DEVICE_DEVICE_MEMORY_REPORT_CREATE_INFO_EXT"><type>VkStructureType</type> <name>sType</name></member>
+ <member optional="true">const <type>void</type>* <name>pNext</name></member>
+ <member><type>VkDeviceMemoryReportFlagsEXT</type> <name>flags</name></member>
+ <member><type>PFN_vkDeviceMemoryReportCallbackEXT</type> <name>pfnUserCallback</name></member>
+ <member><type>void</type>* <name>pUserData</name></member>
+ </type>
+ <type category="struct" name="VkDeviceMemoryReportCallbackDataEXT" returnedonly="true">
+ <member values="VK_STRUCTURE_TYPE_DEVICE_MEMORY_REPORT_CALLBACK_DATA_EXT"><type>VkStructureType</type> <name>sType</name></member>
+ <member optional="true"><type>void</type>* <name>pNext</name></member>
+ <member><type>VkDeviceMemoryReportFlagsEXT</type> <name>flags</name></member>
+ <member><type>VkDeviceMemoryReportEventTypeEXT</type> <name>type</name></member>
+ <member><type>uint64_t</type> <name>memoryObjectId</name></member>
+ <member><type>VkDeviceSize</type> <name>size</name></member>
+ <member><type>VkObjectType</type> <name>objectType</name></member>
+ <member objecttype="objectType"><type>uint64_t</type> <name>objectHandle</name></member>
+ <member><type>uint32_t</type> <name>heapIndex</name></member>
+ </type>
+ <type category="struct" name="VkImportMemoryHostPointerInfoEXT" structextends="VkMemoryAllocateInfo">
+ <member values="VK_STRUCTURE_TYPE_IMPORT_MEMORY_HOST_POINTER_INFO_EXT"><type>VkStructureType</type> <name>sType</name></member>
+ <member optional="true">const <type>void</type>* <name>pNext</name></member>
+ <member><type>VkExternalMemoryHandleTypeFlagBits</type> <name>handleType</name></member>
+ <member optional="false"><type>void</type>* <name>pHostPointer</name></member>
+ </type>
+ <type category="struct" name="VkMemoryHostPointerPropertiesEXT" returnedonly="true">
+ <member values="VK_STRUCTURE_TYPE_MEMORY_HOST_POINTER_PROPERTIES_EXT"><type>VkStructureType</type> <name>sType</name></member>
+ <member optional="true"><type>void</type>* <name>pNext</name></member>
+ <member><type>uint32_t</type> <name>memoryTypeBits</name></member>
+ </type>
+ <type category="struct" name="VkPhysicalDeviceExternalMemoryHostPropertiesEXT" returnedonly="true" structextends="VkPhysicalDeviceProperties2">
+ <member values="VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_EXTERNAL_MEMORY_HOST_PROPERTIES_EXT"><type>VkStructureType</type> <name>sType</name></member>
+ <member optional="true"><type>void</type>* <name>pNext</name></member>
+ <member limittype="min,pot"><type>VkDeviceSize</type> <name>minImportedHostPointerAlignment</name></member>
+ </type>
+ <type category="struct" name="VkPhysicalDeviceConservativeRasterizationPropertiesEXT" returnedonly="true" structextends="VkPhysicalDeviceProperties2">
+ <member values="VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_CONSERVATIVE_RASTERIZATION_PROPERTIES_EXT"><type>VkStructureType</type> <name>sType</name></member>
+ <member optional="true"><type>void</type>* <name>pNext</name></member>
+ <member limittype="exact"><type>float</type> <name>primitiveOverestimationSize</name><comment>The size in pixels the primitive is enlarged at each edge during conservative rasterization</comment></member>
+ <member limittype="max"><type>float</type> <name>maxExtraPrimitiveOverestimationSize</name><comment>The maximum additional overestimation the client can specify in the pipeline state</comment></member>
+ <member limittype="min,mul"><type>float</type> <name>extraPrimitiveOverestimationSizeGranularity</name><comment>The granularity of extra overestimation sizes the implementations supports between 0 and maxExtraOverestimationSize</comment></member>
+ <member limittype="bitmask"><type>VkBool32</type> <name>primitiveUnderestimation</name><comment>true if the implementation supports conservative rasterization underestimation mode</comment></member>
+ <member limittype="bitmask"><type>VkBool32</type> <name>conservativePointAndLineRasterization</name><comment>true if conservative rasterization also applies to points and lines</comment></member>
+ <member limittype="exact"><type>VkBool32</type> <name>degenerateTrianglesRasterized</name><comment>true if degenerate triangles (those with zero area after snap) are rasterized</comment></member>
+ <member limittype="exact"><type>VkBool32</type> <name>degenerateLinesRasterized</name><comment>true if degenerate lines (those with zero length after snap) are rasterized</comment></member>
+ <member limittype="bitmask"><type>VkBool32</type> <name>fullyCoveredFragmentShaderInputVariable</name><comment>true if the implementation supports the FullyCoveredEXT SPIR-V builtin fragment shader input variable</comment></member>
+ <member limittype="bitmask"><type>VkBool32</type> <name>conservativeRasterizationPostDepthCoverage</name><comment>true if the implementation supports both conservative rasterization and post depth coverage sample coverage mask</comment></member>
+ </type>
+ <type category="struct" name="VkCalibratedTimestampInfoEXT">
+ <member values="VK_STRUCTURE_TYPE_CALIBRATED_TIMESTAMP_INFO_EXT"><type>VkStructureType</type> <name>sType</name></member>
+ <member optional="true">const <type>void</type>* <name>pNext</name></member>
+ <member><type>VkTimeDomainEXT</type> <name>timeDomain</name></member>
+ </type>
+ <type category="struct" name="VkPhysicalDeviceShaderCorePropertiesAMD" returnedonly="true" structextends="VkPhysicalDeviceProperties2">
+ <member values="VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_SHADER_CORE_PROPERTIES_AMD"><type>VkStructureType</type> <name>sType</name></member>
+ <member optional="true"><type>void</type>* <name>pNext</name></member>
+ <member limittype="exact"><type>uint32_t</type> <name>shaderEngineCount</name><comment>number of shader engines</comment></member>
+ <member limittype="exact"><type>uint32_t</type> <name>shaderArraysPerEngineCount</name><comment>number of shader arrays</comment></member>
+ <member limittype="exact"><type>uint32_t</type> <name>computeUnitsPerShaderArray</name><comment>number of physical CUs per shader array</comment></member>
+ <member limittype="exact"><type>uint32_t</type> <name>simdPerComputeUnit</name><comment>number of SIMDs per compute unit</comment></member>
+ <member limittype="exact"><type>uint32_t</type> <name>wavefrontsPerSimd</name><comment>number of wavefront slots in each SIMD</comment></member>
+ <member limittype="max"><type>uint32_t</type> <name>wavefrontSize</name><comment>maximum number of threads per wavefront</comment></member>
+ <member limittype="exact"><type>uint32_t</type> <name>sgprsPerSimd</name><comment>number of physical SGPRs per SIMD</comment></member>
+ <member limittype="min"><type>uint32_t</type> <name>minSgprAllocation</name><comment>minimum number of SGPRs that can be allocated by a wave</comment></member>
+ <member limittype="max"><type>uint32_t</type> <name>maxSgprAllocation</name><comment>number of available SGPRs</comment></member>
+ <member limittype="min,mul"><type>uint32_t</type> <name>sgprAllocationGranularity</name><comment>SGPRs are allocated in groups of this size</comment></member>
+ <member limittype="exact"><type>uint32_t</type> <name>vgprsPerSimd</name><comment>number of physical VGPRs per SIMD</comment></member>
+ <member limittype="min"><type>uint32_t</type> <name>minVgprAllocation</name><comment>minimum number of VGPRs that can be allocated by a wave</comment></member>
+ <member limittype="max"><type>uint32_t</type> <name>maxVgprAllocation</name><comment>number of available VGPRs</comment></member>
+ <member limittype="min,mul"><type>uint32_t</type> <name>vgprAllocationGranularity</name><comment>VGPRs are allocated in groups of this size</comment></member>
+ </type>
+ <type category="struct" name="VkPhysicalDeviceShaderCoreProperties2AMD" returnedonly="true" structextends="VkPhysicalDeviceProperties2">
+ <member values="VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_SHADER_CORE_PROPERTIES_2_AMD"><type>VkStructureType</type> <name>sType</name></member>
+ <member optional="true"><type>void</type>* <name>pNext</name><comment>Pointer to next structure</comment></member>
+ <member limittype="bitmask"><type>VkShaderCorePropertiesFlagsAMD</type> <name>shaderCoreFeatures</name><comment>features supported by the shader core</comment></member>
+ <member limittype="max"><type>uint32_t</type> <name>activeComputeUnitCount</name><comment>number of active compute units across all shader engines/arrays</comment></member>
+ </type>
+ <type category="struct" name="VkPipelineRasterizationConservativeStateCreateInfoEXT" structextends="VkPipelineRasterizationStateCreateInfo">
+ <member values="VK_STRUCTURE_TYPE_PIPELINE_RASTERIZATION_CONSERVATIVE_STATE_CREATE_INFO_EXT"><type>VkStructureType</type> <name>sType</name></member>
+ <member optional="true">const <type>void</type>* <name>pNext</name></member>
+ <member optional="true"><type>VkPipelineRasterizationConservativeStateCreateFlagsEXT</type> <name>flags</name><comment>Reserved</comment></member>
+ <member><type>VkConservativeRasterizationModeEXT</type> <name>conservativeRasterizationMode</name><comment>Conservative rasterization mode</comment></member>
+ <member><type>float</type> <name>extraPrimitiveOverestimationSize</name><comment>Extra overestimation to add to the primitive</comment></member>
+ </type>
+ <type category="struct" name="VkPhysicalDeviceDescriptorIndexingFeatures" structextends="VkPhysicalDeviceFeatures2,VkDeviceCreateInfo">
+ <member values="VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_DESCRIPTOR_INDEXING_FEATURES"><type>VkStructureType</type> <name>sType</name></member>
+ <member optional="true"><type>void</type>* <name>pNext</name></member>
+ <member><type>VkBool32</type> <name>shaderInputAttachmentArrayDynamicIndexing</name></member>
+ <member><type>VkBool32</type> <name>shaderUniformTexelBufferArrayDynamicIndexing</name></member>
+ <member><type>VkBool32</type> <name>shaderStorageTexelBufferArrayDynamicIndexing</name></member>
+ <member><type>VkBool32</type> <name>shaderUniformBufferArrayNonUniformIndexing</name></member>
+ <member><type>VkBool32</type> <name>shaderSampledImageArrayNonUniformIndexing</name></member>
+ <member><type>VkBool32</type> <name>shaderStorageBufferArrayNonUniformIndexing</name></member>
+ <member><type>VkBool32</type> <name>shaderStorageImageArrayNonUniformIndexing</name></member>
+ <member><type>VkBool32</type> <name>shaderInputAttachmentArrayNonUniformIndexing</name></member>
+ <member><type>VkBool32</type> <name>shaderUniformTexelBufferArrayNonUniformIndexing</name></member>
+ <member><type>VkBool32</type> <name>shaderStorageTexelBufferArrayNonUniformIndexing</name></member>
+ <member><type>VkBool32</type> <name>descriptorBindingUniformBufferUpdateAfterBind</name></member>
+ <member><type>VkBool32</type> <name>descriptorBindingSampledImageUpdateAfterBind</name></member>
+ <member><type>VkBool32</type> <name>descriptorBindingStorageImageUpdateAfterBind</name></member>
+ <member><type>VkBool32</type> <name>descriptorBindingStorageBufferUpdateAfterBind</name></member>
+ <member><type>VkBool32</type> <name>descriptorBindingUniformTexelBufferUpdateAfterBind</name></member>
+ <member><type>VkBool32</type> <name>descriptorBindingStorageTexelBufferUpdateAfterBind</name></member>
+ <member><type>VkBool32</type> <name>descriptorBindingUpdateUnusedWhilePending</name></member>
+ <member><type>VkBool32</type> <name>descriptorBindingPartiallyBound</name></member>
+ <member><type>VkBool32</type> <name>descriptorBindingVariableDescriptorCount</name></member>
+ <member><type>VkBool32</type> <name>runtimeDescriptorArray</name></member>
+ </type>
+ <type category="struct" name="VkPhysicalDeviceDescriptorIndexingFeaturesEXT" alias="VkPhysicalDeviceDescriptorIndexingFeatures"/>
+ <type category="struct" name="VkPhysicalDeviceDescriptorIndexingProperties" returnedonly="true" structextends="VkPhysicalDeviceProperties2">
+ <member values="VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_DESCRIPTOR_INDEXING_PROPERTIES"><type>VkStructureType</type> <name>sType</name></member>
+ <member optional="true"><type>void</type>* <name>pNext</name></member>
+ <member limittype="max"><type>uint32_t</type> <name>maxUpdateAfterBindDescriptorsInAllPools</name></member>
+ <member limittype="bitmask"><type>VkBool32</type> <name>shaderUniformBufferArrayNonUniformIndexingNative</name></member>
+ <member limittype="bitmask"><type>VkBool32</type> <name>shaderSampledImageArrayNonUniformIndexingNative</name></member>
+ <member limittype="bitmask"><type>VkBool32</type> <name>shaderStorageBufferArrayNonUniformIndexingNative</name></member>
+ <member limittype="bitmask"><type>VkBool32</type> <name>shaderStorageImageArrayNonUniformIndexingNative</name></member>
+ <member limittype="bitmask"><type>VkBool32</type> <name>shaderInputAttachmentArrayNonUniformIndexingNative</name></member>
+ <member limittype="bitmask"><type>VkBool32</type> <name>robustBufferAccessUpdateAfterBind</name></member>
+ <member limittype="bitmask"><type>VkBool32</type> <name>quadDivergentImplicitLod</name></member>
+ <member limittype="max"><type>uint32_t</type> <name>maxPerStageDescriptorUpdateAfterBindSamplers</name></member>
+ <member limittype="max"><type>uint32_t</type> <name>maxPerStageDescriptorUpdateAfterBindUniformBuffers</name></member>
+ <member limittype="max"><type>uint32_t</type> <name>maxPerStageDescriptorUpdateAfterBindStorageBuffers</name></member>
+ <member limittype="max"><type>uint32_t</type> <name>maxPerStageDescriptorUpdateAfterBindSampledImages</name></member>
+ <member limittype="max"><type>uint32_t</type> <name>maxPerStageDescriptorUpdateAfterBindStorageImages</name></member>
+ <member limittype="max"><type>uint32_t</type> <name>maxPerStageDescriptorUpdateAfterBindInputAttachments</name></member>
+ <member limittype="max"><type>uint32_t</type> <name>maxPerStageUpdateAfterBindResources</name></member>
+ <member limittype="max"><type>uint32_t</type> <name>maxDescriptorSetUpdateAfterBindSamplers</name></member>
+ <member limittype="max"><type>uint32_t</type> <name>maxDescriptorSetUpdateAfterBindUniformBuffers</name></member>
+ <member limittype="max"><type>uint32_t</type> <name>maxDescriptorSetUpdateAfterBindUniformBuffersDynamic</name></member>
+ <member limittype="max"><type>uint32_t</type> <name>maxDescriptorSetUpdateAfterBindStorageBuffers</name></member>
+ <member limittype="max"><type>uint32_t</type> <name>maxDescriptorSetUpdateAfterBindStorageBuffersDynamic</name></member>
+ <member limittype="max"><type>uint32_t</type> <name>maxDescriptorSetUpdateAfterBindSampledImages</name></member>
+ <member limittype="max"><type>uint32_t</type> <name>maxDescriptorSetUpdateAfterBindStorageImages</name></member>
+ <member limittype="max"><type>uint32_t</type> <name>maxDescriptorSetUpdateAfterBindInputAttachments</name></member>
+ </type>
+ <type category="struct" name="VkPhysicalDeviceDescriptorIndexingPropertiesEXT" alias="VkPhysicalDeviceDescriptorIndexingProperties"/>
+ <type category="struct" name="VkDescriptorSetLayoutBindingFlagsCreateInfo" structextends="VkDescriptorSetLayoutCreateInfo">
+ <member values="VK_STRUCTURE_TYPE_DESCRIPTOR_SET_LAYOUT_BINDING_FLAGS_CREATE_INFO"><type>VkStructureType</type> <name>sType</name></member>
+ <member optional="true">const <type>void</type>* <name>pNext</name></member>
+ <member optional="true"><type>uint32_t</type> <name>bindingCount</name></member>
+ <member len="bindingCount" optional="false,true">const <type>VkDescriptorBindingFlags</type>* <name>pBindingFlags</name></member>
+ </type>
+ <type category="struct" name="VkDescriptorSetLayoutBindingFlagsCreateInfoEXT" alias="VkDescriptorSetLayoutBindingFlagsCreateInfo"/>
+ <type category="struct" name="VkDescriptorSetVariableDescriptorCountAllocateInfo" structextends="VkDescriptorSetAllocateInfo">
+ <member values="VK_STRUCTURE_TYPE_DESCRIPTOR_SET_VARIABLE_DESCRIPTOR_COUNT_ALLOCATE_INFO"><type>VkStructureType</type> <name>sType</name></member>
+ <member optional="true">const <type>void</type>* <name>pNext</name></member>
+ <member optional="true"><type>uint32_t</type> <name>descriptorSetCount</name></member>
+ <member len="descriptorSetCount">const <type>uint32_t</type>* <name>pDescriptorCounts</name></member>
+ </type>
+ <type category="struct" name="VkDescriptorSetVariableDescriptorCountAllocateInfoEXT" alias="VkDescriptorSetVariableDescriptorCountAllocateInfo"/>
+ <type category="struct" name="VkDescriptorSetVariableDescriptorCountLayoutSupport" structextends="VkDescriptorSetLayoutSupport" returnedonly="true">
+ <member values="VK_STRUCTURE_TYPE_DESCRIPTOR_SET_VARIABLE_DESCRIPTOR_COUNT_LAYOUT_SUPPORT"><type>VkStructureType</type> <name>sType</name></member>
+ <member optional="true"><type>void</type>* <name>pNext</name></member>
+ <member><type>uint32_t</type> <name>maxVariableDescriptorCount</name></member>
+ </type>
+ <type category="struct" name="VkDescriptorSetVariableDescriptorCountLayoutSupportEXT" alias="VkDescriptorSetVariableDescriptorCountLayoutSupport"/>
+ <type category="struct" name="VkAttachmentDescription2">
+ <member values="VK_STRUCTURE_TYPE_ATTACHMENT_DESCRIPTION_2"><type>VkStructureType</type> <name>sType</name></member>
+ <member optional="true">const <type>void</type>* <name>pNext</name></member>
+ <member optional="true"><type>VkAttachmentDescriptionFlags</type> <name>flags</name></member>
+ <member><type>VkFormat</type> <name>format</name></member>
+ <member><type>VkSampleCountFlagBits</type> <name>samples</name></member>
+ <member><type>VkAttachmentLoadOp</type> <name>loadOp</name><comment>Load operation for color or depth data</comment></member>
+ <member><type>VkAttachmentStoreOp</type> <name>storeOp</name><comment>Store operation for color or depth data</comment></member>
+ <member><type>VkAttachmentLoadOp</type> <name>stencilLoadOp</name><comment>Load operation for stencil data</comment></member>
+ <member><type>VkAttachmentStoreOp</type> <name>stencilStoreOp</name><comment>Store operation for stencil data</comment></member>
+ <member><type>VkImageLayout</type> <name>initialLayout</name></member>
+ <member><type>VkImageLayout</type> <name>finalLayout</name></member>
+ </type>
+ <type category="struct" name="VkAttachmentDescription2KHR" alias="VkAttachmentDescription2"/>
+ <type category="struct" name="VkAttachmentReference2">
+ <member values="VK_STRUCTURE_TYPE_ATTACHMENT_REFERENCE_2"><type>VkStructureType</type> <name>sType</name></member>
+ <member optional="true">const <type>void</type>* <name>pNext</name></member>
+ <member><type>uint32_t</type> <name>attachment</name></member>
+ <member><type>VkImageLayout</type> <name>layout</name></member>
+ <member noautovalidity="true"><type>VkImageAspectFlags</type> <name>aspectMask</name></member>
+ </type>
+ <type category="struct" name="VkAttachmentReference2KHR" alias="VkAttachmentReference2"/>
+ <type category="struct" name="VkSubpassDescription2">
+ <member values="VK_STRUCTURE_TYPE_SUBPASS_DESCRIPTION_2"><type>VkStructureType</type> <name>sType</name></member>
+ <member optional="true">const <type>void</type>* <name>pNext</name></member>
+ <member optional="true"><type>VkSubpassDescriptionFlags</type> <name>flags</name></member>
+ <member><type>VkPipelineBindPoint</type> <name>pipelineBindPoint</name></member>
+ <member><type>uint32_t</type> <name>viewMask</name></member>
+ <member optional="true"><type>uint32_t</type> <name>inputAttachmentCount</name></member>
+ <member len="inputAttachmentCount">const <type>VkAttachmentReference2</type>* <name>pInputAttachments</name></member>
+ <member optional="true"><type>uint32_t</type> <name>colorAttachmentCount</name></member>
+ <member len="colorAttachmentCount">const <type>VkAttachmentReference2</type>* <name>pColorAttachments</name></member>
+ <member optional="true" len="colorAttachmentCount">const <type>VkAttachmentReference2</type>* <name>pResolveAttachments</name></member>
+ <member optional="true">const <type>VkAttachmentReference2</type>* <name>pDepthStencilAttachment</name></member>
+ <member optional="true"><type>uint32_t</type> <name>preserveAttachmentCount</name></member>
+ <member len="preserveAttachmentCount">const <type>uint32_t</type>* <name>pPreserveAttachments</name></member>
+ </type>
+ <type category="struct" name="VkSubpassDescription2KHR" alias="VkSubpassDescription2"/>
+ <type category="struct" name="VkSubpassDependency2">
+ <member values="VK_STRUCTURE_TYPE_SUBPASS_DEPENDENCY_2"><type>VkStructureType</type> <name>sType</name></member>
+ <member optional="true">const <type>void</type>* <name>pNext</name></member>
+ <member><type>uint32_t</type> <name>srcSubpass</name></member>
+ <member><type>uint32_t</type> <name>dstSubpass</name></member>
+ <member optional="true"><type>VkPipelineStageFlags</type> <name>srcStageMask</name></member>
+ <member optional="true"><type>VkPipelineStageFlags</type> <name>dstStageMask</name></member>
+ <member optional="true"><type>VkAccessFlags</type> <name>srcAccessMask</name></member>
+ <member optional="true"><type>VkAccessFlags</type> <name>dstAccessMask</name></member>
+ <member optional="true"><type>VkDependencyFlags</type> <name>dependencyFlags</name></member>
+ <member><type>int32_t</type> <name>viewOffset</name></member>
+ </type>
+ <type category="struct" name="VkSubpassDependency2KHR" alias="VkSubpassDependency2"/>
+ <type category="struct" name="VkRenderPassCreateInfo2">
+ <member values="VK_STRUCTURE_TYPE_RENDER_PASS_CREATE_INFO_2"><type>VkStructureType</type> <name>sType</name></member>
+ <member optional="true">const <type>void</type>* <name>pNext</name></member>
+ <member optional="true"><type>VkRenderPassCreateFlags</type> <name>flags</name></member>
+ <member optional="true"><type>uint32_t</type> <name>attachmentCount</name></member>
+ <member len="attachmentCount">const <type>VkAttachmentDescription2</type>* <name>pAttachments</name></member>
+ <member><type>uint32_t</type> <name>subpassCount</name></member>
+ <member len="subpassCount">const <type>VkSubpassDescription2</type>* <name>pSubpasses</name></member>
+ <member optional="true"><type>uint32_t</type> <name>dependencyCount</name></member>
+ <member len="dependencyCount">const <type>VkSubpassDependency2</type>* <name>pDependencies</name></member>
+ <member optional="true"><type>uint32_t</type> <name>correlatedViewMaskCount</name></member>
+ <member len="correlatedViewMaskCount">const <type>uint32_t</type>* <name>pCorrelatedViewMasks</name></member>
+ </type>
+ <type category="struct" name="VkRenderPassCreateInfo2KHR" alias="VkRenderPassCreateInfo2"/>
+ <type category="struct" name="VkSubpassBeginInfo">
+ <member values="VK_STRUCTURE_TYPE_SUBPASS_BEGIN_INFO"><type>VkStructureType</type> <name>sType</name></member>
+ <member optional="true">const <type>void</type>* <name>pNext</name></member>
+ <member><type>VkSubpassContents</type> <name>contents</name></member>
+ </type>
+ <type category="struct" name="VkSubpassBeginInfoKHR" alias="VkSubpassBeginInfo"/>
+ <type category="struct" name="VkSubpassEndInfo">
+ <member values="VK_STRUCTURE_TYPE_SUBPASS_END_INFO"><type>VkStructureType</type> <name>sType</name></member>
+ <member optional="true">const <type>void</type>* <name>pNext</name></member>
+ </type>
+ <type category="struct" name="VkSubpassEndInfoKHR" alias="VkSubpassEndInfo"/>
+ <type category="struct" name="VkPhysicalDeviceTimelineSemaphoreFeatures" structextends="VkPhysicalDeviceFeatures2,VkDeviceCreateInfo">
+ <member values="VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_TIMELINE_SEMAPHORE_FEATURES"><type>VkStructureType</type> <name>sType</name></member>
+ <member optional="true"><type>void</type>* <name>pNext</name></member>
+ <member><type>VkBool32</type> <name>timelineSemaphore</name></member>
+ </type>
+ <type category="struct" name="VkPhysicalDeviceTimelineSemaphoreFeaturesKHR" alias="VkPhysicalDeviceTimelineSemaphoreFeatures"/>
+ <type category="struct" name="VkPhysicalDeviceTimelineSemaphoreProperties" structextends="VkPhysicalDeviceProperties2" returnedonly="true">
+ <member values="VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_TIMELINE_SEMAPHORE_PROPERTIES"><type>VkStructureType</type> <name>sType</name></member>
+ <member optional="true"><type>void</type>* <name>pNext</name></member>
+ <member limittype="max"><type>uint64_t</type> <name>maxTimelineSemaphoreValueDifference</name></member>
+ </type>
+ <type category="struct" name="VkPhysicalDeviceTimelineSemaphorePropertiesKHR" alias="VkPhysicalDeviceTimelineSemaphoreProperties"/>
+ <type category="struct" name="VkSemaphoreTypeCreateInfo" structextends="VkSemaphoreCreateInfo,VkPhysicalDeviceExternalSemaphoreInfo">
+ <member values="VK_STRUCTURE_TYPE_SEMAPHORE_TYPE_CREATE_INFO"><type>VkStructureType</type> <name>sType</name></member>
+ <member optional="true">const <type>void</type>* <name>pNext</name></member>
+ <member><type>VkSemaphoreType</type> <name>semaphoreType</name></member>
+ <member><type>uint64_t</type> <name>initialValue</name></member>
+ </type>
+ <type category="struct" name="VkSemaphoreTypeCreateInfoKHR" alias="VkSemaphoreTypeCreateInfo"/>
+ <type category="struct" name="VkTimelineSemaphoreSubmitInfo" structextends="VkSubmitInfo,VkBindSparseInfo">
+ <member values="VK_STRUCTURE_TYPE_TIMELINE_SEMAPHORE_SUBMIT_INFO"><type>VkStructureType</type> <name>sType</name></member>
+ <member optional="true">const <type>void</type>* <name>pNext</name></member>
+ <member optional="true"><type>uint32_t</type> <name>waitSemaphoreValueCount</name></member>
+ <member optional="true" len="waitSemaphoreValueCount">const <type>uint64_t</type>* <name>pWaitSemaphoreValues</name></member>
+ <member optional="true"><type>uint32_t</type> <name>signalSemaphoreValueCount</name></member>
+ <member optional="true" len="signalSemaphoreValueCount">const <type>uint64_t</type>* <name>pSignalSemaphoreValues</name></member>
+ </type>
+ <type category="struct" name="VkTimelineSemaphoreSubmitInfoKHR" alias="VkTimelineSemaphoreSubmitInfo"/>
+ <type category="struct" name="VkSemaphoreWaitInfo">
+ <member values="VK_STRUCTURE_TYPE_SEMAPHORE_WAIT_INFO"><type>VkStructureType</type> <name>sType</name></member>
+ <member optional="true">const <type>void</type>* <name>pNext</name></member>
+ <member optional="true"><type>VkSemaphoreWaitFlags</type> <name>flags</name></member>
+ <member><type>uint32_t</type> <name>semaphoreCount</name></member>
+ <member len="semaphoreCount">const <type>VkSemaphore</type>* <name>pSemaphores</name></member>
+ <member len="semaphoreCount">const <type>uint64_t</type>* <name>pValues</name></member>
+ </type>
+ <type category="struct" name="VkSemaphoreWaitInfoKHR" alias="VkSemaphoreWaitInfo"/>
+ <type category="struct" name="VkSemaphoreSignalInfo">
+ <member values="VK_STRUCTURE_TYPE_SEMAPHORE_SIGNAL_INFO"><type>VkStructureType</type> <name>sType</name></member>
+ <member optional="true">const <type>void</type>* <name>pNext</name></member>
+ <member><type>VkSemaphore</type> <name>semaphore</name></member>
+ <member><type>uint64_t</type> <name>value</name></member>
+ </type>
+ <type category="struct" name="VkSemaphoreSignalInfoKHR" alias="VkSemaphoreSignalInfo"/>
+ <type category="struct" name="VkVertexInputBindingDivisorDescriptionEXT">
+ <member><type>uint32_t</type> <name>binding</name></member>
+ <member><type>uint32_t</type> <name>divisor</name></member>
+ </type>
+ <type category="struct" name="VkPipelineVertexInputDivisorStateCreateInfoEXT" structextends="VkPipelineVertexInputStateCreateInfo">
+ <member values="VK_STRUCTURE_TYPE_PIPELINE_VERTEX_INPUT_DIVISOR_STATE_CREATE_INFO_EXT"><type>VkStructureType</type> <name>sType</name></member>
+ <member optional="true">const <type>void</type>* <name>pNext</name></member>
+ <member><type>uint32_t</type> <name>vertexBindingDivisorCount</name></member>
+ <member len="vertexBindingDivisorCount">const <type>VkVertexInputBindingDivisorDescriptionEXT</type>* <name>pVertexBindingDivisors</name></member>
+ </type>
+ <type category="struct" name="VkPhysicalDeviceVertexAttributeDivisorPropertiesEXT" returnedonly="true" structextends="VkPhysicalDeviceProperties2">
+ <member values="VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_VERTEX_ATTRIBUTE_DIVISOR_PROPERTIES_EXT"><type>VkStructureType</type> <name>sType</name></member>
+ <member optional="true"><type>void</type>* <name>pNext</name></member>
+ <member limittype="max"><type>uint32_t</type> <name>maxVertexAttribDivisor</name><comment>max value of vertex attribute divisor</comment></member>
+ </type>
+ <type category="struct" name="VkPhysicalDevicePCIBusInfoPropertiesEXT" structextends="VkPhysicalDeviceProperties2" returnedonly="true">
+ <member values="VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_PCI_BUS_INFO_PROPERTIES_EXT"><type>VkStructureType</type> <name>sType</name></member>
+ <member optional="true"><type>void</type>* <name>pNext</name></member>
+ <member limittype="noauto"><type>uint32_t</type> <name>pciDomain</name></member>
+ <member limittype="noauto"><type>uint32_t</type> <name>pciBus</name></member>
+ <member limittype="noauto"><type>uint32_t</type> <name>pciDevice</name></member>
+ <member limittype="noauto"><type>uint32_t</type> <name>pciFunction</name></member>
+ </type>
+ <type category="struct" name="VkImportAndroidHardwareBufferInfoANDROID" structextends="VkMemoryAllocateInfo">
+ <member values="VK_STRUCTURE_TYPE_IMPORT_ANDROID_HARDWARE_BUFFER_INFO_ANDROID"><type>VkStructureType</type> <name>sType</name></member>
+ <member optional="true">const <type>void</type>* <name>pNext</name></member>
+ <member>struct <type>AHardwareBuffer</type>* <name>buffer</name></member>
+ </type>
+ <type category="struct" name="VkAndroidHardwareBufferUsageANDROID" structextends="VkImageFormatProperties2" returnedonly="true">
+ <member values="VK_STRUCTURE_TYPE_ANDROID_HARDWARE_BUFFER_USAGE_ANDROID"><type>VkStructureType</type> <name>sType</name></member>
+ <member optional="true"><type>void</type>* <name>pNext</name></member>
+ <member><type>uint64_t</type> <name>androidHardwareBufferUsage</name></member>
+ </type>
+ <type category="struct" name="VkAndroidHardwareBufferPropertiesANDROID" returnedonly="true">
+ <member values="VK_STRUCTURE_TYPE_ANDROID_HARDWARE_BUFFER_PROPERTIES_ANDROID"><type>VkStructureType</type> <name>sType</name></member>
+ <member optional="true"><type>void</type>* <name>pNext</name></member>
+ <member><type>VkDeviceSize</type> <name>allocationSize</name></member>
+ <member><type>uint32_t</type> <name>memoryTypeBits</name></member>
+ </type>
+ <type category="struct" name="VkMemoryGetAndroidHardwareBufferInfoANDROID">
+ <member values="VK_STRUCTURE_TYPE_MEMORY_GET_ANDROID_HARDWARE_BUFFER_INFO_ANDROID"><type>VkStructureType</type> <name>sType</name></member>
+ <member optional="true">const <type>void</type>* <name>pNext</name></member>
+ <member><type>VkDeviceMemory</type> <name>memory</name></member>
+ </type>
+ <type category="struct" name="VkAndroidHardwareBufferFormatPropertiesANDROID" structextends="VkAndroidHardwareBufferPropertiesANDROID" returnedonly="true">
+ <member values="VK_STRUCTURE_TYPE_ANDROID_HARDWARE_BUFFER_FORMAT_PROPERTIES_ANDROID"><type>VkStructureType</type> <name>sType</name></member>
+ <member optional="true"><type>void</type>* <name>pNext</name></member>
+ <member><type>VkFormat</type> <name>format</name></member>
+ <member><type>uint64_t</type> <name>externalFormat</name></member>
+ <member><type>VkFormatFeatureFlags</type> <name>formatFeatures</name></member>
+ <member><type>VkComponentMapping</type> <name>samplerYcbcrConversionComponents</name></member>
+ <member><type>VkSamplerYcbcrModelConversion</type> <name>suggestedYcbcrModel</name></member>
+ <member><type>VkSamplerYcbcrRange</type> <name>suggestedYcbcrRange</name></member>
+ <member><type>VkChromaLocation</type> <name>suggestedXChromaOffset</name></member>
+ <member><type>VkChromaLocation</type> <name>suggestedYChromaOffset</name></member>
+ </type>
+ <type category="struct" name="VkCommandBufferInheritanceConditionalRenderingInfoEXT" structextends="VkCommandBufferInheritanceInfo">
+ <member values="VK_STRUCTURE_TYPE_COMMAND_BUFFER_INHERITANCE_CONDITIONAL_RENDERING_INFO_EXT"><type>VkStructureType</type> <name>sType</name></member>
+ <member optional="true">const <type>void</type>* <name>pNext</name></member>
+ <member><type>VkBool32</type> <name>conditionalRenderingEnable</name><comment>Whether this secondary command buffer may be executed during an active conditional rendering</comment></member>
+ </type>
+ <type category="struct" name="VkExternalFormatANDROID" structextends="VkImageCreateInfo,VkSamplerYcbcrConversionCreateInfo">
+ <member values="VK_STRUCTURE_TYPE_EXTERNAL_FORMAT_ANDROID"><type>VkStructureType</type> <name>sType</name></member>
+ <member optional="true"><type>void</type>* <name>pNext</name></member>
+ <member><type>uint64_t</type> <name>externalFormat</name></member>
+ </type>
+ <type category="struct" name="VkPhysicalDevice8BitStorageFeatures" structextends="VkPhysicalDeviceFeatures2,VkDeviceCreateInfo">
+ <member values="VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_8BIT_STORAGE_FEATURES"><type>VkStructureType</type> <name>sType</name></member>
+ <member optional="true"><type>void</type>* <name>pNext</name></member>
+ <member><type>VkBool32</type> <name>storageBuffer8BitAccess</name><comment>8-bit integer variables supported in StorageBuffer</comment></member>
+ <member><type>VkBool32</type> <name>uniformAndStorageBuffer8BitAccess</name><comment>8-bit integer variables supported in StorageBuffer and Uniform</comment></member>
+ <member><type>VkBool32</type> <name>storagePushConstant8</name><comment>8-bit integer variables supported in PushConstant</comment></member>
+ </type>
+ <type category="struct" name="VkPhysicalDevice8BitStorageFeaturesKHR" alias="VkPhysicalDevice8BitStorageFeatures"/>
+ <type category="struct" name="VkPhysicalDeviceConditionalRenderingFeaturesEXT" structextends="VkPhysicalDeviceFeatures2,VkDeviceCreateInfo">
+ <member values="VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_CONDITIONAL_RENDERING_FEATURES_EXT"><type>VkStructureType</type> <name>sType</name></member>
+ <member optional="true"><type>void</type>* <name>pNext</name></member>
+ <member><type>VkBool32</type> <name>conditionalRendering</name></member>
+ <member><type>VkBool32</type> <name>inheritedConditionalRendering</name></member>
+ </type>
+ <type category="struct" name="VkPhysicalDeviceVulkanMemoryModelFeatures" structextends="VkPhysicalDeviceFeatures2,VkDeviceCreateInfo">
+ <member values="VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_VULKAN_MEMORY_MODEL_FEATURES"><type>VkStructureType</type> <name>sType</name></member>
+ <member optional="true"><type>void</type>* <name>pNext</name></member>
+ <member><type>VkBool32</type> <name>vulkanMemoryModel</name></member>
+ <member><type>VkBool32</type> <name>vulkanMemoryModelDeviceScope</name></member>
+ <member><type>VkBool32</type> <name>vulkanMemoryModelAvailabilityVisibilityChains</name></member>
+ </type>
+ <type category="struct" name="VkPhysicalDeviceVulkanMemoryModelFeaturesKHR" alias="VkPhysicalDeviceVulkanMemoryModelFeatures"/>
+ <type category="struct" name="VkPhysicalDeviceShaderAtomicInt64Features" structextends="VkPhysicalDeviceFeatures2,VkDeviceCreateInfo">
+ <member values="VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_SHADER_ATOMIC_INT64_FEATURES"><type>VkStructureType</type> <name>sType</name></member>
+ <member optional="true"><type>void</type>* <name>pNext</name></member>
+ <member><type>VkBool32</type> <name>shaderBufferInt64Atomics</name></member>
+ <member><type>VkBool32</type> <name>shaderSharedInt64Atomics</name></member>
+ </type>
+ <type category="struct" name="VkPhysicalDeviceShaderAtomicInt64FeaturesKHR" alias="VkPhysicalDeviceShaderAtomicInt64Features"/>
+ <type category="struct" name="VkPhysicalDeviceShaderAtomicFloatFeaturesEXT" structextends="VkPhysicalDeviceFeatures2,VkDeviceCreateInfo">
+ <member values="VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_SHADER_ATOMIC_FLOAT_FEATURES_EXT"><type>VkStructureType</type> <name>sType</name></member>
+ <member optional="true"><type>void</type>* <name>pNext</name></member>
+ <member><type>VkBool32</type> <name>shaderBufferFloat32Atomics</name></member>
+ <member><type>VkBool32</type> <name>shaderBufferFloat32AtomicAdd</name></member>
+ <member><type>VkBool32</type> <name>shaderBufferFloat64Atomics</name></member>
+ <member><type>VkBool32</type> <name>shaderBufferFloat64AtomicAdd</name></member>
+ <member><type>VkBool32</type> <name>shaderSharedFloat32Atomics</name></member>
+ <member><type>VkBool32</type> <name>shaderSharedFloat32AtomicAdd</name></member>
+ <member><type>VkBool32</type> <name>shaderSharedFloat64Atomics</name></member>
+ <member><type>VkBool32</type> <name>shaderSharedFloat64AtomicAdd</name></member>
+ <member><type>VkBool32</type> <name>shaderImageFloat32Atomics</name></member>
+ <member><type>VkBool32</type> <name>shaderImageFloat32AtomicAdd</name></member>
+ <member><type>VkBool32</type> <name>sparseImageFloat32Atomics</name></member>
+ <member><type>VkBool32</type> <name>sparseImageFloat32AtomicAdd</name></member>
+ </type>
+ <type category="struct" name="VkPhysicalDeviceShaderAtomicFloat2FeaturesEXT" structextends="VkPhysicalDeviceFeatures2,VkDeviceCreateInfo">
+ <member values="VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_SHADER_ATOMIC_FLOAT_2_FEATURES_EXT"><type>VkStructureType</type> <name>sType</name></member>
+ <member optional="true"><type>void</type>* <name>pNext</name></member>
+ <member><type>VkBool32</type> <name>shaderBufferFloat16Atomics</name></member>
+ <member><type>VkBool32</type> <name>shaderBufferFloat16AtomicAdd</name></member>
+ <member><type>VkBool32</type> <name>shaderBufferFloat16AtomicMinMax</name></member>
+ <member><type>VkBool32</type> <name>shaderBufferFloat32AtomicMinMax</name></member>
+ <member><type>VkBool32</type> <name>shaderBufferFloat64AtomicMinMax</name></member>
+ <member><type>VkBool32</type> <name>shaderSharedFloat16Atomics</name></member>
+ <member><type>VkBool32</type> <name>shaderSharedFloat16AtomicAdd</name></member>
+ <member><type>VkBool32</type> <name>shaderSharedFloat16AtomicMinMax</name></member>
+ <member><type>VkBool32</type> <name>shaderSharedFloat32AtomicMinMax</name></member>
+ <member><type>VkBool32</type> <name>shaderSharedFloat64AtomicMinMax</name></member>
+ <member><type>VkBool32</type> <name>shaderImageFloat32AtomicMinMax</name></member>
+ <member><type>VkBool32</type> <name>sparseImageFloat32AtomicMinMax</name></member>
+ </type>
+ <type category="struct" name="VkPhysicalDeviceVertexAttributeDivisorFeaturesEXT" structextends="VkPhysicalDeviceFeatures2,VkDeviceCreateInfo">
+ <member values="VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_VERTEX_ATTRIBUTE_DIVISOR_FEATURES_EXT"><type>VkStructureType</type> <name>sType</name></member>
+ <member optional="true"><type>void</type>* <name>pNext</name></member>
+ <member><type>VkBool32</type> <name>vertexAttributeInstanceRateDivisor</name></member>
+ <member><type>VkBool32</type> <name>vertexAttributeInstanceRateZeroDivisor</name></member>
+ </type>
+ <type category="struct" name="VkQueueFamilyCheckpointPropertiesNV" structextends="VkQueueFamilyProperties2" returnedonly="true">
+ <member values="VK_STRUCTURE_TYPE_QUEUE_FAMILY_CHECKPOINT_PROPERTIES_NV"><type>VkStructureType</type> <name>sType</name></member>
+ <member optional="true"><type>void</type>* <name>pNext</name></member>
+ <member limittype="bitmask"><type>VkPipelineStageFlags</type> <name>checkpointExecutionStageMask</name></member>
+ </type>
+ <type category="struct" name="VkCheckpointDataNV" returnedonly="true">
+ <member values="VK_STRUCTURE_TYPE_CHECKPOINT_DATA_NV"><type>VkStructureType</type> <name>sType</name></member>
+ <member optional="true"><type>void</type>* <name>pNext</name></member>
+ <member><type>VkPipelineStageFlagBits</type> <name>stage</name></member>
+ <member noautovalidity="true"><type>void</type>* <name>pCheckpointMarker</name></member>
+ </type>
+ <type category="struct" name="VkPhysicalDeviceDepthStencilResolveProperties" structextends="VkPhysicalDeviceProperties2" returnedonly="true">
+ <member values="VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_DEPTH_STENCIL_RESOLVE_PROPERTIES"><type>VkStructureType</type> <name>sType</name></member>
+ <member optional="true"><type>void</type>* <name>pNext</name></member>
+ <member limittype="bitmask"><type>VkResolveModeFlags</type> <name>supportedDepthResolveModes</name><comment>supported depth resolve modes</comment></member>
+ <member limittype="bitmask"><type>VkResolveModeFlags</type> <name>supportedStencilResolveModes</name><comment>supported stencil resolve modes</comment></member>
+ <member limittype="bitmask"><type>VkBool32</type> <name>independentResolveNone</name><comment>depth and stencil resolve modes can be set independently if one of them is none</comment></member>
+ <member limittype="bitmask"><type>VkBool32</type> <name>independentResolve</name><comment>depth and stencil resolve modes can be set independently</comment></member>
+ </type>
+ <type category="struct" name="VkPhysicalDeviceDepthStencilResolvePropertiesKHR" alias="VkPhysicalDeviceDepthStencilResolveProperties"/>
+ <type category="struct" name="VkSubpassDescriptionDepthStencilResolve" structextends="VkSubpassDescription2">
+ <member values="VK_STRUCTURE_TYPE_SUBPASS_DESCRIPTION_DEPTH_STENCIL_RESOLVE"><type>VkStructureType</type> <name>sType</name></member>
+ <member optional="true">const <type>void</type>* <name>pNext</name></member>
+ <member noautovalidity="true"><type>VkResolveModeFlagBits</type> <name>depthResolveMode</name><comment>depth resolve mode</comment></member>
+ <member noautovalidity="true"><type>VkResolveModeFlagBits</type> <name>stencilResolveMode</name><comment>stencil resolve mode</comment></member>
+ <member optional="true">const <type>VkAttachmentReference2</type>* <name>pDepthStencilResolveAttachment</name><comment>depth/stencil resolve attachment</comment></member>
+ </type>
+ <type category="struct" name="VkSubpassDescriptionDepthStencilResolveKHR" alias="VkSubpassDescriptionDepthStencilResolve"/>
+ <type category="struct" name="VkImageViewASTCDecodeModeEXT" structextends="VkImageViewCreateInfo">
+ <member values="VK_STRUCTURE_TYPE_IMAGE_VIEW_ASTC_DECODE_MODE_EXT"><type>VkStructureType</type> <name>sType</name></member>
+ <member optional="true">const <type>void</type>* <name>pNext</name></member>
+ <member><type>VkFormat</type> <name>decodeMode</name></member>
+ </type>
+ <type category="struct" name="VkPhysicalDeviceASTCDecodeFeaturesEXT" structextends="VkPhysicalDeviceFeatures2,VkDeviceCreateInfo">
+ <member values="VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_ASTC_DECODE_FEATURES_EXT"><type>VkStructureType</type> <name>sType</name></member>
+ <member optional="true"><type>void</type>* <name>pNext</name></member>
+ <member><type>VkBool32</type> <name>decodeModeSharedExponent</name></member>
+ </type>
+ <type category="struct" name="VkPhysicalDeviceTransformFeedbackFeaturesEXT" structextends="VkPhysicalDeviceFeatures2,VkDeviceCreateInfo">
+ <member values="VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_TRANSFORM_FEEDBACK_FEATURES_EXT"><type>VkStructureType</type> <name>sType</name></member>
+ <member optional="true"><type>void</type>* <name>pNext</name></member>
+ <member><type>VkBool32</type> <name>transformFeedback</name></member>
+ <member><type>VkBool32</type> <name>geometryStreams</name></member>
+ </type>
+ <type category="struct" name="VkPhysicalDeviceTransformFeedbackPropertiesEXT" structextends="VkPhysicalDeviceProperties2" returnedonly="true">
+ <member values="VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_TRANSFORM_FEEDBACK_PROPERTIES_EXT"><type>VkStructureType</type> <name>sType</name></member>
+ <member optional="true"><type>void</type>* <name>pNext</name></member>
+ <member limittype="max"><type>uint32_t</type> <name>maxTransformFeedbackStreams</name></member>
+ <member limittype="max"><type>uint32_t</type> <name>maxTransformFeedbackBuffers</name></member>
+ <member limittype="max"><type>VkDeviceSize</type> <name>maxTransformFeedbackBufferSize</name></member>
+ <member limittype="max"><type>uint32_t</type> <name>maxTransformFeedbackStreamDataSize</name></member>
+ <member limittype="max"><type>uint32_t</type> <name>maxTransformFeedbackBufferDataSize</name></member>
+ <member limittype="max"><type>uint32_t</type> <name>maxTransformFeedbackBufferDataStride</name></member>
+ <member limittype="bitmask"><type>VkBool32</type> <name>transformFeedbackQueries</name></member>
+ <member limittype="bitmask"><type>VkBool32</type> <name>transformFeedbackStreamsLinesTriangles</name></member>
+ <member limittype="bitmask"><type>VkBool32</type> <name>transformFeedbackRasterizationStreamSelect</name></member>
+ <member limittype="bitmask"><type>VkBool32</type> <name>transformFeedbackDraw</name></member>
+ </type>
+ <type category="struct" name="VkPipelineRasterizationStateStreamCreateInfoEXT" structextends="VkPipelineRasterizationStateCreateInfo">
+ <member values="VK_STRUCTURE_TYPE_PIPELINE_RASTERIZATION_STATE_STREAM_CREATE_INFO_EXT"><type>VkStructureType</type> <name>sType</name></member>
+ <member optional="true">const <type>void</type>* <name>pNext</name></member>
+ <member optional="true"><type>VkPipelineRasterizationStateStreamCreateFlagsEXT</type> <name>flags</name></member>
+ <member><type>uint32_t</type> <name>rasterizationStream</name></member>
+ </type>
+ <type category="struct" name="VkPhysicalDeviceRepresentativeFragmentTestFeaturesNV" structextends="VkPhysicalDeviceFeatures2,VkDeviceCreateInfo">
+ <member values="VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_REPRESENTATIVE_FRAGMENT_TEST_FEATURES_NV"><type>VkStructureType</type> <name>sType</name></member>
+ <member optional="true"><type>void</type>* <name>pNext</name></member>
+ <member><type>VkBool32</type> <name>representativeFragmentTest</name></member>
+ </type>
+ <type category="struct" name="VkPipelineRepresentativeFragmentTestStateCreateInfoNV" structextends="VkGraphicsPipelineCreateInfo">
+ <member values="VK_STRUCTURE_TYPE_PIPELINE_REPRESENTATIVE_FRAGMENT_TEST_STATE_CREATE_INFO_NV"><type>VkStructureType</type> <name>sType</name></member>
+ <member optional="true">const <type>void</type>* <name>pNext</name></member>
+ <member><type>VkBool32</type> <name>representativeFragmentTestEnable</name></member>
+ </type>
+ <type category="struct" name="VkPhysicalDeviceExclusiveScissorFeaturesNV" structextends="VkPhysicalDeviceFeatures2,VkDeviceCreateInfo">
+ <member values="VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_EXCLUSIVE_SCISSOR_FEATURES_NV"><type>VkStructureType</type> <name>sType</name></member>
+ <member optional="true"><type>void</type>* <name>pNext</name></member>
+ <member><type>VkBool32</type> <name>exclusiveScissor</name></member>
+ </type>
+ <type category="struct" name="VkPipelineViewportExclusiveScissorStateCreateInfoNV" structextends="VkPipelineViewportStateCreateInfo">
+ <member values="VK_STRUCTURE_TYPE_PIPELINE_VIEWPORT_EXCLUSIVE_SCISSOR_STATE_CREATE_INFO_NV"><type>VkStructureType</type> <name>sType</name></member>
+ <member optional="true">const <type>void</type>* <name>pNext</name></member>
+ <member optional="true"><type>uint32_t</type> <name>exclusiveScissorCount</name></member>
+ <member noautovalidity="true" len="exclusiveScissorCount">const <type>VkRect2D</type>* <name>pExclusiveScissors</name></member>
+ </type>
+ <type category="struct" name="VkPhysicalDeviceCornerSampledImageFeaturesNV" structextends="VkPhysicalDeviceFeatures2,VkDeviceCreateInfo">
+ <member values="VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_CORNER_SAMPLED_IMAGE_FEATURES_NV"><type>VkStructureType</type> <name>sType</name></member>
+ <member optional="true"><type>void</type>* <name>pNext</name></member>
+ <member><type>VkBool32</type> <name>cornerSampledImage</name></member>
+ </type>
+ <type category="struct" name="VkPhysicalDeviceComputeShaderDerivativesFeaturesNV" structextends="VkPhysicalDeviceFeatures2,VkDeviceCreateInfo">
+ <member values="VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_COMPUTE_SHADER_DERIVATIVES_FEATURES_NV"><type>VkStructureType</type> <name>sType</name></member>
+ <member optional="true"><type>void</type>* <name>pNext</name></member>
+ <member><type>VkBool32</type> <name>computeDerivativeGroupQuads</name></member>
+ <member><type>VkBool32</type> <name>computeDerivativeGroupLinear</name></member>
+ </type>
+ <type category="struct" name="VkPhysicalDeviceFragmentShaderBarycentricFeaturesNV" alias="VkPhysicalDeviceFragmentShaderBarycentricFeaturesKHR"/>
+ <type category="struct" name="VkPhysicalDeviceShaderImageFootprintFeaturesNV" structextends="VkPhysicalDeviceFeatures2,VkDeviceCreateInfo">
+ <member values="VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_SHADER_IMAGE_FOOTPRINT_FEATURES_NV"><type>VkStructureType</type> <name>sType</name></member>
+ <member optional="true"><type>void</type>* <name>pNext</name></member>
+ <member><type>VkBool32</type> <name>imageFootprint</name></member>
+ </type>
+ <type category="struct" name="VkPhysicalDeviceDedicatedAllocationImageAliasingFeaturesNV" structextends="VkPhysicalDeviceFeatures2,VkDeviceCreateInfo">
+ <member values="VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_DEDICATED_ALLOCATION_IMAGE_ALIASING_FEATURES_NV"><type>VkStructureType</type> <name>sType</name></member>
+ <member optional="true"><type>void</type>* <name>pNext</name></member>
+ <member><type>VkBool32</type> <name>dedicatedAllocationImageAliasing</name></member>
+ </type>
+ <type category="struct" name="VkShadingRatePaletteNV">
+ <member><type>uint32_t</type> <name>shadingRatePaletteEntryCount</name></member>
+ <member len="shadingRatePaletteEntryCount">const <type>VkShadingRatePaletteEntryNV</type>* <name>pShadingRatePaletteEntries</name></member>
+ </type>
+ <type category="struct" name="VkPipelineViewportShadingRateImageStateCreateInfoNV" structextends="VkPipelineViewportStateCreateInfo">
+ <member values="VK_STRUCTURE_TYPE_PIPELINE_VIEWPORT_SHADING_RATE_IMAGE_STATE_CREATE_INFO_NV"><type>VkStructureType</type> <name>sType</name></member>
+ <member optional="true">const <type>void</type>* <name>pNext</name></member>
+ <member><type>VkBool32</type> <name>shadingRateImageEnable</name></member>
+ <member optional="true"><type>uint32_t</type> <name>viewportCount</name></member>
+ <member noautovalidity="true" len="viewportCount">const <type>VkShadingRatePaletteNV</type>* <name>pShadingRatePalettes</name></member>
+ </type>
+ <type category="struct" name="VkPhysicalDeviceShadingRateImageFeaturesNV" structextends="VkPhysicalDeviceFeatures2,VkDeviceCreateInfo">
+ <member values="VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_SHADING_RATE_IMAGE_FEATURES_NV"><type>VkStructureType</type> <name>sType</name></member>
+ <member optional="true"><type>void</type>* <name>pNext</name></member>
+ <member><type>VkBool32</type> <name>shadingRateImage</name></member>
+ <member><type>VkBool32</type> <name>shadingRateCoarseSampleOrder</name></member>
+ </type>
+ <type category="struct" name="VkPhysicalDeviceShadingRateImagePropertiesNV" structextends="VkPhysicalDeviceProperties2" returnedonly="true">
+ <member values="VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_SHADING_RATE_IMAGE_PROPERTIES_NV"><type>VkStructureType</type> <name>sType</name></member>
+ <member optional="true"><type>void</type>* <name>pNext</name></member>
+ <member limittype="exact"><type>VkExtent2D</type> <name>shadingRateTexelSize</name></member>
+ <member limittype="max"><type>uint32_t</type> <name>shadingRatePaletteSize</name></member>
+ <member limittype="max"><type>uint32_t</type> <name>shadingRateMaxCoarseSamples</name></member>
+ </type>
+ <type category="struct" name="VkPhysicalDeviceInvocationMaskFeaturesHUAWEI" structextends="VkPhysicalDeviceFeatures2,VkDeviceCreateInfo">
+ <member values="VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_INVOCATION_MASK_FEATURES_HUAWEI"><type>VkStructureType</type> <name>sType</name></member>
+ <member optional="true"><type>void</type>* <name>pNext</name></member>
+ <member><type>VkBool32</type> <name>invocationMask</name></member>
+ </type>
+ <type category="struct" name="VkCoarseSampleLocationNV">
+ <member><type>uint32_t</type> <name>pixelX</name></member>
+ <member><type>uint32_t</type> <name>pixelY</name></member>
+ <member><type>uint32_t</type> <name>sample</name></member>
+ </type>
+ <type category="struct" name="VkCoarseSampleOrderCustomNV">
+ <member><type>VkShadingRatePaletteEntryNV</type> <name>shadingRate</name></member>
+ <member><type>uint32_t</type> <name>sampleCount</name></member>
+ <member><type>uint32_t</type> <name>sampleLocationCount</name></member>
+ <member len="sampleLocationCount">const <type>VkCoarseSampleLocationNV</type>* <name>pSampleLocations</name></member>
+ </type>
+ <type category="struct" name="VkPipelineViewportCoarseSampleOrderStateCreateInfoNV" structextends="VkPipelineViewportStateCreateInfo">
+ <member values="VK_STRUCTURE_TYPE_PIPELINE_VIEWPORT_COARSE_SAMPLE_ORDER_STATE_CREATE_INFO_NV"><type>VkStructureType</type> <name>sType</name></member>
+ <member optional="true">const <type>void</type>* <name>pNext</name></member>
+ <member><type>VkCoarseSampleOrderTypeNV</type> <name>sampleOrderType</name></member>
+ <member optional="true"><type>uint32_t</type> <name>customSampleOrderCount</name></member>
+ <member len="customSampleOrderCount">const <type>VkCoarseSampleOrderCustomNV</type>* <name>pCustomSampleOrders</name></member>
+ </type>
+ <type category="struct" name="VkPhysicalDeviceMeshShaderFeaturesNV" structextends="VkPhysicalDeviceFeatures2,VkDeviceCreateInfo">
+ <member values="VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_MESH_SHADER_FEATURES_NV"><type>VkStructureType</type> <name>sType</name></member>
+ <member optional="true"><type>void</type>* <name>pNext</name></member>
+ <member><type>VkBool32</type> <name>taskShader</name></member>
+ <member><type>VkBool32</type> <name>meshShader</name></member>
+ </type>
+ <type category="struct" name="VkPhysicalDeviceMeshShaderPropertiesNV" returnedonly="true" structextends="VkPhysicalDeviceProperties2">
+ <member values="VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_MESH_SHADER_PROPERTIES_NV"><type>VkStructureType</type> <name>sType</name></member>
+ <member optional="true"><type>void</type>* <name>pNext</name></member>
+ <member limittype="max"><type>uint32_t</type> <name>maxDrawMeshTasksCount</name></member>
+ <member limittype="max"><type>uint32_t</type> <name>maxTaskWorkGroupInvocations</name></member>
+ <member limittype="max"><type>uint32_t</type> <name>maxTaskWorkGroupSize</name>[3]</member>
+ <member limittype="max"><type>uint32_t</type> <name>maxTaskTotalMemorySize</name></member>
+ <member limittype="max"><type>uint32_t</type> <name>maxTaskOutputCount</name></member>
+ <member limittype="max"><type>uint32_t</type> <name>maxMeshWorkGroupInvocations</name></member>
+ <member limittype="max"><type>uint32_t</type> <name>maxMeshWorkGroupSize</name>[3]</member>
+ <member limittype="max"><type>uint32_t</type> <name>maxMeshTotalMemorySize</name></member>
+ <member limittype="max"><type>uint32_t</type> <name>maxMeshOutputVertices</name></member>
+ <member limittype="max"><type>uint32_t</type> <name>maxMeshOutputPrimitives</name></member>
+ <member limittype="max"><type>uint32_t</type> <name>maxMeshMultiviewViewCount</name></member>
+ <member limittype="min,mul"><type>uint32_t</type> <name>meshOutputPerVertexGranularity</name></member>
+ <member limittype="min,mul"><type>uint32_t</type> <name>meshOutputPerPrimitiveGranularity</name></member>
+ </type>
+ <type category="struct" name="VkDrawMeshTasksIndirectCommandNV">
+ <member><type>uint32_t</type> <name>taskCount</name></member>
+ <member><type>uint32_t</type> <name>firstTask</name></member>
+ </type>
+ <type category="struct" name="VkRayTracingShaderGroupCreateInfoNV">
+ <member values="VK_STRUCTURE_TYPE_RAY_TRACING_SHADER_GROUP_CREATE_INFO_NV"><type>VkStructureType</type> <name>sType</name></member>
+ <member optional="true">const <type>void</type>* <name>pNext</name></member>
+ <member><type>VkRayTracingShaderGroupTypeKHR</type> <name>type</name></member>
+ <member><type>uint32_t</type> <name>generalShader</name></member>
+ <member><type>uint32_t</type> <name>closestHitShader</name></member>
+ <member><type>uint32_t</type> <name>anyHitShader</name></member>
+ <member><type>uint32_t</type> <name>intersectionShader</name></member>
+ </type>
+ <type category="struct" name="VkRayTracingShaderGroupCreateInfoKHR">
+ <member values="VK_STRUCTURE_TYPE_RAY_TRACING_SHADER_GROUP_CREATE_INFO_KHR"><type>VkStructureType</type> <name>sType</name></member>
+ <member optional="true">const <type>void</type>* <name>pNext</name></member>
+ <member><type>VkRayTracingShaderGroupTypeKHR</type> <name>type</name></member>
+ <member><type>uint32_t</type> <name>generalShader</name></member>
+ <member><type>uint32_t</type> <name>closestHitShader</name></member>
+ <member><type>uint32_t</type> <name>anyHitShader</name></member>
+ <member><type>uint32_t</type> <name>intersectionShader</name></member>
+ <member optional="true">const <type>void</type>* <name>pShaderGroupCaptureReplayHandle</name></member>
+ </type>
+ <type category="struct" name="VkRayTracingPipelineCreateInfoNV">
+ <member values="VK_STRUCTURE_TYPE_RAY_TRACING_PIPELINE_CREATE_INFO_NV"><type>VkStructureType</type> <name>sType</name></member>
+ <member optional="true">const <type>void</type>* <name>pNext</name></member>
+ <member optional="true"><type>VkPipelineCreateFlags</type> <name>flags</name><comment>Pipeline creation flags</comment></member>
+ <member><type>uint32_t</type> <name>stageCount</name></member>
+ <member len="stageCount">const <type>VkPipelineShaderStageCreateInfo</type>* <name>pStages</name><comment>One entry for each active shader stage</comment></member>
+ <member><type>uint32_t</type> <name>groupCount</name></member>
+ <member len="groupCount">const <type>VkRayTracingShaderGroupCreateInfoNV</type>* <name>pGroups</name></member>
+ <member><type>uint32_t</type> <name>maxRecursionDepth</name></member>
+ <member><type>VkPipelineLayout</type> <name>layout</name><comment>Interface layout of the pipeline</comment></member>
+ <member noautovalidity="true" optional="true"><type>VkPipeline</type> <name>basePipelineHandle</name><comment>If VK_PIPELINE_CREATE_DERIVATIVE_BIT is set and this value is nonzero, it specifies the handle of the base pipeline this is a derivative of</comment></member>
+ <member><type>int32_t</type> <name>basePipelineIndex</name><comment>If VK_PIPELINE_CREATE_DERIVATIVE_BIT is set and this value is not -1, it specifies an index into pCreateInfos of the base pipeline this is a derivative of</comment></member>
+ </type>
+ <type category="struct" name="VkRayTracingPipelineCreateInfoKHR">
+ <member values="VK_STRUCTURE_TYPE_RAY_TRACING_PIPELINE_CREATE_INFO_KHR"><type>VkStructureType</type> <name>sType</name></member>
+ <member optional="true">const <type>void</type>* <name>pNext</name></member>
+ <member optional="true"><type>VkPipelineCreateFlags</type> <name>flags</name><comment>Pipeline creation flags</comment></member>
+ <member optional="true"><type>uint32_t</type> <name>stageCount</name></member>
+ <member len="stageCount">const <type>VkPipelineShaderStageCreateInfo</type>* <name>pStages</name><comment>One entry for each active shader stage</comment></member>
+ <member optional="true"><type>uint32_t</type> <name>groupCount</name></member>
+ <member len="groupCount">const <type>VkRayTracingShaderGroupCreateInfoKHR</type>* <name>pGroups</name></member>
+ <member><type>uint32_t</type> <name>maxPipelineRayRecursionDepth</name></member>
+ <member optional="true">const <type>VkPipelineLibraryCreateInfoKHR</type>* <name>pLibraryInfo</name></member>
+ <member optional="true">const <type>VkRayTracingPipelineInterfaceCreateInfoKHR</type>* <name>pLibraryInterface</name></member>
+ <member optional="true">const <type>VkPipelineDynamicStateCreateInfo</type>* <name>pDynamicState</name></member>
+ <member><type>VkPipelineLayout</type> <name>layout</name><comment>Interface layout of the pipeline</comment></member>
+ <member noautovalidity="true" optional="true"><type>VkPipeline</type> <name>basePipelineHandle</name><comment>If VK_PIPELINE_CREATE_DERIVATIVE_BIT is set and this value is nonzero, it specifies the handle of the base pipeline this is a derivative of</comment></member>
+ <member><type>int32_t</type> <name>basePipelineIndex</name><comment>If VK_PIPELINE_CREATE_DERIVATIVE_BIT is set and this value is not -1, it specifies an index into pCreateInfos of the base pipeline this is a derivative of</comment></member>
+ </type>
+ <type category="struct" name="VkGeometryTrianglesNV">
+ <member values="VK_STRUCTURE_TYPE_GEOMETRY_TRIANGLES_NV"><type>VkStructureType</type> <name>sType</name></member>
+ <member optional="true">const <type>void</type>* <name>pNext</name></member>
+ <member optional="true"><type>VkBuffer</type> <name>vertexData</name></member>
+ <member><type>VkDeviceSize</type> <name>vertexOffset</name></member>
+ <member><type>uint32_t</type> <name>vertexCount</name></member>
+ <member><type>VkDeviceSize</type> <name>vertexStride</name></member>
+ <member><type>VkFormat</type> <name>vertexFormat</name></member>
+ <member optional="true"><type>VkBuffer</type> <name>indexData</name></member>
+ <member><type>VkDeviceSize</type> <name>indexOffset</name></member>
+ <member><type>uint32_t</type> <name>indexCount</name></member>
+ <member><type>VkIndexType</type> <name>indexType</name></member>
+ <member optional="true"><type>VkBuffer</type> <name>transformData</name><comment>Optional reference to array of floats representing a 3x4 row major affine transformation matrix.</comment></member>
+ <member><type>VkDeviceSize</type> <name>transformOffset</name></member>
+ </type>
+ <type category="struct" name="VkGeometryAABBNV">
+ <member values="VK_STRUCTURE_TYPE_GEOMETRY_AABB_NV"><type>VkStructureType</type> <name>sType</name></member>
+ <member optional="true">const <type>void</type>* <name>pNext</name></member>
+ <member optional="true"><type>VkBuffer</type> <name>aabbData</name></member>
+ <member><type>uint32_t</type> <name>numAABBs</name></member>
+ <member><type>uint32_t</type> <name>stride</name><comment>Stride in bytes between AABBs</comment></member>
+ <member><type>VkDeviceSize</type> <name>offset</name><comment>Offset in bytes of the first AABB in aabbData</comment></member>
+ </type>
+ <type category="struct" name="VkGeometryDataNV">
+ <member><type>VkGeometryTrianglesNV</type> <name>triangles</name></member>
+ <member><type>VkGeometryAABBNV</type> <name>aabbs</name></member>
+ </type>
+ <type category="struct" name="VkGeometryNV">
+ <member values="VK_STRUCTURE_TYPE_GEOMETRY_NV"><type>VkStructureType</type> <name>sType</name></member>
+ <member optional="true">const <type>void</type>* <name>pNext</name></member>
+ <member><type>VkGeometryTypeKHR</type> <name>geometryType</name></member>
+ <member><type>VkGeometryDataNV</type> <name>geometry</name></member>
+ <member optional="true"><type>VkGeometryFlagsKHR</type> <name>flags</name></member>
+ </type>
+ <type category="struct" name="VkAccelerationStructureInfoNV">
+ <member values="VK_STRUCTURE_TYPE_ACCELERATION_STRUCTURE_INFO_NV"><type>VkStructureType</type> <name>sType</name></member>
+ <member optional="true">const <type>void</type>* <name>pNext</name></member>
+ <member><type>VkAccelerationStructureTypeNV</type> <name>type</name></member>
+ <member optional="true"><type>VkBuildAccelerationStructureFlagsNV</type> <name>flags</name></member>
+ <member optional="true"><type>uint32_t</type> <name>instanceCount</name></member>
+ <member optional="true"><type>uint32_t</type> <name>geometryCount</name></member>
+ <member len="geometryCount">const <type>VkGeometryNV</type>* <name>pGeometries</name></member>
+ </type>
+ <type category="struct" name="VkAccelerationStructureCreateInfoNV">
+ <member values="VK_STRUCTURE_TYPE_ACCELERATION_STRUCTURE_CREATE_INFO_NV"><type>VkStructureType</type> <name>sType</name></member>
+ <member optional="true">const <type>void</type>* <name>pNext</name></member>
+ <member><type>VkDeviceSize</type> <name>compactedSize</name></member>
+ <member><type>VkAccelerationStructureInfoNV</type> <name>info</name></member>
+ </type>
+ <type category="struct" name="VkBindAccelerationStructureMemoryInfoNV">
+ <member values="VK_STRUCTURE_TYPE_BIND_ACCELERATION_STRUCTURE_MEMORY_INFO_NV"><type>VkStructureType</type> <name>sType</name></member>
+ <member optional="true">const <type>void</type>* <name>pNext</name></member>
+ <member><type>VkAccelerationStructureNV</type> <name>accelerationStructure</name></member>
+ <member><type>VkDeviceMemory</type> <name>memory</name></member>
+ <member><type>VkDeviceSize</type> <name>memoryOffset</name></member>
+ <member optional="true"><type>uint32_t</type> <name>deviceIndexCount</name></member>
+ <member len="deviceIndexCount">const <type>uint32_t</type>* <name>pDeviceIndices</name></member>
+ </type>
+ <type category="struct" name="VkWriteDescriptorSetAccelerationStructureKHR" structextends="VkWriteDescriptorSet">
+ <member values="VK_STRUCTURE_TYPE_WRITE_DESCRIPTOR_SET_ACCELERATION_STRUCTURE_KHR"><type>VkStructureType</type> <name>sType</name></member>
+ <member optional="true">const <type>void</type>* <name>pNext</name></member>
+ <member><type>uint32_t</type> <name>accelerationStructureCount</name></member>
+ <member optional="false,true" len="accelerationStructureCount">const <type>VkAccelerationStructureKHR</type>* <name>pAccelerationStructures</name></member>
+ </type>
+ <type category="struct" name="VkWriteDescriptorSetAccelerationStructureNV" structextends="VkWriteDescriptorSet">
+ <member values="VK_STRUCTURE_TYPE_WRITE_DESCRIPTOR_SET_ACCELERATION_STRUCTURE_NV"><type>VkStructureType</type> <name>sType</name></member>
+ <member optional="true">const <type>void</type>* <name>pNext</name></member>
+ <member><type>uint32_t</type> <name>accelerationStructureCount</name></member>
+ <member optional="false,true" len="accelerationStructureCount">const <type>VkAccelerationStructureNV</type>* <name>pAccelerationStructures</name></member>
+ </type>
+ <type category="struct" name="VkAccelerationStructureMemoryRequirementsInfoNV">
+ <member values="VK_STRUCTURE_TYPE_ACCELERATION_STRUCTURE_MEMORY_REQUIREMENTS_INFO_NV"><type>VkStructureType</type> <name>sType</name></member>
+ <member optional="true">const <type>void</type>* <name>pNext</name></member>
+ <member><type>VkAccelerationStructureMemoryRequirementsTypeNV</type> <name>type</name></member>
+ <member><type>VkAccelerationStructureNV</type> <name>accelerationStructure</name></member>
+ </type>
+ <type category="struct" name="VkPhysicalDeviceAccelerationStructureFeaturesKHR" structextends="VkPhysicalDeviceFeatures2,VkDeviceCreateInfo">
+ <member values="VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_ACCELERATION_STRUCTURE_FEATURES_KHR"><type>VkStructureType</type> <name>sType</name></member>
+ <member optional="true"><type>void</type>* <name>pNext</name></member>
+ <member><type>VkBool32</type> <name>accelerationStructure</name></member>
+ <member><type>VkBool32</type> <name>accelerationStructureCaptureReplay</name></member>
+ <member><type>VkBool32</type> <name>accelerationStructureIndirectBuild</name></member>
+ <member><type>VkBool32</type> <name>accelerationStructureHostCommands</name></member>
+ <member><type>VkBool32</type> <name>descriptorBindingAccelerationStructureUpdateAfterBind</name></member>
+ </type>
+ <type category="struct" name="VkPhysicalDeviceRayTracingPipelineFeaturesKHR" structextends="VkPhysicalDeviceFeatures2,VkDeviceCreateInfo">
+ <member values="VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_RAY_TRACING_PIPELINE_FEATURES_KHR"><type>VkStructureType</type> <name>sType</name></member>
+ <member optional="true"><type>void</type>* <name>pNext</name></member>
+ <member><type>VkBool32</type> <name>rayTracingPipeline</name></member>
+ <member><type>VkBool32</type> <name>rayTracingPipelineShaderGroupHandleCaptureReplay</name></member>
+ <member><type>VkBool32</type> <name>rayTracingPipelineShaderGroupHandleCaptureReplayMixed</name></member>
+ <member><type>VkBool32</type> <name>rayTracingPipelineTraceRaysIndirect</name></member>
+ <member><type>VkBool32</type> <name>rayTraversalPrimitiveCulling</name></member>
+ </type>
+ <type category="struct" name="VkPhysicalDeviceRayQueryFeaturesKHR" structextends="VkPhysicalDeviceFeatures2,VkDeviceCreateInfo">
+ <member values="VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_RAY_QUERY_FEATURES_KHR"><type>VkStructureType</type> <name>sType</name></member>
+ <member optional="true"><type>void</type>* <name>pNext</name></member>
+ <member><type>VkBool32</type> <name>rayQuery</name></member>
+ </type>
+ <type category="struct" name="VkPhysicalDeviceAccelerationStructurePropertiesKHR" returnedonly="true" structextends="VkPhysicalDeviceProperties2">
+ <member values="VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_ACCELERATION_STRUCTURE_PROPERTIES_KHR"><type>VkStructureType</type> <name>sType</name></member>
+ <member optional="true"><type>void</type>* <name>pNext</name></member>
+ <member limittype="max"><type>uint64_t</type> <name>maxGeometryCount</name></member>
+ <member limittype="max"><type>uint64_t</type> <name>maxInstanceCount</name></member>
+ <member limittype="max"><type>uint64_t</type> <name>maxPrimitiveCount</name></member>
+ <member limittype="max"><type>uint32_t</type> <name>maxPerStageDescriptorAccelerationStructures</name></member>
+ <member limittype="max"><type>uint32_t</type> <name>maxPerStageDescriptorUpdateAfterBindAccelerationStructures</name></member>
+ <member limittype="max"><type>uint32_t</type> <name>maxDescriptorSetAccelerationStructures</name></member>
+ <member limittype="max"><type>uint32_t</type> <name>maxDescriptorSetUpdateAfterBindAccelerationStructures</name></member>
+ <member limittype="min"><type>uint32_t</type> <name>minAccelerationStructureScratchOffsetAlignment</name></member>
+ </type>
+ <type category="struct" name="VkPhysicalDeviceRayTracingPipelinePropertiesKHR" returnedonly="true" structextends="VkPhysicalDeviceProperties2">
+ <member values="VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_RAY_TRACING_PIPELINE_PROPERTIES_KHR"><type>VkStructureType</type> <name>sType</name></member>
+ <member optional="true"><type>void</type>* <name>pNext</name></member>
+ <member limittype="exact"><type>uint32_t</type> <name>shaderGroupHandleSize</name></member>
+ <member limittype="max"><type>uint32_t</type> <name>maxRayRecursionDepth</name></member>
+ <member limittype="max"><type>uint32_t</type> <name>maxShaderGroupStride</name></member>
+ <member limittype="exact"><type>uint32_t</type> <name>shaderGroupBaseAlignment</name></member>
+ <member limittype="exact"><type>uint32_t</type> <name>shaderGroupHandleCaptureReplaySize</name></member>
+ <member limittype="max"><type>uint32_t</type> <name>maxRayDispatchInvocationCount</name></member>
+ <member limittype="min,pot"><type>uint32_t</type> <name>shaderGroupHandleAlignment</name></member>
+ <member limittype="max"><type>uint32_t</type> <name>maxRayHitAttributeSize</name></member>
+ </type>
+ <type category="struct" name="VkPhysicalDeviceRayTracingPropertiesNV" returnedonly="true" structextends="VkPhysicalDeviceProperties2">
+ <member values="VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_RAY_TRACING_PROPERTIES_NV"><type>VkStructureType</type> <name>sType</name></member>
+ <member optional="true"><type>void</type>* <name>pNext</name></member>
+ <member limittype="exact"><type>uint32_t</type> <name>shaderGroupHandleSize</name></member>
+ <member limittype="max"><type>uint32_t</type> <name>maxRecursionDepth</name></member>
+ <member limittype="max"><type>uint32_t</type> <name>maxShaderGroupStride</name></member>
+ <member limittype="exact"><type>uint32_t</type> <name>shaderGroupBaseAlignment</name></member>
+ <member limittype="max"><type>uint64_t</type> <name>maxGeometryCount</name></member>
+ <member limittype="max"><type>uint64_t</type> <name>maxInstanceCount</name></member>
+ <member limittype="max"><type>uint64_t</type> <name>maxTriangleCount</name></member>
+ <member limittype="max"><type>uint32_t</type> <name>maxDescriptorSetAccelerationStructures</name></member>
+ </type>
+ <type category="struct" name="VkStridedDeviceAddressRegionKHR">
+ <member optional="true"><type>VkDeviceAddress</type> <name>deviceAddress</name></member>
+ <member><type>VkDeviceSize</type> <name>stride</name></member>
+ <member><type>VkDeviceSize</type> <name>size</name></member>
+ </type>
+ <type category="struct" name="VkTraceRaysIndirectCommandKHR">
+ <member><type>uint32_t</type> <name>width</name></member>
+ <member><type>uint32_t</type> <name>height</name></member>
+ <member><type>uint32_t</type> <name>depth</name></member>
+ </type>
+ <type category="struct" name="VkTraceRaysIndirectCommand2KHR">
+ <member><type>VkDeviceAddress</type> <name>raygenShaderRecordAddress</name></member>
+ <member><type>VkDeviceSize</type> <name>raygenShaderRecordSize</name></member>
+ <member><type>VkDeviceAddress</type> <name>missShaderBindingTableAddress</name></member>
+ <member><type>VkDeviceSize</type> <name>missShaderBindingTableSize</name></member>
+ <member><type>VkDeviceSize</type> <name>missShaderBindingTableStride</name></member>
+ <member><type>VkDeviceAddress</type> <name>hitShaderBindingTableAddress</name></member>
+ <member><type>VkDeviceSize</type> <name>hitShaderBindingTableSize</name></member>
+ <member><type>VkDeviceSize</type> <name>hitShaderBindingTableStride</name></member>
+ <member><type>VkDeviceAddress</type> <name>callableShaderBindingTableAddress</name></member>
+ <member><type>VkDeviceSize</type> <name>callableShaderBindingTableSize</name></member>
+ <member><type>VkDeviceSize</type> <name>callableShaderBindingTableStride</name></member>
+ <member><type>uint32_t</type> <name>width</name></member>
+ <member><type>uint32_t</type> <name>height</name></member>
+ <member><type>uint32_t</type> <name>depth</name></member>
+ </type>
+ <type category="struct" name="VkPhysicalDeviceRayTracingMaintenance1FeaturesKHR" structextends="VkPhysicalDeviceFeatures2,VkDeviceCreateInfo">
+ <member values="VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_RAY_TRACING_MAINTENANCE_1_FEATURES_KHR"><type>VkStructureType</type> <name>sType</name></member>
+ <member optional="true"><type>void</type>* <name>pNext</name></member>
+ <member><type>VkBool32</type> <name>rayTracingMaintenance1</name></member>
+ <member><type>VkBool32</type> <name>rayTracingPipelineTraceRaysIndirect2</name></member>
+ </type>
+ <type category="struct" name="VkDrmFormatModifierPropertiesListEXT" returnedonly="true" structextends="VkFormatProperties2">
+ <member values="VK_STRUCTURE_TYPE_DRM_FORMAT_MODIFIER_PROPERTIES_LIST_EXT"><type>VkStructureType</type> <name>sType</name></member>
+ <member optional="true"><type>void</type>* <name>pNext</name></member>
+ <member optional="true"><type>uint32_t</type> <name>drmFormatModifierCount</name></member>
+ <member optional="true" len="drmFormatModifierCount"><type>VkDrmFormatModifierPropertiesEXT</type>* <name>pDrmFormatModifierProperties</name></member>
+ </type>
+ <type category="struct" name="VkDrmFormatModifierPropertiesEXT" returnedonly="true">
+ <member><type>uint64_t</type> <name>drmFormatModifier</name></member>
+ <member><type>uint32_t</type> <name>drmFormatModifierPlaneCount</name></member>
+ <member><type>VkFormatFeatureFlags</type> <name>drmFormatModifierTilingFeatures</name></member>
+ </type>
+ <type category="struct" name="VkPhysicalDeviceImageDrmFormatModifierInfoEXT" structextends="VkPhysicalDeviceImageFormatInfo2">
+ <member values="VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_IMAGE_DRM_FORMAT_MODIFIER_INFO_EXT"><type>VkStructureType</type> <name>sType</name></member>
+ <member optional="true">const <type>void</type>* <name>pNext</name></member>
+ <member><type>uint64_t</type> <name>drmFormatModifier</name></member>
+ <member><type>VkSharingMode</type> <name>sharingMode</name></member>
+ <member optional="true"><type>uint32_t</type> <name>queueFamilyIndexCount</name></member>
+ <member noautovalidity="true" len="queueFamilyIndexCount">const <type>uint32_t</type>* <name>pQueueFamilyIndices</name></member>
+ </type>
+ <type category="struct" name="VkImageDrmFormatModifierListCreateInfoEXT" structextends="VkImageCreateInfo">
+ <member values="VK_STRUCTURE_TYPE_IMAGE_DRM_FORMAT_MODIFIER_LIST_CREATE_INFO_EXT"><type>VkStructureType</type> <name>sType</name></member>
+ <member optional="true">const <type>void</type>* <name>pNext</name></member>
+ <member><type>uint32_t</type> <name>drmFormatModifierCount</name></member>
+ <member len="drmFormatModifierCount">const <type>uint64_t</type>* <name>pDrmFormatModifiers</name></member>
+ </type>
+ <type category="struct" name="VkImageDrmFormatModifierExplicitCreateInfoEXT" structextends="VkImageCreateInfo">
+ <member values="VK_STRUCTURE_TYPE_IMAGE_DRM_FORMAT_MODIFIER_EXPLICIT_CREATE_INFO_EXT"><type>VkStructureType</type> <name>sType</name></member>
+ <member optional="true">const <type>void</type>* <name>pNext</name></member>
+ <member><type>uint64_t</type> <name>drmFormatModifier</name></member>
+ <member optional="false"><type>uint32_t</type> <name>drmFormatModifierPlaneCount</name></member>
+ <member len="drmFormatModifierPlaneCount">const <type>VkSubresourceLayout</type>* <name>pPlaneLayouts</name></member>
+ </type>
+ <type category="struct" name="VkImageDrmFormatModifierPropertiesEXT" returnedonly="true">
+ <member values="VK_STRUCTURE_TYPE_IMAGE_DRM_FORMAT_MODIFIER_PROPERTIES_EXT"><type>VkStructureType</type> <name>sType</name></member>
+ <member optional="true"><type>void</type>* <name>pNext</name></member>
+ <member><type>uint64_t</type> <name>drmFormatModifier</name></member>
+ </type>
+ <type category="struct" name="VkImageStencilUsageCreateInfo" structextends="VkImageCreateInfo,VkPhysicalDeviceImageFormatInfo2">
+ <member values="VK_STRUCTURE_TYPE_IMAGE_STENCIL_USAGE_CREATE_INFO"><type>VkStructureType</type> <name>sType</name></member>
+ <member optional="true">const <type>void</type>* <name>pNext</name></member>
+ <member><type>VkImageUsageFlags</type> <name>stencilUsage</name></member>
+ </type>
+ <type category="struct" name="VkImageStencilUsageCreateInfoEXT" alias="VkImageStencilUsageCreateInfo"/>
+ <type category="struct" name="VkDeviceMemoryOverallocationCreateInfoAMD" structextends="VkDeviceCreateInfo">
+ <member values="VK_STRUCTURE_TYPE_DEVICE_MEMORY_OVERALLOCATION_CREATE_INFO_AMD"><type>VkStructureType</type> <name>sType</name></member>
+ <member optional="true">const <type>void</type>* <name>pNext</name></member>
+ <member><type>VkMemoryOverallocationBehaviorAMD</type> <name>overallocationBehavior</name></member>
+ </type>
+ <type category="struct" name="VkPhysicalDeviceFragmentDensityMapFeaturesEXT" structextends="VkPhysicalDeviceFeatures2,VkDeviceCreateInfo">
+ <member values="VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_FRAGMENT_DENSITY_MAP_FEATURES_EXT"><type>VkStructureType</type> <name>sType</name></member>
+ <member optional="true"><type>void</type>* <name>pNext</name></member>
+ <member><type>VkBool32</type> <name>fragmentDensityMap</name></member>
+ <member><type>VkBool32</type> <name>fragmentDensityMapDynamic</name></member>
+ <member><type>VkBool32</type> <name>fragmentDensityMapNonSubsampledImages</name></member>
+ </type>
+ <type category="struct" name="VkPhysicalDeviceFragmentDensityMap2FeaturesEXT" structextends="VkPhysicalDeviceFeatures2,VkDeviceCreateInfo">
+ <member values="VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_FRAGMENT_DENSITY_MAP_2_FEATURES_EXT"><type>VkStructureType</type> <name>sType</name></member>
+ <member optional="true"><type>void</type>* <name>pNext</name></member>
+ <member><type>VkBool32</type> <name>fragmentDensityMapDeferred</name></member>
+ </type>
+ <type category="struct" name="VkPhysicalDeviceFragmentDensityMapOffsetFeaturesQCOM" structextends="VkPhysicalDeviceFeatures2,VkDeviceCreateInfo">
+ <member values="VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_FRAGMENT_DENSITY_MAP_OFFSET_FEATURES_QCOM"><type>VkStructureType</type> <name>sType</name></member>
+ <member optional="true"><type>void</type>* <name>pNext</name></member>
+ <member><type>VkBool32</type> <name>fragmentDensityMapOffset</name></member>
+ </type>
+ <type category="struct" name="VkPhysicalDeviceFragmentDensityMapPropertiesEXT" returnedonly="true" structextends="VkPhysicalDeviceProperties2">
+ <member values="VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_FRAGMENT_DENSITY_MAP_PROPERTIES_EXT"><type>VkStructureType</type> <name>sType</name></member>
+ <member optional="true"><type>void</type>* <name>pNext</name></member>
+ <member limittype="min"><type>VkExtent2D</type> <name>minFragmentDensityTexelSize</name></member>
+ <member limittype="max"><type>VkExtent2D</type> <name>maxFragmentDensityTexelSize</name></member>
+ <member limittype="bitmask"><type>VkBool32</type> <name>fragmentDensityInvocations</name></member>
+ </type>
+ <type category="struct" name="VkPhysicalDeviceFragmentDensityMap2PropertiesEXT" returnedonly="true" structextends="VkPhysicalDeviceProperties2">
+ <member values="VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_FRAGMENT_DENSITY_MAP_2_PROPERTIES_EXT"><type>VkStructureType</type> <name>sType</name></member>
+ <member optional="true"><type>void</type>* <name>pNext</name></member>
+ <member limittype="exact"><type>VkBool32</type> <name>subsampledLoads</name></member>
+ <member limittype="exact"><type>VkBool32</type> <name>subsampledCoarseReconstructionEarlyAccess</name></member>
+ <member limittype="max"><type>uint32_t</type> <name>maxSubsampledArrayLayers</name></member>
+ <member limittype="max"><type>uint32_t</type> <name>maxDescriptorSetSubsampledSamplers</name></member>
+ </type>
+ <type category="struct" name="VkPhysicalDeviceFragmentDensityMapOffsetPropertiesQCOM" returnedonly="true" structextends="VkPhysicalDeviceProperties2">
+ <member values="VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_FRAGMENT_DENSITY_MAP_OFFSET_PROPERTIES_QCOM"><type>VkStructureType</type> <name>sType</name></member>
+ <member optional="true"><type>void</type>* <name>pNext</name></member>
+ <member limittype="min,mul"><type>VkExtent2D</type> <name>fragmentDensityOffsetGranularity</name></member>
+ </type>
+ <type category="struct" name="VkRenderPassFragmentDensityMapCreateInfoEXT" structextends="VkRenderPassCreateInfo,VkRenderPassCreateInfo2">
+ <member values="VK_STRUCTURE_TYPE_RENDER_PASS_FRAGMENT_DENSITY_MAP_CREATE_INFO_EXT"><type>VkStructureType</type> <name>sType</name></member>
+ <member optional="true">const <type>void</type>* <name>pNext</name></member>
+ <member><type>VkAttachmentReference</type> <name>fragmentDensityMapAttachment</name></member>
+ </type>
+ <type category="struct" name="VkSubpassFragmentDensityMapOffsetEndInfoQCOM" structextends="VkSubpassEndInfo">
+ <member values="VK_STRUCTURE_TYPE_SUBPASS_FRAGMENT_DENSITY_MAP_OFFSET_END_INFO_QCOM"><type>VkStructureType</type> <name>sType</name></member>
+ <member optional="true">const <type>void</type>* <name>pNext</name></member>
+ <member optional="true"><type>uint32_t</type> <name>fragmentDensityOffsetCount</name></member>
+ <member len="fragmentDensityOffsetCount">const <type>VkOffset2D</type>* <name>pFragmentDensityOffsets</name></member>
+ </type>
+ <type category="struct" name="VkPhysicalDeviceScalarBlockLayoutFeatures" structextends="VkPhysicalDeviceFeatures2,VkDeviceCreateInfo">
+ <member values="VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_SCALAR_BLOCK_LAYOUT_FEATURES"><type>VkStructureType</type> <name>sType</name></member>
+ <member optional="true"><type>void</type>* <name>pNext</name></member>
+ <member><type>VkBool32</type> <name>scalarBlockLayout</name></member>
+ </type>
+ <type category="struct" name="VkPhysicalDeviceScalarBlockLayoutFeaturesEXT" alias="VkPhysicalDeviceScalarBlockLayoutFeatures"/>
+ <type category="struct" name="VkSurfaceProtectedCapabilitiesKHR" structextends="VkSurfaceCapabilities2KHR">
+ <member values="VK_STRUCTURE_TYPE_SURFACE_PROTECTED_CAPABILITIES_KHR"><type>VkStructureType</type> <name>sType</name></member>
+ <member optional="true">const <type>void</type>* <name>pNext</name></member>
+ <member><type>VkBool32</type> <name>supportsProtected</name><comment>Represents if surface can be protected</comment></member>
+ </type>
+ <type category="struct" name="VkPhysicalDeviceUniformBufferStandardLayoutFeatures" structextends="VkPhysicalDeviceFeatures2,VkDeviceCreateInfo">
+ <member values="VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_UNIFORM_BUFFER_STANDARD_LAYOUT_FEATURES"><type>VkStructureType</type> <name>sType</name></member>
+ <member optional="true"><type>void</type>* <name>pNext</name></member>
+ <member><type>VkBool32</type> <name>uniformBufferStandardLayout</name></member>
+ </type>
+ <type category="struct" name="VkPhysicalDeviceUniformBufferStandardLayoutFeaturesKHR" alias="VkPhysicalDeviceUniformBufferStandardLayoutFeatures"/>
+ <type category="struct" name="VkPhysicalDeviceDepthClipEnableFeaturesEXT" structextends="VkPhysicalDeviceFeatures2,VkDeviceCreateInfo">
+ <member values="VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_DEPTH_CLIP_ENABLE_FEATURES_EXT"><type>VkStructureType</type> <name>sType</name></member>
+ <member optional="true"><type>void</type>* <name>pNext</name></member>
+ <member><type>VkBool32</type> <name>depthClipEnable</name></member>
+ </type>
+ <type category="struct" name="VkPipelineRasterizationDepthClipStateCreateInfoEXT" structextends="VkPipelineRasterizationStateCreateInfo">
+ <member values="VK_STRUCTURE_TYPE_PIPELINE_RASTERIZATION_DEPTH_CLIP_STATE_CREATE_INFO_EXT"><type>VkStructureType</type> <name>sType</name></member>
+ <member optional="true">const <type>void</type>* <name>pNext</name></member>
+ <member optional="true"><type>VkPipelineRasterizationDepthClipStateCreateFlagsEXT</type> <name>flags</name><comment>Reserved</comment></member>
+ <member><type>VkBool32</type> <name>depthClipEnable</name></member>
+ </type>
+ <type category="struct" name="VkPhysicalDeviceMemoryBudgetPropertiesEXT" structextends="VkPhysicalDeviceMemoryProperties2" returnedonly="true">
+ <member values="VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_MEMORY_BUDGET_PROPERTIES_EXT"><type>VkStructureType</type> <name>sType</name></member>
+ <member optional="true"><type>void</type>* <name>pNext</name></member>
+ <member><type>VkDeviceSize</type> <name>heapBudget</name>[<enum>VK_MAX_MEMORY_HEAPS</enum>]</member>
+ <member><type>VkDeviceSize</type> <name>heapUsage</name>[<enum>VK_MAX_MEMORY_HEAPS</enum>]</member>
+ </type>
+ <type category="struct" name="VkPhysicalDeviceMemoryPriorityFeaturesEXT" structextends="VkPhysicalDeviceFeatures2,VkDeviceCreateInfo">
+ <member values="VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_MEMORY_PRIORITY_FEATURES_EXT"><type>VkStructureType</type> <name>sType</name></member>
+ <member optional="true"><type>void</type>* <name>pNext</name></member>
+ <member><type>VkBool32</type> <name>memoryPriority</name></member>
+ </type>
+ <type category="struct" name="VkMemoryPriorityAllocateInfoEXT" structextends="VkMemoryAllocateInfo">
+ <member values="VK_STRUCTURE_TYPE_MEMORY_PRIORITY_ALLOCATE_INFO_EXT"><type>VkStructureType</type> <name>sType</name></member>
+ <member optional="true">const <type>void</type>* <name>pNext</name></member>
+ <member><type>float</type> <name>priority</name></member>
+ </type>
+ <type category="struct" name="VkPhysicalDevicePageableDeviceLocalMemoryFeaturesEXT" structextends="VkPhysicalDeviceFeatures2,VkDeviceCreateInfo">
+ <member values="VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_PAGEABLE_DEVICE_LOCAL_MEMORY_FEATURES_EXT"><type>VkStructureType</type> <name>sType</name></member>
+ <member optional="true"><type>void</type>* <name>pNext</name></member>
+ <member><type>VkBool32</type> <name>pageableDeviceLocalMemory</name></member>
+ </type>
+ <type category="struct" name="VkPhysicalDeviceBufferDeviceAddressFeatures" structextends="VkPhysicalDeviceFeatures2,VkDeviceCreateInfo">
+ <member values="VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_BUFFER_DEVICE_ADDRESS_FEATURES"><type>VkStructureType</type> <name>sType</name></member>
+ <member optional="true"><type>void</type>* <name>pNext</name></member>
+ <member><type>VkBool32</type> <name>bufferDeviceAddress</name></member>
+ <member><type>VkBool32</type> <name>bufferDeviceAddressCaptureReplay</name></member>
+ <member><type>VkBool32</type> <name>bufferDeviceAddressMultiDevice</name></member>
+ </type>
+ <type category="struct" name="VkPhysicalDeviceBufferDeviceAddressFeaturesKHR" alias="VkPhysicalDeviceBufferDeviceAddressFeatures"/>
+ <type category="struct" name="VkPhysicalDeviceBufferDeviceAddressFeaturesEXT" structextends="VkPhysicalDeviceFeatures2,VkDeviceCreateInfo">
+ <member values="VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_BUFFER_DEVICE_ADDRESS_FEATURES_EXT"><type>VkStructureType</type> <name>sType</name></member>
+ <member optional="true"><type>void</type>* <name>pNext</name></member>
+ <member><type>VkBool32</type> <name>bufferDeviceAddress</name></member>
+ <member><type>VkBool32</type> <name>bufferDeviceAddressCaptureReplay</name></member>
+ <member><type>VkBool32</type> <name>bufferDeviceAddressMultiDevice</name></member>
+ </type>
+ <type category="struct" name="VkPhysicalDeviceBufferAddressFeaturesEXT" alias="VkPhysicalDeviceBufferDeviceAddressFeaturesEXT"/>
+ <type category="struct" name="VkBufferDeviceAddressInfo">
+ <member values="VK_STRUCTURE_TYPE_BUFFER_DEVICE_ADDRESS_INFO"><type>VkStructureType</type> <name>sType</name></member>
+ <member optional="true">const <type>void</type>* <name>pNext</name></member>
+ <member><type>VkBuffer</type> <name>buffer</name></member>
+ </type>
+ <type category="struct" name="VkBufferDeviceAddressInfoKHR" alias="VkBufferDeviceAddressInfo"/>
+ <type category="struct" name="VkBufferDeviceAddressInfoEXT" alias="VkBufferDeviceAddressInfo"/>
+ <type category="struct" name="VkBufferOpaqueCaptureAddressCreateInfo" structextends="VkBufferCreateInfo">
+ <member values="VK_STRUCTURE_TYPE_BUFFER_OPAQUE_CAPTURE_ADDRESS_CREATE_INFO"><type>VkStructureType</type> <name>sType</name></member>
+ <member optional="true">const <type>void</type>* <name>pNext</name></member>
+ <member><type>uint64_t</type> <name>opaqueCaptureAddress</name></member>
+ </type>
+ <type category="struct" name="VkBufferOpaqueCaptureAddressCreateInfoKHR" alias="VkBufferOpaqueCaptureAddressCreateInfo"/>
+ <type category="struct" name="VkBufferDeviceAddressCreateInfoEXT" structextends="VkBufferCreateInfo">
+ <member values="VK_STRUCTURE_TYPE_BUFFER_DEVICE_ADDRESS_CREATE_INFO_EXT"><type>VkStructureType</type> <name>sType</name></member>
+ <member optional="true">const <type>void</type>* <name>pNext</name></member>
+ <member><type>VkDeviceAddress</type> <name>deviceAddress</name></member>
+ </type>
+ <type category="struct" name="VkPhysicalDeviceImageViewImageFormatInfoEXT" structextends="VkPhysicalDeviceImageFormatInfo2">
+ <member values="VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_IMAGE_VIEW_IMAGE_FORMAT_INFO_EXT"><type>VkStructureType</type> <name>sType</name></member>
+ <member optional="true"><type>void</type>* <name>pNext</name></member>
+ <member><type>VkImageViewType</type> <name>imageViewType</name></member>
+ </type>
+ <type category="struct" name="VkFilterCubicImageViewImageFormatPropertiesEXT" returnedonly="true" structextends="VkImageFormatProperties2">
+ <member values="VK_STRUCTURE_TYPE_FILTER_CUBIC_IMAGE_VIEW_IMAGE_FORMAT_PROPERTIES_EXT"><type>VkStructureType</type> <name>sType</name></member>
+ <member optional="true"><type>void</type>* <name>pNext</name></member>
+ <member><type>VkBool32</type> <name>filterCubic</name><comment>The combinations of format, image type (and image view type if provided) can be filtered with VK_FILTER_CUBIC_EXT</comment></member>
+ <member><type>VkBool32</type> <name>filterCubicMinmax</name><comment>The combination of format, image type (and image view type if provided) can be filtered with VK_FILTER_CUBIC_EXT and ReductionMode of Min or Max</comment></member>
+ </type>
+ <type category="struct" name="VkPhysicalDeviceImagelessFramebufferFeatures" structextends="VkPhysicalDeviceFeatures2,VkDeviceCreateInfo">
+ <member values="VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_IMAGELESS_FRAMEBUFFER_FEATURES"><type>VkStructureType</type> <name>sType</name></member>
+ <member optional="true"><type>void</type>* <name>pNext</name></member>
+ <member><type>VkBool32</type> <name>imagelessFramebuffer</name></member>
+ </type>
+ <type category="struct" name="VkPhysicalDeviceImagelessFramebufferFeaturesKHR" alias="VkPhysicalDeviceImagelessFramebufferFeatures"/>
+ <type category="struct" name="VkFramebufferAttachmentsCreateInfo" structextends="VkFramebufferCreateInfo">
+ <member values="VK_STRUCTURE_TYPE_FRAMEBUFFER_ATTACHMENTS_CREATE_INFO"><type>VkStructureType</type> <name>sType</name></member>
+ <member optional="true">const <type>void</type>* <name>pNext</name></member>
+ <member optional="true"><type>uint32_t</type> <name>attachmentImageInfoCount</name></member>
+ <member len="attachmentImageInfoCount">const <type>VkFramebufferAttachmentImageInfo</type>* <name>pAttachmentImageInfos</name></member>
+ </type>
+ <type category="struct" name="VkFramebufferAttachmentsCreateInfoKHR" alias="VkFramebufferAttachmentsCreateInfo"/>
+ <type category="struct" name="VkFramebufferAttachmentImageInfo">
+ <member values="VK_STRUCTURE_TYPE_FRAMEBUFFER_ATTACHMENT_IMAGE_INFO"><type>VkStructureType</type> <name>sType</name></member>
+ <member optional="true">const <type>void</type>* <name>pNext</name></member>
+ <member optional="true"><type>VkImageCreateFlags</type> <name>flags</name><comment>Image creation flags</comment></member>
+ <member><type>VkImageUsageFlags</type> <name>usage</name><comment>Image usage flags</comment></member>
+ <member><type>uint32_t</type> <name>width</name></member>
+ <member><type>uint32_t</type> <name>height</name></member>
+ <member><type>uint32_t</type> <name>layerCount</name></member>
+ <member optional="true"><type>uint32_t</type> <name>viewFormatCount</name></member>
+ <member len="viewFormatCount">const <type>VkFormat</type>* <name>pViewFormats</name></member>
+ </type>
+ <type category="struct" name="VkFramebufferAttachmentImageInfoKHR" alias="VkFramebufferAttachmentImageInfo"/>
+ <type category="struct" name="VkRenderPassAttachmentBeginInfo" structextends="VkRenderPassBeginInfo">
+ <member values="VK_STRUCTURE_TYPE_RENDER_PASS_ATTACHMENT_BEGIN_INFO"><type>VkStructureType</type> <name>sType</name></member>
+ <member optional="true">const <type>void</type>* <name>pNext</name></member>
+ <member optional="true"><type>uint32_t</type> <name>attachmentCount</name></member>
+ <member len="attachmentCount">const <type>VkImageView</type>* <name>pAttachments</name></member>
+ </type>
+ <type category="struct" name="VkRenderPassAttachmentBeginInfoKHR" alias="VkRenderPassAttachmentBeginInfo"/>
+ <type category="struct" name="VkPhysicalDeviceTextureCompressionASTCHDRFeatures" structextends="VkPhysicalDeviceFeatures2,VkDeviceCreateInfo">
+ <member values="VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_TEXTURE_COMPRESSION_ASTC_HDR_FEATURES"><type>VkStructureType</type> <name>sType</name></member>
+ <member optional="true"><type>void</type>* <name>pNext</name></member>
+ <member><type>VkBool32</type> <name>textureCompressionASTC_HDR</name></member>
+ </type>
+ <type category="struct" name="VkPhysicalDeviceTextureCompressionASTCHDRFeaturesEXT" alias="VkPhysicalDeviceTextureCompressionASTCHDRFeatures"/>
+ <type category="struct" name="VkPhysicalDeviceCooperativeMatrixFeaturesNV" structextends="VkPhysicalDeviceFeatures2,VkDeviceCreateInfo">
+ <member values="VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_COOPERATIVE_MATRIX_FEATURES_NV"><type>VkStructureType</type> <name>sType</name></member>
+ <member optional="true"><type>void</type>* <name>pNext</name></member>
+ <member><type>VkBool32</type> <name>cooperativeMatrix</name></member>
+ <member><type>VkBool32</type> <name>cooperativeMatrixRobustBufferAccess</name></member>
+ </type>
+ <type category="struct" name="VkPhysicalDeviceCooperativeMatrixPropertiesNV" returnedonly="true" structextends="VkPhysicalDeviceProperties2">
+ <member values="VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_COOPERATIVE_MATRIX_PROPERTIES_NV"><type>VkStructureType</type> <name>sType</name></member>
+ <member optional="true"><type>void</type>* <name>pNext</name></member>
+ <member limittype="bitmask"><type>VkShaderStageFlags</type> <name>cooperativeMatrixSupportedStages</name></member>
+ </type>
+ <type category="struct" name="VkCooperativeMatrixPropertiesNV">
+ <member values="VK_STRUCTURE_TYPE_COOPERATIVE_MATRIX_PROPERTIES_NV"><type>VkStructureType</type> <name>sType</name></member>
+ <member optional="true"><type>void</type>* <name>pNext</name></member>
+ <member><type>uint32_t</type> <name>MSize</name></member>
+ <member><type>uint32_t</type> <name>NSize</name></member>
+ <member><type>uint32_t</type> <name>KSize</name></member>
+ <member><type>VkComponentTypeNV</type> <name>AType</name></member>
+ <member><type>VkComponentTypeNV</type> <name>BType</name></member>
+ <member><type>VkComponentTypeNV</type> <name>CType</name></member>
+ <member><type>VkComponentTypeNV</type> <name>DType</name></member>
+ <member><type>VkScopeNV</type> <name>scope</name></member>
+ </type>
+ <type category="struct" name="VkPhysicalDeviceYcbcrImageArraysFeaturesEXT" structextends="VkPhysicalDeviceFeatures2,VkDeviceCreateInfo">
+ <member values="VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_YCBCR_IMAGE_ARRAYS_FEATURES_EXT"><type>VkStructureType</type> <name>sType</name></member>
+ <member optional="true"><type>void</type>* <name>pNext</name></member>
+ <member><type>VkBool32</type> <name>ycbcrImageArrays</name></member>
+ </type>
+ <type category="struct" name="VkImageViewHandleInfoNVX">
+ <member values="VK_STRUCTURE_TYPE_IMAGE_VIEW_HANDLE_INFO_NVX"><type>VkStructureType</type> <name>sType</name></member>
+ <member optional="true">const <type>void</type>* <name>pNext</name></member>
+ <member><type>VkImageView</type> <name>imageView</name></member>
+ <member><type>VkDescriptorType</type> <name>descriptorType</name></member>
+ <member optional="true"><type>VkSampler</type> <name>sampler</name></member>
+ </type>
+ <type category="struct" name="VkImageViewAddressPropertiesNVX" returnedonly="true">
+ <member values="VK_STRUCTURE_TYPE_IMAGE_VIEW_ADDRESS_PROPERTIES_NVX"><type>VkStructureType</type> <name>sType</name></member>
+ <member optional="true"><type>void</type>* <name>pNext</name></member>
+ <member><type>VkDeviceAddress</type> <name>deviceAddress</name></member>
+ <member><type>VkDeviceSize</type> <name>size</name></member>
+ </type>
+ <type category="struct" name="VkPresentFrameTokenGGP" structextends="VkPresentInfoKHR">
+ <member values="VK_STRUCTURE_TYPE_PRESENT_FRAME_TOKEN_GGP"><type>VkStructureType</type> <name>sType</name></member>
+ <member optional="true">const <type>void</type>* <name>pNext</name></member>
+ <member><type>GgpFrameToken</type> <name>frameToken</name></member>
+ </type>
+ <type category="struct" name="VkPipelineCreationFeedback" returnedonly="true">
+ <member><type>VkPipelineCreationFeedbackFlags</type> <name>flags</name></member>
+ <member><type>uint64_t</type> <name>duration</name></member>
+ </type>
+ <type category="struct" name="VkPipelineCreationFeedbackEXT" alias="VkPipelineCreationFeedback"/>
+ <type category="struct" name="VkPipelineCreationFeedbackCreateInfo" structextends="VkGraphicsPipelineCreateInfo,VkComputePipelineCreateInfo,VkRayTracingPipelineCreateInfoNV,VkRayTracingPipelineCreateInfoKHR">
+ <member values="VK_STRUCTURE_TYPE_PIPELINE_CREATION_FEEDBACK_CREATE_INFO"><type>VkStructureType</type> <name>sType</name></member>
+ <member optional="true">const <type>void</type>* <name>pNext</name></member>
+ <member><type>VkPipelineCreationFeedback</type>* <name>pPipelineCreationFeedback</name><comment>Output pipeline creation feedback.</comment></member>
+ <member optional="true"><type>uint32_t</type> <name>pipelineStageCreationFeedbackCount</name></member>
+ <member len="pipelineStageCreationFeedbackCount"><type>VkPipelineCreationFeedback</type>* <name>pPipelineStageCreationFeedbacks</name><comment>One entry for each shader stage specified in the parent Vk*PipelineCreateInfo struct</comment></member>
+ </type>
+ <type category="struct" name="VkPipelineCreationFeedbackCreateInfoEXT" alias="VkPipelineCreationFeedbackCreateInfo"/>
+ <type category="struct" name="VkSurfaceFullScreenExclusiveInfoEXT" structextends="VkPhysicalDeviceSurfaceInfo2KHR,VkSwapchainCreateInfoKHR">
+ <member values="VK_STRUCTURE_TYPE_SURFACE_FULL_SCREEN_EXCLUSIVE_INFO_EXT"><type>VkStructureType</type> <name>sType</name></member>
+ <member optional="true"><type>void</type>* <name>pNext</name></member>
+ <member><type>VkFullScreenExclusiveEXT</type> <name>fullScreenExclusive</name></member>
+ </type>
+ <type category="struct" name="VkSurfaceFullScreenExclusiveWin32InfoEXT" structextends="VkPhysicalDeviceSurfaceInfo2KHR,VkSwapchainCreateInfoKHR">
+ <member values="VK_STRUCTURE_TYPE_SURFACE_FULL_SCREEN_EXCLUSIVE_WIN32_INFO_EXT"><type>VkStructureType</type> <name>sType</name></member>
+ <member optional="true">const <type>void</type>* <name>pNext</name></member>
+ <member><type>HMONITOR</type> <name>hmonitor</name></member>
+ </type>
+ <type category="struct" name="VkSurfaceCapabilitiesFullScreenExclusiveEXT" structextends="VkSurfaceCapabilities2KHR">
+ <member values="VK_STRUCTURE_TYPE_SURFACE_CAPABILITIES_FULL_SCREEN_EXCLUSIVE_EXT"><type>VkStructureType</type> <name>sType</name></member>
+ <member optional="true"><type>void</type>* <name>pNext</name></member>
+ <member><type>VkBool32</type> <name>fullScreenExclusiveSupported</name></member>
+ </type>
+ <type category="struct" name="VkPhysicalDevicePerformanceQueryFeaturesKHR" structextends="VkPhysicalDeviceFeatures2,VkDeviceCreateInfo">
+ <member values="VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_PERFORMANCE_QUERY_FEATURES_KHR"><type>VkStructureType</type> <name>sType</name></member>
+ <member optional="true"><type>void</type>* <name>pNext</name></member>
+ <member><type>VkBool32</type> <name>performanceCounterQueryPools</name><comment>performance counters supported in query pools</comment></member>
+ <member><type>VkBool32</type> <name>performanceCounterMultipleQueryPools</name><comment>performance counters from multiple query pools can be accessed in the same primary command buffer</comment></member>
+ </type>
+ <type category="struct" name="VkPhysicalDevicePerformanceQueryPropertiesKHR" returnedonly="true" structextends="VkPhysicalDeviceProperties2">
+ <member values="VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_PERFORMANCE_QUERY_PROPERTIES_KHR"><type>VkStructureType</type> <name>sType</name></member>
+ <member optional="true"><type>void</type>* <name>pNext</name></member>
+ <member limittype="bitmask" noautovalidity="true"><type>VkBool32</type> <name>allowCommandBufferQueryCopies</name><comment>Flag to specify whether performance queries are allowed to be used in vkCmdCopyQueryPoolResults</comment></member>
+ </type>
+ <type category="struct" name="VkPerformanceCounterKHR" returnedonly="true">
+ <member values="VK_STRUCTURE_TYPE_PERFORMANCE_COUNTER_KHR"><type>VkStructureType</type> <name>sType</name></member>
+ <member optional="true"><type>void</type>* <name>pNext</name></member>
+ <member><type>VkPerformanceCounterUnitKHR</type> <name>unit</name></member>
+ <member><type>VkPerformanceCounterScopeKHR</type> <name>scope</name></member>
+ <member><type>VkPerformanceCounterStorageKHR</type> <name>storage</name></member>
+ <member><type>uint8_t</type> <name>uuid</name>[<enum>VK_UUID_SIZE</enum>]</member>
+ </type>
+ <type category="struct" name="VkPerformanceCounterDescriptionKHR" returnedonly="true">
+ <member values="VK_STRUCTURE_TYPE_PERFORMANCE_COUNTER_DESCRIPTION_KHR"><type>VkStructureType</type> <name>sType</name></member>
+ <member optional="true"><type>void</type>* <name>pNext</name></member>
+ <member optional="true"><type>VkPerformanceCounterDescriptionFlagsKHR</type> <name>flags</name></member>
+ <member><type>char</type> <name>name</name>[<enum>VK_MAX_DESCRIPTION_SIZE</enum>]</member>
+ <member><type>char</type> <name>category</name>[<enum>VK_MAX_DESCRIPTION_SIZE</enum>]</member>
+ <member><type>char</type> <name>description</name>[<enum>VK_MAX_DESCRIPTION_SIZE</enum>]</member>
+ </type>
+ <type category="struct" name="VkQueryPoolPerformanceCreateInfoKHR" structextends="VkQueryPoolCreateInfo">
+ <member values="VK_STRUCTURE_TYPE_QUERY_POOL_PERFORMANCE_CREATE_INFO_KHR"><type>VkStructureType</type> <name>sType</name></member>
+ <member optional="true">const <type>void</type>* <name>pNext</name></member>
+ <member><type>uint32_t</type> <name>queueFamilyIndex</name></member>
+ <member><type>uint32_t</type> <name>counterIndexCount</name></member>
+ <member len="counterIndexCount">const <type>uint32_t</type>* <name>pCounterIndices</name></member>
+ </type>
+ <type category="union" name="VkPerformanceCounterResultKHR" comment="// Union of all the possible return types a counter result could return">
+ <member><type>int32_t</type> <name>int32</name></member>
+ <member><type>int64_t</type> <name>int64</name></member>
+ <member><type>uint32_t</type> <name>uint32</name></member>
+ <member><type>uint64_t</type> <name>uint64</name></member>
+ <member><type>float</type> <name>float32</name></member>
+ <member><type>double</type> <name>float64</name></member>
+ </type>
+ <type category="struct" name="VkAcquireProfilingLockInfoKHR">
+ <member values="VK_STRUCTURE_TYPE_ACQUIRE_PROFILING_LOCK_INFO_KHR"><type>VkStructureType</type> <name>sType</name></member>
+ <member optional="true">const <type>void</type>* <name>pNext</name></member>
+ <member optional="true"><type>VkAcquireProfilingLockFlagsKHR</type> <name>flags</name><comment>Acquire profiling lock flags</comment></member>
+ <member><type>uint64_t</type> <name>timeout</name></member>
+ </type>
+ <type category="struct" name="VkPerformanceQuerySubmitInfoKHR" structextends="VkSubmitInfo,VkSubmitInfo2">
+ <member values="VK_STRUCTURE_TYPE_PERFORMANCE_QUERY_SUBMIT_INFO_KHR"><type>VkStructureType</type> <name>sType</name></member>
+ <member optional="true">const <type>void</type>* <name>pNext</name></member>
+ <member><type>uint32_t</type> <name>counterPassIndex</name><comment>Index for which counter pass to submit</comment></member>
+ </type>
+ <type category="struct" name="VkHeadlessSurfaceCreateInfoEXT">
+ <member values="VK_STRUCTURE_TYPE_HEADLESS_SURFACE_CREATE_INFO_EXT"><type>VkStructureType</type> <name>sType</name></member>
+ <member optional="true">const <type>void</type>* <name>pNext</name></member>
+ <member optional="true"><type>VkHeadlessSurfaceCreateFlagsEXT</type> <name>flags</name></member>
+ </type>
+ <type category="struct" name="VkPhysicalDeviceCoverageReductionModeFeaturesNV" structextends="VkPhysicalDeviceFeatures2,VkDeviceCreateInfo">
+ <member values="VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_COVERAGE_REDUCTION_MODE_FEATURES_NV"><type>VkStructureType</type> <name>sType</name></member>
+ <member optional="true"><type>void</type>* <name>pNext</name></member>
+ <member><type>VkBool32</type> <name>coverageReductionMode</name></member>
+ </type>
+ <type category="struct" name="VkPipelineCoverageReductionStateCreateInfoNV" structextends="VkPipelineMultisampleStateCreateInfo">
+ <member values="VK_STRUCTURE_TYPE_PIPELINE_COVERAGE_REDUCTION_STATE_CREATE_INFO_NV"><type>VkStructureType</type> <name>sType</name></member>
+ <member optional="true">const <type>void</type>* <name>pNext</name></member>
+ <member optional="true"><type>VkPipelineCoverageReductionStateCreateFlagsNV</type> <name>flags</name></member>
+ <member><type>VkCoverageReductionModeNV</type> <name>coverageReductionMode</name></member>
+ </type>
+ <type category="struct" name="VkFramebufferMixedSamplesCombinationNV" returnedonly="true">
+ <member values="VK_STRUCTURE_TYPE_FRAMEBUFFER_MIXED_SAMPLES_COMBINATION_NV"><type>VkStructureType</type> <name>sType</name></member>
+ <member optional="true"><type>void</type>* <name>pNext</name></member>
+ <member><type>VkCoverageReductionModeNV</type> <name>coverageReductionMode</name></member>
+ <member><type>VkSampleCountFlagBits</type> <name>rasterizationSamples</name></member>
+ <member><type>VkSampleCountFlags</type> <name>depthStencilSamples</name></member>
+ <member><type>VkSampleCountFlags</type> <name>colorSamples</name></member>
+ </type>
+ <type category="struct" name="VkPhysicalDeviceShaderIntegerFunctions2FeaturesINTEL" structextends="VkPhysicalDeviceFeatures2,VkDeviceCreateInfo">
+ <member values="VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_SHADER_INTEGER_FUNCTIONS_2_FEATURES_INTEL"><type>VkStructureType</type> <name>sType</name></member>
+ <member optional="true"><type>void</type>* <name>pNext</name></member>
+ <member><type>VkBool32</type> <name>shaderIntegerFunctions2</name></member>
+ </type>
+ <type category="union" name="VkPerformanceValueDataINTEL">
+ <member selection="VK_PERFORMANCE_VALUE_TYPE_UINT32_INTEL"><type>uint32_t</type> <name>value32</name></member>
+ <member selection="VK_PERFORMANCE_VALUE_TYPE_UINT64_INTEL"><type>uint64_t</type> <name>value64</name></member>
+ <member selection="VK_PERFORMANCE_VALUE_TYPE_FLOAT_INTEL"><type>float</type> <name>valueFloat</name></member>
+ <member selection="VK_PERFORMANCE_VALUE_TYPE_BOOL_INTEL"><type>VkBool32</type> <name>valueBool</name></member>
+ <member selection="VK_PERFORMANCE_VALUE_TYPE_STRING_INTEL" len="null-terminated">const <type>char</type>* <name>valueString</name></member>
+ </type>
+ <type category="struct" name="VkPerformanceValueINTEL">
+ <member><type>VkPerformanceValueTypeINTEL</type> <name>type</name></member>
+ <member selector="type" noautovalidity="true"><type>VkPerformanceValueDataINTEL</type> <name>data</name></member>
+ </type>
+ <type category="struct" name="VkInitializePerformanceApiInfoINTEL" >
+ <member values="VK_STRUCTURE_TYPE_INITIALIZE_PERFORMANCE_API_INFO_INTEL"><type>VkStructureType</type> <name>sType</name></member>
+ <member optional="true">const <type>void</type>* <name>pNext</name></member>
+ <member optional="true"><type>void</type>* <name>pUserData</name></member>
+ </type>
+ <type category="struct" name="VkQueryPoolPerformanceQueryCreateInfoINTEL" structextends="VkQueryPoolCreateInfo">
+ <member values="VK_STRUCTURE_TYPE_QUERY_POOL_PERFORMANCE_QUERY_CREATE_INFO_INTEL"><type>VkStructureType</type> <name>sType</name></member>
+ <member optional="true">const <type>void</type>* <name>pNext</name></member>
+ <member><type>VkQueryPoolSamplingModeINTEL</type> <name>performanceCountersSampling</name></member>
+ </type>
+ <type category="struct" name="VkQueryPoolCreateInfoINTEL" alias="VkQueryPoolPerformanceQueryCreateInfoINTEL"/>
+ <type category="struct" name="VkPerformanceMarkerInfoINTEL">
+ <member values="VK_STRUCTURE_TYPE_PERFORMANCE_MARKER_INFO_INTEL"><type>VkStructureType</type> <name>sType</name></member>
+ <member optional="true">const <type>void</type>* <name>pNext</name></member>
+ <member><type>uint64_t</type> <name>marker</name></member>
+ </type>
+ <type category="struct" name="VkPerformanceStreamMarkerInfoINTEL">
+ <member values="VK_STRUCTURE_TYPE_PERFORMANCE_STREAM_MARKER_INFO_INTEL"><type>VkStructureType</type> <name>sType</name></member>
+ <member optional="true">const <type>void</type>* <name>pNext</name></member>
+ <member><type>uint32_t</type> <name>marker</name></member>
+ </type>
+ <type category="struct" name="VkPerformanceOverrideInfoINTEL">
+ <member values="VK_STRUCTURE_TYPE_PERFORMANCE_OVERRIDE_INFO_INTEL"><type>VkStructureType</type> <name>sType</name></member>
+ <member optional="true">const <type>void</type>* <name>pNext</name></member>
+ <member><type>VkPerformanceOverrideTypeINTEL</type> <name>type</name></member>
+ <member><type>VkBool32</type> <name>enable</name></member>
+ <member><type>uint64_t</type> <name>parameter</name></member>
+ </type>
+ <type category="struct" name="VkPerformanceConfigurationAcquireInfoINTEL">
+ <member values="VK_STRUCTURE_TYPE_PERFORMANCE_CONFIGURATION_ACQUIRE_INFO_INTEL"><type>VkStructureType</type> <name>sType</name></member>
+ <member optional="true">const <type>void</type>* <name>pNext</name></member>
+ <member><type>VkPerformanceConfigurationTypeINTEL</type> <name>type</name></member>
+ </type>
+ <type category="struct" name="VkPhysicalDeviceShaderClockFeaturesKHR" structextends="VkPhysicalDeviceFeatures2,VkDeviceCreateInfo">
+ <member values="VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_SHADER_CLOCK_FEATURES_KHR"><type>VkStructureType</type> <name>sType</name></member>
+ <member optional="true"><type>void</type>* <name>pNext</name></member>
+ <member><type>VkBool32</type> <name>shaderSubgroupClock</name></member>
+ <member><type>VkBool32</type> <name>shaderDeviceClock</name></member>
+ </type>
+ <type category="struct" name="VkPhysicalDeviceIndexTypeUint8FeaturesEXT" structextends="VkPhysicalDeviceFeatures2,VkDeviceCreateInfo">
+ <member values="VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_INDEX_TYPE_UINT8_FEATURES_EXT"><type>VkStructureType</type> <name>sType</name></member>
+ <member optional="true"><type>void</type>* <name>pNext</name></member>
+ <member><type>VkBool32</type> <name>indexTypeUint8</name></member>
+ </type>
+ <type category="struct" name="VkPhysicalDeviceShaderSMBuiltinsPropertiesNV" returnedonly="true" structextends="VkPhysicalDeviceProperties2">
+ <member values="VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_SHADER_SM_BUILTINS_PROPERTIES_NV"><type>VkStructureType</type> <name>sType</name></member>
+ <member optional="true"><type>void</type>* <name>pNext</name></member>
+ <member limittype="max"><type>uint32_t</type> <name>shaderSMCount</name></member>
+ <member limittype="max"><type>uint32_t</type> <name>shaderWarpsPerSM</name></member>
+ </type>
+ <type category="struct" name="VkPhysicalDeviceShaderSMBuiltinsFeaturesNV" structextends="VkPhysicalDeviceFeatures2,VkDeviceCreateInfo">
+ <member values="VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_SHADER_SM_BUILTINS_FEATURES_NV"><type>VkStructureType</type> <name>sType</name></member>
+ <member optional="true"><type>void</type>* <name>pNext</name></member>
+ <member><type>VkBool32</type> <name>shaderSMBuiltins</name></member>
+ </type>
+ <type category="struct" name="VkPhysicalDeviceFragmentShaderInterlockFeaturesEXT" structextends="VkPhysicalDeviceFeatures2,VkDeviceCreateInfo">
+ <member values="VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_FRAGMENT_SHADER_INTERLOCK_FEATURES_EXT"><type>VkStructureType</type> <name>sType</name></member>
+ <member optional="true"><type>void</type>* <name>pNext</name><comment>Pointer to next structure</comment></member>
+ <member><type>VkBool32</type> <name>fragmentShaderSampleInterlock</name></member>
+ <member><type>VkBool32</type> <name>fragmentShaderPixelInterlock</name></member>
+ <member><type>VkBool32</type> <name>fragmentShaderShadingRateInterlock</name></member>
+ </type>
+ <type category="struct" name="VkPhysicalDeviceSeparateDepthStencilLayoutsFeatures" structextends="VkPhysicalDeviceFeatures2,VkDeviceCreateInfo">
+ <member values="VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_SEPARATE_DEPTH_STENCIL_LAYOUTS_FEATURES"><type>VkStructureType</type> <name>sType</name></member>
+ <member optional="true"><type>void</type>* <name>pNext</name></member>
+ <member><type>VkBool32</type> <name>separateDepthStencilLayouts</name></member>
+ </type>
+ <type category="struct" name="VkPhysicalDeviceSeparateDepthStencilLayoutsFeaturesKHR" alias="VkPhysicalDeviceSeparateDepthStencilLayoutsFeatures"/>
+ <type category="struct" name="VkAttachmentReferenceStencilLayout" structextends="VkAttachmentReference2">
+ <member values="VK_STRUCTURE_TYPE_ATTACHMENT_REFERENCE_STENCIL_LAYOUT"><type>VkStructureType</type> <name>sType</name></member>
+ <member optional="true"><type>void</type>* <name>pNext</name></member>
+ <member><type>VkImageLayout</type> <name>stencilLayout</name></member>
+ </type>
+ <type category="struct" name="VkPhysicalDevicePrimitiveTopologyListRestartFeaturesEXT" structextends="VkPhysicalDeviceFeatures2,VkDeviceCreateInfo">
+ <member values="VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_PRIMITIVE_TOPOLOGY_LIST_RESTART_FEATURES_EXT"><type>VkStructureType</type> <name>sType</name></member>
+ <member optional="true"><type>void</type>* <name>pNext</name></member>
+ <member><type>VkBool32</type> <name>primitiveTopologyListRestart</name></member>
+ <member><type>VkBool32</type> <name>primitiveTopologyPatchListRestart</name></member>
+ </type>
+ <type category="struct" name="VkAttachmentReferenceStencilLayoutKHR" alias="VkAttachmentReferenceStencilLayout"/>
+ <type category="struct" name="VkAttachmentDescriptionStencilLayout" structextends="VkAttachmentDescription2">
+ <member values="VK_STRUCTURE_TYPE_ATTACHMENT_DESCRIPTION_STENCIL_LAYOUT"><type>VkStructureType</type> <name>sType</name></member>
+ <member optional="true"><type>void</type>* <name>pNext</name></member>
+ <member><type>VkImageLayout</type> <name>stencilInitialLayout</name></member>
+ <member><type>VkImageLayout</type> <name>stencilFinalLayout</name></member>
+ </type>
+ <type category="struct" name="VkAttachmentDescriptionStencilLayoutKHR" alias="VkAttachmentDescriptionStencilLayout"/>
+ <type category="struct" name="VkPhysicalDevicePipelineExecutablePropertiesFeaturesKHR" structextends="VkPhysicalDeviceFeatures2,VkDeviceCreateInfo">
+ <member values="VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_PIPELINE_EXECUTABLE_PROPERTIES_FEATURES_KHR"><type>VkStructureType</type> <name>sType</name></member>
+ <member optional="true"><type>void</type>* <name>pNext</name></member>
+ <member><type>VkBool32</type> <name>pipelineExecutableInfo</name></member>
+ </type>
+ <type category="struct" name="VkPipelineInfoKHR">
+ <member values="VK_STRUCTURE_TYPE_PIPELINE_INFO_KHR"><type>VkStructureType</type> <name>sType</name></member>
+ <member optional="true">const <type>void</type>* <name>pNext</name></member>
+ <member><type>VkPipeline</type> <name>pipeline</name></member>
+ </type>
+ <type category="struct" name="VkPipelineInfoEXT" alias="VkPipelineInfoKHR"/>
+ <type category="struct" name="VkPipelineExecutablePropertiesKHR" returnedonly="true">
+ <member values="VK_STRUCTURE_TYPE_PIPELINE_EXECUTABLE_PROPERTIES_KHR"><type>VkStructureType</type> <name>sType</name></member>
+ <member optional="true"><type>void</type>* <name>pNext</name></member>
+ <member><type>VkShaderStageFlags</type> <name>stages</name></member>
+ <member><type>char</type> <name>name</name>[<enum>VK_MAX_DESCRIPTION_SIZE</enum>]</member>
+ <member><type>char</type> <name>description</name>[<enum>VK_MAX_DESCRIPTION_SIZE</enum>]</member>
+ <member><type>uint32_t</type> <name>subgroupSize</name></member>
+ </type>
+ <type category="struct" name="VkPipelineExecutableInfoKHR">
+ <member values="VK_STRUCTURE_TYPE_PIPELINE_EXECUTABLE_INFO_KHR"><type>VkStructureType</type> <name>sType</name></member>
+ <member optional="true">const <type>void</type>* <name>pNext</name></member>
+ <member><type>VkPipeline</type> <name>pipeline</name></member>
+ <member><type>uint32_t</type> <name>executableIndex</name></member>
+ </type>
+ <type category="union" name="VkPipelineExecutableStatisticValueKHR" returnedonly="true">
+ <member selection="VK_PIPELINE_EXECUTABLE_STATISTIC_FORMAT_BOOL32_KHR"><type>VkBool32</type> <name>b32</name></member>
+ <member selection="VK_PIPELINE_EXECUTABLE_STATISTIC_FORMAT_INT64_KHR"><type>int64_t</type> <name>i64</name></member>
+ <member selection="VK_PIPELINE_EXECUTABLE_STATISTIC_FORMAT_UINT64_KHR"><type>uint64_t</type> <name>u64</name></member>
+ <member selection="VK_PIPELINE_EXECUTABLE_STATISTIC_FORMAT_FLOAT64_KHR"><type>double</type> <name>f64</name></member>
+ </type>
+ <type category="struct" name="VkPipelineExecutableStatisticKHR" returnedonly="true">
+ <member values="VK_STRUCTURE_TYPE_PIPELINE_EXECUTABLE_STATISTIC_KHR"><type>VkStructureType</type> <name>sType</name></member>
+ <member optional="true"><type>void</type>* <name>pNext</name></member>
+ <member><type>char</type> <name>name</name>[<enum>VK_MAX_DESCRIPTION_SIZE</enum>]</member>
+ <member><type>char</type> <name>description</name>[<enum>VK_MAX_DESCRIPTION_SIZE</enum>]</member>
+ <member><type>VkPipelineExecutableStatisticFormatKHR</type> <name>format</name></member>
+ <member selector="format" noautovalidity="true"><type>VkPipelineExecutableStatisticValueKHR</type> <name>value</name></member>
+ </type>
+ <type category="struct" name="VkPipelineExecutableInternalRepresentationKHR" returnedonly="true">
+ <member values="VK_STRUCTURE_TYPE_PIPELINE_EXECUTABLE_INTERNAL_REPRESENTATION_KHR"><type>VkStructureType</type> <name>sType</name></member>
+ <member optional="true"><type>void</type>* <name>pNext</name></member>
+ <member><type>char</type> <name>name</name>[<enum>VK_MAX_DESCRIPTION_SIZE</enum>]</member>
+ <member><type>char</type> <name>description</name>[<enum>VK_MAX_DESCRIPTION_SIZE</enum>]</member>
+ <member><type>VkBool32</type> <name>isText</name></member>
+ <member><type>size_t</type> <name>dataSize</name></member>
+ <member optional="true" len="dataSize"><type>void</type>* <name>pData</name></member>
+ </type>
+ <type category="struct" name="VkPhysicalDeviceShaderDemoteToHelperInvocationFeatures" structextends="VkPhysicalDeviceFeatures2,VkDeviceCreateInfo">
+ <member values="VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_SHADER_DEMOTE_TO_HELPER_INVOCATION_FEATURES"><type>VkStructureType</type> <name>sType</name></member>
+ <member optional="true"><type>void</type>* <name>pNext</name></member>
+ <member><type>VkBool32</type> <name>shaderDemoteToHelperInvocation</name></member>
+ </type>
+ <type category="struct" name="VkPhysicalDeviceShaderDemoteToHelperInvocationFeaturesEXT" alias="VkPhysicalDeviceShaderDemoteToHelperInvocationFeatures"/>
+ <type category="struct" name="VkPhysicalDeviceTexelBufferAlignmentFeaturesEXT" structextends="VkPhysicalDeviceFeatures2,VkDeviceCreateInfo">
+ <member values="VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_TEXEL_BUFFER_ALIGNMENT_FEATURES_EXT"><type>VkStructureType</type> <name>sType</name></member>
+ <member optional="true"><type>void</type>* <name>pNext</name></member>
+ <member><type>VkBool32</type> <name>texelBufferAlignment</name></member>
+ </type>
+ <type category="struct" name="VkPhysicalDeviceTexelBufferAlignmentProperties" structextends="VkPhysicalDeviceProperties2" returnedonly="true">
+ <member values="VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_TEXEL_BUFFER_ALIGNMENT_PROPERTIES"><type>VkStructureType</type> <name>sType</name></member>
+ <member optional="true"><type>void</type>* <name>pNext</name></member>
+ <member limittype="min,pot"><type>VkDeviceSize</type> <name>storageTexelBufferOffsetAlignmentBytes</name></member>
+ <member limittype="exact"><type>VkBool32</type> <name>storageTexelBufferOffsetSingleTexelAlignment</name></member>
+ <member limittype="min,pot"><type>VkDeviceSize</type> <name>uniformTexelBufferOffsetAlignmentBytes</name></member>
+ <member limittype="exact"><type>VkBool32</type> <name>uniformTexelBufferOffsetSingleTexelAlignment</name></member>
+ </type>
+ <type category="struct" name="VkPhysicalDeviceTexelBufferAlignmentPropertiesEXT" alias="VkPhysicalDeviceTexelBufferAlignmentProperties"/>
+ <type category="struct" name="VkPhysicalDeviceSubgroupSizeControlFeatures" structextends="VkPhysicalDeviceFeatures2,VkDeviceCreateInfo">
+ <member values="VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_SUBGROUP_SIZE_CONTROL_FEATURES"><type>VkStructureType</type> <name>sType</name></member>
+ <member optional="true"><type>void</type>* <name>pNext</name></member>
+ <member><type>VkBool32</type> <name>subgroupSizeControl</name></member>
+ <member><type>VkBool32</type> <name>computeFullSubgroups</name></member>
+ </type>
+ <type category="struct" name="VkPhysicalDeviceSubgroupSizeControlFeaturesEXT" alias="VkPhysicalDeviceSubgroupSizeControlFeatures"/>
+ <type category="struct" name="VkPhysicalDeviceSubgroupSizeControlProperties" returnedonly="true" structextends="VkPhysicalDeviceProperties2">
+ <member values="VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_SUBGROUP_SIZE_CONTROL_PROPERTIES"><type>VkStructureType</type> <name>sType</name></member>
+ <member optional="true"><type>void</type>* <name>pNext</name></member>
+ <member limittype="min,pot" noautovalidity="true"><type>uint32_t</type> <name>minSubgroupSize</name><comment>The minimum subgroup size supported by this device</comment></member>
+ <member limittype="max,pot" noautovalidity="true"><type>uint32_t</type> <name>maxSubgroupSize</name><comment>The maximum subgroup size supported by this device</comment></member>
+ <member limittype="max" noautovalidity="true"><type>uint32_t</type> <name>maxComputeWorkgroupSubgroups</name><comment>The maximum number of subgroups supported in a workgroup</comment></member>
+ <member limittype="bitmask"><type>VkShaderStageFlags</type> <name>requiredSubgroupSizeStages</name><comment>The shader stages that support specifying a subgroup size</comment></member>
+ </type>
+ <type category="struct" name="VkPhysicalDeviceSubgroupSizeControlPropertiesEXT" alias="VkPhysicalDeviceSubgroupSizeControlProperties"/>
+ <type category="struct" name="VkPipelineShaderStageRequiredSubgroupSizeCreateInfo" returnedonly="true" structextends="VkPipelineShaderStageCreateInfo">
+ <member values="VK_STRUCTURE_TYPE_PIPELINE_SHADER_STAGE_REQUIRED_SUBGROUP_SIZE_CREATE_INFO"><type>VkStructureType</type> <name>sType</name></member>
+ <member optional="true"><type>void</type>* <name>pNext</name></member>
+ <member><type>uint32_t</type> <name>requiredSubgroupSize</name></member>
+ </type>
+ <type category="struct" name="VkPipelineShaderStageRequiredSubgroupSizeCreateInfoEXT" alias="VkPipelineShaderStageRequiredSubgroupSizeCreateInfo"/>
+ <type category="struct" name="VkSubpassShadingPipelineCreateInfoHUAWEI" returnedonly="true" structextends="VkComputePipelineCreateInfo">
+ <member values="VK_STRUCTURE_TYPE_SUBPASS_SHADING_PIPELINE_CREATE_INFO_HUAWEI"><type>VkStructureType</type> <name>sType</name></member>
+ <member optional="true"><type>void</type>* <name>pNext</name></member>
+ <member><type>VkRenderPass</type> <name>renderPass</name></member>
+ <member><type>uint32_t</type> <name>subpass</name></member>
+ </type>
+ <type category="struct" name="VkPhysicalDeviceSubpassShadingPropertiesHUAWEI" structextends="VkPhysicalDeviceProperties2" returnedonly="true">
+ <member values="VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_SUBPASS_SHADING_PROPERTIES_HUAWEI"><type>VkStructureType</type> <name>sType</name></member>
+ <member optional="true"><type>void</type>* <name>pNext</name></member>
+ <member limittype="max,pot"><type>uint32_t</type> <name>maxSubpassShadingWorkgroupSizeAspectRatio</name></member>
+ </type>
+ <type category="struct" name="VkMemoryOpaqueCaptureAddressAllocateInfo" structextends="VkMemoryAllocateInfo">
+ <member values="VK_STRUCTURE_TYPE_MEMORY_OPAQUE_CAPTURE_ADDRESS_ALLOCATE_INFO"><type>VkStructureType</type> <name>sType</name></member>
+ <member optional="true">const <type>void</type>* <name>pNext</name></member>
+ <member><type>uint64_t</type> <name>opaqueCaptureAddress</name></member>
+ </type>
+ <type category="struct" name="VkMemoryOpaqueCaptureAddressAllocateInfoKHR" alias="VkMemoryOpaqueCaptureAddressAllocateInfo"/>
+ <type category="struct" name="VkDeviceMemoryOpaqueCaptureAddressInfo">
+ <member values="VK_STRUCTURE_TYPE_DEVICE_MEMORY_OPAQUE_CAPTURE_ADDRESS_INFO"><type>VkStructureType</type> <name>sType</name></member>
+ <member optional="true">const <type>void</type>* <name>pNext</name></member>
+ <member><type>VkDeviceMemory</type> <name>memory</name></member>
+ </type>
+ <type category="struct" name="VkDeviceMemoryOpaqueCaptureAddressInfoKHR" alias="VkDeviceMemoryOpaqueCaptureAddressInfo"/>
+ <type category="struct" name="VkPhysicalDeviceLineRasterizationFeaturesEXT" structextends="VkPhysicalDeviceFeatures2,VkDeviceCreateInfo">
+ <member values="VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_LINE_RASTERIZATION_FEATURES_EXT"><type>VkStructureType</type> <name>sType</name></member>
+ <member optional="true"><type>void</type>* <name>pNext</name></member>
+ <member><type>VkBool32</type> <name>rectangularLines</name></member>
+ <member><type>VkBool32</type> <name>bresenhamLines</name></member>
+ <member><type>VkBool32</type> <name>smoothLines</name></member>
+ <member><type>VkBool32</type> <name>stippledRectangularLines</name></member>
+ <member><type>VkBool32</type> <name>stippledBresenhamLines</name></member>
+ <member><type>VkBool32</type> <name>stippledSmoothLines</name></member>
+ </type>
+ <type category="struct" name="VkPhysicalDeviceLineRasterizationPropertiesEXT" returnedonly="true" structextends="VkPhysicalDeviceProperties2">
+ <member values="VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_LINE_RASTERIZATION_PROPERTIES_EXT"><type>VkStructureType</type> <name>sType</name></member>
+ <member optional="true"><type>void</type>* <name>pNext</name></member>
+ <member limittype="bits"><type>uint32_t</type> <name>lineSubPixelPrecisionBits</name></member>
+ </type>
+ <type category="struct" name="VkPipelineRasterizationLineStateCreateInfoEXT" structextends="VkPipelineRasterizationStateCreateInfo">
+ <member values="VK_STRUCTURE_TYPE_PIPELINE_RASTERIZATION_LINE_STATE_CREATE_INFO_EXT"><type>VkStructureType</type> <name>sType</name></member>
+ <member optional="true">const <type>void</type>* <name>pNext</name></member>
+ <member><type>VkLineRasterizationModeEXT</type> <name>lineRasterizationMode</name></member>
+ <member><type>VkBool32</type> <name>stippledLineEnable</name></member>
+ <member><type>uint32_t</type> <name>lineStippleFactor</name></member>
+ <member><type>uint16_t</type> <name>lineStipplePattern</name></member>
+ </type>
+ <type category="struct" name="VkPhysicalDevicePipelineCreationCacheControlFeatures" structextends="VkPhysicalDeviceFeatures2,VkDeviceCreateInfo">
+ <member values="VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_PIPELINE_CREATION_CACHE_CONTROL_FEATURES"><type>VkStructureType</type> <name>sType</name></member>
+ <member optional="true"><type>void</type>* <name>pNext</name></member>
+ <member><type>VkBool32</type> <name>pipelineCreationCacheControl</name></member>
+ </type>
+ <type category="struct" name="VkPhysicalDevicePipelineCreationCacheControlFeaturesEXT" alias="VkPhysicalDevicePipelineCreationCacheControlFeatures"/>
+ <type category="struct" name="VkPhysicalDeviceVulkan11Features" structextends="VkPhysicalDeviceFeatures2,VkDeviceCreateInfo">
+ <member values="VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_VULKAN_1_1_FEATURES"><type>VkStructureType</type> <name>sType</name></member>
+ <member optional="true"><type>void</type>* <name>pNext</name></member>
+ <member><type>VkBool32</type> <name>storageBuffer16BitAccess</name><comment>16-bit integer/floating-point variables supported in BufferBlock</comment></member>
+ <member><type>VkBool32</type> <name>uniformAndStorageBuffer16BitAccess</name><comment>16-bit integer/floating-point variables supported in BufferBlock and Block</comment></member>
+ <member><type>VkBool32</type> <name>storagePushConstant16</name><comment>16-bit integer/floating-point variables supported in PushConstant</comment></member>
+ <member><type>VkBool32</type> <name>storageInputOutput16</name><comment>16-bit integer/floating-point variables supported in shader inputs and outputs</comment></member>
+ <member><type>VkBool32</type> <name>multiview</name><comment>Multiple views in a renderpass</comment></member>
+ <member><type>VkBool32</type> <name>multiviewGeometryShader</name><comment>Multiple views in a renderpass w/ geometry shader</comment></member>
+ <member><type>VkBool32</type> <name>multiviewTessellationShader</name><comment>Multiple views in a renderpass w/ tessellation shader</comment></member>
+ <member><type>VkBool32</type> <name>variablePointersStorageBuffer</name></member>
+ <member><type>VkBool32</type> <name>variablePointers</name></member>
+ <member><type>VkBool32</type> <name>protectedMemory</name></member>
+ <member><type>VkBool32</type> <name>samplerYcbcrConversion</name><comment>Sampler color conversion supported</comment></member>
+ <member><type>VkBool32</type> <name>shaderDrawParameters</name></member>
+ </type>
+ <type category="struct" name="VkPhysicalDeviceVulkan11Properties" returnedonly="true" structextends="VkPhysicalDeviceProperties2">
+ <member values="VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_VULKAN_1_1_PROPERTIES"><type>VkStructureType</type> <name>sType</name></member>
+ <member optional="true"><type>void</type>* <name>pNext</name></member>
+ <member limittype="exact"><type>uint8_t</type> <name>deviceUUID</name>[<enum>VK_UUID_SIZE</enum>]</member>
+ <member limittype="exact"><type>uint8_t</type> <name>driverUUID</name>[<enum>VK_UUID_SIZE</enum>]</member>
+ <member limittype="exact"><type>uint8_t</type> <name>deviceLUID</name>[<enum>VK_LUID_SIZE</enum>]</member>
+ <member limittype="exact"><type>uint32_t</type> <name>deviceNodeMask</name></member>
+ <member limittype="exact"><type>VkBool32</type> <name>deviceLUIDValid</name></member>
+ <member limittype="min,pot" noautovalidity="true"><type>uint32_t</type> <name>subgroupSize</name><comment>The size of a subgroup for this queue.</comment></member>
+ <member limittype="bitmask" noautovalidity="true"><type>VkShaderStageFlags</type> <name>subgroupSupportedStages</name><comment>Bitfield of what shader stages support subgroup operations</comment></member>
+ <member limittype="bitmask" noautovalidity="true"><type>VkSubgroupFeatureFlags</type> <name>subgroupSupportedOperations</name><comment>Bitfield of what subgroup operations are supported.</comment></member>
+ <member limittype="bitmask" noautovalidity="true"><type>VkBool32</type> <name>subgroupQuadOperationsInAllStages</name><comment>Flag to specify whether quad operations are available in all stages.</comment></member>
+ <member limittype="exact"><type>VkPointClippingBehavior</type> <name>pointClippingBehavior</name></member>
+ <member limittype="max"><type>uint32_t</type> <name>maxMultiviewViewCount</name><comment>max number of views in a subpass</comment></member>
+ <member limittype="max"><type>uint32_t</type> <name>maxMultiviewInstanceIndex</name><comment>max instance index for a draw in a multiview subpass</comment></member>
+ <member limittype="exact"><type>VkBool32</type> <name>protectedNoFault</name></member>
+ <member limittype="max"><type>uint32_t</type> <name>maxPerSetDescriptors</name></member>
+ <member limittype="max"><type>VkDeviceSize</type> <name>maxMemoryAllocationSize</name></member>
+ </type>
+ <type category="struct" name="VkPhysicalDeviceVulkan12Features" structextends="VkPhysicalDeviceFeatures2,VkDeviceCreateInfo">
+ <member values="VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_VULKAN_1_2_FEATURES"><type>VkStructureType</type> <name>sType</name></member>
+ <member optional="true"><type>void</type>* <name>pNext</name></member>
+ <member><type>VkBool32</type> <name>samplerMirrorClampToEdge</name></member>
+ <member><type>VkBool32</type> <name>drawIndirectCount</name></member>
+ <member><type>VkBool32</type> <name>storageBuffer8BitAccess</name><comment>8-bit integer variables supported in StorageBuffer</comment></member>
+ <member><type>VkBool32</type> <name>uniformAndStorageBuffer8BitAccess</name><comment>8-bit integer variables supported in StorageBuffer and Uniform</comment></member>
+ <member><type>VkBool32</type> <name>storagePushConstant8</name><comment>8-bit integer variables supported in PushConstant</comment></member>
+ <member><type>VkBool32</type> <name>shaderBufferInt64Atomics</name></member>
+ <member><type>VkBool32</type> <name>shaderSharedInt64Atomics</name></member>
+ <member><type>VkBool32</type> <name>shaderFloat16</name><comment>16-bit floats (halfs) in shaders</comment></member>
+ <member><type>VkBool32</type> <name>shaderInt8</name><comment>8-bit integers in shaders</comment></member>
+ <member><type>VkBool32</type> <name>descriptorIndexing</name></member>
+ <member><type>VkBool32</type> <name>shaderInputAttachmentArrayDynamicIndexing</name></member>
+ <member><type>VkBool32</type> <name>shaderUniformTexelBufferArrayDynamicIndexing</name></member>
+ <member><type>VkBool32</type> <name>shaderStorageTexelBufferArrayDynamicIndexing</name></member>
+ <member><type>VkBool32</type> <name>shaderUniformBufferArrayNonUniformIndexing</name></member>
+ <member><type>VkBool32</type> <name>shaderSampledImageArrayNonUniformIndexing</name></member>
+ <member><type>VkBool32</type> <name>shaderStorageBufferArrayNonUniformIndexing</name></member>
+ <member><type>VkBool32</type> <name>shaderStorageImageArrayNonUniformIndexing</name></member>
+ <member><type>VkBool32</type> <name>shaderInputAttachmentArrayNonUniformIndexing</name></member>
+ <member><type>VkBool32</type> <name>shaderUniformTexelBufferArrayNonUniformIndexing</name></member>
+ <member><type>VkBool32</type> <name>shaderStorageTexelBufferArrayNonUniformIndexing</name></member>
+ <member><type>VkBool32</type> <name>descriptorBindingUniformBufferUpdateAfterBind</name></member>
+ <member><type>VkBool32</type> <name>descriptorBindingSampledImageUpdateAfterBind</name></member>
+ <member><type>VkBool32</type> <name>descriptorBindingStorageImageUpdateAfterBind</name></member>
+ <member><type>VkBool32</type> <name>descriptorBindingStorageBufferUpdateAfterBind</name></member>
+ <member><type>VkBool32</type> <name>descriptorBindingUniformTexelBufferUpdateAfterBind</name></member>
+ <member><type>VkBool32</type> <name>descriptorBindingStorageTexelBufferUpdateAfterBind</name></member>
+ <member><type>VkBool32</type> <name>descriptorBindingUpdateUnusedWhilePending</name></member>
+ <member><type>VkBool32</type> <name>descriptorBindingPartiallyBound</name></member>
+ <member><type>VkBool32</type> <name>descriptorBindingVariableDescriptorCount</name></member>
+ <member><type>VkBool32</type> <name>runtimeDescriptorArray</name></member>
+ <member><type>VkBool32</type> <name>samplerFilterMinmax</name></member>
+ <member><type>VkBool32</type> <name>scalarBlockLayout</name></member>
+ <member><type>VkBool32</type> <name>imagelessFramebuffer</name></member>
+ <member><type>VkBool32</type> <name>uniformBufferStandardLayout</name></member>
+ <member><type>VkBool32</type> <name>shaderSubgroupExtendedTypes</name></member>
+ <member><type>VkBool32</type> <name>separateDepthStencilLayouts</name></member>
+ <member><type>VkBool32</type> <name>hostQueryReset</name></member>
+ <member><type>VkBool32</type> <name>timelineSemaphore</name></member>
+ <member><type>VkBool32</type> <name>bufferDeviceAddress</name></member>
+ <member><type>VkBool32</type> <name>bufferDeviceAddressCaptureReplay</name></member>
+ <member><type>VkBool32</type> <name>bufferDeviceAddressMultiDevice</name></member>
+ <member><type>VkBool32</type> <name>vulkanMemoryModel</name></member>
+ <member><type>VkBool32</type> <name>vulkanMemoryModelDeviceScope</name></member>
+ <member><type>VkBool32</type> <name>vulkanMemoryModelAvailabilityVisibilityChains</name></member>
+ <member><type>VkBool32</type> <name>shaderOutputViewportIndex</name></member>
+ <member><type>VkBool32</type> <name>shaderOutputLayer</name></member>
+ <member><type>VkBool32</type> <name>subgroupBroadcastDynamicId</name></member>
+ </type>
+ <type category="struct" name="VkPhysicalDeviceVulkan12Properties" returnedonly="true" structextends="VkPhysicalDeviceProperties2">
+ <member values="VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_VULKAN_1_2_PROPERTIES"><type>VkStructureType</type> <name>sType</name></member>
+ <member optional="true"><type>void</type>* <name>pNext</name></member>
+ <member limittype="noauto"><type>VkDriverId</type> <name>driverID</name></member>
+ <member limittype="noauto"><type>char</type> <name>driverName</name>[<enum>VK_MAX_DRIVER_NAME_SIZE</enum>]</member>
+ <member limittype="noauto"><type>char</type> <name>driverInfo</name>[<enum>VK_MAX_DRIVER_INFO_SIZE</enum>]</member>
+ <member limittype="noauto"><type>VkConformanceVersion</type> <name>conformanceVersion</name></member>
+ <member limittype="exact"><type>VkShaderFloatControlsIndependence</type> <name>denormBehaviorIndependence</name></member>
+ <member limittype="exact"><type>VkShaderFloatControlsIndependence</type> <name>roundingModeIndependence</name></member>
+ <member limittype="bitmask"><type>VkBool32</type> <name>shaderSignedZeroInfNanPreserveFloat16</name><comment>An implementation can preserve signed zero, nan, inf</comment></member>
+ <member limittype="bitmask"><type>VkBool32</type> <name>shaderSignedZeroInfNanPreserveFloat32</name><comment>An implementation can preserve signed zero, nan, inf</comment></member>
+ <member limittype="bitmask"><type>VkBool32</type> <name>shaderSignedZeroInfNanPreserveFloat64</name><comment>An implementation can preserve signed zero, nan, inf</comment></member>
+ <member limittype="bitmask"><type>VkBool32</type> <name>shaderDenormPreserveFloat16</name><comment>An implementation can preserve denormals</comment></member>
+ <member limittype="bitmask"><type>VkBool32</type> <name>shaderDenormPreserveFloat32</name><comment>An implementation can preserve denormals</comment></member>
+ <member limittype="bitmask"><type>VkBool32</type> <name>shaderDenormPreserveFloat64</name><comment>An implementation can preserve denormals</comment></member>
+ <member limittype="bitmask"><type>VkBool32</type> <name>shaderDenormFlushToZeroFloat16</name><comment>An implementation can flush to zero denormals</comment></member>
+ <member limittype="bitmask"><type>VkBool32</type> <name>shaderDenormFlushToZeroFloat32</name><comment>An implementation can flush to zero denormals</comment></member>
+ <member limittype="bitmask"><type>VkBool32</type> <name>shaderDenormFlushToZeroFloat64</name><comment>An implementation can flush to zero denormals</comment></member>
+ <member limittype="bitmask"><type>VkBool32</type> <name>shaderRoundingModeRTEFloat16</name><comment>An implementation can support RTE</comment></member>
+ <member limittype="bitmask"><type>VkBool32</type> <name>shaderRoundingModeRTEFloat32</name><comment>An implementation can support RTE</comment></member>
+ <member limittype="bitmask"><type>VkBool32</type> <name>shaderRoundingModeRTEFloat64</name><comment>An implementation can support RTE</comment></member>
+ <member limittype="bitmask"><type>VkBool32</type> <name>shaderRoundingModeRTZFloat16</name><comment>An implementation can support RTZ</comment></member>
+ <member limittype="bitmask"><type>VkBool32</type> <name>shaderRoundingModeRTZFloat32</name><comment>An implementation can support RTZ</comment></member>
+ <member limittype="bitmask"><type>VkBool32</type> <name>shaderRoundingModeRTZFloat64</name><comment>An implementation can support RTZ</comment></member>
+ <member limittype="max"><type>uint32_t</type> <name>maxUpdateAfterBindDescriptorsInAllPools</name></member>
+ <member limittype="bitmask"><type>VkBool32</type> <name>shaderUniformBufferArrayNonUniformIndexingNative</name></member>
+ <member limittype="bitmask"><type>VkBool32</type> <name>shaderSampledImageArrayNonUniformIndexingNative</name></member>
+ <member limittype="bitmask"><type>VkBool32</type> <name>shaderStorageBufferArrayNonUniformIndexingNative</name></member>
+ <member limittype="bitmask"><type>VkBool32</type> <name>shaderStorageImageArrayNonUniformIndexingNative</name></member>
+ <member limittype="bitmask"><type>VkBool32</type> <name>shaderInputAttachmentArrayNonUniformIndexingNative</name></member>
+ <member limittype="bitmask"><type>VkBool32</type> <name>robustBufferAccessUpdateAfterBind</name></member>
+ <member limittype="bitmask"><type>VkBool32</type> <name>quadDivergentImplicitLod</name></member>
+ <member limittype="max"><type>uint32_t</type> <name>maxPerStageDescriptorUpdateAfterBindSamplers</name></member>
+ <member limittype="max"><type>uint32_t</type> <name>maxPerStageDescriptorUpdateAfterBindUniformBuffers</name></member>
+ <member limittype="max"><type>uint32_t</type> <name>maxPerStageDescriptorUpdateAfterBindStorageBuffers</name></member>
+ <member limittype="max"><type>uint32_t</type> <name>maxPerStageDescriptorUpdateAfterBindSampledImages</name></member>
+ <member limittype="max"><type>uint32_t</type> <name>maxPerStageDescriptorUpdateAfterBindStorageImages</name></member>
+ <member limittype="max"><type>uint32_t</type> <name>maxPerStageDescriptorUpdateAfterBindInputAttachments</name></member>
+ <member limittype="max"><type>uint32_t</type> <name>maxPerStageUpdateAfterBindResources</name></member>
+ <member limittype="max"><type>uint32_t</type> <name>maxDescriptorSetUpdateAfterBindSamplers</name></member>
+ <member limittype="max"><type>uint32_t</type> <name>maxDescriptorSetUpdateAfterBindUniformBuffers</name></member>
+ <member limittype="max"><type>uint32_t</type> <name>maxDescriptorSetUpdateAfterBindUniformBuffersDynamic</name></member>
+ <member limittype="max"><type>uint32_t</type> <name>maxDescriptorSetUpdateAfterBindStorageBuffers</name></member>
+ <member limittype="max"><type>uint32_t</type> <name>maxDescriptorSetUpdateAfterBindStorageBuffersDynamic</name></member>
+ <member limittype="max"><type>uint32_t</type> <name>maxDescriptorSetUpdateAfterBindSampledImages</name></member>
+ <member limittype="max"><type>uint32_t</type> <name>maxDescriptorSetUpdateAfterBindStorageImages</name></member>
+ <member limittype="max"><type>uint32_t</type> <name>maxDescriptorSetUpdateAfterBindInputAttachments</name></member>
+ <member limittype="bitmask"><type>VkResolveModeFlags</type> <name>supportedDepthResolveModes</name><comment>supported depth resolve modes</comment></member>
+ <member limittype="bitmask"><type>VkResolveModeFlags</type> <name>supportedStencilResolveModes</name><comment>supported stencil resolve modes</comment></member>
+ <member limittype="bitmask"><type>VkBool32</type> <name>independentResolveNone</name><comment>depth and stencil resolve modes can be set independently if one of them is none</comment></member>
+ <member limittype="bitmask"><type>VkBool32</type> <name>independentResolve</name><comment>depth and stencil resolve modes can be set independently</comment></member>
+ <member limittype="bitmask"><type>VkBool32</type> <name>filterMinmaxSingleComponentFormats</name></member>
+ <member limittype="bitmask"><type>VkBool32</type> <name>filterMinmaxImageComponentMapping</name></member>
+ <member limittype="max"><type>uint64_t</type> <name>maxTimelineSemaphoreValueDifference</name></member>
+ <member limittype="bitmask" optional="true"><type>VkSampleCountFlags</type> <name>framebufferIntegerColorSampleCounts</name></member>
+ </type>
+ <type category="struct" name="VkPhysicalDeviceVulkan13Features" structextends="VkPhysicalDeviceFeatures2,VkDeviceCreateInfo">
+ <member values="VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_VULKAN_1_3_FEATURES"><type>VkStructureType</type> <name>sType</name></member>
+ <member optional="true"><type>void</type>* <name>pNext</name></member>
+ <member><type>VkBool32</type> <name>robustImageAccess</name></member>
+ <member><type>VkBool32</type> <name>inlineUniformBlock</name></member>
+ <member><type>VkBool32</type> <name>descriptorBindingInlineUniformBlockUpdateAfterBind</name></member>
+ <member><type>VkBool32</type> <name>pipelineCreationCacheControl</name></member>
+ <member><type>VkBool32</type> <name>privateData</name></member>
+ <member><type>VkBool32</type> <name>shaderDemoteToHelperInvocation</name></member>
+ <member><type>VkBool32</type> <name>shaderTerminateInvocation</name></member>
+ <member><type>VkBool32</type> <name>subgroupSizeControl</name></member>
+ <member><type>VkBool32</type> <name>computeFullSubgroups</name></member>
+ <member><type>VkBool32</type> <name>synchronization2</name></member>
+ <member><type>VkBool32</type> <name>textureCompressionASTC_HDR</name></member>
+ <member><type>VkBool32</type> <name>shaderZeroInitializeWorkgroupMemory</name></member>
+ <member><type>VkBool32</type> <name>dynamicRendering</name></member>
+ <member><type>VkBool32</type> <name>shaderIntegerDotProduct</name></member>
+ <member><type>VkBool32</type> <name>maintenance4</name></member>
+ </type>
+ <type category="struct" name="VkPhysicalDeviceVulkan13Properties" returnedonly="true" structextends="VkPhysicalDeviceProperties2">
+ <member values="VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_VULKAN_1_3_PROPERTIES"><type>VkStructureType</type> <name>sType</name></member>
+ <member optional="true"><type>void</type>* <name>pNext</name></member>
+ <member limittype="min,pot" noautovalidity="true"><type>uint32_t</type> <name>minSubgroupSize</name><comment>The minimum subgroup size supported by this device</comment></member>
+ <member limittype="max,pot" noautovalidity="true"><type>uint32_t</type> <name>maxSubgroupSize</name><comment>The maximum subgroup size supported by this device</comment></member>
+ <member limittype="max" noautovalidity="true"><type>uint32_t</type> <name>maxComputeWorkgroupSubgroups</name><comment>The maximum number of subgroups supported in a workgroup</comment></member>
+ <member limittype="bitmask"><type>VkShaderStageFlags</type> <name>requiredSubgroupSizeStages</name><comment>The shader stages that support specifying a subgroup size</comment></member>
+ <member limittype="max"><type>uint32_t</type> <name>maxInlineUniformBlockSize</name></member>
+ <member limittype="max"><type>uint32_t</type> <name>maxPerStageDescriptorInlineUniformBlocks</name></member>
+ <member limittype="max"><type>uint32_t</type> <name>maxPerStageDescriptorUpdateAfterBindInlineUniformBlocks</name></member>
+ <member limittype="max"><type>uint32_t</type> <name>maxDescriptorSetInlineUniformBlocks</name></member>
+ <member limittype="max"><type>uint32_t</type> <name>maxDescriptorSetUpdateAfterBindInlineUniformBlocks</name></member>
+ <member limittype="max"><type>uint32_t</type> <name>maxInlineUniformTotalSize</name></member>
+ <member limittype="bitmask"><type>VkBool32</type> <name>integerDotProduct8BitUnsignedAccelerated</name></member>
+ <member limittype="bitmask"><type>VkBool32</type> <name>integerDotProduct8BitSignedAccelerated</name></member>
+ <member limittype="bitmask"><type>VkBool32</type> <name>integerDotProduct8BitMixedSignednessAccelerated</name></member>
+ <member limittype="bitmask"><type>VkBool32</type> <name>integerDotProduct4x8BitPackedUnsignedAccelerated</name></member>
+ <member limittype="bitmask"><type>VkBool32</type> <name>integerDotProduct4x8BitPackedSignedAccelerated</name></member>
+ <member limittype="bitmask"><type>VkBool32</type> <name>integerDotProduct4x8BitPackedMixedSignednessAccelerated</name></member>
+ <member limittype="bitmask"><type>VkBool32</type> <name>integerDotProduct16BitUnsignedAccelerated</name></member>
+ <member limittype="bitmask"><type>VkBool32</type> <name>integerDotProduct16BitSignedAccelerated</name></member>
+ <member limittype="bitmask"><type>VkBool32</type> <name>integerDotProduct16BitMixedSignednessAccelerated</name></member>
+ <member limittype="bitmask"><type>VkBool32</type> <name>integerDotProduct32BitUnsignedAccelerated</name></member>
+ <member limittype="bitmask"><type>VkBool32</type> <name>integerDotProduct32BitSignedAccelerated</name></member>
+ <member limittype="bitmask"><type>VkBool32</type> <name>integerDotProduct32BitMixedSignednessAccelerated</name></member>
+ <member limittype="bitmask"><type>VkBool32</type> <name>integerDotProduct64BitUnsignedAccelerated</name></member>
+ <member limittype="bitmask"><type>VkBool32</type> <name>integerDotProduct64BitSignedAccelerated</name></member>
+ <member limittype="bitmask"><type>VkBool32</type> <name>integerDotProduct64BitMixedSignednessAccelerated</name></member>
+ <member limittype="bitmask"><type>VkBool32</type> <name>integerDotProductAccumulatingSaturating8BitUnsignedAccelerated</name></member>
+ <member limittype="bitmask"><type>VkBool32</type> <name>integerDotProductAccumulatingSaturating8BitSignedAccelerated</name></member>
+ <member limittype="bitmask"><type>VkBool32</type> <name>integerDotProductAccumulatingSaturating8BitMixedSignednessAccelerated</name></member>
+ <member limittype="bitmask"><type>VkBool32</type> <name>integerDotProductAccumulatingSaturating4x8BitPackedUnsignedAccelerated</name></member>
+ <member limittype="bitmask"><type>VkBool32</type> <name>integerDotProductAccumulatingSaturating4x8BitPackedSignedAccelerated</name></member>
+ <member limittype="bitmask"><type>VkBool32</type> <name>integerDotProductAccumulatingSaturating4x8BitPackedMixedSignednessAccelerated</name></member>
+ <member limittype="bitmask"><type>VkBool32</type> <name>integerDotProductAccumulatingSaturating16BitUnsignedAccelerated</name></member>
+ <member limittype="bitmask"><type>VkBool32</type> <name>integerDotProductAccumulatingSaturating16BitSignedAccelerated</name></member>
+ <member limittype="bitmask"><type>VkBool32</type> <name>integerDotProductAccumulatingSaturating16BitMixedSignednessAccelerated</name></member>
+ <member limittype="bitmask"><type>VkBool32</type> <name>integerDotProductAccumulatingSaturating32BitUnsignedAccelerated</name></member>
+ <member limittype="bitmask"><type>VkBool32</type> <name>integerDotProductAccumulatingSaturating32BitSignedAccelerated</name></member>
+ <member limittype="bitmask"><type>VkBool32</type> <name>integerDotProductAccumulatingSaturating32BitMixedSignednessAccelerated</name></member>
+ <member limittype="bitmask"><type>VkBool32</type> <name>integerDotProductAccumulatingSaturating64BitUnsignedAccelerated</name></member>
+ <member limittype="bitmask"><type>VkBool32</type> <name>integerDotProductAccumulatingSaturating64BitSignedAccelerated</name></member>
+ <member limittype="bitmask"><type>VkBool32</type> <name>integerDotProductAccumulatingSaturating64BitMixedSignednessAccelerated</name></member>
+ <member limittype="min,pot"><type>VkDeviceSize</type> <name>storageTexelBufferOffsetAlignmentBytes</name></member>
+ <member limittype="exact"><type>VkBool32</type> <name>storageTexelBufferOffsetSingleTexelAlignment</name></member>
+ <member limittype="min,pot"><type>VkDeviceSize</type> <name>uniformTexelBufferOffsetAlignmentBytes</name></member>
+ <member limittype="exact"><type>VkBool32</type> <name>uniformTexelBufferOffsetSingleTexelAlignment</name></member>
+ <member limittype="max"><type>VkDeviceSize</type> <name>maxBufferSize</name></member>
+ </type>
+ <type category="struct" name="VkPipelineCompilerControlCreateInfoAMD" structextends="VkGraphicsPipelineCreateInfo,VkComputePipelineCreateInfo">
+ <member values="VK_STRUCTURE_TYPE_PIPELINE_COMPILER_CONTROL_CREATE_INFO_AMD"><type>VkStructureType</type> <name>sType</name></member>
+ <member optional="true">const <type>void</type>* <name>pNext</name></member>
+ <member optional="true"><type>VkPipelineCompilerControlFlagsAMD</type> <name>compilerControlFlags</name></member>
+ </type>
+ <type category="struct" name="VkPhysicalDeviceCoherentMemoryFeaturesAMD" structextends="VkPhysicalDeviceFeatures2,VkDeviceCreateInfo">
+ <member values="VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_COHERENT_MEMORY_FEATURES_AMD"><type>VkStructureType</type> <name>sType</name></member>
+ <member optional="true"><type>void</type>* <name>pNext</name></member>
+ <member><type>VkBool32</type> <name>deviceCoherentMemory</name></member>
+ </type>
+ <type category="struct" name="VkPhysicalDeviceToolProperties" returnedonly="true">
+ <member values="VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_TOOL_PROPERTIES"><type>VkStructureType</type> <name>sType</name></member>
+ <member optional="true"><type>void</type>* <name>pNext</name></member>
+ <member><type>char</type> <name>name</name>[<enum>VK_MAX_EXTENSION_NAME_SIZE</enum>]</member>
+ <member><type>char</type> <name>version</name>[<enum>VK_MAX_EXTENSION_NAME_SIZE</enum>]</member>
+ <member><type>VkToolPurposeFlags</type> <name>purposes</name></member>
+ <member><type>char</type> <name>description</name>[<enum>VK_MAX_DESCRIPTION_SIZE</enum>]</member>
+ <member><type>char</type> <name>layer</name>[<enum>VK_MAX_EXTENSION_NAME_SIZE</enum>]</member>
+ </type>
+ <type category="struct" name="VkPhysicalDeviceToolPropertiesEXT" alias="VkPhysicalDeviceToolProperties"/>
+ <type category="struct" name="VkSamplerCustomBorderColorCreateInfoEXT" structextends="VkSamplerCreateInfo">
+ <member values="VK_STRUCTURE_TYPE_SAMPLER_CUSTOM_BORDER_COLOR_CREATE_INFO_EXT"><type>VkStructureType</type> <name>sType</name></member>
+ <member optional="true">const <type>void</type>* <name>pNext</name></member>
+ <member noautovalidity="true"><type>VkClearColorValue</type> <name>customBorderColor</name></member>
+ <member><type>VkFormat</type> <name>format</name></member>
+ </type>
+ <type category="struct" name="VkPhysicalDeviceCustomBorderColorPropertiesEXT" structextends="VkPhysicalDeviceProperties2" returnedonly="true">
+ <member values="VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_CUSTOM_BORDER_COLOR_PROPERTIES_EXT"><type>VkStructureType</type> <name>sType</name></member>
+ <member optional="true"><type>void</type>* <name>pNext</name></member>
+ <member limittype="max"><type>uint32_t</type> <name>maxCustomBorderColorSamplers</name></member>
+ </type>
+ <type category="struct" name="VkPhysicalDeviceCustomBorderColorFeaturesEXT" structextends="VkPhysicalDeviceFeatures2,VkDeviceCreateInfo">
+ <member values="VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_CUSTOM_BORDER_COLOR_FEATURES_EXT"><type>VkStructureType</type> <name>sType</name></member>
+ <member optional="true"><type>void</type>* <name>pNext</name></member>
+ <member><type>VkBool32</type> <name>customBorderColors</name></member>
+ <member><type>VkBool32</type> <name>customBorderColorWithoutFormat</name></member>
+ </type>
+ <type category="struct" name="VkSamplerBorderColorComponentMappingCreateInfoEXT" structextends="VkSamplerCreateInfo">
+ <member values="VK_STRUCTURE_TYPE_SAMPLER_BORDER_COLOR_COMPONENT_MAPPING_CREATE_INFO_EXT"><type>VkStructureType</type> <name>sType</name></member>
+ <member optional="true">const <type>void</type>* <name>pNext</name></member>
+ <member><type>VkComponentMapping</type> <name>components</name></member>
+ <member><type>VkBool32</type> <name>srgb</name></member>
+ </type>
+ <type category="struct" name="VkPhysicalDeviceBorderColorSwizzleFeaturesEXT" structextends="VkPhysicalDeviceFeatures2,VkDeviceCreateInfo">
+ <member values="VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_BORDER_COLOR_SWIZZLE_FEATURES_EXT"><type>VkStructureType</type> <name>sType</name></member>
+ <member optional="true"><type>void</type>* <name>pNext</name></member>
+ <member><type>VkBool32</type> <name>borderColorSwizzle</name></member>
+ <member><type>VkBool32</type> <name>borderColorSwizzleFromImage</name></member>
+ </type>
+ <type category="union" name="VkDeviceOrHostAddressKHR">
+ <member noautovalidity="true"><type>VkDeviceAddress</type> <name>deviceAddress</name></member>
+ <member noautovalidity="true"><type>void</type>* <name>hostAddress</name></member>
+ </type>
+ <type category="union" name="VkDeviceOrHostAddressConstKHR">
+ <member noautovalidity="true"><type>VkDeviceAddress</type> <name>deviceAddress</name></member>
+ <member noautovalidity="true">const <type>void</type>* <name>hostAddress</name></member>
+ </type>
+ <type category="struct" name="VkAccelerationStructureGeometryTrianglesDataKHR">
+ <member values="VK_STRUCTURE_TYPE_ACCELERATION_STRUCTURE_GEOMETRY_TRIANGLES_DATA_KHR"><type>VkStructureType</type> <name>sType</name></member>
+ <member optional="true">const <type>void</type>* <name>pNext</name></member>
+ <member><type>VkFormat</type> <name>vertexFormat</name></member>
+ <member noautovalidity="true"><type>VkDeviceOrHostAddressConstKHR</type> <name>vertexData</name></member>
+ <member><type>VkDeviceSize</type> <name>vertexStride</name></member>
+ <member><type>uint32_t</type> <name>maxVertex</name></member>
+ <member><type>VkIndexType</type> <name>indexType</name></member>
+ <member noautovalidity="true"><type>VkDeviceOrHostAddressConstKHR</type> <name>indexData</name></member>
+ <member noautovalidity="true"><type>VkDeviceOrHostAddressConstKHR</type> <name>transformData</name></member>
+ </type>
+ <type category="struct" name="VkAccelerationStructureGeometryAabbsDataKHR">
+ <member values="VK_STRUCTURE_TYPE_ACCELERATION_STRUCTURE_GEOMETRY_AABBS_DATA_KHR"><type>VkStructureType</type> <name>sType</name></member>
+ <member optional="true">const <type>void</type>* <name>pNext</name></member>
+ <member noautovalidity="true"><type>VkDeviceOrHostAddressConstKHR</type> <name>data</name></member>
+ <member><type>VkDeviceSize</type> <name>stride</name></member>
+ </type>
+ <type category="struct" name="VkAccelerationStructureGeometryInstancesDataKHR">
+ <member values="VK_STRUCTURE_TYPE_ACCELERATION_STRUCTURE_GEOMETRY_INSTANCES_DATA_KHR"><type>VkStructureType</type> <name>sType</name></member>
+ <member optional="true">const <type>void</type>* <name>pNext</name></member>
+ <member><type>VkBool32</type> <name>arrayOfPointers</name></member>
+ <member noautovalidity="true"><type>VkDeviceOrHostAddressConstKHR</type> <name>data</name></member>
+ </type>
+ <type category="union" name="VkAccelerationStructureGeometryDataKHR">
+ <member selection="VK_GEOMETRY_TYPE_TRIANGLES_KHR"><type>VkAccelerationStructureGeometryTrianglesDataKHR</type> <name>triangles</name></member>
+ <member selection="VK_GEOMETRY_TYPE_AABBS_KHR"><type>VkAccelerationStructureGeometryAabbsDataKHR</type> <name>aabbs</name></member>
+ <member selection="VK_GEOMETRY_TYPE_INSTANCES_KHR"><type>VkAccelerationStructureGeometryInstancesDataKHR</type> <name>instances</name></member>
+ </type>
+ <type category="struct" name="VkAccelerationStructureGeometryKHR">
+ <member values="VK_STRUCTURE_TYPE_ACCELERATION_STRUCTURE_GEOMETRY_KHR"><type>VkStructureType</type> <name>sType</name></member>
+ <member optional="true">const <type>void</type>* <name>pNext</name></member>
+ <member><type>VkGeometryTypeKHR</type> <name>geometryType</name></member>
+ <member selector="geometryType"><type>VkAccelerationStructureGeometryDataKHR</type> <name>geometry</name></member>
+ <member optional="true"><type>VkGeometryFlagsKHR</type> <name>flags</name></member>
+ </type>
+ <type category="struct" name="VkAccelerationStructureBuildGeometryInfoKHR">
+ <member values="VK_STRUCTURE_TYPE_ACCELERATION_STRUCTURE_BUILD_GEOMETRY_INFO_KHR"><type>VkStructureType</type> <name>sType</name></member>
+ <member optional="true">const <type>void</type>* <name>pNext</name></member>
+ <member><type>VkAccelerationStructureTypeKHR</type> <name>type</name></member>
+ <member optional="true"><type>VkBuildAccelerationStructureFlagsKHR</type> <name>flags</name></member>
+ <member noautovalidity="true"><type>VkBuildAccelerationStructureModeKHR</type> <name>mode</name></member>
+ <member optional="true" noautovalidity="true"><type>VkAccelerationStructureKHR</type> <name>srcAccelerationStructure</name></member>
+ <member optional="true" noautovalidity="true"><type>VkAccelerationStructureKHR</type> <name>dstAccelerationStructure</name></member>
+ <member optional="true"><type>uint32_t</type> <name>geometryCount</name></member>
+ <member len="geometryCount" optional="true">const <type>VkAccelerationStructureGeometryKHR</type>* <name>pGeometries</name></member>
+ <member len="geometryCount,1" optional="true,false">const <type>VkAccelerationStructureGeometryKHR</type>* const* <name>ppGeometries</name></member>
+ <member noautovalidity="true"><type>VkDeviceOrHostAddressKHR</type> <name>scratchData</name></member>
+ </type>
+ <type category="struct" name="VkAccelerationStructureBuildRangeInfoKHR">
+ <member><type>uint32_t</type> <name>primitiveCount</name></member>
+ <member><type>uint32_t</type> <name>primitiveOffset</name></member>
+ <member><type>uint32_t</type> <name>firstVertex</name></member>
+ <member><type>uint32_t</type> <name>transformOffset</name></member>
+ </type>
+ <type category="struct" name="VkAccelerationStructureCreateInfoKHR">
+ <member values="VK_STRUCTURE_TYPE_ACCELERATION_STRUCTURE_CREATE_INFO_KHR"><type>VkStructureType</type> <name>sType</name></member>
+ <member optional="true">const <type>void</type>* <name>pNext</name></member>
+ <member optional="true"><type>VkAccelerationStructureCreateFlagsKHR</type> <name>createFlags</name></member>
+ <member><type>VkBuffer</type> <name>buffer</name></member>
+ <member><type>VkDeviceSize</type> <name>offset</name><comment>Specified in bytes</comment></member>
+ <member><type>VkDeviceSize</type> <name>size</name></member>
+ <member><type>VkAccelerationStructureTypeKHR</type> <name>type</name></member>
+ <member optional="true"><type>VkDeviceAddress</type> <name>deviceAddress</name></member>
+ </type>
+ <type category="struct" name="VkAabbPositionsKHR">
+ <member><type>float</type> <name>minX</name></member>
+ <member><type>float</type> <name>minY</name></member>
+ <member><type>float</type> <name>minZ</name></member>
+ <member><type>float</type> <name>maxX</name></member>
+ <member><type>float</type> <name>maxY</name></member>
+ <member><type>float</type> <name>maxZ</name></member>
+ </type>
+ <type category="struct" name="VkAabbPositionsNV" alias="VkAabbPositionsKHR"/>
+ <type category="struct" name="VkTransformMatrixKHR">
+ <member><type>float</type> <name>matrix</name>[3][4]</member>
+ </type>
+ <type category="struct" name="VkTransformMatrixNV" alias="VkTransformMatrixKHR"/>
+ <type category="struct" name="VkAccelerationStructureInstanceKHR">
+ <comment>The bitfields in this structure are non-normative since bitfield ordering is implementation-defined in C. The specification defines the normative layout.</comment>
+ <member><type>VkTransformMatrixKHR</type> <name>transform</name></member>
+ <member><type>uint32_t</type> <name>instanceCustomIndex</name>:24</member>
+ <member><type>uint32_t</type> <name>mask</name>:8</member>
+ <member><type>uint32_t</type> <name>instanceShaderBindingTableRecordOffset</name>:24</member>
+ <member optional="true"><type>VkGeometryInstanceFlagsKHR</type> <name>flags</name>:8</member>
+ <member><type>uint64_t</type> <name>accelerationStructureReference</name></member>
+ </type>
+ <type category="struct" name="VkAccelerationStructureInstanceNV" alias="VkAccelerationStructureInstanceKHR"/>
+ <type category="struct" name="VkAccelerationStructureDeviceAddressInfoKHR">
+ <member values="VK_STRUCTURE_TYPE_ACCELERATION_STRUCTURE_DEVICE_ADDRESS_INFO_KHR"><type>VkStructureType</type> <name>sType</name></member>
+ <member optional="true">const <type>void</type>* <name>pNext</name></member>
+ <member><type>VkAccelerationStructureKHR</type> <name>accelerationStructure</name></member>
+ </type>
+ <type category="struct" name="VkAccelerationStructureVersionInfoKHR">
+ <member values="VK_STRUCTURE_TYPE_ACCELERATION_STRUCTURE_VERSION_INFO_KHR"><type>VkStructureType</type> <name>sType</name></member>
+ <member optional="true">const <type>void</type>* <name>pNext</name></member>
+ <member len="latexmath:[2 \times \mathtt{VK\_UUID\_SIZE}]" altlen="2*VK_UUID_SIZE">const <type>uint8_t</type>* <name>pVersionData</name></member>
+ </type>
+ <type category="struct" name="VkCopyAccelerationStructureInfoKHR">
+ <member values="VK_STRUCTURE_TYPE_COPY_ACCELERATION_STRUCTURE_INFO_KHR"><type>VkStructureType</type> <name>sType</name></member>
+ <member optional="true">const <type>void</type>* <name>pNext</name></member>
+ <member><type>VkAccelerationStructureKHR</type> <name>src</name></member>
+ <member><type>VkAccelerationStructureKHR</type> <name>dst</name></member>
+ <member><type>VkCopyAccelerationStructureModeKHR</type> <name>mode</name></member>
+ </type>
+ <type category="struct" name="VkCopyAccelerationStructureToMemoryInfoKHR">
+ <member values="VK_STRUCTURE_TYPE_COPY_ACCELERATION_STRUCTURE_TO_MEMORY_INFO_KHR"><type>VkStructureType</type> <name>sType</name></member>
+ <member optional="true">const <type>void</type>* <name>pNext</name></member>
+ <member><type>VkAccelerationStructureKHR</type> <name>src</name></member>
+ <member noautovalidity="true"><type>VkDeviceOrHostAddressKHR</type> <name>dst</name></member>
+ <member><type>VkCopyAccelerationStructureModeKHR</type> <name>mode</name></member>
+ </type>
+ <type category="struct" name="VkCopyMemoryToAccelerationStructureInfoKHR">
+ <member values="VK_STRUCTURE_TYPE_COPY_MEMORY_TO_ACCELERATION_STRUCTURE_INFO_KHR"><type>VkStructureType</type> <name>sType</name></member>
+ <member optional="true">const <type>void</type>* <name>pNext</name></member>
+ <member noautovalidity="true"><type>VkDeviceOrHostAddressConstKHR</type> <name>src</name></member>
+ <member><type>VkAccelerationStructureKHR</type> <name>dst</name></member>
+ <member><type>VkCopyAccelerationStructureModeKHR</type> <name>mode</name></member>
+ </type>
+ <type category="struct" name="VkRayTracingPipelineInterfaceCreateInfoKHR">
+ <member values="VK_STRUCTURE_TYPE_RAY_TRACING_PIPELINE_INTERFACE_CREATE_INFO_KHR"><type>VkStructureType</type> <name>sType</name></member>
+ <member optional="true">const <type>void</type>* <name>pNext</name></member>
+ <member><type>uint32_t</type> <name>maxPipelineRayPayloadSize</name></member>
+ <member><type>uint32_t</type> <name>maxPipelineRayHitAttributeSize</name></member>
+ </type>
+ <type category="struct" name="VkPipelineLibraryCreateInfoKHR" structextends="VkGraphicsPipelineCreateInfo">
+ <member values="VK_STRUCTURE_TYPE_PIPELINE_LIBRARY_CREATE_INFO_KHR"><type>VkStructureType</type> <name>sType</name></member>
+ <member optional="true">const <type>void</type>* <name>pNext</name></member>
+ <member optional="true"><type>uint32_t</type> <name>libraryCount</name></member>
+ <member len="libraryCount">const <type>VkPipeline</type>* <name>pLibraries</name></member>
+ </type>
+ <type category="struct" name="VkPhysicalDeviceExtendedDynamicStateFeaturesEXT" structextends="VkPhysicalDeviceFeatures2,VkDeviceCreateInfo">
+ <member values="VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_EXTENDED_DYNAMIC_STATE_FEATURES_EXT"><type>VkStructureType</type> <name>sType</name></member>
+ <member optional="true"><type>void</type>* <name>pNext</name></member>
+ <member><type>VkBool32</type> <name>extendedDynamicState</name></member>
+ </type>
+ <type category="struct" name="VkPhysicalDeviceExtendedDynamicState2FeaturesEXT" structextends="VkPhysicalDeviceFeatures2,VkDeviceCreateInfo">
+ <member values="VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_EXTENDED_DYNAMIC_STATE_2_FEATURES_EXT"><type>VkStructureType</type> <name>sType</name></member>
+ <member optional="true"><type>void</type>* <name>pNext</name></member>
+ <member><type>VkBool32</type> <name>extendedDynamicState2</name></member>
+ <member><type>VkBool32</type> <name>extendedDynamicState2LogicOp</name></member>
+ <member><type>VkBool32</type> <name>extendedDynamicState2PatchControlPoints</name></member>
+ </type>
+ <type category="struct" name="VkRenderPassTransformBeginInfoQCOM" structextends="VkRenderPassBeginInfo">
+ <member values="VK_STRUCTURE_TYPE_RENDER_PASS_TRANSFORM_BEGIN_INFO_QCOM"><type>VkStructureType</type> <name>sType</name></member>
+ <member optional="true"><type>void</type>* <name>pNext</name><comment>Pointer to next structure</comment></member>
+ <member noautovalidity="true"><type>VkSurfaceTransformFlagBitsKHR</type> <name>transform</name></member>
+ </type>
+ <type category="struct" name="VkCopyCommandTransformInfoQCOM" structextends="VkBufferImageCopy2,VkImageBlit2">
+ <member values="VK_STRUCTURE_TYPE_COPY_COMMAND_TRANSFORM_INFO_QCOM"><type>VkStructureType</type> <name>sType</name></member>
+ <member optional="true" noautovalidity="true">const <type>void</type>* <name>pNext</name></member>
+ <member noautovalidity="true"><type>VkSurfaceTransformFlagBitsKHR</type> <name>transform</name></member>
+ </type>
+ <type category="struct" name="VkCommandBufferInheritanceRenderPassTransformInfoQCOM" structextends="VkCommandBufferInheritanceInfo">
+ <member values="VK_STRUCTURE_TYPE_COMMAND_BUFFER_INHERITANCE_RENDER_PASS_TRANSFORM_INFO_QCOM"><type>VkStructureType</type> <name>sType</name></member>
+ <member optional="true"><type>void</type>* <name>pNext</name><comment>Pointer to next structure</comment></member>
+ <member noautovalidity="true"><type>VkSurfaceTransformFlagBitsKHR</type> <name>transform</name></member>
+ <member><type>VkRect2D</type> <name>renderArea</name></member>
+ </type>
+ <type category="struct" name="VkPhysicalDeviceDiagnosticsConfigFeaturesNV" structextends="VkPhysicalDeviceFeatures2,VkDeviceCreateInfo">
+ <member values="VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_DIAGNOSTICS_CONFIG_FEATURES_NV"><type>VkStructureType</type> <name>sType</name></member>
+ <member optional="true"><type>void</type>* <name>pNext</name></member>
+ <member><type>VkBool32</type> <name>diagnosticsConfig</name></member>
+ </type>
+ <type category="struct" name="VkDeviceDiagnosticsConfigCreateInfoNV" structextends="VkDeviceCreateInfo">
+ <member values="VK_STRUCTURE_TYPE_DEVICE_DIAGNOSTICS_CONFIG_CREATE_INFO_NV"><type>VkStructureType</type> <name>sType</name></member>
+ <member optional="true">const <type>void</type>* <name>pNext</name></member>
+ <member optional="true"><type>VkDeviceDiagnosticsConfigFlagsNV</type> <name>flags</name></member>
+ </type>
+ <type category="struct" name="VkPhysicalDeviceZeroInitializeWorkgroupMemoryFeatures" structextends="VkPhysicalDeviceFeatures2,VkDeviceCreateInfo">
+ <member values="VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_ZERO_INITIALIZE_WORKGROUP_MEMORY_FEATURES"><type>VkStructureType</type> <name>sType</name></member>
+ <member optional="true"><type>void</type>* <name>pNext</name></member>
+ <member><type>VkBool32</type> <name>shaderZeroInitializeWorkgroupMemory</name></member>
+ </type>
+ <type category="struct" name="VkPhysicalDeviceZeroInitializeWorkgroupMemoryFeaturesKHR" alias="VkPhysicalDeviceZeroInitializeWorkgroupMemoryFeatures"/>
+ <type category="struct" name="VkPhysicalDeviceShaderSubgroupUniformControlFlowFeaturesKHR" structextends="VkPhysicalDeviceFeatures2,VkDeviceCreateInfo">
+ <member values="VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_SHADER_SUBGROUP_UNIFORM_CONTROL_FLOW_FEATURES_KHR"><type>VkStructureType</type> <name>sType</name></member>
+ <member optional="true"><type>void</type>* <name>pNext</name></member>
+ <member><type>VkBool32</type> <name>shaderSubgroupUniformControlFlow</name></member>
+ </type>
+ <type category="struct" name="VkPhysicalDeviceRobustness2FeaturesEXT" structextends="VkPhysicalDeviceFeatures2,VkDeviceCreateInfo">
+ <member values="VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_ROBUSTNESS_2_FEATURES_EXT"><type>VkStructureType</type> <name>sType</name></member>
+ <member optional="true"><type>void</type>* <name>pNext</name></member>
+ <member><type>VkBool32</type> <name>robustBufferAccess2</name></member>
+ <member><type>VkBool32</type> <name>robustImageAccess2</name></member>
+ <member><type>VkBool32</type> <name>nullDescriptor</name></member>
+ </type>
+ <type category="struct" name="VkPhysicalDeviceRobustness2PropertiesEXT" returnedonly="true" structextends="VkPhysicalDeviceProperties2">
+ <member values="VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_ROBUSTNESS_2_PROPERTIES_EXT"><type>VkStructureType</type> <name>sType</name></member>
+ <member optional="true"><type>void</type>* <name>pNext</name></member>
+ <member limittype="min,pot"><type>VkDeviceSize</type> <name>robustStorageBufferAccessSizeAlignment</name></member>
+ <member limittype="min,pot"><type>VkDeviceSize</type> <name>robustUniformBufferAccessSizeAlignment</name></member>
+ </type>
+ <type category="struct" name="VkPhysicalDeviceImageRobustnessFeatures" structextends="VkPhysicalDeviceFeatures2,VkDeviceCreateInfo">
+ <member values="VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_IMAGE_ROBUSTNESS_FEATURES"><type>VkStructureType</type> <name>sType</name></member>
+ <member optional="true"><type>void</type>* <name>pNext</name></member>
+ <member><type>VkBool32</type> <name>robustImageAccess</name></member>
+ </type>
+ <type category="struct" name="VkPhysicalDeviceImageRobustnessFeaturesEXT" alias="VkPhysicalDeviceImageRobustnessFeatures"/>
+ <type category="struct" name="VkPhysicalDeviceWorkgroupMemoryExplicitLayoutFeaturesKHR" structextends="VkPhysicalDeviceFeatures2,VkDeviceCreateInfo">
+ <member values="VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_WORKGROUP_MEMORY_EXPLICIT_LAYOUT_FEATURES_KHR"><type>VkStructureType</type> <name>sType</name></member>
+ <member optional="true" noautovalidity="true"><type>void</type>* <name>pNext</name></member>
+ <member><type>VkBool32</type> <name>workgroupMemoryExplicitLayout</name></member>
+ <member><type>VkBool32</type> <name>workgroupMemoryExplicitLayoutScalarBlockLayout</name></member>
+ <member><type>VkBool32</type> <name>workgroupMemoryExplicitLayout8BitAccess</name></member>
+ <member><type>VkBool32</type> <name>workgroupMemoryExplicitLayout16BitAccess</name></member>
+ </type>
+ <type category="struct" name="VkPhysicalDevicePortabilitySubsetFeaturesKHR" structextends="VkPhysicalDeviceFeatures2,VkDeviceCreateInfo">
+ <member values="VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_PORTABILITY_SUBSET_FEATURES_KHR"><type>VkStructureType</type> <name>sType</name></member>
+ <member optional="true"><type>void</type>* <name>pNext</name></member>
+ <member><type>VkBool32</type> <name>constantAlphaColorBlendFactors</name></member>
+ <member><type>VkBool32</type> <name>events</name></member>
+ <member><type>VkBool32</type> <name>imageViewFormatReinterpretation</name></member>
+ <member><type>VkBool32</type> <name>imageViewFormatSwizzle</name></member>
+ <member><type>VkBool32</type> <name>imageView2DOn3DImage</name></member>
+ <member><type>VkBool32</type> <name>multisampleArrayImage</name></member>
+ <member><type>VkBool32</type> <name>mutableComparisonSamplers</name></member>
+ <member><type>VkBool32</type> <name>pointPolygons</name></member>
+ <member><type>VkBool32</type> <name>samplerMipLodBias</name></member>
+ <member><type>VkBool32</type> <name>separateStencilMaskRef</name></member>
+ <member><type>VkBool32</type> <name>shaderSampleRateInterpolationFunctions</name></member>
+ <member><type>VkBool32</type> <name>tessellationIsolines</name></member>
+ <member><type>VkBool32</type> <name>tessellationPointMode</name></member>
+ <member><type>VkBool32</type> <name>triangleFans</name></member>
+ <member><type>VkBool32</type> <name>vertexAttributeAccessBeyondStride</name></member>
+ </type>
+ <type category="struct" name="VkPhysicalDevicePortabilitySubsetPropertiesKHR" structextends="VkPhysicalDeviceProperties2">
+ <member values="VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_PORTABILITY_SUBSET_PROPERTIES_KHR"><type>VkStructureType</type> <name>sType</name></member>
+ <member optional="true"><type>void</type>* <name>pNext</name></member>
+ <member limittype="min,pot"><type>uint32_t</type> <name>minVertexInputBindingStrideAlignment</name></member>
+ </type>
+ <type category="struct" name="VkPhysicalDevice4444FormatsFeaturesEXT" structextends="VkPhysicalDeviceFeatures2,VkDeviceCreateInfo">
+ <member values="VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_4444_FORMATS_FEATURES_EXT"><type>VkStructureType</type> <name>sType</name></member>
+ <member optional="true"><type>void</type>* <name>pNext</name></member>
+ <member><type>VkBool32</type> <name>formatA4R4G4B4</name></member>
+ <member><type>VkBool32</type> <name>formatA4B4G4R4</name></member>
+ </type>
+ <type category="struct" name="VkPhysicalDeviceSubpassShadingFeaturesHUAWEI" structextends="VkPhysicalDeviceFeatures2,VkDeviceCreateInfo">
+ <member values="VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_SUBPASS_SHADING_FEATURES_HUAWEI"><type>VkStructureType</type> <name>sType</name></member>
+ <member optional="true"><type>void</type>* <name>pNext</name></member>
+ <member><type>VkBool32</type> <name>subpassShading</name></member>
+ </type>
+ <type category="struct" name="VkBufferCopy2">
+ <member values="VK_STRUCTURE_TYPE_BUFFER_COPY_2"><type>VkStructureType</type> <name>sType</name></member>
+ <member optional="true">const <type>void</type>* <name>pNext</name></member>
+ <member><type>VkDeviceSize</type> <name>srcOffset</name><comment>Specified in bytes</comment></member>
+ <member><type>VkDeviceSize</type> <name>dstOffset</name><comment>Specified in bytes</comment></member>
+ <member noautovalidity="true"><type>VkDeviceSize</type> <name>size</name><comment>Specified in bytes</comment></member>
+ </type>
+ <type category="struct" name="VkBufferCopy2KHR" alias="VkBufferCopy2"/>
+ <type category="struct" name="VkImageCopy2">
+ <member values="VK_STRUCTURE_TYPE_IMAGE_COPY_2"><type>VkStructureType</type> <name>sType</name></member>
+ <member optional="true">const <type>void</type>* <name>pNext</name></member>
+ <member><type>VkImageSubresourceLayers</type> <name>srcSubresource</name></member>
+ <member><type>VkOffset3D</type> <name>srcOffset</name><comment>Specified in pixels for both compressed and uncompressed images</comment></member>
+ <member><type>VkImageSubresourceLayers</type> <name>dstSubresource</name></member>
+ <member><type>VkOffset3D</type> <name>dstOffset</name><comment>Specified in pixels for both compressed and uncompressed images</comment></member>
+ <member><type>VkExtent3D</type> <name>extent</name><comment>Specified in pixels for both compressed and uncompressed images</comment></member>
+ </type>
+ <type category="struct" name="VkImageCopy2KHR" alias="VkImageCopy2"/>
+ <type category="struct" name="VkImageBlit2">
+ <member values="VK_STRUCTURE_TYPE_IMAGE_BLIT_2"><type>VkStructureType</type> <name>sType</name></member>
+ <member optional="true">const <type>void</type>* <name>pNext</name></member>
+ <member><type>VkImageSubresourceLayers</type> <name>srcSubresource</name></member>
+ <member><type>VkOffset3D</type> <name>srcOffsets</name>[2]<comment>Specified in pixels for both compressed and uncompressed images</comment></member>
+ <member><type>VkImageSubresourceLayers</type> <name>dstSubresource</name></member>
+ <member><type>VkOffset3D</type> <name>dstOffsets</name>[2]<comment>Specified in pixels for both compressed and uncompressed images</comment></member>
+ </type>
+ <type category="struct" name="VkImageBlit2KHR" alias="VkImageBlit2"/>
+ <type category="struct" name="VkBufferImageCopy2">
+ <member values="VK_STRUCTURE_TYPE_BUFFER_IMAGE_COPY_2"><type>VkStructureType</type> <name>sType</name></member>
+ <member optional="true">const <type>void</type>* <name>pNext</name></member>
+ <member><type>VkDeviceSize</type> <name>bufferOffset</name><comment>Specified in bytes</comment></member>
+ <member><type>uint32_t</type> <name>bufferRowLength</name><comment>Specified in texels</comment></member>
+ <member><type>uint32_t</type> <name>bufferImageHeight</name></member>
+ <member><type>VkImageSubresourceLayers</type> <name>imageSubresource</name></member>
+ <member><type>VkOffset3D</type> <name>imageOffset</name><comment>Specified in pixels for both compressed and uncompressed images</comment></member>
+ <member><type>VkExtent3D</type> <name>imageExtent</name><comment>Specified in pixels for both compressed and uncompressed images</comment></member>
+ </type>
+ <type category="struct" name="VkBufferImageCopy2KHR" alias="VkBufferImageCopy2"/>
+ <type category="struct" name="VkImageResolve2">
+ <member values="VK_STRUCTURE_TYPE_IMAGE_RESOLVE_2"><type>VkStructureType</type> <name>sType</name></member>
+ <member optional="true">const <type>void</type>* <name>pNext</name></member>
+ <member><type>VkImageSubresourceLayers</type> <name>srcSubresource</name></member>
+ <member><type>VkOffset3D</type> <name>srcOffset</name></member>
+ <member><type>VkImageSubresourceLayers</type> <name>dstSubresource</name></member>
+ <member><type>VkOffset3D</type> <name>dstOffset</name></member>
+ <member><type>VkExtent3D</type> <name>extent</name></member>
+ </type>
+ <type category="struct" name="VkImageResolve2KHR" alias="VkImageResolve2"/>
+ <type category="struct" name="VkCopyBufferInfo2">
+ <member values="VK_STRUCTURE_TYPE_COPY_BUFFER_INFO_2"><type>VkStructureType</type> <name>sType</name></member>
+ <member optional="true">const <type>void</type>* <name>pNext</name></member>
+ <member><type>VkBuffer</type> <name>srcBuffer</name></member>
+ <member><type>VkBuffer</type> <name>dstBuffer</name></member>
+ <member><type>uint32_t</type> <name>regionCount</name></member>
+ <member len="regionCount">const <type>VkBufferCopy2</type>* <name>pRegions</name></member>
+ </type>
+ <type category="struct" name="VkCopyBufferInfo2KHR" alias="VkCopyBufferInfo2"/>
+ <type category="struct" name="VkCopyImageInfo2">
+ <member values="VK_STRUCTURE_TYPE_COPY_IMAGE_INFO_2"><type>VkStructureType</type> <name>sType</name></member>
+ <member optional="true">const <type>void</type>* <name>pNext</name></member>
+ <member><type>VkImage</type> <name>srcImage</name></member>
+ <member><type>VkImageLayout</type> <name>srcImageLayout</name></member>
+ <member><type>VkImage</type> <name>dstImage</name></member>
+ <member><type>VkImageLayout</type> <name>dstImageLayout</name></member>
+ <member><type>uint32_t</type> <name>regionCount</name></member>
+ <member len="regionCount">const <type>VkImageCopy2</type>* <name>pRegions</name></member>
+ </type>
+ <type category="struct" name="VkCopyImageInfo2KHR" alias="VkCopyImageInfo2"/>
+ <type category="struct" name="VkBlitImageInfo2">
+ <member values="VK_STRUCTURE_TYPE_BLIT_IMAGE_INFO_2"><type>VkStructureType</type> <name>sType</name></member>
+ <member optional="true">const <type>void</type>* <name>pNext</name></member>
+ <member><type>VkImage</type> <name>srcImage</name></member>
+ <member><type>VkImageLayout</type> <name>srcImageLayout</name></member>
+ <member><type>VkImage</type> <name>dstImage</name></member>
+ <member><type>VkImageLayout</type> <name>dstImageLayout</name></member>
+ <member><type>uint32_t</type> <name>regionCount</name></member>
+ <member len="regionCount">const <type>VkImageBlit2</type>* <name>pRegions</name></member>
+ <member><type>VkFilter</type> <name>filter</name></member>
+ </type>
+ <type category="struct" name="VkBlitImageInfo2KHR" alias="VkBlitImageInfo2"/>
+ <type category="struct" name="VkCopyBufferToImageInfo2">
+ <member values="VK_STRUCTURE_TYPE_COPY_BUFFER_TO_IMAGE_INFO_2"><type>VkStructureType</type> <name>sType</name></member>
+ <member optional="true">const <type>void</type>* <name>pNext</name></member>
+ <member><type>VkBuffer</type> <name>srcBuffer</name></member>
+ <member><type>VkImage</type> <name>dstImage</name></member>
+ <member><type>VkImageLayout</type> <name>dstImageLayout</name></member>
+ <member><type>uint32_t</type> <name>regionCount</name></member>
+ <member len="regionCount">const <type>VkBufferImageCopy2</type>* <name>pRegions</name></member>
+ </type>
+ <type category="struct" name="VkCopyBufferToImageInfo2KHR" alias="VkCopyBufferToImageInfo2"/>
+ <type category="struct" name="VkCopyImageToBufferInfo2">
+ <member values="VK_STRUCTURE_TYPE_COPY_IMAGE_TO_BUFFER_INFO_2"><type>VkStructureType</type> <name>sType</name></member>
+ <member optional="true">const <type>void</type>* <name>pNext</name></member>
+ <member><type>VkImage</type> <name>srcImage</name></member>
+ <member><type>VkImageLayout</type> <name>srcImageLayout</name></member>
+ <member><type>VkBuffer</type> <name>dstBuffer</name></member>
+ <member><type>uint32_t</type> <name>regionCount</name></member>
+ <member len="regionCount">const <type>VkBufferImageCopy2</type>* <name>pRegions</name></member>
+ </type>
+ <type category="struct" name="VkCopyImageToBufferInfo2KHR" alias="VkCopyImageToBufferInfo2"/>
+ <type category="struct" name="VkResolveImageInfo2">
+ <member values="VK_STRUCTURE_TYPE_RESOLVE_IMAGE_INFO_2"><type>VkStructureType</type> <name>sType</name></member>
+ <member optional="true">const <type>void</type>* <name>pNext</name></member>
+ <member><type>VkImage</type> <name>srcImage</name></member>
+ <member><type>VkImageLayout</type> <name>srcImageLayout</name></member>
+ <member><type>VkImage</type> <name>dstImage</name></member>
+ <member><type>VkImageLayout</type> <name>dstImageLayout</name></member>
+ <member><type>uint32_t</type> <name>regionCount</name></member>
+ <member len="regionCount">const <type>VkImageResolve2</type>* <name>pRegions</name></member>
+ </type>
+ <type category="struct" name="VkResolveImageInfo2KHR" alias="VkResolveImageInfo2"/>
+ <type category="struct" name="VkPhysicalDeviceShaderImageAtomicInt64FeaturesEXT" structextends="VkPhysicalDeviceFeatures2,VkDeviceCreateInfo">
+ <member values="VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_SHADER_IMAGE_ATOMIC_INT64_FEATURES_EXT"><type>VkStructureType</type> <name>sType</name></member>
+ <member optional="true"><type>void</type>* <name>pNext</name></member>
+ <member><type>VkBool32</type> <name>shaderImageInt64Atomics</name></member>
+ <member><type>VkBool32</type> <name>sparseImageInt64Atomics</name></member>
+ </type>
+ <type category="struct" name="VkFragmentShadingRateAttachmentInfoKHR" structextends="VkSubpassDescription2">
+ <member values="VK_STRUCTURE_TYPE_FRAGMENT_SHADING_RATE_ATTACHMENT_INFO_KHR"><type>VkStructureType</type> <name>sType</name></member>
+ <member optional="true">const <type>void</type>* <name>pNext</name></member>
+ <member optional="true">const <type>VkAttachmentReference2</type>* <name>pFragmentShadingRateAttachment</name></member>
+ <member><type>VkExtent2D</type> <name>shadingRateAttachmentTexelSize</name></member>
+ </type>
+ <type category="struct" name="VkPipelineFragmentShadingRateStateCreateInfoKHR" structextends="VkGraphicsPipelineCreateInfo">
+ <member values="VK_STRUCTURE_TYPE_PIPELINE_FRAGMENT_SHADING_RATE_STATE_CREATE_INFO_KHR"><type>VkStructureType</type> <name>sType</name></member>
+ <member optional="true">const <type>void</type>* <name>pNext</name></member>
+ <member><type>VkExtent2D</type> <name>fragmentSize</name></member>
+ <member noautovalidity="true"><type>VkFragmentShadingRateCombinerOpKHR</type> <name>combinerOps</name>[2]</member>
+ </type>
+ <type category="struct" name="VkPhysicalDeviceFragmentShadingRateFeaturesKHR" structextends="VkPhysicalDeviceFeatures2,VkDeviceCreateInfo">
+ <member values="VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_FRAGMENT_SHADING_RATE_FEATURES_KHR"><type>VkStructureType</type> <name>sType</name></member>
+ <member optional="true"><type>void</type>* <name>pNext</name></member>
+ <member><type>VkBool32</type> <name>pipelineFragmentShadingRate</name></member>
+ <member><type>VkBool32</type> <name>primitiveFragmentShadingRate</name></member>
+ <member><type>VkBool32</type> <name>attachmentFragmentShadingRate</name></member>
+ </type>
+ <type category="struct" name="VkPhysicalDeviceFragmentShadingRatePropertiesKHR" structextends="VkPhysicalDeviceProperties2" returnedonly="true">
+ <member values="VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_FRAGMENT_SHADING_RATE_PROPERTIES_KHR"><type>VkStructureType</type> <name>sType</name></member>
+ <member optional="true"><type>void</type>* <name>pNext</name></member>
+ <member limittype="min"><type>VkExtent2D</type> <name>minFragmentShadingRateAttachmentTexelSize</name></member>
+ <member limittype="max"><type>VkExtent2D</type> <name>maxFragmentShadingRateAttachmentTexelSize</name></member>
+ <member limittype="max,pot"><type>uint32_t</type> <name>maxFragmentShadingRateAttachmentTexelSizeAspectRatio</name></member>
+ <member limittype="bitmask"><type>VkBool32</type> <name>primitiveFragmentShadingRateWithMultipleViewports</name></member>
+ <member limittype="bitmask"><type>VkBool32</type> <name>layeredShadingRateAttachments</name></member>
+ <member limittype="bitmask"><type>VkBool32</type> <name>fragmentShadingRateNonTrivialCombinerOps</name></member>
+ <member limittype="max"><type>VkExtent2D</type> <name>maxFragmentSize</name></member>
+ <member limittype="max,pot"><type>uint32_t</type> <name>maxFragmentSizeAspectRatio</name></member>
+ <member limittype="max"><type>uint32_t</type> <name>maxFragmentShadingRateCoverageSamples</name></member>
+ <member limittype="max"><type>VkSampleCountFlagBits</type> <name>maxFragmentShadingRateRasterizationSamples</name></member>
+ <member limittype="bitmask"><type>VkBool32</type> <name>fragmentShadingRateWithShaderDepthStencilWrites</name></member>
+ <member limittype="bitmask"><type>VkBool32</type> <name>fragmentShadingRateWithSampleMask</name></member>
+ <member limittype="bitmask"><type>VkBool32</type> <name>fragmentShadingRateWithShaderSampleMask</name></member>
+ <member limittype="bitmask"><type>VkBool32</type> <name>fragmentShadingRateWithConservativeRasterization</name></member>
+ <member limittype="bitmask"><type>VkBool32</type> <name>fragmentShadingRateWithFragmentShaderInterlock</name></member>
+ <member limittype="bitmask"><type>VkBool32</type> <name>fragmentShadingRateWithCustomSampleLocations</name></member>
+ <member limittype="bitmask"><type>VkBool32</type> <name>fragmentShadingRateStrictMultiplyCombiner</name></member>
+ </type>
+ <type category="struct" name="VkPhysicalDeviceFragmentShadingRateKHR" returnedonly="true">
+ <member values="VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_FRAGMENT_SHADING_RATE_KHR"><type>VkStructureType</type> <name>sType</name></member>
+ <member optional="true"><type>void</type>* <name>pNext</name></member>
+ <member><type>VkSampleCountFlags</type> <name>sampleCounts</name></member>
+ <member><type>VkExtent2D</type> <name>fragmentSize</name></member>
+ </type>
+ <type category="struct" name="VkPhysicalDeviceShaderTerminateInvocationFeatures" structextends="VkPhysicalDeviceFeatures2,VkDeviceCreateInfo">
+ <member values="VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_SHADER_TERMINATE_INVOCATION_FEATURES"><type>VkStructureType</type> <name>sType</name></member>
+ <member optional="true" noautovalidity="true"><type>void</type>* <name>pNext</name></member>
+ <member><type>VkBool32</type> <name>shaderTerminateInvocation</name></member>
+ </type>
+ <type category="struct" name="VkPhysicalDeviceShaderTerminateInvocationFeaturesKHR" alias="VkPhysicalDeviceShaderTerminateInvocationFeatures"/>
+ <type category="struct" name="VkPhysicalDeviceFragmentShadingRateEnumsFeaturesNV" structextends="VkPhysicalDeviceFeatures2,VkDeviceCreateInfo">
+ <member values="VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_FRAGMENT_SHADING_RATE_ENUMS_FEATURES_NV"><type>VkStructureType</type> <name>sType</name></member>
+ <member optional="true"><type>void</type>* <name>pNext</name></member>
+ <member><type>VkBool32</type> <name>fragmentShadingRateEnums</name></member>
+ <member><type>VkBool32</type> <name>supersampleFragmentShadingRates</name></member>
+ <member><type>VkBool32</type> <name>noInvocationFragmentShadingRates</name></member>
+ </type>
+ <type category="struct" name="VkPhysicalDeviceFragmentShadingRateEnumsPropertiesNV" structextends="VkPhysicalDeviceProperties2">
+ <member values="VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_FRAGMENT_SHADING_RATE_ENUMS_PROPERTIES_NV"><type>VkStructureType</type> <name>sType</name></member>
+ <member optional="true"><type>void</type>* <name>pNext</name></member>
+ <member limittype="max"><type>VkSampleCountFlagBits</type> <name>maxFragmentShadingRateInvocationCount</name></member>
+ </type>
+ <type category="struct" name="VkPipelineFragmentShadingRateEnumStateCreateInfoNV" structextends="VkGraphicsPipelineCreateInfo">
+ <member values="VK_STRUCTURE_TYPE_PIPELINE_FRAGMENT_SHADING_RATE_ENUM_STATE_CREATE_INFO_NV"><type>VkStructureType</type> <name>sType</name></member>
+ <member optional="true">const <type>void</type>* <name>pNext</name></member>
+ <member noautovalidity="true"><type>VkFragmentShadingRateTypeNV</type> <name>shadingRateType</name></member>
+ <member noautovalidity="true"><type>VkFragmentShadingRateNV</type> <name>shadingRate</name></member>
+ <member noautovalidity="true"><type>VkFragmentShadingRateCombinerOpKHR</type> <name>combinerOps</name>[2]</member>
+ </type>
+ <type category="struct" name="VkAccelerationStructureBuildSizesInfoKHR">
+ <member values="VK_STRUCTURE_TYPE_ACCELERATION_STRUCTURE_BUILD_SIZES_INFO_KHR"><type>VkStructureType</type> <name>sType</name></member>
+ <member optional="true">const <type>void</type>* <name>pNext</name></member>
+ <member><type>VkDeviceSize</type> <name>accelerationStructureSize</name></member>
+ <member><type>VkDeviceSize</type> <name>updateScratchSize</name></member>
+ <member><type>VkDeviceSize</type> <name>buildScratchSize</name></member>
+ </type>
+ <type category="struct" name="VkPhysicalDeviceImage2DViewOf3DFeaturesEXT" structextends="VkPhysicalDeviceFeatures2,VkDeviceCreateInfo">
+ <member values="VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_IMAGE_2D_VIEW_OF_3D_FEATURES_EXT"><type>VkStructureType</type> <name>sType</name></member>
+ <member optional="true" noautovalidity="true"><type>void</type>* <name>pNext</name></member>
+ <member><type>VkBool32</type> <name>image2DViewOf3D</name></member>
+ <member><type>VkBool32</type> <name>sampler2DViewOf3D</name></member>
+ </type>
+ <type category="struct" name="VkPhysicalDeviceMutableDescriptorTypeFeaturesVALVE" structextends="VkPhysicalDeviceFeatures2,VkDeviceCreateInfo">
+ <member values="VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_MUTABLE_DESCRIPTOR_TYPE_FEATURES_VALVE"><type>VkStructureType</type> <name>sType</name></member>
+ <member optional="true" noautovalidity="true"><type>void</type>* <name>pNext</name></member>
+ <member><type>VkBool32</type> <name>mutableDescriptorType</name></member>
+ </type>
+ <type category="struct" name="VkMutableDescriptorTypeListVALVE">
+ <member optional="true"><type>uint32_t</type> <name>descriptorTypeCount</name></member>
+ <member len="descriptorTypeCount">const <type>VkDescriptorType</type>* <name>pDescriptorTypes</name></member>
+ </type>
+ <type category="struct" name="VkMutableDescriptorTypeCreateInfoVALVE" structextends="VkDescriptorSetLayoutCreateInfo,VkDescriptorPoolCreateInfo">
+ <member values="VK_STRUCTURE_TYPE_MUTABLE_DESCRIPTOR_TYPE_CREATE_INFO_VALVE"><type>VkStructureType</type> <name>sType</name></member>
+ <member optional="true">const <type>void</type>* <name>pNext</name></member>
+ <member optional="true"><type>uint32_t</type> <name>mutableDescriptorTypeListCount</name></member>
+ <member len="mutableDescriptorTypeListCount">const <type>VkMutableDescriptorTypeListVALVE</type>* <name>pMutableDescriptorTypeLists</name></member>
+ </type>
+ <type category="struct" name="VkPhysicalDeviceDepthClipControlFeaturesEXT" structextends="VkPhysicalDeviceFeatures2,VkDeviceCreateInfo">
+ <member values="VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_DEPTH_CLIP_CONTROL_FEATURES_EXT"><type>VkStructureType</type> <name>sType</name></member>
+ <member optional="true" noautovalidity="true"><type>void</type>* <name>pNext</name></member>
+ <member><type>VkBool32</type> <name>depthClipControl</name></member>
+ </type>
+ <type category="struct" name="VkPipelineViewportDepthClipControlCreateInfoEXT" structextends="VkPipelineViewportStateCreateInfo">
+ <member values="VK_STRUCTURE_TYPE_PIPELINE_VIEWPORT_DEPTH_CLIP_CONTROL_CREATE_INFO_EXT"><type>VkStructureType</type> <name>sType</name></member>
+ <member optional="true">const <type>void</type>* <name>pNext</name></member>
+ <member><type>VkBool32</type> <name>negativeOneToOne</name></member>
+ </type>
+ <type category="struct" name="VkPhysicalDeviceVertexInputDynamicStateFeaturesEXT" structextends="VkPhysicalDeviceFeatures2,VkDeviceCreateInfo">
+ <member values="VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_VERTEX_INPUT_DYNAMIC_STATE_FEATURES_EXT"><type>VkStructureType</type> <name>sType</name></member>
+ <member optional="true" noautovalidity="true"><type>void</type>* <name>pNext</name></member>
+ <member><type>VkBool32</type> <name>vertexInputDynamicState</name></member>
+ </type>
+ <type category="struct" name="VkPhysicalDeviceExternalMemoryRDMAFeaturesNV" structextends="VkPhysicalDeviceFeatures2,VkDeviceCreateInfo">
+ <member values="VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_EXTERNAL_MEMORY_RDMA_FEATURES_NV"><type>VkStructureType</type> <name>sType</name></member>
+ <member optional="true" noautovalidity="true"><type>void</type>* <name>pNext</name></member>
+ <member><type>VkBool32</type> <name>externalMemoryRDMA</name></member>
+ </type>
+ <type category="struct" name="VkVertexInputBindingDescription2EXT">
+ <member values="VK_STRUCTURE_TYPE_VERTEX_INPUT_BINDING_DESCRIPTION_2_EXT"><type>VkStructureType</type> <name>sType</name></member>
+ <member optional="true" noautovalidity="true"><type>void</type>* <name>pNext</name></member>
+ <member><type>uint32_t</type> <name>binding</name></member>
+ <member><type>uint32_t</type> <name>stride</name></member>
+ <member><type>VkVertexInputRate</type> <name>inputRate</name></member>
+ <member><type>uint32_t</type> <name>divisor</name></member>
+ </type>
+ <type category="struct" name="VkVertexInputAttributeDescription2EXT">
+ <member values="VK_STRUCTURE_TYPE_VERTEX_INPUT_ATTRIBUTE_DESCRIPTION_2_EXT"><type>VkStructureType</type> <name>sType</name></member>
+ <member optional="true" noautovalidity="true"><type>void</type>* <name>pNext</name></member>
+ <member><type>uint32_t</type> <name>location</name><comment>location of the shader vertex attrib</comment></member>
+ <member><type>uint32_t</type> <name>binding</name><comment>Vertex buffer binding id</comment></member>
+ <member><type>VkFormat</type> <name>format</name><comment>format of source data</comment></member>
+ <member><type>uint32_t</type> <name>offset</name><comment>Offset of first element in bytes from base of vertex</comment></member>
+ </type>
+ <type category="struct" name="VkPhysicalDeviceColorWriteEnableFeaturesEXT" structextends="VkPhysicalDeviceFeatures2,VkDeviceCreateInfo">
+ <member values="VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_COLOR_WRITE_ENABLE_FEATURES_EXT"><type>VkStructureType</type> <name>sType</name></member>
+ <member optional="true"><type>void</type>* <name>pNext</name></member>
+ <member><type>VkBool32</type> <name>colorWriteEnable</name></member>
+ </type>
+ <type category="struct" name="VkPipelineColorWriteCreateInfoEXT" structextends="VkPipelineColorBlendStateCreateInfo">
+ <member values="VK_STRUCTURE_TYPE_PIPELINE_COLOR_WRITE_CREATE_INFO_EXT"><type>VkStructureType</type> <name>sType</name></member>
+ <member optional="true">const <type>void</type>* <name>pNext</name></member>
+ <member optional="true"><type>uint32_t</type> <name>attachmentCount</name><comment># of pAttachments</comment></member>
+ <member len="attachmentCount">const <type>VkBool32</type>* <name>pColorWriteEnables</name></member>
+ </type>
+ <type category="struct" name="VkMemoryBarrier2" structextends="VkSubpassDependency2">
+ <member values="VK_STRUCTURE_TYPE_MEMORY_BARRIER_2"><type>VkStructureType</type> <name>sType</name></member>
+ <member optional="true">const <type>void</type>* <name>pNext</name></member>
+ <member optional="true"><type>VkPipelineStageFlags2</type> <name>srcStageMask</name></member>
+ <member optional="true"><type>VkAccessFlags2</type> <name>srcAccessMask</name></member>
+ <member optional="true"><type>VkPipelineStageFlags2</type> <name>dstStageMask</name></member>
+ <member optional="true"><type>VkAccessFlags2</type> <name>dstAccessMask</name></member>
+ </type>
+ <type category="struct" name="VkMemoryBarrier2KHR" alias="VkMemoryBarrier2"/>
+ <type category="struct" name="VkImageMemoryBarrier2">
+ <member values="VK_STRUCTURE_TYPE_IMAGE_MEMORY_BARRIER_2"><type>VkStructureType</type> <name>sType</name></member>
+ <member optional="true">const <type>void</type>* <name>pNext</name></member>
+ <member optional="true"><type>VkPipelineStageFlags2</type> <name>srcStageMask</name></member>
+ <member optional="true"><type>VkAccessFlags2</type> <name>srcAccessMask</name></member>
+ <member optional="true"><type>VkPipelineStageFlags2</type> <name>dstStageMask</name></member>
+ <member optional="true"><type>VkAccessFlags2</type> <name>dstAccessMask</name></member>
+ <member><type>VkImageLayout</type> <name>oldLayout</name></member>
+ <member><type>VkImageLayout</type> <name>newLayout</name></member>
+ <member><type>uint32_t</type> <name>srcQueueFamilyIndex</name></member>
+ <member><type>uint32_t</type> <name>dstQueueFamilyIndex</name></member>
+ <member><type>VkImage</type> <name>image</name></member>
+ <member><type>VkImageSubresourceRange</type> <name>subresourceRange</name></member>
+ </type>
+ <type category="struct" name="VkImageMemoryBarrier2KHR" alias="VkImageMemoryBarrier2"/>
+ <type category="struct" name="VkBufferMemoryBarrier2">
+ <member values="VK_STRUCTURE_TYPE_BUFFER_MEMORY_BARRIER_2"><type>VkStructureType</type> <name>sType</name></member>
+ <member optional="true">const <type>void</type>* <name>pNext</name></member>
+ <member optional="true"><type>VkPipelineStageFlags2</type> <name>srcStageMask</name></member>
+ <member optional="true"><type>VkAccessFlags2</type> <name>srcAccessMask</name></member>
+ <member optional="true"><type>VkPipelineStageFlags2</type> <name>dstStageMask</name></member>
+ <member optional="true"><type>VkAccessFlags2</type> <name>dstAccessMask</name></member>
+ <member><type>uint32_t</type> <name>srcQueueFamilyIndex</name></member>
+ <member><type>uint32_t</type> <name>dstQueueFamilyIndex</name></member>
+ <member><type>VkBuffer</type> <name>buffer</name></member>
+ <member><type>VkDeviceSize</type> <name>offset</name></member>
+ <member><type>VkDeviceSize</type> <name>size</name></member>
+ </type>
+ <type category="struct" name="VkBufferMemoryBarrier2KHR" alias="VkBufferMemoryBarrier2"/>
+ <type category="struct" name="VkDependencyInfo">
+ <member values="VK_STRUCTURE_TYPE_DEPENDENCY_INFO"><type>VkStructureType</type> <name>sType</name></member>
+ <member optional="true">const <type>void</type>* <name>pNext</name></member>
+ <member optional="true"><type>VkDependencyFlags</type> <name>dependencyFlags</name></member>
+ <member optional="true"><type>uint32_t</type> <name>memoryBarrierCount</name></member>
+ <member len="memoryBarrierCount">const <type>VkMemoryBarrier2</type>* <name>pMemoryBarriers</name></member>
+ <member optional="true"><type>uint32_t</type> <name>bufferMemoryBarrierCount</name></member>
+ <member len="bufferMemoryBarrierCount">const <type>VkBufferMemoryBarrier2</type>* <name>pBufferMemoryBarriers</name></member>
+ <member optional="true"><type>uint32_t</type> <name>imageMemoryBarrierCount</name></member>
+ <member len="imageMemoryBarrierCount">const <type>VkImageMemoryBarrier2</type>* <name>pImageMemoryBarriers</name></member>
+ </type>
+ <type category="struct" name="VkDependencyInfoKHR" alias="VkDependencyInfo"/>
+ <type category="struct" name="VkSemaphoreSubmitInfo">
+ <member values="VK_STRUCTURE_TYPE_SEMAPHORE_SUBMIT_INFO"><type>VkStructureType</type> <name>sType</name></member>
+ <member optional="true">const <type>void</type>* <name>pNext</name></member>
+ <member><type>VkSemaphore</type> <name>semaphore</name></member>
+ <member><type>uint64_t</type> <name>value</name></member>
+ <member optional="true"><type>VkPipelineStageFlags2</type> <name>stageMask</name></member>
+ <member><type>uint32_t</type> <name>deviceIndex</name></member>
+ </type>
+ <type category="struct" name="VkSemaphoreSubmitInfoKHR" alias="VkSemaphoreSubmitInfo"/>
+ <type category="struct" name="VkCommandBufferSubmitInfo">
+ <member values="VK_STRUCTURE_TYPE_COMMAND_BUFFER_SUBMIT_INFO"><type>VkStructureType</type> <name>sType</name></member>
+ <member optional="true">const <type>void</type>* <name>pNext</name></member>
+ <member><type>VkCommandBuffer</type> <name>commandBuffer</name></member>
+ <member><type>uint32_t</type> <name>deviceMask</name></member>
+ </type>
+ <type category="struct" name="VkCommandBufferSubmitInfoKHR" alias="VkCommandBufferSubmitInfo"/>
+ <type category="struct" name="VkSubmitInfo2">
+ <member values="VK_STRUCTURE_TYPE_SUBMIT_INFO_2"><type>VkStructureType</type> <name>sType</name></member>
+ <member optional="true">const <type>void</type>* <name>pNext</name></member>
+ <member optional="true"><type>VkSubmitFlags</type> <name>flags</name></member>
+ <member optional="true"><type>uint32_t</type> <name>waitSemaphoreInfoCount</name></member>
+ <member len="waitSemaphoreInfoCount">const <type>VkSemaphoreSubmitInfo</type>* <name>pWaitSemaphoreInfos</name></member>
+ <member optional="true"><type>uint32_t</type> <name>commandBufferInfoCount</name></member>
+ <member len="commandBufferInfoCount">const <type>VkCommandBufferSubmitInfo</type>* <name>pCommandBufferInfos</name></member>
+ <member optional="true"><type>uint32_t</type> <name>signalSemaphoreInfoCount</name></member>
+ <member len="signalSemaphoreInfoCount">const <type>VkSemaphoreSubmitInfo</type>* <name>pSignalSemaphoreInfos</name></member>
+ </type>
+ <type category="struct" name="VkSubmitInfo2KHR" alias="VkSubmitInfo2"/>
+ <type category="struct" name="VkQueueFamilyCheckpointProperties2NV" structextends="VkQueueFamilyProperties2" returnedonly="true">
+ <member values="VK_STRUCTURE_TYPE_QUEUE_FAMILY_CHECKPOINT_PROPERTIES_2_NV"><type>VkStructureType</type> <name>sType</name></member>
+ <member optional="true"><type>void</type>* <name>pNext</name></member>
+ <member limittype="bitmask"><type>VkPipelineStageFlags2</type> <name>checkpointExecutionStageMask</name></member>
+ </type>
+ <type category="struct" name="VkCheckpointData2NV" returnedonly="true">
+ <member values="VK_STRUCTURE_TYPE_CHECKPOINT_DATA_2_NV"><type>VkStructureType</type> <name>sType</name></member>
+ <member optional="true"><type>void</type>* <name>pNext</name></member>
+ <member><type>VkPipelineStageFlags2</type> <name>stage</name></member>
+ <member noautovalidity="true"><type>void</type>* <name>pCheckpointMarker</name></member>
+ </type>
+ <type category="struct" name="VkPhysicalDeviceSynchronization2Features" structextends="VkPhysicalDeviceFeatures2,VkDeviceCreateInfo">
+ <member values="VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_SYNCHRONIZATION_2_FEATURES"><type>VkStructureType</type> <name>sType</name></member>
+ <member optional="true" noautovalidity="true"><type>void</type>* <name>pNext</name></member>
+ <member><type>VkBool32</type> <name>synchronization2</name></member>
+ </type>
+ <type category="struct" name="VkPhysicalDeviceSynchronization2FeaturesKHR" alias="VkPhysicalDeviceSynchronization2Features"/>
+ <type category="struct" name="VkPhysicalDevicePrimitivesGeneratedQueryFeaturesEXT" structextends="VkPhysicalDeviceFeatures2,VkDeviceCreateInfo">
+ <member values="VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_PRIMITIVES_GENERATED_QUERY_FEATURES_EXT"><type>VkStructureType</type> <name>sType</name></member>
+ <member optional="true"><type>void</type>* <name>pNext</name></member>
+ <member><type>VkBool32</type> <name>primitivesGeneratedQuery</name></member>
+ <member><type>VkBool32</type> <name>primitivesGeneratedQueryWithRasterizerDiscard</name></member>
+ <member><type>VkBool32</type> <name>primitivesGeneratedQueryWithNonZeroStreams</name></member>
+ </type>
+ <type category="struct" name="VkPhysicalDeviceMultisampledRenderToSingleSampledFeaturesEXT" structextends="VkPhysicalDeviceFeatures2,VkDeviceCreateInfo">
+ <member values="VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_MULTISAMPLED_RENDER_TO_SINGLE_SAMPLED_FEATURES_EXT"><type>VkStructureType</type> <name>sType</name></member>
+ <member optional="true"><type>void</type>* <name>pNext</name></member>
+ <member><type>VkBool32</type> <name>multisampledRenderToSingleSampled</name></member>
+ </type>
+ <type category="struct" name="VkSubpassResolvePerformanceQueryEXT" returnedonly="true" structextends="VkFormatProperties2">
+ <member values="VK_STRUCTURE_TYPE_SUBPASS_RESOLVE_PERFORMANCE_QUERY_EXT"><type>VkStructureType</type> <name>sType</name></member>
+ <member optional="true"><type>void</type>* <name>pNext</name></member>
+ <member><type>VkBool32</type> <name>optimal</name></member>
+ </type>
+ <type category="struct" name="VkMultisampledRenderToSingleSampledInfoEXT" structextends="VkSubpassDescription2,VkRenderingInfo">
+ <member values="VK_STRUCTURE_TYPE_MULTISAMPLED_RENDER_TO_SINGLE_SAMPLED_INFO_EXT"><type>VkStructureType</type> <name>sType</name></member>
+ <member optional="true">const <type>void</type>* <name>pNext</name></member>
+ <member><type>VkBool32</type> <name>multisampledRenderToSingleSampledEnable</name></member>
+ <member><type>VkSampleCountFlagBits</type> <name>rasterizationSamples</name></member>
+ </type>
+ <type category="struct" name="VkVideoQueueFamilyProperties2KHR" structextends="VkQueueFamilyProperties2">
+ <member values="VK_STRUCTURE_TYPE_VIDEO_QUEUE_FAMILY_PROPERTIES_2_KHR"><type>VkStructureType</type> <name>sType</name></member>
+ <member optional="true"><type>void</type>* <name>pNext</name></member>
+ <member limittype="bitmask"><type>VkVideoCodecOperationFlagsKHR</type> <name>videoCodecOperations</name></member>
+ </type>
+ <type category="struct" name="VkQueueFamilyQueryResultStatusProperties2KHR" structextends="VkQueueFamilyProperties2">
+ <member values="VK_STRUCTURE_TYPE_QUEUE_FAMILY_QUERY_RESULT_STATUS_PROPERTIES_2_KHR"><type>VkStructureType</type> <name>sType</name></member>
+ <member optional="true"><type>void</type>* <name>pNext</name></member>
+ <member><type>VkBool32</type> <name>queryResultStatusSupport</name></member>
+ </type>
+ <type category="struct" name="VkVideoProfilesKHR" structextends="VkPhysicalDeviceImageFormatInfo2,VkPhysicalDeviceVideoFormatInfoKHR,VkImageCreateInfo,VkBufferCreateInfo">
+ <member values="VK_STRUCTURE_TYPE_VIDEO_PROFILES_KHR"><type>VkStructureType</type> <name>sType</name></member>
+ <member optional="true">const <type>void</type>* <name>pNext</name></member>
+ <member optional="true"><type>uint32_t</type> <name>profileCount</name></member>
+ <member len="profileCount">const <type>VkVideoProfileKHR</type>* <name>pProfiles</name></member>
+ </type>
+ <type category="struct" name="VkPhysicalDeviceVideoFormatInfoKHR">
+ <member values="VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_VIDEO_FORMAT_INFO_KHR"> <type>VkStructureType</type> <name>sType</name></member>
+ <member optional="true"><type>void</type>* <name>pNext</name></member>
+ <member><type>VkImageUsageFlags</type> <name>imageUsage</name></member>
+ </type>
+ <type category="struct" name="VkVideoFormatPropertiesKHR" returnedonly="true">
+ <member values="VK_STRUCTURE_TYPE_VIDEO_FORMAT_PROPERTIES_KHR"><type>VkStructureType</type> <name>sType</name></member>
+ <member optional="true"><type>void</type>* <name>pNext</name></member>
+ <member><type>VkFormat</type> <name>format</name></member>
+ <member><type>VkComponentMapping</type> <name>componentMapping</name></member>
+ <member><type>VkImageCreateFlags</type> <name>imageCreateFlags</name></member>
+ <member><type>VkImageType</type> <name>imageType</name></member>
+ <member><type>VkImageTiling</type> <name>imageTiling</name></member>
+ <member><type>VkImageUsageFlags</type> <name>imageUsageFlags</name></member>
+ </type>
+ <type category="struct" name="VkVideoProfileKHR" structextends="VkQueryPoolCreateInfo">
+ <member values="VK_STRUCTURE_TYPE_VIDEO_PROFILE_KHR"><type>VkStructureType</type> <name>sType</name></member>
+ <member optional="true">const <type>void</type>* <name>pNext</name></member>
+ <member><type>VkVideoCodecOperationFlagBitsKHR</type> <name>videoCodecOperation</name></member>
+ <member><type>VkVideoChromaSubsamplingFlagsKHR</type> <name>chromaSubsampling</name></member>
+ <member><type>VkVideoComponentBitDepthFlagsKHR</type> <name>lumaBitDepth</name></member>
+ <member><type>VkVideoComponentBitDepthFlagsKHR</type> <name>chromaBitDepth</name></member>
+ </type>
+ <type category="struct" name="VkVideoCapabilitiesKHR" returnedonly="true">
+ <member values="VK_STRUCTURE_TYPE_VIDEO_CAPABILITIES_KHR"><type>VkStructureType</type> <name>sType</name></member>
+ <member optional="true"><type>void</type>* <name>pNext</name></member>
+ <member><type>VkVideoCapabilityFlagsKHR</type> <name>capabilityFlags</name></member>
+ <member><type>VkDeviceSize</type> <name>minBitstreamBufferOffsetAlignment</name></member>
+ <member><type>VkDeviceSize</type> <name>minBitstreamBufferSizeAlignment</name></member>
+ <member><type>VkExtent2D</type> <name>videoPictureExtentGranularity</name></member>
+ <member><type>VkExtent2D</type> <name>minExtent</name></member>
+ <member><type>VkExtent2D</type> <name>maxExtent</name></member>
+ <member><type>uint32_t</type> <name>maxReferencePicturesSlotsCount</name></member>
+ <member><type>uint32_t</type> <name>maxReferencePicturesActiveCount</name></member>
+ <member><type>VkExtensionProperties</type> <name>stdHeaderVersion</name></member>
+ </type>
+ <type category="struct" name="VkVideoGetMemoryPropertiesKHR">
+ <member values="VK_STRUCTURE_TYPE_VIDEO_GET_MEMORY_PROPERTIES_KHR"><type>VkStructureType</type> <name>sType</name></member>
+ <member optional="true">const <type>void</type>* <name>pNext</name></member>
+ <member><type>uint32_t</type> <name>memoryBindIndex</name></member>
+ <member><type>VkMemoryRequirements2</type>* <name>pMemoryRequirements</name></member>
+ </type>
+ <type category="struct" name="VkVideoBindMemoryKHR">
+ <member values="VK_STRUCTURE_TYPE_VIDEO_BIND_MEMORY_KHR"><type>VkStructureType</type> <name>sType</name></member>
+ <member optional="true">const <type>void</type>* <name>pNext</name></member>
+ <member><type>uint32_t</type> <name>memoryBindIndex</name></member>
+ <member><type>VkDeviceMemory</type> <name>memory</name></member>
+ <member><type>VkDeviceSize</type> <name>memoryOffset</name></member>
+ <member><type>VkDeviceSize</type> <name>memorySize</name></member>
+ </type>
+ <type category="struct" name="VkVideoPictureResourceKHR">
+ <member values="VK_STRUCTURE_TYPE_VIDEO_PICTURE_RESOURCE_KHR"><type>VkStructureType</type> <name>sType</name></member>
+ <member optional="true">const <type>void</type>* <name>pNext</name></member>
+ <member><type>VkOffset2D</type> <name>codedOffset</name><comment>The offset to be used for the picture resource, currently only used in field mode</comment></member>
+ <member><type>VkExtent2D</type> <name>codedExtent</name><comment>The extent to be used for the picture resource</comment></member>
+ <member><type>uint32_t</type> <name>baseArrayLayer</name><comment>The first array layer to be accessed for the Decode or Encode Operations</comment></member>
+ <member><type>VkImageView</type> <name>imageViewBinding</name><comment>The ImageView binding of the resource</comment></member>
+ </type>
+ <type category="struct" name="VkVideoReferenceSlotKHR">
+ <member values="VK_STRUCTURE_TYPE_VIDEO_REFERENCE_SLOT_KHR"><type>VkStructureType</type> <name>sType</name></member>
+ <member optional="true">const <type>void</type>* <name>pNext</name></member>
+ <member><type>int8_t</type> <name>slotIndex</name><comment>The reference slot index</comment></member>
+ <member>const <type>VkVideoPictureResourceKHR</type>* <name>pPictureResource</name><comment>The reference picture resource</comment></member>
+ </type>
+ <type category="struct" name="VkVideoDecodeCapabilitiesKHR" returnedonly="true" structextends="VkVideoCapabilitiesKHR">
+ <member values="VK_STRUCTURE_TYPE_VIDEO_DECODE_CAPABILITIES_KHR"><type>VkStructureType</type> <name>sType</name></member>
+ <member optional="true"><type>void</type>* <name>pNext</name></member>
+ <member noautovalidity="true"><type>VkVideoDecodeCapabilityFlagsKHR</type> <name>flags</name></member>
+ </type>
+ <type category="struct" name="VkVideoDecodeInfoKHR">
+ <member values="VK_STRUCTURE_TYPE_VIDEO_DECODE_INFO_KHR"><type>VkStructureType</type> <name>sType</name></member>
+ <member optional="true">const <type>void</type>* <name>pNext</name></member>
+ <member optional="true"><type>VkVideoDecodeFlagsKHR</type> <name>flags</name></member>
+ <member><type>VkBuffer</type> <name>srcBuffer</name></member>
+ <member><type>VkDeviceSize</type> <name>srcBufferOffset</name></member>
+ <member><type>VkDeviceSize</type> <name>srcBufferRange</name></member>
+ <member><type>VkVideoPictureResourceKHR</type> <name>dstPictureResource</name></member>
+ <member>const <type>VkVideoReferenceSlotKHR</type>* <name>pSetupReferenceSlot</name></member>
+ <member optional="true"><type>uint32_t</type> <name>referenceSlotCount</name></member>
+ <member len="referenceSlotCount">const <type>VkVideoReferenceSlotKHR</type>* <name>pReferenceSlots</name></member>
+ </type>
+ <comment>Video Decode Codec Standard specific structures</comment>
+ <type category="include" name="vk_video/vulkan_video_codec_h264std.h">#include "vk_video/vulkan_video_codec_h264std.h"</type>
+ <type requires="vk_video/vulkan_video_codec_h264std.h" name="StdVideoH264ProfileIdc"/>
+ <type requires="vk_video/vulkan_video_codec_h264std.h" name="StdVideoH264Level"/>
+ <type requires="vk_video/vulkan_video_codec_h264std.h" name="StdVideoH264ChromaFormatIdc"/>
+ <type requires="vk_video/vulkan_video_codec_h264std.h" name="StdVideoH264PocType"/>
+ <type requires="vk_video/vulkan_video_codec_h264std.h" name="StdVideoH264SpsFlags"/>
+ <type requires="vk_video/vulkan_video_codec_h264std.h" name="StdVideoH264ScalingLists"/>
+ <type requires="vk_video/vulkan_video_codec_h264std.h" name="StdVideoH264SequenceParameterSetVui"/>
+ <type requires="vk_video/vulkan_video_codec_h264std.h" name="StdVideoH264AspectRatioIdc"/>
+ <type requires="vk_video/vulkan_video_codec_h264std.h" name="StdVideoH264HrdParameters"/>
+ <type requires="vk_video/vulkan_video_codec_h264std.h" name="StdVideoH264SpsVuiFlags"/>
+ <type requires="vk_video/vulkan_video_codec_h264std.h" name="StdVideoH264WeightedBipredIdc"/>
+ <type requires="vk_video/vulkan_video_codec_h264std.h" name="StdVideoH264PpsFlags"/>
+ <type requires="vk_video/vulkan_video_codec_h264std.h" name="StdVideoH264SliceType"/>
+ <type requires="vk_video/vulkan_video_codec_h264std.h" name="StdVideoH264CabacInitIdc"/>
+ <type requires="vk_video/vulkan_video_codec_h264std.h" name="StdVideoH264DisableDeblockingFilterIdc"/>
+ <type requires="vk_video/vulkan_video_codec_h264std.h" name="StdVideoH264PictureType"/>
+ <type requires="vk_video/vulkan_video_codec_h264std.h" name="StdVideoH264ModificationOfPicNumsIdc"/>
+ <type requires="vk_video/vulkan_video_codec_h264std.h" name="StdVideoH264MemMgmtControlOp"/>
+ <type category="include" name="vk_video/vulkan_video_codec_h264std_decode.h">#include "vk_video/vulkan_video_codec_h264std_decode.h"</type>
+ <type requires="vk_video/vulkan_video_codec_h264std_decode.h" name="StdVideoDecodeH264PictureInfo"/>
+ <type requires="vk_video/vulkan_video_codec_h264std_decode.h" name="StdVideoDecodeH264ReferenceInfo"/>
+ <type requires="vk_video/vulkan_video_codec_h264std_decode.h" name="StdVideoDecodeH264Mvc"/>
+ <type requires="vk_video/vulkan_video_codec_h264std_decode.h" name="StdVideoDecodeH264PictureInfoFlags"/>
+ <type requires="vk_video/vulkan_video_codec_h264std_decode.h" name="StdVideoDecodeH264ReferenceInfoFlags"/>
+ <type requires="vk_video/vulkan_video_codec_h264std_decode.h" name="StdVideoDecodeH264MvcElement"/>
+ <type requires="vk_video/vulkan_video_codec_h264std_decode.h" name="StdVideoDecodeH264MvcElementFlags"/>
+ <type category="struct" name="VkVideoDecodeH264ProfileEXT" structextends="VkVideoProfileKHR,VkQueryPoolCreateInfo">
+ <member values="VK_STRUCTURE_TYPE_VIDEO_DECODE_H264_PROFILE_EXT"><type>VkStructureType</type> <name>sType</name></member>
+ <member optional="true">const <type>void</type>* <name>pNext</name></member>
+ <member><type>StdVideoH264ProfileIdc</type> <name>stdProfileIdc</name></member>
+ <member noautovalidity="true"><type>VkVideoDecodeH264PictureLayoutFlagsEXT</type> <name>pictureLayout</name></member>
+ </type>
+ <type category="struct" name="VkVideoDecodeH264CapabilitiesEXT" returnedonly="true" structextends="VkVideoDecodeCapabilitiesKHR">
+ <member values="VK_STRUCTURE_TYPE_VIDEO_DECODE_H264_CAPABILITIES_EXT"><type>VkStructureType</type> <name>sType</name></member>
+ <member optional="true"><type>void</type>* <name>pNext</name></member>
+ <member><type>StdVideoH264Level</type> <name>maxLevel</name></member>
+ <member><type>VkOffset2D</type> <name>fieldOffsetGranularity</name></member>
+ </type>
+ <type requires="vk_video/vulkan_video_codec_h264std.h" name="StdVideoH264SequenceParameterSet"/>
+ <type requires="vk_video/vulkan_video_codec_h264std.h" name="StdVideoH264PictureParameterSet"/>
+ <type category="struct" name="VkVideoDecodeH264SessionParametersAddInfoEXT" structextends="VkVideoSessionParametersUpdateInfoKHR">
+ <member values="VK_STRUCTURE_TYPE_VIDEO_DECODE_H264_SESSION_PARAMETERS_ADD_INFO_EXT"><type>VkStructureType</type> <name>sType</name></member>
+ <member optional="true">const <type>void</type>* <name>pNext</name></member>
+ <member><type>uint32_t</type> <name>spsStdCount</name></member>
+ <member len="spsStdCount" optional="true">const <type>StdVideoH264SequenceParameterSet</type>* <name>pSpsStd</name></member>
+ <member><type>uint32_t</type> <name>ppsStdCount</name></member>
+ <member len="ppsStdCount" optional="true">const <type>StdVideoH264PictureParameterSet</type>* <name>pPpsStd</name><comment>List of Picture Parameters associated with the spsStd, above</comment></member>
+ </type>
+ <type category="struct" name="VkVideoDecodeH264SessionParametersCreateInfoEXT" structextends="VkVideoSessionParametersCreateInfoKHR">
+ <member values="VK_STRUCTURE_TYPE_VIDEO_DECODE_H264_SESSION_PARAMETERS_CREATE_INFO_EXT"><type>VkStructureType</type> <name>sType</name></member>
+ <member optional="true">const <type>void</type>* <name>pNext</name></member>
+ <member><type>uint32_t</type> <name>maxSpsStdCount</name></member>
+ <member><type>uint32_t</type> <name>maxPpsStdCount</name></member>
+ <member optional="true">const <type>VkVideoDecodeH264SessionParametersAddInfoEXT</type>* <name>pParametersAddInfo</name></member>
+ </type>
+ <type category="struct" name="VkVideoDecodeH264PictureInfoEXT" structextends="VkVideoDecodeInfoKHR">
+ <member values="VK_STRUCTURE_TYPE_VIDEO_DECODE_H264_PICTURE_INFO_EXT"><type>VkStructureType</type> <name>sType</name></member>
+ <member optional="true" noautovalidity="true">const <type>void</type>* <name>pNext</name></member>
+ <member>const <type>StdVideoDecodeH264PictureInfo</type>* <name>pStdPictureInfo</name></member>
+ <member><type>uint32_t</type> <name>slicesCount</name></member>
+ <member len="slicesCount">const <type>uint32_t</type>* <name>pSlicesDataOffsets</name></member>
+ </type>
+ <type category="struct" name="VkVideoDecodeH264DpbSlotInfoEXT" structextends="VkVideoReferenceSlotKHR">
+ <member values="VK_STRUCTURE_TYPE_VIDEO_DECODE_H264_DPB_SLOT_INFO_EXT"><type>VkStructureType</type> <name>sType</name></member>
+ <member optional="true">const <type>void</type>* <name>pNext</name></member>
+ <member>const <type>StdVideoDecodeH264ReferenceInfo</type>* <name>pStdReferenceInfo</name></member>
+ </type>
+ <type category="struct" name="VkVideoDecodeH264MvcEXT" structextends="VkVideoDecodeH264PictureInfoEXT">
+ <member values="VK_STRUCTURE_TYPE_VIDEO_DECODE_H264_MVC_EXT"><type>VkStructureType</type> <name>sType</name></member>
+ <member optional="true" noautovalidity="true">const <type>void</type>*<name>pNext</name></member>
+ <member>const <type>StdVideoDecodeH264Mvc</type>* <name>pStdMvc</name></member>
+ </type>
+ <type category="include" name="vk_video/vulkan_video_codec_h265std.h">#include "vk_video/vulkan_video_codec_h265std.h"</type>
+ <type requires="vk_video/vulkan_video_codec_h265std.h" name="StdVideoH265ProfileIdc"/>
+ <type requires="vk_video/vulkan_video_codec_h265std.h" name="StdVideoH265VideoParameterSet"/>
+ <type requires="vk_video/vulkan_video_codec_h265std.h" name="StdVideoH265SequenceParameterSet"/>
+ <type requires="vk_video/vulkan_video_codec_h265std.h" name="StdVideoH265PictureParameterSet"/>
+ <type requires="vk_video/vulkan_video_codec_h265std.h" name="StdVideoH265DecPicBufMgr"/>
+ <type requires="vk_video/vulkan_video_codec_h265std.h" name="StdVideoH265HrdParameters"/>
+ <type requires="vk_video/vulkan_video_codec_h265std.h" name="StdVideoH265VpsFlags"/>
+ <type requires="vk_video/vulkan_video_codec_h265std.h" name="StdVideoH265Level"/>
+ <type requires="vk_video/vulkan_video_codec_h265std.h" name="StdVideoH265SpsFlags"/>
+ <type requires="vk_video/vulkan_video_codec_h265std.h" name="StdVideoH265ScalingLists"/>
+ <type requires="vk_video/vulkan_video_codec_h265std.h" name="StdVideoH265SequenceParameterSetVui"/>
+ <type requires="vk_video/vulkan_video_codec_h265std.h" name="StdVideoH265PredictorPaletteEntries"/>
+ <type requires="vk_video/vulkan_video_codec_h265std.h" name="StdVideoH265PpsFlags"/>
+ <type requires="vk_video/vulkan_video_codec_h265std.h" name="StdVideoH265SubLayerHrdParameters"/>
+ <type requires="vk_video/vulkan_video_codec_h265std.h" name="StdVideoH265HrdFlags"/>
+ <type requires="vk_video/vulkan_video_codec_h265std.h" name="StdVideoH265SpsVuiFlags"/>
+ <type requires="vk_video/vulkan_video_codec_h265std.h" name="StdVideoH265SliceType"/>
+ <type requires="vk_video/vulkan_video_codec_h265std.h" name="StdVideoH265PictureType"/>
+ <type category="include" name="vk_video/vulkan_video_codec_h265std_decode.h">#include "vk_video/vulkan_video_codec_h265std_decode.h"</type>
+ <type requires="vk_video/vulkan_video_codec_h265std_decode.h" name="StdVideoDecodeH265PictureInfo"/>
+ <type requires="vk_video/vulkan_video_codec_h265std_decode.h" name="StdVideoDecodeH265ReferenceInfo"/>
+ <type requires="vk_video/vulkan_video_codec_h265std_decode.h" name="StdVideoDecodeH265PictureInfoFlags"/>
+ <type requires="vk_video/vulkan_video_codec_h265std_decode.h" name="StdVideoDecodeH265ReferenceInfoFlags"/>
+ <type category="struct" name="VkVideoDecodeH265ProfileEXT" structextends="VkVideoProfileKHR,VkQueryPoolCreateInfo">
+ <member values="VK_STRUCTURE_TYPE_VIDEO_DECODE_H265_PROFILE_EXT"><type>VkStructureType</type> <name>sType</name></member>
+ <member optional="true">const <type>void</type>* <name>pNext</name></member>
+ <member><type>StdVideoH265ProfileIdc</type> <name>stdProfileIdc</name></member>
+ </type>
+ <type category="struct" name="VkVideoDecodeH265CapabilitiesEXT" returnedonly="true" structextends="VkVideoDecodeCapabilitiesKHR">
+ <member values="VK_STRUCTURE_TYPE_VIDEO_DECODE_H265_CAPABILITIES_EXT"><type>VkStructureType</type> <name>sType</name></member>
+ <member optional="true"><type>void</type>* <name>pNext</name></member>
+ <member><type>StdVideoH265Level</type> <name>maxLevel</name></member>
+ </type>
+ <type category="struct" name="VkVideoDecodeH265SessionParametersAddInfoEXT" structextends="VkVideoSessionParametersUpdateInfoKHR">
+ <member values="VK_STRUCTURE_TYPE_VIDEO_DECODE_H265_SESSION_PARAMETERS_ADD_INFO_EXT"><type>VkStructureType</type> <name>sType</name></member>
+ <member optional="true">const <type>void</type>* <name>pNext</name></member>
+ <member><type>uint32_t</type> <name>vpsStdCount</name></member>
+ <member len="vpsStdCount" optional="true">const <type>StdVideoH265VideoParameterSet</type>* <name>pVpsStd</name></member>
+ <member><type>uint32_t</type> <name>spsStdCount</name></member>
+ <member len="spsStdCount" optional="true">const <type>StdVideoH265SequenceParameterSet</type>* <name>pSpsStd</name></member>
+ <member><type>uint32_t</type> <name>ppsStdCount</name></member>
+ <member len="ppsStdCount" optional="true">const <type>StdVideoH265PictureParameterSet</type>* <name>pPpsStd</name><comment>List of Picture Parameters associated with the spsStd, above</comment></member>
+ </type>
+ <type category="struct" name="VkVideoDecodeH265SessionParametersCreateInfoEXT" structextends="VkVideoSessionParametersCreateInfoKHR">
+ <member values="VK_STRUCTURE_TYPE_VIDEO_DECODE_H265_SESSION_PARAMETERS_CREATE_INFO_EXT"><type>VkStructureType</type> <name>sType</name></member>
+ <member optional="true">const <type>void</type>* <name>pNext</name></member>
+ <member><type>uint32_t</type> <name>maxVpsStdCount</name></member>
+ <member><type>uint32_t</type> <name>maxSpsStdCount</name></member>
+ <member><type>uint32_t</type> <name>maxPpsStdCount</name></member>
+ <member optional="true">const <type>VkVideoDecodeH265SessionParametersAddInfoEXT</type>* <name>pParametersAddInfo</name></member>
+ </type>
+ <type category="struct" name="VkVideoDecodeH265PictureInfoEXT" structextends="VkVideoDecodeInfoKHR">
+ <member values="VK_STRUCTURE_TYPE_VIDEO_DECODE_H265_PICTURE_INFO_EXT"><type>VkStructureType</type> <name>sType</name></member>
+ <member optional="true">const <type>void</type>* <name>pNext</name></member>
+ <member><type>StdVideoDecodeH265PictureInfo</type>* <name>pStdPictureInfo</name></member>
+ <member><type>uint32_t</type> <name>slicesCount</name></member>
+ <member len="slicesCount">const <type>uint32_t</type>* <name>pSlicesDataOffsets</name></member>
+ </type>
+ <type category="struct" name="VkVideoDecodeH265DpbSlotInfoEXT" structextends="VkVideoReferenceSlotKHR">
+ <member values="VK_STRUCTURE_TYPE_VIDEO_DECODE_H265_DPB_SLOT_INFO_EXT"><type>VkStructureType</type> <name>sType</name></member>
+ <member optional="true">const <type>void</type>* <name>pNext</name></member>
+ <member>const <type>StdVideoDecodeH265ReferenceInfo</type>* <name>pStdReferenceInfo</name></member>
+ </type>
+ <type category="struct" name="VkVideoSessionCreateInfoKHR">
+ <member values="VK_STRUCTURE_TYPE_VIDEO_SESSION_CREATE_INFO_KHR"><type>VkStructureType</type> <name>sType</name></member>
+ <member optional="true">const <type>void</type>* <name>pNext</name></member>
+ <member><type>uint32_t</type> <name>queueFamilyIndex</name></member>
+ <member optional="true"><type>VkVideoSessionCreateFlagsKHR</type> <name>flags</name></member>
+ <member>const <type>VkVideoProfileKHR</type>* <name>pVideoProfile</name></member>
+ <member><type>VkFormat</type> <name>pictureFormat</name></member>
+ <member><type>VkExtent2D</type> <name>maxCodedExtent</name></member>
+ <member><type>VkFormat</type> <name>referencePicturesFormat</name></member>
+ <member><type>uint32_t</type> <name>maxReferencePicturesSlotsCount</name></member>
+ <member><type>uint32_t</type> <name>maxReferencePicturesActiveCount</name></member>
+ <member>const <type>VkExtensionProperties</type>* <name>pStdHeaderVersion</name></member>
+ </type>
+ <type category="struct" name="VkVideoSessionParametersCreateInfoKHR">
+ <member values="VK_STRUCTURE_TYPE_VIDEO_SESSION_PARAMETERS_CREATE_INFO_KHR"><type>VkStructureType</type> <name>sType</name></member>
+ <member optional="true">const <type>void</type>* <name>pNext</name></member>
+ <member optional="true"><type>VkVideoSessionParametersKHR</type> <name>videoSessionParametersTemplate</name></member>
+ <member><type>VkVideoSessionKHR</type> <name>videoSession</name></member>
+ </type>
+ <type category="struct" name="VkVideoSessionParametersUpdateInfoKHR">
+ <member values="VK_STRUCTURE_TYPE_VIDEO_SESSION_PARAMETERS_UPDATE_INFO_KHR"><type>VkStructureType</type> <name>sType</name></member>
+ <member optional="true">const <type>void</type>* <name>pNext</name></member>
+ <member><type>uint32_t</type> <name>updateSequenceCount</name></member>
+ </type>
+ <type category="struct" name="VkVideoBeginCodingInfoKHR">
+ <member values="VK_STRUCTURE_TYPE_VIDEO_BEGIN_CODING_INFO_KHR"><type>VkStructureType</type> <name>sType</name></member>
+ <member optional="true">const <type>void</type>* <name>pNext</name></member>
+ <member optional="true"><type>VkVideoBeginCodingFlagsKHR</type> <name>flags</name></member>
+ <member><type>VkVideoCodingQualityPresetFlagsKHR</type> <name>codecQualityPreset</name></member>
+ <member><type>VkVideoSessionKHR</type> <name>videoSession</name></member>
+ <member optional="true"><type>VkVideoSessionParametersKHR</type> <name>videoSessionParameters</name></member>
+ <member optional="true"><type>uint32_t</type> <name>referenceSlotCount</name></member>
+ <member len="referenceSlotCount">const <type>VkVideoReferenceSlotKHR</type>* <name>pReferenceSlots</name></member>
+ </type>
+ <type category="struct" name="VkVideoEndCodingInfoKHR">
+ <member values="VK_STRUCTURE_TYPE_VIDEO_END_CODING_INFO_KHR"><type>VkStructureType</type> <name>sType</name></member>
+ <member optional="true">const <type>void</type>* <name>pNext</name></member>
+ <member optional="true"><type>VkVideoEndCodingFlagsKHR</type> <name>flags</name></member>
+ </type>
+ <type category="struct" name="VkVideoCodingControlInfoKHR">
+ <member values="VK_STRUCTURE_TYPE_VIDEO_CODING_CONTROL_INFO_KHR"><type>VkStructureType</type> <name>sType</name></member>
+ <member optional="true">const <type>void</type>* <name>pNext</name></member>
+ <member optional="true"><type>VkVideoCodingControlFlagsKHR</type> <name>flags</name></member>
+ </type>
+ <type category="struct" name="VkVideoEncodeInfoKHR">
+ <member values="VK_STRUCTURE_TYPE_VIDEO_ENCODE_INFO_KHR"><type>VkStructureType</type> <name>sType</name></member>
+ <member optional="true">const <type>void</type>* <name>pNext</name></member>
+ <member optional="true"><type>VkVideoEncodeFlagsKHR</type> <name>flags</name></member>
+ <member><type>uint32_t</type> <name>qualityLevel</name></member>
+ <member><type>VkBuffer</type> <name>dstBitstreamBuffer</name></member>
+ <member><type>VkDeviceSize</type> <name>dstBitstreamBufferOffset</name></member>
+ <member><type>VkDeviceSize</type> <name>dstBitstreamBufferMaxRange</name></member>
+ <member><type>VkVideoPictureResourceKHR</type> <name>srcPictureResource</name></member>
+ <member>const <type>VkVideoReferenceSlotKHR</type>* <name>pSetupReferenceSlot</name></member>
+ <member optional="true"><type>uint32_t</type> <name>referenceSlotCount</name></member>
+ <member len="referenceSlotCount">const <type>VkVideoReferenceSlotKHR</type>* <name>pReferenceSlots</name></member>
+ <member><type>uint32_t</type> <name>precedingExternallyEncodedBytes</name></member>
+ </type>
+ <type category="struct" name="VkVideoEncodeRateControlInfoKHR" structextends="VkVideoCodingControlInfoKHR">
+ <member values="VK_STRUCTURE_TYPE_VIDEO_ENCODE_RATE_CONTROL_INFO_KHR"><type>VkStructureType</type> <name>sType</name></member>
+ <member optional="true">const <type>void</type>* <name>pNext</name></member>
+ <member noautovalidity="true"><type>VkVideoEncodeRateControlFlagsKHR</type> <name>flags</name></member>
+ <member><type>VkVideoEncodeRateControlModeFlagBitsKHR</type> <name>rateControlMode</name></member>
+ <member><type>uint8_t</type> <name>layerCount</name></member>
+ <member len="layerCount">const <type>VkVideoEncodeRateControlLayerInfoKHR</type>* <name>pLayerConfigs</name></member>
+ </type>
+ <type category="struct" name="VkVideoEncodeRateControlLayerInfoKHR" structextends="VkVideoCodingControlInfoKHR">
+ <member values="VK_STRUCTURE_TYPE_VIDEO_ENCODE_RATE_CONTROL_LAYER_INFO_KHR"><type>VkStructureType</type> <name>sType</name></member>
+ <member>const <type>void</type>* <name>pNext</name></member>
+ <member><type>uint32_t</type> <name>averageBitrate</name></member>
+ <member><type>uint32_t</type> <name>maxBitrate</name></member>
+ <member><type>uint32_t</type> <name>frameRateNumerator</name></member>
+ <member><type>uint32_t</type> <name>frameRateDenominator</name></member>
+ <member><type>uint32_t</type> <name>virtualBufferSizeInMs</name></member>
+ <member><type>uint32_t</type> <name>initialVirtualBufferSizeInMs</name></member>
+ </type>
+ <type category="struct" name="VkVideoEncodeCapabilitiesKHR" returnedonly="true" structextends="VkVideoCapabilitiesKHR">
+ <member values="VK_STRUCTURE_TYPE_VIDEO_ENCODE_CAPABILITIES_KHR"><type>VkStructureType</type> <name>sType</name></member>
+ <member optional="true"><type>void</type>* <name>pNext</name></member>
+ <member noautovalidity="true"><type>VkVideoEncodeCapabilityFlagsKHR</type> <name>flags</name></member>
+ <member><type>VkVideoEncodeRateControlModeFlagsKHR</type> <name>rateControlModes</name></member>
+ <member><type>uint8_t</type> <name>rateControlLayerCount</name></member>
+ <member><type>uint8_t</type> <name>qualityLevelCount</name></member>
+ <member><type>VkExtent2D</type> <name>inputImageDataFillAlignment</name></member>
+ </type>
+ <type category="struct" name="VkVideoEncodeH264CapabilitiesEXT" returnedonly="true" structextends="VkVideoEncodeCapabilitiesKHR">
+ <member values="VK_STRUCTURE_TYPE_VIDEO_ENCODE_H264_CAPABILITIES_EXT"><type>VkStructureType</type> <name>sType</name></member>
+ <member optional="true"><type>void</type>* <name>pNext</name></member>
+ <member noautovalidity="true"><type>VkVideoEncodeH264CapabilityFlagsEXT</type> <name>flags</name></member>
+ <member><type>VkVideoEncodeH264InputModeFlagsEXT</type> <name>inputModeFlags</name></member>
+ <member><type>VkVideoEncodeH264OutputModeFlagsEXT</type> <name>outputModeFlags</name></member>
+ <member><type>uint8_t</type> <name>maxPPictureL0ReferenceCount</name></member>
+ <member><type>uint8_t</type> <name>maxBPictureL0ReferenceCount</name></member>
+ <member><type>uint8_t</type> <name>maxL1ReferenceCount</name></member>
+ <member><type>VkBool32</type> <name>motionVectorsOverPicBoundariesFlag</name></member>
+ <member><type>uint32_t</type> <name>maxBytesPerPicDenom</name></member>
+ <member><type>uint32_t</type> <name>maxBitsPerMbDenom</name></member>
+ <member><type>uint32_t</type> <name>log2MaxMvLengthHorizontal</name></member>
+ <member><type>uint32_t</type> <name>log2MaxMvLengthVertical</name></member>
+ </type>
+ <type category="include" name="vk_video/vulkan_video_codec_h264std_encode.h">#include "vk_video/vulkan_video_codec_h264std_encode.h"</type>
+ <type requires="vk_video/vulkan_video_codec_h264std_encode.h" name="StdVideoEncodeH264SliceHeader"/>
+ <type requires="vk_video/vulkan_video_codec_h264std_encode.h" name="StdVideoEncodeH264PictureInfo"/>
+ <type requires="vk_video/vulkan_video_codec_h264std_encode.h" name="StdVideoEncodeH264ReferenceInfo"/>
+ <type requires="vk_video/vulkan_video_codec_h264std_encode.h" name="StdVideoEncodeH264SliceHeaderFlags"/>
+ <type requires="vk_video/vulkan_video_codec_h264std_encode.h" name="StdVideoEncodeH264RefMemMgmtCtrlOperations"/>
+ <type requires="vk_video/vulkan_video_codec_h264std_encode.h" name="StdVideoEncodeH264PictureInfoFlags"/>
+ <type requires="vk_video/vulkan_video_codec_h264std_encode.h" name="StdVideoEncodeH264ReferenceInfoFlags"/>
+ <type requires="vk_video/vulkan_video_codec_h264std_encode.h" name="StdVideoEncodeH264RefMgmtFlags"/>
+ <type requires="vk_video/vulkan_video_codec_h264std_encode.h" name="StdVideoEncodeH264RefListModEntry"/>
+ <type requires="vk_video/vulkan_video_codec_h264std_encode.h" name="StdVideoEncodeH264RefPicMarkingEntry"/>
+ <type category="struct" name="VkVideoEncodeH264SessionParametersAddInfoEXT" structextends="VkVideoSessionParametersUpdateInfoKHR">
+ <member values="VK_STRUCTURE_TYPE_VIDEO_ENCODE_H264_SESSION_PARAMETERS_ADD_INFO_EXT"><type>VkStructureType</type> <name>sType</name></member>
+ <member optional="true">const <type>void</type>* <name>pNext</name></member>
+ <member><type>uint32_t</type> <name>spsStdCount</name></member>
+ <member len="spsStdCount" optional="true">const <type>StdVideoH264SequenceParameterSet</type>* <name>pSpsStd</name></member>
+ <member><type>uint32_t</type> <name>ppsStdCount</name></member>
+ <member len="ppsStdCount" optional="true">const <type>StdVideoH264PictureParameterSet</type>* <name>pPpsStd</name><comment>List of Picture Parameters associated with the spsStd, above</comment></member>
+ </type>
+ <type category="struct" name="VkVideoEncodeH264SessionParametersCreateInfoEXT" structextends="VkVideoSessionParametersCreateInfoKHR">
+ <member values="VK_STRUCTURE_TYPE_VIDEO_ENCODE_H264_SESSION_PARAMETERS_CREATE_INFO_EXT"><type>VkStructureType</type> <name>sType</name></member>
+ <member optional="true">const <type>void</type>* <name>pNext</name></member>
+ <member><type>uint32_t</type> <name>maxSpsStdCount</name></member>
+ <member><type>uint32_t</type> <name>maxPpsStdCount</name></member>
+ <member optional="true">const <type>VkVideoEncodeH264SessionParametersAddInfoEXT</type>* <name>pParametersAddInfo</name></member>
+ </type>
+ <type category="struct" name="VkVideoEncodeH264DpbSlotInfoEXT">
+ <member values="VK_STRUCTURE_TYPE_VIDEO_ENCODE_H264_DPB_SLOT_INFO_EXT"><type>VkStructureType</type> <name>sType</name></member>
+ <member optional="true">const <type>void</type>* <name>pNext</name></member>
+ <member><type>int8_t</type> <name>slotIndex</name></member>
+ <member>const <type>StdVideoEncodeH264ReferenceInfo</type>* <name>pStdReferenceInfo</name></member>
+ </type>
+ <type category="struct" name="VkVideoEncodeH264VclFrameInfoEXT" structextends="VkVideoEncodeInfoKHR">
+ <member values="VK_STRUCTURE_TYPE_VIDEO_ENCODE_H264_VCL_FRAME_INFO_EXT"><type>VkStructureType</type> <name>sType</name></member>
+ <member optional="true">const <type>void</type>* <name>pNext</name></member>
+ <member optional="true">const <type>VkVideoEncodeH264ReferenceListsEXT</type>* <name>pReferenceFinalLists</name></member>
+ <member><type>uint32_t</type> <name>naluSliceEntryCount</name></member>
+ <member len="naluSliceEntryCount">const <type>VkVideoEncodeH264NaluSliceEXT</type>* <name>pNaluSliceEntries</name></member>
+ <member>const <type>StdVideoEncodeH264PictureInfo</type>* <name>pCurrentPictureInfo</name></member>
+ </type>
+ <type category="struct" name="VkVideoEncodeH264ReferenceListsEXT">
+ <member values="VK_STRUCTURE_TYPE_VIDEO_ENCODE_H264_REFERENCE_LISTS_EXT"><type>VkStructureType</type> <name>sType</name></member>
+ <member optional="true">const <type>void</type>* <name>pNext</name></member>
+ <member optional="true"><type>uint8_t</type> <name>referenceList0EntryCount</name></member>
+ <member len="referenceList0EntryCount">const <type>VkVideoEncodeH264DpbSlotInfoEXT</type>* <name>pReferenceList0Entries</name></member>
+ <member optional="true"><type>uint8_t</type> <name>referenceList1EntryCount</name></member>
+ <member len="referenceList1EntryCount">const <type>VkVideoEncodeH264DpbSlotInfoEXT</type>* <name>pReferenceList1Entries</name></member>
+ <member>const <type>StdVideoEncodeH264RefMemMgmtCtrlOperations</type>* <name>pMemMgmtCtrlOperations</name></member>
+ </type>
+ <type category="struct" name="VkVideoEncodeH264EmitPictureParametersEXT" structextends="VkVideoEncodeInfoKHR">
+ <member values="VK_STRUCTURE_TYPE_VIDEO_ENCODE_H264_EMIT_PICTURE_PARAMETERS_EXT"><type>VkStructureType</type> <name>sType</name></member>
+ <member optional="true">const <type>void</type>* <name>pNext</name></member>
+ <member><type>uint8_t</type> <name>spsId</name></member>
+ <member><type>VkBool32</type> <name>emitSpsEnable</name></member>
+ <member><type>uint32_t</type> <name>ppsIdEntryCount</name></member>
+ <member len="ppsIdEntryCount">const <type>uint8_t</type>* <name>ppsIdEntries</name></member>
+ </type>
+ <type category="struct" name="VkVideoEncodeH264ProfileEXT" structextends="VkVideoProfileKHR,VkQueryPoolCreateInfo">
+ <member values="VK_STRUCTURE_TYPE_VIDEO_ENCODE_H264_PROFILE_EXT"><type>VkStructureType</type> <name>sType</name></member>
+ <member optional="true">const <type>void</type>* <name>pNext</name></member>
+ <member><type>StdVideoH264ProfileIdc</type> <name>stdProfileIdc</name></member>
+ </type>
+ <type category="struct" name="VkVideoEncodeH264NaluSliceEXT">
+ <member values="VK_STRUCTURE_TYPE_VIDEO_ENCODE_H264_NALU_SLICE_EXT"><type>VkStructureType</type> <name>sType</name></member>
+ <member optional="true">const <type>void</type>* <name>pNext</name></member>
+ <member><type>uint32_t</type> <name>mbCount</name></member>
+ <member optional="true">const <type>VkVideoEncodeH264ReferenceListsEXT</type>* <name>pReferenceFinalLists</name></member>
+ <member>const <type>StdVideoEncodeH264SliceHeader</type>* <name>pSliceHeaderStd</name></member>
+ </type>
+ <type category="struct" name="VkVideoEncodeH264RateControlInfoEXT" structextends="VkVideoEncodeRateControlInfoKHR">
+ <member values="VK_STRUCTURE_TYPE_VIDEO_ENCODE_H264_RATE_CONTROL_INFO_EXT"><type>VkStructureType</type> <name>sType</name></member>
+ <member optional="true">const <type>void</type>* <name>pNext</name></member>
+ <member><type>uint32_t</type> <name>gopFrameCount</name></member>
+ <member><type>uint32_t</type> <name>idrPeriod</name></member>
+ <member><type>uint32_t</type> <name>consecutiveBFrameCount</name></member>
+ <member><type>VkVideoEncodeH264RateControlStructureFlagBitsEXT</type> <name>rateControlStructure</name></member>
+ <member><type>uint8_t</type> <name>temporalLayerCount</name></member>
+ </type>
+ <type category="struct" name="VkVideoEncodeH264QpEXT">
+ <member noautovalidity="true"><type>int32_t</type> <name>qpI</name></member>
+ <member noautovalidity="true"><type>int32_t</type> <name>qpP</name></member>
+ <member noautovalidity="true"><type>int32_t</type> <name>qpB</name></member>
+ </type>
+ <type category="struct" name="VkVideoEncodeH264FrameSizeEXT">
+ <member noautovalidity="true"><type>uint32_t</type> <name>frameISize</name></member>
+ <member noautovalidity="true"><type>uint32_t</type> <name>framePSize</name></member>
+ <member noautovalidity="true"><type>uint32_t</type> <name>frameBSize</name></member>
+ </type>
+ <type category="struct" name="VkVideoEncodeH264RateControlLayerInfoEXT" structextends="VkVideoEncodeRateControlLayerInfoKHR">
+ <member values="VK_STRUCTURE_TYPE_VIDEO_ENCODE_H264_RATE_CONTROL_LAYER_INFO_EXT"><type>VkStructureType</type> <name>sType</name></member>
+ <member optional="true">const <type>void</type>* <name>pNext</name></member>
+ <member><type>uint8_t</type> <name>temporalLayerId</name></member>
+ <member><type>VkBool32</type> <name>useInitialRcQp</name></member>
+ <member><type>VkVideoEncodeH264QpEXT</type> <name>initialRcQp</name></member>
+ <member><type>VkBool32</type> <name>useMinQp</name></member>
+ <member><type>VkVideoEncodeH264QpEXT</type> <name>minQp</name></member>
+ <member><type>VkBool32</type> <name>useMaxQp</name></member>
+ <member><type>VkVideoEncodeH264QpEXT</type> <name>maxQp</name></member>
+ <member><type>VkBool32</type> <name>useMaxFrameSize</name></member>
+ <member><type>VkVideoEncodeH264FrameSizeEXT</type> <name>maxFrameSize</name></member>
+ </type>
+ <type category="struct" name="VkVideoEncodeH265CapabilitiesEXT" returnedonly="true" structextends="VkVideoEncodeCapabilitiesKHR">
+ <member values="VK_STRUCTURE_TYPE_VIDEO_ENCODE_H265_CAPABILITIES_EXT"><type>VkStructureType</type> <name>sType</name></member>
+ <member optional="true"><type>void</type>* <name>pNext</name></member>
+ <member noautovalidity="true"><type>VkVideoEncodeH265CapabilityFlagsEXT</type> <name>flags</name></member>
+ <member><type>VkVideoEncodeH265InputModeFlagsEXT</type> <name>inputModeFlags</name></member>
+ <member><type>VkVideoEncodeH265OutputModeFlagsEXT</type> <name>outputModeFlags</name></member>
+ <member><type>VkVideoEncodeH265CtbSizeFlagsEXT</type> <name>ctbSizes</name></member>
+ <member><type>VkVideoEncodeH265TransformBlockSizeFlagsEXT</type> <name>transformBlockSizes</name></member>
+ <member><type>uint8_t</type> <name>maxPPictureL0ReferenceCount</name></member>
+ <member><type>uint8_t</type> <name>maxBPictureL0ReferenceCount</name></member>
+ <member><type>uint8_t</type> <name>maxL1ReferenceCount</name></member>
+ <member><type>uint8_t</type> <name>maxSubLayersCount</name></member>
+ <member><type>uint8_t</type> <name>minLog2MinLumaCodingBlockSizeMinus3</name></member>
+ <member><type>uint8_t</type> <name>maxLog2MinLumaCodingBlockSizeMinus3</name></member>
+ <member><type>uint8_t</type> <name>minLog2MinLumaTransformBlockSizeMinus2</name></member>
+ <member><type>uint8_t</type> <name>maxLog2MinLumaTransformBlockSizeMinus2</name></member>
+ <member><type>uint8_t</type> <name>minMaxTransformHierarchyDepthInter</name></member>
+ <member><type>uint8_t</type> <name>maxMaxTransformHierarchyDepthInter</name></member>
+ <member><type>uint8_t</type> <name>minMaxTransformHierarchyDepthIntra</name></member>
+ <member><type>uint8_t</type> <name>maxMaxTransformHierarchyDepthIntra</name></member>
+ <member><type>uint8_t</type> <name>maxDiffCuQpDeltaDepth</name></member>
+ <member><type>uint8_t</type> <name>minMaxNumMergeCand</name></member>
+ <member><type>uint8_t</type> <name>maxMaxNumMergeCand</name></member>
+ </type>
+ <type category="include" name="vk_video/vulkan_video_codec_h265std_encode.h">#include "vk_video/vulkan_video_codec_h265std_encode.h"</type>
+ <type requires="vk_video/vulkan_video_codec_h265std_encode.h" name="StdVideoEncodeH265PictureInfoFlags"/>
+ <type requires="vk_video/vulkan_video_codec_h265std_encode.h" name="StdVideoEncodeH265PictureInfo"/>
+ <type requires="vk_video/vulkan_video_codec_h265std_encode.h" name="StdVideoEncodeH265SliceSegmentHeader"/>
+ <type requires="vk_video/vulkan_video_codec_h265std_encode.h" name="StdVideoEncodeH265ReferenceInfo"/>
+ <type requires="vk_video/vulkan_video_codec_h265std_encode.h" name="StdVideoEncodeH265ReferenceModifications"/>
+ <type requires="vk_video/vulkan_video_codec_h265std_encode.h" name="StdVideoEncodeH265SliceSegmentHeaderFlags"/>
+ <type requires="vk_video/vulkan_video_codec_h265std_encode.h" name="StdVideoEncodeH265ReferenceInfoFlags"/>
+ <type requires="vk_video/vulkan_video_codec_h265std_encode.h" name="StdVideoEncodeH265ReferenceModificationFlags"/>
+ <type category="struct" name="VkVideoEncodeH265SessionParametersAddInfoEXT" structextends="VkVideoSessionParametersUpdateInfoKHR">
+ <member values="VK_STRUCTURE_TYPE_VIDEO_ENCODE_H265_SESSION_PARAMETERS_ADD_INFO_EXT"><type>VkStructureType</type> <name>sType</name></member>
+ <member optional="true">const <type>void</type>* <name>pNext</name></member>
+ <member><type>uint32_t</type> <name>vpsStdCount</name></member>
+ <member len="vpsStdCount" optional="true">const <type>StdVideoH265VideoParameterSet</type>* <name>pVpsStd</name></member>
+ <member><type>uint32_t</type> <name>spsStdCount</name></member>
+ <member len="spsStdCount" optional="true">const <type>StdVideoH265SequenceParameterSet</type>* <name>pSpsStd</name></member>
+ <member><type>uint32_t</type> <name>ppsStdCount</name></member>
+ <member len="ppsStdCount" optional="true">const <type>StdVideoH265PictureParameterSet</type>* <name>pPpsStd</name><comment>List of Picture Parameters associated with the spsStd, above</comment></member>
+ </type>
+ <type category="struct" name="VkVideoEncodeH265SessionParametersCreateInfoEXT" structextends="VkVideoSessionParametersCreateInfoKHR">
+ <member values="VK_STRUCTURE_TYPE_VIDEO_ENCODE_H265_SESSION_PARAMETERS_CREATE_INFO_EXT"><type>VkStructureType</type> <name>sType</name></member>
+ <member optional="true">const <type>void</type>* <name>pNext</name></member>
+ <member><type>uint32_t</type> <name>maxVpsStdCount</name></member>
+ <member><type>uint32_t</type> <name>maxSpsStdCount</name></member>
+ <member><type>uint32_t</type> <name>maxPpsStdCount</name></member>
+ <member optional="true">const <type>VkVideoEncodeH265SessionParametersAddInfoEXT</type>* <name>pParametersAddInfo</name></member>
+ </type>
+ <type category="struct" name="VkVideoEncodeH265VclFrameInfoEXT" structextends="VkVideoEncodeInfoKHR">
+ <member values="VK_STRUCTURE_TYPE_VIDEO_ENCODE_H265_VCL_FRAME_INFO_EXT"><type>VkStructureType</type> <name>sType</name></member>
+ <member optional="true">const <type>void</type>* <name>pNext</name></member>
+ <member optional="true">const <type>VkVideoEncodeH265ReferenceListsEXT</type>* <name>pReferenceFinalLists</name></member>
+ <member><type>uint32_t</type> <name>naluSliceSegmentEntryCount</name></member>
+ <member len="naluSliceSegmentEntryCount">const <type>VkVideoEncodeH265NaluSliceSegmentEXT</type>* <name>pNaluSliceSegmentEntries</name></member>
+ <member>const <type>StdVideoEncodeH265PictureInfo</type>* <name>pCurrentPictureInfo</name></member>
+ </type>
+ <type category="struct" name="VkVideoEncodeH265EmitPictureParametersEXT" structextends="VkVideoEncodeInfoKHR">
+ <member values="VK_STRUCTURE_TYPE_VIDEO_ENCODE_H265_EMIT_PICTURE_PARAMETERS_EXT"><type>VkStructureType</type> <name>sType</name></member>
+ <member optional="true">const <type>void</type>* <name>pNext</name></member>
+ <member><type>uint8_t</type> <name>vpsId</name></member>
+ <member><type>uint8_t</type> <name>spsId</name></member>
+ <member><type>VkBool32</type> <name>emitVpsEnable</name></member>
+ <member><type>VkBool32</type> <name>emitSpsEnable</name></member>
+ <member optional="true"><type>uint32_t</type> <name>ppsIdEntryCount</name></member>
+ <member len="ppsIdEntryCount">const <type>uint8_t</type>* <name>ppsIdEntries</name></member>
+ </type>
+ <type category="struct" name="VkVideoEncodeH265NaluSliceSegmentEXT">
+ <member values="VK_STRUCTURE_TYPE_VIDEO_ENCODE_H265_NALU_SLICE_SEGMENT_EXT"><type>VkStructureType</type> <name>sType</name></member>
+ <member optional="true">const <type>void</type>* <name>pNext</name></member>
+ <member><type>uint32_t</type> <name>ctbCount</name></member>
+ <member optional="true">const <type>VkVideoEncodeH265ReferenceListsEXT</type>* <name>pReferenceFinalLists</name></member>
+ <member>const <type>StdVideoEncodeH265SliceSegmentHeader</type>* <name>pSliceSegmentHeaderStd</name></member>
+ </type>
+ <type category="struct" name="VkVideoEncodeH265RateControlInfoEXT" structextends="VkVideoEncodeRateControlInfoKHR">
+ <member values="VK_STRUCTURE_TYPE_VIDEO_ENCODE_H265_RATE_CONTROL_INFO_EXT"><type>VkStructureType</type> <name>sType</name></member>
+ <member optional="true">const <type>void</type>* <name>pNext</name></member>
+ <member><type>uint32_t</type> <name>gopFrameCount</name></member>
+ <member><type>uint32_t</type> <name>idrPeriod</name></member>
+ <member><type>uint32_t</type> <name>consecutiveBFrameCount</name></member>
+ <member><type>VkVideoEncodeH265RateControlStructureFlagBitsEXT</type> <name>rateControlStructure</name></member>
+ <member><type>uint8_t</type> <name>subLayerCount</name></member>
+ </type>
+ <type category="struct" name="VkVideoEncodeH265QpEXT">
+ <member noautovalidity="true"><type>int32_t</type> <name>qpI</name></member>
+ <member noautovalidity="true"><type>int32_t</type> <name>qpP</name></member>
+ <member noautovalidity="true"><type>int32_t</type> <name>qpB</name></member>
+ </type>
+ <type category="struct" name="VkVideoEncodeH265FrameSizeEXT">
+ <member noautovalidity="true"><type>uint32_t</type> <name>frameISize</name></member>
+ <member noautovalidity="true"><type>uint32_t</type> <name>framePSize</name></member>
+ <member noautovalidity="true"><type>uint32_t</type> <name>frameBSize</name></member>
+ </type>
+ <type category="struct" name="VkVideoEncodeH265RateControlLayerInfoEXT" structextends="VkVideoEncodeRateControlLayerInfoKHR">
+ <member values="VK_STRUCTURE_TYPE_VIDEO_ENCODE_H265_RATE_CONTROL_LAYER_INFO_EXT"><type>VkStructureType</type> <name>sType</name></member>
+ <member optional="true">const <type>void</type>* <name>pNext</name></member>
+ <member><type>uint8_t</type> <name>temporalId</name></member>
+ <member><type>VkBool32</type> <name>useInitialRcQp</name></member>
+ <member><type>VkVideoEncodeH265QpEXT</type> <name>initialRcQp</name></member>
+ <member><type>VkBool32</type> <name>useMinQp</name></member>
+ <member><type>VkVideoEncodeH265QpEXT</type> <name>minQp</name></member>
+ <member><type>VkBool32</type> <name>useMaxQp</name></member>
+ <member><type>VkVideoEncodeH265QpEXT</type> <name>maxQp</name></member>
+ <member><type>VkBool32</type> <name>useMaxFrameSize</name></member>
+ <member><type>VkVideoEncodeH265FrameSizeEXT</type> <name>maxFrameSize</name></member>
+ </type>
+ <type category="struct" name="VkVideoEncodeH265ProfileEXT" structextends="VkVideoProfileKHR,VkQueryPoolCreateInfo">
+ <member values="VK_STRUCTURE_TYPE_VIDEO_ENCODE_H265_PROFILE_EXT"><type>VkStructureType</type> <name>sType</name></member>
+ <member optional="true">const <type>void</type>* <name>pNext</name></member>
+ <member><type>StdVideoH265ProfileIdc</type> <name>stdProfileIdc</name></member>
+ </type>
+ <type category="struct" name="VkVideoEncodeH265DpbSlotInfoEXT">
+ <member values="VK_STRUCTURE_TYPE_VIDEO_ENCODE_H265_DPB_SLOT_INFO_EXT"><type>VkStructureType</type> <name>sType</name></member>
+ <member optional="true">const <type>void</type>* <name>pNext</name></member>
+ <member><type>int8_t</type> <name>slotIndex</name></member>
+ <member>const <type>StdVideoEncodeH265ReferenceInfo</type>* <name>pStdReferenceInfo</name></member>
+ </type>
+ <type category="struct" name="VkVideoEncodeH265ReferenceListsEXT">
+ <member values="VK_STRUCTURE_TYPE_VIDEO_ENCODE_H265_REFERENCE_LISTS_EXT"><type>VkStructureType</type> <name>sType</name></member>
+ <member optional="true">const <type>void</type>* <name>pNext</name></member>
+ <member optional="true"><type>uint8_t</type> <name>referenceList0EntryCount</name></member>
+ <member len="referenceList0EntryCount">const <type>VkVideoEncodeH265DpbSlotInfoEXT</type>* <name>pReferenceList0Entries</name></member>
+ <member optional="true"><type>uint8_t</type> <name>referenceList1EntryCount</name></member>
+ <member len="referenceList1EntryCount">const <type>VkVideoEncodeH265DpbSlotInfoEXT</type>* <name>pReferenceList1Entries</name></member>
+ <member>const <type>StdVideoEncodeH265ReferenceModifications</type>* <name>pReferenceModifications</name></member>
+ </type>
+ <type category="struct" name="VkPhysicalDeviceInheritedViewportScissorFeaturesNV" structextends="VkPhysicalDeviceFeatures2,VkDeviceCreateInfo">
+ <member values="VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_INHERITED_VIEWPORT_SCISSOR_FEATURES_NV"><type>VkStructureType</type> <name>sType</name></member>
+ <member optional="true"><type>void</type>* <name>pNext</name></member>
+ <member><type>VkBool32</type> <name>inheritedViewportScissor2D</name></member>
+ </type>
+ <type category="struct" name="VkCommandBufferInheritanceViewportScissorInfoNV" structextends="VkCommandBufferInheritanceInfo">
+ <member values="VK_STRUCTURE_TYPE_COMMAND_BUFFER_INHERITANCE_VIEWPORT_SCISSOR_INFO_NV"><type>VkStructureType</type> <name>sType</name></member>
+ <member optional="true">const <type>void</type>* <name>pNext</name></member>
+ <member><type>VkBool32</type> <name>viewportScissor2D</name></member>
+ <member><type>uint32_t</type> <name>viewportDepthCount</name></member>
+ <member noautovalidity="true">const <type>VkViewport</type>* <name>pViewportDepths</name></member>
+ </type>
+ <type category="struct" name="VkPhysicalDeviceYcbcr2Plane444FormatsFeaturesEXT" structextends="VkPhysicalDeviceFeatures2,VkDeviceCreateInfo">
+ <member values="VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_YCBCR_2_PLANE_444_FORMATS_FEATURES_EXT"><type>VkStructureType</type> <name>sType</name></member>
+ <member optional="true"><type>void</type>* <name>pNext</name></member>
+ <member><type>VkBool32</type> <name>ycbcr2plane444Formats</name></member>
+ </type>
+ <type category="struct" name="VkPhysicalDeviceProvokingVertexFeaturesEXT" structextends="VkPhysicalDeviceFeatures2,VkDeviceCreateInfo">
+ <member values="VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_PROVOKING_VERTEX_FEATURES_EXT"><type>VkStructureType</type> <name>sType</name></member>
+ <member optional="true" noautovalidity="true"><type>void</type>* <name>pNext</name></member>
+ <member><type>VkBool32</type> <name>provokingVertexLast</name></member>
+ <member><type>VkBool32</type> <name>transformFeedbackPreservesProvokingVertex</name></member>
+ </type>
+ <type category="struct" name="VkPhysicalDeviceProvokingVertexPropertiesEXT" returnedonly="true" structextends="VkPhysicalDeviceProperties2">
+ <member values="VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_PROVOKING_VERTEX_PROPERTIES_EXT"><type>VkStructureType</type> <name>sType</name></member>
+ <member optional="true"><type>void</type>* <name>pNext</name></member>
+ <member limittype="bitmask"><type>VkBool32</type> <name>provokingVertexModePerPipeline</name></member>
+ <member limittype="bitmask"><type>VkBool32</type> <name>transformFeedbackPreservesTriangleFanProvokingVertex</name></member>
+ </type>
+ <type category="struct" name="VkPipelineRasterizationProvokingVertexStateCreateInfoEXT" structextends="VkPipelineRasterizationStateCreateInfo">
+ <member values="VK_STRUCTURE_TYPE_PIPELINE_RASTERIZATION_PROVOKING_VERTEX_STATE_CREATE_INFO_EXT"><type>VkStructureType</type> <name>sType</name></member>
+ <member optional="true">const <type>void</type>* <name>pNext</name></member>
+ <member><type>VkProvokingVertexModeEXT</type> <name>provokingVertexMode</name></member>
+ </type>
+ <type category="struct" name="VkCuModuleCreateInfoNVX">
+ <member values="VK_STRUCTURE_TYPE_CU_MODULE_CREATE_INFO_NVX"><type>VkStructureType</type> <name>sType</name></member>
+ <member optional="true">const <type>void</type>* <name>pNext</name></member>
+ <member><type>size_t</type> <name>dataSize</name></member>
+ <member len="dataSize">const <type>void</type>* <name>pData</name></member>
+ </type>
+ <type category="struct" name="VkCuFunctionCreateInfoNVX">
+ <member values="VK_STRUCTURE_TYPE_CU_FUNCTION_CREATE_INFO_NVX"><type>VkStructureType</type> <name>sType</name></member>
+ <member optional="true">const <type>void</type>* <name>pNext</name></member>
+ <member><type>VkCuModuleNVX</type> <name>module</name></member>
+ <member len="null-terminated">const <type>char</type>* <name>pName</name></member>
+ </type>
+ <type category="struct" name="VkCuLaunchInfoNVX">
+ <member values="VK_STRUCTURE_TYPE_CU_LAUNCH_INFO_NVX"><type>VkStructureType</type> <name>sType</name></member>
+ <member optional="true">const <type>void</type>* <name>pNext</name></member>
+ <member><type>VkCuFunctionNVX</type> <name>function</name></member>
+ <member><type>uint32_t</type> <name>gridDimX</name></member>
+ <member><type>uint32_t</type> <name>gridDimY</name></member>
+ <member><type>uint32_t</type> <name>gridDimZ</name></member>
+ <member><type>uint32_t</type> <name>blockDimX</name></member>
+ <member><type>uint32_t</type> <name>blockDimY</name></member>
+ <member><type>uint32_t</type> <name>blockDimZ</name></member>
+ <member><type>uint32_t</type> <name>sharedMemBytes</name></member>
+ <member optional="true"><type>size_t</type> <name>paramCount</name></member>
+ <member len="paramCount">const <type>void</type>* const * <name>pParams</name></member>
+ <member optional="true"><type>size_t</type> <name>extraCount</name></member>
+ <member len="extraCount">const <type>void</type>* const * <name>pExtras</name></member>
+ </type>
+ <type category="struct" name="VkPhysicalDeviceShaderIntegerDotProductFeatures" structextends="VkPhysicalDeviceFeatures2,VkDeviceCreateInfo">
+ <member values="VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_SHADER_INTEGER_DOT_PRODUCT_FEATURES"><type>VkStructureType</type> <name>sType</name></member>
+ <member optional="true"><type>void</type>* <name>pNext</name></member>
+ <member><type>VkBool32</type> <name>shaderIntegerDotProduct</name></member>
+ </type>
+ <type category="struct" name="VkPhysicalDeviceShaderIntegerDotProductFeaturesKHR" alias="VkPhysicalDeviceShaderIntegerDotProductFeatures"/>
+ <type category="struct" name="VkPhysicalDeviceShaderIntegerDotProductProperties" structextends="VkPhysicalDeviceProperties2" returnedonly="true">
+ <member values="VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_SHADER_INTEGER_DOT_PRODUCT_PROPERTIES"><type>VkStructureType</type> <name>sType</name></member>
+ <member optional="true"><type>void</type>* <name>pNext</name></member>
+ <member limittype="bitmask"><type>VkBool32</type> <name>integerDotProduct8BitUnsignedAccelerated</name></member>
+ <member limittype="bitmask"><type>VkBool32</type> <name>integerDotProduct8BitSignedAccelerated</name></member>
+ <member limittype="bitmask"><type>VkBool32</type> <name>integerDotProduct8BitMixedSignednessAccelerated</name></member>
+ <member limittype="bitmask"><type>VkBool32</type> <name>integerDotProduct4x8BitPackedUnsignedAccelerated</name></member>
+ <member limittype="bitmask"><type>VkBool32</type> <name>integerDotProduct4x8BitPackedSignedAccelerated</name></member>
+ <member limittype="bitmask"><type>VkBool32</type> <name>integerDotProduct4x8BitPackedMixedSignednessAccelerated</name></member>
+ <member limittype="bitmask"><type>VkBool32</type> <name>integerDotProduct16BitUnsignedAccelerated</name></member>
+ <member limittype="bitmask"><type>VkBool32</type> <name>integerDotProduct16BitSignedAccelerated</name></member>
+ <member limittype="bitmask"><type>VkBool32</type> <name>integerDotProduct16BitMixedSignednessAccelerated</name></member>
+ <member limittype="bitmask"><type>VkBool32</type> <name>integerDotProduct32BitUnsignedAccelerated</name></member>
+ <member limittype="bitmask"><type>VkBool32</type> <name>integerDotProduct32BitSignedAccelerated</name></member>
+ <member limittype="bitmask"><type>VkBool32</type> <name>integerDotProduct32BitMixedSignednessAccelerated</name></member>
+ <member limittype="bitmask"><type>VkBool32</type> <name>integerDotProduct64BitUnsignedAccelerated</name></member>
+ <member limittype="bitmask"><type>VkBool32</type> <name>integerDotProduct64BitSignedAccelerated</name></member>
+ <member limittype="bitmask"><type>VkBool32</type> <name>integerDotProduct64BitMixedSignednessAccelerated</name></member>
+ <member limittype="bitmask"><type>VkBool32</type> <name>integerDotProductAccumulatingSaturating8BitUnsignedAccelerated</name></member>
+ <member limittype="bitmask"><type>VkBool32</type> <name>integerDotProductAccumulatingSaturating8BitSignedAccelerated</name></member>
+ <member limittype="bitmask"><type>VkBool32</type> <name>integerDotProductAccumulatingSaturating8BitMixedSignednessAccelerated</name></member>
+ <member limittype="bitmask"><type>VkBool32</type> <name>integerDotProductAccumulatingSaturating4x8BitPackedUnsignedAccelerated</name></member>
+ <member limittype="bitmask"><type>VkBool32</type> <name>integerDotProductAccumulatingSaturating4x8BitPackedSignedAccelerated</name></member>
+ <member limittype="bitmask"><type>VkBool32</type> <name>integerDotProductAccumulatingSaturating4x8BitPackedMixedSignednessAccelerated</name></member>
+ <member limittype="bitmask"><type>VkBool32</type> <name>integerDotProductAccumulatingSaturating16BitUnsignedAccelerated</name></member>
+ <member limittype="bitmask"><type>VkBool32</type> <name>integerDotProductAccumulatingSaturating16BitSignedAccelerated</name></member>
+ <member limittype="bitmask"><type>VkBool32</type> <name>integerDotProductAccumulatingSaturating16BitMixedSignednessAccelerated</name></member>
+ <member limittype="bitmask"><type>VkBool32</type> <name>integerDotProductAccumulatingSaturating32BitUnsignedAccelerated</name></member>
+ <member limittype="bitmask"><type>VkBool32</type> <name>integerDotProductAccumulatingSaturating32BitSignedAccelerated</name></member>
+ <member limittype="bitmask"><type>VkBool32</type> <name>integerDotProductAccumulatingSaturating32BitMixedSignednessAccelerated</name></member>
+ <member limittype="bitmask"><type>VkBool32</type> <name>integerDotProductAccumulatingSaturating64BitUnsignedAccelerated</name></member>
+ <member limittype="bitmask"><type>VkBool32</type> <name>integerDotProductAccumulatingSaturating64BitSignedAccelerated</name></member>
+ <member limittype="bitmask"><type>VkBool32</type> <name>integerDotProductAccumulatingSaturating64BitMixedSignednessAccelerated</name></member>
+ </type>
+ <type category="struct" name="VkPhysicalDeviceShaderIntegerDotProductPropertiesKHR" alias="VkPhysicalDeviceShaderIntegerDotProductProperties"/>
+ <type category="struct" name="VkPhysicalDeviceDrmPropertiesEXT" returnedonly="true" structextends="VkPhysicalDeviceProperties2">
+ <member values="VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_DRM_PROPERTIES_EXT"><type>VkStructureType</type> <name>sType</name></member>
+ <member optional="true"><type>void</type>* <name>pNext</name></member>
+ <member limittype="bitmask"><type>VkBool32</type> <name>hasPrimary</name></member>
+ <member limittype="bitmask"><type>VkBool32</type> <name>hasRender</name></member>
+ <member limittype="noauto"><type>int64_t</type> <name>primaryMajor</name></member>
+ <member limittype="noauto"><type>int64_t</type> <name>primaryMinor</name></member>
+ <member limittype="noauto"><type>int64_t</type> <name>renderMajor</name></member>
+ <member limittype="noauto"><type>int64_t</type> <name>renderMinor</name></member>
+ </type>
+ <type category="struct" name="VkPhysicalDeviceFragmentShaderBarycentricFeaturesKHR" structextends="VkPhysicalDeviceFeatures2,VkDeviceCreateInfo">
+ <member values="VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_FRAGMENT_SHADER_BARYCENTRIC_FEATURES_KHR"><type>VkStructureType</type> <name>sType</name></member>
+ <member optional="true"><type>void</type>* <name>pNext</name></member>
+ <member><type>VkBool32</type> <name>fragmentShaderBarycentric</name></member>
+ </type>
+ <type category="struct" name="VkPhysicalDeviceFragmentShaderBarycentricPropertiesKHR" returnedonly="true" structextends="VkPhysicalDeviceProperties2">
+ <member values="VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_FRAGMENT_SHADER_BARYCENTRIC_PROPERTIES_KHR"><type>VkStructureType</type> <name>sType</name></member>
+ <member optional="true"><type>void</type>* <name>pNext</name></member>
+ <member limittype="bitmask"><type>VkBool32</type> <name>triStripVertexOrderIndependentOfProvokingVertex</name></member>
+ </type>
+ <type category="struct" name="VkPhysicalDeviceRayTracingMotionBlurFeaturesNV" structextends="VkPhysicalDeviceFeatures2,VkDeviceCreateInfo">
+ <member values="VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_RAY_TRACING_MOTION_BLUR_FEATURES_NV"><type>VkStructureType</type> <name>sType</name></member>
+ <member optional="true" noautovalidity="true"><type>void</type>* <name>pNext</name></member>
+ <member><type>VkBool32</type> <name>rayTracingMotionBlur</name></member>
+ <member><type>VkBool32</type> <name>rayTracingMotionBlurPipelineTraceRaysIndirect</name></member>
+ </type>
+ <type name="VkAccelerationStructureMotionInstanceTypeNV" category="enum"/>
+ <type category="struct" name="VkAccelerationStructureGeometryMotionTrianglesDataNV" structextends="VkAccelerationStructureGeometryTrianglesDataKHR">
+ <member values="VK_STRUCTURE_TYPE_ACCELERATION_STRUCTURE_GEOMETRY_MOTION_TRIANGLES_DATA_NV"><type>VkStructureType</type> <name>sType</name></member>
+ <member optional="true">const <type>void</type>* <name>pNext</name></member>
+ <member noautovalidity="true"><type>VkDeviceOrHostAddressConstKHR</type> <name>vertexData</name></member>
+ </type>
+ <type category="struct" name="VkAccelerationStructureMotionInfoNV" structextends="VkAccelerationStructureCreateInfoKHR">
+ <member values="VK_STRUCTURE_TYPE_ACCELERATION_STRUCTURE_MOTION_INFO_NV"><type>VkStructureType</type> <name>sType</name></member>
+ <member optional="true">const <type>void</type>* <name>pNext</name></member>
+ <member><type>uint32_t</type> <name>maxInstances</name></member>
+ <member optional="true"><type>VkAccelerationStructureMotionInfoFlagsNV</type> <name>flags</name></member>
+ </type>
+ <type category="struct" name="VkSRTDataNV">
+ <member><type>float</type> <name>sx</name></member>
+ <member><type>float</type> <name>a</name></member>
+ <member><type>float</type> <name>b</name></member>
+ <member><type>float</type> <name>pvx</name></member>
+ <member><type>float</type> <name>sy</name></member>
+ <member><type>float</type> <name>c</name></member>
+ <member><type>float</type> <name>pvy</name></member>
+ <member><type>float</type> <name>sz</name></member>
+ <member><type>float</type> <name>pvz</name></member>
+ <member><type>float</type> <name>qx</name></member>
+ <member><type>float</type> <name>qy</name></member>
+ <member><type>float</type> <name>qz</name></member>
+ <member><type>float</type> <name>qw</name></member>
+ <member><type>float</type> <name>tx</name></member>
+ <member><type>float</type> <name>ty</name></member>
+ <member><type>float</type> <name>tz</name></member>
+ </type>
+ <type category="struct" name="VkAccelerationStructureSRTMotionInstanceNV">
+ <comment>The bitfields in this structure are non-normative since bitfield ordering is implementation-defined in C. The specification defines the normative layout.</comment>
+ <member><type>VkSRTDataNV</type> <name>transformT0</name></member>
+ <member><type>VkSRTDataNV</type> <name>transformT1</name></member>
+ <member><type>uint32_t</type> <name>instanceCustomIndex</name>:24</member>
+ <member><type>uint32_t</type> <name>mask</name>:8</member>
+ <member><type>uint32_t</type> <name>instanceShaderBindingTableRecordOffset</name>:24</member>
+ <member optional="true"><type>VkGeometryInstanceFlagsKHR</type> <name>flags</name>:8</member>
+ <member><type>uint64_t</type> <name>accelerationStructureReference</name></member>
+ </type>
+ <type category="struct" name="VkAccelerationStructureMatrixMotionInstanceNV">
+ <comment>The bitfields in this structure are non-normative since bitfield ordering is implementation-defined in C. The specification defines the normative layout.</comment>
+ <member><type>VkTransformMatrixKHR</type> <name>transformT0</name></member>
+ <member><type>VkTransformMatrixKHR</type> <name>transformT1</name></member>
+ <member><type>uint32_t</type> <name>instanceCustomIndex</name>:24</member>
+ <member><type>uint32_t</type> <name>mask</name>:8</member>
+ <member><type>uint32_t</type> <name>instanceShaderBindingTableRecordOffset</name>:24</member>
+ <member optional="true"><type>VkGeometryInstanceFlagsKHR</type> <name>flags</name>:8</member>
+ <member><type>uint64_t</type> <name>accelerationStructureReference</name></member>
+ </type>
+ <type category="union" name="VkAccelerationStructureMotionInstanceDataNV">
+ <member selection="VK_ACCELERATION_STRUCTURE_MOTION_INSTANCE_TYPE_STATIC_NV"><type>VkAccelerationStructureInstanceKHR</type> <name>staticInstance</name></member>
+ <member selection="VK_ACCELERATION_STRUCTURE_MOTION_INSTANCE_TYPE_MATRIX_MOTION_NV"><type>VkAccelerationStructureMatrixMotionInstanceNV</type> <name>matrixMotionInstance</name></member>
+ <member selection="VK_ACCELERATION_STRUCTURE_MOTION_INSTANCE_TYPE_SRT_MOTION_NV"><type>VkAccelerationStructureSRTMotionInstanceNV</type> <name>srtMotionInstance</name></member>
+ </type>
+ <type category="struct" name="VkAccelerationStructureMotionInstanceNV">
+ <member><type>VkAccelerationStructureMotionInstanceTypeNV</type> <name>type</name></member>
+ <member optional="true"><type>VkAccelerationStructureMotionInstanceFlagsNV</type> <name>flags</name></member>
+ <member selector="type"><type>VkAccelerationStructureMotionInstanceDataNV</type> <name>data</name></member>
+ </type>
+ <type category="basetype">typedef <type>void</type>* <name>VkRemoteAddressNV</name>;</type>
+ <type category="struct" name="VkMemoryGetRemoteAddressInfoNV">
+ <member values="VK_STRUCTURE_TYPE_MEMORY_GET_REMOTE_ADDRESS_INFO_NV"><type>VkStructureType</type> <name>sType</name></member>
+ <member optional="true">const <type>void</type>* <name>pNext</name></member>
+ <member><type>VkDeviceMemory</type> <name>memory</name></member>
+ <member><type>VkExternalMemoryHandleTypeFlagBits</type> <name>handleType</name></member>
+ </type>
+ <type category="struct" name="VkImportMemoryBufferCollectionFUCHSIA" structextends="VkMemoryAllocateInfo">
+ <member values="VK_STRUCTURE_TYPE_IMPORT_MEMORY_BUFFER_COLLECTION_FUCHSIA"><type>VkStructureType</type> <name>sType</name></member>
+ <member optional="true">const <type>void</type>* <name>pNext</name></member>
+ <member><type>VkBufferCollectionFUCHSIA</type> <name>collection</name></member>
+ <member><type>uint32_t</type> <name>index</name></member>
+ </type>
+ <type category="struct" name="VkBufferCollectionImageCreateInfoFUCHSIA" structextends="VkImageCreateInfo">
+ <member values="VK_STRUCTURE_TYPE_BUFFER_COLLECTION_IMAGE_CREATE_INFO_FUCHSIA"><type>VkStructureType</type> <name>sType</name></member>
+ <member optional="true">const <type>void</type>* <name>pNext</name></member>
+ <member><type>VkBufferCollectionFUCHSIA</type> <name>collection</name></member>
+ <member><type>uint32_t</type> <name>index</name></member>
+ </type>
+ <type category="struct" name="VkBufferCollectionBufferCreateInfoFUCHSIA" structextends="VkBufferCreateInfo">
+ <member values="VK_STRUCTURE_TYPE_BUFFER_COLLECTION_BUFFER_CREATE_INFO_FUCHSIA"><type>VkStructureType</type> <name>sType</name></member>
+ <member optional="true">const <type>void</type>* <name>pNext</name></member>
+ <member><type>VkBufferCollectionFUCHSIA</type> <name>collection</name></member>
+ <member><type>uint32_t</type> <name>index</name></member>
+ </type>
+ <type category="struct" name="VkBufferCollectionCreateInfoFUCHSIA">
+ <member values="VK_STRUCTURE_TYPE_BUFFER_COLLECTION_CREATE_INFO_FUCHSIA"><type>VkStructureType</type> <name>sType</name></member>
+ <member optional="true">const <type>void</type>* <name>pNext</name></member>
+ <member><type>zx_handle_t</type> <name>collectionToken</name></member>
+ </type>
+ <type category="struct" name="VkBufferCollectionPropertiesFUCHSIA">
+ <member values="VK_STRUCTURE_TYPE_BUFFER_COLLECTION_PROPERTIES_FUCHSIA"><type>VkStructureType</type> <name>sType</name></member>
+ <member optional="true"><type>void</type>* <name>pNext</name></member>
+ <member><type>uint32_t</type> <name>memoryTypeBits</name></member>
+ <member><type>uint32_t</type> <name>bufferCount</name></member>
+ <member><type>uint32_t</type> <name>createInfoIndex</name></member>
+ <member><type>uint64_t</type> <name>sysmemPixelFormat</name></member>
+ <member><type>VkFormatFeatureFlags</type> <name>formatFeatures</name></member>
+ <member><type>VkSysmemColorSpaceFUCHSIA</type> <name>sysmemColorSpaceIndex</name></member>
+ <member><type>VkComponentMapping</type> <name>samplerYcbcrConversionComponents</name></member>
+ <member><type>VkSamplerYcbcrModelConversion</type> <name>suggestedYcbcrModel</name></member>
+ <member><type>VkSamplerYcbcrRange</type> <name>suggestedYcbcrRange</name></member>
+ <member><type>VkChromaLocation</type> <name>suggestedXChromaOffset</name></member>
+ <member><type>VkChromaLocation</type> <name>suggestedYChromaOffset</name></member>
+ </type>
+ <type category="struct" name="VkBufferConstraintsInfoFUCHSIA">
+ <member values="VK_STRUCTURE_TYPE_BUFFER_CONSTRAINTS_INFO_FUCHSIA"><type>VkStructureType</type> <name>sType</name></member>
+ <member optional="true">const <type>void</type>* <name>pNext</name></member>
+ <member><type>VkBufferCreateInfo</type> <name>createInfo</name></member>
+ <member optional="true"><type>VkFormatFeatureFlags</type> <name>requiredFormatFeatures</name></member>
+ <member><type>VkBufferCollectionConstraintsInfoFUCHSIA</type> <name>bufferCollectionConstraints</name></member>
+ </type>
+ <type category="struct" name="VkSysmemColorSpaceFUCHSIA">
+ <member values="VK_STRUCTURE_TYPE_SYSMEM_COLOR_SPACE_FUCHSIA"><type>VkStructureType</type> <name>sType</name></member>
+ <member optional="true">const <type>void</type>* <name>pNext</name></member>
+ <member><type>uint32_t</type> <name>colorSpace</name></member>
+ </type>
+ <type category="struct" name="VkImageFormatConstraintsInfoFUCHSIA">
+ <member values="VK_STRUCTURE_TYPE_IMAGE_FORMAT_CONSTRAINTS_INFO_FUCHSIA"><type>VkStructureType</type> <name>sType</name></member>
+ <member optional="true">const <type>void</type>* <name>pNext</name></member>
+ <member><type>VkImageCreateInfo</type> <name>imageCreateInfo</name></member>
+ <member><type>VkFormatFeatureFlags</type> <name>requiredFormatFeatures</name></member>
+ <member optional="true"><type>VkImageFormatConstraintsFlagsFUCHSIA</type> <name>flags</name></member>
+ <member optional="true"><type>uint64_t</type> <name>sysmemPixelFormat</name></member>
+ <member><type>uint32_t</type> <name>colorSpaceCount</name></member>
+ <member len="colorSpaceCount">const <type>VkSysmemColorSpaceFUCHSIA</type>* <name>pColorSpaces</name></member>
+ </type>
+ <type category="struct" name="VkImageConstraintsInfoFUCHSIA">
+ <member values="VK_STRUCTURE_TYPE_IMAGE_CONSTRAINTS_INFO_FUCHSIA"><type>VkStructureType</type> <name>sType</name></member>
+ <member optional="true">const <type>void</type>* <name>pNext</name></member>
+ <member><type>uint32_t</type> <name>formatConstraintsCount</name></member>
+ <member len="formatConstraintsCount">const <type>VkImageFormatConstraintsInfoFUCHSIA</type>* <name>pFormatConstraints</name></member>
+ <member><type>VkBufferCollectionConstraintsInfoFUCHSIA</type> <name>bufferCollectionConstraints</name></member>
+ <member optional="true"><type>VkImageConstraintsInfoFlagsFUCHSIA</type> <name>flags</name></member>
+ </type>
+ <type category="struct" name="VkBufferCollectionConstraintsInfoFUCHSIA">
+ <member values="VK_STRUCTURE_TYPE_BUFFER_COLLECTION_CONSTRAINTS_INFO_FUCHSIA"><type>VkStructureType</type> <name>sType</name></member>
+ <member optional="true">const <type>void</type>* <name>pNext</name></member>
+ <member><type>uint32_t</type> <name>minBufferCount</name></member>
+ <member><type>uint32_t</type> <name>maxBufferCount</name></member>
+ <member><type>uint32_t</type> <name>minBufferCountForCamping</name></member>
+ <member><type>uint32_t</type> <name>minBufferCountForDedicatedSlack</name></member>
+ <member><type>uint32_t</type> <name>minBufferCountForSharedSlack</name></member>
+ </type>
+ <type category="struct" name="VkPhysicalDeviceRGBA10X6FormatsFeaturesEXT" structextends="VkPhysicalDeviceFeatures2,VkDeviceCreateInfo">
+ <member values="VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_RGBA10X6_FORMATS_FEATURES_EXT"><type>VkStructureType</type> <name>sType</name></member>
+ <member optional="true" noautovalidity="true"><type>void</type>* <name>pNext</name></member>
+ <member><type>VkBool32</type> <name>formatRgba10x6WithoutYCbCrSampler</name></member>
+ </type>
+ <type category="struct" name="VkFormatProperties3" returnedonly="true" structextends="VkFormatProperties2">
+ <member values="VK_STRUCTURE_TYPE_FORMAT_PROPERTIES_3"><type>VkStructureType</type> <name>sType</name></member>
+ <member optional="true"><type>void</type>* <name>pNext</name></member>
+ <member optional="true" limittype="bitmask"><type>VkFormatFeatureFlags2</type> <name>linearTilingFeatures</name></member>
+ <member optional="true" limittype="bitmask"><type>VkFormatFeatureFlags2</type> <name>optimalTilingFeatures</name></member>
+ <member optional="true" limittype="bitmask"><type>VkFormatFeatureFlags2</type> <name>bufferFeatures</name></member>
+ </type>
+ <type category="struct" name="VkFormatProperties3KHR" alias="VkFormatProperties3"/>
+ <type category="struct" name="VkDrmFormatModifierPropertiesList2EXT" returnedonly="true" structextends="VkFormatProperties2">
+ <member values="VK_STRUCTURE_TYPE_DRM_FORMAT_MODIFIER_PROPERTIES_LIST_2_EXT"><type>VkStructureType</type> <name>sType</name></member>
+ <member optional="true"><type>void</type>* <name>pNext</name></member>
+ <member optional="true"><type>uint32_t</type> <name>drmFormatModifierCount</name></member>
+ <member optional="true" len="drmFormatModifierCount"><type>VkDrmFormatModifierProperties2EXT</type>* <name>pDrmFormatModifierProperties</name></member>
+ </type>
+ <type category="struct" name="VkDrmFormatModifierProperties2EXT" returnedonly="true">
+ <member><type>uint64_t</type> <name>drmFormatModifier</name></member>
+ <member><type>uint32_t</type> <name>drmFormatModifierPlaneCount</name></member>
+ <member><type>VkFormatFeatureFlags2</type> <name>drmFormatModifierTilingFeatures</name></member>
+ </type>
+ <type category="struct" name="VkAndroidHardwareBufferFormatProperties2ANDROID" structextends="VkAndroidHardwareBufferPropertiesANDROID" returnedonly="true">
+ <member values="VK_STRUCTURE_TYPE_ANDROID_HARDWARE_BUFFER_FORMAT_PROPERTIES_2_ANDROID"><type>VkStructureType</type> <name>sType</name></member>
+ <member optional="true"><type>void</type>* <name>pNext</name></member>
+ <member><type>VkFormat</type> <name>format</name></member>
+ <member><type>uint64_t</type> <name>externalFormat</name></member>
+ <member><type>VkFormatFeatureFlags2</type> <name>formatFeatures</name></member>
+ <member><type>VkComponentMapping</type> <name>samplerYcbcrConversionComponents</name></member>
+ <member><type>VkSamplerYcbcrModelConversion</type> <name>suggestedYcbcrModel</name></member>
+ <member><type>VkSamplerYcbcrRange</type> <name>suggestedYcbcrRange</name></member>
+ <member><type>VkChromaLocation</type> <name>suggestedXChromaOffset</name></member>
+ <member><type>VkChromaLocation</type> <name>suggestedYChromaOffset</name></member>
+ </type>
+ <type category="struct" name="VkPipelineRenderingCreateInfo" structextends="VkGraphicsPipelineCreateInfo">
+ <member values="VK_STRUCTURE_TYPE_PIPELINE_RENDERING_CREATE_INFO"><type>VkStructureType</type> <name>sType</name></member>
+ <member optional="true">const <type>void</type>* <name>pNext</name></member>
+ <member><type>uint32_t</type> <name>viewMask</name></member>
+ <member optional="true"><type>uint32_t</type> <name>colorAttachmentCount</name></member>
+ <member noautovalidity="true" len="colorAttachmentCount">const <type>VkFormat</type>* <name>pColorAttachmentFormats</name></member>
+ <member noautovalidity="true"><type>VkFormat</type> <name>depthAttachmentFormat</name></member>
+ <member noautovalidity="true"><type>VkFormat</type> <name>stencilAttachmentFormat</name></member>
+ </type>
+ <type category="struct" name="VkPipelineRenderingCreateInfoKHR" alias="VkPipelineRenderingCreateInfo"/>
+ <type category="struct" name="VkRenderingInfo">
+ <member values="VK_STRUCTURE_TYPE_RENDERING_INFO"><type>VkStructureType</type> <name>sType</name></member>
+ <member optional="true">const <type>void</type>* <name>pNext</name></member>
+ <member optional="true"><type>VkRenderingFlags</type> <name>flags</name></member>
+ <member><type>VkRect2D</type> <name>renderArea</name></member>
+ <member><type>uint32_t</type> <name>layerCount</name></member>
+ <member><type>uint32_t</type> <name>viewMask</name></member>
+ <member optional="true"><type>uint32_t</type> <name>colorAttachmentCount</name></member>
+ <member len="colorAttachmentCount">const <type>VkRenderingAttachmentInfo</type>* <name>pColorAttachments</name></member>
+ <member optional="true">const <type>VkRenderingAttachmentInfo</type>* <name>pDepthAttachment</name></member>
+ <member optional="true">const <type>VkRenderingAttachmentInfo</type>* <name>pStencilAttachment</name></member>
+ </type>
+ <type category="struct" name="VkRenderingInfoKHR" alias="VkRenderingInfo"/>
+ <type category="struct" name="VkRenderingAttachmentInfo">
+ <member values="VK_STRUCTURE_TYPE_RENDERING_ATTACHMENT_INFO"><type>VkStructureType</type> <name>sType</name></member>
+ <member optional="true">const <type>void</type>* <name>pNext</name></member>
+ <member optional="true"><type>VkImageView</type> <name>imageView</name></member>
+ <member><type>VkImageLayout</type> <name>imageLayout</name></member>
+ <member optional="true"><type>VkResolveModeFlagBits</type> <name>resolveMode</name></member>
+ <member optional="true"><type>VkImageView</type> <name>resolveImageView</name></member>
+ <member><type>VkImageLayout</type> <name>resolveImageLayout</name></member>
+ <member><type>VkAttachmentLoadOp</type> <name>loadOp</name></member>
+ <member><type>VkAttachmentStoreOp</type> <name>storeOp</name></member>
+ <member><type>VkClearValue</type> <name>clearValue</name></member>
+ </type>
+ <type category="struct" name="VkRenderingAttachmentInfoKHR" alias="VkRenderingAttachmentInfo"/>
+ <type category="struct" name="VkRenderingFragmentShadingRateAttachmentInfoKHR" structextends="VkRenderingInfo">
+ <member values="VK_STRUCTURE_TYPE_RENDERING_FRAGMENT_SHADING_RATE_ATTACHMENT_INFO_KHR"><type>VkStructureType</type> <name>sType</name></member>
+ <member optional="true">const <type>void</type>* <name>pNext</name></member>
+ <member optional="true"><type>VkImageView</type> <name>imageView</name></member>
+ <member><type>VkImageLayout</type> <name>imageLayout</name></member>
+ <member><type>VkExtent2D</type> <name>shadingRateAttachmentTexelSize</name></member>
+ </type>
+ <type category="struct" name="VkRenderingFragmentDensityMapAttachmentInfoEXT" structextends="VkRenderingInfo">
+ <member values="VK_STRUCTURE_TYPE_RENDERING_FRAGMENT_DENSITY_MAP_ATTACHMENT_INFO_EXT"><type>VkStructureType</type> <name>sType</name></member>
+ <member optional="true">const <type>void</type>* <name>pNext</name></member>
+ <member><type>VkImageView</type> <name>imageView</name></member>
+ <member><type>VkImageLayout</type> <name>imageLayout</name></member>
+ </type>
+ <type category="struct" name="VkPhysicalDeviceDynamicRenderingFeatures" structextends="VkPhysicalDeviceFeatures2,VkDeviceCreateInfo">
+ <member values="VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_DYNAMIC_RENDERING_FEATURES"><type>VkStructureType</type> <name>sType</name></member>
+ <member optional="true" noautovalidity="true"><type>void</type>* <name>pNext</name></member>
+ <member><type>VkBool32</type> <name>dynamicRendering</name></member>
+ </type>
+ <type category="struct" name="VkPhysicalDeviceDynamicRenderingFeaturesKHR" alias="VkPhysicalDeviceDynamicRenderingFeatures"/>
+ <type category="struct" name="VkCommandBufferInheritanceRenderingInfo" structextends="VkCommandBufferInheritanceInfo">
+ <member values="VK_STRUCTURE_TYPE_COMMAND_BUFFER_INHERITANCE_RENDERING_INFO"><type>VkStructureType</type> <name>sType</name></member>
+ <member optional="true">const <type>void</type>* <name>pNext</name></member>
+ <member optional="true"><type>VkRenderingFlags</type> <name>flags</name></member>
+ <member><type>uint32_t</type> <name>viewMask</name></member>
+ <member optional="true"><type>uint32_t</type> <name>colorAttachmentCount</name></member>
+ <member len="colorAttachmentCount">const <type>VkFormat</type>* <name>pColorAttachmentFormats</name></member>
+ <member><type>VkFormat</type> <name>depthAttachmentFormat</name></member>
+ <member><type>VkFormat</type> <name>stencilAttachmentFormat</name></member>
+ <member optional="true"><type>VkSampleCountFlagBits</type> <name>rasterizationSamples</name></member>
+ </type>
+ <type category="struct" name="VkCommandBufferInheritanceRenderingInfoKHR" alias="VkCommandBufferInheritanceRenderingInfo"/>
+ <type category="struct" name="VkAttachmentSampleCountInfoAMD" structextends="VkCommandBufferInheritanceInfo,VkGraphicsPipelineCreateInfo">
+ <member values="VK_STRUCTURE_TYPE_ATTACHMENT_SAMPLE_COUNT_INFO_AMD"><type>VkStructureType</type> <name>sType</name></member>
+ <member optional="true">const <type>void</type>* <name>pNext</name></member>
+ <member optional="true"><type>uint32_t</type> <name>colorAttachmentCount</name></member>
+ <member noautovalidity="true" len="colorAttachmentCount">const <type>VkSampleCountFlagBits</type>* <name>pColorAttachmentSamples</name></member>
+ <member noautovalidity="true" optional="true"><type>VkSampleCountFlagBits</type> <name>depthStencilAttachmentSamples</name></member>
+ </type>
+ <type category="struct" name="VkAttachmentSampleCountInfoNV" alias="VkAttachmentSampleCountInfoAMD"/>
+ <type category="struct" name="VkMultiviewPerViewAttributesInfoNVX" structextends="VkCommandBufferInheritanceInfo,VkGraphicsPipelineCreateInfo,VkRenderingInfo">
+ <member values="VK_STRUCTURE_TYPE_MULTIVIEW_PER_VIEW_ATTRIBUTES_INFO_NVX"><type>VkStructureType</type> <name>sType</name></member>
+ <member optional="true">const <type>void</type>* <name>pNext</name></member>
+ <member><type>VkBool32</type> <name>perViewAttributes</name></member>
+ <member><type>VkBool32</type> <name>perViewAttributesPositionXOnly</name></member>
+ </type>
+ <type category="struct" name="VkPhysicalDeviceImageViewMinLodFeaturesEXT" structextends="VkPhysicalDeviceFeatures2,VkDeviceCreateInfo">
+ <member values="VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_IMAGE_VIEW_MIN_LOD_FEATURES_EXT"><type>VkStructureType</type> <name>sType</name></member>
+ <member optional="true" noautovalidity="true"><type>void</type>* <name>pNext</name></member>
+ <member><type>VkBool32</type> <name>minLod</name></member>
+ </type>
+ <type category="struct" name="VkImageViewMinLodCreateInfoEXT" structextends="VkImageViewCreateInfo">
+ <member values="VK_STRUCTURE_TYPE_IMAGE_VIEW_MIN_LOD_CREATE_INFO_EXT"><type>VkStructureType</type> <name>sType</name></member>
+ <member optional="true">const <type>void</type>* <name>pNext</name></member>
+ <member><type>float</type> <name>minLod</name></member>
+ </type>
+ <type category="struct" name="VkPhysicalDeviceRasterizationOrderAttachmentAccessFeaturesARM" structextends="VkPhysicalDeviceFeatures2,VkDeviceCreateInfo">
+ <member values="VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_RASTERIZATION_ORDER_ATTACHMENT_ACCESS_FEATURES_ARM"><type>VkStructureType</type> <name>sType</name></member>
+ <member optional="true"><type>void</type>* <name>pNext</name></member>
+ <member><type>VkBool32</type> <name>rasterizationOrderColorAttachmentAccess</name></member>
+ <member><type>VkBool32</type> <name>rasterizationOrderDepthAttachmentAccess</name></member>
+ <member><type>VkBool32</type> <name>rasterizationOrderStencilAttachmentAccess</name></member>
+ </type>
+ <type category="struct" name="VkPhysicalDeviceLinearColorAttachmentFeaturesNV" structextends="VkPhysicalDeviceFeatures2,VkDeviceCreateInfo">
+ <member values="VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_LINEAR_COLOR_ATTACHMENT_FEATURES_NV"><type>VkStructureType</type> <name>sType</name></member>
+ <member optional="true" noautovalidity="true"><type>void</type>* <name>pNext</name></member>
+ <member><type>VkBool32</type> <name>linearColorAttachment</name></member>
+ </type>
+ <type category="struct" name="VkPhysicalDeviceGraphicsPipelineLibraryFeaturesEXT" structextends="VkPhysicalDeviceFeatures2,VkDeviceCreateInfo">
+ <member values="VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_GRAPHICS_PIPELINE_LIBRARY_FEATURES_EXT"><type>VkStructureType</type> <name>sType</name></member>
+ <member optional="true"><type>void</type>* <name>pNext</name></member>
+ <member><type>VkBool32</type> <name>graphicsPipelineLibrary</name></member>
+ </type>
+ <type category="struct" name="VkPhysicalDeviceGraphicsPipelineLibraryPropertiesEXT" structextends="VkPhysicalDeviceProperties2">
+ <member values="VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_GRAPHICS_PIPELINE_LIBRARY_PROPERTIES_EXT"><type>VkStructureType</type> <name>sType</name></member>
+ <member optional="true"><type>void</type>* <name>pNext</name></member>
+ <member limittype="bitmask"><type>VkBool32</type> <name>graphicsPipelineLibraryFastLinking</name></member>
+ <member limittype="bitmask"><type>VkBool32</type> <name>graphicsPipelineLibraryIndependentInterpolationDecoration</name></member>
+ </type>
+ <type category="struct" name="VkGraphicsPipelineLibraryCreateInfoEXT" structextends="VkGraphicsPipelineCreateInfo">
+ <member values="VK_STRUCTURE_TYPE_GRAPHICS_PIPELINE_LIBRARY_CREATE_INFO_EXT"><type>VkStructureType</type> <name>sType</name></member>
+ <member optional="true"><type>void</type>* <name>pNext</name></member>
+ <member><type>VkGraphicsPipelineLibraryFlagsEXT</type> <name>flags</name></member>
+ </type>
+ <type category="struct" name="VkPhysicalDeviceDescriptorSetHostMappingFeaturesVALVE" structextends="VkPhysicalDeviceFeatures2,VkDeviceCreateInfo">
+ <member values="VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_DESCRIPTOR_SET_HOST_MAPPING_FEATURES_VALVE"><type>VkStructureType</type> <name>sType</name></member>
+ <member optional="true" noautovalidity="true"><type>void</type>* <name>pNext</name></member>
+ <member><type>VkBool32</type> <name>descriptorSetHostMapping</name></member>
+ </type>
+ <type category="struct" name="VkDescriptorSetBindingReferenceVALVE">
+ <member values="VK_STRUCTURE_TYPE_DESCRIPTOR_SET_BINDING_REFERENCE_VALVE"><type>VkStructureType</type> <name>sType</name></member>
+ <member optional="true">const <type>void</type>* <name>pNext</name></member>
+ <member><type>VkDescriptorSetLayout</type> <name>descriptorSetLayout</name></member>
+ <member><type>uint32_t</type> <name>binding</name></member>
+ </type>
+ <type category="struct" name="VkDescriptorSetLayoutHostMappingInfoVALVE">
+ <member values="VK_STRUCTURE_TYPE_DESCRIPTOR_SET_LAYOUT_HOST_MAPPING_INFO_VALVE"><type>VkStructureType</type> <name>sType</name></member>
+ <member optional="true"><type>void</type>* <name>pNext</name></member>
+ <member><type>size_t</type> <name>descriptorOffset</name></member>
+ <member><type>uint32_t</type> <name>descriptorSize</name></member>
+ </type>
+ <type category="struct" name="VkPhysicalDeviceShaderModuleIdentifierFeaturesEXT" structextends="VkPhysicalDeviceFeatures2,VkDeviceCreateInfo">
+ <member values="VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_SHADER_MODULE_IDENTIFIER_FEATURES_EXT"><type>VkStructureType</type> <name>sType</name></member>
+ <member optional="true" noautovalidity="true"><type>void</type>* <name>pNext</name></member>
+ <member><type>VkBool32</type> <name>shaderModuleIdentifier</name></member>
+ </type>
+ <type category="struct" name="VkPhysicalDeviceShaderModuleIdentifierPropertiesEXT" returnedonly="true" structextends="VkPhysicalDeviceProperties2">
+ <member values="VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_SHADER_MODULE_IDENTIFIER_PROPERTIES_EXT"><type>VkStructureType</type> <name>sType</name></member>
+ <member optional="true" noautovalidity="true"><type>void</type>* <name>pNext</name></member>
+ <member limittype="noauto"><type>uint8_t</type> <name>shaderModuleIdentifierAlgorithmUUID</name>[<enum>VK_UUID_SIZE</enum>]</member>
+ </type>
+ <type category="struct" name="VkPipelineShaderStageModuleIdentifierCreateInfoEXT" structextends="VkPipelineShaderStageCreateInfo">
+ <member values="VK_STRUCTURE_TYPE_PIPELINE_SHADER_STAGE_MODULE_IDENTIFIER_CREATE_INFO_EXT"><type>VkStructureType</type> <name>sType</name></member>
+ <member optional="true">const <type>void</type>* <name>pNext</name></member>
+ <member optional="true"><type>uint32_t</type> <name>identifierSize</name></member>
+ <member len="identifierSize">const <type>uint8_t</type>* <name>pIdentifier</name></member>
+ </type>
+ <type category="struct" name="VkShaderModuleIdentifierEXT" returnedonly="true">
+ <member values="VK_STRUCTURE_TYPE_SHADER_MODULE_IDENTIFIER_EXT"><type>VkStructureType</type> <name>sType</name></member>
+ <member optional="true"><type>void</type>* <name>pNext</name></member>
+ <member noautovalidity="true"><type>uint32_t</type> <name>identifierSize</name></member>
+ <member><type>uint8_t</type> <name>identifier</name>[<enum>VK_MAX_SHADER_MODULE_IDENTIFIER_SIZE_EXT</enum>]</member>
+ </type>
+ <type category="struct" name="VkImageCompressionControlEXT" structextends="VkImageCreateInfo,VkSwapchainCreateInfoKHR,VkPhysicalDeviceImageFormatInfo2">
+ <member values="VK_STRUCTURE_TYPE_IMAGE_COMPRESSION_CONTROL_EXT"><type>VkStructureType</type> <name>sType</name></member>
+ <member optional="true">const <type>void</type>* <name>pNext</name></member>
+ <member noautovalidity="true"><type>VkImageCompressionFlagsEXT</type> <name>flags</name></member>
+ <member optional="true"><type>uint32_t</type> <name>compressionControlPlaneCount</name></member>
+ <member noautovalidity="true" len="compressionControlPlaneCount"><type>VkImageCompressionFixedRateFlagsEXT</type>* <name>pFixedRateFlags</name></member>
+ </type>
+ <type category="struct" name="VkPhysicalDeviceImageCompressionControlFeaturesEXT" structextends="VkPhysicalDeviceFeatures2,VkDeviceCreateInfo">
+ <member values="VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_IMAGE_COMPRESSION_CONTROL_FEATURES_EXT"><type>VkStructureType</type> <name>sType</name></member>
+ <member optional="true" noautovalidity="true"><type>void</type>* <name>pNext</name></member>
+ <member><type>VkBool32</type> <name>imageCompressionControl</name></member>
+ </type>
+ <type category="struct" name="VkImageCompressionPropertiesEXT" structextends="VkImageFormatProperties2,VkSurfaceFormat2KHR,VkSubresourceLayout2EXT" returnedonly="true">
+ <member values="VK_STRUCTURE_TYPE_IMAGE_COMPRESSION_PROPERTIES_EXT"><type>VkStructureType</type> <name>sType</name></member>
+ <member optional="true"><type>void</type>* <name>pNext</name></member>
+ <member><type>VkImageCompressionFlagsEXT</type> <name>imageCompressionFlags</name></member>
+ <member><type>VkImageCompressionFixedRateFlagsEXT</type> <name>imageCompressionFixedRateFlags</name></member>
+ </type>
+ <type category="struct" name="VkPhysicalDeviceImageCompressionControlSwapchainFeaturesEXT" structextends="VkPhysicalDeviceFeatures2,VkDeviceCreateInfo">
+ <member values="VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_IMAGE_COMPRESSION_CONTROL_SWAPCHAIN_FEATURES_EXT"><type>VkStructureType</type> <name>sType</name></member>
+ <member optional="true" noautovalidity="true"><type>void</type>* <name>pNext</name></member>
+ <member><type>VkBool32</type> <name>imageCompressionControlSwapchain</name></member>
+ </type>
+ <type category="struct" name="VkImageSubresource2EXT">
+ <member values="VK_STRUCTURE_TYPE_IMAGE_SUBRESOURCE_2_EXT"><type>VkStructureType</type> <name>sType</name></member>
+ <member optional="true"><type>void</type>* <name>pNext</name></member>
+ <member><type>VkImageSubresource</type> <name>imageSubresource</name></member>
+ </type>
+ <type category="struct" name="VkSubresourceLayout2EXT" returnedonly="true">
+ <member values="VK_STRUCTURE_TYPE_SUBRESOURCE_LAYOUT_2_EXT"><type>VkStructureType</type> <name>sType</name></member>
+ <member optional="true"><type>void</type>* <name>pNext</name></member>
+ <member><type>VkSubresourceLayout</type> <name>subresourceLayout</name></member>
+ </type>
+ <type category="struct" name="VkRenderPassCreationControlEXT" structextends="VkRenderPassCreateInfo2,VkSubpassDescription2">
+ <member values="VK_STRUCTURE_TYPE_RENDER_PASS_CREATION_CONTROL_EXT"><type>VkStructureType</type> <name>sType</name></member>
+ <member optional="true">const <type>void</type>* <name>pNext</name></member>
+ <member><type>VkBool32</type> <name>disallowMerging</name></member>
+ </type>
+ <type category="struct" name="VkRenderPassCreationFeedbackInfoEXT" returnedonly="true">
+ <member><type>uint32_t</type> <name>postMergeSubpassCount</name></member>
+ </type>
+ <type category="struct" name="VkRenderPassCreationFeedbackCreateInfoEXT" structextends="VkRenderPassCreateInfo2">
+ <member values="VK_STRUCTURE_TYPE_RENDER_PASS_CREATION_FEEDBACK_CREATE_INFO_EXT"><type>VkStructureType</type> <name>sType</name></member>
+ <member optional="true">const <type>void</type>* <name>pNext</name></member>
+ <member><type>VkRenderPassCreationFeedbackInfoEXT</type>* <name>pRenderPassFeedback</name></member>
+ </type>
+ <type category="struct" name="VkRenderPassSubpassFeedbackInfoEXT" returnedonly="true">
+ <member><type>VkSubpassMergeStatusEXT</type> <name>subpassMergeStatus</name></member>
+ <member><type>char</type> <name>description</name>[<enum>VK_MAX_DESCRIPTION_SIZE</enum>]</member>
+ <member><type>uint32_t</type> <name>postMergeIndex</name></member>
+ </type>
+ <type category="struct" name="VkRenderPassSubpassFeedbackCreateInfoEXT" structextends="VkSubpassDescription2">
+ <member values="VK_STRUCTURE_TYPE_RENDER_PASS_SUBPASS_FEEDBACK_CREATE_INFO_EXT"><type>VkStructureType</type> <name>sType</name></member>
+ <member optional="true">const <type>void</type>* <name>pNext</name></member>
+ <member><type>VkRenderPassSubpassFeedbackInfoEXT</type>* <name>pSubpassFeedback</name></member>
+ </type>
+ <type category="struct" name="VkPhysicalDeviceSubpassMergeFeedbackFeaturesEXT" structextends="VkPhysicalDeviceFeatures2,VkDeviceCreateInfo">
+ <member values="VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_SUBPASS_MERGE_FEEDBACK_FEATURES_EXT"><type>VkStructureType</type> <name>sType</name></member>
+ <member optional="true" noautovalidity="true"><type>void</type>* <name>pNext</name></member>
+ <member><type>VkBool32</type> <name>subpassMergeFeedback</name></member>
+ </type>
+ <type category="struct" name="VkPipelinePropertiesIdentifierEXT">
+ <member values="VK_STRUCTURE_TYPE_PIPELINE_PROPERTIES_IDENTIFIER_EXT"><type>VkStructureType</type> <name>sType</name></member>
+ <member optional="true"><type>void</type>* <name>pNext</name></member>
+ <member><type>uint8_t</type> <name>pipelineIdentifier</name>[<enum>VK_UUID_SIZE</enum>]</member>
+ </type>
+ <type category="struct" name="VkPhysicalDevicePipelinePropertiesFeaturesEXT" structextends="VkPhysicalDeviceFeatures2,VkDeviceCreateInfo">
+ <member values="VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_PIPELINE_PROPERTIES_FEATURES_EXT"><type>VkStructureType</type> <name>sType</name></member>
+ <member optional="true" noautovalidity="true"><type>void</type>* <name>pNext</name></member>
+ <member><type>VkBool32</type> <name>pipelinePropertiesIdentifier</name></member>
+ </type>
+ <type category="struct" name="VkPhysicalDeviceShaderEarlyAndLateFragmentTestsFeaturesAMD" structextends="VkPhysicalDeviceFeatures2,VkDeviceCreateInfo">
+ <member values="VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_SHADER_EARLY_AND_LATE_FRAGMENT_TESTS_FEATURES_AMD"><type>VkStructureType</type> <name>sType</name></member>
+ <member noautovalidity="true" optional="true"><type>void</type>* <name>pNext</name></member>
+ <member><type>VkBool32</type> <name>shaderEarlyAndLateFragmentTests</name></member>
+ </type>
+ <type category="struct" name="VkExportMetalObjectCreateInfoEXT" structextends="VkInstanceCreateInfo,VkMemoryAllocateInfo,VkImageCreateInfo,VkImageViewCreateInfo,VkBufferViewCreateInfo,VkSemaphoreCreateInfo,VkEventCreateInfo" allowduplicate="true">
+ <member values="VK_STRUCTURE_TYPE_EXPORT_METAL_OBJECT_CREATE_INFO_EXT"><type>VkStructureType</type> <name>sType</name></member>
+ <member optional="true">const <type>void</type>* <name>pNext</name></member>
+ <member optional="true"><type>VkExportMetalObjectTypeFlagBitsEXT</type> <name>exportObjectType</name></member>
+ </type>
+ <type category="struct" name="VkExportMetalObjectsInfoEXT">
+ <member values="VK_STRUCTURE_TYPE_EXPORT_METAL_OBJECTS_INFO_EXT"><type>VkStructureType</type> <name>sType</name></member>
+ <member optional="true">const <type>void</type>* <name>pNext</name></member>
+ </type>
+ <type category="struct" name="VkExportMetalDeviceInfoEXT" structextends="VkExportMetalObjectsInfoEXT">
+ <member values="VK_STRUCTURE_TYPE_EXPORT_METAL_DEVICE_INFO_EXT"><type>VkStructureType</type> <name>sType</name></member>
+ <member optional="true">const <type>void</type>* <name>pNext</name></member>
+ <member><type>MTLDevice_id</type> <name>mtlDevice</name></member>
+ </type>
+ <type category="struct" name="VkExportMetalCommandQueueInfoEXT" structextends="VkExportMetalObjectsInfoEXT" allowduplicate="true">
+ <member values="VK_STRUCTURE_TYPE_EXPORT_METAL_COMMAND_QUEUE_INFO_EXT"><type>VkStructureType</type> <name>sType</name></member>
+ <member optional="true">const <type>void</type>* <name>pNext</name></member>
+ <member><type>VkQueue</type> <name>queue</name></member>
+ <member><type>MTLCommandQueue_id</type> <name>mtlCommandQueue</name></member>
+ </type>
+ <type category="struct" name="VkExportMetalBufferInfoEXT" structextends="VkExportMetalObjectsInfoEXT" allowduplicate="true">
+ <member values="VK_STRUCTURE_TYPE_EXPORT_METAL_BUFFER_INFO_EXT"><type>VkStructureType</type> <name>sType</name></member>
+ <member optional="true">const <type>void</type>* <name>pNext</name></member>
+ <member><type>VkDeviceMemory</type> <name>memory</name></member>
+ <member><type>MTLBuffer_id</type> <name>mtlBuffer</name></member>
+ </type>
+ <type category="struct" name="VkImportMetalBufferInfoEXT" structextends="VkMemoryAllocateInfo" allowduplicate="false">
+ <member values="VK_STRUCTURE_TYPE_IMPORT_METAL_BUFFER_INFO_EXT"><type>VkStructureType</type> <name>sType</name></member>
+ <member optional="true">const <type>void</type>* <name>pNext</name></member>
+ <member><type>MTLBuffer_id</type> <name>mtlBuffer</name></member>
+ </type>
+ <type category="struct" name="VkExportMetalTextureInfoEXT" structextends="VkExportMetalObjectsInfoEXT" allowduplicate="true">
+ <member values="VK_STRUCTURE_TYPE_EXPORT_METAL_TEXTURE_INFO_EXT"><type>VkStructureType</type> <name>sType</name></member>
+ <member optional="true">const <type>void</type>* <name>pNext</name></member>
+ <member optional="true"><type>VkImage</type> <name>image</name></member>
+ <member optional="true"><type>VkImageView</type> <name>imageView</name></member>
+ <member optional="true"><type>VkBufferView</type> <name>bufferView</name></member>
+ <member><type>VkImageAspectFlagBits</type> <name>plane</name></member>
+ <member><type>MTLTexture_id</type> <name>mtlTexture</name></member>
+ </type>
+ <type category="struct" name="VkImportMetalTextureInfoEXT" structextends="VkImageCreateInfo" allowduplicate="true">
+ <member values="VK_STRUCTURE_TYPE_IMPORT_METAL_TEXTURE_INFO_EXT"><type>VkStructureType</type> <name>sType</name></member>
+ <member optional="true">const <type>void</type>* <name>pNext</name></member>
+ <member><type>VkImageAspectFlagBits</type> <name>plane</name></member>
+ <member><type>MTLTexture_id</type> <name>mtlTexture</name></member>
+ </type>
+ <type category="struct" name="VkExportMetalIOSurfaceInfoEXT" structextends="VkExportMetalObjectsInfoEXT" allowduplicate="true">
+ <member values="VK_STRUCTURE_TYPE_EXPORT_METAL_IO_SURFACE_INFO_EXT"><type>VkStructureType</type> <name>sType</name></member>
+ <member optional="true">const <type>void</type>* <name>pNext</name></member>
+ <member><type>VkImage</type> <name>image</name></member>
+ <member><type>IOSurfaceRef</type> <name>ioSurface</name></member>
+ </type>
+ <type category="struct" name="VkImportMetalIOSurfaceInfoEXT" structextends="VkImageCreateInfo" allowduplicate="false">
+ <member values="VK_STRUCTURE_TYPE_IMPORT_METAL_IO_SURFACE_INFO_EXT"><type>VkStructureType</type> <name>sType</name></member>
+ <member optional="true">const <type>void</type>* <name>pNext</name></member>
+ <member optional="true"><type>IOSurfaceRef</type> <name>ioSurface</name></member>
+ </type>
+ <type category="struct" name="VkExportMetalSharedEventInfoEXT" structextends="VkExportMetalObjectsInfoEXT" allowduplicate="true">
+ <member values="VK_STRUCTURE_TYPE_EXPORT_METAL_SHARED_EVENT_INFO_EXT"><type>VkStructureType</type> <name>sType</name></member>
+ <member optional="true">const <type>void</type>* <name>pNext</name></member>
+ <member optional="true"><type>VkSemaphore</type> <name>semaphore</name></member>
+ <member optional="true"><type>VkEvent</type> <name>event</name></member>
+ <member><type>MTLSharedEvent_id</type> <name>mtlSharedEvent</name></member>
+ </type>
+ <type category="struct" name="VkImportMetalSharedEventInfoEXT" structextends="VkSemaphoreCreateInfo,VkEventCreateInfo" allowduplicate="false">
+ <member values="VK_STRUCTURE_TYPE_IMPORT_METAL_SHARED_EVENT_INFO_EXT"><type>VkStructureType</type> <name>sType</name></member>
+ <member optional="true">const <type>void</type>* <name>pNext</name></member>
+ <member><type>MTLSharedEvent_id</type> <name>mtlSharedEvent</name></member>
+ </type>
+ <type category="struct" name="VkPhysicalDeviceNonSeamlessCubeMapFeaturesEXT" structextends="VkPhysicalDeviceFeatures2,VkDeviceCreateInfo">
+ <member values="VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_NON_SEAMLESS_CUBE_MAP_FEATURES_EXT"><type>VkStructureType</type> <name>sType</name></member>
+ <member optional="true" noautovalidity="true"><type>void</type>* <name>pNext</name></member>
+ <member><type>VkBool32</type> <name>nonSeamlessCubeMap</name></member>
+ </type>
+ <type category="struct" name="VkPhysicalDevicePipelineRobustnessFeaturesEXT" structextends="VkPhysicalDeviceFeatures2,VkDeviceCreateInfo">
+ <member values="VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_PIPELINE_ROBUSTNESS_FEATURES_EXT"><type>VkStructureType</type> <name>sType</name></member>
+ <member noautovalidity="true" optional="true"><type>void</type>* <name>pNext</name></member>
+ <member><type>VkBool32</type> <name>pipelineRobustness</name></member>
+ </type>
+ <type category="struct" name="VkPipelineRobustnessCreateInfoEXT" structextends="VkGraphicsPipelineCreateInfo,VkComputePipelineCreateInfo,VkPipelineShaderStageCreateInfo,VkRayTracingPipelineCreateInfoKHR">
+ <member values="VK_STRUCTURE_TYPE_PIPELINE_ROBUSTNESS_CREATE_INFO_EXT"><type>VkStructureType</type> <name>sType</name></member>
+ <member noautovalidity="true" optional="true">const <type>void</type>* <name>pNext</name></member>
+ <member><type>VkPipelineRobustnessBufferBehaviorEXT</type> <name>storageBuffers</name></member>
+ <member><type>VkPipelineRobustnessBufferBehaviorEXT</type> <name>uniformBuffers</name></member>
+ <member><type>VkPipelineRobustnessBufferBehaviorEXT</type> <name>vertexInputs</name></member>
+ <member><type>VkPipelineRobustnessImageBehaviorEXT</type> <name>images</name></member>
+ </type>
+ <type category="struct" name="VkPhysicalDevicePipelineRobustnessPropertiesEXT" returnedonly="true" structextends="VkPhysicalDeviceProperties2">
+ <member values="VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_PIPELINE_ROBUSTNESS_PROPERTIES_EXT"><type>VkStructureType</type> <name>sType</name></member>
+ <member optional="true"><type>void</type>* <name>pNext</name></member>
+ <member limittype="exact"><type>VkPipelineRobustnessBufferBehaviorEXT</type> <name>defaultRobustnessStorageBuffers</name></member>
+ <member limittype="exact"><type>VkPipelineRobustnessBufferBehaviorEXT</type> <name>defaultRobustnessUniformBuffers</name></member>
+ <member limittype="exact"><type>VkPipelineRobustnessBufferBehaviorEXT</type> <name>defaultRobustnessVertexInputs</name></member>
+ <member limittype="exact"><type>VkPipelineRobustnessImageBehaviorEXT</type> <name>defaultRobustnessImages</name></member>
+ </type>
+ <type category="struct" name="VkImageViewSampleWeightCreateInfoQCOM" structextends="VkImageViewCreateInfo">
+ <member values="VK_STRUCTURE_TYPE_IMAGE_VIEW_SAMPLE_WEIGHT_CREATE_INFO_QCOM"><type>VkStructureType</type> <name>sType</name></member>
+ <member optional="true">const <type>void</type>* <name>pNext</name></member>
+ <member><type>VkOffset2D</type> <name>filterCenter</name></member>
+ <member><type>VkExtent2D</type> <name>filterSize</name></member>
+ <member><type>uint32_t</type> <name>numPhases</name></member>
+ </type>
+ <type category="struct" name="VkPhysicalDeviceImageProcessingFeaturesQCOM" structextends="VkPhysicalDeviceFeatures2,VkDeviceCreateInfo">
+ <member values="VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_IMAGE_PROCESSING_FEATURES_QCOM"><type>VkStructureType</type> <name>sType</name></member>
+ <member optional="true" noautovalidity="true"><type>void</type>* <name>pNext</name></member>
+ <member><type>VkBool32</type> <name>textureSampleWeighted</name></member>
+ <member><type>VkBool32</type> <name>textureBoxFilter</name></member>
+ <member><type>VkBool32</type> <name>textureBlockMatch</name></member>
+ </type>
+ <type category="struct" name="VkPhysicalDeviceImageProcessingPropertiesQCOM" returnedonly="true" structextends="VkPhysicalDeviceProperties2">
+ <member values="VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_IMAGE_PROCESSING_PROPERTIES_QCOM"><type>VkStructureType</type> <name>sType</name></member>
+ <member optional="true"><type>void</type>* <name>pNext</name></member>
+ <member limittype="max" optional="true"><type>uint32_t</type> <name>maxWeightFilterPhases</name></member>
+ <member limittype="max" optional="true"><type>VkExtent2D</type> <name>maxWeightFilterDimension</name></member>
+ <member limittype="max" optional="true"><type>VkExtent2D</type> <name>maxBlockMatchRegion</name></member>
+ <member limittype="max" optional="true"><type>VkExtent2D</type> <name>maxBoxFilterBlockSize</name></member>
+ </type>
+ <type category="struct" name="VkPhysicalDeviceTilePropertiesFeaturesQCOM" structextends="VkPhysicalDeviceFeatures2,VkDeviceCreateInfo">
+ <member values="VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_TILE_PROPERTIES_FEATURES_QCOM"><type>VkStructureType</type> <name>sType</name></member>
+ <member optional="true"><type>void</type>* <name>pNext</name></member>
+ <member><type>VkBool32</type> <name>tileProperties</name></member>
+ </type>
+ <type category="struct" name="VkTilePropertiesQCOM">
+ <member values="VK_STRUCTURE_TYPE_TILE_PROPERTIES_QCOM"><type>VkStructureType</type> <name>sType</name></member>
+ <member optional="true"><type>void</type>* <name>pNext</name></member>
+ <member><type>VkExtent3D</type> <name>tileSize</name></member>
+ <member><type>VkExtent2D</type> <name>apronSize</name></member>
+ <member><type>VkOffset2D</type> <name>origin</name></member>
+ </type>
</types>
+ <comment>Vulkan enumerant (token) definitions</comment>
- <!-- SECTION: Vulkan enumerant (token) definitions. -->
-
- <enums name="API Constants" comment="Misc. hardcoded constants - not an enumerated type">
- <!-- This is part of the header boilerplate -->
- <enum value="256" name="VK_MAX_PHYSICAL_DEVICE_NAME_SIZE"/>
- <enum value="16" name="VK_UUID_SIZE"/>
- <enum value="256" name="VK_MAX_EXTENSION_NAME_SIZE"/>
- <enum value="256" name="VK_MAX_DESCRIPTION_SIZE"/>
- <enum value="32" name="VK_MAX_MEMORY_TYPES"/>
- <enum value="16" name="VK_MAX_MEMORY_HEAPS"/> <!-- The maximum number of unique memory heaps, each of which supporting 1 or more memory types. -->
- <enum value="1000.0f" name="VK_LOD_CLAMP_NONE"/>
- <enum value="(~0U)" name="VK_REMAINING_MIP_LEVELS"/>
- <enum value="(~0U)" name="VK_REMAINING_ARRAY_LAYERS"/>
- <enum value="(~0ULL)" name="VK_WHOLE_SIZE"/>
- <enum value="(~0U)" name="VK_ATTACHMENT_UNUSED"/>
- <enum value="1" name="VK_TRUE"/>
- <enum value="0" name="VK_FALSE"/>
- <enum value="(~0U)" name="VK_QUEUE_FAMILY_IGNORED"/>
- <enum value="(~0U)" name="VK_SUBPASS_EXTERNAL"/>
+ <enums name="API Constants" comment="Vulkan hardcoded constants - not an enumerated type, part of the header boilerplate">
+ <enum type="uint32_t" value="256" name="VK_MAX_PHYSICAL_DEVICE_NAME_SIZE"/>
+ <enum type="uint32_t" value="16" name="VK_UUID_SIZE"/>
+ <enum type="uint32_t" value="8" name="VK_LUID_SIZE"/>
+ <enum name="VK_LUID_SIZE_KHR" alias="VK_LUID_SIZE"/>
+ <enum type="uint32_t" value="256" name="VK_MAX_EXTENSION_NAME_SIZE"/>
+ <enum type="uint32_t" value="256" name="VK_MAX_DESCRIPTION_SIZE"/>
+ <enum type="uint32_t" value="32" name="VK_MAX_MEMORY_TYPES"/>
+ <enum type="uint32_t" value="16" name="VK_MAX_MEMORY_HEAPS" comment="The maximum number of unique memory heaps, each of which supporting 1 or more memory types"/>
+ <enum type="float" value="1000.0F" name="VK_LOD_CLAMP_NONE"/>
+ <enum type="uint32_t" value="(~0U)" name="VK_REMAINING_MIP_LEVELS"/>
+ <enum type="uint32_t" value="(~0U)" name="VK_REMAINING_ARRAY_LAYERS"/>
+ <enum type="uint64_t" value="(~0ULL)" name="VK_WHOLE_SIZE"/>
+ <enum type="uint32_t" value="(~0U)" name="VK_ATTACHMENT_UNUSED"/>
+ <enum type="uint32_t" value="1" name="VK_TRUE"/>
+ <enum type="uint32_t" value="0" name="VK_FALSE"/>
+ <enum type="uint32_t" value="(~0U)" name="VK_QUEUE_FAMILY_IGNORED"/>
+ <enum type="uint32_t" value="(~1U)" name="VK_QUEUE_FAMILY_EXTERNAL"/>
+ <enum name="VK_QUEUE_FAMILY_EXTERNAL_KHR" alias="VK_QUEUE_FAMILY_EXTERNAL"/>
+ <enum type="uint32_t" value="(~2U)" name="VK_QUEUE_FAMILY_FOREIGN_EXT"/>
+ <enum type="uint32_t" value="(~0U)" name="VK_SUBPASS_EXTERNAL"/>
+ <enum type="uint32_t" value="32" name="VK_MAX_DEVICE_GROUP_SIZE"/>
+ <enum name="VK_MAX_DEVICE_GROUP_SIZE_KHR" alias="VK_MAX_DEVICE_GROUP_SIZE"/>
+ <enum type="uint32_t" value="256" name="VK_MAX_DRIVER_NAME_SIZE"/>
+ <enum name="VK_MAX_DRIVER_NAME_SIZE_KHR" alias="VK_MAX_DRIVER_NAME_SIZE"/>
+ <enum type="uint32_t" value="256" name="VK_MAX_DRIVER_INFO_SIZE"/>
+ <enum name="VK_MAX_DRIVER_INFO_SIZE_KHR" alias="VK_MAX_DRIVER_INFO_SIZE"/>
+ <enum type="uint32_t" value="(~0U)" name="VK_SHADER_UNUSED_KHR"/>
+ <enum name="VK_SHADER_UNUSED_NV" alias="VK_SHADER_UNUSED_KHR"/>
+ <enum type="uint32_t" value="16" name="VK_MAX_GLOBAL_PRIORITY_SIZE_KHR"/>
+ <enum name="VK_MAX_GLOBAL_PRIORITY_SIZE_EXT" alias="VK_MAX_GLOBAL_PRIORITY_SIZE_KHR"/>
+ <enum type="uint32_t" value="32" name="VK_MAX_SHADER_MODULE_IDENTIFIER_SIZE_EXT"/>
</enums>
- <!-- Unlike OpenGL, most tokens in Vulkan are actual typed enumerants in
- their own numeric namespaces. The "name" attribute is the C enum
- type name, and is pulled in from a <type> definition above
- (slightly clunky, but retains the type / enum distinction). "type"
- attributes of "enum" or "bitmask" indicate that these values should
- be generated inside an appropriate definition. -->
+ <comment>
+ Unlike OpenGL, most tokens in Vulkan are actual typed enumerants in
+ their own numeric namespaces. The "name" attribute is the C enum
+ type name, and is pulled in from a type tag definition above
+ (slightly clunky, but retains the type / enum distinction). "type"
+ attributes of "enum" or "bitmask" indicate that these values should
+ be generated inside an appropriate definition.
+ </comment>
<enums name="VkImageLayout" type="enum">
<enum value="0" name="VK_IMAGE_LAYOUT_UNDEFINED" comment="Implicit layout an image is when its contents are undefined due to various reasons (e.g. right after creation)"/>
@@ -1862,8 +7142,8 @@ maintained in the master branch of the Khronos Vulkan GitHub project.
<enum value="3" name="VK_IMAGE_LAYOUT_DEPTH_STENCIL_ATTACHMENT_OPTIMAL" comment="Optimal layout when image is only used for depth/stencil attachment read/write"/>
<enum value="4" name="VK_IMAGE_LAYOUT_DEPTH_STENCIL_READ_ONLY_OPTIMAL" comment="Optimal layout when image is used for read only depth/stencil attachment and shader access"/>
<enum value="5" name="VK_IMAGE_LAYOUT_SHADER_READ_ONLY_OPTIMAL" comment="Optimal layout when image is used for read only shader access"/>
- <enum value="6" name="VK_IMAGE_LAYOUT_TRANSFER_SRC_OPTIMAL" comment="Optimal layout when image is used only as source of transfer operations"/>
- <enum value="7" name="VK_IMAGE_LAYOUT_TRANSFER_DST_OPTIMAL" comment="Optimal layout when image is used only as destination of transfer operations"/>
+ <enum value="6" name="VK_IMAGE_LAYOUT_TRANSFER_SRC_OPTIMAL" comment="Optimal layout when image is used only as source of transfer operations"/>
+ <enum value="7" name="VK_IMAGE_LAYOUT_TRANSFER_DST_OPTIMAL" comment="Optimal layout when image is used only as destination of transfer operations"/>
<enum value="8" name="VK_IMAGE_LAYOUT_PREINITIALIZED" comment="Initial layout used when the data is populated by the CPU"/>
</enums>
<enums name="VkAttachmentLoadOp" type="enum">
@@ -1939,6 +7219,8 @@ maintained in the master branch of the Khronos Vulkan GitHub project.
<enums name="VkPipelineCacheHeaderVersion" type="enum">
<enum value="1" name="VK_PIPELINE_CACHE_HEADER_VERSION_ONE"/>
</enums>
+ <enums name="VkPipelineCacheCreateFlagBits" type="bitmask">
+ </enums>
<enums name="VkPrimitiveTopology" type="enum">
<enum value="0" name="VK_PRIMITIVE_TOPOLOGY_POINT_LIST"/>
<enum value="1" name="VK_PRIMITIVE_TOPOLOGY_LINE_LIST"/>
@@ -1973,7 +7255,11 @@ maintained in the master branch of the Khronos Vulkan GitHub project.
<enum value="1" name="VK_SAMPLER_ADDRESS_MODE_MIRRORED_REPEAT"/>
<enum value="2" name="VK_SAMPLER_ADDRESS_MODE_CLAMP_TO_EDGE"/>
<enum value="3" name="VK_SAMPLER_ADDRESS_MODE_CLAMP_TO_BORDER"/>
- <!-- <enum value="4" name="VK_SAMPLER_ADDRESS_MODE_MIRROR_CLAMP_TO_EDGE" comment="Reserved for VK_KHR_sampler_mirror_clamp_to_edge, do not alias!"/> -->
+ <comment>
+ value="4" reserved for VK_KHR_sampler_mirror_clamp_to_edge
+ enum VK_SAMPLER_ADDRESS_MODE_MIRROR_CLAMP_TO_EDGE; do not
+ alias!
+ </comment>
</enums>
<enums name="VkCompareOp" type="enum">
<enum value="0" name="VK_COMPARE_OP_NEVER"/>
@@ -1990,12 +7276,6 @@ maintained in the master branch of the Khronos Vulkan GitHub project.
<enum value="1" name="VK_POLYGON_MODE_LINE"/>
<enum value="2" name="VK_POLYGON_MODE_POINT"/>
</enums>
- <enums name="VkCullModeFlagBits" type="bitmask">
- <enum value="0" name="VK_CULL_MODE_NONE"/>
- <enum bitpos="0" name="VK_CULL_MODE_FRONT_BIT"/>
- <enum bitpos="1" name="VK_CULL_MODE_BACK_BIT"/>
- <enum value="0x00000003" name="VK_CULL_MODE_FRONT_AND_BACK"/>
- </enums>
<enums name="VkFrontFace" type="enum">
<enum value="0" name="VK_FRONT_FACE_COUNTER_CLOCKWISE"/>
<enum value="1" name="VK_FRONT_FACE_CLOCKWISE"/>
@@ -2312,25 +7592,25 @@ maintained in the master branch of the Khronos Vulkan GitHub project.
<enum value="44" name="VK_STRUCTURE_TYPE_BUFFER_MEMORY_BARRIER"/>
<enum value="45" name="VK_STRUCTURE_TYPE_IMAGE_MEMORY_BARRIER"/>
<enum value="46" name="VK_STRUCTURE_TYPE_MEMORY_BARRIER"/>
- <enum value="47" name="VK_STRUCTURE_TYPE_LOADER_INSTANCE_CREATE_INFO"/> <!-- Reserved for internal use by the loader, layers, and ICDs -->
- <enum value="48" name="VK_STRUCTURE_TYPE_LOADER_DEVICE_CREATE_INFO"/> <!-- Reserved for internal use by the loader, layers, and ICDs -->
+ <enum value="47" name="VK_STRUCTURE_TYPE_LOADER_INSTANCE_CREATE_INFO" comment="Reserved for internal use by the loader, layers, and ICDs"/>
+ <enum value="48" name="VK_STRUCTURE_TYPE_LOADER_DEVICE_CREATE_INFO" comment="Reserved for internal use by the loader, layers, and ICDs"/>
</enums>
<enums name="VkSubpassContents" type="enum">
<enum value="0" name="VK_SUBPASS_CONTENTS_INLINE"/>
<enum value="1" name="VK_SUBPASS_CONTENTS_SECONDARY_COMMAND_BUFFERS"/>
</enums>
- <enums name="VkResult" type="enum" comment="Error and return codes">
- <!-- Return codes for successful operation execution (positive values) -->
+ <enums name="VkResult" type="enum" comment="API result codes">
+ <comment>Return codes (positive values)</comment>
<enum value="0" name="VK_SUCCESS" comment="Command completed successfully"/>
<enum value="1" name="VK_NOT_READY" comment="A fence or query has not yet completed"/>
<enum value="2" name="VK_TIMEOUT" comment="A wait operation has not completed in the specified time"/>
<enum value="3" name="VK_EVENT_SET" comment="An event is signaled"/>
<enum value="4" name="VK_EVENT_RESET" comment="An event is unsignaled"/>
<enum value="5" name="VK_INCOMPLETE" comment="A return array was too small for the result"/>
- <!-- Error codes (negative values) -->
+ <comment>Error codes (negative values)</comment>
<enum value="-1" name="VK_ERROR_OUT_OF_HOST_MEMORY" comment="A host memory allocation has failed"/>
<enum value="-2" name="VK_ERROR_OUT_OF_DEVICE_MEMORY" comment="A device memory allocation has failed"/>
- <enum value="-3" name="VK_ERROR_INITIALIZATION_FAILED" comment="Initialization of a object has failed"/>
+ <enum value="-3" name="VK_ERROR_INITIALIZATION_FAILED" comment="Initialization of an object has failed"/>
<enum value="-4" name="VK_ERROR_DEVICE_LOST" comment="The logical device has been lost. See &lt;&lt;devsandqueues-lost-device&gt;&gt;"/>
<enum value="-5" name="VK_ERROR_MEMORY_MAP_FAILED" comment="Mapping of a memory object has failed"/>
<enum value="-6" name="VK_ERROR_LAYER_NOT_PRESENT" comment="Layer specified does not exist"/>
@@ -2340,27 +7620,69 @@ maintained in the master branch of the Khronos Vulkan GitHub project.
<enum value="-10" name="VK_ERROR_TOO_MANY_OBJECTS" comment="Too many objects of the type have already been created"/>
<enum value="-11" name="VK_ERROR_FORMAT_NOT_SUPPORTED" comment="Requested format is not supported on this device"/>
<enum value="-12" name="VK_ERROR_FRAGMENTED_POOL" comment="A requested pool allocation has failed due to fragmentation of the pool's memory"/>
- <unused start="-12"/>
+ <enum value="-13" name="VK_ERROR_UNKNOWN" comment="An unknown error has occurred, due to an implementation or application bug"/>
+ <unused start="-14" comment="This is the next unused available error code (negative value)"/>
</enums>
<enums name="VkDynamicState" type="enum">
- <enum value="0" name="VK_DYNAMIC_STATE_VIEWPORT"/>
- <enum value="1" name="VK_DYNAMIC_STATE_SCISSOR"/>
- <enum value="2" name="VK_DYNAMIC_STATE_LINE_WIDTH"/>
- <enum value="3" name="VK_DYNAMIC_STATE_DEPTH_BIAS"/>
- <enum value="4" name="VK_DYNAMIC_STATE_BLEND_CONSTANTS"/>
- <enum value="5" name="VK_DYNAMIC_STATE_DEPTH_BOUNDS"/>
- <enum value="6" name="VK_DYNAMIC_STATE_STENCIL_COMPARE_MASK"/>
- <enum value="7" name="VK_DYNAMIC_STATE_STENCIL_WRITE_MASK"/>
- <enum value="8" name="VK_DYNAMIC_STATE_STENCIL_REFERENCE"/>
+ <enum value="0" name="VK_DYNAMIC_STATE_VIEWPORT"/>
+ <enum value="1" name="VK_DYNAMIC_STATE_SCISSOR"/>
+ <enum value="2" name="VK_DYNAMIC_STATE_LINE_WIDTH"/>
+ <enum value="3" name="VK_DYNAMIC_STATE_DEPTH_BIAS"/>
+ <enum value="4" name="VK_DYNAMIC_STATE_BLEND_CONSTANTS"/>
+ <enum value="5" name="VK_DYNAMIC_STATE_DEPTH_BOUNDS"/>
+ <enum value="6" name="VK_DYNAMIC_STATE_STENCIL_COMPARE_MASK"/>
+ <enum value="7" name="VK_DYNAMIC_STATE_STENCIL_WRITE_MASK"/>
+ <enum value="8" name="VK_DYNAMIC_STATE_STENCIL_REFERENCE"/>
+ </enums>
+ <enums name="VkDescriptorUpdateTemplateType" type="enum">
+ <enum value="0" name="VK_DESCRIPTOR_UPDATE_TEMPLATE_TYPE_DESCRIPTOR_SET" comment="Create descriptor update template for descriptor set updates"/>
+ </enums>
+ <enums name="VkObjectType" type="enum" comment="Enums to track objects of various types - also see objtypeenum attributes on type tags">
+ <enum value="0" name="VK_OBJECT_TYPE_UNKNOWN"/>
+ <enum value="1" name="VK_OBJECT_TYPE_INSTANCE"/>
+ <enum value="2" name="VK_OBJECT_TYPE_PHYSICAL_DEVICE"/>
+ <enum value="3" name="VK_OBJECT_TYPE_DEVICE"/>
+ <enum value="4" name="VK_OBJECT_TYPE_QUEUE"/>
+ <enum value="5" name="VK_OBJECT_TYPE_SEMAPHORE"/>
+ <enum value="6" name="VK_OBJECT_TYPE_COMMAND_BUFFER"/>
+ <enum value="7" name="VK_OBJECT_TYPE_FENCE"/>
+ <enum value="8" name="VK_OBJECT_TYPE_DEVICE_MEMORY"/>
+ <enum value="9" name="VK_OBJECT_TYPE_BUFFER"/>
+ <enum value="10" name="VK_OBJECT_TYPE_IMAGE"/>
+ <enum value="11" name="VK_OBJECT_TYPE_EVENT"/>
+ <enum value="12" name="VK_OBJECT_TYPE_QUERY_POOL"/>
+ <enum value="13" name="VK_OBJECT_TYPE_BUFFER_VIEW"/>
+ <enum value="14" name="VK_OBJECT_TYPE_IMAGE_VIEW"/>
+ <enum value="15" name="VK_OBJECT_TYPE_SHADER_MODULE"/>
+ <enum value="16" name="VK_OBJECT_TYPE_PIPELINE_CACHE"/>
+ <enum value="17" name="VK_OBJECT_TYPE_PIPELINE_LAYOUT"/>
+ <enum value="18" name="VK_OBJECT_TYPE_RENDER_PASS"/>
+ <enum value="19" name="VK_OBJECT_TYPE_PIPELINE"/>
+ <enum value="20" name="VK_OBJECT_TYPE_DESCRIPTOR_SET_LAYOUT"/>
+ <enum value="21" name="VK_OBJECT_TYPE_SAMPLER"/>
+ <enum value="22" name="VK_OBJECT_TYPE_DESCRIPTOR_POOL"/>
+ <enum value="23" name="VK_OBJECT_TYPE_DESCRIPTOR_SET"/>
+ <enum value="24" name="VK_OBJECT_TYPE_FRAMEBUFFER"/>
+ <enum value="25" name="VK_OBJECT_TYPE_COMMAND_POOL"/>
</enums>
- <!-- Flags -->
+ <comment>Flags</comment>
<enums name="VkQueueFlagBits" type="bitmask">
<enum bitpos="0" name="VK_QUEUE_GRAPHICS_BIT" comment="Queue supports graphics operations"/>
<enum bitpos="1" name="VK_QUEUE_COMPUTE_BIT" comment="Queue supports compute operations"/>
<enum bitpos="2" name="VK_QUEUE_TRANSFER_BIT" comment="Queue supports transfer operations"/>
<enum bitpos="3" name="VK_QUEUE_SPARSE_BINDING_BIT" comment="Queue supports sparse resource memory management operations"/>
</enums>
+ <enums name="VkCullModeFlagBits" type="bitmask">
+ <enum value="0" name="VK_CULL_MODE_NONE"/>
+ <enum bitpos="0" name="VK_CULL_MODE_FRONT_BIT"/>
+ <enum bitpos="1" name="VK_CULL_MODE_BACK_BIT"/>
+ <enum value="0x00000003" name="VK_CULL_MODE_FRONT_AND_BACK"/>
+ </enums>
+ <enums name="VkRenderPassCreateFlagBits" type="bitmask">
+ </enums>
+ <enums name="VkDeviceQueueCreateFlagBits" type="bitmask">
+ </enums>
<enums name="VkMemoryPropertyFlagBits" type="bitmask">
<enum bitpos="0" name="VK_MEMORY_PROPERTY_DEVICE_LOCAL_BIT" comment="If otherwise stated, then allocate memory on device"/>
<enum bitpos="1" name="VK_MEMORY_PROPERTY_HOST_VISIBLE_BIT" comment="Memory is mappable by host"/>
@@ -2404,7 +7726,7 @@ maintained in the master branch of the Khronos Vulkan GitHub project.
<enums name="VkBufferCreateFlagBits" type="bitmask">
<enum bitpos="0" name="VK_BUFFER_CREATE_SPARSE_BINDING_BIT" comment="Buffer should support sparse backing"/>
<enum bitpos="1" name="VK_BUFFER_CREATE_SPARSE_RESIDENCY_BIT" comment="Buffer should support sparse backing with partial residency"/>
- <enum bitpos="2" name="VK_BUFFER_CREATE_SPARSE_ALIASED_BIT" comment="Buffer should support constent data access to physical memory ranges mapped into multiple locations of sparse buffers"/>
+ <enum bitpos="2" name="VK_BUFFER_CREATE_SPARSE_ALIASED_BIT" comment="Buffer should support constant data access to physical memory ranges mapped into multiple locations of sparse buffers"/>
</enums>
<enums name="VkShaderStageFlagBits" type="bitmask">
<enum bitpos="0" name="VK_SHADER_STAGE_VERTEX_BIT"/>
@@ -2429,15 +7751,21 @@ maintained in the master branch of the Khronos Vulkan GitHub project.
<enums name="VkImageCreateFlagBits" type="bitmask">
<enum bitpos="0" name="VK_IMAGE_CREATE_SPARSE_BINDING_BIT" comment="Image should support sparse backing"/>
<enum bitpos="1" name="VK_IMAGE_CREATE_SPARSE_RESIDENCY_BIT" comment="Image should support sparse backing with partial residency"/>
- <enum bitpos="2" name="VK_IMAGE_CREATE_SPARSE_ALIASED_BIT" comment="Image should support constent data access to physical memory ranges mapped into multiple locations of sparse images"/>
+ <enum bitpos="2" name="VK_IMAGE_CREATE_SPARSE_ALIASED_BIT" comment="Image should support constant data access to physical memory ranges mapped into multiple locations of sparse images"/>
<enum bitpos="3" name="VK_IMAGE_CREATE_MUTABLE_FORMAT_BIT" comment="Allows image views to have different format than the base image"/>
<enum bitpos="4" name="VK_IMAGE_CREATE_CUBE_COMPATIBLE_BIT" comment="Allows creating image views with cube type from the created image"/>
</enums>
- <enums name="VkPipelineCreateFlagBits" type="bitmask">
+ <enums name="VkImageViewCreateFlagBits" type="bitmask">
+ </enums>
+ <enums name="VkSamplerCreateFlagBits" type="bitmask">
+ </enums>
+ <enums name="VkPipelineCreateFlagBits" type="bitmask" comment="Note that the gap at bitpos 10 is unused, and can be reserved">
<enum bitpos="0" name="VK_PIPELINE_CREATE_DISABLE_OPTIMIZATION_BIT"/>
<enum bitpos="1" name="VK_PIPELINE_CREATE_ALLOW_DERIVATIVES_BIT"/>
<enum bitpos="2" name="VK_PIPELINE_CREATE_DERIVATIVE_BIT"/>
</enums>
+ <enums name="VkPipelineShaderStageCreateFlagBits" type="bitmask">
+ </enums>
<enums name="VkColorComponentFlagBits" type="bitmask">
<enum bitpos="0" name="VK_COLOR_COMPONENT_R_BIT"/>
<enum bitpos="1" name="VK_COLOR_COMPONENT_G_BIT"/>
@@ -2447,6 +7775,8 @@ maintained in the master branch of the Khronos Vulkan GitHub project.
<enums name="VkFenceCreateFlagBits" type="bitmask">
<enum bitpos="0" name="VK_FENCE_CREATE_SIGNALED_BIT"/>
</enums>
+ <enums name="VkSemaphoreCreateFlagBits" type="bitmask">
+ </enums>
<enums name="VkFormatFeatureFlagBits" type="bitmask">
<enum bitpos="0" name="VK_FORMAT_FEATURE_SAMPLED_IMAGE_BIT" comment="Format can be used for sampled images (SAMPLED_IMAGE and COMBINED_IMAGE_SAMPLER descriptor types)"/>
<enum bitpos="1" name="VK_FORMAT_FEATURE_STORAGE_IMAGE_BIT" comment="Format can be used for storage images (STORAGE_IMAGE descriptor type)"/>
@@ -2496,8 +7826,8 @@ maintained in the master branch of the Khronos Vulkan GitHub project.
<enum bitpos="3" name="VK_IMAGE_ASPECT_METADATA_BIT"/>
</enums>
<enums name="VkSparseImageFormatFlagBits" type="bitmask">
- <enum bitpos="0" name="VK_SPARSE_IMAGE_FORMAT_SINGLE_MIPTAIL_BIT" comment="Image uses a single mip tail region for all array layers"/>
- <enum bitpos="1" name="VK_SPARSE_IMAGE_FORMAT_ALIGNED_MIP_SIZE_BIT" comment="Image requires mip level dimensions to be an integer multiple of the sparse image block dimensions for non-tail mip levels."/>
+ <enum bitpos="0" name="VK_SPARSE_IMAGE_FORMAT_SINGLE_MIPTAIL_BIT" comment="Image uses a single mip tail region for all array layers"/>
+ <enum bitpos="1" name="VK_SPARSE_IMAGE_FORMAT_ALIGNED_MIP_SIZE_BIT" comment="Image requires mip level dimensions to be an integer multiple of the sparse image block dimensions for non-tail mip levels."/>
<enum bitpos="2" name="VK_SPARSE_IMAGE_FORMAT_NONSTANDARD_BLOCK_SIZE_BIT" comment="Image uses a non-standard sparse image block dimensions"/>
</enums>
<enums name="VkSparseMemoryBindFlagBits" type="bitmask">
@@ -2508,8 +7838,8 @@ maintained in the master branch of the Khronos Vulkan GitHub project.
<enum bitpos="1" name="VK_PIPELINE_STAGE_DRAW_INDIRECT_BIT" comment="Draw/DispatchIndirect command fetch"/>
<enum bitpos="2" name="VK_PIPELINE_STAGE_VERTEX_INPUT_BIT" comment="Vertex/index fetch"/>
<enum bitpos="3" name="VK_PIPELINE_STAGE_VERTEX_SHADER_BIT" comment="Vertex shading"/>
- <enum bitpos="4" name="VK_PIPELINE_STAGE_TESSELLATION_CONTROL_SHADER_BIT" comment="Tessellation control shading"/>
- <enum bitpos="5" name="VK_PIPELINE_STAGE_TESSELLATION_EVALUATION_SHADER_BIT" comment="Tessellation evaluation shading"/>
+ <enum bitpos="4" name="VK_PIPELINE_STAGE_TESSELLATION_CONTROL_SHADER_BIT" comment="Tessellation control shading"/>
+ <enum bitpos="5" name="VK_PIPELINE_STAGE_TESSELLATION_EVALUATION_SHADER_BIT" comment="Tessellation evaluation shading"/>
<enum bitpos="6" name="VK_PIPELINE_STAGE_GEOMETRY_SHADER_BIT" comment="Geometry shading"/>
<enum bitpos="7" name="VK_PIPELINE_STAGE_FRAGMENT_SHADER_BIT" comment="Fragment shading"/>
<enum bitpos="8" name="VK_PIPELINE_STAGE_EARLY_FRAGMENT_TESTS_BIT" comment="Early fragment (depth and stencil) tests"/>
@@ -2547,7 +7877,8 @@ maintained in the master branch of the Khronos Vulkan GitHub project.
<enums name="VkStencilFaceFlagBits" type="bitmask">
<enum bitpos="0" name="VK_STENCIL_FACE_FRONT_BIT" comment="Front face"/>
<enum bitpos="1" name="VK_STENCIL_FACE_BACK_BIT" comment="Back face"/>
- <enum value="0x00000003" name="VK_STENCIL_FRONT_AND_BACK" comment="Front and back faces"/>
+ <enum value="0x00000003" name="VK_STENCIL_FACE_FRONT_AND_BACK" comment="Front and back faces"/>
+ <enum name="VK_STENCIL_FRONT_AND_BACK" alias="VK_STENCIL_FACE_FRONT_AND_BACK" comment="Backwards-compatible alias containing a typo"/>
</enums>
<enums name="VkDescriptorPoolCreateFlagBits" type="bitmask">
<enum bitpos="0" name="VK_DESCRIPTOR_POOL_CREATE_FREE_DESCRIPTOR_SET_BIT" comment="Descriptor sets may be freed individually"/>
@@ -2555,7 +7886,15 @@ maintained in the master branch of the Khronos Vulkan GitHub project.
<enums name="VkDependencyFlagBits" type="bitmask">
<enum bitpos="0" name="VK_DEPENDENCY_BY_REGION_BIT" comment="Dependency is per pixel region "/>
</enums>
- <!-- WSI extensions -->
+ <enums name="VkSemaphoreType" type="enum">
+ <enum value="0" name="VK_SEMAPHORE_TYPE_BINARY"/>
+ <enum value="1" name="VK_SEMAPHORE_TYPE_TIMELINE"/>
+ </enums>
+ <enums name="VkSemaphoreWaitFlagBits" type="bitmask">
+ <enum bitpos="0" name="VK_SEMAPHORE_WAIT_ANY_BIT"/>
+ </enums>
+
+ <comment>WSI Extensions</comment>
<enums name="VkPresentModeKHR" type="enum">
<enum value="0" name="VK_PRESENT_MODE_IMMEDIATE_KHR"/>
<enum value="1" name="VK_PRESENT_MODE_MAILBOX_KHR"/>
@@ -2564,6 +7903,7 @@ maintained in the master branch of the Khronos Vulkan GitHub project.
</enums>
<enums name="VkColorSpaceKHR" type="enum">
<enum value="0" name="VK_COLOR_SPACE_SRGB_NONLINEAR_KHR"/>
+ <enum name="VK_COLORSPACE_SRGB_NONLINEAR_KHR" alias="VK_COLOR_SPACE_SRGB_NONLINEAR_KHR" comment="Backwards-compatible alias containing a typo"/>
</enums>
<enums name="VkDisplayPlaneAlphaFlagBitsKHR" type="bitmask">
<enum bitpos="0" name="VK_DISPLAY_PLANE_ALPHA_OPAQUE_BIT_KHR"/>
@@ -2588,115 +7928,1048 @@ maintained in the master branch of the Khronos Vulkan GitHub project.
<enum bitpos="7" name="VK_SURFACE_TRANSFORM_HORIZONTAL_MIRROR_ROTATE_270_BIT_KHR"/>
<enum bitpos="8" name="VK_SURFACE_TRANSFORM_INHERIT_BIT_KHR"/>
</enums>
+ <enums name="VkSwapchainImageUsageFlagBitsANDROID" type="bitmask">
+ <enum bitpos="0" name="VK_SWAPCHAIN_IMAGE_USAGE_SHARED_BIT_ANDROID"/>
+ </enums>
+ <enums name="VkTimeDomainEXT" type="enum">
+ <enum value="0" name="VK_TIME_DOMAIN_DEVICE_EXT"/>
+ <enum value="1" name="VK_TIME_DOMAIN_CLOCK_MONOTONIC_EXT"/>
+ <enum value="2" name="VK_TIME_DOMAIN_CLOCK_MONOTONIC_RAW_EXT"/>
+ <enum value="3" name="VK_TIME_DOMAIN_QUERY_PERFORMANCE_COUNTER_EXT"/>
+ </enums>
<enums name="VkDebugReportFlagBitsEXT" type="bitmask">
- <enum bitpos="0" name="VK_DEBUG_REPORT_INFORMATION_BIT_EXT"/>
- <enum bitpos="1" name="VK_DEBUG_REPORT_WARNING_BIT_EXT"/>
- <enum bitpos="2" name="VK_DEBUG_REPORT_PERFORMANCE_WARNING_BIT_EXT"/>
- <enum bitpos="3" name="VK_DEBUG_REPORT_ERROR_BIT_EXT"/>
- <enum bitpos="4" name="VK_DEBUG_REPORT_DEBUG_BIT_EXT"/>
+ <enum bitpos="0" name="VK_DEBUG_REPORT_INFORMATION_BIT_EXT"/>
+ <enum bitpos="1" name="VK_DEBUG_REPORT_WARNING_BIT_EXT"/>
+ <enum bitpos="2" name="VK_DEBUG_REPORT_PERFORMANCE_WARNING_BIT_EXT"/>
+ <enum bitpos="3" name="VK_DEBUG_REPORT_ERROR_BIT_EXT"/>
+ <enum bitpos="4" name="VK_DEBUG_REPORT_DEBUG_BIT_EXT"/>
</enums>
<enums name="VkDebugReportObjectTypeEXT" type="enum">
- <enum value="0" name="VK_DEBUG_REPORT_OBJECT_TYPE_UNKNOWN_EXT"/>
- <enum value="1" name="VK_DEBUG_REPORT_OBJECT_TYPE_INSTANCE_EXT"/>
- <enum value="2" name="VK_DEBUG_REPORT_OBJECT_TYPE_PHYSICAL_DEVICE_EXT"/>
- <enum value="3" name="VK_DEBUG_REPORT_OBJECT_TYPE_DEVICE_EXT"/>
- <enum value="4" name="VK_DEBUG_REPORT_OBJECT_TYPE_QUEUE_EXT"/>
- <enum value="5" name="VK_DEBUG_REPORT_OBJECT_TYPE_SEMAPHORE_EXT"/>
- <enum value="6" name="VK_DEBUG_REPORT_OBJECT_TYPE_COMMAND_BUFFER_EXT"/>
- <enum value="7" name="VK_DEBUG_REPORT_OBJECT_TYPE_FENCE_EXT"/>
- <enum value="8" name="VK_DEBUG_REPORT_OBJECT_TYPE_DEVICE_MEMORY_EXT"/>
- <enum value="9" name="VK_DEBUG_REPORT_OBJECT_TYPE_BUFFER_EXT"/>
- <enum value="10" name="VK_DEBUG_REPORT_OBJECT_TYPE_IMAGE_EXT"/>
- <enum value="11" name="VK_DEBUG_REPORT_OBJECT_TYPE_EVENT_EXT"/>
- <enum value="12" name="VK_DEBUG_REPORT_OBJECT_TYPE_QUERY_POOL_EXT"/>
- <enum value="13" name="VK_DEBUG_REPORT_OBJECT_TYPE_BUFFER_VIEW_EXT"/>
- <enum value="14" name="VK_DEBUG_REPORT_OBJECT_TYPE_IMAGE_VIEW_EXT"/>
- <enum value="15" name="VK_DEBUG_REPORT_OBJECT_TYPE_SHADER_MODULE_EXT"/>
- <enum value="16" name="VK_DEBUG_REPORT_OBJECT_TYPE_PIPELINE_CACHE_EXT"/>
- <enum value="17" name="VK_DEBUG_REPORT_OBJECT_TYPE_PIPELINE_LAYOUT_EXT"/>
- <enum value="18" name="VK_DEBUG_REPORT_OBJECT_TYPE_RENDER_PASS_EXT"/>
- <enum value="19" name="VK_DEBUG_REPORT_OBJECT_TYPE_PIPELINE_EXT"/>
- <enum value="20" name="VK_DEBUG_REPORT_OBJECT_TYPE_DESCRIPTOR_SET_LAYOUT_EXT"/>
- <enum value="21" name="VK_DEBUG_REPORT_OBJECT_TYPE_SAMPLER_EXT"/>
- <enum value="22" name="VK_DEBUG_REPORT_OBJECT_TYPE_DESCRIPTOR_POOL_EXT"/>
- <enum value="23" name="VK_DEBUG_REPORT_OBJECT_TYPE_DESCRIPTOR_SET_EXT"/>
- <enum value="24" name="VK_DEBUG_REPORT_OBJECT_TYPE_FRAMEBUFFER_EXT"/>
- <enum value="25" name="VK_DEBUG_REPORT_OBJECT_TYPE_COMMAND_POOL_EXT"/>
- <enum value="26" name="VK_DEBUG_REPORT_OBJECT_TYPE_SURFACE_KHR_EXT"/>
- <enum value="27" name="VK_DEBUG_REPORT_OBJECT_TYPE_SWAPCHAIN_KHR_EXT"/>
- <enum value="28" name="VK_DEBUG_REPORT_OBJECT_TYPE_DEBUG_REPORT_EXT"/>
- <enum value="29" name="VK_DEBUG_REPORT_OBJECT_TYPE_DISPLAY_KHR_EXT"/>
- <enum value="30" name="VK_DEBUG_REPORT_OBJECT_TYPE_DISPLAY_MODE_KHR_EXT"/>
- <enum value="31" name="VK_DEBUG_REPORT_OBJECT_TYPE_OBJECT_TABLE_NVX_EXT"/>
- <enum value="32" name="VK_DEBUG_REPORT_OBJECT_TYPE_INDIRECT_COMMANDS_LAYOUT_NVX_EXT"/>
- </enums>
- <enums name="VkDebugReportErrorEXT" type="enum">
- <enum value="0" name="VK_DEBUG_REPORT_ERROR_NONE_EXT"/> <!-- Used for INFO & other non-error messages -->
- <enum value="1" name="VK_DEBUG_REPORT_ERROR_CALLBACK_REF_EXT"/> <!-- Callbacks were not destroyed prior to calling DestroyInstance -->
+ <enum value="0" name="VK_DEBUG_REPORT_OBJECT_TYPE_UNKNOWN_EXT"/>
+ <enum value="1" name="VK_DEBUG_REPORT_OBJECT_TYPE_INSTANCE_EXT"/>
+ <enum value="2" name="VK_DEBUG_REPORT_OBJECT_TYPE_PHYSICAL_DEVICE_EXT"/>
+ <enum value="3" name="VK_DEBUG_REPORT_OBJECT_TYPE_DEVICE_EXT"/>
+ <enum value="4" name="VK_DEBUG_REPORT_OBJECT_TYPE_QUEUE_EXT"/>
+ <enum value="5" name="VK_DEBUG_REPORT_OBJECT_TYPE_SEMAPHORE_EXT"/>
+ <enum value="6" name="VK_DEBUG_REPORT_OBJECT_TYPE_COMMAND_BUFFER_EXT"/>
+ <enum value="7" name="VK_DEBUG_REPORT_OBJECT_TYPE_FENCE_EXT"/>
+ <enum value="8" name="VK_DEBUG_REPORT_OBJECT_TYPE_DEVICE_MEMORY_EXT"/>
+ <enum value="9" name="VK_DEBUG_REPORT_OBJECT_TYPE_BUFFER_EXT"/>
+ <enum value="10" name="VK_DEBUG_REPORT_OBJECT_TYPE_IMAGE_EXT"/>
+ <enum value="11" name="VK_DEBUG_REPORT_OBJECT_TYPE_EVENT_EXT"/>
+ <enum value="12" name="VK_DEBUG_REPORT_OBJECT_TYPE_QUERY_POOL_EXT"/>
+ <enum value="13" name="VK_DEBUG_REPORT_OBJECT_TYPE_BUFFER_VIEW_EXT"/>
+ <enum value="14" name="VK_DEBUG_REPORT_OBJECT_TYPE_IMAGE_VIEW_EXT"/>
+ <enum value="15" name="VK_DEBUG_REPORT_OBJECT_TYPE_SHADER_MODULE_EXT"/>
+ <enum value="16" name="VK_DEBUG_REPORT_OBJECT_TYPE_PIPELINE_CACHE_EXT"/>
+ <enum value="17" name="VK_DEBUG_REPORT_OBJECT_TYPE_PIPELINE_LAYOUT_EXT"/>
+ <enum value="18" name="VK_DEBUG_REPORT_OBJECT_TYPE_RENDER_PASS_EXT"/>
+ <enum value="19" name="VK_DEBUG_REPORT_OBJECT_TYPE_PIPELINE_EXT"/>
+ <enum value="20" name="VK_DEBUG_REPORT_OBJECT_TYPE_DESCRIPTOR_SET_LAYOUT_EXT"/>
+ <enum value="21" name="VK_DEBUG_REPORT_OBJECT_TYPE_SAMPLER_EXT"/>
+ <enum value="22" name="VK_DEBUG_REPORT_OBJECT_TYPE_DESCRIPTOR_POOL_EXT"/>
+ <enum value="23" name="VK_DEBUG_REPORT_OBJECT_TYPE_DESCRIPTOR_SET_EXT"/>
+ <enum value="24" name="VK_DEBUG_REPORT_OBJECT_TYPE_FRAMEBUFFER_EXT"/>
+ <enum value="25" name="VK_DEBUG_REPORT_OBJECT_TYPE_COMMAND_POOL_EXT"/>
+ <enum value="26" name="VK_DEBUG_REPORT_OBJECT_TYPE_SURFACE_KHR_EXT"/>
+ <enum value="27" name="VK_DEBUG_REPORT_OBJECT_TYPE_SWAPCHAIN_KHR_EXT"/>
+ <enum value="28" name="VK_DEBUG_REPORT_OBJECT_TYPE_DEBUG_REPORT_CALLBACK_EXT_EXT"/>
+ <enum name="VK_DEBUG_REPORT_OBJECT_TYPE_DEBUG_REPORT_EXT" alias="VK_DEBUG_REPORT_OBJECT_TYPE_DEBUG_REPORT_CALLBACK_EXT_EXT" comment="Backwards-compatible alias containing a typo"/>
+ <enum value="29" name="VK_DEBUG_REPORT_OBJECT_TYPE_DISPLAY_KHR_EXT"/>
+ <enum value="30" name="VK_DEBUG_REPORT_OBJECT_TYPE_DISPLAY_MODE_KHR_EXT"/>
+ <comment>NVX_device_generated_commands formerly used these enum values, but that extension has been removed
+ value 31 / name VK_DEBUG_REPORT_OBJECT_TYPE_OBJECT_TABLE_NVX_EXT
+ value 32 / name VK_DEBUG_REPORT_OBJECT_TYPE_INDIRECT_COMMANDS_LAYOUT_NVX_EXT
+ </comment>
+ <enum value="33" name="VK_DEBUG_REPORT_OBJECT_TYPE_VALIDATION_CACHE_EXT_EXT"/>
+ <enum name="VK_DEBUG_REPORT_OBJECT_TYPE_VALIDATION_CACHE_EXT" alias="VK_DEBUG_REPORT_OBJECT_TYPE_VALIDATION_CACHE_EXT_EXT" comment="Backwards-compatible alias containing a typo"/>
+ </enums>
+ <enums name="VkDeviceMemoryReportEventTypeEXT" type="enum">
+ <enum value="0" name="VK_DEVICE_MEMORY_REPORT_EVENT_TYPE_ALLOCATE_EXT"/>
+ <enum value="1" name="VK_DEVICE_MEMORY_REPORT_EVENT_TYPE_FREE_EXT"/>
+ <enum value="2" name="VK_DEVICE_MEMORY_REPORT_EVENT_TYPE_IMPORT_EXT"/>
+ <enum value="3" name="VK_DEVICE_MEMORY_REPORT_EVENT_TYPE_UNIMPORT_EXT"/>
+ <enum value="4" name="VK_DEVICE_MEMORY_REPORT_EVENT_TYPE_ALLOCATION_FAILED_EXT"/>
</enums>
<enums name="VkRasterizationOrderAMD" type="enum">
- <enum value="0" name="VK_RASTERIZATION_ORDER_STRICT_AMD"/> <!-- Rasterization order strictly follows API order -->
- <enum value="1" name="VK_RASTERIZATION_ORDER_RELAXED_AMD"/> <!-- Rasterization order may not follow API order -->
+ <enum value="0" name="VK_RASTERIZATION_ORDER_STRICT_AMD"/>
+ <enum value="1" name="VK_RASTERIZATION_ORDER_RELAXED_AMD"/>
</enums>
<enums name="VkExternalMemoryHandleTypeFlagBitsNV" type="bitmask">
- <enum bitpos="0" name="VK_EXTERNAL_MEMORY_HANDLE_TYPE_OPAQUE_WIN32_BIT_NV"/>
- <enum bitpos="1" name="VK_EXTERNAL_MEMORY_HANDLE_TYPE_OPAQUE_WIN32_KMT_BIT_NV"/>
- <enum bitpos="2" name="VK_EXTERNAL_MEMORY_HANDLE_TYPE_D3D11_IMAGE_BIT_NV"/>
- <enum bitpos="3" name="VK_EXTERNAL_MEMORY_HANDLE_TYPE_D3D11_IMAGE_KMT_BIT_NV"/>
+ <enum bitpos="0" name="VK_EXTERNAL_MEMORY_HANDLE_TYPE_OPAQUE_WIN32_BIT_NV"/>
+ <enum bitpos="1" name="VK_EXTERNAL_MEMORY_HANDLE_TYPE_OPAQUE_WIN32_KMT_BIT_NV"/>
+ <enum bitpos="2" name="VK_EXTERNAL_MEMORY_HANDLE_TYPE_D3D11_IMAGE_BIT_NV"/>
+ <enum bitpos="3" name="VK_EXTERNAL_MEMORY_HANDLE_TYPE_D3D11_IMAGE_KMT_BIT_NV"/>
</enums>
<enums name="VkExternalMemoryFeatureFlagBitsNV" type="bitmask">
- <enum bitpos="0" name="VK_EXTERNAL_MEMORY_FEATURE_DEDICATED_ONLY_BIT_NV"/>
- <enum bitpos="1" name="VK_EXTERNAL_MEMORY_FEATURE_EXPORTABLE_BIT_NV"/>
- <enum bitpos="2" name="VK_EXTERNAL_MEMORY_FEATURE_IMPORTABLE_BIT_NV"/>
+ <enum bitpos="0" name="VK_EXTERNAL_MEMORY_FEATURE_DEDICATED_ONLY_BIT_NV"/>
+ <enum bitpos="1" name="VK_EXTERNAL_MEMORY_FEATURE_EXPORTABLE_BIT_NV"/>
+ <enum bitpos="2" name="VK_EXTERNAL_MEMORY_FEATURE_IMPORTABLE_BIT_NV"/>
</enums>
<enums name="VkValidationCheckEXT" type="enum">
- <enum value="0" name="VK_VALIDATION_CHECK_ALL_EXT"/>
- <!-- Placeholder for validation enums to be defined for VK_EXT_Validation_flags extension -->
- </enums>
- <enums name="VkIndirectCommandsLayoutUsageFlagBitsNVX" type="bitmask">
- <enum bitpos="0" name="VK_INDIRECT_COMMANDS_LAYOUT_USAGE_UNORDERED_SEQUENCES_BIT_NVX"/> <!-- sequences can be processed in implementation-dependent order -->
- <enum bitpos="1" name="VK_INDIRECT_COMMANDS_LAYOUT_USAGE_SPARSE_SEQUENCES_BIT_NVX"/> <!-- likely generated with a high difference in actual sequencesCount and maxSequencesCount -->
- <enum bitpos="2" name="VK_INDIRECT_COMMANDS_LAYOUT_USAGE_EMPTY_EXECUTIONS_BIT_NVX"/> <!-- likely to contain draw/dispatch calls that are zero-sized -->
- <enum bitpos="3" name="VK_INDIRECT_COMMANDS_LAYOUT_USAGE_INDEXED_SEQUENCES_BIT_NVX"/> <!-- custom sequence index permutation (32-bit) is provided -->
- </enums>
- <enums name="VkObjectEntryUsageFlagBitsNVX" type="bitmask">
- <enum bitpos="0" name="VK_OBJECT_ENTRY_USAGE_GRAPHICS_BIT_NVX"/>
- <enum bitpos="1" name="VK_OBJECT_ENTRY_USAGE_COMPUTE_BIT_NVX"/>
- </enums>
- <enums name="VkIndirectCommandsTokenTypeNVX" type="enum">
- <enum value="0" name="VK_INDIRECT_COMMANDS_TOKEN_PIPELINE_NVX"/> <!-- array of 32bit tableEntry in the object table -->
- <enum value="1" name="VK_INDIRECT_COMMANDS_TOKEN_DESCRIPTOR_SET_NVX"/> <!-- array of (32 bit tableEntry + variable count 32bit offsets) -->
- <enum value="2" name="VK_INDIRECT_COMMANDS_TOKEN_INDEX_BUFFER_NVX"/> <!-- array of (32 bit tableEntry + optional 32bit offset) -->
- <enum value="3" name="VK_INDIRECT_COMMANDS_TOKEN_VERTEX_BUFFER_NVX"/> <!-- array of (32 bit tableEntry + optional 32bit offset) -->
- <enum value="4" name="VK_INDIRECT_COMMANDS_TOKEN_PUSH_CONSTANT_NVX"/> <!-- array of (32 bit tableEntry + variable count 32bit values ) -->
- <enum value="5" name="VK_INDIRECT_COMMANDS_TOKEN_DRAW_INDEXED_NVX"/> <!-- array of VkDrawIndexedIndirectCommand -->
- <enum value="6" name="VK_INDIRECT_COMMANDS_TOKEN_DRAW_NVX"/> <!-- array of VkDrawIndirectCommand -->
- <enum value="7" name="VK_INDIRECT_COMMANDS_TOKEN_DISPATCH_NVX"/> <!-- array of VkDispatchIndirectCommand -->
- </enums>
- <enums name="VkObjectEntryTypeNVX" type="enum">
- <enum value="0" name="VK_OBJECT_ENTRY_DESCRIPTOR_SET_NVX"/>
- <enum value="1" name="VK_OBJECT_ENTRY_PIPELINE_NVX"/>
- <enum value="2" name="VK_OBJECT_ENTRY_INDEX_BUFFER_NVX"/>
- <enum value="3" name="VK_OBJECT_ENTRY_VERTEX_BUFFER_NVX"/>
- <enum value="4" name="VK_OBJECT_ENTRY_PUSH_CONSTANT_NVX"/>
+ <enum value="0" name="VK_VALIDATION_CHECK_ALL_EXT"/>
+ <enum value="1" name="VK_VALIDATION_CHECK_SHADERS_EXT"/>
+ </enums>
+ <enums name="VkValidationFeatureEnableEXT" type="enum">
+ <enum value="0" name="VK_VALIDATION_FEATURE_ENABLE_GPU_ASSISTED_EXT"/>
+ <enum value="1" name="VK_VALIDATION_FEATURE_ENABLE_GPU_ASSISTED_RESERVE_BINDING_SLOT_EXT"/>
+ <enum value="2" name="VK_VALIDATION_FEATURE_ENABLE_BEST_PRACTICES_EXT"/>
+ <enum value="3" name="VK_VALIDATION_FEATURE_ENABLE_DEBUG_PRINTF_EXT"/>
+ <enum value="4" name="VK_VALIDATION_FEATURE_ENABLE_SYNCHRONIZATION_VALIDATION_EXT"/>
+ </enums>
+ <enums name="VkValidationFeatureDisableEXT" type="enum">
+ <enum value="0" name="VK_VALIDATION_FEATURE_DISABLE_ALL_EXT"/>
+ <enum value="1" name="VK_VALIDATION_FEATURE_DISABLE_SHADERS_EXT"/>
+ <enum value="2" name="VK_VALIDATION_FEATURE_DISABLE_THREAD_SAFETY_EXT"/>
+ <enum value="3" name="VK_VALIDATION_FEATURE_DISABLE_API_PARAMETERS_EXT"/>
+ <enum value="4" name="VK_VALIDATION_FEATURE_DISABLE_OBJECT_LIFETIMES_EXT"/>
+ <enum value="5" name="VK_VALIDATION_FEATURE_DISABLE_CORE_CHECKS_EXT"/>
+ <enum value="6" name="VK_VALIDATION_FEATURE_DISABLE_UNIQUE_HANDLES_EXT"/>
+ <enum value="7" name="VK_VALIDATION_FEATURE_DISABLE_SHADER_VALIDATION_CACHE_EXT"/>
+ </enums>
+ <enums name="VkSubgroupFeatureFlagBits" type="bitmask">
+ <enum bitpos="0" name="VK_SUBGROUP_FEATURE_BASIC_BIT" comment="Basic subgroup operations"/>
+ <enum bitpos="1" name="VK_SUBGROUP_FEATURE_VOTE_BIT" comment="Vote subgroup operations"/>
+ <enum bitpos="2" name="VK_SUBGROUP_FEATURE_ARITHMETIC_BIT" comment="Arithmetic subgroup operations"/>
+ <enum bitpos="3" name="VK_SUBGROUP_FEATURE_BALLOT_BIT" comment="Ballot subgroup operations"/>
+ <enum bitpos="4" name="VK_SUBGROUP_FEATURE_SHUFFLE_BIT" comment="Shuffle subgroup operations"/>
+ <enum bitpos="5" name="VK_SUBGROUP_FEATURE_SHUFFLE_RELATIVE_BIT" comment="Shuffle relative subgroup operations"/>
+ <enum bitpos="6" name="VK_SUBGROUP_FEATURE_CLUSTERED_BIT" comment="Clustered subgroup operations"/>
+ <enum bitpos="7" name="VK_SUBGROUP_FEATURE_QUAD_BIT" comment="Quad subgroup operations"/>
+ </enums>
+ <enums name="VkIndirectCommandsLayoutUsageFlagBitsNV" type="bitmask">
+ <enum bitpos="0" name="VK_INDIRECT_COMMANDS_LAYOUT_USAGE_EXPLICIT_PREPROCESS_BIT_NV"/>
+ <enum bitpos="1" name="VK_INDIRECT_COMMANDS_LAYOUT_USAGE_INDEXED_SEQUENCES_BIT_NV"/>
+ <enum bitpos="2" name="VK_INDIRECT_COMMANDS_LAYOUT_USAGE_UNORDERED_SEQUENCES_BIT_NV"/>
+ </enums>
+ <enums name="VkIndirectStateFlagBitsNV" type="bitmask">
+ <enum bitpos="0" name="VK_INDIRECT_STATE_FLAG_FRONTFACE_BIT_NV"/>
+ </enums>
+ <enums name="VkIndirectCommandsTokenTypeNV" type="enum">
+ <enum value="0" name="VK_INDIRECT_COMMANDS_TOKEN_TYPE_SHADER_GROUP_NV"/>
+ <enum value="1" name="VK_INDIRECT_COMMANDS_TOKEN_TYPE_STATE_FLAGS_NV"/>
+ <enum value="2" name="VK_INDIRECT_COMMANDS_TOKEN_TYPE_INDEX_BUFFER_NV"/>
+ <enum value="3" name="VK_INDIRECT_COMMANDS_TOKEN_TYPE_VERTEX_BUFFER_NV"/>
+ <enum value="4" name="VK_INDIRECT_COMMANDS_TOKEN_TYPE_PUSH_CONSTANT_NV"/>
+ <enum value="5" name="VK_INDIRECT_COMMANDS_TOKEN_TYPE_DRAW_INDEXED_NV"/>
+ <enum value="6" name="VK_INDIRECT_COMMANDS_TOKEN_TYPE_DRAW_NV"/>
+ <enum value="7" name="VK_INDIRECT_COMMANDS_TOKEN_TYPE_DRAW_TASKS_NV"/>
+ </enums>
+ <enums name="VkPrivateDataSlotCreateFlagBits" type="bitmask">
+ </enums>
+ <enums name="VkDescriptorSetLayoutCreateFlagBits" type="bitmask">
+ </enums>
+ <enums name="VkExternalMemoryHandleTypeFlagBits" type="bitmask">
+ <enum bitpos="0" name="VK_EXTERNAL_MEMORY_HANDLE_TYPE_OPAQUE_FD_BIT"/>
+ <enum bitpos="1" name="VK_EXTERNAL_MEMORY_HANDLE_TYPE_OPAQUE_WIN32_BIT"/>
+ <enum bitpos="2" name="VK_EXTERNAL_MEMORY_HANDLE_TYPE_OPAQUE_WIN32_KMT_BIT"/>
+ <enum bitpos="3" name="VK_EXTERNAL_MEMORY_HANDLE_TYPE_D3D11_TEXTURE_BIT"/>
+ <enum bitpos="4" name="VK_EXTERNAL_MEMORY_HANDLE_TYPE_D3D11_TEXTURE_KMT_BIT"/>
+ <enum bitpos="5" name="VK_EXTERNAL_MEMORY_HANDLE_TYPE_D3D12_HEAP_BIT"/>
+ <enum bitpos="6" name="VK_EXTERNAL_MEMORY_HANDLE_TYPE_D3D12_RESOURCE_BIT"/>
+ </enums>
+ <enums name="VkExternalMemoryFeatureFlagBits" type="bitmask">
+ <enum bitpos="0" name="VK_EXTERNAL_MEMORY_FEATURE_DEDICATED_ONLY_BIT"/>
+ <enum bitpos="1" name="VK_EXTERNAL_MEMORY_FEATURE_EXPORTABLE_BIT"/>
+ <enum bitpos="2" name="VK_EXTERNAL_MEMORY_FEATURE_IMPORTABLE_BIT"/>
+ </enums>
+ <enums name="VkExternalSemaphoreHandleTypeFlagBits" type="bitmask">
+ <enum bitpos="0" name="VK_EXTERNAL_SEMAPHORE_HANDLE_TYPE_OPAQUE_FD_BIT"/>
+ <enum bitpos="1" name="VK_EXTERNAL_SEMAPHORE_HANDLE_TYPE_OPAQUE_WIN32_BIT"/>
+ <enum bitpos="2" name="VK_EXTERNAL_SEMAPHORE_HANDLE_TYPE_OPAQUE_WIN32_KMT_BIT"/>
+ <enum bitpos="3" name="VK_EXTERNAL_SEMAPHORE_HANDLE_TYPE_D3D12_FENCE_BIT"/>
+ <enum name="VK_EXTERNAL_SEMAPHORE_HANDLE_TYPE_D3D11_FENCE_BIT" alias="VK_EXTERNAL_SEMAPHORE_HANDLE_TYPE_D3D12_FENCE_BIT"/>
+ <enum bitpos="4" name="VK_EXTERNAL_SEMAPHORE_HANDLE_TYPE_SYNC_FD_BIT"/>
+ </enums>
+ <enums name="VkExternalSemaphoreFeatureFlagBits" type="bitmask">
+ <enum bitpos="0" name="VK_EXTERNAL_SEMAPHORE_FEATURE_EXPORTABLE_BIT"/>
+ <enum bitpos="1" name="VK_EXTERNAL_SEMAPHORE_FEATURE_IMPORTABLE_BIT"/>
+ </enums>
+ <enums name="VkSemaphoreImportFlagBits" type="bitmask">
+ <enum bitpos="0" name="VK_SEMAPHORE_IMPORT_TEMPORARY_BIT"/>
+ </enums>
+ <enums name="VkExternalFenceHandleTypeFlagBits" type="bitmask">
+ <enum bitpos="0" name="VK_EXTERNAL_FENCE_HANDLE_TYPE_OPAQUE_FD_BIT"/>
+ <enum bitpos="1" name="VK_EXTERNAL_FENCE_HANDLE_TYPE_OPAQUE_WIN32_BIT"/>
+ <enum bitpos="2" name="VK_EXTERNAL_FENCE_HANDLE_TYPE_OPAQUE_WIN32_KMT_BIT"/>
+ <enum bitpos="3" name="VK_EXTERNAL_FENCE_HANDLE_TYPE_SYNC_FD_BIT"/>
+ </enums>
+ <enums name="VkExternalFenceFeatureFlagBits" type="bitmask">
+ <enum bitpos="0" name="VK_EXTERNAL_FENCE_FEATURE_EXPORTABLE_BIT"/>
+ <enum bitpos="1" name="VK_EXTERNAL_FENCE_FEATURE_IMPORTABLE_BIT"/>
+ </enums>
+ <enums name="VkFenceImportFlagBits" type="bitmask">
+ <enum bitpos="0" name="VK_FENCE_IMPORT_TEMPORARY_BIT"/>
</enums>
<enums name="VkSurfaceCounterFlagBitsEXT" type="bitmask">
- <enum bitpos="0" name="VK_SURFACE_COUNTER_VBLANK_EXT"/>
+ <enum bitpos="0" name="VK_SURFACE_COUNTER_VBLANK_BIT_EXT"/>
+ <enum name="VK_SURFACE_COUNTER_VBLANK_EXT" alias="VK_SURFACE_COUNTER_VBLANK_BIT_EXT" comment="Backwards-compatible alias containing a typo"/>
</enums>
<enums name="VkDisplayPowerStateEXT" type="enum">
- <enum value="0" name="VK_DISPLAY_POWER_STATE_OFF_EXT"/>
- <enum value="1" name="VK_DISPLAY_POWER_STATE_SUSPEND_EXT"/>
- <enum value="2" name="VK_DISPLAY_POWER_STATE_ON_EXT"/>
+ <enum value="0" name="VK_DISPLAY_POWER_STATE_OFF_EXT"/>
+ <enum value="1" name="VK_DISPLAY_POWER_STATE_SUSPEND_EXT"/>
+ <enum value="2" name="VK_DISPLAY_POWER_STATE_ON_EXT"/>
</enums>
<enums name="VkDeviceEventTypeEXT" type="enum">
- <enum value="0" name="VK_DEVICE_EVENT_TYPE_DISPLAY_HOTPLUG_EXT"/>
+ <enum value="0" name="VK_DEVICE_EVENT_TYPE_DISPLAY_HOTPLUG_EXT"/>
</enums>
<enums name="VkDisplayEventTypeEXT" type="enum">
- <enum value="0" name="VK_DISPLAY_EVENT_TYPE_FIRST_PIXEL_OUT_EXT"/>
+ <enum value="0" name="VK_DISPLAY_EVENT_TYPE_FIRST_PIXEL_OUT_EXT"/>
+ </enums>
+ <enums name="VkPeerMemoryFeatureFlagBits" type="bitmask">
+ <enum bitpos="0" name="VK_PEER_MEMORY_FEATURE_COPY_SRC_BIT" comment="Can read with vkCmdCopy commands"/>
+ <enum bitpos="1" name="VK_PEER_MEMORY_FEATURE_COPY_DST_BIT" comment="Can write with vkCmdCopy commands"/>
+ <enum bitpos="2" name="VK_PEER_MEMORY_FEATURE_GENERIC_SRC_BIT" comment="Can read with any access type/command"/>
+ <enum bitpos="3" name="VK_PEER_MEMORY_FEATURE_GENERIC_DST_BIT" comment="Can write with and access type/command"/>
+ </enums>
+ <enums name="VkMemoryAllocateFlagBits" type="bitmask">
+ <enum bitpos="0" name="VK_MEMORY_ALLOCATE_DEVICE_MASK_BIT" comment="Force allocation on specific devices"/>
+ </enums>
+ <enums name="VkDeviceGroupPresentModeFlagBitsKHR" type="bitmask">
+ <enum bitpos="0" name="VK_DEVICE_GROUP_PRESENT_MODE_LOCAL_BIT_KHR" comment="Present from local memory"/>
+ <enum bitpos="1" name="VK_DEVICE_GROUP_PRESENT_MODE_REMOTE_BIT_KHR" comment="Present from remote memory"/>
+ <enum bitpos="2" name="VK_DEVICE_GROUP_PRESENT_MODE_SUM_BIT_KHR" comment="Present sum of local and/or remote memory"/>
+ <enum bitpos="3" name="VK_DEVICE_GROUP_PRESENT_MODE_LOCAL_MULTI_DEVICE_BIT_KHR" comment="Each physical device presents from local memory"/>
+ </enums>
+ <enums name="VkSwapchainCreateFlagBitsKHR" type="bitmask">
+ </enums>
+ <enums name="VkViewportCoordinateSwizzleNV" type="enum">
+ <enum value="0" name="VK_VIEWPORT_COORDINATE_SWIZZLE_POSITIVE_X_NV"/>
+ <enum value="1" name="VK_VIEWPORT_COORDINATE_SWIZZLE_NEGATIVE_X_NV"/>
+ <enum value="2" name="VK_VIEWPORT_COORDINATE_SWIZZLE_POSITIVE_Y_NV"/>
+ <enum value="3" name="VK_VIEWPORT_COORDINATE_SWIZZLE_NEGATIVE_Y_NV"/>
+ <enum value="4" name="VK_VIEWPORT_COORDINATE_SWIZZLE_POSITIVE_Z_NV"/>
+ <enum value="5" name="VK_VIEWPORT_COORDINATE_SWIZZLE_NEGATIVE_Z_NV"/>
+ <enum value="6" name="VK_VIEWPORT_COORDINATE_SWIZZLE_POSITIVE_W_NV"/>
+ <enum value="7" name="VK_VIEWPORT_COORDINATE_SWIZZLE_NEGATIVE_W_NV"/>
+ </enums>
+ <enums name="VkDiscardRectangleModeEXT" type="enum">
+ <enum value="0" name="VK_DISCARD_RECTANGLE_MODE_INCLUSIVE_EXT"/>
+ <enum value="1" name="VK_DISCARD_RECTANGLE_MODE_EXCLUSIVE_EXT"/>
+ </enums>
+ <enums name="VkSubpassDescriptionFlagBits" type="bitmask">
+ </enums>
+ <enums name="VkPointClippingBehavior" type="enum">
+ <enum value="0" name="VK_POINT_CLIPPING_BEHAVIOR_ALL_CLIP_PLANES"/>
+ <enum value="1" name="VK_POINT_CLIPPING_BEHAVIOR_USER_CLIP_PLANES_ONLY"/>
+ </enums>
+ <enums name="VkSamplerReductionMode" type="enum">
+ <enum value="0" name="VK_SAMPLER_REDUCTION_MODE_WEIGHTED_AVERAGE"/>
+ <enum value="1" name="VK_SAMPLER_REDUCTION_MODE_MIN"/>
+ <enum value="2" name="VK_SAMPLER_REDUCTION_MODE_MAX"/>
+ </enums>
+ <enums name="VkTessellationDomainOrigin" type="enum">
+ <enum value="0" name="VK_TESSELLATION_DOMAIN_ORIGIN_UPPER_LEFT"/>
+ <enum value="1" name="VK_TESSELLATION_DOMAIN_ORIGIN_LOWER_LEFT"/>
+ </enums>
+ <enums name="VkSamplerYcbcrModelConversion" type="enum">
+ <enum value="0" name="VK_SAMPLER_YCBCR_MODEL_CONVERSION_RGB_IDENTITY"/>
+ <enum value="1" name="VK_SAMPLER_YCBCR_MODEL_CONVERSION_YCBCR_IDENTITY" comment="just range expansion"/>
+ <enum value="2" name="VK_SAMPLER_YCBCR_MODEL_CONVERSION_YCBCR_709" comment="aka HD YUV"/>
+ <enum value="3" name="VK_SAMPLER_YCBCR_MODEL_CONVERSION_YCBCR_601" comment="aka SD YUV"/>
+ <enum value="4" name="VK_SAMPLER_YCBCR_MODEL_CONVERSION_YCBCR_2020" comment="aka UHD YUV"/>
+ </enums>
+ <enums name="VkSamplerYcbcrRange" type="enum">
+ <enum value="0" name="VK_SAMPLER_YCBCR_RANGE_ITU_FULL" comment="Luma 0..1 maps to 0..255, chroma -0.5..0.5 to 1..255 (clamped)"/>
+ <enum value="1" name="VK_SAMPLER_YCBCR_RANGE_ITU_NARROW" comment="Luma 0..1 maps to 16..235, chroma -0.5..0.5 to 16..240"/>
+ </enums>
+ <enums name="VkChromaLocation" type="enum">
+ <enum value="0" name="VK_CHROMA_LOCATION_COSITED_EVEN"/>
+ <enum value="1" name="VK_CHROMA_LOCATION_MIDPOINT"/>
+ </enums>
+ <enums name="VkBlendOverlapEXT" type="enum">
+ <enum value="0" name="VK_BLEND_OVERLAP_UNCORRELATED_EXT"/>
+ <enum value="1" name="VK_BLEND_OVERLAP_DISJOINT_EXT"/>
+ <enum value="2" name="VK_BLEND_OVERLAP_CONJOINT_EXT"/>
+ </enums>
+ <enums name="VkCoverageModulationModeNV" type="enum">
+ <enum value="0" name="VK_COVERAGE_MODULATION_MODE_NONE_NV"/>
+ <enum value="1" name="VK_COVERAGE_MODULATION_MODE_RGB_NV"/>
+ <enum value="2" name="VK_COVERAGE_MODULATION_MODE_ALPHA_NV"/>
+ <enum value="3" name="VK_COVERAGE_MODULATION_MODE_RGBA_NV"/>
+ </enums>
+ <enums name="VkCoverageReductionModeNV" type="enum">
+ <enum value="0" name="VK_COVERAGE_REDUCTION_MODE_MERGE_NV"/>
+ <enum value="1" name="VK_COVERAGE_REDUCTION_MODE_TRUNCATE_NV"/>
+ </enums>
+ <enums name="VkValidationCacheHeaderVersionEXT" type="enum">
+ <enum value="1" name="VK_VALIDATION_CACHE_HEADER_VERSION_ONE_EXT"/>
+ </enums>
+ <enums name="VkShaderInfoTypeAMD" type="enum">
+ <enum value="0" name="VK_SHADER_INFO_TYPE_STATISTICS_AMD"/>
+ <enum value="1" name="VK_SHADER_INFO_TYPE_BINARY_AMD"/>
+ <enum value="2" name="VK_SHADER_INFO_TYPE_DISASSEMBLY_AMD"/>
+ </enums>
+ <enums name="VkQueueGlobalPriorityKHR" type="enum">
+ <enum value="128" name="VK_QUEUE_GLOBAL_PRIORITY_LOW_KHR"/>
+ <enum value="256" name="VK_QUEUE_GLOBAL_PRIORITY_MEDIUM_KHR"/>
+ <enum value="512" name="VK_QUEUE_GLOBAL_PRIORITY_HIGH_KHR"/>
+ <enum value="1024" name="VK_QUEUE_GLOBAL_PRIORITY_REALTIME_KHR"/>
+ <enum name="VK_QUEUE_GLOBAL_PRIORITY_LOW_EXT" alias="VK_QUEUE_GLOBAL_PRIORITY_LOW_KHR"/>
+ <enum name="VK_QUEUE_GLOBAL_PRIORITY_MEDIUM_EXT" alias="VK_QUEUE_GLOBAL_PRIORITY_MEDIUM_KHR"/>
+ <enum name="VK_QUEUE_GLOBAL_PRIORITY_HIGH_EXT" alias="VK_QUEUE_GLOBAL_PRIORITY_HIGH_KHR"/>
+ <enum name="VK_QUEUE_GLOBAL_PRIORITY_REALTIME_EXT" alias="VK_QUEUE_GLOBAL_PRIORITY_REALTIME_KHR"/>
+ </enums>
+ <enums name="VkDebugUtilsMessageSeverityFlagBitsEXT" type="bitmask">
+ <enum bitpos="0" name="VK_DEBUG_UTILS_MESSAGE_SEVERITY_VERBOSE_BIT_EXT"/>
+ <enum bitpos="4" name="VK_DEBUG_UTILS_MESSAGE_SEVERITY_INFO_BIT_EXT"/>
+ <enum bitpos="8" name="VK_DEBUG_UTILS_MESSAGE_SEVERITY_WARNING_BIT_EXT"/>
+ <enum bitpos="12" name="VK_DEBUG_UTILS_MESSAGE_SEVERITY_ERROR_BIT_EXT"/>
+ </enums>
+ <enums name="VkDebugUtilsMessageTypeFlagBitsEXT" type="bitmask">
+ <enum bitpos="0" name="VK_DEBUG_UTILS_MESSAGE_TYPE_GENERAL_BIT_EXT"/>
+ <enum bitpos="1" name="VK_DEBUG_UTILS_MESSAGE_TYPE_VALIDATION_BIT_EXT"/>
+ <enum bitpos="2" name="VK_DEBUG_UTILS_MESSAGE_TYPE_PERFORMANCE_BIT_EXT"/>
+ </enums>
+ <enums name="VkConservativeRasterizationModeEXT" type="enum">
+ <enum value="0" name="VK_CONSERVATIVE_RASTERIZATION_MODE_DISABLED_EXT"/>
+ <enum value="1" name="VK_CONSERVATIVE_RASTERIZATION_MODE_OVERESTIMATE_EXT"/>
+ <enum value="2" name="VK_CONSERVATIVE_RASTERIZATION_MODE_UNDERESTIMATE_EXT"/>
+ </enums>
+ <enums name="VkDescriptorBindingFlagBits" type="bitmask">
+ <enum bitpos="0" name="VK_DESCRIPTOR_BINDING_UPDATE_AFTER_BIND_BIT"/>
+ <enum bitpos="1" name="VK_DESCRIPTOR_BINDING_UPDATE_UNUSED_WHILE_PENDING_BIT"/>
+ <enum bitpos="2" name="VK_DESCRIPTOR_BINDING_PARTIALLY_BOUND_BIT"/>
+ <enum bitpos="3" name="VK_DESCRIPTOR_BINDING_VARIABLE_DESCRIPTOR_COUNT_BIT"/>
+ </enums>
+ <enums name="VkVendorId" type="enum">
+ <comment>Vendor IDs are now represented as enums instead of the old
+ &lt;vendorids&gt; tag, allowing them to be included in the
+ API headers.</comment>
+ <enum value="0x10001" name="VK_VENDOR_ID_VIV" comment="Vivante vendor ID"/>
+ <enum value="0x10002" name="VK_VENDOR_ID_VSI" comment="VeriSilicon vendor ID"/>
+ <enum value="0x10003" name="VK_VENDOR_ID_KAZAN" comment="Kazan Software Renderer"/>
+ <enum value="0x10004" name="VK_VENDOR_ID_CODEPLAY" comment="Codeplay Software Ltd. vendor ID"/>
+ <enum value="0x10005" name="VK_VENDOR_ID_MESA" comment="Mesa vendor ID"/>
+ <enum value="0x10006" name="VK_VENDOR_ID_POCL" comment="PoCL vendor ID"/>
+ <unused start="0x10007" comment="This is the next unused available Khronos vendor ID"/>
+ </enums>
+ <enums name="VkDriverId" type="enum">
+ <comment>Driver IDs are now represented as enums instead of the old
+ &lt;driverids&gt; tag, allowing them to be included in the
+ API headers.</comment>
+ <enum value="1" name="VK_DRIVER_ID_AMD_PROPRIETARY" comment="Advanced Micro Devices, Inc."/>
+ <enum value="2" name="VK_DRIVER_ID_AMD_OPEN_SOURCE" comment="Advanced Micro Devices, Inc."/>
+ <enum value="3" name="VK_DRIVER_ID_MESA_RADV" comment="Mesa open source project"/>
+ <enum value="4" name="VK_DRIVER_ID_NVIDIA_PROPRIETARY" comment="NVIDIA Corporation"/>
+ <enum value="5" name="VK_DRIVER_ID_INTEL_PROPRIETARY_WINDOWS" comment="Intel Corporation"/>
+ <enum value="6" name="VK_DRIVER_ID_INTEL_OPEN_SOURCE_MESA" comment="Intel Corporation"/>
+ <enum value="7" name="VK_DRIVER_ID_IMAGINATION_PROPRIETARY" comment="Imagination Technologies"/>
+ <enum value="8" name="VK_DRIVER_ID_QUALCOMM_PROPRIETARY" comment="Qualcomm Technologies, Inc."/>
+ <enum value="9" name="VK_DRIVER_ID_ARM_PROPRIETARY" comment="Arm Limited"/>
+ <enum value="10" name="VK_DRIVER_ID_GOOGLE_SWIFTSHADER" comment="Google LLC"/>
+ <enum value="11" name="VK_DRIVER_ID_GGP_PROPRIETARY" comment="Google LLC"/>
+ <enum value="12" name="VK_DRIVER_ID_BROADCOM_PROPRIETARY" comment="Broadcom Inc."/>
+ <enum value="13" name="VK_DRIVER_ID_MESA_LLVMPIPE" comment="Mesa"/>
+ <enum value="14" name="VK_DRIVER_ID_MOLTENVK" comment="MoltenVK"/>
+ <enum value="15" name="VK_DRIVER_ID_COREAVI_PROPRIETARY" comment="Core Avionics &amp; Industrial Inc."/>
+ <enum value="16" name="VK_DRIVER_ID_JUICE_PROPRIETARY" comment="Juice Technologies, Inc."/>
+ <enum value="17" name="VK_DRIVER_ID_VERISILICON_PROPRIETARY" comment="Verisilicon, Inc."/>
+ <enum value="18" name="VK_DRIVER_ID_MESA_TURNIP" comment="Mesa open source project"/>
+ <enum value="19" name="VK_DRIVER_ID_MESA_V3DV" comment="Mesa open source project"/>
+ <enum value="20" name="VK_DRIVER_ID_MESA_PANVK" comment="Mesa open source project"/>
+ <enum value="21" name="VK_DRIVER_ID_SAMSUNG_PROPRIETARY" comment="Samsung Electronics Co., Ltd."/>
+ <enum value="22" name="VK_DRIVER_ID_MESA_VENUS" comment="Mesa open source project"/>
+ <enum value="23" name="VK_DRIVER_ID_MESA_DOZEN" comment="Mesa open source project"/>
+ </enums>
+ <enums name="VkConditionalRenderingFlagBitsEXT" type="bitmask">
+ <enum bitpos="0" name="VK_CONDITIONAL_RENDERING_INVERTED_BIT_EXT"/>
+ </enums>
+ <enums name="VkResolveModeFlagBits" type="bitmask">
+ <enum value="0" name="VK_RESOLVE_MODE_NONE"/>
+ <enum bitpos="0" name="VK_RESOLVE_MODE_SAMPLE_ZERO_BIT"/>
+ <enum bitpos="1" name="VK_RESOLVE_MODE_AVERAGE_BIT"/>
+ <enum bitpos="2" name="VK_RESOLVE_MODE_MIN_BIT"/>
+ <enum bitpos="3" name="VK_RESOLVE_MODE_MAX_BIT"/>
+ </enums>
+ <enums name="VkShadingRatePaletteEntryNV" type="enum">
+ <enum value="0" name="VK_SHADING_RATE_PALETTE_ENTRY_NO_INVOCATIONS_NV"/>
+ <enum value="1" name="VK_SHADING_RATE_PALETTE_ENTRY_16_INVOCATIONS_PER_PIXEL_NV"/>
+ <enum value="2" name="VK_SHADING_RATE_PALETTE_ENTRY_8_INVOCATIONS_PER_PIXEL_NV"/>
+ <enum value="3" name="VK_SHADING_RATE_PALETTE_ENTRY_4_INVOCATIONS_PER_PIXEL_NV"/>
+ <enum value="4" name="VK_SHADING_RATE_PALETTE_ENTRY_2_INVOCATIONS_PER_PIXEL_NV"/>
+ <enum value="5" name="VK_SHADING_RATE_PALETTE_ENTRY_1_INVOCATION_PER_PIXEL_NV"/>
+ <enum value="6" name="VK_SHADING_RATE_PALETTE_ENTRY_1_INVOCATION_PER_2X1_PIXELS_NV"/>
+ <enum value="7" name="VK_SHADING_RATE_PALETTE_ENTRY_1_INVOCATION_PER_1X2_PIXELS_NV"/>
+ <enum value="8" name="VK_SHADING_RATE_PALETTE_ENTRY_1_INVOCATION_PER_2X2_PIXELS_NV"/>
+ <enum value="9" name="VK_SHADING_RATE_PALETTE_ENTRY_1_INVOCATION_PER_4X2_PIXELS_NV"/>
+ <enum value="10" name="VK_SHADING_RATE_PALETTE_ENTRY_1_INVOCATION_PER_2X4_PIXELS_NV"/>
+ <enum value="11" name="VK_SHADING_RATE_PALETTE_ENTRY_1_INVOCATION_PER_4X4_PIXELS_NV"/>
+ </enums>
+ <enums name="VkCoarseSampleOrderTypeNV" type="enum">
+ <enum value="0" name="VK_COARSE_SAMPLE_ORDER_TYPE_DEFAULT_NV"/>
+ <enum value="1" name="VK_COARSE_SAMPLE_ORDER_TYPE_CUSTOM_NV"/>
+ <enum value="2" name="VK_COARSE_SAMPLE_ORDER_TYPE_PIXEL_MAJOR_NV"/>
+ <enum value="3" name="VK_COARSE_SAMPLE_ORDER_TYPE_SAMPLE_MAJOR_NV"/>
+ </enums>
+ <enums name="VkGeometryInstanceFlagBitsKHR" type="bitmask">
+ <enum bitpos="0" name="VK_GEOMETRY_INSTANCE_TRIANGLE_FACING_CULL_DISABLE_BIT_KHR"/>
+ <enum bitpos="1" name="VK_GEOMETRY_INSTANCE_TRIANGLE_FLIP_FACING_BIT_KHR"/>
+ <enum bitpos="2" name="VK_GEOMETRY_INSTANCE_FORCE_OPAQUE_BIT_KHR"/>
+ <enum bitpos="3" name="VK_GEOMETRY_INSTANCE_FORCE_NO_OPAQUE_BIT_KHR"/>
+ <enum name="VK_GEOMETRY_INSTANCE_TRIANGLE_FRONT_COUNTERCLOCKWISE_BIT_KHR" alias="VK_GEOMETRY_INSTANCE_TRIANGLE_FLIP_FACING_BIT_KHR"/>
+ </enums>
+ <enums name="VkGeometryFlagBitsKHR" type="bitmask">
+ <enum bitpos="0" name="VK_GEOMETRY_OPAQUE_BIT_KHR"/>
+ <enum bitpos="1" name="VK_GEOMETRY_NO_DUPLICATE_ANY_HIT_INVOCATION_BIT_KHR"/>
+ </enums>
+ <enums name="VkBuildAccelerationStructureFlagBitsKHR" type="bitmask">
+ <enum bitpos="0" name="VK_BUILD_ACCELERATION_STRUCTURE_ALLOW_UPDATE_BIT_KHR"/>
+ <enum bitpos="1" name="VK_BUILD_ACCELERATION_STRUCTURE_ALLOW_COMPACTION_BIT_KHR"/>
+ <enum bitpos="2" name="VK_BUILD_ACCELERATION_STRUCTURE_PREFER_FAST_TRACE_BIT_KHR"/>
+ <enum bitpos="3" name="VK_BUILD_ACCELERATION_STRUCTURE_PREFER_FAST_BUILD_BIT_KHR"/>
+ <enum bitpos="4" name="VK_BUILD_ACCELERATION_STRUCTURE_LOW_MEMORY_BIT_KHR"/>
+ </enums>
+ <enums name="VkAccelerationStructureCreateFlagBitsKHR" type="bitmask">
+ <enum bitpos="0" name="VK_ACCELERATION_STRUCTURE_CREATE_DEVICE_ADDRESS_CAPTURE_REPLAY_BIT_KHR"/>
+ </enums>
+ <enums name="VkCopyAccelerationStructureModeKHR" type="enum">
+ <enum value="0" name="VK_COPY_ACCELERATION_STRUCTURE_MODE_CLONE_KHR"/>
+ <enum value="1" name="VK_COPY_ACCELERATION_STRUCTURE_MODE_COMPACT_KHR"/>
+ <enum value="2" name="VK_COPY_ACCELERATION_STRUCTURE_MODE_SERIALIZE_KHR"/>
+ <enum value="3" name="VK_COPY_ACCELERATION_STRUCTURE_MODE_DESERIALIZE_KHR"/>
+ </enums>
+ <enums name="VkBuildAccelerationStructureModeKHR" type="enum">
+ <enum value="0" name="VK_BUILD_ACCELERATION_STRUCTURE_MODE_BUILD_KHR"/>
+ <enum value="1" name="VK_BUILD_ACCELERATION_STRUCTURE_MODE_UPDATE_KHR"/>
+ </enums>
+ <enums name="VkAccelerationStructureTypeKHR" type="enum">
+ <enum value="0" name="VK_ACCELERATION_STRUCTURE_TYPE_TOP_LEVEL_KHR"/>
+ <enum value="1" name="VK_ACCELERATION_STRUCTURE_TYPE_BOTTOM_LEVEL_KHR"/>
+ <enum value="2" name="VK_ACCELERATION_STRUCTURE_TYPE_GENERIC_KHR"/>
+ </enums>
+ <enums name="VkGeometryTypeKHR" type="enum">
+ <enum value="0" name="VK_GEOMETRY_TYPE_TRIANGLES_KHR"/>
+ <enum value="1" name="VK_GEOMETRY_TYPE_AABBS_KHR"/>
+ <enum value="2" name="VK_GEOMETRY_TYPE_INSTANCES_KHR"/>
+ </enums>
+ <enums name="VkAccelerationStructureMemoryRequirementsTypeNV" type="enum">
+ <enum value="0" name="VK_ACCELERATION_STRUCTURE_MEMORY_REQUIREMENTS_TYPE_OBJECT_NV"/>
+ <enum value="1" name="VK_ACCELERATION_STRUCTURE_MEMORY_REQUIREMENTS_TYPE_BUILD_SCRATCH_NV"/>
+ <enum value="2" name="VK_ACCELERATION_STRUCTURE_MEMORY_REQUIREMENTS_TYPE_UPDATE_SCRATCH_NV"/>
+ </enums>
+ <enums name="VkAccelerationStructureBuildTypeKHR" type="enum">
+ <enum value="0" name="VK_ACCELERATION_STRUCTURE_BUILD_TYPE_HOST_KHR"/>
+ <enum value="1" name="VK_ACCELERATION_STRUCTURE_BUILD_TYPE_DEVICE_KHR"/>
+ <enum value="2" name="VK_ACCELERATION_STRUCTURE_BUILD_TYPE_HOST_OR_DEVICE_KHR"/>
+ </enums>
+ <enums name="VkRayTracingShaderGroupTypeKHR" type="enum">
+ <enum value="0" name="VK_RAY_TRACING_SHADER_GROUP_TYPE_GENERAL_KHR"/>
+ <enum value="1" name="VK_RAY_TRACING_SHADER_GROUP_TYPE_TRIANGLES_HIT_GROUP_KHR"/>
+ <enum value="2" name="VK_RAY_TRACING_SHADER_GROUP_TYPE_PROCEDURAL_HIT_GROUP_KHR"/>
+ </enums>
+ <enums name="VkAccelerationStructureCompatibilityKHR" type="enum">
+ <enum value="0" name="VK_ACCELERATION_STRUCTURE_COMPATIBILITY_COMPATIBLE_KHR"/>
+ <enum value="1" name="VK_ACCELERATION_STRUCTURE_COMPATIBILITY_INCOMPATIBLE_KHR"/>
+ </enums>
+ <enums name="VkShaderGroupShaderKHR" type="enum">
+ <enum value="0" name="VK_SHADER_GROUP_SHADER_GENERAL_KHR"/>
+ <enum value="1" name="VK_SHADER_GROUP_SHADER_CLOSEST_HIT_KHR"/>
+ <enum value="2" name="VK_SHADER_GROUP_SHADER_ANY_HIT_KHR"/>
+ <enum value="3" name="VK_SHADER_GROUP_SHADER_INTERSECTION_KHR"/>
+ </enums>
+ <enums name="VkMemoryOverallocationBehaviorAMD" type="enum">
+ <enum value="0" name="VK_MEMORY_OVERALLOCATION_BEHAVIOR_DEFAULT_AMD"/>
+ <enum value="1" name="VK_MEMORY_OVERALLOCATION_BEHAVIOR_ALLOWED_AMD"/>
+ <enum value="2" name="VK_MEMORY_OVERALLOCATION_BEHAVIOR_DISALLOWED_AMD"/>
+ </enums>
+ <enums name="VkFramebufferCreateFlagBits" type="bitmask">
+ </enums>
+ <enums name="VkScopeNV" type="enum">
+ <enum value="1" name="VK_SCOPE_DEVICE_NV"/>
+ <enum value="2" name="VK_SCOPE_WORKGROUP_NV"/>
+ <enum value="3" name="VK_SCOPE_SUBGROUP_NV"/>
+ <enum value="5" name="VK_SCOPE_QUEUE_FAMILY_NV"/>
+ </enums>
+ <enums name="VkComponentTypeNV" type="enum">
+ <enum value="0" name="VK_COMPONENT_TYPE_FLOAT16_NV"/>
+ <enum value="1" name="VK_COMPONENT_TYPE_FLOAT32_NV"/>
+ <enum value="2" name="VK_COMPONENT_TYPE_FLOAT64_NV"/>
+ <enum value="3" name="VK_COMPONENT_TYPE_SINT8_NV"/>
+ <enum value="4" name="VK_COMPONENT_TYPE_SINT16_NV"/>
+ <enum value="5" name="VK_COMPONENT_TYPE_SINT32_NV"/>
+ <enum value="6" name="VK_COMPONENT_TYPE_SINT64_NV"/>
+ <enum value="7" name="VK_COMPONENT_TYPE_UINT8_NV"/>
+ <enum value="8" name="VK_COMPONENT_TYPE_UINT16_NV"/>
+ <enum value="9" name="VK_COMPONENT_TYPE_UINT32_NV"/>
+ <enum value="10" name="VK_COMPONENT_TYPE_UINT64_NV"/>
+ </enums>
+ <enums name="VkDeviceDiagnosticsConfigFlagBitsNV" type="bitmask">
+ <enum bitpos="0" name="VK_DEVICE_DIAGNOSTICS_CONFIG_ENABLE_SHADER_DEBUG_INFO_BIT_NV"/>
+ <enum bitpos="1" name="VK_DEVICE_DIAGNOSTICS_CONFIG_ENABLE_RESOURCE_TRACKING_BIT_NV"/>
+ <enum bitpos="2" name="VK_DEVICE_DIAGNOSTICS_CONFIG_ENABLE_AUTOMATIC_CHECKPOINTS_BIT_NV"/>
+ <enum bitpos="3" name="VK_DEVICE_DIAGNOSTICS_CONFIG_ENABLE_SHADER_ERROR_REPORTING_BIT_NV"/>
+ </enums>
+ <enums name="VkPipelineCreationFeedbackFlagBits" type="bitmask">
+ <enum bitpos="0" name="VK_PIPELINE_CREATION_FEEDBACK_VALID_BIT"/>
+ <enum name="VK_PIPELINE_CREATION_FEEDBACK_VALID_BIT_EXT" alias="VK_PIPELINE_CREATION_FEEDBACK_VALID_BIT"/>
+ <enum bitpos="1" name="VK_PIPELINE_CREATION_FEEDBACK_APPLICATION_PIPELINE_CACHE_HIT_BIT"/>
+ <enum name="VK_PIPELINE_CREATION_FEEDBACK_APPLICATION_PIPELINE_CACHE_HIT_BIT_EXT" alias="VK_PIPELINE_CREATION_FEEDBACK_APPLICATION_PIPELINE_CACHE_HIT_BIT"/>
+ <enum bitpos="2" name="VK_PIPELINE_CREATION_FEEDBACK_BASE_PIPELINE_ACCELERATION_BIT"/>
+ <enum name="VK_PIPELINE_CREATION_FEEDBACK_BASE_PIPELINE_ACCELERATION_BIT_EXT" alias="VK_PIPELINE_CREATION_FEEDBACK_BASE_PIPELINE_ACCELERATION_BIT"/>
+ </enums>
+ <enums name="VkFullScreenExclusiveEXT" type="enum">
+ <enum value="0" name="VK_FULL_SCREEN_EXCLUSIVE_DEFAULT_EXT"/>
+ <enum value="1" name="VK_FULL_SCREEN_EXCLUSIVE_ALLOWED_EXT"/>
+ <enum value="2" name="VK_FULL_SCREEN_EXCLUSIVE_DISALLOWED_EXT"/>
+ <enum value="3" name="VK_FULL_SCREEN_EXCLUSIVE_APPLICATION_CONTROLLED_EXT"/>
+ </enums>
+ <enums name="VkPerformanceCounterScopeKHR" type="enum">
+ <enum value="0" name="VK_PERFORMANCE_COUNTER_SCOPE_COMMAND_BUFFER_KHR"/>
+ <enum value="1" name="VK_PERFORMANCE_COUNTER_SCOPE_RENDER_PASS_KHR"/>
+ <enum value="2" name="VK_PERFORMANCE_COUNTER_SCOPE_COMMAND_KHR"/>
+ <enum name="VK_QUERY_SCOPE_COMMAND_BUFFER_KHR" alias="VK_PERFORMANCE_COUNTER_SCOPE_COMMAND_BUFFER_KHR" comment="Backwards-compatible alias containing a typo"/>
+ <enum name="VK_QUERY_SCOPE_RENDER_PASS_KHR" alias="VK_PERFORMANCE_COUNTER_SCOPE_RENDER_PASS_KHR" comment="Backwards-compatible alias containing a typo"/>
+ <enum name="VK_QUERY_SCOPE_COMMAND_KHR" alias="VK_PERFORMANCE_COUNTER_SCOPE_COMMAND_KHR" comment="Backwards-compatible alias containing a typo"/>
+ </enums>
+ <enums name="VkPerformanceCounterUnitKHR" type="enum">
+ <enum value="0" name="VK_PERFORMANCE_COUNTER_UNIT_GENERIC_KHR"/>
+ <enum value="1" name="VK_PERFORMANCE_COUNTER_UNIT_PERCENTAGE_KHR"/>
+ <enum value="2" name="VK_PERFORMANCE_COUNTER_UNIT_NANOSECONDS_KHR"/>
+ <enum value="3" name="VK_PERFORMANCE_COUNTER_UNIT_BYTES_KHR"/>
+ <enum value="4" name="VK_PERFORMANCE_COUNTER_UNIT_BYTES_PER_SECOND_KHR"/>
+ <enum value="5" name="VK_PERFORMANCE_COUNTER_UNIT_KELVIN_KHR"/>
+ <enum value="6" name="VK_PERFORMANCE_COUNTER_UNIT_WATTS_KHR"/>
+ <enum value="7" name="VK_PERFORMANCE_COUNTER_UNIT_VOLTS_KHR"/>
+ <enum value="8" name="VK_PERFORMANCE_COUNTER_UNIT_AMPS_KHR"/>
+ <enum value="9" name="VK_PERFORMANCE_COUNTER_UNIT_HERTZ_KHR"/>
+ <enum value="10" name="VK_PERFORMANCE_COUNTER_UNIT_CYCLES_KHR"/>
+ </enums>
+ <enums name="VkPerformanceCounterStorageKHR" type="enum">
+ <enum value="0" name="VK_PERFORMANCE_COUNTER_STORAGE_INT32_KHR"/>
+ <enum value="1" name="VK_PERFORMANCE_COUNTER_STORAGE_INT64_KHR"/>
+ <enum value="2" name="VK_PERFORMANCE_COUNTER_STORAGE_UINT32_KHR"/>
+ <enum value="3" name="VK_PERFORMANCE_COUNTER_STORAGE_UINT64_KHR"/>
+ <enum value="4" name="VK_PERFORMANCE_COUNTER_STORAGE_FLOAT32_KHR"/>
+ <enum value="5" name="VK_PERFORMANCE_COUNTER_STORAGE_FLOAT64_KHR"/>
+ </enums>
+ <enums name="VkPerformanceCounterDescriptionFlagBitsKHR" type="bitmask">
+ <enum bitpos="0" name="VK_PERFORMANCE_COUNTER_DESCRIPTION_PERFORMANCE_IMPACTING_BIT_KHR"/>
+ <enum name="VK_PERFORMANCE_COUNTER_DESCRIPTION_PERFORMANCE_IMPACTING_KHR" alias="VK_PERFORMANCE_COUNTER_DESCRIPTION_PERFORMANCE_IMPACTING_BIT_KHR" comment="Backwards-compatible alias containing a typo"/>
+ <enum bitpos="1" name="VK_PERFORMANCE_COUNTER_DESCRIPTION_CONCURRENTLY_IMPACTED_BIT_KHR"/>
+ <enum name="VK_PERFORMANCE_COUNTER_DESCRIPTION_CONCURRENTLY_IMPACTED_KHR" alias="VK_PERFORMANCE_COUNTER_DESCRIPTION_CONCURRENTLY_IMPACTED_BIT_KHR" comment="Backwards-compatible alias containing a typo"/>
+ </enums>
+ <enums name="VkAcquireProfilingLockFlagBitsKHR" type="bitmask">
+ </enums>
+ <enums name="VkShaderCorePropertiesFlagBitsAMD" type="bitmask">
+ </enums>
+ <enums name="VkPerformanceConfigurationTypeINTEL" type="enum">
+ <enum value="0" name="VK_PERFORMANCE_CONFIGURATION_TYPE_COMMAND_QUEUE_METRICS_DISCOVERY_ACTIVATED_INTEL"/>
+ </enums>
+ <enums name="VkQueryPoolSamplingModeINTEL" type="enum">
+ <enum value="0" name="VK_QUERY_POOL_SAMPLING_MODE_MANUAL_INTEL"/>
+ </enums>
+ <enums name="VkPerformanceOverrideTypeINTEL" type="enum">
+ <enum value="0" name="VK_PERFORMANCE_OVERRIDE_TYPE_NULL_HARDWARE_INTEL"/>
+ <enum value="1" name="VK_PERFORMANCE_OVERRIDE_TYPE_FLUSH_GPU_CACHES_INTEL"/>
+ </enums>
+ <enums name="VkPerformanceParameterTypeINTEL" type="enum">
+ <enum value="0" name="VK_PERFORMANCE_PARAMETER_TYPE_HW_COUNTERS_SUPPORTED_INTEL"/>
+ <enum value="1" name="VK_PERFORMANCE_PARAMETER_TYPE_STREAM_MARKER_VALID_BITS_INTEL"/>
+ </enums>
+ <enums name="VkPerformanceValueTypeINTEL" type="enum">
+ <enum value="0" name="VK_PERFORMANCE_VALUE_TYPE_UINT32_INTEL"/>
+ <enum value="1" name="VK_PERFORMANCE_VALUE_TYPE_UINT64_INTEL"/>
+ <enum value="2" name="VK_PERFORMANCE_VALUE_TYPE_FLOAT_INTEL"/>
+ <enum value="3" name="VK_PERFORMANCE_VALUE_TYPE_BOOL_INTEL"/>
+ <enum value="4" name="VK_PERFORMANCE_VALUE_TYPE_STRING_INTEL"/>
+ </enums>
+ <enums name="VkShaderFloatControlsIndependence" type="enum">
+ <enum value="0" name="VK_SHADER_FLOAT_CONTROLS_INDEPENDENCE_32_BIT_ONLY"/>
+ <enum value="1" name="VK_SHADER_FLOAT_CONTROLS_INDEPENDENCE_ALL"/>
+ <enum value="2" name="VK_SHADER_FLOAT_CONTROLS_INDEPENDENCE_NONE"/>
+ </enums>
+ <enums name="VkPipelineExecutableStatisticFormatKHR" type="enum">
+ <enum value="0" name="VK_PIPELINE_EXECUTABLE_STATISTIC_FORMAT_BOOL32_KHR"/>
+ <enum value="1" name="VK_PIPELINE_EXECUTABLE_STATISTIC_FORMAT_INT64_KHR"/>
+ <enum value="2" name="VK_PIPELINE_EXECUTABLE_STATISTIC_FORMAT_UINT64_KHR"/>
+ <enum value="3" name="VK_PIPELINE_EXECUTABLE_STATISTIC_FORMAT_FLOAT64_KHR"/>
+ </enums>
+ <enums name="VkLineRasterizationModeEXT" type="enum">
+ <enum value="0" name="VK_LINE_RASTERIZATION_MODE_DEFAULT_EXT"/>
+ <enum value="1" name="VK_LINE_RASTERIZATION_MODE_RECTANGULAR_EXT"/>
+ <enum value="2" name="VK_LINE_RASTERIZATION_MODE_BRESENHAM_EXT"/>
+ <enum value="3" name="VK_LINE_RASTERIZATION_MODE_RECTANGULAR_SMOOTH_EXT"/>
+ </enums>
+ <enums name="VkShaderModuleCreateFlagBits" type="bitmask">
+ </enums>
+ <enums name="VkPipelineCompilerControlFlagBitsAMD" type="bitmask">
+ </enums>
+ <enums name="VkToolPurposeFlagBits" type="bitmask">
+ <enum bitpos="0" name="VK_TOOL_PURPOSE_VALIDATION_BIT"/>
+ <enum name="VK_TOOL_PURPOSE_VALIDATION_BIT_EXT" alias="VK_TOOL_PURPOSE_VALIDATION_BIT"/>
+ <enum bitpos="1" name="VK_TOOL_PURPOSE_PROFILING_BIT"/>
+ <enum name="VK_TOOL_PURPOSE_PROFILING_BIT_EXT" alias="VK_TOOL_PURPOSE_PROFILING_BIT"/>
+ <enum bitpos="2" name="VK_TOOL_PURPOSE_TRACING_BIT"/>
+ <enum name="VK_TOOL_PURPOSE_TRACING_BIT_EXT" alias="VK_TOOL_PURPOSE_TRACING_BIT"/>
+ <enum bitpos="3" name="VK_TOOL_PURPOSE_ADDITIONAL_FEATURES_BIT"/>
+ <enum name="VK_TOOL_PURPOSE_ADDITIONAL_FEATURES_BIT_EXT" alias="VK_TOOL_PURPOSE_ADDITIONAL_FEATURES_BIT"/>
+ <enum bitpos="4" name="VK_TOOL_PURPOSE_MODIFYING_FEATURES_BIT"/>
+ <enum name="VK_TOOL_PURPOSE_MODIFYING_FEATURES_BIT_EXT" alias="VK_TOOL_PURPOSE_MODIFYING_FEATURES_BIT"/>
+ </enums>
+ <enums name="VkFragmentShadingRateCombinerOpKHR" type="enum">
+ <enum value="0" name="VK_FRAGMENT_SHADING_RATE_COMBINER_OP_KEEP_KHR"/>
+ <enum value="1" name="VK_FRAGMENT_SHADING_RATE_COMBINER_OP_REPLACE_KHR"/>
+ <enum value="2" name="VK_FRAGMENT_SHADING_RATE_COMBINER_OP_MIN_KHR"/>
+ <enum value="3" name="VK_FRAGMENT_SHADING_RATE_COMBINER_OP_MAX_KHR"/>
+ <enum value="4" name="VK_FRAGMENT_SHADING_RATE_COMBINER_OP_MUL_KHR"/>
+ </enums>
+ <enums name="VkFragmentShadingRateNV" type="enum">
+ <enum value="0" name="VK_FRAGMENT_SHADING_RATE_1_INVOCATION_PER_PIXEL_NV"/>
+ <enum value="1" name="VK_FRAGMENT_SHADING_RATE_1_INVOCATION_PER_1X2_PIXELS_NV"/>
+ <enum value="4" name="VK_FRAGMENT_SHADING_RATE_1_INVOCATION_PER_2X1_PIXELS_NV"/>
+ <enum value="5" name="VK_FRAGMENT_SHADING_RATE_1_INVOCATION_PER_2X2_PIXELS_NV"/>
+ <enum value="6" name="VK_FRAGMENT_SHADING_RATE_1_INVOCATION_PER_2X4_PIXELS_NV"/>
+ <enum value="9" name="VK_FRAGMENT_SHADING_RATE_1_INVOCATION_PER_4X2_PIXELS_NV"/>
+ <enum value="10" name="VK_FRAGMENT_SHADING_RATE_1_INVOCATION_PER_4X4_PIXELS_NV"/>
+ <enum value="11" name="VK_FRAGMENT_SHADING_RATE_2_INVOCATIONS_PER_PIXEL_NV"/>
+ <enum value="12" name="VK_FRAGMENT_SHADING_RATE_4_INVOCATIONS_PER_PIXEL_NV"/>
+ <enum value="13" name="VK_FRAGMENT_SHADING_RATE_8_INVOCATIONS_PER_PIXEL_NV"/>
+ <enum value="14" name="VK_FRAGMENT_SHADING_RATE_16_INVOCATIONS_PER_PIXEL_NV"/>
+ <enum value="15" name="VK_FRAGMENT_SHADING_RATE_NO_INVOCATIONS_NV"/>
+ </enums>
+ <enums name="VkFragmentShadingRateTypeNV" type="enum">
+ <enum value="0" name="VK_FRAGMENT_SHADING_RATE_TYPE_FRAGMENT_SIZE_NV"/>
+ <enum value="1" name="VK_FRAGMENT_SHADING_RATE_TYPE_ENUMS_NV"/>
+ </enums>
+ <enums name="VkSubpassMergeStatusEXT" type="enum">
+ <enum value="0" name="VK_SUBPASS_MERGE_STATUS_MERGED_EXT"/>
+ <enum value="1" name="VK_SUBPASS_MERGE_STATUS_DISALLOWED_EXT"/>
+ <enum value="2" name="VK_SUBPASS_MERGE_STATUS_NOT_MERGED_SIDE_EFFECTS_EXT"/>
+ <enum value="3" name="VK_SUBPASS_MERGE_STATUS_NOT_MERGED_SAMPLES_MISMATCH_EXT"/>
+ <enum value="4" name="VK_SUBPASS_MERGE_STATUS_NOT_MERGED_VIEWS_MISMATCH_EXT"/>
+ <enum value="5" name="VK_SUBPASS_MERGE_STATUS_NOT_MERGED_ALIASING_EXT"/>
+ <enum value="6" name="VK_SUBPASS_MERGE_STATUS_NOT_MERGED_DEPENDENCIES_EXT"/>
+ <enum value="7" name="VK_SUBPASS_MERGE_STATUS_NOT_MERGED_INCOMPATIBLE_INPUT_ATTACHMENT_EXT"/>
+ <enum value="8" name="VK_SUBPASS_MERGE_STATUS_NOT_MERGED_TOO_MANY_ATTACHMENTS_EXT"/>
+ <enum value="9" name="VK_SUBPASS_MERGE_STATUS_NOT_MERGED_INSUFFICIENT_STORAGE_EXT"/>
+ <enum value="10" name="VK_SUBPASS_MERGE_STATUS_NOT_MERGED_DEPTH_STENCIL_COUNT_EXT"/>
+ <enum value="11" name="VK_SUBPASS_MERGE_STATUS_NOT_MERGED_RESOLVE_ATTACHMENT_REUSE_EXT"/>
+ <enum value="12" name="VK_SUBPASS_MERGE_STATUS_NOT_MERGED_SINGLE_SUBPASS_EXT"/>
+ <enum value="13" name="VK_SUBPASS_MERGE_STATUS_NOT_MERGED_UNSPECIFIED_EXT"/>
+ </enums>
+ <enums name="VkAccessFlagBits2" type="bitmask" bitwidth="64">
+ <enum value="0" name="VK_ACCESS_2_NONE"/>
+ <enum name="VK_ACCESS_2_NONE_KHR" alias="VK_ACCESS_2_NONE"/>
+ <enum bitpos="0" name="VK_ACCESS_2_INDIRECT_COMMAND_READ_BIT"/>
+ <enum name="VK_ACCESS_2_INDIRECT_COMMAND_READ_BIT_KHR" alias="VK_ACCESS_2_INDIRECT_COMMAND_READ_BIT"/>
+ <enum bitpos="1" name="VK_ACCESS_2_INDEX_READ_BIT"/>
+ <enum name="VK_ACCESS_2_INDEX_READ_BIT_KHR" alias="VK_ACCESS_2_INDEX_READ_BIT"/>
+ <enum bitpos="2" name="VK_ACCESS_2_VERTEX_ATTRIBUTE_READ_BIT"/>
+ <enum name="VK_ACCESS_2_VERTEX_ATTRIBUTE_READ_BIT_KHR" alias="VK_ACCESS_2_VERTEX_ATTRIBUTE_READ_BIT"/>
+ <enum bitpos="3" name="VK_ACCESS_2_UNIFORM_READ_BIT"/>
+ <enum name="VK_ACCESS_2_UNIFORM_READ_BIT_KHR" alias="VK_ACCESS_2_UNIFORM_READ_BIT"/>
+ <enum bitpos="4" name="VK_ACCESS_2_INPUT_ATTACHMENT_READ_BIT"/>
+ <enum name="VK_ACCESS_2_INPUT_ATTACHMENT_READ_BIT_KHR" alias="VK_ACCESS_2_INPUT_ATTACHMENT_READ_BIT"/>
+ <enum bitpos="5" name="VK_ACCESS_2_SHADER_READ_BIT"/>
+ <enum name="VK_ACCESS_2_SHADER_READ_BIT_KHR" alias="VK_ACCESS_2_SHADER_READ_BIT"/>
+ <enum bitpos="6" name="VK_ACCESS_2_SHADER_WRITE_BIT"/>
+ <enum name="VK_ACCESS_2_SHADER_WRITE_BIT_KHR" alias="VK_ACCESS_2_SHADER_WRITE_BIT"/>
+ <enum bitpos="7" name="VK_ACCESS_2_COLOR_ATTACHMENT_READ_BIT"/>
+ <enum name="VK_ACCESS_2_COLOR_ATTACHMENT_READ_BIT_KHR" alias="VK_ACCESS_2_COLOR_ATTACHMENT_READ_BIT"/>
+ <enum bitpos="8" name="VK_ACCESS_2_COLOR_ATTACHMENT_WRITE_BIT"/>
+ <enum name="VK_ACCESS_2_COLOR_ATTACHMENT_WRITE_BIT_KHR" alias="VK_ACCESS_2_COLOR_ATTACHMENT_WRITE_BIT"/>
+ <enum bitpos="9" name="VK_ACCESS_2_DEPTH_STENCIL_ATTACHMENT_READ_BIT"/>
+ <enum name="VK_ACCESS_2_DEPTH_STENCIL_ATTACHMENT_READ_BIT_KHR" alias="VK_ACCESS_2_DEPTH_STENCIL_ATTACHMENT_READ_BIT"/>
+ <enum bitpos="10" name="VK_ACCESS_2_DEPTH_STENCIL_ATTACHMENT_WRITE_BIT"/>
+ <enum name="VK_ACCESS_2_DEPTH_STENCIL_ATTACHMENT_WRITE_BIT_KHR" alias="VK_ACCESS_2_DEPTH_STENCIL_ATTACHMENT_WRITE_BIT"/>
+ <enum bitpos="11" name="VK_ACCESS_2_TRANSFER_READ_BIT"/>
+ <enum name="VK_ACCESS_2_TRANSFER_READ_BIT_KHR" alias="VK_ACCESS_2_TRANSFER_READ_BIT"/>
+ <enum bitpos="12" name="VK_ACCESS_2_TRANSFER_WRITE_BIT"/>
+ <enum name="VK_ACCESS_2_TRANSFER_WRITE_BIT_KHR" alias="VK_ACCESS_2_TRANSFER_WRITE_BIT"/>
+ <enum bitpos="13" name="VK_ACCESS_2_HOST_READ_BIT"/>
+ <enum name="VK_ACCESS_2_HOST_READ_BIT_KHR" alias="VK_ACCESS_2_HOST_READ_BIT"/>
+ <enum bitpos="14" name="VK_ACCESS_2_HOST_WRITE_BIT"/>
+ <enum name="VK_ACCESS_2_HOST_WRITE_BIT_KHR" alias="VK_ACCESS_2_HOST_WRITE_BIT"/>
+ <enum bitpos="15" name="VK_ACCESS_2_MEMORY_READ_BIT"/>
+ <enum name="VK_ACCESS_2_MEMORY_READ_BIT_KHR" alias="VK_ACCESS_2_MEMORY_READ_BIT"/>
+ <enum bitpos="16" name="VK_ACCESS_2_MEMORY_WRITE_BIT"/>
+ <enum name="VK_ACCESS_2_MEMORY_WRITE_BIT_KHR" alias="VK_ACCESS_2_MEMORY_WRITE_BIT"/>
+ <comment>bitpos 17-31 are specified by extensions to the original VkAccessFlagBits enum</comment>
+ <enum bitpos="32" name="VK_ACCESS_2_SHADER_SAMPLED_READ_BIT"/>
+ <enum name="VK_ACCESS_2_SHADER_SAMPLED_READ_BIT_KHR" alias="VK_ACCESS_2_SHADER_SAMPLED_READ_BIT"/>
+ <enum bitpos="33" name="VK_ACCESS_2_SHADER_STORAGE_READ_BIT"/>
+ <enum name="VK_ACCESS_2_SHADER_STORAGE_READ_BIT_KHR" alias="VK_ACCESS_2_SHADER_STORAGE_READ_BIT"/>
+ <enum bitpos="34" name="VK_ACCESS_2_SHADER_STORAGE_WRITE_BIT"/>
+ <enum name="VK_ACCESS_2_SHADER_STORAGE_WRITE_BIT_KHR" alias="VK_ACCESS_2_SHADER_STORAGE_WRITE_BIT"/>
+ </enums>
+ <enums name="VkPipelineStageFlagBits2" type="bitmask" bitwidth="64">
+ <enum value="0" name="VK_PIPELINE_STAGE_2_NONE"/>
+ <enum name="VK_PIPELINE_STAGE_2_NONE_KHR" alias="VK_PIPELINE_STAGE_2_NONE"/>
+ <enum bitpos="0" name="VK_PIPELINE_STAGE_2_TOP_OF_PIPE_BIT"/>
+ <enum name="VK_PIPELINE_STAGE_2_TOP_OF_PIPE_BIT_KHR" alias="VK_PIPELINE_STAGE_2_TOP_OF_PIPE_BIT"/>
+ <enum bitpos="1" name="VK_PIPELINE_STAGE_2_DRAW_INDIRECT_BIT"/>
+ <enum name="VK_PIPELINE_STAGE_2_DRAW_INDIRECT_BIT_KHR" alias="VK_PIPELINE_STAGE_2_DRAW_INDIRECT_BIT"/>
+ <enum bitpos="2" name="VK_PIPELINE_STAGE_2_VERTEX_INPUT_BIT"/>
+ <enum name="VK_PIPELINE_STAGE_2_VERTEX_INPUT_BIT_KHR" alias="VK_PIPELINE_STAGE_2_VERTEX_INPUT_BIT"/>
+ <enum bitpos="3" name="VK_PIPELINE_STAGE_2_VERTEX_SHADER_BIT"/>
+ <enum name="VK_PIPELINE_STAGE_2_VERTEX_SHADER_BIT_KHR" alias="VK_PIPELINE_STAGE_2_VERTEX_SHADER_BIT"/>
+ <enum bitpos="4" name="VK_PIPELINE_STAGE_2_TESSELLATION_CONTROL_SHADER_BIT"/>
+ <enum name="VK_PIPELINE_STAGE_2_TESSELLATION_CONTROL_SHADER_BIT_KHR" alias="VK_PIPELINE_STAGE_2_TESSELLATION_CONTROL_SHADER_BIT"/>
+ <enum bitpos="5" name="VK_PIPELINE_STAGE_2_TESSELLATION_EVALUATION_SHADER_BIT"/>
+ <enum name="VK_PIPELINE_STAGE_2_TESSELLATION_EVALUATION_SHADER_BIT_KHR" alias="VK_PIPELINE_STAGE_2_TESSELLATION_EVALUATION_SHADER_BIT"/>
+ <enum bitpos="6" name="VK_PIPELINE_STAGE_2_GEOMETRY_SHADER_BIT"/>
+ <enum name="VK_PIPELINE_STAGE_2_GEOMETRY_SHADER_BIT_KHR" alias="VK_PIPELINE_STAGE_2_GEOMETRY_SHADER_BIT"/>
+ <enum bitpos="7" name="VK_PIPELINE_STAGE_2_FRAGMENT_SHADER_BIT"/>
+ <enum name="VK_PIPELINE_STAGE_2_FRAGMENT_SHADER_BIT_KHR" alias="VK_PIPELINE_STAGE_2_FRAGMENT_SHADER_BIT"/>
+ <enum bitpos="8" name="VK_PIPELINE_STAGE_2_EARLY_FRAGMENT_TESTS_BIT"/>
+ <enum name="VK_PIPELINE_STAGE_2_EARLY_FRAGMENT_TESTS_BIT_KHR" alias="VK_PIPELINE_STAGE_2_EARLY_FRAGMENT_TESTS_BIT"/>
+ <enum bitpos="9" name="VK_PIPELINE_STAGE_2_LATE_FRAGMENT_TESTS_BIT"/>
+ <enum name="VK_PIPELINE_STAGE_2_LATE_FRAGMENT_TESTS_BIT_KHR" alias="VK_PIPELINE_STAGE_2_LATE_FRAGMENT_TESTS_BIT"/>
+ <enum bitpos="10" name="VK_PIPELINE_STAGE_2_COLOR_ATTACHMENT_OUTPUT_BIT"/>
+ <enum name="VK_PIPELINE_STAGE_2_COLOR_ATTACHMENT_OUTPUT_BIT_KHR" alias="VK_PIPELINE_STAGE_2_COLOR_ATTACHMENT_OUTPUT_BIT"/>
+ <enum bitpos="11" name="VK_PIPELINE_STAGE_2_COMPUTE_SHADER_BIT"/>
+ <enum name="VK_PIPELINE_STAGE_2_COMPUTE_SHADER_BIT_KHR" alias="VK_PIPELINE_STAGE_2_COMPUTE_SHADER_BIT"/>
+ <enum bitpos="12" name="VK_PIPELINE_STAGE_2_ALL_TRANSFER_BIT"/>
+ <enum name="VK_PIPELINE_STAGE_2_ALL_TRANSFER_BIT_KHR" alias="VK_PIPELINE_STAGE_2_ALL_TRANSFER_BIT"/>
+ <enum name="VK_PIPELINE_STAGE_2_TRANSFER_BIT" alias="VK_PIPELINE_STAGE_2_ALL_TRANSFER_BIT_KHR"/>
+ <enum name="VK_PIPELINE_STAGE_2_TRANSFER_BIT_KHR" alias="VK_PIPELINE_STAGE_2_ALL_TRANSFER_BIT"/>
+ <enum bitpos="13" name="VK_PIPELINE_STAGE_2_BOTTOM_OF_PIPE_BIT"/>
+ <enum name="VK_PIPELINE_STAGE_2_BOTTOM_OF_PIPE_BIT_KHR" alias="VK_PIPELINE_STAGE_2_BOTTOM_OF_PIPE_BIT"/>
+ <enum bitpos="14" name="VK_PIPELINE_STAGE_2_HOST_BIT"/>
+ <enum name="VK_PIPELINE_STAGE_2_HOST_BIT_KHR" alias="VK_PIPELINE_STAGE_2_HOST_BIT"/>
+ <enum bitpos="15" name="VK_PIPELINE_STAGE_2_ALL_GRAPHICS_BIT"/>
+ <enum name="VK_PIPELINE_STAGE_2_ALL_GRAPHICS_BIT_KHR" alias="VK_PIPELINE_STAGE_2_ALL_GRAPHICS_BIT"/>
+ <enum bitpos="16" name="VK_PIPELINE_STAGE_2_ALL_COMMANDS_BIT"/>
+ <enum name="VK_PIPELINE_STAGE_2_ALL_COMMANDS_BIT_KHR" alias="VK_PIPELINE_STAGE_2_ALL_COMMANDS_BIT"/>
+ <comment>bitpos 17-31 are specified by extensions to the original VkPipelineStageFlagBits enum</comment>
+ <enum bitpos="32" name="VK_PIPELINE_STAGE_2_COPY_BIT"/>
+ <enum name="VK_PIPELINE_STAGE_2_COPY_BIT_KHR" alias="VK_PIPELINE_STAGE_2_COPY_BIT"/>
+ <enum bitpos="33" name="VK_PIPELINE_STAGE_2_RESOLVE_BIT"/>
+ <enum name="VK_PIPELINE_STAGE_2_RESOLVE_BIT_KHR" alias="VK_PIPELINE_STAGE_2_RESOLVE_BIT"/>
+ <enum bitpos="34" name="VK_PIPELINE_STAGE_2_BLIT_BIT"/>
+ <enum name="VK_PIPELINE_STAGE_2_BLIT_BIT_KHR" alias="VK_PIPELINE_STAGE_2_BLIT_BIT"/>
+ <enum bitpos="35" name="VK_PIPELINE_STAGE_2_CLEAR_BIT"/>
+ <enum name="VK_PIPELINE_STAGE_2_CLEAR_BIT_KHR" alias="VK_PIPELINE_STAGE_2_CLEAR_BIT"/>
+ <enum bitpos="36" name="VK_PIPELINE_STAGE_2_INDEX_INPUT_BIT"/>
+ <enum name="VK_PIPELINE_STAGE_2_INDEX_INPUT_BIT_KHR" alias="VK_PIPELINE_STAGE_2_INDEX_INPUT_BIT"/>
+ <enum bitpos="37" name="VK_PIPELINE_STAGE_2_VERTEX_ATTRIBUTE_INPUT_BIT"/>
+ <enum name="VK_PIPELINE_STAGE_2_VERTEX_ATTRIBUTE_INPUT_BIT_KHR" alias="VK_PIPELINE_STAGE_2_VERTEX_ATTRIBUTE_INPUT_BIT"/>
+ <enum bitpos="38" name="VK_PIPELINE_STAGE_2_PRE_RASTERIZATION_SHADERS_BIT"/>
+ <enum name="VK_PIPELINE_STAGE_2_PRE_RASTERIZATION_SHADERS_BIT_KHR" alias="VK_PIPELINE_STAGE_2_PRE_RASTERIZATION_SHADERS_BIT"/>
+ </enums>
+ <enums name="VkSubmitFlagBits" type="bitmask">
+ <enum bitpos="0" name="VK_SUBMIT_PROTECTED_BIT"/>
+ <enum name="VK_SUBMIT_PROTECTED_BIT_KHR" alias="VK_SUBMIT_PROTECTED_BIT"/>
+ </enums>
+ <enums name="VkEventCreateFlagBits" type="bitmask">
+ </enums>
+ <enums name="VkPipelineLayoutCreateFlagBits" type="bitmask">
+ </enums>
+ <enums name="VkProvokingVertexModeEXT" type="enum">
+ <enum value="0" name="VK_PROVOKING_VERTEX_MODE_FIRST_VERTEX_EXT"/>
+ <enum value="1" name="VK_PROVOKING_VERTEX_MODE_LAST_VERTEX_EXT"/>
+ </enums>
+ <enums name="VkAccelerationStructureMotionInstanceTypeNV" type="enum">
+ <enum value="0" name="VK_ACCELERATION_STRUCTURE_MOTION_INSTANCE_TYPE_STATIC_NV"/>
+ <enum value="1" name="VK_ACCELERATION_STRUCTURE_MOTION_INSTANCE_TYPE_MATRIX_MOTION_NV"/>
+ <enum value="2" name="VK_ACCELERATION_STRUCTURE_MOTION_INSTANCE_TYPE_SRT_MOTION_NV"/>
+ </enums>
+ <enums name="VkPipelineColorBlendStateCreateFlagBits" type="bitmask">
+ </enums>
+ <enums name="VkPipelineDepthStencilStateCreateFlagBits" type="bitmask">
+ </enums>
+ <enums name="VkGraphicsPipelineLibraryFlagBitsEXT" type="bitmask">
+ <enum bitpos="0" name="VK_GRAPHICS_PIPELINE_LIBRARY_VERTEX_INPUT_INTERFACE_BIT_EXT"/>
+ <enum bitpos="1" name="VK_GRAPHICS_PIPELINE_LIBRARY_PRE_RASTERIZATION_SHADERS_BIT_EXT"/>
+ <enum bitpos="2" name="VK_GRAPHICS_PIPELINE_LIBRARY_FRAGMENT_SHADER_BIT_EXT"/>
+ <enum bitpos="3" name="VK_GRAPHICS_PIPELINE_LIBRARY_FRAGMENT_OUTPUT_INTERFACE_BIT_EXT"/>
</enums>
- <!-- SECTION: Vulkan command definitions -->
- <commands>
+ <enums name="VkVideoCodecOperationFlagBitsKHR" type="bitmask">
+ <enum value="0" name="VK_VIDEO_CODEC_OPERATION_INVALID_BIT_KHR"/>
+ </enums>
+ <enums name="VkVideoChromaSubsamplingFlagBitsKHR" type="bitmask" comment="Vulkan video chroma subsampling definitions">
+ <enum value="0" name="VK_VIDEO_CHROMA_SUBSAMPLING_INVALID_BIT_KHR"/>
+ <enum bitpos="0" name="VK_VIDEO_CHROMA_SUBSAMPLING_MONOCHROME_BIT_KHR"/>
+ <enum bitpos="1" name="VK_VIDEO_CHROMA_SUBSAMPLING_420_BIT_KHR"/>
+ <enum bitpos="2" name="VK_VIDEO_CHROMA_SUBSAMPLING_422_BIT_KHR"/>
+ <enum bitpos="3" name="VK_VIDEO_CHROMA_SUBSAMPLING_444_BIT_KHR"/>
+ </enums>
+ <enums name="VkVideoComponentBitDepthFlagBitsKHR" type="bitmask" comment="Vulkan video component bit depth definitions">
+ <enum value="0" name="VK_VIDEO_COMPONENT_BIT_DEPTH_INVALID_KHR"/>
+ <enum bitpos="0" name="VK_VIDEO_COMPONENT_BIT_DEPTH_8_BIT_KHR"/>
+ <enum bitpos="2" name="VK_VIDEO_COMPONENT_BIT_DEPTH_10_BIT_KHR"/>
+ <enum bitpos="4" name="VK_VIDEO_COMPONENT_BIT_DEPTH_12_BIT_KHR"/>
+ </enums>
+ <enums name="VkVideoCapabilityFlagBitsKHR" type="bitmask">
+ <enum bitpos="0" name="VK_VIDEO_CAPABILITY_PROTECTED_CONTENT_BIT_KHR"/>
+ <enum bitpos="1" name="VK_VIDEO_CAPABILITY_SEPARATE_REFERENCE_IMAGES_BIT_KHR"/>
+ </enums>
+ <enums name="VkVideoSessionCreateFlagBitsKHR" type="bitmask">
+ <enum value="0" name="VK_VIDEO_SESSION_CREATE_DEFAULT_KHR"/>
+ <enum bitpos="0" name="VK_VIDEO_SESSION_CREATE_PROTECTED_CONTENT_BIT_KHR"/>
+ </enums>
+ <enums name="VkVideoCodingQualityPresetFlagBitsKHR" type="bitmask">
+ <enum bitpos="0" name="VK_VIDEO_CODING_QUALITY_PRESET_NORMAL_BIT_KHR"/>
+ <enum bitpos="1" name="VK_VIDEO_CODING_QUALITY_PRESET_POWER_BIT_KHR"/>
+ <enum bitpos="2" name="VK_VIDEO_CODING_QUALITY_PRESET_QUALITY_BIT_KHR"/>
+ </enums>
+ <enums name="VkVideoDecodeH264PictureLayoutFlagBitsEXT" type="bitmask">
+ <enum value="0" name="VK_VIDEO_DECODE_H264_PICTURE_LAYOUT_PROGRESSIVE_EXT"/>
+ <enum bitpos="0" name="VK_VIDEO_DECODE_H264_PICTURE_LAYOUT_INTERLACED_INTERLEAVED_LINES_BIT_EXT"/>
+ <enum bitpos="1" name="VK_VIDEO_DECODE_H264_PICTURE_LAYOUT_INTERLACED_SEPARATE_PLANES_BIT_EXT"/>
+ </enums>
+ <enums name="VkVideoCodingControlFlagBitsKHR" type="bitmask">
+ <enum value="0" name="VK_VIDEO_CODING_CONTROL_DEFAULT_KHR"/>
+ <enum bitpos="0" name="VK_VIDEO_CODING_CONTROL_RESET_BIT_KHR"/>
+ </enums>
+ <enums name="VkQueryResultStatusKHR" type="enum">
+ <enum value="-1" name="VK_QUERY_RESULT_STATUS_ERROR_KHR"/>
+ <enum value="0" name="VK_QUERY_RESULT_STATUS_NOT_READY_KHR"/>
+ <enum value="1" name="VK_QUERY_RESULT_STATUS_COMPLETE_KHR"/>
+ </enums>
+ <enums name="VkVideoDecodeCapabilityFlagBitsKHR" type="bitmask">
+ <enum value="0" name="VK_VIDEO_DECODE_CAPABILITY_DEFAULT_KHR"/>
+ <enum bitpos="0" name="VK_VIDEO_DECODE_CAPABILITY_DPB_AND_OUTPUT_COINCIDE_BIT_KHR"/>
+ <enum bitpos="1" name="VK_VIDEO_DECODE_CAPABILITY_DPB_AND_OUTPUT_DISTINCT_BIT_KHR"/>
+ </enums>
+ <enums name="VkVideoDecodeFlagBitsKHR" type="bitmask">
+ <enum value="0" name="VK_VIDEO_DECODE_DEFAULT_KHR"/>
+ <enum bitpos="0" name="VK_VIDEO_DECODE_RESERVED_0_BIT_KHR"/>
+ </enums>
+ <enums name="VkVideoEncodeFlagBitsKHR" type="bitmask">
+ <enum value="0" name="VK_VIDEO_ENCODE_DEFAULT_KHR"/>
+ <enum bitpos="0" name="VK_VIDEO_ENCODE_RESERVED_0_BIT_KHR"/>
+ </enums>
+ <enums name="VkVideoEncodeCapabilityFlagBitsKHR" type="bitmask">
+ <enum value="0" name="VK_VIDEO_ENCODE_CAPABILITY_DEFAULT_KHR"/>
+ <enum bitpos="0" name="VK_VIDEO_ENCODE_CAPABILITY_PRECEDING_EXTERNALLY_ENCODED_BYTES_BIT_KHR"/>
+ </enums>
+ <enums name="VkVideoEncodeRateControlFlagBitsKHR" type="bitmask">
+ <enum value="0" name="VK_VIDEO_ENCODE_RATE_CONTROL_DEFAULT_KHR"/>
+ <enum bitpos="0" name="VK_VIDEO_ENCODE_RATE_CONTROL_RESERVED_0_BIT_KHR"/>
+ </enums>
+ <enums name="VkVideoEncodeRateControlModeFlagBitsKHR" type="bitmask">
+ <enum value="0" name="VK_VIDEO_ENCODE_RATE_CONTROL_MODE_NONE_BIT_KHR"/>
+ <enum value="1" name="VK_VIDEO_ENCODE_RATE_CONTROL_MODE_CBR_BIT_KHR"/>
+ <enum value="2" name="VK_VIDEO_ENCODE_RATE_CONTROL_MODE_VBR_BIT_KHR"/>
+ </enums>
+ <enums name="VkVideoEncodeH264CapabilityFlagBitsEXT" type="bitmask">
+ <enum bitpos="0" name="VK_VIDEO_ENCODE_H264_CAPABILITY_DIRECT_8X8_INFERENCE_ENABLED_BIT_EXT"/>
+ <enum bitpos="1" name="VK_VIDEO_ENCODE_H264_CAPABILITY_DIRECT_8X8_INFERENCE_DISABLED_BIT_EXT"/>
+ <enum bitpos="2" name="VK_VIDEO_ENCODE_H264_CAPABILITY_SEPARATE_COLOUR_PLANE_BIT_EXT"/>
+ <enum bitpos="3" name="VK_VIDEO_ENCODE_H264_CAPABILITY_QPPRIME_Y_ZERO_TRANSFORM_BYPASS_BIT_EXT"/>
+ <enum bitpos="4" name="VK_VIDEO_ENCODE_H264_CAPABILITY_SCALING_LISTS_BIT_EXT"/>
+ <enum bitpos="5" name="VK_VIDEO_ENCODE_H264_CAPABILITY_HRD_COMPLIANCE_BIT_EXT"/>
+ <enum bitpos="6" name="VK_VIDEO_ENCODE_H264_CAPABILITY_CHROMA_QP_OFFSET_BIT_EXT"/>
+ <enum bitpos="7" name="VK_VIDEO_ENCODE_H264_CAPABILITY_SECOND_CHROMA_QP_OFFSET_BIT_EXT"/>
+ <enum bitpos="8" name="VK_VIDEO_ENCODE_H264_CAPABILITY_PIC_INIT_QP_MINUS26_BIT_EXT"/>
+ <enum bitpos="9" name="VK_VIDEO_ENCODE_H264_CAPABILITY_WEIGHTED_PRED_BIT_EXT"/>
+ <enum bitpos="10" name="VK_VIDEO_ENCODE_H264_CAPABILITY_WEIGHTED_BIPRED_EXPLICIT_BIT_EXT"/>
+ <enum bitpos="11" name="VK_VIDEO_ENCODE_H264_CAPABILITY_WEIGHTED_BIPRED_IMPLICIT_BIT_EXT"/>
+ <enum bitpos="12" name="VK_VIDEO_ENCODE_H264_CAPABILITY_WEIGHTED_PRED_NO_TABLE_BIT_EXT"/>
+ <enum bitpos="13" name="VK_VIDEO_ENCODE_H264_CAPABILITY_TRANSFORM_8X8_BIT_EXT"/>
+ <enum bitpos="14" name="VK_VIDEO_ENCODE_H264_CAPABILITY_CABAC_BIT_EXT"/>
+ <enum bitpos="15" name="VK_VIDEO_ENCODE_H264_CAPABILITY_CAVLC_BIT_EXT"/>
+ <enum bitpos="16" name="VK_VIDEO_ENCODE_H264_CAPABILITY_DEBLOCKING_FILTER_DISABLED_BIT_EXT"/>
+ <enum bitpos="17" name="VK_VIDEO_ENCODE_H264_CAPABILITY_DEBLOCKING_FILTER_ENABLED_BIT_EXT"/>
+ <enum bitpos="18" name="VK_VIDEO_ENCODE_H264_CAPABILITY_DEBLOCKING_FILTER_PARTIAL_BIT_EXT"/>
+ <enum bitpos="19" name="VK_VIDEO_ENCODE_H264_CAPABILITY_DISABLE_DIRECT_SPATIAL_MV_PRED_BIT_EXT"/>
+ <enum bitpos="20" name="VK_VIDEO_ENCODE_H264_CAPABILITY_MULTIPLE_SLICE_PER_FRAME_BIT_EXT"/>
+ <enum bitpos="21" name="VK_VIDEO_ENCODE_H264_CAPABILITY_SLICE_MB_COUNT_BIT_EXT"/>
+ <enum bitpos="22" name="VK_VIDEO_ENCODE_H264_CAPABILITY_ROW_UNALIGNED_SLICE_BIT_EXT"/>
+ <enum bitpos="23" name="VK_VIDEO_ENCODE_H264_CAPABILITY_DIFFERENT_SLICE_TYPE_BIT_EXT"/>
+ <enum bitpos="24" name="VK_VIDEO_ENCODE_H264_CAPABILITY_B_FRAME_IN_L1_LIST_BIT_EXT"/>
+ </enums>
+ <enums name="VkVideoEncodeH264InputModeFlagBitsEXT" type="bitmask">
+ <enum bitpos="0" name="VK_VIDEO_ENCODE_H264_INPUT_MODE_FRAME_BIT_EXT"/>
+ <enum bitpos="1" name="VK_VIDEO_ENCODE_H264_INPUT_MODE_SLICE_BIT_EXT"/>
+ <enum bitpos="2" name="VK_VIDEO_ENCODE_H264_INPUT_MODE_NON_VCL_BIT_EXT"/>
+ </enums>
+ <enums name="VkVideoEncodeH264OutputModeFlagBitsEXT" type="bitmask">
+ <enum bitpos="0" name="VK_VIDEO_ENCODE_H264_OUTPUT_MODE_FRAME_BIT_EXT"/>
+ <enum bitpos="1" name="VK_VIDEO_ENCODE_H264_OUTPUT_MODE_SLICE_BIT_EXT"/>
+ <enum bitpos="2" name="VK_VIDEO_ENCODE_H264_OUTPUT_MODE_NON_VCL_BIT_EXT"/>
+ </enums>
+ <enums name="VkVideoEncodeH264RateControlStructureFlagBitsEXT" type="bitmask">
+ <enum value="0" name="VK_VIDEO_ENCODE_H264_RATE_CONTROL_STRUCTURE_UNKNOWN_EXT"/>
+ <enum bitpos="0" name="VK_VIDEO_ENCODE_H264_RATE_CONTROL_STRUCTURE_FLAT_BIT_EXT"/>
+ <enum bitpos="1" name="VK_VIDEO_ENCODE_H264_RATE_CONTROL_STRUCTURE_DYADIC_BIT_EXT"/>
+ </enums>
+ <enums name="VkImageFormatConstraintsFlagBitsFUCHSIA" type="bitmask">
+ </enums>
+ <enums name="VkImageConstraintsInfoFlagBitsFUCHSIA" type="bitmask">
+ <enum bitpos="0" name="VK_IMAGE_CONSTRAINTS_INFO_CPU_READ_RARELY_FUCHSIA"/>
+ <enum bitpos="1" name="VK_IMAGE_CONSTRAINTS_INFO_CPU_READ_OFTEN_FUCHSIA"/>
+ <enum bitpos="2" name="VK_IMAGE_CONSTRAINTS_INFO_CPU_WRITE_RARELY_FUCHSIA"/>
+ <enum bitpos="3" name="VK_IMAGE_CONSTRAINTS_INFO_CPU_WRITE_OFTEN_FUCHSIA"/>
+ <enum bitpos="4" name="VK_IMAGE_CONSTRAINTS_INFO_PROTECTED_OPTIONAL_FUCHSIA"/>
+ </enums>
+ <enums name="VkFormatFeatureFlagBits2" type="bitmask" bitwidth="64">
+ <enum bitpos="0" name="VK_FORMAT_FEATURE_2_SAMPLED_IMAGE_BIT"/>
+ <enum name="VK_FORMAT_FEATURE_2_SAMPLED_IMAGE_BIT_KHR" alias="VK_FORMAT_FEATURE_2_SAMPLED_IMAGE_BIT"/>
+ <enum bitpos="1" name="VK_FORMAT_FEATURE_2_STORAGE_IMAGE_BIT"/>
+ <enum name="VK_FORMAT_FEATURE_2_STORAGE_IMAGE_BIT_KHR" alias="VK_FORMAT_FEATURE_2_STORAGE_IMAGE_BIT"/>
+ <enum bitpos="2" name="VK_FORMAT_FEATURE_2_STORAGE_IMAGE_ATOMIC_BIT"/>
+ <enum name="VK_FORMAT_FEATURE_2_STORAGE_IMAGE_ATOMIC_BIT_KHR" alias="VK_FORMAT_FEATURE_2_STORAGE_IMAGE_ATOMIC_BIT"/>
+ <enum bitpos="3" name="VK_FORMAT_FEATURE_2_UNIFORM_TEXEL_BUFFER_BIT"/>
+ <enum name="VK_FORMAT_FEATURE_2_UNIFORM_TEXEL_BUFFER_BIT_KHR" alias="VK_FORMAT_FEATURE_2_UNIFORM_TEXEL_BUFFER_BIT"/>
+ <enum bitpos="4" name="VK_FORMAT_FEATURE_2_STORAGE_TEXEL_BUFFER_BIT"/>
+ <enum name="VK_FORMAT_FEATURE_2_STORAGE_TEXEL_BUFFER_BIT_KHR" alias="VK_FORMAT_FEATURE_2_STORAGE_TEXEL_BUFFER_BIT"/>
+ <enum bitpos="5" name="VK_FORMAT_FEATURE_2_STORAGE_TEXEL_BUFFER_ATOMIC_BIT"/>
+ <enum name="VK_FORMAT_FEATURE_2_STORAGE_TEXEL_BUFFER_ATOMIC_BIT_KHR" alias="VK_FORMAT_FEATURE_2_STORAGE_TEXEL_BUFFER_ATOMIC_BIT"/>
+ <enum bitpos="6" name="VK_FORMAT_FEATURE_2_VERTEX_BUFFER_BIT"/>
+ <enum name="VK_FORMAT_FEATURE_2_VERTEX_BUFFER_BIT_KHR" alias="VK_FORMAT_FEATURE_2_VERTEX_BUFFER_BIT"/>
+ <enum bitpos="7" name="VK_FORMAT_FEATURE_2_COLOR_ATTACHMENT_BIT"/>
+ <enum name="VK_FORMAT_FEATURE_2_COLOR_ATTACHMENT_BIT_KHR" alias="VK_FORMAT_FEATURE_2_COLOR_ATTACHMENT_BIT"/>
+ <enum bitpos="8" name="VK_FORMAT_FEATURE_2_COLOR_ATTACHMENT_BLEND_BIT"/>
+ <enum name="VK_FORMAT_FEATURE_2_COLOR_ATTACHMENT_BLEND_BIT_KHR" alias="VK_FORMAT_FEATURE_2_COLOR_ATTACHMENT_BLEND_BIT"/>
+ <enum bitpos="9" name="VK_FORMAT_FEATURE_2_DEPTH_STENCIL_ATTACHMENT_BIT"/>
+ <enum name="VK_FORMAT_FEATURE_2_DEPTH_STENCIL_ATTACHMENT_BIT_KHR" alias="VK_FORMAT_FEATURE_2_DEPTH_STENCIL_ATTACHMENT_BIT"/>
+ <enum bitpos="10" name="VK_FORMAT_FEATURE_2_BLIT_SRC_BIT"/>
+ <enum name="VK_FORMAT_FEATURE_2_BLIT_SRC_BIT_KHR" alias="VK_FORMAT_FEATURE_2_BLIT_SRC_BIT"/>
+ <enum bitpos="11" name="VK_FORMAT_FEATURE_2_BLIT_DST_BIT"/>
+ <enum name="VK_FORMAT_FEATURE_2_BLIT_DST_BIT_KHR" alias="VK_FORMAT_FEATURE_2_BLIT_DST_BIT"/>
+ <enum bitpos="12" name="VK_FORMAT_FEATURE_2_SAMPLED_IMAGE_FILTER_LINEAR_BIT"/>
+ <enum name="VK_FORMAT_FEATURE_2_SAMPLED_IMAGE_FILTER_LINEAR_BIT_KHR" alias="VK_FORMAT_FEATURE_2_SAMPLED_IMAGE_FILTER_LINEAR_BIT"/>
+ <enum bitpos="13" name="VK_FORMAT_FEATURE_2_SAMPLED_IMAGE_FILTER_CUBIC_BIT"/>
+ <enum name="VK_FORMAT_FEATURE_2_SAMPLED_IMAGE_FILTER_CUBIC_BIT_EXT" alias="VK_FORMAT_FEATURE_2_SAMPLED_IMAGE_FILTER_CUBIC_BIT"/>
+ <enum bitpos="14" name="VK_FORMAT_FEATURE_2_TRANSFER_SRC_BIT"/>
+ <enum name="VK_FORMAT_FEATURE_2_TRANSFER_SRC_BIT_KHR" alias="VK_FORMAT_FEATURE_2_TRANSFER_SRC_BIT"/>
+ <enum bitpos="15" name="VK_FORMAT_FEATURE_2_TRANSFER_DST_BIT"/>
+ <enum name="VK_FORMAT_FEATURE_2_TRANSFER_DST_BIT_KHR" alias="VK_FORMAT_FEATURE_2_TRANSFER_DST_BIT"/>
+ <enum bitpos="16" name="VK_FORMAT_FEATURE_2_SAMPLED_IMAGE_FILTER_MINMAX_BIT"/>
+ <enum name="VK_FORMAT_FEATURE_2_SAMPLED_IMAGE_FILTER_MINMAX_BIT_KHR" alias="VK_FORMAT_FEATURE_2_SAMPLED_IMAGE_FILTER_MINMAX_BIT"/>
+ <enum bitpos="17" name="VK_FORMAT_FEATURE_2_MIDPOINT_CHROMA_SAMPLES_BIT"/>
+ <enum name="VK_FORMAT_FEATURE_2_MIDPOINT_CHROMA_SAMPLES_BIT_KHR" alias="VK_FORMAT_FEATURE_2_MIDPOINT_CHROMA_SAMPLES_BIT"/>
+ <enum bitpos="18" name="VK_FORMAT_FEATURE_2_SAMPLED_IMAGE_YCBCR_CONVERSION_LINEAR_FILTER_BIT"/>
+ <enum name="VK_FORMAT_FEATURE_2_SAMPLED_IMAGE_YCBCR_CONVERSION_LINEAR_FILTER_BIT_KHR" alias="VK_FORMAT_FEATURE_2_SAMPLED_IMAGE_YCBCR_CONVERSION_LINEAR_FILTER_BIT"/>
+ <enum bitpos="19" name="VK_FORMAT_FEATURE_2_SAMPLED_IMAGE_YCBCR_CONVERSION_SEPARATE_RECONSTRUCTION_FILTER_BIT"/>
+ <enum name="VK_FORMAT_FEATURE_2_SAMPLED_IMAGE_YCBCR_CONVERSION_SEPARATE_RECONSTRUCTION_FILTER_BIT_KHR" alias="VK_FORMAT_FEATURE_2_SAMPLED_IMAGE_YCBCR_CONVERSION_SEPARATE_RECONSTRUCTION_FILTER_BIT"/>
+ <enum bitpos="20" name="VK_FORMAT_FEATURE_2_SAMPLED_IMAGE_YCBCR_CONVERSION_CHROMA_RECONSTRUCTION_EXPLICIT_BIT"/>
+ <enum name="VK_FORMAT_FEATURE_2_SAMPLED_IMAGE_YCBCR_CONVERSION_CHROMA_RECONSTRUCTION_EXPLICIT_BIT_KHR" alias="VK_FORMAT_FEATURE_2_SAMPLED_IMAGE_YCBCR_CONVERSION_CHROMA_RECONSTRUCTION_EXPLICIT_BIT"/>
+ <enum bitpos="21" name="VK_FORMAT_FEATURE_2_SAMPLED_IMAGE_YCBCR_CONVERSION_CHROMA_RECONSTRUCTION_EXPLICIT_FORCEABLE_BIT"/>
+ <enum name="VK_FORMAT_FEATURE_2_SAMPLED_IMAGE_YCBCR_CONVERSION_CHROMA_RECONSTRUCTION_EXPLICIT_FORCEABLE_BIT_KHR" alias="VK_FORMAT_FEATURE_2_SAMPLED_IMAGE_YCBCR_CONVERSION_CHROMA_RECONSTRUCTION_EXPLICIT_FORCEABLE_BIT"/>
+ <enum bitpos="22" name="VK_FORMAT_FEATURE_2_DISJOINT_BIT"/>
+ <enum name="VK_FORMAT_FEATURE_2_DISJOINT_BIT_KHR" alias="VK_FORMAT_FEATURE_2_DISJOINT_BIT"/>
+ <enum bitpos="23" name="VK_FORMAT_FEATURE_2_COSITED_CHROMA_SAMPLES_BIT"/>
+ <enum name="VK_FORMAT_FEATURE_2_COSITED_CHROMA_SAMPLES_BIT_KHR" alias="VK_FORMAT_FEATURE_2_COSITED_CHROMA_SAMPLES_BIT"/>
+ <enum bitpos="31" name="VK_FORMAT_FEATURE_2_STORAGE_READ_WITHOUT_FORMAT_BIT"/>
+ <enum name="VK_FORMAT_FEATURE_2_STORAGE_READ_WITHOUT_FORMAT_BIT_KHR" alias="VK_FORMAT_FEATURE_2_STORAGE_READ_WITHOUT_FORMAT_BIT"/>
+ <enum bitpos="32" name="VK_FORMAT_FEATURE_2_STORAGE_WRITE_WITHOUT_FORMAT_BIT"/>
+ <enum name="VK_FORMAT_FEATURE_2_STORAGE_WRITE_WITHOUT_FORMAT_BIT_KHR" alias="VK_FORMAT_FEATURE_2_STORAGE_WRITE_WITHOUT_FORMAT_BIT"/>
+ <enum bitpos="33" name="VK_FORMAT_FEATURE_2_SAMPLED_IMAGE_DEPTH_COMPARISON_BIT"/>
+ <enum name="VK_FORMAT_FEATURE_2_SAMPLED_IMAGE_DEPTH_COMPARISON_BIT_KHR" alias="VK_FORMAT_FEATURE_2_SAMPLED_IMAGE_DEPTH_COMPARISON_BIT"/>
+ </enums>
+ <enums name="VkRenderingFlagBits" type="bitmask">
+ <enum bitpos="0" name="VK_RENDERING_CONTENTS_SECONDARY_COMMAND_BUFFERS_BIT"/>
+ <enum name="VK_RENDERING_CONTENTS_SECONDARY_COMMAND_BUFFERS_BIT_KHR" alias="VK_RENDERING_CONTENTS_SECONDARY_COMMAND_BUFFERS_BIT"/>
+ <enum bitpos="1" name="VK_RENDERING_SUSPENDING_BIT"/>
+ <enum name="VK_RENDERING_SUSPENDING_BIT_KHR" alias="VK_RENDERING_SUSPENDING_BIT"/>
+ <enum bitpos="2" name="VK_RENDERING_RESUMING_BIT"/>
+ <enum name="VK_RENDERING_RESUMING_BIT_KHR" alias="VK_RENDERING_RESUMING_BIT"/>
+ </enums>
+ <enums name="VkVideoEncodeH265CapabilityFlagBitsEXT" type="bitmask">
+ <enum bitpos="0" name="VK_VIDEO_ENCODE_H265_CAPABILITY_SEPARATE_COLOUR_PLANE_BIT_EXT"/>
+ <enum bitpos="1" name="VK_VIDEO_ENCODE_H265_CAPABILITY_SCALING_LISTS_BIT_EXT"/>
+ <enum bitpos="2" name="VK_VIDEO_ENCODE_H265_CAPABILITY_SAMPLE_ADAPTIVE_OFFSET_ENABLED_BIT_EXT"/>
+ <enum bitpos="3" name="VK_VIDEO_ENCODE_H265_CAPABILITY_PCM_ENABLE_BIT_EXT"/>
+ <enum bitpos="4" name="VK_VIDEO_ENCODE_H265_CAPABILITY_SPS_TEMPORAL_MVP_ENABLED_BIT_EXT"/>
+ <enum bitpos="5" name="VK_VIDEO_ENCODE_H265_CAPABILITY_HRD_COMPLIANCE_BIT_EXT"/>
+ <enum bitpos="6" name="VK_VIDEO_ENCODE_H265_CAPABILITY_INIT_QP_MINUS26_BIT_EXT"/>
+ <enum bitpos="7" name="VK_VIDEO_ENCODE_H265_CAPABILITY_LOG2_PARALLEL_MERGE_LEVEL_MINUS2_BIT_EXT"/>
+ <enum bitpos="8" name="VK_VIDEO_ENCODE_H265_CAPABILITY_SIGN_DATA_HIDING_ENABLED_BIT_EXT"/>
+ <enum bitpos="9" name="VK_VIDEO_ENCODE_H265_CAPABILITY_TRANSFORM_SKIP_ENABLED_BIT_EXT"/>
+ <enum bitpos="10" name="VK_VIDEO_ENCODE_H265_CAPABILITY_TRANSFORM_SKIP_DISABLED_BIT_EXT"/>
+ <enum bitpos="11" name="VK_VIDEO_ENCODE_H265_CAPABILITY_PPS_SLICE_CHROMA_QP_OFFSETS_PRESENT_BIT_EXT"/>
+ <enum bitpos="12" name="VK_VIDEO_ENCODE_H265_CAPABILITY_WEIGHTED_PRED_BIT_EXT"/>
+ <enum bitpos="13" name="VK_VIDEO_ENCODE_H265_CAPABILITY_WEIGHTED_BIPRED_BIT_EXT"/>
+ <enum bitpos="14" name="VK_VIDEO_ENCODE_H265_CAPABILITY_WEIGHTED_PRED_NO_TABLE_BIT_EXT"/>
+ <enum bitpos="15" name="VK_VIDEO_ENCODE_H265_CAPABILITY_TRANSQUANT_BYPASS_ENABLED_BIT_EXT"/>
+ <enum bitpos="16" name="VK_VIDEO_ENCODE_H265_CAPABILITY_ENTROPY_CODING_SYNC_ENABLED_BIT_EXT"/>
+ <enum bitpos="17" name="VK_VIDEO_ENCODE_H265_CAPABILITY_DEBLOCKING_FILTER_OVERRIDE_ENABLED_BIT_EXT"/>
+ <enum bitpos="18" name="VK_VIDEO_ENCODE_H265_CAPABILITY_MULTIPLE_TILE_PER_FRAME_BIT_EXT"/>
+ <enum bitpos="19" name="VK_VIDEO_ENCODE_H265_CAPABILITY_MULTIPLE_SLICE_PER_TILE_BIT_EXT"/>
+ <enum bitpos="20" name="VK_VIDEO_ENCODE_H265_CAPABILITY_MULTIPLE_TILE_PER_SLICE_BIT_EXT"/>
+ <enum bitpos="21" name="VK_VIDEO_ENCODE_H265_CAPABILITY_SLICE_SEGMENT_CTB_COUNT_BIT_EXT"/>
+ <enum bitpos="22" name="VK_VIDEO_ENCODE_H265_CAPABILITY_ROW_UNALIGNED_SLICE_SEGMENT_BIT_EXT"/>
+ <enum bitpos="23" name="VK_VIDEO_ENCODE_H265_CAPABILITY_DEPENDENT_SLICE_SEGMENT_BIT_EXT"/>
+ <enum bitpos="24" name="VK_VIDEO_ENCODE_H265_CAPABILITY_DIFFERENT_SLICE_TYPE_BIT_EXT"/>
+ <enum bitpos="25" name="VK_VIDEO_ENCODE_H265_CAPABILITY_B_FRAME_IN_L1_LIST_BIT_EXT"/>
+ </enums>
+ <enums name="VkVideoEncodeH265InputModeFlagBitsEXT" type="bitmask">
+ <enum bitpos="0" name="VK_VIDEO_ENCODE_H265_INPUT_MODE_FRAME_BIT_EXT"/>
+ <enum bitpos="1" name="VK_VIDEO_ENCODE_H265_INPUT_MODE_SLICE_SEGMENT_BIT_EXT"/>
+ <enum bitpos="2" name="VK_VIDEO_ENCODE_H265_INPUT_MODE_NON_VCL_BIT_EXT"/>
+ </enums>
+ <enums name="VkVideoEncodeH265OutputModeFlagBitsEXT" type="bitmask">
+ <enum bitpos="0" name="VK_VIDEO_ENCODE_H265_OUTPUT_MODE_FRAME_BIT_EXT"/>
+ <enum bitpos="1" name="VK_VIDEO_ENCODE_H265_OUTPUT_MODE_SLICE_SEGMENT_BIT_EXT"/>
+ <enum bitpos="2" name="VK_VIDEO_ENCODE_H265_OUTPUT_MODE_NON_VCL_BIT_EXT"/>
+ </enums>
+ <enums name="VkVideoEncodeH265RateControlStructureFlagBitsEXT" type="bitmask">
+ <enum value="0" name="VK_VIDEO_ENCODE_H265_RATE_CONTROL_STRUCTURE_UNKNOWN_EXT"/>
+ <enum bitpos="0" name="VK_VIDEO_ENCODE_H265_RATE_CONTROL_STRUCTURE_FLAT_BIT_EXT"/>
+ <enum bitpos="1" name="VK_VIDEO_ENCODE_H265_RATE_CONTROL_STRUCTURE_DYADIC_BIT_EXT"/>
+ </enums>
+ <enums name="VkVideoEncodeH265CtbSizeFlagBitsEXT" type="bitmask">
+ <enum bitpos="0" name="VK_VIDEO_ENCODE_H265_CTB_SIZE_16_BIT_EXT"/>
+ <enum bitpos="1" name="VK_VIDEO_ENCODE_H265_CTB_SIZE_32_BIT_EXT"/>
+ <enum bitpos="2" name="VK_VIDEO_ENCODE_H265_CTB_SIZE_64_BIT_EXT"/>
+ </enums>
+ <enums name="VkVideoEncodeH265TransformBlockSizeFlagBitsEXT" type="bitmask">
+ <enum bitpos="0" name="VK_VIDEO_ENCODE_H265_TRANSFORM_BLOCK_SIZE_4_BIT_EXT"/>
+ <enum bitpos="1" name="VK_VIDEO_ENCODE_H265_TRANSFORM_BLOCK_SIZE_8_BIT_EXT"/>
+ <enum bitpos="2" name="VK_VIDEO_ENCODE_H265_TRANSFORM_BLOCK_SIZE_16_BIT_EXT"/>
+ <enum bitpos="3" name="VK_VIDEO_ENCODE_H265_TRANSFORM_BLOCK_SIZE_32_BIT_EXT"/>
+ </enums>
+ <enums name="VkExportMetalObjectTypeFlagBitsEXT" type="bitmask">
+ <enum bitpos="0" name="VK_EXPORT_METAL_OBJECT_TYPE_METAL_DEVICE_BIT_EXT"/>
+ <enum bitpos="1" name="VK_EXPORT_METAL_OBJECT_TYPE_METAL_COMMAND_QUEUE_BIT_EXT"/>
+ <enum bitpos="2" name="VK_EXPORT_METAL_OBJECT_TYPE_METAL_BUFFER_BIT_EXT"/>
+ <enum bitpos="3" name="VK_EXPORT_METAL_OBJECT_TYPE_METAL_TEXTURE_BIT_EXT"/>
+ <enum bitpos="4" name="VK_EXPORT_METAL_OBJECT_TYPE_METAL_IOSURFACE_BIT_EXT"/>
+ <enum bitpos="5" name="VK_EXPORT_METAL_OBJECT_TYPE_METAL_SHARED_EVENT_BIT_EXT"/>
+ </enums>
+ <enums name="VkInstanceCreateFlagBits" type="bitmask">
+ </enums>
+ <enums name="VkImageCompressionFlagBitsEXT" type="bitmask">
+ <enum value="0" name="VK_IMAGE_COMPRESSION_DEFAULT_EXT"/>
+ <enum bitpos="0" name="VK_IMAGE_COMPRESSION_FIXED_RATE_DEFAULT_EXT"/>
+ <enum bitpos="1" name="VK_IMAGE_COMPRESSION_FIXED_RATE_EXPLICIT_EXT"/>
+ <enum bitpos="2" name="VK_IMAGE_COMPRESSION_DISABLED_EXT"/>
+ </enums>
+ <enums name="VkImageCompressionFixedRateFlagBitsEXT" type="bitmask">
+ <enum value="0" name="VK_IMAGE_COMPRESSION_FIXED_RATE_NONE_EXT"/>
+ <enum bitpos="0" name="VK_IMAGE_COMPRESSION_FIXED_RATE_1BPC_BIT_EXT"/>
+ <enum bitpos="1" name="VK_IMAGE_COMPRESSION_FIXED_RATE_2BPC_BIT_EXT"/>
+ <enum bitpos="2" name="VK_IMAGE_COMPRESSION_FIXED_RATE_3BPC_BIT_EXT"/>
+ <enum bitpos="3" name="VK_IMAGE_COMPRESSION_FIXED_RATE_4BPC_BIT_EXT"/>
+ <enum bitpos="4" name="VK_IMAGE_COMPRESSION_FIXED_RATE_5BPC_BIT_EXT"/>
+ <enum bitpos="5" name="VK_IMAGE_COMPRESSION_FIXED_RATE_6BPC_BIT_EXT"/>
+ <enum bitpos="6" name="VK_IMAGE_COMPRESSION_FIXED_RATE_7BPC_BIT_EXT"/>
+ <enum bitpos="7" name="VK_IMAGE_COMPRESSION_FIXED_RATE_8BPC_BIT_EXT"/>
+ <enum bitpos="8" name="VK_IMAGE_COMPRESSION_FIXED_RATE_9BPC_BIT_EXT"/>
+ <enum bitpos="9" name="VK_IMAGE_COMPRESSION_FIXED_RATE_10BPC_BIT_EXT"/>
+ <enum bitpos="10" name="VK_IMAGE_COMPRESSION_FIXED_RATE_11BPC_BIT_EXT"/>
+ <enum bitpos="11" name="VK_IMAGE_COMPRESSION_FIXED_RATE_12BPC_BIT_EXT"/>
+ <enum bitpos="12" name="VK_IMAGE_COMPRESSION_FIXED_RATE_13BPC_BIT_EXT"/>
+ <enum bitpos="13" name="VK_IMAGE_COMPRESSION_FIXED_RATE_14BPC_BIT_EXT"/>
+ <enum bitpos="14" name="VK_IMAGE_COMPRESSION_FIXED_RATE_15BPC_BIT_EXT"/>
+ <enum bitpos="15" name="VK_IMAGE_COMPRESSION_FIXED_RATE_16BPC_BIT_EXT"/>
+ <enum bitpos="16" name="VK_IMAGE_COMPRESSION_FIXED_RATE_17BPC_BIT_EXT"/>
+ <enum bitpos="17" name="VK_IMAGE_COMPRESSION_FIXED_RATE_18BPC_BIT_EXT"/>
+ <enum bitpos="18" name="VK_IMAGE_COMPRESSION_FIXED_RATE_19BPC_BIT_EXT"/>
+ <enum bitpos="19" name="VK_IMAGE_COMPRESSION_FIXED_RATE_20BPC_BIT_EXT"/>
+ <enum bitpos="20" name="VK_IMAGE_COMPRESSION_FIXED_RATE_21BPC_BIT_EXT"/>
+ <enum bitpos="21" name="VK_IMAGE_COMPRESSION_FIXED_RATE_22BPC_BIT_EXT"/>
+ <enum bitpos="22" name="VK_IMAGE_COMPRESSION_FIXED_RATE_23BPC_BIT_EXT"/>
+ <enum bitpos="23" name="VK_IMAGE_COMPRESSION_FIXED_RATE_24BPC_BIT_EXT"/>
+ </enums>
+ <enums name="VkPipelineRobustnessBufferBehaviorEXT" type="enum">
+ <enum value="0" name="VK_PIPELINE_ROBUSTNESS_BUFFER_BEHAVIOR_DEVICE_DEFAULT_EXT" />
+ <enum value="1" name="VK_PIPELINE_ROBUSTNESS_BUFFER_BEHAVIOR_DISABLED_EXT" />
+ <enum value="2" name="VK_PIPELINE_ROBUSTNESS_BUFFER_BEHAVIOR_ROBUST_BUFFER_ACCESS_EXT" />
+ <enum value="3" name="VK_PIPELINE_ROBUSTNESS_BUFFER_BEHAVIOR_ROBUST_BUFFER_ACCESS_2_EXT" />
+ </enums>
+ <enums name="VkPipelineRobustnessImageBehaviorEXT" type="enum">
+ <enum value="0" name="VK_PIPELINE_ROBUSTNESS_IMAGE_BEHAVIOR_DEVICE_DEFAULT_EXT" />
+ <enum value="1" name="VK_PIPELINE_ROBUSTNESS_IMAGE_BEHAVIOR_DISABLED_EXT" />
+ <enum value="2" name="VK_PIPELINE_ROBUSTNESS_IMAGE_BEHAVIOR_ROBUST_IMAGE_ACCESS_EXT" />
+ <enum value="3" name="VK_PIPELINE_ROBUSTNESS_IMAGE_BEHAVIOR_ROBUST_IMAGE_ACCESS_2_EXT" />
+ </enums>
+ <commands comment="Vulkan command definitions">
<command successcodes="VK_SUCCESS" errorcodes="VK_ERROR_OUT_OF_HOST_MEMORY,VK_ERROR_OUT_OF_DEVICE_MEMORY,VK_ERROR_INITIALIZATION_FAILED,VK_ERROR_LAYER_NOT_PRESENT,VK_ERROR_EXTENSION_NOT_PRESENT,VK_ERROR_INCOMPATIBLE_DRIVER">
<proto><type>VkResult</type> <name>vkCreateInstance</name></proto>
<param>const <type>VkInstanceCreateInfo</type>* <name>pCreateInfo</name></param>
@@ -2707,6 +8980,9 @@ maintained in the master branch of the Khronos Vulkan GitHub project.
<proto><type>void</type> <name>vkDestroyInstance</name></proto>
<param optional="true" externsync="true"><type>VkInstance</type> <name>instance</name></param>
<param optional="true">const <type>VkAllocationCallbacks</type>* <name>pAllocator</name></param>
+ <implicitexternsyncparams>
+ <param>all sname:VkPhysicalDevice objects enumerated from pname:instance</param>
+ </implicitexternsyncparams>
</command>
<command successcodes="VK_SUCCESS,VK_INCOMPLETE" errorcodes="VK_ERROR_OUT_OF_HOST_MEMORY,VK_ERROR_OUT_OF_DEVICE_MEMORY,VK_ERROR_INITIALIZATION_FAILED">
<proto><type>VkResult</type> <name>vkEnumeratePhysicalDevices</name></proto>
@@ -2772,6 +9048,13 @@ maintained in the master branch of the Khronos Vulkan GitHub project.
<proto><type>void</type> <name>vkDestroyDevice</name></proto>
<param optional="true" externsync="true"><type>VkDevice</type> <name>device</name></param>
<param optional="true">const <type>VkAllocationCallbacks</type>* <name>pAllocator</name></param>
+ <implicitexternsyncparams>
+ <param>all sname:VkQueue objects created from pname:device</param>
+ </implicitexternsyncparams>
+ </command>
+ <command successcodes="VK_SUCCESS" errorcodes="VK_ERROR_OUT_OF_HOST_MEMORY">
+ <proto><type>VkResult</type> <name>vkEnumerateInstanceVersion</name></proto>
+ <param><type>uint32_t</type>* <name>pApiVersion</name></param>
</command>
<command successcodes="VK_SUCCESS,VK_INCOMPLETE" errorcodes="VK_ERROR_OUT_OF_HOST_MEMORY,VK_ERROR_OUT_OF_DEVICE_MEMORY">
<proto><type>VkResult</type> <name>vkEnumerateInstanceLayerProperties</name></proto>
@@ -2808,12 +9091,12 @@ maintained in the master branch of the Khronos Vulkan GitHub project.
<proto><type>VkResult</type> <name>vkQueueSubmit</name></proto>
<param externsync="true"><type>VkQueue</type> <name>queue</name></param>
<param optional="true"><type>uint32_t</type> <name>submitCount</name></param>
- <param len="submitCount" externsync="pSubmits[].pWaitSemaphores[],pSubmits[].pSignalSemaphores[]">const <type>VkSubmitInfo</type>* <name>pSubmits</name></param>
+ <param len="submitCount">const <type>VkSubmitInfo</type>* <name>pSubmits</name></param>
<param optional="true" externsync="true"><type>VkFence</type> <name>fence</name></param>
</command>
<command successcodes="VK_SUCCESS" errorcodes="VK_ERROR_OUT_OF_HOST_MEMORY,VK_ERROR_OUT_OF_DEVICE_MEMORY,VK_ERROR_DEVICE_LOST">
<proto><type>VkResult</type> <name>vkQueueWaitIdle</name></proto>
- <param><type>VkQueue</type> <name>queue</name></param>
+ <param externsync="true"><type>VkQueue</type> <name>queue</name></param>
</command>
<command successcodes="VK_SUCCESS" errorcodes="VK_ERROR_OUT_OF_HOST_MEMORY,VK_ERROR_OUT_OF_DEVICE_MEMORY,VK_ERROR_DEVICE_LOST">
<proto><type>VkResult</type> <name>vkDeviceWaitIdle</name></proto>
@@ -2822,7 +9105,7 @@ maintained in the master branch of the Khronos Vulkan GitHub project.
<param>all sname:VkQueue objects created from pname:device</param>
</implicitexternsyncparams>
</command>
- <command successcodes="VK_SUCCESS" errorcodes="VK_ERROR_OUT_OF_HOST_MEMORY,VK_ERROR_OUT_OF_DEVICE_MEMORY,VK_ERROR_TOO_MANY_OBJECTS">
+ <command successcodes="VK_SUCCESS" errorcodes="VK_ERROR_OUT_OF_HOST_MEMORY,VK_ERROR_OUT_OF_DEVICE_MEMORY,VK_ERROR_INVALID_EXTERNAL_HANDLE,VK_ERROR_INVALID_OPAQUE_CAPTURE_ADDRESS_KHR">
<proto><type>VkResult</type> <name>vkAllocateMemory</name></proto>
<param><type>VkDevice</type> <name>device</name></param>
<param>const <type>VkMemoryAllocateInfo</type>* <name>pAllocateInfo</name></param>
@@ -2842,7 +9125,7 @@ maintained in the master branch of the Khronos Vulkan GitHub project.
<param><type>VkDeviceSize</type> <name>offset</name></param>
<param><type>VkDeviceSize</type> <name>size</name></param>
<param optional="true"><type>VkMemoryMapFlags</type> <name>flags</name></param>
- <param><type>void</type>** <name>ppData</name></param>
+ <param optional="false,true"><type>void</type>** <name>ppData</name></param>
</command>
<command>
<proto><type>void</type> <name>vkUnmapMemory</name></proto>
@@ -2873,7 +9156,7 @@ maintained in the master branch of the Khronos Vulkan GitHub project.
<param><type>VkBuffer</type> <name>buffer</name></param>
<param><type>VkMemoryRequirements</type>* <name>pMemoryRequirements</name></param>
</command>
- <command successcodes="VK_SUCCESS" errorcodes="VK_ERROR_OUT_OF_HOST_MEMORY,VK_ERROR_OUT_OF_DEVICE_MEMORY">
+ <command successcodes="VK_SUCCESS" errorcodes="VK_ERROR_OUT_OF_HOST_MEMORY,VK_ERROR_OUT_OF_DEVICE_MEMORY,VK_ERROR_INVALID_OPAQUE_CAPTURE_ADDRESS_KHR">
<proto><type>VkResult</type> <name>vkBindBufferMemory</name></proto>
<param><type>VkDevice</type> <name>device</name></param>
<param externsync="true"><type>VkBuffer</type> <name>buffer</name></param>
@@ -2915,7 +9198,7 @@ maintained in the master branch of the Khronos Vulkan GitHub project.
<proto><type>VkResult</type> <name>vkQueueBindSparse</name></proto>
<param externsync="true"><type>VkQueue</type> <name>queue</name></param>
<param optional="true"><type>uint32_t</type> <name>bindInfoCount</name></param>
- <param len="bindInfoCount" externsync="pBindInfo[].pWaitSemaphores[],pBindInfo[].pSignalSemaphores[],pBindInfo[].pBufferBinds[].buffer,pBindInfo[].pImageOpaqueBinds[].image,pBindInfo[].pImageBinds[].image">const <type>VkBindSparseInfo</type>* <name>pBindInfo</name></param>
+ <param len="bindInfoCount">const <type>VkBindSparseInfo</type>* <name>pBindInfo</name></param>
<param optional="true" externsync="true"><type>VkFence</type> <name>fence</name></param>
</command>
<command successcodes="VK_SUCCESS" errorcodes="VK_ERROR_OUT_OF_HOST_MEMORY,VK_ERROR_OUT_OF_DEVICE_MEMORY">
@@ -2931,7 +9214,7 @@ maintained in the master branch of the Khronos Vulkan GitHub project.
<param optional="true" externsync="true"><type>VkFence</type> <name>fence</name></param>
<param optional="true">const <type>VkAllocationCallbacks</type>* <name>pAllocator</name></param>
</command>
- <command successcodes="VK_SUCCESS" errorcodes="VK_ERROR_OUT_OF_HOST_MEMORY,VK_ERROR_OUT_OF_DEVICE_MEMORY">
+ <command successcodes="VK_SUCCESS" errorcodes="VK_ERROR_OUT_OF_DEVICE_MEMORY">
<proto><type>VkResult</type> <name>vkResetFences</name></proto>
<param><type>VkDevice</type> <name>device</name></param>
<param><type>uint32_t</type> <name>fenceCount</name></param>
@@ -2986,7 +9269,7 @@ maintained in the master branch of the Khronos Vulkan GitHub project.
<param><type>VkDevice</type> <name>device</name></param>
<param externsync="true"><type>VkEvent</type> <name>event</name></param>
</command>
- <command successcodes="VK_SUCCESS" errorcodes="VK_ERROR_OUT_OF_HOST_MEMORY,VK_ERROR_OUT_OF_DEVICE_MEMORY">
+ <command successcodes="VK_SUCCESS" errorcodes="VK_ERROR_OUT_OF_DEVICE_MEMORY">
<proto><type>VkResult</type> <name>vkResetEvent</name></proto>
<param><type>VkDevice</type> <name>device</name></param>
<param externsync="true"><type>VkEvent</type> <name>event</name></param>
@@ -3015,7 +9298,15 @@ maintained in the master branch of the Khronos Vulkan GitHub project.
<param><type>VkDeviceSize</type> <name>stride</name></param>
<param optional="true"><type>VkQueryResultFlags</type> <name>flags</name></param>
</command>
- <command successcodes="VK_SUCCESS" errorcodes="VK_ERROR_OUT_OF_HOST_MEMORY,VK_ERROR_OUT_OF_DEVICE_MEMORY">
+ <command>
+ <proto><type>void</type> <name>vkResetQueryPool</name></proto>
+ <param><type>VkDevice</type> <name>device</name></param>
+ <param><type>VkQueryPool</type> <name>queryPool</name></param>
+ <param><type>uint32_t</type> <name>firstQuery</name></param>
+ <param><type>uint32_t</type> <name>queryCount</name></param>
+ </command>
+ <command name="vkResetQueryPoolEXT" alias="vkResetQueryPool"/>
+ <command successcodes="VK_SUCCESS" errorcodes="VK_ERROR_OUT_OF_HOST_MEMORY,VK_ERROR_OUT_OF_DEVICE_MEMORY,VK_ERROR_INVALID_OPAQUE_CAPTURE_ADDRESS_KHR">
<proto><type>VkResult</type> <name>vkCreateBuffer</name></proto>
<param><type>VkDevice</type> <name>device</name></param>
<param>const <type>VkBufferCreateInfo</type>* <name>pCreateInfo</name></param>
@@ -3041,7 +9332,7 @@ maintained in the master branch of the Khronos Vulkan GitHub project.
<param optional="true" externsync="true"><type>VkBufferView</type> <name>bufferView</name></param>
<param optional="true">const <type>VkAllocationCallbacks</type>* <name>pAllocator</name></param>
</command>
- <command successcodes="VK_SUCCESS" errorcodes="VK_ERROR_OUT_OF_HOST_MEMORY,VK_ERROR_OUT_OF_DEVICE_MEMORY">
+ <command successcodes="VK_SUCCESS" errorcodes="VK_ERROR_OUT_OF_HOST_MEMORY,VK_ERROR_OUT_OF_DEVICE_MEMORY,VK_ERROR_COMPRESSION_EXHAUSTED_EXT">
<proto><type>VkResult</type> <name>vkCreateImage</name></proto>
<param><type>VkDevice</type> <name>device</name></param>
<param>const <type>VkImageCreateInfo</type>* <name>pCreateInfo</name></param>
@@ -3114,7 +9405,7 @@ maintained in the master branch of the Khronos Vulkan GitHub project.
<param><type>uint32_t</type> <name>srcCacheCount</name></param>
<param len="srcCacheCount">const <type>VkPipelineCache</type>* <name>pSrcCaches</name></param>
</command>
- <command successcodes="VK_SUCCESS" errorcodes="VK_ERROR_OUT_OF_HOST_MEMORY,VK_ERROR_OUT_OF_DEVICE_MEMORY,VK_ERROR_INVALID_SHADER_NV">
+ <command successcodes="VK_SUCCESS,VK_PIPELINE_COMPILE_REQUIRED_EXT" errorcodes="VK_ERROR_OUT_OF_HOST_MEMORY,VK_ERROR_OUT_OF_DEVICE_MEMORY,VK_ERROR_INVALID_SHADER_NV">
<proto><type>VkResult</type> <name>vkCreateGraphicsPipelines</name></proto>
<param><type>VkDevice</type> <name>device</name></param>
<param optional="true"><type>VkPipelineCache</type> <name>pipelineCache</name></param>
@@ -3123,7 +9414,7 @@ maintained in the master branch of the Khronos Vulkan GitHub project.
<param optional="true">const <type>VkAllocationCallbacks</type>* <name>pAllocator</name></param>
<param len="createInfoCount"><type>VkPipeline</type>* <name>pPipelines</name></param>
</command>
- <command successcodes="VK_SUCCESS" errorcodes="VK_ERROR_OUT_OF_HOST_MEMORY,VK_ERROR_OUT_OF_DEVICE_MEMORY,VK_ERROR_INVALID_SHADER_NV">
+ <command successcodes="VK_SUCCESS,VK_PIPELINE_COMPILE_REQUIRED_EXT" errorcodes="VK_ERROR_OUT_OF_HOST_MEMORY,VK_ERROR_OUT_OF_DEVICE_MEMORY,VK_ERROR_INVALID_SHADER_NV">
<proto><type>VkResult</type> <name>vkCreateComputePipelines</name></proto>
<param><type>VkDevice</type> <name>device</name></param>
<param optional="true"><type>VkPipelineCache</type> <name>pipelineCache</name></param>
@@ -3132,6 +9423,12 @@ maintained in the master branch of the Khronos Vulkan GitHub project.
<param optional="true">const <type>VkAllocationCallbacks</type>* <name>pAllocator</name></param>
<param len="createInfoCount"><type>VkPipeline</type>* <name>pPipelines</name></param>
</command>
+ <command successcodes="VK_SUCCESS,VK_INCOMPLETE" errorcodes="VK_ERROR_OUT_OF_HOST_MEMORY,VK_ERROR_OUT_OF_DEVICE_MEMORY,VK_ERROR_SURFACE_LOST_KHR">
+ <proto><type>VkResult</type> <name>vkGetDeviceSubpassShadingMaxWorkgroupSizeHUAWEI</name></proto>
+ <param><type>VkDevice</type> <name>device</name></param>
+ <param><type>VkRenderPass</type> <name>renderpass</name></param>
+ <param><type>VkExtent2D</type>* <name>pMaxWorkgroupSize</name></param>
+ </command>
<command>
<proto><type>void</type> <name>vkDestroyPipeline</name></proto>
<param><type>VkDevice</type> <name>device</name></param>
@@ -3151,7 +9448,7 @@ maintained in the master branch of the Khronos Vulkan GitHub project.
<param optional="true" externsync="true"><type>VkPipelineLayout</type> <name>pipelineLayout</name></param>
<param optional="true">const <type>VkAllocationCallbacks</type>* <name>pAllocator</name></param>
</command>
- <command successcodes="VK_SUCCESS" errorcodes="VK_ERROR_OUT_OF_HOST_MEMORY,VK_ERROR_OUT_OF_DEVICE_MEMORY,VK_ERROR_TOO_MANY_OBJECTS">
+ <command successcodes="VK_SUCCESS" errorcodes="VK_ERROR_OUT_OF_HOST_MEMORY,VK_ERROR_OUT_OF_DEVICE_MEMORY">
<proto><type>VkResult</type> <name>vkCreateSampler</name></proto>
<param><type>VkDevice</type> <name>device</name></param>
<param>const <type>VkSamplerCreateInfo</type>* <name>pCreateInfo</name></param>
@@ -3177,7 +9474,7 @@ maintained in the master branch of the Khronos Vulkan GitHub project.
<param optional="true" externsync="true"><type>VkDescriptorSetLayout</type> <name>descriptorSetLayout</name></param>
<param optional="true">const <type>VkAllocationCallbacks</type>* <name>pAllocator</name></param>
</command>
- <command successcodes="VK_SUCCESS" errorcodes="VK_ERROR_OUT_OF_HOST_MEMORY,VK_ERROR_OUT_OF_DEVICE_MEMORY">
+ <command successcodes="VK_SUCCESS" errorcodes="VK_ERROR_OUT_OF_HOST_MEMORY,VK_ERROR_OUT_OF_DEVICE_MEMORY,VK_ERROR_FRAGMENTATION_EXT">
<proto><type>VkResult</type> <name>vkCreateDescriptorPool</name></proto>
<param><type>VkDevice</type> <name>device</name></param>
<param>const <type>VkDescriptorPoolCreateInfo</type>* <name>pCreateInfo</name></param>
@@ -3190,7 +9487,7 @@ maintained in the master branch of the Khronos Vulkan GitHub project.
<param optional="true" externsync="true"><type>VkDescriptorPool</type> <name>descriptorPool</name></param>
<param optional="true">const <type>VkAllocationCallbacks</type>* <name>pAllocator</name></param>
</command>
- <command successcodes="VK_SUCCESS" errorcodes="VK_ERROR_OUT_OF_HOST_MEMORY,VK_ERROR_OUT_OF_DEVICE_MEMORY">
+ <command successcodes="VK_SUCCESS">
<proto><type>VkResult</type> <name>vkResetDescriptorPool</name></proto>
<param><type>VkDevice</type> <name>device</name></param>
<param externsync="true"><type>VkDescriptorPool</type> <name>descriptorPool</name></param>
@@ -3199,13 +9496,13 @@ maintained in the master branch of the Khronos Vulkan GitHub project.
<param>any sname:VkDescriptorSet objects allocated from pname:descriptorPool</param>
</implicitexternsyncparams>
</command>
- <command successcodes="VK_SUCCESS" errorcodes="VK_ERROR_OUT_OF_HOST_MEMORY,VK_ERROR_OUT_OF_DEVICE_MEMORY,VK_ERROR_FRAGMENTED_POOL">
+ <command successcodes="VK_SUCCESS" errorcodes="VK_ERROR_OUT_OF_HOST_MEMORY,VK_ERROR_OUT_OF_DEVICE_MEMORY,VK_ERROR_FRAGMENTED_POOL,VK_ERROR_OUT_OF_POOL_MEMORY">
<proto><type>VkResult</type> <name>vkAllocateDescriptorSets</name></proto>
<param><type>VkDevice</type> <name>device</name></param>
- <param externsync="pAllocateInfo::descriptorPool">const <type>VkDescriptorSetAllocateInfo</type>* <name>pAllocateInfo</name></param>
- <param len="pAllocateInfo::descriptorSetCount"><type>VkDescriptorSet</type>* <name>pDescriptorSets</name></param>
+ <param externsync="pAllocateInfo-&gt;descriptorPool">const <type>VkDescriptorSetAllocateInfo</type>* <name>pAllocateInfo</name></param>
+ <param len="pAllocateInfo-&gt;descriptorSetCount"><type>VkDescriptorSet</type>* <name>pDescriptorSets</name></param>
</command>
- <command successcodes="VK_SUCCESS" errorcodes="VK_ERROR_OUT_OF_HOST_MEMORY,VK_ERROR_OUT_OF_DEVICE_MEMORY">
+ <command successcodes="VK_SUCCESS">
<proto><type>VkResult</type> <name>vkFreeDescriptorSets</name></proto>
<param><type>VkDevice</type> <name>device</name></param>
<param externsync="true"><type>VkDescriptorPool</type> <name>descriptorPool</name></param>
@@ -3216,9 +9513,9 @@ maintained in the master branch of the Khronos Vulkan GitHub project.
<proto><type>void</type> <name>vkUpdateDescriptorSets</name></proto>
<param><type>VkDevice</type> <name>device</name></param>
<param optional="true"><type>uint32_t</type> <name>descriptorWriteCount</name></param>
- <param len="descriptorWriteCount" externsync="pDescriptorWrites[].dstSet">const <type>VkWriteDescriptorSet</type>* <name>pDescriptorWrites</name></param>
+ <param len="descriptorWriteCount">const <type>VkWriteDescriptorSet</type>* <name>pDescriptorWrites</name></param>
<param optional="true"><type>uint32_t</type> <name>descriptorCopyCount</name></param>
- <param len="descriptorCopyCount" externsync="pDescriptorCopies[].dstSet">const <type>VkCopyDescriptorSet</type>* <name>pDescriptorCopies</name></param>
+ <param len="descriptorCopyCount">const <type>VkCopyDescriptorSet</type>* <name>pDescriptorCopies</name></param>
</command>
<command successcodes="VK_SUCCESS" errorcodes="VK_ERROR_OUT_OF_HOST_MEMORY,VK_ERROR_OUT_OF_DEVICE_MEMORY">
<proto><type>VkResult</type> <name>vkCreateFramebuffer</name></proto>
@@ -3265,7 +9562,7 @@ maintained in the master branch of the Khronos Vulkan GitHub project.
<param optional="true" externsync="true"><type>VkCommandPool</type> <name>commandPool</name></param>
<param optional="true">const <type>VkAllocationCallbacks</type>* <name>pAllocator</name></param>
</command>
- <command successcodes="VK_SUCCESS" errorcodes="VK_ERROR_OUT_OF_HOST_MEMORY,VK_ERROR_OUT_OF_DEVICE_MEMORY">
+ <command successcodes="VK_SUCCESS" errorcodes="VK_ERROR_OUT_OF_DEVICE_MEMORY">
<proto><type>VkResult</type> <name>vkResetCommandPool</name></proto>
<param><type>VkDevice</type> <name>device</name></param>
<param externsync="true"><type>VkCommandPool</type> <name>commandPool</name></param>
@@ -3274,8 +9571,8 @@ maintained in the master branch of the Khronos Vulkan GitHub project.
<command successcodes="VK_SUCCESS" errorcodes="VK_ERROR_OUT_OF_HOST_MEMORY,VK_ERROR_OUT_OF_DEVICE_MEMORY">
<proto><type>VkResult</type> <name>vkAllocateCommandBuffers</name></proto>
<param><type>VkDevice</type> <name>device</name></param>
- <param externsync="pAllocateInfo::commandPool">const <type>VkCommandBufferAllocateInfo</type>* <name>pAllocateInfo</name></param>
- <param len="pAllocateInfo::commandBufferCount"><type>VkCommandBuffer</type>* <name>pCommandBuffers</name></param>
+ <param externsync="pAllocateInfo-&gt;commandPool">const <type>VkCommandBufferAllocateInfo</type>* <name>pAllocateInfo</name></param>
+ <param len="pAllocateInfo-&gt;commandBufferCount"><type>VkCommandBuffer</type>* <name>pCommandBuffers</name></param>
</command>
<command>
<proto><type>void</type> <name>vkFreeCommandBuffers</name></proto>
@@ -3299,10 +9596,13 @@ maintained in the master branch of the Khronos Vulkan GitHub project.
<param>the sname:VkCommandPool that pname:commandBuffer was allocated from</param>
</implicitexternsyncparams>
</command>
- <command successcodes="VK_SUCCESS" errorcodes="VK_ERROR_OUT_OF_HOST_MEMORY,VK_ERROR_OUT_OF_DEVICE_MEMORY">
+ <command successcodes="VK_SUCCESS" errorcodes="VK_ERROR_OUT_OF_DEVICE_MEMORY">
<proto><type>VkResult</type> <name>vkResetCommandBuffer</name></proto>
<param externsync="true"><type>VkCommandBuffer</type> <name>commandBuffer</name></param>
<param optional="true"><type>VkCommandBufferResetFlags</type> <name>flags</name></param>
+ <implicitexternsyncparams>
+ <param>the sname:VkCommandPool that pname:commandBuffer was allocated from</param>
+ </implicitexternsyncparams>
</command>
<command queues="graphics,compute" renderpass="both" cmdbufferlevel="primary,secondary">
<proto><type>void</type> <name>vkCmdBindPipeline</name></proto>
@@ -3315,7 +9615,7 @@ maintained in the master branch of the Khronos Vulkan GitHub project.
<param externsync="true"><type>VkCommandBuffer</type> <name>commandBuffer</name></param>
<param><type>uint32_t</type> <name>firstViewport</name></param>
<param><type>uint32_t</type> <name>viewportCount</name></param>
- <param len="viewportCount" noautovalidity="true">const <type>VkViewport</type>* <name>pViewports</name></param>
+ <param len="viewportCount">const <type>VkViewport</type>* <name>pViewports</name></param>
</command>
<command queues="graphics" renderpass="both" cmdbufferlevel="primary,secondary">
<proto><type>void</type> <name>vkCmdSetScissor</name></proto>
@@ -3372,7 +9672,7 @@ maintained in the master branch of the Khronos Vulkan GitHub project.
<param><type>VkPipelineLayout</type> <name>layout</name></param>
<param><type>uint32_t</type> <name>firstSet</name></param>
<param><type>uint32_t</type> <name>descriptorSetCount</name></param>
- <param len="descriptorSetCount">const <type>VkDescriptorSet</type>* <name>pDescriptorSets</name></param>
+ <param len="descriptorSetCount" optional="false,true">const <type>VkDescriptorSet</type>* <name>pDescriptorSets</name></param>
<param optional="true"><type>uint32_t</type> <name>dynamicOffsetCount</name></param>
<param len="dynamicOffsetCount">const <type>uint32_t</type>* <name>pDynamicOffsets</name></param>
</command>
@@ -3388,10 +9688,10 @@ maintained in the master branch of the Khronos Vulkan GitHub project.
<param externsync="true"><type>VkCommandBuffer</type> <name>commandBuffer</name></param>
<param><type>uint32_t</type> <name>firstBinding</name></param>
<param><type>uint32_t</type> <name>bindingCount</name></param>
- <param len="bindingCount">const <type>VkBuffer</type>* <name>pBuffers</name></param>
+ <param len="bindingCount" optional="false,true">const <type>VkBuffer</type>* <name>pBuffers</name></param>
<param len="bindingCount">const <type>VkDeviceSize</type>* <name>pOffsets</name></param>
</command>
- <command queues="graphics" renderpass="inside" cmdbufferlevel="primary,secondary" pipeline="graphics">
+ <command queues="graphics" renderpass="inside" cmdbufferlevel="primary,secondary">
<proto><type>void</type> <name>vkCmdDraw</name></proto>
<param externsync="true"><type>VkCommandBuffer</type> <name>commandBuffer</name></param>
<param><type>uint32_t</type> <name>vertexCount</name></param>
@@ -3399,7 +9699,7 @@ maintained in the master branch of the Khronos Vulkan GitHub project.
<param><type>uint32_t</type> <name>firstVertex</name></param>
<param><type>uint32_t</type> <name>firstInstance</name></param>
</command>
- <command queues="graphics" renderpass="inside" cmdbufferlevel="primary,secondary" pipeline="graphics">
+ <command queues="graphics" renderpass="inside" cmdbufferlevel="primary,secondary">
<proto><type>void</type> <name>vkCmdDrawIndexed</name></proto>
<param externsync="true"><type>VkCommandBuffer</type> <name>commandBuffer</name></param>
<param><type>uint32_t</type> <name>indexCount</name></param>
@@ -3408,7 +9708,26 @@ maintained in the master branch of the Khronos Vulkan GitHub project.
<param><type>int32_t</type> <name>vertexOffset</name></param>
<param><type>uint32_t</type> <name>firstInstance</name></param>
</command>
- <command queues="graphics" renderpass="inside" cmdbufferlevel="primary,secondary" pipeline="graphics">
+ <command queues="graphics" renderpass="inside" cmdbufferlevel="primary,secondary">
+ <proto><type>void</type> <name>vkCmdDrawMultiEXT</name></proto>
+ <param externsync="true"><type>VkCommandBuffer</type> <name>commandBuffer</name></param>
+ <param optional="true"><type>uint32_t</type> <name>drawCount</name></param>
+ <param noautovalidity="true" len="drawCount">const <type>VkMultiDrawInfoEXT</type>* <name>pVertexInfo</name></param>
+ <param><type>uint32_t</type> <name>instanceCount</name></param>
+ <param><type>uint32_t</type> <name>firstInstance</name></param>
+ <param><type>uint32_t</type> <name>stride</name></param>
+ </command>
+ <command queues="graphics" renderpass="inside" cmdbufferlevel="primary,secondary">
+ <proto><type>void</type> <name>vkCmdDrawMultiIndexedEXT</name></proto>
+ <param externsync="true"><type>VkCommandBuffer</type> <name>commandBuffer</name></param>
+ <param optional="true"><type>uint32_t</type> <name>drawCount</name></param>
+ <param noautovalidity="true" len="drawCount">const <type>VkMultiDrawIndexedInfoEXT</type>* <name>pIndexInfo</name></param>
+ <param><type>uint32_t</type> <name>instanceCount</name></param>
+ <param><type>uint32_t</type> <name>firstInstance</name></param>
+ <param><type>uint32_t</type> <name>stride</name></param>
+ <param optional="true">const <type>int32_t</type>* <name>pVertexOffset</name></param>
+ </command>
+ <command queues="graphics" renderpass="inside" cmdbufferlevel="primary,secondary">
<proto><type>void</type> <name>vkCmdDrawIndirect</name></proto>
<param externsync="true"><type>VkCommandBuffer</type> <name>commandBuffer</name></param>
<param><type>VkBuffer</type> <name>buffer</name></param>
@@ -3416,7 +9735,7 @@ maintained in the master branch of the Khronos Vulkan GitHub project.
<param><type>uint32_t</type> <name>drawCount</name></param>
<param><type>uint32_t</type> <name>stride</name></param>
</command>
- <command queues="graphics" renderpass="inside" cmdbufferlevel="primary,secondary" pipeline="graphics">
+ <command queues="graphics" renderpass="inside" cmdbufferlevel="primary,secondary">
<proto><type>void</type> <name>vkCmdDrawIndexedIndirect</name></proto>
<param externsync="true"><type>VkCommandBuffer</type> <name>commandBuffer</name></param>
<param><type>VkBuffer</type> <name>buffer</name></param>
@@ -3424,20 +9743,24 @@ maintained in the master branch of the Khronos Vulkan GitHub project.
<param><type>uint32_t</type> <name>drawCount</name></param>
<param><type>uint32_t</type> <name>stride</name></param>
</command>
- <command queues="compute" renderpass="outside" cmdbufferlevel="primary,secondary" pipeline="compute">
+ <command queues="compute" renderpass="outside" cmdbufferlevel="primary,secondary">
<proto><type>void</type> <name>vkCmdDispatch</name></proto>
<param externsync="true"><type>VkCommandBuffer</type> <name>commandBuffer</name></param>
- <param><type>uint32_t</type> <name>x</name></param>
- <param><type>uint32_t</type> <name>y</name></param>
- <param><type>uint32_t</type> <name>z</name></param>
+ <param><type>uint32_t</type> <name>groupCountX</name></param>
+ <param><type>uint32_t</type> <name>groupCountY</name></param>
+ <param><type>uint32_t</type> <name>groupCountZ</name></param>
</command>
- <command queues="compute" renderpass="outside" cmdbufferlevel="primary,secondary" pipeline="compute">
+ <command queues="compute" renderpass="outside" cmdbufferlevel="primary,secondary">
<proto><type>void</type> <name>vkCmdDispatchIndirect</name></proto>
<param externsync="true"><type>VkCommandBuffer</type> <name>commandBuffer</name></param>
<param><type>VkBuffer</type> <name>buffer</name></param>
<param><type>VkDeviceSize</type> <name>offset</name></param>
</command>
- <command queues="transfer,graphics,compute" renderpass="outside" cmdbufferlevel="primary,secondary" pipeline="transfer">
+ <command queues="graphics" renderpass="inside" cmdbufferlevel="primary,secondary">
+ <proto><type>void</type> <name>vkCmdSubpassShadingHUAWEI</name></proto>
+ <param externsync="true"><type>VkCommandBuffer</type> <name>commandBuffer</name></param>
+ </command>
+ <command queues="transfer,graphics,compute" renderpass="outside" cmdbufferlevel="primary,secondary">
<proto><type>void</type> <name>vkCmdCopyBuffer</name></proto>
<param externsync="true"><type>VkCommandBuffer</type> <name>commandBuffer</name></param>
<param><type>VkBuffer</type> <name>srcBuffer</name></param>
@@ -3445,7 +9768,7 @@ maintained in the master branch of the Khronos Vulkan GitHub project.
<param><type>uint32_t</type> <name>regionCount</name></param>
<param len="regionCount">const <type>VkBufferCopy</type>* <name>pRegions</name></param>
</command>
- <command queues="transfer,graphics,compute" renderpass="outside" cmdbufferlevel="primary,secondary" pipeline="transfer">
+ <command queues="transfer,graphics,compute" renderpass="outside" cmdbufferlevel="primary,secondary">
<proto><type>void</type> <name>vkCmdCopyImage</name></proto>
<param externsync="true"><type>VkCommandBuffer</type> <name>commandBuffer</name></param>
<param><type>VkImage</type> <name>srcImage</name></param>
@@ -3455,7 +9778,7 @@ maintained in the master branch of the Khronos Vulkan GitHub project.
<param><type>uint32_t</type> <name>regionCount</name></param>
<param len="regionCount">const <type>VkImageCopy</type>* <name>pRegions</name></param>
</command>
- <command queues="graphics" renderpass="outside" cmdbufferlevel="primary,secondary" pipeline="transfer">
+ <command queues="graphics" renderpass="outside" cmdbufferlevel="primary,secondary">
<proto><type>void</type> <name>vkCmdBlitImage</name></proto>
<param externsync="true"><type>VkCommandBuffer</type> <name>commandBuffer</name></param>
<param><type>VkImage</type> <name>srcImage</name></param>
@@ -3466,7 +9789,7 @@ maintained in the master branch of the Khronos Vulkan GitHub project.
<param len="regionCount">const <type>VkImageBlit</type>* <name>pRegions</name></param>
<param><type>VkFilter</type> <name>filter</name></param>
</command>
- <command queues="transfer,graphics,compute" renderpass="outside" cmdbufferlevel="primary,secondary" pipeline="transfer">
+ <command queues="transfer,graphics,compute" renderpass="outside" cmdbufferlevel="primary,secondary">
<proto><type>void</type> <name>vkCmdCopyBufferToImage</name></proto>
<param externsync="true"><type>VkCommandBuffer</type> <name>commandBuffer</name></param>
<param><type>VkBuffer</type> <name>srcBuffer</name></param>
@@ -3475,7 +9798,7 @@ maintained in the master branch of the Khronos Vulkan GitHub project.
<param><type>uint32_t</type> <name>regionCount</name></param>
<param len="regionCount">const <type>VkBufferImageCopy</type>* <name>pRegions</name></param>
</command>
- <command queues="transfer,graphics,compute" renderpass="outside" cmdbufferlevel="primary,secondary" pipeline="transfer">
+ <command queues="transfer,graphics,compute" renderpass="outside" cmdbufferlevel="primary,secondary">
<proto><type>void</type> <name>vkCmdCopyImageToBuffer</name></proto>
<param externsync="true"><type>VkCommandBuffer</type> <name>commandBuffer</name></param>
<param><type>VkImage</type> <name>srcImage</name></param>
@@ -3484,7 +9807,7 @@ maintained in the master branch of the Khronos Vulkan GitHub project.
<param><type>uint32_t</type> <name>regionCount</name></param>
<param len="regionCount">const <type>VkBufferImageCopy</type>* <name>pRegions</name></param>
</command>
- <command queues="transfer,graphics,compute" renderpass="outside" cmdbufferlevel="primary,secondary" pipeline="transfer">
+ <command queues="transfer,graphics,compute" renderpass="outside" cmdbufferlevel="primary,secondary">
<proto><type>void</type> <name>vkCmdUpdateBuffer</name></proto>
<param externsync="true"><type>VkCommandBuffer</type> <name>commandBuffer</name></param>
<param><type>VkBuffer</type> <name>dstBuffer</name></param>
@@ -3492,7 +9815,7 @@ maintained in the master branch of the Khronos Vulkan GitHub project.
<param><type>VkDeviceSize</type> <name>dataSize</name></param>
<param len="dataSize">const <type>void</type>* <name>pData</name></param>
</command>
- <command queues="transfer,graphics,compute" renderpass="outside" cmdbufferlevel="primary,secondary" pipeline="transfer" comment="transfer support is only available when VK_KHR_maintenance1 is enabled, as documented in valid usage language in the specification">
+ <command queues="transfer,graphics,compute" renderpass="outside" cmdbufferlevel="primary,secondary" comment="transfer support is only available when VK_KHR_maintenance1 is enabled, as documented in valid usage language in the specification">
<proto><type>void</type> <name>vkCmdFillBuffer</name></proto>
<param externsync="true"><type>VkCommandBuffer</type> <name>commandBuffer</name></param>
<param><type>VkBuffer</type> <name>dstBuffer</name></param>
@@ -3500,16 +9823,16 @@ maintained in the master branch of the Khronos Vulkan GitHub project.
<param><type>VkDeviceSize</type> <name>size</name></param>
<param><type>uint32_t</type> <name>data</name></param>
</command>
- <command queues="graphics,compute" renderpass="outside" cmdbufferlevel="primary,secondary" pipeline="transfer">
+ <command queues="graphics,compute" renderpass="outside" cmdbufferlevel="primary,secondary">
<proto><type>void</type> <name>vkCmdClearColorImage</name></proto>
<param externsync="true"><type>VkCommandBuffer</type> <name>commandBuffer</name></param>
<param><type>VkImage</type> <name>image</name></param>
<param><type>VkImageLayout</type> <name>imageLayout</name></param>
- <param>const <type>VkClearColorValue</type>* <name>pColor</name></param>
+ <param noautovalidity="true">const <type>VkClearColorValue</type>* <name>pColor</name></param>
<param><type>uint32_t</type> <name>rangeCount</name></param>
<param len="rangeCount">const <type>VkImageSubresourceRange</type>* <name>pRanges</name></param>
</command>
- <command queues="graphics" renderpass="outside" cmdbufferlevel="primary,secondary" pipeline="transfer">
+ <command queues="graphics" renderpass="outside" cmdbufferlevel="primary,secondary">
<proto><type>void</type> <name>vkCmdClearDepthStencilImage</name></proto>
<param externsync="true"><type>VkCommandBuffer</type> <name>commandBuffer</name></param>
<param><type>VkImage</type> <name>image</name></param>
@@ -3518,7 +9841,7 @@ maintained in the master branch of the Khronos Vulkan GitHub project.
<param><type>uint32_t</type> <name>rangeCount</name></param>
<param len="rangeCount">const <type>VkImageSubresourceRange</type>* <name>pRanges</name></param>
</command>
- <command queues="graphics" renderpass="inside" cmdbufferlevel="primary,secondary" pipeline="graphics">
+ <command queues="graphics" renderpass="inside" cmdbufferlevel="primary,secondary">
<proto><type>void</type> <name>vkCmdClearAttachments</name></proto>
<param externsync="true"><type>VkCommandBuffer</type> <name>commandBuffer</name></param>
<param><type>uint32_t</type> <name>attachmentCount</name></param>
@@ -3526,7 +9849,7 @@ maintained in the master branch of the Khronos Vulkan GitHub project.
<param><type>uint32_t</type> <name>rectCount</name></param>
<param len="rectCount">const <type>VkClearRect</type>* <name>pRects</name></param>
</command>
- <command queues="graphics" renderpass="outside" cmdbufferlevel="primary,secondary" pipeline="transfer">
+ <command queues="graphics" renderpass="outside" cmdbufferlevel="primary,secondary">
<proto><type>void</type> <name>vkCmdResolveImage</name></proto>
<param externsync="true"><type>VkCommandBuffer</type> <name>commandBuffer</name></param>
<param><type>VkImage</type> <name>srcImage</name></param>
@@ -3536,25 +9859,25 @@ maintained in the master branch of the Khronos Vulkan GitHub project.
<param><type>uint32_t</type> <name>regionCount</name></param>
<param len="regionCount">const <type>VkImageResolve</type>* <name>pRegions</name></param>
</command>
- <command queues="graphics,compute" renderpass="outside" cmdbufferlevel="primary,secondary">
+ <command queues="graphics,compute" renderpass="outside" videocoding="both" cmdbufferlevel="primary,secondary">
<proto><type>void</type> <name>vkCmdSetEvent</name></proto>
<param externsync="true"><type>VkCommandBuffer</type> <name>commandBuffer</name></param>
<param><type>VkEvent</type> <name>event</name></param>
- <param><type>VkPipelineStageFlags</type> <name>stageMask</name></param>
+ <param optional="true"><type>VkPipelineStageFlags</type> <name>stageMask</name></param>
</command>
- <command queues="graphics,compute" renderpass="outside" cmdbufferlevel="primary,secondary">
+ <command queues="graphics,compute" renderpass="outside" videocoding="both" cmdbufferlevel="primary,secondary">
<proto><type>void</type> <name>vkCmdResetEvent</name></proto>
<param externsync="true"><type>VkCommandBuffer</type> <name>commandBuffer</name></param>
<param><type>VkEvent</type> <name>event</name></param>
- <param><type>VkPipelineStageFlags</type> <name>stageMask</name></param>
+ <param optional="true"><type>VkPipelineStageFlags</type> <name>stageMask</name></param>
</command>
- <command queues="graphics,compute" renderpass="both" cmdbufferlevel="primary,secondary">
+ <command queues="graphics,compute" renderpass="both" videocoding="both" cmdbufferlevel="primary,secondary">
<proto><type>void</type> <name>vkCmdWaitEvents</name></proto>
<param externsync="true"><type>VkCommandBuffer</type> <name>commandBuffer</name></param>
<param><type>uint32_t</type> <name>eventCount</name></param>
<param len="eventCount">const <type>VkEvent</type>* <name>pEvents</name></param>
- <param><type>VkPipelineStageFlags</type> <name>srcStageMask</name></param>
- <param><type>VkPipelineStageFlags</type> <name>dstStageMask</name></param>
+ <param optional="true"><type>VkPipelineStageFlags</type> <name>srcStageMask</name></param>
+ <param optional="true"><type>VkPipelineStageFlags</type> <name>dstStageMask</name></param>
<param optional="true"><type>uint32_t</type> <name>memoryBarrierCount</name></param>
<param len="memoryBarrierCount">const <type>VkMemoryBarrier</type>* <name>pMemoryBarriers</name></param>
<param optional="true"><type>uint32_t</type> <name>bufferMemoryBarrierCount</name></param>
@@ -3562,11 +9885,11 @@ maintained in the master branch of the Khronos Vulkan GitHub project.
<param optional="true"><type>uint32_t</type> <name>imageMemoryBarrierCount</name></param>
<param len="imageMemoryBarrierCount">const <type>VkImageMemoryBarrier</type>* <name>pImageMemoryBarriers</name></param>
</command>
- <command queues="transfer,graphics,compute" renderpass="both" cmdbufferlevel="primary,secondary">
+ <command queues="transfer,graphics,compute" renderpass="both" videocoding="both" cmdbufferlevel="primary,secondary">
<proto><type>void</type> <name>vkCmdPipelineBarrier</name></proto>
<param externsync="true"><type>VkCommandBuffer</type> <name>commandBuffer</name></param>
- <param><type>VkPipelineStageFlags</type> <name>srcStageMask</name></param>
- <param><type>VkPipelineStageFlags</type> <name>dstStageMask</name></param>
+ <param optional="true"><type>VkPipelineStageFlags</type> <name>srcStageMask</name></param>
+ <param optional="true"><type>VkPipelineStageFlags</type> <name>dstStageMask</name></param>
<param optional="true"><type>VkDependencyFlags</type> <name>dependencyFlags</name></param>
<param optional="true"><type>uint32_t</type> <name>memoryBarrierCount</name></param>
<param len="memoryBarrierCount">const <type>VkMemoryBarrier</type>* <name>pMemoryBarriers</name></param>
@@ -3575,34 +9898,43 @@ maintained in the master branch of the Khronos Vulkan GitHub project.
<param optional="true"><type>uint32_t</type> <name>imageMemoryBarrierCount</name></param>
<param len="imageMemoryBarrierCount">const <type>VkImageMemoryBarrier</type>* <name>pImageMemoryBarriers</name></param>
</command>
- <command queues="graphics,compute" renderpass="both" cmdbufferlevel="primary,secondary">
+ <command queues="graphics,compute,decode,encode" renderpass="both" videocoding="both" cmdbufferlevel="primary,secondary">
<proto><type>void</type> <name>vkCmdBeginQuery</name></proto>
<param externsync="true"><type>VkCommandBuffer</type> <name>commandBuffer</name></param>
<param><type>VkQueryPool</type> <name>queryPool</name></param>
<param><type>uint32_t</type> <name>query</name></param>
<param optional="true"><type>VkQueryControlFlags</type> <name>flags</name></param>
</command>
- <command queues="graphics,compute" renderpass="both" cmdbufferlevel="primary,secondary">
+ <command queues="graphics,compute,decode,encode" renderpass="both" videocoding="both" cmdbufferlevel="primary,secondary">
<proto><type>void</type> <name>vkCmdEndQuery</name></proto>
<param externsync="true"><type>VkCommandBuffer</type> <name>commandBuffer</name></param>
<param><type>VkQueryPool</type> <name>queryPool</name></param>
<param><type>uint32_t</type> <name>query</name></param>
</command>
- <command queues="graphics,compute" renderpass="outside" cmdbufferlevel="primary,secondary">
+ <command queues="graphics,compute" renderpass="both" cmdbufferlevel="primary,secondary">
+ <proto><type>void</type> <name>vkCmdBeginConditionalRenderingEXT</name></proto>
+ <param externsync="true"><type>VkCommandBuffer</type> <name>commandBuffer</name></param>
+ <param>const <type>VkConditionalRenderingBeginInfoEXT</type>* <name>pConditionalRenderingBegin</name></param>
+ </command>
+ <command queues="graphics,compute" renderpass="both" cmdbufferlevel="primary,secondary">
+ <proto><type>void</type> <name>vkCmdEndConditionalRenderingEXT</name></proto>
+ <param externsync="true"><type>VkCommandBuffer</type> <name>commandBuffer</name></param>
+ </command>
+ <command queues="graphics,compute,decode,encode" renderpass="outside" cmdbufferlevel="primary,secondary">
<proto><type>void</type> <name>vkCmdResetQueryPool</name></proto>
<param externsync="true"><type>VkCommandBuffer</type> <name>commandBuffer</name></param>
<param><type>VkQueryPool</type> <name>queryPool</name></param>
<param><type>uint32_t</type> <name>firstQuery</name></param>
<param><type>uint32_t</type> <name>queryCount</name></param>
</command>
- <command queues="graphics,compute" renderpass="both" cmdbufferlevel="primary,secondary" pipeline="transfer">
+ <command queues="transfer,graphics,compute,decode,encode" renderpass="both" videocoding="both" cmdbufferlevel="primary,secondary">
<proto><type>void</type> <name>vkCmdWriteTimestamp</name></proto>
<param externsync="true"><type>VkCommandBuffer</type> <name>commandBuffer</name></param>
<param><type>VkPipelineStageFlagBits</type> <name>pipelineStage</name></param>
<param><type>VkQueryPool</type> <name>queryPool</name></param>
<param><type>uint32_t</type> <name>query</name></param>
</command>
- <command queues="graphics,compute" renderpass="outside" cmdbufferlevel="primary,secondary" pipeline="transfer">
+ <command queues="graphics,compute" renderpass="outside" cmdbufferlevel="primary,secondary">
<proto><type>void</type> <name>vkCmdCopyQueryPoolResults</name></proto>
<param externsync="true"><type>VkCommandBuffer</type> <name>commandBuffer</name></param>
<param><type>VkQueryPool</type> <name>queryPool</name></param>
@@ -3622,18 +9954,18 @@ maintained in the master branch of the Khronos Vulkan GitHub project.
<param><type>uint32_t</type> <name>size</name></param>
<param len="size">const <type>void</type>* <name>pValues</name></param>
</command>
- <command queues="graphics" renderpass="outside" cmdbufferlevel="primary" pipeline="graphics">
+ <command queues="graphics" renderpass="outside" cmdbufferlevel="primary">
<proto><type>void</type> <name>vkCmdBeginRenderPass</name></proto>
<param externsync="true"><type>VkCommandBuffer</type> <name>commandBuffer</name></param>
<param>const <type>VkRenderPassBeginInfo</type>* <name>pRenderPassBegin</name></param>
<param><type>VkSubpassContents</type> <name>contents</name></param>
</command>
- <command queues="graphics" renderpass="inside" cmdbufferlevel="primary" pipeline="graphics">
+ <command queues="graphics" renderpass="inside" cmdbufferlevel="primary">
<proto><type>void</type> <name>vkCmdNextSubpass</name></proto>
<param externsync="true"><type>VkCommandBuffer</type> <name>commandBuffer</name></param>
<param><type>VkSubpassContents</type> <name>contents</name></param>
</command>
- <command queues="graphics" renderpass="inside" cmdbufferlevel="primary" pipeline="graphics">
+ <command queues="graphics" renderpass="inside" cmdbufferlevel="primary">
<proto><type>void</type> <name>vkCmdEndRenderPass</name></proto>
<param externsync="true"><type>VkCommandBuffer</type> <name>commandBuffer</name></param>
</command>
@@ -3706,19 +10038,6 @@ maintained in the master branch of the Khronos Vulkan GitHub project.
<param optional="true">const <type>VkAllocationCallbacks</type>* <name>pAllocator</name></param>
<param len="swapchainCount"><type>VkSwapchainKHR</type>* <name>pSwapchains</name></param>
</command>
- <command successcodes="VK_SUCCESS" errorcodes="VK_ERROR_OUT_OF_HOST_MEMORY,VK_ERROR_OUT_OF_DEVICE_MEMORY">
- <proto><type>VkResult</type> <name>vkCreateMirSurfaceKHR</name></proto>
- <param><type>VkInstance</type> <name>instance</name></param>
- <param>const <type>VkMirSurfaceCreateInfoKHR</type>* <name>pCreateInfo</name></param>
- <param optional="true">const <type>VkAllocationCallbacks</type>* <name>pAllocator</name></param>
- <param><type>VkSurfaceKHR</type>* <name>pSurface</name></param>
- </command>
- <command>
- <proto><type>VkBool32</type> <name>vkGetPhysicalDeviceMirPresentationSupportKHR</name></proto>
- <param><type>VkPhysicalDevice</type> <name>physicalDevice</name></param>
- <param><type>uint32_t</type> <name>queueFamilyIndex</name></param>
- <param><type>MirConnection</type>* <name>connection</name></param>
- </command>
<command>
<proto><type>void</type> <name>vkDestroySurfaceKHR</name></proto>
<param><type>VkInstance</type> <name>instance</name></param>
@@ -3741,21 +10060,21 @@ maintained in the master branch of the Khronos Vulkan GitHub project.
<command successcodes="VK_SUCCESS,VK_INCOMPLETE" errorcodes="VK_ERROR_OUT_OF_HOST_MEMORY,VK_ERROR_OUT_OF_DEVICE_MEMORY,VK_ERROR_SURFACE_LOST_KHR">
<proto><type>VkResult</type> <name>vkGetPhysicalDeviceSurfaceFormatsKHR</name></proto>
<param><type>VkPhysicalDevice</type> <name>physicalDevice</name></param>
- <param><type>VkSurfaceKHR</type> <name>surface</name></param>
+ <param optional="true"><type>VkSurfaceKHR</type> <name>surface</name></param>
<param optional="false,true"><type>uint32_t</type>* <name>pSurfaceFormatCount</name></param>
<param optional="true" len="pSurfaceFormatCount"><type>VkSurfaceFormatKHR</type>* <name>pSurfaceFormats</name></param>
</command>
<command successcodes="VK_SUCCESS,VK_INCOMPLETE" errorcodes="VK_ERROR_OUT_OF_HOST_MEMORY,VK_ERROR_OUT_OF_DEVICE_MEMORY,VK_ERROR_SURFACE_LOST_KHR">
<proto><type>VkResult</type> <name>vkGetPhysicalDeviceSurfacePresentModesKHR</name></proto>
<param><type>VkPhysicalDevice</type> <name>physicalDevice</name></param>
- <param><type>VkSurfaceKHR</type> <name>surface</name></param>
+ <param optional="true"><type>VkSurfaceKHR</type> <name>surface</name></param>
<param optional="false,true"><type>uint32_t</type>* <name>pPresentModeCount</name></param>
<param optional="true" len="pPresentModeCount"><type>VkPresentModeKHR</type>* <name>pPresentModes</name></param>
</command>
- <command successcodes="VK_SUCCESS" errorcodes="VK_ERROR_OUT_OF_HOST_MEMORY,VK_ERROR_OUT_OF_DEVICE_MEMORY,VK_ERROR_DEVICE_LOST,VK_ERROR_SURFACE_LOST_KHR,VK_ERROR_NATIVE_WINDOW_IN_USE_KHR">
+ <command successcodes="VK_SUCCESS" errorcodes="VK_ERROR_OUT_OF_HOST_MEMORY,VK_ERROR_OUT_OF_DEVICE_MEMORY,VK_ERROR_DEVICE_LOST,VK_ERROR_SURFACE_LOST_KHR,VK_ERROR_NATIVE_WINDOW_IN_USE_KHR,VK_ERROR_INITIALIZATION_FAILED,VK_ERROR_COMPRESSION_EXHAUSTED_EXT">
<proto><type>VkResult</type> <name>vkCreateSwapchainKHR</name></proto>
<param><type>VkDevice</type> <name>device</name></param>
- <param externsync="pCreateInfo.surface,pCreateInfo.oldSwapchain">const <type>VkSwapchainCreateInfoKHR</type>* <name>pCreateInfo</name></param>
+ <param externsync="pCreateInfo-&gt;surface,pCreateInfo-&gt;oldSwapchain">const <type>VkSwapchainCreateInfoKHR</type>* <name>pCreateInfo</name></param>
<param optional="true">const <type>VkAllocationCallbacks</type>* <name>pAllocator</name></param>
<param><type>VkSwapchainKHR</type>* <name>pSwapchain</name></param>
</command>
@@ -3772,7 +10091,7 @@ maintained in the master branch of the Khronos Vulkan GitHub project.
<param optional="false,true"><type>uint32_t</type>* <name>pSwapchainImageCount</name></param>
<param optional="true" len="pSwapchainImageCount"><type>VkImage</type>* <name>pSwapchainImages</name></param>
</command>
- <command successcodes="VK_SUCCESS,VK_TIMEOUT,VK_NOT_READY,VK_SUBOPTIMAL_KHR" errorcodes="VK_ERROR_OUT_OF_HOST_MEMORY,VK_ERROR_OUT_OF_DEVICE_MEMORY,VK_ERROR_DEVICE_LOST,VK_ERROR_OUT_OF_DATE_KHR,VK_ERROR_SURFACE_LOST_KHR">
+ <command successcodes="VK_SUCCESS,VK_TIMEOUT,VK_NOT_READY,VK_SUBOPTIMAL_KHR" errorcodes="VK_ERROR_OUT_OF_HOST_MEMORY,VK_ERROR_OUT_OF_DEVICE_MEMORY,VK_ERROR_DEVICE_LOST,VK_ERROR_OUT_OF_DATE_KHR,VK_ERROR_SURFACE_LOST_KHR,VK_ERROR_FULL_SCREEN_EXCLUSIVE_MODE_LOST_EXT">
<proto><type>VkResult</type> <name>vkAcquireNextImageKHR</name></proto>
<param><type>VkDevice</type> <name>device</name></param>
<param externsync="true"><type>VkSwapchainKHR</type> <name>swapchain</name></param>
@@ -3781,10 +10100,10 @@ maintained in the master branch of the Khronos Vulkan GitHub project.
<param optional="true" externsync="true"><type>VkFence</type> <name>fence</name></param>
<param><type>uint32_t</type>* <name>pImageIndex</name></param>
</command>
- <command successcodes="VK_SUCCESS,VK_SUBOPTIMAL_KHR" errorcodes="VK_ERROR_OUT_OF_HOST_MEMORY,VK_ERROR_OUT_OF_DEVICE_MEMORY,VK_ERROR_DEVICE_LOST,VK_ERROR_OUT_OF_DATE_KHR,VK_ERROR_SURFACE_LOST_KHR">
+ <command successcodes="VK_SUCCESS,VK_SUBOPTIMAL_KHR" errorcodes="VK_ERROR_OUT_OF_HOST_MEMORY,VK_ERROR_OUT_OF_DEVICE_MEMORY,VK_ERROR_DEVICE_LOST,VK_ERROR_OUT_OF_DATE_KHR,VK_ERROR_SURFACE_LOST_KHR,VK_ERROR_FULL_SCREEN_EXCLUSIVE_MODE_LOST_EXT">
<proto><type>VkResult</type> <name>vkQueuePresentKHR</name></proto>
<param externsync="true"><type>VkQueue</type> <name>queue</name></param>
- <param externsync="pPresentInfo.pWaitSemaphores[],pPresentInfo.pSwapchains[]">const <type>VkPresentInfoKHR</type>* <name>pPresentInfo</name></param>
+ <param externsync="pPresentInfo-&gt;pWaitSemaphores[],pPresentInfo-&gt;pSwapchains[]">const <type>VkPresentInfoKHR</type>* <name>pPresentInfo</name></param>
</command>
<command successcodes="VK_SUCCESS" errorcodes="VK_ERROR_OUT_OF_HOST_MEMORY,VK_ERROR_OUT_OF_DEVICE_MEMORY,VK_ERROR_NATIVE_WINDOW_IN_USE_KHR">
<proto><type>VkResult</type> <name>vkCreateViSurfaceNN</name></proto>
@@ -3846,6 +10165,46 @@ maintained in the master branch of the Khronos Vulkan GitHub project.
<param><type>xcb_connection_t</type>* <name>connection</name></param>
<param><type>xcb_visualid_t</type> <name>visual_id</name></param>
</command>
+ <command successcodes="VK_SUCCESS" errorcodes="VK_ERROR_OUT_OF_HOST_MEMORY,VK_ERROR_OUT_OF_DEVICE_MEMORY">
+ <proto><type>VkResult</type> <name>vkCreateDirectFBSurfaceEXT</name></proto>
+ <param><type>VkInstance</type> <name>instance</name></param>
+ <param>const <type>VkDirectFBSurfaceCreateInfoEXT</type>* <name>pCreateInfo</name></param>
+ <param optional="true">const <type>VkAllocationCallbacks</type>* <name>pAllocator</name></param>
+ <param><type>VkSurfaceKHR</type>* <name>pSurface</name></param>
+ </command>
+ <command>
+ <proto><type>VkBool32</type> <name>vkGetPhysicalDeviceDirectFBPresentationSupportEXT</name></proto>
+ <param><type>VkPhysicalDevice</type> <name>physicalDevice</name></param>
+ <param><type>uint32_t</type> <name>queueFamilyIndex</name></param>
+ <param><type>IDirectFB</type>* <name>dfb</name></param>
+ </command>
+ <command successcodes="VK_SUCCESS" errorcodes="VK_ERROR_OUT_OF_HOST_MEMORY,VK_ERROR_OUT_OF_DEVICE_MEMORY">
+ <proto><type>VkResult</type> <name>vkCreateImagePipeSurfaceFUCHSIA</name></proto>
+ <param><type>VkInstance</type> <name>instance</name></param>
+ <param>const <type>VkImagePipeSurfaceCreateInfoFUCHSIA</type>* <name>pCreateInfo</name></param>
+ <param optional="true">const <type>VkAllocationCallbacks</type>* <name>pAllocator</name></param>
+ <param><type>VkSurfaceKHR</type>* <name>pSurface</name></param>
+ </command>
+ <command successcodes="VK_SUCCESS" errorcodes="VK_ERROR_OUT_OF_HOST_MEMORY,VK_ERROR_OUT_OF_DEVICE_MEMORY,VK_ERROR_NATIVE_WINDOW_IN_USE_KHR">
+ <proto><type>VkResult</type> <name>vkCreateStreamDescriptorSurfaceGGP</name></proto>
+ <param><type>VkInstance</type> <name>instance</name></param>
+ <param>const <type>VkStreamDescriptorSurfaceCreateInfoGGP</type>* <name>pCreateInfo</name></param>
+ <param optional="true">const <type>VkAllocationCallbacks</type>* <name>pAllocator</name></param>
+ <param><type>VkSurfaceKHR</type>* <name>pSurface</name></param>
+ </command>
+ <command successcodes="VK_SUCCESS" errorcodes="VK_ERROR_OUT_OF_HOST_MEMORY,VK_ERROR_OUT_OF_DEVICE_MEMORY">
+ <proto><type>VkResult</type> <name>vkCreateScreenSurfaceQNX</name></proto>
+ <param><type>VkInstance</type> <name>instance</name></param>
+ <param>const <type>VkScreenSurfaceCreateInfoQNX</type>* <name>pCreateInfo</name></param>
+ <param optional="true">const <type>VkAllocationCallbacks</type>* <name>pAllocator</name></param>
+ <param><type>VkSurfaceKHR</type>* <name>pSurface</name></param>
+ </command>
+ <command>
+ <proto><type>VkBool32</type> <name>vkGetPhysicalDeviceScreenPresentationSupportQNX</name></proto>
+ <param><type>VkPhysicalDevice</type> <name>physicalDevice</name></param>
+ <param><type>uint32_t</type> <name>queueFamilyIndex</name></param>
+ <param>struct <type>_screen_window</type>* <name>window</name></param>
+ </command>
<command successcodes="VK_SUCCESS" errorcodes="VK_ERROR_OUT_OF_HOST_MEMORY">
<proto><type>VkResult</type> <name>vkCreateDebugReportCallbackEXT</name></proto>
<param><type>VkInstance</type> <name>instance</name></param>
@@ -3856,7 +10215,7 @@ maintained in the master branch of the Khronos Vulkan GitHub project.
<command>
<proto><type>void</type> <name>vkDestroyDebugReportCallbackEXT</name></proto>
<param><type>VkInstance</type> <name>instance</name></param>
- <param externsync="true"><type>VkDebugReportCallbackEXT</type> <name>callback</name></param>
+ <param optional="true" externsync="true"><type>VkDebugReportCallbackEXT</type> <name>callback</name></param>
<param optional="true">const <type>VkAllocationCallbacks</type>* <name>pAllocator</name></param>
</command>
<command>
@@ -3864,7 +10223,7 @@ maintained in the master branch of the Khronos Vulkan GitHub project.
<param><type>VkInstance</type> <name>instance</name></param>
<param><type>VkDebugReportFlagsEXT</type> <name>flags</name></param>
<param><type>VkDebugReportObjectTypeEXT</type> <name>objectType</name></param>
- <param><type>uint64_t</type> <name>object</name></param>
+ <param objecttype="objectType"><type>uint64_t</type> <name>object</name></param>
<param><type>size_t</type> <name>location</name></param>
<param><type>int32_t</type> <name>messageCode</name></param>
<param len="null-terminated">const <type>char</type>* <name>pLayerPrefix</name></param>
@@ -3873,26 +10232,26 @@ maintained in the master branch of the Khronos Vulkan GitHub project.
<command successcodes="VK_SUCCESS" errorcodes="VK_ERROR_OUT_OF_HOST_MEMORY,VK_ERROR_OUT_OF_DEVICE_MEMORY">
<proto><type>VkResult</type> <name>vkDebugMarkerSetObjectNameEXT</name></proto>
<param><type>VkDevice</type> <name>device</name></param>
- <param externsync="pNameInfo.object"><type>VkDebugMarkerObjectNameInfoEXT</type>* <name>pNameInfo</name></param>
+ <param externsync="pNameInfo-&gt;object">const <type>VkDebugMarkerObjectNameInfoEXT</type>* <name>pNameInfo</name></param>
</command>
<command successcodes="VK_SUCCESS" errorcodes="VK_ERROR_OUT_OF_HOST_MEMORY,VK_ERROR_OUT_OF_DEVICE_MEMORY">
<proto><type>VkResult</type> <name>vkDebugMarkerSetObjectTagEXT</name></proto>
<param><type>VkDevice</type> <name>device</name></param>
- <param externsync="pTagInfo.object"><type>VkDebugMarkerObjectTagInfoEXT</type>* <name>pTagInfo</name></param>
+ <param externsync="pTagInfo-&gt;object">const <type>VkDebugMarkerObjectTagInfoEXT</type>* <name>pTagInfo</name></param>
</command>
<command queues="graphics,compute" renderpass="both" cmdbufferlevel="primary,secondary">
<proto><type>void</type> <name>vkCmdDebugMarkerBeginEXT</name></proto>
- <param><type>VkCommandBuffer</type> <name>commandBuffer</name></param>
- <param><type>VkDebugMarkerMarkerInfoEXT</type>* <name>pMarkerInfo</name></param>
+ <param externsync="true"><type>VkCommandBuffer</type> <name>commandBuffer</name></param>
+ <param>const <type>VkDebugMarkerMarkerInfoEXT</type>* <name>pMarkerInfo</name></param>
</command>
<command queues="graphics,compute" renderpass="both" cmdbufferlevel="primary,secondary">
<proto><type>void</type> <name>vkCmdDebugMarkerEndEXT</name></proto>
- <param><type>VkCommandBuffer</type> <name>commandBuffer</name></param>
+ <param externsync="true"><type>VkCommandBuffer</type> <name>commandBuffer</name></param>
</command>
<command queues="graphics,compute" renderpass="both" cmdbufferlevel="primary,secondary">
<proto><type>void</type> <name>vkCmdDebugMarkerInsertEXT</name></proto>
- <param><type>VkCommandBuffer</type> <name>commandBuffer</name></param>
- <param><type>VkDebugMarkerMarkerInfoEXT</type>* <name>pMarkerInfo</name></param>
+ <param externsync="true"><type>VkCommandBuffer</type> <name>commandBuffer</name></param>
+ <param>const <type>VkDebugMarkerMarkerInfoEXT</type>* <name>pMarkerInfo</name></param>
</command>
<command successcodes="VK_SUCCESS" errorcodes="VK_ERROR_OUT_OF_HOST_MEMORY,VK_ERROR_OUT_OF_DEVICE_MEMORY,VK_ERROR_FORMAT_NOT_SUPPORTED">
<proto><type>VkResult</type> <name>vkGetPhysicalDeviceExternalImageFormatPropertiesNV</name></proto>
@@ -3912,170 +10271,278 @@ maintained in the master branch of the Khronos Vulkan GitHub project.
<param><type>VkExternalMemoryHandleTypeFlagsNV</type> <name>handleType</name></param>
<param><type>HANDLE</type>* <name>pHandle</name></param>
</command>
- <command queues="graphics" renderpass="inside" cmdbufferlevel="primary,secondary" pipeline="graphics">
- <proto><type>void</type> <name>vkCmdDrawIndirectCountAMD</name></proto>
- <param externsync="true"><type>VkCommandBuffer</type> <name>commandBuffer</name></param>
- <param><type>VkBuffer</type> <name>buffer</name></param>
- <param><type>VkDeviceSize</type> <name>offset</name></param>
- <param><type>VkBuffer</type> <name>countBuffer</name></param>
- <param><type>VkDeviceSize</type> <name>countBufferOffset</name></param>
- <param><type>uint32_t</type> <name>maxDrawCount</name></param>
- <param><type>uint32_t</type> <name>stride</name></param>
- </command>
- <command queues="graphics" renderpass="inside" cmdbufferlevel="primary,secondary" pipeline="graphics">
- <proto><type>void</type> <name>vkCmdDrawIndexedIndirectCountAMD</name></proto>
- <param externsync="true"><type>VkCommandBuffer</type> <name>commandBuffer</name></param>
- <param><type>VkBuffer</type> <name>buffer</name></param>
- <param><type>VkDeviceSize</type> <name>offset</name></param>
- <param><type>VkBuffer</type> <name>countBuffer</name></param>
- <param><type>VkDeviceSize</type> <name>countBufferOffset</name></param>
- <param><type>uint32_t</type> <name>maxDrawCount</name></param>
- <param><type>uint32_t</type> <name>stride</name></param>
- </command>
<command queues="graphics,compute" renderpass="inside" cmdbufferlevel="primary,secondary">
- <proto><type>void</type> <name>vkCmdProcessCommandsNVX</name></proto>
+ <proto><type>void</type> <name>vkCmdExecuteGeneratedCommandsNV</name></proto>
<param externsync="true"><type>VkCommandBuffer</type> <name>commandBuffer</name></param>
- <param>const <type>VkCmdProcessCommandsInfoNVX</type>* <name>pProcessCommandsInfo</name></param>
+ <param><type>VkBool32</type> <name>isPreprocessed</name></param>
+ <param>const <type>VkGeneratedCommandsInfoNV</type>* <name>pGeneratedCommandsInfo</name></param>
</command>
- <command queues="graphics,compute" renderpass="inside" cmdbufferlevel="secondary">
- <proto><type>void</type> <name>vkCmdReserveSpaceForCommandsNVX</name></proto>
+ <command queues="graphics,compute" renderpass="outside" cmdbufferlevel="primary,secondary">
+ <proto><type>void</type> <name>vkCmdPreprocessGeneratedCommandsNV</name></proto>
<param externsync="true"><type>VkCommandBuffer</type> <name>commandBuffer</name></param>
- <param>const <type>VkCmdReserveSpaceForCommandsInfoNVX</type>* <name>pReserveSpaceInfo</name></param>
+ <param>const <type>VkGeneratedCommandsInfoNV</type>* <name>pGeneratedCommandsInfo</name></param>
</command>
- <command successcodes="VK_SUCCESS" errorcodes="VK_ERROR_OUT_OF_HOST_MEMORY,VK_ERROR_OUT_OF_DEVICE_MEMORY">
- <proto><type>VkResult</type> <name>vkCreateIndirectCommandsLayoutNVX</name></proto>
- <param><type>VkDevice</type> <name>device</name></param>
- <param>const <type>VkIndirectCommandsLayoutCreateInfoNVX</type>* <name>pCreateInfo</name></param>
- <param optional="true">const <type>VkAllocationCallbacks</type>* <name>pAllocator</name></param>
- <param><type>VkIndirectCommandsLayoutNVX</type>* <name>pIndirectCommandsLayout</name></param>
+ <command queues="graphics,compute" renderpass="both" cmdbufferlevel="primary,secondary">
+ <proto><type>void</type> <name>vkCmdBindPipelineShaderGroupNV</name></proto>
+ <param externsync="true"><type>VkCommandBuffer</type> <name>commandBuffer</name></param>
+ <param><type>VkPipelineBindPoint</type> <name>pipelineBindPoint</name></param>
+ <param><type>VkPipeline</type> <name>pipeline</name></param>
+ <param><type>uint32_t</type> <name>groupIndex</name></param>
</command>
<command>
- <proto><type>void</type> <name>vkDestroyIndirectCommandsLayoutNVX</name></proto>
+ <proto><type>void</type> <name>vkGetGeneratedCommandsMemoryRequirementsNV</name></proto>
<param><type>VkDevice</type> <name>device</name></param>
- <param><type>VkIndirectCommandsLayoutNVX</type> <name>indirectCommandsLayout</name></param>
- <param optional="true">const <type>VkAllocationCallbacks</type>* <name>pAllocator</name></param>
+ <param>const <type>VkGeneratedCommandsMemoryRequirementsInfoNV</type>* <name>pInfo</name></param>
+ <param><type>VkMemoryRequirements2</type>* <name>pMemoryRequirements</name></param>
</command>
<command successcodes="VK_SUCCESS" errorcodes="VK_ERROR_OUT_OF_HOST_MEMORY,VK_ERROR_OUT_OF_DEVICE_MEMORY">
- <proto><type>VkResult</type> <name>vkCreateObjectTableNVX</name></proto>
+ <proto><type>VkResult</type> <name>vkCreateIndirectCommandsLayoutNV</name></proto>
<param><type>VkDevice</type> <name>device</name></param>
- <param>const <type>VkObjectTableCreateInfoNVX</type>* <name>pCreateInfo</name></param>
+ <param>const <type>VkIndirectCommandsLayoutCreateInfoNV</type>* <name>pCreateInfo</name></param>
<param optional="true">const <type>VkAllocationCallbacks</type>* <name>pAllocator</name></param>
- <param><type>VkObjectTableNVX</type>* <name>pObjectTable</name></param>
+ <param><type>VkIndirectCommandsLayoutNV</type>* <name>pIndirectCommandsLayout</name></param>
</command>
<command>
- <proto><type>void</type> <name>vkDestroyObjectTableNVX</name></proto>
+ <proto><type>void</type> <name>vkDestroyIndirectCommandsLayoutNV</name></proto>
<param><type>VkDevice</type> <name>device</name></param>
- <param externsync="true"><type>VkObjectTableNVX</type> <name>objectTable</name></param>
+ <param optional="true" externsync="true"><type>VkIndirectCommandsLayoutNV</type> <name>indirectCommandsLayout</name></param>
<param optional="true">const <type>VkAllocationCallbacks</type>* <name>pAllocator</name></param>
</command>
- <command successcodes="VK_SUCCESS" errorcodes="VK_ERROR_OUT_OF_HOST_MEMORY,VK_ERROR_OUT_OF_DEVICE_MEMORY">
- <proto><type>VkResult</type> <name>vkRegisterObjectsNVX</name></proto>
- <param><type>VkDevice</type> <name>device</name></param>
- <param externsync="true"><type>VkObjectTableNVX</type> <name>objectTable</name></param>
- <param><type>uint32_t</type> <name>objectCount</name></param>
- <param len="objectCount">const <type>VkObjectTableEntryNVX</type>* const* <name>ppObjectTableEntries</name></param>
- <param len="objectCount">const <type>uint32_t</type>* <name>pObjectIndices</name></param>
- </command>
- <command successcodes="VK_SUCCESS" errorcodes="VK_ERROR_OUT_OF_HOST_MEMORY,VK_ERROR_OUT_OF_DEVICE_MEMORY">
- <proto><type>VkResult</type> <name>vkUnregisterObjectsNVX</name></proto>
- <param><type>VkDevice</type> <name>device</name></param>
- <param externsync="true"><type>VkObjectTableNVX</type> <name>objectTable</name></param>
- <param><type>uint32_t</type> <name>objectCount</name></param>
- <param len="objectCount">const <type>VkObjectEntryTypeNVX</type>* <name>pObjectEntryTypes</name></param>
- <param len="objectCount">const <type>uint32_t</type>* <name>pObjectIndices</name></param>
- </command>
<command>
- <proto><type>void</type> <name>vkGetPhysicalDeviceGeneratedCommandsPropertiesNVX</name></proto>
+ <proto><type>void</type> <name>vkGetPhysicalDeviceFeatures2</name></proto>
<param><type>VkPhysicalDevice</type> <name>physicalDevice</name></param>
- <param><type>VkDeviceGeneratedCommandsFeaturesNVX</type>* <name>pFeatures</name></param>
- <param><type>VkDeviceGeneratedCommandsLimitsNVX</type>* <name>pLimits</name></param>
+ <param><type>VkPhysicalDeviceFeatures2</type>* <name>pFeatures</name></param>
</command>
+ <command name="vkGetPhysicalDeviceFeatures2KHR" alias="vkGetPhysicalDeviceFeatures2"/>
<command>
- <proto><type>void</type> <name>vkGetPhysicalDeviceFeatures2KHR</name></proto>
+ <proto><type>void</type> <name>vkGetPhysicalDeviceProperties2</name></proto>
<param><type>VkPhysicalDevice</type> <name>physicalDevice</name></param>
- <param><type>VkPhysicalDeviceFeatures2KHR</type>* <name>pFeatures</name></param>
+ <param><type>VkPhysicalDeviceProperties2</type>* <name>pProperties</name></param>
</command>
+ <command name="vkGetPhysicalDeviceProperties2KHR" alias="vkGetPhysicalDeviceProperties2"/>
<command>
- <proto><type>void</type> <name>vkGetPhysicalDeviceProperties2KHR</name></proto>
- <param><type>VkPhysicalDevice</type> <name>physicalDevice</name></param>
- <param><type>VkPhysicalDeviceProperties2KHR</type>* <name>pProperties</name></param>
- </command>
- <command>
- <proto><type>void</type> <name>vkGetPhysicalDeviceFormatProperties2KHR</name></proto>
+ <proto><type>void</type> <name>vkGetPhysicalDeviceFormatProperties2</name></proto>
<param><type>VkPhysicalDevice</type> <name>physicalDevice</name></param>
<param><type>VkFormat</type> <name>format</name></param>
- <param><type>VkFormatProperties2KHR</type>* <name>pFormatProperties</name></param>
+ <param><type>VkFormatProperties2</type>* <name>pFormatProperties</name></param>
</command>
- <command successcodes="VK_SUCCESS" errorcodes="VK_ERROR_OUT_OF_HOST_MEMORY,VK_ERROR_OUT_OF_DEVICE_MEMORY,VK_ERROR_FORMAT_NOT_SUPPORTED">
- <proto><type>VkResult</type> <name>vkGetPhysicalDeviceImageFormatProperties2KHR</name></proto>
+ <command name="vkGetPhysicalDeviceFormatProperties2KHR" alias="vkGetPhysicalDeviceFormatProperties2"/>
+ <command successcodes="VK_SUCCESS" errorcodes="VK_ERROR_OUT_OF_HOST_MEMORY,VK_ERROR_OUT_OF_DEVICE_MEMORY,VK_ERROR_FORMAT_NOT_SUPPORTED,VK_ERROR_IMAGE_USAGE_NOT_SUPPORTED_KHR,VK_ERROR_VIDEO_PROFILE_OPERATION_NOT_SUPPORTED_KHR,VK_ERROR_VIDEO_PROFILE_FORMAT_NOT_SUPPORTED_KHR,VK_ERROR_VIDEO_PICTURE_LAYOUT_NOT_SUPPORTED_KHR,VK_ERROR_VIDEO_PROFILE_CODEC_NOT_SUPPORTED_KHR">
+ <proto><type>VkResult</type> <name>vkGetPhysicalDeviceImageFormatProperties2</name></proto>
<param><type>VkPhysicalDevice</type> <name>physicalDevice</name></param>
- <param>const <type>VkPhysicalDeviceImageFormatInfo2KHR</type>* <name>pImageFormatInfo</name></param>
- <param><type>VkImageFormatProperties2KHR</type>* <name>pImageFormatProperties</name></param>
+ <param>const <type>VkPhysicalDeviceImageFormatInfo2</type>* <name>pImageFormatInfo</name></param>
+ <param><type>VkImageFormatProperties2</type>* <name>pImageFormatProperties</name></param>
</command>
+ <command name="vkGetPhysicalDeviceImageFormatProperties2KHR" alias="vkGetPhysicalDeviceImageFormatProperties2"/>
<command>
- <proto><type>void</type> <name>vkGetPhysicalDeviceQueueFamilyProperties2KHR</name></proto>
+ <proto><type>void</type> <name>vkGetPhysicalDeviceQueueFamilyProperties2</name></proto>
<param><type>VkPhysicalDevice</type> <name>physicalDevice</name></param>
<param optional="false,true"><type>uint32_t</type>* <name>pQueueFamilyPropertyCount</name></param>
- <param optional="true" len="pQueueFamilyPropertyCount"><type>VkQueueFamilyProperties2KHR</type>* <name>pQueueFamilyProperties</name></param>
+ <param optional="true" len="pQueueFamilyPropertyCount"><type>VkQueueFamilyProperties2</type>* <name>pQueueFamilyProperties</name></param>
</command>
+ <command name="vkGetPhysicalDeviceQueueFamilyProperties2KHR" alias="vkGetPhysicalDeviceQueueFamilyProperties2"/>
<command>
- <proto><type>void</type> <name>vkGetPhysicalDeviceMemoryProperties2KHR</name></proto>
+ <proto><type>void</type> <name>vkGetPhysicalDeviceMemoryProperties2</name></proto>
<param><type>VkPhysicalDevice</type> <name>physicalDevice</name></param>
- <param><type>VkPhysicalDeviceMemoryProperties2KHR</type>* <name>pMemoryProperties</name></param>
+ <param><type>VkPhysicalDeviceMemoryProperties2</type>* <name>pMemoryProperties</name></param>
</command>
+ <command name="vkGetPhysicalDeviceMemoryProperties2KHR" alias="vkGetPhysicalDeviceMemoryProperties2"/>
<command>
- <proto><type>void</type> <name>vkGetPhysicalDeviceSparseImageFormatProperties2KHR</name></proto>
+ <proto><type>void</type> <name>vkGetPhysicalDeviceSparseImageFormatProperties2</name></proto>
<param><type>VkPhysicalDevice</type> <name>physicalDevice</name></param>
- <param>const <type>VkPhysicalDeviceSparseImageFormatInfo2KHR</type>* <name>pFormatInfo</name></param>
+ <param>const <type>VkPhysicalDeviceSparseImageFormatInfo2</type>* <name>pFormatInfo</name></param>
<param optional="false,true"><type>uint32_t</type>* <name>pPropertyCount</name></param>
- <param optional="true" len="pPropertyCount"><type>VkSparseImageFormatProperties2KHR</type>* <name>pProperties</name></param>
+ <param optional="true" len="pPropertyCount"><type>VkSparseImageFormatProperties2</type>* <name>pProperties</name></param>
+ </command>
+ <command name="vkGetPhysicalDeviceSparseImageFormatProperties2KHR" alias="vkGetPhysicalDeviceSparseImageFormatProperties2"/>
+ <command queues="graphics,compute" renderpass="both" cmdbufferlevel="primary,secondary">
+ <proto><type>void</type> <name>vkCmdPushDescriptorSetKHR</name></proto>
+ <param externsync="true"><type>VkCommandBuffer</type> <name>commandBuffer</name></param>
+ <param><type>VkPipelineBindPoint</type> <name>pipelineBindPoint</name></param>
+ <param><type>VkPipelineLayout</type> <name>layout</name></param>
+ <param><type>uint32_t</type> <name>set</name></param>
+ <param><type>uint32_t</type> <name>descriptorWriteCount</name></param>
+ <param len="descriptorWriteCount">const <type>VkWriteDescriptorSet</type>* <name>pDescriptorWrites</name></param>
+ </command>
+ <command>
+ <proto><type>void</type> <name>vkTrimCommandPool</name></proto>
+ <param><type>VkDevice</type> <name>device</name></param>
+ <param externsync="true"><type>VkCommandPool</type> <name>commandPool</name></param>
+ <param optional="true"><type>VkCommandPoolTrimFlags</type> <name>flags</name></param>
+ </command>
+ <command name="vkTrimCommandPoolKHR" alias="vkTrimCommandPool"/>
+ <command>
+ <proto><type>void</type> <name>vkGetPhysicalDeviceExternalBufferProperties</name></proto>
+ <param><type>VkPhysicalDevice</type> <name>physicalDevice</name></param>
+ <param>const <type>VkPhysicalDeviceExternalBufferInfo</type>* <name>pExternalBufferInfo</name></param>
+ <param><type>VkExternalBufferProperties</type>* <name>pExternalBufferProperties</name></param>
+ </command>
+ <command name="vkGetPhysicalDeviceExternalBufferPropertiesKHR" alias="vkGetPhysicalDeviceExternalBufferProperties"/>
+ <command successcodes="VK_SUCCESS" errorcodes="VK_ERROR_TOO_MANY_OBJECTS,VK_ERROR_OUT_OF_HOST_MEMORY">
+ <proto><type>VkResult</type> <name>vkGetMemoryWin32HandleKHR</name></proto>
+ <param><type>VkDevice</type> <name>device</name></param>
+ <param>const <type>VkMemoryGetWin32HandleInfoKHR</type>* <name>pGetWin32HandleInfo</name></param>
+ <param><type>HANDLE</type>* <name>pHandle</name></param>
+ </command>
+ <command successcodes="VK_SUCCESS" errorcodes="VK_ERROR_OUT_OF_HOST_MEMORY,VK_ERROR_INVALID_EXTERNAL_HANDLE">
+ <proto><type>VkResult</type> <name>vkGetMemoryWin32HandlePropertiesKHR</name></proto>
+ <param><type>VkDevice</type> <name>device</name></param>
+ <param><type>VkExternalMemoryHandleTypeFlagBits</type> <name>handleType</name></param>
+ <param><type>HANDLE</type> <name>handle</name></param>
+ <param><type>VkMemoryWin32HandlePropertiesKHR</type>* <name>pMemoryWin32HandleProperties</name></param>
+ </command>
+ <command successcodes="VK_SUCCESS" errorcodes="VK_ERROR_TOO_MANY_OBJECTS,VK_ERROR_OUT_OF_HOST_MEMORY">
+ <proto><type>VkResult</type> <name>vkGetMemoryFdKHR</name></proto>
+ <param><type>VkDevice</type> <name>device</name></param>
+ <param>const <type>VkMemoryGetFdInfoKHR</type>* <name>pGetFdInfo</name></param>
+ <param><type>int</type>* <name>pFd</name></param>
+ </command>
+ <command successcodes="VK_SUCCESS" errorcodes="VK_ERROR_OUT_OF_HOST_MEMORY,VK_ERROR_INVALID_EXTERNAL_HANDLE">
+ <proto><type>VkResult</type> <name>vkGetMemoryFdPropertiesKHR</name></proto>
+ <param><type>VkDevice</type> <name>device</name></param>
+ <param><type>VkExternalMemoryHandleTypeFlagBits</type> <name>handleType</name></param>
+ <param><type>int</type> <name>fd</name></param>
+ <param><type>VkMemoryFdPropertiesKHR</type>* <name>pMemoryFdProperties</name></param>
+ </command>
+ <command successcodes="VK_SUCCESS" errorcodes="VK_ERROR_TOO_MANY_OBJECTS,VK_ERROR_OUT_OF_HOST_MEMORY">
+ <proto><type>VkResult</type> <name>vkGetMemoryZirconHandleFUCHSIA</name></proto>
+ <param><type>VkDevice</type> <name>device</name></param>
+ <param>const <type>VkMemoryGetZirconHandleInfoFUCHSIA</type>* <name>pGetZirconHandleInfo</name></param>
+ <param><type>zx_handle_t</type>* <name>pZirconHandle</name></param>
+ </command>
+ <command successcodes="VK_SUCCESS" errorcodes="VK_ERROR_INVALID_EXTERNAL_HANDLE">
+ <proto><type>VkResult</type> <name>vkGetMemoryZirconHandlePropertiesFUCHSIA</name></proto>
+ <param><type>VkDevice</type> <name>device</name></param>
+ <param><type>VkExternalMemoryHandleTypeFlagBits</type> <name>handleType</name></param>
+ <param><type>zx_handle_t</type> <name>zirconHandle</name></param>
+ <param><type>VkMemoryZirconHandlePropertiesFUCHSIA</type>* <name>pMemoryZirconHandleProperties</name></param>
+ </command>
+ <command successcodes="VK_SUCCESS" errorcodes="VK_ERROR_INVALID_EXTERNAL_HANDLE">
+ <proto><type>VkResult</type> <name>vkGetMemoryRemoteAddressNV</name></proto>
+ <param><type>VkDevice</type> <name>device</name></param>
+ <param>const <type>VkMemoryGetRemoteAddressInfoNV</type>* <name>pMemoryGetRemoteAddressInfo</name></param>
+ <param><type>VkRemoteAddressNV</type>* <name>pAddress</name></param>
+ </command>
+ <command>
+ <proto><type>void</type> <name>vkGetPhysicalDeviceExternalSemaphoreProperties</name></proto>
+ <param><type>VkPhysicalDevice</type> <name>physicalDevice</name></param>
+ <param>const <type>VkPhysicalDeviceExternalSemaphoreInfo</type>* <name>pExternalSemaphoreInfo</name></param>
+ <param><type>VkExternalSemaphoreProperties</type>* <name>pExternalSemaphoreProperties</name></param>
+ </command>
+ <command name="vkGetPhysicalDeviceExternalSemaphorePropertiesKHR" alias="vkGetPhysicalDeviceExternalSemaphoreProperties"/>
+ <command successcodes="VK_SUCCESS" errorcodes="VK_ERROR_TOO_MANY_OBJECTS,VK_ERROR_OUT_OF_HOST_MEMORY">
+ <proto><type>VkResult</type> <name>vkGetSemaphoreWin32HandleKHR</name></proto>
+ <param><type>VkDevice</type> <name>device</name></param>
+ <param>const <type>VkSemaphoreGetWin32HandleInfoKHR</type>* <name>pGetWin32HandleInfo</name></param>
+ <param><type>HANDLE</type>* <name>pHandle</name></param>
+ </command>
+ <command successcodes="VK_SUCCESS" errorcodes="VK_ERROR_OUT_OF_HOST_MEMORY,VK_ERROR_INVALID_EXTERNAL_HANDLE">
+ <proto><type>VkResult</type> <name>vkImportSemaphoreWin32HandleKHR</name></proto>
+ <param><type>VkDevice</type> <name>device</name></param>
+ <param>const <type>VkImportSemaphoreWin32HandleInfoKHR</type>* <name>pImportSemaphoreWin32HandleInfo</name></param>
+ </command>
+ <command successcodes="VK_SUCCESS" errorcodes="VK_ERROR_TOO_MANY_OBJECTS,VK_ERROR_OUT_OF_HOST_MEMORY">
+ <proto><type>VkResult</type> <name>vkGetSemaphoreFdKHR</name></proto>
+ <param><type>VkDevice</type> <name>device</name></param>
+ <param>const <type>VkSemaphoreGetFdInfoKHR</type>* <name>pGetFdInfo</name></param>
+ <param><type>int</type>* <name>pFd</name></param>
+ </command>
+ <command successcodes="VK_SUCCESS" errorcodes="VK_ERROR_OUT_OF_HOST_MEMORY,VK_ERROR_INVALID_EXTERNAL_HANDLE">
+ <proto><type>VkResult</type> <name>vkImportSemaphoreFdKHR</name></proto>
+ <param><type>VkDevice</type> <name>device</name></param>
+ <param>const <type>VkImportSemaphoreFdInfoKHR</type>* <name>pImportSemaphoreFdInfo</name></param>
+ </command>
+ <command successcodes="VK_SUCCESS" errorcodes="VK_ERROR_TOO_MANY_OBJECTS,VK_ERROR_OUT_OF_HOST_MEMORY">
+ <proto><type>VkResult</type> <name>vkGetSemaphoreZirconHandleFUCHSIA</name></proto>
+ <param><type>VkDevice</type> <name>device</name></param>
+ <param>const <type>VkSemaphoreGetZirconHandleInfoFUCHSIA</type>* <name>pGetZirconHandleInfo</name></param>
+ <param><type>zx_handle_t</type>* <name>pZirconHandle</name></param>
+ </command>
+ <command successcodes="VK_SUCCESS" errorcodes="VK_ERROR_OUT_OF_HOST_MEMORY,VK_ERROR_INVALID_EXTERNAL_HANDLE">
+ <proto><type>VkResult</type> <name>vkImportSemaphoreZirconHandleFUCHSIA</name></proto>
+ <param><type>VkDevice</type> <name>device</name></param>
+ <param>const <type>VkImportSemaphoreZirconHandleInfoFUCHSIA</type>* <name>pImportSemaphoreZirconHandleInfo</name></param>
</command>
<command>
- <proto><type>void</type> <name>vkTrimCommandPoolKHR</name></proto>
- <param><type>VkDevice</type> <name>device</name></param>
- <param externsync="true"><type>VkCommandPool</type> <name>commandPool</name></param>
- <param optional="true"><type>VkCommandPoolTrimFlagsKHR</type> <name>flags</name></param>
+ <proto><type>void</type> <name>vkGetPhysicalDeviceExternalFenceProperties</name></proto>
+ <param><type>VkPhysicalDevice</type> <name>physicalDevice</name></param>
+ <param>const <type>VkPhysicalDeviceExternalFenceInfo</type>* <name>pExternalFenceInfo</name></param>
+ <param><type>VkExternalFenceProperties</type>* <name>pExternalFenceProperties</name></param>
+ </command>
+ <command name="vkGetPhysicalDeviceExternalFencePropertiesKHR" alias="vkGetPhysicalDeviceExternalFenceProperties"/>
+ <command successcodes="VK_SUCCESS" errorcodes="VK_ERROR_TOO_MANY_OBJECTS,VK_ERROR_OUT_OF_HOST_MEMORY">
+ <proto><type>VkResult</type> <name>vkGetFenceWin32HandleKHR</name></proto>
+ <param><type>VkDevice</type> <name>device</name></param>
+ <param>const <type>VkFenceGetWin32HandleInfoKHR</type>* <name>pGetWin32HandleInfo</name></param>
+ <param><type>HANDLE</type>* <name>pHandle</name></param>
+ </command>
+ <command successcodes="VK_SUCCESS" errorcodes="VK_ERROR_OUT_OF_HOST_MEMORY,VK_ERROR_INVALID_EXTERNAL_HANDLE">
+ <proto><type>VkResult</type> <name>vkImportFenceWin32HandleKHR</name></proto>
+ <param><type>VkDevice</type> <name>device</name></param>
+ <param>const <type>VkImportFenceWin32HandleInfoKHR</type>* <name>pImportFenceWin32HandleInfo</name></param>
+ </command>
+ <command successcodes="VK_SUCCESS" errorcodes="VK_ERROR_TOO_MANY_OBJECTS,VK_ERROR_OUT_OF_HOST_MEMORY">
+ <proto><type>VkResult</type> <name>vkGetFenceFdKHR</name></proto>
+ <param><type>VkDevice</type> <name>device</name></param>
+ <param>const <type>VkFenceGetFdInfoKHR</type>* <name>pGetFdInfo</name></param>
+ <param><type>int</type>* <name>pFd</name></param>
+ </command>
+ <command successcodes="VK_SUCCESS" errorcodes="VK_ERROR_OUT_OF_HOST_MEMORY,VK_ERROR_INVALID_EXTERNAL_HANDLE">
+ <proto><type>VkResult</type> <name>vkImportFenceFdKHR</name></proto>
+ <param><type>VkDevice</type> <name>device</name></param>
+ <param>const <type>VkImportFenceFdInfoKHR</type>* <name>pImportFenceFdInfo</name></param>
</command>
<command successcodes="VK_SUCCESS">
<proto><type>VkResult</type> <name>vkReleaseDisplayEXT</name></proto>
<param><type>VkPhysicalDevice</type> <name>physicalDevice</name></param>
<param><type>VkDisplayKHR</type> <name>display</name></param>
</command>
- <command successcodes="VK_SUCCESS">
+ <command successcodes="VK_SUCCESS" errorcodes="VK_ERROR_OUT_OF_HOST_MEMORY,VK_ERROR_INITIALIZATION_FAILED">
<proto><type>VkResult</type> <name>vkAcquireXlibDisplayEXT</name></proto>
<param><type>VkPhysicalDevice</type> <name>physicalDevice</name></param>
<param><type>Display</type>* <name>dpy</name></param>
<param><type>VkDisplayKHR</type> <name>display</name></param>
</command>
- <command successcodes="VK_SUCCESS">
+ <command successcodes="VK_SUCCESS" errorcodes="VK_ERROR_OUT_OF_HOST_MEMORY">
<proto><type>VkResult</type> <name>vkGetRandROutputDisplayEXT</name></proto>
<param><type>VkPhysicalDevice</type> <name>physicalDevice</name></param>
<param><type>Display</type>* <name>dpy</name></param>
<param><type>RROutput</type> <name>rrOutput</name></param>
<param><type>VkDisplayKHR</type>* <name>pDisplay</name></param>
</command>
- <command successcodes="VK_SUCCESS">
+ <command successcodes="VK_SUCCESS" errorcodes="VK_ERROR_OUT_OF_HOST_MEMORY,VK_ERROR_DEVICE_LOST,VK_ERROR_INITIALIZATION_FAILED">
+ <proto><type>VkResult</type> <name>vkAcquireWinrtDisplayNV</name></proto>
+ <param><type>VkPhysicalDevice</type> <name>physicalDevice</name></param>
+ <param><type>VkDisplayKHR</type> <name>display</name></param>
+ </command>
+ <command successcodes="VK_SUCCESS" errorcodes="VK_ERROR_OUT_OF_HOST_MEMORY,VK_ERROR_DEVICE_LOST,VK_ERROR_INITIALIZATION_FAILED">
+ <proto><type>VkResult</type> <name>vkGetWinrtDisplayNV</name></proto>
+ <param><type>VkPhysicalDevice</type> <name>physicalDevice</name></param>
+ <param><type>uint32_t</type> <name>deviceRelativeId</name></param>
+ <param><type>VkDisplayKHR</type>* <name>pDisplay</name></param>
+ </command>
+ <command successcodes="VK_SUCCESS" errorcodes="VK_ERROR_OUT_OF_HOST_MEMORY">
<proto><type>VkResult</type> <name>vkDisplayPowerControlEXT</name></proto>
<param><type>VkDevice</type> <name>device</name></param>
<param><type>VkDisplayKHR</type> <name>display</name></param>
<param>const <type>VkDisplayPowerInfoEXT</type>* <name>pDisplayPowerInfo</name></param>
</command>
- <command successcodes="VK_SUCCESS">
+ <command successcodes="VK_SUCCESS" errorcodes="VK_ERROR_OUT_OF_HOST_MEMORY">
<proto><type>VkResult</type> <name>vkRegisterDeviceEventEXT</name></proto>
<param><type>VkDevice</type> <name>device</name></param>
<param>const <type>VkDeviceEventInfoEXT</type>* <name>pDeviceEventInfo</name></param>
- <param>const <type>VkAllocationCallbacks</type>* <name>pAllocator</name></param>
+ <param optional="true">const <type>VkAllocationCallbacks</type>* <name>pAllocator</name></param>
<param><type>VkFence</type>* <name>pFence</name></param>
</command>
- <command successcodes="VK_SUCCESS">
+ <command successcodes="VK_SUCCESS" errorcodes="VK_ERROR_OUT_OF_HOST_MEMORY">
<proto><type>VkResult</type> <name>vkRegisterDisplayEventEXT</name></proto>
<param><type>VkDevice</type> <name>device</name></param>
<param><type>VkDisplayKHR</type> <name>display</name></param>
<param>const <type>VkDisplayEventInfoEXT</type>* <name>pDisplayEventInfo</name></param>
- <param>const <type>VkAllocationCallbacks</type>* <name>pAllocator</name></param>
+ <param optional="true">const <type>VkAllocationCallbacks</type>* <name>pAllocator</name></param>
<param><type>VkFence</type>* <name>pFence</name></param>
</command>
- <command successcodes="VK_SUCCESS,VK_ERROR_DEVICE_LOST,VK_ERROR_OUT_OF_DATE_KHR">
+ <command successcodes="VK_SUCCESS" errorcodes="VK_ERROR_OUT_OF_HOST_MEMORY,VK_ERROR_DEVICE_LOST,VK_ERROR_OUT_OF_DATE_KHR">
<proto><type>VkResult</type> <name>vkGetSwapchainCounterEXT</name></proto>
<param><type>VkDevice</type> <name>device</name></param>
<param><type>VkSwapchainKHR</type> <name>swapchain</name></param>
@@ -4088,35 +10555,1748 @@ maintained in the master branch of the Khronos Vulkan GitHub project.
<param><type>VkSurfaceKHR</type> <name>surface</name></param>
<param><type>VkSurfaceCapabilities2EXT</type>* <name>pSurfaceCapabilities</name></param>
</command>
+ <command successcodes="VK_SUCCESS,VK_INCOMPLETE" errorcodes="VK_ERROR_OUT_OF_HOST_MEMORY,VK_ERROR_OUT_OF_DEVICE_MEMORY,VK_ERROR_INITIALIZATION_FAILED">
+ <proto><type>VkResult</type> <name>vkEnumeratePhysicalDeviceGroups</name></proto>
+ <param><type>VkInstance</type> <name>instance</name></param>
+ <param optional="false,true"><type>uint32_t</type>* <name>pPhysicalDeviceGroupCount</name></param>
+ <param optional="true" len="pPhysicalDeviceGroupCount"><type>VkPhysicalDeviceGroupProperties</type>* <name>pPhysicalDeviceGroupProperties</name></param>
+ </command>
+ <command name="vkEnumeratePhysicalDeviceGroupsKHR" alias="vkEnumeratePhysicalDeviceGroups"/>
+ <command>
+ <proto><type>void</type> <name>vkGetDeviceGroupPeerMemoryFeatures</name></proto>
+ <param><type>VkDevice</type> <name>device</name></param>
+ <param><type>uint32_t</type> <name>heapIndex</name></param>
+ <param><type>uint32_t</type> <name>localDeviceIndex</name></param>
+ <param><type>uint32_t</type> <name>remoteDeviceIndex</name></param>
+ <param><type>VkPeerMemoryFeatureFlags</type>* <name>pPeerMemoryFeatures</name></param>
+ </command>
+ <command name="vkGetDeviceGroupPeerMemoryFeaturesKHR" alias="vkGetDeviceGroupPeerMemoryFeatures"/>
+ <command successcodes="VK_SUCCESS" errorcodes="VK_ERROR_OUT_OF_HOST_MEMORY,VK_ERROR_OUT_OF_DEVICE_MEMORY,VK_ERROR_INVALID_OPAQUE_CAPTURE_ADDRESS_KHR">
+ <proto><type>VkResult</type> <name>vkBindBufferMemory2</name></proto>
+ <param><type>VkDevice</type> <name>device</name></param>
+ <param><type>uint32_t</type> <name>bindInfoCount</name></param>
+ <param len="bindInfoCount">const <type>VkBindBufferMemoryInfo</type>* <name>pBindInfos</name></param>
+ </command>
+ <command name="vkBindBufferMemory2KHR" alias="vkBindBufferMemory2"/>
+ <command successcodes="VK_SUCCESS" errorcodes="VK_ERROR_OUT_OF_HOST_MEMORY,VK_ERROR_OUT_OF_DEVICE_MEMORY">
+ <proto><type>VkResult</type> <name>vkBindImageMemory2</name></proto>
+ <param><type>VkDevice</type> <name>device</name></param>
+ <param><type>uint32_t</type> <name>bindInfoCount</name></param>
+ <param len="bindInfoCount">const <type>VkBindImageMemoryInfo</type>* <name>pBindInfos</name></param>
+ </command>
+ <command name="vkBindImageMemory2KHR" alias="vkBindImageMemory2"/>
+ <command queues="graphics,compute,transfer" renderpass="both" videocoding="both" cmdbufferlevel="primary,secondary">
+ <proto><type>void</type> <name>vkCmdSetDeviceMask</name></proto>
+ <param externsync="true"><type>VkCommandBuffer</type> <name>commandBuffer</name></param>
+ <param><type>uint32_t</type> <name>deviceMask</name></param>
+ </command>
+ <command name="vkCmdSetDeviceMaskKHR" alias="vkCmdSetDeviceMask"/>
+ <command successcodes="VK_SUCCESS" errorcodes="VK_ERROR_OUT_OF_HOST_MEMORY,VK_ERROR_OUT_OF_DEVICE_MEMORY">
+ <proto><type>VkResult</type> <name>vkGetDeviceGroupPresentCapabilitiesKHR</name></proto>
+ <param><type>VkDevice</type> <name>device</name></param>
+ <param><type>VkDeviceGroupPresentCapabilitiesKHR</type>* <name>pDeviceGroupPresentCapabilities</name></param>
+ </command>
+ <command successcodes="VK_SUCCESS" errorcodes="VK_ERROR_OUT_OF_HOST_MEMORY,VK_ERROR_OUT_OF_DEVICE_MEMORY,VK_ERROR_SURFACE_LOST_KHR">
+ <proto><type>VkResult</type> <name>vkGetDeviceGroupSurfacePresentModesKHR</name></proto>
+ <param><type>VkDevice</type> <name>device</name></param>
+ <param externsync="true"><type>VkSurfaceKHR</type> <name>surface</name></param>
+ <param optional="false,true"><type>VkDeviceGroupPresentModeFlagsKHR</type>* <name>pModes</name></param>
+ </command>
+ <command successcodes="VK_SUCCESS,VK_TIMEOUT,VK_NOT_READY,VK_SUBOPTIMAL_KHR" errorcodes="VK_ERROR_OUT_OF_HOST_MEMORY,VK_ERROR_OUT_OF_DEVICE_MEMORY,VK_ERROR_DEVICE_LOST,VK_ERROR_OUT_OF_DATE_KHR,VK_ERROR_SURFACE_LOST_KHR,VK_ERROR_FULL_SCREEN_EXCLUSIVE_MODE_LOST_EXT">
+ <proto><type>VkResult</type> <name>vkAcquireNextImage2KHR</name></proto>
+ <param><type>VkDevice</type> <name>device</name></param>
+ <param>const <type>VkAcquireNextImageInfoKHR</type>* <name>pAcquireInfo</name></param>
+ <param><type>uint32_t</type>* <name>pImageIndex</name></param>
+ </command>
+ <command queues="compute" renderpass="outside" cmdbufferlevel="primary,secondary">
+ <proto><type>void</type> <name>vkCmdDispatchBase</name></proto>
+ <param externsync="true"><type>VkCommandBuffer</type> <name>commandBuffer</name></param>
+ <param><type>uint32_t</type> <name>baseGroupX</name></param>
+ <param><type>uint32_t</type> <name>baseGroupY</name></param>
+ <param><type>uint32_t</type> <name>baseGroupZ</name></param>
+ <param><type>uint32_t</type> <name>groupCountX</name></param>
+ <param><type>uint32_t</type> <name>groupCountY</name></param>
+ <param><type>uint32_t</type> <name>groupCountZ</name></param>
+ </command>
+ <command name="vkCmdDispatchBaseKHR" alias="vkCmdDispatchBase"/>
+ <command successcodes="VK_SUCCESS,VK_INCOMPLETE" errorcodes="VK_ERROR_OUT_OF_HOST_MEMORY,VK_ERROR_OUT_OF_DEVICE_MEMORY">
+ <proto><type>VkResult</type> <name>vkGetPhysicalDevicePresentRectanglesKHR</name></proto>
+ <param><type>VkPhysicalDevice</type> <name>physicalDevice</name></param>
+ <param externsync="true"><type>VkSurfaceKHR</type> <name>surface</name></param>
+ <param optional="false,true"><type>uint32_t</type>* <name>pRectCount</name></param>
+ <param optional="true" len="pRectCount"><type>VkRect2D</type>* <name>pRects</name></param>
+ </command>
+ <command successcodes="VK_SUCCESS" errorcodes="VK_ERROR_OUT_OF_HOST_MEMORY,VK_ERROR_OUT_OF_DEVICE_MEMORY">
+ <proto><type>VkResult</type> <name>vkCreateDescriptorUpdateTemplate</name></proto>
+ <param><type>VkDevice</type> <name>device</name></param>
+ <param>const <type>VkDescriptorUpdateTemplateCreateInfo</type>* <name>pCreateInfo</name></param>
+ <param optional="true">const <type>VkAllocationCallbacks</type>* <name>pAllocator</name></param>
+ <param><type>VkDescriptorUpdateTemplate</type>* <name>pDescriptorUpdateTemplate</name></param>
+ </command>
+ <command name="vkCreateDescriptorUpdateTemplateKHR" alias="vkCreateDescriptorUpdateTemplate"/>
+ <command>
+ <proto><type>void</type> <name>vkDestroyDescriptorUpdateTemplate</name></proto>
+ <param><type>VkDevice</type> <name>device</name></param>
+ <param optional="true" externsync="true"><type>VkDescriptorUpdateTemplate</type> <name>descriptorUpdateTemplate</name></param>
+ <param optional="true">const <type>VkAllocationCallbacks</type>* <name>pAllocator</name></param>
+ </command>
+ <command name="vkDestroyDescriptorUpdateTemplateKHR" alias="vkDestroyDescriptorUpdateTemplate"/>
+ <command>
+ <proto><type>void</type> <name>vkUpdateDescriptorSetWithTemplate</name></proto>
+ <param><type>VkDevice</type> <name>device</name></param>
+ <param><type>VkDescriptorSet</type> <name>descriptorSet</name></param>
+ <param><type>VkDescriptorUpdateTemplate</type> <name>descriptorUpdateTemplate</name></param>
+ <param noautovalidity="true">const <type>void</type>* <name>pData</name></param>
+ </command>
+ <command name="vkUpdateDescriptorSetWithTemplateKHR" alias="vkUpdateDescriptorSetWithTemplate"/>
+ <command queues="graphics,compute" renderpass="both" cmdbufferlevel="primary,secondary">
+ <proto><type>void</type> <name>vkCmdPushDescriptorSetWithTemplateKHR</name></proto>
+ <param externsync="true"><type>VkCommandBuffer</type> <name>commandBuffer</name></param>
+ <param><type>VkDescriptorUpdateTemplate</type> <name>descriptorUpdateTemplate</name></param>
+ <param><type>VkPipelineLayout</type> <name>layout</name></param>
+ <param><type>uint32_t</type> <name>set</name></param>
+ <param noautovalidity="true">const <type>void</type>* <name>pData</name></param>
+ </command>
+ <command>
+ <proto><type>void</type> <name>vkSetHdrMetadataEXT</name></proto>
+ <param><type>VkDevice</type> <name>device</name></param>
+ <param><type>uint32_t</type> <name>swapchainCount</name></param>
+ <param len="swapchainCount">const <type>VkSwapchainKHR</type>* <name>pSwapchains</name></param>
+ <param len="swapchainCount">const <type>VkHdrMetadataEXT</type>* <name>pMetadata</name></param>
+ </command>
+ <command successcodes="VK_SUCCESS,VK_SUBOPTIMAL_KHR" errorcodes="VK_ERROR_OUT_OF_HOST_MEMORY,VK_ERROR_OUT_OF_DEVICE_MEMORY,VK_ERROR_DEVICE_LOST,VK_ERROR_OUT_OF_DATE_KHR,VK_ERROR_SURFACE_LOST_KHR,VK_ERROR_FULL_SCREEN_EXCLUSIVE_MODE_LOST_EXT">
+ <proto><type>VkResult</type> <name>vkGetSwapchainStatusKHR</name></proto>
+ <param><type>VkDevice</type> <name>device</name></param>
+ <param externsync="true"><type>VkSwapchainKHR</type> <name>swapchain</name></param>
+ </command>
+ <command successcodes="VK_SUCCESS" errorcodes="VK_ERROR_OUT_OF_HOST_MEMORY,VK_ERROR_DEVICE_LOST,VK_ERROR_SURFACE_LOST_KHR">
+ <proto><type>VkResult</type> <name>vkGetRefreshCycleDurationGOOGLE</name></proto>
+ <param><type>VkDevice</type> <name>device</name></param>
+ <param externsync="true"><type>VkSwapchainKHR</type> <name>swapchain</name></param>
+ <param><type>VkRefreshCycleDurationGOOGLE</type>* <name>pDisplayTimingProperties</name></param>
+ </command>
+ <command successcodes="VK_SUCCESS,VK_INCOMPLETE" errorcodes="VK_ERROR_OUT_OF_HOST_MEMORY,VK_ERROR_DEVICE_LOST,VK_ERROR_OUT_OF_DATE_KHR,VK_ERROR_SURFACE_LOST_KHR">
+ <proto><type>VkResult</type> <name>vkGetPastPresentationTimingGOOGLE</name></proto>
+ <param><type>VkDevice</type> <name>device</name></param>
+ <param externsync="true"><type>VkSwapchainKHR</type> <name>swapchain</name></param>
+ <param optional="false,true"><type>uint32_t</type>* <name>pPresentationTimingCount</name></param>
+ <param optional="true" len="pPresentationTimingCount"><type>VkPastPresentationTimingGOOGLE</type>* <name>pPresentationTimings</name></param>
+ </command>
+ <command successcodes="VK_SUCCESS" errorcodes="VK_ERROR_OUT_OF_HOST_MEMORY,VK_ERROR_OUT_OF_DEVICE_MEMORY,VK_ERROR_NATIVE_WINDOW_IN_USE_KHR">
+ <proto><type>VkResult</type> <name>vkCreateIOSSurfaceMVK</name></proto>
+ <param><type>VkInstance</type> <name>instance</name></param>
+ <param>const <type>VkIOSSurfaceCreateInfoMVK</type>* <name>pCreateInfo</name></param>
+ <param optional="true">const <type>VkAllocationCallbacks</type>* <name>pAllocator</name></param>
+ <param><type>VkSurfaceKHR</type>* <name>pSurface</name></param>
+ </command>
+ <command successcodes="VK_SUCCESS" errorcodes="VK_ERROR_OUT_OF_HOST_MEMORY,VK_ERROR_OUT_OF_DEVICE_MEMORY,VK_ERROR_NATIVE_WINDOW_IN_USE_KHR">
+ <proto><type>VkResult</type> <name>vkCreateMacOSSurfaceMVK</name></proto>
+ <param><type>VkInstance</type> <name>instance</name></param>
+ <param>const <type>VkMacOSSurfaceCreateInfoMVK</type>* <name>pCreateInfo</name></param>
+ <param optional="true">const <type>VkAllocationCallbacks</type>* <name>pAllocator</name></param>
+ <param><type>VkSurfaceKHR</type>* <name>pSurface</name></param>
+ </command>
+ <command successcodes="VK_SUCCESS" errorcodes="VK_ERROR_OUT_OF_HOST_MEMORY,VK_ERROR_OUT_OF_DEVICE_MEMORY,VK_ERROR_NATIVE_WINDOW_IN_USE_KHR">
+ <proto><type>VkResult</type> <name>vkCreateMetalSurfaceEXT</name></proto>
+ <param><type>VkInstance</type> <name>instance</name></param>
+ <param>const <type>VkMetalSurfaceCreateInfoEXT</type>* <name>pCreateInfo</name></param>
+ <param optional="true">const <type>VkAllocationCallbacks</type>* <name>pAllocator</name></param>
+ <param><type>VkSurfaceKHR</type>* <name>pSurface</name></param>
+ </command>
+ <command queues="graphics" renderpass="both" cmdbufferlevel="primary,secondary">
+ <proto><type>void</type> <name>vkCmdSetViewportWScalingNV</name></proto>
+ <param externsync="true"><type>VkCommandBuffer</type> <name>commandBuffer</name></param>
+ <param><type>uint32_t</type> <name>firstViewport</name></param>
+ <param><type>uint32_t</type> <name>viewportCount</name></param>
+ <param len="viewportCount">const <type>VkViewportWScalingNV</type>* <name>pViewportWScalings</name></param>
+ </command>
+ <command queues="graphics" renderpass="both" cmdbufferlevel="primary,secondary">
+ <proto><type>void</type> <name>vkCmdSetDiscardRectangleEXT</name></proto>
+ <param externsync="true"><type>VkCommandBuffer</type> <name>commandBuffer</name></param>
+ <param><type>uint32_t</type> <name>firstDiscardRectangle</name></param>
+ <param><type>uint32_t</type> <name>discardRectangleCount</name></param>
+ <param len="discardRectangleCount">const <type>VkRect2D</type>* <name>pDiscardRectangles</name></param>
+ </command>
+ <command queues="graphics" renderpass="both" cmdbufferlevel="primary,secondary">
+ <proto><type>void</type> <name>vkCmdSetSampleLocationsEXT</name></proto>
+ <param externsync="true"><type>VkCommandBuffer</type> <name>commandBuffer</name></param>
+ <param>const <type>VkSampleLocationsInfoEXT</type>* <name>pSampleLocationsInfo</name></param>
+ </command>
+ <command>
+ <proto><type>void</type> <name>vkGetPhysicalDeviceMultisamplePropertiesEXT</name></proto>
+ <param><type>VkPhysicalDevice</type> <name>physicalDevice</name></param>
+ <param><type>VkSampleCountFlagBits</type> <name>samples</name></param>
+ <param><type>VkMultisamplePropertiesEXT</type>* <name>pMultisampleProperties</name></param>
+ </command>
+ <command successcodes="VK_SUCCESS" errorcodes="VK_ERROR_OUT_OF_HOST_MEMORY,VK_ERROR_OUT_OF_DEVICE_MEMORY,VK_ERROR_SURFACE_LOST_KHR">
+ <proto><type>VkResult</type> <name>vkGetPhysicalDeviceSurfaceCapabilities2KHR</name></proto>
+ <param><type>VkPhysicalDevice</type> <name>physicalDevice</name></param>
+ <param>const <type>VkPhysicalDeviceSurfaceInfo2KHR</type>* <name>pSurfaceInfo</name></param>
+ <param><type>VkSurfaceCapabilities2KHR</type>* <name>pSurfaceCapabilities</name></param>
+ </command>
+ <command successcodes="VK_SUCCESS,VK_INCOMPLETE" errorcodes="VK_ERROR_OUT_OF_HOST_MEMORY,VK_ERROR_OUT_OF_DEVICE_MEMORY,VK_ERROR_SURFACE_LOST_KHR">
+ <proto><type>VkResult</type> <name>vkGetPhysicalDeviceSurfaceFormats2KHR</name></proto>
+ <param><type>VkPhysicalDevice</type> <name>physicalDevice</name></param>
+ <param>const <type>VkPhysicalDeviceSurfaceInfo2KHR</type>* <name>pSurfaceInfo</name></param>
+ <param optional="false,true"><type>uint32_t</type>* <name>pSurfaceFormatCount</name></param>
+ <param optional="true" len="pSurfaceFormatCount"><type>VkSurfaceFormat2KHR</type>* <name>pSurfaceFormats</name></param>
+ </command>
+ <command successcodes="VK_SUCCESS,VK_INCOMPLETE" errorcodes="VK_ERROR_OUT_OF_HOST_MEMORY,VK_ERROR_OUT_OF_DEVICE_MEMORY">
+ <proto><type>VkResult</type> <name>vkGetPhysicalDeviceDisplayProperties2KHR</name></proto>
+ <param><type>VkPhysicalDevice</type> <name>physicalDevice</name></param>
+ <param optional="false,true"><type>uint32_t</type>* <name>pPropertyCount</name></param>
+ <param optional="true" len="pPropertyCount"><type>VkDisplayProperties2KHR</type>* <name>pProperties</name></param>
+ </command>
+ <command successcodes="VK_SUCCESS,VK_INCOMPLETE" errorcodes="VK_ERROR_OUT_OF_HOST_MEMORY,VK_ERROR_OUT_OF_DEVICE_MEMORY">
+ <proto><type>VkResult</type> <name>vkGetPhysicalDeviceDisplayPlaneProperties2KHR</name></proto>
+ <param><type>VkPhysicalDevice</type> <name>physicalDevice</name></param>
+ <param optional="false,true"><type>uint32_t</type>* <name>pPropertyCount</name></param>
+ <param optional="true" len="pPropertyCount"><type>VkDisplayPlaneProperties2KHR</type>* <name>pProperties</name></param>
+ </command>
+ <command successcodes="VK_SUCCESS,VK_INCOMPLETE" errorcodes="VK_ERROR_OUT_OF_HOST_MEMORY,VK_ERROR_OUT_OF_DEVICE_MEMORY">
+ <proto><type>VkResult</type> <name>vkGetDisplayModeProperties2KHR</name></proto>
+ <param><type>VkPhysicalDevice</type> <name>physicalDevice</name></param>
+ <param><type>VkDisplayKHR</type> <name>display</name></param>
+ <param optional="false,true"><type>uint32_t</type>* <name>pPropertyCount</name></param>
+ <param optional="true" len="pPropertyCount"><type>VkDisplayModeProperties2KHR</type>* <name>pProperties</name></param>
+ </command>
+ <command successcodes="VK_SUCCESS" errorcodes="VK_ERROR_OUT_OF_HOST_MEMORY,VK_ERROR_OUT_OF_DEVICE_MEMORY">
+ <proto><type>VkResult</type> <name>vkGetDisplayPlaneCapabilities2KHR</name></proto>
+ <param><type>VkPhysicalDevice</type> <name>physicalDevice</name></param>
+ <param>const <type>VkDisplayPlaneInfo2KHR</type>* <name>pDisplayPlaneInfo</name></param>
+ <param><type>VkDisplayPlaneCapabilities2KHR</type>* <name>pCapabilities</name></param>
+ </command>
+ <command>
+ <proto><type>void</type> <name>vkGetBufferMemoryRequirements2</name></proto>
+ <param><type>VkDevice</type> <name>device</name></param>
+ <param>const <type>VkBufferMemoryRequirementsInfo2</type>* <name>pInfo</name></param>
+ <param><type>VkMemoryRequirements2</type>* <name>pMemoryRequirements</name></param>
+ </command>
+ <command name="vkGetBufferMemoryRequirements2KHR" alias="vkGetBufferMemoryRequirements2"/>
+ <command>
+ <proto><type>void</type> <name>vkGetImageMemoryRequirements2</name></proto>
+ <param><type>VkDevice</type> <name>device</name></param>
+ <param>const <type>VkImageMemoryRequirementsInfo2</type>* <name>pInfo</name></param>
+ <param><type>VkMemoryRequirements2</type>* <name>pMemoryRequirements</name></param>
+ </command>
+ <command name="vkGetImageMemoryRequirements2KHR" alias="vkGetImageMemoryRequirements2"/>
+ <command>
+ <proto><type>void</type> <name>vkGetImageSparseMemoryRequirements2</name></proto>
+ <param><type>VkDevice</type> <name>device</name></param>
+ <param>const <type>VkImageSparseMemoryRequirementsInfo2</type>* <name>pInfo</name></param>
+ <param optional="false,true"><type>uint32_t</type>* <name>pSparseMemoryRequirementCount</name></param>
+ <param optional="true" len="pSparseMemoryRequirementCount"><type>VkSparseImageMemoryRequirements2</type>* <name>pSparseMemoryRequirements</name></param>
+ </command>
+ <command name="vkGetImageSparseMemoryRequirements2KHR" alias="vkGetImageSparseMemoryRequirements2"/>
+ <command>
+ <proto><type>void</type> <name>vkGetDeviceBufferMemoryRequirements</name></proto>
+ <param><type>VkDevice</type> <name>device</name></param>
+ <param>const <type>VkDeviceBufferMemoryRequirements</type>* <name>pInfo</name></param>
+ <param><type>VkMemoryRequirements2</type>* <name>pMemoryRequirements</name></param>
+ </command>
+ <command name="vkGetDeviceBufferMemoryRequirementsKHR" alias="vkGetDeviceBufferMemoryRequirements"/>
+ <command>
+ <proto><type>void</type> <name>vkGetDeviceImageMemoryRequirements</name></proto>
+ <param><type>VkDevice</type> <name>device</name></param>
+ <param>const <type>VkDeviceImageMemoryRequirements</type>* <name>pInfo</name></param>
+ <param><type>VkMemoryRequirements2</type>* <name>pMemoryRequirements</name></param>
+ </command>
+ <command name="vkGetDeviceImageMemoryRequirementsKHR" alias="vkGetDeviceImageMemoryRequirements"/>
+ <command>
+ <proto><type>void</type> <name>vkGetDeviceImageSparseMemoryRequirements</name></proto>
+ <param><type>VkDevice</type> <name>device</name></param>
+ <param>const <type>VkDeviceImageMemoryRequirements</type>* <name>pInfo</name></param>
+ <param optional="false,true"><type>uint32_t</type>* <name>pSparseMemoryRequirementCount</name></param>
+ <param optional="true" len="pSparseMemoryRequirementCount"><type>VkSparseImageMemoryRequirements2</type>* <name>pSparseMemoryRequirements</name></param>
+ </command>
+ <command name="vkGetDeviceImageSparseMemoryRequirementsKHR" alias="vkGetDeviceImageSparseMemoryRequirements"/>
+ <command successcodes="VK_SUCCESS" errorcodes="VK_ERROR_OUT_OF_HOST_MEMORY,VK_ERROR_OUT_OF_DEVICE_MEMORY">
+ <proto><type>VkResult</type> <name>vkCreateSamplerYcbcrConversion</name></proto>
+ <param><type>VkDevice</type> <name>device</name></param>
+ <param>const <type>VkSamplerYcbcrConversionCreateInfo</type>* <name>pCreateInfo</name></param>
+ <param optional="true">const <type>VkAllocationCallbacks</type>* <name>pAllocator</name></param>
+ <param><type>VkSamplerYcbcrConversion</type>* <name>pYcbcrConversion</name></param>
+ </command>
+ <command name="vkCreateSamplerYcbcrConversionKHR" alias="vkCreateSamplerYcbcrConversion"/>
+ <command>
+ <proto><type>void</type> <name>vkDestroySamplerYcbcrConversion</name></proto>
+ <param><type>VkDevice</type> <name>device</name></param>
+ <param optional="true" externsync="true"><type>VkSamplerYcbcrConversion</type> <name>ycbcrConversion</name></param>
+ <param optional="true">const <type>VkAllocationCallbacks</type>* <name>pAllocator</name></param>
+ </command>
+ <command name="vkDestroySamplerYcbcrConversionKHR" alias="vkDestroySamplerYcbcrConversion"/>
+ <command>
+ <proto><type>void</type> <name>vkGetDeviceQueue2</name></proto>
+ <param><type>VkDevice</type> <name>device</name></param>
+ <param>const <type>VkDeviceQueueInfo2</type>* <name>pQueueInfo</name></param>
+ <param><type>VkQueue</type>* <name>pQueue</name></param>
+ </command>
+ <command successcodes="VK_SUCCESS" errorcodes="VK_ERROR_OUT_OF_HOST_MEMORY">
+ <proto><type>VkResult</type> <name>vkCreateValidationCacheEXT</name></proto>
+ <param><type>VkDevice</type> <name>device</name></param>
+ <param>const <type>VkValidationCacheCreateInfoEXT</type>* <name>pCreateInfo</name></param>
+ <param optional="true">const <type>VkAllocationCallbacks</type>* <name>pAllocator</name></param>
+ <param><type>VkValidationCacheEXT</type>* <name>pValidationCache</name></param>
+ </command>
+ <command>
+ <proto><type>void</type> <name>vkDestroyValidationCacheEXT</name></proto>
+ <param><type>VkDevice</type> <name>device</name></param>
+ <param optional="true" externsync="true"><type>VkValidationCacheEXT</type> <name>validationCache</name></param>
+ <param optional="true">const <type>VkAllocationCallbacks</type>* <name>pAllocator</name></param>
+ </command>
+ <command successcodes="VK_SUCCESS,VK_INCOMPLETE" errorcodes="VK_ERROR_OUT_OF_HOST_MEMORY,VK_ERROR_OUT_OF_DEVICE_MEMORY">
+ <proto><type>VkResult</type> <name>vkGetValidationCacheDataEXT</name></proto>
+ <param><type>VkDevice</type> <name>device</name></param>
+ <param><type>VkValidationCacheEXT</type> <name>validationCache</name></param>
+ <param optional="false,true"><type>size_t</type>* <name>pDataSize</name></param>
+ <param optional="true" len="pDataSize"><type>void</type>* <name>pData</name></param>
+ </command>
+ <command successcodes="VK_SUCCESS" errorcodes="VK_ERROR_OUT_OF_HOST_MEMORY,VK_ERROR_OUT_OF_DEVICE_MEMORY">
+ <proto><type>VkResult</type> <name>vkMergeValidationCachesEXT</name></proto>
+ <param><type>VkDevice</type> <name>device</name></param>
+ <param externsync="true"><type>VkValidationCacheEXT</type> <name>dstCache</name></param>
+ <param><type>uint32_t</type> <name>srcCacheCount</name></param>
+ <param len="srcCacheCount">const <type>VkValidationCacheEXT</type>* <name>pSrcCaches</name></param>
+ </command>
+ <command>
+ <proto><type>void</type> <name>vkGetDescriptorSetLayoutSupport</name></proto>
+ <param><type>VkDevice</type> <name>device</name></param>
+ <param>const <type>VkDescriptorSetLayoutCreateInfo</type>* <name>pCreateInfo</name></param>
+ <param><type>VkDescriptorSetLayoutSupport</type>* <name>pSupport</name></param>
+ </command>
+ <command name="vkGetDescriptorSetLayoutSupportKHR" alias="vkGetDescriptorSetLayoutSupport"/>
+ <command>
+ <proto><type>VkResult</type> <name>vkGetSwapchainGrallocUsageANDROID</name></proto>
+ <param><type>VkDevice</type> <name>device</name></param>
+ <param><type>VkFormat</type> <name>format</name></param>
+ <param><type>VkImageUsageFlags</type> <name>imageUsage</name></param>
+ <param><type>int</type>* <name>grallocUsage</name></param>
+ </command>
+ <command>
+ <proto><type>VkResult</type> <name>vkGetSwapchainGrallocUsage2ANDROID</name></proto>
+ <param><type>VkDevice</type> <name>device</name></param>
+ <param><type>VkFormat</type> <name>format</name></param>
+ <param><type>VkImageUsageFlags</type> <name>imageUsage</name></param>
+ <param><type>VkSwapchainImageUsageFlagsANDROID</type> <name>swapchainImageUsage</name></param>
+ <param><type>uint64_t</type>* <name>grallocConsumerUsage</name></param>
+ <param><type>uint64_t</type>* <name>grallocProducerUsage</name></param>
+ </command>
+ <command>
+ <proto><type>VkResult</type> <name>vkAcquireImageANDROID</name></proto>
+ <param><type>VkDevice</type> <name>device</name></param>
+ <param><type>VkImage</type> <name>image</name></param>
+ <param><type>int</type> <name>nativeFenceFd</name></param>
+ <param><type>VkSemaphore</type> <name>semaphore</name></param>
+ <param><type>VkFence</type> <name>fence</name></param>
+ </command>
+ <command>
+ <proto><type>VkResult</type> <name>vkQueueSignalReleaseImageANDROID</name></proto>
+ <param><type>VkQueue</type> <name>queue</name></param>
+ <param><type>uint32_t</type> <name>waitSemaphoreCount</name></param>
+ <param len="waitSemaphoreCount">const <type>VkSemaphore</type>* <name>pWaitSemaphores</name></param>
+ <param><type>VkImage</type> <name>image</name></param>
+ <param><type>int</type>* <name>pNativeFenceFd</name></param>
+ </command>
+ <command successcodes="VK_SUCCESS,VK_INCOMPLETE" errorcodes="VK_ERROR_FEATURE_NOT_PRESENT,VK_ERROR_OUT_OF_HOST_MEMORY">
+ <proto><type>VkResult</type> <name>vkGetShaderInfoAMD</name></proto>
+ <param><type>VkDevice</type> <name>device</name></param>
+ <param><type>VkPipeline</type> <name>pipeline</name></param>
+ <param><type>VkShaderStageFlagBits</type> <name>shaderStage</name></param>
+ <param><type>VkShaderInfoTypeAMD</type> <name>infoType</name></param>
+ <param optional="false,true"><type>size_t</type>* <name>pInfoSize</name></param>
+ <param optional="true" len="pInfoSize"><type>void</type>* <name>pInfo</name></param>
+ </command>
+ <command>
+ <proto><type>void</type> <name>vkSetLocalDimmingAMD</name></proto>
+ <param><type>VkDevice</type> <name>device</name></param>
+ <param><type>VkSwapchainKHR</type> <name>swapChain</name></param>
+ <param><type>VkBool32</type> <name>localDimmingEnable</name></param>
+ </command>
+ <command successcodes="VK_SUCCESS,VK_INCOMPLETE" errorcodes="VK_ERROR_OUT_OF_HOST_MEMORY,VK_ERROR_OUT_OF_DEVICE_MEMORY">
+ <proto><type>VkResult</type> <name>vkGetPhysicalDeviceCalibrateableTimeDomainsEXT</name></proto>
+ <param><type>VkPhysicalDevice</type> <name>physicalDevice</name></param>
+ <param optional="false,true"><type>uint32_t</type>* <name>pTimeDomainCount</name></param>
+ <param optional="true" len="pTimeDomainCount"><type>VkTimeDomainEXT</type>* <name>pTimeDomains</name></param>
+ </command>
+ <command successcodes="VK_SUCCESS" errorcodes="VK_ERROR_OUT_OF_HOST_MEMORY,VK_ERROR_OUT_OF_DEVICE_MEMORY">
+ <proto><type>VkResult</type> <name>vkGetCalibratedTimestampsEXT</name></proto>
+ <param><type>VkDevice</type> <name>device</name></param>
+ <param><type>uint32_t</type> <name>timestampCount</name></param>
+ <param len="timestampCount">const <type>VkCalibratedTimestampInfoEXT</type>* <name>pTimestampInfos</name></param>
+ <param len="timestampCount"><type>uint64_t</type>* <name>pTimestamps</name></param>
+ <param><type>uint64_t</type>* <name>pMaxDeviation</name></param>
+ </command>
+ <command successcodes="VK_SUCCESS" errorcodes="VK_ERROR_OUT_OF_HOST_MEMORY,VK_ERROR_OUT_OF_DEVICE_MEMORY">
+ <proto><type>VkResult</type> <name>vkSetDebugUtilsObjectNameEXT</name></proto>
+ <param><type>VkDevice</type> <name>device</name></param>
+ <param externsync="pNameInfo-&gt;objectHandle">const <type>VkDebugUtilsObjectNameInfoEXT</type>* <name>pNameInfo</name></param>
+ </command>
+ <command successcodes="VK_SUCCESS" errorcodes="VK_ERROR_OUT_OF_HOST_MEMORY,VK_ERROR_OUT_OF_DEVICE_MEMORY">
+ <proto><type>VkResult</type> <name>vkSetDebugUtilsObjectTagEXT</name></proto>
+ <param><type>VkDevice</type> <name>device</name></param>
+ <param externsync="pTagInfo-&gt;objectHandle">const <type>VkDebugUtilsObjectTagInfoEXT</type>* <name>pTagInfo</name></param>
+ </command>
+ <command>
+ <proto><type>void</type> <name>vkQueueBeginDebugUtilsLabelEXT</name></proto>
+ <param><type>VkQueue</type> <name>queue</name></param>
+ <param>const <type>VkDebugUtilsLabelEXT</type>* <name>pLabelInfo</name></param>
+ </command>
+ <command>
+ <proto><type>void</type> <name>vkQueueEndDebugUtilsLabelEXT</name></proto>
+ <param><type>VkQueue</type> <name>queue</name></param>
+ </command>
+ <command>
+ <proto><type>void</type> <name>vkQueueInsertDebugUtilsLabelEXT</name></proto>
+ <param><type>VkQueue</type> <name>queue</name></param>
+ <param>const <type>VkDebugUtilsLabelEXT</type>* <name>pLabelInfo</name></param>
+ </command>
+ <command queues="graphics,compute" renderpass="both" cmdbufferlevel="primary,secondary">
+ <proto><type>void</type> <name>vkCmdBeginDebugUtilsLabelEXT</name></proto>
+ <param externsync="true"><type>VkCommandBuffer</type> <name>commandBuffer</name></param>
+ <param>const <type>VkDebugUtilsLabelEXT</type>* <name>pLabelInfo</name></param>
+ </command>
+ <command queues="graphics,compute" renderpass="both" cmdbufferlevel="primary,secondary">
+ <proto><type>void</type> <name>vkCmdEndDebugUtilsLabelEXT</name></proto>
+ <param externsync="true"><type>VkCommandBuffer</type> <name>commandBuffer</name></param>
+ </command>
+ <command queues="graphics,compute" renderpass="both" cmdbufferlevel="primary,secondary">
+ <proto><type>void</type> <name>vkCmdInsertDebugUtilsLabelEXT</name></proto>
+ <param externsync="true"><type>VkCommandBuffer</type> <name>commandBuffer</name></param>
+ <param>const <type>VkDebugUtilsLabelEXT</type>* <name>pLabelInfo</name></param>
+ </command>
+ <command successcodes="VK_SUCCESS" errorcodes="VK_ERROR_OUT_OF_HOST_MEMORY">
+ <proto><type>VkResult</type> <name>vkCreateDebugUtilsMessengerEXT</name></proto>
+ <param><type>VkInstance</type> <name>instance</name></param>
+ <param>const <type>VkDebugUtilsMessengerCreateInfoEXT</type>* <name>pCreateInfo</name></param>
+ <param optional="true">const <type>VkAllocationCallbacks</type>* <name>pAllocator</name></param>
+ <param><type>VkDebugUtilsMessengerEXT</type>* <name>pMessenger</name></param>
+ </command>
+ <command>
+ <proto><type>void</type> <name>vkDestroyDebugUtilsMessengerEXT</name></proto>
+ <param><type>VkInstance</type> <name>instance</name></param>
+ <param optional="true" externsync="true"><type>VkDebugUtilsMessengerEXT</type> <name>messenger</name></param>
+ <param optional="true">const <type>VkAllocationCallbacks</type>* <name>pAllocator</name></param>
+ </command>
+ <command>
+ <proto><type>void</type> <name>vkSubmitDebugUtilsMessageEXT</name></proto>
+ <param><type>VkInstance</type> <name>instance</name></param>
+ <param><type>VkDebugUtilsMessageSeverityFlagBitsEXT</type> <name>messageSeverity</name></param>
+ <param><type>VkDebugUtilsMessageTypeFlagsEXT</type> <name>messageTypes</name></param>
+ <param>const <type>VkDebugUtilsMessengerCallbackDataEXT</type>* <name>pCallbackData</name></param>
+ </command>
+ <command successcodes="VK_SUCCESS" errorcodes="VK_ERROR_OUT_OF_HOST_MEMORY,VK_ERROR_INVALID_EXTERNAL_HANDLE">
+ <proto><type>VkResult</type> <name>vkGetMemoryHostPointerPropertiesEXT</name></proto>
+ <param><type>VkDevice</type> <name>device</name></param>
+ <param><type>VkExternalMemoryHandleTypeFlagBits</type> <name>handleType</name></param>
+ <param optional="false">const <type>void</type>* <name>pHostPointer</name></param>
+ <param><type>VkMemoryHostPointerPropertiesEXT</type>* <name>pMemoryHostPointerProperties</name></param>
+ </command>
+ <command queues="transfer,graphics,compute" renderpass="both" cmdbufferlevel="primary,secondary">
+ <proto><type>void</type> <name>vkCmdWriteBufferMarkerAMD</name></proto>
+ <param externsync="true"><type>VkCommandBuffer</type> <name>commandBuffer</name></param>
+ <param optional="true"><type>VkPipelineStageFlagBits</type> <name>pipelineStage</name></param>
+ <param><type>VkBuffer</type> <name>dstBuffer</name></param>
+ <param><type>VkDeviceSize</type> <name>dstOffset</name></param>
+ <param><type>uint32_t</type> <name>marker</name></param>
+ </command>
+ <command successcodes="VK_SUCCESS" errorcodes="VK_ERROR_OUT_OF_HOST_MEMORY,VK_ERROR_OUT_OF_DEVICE_MEMORY">
+ <proto><type>VkResult</type> <name>vkCreateRenderPass2</name></proto>
+ <param><type>VkDevice</type> <name>device</name></param>
+ <param>const <type>VkRenderPassCreateInfo2</type>* <name>pCreateInfo</name></param>
+ <param optional="true">const <type>VkAllocationCallbacks</type>* <name>pAllocator</name></param>
+ <param><type>VkRenderPass</type>* <name>pRenderPass</name></param>
+ </command>
+ <command name="vkCreateRenderPass2KHR" alias="vkCreateRenderPass2"/>
+ <command queues="graphics" renderpass="outside" cmdbufferlevel="primary">
+ <proto><type>void</type> <name>vkCmdBeginRenderPass2</name></proto>
+ <param externsync="true"><type>VkCommandBuffer</type> <name>commandBuffer</name></param>
+ <param>const <type>VkRenderPassBeginInfo</type>* <name>pRenderPassBegin</name></param>
+ <param>const <type>VkSubpassBeginInfo</type>* <name>pSubpassBeginInfo</name></param>
+ </command>
+ <command name="vkCmdBeginRenderPass2KHR" alias="vkCmdBeginRenderPass2"/>
+ <command queues="graphics" renderpass="inside" cmdbufferlevel="primary">
+ <proto><type>void</type> <name>vkCmdNextSubpass2</name></proto>
+ <param externsync="true"><type>VkCommandBuffer</type> <name>commandBuffer</name></param>
+ <param>const <type>VkSubpassBeginInfo</type>* <name>pSubpassBeginInfo</name></param>
+ <param>const <type>VkSubpassEndInfo</type>* <name>pSubpassEndInfo</name></param>
+ </command>
+ <command name="vkCmdNextSubpass2KHR" alias="vkCmdNextSubpass2"/>
+ <command queues="graphics" renderpass="inside" cmdbufferlevel="primary">
+ <proto><type>void</type> <name>vkCmdEndRenderPass2</name></proto>
+ <param externsync="true"><type>VkCommandBuffer</type> <name>commandBuffer</name></param>
+ <param>const <type>VkSubpassEndInfo</type>* <name>pSubpassEndInfo</name></param>
+ </command>
+ <command name="vkCmdEndRenderPass2KHR" alias="vkCmdEndRenderPass2"/>
+ <command successcodes="VK_SUCCESS" errorcodes="VK_ERROR_OUT_OF_HOST_MEMORY,VK_ERROR_OUT_OF_DEVICE_MEMORY,VK_ERROR_DEVICE_LOST">
+ <proto><type>VkResult</type> <name>vkGetSemaphoreCounterValue</name></proto>
+ <param><type>VkDevice</type> <name>device</name></param>
+ <param><type>VkSemaphore</type> <name>semaphore</name></param>
+ <param><type>uint64_t</type>* <name>pValue</name></param>
+ </command>
+ <command name="vkGetSemaphoreCounterValueKHR" alias="vkGetSemaphoreCounterValue"/>
+ <command successcodes="VK_SUCCESS,VK_TIMEOUT" errorcodes="VK_ERROR_OUT_OF_HOST_MEMORY,VK_ERROR_OUT_OF_DEVICE_MEMORY,VK_ERROR_DEVICE_LOST">
+ <proto><type>VkResult</type> <name>vkWaitSemaphores</name></proto>
+ <param><type>VkDevice</type> <name>device</name></param>
+ <param>const <type>VkSemaphoreWaitInfo</type>* <name>pWaitInfo</name></param>
+ <param><type>uint64_t</type> <name>timeout</name></param>
+ </command>
+ <command name="vkWaitSemaphoresKHR" alias="vkWaitSemaphores"/>
+ <command successcodes="VK_SUCCESS" errorcodes="VK_ERROR_OUT_OF_HOST_MEMORY,VK_ERROR_OUT_OF_DEVICE_MEMORY">
+ <proto><type>VkResult</type> <name>vkSignalSemaphore</name></proto>
+ <param><type>VkDevice</type> <name>device</name></param>
+ <param>const <type>VkSemaphoreSignalInfo</type>* <name>pSignalInfo</name></param>
+ </command>
+ <command name="vkSignalSemaphoreKHR" alias="vkSignalSemaphore"/>
+ <command successcodes="VK_SUCCESS" errorcodes="VK_ERROR_OUT_OF_HOST_MEMORY,VK_ERROR_INVALID_EXTERNAL_HANDLE_KHR">
+ <proto><type>VkResult</type> <name>vkGetAndroidHardwareBufferPropertiesANDROID</name></proto>
+ <param><type>VkDevice</type> <name>device</name></param>
+ <param>const struct <type>AHardwareBuffer</type>* <name>buffer</name></param>
+ <param><type>VkAndroidHardwareBufferPropertiesANDROID</type>* <name>pProperties</name></param>
+ </command>
+ <command successcodes="VK_SUCCESS" errorcodes="VK_ERROR_TOO_MANY_OBJECTS,VK_ERROR_OUT_OF_HOST_MEMORY">
+ <proto><type>VkResult</type> <name>vkGetMemoryAndroidHardwareBufferANDROID</name></proto>
+ <param><type>VkDevice</type> <name>device</name></param>
+ <param>const <type>VkMemoryGetAndroidHardwareBufferInfoANDROID</type>* <name>pInfo</name></param>
+ <param>struct <type>AHardwareBuffer</type>** <name>pBuffer</name></param>
+ </command>
+ <command queues="graphics" renderpass="inside" cmdbufferlevel="primary,secondary">
+ <proto><type>void</type> <name>vkCmdDrawIndirectCount</name></proto>
+ <param externsync="true"><type>VkCommandBuffer</type> <name>commandBuffer</name></param>
+ <param><type>VkBuffer</type> <name>buffer</name></param>
+ <param><type>VkDeviceSize</type> <name>offset</name></param>
+ <param><type>VkBuffer</type> <name>countBuffer</name></param>
+ <param><type>VkDeviceSize</type> <name>countBufferOffset</name></param>
+ <param><type>uint32_t</type> <name>maxDrawCount</name></param>
+ <param><type>uint32_t</type> <name>stride</name></param>
+ </command>
+ <command name="vkCmdDrawIndirectCountKHR" alias="vkCmdDrawIndirectCount"/>
+ <command name="vkCmdDrawIndirectCountAMD" alias="vkCmdDrawIndirectCount"/>
+ <command queues="graphics" renderpass="inside" cmdbufferlevel="primary,secondary">
+ <proto><type>void</type> <name>vkCmdDrawIndexedIndirectCount</name></proto>
+ <param externsync="true"><type>VkCommandBuffer</type> <name>commandBuffer</name></param>
+ <param><type>VkBuffer</type> <name>buffer</name></param>
+ <param><type>VkDeviceSize</type> <name>offset</name></param>
+ <param><type>VkBuffer</type> <name>countBuffer</name></param>
+ <param><type>VkDeviceSize</type> <name>countBufferOffset</name></param>
+ <param><type>uint32_t</type> <name>maxDrawCount</name></param>
+ <param><type>uint32_t</type> <name>stride</name></param>
+ </command>
+ <command name="vkCmdDrawIndexedIndirectCountKHR" alias="vkCmdDrawIndexedIndirectCount"/>
+ <command name="vkCmdDrawIndexedIndirectCountAMD" alias="vkCmdDrawIndexedIndirectCount"/>
+ <command queues="graphics,compute,transfer" renderpass="both" cmdbufferlevel="primary,secondary">
+ <proto><type>void</type> <name>vkCmdSetCheckpointNV</name></proto>
+ <param externsync="true"><type>VkCommandBuffer</type> <name>commandBuffer</name></param>
+ <param noautovalidity="true">const <type>void</type>* <name>pCheckpointMarker</name></param>
+ </command>
+ <command>
+ <proto><type>void</type> <name>vkGetQueueCheckpointDataNV</name></proto>
+ <param><type>VkQueue</type> <name>queue</name></param>
+ <param optional="false,true"><type>uint32_t</type>* <name>pCheckpointDataCount</name></param>
+ <param optional="true" len="pCheckpointDataCount"><type>VkCheckpointDataNV</type>* <name>pCheckpointData</name></param>
+ </command>
+ <command queues="graphics" renderpass="both" cmdbufferlevel="primary,secondary">
+ <proto><type>void</type> <name>vkCmdBindTransformFeedbackBuffersEXT</name></proto>
+ <param externsync="true"><type>VkCommandBuffer</type> <name>commandBuffer</name></param>
+ <param><type>uint32_t</type> <name>firstBinding</name></param>
+ <param><type>uint32_t</type> <name>bindingCount</name></param>
+ <param len="bindingCount">const <type>VkBuffer</type>* <name>pBuffers</name></param>
+ <param len="bindingCount">const <type>VkDeviceSize</type>* <name>pOffsets</name></param>
+ <param optional="true" len="bindingCount" noautovalidity="true">const <type>VkDeviceSize</type>* <name>pSizes</name></param>
+ </command>
+ <command queues="graphics" renderpass="inside" cmdbufferlevel="primary,secondary">
+ <proto><type>void</type> <name>vkCmdBeginTransformFeedbackEXT</name></proto>
+ <param externsync="true"><type>VkCommandBuffer</type> <name>commandBuffer</name></param>
+ <param><type>uint32_t</type> <name>firstCounterBuffer</name></param>
+ <param optional="true"><type>uint32_t</type> <name>counterBufferCount</name></param>
+ <param noautovalidity="true" len="counterBufferCount">const <type>VkBuffer</type>* <name>pCounterBuffers</name></param>
+ <param optional="true" len="counterBufferCount">const <type>VkDeviceSize</type>* <name>pCounterBufferOffsets</name></param>
+ </command>
+ <command queues="graphics" renderpass="inside" cmdbufferlevel="primary,secondary">
+ <proto><type>void</type> <name>vkCmdEndTransformFeedbackEXT</name></proto>
+ <param externsync="true"><type>VkCommandBuffer</type> <name>commandBuffer</name></param>
+ <param><type>uint32_t</type> <name>firstCounterBuffer</name></param>
+ <param optional="true"><type>uint32_t</type> <name>counterBufferCount</name></param>
+ <param noautovalidity="true" len="counterBufferCount">const <type>VkBuffer</type>* <name>pCounterBuffers</name></param>
+ <param optional="true" len="counterBufferCount">const <type>VkDeviceSize</type>* <name>pCounterBufferOffsets</name></param>
+ </command>
+ <command queues="graphics,compute" renderpass="both" cmdbufferlevel="primary,secondary">
+ <proto><type>void</type> <name>vkCmdBeginQueryIndexedEXT</name></proto>
+ <param externsync="true"><type>VkCommandBuffer</type> <name>commandBuffer</name></param>
+ <param><type>VkQueryPool</type> <name>queryPool</name></param>
+ <param><type>uint32_t</type> <name>query</name></param>
+ <param optional="true"><type>VkQueryControlFlags</type> <name>flags</name></param>
+ <param><type>uint32_t</type> <name>index</name></param>
+ </command>
+ <command queues="graphics,compute" renderpass="both" cmdbufferlevel="primary,secondary">
+ <proto><type>void</type> <name>vkCmdEndQueryIndexedEXT</name></proto>
+ <param externsync="true"><type>VkCommandBuffer</type> <name>commandBuffer</name></param>
+ <param><type>VkQueryPool</type> <name>queryPool</name></param>
+ <param><type>uint32_t</type> <name>query</name></param>
+ <param><type>uint32_t</type> <name>index</name></param>
+ </command>
+ <command queues="graphics" renderpass="inside" cmdbufferlevel="primary,secondary">
+ <proto><type>void</type> <name>vkCmdDrawIndirectByteCountEXT</name></proto>
+ <param externsync="true"><type>VkCommandBuffer</type> <name>commandBuffer</name></param>
+ <param><type>uint32_t</type> <name>instanceCount</name></param>
+ <param><type>uint32_t</type> <name>firstInstance</name></param>
+ <param><type>VkBuffer</type> <name>counterBuffer</name></param>
+ <param><type>VkDeviceSize</type> <name>counterBufferOffset</name></param>
+ <param><type>uint32_t</type> <name>counterOffset</name></param>
+ <param><type>uint32_t</type> <name>vertexStride</name></param>
+ </command>
+ <command queues="graphics" renderpass="both" cmdbufferlevel="primary,secondary">
+ <proto><type>void</type> <name>vkCmdSetExclusiveScissorNV</name></proto>
+ <param externsync="true"><type>VkCommandBuffer</type> <name>commandBuffer</name></param>
+ <param><type>uint32_t</type> <name>firstExclusiveScissor</name></param>
+ <param><type>uint32_t</type> <name>exclusiveScissorCount</name></param>
+ <param len="exclusiveScissorCount">const <type>VkRect2D</type>* <name>pExclusiveScissors</name></param>
+ </command>
+ <command queues="graphics" renderpass="both" cmdbufferlevel="primary,secondary">
+ <proto><type>void</type> <name>vkCmdBindShadingRateImageNV</name></proto>
+ <param externsync="true"><type>VkCommandBuffer</type> <name>commandBuffer</name></param>
+ <param optional="true"><type>VkImageView</type> <name>imageView</name></param>
+ <param><type>VkImageLayout</type> <name>imageLayout</name></param>
+ </command>
+ <command queues="graphics" renderpass="both" cmdbufferlevel="primary,secondary">
+ <proto><type>void</type> <name>vkCmdSetViewportShadingRatePaletteNV</name></proto>
+ <param externsync="true"><type>VkCommandBuffer</type> <name>commandBuffer</name></param>
+ <param><type>uint32_t</type> <name>firstViewport</name></param>
+ <param><type>uint32_t</type> <name>viewportCount</name></param>
+ <param len="viewportCount">const <type>VkShadingRatePaletteNV</type>* <name>pShadingRatePalettes</name></param>
+ </command>
+ <command queues="graphics" renderpass="both" cmdbufferlevel="primary,secondary">
+ <proto><type>void</type> <name>vkCmdSetCoarseSampleOrderNV</name></proto>
+ <param externsync="true"><type>VkCommandBuffer</type> <name>commandBuffer</name></param>
+ <param><type>VkCoarseSampleOrderTypeNV</type> <name>sampleOrderType</name></param>
+ <param optional="true"><type>uint32_t</type> <name>customSampleOrderCount</name></param>
+ <param len="customSampleOrderCount">const <type>VkCoarseSampleOrderCustomNV</type>* <name>pCustomSampleOrders</name></param>
+ </command>
+ <command queues="graphics" renderpass="inside" cmdbufferlevel="primary,secondary">
+ <proto><type>void</type> <name>vkCmdDrawMeshTasksNV</name></proto>
+ <param externsync="true"><type>VkCommandBuffer</type> <name>commandBuffer</name></param>
+ <param><type>uint32_t</type> <name>taskCount</name></param>
+ <param><type>uint32_t</type> <name>firstTask</name></param>
+ </command>
+ <command queues="graphics" renderpass="inside" cmdbufferlevel="primary,secondary">
+ <proto><type>void</type> <name>vkCmdDrawMeshTasksIndirectNV</name></proto>
+ <param externsync="true"><type>VkCommandBuffer</type> <name>commandBuffer</name></param>
+ <param><type>VkBuffer</type> <name>buffer</name></param>
+ <param><type>VkDeviceSize</type> <name>offset</name></param>
+ <param><type>uint32_t</type> <name>drawCount</name></param>
+ <param><type>uint32_t</type> <name>stride</name></param>
+ </command>
+ <command queues="graphics" renderpass="inside" cmdbufferlevel="primary,secondary">
+ <proto><type>void</type> <name>vkCmdDrawMeshTasksIndirectCountNV</name></proto>
+ <param externsync="true"><type>VkCommandBuffer</type> <name>commandBuffer</name></param>
+ <param><type>VkBuffer</type> <name>buffer</name></param>
+ <param><type>VkDeviceSize</type> <name>offset</name></param>
+ <param><type>VkBuffer</type> <name>countBuffer</name></param>
+ <param><type>VkDeviceSize</type> <name>countBufferOffset</name></param>
+ <param><type>uint32_t</type> <name>maxDrawCount</name></param>
+ <param><type>uint32_t</type> <name>stride</name></param>
+ </command>
+ <command successcodes="VK_SUCCESS" errorcodes="VK_ERROR_OUT_OF_HOST_MEMORY,VK_ERROR_OUT_OF_DEVICE_MEMORY">
+ <proto><type>VkResult</type> <name>vkCompileDeferredNV</name></proto>
+ <param><type>VkDevice</type> <name>device</name></param>
+ <param><type>VkPipeline</type> <name>pipeline</name></param>
+ <param><type>uint32_t</type> <name>shader</name></param>
+ </command>
+ <command successcodes="VK_SUCCESS" errorcodes="VK_ERROR_OUT_OF_HOST_MEMORY">
+ <proto><type>VkResult</type> <name>vkCreateAccelerationStructureNV</name></proto>
+ <param><type>VkDevice</type> <name>device</name></param>
+ <param>const <type>VkAccelerationStructureCreateInfoNV</type>* <name>pCreateInfo</name></param>
+ <param optional="true">const <type>VkAllocationCallbacks</type>* <name>pAllocator</name></param>
+ <param><type>VkAccelerationStructureNV</type>* <name>pAccelerationStructure</name></param>
+ </command>
+ <command queues="compute" renderpass="outside" cmdbufferlevel="primary,secondary">
+ <proto><type>void</type> <name>vkCmdBindInvocationMaskHUAWEI</name></proto>
+ <param externsync="true"><type>VkCommandBuffer</type> <name>commandBuffer</name></param>
+ <param optional="true"><type>VkImageView</type> <name>imageView</name></param>
+ <param><type>VkImageLayout</type> <name>imageLayout</name></param>
+ </command>
+ <command>
+ <proto><type>void</type> <name>vkDestroyAccelerationStructureKHR</name></proto>
+ <param><type>VkDevice</type> <name>device</name></param>
+ <param optional="true" externsync="true"><type>VkAccelerationStructureKHR</type> <name>accelerationStructure</name></param>
+ <param optional="true">const <type>VkAllocationCallbacks</type>* <name>pAllocator</name></param>
+ </command>
+ <command>
+ <proto><type>void</type> <name>vkDestroyAccelerationStructureNV</name></proto>
+ <param><type>VkDevice</type> <name>device</name></param>
+ <param optional="true" externsync="true"><type>VkAccelerationStructureNV</type> <name>accelerationStructure</name></param>
+ <param optional="true">const <type>VkAllocationCallbacks</type>* <name>pAllocator</name></param>
+ </command>
+ <command>
+ <proto><type>void</type> <name>vkGetAccelerationStructureMemoryRequirementsNV</name></proto>
+ <param><type>VkDevice</type> <name>device</name></param>
+ <param>const <type>VkAccelerationStructureMemoryRequirementsInfoNV</type>* <name>pInfo</name></param>
+ <param><type>VkMemoryRequirements2KHR</type>* <name>pMemoryRequirements</name></param>
+ </command>
+ <command successcodes="VK_SUCCESS" errorcodes="VK_ERROR_OUT_OF_HOST_MEMORY,VK_ERROR_OUT_OF_DEVICE_MEMORY">
+ <proto><type>VkResult</type> <name>vkBindAccelerationStructureMemoryNV</name></proto>
+ <param><type>VkDevice</type> <name>device</name></param>
+ <param><type>uint32_t</type> <name>bindInfoCount</name></param>
+ <param len="bindInfoCount">const <type>VkBindAccelerationStructureMemoryInfoNV</type>* <name>pBindInfos</name></param>
+ </command>
+ <command queues="compute" renderpass="outside" cmdbufferlevel="primary,secondary">
+ <proto><type>void</type> <name>vkCmdCopyAccelerationStructureNV</name></proto>
+ <param externsync="true"><type>VkCommandBuffer</type> <name>commandBuffer</name></param>
+ <param><type>VkAccelerationStructureNV</type> <name>dst</name></param>
+ <param><type>VkAccelerationStructureNV</type> <name>src</name></param>
+ <param><type>VkCopyAccelerationStructureModeKHR</type> <name>mode</name></param>
+ </command>
+ <command queues="compute" renderpass="outside" cmdbufferlevel="primary,secondary">
+ <proto><type>void</type> <name>vkCmdCopyAccelerationStructureKHR</name></proto>
+ <param externsync="true"><type>VkCommandBuffer</type> <name>commandBuffer</name></param>
+ <param>const <type>VkCopyAccelerationStructureInfoKHR</type>* <name>pInfo</name></param>
+ </command>
+ <command successcodes="VK_SUCCESS,VK_OPERATION_DEFERRED_KHR,VK_OPERATION_NOT_DEFERRED_KHR" errorcodes="VK_ERROR_OUT_OF_HOST_MEMORY,VK_ERROR_OUT_OF_DEVICE_MEMORY">
+ <proto><type>VkResult</type> <name>vkCopyAccelerationStructureKHR</name></proto>
+ <param><type>VkDevice</type> <name>device</name></param>
+ <param optional="true"><type>VkDeferredOperationKHR</type> <name>deferredOperation</name></param>
+ <param>const <type>VkCopyAccelerationStructureInfoKHR</type>* <name>pInfo</name></param>
+ </command>
+ <command queues="compute" renderpass="outside" cmdbufferlevel="primary,secondary">
+ <proto><type>void</type> <name>vkCmdCopyAccelerationStructureToMemoryKHR</name></proto>
+ <param externsync="true"><type>VkCommandBuffer</type> <name>commandBuffer</name></param>
+ <param>const <type>VkCopyAccelerationStructureToMemoryInfoKHR</type>* <name>pInfo</name></param>
+ </command>
+ <command successcodes="VK_SUCCESS,VK_OPERATION_DEFERRED_KHR,VK_OPERATION_NOT_DEFERRED_KHR" errorcodes="VK_ERROR_OUT_OF_HOST_MEMORY,VK_ERROR_OUT_OF_DEVICE_MEMORY">
+ <proto><type>VkResult</type> <name>vkCopyAccelerationStructureToMemoryKHR</name></proto>
+ <param><type>VkDevice</type> <name>device</name></param>
+ <param optional="true"><type>VkDeferredOperationKHR</type> <name>deferredOperation</name></param>
+ <param>const <type>VkCopyAccelerationStructureToMemoryInfoKHR</type>* <name>pInfo</name></param>
+ </command>
+ <command queues="compute" renderpass="outside" cmdbufferlevel="primary,secondary">
+ <proto><type>void</type> <name>vkCmdCopyMemoryToAccelerationStructureKHR</name></proto>
+ <param externsync="true"><type>VkCommandBuffer</type> <name>commandBuffer</name></param>
+ <param>const <type>VkCopyMemoryToAccelerationStructureInfoKHR</type>* <name>pInfo</name></param>
+ </command>
+ <command successcodes="VK_SUCCESS,VK_OPERATION_DEFERRED_KHR,VK_OPERATION_NOT_DEFERRED_KHR" errorcodes="VK_ERROR_OUT_OF_HOST_MEMORY,VK_ERROR_OUT_OF_DEVICE_MEMORY">
+ <proto><type>VkResult</type> <name>vkCopyMemoryToAccelerationStructureKHR</name></proto>
+ <param><type>VkDevice</type> <name>device</name></param>
+ <param optional="true"><type>VkDeferredOperationKHR</type> <name>deferredOperation</name></param>
+ <param>const <type>VkCopyMemoryToAccelerationStructureInfoKHR</type>* <name>pInfo</name></param>
+ </command>
+ <command queues="compute" renderpass="outside" cmdbufferlevel="primary,secondary">
+ <proto><type>void</type> <name>vkCmdWriteAccelerationStructuresPropertiesKHR</name></proto>
+ <param externsync="true"><type>VkCommandBuffer</type> <name>commandBuffer</name></param>
+ <param><type>uint32_t</type> <name>accelerationStructureCount</name></param>
+ <param len="accelerationStructureCount">const <type>VkAccelerationStructureKHR</type>* <name>pAccelerationStructures</name></param>
+ <param><type>VkQueryType</type> <name>queryType</name></param>
+ <param><type>VkQueryPool</type> <name>queryPool</name></param>
+ <param><type>uint32_t</type> <name>firstQuery</name></param>
+ </command>
+ <command queues="compute" renderpass="outside" cmdbufferlevel="primary,secondary">
+ <proto><type>void</type> <name>vkCmdWriteAccelerationStructuresPropertiesNV</name></proto>
+ <param externsync="true"><type>VkCommandBuffer</type> <name>commandBuffer</name></param>
+ <param><type>uint32_t</type> <name>accelerationStructureCount</name></param>
+ <param len="accelerationStructureCount">const <type>VkAccelerationStructureNV</type>* <name>pAccelerationStructures</name></param>
+ <param><type>VkQueryType</type> <name>queryType</name></param>
+ <param><type>VkQueryPool</type> <name>queryPool</name></param>
+ <param><type>uint32_t</type> <name>firstQuery</name></param>
+ </command>
+ <command queues="compute" renderpass="outside" cmdbufferlevel="primary,secondary">
+ <proto><type>void</type> <name>vkCmdBuildAccelerationStructureNV</name></proto>
+ <param externsync="true"><type>VkCommandBuffer</type> <name>commandBuffer</name></param>
+ <param>const <type>VkAccelerationStructureInfoNV</type>* <name>pInfo</name></param>
+ <param optional="true"><type>VkBuffer</type> <name>instanceData</name></param>
+ <param><type>VkDeviceSize</type> <name>instanceOffset</name></param>
+ <param><type>VkBool32</type> <name>update</name></param>
+ <param><type>VkAccelerationStructureNV</type> <name>dst</name></param>
+ <param optional="true"><type>VkAccelerationStructureNV</type> <name>src</name></param>
+ <param><type>VkBuffer</type> <name>scratch</name></param>
+ <param><type>VkDeviceSize</type> <name>scratchOffset</name></param>
+ </command>
+ <command successcodes="VK_SUCCESS" errorcodes="VK_ERROR_OUT_OF_HOST_MEMORY,VK_ERROR_OUT_OF_DEVICE_MEMORY">
+ <proto><type>VkResult</type> <name>vkWriteAccelerationStructuresPropertiesKHR</name></proto>
+ <param><type>VkDevice</type> <name>device</name></param>
+ <param><type>uint32_t</type> <name>accelerationStructureCount</name></param>
+ <param len="accelerationStructureCount">const <type>VkAccelerationStructureKHR</type>* <name>pAccelerationStructures</name></param>
+ <param><type>VkQueryType</type> <name>queryType</name></param>
+ <param><type>size_t</type> <name>dataSize</name></param>
+ <param len="dataSize"><type>void</type>* <name>pData</name></param>
+ <param><type>size_t</type> <name>stride</name></param>
+ </command>
+ <command queues="compute" renderpass="outside" cmdbufferlevel="primary,secondary">
+ <proto><type>void</type> <name>vkCmdTraceRaysKHR</name></proto>
+ <param externsync="true"><type>VkCommandBuffer</type> <name>commandBuffer</name></param>
+ <param>const <type>VkStridedDeviceAddressRegionKHR</type>* <name>pRaygenShaderBindingTable</name></param>
+ <param>const <type>VkStridedDeviceAddressRegionKHR</type>* <name>pMissShaderBindingTable</name></param>
+ <param>const <type>VkStridedDeviceAddressRegionKHR</type>* <name>pHitShaderBindingTable</name></param>
+ <param>const <type>VkStridedDeviceAddressRegionKHR</type>* <name>pCallableShaderBindingTable</name></param>
+ <param><type>uint32_t</type> <name>width</name></param>
+ <param><type>uint32_t</type> <name>height</name></param>
+ <param><type>uint32_t</type> <name>depth</name></param>
+ </command>
+ <command queues="compute" renderpass="outside" cmdbufferlevel="primary,secondary">
+ <proto><type>void</type> <name>vkCmdTraceRaysNV</name></proto>
+ <param externsync="true"><type>VkCommandBuffer</type> <name>commandBuffer</name></param>
+ <param><type>VkBuffer</type> <name>raygenShaderBindingTableBuffer</name></param>
+ <param><type>VkDeviceSize</type> <name>raygenShaderBindingOffset</name></param>
+ <param optional="true"><type>VkBuffer</type> <name>missShaderBindingTableBuffer</name></param>
+ <param><type>VkDeviceSize</type> <name>missShaderBindingOffset</name></param>
+ <param><type>VkDeviceSize</type> <name>missShaderBindingStride</name></param>
+ <param optional="true"><type>VkBuffer</type> <name>hitShaderBindingTableBuffer</name></param>
+ <param><type>VkDeviceSize</type> <name>hitShaderBindingOffset</name></param>
+ <param><type>VkDeviceSize</type> <name>hitShaderBindingStride</name></param>
+ <param optional="true"><type>VkBuffer</type> <name>callableShaderBindingTableBuffer</name></param>
+ <param><type>VkDeviceSize</type> <name>callableShaderBindingOffset</name></param>
+ <param><type>VkDeviceSize</type> <name>callableShaderBindingStride</name></param>
+ <param><type>uint32_t</type> <name>width</name></param>
+ <param><type>uint32_t</type> <name>height</name></param>
+ <param><type>uint32_t</type> <name>depth</name></param>
+ </command>
+ <command successcodes="VK_SUCCESS" errorcodes="VK_ERROR_OUT_OF_HOST_MEMORY,VK_ERROR_OUT_OF_DEVICE_MEMORY">
+ <proto><type>VkResult</type> <name>vkGetRayTracingShaderGroupHandlesKHR</name></proto>
+ <param><type>VkDevice</type> <name>device</name></param>
+ <param><type>VkPipeline</type> <name>pipeline</name></param>
+ <param><type>uint32_t</type> <name>firstGroup</name></param>
+ <param><type>uint32_t</type> <name>groupCount</name></param>
+ <param><type>size_t</type> <name>dataSize</name></param>
+ <param len="dataSize"><type>void</type>* <name>pData</name></param>
+ </command>
+ <command name="vkGetRayTracingShaderGroupHandlesNV" alias="vkGetRayTracingShaderGroupHandlesKHR"/>
+ <command successcodes="VK_SUCCESS" errorcodes="VK_ERROR_OUT_OF_HOST_MEMORY,VK_ERROR_OUT_OF_DEVICE_MEMORY">
+ <proto><type>VkResult</type> <name>vkGetRayTracingCaptureReplayShaderGroupHandlesKHR</name></proto>
+ <param><type>VkDevice</type> <name>device</name></param>
+ <param><type>VkPipeline</type> <name>pipeline</name></param>
+ <param><type>uint32_t</type> <name>firstGroup</name></param>
+ <param><type>uint32_t</type> <name>groupCount</name></param>
+ <param><type>size_t</type> <name>dataSize</name></param>
+ <param len="dataSize"><type>void</type>* <name>pData</name></param>
+ </command>
+ <command successcodes="VK_SUCCESS" errorcodes="VK_ERROR_OUT_OF_HOST_MEMORY,VK_ERROR_OUT_OF_DEVICE_MEMORY">
+ <proto><type>VkResult</type> <name>vkGetAccelerationStructureHandleNV</name></proto>
+ <param><type>VkDevice</type> <name>device</name></param>
+ <param><type>VkAccelerationStructureNV</type> <name>accelerationStructure</name></param>
+ <param><type>size_t</type> <name>dataSize</name></param>
+ <param len="dataSize"><type>void</type>* <name>pData</name></param>
+ </command>
+ <command successcodes="VK_SUCCESS,VK_PIPELINE_COMPILE_REQUIRED_EXT" errorcodes="VK_ERROR_OUT_OF_HOST_MEMORY,VK_ERROR_OUT_OF_DEVICE_MEMORY,VK_ERROR_INVALID_SHADER_NV">
+ <proto><type>VkResult</type> <name>vkCreateRayTracingPipelinesNV</name></proto>
+ <param><type>VkDevice</type> <name>device</name></param>
+ <param optional="true"><type>VkPipelineCache</type> <name>pipelineCache</name></param>
+ <param><type>uint32_t</type> <name>createInfoCount</name></param>
+ <param len="createInfoCount">const <type>VkRayTracingPipelineCreateInfoNV</type>* <name>pCreateInfos</name></param>
+ <param optional="true">const <type>VkAllocationCallbacks</type>* <name>pAllocator</name></param>
+ <param len="createInfoCount"><type>VkPipeline</type>* <name>pPipelines</name></param>
+ </command>
+ <command successcodes="VK_SUCCESS,VK_OPERATION_DEFERRED_KHR,VK_OPERATION_NOT_DEFERRED_KHR,VK_PIPELINE_COMPILE_REQUIRED_EXT" errorcodes="VK_ERROR_OUT_OF_HOST_MEMORY,VK_ERROR_OUT_OF_DEVICE_MEMORY,VK_ERROR_INVALID_OPAQUE_CAPTURE_ADDRESS">
+ <proto><type>VkResult</type> <name>vkCreateRayTracingPipelinesKHR</name></proto>
+ <param><type>VkDevice</type> <name>device</name></param>
+ <param optional="true"><type>VkDeferredOperationKHR</type> <name>deferredOperation</name></param>
+ <param optional="true"><type>VkPipelineCache</type> <name>pipelineCache</name></param>
+ <param><type>uint32_t</type> <name>createInfoCount</name></param>
+ <param len="createInfoCount">const <type>VkRayTracingPipelineCreateInfoKHR</type>* <name>pCreateInfos</name></param>
+ <param optional="true">const <type>VkAllocationCallbacks</type>* <name>pAllocator</name></param>
+ <param len="createInfoCount"><type>VkPipeline</type>* <name>pPipelines</name></param>
+ </command>
+ <command successcodes="VK_SUCCESS,VK_INCOMPLETE" errorcodes="VK_ERROR_OUT_OF_HOST_MEMORY,VK_ERROR_OUT_OF_DEVICE_MEMORY">
+ <proto><type>VkResult</type> <name>vkGetPhysicalDeviceCooperativeMatrixPropertiesNV</name></proto>
+ <param><type>VkPhysicalDevice</type> <name>physicalDevice</name></param>
+ <param optional="false,true"><type>uint32_t</type>* <name>pPropertyCount</name></param>
+ <param optional="true" len="pPropertyCount"><type>VkCooperativeMatrixPropertiesNV</type>* <name>pProperties</name></param>
+ </command>
+ <command queues="compute" renderpass="outside" cmdbufferlevel="primary,secondary">
+ <proto><type>void</type> <name>vkCmdTraceRaysIndirectKHR</name></proto>
+ <param externsync="true"><type>VkCommandBuffer</type> <name>commandBuffer</name></param>
+ <param>const <type>VkStridedDeviceAddressRegionKHR</type>* <name>pRaygenShaderBindingTable</name></param>
+ <param>const <type>VkStridedDeviceAddressRegionKHR</type>* <name>pMissShaderBindingTable</name></param>
+ <param>const <type>VkStridedDeviceAddressRegionKHR</type>* <name>pHitShaderBindingTable</name></param>
+ <param>const <type>VkStridedDeviceAddressRegionKHR</type>* <name>pCallableShaderBindingTable</name></param>
+ <param><type>VkDeviceAddress</type> <name>indirectDeviceAddress</name></param>
+ </command>
+ <command queues="compute" renderpass="outside" cmdbufferlevel="primary,secondary">
+ <proto><type>void</type> <name>vkCmdTraceRaysIndirect2KHR</name></proto>
+ <param externsync="true"><type>VkCommandBuffer</type> <name>commandBuffer</name></param>
+ <param><type>VkDeviceAddress</type> <name>indirectDeviceAddress</name></param>
+ </command>
+ <command>
+ <proto><type>void</type> <name>vkGetDeviceAccelerationStructureCompatibilityKHR</name></proto>
+ <param><type>VkDevice</type> <name>device</name></param>
+ <param>const <type>VkAccelerationStructureVersionInfoKHR</type>* <name>pVersionInfo</name></param>
+ <param><type>VkAccelerationStructureCompatibilityKHR</type>* <name>pCompatibility</name></param>
+ </command>
+ <command>
+ <proto><type>VkDeviceSize</type> <name>vkGetRayTracingShaderGroupStackSizeKHR</name></proto>
+ <param><type>VkDevice</type> <name>device</name></param>
+ <param><type>VkPipeline</type> <name>pipeline</name></param>
+ <param><type>uint32_t</type> <name>group</name></param>
+ <param><type>VkShaderGroupShaderKHR</type> <name>groupShader</name></param>
+ </command>
+ <command queues="compute" renderpass="outside" cmdbufferlevel="primary,secondary">
+ <proto><type>void</type> <name>vkCmdSetRayTracingPipelineStackSizeKHR</name></proto>
+ <param externsync="true"><type>VkCommandBuffer</type> <name>commandBuffer</name></param>
+ <param><type>uint32_t</type> <name>pipelineStackSize</name></param>
+ </command>
+ <command>
+ <proto><type>uint32_t</type> <name>vkGetImageViewHandleNVX</name></proto>
+ <param><type>VkDevice</type> <name>device</name></param>
+ <param>const <type>VkImageViewHandleInfoNVX</type>* <name>pInfo</name></param>
+ </command>
+ <command successcodes="VK_SUCCESS" errorcodes="VK_ERROR_OUT_OF_HOST_MEMORY,VK_ERROR_UNKNOWN">
+ <proto><type>VkResult</type> <name>vkGetImageViewAddressNVX</name></proto>
+ <param><type>VkDevice</type> <name>device</name></param>
+ <param><type>VkImageView</type> <name>imageView</name></param>
+ <param><type>VkImageViewAddressPropertiesNVX</type>* <name>pProperties</name></param>
+ </command>
+ <command successcodes="VK_SUCCESS,VK_INCOMPLETE" errorcodes="VK_ERROR_OUT_OF_HOST_MEMORY,VK_ERROR_OUT_OF_DEVICE_MEMORY,VK_ERROR_SURFACE_LOST_KHR">
+ <proto><type>VkResult</type> <name>vkGetPhysicalDeviceSurfacePresentModes2EXT</name></proto>
+ <param><type>VkPhysicalDevice</type> <name>physicalDevice</name></param>
+ <param>const <type>VkPhysicalDeviceSurfaceInfo2KHR</type>* <name>pSurfaceInfo</name></param>
+ <param optional="false,true"><type>uint32_t</type>* <name>pPresentModeCount</name></param>
+ <param optional="true" len="pPresentModeCount"><type>VkPresentModeKHR</type>* <name>pPresentModes</name></param>
+ </command>
+ <command successcodes="VK_SUCCESS" errorcodes="VK_ERROR_OUT_OF_HOST_MEMORY,VK_ERROR_OUT_OF_DEVICE_MEMORY,VK_ERROR_SURFACE_LOST_KHR">
+ <proto><type>VkResult</type> <name>vkGetDeviceGroupSurfacePresentModes2EXT</name></proto>
+ <param><type>VkDevice</type> <name>device</name></param>
+ <param>const <type>VkPhysicalDeviceSurfaceInfo2KHR</type>* <name>pSurfaceInfo</name></param>
+ <param optional="false,true"><type>VkDeviceGroupPresentModeFlagsKHR</type>* <name>pModes</name></param>
+ </command>
+ <command successcodes="VK_SUCCESS" errorcodes="VK_ERROR_OUT_OF_HOST_MEMORY,VK_ERROR_OUT_OF_DEVICE_MEMORY,VK_ERROR_INITIALIZATION_FAILED,VK_ERROR_SURFACE_LOST_KHR">
+ <proto><type>VkResult</type> <name>vkAcquireFullScreenExclusiveModeEXT</name></proto>
+ <param><type>VkDevice</type> <name>device</name></param>
+ <param><type>VkSwapchainKHR</type> <name>swapchain</name></param>
+ </command>
+ <command successcodes="VK_SUCCESS" errorcodes="VK_ERROR_OUT_OF_HOST_MEMORY,VK_ERROR_OUT_OF_DEVICE_MEMORY,VK_ERROR_SURFACE_LOST_KHR">
+ <proto><type>VkResult</type> <name>vkReleaseFullScreenExclusiveModeEXT</name></proto>
+ <param><type>VkDevice</type> <name>device</name></param>
+ <param><type>VkSwapchainKHR</type> <name>swapchain</name></param>
+ </command>
+ <command successcodes="VK_SUCCESS,VK_INCOMPLETE" errorcodes="VK_ERROR_OUT_OF_HOST_MEMORY,VK_ERROR_OUT_OF_DEVICE_MEMORY,VK_ERROR_INITIALIZATION_FAILED">
+ <proto><type>VkResult</type> <name>vkEnumeratePhysicalDeviceQueueFamilyPerformanceQueryCountersKHR</name></proto>
+ <param><type>VkPhysicalDevice</type> <name>physicalDevice</name></param>
+ <param><type>uint32_t</type> <name>queueFamilyIndex</name></param>
+ <param optional="false,true"><type>uint32_t</type>* <name>pCounterCount</name></param>
+ <param optional="true" len="pCounterCount"><type>VkPerformanceCounterKHR</type>* <name>pCounters</name></param>
+ <param optional="true" len="pCounterCount"><type>VkPerformanceCounterDescriptionKHR</type>* <name>pCounterDescriptions</name></param>
+ </command>
+ <command>
+ <proto><type>void</type> <name>vkGetPhysicalDeviceQueueFamilyPerformanceQueryPassesKHR</name></proto>
+ <param><type>VkPhysicalDevice</type> <name>physicalDevice</name></param>
+ <param>const <type>VkQueryPoolPerformanceCreateInfoKHR</type>* <name>pPerformanceQueryCreateInfo</name></param>
+ <param><type>uint32_t</type>* <name>pNumPasses</name></param>
+ </command>
+ <command successcodes="VK_SUCCESS" errorcodes="VK_ERROR_OUT_OF_HOST_MEMORY,VK_TIMEOUT">
+ <proto><type>VkResult</type> <name>vkAcquireProfilingLockKHR</name></proto>
+ <param><type>VkDevice</type> <name>device</name></param>
+ <param>const <type>VkAcquireProfilingLockInfoKHR</type>* <name>pInfo</name></param>
+ </command>
+ <command>
+ <proto><type>void</type> <name>vkReleaseProfilingLockKHR</name></proto>
+ <param><type>VkDevice</type> <name>device</name></param>
+ </command>
+ <command successcodes="VK_SUCCESS" errorcodes="VK_ERROR_OUT_OF_HOST_MEMORY">
+ <proto><type>VkResult</type> <name>vkGetImageDrmFormatModifierPropertiesEXT</name></proto>
+ <param><type>VkDevice</type> <name>device</name></param>
+ <param><type>VkImage</type> <name>image</name></param>
+ <param><type>VkImageDrmFormatModifierPropertiesEXT</type>* <name>pProperties</name></param>
+ </command>
+ <command>
+ <proto><type>uint64_t</type> <name>vkGetBufferOpaqueCaptureAddress</name></proto>
+ <param><type>VkDevice</type> <name>device</name></param>
+ <param>const <type>VkBufferDeviceAddressInfo</type>* <name>pInfo</name></param>
+ </command>
+ <command name="vkGetBufferOpaqueCaptureAddressKHR" alias="vkGetBufferOpaqueCaptureAddress"/>
+ <command>
+ <proto><type>VkDeviceAddress</type> <name>vkGetBufferDeviceAddress</name></proto>
+ <param><type>VkDevice</type> <name>device</name></param>
+ <param>const <type>VkBufferDeviceAddressInfo</type>* <name>pInfo</name></param>
+ </command>
+ <command name="vkGetBufferDeviceAddressKHR" alias="vkGetBufferDeviceAddress"/>
+ <command name="vkGetBufferDeviceAddressEXT" alias="vkGetBufferDeviceAddress"/>
+ <command successcodes="VK_SUCCESS" errorcodes="VK_ERROR_OUT_OF_HOST_MEMORY,VK_ERROR_OUT_OF_DEVICE_MEMORY">
+ <proto><type>VkResult</type> <name>vkCreateHeadlessSurfaceEXT</name></proto>
+ <param><type>VkInstance</type> <name>instance</name></param>
+ <param>const <type>VkHeadlessSurfaceCreateInfoEXT</type>* <name>pCreateInfo</name></param>
+ <param optional="true">const <type>VkAllocationCallbacks</type>* <name>pAllocator</name></param>
+ <param><type>VkSurfaceKHR</type>* <name>pSurface</name></param>
+ </command>
+ <command successcodes="VK_SUCCESS,VK_INCOMPLETE" errorcodes="VK_ERROR_OUT_OF_HOST_MEMORY,VK_ERROR_OUT_OF_DEVICE_MEMORY">
+ <proto><type>VkResult</type> <name>vkGetPhysicalDeviceSupportedFramebufferMixedSamplesCombinationsNV</name></proto>
+ <param><type>VkPhysicalDevice</type> <name>physicalDevice</name></param>
+ <param optional="false,true"><type>uint32_t</type>* <name>pCombinationCount</name></param>
+ <param optional="true" len="pCombinationCount"><type>VkFramebufferMixedSamplesCombinationNV</type>* <name>pCombinations</name></param>
+ </command>
+ <command successcodes="VK_SUCCESS" errorcodes="VK_ERROR_TOO_MANY_OBJECTS,VK_ERROR_OUT_OF_HOST_MEMORY">
+ <proto><type>VkResult</type> <name>vkInitializePerformanceApiINTEL</name></proto>
+ <param><type>VkDevice</type> <name>device</name></param>
+ <param>const <type>VkInitializePerformanceApiInfoINTEL</type>* <name>pInitializeInfo</name></param>
+ </command>
+ <command>
+ <proto><type>void</type> <name>vkUninitializePerformanceApiINTEL</name></proto>
+ <param><type>VkDevice</type> <name>device</name></param>
+ </command>
+ <command queues="graphics,compute,transfer" renderpass="both" cmdbufferlevel="primary,secondary" successcodes="VK_SUCCESS" errorcodes="VK_ERROR_TOO_MANY_OBJECTS,VK_ERROR_OUT_OF_HOST_MEMORY">
+ <proto><type>VkResult</type> <name>vkCmdSetPerformanceMarkerINTEL</name></proto>
+ <param externsync="true"><type>VkCommandBuffer</type> <name>commandBuffer</name></param>
+ <param>const <type>VkPerformanceMarkerInfoINTEL</type>* <name>pMarkerInfo</name></param>
+ </command>
+ <command queues="graphics,compute,transfer" renderpass="both" cmdbufferlevel="primary,secondary" successcodes="VK_SUCCESS" errorcodes="VK_ERROR_TOO_MANY_OBJECTS,VK_ERROR_OUT_OF_HOST_MEMORY">
+ <proto><type>VkResult</type> <name>vkCmdSetPerformanceStreamMarkerINTEL</name></proto>
+ <param externsync="true"><type>VkCommandBuffer</type> <name>commandBuffer</name></param>
+ <param>const <type>VkPerformanceStreamMarkerInfoINTEL</type>* <name>pMarkerInfo</name></param>
+ </command>
+ <command queues="graphics,compute,transfer" renderpass="both" cmdbufferlevel="primary,secondary" successcodes="VK_SUCCESS" errorcodes="VK_ERROR_TOO_MANY_OBJECTS,VK_ERROR_OUT_OF_HOST_MEMORY">
+ <proto><type>VkResult</type> <name>vkCmdSetPerformanceOverrideINTEL</name></proto>
+ <param externsync="true"><type>VkCommandBuffer</type> <name>commandBuffer</name></param>
+ <param>const <type>VkPerformanceOverrideInfoINTEL</type>* <name>pOverrideInfo</name></param>
+ </command>
+ <command successcodes="VK_SUCCESS" errorcodes="VK_ERROR_TOO_MANY_OBJECTS,VK_ERROR_OUT_OF_HOST_MEMORY">
+ <proto><type>VkResult</type> <name>vkAcquirePerformanceConfigurationINTEL</name></proto>
+ <param><type>VkDevice</type> <name>device</name></param>
+ <param>const <type>VkPerformanceConfigurationAcquireInfoINTEL</type>* <name>pAcquireInfo</name></param>
+ <param><type>VkPerformanceConfigurationINTEL</type>* <name>pConfiguration</name></param>
+ </command>
+ <command successcodes="VK_SUCCESS" errorcodes="VK_ERROR_TOO_MANY_OBJECTS,VK_ERROR_OUT_OF_HOST_MEMORY">
+ <proto><type>VkResult</type> <name>vkReleasePerformanceConfigurationINTEL</name></proto>
+ <param><type>VkDevice</type> <name>device</name></param>
+ <param optional="true" externsync="true"><type>VkPerformanceConfigurationINTEL</type> <name>configuration</name></param>
+ </command>
+ <command successcodes="VK_SUCCESS" errorcodes="VK_ERROR_TOO_MANY_OBJECTS,VK_ERROR_OUT_OF_HOST_MEMORY">
+ <proto><type>VkResult</type> <name>vkQueueSetPerformanceConfigurationINTEL</name></proto>
+ <param><type>VkQueue</type> <name>queue</name></param>
+ <param><type>VkPerformanceConfigurationINTEL</type> <name>configuration</name></param>
+ </command>
+ <command successcodes="VK_SUCCESS" errorcodes="VK_ERROR_TOO_MANY_OBJECTS,VK_ERROR_OUT_OF_HOST_MEMORY">
+ <proto><type>VkResult</type> <name>vkGetPerformanceParameterINTEL</name></proto>
+ <param><type>VkDevice</type> <name>device</name></param>
+ <param><type>VkPerformanceParameterTypeINTEL</type> <name>parameter</name></param>
+ <param><type>VkPerformanceValueINTEL</type>* <name>pValue</name></param>
+ </command>
+ <command>
+ <proto><type>uint64_t</type> <name>vkGetDeviceMemoryOpaqueCaptureAddress</name></proto>
+ <param><type>VkDevice</type> <name>device</name></param>
+ <param>const <type>VkDeviceMemoryOpaqueCaptureAddressInfo</type>* <name>pInfo</name></param>
+ </command>
+ <command name="vkGetDeviceMemoryOpaqueCaptureAddressKHR" alias="vkGetDeviceMemoryOpaqueCaptureAddress"/>
+ <command successcodes="VK_SUCCESS,VK_INCOMPLETE" errorcodes="VK_ERROR_OUT_OF_HOST_MEMORY,VK_ERROR_OUT_OF_DEVICE_MEMORY">
+ <proto><type>VkResult</type> <name>vkGetPipelineExecutablePropertiesKHR</name></proto>
+ <param><type>VkDevice</type> <name>device</name></param>
+ <param>const <type>VkPipelineInfoKHR</type>* <name>pPipelineInfo</name></param>
+ <param optional="false,true"><type>uint32_t</type>* <name>pExecutableCount</name></param>
+ <param optional="true" len="pExecutableCount"><type>VkPipelineExecutablePropertiesKHR</type>* <name>pProperties</name></param>
+ </command>
+ <command successcodes="VK_SUCCESS,VK_INCOMPLETE" errorcodes="VK_ERROR_OUT_OF_HOST_MEMORY,VK_ERROR_OUT_OF_DEVICE_MEMORY">
+ <proto><type>VkResult</type> <name>vkGetPipelineExecutableStatisticsKHR</name></proto>
+ <param><type>VkDevice</type> <name>device</name></param>
+ <param>const <type>VkPipelineExecutableInfoKHR</type>* <name>pExecutableInfo</name></param>
+ <param optional="false,true"><type>uint32_t</type>* <name>pStatisticCount</name></param>
+ <param optional="true" len="pStatisticCount"><type>VkPipelineExecutableStatisticKHR</type>* <name>pStatistics</name></param>
+ </command>
+ <command successcodes="VK_SUCCESS,VK_INCOMPLETE" errorcodes="VK_ERROR_OUT_OF_HOST_MEMORY,VK_ERROR_OUT_OF_DEVICE_MEMORY">
+ <proto><type>VkResult</type> <name>vkGetPipelineExecutableInternalRepresentationsKHR</name></proto>
+ <param><type>VkDevice</type> <name>device</name></param>
+ <param>const <type>VkPipelineExecutableInfoKHR</type>* <name>pExecutableInfo</name></param>
+ <param optional="false,true"><type>uint32_t</type>* <name>pInternalRepresentationCount</name></param>
+ <param optional="true" len="pInternalRepresentationCount"><type>VkPipelineExecutableInternalRepresentationKHR</type>* <name>pInternalRepresentations</name></param>
+ </command>
+ <command queues="graphics" renderpass="both" cmdbufferlevel="primary,secondary">
+ <proto><type>void</type> <name>vkCmdSetLineStippleEXT</name></proto>
+ <param externsync="true"><type>VkCommandBuffer</type> <name>commandBuffer</name></param>
+ <param><type>uint32_t</type> <name>lineStippleFactor</name></param>
+ <param><type>uint16_t</type> <name>lineStipplePattern</name></param>
+ </command>
+ <command successcodes="VK_SUCCESS,VK_INCOMPLETE" errorcodes="VK_ERROR_OUT_OF_HOST_MEMORY">
+ <proto><type>VkResult</type> <name>vkGetPhysicalDeviceToolProperties</name></proto>
+ <param><type>VkPhysicalDevice</type> <name>physicalDevice</name></param>
+ <param optional="false,true"><type>uint32_t</type>* <name>pToolCount</name></param>
+ <param optional="true" len="pToolCount"><type>VkPhysicalDeviceToolProperties</type>* <name>pToolProperties</name></param>
+ </command>
+ <command name="vkGetPhysicalDeviceToolPropertiesEXT" alias="vkGetPhysicalDeviceToolProperties"/>
+ <command successcodes="VK_SUCCESS" errorcodes="VK_ERROR_OUT_OF_HOST_MEMORY,VK_ERROR_INVALID_OPAQUE_CAPTURE_ADDRESS_KHR">
+ <proto><type>VkResult</type> <name>vkCreateAccelerationStructureKHR</name></proto>
+ <param><type>VkDevice</type> <name>device</name></param>
+ <param>const <type>VkAccelerationStructureCreateInfoKHR</type>* <name>pCreateInfo</name></param>
+ <param optional="true">const <type>VkAllocationCallbacks</type>* <name>pAllocator</name></param>
+ <param><type>VkAccelerationStructureKHR</type>* <name>pAccelerationStructure</name></param>
+ </command>
+ <command queues="compute" renderpass="outside" cmdbufferlevel="primary,secondary">
+ <proto><type>void</type> <name>vkCmdBuildAccelerationStructuresKHR</name></proto>
+ <param externsync="true"><type>VkCommandBuffer</type> <name>commandBuffer</name></param>
+ <param><type>uint32_t</type> <name>infoCount</name></param>
+ <param len="infoCount">const <type>VkAccelerationStructureBuildGeometryInfoKHR</type>* <name>pInfos</name></param>
+ <param len="infoCount">const <type>VkAccelerationStructureBuildRangeInfoKHR</type>* const* <name>ppBuildRangeInfos</name></param>
+ </command>
+ <command queues="compute" renderpass="outside" cmdbufferlevel="primary,secondary">
+ <proto><type>void</type> <name>vkCmdBuildAccelerationStructuresIndirectKHR</name></proto>
+ <param externsync="true"><type>VkCommandBuffer</type> <name>commandBuffer</name></param>
+ <param><type>uint32_t</type> <name>infoCount</name></param>
+ <param len="infoCount">const <type>VkAccelerationStructureBuildGeometryInfoKHR</type>* <name>pInfos</name></param>
+ <param len="infoCount">const <type>VkDeviceAddress</type>* <name>pIndirectDeviceAddresses</name></param>
+ <param len="infoCount">const <type>uint32_t</type>* <name>pIndirectStrides</name></param>
+ <param len="infoCount">const <type>uint32_t</type>* const* <name>ppMaxPrimitiveCounts</name></param>
+ </command>
+ <command successcodes="VK_SUCCESS,VK_OPERATION_DEFERRED_KHR,VK_OPERATION_NOT_DEFERRED_KHR" errorcodes="VK_ERROR_OUT_OF_HOST_MEMORY,VK_ERROR_OUT_OF_DEVICE_MEMORY">
+ <proto><type>VkResult</type> <name>vkBuildAccelerationStructuresKHR</name></proto>
+ <param><type>VkDevice</type> <name>device</name></param>
+ <param optional="true"><type>VkDeferredOperationKHR</type> <name>deferredOperation</name></param>
+ <param><type>uint32_t</type> <name>infoCount</name></param>
+ <param len="infoCount">const <type>VkAccelerationStructureBuildGeometryInfoKHR</type>* <name>pInfos</name></param>
+ <param len="infoCount">const <type>VkAccelerationStructureBuildRangeInfoKHR</type>* const* <name>ppBuildRangeInfos</name></param>
+ </command>
+ <command>
+ <proto><type>VkDeviceAddress</type> <name>vkGetAccelerationStructureDeviceAddressKHR</name></proto>
+ <param><type>VkDevice</type> <name>device</name></param>
+ <param>const <type>VkAccelerationStructureDeviceAddressInfoKHR</type>* <name>pInfo</name></param>
+ </command>
+ <command successcodes="VK_SUCCESS" errorcodes="VK_ERROR_OUT_OF_HOST_MEMORY">
+ <proto><type>VkResult</type> <name>vkCreateDeferredOperationKHR</name></proto>
+ <param><type>VkDevice</type> <name>device</name></param>
+ <param optional="true">const <type>VkAllocationCallbacks</type>* <name>pAllocator</name></param>
+ <param><type>VkDeferredOperationKHR</type>* <name>pDeferredOperation</name></param>
+ </command>
+ <command>
+ <proto><type>void</type> <name>vkDestroyDeferredOperationKHR</name></proto>
+ <param><type>VkDevice</type> <name>device</name></param>
+ <param optional="true" externsync="true"><type>VkDeferredOperationKHR</type> <name>operation</name></param>
+ <param optional="true">const <type>VkAllocationCallbacks</type>* <name>pAllocator</name></param>
+ </command>
+ <command>
+ <proto><type>uint32_t</type> <name>vkGetDeferredOperationMaxConcurrencyKHR</name></proto>
+ <param><type>VkDevice</type> <name>device</name></param>
+ <param><type>VkDeferredOperationKHR</type> <name>operation</name></param>
+ </command>
+ <command successcodes="VK_SUCCESS,VK_NOT_READY">
+ <proto><type>VkResult</type> <name>vkGetDeferredOperationResultKHR</name></proto>
+ <param><type>VkDevice</type> <name>device</name></param>
+ <param><type>VkDeferredOperationKHR</type> <name>operation</name></param>
+ </command>
+ <command successcodes="VK_SUCCESS,VK_THREAD_DONE_KHR,VK_THREAD_IDLE_KHR" errorcodes="VK_ERROR_OUT_OF_HOST_MEMORY,VK_ERROR_OUT_OF_DEVICE_MEMORY">
+ <proto><type>VkResult</type> <name>vkDeferredOperationJoinKHR</name></proto>
+ <param><type>VkDevice</type> <name>device</name></param>
+ <param><type>VkDeferredOperationKHR</type> <name>operation</name></param>
+ </command>
+ <command queues="graphics" renderpass="both" cmdbufferlevel="primary,secondary">
+ <proto><type>void</type> <name>vkCmdSetCullMode</name></proto>
+ <param externsync="true"><type>VkCommandBuffer</type> <name>commandBuffer</name></param>
+ <param optional="true"><type>VkCullModeFlags</type> <name>cullMode</name></param>
+ </command>
+ <command name="vkCmdSetCullModeEXT" alias="vkCmdSetCullMode"/>
+ <command queues="graphics" renderpass="both" cmdbufferlevel="primary,secondary">
+ <proto><type>void</type> <name>vkCmdSetFrontFace</name></proto>
+ <param externsync="true"><type>VkCommandBuffer</type> <name>commandBuffer</name></param>
+ <param><type>VkFrontFace</type> <name>frontFace</name></param>
+ </command>
+ <command name="vkCmdSetFrontFaceEXT" alias="vkCmdSetFrontFace"/>
+ <command queues="graphics" renderpass="both" cmdbufferlevel="primary,secondary">
+ <proto><type>void</type> <name>vkCmdSetPrimitiveTopology</name></proto>
+ <param externsync="true"><type>VkCommandBuffer</type> <name>commandBuffer</name></param>
+ <param><type>VkPrimitiveTopology</type> <name>primitiveTopology</name></param>
+ </command>
+ <command name="vkCmdSetPrimitiveTopologyEXT" alias="vkCmdSetPrimitiveTopology"/>
+ <command queues="graphics" renderpass="both" cmdbufferlevel="primary,secondary">
+ <proto><type>void</type> <name>vkCmdSetViewportWithCount</name></proto>
+ <param externsync="true"><type>VkCommandBuffer</type> <name>commandBuffer</name></param>
+ <param><type>uint32_t</type> <name>viewportCount</name></param>
+ <param len="viewportCount">const <type>VkViewport</type>* <name>pViewports</name></param>
+ </command>
+ <command name="vkCmdSetViewportWithCountEXT" alias="vkCmdSetViewportWithCount"/>
+ <command queues="graphics" renderpass="both" cmdbufferlevel="primary,secondary">
+ <proto><type>void</type> <name>vkCmdSetScissorWithCount</name></proto>
+ <param externsync="true"><type>VkCommandBuffer</type> <name>commandBuffer</name></param>
+ <param><type>uint32_t</type> <name>scissorCount</name></param>
+ <param len="scissorCount">const <type>VkRect2D</type>* <name>pScissors</name></param>
+ </command>
+ <command name="vkCmdSetScissorWithCountEXT" alias="vkCmdSetScissorWithCount"/>
+ <command queues="graphics" renderpass="both" cmdbufferlevel="primary,secondary">
+ <proto><type>void</type> <name>vkCmdBindVertexBuffers2</name></proto>
+ <param externsync="true"><type>VkCommandBuffer</type> <name>commandBuffer</name></param>
+ <param><type>uint32_t</type> <name>firstBinding</name></param>
+ <param><type>uint32_t</type> <name>bindingCount</name></param>
+ <param len="bindingCount" optional="false,true">const <type>VkBuffer</type>* <name>pBuffers</name></param>
+ <param len="bindingCount">const <type>VkDeviceSize</type>* <name>pOffsets</name></param>
+ <param optional="true" len="bindingCount">const <type>VkDeviceSize</type>* <name>pSizes</name></param>
+ <param optional="true" len="bindingCount">const <type>VkDeviceSize</type>* <name>pStrides</name></param>
+ </command>
+ <command name="vkCmdBindVertexBuffers2EXT" alias="vkCmdBindVertexBuffers2"/>
+ <command queues="graphics" renderpass="both" cmdbufferlevel="primary,secondary">
+ <proto><type>void</type> <name>vkCmdSetDepthTestEnable</name></proto>
+ <param externsync="true"><type>VkCommandBuffer</type> <name>commandBuffer</name></param>
+ <param><type>VkBool32</type> <name>depthTestEnable</name></param>
+ </command>
+ <command name="vkCmdSetDepthTestEnableEXT" alias="vkCmdSetDepthTestEnable"/>
+ <command queues="graphics" renderpass="both" cmdbufferlevel="primary,secondary">
+ <proto><type>void</type> <name>vkCmdSetDepthWriteEnable</name></proto>
+ <param externsync="true"><type>VkCommandBuffer</type> <name>commandBuffer</name></param>
+ <param><type>VkBool32</type> <name>depthWriteEnable</name></param>
+ </command>
+ <command name="vkCmdSetDepthWriteEnableEXT" alias="vkCmdSetDepthWriteEnable"/>
+ <command queues="graphics" renderpass="both" cmdbufferlevel="primary,secondary">
+ <proto><type>void</type> <name>vkCmdSetDepthCompareOp</name></proto>
+ <param externsync="true"><type>VkCommandBuffer</type> <name>commandBuffer</name></param>
+ <param><type>VkCompareOp</type> <name>depthCompareOp</name></param>
+ </command>
+ <command name="vkCmdSetDepthCompareOpEXT" alias="vkCmdSetDepthCompareOp"/>
+ <command queues="graphics" renderpass="both" cmdbufferlevel="primary,secondary">
+ <proto><type>void</type> <name>vkCmdSetDepthBoundsTestEnable</name></proto>
+ <param externsync="true"><type>VkCommandBuffer</type> <name>commandBuffer</name></param>
+ <param><type>VkBool32</type> <name>depthBoundsTestEnable</name></param>
+ </command>
+ <command name="vkCmdSetDepthBoundsTestEnableEXT" alias="vkCmdSetDepthBoundsTestEnable"/>
+ <command queues="graphics" renderpass="both" cmdbufferlevel="primary,secondary">
+ <proto><type>void</type> <name>vkCmdSetStencilTestEnable</name></proto>
+ <param externsync="true"><type>VkCommandBuffer</type> <name>commandBuffer</name></param>
+ <param><type>VkBool32</type> <name>stencilTestEnable</name></param>
+ </command>
+ <command name="vkCmdSetStencilTestEnableEXT" alias="vkCmdSetStencilTestEnable"/>
+ <command queues="graphics" renderpass="both" cmdbufferlevel="primary,secondary">
+ <proto><type>void</type> <name>vkCmdSetStencilOp</name></proto>
+ <param externsync="true"><type>VkCommandBuffer</type> <name>commandBuffer</name></param>
+ <param><type>VkStencilFaceFlags</type> <name>faceMask</name></param>
+ <param><type>VkStencilOp</type> <name>failOp</name></param>
+ <param><type>VkStencilOp</type> <name>passOp</name></param>
+ <param><type>VkStencilOp</type> <name>depthFailOp</name></param>
+ <param><type>VkCompareOp</type> <name>compareOp</name></param>
+ </command>
+ <command name="vkCmdSetStencilOpEXT" alias="vkCmdSetStencilOp"/>
+ <command queues="graphics" renderpass="both" cmdbufferlevel="primary,secondary">
+ <proto><type>void</type> <name>vkCmdSetPatchControlPointsEXT</name></proto>
+ <param externsync="true"><type>VkCommandBuffer</type> <name>commandBuffer</name></param>
+ <param><type>uint32_t</type> <name>patchControlPoints</name></param>
+ </command>
+ <command queues="graphics" renderpass="both" cmdbufferlevel="primary,secondary">
+ <proto><type>void</type> <name>vkCmdSetRasterizerDiscardEnable</name></proto>
+ <param externsync="true"><type>VkCommandBuffer</type> <name>commandBuffer</name></param>
+ <param><type>VkBool32</type> <name>rasterizerDiscardEnable</name></param>
+ </command>
+ <command name="vkCmdSetRasterizerDiscardEnableEXT" alias="vkCmdSetRasterizerDiscardEnable"/>
+ <command queues="graphics" renderpass="both" cmdbufferlevel="primary,secondary">
+ <proto><type>void</type> <name>vkCmdSetDepthBiasEnable</name></proto>
+ <param externsync="true"><type>VkCommandBuffer</type> <name>commandBuffer</name></param>
+ <param><type>VkBool32</type> <name>depthBiasEnable</name></param>
+ </command>
+ <command name="vkCmdSetDepthBiasEnableEXT" alias="vkCmdSetDepthBiasEnable"/>
+ <command queues="graphics" renderpass="both" cmdbufferlevel="primary,secondary">
+ <proto><type>void</type> <name>vkCmdSetLogicOpEXT</name></proto>
+ <param externsync="true"><type>VkCommandBuffer</type> <name>commandBuffer</name></param>
+ <param><type>VkLogicOp</type> <name>logicOp</name></param>
+ </command>
+ <command queues="graphics" renderpass="both" cmdbufferlevel="primary,secondary">
+ <proto><type>void</type> <name>vkCmdSetPrimitiveRestartEnable</name></proto>
+ <param externsync="true"><type>VkCommandBuffer</type> <name>commandBuffer</name></param>
+ <param><type>VkBool32</type> <name>primitiveRestartEnable</name></param>
+ </command>
+ <command name="vkCmdSetPrimitiveRestartEnableEXT" alias="vkCmdSetPrimitiveRestartEnable"/>
+ <command successcodes="VK_SUCCESS" errorcodes="VK_ERROR_OUT_OF_HOST_MEMORY">
+ <proto><type>VkResult</type> <name>vkCreatePrivateDataSlot</name></proto>
+ <param><type>VkDevice</type> <name>device</name></param>
+ <param>const <type>VkPrivateDataSlotCreateInfo</type>* <name>pCreateInfo</name></param>
+ <param optional="true">const <type>VkAllocationCallbacks</type>* <name>pAllocator</name></param>
+ <param><type>VkPrivateDataSlot</type>* <name>pPrivateDataSlot</name></param>
+ </command>
+ <command name="vkCreatePrivateDataSlotEXT" alias="vkCreatePrivateDataSlot"/>
+ <command>
+ <proto><type>void</type> <name>vkDestroyPrivateDataSlot</name></proto>
+ <param><type>VkDevice</type> <name>device</name></param>
+ <param optional="true" externsync="true"><type>VkPrivateDataSlot</type> <name>privateDataSlot</name></param>
+ <param optional="true">const <type>VkAllocationCallbacks</type>* <name>pAllocator</name></param>
+ </command>
+ <command name="vkDestroyPrivateDataSlotEXT" alias="vkDestroyPrivateDataSlot"/>
+ <command successcodes="VK_SUCCESS" errorcodes="VK_ERROR_OUT_OF_HOST_MEMORY">
+ <proto><type>VkResult</type> <name>vkSetPrivateData</name></proto>
+ <param><type>VkDevice</type> <name>device</name></param>
+ <param><type>VkObjectType</type> <name>objectType</name></param>
+ <param objecttype="objectType"><type>uint64_t</type> <name>objectHandle</name></param>
+ <param><type>VkPrivateDataSlot</type> <name>privateDataSlot</name></param>
+ <param><type>uint64_t</type> <name>data</name></param>
+ </command>
+ <command name="vkSetPrivateDataEXT" alias="vkSetPrivateData"/>
+ <command>
+ <proto><type>void</type> <name>vkGetPrivateData</name></proto>
+ <param><type>VkDevice</type> <name>device</name></param>
+ <param><type>VkObjectType</type> <name>objectType</name></param>
+ <param objecttype="objectType"><type>uint64_t</type> <name>objectHandle</name></param>
+ <param><type>VkPrivateDataSlot</type> <name>privateDataSlot</name></param>
+ <param><type>uint64_t</type>* <name>pData</name></param>
+ </command>
+ <command name="vkGetPrivateDataEXT" alias="vkGetPrivateData"/>
+ <command queues="transfer,graphics,compute" renderpass="outside" cmdbufferlevel="primary,secondary">
+ <proto><type>void</type> <name>vkCmdCopyBuffer2</name></proto>
+ <param externsync="true"><type>VkCommandBuffer</type> <name>commandBuffer</name></param>
+ <param>const <type>VkCopyBufferInfo2</type>* <name>pCopyBufferInfo</name></param>
+ </command>
+ <command name="vkCmdCopyBuffer2KHR" alias="vkCmdCopyBuffer2"/>
+ <command queues="transfer,graphics,compute" renderpass="outside" cmdbufferlevel="primary,secondary">
+ <proto><type>void</type> <name>vkCmdCopyImage2</name></proto>
+ <param externsync="true"><type>VkCommandBuffer</type> <name>commandBuffer</name></param>
+ <param>const <type>VkCopyImageInfo2</type>* <name>pCopyImageInfo</name></param>
+ </command>
+ <command name="vkCmdCopyImage2KHR" alias="vkCmdCopyImage2"/>
+ <command queues="graphics" renderpass="outside" cmdbufferlevel="primary,secondary">
+ <proto><type>void</type> <name>vkCmdBlitImage2</name></proto>
+ <param externsync="true"><type>VkCommandBuffer</type> <name>commandBuffer</name></param>
+ <param>const <type>VkBlitImageInfo2</type>* <name>pBlitImageInfo</name></param>
+ </command>
+ <command name="vkCmdBlitImage2KHR" alias="vkCmdBlitImage2"/>
+ <command queues="transfer,graphics,compute" renderpass="outside" cmdbufferlevel="primary,secondary">
+ <proto><type>void</type> <name>vkCmdCopyBufferToImage2</name></proto>
+ <param externsync="true"><type>VkCommandBuffer</type> <name>commandBuffer</name></param>
+ <param>const <type>VkCopyBufferToImageInfo2</type>* <name>pCopyBufferToImageInfo</name></param>
+ </command>
+ <command name="vkCmdCopyBufferToImage2KHR" alias="vkCmdCopyBufferToImage2"/>
+ <command queues="transfer,graphics,compute" renderpass="outside" cmdbufferlevel="primary,secondary">
+ <proto><type>void</type> <name>vkCmdCopyImageToBuffer2</name></proto>
+ <param externsync="true"><type>VkCommandBuffer</type> <name>commandBuffer</name></param>
+ <param>const <type>VkCopyImageToBufferInfo2</type>* <name>pCopyImageToBufferInfo</name></param>
+ </command>
+ <command name="vkCmdCopyImageToBuffer2KHR" alias="vkCmdCopyImageToBuffer2"/>
+ <command queues="graphics" renderpass="outside" cmdbufferlevel="primary,secondary">
+ <proto><type>void</type> <name>vkCmdResolveImage2</name></proto>
+ <param externsync="true"><type>VkCommandBuffer</type> <name>commandBuffer</name></param>
+ <param>const <type>VkResolveImageInfo2</type>* <name>pResolveImageInfo</name></param>
+ </command>
+ <command name="vkCmdResolveImage2KHR" alias="vkCmdResolveImage2"/>
+ <command queues="graphics" renderpass="both" cmdbufferlevel="primary,secondary">
+ <proto><type>void</type> <name>vkCmdSetFragmentShadingRateKHR</name></proto>
+ <param externsync="true"><type>VkCommandBuffer</type> <name>commandBuffer</name></param>
+ <param>const <type>VkExtent2D</type>* <name>pFragmentSize</name></param>
+ <param>const <type>VkFragmentShadingRateCombinerOpKHR</type> <name>combinerOps</name>[2]</param>
+ </command>
+ <command successcodes="VK_SUCCESS,VK_INCOMPLETE" errorcodes="VK_ERROR_OUT_OF_HOST_MEMORY">
+ <proto><type>VkResult</type> <name>vkGetPhysicalDeviceFragmentShadingRatesKHR</name></proto>
+ <param><type>VkPhysicalDevice</type> <name>physicalDevice</name></param>
+ <param optional="false,true"><type>uint32_t</type>* <name>pFragmentShadingRateCount</name></param>
+ <param optional="true" len="pFragmentShadingRateCount"><type>VkPhysicalDeviceFragmentShadingRateKHR</type>* <name>pFragmentShadingRates</name></param>
+ </command>
+ <command queues="graphics" renderpass="both" cmdbufferlevel="primary,secondary">
+ <proto><type>void</type> <name>vkCmdSetFragmentShadingRateEnumNV</name></proto>
+ <param externsync="true"><type>VkCommandBuffer</type> <name>commandBuffer</name></param>
+ <param><type>VkFragmentShadingRateNV</type> <name>shadingRate</name></param>
+ <param>const <type>VkFragmentShadingRateCombinerOpKHR</type> <name>combinerOps</name>[2]</param>
+ </command>
+ <command>
+ <proto><type>void</type> <name>vkGetAccelerationStructureBuildSizesKHR</name></proto>
+ <param><type>VkDevice</type> <name>device</name></param>
+ <param><type>VkAccelerationStructureBuildTypeKHR</type> <name>buildType</name></param>
+ <param>const <type>VkAccelerationStructureBuildGeometryInfoKHR</type>* <name>pBuildInfo</name></param>
+ <param optional="true" len="pBuildInfo-&gt;geometryCount">const <type>uint32_t</type>* <name>pMaxPrimitiveCounts</name></param>
+ <param><type>VkAccelerationStructureBuildSizesInfoKHR</type>* <name>pSizeInfo</name></param>
+ </command>
+ <command queues="graphics" renderpass="both" cmdbufferlevel="primary,secondary">
+ <proto><type>void</type> <name>vkCmdSetVertexInputEXT</name></proto>
+ <param externsync="true"><type>VkCommandBuffer</type> <name>commandBuffer</name></param>
+ <param optional="true"><type>uint32_t</type> <name>vertexBindingDescriptionCount</name></param>
+ <param len="vertexBindingDescriptionCount">const <type>VkVertexInputBindingDescription2EXT</type>* <name>pVertexBindingDescriptions</name></param>
+ <param optional="true"><type>uint32_t</type> <name>vertexAttributeDescriptionCount</name></param>
+ <param len="vertexAttributeDescriptionCount">const <type>VkVertexInputAttributeDescription2EXT</type>* <name>pVertexAttributeDescriptions</name></param>
+ </command>
+ <command queues="graphics" renderpass="both" cmdbufferlevel="primary,secondary">
+ <proto><type>void</type> <name>vkCmdSetColorWriteEnableEXT</name></proto>
+ <param externsync="true"><type>VkCommandBuffer</type> <name>commandBuffer</name></param>
+ <param><type>uint32_t</type> <name>attachmentCount</name></param>
+ <param len="attachmentCount">const <type>VkBool32</type>* <name>pColorWriteEnables</name></param>
+ </command>
+ <command queues="graphics,compute" renderpass="outside" videocoding="both" cmdbufferlevel="primary,secondary">
+ <proto><type>void</type> <name>vkCmdSetEvent2</name></proto>
+ <param externsync="true"><type>VkCommandBuffer</type> <name>commandBuffer</name></param>
+ <param><type>VkEvent</type> <name>event</name></param>
+ <param>const <type>VkDependencyInfo</type>* <name>pDependencyInfo</name></param>
+ </command>
+ <command name="vkCmdSetEvent2KHR" alias="vkCmdSetEvent2"/>
+ <command queues="graphics,compute" renderpass="outside" videocoding="both" cmdbufferlevel="primary,secondary">
+ <proto><type>void</type> <name>vkCmdResetEvent2</name></proto>
+ <param externsync="true"><type>VkCommandBuffer</type> <name>commandBuffer</name></param>
+ <param><type>VkEvent</type> <name>event</name></param>
+ <param optional="true"><type>VkPipelineStageFlags2</type> <name>stageMask</name></param>
+ </command>
+ <command name="vkCmdResetEvent2KHR" alias="vkCmdResetEvent2"/>
+ <command queues="graphics,compute" renderpass="both" videocoding="both" cmdbufferlevel="primary,secondary">
+ <proto><type>void</type> <name>vkCmdWaitEvents2</name></proto>
+ <param externsync="true"><type>VkCommandBuffer</type> <name>commandBuffer</name></param>
+ <param><type>uint32_t</type> <name>eventCount</name></param>
+ <param len="eventCount">const <type>VkEvent</type>* <name>pEvents</name></param>
+ <param len="eventCount">const <type>VkDependencyInfo</type>* <name>pDependencyInfos</name></param>
+ </command>
+ <command name="vkCmdWaitEvents2KHR" alias="vkCmdWaitEvents2"/>
+ <command queues="transfer,graphics,compute" renderpass="both" videocoding="both" cmdbufferlevel="primary,secondary">
+ <proto><type>void</type> <name>vkCmdPipelineBarrier2</name></proto>
+ <param externsync="true"><type>VkCommandBuffer</type> <name>commandBuffer</name></param>
+ <param>const <type>VkDependencyInfo</type>* <name>pDependencyInfo</name></param>
+ </command>
+ <command name="vkCmdPipelineBarrier2KHR" alias="vkCmdPipelineBarrier2"/>
+ <command successcodes="VK_SUCCESS" errorcodes="VK_ERROR_OUT_OF_HOST_MEMORY,VK_ERROR_OUT_OF_DEVICE_MEMORY,VK_ERROR_DEVICE_LOST">
+ <proto><type>VkResult</type> <name>vkQueueSubmit2</name></proto>
+ <param externsync="true"><type>VkQueue</type> <name>queue</name></param>
+ <param optional="true"><type>uint32_t</type> <name>submitCount</name></param>
+ <param len="submitCount">const <type>VkSubmitInfo2</type>* <name>pSubmits</name></param>
+ <param optional="true" externsync="true"><type>VkFence</type> <name>fence</name></param>
+ </command>
+ <command name="vkQueueSubmit2KHR" alias="vkQueueSubmit2"/>
+ <command queues="transfer,graphics,compute,decode,encode" renderpass="both" videocoding="both" cmdbufferlevel="primary,secondary">
+ <proto><type>void</type> <name>vkCmdWriteTimestamp2</name></proto>
+ <param externsync="true"><type>VkCommandBuffer</type> <name>commandBuffer</name></param>
+ <param optional="true"><type>VkPipelineStageFlags2</type> <name>stage</name></param>
+ <param><type>VkQueryPool</type> <name>queryPool</name></param>
+ <param><type>uint32_t</type> <name>query</name></param>
+ </command>
+ <command name="vkCmdWriteTimestamp2KHR" alias="vkCmdWriteTimestamp2"/>
+ <command queues="transfer,graphics,compute" renderpass="both" cmdbufferlevel="primary,secondary">
+ <proto><type>void</type> <name>vkCmdWriteBufferMarker2AMD</name></proto>
+ <param externsync="true"><type>VkCommandBuffer</type> <name>commandBuffer</name></param>
+ <param optional="true"><type>VkPipelineStageFlags2</type> <name>stage</name></param>
+ <param><type>VkBuffer</type> <name>dstBuffer</name></param>
+ <param><type>VkDeviceSize</type> <name>dstOffset</name></param>
+ <param><type>uint32_t</type> <name>marker</name></param>
+ </command>
+ <command>
+ <proto><type>void</type> <name>vkGetQueueCheckpointData2NV</name></proto>
+ <param><type>VkQueue</type> <name>queue</name></param>
+ <param optional="false,true"><type>uint32_t</type>* <name>pCheckpointDataCount</name></param>
+ <param optional="true" len="pCheckpointDataCount"><type>VkCheckpointData2NV</type>* <name>pCheckpointData</name></param>
+ </command>
+ <command successcodes="VK_SUCCESS" errorcodes="VK_ERROR_OUT_OF_HOST_MEMORY,VK_ERROR_OUT_OF_DEVICE_MEMORY,VK_ERROR_VIDEO_PROFILE_OPERATION_NOT_SUPPORTED_KHR,VK_ERROR_VIDEO_PROFILE_FORMAT_NOT_SUPPORTED_KHR,VK_ERROR_VIDEO_PICTURE_LAYOUT_NOT_SUPPORTED_KHR,VK_ERROR_VIDEO_PROFILE_CODEC_NOT_SUPPORTED_KHR">
+ <proto><type>VkResult</type> <name>vkGetPhysicalDeviceVideoCapabilitiesKHR</name></proto>
+ <param><type>VkPhysicalDevice</type> <name>physicalDevice</name></param>
+ <param>const <type>VkVideoProfileKHR</type>* <name>pVideoProfile</name></param>
+ <param><type>VkVideoCapabilitiesKHR</type>* <name>pCapabilities</name></param>
+ </command>
+ <command successcodes="VK_SUCCESS,VK_INCOMPLETE" errorcodes="VK_ERROR_OUT_OF_HOST_MEMORY,VK_ERROR_OUT_OF_DEVICE_MEMORY,VK_ERROR_IMAGE_USAGE_NOT_SUPPORTED_KHR,VK_ERROR_VIDEO_PROFILE_OPERATION_NOT_SUPPORTED_KHR,VK_ERROR_VIDEO_PROFILE_FORMAT_NOT_SUPPORTED_KHR,VK_ERROR_VIDEO_PICTURE_LAYOUT_NOT_SUPPORTED_KHR,VK_ERROR_VIDEO_PROFILE_CODEC_NOT_SUPPORTED_KHR">
+ <proto><type>VkResult</type> <name>vkGetPhysicalDeviceVideoFormatPropertiesKHR</name></proto>
+ <param><type>VkPhysicalDevice</type> <name>physicalDevice</name></param>
+ <param>const <type>VkPhysicalDeviceVideoFormatInfoKHR</type>* <name>pVideoFormatInfo</name></param>
+ <param optional="false,true"><type>uint32_t</type>* <name>pVideoFormatPropertyCount</name></param>
+ <param optional="true" len="pVideoFormatPropertyCount"><type>VkVideoFormatPropertiesKHR</type>* <name>pVideoFormatProperties</name></param>
+ </command>
+ <command successcodes="VK_SUCCESS" errorcodes="VK_ERROR_OUT_OF_HOST_MEMORY,VK_ERROR_OUT_OF_DEVICE_MEMORY,VK_ERROR_INITIALIZATION_FAILED,VK_ERROR_VIDEO_STD_VERSION_NOT_SUPPORTED_KHR">
+ <proto><type>VkResult</type> <name>vkCreateVideoSessionKHR</name></proto>
+ <param><type>VkDevice</type> <name>device</name></param>
+ <param>const <type>VkVideoSessionCreateInfoKHR</type>* <name>pCreateInfo</name></param>
+ <param optional="true">const <type>VkAllocationCallbacks</type>* <name>pAllocator</name></param>
+ <param><type>VkVideoSessionKHR</type>* <name>pVideoSession</name></param>
+ </command>
+ <command>
+ <proto><type>void</type> <name>vkDestroyVideoSessionKHR</name></proto>
+ <param><type>VkDevice</type> <name>device</name></param>
+ <param><type>VkVideoSessionKHR</type> <name>videoSession</name></param>
+ <param optional="true">const <type>VkAllocationCallbacks</type>* <name>pAllocator</name></param>
+ </command>
+ <command successcodes="VK_SUCCESS" errorcodes="VK_ERROR_INITIALIZATION_FAILED,VK_ERROR_OUT_OF_HOST_MEMORY,VK_ERROR_OUT_OF_DEVICE_MEMORY,VK_ERROR_TOO_MANY_OBJECTS">
+ <proto><type>VkResult</type> <name>vkCreateVideoSessionParametersKHR</name></proto>
+ <param><type>VkDevice</type> <name>device</name></param>
+ <param>const <type>VkVideoSessionParametersCreateInfoKHR</type>* <name>pCreateInfo</name></param>
+ <param optional="true">const <type>VkAllocationCallbacks</type>* <name>pAllocator</name></param>
+ <param><type>VkVideoSessionParametersKHR</type>* <name>pVideoSessionParameters</name></param>
+ </command>
+ <command successcodes="VK_SUCCESS" errorcodes="VK_ERROR_INITIALIZATION_FAILED,VK_ERROR_TOO_MANY_OBJECTS">
+ <proto><type>VkResult</type> <name>vkUpdateVideoSessionParametersKHR</name></proto>
+ <param><type>VkDevice</type> <name>device</name></param>
+ <param><type>VkVideoSessionParametersKHR</type> <name>videoSessionParameters</name></param>
+ <param>const <type>VkVideoSessionParametersUpdateInfoKHR</type>* <name>pUpdateInfo</name></param>
+ </command>
+ <command>
+ <proto><type>void</type> <name>vkDestroyVideoSessionParametersKHR</name></proto>
+ <param><type>VkDevice</type> <name>device</name></param>
+ <param><type>VkVideoSessionParametersKHR</type> <name>videoSessionParameters</name></param>
+ <param optional="true">const <type>VkAllocationCallbacks</type>* <name>pAllocator</name></param>
+ </command>
+ <command successcodes="VK_SUCCESS,VK_INCOMPLETE" errorcodes="VK_ERROR_INITIALIZATION_FAILED">
+ <proto><type>VkResult</type> <name>vkGetVideoSessionMemoryRequirementsKHR</name></proto>
+ <param><type>VkDevice</type> <name>device</name></param>
+ <param><type>VkVideoSessionKHR</type> <name>videoSession</name></param>
+ <param optional="false,true"><type>uint32_t</type>* <name>pVideoSessionMemoryRequirementsCount</name></param>
+ <param optional="true" len="pVideoSessionMemoryRequirementsCount"><type>VkVideoGetMemoryPropertiesKHR</type>* <name>pVideoSessionMemoryRequirements</name></param>
+ </command>
+ <command successcodes="VK_SUCCESS" errorcodes="VK_ERROR_OUT_OF_HOST_MEMORY,VK_ERROR_OUT_OF_DEVICE_MEMORY,VK_ERROR_INITIALIZATION_FAILED">
+ <proto><type>VkResult</type> <name>vkBindVideoSessionMemoryKHR</name></proto>
+ <param><type>VkDevice</type> <name>device</name></param>
+ <param><type>VkVideoSessionKHR</type> <name>videoSession</name></param>
+ <param><type>uint32_t</type> <name>videoSessionBindMemoryCount</name></param>
+ <param len="videoSessionBindMemoryCount">const <type>VkVideoBindMemoryKHR</type>* <name>pVideoSessionBindMemories</name></param>
+ </command>
+ <command queues="decode" renderpass="outside" videocoding="inside" cmdbufferlevel="primary">
+ <proto><type>void</type> <name>vkCmdDecodeVideoKHR</name></proto>
+ <param><type>VkCommandBuffer</type> <name>commandBuffer</name></param>
+ <param>const <type>VkVideoDecodeInfoKHR</type>* <name>pFrameInfo</name></param>
+ </command>
+ <command queues="decode,encode" renderpass="outside" videocoding="outside" cmdbufferlevel="primary">
+ <proto><type>void</type> <name>vkCmdBeginVideoCodingKHR</name></proto>
+ <param><type>VkCommandBuffer</type> <name>commandBuffer</name></param>
+ <param>const <type>VkVideoBeginCodingInfoKHR</type>* <name>pBeginInfo</name></param>
+ </command>
+ <command queues="decode,encode" renderpass="outside" videocoding="inside" cmdbufferlevel="primary">
+ <proto><type>void</type> <name>vkCmdControlVideoCodingKHR</name></proto>
+ <param><type>VkCommandBuffer</type> <name>commandBuffer</name></param>
+ <param>const <type>VkVideoCodingControlInfoKHR</type>* <name>pCodingControlInfo</name></param>
+ </command>
+ <command queues="decode,encode" renderpass="outside" videocoding="inside" cmdbufferlevel="primary">
+ <proto><type>void</type> <name>vkCmdEndVideoCodingKHR</name></proto>
+ <param><type>VkCommandBuffer</type> <name>commandBuffer</name></param>
+ <param>const <type>VkVideoEndCodingInfoKHR</type>* <name>pEndCodingInfo</name></param>
+ </command>
+ <command queues="encode" renderpass="outside" videocoding="inside" cmdbufferlevel="primary">
+ <proto><type>void</type> <name>vkCmdEncodeVideoKHR</name></proto>
+ <param><type>VkCommandBuffer</type> <name>commandBuffer</name></param>
+ <param>const <type>VkVideoEncodeInfoKHR</type>* <name>pEncodeInfo</name></param>
+ </command>
+ <command successcodes="VK_SUCCESS" errorcodes="VK_ERROR_OUT_OF_HOST_MEMORY,VK_ERROR_INITIALIZATION_FAILED">
+ <proto><type>VkResult</type> <name>vkCreateCuModuleNVX</name></proto>
+ <param><type>VkDevice</type> <name>device</name></param>
+ <param>const <type>VkCuModuleCreateInfoNVX</type>* <name>pCreateInfo</name></param>
+ <param optional="true">const <type>VkAllocationCallbacks</type>* <name>pAllocator</name></param>
+ <param><type>VkCuModuleNVX</type>* <name>pModule</name></param>
+ </command>
+ <command successcodes="VK_SUCCESS" errorcodes="VK_ERROR_OUT_OF_HOST_MEMORY,VK_ERROR_INITIALIZATION_FAILED">
+ <proto><type>VkResult</type> <name>vkCreateCuFunctionNVX</name></proto>
+ <param><type>VkDevice</type> <name>device</name></param>
+ <param>const <type>VkCuFunctionCreateInfoNVX</type>* <name>pCreateInfo</name></param>
+ <param optional="true">const <type>VkAllocationCallbacks</type>* <name>pAllocator</name></param>
+ <param><type>VkCuFunctionNVX</type>* <name>pFunction</name></param>
+ </command>
+ <command>
+ <proto><type>void</type> <name>vkDestroyCuModuleNVX</name></proto>
+ <param><type>VkDevice</type> <name>device</name></param>
+ <param><type>VkCuModuleNVX</type> <name>module</name></param>
+ <param optional="true">const <type>VkAllocationCallbacks</type>* <name>pAllocator</name></param>
+ </command>
+ <command>
+ <proto><type>void</type> <name>vkDestroyCuFunctionNVX</name></proto>
+ <param><type>VkDevice</type> <name>device</name></param>
+ <param><type>VkCuFunctionNVX</type> <name>function</name></param>
+ <param optional="true">const <type>VkAllocationCallbacks</type>* <name>pAllocator</name></param>
+ </command>
+ <command queues="graphics,compute" renderpass="both" cmdbufferlevel="primary,secondary">
+ <proto><type>void</type> <name>vkCmdCuLaunchKernelNVX</name></proto>
+ <param><type>VkCommandBuffer</type> <name>commandBuffer</name></param>
+ <param>const <type>VkCuLaunchInfoNVX</type>* <name>pLaunchInfo</name></param>
+ </command>
+ <command>
+ <proto><type>void</type> <name>vkSetDeviceMemoryPriorityEXT</name></proto>
+ <param><type>VkDevice</type> <name>device</name></param>
+ <param><type>VkDeviceMemory</type> <name>memory</name></param>
+ <param><type>float</type> <name>priority</name></param>
+ </command>
+ <command successcodes="VK_SUCCESS" errorcodes="VK_ERROR_INITIALIZATION_FAILED">
+ <proto><type>VkResult</type> <name>vkAcquireDrmDisplayEXT</name></proto>
+ <param><type>VkPhysicalDevice</type> <name>physicalDevice</name></param>
+ <param><type>int32_t</type> <name>drmFd</name></param>
+ <param><type>VkDisplayKHR</type> <name>display</name></param>
+ </command>
+ <command successcodes="VK_SUCCESS" errorcodes="VK_ERROR_INITIALIZATION_FAILED,VK_ERROR_OUT_OF_HOST_MEMORY">
+ <proto><type>VkResult</type> <name>vkGetDrmDisplayEXT</name></proto>
+ <param><type>VkPhysicalDevice</type> <name>physicalDevice</name></param>
+ <param><type>int32_t</type> <name>drmFd</name></param>
+ <param><type>uint32_t</type> <name>connectorId</name></param>
+ <param><type>VkDisplayKHR</type>* <name>display</name></param>
+ </command>
+ <command successcodes="VK_SUCCESS,VK_TIMEOUT,VK_SUBOPTIMAL_KHR" errorcodes="VK_ERROR_OUT_OF_HOST_MEMORY,VK_ERROR_OUT_OF_DEVICE_MEMORY,VK_ERROR_DEVICE_LOST,VK_ERROR_OUT_OF_DATE_KHR,VK_ERROR_SURFACE_LOST_KHR,VK_ERROR_FULL_SCREEN_EXCLUSIVE_MODE_LOST_EXT">
+ <proto><type>VkResult</type> <name>vkWaitForPresentKHR</name></proto>
+ <param><type>VkDevice</type> <name>device</name></param>
+ <param externsync="true"><type>VkSwapchainKHR</type> <name>swapchain</name></param>
+ <param><type>uint64_t</type> <name>presentId</name></param>
+ <param><type>uint64_t</type> <name>timeout</name></param>
+ </command>
+ <command successcodes="VK_SUCCESS" errorcodes="VK_ERROR_OUT_OF_HOST_MEMORY,VK_ERROR_INVALID_EXTERNAL_HANDLE,VK_ERROR_INITIALIZATION_FAILED">
+ <proto><type>VkResult</type> <name>vkCreateBufferCollectionFUCHSIA</name></proto>
+ <param><type>VkDevice</type> <name>device</name></param>
+ <param>const <type>VkBufferCollectionCreateInfoFUCHSIA</type>* <name>pCreateInfo</name></param>
+ <param optional="true">const <type>VkAllocationCallbacks</type>* <name>pAllocator</name></param>
+ <param><type>VkBufferCollectionFUCHSIA</type>* <name>pCollection</name></param>
+ </command>
+ <command successcodes="VK_SUCCESS" errorcodes="VK_ERROR_INITIALIZATION_FAILED,VK_ERROR_OUT_OF_HOST_MEMORY,VK_ERROR_FORMAT_NOT_SUPPORTED">
+ <proto><type>VkResult</type> <name>vkSetBufferCollectionBufferConstraintsFUCHSIA</name></proto>
+ <param><type>VkDevice</type> <name>device</name></param>
+ <param><type>VkBufferCollectionFUCHSIA</type> <name>collection</name></param>
+ <param>const <type>VkBufferConstraintsInfoFUCHSIA</type>* <name>pBufferConstraintsInfo</name></param>
+ </command>
+ <command successcodes="VK_SUCCESS" errorcodes="VK_ERROR_INITIALIZATION_FAILED,VK_ERROR_OUT_OF_HOST_MEMORY,VK_ERROR_FORMAT_NOT_SUPPORTED">
+ <proto><type>VkResult</type> <name>vkSetBufferCollectionImageConstraintsFUCHSIA</name></proto>
+ <param><type>VkDevice</type> <name>device</name></param>
+ <param><type>VkBufferCollectionFUCHSIA</type> <name>collection</name></param>
+ <param>const <type>VkImageConstraintsInfoFUCHSIA</type>* <name>pImageConstraintsInfo</name></param>
+ </command>
+ <command>
+ <proto><type>void</type> <name>vkDestroyBufferCollectionFUCHSIA</name></proto>
+ <param><type>VkDevice</type> <name>device</name></param>
+ <param><type>VkBufferCollectionFUCHSIA</type> <name>collection</name></param>
+ <param optional="true">const <type>VkAllocationCallbacks</type>* <name>pAllocator</name></param>
+ </command>
+ <command successcodes="VK_SUCCESS" errorcodes="VK_ERROR_OUT_OF_HOST_MEMORY,VK_ERROR_INITIALIZATION_FAILED">
+ <proto><type>VkResult</type> <name>vkGetBufferCollectionPropertiesFUCHSIA</name></proto>
+ <param><type>VkDevice</type> <name>device</name></param>
+ <param><type>VkBufferCollectionFUCHSIA</type> <name>collection</name></param>
+ <param><type>VkBufferCollectionPropertiesFUCHSIA</type>* <name>pProperties</name></param>
+ </command>
+ <command queues="graphics" renderpass="outside" cmdbufferlevel="primary,secondary">
+ <proto><type>void</type> <name>vkCmdBeginRendering</name></proto>
+ <param externsync="true"><type>VkCommandBuffer</type> <name>commandBuffer</name></param>
+ <param>const <type>VkRenderingInfo</type>* <name>pRenderingInfo</name></param>
+ </command>
+ <command name="vkCmdBeginRenderingKHR" alias="vkCmdBeginRendering"/>
+ <command queues="graphics" renderpass="inside" cmdbufferlevel="primary,secondary">
+ <proto><type>void</type> <name>vkCmdEndRendering</name></proto>
+ <param externsync="true"><type>VkCommandBuffer</type> <name>commandBuffer</name></param>
+ </command>
+ <command name="vkCmdEndRenderingKHR" alias="vkCmdEndRendering"/>
+ <command>
+ <proto><type>void</type> <name>vkGetDescriptorSetLayoutHostMappingInfoVALVE</name></proto>
+ <param><type>VkDevice</type> <name>device</name></param>
+ <param>const <type>VkDescriptorSetBindingReferenceVALVE</type>* <name>pBindingReference</name></param>
+ <param><type>VkDescriptorSetLayoutHostMappingInfoVALVE</type>* <name>pHostMapping</name></param>
+ </command>
+ <command>
+ <proto><type>void</type> <name>vkGetDescriptorSetHostMappingVALVE</name></proto>
+ <param><type>VkDevice</type> <name>device</name></param>
+ <param><type>VkDescriptorSet</type> <name>descriptorSet</name></param>
+ <param><type>void</type>** <name>ppData</name></param>
+ </command>
+ <command>
+ <proto><type>void</type> <name>vkGetShaderModuleIdentifierEXT</name></proto>
+ <param><type>VkDevice</type> <name>device</name></param>
+ <param><type>VkShaderModule</type> <name>shaderModule</name></param>
+ <param><type>VkShaderModuleIdentifierEXT</type>* <name>pIdentifier</name></param>
+ </command>
+ <command>
+ <proto><type>void</type> <name>vkGetShaderModuleCreateInfoIdentifierEXT</name></proto>
+ <param><type>VkDevice</type> <name>device</name></param>
+ <param>const <type>VkShaderModuleCreateInfo</type>* <name>pCreateInfo</name></param>
+ <param><type>VkShaderModuleIdentifierEXT</type>* <name>pIdentifier</name></param>
+ </command>
+ <command>
+ <proto><type>void</type> <name>vkGetImageSubresourceLayout2EXT</name></proto>
+ <param><type>VkDevice</type> <name>device</name></param>
+ <param><type>VkImage</type> <name>image</name></param>
+ <param>const <type>VkImageSubresource2EXT</type>* <name>pSubresource</name></param>
+ <param><type>VkSubresourceLayout2EXT</type>* <name>pLayout</name></param>
+ </command>
+ <command successcodes="VK_SUCCESS" errorcodes="VK_ERROR_OUT_OF_HOST_MEMORY">
+ <proto><type>VkResult</type> <name>vkGetPipelinePropertiesEXT</name></proto>
+ <param><type>VkDevice</type> <name>device</name></param>
+ <param>const <type>VkPipelineInfoEXT</type>* <name>pPipelineInfo</name></param>
+ <param noautovalidity="true" validstructs="VkPipelinePropertiesIdentifierEXT"><type>VkBaseOutStructure</type>* <name>pPipelineProperties</name></param>
+ </command>
+ <command>
+ <proto><type>void</type> <name>vkExportMetalObjectsEXT</name></proto>
+ <param><type>VkDevice</type> <name>device</name></param>
+ <param><type>VkExportMetalObjectsInfoEXT</type>* <name>pMetalObjectsInfo</name></param>
+ </command>
+ <command successcodes="VK_SUCCESS,VK_INCOMPLETE">
+ <proto><type>VkResult</type> <name>vkGetFramebufferTilePropertiesQCOM</name></proto>
+ <param><type>VkDevice</type> <name>device</name></param>
+ <param><type>VkFramebuffer</type> <name>framebuffer</name></param>
+ <param optional="false,true"><type>uint32_t</type>* <name>pPropertiesCount</name></param>
+ <param optional="true" len="pPropertiesCount"><type>VkTilePropertiesQCOM</type>* <name>pProperties</name></param>
+ </command>
+ <command successcodes="VK_SUCCESS">
+ <proto><type>VkResult</type> <name>vkGetDynamicRenderingTilePropertiesQCOM</name></proto>
+ <param><type>VkDevice</type> <name>device</name></param>
+ <param>const <type>VkRenderingInfo</type>* <name>pRenderingInfo</name></param>
+ <param><type>VkTilePropertiesQCOM</type>* <name>pProperties</name></param>
+ </command>
</commands>
- <!-- SECTION: Vulkan API interface definitions -->
- <feature api="vulkan" name="VK_VERSION_1_0" number="1.0">
+ <feature api="vulkan" name="VK_VERSION_1_0" number="1.0" comment="Vulkan core API interface definitions">
<require comment="Header boilerplate">
<type name="vk_platform"/>
+ <type name="VK_DEFINE_HANDLE"/>
+ <type name="VK_USE_64_BIT_PTR_DEFINES"/>
+ <type name="VK_DEFINE_NON_DISPATCHABLE_HANDLE"/>
+ <type name="VK_NULL_HANDLE"/>
</require>
- <require comment="API version">
- <type name="VK_API_VERSION"/>
- <type name="VK_API_VERSION_1_0"/>
- <type name="VK_VERSION_MAJOR"/>
- <type name="VK_VERSION_MINOR"/>
- <type name="VK_VERSION_PATCH"/>
- <type name="VK_HEADER_VERSION"/>
+ <require comment="Fundamental types used by many commands and structures">
+ <type name="VkBool32"/>
+ <type name="VkDeviceAddress"/>
+ <type name="VkDeviceSize"/>
+ <type name="VkExtent2D"/>
+ <type name="VkExtent3D"/>
+ <type name="VkFlags"/>
+ <type name="VkOffset2D"/>
+ <type name="VkOffset3D"/>
+ <type name="VkRect2D"/>
+ <type name="VkResult"/>
+ <type name="VkStructureType"/>
</require>
<require comment="API constants">
- <enum name="VK_LOD_CLAMP_NONE"/>
- <enum name="VK_REMAINING_MIP_LEVELS"/>
- <enum name="VK_REMAINING_ARRAY_LAYERS"/>
- <enum name="VK_WHOLE_SIZE"/>
<enum name="VK_ATTACHMENT_UNUSED"/>
- <enum name="VK_TRUE"/>
<enum name="VK_FALSE"/>
- <type name="VK_NULL_HANDLE"/>
+ <enum name="VK_LOD_CLAMP_NONE"/>
<enum name="VK_QUEUE_FAMILY_IGNORED"/>
+ <enum name="VK_REMAINING_ARRAY_LAYERS"/>
+ <enum name="VK_REMAINING_MIP_LEVELS"/>
<enum name="VK_SUBPASS_EXTERNAL"/>
+ <enum name="VK_TRUE"/>
+ <enum name="VK_WHOLE_SIZE"/>
+ <enum name="VK_MAX_MEMORY_TYPES"/>
+ <enum name="VK_MAX_PHYSICAL_DEVICE_NAME_SIZE"/>
+ <enum name="VK_UUID_SIZE"/>
+ <enum name="VK_MAX_EXTENSION_NAME_SIZE"/>
+ <enum name="VK_MAX_DESCRIPTION_SIZE"/>
+ <enum name="VK_MAX_MEMORY_HEAPS"/>
<type name="VkPipelineCacheHeaderVersion"/>
</require>
+ <require comment="These types are part of the API, though not directly used in API commands or data structures">
+ <type name="VkBaseInStructure"/>
+ <type name="VkBaseOutStructure"/>
+ <type name="VkBufferMemoryBarrier"/>
+ <type name="VkDispatchIndirectCommand"/>
+ <type name="VkDrawIndexedIndirectCommand"/>
+ <type name="VkDrawIndirectCommand"/>
+ <type name="VkImageMemoryBarrier"/>
+ <type name="VkMemoryBarrier"/>
+ <type name="VkObjectType"/>
+ <type name="VkPipelineCacheHeaderVersionOne"/>
+ <type name="VkVendorId"/>
+ </require>
+ <require comment="API version macros">
+ <type name="VK_API_VERSION"/>
+ <type name="VK_API_VERSION_1_0"/>
+ <type name="VK_HEADER_VERSION"/>
+ <type name="VK_HEADER_VERSION_COMPLETE"/>
+ <type name="VK_MAKE_VERSION"/>
+ <type name="VK_VERSION_MAJOR"/>
+ <type name="VK_VERSION_MINOR"/>
+ <type name="VK_VERSION_PATCH"/>
+ <type name="VK_MAKE_API_VERSION"/>
+ <type name="VK_API_VERSION_VARIANT"/>
+ <type name="VK_API_VERSION_MAJOR"/>
+ <type name="VK_API_VERSION_MINOR"/>
+ <type name="VK_API_VERSION_PATCH"/>
+ </require>
<require comment="Device initialization">
+ <type name="PFN_vkAllocationFunction"/>
+ <type name="PFN_vkFreeFunction"/>
+ <type name="PFN_vkInternalAllocationNotification"/>
+ <type name="PFN_vkInternalFreeNotification"/>
+ <type name="PFN_vkReallocationFunction"/>
+ <type name="PFN_vkVoidFunction"/>
+ <type name="VkAllocationCallbacks"/>
+ <type name="VkApplicationInfo"/>
+ <type name="VkFormat"/>
+ <type name="VkFormatFeatureFlagBits"/>
+ <type name="VkFormatFeatureFlags"/>
+ <type name="VkFormatProperties"/>
+ <type name="VkImageCreateFlagBits"/>
+ <type name="VkImageCreateFlags"/>
+ <type name="VkImageFormatProperties"/>
+ <type name="VkImageTiling"/>
+ <type name="VkImageType"/>
+ <type name="VkImageUsageFlagBits"/>
+ <type name="VkImageUsageFlags"/>
+ <type name="VkInstance"/>
+ <type name="VkInstanceCreateFlags"/>
+ <type name="VkInstanceCreateFlagBits"/>
+ <type name="VkInstanceCreateInfo"/>
+ <type name="VkInternalAllocationType"/>
+ <type name="VkMemoryHeap"/>
+ <type name="VkMemoryHeapFlagBits"/>
+ <type name="VkMemoryHeapFlags"/>
+ <type name="VkMemoryPropertyFlagBits"/>
+ <type name="VkMemoryPropertyFlags"/>
+ <type name="VkMemoryType"/>
+ <type name="VkPhysicalDevice"/>
+ <type name="VkPhysicalDeviceFeatures"/>
+ <type name="VkPhysicalDeviceLimits"/>
+ <type name="VkPhysicalDeviceMemoryProperties"/>
+ <type name="VkPhysicalDeviceProperties"/>
+ <type name="VkPhysicalDeviceSparseProperties"/>
+ <type name="VkPhysicalDeviceType"/>
+ <type name="VkQueueFamilyProperties"/>
+ <type name="VkQueueFlagBits"/>
+ <type name="VkQueueFlags"/>
+ <type name="VkSampleCountFlagBits"/>
+ <type name="VkSampleCountFlags"/>
+ <type name="VkSystemAllocationScope"/>
<command name="vkCreateInstance"/>
<command name="vkDestroyInstance"/>
<command name="vkEnumeratePhysicalDevices"/>
@@ -4130,24 +12310,38 @@ maintained in the master branch of the Khronos Vulkan GitHub project.
<command name="vkGetDeviceProcAddr"/>
</require>
<require comment="Device commands">
+ <type name="VkDevice"/>
+ <type name="VkDeviceCreateFlags" comment="Will add VkDeviceCreateFlagBits when bits are defined in the future"/>
+ <type name="VkDeviceCreateInfo"/>
+ <type name="VkDeviceQueueCreateFlags" comment="VkDeviceQueueCreateFlagBits was added later"/>
+ <type name="VkDeviceQueueCreateInfo"/>
<command name="vkCreateDevice"/>
<command name="vkDestroyDevice"/>
</require>
<require comment="Extension discovery commands">
+ <type name="VkExtensionProperties"/>
<command name="vkEnumerateInstanceExtensionProperties"/>
<command name="vkEnumerateDeviceExtensionProperties"/>
</require>
<require comment="Layer discovery commands">
+ <type name="VkLayerProperties"/>
<command name="vkEnumerateInstanceLayerProperties"/>
<command name="vkEnumerateDeviceLayerProperties"/>
</require>
- <require comment="queue commands">
+ <require comment="Queue commands">
+ <type name="VkPipelineStageFlagBits"/>
+ <type name="VkPipelineStageFlags"/>
+ <type name="VkQueue"/>
+ <type name="VkSubmitInfo"/>
<command name="vkGetDeviceQueue"/>
<command name="vkQueueSubmit"/>
<command name="vkQueueWaitIdle"/>
<command name="vkDeviceWaitIdle"/>
</require>
<require comment="Memory commands">
+ <type name="VkMappedMemoryRange"/>
+ <type name="VkMemoryAllocateInfo"/>
+ <type name="VkMemoryMapFlags"/>
<command name="vkAllocateMemory"/>
<command name="vkFreeMemory"/>
<command name="vkMapMemory"/>
@@ -4157,17 +12351,38 @@ maintained in the master branch of the Khronos Vulkan GitHub project.
<command name="vkGetDeviceMemoryCommitment"/>
</require>
<require comment="Memory management API commands">
+ <type name="VkDeviceMemory"/>
+ <type name="VkMemoryRequirements"/>
<command name="vkBindBufferMemory"/>
<command name="vkBindImageMemory"/>
<command name="vkGetBufferMemoryRequirements"/>
<command name="vkGetImageMemoryRequirements"/>
</require>
<require comment="Sparse resource memory management API commands">
+ <type name="VkBindSparseInfo"/>
+ <type name="VkImageAspectFlagBits"/>
+ <type name="VkImageAspectFlags"/>
+ <type name="VkImageSubresource"/>
+ <type name="VkSparseBufferMemoryBindInfo"/>
+ <type name="VkSparseImageFormatFlagBits"/>
+ <type name="VkSparseImageFormatFlags"/>
+ <type name="VkSparseImageFormatProperties"/>
+ <type name="VkSparseImageMemoryBind"/>
+ <type name="VkSparseImageMemoryBindInfo"/>
+ <type name="VkSparseImageMemoryRequirements"/>
+ <type name="VkSparseImageOpaqueMemoryBindInfo"/>
+ <type name="VkSparseMemoryBind"/>
+ <type name="VkSparseMemoryBindFlagBits"/>
+ <type name="VkSparseMemoryBindFlags"/>
<command name="vkGetImageSparseMemoryRequirements"/>
<command name="vkGetPhysicalDeviceSparseImageFormatProperties"/>
<command name="vkQueueBindSparse"/>
</require>
<require comment="Fence commands">
+ <type name="VkFence"/>
+ <type name="VkFenceCreateFlagBits"/>
+ <type name="VkFenceCreateFlags"/>
+ <type name="VkFenceCreateInfo"/>
<command name="vkCreateFence"/>
<command name="vkDestroyFence"/>
<command name="vkResetFences"/>
@@ -4175,10 +12390,17 @@ maintained in the master branch of the Khronos Vulkan GitHub project.
<command name="vkWaitForFences"/>
</require>
<require comment="Queue semaphore commands">
+ <type name="VkSemaphore"/>
+ <type name="VkSemaphoreCreateFlags" comment="Will add VkSemaphoreCreateFlagBits when bits are defined in the future"/>
+ <type name="VkSemaphoreCreateInfo"/>
<command name="vkCreateSemaphore"/>
<command name="vkDestroySemaphore"/>
</require>
<require comment="Event commands">
+ <type name="VkEvent"/>
+ <type name="VkEventCreateFlags"/>
+ <type name="VkEventCreateFlagBits"/>
+ <type name="VkEventCreateInfo"/>
<command name="vkCreateEvent"/>
<command name="vkDestroyEvent"/>
<command name="vkGetEventStatus"/>
@@ -4186,51 +12408,167 @@ maintained in the master branch of the Khronos Vulkan GitHub project.
<command name="vkResetEvent"/>
</require>
<require comment="Query commands">
+ <type name="VkQueryPipelineStatisticFlagBits"/>
+ <type name="VkQueryPipelineStatisticFlags"/>
+ <type name="VkQueryPool"/>
+ <type name="VkQueryPoolCreateFlags" comment="Will add VkQueryPoolCreateFlagBits when bits are defined in the future"/>
+ <type name="VkQueryPoolCreateInfo"/>
+ <type name="VkQueryResultFlagBits"/>
+ <type name="VkQueryResultFlags"/>
+ <type name="VkQueryType"/>
<command name="vkCreateQueryPool"/>
<command name="vkDestroyQueryPool"/>
<command name="vkGetQueryPoolResults"/>
</require>
<require comment="Buffer commands">
+ <type name="VkBuffer"/>
+ <type name="VkBufferCreateFlagBits"/>
+ <type name="VkBufferCreateFlags"/>
+ <type name="VkBufferCreateInfo"/>
+ <type name="VkBufferUsageFlagBits"/>
+ <type name="VkBufferUsageFlags"/>
+ <type name="VkSharingMode"/>
<command name="vkCreateBuffer"/>
<command name="vkDestroyBuffer"/>
</require>
<require comment="Buffer view commands">
+ <type name="VkBufferView"/>
+ <type name="VkBufferViewCreateFlags" comment="Will add VkBufferViewFlagBits when bits are defined in the future"/>
+ <type name="VkBufferViewCreateInfo"/>
<command name="vkCreateBufferView"/>
<command name="vkDestroyBufferView"/>
</require>
<require comment="Image commands">
+ <type name="VkImage"/>
+ <type name="VkImageCreateInfo"/>
+ <type name="VkImageLayout"/>
+ <type name="VkSubresourceLayout"/>
<command name="vkCreateImage"/>
<command name="vkDestroyImage"/>
<command name="vkGetImageSubresourceLayout"/>
</require>
<require comment="Image view commands">
+ <type name="VkComponentMapping"/>
+ <type name="VkComponentSwizzle"/>
+ <type name="VkImageSubresourceRange"/>
+ <type name="VkImageView"/>
+ <type name="VkImageViewCreateFlagBits"/>
+ <type name="VkImageViewCreateFlags"/>
+ <type name="VkImageViewCreateInfo"/>
+ <type name="VkImageViewType"/>
<command name="vkCreateImageView"/>
<command name="vkDestroyImageView"/>
</require>
<require comment="Shader commands">
+ <type name="VkShaderModule"/>
+ <type name="VkShaderModuleCreateFlags"/>
+ <type name="VkShaderModuleCreateInfo"/>
<command name="vkCreateShaderModule"/>
<command name="vkDestroyShaderModule"/>
</require>
<require comment="Pipeline Cache commands">
+ <type name="VkPipelineCache"/>
+ <type name="VkPipelineCacheCreateFlags" comment="VkPipelineCacheCreateFlagBits was added later"/>
+ <type name="VkPipelineCacheCreateInfo"/>
<command name="vkCreatePipelineCache"/>
<command name="vkDestroyPipelineCache"/>
<command name="vkGetPipelineCacheData"/>
<command name="vkMergePipelineCaches"/>
</require>
<require comment="Pipeline commands">
+ <type name="VkBlendFactor"/>
+ <type name="VkBlendOp"/>
+ <type name="VkColorComponentFlagBits"/>
+ <type name="VkColorComponentFlags"/>
+ <type name="VkCompareOp"/>
+ <type name="VkComputePipelineCreateInfo"/>
+ <type name="VkCullModeFlagBits"/>
+ <type name="VkCullModeFlags"/>
+ <type name="VkDynamicState"/>
+ <type name="VkFrontFace"/>
+ <type name="VkGraphicsPipelineCreateInfo"/>
+ <type name="VkLogicOp"/>
+ <type name="VkPipeline"/>
+ <type name="VkPipelineColorBlendAttachmentState"/>
+ <type name="VkPipelineColorBlendStateCreateFlags" comment="Will add VkPipeline*StateFlagBits when bits are defined in the future"/>
+ <type name="VkPipelineColorBlendStateCreateInfo"/>
+ <type name="VkPipelineCreateFlagBits"/>
+ <type name="VkPipelineCreateFlags"/>
+ <type name="VkPipelineDepthStencilStateCreateFlags" comment="Will add VkPipeline*StateFlagBits when bits are defined in the future"/>
+ <type name="VkPipelineDepthStencilStateCreateInfo"/>
+ <type name="VkPipelineDynamicStateCreateFlags" comment="Will add VkPipeline*StateFlagBits when bits are defined in the future"/>
+ <type name="VkPipelineDynamicStateCreateInfo"/>
+ <type name="VkPipelineInputAssemblyStateCreateFlags" comment="Will add VkPipeline*StateFlagBits when bits are defined in the future"/>
+ <type name="VkPipelineInputAssemblyStateCreateInfo"/>
+ <type name="VkPipelineLayoutCreateFlags" comment="Will add VkPipelineLayoutCreateFlagBits when bits are defined in the future"/>
+ <type name="VkPipelineMultisampleStateCreateFlags" comment="Will add VkPipelineMultisampleStateCreateFlagBits when bits are defined in the future"/>
+ <type name="VkPipelineMultisampleStateCreateInfo"/>
+ <type name="VkPipelineRasterizationStateCreateFlags" comment="Will add VkPipelineRasterizationStateCreateFlagBits when bits are defined in the future"/>
+ <type name="VkPipelineRasterizationStateCreateInfo"/>
+ <type name="VkPipelineShaderStageCreateFlagBits"/>
+ <type name="VkPipelineShaderStageCreateFlags"/>
+ <type name="VkPipelineShaderStageCreateInfo"/>
+ <type name="VkPipelineTessellationStateCreateFlags" comment="Will add VkPipelineTessellationStateCreateFlagBits when bits are defined in the future"/>
+ <type name="VkPipelineTessellationStateCreateInfo"/>
+ <type name="VkPipelineVertexInputStateCreateFlags" comment="Will add VkPipelineVertexInputStateCreateFlagBits when bits are defined in the future"/>
+ <type name="VkPipelineVertexInputStateCreateInfo"/>
+ <type name="VkPipelineViewportStateCreateFlags" comment="Will add VkPipelineViewportStateCreateFlagBits when bits are defined in the future"/>
+ <type name="VkPipelineViewportStateCreateInfo"/>
+ <type name="VkPolygonMode"/>
+ <type name="VkPrimitiveTopology"/>
+ <type name="VkSampleMask"/>
+ <type name="VkShaderStageFlagBits"/>
+ <type name="VkShaderStageFlags"/>
+ <type name="VkSpecializationInfo"/>
+ <type name="VkSpecializationMapEntry"/>
+ <type name="VkStencilOp"/>
+ <type name="VkStencilOpState"/>
+ <type name="VkVertexInputAttributeDescription"/>
+ <type name="VkVertexInputBindingDescription"/>
+ <type name="VkVertexInputRate"/>
+ <type name="VkViewport"/>
<command name="vkCreateGraphicsPipelines"/>
<command name="vkCreateComputePipelines"/>
<command name="vkDestroyPipeline"/>
</require>
<require comment="Pipeline layout commands">
+ <type name="VkPipelineLayout"/>
+ <type name="VkPipelineLayoutCreateInfo"/>
+ <type name="VkPushConstantRange"/>
<command name="vkCreatePipelineLayout"/>
<command name="vkDestroyPipelineLayout"/>
</require>
<require comment="Sampler commands">
+ <type name="VkBorderColor"/>
+ <type name="VkFilter"/>
+ <type name="VkSampler"/>
+ <type name="VkSamplerAddressMode"/>
+ <type name="VkSamplerCreateFlagBits"/>
+ <type name="VkSamplerCreateFlags"/>
+ <type name="VkSamplerCreateInfo"/>
+ <type name="VkSamplerMipmapMode"/>
<command name="vkCreateSampler"/>
<command name="vkDestroySampler"/>
</require>
<require comment="Descriptor set commands">
+ <type name="VkCopyDescriptorSet"/>
+ <type name="VkDescriptorBufferInfo"/>
+ <type name="VkDescriptorImageInfo"/>
+ <type name="VkDescriptorPool"/>
+ <type name="VkDescriptorPoolCreateFlagBits"/>
+ <type name="VkDescriptorPoolCreateFlags"/>
+ <type name="VkDescriptorPoolCreateInfo"/>
+ <type name="VkDescriptorPoolResetFlags"/>
+ <type name="VkDescriptorPoolSize"/>
+ <type name="VkDescriptorSet"/>
+ <type name="VkDescriptorSetAllocateInfo"/>
+ <type name="VkDescriptorSetLayout"/>
+ <type name="VkDescriptorSetLayoutBinding"/>
+ <type name="VkDescriptorSetLayoutCreateFlagBits"/>
+ <type name="VkDescriptorSetLayoutCreateFlags"/>
+ <type name="VkDescriptorSetLayoutCreateInfo"/>
+ <type name="VkDescriptorType"/>
+ <type name="VkWriteDescriptorSet"/>
<command name="vkCreateDescriptorSetLayout"/>
<command name="vkDestroyDescriptorSetLayout"/>
<command name="vkCreateDescriptorPool"/>
@@ -4241,6 +12579,29 @@ maintained in the master branch of the Khronos Vulkan GitHub project.
<command name="vkUpdateDescriptorSets"/>
</require>
<require comment="Pass commands">
+ <type name="VkAccessFlagBits"/>
+ <type name="VkAccessFlags"/>
+ <type name="VkAttachmentDescription"/>
+ <type name="VkAttachmentDescriptionFlagBits"/>
+ <type name="VkAttachmentDescriptionFlags"/>
+ <type name="VkAttachmentLoadOp"/>
+ <type name="VkAttachmentReference"/>
+ <type name="VkAttachmentStoreOp"/>
+ <type name="VkDependencyFlagBits"/>
+ <type name="VkDependencyFlags"/>
+ <type name="VkFramebuffer"/>
+ <type name="VkFramebufferCreateFlagBits"/>
+ <type name="VkFramebufferCreateFlags"/>
+ <type name="VkFramebufferCreateInfo"/>
+ <type name="VkPipelineBindPoint"/>
+ <type name="VkRenderPass"/>
+ <type name="VkRenderPassCreateFlagBits"/>
+ <type name="VkRenderPassCreateFlags"/>
+ <type name="VkRenderPassCreateInfo"/>
+ <type name="VkSubpassDependency"/>
+ <type name="VkSubpassDescription"/>
+ <type name="VkSubpassDescriptionFlagBits"/>
+ <type name="VkSubpassDescriptionFlags"/>
<command name="vkCreateFramebuffer"/>
<command name="vkDestroyFramebuffer"/>
<command name="vkCreateRenderPass"/>
@@ -4248,11 +12609,28 @@ maintained in the master branch of the Khronos Vulkan GitHub project.
<command name="vkGetRenderAreaGranularity"/>
</require>
<require comment="Command pool commands">
+ <type name="VkCommandPool"/>
+ <type name="VkCommandPoolCreateFlagBits"/>
+ <type name="VkCommandPoolCreateFlags"/>
+ <type name="VkCommandPoolCreateInfo"/>
+ <type name="VkCommandPoolResetFlagBits"/>
+ <type name="VkCommandPoolResetFlags"/>
<command name="vkCreateCommandPool"/>
<command name="vkDestroyCommandPool"/>
<command name="vkResetCommandPool"/>
</require>
<require comment="Command buffer commands">
+ <type name="VkCommandBuffer"/>
+ <type name="VkCommandBufferAllocateInfo"/>
+ <type name="VkCommandBufferBeginInfo"/>
+ <type name="VkCommandBufferInheritanceInfo"/>
+ <type name="VkCommandBufferLevel"/>
+ <type name="VkCommandBufferResetFlagBits"/>
+ <type name="VkCommandBufferResetFlags"/>
+ <type name="VkCommandBufferUsageFlagBits"/>
+ <type name="VkCommandBufferUsageFlags"/>
+ <type name="VkQueryControlFlagBits"/>
+ <type name="VkQueryControlFlags"/>
<command name="vkAllocateCommandBuffers"/>
<command name="vkFreeCommandBuffers"/>
<command name="vkBeginCommandBuffer"/>
@@ -4260,6 +12638,22 @@ maintained in the master branch of the Khronos Vulkan GitHub project.
<command name="vkResetCommandBuffer"/>
</require>
<require comment="Command buffer building commands">
+ <type name="VkBufferCopy"/>
+ <type name="VkBufferImageCopy"/>
+ <type name="VkClearAttachment"/>
+ <type name="VkClearColorValue"/>
+ <type name="VkClearDepthStencilValue"/>
+ <type name="VkClearRect"/>
+ <type name="VkClearValue"/>
+ <type name="VkImageBlit"/>
+ <type name="VkImageCopy"/>
+ <type name="VkImageResolve"/>
+ <type name="VkImageSubresourceLayers"/>
+ <type name="VkIndexType"/>
+ <type name="VkRenderPassBeginInfo"/>
+ <type name="VkStencilFaceFlagBits"/>
+ <type name="VkStencilFaceFlags"/>
+ <type name="VkSubpassContents"/>
<command name="vkCmdBindPipeline"/>
<command name="vkCmdSetViewport"/>
<command name="vkCmdSetScissor"/>
@@ -4305,30 +12699,815 @@ maintained in the master branch of the Khronos Vulkan GitHub project.
<command name="vkCmdEndRenderPass"/>
<command name="vkCmdExecuteCommands"/>
</require>
- <require comment="Types not directly used by the API">
- <!-- Include <type name="typename"/> here for e.g. structs that
- are not parameter types of commands, but still need to be
- defined in the API.
- -->
- <type name="VkBufferMemoryBarrier"/>
- <type name="VkDispatchIndirectCommand"/>
- <type name="VkDrawIndexedIndirectCommand"/>
- <type name="VkDrawIndirectCommand"/>
- <type name="VkImageMemoryBarrier"/>
- <type name="VkMemoryBarrier"/>
+ </feature>
+ <feature api="vulkan" name="VK_VERSION_1_1" number="1.1" comment="Vulkan 1.1 core API interface definitions.">
+ <require>
+ <type name="VK_API_VERSION_1_1"/>
+ </require>
+ <require comment="Device Initialization">
+ <command name="vkEnumerateInstanceVersion"/>
+ </require>
+ <require comment="Promoted from VK_KHR_relaxed_block_layout, which has no API"/>
+ <require comment="Promoted from VK_KHR_storage_buffer_storage_class, which has no API"/>
+ <require comment="Originally based on VK_KHR_subgroup (extension 94), but the actual enum block used was, incorrectly, that of extension 95">
+ <enum extends="VkStructureType" extnumber="95" offset="0" name="VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_SUBGROUP_PROPERTIES"/>
+ <type name="VkPhysicalDeviceSubgroupProperties"/>
+ <type name="VkSubgroupFeatureFlags"/>
+ <type name="VkSubgroupFeatureFlagBits"/>
+ </require>
+ <require comment="Promoted from VK_KHR_bind_memory2">
+ <command name="vkBindBufferMemory2"/>
+ <command name="vkBindImageMemory2"/>
+ <enum extends="VkStructureType" extnumber="158" offset="0" name="VK_STRUCTURE_TYPE_BIND_BUFFER_MEMORY_INFO"/>
+ <enum extends="VkStructureType" extnumber="158" offset="1" name="VK_STRUCTURE_TYPE_BIND_IMAGE_MEMORY_INFO"/>
+ <enum bitpos="10" extends="VkImageCreateFlagBits" name="VK_IMAGE_CREATE_ALIAS_BIT"/>
+ <type name="VkBindBufferMemoryInfo"/>
+ <type name="VkBindImageMemoryInfo"/>
+ </require>
+ <require comment="Promoted from VK_KHR_16bit_storage">
+ <enum extends="VkStructureType" extnumber="84" offset="0" name="VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_16BIT_STORAGE_FEATURES"/>
+ <type name="VkPhysicalDevice16BitStorageFeatures"/>
+ </require>
+ <require comment="Promoted from VK_KHR_dedicated_allocation">
+ <enum extends="VkStructureType" extnumber="128" offset="0" name="VK_STRUCTURE_TYPE_MEMORY_DEDICATED_REQUIREMENTS"/>
+ <enum extends="VkStructureType" extnumber="128" offset="1" name="VK_STRUCTURE_TYPE_MEMORY_DEDICATED_ALLOCATE_INFO"/>
+ <type name="VkMemoryDedicatedRequirements"/>
+ <type name="VkMemoryDedicatedAllocateInfo"/>
+ </require>
+ <require comment="Promoted from VK_KHR_device_group">
+ <enum extends="VkStructureType" extnumber="61" offset="0" name="VK_STRUCTURE_TYPE_MEMORY_ALLOCATE_FLAGS_INFO"/>
+ <comment>offset 1 reserved for the old VK_STRUCTURE_TYPE_BIND_BUFFER_MEMORY_INFO_KHX enum</comment>
+ <comment>offset 2 reserved for the old VK_STRUCTURE_TYPE_BIND_IMAGE_MEMORY_INFO_KHX enum</comment>
+ <enum extends="VkStructureType" extnumber="61" offset="3" name="VK_STRUCTURE_TYPE_DEVICE_GROUP_RENDER_PASS_BEGIN_INFO"/>
+ <enum extends="VkStructureType" extnumber="61" offset="4" name="VK_STRUCTURE_TYPE_DEVICE_GROUP_COMMAND_BUFFER_BEGIN_INFO"/>
+ <enum extends="VkStructureType" extnumber="61" offset="5" name="VK_STRUCTURE_TYPE_DEVICE_GROUP_SUBMIT_INFO"/>
+ <enum extends="VkStructureType" extnumber="61" offset="6" name="VK_STRUCTURE_TYPE_DEVICE_GROUP_BIND_SPARSE_INFO"/>
+ <type name="VkPeerMemoryFeatureFlags"/>
+ <type name="VkPeerMemoryFeatureFlagBits"/>
+ <type name="VkMemoryAllocateFlags"/>
+ <type name="VkMemoryAllocateFlagBits"/>
+ <type name="VkMemoryAllocateFlagsInfo"/>
+ <type name="VkDeviceGroupRenderPassBeginInfo"/>
+ <type name="VkDeviceGroupCommandBufferBeginInfo"/>
+ <type name="VkDeviceGroupSubmitInfo"/>
+ <type name="VkDeviceGroupBindSparseInfo"/>
+ <command name="vkGetDeviceGroupPeerMemoryFeatures"/>
+ <command name="vkCmdSetDeviceMask"/>
+ <command name="vkCmdDispatchBase"/>
+ <enum bitpos="3" extends="VkPipelineCreateFlagBits" name="VK_PIPELINE_CREATE_VIEW_INDEX_FROM_DEVICE_INDEX_BIT"/>
+ <enum bitpos="4" extends="VkPipelineCreateFlagBits" name="VK_PIPELINE_CREATE_DISPATCH_BASE_BIT"/>
+ <enum extends="VkPipelineCreateFlagBits" name="VK_PIPELINE_CREATE_DISPATCH_BASE" alias="VK_PIPELINE_CREATE_DISPATCH_BASE_BIT"/>
+ <enum bitpos="2" extends="VkDependencyFlagBits" name="VK_DEPENDENCY_DEVICE_GROUP_BIT" comment="Dependency is across devices"/>
+ </require>
+ <require comment="Promoted from VK_KHR_device_group + VK_KHR_bind_memory2">
+ <enum extends="VkStructureType" extnumber="61" offset="13" name="VK_STRUCTURE_TYPE_BIND_BUFFER_MEMORY_DEVICE_GROUP_INFO"/>
+ <enum extends="VkStructureType" extnumber="61" offset="14" name="VK_STRUCTURE_TYPE_BIND_IMAGE_MEMORY_DEVICE_GROUP_INFO"/>
+ <type name="VkBindBufferMemoryDeviceGroupInfo"/>
+ <type name="VkBindImageMemoryDeviceGroupInfo"/>
+ <enum bitpos="6" extends="VkImageCreateFlagBits" name="VK_IMAGE_CREATE_SPLIT_INSTANCE_BIND_REGIONS_BIT" comment="Allows using VkBindImageMemoryDeviceGroupInfo::pSplitInstanceBindRegions when binding memory to the image"/>
+ </require>
+ <require comment="Promoted from VK_KHR_device_group_creation">
+ <enum extends="VkStructureType" extnumber="71" offset="0" name="VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_GROUP_PROPERTIES"/>
+ <enum extends="VkStructureType" extnumber="71" offset="1" name="VK_STRUCTURE_TYPE_DEVICE_GROUP_DEVICE_CREATE_INFO"/>
+ <enum name="VK_MAX_DEVICE_GROUP_SIZE"/>
+ <type name="VkPhysicalDeviceGroupProperties"/>
+ <type name="VkDeviceGroupDeviceCreateInfo"/>
+ <command name="vkEnumeratePhysicalDeviceGroups"/>
+ <enum bitpos="1" extends="VkMemoryHeapFlagBits" name="VK_MEMORY_HEAP_MULTI_INSTANCE_BIT" comment="If set, heap allocations allocate multiple instances by default"/>
+ </require>
+ <require comment="Promoted from VK_KHR_get_memory_requirements2">
+ <enum extends="VkStructureType" extnumber="147" offset="0" name="VK_STRUCTURE_TYPE_BUFFER_MEMORY_REQUIREMENTS_INFO_2"/>
+ <enum extends="VkStructureType" extnumber="147" offset="1" name="VK_STRUCTURE_TYPE_IMAGE_MEMORY_REQUIREMENTS_INFO_2"/>
+ <enum extends="VkStructureType" extnumber="147" offset="2" name="VK_STRUCTURE_TYPE_IMAGE_SPARSE_MEMORY_REQUIREMENTS_INFO_2"/>
+ <enum extends="VkStructureType" extnumber="147" offset="3" name="VK_STRUCTURE_TYPE_MEMORY_REQUIREMENTS_2"/>
+ <enum extends="VkStructureType" extnumber="147" offset="4" name="VK_STRUCTURE_TYPE_SPARSE_IMAGE_MEMORY_REQUIREMENTS_2"/>
+ <type name="VkBufferMemoryRequirementsInfo2"/>
+ <type name="VkImageMemoryRequirementsInfo2"/>
+ <type name="VkImageSparseMemoryRequirementsInfo2"/>
+ <type name="VkMemoryRequirements2"/>
+ <type name="VkSparseImageMemoryRequirements2"/>
+ <command name="vkGetImageMemoryRequirements2"/>
+ <command name="vkGetBufferMemoryRequirements2"/>
+ <command name="vkGetImageSparseMemoryRequirements2"/>
+ </require>
+ <require comment="Promoted from VK_KHR_get_physical_device_properties2">
+ <enum extends="VkStructureType" extnumber="60" offset="0" name="VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_FEATURES_2"/>
+ <enum extends="VkStructureType" extnumber="60" offset="1" name="VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_PROPERTIES_2"/>
+ <enum extends="VkStructureType" extnumber="60" offset="2" name="VK_STRUCTURE_TYPE_FORMAT_PROPERTIES_2"/>
+ <enum extends="VkStructureType" extnumber="60" offset="3" name="VK_STRUCTURE_TYPE_IMAGE_FORMAT_PROPERTIES_2"/>
+ <enum extends="VkStructureType" extnumber="60" offset="4" name="VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_IMAGE_FORMAT_INFO_2"/>
+ <enum extends="VkStructureType" extnumber="60" offset="5" name="VK_STRUCTURE_TYPE_QUEUE_FAMILY_PROPERTIES_2"/>
+ <enum extends="VkStructureType" extnumber="60" offset="6" name="VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_MEMORY_PROPERTIES_2"/>
+ <enum extends="VkStructureType" extnumber="60" offset="7" name="VK_STRUCTURE_TYPE_SPARSE_IMAGE_FORMAT_PROPERTIES_2"/>
+ <enum extends="VkStructureType" extnumber="60" offset="8" name="VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_SPARSE_IMAGE_FORMAT_INFO_2"/>
+ <type name="VkPhysicalDeviceFeatures2"/>
+ <type name="VkPhysicalDeviceProperties2"/>
+ <type name="VkFormatProperties2"/>
+ <type name="VkImageFormatProperties2"/>
+ <type name="VkPhysicalDeviceImageFormatInfo2"/>
+ <type name="VkQueueFamilyProperties2"/>
+ <type name="VkPhysicalDeviceMemoryProperties2"/>
+ <type name="VkSparseImageFormatProperties2"/>
+ <type name="VkPhysicalDeviceSparseImageFormatInfo2"/>
+ <command name="vkGetPhysicalDeviceFeatures2"/>
+ <command name="vkGetPhysicalDeviceProperties2"/>
+ <command name="vkGetPhysicalDeviceFormatProperties2"/>
+ <command name="vkGetPhysicalDeviceImageFormatProperties2"/>
+ <command name="vkGetPhysicalDeviceQueueFamilyProperties2"/>
+ <command name="vkGetPhysicalDeviceMemoryProperties2"/>
+ <command name="vkGetPhysicalDeviceSparseImageFormatProperties2"/>
+ </require>
+ <require comment="Promoted from VK_KHR_maintenance1">
+ <enum extends="VkResult" extnumber="70" offset="0" dir="-" name="VK_ERROR_OUT_OF_POOL_MEMORY"/>
+ <enum bitpos="14" extends="VkFormatFeatureFlagBits" name="VK_FORMAT_FEATURE_TRANSFER_SRC_BIT" comment="Format can be used as the source image of image transfer commands"/>
+ <enum bitpos="15" extends="VkFormatFeatureFlagBits" name="VK_FORMAT_FEATURE_TRANSFER_DST_BIT" comment="Format can be used as the destination image of image transfer commands"/>
+ <enum bitpos="5" extends="VkImageCreateFlagBits" name="VK_IMAGE_CREATE_2D_ARRAY_COMPATIBLE_BIT" comment="The 3D image can be viewed as a 2D or 2D array image"/>
+ <command name="vkTrimCommandPool"/>
+ <comment>Additional dependent types / tokens extending enumerants, not explicitly mentioned</comment>
+ <type name="VkCommandPoolTrimFlags"/>
+ </require>
+ <require comment="Promoted from VK_KHR_maintenance2">
+ <enum bitpos="7" extends="VkImageCreateFlagBits" name="VK_IMAGE_CREATE_BLOCK_TEXEL_VIEW_COMPATIBLE_BIT"/>
+ <enum bitpos="8" extends="VkImageCreateFlagBits" name="VK_IMAGE_CREATE_EXTENDED_USAGE_BIT"/>
+ <enum extends="VkStructureType" extnumber="118" offset="0" name="VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_POINT_CLIPPING_PROPERTIES"/>
+ <enum extends="VkStructureType" extnumber="118" offset="1" name="VK_STRUCTURE_TYPE_RENDER_PASS_INPUT_ATTACHMENT_ASPECT_CREATE_INFO"/>
+ <enum extends="VkStructureType" extnumber="118" offset="2" name="VK_STRUCTURE_TYPE_IMAGE_VIEW_USAGE_CREATE_INFO"/>
+ <enum extends="VkStructureType" extnumber="118" offset="3" name="VK_STRUCTURE_TYPE_PIPELINE_TESSELLATION_DOMAIN_ORIGIN_STATE_CREATE_INFO"/>
+ <enum extends="VkImageLayout" extnumber="118" offset="0" name="VK_IMAGE_LAYOUT_DEPTH_READ_ONLY_STENCIL_ATTACHMENT_OPTIMAL"/>
+ <enum extends="VkImageLayout" extnumber="118" offset="1" name="VK_IMAGE_LAYOUT_DEPTH_ATTACHMENT_STENCIL_READ_ONLY_OPTIMAL"/>
+ <type name="VkPhysicalDevicePointClippingProperties"/>
+ <type name="VkPointClippingBehavior"/>
+ <type name="VkRenderPassInputAttachmentAspectCreateInfo"/>
+ <type name="VkInputAttachmentAspectReference"/>
+ <type name="VkImageViewUsageCreateInfo"/>
+ <type name="VkTessellationDomainOrigin"/>
+ <type name="VkPipelineTessellationDomainOriginStateCreateInfo"/>
+ </require>
+ <require comment="Promoted from VK_KHR_multiview">
+ <enum extends="VkStructureType" extnumber="54" offset="0" name="VK_STRUCTURE_TYPE_RENDER_PASS_MULTIVIEW_CREATE_INFO"/>
+ <enum extends="VkStructureType" extnumber="54" offset="1" name="VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_MULTIVIEW_FEATURES"/>
+ <enum extends="VkStructureType" extnumber="54" offset="2" name="VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_MULTIVIEW_PROPERTIES"/>
+ <enum bitpos="1" extends="VkDependencyFlagBits" name="VK_DEPENDENCY_VIEW_LOCAL_BIT"/>
+ <type name="VkRenderPassMultiviewCreateInfo"/>
+ <type name="VkPhysicalDeviceMultiviewFeatures"/>
+ <type name="VkPhysicalDeviceMultiviewProperties"/>
+ </require>
+ <require comment="Promoted from VK_KHR_variable_pointers">
+ <enum extends="VkStructureType" extnumber="121" offset="0" name="VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_VARIABLE_POINTERS_FEATURES"/>
+ <enum extends="VkStructureType" name="VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_VARIABLE_POINTER_FEATURES" alias="VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_VARIABLE_POINTERS_FEATURES"/>
+ <type name="VkPhysicalDeviceVariablePointerFeatures"/>
+ <type name="VkPhysicalDeviceVariablePointersFeatures"/>
+ </require>
+ <require comment="Originally based on VK_KHR_protected_memory (extension 146), which was never published; thus the mystifying large value= numbers below. These are not aliased since they were not actually promoted from an extension.">
+ <enum extends="VkStructureType" extnumber="146" offset="0" name="VK_STRUCTURE_TYPE_PROTECTED_SUBMIT_INFO"/>
+ <enum extends="VkStructureType" extnumber="146" offset="1" name="VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_PROTECTED_MEMORY_FEATURES"/>
+ <enum extends="VkStructureType" extnumber="146" offset="2" name="VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_PROTECTED_MEMORY_PROPERTIES"/>
+ <enum extends="VkStructureType" extnumber="146" offset="3" name="VK_STRUCTURE_TYPE_DEVICE_QUEUE_INFO_2"/>
+ <enum bitpos="4" extends="VkQueueFlagBits" name="VK_QUEUE_PROTECTED_BIT" comment="Queues may support protected operations"/>
+ <enum bitpos="0" extends="VkDeviceQueueCreateFlagBits" name="VK_DEVICE_QUEUE_CREATE_PROTECTED_BIT" comment="Queue is a protected-capable device queue"/>
+ <type name="VkDeviceQueueCreateFlagBits" comment="This is a temporary workaround for processors not recognizing that VK_DEVICE_QUEUE_CREATE_PROTECTED_BIT above also requires this type"/>
+ <enum bitpos="5" extends="VkMemoryPropertyFlagBits" name="VK_MEMORY_PROPERTY_PROTECTED_BIT" comment="Memory is protected"/>
+ <enum bitpos="3" extends="VkBufferCreateFlagBits" name="VK_BUFFER_CREATE_PROTECTED_BIT" comment="Buffer requires protected memory"/>
+ <enum bitpos="11" extends="VkImageCreateFlagBits" name="VK_IMAGE_CREATE_PROTECTED_BIT" comment="Image requires protected memory"/>
+ <enum bitpos="2" extends="VkCommandPoolCreateFlagBits" name="VK_COMMAND_POOL_CREATE_PROTECTED_BIT" comment="Command buffers allocated from pool are protected command buffers"/>
+ <type name="VkPhysicalDeviceProtectedMemoryFeatures"/>
+ <type name="VkPhysicalDeviceProtectedMemoryProperties"/>
+ <type name="VkDeviceQueueInfo2"/>
+ <type name="VkProtectedSubmitInfo"/>
+ <command name="vkGetDeviceQueue2"/>
+ </require>
+ <require comment="Promoted from VK_KHR_sampler_ycbcr_conversion">
+ <enum extends="VkStructureType" extnumber="157" offset="0" name="VK_STRUCTURE_TYPE_SAMPLER_YCBCR_CONVERSION_CREATE_INFO"/>
+ <enum extends="VkStructureType" extnumber="157" offset="1" name="VK_STRUCTURE_TYPE_SAMPLER_YCBCR_CONVERSION_INFO"/>
+ <enum extends="VkStructureType" extnumber="157" offset="2" name="VK_STRUCTURE_TYPE_BIND_IMAGE_PLANE_MEMORY_INFO"/>
+ <enum extends="VkStructureType" extnumber="157" offset="3" name="VK_STRUCTURE_TYPE_IMAGE_PLANE_MEMORY_REQUIREMENTS_INFO"/>
+ <enum extends="VkStructureType" extnumber="157" offset="4" name="VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_SAMPLER_YCBCR_CONVERSION_FEATURES"/>
+ <enum extends="VkStructureType" extnumber="157" offset="5" name="VK_STRUCTURE_TYPE_SAMPLER_YCBCR_CONVERSION_IMAGE_FORMAT_PROPERTIES"/>
+ <enum extends="VkObjectType" extnumber="157" offset="0" name="VK_OBJECT_TYPE_SAMPLER_YCBCR_CONVERSION"/>
+ <enum extends="VkFormat" extnumber="157" offset="0" name="VK_FORMAT_G8B8G8R8_422_UNORM"/>
+ <enum extends="VkFormat" extnumber="157" offset="1" name="VK_FORMAT_B8G8R8G8_422_UNORM"/>
+ <enum extends="VkFormat" extnumber="157" offset="2" name="VK_FORMAT_G8_B8_R8_3PLANE_420_UNORM"/>
+ <enum extends="VkFormat" extnumber="157" offset="3" name="VK_FORMAT_G8_B8R8_2PLANE_420_UNORM"/>
+ <enum extends="VkFormat" extnumber="157" offset="4" name="VK_FORMAT_G8_B8_R8_3PLANE_422_UNORM"/>
+ <enum extends="VkFormat" extnumber="157" offset="5" name="VK_FORMAT_G8_B8R8_2PLANE_422_UNORM"/>
+ <enum extends="VkFormat" extnumber="157" offset="6" name="VK_FORMAT_G8_B8_R8_3PLANE_444_UNORM"/>
+ <enum extends="VkFormat" extnumber="157" offset="7" name="VK_FORMAT_R10X6_UNORM_PACK16"/>
+ <enum extends="VkFormat" extnumber="157" offset="8" name="VK_FORMAT_R10X6G10X6_UNORM_2PACK16"/>
+ <enum extends="VkFormat" extnumber="157" offset="9" name="VK_FORMAT_R10X6G10X6B10X6A10X6_UNORM_4PACK16"/>
+ <enum extends="VkFormat" extnumber="157" offset="10" name="VK_FORMAT_G10X6B10X6G10X6R10X6_422_UNORM_4PACK16"/>
+ <enum extends="VkFormat" extnumber="157" offset="11" name="VK_FORMAT_B10X6G10X6R10X6G10X6_422_UNORM_4PACK16"/>
+ <enum extends="VkFormat" extnumber="157" offset="12" name="VK_FORMAT_G10X6_B10X6_R10X6_3PLANE_420_UNORM_3PACK16"/>
+ <enum extends="VkFormat" extnumber="157" offset="13" name="VK_FORMAT_G10X6_B10X6R10X6_2PLANE_420_UNORM_3PACK16"/>
+ <enum extends="VkFormat" extnumber="157" offset="14" name="VK_FORMAT_G10X6_B10X6_R10X6_3PLANE_422_UNORM_3PACK16"/>
+ <enum extends="VkFormat" extnumber="157" offset="15" name="VK_FORMAT_G10X6_B10X6R10X6_2PLANE_422_UNORM_3PACK16"/>
+ <enum extends="VkFormat" extnumber="157" offset="16" name="VK_FORMAT_G10X6_B10X6_R10X6_3PLANE_444_UNORM_3PACK16"/>
+ <enum extends="VkFormat" extnumber="157" offset="17" name="VK_FORMAT_R12X4_UNORM_PACK16"/>
+ <enum extends="VkFormat" extnumber="157" offset="18" name="VK_FORMAT_R12X4G12X4_UNORM_2PACK16"/>
+ <enum extends="VkFormat" extnumber="157" offset="19" name="VK_FORMAT_R12X4G12X4B12X4A12X4_UNORM_4PACK16"/>
+ <enum extends="VkFormat" extnumber="157" offset="20" name="VK_FORMAT_G12X4B12X4G12X4R12X4_422_UNORM_4PACK16"/>
+ <enum extends="VkFormat" extnumber="157" offset="21" name="VK_FORMAT_B12X4G12X4R12X4G12X4_422_UNORM_4PACK16"/>
+ <enum extends="VkFormat" extnumber="157" offset="22" name="VK_FORMAT_G12X4_B12X4_R12X4_3PLANE_420_UNORM_3PACK16"/>
+ <enum extends="VkFormat" extnumber="157" offset="23" name="VK_FORMAT_G12X4_B12X4R12X4_2PLANE_420_UNORM_3PACK16"/>
+ <enum extends="VkFormat" extnumber="157" offset="24" name="VK_FORMAT_G12X4_B12X4_R12X4_3PLANE_422_UNORM_3PACK16"/>
+ <enum extends="VkFormat" extnumber="157" offset="25" name="VK_FORMAT_G12X4_B12X4R12X4_2PLANE_422_UNORM_3PACK16"/>
+ <enum extends="VkFormat" extnumber="157" offset="26" name="VK_FORMAT_G12X4_B12X4_R12X4_3PLANE_444_UNORM_3PACK16"/>
+ <enum extends="VkFormat" extnumber="157" offset="27" name="VK_FORMAT_G16B16G16R16_422_UNORM"/>
+ <enum extends="VkFormat" extnumber="157" offset="28" name="VK_FORMAT_B16G16R16G16_422_UNORM"/>
+ <enum extends="VkFormat" extnumber="157" offset="29" name="VK_FORMAT_G16_B16_R16_3PLANE_420_UNORM"/>
+ <enum extends="VkFormat" extnumber="157" offset="30" name="VK_FORMAT_G16_B16R16_2PLANE_420_UNORM"/>
+ <enum extends="VkFormat" extnumber="157" offset="31" name="VK_FORMAT_G16_B16_R16_3PLANE_422_UNORM"/>
+ <enum extends="VkFormat" extnumber="157" offset="32" name="VK_FORMAT_G16_B16R16_2PLANE_422_UNORM"/>
+ <enum extends="VkFormat" extnumber="157" offset="33" name="VK_FORMAT_G16_B16_R16_3PLANE_444_UNORM"/>
+ <enum bitpos="4" extends="VkImageAspectFlagBits" name="VK_IMAGE_ASPECT_PLANE_0_BIT"/>
+ <enum bitpos="5" extends="VkImageAspectFlagBits" name="VK_IMAGE_ASPECT_PLANE_1_BIT"/>
+ <enum bitpos="6" extends="VkImageAspectFlagBits" name="VK_IMAGE_ASPECT_PLANE_2_BIT"/>
+ <enum bitpos="9" extends="VkImageCreateFlagBits" name="VK_IMAGE_CREATE_DISJOINT_BIT"/>
+ <enum bitpos="17" extends="VkFormatFeatureFlagBits" name="VK_FORMAT_FEATURE_MIDPOINT_CHROMA_SAMPLES_BIT" comment="Format can have midpoint rather than cosited chroma samples"/>
+ <enum bitpos="18" extends="VkFormatFeatureFlagBits" name="VK_FORMAT_FEATURE_SAMPLED_IMAGE_YCBCR_CONVERSION_LINEAR_FILTER_BIT" comment="Format can be used with linear filtering whilst color conversion is enabled"/>
+ <enum bitpos="19" extends="VkFormatFeatureFlagBits" name="VK_FORMAT_FEATURE_SAMPLED_IMAGE_YCBCR_CONVERSION_SEPARATE_RECONSTRUCTION_FILTER_BIT" comment="Format can have different chroma, min and mag filters"/>
+ <enum bitpos="20" extends="VkFormatFeatureFlagBits" name="VK_FORMAT_FEATURE_SAMPLED_IMAGE_YCBCR_CONVERSION_CHROMA_RECONSTRUCTION_EXPLICIT_BIT"/>
+ <enum bitpos="21" extends="VkFormatFeatureFlagBits" name="VK_FORMAT_FEATURE_SAMPLED_IMAGE_YCBCR_CONVERSION_CHROMA_RECONSTRUCTION_EXPLICIT_FORCEABLE_BIT"/>
+ <enum bitpos="22" extends="VkFormatFeatureFlagBits" name="VK_FORMAT_FEATURE_DISJOINT_BIT" comment="Format supports disjoint planes"/>
+ <enum bitpos="23" extends="VkFormatFeatureFlagBits" name="VK_FORMAT_FEATURE_COSITED_CHROMA_SAMPLES_BIT" comment="Format can have cosited rather than midpoint chroma samples"/>
+ <type name="VkSamplerYcbcrConversionCreateInfo"/>
+ <type name="VkSamplerYcbcrConversionInfo"/>
+ <type name="VkBindImagePlaneMemoryInfo"/>
+ <type name="VkImagePlaneMemoryRequirementsInfo"/>
+ <type name="VkPhysicalDeviceSamplerYcbcrConversionFeatures"/>
+ <type name="VkSamplerYcbcrConversionImageFormatProperties"/>
+ <command name="vkCreateSamplerYcbcrConversion"/>
+ <command name="vkDestroySamplerYcbcrConversion"/>
+ <comment>Additional dependent types / tokens extending enumerants, not explicitly mentioned</comment>
+ <type name="VkSamplerYcbcrConversion"/>
+ <type name="VkSamplerYcbcrModelConversion"/>
+ <type name="VkSamplerYcbcrRange"/>
+ <type name="VkChromaLocation"/>
+ </require>
+ <require comment="Promoted from VK_KHR_descriptor_update_template">
+ <enum extends="VkStructureType" extnumber="86" offset="0" name="VK_STRUCTURE_TYPE_DESCRIPTOR_UPDATE_TEMPLATE_CREATE_INFO"/>
+ <enum extends="VkObjectType" extnumber="86" offset="0" name="VK_OBJECT_TYPE_DESCRIPTOR_UPDATE_TEMPLATE"/>
+ <command name="vkCreateDescriptorUpdateTemplate"/>
+ <command name="vkDestroyDescriptorUpdateTemplate"/>
+ <command name="vkUpdateDescriptorSetWithTemplate"/>
+ <type name="VkDescriptorUpdateTemplate"/>
+ <type name="VkDescriptorUpdateTemplateCreateFlags"/>
+ <type name="VkDescriptorUpdateTemplateType"/>
+ <type name="VkDescriptorUpdateTemplateEntry"/>
+ <type name="VkDescriptorUpdateTemplateCreateInfo"/>
+ </require>
+ <require comment="Promoted from VK_KHR_external_memory_capabilities">
+ <enum extends="VkStructureType" extnumber="72" offset="0" name="VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_EXTERNAL_IMAGE_FORMAT_INFO"/>
+ <enum extends="VkStructureType" extnumber="72" offset="1" name="VK_STRUCTURE_TYPE_EXTERNAL_IMAGE_FORMAT_PROPERTIES"/>
+ <enum extends="VkStructureType" extnumber="72" offset="2" name="VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_EXTERNAL_BUFFER_INFO"/>
+ <enum extends="VkStructureType" extnumber="72" offset="3" name="VK_STRUCTURE_TYPE_EXTERNAL_BUFFER_PROPERTIES"/>
+ <enum extends="VkStructureType" extnumber="72" offset="4" name="VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_ID_PROPERTIES"/>
+ <enum name="VK_LUID_SIZE"/>
+ <type name="VkExternalMemoryHandleTypeFlags"/>
+ <type name="VkExternalMemoryHandleTypeFlagBits"/>
+ <type name="VkExternalMemoryFeatureFlags"/>
+ <type name="VkExternalMemoryFeatureFlagBits"/>
+ <type name="VkExternalMemoryProperties"/>
+ <type name="VkPhysicalDeviceExternalImageFormatInfo"/>
+ <type name="VkExternalImageFormatProperties"/>
+ <type name="VkPhysicalDeviceExternalBufferInfo"/>
+ <type name="VkExternalBufferProperties"/>
+ <type name="VkPhysicalDeviceIDProperties"/>
+ <command name="vkGetPhysicalDeviceExternalBufferProperties"/>
+ </require>
+ <require comment="Promoted from VK_KHR_external_memory">
+ <enum extends="VkStructureType" extnumber="73" offset="0" name="VK_STRUCTURE_TYPE_EXTERNAL_MEMORY_BUFFER_CREATE_INFO"/>
+ <enum extends="VkStructureType" extnumber="73" offset="1" name="VK_STRUCTURE_TYPE_EXTERNAL_MEMORY_IMAGE_CREATE_INFO"/>
+ <enum extends="VkStructureType" extnumber="73" offset="2" name="VK_STRUCTURE_TYPE_EXPORT_MEMORY_ALLOCATE_INFO"/>
+ <enum extends="VkResult" extnumber="73" offset="3" dir="-" name="VK_ERROR_INVALID_EXTERNAL_HANDLE"/>
+ <enum name="VK_QUEUE_FAMILY_EXTERNAL"/>
+ <type name="VkExternalMemoryImageCreateInfo"/>
+ <type name="VkExternalMemoryBufferCreateInfo"/>
+ <type name="VkExportMemoryAllocateInfo"/>
+ </require>
+ <require comment="Promoted from VK_KHR_external_fence_capabilities">
+ <enum extends="VkStructureType" extnumber="113" offset="0" name="VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_EXTERNAL_FENCE_INFO"/>
+ <enum extends="VkStructureType" extnumber="113" offset="1" name="VK_STRUCTURE_TYPE_EXTERNAL_FENCE_PROPERTIES"/>
+ <type name="VkExternalFenceHandleTypeFlags"/>
+ <type name="VkExternalFenceHandleTypeFlagBits"/>
+ <type name="VkExternalFenceFeatureFlags"/>
+ <type name="VkExternalFenceFeatureFlagBits"/>
+ <type name="VkPhysicalDeviceExternalFenceInfo"/>
+ <type name="VkExternalFenceProperties"/>
+ <command name="vkGetPhysicalDeviceExternalFenceProperties"/>
+ </require>
+ <require comment="Promoted from VK_KHR_external_fence">
+ <enum extends="VkStructureType" extnumber="114" offset="0" name="VK_STRUCTURE_TYPE_EXPORT_FENCE_CREATE_INFO"/>
+ <type name="VkFenceImportFlags"/>
+ <type name="VkFenceImportFlagBits"/>
+ <type name="VkExportFenceCreateInfo"/>
+ </require>
+ <require comment="Promoted from VK_KHR_external_semaphore">
+ <enum extends="VkStructureType" extnumber="78" offset="0" name="VK_STRUCTURE_TYPE_EXPORT_SEMAPHORE_CREATE_INFO"/>
+ <type name="VkSemaphoreImportFlags"/>
+ <type name="VkSemaphoreImportFlagBits"/>
+ <type name="VkExportSemaphoreCreateInfo"/>
+ </require>
+ <require comment="Promoted from VK_KHR_external_semaphore_capabilities">
+ <enum extends="VkStructureType" extnumber="77" offset="0" name="VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_EXTERNAL_SEMAPHORE_INFO"/>
+ <enum extends="VkStructureType" extnumber="77" offset="1" name="VK_STRUCTURE_TYPE_EXTERNAL_SEMAPHORE_PROPERTIES"/>
+ <type name="VkExternalSemaphoreHandleTypeFlags"/>
+ <type name="VkExternalSemaphoreHandleTypeFlagBits"/>
+ <type name="VkExternalSemaphoreFeatureFlags"/>
+ <type name="VkExternalSemaphoreFeatureFlagBits"/>
+ <type name="VkPhysicalDeviceExternalSemaphoreInfo"/>
+ <type name="VkExternalSemaphoreProperties"/>
+ <command name="vkGetPhysicalDeviceExternalSemaphoreProperties"/>
+ </require>
+ <require comment="Promoted from VK_KHR_maintenance3">
+ <enum extends="VkStructureType" extnumber="169" offset="0" name="VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_MAINTENANCE_3_PROPERTIES"/>
+ <enum extends="VkStructureType" extnumber="169" offset="1" name="VK_STRUCTURE_TYPE_DESCRIPTOR_SET_LAYOUT_SUPPORT"/>
+ <type name="VkPhysicalDeviceMaintenance3Properties"/>
+ <type name="VkDescriptorSetLayoutSupport"/>
+ <command name="vkGetDescriptorSetLayoutSupport"/>
+ </require>
+ <require comment="Promoted from VK_KHR_shader_draw_parameters, with a feature support query added">
+ <enum extends="VkStructureType" extnumber="64" offset="0" name="VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_SHADER_DRAW_PARAMETERS_FEATURES"/>
+ <enum extends="VkStructureType" name="VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_SHADER_DRAW_PARAMETER_FEATURES" alias="VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_SHADER_DRAW_PARAMETERS_FEATURES"/>
+ <type name="VkPhysicalDeviceShaderDrawParameterFeatures"/>
+ <type name="VkPhysicalDeviceShaderDrawParametersFeatures"/>
+ </require>
+ </feature>
+ <feature api="vulkan" name="VK_VERSION_1_2" number="1.2" comment="Vulkan 1.2 core API interface definitions.">
+ <require>
+ <type name="VK_API_VERSION_1_2"/>
+ </require>
+ <require>
+ <enum extends="VkStructureType" value="49" name="VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_VULKAN_1_1_FEATURES"/>
+ <enum extends="VkStructureType" value="50" name="VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_VULKAN_1_1_PROPERTIES"/>
+ <enum extends="VkStructureType" value="51" name="VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_VULKAN_1_2_FEATURES"/>
+ <enum extends="VkStructureType" value="52" name="VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_VULKAN_1_2_PROPERTIES"/>
+ <type name="VkPhysicalDeviceVulkan11Features"/>
+ <type name="VkPhysicalDeviceVulkan11Properties"/>
+ <type name="VkPhysicalDeviceVulkan12Features"/>
+ <type name="VkPhysicalDeviceVulkan12Properties"/>
+ </require>
+ <require comment="Promoted from VK_KHR_image_format_list (extension 148)">
+ <enum offset="0" extends="VkStructureType" extnumber="148" name="VK_STRUCTURE_TYPE_IMAGE_FORMAT_LIST_CREATE_INFO"/>
+ <type name="VkImageFormatListCreateInfo"/>
+ </require>
+ <require comment="Promoted from VK_KHR_sampler_mirror_clamp_to_edge (extension 15)">
+ <enum value="4" extends="VkSamplerAddressMode" name="VK_SAMPLER_ADDRESS_MODE_MIRROR_CLAMP_TO_EDGE" comment="No need to add an extnumber attribute, since this uses a core enum value"/>
+ </require>
+ <require comment="Promoted from VK_KHR_draw_indirect_count (extension 170)">
+ <command name="vkCmdDrawIndirectCount"/>
+ <command name="vkCmdDrawIndexedIndirectCount"/>
+ </require>
+ <require comment="Promoted from VK_KHR_create_renderpass2 (extension 110)">
+ <enum offset="0" extends="VkStructureType" extnumber="110" name="VK_STRUCTURE_TYPE_ATTACHMENT_DESCRIPTION_2"/>
+ <enum offset="1" extends="VkStructureType" extnumber="110" name="VK_STRUCTURE_TYPE_ATTACHMENT_REFERENCE_2"/>
+ <enum offset="2" extends="VkStructureType" extnumber="110" name="VK_STRUCTURE_TYPE_SUBPASS_DESCRIPTION_2"/>
+ <enum offset="3" extends="VkStructureType" extnumber="110" name="VK_STRUCTURE_TYPE_SUBPASS_DEPENDENCY_2"/>
+ <enum offset="4" extends="VkStructureType" extnumber="110" name="VK_STRUCTURE_TYPE_RENDER_PASS_CREATE_INFO_2"/>
+ <enum offset="5" extends="VkStructureType" extnumber="110" name="VK_STRUCTURE_TYPE_SUBPASS_BEGIN_INFO"/>
+ <enum offset="6" extends="VkStructureType" extnumber="110" name="VK_STRUCTURE_TYPE_SUBPASS_END_INFO"/>
+ <command name="vkCreateRenderPass2"/>
+ <command name="vkCmdBeginRenderPass2"/>
+ <command name="vkCmdNextSubpass2"/>
+ <command name="vkCmdEndRenderPass2"/>
+ <type name="VkRenderPassCreateInfo2"/>
+ <type name="VkAttachmentDescription2"/>
+ <type name="VkAttachmentReference2"/>
+ <type name="VkSubpassDescription2"/>
+ <type name="VkSubpassDependency2"/>
+ <type name="VkSubpassBeginInfo"/>
+ <type name="VkSubpassEndInfo"/>
+ </require>
+ <require comment="Promoted from VK_KHR_8bit_storage (extension 178)">
+ <enum offset="0" extends="VkStructureType" extnumber="178" name="VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_8BIT_STORAGE_FEATURES"/>
+ <type name="VkPhysicalDevice8BitStorageFeatures"/>
+ </require>
+ <require comment="Promoted from VK_KHR_driver_properties (extension 197)">
+ <enum offset="0" extends="VkStructureType" extnumber="197" name="VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_DRIVER_PROPERTIES"/>
+ <enum name="VK_MAX_DRIVER_NAME_SIZE"/>
+ <enum name="VK_MAX_DRIVER_INFO_SIZE"/>
+ <type name="VkDriverId"/>
+ <type name="VkConformanceVersion"/>
+ <type name="VkPhysicalDeviceDriverProperties"/>
+ </require>
+ <require comment="Promoted from VK_KHR_shader_atomic_int64 (extension 181)">
+ <enum offset="0" extends="VkStructureType" extnumber="181" name="VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_SHADER_ATOMIC_INT64_FEATURES"/>
+ <type name="VkPhysicalDeviceShaderAtomicInt64Features"/>
+ </require>
+ <require comment="Promoted from VK_KHR_shader_float16_int8 (extension 83)">
+ <enum offset="0" extends="VkStructureType" extnumber="83" name="VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_SHADER_FLOAT16_INT8_FEATURES"/>
+ <type name="VkPhysicalDeviceShaderFloat16Int8Features"/>
+ </require>
+ <require comment="Promoted from VK_KHR_shader_float_controls (extension 198)">
+ <enum offset="0" extends="VkStructureType" extnumber="198" name="VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_FLOAT_CONTROLS_PROPERTIES"/>
+ <type name="VkPhysicalDeviceFloatControlsProperties"/>
+ <type name="VkShaderFloatControlsIndependence"/>
+ </require>
+ <require comment="Promoted from VK_EXT_descriptor_indexing (extension 162)">
+ <enum offset="0" extends="VkStructureType" extnumber="162" name="VK_STRUCTURE_TYPE_DESCRIPTOR_SET_LAYOUT_BINDING_FLAGS_CREATE_INFO"/>
+ <enum offset="1" extends="VkStructureType" extnumber="162" name="VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_DESCRIPTOR_INDEXING_FEATURES"/>
+ <enum offset="2" extends="VkStructureType" extnumber="162" name="VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_DESCRIPTOR_INDEXING_PROPERTIES"/>
+ <enum offset="3" extends="VkStructureType" extnumber="162" name="VK_STRUCTURE_TYPE_DESCRIPTOR_SET_VARIABLE_DESCRIPTOR_COUNT_ALLOCATE_INFO"/>
+ <enum offset="4" extends="VkStructureType" extnumber="162" name="VK_STRUCTURE_TYPE_DESCRIPTOR_SET_VARIABLE_DESCRIPTOR_COUNT_LAYOUT_SUPPORT"/>
+ <enum bitpos="1" extends="VkDescriptorPoolCreateFlagBits" name="VK_DESCRIPTOR_POOL_CREATE_UPDATE_AFTER_BIND_BIT"/>
+ <enum bitpos="1" extends="VkDescriptorSetLayoutCreateFlagBits" name="VK_DESCRIPTOR_SET_LAYOUT_CREATE_UPDATE_AFTER_BIND_POOL_BIT"/>
+ <enum offset="0" dir="-" extends="VkResult" extnumber="162" name="VK_ERROR_FRAGMENTATION"/>
+ <type name="VkDescriptorSetLayoutBindingFlagsCreateInfo"/>
+ <type name="VkPhysicalDeviceDescriptorIndexingFeatures"/>
+ <type name="VkPhysicalDeviceDescriptorIndexingProperties"/>
+ <type name="VkDescriptorSetVariableDescriptorCountAllocateInfo"/>
+ <type name="VkDescriptorSetVariableDescriptorCountLayoutSupport"/>
+ <type name="VkDescriptorBindingFlagBits"/>
+ <type name="VkDescriptorBindingFlags"/>
+ </require>
+ <require comment="Promoted from VK_KHR_depth_stencil_resolve (extension 200)">
+ <enum offset="0" extends="VkStructureType" extnumber="200" name="VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_DEPTH_STENCIL_RESOLVE_PROPERTIES"/>
+ <enum offset="1" extends="VkStructureType" extnumber="200" name="VK_STRUCTURE_TYPE_SUBPASS_DESCRIPTION_DEPTH_STENCIL_RESOLVE"/>
+ <type name="VkSubpassDescriptionDepthStencilResolve"/>
+ <type name="VkPhysicalDeviceDepthStencilResolveProperties"/>
+ <type name="VkResolveModeFlagBits"/>
+ <type name="VkResolveModeFlags"/>
+ </require>
+ <require comment="Promoted from VK_EXT_scalar_block_layout (extension 222))">
+ <type name="VkPhysicalDeviceScalarBlockLayoutFeatures"/>
+ <enum offset="0" extends="VkStructureType" extnumber="222" name="VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_SCALAR_BLOCK_LAYOUT_FEATURES"/>
+ </require>
+ <require comment="Promoted from VK_EXT_shader_viewport_index_layer, which has no API (extension 163)"/>
+ <require comment="Promoted from VK_EXT_separate_stencil_usage (extension 247)">
+ <enum offset="0" extends="VkStructureType" extnumber="247" name="VK_STRUCTURE_TYPE_IMAGE_STENCIL_USAGE_CREATE_INFO"/>
+ <type name="VkImageStencilUsageCreateInfo"/>
+ </require>
+ <require comment="Promoted from VK_EXT_sampler_filter_minmax (extension 131)">
+ <enum offset="0" extends="VkStructureType" extnumber="131" name="VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_SAMPLER_FILTER_MINMAX_PROPERTIES"/>
+ <enum offset="1" extends="VkStructureType" extnumber="131" name="VK_STRUCTURE_TYPE_SAMPLER_REDUCTION_MODE_CREATE_INFO"/>
+ <enum bitpos="16" extends="VkFormatFeatureFlagBits" name="VK_FORMAT_FEATURE_SAMPLED_IMAGE_FILTER_MINMAX_BIT" comment="Format can be used with min/max reduction filtering"/>
+ <type name="VkSamplerReductionMode"/>
+ <type name="VkSamplerReductionModeCreateInfo"/>
+ <type name="VkPhysicalDeviceSamplerFilterMinmaxProperties"/>
+ </require>
+ <require comment="Promoted from VK_KHR_vulkan_memory_model (extension 212)">
+ <enum offset="0" extends="VkStructureType" extnumber="212" name="VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_VULKAN_MEMORY_MODEL_FEATURES"/>
+ <type name="VkPhysicalDeviceVulkanMemoryModelFeatures"/>
+ </require>
+ <require comment="Promoted from VK_KHR_imageless_framebuffer (extension 109)">
+ <type name="VkPhysicalDeviceImagelessFramebufferFeatures"/>
+ <type name="VkFramebufferAttachmentsCreateInfo"/>
+ <type name="VkFramebufferAttachmentImageInfo"/>
+ <type name="VkRenderPassAttachmentBeginInfo"/>
+ <enum offset="0" extends="VkStructureType" extnumber="109" name="VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_IMAGELESS_FRAMEBUFFER_FEATURES"/>
+ <enum offset="1" extends="VkStructureType" extnumber="109" name="VK_STRUCTURE_TYPE_FRAMEBUFFER_ATTACHMENTS_CREATE_INFO"/>
+ <enum offset="2" extends="VkStructureType" extnumber="109" name="VK_STRUCTURE_TYPE_FRAMEBUFFER_ATTACHMENT_IMAGE_INFO"/>
+ <enum offset="3" extends="VkStructureType" extnumber="109" name="VK_STRUCTURE_TYPE_RENDER_PASS_ATTACHMENT_BEGIN_INFO"/>
+ <enum bitpos="0" extends="VkFramebufferCreateFlagBits" name="VK_FRAMEBUFFER_CREATE_IMAGELESS_BIT"/>
+ </require>
+ <require comment="Promoted from VK_KHR_uniform_buffer_standard_layout (extension 254)">
+ <type name="VkPhysicalDeviceUniformBufferStandardLayoutFeatures"/>
+ <enum offset="0" extends="VkStructureType" extnumber="254" name="VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_UNIFORM_BUFFER_STANDARD_LAYOUT_FEATURES"/>
+ </require>
+ <require comment="Promoted from VK_KHR_shader_subgroup_extended_types (extension 176)">
+ <enum offset="0" extends="VkStructureType" extnumber="176" name="VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_SHADER_SUBGROUP_EXTENDED_TYPES_FEATURES"/>
+ <type name="VkPhysicalDeviceShaderSubgroupExtendedTypesFeatures"/>
+ </require>
+ <require comment="Promoted from VK_KHR_spirv_1_4 (extension 237)">
+ </require>
+ <require comment="Promoted from VK_KHR_separate_depth_stencil_layouts (extension 242)">
+ <enum offset="0" extends="VkStructureType" extnumber="242" name="VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_SEPARATE_DEPTH_STENCIL_LAYOUTS_FEATURES"/>
+ <enum offset="1" extends="VkStructureType" extnumber="242" name="VK_STRUCTURE_TYPE_ATTACHMENT_REFERENCE_STENCIL_LAYOUT"/>
+ <enum offset="2" extends="VkStructureType" extnumber="242" name="VK_STRUCTURE_TYPE_ATTACHMENT_DESCRIPTION_STENCIL_LAYOUT"/>
+ <enum offset="0" extends="VkImageLayout" extnumber="242" name="VK_IMAGE_LAYOUT_DEPTH_ATTACHMENT_OPTIMAL"/>
+ <enum offset="1" extends="VkImageLayout" extnumber="242" name="VK_IMAGE_LAYOUT_DEPTH_READ_ONLY_OPTIMAL"/>
+ <enum offset="2" extends="VkImageLayout" extnumber="242" name="VK_IMAGE_LAYOUT_STENCIL_ATTACHMENT_OPTIMAL"/>
+ <enum offset="3" extends="VkImageLayout" extnumber="242" name="VK_IMAGE_LAYOUT_STENCIL_READ_ONLY_OPTIMAL"/>
+ <type name="VkPhysicalDeviceSeparateDepthStencilLayoutsFeatures"/>
+ <type name="VkAttachmentReferenceStencilLayout"/>
+ <type name="VkAttachmentDescriptionStencilLayout"/>
+ </require>
+ <require comment="Promoted from VK_EXT_host_query_reset (extension 262)">
+ <enum offset="0" extends="VkStructureType" extnumber="262" name="VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_HOST_QUERY_RESET_FEATURES"/>
+ <type name="VkPhysicalDeviceHostQueryResetFeatures"/>
+ <command name="vkResetQueryPool"/>
+ </require>
+ <require comment="Promoted from VK_KHR_timeline_semaphore (extension 208)">
+ <enum offset="0" extends="VkStructureType" extnumber="208" name="VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_TIMELINE_SEMAPHORE_FEATURES"/>
+ <enum offset="1" extends="VkStructureType" extnumber="208" name="VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_TIMELINE_SEMAPHORE_PROPERTIES"/>
+ <enum offset="2" extends="VkStructureType" extnumber="208" name="VK_STRUCTURE_TYPE_SEMAPHORE_TYPE_CREATE_INFO"/>
+ <enum offset="3" extends="VkStructureType" extnumber="208" name="VK_STRUCTURE_TYPE_TIMELINE_SEMAPHORE_SUBMIT_INFO"/>
+ <enum offset="4" extends="VkStructureType" extnumber="208" name="VK_STRUCTURE_TYPE_SEMAPHORE_WAIT_INFO"/>
+ <enum offset="5" extends="VkStructureType" extnumber="208" name="VK_STRUCTURE_TYPE_SEMAPHORE_SIGNAL_INFO"/>
+ <type name="VkSemaphoreType"/>
+ <type name="VkPhysicalDeviceTimelineSemaphoreFeatures"/>
+ <type name="VkPhysicalDeviceTimelineSemaphoreProperties"/>
+ <type name="VkSemaphoreTypeCreateInfo"/>
+ <type name="VkTimelineSemaphoreSubmitInfo"/>
+ <type name="VkSemaphoreWaitFlagBits"/>
+ <type name="VkSemaphoreWaitFlags"/>
+ <type name="VkSemaphoreWaitInfo"/>
+ <type name="VkSemaphoreSignalInfo"/>
+ <command name="vkGetSemaphoreCounterValue"/>
+ <command name="vkWaitSemaphores"/>
+ <command name="vkSignalSemaphore"/>
+ </require>
+ <require comment="Promoted from VK_KHR_buffer_device_address (extension 258)">
+ <enum offset="0" extends="VkStructureType" extnumber="258" name="VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_BUFFER_DEVICE_ADDRESS_FEATURES"/>
+ <enum offset="1" extends="VkStructureType" extnumber="245" name="VK_STRUCTURE_TYPE_BUFFER_DEVICE_ADDRESS_INFO"/>
+ <enum offset="2" extends="VkStructureType" extnumber="258" name="VK_STRUCTURE_TYPE_BUFFER_OPAQUE_CAPTURE_ADDRESS_CREATE_INFO"/>
+ <enum offset="3" extends="VkStructureType" extnumber="258" name="VK_STRUCTURE_TYPE_MEMORY_OPAQUE_CAPTURE_ADDRESS_ALLOCATE_INFO"/>
+ <enum offset="4" extends="VkStructureType" extnumber="258" name="VK_STRUCTURE_TYPE_DEVICE_MEMORY_OPAQUE_CAPTURE_ADDRESS_INFO"/>
+ <enum bitpos="17" extends="VkBufferUsageFlagBits" name="VK_BUFFER_USAGE_SHADER_DEVICE_ADDRESS_BIT"/>
+ <enum bitpos="4" extends="VkBufferCreateFlagBits" name="VK_BUFFER_CREATE_DEVICE_ADDRESS_CAPTURE_REPLAY_BIT"/>
+ <enum bitpos="1" extends="VkMemoryAllocateFlagBits" name="VK_MEMORY_ALLOCATE_DEVICE_ADDRESS_BIT"/>
+ <enum bitpos="2" extends="VkMemoryAllocateFlagBits" name="VK_MEMORY_ALLOCATE_DEVICE_ADDRESS_CAPTURE_REPLAY_BIT"/>
+ <enum offset="0" dir="-" extends="VkResult" extnumber="258" name="VK_ERROR_INVALID_OPAQUE_CAPTURE_ADDRESS"/>
+ <type name="VkPhysicalDeviceBufferDeviceAddressFeatures"/>
+ <type name="VkBufferDeviceAddressInfo"/>
+ <type name="VkBufferOpaqueCaptureAddressCreateInfo"/>
+ <type name="VkMemoryOpaqueCaptureAddressAllocateInfo"/>
+ <type name="VkDeviceMemoryOpaqueCaptureAddressInfo"/>
+ <command name="vkGetBufferDeviceAddress"/>
+ <command name="vkGetBufferOpaqueCaptureAddress"/>
+ <command name="vkGetDeviceMemoryOpaqueCaptureAddress"/>
+ </require>
+ </feature>
+ <feature api="vulkan" name="VK_VERSION_1_3" number="1.3" comment="Vulkan 1.3 core API interface definitions.">
+ <require>
+ <type name="VK_API_VERSION_1_3"/>
+ </require>
+ <require>
+ <type name="VkFlags64"/>
+ </require>
+ <require>
+ <enum extends="VkStructureType" value="53" name="VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_VULKAN_1_3_FEATURES"/>
+ <enum extends="VkStructureType" value="54" name="VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_VULKAN_1_3_PROPERTIES"/>
+ <type name="VkPhysicalDeviceVulkan13Features"/>
+ <type name="VkPhysicalDeviceVulkan13Properties"/>
+ </require>
+ <require comment="Promoted from VK_EXT_pipeline_creation_feedback (extension 193)">
+ <enum offset="0" extends="VkStructureType" extnumber="193" name="VK_STRUCTURE_TYPE_PIPELINE_CREATION_FEEDBACK_CREATE_INFO"/>
+ <type name="VkPipelineCreationFeedbackFlagBits"/>
+ <type name="VkPipelineCreationFeedbackFlags"/>
+ <type name="VkPipelineCreationFeedbackCreateInfo"/>
+ <type name="VkPipelineCreationFeedback"/>
+ </require>
+ <require comment="Promoted from VK_KHR_shader_terminate_invocation (extension 216)">
+ <enum offset="0" extends="VkStructureType" extnumber="216" name="VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_SHADER_TERMINATE_INVOCATION_FEATURES"/>
+ <type name="VkPhysicalDeviceShaderTerminateInvocationFeatures"/>
+ </require>
+ <require comment="Promoted from VK_EXT_tooling_info (extension 246)">
+ <enum offset="0" extends="VkStructureType" extnumber="246" name="VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_TOOL_PROPERTIES"/>
+ <type name="VkToolPurposeFlagBits"/>
+ <type name="VkToolPurposeFlags"/>
+ <type name="VkPhysicalDeviceToolProperties"/>
+ <command name="vkGetPhysicalDeviceToolProperties"/>
+ </require>
+ <require comment="Promoted from VK_EXT_shader_demote_to_helper_invocation (extension 277)">
+ <enum offset="0" extends="VkStructureType" extnumber="277" name="VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_SHADER_DEMOTE_TO_HELPER_INVOCATION_FEATURES"/>
+ <type name="VkPhysicalDeviceShaderDemoteToHelperInvocationFeatures"/>
+ </require>
+ <require comment="Promoted from VK_KHR_shader_non_semantic_info (extension 294)">
+ </require>
+ <require comment="Promoted from VK_EXT_private_data (extension 296)">
+ <enum offset="0" extends="VkStructureType" extnumber="296" name="VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_PRIVATE_DATA_FEATURES"/>
+ <enum offset="1" extends="VkStructureType" extnumber="296" name="VK_STRUCTURE_TYPE_DEVICE_PRIVATE_DATA_CREATE_INFO"/>
+ <enum offset="2" extends="VkStructureType" extnumber="296" name="VK_STRUCTURE_TYPE_PRIVATE_DATA_SLOT_CREATE_INFO"/>
+ <enum offset="0" extends="VkObjectType" extnumber="296" name="VK_OBJECT_TYPE_PRIVATE_DATA_SLOT"/>
+ <type name="VkPhysicalDevicePrivateDataFeatures"/>
+ <type name="VkDevicePrivateDataCreateInfo"/>
+ <type name="VkPrivateDataSlotCreateInfo"/>
+ <type name="VkPrivateDataSlot"/>
+ <type name="VkPrivateDataSlotCreateFlags" comment="Will add VkPrivateDataSlotCreateFlagBits when bits are defined in the future"/>
+ <command name="vkCreatePrivateDataSlot"/>
+ <command name="vkDestroyPrivateDataSlot"/>
+ <command name="vkSetPrivateData"/>
+ <command name="vkGetPrivateData"/>
+ </require>
+ <require comment="Promoted from VK_EXT_pipeline_creation_cache_control (extension 298)">
+ <enum offset="0" extends="VkStructureType" extnumber="298" name="VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_PIPELINE_CREATION_CACHE_CONTROL_FEATURES"/>
+ <type name="VkPhysicalDevicePipelineCreationCacheControlFeatures"/>
+ <enum bitpos="8" extends="VkPipelineCreateFlagBits" name="VK_PIPELINE_CREATE_FAIL_ON_PIPELINE_COMPILE_REQUIRED_BIT"/>
+ <enum bitpos="9" extends="VkPipelineCreateFlagBits" name="VK_PIPELINE_CREATE_EARLY_RETURN_ON_FAILURE_BIT"/>
+ <enum offset="0" extends="VkResult" extnumber="298" name="VK_PIPELINE_COMPILE_REQUIRED"/>
+ <enum bitpos="0" extends="VkPipelineCacheCreateFlagBits" name="VK_PIPELINE_CACHE_CREATE_EXTERNALLY_SYNCHRONIZED_BIT"/>
+ </require>
+ <require comment="Promoted from VK_KHR_synchronization2 (extension 315)">
+ <enum offset="0" extends="VkStructureType" extnumber="315" name="VK_STRUCTURE_TYPE_MEMORY_BARRIER_2"/>
+ <enum offset="1" extends="VkStructureType" extnumber="315" name="VK_STRUCTURE_TYPE_BUFFER_MEMORY_BARRIER_2"/>
+ <enum offset="2" extends="VkStructureType" extnumber="315" name="VK_STRUCTURE_TYPE_IMAGE_MEMORY_BARRIER_2"/>
+ <enum offset="3" extends="VkStructureType" extnumber="315" name="VK_STRUCTURE_TYPE_DEPENDENCY_INFO"/>
+ <enum offset="4" extends="VkStructureType" extnumber="315" name="VK_STRUCTURE_TYPE_SUBMIT_INFO_2"/>
+ <enum offset="5" extends="VkStructureType" extnumber="315" name="VK_STRUCTURE_TYPE_SEMAPHORE_SUBMIT_INFO"/>
+ <enum offset="6" extends="VkStructureType" extnumber="315" name="VK_STRUCTURE_TYPE_COMMAND_BUFFER_SUBMIT_INFO"/>
+ <enum offset="7" extends="VkStructureType" extnumber="315" name="VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_SYNCHRONIZATION_2_FEATURES"/>
+ <enum bitpos="0" extends="VkEventCreateFlagBits" name="VK_EVENT_CREATE_DEVICE_ONLY_BIT"/>
+ <enum offset="0" extends="VkImageLayout" extnumber="315" name="VK_IMAGE_LAYOUT_READ_ONLY_OPTIMAL"/>
+ <enum offset="1" extends="VkImageLayout" extnumber="315" name="VK_IMAGE_LAYOUT_ATTACHMENT_OPTIMAL"/>
+ <enum value="0" extends="VkPipelineStageFlagBits" name="VK_PIPELINE_STAGE_NONE"/>
+ <enum value="0" extends="VkAccessFlagBits" name="VK_ACCESS_NONE"/>
+ <type name="VkPipelineStageFlags2"/>
+ <type name="VkPipelineStageFlagBits2"/>
+ <type name="VkAccessFlags2"/>
+ <type name="VkAccessFlagBits2"/>
+ <type name="VkMemoryBarrier2"/>
+ <type name="VkBufferMemoryBarrier2"/>
+ <type name="VkImageMemoryBarrier2"/>
+ <type name="VkDependencyInfo"/>
+ <type name="VkSubmitInfo2"/>
+ <type name="VkSemaphoreSubmitInfo"/>
+ <type name="VkCommandBufferSubmitInfo"/>
+ <type name="VkSubmitFlagBits"/>
+ <type name="VkSubmitFlags"/>
+ <type name="VkPhysicalDeviceSynchronization2Features"/>
+ <command name="vkCmdSetEvent2"/>
+ <command name="vkCmdResetEvent2"/>
+ <command name="vkCmdWaitEvents2"/>
+ <command name="vkCmdPipelineBarrier2"/>
+ <command name="vkCmdWriteTimestamp2"/>
+ <command name="vkQueueSubmit2"/>
+ </require>
+ <require comment="Promoted from VK_KHR_zero_initialize_workgroup_memory (extension 326)">
+ <enum offset="0" extends="VkStructureType" extnumber="326" name="VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_ZERO_INITIALIZE_WORKGROUP_MEMORY_FEATURES"/>
+ <type name="VkPhysicalDeviceZeroInitializeWorkgroupMemoryFeatures"/>
+ </require>
+ <require comment="Promoted from VK_EXT_image_robustness (extension 336)">
+ <enum offset="0" extends="VkStructureType" extnumber="336" name="VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_IMAGE_ROBUSTNESS_FEATURES"/>
+ <type name="VkPhysicalDeviceImageRobustnessFeatures"/>
+ </require>
+ <require comment="Promoted from VK_KHR_copy_commands2 (extension 338)">
+ <enum offset="0" extends="VkStructureType" extnumber="338" name="VK_STRUCTURE_TYPE_COPY_BUFFER_INFO_2"/>
+ <enum offset="1" extends="VkStructureType" extnumber="338" name="VK_STRUCTURE_TYPE_COPY_IMAGE_INFO_2"/>
+ <enum offset="2" extends="VkStructureType" extnumber="338" name="VK_STRUCTURE_TYPE_COPY_BUFFER_TO_IMAGE_INFO_2"/>
+ <enum offset="3" extends="VkStructureType" extnumber="338" name="VK_STRUCTURE_TYPE_COPY_IMAGE_TO_BUFFER_INFO_2"/>
+ <enum offset="4" extends="VkStructureType" extnumber="338" name="VK_STRUCTURE_TYPE_BLIT_IMAGE_INFO_2"/>
+ <enum offset="5" extends="VkStructureType" extnumber="338" name="VK_STRUCTURE_TYPE_RESOLVE_IMAGE_INFO_2"/>
+ <enum offset="6" extends="VkStructureType" extnumber="338" name="VK_STRUCTURE_TYPE_BUFFER_COPY_2"/>
+ <enum offset="7" extends="VkStructureType" extnumber="338" name="VK_STRUCTURE_TYPE_IMAGE_COPY_2"/>
+ <enum offset="8" extends="VkStructureType" extnumber="338" name="VK_STRUCTURE_TYPE_IMAGE_BLIT_2"/>
+ <enum offset="9" extends="VkStructureType" extnumber="338" name="VK_STRUCTURE_TYPE_BUFFER_IMAGE_COPY_2"/>
+ <enum offset="10" extends="VkStructureType" extnumber="338" name="VK_STRUCTURE_TYPE_IMAGE_RESOLVE_2"/>
+ <type name="VkCopyBufferInfo2"/>
+ <type name="VkCopyImageInfo2"/>
+ <type name="VkCopyBufferToImageInfo2"/>
+ <type name="VkCopyImageToBufferInfo2"/>
+ <type name="VkBlitImageInfo2"/>
+ <type name="VkResolveImageInfo2"/>
+ <type name="VkBufferCopy2"/>
+ <type name="VkImageCopy2"/>
+ <type name="VkImageBlit2"/>
+ <type name="VkBufferImageCopy2"/>
+ <type name="VkImageResolve2"/>
+ <command name="vkCmdCopyBuffer2"/>
+ <command name="vkCmdCopyImage2"/>
+ <command name="vkCmdCopyBufferToImage2"/>
+ <command name="vkCmdCopyImageToBuffer2"/>
+ <command name="vkCmdBlitImage2"/>
+ <command name="vkCmdResolveImage2"/>
+ </require>
+ <require comment="Promoted from VK_EXT_subgroup_size_control (STDPROMOTE/PROPLIMCHANGE) (extension 226)">
+ <type name="VkPhysicalDeviceSubgroupSizeControlFeatures"/>
+ <type name="VkPhysicalDeviceSubgroupSizeControlProperties"/>
+ <type name="VkPipelineShaderStageRequiredSubgroupSizeCreateInfo"/>
+ <enum offset="0" extends="VkStructureType" extnumber="226" name="VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_SUBGROUP_SIZE_CONTROL_PROPERTIES"/>
+ <enum offset="1" extends="VkStructureType" extnumber="226" name="VK_STRUCTURE_TYPE_PIPELINE_SHADER_STAGE_REQUIRED_SUBGROUP_SIZE_CREATE_INFO"/>
+ <enum offset="2" extends="VkStructureType" extnumber="226" name="VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_SUBGROUP_SIZE_CONTROL_FEATURES"/>
+ <enum bitpos="0" extends="VkPipelineShaderStageCreateFlagBits" name="VK_PIPELINE_SHADER_STAGE_CREATE_ALLOW_VARYING_SUBGROUP_SIZE_BIT"/>
+ <enum bitpos="1" extends="VkPipelineShaderStageCreateFlagBits" name="VK_PIPELINE_SHADER_STAGE_CREATE_REQUIRE_FULL_SUBGROUPS_BIT"/>
+ </require>
+ <require comment="Promoted from VK_EXT_inline_uniform_block (STDPROMOTE/PROPLIMCHANGE) (extension 139)">
+ <enum offset="0" extends="VkDescriptorType" extnumber="139" name="VK_DESCRIPTOR_TYPE_INLINE_UNIFORM_BLOCK"/>
+ <enum offset="0" extends="VkStructureType" extnumber="139" name="VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_INLINE_UNIFORM_BLOCK_FEATURES"/>
+ <enum offset="1" extends="VkStructureType" extnumber="139" name="VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_INLINE_UNIFORM_BLOCK_PROPERTIES"/>
+ <enum offset="2" extends="VkStructureType" extnumber="139" name="VK_STRUCTURE_TYPE_WRITE_DESCRIPTOR_SET_INLINE_UNIFORM_BLOCK"/>
+ <enum offset="3" extends="VkStructureType" extnumber="139" name="VK_STRUCTURE_TYPE_DESCRIPTOR_POOL_INLINE_UNIFORM_BLOCK_CREATE_INFO"/>
+ <type name="VkPhysicalDeviceInlineUniformBlockFeatures"/>
+ <type name="VkPhysicalDeviceInlineUniformBlockProperties"/>
+ <type name="VkWriteDescriptorSetInlineUniformBlock"/>
+ <type name="VkDescriptorPoolInlineUniformBlockCreateInfo"/>
+ </require>
+ <require comment="Promoted from VK_EXT_ycbcr_2plane_444_formats (does not promote the Feature struct, just the formats) (extension 331)">
+ <enum offset="0" extends="VkFormat" extnumber="331" name="VK_FORMAT_G8_B8R8_2PLANE_444_UNORM"/>
+ <enum offset="1" extends="VkFormat" extnumber="331" name="VK_FORMAT_G10X6_B10X6R10X6_2PLANE_444_UNORM_3PACK16"/>
+ <enum offset="2" extends="VkFormat" extnumber="331" name="VK_FORMAT_G12X4_B12X4R12X4_2PLANE_444_UNORM_3PACK16"/>
+ <enum offset="3" extends="VkFormat" extnumber="331" name="VK_FORMAT_G16_B16R16_2PLANE_444_UNORM"/>
+ </require>
+ <require comment="Promoted from VK_EXT_4444_formats (does not promote the Feature struct, just the formats) (extension 341)">
+ <enum offset="0" extends="VkFormat" extnumber="341" name="VK_FORMAT_A4R4G4B4_UNORM_PACK16"/>
+ <enum offset="1" extends="VkFormat" extnumber="341" name="VK_FORMAT_A4B4G4R4_UNORM_PACK16"/>
+ </require>
+ <require comment="Promoted from VK_EXT_texture_compression_astc_hdr (Feature struct is promoted, but becomes optional) (extension 67)">
+ <enum offset="0" extends="VkStructureType" extnumber="67" name="VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_TEXTURE_COMPRESSION_ASTC_HDR_FEATURES"/>
+ <type name="VkPhysicalDeviceTextureCompressionASTCHDRFeatures"/>
+ <enum offset="0" extends="VkFormat" extnumber="67" name="VK_FORMAT_ASTC_4x4_SFLOAT_BLOCK"/>
+ <enum offset="1" extends="VkFormat" extnumber="67" name="VK_FORMAT_ASTC_5x4_SFLOAT_BLOCK"/>
+ <enum offset="2" extends="VkFormat" extnumber="67" name="VK_FORMAT_ASTC_5x5_SFLOAT_BLOCK"/>
+ <enum offset="3" extends="VkFormat" extnumber="67" name="VK_FORMAT_ASTC_6x5_SFLOAT_BLOCK"/>
+ <enum offset="4" extends="VkFormat" extnumber="67" name="VK_FORMAT_ASTC_6x6_SFLOAT_BLOCK"/>
+ <enum offset="5" extends="VkFormat" extnumber="67" name="VK_FORMAT_ASTC_8x5_SFLOAT_BLOCK"/>
+ <enum offset="6" extends="VkFormat" extnumber="67" name="VK_FORMAT_ASTC_8x6_SFLOAT_BLOCK"/>
+ <enum offset="7" extends="VkFormat" extnumber="67" name="VK_FORMAT_ASTC_8x8_SFLOAT_BLOCK"/>
+ <enum offset="8" extends="VkFormat" extnumber="67" name="VK_FORMAT_ASTC_10x5_SFLOAT_BLOCK"/>
+ <enum offset="9" extends="VkFormat" extnumber="67" name="VK_FORMAT_ASTC_10x6_SFLOAT_BLOCK"/>
+ <enum offset="10" extends="VkFormat" extnumber="67" name="VK_FORMAT_ASTC_10x8_SFLOAT_BLOCK"/>
+ <enum offset="11" extends="VkFormat" extnumber="67" name="VK_FORMAT_ASTC_10x10_SFLOAT_BLOCK"/>
+ <enum offset="12" extends="VkFormat" extnumber="67" name="VK_FORMAT_ASTC_12x10_SFLOAT_BLOCK"/>
+ <enum offset="13" extends="VkFormat" extnumber="67" name="VK_FORMAT_ASTC_12x12_SFLOAT_BLOCK"/>
+ </require>
+ <require comment="Promoted from VK_KHR_dynamic_rendering (extension 45)">
+ <command name="vkCmdBeginRendering"/>
+ <command name="vkCmdEndRendering"/>
+ <enum offset="0" extends="VkStructureType" extnumber="45" name="VK_STRUCTURE_TYPE_RENDERING_INFO"/>
+ <enum offset="1" extends="VkStructureType" extnumber="45" name="VK_STRUCTURE_TYPE_RENDERING_ATTACHMENT_INFO"/>
+ <enum offset="2" extends="VkStructureType" extnumber="45" name="VK_STRUCTURE_TYPE_PIPELINE_RENDERING_CREATE_INFO"/>
+ <enum offset="3" extends="VkStructureType" extnumber="45" name="VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_DYNAMIC_RENDERING_FEATURES"/>
+ <enum offset="4" extends="VkStructureType" extnumber="45" name="VK_STRUCTURE_TYPE_COMMAND_BUFFER_INHERITANCE_RENDERING_INFO"/>
+ <enum offset="0" extends="VkAttachmentStoreOp" extnumber="302" name="VK_ATTACHMENT_STORE_OP_NONE"/>
+ <type name="VkRenderingInfo"/>
+ <type name="VkRenderingAttachmentInfo"/>
+ <type name="VkPipelineRenderingCreateInfo"/>
+ <type name="VkPhysicalDeviceDynamicRenderingFeatures"/>
+ <type name="VkCommandBufferInheritanceRenderingInfo"/>
+ <type name="VkRenderingFlags"/>
+ <type name="VkRenderingFlagBits"/>
+ </require>
+ <require comment="Promoted from VK_EXT_extended_dynamic_state (Feature struct is not promoted) (extension 268)">
+ <enum offset="0" extends="VkDynamicState" extnumber="268" name="VK_DYNAMIC_STATE_CULL_MODE"/>
+ <enum offset="1" extends="VkDynamicState" extnumber="268" name="VK_DYNAMIC_STATE_FRONT_FACE"/>
+ <enum offset="2" extends="VkDynamicState" extnumber="268" name="VK_DYNAMIC_STATE_PRIMITIVE_TOPOLOGY"/>
+ <enum offset="3" extends="VkDynamicState" extnumber="268" name="VK_DYNAMIC_STATE_VIEWPORT_WITH_COUNT"/>
+ <enum offset="4" extends="VkDynamicState" extnumber="268" name="VK_DYNAMIC_STATE_SCISSOR_WITH_COUNT"/>
+ <enum offset="5" extends="VkDynamicState" extnumber="268" name="VK_DYNAMIC_STATE_VERTEX_INPUT_BINDING_STRIDE"/>
+ <enum offset="6" extends="VkDynamicState" extnumber="268" name="VK_DYNAMIC_STATE_DEPTH_TEST_ENABLE"/>
+ <enum offset="7" extends="VkDynamicState" extnumber="268" name="VK_DYNAMIC_STATE_DEPTH_WRITE_ENABLE"/>
+ <enum offset="8" extends="VkDynamicState" extnumber="268" name="VK_DYNAMIC_STATE_DEPTH_COMPARE_OP"/>
+ <enum offset="9" extends="VkDynamicState" extnumber="268" name="VK_DYNAMIC_STATE_DEPTH_BOUNDS_TEST_ENABLE"/>
+ <enum offset="10" extends="VkDynamicState" extnumber="268" name="VK_DYNAMIC_STATE_STENCIL_TEST_ENABLE"/>
+ <enum offset="11" extends="VkDynamicState" extnumber="268" name="VK_DYNAMIC_STATE_STENCIL_OP"/>
+ <command name="vkCmdSetCullMode"/>
+ <command name="vkCmdSetFrontFace"/>
+ <command name="vkCmdSetPrimitiveTopology"/>
+ <command name="vkCmdSetViewportWithCount"/>
+ <command name="vkCmdSetScissorWithCount"/>
+ <command name="vkCmdBindVertexBuffers2"/>
+ <command name="vkCmdSetDepthTestEnable"/>
+ <command name="vkCmdSetDepthWriteEnable"/>
+ <command name="vkCmdSetDepthCompareOp"/>
+ <command name="vkCmdSetDepthBoundsTestEnable"/>
+ <command name="vkCmdSetStencilTestEnable"/>
+ <command name="vkCmdSetStencilOp"/>
+ </require>
+ <require comment="Promoted from VK_KHR_shader_integer_dot_product (extension 281)">
+ <enum offset="0" extends="VkStructureType" extnumber="281" name="VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_SHADER_INTEGER_DOT_PRODUCT_FEATURES"/>
+ <enum offset="1" extends="VkStructureType" extnumber="281" name="VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_SHADER_INTEGER_DOT_PRODUCT_PROPERTIES"/>
+ <type name="VkPhysicalDeviceShaderIntegerDotProductFeatures"/>
+ <type name="VkPhysicalDeviceShaderIntegerDotProductProperties"/>
+ </require>
+ <require comment="Promoted from VK_EXT_texel_buffer_alignment (extension 282)">
+ <enum offset="1" extends="VkStructureType" extnumber="282" name="VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_TEXEL_BUFFER_ALIGNMENT_PROPERTIES"/>
+ <type name="VkPhysicalDeviceTexelBufferAlignmentProperties"/>
+ </require>
+ <require comment="Promoted from VK_KHR_format_feature_flags2 (extension 361)">
+ <enum offset="0" extends="VkStructureType" extnumber="361" name="VK_STRUCTURE_TYPE_FORMAT_PROPERTIES_3"/>
+ <type name="VkFormatFeatureFlags2"/>
+ <type name="VkFormatFeatureFlagBits2"/>
+ <type name="VkFormatProperties3"/>
+ </require>
+ <require comment="Promoted from VK_EXT_extended_dynamic_state2 (Feature struct and optional state are not promoted) (extension 378)">
+ <enum offset="1" extends="VkDynamicState" extnumber="378" name="VK_DYNAMIC_STATE_RASTERIZER_DISCARD_ENABLE"/>
+ <enum offset="2" extends="VkDynamicState" extnumber="378" name="VK_DYNAMIC_STATE_DEPTH_BIAS_ENABLE"/>
+ <enum offset="4" extends="VkDynamicState" extnumber="378" name="VK_DYNAMIC_STATE_PRIMITIVE_RESTART_ENABLE"/>
+ <command name="vkCmdSetRasterizerDiscardEnable"/>
+ <command name="vkCmdSetDepthBiasEnable"/>
+ <command name="vkCmdSetPrimitiveRestartEnable"/>
+ </require>
+ <require comment="Promoted from VK_KHR_maintenance4 (extension 414)">
+ <enum offset="0" extends="VkStructureType" extnumber="414" name="VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_MAINTENANCE_4_FEATURES"/>
+ <enum offset="1" extends="VkStructureType" extnumber="414" name="VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_MAINTENANCE_4_PROPERTIES"/>
+ <enum offset="2" extends="VkStructureType" extnumber="414" name="VK_STRUCTURE_TYPE_DEVICE_BUFFER_MEMORY_REQUIREMENTS"/>
+ <enum offset="3" extends="VkStructureType" extnumber="414" name="VK_STRUCTURE_TYPE_DEVICE_IMAGE_MEMORY_REQUIREMENTS"/>
+ <enum value="0" extends="VkImageAspectFlagBits" name="VK_IMAGE_ASPECT_NONE"/>
+ <type name="VkPhysicalDeviceMaintenance4Features"/>
+ <type name="VkPhysicalDeviceMaintenance4Properties"/>
+ <type name="VkDeviceBufferMemoryRequirements"/>
+ <type name="VkDeviceImageMemoryRequirements"/>
+ <command name="vkGetDeviceBufferMemoryRequirements"/>
+ <command name="vkGetDeviceImageMemoryRequirements"/>
+ <command name="vkGetDeviceImageSparseMemoryRequirements"/>
</require>
</feature>
- <!-- SECTION: Vulkan extension interface definitions -->
- <extensions>
- <!-- WSI extensions -->
- <extension name="VK_KHR_surface" number="1" type="instance" supported="vulkan">
- <require>
- <enum value="25" name="VK_KHR_SURFACE_SPEC_VERSION"/>
- <enum value="&quot;VK_KHR_surface&quot;" name="VK_KHR_SURFACE_EXTENSION_NAME"/>
- <enum offset="0" dir="-" extends="VkResult" name="VK_ERROR_SURFACE_LOST_KHR"/>
- <enum offset="1" dir="-" extends="VkResult" name="VK_ERROR_NATIVE_WINDOW_IN_USE_KHR"/>
- <enum value="VK_COLOR_SPACE_SRGB_NONLINEAR_KHR" name="VK_COLORSPACE_SRGB_NONLINEAR_KHR"/>
+ <extensions comment="Vulkan extension interface definitions">
+ <extension name="VK_KHR_surface" number="1" type="instance" author="KHR" contact="James Jones @cubanismo,Ian Elliott @ianelliottus" supported="vulkan">
+ <require>
+ <enum value="25" name="VK_KHR_SURFACE_SPEC_VERSION"/>
+ <enum value="&quot;VK_KHR_surface&quot;" name="VK_KHR_SURFACE_EXTENSION_NAME"/>
+ <enum offset="0" extends="VkResult" dir="-" name="VK_ERROR_SURFACE_LOST_KHR"/>
+ <enum offset="1" extends="VkResult" dir="-" name="VK_ERROR_NATIVE_WINDOW_IN_USE_KHR"/>
+ <enum offset="0" extends="VkObjectType" name="VK_OBJECT_TYPE_SURFACE_KHR"/>
+ <type name="VkSurfaceKHR"/>
+ <type name="VkSurfaceTransformFlagBitsKHR"/>
+ <type name="VkPresentModeKHR"/>
+ <type name="VkColorSpaceKHR"/>
+ <type name="VkCompositeAlphaFlagBitsKHR"/>
+ <type name="VkCompositeAlphaFlagsKHR"/>
+ <type name="VkSurfaceCapabilitiesKHR"/>
+ <type name="VkSurfaceFormatKHR"/>
<command name="vkDestroySurfaceKHR"/>
<command name="vkGetPhysicalDeviceSurfaceSupportKHR"/>
<command name="vkGetPhysicalDeviceSurfaceCapabilitiesKHR"/>
@@ -4336,37 +13515,73 @@ maintained in the master branch of the Khronos Vulkan GitHub project.
<command name="vkGetPhysicalDeviceSurfacePresentModesKHR"/>
</require>
</extension>
- <extension name="VK_KHR_swapchain" number="2" type="device" requires="VK_KHR_surface" supported="vulkan">
+ <extension name="VK_KHR_swapchain" number="2" type="device" requires="VK_KHR_surface" author="KHR" contact="James Jones @cubanismo,Ian Elliott @ianelliottus" supported="vulkan">
<require>
- <enum value="68" name="VK_KHR_SWAPCHAIN_SPEC_VERSION"/>
- <enum value="&quot;VK_KHR_swapchain&quot;" name="VK_KHR_SWAPCHAIN_EXTENSION_NAME"/>
- <enum offset="0" extends="VkStructureType" name="VK_STRUCTURE_TYPE_SWAPCHAIN_CREATE_INFO_KHR"/>
- <enum offset="1" extends="VkStructureType" name="VK_STRUCTURE_TYPE_PRESENT_INFO_KHR"/>
- <enum offset="2" extends="VkImageLayout" name="VK_IMAGE_LAYOUT_PRESENT_SRC_KHR"/>
- <enum offset="3" extends="VkResult" name="VK_SUBOPTIMAL_KHR"/>
- <enum offset="4" dir="-" extends="VkResult" name="VK_ERROR_OUT_OF_DATE_KHR"/>
+ <enum value="70" name="VK_KHR_SWAPCHAIN_SPEC_VERSION"/>
+ <enum value="&quot;VK_KHR_swapchain&quot;" name="VK_KHR_SWAPCHAIN_EXTENSION_NAME"/>
+ <enum offset="0" extends="VkStructureType" name="VK_STRUCTURE_TYPE_SWAPCHAIN_CREATE_INFO_KHR"/>
+ <enum offset="1" extends="VkStructureType" name="VK_STRUCTURE_TYPE_PRESENT_INFO_KHR"/>
+ <enum offset="2" extends="VkImageLayout" name="VK_IMAGE_LAYOUT_PRESENT_SRC_KHR"/>
+ <enum offset="3" extends="VkResult" name="VK_SUBOPTIMAL_KHR"/>
+ <enum offset="4" extends="VkResult" dir="-" name="VK_ERROR_OUT_OF_DATE_KHR"/>
+ <enum offset="0" extends="VkObjectType" name="VK_OBJECT_TYPE_SWAPCHAIN_KHR"/>
+ <type name="VkSwapchainCreateFlagBitsKHR"/>
+ <type name="VkSwapchainCreateFlagsKHR"/>
+ <type name="VkSwapchainCreateInfoKHR"/>
+ <type name="VkSwapchainKHR"/>
+ <type name="VkPresentInfoKHR"/>
<command name="vkCreateSwapchainKHR"/>
<command name="vkDestroySwapchainKHR"/>
<command name="vkGetSwapchainImagesKHR"/>
<command name="vkAcquireNextImageKHR"/>
<command name="vkQueuePresentKHR"/>
</require>
+ <require feature="VK_VERSION_1_1">
+ <comment>This duplicates definitions in VK_KHR_device_group below</comment>
+ <enum extends="VkStructureType" extnumber="61" offset="7" name="VK_STRUCTURE_TYPE_DEVICE_GROUP_PRESENT_CAPABILITIES_KHR"/>
+ <enum extends="VkStructureType" extnumber="61" offset="8" name="VK_STRUCTURE_TYPE_IMAGE_SWAPCHAIN_CREATE_INFO_KHR"/>
+ <enum extends="VkStructureType" extnumber="61" offset="9" name="VK_STRUCTURE_TYPE_BIND_IMAGE_MEMORY_SWAPCHAIN_INFO_KHR"/>
+ <enum extends="VkStructureType" extnumber="61" offset="10" name="VK_STRUCTURE_TYPE_ACQUIRE_NEXT_IMAGE_INFO_KHR"/>
+ <enum extends="VkStructureType" extnumber="61" offset="11" name="VK_STRUCTURE_TYPE_DEVICE_GROUP_PRESENT_INFO_KHR"/>
+ <enum extends="VkStructureType" extnumber="61" offset="12" name="VK_STRUCTURE_TYPE_DEVICE_GROUP_SWAPCHAIN_CREATE_INFO_KHR"/>
+ <enum bitpos="0" extends="VkSwapchainCreateFlagBitsKHR" name="VK_SWAPCHAIN_CREATE_SPLIT_INSTANCE_BIND_REGIONS_BIT_KHR" comment="Allow images with VK_IMAGE_CREATE_SPLIT_INSTANCE_BIND_REGIONS_BIT"/>
+ <type name="VkImageSwapchainCreateInfoKHR"/>
+ <type name="VkBindImageMemorySwapchainInfoKHR"/>
+ <type name="VkAcquireNextImageInfoKHR"/>
+ <type name="VkDeviceGroupPresentModeFlagBitsKHR"/>
+ <type name="VkDeviceGroupPresentModeFlagsKHR"/>
+ <type name="VkDeviceGroupPresentCapabilitiesKHR"/>
+ <type name="VkDeviceGroupPresentInfoKHR"/>
+ <type name="VkDeviceGroupSwapchainCreateInfoKHR"/>
+ <command name="vkGetDeviceGroupPresentCapabilitiesKHR"/>
+ <command name="vkGetDeviceGroupSurfacePresentModesKHR"/>
+ <command name="vkGetPhysicalDevicePresentRectanglesKHR"/>
+ <command name="vkAcquireNextImage2KHR"/>
+ <enum bitpos="1" extends="VkSwapchainCreateFlagBitsKHR" name="VK_SWAPCHAIN_CREATE_PROTECTED_BIT_KHR" comment="Swapchain is protected"/>
+ </require>
</extension>
- <extension name="VK_KHR_display" number="3" type="instance" requires="VK_KHR_surface" supported="vulkan">
+ <extension name="VK_KHR_display" number="3" type="instance" requires="VK_KHR_surface" author="KHR" contact="James Jones @cubanismo,Norbert Nopper @FslNopper" supported="vulkan">
<require>
- <enum value="21" name="VK_KHR_DISPLAY_SPEC_VERSION"/>
- <enum value="&quot;VK_KHR_display&quot;" name="VK_KHR_DISPLAY_EXTENSION_NAME"/>
- <enum offset="0" extends="VkStructureType" name="VK_STRUCTURE_TYPE_DISPLAY_MODE_CREATE_INFO_KHR"/>
- <enum offset="1" extends="VkStructureType" name="VK_STRUCTURE_TYPE_DISPLAY_SURFACE_CREATE_INFO_KHR"/>
- <type name="VkDisplayPlaneAlphaFlagsKHR"/>
- <type name="VkDisplayPlaneAlphaFlagBitsKHR"/>
- <type name="VkDisplayPropertiesKHR"/>
+ <enum value="23" name="VK_KHR_DISPLAY_SPEC_VERSION"/>
+ <enum value="&quot;VK_KHR_display&quot;" name="VK_KHR_DISPLAY_EXTENSION_NAME"/>
+ <enum offset="0" extends="VkStructureType" name="VK_STRUCTURE_TYPE_DISPLAY_MODE_CREATE_INFO_KHR"/>
+ <enum offset="1" extends="VkStructureType" name="VK_STRUCTURE_TYPE_DISPLAY_SURFACE_CREATE_INFO_KHR"/>
+ <enum offset="0" extends="VkObjectType" name="VK_OBJECT_TYPE_DISPLAY_KHR"/>
+ <enum offset="1" extends="VkObjectType" name="VK_OBJECT_TYPE_DISPLAY_MODE_KHR"/>
+ <type name="VkDisplayKHR"/>
+ <type name="VkDisplayModeCreateFlagsKHR"/>
+ <type name="VkDisplayModeCreateInfoKHR"/>
+ <type name="VkDisplayModeKHR"/>
<type name="VkDisplayModeParametersKHR"/>
<type name="VkDisplayModePropertiesKHR"/>
- <type name="VkDisplayModeCreateInfoKHR"/>
+ <type name="VkDisplayPlaneAlphaFlagBitsKHR"/>
+ <type name="VkDisplayPlaneAlphaFlagsKHR"/>
<type name="VkDisplayPlaneCapabilitiesKHR"/>
<type name="VkDisplayPlanePropertiesKHR"/>
+ <type name="VkDisplayPropertiesKHR"/>
+ <type name="VkDisplaySurfaceCreateFlagsKHR"/>
<type name="VkDisplaySurfaceCreateInfoKHR"/>
+ <type name="VkSurfaceTransformFlagsKHR"/>
<command name="vkGetPhysicalDeviceDisplayPropertiesKHR"/>
<command name="vkGetPhysicalDeviceDisplayPlanePropertiesKHR"/>
<command name="vkGetDisplayPlaneSupportedDisplaysKHR"/>
@@ -4376,177 +13591,199 @@ maintained in the master branch of the Khronos Vulkan GitHub project.
<command name="vkCreateDisplayPlaneSurfaceKHR"/>
</require>
</extension>
- <extension name="VK_KHR_display_swapchain" number="4" type="device" requires="VK_KHR_swapchain,VK_KHR_display" supported="vulkan">
+ <extension name="VK_KHR_display_swapchain" number="4" type="device" requires="VK_KHR_swapchain,VK_KHR_display" author="KHR" contact="James Jones @cubanismo" supported="vulkan">
<require>
- <enum value="9" name="VK_KHR_DISPLAY_SWAPCHAIN_SPEC_VERSION"/>
- <enum value="&quot;VK_KHR_display_swapchain&quot;" name="VK_KHR_DISPLAY_SWAPCHAIN_EXTENSION_NAME"/>
- <enum offset="0" extends="VkStructureType" name="VK_STRUCTURE_TYPE_DISPLAY_PRESENT_INFO_KHR"/>
- <enum offset="1" dir="-" extends="VkResult" name="VK_ERROR_INCOMPATIBLE_DISPLAY_KHR"/>
+ <enum value="10" name="VK_KHR_DISPLAY_SWAPCHAIN_SPEC_VERSION"/>
+ <enum value="&quot;VK_KHR_display_swapchain&quot;" name="VK_KHR_DISPLAY_SWAPCHAIN_EXTENSION_NAME"/>
+ <enum offset="0" extends="VkStructureType" name="VK_STRUCTURE_TYPE_DISPLAY_PRESENT_INFO_KHR"/>
+ <enum offset="1" extends="VkResult" dir="-" name="VK_ERROR_INCOMPATIBLE_DISPLAY_KHR"/>
<type name="VkDisplayPresentInfoKHR"/>
<command name="vkCreateSharedSwapchainsKHR"/>
</require>
</extension>
- <extension name="VK_KHR_xlib_surface" number="5" type="instance" requires="VK_KHR_surface" protect="VK_USE_PLATFORM_XLIB_KHR" supported="vulkan">
+ <extension name="VK_KHR_xlib_surface" number="5" type="instance" requires="VK_KHR_surface" platform="xlib" author="KHR" contact="Jesse Hall @critsec,Ian Elliott @ianelliottus" supported="vulkan">
<require>
- <enum value="6" name="VK_KHR_XLIB_SURFACE_SPEC_VERSION"/>
- <enum value="&quot;VK_KHR_xlib_surface&quot;" name="VK_KHR_XLIB_SURFACE_EXTENSION_NAME"/>
- <enum offset="0" extends="VkStructureType" name="VK_STRUCTURE_TYPE_XLIB_SURFACE_CREATE_INFO_KHR"/>
+ <enum value="6" name="VK_KHR_XLIB_SURFACE_SPEC_VERSION"/>
+ <enum value="&quot;VK_KHR_xlib_surface&quot;" name="VK_KHR_XLIB_SURFACE_EXTENSION_NAME"/>
+ <enum offset="0" extends="VkStructureType" name="VK_STRUCTURE_TYPE_XLIB_SURFACE_CREATE_INFO_KHR"/>
<type name="VkXlibSurfaceCreateFlagsKHR"/>
<type name="VkXlibSurfaceCreateInfoKHR"/>
<command name="vkCreateXlibSurfaceKHR"/>
<command name="vkGetPhysicalDeviceXlibPresentationSupportKHR"/>
</require>
</extension>
- <extension name="VK_KHR_xcb_surface" number="6" type="instance" requires="VK_KHR_surface" protect="VK_USE_PLATFORM_XCB_KHR" supported="vulkan">
+ <extension name="VK_KHR_xcb_surface" number="6" type="instance" requires="VK_KHR_surface" platform="xcb" author="KHR" contact="Jesse Hall @critsec,Ian Elliott @ianelliottus" supported="vulkan">
<require>
- <enum value="6" name="VK_KHR_XCB_SURFACE_SPEC_VERSION"/>
- <enum value="&quot;VK_KHR_xcb_surface&quot;" name="VK_KHR_XCB_SURFACE_EXTENSION_NAME"/>
- <enum offset="0" extends="VkStructureType" name="VK_STRUCTURE_TYPE_XCB_SURFACE_CREATE_INFO_KHR"/>
+ <enum value="6" name="VK_KHR_XCB_SURFACE_SPEC_VERSION"/>
+ <enum value="&quot;VK_KHR_xcb_surface&quot;" name="VK_KHR_XCB_SURFACE_EXTENSION_NAME"/>
+ <enum offset="0" extends="VkStructureType" name="VK_STRUCTURE_TYPE_XCB_SURFACE_CREATE_INFO_KHR"/>
<type name="VkXcbSurfaceCreateFlagsKHR"/>
<type name="VkXcbSurfaceCreateInfoKHR"/>
<command name="vkCreateXcbSurfaceKHR"/>
<command name="vkGetPhysicalDeviceXcbPresentationSupportKHR"/>
</require>
</extension>
- <extension name="VK_KHR_wayland_surface" number="7" type="instance" requires="VK_KHR_surface" protect="VK_USE_PLATFORM_WAYLAND_KHR" supported="vulkan">
+ <extension name="VK_KHR_wayland_surface" number="7" type="instance" requires="VK_KHR_surface" platform="wayland" author="KHR" contact="Jesse Hall @critsec,Ian Elliott @ianelliottus" supported="vulkan">
<require>
- <enum value="5" name="VK_KHR_WAYLAND_SURFACE_SPEC_VERSION"/>
- <enum value="&quot;VK_KHR_wayland_surface&quot;" name="VK_KHR_WAYLAND_SURFACE_EXTENSION_NAME"/>
- <enum offset="0" extends="VkStructureType" name="VK_STRUCTURE_TYPE_WAYLAND_SURFACE_CREATE_INFO_KHR"/>
+ <enum value="6" name="VK_KHR_WAYLAND_SURFACE_SPEC_VERSION"/>
+ <enum value="&quot;VK_KHR_wayland_surface&quot;" name="VK_KHR_WAYLAND_SURFACE_EXTENSION_NAME"/>
+ <enum offset="0" extends="VkStructureType" name="VK_STRUCTURE_TYPE_WAYLAND_SURFACE_CREATE_INFO_KHR"/>
<type name="VkWaylandSurfaceCreateFlagsKHR"/>
<type name="VkWaylandSurfaceCreateInfoKHR"/>
<command name="vkCreateWaylandSurfaceKHR"/>
<command name="vkGetPhysicalDeviceWaylandPresentationSupportKHR"/>
</require>
</extension>
- <extension name="VK_KHR_mir_surface" number="8" type="instance" requires="VK_KHR_surface" protect="VK_USE_PLATFORM_MIR_KHR" supported="vulkan">
+ <extension name="VK_KHR_mir_surface" number="8" type="instance" requires="VK_KHR_surface" author="KHR" supported="disabled" comment="Extension permanently disabled. Extension number should not be reused">
<require>
- <enum value="4" name="VK_KHR_MIR_SURFACE_SPEC_VERSION"/>
- <enum value="&quot;VK_KHR_mir_surface&quot;" name="VK_KHR_MIR_SURFACE_EXTENSION_NAME"/>
- <enum offset="0" extends="VkStructureType" name="VK_STRUCTURE_TYPE_MIR_SURFACE_CREATE_INFO_KHR"/>
- <type name="VkMirSurfaceCreateFlagsKHR"/>
- <type name="VkMirSurfaceCreateInfoKHR"/>
- <command name="vkCreateMirSurfaceKHR"/>
- <command name="vkGetPhysicalDeviceMirPresentationSupportKHR"/>
+ <enum value="4" name="VK_KHR_MIR_SURFACE_SPEC_VERSION"/>
+ <enum value="&quot;VK_KHR_mir_surface&quot;" name="VK_KHR_MIR_SURFACE_EXTENSION_NAME"/>
</require>
</extension>
- <extension name="VK_KHR_android_surface" number="9" type="instance" requires="VK_KHR_surface" protect="VK_USE_PLATFORM_ANDROID_KHR" supported="vulkan">
+ <extension name="VK_KHR_android_surface" number="9" type="instance" requires="VK_KHR_surface" platform="android" author="KHR" contact="Jesse Hall @critsec" supported="vulkan">
<require>
- <enum value="6" name="VK_KHR_ANDROID_SURFACE_SPEC_VERSION"/>
- <enum value="&quot;VK_KHR_android_surface&quot;" name="VK_KHR_ANDROID_SURFACE_EXTENSION_NAME"/>
- <enum offset="0" extends="VkStructureType" name="VK_STRUCTURE_TYPE_ANDROID_SURFACE_CREATE_INFO_KHR"/>
+ <enum value="6" name="VK_KHR_ANDROID_SURFACE_SPEC_VERSION"/>
+ <enum value="&quot;VK_KHR_android_surface&quot;" name="VK_KHR_ANDROID_SURFACE_EXTENSION_NAME"/>
+ <type name="ANativeWindow"/>
+ <enum offset="0" extends="VkStructureType" name="VK_STRUCTURE_TYPE_ANDROID_SURFACE_CREATE_INFO_KHR"/>
<type name="VkAndroidSurfaceCreateFlagsKHR"/>
<type name="VkAndroidSurfaceCreateInfoKHR"/>
<command name="vkCreateAndroidSurfaceKHR"/>
</require>
</extension>
- <extension name="VK_KHR_win32_surface" number="10" type="instance" requires="VK_KHR_surface" protect="VK_USE_PLATFORM_WIN32_KHR" supported="vulkan">
+ <extension name="VK_KHR_win32_surface" number="10" type="instance" requires="VK_KHR_surface" platform="win32" author="KHR" contact="Jesse Hall @critsec,Ian Elliott @ianelliottus" supported="vulkan">
<require>
- <enum value="5" name="VK_KHR_WIN32_SURFACE_SPEC_VERSION"/>
- <enum value="&quot;VK_KHR_win32_surface&quot;" name="VK_KHR_WIN32_SURFACE_EXTENSION_NAME"/>
- <enum offset="0" extends="VkStructureType" name="VK_STRUCTURE_TYPE_WIN32_SURFACE_CREATE_INFO_KHR"/>
+ <enum value="6" name="VK_KHR_WIN32_SURFACE_SPEC_VERSION"/>
+ <enum value="&quot;VK_KHR_win32_surface&quot;" name="VK_KHR_WIN32_SURFACE_EXTENSION_NAME"/>
+ <enum offset="0" extends="VkStructureType" name="VK_STRUCTURE_TYPE_WIN32_SURFACE_CREATE_INFO_KHR"/>
<type name="VkWin32SurfaceCreateFlagsKHR"/>
<type name="VkWin32SurfaceCreateInfoKHR"/>
<command name="vkCreateWin32SurfaceKHR"/>
<command name="vkGetPhysicalDeviceWin32PresentationSupportKHR"/>
</require>
</extension>
- <extension name="VK_ANDROID_native_buffer" number="11" supported="disabled">
+ <extension name="VK_ANDROID_native_buffer" number="11" type="device" author="ANDROID" platform="android" contact="Jesse Hall @critsec" supported="disabled">
<require>
- <enum value="4" name="VK_ANDROID_NATIVE_BUFFER_SPEC_VERSION"/>
- <enum value="11" name="VK_ANDROID_NATIVE_BUFFER_NUMBER"/>
- <enum value="&quot;VK_ANDROID_native_buffer&quot;" name="VK_ANDROID_NATIVE_BUFFER_NAME"/>
+ <comment>VK_ANDROID_native_buffer is used between the Android Vulkan loader and drivers to implement the WSI extensions. It is not exposed to applications and uses types that are not part of Android's stable public API, so it is left disabled to keep it out of the standard Vulkan headers.</comment>
+ <enum value="8" name="VK_ANDROID_NATIVE_BUFFER_SPEC_VERSION"/>
+ <enum value="11" name="VK_ANDROID_NATIVE_BUFFER_NUMBER"/>
+ <enum value="&quot;VK_ANDROID_native_buffer&quot;" name="VK_ANDROID_NATIVE_BUFFER_EXTENSION_NAME"/>
+ <enum name="VK_ANDROID_NATIVE_BUFFER_NAME" alias="VK_ANDROID_NATIVE_BUFFER_EXTENSION_NAME"/>
+ <enum offset="0" extends="VkStructureType" name="VK_STRUCTURE_TYPE_NATIVE_BUFFER_ANDROID"/>
+ <enum offset="1" extends="VkStructureType" name="VK_STRUCTURE_TYPE_SWAPCHAIN_IMAGE_CREATE_INFO_ANDROID"/>
+ <enum offset="2" extends="VkStructureType" name="VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_PRESENTATION_PROPERTIES_ANDROID"/>
+ <type name="VkNativeBufferANDROID"/>
+ <type name="VkSwapchainImageCreateInfoANDROID"/>
+ <type name="VkPhysicalDevicePresentationPropertiesANDROID"/>
+ <type name="VkNativeBufferUsage2ANDROID"/>
+ <type name="VkSwapchainImageUsageFlagBitsANDROID"/>
+ <type name="VkSwapchainImageUsageFlagsANDROID"/>
+ <command name="vkGetSwapchainGrallocUsageANDROID"/>
+ <command name="vkAcquireImageANDROID"/>
+ <command name="vkQueueSignalReleaseImageANDROID"/>
+ <command name="vkGetSwapchainGrallocUsage2ANDROID"/>
</require>
</extension>
- <extension name="VK_EXT_debug_report" number="12" type="instance" author="Google, Inc." contact="Courtney Goeltzenleuchter @courtney" supported="vulkan">
+ <extension name="VK_EXT_debug_report" number="12" type="instance" author="GOOGLE" contact="Courtney Goeltzenleuchter @courtney-g" specialuse="debugging" supported="vulkan" deprecatedby="VK_EXT_debug_utils">
<require>
- <enum value="4" name="VK_EXT_DEBUG_REPORT_SPEC_VERSION"/>
- <enum value="&quot;VK_EXT_debug_report&quot;" name="VK_EXT_DEBUG_REPORT_EXTENSION_NAME"/>
- <enum offset="0" extends="VkStructureType" name="VK_STRUCTURE_TYPE_DEBUG_REPORT_CALLBACK_CREATE_INFO_EXT"/>
- <enum offset="1" dir="-" extends="VkResult" name="VK_ERROR_VALIDATION_FAILED_EXT"/>
- <enum value="VK_STRUCTURE_TYPE_DEBUG_REPORT_CALLBACK_CREATE_INFO_EXT" name="VK_STRUCTURE_TYPE_DEBUG_REPORT_CREATE_INFO_EXT"/>
+ <enum value="10" name="VK_EXT_DEBUG_REPORT_SPEC_VERSION"/>
+ <enum value="&quot;VK_EXT_debug_report&quot;" name="VK_EXT_DEBUG_REPORT_EXTENSION_NAME"/>
+ <enum offset="0" extends="VkStructureType" name="VK_STRUCTURE_TYPE_DEBUG_REPORT_CALLBACK_CREATE_INFO_EXT"/>
+ <enum alias="VK_STRUCTURE_TYPE_DEBUG_REPORT_CALLBACK_CREATE_INFO_EXT" extends="VkStructureType" name="VK_STRUCTURE_TYPE_DEBUG_REPORT_CREATE_INFO_EXT" comment="Backwards-compatible alias containing a typo"/>
+ <enum offset="1" extends="VkResult" dir="-" name="VK_ERROR_VALIDATION_FAILED_EXT"/>
+ <enum offset="0" extends="VkObjectType" name="VK_OBJECT_TYPE_DEBUG_REPORT_CALLBACK_EXT"/>
+ <type name="VkDebugReportCallbackEXT"/>
+ <type name="PFN_vkDebugReportCallbackEXT"/>
+ <type name="VkDebugReportFlagBitsEXT"/>
+ <type name="VkDebugReportFlagsEXT"/>
<type name="VkDebugReportObjectTypeEXT"/>
- <type name="VkDebugReportErrorEXT"/>
+ <type name="VkDebugReportCallbackCreateInfoEXT"/>
<command name="vkCreateDebugReportCallbackEXT"/>
<command name="vkDestroyDebugReportCallbackEXT"/>
<command name="vkDebugReportMessageEXT"/>
</require>
+ <require feature="VK_VERSION_1_1">
+ <comment>This duplicates definitions in other extensions, below</comment>
+ <enum extends="VkDebugReportObjectTypeEXT" extnumber="157" offset="0" name="VK_DEBUG_REPORT_OBJECT_TYPE_SAMPLER_YCBCR_CONVERSION_EXT"/>
+ <enum extends="VkDebugReportObjectTypeEXT" extnumber="86" offset="0" name="VK_DEBUG_REPORT_OBJECT_TYPE_DESCRIPTOR_UPDATE_TEMPLATE_EXT"/>
+ </require>
</extension>
- <extension name="VK_NV_glsl_shader" number="13" type="device" author="NVIDIA" contact="Piers Daniell @pdaniell" supported="vulkan">
+ <extension name="VK_NV_glsl_shader" number="13" type="device" author="NV" contact="Piers Daniell @pdaniell-nv" supported="vulkan" deprecatedby="">
<require>
- <enum value="1" name="VK_NV_GLSL_SHADER_SPEC_VERSION"/>
- <enum value="&quot;VK_NV_glsl_shader&quot;" name="VK_NV_GLSL_SHADER_EXTENSION_NAME"/>
- <enum offset="0" dir="-" extends="VkResult" name="VK_ERROR_INVALID_SHADER_NV"/>
+ <enum value="1" name="VK_NV_GLSL_SHADER_SPEC_VERSION"/>
+ <enum value="&quot;VK_NV_glsl_shader&quot;" name="VK_NV_GLSL_SHADER_EXTENSION_NAME"/>
+ <enum offset="0" extends="VkResult" dir="-" name="VK_ERROR_INVALID_SHADER_NV"/>
</require>
</extension>
- <extension name="VK_NV_extension_1" number="14" author="NVIDIA" contact="Piers Daniell @pdaniell" supported="disabled">
+ <extension name="VK_EXT_depth_range_unrestricted" type="device" number="14" author="NV" contact="Piers Daniell @pdaniell-nv" supported="vulkan">
<require>
- <enum value="0" name="VK_NV_EXTENSION_1_SPEC_VERSION"/>
- <enum value="&quot;VK_NV_extension_1&quot;" name="VK_NV_EXTENSION_1_EXTENSION_NAME"/>
- <enum offset="0" dir="-" extends="VkResult" name="VK_NV_EXTENSION_1_ERROR"/>
+ <enum value="1" name="VK_EXT_DEPTH_RANGE_UNRESTRICTED_SPEC_VERSION"/>
+ <enum value="&quot;VK_EXT_depth_range_unrestricted&quot;" name="VK_EXT_DEPTH_RANGE_UNRESTRICTED_EXTENSION_NAME"/>
</require>
</extension>
- <extension name="VK_KHR_sampler_mirror_clamp_to_edge" type="device" number="15" author="KHR" contact="Tobias Hector @tobias" supported="vulkan">
+ <extension name="VK_KHR_sampler_mirror_clamp_to_edge" type="device" number="15" author="KHR" contact="Tobias Hector @tobski" supported="vulkan" promotedto="VK_VERSION_1_2">
<require>
- <enum value="1" name="VK_KHR_SAMPLER_MIRROR_CLAMP_TO_EDGE_SPEC_VERSION"/>
- <enum value="&quot;VK_KHR_sampler_mirror_clamp_to_edge&quot;" name="VK_KHR_SAMPLER_MIRROR_CLAMP_TO_EDGE_EXTENSION_NAME"/>
- <enum value="4" extends="VkSamplerAddressMode" name="VK_SAMPLER_ADDRESS_MODE_MIRROR_CLAMP_TO_EDGE" comment="Note that this defines what was previously a core enum, and so uses the 'value' attribute rather than 'offset', and does not have a suffix. This is a special case, and should not be repeated"/>
+ <enum value="3" name="VK_KHR_SAMPLER_MIRROR_CLAMP_TO_EDGE_SPEC_VERSION"/>
+ <enum value="&quot;VK_KHR_sampler_mirror_clamp_to_edge&quot;" name="VK_KHR_SAMPLER_MIRROR_CLAMP_TO_EDGE_EXTENSION_NAME"/>
+ <enum value="4" extends="VkSamplerAddressMode" name="VK_SAMPLER_ADDRESS_MODE_MIRROR_CLAMP_TO_EDGE" comment="Note that this defines what was previously a core enum, and so uses the 'value' attribute rather than 'offset', and does not have a suffix. This is a special case, and should not be repeated"/>
+ <enum extends="VkSamplerAddressMode" name="VK_SAMPLER_ADDRESS_MODE_MIRROR_CLAMP_TO_EDGE_KHR" alias="VK_SAMPLER_ADDRESS_MODE_MIRROR_CLAMP_TO_EDGE" comment="Alias introduced for consistency with extension suffixing rules"/>
</require>
</extension>
- <extension name="VK_IMG_filter_cubic" number="16" type="device" author="IMG" contact="Tobias Hector @tobias" supported="vulkan">
+ <extension name="VK_IMG_filter_cubic" number="16" type="device" author="IMG" contact="Tobias Hector @tobski" supported="vulkan">
<require>
- <enum value="1" name="VK_IMG_FILTER_CUBIC_SPEC_VERSION"/>
- <enum value="&quot;VK_IMG_filter_cubic&quot;" name="VK_IMG_FILTER_CUBIC_EXTENSION_NAME"/>
- <enum offset="0" extends="VkFilter" name="VK_FILTER_CUBIC_IMG"/>
- <enum bitpos="13" extends="VkFormatFeatureFlagBits" name="VK_FORMAT_FEATURE_SAMPLED_IMAGE_FILTER_CUBIC_BIT_IMG" comment="Format can be filtered with VK_FILTER_CUBIC_IMG when being sampled"/>
+ <enum value="1" name="VK_IMG_FILTER_CUBIC_SPEC_VERSION"/>
+ <enum value="&quot;VK_IMG_filter_cubic&quot;" name="VK_IMG_FILTER_CUBIC_EXTENSION_NAME"/>
+ <enum extends="VkFilter" name="VK_FILTER_CUBIC_IMG" alias="VK_FILTER_CUBIC_EXT"/>
+ <enum extends="VkFormatFeatureFlagBits" name="VK_FORMAT_FEATURE_SAMPLED_IMAGE_FILTER_CUBIC_BIT_IMG" alias="VK_FORMAT_FEATURE_SAMPLED_IMAGE_FILTER_CUBIC_BIT_EXT" comment="Format can be filtered with VK_FILTER_CUBIC_IMG when being sampled"/>
</require>
</extension>
- <extension name="VK_AMD_extension_17" number="17" author="AMD" contact="Daniel Rakos @aqnuep" supported="disabled">
+ <extension name="VK_AMD_extension_17" number="17" author="AMD" contact="Daniel Rakos @drakos-amd" supported="disabled">
<require>
- <enum value="0" name="VK_AMD_EXTENSION_17_SPEC_VERSION"/>
- <enum value="&quot;VK_AMD_extension_17&quot;" name="VK_AMD_EXTENSION_17_EXTENSION_NAME"/>
+ <enum value="0" name="VK_AMD_EXTENSION_17_SPEC_VERSION"/>
+ <enum value="&quot;VK_AMD_extension_17&quot;" name="VK_AMD_EXTENSION_17_EXTENSION_NAME"/>
</require>
</extension>
- <extension name="VK_AMD_extension_18" number="18" author="AMD" contact="Daniel Rakos @aqnuep" supported="disabled">
+ <extension name="VK_AMD_extension_18" number="18" author="AMD" contact="Daniel Rakos @drakos-amd" supported="disabled">
<require>
- <enum value="0" name="VK_AMD_EXTENSION_18_SPEC_VERSION"/>
- <enum value="&quot;VK_AMD_extension_18&quot;" name="VK_AMD_EXTENSION_18_EXTENSION_NAME"/>
+ <enum value="0" name="VK_AMD_EXTENSION_18_SPEC_VERSION"/>
+ <enum value="&quot;VK_AMD_extension_18&quot;" name="VK_AMD_EXTENSION_18_EXTENSION_NAME"/>
</require>
</extension>
- <extension name="VK_AMD_rasterization_order" number="19" type="device" author="AMD" contact="Daniel Rakos @aqnuep" supported="vulkan">
+ <extension name="VK_AMD_rasterization_order" number="19" type="device" author="AMD" contact="Daniel Rakos @drakos-amd" supported="vulkan">
<require>
- <enum value="1" name="VK_AMD_RASTERIZATION_ORDER_SPEC_VERSION"/>
- <enum value="&quot;VK_AMD_rasterization_order&quot;" name="VK_AMD_RASTERIZATION_ORDER_EXTENSION_NAME"/>
- <enum offset="0" extends="VkStructureType" name="VK_STRUCTURE_TYPE_PIPELINE_RASTERIZATION_STATE_RASTERIZATION_ORDER_AMD"/>
+ <enum value="1" name="VK_AMD_RASTERIZATION_ORDER_SPEC_VERSION"/>
+ <enum value="&quot;VK_AMD_rasterization_order&quot;" name="VK_AMD_RASTERIZATION_ORDER_EXTENSION_NAME"/>
+ <enum offset="0" extends="VkStructureType" name="VK_STRUCTURE_TYPE_PIPELINE_RASTERIZATION_STATE_RASTERIZATION_ORDER_AMD"/>
<type name="VkRasterizationOrderAMD"/>
<type name="VkPipelineRasterizationStateRasterizationOrderAMD"/>
</require>
</extension>
- <extension name="VK_AMD_extension_20" number="20" author="AMD" contact="Daniel Rakos @aqnuep" supported="disabled">
+ <extension name="VK_AMD_extension_20" number="20" author="AMD" contact="Daniel Rakos @drakos-amd" supported="disabled">
<require>
- <enum value="0" name="VK_AMD_EXTENSION_20_SPEC_VERSION"/>
- <enum value="&quot;VK_AMD_extension_20&quot;" name="VK_AMD_EXTENSION_20_EXTENSION_NAME"/>
+ <enum value="0" name="VK_AMD_EXTENSION_20_SPEC_VERSION"/>
+ <enum value="&quot;VK_AMD_extension_20&quot;" name="VK_AMD_EXTENSION_20_EXTENSION_NAME"/>
</require>
</extension>
- <extension name="VK_AMD_shader_trinary_minmax" number="21" type="device" author="AMD" contact="quentin.lin@amd.com" supported="vulkan">
+ <extension name="VK_AMD_shader_trinary_minmax" number="21" type="device" author="AMD" contact="Qun Lin @linqun" supported="vulkan">
<require>
- <enum value="1" name="VK_AMD_SHADER_TRINARY_MINMAX_SPEC_VERSION"/>
- <enum value="&quot;VK_AMD_shader_trinary_minmax&quot;" name="VK_AMD_SHADER_TRINARY_MINMAX_EXTENSION_NAME"/>
+ <enum value="1" name="VK_AMD_SHADER_TRINARY_MINMAX_SPEC_VERSION"/>
+ <enum value="&quot;VK_AMD_shader_trinary_minmax&quot;" name="VK_AMD_SHADER_TRINARY_MINMAX_EXTENSION_NAME"/>
</require>
</extension>
- <extension name="VK_AMD_shader_explicit_vertex_parameter" number="22" type="device" author="AMD" contact="quentin.lin@amd.com" supported="vulkan">
+ <extension name="VK_AMD_shader_explicit_vertex_parameter" number="22" type="device" author="AMD" contact="Qun Lin @linqun" supported="vulkan">
<require>
- <enum value="1" name="VK_AMD_SHADER_EXPLICIT_VERTEX_PARAMETER_SPEC_VERSION"/>
+ <enum value="1" name="VK_AMD_SHADER_EXPLICIT_VERTEX_PARAMETER_SPEC_VERSION"/>
<enum value="&quot;VK_AMD_shader_explicit_vertex_parameter&quot;" name="VK_AMD_SHADER_EXPLICIT_VERTEX_PARAMETER_EXTENSION_NAME"/>
</require>
</extension>
- <extension name="VK_EXT_debug_marker" number="23" type="device" author="Baldur Karlsson" contact="baldurk@baldurk.org" supported="vulkan">
+ <extension name="VK_EXT_debug_marker" number="23" type="device" requires="VK_EXT_debug_report" author="Baldur Karlsson" contact="Baldur Karlsson @baldurk" specialuse="debugging" supported="vulkan" promotedto="VK_EXT_debug_utils">
<require>
- <enum value="3" name="VK_EXT_DEBUG_MARKER_SPEC_VERSION"/>
- <enum value="&quot;VK_EXT_debug_marker&quot;" name="VK_EXT_DEBUG_MARKER_EXTENSION_NAME"/>
- <enum offset="0" extends="VkStructureType" name="VK_STRUCTURE_TYPE_DEBUG_MARKER_OBJECT_NAME_INFO_EXT"/>
- <enum offset="1" extends="VkStructureType" name="VK_STRUCTURE_TYPE_DEBUG_MARKER_OBJECT_TAG_INFO_EXT"/>
- <enum offset="2" extends="VkStructureType" name="VK_STRUCTURE_TYPE_DEBUG_MARKER_MARKER_INFO_EXT"/>
+ <enum value="4" name="VK_EXT_DEBUG_MARKER_SPEC_VERSION"/>
+ <enum value="&quot;VK_EXT_debug_marker&quot;" name="VK_EXT_DEBUG_MARKER_EXTENSION_NAME"/>
+ <enum offset="0" extends="VkStructureType" name="VK_STRUCTURE_TYPE_DEBUG_MARKER_OBJECT_NAME_INFO_EXT"/>
+ <enum offset="1" extends="VkStructureType" name="VK_STRUCTURE_TYPE_DEBUG_MARKER_OBJECT_TAG_INFO_EXT"/>
+ <enum offset="2" extends="VkStructureType" name="VK_STRUCTURE_TYPE_DEBUG_MARKER_MARKER_INFO_EXT"/>
+ <type name="VkDebugReportObjectTypeEXT"/>
<type name="VkDebugMarkerObjectNameInfoEXT"/>
<type name="VkDebugMarkerObjectTagInfoEXT"/>
<type name="VkDebugMarkerMarkerInfoEXT"/>
@@ -4557,218 +13794,534 @@ maintained in the master branch of the Khronos Vulkan GitHub project.
<command name="vkCmdDebugMarkerInsertEXT"/>
</require>
</extension>
- <extension name="VK_AMD_extension_24" number="24" author="AMD" contact="Daniel Rakos @aqnuep" supported="disabled">
+ <extension name="VK_KHR_video_queue" number="24" type="device" requires="VK_KHR_get_physical_device_properties2,VK_KHR_synchronization2" author="KHR" contact="Tony Zlatinski @tzlatinski" provisional="true" platform="provisional" supported="vulkan" requiresCore="1.1">
<require>
- <enum value="0" name="VK_AMD_EXTENSION_24_SPEC_VERSION"/>
- <enum value="&quot;VK_AMD_extension_24&quot;" name="VK_AMD_EXTENSION_24_EXTENSION_NAME"/>
+ <enum value="4" name="VK_KHR_VIDEO_QUEUE_SPEC_VERSION"/>
+ <enum value="&quot;VK_KHR_video_queue&quot;" name="VK_KHR_VIDEO_QUEUE_EXTENSION_NAME"/>
+ <enum offset="0" extends="VkStructureType" name="VK_STRUCTURE_TYPE_VIDEO_PROFILE_KHR" protect="VK_ENABLE_BETA_EXTENSIONS"/>
+ <enum offset="1" extends="VkStructureType" name="VK_STRUCTURE_TYPE_VIDEO_CAPABILITIES_KHR" protect="VK_ENABLE_BETA_EXTENSIONS"/>
+ <enum offset="2" extends="VkStructureType" name="VK_STRUCTURE_TYPE_VIDEO_PICTURE_RESOURCE_KHR" protect="VK_ENABLE_BETA_EXTENSIONS"/>
+ <enum offset="3" extends="VkStructureType" name="VK_STRUCTURE_TYPE_VIDEO_GET_MEMORY_PROPERTIES_KHR" protect="VK_ENABLE_BETA_EXTENSIONS"/>
+ <enum offset="4" extends="VkStructureType" name="VK_STRUCTURE_TYPE_VIDEO_BIND_MEMORY_KHR" protect="VK_ENABLE_BETA_EXTENSIONS"/>
+ <enum offset="5" extends="VkStructureType" name="VK_STRUCTURE_TYPE_VIDEO_SESSION_CREATE_INFO_KHR" protect="VK_ENABLE_BETA_EXTENSIONS"/>
+ <enum offset="6" extends="VkStructureType" name="VK_STRUCTURE_TYPE_VIDEO_SESSION_PARAMETERS_CREATE_INFO_KHR" protect="VK_ENABLE_BETA_EXTENSIONS"/>
+ <enum offset="7" extends="VkStructureType" name="VK_STRUCTURE_TYPE_VIDEO_SESSION_PARAMETERS_UPDATE_INFO_KHR" protect="VK_ENABLE_BETA_EXTENSIONS"/>
+ <enum offset="8" extends="VkStructureType" name="VK_STRUCTURE_TYPE_VIDEO_BEGIN_CODING_INFO_KHR" protect="VK_ENABLE_BETA_EXTENSIONS"/>
+ <enum offset="9" extends="VkStructureType" name="VK_STRUCTURE_TYPE_VIDEO_END_CODING_INFO_KHR" protect="VK_ENABLE_BETA_EXTENSIONS"/>
+ <enum offset="10" extends="VkStructureType" name="VK_STRUCTURE_TYPE_VIDEO_CODING_CONTROL_INFO_KHR" protect="VK_ENABLE_BETA_EXTENSIONS"/>
+ <enum offset="11" extends="VkStructureType" name="VK_STRUCTURE_TYPE_VIDEO_REFERENCE_SLOT_KHR" protect="VK_ENABLE_BETA_EXTENSIONS"/>
+ <enum offset="12" extends="VkStructureType" name="VK_STRUCTURE_TYPE_VIDEO_QUEUE_FAMILY_PROPERTIES_2_KHR" protect="VK_ENABLE_BETA_EXTENSIONS"/>
+ <enum offset="13" extends="VkStructureType" name="VK_STRUCTURE_TYPE_VIDEO_PROFILES_KHR" protect="VK_ENABLE_BETA_EXTENSIONS"/>
+ <enum offset="14" extends="VkStructureType" name="VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_VIDEO_FORMAT_INFO_KHR" protect="VK_ENABLE_BETA_EXTENSIONS"/>
+ <enum offset="15" extends="VkStructureType" name="VK_STRUCTURE_TYPE_VIDEO_FORMAT_PROPERTIES_KHR" protect="VK_ENABLE_BETA_EXTENSIONS"/>
+ <enum offset="16" extends="VkStructureType" name="VK_STRUCTURE_TYPE_QUEUE_FAMILY_QUERY_RESULT_STATUS_PROPERTIES_2_KHR" protect="VK_ENABLE_BETA_EXTENSIONS"/>
+
+ <enum offset="0" extends="VkObjectType" name="VK_OBJECT_TYPE_VIDEO_SESSION_KHR" comment="VkVideoSessionKHR" protect="VK_ENABLE_BETA_EXTENSIONS"/>
+ <enum offset="1" extends="VkObjectType" name="VK_OBJECT_TYPE_VIDEO_SESSION_PARAMETERS_KHR" comment="VkVideoSessionParametersKHR" protect="VK_ENABLE_BETA_EXTENSIONS"/>
+
+ <enum offset="0" extends="VkQueryType" name="VK_QUERY_TYPE_RESULT_STATUS_ONLY_KHR" protect="VK_ENABLE_BETA_EXTENSIONS"/>
+ <enum bitpos="4" extends="VkQueryResultFlagBits" name="VK_QUERY_RESULT_WITH_STATUS_BIT_KHR" protect="VK_ENABLE_BETA_EXTENSIONS"/>
+
+ <enum offset="0" extends="VkResult" dir="-" name="VK_ERROR_IMAGE_USAGE_NOT_SUPPORTED_KHR" protect="VK_ENABLE_BETA_EXTENSIONS"/>
+ <enum offset="1" extends="VkResult" dir="-" name="VK_ERROR_VIDEO_PICTURE_LAYOUT_NOT_SUPPORTED_KHR" protect="VK_ENABLE_BETA_EXTENSIONS"/>
+ <enum offset="2" extends="VkResult" dir="-" name="VK_ERROR_VIDEO_PROFILE_OPERATION_NOT_SUPPORTED_KHR" protect="VK_ENABLE_BETA_EXTENSIONS"/>
+ <enum offset="3" extends="VkResult" dir="-" name="VK_ERROR_VIDEO_PROFILE_FORMAT_NOT_SUPPORTED_KHR" protect="VK_ENABLE_BETA_EXTENSIONS"/>
+ <enum offset="4" extends="VkResult" dir="-" name="VK_ERROR_VIDEO_PROFILE_CODEC_NOT_SUPPORTED_KHR" protect="VK_ENABLE_BETA_EXTENSIONS"/>
+ <enum offset="5" extends="VkResult" dir="-" name="VK_ERROR_VIDEO_STD_VERSION_NOT_SUPPORTED_KHR" protect="VK_ENABLE_BETA_EXTENSIONS"/>
+
+ <type name="VkVideoSessionKHR"/>
+ <type name="VkVideoSessionParametersKHR"/>
+
+ <type name="VkVideoCodecOperationFlagBitsKHR"/>
+ <type name="VkVideoCodecOperationFlagsKHR"/>
+ <type name="VkVideoChromaSubsamplingFlagBitsKHR"/>
+ <type name="VkVideoChromaSubsamplingFlagsKHR"/>
+ <type name="VkVideoComponentBitDepthFlagBitsKHR"/>
+ <type name="VkVideoComponentBitDepthFlagsKHR"/>
+ <type name="VkVideoCapabilityFlagBitsKHR"/>
+ <type name="VkVideoCapabilityFlagsKHR"/>
+ <type name="VkVideoSessionCreateFlagBitsKHR"/>
+ <type name="VkVideoSessionCreateFlagsKHR"/>
+ <type name="VkVideoBeginCodingFlagsKHR"/>
+ <type name="VkVideoEndCodingFlagsKHR"/>
+ <type name="VkVideoCodingControlFlagBitsKHR"/>
+ <type name="VkVideoCodingControlFlagsKHR"/>
+ <type name="VkVideoCodingQualityPresetFlagBitsKHR"/>
+ <type name="VkVideoCodingQualityPresetFlagsKHR"/>
+
+ <type name="VkQueueFamilyQueryResultStatusProperties2KHR"/>
+ <type name="VkQueryResultStatusKHR"/>
+
+ <type name="VkVideoQueueFamilyProperties2KHR"/>
+ <type name="VkVideoProfileKHR"/>
+ <type name="VkVideoProfilesKHR"/>
+ <type name="VkVideoCapabilitiesKHR"/>
+ <type name="VkPhysicalDeviceVideoFormatInfoKHR"/>
+ <type name="VkVideoFormatPropertiesKHR"/>
+ <type name="VkVideoPictureResourceKHR"/>
+ <type name="VkVideoReferenceSlotKHR"/>
+ <type name="VkVideoGetMemoryPropertiesKHR"/>
+ <type name="VkVideoBindMemoryKHR"/>
+ <type name="VkVideoSessionCreateInfoKHR"/>
+ <type name="VkVideoSessionParametersCreateInfoKHR"/>
+ <type name="VkVideoSessionParametersUpdateInfoKHR"/>
+ <type name="VkVideoBeginCodingInfoKHR"/>
+ <type name="VkVideoEndCodingInfoKHR"/>
+ <type name="VkVideoCodingControlInfoKHR"/>
+
+ <command name="vkGetPhysicalDeviceVideoCapabilitiesKHR"/>
+ <command name="vkGetPhysicalDeviceVideoFormatPropertiesKHR"/>
+
+ <command name="vkCreateVideoSessionKHR"/>
+ <command name="vkDestroyVideoSessionKHR"/>
+ <command name="vkGetVideoSessionMemoryRequirementsKHR"/>
+ <command name="vkBindVideoSessionMemoryKHR"/>
+ <command name="vkCreateVideoSessionParametersKHR"/>
+ <command name="vkUpdateVideoSessionParametersKHR"/>
+ <command name="vkDestroyVideoSessionParametersKHR"/>
+ <command name="vkCmdBeginVideoCodingKHR"/>
+ <command name="vkCmdEndVideoCodingKHR"/>
+ <command name="vkCmdControlVideoCodingKHR"/>
</require>
</extension>
- <extension name="VK_AMD_extension_25" number="25" author="AMD" contact="Daniel Rakos @aqnuep" supported="disabled">
+ <extension name="VK_KHR_video_decode_queue" number="25" type="device" requires="VK_KHR_video_queue,VK_KHR_synchronization2" author="KHR" contact="jake.beju@amd.com" provisional="true" platform="provisional" supported="vulkan">
<require>
- <enum value="0" name="VK_AMD_EXTENSION_25_SPEC_VERSION"/>
- <enum value="&quot;VK_AMD_extension_25&quot;" name="VK_AMD_EXTENSION_25_EXTENSION_NAME"/>
+ <enum value="4" name="VK_KHR_VIDEO_DECODE_QUEUE_SPEC_VERSION"/>
+ <enum value="&quot;VK_KHR_video_decode_queue&quot;" name="VK_KHR_VIDEO_DECODE_QUEUE_EXTENSION_NAME"/>
+ <enum offset="0" extends="VkStructureType" name="VK_STRUCTURE_TYPE_VIDEO_DECODE_INFO_KHR" protect="VK_ENABLE_BETA_EXTENSIONS"/>
+ <enum offset="1" extends="VkStructureType" name="VK_STRUCTURE_TYPE_VIDEO_DECODE_CAPABILITIES_KHR" protect="VK_ENABLE_BETA_EXTENSIONS"/>
+ <enum bitpos="5" extends="VkQueueFlagBits" name="VK_QUEUE_VIDEO_DECODE_BIT_KHR" protect="VK_ENABLE_BETA_EXTENSIONS"/>
+ <!-- VkPipelineStageFlagBits bitpos="26" is reserved by this extension, but not used -->
+ <enum bitpos="26" extends="VkPipelineStageFlagBits2" name="VK_PIPELINE_STAGE_2_VIDEO_DECODE_BIT_KHR" protect="VK_ENABLE_BETA_EXTENSIONS"/>
+ <enum bitpos="35" extends="VkAccessFlagBits2" name="VK_ACCESS_2_VIDEO_DECODE_READ_BIT_KHR" protect="VK_ENABLE_BETA_EXTENSIONS" />
+ <enum bitpos="36" extends="VkAccessFlagBits2" name="VK_ACCESS_2_VIDEO_DECODE_WRITE_BIT_KHR" protect="VK_ENABLE_BETA_EXTENSIONS"/>
+ <enum bitpos="13" extends="VkBufferUsageFlagBits" name="VK_BUFFER_USAGE_VIDEO_DECODE_SRC_BIT_KHR" protect="VK_ENABLE_BETA_EXTENSIONS"/>
+ <enum bitpos="14" extends="VkBufferUsageFlagBits" name="VK_BUFFER_USAGE_VIDEO_DECODE_DST_BIT_KHR" protect="VK_ENABLE_BETA_EXTENSIONS"/>
+ <enum bitpos="10" extends="VkImageUsageFlagBits" name="VK_IMAGE_USAGE_VIDEO_DECODE_DST_BIT_KHR" protect="VK_ENABLE_BETA_EXTENSIONS"/>
+ <enum bitpos="11" extends="VkImageUsageFlagBits" name="VK_IMAGE_USAGE_VIDEO_DECODE_SRC_BIT_KHR" protect="VK_ENABLE_BETA_EXTENSIONS"/>
+ <enum bitpos="12" extends="VkImageUsageFlagBits" name="VK_IMAGE_USAGE_VIDEO_DECODE_DPB_BIT_KHR" protect="VK_ENABLE_BETA_EXTENSIONS"/>
+ <enum bitpos="25" extends="VkFormatFeatureFlagBits" name="VK_FORMAT_FEATURE_VIDEO_DECODE_OUTPUT_BIT_KHR" protect="VK_ENABLE_BETA_EXTENSIONS"/>
+ <enum bitpos="26" extends="VkFormatFeatureFlagBits" name="VK_FORMAT_FEATURE_VIDEO_DECODE_DPB_BIT_KHR" protect="VK_ENABLE_BETA_EXTENSIONS"/>
+ <enum offset="0" extends="VkImageLayout" name="VK_IMAGE_LAYOUT_VIDEO_DECODE_DST_KHR" protect="VK_ENABLE_BETA_EXTENSIONS"/>
+ <enum offset="1" extends="VkImageLayout" name="VK_IMAGE_LAYOUT_VIDEO_DECODE_SRC_KHR" protect="VK_ENABLE_BETA_EXTENSIONS"/>
+ <enum offset="2" extends="VkImageLayout" name="VK_IMAGE_LAYOUT_VIDEO_DECODE_DPB_KHR" protect="VK_ENABLE_BETA_EXTENSIONS"/>
+
+ <type name="VkVideoDecodeCapabilityFlagBitsKHR"/>
+ <type name="VkVideoDecodeCapabilityFlagsKHR"/>
+ <type name="VkVideoDecodeCapabilitiesKHR"/>
+
+ <type name="VkVideoDecodeFlagBitsKHR"/>
+ <type name="VkVideoDecodeFlagsKHR"/>
+
+ <type name="VkVideoDecodeInfoKHR"/>
+ <command name="vkCmdDecodeVideoKHR"/>
+ </require>
+ <require extension="VK_KHR_format_feature_flags2">
+ <enum bitpos="25" extends="VkFormatFeatureFlagBits2" name="VK_FORMAT_FEATURE_2_VIDEO_DECODE_OUTPUT_BIT_KHR" protect="VK_ENABLE_BETA_EXTENSIONS"/>
+ <enum bitpos="26" extends="VkFormatFeatureFlagBits2" name="VK_FORMAT_FEATURE_2_VIDEO_DECODE_DPB_BIT_KHR" protect="VK_ENABLE_BETA_EXTENSIONS"/>
</require>
</extension>
- <extension name="VK_AMD_gcn_shader" number="26" type="device" author="AMD" contact="dominik.witczak@amd.com" supported="vulkan">
+ <extension name="VK_AMD_gcn_shader" number="26" type="device" author="AMD" contact="Dominik Witczak @dominikwitczakamd" supported="vulkan">
<require>
- <enum value="1" name="VK_AMD_GCN_SHADER_SPEC_VERSION"/>
- <enum value="&quot;VK_AMD_gcn_shader&quot;" name="VK_AMD_GCN_SHADER_EXTENSION_NAME"/>
+ <enum value="1" name="VK_AMD_GCN_SHADER_SPEC_VERSION"/>
+ <enum value="&quot;VK_AMD_gcn_shader&quot;" name="VK_AMD_GCN_SHADER_EXTENSION_NAME"/>
</require>
</extension>
- <extension name="VK_NV_dedicated_allocation" number="27" type="device" author="NVIDIA" contact="Jeff Bolz @jbolz" supported="vulkan">
+ <extension name="VK_NV_dedicated_allocation" number="27" type="device" author="NV" contact="Jeff Bolz @jeffbolznv" supported="vulkan" deprecatedby="VK_KHR_dedicated_allocation">
<require>
- <enum value="1" name="VK_NV_DEDICATED_ALLOCATION_SPEC_VERSION"/>
- <enum value="&quot;VK_NV_dedicated_allocation&quot;" name="VK_NV_DEDICATED_ALLOCATION_EXTENSION_NAME"/>
- <enum offset="0" extends="VkStructureType" name="VK_STRUCTURE_TYPE_DEDICATED_ALLOCATION_IMAGE_CREATE_INFO_NV"/>
- <enum offset="1" extends="VkStructureType" name="VK_STRUCTURE_TYPE_DEDICATED_ALLOCATION_BUFFER_CREATE_INFO_NV"/>
- <enum offset="2" extends="VkStructureType" name="VK_STRUCTURE_TYPE_DEDICATED_ALLOCATION_MEMORY_ALLOCATE_INFO_NV"/>
+ <enum value="1" name="VK_NV_DEDICATED_ALLOCATION_SPEC_VERSION"/>
+ <enum value="&quot;VK_NV_dedicated_allocation&quot;" name="VK_NV_DEDICATED_ALLOCATION_EXTENSION_NAME"/>
+ <enum offset="0" extends="VkStructureType" name="VK_STRUCTURE_TYPE_DEDICATED_ALLOCATION_IMAGE_CREATE_INFO_NV"/>
+ <enum offset="1" extends="VkStructureType" name="VK_STRUCTURE_TYPE_DEDICATED_ALLOCATION_BUFFER_CREATE_INFO_NV"/>
+ <enum offset="2" extends="VkStructureType" name="VK_STRUCTURE_TYPE_DEDICATED_ALLOCATION_MEMORY_ALLOCATE_INFO_NV"/>
<type name="VkDedicatedAllocationImageCreateInfoNV"/>
<type name="VkDedicatedAllocationBufferCreateInfoNV"/>
<type name="VkDedicatedAllocationMemoryAllocateInfoNV"/>
</require>
</extension>
- <extension name="VK_EXT_extension_28" number="28" author="NVIDIA" contact="Piers Daniell @pdaniell" supported="disabled">
+ <extension name="VK_EXT_extension_28" number="28" author="NV" contact="Piers Daniell @pdaniell-nv" supported="disabled">
<require>
- <enum value="0" name="VK_EXT_EXTENSION_28_SPEC_VERSION"/>
- <enum value="&quot;VK_NV_extension_28&quot;" name="VK_EXT_EXTENSION_28_EXTENSION_NAME"/>
+ <enum value="0" name="VK_EXT_EXTENSION_28_SPEC_VERSION"/>
+ <enum value="&quot;VK_EXT_extension_28&quot;" name="VK_EXT_EXTENSION_28_EXTENSION_NAME"/>
</require>
</extension>
- <extension name="VK_NVX_extension_29" number="29" author="NVIDIA" contact="Jeff Juliano @jjuliano" supported="disabled">
+ <extension name="VK_EXT_transform_feedback" number="29" type="device" author="NV" contact="Piers Daniell @pdaniell-nv" specialuse="glemulation,d3demulation,devtools" supported="vulkan" requires="VK_KHR_get_physical_device_properties2">
<require>
- <enum value="0" name="VK_NVX_EXTENSION_29_SPEC_VERSION"/>
- <enum value="&quot;VK_NVX_extension_29&quot;" name="VK_NVX_EXTENSION_29_EXTENSION_NAME"/>
+ <enum value="1" name="VK_EXT_TRANSFORM_FEEDBACK_SPEC_VERSION"/>
+ <enum value="&quot;VK_EXT_transform_feedback&quot;" name="VK_EXT_TRANSFORM_FEEDBACK_EXTENSION_NAME"/>
+ <command name="vkCmdBindTransformFeedbackBuffersEXT"/>
+ <command name="vkCmdBeginTransformFeedbackEXT"/>
+ <command name="vkCmdEndTransformFeedbackEXT"/>
+ <command name="vkCmdBeginQueryIndexedEXT"/>
+ <command name="vkCmdEndQueryIndexedEXT"/>
+ <command name="vkCmdDrawIndirectByteCountEXT"/>
+
+ <enum offset="0" extends="VkStructureType" name="VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_TRANSFORM_FEEDBACK_FEATURES_EXT"/>
+ <enum offset="1" extends="VkStructureType" name="VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_TRANSFORM_FEEDBACK_PROPERTIES_EXT"/>
+ <enum offset="2" extends="VkStructureType" name="VK_STRUCTURE_TYPE_PIPELINE_RASTERIZATION_STATE_STREAM_CREATE_INFO_EXT"/>
+
+ <enum offset="4" extends="VkQueryType" name="VK_QUERY_TYPE_TRANSFORM_FEEDBACK_STREAM_EXT"/>
+
+ <enum bitpos="11" extends="VkBufferUsageFlagBits" name="VK_BUFFER_USAGE_TRANSFORM_FEEDBACK_BUFFER_BIT_EXT"/>
+ <enum bitpos="12" extends="VkBufferUsageFlagBits" name="VK_BUFFER_USAGE_TRANSFORM_FEEDBACK_COUNTER_BUFFER_BIT_EXT"/>
+
+ <enum bitpos="25" extends="VkAccessFlagBits" name="VK_ACCESS_TRANSFORM_FEEDBACK_WRITE_BIT_EXT"/>
+ <enum bitpos="26" extends="VkAccessFlagBits" name="VK_ACCESS_TRANSFORM_FEEDBACK_COUNTER_READ_BIT_EXT"/>
+ <enum bitpos="27" extends="VkAccessFlagBits" name="VK_ACCESS_TRANSFORM_FEEDBACK_COUNTER_WRITE_BIT_EXT"/>
+
+ <enum bitpos="24" extends="VkPipelineStageFlagBits" name="VK_PIPELINE_STAGE_TRANSFORM_FEEDBACK_BIT_EXT"/>
+
+ <type name="VkPhysicalDeviceTransformFeedbackFeaturesEXT"/>
+ <type name="VkPhysicalDeviceTransformFeedbackPropertiesEXT"/>
+ <type name="VkPipelineRasterizationStateStreamCreateInfoEXT"/>
+
+ <type name="VkPipelineRasterizationStateStreamCreateFlagsEXT"/>
</require>
</extension>
- <extension name="VK_NVX_extension_30" number="30" author="NVIDIA" contact="Jeff Juliano @jjuliano" supported="disabled">
+ <extension name="VK_NVX_binary_import" number="30" type="device" author="NVX" contact="Eric Werness @ewerness-nv,Liam Middlebrook @liam-middlebrook" supported="vulkan">
<require>
- <enum value="0" name="VK_NVX_EXTENSION_30_SPEC_VERSION"/>
- <enum value="&quot;VK_NVX_extension_30&quot;" name="VK_NVX_EXTENSION_30_EXTENSION_NAME"/>
+ <enum value="1" name="VK_NVX_BINARY_IMPORT_SPEC_VERSION"/>
+ <enum value="&quot;VK_NVX_binary_import&quot;" name="VK_NVX_BINARY_IMPORT_EXTENSION_NAME"/>
+ <enum offset="0" extends="VkStructureType" name="VK_STRUCTURE_TYPE_CU_MODULE_CREATE_INFO_NVX"/>
+ <enum offset="1" extends="VkStructureType" name="VK_STRUCTURE_TYPE_CU_FUNCTION_CREATE_INFO_NVX"/>
+ <enum offset="2" extends="VkStructureType" name="VK_STRUCTURE_TYPE_CU_LAUNCH_INFO_NVX"/>
+ <enum offset="0" extends="VkObjectType" name="VK_OBJECT_TYPE_CU_MODULE_NVX"/>
+ <enum offset="1" extends="VkObjectType" name="VK_OBJECT_TYPE_CU_FUNCTION_NVX"/>
+ <enum offset="0" extends="VkDebugReportObjectTypeEXT" name="VK_DEBUG_REPORT_OBJECT_TYPE_CU_MODULE_NVX_EXT"/>
+ <enum offset="1" extends="VkDebugReportObjectTypeEXT" name="VK_DEBUG_REPORT_OBJECT_TYPE_CU_FUNCTION_NVX_EXT"/>
+ <type name="VkCuModuleNVX"/>
+ <type name="VkCuFunctionNVX"/>
+ <type name="VkCuModuleCreateInfoNVX"/>
+ <type name="VkCuFunctionCreateInfoNVX"/>
+ <type name="VkCuLaunchInfoNVX"/>
+ <command name="vkCreateCuModuleNVX"/>
+ <command name="vkCreateCuFunctionNVX"/>
+ <command name="vkDestroyCuModuleNVX"/>
+ <command name="vkDestroyCuFunctionNVX"/>
+ <command name="vkCmdCuLaunchKernelNVX"/>
</require>
</extension>
- <extension name="VK_NVX_extension_31" number="31" author="NVIDIA" contact="Jeff Juliano @jjuliano" supported="disabled">
+ <extension name="VK_NVX_image_view_handle" number="31" type="device" author="NVX" contact="Eric Werness @ewerness-nv" supported="vulkan">
<require>
- <enum value="0" name="VK_NVX_EXTENSION_31_SPEC_VERSION"/>
- <enum value="&quot;VK_NVX_extension_31&quot;" name="VK_NVX_EXTENSION_31_EXTENSION_NAME"/>
+ <enum value="2" name="VK_NVX_IMAGE_VIEW_HANDLE_SPEC_VERSION"/>
+ <enum value="&quot;VK_NVX_image_view_handle&quot;" name="VK_NVX_IMAGE_VIEW_HANDLE_EXTENSION_NAME"/>
+ <enum offset="0" extends="VkStructureType" name="VK_STRUCTURE_TYPE_IMAGE_VIEW_HANDLE_INFO_NVX"/>
+ <enum offset="1" extends="VkStructureType" name="VK_STRUCTURE_TYPE_IMAGE_VIEW_ADDRESS_PROPERTIES_NVX"/>
+ <type name="VkImageViewHandleInfoNVX"/>
+ <type name="VkImageViewAddressPropertiesNVX"/>
+ <command name="vkGetImageViewHandleNVX"/>
+ <command name="vkGetImageViewAddressNVX"/>
</require>
</extension>
- <extension name="VK_AMD_extension_32" number="32" author="AMD" contact="Daniel Rakos @aqnuep" supported="disabled">
+ <extension name="VK_AMD_extension_32" number="32" author="AMD" contact="Daniel Rakos @drakos-amd" supported="disabled">
<require>
- <enum value="0" name="VK_AMD_EXTENSION_32_SPEC_VERSION"/>
- <enum value="&quot;VK_AMD_extension_32&quot;" name="VK_AMD_EXTENSION_32_EXTENSION_NAME"/>
+ <enum value="0" name="VK_AMD_EXTENSION_32_SPEC_VERSION"/>
+ <enum value="&quot;VK_AMD_extension_32&quot;" name="VK_AMD_EXTENSION_32_EXTENSION_NAME"/>
</require>
</extension>
- <extension name="VK_AMD_extension_33" number="33" author="AMD" contact="Daniel Rakos @aqnuep" supported="disabled">
+ <extension name="VK_AMD_extension_33" number="33" author="AMD" contact="Daniel Rakos @drakos-amd" supported="disabled">
<require>
- <enum value="0" name="VK_AMD_EXTENSION_33_SPEC_VERSION"/>
- <enum value="&quot;VK_AMD_extension_33&quot;" name="VK_AMD_EXTENSION_33_EXTENSION_NAME"/>
+ <enum value="0" name="VK_AMD_EXTENSION_33_SPEC_VERSION"/>
+ <enum value="&quot;VK_AMD_extension_33&quot;" name="VK_AMD_EXTENSION_33_EXTENSION_NAME"/>
</require>
</extension>
- <extension name="VK_AMD_draw_indirect_count" number="34" type="device" author="AMD" contact="Daniel Rakos @aqnuep" supported="vulkan">
+ <extension name="VK_AMD_draw_indirect_count" number="34" type="device" author="AMD" contact="Daniel Rakos @drakos-amd" supported="vulkan" promotedto="VK_KHR_draw_indirect_count">
<require>
- <enum value="1" name="VK_AMD_DRAW_INDIRECT_COUNT_SPEC_VERSION"/>
- <enum value="&quot;VK_AMD_draw_indirect_count&quot;" name="VK_AMD_DRAW_INDIRECT_COUNT_EXTENSION_NAME"/>
+ <enum value="2" name="VK_AMD_DRAW_INDIRECT_COUNT_SPEC_VERSION"/>
+ <enum value="&quot;VK_AMD_draw_indirect_count&quot;" name="VK_AMD_DRAW_INDIRECT_COUNT_EXTENSION_NAME"/>
<command name="vkCmdDrawIndirectCountAMD"/>
<command name="vkCmdDrawIndexedIndirectCountAMD"/>
</require>
</extension>
- <extension name="VK_AMD_extension_35" number="35" author="AMD" contact="Daniel Rakos @aqnuep" supported="disabled">
+ <extension name="VK_AMD_extension_35" number="35" author="AMD" contact="Daniel Rakos @drakos-amd" supported="disabled">
<require>
- <enum value="0" name="VK_AMD_EXTENSION_35_SPEC_VERSION"/>
- <enum value="&quot;VK_AMD_extension_35&quot;" name="VK_AMD_EXTENSION_35_EXTENSION_NAME"/>
+ <enum value="0" name="VK_AMD_EXTENSION_35_SPEC_VERSION"/>
+ <enum value="&quot;VK_AMD_extension_35&quot;" name="VK_AMD_EXTENSION_35_EXTENSION_NAME"/>
</require>
</extension>
- <extension name="VK_AMD_negative_viewport_height" number="36" type="device" author="AMD" contact="Matthaeus G. Chajdas @anteru" supported="vulkan">
+ <extension name="VK_AMD_negative_viewport_height" number="36" type="device" author="AMD" contact="Matthaeus G. Chajdas @anteru" supported="vulkan" obsoletedby="VK_KHR_maintenance1">
<require>
- <enum value="1" name="VK_AMD_NEGATIVE_VIEWPORT_HEIGHT_SPEC_VERSION"/>
- <enum value="&quot;VK_AMD_negative_viewport_height&quot;" name="VK_AMD_NEGATIVE_VIEWPORT_HEIGHT_EXTENSION_NAME"/>
+ <enum value="1" name="VK_AMD_NEGATIVE_VIEWPORT_HEIGHT_SPEC_VERSION"/>
+ <enum value="&quot;VK_AMD_negative_viewport_height&quot;" name="VK_AMD_NEGATIVE_VIEWPORT_HEIGHT_EXTENSION_NAME"/>
</require>
</extension>
- <extension name="VK_AMD_gpu_shader_half_float" number="37" type="device" author="AMD" contact="Dominik Witczak @dominikwitczak_amd" supported="vulkan">
+ <extension name="VK_AMD_gpu_shader_half_float" number="37" type="device" author="AMD" contact="Dominik Witczak @dominikwitczakamd" supported="vulkan" deprecatedby="VK_KHR_shader_float16_int8">
<require>
- <enum value="1" name="VK_AMD_GPU_SHADER_HALF_FLOAT_SPEC_VERSION"/>
- <enum value="&quot;VK_AMD_gpu_shader_half_float&quot;" name="VK_AMD_GPU_SHADER_HALF_FLOAT_EXTENSION_NAME"/>
+ <enum value="2" name="VK_AMD_GPU_SHADER_HALF_FLOAT_SPEC_VERSION"/>
+ <enum value="&quot;VK_AMD_gpu_shader_half_float&quot;" name="VK_AMD_GPU_SHADER_HALF_FLOAT_EXTENSION_NAME"/>
</require>
</extension>
- <extension name="VK_AMD_shader_ballot" number="38" type="device" author="AMD" contact="Dominik Witczak @dominikwitczak_amd" supported="vulkan">
+ <extension name="VK_AMD_shader_ballot" number="38" type="device" author="AMD" contact="Dominik Witczak @dominikwitczakamd" supported="vulkan">
<require>
- <enum value="1" name="VK_AMD_SHADER_BALLOT_SPEC_VERSION"/>
- <enum value="&quot;VK_AMD_shader_ballot&quot;" name="VK_AMD_SHADER_BALLOT_EXTENSION_NAME"/>
+ <enum value="1" name="VK_AMD_SHADER_BALLOT_SPEC_VERSION"/>
+ <enum value="&quot;VK_AMD_shader_ballot&quot;" name="VK_AMD_SHADER_BALLOT_EXTENSION_NAME"/>
</require>
</extension>
- <extension name="VK_AMD_extension_39" number="39" author="AMD" contact="Daniel Rakos @aqnuep" supported="disabled">
+ <extension name="VK_EXT_video_encode_h264" number="39" type="device" requires="VK_KHR_video_encode_queue" author="KHR" contact="Ahmed Abdelkhalek @aabdelkh" provisional="true" platform="provisional" supported="vulkan">
<require>
- <enum value="0" name="VK_AMD_EXTENSION_39_SPEC_VERSION"/>
- <enum value="&quot;VK_AMD_extension_39&quot;" name="VK_AMD_EXTENSION_39_EXTENSION_NAME"/>
+ <enum value="7" name="VK_EXT_VIDEO_ENCODE_H264_SPEC_VERSION"/>
+ <enum value="&quot;VK_EXT_video_encode_h264&quot;" name="VK_EXT_VIDEO_ENCODE_H264_EXTENSION_NAME"/>
+ <enum offset="0" extends="VkStructureType" name="VK_STRUCTURE_TYPE_VIDEO_ENCODE_H264_CAPABILITIES_EXT" protect="VK_ENABLE_BETA_EXTENSIONS"/>
+ <enum offset="1" extends="VkStructureType" name="VK_STRUCTURE_TYPE_VIDEO_ENCODE_H264_SESSION_PARAMETERS_CREATE_INFO_EXT" protect="VK_ENABLE_BETA_EXTENSIONS"/>
+ <enum offset="2" extends="VkStructureType" name="VK_STRUCTURE_TYPE_VIDEO_ENCODE_H264_SESSION_PARAMETERS_ADD_INFO_EXT" protect="VK_ENABLE_BETA_EXTENSIONS"/>
+ <enum offset="3" extends="VkStructureType" name="VK_STRUCTURE_TYPE_VIDEO_ENCODE_H264_VCL_FRAME_INFO_EXT" protect="VK_ENABLE_BETA_EXTENSIONS"/>
+ <enum offset="4" extends="VkStructureType" name="VK_STRUCTURE_TYPE_VIDEO_ENCODE_H264_DPB_SLOT_INFO_EXT" protect="VK_ENABLE_BETA_EXTENSIONS"/>
+ <enum offset="5" extends="VkStructureType" name="VK_STRUCTURE_TYPE_VIDEO_ENCODE_H264_NALU_SLICE_EXT" protect="VK_ENABLE_BETA_EXTENSIONS"/>
+ <enum offset="6" extends="VkStructureType" name="VK_STRUCTURE_TYPE_VIDEO_ENCODE_H264_EMIT_PICTURE_PARAMETERS_EXT" protect="VK_ENABLE_BETA_EXTENSIONS"/>
+ <enum offset="7" extends="VkStructureType" name="VK_STRUCTURE_TYPE_VIDEO_ENCODE_H264_PROFILE_EXT" protect="VK_ENABLE_BETA_EXTENSIONS"/>
+ <enum offset="8" extends="VkStructureType" name="VK_STRUCTURE_TYPE_VIDEO_ENCODE_H264_RATE_CONTROL_INFO_EXT" protect="VK_ENABLE_BETA_EXTENSIONS"/>
+ <enum offset="9" extends="VkStructureType" name="VK_STRUCTURE_TYPE_VIDEO_ENCODE_H264_RATE_CONTROL_LAYER_INFO_EXT" protect="VK_ENABLE_BETA_EXTENSIONS"/>
+ <enum offset="10" extends="VkStructureType" name="VK_STRUCTURE_TYPE_VIDEO_ENCODE_H264_REFERENCE_LISTS_EXT" protect="VK_ENABLE_BETA_EXTENSIONS"/>
+ <enum bitpos="16" extends="VkVideoCodecOperationFlagBitsKHR" name="VK_VIDEO_CODEC_OPERATION_ENCODE_H264_BIT_EXT" protect="VK_ENABLE_BETA_EXTENSIONS"/>
+
+ <type name="VkVideoEncodeH264CapabilityFlagBitsEXT"/>
+ <type name="VkVideoEncodeH264CapabilityFlagsEXT"/>
+ <type name="VkVideoEncodeH264InputModeFlagBitsEXT"/>
+ <type name="VkVideoEncodeH264InputModeFlagsEXT"/>
+ <type name="VkVideoEncodeH264OutputModeFlagBitsEXT"/>
+ <type name="VkVideoEncodeH264OutputModeFlagsEXT"/>
+ <type name="VkVideoEncodeH264CapabilitiesEXT"/>
+ <type name="VkVideoEncodeH264SessionParametersCreateInfoEXT"/>
+ <type name="VkVideoEncodeH264SessionParametersAddInfoEXT"/>
+ <type name="VkVideoEncodeH264VclFrameInfoEXT"/>
+ <type name="VkVideoEncodeH264ReferenceListsEXT"/>
+ <type name="VkVideoEncodeH264EmitPictureParametersEXT"/>
+ <type name="VkVideoEncodeH264DpbSlotInfoEXT"/>
+ <type name="VkVideoEncodeH264NaluSliceEXT"/>
+ <type name="VkVideoEncodeH264ProfileEXT"/>
+ <type name="VkVideoEncodeH264RateControlInfoEXT"/>
+ <type name="VkVideoEncodeH264RateControlStructureFlagBitsEXT"/>
+ <type name="VkVideoEncodeH264RateControlStructureFlagsEXT"/>
+ <type name="VkVideoEncodeH264RateControlLayerInfoEXT"/>
+ <type name="VkVideoEncodeH264QpEXT"/>
+ <type name="VkVideoEncodeH264FrameSizeEXT"/>
</require>
</extension>
- <extension name="VK_AMD_extension_40" number="40" author="AMD" contact="Daniel Rakos @aqnuep" supported="disabled">
+ <extension name="VK_EXT_video_encode_h265" number="40" type="device" requires="VK_KHR_video_encode_queue" author="KHR" contact="Ahmed Abdelkhalek @aabdelkh" provisional="true" platform="provisional" supported="vulkan">
<require>
- <enum value="0" name="VK_AMD_EXTENSION_40_SPEC_VERSION"/>
- <enum value="&quot;VK_AMD_extension_40&quot;" name="VK_AMD_EXTENSION_40_EXTENSION_NAME"/>
+ <enum value="7" name="VK_EXT_VIDEO_ENCODE_H265_SPEC_VERSION"/>
+ <enum value="&quot;VK_EXT_video_encode_h265&quot;" name="VK_EXT_VIDEO_ENCODE_H265_EXTENSION_NAME"/>
+ <enum offset="0" extends="VkStructureType" name="VK_STRUCTURE_TYPE_VIDEO_ENCODE_H265_CAPABILITIES_EXT" protect="VK_ENABLE_BETA_EXTENSIONS"/>
+ <enum offset="1" extends="VkStructureType" name="VK_STRUCTURE_TYPE_VIDEO_ENCODE_H265_SESSION_PARAMETERS_CREATE_INFO_EXT" protect="VK_ENABLE_BETA_EXTENSIONS"/>
+ <enum offset="2" extends="VkStructureType" name="VK_STRUCTURE_TYPE_VIDEO_ENCODE_H265_SESSION_PARAMETERS_ADD_INFO_EXT" protect="VK_ENABLE_BETA_EXTENSIONS"/>
+ <enum offset="3" extends="VkStructureType" name="VK_STRUCTURE_TYPE_VIDEO_ENCODE_H265_VCL_FRAME_INFO_EXT" protect="VK_ENABLE_BETA_EXTENSIONS"/>
+ <enum offset="4" extends="VkStructureType" name="VK_STRUCTURE_TYPE_VIDEO_ENCODE_H265_DPB_SLOT_INFO_EXT" protect="VK_ENABLE_BETA_EXTENSIONS"/>
+ <enum offset="5" extends="VkStructureType" name="VK_STRUCTURE_TYPE_VIDEO_ENCODE_H265_NALU_SLICE_SEGMENT_EXT" protect="VK_ENABLE_BETA_EXTENSIONS"/>
+ <enum offset="6" extends="VkStructureType" name="VK_STRUCTURE_TYPE_VIDEO_ENCODE_H265_EMIT_PICTURE_PARAMETERS_EXT" protect="VK_ENABLE_BETA_EXTENSIONS"/>
+ <enum offset="7" extends="VkStructureType" name="VK_STRUCTURE_TYPE_VIDEO_ENCODE_H265_PROFILE_EXT" protect="VK_ENABLE_BETA_EXTENSIONS"/>
+ <enum offset="8" extends="VkStructureType" name="VK_STRUCTURE_TYPE_VIDEO_ENCODE_H265_REFERENCE_LISTS_EXT" protect="VK_ENABLE_BETA_EXTENSIONS"/>
+ <enum offset="9" extends="VkStructureType" name="VK_STRUCTURE_TYPE_VIDEO_ENCODE_H265_RATE_CONTROL_INFO_EXT" protect="VK_ENABLE_BETA_EXTENSIONS"/>
+ <enum offset="10" extends="VkStructureType" name="VK_STRUCTURE_TYPE_VIDEO_ENCODE_H265_RATE_CONTROL_LAYER_INFO_EXT" protect="VK_ENABLE_BETA_EXTENSIONS"/>
+ <enum bitpos="17" extends="VkVideoCodecOperationFlagBitsKHR" name="VK_VIDEO_CODEC_OPERATION_ENCODE_H265_BIT_EXT" protect="VK_ENABLE_BETA_EXTENSIONS"/>
+
+ <type name="VkVideoEncodeH265CapabilityFlagBitsEXT"/>
+ <type name="VkVideoEncodeH265CapabilityFlagsEXT"/>
+ <type name="VkVideoEncodeH265InputModeFlagBitsEXT"/>
+ <type name="VkVideoEncodeH265InputModeFlagsEXT"/>
+ <type name="VkVideoEncodeH265OutputModeFlagBitsEXT"/>
+ <type name="VkVideoEncodeH265OutputModeFlagsEXT"/>
+
+ <type name="VkVideoEncodeH265CtbSizeFlagBitsEXT"/>
+ <type name="VkVideoEncodeH265CtbSizeFlagsEXT"/>
+ <type name="VkVideoEncodeH265TransformBlockSizeFlagBitsEXT"/>
+ <type name="VkVideoEncodeH265TransformBlockSizeFlagsEXT"/>
+ <type name="VkVideoEncodeH265CapabilitiesEXT"/>
+ <type name="VkVideoEncodeH265SessionParametersCreateInfoEXT"/>
+ <type name="VkVideoEncodeH265SessionParametersAddInfoEXT"/>
+ <type name="VkVideoEncodeH265VclFrameInfoEXT"/>
+ <type name="VkVideoEncodeH265EmitPictureParametersEXT"/>
+ <type name="VkVideoEncodeH265DpbSlotInfoEXT"/>
+ <type name="VkVideoEncodeH265NaluSliceSegmentEXT"/>
+ <type name="VkVideoEncodeH265ProfileEXT"/>
+ <type name="VkVideoEncodeH265ReferenceListsEXT"/>
+ <type name="VkVideoEncodeH265RateControlInfoEXT"/>
+ <type name="VkVideoEncodeH265RateControlStructureFlagBitsEXT"/>
+ <type name="VkVideoEncodeH265RateControlStructureFlagsEXT"/>
+ <type name="VkVideoEncodeH265RateControlLayerInfoEXT"/>
+ <type name="VkVideoEncodeH265QpEXT"/>
+ <type name="VkVideoEncodeH265FrameSizeEXT"/>
</require>
</extension>
- <extension name="VK_AMD_extension_41" number="41" author="AMD" contact="Daniel Rakos @aqnuep" supported="disabled">
+ <extension name="VK_EXT_video_decode_h264" number="41" type="device" requires="VK_KHR_video_decode_queue" author="KHR" contact="peter.fang@amd.com" provisional="true" platform="provisional" supported="vulkan">
<require>
- <enum value="0" name="VK_AMD_EXTENSION_41_SPEC_VERSION"/>
- <enum value="&quot;VK_AMD_extension_41&quot;" name="VK_AMD_EXTENSION_41_EXTENSION_NAME"/>
+ <enum value="5" name="VK_EXT_VIDEO_DECODE_H264_SPEC_VERSION"/>
+ <enum value="&quot;VK_EXT_video_decode_h264&quot;" name="VK_EXT_VIDEO_DECODE_H264_EXTENSION_NAME"/>
+ <enum offset="0" extends="VkStructureType" name="VK_STRUCTURE_TYPE_VIDEO_DECODE_H264_CAPABILITIES_EXT" protect="VK_ENABLE_BETA_EXTENSIONS"/>
+ <enum offset="1" extends="VkStructureType" name="VK_STRUCTURE_TYPE_VIDEO_DECODE_H264_PICTURE_INFO_EXT" protect="VK_ENABLE_BETA_EXTENSIONS"/>
+ <enum offset="2" extends="VkStructureType" name="VK_STRUCTURE_TYPE_VIDEO_DECODE_H264_MVC_EXT" protect="VK_ENABLE_BETA_EXTENSIONS"/>
+ <enum offset="3" extends="VkStructureType" name="VK_STRUCTURE_TYPE_VIDEO_DECODE_H264_PROFILE_EXT" protect="VK_ENABLE_BETA_EXTENSIONS"/>
+ <enum offset="4" extends="VkStructureType" name="VK_STRUCTURE_TYPE_VIDEO_DECODE_H264_SESSION_PARAMETERS_CREATE_INFO_EXT" protect="VK_ENABLE_BETA_EXTENSIONS"/>
+ <enum offset="5" extends="VkStructureType" name="VK_STRUCTURE_TYPE_VIDEO_DECODE_H264_SESSION_PARAMETERS_ADD_INFO_EXT" protect="VK_ENABLE_BETA_EXTENSIONS"/>
+ <enum offset="6" extends="VkStructureType" name="VK_STRUCTURE_TYPE_VIDEO_DECODE_H264_DPB_SLOT_INFO_EXT" protect="VK_ENABLE_BETA_EXTENSIONS"/>
+ <enum bitpos="0" extends="VkVideoCodecOperationFlagBitsKHR" name="VK_VIDEO_CODEC_OPERATION_DECODE_H264_BIT_EXT" protect="VK_ENABLE_BETA_EXTENSIONS"/>
+ <type name="VkVideoDecodeH264PictureLayoutFlagBitsEXT"/>
+ <type name="VkVideoDecodeH264PictureLayoutFlagsEXT"/>
+ <type name="VkVideoDecodeH264ProfileEXT"/>
+ <type name="VkVideoDecodeH264CapabilitiesEXT"/>
+ <type name="VkVideoDecodeH264SessionParametersCreateInfoEXT"/>
+ <type name="VkVideoDecodeH264SessionParametersAddInfoEXT"/>
+ <type name="VkVideoDecodeH264PictureInfoEXT"/>
+ <type name="VkVideoDecodeH264MvcEXT"/>
+ <type name="VkVideoDecodeH264DpbSlotInfoEXT"/>
</require>
</extension>
- <extension name="VK_AMD_extension_42" number="42" author="AMD" contact="Daniel Rakos @aqnuep" supported="disabled">
+ <extension name="VK_AMD_texture_gather_bias_lod" number="42" author="AMD" contact="Rex Xu @amdrexu" supported="vulkan" type="device" requires="VK_KHR_get_physical_device_properties2">
<require>
- <enum value="0" name="VK_AMD_EXTENSION_42_SPEC_VERSION"/>
- <enum value="&quot;VK_AMD_extension_42&quot;" name="VK_AMD_EXTENSION_42_EXTENSION_NAME"/>
+ <enum value="1" name="VK_AMD_TEXTURE_GATHER_BIAS_LOD_SPEC_VERSION"/>
+ <enum value="&quot;VK_AMD_texture_gather_bias_lod&quot;" name="VK_AMD_TEXTURE_GATHER_BIAS_LOD_EXTENSION_NAME"/>
+ <enum offset="0" extends="VkStructureType" name="VK_STRUCTURE_TYPE_TEXTURE_LOD_GATHER_FORMAT_PROPERTIES_AMD"/>
+ <type name="VkTextureLODGatherFormatPropertiesAMD"/>
</require>
</extension>
- <extension name="VK_AMD_extension_43" number="43" author="AMD" contact="Daniel Rakos @aqnuep" supported="disabled">
+ <extension name="VK_AMD_shader_info" number="43" author="AMD" contact="Jaakko Konttinen @jaakkoamd" supported="vulkan" specialuse="devtools" type="device">
<require>
- <enum value="0" name="VK_AMD_EXTENSION_43_SPEC_VERSION"/>
- <enum value="&quot;VK_AMD_extension_43&quot;" name="VK_AMD_EXTENSION_43_EXTENSION_NAME"/>
+ <enum value="1" name="VK_AMD_SHADER_INFO_SPEC_VERSION"/>
+ <enum value="&quot;VK_AMD_shader_info&quot;" name="VK_AMD_SHADER_INFO_EXTENSION_NAME"/>
+ <type name="VkShaderInfoTypeAMD"/>
+ <type name="VkShaderResourceUsageAMD"/>
+ <type name="VkShaderStatisticsInfoAMD"/>
+ <command name="vkGetShaderInfoAMD"/>
</require>
</extension>
- <extension name="VK_AMD_extension_44" number="44" author="AMD" contact="Daniel Rakos @aqnuep" supported="disabled">
+ <extension name="VK_AMD_extension_44" number="44" author="AMD" contact="Daniel Rakos @drakos-amd" supported="disabled">
<require>
- <enum value="0" name="VK_AMD_EXTENSION_44_SPEC_VERSION"/>
- <enum value="&quot;VK_AMD_extension_44&quot;" name="VK_AMD_EXTENSION_44_EXTENSION_NAME"/>
+ <enum value="0" name="VK_AMD_EXTENSION_44_SPEC_VERSION"/>
+ <enum value="&quot;VK_AMD_extension_44&quot;" name="VK_AMD_EXTENSION_44_EXTENSION_NAME"/>
</require>
</extension>
- <extension name="VK_AMD_extension_45" number="45" author="AMD" contact="Daniel Rakos @aqnuep" supported="disabled">
+ <extension name="VK_KHR_dynamic_rendering" number="45" author="KHR" type="device" requires="VK_KHR_depth_stencil_resolve,VK_KHR_get_physical_device_properties2" contact="Tobias Hector @tobski" supported="vulkan" promotedto="VK_VERSION_1_3">
<require>
- <enum value="0" name="VK_AMD_EXTENSION_45_SPEC_VERSION"/>
- <enum value="&quot;VK_AMD_extension_45&quot;" name="VK_AMD_EXTENSION_45_EXTENSION_NAME"/>
+ <enum value="1" name="VK_KHR_DYNAMIC_RENDERING_SPEC_VERSION"/>
+ <enum value="&quot;VK_KHR_dynamic_rendering&quot;" name="VK_KHR_DYNAMIC_RENDERING_EXTENSION_NAME"/>
+ <command name="vkCmdBeginRenderingKHR"/>
+ <command name="vkCmdEndRenderingKHR"/>
+ <enum extends="VkStructureType" name="VK_STRUCTURE_TYPE_RENDERING_INFO_KHR" alias="VK_STRUCTURE_TYPE_RENDERING_INFO"/>
+ <enum extends="VkStructureType" name="VK_STRUCTURE_TYPE_RENDERING_ATTACHMENT_INFO_KHR" alias="VK_STRUCTURE_TYPE_RENDERING_ATTACHMENT_INFO"/>
+ <enum extends="VkStructureType" name="VK_STRUCTURE_TYPE_PIPELINE_RENDERING_CREATE_INFO_KHR" alias="VK_STRUCTURE_TYPE_PIPELINE_RENDERING_CREATE_INFO"/>
+ <enum extends="VkStructureType" name="VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_DYNAMIC_RENDERING_FEATURES_KHR" alias="VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_DYNAMIC_RENDERING_FEATURES"/>
+ <enum extends="VkStructureType" name="VK_STRUCTURE_TYPE_COMMAND_BUFFER_INHERITANCE_RENDERING_INFO_KHR" alias="VK_STRUCTURE_TYPE_COMMAND_BUFFER_INHERITANCE_RENDERING_INFO"/>
+ <enum extends="VkAttachmentStoreOp" name="VK_ATTACHMENT_STORE_OP_NONE_KHR" alias="VK_ATTACHMENT_STORE_OP_NONE"/>
+ <type name="VkRenderingInfoKHR"/>
+ <type name="VkRenderingAttachmentInfoKHR"/>
+ <type name="VkPipelineRenderingCreateInfoKHR"/>
+ <type name="VkPhysicalDeviceDynamicRenderingFeaturesKHR"/>
+ <type name="VkCommandBufferInheritanceRenderingInfoKHR"/>
+ <type name="VkRenderingFlagsKHR"/>
+ <type name="VkRenderingFlagBitsKHR"/>
+ </require>
+ <require extension="VK_KHR_fragment_shading_rate">
+ <enum bitpos="21" extends="VkPipelineCreateFlagBits" name="VK_PIPELINE_CREATE_RENDERING_FRAGMENT_SHADING_RATE_ATTACHMENT_BIT_KHR"/>
+ <enum alias="VK_PIPELINE_CREATE_RENDERING_FRAGMENT_SHADING_RATE_ATTACHMENT_BIT_KHR" extends="VkPipelineCreateFlagBits" name="VK_PIPELINE_RASTERIZATION_STATE_CREATE_FRAGMENT_SHADING_RATE_ATTACHMENT_BIT_KHR" comment="Backwards-compatible alias containing a typo"/>
+ <enum offset="6" extends="VkStructureType" extnumber="45" name="VK_STRUCTURE_TYPE_RENDERING_FRAGMENT_SHADING_RATE_ATTACHMENT_INFO_KHR"/>
+ <type name="VkRenderingFragmentShadingRateAttachmentInfoKHR"/>
+ </require>
+ <require extension="VK_EXT_fragment_density_map">
+ <enum bitpos="22" extends="VkPipelineCreateFlagBits" name="VK_PIPELINE_CREATE_RENDERING_FRAGMENT_DENSITY_MAP_ATTACHMENT_BIT_EXT"/>
+ <enum alias="VK_PIPELINE_CREATE_RENDERING_FRAGMENT_DENSITY_MAP_ATTACHMENT_BIT_EXT" extends="VkPipelineCreateFlagBits" name="VK_PIPELINE_RASTERIZATION_STATE_CREATE_FRAGMENT_DENSITY_MAP_ATTACHMENT_BIT_EXT" comment="Backwards-compatible alias containing a typo"/>
+ <enum offset="7" extends="VkStructureType" extnumber="45" name="VK_STRUCTURE_TYPE_RENDERING_FRAGMENT_DENSITY_MAP_ATTACHMENT_INFO_EXT"/>
+ <type name="VkRenderingFragmentDensityMapAttachmentInfoEXT"/>
+ </require>
+ <require extension="VK_AMD_mixed_attachment_samples">
+ <enum offset="8" extends="VkStructureType" extnumber="45" name="VK_STRUCTURE_TYPE_ATTACHMENT_SAMPLE_COUNT_INFO_AMD"/>
+ <type name="VkAttachmentSampleCountInfoAMD"/>
+ </require>
+ <require extension="VK_NV_framebuffer_mixed_samples">
+ <enum extends="VkStructureType" name="VK_STRUCTURE_TYPE_ATTACHMENT_SAMPLE_COUNT_INFO_NV" alias="VK_STRUCTURE_TYPE_ATTACHMENT_SAMPLE_COUNT_INFO_AMD"/>
+ <type name="VkAttachmentSampleCountInfoNV"/>
+ </require>
+ <require extension="VK_NVX_multiview_per_view_attributes">
+ <enum offset="9" extends="VkStructureType" extnumber="45" name="VK_STRUCTURE_TYPE_MULTIVIEW_PER_VIEW_ATTRIBUTES_INFO_NVX"/>
+ <type name="VkMultiviewPerViewAttributesInfoNVX"/>
</require>
</extension>
- <extension name="VK_AMD_extension_46" number="46" author="AMD" contact="Daniel Rakos @aqnuep" supported="disabled">
+ <extension name="VK_AMD_extension_46" number="46" author="AMD" contact="Daniel Rakos @drakos-amd" supported="disabled">
<require>
- <enum value="0" name="VK_AMD_EXTENSION_46_SPEC_VERSION"/>
- <enum value="&quot;VK_AMD_extension_46&quot;" name="VK_AMD_EXTENSION_46_EXTENSION_NAME"/>
+ <enum value="0" name="VK_AMD_EXTENSION_46_SPEC_VERSION"/>
+ <enum value="&quot;VK_AMD_extension_46&quot;" name="VK_AMD_EXTENSION_46_EXTENSION_NAME"/>
</require>
</extension>
- <extension name="VK_AMD_extension_47" number="47" author="AMD" contact="Daniel Rakos @aqnuep" supported="disabled">
+ <extension name="VK_AMD_shader_image_load_store_lod" number="47" author="AMD" contact="Dominik Witczak @dominikwitczakamd" supported="vulkan" type="device">
<require>
- <enum value="0" name="VK_AMD_EXTENSION_47_SPEC_VERSION"/>
- <enum value="&quot;VK_AMD_extension_47&quot;" name="VK_AMD_EXTENSION_47_EXTENSION_NAME"/>
+ <enum value="1" name="VK_AMD_SHADER_IMAGE_LOAD_STORE_LOD_SPEC_VERSION"/>
+ <enum value="&quot;VK_AMD_shader_image_load_store_lod&quot;" name="VK_AMD_SHADER_IMAGE_LOAD_STORE_LOD_EXTENSION_NAME"/>
</require>
</extension>
- <extension name="VK_NVX_extension_48" number="48" author="NVIDIA" contact="James Jones @cubanismo" supported="disabled">
+ <extension name="VK_NVX_extension_48" number="48" author="NVX" contact="James Jones @cubanismo" supported="disabled">
<require>
- <enum value="0" name="VK_NVX_EXTENSION_48_SPEC_VERSION"/>
- <enum value="&quot;VK_NVX_extension_48&quot;" name="VK_NVX_EXTENSION_48_EXTENSION_NAME"/>
+ <enum value="0" name="VK_NVX_EXTENSION_48_SPEC_VERSION"/>
+ <enum value="&quot;VK_NVX_extension_48&quot;" name="VK_NVX_EXTENSION_48_EXTENSION_NAME"/>
</require>
</extension>
<extension name="VK_GOOGLE_extension_49" number="49" author="GOOGLE" contact="Jean-Francois Roy @jfroy" supported="disabled">
<require>
- <enum value="0" name="VK_GOOGLE_EXTENSION_49_SPEC_VERSION"/>
- <enum value="&quot;VK_GOOGLE_extension_49&quot;" name="VK_GOOGLE_EXTENSION_49_EXTENSION_NAME"/>
+ <enum value="0" name="VK_GOOGLE_EXTENSION_49_SPEC_VERSION"/>
+ <enum value="&quot;VK_GOOGLE_extension_49&quot;" name="VK_GOOGLE_EXTENSION_49_EXTENSION_NAME"/>
</require>
</extension>
- <extension name="VK_GOOGLE_extension_50" number="50" author="GOOGLE" contact="Jean-Francois Roy @jfroy" supported="disabled">
+ <extension name="VK_GGP_stream_descriptor_surface" number="50" type="instance" requires="VK_KHR_surface" platform="ggp" author="GGP" contact="Jean-Francois Roy @jfroy" supported="vulkan">
<require>
- <enum value="0" name="VK_GOOGLE_EXTENSION_50_SPEC_VERSION"/>
- <enum value="&quot;VK_GOOGLE_extension_50&quot;" name="VK_GOOGLE_EXTENSION_50_EXTENSION_NAME"/>
+ <enum value="1" name="VK_GGP_STREAM_DESCRIPTOR_SURFACE_SPEC_VERSION"/>
+ <enum value="&quot;VK_GGP_stream_descriptor_surface&quot;" name="VK_GGP_STREAM_DESCRIPTOR_SURFACE_EXTENSION_NAME"/>
+ <enum offset="0" extends="VkStructureType" name="VK_STRUCTURE_TYPE_STREAM_DESCRIPTOR_SURFACE_CREATE_INFO_GGP"/>
+ <type name="VkStreamDescriptorSurfaceCreateFlagsGGP"/>
+ <type name="VkStreamDescriptorSurfaceCreateInfoGGP"/>
+ <command name="vkCreateStreamDescriptorSurfaceGGP"/>
</require>
</extension>
- <extension name="VK_NVX_extension_51" number="51" author="NVIDIA" contact="James Jones @cubanismo" supported="disabled">
+ <extension name="VK_NV_corner_sampled_image" number="51" author="NV" type="device" requires="VK_KHR_get_physical_device_properties2" contact="Daniel Koch @dgkoch" supported="vulkan">
<require>
- <enum value="0" name="VK_NVX_EXTENSION_51_SPEC_VERSION"/>
- <enum value="&quot;VK_NVX_extension_51&quot;" name="VK_NVX_EXTENSION_51_EXTENSION_NAME"/>
+ <enum value="2" name="VK_NV_CORNER_SAMPLED_IMAGE_SPEC_VERSION"/>
+ <enum value="&quot;VK_NV_corner_sampled_image&quot;" name="VK_NV_CORNER_SAMPLED_IMAGE_EXTENSION_NAME"/>
+ <enum bitpos="13" extends="VkImageCreateFlagBits" name="VK_IMAGE_CREATE_CORNER_SAMPLED_BIT_NV"/>
+ <enum offset="0" extends="VkStructureType" name="VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_CORNER_SAMPLED_IMAGE_FEATURES_NV"/>
+ <type name="VkPhysicalDeviceCornerSampledImageFeaturesNV"/>
</require>
</extension>
- <extension name="VK_NVX_extension_52" number="52" author="NVIDIA" contact="James Jones @cubanismo" supported="disabled">
+ <extension name="VK_NV_extension_52" number="52" author="NV" contact="Daniel Koch @dgkoch" supported="disabled">
<require>
- <enum value="0" name="VK_NVX_EXTENSION_52_SPEC_VERSION"/>
- <enum value="&quot;VK_NVX_extension_52&quot;" name="VK_NVX_EXTENSION_52_EXTENSION_NAME"/>
+ <enum value="0" name="VK_NV_EXTENSION_52_SPEC_VERSION"/>
+ <enum value="&quot;VK_NV_extension_52&quot;" name="VK_NV_EXTENSION_52_EXTENSION_NAME"/>
+ <enum bitpos="0" extends="VkShaderModuleCreateFlagBits" name="VK_SHADER_MODULE_CREATE_RESERVED_0_BIT_NV"/>
+ <enum bitpos="2" extends="VkPipelineShaderStageCreateFlagBits" name="VK_PIPELINE_SHADER_STAGE_CREATE_RESERVED_2_BIT_NV"/>
</require>
</extension>
- <extension name="VK_NV_extension_53" number="53" author="NVIDIA" contact="Jeff Bolz @jbolz" supported="disabled">
+ <extension name="VK_NV_extension_53" number="53" author="NV" contact="Jeff Bolz @jeffbolznv" supported="disabled">
<require>
- <enum value="0" name="VK_NV_EXTENSION_53_SPEC_VERSION"/>
- <enum value="&quot;VK_NV_extension_53&quot;" name="VK_NV_EXTENSION_53_EXTENSION_NAME"/>
+ <enum value="0" name="VK_NV_EXTENSION_53_SPEC_VERSION"/>
+ <enum value="&quot;VK_NV_extension_53&quot;" name="VK_NV_EXTENSION_53_EXTENSION_NAME"/>
</require>
</extension>
- <extension name="VK_NV_extension_54" number="54" author="NVIDIA" contact="Jeff Bolz @jbolz" supported="disabled">
+ <extension name="VK_KHR_multiview" number="54" type="device" author="KHR" requires="VK_KHR_get_physical_device_properties2" contact="Jeff Bolz @jeffbolznv" supported="vulkan" promotedto="VK_VERSION_1_1">
<require>
- <enum value="0" name="VK_NV_EXTENSION_54_SPEC_VERSION"/>
- <enum value="&quot;VK_NV_extension_54&quot;" name="VK_NV_EXTENSION_54_EXTENSION_NAME"/>
+ <enum value="1" name="VK_KHR_MULTIVIEW_SPEC_VERSION"/>
+ <enum value="&quot;VK_KHR_multiview&quot;" name="VK_KHR_MULTIVIEW_EXTENSION_NAME"/>
+ <enum extends="VkStructureType" name="VK_STRUCTURE_TYPE_RENDER_PASS_MULTIVIEW_CREATE_INFO_KHR" alias="VK_STRUCTURE_TYPE_RENDER_PASS_MULTIVIEW_CREATE_INFO"/>
+ <enum extends="VkStructureType" name="VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_MULTIVIEW_FEATURES_KHR" alias="VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_MULTIVIEW_FEATURES"/>
+ <enum extends="VkStructureType" name="VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_MULTIVIEW_PROPERTIES_KHR" alias="VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_MULTIVIEW_PROPERTIES"/>
+ <enum extends="VkDependencyFlagBits" name="VK_DEPENDENCY_VIEW_LOCAL_BIT_KHR" alias="VK_DEPENDENCY_VIEW_LOCAL_BIT"/>
+ <type name="VkRenderPassMultiviewCreateInfoKHR"/>
+ <type name="VkPhysicalDeviceMultiviewFeaturesKHR"/>
+ <type name="VkPhysicalDeviceMultiviewPropertiesKHR"/>
</require>
</extension>
- <extension name="VK_IMG_format_pvrtc" number="55" type="device" author="IMG" contact="Tobias Hector @tobias" supported="vulkan">
+ <extension name="VK_IMG_format_pvrtc" number="55" type="device" author="IMG" contact="Stuart Smith" supported="vulkan">
<require>
- <enum value="1" name="VK_IMG_FORMAT_PVRTC_SPEC_VERSION"/>
- <enum value="&quot;VK_IMG_format_pvrtc&quot;" name="VK_IMG_FORMAT_PVRTC_EXTENSION_NAME"/>
- <enum offset="0" extends="VkFormat" name="VK_FORMAT_PVRTC1_2BPP_UNORM_BLOCK_IMG"/>
- <enum offset="1" extends="VkFormat" name="VK_FORMAT_PVRTC1_4BPP_UNORM_BLOCK_IMG"/>
- <enum offset="2" extends="VkFormat" name="VK_FORMAT_PVRTC2_2BPP_UNORM_BLOCK_IMG"/>
- <enum offset="3" extends="VkFormat" name="VK_FORMAT_PVRTC2_4BPP_UNORM_BLOCK_IMG"/>
- <enum offset="4" extends="VkFormat" name="VK_FORMAT_PVRTC1_2BPP_SRGB_BLOCK_IMG"/>
- <enum offset="5" extends="VkFormat" name="VK_FORMAT_PVRTC1_4BPP_SRGB_BLOCK_IMG"/>
- <enum offset="6" extends="VkFormat" name="VK_FORMAT_PVRTC2_2BPP_SRGB_BLOCK_IMG"/>
- <enum offset="7" extends="VkFormat" name="VK_FORMAT_PVRTC2_4BPP_SRGB_BLOCK_IMG"/>
+ <enum value="1" name="VK_IMG_FORMAT_PVRTC_SPEC_VERSION"/>
+ <enum value="&quot;VK_IMG_format_pvrtc&quot;" name="VK_IMG_FORMAT_PVRTC_EXTENSION_NAME"/>
+ <enum offset="0" extends="VkFormat" name="VK_FORMAT_PVRTC1_2BPP_UNORM_BLOCK_IMG"/>
+ <enum offset="1" extends="VkFormat" name="VK_FORMAT_PVRTC1_4BPP_UNORM_BLOCK_IMG"/>
+ <enum offset="2" extends="VkFormat" name="VK_FORMAT_PVRTC2_2BPP_UNORM_BLOCK_IMG"/>
+ <enum offset="3" extends="VkFormat" name="VK_FORMAT_PVRTC2_4BPP_UNORM_BLOCK_IMG"/>
+ <enum offset="4" extends="VkFormat" name="VK_FORMAT_PVRTC1_2BPP_SRGB_BLOCK_IMG"/>
+ <enum offset="5" extends="VkFormat" name="VK_FORMAT_PVRTC1_4BPP_SRGB_BLOCK_IMG"/>
+ <enum offset="6" extends="VkFormat" name="VK_FORMAT_PVRTC2_2BPP_SRGB_BLOCK_IMG"/>
+ <enum offset="7" extends="VkFormat" name="VK_FORMAT_PVRTC2_4BPP_SRGB_BLOCK_IMG"/>
</require>
</extension>
- <extension name="VK_NV_external_memory_capabilities" number="56" type="instance" author="NVIDIA" contact="James jones @cubanismo" supported="vulkan">
+ <extension name="VK_NV_external_memory_capabilities" number="56" type="instance" author="NV" contact="James Jones @cubanismo" supported="vulkan" deprecatedby="VK_KHR_external_memory_capabilities">
<require>
- <enum value="1" name="VK_NV_EXTERNAL_MEMORY_CAPABILITIES_SPEC_VERSION"/>
- <enum value="&quot;VK_NV_external_memory_capabilities&quot;" name="VK_NV_EXTERNAL_MEMORY_CAPABILITIES_EXTENSION_NAME"/>
+ <enum value="1" name="VK_NV_EXTERNAL_MEMORY_CAPABILITIES_SPEC_VERSION"/>
+ <enum value="&quot;VK_NV_external_memory_capabilities&quot;" name="VK_NV_EXTERNAL_MEMORY_CAPABILITIES_EXTENSION_NAME"/>
<type name="VkExternalMemoryHandleTypeFlagsNV"/>
<type name="VkExternalMemoryHandleTypeFlagBitsNV"/>
<type name="VkExternalMemoryFeatureFlagsNV"/>
@@ -4777,48 +14330,48 @@ maintained in the master branch of the Khronos Vulkan GitHub project.
<command name="vkGetPhysicalDeviceExternalImageFormatPropertiesNV"/>
</require>
</extension>
- <extension name="VK_NV_external_memory" number="57" type="device" requires="VK_NV_external_memory_capabilities" author="NVIDIA" contact="James jones @cubanismo" supported="vulkan">
+ <extension name="VK_NV_external_memory" number="57" type="device" requires="VK_NV_external_memory_capabilities" author="NV" contact="James Jones @cubanismo" supported="vulkan" deprecatedby="VK_KHR_external_memory">
<require>
- <enum value="1" name="VK_NV_EXTERNAL_MEMORY_SPEC_VERSION"/>
- <enum value="&quot;VK_NV_external_memory&quot;" name="VK_NV_EXTERNAL_MEMORY_EXTENSION_NAME"/>
- <enum offset="0" extends="VkStructureType" name="VK_STRUCTURE_TYPE_EXTERNAL_MEMORY_IMAGE_CREATE_INFO_NV"/>
- <enum offset="1" extends="VkStructureType" name="VK_STRUCTURE_TYPE_EXPORT_MEMORY_ALLOCATE_INFO_NV"/>
+ <enum value="1" name="VK_NV_EXTERNAL_MEMORY_SPEC_VERSION"/>
+ <enum value="&quot;VK_NV_external_memory&quot;" name="VK_NV_EXTERNAL_MEMORY_EXTENSION_NAME"/>
+ <enum offset="0" extends="VkStructureType" name="VK_STRUCTURE_TYPE_EXTERNAL_MEMORY_IMAGE_CREATE_INFO_NV"/>
+ <enum offset="1" extends="VkStructureType" name="VK_STRUCTURE_TYPE_EXPORT_MEMORY_ALLOCATE_INFO_NV"/>
<type name="VkExternalMemoryImageCreateInfoNV"/>
<type name="VkExportMemoryAllocateInfoNV"/>
</require>
</extension>
- <extension name="VK_NV_external_memory_win32" number="58" type="device" requires="VK_NV_external_memory_capabilities,VK_NV_external_memory" author="NVIDIA" contact="James jones @cubanismo" protect="VK_USE_PLATFORM_WIN32_KHR" supported="vulkan">
+ <extension name="VK_NV_external_memory_win32" number="58" type="device" requires="VK_NV_external_memory" author="NV" contact="James Jones @cubanismo" platform="win32" supported="vulkan" deprecatedby="VK_KHR_external_memory_win32">
<require>
- <enum value="1" name="VK_NV_EXTERNAL_MEMORY_WIN32_SPEC_VERSION"/>
- <enum value="&quot;VK_NV_external_memory_win32&quot;" name="VK_NV_EXTERNAL_MEMORY_WIN32_EXTENSION_NAME"/>
- <enum offset="0" extends="VkStructureType" name="VK_STRUCTURE_TYPE_IMPORT_MEMORY_WIN32_HANDLE_INFO_NV"/>
- <enum offset="1" extends="VkStructureType" name="VK_STRUCTURE_TYPE_EXPORT_MEMORY_WIN32_HANDLE_INFO_NV"/>
+ <enum value="1" name="VK_NV_EXTERNAL_MEMORY_WIN32_SPEC_VERSION"/>
+ <enum value="&quot;VK_NV_external_memory_win32&quot;" name="VK_NV_EXTERNAL_MEMORY_WIN32_EXTENSION_NAME"/>
+ <enum offset="0" extends="VkStructureType" name="VK_STRUCTURE_TYPE_IMPORT_MEMORY_WIN32_HANDLE_INFO_NV"/>
+ <enum offset="1" extends="VkStructureType" name="VK_STRUCTURE_TYPE_EXPORT_MEMORY_WIN32_HANDLE_INFO_NV"/>
<type name="VkImportMemoryWin32HandleInfoNV"/>
<type name="VkExportMemoryWin32HandleInfoNV"/>
<command name="vkGetMemoryWin32HandleNV"/>
</require>
</extension>
- <extension name="VK_NV_win32_keyed_mutex" number="59" type="device" requires="VK_NV_external_memory_capabilities,VK_NV_external_memory_win32" author="NVIDIA" contact="Carsten Rohde" protect="VK_USE_PLATFORM_WIN32_KHR" supported="vulkan">
+ <extension name="VK_NV_win32_keyed_mutex" number="59" type="device" requires="VK_NV_external_memory_win32" author="NV" contact="Carsten Rohde @crohde" platform="win32" supported="vulkan" promotedto="VK_KHR_win32_keyed_mutex">
<require>
- <enum value="1" name="VK_NV_WIN32_KEYED_MUTEX_SPEC_VERSION"/>
- <enum value="&quot;VK_NV_win32_keyed_mutex&quot;" name="VK_NV_WIN32_KEYED_MUTEX_EXTENSION_NAME"/>
- <enum offset="0" extends="VkStructureType" name="VK_STRUCTURE_TYPE_WIN32_KEYED_MUTEX_ACQUIRE_RELEASE_INFO_NV"/>
+ <enum value="2" name="VK_NV_WIN32_KEYED_MUTEX_SPEC_VERSION"/>
+ <enum value="&quot;VK_NV_win32_keyed_mutex&quot;" name="VK_NV_WIN32_KEYED_MUTEX_EXTENSION_NAME"/>
+ <enum offset="0" extends="VkStructureType" name="VK_STRUCTURE_TYPE_WIN32_KEYED_MUTEX_ACQUIRE_RELEASE_INFO_NV"/>
<type name="VkWin32KeyedMutexAcquireReleaseInfoNV"/>
</require>
</extension>
- <extension name="VK_KHR_get_physical_device_properties2" number="60" author="KHR" contact="Jeff Bolz @jbolz" supported="vulkan">
+ <extension name="VK_KHR_get_physical_device_properties2" number="60" type="instance" author="KHR" contact="Jeff Bolz @jeffbolznv" supported="vulkan" promotedto="VK_VERSION_1_1">
<require>
- <enum value="1" name="VK_KHR_GET_PHYSICAL_DEVICE_PROPERTIES_2_SPEC_VERSION"/>
+ <enum value="2" name="VK_KHR_GET_PHYSICAL_DEVICE_PROPERTIES_2_SPEC_VERSION"/>
<enum value="&quot;VK_KHR_get_physical_device_properties2&quot;" name="VK_KHR_GET_PHYSICAL_DEVICE_PROPERTIES_2_EXTENSION_NAME"/>
- <enum offset="0" extends="VkStructureType" name="VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_FEATURES_2_KHR"/>
- <enum offset="1" extends="VkStructureType" name="VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_PROPERTIES_2_KHR"/>
- <enum offset="2" extends="VkStructureType" name="VK_STRUCTURE_TYPE_FORMAT_PROPERTIES_2_KHR"/>
- <enum offset="3" extends="VkStructureType" name="VK_STRUCTURE_TYPE_IMAGE_FORMAT_PROPERTIES_2_KHR"/>
- <enum offset="4" extends="VkStructureType" name="VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_IMAGE_FORMAT_INFO_2_KHR"/>
- <enum offset="5" extends="VkStructureType" name="VK_STRUCTURE_TYPE_QUEUE_FAMILY_PROPERTIES_2_KHR"/>
- <enum offset="6" extends="VkStructureType" name="VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_MEMORY_PROPERTIES_2_KHR"/>
- <enum offset="7" extends="VkStructureType" name="VK_STRUCTURE_TYPE_SPARSE_IMAGE_FORMAT_PROPERTIES_2_KHR"/>
- <enum offset="8" extends="VkStructureType" name="VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_SPARSE_IMAGE_FORMAT_INFO_2_KHR"/>
+ <enum extends="VkStructureType" name="VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_FEATURES_2_KHR" alias="VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_FEATURES_2"/>
+ <enum extends="VkStructureType" name="VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_PROPERTIES_2_KHR" alias="VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_PROPERTIES_2"/>
+ <enum extends="VkStructureType" name="VK_STRUCTURE_TYPE_FORMAT_PROPERTIES_2_KHR" alias="VK_STRUCTURE_TYPE_FORMAT_PROPERTIES_2"/>
+ <enum extends="VkStructureType" name="VK_STRUCTURE_TYPE_IMAGE_FORMAT_PROPERTIES_2_KHR" alias="VK_STRUCTURE_TYPE_IMAGE_FORMAT_PROPERTIES_2"/>
+ <enum extends="VkStructureType" name="VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_IMAGE_FORMAT_INFO_2_KHR" alias="VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_IMAGE_FORMAT_INFO_2"/>
+ <enum extends="VkStructureType" name="VK_STRUCTURE_TYPE_QUEUE_FAMILY_PROPERTIES_2_KHR" alias="VK_STRUCTURE_TYPE_QUEUE_FAMILY_PROPERTIES_2"/>
+ <enum extends="VkStructureType" name="VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_MEMORY_PROPERTIES_2_KHR" alias="VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_MEMORY_PROPERTIES_2"/>
+ <enum extends="VkStructureType" name="VK_STRUCTURE_TYPE_SPARSE_IMAGE_FORMAT_PROPERTIES_2_KHR" alias="VK_STRUCTURE_TYPE_SPARSE_IMAGE_FORMAT_PROPERTIES_2"/>
+ <enum extends="VkStructureType" name="VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_SPARSE_IMAGE_FORMAT_INFO_2_KHR" alias="VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_SPARSE_IMAGE_FORMAT_INFO_2"/>
<type name="VkPhysicalDeviceFeatures2KHR"/>
<type name="VkPhysicalDeviceProperties2KHR"/>
<type name="VkFormatProperties2KHR"/>
@@ -4837,433 +14390,6932 @@ maintained in the master branch of the Khronos Vulkan GitHub project.
<command name="vkGetPhysicalDeviceSparseImageFormatProperties2KHR"/>
</require>
</extension>
- <extension name="VK_KHR_extension_61" number="61" author="KHR" contact="Jeff Bolz @jbolz" supported="disabled">
+ <extension name="VK_KHR_device_group" number="61" type="device" author="KHR" requires="VK_KHR_device_group_creation" contact="Jeff Bolz @jeffbolznv" supported="vulkan" promotedto="VK_VERSION_1_1">
<require>
- <enum value="0" name="VK_KHR_EXTENSION_61_SPEC_VERSION"/>
- <enum value="&quot;VK_KHR_extension_61&quot;" name="VK_KHR_EXTENSION_61_EXTENSION_NAME"/>
+ <enum value="4" name="VK_KHR_DEVICE_GROUP_SPEC_VERSION"/>
+ <enum value="&quot;VK_KHR_device_group&quot;" name="VK_KHR_DEVICE_GROUP_EXTENSION_NAME"/>
+ <enum extends="VkStructureType" name="VK_STRUCTURE_TYPE_MEMORY_ALLOCATE_FLAGS_INFO_KHR" alias="VK_STRUCTURE_TYPE_MEMORY_ALLOCATE_FLAGS_INFO"/>
+ <enum extends="VkStructureType" name="VK_STRUCTURE_TYPE_DEVICE_GROUP_RENDER_PASS_BEGIN_INFO_KHR" alias="VK_STRUCTURE_TYPE_DEVICE_GROUP_RENDER_PASS_BEGIN_INFO"/>
+ <enum extends="VkStructureType" name="VK_STRUCTURE_TYPE_DEVICE_GROUP_COMMAND_BUFFER_BEGIN_INFO_KHR" alias="VK_STRUCTURE_TYPE_DEVICE_GROUP_COMMAND_BUFFER_BEGIN_INFO"/>
+ <enum extends="VkStructureType" name="VK_STRUCTURE_TYPE_DEVICE_GROUP_SUBMIT_INFO_KHR" alias="VK_STRUCTURE_TYPE_DEVICE_GROUP_SUBMIT_INFO"/>
+ <enum extends="VkStructureType" name="VK_STRUCTURE_TYPE_DEVICE_GROUP_BIND_SPARSE_INFO_KHR" alias="VK_STRUCTURE_TYPE_DEVICE_GROUP_BIND_SPARSE_INFO"/>
+ <type name="VkPeerMemoryFeatureFlagsKHR"/>
+ <type name="VkPeerMemoryFeatureFlagBitsKHR"/>
+ <enum extends="VkPeerMemoryFeatureFlagBits" name="VK_PEER_MEMORY_FEATURE_COPY_SRC_BIT_KHR" alias="VK_PEER_MEMORY_FEATURE_COPY_SRC_BIT"/>
+ <enum extends="VkPeerMemoryFeatureFlagBits" name="VK_PEER_MEMORY_FEATURE_COPY_DST_BIT_KHR" alias="VK_PEER_MEMORY_FEATURE_COPY_DST_BIT"/>
+ <enum extends="VkPeerMemoryFeatureFlagBits" name="VK_PEER_MEMORY_FEATURE_GENERIC_SRC_BIT_KHR" alias="VK_PEER_MEMORY_FEATURE_GENERIC_SRC_BIT"/>
+ <enum extends="VkPeerMemoryFeatureFlagBits" name="VK_PEER_MEMORY_FEATURE_GENERIC_DST_BIT_KHR" alias="VK_PEER_MEMORY_FEATURE_GENERIC_DST_BIT"/>
+ <type name="VkMemoryAllocateFlagsKHR"/>
+ <type name="VkMemoryAllocateFlagBitsKHR"/>
+ <enum extends="VkMemoryAllocateFlagBits" name="VK_MEMORY_ALLOCATE_DEVICE_MASK_BIT_KHR" alias="VK_MEMORY_ALLOCATE_DEVICE_MASK_BIT"/>
+ <type name="VkMemoryAllocateFlagsInfoKHR"/>
+ <type name="VkDeviceGroupRenderPassBeginInfoKHR"/>
+ <type name="VkDeviceGroupCommandBufferBeginInfoKHR"/>
+ <type name="VkDeviceGroupSubmitInfoKHR"/>
+ <type name="VkDeviceGroupBindSparseInfoKHR"/>
+ <command name="vkGetDeviceGroupPeerMemoryFeaturesKHR"/>
+ <command name="vkCmdSetDeviceMaskKHR"/>
+ <command name="vkCmdDispatchBaseKHR"/>
+ <enum extends="VkPipelineCreateFlagBits" name="VK_PIPELINE_CREATE_VIEW_INDEX_FROM_DEVICE_INDEX_BIT_KHR" alias="VK_PIPELINE_CREATE_VIEW_INDEX_FROM_DEVICE_INDEX_BIT"/>
+ <enum extends="VkPipelineCreateFlagBits" name="VK_PIPELINE_CREATE_DISPATCH_BASE_KHR" alias="VK_PIPELINE_CREATE_DISPATCH_BASE"/>
+ <enum extends="VkDependencyFlagBits" name="VK_DEPENDENCY_DEVICE_GROUP_BIT_KHR" alias="VK_DEPENDENCY_DEVICE_GROUP_BIT"/>
+ </require>
+ <require extension="VK_KHR_bind_memory2">
+ <enum extends="VkStructureType" name="VK_STRUCTURE_TYPE_BIND_BUFFER_MEMORY_DEVICE_GROUP_INFO_KHR" alias="VK_STRUCTURE_TYPE_BIND_BUFFER_MEMORY_DEVICE_GROUP_INFO"/>
+ <enum extends="VkStructureType" name="VK_STRUCTURE_TYPE_BIND_IMAGE_MEMORY_DEVICE_GROUP_INFO_KHR" alias="VK_STRUCTURE_TYPE_BIND_IMAGE_MEMORY_DEVICE_GROUP_INFO"/>
+ <type name="VkBindBufferMemoryDeviceGroupInfoKHR"/>
+ <type name="VkBindImageMemoryDeviceGroupInfoKHR"/>
+ <enum extends="VkImageCreateFlagBits" name="VK_IMAGE_CREATE_SPLIT_INSTANCE_BIND_REGIONS_BIT_KHR" alias="VK_IMAGE_CREATE_SPLIT_INSTANCE_BIND_REGIONS_BIT"/>
+ </require>
+ <require extension="VK_KHR_surface">
+ <enum offset="7" extends="VkStructureType" name="VK_STRUCTURE_TYPE_DEVICE_GROUP_PRESENT_CAPABILITIES_KHR"/>
+ <type name="VkDeviceGroupPresentModeFlagBitsKHR"/>
+ <type name="VkDeviceGroupPresentModeFlagsKHR"/>
+ <type name="VkDeviceGroupPresentCapabilitiesKHR"/>
+ <command name="vkGetDeviceGroupPresentCapabilitiesKHR"/>
+ <command name="vkGetDeviceGroupSurfacePresentModesKHR"/>
+ <command name="vkGetPhysicalDevicePresentRectanglesKHR"/>
+ </require>
+ <require extension="VK_KHR_swapchain">
+ <enum offset="8" extends="VkStructureType" name="VK_STRUCTURE_TYPE_IMAGE_SWAPCHAIN_CREATE_INFO_KHR"/>
+ <enum offset="9" extends="VkStructureType" name="VK_STRUCTURE_TYPE_BIND_IMAGE_MEMORY_SWAPCHAIN_INFO_KHR"/>
+ <enum offset="10" extends="VkStructureType" name="VK_STRUCTURE_TYPE_ACQUIRE_NEXT_IMAGE_INFO_KHR"/>
+ <enum offset="11" extends="VkStructureType" name="VK_STRUCTURE_TYPE_DEVICE_GROUP_PRESENT_INFO_KHR"/>
+ <enum offset="12" extends="VkStructureType" name="VK_STRUCTURE_TYPE_DEVICE_GROUP_SWAPCHAIN_CREATE_INFO_KHR"/>
+ <enum bitpos="0" extends="VkSwapchainCreateFlagBitsKHR" name="VK_SWAPCHAIN_CREATE_SPLIT_INSTANCE_BIND_REGIONS_BIT_KHR" comment="Allow images with VK_IMAGE_CREATE_SPLIT_INSTANCE_BIND_REGIONS_BIT"/>
+ <type name="VkImageSwapchainCreateInfoKHR"/>
+ <type name="VkBindImageMemorySwapchainInfoKHR"/>
+ <type name="VkAcquireNextImageInfoKHR"/>
+ <type name="VkDeviceGroupPresentInfoKHR"/>
+ <type name="VkDeviceGroupSwapchainCreateInfoKHR"/>
+ <command name="vkAcquireNextImage2KHR"/>
</require>
</extension>
- <extension name="VK_EXT_validation_flags" number="62" type="instance" author="Google, Inc." contact="Tobin Ehlis @tobine" supported="vulkan">
+ <extension name="VK_EXT_validation_flags" number="62" type="instance" author="GOOGLE" contact="Tobin Ehlis @tobine" specialuse="debugging" supported="vulkan" deprecatedby="VK_EXT_validation_features">
<require>
- <enum value="1" name="VK_EXT_VALIDATION_FLAGS_SPEC_VERSION"/>
- <enum value="&quot;VK_EXT_validation_flags&quot;" name="VK_EXT_VALIDATION_FLAGS_EXTENSION_NAME"/>
- <enum offset="0" extends="VkStructureType" name="VK_STRUCTURE_TYPE_VALIDATION_FLAGS_EXT"/>
+ <enum value="2" name="VK_EXT_VALIDATION_FLAGS_SPEC_VERSION"/>
+ <enum value="&quot;VK_EXT_validation_flags&quot;" name="VK_EXT_VALIDATION_FLAGS_EXTENSION_NAME"/>
+ <enum offset="0" extends="VkStructureType" name="VK_STRUCTURE_TYPE_VALIDATION_FLAGS_EXT"/>
<type name="VkValidationFlagsEXT"/>
+ <type name="VkValidationCheckEXT"/>
</require>
</extension>
- <extension name="VK_NN_vi_surface" number="63" author="NN" contact="Mathias Heyer @mheyer" type="instance" requires="VK_KHR_surface" protect="VK_USE_PLATFORM_VI_NN" supported="vulkan">
+ <extension name="VK_NN_vi_surface" number="63" type="instance" author="NN" contact="Mathias Heyer gitlab:@mheyer" requires="VK_KHR_surface" platform="vi" supported="vulkan">
<require>
- <enum value="1" name="VK_NN_VI_SURFACE_SPEC_VERSION"/>
- <enum value="&quot;VK_NN_vi_surface&quot;" name="VK_NN_VI_SURFACE_EXTENSION_NAME"/>
- <enum offset="0" extends="VkStructureType" name="VK_STRUCTURE_TYPE_VI_SURFACE_CREATE_INFO_NN"/>
+ <enum value="1" name="VK_NN_VI_SURFACE_SPEC_VERSION"/>
+ <enum value="&quot;VK_NN_vi_surface&quot;" name="VK_NN_VI_SURFACE_EXTENSION_NAME"/>
+ <enum offset="0" extends="VkStructureType" name="VK_STRUCTURE_TYPE_VI_SURFACE_CREATE_INFO_NN"/>
<type name="VkViSurfaceCreateFlagsNN"/>
<type name="VkViSurfaceCreateInfoNN"/>
<command name="vkCreateViSurfaceNN"/>
</require>
</extension>
- <extension name="VK_KHR_shader_draw_parameters" number="64" type="device" author="KHR" contact="Daniel Koch @dgkoch" supported="vulkan">
+ <extension name="VK_KHR_shader_draw_parameters" number="64" type="device" author="KHR" contact="Daniel Koch @dgkoch" supported="vulkan" promotedto="VK_VERSION_1_1">
<require>
- <enum value="1" name="VK_KHR_SHADER_DRAW_PARAMETERS_SPEC_VERSION"/>
- <enum value="&quot;VK_KHR_shader_draw_parameters&quot;" name="VK_KHR_SHADER_DRAW_PARAMETERS_EXTENSION_NAME"/>
+ <enum value="1" name="VK_KHR_SHADER_DRAW_PARAMETERS_SPEC_VERSION"/>
+ <enum value="&quot;VK_KHR_shader_draw_parameters&quot;" name="VK_KHR_SHADER_DRAW_PARAMETERS_EXTENSION_NAME"/>
</require>
</extension>
- <extension name="VK_EXT_shader_subgroup_ballot" number="65" author="NVIDIA" contact="Daniel Koch @dgkoch" supported="vulkan">
+ <extension name="VK_EXT_shader_subgroup_ballot" number="65" type="device" author="NV" contact="Daniel Koch @dgkoch" supported="vulkan" deprecatedby="VK_VERSION_1_2">
<require>
- <enum value="1" name="VK_EXT_SHADER_SUBGROUP_BALLOT_SPEC_VERSION"/>
- <enum value="&quot;VK_EXT_shader_subgroup_ballot&quot;" name="VK_EXT_SHADER_SUBGROUP_BALLOT_EXTENSION_NAME"/>
+ <enum value="1" name="VK_EXT_SHADER_SUBGROUP_BALLOT_SPEC_VERSION"/>
+ <enum value="&quot;VK_EXT_shader_subgroup_ballot&quot;" name="VK_EXT_SHADER_SUBGROUP_BALLOT_EXTENSION_NAME"/>
</require>
</extension>
- <extension name="VK_EXT_shader_subgroup_vote" number="66" author="NVIDIA" contact="Daniel Koch @dgkoch" supported="vulkan">
+ <extension name="VK_EXT_shader_subgroup_vote" number="66" type="device" author="NV" contact="Daniel Koch @dgkoch" supported="vulkan" deprecatedby="VK_VERSION_1_1">
<require>
- <enum value="1" name="VK_EXT_SHADER_SUBGROUP_VOTE_SPEC_VERSION"/>
- <enum value="&quot;VK_EXT_shader_subgroup_vote&quot;" name="VK_EXT_SHADER_SUBGROUP_VOTE_EXTENSION_NAME"/>
+ <enum value="1" name="VK_EXT_SHADER_SUBGROUP_VOTE_SPEC_VERSION"/>
+ <enum value="&quot;VK_EXT_shader_subgroup_vote&quot;" name="VK_EXT_SHADER_SUBGROUP_VOTE_EXTENSION_NAME"/>
</require>
</extension>
- <extension name="VK_ARM_extension_01" number="67" type="device" author="ARM" contact="Jan-Harald Fredriksen @janharald" supported="disabled">
+ <extension name="VK_EXT_texture_compression_astc_hdr" number="67" type="device" author="ARM" contact="Jan-Harald Fredriksen @janharaldfredriksen-arm" requires="VK_KHR_get_physical_device_properties2" supported="vulkan" promotedto="VK_VERSION_1_3">
<require>
- <enum value="0" name="VK_ARM_EXTENSION_01_SPEC_VERSION"/>
- <enum value="&quot;VK_ARM_extension_01&quot;" name="VK_ARM_EXTENSION_01_EXTENSION_NAME"/>
+ <enum value="1" name="VK_EXT_TEXTURE_COMPRESSION_ASTC_HDR_SPEC_VERSION"/>
+ <enum value="&quot;VK_EXT_texture_compression_astc_hdr&quot;" name="VK_EXT_TEXTURE_COMPRESSION_ASTC_HDR_EXTENSION_NAME"/>
+ <enum extends="VkStructureType" name="VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_TEXTURE_COMPRESSION_ASTC_HDR_FEATURES_EXT" alias="VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_TEXTURE_COMPRESSION_ASTC_HDR_FEATURES"/>
+ <type name="VkPhysicalDeviceTextureCompressionASTCHDRFeaturesEXT"/>
+ <enum extends="VkFormat" name="VK_FORMAT_ASTC_4x4_SFLOAT_BLOCK_EXT" alias="VK_FORMAT_ASTC_4x4_SFLOAT_BLOCK"/>
+ <enum extends="VkFormat" name="VK_FORMAT_ASTC_5x4_SFLOAT_BLOCK_EXT" alias="VK_FORMAT_ASTC_5x4_SFLOAT_BLOCK"/>
+ <enum extends="VkFormat" name="VK_FORMAT_ASTC_5x5_SFLOAT_BLOCK_EXT" alias="VK_FORMAT_ASTC_5x5_SFLOAT_BLOCK"/>
+ <enum extends="VkFormat" name="VK_FORMAT_ASTC_6x5_SFLOAT_BLOCK_EXT" alias="VK_FORMAT_ASTC_6x5_SFLOAT_BLOCK"/>
+ <enum extends="VkFormat" name="VK_FORMAT_ASTC_6x6_SFLOAT_BLOCK_EXT" alias="VK_FORMAT_ASTC_6x6_SFLOAT_BLOCK"/>
+ <enum extends="VkFormat" name="VK_FORMAT_ASTC_8x5_SFLOAT_BLOCK_EXT" alias="VK_FORMAT_ASTC_8x5_SFLOAT_BLOCK"/>
+ <enum extends="VkFormat" name="VK_FORMAT_ASTC_8x6_SFLOAT_BLOCK_EXT" alias="VK_FORMAT_ASTC_8x6_SFLOAT_BLOCK"/>
+ <enum extends="VkFormat" name="VK_FORMAT_ASTC_8x8_SFLOAT_BLOCK_EXT" alias="VK_FORMAT_ASTC_8x8_SFLOAT_BLOCK"/>
+ <enum extends="VkFormat" name="VK_FORMAT_ASTC_10x5_SFLOAT_BLOCK_EXT" alias="VK_FORMAT_ASTC_10x5_SFLOAT_BLOCK"/>
+ <enum extends="VkFormat" name="VK_FORMAT_ASTC_10x6_SFLOAT_BLOCK_EXT" alias="VK_FORMAT_ASTC_10x6_SFLOAT_BLOCK"/>
+ <enum extends="VkFormat" name="VK_FORMAT_ASTC_10x8_SFLOAT_BLOCK_EXT" alias="VK_FORMAT_ASTC_10x8_SFLOAT_BLOCK"/>
+ <enum extends="VkFormat" name="VK_FORMAT_ASTC_10x10_SFLOAT_BLOCK_EXT" alias="VK_FORMAT_ASTC_10x10_SFLOAT_BLOCK"/>
+ <enum extends="VkFormat" name="VK_FORMAT_ASTC_12x10_SFLOAT_BLOCK_EXT" alias="VK_FORMAT_ASTC_12x10_SFLOAT_BLOCK"/>
+ <enum extends="VkFormat" name="VK_FORMAT_ASTC_12x12_SFLOAT_BLOCK_EXT" alias="VK_FORMAT_ASTC_12x12_SFLOAT_BLOCK"/>
</require>
</extension>
- <extension name="VK_ARM_extension_02" number="68" type="device" author="ARM" contact="Jan-Harald Fredriksen @janharald" supported="disabled">
+ <extension name="VK_EXT_astc_decode_mode" number="68" type="device" author="ARM" contact="Jan-Harald Fredriksen @janharaldfredriksen-arm" requires="VK_KHR_get_physical_device_properties2" supported="vulkan">
<require>
- <enum value="0" name="VK_ARM_EXTENSION_02_SPEC_VERSION"/>
- <enum value="&quot;VK_ARM_extension_02&quot;" name="VK_ARM_EXTENSION_02_EXTENSION_NAME"/>
+ <enum value="1" name="VK_EXT_ASTC_DECODE_MODE_SPEC_VERSION"/>
+ <enum value="&quot;VK_EXT_astc_decode_mode&quot;" name="VK_EXT_ASTC_DECODE_MODE_EXTENSION_NAME"/>
+ <enum offset="0" extends="VkStructureType" name="VK_STRUCTURE_TYPE_IMAGE_VIEW_ASTC_DECODE_MODE_EXT"/>
+ <enum offset="1" extends="VkStructureType" name="VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_ASTC_DECODE_FEATURES_EXT"/>
+ <type name="VkImageViewASTCDecodeModeEXT"/>
+ <type name="VkPhysicalDeviceASTCDecodeFeaturesEXT"/>
</require>
</extension>
- <extension name="VK_IMG_extension_69" number="69" type="device" author="IMG" contact="Tobias Hector @tobias" supported="disabled">
+ <extension name="VK_EXT_pipeline_robustness" requires="VK_KHR_get_physical_device_properties2" number="69" type="device" author="IMG" contact="Jarred Davies" supported="vulkan">
<require>
- <enum value="0" name="VK_IMG_EXTENSION_69_SPEC_VERSION"/>
- <enum value="&quot;VK_IMG_extension_69&quot;" name="VK_IMG_EXTENSION_69_EXTENSION_NAME"/>
+ <enum value="1" name="VK_EXT_PIPELINE_ROBUSTNESS_SPEC_VERSION"/>
+ <enum value="&quot;VK_EXT_pipeline_robustness&quot;" name="VK_EXT_PIPELINE_ROBUSTNESS_EXTENSION_NAME"/>
+ <enum offset="0" extends="VkStructureType" name="VK_STRUCTURE_TYPE_PIPELINE_ROBUSTNESS_CREATE_INFO_EXT"/>
+ <enum offset="1" extends="VkStructureType" name="VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_PIPELINE_ROBUSTNESS_FEATURES_EXT"/>
+ <enum offset="2" extends="VkStructureType" name="VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_PIPELINE_ROBUSTNESS_PROPERTIES_EXT"/>
+ <type name="VkPhysicalDevicePipelineRobustnessFeaturesEXT"/>
+ <type name="VkPhysicalDevicePipelineRobustnessPropertiesEXT"/>
+ <type name="VkPipelineRobustnessCreateInfoEXT"/>
+ <type name="VkPipelineRobustnessBufferBehaviorEXT"/>
+ <type name="VkPipelineRobustnessImageBehaviorEXT"/>
</require>
</extension>
- <extension name="VK_KHR_maintenance1" number="70" author="KHR" contact="Piers Daniell @pdaniell" supported="vulkan">
+ <extension name="VK_KHR_maintenance1" number="70" type="device" author="KHR" contact="Piers Daniell @pdaniell-nv" supported="vulkan" promotedto="VK_VERSION_1_1">
<require>
- <enum value="1" name="VK_KHR_MAINTENANCE1_SPEC_VERSION"/>
- <enum value="&quot;VK_KHR_maintenance1&quot;" name="VK_KHR_MAINTENANCE1_EXTENSION_NAME"/>
- <enum offset="0" dir="-" extends="VkResult" name="VK_ERROR_OUT_OF_POOL_MEMORY_KHR"/>
- <enum bitpos="14" extends="VkFormatFeatureFlagBits" name="VK_FORMAT_FEATURE_TRANSFER_SRC_BIT_KHR" comment="Format can be used as the source image of image transfer commands"/>
- <enum bitpos="15" extends="VkFormatFeatureFlagBits" name="VK_FORMAT_FEATURE_TRANSFER_DST_BIT_KHR" comment="Format can be used as the destination image of image transfer commands"/>
- <enum bitpos="5" extends="VkImageCreateFlagBits" name="VK_IMAGE_CREATE_2D_ARRAY_COMPATIBLE_BIT_KHR" comment="The 3D image can be viewed as a 2D or 2D array image"/>
+ <enum value="2" name="VK_KHR_MAINTENANCE_1_SPEC_VERSION"/>
+ <enum value="&quot;VK_KHR_maintenance1&quot;" name="VK_KHR_MAINTENANCE_1_EXTENSION_NAME"/>
+ <enum alias="VK_KHR_MAINTENANCE_1_SPEC_VERSION" name="VK_KHR_MAINTENANCE1_SPEC_VERSION" comment="Backwards-compatible alias containing a typo"/>
+ <enum alias="VK_KHR_MAINTENANCE_1_EXTENSION_NAME" name="VK_KHR_MAINTENANCE1_EXTENSION_NAME" comment="Backwards-compatible alias containing a typo"/>
+ <enum extends="VkResult" name="VK_ERROR_OUT_OF_POOL_MEMORY_KHR" alias="VK_ERROR_OUT_OF_POOL_MEMORY"/>
+ <enum extends="VkFormatFeatureFlagBits" name="VK_FORMAT_FEATURE_TRANSFER_SRC_BIT_KHR" alias="VK_FORMAT_FEATURE_TRANSFER_SRC_BIT"/>
+ <enum extends="VkFormatFeatureFlagBits" name="VK_FORMAT_FEATURE_TRANSFER_DST_BIT_KHR" alias="VK_FORMAT_FEATURE_TRANSFER_DST_BIT"/>
+ <enum extends="VkImageCreateFlagBits" name="VK_IMAGE_CREATE_2D_ARRAY_COMPATIBLE_BIT_KHR" alias="VK_IMAGE_CREATE_2D_ARRAY_COMPATIBLE_BIT"/>
+ <type name="VkCommandPoolTrimFlagsKHR"/>
<command name="vkTrimCommandPoolKHR"/>
</require>
</extension>
- <extension name="VK_KHR_extension_71" number="71" author="KHR" contact="Jeff Bolz @jbolz" supported="disabled">
+ <extension name="VK_KHR_device_group_creation" number="71" type="instance" author="KHR" contact="Jeff Bolz @jeffbolznv" supported="vulkan" promotedto="VK_VERSION_1_1">
<require>
- <enum value="0" name="VK_KHR_EXTENSION_71_SPEC_VERSION"/>
- <enum value="&quot;VK_KHR_extension_71&quot;" name="VK_KHR_EXTENSION_71_EXTENSION_NAME"/>
+ <enum value="1" name="VK_KHR_DEVICE_GROUP_CREATION_SPEC_VERSION"/>
+ <enum value="&quot;VK_KHR_device_group_creation&quot;" name="VK_KHR_DEVICE_GROUP_CREATION_EXTENSION_NAME"/>
+ <enum extends="VkStructureType" name="VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_GROUP_PROPERTIES_KHR" alias="VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_GROUP_PROPERTIES"/>
+ <enum extends="VkStructureType" name="VK_STRUCTURE_TYPE_DEVICE_GROUP_DEVICE_CREATE_INFO_KHR" alias="VK_STRUCTURE_TYPE_DEVICE_GROUP_DEVICE_CREATE_INFO"/>
+ <enum name="VK_MAX_DEVICE_GROUP_SIZE_KHR"/>
+ <type name="VkPhysicalDeviceGroupPropertiesKHR"/>
+ <type name="VkDeviceGroupDeviceCreateInfoKHR"/>
+ <command name="vkEnumeratePhysicalDeviceGroupsKHR"/>
+ <enum extends="VkMemoryHeapFlagBits" name="VK_MEMORY_HEAP_MULTI_INSTANCE_BIT_KHR" alias="VK_MEMORY_HEAP_MULTI_INSTANCE_BIT"/>
</require>
</extension>
- <extension name="VK_KHR_extension_72" number="72" author="KHR" contact="James Jones @cubanismo" supported="disable">
+ <extension name="VK_KHR_external_memory_capabilities" number="72" type="instance" author="KHR" requires="VK_KHR_get_physical_device_properties2" contact="James Jones @cubanismo" supported="vulkan" promotedto="VK_VERSION_1_1">
<require>
- <enum value="0" name="VK_KHR_EXTENSION_72_SPEC_VERSION"/>
- <enum value="&quot;VK_KHR_extension_72&quot;" name="VK_KHR_EXTENSION_72_EXTENSION_NAME"/>
+ <enum value="1" name="VK_KHR_EXTERNAL_MEMORY_CAPABILITIES_SPEC_VERSION"/>
+ <enum value="&quot;VK_KHR_external_memory_capabilities&quot;" name="VK_KHR_EXTERNAL_MEMORY_CAPABILITIES_EXTENSION_NAME"/>
+ <enum extends="VkStructureType" name="VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_EXTERNAL_IMAGE_FORMAT_INFO_KHR" alias="VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_EXTERNAL_IMAGE_FORMAT_INFO"/>
+ <enum extends="VkStructureType" name="VK_STRUCTURE_TYPE_EXTERNAL_IMAGE_FORMAT_PROPERTIES_KHR" alias="VK_STRUCTURE_TYPE_EXTERNAL_IMAGE_FORMAT_PROPERTIES"/>
+ <enum extends="VkStructureType" name="VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_EXTERNAL_BUFFER_INFO_KHR" alias="VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_EXTERNAL_BUFFER_INFO"/>
+ <enum extends="VkStructureType" name="VK_STRUCTURE_TYPE_EXTERNAL_BUFFER_PROPERTIES_KHR" alias="VK_STRUCTURE_TYPE_EXTERNAL_BUFFER_PROPERTIES"/>
+ <enum extends="VkStructureType" name="VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_ID_PROPERTIES_KHR" alias="VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_ID_PROPERTIES"/>
+ <enum name="VK_LUID_SIZE_KHR"/>
+ <type name="VkExternalMemoryHandleTypeFlagsKHR"/>
+ <type name="VkExternalMemoryHandleTypeFlagBitsKHR"/>
+ <enum extends="VkExternalMemoryHandleTypeFlagBits" name="VK_EXTERNAL_MEMORY_HANDLE_TYPE_OPAQUE_FD_BIT_KHR" alias="VK_EXTERNAL_MEMORY_HANDLE_TYPE_OPAQUE_FD_BIT"/>
+ <enum extends="VkExternalMemoryHandleTypeFlagBits" name="VK_EXTERNAL_MEMORY_HANDLE_TYPE_OPAQUE_WIN32_BIT_KHR" alias="VK_EXTERNAL_MEMORY_HANDLE_TYPE_OPAQUE_WIN32_BIT"/>
+ <enum extends="VkExternalMemoryHandleTypeFlagBits" name="VK_EXTERNAL_MEMORY_HANDLE_TYPE_OPAQUE_WIN32_KMT_BIT_KHR" alias="VK_EXTERNAL_MEMORY_HANDLE_TYPE_OPAQUE_WIN32_KMT_BIT"/>
+ <enum extends="VkExternalMemoryHandleTypeFlagBits" name="VK_EXTERNAL_MEMORY_HANDLE_TYPE_D3D11_TEXTURE_BIT_KHR" alias="VK_EXTERNAL_MEMORY_HANDLE_TYPE_D3D11_TEXTURE_BIT"/>
+ <enum extends="VkExternalMemoryHandleTypeFlagBits" name="VK_EXTERNAL_MEMORY_HANDLE_TYPE_D3D11_TEXTURE_KMT_BIT_KHR" alias="VK_EXTERNAL_MEMORY_HANDLE_TYPE_D3D11_TEXTURE_KMT_BIT"/>
+ <enum extends="VkExternalMemoryHandleTypeFlagBits" name="VK_EXTERNAL_MEMORY_HANDLE_TYPE_D3D12_HEAP_BIT_KHR" alias="VK_EXTERNAL_MEMORY_HANDLE_TYPE_D3D12_HEAP_BIT"/>
+ <enum extends="VkExternalMemoryHandleTypeFlagBits" name="VK_EXTERNAL_MEMORY_HANDLE_TYPE_D3D12_RESOURCE_BIT_KHR" alias="VK_EXTERNAL_MEMORY_HANDLE_TYPE_D3D12_RESOURCE_BIT"/>
+ <type name="VkExternalMemoryFeatureFlagsKHR"/>
+ <type name="VkExternalMemoryFeatureFlagBitsKHR"/>
+ <enum extends="VkExternalMemoryFeatureFlagBits" name="VK_EXTERNAL_MEMORY_FEATURE_DEDICATED_ONLY_BIT_KHR" alias="VK_EXTERNAL_MEMORY_FEATURE_DEDICATED_ONLY_BIT"/>
+ <enum extends="VkExternalMemoryFeatureFlagBits" name="VK_EXTERNAL_MEMORY_FEATURE_EXPORTABLE_BIT_KHR" alias="VK_EXTERNAL_MEMORY_FEATURE_EXPORTABLE_BIT"/>
+ <enum extends="VkExternalMemoryFeatureFlagBits" name="VK_EXTERNAL_MEMORY_FEATURE_IMPORTABLE_BIT_KHR" alias="VK_EXTERNAL_MEMORY_FEATURE_IMPORTABLE_BIT"/>
+ <type name="VkExternalMemoryPropertiesKHR"/>
+ <type name="VkPhysicalDeviceExternalImageFormatInfoKHR"/>
+ <type name="VkExternalImageFormatPropertiesKHR"/>
+ <type name="VkPhysicalDeviceExternalBufferInfoKHR"/>
+ <type name="VkExternalBufferPropertiesKHR"/>
+ <type name="VkPhysicalDeviceIDPropertiesKHR"/>
+ <command name="vkGetPhysicalDeviceExternalBufferPropertiesKHR"/>
</require>
</extension>
- <extension name="VK_KHR_extension_73" number="73" author="KHR" contact="James Jones @cubanismo" supported="disable">
+ <extension name="VK_KHR_external_memory" number="73" type="device" requires="VK_KHR_external_memory_capabilities" author="KHR" contact="James Jones @cubanismo" supported="vulkan" promotedto="VK_VERSION_1_1">
<require>
- <enum value="0" name="VK_KHR_EXTENSION_73_SPEC_VERSION"/>
- <enum value="&quot;VK_KHR_extension_73&quot;" name="VK_KHR_EXTENSION_73_EXTENSION_NAME"/>
+ <enum value="1" name="VK_KHR_EXTERNAL_MEMORY_SPEC_VERSION"/>
+ <enum value="&quot;VK_KHR_external_memory&quot;" name="VK_KHR_EXTERNAL_MEMORY_EXTENSION_NAME"/>
+ <enum extends="VkStructureType" name="VK_STRUCTURE_TYPE_EXTERNAL_MEMORY_BUFFER_CREATE_INFO_KHR" alias="VK_STRUCTURE_TYPE_EXTERNAL_MEMORY_BUFFER_CREATE_INFO"/>
+ <enum extends="VkStructureType" name="VK_STRUCTURE_TYPE_EXTERNAL_MEMORY_IMAGE_CREATE_INFO_KHR" alias="VK_STRUCTURE_TYPE_EXTERNAL_MEMORY_IMAGE_CREATE_INFO"/>
+ <enum extends="VkStructureType" name="VK_STRUCTURE_TYPE_EXPORT_MEMORY_ALLOCATE_INFO_KHR" alias="VK_STRUCTURE_TYPE_EXPORT_MEMORY_ALLOCATE_INFO"/>
+ <enum extends="VkResult" name="VK_ERROR_INVALID_EXTERNAL_HANDLE_KHR" alias="VK_ERROR_INVALID_EXTERNAL_HANDLE"/>
+ <enum name="VK_QUEUE_FAMILY_EXTERNAL_KHR"/>
+ <type name="VkExternalMemoryImageCreateInfoKHR"/>
+ <type name="VkExternalMemoryBufferCreateInfoKHR"/>
+ <type name="VkExportMemoryAllocateInfoKHR"/>
</require>
</extension>
- <extension name="VK_KHR_extension_74" number="74" author="KHR" contact="James Jones @cubanismo" supported="disable">
+ <extension name="VK_KHR_external_memory_win32" number="74" type="device" requires="VK_KHR_external_memory" author="KHR" contact="James Jones @cubanismo" platform="win32" supported="vulkan">
<require>
- <enum value="0" name="VK_KHR_EXTENSION_74_SPEC_VERSION"/>
- <enum value="&quot;VK_KHR_extension_74&quot;" name="VK_KHR_EXTENSION_74_EXTENSION_NAME"/>
+ <enum value="1" name="VK_KHR_EXTERNAL_MEMORY_WIN32_SPEC_VERSION"/>
+ <enum value="&quot;VK_KHR_external_memory_win32&quot;" name="VK_KHR_EXTERNAL_MEMORY_WIN32_EXTENSION_NAME"/>
+ <enum offset="0" extends="VkStructureType" name="VK_STRUCTURE_TYPE_IMPORT_MEMORY_WIN32_HANDLE_INFO_KHR"/>
+ <enum offset="1" extends="VkStructureType" name="VK_STRUCTURE_TYPE_EXPORT_MEMORY_WIN32_HANDLE_INFO_KHR"/>
+ <enum offset="2" extends="VkStructureType" name="VK_STRUCTURE_TYPE_MEMORY_WIN32_HANDLE_PROPERTIES_KHR"/>
+ <enum offset="3" extends="VkStructureType" name="VK_STRUCTURE_TYPE_MEMORY_GET_WIN32_HANDLE_INFO_KHR"/>
+ <type name="VkImportMemoryWin32HandleInfoKHR"/>
+ <type name="VkExportMemoryWin32HandleInfoKHR"/>
+ <type name="VkMemoryWin32HandlePropertiesKHR"/>
+ <type name="VkMemoryGetWin32HandleInfoKHR"/>
+ <command name="vkGetMemoryWin32HandleKHR"/>
+ <command name="vkGetMemoryWin32HandlePropertiesKHR"/>
</require>
</extension>
- <extension name="VK_KHR_extension_75" number="75" author="KHR" contact="James Jones @cubanismo" supported="disable">
+ <extension name="VK_KHR_external_memory_fd" number="75" type="device" requires="VK_KHR_external_memory" author="KHR" contact="James Jones @cubanismo" supported="vulkan">
<require>
- <enum value="0" name="VK_KHR_EXTENSION_75_SPEC_VERSION"/>
- <enum value="&quot;VK_KHR_extension_75&quot;" name="VK_KHR_EXTENSION_75_EXTENSION_NAME"/>
+ <enum value="1" name="VK_KHR_EXTERNAL_MEMORY_FD_SPEC_VERSION"/>
+ <enum value="&quot;VK_KHR_external_memory_fd&quot;" name="VK_KHR_EXTERNAL_MEMORY_FD_EXTENSION_NAME"/>
+ <enum offset="0" extends="VkStructureType" name="VK_STRUCTURE_TYPE_IMPORT_MEMORY_FD_INFO_KHR"/>
+ <enum offset="1" extends="VkStructureType" name="VK_STRUCTURE_TYPE_MEMORY_FD_PROPERTIES_KHR"/>
+ <enum offset="2" extends="VkStructureType" name="VK_STRUCTURE_TYPE_MEMORY_GET_FD_INFO_KHR"/>
+ <type name="VkImportMemoryFdInfoKHR"/>
+ <type name="VkMemoryFdPropertiesKHR"/>
+ <type name="VkMemoryGetFdInfoKHR"/>
+ <command name="vkGetMemoryFdKHR"/>
+ <command name="vkGetMemoryFdPropertiesKHR"/>
</require>
</extension>
- <extension name="VK_KHR_extension_76" number="76" author="KHR" contact="James Jones @cubanismo" supported="disable">
+ <extension name="VK_KHR_win32_keyed_mutex" number="76" type="device" requires="VK_KHR_external_memory_win32" author="KHR" contact="Carsten Rohde @crohde" platform="win32" supported="vulkan">
<require>
- <enum value="0" name="VK_KHR_EXTENSION_76_SPEC_VERSION"/>
- <enum value="&quot;VK_KHR_extension_76&quot;" name="VK_KHR_EXTENSION_76_EXTENSION_NAME"/>
+ <enum value="1" name="VK_KHR_WIN32_KEYED_MUTEX_SPEC_VERSION"/>
+ <enum value="&quot;VK_KHR_win32_keyed_mutex&quot;" name="VK_KHR_WIN32_KEYED_MUTEX_EXTENSION_NAME"/>
+ <enum offset="0" extends="VkStructureType" name="VK_STRUCTURE_TYPE_WIN32_KEYED_MUTEX_ACQUIRE_RELEASE_INFO_KHR"/>
+ <type name="VkWin32KeyedMutexAcquireReleaseInfoKHR"/>
</require>
</extension>
- <extension name="VK_KHR_extension_77" number="77" author="KHR" contact="James Jones @cubanismo" supported="disable">
+ <extension name="VK_KHR_external_semaphore_capabilities" number="77" type="instance" author="KHR" requires="VK_KHR_get_physical_device_properties2" contact="James Jones @cubanismo" supported="vulkan" promotedto="VK_VERSION_1_1">
<require>
- <enum value="0" name="VK_KHR_EXTENSION_77_SPEC_VERSION"/>
- <enum value="&quot;VK_KHR_extension_77&quot;" name="VK_KHR_EXTENSION_77_EXTENSION_NAME"/>
+ <enum value="1" name="VK_KHR_EXTERNAL_SEMAPHORE_CAPABILITIES_SPEC_VERSION"/>
+ <enum value="&quot;VK_KHR_external_semaphore_capabilities&quot;" name="VK_KHR_EXTERNAL_SEMAPHORE_CAPABILITIES_EXTENSION_NAME"/>
+ <enum extends="VkStructureType" name="VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_EXTERNAL_SEMAPHORE_INFO_KHR" alias="VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_EXTERNAL_SEMAPHORE_INFO"/>
+ <enum extends="VkStructureType" name="VK_STRUCTURE_TYPE_EXTERNAL_SEMAPHORE_PROPERTIES_KHR" alias="VK_STRUCTURE_TYPE_EXTERNAL_SEMAPHORE_PROPERTIES"/>
+ <enum extends="VkStructureType" name="VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_ID_PROPERTIES_KHR" alias="VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_ID_PROPERTIES"/>
+ <enum name="VK_LUID_SIZE_KHR"/>
+ <type name="VkExternalSemaphoreHandleTypeFlagsKHR"/>
+ <type name="VkExternalSemaphoreHandleTypeFlagBitsKHR"/>
+ <enum extends="VkExternalSemaphoreHandleTypeFlagBits" name="VK_EXTERNAL_SEMAPHORE_HANDLE_TYPE_OPAQUE_FD_BIT_KHR" alias="VK_EXTERNAL_SEMAPHORE_HANDLE_TYPE_OPAQUE_FD_BIT"/>
+ <enum extends="VkExternalSemaphoreHandleTypeFlagBits" name="VK_EXTERNAL_SEMAPHORE_HANDLE_TYPE_OPAQUE_WIN32_BIT_KHR" alias="VK_EXTERNAL_SEMAPHORE_HANDLE_TYPE_OPAQUE_WIN32_BIT"/>
+ <enum extends="VkExternalSemaphoreHandleTypeFlagBits" name="VK_EXTERNAL_SEMAPHORE_HANDLE_TYPE_OPAQUE_WIN32_KMT_BIT_KHR" alias="VK_EXTERNAL_SEMAPHORE_HANDLE_TYPE_OPAQUE_WIN32_KMT_BIT"/>
+ <enum extends="VkExternalSemaphoreHandleTypeFlagBits" name="VK_EXTERNAL_SEMAPHORE_HANDLE_TYPE_D3D12_FENCE_BIT_KHR" alias="VK_EXTERNAL_SEMAPHORE_HANDLE_TYPE_D3D12_FENCE_BIT"/>
+ <enum extends="VkExternalSemaphoreHandleTypeFlagBits" name="VK_EXTERNAL_SEMAPHORE_HANDLE_TYPE_SYNC_FD_BIT_KHR" alias="VK_EXTERNAL_SEMAPHORE_HANDLE_TYPE_SYNC_FD_BIT"/>
+ <type name="VkExternalSemaphoreFeatureFlagsKHR"/>
+ <type name="VkExternalSemaphoreFeatureFlagBitsKHR"/>
+ <enum extends="VkExternalSemaphoreFeatureFlagBits" name="VK_EXTERNAL_SEMAPHORE_FEATURE_EXPORTABLE_BIT_KHR" alias="VK_EXTERNAL_SEMAPHORE_FEATURE_EXPORTABLE_BIT"/>
+ <enum extends="VkExternalSemaphoreFeatureFlagBits" name="VK_EXTERNAL_SEMAPHORE_FEATURE_IMPORTABLE_BIT_KHR" alias="VK_EXTERNAL_SEMAPHORE_FEATURE_IMPORTABLE_BIT"/>
+ <type name="VkPhysicalDeviceExternalSemaphoreInfoKHR"/>
+ <type name="VkExternalSemaphorePropertiesKHR"/>
+ <type name="VkPhysicalDeviceIDPropertiesKHR"/>
+ <command name="vkGetPhysicalDeviceExternalSemaphorePropertiesKHR"/>
</require>
</extension>
- <extension name="VK_KHR_extension_78" number="78" author="KHR" contact="James Jones @cubanismo" supported="disable">
+ <extension name="VK_KHR_external_semaphore" number="78" type="device" requires="VK_KHR_external_semaphore_capabilities" author="KHR" contact="James Jones @cubanismo" supported="vulkan" promotedto="VK_VERSION_1_1">
<require>
- <enum value="0" name="VK_KHR_EXTENSION_78_SPEC_VERSION"/>
- <enum value="&quot;VK_KHR_extension_78&quot;" name="VK_KHR_EXTENSION_78_EXTENSION_NAME"/>
+ <enum value="1" name="VK_KHR_EXTERNAL_SEMAPHORE_SPEC_VERSION"/>
+ <enum value="&quot;VK_KHR_external_semaphore&quot;" name="VK_KHR_EXTERNAL_SEMAPHORE_EXTENSION_NAME"/>
+ <enum extends="VkStructureType" name="VK_STRUCTURE_TYPE_EXPORT_SEMAPHORE_CREATE_INFO_KHR" alias="VK_STRUCTURE_TYPE_EXPORT_SEMAPHORE_CREATE_INFO"/>
+ <type name="VkSemaphoreImportFlagsKHR"/>
+ <type name="VkSemaphoreImportFlagBitsKHR"/>
+ <enum extends="VkSemaphoreImportFlagBits" name="VK_SEMAPHORE_IMPORT_TEMPORARY_BIT_KHR" alias="VK_SEMAPHORE_IMPORT_TEMPORARY_BIT"/>
+ <type name="VkExportSemaphoreCreateInfoKHR"/>
</require>
</extension>
- <extension name="VK_KHR_extension_79" number="79" author="KHR" contact="James Jones @cubanismo" supported="disable">
+ <extension name="VK_KHR_external_semaphore_win32" number="79" type="device" requires="VK_KHR_external_semaphore" author="KHR" contact="James Jones @cubanismo" platform="win32" supported="vulkan">
<require>
- <enum value="0" name="VK_KHR_EXTENSION_79_SPEC_VERSION"/>
- <enum value="&quot;VK_KHR_extension_79&quot;" name="VK_KHR_EXTENSION_79_EXTENSION_NAME"/>
+ <enum value="1" name="VK_KHR_EXTERNAL_SEMAPHORE_WIN32_SPEC_VERSION"/>
+ <enum value="&quot;VK_KHR_external_semaphore_win32&quot;" name="VK_KHR_EXTERNAL_SEMAPHORE_WIN32_EXTENSION_NAME"/>
+ <enum offset="0" extends="VkStructureType" name="VK_STRUCTURE_TYPE_IMPORT_SEMAPHORE_WIN32_HANDLE_INFO_KHR"/>
+ <enum offset="1" extends="VkStructureType" name="VK_STRUCTURE_TYPE_EXPORT_SEMAPHORE_WIN32_HANDLE_INFO_KHR"/>
+ <enum offset="2" extends="VkStructureType" name="VK_STRUCTURE_TYPE_D3D12_FENCE_SUBMIT_INFO_KHR"/>
+ <enum offset="3" extends="VkStructureType" name="VK_STRUCTURE_TYPE_SEMAPHORE_GET_WIN32_HANDLE_INFO_KHR"/>
+ <type name="VkImportSemaphoreWin32HandleInfoKHR"/>
+ <type name="VkExportSemaphoreWin32HandleInfoKHR"/>
+ <type name="VkD3D12FenceSubmitInfoKHR"/>
+ <type name="VkSemaphoreGetWin32HandleInfoKHR"/>
+ <command name="vkImportSemaphoreWin32HandleKHR"/>
+ <command name="vkGetSemaphoreWin32HandleKHR"/>
</require>
</extension>
- <extension name="VK_KHR_extension_80" number="80" author="KHR" contact="James Jones @cubanismo" supported="disable">
+ <extension name="VK_KHR_external_semaphore_fd" number="80" type="device" requires="VK_KHR_external_semaphore" author="KHR" contact="James Jones @cubanismo" supported="vulkan">
<require>
- <enum value="0" name="VK_KHR_EXTENSION_80_SPEC_VERSION"/>
- <enum value="&quot;VK_KHR_extension_80&quot;" name="VK_KHR_EXTENSION_80_EXTENSION_NAME"/>
+ <enum value="1" name="VK_KHR_EXTERNAL_SEMAPHORE_FD_SPEC_VERSION"/>
+ <enum value="&quot;VK_KHR_external_semaphore_fd&quot;" name="VK_KHR_EXTERNAL_SEMAPHORE_FD_EXTENSION_NAME"/>
+ <enum offset="0" extends="VkStructureType" name="VK_STRUCTURE_TYPE_IMPORT_SEMAPHORE_FD_INFO_KHR"/>
+ <enum offset="1" extends="VkStructureType" name="VK_STRUCTURE_TYPE_SEMAPHORE_GET_FD_INFO_KHR"/>
+ <type name="VkImportSemaphoreFdInfoKHR"/>
+ <type name="VkSemaphoreGetFdInfoKHR"/>
+ <command name="vkImportSemaphoreFdKHR"/>
+ <command name="vkGetSemaphoreFdKHR"/>
</require>
</extension>
- <extension name="VK_KHR_extension_81" number="81" author="KHR" contact="Jeff Bolz @jbolz" supported="disabled">
+ <extension name="VK_KHR_push_descriptor" number="81" type="device" author="KHR" requires="VK_KHR_get_physical_device_properties2" contact="Jeff Bolz @jeffbolznv" supported="vulkan">
<require>
- <enum value="0" name="VK_KHR_EXTENSION_81_SPEC_VERSION"/>
- <enum value="&quot;VK_KHR_extension_81&quot;" name="VK_KHR_EXTENSION_81_EXTENSION_NAME"/>
+ <enum value="2" name="VK_KHR_PUSH_DESCRIPTOR_SPEC_VERSION"/>
+ <enum value="&quot;VK_KHR_push_descriptor&quot;" name="VK_KHR_PUSH_DESCRIPTOR_EXTENSION_NAME"/>
+ <enum offset="0" extends="VkStructureType" name="VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_PUSH_DESCRIPTOR_PROPERTIES_KHR"/>
+ <enum bitpos="0" extends="VkDescriptorSetLayoutCreateFlagBits" name="VK_DESCRIPTOR_SET_LAYOUT_CREATE_PUSH_DESCRIPTOR_BIT_KHR" comment="Descriptors are pushed via flink:vkCmdPushDescriptorSetKHR"/>
+ <command name="vkCmdPushDescriptorSetKHR"/>
+ <type name="VkPhysicalDevicePushDescriptorPropertiesKHR"/>
+ </require>
+ <require feature="VK_VERSION_1_1">
+ <command name="vkCmdPushDescriptorSetWithTemplateKHR"/>
+ <enum value="1" extends="VkDescriptorUpdateTemplateType" name="VK_DESCRIPTOR_UPDATE_TEMPLATE_TYPE_PUSH_DESCRIPTORS_KHR" comment="Create descriptor update template for pushed descriptor updates"/>
+ </require>
+ <require extension="VK_KHR_descriptor_update_template">
+ <command name="vkCmdPushDescriptorSetWithTemplateKHR"/>
+ <enum value="1" extends="VkDescriptorUpdateTemplateType" name="VK_DESCRIPTOR_UPDATE_TEMPLATE_TYPE_PUSH_DESCRIPTORS_KHR" comment="Create descriptor update template for pushed descriptor updates"/>
</require>
</extension>
- <extension name="VK_KHR_extension_82" number="82" author="KHR" contact="Jeff Bolz @jbolz" supported="disabled">
+ <extension name="VK_EXT_conditional_rendering" number="82" type="device" author="NV" contact="Vikram Kushwaha @vkushwaha" supported="vulkan">
<require>
- <enum value="0" name="VK_KHR_EXTENSION_82_SPEC_VERSION"/>
- <enum value="&quot;VK_KHR_extension_82&quot;" name="VK_KHR_EXTENSION_82_EXTENSION_NAME"/>
+ <enum value="2" name="VK_EXT_CONDITIONAL_RENDERING_SPEC_VERSION"/>
+ <enum value="&quot;VK_EXT_conditional_rendering&quot;" name="VK_EXT_CONDITIONAL_RENDERING_EXTENSION_NAME"/>
+ <enum offset="0" extends="VkStructureType" name="VK_STRUCTURE_TYPE_COMMAND_BUFFER_INHERITANCE_CONDITIONAL_RENDERING_INFO_EXT"/>
+ <enum offset="1" extends="VkStructureType" name="VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_CONDITIONAL_RENDERING_FEATURES_EXT"/>
+ <enum offset="2" extends="VkStructureType" name="VK_STRUCTURE_TYPE_CONDITIONAL_RENDERING_BEGIN_INFO_EXT"/>
+ <type name="VkConditionalRenderingFlagsEXT"/>
+ <type name="VkConditionalRenderingFlagBitsEXT"/>
+ <enum bitpos="20" extends="VkAccessFlagBits" name="VK_ACCESS_CONDITIONAL_RENDERING_READ_BIT_EXT" comment="read access flag for reading conditional rendering predicate"/>
+ <enum bitpos="9" extends="VkBufferUsageFlagBits" name="VK_BUFFER_USAGE_CONDITIONAL_RENDERING_BIT_EXT" comment="Specifies the buffer can be used as predicate in conditional rendering"/>
+ <enum bitpos="18" extends="VkPipelineStageFlagBits" name="VK_PIPELINE_STAGE_CONDITIONAL_RENDERING_BIT_EXT" comment="A pipeline stage for conditional rendering predicate fetch"/>
+ <command name="vkCmdBeginConditionalRenderingEXT"/>
+ <command name="vkCmdEndConditionalRenderingEXT"/>
+ <type name="VkConditionalRenderingBeginInfoEXT"/>
+ <type name="VkPhysicalDeviceConditionalRenderingFeaturesEXT"/>
+ <type name="VkCommandBufferInheritanceConditionalRenderingInfoEXT"/>
</require>
</extension>
- <extension name="VK_KHR_extension_83" number="83" author="KHR" contact="Jan-Harald Fredriksen @janharald" supported="disabled">
- <require>
- <enum value="0" name="VK_KHR_EXTENSION_83_SPEC_VERSION"/>
- <enum value="&quot;VK_KHR_extension_83&quot;" name="VK_KHR_EXTENSION_83_EXTENSION_NAME"/>
- </require>
- </extension>
- <extension name="VK_KHR_extension_84" number="84" author="KHR" contact="Jan-Harald Fredriksen @janharald" supported="disabled">
- <require>
- <enum value="0" name="VK_KHR_EXTENSION_84_SPEC_VERSION"/>
- <enum value="&quot;VK_KHR_extension_84&quot;" name="VK_KHR_EXTENSION_84_EXTENSION_NAME"/>
- </require>
- </extension>
- <extension name="VK_KHR_extension_85" number="85" author="KHR" contact="Ian Elliott @ianelliott" supported="disabled">
- <require>
- <enum value="0" name="VK_KHR_EXTENSION_85_SPEC_VERSION"/>
- <enum value="&quot;VK_KHR_extension_85&quot;" name="VK_KHR_EXTENSION_85_EXTENSION_NAME"/>
- </require>
- </extension>
- <extension name="VK_KHR_extension_86" number="86" author="KHR" contact="Markus Tavenrath @mtavenrath" supported="disabled">
- <require>
- <enum value="0" name="VK_KHR_EXTENSION_86_SPEC_VERSION"/>
- <enum value="&quot;VK_KHR_extension_86&quot;" name="VK_KHR_EXTENSION_86_EXTENSION_NAME"/>
- </require>
- </extension>
- <extension name="VK_NVX_device_generated_commands" number="87" type="device" author="NVIDIA" contact="Christoph Kubisch @pixeljetstream" supported="vulkan">
- <require>
- <enum value="1" name="VK_NVX_DEVICE_GENERATED_COMMANDS_SPEC_VERSION"/>
- <enum value="&quot;VK_NVX_device_generated_commands&quot;" name="VK_NVX_DEVICE_GENERATED_COMMANDS_EXTENSION_NAME"/>
- <enum offset="0" extends="VkStructureType" name="VK_STRUCTURE_TYPE_OBJECT_TABLE_CREATE_INFO_NVX"/>
- <enum offset="1" extends="VkStructureType" name="VK_STRUCTURE_TYPE_INDIRECT_COMMANDS_LAYOUT_CREATE_INFO_NVX"/>
- <enum offset="2" extends="VkStructureType" name="VK_STRUCTURE_TYPE_CMD_PROCESS_COMMANDS_INFO_NVX"/>
- <enum offset="3" extends="VkStructureType" name="VK_STRUCTURE_TYPE_CMD_RESERVE_SPACE_FOR_COMMANDS_INFO_NVX"/>
- <enum offset="4" extends="VkStructureType" name="VK_STRUCTURE_TYPE_DEVICE_GENERATED_COMMANDS_LIMITS_NVX"/>
- <enum offset="5" extends="VkStructureType" name="VK_STRUCTURE_TYPE_DEVICE_GENERATED_COMMANDS_FEATURES_NVX"/>
- <enum bitpos="17" extends="VkPipelineStageFlagBits" name="VK_PIPELINE_STAGE_COMMAND_PROCESS_BIT_NVX"/>
- <enum bitpos="17" extends="VkAccessFlagBits" name="VK_ACCESS_COMMAND_PROCESS_READ_BIT_NVX"/>
- <enum bitpos="18" extends="VkAccessFlagBits" name="VK_ACCESS_COMMAND_PROCESS_WRITE_BIT_NVX"/>
- <type name="VkObjectTableNVX"/>
- <type name="VkIndirectCommandsLayoutNVX"/>
- <type name="VkIndirectCommandsLayoutUsageFlagsNVX"/>
- <type name="VkObjectEntryUsageFlagsNVX"/>
- <type name="VkIndirectCommandsLayoutUsageFlagBitsNVX"/>
- <type name="VkIndirectCommandsTokenTypeNVX"/>
- <type name="VkObjectEntryUsageFlagBitsNVX"/>
- <type name="VkObjectEntryTypeNVX"/>
- <type name="VkDeviceGeneratedCommandsFeaturesNVX"/>
- <type name="VkDeviceGeneratedCommandsLimitsNVX"/>
- <type name="VkIndirectCommandsTokenNVX"/>
- <type name="VkIndirectCommandsLayoutTokenNVX"/>
- <type name="VkIndirectCommandsLayoutCreateInfoNVX"/>
- <type name="VkCmdProcessCommandsInfoNVX"/>
- <type name="VkCmdReserveSpaceForCommandsInfoNVX"/>
- <type name="VkObjectTableCreateInfoNVX"/>
- <type name="VkObjectTableEntryNVX"/>
- <type name="VkObjectTablePipelineEntryNVX"/>
- <type name="VkObjectTableDescriptorSetEntryNVX"/>
- <type name="VkObjectTableVertexBufferEntryNVX"/>
- <type name="VkObjectTableIndexBufferEntryNVX"/>
- <type name="VkObjectTablePushConstantEntryNVX"/>
- <command name="vkCmdProcessCommandsNVX"/>
- <command name="vkCmdReserveSpaceForCommandsNVX"/>
- <command name="vkCreateIndirectCommandsLayoutNVX"/>
- <command name="vkDestroyIndirectCommandsLayoutNVX"/>
- <command name="vkCreateObjectTableNVX"/>
- <command name="vkDestroyObjectTableNVX"/>
- <command name="vkRegisterObjectsNVX"/>
- <command name="vkUnregisterObjectsNVX"/>
- <command name="vkGetPhysicalDeviceGeneratedCommandsPropertiesNVX"/>
- </require>
- </extension>
- <extension name="VK_KHR_extension_88" number="88" author="NV" contact="Eric Werness @ewerness" supported="disabled">
- <require>
- <enum value="0" name="VK_KHR_EXTENSION_88_SPEC_VERSION"/>
- <enum value="&quot;VK_KHR_extension_88&quot;" name="VK_KHR_EXTENSION_88_EXTENSION_NAME"/>
- </require>
- </extension>
- <extension name="VK_EXT_direct_mode_display" number="89" type="instance" requires="VK_KHR_display" author="NVIDIA" contact="James Jones @cubanismo" supported="vulkan">
- <require>
- <enum value="1" name="VK_EXT_DIRECT_MODE_DISPLAY_SPEC_VERSION"/>
- <enum value="&quot;VK_EXT_direct_mode_display&quot;" name="VK_EXT_DIRECT_MODE_DISPLAY_EXTENSION_NAME"/>
- <command name="vkReleaseDisplayEXT"/>
- </require>
- </extension>
- <extension name="VK_EXT_acquire_xlib_display" number="90" type="instance" requires="VK_EXT_direct_mode_display,VK_KHR_display" author="NVIDIA" contact="James Jones @cubanismo" protect="VK_USE_PLATFORM_XLIB_XRANDR_EXT" supported="vulkan">
- <require>
- <enum value="1" name="VK_EXT_ACQUIRE_XLIB_DISPLAY_SPEC_VERSION"/>
- <enum value="&quot;VK_EXT_acquire_xlib_display&quot;" name="VK_EXT_ACQUIRE_XLIB_DISPLAY_EXTENSION_NAME"/>
- <command name="vkAcquireXlibDisplayEXT"/>
- <command name="vkGetRandROutputDisplayEXT"/>
- </require>
- </extension>
- <extension name="VK_EXT_display_surface_counter" number="91" type="instance" requires="VK_KHR_display" author="NVIDIA" contact="James Jones @cubanismo" supported="vulkan">
- <require>
- <enum value="1" name="VK_EXT_DISPLAY_SURFACE_COUNTER_SPEC_VERSION"/>
- <enum value="&quot;VK_EXT_display_surface_counter&quot;" name="VK_EXT_DISPLAY_SURFACE_COUNTER_EXTENSION_NAME"/>
- <enum offset="0" extends="VkStructureType" name="VK_STRUCTURE_TYPE_SURFACE_CAPABILITIES2_EXT"/>
- <type name="VkSurfaceCounterFlagsEXT"/>
- <type name="VkSurfaceCounterFlagBitsEXT"/>
- <type name="VkSurfaceCapabilities2EXT"/>
- <command name="vkGetPhysicalDeviceSurfaceCapabilities2EXT"/>
- </require>
- </extension>
- <extension name="VK_EXT_display_control" number="92" type="device" requires="VK_KHR_display,VK_EXT_display_surface_counter,VK_KHR_swapchain" author="NVIDIA" contact="James Jones @cubanismo" supported="vulkan">
- <require>
- <enum value="1" name="VK_EXT_DISPLAY_CONTROL_SPEC_VERSION"/>
- <enum value="&quot;VK_EXT_display_control&quot;" name="VK_EXT_DISPLAY_CONTROL_EXTENSION_NAME"/>
- <enum offset="0" extends="VkStructureType" name="VK_STRUCTURE_TYPE_DISPLAY_POWER_INFO_EXT"/>
- <enum offset="1" extends="VkStructureType" name="VK_STRUCTURE_TYPE_DEVICE_EVENT_INFO_EXT"/>
- <enum offset="2" extends="VkStructureType" name="VK_STRUCTURE_TYPE_DISPLAY_EVENT_INFO_EXT"/>
- <enum offset="3" extends="VkStructureType" name="VK_STRUCTURE_TYPE_SWAPCHAIN_COUNTER_CREATE_INFO_EXT"/>
- <type name="VkDisplayPowerStateEXT"/>
- <type name="VkDeviceEventTypeEXT"/>
- <type name="VkDisplayEventTypeEXT"/>
- <type name="VkDisplayPowerInfoEXT"/>
- <type name="VkDeviceEventInfoEXT"/>
- <type name="VkDisplayEventInfoEXT"/>
- <type name="VkSwapchainCounterCreateInfoEXT"/>
- <command name="vkDisplayPowerControlEXT"/>
- <command name="vkRegisterDeviceEventEXT"/>
- <command name="vkRegisterDisplayEventEXT"/>
- <command name="vkGetSwapchainCounterEXT"/>
- </require>
- </extension>
- <extension name="VK_KHR_extension_93" number="93" author="GOOGLE" contact="Ian Elliott @ianelliott" supported="disabled">
- <require>
- <enum value="0" name="VK_GOOGLE_EXTENSION_93_SPEC_VERSION"/>
- <enum value="&quot;VK_GOOGLE_extension_93&quot;" name="VK_GOOGLE_EXTENSION_93_EXTENSION_NAME"/>
- </require>
- </extension>
- <extension name="VK_KHR_extension_94" number="94" author="Codeplay" contact="Neil Henning @neil_henning" supported="disabled">
- <require>
- <enum value="0" name="VK_KHR_EXTENSION_94_SPEC_VERSION"/>
- <enum value="&quot;VK_KHR_extension_94&quot;" name="VK_KHR_EXTENSION_94_EXTENSION_NAME"/>
- </require>
- </extension>
- <extension name="VK_NV_extension_95" number="95" author="NVIDIA" contact="Daniel Koch @dgkoch" supported="disabled">
- <require>
- <enum value="0" name="VK_NV_EXTENSION_95_SPEC_VERSION"/>
- <enum value="&quot;VK_NV_extension_95&quot;" name="VK_NV_EXTENSION_95_EXTENSION_NAME"/>
- </require>
- </extension>
- <extension name="VK_NV_extension_96" number="96" author="NVIDIA" contact="Daniel Koch @dgkoch" supported="disabled">
- <require>
- <enum value="0" name="VK_NV_EXTENSION_96_SPEC_VERSION"/>
- <enum value="&quot;VK_NV_extension_96&quot;" name="VK_NV_EXTENSION_96_EXTENSION_NAME"/>
- </require>
- </extension>
- <extension name="VK_NV_extension_97" number="97" author="NVIDIA" contact="Daniel Koch @dgkoch" supported="disabled">
- <require>
- <enum value="0" name="VK_NV_EXTENSION_97_SPEC_VERSION"/>
- <enum value="&quot;VK_NV_extension_97&quot;" name="VK_NV_EXTENSION_97_EXTENSION_NAME"/>
- </require>
- </extension>
- <extension name="VK_NV_extension_98" number="98" author="NVIDIA" contact="Daniel Koch @dgkoch" supported="disabled">
- <require>
- <enum value="0" name="VK_NV_EXTENSION_98_SPEC_VERSION"/>
- <enum value="&quot;VK_NV_extension_98&quot;" name="VK_NV_EXTENSION_98_EXTENSION_NAME"/>
- </require>
- </extension>
- <extension name="VK_NV_extension_99" number="99" author="NVIDIA" contact="Daniel Koch @dgkoch" supported="disabled">
- <require>
- <enum value="0" name="VK_NV_EXTENSION_99_SPEC_VERSION"/>
- <enum value="&quot;VK_NV_extension_99&quot;" name="VK_NV_EXTENSION_99_EXTENSION_NAME"/>
- </require>
- </extension>
- <extension name="VK_NV_extension_100" number="100" author="NVIDIA" contact="Daniel Koch @dgkoch" supported="disabled">
- <require>
- <enum value="0" name="VK_NV_EXTENSION_100_SPEC_VERSION"/>
- <enum value="&quot;VK_NV_extension_100&quot;" name="VK_NV_EXTENSION_100_EXTENSION_NAME"/>
- </require>
- </extension>
- <extension name="VK_NV_extension_101" number="101" author="NVIDIA" contact="Daniel Koch @dgkoch" supported="disabled">
- <require>
- <enum value="0" name="VK_NV_EXTENSION_101_SPEC_VERSION"/>
- <enum value="&quot;VK_NV_extension_101&quot;" name="VK_NV_EXTENSION_101_EXTENSION_NAME"/>
- </require>
- </extension>
- <extension name="VK_NV_extension_102" number="102" author="NVIDIA" contact="Daniel Koch @dgkoch" supported="disabled">
- <require>
- <enum value="0" name="VK_NV_EXTENSION_102_SPEC_VERSION"/>
- <enum value="&quot;VK_NV_extension_102&quot;" name="VK_NV_EXTENSION_102_EXTENSION_NAME"/>
- </require>
- </extension>
- <extension name="VK_NV_extension_103" number="103" author="NVIDIA" contact="Daniel Koch @dgkoch" supported="disabled">
- <require>
- <enum value="0" name="VK_NV_EXTENSION_103_SPEC_VERSION"/>
- <enum value="&quot;VK_NV_extension_103&quot;" name="VK_NV_EXTENSION_103_EXTENSION_NAME"/>
- </require>
- </extension>
- <extension name="VK_NV_extension_104" number="104" author="NVIDIA" contact="Mathias Schott @mschott" supported="disabled">
- <require>
- <enum value="0" name="VK_NV_EXTENSION_104_SPEC_VERSION"/>
- <enum value="&quot;VK_NV_extension_104&quot;" name="VK_NV_EXTENSION_104_EXTENSION_NAME"/>
- </require>
- </extension>
- <extension name="VK_EXT_swapchain_colorspace" number="105" author="GOOGLE" contact="Courtney Goeltzenleuchter @courtneygo" requires="VK_KHR_surface" supported="vulkan">
- <require>
- <enum value="1" name="VK_SWAPCHAIN_COLOR_SPACE_SPEC_VERSION"/>
- <enum value="&quot;VK_EXT_swapchain_colorspace&quot;" name="VK_SWAPCHAIN_COLOR_SPACE_EXTENSION_NAME"/>
- <enum offset="1" extends="VkColorSpaceKHR" name="VK_COLOR_SPACE_DISPLAY_P3_LINEAR_EXT"/>
- <enum offset="2" extends="VkColorSpaceKHR" name="VK_COLOR_SPACE_DISPLAY_P3_NONLINEAR_EXT"/>
- <enum offset="3" extends="VkColorSpaceKHR" name="VK_COLOR_SPACE_SCRGB_LINEAR_EXT"/>
- <enum offset="4" extends="VkColorSpaceKHR" name="VK_COLOR_SPACE_SCRGB_NONLINEAR_EXT"/>
- <enum offset="5" extends="VkColorSpaceKHR" name="VK_COLOR_SPACE_DCI_P3_LINEAR_EXT"/>
- <enum offset="6" extends="VkColorSpaceKHR" name="VK_COLOR_SPACE_DCI_P3_NONLINEAR_EXT"/>
- <enum offset="7" extends="VkColorSpaceKHR" name="VK_COLOR_SPACE_BT709_LINEAR_EXT"/>
- <enum offset="8" extends="VkColorSpaceKHR" name="VK_COLOR_SPACE_BT709_NONLINEAR_EXT"/>
- <enum offset="9" extends="VkColorSpaceKHR" name="VK_COLOR_SPACE_BT2020_LINEAR_EXT"/>
- <enum offset="10" extends="VkColorSpaceKHR" name="VK_COLOR_SPACE_BT2020_NONLINEAR_EXT"/>
- <enum offset="11" extends="VkColorSpaceKHR" name="VK_COLOR_SPACE_ADOBERGB_LINEAR_EXT"/>
- <enum offset="12" extends="VkColorSpaceKHR" name="VK_COLOR_SPACE_ADOBERGB_NONLINEAR_EXT"/>
- </require>
- </extension>
- <extension name="VK_EXT_extension_106" number="106" author="GOOGLE" contact="Courtney Goeltzenleuchter @courtneygo" supported="disabled">
- <require>
- <enum value="0" name="VK_KHR_EXTENSION_106_SPEC_VERSION"/>
- <enum value="&quot;VK_EXT_extension_106&quot;" name="VK_KHR_EXTENSION_106_EXTENSION_NAME"/>
- </require>
- </extension>
- <extension name="VK_IMG_extension_107" number="107" author="IMG" contact="Michael Worcester @michaelworcester" supported="disabled">
- <require>
- <enum value="0" name="VK_IMG_EXTENSION_107_SPEC_VERSION"/>
- <enum value="&quot;VK_IMG_extension_107&quot;" name="VK_IMG_EXTENSION_107_EXTENSION_NAME"/>
- </require>
- </extension>
- <extension name="VK_IMG_extension_108" number="108" author="IMG" contact="Michael Worcester @michaelworcester" supported="disabled">
- <require>
- <enum value="0" name="VK_IMG_EXTENSION_108_SPEC_VERSION"/>
- <enum value="&quot;VK_IMG_extension_108&quot;" name="VK_IMG_EXTENSION_108_EXTENSION_NAME"/>
- </require>
- </extension>
- <extension name="VK_IMG_extension_109" number="109" author="IMG" contact="Michael Worcester @michaelworcester" supported="disabled">
- <require>
- <enum value="0" name="VK_IMG_EXTENSION_109_SPEC_VERSION"/>
- <enum value="&quot;VK_IMG_extension_109&quot;" name="VK_IMG_EXTENSION_109_EXTENSION_NAME"/>
- </require>
- </extension>
- <extension name="VK_IMG_extension_110" number="110" author="IMG" contact="Michael Worcester @michaelworcester" supported="disabled">
- <require>
- <enum value="0" name="VK_IMG_EXTENSION_110_SPEC_VERSION"/>
- <enum value="&quot;VK_IMG_extension_110&quot;" name="VK_IMG_EXTENSION_110_EXTENSION_NAME"/>
- </require>
- </extension>
- <extension name="VK_IMG_extension_111" number="111" author="IMG" contact="Michael Worcester @michaelworcester" supported="disabled">
- <require>
- <enum value="0" name="VK_IMG_EXTENSION_111_SPEC_VERSION"/>
- <enum value="&quot;VK_IMG_extension_111&quot;" name="VK_IMG_EXTENSION_111_EXTENSION_NAME"/>
- </require>
- </extension>
- <extension name="VK_KHR_extension_112" number="112" author="KHR" contact="Alon Or-bach @alonorbach" supported="disabled">
- <require>
- <enum value="0" name="VK_KHR_EXTENSION_112_SPEC_VERSION"/>
- <enum value="&quot;VK_KHR_extension_112&quot;" name="VK_KHR_EXTENSION_112_EXTENSION_NAME"/>
- </require>
- </extension>
- <extension name="VK_KHR_extension_113" number="113" author="KHX" contact="Cass Everitt @casseveritt" supported="disabled">
- <require>
- <enum value="0" name="VK_KHR_EXTENSION_113_SPEC_VERSION"/>
- <enum value="&quot;VK_KHR_extension_113&quot;" name="VK_KHR_EXTENSION_113_EXTENSION_NAME"/>
- </require>
- </extension>
- <extension name="VK_KHR_extension_114" number="114" author="KHX" contact="Cass Everitt @casseveritt" supported="disabled">
- <require>
- <enum value="0" name="VK_KHR_EXTENSION_114_SPEC_VERSION"/>
- <enum value="&quot;VK_KHR_extension_114&quot;" name="VK_KHR_EXTENSION_114_EXTENSION_NAME"/>
- </require>
- </extension>
- <extension name="VK_KHR_extension_115" number="115" author="KHX" contact="Cass Everitt @casseveritt" supported="disabled">
- <require>
- <enum value="0" name="VK_KHR_EXTENSION_115_SPEC_VERSION"/>
- <enum value="&quot;VK_KHR_extension_115&quot;" name="VK_KHR_EXTENSION_115_EXTENSION_NAME"/>
- </require>
- </extension>
- <extension name="VK_KHR_extension_116" number="116" author="KHX" contact="Cass Everitt @casseveritt" supported="disabled">
- <require>
- <enum value="0" name="VK_KHR_EXTENSION_116_SPEC_VERSION"/>
- <enum value="&quot;VK_KHR_extension_116&quot;" name="VK_KHR_EXTENSION_116_EXTENSION_NAME"/>
- </require>
- </extension>
- <extension name="VK_KHR_extension_117" number="117" author="KHR" contact="Kenneth Benzie @kbenzie" supported="disabled">
+ <extension name="VK_KHR_shader_float16_int8" number="83" type="device" requires="VK_KHR_get_physical_device_properties2" author="KHR" contact="Alexander Galazin @alegal-arm" supported="vulkan" promotedto="VK_VERSION_1_2">
+ <require>
+ <enum value="1" name="VK_KHR_SHADER_FLOAT16_INT8_SPEC_VERSION"/>
+ <enum value="&quot;VK_KHR_shader_float16_int8&quot;" name="VK_KHR_SHADER_FLOAT16_INT8_EXTENSION_NAME"/>
+ <enum extends="VkStructureType" name="VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_SHADER_FLOAT16_INT8_FEATURES_KHR" alias="VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_SHADER_FLOAT16_INT8_FEATURES"/>
+ <enum extends="VkStructureType" name="VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_FLOAT16_INT8_FEATURES_KHR" alias="VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_SHADER_FLOAT16_INT8_FEATURES"/>
+ <type name="VkPhysicalDeviceShaderFloat16Int8FeaturesKHR"/>
+ <type name="VkPhysicalDeviceFloat16Int8FeaturesKHR"/>
+ </require>
+ </extension>
+ <extension name="VK_KHR_16bit_storage" number="84" type="device" requires="VK_KHR_get_physical_device_properties2,VK_KHR_storage_buffer_storage_class" author="KHR" contact="Jan-Harald Fredriksen @janharaldfredriksen-arm" supported="vulkan" promotedto="VK_VERSION_1_1">
+ <require>
+ <enum value="1" name="VK_KHR_16BIT_STORAGE_SPEC_VERSION"/>
+ <enum value="&quot;VK_KHR_16bit_storage&quot;" name="VK_KHR_16BIT_STORAGE_EXTENSION_NAME"/>
+ <enum extends="VkStructureType" name="VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_16BIT_STORAGE_FEATURES_KHR" alias="VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_16BIT_STORAGE_FEATURES"/>
+ <type name="VkPhysicalDevice16BitStorageFeaturesKHR"/>
+ </require>
+ </extension>
+ <extension name="VK_KHR_incremental_present" number="85" type="device" author="KHR" requires="VK_KHR_swapchain" contact="Ian Elliott @ianelliottus" supported="vulkan">
+ <require>
+ <enum value="2" name="VK_KHR_INCREMENTAL_PRESENT_SPEC_VERSION"/>
+ <enum value="&quot;VK_KHR_incremental_present&quot;" name="VK_KHR_INCREMENTAL_PRESENT_EXTENSION_NAME"/>
+ <enum offset="0" extends="VkStructureType" name="VK_STRUCTURE_TYPE_PRESENT_REGIONS_KHR"/>
+ <type name="VkPresentRegionsKHR"/>
+ <type name="VkPresentRegionKHR"/>
+ <type name="VkRectLayerKHR"/>
+ </require>
+ </extension>
+ <extension name="VK_KHR_descriptor_update_template" number="86" type="device" author="KHR" contact="Markus Tavenrath @mtavenrath" supported="vulkan" promotedto="VK_VERSION_1_1">
+ <require>
+ <enum value="1" name="VK_KHR_DESCRIPTOR_UPDATE_TEMPLATE_SPEC_VERSION"/>
+ <enum value="&quot;VK_KHR_descriptor_update_template&quot;" name="VK_KHR_DESCRIPTOR_UPDATE_TEMPLATE_EXTENSION_NAME"/>
+ <enum extends="VkStructureType" name="VK_STRUCTURE_TYPE_DESCRIPTOR_UPDATE_TEMPLATE_CREATE_INFO_KHR" alias="VK_STRUCTURE_TYPE_DESCRIPTOR_UPDATE_TEMPLATE_CREATE_INFO"/>
+ <enum extends="VkObjectType" name="VK_OBJECT_TYPE_DESCRIPTOR_UPDATE_TEMPLATE_KHR" alias="VK_OBJECT_TYPE_DESCRIPTOR_UPDATE_TEMPLATE"/>
+ <command name="vkCreateDescriptorUpdateTemplateKHR"/>
+ <command name="vkDestroyDescriptorUpdateTemplateKHR"/>
+ <command name="vkUpdateDescriptorSetWithTemplateKHR"/>
+ <type name="VkDescriptorUpdateTemplateKHR"/>
+ <type name="VkDescriptorUpdateTemplateCreateFlagsKHR"/>
+ <type name="VkDescriptorUpdateTemplateTypeKHR"/>
+ <type name="VkDescriptorUpdateTemplateEntryKHR"/>
+ <type name="VkDescriptorUpdateTemplateCreateInfoKHR"/>
+ <enum extends="VkDescriptorUpdateTemplateType" name="VK_DESCRIPTOR_UPDATE_TEMPLATE_TYPE_DESCRIPTOR_SET_KHR" alias="VK_DESCRIPTOR_UPDATE_TEMPLATE_TYPE_DESCRIPTOR_SET"/>
+ </require>
+ <require extension="VK_KHR_push_descriptor">
+ <command name="vkCmdPushDescriptorSetWithTemplateKHR"/>
+ <enum value="1" extends="VkDescriptorUpdateTemplateType" name="VK_DESCRIPTOR_UPDATE_TEMPLATE_TYPE_PUSH_DESCRIPTORS_KHR" comment="Create descriptor update template for pushed descriptor updates"/>
+ </require>
+ <require extension="VK_EXT_debug_report">
+ <enum extends="VkDebugReportObjectTypeEXT" name="VK_DEBUG_REPORT_OBJECT_TYPE_DESCRIPTOR_UPDATE_TEMPLATE_KHR_EXT" alias="VK_DEBUG_REPORT_OBJECT_TYPE_DESCRIPTOR_UPDATE_TEMPLATE_EXT"/>
+ </require>
+ </extension>
+ <extension name="VK_NVX_device_generated_commands" number="87" type="device" author="NVX" contact="Christoph Kubisch @pixeljetstream" supported="disabled">
+ <require>
+ <enum value="3" name="VK_NVX_DEVICE_GENERATED_COMMANDS_SPEC_VERSION"/>
+ <enum value="&quot;VK_NVX_device_generated_commands&quot;" name="VK_NVX_DEVICE_GENERATED_COMMANDS_EXTENSION_NAME"/>
+ </require>
+ </extension>
+ <extension name="VK_NV_clip_space_w_scaling" number="88" type="device" author="NV" contact="Eric Werness @ewerness-nv" supported="vulkan">
+ <require>
+ <enum value="1" name="VK_NV_CLIP_SPACE_W_SCALING_SPEC_VERSION"/>
+ <enum value="&quot;VK_NV_clip_space_w_scaling&quot;" name="VK_NV_CLIP_SPACE_W_SCALING_EXTENSION_NAME"/>
+ <enum offset="0" extends="VkStructureType" name="VK_STRUCTURE_TYPE_PIPELINE_VIEWPORT_W_SCALING_STATE_CREATE_INFO_NV"/>
+ <enum offset="0" extends="VkDynamicState" name="VK_DYNAMIC_STATE_VIEWPORT_W_SCALING_NV"/>
+ <type name="VkViewportWScalingNV"/>
+ <type name="VkPipelineViewportWScalingStateCreateInfoNV"/>
+ <command name="vkCmdSetViewportWScalingNV"/>
+ </require>
+ </extension>
+ <extension name="VK_EXT_direct_mode_display" number="89" type="instance" requires="VK_KHR_display" author="NV" contact="James Jones @cubanismo" supported="vulkan">
+ <require>
+ <enum value="1" name="VK_EXT_DIRECT_MODE_DISPLAY_SPEC_VERSION"/>
+ <enum value="&quot;VK_EXT_direct_mode_display&quot;" name="VK_EXT_DIRECT_MODE_DISPLAY_EXTENSION_NAME"/>
+ <command name="vkReleaseDisplayEXT"/>
+ </require>
+ </extension>
+ <extension name="VK_EXT_acquire_xlib_display" number="90" type="instance" requires="VK_EXT_direct_mode_display" author="NV" contact="James Jones @cubanismo" platform="xlib_xrandr" supported="vulkan">
+ <require>
+ <enum value="1" name="VK_EXT_ACQUIRE_XLIB_DISPLAY_SPEC_VERSION"/>
+ <enum value="&quot;VK_EXT_acquire_xlib_display&quot;" name="VK_EXT_ACQUIRE_XLIB_DISPLAY_EXTENSION_NAME"/>
+ <command name="vkAcquireXlibDisplayEXT"/>
+ <command name="vkGetRandROutputDisplayEXT"/>
+ </require>
+ </extension>
+ <extension name="VK_EXT_display_surface_counter" number="91" type="instance" requires="VK_KHR_display" author="NV" contact="James Jones @cubanismo" supported="vulkan">
+ <require>
+ <enum value="1" name="VK_EXT_DISPLAY_SURFACE_COUNTER_SPEC_VERSION"/>
+ <enum value="&quot;VK_EXT_display_surface_counter&quot;" name="VK_EXT_DISPLAY_SURFACE_COUNTER_EXTENSION_NAME"/>
+ <enum offset="0" extends="VkStructureType" name="VK_STRUCTURE_TYPE_SURFACE_CAPABILITIES_2_EXT"/>
+ <enum alias="VK_STRUCTURE_TYPE_SURFACE_CAPABILITIES_2_EXT" extends="VkStructureType" name="VK_STRUCTURE_TYPE_SURFACE_CAPABILITIES2_EXT" comment="Backwards-compatible alias containing a typo"/>
+ <type name="VkSurfaceCounterFlagsEXT"/>
+ <type name="VkSurfaceCounterFlagBitsEXT"/>
+ <type name="VkSurfaceCapabilities2EXT"/>
+ <command name="vkGetPhysicalDeviceSurfaceCapabilities2EXT"/>
+ </require>
+ </extension>
+ <extension name="VK_EXT_display_control" number="92" type="device" requires="VK_EXT_display_surface_counter,VK_KHR_swapchain" author="NV" contact="James Jones @cubanismo" supported="vulkan">
+ <require>
+ <enum value="1" name="VK_EXT_DISPLAY_CONTROL_SPEC_VERSION"/>
+ <enum value="&quot;VK_EXT_display_control&quot;" name="VK_EXT_DISPLAY_CONTROL_EXTENSION_NAME"/>
+ <enum offset="0" extends="VkStructureType" name="VK_STRUCTURE_TYPE_DISPLAY_POWER_INFO_EXT"/>
+ <enum offset="1" extends="VkStructureType" name="VK_STRUCTURE_TYPE_DEVICE_EVENT_INFO_EXT"/>
+ <enum offset="2" extends="VkStructureType" name="VK_STRUCTURE_TYPE_DISPLAY_EVENT_INFO_EXT"/>
+ <enum offset="3" extends="VkStructureType" name="VK_STRUCTURE_TYPE_SWAPCHAIN_COUNTER_CREATE_INFO_EXT"/>
+ <type name="VkDisplayPowerStateEXT"/>
+ <type name="VkDeviceEventTypeEXT"/>
+ <type name="VkDisplayEventTypeEXT"/>
+ <type name="VkDisplayPowerInfoEXT"/>
+ <type name="VkDeviceEventInfoEXT"/>
+ <type name="VkDisplayEventInfoEXT"/>
+ <type name="VkSwapchainCounterCreateInfoEXT"/>
+ <command name="vkDisplayPowerControlEXT"/>
+ <command name="vkRegisterDeviceEventEXT"/>
+ <command name="vkRegisterDisplayEventEXT"/>
+ <command name="vkGetSwapchainCounterEXT"/>
+ </require>
+ </extension>
+ <extension name="VK_GOOGLE_display_timing" number="93" type="device" author="GOOGLE" requires="VK_KHR_swapchain" contact="Ian Elliott @ianelliottus" supported="vulkan">
+ <require>
+ <enum value="1" name="VK_GOOGLE_DISPLAY_TIMING_SPEC_VERSION"/>
+ <enum value="&quot;VK_GOOGLE_display_timing&quot;" name="VK_GOOGLE_DISPLAY_TIMING_EXTENSION_NAME"/>
+ <enum offset="0" extends="VkStructureType" name="VK_STRUCTURE_TYPE_PRESENT_TIMES_INFO_GOOGLE"/>
+ <type name="VkRefreshCycleDurationGOOGLE"/>
+ <type name="VkPastPresentationTimingGOOGLE"/>
+ <type name="VkPresentTimesInfoGOOGLE"/>
+ <type name="VkPresentTimeGOOGLE"/>
+ <command name="vkGetRefreshCycleDurationGOOGLE"/>
+ <command name="vkGetPastPresentationTimingGOOGLE"/>
+ </require>
+ </extension>
+ <extension name="VK_RESERVED_do_not_use_94" number="94" supported="disabled" comment="Used for functionality subsumed into Vulkan 1.1 and not published as an extension">
+ <require>
+ <enum value="1" name="VK_RESERVED_DO_NOT_USE_94_SPEC_VERSION"/>
+ <enum value="&quot;VK_RESERVED_do_not_use_94&quot;" name="VK_RESERVED_DO_NOT_USE_94_EXTENSION_NAME"/>
+ </require>
+ </extension>
+ <extension name="VK_NV_sample_mask_override_coverage" number="95" type="device" author="NV" contact="Piers Daniell @pdaniell-nv" supported="vulkan">
+ <require>
+ <enum value="1" name="VK_NV_SAMPLE_MASK_OVERRIDE_COVERAGE_SPEC_VERSION"/>
+ <enum value="&quot;VK_NV_sample_mask_override_coverage&quot;" name="VK_NV_SAMPLE_MASK_OVERRIDE_COVERAGE_EXTENSION_NAME"/>
+ <comment>
+ enum offset=0 was mistakenly used for the 1.1 core enum
+ VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_SUBGROUP_PROPERTIES
+ (value=1000094000). Fortunately, no conflict resulted.
+ </comment>
+ </require>
+ </extension>
+ <extension name="VK_NV_geometry_shader_passthrough" number="96" type="device" author="NV" contact="Daniel Koch @dgkoch" supported="vulkan">
+ <require>
+ <enum value="1" name="VK_NV_GEOMETRY_SHADER_PASSTHROUGH_SPEC_VERSION"/>
+ <enum value="&quot;VK_NV_geometry_shader_passthrough&quot;" name="VK_NV_GEOMETRY_SHADER_PASSTHROUGH_EXTENSION_NAME"/>
+ </require>
+ </extension>
+ <extension name="VK_NV_viewport_array2" number="97" type="device" author="NV" contact="Daniel Koch @dgkoch" supported="vulkan">
+ <require>
+ <enum value="1" name="VK_NV_VIEWPORT_ARRAY_2_SPEC_VERSION"/>
+ <enum value="&quot;VK_NV_viewport_array2&quot;" name="VK_NV_VIEWPORT_ARRAY_2_EXTENSION_NAME"/>
+ <enum alias="VK_NV_VIEWPORT_ARRAY_2_SPEC_VERSION" name="VK_NV_VIEWPORT_ARRAY2_SPEC_VERSION" comment="Backwards-compatible alias containing a typo"/>
+ <enum alias="VK_NV_VIEWPORT_ARRAY_2_EXTENSION_NAME" name="VK_NV_VIEWPORT_ARRAY2_EXTENSION_NAME" comment="Backwards-compatible alias containing a typo"/>
+ </require>
+ </extension>
+ <extension name="VK_NVX_multiview_per_view_attributes" number="98" type="device" requires="VK_KHR_multiview" author="NVX" contact="Jeff Bolz @jeffbolznv" supported="vulkan">
+ <require>
+ <enum value="1" name="VK_NVX_MULTIVIEW_PER_VIEW_ATTRIBUTES_SPEC_VERSION"/>
+ <enum value="&quot;VK_NVX_multiview_per_view_attributes&quot;" name="VK_NVX_MULTIVIEW_PER_VIEW_ATTRIBUTES_EXTENSION_NAME"/>
+ <enum offset="0" extends="VkStructureType" name="VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_MULTIVIEW_PER_VIEW_ATTRIBUTES_PROPERTIES_NVX"/>
+ <enum bitpos="0" extends="VkSubpassDescriptionFlagBits" name="VK_SUBPASS_DESCRIPTION_PER_VIEW_ATTRIBUTES_BIT_NVX"/>
+ <enum bitpos="1" extends="VkSubpassDescriptionFlagBits" name="VK_SUBPASS_DESCRIPTION_PER_VIEW_POSITION_X_ONLY_BIT_NVX"/>
+ <type name="VkPhysicalDeviceMultiviewPerViewAttributesPropertiesNVX"/>
+ </require>
+ </extension>
+ <extension name="VK_NV_viewport_swizzle" number="99" type="device" author="NV" contact="Piers Daniell @pdaniell-nv" supported="vulkan">
+ <require>
+ <enum value="1" name="VK_NV_VIEWPORT_SWIZZLE_SPEC_VERSION"/>
+ <enum value="&quot;VK_NV_viewport_swizzle&quot;" name="VK_NV_VIEWPORT_SWIZZLE_EXTENSION_NAME"/>
+ <enum offset="0" extends="VkStructureType" name="VK_STRUCTURE_TYPE_PIPELINE_VIEWPORT_SWIZZLE_STATE_CREATE_INFO_NV"/>
+ <type name="VkViewportSwizzleNV"/>
+ <type name="VkViewportCoordinateSwizzleNV"/>
+ <type name="VkPipelineViewportSwizzleStateCreateInfoNV"/>
+ <type name="VkPipelineViewportSwizzleStateCreateFlagsNV"/>
+ </require>
+ </extension>
+ <extension name="VK_EXT_discard_rectangles" number="100" type="device" requires="VK_KHR_get_physical_device_properties2" author="NV" contact="Piers Daniell @pdaniell-nv" supported="vulkan">
+ <require>
+ <enum value="1" name="VK_EXT_DISCARD_RECTANGLES_SPEC_VERSION"/>
+ <enum value="&quot;VK_EXT_discard_rectangles&quot;" name="VK_EXT_DISCARD_RECTANGLES_EXTENSION_NAME"/>
+ <enum offset="0" extends="VkStructureType" name="VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_DISCARD_RECTANGLE_PROPERTIES_EXT"/>
+ <enum offset="1" extends="VkStructureType" name="VK_STRUCTURE_TYPE_PIPELINE_DISCARD_RECTANGLE_STATE_CREATE_INFO_EXT"/>
+ <enum offset="0" extends="VkDynamicState" name="VK_DYNAMIC_STATE_DISCARD_RECTANGLE_EXT"/>
+ <type name="VkPhysicalDeviceDiscardRectanglePropertiesEXT"/>
+ <type name="VkPipelineDiscardRectangleStateCreateInfoEXT"/>
+ <type name="VkPipelineDiscardRectangleStateCreateFlagsEXT"/>
+ <type name="VkDiscardRectangleModeEXT"/>
+ <command name="vkCmdSetDiscardRectangleEXT"/>
+ </require>
+ </extension>
+ <extension name="VK_NV_extension_101" number="101" author="NV" contact="Daniel Koch @dgkoch" supported="disabled">
+ <require>
+ <enum value="0" name="VK_NV_EXTENSION_101_SPEC_VERSION"/>
+ <enum value="&quot;VK_NV_extension_101&quot;" name="VK_NV_EXTENSION_101_EXTENSION_NAME"/>
+ </require>
+ </extension>
+ <extension name="VK_EXT_conservative_rasterization" number="102" type="device" requires="VK_KHR_get_physical_device_properties2" author="NV" contact="Piers Daniell @pdaniell-nv" supported="vulkan">
+ <require>
+ <enum value="1" name="VK_EXT_CONSERVATIVE_RASTERIZATION_SPEC_VERSION"/>
+ <enum value="&quot;VK_EXT_conservative_rasterization&quot;" name="VK_EXT_CONSERVATIVE_RASTERIZATION_EXTENSION_NAME"/>
+ <enum offset="0" extends="VkStructureType" name="VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_CONSERVATIVE_RASTERIZATION_PROPERTIES_EXT"/>
+ <enum offset="1" extends="VkStructureType" name="VK_STRUCTURE_TYPE_PIPELINE_RASTERIZATION_CONSERVATIVE_STATE_CREATE_INFO_EXT"/>
+ <type name="VkPhysicalDeviceConservativeRasterizationPropertiesEXT"/>
+ <type name="VkPipelineRasterizationConservativeStateCreateInfoEXT"/>
+ <type name="VkPipelineRasterizationConservativeStateCreateFlagsEXT"/>
+ <type name="VkConservativeRasterizationModeEXT"/>
+ </require>
+ </extension>
+ <extension name="VK_EXT_depth_clip_enable" number="103" type="device" author="EXT" contact="Piers Daniell @pdaniell-nv" specialuse="d3demulation" supported="vulkan">
+ <require>
+ <enum value="1" name="VK_EXT_DEPTH_CLIP_ENABLE_SPEC_VERSION"/>
+ <enum value="&quot;VK_EXT_depth_clip_enable&quot;" name="VK_EXT_DEPTH_CLIP_ENABLE_EXTENSION_NAME"/>
+ <enum offset="0" extends="VkStructureType" name="VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_DEPTH_CLIP_ENABLE_FEATURES_EXT"/>
+ <enum offset="1" extends="VkStructureType" name="VK_STRUCTURE_TYPE_PIPELINE_RASTERIZATION_DEPTH_CLIP_STATE_CREATE_INFO_EXT"/>
+ <type name="VkPhysicalDeviceDepthClipEnableFeaturesEXT"/>
+ <type name="VkPipelineRasterizationDepthClipStateCreateInfoEXT"/>
+ <type name="VkPipelineRasterizationDepthClipStateCreateFlagsEXT"/>
+ </require>
+ </extension>
+ <extension name="VK_NV_extension_104" number="104" author="NV" contact="Mathias Schott gitlab:@mschott" supported="disabled">
+ <require>
+ <enum value="0" name="VK_NV_EXTENSION_104_SPEC_VERSION"/>
+ <enum value="&quot;VK_NV_extension_104&quot;" name="VK_NV_EXTENSION_104_EXTENSION_NAME"/>
+ </require>
+ </extension>
+ <extension name="VK_EXT_swapchain_colorspace" number="105" type="instance" author="GOOGLE" contact="Courtney Goeltzenleuchter @courtney-g" requires="VK_KHR_surface" supported="vulkan">
+ <require>
+ <enum value="4" name="VK_EXT_SWAPCHAIN_COLOR_SPACE_SPEC_VERSION"/>
+ <enum value="&quot;VK_EXT_swapchain_colorspace&quot;" name="VK_EXT_SWAPCHAIN_COLOR_SPACE_EXTENSION_NAME"/>
+ <enum offset="1" extends="VkColorSpaceKHR" name="VK_COLOR_SPACE_DISPLAY_P3_NONLINEAR_EXT"/>
+ <enum offset="2" extends="VkColorSpaceKHR" name="VK_COLOR_SPACE_EXTENDED_SRGB_LINEAR_EXT"/>
+ <enum offset="3" extends="VkColorSpaceKHR" name="VK_COLOR_SPACE_DISPLAY_P3_LINEAR_EXT"/>
+ <enum offset="4" extends="VkColorSpaceKHR" name="VK_COLOR_SPACE_DCI_P3_NONLINEAR_EXT"/>
+ <enum offset="5" extends="VkColorSpaceKHR" name="VK_COLOR_SPACE_BT709_LINEAR_EXT"/>
+ <enum offset="6" extends="VkColorSpaceKHR" name="VK_COLOR_SPACE_BT709_NONLINEAR_EXT"/>
+ <enum offset="7" extends="VkColorSpaceKHR" name="VK_COLOR_SPACE_BT2020_LINEAR_EXT"/>
+ <enum offset="8" extends="VkColorSpaceKHR" name="VK_COLOR_SPACE_HDR10_ST2084_EXT"/>
+ <enum offset="9" extends="VkColorSpaceKHR" name="VK_COLOR_SPACE_DOLBYVISION_EXT"/>
+ <enum offset="10" extends="VkColorSpaceKHR" name="VK_COLOR_SPACE_HDR10_HLG_EXT"/>
+ <enum offset="11" extends="VkColorSpaceKHR" name="VK_COLOR_SPACE_ADOBERGB_LINEAR_EXT"/>
+ <enum offset="12" extends="VkColorSpaceKHR" name="VK_COLOR_SPACE_ADOBERGB_NONLINEAR_EXT"/>
+ <enum offset="13" extends="VkColorSpaceKHR" name="VK_COLOR_SPACE_PASS_THROUGH_EXT"/>
+ <enum offset="14" extends="VkColorSpaceKHR" name="VK_COLOR_SPACE_EXTENDED_SRGB_NONLINEAR_EXT"/>
+ <enum extends="VkColorSpaceKHR" name="VK_COLOR_SPACE_DCI_P3_LINEAR_EXT" alias="VK_COLOR_SPACE_DISPLAY_P3_LINEAR_EXT" comment="Backwards-compatible alias containing a typo"/>
+ </require>
+ </extension>
+ <extension name="VK_EXT_hdr_metadata" number="106" type="device" requires="VK_KHR_swapchain" author="GOOGLE" contact="Courtney Goeltzenleuchter @courtney-g" supported="vulkan">
+ <require>
+ <enum value="2" name="VK_EXT_HDR_METADATA_SPEC_VERSION"/>
+ <enum value="&quot;VK_EXT_hdr_metadata&quot;" name="VK_EXT_HDR_METADATA_EXTENSION_NAME"/>
+ <enum offset="0" extends="VkStructureType" name="VK_STRUCTURE_TYPE_HDR_METADATA_EXT"/>
+ <type name="VkHdrMetadataEXT"/>
+ <type name="VkXYColorEXT"/>
+ <command name="vkSetHdrMetadataEXT"/>
+ </require>
+ </extension>
+ <extension name="VK_IMG_extension_107" number="107" author="IMG" contact="Michael Worcester @michaelworcester" supported="disabled">
+ <require>
+ <enum value="0" name="VK_IMG_EXTENSION_107_SPEC_VERSION"/>
+ <enum value="&quot;VK_IMG_extension_107&quot;" name="VK_IMG_EXTENSION_107_EXTENSION_NAME"/>
+ </require>
+ </extension>
+ <extension name="VK_IMG_extension_108" number="108" author="IMG" contact="Michael Worcester @michaelworcester" supported="disabled">
+ <require>
+ <enum value="0" name="VK_IMG_EXTENSION_108_SPEC_VERSION"/>
+ <enum value="&quot;VK_IMG_extension_108&quot;" name="VK_IMG_EXTENSION_108_EXTENSION_NAME"/>
+ </require>
+ </extension>
+ <extension name="VK_KHR_imageless_framebuffer" requires="VK_KHR_maintenance2,VK_KHR_image_format_list" number="109" author="KHR" contact="Tobias Hector @tobias" type="device" supported="vulkan" promotedto="VK_VERSION_1_2">
+ <require>
+ <enum value="1" name="VK_KHR_IMAGELESS_FRAMEBUFFER_SPEC_VERSION"/>
+ <enum value="&quot;VK_KHR_imageless_framebuffer&quot;" name="VK_KHR_IMAGELESS_FRAMEBUFFER_EXTENSION_NAME"/>
+ <type name="VkPhysicalDeviceImagelessFramebufferFeaturesKHR"/>
+ <type name="VkFramebufferAttachmentsCreateInfoKHR"/>
+ <type name="VkFramebufferAttachmentImageInfoKHR"/>
+ <type name="VkRenderPassAttachmentBeginInfoKHR"/>
+ <enum extends="VkStructureType" name="VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_IMAGELESS_FRAMEBUFFER_FEATURES_KHR" alias="VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_IMAGELESS_FRAMEBUFFER_FEATURES"/>
+ <enum extends="VkStructureType" name="VK_STRUCTURE_TYPE_FRAMEBUFFER_ATTACHMENTS_CREATE_INFO_KHR" alias="VK_STRUCTURE_TYPE_FRAMEBUFFER_ATTACHMENTS_CREATE_INFO"/>
+ <enum extends="VkStructureType" name="VK_STRUCTURE_TYPE_FRAMEBUFFER_ATTACHMENT_IMAGE_INFO_KHR" alias="VK_STRUCTURE_TYPE_FRAMEBUFFER_ATTACHMENT_IMAGE_INFO"/>
+ <enum extends="VkStructureType" name="VK_STRUCTURE_TYPE_RENDER_PASS_ATTACHMENT_BEGIN_INFO_KHR" alias="VK_STRUCTURE_TYPE_RENDER_PASS_ATTACHMENT_BEGIN_INFO"/>
+ <enum extends="VkFramebufferCreateFlagBits" name="VK_FRAMEBUFFER_CREATE_IMAGELESS_BIT_KHR" alias="VK_FRAMEBUFFER_CREATE_IMAGELESS_BIT"/>
+ </require>
+ </extension>
+ <extension name="VK_KHR_create_renderpass2" requires="VK_KHR_multiview,VK_KHR_maintenance2" number="110" author="KHR" contact="Tobias Hector @tobias" type="device" supported="vulkan" promotedto="VK_VERSION_1_2">
+ <require>
+ <enum value="1" name="VK_KHR_CREATE_RENDERPASS_2_SPEC_VERSION"/>
+ <enum value="&quot;VK_KHR_create_renderpass2&quot;" name="VK_KHR_CREATE_RENDERPASS_2_EXTENSION_NAME"/>
+ <enum extends="VkStructureType" name="VK_STRUCTURE_TYPE_ATTACHMENT_DESCRIPTION_2_KHR" alias="VK_STRUCTURE_TYPE_ATTACHMENT_DESCRIPTION_2"/>
+ <enum extends="VkStructureType" name="VK_STRUCTURE_TYPE_ATTACHMENT_REFERENCE_2_KHR" alias="VK_STRUCTURE_TYPE_ATTACHMENT_REFERENCE_2"/>
+ <enum extends="VkStructureType" name="VK_STRUCTURE_TYPE_SUBPASS_DESCRIPTION_2_KHR" alias="VK_STRUCTURE_TYPE_SUBPASS_DESCRIPTION_2"/>
+ <enum extends="VkStructureType" name="VK_STRUCTURE_TYPE_SUBPASS_DEPENDENCY_2_KHR" alias="VK_STRUCTURE_TYPE_SUBPASS_DEPENDENCY_2"/>
+ <enum extends="VkStructureType" name="VK_STRUCTURE_TYPE_RENDER_PASS_CREATE_INFO_2_KHR" alias="VK_STRUCTURE_TYPE_RENDER_PASS_CREATE_INFO_2"/>
+ <enum extends="VkStructureType" name="VK_STRUCTURE_TYPE_SUBPASS_BEGIN_INFO_KHR" alias="VK_STRUCTURE_TYPE_SUBPASS_BEGIN_INFO"/>
+ <enum extends="VkStructureType" name="VK_STRUCTURE_TYPE_SUBPASS_END_INFO_KHR" alias="VK_STRUCTURE_TYPE_SUBPASS_END_INFO"/>
+ <command name="vkCreateRenderPass2KHR"/>
+ <command name="vkCmdBeginRenderPass2KHR"/>
+ <command name="vkCmdNextSubpass2KHR"/>
+ <command name="vkCmdEndRenderPass2KHR"/>
+ <type name="VkRenderPassCreateInfo2KHR"/>
+ <type name="VkAttachmentDescription2KHR"/>
+ <type name="VkAttachmentReference2KHR"/>
+ <type name="VkSubpassDescription2KHR"/>
+ <type name="VkSubpassDependency2KHR"/>
+ <type name="VkSubpassBeginInfoKHR"/>
+ <type name="VkSubpassEndInfoKHR"/>
+ </require>
+ </extension>
+ <extension name="VK_IMG_extension_111" number="111" author="IMG" contact="Michael Worcester @michaelworcester" supported="disabled">
+ <require>
+ <enum value="0" name="VK_IMG_EXTENSION_111_SPEC_VERSION"/>
+ <enum value="&quot;VK_IMG_extension_111&quot;" name="VK_IMG_EXTENSION_111_EXTENSION_NAME"/>
+ </require>
+ </extension>
+ <extension name="VK_KHR_shared_presentable_image" number="112" type="device" requires="VK_KHR_swapchain,VK_KHR_get_physical_device_properties2,VK_KHR_get_surface_capabilities2" author="KHR" contact="Alon Or-bach @alonorbach" supported="vulkan">
+ <require>
+ <enum value="1" name="VK_KHR_SHARED_PRESENTABLE_IMAGE_SPEC_VERSION"/>
+ <enum value="&quot;VK_KHR_shared_presentable_image&quot;" name="VK_KHR_SHARED_PRESENTABLE_IMAGE_EXTENSION_NAME"/>
+ <enum offset="0" extends="VkStructureType" name="VK_STRUCTURE_TYPE_SHARED_PRESENT_SURFACE_CAPABILITIES_KHR"/>
+ <enum offset="0" extends="VkPresentModeKHR" name="VK_PRESENT_MODE_SHARED_DEMAND_REFRESH_KHR"/>
+ <enum offset="1" extends="VkPresentModeKHR" name="VK_PRESENT_MODE_SHARED_CONTINUOUS_REFRESH_KHR"/>
+ <enum offset="0" extends="VkImageLayout" name="VK_IMAGE_LAYOUT_SHARED_PRESENT_KHR"/>
+ <type name="VkSharedPresentSurfaceCapabilitiesKHR"/>
+ <command name="vkGetSwapchainStatusKHR"/>
+ </require>
+ </extension>
+ <extension name="VK_KHR_external_fence_capabilities" number="113" type="instance" author="KHR" requires="VK_KHR_get_physical_device_properties2" contact="Jesse Hall @critsec" supported="vulkan" promotedto="VK_VERSION_1_1">
+ <require>
+ <enum value="1" name="VK_KHR_EXTERNAL_FENCE_CAPABILITIES_SPEC_VERSION"/>
+ <enum value="&quot;VK_KHR_external_fence_capabilities&quot;" name="VK_KHR_EXTERNAL_FENCE_CAPABILITIES_EXTENSION_NAME"/>
+ <enum extends="VkStructureType" name="VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_EXTERNAL_FENCE_INFO_KHR" alias="VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_EXTERNAL_FENCE_INFO"/>
+ <enum extends="VkStructureType" name="VK_STRUCTURE_TYPE_EXTERNAL_FENCE_PROPERTIES_KHR" alias="VK_STRUCTURE_TYPE_EXTERNAL_FENCE_PROPERTIES"/>
+ <enum extends="VkStructureType" name="VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_ID_PROPERTIES_KHR" alias="VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_ID_PROPERTIES"/>
+ <enum name="VK_LUID_SIZE_KHR"/>
+ <type name="VkExternalFenceHandleTypeFlagsKHR"/>
+ <type name="VkExternalFenceHandleTypeFlagBitsKHR"/>
+ <enum extends="VkExternalFenceHandleTypeFlagBits" name="VK_EXTERNAL_FENCE_HANDLE_TYPE_OPAQUE_FD_BIT_KHR" alias="VK_EXTERNAL_FENCE_HANDLE_TYPE_OPAQUE_FD_BIT"/>
+ <enum extends="VkExternalFenceHandleTypeFlagBits" name="VK_EXTERNAL_FENCE_HANDLE_TYPE_OPAQUE_WIN32_BIT_KHR" alias="VK_EXTERNAL_FENCE_HANDLE_TYPE_OPAQUE_WIN32_BIT"/>
+ <enum extends="VkExternalFenceHandleTypeFlagBits" name="VK_EXTERNAL_FENCE_HANDLE_TYPE_OPAQUE_WIN32_KMT_BIT_KHR" alias="VK_EXTERNAL_FENCE_HANDLE_TYPE_OPAQUE_WIN32_KMT_BIT"/>
+ <enum extends="VkExternalFenceHandleTypeFlagBits" name="VK_EXTERNAL_FENCE_HANDLE_TYPE_SYNC_FD_BIT_KHR" alias="VK_EXTERNAL_FENCE_HANDLE_TYPE_SYNC_FD_BIT"/>
+ <type name="VkExternalFenceFeatureFlagsKHR"/>
+ <type name="VkExternalFenceFeatureFlagBitsKHR"/>
+ <enum extends="VkExternalFenceFeatureFlagBits" name="VK_EXTERNAL_FENCE_FEATURE_EXPORTABLE_BIT_KHR" alias="VK_EXTERNAL_FENCE_FEATURE_EXPORTABLE_BIT"/>
+ <enum extends="VkExternalFenceFeatureFlagBits" name="VK_EXTERNAL_FENCE_FEATURE_IMPORTABLE_BIT_KHR" alias="VK_EXTERNAL_FENCE_FEATURE_IMPORTABLE_BIT"/>
+ <type name="VkPhysicalDeviceExternalFenceInfoKHR"/>
+ <type name="VkExternalFencePropertiesKHR"/>
+ <type name="VkPhysicalDeviceIDPropertiesKHR"/>
+ <command name="vkGetPhysicalDeviceExternalFencePropertiesKHR"/>
+ </require>
+ </extension>
+ <extension name="VK_KHR_external_fence" number="114" type="device" requires="VK_KHR_external_fence_capabilities" author="KHR" contact="Jesse Hall @critsec" supported="vulkan" promotedto="VK_VERSION_1_1">
+ <require>
+ <enum value="1" name="VK_KHR_EXTERNAL_FENCE_SPEC_VERSION"/>
+ <enum value="&quot;VK_KHR_external_fence&quot;" name="VK_KHR_EXTERNAL_FENCE_EXTENSION_NAME"/>
+ <enum extends="VkStructureType" name="VK_STRUCTURE_TYPE_EXPORT_FENCE_CREATE_INFO_KHR" alias="VK_STRUCTURE_TYPE_EXPORT_FENCE_CREATE_INFO"/>
+ <type name="VkFenceImportFlagsKHR"/>
+ <type name="VkFenceImportFlagBitsKHR"/>
+ <enum extends="VkFenceImportFlagBits" name="VK_FENCE_IMPORT_TEMPORARY_BIT_KHR" alias="VK_FENCE_IMPORT_TEMPORARY_BIT"/>
+ <type name="VkExportFenceCreateInfoKHR"/>
+ </require>
+ </extension>
+ <extension name="VK_KHR_external_fence_win32" number="115" type="device" requires="VK_KHR_external_fence" author="KHR" contact="Jesse Hall @critsec" platform="win32" supported="vulkan">
+ <require>
+ <enum value="1" name="VK_KHR_EXTERNAL_FENCE_WIN32_SPEC_VERSION"/>
+ <enum value="&quot;VK_KHR_external_fence_win32&quot;" name="VK_KHR_EXTERNAL_FENCE_WIN32_EXTENSION_NAME"/>
+ <enum offset="0" extends="VkStructureType" name="VK_STRUCTURE_TYPE_IMPORT_FENCE_WIN32_HANDLE_INFO_KHR"/>
+ <enum offset="1" extends="VkStructureType" name="VK_STRUCTURE_TYPE_EXPORT_FENCE_WIN32_HANDLE_INFO_KHR"/>
+ <enum offset="2" extends="VkStructureType" name="VK_STRUCTURE_TYPE_FENCE_GET_WIN32_HANDLE_INFO_KHR"/>
+ <type name="VkImportFenceWin32HandleInfoKHR"/>
+ <type name="VkExportFenceWin32HandleInfoKHR"/>
+ <type name="VkFenceGetWin32HandleInfoKHR"/>
+ <command name="vkImportFenceWin32HandleKHR"/>
+ <command name="vkGetFenceWin32HandleKHR"/>
+ </require>
+ </extension>
+ <extension name="VK_KHR_external_fence_fd" number="116" type="device" requires="VK_KHR_external_fence" author="KHR" contact="Jesse Hall @critsec" supported="vulkan">
+ <require>
+ <enum value="1" name="VK_KHR_EXTERNAL_FENCE_FD_SPEC_VERSION"/>
+ <enum value="&quot;VK_KHR_external_fence_fd&quot;" name="VK_KHR_EXTERNAL_FENCE_FD_EXTENSION_NAME"/>
+ <enum offset="0" extends="VkStructureType" name="VK_STRUCTURE_TYPE_IMPORT_FENCE_FD_INFO_KHR"/>
+ <enum offset="1" extends="VkStructureType" name="VK_STRUCTURE_TYPE_FENCE_GET_FD_INFO_KHR"/>
+ <type name="VkImportFenceFdInfoKHR"/>
+ <type name="VkFenceGetFdInfoKHR"/>
+ <command name="vkImportFenceFdKHR"/>
+ <command name="vkGetFenceFdKHR"/>
+ </require>
+ </extension>
+ <extension name="VK_KHR_performance_query" number="117" type="device" requires="VK_KHR_get_physical_device_properties2" author="KHR" contact="Alon Or-bach @alonorbach" specialuse="devtools" supported="vulkan">
+ <require>
+ <enum value="1" name="VK_KHR_PERFORMANCE_QUERY_SPEC_VERSION"/>
+ <enum value="&quot;VK_KHR_performance_query&quot;" name="VK_KHR_PERFORMANCE_QUERY_EXTENSION_NAME"/>
+ <enum offset="0" extends="VkQueryType" name="VK_QUERY_TYPE_PERFORMANCE_QUERY_KHR"/>
+ <enum offset="0" extends="VkStructureType" name="VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_PERFORMANCE_QUERY_FEATURES_KHR"/>
+ <enum offset="1" extends="VkStructureType" name="VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_PERFORMANCE_QUERY_PROPERTIES_KHR"/>
+ <enum offset="2" extends="VkStructureType" name="VK_STRUCTURE_TYPE_QUERY_POOL_PERFORMANCE_CREATE_INFO_KHR"/>
+ <enum offset="3" extends="VkStructureType" name="VK_STRUCTURE_TYPE_PERFORMANCE_QUERY_SUBMIT_INFO_KHR"/>
+ <enum offset="4" extends="VkStructureType" name="VK_STRUCTURE_TYPE_ACQUIRE_PROFILING_LOCK_INFO_KHR"/>
+ <enum offset="5" extends="VkStructureType" name="VK_STRUCTURE_TYPE_PERFORMANCE_COUNTER_KHR"/>
+ <enum offset="6" extends="VkStructureType" name="VK_STRUCTURE_TYPE_PERFORMANCE_COUNTER_DESCRIPTION_KHR"/>
+ <type name="VkPhysicalDevicePerformanceQueryFeaturesKHR"/>
+ <type name="VkPhysicalDevicePerformanceQueryPropertiesKHR"/>
+ <type name="VkPerformanceCounterKHR"/>
+ <type name="VkPerformanceCounterDescriptionKHR"/>
+ <type name="VkPerformanceCounterDescriptionFlagsKHR"/>
+ <type name="VkPerformanceCounterDescriptionFlagBitsKHR"/>
+ <type name="VkQueryPoolPerformanceCreateInfoKHR"/>
+ <type name="VkPerformanceCounterScopeKHR"/>
+ <type name="VkPerformanceCounterStorageKHR"/>
+ <type name="VkPerformanceCounterUnitKHR"/>
+ <type name="VkPerformanceCounterResultKHR"/>
+ <type name="VkAcquireProfilingLockInfoKHR"/>
+ <type name="VkAcquireProfilingLockFlagsKHR"/>
+ <type name="VkAcquireProfilingLockFlagBitsKHR"/>
+ <type name="VkPerformanceQuerySubmitInfoKHR"/>
+ <command name="vkEnumeratePhysicalDeviceQueueFamilyPerformanceQueryCountersKHR"/>
+ <command name="vkGetPhysicalDeviceQueueFamilyPerformanceQueryPassesKHR"/>
+ <command name="vkAcquireProfilingLockKHR"/>
+ <command name="vkReleaseProfilingLockKHR"/>
+ </require>
+ </extension>
+ <extension name="VK_KHR_maintenance2" number="118" type="device" author="KHR" contact="Michael Worcester @michaelworcester" supported="vulkan" promotedto="VK_VERSION_1_1">
+ <require>
+ <enum value="1" name="VK_KHR_MAINTENANCE_2_SPEC_VERSION"/>
+ <enum value="&quot;VK_KHR_maintenance2&quot;" name="VK_KHR_MAINTENANCE_2_EXTENSION_NAME"/>
+ <enum alias="VK_KHR_MAINTENANCE_2_SPEC_VERSION" name="VK_KHR_MAINTENANCE2_SPEC_VERSION" comment="Backwards-compatible alias containing a typo"/>
+ <enum alias="VK_KHR_MAINTENANCE_2_EXTENSION_NAME" name="VK_KHR_MAINTENANCE2_EXTENSION_NAME" comment="Backwards-compatible alias containing a typo"/>
+ <enum extends="VkImageCreateFlagBits" name="VK_IMAGE_CREATE_BLOCK_TEXEL_VIEW_COMPATIBLE_BIT_KHR" alias="VK_IMAGE_CREATE_BLOCK_TEXEL_VIEW_COMPATIBLE_BIT"/>
+ <enum extends="VkImageCreateFlagBits" name="VK_IMAGE_CREATE_EXTENDED_USAGE_BIT_KHR" alias="VK_IMAGE_CREATE_EXTENDED_USAGE_BIT"/>
+ <enum extends="VkStructureType" name="VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_POINT_CLIPPING_PROPERTIES_KHR" alias="VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_POINT_CLIPPING_PROPERTIES"/>
+ <enum extends="VkStructureType" name="VK_STRUCTURE_TYPE_RENDER_PASS_INPUT_ATTACHMENT_ASPECT_CREATE_INFO_KHR" alias="VK_STRUCTURE_TYPE_RENDER_PASS_INPUT_ATTACHMENT_ASPECT_CREATE_INFO"/>
+ <enum extends="VkStructureType" name="VK_STRUCTURE_TYPE_IMAGE_VIEW_USAGE_CREATE_INFO_KHR" alias="VK_STRUCTURE_TYPE_IMAGE_VIEW_USAGE_CREATE_INFO"/>
+ <enum extends="VkStructureType" name="VK_STRUCTURE_TYPE_PIPELINE_TESSELLATION_DOMAIN_ORIGIN_STATE_CREATE_INFO_KHR" alias="VK_STRUCTURE_TYPE_PIPELINE_TESSELLATION_DOMAIN_ORIGIN_STATE_CREATE_INFO"/>
+ <enum extends="VkImageLayout" name="VK_IMAGE_LAYOUT_DEPTH_READ_ONLY_STENCIL_ATTACHMENT_OPTIMAL_KHR" alias="VK_IMAGE_LAYOUT_DEPTH_READ_ONLY_STENCIL_ATTACHMENT_OPTIMAL"/>
+ <enum extends="VkImageLayout" name="VK_IMAGE_LAYOUT_DEPTH_ATTACHMENT_STENCIL_READ_ONLY_OPTIMAL_KHR" alias="VK_IMAGE_LAYOUT_DEPTH_ATTACHMENT_STENCIL_READ_ONLY_OPTIMAL"/>
+ <type name="VkPhysicalDevicePointClippingPropertiesKHR"/>
+ <type name="VkPointClippingBehaviorKHR"/>
+ <enum extends="VkPointClippingBehavior" name="VK_POINT_CLIPPING_BEHAVIOR_ALL_CLIP_PLANES_KHR" alias="VK_POINT_CLIPPING_BEHAVIOR_ALL_CLIP_PLANES"/>
+ <enum extends="VkPointClippingBehavior" name="VK_POINT_CLIPPING_BEHAVIOR_USER_CLIP_PLANES_ONLY_KHR" alias="VK_POINT_CLIPPING_BEHAVIOR_USER_CLIP_PLANES_ONLY"/>
+ <type name="VkRenderPassInputAttachmentAspectCreateInfoKHR"/>
+ <type name="VkInputAttachmentAspectReferenceKHR"/>
+ <type name="VkImageViewUsageCreateInfoKHR"/>
+ <type name="VkTessellationDomainOriginKHR"/>
+ <enum extends="VkTessellationDomainOrigin" name="VK_TESSELLATION_DOMAIN_ORIGIN_UPPER_LEFT_KHR" alias="VK_TESSELLATION_DOMAIN_ORIGIN_UPPER_LEFT"/>
+ <enum extends="VkTessellationDomainOrigin" name="VK_TESSELLATION_DOMAIN_ORIGIN_LOWER_LEFT_KHR" alias="VK_TESSELLATION_DOMAIN_ORIGIN_LOWER_LEFT"/>
+ <type name="VkPipelineTessellationDomainOriginStateCreateInfoKHR"/>
+ </require>
+ </extension>
+ <extension name="VK_KHR_extension_119" number="119" author="KHR" contact="Michael Worcester @michaelworcester" supported="disabled">
+ <require>
+ <enum value="0" name="VK_KHR_EXTENSION_119_SPEC_VERSION"/>
+ <enum value="&quot;VK_KHR_extension_119&quot;" name="VK_KHR_EXTENSION_119_EXTENSION_NAME"/>
+ </require>
+ </extension>
+ <extension name="VK_KHR_get_surface_capabilities2" number="120" type="instance" requires="VK_KHR_surface" author="KHR" contact="James Jones @cubanismo" supported="vulkan">
+ <require>
+ <enum value="1" name="VK_KHR_GET_SURFACE_CAPABILITIES_2_SPEC_VERSION"/>
+ <enum value="&quot;VK_KHR_get_surface_capabilities2&quot;" name="VK_KHR_GET_SURFACE_CAPABILITIES_2_EXTENSION_NAME"/>
+ <enum offset="0" extends="VkStructureType" name="VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_SURFACE_INFO_2_KHR"/>
+ <enum offset="1" extends="VkStructureType" name="VK_STRUCTURE_TYPE_SURFACE_CAPABILITIES_2_KHR"/>
+ <enum offset="2" extends="VkStructureType" name="VK_STRUCTURE_TYPE_SURFACE_FORMAT_2_KHR"/>
+ <type name="VkPhysicalDeviceSurfaceInfo2KHR"/>
+ <type name="VkSurfaceCapabilities2KHR"/>
+ <type name="VkSurfaceFormat2KHR"/>
+ <command name="vkGetPhysicalDeviceSurfaceCapabilities2KHR"/>
+ <command name="vkGetPhysicalDeviceSurfaceFormats2KHR"/>
+ </require>
+ </extension>
+ <extension name="VK_KHR_variable_pointers" number="121" type="device" author="KHR" contact="Jesse Hall @critsec" requires="VK_KHR_get_physical_device_properties2,VK_KHR_storage_buffer_storage_class" supported="vulkan" promotedto="VK_VERSION_1_1">
+ <require>
+ <enum value="1" name="VK_KHR_VARIABLE_POINTERS_SPEC_VERSION"/>
+ <enum value="&quot;VK_KHR_variable_pointers&quot;" name="VK_KHR_VARIABLE_POINTERS_EXTENSION_NAME"/>
+ <enum extends="VkStructureType" name="VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_VARIABLE_POINTERS_FEATURES_KHR" alias="VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_VARIABLE_POINTERS_FEATURES"/>
+ <enum extends="VkStructureType" name="VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_VARIABLE_POINTER_FEATURES_KHR" alias="VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_VARIABLE_POINTERS_FEATURES_KHR"/>
+ <type name="VkPhysicalDeviceVariablePointerFeaturesKHR"/>
+ <type name="VkPhysicalDeviceVariablePointersFeaturesKHR"/>
+ </require>
+ </extension>
+ <extension name="VK_KHR_get_display_properties2" number="122" type="instance" requires="VK_KHR_display" author="KHR" contact="James Jones @cubanismo" supported="vulkan">
+ <require>
+ <enum value="1" name="VK_KHR_GET_DISPLAY_PROPERTIES_2_SPEC_VERSION"/>
+ <enum value="&quot;VK_KHR_get_display_properties2&quot;" name="VK_KHR_GET_DISPLAY_PROPERTIES_2_EXTENSION_NAME"/>
+ <enum offset="0" extends="VkStructureType" name="VK_STRUCTURE_TYPE_DISPLAY_PROPERTIES_2_KHR"/>
+ <enum offset="1" extends="VkStructureType" name="VK_STRUCTURE_TYPE_DISPLAY_PLANE_PROPERTIES_2_KHR"/>
+ <enum offset="2" extends="VkStructureType" name="VK_STRUCTURE_TYPE_DISPLAY_MODE_PROPERTIES_2_KHR"/>
+ <enum offset="3" extends="VkStructureType" name="VK_STRUCTURE_TYPE_DISPLAY_PLANE_INFO_2_KHR"/>
+ <enum offset="4" extends="VkStructureType" name="VK_STRUCTURE_TYPE_DISPLAY_PLANE_CAPABILITIES_2_KHR"/>
+ <type name="VkDisplayProperties2KHR"/>
+ <type name="VkDisplayPlaneProperties2KHR"/>
+ <type name="VkDisplayModeProperties2KHR"/>
+ <type name="VkDisplayPlaneInfo2KHR"/>
+ <type name="VkDisplayPlaneCapabilities2KHR"/>
+ <command name="vkGetPhysicalDeviceDisplayProperties2KHR"/>
+ <command name="vkGetPhysicalDeviceDisplayPlaneProperties2KHR"/>
+ <command name="vkGetDisplayModeProperties2KHR"/>
+ <command name="vkGetDisplayPlaneCapabilities2KHR"/>
+ </require>
+ </extension>
+ <extension name="VK_MVK_ios_surface" number="123" type="instance" requires="VK_KHR_surface" platform="ios" supported="vulkan" author="MVK" contact="Bill Hollings @billhollings" deprecatedby="VK_EXT_metal_surface">
+ <require>
+ <enum value="3" name="VK_MVK_IOS_SURFACE_SPEC_VERSION"/>
+ <enum value="&quot;VK_MVK_ios_surface&quot;" name="VK_MVK_IOS_SURFACE_EXTENSION_NAME"/>
+ <enum offset="0" extends="VkStructureType" name="VK_STRUCTURE_TYPE_IOS_SURFACE_CREATE_INFO_MVK"/>
+ <type name="VkIOSSurfaceCreateFlagsMVK"/>
+ <type name="VkIOSSurfaceCreateInfoMVK"/>
+ <command name="vkCreateIOSSurfaceMVK"/>
+ </require>
+ </extension>
+ <extension name="VK_MVK_macos_surface" number="124" type="instance" requires="VK_KHR_surface" platform="macos" supported="vulkan" author="MVK" contact="Bill Hollings @billhollings" deprecatedby="VK_EXT_metal_surface">
+ <require>
+ <enum value="3" name="VK_MVK_MACOS_SURFACE_SPEC_VERSION"/>
+ <enum value="&quot;VK_MVK_macos_surface&quot;" name="VK_MVK_MACOS_SURFACE_EXTENSION_NAME"/>
+ <enum offset="0" extends="VkStructureType" name="VK_STRUCTURE_TYPE_MACOS_SURFACE_CREATE_INFO_MVK"/>
+ <type name="VkMacOSSurfaceCreateFlagsMVK"/>
+ <type name="VkMacOSSurfaceCreateInfoMVK"/>
+ <command name="vkCreateMacOSSurfaceMVK"/>
+ </require>
+ </extension>
+ <extension name="VK_MVK_moltenvk" number="125" type="instance" author="MVK" contact="Bill Hollings @billhollings" supported="disabled">
+ <require>
+ <enum value="0" name="VK_MVK_MOLTENVK_SPEC_VERSION"/>
+ <enum value="&quot;VK_MVK_moltenvk&quot;" name="VK_MVK_MOLTENVK_EXTENSION_NAME"/>
+ </require>
+ </extension>
+ <extension name="VK_EXT_external_memory_dma_buf" number="126" type="device" requires="VK_KHR_external_memory_fd" author="EXT" contact="Chad Versace @chadversary" supported="vulkan">
+ <require>
+ <enum value="1" name="VK_EXT_EXTERNAL_MEMORY_DMA_BUF_SPEC_VERSION"/>
+ <enum value="&quot;VK_EXT_external_memory_dma_buf&quot;" name="VK_EXT_EXTERNAL_MEMORY_DMA_BUF_EXTENSION_NAME"/>
+ <enum bitpos="9" extends="VkExternalMemoryHandleTypeFlagBits" name="VK_EXTERNAL_MEMORY_HANDLE_TYPE_DMA_BUF_BIT_EXT"/>
+ </require>
+ </extension>
+ <extension name="VK_EXT_queue_family_foreign" number="127" type="device" author="EXT" requires="VK_KHR_external_memory" contact="Chad Versace @chadversary" supported="vulkan">
+ <require>
+ <enum value="1" name="VK_EXT_QUEUE_FAMILY_FOREIGN_SPEC_VERSION"/>
+ <enum value="&quot;VK_EXT_queue_family_foreign&quot;" name="VK_EXT_QUEUE_FAMILY_FOREIGN_EXTENSION_NAME"/>
+ <enum name="VK_QUEUE_FAMILY_FOREIGN_EXT"/>
+ </require>
+ </extension>
+ <extension name="VK_KHR_dedicated_allocation" number="128" type="device" author="KHR" requires="VK_KHR_get_memory_requirements2" contact="James Jones @cubanismo" supported="vulkan" promotedto="VK_VERSION_1_1">
+ <require>
+ <enum value="3" name="VK_KHR_DEDICATED_ALLOCATION_SPEC_VERSION"/>
+ <enum value="&quot;VK_KHR_dedicated_allocation&quot;" name="VK_KHR_DEDICATED_ALLOCATION_EXTENSION_NAME"/>
+ <enum extends="VkStructureType" name="VK_STRUCTURE_TYPE_MEMORY_DEDICATED_REQUIREMENTS_KHR" alias="VK_STRUCTURE_TYPE_MEMORY_DEDICATED_REQUIREMENTS"/>
+ <enum extends="VkStructureType" name="VK_STRUCTURE_TYPE_MEMORY_DEDICATED_ALLOCATE_INFO_KHR" alias="VK_STRUCTURE_TYPE_MEMORY_DEDICATED_ALLOCATE_INFO"/>
+ <type name="VkMemoryDedicatedRequirementsKHR"/>
+ <type name="VkMemoryDedicatedAllocateInfoKHR"/>
+ </require>
+ </extension>
+ <extension name="VK_EXT_debug_utils" number="129" type="instance" author="EXT" contact="Mark Young @marky-lunarg" specialuse="debugging" supported="vulkan">
+ <require>
+ <enum value="2" name="VK_EXT_DEBUG_UTILS_SPEC_VERSION"/>
+ <enum value="&quot;VK_EXT_debug_utils&quot;" name="VK_EXT_DEBUG_UTILS_EXTENSION_NAME"/>
+ <enum offset="0" extends="VkStructureType" name="VK_STRUCTURE_TYPE_DEBUG_UTILS_OBJECT_NAME_INFO_EXT"/>
+ <enum offset="1" extends="VkStructureType" name="VK_STRUCTURE_TYPE_DEBUG_UTILS_OBJECT_TAG_INFO_EXT"/>
+ <enum offset="2" extends="VkStructureType" name="VK_STRUCTURE_TYPE_DEBUG_UTILS_LABEL_EXT"/>
+ <enum offset="3" extends="VkStructureType" name="VK_STRUCTURE_TYPE_DEBUG_UTILS_MESSENGER_CALLBACK_DATA_EXT"/>
+ <enum offset="4" extends="VkStructureType" name="VK_STRUCTURE_TYPE_DEBUG_UTILS_MESSENGER_CREATE_INFO_EXT"/>
+ <enum offset="0" extends="VkObjectType" name="VK_OBJECT_TYPE_DEBUG_UTILS_MESSENGER_EXT"/>
+ <type name="PFN_vkDebugUtilsMessengerCallbackEXT"/>
+ <type name="VkDebugUtilsLabelEXT"/>
+ <type name="VkDebugUtilsMessageSeverityFlagBitsEXT"/>
+ <type name="VkDebugUtilsMessageSeverityFlagsEXT"/>
+ <type name="VkDebugUtilsMessageTypeFlagBitsEXT"/>
+ <type name="VkDebugUtilsMessageTypeFlagsEXT"/>
+ <type name="VkDebugUtilsMessengerCallbackDataEXT"/>
+ <type name="VkDebugUtilsMessengerCallbackDataFlagsEXT"/>
+ <type name="VkDebugUtilsMessengerCreateFlagsEXT"/>
+ <type name="VkDebugUtilsMessengerCreateInfoEXT"/>
+ <type name="VkDebugUtilsMessengerEXT"/>
+ <type name="VkDebugUtilsObjectNameInfoEXT"/>
+ <type name="VkDebugUtilsObjectTagInfoEXT"/>
+ <command name="vkSetDebugUtilsObjectNameEXT"/>
+ <command name="vkSetDebugUtilsObjectTagEXT"/>
+ <command name="vkQueueBeginDebugUtilsLabelEXT"/>
+ <command name="vkQueueEndDebugUtilsLabelEXT"/>
+ <command name="vkQueueInsertDebugUtilsLabelEXT"/>
+ <command name="vkCmdBeginDebugUtilsLabelEXT"/>
+ <command name="vkCmdEndDebugUtilsLabelEXT"/>
+ <command name="vkCmdInsertDebugUtilsLabelEXT"/>
+ <command name="vkCreateDebugUtilsMessengerEXT"/>
+ <command name="vkDestroyDebugUtilsMessengerEXT"/>
+ <command name="vkSubmitDebugUtilsMessageEXT"/>
+ </require>
+ </extension>
+ <extension name="VK_ANDROID_external_memory_android_hardware_buffer" number="130" type="device" author="ANDROID" requires="VK_KHR_sampler_ycbcr_conversion,VK_KHR_external_memory,VK_EXT_queue_family_foreign,VK_KHR_dedicated_allocation" platform="android" contact="Jesse Hall @critsec" supported="vulkan">
+ <require>
+ <enum value="5" name="VK_ANDROID_EXTERNAL_MEMORY_ANDROID_HARDWARE_BUFFER_SPEC_VERSION"/>
+ <enum value="&quot;VK_ANDROID_external_memory_android_hardware_buffer&quot;" name="VK_ANDROID_EXTERNAL_MEMORY_ANDROID_HARDWARE_BUFFER_EXTENSION_NAME"/>
+ <enum bitpos="10" extends="VkExternalMemoryHandleTypeFlagBits" name="VK_EXTERNAL_MEMORY_HANDLE_TYPE_ANDROID_HARDWARE_BUFFER_BIT_ANDROID"/>
+ <enum offset="0" extends="VkStructureType" name="VK_STRUCTURE_TYPE_ANDROID_HARDWARE_BUFFER_USAGE_ANDROID"/>
+ <enum offset="1" extends="VkStructureType" name="VK_STRUCTURE_TYPE_ANDROID_HARDWARE_BUFFER_PROPERTIES_ANDROID"/>
+ <enum offset="2" extends="VkStructureType" name="VK_STRUCTURE_TYPE_ANDROID_HARDWARE_BUFFER_FORMAT_PROPERTIES_ANDROID"/>
+ <enum offset="3" extends="VkStructureType" name="VK_STRUCTURE_TYPE_IMPORT_ANDROID_HARDWARE_BUFFER_INFO_ANDROID"/>
+ <enum offset="4" extends="VkStructureType" name="VK_STRUCTURE_TYPE_MEMORY_GET_ANDROID_HARDWARE_BUFFER_INFO_ANDROID"/>
+ <enum offset="5" extends="VkStructureType" name="VK_STRUCTURE_TYPE_EXTERNAL_FORMAT_ANDROID"/>
+ <type name="VkAndroidHardwareBufferUsageANDROID"/>
+ <type name="VkAndroidHardwareBufferPropertiesANDROID"/>
+ <type name="VkAndroidHardwareBufferFormatPropertiesANDROID"/>
+ <type name="VkImportAndroidHardwareBufferInfoANDROID"/>
+ <type name="VkMemoryGetAndroidHardwareBufferInfoANDROID"/>
+ <type name="VkExternalFormatANDROID"/>
+ <command name="vkGetAndroidHardwareBufferPropertiesANDROID"/>
+ <command name="vkGetMemoryAndroidHardwareBufferANDROID"/>
+ <type name="AHardwareBuffer"/>
+ </require>
+ <require extension="VK_KHR_format_feature_flags2">
+ <type name="VkAndroidHardwareBufferFormatProperties2ANDROID"/>
+ <enum offset="6" extends="VkStructureType" name="VK_STRUCTURE_TYPE_ANDROID_HARDWARE_BUFFER_FORMAT_PROPERTIES_2_ANDROID"/>
+ </require>
+ </extension>
+ <extension name="VK_EXT_sampler_filter_minmax" number="131" type="device" author="NV" requires="VK_KHR_get_physical_device_properties2" contact="Jeff Bolz @jeffbolznv" supported="vulkan" promotedto="VK_VERSION_1_2">
+ <require>
+ <enum value="2" name="VK_EXT_SAMPLER_FILTER_MINMAX_SPEC_VERSION"/>
+ <enum value="&quot;VK_EXT_sampler_filter_minmax&quot;" name="VK_EXT_SAMPLER_FILTER_MINMAX_EXTENSION_NAME"/>
+ <enum extends="VkStructureType" name="VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_SAMPLER_FILTER_MINMAX_PROPERTIES_EXT" alias="VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_SAMPLER_FILTER_MINMAX_PROPERTIES"/>
+ <enum extends="VkStructureType" name="VK_STRUCTURE_TYPE_SAMPLER_REDUCTION_MODE_CREATE_INFO_EXT" alias="VK_STRUCTURE_TYPE_SAMPLER_REDUCTION_MODE_CREATE_INFO"/>
+ <enum extends="VkFormatFeatureFlagBits" name="VK_FORMAT_FEATURE_SAMPLED_IMAGE_FILTER_MINMAX_BIT_EXT" alias="VK_FORMAT_FEATURE_SAMPLED_IMAGE_FILTER_MINMAX_BIT"/>
+ <enum extends="VkSamplerReductionMode" name="VK_SAMPLER_REDUCTION_MODE_WEIGHTED_AVERAGE_EXT" alias="VK_SAMPLER_REDUCTION_MODE_WEIGHTED_AVERAGE"/>
+ <enum extends="VkSamplerReductionMode" name="VK_SAMPLER_REDUCTION_MODE_MIN_EXT" alias="VK_SAMPLER_REDUCTION_MODE_MIN"/>
+ <enum extends="VkSamplerReductionMode" name="VK_SAMPLER_REDUCTION_MODE_MAX_EXT" alias="VK_SAMPLER_REDUCTION_MODE_MAX"/>
+ <type name="VkSamplerReductionModeEXT"/>
+ <type name="VkSamplerReductionModeCreateInfoEXT"/>
+ <type name="VkPhysicalDeviceSamplerFilterMinmaxPropertiesEXT"/>
+ </require>
+ </extension>
+ <extension name="VK_KHR_storage_buffer_storage_class" number="132" type="device" author="KHR" contact="Alexander Galazin @alegal-arm" supported="vulkan" promotedto="VK_VERSION_1_1">
+ <require>
+ <enum value="1" name="VK_KHR_STORAGE_BUFFER_STORAGE_CLASS_SPEC_VERSION"/>
+ <enum value="&quot;VK_KHR_storage_buffer_storage_class&quot;" name="VK_KHR_STORAGE_BUFFER_STORAGE_CLASS_EXTENSION_NAME"/>
+ </require>
+ </extension>
+ <extension name="VK_AMD_gpu_shader_int16" number="133" type="device" author="AMD" contact="Qun Lin @linqun" supported="vulkan" deprecatedby="VK_KHR_shader_float16_int8">
+ <require>
+ <enum value="2" name="VK_AMD_GPU_SHADER_INT16_SPEC_VERSION"/>
+ <enum value="&quot;VK_AMD_gpu_shader_int16&quot;" name="VK_AMD_GPU_SHADER_INT16_EXTENSION_NAME"/>
+ </require>
+ </extension>
+ <extension name="VK_AMD_extension_134" number="134" author="AMD" contact="Mais Alnasser @malnasse" supported="disabled">
+ <require>
+ <enum value="0" name="VK_AMD_EXTENSION_134_SPEC_VERSION"/>
+ <enum value="&quot;VK_AMD_extension_134&quot;" name="VK_AMD_EXTENSION_134_EXTENSION_NAME"/>
+ </require>
+ </extension>
+ <extension name="VK_AMD_extension_135" number="135" author="AMD" contact="Mais Alnasser @malnasse" supported="disabled">
+ <require>
+ <enum value="0" name="VK_AMD_EXTENSION_135_SPEC_VERSION"/>
+ <enum value="&quot;VK_AMD_extension_135&quot;" name="VK_AMD_EXTENSION_135_EXTENSION_NAME"/>
+ <enum bitpos="25" extends="VkBufferUsageFlagBits" name="VK_BUFFER_USAGE_RESERVED_25_BIT_AMD"/>
+ </require>
+ </extension>
+ <extension name="VK_AMD_extension_136" number="136" author="AMD" contact="Mais Alnasser @malnasse" supported="disabled">
+ <require>
+ <enum value="0" name="VK_AMD_EXTENSION_136_SPEC_VERSION"/>
+ <enum value="&quot;VK_AMD_extension_136&quot;" name="VK_AMD_EXTENSION_136_EXTENSION_NAME"/>
+ </require>
+ </extension>
+ <extension name="VK_AMD_mixed_attachment_samples" number="137" type="device" author="AMD" contact="Matthaeus G. Chajdas @anteru" supported="vulkan">
+ <require>
+ <enum value="1" name="VK_AMD_MIXED_ATTACHMENT_SAMPLES_SPEC_VERSION"/>
+ <enum value="&quot;VK_AMD_mixed_attachment_samples&quot;" name="VK_AMD_MIXED_ATTACHMENT_SAMPLES_EXTENSION_NAME"/>
+ </require>
+ </extension>
+ <extension name="VK_AMD_shader_fragment_mask" number="138" author="AMD" contact="Aaron Hagan @AaronHaganAMD" supported="vulkan" type="device">
+ <require>
+ <enum value="1" name="VK_AMD_SHADER_FRAGMENT_MASK_SPEC_VERSION"/>
+ <enum value="&quot;VK_AMD_shader_fragment_mask&quot;" name="VK_AMD_SHADER_FRAGMENT_MASK_EXTENSION_NAME"/>
+ </require>
+ </extension>
+ <extension name="VK_EXT_inline_uniform_block" number="139" type="device" author="EXT" requires="VK_KHR_get_physical_device_properties2,VK_KHR_maintenance1" contact="Daniel Rakos @aqnuep" supported="vulkan" promotedto="VK_VERSION_1_3">
+ <require>
+ <enum value="1" name="VK_EXT_INLINE_UNIFORM_BLOCK_SPEC_VERSION"/>
+ <enum value="&quot;VK_EXT_inline_uniform_block&quot;" name="VK_EXT_INLINE_UNIFORM_BLOCK_EXTENSION_NAME"/>
+ <enum extends="VkDescriptorType" name="VK_DESCRIPTOR_TYPE_INLINE_UNIFORM_BLOCK_EXT" alias="VK_DESCRIPTOR_TYPE_INLINE_UNIFORM_BLOCK"/>
+ <enum extends="VkStructureType" name="VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_INLINE_UNIFORM_BLOCK_FEATURES_EXT" alias="VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_INLINE_UNIFORM_BLOCK_FEATURES"/>
+ <enum extends="VkStructureType" name="VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_INLINE_UNIFORM_BLOCK_PROPERTIES_EXT" alias="VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_INLINE_UNIFORM_BLOCK_PROPERTIES"/>
+ <enum extends="VkStructureType" name="VK_STRUCTURE_TYPE_WRITE_DESCRIPTOR_SET_INLINE_UNIFORM_BLOCK_EXT" alias="VK_STRUCTURE_TYPE_WRITE_DESCRIPTOR_SET_INLINE_UNIFORM_BLOCK"/>
+ <enum extends="VkStructureType" name="VK_STRUCTURE_TYPE_DESCRIPTOR_POOL_INLINE_UNIFORM_BLOCK_CREATE_INFO_EXT" alias="VK_STRUCTURE_TYPE_DESCRIPTOR_POOL_INLINE_UNIFORM_BLOCK_CREATE_INFO"/>
+ <type name="VkPhysicalDeviceInlineUniformBlockFeaturesEXT"/>
+ <type name="VkPhysicalDeviceInlineUniformBlockPropertiesEXT"/>
+ <type name="VkWriteDescriptorSetInlineUniformBlockEXT"/>
+ <type name="VkDescriptorPoolInlineUniformBlockCreateInfoEXT"/>
+ </require>
+ </extension>
+ <extension name="VK_AMD_extension_140" number="140" author="AMD" contact="Mais Alnasser @malnasse" supported="disabled">
+ <require>
+ <enum value="0" name="VK_AMD_EXTENSION_140_SPEC_VERSION"/>
+ <enum value="&quot;VK_AMD_extension_140&quot;" name="VK_AMD_EXTENSION_140_EXTENSION_NAME"/>
+ </require>
+ </extension>
+ <extension name="VK_EXT_shader_stencil_export" number="141" type="device" author="EXT" contact="Dominik Witczak @dominikwitczakamd" supported="vulkan">
+ <require>
+ <enum value="1" name="VK_EXT_SHADER_STENCIL_EXPORT_SPEC_VERSION"/>
+ <enum value="&quot;VK_EXT_shader_stencil_export&quot;" name="VK_EXT_SHADER_STENCIL_EXPORT_EXTENSION_NAME"/>
+ </require>
+ </extension>
+ <extension name="VK_AMD_extension_142" number="142" author="AMD" contact="Mais Alnasser @malnasse" supported="disabled">
+ <require>
+ <enum value="0" name="VK_AMD_EXTENSION_142_SPEC_VERSION"/>
+ <enum value="&quot;VK_AMD_extension_142&quot;" name="VK_AMD_EXTENSION_142_EXTENSION_NAME"/>
+ </require>
+ </extension>
+ <extension name="VK_AMD_extension_143" number="143" author="AMD" contact="Mais Alnasser @malnasse" supported="disabled">
+ <require>
+ <enum value="0" name="VK_AMD_EXTENSION_143_SPEC_VERSION"/>
+ <enum value="&quot;VK_AMD_extension_143&quot;" name="VK_AMD_EXTENSION_143_EXTENSION_NAME"/>
+ </require>
+ </extension>
+ <extension name="VK_EXT_sample_locations" number="144" type="device" author="AMD" contact="Daniel Rakos @drakos-amd" supported="vulkan" requires="VK_KHR_get_physical_device_properties2">
+ <require>
+ <enum value="1" name="VK_EXT_SAMPLE_LOCATIONS_SPEC_VERSION"/>
+ <enum value="&quot;VK_EXT_sample_locations&quot;" name="VK_EXT_SAMPLE_LOCATIONS_EXTENSION_NAME"/>
+ <enum bitpos="12" extends="VkImageCreateFlagBits" name="VK_IMAGE_CREATE_SAMPLE_LOCATIONS_COMPATIBLE_DEPTH_BIT_EXT"/>
+ <enum offset="0" extends="VkStructureType" name="VK_STRUCTURE_TYPE_SAMPLE_LOCATIONS_INFO_EXT"/>
+ <enum offset="1" extends="VkStructureType" name="VK_STRUCTURE_TYPE_RENDER_PASS_SAMPLE_LOCATIONS_BEGIN_INFO_EXT"/>
+ <enum offset="2" extends="VkStructureType" name="VK_STRUCTURE_TYPE_PIPELINE_SAMPLE_LOCATIONS_STATE_CREATE_INFO_EXT"/>
+ <enum offset="3" extends="VkStructureType" name="VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_SAMPLE_LOCATIONS_PROPERTIES_EXT"/>
+ <enum offset="4" extends="VkStructureType" name="VK_STRUCTURE_TYPE_MULTISAMPLE_PROPERTIES_EXT"/>
+ <enum offset="0" extends="VkDynamicState" name="VK_DYNAMIC_STATE_SAMPLE_LOCATIONS_EXT"/>
+ <type name="VkSampleLocationEXT"/>
+ <type name="VkSampleLocationsInfoEXT"/>
+ <type name="VkAttachmentSampleLocationsEXT"/>
+ <type name="VkSubpassSampleLocationsEXT"/>
+ <type name="VkRenderPassSampleLocationsBeginInfoEXT"/>
+ <type name="VkPipelineSampleLocationsStateCreateInfoEXT"/>
+ <type name="VkPhysicalDeviceSampleLocationsPropertiesEXT"/>
+ <type name="VkMultisamplePropertiesEXT"/>
+ <command name="vkCmdSetSampleLocationsEXT"/>
+ <command name="vkGetPhysicalDeviceMultisamplePropertiesEXT"/>
+ </require>
+ </extension>
+ <extension name="VK_KHR_relaxed_block_layout" number="145" type="device" author="KHR" contact="John Kessenich @johnkslang" supported="vulkan" promotedto="VK_VERSION_1_1">
+ <require>
+ <enum value="1" name="VK_KHR_RELAXED_BLOCK_LAYOUT_SPEC_VERSION"/>
+ <enum value="&quot;VK_KHR_relaxed_block_layout&quot;" name="VK_KHR_RELAXED_BLOCK_LAYOUT_EXTENSION_NAME"/>
+ </require>
+ </extension>
+ <extension name="VK_RESERVED_do_not_use_146" number="146" supported="disabled" comment="Used for functionality subsumed into Vulkan 1.1 and not published as an extension">
+ <require>
+ <enum value="1" name="VK_RESERVED_DO_NOT_USE_146_SPEC_VERSION"/>
+ <enum value="&quot;VK_RESERVED_do_not_use_146&quot;" name="VK_RESERVED_DO_NOT_USE_146_EXTENSION_NAME"/>
+ </require>
+ </extension>
+ <extension name="VK_KHR_get_memory_requirements2" number="147" type="device" author="KHR" contact="Jason Ekstrand @jekstrand" supported="vulkan" promotedto="VK_VERSION_1_1">
+ <require>
+ <enum value="1" name="VK_KHR_GET_MEMORY_REQUIREMENTS_2_SPEC_VERSION"/>
+ <enum value="&quot;VK_KHR_get_memory_requirements2&quot;" name="VK_KHR_GET_MEMORY_REQUIREMENTS_2_EXTENSION_NAME"/>
+ <enum extends="VkStructureType" name="VK_STRUCTURE_TYPE_BUFFER_MEMORY_REQUIREMENTS_INFO_2_KHR" alias="VK_STRUCTURE_TYPE_BUFFER_MEMORY_REQUIREMENTS_INFO_2"/>
+ <enum extends="VkStructureType" name="VK_STRUCTURE_TYPE_IMAGE_MEMORY_REQUIREMENTS_INFO_2_KHR" alias="VK_STRUCTURE_TYPE_IMAGE_MEMORY_REQUIREMENTS_INFO_2"/>
+ <enum extends="VkStructureType" name="VK_STRUCTURE_TYPE_IMAGE_SPARSE_MEMORY_REQUIREMENTS_INFO_2_KHR" alias="VK_STRUCTURE_TYPE_IMAGE_SPARSE_MEMORY_REQUIREMENTS_INFO_2"/>
+ <enum extends="VkStructureType" name="VK_STRUCTURE_TYPE_MEMORY_REQUIREMENTS_2_KHR" alias="VK_STRUCTURE_TYPE_MEMORY_REQUIREMENTS_2"/>
+ <enum extends="VkStructureType" name="VK_STRUCTURE_TYPE_SPARSE_IMAGE_MEMORY_REQUIREMENTS_2_KHR" alias="VK_STRUCTURE_TYPE_SPARSE_IMAGE_MEMORY_REQUIREMENTS_2"/>
+ <type name="VkBufferMemoryRequirementsInfo2KHR"/>
+ <type name="VkImageMemoryRequirementsInfo2KHR"/>
+ <type name="VkImageSparseMemoryRequirementsInfo2KHR"/>
+ <type name="VkMemoryRequirements2KHR"/>
+ <type name="VkSparseImageMemoryRequirements2KHR"/>
+ <command name="vkGetImageMemoryRequirements2KHR"/>
+ <command name="vkGetBufferMemoryRequirements2KHR"/>
+ <command name="vkGetImageSparseMemoryRequirements2KHR"/>
+ </require>
+ </extension>
+ <extension name="VK_KHR_image_format_list" number="148" type="device" author="KHR" contact="Jason Ekstrand @jekstrand" supported="vulkan" promotedto="VK_VERSION_1_2">
+ <require>
+ <enum value="1" name="VK_KHR_IMAGE_FORMAT_LIST_SPEC_VERSION"/>
+ <enum value="&quot;VK_KHR_image_format_list&quot;" name="VK_KHR_IMAGE_FORMAT_LIST_EXTENSION_NAME"/>
+ <enum extends="VkStructureType" name="VK_STRUCTURE_TYPE_IMAGE_FORMAT_LIST_CREATE_INFO_KHR" alias="VK_STRUCTURE_TYPE_IMAGE_FORMAT_LIST_CREATE_INFO"/>
+ <type name="VkImageFormatListCreateInfoKHR"/>
+ </require>
+ </extension>
+ <extension name="VK_EXT_blend_operation_advanced" number="149" type="device" author="NV" contact="Jeff Bolz @jeffbolznv" supported="vulkan" requires="VK_KHR_get_physical_device_properties2">
+ <require>
+ <enum value="2" name="VK_EXT_BLEND_OPERATION_ADVANCED_SPEC_VERSION"/>
+ <enum value="&quot;VK_EXT_blend_operation_advanced&quot;" name="VK_EXT_BLEND_OPERATION_ADVANCED_EXTENSION_NAME"/>
+ <enum offset="0" extends="VkStructureType" name="VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_BLEND_OPERATION_ADVANCED_FEATURES_EXT"/>
+ <enum offset="1" extends="VkStructureType" name="VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_BLEND_OPERATION_ADVANCED_PROPERTIES_EXT"/>
+ <enum offset="2" extends="VkStructureType" name="VK_STRUCTURE_TYPE_PIPELINE_COLOR_BLEND_ADVANCED_STATE_CREATE_INFO_EXT"/>
+ <type name="VkPhysicalDeviceBlendOperationAdvancedFeaturesEXT"/>
+ <type name="VkPhysicalDeviceBlendOperationAdvancedPropertiesEXT"/>
+ <type name="VkPipelineColorBlendAdvancedStateCreateInfoEXT"/>
+ <type name="VkBlendOverlapEXT"/>
+ <enum offset="0" extends="VkBlendOp" name="VK_BLEND_OP_ZERO_EXT"/>
+ <enum offset="1" extends="VkBlendOp" name="VK_BLEND_OP_SRC_EXT"/>
+ <enum offset="2" extends="VkBlendOp" name="VK_BLEND_OP_DST_EXT"/>
+ <enum offset="3" extends="VkBlendOp" name="VK_BLEND_OP_SRC_OVER_EXT"/>
+ <enum offset="4" extends="VkBlendOp" name="VK_BLEND_OP_DST_OVER_EXT"/>
+ <enum offset="5" extends="VkBlendOp" name="VK_BLEND_OP_SRC_IN_EXT"/>
+ <enum offset="6" extends="VkBlendOp" name="VK_BLEND_OP_DST_IN_EXT"/>
+ <enum offset="7" extends="VkBlendOp" name="VK_BLEND_OP_SRC_OUT_EXT"/>
+ <enum offset="8" extends="VkBlendOp" name="VK_BLEND_OP_DST_OUT_EXT"/>
+ <enum offset="9" extends="VkBlendOp" name="VK_BLEND_OP_SRC_ATOP_EXT"/>
+ <enum offset="10" extends="VkBlendOp" name="VK_BLEND_OP_DST_ATOP_EXT"/>
+ <enum offset="11" extends="VkBlendOp" name="VK_BLEND_OP_XOR_EXT"/>
+ <enum offset="12" extends="VkBlendOp" name="VK_BLEND_OP_MULTIPLY_EXT"/>
+ <enum offset="13" extends="VkBlendOp" name="VK_BLEND_OP_SCREEN_EXT"/>
+ <enum offset="14" extends="VkBlendOp" name="VK_BLEND_OP_OVERLAY_EXT"/>
+ <enum offset="15" extends="VkBlendOp" name="VK_BLEND_OP_DARKEN_EXT"/>
+ <enum offset="16" extends="VkBlendOp" name="VK_BLEND_OP_LIGHTEN_EXT"/>
+ <enum offset="17" extends="VkBlendOp" name="VK_BLEND_OP_COLORDODGE_EXT"/>
+ <enum offset="18" extends="VkBlendOp" name="VK_BLEND_OP_COLORBURN_EXT"/>
+ <enum offset="19" extends="VkBlendOp" name="VK_BLEND_OP_HARDLIGHT_EXT"/>
+ <enum offset="20" extends="VkBlendOp" name="VK_BLEND_OP_SOFTLIGHT_EXT"/>
+ <enum offset="21" extends="VkBlendOp" name="VK_BLEND_OP_DIFFERENCE_EXT"/>
+ <enum offset="22" extends="VkBlendOp" name="VK_BLEND_OP_EXCLUSION_EXT"/>
+ <enum offset="23" extends="VkBlendOp" name="VK_BLEND_OP_INVERT_EXT"/>
+ <enum offset="24" extends="VkBlendOp" name="VK_BLEND_OP_INVERT_RGB_EXT"/>
+ <enum offset="25" extends="VkBlendOp" name="VK_BLEND_OP_LINEARDODGE_EXT"/>
+ <enum offset="26" extends="VkBlendOp" name="VK_BLEND_OP_LINEARBURN_EXT"/>
+ <enum offset="27" extends="VkBlendOp" name="VK_BLEND_OP_VIVIDLIGHT_EXT"/>
+ <enum offset="28" extends="VkBlendOp" name="VK_BLEND_OP_LINEARLIGHT_EXT"/>
+ <enum offset="29" extends="VkBlendOp" name="VK_BLEND_OP_PINLIGHT_EXT"/>
+ <enum offset="30" extends="VkBlendOp" name="VK_BLEND_OP_HARDMIX_EXT"/>
+ <enum offset="31" extends="VkBlendOp" name="VK_BLEND_OP_HSL_HUE_EXT"/>
+ <enum offset="32" extends="VkBlendOp" name="VK_BLEND_OP_HSL_SATURATION_EXT"/>
+ <enum offset="33" extends="VkBlendOp" name="VK_BLEND_OP_HSL_COLOR_EXT"/>
+ <enum offset="34" extends="VkBlendOp" name="VK_BLEND_OP_HSL_LUMINOSITY_EXT"/>
+ <enum offset="35" extends="VkBlendOp" name="VK_BLEND_OP_PLUS_EXT"/>
+ <enum offset="36" extends="VkBlendOp" name="VK_BLEND_OP_PLUS_CLAMPED_EXT"/>
+ <enum offset="37" extends="VkBlendOp" name="VK_BLEND_OP_PLUS_CLAMPED_ALPHA_EXT"/>
+ <enum offset="38" extends="VkBlendOp" name="VK_BLEND_OP_PLUS_DARKER_EXT"/>
+ <enum offset="39" extends="VkBlendOp" name="VK_BLEND_OP_MINUS_EXT"/>
+ <enum offset="40" extends="VkBlendOp" name="VK_BLEND_OP_MINUS_CLAMPED_EXT"/>
+ <enum offset="41" extends="VkBlendOp" name="VK_BLEND_OP_CONTRAST_EXT"/>
+ <enum offset="42" extends="VkBlendOp" name="VK_BLEND_OP_INVERT_OVG_EXT"/>
+ <enum offset="43" extends="VkBlendOp" name="VK_BLEND_OP_RED_EXT"/>
+ <enum offset="44" extends="VkBlendOp" name="VK_BLEND_OP_GREEN_EXT"/>
+ <enum offset="45" extends="VkBlendOp" name="VK_BLEND_OP_BLUE_EXT"/>
+ <enum bitpos="19" extends="VkAccessFlagBits" name="VK_ACCESS_COLOR_ATTACHMENT_READ_NONCOHERENT_BIT_EXT"/>
+ </require>
+ </extension>
+ <extension name="VK_NV_fragment_coverage_to_color" number="150" type="device" author="NV" contact="Jeff Bolz @jeffbolznv" supported="vulkan">
+ <require>
+ <enum value="1" name="VK_NV_FRAGMENT_COVERAGE_TO_COLOR_SPEC_VERSION"/>
+ <enum value="&quot;VK_NV_fragment_coverage_to_color&quot;" name="VK_NV_FRAGMENT_COVERAGE_TO_COLOR_EXTENSION_NAME"/>
+ <enum offset="0" extends="VkStructureType" name="VK_STRUCTURE_TYPE_PIPELINE_COVERAGE_TO_COLOR_STATE_CREATE_INFO_NV"/>
+ <type name="VkPipelineCoverageToColorStateCreateFlagsNV"/>
+ <type name="VkPipelineCoverageToColorStateCreateInfoNV"/>
+ </require>
+ </extension>
+ <extension name="VK_KHR_acceleration_structure" number="151" type="device" requiresCore="1.1" requires="VK_EXT_descriptor_indexing,VK_KHR_buffer_device_address,VK_KHR_deferred_host_operations" author="KHR" contact="Daniel Koch @dgkoch" supported="vulkan" sortorder="1">
+ <require>
+ <enum value="13" name="VK_KHR_ACCELERATION_STRUCTURE_SPEC_VERSION"/>
+ <enum value="&quot;VK_KHR_acceleration_structure&quot;" name="VK_KHR_ACCELERATION_STRUCTURE_EXTENSION_NAME"/>
+ <enum offset="7" extends="VkStructureType" name="VK_STRUCTURE_TYPE_WRITE_DESCRIPTOR_SET_ACCELERATION_STRUCTURE_KHR"/>
+ <enum offset="0" extends="VkStructureType" name="VK_STRUCTURE_TYPE_ACCELERATION_STRUCTURE_BUILD_GEOMETRY_INFO_KHR"/>
+ <enum offset="2" extends="VkStructureType" name="VK_STRUCTURE_TYPE_ACCELERATION_STRUCTURE_DEVICE_ADDRESS_INFO_KHR"/>
+ <enum offset="3" extends="VkStructureType" name="VK_STRUCTURE_TYPE_ACCELERATION_STRUCTURE_GEOMETRY_AABBS_DATA_KHR"/>
+ <enum offset="4" extends="VkStructureType" name="VK_STRUCTURE_TYPE_ACCELERATION_STRUCTURE_GEOMETRY_INSTANCES_DATA_KHR"/>
+ <enum offset="5" extends="VkStructureType" name="VK_STRUCTURE_TYPE_ACCELERATION_STRUCTURE_GEOMETRY_TRIANGLES_DATA_KHR"/>
+ <enum offset="6" extends="VkStructureType" name="VK_STRUCTURE_TYPE_ACCELERATION_STRUCTURE_GEOMETRY_KHR"/>
+ <enum offset="9" extends="VkStructureType" name="VK_STRUCTURE_TYPE_ACCELERATION_STRUCTURE_VERSION_INFO_KHR"/>
+ <enum offset="10" extends="VkStructureType" name="VK_STRUCTURE_TYPE_COPY_ACCELERATION_STRUCTURE_INFO_KHR"/>
+ <enum offset="11" extends="VkStructureType" name="VK_STRUCTURE_TYPE_COPY_ACCELERATION_STRUCTURE_TO_MEMORY_INFO_KHR"/>
+ <enum offset="12" extends="VkStructureType" name="VK_STRUCTURE_TYPE_COPY_MEMORY_TO_ACCELERATION_STRUCTURE_INFO_KHR"/>
+ <enum offset="13" extends="VkStructureType" name="VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_ACCELERATION_STRUCTURE_FEATURES_KHR"/>
+ <enum offset="14" extends="VkStructureType" name="VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_ACCELERATION_STRUCTURE_PROPERTIES_KHR"/>
+ <enum offset="17" extends="VkStructureType" name="VK_STRUCTURE_TYPE_ACCELERATION_STRUCTURE_CREATE_INFO_KHR"/>
+ <enum offset="20" extends="VkStructureType" name="VK_STRUCTURE_TYPE_ACCELERATION_STRUCTURE_BUILD_SIZES_INFO_KHR"/>
+ <enum bitpos="25" extends="VkPipelineStageFlagBits" name="VK_PIPELINE_STAGE_ACCELERATION_STRUCTURE_BUILD_BIT_KHR"/>
+ <enum offset="0" extends="VkDescriptorType" name="VK_DESCRIPTOR_TYPE_ACCELERATION_STRUCTURE_KHR"/>
+ <enum bitpos="21" extends="VkAccessFlagBits" name="VK_ACCESS_ACCELERATION_STRUCTURE_READ_BIT_KHR"/>
+ <enum bitpos="22" extends="VkAccessFlagBits" name="VK_ACCESS_ACCELERATION_STRUCTURE_WRITE_BIT_KHR"/>
+ <enum offset="0" extends="VkQueryType" name="VK_QUERY_TYPE_ACCELERATION_STRUCTURE_COMPACTED_SIZE_KHR"/>
+ <enum offset="1" extends="VkQueryType" name="VK_QUERY_TYPE_ACCELERATION_STRUCTURE_SERIALIZATION_SIZE_KHR"/>
+ <enum offset="0" extends="VkObjectType" name="VK_OBJECT_TYPE_ACCELERATION_STRUCTURE_KHR"/>
+ <enum offset="0" extends="VkDebugReportObjectTypeEXT" name="VK_DEBUG_REPORT_OBJECT_TYPE_ACCELERATION_STRUCTURE_KHR_EXT"/>
+ <enum offset="0" extends="VkIndexType" extnumber="166" name="VK_INDEX_TYPE_NONE_KHR"/>
+ <enum bitpos="29" extends="VkFormatFeatureFlagBits" name="VK_FORMAT_FEATURE_ACCELERATION_STRUCTURE_VERTEX_BUFFER_BIT_KHR"/>
+ <enum bitpos="19" extends="VkBufferUsageFlagBits" name="VK_BUFFER_USAGE_ACCELERATION_STRUCTURE_BUILD_INPUT_READ_ONLY_BIT_KHR"/>
+ <enum bitpos="20" extends="VkBufferUsageFlagBits" name="VK_BUFFER_USAGE_ACCELERATION_STRUCTURE_STORAGE_BIT_KHR"/>
+ <type name="VkAccelerationStructureTypeKHR"/>
+ <type name="VkDeviceOrHostAddressKHR"/>
+ <type name="VkDeviceOrHostAddressConstKHR"/>
+ <type name="VkAccelerationStructureBuildRangeInfoKHR"/>
+ <type name="VkAabbPositionsKHR"/>
+ <type name="VkAccelerationStructureGeometryTrianglesDataKHR"/>
+ <type name="VkTransformMatrixKHR"/>
+ <type name="VkAccelerationStructureBuildGeometryInfoKHR"/>
+ <type name="VkAccelerationStructureBuildTypeKHR"/>
+ <type name="VkAccelerationStructureGeometryAabbsDataKHR"/>
+ <type name="VkAccelerationStructureInstanceKHR"/>
+ <type name="VkAccelerationStructureGeometryInstancesDataKHR"/>
+ <type name="VkAccelerationStructureGeometryDataKHR"/>
+ <type name="VkAccelerationStructureGeometryKHR"/>
+ <type name="VkGeometryFlagsKHR"/>
+ <type name="VkGeometryInstanceFlagsKHR"/>
+ <type name="VkGeometryFlagBitsKHR"/>
+ <type name="VkGeometryInstanceFlagBitsKHR"/>
+ <type name="VkAccelerationStructureCreateInfoKHR"/>
+ <type name="VkAccelerationStructureKHR"/>
+ <type name="VkBuildAccelerationStructureFlagBitsKHR"/>
+ <type name="VkBuildAccelerationStructureFlagsKHR"/>
+ <type name="VkCopyAccelerationStructureModeKHR"/>
+ <type name="VkGeometryTypeKHR"/>
+ <type name="VkWriteDescriptorSetAccelerationStructureKHR"/>
+ <type name="VkPhysicalDeviceAccelerationStructureFeaturesKHR"/>
+ <type name="VkPhysicalDeviceAccelerationStructurePropertiesKHR"/>
+ <type name="VkAccelerationStructureDeviceAddressInfoKHR"/>
+ <type name="VkAccelerationStructureVersionInfoKHR"/>
+ <type name="VkCopyAccelerationStructureToMemoryInfoKHR"/>
+ <type name="VkCopyMemoryToAccelerationStructureInfoKHR"/>
+ <type name="VkCopyAccelerationStructureInfoKHR"/>
+ <type name="VkAccelerationStructureCompatibilityKHR"/>
+ <type name="VkAccelerationStructureCreateFlagBitsKHR"/>
+ <type name="VkAccelerationStructureCreateFlagsKHR"/>
+ <type name="VkBuildAccelerationStructureModeKHR"/>
+ <type name="VkAccelerationStructureBuildSizesInfoKHR"/>
+ <command name="vkCreateAccelerationStructureKHR"/>
+ <command name="vkDestroyAccelerationStructureKHR"/>
+ <command name="vkCmdBuildAccelerationStructuresKHR"/>
+ <command name="vkCmdBuildAccelerationStructuresIndirectKHR"/>
+ <command name="vkBuildAccelerationStructuresKHR"/>
+ <command name="vkCopyAccelerationStructureKHR"/>
+ <command name="vkCopyAccelerationStructureToMemoryKHR"/>
+ <command name="vkCopyMemoryToAccelerationStructureKHR"/>
+ <command name="vkWriteAccelerationStructuresPropertiesKHR"/>
+ <command name="vkCmdCopyAccelerationStructureKHR"/>
+ <command name="vkCmdCopyAccelerationStructureToMemoryKHR"/>
+ <command name="vkCmdCopyMemoryToAccelerationStructureKHR"/>
+ <command name="vkGetAccelerationStructureDeviceAddressKHR"/>
+ <command name="vkCmdWriteAccelerationStructuresPropertiesKHR"/>
+ <command name="vkGetDeviceAccelerationStructureCompatibilityKHR"/>
+ <command name="vkGetAccelerationStructureBuildSizesKHR"/>
+ </require>
+ <require extension="VK_KHR_format_feature_flags2">
+ <enum bitpos="29" extends="VkFormatFeatureFlagBits2" name="VK_FORMAT_FEATURE_2_ACCELERATION_STRUCTURE_VERTEX_BUFFER_BIT_KHR"/>
+ </require>
+ </extension>
+ <extension name="VK_KHR_ray_tracing_pipeline" number="348" type="device" requiresCore="1.1" requires="VK_KHR_spirv_1_4,VK_KHR_acceleration_structure" author="KHR" contact="Daniel Koch @dgkoch" supported="vulkan" sortorder="1">
+ <require>
+ <enum value="1" name="VK_KHR_RAY_TRACING_PIPELINE_SPEC_VERSION"/>
+ <enum value="&quot;VK_KHR_ray_tracing_pipeline&quot;" name="VK_KHR_RAY_TRACING_PIPELINE_EXTENSION_NAME"/>
+ <enum name="VK_SHADER_UNUSED_KHR"/>
+ <enum offset="0" extends="VkStructureType" name="VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_RAY_TRACING_PIPELINE_FEATURES_KHR"/>
+ <enum offset="1" extends="VkStructureType" name="VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_RAY_TRACING_PIPELINE_PROPERTIES_KHR"/>
+ <enum offset="15" extends="VkStructureType" extnumber="151" name="VK_STRUCTURE_TYPE_RAY_TRACING_PIPELINE_CREATE_INFO_KHR"/>
+ <enum offset="16" extends="VkStructureType" extnumber="151" name="VK_STRUCTURE_TYPE_RAY_TRACING_SHADER_GROUP_CREATE_INFO_KHR"/>
+ <enum offset="18" extends="VkStructureType" extnumber="151" name="VK_STRUCTURE_TYPE_RAY_TRACING_PIPELINE_INTERFACE_CREATE_INFO_KHR"/>
+ <enum bitpos="8" extends="VkShaderStageFlagBits" name="VK_SHADER_STAGE_RAYGEN_BIT_KHR"/>
+ <enum bitpos="9" extends="VkShaderStageFlagBits" name="VK_SHADER_STAGE_ANY_HIT_BIT_KHR"/>
+ <enum bitpos="10" extends="VkShaderStageFlagBits" name="VK_SHADER_STAGE_CLOSEST_HIT_BIT_KHR"/>
+ <enum bitpos="11" extends="VkShaderStageFlagBits" name="VK_SHADER_STAGE_MISS_BIT_KHR"/>
+ <enum bitpos="12" extends="VkShaderStageFlagBits" name="VK_SHADER_STAGE_INTERSECTION_BIT_KHR"/>
+ <enum bitpos="13" extends="VkShaderStageFlagBits" name="VK_SHADER_STAGE_CALLABLE_BIT_KHR"/>
+ <enum bitpos="21" extends="VkPipelineStageFlagBits" name="VK_PIPELINE_STAGE_RAY_TRACING_SHADER_BIT_KHR"/>
+ <enum bitpos="10" extends="VkBufferUsageFlagBits" name="VK_BUFFER_USAGE_SHADER_BINDING_TABLE_BIT_KHR"/>
+ <enum offset="0" extends="VkPipelineBindPoint" extnumber="166" name="VK_PIPELINE_BIND_POINT_RAY_TRACING_KHR"/>
+ <enum bitpos="14" extends="VkPipelineCreateFlagBits" name="VK_PIPELINE_CREATE_RAY_TRACING_NO_NULL_ANY_HIT_SHADERS_BIT_KHR"/>
+ <enum bitpos="15" extends="VkPipelineCreateFlagBits" name="VK_PIPELINE_CREATE_RAY_TRACING_NO_NULL_CLOSEST_HIT_SHADERS_BIT_KHR"/>
+ <enum bitpos="16" extends="VkPipelineCreateFlagBits" name="VK_PIPELINE_CREATE_RAY_TRACING_NO_NULL_MISS_SHADERS_BIT_KHR"/>
+ <enum bitpos="17" extends="VkPipelineCreateFlagBits" name="VK_PIPELINE_CREATE_RAY_TRACING_NO_NULL_INTERSECTION_SHADERS_BIT_KHR"/>
+ <enum bitpos="12" extends="VkPipelineCreateFlagBits" name="VK_PIPELINE_CREATE_RAY_TRACING_SKIP_TRIANGLES_BIT_KHR"/>
+ <enum bitpos="13" extends="VkPipelineCreateFlagBits" name="VK_PIPELINE_CREATE_RAY_TRACING_SKIP_AABBS_BIT_KHR"/>
+ <enum bitpos="19" extends="VkPipelineCreateFlagBits" name="VK_PIPELINE_CREATE_RAY_TRACING_SHADER_GROUP_HANDLE_CAPTURE_REPLAY_BIT_KHR"/>
+ <enum offset="0" extends="VkDynamicState" name="VK_DYNAMIC_STATE_RAY_TRACING_PIPELINE_STACK_SIZE_KHR"/>
+ <type name="VkRayTracingShaderGroupCreateInfoKHR"/>
+ <type name="VkRayTracingShaderGroupTypeKHR"/>
+ <type name="VkRayTracingPipelineCreateInfoKHR"/>
+ <type name="VkPhysicalDeviceRayTracingPipelineFeaturesKHR"/>
+ <type name="VkPhysicalDeviceRayTracingPipelinePropertiesKHR"/>
+ <type name="VkStridedDeviceAddressRegionKHR"/>
+ <type name="VkTraceRaysIndirectCommandKHR"/>
+ <type name="VkRayTracingPipelineInterfaceCreateInfoKHR"/>
+ <type name="VkShaderGroupShaderKHR"/>
+ <command name="vkCmdTraceRaysKHR"/>
+ <command name="vkCreateRayTracingPipelinesKHR"/>
+ <command name="vkGetRayTracingShaderGroupHandlesKHR"/>
+ <command name="vkGetRayTracingCaptureReplayShaderGroupHandlesKHR"/>
+ <command name="vkCmdTraceRaysIndirectKHR"/>
+ <command name="vkGetRayTracingShaderGroupStackSizeKHR"/>
+ <command name="vkCmdSetRayTracingPipelineStackSizeKHR"/>
+ </require>
+ </extension>
+ <extension name="VK_KHR_ray_query" number="349" type="device" requiresCore="1.1" requires="VK_KHR_spirv_1_4,VK_KHR_acceleration_structure" author="KHR" contact="Daniel Koch @dgkoch" supported="vulkan" sortorder="1">
+ <require>
+ <enum value="1" name="VK_KHR_RAY_QUERY_SPEC_VERSION"/>
+ <enum value="&quot;VK_KHR_ray_query&quot;" name="VK_KHR_RAY_QUERY_EXTENSION_NAME"/>
+ <enum offset="13" extends="VkStructureType" name="VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_RAY_QUERY_FEATURES_KHR"/>
+ <type name="VkPhysicalDeviceRayQueryFeaturesKHR"/>
+ </require>
+ </extension>
+ <extension name="VK_NV_extension_152" number="152" author="NV" contact="Jeff Bolz @jeffbolznv" supported="disabled">
+ <require>
+ <enum value="0" name="VK_NV_EXTENSION_152_SPEC_VERSION"/>
+ <enum value="&quot;VK_NV_extension_152&quot;" name="VK_NV_EXTENSION_152_EXTENSION_NAME"/>
+ </require>
+ </extension>
+ <extension name="VK_NV_framebuffer_mixed_samples" number="153" type="device" author="NV" contact="Jeff Bolz @jeffbolznv" supported="vulkan">
+ <require>
+ <enum value="1" name="VK_NV_FRAMEBUFFER_MIXED_SAMPLES_SPEC_VERSION"/>
+ <enum value="&quot;VK_NV_framebuffer_mixed_samples&quot;" name="VK_NV_FRAMEBUFFER_MIXED_SAMPLES_EXTENSION_NAME"/>
+ <enum offset="0" extends="VkStructureType" name="VK_STRUCTURE_TYPE_PIPELINE_COVERAGE_MODULATION_STATE_CREATE_INFO_NV"/>
+ <type name="VkPipelineCoverageModulationStateCreateInfoNV"/>
+ <type name="VkPipelineCoverageModulationStateCreateFlagsNV"/>
+ <type name="VkCoverageModulationModeNV"/>
+ </require>
+ </extension>
+ <extension name="VK_NV_fill_rectangle" number="154" type="device" author="NV" contact="Jeff Bolz @jeffbolznv" supported="vulkan">
+ <require>
+ <enum value="1" name="VK_NV_FILL_RECTANGLE_SPEC_VERSION"/>
+ <enum value="&quot;VK_NV_fill_rectangle&quot;" name="VK_NV_FILL_RECTANGLE_EXTENSION_NAME"/>
+ <enum offset="0" extends="VkPolygonMode" name="VK_POLYGON_MODE_FILL_RECTANGLE_NV"/>
+ </require>
+ </extension>
+ <extension name="VK_NV_shader_sm_builtins" number="155" type="device" requiresCore="1.1" author="NV" contact="Daniel Koch @dgkoch" supported="vulkan">
+ <require>
+ <enum value="1" name="VK_NV_SHADER_SM_BUILTINS_SPEC_VERSION"/>
+ <enum value="&quot;VK_NV_shader_sm_builtins&quot;" name="VK_NV_SHADER_SM_BUILTINS_EXTENSION_NAME"/>
+ <enum offset="0" extends="VkStructureType" name="VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_SHADER_SM_BUILTINS_FEATURES_NV"/>
+ <enum offset="1" extends="VkStructureType" name="VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_SHADER_SM_BUILTINS_PROPERTIES_NV"/>
+ <type name="VkPhysicalDeviceShaderSMBuiltinsPropertiesNV"/>
+ <type name="VkPhysicalDeviceShaderSMBuiltinsFeaturesNV"/>
+ </require>
+ </extension>
+ <extension name="VK_EXT_post_depth_coverage" number="156" type="device" author="NV" contact="Daniel Koch @dgkoch" supported="vulkan">
+ <require>
+ <enum value="1" name="VK_EXT_POST_DEPTH_COVERAGE_SPEC_VERSION"/>
+ <enum value="&quot;VK_EXT_post_depth_coverage&quot;" name="VK_EXT_POST_DEPTH_COVERAGE_EXTENSION_NAME"/>
+ </require>
+ </extension>
+ <extension name="VK_KHR_sampler_ycbcr_conversion" number="157" type="device" requires="VK_KHR_maintenance1,VK_KHR_bind_memory2,VK_KHR_get_memory_requirements2,VK_KHR_get_physical_device_properties2" author="KHR" contact="Andrew Garrard @fluppeteer" supported="vulkan" promotedto="VK_VERSION_1_1">
+ <require>
+ <enum value="14" name="VK_KHR_SAMPLER_YCBCR_CONVERSION_SPEC_VERSION"/>
+ <enum value="&quot;VK_KHR_sampler_ycbcr_conversion&quot;" name="VK_KHR_SAMPLER_YCBCR_CONVERSION_EXTENSION_NAME"/>
+ <enum extends="VkStructureType" name="VK_STRUCTURE_TYPE_SAMPLER_YCBCR_CONVERSION_CREATE_INFO_KHR" alias="VK_STRUCTURE_TYPE_SAMPLER_YCBCR_CONVERSION_CREATE_INFO"/>
+ <enum extends="VkStructureType" name="VK_STRUCTURE_TYPE_SAMPLER_YCBCR_CONVERSION_INFO_KHR" alias="VK_STRUCTURE_TYPE_SAMPLER_YCBCR_CONVERSION_INFO"/>
+ <enum extends="VkStructureType" name="VK_STRUCTURE_TYPE_BIND_IMAGE_PLANE_MEMORY_INFO_KHR" alias="VK_STRUCTURE_TYPE_BIND_IMAGE_PLANE_MEMORY_INFO"/>
+ <enum extends="VkStructureType" name="VK_STRUCTURE_TYPE_IMAGE_PLANE_MEMORY_REQUIREMENTS_INFO_KHR" alias="VK_STRUCTURE_TYPE_IMAGE_PLANE_MEMORY_REQUIREMENTS_INFO"/>
+ <enum extends="VkStructureType" name="VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_SAMPLER_YCBCR_CONVERSION_FEATURES_KHR" alias="VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_SAMPLER_YCBCR_CONVERSION_FEATURES"/>
+ <enum extends="VkStructureType" name="VK_STRUCTURE_TYPE_SAMPLER_YCBCR_CONVERSION_IMAGE_FORMAT_PROPERTIES_KHR" alias="VK_STRUCTURE_TYPE_SAMPLER_YCBCR_CONVERSION_IMAGE_FORMAT_PROPERTIES"/>
+ <enum extends="VkDebugReportObjectTypeEXT" name="VK_DEBUG_REPORT_OBJECT_TYPE_SAMPLER_YCBCR_CONVERSION_KHR_EXT" alias="VK_DEBUG_REPORT_OBJECT_TYPE_SAMPLER_YCBCR_CONVERSION_EXT"/>
+ <enum extends="VkObjectType" name="VK_OBJECT_TYPE_SAMPLER_YCBCR_CONVERSION_KHR" alias="VK_OBJECT_TYPE_SAMPLER_YCBCR_CONVERSION"/>
+ <enum extends="VkFormat" name="VK_FORMAT_G8B8G8R8_422_UNORM_KHR" alias="VK_FORMAT_G8B8G8R8_422_UNORM"/>
+ <enum extends="VkFormat" name="VK_FORMAT_B8G8R8G8_422_UNORM_KHR" alias="VK_FORMAT_B8G8R8G8_422_UNORM"/>
+ <enum extends="VkFormat" name="VK_FORMAT_G8_B8_R8_3PLANE_420_UNORM_KHR" alias="VK_FORMAT_G8_B8_R8_3PLANE_420_UNORM"/>
+ <enum extends="VkFormat" name="VK_FORMAT_G8_B8R8_2PLANE_420_UNORM_KHR" alias="VK_FORMAT_G8_B8R8_2PLANE_420_UNORM"/>
+ <enum extends="VkFormat" name="VK_FORMAT_G8_B8_R8_3PLANE_422_UNORM_KHR" alias="VK_FORMAT_G8_B8_R8_3PLANE_422_UNORM"/>
+ <enum extends="VkFormat" name="VK_FORMAT_G8_B8R8_2PLANE_422_UNORM_KHR" alias="VK_FORMAT_G8_B8R8_2PLANE_422_UNORM"/>
+ <enum extends="VkFormat" name="VK_FORMAT_G8_B8_R8_3PLANE_444_UNORM_KHR" alias="VK_FORMAT_G8_B8_R8_3PLANE_444_UNORM"/>
+ <enum extends="VkFormat" name="VK_FORMAT_R10X6_UNORM_PACK16_KHR" alias="VK_FORMAT_R10X6_UNORM_PACK16"/>
+ <enum extends="VkFormat" name="VK_FORMAT_R10X6G10X6_UNORM_2PACK16_KHR" alias="VK_FORMAT_R10X6G10X6_UNORM_2PACK16"/>
+ <enum extends="VkFormat" name="VK_FORMAT_R10X6G10X6B10X6A10X6_UNORM_4PACK16_KHR" alias="VK_FORMAT_R10X6G10X6B10X6A10X6_UNORM_4PACK16"/>
+ <enum extends="VkFormat" name="VK_FORMAT_G10X6B10X6G10X6R10X6_422_UNORM_4PACK16_KHR" alias="VK_FORMAT_G10X6B10X6G10X6R10X6_422_UNORM_4PACK16"/>
+ <enum extends="VkFormat" name="VK_FORMAT_B10X6G10X6R10X6G10X6_422_UNORM_4PACK16_KHR" alias="VK_FORMAT_B10X6G10X6R10X6G10X6_422_UNORM_4PACK16"/>
+ <enum extends="VkFormat" name="VK_FORMAT_G10X6_B10X6_R10X6_3PLANE_420_UNORM_3PACK16_KHR" alias="VK_FORMAT_G10X6_B10X6_R10X6_3PLANE_420_UNORM_3PACK16"/>
+ <enum extends="VkFormat" name="VK_FORMAT_G10X6_B10X6R10X6_2PLANE_420_UNORM_3PACK16_KHR" alias="VK_FORMAT_G10X6_B10X6R10X6_2PLANE_420_UNORM_3PACK16"/>
+ <enum extends="VkFormat" name="VK_FORMAT_G10X6_B10X6_R10X6_3PLANE_422_UNORM_3PACK16_KHR" alias="VK_FORMAT_G10X6_B10X6_R10X6_3PLANE_422_UNORM_3PACK16"/>
+ <enum extends="VkFormat" name="VK_FORMAT_G10X6_B10X6R10X6_2PLANE_422_UNORM_3PACK16_KHR" alias="VK_FORMAT_G10X6_B10X6R10X6_2PLANE_422_UNORM_3PACK16"/>
+ <enum extends="VkFormat" name="VK_FORMAT_G10X6_B10X6_R10X6_3PLANE_444_UNORM_3PACK16_KHR" alias="VK_FORMAT_G10X6_B10X6_R10X6_3PLANE_444_UNORM_3PACK16"/>
+ <enum extends="VkFormat" name="VK_FORMAT_R12X4_UNORM_PACK16_KHR" alias="VK_FORMAT_R12X4_UNORM_PACK16"/>
+ <enum extends="VkFormat" name="VK_FORMAT_R12X4G12X4_UNORM_2PACK16_KHR" alias="VK_FORMAT_R12X4G12X4_UNORM_2PACK16"/>
+ <enum extends="VkFormat" name="VK_FORMAT_R12X4G12X4B12X4A12X4_UNORM_4PACK16_KHR" alias="VK_FORMAT_R12X4G12X4B12X4A12X4_UNORM_4PACK16"/>
+ <enum extends="VkFormat" name="VK_FORMAT_G12X4B12X4G12X4R12X4_422_UNORM_4PACK16_KHR" alias="VK_FORMAT_G12X4B12X4G12X4R12X4_422_UNORM_4PACK16"/>
+ <enum extends="VkFormat" name="VK_FORMAT_B12X4G12X4R12X4G12X4_422_UNORM_4PACK16_KHR" alias="VK_FORMAT_B12X4G12X4R12X4G12X4_422_UNORM_4PACK16"/>
+ <enum extends="VkFormat" name="VK_FORMAT_G12X4_B12X4_R12X4_3PLANE_420_UNORM_3PACK16_KHR" alias="VK_FORMAT_G12X4_B12X4_R12X4_3PLANE_420_UNORM_3PACK16"/>
+ <enum extends="VkFormat" name="VK_FORMAT_G12X4_B12X4R12X4_2PLANE_420_UNORM_3PACK16_KHR" alias="VK_FORMAT_G12X4_B12X4R12X4_2PLANE_420_UNORM_3PACK16"/>
+ <enum extends="VkFormat" name="VK_FORMAT_G12X4_B12X4_R12X4_3PLANE_422_UNORM_3PACK16_KHR" alias="VK_FORMAT_G12X4_B12X4_R12X4_3PLANE_422_UNORM_3PACK16"/>
+ <enum extends="VkFormat" name="VK_FORMAT_G12X4_B12X4R12X4_2PLANE_422_UNORM_3PACK16_KHR" alias="VK_FORMAT_G12X4_B12X4R12X4_2PLANE_422_UNORM_3PACK16"/>
+ <enum extends="VkFormat" name="VK_FORMAT_G12X4_B12X4_R12X4_3PLANE_444_UNORM_3PACK16_KHR" alias="VK_FORMAT_G12X4_B12X4_R12X4_3PLANE_444_UNORM_3PACK16"/>
+ <enum extends="VkFormat" name="VK_FORMAT_G16B16G16R16_422_UNORM_KHR" alias="VK_FORMAT_G16B16G16R16_422_UNORM"/>
+ <enum extends="VkFormat" name="VK_FORMAT_B16G16R16G16_422_UNORM_KHR" alias="VK_FORMAT_B16G16R16G16_422_UNORM"/>
+ <enum extends="VkFormat" name="VK_FORMAT_G16_B16_R16_3PLANE_420_UNORM_KHR" alias="VK_FORMAT_G16_B16_R16_3PLANE_420_UNORM"/>
+ <enum extends="VkFormat" name="VK_FORMAT_G16_B16R16_2PLANE_420_UNORM_KHR" alias="VK_FORMAT_G16_B16R16_2PLANE_420_UNORM"/>
+ <enum extends="VkFormat" name="VK_FORMAT_G16_B16_R16_3PLANE_422_UNORM_KHR" alias="VK_FORMAT_G16_B16_R16_3PLANE_422_UNORM"/>
+ <enum extends="VkFormat" name="VK_FORMAT_G16_B16R16_2PLANE_422_UNORM_KHR" alias="VK_FORMAT_G16_B16R16_2PLANE_422_UNORM"/>
+ <enum extends="VkFormat" name="VK_FORMAT_G16_B16_R16_3PLANE_444_UNORM_KHR" alias="VK_FORMAT_G16_B16_R16_3PLANE_444_UNORM"/>
+ <enum extends="VkImageAspectFlagBits" name="VK_IMAGE_ASPECT_PLANE_0_BIT_KHR" alias="VK_IMAGE_ASPECT_PLANE_0_BIT"/>
+ <enum extends="VkImageAspectFlagBits" name="VK_IMAGE_ASPECT_PLANE_1_BIT_KHR" alias="VK_IMAGE_ASPECT_PLANE_1_BIT"/>
+ <enum extends="VkImageAspectFlagBits" name="VK_IMAGE_ASPECT_PLANE_2_BIT_KHR" alias="VK_IMAGE_ASPECT_PLANE_2_BIT"/>
+ <enum extends="VkImageCreateFlagBits" name="VK_IMAGE_CREATE_DISJOINT_BIT_KHR" alias="VK_IMAGE_CREATE_DISJOINT_BIT"/>
+ <enum extends="VkFormatFeatureFlagBits" name="VK_FORMAT_FEATURE_MIDPOINT_CHROMA_SAMPLES_BIT_KHR" alias="VK_FORMAT_FEATURE_MIDPOINT_CHROMA_SAMPLES_BIT"/>
+ <enum extends="VkFormatFeatureFlagBits" name="VK_FORMAT_FEATURE_SAMPLED_IMAGE_YCBCR_CONVERSION_LINEAR_FILTER_BIT_KHR" alias="VK_FORMAT_FEATURE_SAMPLED_IMAGE_YCBCR_CONVERSION_LINEAR_FILTER_BIT"/>
+ <enum extends="VkFormatFeatureFlagBits" name="VK_FORMAT_FEATURE_SAMPLED_IMAGE_YCBCR_CONVERSION_SEPARATE_RECONSTRUCTION_FILTER_BIT_KHR" alias="VK_FORMAT_FEATURE_SAMPLED_IMAGE_YCBCR_CONVERSION_SEPARATE_RECONSTRUCTION_FILTER_BIT"/>
+ <enum extends="VkFormatFeatureFlagBits" name="VK_FORMAT_FEATURE_SAMPLED_IMAGE_YCBCR_CONVERSION_CHROMA_RECONSTRUCTION_EXPLICIT_BIT_KHR" alias="VK_FORMAT_FEATURE_SAMPLED_IMAGE_YCBCR_CONVERSION_CHROMA_RECONSTRUCTION_EXPLICIT_BIT"/>
+ <enum extends="VkFormatFeatureFlagBits" name="VK_FORMAT_FEATURE_SAMPLED_IMAGE_YCBCR_CONVERSION_CHROMA_RECONSTRUCTION_EXPLICIT_FORCEABLE_BIT_KHR" alias="VK_FORMAT_FEATURE_SAMPLED_IMAGE_YCBCR_CONVERSION_CHROMA_RECONSTRUCTION_EXPLICIT_FORCEABLE_BIT"/>
+ <enum extends="VkFormatFeatureFlagBits" name="VK_FORMAT_FEATURE_DISJOINT_BIT_KHR" alias="VK_FORMAT_FEATURE_DISJOINT_BIT"/>
+ <enum extends="VkFormatFeatureFlagBits" name="VK_FORMAT_FEATURE_COSITED_CHROMA_SAMPLES_BIT_KHR" alias="VK_FORMAT_FEATURE_COSITED_CHROMA_SAMPLES_BIT"/>
+ <type name="VkSamplerYcbcrConversionCreateInfoKHR"/>
+ <type name="VkSamplerYcbcrConversionInfoKHR"/>
+ <type name="VkBindImagePlaneMemoryInfoKHR"/>
+ <type name="VkImagePlaneMemoryRequirementsInfoKHR"/>
+ <type name="VkPhysicalDeviceSamplerYcbcrConversionFeaturesKHR"/>
+ <type name="VkSamplerYcbcrConversionImageFormatPropertiesKHR"/>
+ <command name="vkCreateSamplerYcbcrConversionKHR"/>
+ <command name="vkDestroySamplerYcbcrConversionKHR"/>
+ <type name="VkSamplerYcbcrConversionKHR"/>
+ <type name="VkSamplerYcbcrModelConversionKHR"/>
+ <enum extends="VkSamplerYcbcrModelConversion" name="VK_SAMPLER_YCBCR_MODEL_CONVERSION_RGB_IDENTITY_KHR" alias="VK_SAMPLER_YCBCR_MODEL_CONVERSION_RGB_IDENTITY"/>
+ <enum extends="VkSamplerYcbcrModelConversion" name="VK_SAMPLER_YCBCR_MODEL_CONVERSION_YCBCR_IDENTITY_KHR" alias="VK_SAMPLER_YCBCR_MODEL_CONVERSION_YCBCR_IDENTITY"/>
+ <enum extends="VkSamplerYcbcrModelConversion" name="VK_SAMPLER_YCBCR_MODEL_CONVERSION_YCBCR_709_KHR" alias="VK_SAMPLER_YCBCR_MODEL_CONVERSION_YCBCR_709"/>
+ <enum extends="VkSamplerYcbcrModelConversion" name="VK_SAMPLER_YCBCR_MODEL_CONVERSION_YCBCR_601_KHR" alias="VK_SAMPLER_YCBCR_MODEL_CONVERSION_YCBCR_601"/>
+ <enum extends="VkSamplerYcbcrModelConversion" name="VK_SAMPLER_YCBCR_MODEL_CONVERSION_YCBCR_2020_KHR" alias="VK_SAMPLER_YCBCR_MODEL_CONVERSION_YCBCR_2020"/>
+ <type name="VkSamplerYcbcrRangeKHR"/>
+ <enum extends="VkSamplerYcbcrRange" name="VK_SAMPLER_YCBCR_RANGE_ITU_FULL_KHR" alias="VK_SAMPLER_YCBCR_RANGE_ITU_FULL"/>
+ <enum extends="VkSamplerYcbcrRange" name="VK_SAMPLER_YCBCR_RANGE_ITU_NARROW_KHR" alias="VK_SAMPLER_YCBCR_RANGE_ITU_NARROW"/>
+ <type name="VkChromaLocationKHR"/>
+ <enum extends="VkChromaLocation" name="VK_CHROMA_LOCATION_COSITED_EVEN_KHR" alias="VK_CHROMA_LOCATION_COSITED_EVEN"/>
+ <enum extends="VkChromaLocation" name="VK_CHROMA_LOCATION_MIDPOINT_KHR" alias="VK_CHROMA_LOCATION_MIDPOINT"/>
+ </require>
+ <require extension="VK_EXT_debug_report">
+ <enum extends="VkDebugReportObjectTypeEXT" offset="0" name="VK_DEBUG_REPORT_OBJECT_TYPE_SAMPLER_YCBCR_CONVERSION_EXT"/>
+ </require>
+ </extension>
+ <extension name="VK_KHR_bind_memory2" number="158" type="device" author="KHR" contact="Tobias Hector @tobski" supported="vulkan" promotedto="VK_VERSION_1_1">
+ <require>
+ <enum value="1" name="VK_KHR_BIND_MEMORY_2_SPEC_VERSION"/>
+ <enum value="&quot;VK_KHR_bind_memory2&quot;" name="VK_KHR_BIND_MEMORY_2_EXTENSION_NAME"/>
+ <command name="vkBindBufferMemory2KHR"/>
+ <command name="vkBindImageMemory2KHR"/>
+ <enum extends="VkStructureType" name="VK_STRUCTURE_TYPE_BIND_BUFFER_MEMORY_INFO_KHR" alias="VK_STRUCTURE_TYPE_BIND_BUFFER_MEMORY_INFO"/>
+ <enum extends="VkStructureType" name="VK_STRUCTURE_TYPE_BIND_IMAGE_MEMORY_INFO_KHR" alias="VK_STRUCTURE_TYPE_BIND_IMAGE_MEMORY_INFO"/>
+ <enum extends="VkImageCreateFlagBits" name="VK_IMAGE_CREATE_ALIAS_BIT_KHR" alias="VK_IMAGE_CREATE_ALIAS_BIT"/>
+ <type name="VkBindBufferMemoryInfoKHR"/>
+ <type name="VkBindImageMemoryInfoKHR"/>
+ </require>
+ </extension>
+ <extension name="VK_EXT_image_drm_format_modifier" number="159" type="device" requires="VK_KHR_bind_memory2,VK_KHR_get_physical_device_properties2,VK_KHR_image_format_list,VK_KHR_sampler_ycbcr_conversion" author="EXT" contact="Chad Versace @chadversary" supported="vulkan">
+ <require>
+ <enum value="2" name="VK_EXT_IMAGE_DRM_FORMAT_MODIFIER_SPEC_VERSION"/>
+ <enum value="&quot;VK_EXT_image_drm_format_modifier&quot;" name="VK_EXT_IMAGE_DRM_FORMAT_MODIFIER_EXTENSION_NAME"/>
+ <enum offset="0" dir="-" extends="VkResult" name="VK_ERROR_INVALID_DRM_FORMAT_MODIFIER_PLANE_LAYOUT_EXT"/>
+ <enum offset="0" extends="VkStructureType" name="VK_STRUCTURE_TYPE_DRM_FORMAT_MODIFIER_PROPERTIES_LIST_EXT"/>
+ <enum offset="2" extends="VkStructureType" name="VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_IMAGE_DRM_FORMAT_MODIFIER_INFO_EXT"/>
+ <enum offset="3" extends="VkStructureType" name="VK_STRUCTURE_TYPE_IMAGE_DRM_FORMAT_MODIFIER_LIST_CREATE_INFO_EXT"/>
+ <enum offset="4" extends="VkStructureType" name="VK_STRUCTURE_TYPE_IMAGE_DRM_FORMAT_MODIFIER_EXPLICIT_CREATE_INFO_EXT"/>
+ <enum offset="5" extends="VkStructureType" name="VK_STRUCTURE_TYPE_IMAGE_DRM_FORMAT_MODIFIER_PROPERTIES_EXT"/>
+ <enum offset="0" extends="VkImageTiling" name="VK_IMAGE_TILING_DRM_FORMAT_MODIFIER_EXT"/>
+ <enum bitpos="7" extends="VkImageAspectFlagBits" name="VK_IMAGE_ASPECT_MEMORY_PLANE_0_BIT_EXT"/>
+ <enum bitpos="8" extends="VkImageAspectFlagBits" name="VK_IMAGE_ASPECT_MEMORY_PLANE_1_BIT_EXT"/>
+ <enum bitpos="9" extends="VkImageAspectFlagBits" name="VK_IMAGE_ASPECT_MEMORY_PLANE_2_BIT_EXT"/>
+ <enum bitpos="10" extends="VkImageAspectFlagBits" name="VK_IMAGE_ASPECT_MEMORY_PLANE_3_BIT_EXT"/>
+ <type name="VkDrmFormatModifierPropertiesListEXT"/>
+ <type name="VkDrmFormatModifierPropertiesEXT"/>
+ <type name="VkPhysicalDeviceImageDrmFormatModifierInfoEXT"/>
+ <type name="VkImageDrmFormatModifierListCreateInfoEXT"/>
+ <type name="VkImageDrmFormatModifierExplicitCreateInfoEXT"/>
+ <type name="VkImageDrmFormatModifierPropertiesEXT"/>
+ <command name="vkGetImageDrmFormatModifierPropertiesEXT"/>
+ </require>
+ <require extension="VK_KHR_format_feature_flags2">
+ <type name="VkDrmFormatModifierPropertiesList2EXT"/>
+ <type name="VkDrmFormatModifierProperties2EXT"/>
+ <enum offset="6" extends="VkStructureType" name="VK_STRUCTURE_TYPE_DRM_FORMAT_MODIFIER_PROPERTIES_LIST_2_EXT"/>
+ </require>
+ </extension>
+ <extension name="VK_EXT_extension_160" number="160" author="EXT" contact="Mark Young @marky-lunarg" supported="disabled">
+ <require>
+ <enum value="0" name="VK_EXT_EXTENSION_160_SPEC_VERSION"/>
+ <enum value="&quot;VK_EXT_extension_160&quot;" name="VK_EXT_EXTENSION_160_EXTENSION_NAME"/>
+ </require>
+ </extension>
+ <extension name="VK_EXT_validation_cache" number="161" type="device" author="GOOGLE" contact="Cort Stratton @cdwfs" supported="vulkan">
+ <require>
+ <enum value="1" name="VK_EXT_VALIDATION_CACHE_SPEC_VERSION"/>
+ <enum value="&quot;VK_EXT_validation_cache&quot;" name="VK_EXT_VALIDATION_CACHE_EXTENSION_NAME"/>
+ <enum offset="0" extends="VkStructureType" name="VK_STRUCTURE_TYPE_VALIDATION_CACHE_CREATE_INFO_EXT"/>
+ <enum offset="1" extends="VkStructureType" name="VK_STRUCTURE_TYPE_SHADER_MODULE_VALIDATION_CACHE_CREATE_INFO_EXT"/>
+ <enum offset="0" extends="VkObjectType" name="VK_OBJECT_TYPE_VALIDATION_CACHE_EXT"/>
+ <type name="VkValidationCacheEXT"/>
+ <type name="VkValidationCacheCreateInfoEXT"/>
+ <type name="VkShaderModuleValidationCacheCreateInfoEXT"/>
+ <type name="VkValidationCacheHeaderVersionEXT"/>
+ <type name="VkValidationCacheCreateFlagsEXT"/>
+ <command name="vkCreateValidationCacheEXT"/>
+ <command name="vkDestroyValidationCacheEXT"/>
+ <command name="vkMergeValidationCachesEXT"/>
+ <command name="vkGetValidationCacheDataEXT"/>
+ </require>
+ </extension>
+ <extension name="VK_EXT_descriptor_indexing" number="162" type="device" requires="VK_KHR_get_physical_device_properties2,VK_KHR_maintenance3" author="NV" contact="Jeff Bolz @jeffbolznv" supported="vulkan" promotedto="VK_VERSION_1_2">
+ <require>
+ <enum value="2" name="VK_EXT_DESCRIPTOR_INDEXING_SPEC_VERSION"/>
+ <enum value="&quot;VK_EXT_descriptor_indexing&quot;" name="VK_EXT_DESCRIPTOR_INDEXING_EXTENSION_NAME"/>
+ <enum extends="VkStructureType" name="VK_STRUCTURE_TYPE_DESCRIPTOR_SET_LAYOUT_BINDING_FLAGS_CREATE_INFO_EXT" alias="VK_STRUCTURE_TYPE_DESCRIPTOR_SET_LAYOUT_BINDING_FLAGS_CREATE_INFO"/>
+ <enum extends="VkStructureType" name="VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_DESCRIPTOR_INDEXING_FEATURES_EXT" alias="VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_DESCRIPTOR_INDEXING_FEATURES"/>
+ <enum extends="VkStructureType" name="VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_DESCRIPTOR_INDEXING_PROPERTIES_EXT" alias="VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_DESCRIPTOR_INDEXING_PROPERTIES"/>
+ <enum extends="VkStructureType" name="VK_STRUCTURE_TYPE_DESCRIPTOR_SET_VARIABLE_DESCRIPTOR_COUNT_ALLOCATE_INFO_EXT" alias="VK_STRUCTURE_TYPE_DESCRIPTOR_SET_VARIABLE_DESCRIPTOR_COUNT_ALLOCATE_INFO"/>
+ <enum extends="VkStructureType" name="VK_STRUCTURE_TYPE_DESCRIPTOR_SET_VARIABLE_DESCRIPTOR_COUNT_LAYOUT_SUPPORT_EXT" alias="VK_STRUCTURE_TYPE_DESCRIPTOR_SET_VARIABLE_DESCRIPTOR_COUNT_LAYOUT_SUPPORT"/>
+ <enum extends="VkDescriptorBindingFlagBits" name="VK_DESCRIPTOR_BINDING_UPDATE_AFTER_BIND_BIT_EXT" alias="VK_DESCRIPTOR_BINDING_UPDATE_AFTER_BIND_BIT"/>
+ <enum extends="VkDescriptorBindingFlagBits" name="VK_DESCRIPTOR_BINDING_UPDATE_UNUSED_WHILE_PENDING_BIT_EXT" alias="VK_DESCRIPTOR_BINDING_UPDATE_UNUSED_WHILE_PENDING_BIT"/>
+ <enum extends="VkDescriptorBindingFlagBits" name="VK_DESCRIPTOR_BINDING_PARTIALLY_BOUND_BIT_EXT" alias="VK_DESCRIPTOR_BINDING_PARTIALLY_BOUND_BIT"/>
+ <enum extends="VkDescriptorBindingFlagBits" name="VK_DESCRIPTOR_BINDING_VARIABLE_DESCRIPTOR_COUNT_BIT_EXT" alias="VK_DESCRIPTOR_BINDING_VARIABLE_DESCRIPTOR_COUNT_BIT"/>
+ <enum extends="VkDescriptorPoolCreateFlagBits" name="VK_DESCRIPTOR_POOL_CREATE_UPDATE_AFTER_BIND_BIT_EXT" alias="VK_DESCRIPTOR_POOL_CREATE_UPDATE_AFTER_BIND_BIT"/>
+ <enum extends="VkDescriptorSetLayoutCreateFlagBits" name="VK_DESCRIPTOR_SET_LAYOUT_CREATE_UPDATE_AFTER_BIND_POOL_BIT_EXT" alias="VK_DESCRIPTOR_SET_LAYOUT_CREATE_UPDATE_AFTER_BIND_POOL_BIT"/>
+ <enum extends="VkResult" name="VK_ERROR_FRAGMENTATION_EXT" alias="VK_ERROR_FRAGMENTATION"/>
+ <type name="VkDescriptorSetLayoutBindingFlagsCreateInfoEXT"/>
+ <type name="VkPhysicalDeviceDescriptorIndexingFeaturesEXT"/>
+ <type name="VkPhysicalDeviceDescriptorIndexingPropertiesEXT"/>
+ <type name="VkDescriptorSetVariableDescriptorCountAllocateInfoEXT"/>
+ <type name="VkDescriptorSetVariableDescriptorCountLayoutSupportEXT"/>
+ <type name="VkDescriptorBindingFlagBitsEXT"/>
+ <type name="VkDescriptorBindingFlagsEXT"/>
+ </require>
+ </extension>
+ <extension name="VK_EXT_shader_viewport_index_layer" number="163" type="device" author="NV" contact="Daniel Koch @dgkoch" supported="vulkan" promotedto="VK_VERSION_1_2">
+ <require>
+ <enum value="1" name="VK_EXT_SHADER_VIEWPORT_INDEX_LAYER_SPEC_VERSION"/>
+ <enum value="&quot;VK_EXT_shader_viewport_index_layer&quot;" name="VK_EXT_SHADER_VIEWPORT_INDEX_LAYER_EXTENSION_NAME"/>
+ </require>
+ </extension>
+ <extension name="VK_KHR_portability_subset" number="164" type="device" requires="VK_KHR_get_physical_device_properties2" author="KHR" contact="Bill Hollings @billhollings" platform="provisional" supported="vulkan" provisional="true">
+ <require>
+ <enum value="1" name="VK_KHR_PORTABILITY_SUBSET_SPEC_VERSION"/>
+ <enum value="&quot;VK_KHR_portability_subset&quot;" name="VK_KHR_PORTABILITY_SUBSET_EXTENSION_NAME"/>
+ <enum offset="0" extends="VkStructureType" name="VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_PORTABILITY_SUBSET_FEATURES_KHR" protect="VK_ENABLE_BETA_EXTENSIONS"/>
+ <enum offset="1" extends="VkStructureType" name="VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_PORTABILITY_SUBSET_PROPERTIES_KHR" protect="VK_ENABLE_BETA_EXTENSIONS"/>
+ <type name="VkPhysicalDevicePortabilitySubsetFeaturesKHR"/>
+ <type name="VkPhysicalDevicePortabilitySubsetPropertiesKHR"/>
+ </require>
+ </extension>
+ <extension name="VK_NV_shading_rate_image" number="165" type="device" requires="VK_KHR_get_physical_device_properties2" author="NV" contact="Pat Brown @nvpbrown" supported="vulkan">
+ <require>
+ <enum value="3" name="VK_NV_SHADING_RATE_IMAGE_SPEC_VERSION"/>
+ <enum value="&quot;VK_NV_shading_rate_image&quot;" name="VK_NV_SHADING_RATE_IMAGE_EXTENSION_NAME"/>
+ <enum offset="0" extends="VkStructureType" name="VK_STRUCTURE_TYPE_PIPELINE_VIEWPORT_SHADING_RATE_IMAGE_STATE_CREATE_INFO_NV"/>
+ <enum offset="1" extends="VkStructureType" name="VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_SHADING_RATE_IMAGE_FEATURES_NV"/>
+ <enum offset="2" extends="VkStructureType" name="VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_SHADING_RATE_IMAGE_PROPERTIES_NV"/>
+ <enum extends="VkImageLayout" name="VK_IMAGE_LAYOUT_SHADING_RATE_OPTIMAL_NV" alias="VK_IMAGE_LAYOUT_FRAGMENT_SHADING_RATE_ATTACHMENT_OPTIMAL_KHR"/>
+ <enum offset="4" extends="VkDynamicState" name="VK_DYNAMIC_STATE_VIEWPORT_SHADING_RATE_PALETTE_NV"/>
+ <enum extends="VkAccessFlagBits" name="VK_ACCESS_SHADING_RATE_IMAGE_READ_BIT_NV" alias="VK_ACCESS_FRAGMENT_SHADING_RATE_ATTACHMENT_READ_BIT_KHR"/>
+ <enum extends="VkImageUsageFlagBits" name="VK_IMAGE_USAGE_SHADING_RATE_IMAGE_BIT_NV" alias="VK_IMAGE_USAGE_FRAGMENT_SHADING_RATE_ATTACHMENT_BIT_KHR"/>
+ <enum extends="VkPipelineStageFlagBits" name="VK_PIPELINE_STAGE_SHADING_RATE_IMAGE_BIT_NV" alias="VK_PIPELINE_STAGE_FRAGMENT_SHADING_RATE_ATTACHMENT_BIT_KHR"/>
+ <enum offset="5" extends="VkStructureType" name="VK_STRUCTURE_TYPE_PIPELINE_VIEWPORT_COARSE_SAMPLE_ORDER_STATE_CREATE_INFO_NV"/>
+ <enum offset="6" extends="VkDynamicState" name="VK_DYNAMIC_STATE_VIEWPORT_COARSE_SAMPLE_ORDER_NV"/>
+ <type name="VkShadingRatePaletteEntryNV"/>
+ <type name="VkShadingRatePaletteNV"/>
+ <type name="VkPipelineViewportShadingRateImageStateCreateInfoNV"/>
+ <type name="VkPhysicalDeviceShadingRateImageFeaturesNV"/>
+ <type name="VkPhysicalDeviceShadingRateImagePropertiesNV"/>
+ <type name="VkCoarseSampleLocationNV"/>
+ <type name="VkCoarseSampleOrderCustomNV"/>
+ <type name="VkPipelineViewportCoarseSampleOrderStateCreateInfoNV"/>
+ <type name="VkCoarseSampleOrderTypeNV"/>
+ <command name="vkCmdBindShadingRateImageNV"/>
+ <command name="vkCmdSetViewportShadingRatePaletteNV"/>
+ <command name="vkCmdSetCoarseSampleOrderNV"/>
+ </require>
+ </extension>
+ <extension name="VK_NV_ray_tracing" number="166" type="device" requires="VK_KHR_get_physical_device_properties2,VK_KHR_get_memory_requirements2" author="NV" contact="Eric Werness @ewerness-nv" supported="vulkan">
+ <require>
+ <enum value="3" name="VK_NV_RAY_TRACING_SPEC_VERSION"/>
+ <enum value="&quot;VK_NV_ray_tracing&quot;" name="VK_NV_RAY_TRACING_EXTENSION_NAME"/>
+ <enum name="VK_SHADER_UNUSED_NV"/>
+ <enum offset="0" extends="VkStructureType" name="VK_STRUCTURE_TYPE_RAY_TRACING_PIPELINE_CREATE_INFO_NV"/>
+ <enum offset="1" extends="VkStructureType" name="VK_STRUCTURE_TYPE_ACCELERATION_STRUCTURE_CREATE_INFO_NV"/>
+ <enum offset="3" extends="VkStructureType" name="VK_STRUCTURE_TYPE_GEOMETRY_NV"/>
+ <enum offset="4" extends="VkStructureType" name="VK_STRUCTURE_TYPE_GEOMETRY_TRIANGLES_NV"/>
+ <enum offset="5" extends="VkStructureType" name="VK_STRUCTURE_TYPE_GEOMETRY_AABB_NV"/>
+ <enum offset="6" extends="VkStructureType" name="VK_STRUCTURE_TYPE_BIND_ACCELERATION_STRUCTURE_MEMORY_INFO_NV"/>
+ <enum offset="7" extends="VkStructureType" name="VK_STRUCTURE_TYPE_WRITE_DESCRIPTOR_SET_ACCELERATION_STRUCTURE_NV"/>
+ <enum offset="8" extends="VkStructureType" name="VK_STRUCTURE_TYPE_ACCELERATION_STRUCTURE_MEMORY_REQUIREMENTS_INFO_NV"/>
+ <enum offset="9" extends="VkStructureType" name="VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_RAY_TRACING_PROPERTIES_NV"/>
+ <enum offset="11" extends="VkStructureType" name="VK_STRUCTURE_TYPE_RAY_TRACING_SHADER_GROUP_CREATE_INFO_NV"/>
+ <enum offset="12" extends="VkStructureType" name="VK_STRUCTURE_TYPE_ACCELERATION_STRUCTURE_INFO_NV"/>
+ <enum extends="VkShaderStageFlagBits" name="VK_SHADER_STAGE_RAYGEN_BIT_NV" alias="VK_SHADER_STAGE_RAYGEN_BIT_KHR"/>
+ <enum extends="VkShaderStageFlagBits" name="VK_SHADER_STAGE_ANY_HIT_BIT_NV" alias="VK_SHADER_STAGE_ANY_HIT_BIT_KHR"/>
+ <enum extends="VkShaderStageFlagBits" name="VK_SHADER_STAGE_CLOSEST_HIT_BIT_NV" alias="VK_SHADER_STAGE_CLOSEST_HIT_BIT_KHR"/>
+ <enum extends="VkShaderStageFlagBits" name="VK_SHADER_STAGE_MISS_BIT_NV" alias="VK_SHADER_STAGE_MISS_BIT_KHR"/>
+ <enum extends="VkShaderStageFlagBits" name="VK_SHADER_STAGE_INTERSECTION_BIT_NV" alias="VK_SHADER_STAGE_INTERSECTION_BIT_KHR"/>
+ <enum extends="VkShaderStageFlagBits" name="VK_SHADER_STAGE_CALLABLE_BIT_NV" alias="VK_SHADER_STAGE_CALLABLE_BIT_KHR"/>
+ <enum extends="VkPipelineStageFlagBits" name="VK_PIPELINE_STAGE_RAY_TRACING_SHADER_BIT_NV" alias="VK_PIPELINE_STAGE_RAY_TRACING_SHADER_BIT_KHR"/>
+ <enum extends="VkPipelineStageFlagBits" name="VK_PIPELINE_STAGE_ACCELERATION_STRUCTURE_BUILD_BIT_NV" alias="VK_PIPELINE_STAGE_ACCELERATION_STRUCTURE_BUILD_BIT_KHR"/>
+ <enum extends="VkBufferUsageFlagBits" name="VK_BUFFER_USAGE_RAY_TRACING_BIT_NV" alias="VK_BUFFER_USAGE_SHADER_BINDING_TABLE_BIT_KHR"/>
+ <enum extends="VkPipelineBindPoint" name="VK_PIPELINE_BIND_POINT_RAY_TRACING_NV" alias="VK_PIPELINE_BIND_POINT_RAY_TRACING_KHR"/>
+ <enum offset="0" extends="VkDescriptorType" name="VK_DESCRIPTOR_TYPE_ACCELERATION_STRUCTURE_NV"/>
+ <enum extends="VkAccessFlagBits" name="VK_ACCESS_ACCELERATION_STRUCTURE_READ_BIT_NV" alias="VK_ACCESS_ACCELERATION_STRUCTURE_READ_BIT_KHR"/>
+ <enum extends="VkAccessFlagBits" name="VK_ACCESS_ACCELERATION_STRUCTURE_WRITE_BIT_NV" alias="VK_ACCESS_ACCELERATION_STRUCTURE_WRITE_BIT_KHR"/>
+ <enum offset="0" extends="VkQueryType" name="VK_QUERY_TYPE_ACCELERATION_STRUCTURE_COMPACTED_SIZE_NV"/>
+ <enum bitpos="5" extends="VkPipelineCreateFlagBits" name="VK_PIPELINE_CREATE_DEFER_COMPILE_BIT_NV"/>
+ <enum offset="0" extends="VkObjectType" name="VK_OBJECT_TYPE_ACCELERATION_STRUCTURE_NV"/>
+ <enum offset="0" extends="VkDebugReportObjectTypeEXT" name="VK_DEBUG_REPORT_OBJECT_TYPE_ACCELERATION_STRUCTURE_NV_EXT"/>
+ <enum extends="VkIndexType" name="VK_INDEX_TYPE_NONE_NV" alias="VK_INDEX_TYPE_NONE_KHR"/>
+ <type name="VkRayTracingShaderGroupCreateInfoNV"/>
+ <type name="VkRayTracingShaderGroupTypeNV"/>
+ <enum extends="VkRayTracingShaderGroupTypeKHR" name="VK_RAY_TRACING_SHADER_GROUP_TYPE_GENERAL_NV" alias="VK_RAY_TRACING_SHADER_GROUP_TYPE_GENERAL_KHR"/>
+ <enum extends="VkRayTracingShaderGroupTypeKHR" name="VK_RAY_TRACING_SHADER_GROUP_TYPE_TRIANGLES_HIT_GROUP_NV" alias="VK_RAY_TRACING_SHADER_GROUP_TYPE_TRIANGLES_HIT_GROUP_KHR"/>
+ <enum extends="VkRayTracingShaderGroupTypeKHR" name="VK_RAY_TRACING_SHADER_GROUP_TYPE_PROCEDURAL_HIT_GROUP_NV" alias="VK_RAY_TRACING_SHADER_GROUP_TYPE_PROCEDURAL_HIT_GROUP_KHR"/>
+ <type name="VkRayTracingPipelineCreateInfoNV"/>
+ <type name="VkGeometryTypeNV"/>
+ <enum extends="VkGeometryTypeKHR" name="VK_GEOMETRY_TYPE_TRIANGLES_NV" alias="VK_GEOMETRY_TYPE_TRIANGLES_KHR"/>
+ <enum extends="VkGeometryTypeKHR" name="VK_GEOMETRY_TYPE_AABBS_NV" alias="VK_GEOMETRY_TYPE_AABBS_KHR"/>
+ <type name="VkAccelerationStructureTypeNV"/>
+ <enum extends="VkAccelerationStructureTypeKHR" name="VK_ACCELERATION_STRUCTURE_TYPE_TOP_LEVEL_NV" alias="VK_ACCELERATION_STRUCTURE_TYPE_TOP_LEVEL_KHR"/>
+ <enum extends="VkAccelerationStructureTypeKHR" name="VK_ACCELERATION_STRUCTURE_TYPE_BOTTOM_LEVEL_NV" alias="VK_ACCELERATION_STRUCTURE_TYPE_BOTTOM_LEVEL_KHR"/>
+ <type name="VkGeometryTrianglesNV"/>
+ <type name="VkGeometryAABBNV"/>
+ <type name="VkGeometryDataNV"/>
+ <type name="VkGeometryNV"/>
+ <type name="VkGeometryFlagsNV"/>
+ <type name="VkGeometryFlagBitsNV"/>
+ <enum extends="VkGeometryFlagBitsKHR" name="VK_GEOMETRY_OPAQUE_BIT_NV" alias="VK_GEOMETRY_OPAQUE_BIT_KHR"/>
+ <enum extends="VkGeometryFlagBitsKHR" name="VK_GEOMETRY_NO_DUPLICATE_ANY_HIT_INVOCATION_BIT_NV" alias="VK_GEOMETRY_NO_DUPLICATE_ANY_HIT_INVOCATION_BIT_KHR"/>
+ <type name="VkGeometryInstanceFlagsNV"/>
+ <type name="VkGeometryInstanceFlagBitsNV"/>
+ <enum extends="VkGeometryInstanceFlagBitsKHR" name="VK_GEOMETRY_INSTANCE_TRIANGLE_CULL_DISABLE_BIT_NV" alias="VK_GEOMETRY_INSTANCE_TRIANGLE_FACING_CULL_DISABLE_BIT_KHR"/>
+ <enum extends="VkGeometryInstanceFlagBitsKHR" name="VK_GEOMETRY_INSTANCE_TRIANGLE_FRONT_COUNTERCLOCKWISE_BIT_NV" alias="VK_GEOMETRY_INSTANCE_TRIANGLE_FRONT_COUNTERCLOCKWISE_BIT_KHR"/>
+ <enum extends="VkGeometryInstanceFlagBitsKHR" name="VK_GEOMETRY_INSTANCE_FORCE_OPAQUE_BIT_NV" alias="VK_GEOMETRY_INSTANCE_FORCE_OPAQUE_BIT_KHR"/>
+ <enum extends="VkGeometryInstanceFlagBitsKHR" name="VK_GEOMETRY_INSTANCE_FORCE_NO_OPAQUE_BIT_NV" alias="VK_GEOMETRY_INSTANCE_FORCE_NO_OPAQUE_BIT_KHR"/>
+ <type name="VkAccelerationStructureInfoNV"/>
+ <type name="VkAccelerationStructureCreateInfoNV"/>
+ <type name="VkAccelerationStructureNV"/>
+ <type name="VkBuildAccelerationStructureFlagBitsNV"/>
+ <enum extends="VkBuildAccelerationStructureFlagBitsKHR" name="VK_BUILD_ACCELERATION_STRUCTURE_ALLOW_UPDATE_BIT_NV" alias="VK_BUILD_ACCELERATION_STRUCTURE_ALLOW_UPDATE_BIT_KHR"/>
+ <enum extends="VkBuildAccelerationStructureFlagBitsKHR" name="VK_BUILD_ACCELERATION_STRUCTURE_ALLOW_COMPACTION_BIT_NV" alias="VK_BUILD_ACCELERATION_STRUCTURE_ALLOW_COMPACTION_BIT_KHR"/>
+ <enum extends="VkBuildAccelerationStructureFlagBitsKHR" name="VK_BUILD_ACCELERATION_STRUCTURE_PREFER_FAST_TRACE_BIT_NV" alias="VK_BUILD_ACCELERATION_STRUCTURE_PREFER_FAST_TRACE_BIT_KHR"/>
+ <enum extends="VkBuildAccelerationStructureFlagBitsKHR" name="VK_BUILD_ACCELERATION_STRUCTURE_PREFER_FAST_BUILD_BIT_NV" alias="VK_BUILD_ACCELERATION_STRUCTURE_PREFER_FAST_BUILD_BIT_KHR"/>
+ <enum extends="VkBuildAccelerationStructureFlagBitsKHR" name="VK_BUILD_ACCELERATION_STRUCTURE_LOW_MEMORY_BIT_NV" alias="VK_BUILD_ACCELERATION_STRUCTURE_LOW_MEMORY_BIT_KHR"/>
+ <type name="VkBuildAccelerationStructureFlagsNV"/>
+ <type name="VkCopyAccelerationStructureModeNV"/>
+ <enum extends="VkCopyAccelerationStructureModeKHR" name="VK_COPY_ACCELERATION_STRUCTURE_MODE_CLONE_NV" alias="VK_COPY_ACCELERATION_STRUCTURE_MODE_CLONE_KHR"/>
+ <enum extends="VkCopyAccelerationStructureModeKHR" name="VK_COPY_ACCELERATION_STRUCTURE_MODE_COMPACT_NV" alias="VK_COPY_ACCELERATION_STRUCTURE_MODE_COMPACT_KHR"/>
+ <type name="VkBindAccelerationStructureMemoryInfoNV"/>
+ <type name="VkWriteDescriptorSetAccelerationStructureNV"/>
+ <type name="VkAccelerationStructureMemoryRequirementsInfoNV"/>
+ <type name="VkPhysicalDeviceRayTracingPropertiesNV"/>
+ <type name="VkMemoryRequirements2KHR"/>
+ <type name="VkAccelerationStructureMemoryRequirementsTypeNV"/>
+ <type name="VkTransformMatrixNV"/>
+ <type name="VkAabbPositionsNV"/>
+ <type name="VkAccelerationStructureInstanceNV"/>
+ <command name="vkCreateAccelerationStructureNV"/>
+ <command name="vkDestroyAccelerationStructureNV"/>
+ <command name="vkGetAccelerationStructureMemoryRequirementsNV"/>
+ <command name="vkBindAccelerationStructureMemoryNV"/>
+ <command name="vkCmdBuildAccelerationStructureNV"/>
+ <command name="vkCmdCopyAccelerationStructureNV"/>
+ <command name="vkCmdTraceRaysNV"/>
+ <command name="vkCreateRayTracingPipelinesNV"/>
+ <command name="vkGetRayTracingShaderGroupHandlesNV"/>
+ <command name="vkGetAccelerationStructureHandleNV"/>
+ <command name="vkCmdWriteAccelerationStructuresPropertiesNV"/>
+ <command name="vkCompileDeferredNV"/>
+ </require>
+ </extension>
+ <extension name="VK_NV_representative_fragment_test" number="167" type="device" author="NV" contact="Kedarnath Thangudu @kthangudu" supported="vulkan">
+ <require>
+ <enum value="2" name="VK_NV_REPRESENTATIVE_FRAGMENT_TEST_SPEC_VERSION"/>
+ <enum value="&quot;VK_NV_representative_fragment_test&quot;" name="VK_NV_REPRESENTATIVE_FRAGMENT_TEST_EXTENSION_NAME"/>
+ <enum offset="0" extends="VkStructureType" name="VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_REPRESENTATIVE_FRAGMENT_TEST_FEATURES_NV"/>
+ <enum offset="1" extends="VkStructureType" name="VK_STRUCTURE_TYPE_PIPELINE_REPRESENTATIVE_FRAGMENT_TEST_STATE_CREATE_INFO_NV"/>
+ <type name="VkPhysicalDeviceRepresentativeFragmentTestFeaturesNV"/>
+ <type name="VkPipelineRepresentativeFragmentTestStateCreateInfoNV"/>
+ </require>
+ </extension>
+ <extension name="VK_NV_extension_168" number="168" author="NV" contact="Daniel Koch @dgkoch" supported="disabled">
+ <require>
+ <enum value="0" name="VK_NV_EXTENSION_168_SPEC_VERSION"/>
+ <enum value="&quot;VK_NV_extension_168&quot;" name="VK_NV_EXTENSION_168_EXTENSION_NAME"/>
+ </require>
+ </extension>
+ <extension name="VK_KHR_maintenance3" number="169" type="device" requires="VK_KHR_get_physical_device_properties2" author="KHR" contact="Jeff Bolz @jeffbolznv" supported="vulkan" promotedto="VK_VERSION_1_1">
+ <require>
+ <enum value="1" name="VK_KHR_MAINTENANCE_3_SPEC_VERSION"/>
+ <enum value="&quot;VK_KHR_maintenance3&quot;" name="VK_KHR_MAINTENANCE_3_EXTENSION_NAME"/>
+ <enum alias="VK_KHR_MAINTENANCE_3_SPEC_VERSION" name="VK_KHR_MAINTENANCE3_SPEC_VERSION" comment="Backwards-compatible alias containing a typo"/>
+ <enum alias="VK_KHR_MAINTENANCE_3_EXTENSION_NAME" name="VK_KHR_MAINTENANCE3_EXTENSION_NAME" comment="Backwards-compatible alias containing a typo"/>
+ <enum extends="VkStructureType" name="VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_MAINTENANCE_3_PROPERTIES_KHR" alias="VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_MAINTENANCE_3_PROPERTIES"/>
+ <enum extends="VkStructureType" name="VK_STRUCTURE_TYPE_DESCRIPTOR_SET_LAYOUT_SUPPORT_KHR" alias="VK_STRUCTURE_TYPE_DESCRIPTOR_SET_LAYOUT_SUPPORT"/>
+ <type name="VkPhysicalDeviceMaintenance3PropertiesKHR"/>
+ <type name="VkDescriptorSetLayoutSupportKHR"/>
+ <command name="vkGetDescriptorSetLayoutSupportKHR"/>
+ </require>
+ </extension>
+ <extension name="VK_KHR_draw_indirect_count" number="170" type="device" author="KHR" contact="Piers Daniell @pdaniell-nv" supported="vulkan" promotedto="VK_VERSION_1_2">
+ <require>
+ <enum value="1" name="VK_KHR_DRAW_INDIRECT_COUNT_SPEC_VERSION"/>
+ <enum value="&quot;VK_KHR_draw_indirect_count&quot;" name="VK_KHR_DRAW_INDIRECT_COUNT_EXTENSION_NAME"/>
+ <command name="vkCmdDrawIndirectCountKHR"/>
+ <command name="vkCmdDrawIndexedIndirectCountKHR"/>
+ </require>
+ </extension>
+ <extension name="VK_EXT_filter_cubic" number="171" type="device" author="QCOM" contact="Bill Licea-Kane @wwlk" supported="vulkan">
+ <require>
+ <enum value="3" name="VK_EXT_FILTER_CUBIC_SPEC_VERSION"/>
+ <enum value="&quot;VK_EXT_filter_cubic&quot;" name="VK_EXT_FILTER_CUBIC_EXTENSION_NAME"/>
+ <enum offset="0" extends="VkFilter" extnumber="16" name="VK_FILTER_CUBIC_EXT"/>
+ <enum bitpos="13" extends="VkFormatFeatureFlagBits" name="VK_FORMAT_FEATURE_SAMPLED_IMAGE_FILTER_CUBIC_BIT_EXT"/>
+ <enum offset="0" extends="VkStructureType" name="VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_IMAGE_VIEW_IMAGE_FORMAT_INFO_EXT"/>
+ <enum offset="1" extends="VkStructureType" name="VK_STRUCTURE_TYPE_FILTER_CUBIC_IMAGE_VIEW_IMAGE_FORMAT_PROPERTIES_EXT"/>
+ <type name="VkPhysicalDeviceImageViewImageFormatInfoEXT"/>
+ <type name="VkFilterCubicImageViewImageFormatPropertiesEXT"/>
+ </require>
+ </extension>
+ <extension name="VK_QCOM_render_pass_shader_resolve" number="172" type="device" author="QCOM" contact="Bill Licea-Kane @wwlk" supported="vulkan">
+ <require>
+ <enum value="4" name="VK_QCOM_RENDER_PASS_SHADER_RESOLVE_SPEC_VERSION"/>
+ <enum value="&quot;VK_QCOM_render_pass_shader_resolve&quot;" name="VK_QCOM_RENDER_PASS_SHADER_RESOLVE_EXTENSION_NAME"/>
+ <enum bitpos="2" extends="VkSubpassDescriptionFlagBits" name="VK_SUBPASS_DESCRIPTION_FRAGMENT_REGION_BIT_QCOM"/>
+ <enum bitpos="3" extends="VkSubpassDescriptionFlagBits" name="VK_SUBPASS_DESCRIPTION_SHADER_RESOLVE_BIT_QCOM"/>
+ </require>
+ </extension>
+ <extension name="VK_QCOM_extension_173" number="173" author="QCOM" contact="Bill Licea-Kane @wwlk" supported="disabled">
+ <require>
+ <enum value="0" name="VK_QCOM_EXTENSION_173_SPEC_VERSION"/>
+ <enum value="&quot;VK_QCOM_extension_173&quot;" name="VK_QCOM_EXTENSION_173_EXTENSION_NAME"/>
+ <enum bitpos="18" extends="VkBufferUsageFlagBits" name="VK_BUFFER_USAGE_RESERVED_18_BIT_QCOM"/>
+ <enum bitpos="16" extends="VkImageUsageFlagBits" name="VK_IMAGE_USAGE_RESERVED_16_BIT_QCOM"/>
+ <enum bitpos="17" extends="VkImageUsageFlagBits" name="VK_IMAGE_USAGE_RESERVED_17_BIT_QCOM"/>
+ </require>
+ </extension>
+ <extension name="VK_QCOM_extension_174" number="174" author="QCOM" contact="Bill Licea-Kane @wwlk" supported="disabled">
+ <require>
+ <enum value="0" name="VK_QCOM_EXTENSION_174_SPEC_VERSION"/>
+ <enum value="&quot;VK_QCOM_extension_174&quot;" name="VK_QCOM_EXTENSION_174_EXTENSION_NAME"/>
+ </require>
+ </extension>
+ <extension name="VK_EXT_global_priority" number="175" type="device" author="EXT" contact="Andres Rodriguez @lostgoat" supported="vulkan" promotedto="VK_KHR_global_priority">
+ <require>
+ <enum value="2" name="VK_EXT_GLOBAL_PRIORITY_SPEC_VERSION"/>
+ <enum value="&quot;VK_EXT_global_priority&quot;" name="VK_EXT_GLOBAL_PRIORITY_EXTENSION_NAME"/>
+ <enum extends="VkStructureType" alias="VK_STRUCTURE_TYPE_DEVICE_QUEUE_GLOBAL_PRIORITY_CREATE_INFO_KHR" name="VK_STRUCTURE_TYPE_DEVICE_QUEUE_GLOBAL_PRIORITY_CREATE_INFO_EXT"/>
+ <enum extends="VkResult" alias="VK_ERROR_NOT_PERMITTED_KHR" name="VK_ERROR_NOT_PERMITTED_EXT"/>
+ <type name="VkDeviceQueueGlobalPriorityCreateInfoEXT"/>
+ <type name="VkQueueGlobalPriorityEXT"/>
+ </require>
+ </extension>
+ <extension name="VK_KHR_shader_subgroup_extended_types" number="176" type="device" requiresCore="1.1" author="KHR" contact="Neil Henning @sheredom" supported="vulkan" promotedto="VK_VERSION_1_2">
+ <require>
+ <enum value="1" name="VK_KHR_SHADER_SUBGROUP_EXTENDED_TYPES_SPEC_VERSION"/>
+ <enum value="&quot;VK_KHR_shader_subgroup_extended_types&quot;" name="VK_KHR_SHADER_SUBGROUP_EXTENDED_TYPES_EXTENSION_NAME"/>
+ <enum extends="VkStructureType" name="VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_SHADER_SUBGROUP_EXTENDED_TYPES_FEATURES_KHR" alias="VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_SHADER_SUBGROUP_EXTENDED_TYPES_FEATURES"/>
+ <type name="VkPhysicalDeviceShaderSubgroupExtendedTypesFeaturesKHR"/>
+ </require>
+ </extension>
+ <extension name="VK_EXT_extension_177" number="177" author="EXT" contact="Neil Henning @sheredom" supported="disabled">
+ <require>
+ <enum value="0" name="VK_EXT_EXTENSION_177_SPEC_VERSION"/>
+ <enum value="&quot;VK_EXT_extension_177&quot;" name="VK_EXT_EXTENSION_177_EXTENSION_NAME"/>
+ </require>
+ </extension>
+ <extension name="VK_KHR_8bit_storage" number="178" type="device" requires="VK_KHR_get_physical_device_properties2,VK_KHR_storage_buffer_storage_class" author="KHR" contact="Alexander Galazin @alegal-arm" supported="vulkan" promotedto="VK_VERSION_1_2">
+ <require>
+ <enum value="1" name="VK_KHR_8BIT_STORAGE_SPEC_VERSION"/>
+ <enum value="&quot;VK_KHR_8bit_storage&quot;" name="VK_KHR_8BIT_STORAGE_EXTENSION_NAME"/>
+ <enum extends="VkStructureType" name="VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_8BIT_STORAGE_FEATURES_KHR" alias="VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_8BIT_STORAGE_FEATURES"/>
+ <type name="VkPhysicalDevice8BitStorageFeaturesKHR"/>
+ </require>
+ </extension>
+ <extension name="VK_EXT_external_memory_host" number="179" type="device" author="EXT" requires="VK_KHR_external_memory" contact="Daniel Rakos @drakos-amd" supported="vulkan">
+ <require>
+ <enum value="1" name="VK_EXT_EXTERNAL_MEMORY_HOST_SPEC_VERSION"/>
+ <enum value="&quot;VK_EXT_external_memory_host&quot;" name="VK_EXT_EXTERNAL_MEMORY_HOST_EXTENSION_NAME"/>
+ <enum offset="0" extends="VkStructureType" name="VK_STRUCTURE_TYPE_IMPORT_MEMORY_HOST_POINTER_INFO_EXT"/>
+ <enum offset="1" extends="VkStructureType" name="VK_STRUCTURE_TYPE_MEMORY_HOST_POINTER_PROPERTIES_EXT"/>
+ <enum offset="2" extends="VkStructureType" name="VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_EXTERNAL_MEMORY_HOST_PROPERTIES_EXT"/>
+ <enum bitpos="7" extends="VkExternalMemoryHandleTypeFlagBits" name="VK_EXTERNAL_MEMORY_HANDLE_TYPE_HOST_ALLOCATION_BIT_EXT"/>
+ <enum bitpos="8" extends="VkExternalMemoryHandleTypeFlagBits" name="VK_EXTERNAL_MEMORY_HANDLE_TYPE_HOST_MAPPED_FOREIGN_MEMORY_BIT_EXT"/>
+ <type name="VkImportMemoryHostPointerInfoEXT"/>
+ <type name="VkMemoryHostPointerPropertiesEXT"/>
+ <type name="VkPhysicalDeviceExternalMemoryHostPropertiesEXT"/>
+ <command name="vkGetMemoryHostPointerPropertiesEXT"/>
+ </require>
+ </extension>
+ <extension name="VK_AMD_buffer_marker" number="180" type="device" author="AMD" contact="Daniel Rakos @drakos-amd" specialuse="devtools" supported="vulkan">
+ <require>
+ <enum value="1" name="VK_AMD_BUFFER_MARKER_SPEC_VERSION"/>
+ <enum value="&quot;VK_AMD_buffer_marker&quot;" name="VK_AMD_BUFFER_MARKER_EXTENSION_NAME"/>
+ <command name="vkCmdWriteBufferMarkerAMD"/>
+ </require>
+ </extension>
+ <extension name="VK_KHR_shader_atomic_int64" number="181" type="device" author="KHR" requires="VK_KHR_get_physical_device_properties2" contact="Aaron Hagan @ahagan" supported="vulkan" promotedto="VK_VERSION_1_2">
+ <require>
+ <enum value="1" name="VK_KHR_SHADER_ATOMIC_INT64_SPEC_VERSION"/>
+ <enum value="&quot;VK_KHR_shader_atomic_int64&quot;" name="VK_KHR_SHADER_ATOMIC_INT64_EXTENSION_NAME"/>
+ <enum extends="VkStructureType" name="VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_SHADER_ATOMIC_INT64_FEATURES_KHR" alias="VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_SHADER_ATOMIC_INT64_FEATURES"/>
+ <type name="VkPhysicalDeviceShaderAtomicInt64FeaturesKHR"/>
+ </require>
+ </extension>
+ <extension name="VK_KHR_shader_clock" number="182" type="device" author="KHR" requires="VK_KHR_get_physical_device_properties2" contact="Aaron Hagan @ahagan" supported="vulkan">
+ <require>
+ <enum value="1" name="VK_KHR_SHADER_CLOCK_SPEC_VERSION"/>
+ <enum value="&quot;VK_KHR_shader_clock&quot;" name="VK_KHR_SHADER_CLOCK_EXTENSION_NAME"/>
+ <enum offset="0" extends="VkStructureType" name="VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_SHADER_CLOCK_FEATURES_KHR"/>
+ <type name="VkPhysicalDeviceShaderClockFeaturesKHR"/>
+ </require>
+ </extension>
+ <extension name="VK_AMD_extension_183" number="183" author="AMD" contact="Daniel Rakos @drakos-amd" supported="disabled">
+ <require>
+ <enum value="0" name="VK_AMD_EXTENSION_183_SPEC_VERSION"/>
+ <enum value="&quot;VK_AMD_extension_183&quot;" name="VK_AMD_EXTENSION_183_EXTENSION_NAME"/>
+ </require>
+ </extension>
+ <extension name="VK_AMD_pipeline_compiler_control" number="184" type="device" author="AMD" contact="Matthaeus G. Chajdas @anteru" supported="vulkan">
+ <require>
+ <enum value="1" name="VK_AMD_PIPELINE_COMPILER_CONTROL_SPEC_VERSION"/>
+ <enum value="&quot;VK_AMD_pipeline_compiler_control&quot;" name="VK_AMD_PIPELINE_COMPILER_CONTROL_EXTENSION_NAME"/>
+ <enum offset="0" extends="VkStructureType" name="VK_STRUCTURE_TYPE_PIPELINE_COMPILER_CONTROL_CREATE_INFO_AMD"/>
+ <type name="VkPipelineCompilerControlFlagBitsAMD"/>
+ <type name="VkPipelineCompilerControlFlagsAMD"/>
+ <type name="VkPipelineCompilerControlCreateInfoAMD"/>
+ </require>
+ </extension>
+ <extension name="VK_EXT_calibrated_timestamps" number="185" type="device" requires="VK_KHR_get_physical_device_properties2" author="EXT" contact="Daniel Rakos @drakos-amd" supported="vulkan">
+ <require>
+ <enum value="2" name="VK_EXT_CALIBRATED_TIMESTAMPS_SPEC_VERSION"/>
+ <enum value="&quot;VK_EXT_calibrated_timestamps&quot;" name="VK_EXT_CALIBRATED_TIMESTAMPS_EXTENSION_NAME"/>
+ <enum offset="0" extends="VkStructureType" name="VK_STRUCTURE_TYPE_CALIBRATED_TIMESTAMP_INFO_EXT"/>
+ <type name="VkTimeDomainEXT"/>
+ <type name="VkCalibratedTimestampInfoEXT"/>
+ <command name="vkGetPhysicalDeviceCalibrateableTimeDomainsEXT"/>
+ <command name="vkGetCalibratedTimestampsEXT"/>
+ </require>
+ </extension>
+ <extension name="VK_AMD_shader_core_properties" number="186" type="device" author="AMD" requires="VK_KHR_get_physical_device_properties2" contact="Martin Dinkov @mdinkov" supported="vulkan">
+ <require>
+ <enum value="2" name="VK_AMD_SHADER_CORE_PROPERTIES_SPEC_VERSION"/>
+ <enum value="&quot;VK_AMD_shader_core_properties&quot;" name="VK_AMD_SHADER_CORE_PROPERTIES_EXTENSION_NAME"/>
+ <enum offset="0" extends="VkStructureType" name="VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_SHADER_CORE_PROPERTIES_AMD"/>
+ <type name="VkPhysicalDeviceShaderCorePropertiesAMD"/>
+ </require>
+ </extension>
+ <extension name="VK_AMD_extension_187" number="187" author="AMD" contact="Daniel Rakos @drakos-amd" supported="disabled">
+ <require>
+ <enum value="0" name="VK_AMD_EXTENSION_187_SPEC_VERSION"/>
+ <enum value="&quot;VK_AMD_extension_187&quot;" name="VK_AMD_EXTENSION_187_EXTENSION_NAME"/>
+ </require>
+ </extension>
+ <extension name="VK_EXT_video_decode_h265" number="188" type="device" requires="VK_KHR_video_decode_queue" author="KHR" contact="peter.fang@amd.com" provisional="true" platform="provisional" supported="vulkan">
+ <require>
+ <enum value="3" name="VK_EXT_VIDEO_DECODE_H265_SPEC_VERSION"/>
+ <enum value="&quot;VK_EXT_video_decode_h265&quot;" name="VK_EXT_VIDEO_DECODE_H265_EXTENSION_NAME"/>
+ <enum offset="0" extends="VkStructureType" name="VK_STRUCTURE_TYPE_VIDEO_DECODE_H265_CAPABILITIES_EXT" protect="VK_ENABLE_BETA_EXTENSIONS"/>
+ <enum offset="1" extends="VkStructureType" name="VK_STRUCTURE_TYPE_VIDEO_DECODE_H265_SESSION_PARAMETERS_CREATE_INFO_EXT" protect="VK_ENABLE_BETA_EXTENSIONS"/>
+ <enum offset="2" extends="VkStructureType" name="VK_STRUCTURE_TYPE_VIDEO_DECODE_H265_SESSION_PARAMETERS_ADD_INFO_EXT" protect="VK_ENABLE_BETA_EXTENSIONS"/>
+ <enum offset="3" extends="VkStructureType" name="VK_STRUCTURE_TYPE_VIDEO_DECODE_H265_PROFILE_EXT" protect="VK_ENABLE_BETA_EXTENSIONS"/>
+ <enum offset="4" extends="VkStructureType" name="VK_STRUCTURE_TYPE_VIDEO_DECODE_H265_PICTURE_INFO_EXT" protect="VK_ENABLE_BETA_EXTENSIONS"/>
+ <enum offset="5" extends="VkStructureType" name="VK_STRUCTURE_TYPE_VIDEO_DECODE_H265_DPB_SLOT_INFO_EXT" protect="VK_ENABLE_BETA_EXTENSIONS"/>
+ <enum bitpos="1" extends="VkVideoCodecOperationFlagBitsKHR" name="VK_VIDEO_CODEC_OPERATION_DECODE_H265_BIT_EXT" protect="VK_ENABLE_BETA_EXTENSIONS"/>
+
+ <type name="VkVideoDecodeH265ProfileEXT"/>
+ <type name="VkVideoDecodeH265CapabilitiesEXT"/>
+
+ <type name="VkVideoDecodeH265SessionParametersCreateInfoEXT"/>
+ <type name="VkVideoDecodeH265SessionParametersAddInfoEXT"/>
+ <type name="VkVideoDecodeH265PictureInfoEXT"/>
+ <type name="VkVideoDecodeH265DpbSlotInfoEXT"/>
+ </require>
+ </extension>
+ <extension name="VK_KHR_global_priority" number="189" type="device" author="KHR" contact="Tobias Hector @tobski" supported="vulkan">
+ <require>
+ <enum value="1" name="VK_KHR_GLOBAL_PRIORITY_SPEC_VERSION"/>
+ <enum value="&quot;VK_KHR_global_priority&quot;" name="VK_KHR_GLOBAL_PRIORITY_EXTENSION_NAME"/>
+ <enum offset="0" extends="VkStructureType" extnumber="175" name="VK_STRUCTURE_TYPE_DEVICE_QUEUE_GLOBAL_PRIORITY_CREATE_INFO_KHR"/>
+ <enum offset="0" extends="VkStructureType" extnumber="389" name="VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_GLOBAL_PRIORITY_QUERY_FEATURES_KHR"/>
+ <enum offset="1" extends="VkStructureType" extnumber="389" name="VK_STRUCTURE_TYPE_QUEUE_FAMILY_GLOBAL_PRIORITY_PROPERTIES_KHR"/>
+ <enum extends="VkResult" extnumber="175" offset="1" dir="-" name="VK_ERROR_NOT_PERMITTED_KHR"/>
+ <enum name="VK_MAX_GLOBAL_PRIORITY_SIZE_KHR"/>
+ <type name="VkDeviceQueueGlobalPriorityCreateInfoKHR"/>
+ <type name="VkQueueGlobalPriorityKHR"/>
+ <type name="VkPhysicalDeviceGlobalPriorityQueryFeaturesKHR"/>
+ <type name="VkQueueFamilyGlobalPriorityPropertiesKHR"/>
+ </require>
+ </extension>
+ <extension name="VK_AMD_memory_overallocation_behavior" number="190" type="device" author="AMD" contact="Martin Dinkov @mdinkov" supported="vulkan">
+ <require>
+ <enum value="1" name="VK_AMD_MEMORY_OVERALLOCATION_BEHAVIOR_SPEC_VERSION"/>
+ <enum value="&quot;VK_AMD_memory_overallocation_behavior&quot;" name="VK_AMD_MEMORY_OVERALLOCATION_BEHAVIOR_EXTENSION_NAME"/>
+ <enum offset="0" extends="VkStructureType" name="VK_STRUCTURE_TYPE_DEVICE_MEMORY_OVERALLOCATION_CREATE_INFO_AMD"/>
+ <type name="VkMemoryOverallocationBehaviorAMD"/>
+ <type name="VkDeviceMemoryOverallocationCreateInfoAMD"/>
+ </require>
+ </extension>
+ <extension name="VK_EXT_vertex_attribute_divisor" number="191" type="device" requires="VK_KHR_get_physical_device_properties2" author="NV" contact="Vikram Kushwaha @vkushwaha" supported="vulkan">
+ <require>
+ <enum value="3" name="VK_EXT_VERTEX_ATTRIBUTE_DIVISOR_SPEC_VERSION"/>
+ <enum value="&quot;VK_EXT_vertex_attribute_divisor&quot;" name="VK_EXT_VERTEX_ATTRIBUTE_DIVISOR_EXTENSION_NAME"/>
+ <enum offset="0" extends="VkStructureType" name="VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_VERTEX_ATTRIBUTE_DIVISOR_PROPERTIES_EXT"/>
+ <enum offset="1" extends="VkStructureType" name="VK_STRUCTURE_TYPE_PIPELINE_VERTEX_INPUT_DIVISOR_STATE_CREATE_INFO_EXT"/>
+ <enum offset="2" extends="VkStructureType" name="VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_VERTEX_ATTRIBUTE_DIVISOR_FEATURES_EXT"/>
+ <type name="VkPhysicalDeviceVertexAttributeDivisorPropertiesEXT"/>
+ <type name="VkVertexInputBindingDivisorDescriptionEXT"/>
+ <type name="VkPipelineVertexInputDivisorStateCreateInfoEXT"/>
+ <type name="VkPhysicalDeviceVertexAttributeDivisorFeaturesEXT"/>
+ </require>
+ </extension>
+ <extension name="VK_GGP_frame_token" number="192" type="device" requires="VK_KHR_swapchain,VK_GGP_stream_descriptor_surface" platform="ggp" author="GGP" contact="Jean-Francois Roy @jfroy" supported="vulkan">
+ <require>
+ <enum value="1" name="VK_GGP_FRAME_TOKEN_SPEC_VERSION"/>
+ <enum value="&quot;VK_GGP_frame_token&quot;" name="VK_GGP_FRAME_TOKEN_EXTENSION_NAME"/>
+ <enum offset="0" extends="VkStructureType" name="VK_STRUCTURE_TYPE_PRESENT_FRAME_TOKEN_GGP"/>
+ <type name="VkPresentFrameTokenGGP"/>
+ </require>
+ </extension>
+ <extension name="VK_EXT_pipeline_creation_feedback" number="193" type="device" author="GOOGLE" contact="Jean-Francois Roy @jfroy" specialuse="devtools" supported="vulkan" promotedto="VK_VERSION_1_3">
+ <require>
+ <enum value="1" name="VK_EXT_PIPELINE_CREATION_FEEDBACK_SPEC_VERSION"/>
+ <enum value="&quot;VK_EXT_pipeline_creation_feedback&quot;" name="VK_EXT_PIPELINE_CREATION_FEEDBACK_EXTENSION_NAME"/>
+ <enum extends="VkStructureType" name="VK_STRUCTURE_TYPE_PIPELINE_CREATION_FEEDBACK_CREATE_INFO_EXT" alias="VK_STRUCTURE_TYPE_PIPELINE_CREATION_FEEDBACK_CREATE_INFO"/>
+ <type name="VkPipelineCreationFeedbackFlagBitsEXT"/>
+ <type name="VkPipelineCreationFeedbackFlagsEXT"/>
+ <type name="VkPipelineCreationFeedbackCreateInfoEXT"/>
+ <type name="VkPipelineCreationFeedbackEXT"/>
+ </require>
+ </extension>
+ <extension name="VK_GOOGLE_extension_194" number="194" author="GOOGLE" contact="Jean-Francois Roy @jfroy" supported="disabled">
+ <require>
+ <enum value="0" name="VK_GOOGLE_EXTENSION_194_SPEC_VERSION"/>
+ <enum value="&quot;VK_GOOGLE_extension_194&quot;" name="VK_GOOGLE_EXTENSION_194_EXTENSION_NAME"/>
+ </require>
+ </extension>
+ <extension name="VK_GOOGLE_extension_195" number="195" author="GOOGLE" contact="Jean-Francois Roy @jfroy" supported="disabled">
+ <require>
+ <enum value="0" name="VK_GOOGLE_EXTENSION_195_SPEC_VERSION"/>
+ <enum value="&quot;VK_GOOGLE_extension_195&quot;" name="VK_GOOGLE_EXTENSION_195_EXTENSION_NAME"/>
+ </require>
+ </extension>
+ <extension name="VK_GOOGLE_extension_196" number="196" author="GOOGLE" contact="Jean-Francois Roy @jfroy" supported="disabled">
+ <require>
+ <enum value="0" name="VK_GOOGLE_EXTENSION_196_SPEC_VERSION"/>
+ <enum value="&quot;VK_GOOGLE_extension_196&quot;" name="VK_GOOGLE_EXTENSION_196_EXTENSION_NAME"/>
+ <enum bitpos="1" extends="VkPipelineCacheCreateFlagBits"
+ name="VK_PIPELINE_CACHE_CREATE_RESERVED_1_BIT_EXT"/>
+ </require>
+ </extension>
+ <extension name="VK_KHR_driver_properties" number="197" type="device" requires="VK_KHR_get_physical_device_properties2" author="KHR" contact="Daniel Rakos @drakos-amd" supported="vulkan" promotedto="VK_VERSION_1_2">
+ <require>
+ <enum value="1" name="VK_KHR_DRIVER_PROPERTIES_SPEC_VERSION"/>
+ <enum value="&quot;VK_KHR_driver_properties&quot;" name="VK_KHR_DRIVER_PROPERTIES_EXTENSION_NAME"/>
+ <enum extends="VkStructureType" name="VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_DRIVER_PROPERTIES_KHR" alias="VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_DRIVER_PROPERTIES"/>
+ <enum name="VK_MAX_DRIVER_NAME_SIZE_KHR"/>
+ <enum name="VK_MAX_DRIVER_INFO_SIZE_KHR"/>
+ <type name="VkDriverIdKHR"/>
+ <enum extends="VkDriverId" name="VK_DRIVER_ID_AMD_PROPRIETARY_KHR" alias="VK_DRIVER_ID_AMD_PROPRIETARY"/>
+ <enum extends="VkDriverId" name="VK_DRIVER_ID_AMD_OPEN_SOURCE_KHR" alias="VK_DRIVER_ID_AMD_OPEN_SOURCE"/>
+ <enum extends="VkDriverId" name="VK_DRIVER_ID_MESA_RADV_KHR" alias="VK_DRIVER_ID_MESA_RADV"/>
+ <enum extends="VkDriverId" name="VK_DRIVER_ID_NVIDIA_PROPRIETARY_KHR" alias="VK_DRIVER_ID_NVIDIA_PROPRIETARY"/>
+ <enum extends="VkDriverId" name="VK_DRIVER_ID_INTEL_PROPRIETARY_WINDOWS_KHR" alias="VK_DRIVER_ID_INTEL_PROPRIETARY_WINDOWS"/>
+ <enum extends="VkDriverId" name="VK_DRIVER_ID_INTEL_OPEN_SOURCE_MESA_KHR" alias="VK_DRIVER_ID_INTEL_OPEN_SOURCE_MESA"/>
+ <enum extends="VkDriverId" name="VK_DRIVER_ID_IMAGINATION_PROPRIETARY_KHR" alias="VK_DRIVER_ID_IMAGINATION_PROPRIETARY"/>
+ <enum extends="VkDriverId" name="VK_DRIVER_ID_QUALCOMM_PROPRIETARY_KHR" alias="VK_DRIVER_ID_QUALCOMM_PROPRIETARY"/>
+ <enum extends="VkDriverId" name="VK_DRIVER_ID_ARM_PROPRIETARY_KHR" alias="VK_DRIVER_ID_ARM_PROPRIETARY"/>
+ <enum extends="VkDriverId" name="VK_DRIVER_ID_GOOGLE_SWIFTSHADER_KHR" alias="VK_DRIVER_ID_GOOGLE_SWIFTSHADER"/>
+ <enum extends="VkDriverId" name="VK_DRIVER_ID_GGP_PROPRIETARY_KHR" alias="VK_DRIVER_ID_GGP_PROPRIETARY"/>
+ <enum extends="VkDriverId" name="VK_DRIVER_ID_BROADCOM_PROPRIETARY_KHR" alias="VK_DRIVER_ID_BROADCOM_PROPRIETARY"/>
+ <type name="VkConformanceVersionKHR"/>
+ <type name="VkPhysicalDeviceDriverPropertiesKHR"/>
+ </require>
+ </extension>
+ <extension name="VK_KHR_shader_float_controls" number="198" type="device" requires="VK_KHR_get_physical_device_properties2" author="KHR" contact="Alexander Galazin @alegal-arm" supported="vulkan" promotedto="VK_VERSION_1_2">
+ <require>
+ <enum value="4" name="VK_KHR_SHADER_FLOAT_CONTROLS_SPEC_VERSION"/>
+ <enum value="&quot;VK_KHR_shader_float_controls&quot;" name="VK_KHR_SHADER_FLOAT_CONTROLS_EXTENSION_NAME"/>
+ <enum extends="VkStructureType" name="VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_FLOAT_CONTROLS_PROPERTIES_KHR" alias="VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_FLOAT_CONTROLS_PROPERTIES"/>
+ <type name="VkPhysicalDeviceFloatControlsPropertiesKHR"/>
+ <type name="VkShaderFloatControlsIndependenceKHR"/>
+ <enum extends="VkShaderFloatControlsIndependence" name="VK_SHADER_FLOAT_CONTROLS_INDEPENDENCE_32_BIT_ONLY_KHR" alias="VK_SHADER_FLOAT_CONTROLS_INDEPENDENCE_32_BIT_ONLY"/>
+ <enum extends="VkShaderFloatControlsIndependence" name="VK_SHADER_FLOAT_CONTROLS_INDEPENDENCE_ALL_KHR" alias="VK_SHADER_FLOAT_CONTROLS_INDEPENDENCE_ALL"/>
+ <enum extends="VkShaderFloatControlsIndependence" name="VK_SHADER_FLOAT_CONTROLS_INDEPENDENCE_NONE_KHR" alias="VK_SHADER_FLOAT_CONTROLS_INDEPENDENCE_NONE"/>
+ </require>
+ </extension>
+ <extension name="VK_NV_shader_subgroup_partitioned" number="199" type="device" requiresCore="1.1" author="NV" contact="Jeff Bolz @jeffbolznv" supported="vulkan">
+ <require>
+ <enum value="1" name="VK_NV_SHADER_SUBGROUP_PARTITIONED_SPEC_VERSION"/>
+ <enum value="&quot;VK_NV_shader_subgroup_partitioned&quot;" name="VK_NV_SHADER_SUBGROUP_PARTITIONED_EXTENSION_NAME"/>
+ <enum bitpos="8" extends="VkSubgroupFeatureFlagBits" name="VK_SUBGROUP_FEATURE_PARTITIONED_BIT_NV"/>
+ </require>
+ </extension>
+ <extension name="VK_KHR_depth_stencil_resolve" number="200" type="device" requires="VK_KHR_create_renderpass2" author="KHR" contact="Jan-Harald Fredriksen @janharald" supported="vulkan" promotedto="VK_VERSION_1_2">
+ <require>
+ <enum value="1" name="VK_KHR_DEPTH_STENCIL_RESOLVE_SPEC_VERSION"/>
+ <enum value="&quot;VK_KHR_depth_stencil_resolve&quot;" name="VK_KHR_DEPTH_STENCIL_RESOLVE_EXTENSION_NAME"/>
+ <enum extends="VkStructureType" name="VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_DEPTH_STENCIL_RESOLVE_PROPERTIES_KHR" alias="VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_DEPTH_STENCIL_RESOLVE_PROPERTIES"/>
+ <enum extends="VkStructureType" name="VK_STRUCTURE_TYPE_SUBPASS_DESCRIPTION_DEPTH_STENCIL_RESOLVE_KHR" alias="VK_STRUCTURE_TYPE_SUBPASS_DESCRIPTION_DEPTH_STENCIL_RESOLVE"/>
+ <type name="VkSubpassDescriptionDepthStencilResolveKHR"/>
+ <type name="VkPhysicalDeviceDepthStencilResolvePropertiesKHR"/>
+ <type name="VkResolveModeFlagBitsKHR"/>
+ <type name="VkResolveModeFlagsKHR"/>
+ <enum extends="VkResolveModeFlagBits" name="VK_RESOLVE_MODE_NONE_KHR" alias="VK_RESOLVE_MODE_NONE"/>
+ <enum extends="VkResolveModeFlagBits" name="VK_RESOLVE_MODE_SAMPLE_ZERO_BIT_KHR" alias="VK_RESOLVE_MODE_SAMPLE_ZERO_BIT"/>
+ <enum extends="VkResolveModeFlagBits" name="VK_RESOLVE_MODE_AVERAGE_BIT_KHR" alias="VK_RESOLVE_MODE_AVERAGE_BIT"/>
+ <enum extends="VkResolveModeFlagBits" name="VK_RESOLVE_MODE_MIN_BIT_KHR" alias="VK_RESOLVE_MODE_MIN_BIT"/>
+ <enum extends="VkResolveModeFlagBits" name="VK_RESOLVE_MODE_MAX_BIT_KHR" alias="VK_RESOLVE_MODE_MAX_BIT"/>
+ </require>
+ </extension>
+ <extension name="VK_KHR_swapchain_mutable_format" number="201" type="device" author="KHR" requires="VK_KHR_swapchain,VK_KHR_maintenance2,VK_KHR_image_format_list" contact="Daniel Rakos @drakos-arm" supported="vulkan">
+ <require>
+ <enum value="1" name="VK_KHR_SWAPCHAIN_MUTABLE_FORMAT_SPEC_VERSION"/>
+ <enum value="&quot;VK_KHR_swapchain_mutable_format&quot;" name="VK_KHR_SWAPCHAIN_MUTABLE_FORMAT_EXTENSION_NAME"/>
+ <enum bitpos="2" extends="VkSwapchainCreateFlagBitsKHR" name="VK_SWAPCHAIN_CREATE_MUTABLE_FORMAT_BIT_KHR"/>
+ </require>
+ </extension>
+ <extension name="VK_NV_compute_shader_derivatives" number="202" type="device" requires="VK_KHR_get_physical_device_properties2" author="NV" contact="Pat Brown @nvpbrown" supported="vulkan">
+ <require>
+ <enum value="1" name="VK_NV_COMPUTE_SHADER_DERIVATIVES_SPEC_VERSION"/>
+ <enum value="&quot;VK_NV_compute_shader_derivatives&quot;" name="VK_NV_COMPUTE_SHADER_DERIVATIVES_EXTENSION_NAME"/>
+ <enum offset="0" extends="VkStructureType" name="VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_COMPUTE_SHADER_DERIVATIVES_FEATURES_NV"/>
+ <type name="VkPhysicalDeviceComputeShaderDerivativesFeaturesNV"/>
+ </require>
+ </extension>
+ <extension name="VK_NV_mesh_shader" number="203" type="device" requires="VK_KHR_get_physical_device_properties2" author="NV" contact="Christoph Kubisch @pixeljetstream" supported="vulkan">
+ <require>
+ <enum value="1" name="VK_NV_MESH_SHADER_SPEC_VERSION"/>
+ <enum value="&quot;VK_NV_mesh_shader&quot;" name="VK_NV_MESH_SHADER_EXTENSION_NAME"/>
+ <enum offset="0" extends="VkStructureType" name="VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_MESH_SHADER_FEATURES_NV"/>
+ <enum offset="1" extends="VkStructureType" name="VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_MESH_SHADER_PROPERTIES_NV"/>
+ <enum bitpos="6" extends="VkShaderStageFlagBits" name="VK_SHADER_STAGE_TASK_BIT_NV"/>
+ <enum bitpos="7" extends="VkShaderStageFlagBits" name="VK_SHADER_STAGE_MESH_BIT_NV"/>
+ <enum bitpos="19" extends="VkPipelineStageFlagBits" name="VK_PIPELINE_STAGE_TASK_SHADER_BIT_NV"/>
+ <enum bitpos="20" extends="VkPipelineStageFlagBits" name="VK_PIPELINE_STAGE_MESH_SHADER_BIT_NV"/>
+ <command name="vkCmdDrawMeshTasksNV"/>
+ <command name="vkCmdDrawMeshTasksIndirectNV"/>
+ <command name="vkCmdDrawMeshTasksIndirectCountNV"/>
+ <type name="VkPhysicalDeviceMeshShaderFeaturesNV"/>
+ <type name="VkPhysicalDeviceMeshShaderPropertiesNV"/>
+ <type name="VkDrawMeshTasksIndirectCommandNV"/>
+ </require>
+ </extension>
+ <extension name="VK_NV_fragment_shader_barycentric" number="204" type="device" requires="VK_KHR_get_physical_device_properties2" author="NV" contact="Pat Brown @nvpbrown" supported="vulkan" promotedto="VK_KHR_fragment_shader_barycentric">
+ <require>
+ <enum value="1" name="VK_NV_FRAGMENT_SHADER_BARYCENTRIC_SPEC_VERSION"/>
+ <enum value="&quot;VK_NV_fragment_shader_barycentric&quot;" name="VK_NV_FRAGMENT_SHADER_BARYCENTRIC_EXTENSION_NAME"/>
+ <enum extends="VkStructureType" name="VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_FRAGMENT_SHADER_BARYCENTRIC_FEATURES_NV" alias="VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_FRAGMENT_SHADER_BARYCENTRIC_FEATURES_KHR"/>
+ <type name="VkPhysicalDeviceFragmentShaderBarycentricFeaturesNV"/>
+ </require>
+ </extension>
+ <extension name="VK_NV_shader_image_footprint" number="205" type="device" requires="VK_KHR_get_physical_device_properties2" author="NV" contact="Pat Brown @nvpbrown" supported="vulkan">
+ <require>
+ <enum value="2" name="VK_NV_SHADER_IMAGE_FOOTPRINT_SPEC_VERSION"/>
+ <enum value="&quot;VK_NV_shader_image_footprint&quot;" name="VK_NV_SHADER_IMAGE_FOOTPRINT_EXTENSION_NAME"/>
+ <enum offset="0" extends="VkStructureType" name="VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_SHADER_IMAGE_FOOTPRINT_FEATURES_NV"/>
+ <type name="VkPhysicalDeviceShaderImageFootprintFeaturesNV"/>
+ </require>
+ </extension>
+ <extension name="VK_NV_scissor_exclusive" number="206" type="device" requires="VK_KHR_get_physical_device_properties2" author="NV" contact="Pat Brown @nvpbrown" supported="vulkan">
+ <require>
+ <enum value="1" name="VK_NV_SCISSOR_EXCLUSIVE_SPEC_VERSION"/>
+ <enum value="&quot;VK_NV_scissor_exclusive&quot;" name="VK_NV_SCISSOR_EXCLUSIVE_EXTENSION_NAME"/>
+ <enum offset="0" extends="VkStructureType" name="VK_STRUCTURE_TYPE_PIPELINE_VIEWPORT_EXCLUSIVE_SCISSOR_STATE_CREATE_INFO_NV"/>
+ <enum offset="1" extends="VkDynamicState" name="VK_DYNAMIC_STATE_EXCLUSIVE_SCISSOR_NV"/>
+ <enum offset="2" extends="VkStructureType" name="VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_EXCLUSIVE_SCISSOR_FEATURES_NV"/>
+ <type name="VkPipelineViewportExclusiveScissorStateCreateInfoNV"/>
+ <type name="VkPhysicalDeviceExclusiveScissorFeaturesNV"/>
+ <command name="vkCmdSetExclusiveScissorNV"/>
+ </require>
+ </extension>
+ <extension name="VK_NV_device_diagnostic_checkpoints" type="device" number="207" requires="VK_KHR_get_physical_device_properties2" author="NVIDIA" contact="Nuno Subtil @nsubtil" supported="vulkan">
+ <require>
+ <enum value="2" name="VK_NV_DEVICE_DIAGNOSTIC_CHECKPOINTS_SPEC_VERSION"/>
+ <enum value="&quot;VK_NV_device_diagnostic_checkpoints&quot;" name="VK_NV_DEVICE_DIAGNOSTIC_CHECKPOINTS_EXTENSION_NAME"/>
+ <enum offset="0" extends="VkStructureType" name="VK_STRUCTURE_TYPE_CHECKPOINT_DATA_NV"/>
+ <enum offset="1" extends="VkStructureType" name="VK_STRUCTURE_TYPE_QUEUE_FAMILY_CHECKPOINT_PROPERTIES_NV"/>
+ <type name="VkQueueFamilyCheckpointPropertiesNV"/>
+ <type name="VkCheckpointDataNV"/>
+ <command name="vkCmdSetCheckpointNV"/>
+ <command name="vkGetQueueCheckpointDataNV"/>
+ </require>
+ </extension>
+ <extension name="VK_KHR_timeline_semaphore" number="208" type="device" author="KHR" requires="VK_KHR_get_physical_device_properties2" contact="Jason Ekstrand @jekstrand" supported="vulkan" promotedto="VK_VERSION_1_2">
+ <require>
+ <enum value="2" name="VK_KHR_TIMELINE_SEMAPHORE_SPEC_VERSION"/>
+ <enum value="&quot;VK_KHR_timeline_semaphore&quot;" name="VK_KHR_TIMELINE_SEMAPHORE_EXTENSION_NAME"/>
+ <enum extends="VkStructureType" name="VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_TIMELINE_SEMAPHORE_FEATURES_KHR" alias="VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_TIMELINE_SEMAPHORE_FEATURES"/>
+ <enum extends="VkStructureType" name="VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_TIMELINE_SEMAPHORE_PROPERTIES_KHR" alias="VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_TIMELINE_SEMAPHORE_PROPERTIES"/>
+ <enum extends="VkStructureType" name="VK_STRUCTURE_TYPE_SEMAPHORE_TYPE_CREATE_INFO_KHR" alias="VK_STRUCTURE_TYPE_SEMAPHORE_TYPE_CREATE_INFO"/>
+ <enum extends="VkStructureType" name="VK_STRUCTURE_TYPE_TIMELINE_SEMAPHORE_SUBMIT_INFO_KHR" alias="VK_STRUCTURE_TYPE_TIMELINE_SEMAPHORE_SUBMIT_INFO"/>
+ <enum extends="VkStructureType" name="VK_STRUCTURE_TYPE_SEMAPHORE_WAIT_INFO_KHR" alias="VK_STRUCTURE_TYPE_SEMAPHORE_WAIT_INFO"/>
+ <enum extends="VkStructureType" name="VK_STRUCTURE_TYPE_SEMAPHORE_SIGNAL_INFO_KHR" alias="VK_STRUCTURE_TYPE_SEMAPHORE_SIGNAL_INFO"/>
+ <enum extends="VkSemaphoreType" name="VK_SEMAPHORE_TYPE_BINARY_KHR" alias="VK_SEMAPHORE_TYPE_BINARY"/>
+ <enum extends="VkSemaphoreType" name="VK_SEMAPHORE_TYPE_TIMELINE_KHR" alias="VK_SEMAPHORE_TYPE_TIMELINE"/>
+ <enum extends="VkSemaphoreWaitFlagBits" name="VK_SEMAPHORE_WAIT_ANY_BIT_KHR" alias="VK_SEMAPHORE_WAIT_ANY_BIT"/>
+ <type name="VkSemaphoreTypeKHR"/>
+ <type name="VkPhysicalDeviceTimelineSemaphoreFeaturesKHR"/>
+ <type name="VkPhysicalDeviceTimelineSemaphorePropertiesKHR"/>
+ <type name="VkSemaphoreTypeCreateInfoKHR"/>
+ <type name="VkTimelineSemaphoreSubmitInfoKHR"/>
+ <type name="VkSemaphoreWaitFlagBitsKHR"/>
+ <type name="VkSemaphoreWaitFlagsKHR"/>
+ <type name="VkSemaphoreWaitInfoKHR"/>
+ <type name="VkSemaphoreSignalInfoKHR"/>
+ <command name="vkGetSemaphoreCounterValueKHR"/>
+ <command name="vkWaitSemaphoresKHR"/>
+ <command name="vkSignalSemaphoreKHR"/>
+ </require>
+ </extension>
+ <extension name="VK_KHR_extension_209" number="209" type="device" author="KHR" contact="Ian Elliott @ianelliott" supported="disabled">
+ <require>
+ <enum value="0" name="VK_KHR_EXTENSION_209_SPEC_VERSION"/>
+ <enum value="&quot;VK_KHR_extension_209&quot;" name="VK_KHR_EXTENSION_209_EXTENSION_NAME"/>
+ </require>
+ </extension>
+ <extension name="VK_INTEL_shader_integer_functions2" number="210" type="device" requires="VK_KHR_get_physical_device_properties2" author="INTEL" contact="Ian Romanick @ianromanick" supported="vulkan">
+ <require>
+ <enum value="1" name="VK_INTEL_SHADER_INTEGER_FUNCTIONS_2_SPEC_VERSION"/>
+ <enum value="&quot;VK_INTEL_shader_integer_functions2&quot;" name="VK_INTEL_SHADER_INTEGER_FUNCTIONS_2_EXTENSION_NAME"/>
+ <enum offset="0" extends="VkStructureType" name="VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_SHADER_INTEGER_FUNCTIONS_2_FEATURES_INTEL"/>
+ <type name="VkPhysicalDeviceShaderIntegerFunctions2FeaturesINTEL"/>
+ </require>
+ </extension>
+ <extension name="VK_INTEL_performance_query" number="211" type="device" author="INTEL" contact="Lionel Landwerlin @llandwerlin" specialuse="devtools" supported="vulkan">
+ <require>
+ <enum value="2" name="VK_INTEL_PERFORMANCE_QUERY_SPEC_VERSION"/>
+ <enum value="&quot;VK_INTEL_performance_query&quot;" name="VK_INTEL_PERFORMANCE_QUERY_EXTENSION_NAME"/>
+ <enum offset="0" extends="VkStructureType" name="VK_STRUCTURE_TYPE_QUERY_POOL_PERFORMANCE_QUERY_CREATE_INFO_INTEL"/>
+ <enum extends="VkStructureType" name="VK_STRUCTURE_TYPE_QUERY_POOL_CREATE_INFO_INTEL" alias="VK_STRUCTURE_TYPE_QUERY_POOL_PERFORMANCE_QUERY_CREATE_INFO_INTEL" comment="Backwards-compatible alias containing a typo"/>
+ <enum offset="1" extends="VkStructureType" name="VK_STRUCTURE_TYPE_INITIALIZE_PERFORMANCE_API_INFO_INTEL"/>
+ <enum offset="2" extends="VkStructureType" name="VK_STRUCTURE_TYPE_PERFORMANCE_MARKER_INFO_INTEL"/>
+ <enum offset="3" extends="VkStructureType" name="VK_STRUCTURE_TYPE_PERFORMANCE_STREAM_MARKER_INFO_INTEL"/>
+ <enum offset="4" extends="VkStructureType" name="VK_STRUCTURE_TYPE_PERFORMANCE_OVERRIDE_INFO_INTEL"/>
+ <enum offset="5" extends="VkStructureType" name="VK_STRUCTURE_TYPE_PERFORMANCE_CONFIGURATION_ACQUIRE_INFO_INTEL"/>
+ <enum offset="0" extends="VkQueryType" name="VK_QUERY_TYPE_PERFORMANCE_QUERY_INTEL"/>
+ <enum offset="0" extends="VkObjectType" name="VK_OBJECT_TYPE_PERFORMANCE_CONFIGURATION_INTEL"/>
+ <type name="VkPerformanceConfigurationTypeINTEL"/>
+ <type name="VkQueryPoolSamplingModeINTEL"/>
+ <type name="VkPerformanceOverrideTypeINTEL"/>
+ <type name="VkPerformanceParameterTypeINTEL"/>
+ <type name="VkPerformanceValueTypeINTEL"/>
+ <type name="VkPerformanceValueDataINTEL"/>
+ <type name="VkPerformanceValueINTEL"/>
+ <type name="VkInitializePerformanceApiInfoINTEL"/>
+ <type name="VkQueryPoolCreateInfoINTEL"/>
+ <type name="VkQueryPoolPerformanceQueryCreateInfoINTEL"/>
+ <type name="VkPerformanceMarkerInfoINTEL"/>
+ <type name="VkPerformanceStreamMarkerInfoINTEL"/>
+ <type name="VkPerformanceOverrideInfoINTEL"/>
+ <type name="VkPerformanceConfigurationAcquireInfoINTEL"/>
+ <type name="VkPerformanceConfigurationINTEL"/>
+ <command name="vkInitializePerformanceApiINTEL"/>
+ <command name="vkUninitializePerformanceApiINTEL"/>
+ <command name="vkCmdSetPerformanceMarkerINTEL"/>
+ <command name="vkCmdSetPerformanceStreamMarkerINTEL"/>
+ <command name="vkCmdSetPerformanceOverrideINTEL"/>
+ <command name="vkAcquirePerformanceConfigurationINTEL"/>
+ <command name="vkReleasePerformanceConfigurationINTEL"/>
+ <command name="vkQueueSetPerformanceConfigurationINTEL"/>
+ <command name="vkGetPerformanceParameterINTEL"/>
+ </require>
+ </extension>
+ <extension name="VK_KHR_vulkan_memory_model" number="212" type="device" author="KHR" contact="Jeff Bolz @jeffbolznv" supported="vulkan" promotedto="VK_VERSION_1_2">
+ <require>
+ <enum value="3" name="VK_KHR_VULKAN_MEMORY_MODEL_SPEC_VERSION"/>
+ <enum value="&quot;VK_KHR_vulkan_memory_model&quot;" name="VK_KHR_VULKAN_MEMORY_MODEL_EXTENSION_NAME"/>
+ <enum extends="VkStructureType" name="VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_VULKAN_MEMORY_MODEL_FEATURES_KHR" alias="VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_VULKAN_MEMORY_MODEL_FEATURES"/>
+ <type name="VkPhysicalDeviceVulkanMemoryModelFeaturesKHR"/>
+ </require>
+ </extension>
+ <extension name="VK_EXT_pci_bus_info" number="213" type="device" author="EXT" requires="VK_KHR_get_physical_device_properties2" contact="Matthaeus G. Chajdas @anteru" supported="vulkan">
+ <require>
+ <enum value="2" name="VK_EXT_PCI_BUS_INFO_SPEC_VERSION"/>
+ <enum value="&quot;VK_EXT_pci_bus_info&quot;" name="VK_EXT_PCI_BUS_INFO_EXTENSION_NAME"/>
+ <enum offset="0" extends="VkStructureType" name="VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_PCI_BUS_INFO_PROPERTIES_EXT"/>
+ <type name="VkPhysicalDevicePCIBusInfoPropertiesEXT"/>
+ </require>
+ </extension>
+ <extension name="VK_AMD_display_native_hdr" number="214" type="device" author="AMD" requires="VK_KHR_get_physical_device_properties2,VK_KHR_get_surface_capabilities2,VK_KHR_swapchain" contact="Matthaeus G. Chajdas @anteru" supported="vulkan">
+ <require>
+ <enum value="1" name="VK_AMD_DISPLAY_NATIVE_HDR_SPEC_VERSION"/>
+ <enum value="&quot;VK_AMD_display_native_hdr&quot;" name="VK_AMD_DISPLAY_NATIVE_HDR_EXTENSION_NAME"/>
+ <enum offset="0" extends="VkStructureType" name="VK_STRUCTURE_TYPE_DISPLAY_NATIVE_HDR_SURFACE_CAPABILITIES_AMD"/>
+ <enum offset="1" extends="VkStructureType" name="VK_STRUCTURE_TYPE_SWAPCHAIN_DISPLAY_NATIVE_HDR_CREATE_INFO_AMD"/>
+ <enum offset="0" extends="VkColorSpaceKHR" name="VK_COLOR_SPACE_DISPLAY_NATIVE_AMD"/>
+ <type name="VkDisplayNativeHdrSurfaceCapabilitiesAMD"/>
+ <type name="VkSwapchainDisplayNativeHdrCreateInfoAMD"/>
+ <command name="vkSetLocalDimmingAMD"/>
+ </require>
+ </extension>
+ <extension name="VK_FUCHSIA_imagepipe_surface" number="215" type="instance" author="FUCHSIA" requires="VK_KHR_surface" platform="fuchsia" contact="Craig Stout @cdotstout" supported="vulkan">
+ <require>
+ <enum value="1" name="VK_FUCHSIA_IMAGEPIPE_SURFACE_SPEC_VERSION"/>
+ <enum value="&quot;VK_FUCHSIA_imagepipe_surface&quot;" name="VK_FUCHSIA_IMAGEPIPE_SURFACE_EXTENSION_NAME"/>
+ <enum offset="0" extends="VkStructureType" name="VK_STRUCTURE_TYPE_IMAGEPIPE_SURFACE_CREATE_INFO_FUCHSIA"/>
+ <type name="VkImagePipeSurfaceCreateFlagsFUCHSIA"/>
+ <type name="VkImagePipeSurfaceCreateInfoFUCHSIA"/>
+ <command name="vkCreateImagePipeSurfaceFUCHSIA"/>
+ </require>
+ </extension>
+ <extension name="VK_KHR_shader_terminate_invocation" number="216" type="device" author="KHR" requires="VK_KHR_get_physical_device_properties2" contact="Jesse Hall @critsec" supported="vulkan" promotedto="VK_VERSION_1_3">
+ <require>
+ <enum value="1" name="VK_KHR_SHADER_TERMINATE_INVOCATION_SPEC_VERSION"/>
+ <enum value="&quot;VK_KHR_shader_terminate_invocation&quot;" name="VK_KHR_SHADER_TERMINATE_INVOCATION_EXTENSION_NAME"/>
+ <enum extends="VkStructureType" name="VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_SHADER_TERMINATE_INVOCATION_FEATURES_KHR" alias="VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_SHADER_TERMINATE_INVOCATION_FEATURES"/>
+ <type name="VkPhysicalDeviceShaderTerminateInvocationFeaturesKHR"/>
+ </require>
+ </extension>
+ <extension name="VK_GOOGLE_extension_217" number="217" author="GOOGLE" contact="Jesse Hall @critsec" supported="disabled">
+ <require>
+ <enum value="0" name="VK_GOOGLE_EXTENSION_217_SPEC_VERSION"/>
+ <enum value="&quot;VK_GOOGLE_extension_217&quot;" name="VK_GOOGLE_EXTENSION_217_EXTENSION_NAME"/>
+ </require>
+ </extension>
+ <extension name="VK_EXT_metal_surface" number="218" type="instance" requires="VK_KHR_surface" platform="metal" supported="vulkan" author="EXT" contact="Dzmitry Malyshau @kvark">
+ <require>
+ <enum value="1" name="VK_EXT_METAL_SURFACE_SPEC_VERSION"/>
+ <enum value="&quot;VK_EXT_metal_surface&quot;" name="VK_EXT_METAL_SURFACE_EXTENSION_NAME"/>
+ <enum offset="0" extends="VkStructureType" name="VK_STRUCTURE_TYPE_METAL_SURFACE_CREATE_INFO_EXT"/>
+ <type name="VkMetalSurfaceCreateFlagsEXT"/>
+ <type name="VkMetalSurfaceCreateInfoEXT"/>
+ <command name="vkCreateMetalSurfaceEXT"/>
+ <type name="CAMetalLayer"/>
+ </require>
+ </extension>
+ <extension name="VK_EXT_fragment_density_map" number="219" type="device" requires="VK_KHR_get_physical_device_properties2" author="EXT" contact="Matthew Netsch @mnetsch" supported="vulkan">
+ <require>
+ <enum value="2" name="VK_EXT_FRAGMENT_DENSITY_MAP_SPEC_VERSION"/>
+ <enum value="&quot;VK_EXT_fragment_density_map&quot;" name="VK_EXT_FRAGMENT_DENSITY_MAP_EXTENSION_NAME"/>
+ <enum offset="0" extends="VkStructureType" name="VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_FRAGMENT_DENSITY_MAP_FEATURES_EXT"/>
+ <enum offset="1" extends="VkStructureType" name="VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_FRAGMENT_DENSITY_MAP_PROPERTIES_EXT"/>
+ <enum offset="2" extends="VkStructureType" name="VK_STRUCTURE_TYPE_RENDER_PASS_FRAGMENT_DENSITY_MAP_CREATE_INFO_EXT"/>
+ <enum bitpos="14" extends="VkImageCreateFlagBits" name="VK_IMAGE_CREATE_SUBSAMPLED_BIT_EXT"/>
+ <enum offset="0" extends="VkImageLayout" name="VK_IMAGE_LAYOUT_FRAGMENT_DENSITY_MAP_OPTIMAL_EXT"/>
+ <enum bitpos="24" extends="VkAccessFlagBits" name="VK_ACCESS_FRAGMENT_DENSITY_MAP_READ_BIT_EXT"/>
+ <enum bitpos="24" extends="VkFormatFeatureFlagBits" name="VK_FORMAT_FEATURE_FRAGMENT_DENSITY_MAP_BIT_EXT"/>
+ <enum bitpos="9" extends="VkImageUsageFlagBits" name="VK_IMAGE_USAGE_FRAGMENT_DENSITY_MAP_BIT_EXT"/>
+ <enum bitpos="0" extends="VkImageViewCreateFlagBits" name="VK_IMAGE_VIEW_CREATE_FRAGMENT_DENSITY_MAP_DYNAMIC_BIT_EXT"/>
+ <enum bitpos="23" extends="VkPipelineStageFlagBits" name="VK_PIPELINE_STAGE_FRAGMENT_DENSITY_PROCESS_BIT_EXT"/>
+ <enum bitpos="0" extends="VkSamplerCreateFlagBits" name="VK_SAMPLER_CREATE_SUBSAMPLED_BIT_EXT"/>
+ <enum bitpos="1" extends="VkSamplerCreateFlagBits" name="VK_SAMPLER_CREATE_SUBSAMPLED_COARSE_RECONSTRUCTION_BIT_EXT"/>
+ <type name="VkPhysicalDeviceFragmentDensityMapFeaturesEXT"/>
+ <type name="VkPhysicalDeviceFragmentDensityMapPropertiesEXT"/>
+ <type name="VkRenderPassFragmentDensityMapCreateInfoEXT"/>
+ </require>
+ <require extension="VK_KHR_format_feature_flags2">
+ <enum bitpos="24" extends="VkFormatFeatureFlagBits2" name="VK_FORMAT_FEATURE_2_FRAGMENT_DENSITY_MAP_BIT_EXT"/>
+ </require>
+ </extension>
+ <extension name="VK_EXT_extension_220" number="220" author="EXT" contact="Dzmitry Malyshau @kvark" supported="disabled">
+ <require>
+ <enum value="0" name="VK_EXT_EXTENSION_220_SPEC_VERSION"/>
+ <enum value="&quot;VK_EXT_extension_220&quot;" name="VK_EXT_EXTENSION_220_EXTENSION_NAME"/>
+ </require>
+ </extension>
+ <extension name="VK_KHR_extension_221" number="221" author="KHR" contact="Tobias Hector @tobski" supported="disabled">
+ <require>
+ <enum value="0" name="VK_KHR_EXTENSION_221_SPEC_VERSION"/>
+ <enum value="&quot;VK_KHR_extension_221&quot;" name="VK_KHR_EXTENSION_221_EXTENSION_NAME"/>
+ <enum bitpos="0" extends="VkRenderPassCreateFlagBits" name="VK_RENDER_PASS_CREATE_RESERVED_0_BIT_KHR"/>
+ </require>
+ </extension>
+ <extension name="VK_EXT_scalar_block_layout" number="222" requires="VK_KHR_get_physical_device_properties2" type="device" author="EXT" contact="Tobias Hector @tobski" supported="vulkan" promotedto="VK_VERSION_1_2">
+ <require>
+ <enum value="1" name="VK_EXT_SCALAR_BLOCK_LAYOUT_SPEC_VERSION"/>
+ <enum value="&quot;VK_EXT_scalar_block_layout&quot;" name="VK_EXT_SCALAR_BLOCK_LAYOUT_EXTENSION_NAME"/>
+ <type name="VkPhysicalDeviceScalarBlockLayoutFeaturesEXT"/>
+ <enum extends="VkStructureType" name="VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_SCALAR_BLOCK_LAYOUT_FEATURES_EXT" alias="VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_SCALAR_BLOCK_LAYOUT_FEATURES"/>
+ </require>
+ </extension>
+ <extension name="VK_EXT_extension_223" number="223" author="EXT" contact="Tobias Hector @tobski" supported="disabled">
+ <require>
+ <enum value="0" name="VK_EXT_EXTENSION_223_SPEC_VERSION"/>
+ <enum value="&quot;VK_EXT_extension_223&quot;" name="VK_EXT_EXTENSION_223_EXTENSION_NAME"/>
+ </require>
+ </extension>
+ <extension name="VK_GOOGLE_hlsl_functionality1" number="224" type="device" author="GOOGLE" contact="Hai Nguyen @chaoticbob" supported="vulkan">
+ <require>
+ <enum value="1" name="VK_GOOGLE_HLSL_FUNCTIONALITY_1_SPEC_VERSION"/>
+ <enum value="&quot;VK_GOOGLE_hlsl_functionality1&quot;" name="VK_GOOGLE_HLSL_FUNCTIONALITY_1_EXTENSION_NAME"/>
+ <enum alias="VK_GOOGLE_HLSL_FUNCTIONALITY_1_SPEC_VERSION" name="VK_GOOGLE_HLSL_FUNCTIONALITY1_SPEC_VERSION" comment="Backwards-compatible alias containing a typo"/>
+ <enum alias="VK_GOOGLE_HLSL_FUNCTIONALITY_1_EXTENSION_NAME" name="VK_GOOGLE_HLSL_FUNCTIONALITY1_EXTENSION_NAME" comment="Backwards-compatible alias containing a typo"/>
+ </require>
+ </extension>
+ <extension name="VK_GOOGLE_decorate_string" number="225" type="device" author="GOOGLE" contact="Hai Nguyen @chaoticbob" supported="vulkan">
+ <require>
+ <enum value="1" name="VK_GOOGLE_DECORATE_STRING_SPEC_VERSION"/>
+ <enum value="&quot;VK_GOOGLE_decorate_string&quot;" name="VK_GOOGLE_DECORATE_STRING_EXTENSION_NAME"/>
+ </require>
+ </extension>
+ <extension name="VK_EXT_subgroup_size_control" number="226" type="device" requiresCore="1.1" author="EXT" contact="Neil Henning @sheredom" supported="vulkan" promotedto="VK_VERSION_1_3">
+ <require>
+ <enum value="2" name="VK_EXT_SUBGROUP_SIZE_CONTROL_SPEC_VERSION"/>
+ <enum value="&quot;VK_EXT_subgroup_size_control&quot;" name="VK_EXT_SUBGROUP_SIZE_CONTROL_EXTENSION_NAME"/>
+ <type name="VkPhysicalDeviceSubgroupSizeControlFeaturesEXT"/>
+ <type name="VkPhysicalDeviceSubgroupSizeControlPropertiesEXT"/>
+ <type name="VkPipelineShaderStageRequiredSubgroupSizeCreateInfoEXT"/>
+ <enum extends="VkStructureType" name="VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_SUBGROUP_SIZE_CONTROL_PROPERTIES_EXT" alias="VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_SUBGROUP_SIZE_CONTROL_PROPERTIES"/>
+ <enum extends="VkStructureType" name="VK_STRUCTURE_TYPE_PIPELINE_SHADER_STAGE_REQUIRED_SUBGROUP_SIZE_CREATE_INFO_EXT" alias="VK_STRUCTURE_TYPE_PIPELINE_SHADER_STAGE_REQUIRED_SUBGROUP_SIZE_CREATE_INFO"/>
+ <enum extends="VkStructureType" name="VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_SUBGROUP_SIZE_CONTROL_FEATURES_EXT" alias="VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_SUBGROUP_SIZE_CONTROL_FEATURES"/>
+ <enum extends="VkPipelineShaderStageCreateFlagBits" name="VK_PIPELINE_SHADER_STAGE_CREATE_ALLOW_VARYING_SUBGROUP_SIZE_BIT_EXT" alias="VK_PIPELINE_SHADER_STAGE_CREATE_ALLOW_VARYING_SUBGROUP_SIZE_BIT"/>
+ <enum extends="VkPipelineShaderStageCreateFlagBits" name="VK_PIPELINE_SHADER_STAGE_CREATE_REQUIRE_FULL_SUBGROUPS_BIT_EXT" alias="VK_PIPELINE_SHADER_STAGE_CREATE_REQUIRE_FULL_SUBGROUPS_BIT"/>
+ </require>
+ </extension>
+ <extension name="VK_KHR_fragment_shading_rate" number="227" type="device" requires="VK_KHR_create_renderpass2,VK_KHR_get_physical_device_properties2" author="KHR" contact="Tobias Hector @tobski" supported="vulkan">
+ <require>
+ <enum value="2" name="VK_KHR_FRAGMENT_SHADING_RATE_SPEC_VERSION"/>
+ <enum value="&quot;VK_KHR_fragment_shading_rate&quot;" name="VK_KHR_FRAGMENT_SHADING_RATE_EXTENSION_NAME"/>
+ <type name="VkFragmentShadingRateCombinerOpKHR"/>
+ <type name="VkFragmentShadingRateAttachmentInfoKHR"/>
+ <type name="VkPipelineFragmentShadingRateStateCreateInfoKHR"/>
+ <type name="VkPhysicalDeviceFragmentShadingRateFeaturesKHR"/>
+ <type name="VkPhysicalDeviceFragmentShadingRatePropertiesKHR"/>
+ <type name="VkPhysicalDeviceFragmentShadingRateKHR"/>
+ <command name="vkGetPhysicalDeviceFragmentShadingRatesKHR"/>
+ <command name="vkCmdSetFragmentShadingRateKHR"/>
+ <enum offset="3" extends="VkImageLayout" extnumber="165" name="VK_IMAGE_LAYOUT_FRAGMENT_SHADING_RATE_ATTACHMENT_OPTIMAL_KHR"/>
+ <enum offset="0" extends="VkDynamicState" name="VK_DYNAMIC_STATE_FRAGMENT_SHADING_RATE_KHR"/>
+ <enum offset="0" extends="VkStructureType" name="VK_STRUCTURE_TYPE_FRAGMENT_SHADING_RATE_ATTACHMENT_INFO_KHR"/>
+ <enum offset="1" extends="VkStructureType" name="VK_STRUCTURE_TYPE_PIPELINE_FRAGMENT_SHADING_RATE_STATE_CREATE_INFO_KHR"/>
+ <enum offset="2" extends="VkStructureType" name="VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_FRAGMENT_SHADING_RATE_PROPERTIES_KHR"/>
+ <enum offset="3" extends="VkStructureType" name="VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_FRAGMENT_SHADING_RATE_FEATURES_KHR"/>
+ <enum offset="4" extends="VkStructureType" name="VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_FRAGMENT_SHADING_RATE_KHR"/>
+ <enum bitpos="23" extends="VkAccessFlagBits" name="VK_ACCESS_FRAGMENT_SHADING_RATE_ATTACHMENT_READ_BIT_KHR"/>
+ <enum bitpos="8" extends="VkImageUsageFlagBits" name="VK_IMAGE_USAGE_FRAGMENT_SHADING_RATE_ATTACHMENT_BIT_KHR"/>
+ <enum bitpos="22" extends="VkPipelineStageFlagBits" name="VK_PIPELINE_STAGE_FRAGMENT_SHADING_RATE_ATTACHMENT_BIT_KHR"/>
+ <enum bitpos="30" extends="VkFormatFeatureFlagBits" name="VK_FORMAT_FEATURE_FRAGMENT_SHADING_RATE_ATTACHMENT_BIT_KHR"/>
+ </require>
+ <require extension="VK_KHR_format_feature_flags2">
+ <enum bitpos="30" extends="VkFormatFeatureFlagBits2" name="VK_FORMAT_FEATURE_2_FRAGMENT_SHADING_RATE_ATTACHMENT_BIT_KHR"/>
+ </require>
+ </extension>
+ <extension name="VK_AMD_shader_core_properties2" number="228" type="device" author="AMD" contact="Matthaeus G. Chajdas @anteru" supported="vulkan" requires="VK_AMD_shader_core_properties">
+ <require>
+ <enum value="1" name="VK_AMD_SHADER_CORE_PROPERTIES_2_SPEC_VERSION"/>
+ <enum value="&quot;VK_AMD_shader_core_properties2&quot;" name="VK_AMD_SHADER_CORE_PROPERTIES_2_EXTENSION_NAME"/>
+ <enum offset="0" extends="VkStructureType" name="VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_SHADER_CORE_PROPERTIES_2_AMD"/>
+ <type name="VkPhysicalDeviceShaderCoreProperties2AMD"/>
+ <type name="VkShaderCorePropertiesFlagBitsAMD"/>
+ <type name="VkShaderCorePropertiesFlagsAMD"/>
+ </require>
+ </extension>
+ <extension name="VK_AMD_extension_229" number="229" author="AMD" contact="Martin Dinkov @mdinkov" supported="disabled">
+ <require>
+ <enum value="0" name="VK_AMD_EXTENSION_229_SPEC_VERSION"/>
+ <enum value="&quot;VK_AMD_extension_229&quot;" name="VK_AMD_EXTENSION_229_EXTENSION_NAME"/>
+ </require>
+ </extension>
+ <extension name="VK_AMD_device_coherent_memory" number="230" type="device" author="AMD" contact="Tobias Hector @tobski" supported="vulkan">
+ <require>
+ <enum value="1" name="VK_AMD_DEVICE_COHERENT_MEMORY_SPEC_VERSION"/>
+ <enum value="&quot;VK_AMD_device_coherent_memory&quot;" name="VK_AMD_DEVICE_COHERENT_MEMORY_EXTENSION_NAME"/>
+ <enum bitpos="6" extends="VkMemoryPropertyFlagBits" name="VK_MEMORY_PROPERTY_DEVICE_COHERENT_BIT_AMD"/>
+ <enum bitpos="7" extends="VkMemoryPropertyFlagBits" name="VK_MEMORY_PROPERTY_DEVICE_UNCACHED_BIT_AMD"/>
+ <enum offset="0" extends="VkStructureType" name="VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_COHERENT_MEMORY_FEATURES_AMD"/>
+ <type name="VkPhysicalDeviceCoherentMemoryFeaturesAMD"/>
+ </require>
+ </extension>
+ <extension name="VK_AMD_extension_231" number="231" author="AMD" contact="Martin Dinkov @mdinkov" supported="disabled">
+ <require>
+ <enum value="0" name="VK_AMD_EXTENSION_231_SPEC_VERSION"/>
+ <enum value="&quot;VK_AMD_extension_231&quot;" name="VK_AMD_EXTENSION_231_EXTENSION_NAME"/>
+ </require>
+ </extension>
+ <extension name="VK_AMD_extension_232" number="232" author="AMD" contact="Martin Dinkov @mdinkov" supported="disabled">
+ <require>
+ <enum value="0" name="VK_AMD_EXTENSION_232_SPEC_VERSION"/>
+ <enum value="&quot;VK_AMD_extension_232&quot;" name="VK_AMD_EXTENSION_232_EXTENSION_NAME"/>
+ </require>
+ </extension>
+ <extension name="VK_AMD_extension_233" number="233" author="AMD" contact="Martin Dinkov @mdinkov" supported="disabled">
+ <require>
+ <enum value="0" name="VK_AMD_EXTENSION_233_SPEC_VERSION"/>
+ <enum value="&quot;VK_AMD_extension_233&quot;" name="VK_AMD_EXTENSION_233_EXTENSION_NAME"/>
+ </require>
+ </extension>
+ <extension name="VK_AMD_extension_234" number="234" author="AMD" contact="Martin Dinkov @mdinkov" supported="disabled">
+ <require>
+ <enum value="0" name="VK_AMD_EXTENSION_234_SPEC_VERSION"/>
+ <enum value="&quot;VK_AMD_extension_234&quot;" name="VK_AMD_EXTENSION_234_EXTENSION_NAME"/>
+ </require>
+ </extension>
+ <extension name="VK_EXT_shader_image_atomic_int64" number="235" type="device" requires="VK_KHR_get_physical_device_properties2" author="EXT" contact="Tobias Hector @tobski" supported="vulkan">
+ <require>
+ <enum value="1" name="VK_EXT_SHADER_IMAGE_ATOMIC_INT64_SPEC_VERSION"/>
+ <enum value="&quot;VK_EXT_shader_image_atomic_int64&quot;" name="VK_EXT_SHADER_IMAGE_ATOMIC_INT64_EXTENSION_NAME"/>
+ <enum offset="0" extends="VkStructureType" name="VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_SHADER_IMAGE_ATOMIC_INT64_FEATURES_EXT"/>
+ <type name="VkPhysicalDeviceShaderImageAtomicInt64FeaturesEXT"/>
+ </require>
+ </extension>
+ <extension name="VK_AMD_extension_236" number="236" author="AMD" contact="Martin Dinkov @mdinkov" supported="disabled">
+ <require>
+ <enum value="0" name="VK_AMD_EXTENSION_236_SPEC_VERSION"/>
+ <enum value="&quot;VK_AMD_extension_236&quot;" name="VK_AMD_EXTENSION_236_EXTENSION_NAME"/>
+ </require>
+ </extension>
+ <extension name="VK_KHR_spirv_1_4" number="237" type="device" requiresCore="1.1" requires="VK_KHR_shader_float_controls" author="KHR" contact="Jesse Hall @critsec" supported="vulkan" promotedto="VK_VERSION_1_2">
+ <require>
+ <enum value="1" name="VK_KHR_SPIRV_1_4_SPEC_VERSION"/>
+ <enum value="&quot;VK_KHR_spirv_1_4&quot;" name="VK_KHR_SPIRV_1_4_EXTENSION_NAME"/>
+ </require>
+ </extension>
+ <extension name="VK_EXT_memory_budget" number="238" type="device" requires="VK_KHR_get_physical_device_properties2" author="EXT" contact="Jeff Bolz @jeffbolznv" supported="vulkan">
+ <require>
+ <enum value="1" name="VK_EXT_MEMORY_BUDGET_SPEC_VERSION"/>
+ <enum value="&quot;VK_EXT_memory_budget&quot;" name="VK_EXT_MEMORY_BUDGET_EXTENSION_NAME"/>
+ <enum offset="0" extends="VkStructureType" name="VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_MEMORY_BUDGET_PROPERTIES_EXT"/>
+ <type name="VkPhysicalDeviceMemoryBudgetPropertiesEXT"/>
+ </require>
+ </extension>
+ <extension name="VK_EXT_memory_priority" number="239" type="device" requires="VK_KHR_get_physical_device_properties2" author="EXT" contact="Jeff Bolz @jeffbolznv" supported="vulkan">
+ <require>
+ <enum value="1" name="VK_EXT_MEMORY_PRIORITY_SPEC_VERSION"/>
+ <enum value="&quot;VK_EXT_memory_priority&quot;" name="VK_EXT_MEMORY_PRIORITY_EXTENSION_NAME"/>
+ <enum offset="0" extends="VkStructureType" name="VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_MEMORY_PRIORITY_FEATURES_EXT"/>
+ <enum offset="1" extends="VkStructureType" name="VK_STRUCTURE_TYPE_MEMORY_PRIORITY_ALLOCATE_INFO_EXT"/>
+ <type name="VkPhysicalDeviceMemoryPriorityFeaturesEXT"/>
+ <type name="VkMemoryPriorityAllocateInfoEXT"/>
+ </require>
+ </extension>
+ <extension name="VK_KHR_surface_protected_capabilities" number="240" type="instance" requiresCore="1.1" requires="VK_KHR_get_surface_capabilities2" author="KHR" contact="Sandeep Shinde @sashinde" supported="vulkan">
+ <require>
+ <enum value="1" name="VK_KHR_SURFACE_PROTECTED_CAPABILITIES_SPEC_VERSION"/>
+ <enum value="&quot;VK_KHR_surface_protected_capabilities&quot;" name="VK_KHR_SURFACE_PROTECTED_CAPABILITIES_EXTENSION_NAME"/>
+ <enum offset="0" extends="VkStructureType" name="VK_STRUCTURE_TYPE_SURFACE_PROTECTED_CAPABILITIES_KHR"/>
+ <type name="VkSurfaceProtectedCapabilitiesKHR"/>
+ </require>
+ </extension>
+ <extension name="VK_NV_dedicated_allocation_image_aliasing" number="241" type="device" requires="VK_KHR_dedicated_allocation" author="NVIDIA" contact="Nuno Subtil @nsubtil" supported="vulkan">
+ <require>
+ <enum value="1" name="VK_NV_DEDICATED_ALLOCATION_IMAGE_ALIASING_SPEC_VERSION"/>
+ <enum value="&quot;VK_NV_dedicated_allocation_image_aliasing&quot;" name="VK_NV_DEDICATED_ALLOCATION_IMAGE_ALIASING_EXTENSION_NAME"/>
+ <enum offset="0" extends="VkStructureType" name="VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_DEDICATED_ALLOCATION_IMAGE_ALIASING_FEATURES_NV"/>
+ <type name="VkPhysicalDeviceDedicatedAllocationImageAliasingFeaturesNV"/>
+ </require>
+ </extension>
+ <extension name="VK_KHR_separate_depth_stencil_layouts" number="242" type="device" requires="VK_KHR_get_physical_device_properties2,VK_KHR_create_renderpass2" author="KHR" contact="Piers Daniell @pdaniell-nv" supported="vulkan" promotedto="VK_VERSION_1_2">
+ <require>
+ <enum value="1" name="VK_KHR_SEPARATE_DEPTH_STENCIL_LAYOUTS_SPEC_VERSION"/>
+ <enum value="&quot;VK_KHR_separate_depth_stencil_layouts&quot;" name="VK_KHR_SEPARATE_DEPTH_STENCIL_LAYOUTS_EXTENSION_NAME"/>
+ <enum extends="VkStructureType" name="VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_SEPARATE_DEPTH_STENCIL_LAYOUTS_FEATURES_KHR" alias="VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_SEPARATE_DEPTH_STENCIL_LAYOUTS_FEATURES"/>
+ <enum extends="VkStructureType" name="VK_STRUCTURE_TYPE_ATTACHMENT_REFERENCE_STENCIL_LAYOUT_KHR" alias="VK_STRUCTURE_TYPE_ATTACHMENT_REFERENCE_STENCIL_LAYOUT"/>
+ <enum extends="VkStructureType" name="VK_STRUCTURE_TYPE_ATTACHMENT_DESCRIPTION_STENCIL_LAYOUT_KHR" alias="VK_STRUCTURE_TYPE_ATTACHMENT_DESCRIPTION_STENCIL_LAYOUT"/>
+ <enum extends="VkImageLayout" name="VK_IMAGE_LAYOUT_DEPTH_ATTACHMENT_OPTIMAL_KHR" alias="VK_IMAGE_LAYOUT_DEPTH_ATTACHMENT_OPTIMAL"/>
+ <enum extends="VkImageLayout" name="VK_IMAGE_LAYOUT_DEPTH_READ_ONLY_OPTIMAL_KHR" alias="VK_IMAGE_LAYOUT_DEPTH_READ_ONLY_OPTIMAL"/>
+ <enum extends="VkImageLayout" name="VK_IMAGE_LAYOUT_STENCIL_ATTACHMENT_OPTIMAL_KHR" alias="VK_IMAGE_LAYOUT_STENCIL_ATTACHMENT_OPTIMAL"/>
+ <enum extends="VkImageLayout" name="VK_IMAGE_LAYOUT_STENCIL_READ_ONLY_OPTIMAL_KHR" alias="VK_IMAGE_LAYOUT_STENCIL_READ_ONLY_OPTIMAL"/>
+ <type name="VkPhysicalDeviceSeparateDepthStencilLayoutsFeaturesKHR"/>
+ <type name="VkAttachmentReferenceStencilLayoutKHR"/>
+ <type name="VkAttachmentDescriptionStencilLayoutKHR"/>
+ </require>
+ </extension>
+ <extension name="VK_INTEL_extension_243" number="243" author="INTEL" contact="Slawek Grajewski @sgrajewski" supported="disabled">
+ <require>
+ <enum value="0" name="VK_INTEL_EXTENSION_243_SPEC_VERSION"/>
+ <enum value="&quot;VK_INTEL_extension_243&quot;" name="VK_INTEL_EXTENSION_243_EXTENSION_NAME"/>
+ </require>
+ </extension>
+ <extension name="VK_MESA_extension_244" number="244" author="MESA" contact="Andres Rodriguez @lostgoat" supported="disabled">
+ <require>
+ <enum value="0" name="VK_MESA_EXTENSION_244_SPEC_VERSION"/>
+ <enum value="&quot;VK_MESA_extension_244&quot;" name="VK_MESA_EXTENSION_244_EXTENSION_NAME"/>
+ </require>
+ </extension>
+ <extension name="VK_EXT_buffer_device_address" number="245" type="device" requires="VK_KHR_get_physical_device_properties2" author="NV" contact="Jeff Bolz @jeffbolznv" deprecatedby="VK_KHR_buffer_device_address" supported="vulkan">
+ <require>
+ <enum value="2" name="VK_EXT_BUFFER_DEVICE_ADDRESS_SPEC_VERSION"/>
+ <enum value="&quot;VK_EXT_buffer_device_address&quot;" name="VK_EXT_BUFFER_DEVICE_ADDRESS_EXTENSION_NAME"/>
+ <enum offset="0" extends="VkStructureType" name="VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_BUFFER_DEVICE_ADDRESS_FEATURES_EXT"/>
+ <enum extends="VkStructureType" name="VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_BUFFER_ADDRESS_FEATURES_EXT" alias="VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_BUFFER_DEVICE_ADDRESS_FEATURES_EXT"/>
+ <enum extends="VkStructureType" name="VK_STRUCTURE_TYPE_BUFFER_DEVICE_ADDRESS_INFO_EXT" alias="VK_STRUCTURE_TYPE_BUFFER_DEVICE_ADDRESS_INFO"/>
+ <enum offset="2" extends="VkStructureType" name="VK_STRUCTURE_TYPE_BUFFER_DEVICE_ADDRESS_CREATE_INFO_EXT"/>
+ <enum extends="VkBufferUsageFlagBits" name="VK_BUFFER_USAGE_SHADER_DEVICE_ADDRESS_BIT_EXT" alias="VK_BUFFER_USAGE_SHADER_DEVICE_ADDRESS_BIT"/>
+ <enum extends="VkBufferCreateFlagBits" name="VK_BUFFER_CREATE_DEVICE_ADDRESS_CAPTURE_REPLAY_BIT_EXT" alias="VK_BUFFER_CREATE_DEVICE_ADDRESS_CAPTURE_REPLAY_BIT"/>
+ <enum extends="VkResult" name="VK_ERROR_INVALID_DEVICE_ADDRESS_EXT" alias="VK_ERROR_INVALID_OPAQUE_CAPTURE_ADDRESS"/>
+ <type name="VkPhysicalDeviceBufferAddressFeaturesEXT"/>
+ <type name="VkPhysicalDeviceBufferDeviceAddressFeaturesEXT"/>
+ <type name="VkBufferDeviceAddressInfoEXT"/>
+ <type name="VkBufferDeviceAddressCreateInfoEXT"/>
+ <command name="vkGetBufferDeviceAddressEXT"/>
+ </require>
+ </extension>
+ <extension name="VK_EXT_tooling_info" number="246" type="device" author="EXT" contact="Tobias Hector @tobski" supported="vulkan" promotedto="VK_VERSION_1_3">
+ <require>
+ <enum value="1" name="VK_EXT_TOOLING_INFO_SPEC_VERSION"/>
+ <enum value="&quot;VK_EXT_tooling_info&quot;" name="VK_EXT_TOOLING_INFO_EXTENSION_NAME"/>
+ <enum extends="VkStructureType" name="VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_TOOL_PROPERTIES_EXT" alias="VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_TOOL_PROPERTIES"/>
+ <type name="VkToolPurposeFlagBitsEXT"/>
+ <type name="VkToolPurposeFlagsEXT"/>
+ <type name="VkPhysicalDeviceToolPropertiesEXT"/>
+ <command name="vkGetPhysicalDeviceToolPropertiesEXT"/>
+ </require>
+ <require extension="VK_EXT_debug_report">
+ <enum bitpos="5" extends="VkToolPurposeFlagBits" name="VK_TOOL_PURPOSE_DEBUG_REPORTING_BIT_EXT"/>
+ </require>
+ <require extension="VK_EXT_debug_marker">
+ <enum bitpos="6" extends="VkToolPurposeFlagBits" name="VK_TOOL_PURPOSE_DEBUG_MARKERS_BIT_EXT"/>
+ </require>
+ <require extension="VK_EXT_debug_utils">
+ <enum bitpos="5" extends="VkToolPurposeFlagBits" name="VK_TOOL_PURPOSE_DEBUG_REPORTING_BIT_EXT"/>
+ <enum bitpos="6" extends="VkToolPurposeFlagBits" name="VK_TOOL_PURPOSE_DEBUG_MARKERS_BIT_EXT"/>
+ </require>
+ </extension>
+ <extension name="VK_EXT_separate_stencil_usage" number="247" type="device" author="EXT" contact="Daniel Rakos @drakos-amd" supported="vulkan" promotedto="VK_VERSION_1_2">
+ <require>
+ <enum value="1" name="VK_EXT_SEPARATE_STENCIL_USAGE_SPEC_VERSION"/>
+ <enum value="&quot;VK_EXT_separate_stencil_usage&quot;" name="VK_EXT_SEPARATE_STENCIL_USAGE_EXTENSION_NAME"/>
+ <enum extends="VkStructureType" name="VK_STRUCTURE_TYPE_IMAGE_STENCIL_USAGE_CREATE_INFO_EXT" alias="VK_STRUCTURE_TYPE_IMAGE_STENCIL_USAGE_CREATE_INFO"/>
+ <type name="VkImageStencilUsageCreateInfoEXT"/>
+ </require>
+ </extension>
+ <extension name="VK_EXT_validation_features" number="248" type="instance" author="LUNARG" contact="Karl Schultz @karl-lunarg" specialuse="debugging" supported="vulkan">
+ <require>
+ <enum value="5" name="VK_EXT_VALIDATION_FEATURES_SPEC_VERSION"/>
+ <enum value="&quot;VK_EXT_validation_features&quot;" name="VK_EXT_VALIDATION_FEATURES_EXTENSION_NAME"/>
+ <enum offset="0" extends="VkStructureType" name="VK_STRUCTURE_TYPE_VALIDATION_FEATURES_EXT"/>
+ <type name="VkValidationFeaturesEXT"/>
+ <type name="VkValidationFeatureEnableEXT"/>
+ <type name="VkValidationFeatureDisableEXT"/>
+ </require>
+ </extension>
+ <extension name="VK_KHR_present_wait" number="249" type="device" requires="VK_KHR_swapchain,VK_KHR_present_id" author="KHR" contact="Keith Packard @keithp" supported="vulkan">
+ <require>
+ <enum value="1" name="VK_KHR_PRESENT_WAIT_SPEC_VERSION"/>
+ <enum value="&quot;VK_KHR_present_wait&quot;" name="VK_KHR_PRESENT_WAIT_EXTENSION_NAME"/>
+ <command name="vkWaitForPresentKHR"/>
+ <enum offset="0" extends="VkStructureType" name="VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_PRESENT_WAIT_FEATURES_KHR"/>
+ <type name="VkPhysicalDevicePresentWaitFeaturesKHR"/>
+ </require>
+ </extension>
+ <extension name="VK_NV_cooperative_matrix" number="250" type="device" requires="VK_KHR_get_physical_device_properties2" author="NV" contact="Jeff Bolz @jeffbolznv" supported="vulkan">
+ <require>
+ <enum value="1" name="VK_NV_COOPERATIVE_MATRIX_SPEC_VERSION"/>
+ <enum value="&quot;VK_NV_cooperative_matrix&quot;" name="VK_NV_COOPERATIVE_MATRIX_EXTENSION_NAME"/>
+ <enum offset="0" extends="VkStructureType" name="VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_COOPERATIVE_MATRIX_FEATURES_NV"/>
+ <enum offset="1" extends="VkStructureType" name="VK_STRUCTURE_TYPE_COOPERATIVE_MATRIX_PROPERTIES_NV"/>
+ <enum offset="2" extends="VkStructureType" name="VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_COOPERATIVE_MATRIX_PROPERTIES_NV"/>
+ <type name="VkCooperativeMatrixPropertiesNV"/>
+ <type name="VkScopeNV"/>
+ <type name="VkComponentTypeNV"/>
+ <type name="VkPhysicalDeviceCooperativeMatrixFeaturesNV"/>
+ <type name="VkPhysicalDeviceCooperativeMatrixPropertiesNV"/>
+ <command name="vkGetPhysicalDeviceCooperativeMatrixPropertiesNV"/>
+ </require>
+ </extension>
+ <extension name="VK_NV_coverage_reduction_mode" number="251" requires="VK_NV_framebuffer_mixed_samples" type="device" author="NV" contact="Kedarnath Thangudu @kthangudu" supported="vulkan">
+ <require>
+ <enum value="1" name="VK_NV_COVERAGE_REDUCTION_MODE_SPEC_VERSION"/>
+ <enum value="&quot;VK_NV_coverage_reduction_mode&quot;" name="VK_NV_COVERAGE_REDUCTION_MODE_EXTENSION_NAME"/>
+ <enum offset="0" extends="VkStructureType" name="VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_COVERAGE_REDUCTION_MODE_FEATURES_NV"/>
+ <enum offset="1" extends="VkStructureType" name="VK_STRUCTURE_TYPE_PIPELINE_COVERAGE_REDUCTION_STATE_CREATE_INFO_NV"/>
+ <enum offset="2" extends="VkStructureType" name="VK_STRUCTURE_TYPE_FRAMEBUFFER_MIXED_SAMPLES_COMBINATION_NV"/>
+ <type name="VkPhysicalDeviceCoverageReductionModeFeaturesNV"/>
+ <type name="VkPipelineCoverageReductionStateCreateInfoNV"/>
+ <type name="VkPipelineCoverageReductionStateCreateFlagsNV"/>
+ <type name="VkCoverageReductionModeNV"/>
+ <type name="VkFramebufferMixedSamplesCombinationNV"/>
+ <command name="vkGetPhysicalDeviceSupportedFramebufferMixedSamplesCombinationsNV"/>
+ </require>
+ </extension>
+ <extension name="VK_EXT_fragment_shader_interlock" number="252" author="EXT" type="device" requires="VK_KHR_get_physical_device_properties2" contact="Piers Daniell @pdaniell-nv" supported="vulkan">
+ <require>
+ <enum value="1" name="VK_EXT_FRAGMENT_SHADER_INTERLOCK_SPEC_VERSION"/>
+ <enum value="&quot;VK_EXT_fragment_shader_interlock&quot;" name="VK_EXT_FRAGMENT_SHADER_INTERLOCK_EXTENSION_NAME"/>
+ <enum offset="0" extends="VkStructureType" name="VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_FRAGMENT_SHADER_INTERLOCK_FEATURES_EXT"/>
+ <type name="VkPhysicalDeviceFragmentShaderInterlockFeaturesEXT"/>
+ </require>
+ </extension>
+ <extension name="VK_EXT_ycbcr_image_arrays" number="253" type="device" requires="VK_KHR_sampler_ycbcr_conversion" author="EXT" contact="Piers Daniell @pdaniell-nv" supported="vulkan">
+ <require>
+ <enum value="1" name="VK_EXT_YCBCR_IMAGE_ARRAYS_SPEC_VERSION"/>
+ <enum value="&quot;VK_EXT_ycbcr_image_arrays&quot;" name="VK_EXT_YCBCR_IMAGE_ARRAYS_EXTENSION_NAME"/>
+ <enum offset="0" extends="VkStructureType" name="VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_YCBCR_IMAGE_ARRAYS_FEATURES_EXT"/>
+ <type name="VkPhysicalDeviceYcbcrImageArraysFeaturesEXT"/>
+ </require>
+ </extension>
+ <extension name="VK_KHR_uniform_buffer_standard_layout" number="254" requires="VK_KHR_get_physical_device_properties2" type="device" author="KHR" contact="Graeme Leese @gnl21" supported="vulkan" promotedto="VK_VERSION_1_2">
+ <require>
+ <enum value="1" name="VK_KHR_UNIFORM_BUFFER_STANDARD_LAYOUT_SPEC_VERSION"/>
+ <enum value="&quot;VK_KHR_uniform_buffer_standard_layout&quot;" name="VK_KHR_UNIFORM_BUFFER_STANDARD_LAYOUT_EXTENSION_NAME"/>
+ <type name="VkPhysicalDeviceUniformBufferStandardLayoutFeaturesKHR"/>
+ <enum extends="VkStructureType" name="VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_UNIFORM_BUFFER_STANDARD_LAYOUT_FEATURES_KHR" alias="VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_UNIFORM_BUFFER_STANDARD_LAYOUT_FEATURES"/>
+ </require>
+ </extension>
+ <extension name="VK_EXT_provoking_vertex" number="255" type="device" author="EXT" requires="VK_KHR_get_physical_device_properties2" contact="Jesse Hall @jessehall" specialuse="glemulation" supported="vulkan">
+ <require>
+ <enum value="1" name="VK_EXT_PROVOKING_VERTEX_SPEC_VERSION"/>
+ <enum value="&quot;VK_EXT_provoking_vertex&quot;" name="VK_EXT_PROVOKING_VERTEX_EXTENSION_NAME"/>
+ <enum offset="0" extends="VkStructureType" name="VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_PROVOKING_VERTEX_FEATURES_EXT"/>
+ <enum offset="1" extends="VkStructureType" name="VK_STRUCTURE_TYPE_PIPELINE_RASTERIZATION_PROVOKING_VERTEX_STATE_CREATE_INFO_EXT"/>
+ <enum offset="2" extends="VkStructureType" name="VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_PROVOKING_VERTEX_PROPERTIES_EXT"/>
+ <type name="VkPhysicalDeviceProvokingVertexFeaturesEXT"/>
+ <type name="VkPhysicalDeviceProvokingVertexPropertiesEXT"/>
+ <type name="VkPipelineRasterizationProvokingVertexStateCreateInfoEXT"/>
+ <type name="VkProvokingVertexModeEXT"/>
+ </require>
+ </extension>
+ <extension name="VK_EXT_full_screen_exclusive" number="256" type="device" author="EXT" requires="VK_KHR_get_physical_device_properties2,VK_KHR_surface,VK_KHR_get_surface_capabilities2,VK_KHR_swapchain" platform="win32" contact="James Jones @cubanismo" supported="vulkan">
+ <require>
+ <enum value="4" name="VK_EXT_FULL_SCREEN_EXCLUSIVE_SPEC_VERSION"/>
+ <enum value="&quot;VK_EXT_full_screen_exclusive&quot;" name="VK_EXT_FULL_SCREEN_EXCLUSIVE_EXTENSION_NAME"/>
+ <enum offset="0" extends="VkStructureType" name="VK_STRUCTURE_TYPE_SURFACE_FULL_SCREEN_EXCLUSIVE_INFO_EXT"/>
+ <enum offset="2" extends="VkStructureType" name="VK_STRUCTURE_TYPE_SURFACE_CAPABILITIES_FULL_SCREEN_EXCLUSIVE_EXT"/>
+ <enum offset="0" extends="VkResult" dir="-" name="VK_ERROR_FULL_SCREEN_EXCLUSIVE_MODE_LOST_EXT"/>
+ <type name="VkFullScreenExclusiveEXT"/>
+ <type name="VkSurfaceFullScreenExclusiveInfoEXT"/>
+ <type name="VkSurfaceCapabilitiesFullScreenExclusiveEXT"/>
+ <command name="vkGetPhysicalDeviceSurfacePresentModes2EXT"/>
+ <command name="vkAcquireFullScreenExclusiveModeEXT"/>
+ <command name="vkReleaseFullScreenExclusiveModeEXT"/>
+ </require>
+ <require extension="VK_KHR_win32_surface">
+ <enum offset="1" extends="VkStructureType" name="VK_STRUCTURE_TYPE_SURFACE_FULL_SCREEN_EXCLUSIVE_WIN32_INFO_EXT"/>
+ <type name="VkSurfaceFullScreenExclusiveWin32InfoEXT"/>
+ </require>
+ <require extension="VK_KHR_device_group">
+ <command name="vkGetDeviceGroupSurfacePresentModes2EXT"/>
+ </require>
+ <require feature="VK_VERSION_1_1">
+ <command name="vkGetDeviceGroupSurfacePresentModes2EXT"/>
+ </require>
+ </extension>
+ <extension name="VK_EXT_headless_surface" number="257" type="instance" requires="VK_KHR_surface" author="EXT" contact="Lisa Wu @chengtianww" supported="vulkan">
+ <require>
+ <enum value="1" name="VK_EXT_HEADLESS_SURFACE_SPEC_VERSION"/>
+ <enum value="&quot;VK_EXT_headless_surface&quot;" name="VK_EXT_HEADLESS_SURFACE_EXTENSION_NAME"/>
+ <enum offset="0" extends="VkStructureType" name="VK_STRUCTURE_TYPE_HEADLESS_SURFACE_CREATE_INFO_EXT"/>
+ <type name="VkHeadlessSurfaceCreateFlagsEXT"/>
+ <type name="VkHeadlessSurfaceCreateInfoEXT"/>
+ <command name="vkCreateHeadlessSurfaceEXT"/>
+ </require>
+ </extension>
+ <extension name="VK_KHR_buffer_device_address" number="258" type="device" requires="VK_KHR_get_physical_device_properties2" author="KHR" contact="Jeff Bolz @jeffbolznv" supported="vulkan" promotedto="VK_VERSION_1_2">
+ <require>
+ <enum value="1" name="VK_KHR_BUFFER_DEVICE_ADDRESS_SPEC_VERSION"/>
+ <enum value="&quot;VK_KHR_buffer_device_address&quot;" name="VK_KHR_BUFFER_DEVICE_ADDRESS_EXTENSION_NAME"/>
+ <enum extends="VkStructureType" name="VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_BUFFER_DEVICE_ADDRESS_FEATURES_KHR" alias="VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_BUFFER_DEVICE_ADDRESS_FEATURES"/>
+ <enum extends="VkStructureType" name="VK_STRUCTURE_TYPE_BUFFER_DEVICE_ADDRESS_INFO_KHR" alias="VK_STRUCTURE_TYPE_BUFFER_DEVICE_ADDRESS_INFO"/>
+ <enum extends="VkStructureType" name="VK_STRUCTURE_TYPE_BUFFER_OPAQUE_CAPTURE_ADDRESS_CREATE_INFO_KHR" alias="VK_STRUCTURE_TYPE_BUFFER_OPAQUE_CAPTURE_ADDRESS_CREATE_INFO"/>
+ <enum extends="VkStructureType" name="VK_STRUCTURE_TYPE_MEMORY_OPAQUE_CAPTURE_ADDRESS_ALLOCATE_INFO_KHR" alias="VK_STRUCTURE_TYPE_MEMORY_OPAQUE_CAPTURE_ADDRESS_ALLOCATE_INFO"/>
+ <enum extends="VkStructureType" name="VK_STRUCTURE_TYPE_DEVICE_MEMORY_OPAQUE_CAPTURE_ADDRESS_INFO_KHR" alias="VK_STRUCTURE_TYPE_DEVICE_MEMORY_OPAQUE_CAPTURE_ADDRESS_INFO"/>
+ <enum extends="VkBufferUsageFlagBits" name="VK_BUFFER_USAGE_SHADER_DEVICE_ADDRESS_BIT_KHR" alias="VK_BUFFER_USAGE_SHADER_DEVICE_ADDRESS_BIT"/>
+ <enum extends="VkBufferCreateFlagBits" name="VK_BUFFER_CREATE_DEVICE_ADDRESS_CAPTURE_REPLAY_BIT_KHR" alias="VK_BUFFER_CREATE_DEVICE_ADDRESS_CAPTURE_REPLAY_BIT"/>
+ <enum extends="VkMemoryAllocateFlagBits" name="VK_MEMORY_ALLOCATE_DEVICE_ADDRESS_BIT_KHR" alias="VK_MEMORY_ALLOCATE_DEVICE_ADDRESS_BIT"/>
+ <enum extends="VkMemoryAllocateFlagBits" name="VK_MEMORY_ALLOCATE_DEVICE_ADDRESS_CAPTURE_REPLAY_BIT_KHR" alias="VK_MEMORY_ALLOCATE_DEVICE_ADDRESS_CAPTURE_REPLAY_BIT"/>
+ <enum extends="VkResult" name="VK_ERROR_INVALID_OPAQUE_CAPTURE_ADDRESS_KHR" alias="VK_ERROR_INVALID_OPAQUE_CAPTURE_ADDRESS"/>
+ <type name="VkPhysicalDeviceBufferDeviceAddressFeaturesKHR"/>
+ <type name="VkBufferDeviceAddressInfoKHR"/>
+ <type name="VkBufferOpaqueCaptureAddressCreateInfoKHR"/>
+ <type name="VkMemoryOpaqueCaptureAddressAllocateInfoKHR"/>
+ <type name="VkDeviceMemoryOpaqueCaptureAddressInfoKHR"/>
+ <command name="vkGetBufferDeviceAddressKHR"/>
+ <command name="vkGetBufferOpaqueCaptureAddressKHR"/>
+ <command name="vkGetDeviceMemoryOpaqueCaptureAddressKHR"/>
+ </require>
+ </extension>
+ <extension name="VK_EXT_extension_259" number="259" author="EXT" contact="Jeff Leger @jackohound" supported="disabled">
+ <require>
+ <enum value="0" name="VK_EXT_EXTENSION_259_SPEC_VERSION"/>
+ <enum value="&quot;VK_EXT_extension_259&quot;" name="VK_EXT_EXTENSION_259_EXTENSION_NAME"/>
+ <enum bitpos="9" extends="VkQueueFlagBits" name="VK_QUEUE_RESERVED_9_BIT_EXT"/>
+ <enum bitpos="44" extends="VkFormatFeatureFlagBits2" name="VK_FORMAT_FEATURE_2_RESERVED_44_BIT_EXT"/>
+ <enum bitpos="45" extends="VkFormatFeatureFlagBits2" name="VK_FORMAT_FEATURE_2_RESERVED_45_BIT_EXT"/>
+ <enum bitpos="19" extends="VkImageCreateFlagBits" name="VK_IMAGE_CREATE_RESERVED_19_BIT_EXT"/>
+ </require>
+ </extension>
+ <extension name="VK_EXT_line_rasterization" number="260" type="device" requires="VK_KHR_get_physical_device_properties2" author="EXT" contact="Jeff Bolz @jeffbolznv" specialuse="cadsupport" supported="vulkan">
+ <require>
+ <enum value="1" name="VK_EXT_LINE_RASTERIZATION_SPEC_VERSION"/>
+ <enum value="&quot;VK_EXT_line_rasterization&quot;" name="VK_EXT_LINE_RASTERIZATION_EXTENSION_NAME"/>
+ <enum offset="0" extends="VkStructureType" name="VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_LINE_RASTERIZATION_FEATURES_EXT"/>
+ <enum offset="1" extends="VkStructureType" name="VK_STRUCTURE_TYPE_PIPELINE_RASTERIZATION_LINE_STATE_CREATE_INFO_EXT"/>
+ <enum offset="2" extends="VkStructureType" name="VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_LINE_RASTERIZATION_PROPERTIES_EXT"/>
+ <enum offset="0" extends="VkDynamicState" name="VK_DYNAMIC_STATE_LINE_STIPPLE_EXT"/>
+ <type name="VkPhysicalDeviceLineRasterizationFeaturesEXT"/>
+ <type name="VkPhysicalDeviceLineRasterizationPropertiesEXT"/>
+ <type name="VkPipelineRasterizationLineStateCreateInfoEXT"/>
+ <type name="VkLineRasterizationModeEXT"/>
+ <command name="vkCmdSetLineStippleEXT"/>
+ </require>
+ </extension>
+ <extension name="VK_EXT_shader_atomic_float" number="261" type="device" author="NV" requires="VK_KHR_get_physical_device_properties2" contact="Vikram Kushwaha @vkushwaha-nv" supported="vulkan">
+ <require>
+ <enum value="1" name="VK_EXT_SHADER_ATOMIC_FLOAT_SPEC_VERSION"/>
+ <enum value="&quot;VK_EXT_shader_atomic_float&quot;" name="VK_EXT_SHADER_ATOMIC_FLOAT_EXTENSION_NAME"/>
+ <enum offset="0" extends="VkStructureType" name="VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_SHADER_ATOMIC_FLOAT_FEATURES_EXT"/>
+ <type name="VkPhysicalDeviceShaderAtomicFloatFeaturesEXT"/>
+ </require>
+ </extension>
+ <extension name="VK_EXT_host_query_reset" number="262" author="EXT" contact="Bas Nieuwenhuizen @BNieuwenhuizen" supported="vulkan" type="device" requires="VK_KHR_get_physical_device_properties2" promotedto="VK_VERSION_1_2">
+ <require>
+ <enum value="1" name="VK_EXT_HOST_QUERY_RESET_SPEC_VERSION"/>
+ <enum value="&quot;VK_EXT_host_query_reset&quot;" name="VK_EXT_HOST_QUERY_RESET_EXTENSION_NAME"/>
+ <enum extends="VkStructureType" name="VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_HOST_QUERY_RESET_FEATURES_EXT" alias="VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_HOST_QUERY_RESET_FEATURES"/>
+ <type name="VkPhysicalDeviceHostQueryResetFeaturesEXT"/>
+ <command name="vkResetQueryPoolEXT"/>
+ </require>
+ </extension>
+ <extension name="VK_GGP_extension_263" number="263" author="GGP" contact="Jean-Francois Roy @jfroy" supported="disabled">
+ <require>
+ <enum value="0" name="VK_GGP_EXTENSION_263_SPEC_VERSION"/>
+ <enum value="&quot;VK_GGP_extension_263&quot;" name="VK_GGP_EXTENSION_263_EXTENSION_NAME"/>
+ </require>
+ </extension>
+ <extension name="VK_BRCM_extension_264" number="264" author="BRCM" contact="Graeme Leese @gnl21" supported="disabled">
+ <require>
+ <enum value="0" name="VK_BRCM_EXTENSION_264_SPEC_VERSION"/>
+ <enum value="&quot;VK_BRCM_extension_264&quot;" name="VK_BRCM_EXTENSION_264_EXTENSION_NAME"/>
+ </require>
+ </extension>
+ <extension name="VK_BRCM_extension_265" number="265" author="BRCM" contact="Graeme Leese @gnl21" supported="disabled">
+ <require>
+ <enum value="0" name="VK_BRCM_EXTENSION_265_SPEC_VERSION"/>
+ <enum value="&quot;VK_BRCM_extension_265&quot;" name="VK_BRCM_EXTENSION_265_EXTENSION_NAME"/>
+ </require>
+ </extension>
+ <extension name="VK_EXT_index_type_uint8" number="266" type="device" author="EXT" contact="Piers Daniell @pdaniell-nv" supported="vulkan">
+ <require>
+ <enum value="1" name="VK_EXT_INDEX_TYPE_UINT8_SPEC_VERSION"/>
+ <enum value="&quot;VK_EXT_index_type_uint8&quot;" name="VK_EXT_INDEX_TYPE_UINT8_EXTENSION_NAME"/>
+ <enum offset="0" extends="VkStructureType" name="VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_INDEX_TYPE_UINT8_FEATURES_EXT"/>
+ <enum offset="0" extends="VkIndexType" name="VK_INDEX_TYPE_UINT8_EXT"/>
+ <type name="VkPhysicalDeviceIndexTypeUint8FeaturesEXT"/>
+ </require>
+ </extension>
+ <extension name="VK_EXT_extension_267" number="267" type="device" author="EXT" contact="Piers Daniell @pdaniell-nv" supported="disabled">
+ <require>
+ <enum value="0" name="VK_EXT_EXTENSION_267_SPEC_VERSION"/>
+ <enum value="&quot;VK_EXT_extension_267&quot;" name="VK_EXT_EXTENSION_267_EXTENSION_NAME"/>
+ </require>
+ </extension>
+ <extension name="VK_EXT_extended_dynamic_state" number="268" type="device" requires="VK_KHR_get_physical_device_properties2" author="EXT" contact="Piers Daniell @pdaniell-nv" supported="vulkan" promotedto="VK_VERSION_1_3">
+ <require>
+ <enum value="1" name="VK_EXT_EXTENDED_DYNAMIC_STATE_SPEC_VERSION"/>
+ <enum value="&quot;VK_EXT_extended_dynamic_state&quot;" name="VK_EXT_EXTENDED_DYNAMIC_STATE_EXTENSION_NAME"/>
+ <enum offset="0" extends="VkStructureType" name="VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_EXTENDED_DYNAMIC_STATE_FEATURES_EXT" comment="Not promoted to 1.3"/>
+ <enum extends="VkDynamicState" name="VK_DYNAMIC_STATE_CULL_MODE_EXT" alias="VK_DYNAMIC_STATE_CULL_MODE"/>
+ <enum extends="VkDynamicState" name="VK_DYNAMIC_STATE_FRONT_FACE_EXT" alias="VK_DYNAMIC_STATE_FRONT_FACE"/>
+ <enum extends="VkDynamicState" name="VK_DYNAMIC_STATE_PRIMITIVE_TOPOLOGY_EXT" alias="VK_DYNAMIC_STATE_PRIMITIVE_TOPOLOGY"/>
+ <enum extends="VkDynamicState" name="VK_DYNAMIC_STATE_VIEWPORT_WITH_COUNT_EXT" alias="VK_DYNAMIC_STATE_VIEWPORT_WITH_COUNT"/>
+ <enum extends="VkDynamicState" name="VK_DYNAMIC_STATE_SCISSOR_WITH_COUNT_EXT" alias="VK_DYNAMIC_STATE_SCISSOR_WITH_COUNT"/>
+ <enum extends="VkDynamicState" name="VK_DYNAMIC_STATE_VERTEX_INPUT_BINDING_STRIDE_EXT" alias="VK_DYNAMIC_STATE_VERTEX_INPUT_BINDING_STRIDE"/>
+ <enum extends="VkDynamicState" name="VK_DYNAMIC_STATE_DEPTH_TEST_ENABLE_EXT" alias="VK_DYNAMIC_STATE_DEPTH_TEST_ENABLE"/>
+ <enum extends="VkDynamicState" name="VK_DYNAMIC_STATE_DEPTH_WRITE_ENABLE_EXT" alias="VK_DYNAMIC_STATE_DEPTH_WRITE_ENABLE"/>
+ <enum extends="VkDynamicState" name="VK_DYNAMIC_STATE_DEPTH_COMPARE_OP_EXT" alias="VK_DYNAMIC_STATE_DEPTH_COMPARE_OP"/>
+ <enum extends="VkDynamicState" name="VK_DYNAMIC_STATE_DEPTH_BOUNDS_TEST_ENABLE_EXT" alias="VK_DYNAMIC_STATE_DEPTH_BOUNDS_TEST_ENABLE"/>
+ <enum extends="VkDynamicState" name="VK_DYNAMIC_STATE_STENCIL_TEST_ENABLE_EXT" alias="VK_DYNAMIC_STATE_STENCIL_TEST_ENABLE"/>
+ <enum extends="VkDynamicState" name="VK_DYNAMIC_STATE_STENCIL_OP_EXT" alias="VK_DYNAMIC_STATE_STENCIL_OP"/>
+ <type name="VkPhysicalDeviceExtendedDynamicStateFeaturesEXT" comment="Not promoted to 1.3"/>
+ <command name="vkCmdSetCullModeEXT"/>
+ <command name="vkCmdSetFrontFaceEXT"/>
+ <command name="vkCmdSetPrimitiveTopologyEXT"/>
+ <command name="vkCmdSetViewportWithCountEXT"/>
+ <command name="vkCmdSetScissorWithCountEXT"/>
+ <command name="vkCmdBindVertexBuffers2EXT"/>
+ <command name="vkCmdSetDepthTestEnableEXT"/>
+ <command name="vkCmdSetDepthWriteEnableEXT"/>
+ <command name="vkCmdSetDepthCompareOpEXT"/>
+ <command name="vkCmdSetDepthBoundsTestEnableEXT"/>
+ <command name="vkCmdSetStencilTestEnableEXT"/>
+ <command name="vkCmdSetStencilOpEXT"/>
+ </require>
+ </extension>
+ <extension name="VK_KHR_deferred_host_operations" number="269" type="device" author="KHR" contact="Josh Barczak @jbarczak" supported="vulkan">
+ <require>
+ <enum value="4" name="VK_KHR_DEFERRED_HOST_OPERATIONS_SPEC_VERSION"/>
+ <enum value="&quot;VK_KHR_deferred_host_operations&quot;" name="VK_KHR_DEFERRED_HOST_OPERATIONS_EXTENSION_NAME"/>
+ <enum offset="0" extends="VkObjectType" name="VK_OBJECT_TYPE_DEFERRED_OPERATION_KHR"/>
+ <type name="VkDeferredOperationKHR"/>
+ <command name="vkCreateDeferredOperationKHR"/>
+ <command name="vkDestroyDeferredOperationKHR"/>
+ <command name="vkGetDeferredOperationMaxConcurrencyKHR"/>
+ <command name="vkGetDeferredOperationResultKHR"/>
+ <command name="vkDeferredOperationJoinKHR" />
+ <enum extends="VkResult" offset="0" name="VK_THREAD_IDLE_KHR" />
+ <enum extends="VkResult" offset="1" name="VK_THREAD_DONE_KHR" />
+ <enum extends="VkResult" offset="2" name="VK_OPERATION_DEFERRED_KHR" />
+ <enum extends="VkResult" offset="3" name="VK_OPERATION_NOT_DEFERRED_KHR" />
+ </require>
+ </extension>
+ <extension name="VK_KHR_pipeline_executable_properties" number="270" type="device" requires="VK_KHR_get_physical_device_properties2" author="KHR" contact="Jason Ekstrand @jekstrand" specialuse="devtools" supported="vulkan">
+ <require>
+ <enum value="1" name="VK_KHR_PIPELINE_EXECUTABLE_PROPERTIES_SPEC_VERSION"/>
+ <enum value="&quot;VK_KHR_pipeline_executable_properties&quot;" name="VK_KHR_PIPELINE_EXECUTABLE_PROPERTIES_EXTENSION_NAME"/>
+ <enum offset="0" extends="VkStructureType" name="VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_PIPELINE_EXECUTABLE_PROPERTIES_FEATURES_KHR"/>
+ <enum offset="1" extends="VkStructureType" name="VK_STRUCTURE_TYPE_PIPELINE_INFO_KHR"/>
+ <enum offset="2" extends="VkStructureType" name="VK_STRUCTURE_TYPE_PIPELINE_EXECUTABLE_PROPERTIES_KHR"/>
+ <enum offset="3" extends="VkStructureType" name="VK_STRUCTURE_TYPE_PIPELINE_EXECUTABLE_INFO_KHR"/>
+ <enum offset="4" extends="VkStructureType" name="VK_STRUCTURE_TYPE_PIPELINE_EXECUTABLE_STATISTIC_KHR"/>
+ <enum offset="5" extends="VkStructureType" name="VK_STRUCTURE_TYPE_PIPELINE_EXECUTABLE_INTERNAL_REPRESENTATION_KHR"/>
+ <enum bitpos="6" extends="VkPipelineCreateFlagBits" name="VK_PIPELINE_CREATE_CAPTURE_STATISTICS_BIT_KHR"/>
+ <enum bitpos="7" extends="VkPipelineCreateFlagBits" name="VK_PIPELINE_CREATE_CAPTURE_INTERNAL_REPRESENTATIONS_BIT_KHR"/>
+ <type name="VkPhysicalDevicePipelineExecutablePropertiesFeaturesKHR"/>
+ <type name="VkPipelineInfoKHR"/>
+ <type name="VkPipelineExecutablePropertiesKHR"/>
+ <type name="VkPipelineExecutableInfoKHR"/>
+ <type name="VkPipelineExecutableStatisticFormatKHR"/>
+ <type name="VkPipelineExecutableStatisticValueKHR"/>
+ <type name="VkPipelineExecutableStatisticKHR"/>
+ <type name="VkPipelineExecutableInternalRepresentationKHR"/>
+ <command name="vkGetPipelineExecutablePropertiesKHR"/>
+ <command name="vkGetPipelineExecutableStatisticsKHR"/>
+ <command name="vkGetPipelineExecutableInternalRepresentationsKHR"/>
+ </require>
+ </extension>
+ <extension name="VK_INTEL_extension_271" number="271" type="device" author="INTEL" contact="Jason Ekstrand @jekstrand" supported="disabled">
+ <require>
+ <enum value="0" name="VK_INTEL_EXTENSION_271_SPEC_VERSION"/>
+ <enum value="&quot;VK_INTEL_extension_271&quot;" name="VK_INTEL_EXTENSION_271_EXTENSION_NAME"/>
+ <enum bitpos="22" extends="VkImageUsageFlagBits" name="VK_IMAGE_USAGE_RESERVED_22_BIT_EXT"/>
+ </require>
+ </extension>
+ <extension name="VK_INTEL_extension_272" number="272" type="device" author="INTEL" contact="Jason Ekstrand @jekstrand" supported="disabled">
+ <require>
+ <enum value="0" name="VK_INTEL_EXTENSION_272_SPEC_VERSION"/>
+ <enum value="&quot;VK_INTEL_extension_272&quot;" name="VK_INTEL_EXTENSION_272_EXTENSION_NAME"/>
+ </require>
+ </extension>
+ <extension name="VK_INTEL_extension_273" number="273" type="device" author="INTEL" contact="Jason Ekstrand @jekstrand" supported="disabled">
+ <require>
+ <enum value="0" name="VK_INTEL_EXTENSION_273_SPEC_VERSION"/>
+ <enum value="&quot;VK_INTEL_extension_273&quot;" name="VK_INTEL_EXTENSION_273_EXTENSION_NAME"/>
+ </require>
+ </extension>
+ <extension name="VK_EXT_shader_atomic_float2" number="274" type="device" requires="VK_EXT_shader_atomic_float" author="EXT" contact="Jason Ekstrand @jekstrand" supported="vulkan">
+ <require>
+ <enum value="1" name="VK_EXT_SHADER_ATOMIC_FLOAT_2_SPEC_VERSION"/>
+ <enum value="&quot;VK_EXT_shader_atomic_float2&quot;" name="VK_EXT_SHADER_ATOMIC_FLOAT_2_EXTENSION_NAME"/>
+ <enum offset="0" extends="VkStructureType" name="VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_SHADER_ATOMIC_FLOAT_2_FEATURES_EXT"/>
+ <type name="VkPhysicalDeviceShaderAtomicFloat2FeaturesEXT"/>
+ </require>
+ </extension>
+ <extension name="VK_KHR_extension_275" number="275" type="instance" author="KHR" contact="Lionel Landwerlin @llandwerlin" supported="disabled">
+ <require>
+ <enum value="0" name="VK_KHR_EXTENSION_275_SPEC_VERSION"/>
+ <enum value="&quot;VK_KHR_extension_275&quot;" name="VK_KHR_EXTENSION_275_EXTENSION_NAME"/>
+ </require>
+ </extension>
+ <extension name="VK_KHR_extension_276" number="276" type="device" author="KHR" contact="James Jones @cubanismo" supported="disabled">
+ <require>
+ <enum value="0" name="VK_KHR_EXTENSION_276_SPEC_VERSION"/>
+ <enum value="&quot;VK_KHR_extension_276&quot;" name="VK_KHR_EXTENSION_276_EXTENSION_NAME"/>
+ </require>
+ </extension>
+ <extension name="VK_EXT_shader_demote_to_helper_invocation" number="277" type="device" requires="VK_KHR_get_physical_device_properties2" author="EXT" contact="Jeff Bolz @jeffbolznv" supported="vulkan" promotedto="VK_VERSION_1_3">
+ <require>
+ <enum value="1" name="VK_EXT_SHADER_DEMOTE_TO_HELPER_INVOCATION_SPEC_VERSION"/>
+ <enum value="&quot;VK_EXT_shader_demote_to_helper_invocation&quot;" name="VK_EXT_SHADER_DEMOTE_TO_HELPER_INVOCATION_EXTENSION_NAME"/>
+ <enum extends="VkStructureType" name="VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_SHADER_DEMOTE_TO_HELPER_INVOCATION_FEATURES_EXT" alias="VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_SHADER_DEMOTE_TO_HELPER_INVOCATION_FEATURES"/>
+ <type name="VkPhysicalDeviceShaderDemoteToHelperInvocationFeaturesEXT"/>
+ </require>
+ </extension>
+ <extension name="VK_NV_device_generated_commands" number="278" type="device" requiresCore="1.1" requires="VK_KHR_buffer_device_address" author="NV" contact="Christoph Kubisch @pixeljetstream" supported="vulkan">
+ <require>
+ <comment>
+ This extension requires buffer_device_address functionality.
+ VK_EXT_buffer_device_address is also acceptable, but since it is deprecated the KHR version is preferred.
+ </comment>
+ <enum value="3" name="VK_NV_DEVICE_GENERATED_COMMANDS_SPEC_VERSION"/>
+ <enum value="&quot;VK_NV_device_generated_commands&quot;" name="VK_NV_DEVICE_GENERATED_COMMANDS_EXTENSION_NAME"/>
+ <enum offset="0" extends="VkStructureType" name="VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_DEVICE_GENERATED_COMMANDS_PROPERTIES_NV"/>
+ <enum offset="1" extends="VkStructureType" name="VK_STRUCTURE_TYPE_GRAPHICS_SHADER_GROUP_CREATE_INFO_NV"/>
+ <enum offset="2" extends="VkStructureType" name="VK_STRUCTURE_TYPE_GRAPHICS_PIPELINE_SHADER_GROUPS_CREATE_INFO_NV"/>
+ <enum offset="3" extends="VkStructureType" name="VK_STRUCTURE_TYPE_INDIRECT_COMMANDS_LAYOUT_TOKEN_NV"/>
+ <enum offset="4" extends="VkStructureType" name="VK_STRUCTURE_TYPE_INDIRECT_COMMANDS_LAYOUT_CREATE_INFO_NV"/>
+ <enum offset="5" extends="VkStructureType" name="VK_STRUCTURE_TYPE_GENERATED_COMMANDS_INFO_NV"/>
+ <enum offset="6" extends="VkStructureType" name="VK_STRUCTURE_TYPE_GENERATED_COMMANDS_MEMORY_REQUIREMENTS_INFO_NV"/>
+ <enum offset="7" extends="VkStructureType" name="VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_DEVICE_GENERATED_COMMANDS_FEATURES_NV"/>
+ <enum bitpos="18" extends="VkPipelineCreateFlagBits" name="VK_PIPELINE_CREATE_INDIRECT_BINDABLE_BIT_NV"/>
+ <enum bitpos="17" extends="VkPipelineStageFlagBits" name="VK_PIPELINE_STAGE_COMMAND_PREPROCESS_BIT_NV"/>
+ <enum bitpos="17" extends="VkAccessFlagBits" name="VK_ACCESS_COMMAND_PREPROCESS_READ_BIT_NV"/>
+ <enum bitpos="18" extends="VkAccessFlagBits" name="VK_ACCESS_COMMAND_PREPROCESS_WRITE_BIT_NV"/>
+ <enum offset="0" extends="VkObjectType" name="VK_OBJECT_TYPE_INDIRECT_COMMANDS_LAYOUT_NV"/>
+ <type name="VkPhysicalDeviceDeviceGeneratedCommandsPropertiesNV"/>
+ <type name="VkPhysicalDeviceDeviceGeneratedCommandsFeaturesNV"/>
+ <type name="VkGraphicsShaderGroupCreateInfoNV"/>
+ <type name="VkGraphicsPipelineShaderGroupsCreateInfoNV"/>
+ <type name="VkBindShaderGroupIndirectCommandNV"/>
+ <type name="VkBindIndexBufferIndirectCommandNV"/>
+ <type name="VkBindVertexBufferIndirectCommandNV"/>
+ <type name="VkSetStateFlagsIndirectCommandNV"/>
+ <type name="VkIndirectStateFlagBitsNV"/>
+ <type name="VkIndirectStateFlagsNV"/>
+ <type name="VkIndirectCommandsLayoutNV"/>
+ <type name="VkIndirectCommandsTokenTypeNV"/>
+ <type name="VkIndirectCommandsLayoutUsageFlagBitsNV"/>
+ <type name="VkIndirectCommandsLayoutUsageFlagsNV"/>
+ <type name="VkIndirectCommandsStreamNV"/>
+ <type name="VkIndirectCommandsLayoutTokenNV"/>
+ <type name="VkIndirectCommandsLayoutCreateInfoNV"/>
+ <type name="VkGeneratedCommandsInfoNV"/>
+ <type name="VkGeneratedCommandsMemoryRequirementsInfoNV"/>
+ <command name="vkGetGeneratedCommandsMemoryRequirementsNV"/>
+ <command name="vkCmdPreprocessGeneratedCommandsNV"/>
+ <command name="vkCmdExecuteGeneratedCommandsNV"/>
+ <command name="vkCmdBindPipelineShaderGroupNV"/>
+ <command name="vkCreateIndirectCommandsLayoutNV"/>
+ <command name="vkDestroyIndirectCommandsLayoutNV"/>
+ </require>
+ </extension>
+ <extension name="VK_NV_inherited_viewport_scissor" number="279" type="device" author="NV" contact="David Zhao Akeley @akeley98" supported="vulkan">
+ <require>
+ <enum value="1" name="VK_NV_INHERITED_VIEWPORT_SCISSOR_SPEC_VERSION"/>
+ <enum value="&quot;VK_NV_inherited_viewport_scissor&quot;" name="VK_NV_INHERITED_VIEWPORT_SCISSOR_EXTENSION_NAME"/>
+ <enum offset="0" extends="VkStructureType" name="VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_INHERITED_VIEWPORT_SCISSOR_FEATURES_NV"/>
+ <enum offset="1" extends="VkStructureType" name="VK_STRUCTURE_TYPE_COMMAND_BUFFER_INHERITANCE_VIEWPORT_SCISSOR_INFO_NV"/>
+ <type name="VkPhysicalDeviceInheritedViewportScissorFeaturesNV"/>
+ <type name="VkCommandBufferInheritanceViewportScissorInfoNV"/>
+ </require>
+ </extension>
+ <extension name="VK_KHR_extension_280" number="280" type="device" author="KHR" contact="Kevin Petit @kevinpetit" supported="disabled">
+ <require>
+ <enum value="0" name="VK_KHR_EXTENSION_280_SPEC_VERSION"/>
+ <enum value="&quot;VK_KHR_extension_280&quot;" name="VK_KHR_EXTENSION_280_EXTENSION_NAME"/>
+ </require>
+ </extension>
+ <extension name="VK_KHR_shader_integer_dot_product" number="281" type="device" author="KHR" requires="VK_KHR_get_physical_device_properties2" contact="Kevin Petit @kevinpetit" supported="vulkan" promotedto="VK_VERSION_1_3">
+ <require>
+ <enum value="1" name="VK_KHR_SHADER_INTEGER_DOT_PRODUCT_SPEC_VERSION"/>
+ <enum value="&quot;VK_KHR_shader_integer_dot_product&quot;" name="VK_KHR_SHADER_INTEGER_DOT_PRODUCT_EXTENSION_NAME"/>
+ <enum extends="VkStructureType" name="VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_SHADER_INTEGER_DOT_PRODUCT_FEATURES_KHR" alias="VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_SHADER_INTEGER_DOT_PRODUCT_FEATURES"/>
+ <enum extends="VkStructureType" name="VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_SHADER_INTEGER_DOT_PRODUCT_PROPERTIES_KHR" alias="VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_SHADER_INTEGER_DOT_PRODUCT_PROPERTIES"/>
+ <type name="VkPhysicalDeviceShaderIntegerDotProductFeaturesKHR"/>
+ <type name="VkPhysicalDeviceShaderIntegerDotProductPropertiesKHR"/>
+ </require>
+ </extension>
+ <extension name="VK_EXT_texel_buffer_alignment" number="282" type="device" requires="VK_KHR_get_physical_device_properties2" author="EXT" contact="Jeff Bolz @jeffbolznv" supported="vulkan" promotedto="VK_VERSION_1_3">
+ <require>
+ <enum value="1" name="VK_EXT_TEXEL_BUFFER_ALIGNMENT_SPEC_VERSION"/>
+ <enum value="&quot;VK_EXT_texel_buffer_alignment&quot;" name="VK_EXT_TEXEL_BUFFER_ALIGNMENT_EXTENSION_NAME"/>
+ <enum offset="0" extends="VkStructureType" name="VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_TEXEL_BUFFER_ALIGNMENT_FEATURES_EXT" comment="Not promoted to 1.3"/>
+ <enum extends="VkStructureType" name="VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_TEXEL_BUFFER_ALIGNMENT_PROPERTIES_EXT" alias="VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_TEXEL_BUFFER_ALIGNMENT_PROPERTIES"/>
+ <type name="VkPhysicalDeviceTexelBufferAlignmentFeaturesEXT" comment="Not promoted to 1.3"/>
+ <type name="VkPhysicalDeviceTexelBufferAlignmentPropertiesEXT"/>
+ </require>
+ </extension>
+ <extension name="VK_QCOM_render_pass_transform" number="283" type="device" requires="VK_KHR_swapchain,VK_KHR_surface" author="QCOM" contact="Jeff Leger @jackohound" supported="vulkan">
+ <require>
+ <enum value="3" name="VK_QCOM_RENDER_PASS_TRANSFORM_SPEC_VERSION"/>
+ <enum value="&quot;VK_QCOM_render_pass_transform&quot;" name="VK_QCOM_RENDER_PASS_TRANSFORM_EXTENSION_NAME"/>
+ <enum offset="0" extends="VkStructureType" name="VK_STRUCTURE_TYPE_COMMAND_BUFFER_INHERITANCE_RENDER_PASS_TRANSFORM_INFO_QCOM"/>
+ <enum offset="1" extends="VkStructureType" name="VK_STRUCTURE_TYPE_RENDER_PASS_TRANSFORM_BEGIN_INFO_QCOM"/>
+ <enum bitpos="1" extends="VkRenderPassCreateFlagBits" name="VK_RENDER_PASS_CREATE_TRANSFORM_BIT_QCOM"/>
+ <type name="VkRenderPassTransformBeginInfoQCOM"/>
+ <type name="VkCommandBufferInheritanceRenderPassTransformInfoQCOM"/>
+ </require>
+ </extension>
+ <extension name="VK_EXT_extension_284" number="284" type="device" author="EXT" contact="Samuel Pitoiset @hakzsam" supported="disabled">
+ <require>
+ <enum value="0" name="VK_EXT_EXTENSION_284_SPEC_VERSION"/>
+ <enum value="&quot;VK_EXT_extension_284&quot;" name="VK_EXT_EXTENSION_284_EXTENSION_NAME"/>
+ </require>
+ </extension>
+ <extension name="VK_EXT_device_memory_report" number="285" type="device" requires="VK_KHR_get_physical_device_properties2" author="EXT" contact="Yiwei Zhang @zhangyiwei" specialuse="devtools" supported="vulkan">
+ <require>
+ <enum value="2" name="VK_EXT_DEVICE_MEMORY_REPORT_SPEC_VERSION"/>
+ <enum value="&quot;VK_EXT_device_memory_report&quot;" name="VK_EXT_DEVICE_MEMORY_REPORT_EXTENSION_NAME"/>
+ <enum offset="0" extends="VkStructureType" name="VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_DEVICE_MEMORY_REPORT_FEATURES_EXT"/>
+ <enum offset="1" extends="VkStructureType" name="VK_STRUCTURE_TYPE_DEVICE_DEVICE_MEMORY_REPORT_CREATE_INFO_EXT"/>
+ <enum offset="2" extends="VkStructureType" name="VK_STRUCTURE_TYPE_DEVICE_MEMORY_REPORT_CALLBACK_DATA_EXT"/>
+ <type name="VkPhysicalDeviceDeviceMemoryReportFeaturesEXT"/>
+ <type name="VkDeviceDeviceMemoryReportCreateInfoEXT"/>
+ <type name="VkDeviceMemoryReportCallbackDataEXT"/>
+ <type name="VkDeviceMemoryReportFlagsEXT"/>
+ <type name="VkDeviceMemoryReportEventTypeEXT"/>
+ <type name="PFN_vkDeviceMemoryReportCallbackEXT"/>
+ </require>
+ </extension>
+ <extension name="VK_EXT_acquire_drm_display" number="286" type="instance" requires="VK_EXT_direct_mode_display" author="EXT" contact="Drew DeVault sir@cmpwn.com" supported="vulkan">
+ <require>
+ <enum value="1" name="VK_EXT_ACQUIRE_DRM_DISPLAY_SPEC_VERSION"/>
+ <enum value="&quot;VK_EXT_acquire_drm_display&quot;" name="VK_EXT_ACQUIRE_DRM_DISPLAY_EXTENSION_NAME"/>
+ <command name="vkAcquireDrmDisplayEXT"/>
+ <command name="vkGetDrmDisplayEXT"/>
+ </require>
+ </extension>
+ <extension name="VK_EXT_robustness2" number="287" type="device" author="EXT" contact="Liam Middlebrook @liam-middlebrook" supported="vulkan">
+ <require>
+ <enum value="1" name="VK_EXT_ROBUSTNESS_2_SPEC_VERSION"/>
+ <enum value="&quot;VK_EXT_robustness2&quot;" name="VK_EXT_ROBUSTNESS_2_EXTENSION_NAME"/>
+ <enum offset="0" extends="VkStructureType" name="VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_ROBUSTNESS_2_FEATURES_EXT"/>
+ <enum offset="1" extends="VkStructureType" name="VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_ROBUSTNESS_2_PROPERTIES_EXT"/>
+ <type name="VkPhysicalDeviceRobustness2FeaturesEXT"/>
+ <type name="VkPhysicalDeviceRobustness2PropertiesEXT"/>
+ </require>
+ </extension>
+ <extension name="VK_EXT_custom_border_color" number="288" type="device" author="EXT" contact="Liam Middlebrook @liam-middlebrook" specialuse="glemulation,d3demulation" supported="vulkan">
+ <require>
+ <enum value="12" name="VK_EXT_CUSTOM_BORDER_COLOR_SPEC_VERSION"/>
+ <enum value="&quot;VK_EXT_custom_border_color&quot;" name="VK_EXT_CUSTOM_BORDER_COLOR_EXTENSION_NAME"/>
+ <enum offset="0" extends="VkStructureType" name="VK_STRUCTURE_TYPE_SAMPLER_CUSTOM_BORDER_COLOR_CREATE_INFO_EXT"/>
+ <enum offset="1" extends="VkStructureType" name="VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_CUSTOM_BORDER_COLOR_PROPERTIES_EXT"/>
+ <enum offset="2" extends="VkStructureType" name="VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_CUSTOM_BORDER_COLOR_FEATURES_EXT"/>
+ <enum offset="3" extends="VkBorderColor" name="VK_BORDER_COLOR_FLOAT_CUSTOM_EXT"/>
+ <enum offset="4" extends="VkBorderColor" name="VK_BORDER_COLOR_INT_CUSTOM_EXT"/>
+ <type name="VkSamplerCustomBorderColorCreateInfoEXT"/>
+ <type name="VkPhysicalDeviceCustomBorderColorPropertiesEXT"/>
+ <type name="VkPhysicalDeviceCustomBorderColorFeaturesEXT"/>
+ </require>
+ </extension>
+ <extension name="VK_EXT_extension_289" number="289" author="EXT" contact="Jan-Harald Fredriksen @janharaldfredriksen-arm" supported="disabled">
+ <require>
+ <comment>
+ These enums are present only to inform downstream
+ consumers like KTX2. There is no actual Vulkan extension
+ corresponding to the enums.
+ </comment>
+ <enum value="0" name="VK_EXT_EXTENSION_289_SPEC_VERSION"/>
+ <enum value="&quot;VK_EXT_extension_289&quot;" name="VK_EXT_EXTENSION_289_EXTENSION_NAME"/>
+ <enum extends="VkFormat" extnumber="289" offset="0" name="VK_FORMAT_ASTC_3x3x3_UNORM_BLOCK_EXT"/>
+ <enum extends="VkFormat" extnumber="289" offset="1" name="VK_FORMAT_ASTC_3x3x3_SRGB_BLOCK_EXT"/>
+ <enum extends="VkFormat" extnumber="289" offset="2" name="VK_FORMAT_ASTC_3x3x3_SFLOAT_BLOCK_EXT"/>
+ <enum extends="VkFormat" extnumber="289" offset="3" name="VK_FORMAT_ASTC_4x3x3_UNORM_BLOCK_EXT"/>
+ <enum extends="VkFormat" extnumber="289" offset="4" name="VK_FORMAT_ASTC_4x3x3_SRGB_BLOCK_EXT"/>
+ <enum extends="VkFormat" extnumber="289" offset="5" name="VK_FORMAT_ASTC_4x3x3_SFLOAT_BLOCK_EXT"/>
+ <enum extends="VkFormat" extnumber="289" offset="6" name="VK_FORMAT_ASTC_4x4x3_UNORM_BLOCK_EXT"/>
+ <enum extends="VkFormat" extnumber="289" offset="7" name="VK_FORMAT_ASTC_4x4x3_SRGB_BLOCK_EXT"/>
+ <enum extends="VkFormat" extnumber="289" offset="8" name="VK_FORMAT_ASTC_4x4x3_SFLOAT_BLOCK_EXT"/>
+ <enum extends="VkFormat" extnumber="289" offset="9" name="VK_FORMAT_ASTC_4x4x4_UNORM_BLOCK_EXT"/>
+ <enum extends="VkFormat" extnumber="289" offset="10" name="VK_FORMAT_ASTC_4x4x4_SRGB_BLOCK_EXT"/>
+ <enum extends="VkFormat" extnumber="289" offset="11" name="VK_FORMAT_ASTC_4x4x4_SFLOAT_BLOCK_EXT"/>
+ <enum extends="VkFormat" extnumber="289" offset="12" name="VK_FORMAT_ASTC_5x4x4_UNORM_BLOCK_EXT"/>
+ <enum extends="VkFormat" extnumber="289" offset="13" name="VK_FORMAT_ASTC_5x4x4_SRGB_BLOCK_EXT"/>
+ <enum extends="VkFormat" extnumber="289" offset="14" name="VK_FORMAT_ASTC_5x4x4_SFLOAT_BLOCK_EXT"/>
+ <enum extends="VkFormat" extnumber="289" offset="15" name="VK_FORMAT_ASTC_5x5x4_UNORM_BLOCK_EXT"/>
+ <enum extends="VkFormat" extnumber="289" offset="16" name="VK_FORMAT_ASTC_5x5x4_SRGB_BLOCK_EXT"/>
+ <enum extends="VkFormat" extnumber="289" offset="17" name="VK_FORMAT_ASTC_5x5x4_SFLOAT_BLOCK_EXT"/>
+ <enum extends="VkFormat" extnumber="289" offset="18" name="VK_FORMAT_ASTC_5x5x5_UNORM_BLOCK_EXT"/>
+ <enum extends="VkFormat" extnumber="289" offset="19" name="VK_FORMAT_ASTC_5x5x5_SRGB_BLOCK_EXT"/>
+ <enum extends="VkFormat" extnumber="289" offset="20" name="VK_FORMAT_ASTC_5x5x5_SFLOAT_BLOCK_EXT"/>
+ <enum extends="VkFormat" extnumber="289" offset="21" name="VK_FORMAT_ASTC_6x5x5_UNORM_BLOCK_EXT"/>
+ <enum extends="VkFormat" extnumber="289" offset="22" name="VK_FORMAT_ASTC_6x5x5_SRGB_BLOCK_EXT"/>
+ <enum extends="VkFormat" extnumber="289" offset="23" name="VK_FORMAT_ASTC_6x5x5_SFLOAT_BLOCK_EXT"/>
+ <enum extends="VkFormat" extnumber="289" offset="24" name="VK_FORMAT_ASTC_6x6x5_UNORM_BLOCK_EXT"/>
+ <enum extends="VkFormat" extnumber="289" offset="25" name="VK_FORMAT_ASTC_6x6x5_SRGB_BLOCK_EXT"/>
+ <enum extends="VkFormat" extnumber="289" offset="26" name="VK_FORMAT_ASTC_6x6x5_SFLOAT_BLOCK_EXT"/>
+ <enum extends="VkFormat" extnumber="289" offset="27" name="VK_FORMAT_ASTC_6x6x6_UNORM_BLOCK_EXT"/>
+ <enum extends="VkFormat" extnumber="289" offset="28" name="VK_FORMAT_ASTC_6x6x6_SRGB_BLOCK_EXT"/>
+ <enum extends="VkFormat" extnumber="289" offset="29" name="VK_FORMAT_ASTC_6x6x6_SFLOAT_BLOCK_EXT"/>
+ </require>
+ </extension>
+ <extension name="VK_GOOGLE_user_type" number="290" type="device" author="GOOGLE" contact="Kaye Mason @chaleur" supported="vulkan">
+ <require>
+ <enum value="1" name="VK_GOOGLE_USER_TYPE_SPEC_VERSION"/>
+ <enum value="&quot;VK_GOOGLE_user_type&quot;" name="VK_GOOGLE_USER_TYPE_EXTENSION_NAME"/>
+ </require>
+ </extension>
+ <extension name="VK_KHR_pipeline_library" number="291" type="device" author="KHR" contact="Christoph Kubisch @pixeljetstream" supported="vulkan">
+ <require>
+ <enum value="1" name="VK_KHR_PIPELINE_LIBRARY_SPEC_VERSION"/>
+ <enum value="&quot;VK_KHR_pipeline_library&quot;" name="VK_KHR_PIPELINE_LIBRARY_EXTENSION_NAME"/>
+ <enum bitpos="11" extends="VkPipelineCreateFlagBits" name="VK_PIPELINE_CREATE_LIBRARY_BIT_KHR"/>
+ <enum offset="0" extends="VkStructureType" name="VK_STRUCTURE_TYPE_PIPELINE_LIBRARY_CREATE_INFO_KHR"/>
+ <type name="VkPipelineLibraryCreateInfoKHR"/>
+ </require>
+ </extension>
+ <extension name="VK_NV_extension_292" number="292" author="NV" contact="Daniel Koch @dgkoch" supported="disabled">
+ <require>
+ <enum value="0" name="VK_NV_EXTENSION_292_SPEC_VERSION"/>
+ <enum value="&quot;VK_NV_extension_292&quot;" name="VK_NV_EXTENSION_292_EXTENSION_NAME"/>
+ </require>
+ </extension>
+ <extension name="VK_NV_extension_293" number="293" author="NV" contact="Daniel Koch @dgkoch" supported="disabled">
+ <require>
+ <enum value="0" name="VK_NV_EXTENSION_293_SPEC_VERSION"/>
+ <enum value="&quot;VK_NV_extension_293&quot;" name="VK_NV_EXTENSION_293_EXTENSION_NAME"/>
+ </require>
+ </extension>
+ <extension name="VK_KHR_shader_non_semantic_info" number="294" type="device" author="KHR" contact="Baldur Karlsson @baldurk" supported="vulkan" promotedto="VK_VERSION_1_3">
+ <require>
+ <enum value="1" name="VK_KHR_SHADER_NON_SEMANTIC_INFO_SPEC_VERSION"/>
+ <enum value="&quot;VK_KHR_shader_non_semantic_info&quot;" name="VK_KHR_SHADER_NON_SEMANTIC_INFO_EXTENSION_NAME"/>
+ </require>
+ </extension>
+ <extension name="VK_KHR_present_id" number="295" type="device" requires="VK_KHR_swapchain" author="KHR" contact="Keith Packard @keithp" supported="vulkan">
+ <require>
+ <enum value="1" name="VK_KHR_PRESENT_ID_SPEC_VERSION"/>
+ <enum value="&quot;VK_KHR_present_id&quot;" name="VK_KHR_PRESENT_ID_EXTENSION_NAME"/>
+ <enum offset="0" extends="VkStructureType" name="VK_STRUCTURE_TYPE_PRESENT_ID_KHR"/>
+ <type name="VkPresentIdKHR"/>
+ <enum offset="1" extends="VkStructureType" name="VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_PRESENT_ID_FEATURES_KHR"/>
+ <type name="VkPhysicalDevicePresentIdFeaturesKHR"/>
+ </require>
+ </extension>
+ <extension name="VK_EXT_private_data" number="296" type="device" author="NV" contact="Matthew Rusch @mattruschnv" supported="vulkan" promotedto="VK_VERSION_1_3">
+ <require>
+ <enum value="1" name="VK_EXT_PRIVATE_DATA_SPEC_VERSION"/>
+ <enum value="&quot;VK_EXT_private_data&quot;" name="VK_EXT_PRIVATE_DATA_EXTENSION_NAME"/>
+ <enum extends="VkStructureType" name="VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_PRIVATE_DATA_FEATURES_EXT" alias="VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_PRIVATE_DATA_FEATURES"/>
+ <enum extends="VkStructureType" name="VK_STRUCTURE_TYPE_DEVICE_PRIVATE_DATA_CREATE_INFO_EXT" alias="VK_STRUCTURE_TYPE_DEVICE_PRIVATE_DATA_CREATE_INFO"/>
+ <enum extends="VkStructureType" name="VK_STRUCTURE_TYPE_PRIVATE_DATA_SLOT_CREATE_INFO_EXT" alias="VK_STRUCTURE_TYPE_PRIVATE_DATA_SLOT_CREATE_INFO"/>
+ <enum extends="VkObjectType" name="VK_OBJECT_TYPE_PRIVATE_DATA_SLOT_EXT" alias="VK_OBJECT_TYPE_PRIVATE_DATA_SLOT"/>
+ <type name="VkPhysicalDevicePrivateDataFeaturesEXT"/>
+ <type name="VkDevicePrivateDataCreateInfoEXT"/>
+ <type name="VkPrivateDataSlotCreateInfoEXT"/>
+ <type name="VkPrivateDataSlotEXT"/>
+ <type name="VkPrivateDataSlotCreateFlagsEXT" comment="Will add VkPrivateDataSlotCreateFlagBits when bits are defined in the future"/>
+ <command name="vkCreatePrivateDataSlotEXT"/>
+ <command name="vkDestroyPrivateDataSlotEXT"/>
+ <command name="vkSetPrivateDataEXT"/>
+ <command name="vkGetPrivateDataEXT"/>
+ </require>
+ </extension>
+ <extension name="VK_KHR_extension_297" number="297" author="KHR" contact="Corentin Wallez @Kangz" supported="disabled">
+ <require>
+ <enum value="0" name="VK_KHR_EXTENSION_297_SPEC_VERSION"/>
+ <enum value="&quot;VK_KHR_extension_297&quot;" name="VK_KHR_EXTENSION_297_EXTENSION_NAME"/>
+ <enum bitpos="3" extends="VkPipelineShaderStageCreateFlagBits" name="VK_PIPELINE_SHADER_STAGE_CREATE_RESERVED_3_BIT_KHR"/>
+ </require>
+ </extension>
+ <extension name="VK_EXT_pipeline_creation_cache_control" number="298" type="device" author="AMD" contact="Gregory Grebe @grgrebe_amd" supported="vulkan" promotedto="VK_VERSION_1_3">
+ <require>
+ <enum value="3" name="VK_EXT_PIPELINE_CREATION_CACHE_CONTROL_SPEC_VERSION"/>
+ <enum value="&quot;VK_EXT_pipeline_creation_cache_control&quot;" name="VK_EXT_PIPELINE_CREATION_CACHE_CONTROL_EXTENSION_NAME"/>
+ <enum extends="VkStructureType" name="VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_PIPELINE_CREATION_CACHE_CONTROL_FEATURES_EXT" alias="VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_PIPELINE_CREATION_CACHE_CONTROL_FEATURES"/>
+ <type name="VkPhysicalDevicePipelineCreationCacheControlFeaturesEXT"/>
+ <enum extends="VkPipelineCreateFlagBits" name="VK_PIPELINE_CREATE_FAIL_ON_PIPELINE_COMPILE_REQUIRED_BIT_EXT" alias="VK_PIPELINE_CREATE_FAIL_ON_PIPELINE_COMPILE_REQUIRED_BIT"/>
+ <enum extends="VkPipelineCreateFlagBits" name="VK_PIPELINE_CREATE_EARLY_RETURN_ON_FAILURE_BIT_EXT" alias="VK_PIPELINE_CREATE_EARLY_RETURN_ON_FAILURE_BIT"/>
+ <enum extends="VkResult" name="VK_PIPELINE_COMPILE_REQUIRED_EXT" alias="VK_PIPELINE_COMPILE_REQUIRED"/>
+ <enum extends="VkResult" name="VK_ERROR_PIPELINE_COMPILE_REQUIRED_EXT" alias="VK_PIPELINE_COMPILE_REQUIRED"/>
+ <enum extends="VkPipelineCacheCreateFlagBits" name="VK_PIPELINE_CACHE_CREATE_EXTERNALLY_SYNCHRONIZED_BIT_EXT" alias="VK_PIPELINE_CACHE_CREATE_EXTERNALLY_SYNCHRONIZED_BIT"/>
+ <type name="VkPipelineCacheCreateFlagBits" comment="This is a temporary workaround for processors not recognizing that VK_PIPELINE_CACHE_CREATE_EXTERNALLY_SYNCHRONIZED_BIT_EXT above also requires this type"/>
+ </require>
+ </extension>
+ <extension name="VK_KHR_extension_299" number="299" author="KHR" contact="Mark Bellamy @mark.bellamy_arm" supported="disabled">
+ <require>
+ <enum value="0" name="VK_KHR_EXTENSION_299_SPEC_VERSION"/>
+ <enum value="&quot;VK_KHR_extension_299&quot;" name="VK_KHR_EXTENSION_299_EXTENSION_NAME"/>
+ <enum bitpos="2" extends="VkMemoryHeapFlagBits" name="VK_MEMORY_HEAP_RESERVED_2_BIT_KHR"/>
+ <enum extends="VkPipelineCacheCreateFlagBits" name="VK_PIPELINE_CACHE_CREATE_RESERVED_1_BIT_KHR" alias="VK_PIPELINE_CACHE_CREATE_RESERVED_1_BIT_EXT"/>
+ <enum bitpos="2" extends="VkPipelineCacheCreateFlagBits" name="VK_PIPELINE_CACHE_CREATE_RESERVED_2_BIT_KHR"/>
+ </require>
+ </extension>
+ <extension name="VK_KHR_video_encode_queue" number="300" type="device" requires="VK_KHR_video_queue,VK_KHR_synchronization2" author="KHR" contact="Ahmed Abdelkhalek @aabdelkh" provisional="true" platform="provisional" supported="vulkan">
+ <require>
+ <enum value="5" name="VK_KHR_VIDEO_ENCODE_QUEUE_SPEC_VERSION"/>
+ <enum value="&quot;VK_KHR_video_encode_queue&quot;" name="VK_KHR_VIDEO_ENCODE_QUEUE_EXTENSION_NAME"/>
+ <!-- VkPipelineStageFlagBits bitpos="27" is reserved by this extension, but not used -->
+ <enum bitpos="27" extends="VkPipelineStageFlagBits2" name="VK_PIPELINE_STAGE_2_VIDEO_ENCODE_BIT_KHR" protect="VK_ENABLE_BETA_EXTENSIONS" />
+ <enum bitpos="37" extends="VkAccessFlagBits2" name="VK_ACCESS_2_VIDEO_ENCODE_READ_BIT_KHR" protect="VK_ENABLE_BETA_EXTENSIONS" />
+ <enum bitpos="38" extends="VkAccessFlagBits2" name="VK_ACCESS_2_VIDEO_ENCODE_WRITE_BIT_KHR" protect="VK_ENABLE_BETA_EXTENSIONS"/>
+ <enum offset="0" extends="VkStructureType" name="VK_STRUCTURE_TYPE_VIDEO_ENCODE_INFO_KHR" protect="VK_ENABLE_BETA_EXTENSIONS"/>
+ <enum offset="1" extends="VkStructureType" name="VK_STRUCTURE_TYPE_VIDEO_ENCODE_RATE_CONTROL_INFO_KHR" protect="VK_ENABLE_BETA_EXTENSIONS"/>
+ <enum offset="2" extends="VkStructureType" name="VK_STRUCTURE_TYPE_VIDEO_ENCODE_RATE_CONTROL_LAYER_INFO_KHR" protect="VK_ENABLE_BETA_EXTENSIONS"/>
+ <enum offset="3" extends="VkStructureType" name="VK_STRUCTURE_TYPE_VIDEO_ENCODE_CAPABILITIES_KHR" protect="VK_ENABLE_BETA_EXTENSIONS"/>
+ <enum bitpos="6" extends="VkQueueFlagBits" name="VK_QUEUE_VIDEO_ENCODE_BIT_KHR" protect="VK_ENABLE_BETA_EXTENSIONS"/>
+ <enum bitpos="15" extends="VkBufferUsageFlagBits" name="VK_BUFFER_USAGE_VIDEO_ENCODE_DST_BIT_KHR" protect="VK_ENABLE_BETA_EXTENSIONS"/>
+ <enum bitpos="16" extends="VkBufferUsageFlagBits" name="VK_BUFFER_USAGE_VIDEO_ENCODE_SRC_BIT_KHR" protect="VK_ENABLE_BETA_EXTENSIONS"/>
+ <enum bitpos="13" extends="VkImageUsageFlagBits" name="VK_IMAGE_USAGE_VIDEO_ENCODE_DST_BIT_KHR" protect="VK_ENABLE_BETA_EXTENSIONS"/>
+ <enum bitpos="14" extends="VkImageUsageFlagBits" name="VK_IMAGE_USAGE_VIDEO_ENCODE_SRC_BIT_KHR" protect="VK_ENABLE_BETA_EXTENSIONS"/>
+ <enum bitpos="15" extends="VkImageUsageFlagBits" name="VK_IMAGE_USAGE_VIDEO_ENCODE_DPB_BIT_KHR" protect="VK_ENABLE_BETA_EXTENSIONS"/>
+ <enum bitpos="27" extends="VkFormatFeatureFlagBits" name="VK_FORMAT_FEATURE_VIDEO_ENCODE_INPUT_BIT_KHR" protect="VK_ENABLE_BETA_EXTENSIONS"/>
+ <enum bitpos="28" extends="VkFormatFeatureFlagBits" name="VK_FORMAT_FEATURE_VIDEO_ENCODE_DPB_BIT_KHR" protect="VK_ENABLE_BETA_EXTENSIONS"/>
+ <enum offset="0" extends="VkImageLayout" name="VK_IMAGE_LAYOUT_VIDEO_ENCODE_DST_KHR" protect="VK_ENABLE_BETA_EXTENSIONS"/>
+ <enum offset="1" extends="VkImageLayout" name="VK_IMAGE_LAYOUT_VIDEO_ENCODE_SRC_KHR" protect="VK_ENABLE_BETA_EXTENSIONS"/>
+ <enum offset="2" extends="VkImageLayout" name="VK_IMAGE_LAYOUT_VIDEO_ENCODE_DPB_KHR" protect="VK_ENABLE_BETA_EXTENSIONS"/>
+ <enum offset="0" extends="VkQueryType" name="VK_QUERY_TYPE_VIDEO_ENCODE_BITSTREAM_BUFFER_RANGE_KHR" protect="VK_ENABLE_BETA_EXTENSIONS"/>
+
+ <type name="VkVideoEncodeFlagBitsKHR"/>
+ <type name="VkVideoEncodeFlagsKHR"/>
+ <type name="VkVideoEncodeInfoKHR"/>
+
+ <type name="VkVideoEncodeCapabilityFlagBitsKHR"/>
+ <type name="VkVideoEncodeCapabilityFlagsKHR"/>
+ <type name="VkVideoEncodeCapabilitiesKHR"/>
+
+ <type name="VkVideoEncodeRateControlFlagBitsKHR"/>
+ <type name="VkVideoEncodeRateControlFlagsKHR"/>
+ <type name="VkVideoEncodeRateControlModeFlagBitsKHR"/>
+ <type name="VkVideoEncodeRateControlModeFlagsKHR"/>
+ <type name="VkVideoEncodeRateControlInfoKHR"/>
+ <type name="VkVideoEncodeRateControlLayerInfoKHR"/>
+
+ <command name="vkCmdEncodeVideoKHR"/>
+ </require>
+ <require extension="VK_KHR_format_feature_flags2">
+ <enum bitpos="27" extends="VkFormatFeatureFlagBits2" name="VK_FORMAT_FEATURE_2_VIDEO_ENCODE_INPUT_BIT_KHR" protect="VK_ENABLE_BETA_EXTENSIONS"/>
+ <enum bitpos="28" extends="VkFormatFeatureFlagBits2" name="VK_FORMAT_FEATURE_2_VIDEO_ENCODE_DPB_BIT_KHR" protect="VK_ENABLE_BETA_EXTENSIONS"/>
+ </require>
+ </extension>
+ <extension name="VK_NV_device_diagnostics_config" number="301" type="device" requires="VK_KHR_get_physical_device_properties2" author="NV" contact="Kedarnath Thangudu @kthangudu" supported="vulkan">
+ <require>
+ <enum value="2" name="VK_NV_DEVICE_DIAGNOSTICS_CONFIG_SPEC_VERSION"/>
+ <enum value="&quot;VK_NV_device_diagnostics_config&quot;" name="VK_NV_DEVICE_DIAGNOSTICS_CONFIG_EXTENSION_NAME"/>
+ <enum offset="0" extends="VkStructureType" name="VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_DIAGNOSTICS_CONFIG_FEATURES_NV"/>
+ <enum offset="1" extends="VkStructureType" name="VK_STRUCTURE_TYPE_DEVICE_DIAGNOSTICS_CONFIG_CREATE_INFO_NV"/>
+ <type name="VkPhysicalDeviceDiagnosticsConfigFeaturesNV"/>
+ <type name="VkDeviceDiagnosticsConfigCreateInfoNV"/>
+ <type name="VkDeviceDiagnosticsConfigFlagsNV"/>
+ <type name="VkDeviceDiagnosticsConfigFlagBitsNV"/>
+ </require>
+ </extension>
+ <extension name="VK_QCOM_render_pass_store_ops" number="302" type="device" author="QCOM" contact="Bill Licea-Kane @wwlk" supported="vulkan">
+ <require>
+ <enum value="2" name="VK_QCOM_RENDER_PASS_STORE_OPS_SPEC_VERSION"/>
+ <enum value="&quot;VK_QCOM_render_pass_store_ops&quot;" name="VK_QCOM_RENDER_PASS_STORE_OPS_EXTENSION_NAME"/>
+ <enum extends="VkAttachmentStoreOp" name="VK_ATTACHMENT_STORE_OP_NONE_QCOM" alias="VK_ATTACHMENT_STORE_OP_NONE"/>
+ </require>
+ </extension>
+ <extension name="VK_QCOM_extension_303" number="303" author="QCOM" contact="Bill Licea-Kane @wwlk" supported="disabled">
+ <require>
+ <enum value="0" name="VK_QCOM_EXTENSION_303_SPEC_VERSION"/>
+ <enum value="&quot;VK_QCOM_extension_303&quot;" name="VK_QCOM_EXTENSION_303_EXTENSION_NAME"/>
+ </require>
+ </extension>
+ <extension name="VK_QCOM_extension_304" number="304" author="QCOM" contact="Bill Licea-Kane @wwlk" supported="disabled">
+ <require>
+ <enum value="0" name="VK_QCOM_EXTENSION_304_SPEC_VERSION"/>
+ <enum value="&quot;VK_QCOM_extension_304&quot;" name="VK_QCOM_EXTENSION_304_EXTENSION_NAME"/>
+ </require>
+ </extension>
+ <extension name="VK_QCOM_extension_305" number="305" author="QCOM" contact="Bill Licea-Kane @wwlk" supported="disabled">
+ <require>
+ <enum value="0" name="VK_QCOM_EXTENSION_305_SPEC_VERSION"/>
+ <enum value="&quot;VK_QCOM_extension_305&quot;" name="VK_QCOM_EXTENSION_305_EXTENSION_NAME"/>
+ </require>
+ </extension>
+ <extension name="VK_QCOM_extension_306" number="306" author="QCOM" contact="Bill Licea-Kane @wwlk" supported="disabled">
+ <require>
+ <enum value="0" name="VK_QCOM_EXTENSION_306_SPEC_VERSION"/>
+ <enum value="&quot;VK_QCOM_extension_306&quot;" name="VK_QCOM_EXTENSION_306_EXTENSION_NAME"/>
+ </require>
+ </extension>
+ <extension name="VK_QCOM_extension_307" number="307" author="QCOM" contact="Bill Licea-Kane @wwlk" supported="disabled">
+ <require>
+ <enum value="0" name="VK_QCOM_EXTENSION_307_SPEC_VERSION"/>
+ <enum value="&quot;VK_QCOM_extension_307&quot;" name="VK_QCOM_EXTENSION_307_EXTENSION_NAME"/>
+ </require>
+ </extension>
+ <extension name="VK_NV_extension_308" number="308" type="device" author="NV" contact="Tristan Lorach @tlorach" supported="disabled">
+ <require>
+ <enum value="0" name="VK_NV_EXTENSION_308_SPEC_VERSION"/>
+ <enum value="&quot;VK_NV_extension_308&quot;" name="VK_NV_EXTENSION_308_EXTENSION_NAME"/>
+ </require>
+ </extension>
+ <extension name="VK_KHR_extension_309" number="309" author="KHR" contact="Aidan Fabius @afabius" supported="disabled">
+ <require>
+ <enum value="0" name="VK_KHR_EXTENSION_309_SPEC_VERSION"/>
+ <enum value="&quot;VK_KHR_extension_309&quot;" name="VK_KHR_EXTENSION_309_EXTENSION_NAME"/>
+ </require>
+ </extension>
+ <extension name="VK_QCOM_extension_310" number="310" author="QCOM" contact="Jeff Leger @jackohound" supported="disabled">
+ <require>
+ <enum value="0" name="VK_QCOM_EXTENSION_310_SPEC_VERSION"/>
+ <enum value="&quot;VK_QCOM_extension_310&quot;" name="VK_QCOM_EXTENSION_310_EXTENSION_NAME"/>
+ <enum offset="0" extends="VkStructureType" name="VK_STRUCTURE_TYPE_RESERVED_QCOM"/>
+ </require>
+ </extension>
+ <extension name="VK_NV_extension_311" number="311" author="NV" contact="Charles Hansen @cshansen" supported="disabled">
+ <require>
+ <enum value="0" name="VK_NV_EXTENSION_311_SPEC_VERSION"/>
+ <enum value="&quot;VK_NV_extension_311&quot;" name="VK_NV_EXTENSION_311_EXTENSION_NAME"/>
+ </require>
+ </extension>
+ <extension name="VK_EXT_metal_objects" number="312" type="device" platform="metal" supported="vulkan" author="EXT" contact="Bill Hollings @billhollings">
+ <require>
+ <enum value="1" name="VK_EXT_METAL_OBJECTS_SPEC_VERSION"/>
+ <enum value="&quot;VK_EXT_metal_objects&quot;" name="VK_EXT_METAL_OBJECTS_EXTENSION_NAME"/>
+ <enum offset="0" extends="VkStructureType" name="VK_STRUCTURE_TYPE_EXPORT_METAL_OBJECT_CREATE_INFO_EXT"/>
+ <enum offset="1" extends="VkStructureType" name="VK_STRUCTURE_TYPE_EXPORT_METAL_OBJECTS_INFO_EXT"/>
+ <enum offset="2" extends="VkStructureType" name="VK_STRUCTURE_TYPE_EXPORT_METAL_DEVICE_INFO_EXT"/>
+ <enum offset="3" extends="VkStructureType" name="VK_STRUCTURE_TYPE_EXPORT_METAL_COMMAND_QUEUE_INFO_EXT"/>
+ <enum offset="4" extends="VkStructureType" name="VK_STRUCTURE_TYPE_EXPORT_METAL_BUFFER_INFO_EXT"/>
+ <enum offset="5" extends="VkStructureType" name="VK_STRUCTURE_TYPE_IMPORT_METAL_BUFFER_INFO_EXT"/>
+ <enum offset="6" extends="VkStructureType" name="VK_STRUCTURE_TYPE_EXPORT_METAL_TEXTURE_INFO_EXT"/>
+ <enum offset="7" extends="VkStructureType" name="VK_STRUCTURE_TYPE_IMPORT_METAL_TEXTURE_INFO_EXT"/>
+ <enum offset="8" extends="VkStructureType" name="VK_STRUCTURE_TYPE_EXPORT_METAL_IO_SURFACE_INFO_EXT"/>
+ <enum offset="9" extends="VkStructureType" name="VK_STRUCTURE_TYPE_IMPORT_METAL_IO_SURFACE_INFO_EXT"/>
+ <enum offset="10" extends="VkStructureType" name="VK_STRUCTURE_TYPE_EXPORT_METAL_SHARED_EVENT_INFO_EXT"/>
+ <enum offset="11" extends="VkStructureType" name="VK_STRUCTURE_TYPE_IMPORT_METAL_SHARED_EVENT_INFO_EXT"/>
+ <type name="VkExportMetalObjectTypeFlagBitsEXT"/>
+ <type name="VkExportMetalObjectTypeFlagsEXT"/>
+ <type name="VkExportMetalObjectCreateInfoEXT"/>
+ <type name="VkExportMetalObjectsInfoEXT"/>
+ <type name="VkExportMetalDeviceInfoEXT"/>
+ <type name="VkExportMetalCommandQueueInfoEXT"/>
+ <type name="VkExportMetalBufferInfoEXT"/>
+ <type name="VkImportMetalBufferInfoEXT"/>
+ <type name="VkExportMetalTextureInfoEXT"/>
+ <type name="VkImportMetalTextureInfoEXT"/>
+ <type name="VkExportMetalIOSurfaceInfoEXT"/>
+ <type name="VkImportMetalIOSurfaceInfoEXT"/>
+ <type name="VkExportMetalSharedEventInfoEXT"/>
+ <type name="VkImportMetalSharedEventInfoEXT"/>
+ <type name="MTLDevice_id"/>
+ <type name="MTLCommandQueue_id"/>
+ <type name="MTLBuffer_id"/>
+ <type name="MTLTexture_id"/>
+ <type name="MTLSharedEvent_id"/>
+ <type name="IOSurfaceRef"/>
+ <command name="vkExportMetalObjectsEXT"/>
+ </require>
+ </extension>
+ <extension name="VK_EXT_extension_313" number="313" author="MVK" contact="Bill Hollings @billhollings" supported="disabled">
+ <require>
+ <enum value="0" name="VK_EXT_EXTENSION_313_SPEC_VERSION"/>
+ <enum value="&quot;VK_EXT_extension_313&quot;" name="VK_EXT_EXTENSION_313_EXTENSION_NAME"/>
+ </require>
+ </extension>
+ <extension name="VK_AMD_extension_314" number="314" author="AMD" contact="Martin Dinkov @mdinkov" supported="disabled">
+ <require>
+ <enum value="0" name="VK_AMD_EXTENSION_314_SPEC_VERSION"/>
+ <enum value="&quot;VK_AMD_extension_314&quot;" name="VK_AMD_EXTENSION_314_EXTENSION_NAME"/>
+ </require>
+ </extension>
+ <extension name="VK_KHR_synchronization2" number="315" type="device" author="KHR" requires="VK_KHR_get_physical_device_properties2" contact="Tobias Hector @tobski" supported="vulkan" promotedto="VK_VERSION_1_3">
+ <require>
+ <enum value="1" name="VK_KHR_SYNCHRONIZATION_2_SPEC_VERSION"/>
+ <enum value="&quot;VK_KHR_synchronization2&quot;" name="VK_KHR_SYNCHRONIZATION_2_EXTENSION_NAME"/>
+ <enum extends="VkStructureType" name="VK_STRUCTURE_TYPE_MEMORY_BARRIER_2_KHR" alias="VK_STRUCTURE_TYPE_MEMORY_BARRIER_2"/>
+ <enum extends="VkStructureType" name="VK_STRUCTURE_TYPE_BUFFER_MEMORY_BARRIER_2_KHR" alias="VK_STRUCTURE_TYPE_BUFFER_MEMORY_BARRIER_2"/>
+ <enum extends="VkStructureType" name="VK_STRUCTURE_TYPE_IMAGE_MEMORY_BARRIER_2_KHR" alias="VK_STRUCTURE_TYPE_IMAGE_MEMORY_BARRIER_2"/>
+ <enum extends="VkStructureType" name="VK_STRUCTURE_TYPE_DEPENDENCY_INFO_KHR" alias="VK_STRUCTURE_TYPE_DEPENDENCY_INFO"/>
+ <enum extends="VkStructureType" name="VK_STRUCTURE_TYPE_SUBMIT_INFO_2_KHR" alias="VK_STRUCTURE_TYPE_SUBMIT_INFO_2"/>
+ <enum extends="VkStructureType" name="VK_STRUCTURE_TYPE_SEMAPHORE_SUBMIT_INFO_KHR" alias="VK_STRUCTURE_TYPE_SEMAPHORE_SUBMIT_INFO"/>
+ <enum extends="VkStructureType" name="VK_STRUCTURE_TYPE_COMMAND_BUFFER_SUBMIT_INFO_KHR" alias="VK_STRUCTURE_TYPE_COMMAND_BUFFER_SUBMIT_INFO"/>
+ <enum extends="VkStructureType" name="VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_SYNCHRONIZATION_2_FEATURES_KHR" alias="VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_SYNCHRONIZATION_2_FEATURES"/>
+ <enum extends="VkEventCreateFlagBits" name="VK_EVENT_CREATE_DEVICE_ONLY_BIT_KHR" alias="VK_EVENT_CREATE_DEVICE_ONLY_BIT"/>
+ <enum extends="VkImageLayout" name="VK_IMAGE_LAYOUT_READ_ONLY_OPTIMAL_KHR" alias="VK_IMAGE_LAYOUT_READ_ONLY_OPTIMAL"/>
+ <enum extends="VkImageLayout" name="VK_IMAGE_LAYOUT_ATTACHMENT_OPTIMAL_KHR" alias="VK_IMAGE_LAYOUT_ATTACHMENT_OPTIMAL"/>
+ <enum extends="VkPipelineStageFlagBits" name="VK_PIPELINE_STAGE_NONE_KHR" alias="VK_PIPELINE_STAGE_NONE"/>
+ <enum extends="VkAccessFlagBits" name="VK_ACCESS_NONE_KHR" alias="VK_ACCESS_NONE"/>
+ <type name="VkFlags64"/>
+ <type name="VkPipelineStageFlags2KHR"/>
+ <type name="VkPipelineStageFlagBits2KHR"/>
+ <type name="VkAccessFlags2KHR"/>
+ <type name="VkAccessFlagBits2KHR"/>
+ <type name="VkMemoryBarrier2KHR"/>
+ <type name="VkBufferMemoryBarrier2KHR"/>
+ <type name="VkImageMemoryBarrier2KHR"/>
+ <type name="VkDependencyInfoKHR"/>
+ <type name="VkSubmitInfo2KHR"/>
+ <type name="VkSemaphoreSubmitInfoKHR"/>
+ <type name="VkCommandBufferSubmitInfoKHR"/>
+ <type name="VkSubmitFlagBitsKHR"/>
+ <type name="VkSubmitFlagsKHR"/>
+ <type name="VkPhysicalDeviceSynchronization2FeaturesKHR"/>
+ <command name="vkCmdSetEvent2KHR"/>
+ <command name="vkCmdResetEvent2KHR"/>
+ <command name="vkCmdWaitEvents2KHR"/>
+ <command name="vkCmdPipelineBarrier2KHR"/>
+ <command name="vkCmdWriteTimestamp2KHR"/>
+ <command name="vkQueueSubmit2KHR"/>
+ </require>
+ <require extension="VK_EXT_transform_feedback">
+ <enum bitpos="24" extends="VkPipelineStageFlagBits2" name="VK_PIPELINE_STAGE_2_TRANSFORM_FEEDBACK_BIT_EXT"/>
+ <enum bitpos="25" extends="VkAccessFlagBits2" name="VK_ACCESS_2_TRANSFORM_FEEDBACK_WRITE_BIT_EXT"/>
+ <enum bitpos="26" extends="VkAccessFlagBits2" name="VK_ACCESS_2_TRANSFORM_FEEDBACK_COUNTER_READ_BIT_EXT"/>
+ <enum bitpos="27" extends="VkAccessFlagBits2" name="VK_ACCESS_2_TRANSFORM_FEEDBACK_COUNTER_WRITE_BIT_EXT"/>
+ </require>
+ <require extension="VK_EXT_conditional_rendering">
+ <enum bitpos="18" extends="VkPipelineStageFlagBits2" name="VK_PIPELINE_STAGE_2_CONDITIONAL_RENDERING_BIT_EXT" comment="A pipeline stage for conditional rendering predicate fetch"/>
+ <enum bitpos="20" extends="VkAccessFlagBits2" name="VK_ACCESS_2_CONDITIONAL_RENDERING_READ_BIT_EXT" comment="read access flag for reading conditional rendering predicate"/>
+ </require>
+ <require extension="VK_NV_device_generated_commands">
+ <enum bitpos="17" extends="VkPipelineStageFlagBits2" name="VK_PIPELINE_STAGE_2_COMMAND_PREPROCESS_BIT_NV"/>
+ <enum bitpos="17" extends="VkAccessFlagBits2" name="VK_ACCESS_2_COMMAND_PREPROCESS_READ_BIT_NV"/>
+ <enum bitpos="18" extends="VkAccessFlagBits2" name="VK_ACCESS_2_COMMAND_PREPROCESS_WRITE_BIT_NV"/>
+ </require>
+ <require extension="VK_KHR_fragment_shading_rate">
+ <enum bitpos="22" extends="VkPipelineStageFlagBits2" name="VK_PIPELINE_STAGE_2_FRAGMENT_SHADING_RATE_ATTACHMENT_BIT_KHR"/>
+ <enum bitpos="23" extends="VkAccessFlagBits2" name="VK_ACCESS_2_FRAGMENT_SHADING_RATE_ATTACHMENT_READ_BIT_KHR"/>
+ </require>
+ <require extension="VK_NV_shading_rate_image">
+ <enum extends="VkPipelineStageFlagBits2" name="VK_PIPELINE_STAGE_2_SHADING_RATE_IMAGE_BIT_NV" alias="VK_PIPELINE_STAGE_2_FRAGMENT_SHADING_RATE_ATTACHMENT_BIT_KHR"/>
+ <enum extends="VkAccessFlagBits2" name="VK_ACCESS_2_SHADING_RATE_IMAGE_READ_BIT_NV" alias="VK_ACCESS_2_FRAGMENT_SHADING_RATE_ATTACHMENT_READ_BIT_KHR"/>
+ </require>
+ <require extension="VK_KHR_acceleration_structure">
+ <enum bitpos="25" extends="VkPipelineStageFlagBits2" name="VK_PIPELINE_STAGE_2_ACCELERATION_STRUCTURE_BUILD_BIT_KHR"/>
+ <enum bitpos="21" extends="VkAccessFlagBits2" name="VK_ACCESS_2_ACCELERATION_STRUCTURE_READ_BIT_KHR"/>
+ <enum bitpos="22" extends="VkAccessFlagBits2" name="VK_ACCESS_2_ACCELERATION_STRUCTURE_WRITE_BIT_KHR"/>
+ </require>
+ <require extension="VK_KHR_ray_tracing_pipeline">
+ <enum bitpos="21" extends="VkPipelineStageFlagBits2" name="VK_PIPELINE_STAGE_2_RAY_TRACING_SHADER_BIT_KHR"/>
+ </require>
+ <require extension="VK_NV_ray_tracing">
+ <enum extends="VkPipelineStageFlagBits2" name="VK_PIPELINE_STAGE_2_RAY_TRACING_SHADER_BIT_NV" alias="VK_PIPELINE_STAGE_2_RAY_TRACING_SHADER_BIT_KHR"/>
+ <enum extends="VkPipelineStageFlagBits2" name="VK_PIPELINE_STAGE_2_ACCELERATION_STRUCTURE_BUILD_BIT_NV" alias="VK_PIPELINE_STAGE_2_ACCELERATION_STRUCTURE_BUILD_BIT_KHR"/>
+ <enum extends="VkAccessFlagBits2" name="VK_ACCESS_2_ACCELERATION_STRUCTURE_READ_BIT_NV" alias="VK_ACCESS_2_ACCELERATION_STRUCTURE_READ_BIT_KHR"/>
+ <enum extends="VkAccessFlagBits2" name="VK_ACCESS_2_ACCELERATION_STRUCTURE_WRITE_BIT_NV" alias="VK_ACCESS_2_ACCELERATION_STRUCTURE_WRITE_BIT_KHR"/>
+ </require>
+ <require extension="VK_EXT_fragment_density_map">
+ <enum bitpos="23" extends="VkPipelineStageFlagBits2" name="VK_PIPELINE_STAGE_2_FRAGMENT_DENSITY_PROCESS_BIT_EXT"/>
+ <enum bitpos="24" extends="VkAccessFlagBits2" name="VK_ACCESS_2_FRAGMENT_DENSITY_MAP_READ_BIT_EXT"/>
+ </require>
+ <require extension="VK_EXT_blend_operation_advanced">
+ <enum bitpos="19" extends="VkAccessFlagBits2" name="VK_ACCESS_2_COLOR_ATTACHMENT_READ_NONCOHERENT_BIT_EXT"/>
+ </require>
+ <require extension="VK_NV_mesh_shader">
+ <enum bitpos="19" extends="VkPipelineStageFlagBits2" name="VK_PIPELINE_STAGE_2_TASK_SHADER_BIT_NV"/>
+ <enum bitpos="20" extends="VkPipelineStageFlagBits2" name="VK_PIPELINE_STAGE_2_MESH_SHADER_BIT_NV"/>
+ </require>
+ <require extension="VK_AMD_buffer_marker">
+ <command name="vkCmdWriteBufferMarker2AMD"/>
+ </require>
+ <require extension="VK_NV_device_diagnostic_checkpoints">
+ <type name="VkQueueFamilyCheckpointProperties2NV"/>
+ <type name="VkCheckpointData2NV"/>
+ <command name="vkGetQueueCheckpointData2NV"/>
+ <enum offset="8" extends="VkStructureType" name="VK_STRUCTURE_TYPE_QUEUE_FAMILY_CHECKPOINT_PROPERTIES_2_NV"/>
+ <enum offset="9" extends="VkStructureType" name="VK_STRUCTURE_TYPE_CHECKPOINT_DATA_2_NV"/>
+ </require>
+ </extension>
+ <extension name="VK_AMD_extension_316" number="316" author="AMD" contact="Martin Dinkov @mdinkov" supported="disabled">
+ <require>
+ <enum value="0" name="VK_AMD_EXTENSION_316_SPEC_VERSION"/>
+ <enum value="&quot;VK_AMD_extension_316&quot;" name="VK_AMD_EXTENSION_316_EXTENSION_NAME"/>
+ </require>
+ </extension>
+ <extension name="VK_AMD_extension_317" number="317" author="AMD" contact="Martin Dinkov @mdinkov" supported="disabled">
+ <require>
+ <enum value="0" name="VK_AMD_EXTENSION_317_SPEC_VERSION"/>
+ <enum value="&quot;VK_AMD_extension_317&quot;" name="VK_AMD_EXTENSION_317_EXTENSION_NAME"/>
+ <enum bitpos="4" extends="VkDescriptorSetLayoutCreateFlagBits" name="VK_DESCRIPTOR_SET_LAYOUT_CREATE_RESERVED_4_BIT_AMD"/>
+ <enum bitpos="5" extends="VkDescriptorSetLayoutCreateFlagBits" name="VK_DESCRIPTOR_SET_LAYOUT_CREATE_RESERVED_5_BIT_AMD"/>
+ <enum bitpos="21" extends="VkBufferUsageFlagBits" name="VK_BUFFER_USAGE_RESERVED_21_BIT_AMD"/>
+ <enum bitpos="22" extends="VkBufferUsageFlagBits" name="VK_BUFFER_USAGE_RESERVED_22_BIT_AMD"/>
+ <enum bitpos="5" extends="VkBufferCreateFlagBits" name="VK_BUFFER_CREATE_RESERVED_5_BIT_AMD"/>
+ <enum bitpos="16" extends="VkImageCreateFlagBits" name="VK_IMAGE_CREATE_RESERVED_16_BIT_AMD"/>
+ <enum bitpos="3" extends="VkSamplerCreateFlagBits" name="VK_SAMPLER_CREATE_RESERVED_3_BIT_AMD"/>
+ <enum bitpos="41" extends="VkAccessFlagBits2" name="VK_ACCESS_2_RESERVED_41_BIT_AMD"/>
+ <enum bitpos="2" extends="VkImageViewCreateFlagBits" name="VK_IMAGE_VIEW_CREATE_RESERVED_2_BIT_AMD"/>
+ <enum bitpos="3" extends="VkAccelerationStructureCreateFlagBitsKHR" name="VK_ACCELERATION_STRUCTURE_CREATE_RESERVED_3_BIT_AMD"/>
+ </require>
+ </extension>
+ <extension name="VK_AMD_extension_318" number="318" author="AMD" contact="Martin Dinkov @mdinkov" supported="disabled">
+ <require>
+ <enum value="0" name="VK_AMD_EXTENSION_318_SPEC_VERSION"/>
+ <enum value="&quot;VK_AMD_extension_318&quot;" name="VK_AMD_EXTENSION_318_EXTENSION_NAME"/>
+ </require>
+ </extension>
+ <extension name="VK_AMD_extension_319" number="319" author="AMD" contact="Martin Dinkov @mdinkov" supported="disabled">
+ <require>
+ <enum value="0" name="VK_AMD_EXTENSION_319_SPEC_VERSION"/>
+ <enum value="&quot;VK_AMD_extension_319&quot;" name="VK_AMD_EXTENSION_319_EXTENSION_NAME"/>
+ <enum bitpos="3" extends="VkDescriptorSetLayoutCreateFlagBits" name="VK_DESCRIPTOR_SET_LAYOUT_CREATE_RESERVED_3_BIT_AMD"/>
+ <enum bitpos="0" extends="VkPipelineLayoutCreateFlagBits" name="VK_PIPELINE_LAYOUT_CREATE_RESERVED_0_BIT_AMD"/>
+ </require>
+ </extension>
+ <extension name="VK_AMD_extension_320" number="320" author="AMD" contact="Martin Dinkov @mdinkov" supported="disabled">
+ <require>
+ <enum value="0" name="VK_AMD_EXTENSION_320_SPEC_VERSION"/>
+ <enum value="&quot;VK_AMD_extension_320&quot;" name="VK_AMD_EXTENSION_320_EXTENSION_NAME"/>
+ </require>
+ </extension>
+ <extension name="VK_EXT_graphics_pipeline_library" number="321" type="device" requires="VK_KHR_get_physical_device_properties2,VK_KHR_pipeline_library" author="AMD" contact="Tobias Hector @tobski" supported="vulkan">
+ <require>
+ <enum value="1" name="VK_EXT_GRAPHICS_PIPELINE_LIBRARY_SPEC_VERSION"/>
+ <enum value="&quot;VK_EXT_graphics_pipeline_library&quot;" name="VK_EXT_GRAPHICS_PIPELINE_LIBRARY_EXTENSION_NAME"/>
+ <type name="VkPhysicalDeviceGraphicsPipelineLibraryFeaturesEXT"/>
+ <type name="VkPhysicalDeviceGraphicsPipelineLibraryPropertiesEXT"/>
+ <type name="VkGraphicsPipelineLibraryCreateInfoEXT"/>
+ <type name="VkGraphicsPipelineLibraryFlagBitsEXT"/>
+ <type name="VkGraphicsPipelineLibraryFlagsEXT"/>
+ <type name="VkPipelineLayoutCreateFlagBits"/>
+ <enum offset="0" extends="VkStructureType" name="VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_GRAPHICS_PIPELINE_LIBRARY_FEATURES_EXT"/>
+ <enum offset="1" extends="VkStructureType" name="VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_GRAPHICS_PIPELINE_LIBRARY_PROPERTIES_EXT"/>
+ <enum offset="2" extends="VkStructureType" name="VK_STRUCTURE_TYPE_GRAPHICS_PIPELINE_LIBRARY_CREATE_INFO_EXT"/>
+ <enum bitpos="23" extends="VkPipelineCreateFlagBits" name="VK_PIPELINE_CREATE_RETAIN_LINK_TIME_OPTIMIZATION_INFO_BIT_EXT"/>
+ <enum bitpos="10" extends="VkPipelineCreateFlagBits" name="VK_PIPELINE_CREATE_LINK_TIME_OPTIMIZATION_BIT_EXT"/>
+ <enum bitpos="1" extends="VkPipelineLayoutCreateFlagBits" name="VK_PIPELINE_LAYOUT_CREATE_INDEPENDENT_SETS_BIT_EXT"/>
+ </require>
+ </extension>
+ <extension name="VK_AMD_shader_early_and_late_fragment_tests" number="322" author="EXT" contact="Tobias Hector @tobski" type="device" supported="vulkan">
+ <require>
+ <enum value="1" name="VK_AMD_SHADER_EARLY_AND_LATE_FRAGMENT_TESTS_SPEC_VERSION"/>
+ <enum value="&quot;VK_AMD_shader_early_and_late_fragment_tests&quot;" name="VK_AMD_SHADER_EARLY_AND_LATE_FRAGMENT_TESTS_EXTENSION_NAME"/>
+ <type name="VkPhysicalDeviceShaderEarlyAndLateFragmentTestsFeaturesAMD"/>
+ <enum offset="0" extends="VkStructureType" name="VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_SHADER_EARLY_AND_LATE_FRAGMENT_TESTS_FEATURES_AMD"/>
+ </require>
+ </extension>
+ <extension name="VK_KHR_fragment_shader_barycentric" number="323" type="device" requires="VK_KHR_get_physical_device_properties2" author="KHR" contact="Stu Smith" supported="vulkan">
+ <require>
+ <enum value="1" name="VK_KHR_FRAGMENT_SHADER_BARYCENTRIC_SPEC_VERSION"/>
+ <enum value="&quot;VK_KHR_fragment_shader_barycentric&quot;" name="VK_KHR_FRAGMENT_SHADER_BARYCENTRIC_EXTENSION_NAME"/>
+ <enum offset="0" extends="VkStructureType" extnumber="204" name="VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_FRAGMENT_SHADER_BARYCENTRIC_FEATURES_KHR"/>
+ <enum offset="0" extends="VkStructureType" name="VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_FRAGMENT_SHADER_BARYCENTRIC_PROPERTIES_KHR"/>
+ <type name="VkPhysicalDeviceFragmentShaderBarycentricFeaturesKHR"/>
+ <type name="VkPhysicalDeviceFragmentShaderBarycentricPropertiesKHR"/>
+ </require>
+ </extension>
+ <extension name="VK_KHR_shader_subgroup_uniform_control_flow" number="324" type="device" requiresCore="1.1" author="KHR" contact="Alan Baker @alan-baker" supported="vulkan">
+ <require>
+ <enum value="1" name="VK_KHR_SHADER_SUBGROUP_UNIFORM_CONTROL_FLOW_SPEC_VERSION"/>
+ <enum value="&quot;VK_KHR_shader_subgroup_uniform_control_flow&quot;" name="VK_KHR_SHADER_SUBGROUP_UNIFORM_CONTROL_FLOW_EXTENSION_NAME"/>
+ <enum offset="0" extends="VkStructureType" name="VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_SHADER_SUBGROUP_UNIFORM_CONTROL_FLOW_FEATURES_KHR"/>
+ <type name="VkPhysicalDeviceShaderSubgroupUniformControlFlowFeaturesKHR"/>
+ </require>
+ </extension>
+ <extension name="VK_KHR_extension_325" number="325" author="KHR" contact="Ralph Potter gitlab:@r_potter" supported="disabled">
+ <require>
+ <enum value="0" name="VK_KHR_EXTENSION_325_SPEC_VERSION"/>
+ <enum value="&quot;VK_KHR_extension_325&quot;" name="VK_KHR_EXTENSION_325_EXTENSION_NAME"/>
+ </require>
+ </extension>
+ <extension name="VK_KHR_zero_initialize_workgroup_memory" number="326" type="device" requires="VK_KHR_get_physical_device_properties2" author="KHR" contact="Alan Baker @alan-baker" supported="vulkan" promotedto="VK_VERSION_1_3">
+ <require>
+ <enum value="1" name="VK_KHR_ZERO_INITIALIZE_WORKGROUP_MEMORY_SPEC_VERSION"/>
+ <enum value="&quot;VK_KHR_zero_initialize_workgroup_memory&quot;" name="VK_KHR_ZERO_INITIALIZE_WORKGROUP_MEMORY_EXTENSION_NAME"/>
+ <enum extends="VkStructureType" name="VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_ZERO_INITIALIZE_WORKGROUP_MEMORY_FEATURES_KHR" alias="VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_ZERO_INITIALIZE_WORKGROUP_MEMORY_FEATURES"/>
+ <type name="VkPhysicalDeviceZeroInitializeWorkgroupMemoryFeaturesKHR"/>
+ </require>
+ </extension>
+ <extension name="VK_NV_fragment_shading_rate_enums" number="327" type="device" requires="VK_KHR_fragment_shading_rate" author="NV" contact="Pat Brown @nvpbrown" supported="vulkan">
+ <require>
+ <enum value="1" name="VK_NV_FRAGMENT_SHADING_RATE_ENUMS_SPEC_VERSION"/>
+ <enum value="&quot;VK_NV_fragment_shading_rate_enums&quot;" name="VK_NV_FRAGMENT_SHADING_RATE_ENUMS_EXTENSION_NAME"/>
+ <enum offset="0" extends="VkStructureType" name="VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_FRAGMENT_SHADING_RATE_ENUMS_PROPERTIES_NV"/>
+ <enum offset="1" extends="VkStructureType" name="VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_FRAGMENT_SHADING_RATE_ENUMS_FEATURES_NV"/>
+ <enum offset="2" extends="VkStructureType" name="VK_STRUCTURE_TYPE_PIPELINE_FRAGMENT_SHADING_RATE_ENUM_STATE_CREATE_INFO_NV"/>
+ <type name="VkPhysicalDeviceFragmentShadingRateEnumsFeaturesNV"/>
+ <type name="VkPhysicalDeviceFragmentShadingRateEnumsPropertiesNV"/>
+ <type name="VkPipelineFragmentShadingRateEnumStateCreateInfoNV"/>
+ <type name="VkFragmentShadingRateNV"/>
+ <type name="VkFragmentShadingRateTypeNV"/>
+ <command name="vkCmdSetFragmentShadingRateEnumNV"/>
+ </require>
+ </extension>
+ <extension name="VK_NV_ray_tracing_motion_blur" number="328" type="device" requires="VK_KHR_ray_tracing_pipeline" author="NV" contact="Eric Werness" supported="vulkan">
+ <require>
+ <enum value="1" name="VK_NV_RAY_TRACING_MOTION_BLUR_SPEC_VERSION"/>
+ <enum value="&quot;VK_NV_ray_tracing_motion_blur&quot;" name="VK_NV_RAY_TRACING_MOTION_BLUR_EXTENSION_NAME"/>
+ <enum offset="0" extends="VkStructureType" name="VK_STRUCTURE_TYPE_ACCELERATION_STRUCTURE_GEOMETRY_MOTION_TRIANGLES_DATA_NV"/>
+ <enum offset="1" extends="VkStructureType" name="VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_RAY_TRACING_MOTION_BLUR_FEATURES_NV"/>
+ <enum offset="2" extends="VkStructureType" name="VK_STRUCTURE_TYPE_ACCELERATION_STRUCTURE_MOTION_INFO_NV"/>
+ <enum bitpos="5" extends="VkBuildAccelerationStructureFlagBitsKHR" name="VK_BUILD_ACCELERATION_STRUCTURE_MOTION_BIT_NV"/>
+ <enum bitpos="2" extends="VkAccelerationStructureCreateFlagBitsKHR" name="VK_ACCELERATION_STRUCTURE_CREATE_MOTION_BIT_NV"/>
+ <enum bitpos="20" extends="VkPipelineCreateFlagBits" name="VK_PIPELINE_CREATE_RAY_TRACING_ALLOW_MOTION_BIT_NV"/>
+ <type name="VkAccelerationStructureGeometryMotionTrianglesDataNV"/>
+ <type name="VkAccelerationStructureMotionInfoNV"/>
+ <type name="VkAccelerationStructureMotionInstanceNV"/>
+ <type name="VkAccelerationStructureMotionInstanceDataNV"/>
+ <type name="VkAccelerationStructureMatrixMotionInstanceNV"/>
+ <type name="VkAccelerationStructureSRTMotionInstanceNV"/>
+ <type name="VkSRTDataNV"/>
+ <type name="VkAccelerationStructureMotionInstanceTypeNV"/>
+ <type name="VkPhysicalDeviceRayTracingMotionBlurFeaturesNV"/>
+ <type name="VkAccelerationStructureMotionInfoFlagsNV"/>
+ <type name="VkAccelerationStructureMotionInstanceFlagsNV"/>
+ </require>
+ </extension>
+ <extension name="VK_NV_extension_329" number="329" author="NV" contact="Pat Brown @nvpbrown" supported="disabled">
+ <require>
+ <enum value="0" name="VK_NV_EXTENSION_329_SPEC_VERSION"/>
+ <enum value="&quot;VK_NV_extension_329&quot;" name="VK_NV_EXTENSION_329_EXTENSION_NAME"/>
+ </require>
+ </extension>
+ <extension name="VK_NV_extension_330" number="330" author="NV" contact="Liam Middlebrook @liam-middlebrook" supported="disabled">
+ <require>
+ <enum value="0" name="VK_NV_EXTENSION_330_SPEC_VERSION"/>
+ <enum value="&quot;VK_NV_extension_330&quot;" name="VK_NV_EXTENSION_330_EXTENSION_NAME"/>
+ </require>
+ </extension>
+ <extension name="VK_EXT_ycbcr_2plane_444_formats" number="331" type="device" requires="VK_KHR_sampler_ycbcr_conversion" author="EXT" contact="Tony Zlatinski @tzlatinski" supported="vulkan" promotedto="VK_VERSION_1_3">
+ <require>
+ <comment>
+ VkPhysicalDeviceYcbcr2Plane444FormatsFeaturesEXT and
+ VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_YCBCR_2_PLANE_444_FORMATS_FEATURES_EXT
+ were not promoted to Vulkan 1.3.
+ </comment>
+ <enum value="1" name="VK_EXT_YCBCR_2PLANE_444_FORMATS_SPEC_VERSION"/>
+ <enum value="&quot;VK_EXT_ycbcr_2plane_444_formats&quot;" name="VK_EXT_YCBCR_2PLANE_444_FORMATS_EXTENSION_NAME"/>
+ <enum offset="0" extends="VkStructureType" name="VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_YCBCR_2_PLANE_444_FORMATS_FEATURES_EXT"/>
+ <enum extends="VkFormat" name="VK_FORMAT_G8_B8R8_2PLANE_444_UNORM_EXT" alias="VK_FORMAT_G8_B8R8_2PLANE_444_UNORM"/>
+ <enum extends="VkFormat" name="VK_FORMAT_G10X6_B10X6R10X6_2PLANE_444_UNORM_3PACK16_EXT" alias="VK_FORMAT_G10X6_B10X6R10X6_2PLANE_444_UNORM_3PACK16"/>
+ <enum extends="VkFormat" name="VK_FORMAT_G12X4_B12X4R12X4_2PLANE_444_UNORM_3PACK16_EXT" alias="VK_FORMAT_G12X4_B12X4R12X4_2PLANE_444_UNORM_3PACK16"/>
+ <enum extends="VkFormat" name="VK_FORMAT_G16_B16R16_2PLANE_444_UNORM_EXT" alias="VK_FORMAT_G16_B16R16_2PLANE_444_UNORM"/>
+ <type name="VkPhysicalDeviceYcbcr2Plane444FormatsFeaturesEXT"/>
+ </require>
+ </extension>
+ <extension name="VK_NV_extension_332" number="332" author="NV" contact="Tony Zlatinski @tzlatinski" supported="disabled">
+ <require>
+ <enum value="0" name="VK_NV_EXTENSION_332_SPEC_VERSION"/>
+ <enum value="&quot;VK_NV_extension_332&quot;" name="VK_NV_EXTENSION_332_EXTENSION_NAME"/>
+ </require>
+ </extension>
+ <extension name="VK_EXT_fragment_density_map2" number="333" type="device" requires="VK_EXT_fragment_density_map" author="EXT" contact="Matthew Netsch @mnetsch" supported="vulkan">
+ <require>
+ <enum value="1" name="VK_EXT_FRAGMENT_DENSITY_MAP_2_SPEC_VERSION"/>
+ <enum value="&quot;VK_EXT_fragment_density_map2&quot;" name="VK_EXT_FRAGMENT_DENSITY_MAP_2_EXTENSION_NAME"/>
+ <enum offset="0" extends="VkStructureType" name="VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_FRAGMENT_DENSITY_MAP_2_FEATURES_EXT"/>
+ <enum offset="1" extends="VkStructureType" name="VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_FRAGMENT_DENSITY_MAP_2_PROPERTIES_EXT"/>
+ <enum bitpos="1" extends="VkImageViewCreateFlagBits" name="VK_IMAGE_VIEW_CREATE_FRAGMENT_DENSITY_MAP_DEFERRED_BIT_EXT"/>
+ <type name="VkPhysicalDeviceFragmentDensityMap2FeaturesEXT"/>
+ <type name="VkPhysicalDeviceFragmentDensityMap2PropertiesEXT"/>
+ </require>
+ </extension>
+ <extension name="VK_QCOM_rotated_copy_commands" number="334" type="device" requires="VK_KHR_swapchain,VK_KHR_copy_commands2" author="QCOM" contact="Jeff Leger @jackohound" supported="vulkan">
+ <require>
+ <enum value="1" name="VK_QCOM_ROTATED_COPY_COMMANDS_SPEC_VERSION"/>
+ <enum value="&quot;VK_QCOM_rotated_copy_commands&quot;" name="VK_QCOM_ROTATED_COPY_COMMANDS_EXTENSION_NAME"/>
+ <enum offset="0" extends="VkStructureType" name="VK_STRUCTURE_TYPE_COPY_COMMAND_TRANSFORM_INFO_QCOM"/>
+ <type name="VkCopyCommandTransformInfoQCOM"/>
+ </require>
+ </extension>
+ <extension name="VK_KHR_extension_335" number="335" author="KHR" contact="Mark Bellamy @mark.bellamy_arm" supported="disabled">
+ <require>
+ <enum value="0" name="VK_KHR_EXTENSION_335_SPEC_VERSION"/>
+ <enum value="&quot;VK_KHR_extension_335&quot;" name="VK_KHR_EXTENSION_335_EXTENSION_NAME"/>
+ </require>
+ </extension>
+ <extension name="VK_EXT_image_robustness" number="336" type="device" author="EXT" contact="Graeme Leese @gnl21" supported="vulkan" requires="VK_KHR_get_physical_device_properties2" promotedto="VK_VERSION_1_3">
+ <require>
+ <enum value="1" name="VK_EXT_IMAGE_ROBUSTNESS_SPEC_VERSION"/>
+ <enum value="&quot;VK_EXT_image_robustness&quot;" name="VK_EXT_IMAGE_ROBUSTNESS_EXTENSION_NAME"/>
+ <enum extends="VkStructureType" name="VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_IMAGE_ROBUSTNESS_FEATURES_EXT" alias="VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_IMAGE_ROBUSTNESS_FEATURES"/>
+ <type name="VkPhysicalDeviceImageRobustnessFeaturesEXT"/>
+ </require>
+ </extension>
+ <extension name="VK_KHR_workgroup_memory_explicit_layout" number="337" type="device" requires="VK_KHR_get_physical_device_properties2" author="KHR" contact="Caio Marcelo de Oliveira Filho @cmarcelo" supported="vulkan">
+ <require>
+ <enum value="1" name="VK_KHR_WORKGROUP_MEMORY_EXPLICIT_LAYOUT_SPEC_VERSION"/>
+ <enum value="&quot;VK_KHR_workgroup_memory_explicit_layout&quot;" name="VK_KHR_WORKGROUP_MEMORY_EXPLICIT_LAYOUT_EXTENSION_NAME"/>
+ <enum offset="0" extends="VkStructureType" name="VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_WORKGROUP_MEMORY_EXPLICIT_LAYOUT_FEATURES_KHR"/>
+ <type name="VkPhysicalDeviceWorkgroupMemoryExplicitLayoutFeaturesKHR"/>
+ </require>
+ </extension>
+ <extension name="VK_KHR_copy_commands2" number="338" author="KHR" type="device" contact="Jeff Leger @jackohound" supported="vulkan" promotedto="VK_VERSION_1_3">
+ <require>
+ <enum value="1" name="VK_KHR_COPY_COMMANDS_2_SPEC_VERSION"/>
+ <enum value="&quot;VK_KHR_copy_commands2&quot;" name="VK_KHR_COPY_COMMANDS_2_EXTENSION_NAME"/>
+ <enum extends="VkStructureType" name="VK_STRUCTURE_TYPE_COPY_BUFFER_INFO_2_KHR" alias="VK_STRUCTURE_TYPE_COPY_BUFFER_INFO_2"/>
+ <enum extends="VkStructureType" name="VK_STRUCTURE_TYPE_COPY_IMAGE_INFO_2_KHR" alias="VK_STRUCTURE_TYPE_COPY_IMAGE_INFO_2"/>
+ <enum extends="VkStructureType" name="VK_STRUCTURE_TYPE_COPY_BUFFER_TO_IMAGE_INFO_2_KHR" alias="VK_STRUCTURE_TYPE_COPY_BUFFER_TO_IMAGE_INFO_2"/>
+ <enum extends="VkStructureType" name="VK_STRUCTURE_TYPE_COPY_IMAGE_TO_BUFFER_INFO_2_KHR" alias="VK_STRUCTURE_TYPE_COPY_IMAGE_TO_BUFFER_INFO_2"/>
+ <enum extends="VkStructureType" name="VK_STRUCTURE_TYPE_BLIT_IMAGE_INFO_2_KHR" alias="VK_STRUCTURE_TYPE_BLIT_IMAGE_INFO_2"/>
+ <enum extends="VkStructureType" name="VK_STRUCTURE_TYPE_RESOLVE_IMAGE_INFO_2_KHR" alias="VK_STRUCTURE_TYPE_RESOLVE_IMAGE_INFO_2"/>
+ <enum extends="VkStructureType" name="VK_STRUCTURE_TYPE_BUFFER_COPY_2_KHR" alias="VK_STRUCTURE_TYPE_BUFFER_COPY_2"/>
+ <enum extends="VkStructureType" name="VK_STRUCTURE_TYPE_IMAGE_COPY_2_KHR" alias="VK_STRUCTURE_TYPE_IMAGE_COPY_2"/>
+ <enum extends="VkStructureType" name="VK_STRUCTURE_TYPE_IMAGE_BLIT_2_KHR" alias="VK_STRUCTURE_TYPE_IMAGE_BLIT_2"/>
+ <enum extends="VkStructureType" name="VK_STRUCTURE_TYPE_BUFFER_IMAGE_COPY_2_KHR" alias="VK_STRUCTURE_TYPE_BUFFER_IMAGE_COPY_2"/>
+ <enum extends="VkStructureType" name="VK_STRUCTURE_TYPE_IMAGE_RESOLVE_2_KHR" alias="VK_STRUCTURE_TYPE_IMAGE_RESOLVE_2"/>
+ <type name="VkCopyBufferInfo2KHR"/>
+ <type name="VkCopyImageInfo2KHR"/>
+ <type name="VkCopyBufferToImageInfo2KHR"/>
+ <type name="VkCopyImageToBufferInfo2KHR"/>
+ <type name="VkBlitImageInfo2KHR"/>
+ <type name="VkResolveImageInfo2KHR"/>
+ <type name="VkBufferCopy2KHR"/>
+ <type name="VkImageCopy2KHR"/>
+ <type name="VkImageBlit2KHR"/>
+ <type name="VkBufferImageCopy2KHR"/>
+ <type name="VkImageResolve2KHR"/>
+ <command name="vkCmdCopyBuffer2KHR"/>
+ <command name="vkCmdCopyImage2KHR"/>
+ <command name="vkCmdCopyBufferToImage2KHR"/>
+ <command name="vkCmdCopyImageToBuffer2KHR"/>
+ <command name="vkCmdBlitImage2KHR"/>
+ <command name="vkCmdResolveImage2KHR"/>
+ </require>
+ </extension>
+ <extension name="VK_EXT_image_compression_control" number="339" type="device" author="EXT" contact="Jan-Harald Fredriksen @janharaldfredriksen-arm" supported="vulkan">
+ <require>
+ <enum value="1" name="VK_EXT_IMAGE_COMPRESSION_CONTROL_SPEC_VERSION"/>
+ <enum value="&quot;VK_EXT_image_compression_control&quot;" name="VK_EXT_IMAGE_COMPRESSION_CONTROL_EXTENSION_NAME"/>
+ <enum offset="0" extends="VkStructureType" name="VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_IMAGE_COMPRESSION_CONTROL_FEATURES_EXT"/>
+ <type name="VkPhysicalDeviceImageCompressionControlFeaturesEXT"/>
+ <enum offset="1" extends="VkStructureType" name="VK_STRUCTURE_TYPE_IMAGE_COMPRESSION_CONTROL_EXT"/>
+ <type name="VkImageCompressionControlEXT"/>
+ <enum offset="2" extends="VkStructureType" name="VK_STRUCTURE_TYPE_SUBRESOURCE_LAYOUT_2_EXT"/>
+ <type name="VkSubresourceLayout2EXT"/>
+ <enum offset="3" extends="VkStructureType" name="VK_STRUCTURE_TYPE_IMAGE_SUBRESOURCE_2_EXT"/>
+ <type name="VkImageSubresource2EXT"/>
+ <enum offset="4" extends="VkStructureType" name="VK_STRUCTURE_TYPE_IMAGE_COMPRESSION_PROPERTIES_EXT"/>
+ <type name="VkImageCompressionPropertiesEXT"/>
+ <type name="VkImageCompressionFlagBitsEXT"/>
+ <type name="VkImageCompressionFlagsEXT"/>
+ <type name="VkImageCompressionFixedRateFlagBitsEXT"/>
+ <type name="VkImageCompressionFixedRateFlagsEXT"/>
+ <enum offset="0" dir="-" extends="VkResult" name="VK_ERROR_COMPRESSION_EXHAUSTED_EXT"/>
+ <command name="vkGetImageSubresourceLayout2EXT"/>
+ </require>
+ </extension>
+ <extension name="VK_EXT_extension_340" number="340" author="EXT" contact="Joshua Ashton @Joshua-Ashton" supported="disabled">
+ <require>
+ <enum value="0" name="VK_EXT_EXTENSION_340_SPEC_VERSION"/>
+ <enum value="&quot;VK_EXT_extension_340&quot;" name="VK_EXT_EXTENSION_340_EXTENSION_NAME"/>
+ <enum bitpos="19" extends="VkImageUsageFlagBits" name="VK_IMAGE_USAGE_RESERVED_19_BIT_EXT"/>
+ <enum bitpos="25" extends="VkPipelineCreateFlagBits" name="VK_PIPELINE_CREATE_RESERVED_25_BIT_EXT"/>
+ <enum bitpos="26" extends="VkPipelineCreateFlagBits" name="VK_PIPELINE_CREATE_RESERVED_26_BIT_EXT"/>
+ <enum bitpos="3" extends="VkDependencyFlagBits" name="VK_DEPENDENCY_RESERVED_3_BIT_EXT"/>
+ </require>
+ </extension>
+ <extension name="VK_EXT_4444_formats" number="341" type="device" requires="VK_KHR_get_physical_device_properties2" author="EXT" contact="Joshua Ashton @Joshua-Ashton" supported="vulkan" promotedto="VK_VERSION_1_3">
+ <require>
+ <comment>
+ VkPhysicalDevice4444FormatsFeaturesEXT and
+ VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_4444_FORMATS_FEATURES_EXT
+ were not promoted to Vulkan 1.3.
+ </comment>
+ <enum value="1" name="VK_EXT_4444_FORMATS_SPEC_VERSION"/>
+ <enum value="&quot;VK_EXT_4444_formats&quot;" name="VK_EXT_4444_FORMATS_EXTENSION_NAME"/>
+ <enum offset="0" extends="VkStructureType" name="VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_4444_FORMATS_FEATURES_EXT"/>
+ <enum extends="VkFormat" name="VK_FORMAT_A4R4G4B4_UNORM_PACK16_EXT" alias="VK_FORMAT_A4R4G4B4_UNORM_PACK16"/>
+ <enum extends="VkFormat" name="VK_FORMAT_A4B4G4R4_UNORM_PACK16_EXT" alias="VK_FORMAT_A4B4G4R4_UNORM_PACK16"/>
+ <type name="VkPhysicalDevice4444FormatsFeaturesEXT"/>
+ </require>
+ </extension>
+ <extension name="VK_EXT_extension_342" number="342" author="EXT" contact="Ralph Potter gitlab:@r_potter" supported="disabled">
+ <require>
+ <enum value="0" name="VK_EXT_EXTENSION_342_SPEC_VERSION"/>
+ <enum value="&quot;VK_EXT_extension_342&quot;" name="VK_EXT_EXTENSION_342_EXTENSION_NAME"/>
+ </require>
+ </extension>
+ <extension name="VK_ARM_rasterization_order_attachment_access" number="343" type="device" requires="VK_KHR_get_physical_device_properties2" author="ARM" contact="Jan-Harald Fredriksen @janharaldfredriksen-arm" supported="vulkan">
+ <require>
+ <enum value="1" name="VK_ARM_RASTERIZATION_ORDER_ATTACHMENT_ACCESS_SPEC_VERSION"/>
+ <enum value="&quot;VK_ARM_rasterization_order_attachment_access&quot;" name="VK_ARM_RASTERIZATION_ORDER_ATTACHMENT_ACCESS_EXTENSION_NAME"/>
+ <enum offset="0" extends="VkStructureType" name="VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_RASTERIZATION_ORDER_ATTACHMENT_ACCESS_FEATURES_ARM"/>
+ <type name="VkPhysicalDeviceRasterizationOrderAttachmentAccessFeaturesARM"/>
+ <type name="VkPipelineColorBlendStateCreateFlagBits"/>
+ <type name="VkPipelineDepthStencilStateCreateFlagBits"/>
+ <enum bitpos="0" extends="VkPipelineColorBlendStateCreateFlagBits" name="VK_PIPELINE_COLOR_BLEND_STATE_CREATE_RASTERIZATION_ORDER_ATTACHMENT_ACCESS_BIT_ARM"/>
+ <enum bitpos="0" extends="VkPipelineDepthStencilStateCreateFlagBits" name="VK_PIPELINE_DEPTH_STENCIL_STATE_CREATE_RASTERIZATION_ORDER_ATTACHMENT_DEPTH_ACCESS_BIT_ARM"/>
+ <enum bitpos="1" extends="VkPipelineDepthStencilStateCreateFlagBits" name="VK_PIPELINE_DEPTH_STENCIL_STATE_CREATE_RASTERIZATION_ORDER_ATTACHMENT_STENCIL_ACCESS_BIT_ARM"/>
+ <enum bitpos="4" extends="VkSubpassDescriptionFlagBits" name="VK_SUBPASS_DESCRIPTION_RASTERIZATION_ORDER_ATTACHMENT_COLOR_ACCESS_BIT_ARM"/>
+ <enum bitpos="5" extends="VkSubpassDescriptionFlagBits" name="VK_SUBPASS_DESCRIPTION_RASTERIZATION_ORDER_ATTACHMENT_DEPTH_ACCESS_BIT_ARM"/>
+ <enum bitpos="6" extends="VkSubpassDescriptionFlagBits" name="VK_SUBPASS_DESCRIPTION_RASTERIZATION_ORDER_ATTACHMENT_STENCIL_ACCESS_BIT_ARM"/>
+ </require>
+ </extension>
+ <extension name="VK_ARM_extension_344" number="344" author="ARM" contact="Jan-Harald Fredriksen @janharaldfredriksen-arm" supported="disabled">
+ <require>
+ <enum value="0" name="VK_ARM_EXTENSION_344_SPEC_VERSION"/>
+ <enum value="&quot;VK_ARM_extension_344&quot;" name="VK_ARM_EXTENSION_344_EXTENSION_NAME"/>
+ </require>
+ </extension>
+ <extension name="VK_EXT_rgba10x6_formats" number="345" type="device" requires="VK_KHR_sampler_ycbcr_conversion" author="EXT" contact="Jan-Harald Fredriksen @janharaldfredriksen-arm" supported="vulkan">
<require>
- <enum value="0" name="VK_KHR_EXTENSION_117_SPEC_VERSION"/>
- <enum value="&quot;VK_KHR_extension_117&quot;" name="VK_KHR_EXTENSION_117_EXTENSION_NAME"/>
- </require>
- </extension>
+ <enum value="1" name="VK_EXT_RGBA10X6_FORMATS_SPEC_VERSION"/>
+ <enum value="&quot;VK_EXT_rgba10x6_formats&quot;" name="VK_EXT_RGBA10X6_FORMATS_EXTENSION_NAME"/>
+ <enum offset="0" extends="VkStructureType" name="VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_RGBA10X6_FORMATS_FEATURES_EXT"/>
+ <type name="VkPhysicalDeviceRGBA10X6FormatsFeaturesEXT"/>
+ </require>
+ </extension>
+ <extension name="VK_NV_acquire_winrt_display" number="346" type="device" requires="VK_EXT_direct_mode_display" author="NV" contact="Jeff Juliano @jjuliano" platform="win32" supported="vulkan">
+ <require>
+ <enum value="1" name="VK_NV_ACQUIRE_WINRT_DISPLAY_SPEC_VERSION"/>
+ <enum value="&quot;VK_NV_acquire_winrt_display&quot;" name="VK_NV_ACQUIRE_WINRT_DISPLAY_EXTENSION_NAME"/>
+ <command name="vkAcquireWinrtDisplayNV"/>
+ <command name="vkGetWinrtDisplayNV"/>
+ </require>
+ </extension>
+ <extension name="VK_EXT_directfb_surface" number="347" type="instance" requires="VK_KHR_surface" platform="directfb" supported="vulkan" author="EXT" contact="Nicolas Caramelli @caramelli">
+ <require>
+ <enum value="1" name="VK_EXT_DIRECTFB_SURFACE_SPEC_VERSION"/>
+ <enum value="&quot;VK_EXT_directfb_surface&quot;" name="VK_EXT_DIRECTFB_SURFACE_EXTENSION_NAME"/>
+ <enum offset="0" extends="VkStructureType" name="VK_STRUCTURE_TYPE_DIRECTFB_SURFACE_CREATE_INFO_EXT"/>
+ <type name="VkDirectFBSurfaceCreateFlagsEXT"/>
+ <type name="VkDirectFBSurfaceCreateInfoEXT"/>
+ <command name="vkCreateDirectFBSurfaceEXT"/>
+ <command name="vkGetPhysicalDeviceDirectFBPresentationSupportEXT"/>
+ </require>
+ </extension>
+ <extension name="VK_KHR_extension_350" number="350" author="KHR" contact="Mark Bellamy @mark.bellamy_arm" supported="disabled">
+ <require>
+ <enum value="0" name="VK_KHR_EXTENSION_350_SPEC_VERSION"/>
+ <enum value="&quot;VK_KHR_extension_350&quot;" name="VK_KHR_EXTENSION_350_EXTENSION_NAME"/>
+ </require>
+ </extension>
+ <extension name="VK_NV_extension_351" number="351" author="NV" contact="Liam Middlebrook @liam-middlebrook" supported="disabled">
+ <require>
+ <enum value="0" name="VK_NV_EXTENSION_351_SPEC_VERSION"/>
+ <enum value="&quot;VK_NV_extension_351&quot;" name="VK_NV_EXTENSION_351_EXTENSION_NAME"/>
+ </require>
+ </extension>
+ <extension name="VK_VALVE_mutable_descriptor_type" number="352" type="device" supported="vulkan" author="VALVE" contact="Joshua Ashton @Joshua-Ashton,Hans-Kristian Arntzen @HansKristian-Work" specialuse="d3demulation" requires="VK_KHR_maintenance3">
+ <require>
+ <enum value="1" name="VK_VALVE_MUTABLE_DESCRIPTOR_TYPE_SPEC_VERSION"/>
+ <enum value="&quot;VK_VALVE_mutable_descriptor_type&quot;" name="VK_VALVE_MUTABLE_DESCRIPTOR_TYPE_EXTENSION_NAME"/>
+ <enum offset="0" extends="VkStructureType" name="VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_MUTABLE_DESCRIPTOR_TYPE_FEATURES_VALVE"/>
+ <enum offset="2" extends="VkStructureType" name="VK_STRUCTURE_TYPE_MUTABLE_DESCRIPTOR_TYPE_CREATE_INFO_VALVE"/>
+ <enum offset="0" extends="VkDescriptorType" name="VK_DESCRIPTOR_TYPE_MUTABLE_VALVE"/>
+ <enum bitpos="2" extends="VkDescriptorPoolCreateFlagBits" name="VK_DESCRIPTOR_POOL_CREATE_HOST_ONLY_BIT_VALVE"/>
+ <enum bitpos="2" extends="VkDescriptorSetLayoutCreateFlagBits" name="VK_DESCRIPTOR_SET_LAYOUT_CREATE_HOST_ONLY_POOL_BIT_VALVE"/>
+ <type name="VkPhysicalDeviceMutableDescriptorTypeFeaturesVALVE"/>
+ <type name="VkMutableDescriptorTypeListVALVE"/>
+ <type name="VkMutableDescriptorTypeCreateInfoVALVE"/>
+ </require>
+ </extension>
+ <extension name="VK_EXT_vertex_input_dynamic_state" number="353" type="device" requires="VK_KHR_get_physical_device_properties2" author="EXT" contact="Piers Daniell @pdaniell-nv" supported="vulkan">
+ <require>
+ <enum value="2" name="VK_EXT_VERTEX_INPUT_DYNAMIC_STATE_SPEC_VERSION"/>
+ <enum value="&quot;VK_EXT_vertex_input_dynamic_state&quot;" name="VK_EXT_VERTEX_INPUT_DYNAMIC_STATE_EXTENSION_NAME"/>
+ <enum offset="0" extends="VkStructureType" name="VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_VERTEX_INPUT_DYNAMIC_STATE_FEATURES_EXT"/>
+ <enum offset="1" extends="VkStructureType" name="VK_STRUCTURE_TYPE_VERTEX_INPUT_BINDING_DESCRIPTION_2_EXT"/>
+ <enum offset="2" extends="VkStructureType" name="VK_STRUCTURE_TYPE_VERTEX_INPUT_ATTRIBUTE_DESCRIPTION_2_EXT"/>
+ <enum offset="0" extends="VkDynamicState" name="VK_DYNAMIC_STATE_VERTEX_INPUT_EXT"/>
+ <type name="VkPhysicalDeviceVertexInputDynamicStateFeaturesEXT"/>
+ <type name="VkVertexInputBindingDescription2EXT"/>
+ <type name="VkVertexInputAttributeDescription2EXT"/>
+ <command name="vkCmdSetVertexInputEXT"/>
+ </require>
+ </extension>
+ <extension name="VK_EXT_physical_device_drm" number="354" author="EXT" type="device" contact="Simon Ser @emersion" supported="vulkan" requires="VK_KHR_get_physical_device_properties2">
+ <require>
+ <enum value="1" name="VK_EXT_PHYSICAL_DEVICE_DRM_SPEC_VERSION"/>
+ <enum value="&quot;VK_EXT_physical_device_drm&quot;" name="VK_EXT_PHYSICAL_DEVICE_DRM_EXTENSION_NAME"/>
+
+ <enum offset="0" extends="VkStructureType" name="VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_DRM_PROPERTIES_EXT"/>
+
+ <type name="VkPhysicalDeviceDrmPropertiesEXT"/>
+ </require>
+ </extension>
+ <extension name="VK_EXT_extension_355" number="355" author="EXT" contact="Ralph Potter gitlab:@r_potter" supported="disabled">
+ <require>
+ <enum value="0" name="VK_EXT_EXTENSION_355_SPEC_VERSION"/>
+ <enum value="&quot;VK_EXT_extension_355&quot;" name="VK_EXT_EXTENSION_355_EXTENSION_NAME"/>
+ </require>
+ </extension>
+ <extension name="VK_EXT_depth_clip_control" number="356" type="device" requires="VK_KHR_get_physical_device_properties2" author="EXT" contact="Shahbaz Youssefi @syoussefi" supported="vulkan" specialuse="glemulation">
+ <require>
+ <enum value="1" name="VK_EXT_DEPTH_CLIP_CONTROL_SPEC_VERSION"/>
+ <enum value="&quot;VK_EXT_depth_clip_control&quot;" name="VK_EXT_DEPTH_CLIP_CONTROL_EXTENSION_NAME"/>
+ <enum offset="0" extends="VkStructureType" name="VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_DEPTH_CLIP_CONTROL_FEATURES_EXT"/>
+ <enum offset="1" extends="VkStructureType" name="VK_STRUCTURE_TYPE_PIPELINE_VIEWPORT_DEPTH_CLIP_CONTROL_CREATE_INFO_EXT"/>
+ <type name="VkPhysicalDeviceDepthClipControlFeaturesEXT"/>
+ <type name="VkPipelineViewportDepthClipControlCreateInfoEXT"/>
+ </require>
+ </extension>
+ <extension name="VK_EXT_primitive_topology_list_restart" number="357" type="device" author="EXT" contact="Shahbaz Youssefi @syoussefi" supported="vulkan" specialuse="glemulation">
+ <require>
+ <enum value="1" name="VK_EXT_PRIMITIVE_TOPOLOGY_LIST_RESTART_SPEC_VERSION"/>
+ <enum value="&quot;VK_EXT_primitive_topology_list_restart&quot;" name="VK_EXT_PRIMITIVE_TOPOLOGY_LIST_RESTART_EXTENSION_NAME"/>
+ <enum offset="0" extends="VkStructureType" name="VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_PRIMITIVE_TOPOLOGY_LIST_RESTART_FEATURES_EXT"/>
+ <type name="VkPhysicalDevicePrimitiveTopologyListRestartFeaturesEXT"/>
+ </require>
+ </extension>
+ <extension name="VK_KHR_extension_358" number="358" author="KHR" contact="Jeff Bolz @jeffbolznv" supported="disabled">
+ <require>
+ <enum value="0" name="VK_KHR_EXTENSION_358_SPEC_VERSION"/>
+ <enum value="&quot;VK_KHR_extension_358&quot;" name="VK_KHR_EXTENSION_358_EXTENSION_NAME"/>
+ </require>
+ </extension>
+ <extension name="VK_EXT_extension_359" number="359" author="EXT" contact="Bill Hollings @billhollings" supported="disabled" specialuse="glemulation">
+ <require>
+ <enum value="0" name="VK_EXT_EXTENSION_359_SPEC_VERSION"/>
+ <enum value="&quot;VK_EXT_extension_359&quot;" name="VK_EXT_EXTENSION_359_EXTENSION_NAME"/>
+ </require>
+ </extension>
+ <extension name="VK_EXT_extension_360" number="360" author="EXT" contact="Bill Hollings @billhollings" supported="disabled" specialuse="glemulation">
+ <require>
+ <enum value="0" name="VK_EXT_EXTENSION_360_SPEC_VERSION"/>
+ <enum value="&quot;VK_EXT_extension_360&quot;" name="VK_EXT_EXTENSION_360_EXTENSION_NAME"/>
+ </require>
+ </extension>
+ <extension name="VK_KHR_format_feature_flags2" number="361" author="KHR" type="device" requires="VK_KHR_get_physical_device_properties2" contact="Lionel Landwerlin @llandwerlin" supported="vulkan" promotedto="VK_VERSION_1_3">
+ <require>
+ <enum value="1" name="VK_KHR_FORMAT_FEATURE_FLAGS_2_SPEC_VERSION"/>
+ <enum value="&quot;VK_KHR_format_feature_flags2&quot;" name="VK_KHR_FORMAT_FEATURE_FLAGS_2_EXTENSION_NAME"/>
+ <enum extends="VkStructureType" name="VK_STRUCTURE_TYPE_FORMAT_PROPERTIES_3_KHR" alias="VK_STRUCTURE_TYPE_FORMAT_PROPERTIES_3"/>
+ <type name="VkFormatFeatureFlags2KHR"/>
+ <type name="VkFormatFeatureFlagBits2KHR"/>
+ <type name="VkFormatProperties3KHR"/>
+ </require>
+ </extension>
+ <extension name="VK_EXT_extension_362" number="362" author="EXT" contact="Lionel Duc @nvlduc" supported="disabled">
+ <require>
+ <enum value="0" name="VK_EXT_EXTENSION_362_SPEC_VERSION"/>
+ <enum value="&quot;VK_EXT_extension_362&quot;" name="VK_EXT_EXTENSION_362_EXTENSION_NAME"/>
+ </require>
+ </extension>
+ <extension name="VK_EXT_extension_363" number="363" author="EXT" contact="Kaye Mason @chaleur" supported="disabled">
+ <require>
+ <enum value="0" name="VK_EXT_EXTENSION_363_SPEC_VERSION"/>
+ <enum value="&quot;VK_EXT_extension_363&quot;" name="VK_EXT_EXTENSION_363_EXTENSION_NAME"/>
+ </require>
+ </extension>
+ <extension name="VK_FUCHSIA_extension_364" number="364" author="FUCHSIA" contact="Craig Stout @cdotstout" supported="disabled">
+ <require>
+ <enum value="0" name="VK_FUCHSIA_EXTENSION_364_SPEC_VERSION"/>
+ <enum value="&quot;VK_FUCHSIA_extension_364&quot;" name="VK_FUCHSIA_EXTENSION_364_EXTENSION_NAME"/>
+ </require>
+ </extension>
+ <extension name="VK_FUCHSIA_external_memory" number="365" type="device" requires="VK_KHR_external_memory_capabilities,VK_KHR_external_memory" author="FUCHSIA" contact="John Rosasco @rosasco" platform="fuchsia" supported="vulkan">
+ <require>
+ <enum value="1" name="VK_FUCHSIA_EXTERNAL_MEMORY_SPEC_VERSION"/>
+ <enum value="&quot;VK_FUCHSIA_external_memory&quot;" name="VK_FUCHSIA_EXTERNAL_MEMORY_EXTENSION_NAME"/>
+ <enum offset="0" extends="VkStructureType" name="VK_STRUCTURE_TYPE_IMPORT_MEMORY_ZIRCON_HANDLE_INFO_FUCHSIA"/>
+ <enum offset="1" extends="VkStructureType" name="VK_STRUCTURE_TYPE_MEMORY_ZIRCON_HANDLE_PROPERTIES_FUCHSIA"/>
+ <enum offset="2" extends="VkStructureType" name="VK_STRUCTURE_TYPE_MEMORY_GET_ZIRCON_HANDLE_INFO_FUCHSIA"/>
+ <enum bitpos="11" extends="VkExternalMemoryHandleTypeFlagBits" name="VK_EXTERNAL_MEMORY_HANDLE_TYPE_ZIRCON_VMO_BIT_FUCHSIA"/>
+ <type name="VkImportMemoryZirconHandleInfoFUCHSIA"/>
+ <type name="VkMemoryZirconHandlePropertiesFUCHSIA"/>
+ <type name="VkMemoryGetZirconHandleInfoFUCHSIA"/>
+ <command name="vkGetMemoryZirconHandleFUCHSIA"/>
+ <command name="vkGetMemoryZirconHandlePropertiesFUCHSIA"/>
+ </require>
+ </extension>
+ <extension name="VK_FUCHSIA_external_semaphore" number="366" type="device" requires="VK_KHR_external_semaphore_capabilities,VK_KHR_external_semaphore" author="FUCHSIA" contact="John Rosasco @rosasco" platform="fuchsia" supported="vulkan">
+ <require>
+ <enum value="1" name="VK_FUCHSIA_EXTERNAL_SEMAPHORE_SPEC_VERSION"/>
+ <enum value="&quot;VK_FUCHSIA_external_semaphore&quot;" name="VK_FUCHSIA_EXTERNAL_SEMAPHORE_EXTENSION_NAME"/>
+ <enum offset="0" extends="VkStructureType" name="VK_STRUCTURE_TYPE_IMPORT_SEMAPHORE_ZIRCON_HANDLE_INFO_FUCHSIA"/>
+ <enum offset="1" extends="VkStructureType" name="VK_STRUCTURE_TYPE_SEMAPHORE_GET_ZIRCON_HANDLE_INFO_FUCHSIA"/>
+ <enum bitpos="7" extends="VkExternalSemaphoreHandleTypeFlagBits" name="VK_EXTERNAL_SEMAPHORE_HANDLE_TYPE_ZIRCON_EVENT_BIT_FUCHSIA"/>
+ <type name="VkImportSemaphoreZirconHandleInfoFUCHSIA"/>
+ <type name="VkSemaphoreGetZirconHandleInfoFUCHSIA"/>
+ <command name="vkImportSemaphoreZirconHandleFUCHSIA"/>
+ <command name="vkGetSemaphoreZirconHandleFUCHSIA"/>
+ </require>
+ </extension>
+ <extension name="VK_FUCHSIA_buffer_collection" number="367" type="device" requires="VK_FUCHSIA_external_memory,VK_KHR_sampler_ycbcr_conversion" author="FUCHSIA" contact="John Rosasco @rosasco" supported="vulkan" platform="fuchsia">
+ <require>
+ <enum value="2" name="VK_FUCHSIA_BUFFER_COLLECTION_SPEC_VERSION"/>
+ <enum value="&quot;VK_FUCHSIA_buffer_collection&quot;" name="VK_FUCHSIA_BUFFER_COLLECTION_EXTENSION_NAME"/>
+ <enum offset="0" extends="VkStructureType" name="VK_STRUCTURE_TYPE_BUFFER_COLLECTION_CREATE_INFO_FUCHSIA"/>
+ <enum offset="0" extends="VkObjectType" name="VK_OBJECT_TYPE_BUFFER_COLLECTION_FUCHSIA" comment="VkBufferCollectionFUCHSIA"/>
+ <enum offset="0" extends="VkDebugReportObjectTypeEXT" name="VK_DEBUG_REPORT_OBJECT_TYPE_BUFFER_COLLECTION_FUCHSIA_EXT"/>
+ <enum offset="1" extends="VkStructureType" name="VK_STRUCTURE_TYPE_IMPORT_MEMORY_BUFFER_COLLECTION_FUCHSIA"/>
+ <enum offset="2" extends="VkStructureType" name="VK_STRUCTURE_TYPE_BUFFER_COLLECTION_IMAGE_CREATE_INFO_FUCHSIA"/>
+ <enum offset="3" extends="VkStructureType" name="VK_STRUCTURE_TYPE_BUFFER_COLLECTION_PROPERTIES_FUCHSIA"/>
+ <enum offset="4" extends="VkStructureType" name="VK_STRUCTURE_TYPE_BUFFER_CONSTRAINTS_INFO_FUCHSIA"/>
+ <enum offset="5" extends="VkStructureType" name="VK_STRUCTURE_TYPE_BUFFER_COLLECTION_BUFFER_CREATE_INFO_FUCHSIA"/>
+ <enum offset="6" extends="VkStructureType" name="VK_STRUCTURE_TYPE_IMAGE_CONSTRAINTS_INFO_FUCHSIA"/>
+ <enum offset="7" extends="VkStructureType" name="VK_STRUCTURE_TYPE_IMAGE_FORMAT_CONSTRAINTS_INFO_FUCHSIA"/>
+ <enum offset="8" extends="VkStructureType" name="VK_STRUCTURE_TYPE_SYSMEM_COLOR_SPACE_FUCHSIA"/>
+ <enum offset="9" extends="VkStructureType" name="VK_STRUCTURE_TYPE_BUFFER_COLLECTION_CONSTRAINTS_INFO_FUCHSIA"/>
+ <type name="VkBufferCollectionFUCHSIA"/>
+ <type name="VkBufferCollectionCreateInfoFUCHSIA"/>
+ <type name="VkImportMemoryBufferCollectionFUCHSIA"/>
+ <type name="VkBufferCollectionImageCreateInfoFUCHSIA"/>
+ <type name="VkBufferConstraintsInfoFUCHSIA"/>
+ <type name="VkBufferCollectionBufferCreateInfoFUCHSIA"/>
+ <type name="VkBufferCollectionPropertiesFUCHSIA"/>
+ <type name="VkImageFormatConstraintsFlagsFUCHSIA" comment="Will add VkImageFormatConstraintsFlagBitsFUCHSIA when bits are defined in the future"/>
+ <type name="VkSysmemColorSpaceFUCHSIA"/>
+ <type name="VkImageConstraintsInfoFlagBitsFUCHSIA"/>
+ <type name="VkImageConstraintsInfoFlagsFUCHSIA"/>
+ <type name="VkImageConstraintsInfoFUCHSIA"/>
+ <type name="VkImageFormatConstraintsInfoFUCHSIA"/>
+ <type name="VkBufferCollectionConstraintsInfoFUCHSIA"/>
+ <command name="vkCreateBufferCollectionFUCHSIA"/>
+ <command name="vkSetBufferCollectionImageConstraintsFUCHSIA"/>
+ <command name="vkSetBufferCollectionBufferConstraintsFUCHSIA"/>
+ <command name="vkDestroyBufferCollectionFUCHSIA"/>
+ <command name="vkGetBufferCollectionPropertiesFUCHSIA"/>
+ </require>
+ </extension>
+ <extension name="VK_FUCHSIA_extension_368" number="368" author="FUCHSIA" contact="Craig Stout @cdotstout" supported="disabled">
+ <require>
+ <enum value="0" name="VK_FUCHSIA_EXTENSION_368_SPEC_VERSION"/>
+ <enum value="&quot;VK_FUCHSIA_extension_368&quot;" name="VK_FUCHSIA_EXTENSION_368_EXTENSION_NAME"/>
+ </require>
+ </extension>
+ <extension name="VK_QCOM_extension_369" number="369" author="QCOM" contact="Matthew Netsch @mnetsch" supported="disabled">
+ <require>
+ <enum value="0" name="VK_QCOM_EXTENSION_369_SPEC_VERSION"/>
+ <enum value="&quot;VK_QCOM_extension_369&quot;" name="VK_QCOM_EXTENSION_369_EXTENSION_NAME"/>
+ <enum bitpos="4" extends="VkDescriptorBindingFlagBits" name="VK_DESCRIPTOR_BINDING_RESERVED_4_BIT_QCOM"/>
+ </require>
+ </extension>
+ <extension name="VK_HUAWEI_subpass_shading" number="370" type="device" author="HUAWEI" contact="Pan Gao @PanGao-h" requires="VK_KHR_create_renderpass2,VK_KHR_synchronization2" supported="vulkan">
+ <require>
+ <enum value="2" name="VK_HUAWEI_SUBPASS_SHADING_SPEC_VERSION"/>
+ <enum value="&quot;VK_HUAWEI_subpass_shading&quot;" name="VK_HUAWEI_SUBPASS_SHADING_EXTENSION_NAME"/>
+ <enum offset="0" extends="VkStructureType" name="VK_STRUCTURE_TYPE_SUBPASS_SHADING_PIPELINE_CREATE_INFO_HUAWEI"/>
+ <enum offset="1" extends="VkStructureType" name="VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_SUBPASS_SHADING_FEATURES_HUAWEI"/>
+ <enum offset="2" extends="VkStructureType" name="VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_SUBPASS_SHADING_PROPERTIES_HUAWEI"/>
+ <enum offset="3" extends="VkPipelineBindPoint" extnumber="370" name="VK_PIPELINE_BIND_POINT_SUBPASS_SHADING_HUAWEI"/>
+ <enum bitpos="39" extends="VkPipelineStageFlagBits2" name="VK_PIPELINE_STAGE_2_SUBPASS_SHADING_BIT_HUAWEI"/>
+ <enum bitpos="14" extends="VkShaderStageFlagBits" name="VK_SHADER_STAGE_SUBPASS_SHADING_BIT_HUAWEI"/>
+ <type name="VkSubpassShadingPipelineCreateInfoHUAWEI"/>
+ <type name="VkPhysicalDeviceSubpassShadingFeaturesHUAWEI"/>
+ <type name="VkPhysicalDeviceSubpassShadingPropertiesHUAWEI"/>
+ <command name="vkGetDeviceSubpassShadingMaxWorkgroupSizeHUAWEI"/>
+ <command name="vkCmdSubpassShadingHUAWEI"/>
+ </require>
+ </extension>
+ <extension name="VK_HUAWEI_invocation_mask" number="371" type="device" requires="VK_KHR_ray_tracing_pipeline,VK_KHR_synchronization2" author="Huawei" contact="Pan Gao @PanGao-h" supported="vulkan">
+ <require>
+ <enum value="1" name="VK_HUAWEI_INVOCATION_MASK_SPEC_VERSION"/>
+ <enum value="&quot;VK_HUAWEI_invocation_mask&quot;" name="VK_HUAWEI_INVOCATION_MASK_EXTENSION_NAME"/>
+ <enum offset="0" extends="VkStructureType" name="VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_INVOCATION_MASK_FEATURES_HUAWEI"/>
+ <enum bitpos="39" extends="VkAccessFlagBits2" name="VK_ACCESS_2_INVOCATION_MASK_READ_BIT_HUAWEI"/>
+ <enum bitpos="18" extends="VkImageUsageFlagBits" name="VK_IMAGE_USAGE_INVOCATION_MASK_BIT_HUAWEI"/>
+ <enum bitpos="40" extends="VkPipelineStageFlagBits2" name="VK_PIPELINE_STAGE_2_INVOCATION_MASK_BIT_HUAWEI"/>
+ <type name="VkPhysicalDeviceInvocationMaskFeaturesHUAWEI"/>
+ <command name="vkCmdBindInvocationMaskHUAWEI"/>
+ </require>
+ </extension>
+ <extension name="VK_NV_external_memory_rdma" number="372" type="device" requires="VK_KHR_external_memory" author="NV" contact="Carsten Rohde @crohde" supported="vulkan">
+ <require>
+ <enum value="1" name="VK_NV_EXTERNAL_MEMORY_RDMA_SPEC_VERSION"/>
+ <enum value="&quot;VK_NV_external_memory_rdma&quot;" name="VK_NV_EXTERNAL_MEMORY_RDMA_EXTENSION_NAME"/>
+ <enum offset="0" extends="VkStructureType" name="VK_STRUCTURE_TYPE_MEMORY_GET_REMOTE_ADDRESS_INFO_NV"/>
+ <enum offset="1" extends="VkStructureType" name="VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_EXTERNAL_MEMORY_RDMA_FEATURES_NV"/>
+ <enum bitpos="8" extends="VkMemoryPropertyFlagBits" name="VK_MEMORY_PROPERTY_RDMA_CAPABLE_BIT_NV"/>
+ <enum bitpos="12" extends="VkExternalMemoryHandleTypeFlagBits" name="VK_EXTERNAL_MEMORY_HANDLE_TYPE_RDMA_ADDRESS_BIT_NV"/>
+ <type name="VkRemoteAddressNV"/>
+ <type name="VkMemoryGetRemoteAddressInfoNV"/>
+ <type name="VkPhysicalDeviceExternalMemoryRDMAFeaturesNV"/>
+ <command name="vkGetMemoryRemoteAddressNV"/>
+ </require>
+ </extension>
+ <extension name="VK_EXT_pipeline_properties" number="373" type="device" requires="VK_KHR_get_physical_device_properties2" author="EXT" contact="Mukund Keshava @mkeshavanv" supported="vulkan">
+ <require>
+ <enum value="1" name="VK_EXT_PIPELINE_PROPERTIES_SPEC_VERSION"/>
+ <enum value="&quot;VK_EXT_pipeline_properties&quot;" name="VK_EXT_PIPELINE_PROPERTIES_EXTENSION_NAME"/>
+ <enum offset="0" extends="VkStructureType" name="VK_STRUCTURE_TYPE_PIPELINE_PROPERTIES_IDENTIFIER_EXT"/>
+ <enum offset="1" extends="VkStructureType" name="VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_PIPELINE_PROPERTIES_FEATURES_EXT"/>
+ <enum extends="VkStructureType" name="VK_STRUCTURE_TYPE_PIPELINE_INFO_EXT" alias="VK_STRUCTURE_TYPE_PIPELINE_INFO_KHR"/>
+ <type name="VkPipelineInfoEXT"/>
+ <type name="VkPipelinePropertiesIdentifierEXT"/>
+ <type name="VkPhysicalDevicePipelinePropertiesFeaturesEXT"/>
+ <command name="vkGetPipelinePropertiesEXT"/>
+ </require>
+ </extension>
+ <extension name="VK_NV_extension_374" number="374" author="NV" contact="Daniel Koch @dgkoch" supported="disabled">
+ <require>
+ <enum value="0" name="VK_NV_EXTENSION_374_SPEC_VERSION"/>
+ <enum value="&quot;VK_NV_extension_374&quot;" name="VK_NV_EXTENSION_374_EXTENSION_NAME"/>
+ <enum bitpos="4" extends="VkExternalFenceHandleTypeFlagBits" name="VK_EXTERNAL_FENCE_HANDLE_TYPE_RESERVED_4_BIT_NV"/>
+ <enum bitpos="5" extends="VkExternalFenceHandleTypeFlagBits" name="VK_EXTERNAL_FENCE_HANDLE_TYPE_RESERVED_5_BIT_NV"/>
+ <enum bitpos="5" extends="VkExternalSemaphoreHandleTypeFlagBits" name="VK_EXTERNAL_SEMAPHORE_HANDLE_TYPE_RESERVED_5_BIT_NV"/>
+ </require>
+ </extension>
+ <extension name="VK_NV_extension_375" number="375" author="NV" contact="Daniel Koch @dgkoch" supported="disabled">
+ <require>
+ <enum value="0" name="VK_NV_EXTENSION_375_SPEC_VERSION"/>
+ <enum value="&quot;VK_NV_extension_375&quot;" name="VK_NV_EXTENSION_375_EXTENSION_NAME"/>
+ <enum bitpos="13" extends="VkExternalMemoryHandleTypeFlagBits" name="VK_EXTERNAL_MEMORY_HANDLE_TYPE_RESERVED_13_BIT_NV"/>
+ </require>
+ </extension>
+ <extension name="VK_EXT_extension_376" number="376" author="EXT" contact="Melih Yasin Yalcin @yalcinmelihyasin" supported="disabled">
+ <require>
+ <enum value="0" name="VK_EXT_EXTENSION_376_SPEC_VERSION"/>
+ <enum value="&quot;VK_EXT_extension_376&quot;" name="VK_EXT_EXTENSION_376_EXTENSION_NAME"/>
+ </require>
+ </extension>
+ <extension name="VK_EXT_multisampled_render_to_single_sampled" number="377" type="device" requires="VK_KHR_create_renderpass2,VK_KHR_depth_stencil_resolve" author="EXT" contact="Shahbaz Youssefi @syoussefi" supported="vulkan">
+ <require>
+ <enum value="1" name="VK_EXT_MULTISAMPLED_RENDER_TO_SINGLE_SAMPLED_SPEC_VERSION"/>
+ <enum value="&quot;VK_EXT_multisampled_render_to_single_sampled&quot;" name="VK_EXT_MULTISAMPLED_RENDER_TO_SINGLE_SAMPLED_EXTENSION_NAME"/>
+ <enum offset="0" extends="VkStructureType" name="VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_MULTISAMPLED_RENDER_TO_SINGLE_SAMPLED_FEATURES_EXT"/>
+ <enum offset="1" extends="VkStructureType" name="VK_STRUCTURE_TYPE_SUBPASS_RESOLVE_PERFORMANCE_QUERY_EXT"/>
+ <enum offset="2" extends="VkStructureType" name="VK_STRUCTURE_TYPE_MULTISAMPLED_RENDER_TO_SINGLE_SAMPLED_INFO_EXT"/>
+ <enum bitpos="18" extends="VkImageCreateFlagBits" name="VK_IMAGE_CREATE_MULTISAMPLED_RENDER_TO_SINGLE_SAMPLED_BIT_EXT"/>
+ <type name="VkPhysicalDeviceMultisampledRenderToSingleSampledFeaturesEXT"/>
+ <type name="VkSubpassResolvePerformanceQueryEXT"/>
+ <type name="VkMultisampledRenderToSingleSampledInfoEXT"/>
+ </require>
+ </extension>
+ <extension name="VK_EXT_extended_dynamic_state2" number="378" type="device" requires="VK_KHR_get_physical_device_properties2" author="EXT" contact="Vikram Kushwaha @vkushwaha-nv" supported="vulkan" promotedto="VK_VERSION_1_3">
+ <require>
+ <enum value="1" name="VK_EXT_EXTENDED_DYNAMIC_STATE_2_SPEC_VERSION"/>
+ <enum value="&quot;VK_EXT_extended_dynamic_state2&quot;" name="VK_EXT_EXTENDED_DYNAMIC_STATE_2_EXTENSION_NAME"/>
+ <enum offset="0" extends="VkStructureType" name="VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_EXTENDED_DYNAMIC_STATE_2_FEATURES_EXT" comment="Not promoted to 1.3"/>
+ <enum offset="0" extends="VkDynamicState" name="VK_DYNAMIC_STATE_PATCH_CONTROL_POINTS_EXT" comment="Not promoted to 1.3"/>
+ <enum extends="VkDynamicState" name="VK_DYNAMIC_STATE_RASTERIZER_DISCARD_ENABLE_EXT" alias="VK_DYNAMIC_STATE_RASTERIZER_DISCARD_ENABLE"/>
+ <enum extends="VkDynamicState" name="VK_DYNAMIC_STATE_DEPTH_BIAS_ENABLE_EXT" alias="VK_DYNAMIC_STATE_DEPTH_BIAS_ENABLE"/>
+ <enum offset="3" extends="VkDynamicState" name="VK_DYNAMIC_STATE_LOGIC_OP_EXT" comment="Not promoted to 1.3"/>
+ <enum extends="VkDynamicState" name="VK_DYNAMIC_STATE_PRIMITIVE_RESTART_ENABLE_EXT" alias="VK_DYNAMIC_STATE_PRIMITIVE_RESTART_ENABLE"/>
+ <type name="VkPhysicalDeviceExtendedDynamicState2FeaturesEXT" comment="Not promoted to 1.3"/>
+ <command name="vkCmdSetPatchControlPointsEXT" comment="Not promoted to 1.3"/>
+ <command name="vkCmdSetRasterizerDiscardEnableEXT"/>
+ <command name="vkCmdSetDepthBiasEnableEXT"/>
+ <command name="vkCmdSetLogicOpEXT" comment="Not promoted to 1.3"/>
+ <command name="vkCmdSetPrimitiveRestartEnableEXT"/>
+ </require>
+ </extension>
+ <extension name="VK_QNX_screen_surface" number="379" type="instance" requires="VK_KHR_surface" platform="screen" author="QNX" contact="Mike Gorchak @mgorchak-blackberry" supported="vulkan">
+ <require>
+ <enum value="1" name="VK_QNX_SCREEN_SURFACE_SPEC_VERSION"/>
+ <enum value="&quot;VK_QNX_screen_surface&quot;" name="VK_QNX_SCREEN_SURFACE_EXTENSION_NAME"/>
+ <enum offset="0" extends="VkStructureType" name="VK_STRUCTURE_TYPE_SCREEN_SURFACE_CREATE_INFO_QNX"/>
+ <type name="VkScreenSurfaceCreateFlagsQNX"/>
+ <type name="VkScreenSurfaceCreateInfoQNX"/>
+ <command name="vkCreateScreenSurfaceQNX"/>
+ <command name="vkGetPhysicalDeviceScreenPresentationSupportQNX"/>
+ </require>
+ </extension>
+ <extension name="VK_KHR_extension_380" number="380" author="KHR" contact="James Jones @cubanismo" supported="disabled">
+ <require>
+ <enum value="0" name="VK_KHR_EXTENSION_380_SPEC_VERSION"/>
+ <enum value="&quot;VK_KHR_extension_380&quot;" name="VK_KHR_EXTENSION_380_EXTENSION_NAME"/>
+ </require>
+ </extension>
+ <extension name="VK_KHR_extension_381" number="381" author="KHR" contact="James Jones @cubanismo" supported="disabled">
+ <require>
+ <enum value="0" name="VK_KHR_EXTENSION_381_SPEC_VERSION"/>
+ <enum value="&quot;VK_KHR_extension_381&quot;" name="VK_KHR_EXTENSION_381_EXTENSION_NAME"/>
+ </require>
+ </extension>
+ <extension name="VK_EXT_color_write_enable" number="382" type="device" requires="VK_KHR_get_physical_device_properties2" author="EXT" contact="Sharif Elcott @selcott" supported="vulkan">
+ <require>
+ <enum value="1" name="VK_EXT_COLOR_WRITE_ENABLE_SPEC_VERSION"/>
+ <enum value="&quot;VK_EXT_color_write_enable&quot;" name="VK_EXT_COLOR_WRITE_ENABLE_EXTENSION_NAME"/>
+ <enum offset="0" extends="VkStructureType" name="VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_COLOR_WRITE_ENABLE_FEATURES_EXT"/>
+ <enum offset="1" extends="VkStructureType" name="VK_STRUCTURE_TYPE_PIPELINE_COLOR_WRITE_CREATE_INFO_EXT"/>
+ <enum offset="0" extends="VkDynamicState" name="VK_DYNAMIC_STATE_COLOR_WRITE_ENABLE_EXT"/>
+ <type name="VkPhysicalDeviceColorWriteEnableFeaturesEXT"/>
+ <type name="VkPipelineColorWriteCreateInfoEXT"/>
+ <command name="vkCmdSetColorWriteEnableEXT"/>
+ </require>
+ </extension>
+ <extension name="VK_EXT_primitives_generated_query" number="383" type="device" requires="VK_EXT_transform_feedback" author="EXT" contact="Shahbaz Youssefi @syoussefi" supported="vulkan" specialuse="glemulation">
+ <require>
+ <enum value="1" name="VK_EXT_PRIMITIVES_GENERATED_QUERY_SPEC_VERSION"/>
+ <enum value="&quot;VK_EXT_primitives_generated_query&quot;" name="VK_EXT_PRIMITIVES_GENERATED_QUERY_EXTENSION_NAME"/>
+ <enum offset="0" extends="VkStructureType" name="VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_PRIMITIVES_GENERATED_QUERY_FEATURES_EXT"/>
+ <enum offset="0" extends="VkQueryType" name="VK_QUERY_TYPE_PRIMITIVES_GENERATED_EXT"/>
+ <type name="VkPhysicalDevicePrimitivesGeneratedQueryFeaturesEXT"/>
+ </require>
+ </extension>
+ <extension name="VK_EXT_extension_384" number="384" type="instance" author="EXT" contact="Chia-I Wu @olvaffe1" supported="disabled">
+ <require>
+ <enum value="0" name="VK_EXT_EXTENSION_384_SPEC_VERSION"/>
+ <enum value="&quot;VK_EXT_extension_384&quot;" name="VK_EXT_EXTENSION_384_EXTENSION_NAME"/>
+ </require>
+ </extension>
+ <extension name="VK_MESA_extension_385" number="385" type="instance" author="MESA" contact="Chia-I Wu @olvaffe1" supported="disabled">
+ <require>
+ <enum value="0" name="VK_MESA_EXTENSION_385_SPEC_VERSION"/>
+ <enum value="&quot;VK_MESA_extension_385&quot;" name="VK_MESA_EXTENSION_385_EXTENSION_NAME"/>
+ </require>
+ </extension>
+ <extension name="VK_GOOGLE_extension_386" number="386" author="GOOGLE" contact="Chia-I Wu @olvaffe1" supported="disabled">
+ <require>
+ <enum value="0" name="VK_GOOGLE_EXTENSION_386_SPEC_VERSION"/>
+ <enum value="&quot;VK_GOOGLE_extension_386&quot;" name="VK_GOOGLE_EXTENSION_386_EXTENSION_NAME"/>
+ </require>
+ </extension>
+ <extension name="VK_KHR_ray_tracing_maintenance1" number="387" type="device" requiresCore="1.1" requires="VK_KHR_acceleration_structure" author="KHR" contact="Daniel Koch @dgkoch" supported="vulkan">
+ <require>
+ <enum value="1" name="VK_KHR_RAY_TRACING_MAINTENANCE_1_SPEC_VERSION"/>
+ <enum value="&quot;VK_KHR_ray_tracing_maintenance1&quot;" name="VK_KHR_RAY_TRACING_MAINTENANCE_1_EXTENSION_NAME"/>
+ <enum offset="0" extends="VkStructureType" name="VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_RAY_TRACING_MAINTENANCE_1_FEATURES_KHR"/>
+ <enum offset="0" extends="VkQueryType" name="VK_QUERY_TYPE_ACCELERATION_STRUCTURE_SERIALIZATION_BOTTOM_LEVEL_POINTERS_KHR"/>
+ <enum offset="1" extends="VkQueryType" name="VK_QUERY_TYPE_ACCELERATION_STRUCTURE_SIZE_KHR"/>
+ <type name="VkPhysicalDeviceRayTracingMaintenance1FeaturesKHR"/>
+ </require>
+ <require extension="VK_KHR_synchronization2">
+ <!-- VkPipelineStageFlagBits bitpos="28" is reserved by this extension, but not used -->
+ <enum bitpos="28" extends="VkPipelineStageFlagBits2" name="VK_PIPELINE_STAGE_2_ACCELERATION_STRUCTURE_COPY_BIT_KHR"/>
+ </require>
+ <require extension="VK_KHR_synchronization2,VK_KHR_ray_tracing_pipeline">
+ <enum bitpos="40" extends="VkAccessFlagBits2" name="VK_ACCESS_2_SHADER_BINDING_TABLE_READ_BIT_KHR"/>
+ </require>
+ <require extension="VK_KHR_ray_tracing_pipeline">
+ <type name="VkTraceRaysIndirectCommand2KHR"/>
+ <command name="vkCmdTraceRaysIndirect2KHR"/>
+ </require>
+ </extension>
+ <extension name="VK_EXT_extension_388" number="388" author="EXT" contact="Alan Baker @alan-baker" supported="disabled">
+ <require>
+ <enum value="0" name="VK_EXT_EXTENSION_388_SPEC_VERSION"/>
+ <enum value="&quot;VK_EXT_extension_388&quot;" name="VK_EXT_EXTENSION_388_EXTENSION_NAME"/>
+ </require>
+ </extension>
+ <extension name="VK_EXT_global_priority_query" number="389" type="device" requires="VK_EXT_global_priority,VK_KHR_get_physical_device_properties2" author="EXT" contact="Yiwei Zhang @zhangyiwei" supported="vulkan" promotedto="VK_KHR_global_priority">
+ <require>
+ <enum value="1" name="VK_EXT_GLOBAL_PRIORITY_QUERY_SPEC_VERSION"/>
+ <enum value="&quot;VK_EXT_global_priority_query&quot;" name="VK_EXT_GLOBAL_PRIORITY_QUERY_EXTENSION_NAME"/>
+ <enum extends="VkStructureType" alias="VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_GLOBAL_PRIORITY_QUERY_FEATURES_KHR" name="VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_GLOBAL_PRIORITY_QUERY_FEATURES_EXT"/>
+ <enum extends="VkStructureType" alias="VK_STRUCTURE_TYPE_QUEUE_FAMILY_GLOBAL_PRIORITY_PROPERTIES_KHR" name="VK_STRUCTURE_TYPE_QUEUE_FAMILY_GLOBAL_PRIORITY_PROPERTIES_EXT"/>
+ <enum name="VK_MAX_GLOBAL_PRIORITY_SIZE_EXT"/>
+ <type name="VkPhysicalDeviceGlobalPriorityQueryFeaturesEXT"/>
+ <type name="VkQueueFamilyGlobalPriorityPropertiesEXT"/>
+ </require>
+ </extension>
+ <extension name="VK_EXT_extension_390" number="390" author="EXT" contact="Joshua Ashton @Joshua-Ashton" supported="disabled">
+ <require>
+ <enum value="0" name="VK_EXT_EXTENSION_390_SPEC_VERSION"/>
+ <enum value="&quot;VK_EXT_extension_390&quot;" name="VK_EXT_EXTENSION_390_EXTENSION_NAME"/>
+ </require>
+ </extension>
+ <extension name="VK_EXT_extension_391" number="391" author="EXT" contact="Joshua Ashton @Joshua-Ashton" supported="disabled">
+ <require>
+ <enum value="0" name="VK_EXT_EXTENSION_391_SPEC_VERSION"/>
+ <enum value="&quot;VK_EXT_extension_391&quot;" name="VK_EXT_EXTENSION_391_EXTENSION_NAME"/>
+ </require>
+ </extension>
+ <extension name="VK_EXT_image_view_min_lod" number="392" type="device" requires="VK_KHR_get_physical_device_properties2" author="EXT" contact="Joshua Ashton @Joshua-Ashton" supported="vulkan">
+ <require>
+ <enum value="1" name="VK_EXT_IMAGE_VIEW_MIN_LOD_SPEC_VERSION"/>
+ <enum value="&quot;VK_EXT_image_view_min_lod&quot;" name="VK_EXT_IMAGE_VIEW_MIN_LOD_EXTENSION_NAME"/>
+ <enum offset="0" extends="VkStructureType" name="VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_IMAGE_VIEW_MIN_LOD_FEATURES_EXT"/>
+ <enum offset="1" extends="VkStructureType" name="VK_STRUCTURE_TYPE_IMAGE_VIEW_MIN_LOD_CREATE_INFO_EXT"/>
+ <type name="VkPhysicalDeviceImageViewMinLodFeaturesEXT"/>
+ <type name="VkImageViewMinLodCreateInfoEXT"/>
+ </require>
+ </extension>
+ <extension name="VK_EXT_multi_draw" number="393" author="EXT" contact="Mike Blumenkrantz @zmike" type="device" supported="vulkan">
+ <require>
+ <enum value="1" name="VK_EXT_MULTI_DRAW_SPEC_VERSION"/>
+ <enum value="&quot;VK_EXT_multi_draw&quot;" name="VK_EXT_MULTI_DRAW_EXTENSION_NAME"/>
+ <enum offset="0" extends="VkStructureType" name="VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_MULTI_DRAW_FEATURES_EXT"/>
+ <enum offset="1" extends="VkStructureType" name="VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_MULTI_DRAW_PROPERTIES_EXT"/>
+ <type name="VkPhysicalDeviceMultiDrawFeaturesEXT"/>
+ <type name="VkPhysicalDeviceMultiDrawPropertiesEXT"/>
+ <command name="vkCmdDrawMultiEXT"/>
+ <command name="vkCmdDrawMultiIndexedEXT"/>
+ <type name="VkMultiDrawInfoEXT"/>
+ <type name="VkMultiDrawIndexedInfoEXT"/>
+ </require>
+ </extension>
+ <extension name="VK_EXT_image_2d_view_of_3d" number="394" requires="VK_KHR_maintenance1,VK_KHR_get_physical_device_properties2" author="EXT" contact="Mike Blumenkrantz @zmike" specialuse="glemulation" type="device" supported="vulkan">
+ <require>
+ <enum value="1" name="VK_EXT_IMAGE_2D_VIEW_OF_3D_SPEC_VERSION"/>
+ <enum value="&quot;VK_EXT_image_2d_view_of_3d&quot;" name="VK_EXT_IMAGE_2D_VIEW_OF_3D_EXTENSION_NAME"/>
+ <enum offset="0" extends="VkStructureType" name="VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_IMAGE_2D_VIEW_OF_3D_FEATURES_EXT"/>
+ <type name="VkPhysicalDeviceImage2DViewOf3DFeaturesEXT"/>
+ <enum extends="VkImageCreateFlagBits" bitpos="17" name="VK_IMAGE_CREATE_2D_VIEW_COMPATIBLE_BIT_EXT" comment="Image is created with a layout where individual slices are capable of being used as 2D images"/>
+ </require>
+ </extension>
+ <extension name="VK_KHR_portability_enumeration" number="395" author="KHR" contact="Charles Giessen @charles-lunarg" type="instance" supported="vulkan">
+ <require>
+ <enum value="1" name="VK_KHR_PORTABILITY_ENUMERATION_SPEC_VERSION"/>
+ <enum value="&quot;VK_KHR_portability_enumeration&quot;" name="VK_KHR_PORTABILITY_ENUMERATION_EXTENSION_NAME"/>
+ <enum bitpos="0" extends="VkInstanceCreateFlagBits" name="VK_INSTANCE_CREATE_ENUMERATE_PORTABILITY_BIT_KHR"/>
+ </require>
+ </extension>
+ <extension name="VK_KHR_extension_396" number="396" author="EXT" contact="Jan-Harald Fredriksen @janharaldfredriksen-arm" supported="disabled">
+ <require>
+ <enum value="0" name="VK_KHR_EXTENSION_396_SPEC_VERSION"/>
+ <enum value="&quot;VK_KHR_extension_396&quot;" name="VK_KHR_EXTENSION_396_EXTENSION_NAME"/>
+ </require>
+ </extension>
+ <extension name="VK_NV_extension_397" number="397" author="NV" contact="Christoph Kubisch @pixeljetstream" supported="disabled">
+ <require>
+ <enum value="0" name="VK_NV_EXTENSION_397_SPEC_VERSION"/>
+ <enum value="&quot;VK_NV_extension_397&quot;" name="VK_NV_EXTENSION_397_EXTENSION_NAME"/>
+ <enum bitpos="30" extends="VkPipelineStageFlagBits2" name="VK_PIPELINE_STAGE_2_RESERVED_30_BIT_NV"/>
+ <enum bitpos="44" extends="VkAccessFlagBits2" name="VK_ACCESS_2_RESERVED_44_BIT_NV"/>
+ <enum bitpos="45" extends="VkAccessFlagBits2" name="VK_ACCESS_2_RESERVED_45_BIT_NV"/>
+ <enum bitpos="23" extends="VkBufferUsageFlagBits" name="VK_BUFFER_USAGE_RESERVED_23_BIT_NV"/>
+ <enum bitpos="24" extends="VkBufferUsageFlagBits" name="VK_BUFFER_USAGE_RESERVED_24_BIT_NV"/>
+ <enum bitpos="24" extends="VkPipelineCreateFlagBits" name="VK_PIPELINE_CREATE_RESERVED_24_BIT_NV"/>
+ <enum bitpos="4" extends="VkGeometryInstanceFlagBitsKHR" name="VK_GEOMETRY_INSTANCE_RESERVED_4_BIT_NV"/>
+ <enum bitpos="5" extends="VkGeometryInstanceFlagBitsKHR" name="VK_GEOMETRY_INSTANCE_RESERVED_5_BIT_NV"/>
+ <enum bitpos="6" extends="VkBuildAccelerationStructureFlagBitsKHR" name="VK_BUILD_ACCELERATION_STRUCTURE_RESERVED_6_BIT_NV"/>
+ <enum bitpos="7" extends="VkBuildAccelerationStructureFlagBitsKHR" name="VK_BUILD_ACCELERATION_STRUCTURE_RESERVED_7_BIT_NV"/>
+ </require>
+ </extension>
+ <extension name="VK_NV_extension_398" number="398" author="NV" contact="Christoph Kubisch @pixeljetstream" supported="disabled">
+ <require>
+ <enum value="0" name="VK_NV_EXTENSION_398_SPEC_VERSION"/>
+ <enum value="&quot;VK_NV_extension_398&quot;" name="VK_NV_EXTENSION_398_EXTENSION_NAME"/>
+ </require>
+ </extension>
+ <extension name="VK_JUICE_extension_399" number="399" author="JUICE" contact="Dean Beeler @canadacow" supported="disabled">
+ <require>
+ <enum value="0" name="VK_JUICE_EXTENSION_399_SPEC_VERSION"/>
+ <enum value="&quot;VK_JUICE_extension_399&quot;" name="VK_JUICE_EXTENSION_399_EXTENSION_NAME"/>
+ </require>
+ </extension>
+ <extension name="VK_JUICE_extension_400" number="400" author="JUICE" contact="David McCloskey @damcclos" supported="disabled">
+ <require>
+ <enum value="0" name="VK_JUICE_EXTENSION_400_SPEC_VERSION"/>
+ <enum value="&quot;VK_JUICE_extension_400&quot;" name="VK_JUICE_EXTENSION_400_EXTENSION_NAME"/>
+ </require>
+ </extension>
+ <extension name="VK_EXT_load_store_op_none" number="401" author="EXT" type="device" contact="Shahbaz Youssefi @syoussefi" supported="vulkan">
+ <require>
+ <enum value="1" name="VK_EXT_LOAD_STORE_OP_NONE_SPEC_VERSION"/>
+ <enum value="&quot;VK_EXT_load_store_op_none&quot;" name="VK_EXT_LOAD_STORE_OP_NONE_EXTENSION_NAME"/>
+ <enum offset="0" extends="VkAttachmentLoadOp" name="VK_ATTACHMENT_LOAD_OP_NONE_EXT"/>
+ <enum extends="VkAttachmentStoreOp" name="VK_ATTACHMENT_STORE_OP_NONE_EXT" alias="VK_ATTACHMENT_STORE_OP_NONE"/>
+ </require>
+ </extension>
+ <extension name="VK_FB_extension_402" number="402" author="FB" contact="Artem Bolgar @artyom17" supported="disabled">
+ <require>
+ <enum value="0" name="VK_FB_EXTENSION_402_SPEC_VERSION"/>
+ <enum value="&quot;VK_FB_extension_402&quot;" name="VK_FB_EXTENSION_402_EXTENSION_NAME"/>
+ </require>
+ </extension>
+ <extension name="VK_FB_extension_403" number="403" author="FB" contact="Artem Bolgar @artyom17" supported="disabled">
+ <require>
+ <enum value="0" name="VK_FB_EXTENSION_403_SPEC_VERSION"/>
+ <enum value="&quot;VK_FB_extension_403&quot;" name="VK_FB_EXTENSION_403_EXTENSION_NAME"/>
+ </require>
+ </extension>
+ <extension name="VK_FB_extension_404" number="404" author="FB" contact="Artem Bolgar @artyom17" supported="disabled">
+ <require>
+ <enum value="0" name="VK_FB_EXTENSION_404_SPEC_VERSION"/>
+ <enum value="&quot;VK_FB_extension_404&quot;" name="VK_FB_EXTENSION_404_EXTENSION_NAME"/>
+ </require>
+ </extension>
+ <extension name="VK_HUAWEI_extension_405" number="405" author="HUAWEI" contact="Hueilong Wang @wyvernathuawei" supported="disabled">
+ <require>
+ <enum value="0" name="VK_HUAWEI_EXTENSION_405_SPEC_VERSION"/>
+ <enum value="&quot;VK_HUAWEI_extension_405&quot;" name="VK_HUAWEI_EXTENSION_405_EXTENSION_NAME"/>
+ </require>
+ </extension>
+ <extension name="VK_HUAWEI_extension_406" number="406" author="HUAWEI" contact="Hueilong Wang @wyvernathuawei" supported="disabled">
+ <require>
+ <enum value="0" name="VK_HUAWEI_EXTENSION_406_SPEC_VERSION"/>
+ <enum value="&quot;VK_HUAWEI_extension_406&quot;" name="VK_HUAWEI_EXTENSION_406_EXTENSION_NAME"/>
+ </require>
+ </extension>
+ <extension name="VK_GGP_extension_407" number="407" author="GGP" contact="J.D. Rouan @jdrouan" supported="disabled">
+ <require>
+ <enum value="0" name="VK_GGP_EXTENSION_407_SPEC_VERSION"/>
+ <enum value="&quot;VK_GGP_extension_407&quot;" name="VK_GGP_EXTENSION_407_EXTENSION_NAME"/>
+ </require>
+ </extension>
+ <extension name="VK_GGP_extension_408" number="408" author="GGP" contact="J.D. Rouan @jdrouan" supported="disabled">
+ <require>
+ <enum value="0" name="VK_GGP_EXTENSION_408_SPEC_VERSION"/>
+ <enum value="&quot;VK_GGP_extension_408&quot;" name="VK_GGP_EXTENSION_408_EXTENSION_NAME"/>
+ </require>
+ </extension>
+ <extension name="VK_GGP_extension_409" number="409" author="GGP" contact="J.D. Rouan @jdrouan" supported="disabled">
+ <require>
+ <enum value="0" name="VK_GGP_EXTENSION_409_SPEC_VERSION"/>
+ <enum value="&quot;VK_GGP_extension_409&quot;" name="VK_GGP_EXTENSION_409_EXTENSION_NAME"/>
+ </require>
+ </extension>
+ <extension name="VK_GGP_extension_410" number="410" author="GGP" contact="J.D. Rouan @jdrouan" supported="disabled">
+ <require>
+ <enum value="0" name="VK_GGP_EXTENSION_410_SPEC_VERSION"/>
+ <enum value="&quot;VK_GGP_extension_410&quot;" name="VK_GGP_EXTENSION_410_EXTENSION_NAME"/>
+ </require>
+ </extension>
+ <extension name="VK_GGP_extension_411" number="411" author="GGP" contact="J.D. Rouan @jdrouan" supported="disabled">
+ <require>
+ <enum value="0" name="VK_GGP_EXTENSION_411_SPEC_VERSION"/>
+ <enum value="&quot;VK_GGP_extension_411&quot;" name="VK_GGP_EXTENSION_411_EXTENSION_NAME"/>
+ </require>
+ </extension>
+ <extension name="VK_EXT_border_color_swizzle" number="412" type="device" author="EXT" contact="Piers Daniell @pdaniell-nv" supported="vulkan" requires="VK_EXT_custom_border_color" specialuse="glemulation,d3demulation">
+ <require>
+ <enum value="1" name="VK_EXT_BORDER_COLOR_SWIZZLE_SPEC_VERSION"/>
+ <enum value="&quot;VK_EXT_border_color_swizzle&quot;" name="VK_EXT_BORDER_COLOR_SWIZZLE_EXTENSION_NAME"/>
+ <enum offset="0" extends="VkStructureType" name="VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_BORDER_COLOR_SWIZZLE_FEATURES_EXT"/>
+ <enum offset="1" extends="VkStructureType" name="VK_STRUCTURE_TYPE_SAMPLER_BORDER_COLOR_COMPONENT_MAPPING_CREATE_INFO_EXT"/>
+ <type name="VkPhysicalDeviceBorderColorSwizzleFeaturesEXT"/>
+ <type name="VkSamplerBorderColorComponentMappingCreateInfoEXT"/>
+ </require>
+ </extension>
+ <extension name="VK_EXT_pageable_device_local_memory" number="413" author="EXT" contact="Piers Daniell @pdaniell-nv" type="device" requires="VK_EXT_memory_priority" supported="vulkan">
+ <require>
+ <enum value="1" name="VK_EXT_PAGEABLE_DEVICE_LOCAL_MEMORY_SPEC_VERSION"/>
+ <enum value="&quot;VK_EXT_pageable_device_local_memory&quot;" name="VK_EXT_PAGEABLE_DEVICE_LOCAL_MEMORY_EXTENSION_NAME"/>
+ <enum offset="0" extends="VkStructureType" name="VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_PAGEABLE_DEVICE_LOCAL_MEMORY_FEATURES_EXT"/>
+ <type name="VkPhysicalDevicePageableDeviceLocalMemoryFeaturesEXT"/>
+ <command name="vkSetDeviceMemoryPriorityEXT"/>
+ </require>
+ </extension>
+ <extension name="VK_KHR_maintenance4" number="414" type="device" requiresCore="1.1" author="KHR" contact="Piers Daniell @pdaniell-nv" supported="vulkan" promotedto="VK_VERSION_1_3">
+ <require>
+ <enum value="2" name="VK_KHR_MAINTENANCE_4_SPEC_VERSION"/>
+ <enum value="&quot;VK_KHR_maintenance4&quot;" name="VK_KHR_MAINTENANCE_4_EXTENSION_NAME"/>
+ <enum extends="VkStructureType" name="VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_MAINTENANCE_4_FEATURES_KHR" alias="VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_MAINTENANCE_4_FEATURES"/>
+ <enum extends="VkStructureType" name="VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_MAINTENANCE_4_PROPERTIES_KHR" alias="VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_MAINTENANCE_4_PROPERTIES"/>
+ <enum extends="VkStructureType" name="VK_STRUCTURE_TYPE_DEVICE_BUFFER_MEMORY_REQUIREMENTS_KHR" alias="VK_STRUCTURE_TYPE_DEVICE_BUFFER_MEMORY_REQUIREMENTS"/>
+ <enum extends="VkStructureType" name="VK_STRUCTURE_TYPE_DEVICE_IMAGE_MEMORY_REQUIREMENTS_KHR" alias="VK_STRUCTURE_TYPE_DEVICE_IMAGE_MEMORY_REQUIREMENTS"/>
+ <enum extends="VkImageAspectFlagBits" name="VK_IMAGE_ASPECT_NONE_KHR" alias="VK_IMAGE_ASPECT_NONE"/>
+ <type name="VkPhysicalDeviceMaintenance4FeaturesKHR"/>
+ <type name="VkPhysicalDeviceMaintenance4PropertiesKHR"/>
+ <type name="VkDeviceBufferMemoryRequirementsKHR"/>
+ <type name="VkDeviceImageMemoryRequirementsKHR"/>
+ <command name="vkGetDeviceBufferMemoryRequirementsKHR"/>
+ <command name="vkGetDeviceImageMemoryRequirementsKHR"/>
+ <command name="vkGetDeviceImageSparseMemoryRequirementsKHR"/>
+ </require>
+ </extension>
+ <extension name="VK_HUAWEI_extension_415" number="415" author="HUAWEI" contact="Hueilong Wang @wyvernathuawei" supported="disabled">
+ <require>
+ <enum value="0" name="VK_HUAWEI_EXTENSION_415_SPEC_VERSION"/>
+ <enum value="&quot;VK_HUAWEI_extension_415&quot;" name="VK_HUAWEI_EXTENSION_415_EXTENSION_NAME"/>
+ </require>
+ </extension>
+ <extension name="VK_ARM_extension_416" number="416" author="ARM" contact="Jan-Harald Fredriksen @janharaldfredriksen-arm" supported="disabled">
+ <require>
+ <enum value="0" name="VK_ARM_EXTENSION_416_SPEC_VERSION"/>
+ <enum value="&quot;VK_ARM_extension_416&quot;" name="VK_ARM_EXTENSION_416_EXTENSION_NAME"/>
+ </require>
+ </extension>
+ <extension name="VK_KHR_extension_417" number="417" author="KHR" contact="Kevin Petit @kevinpetit" supported="disabled">
+ <require>
+ <enum value="0" name="VK_KHR_EXTENSION_417_SPEC_VERSION"/>
+ <enum value="&quot;VK_KHR_extension_417&quot;" name="VK_KHR_EXTENSION_417_EXTENSION_NAME"/>
+ </require>
+ </extension>
+ <extension name="VK_ARM_extension_418" number="418" author="ARM" contact="Kevin Petit @kevinpetit" supported="disabled">
+ <require>
+ <enum value="0" name="VK_ARM_EXTENSION_418_SPEC_VERSION"/>
+ <enum value="&quot;VK_ARM_extension_418&quot;" name="VK_ARM_EXTENSION_418_EXTENSION_NAME"/>
+ </require>
+ </extension>
+ <extension name="VK_EXT_extension_419" number="419" author="EXT" contact="Mike Blumenkrantz @zmike" type="device" supported="disabled">
+ <require>
+ <enum value="0" name="VK_EXT_EXTENSION_419_SPEC_VERSION"/>
+ <enum value="&quot;VK_EXT_extension_419&quot;" name="VK_EXT_EXTENSION_419_EXTENSION_NAME"/>
+ <enum bitpos="3" extends="VkImageViewCreateFlagBits" name="VK_IMAGE_VIEW_CREATE_RESERVED_3_BIT_EXT"/>
+ </require>
+ </extension>
+ <extension name="VK_EXT_extension_420" number="420" author="EXT" contact="Mike Blumenkrantz @zmike" type="device" supported="disabled">
+ <require>
+ <enum value="0" name="VK_EXT_EXTENSION_420_SPEC_VERSION"/>
+ <enum value="&quot;VK_EXT_extension_420&quot;" name="VK_EXT_EXTENSION_420_EXTENSION_NAME"/>
+ </require>
+ </extension>
+ <extension name="VK_VALVE_descriptor_set_host_mapping" number="421" type="device" author="VALVE" contact="Hans-Kristian Arntzen @HansKristian-Work" specialuse="d3demulation" supported="vulkan">
+ <require>
+ <enum value="1" name="VK_VALVE_DESCRIPTOR_SET_HOST_MAPPING_SPEC_VERSION"/>
+ <enum value="&quot;VK_VALVE_descriptor_set_host_mapping&quot;" name="VK_VALVE_DESCRIPTOR_SET_HOST_MAPPING_EXTENSION_NAME"/>
+ <enum offset="0" extends="VkStructureType" name="VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_DESCRIPTOR_SET_HOST_MAPPING_FEATURES_VALVE"/>
+ <enum offset="1" extends="VkStructureType" name="VK_STRUCTURE_TYPE_DESCRIPTOR_SET_BINDING_REFERENCE_VALVE"/>
+ <enum offset="2" extends="VkStructureType" name="VK_STRUCTURE_TYPE_DESCRIPTOR_SET_LAYOUT_HOST_MAPPING_INFO_VALVE"/>
+ <type name="VkPhysicalDeviceDescriptorSetHostMappingFeaturesVALVE"/>
+ <type name="VkDescriptorSetBindingReferenceVALVE"/>
+ <type name="VkDescriptorSetLayoutHostMappingInfoVALVE"/>
+ <command name="vkGetDescriptorSetLayoutHostMappingInfoVALVE"/>
+ <command name="vkGetDescriptorSetHostMappingVALVE"/>
+ </require>
+ </extension>
+ <extension name="VK_EXT_extension_422" number="422" author="EXT" contact="Graeme Leese @gnl21" supported="disabled">
+ <require>
+ <enum value="0" name="VK_EXT_EXTENSION_422_SPEC_VERSION"/>
+ <enum value="&quot;VK_EXT_extension_422&quot;" name="VK_EXT_EXTENSION_422_EXTENSION_NAME"/>
+ </require>
+ </extension>
+ <extension name="VK_EXT_non_seamless_cube_map" number="423" author="EXT" type="device" contact="Georg Lehmann @DadSchoorse" specialuse="d3demulation,glemulation" supported="vulkan">
+ <require>
+ <enum value="1" name="VK_EXT_NON_SEAMLESS_CUBE_MAP_SPEC_VERSION"/>
+ <enum value="&quot;VK_EXT_non_seamless_cube_map&quot;" name="VK_EXT_NON_SEAMLESS_CUBE_MAP_EXTENSION_NAME"/>
+ <enum bitpos="2" extends="VkSamplerCreateFlagBits" name="VK_SAMPLER_CREATE_NON_SEAMLESS_CUBE_MAP_BIT_EXT"/>
+ <enum offset="0" extends="VkStructureType" name="VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_NON_SEAMLESS_CUBE_MAP_FEATURES_EXT"/>
+ <type name="VkPhysicalDeviceNonSeamlessCubeMapFeaturesEXT"/>
+ </require>
+ </extension>
+ <extension name="VK_ARM_extension_424" number="424" author="ARM" contact="Jan-Harald Fredriksen @janharaldfredriksen-arm" supported="disabled">
+ <require>
+ <enum value="0" name="VK_ARM_EXTENSION_424_SPEC_VERSION"/>
+ <enum value="&quot;VK_ARM_extension_424&quot;" name="VK_ARM_EXTENSION_424_EXTENSION_NAME"/>
+ </require>
+ </extension>
+ <extension name="VK_ARM_extension_425" number="425" author="ARM" contact="Jan-Harald Fredriksen @janharaldfredriksen-arm" supported="disabled">
+ <require>
+ <enum value="0" name="VK_ARM_EXTENSION_425_SPEC_VERSION"/>
+ <enum value="&quot;VK_ARM_extension_425&quot;" name="VK_ARM_EXTENSION_425_EXTENSION_NAME"/>
+ </require>
+ </extension>
+ <extension name="VK_QCOM_fragment_density_map_offset" number="426" type="device" requires="VK_KHR_get_physical_device_properties2,VK_EXT_fragment_density_map" author="QCOM" contact="Matthew Netsch @mnetsch" supported="vulkan">
+ <require>
+ <enum value="1" name="VK_QCOM_FRAGMENT_DENSITY_MAP_OFFSET_SPEC_VERSION"/>
+ <enum value="&quot;VK_QCOM_fragment_density_map_offset&quot;" name="VK_QCOM_FRAGMENT_DENSITY_MAP_OFFSET_EXTENSION_NAME"/>
+ <enum offset="0" extends="VkStructureType" name="VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_FRAGMENT_DENSITY_MAP_OFFSET_FEATURES_QCOM"/>
+ <enum offset="1" extends="VkStructureType" name="VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_FRAGMENT_DENSITY_MAP_OFFSET_PROPERTIES_QCOM"/>
+ <enum offset="2" extends="VkStructureType" name="VK_STRUCTURE_TYPE_SUBPASS_FRAGMENT_DENSITY_MAP_OFFSET_END_INFO_QCOM"/>
+ <enum bitpos="15" extends="VkImageCreateFlagBits" name="VK_IMAGE_CREATE_FRAGMENT_DENSITY_MAP_OFFSET_BIT_QCOM"/>
+ <type name="VkPhysicalDeviceFragmentDensityMapOffsetFeaturesQCOM"/>
+ <type name="VkPhysicalDeviceFragmentDensityMapOffsetPropertiesQCOM"/>
+ <type name="VkSubpassFragmentDensityMapOffsetEndInfoQCOM"/>
+ </require>
+ </extension>
+ <extension name="VK_NV_extension_427" number="427" author="NV" contact="Vikram Kushwaha @vkushwaha-nv" supported="disabled">
+ <require>
+ <enum value="0" name="VK_NV_EXTENSION_427_SPEC_VERSION"/>
+ <enum value="&quot;VK_NV_extension_427&quot;" name="VK_NV_EXTENSION_427_EXTENSION_NAME"/>
+ </require>
+ </extension>
+ <extension name="VK_NV_extension_428" number="428" author="NV" contact="Vikram Kushwaha @vkushwaha-nv" supported="disabled">
+ <require>
+ <enum value="0" name="VK_NV_EXTENSION_428_SPEC_VERSION"/>
+ <enum value="&quot;VK_NV_extension_428&quot;" name="VK_NV_EXTENSION_428_EXTENSION_NAME"/>
+ </require>
+ </extension>
+ <extension name="VK_NV_extension_429" number="429" author="NV" contact="Vikram Kushwaha @vkushwaha-nv" supported="disabled">
+ <require>
+ <enum value="0" name="VK_NV_EXTENSION_429_SPEC_VERSION"/>
+ <enum value="&quot;VK_NV_extension_429&quot;" name="VK_NV_EXTENSION_429_EXTENSION_NAME"/>
+ </require>
+ </extension>
+ <extension name="VK_NV_extension_430" number="430" author="NV" contact="Vikram Kushwaha @vkushwaha-nv" supported="disabled">
+ <require>
+ <enum value="0" name="VK_NV_EXTENSION_430_SPEC_VERSION"/>
+ <enum value="&quot;VK_NV_extension_430&quot;" name="VK_NV_EXTENSION_430_EXTENSION_NAME"/>
+ </require>
+ </extension>
+ <extension name="VK_NV_linear_color_attachment" number="431" type="device" author="NVIDIA" contact="sourav parmar @souravpNV" supported="vulkan">
+ <require>
+ <enum value="1" name="VK_NV_LINEAR_COLOR_ATTACHMENT_SPEC_VERSION"/>
+ <enum value="&quot;VK_NV_linear_color_attachment&quot;" name="VK_NV_LINEAR_COLOR_ATTACHMENT_EXTENSION_NAME"/>
+ <enum offset="0" extends="VkStructureType" name="VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_LINEAR_COLOR_ATTACHMENT_FEATURES_NV"/>
+ <type name="VkPhysicalDeviceLinearColorAttachmentFeaturesNV"/>
+ </require>
+ <require extension="VK_KHR_format_feature_flags2">
+ <enum bitpos="38" extends="VkFormatFeatureFlagBits2" name="VK_FORMAT_FEATURE_2_LINEAR_COLOR_ATTACHMENT_BIT_NV" comment="Format support linear image as render target, it cannot be mixed with non linear attachment"/>
+ </require>
+ </extension>
+ <extension name="VK_NV_extension_432" number="432" author="NV" contact="Sourav Parmar @souravpNV" supported="disabled">
+ <require>
+ <enum value="0" name="VK_NV_EXTENSION_432_SPEC_VERSION"/>
+ <enum value="&quot;VK_NV_extension_432&quot;" name="VK_NV_EXTENSION_432_EXTENSION_NAME"/>
+ </require>
+ </extension>
+ <extension name="VK_NV_extension_433" number="433" author="NV" contact="Sourav Parmar @souravpNV" supported="disabled">
+ <require>
+ <enum value="0" name="VK_NV_EXTENSION_433_SPEC_VERSION"/>
+ <enum value="&quot;VK_NV_extension_433&quot;" name="VK_NV_EXTENSION_433_EXTENSION_NAME"/>
+ </require>
+ </extension>
+ <extension name="VK_GOOGLE_surfaceless_query" number="434" type="instance" requires="VK_KHR_surface" author="GOOGLE" contact="Shahbaz Youssefi @syoussefi" specialuse="glemulation" supported="vulkan">
+ <require>
+ <enum value="1" name="VK_GOOGLE_SURFACELESS_QUERY_SPEC_VERSION"/>
+ <enum value="&quot;VK_GOOGLE_surfaceless_query&quot;" name="VK_GOOGLE_SURFACELESS_QUERY_EXTENSION_NAME"/>
+ </require>
+ </extension>
+ <extension name="VK_KHR_extension_435" number="435" author="KHR" contact="Alan Baker @alan-baker" supported="disabled">
+ <require>
+ <enum value="0" name="VK_KHR_EXTENSION_435_SPEC_VERSION"/>
+ <enum value="&quot;VK_KHR_extension_435&quot;" name="VK_KHR_EXTENSION_435_EXTENSION_NAME"/>
+ </require>
+ </extension>
+ <extension name="VK_NV_extension_436" number="436" author="NV" contact="Daniel Koch @dgkoch" supported="disabled">
+ <require>
+ <enum value="0" name="VK_NV_EXTENSION_436_SPEC_VERSION"/>
+ <enum value="&quot;VK_NV_extension_436&quot;" name="VK_NV_EXTENSION_436_EXTENSION_NAME"/>
+ </require>
+ </extension>
+ <extension name="VK_EXT_extension_437" number="437" author="EXT" contact="Jonathan Weinstein @Jonathan-Weinstein" supported="disabled">
+ <require>
+ <enum value="0" name="VK_EXT_EXTENSION_437_SPEC_VERSION"/>
+ <enum value="&quot;VK_EXT_extension_437&quot;" name="VK_EXT_EXTENSION_437_EXTENSION_NAME"/>
+ </require>
+ </extension>
+ <extension name="VK_EXT_image_compression_control_swapchain" number="438" type="device" requires="VK_EXT_image_compression_control" author="EXT" contact="Jan-Harald Fredriksen @janharaldfredriksen-arm" supported="vulkan">
+ <require>
+ <enum value="1" name="VK_EXT_IMAGE_COMPRESSION_CONTROL_SWAPCHAIN_SPEC_VERSION"/>
+ <enum value="&quot;VK_EXT_image_compression_control_swapchain&quot;" name="VK_EXT_IMAGE_COMPRESSION_CONTROL_SWAPCHAIN_EXTENSION_NAME"/>
+ <enum offset="0" extends="VkStructureType" name="VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_IMAGE_COMPRESSION_CONTROL_SWAPCHAIN_FEATURES_EXT"/>
+ <type name="VkPhysicalDeviceImageCompressionControlSwapchainFeaturesEXT"/>
+ </require>
+ </extension>
+ <extension name="VK_SEC_extension_439" number="439" author="SEC" contact="Ralph Potter gitlab:@r_potter" supported="disabled">
+ <require>
+ <enum value="0" name="VK_SEC_EXTENSION_439_SPEC_VERSION"/>
+ <enum value="&quot;VK_SEC_extension_439&quot;" name="VK_SEC_EXTENSION_439_EXTENSION_NAME"/>
+ </require>
+ </extension>
+ <extension name="VK_QCOM_extension_440" number="440" author="QCOM" contact="Jeff Leger @jackohound" supported="disabled">
+ <require>
+ <enum value="0" name="VK_QCOM_EXTENSION_440_SPEC_VERSION"/>
+ <enum value="&quot;VK_QCOM_extension_440&quot;" name="VK_QCOM_EXTENSION_440_EXTENSION_NAME"/>
+ <enum bitpos="7" extends="VkQueueFlagBits" name="VK_QUEUE_RESERVED_7_BIT_QCOM"/>
+ <enum bitpos="1" extends="VkDeviceQueueCreateFlagBits" name="VK_DEVICE_QUEUE_CREATE_RESERVED_1_BIT_QCOM"/>
+ </require>
+ </extension>
+ <extension name="VK_QCOM_image_processing" number="441" type="device" requires="VK_KHR_format_feature_flags2" author="QCOM" contact="Jeff Leger @jackohound" supported="vulkan">
+ <require>
+ <enum value="1" name="VK_QCOM_IMAGE_PROCESSING_SPEC_VERSION"/>
+ <enum value="&quot;VK_QCOM_image_processing&quot;" name="VK_QCOM_IMAGE_PROCESSING_EXTENSION_NAME"/>
+ <enum offset="0" extends="VkStructureType" name="VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_IMAGE_PROCESSING_FEATURES_QCOM"/>
+ <enum offset="1" extends="VkStructureType" name="VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_IMAGE_PROCESSING_PROPERTIES_QCOM"/>
+ <enum offset="2" extends="VkStructureType" name="VK_STRUCTURE_TYPE_IMAGE_VIEW_SAMPLE_WEIGHT_CREATE_INFO_QCOM"/>
+ <enum bitpos="4" extends="VkSamplerCreateFlagBits" name="VK_SAMPLER_CREATE_IMAGE_PROCESSING_BIT_QCOM"/>
+ <enum bitpos="20" extends="VkImageUsageFlagBits" name="VK_IMAGE_USAGE_SAMPLE_WEIGHT_BIT_QCOM"/>
+ <enum bitpos="21" extends="VkImageUsageFlagBits" name="VK_IMAGE_USAGE_SAMPLE_BLOCK_MATCH_BIT_QCOM"/>
+ <enum offset="0" extends="VkDescriptorType" name="VK_DESCRIPTOR_TYPE_SAMPLE_WEIGHT_IMAGE_QCOM"/>
+ <enum offset="1" extends="VkDescriptorType" name="VK_DESCRIPTOR_TYPE_BLOCK_MATCH_IMAGE_QCOM"/>
+ <type name="VkImageViewSampleWeightCreateInfoQCOM"/>
+ <type name="VkPhysicalDeviceImageProcessingFeaturesQCOM"/>
+ <type name="VkPhysicalDeviceImageProcessingPropertiesQCOM"/>
+ </require>
+ <require extension="VK_KHR_format_feature_flags2">
+ <enum bitpos="34" extends="VkFormatFeatureFlagBits2" name="VK_FORMAT_FEATURE_2_WEIGHT_IMAGE_BIT_QCOM"/>
+ <enum bitpos="35" extends="VkFormatFeatureFlagBits2" name="VK_FORMAT_FEATURE_2_WEIGHT_SAMPLED_IMAGE_BIT_QCOM"/>
+ <enum bitpos="36" extends="VkFormatFeatureFlagBits2" name="VK_FORMAT_FEATURE_2_BLOCK_MATCHING_BIT_QCOM"/>
+ <enum bitpos="37" extends="VkFormatFeatureFlagBits2" name="VK_FORMAT_FEATURE_2_BOX_FILTER_SAMPLED_BIT_QCOM"/>
+ </require>
+ </extension>
+ <extension name="VK_COREAVI_extension_442" number="442" author="COREAVI" contact="Aidan Fabius @afabius" supported="disabled">
+ <require>
+ <enum value="0" name="VK_COREAVI_EXTENSION_442_SPEC_VERSION"/>
+ <enum value="&quot;VK_COREAVI_extension_442&quot;" name="VK_COREAVI_EXTENSION_442_EXTENSION_NAME"/>
+ </require>
+ </extension>
+ <extension name="VK_COREAVI_extension_443" number="443" author="COREAVI" contact="Aidan Fabius @afabius" supported="disabled">
+ <require>
+ <enum value="0" name="VK_COREAVI_EXTENSION_443_SPEC_VERSION"/>
+ <enum value="&quot;VK_COREAVI_extension_443&quot;" name="VK_COREAVI_EXTENSION_443_EXTENSION_NAME"/>
+ </require>
+ </extension>
+ <extension name="VK_COREAVI_extension_444" number="444" author="COREAVI" contact="Aidan Fabius @afabius" supported="disabled">
+ <require>
+ <enum value="0" name="VK_COREAVI_EXTENSION_444_SPEC_VERSION"/>
+ <enum value="&quot;VK_COREAVI_extension_444&quot;" name="VK_COREAVI_EXTENSION_444_EXTENSION_NAME"/>
+ <enum extends="VkCommandPoolResetFlagBits" bitpos="1" name="VK_COMMAND_POOL_RESET_RESERVED_1_BIT_COREAVI"/>
+ </require>
+ </extension>
+ <extension name="VK_COREAVI_extension_445" number="445" author="COREAVI" contact="Aidan Fabius @afabius" supported="disabled">
+ <require>
+ <enum value="0" name="VK_COREAVI_EXTENSION_445_SPEC_VERSION"/>
+ <enum value="&quot;VK_COREAVI_extension_445&quot;" name="VK_COREAVI_EXTENSION_445_EXTENSION_NAME"/>
+ </require>
+ </extension>
+ <extension name="VK_COREAVI_extension_446" number="446" author="COREAVI" contact="Aidan Fabius @afabius" supported="disabled">
+ <require>
+ <enum value="0" name="VK_COREAVI_EXTENSION_446_SPEC_VERSION"/>
+ <enum value="&quot;VK_COREAVI_extension_446&quot;" name="VK_COREAVI_EXTENSION_446_EXTENSION_NAME"/>
+ </require>
+ </extension>
+ <extension name="VK_COREAVI_extension_447" number="447" author="COREAVI" contact="Aidan Fabius @afabius" supported="disabled">
+ <require>
+ <enum value="0" name="VK_COREAVI_EXTENSION_447_SPEC_VERSION"/>
+ <enum value="&quot;VK_COREAVI_extension_447&quot;" name="VK_COREAVI_EXTENSION_447_EXTENSION_NAME"/>
+ </require>
+ </extension>
+ <extension name="VK_SEC_extension_448" number="448" author="SEC" contact="Ralph Potter gitlab:@r_potter" supported="disabled">
+ <require>
+ <enum value="0" name="VK_SEC_EXTENSION_448_SPEC_VERSION"/>
+ <enum value="&quot;VK_SEC_extension_448&quot;" name="VK_SEC_EXTENSION_448_EXTENSION_NAME"/>
+ </require>
+ </extension>
+ <extension name="VK_SEC_extension_449" number="449" author="SEC" contact="Ralph Potter gitlab:@r_potter" supported="disabled">
+ <require>
+ <enum value="0" name="VK_SEC_EXTENSION_449_SPEC_VERSION"/>
+ <enum value="&quot;VK_SEC_extension_449&quot;" name="VK_SEC_EXTENSION_449_EXTENSION_NAME"/>
+ </require>
+ </extension>
+ <extension name="VK_SEC_extension_450" number="450" author="SEC" contact="Ralph Potter gitlab:@r_potter" supported="disabled">
+ <require>
+ <enum value="0" name="VK_SEC_EXTENSION_450_SPEC_VERSION"/>
+ <enum value="&quot;VK_SEC_extension_450&quot;" name="VK_SEC_EXTENSION_450_EXTENSION_NAME"/>
+ </require>
+ </extension>
+ <extension name="VK_SEC_extension_451" number="451" author="SEC" contact="Ralph Potter gitlab:@r_potter" supported="disabled">
+ <require>
+ <enum value="0" name="VK_SEC_EXTENSION_451_SPEC_VERSION"/>
+ <enum value="&quot;VK_SEC_extension_451&quot;" name="VK_SEC_EXTENSION_451_EXTENSION_NAME"/>
+ </require>
+ </extension>
+ <extension name="VK_NV_extension_452" number="452" author="NV" contact="Piers Daniell @pdaniell-nv" supported="disabled">
+ <require>
+ <enum value="0" name="VK_NV_EXTENSION_452_SPEC_VERSION"/>
+ <enum value="&quot;VK_NV_extension_452&quot;" name="VK_NV_EXTENSION_452_EXTENSION_NAME"/>
+ </require>
+ </extension>
+ <extension name="VK_ARM_extension_453" number="453" author="Arm" contact="Kevin Petit @kevinpetit" supported="disabled">
+ <require>
+ <enum value="0" name="VK_ARM_EXTENSION_453_SPEC_VERSION"/>
+ <enum value="&quot;VK_ARM_extension_453&quot;" name="VK_ARM_EXTENSION_453_EXTENSION_NAME"/>
+ </require>
+ </extension>
+ <extension name="VK_GOOGLE_extension_454" number="454" author="GOOGLE" contact="Chad Versace @chadversary" supported="disabled">
+ <require>
+ <enum value="0" name="VK_GOOGLE_EXTENSION_454_SPEC_VERSION"/>
+ <enum value="&quot;VK_GOOGLE_extension_454&quot;" name="VK_GOOGLE_EXTENSION_454_EXTENSION_NAME"/>
+ </require>
+ </extension>
+ <extension name="VK_GOOGLE_extension_455" number="455" author="GOOGLE" contact="Chad Versace @chadversary" supported="disabled">
+ <require>
+ <enum value="0" name="VK_GOOGLE_EXTENSION_455_SPEC_VERSION"/>
+ <enum value="&quot;VK_GOOGLE_extension_455&quot;" name="VK_GOOGLE_EXTENSION_455_EXTENSION_NAME"/>
+ </require>
+ </extension>
+ <extension name="VK_NV_extension_456" number="456" author="NV" contact="Piers Daniell @pdaniell-nv" supported="disabled">
+ <require>
+ <enum value="0" name="VK_NV_EXTENSION_456_SPEC_VERSION"/>
+ <enum value="&quot;VK_NV_extension_456&quot;" name="VK_NV_EXTENSION_456_EXTENSION_NAME"/>
+ </require>
+ </extension>
+ <extension name="VK_EXT_extension_457" number="457" author="RASTERGRID" contact="Daniel Rakos @aqnuep1" supported="disabled">
+ <require>
+ <enum value="0" name="VK_EXT_EXTENSION_457_SPEC_VERSION"/>
+ <enum value="&quot;VK_EXT_extension_457&quot;" name="VK_EXT_EXTENSION_457_EXTENSION_NAME"/>
+ </require>
+ </extension>
+ <extension name="VK_EXT_extension_458" number="458" author="RASTERGRID" contact="Daniel Rakos @aqnuep1" supported="disabled">
+ <require>
+ <enum value="0" name="VK_EXT_EXTENSION_458_SPEC_VERSION"/>
+ <enum value="&quot;VK_EXT_extension_458&quot;" name="VK_EXT_EXTENSION_458_EXTENSION_NAME"/>
+ </require>
+ </extension>
+ <extension name="VK_EXT_subpass_merge_feedback" number="459" type="device" author="EXT" contact="Ting Wei @catweiting" supported="vulkan">
+ <require>
+ <enum value="2" name="VK_EXT_SUBPASS_MERGE_FEEDBACK_SPEC_VERSION"/>
+ <enum value="&quot;VK_EXT_subpass_merge_feedback&quot;" name="VK_EXT_SUBPASS_MERGE_FEEDBACK_EXTENSION_NAME"/>
+ <enum offset="0" extends="VkStructureType" name="VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_SUBPASS_MERGE_FEEDBACK_FEATURES_EXT"/>
+ <enum offset="1" extends="VkStructureType" name="VK_STRUCTURE_TYPE_RENDER_PASS_CREATION_CONTROL_EXT"/>
+ <enum offset="2" extends="VkStructureType" name="VK_STRUCTURE_TYPE_RENDER_PASS_CREATION_FEEDBACK_CREATE_INFO_EXT"/>
+ <enum offset="3" extends="VkStructureType" name="VK_STRUCTURE_TYPE_RENDER_PASS_SUBPASS_FEEDBACK_CREATE_INFO_EXT"/>
+ <type name="VkPhysicalDeviceSubpassMergeFeedbackFeaturesEXT"/>
+ <type name="VkRenderPassCreationControlEXT"/>
+ <type name="VkRenderPassCreationFeedbackInfoEXT"/>
+ <type name="VkRenderPassCreationFeedbackCreateInfoEXT"/>
+ <type name="VkRenderPassSubpassFeedbackInfoEXT"/>
+ <type name="VkRenderPassSubpassFeedbackCreateInfoEXT"/>
+ <type name="VkSubpassMergeStatusEXT"/>
+ </require>
+ </extension>
+ <extension name="VK_EXT_extension_460" number="460" author="EXT" contact="Charles Giessen @charles-lunarg" supported="disabled">
+ <require>
+ <enum value="0" name="VK_EXT_EXTENSION_460_SPEC_VERSION"/>
+ <enum value="&quot;VK_EXT_extension_460&quot;" name="VK_EXT_EXTENSION_460_EXTENSION_NAME"/>
+ </require>
+ </extension>
+ <extension name="VK_EXT_extension_461" number="461" author="EXT" contact="Kevin Petit @kevinpetit" supported="disabled">
+ <require>
+ <enum value="0" name="VK_EXT_EXTENSION_461_SPEC_VERSION"/>
+ <enum value="&quot;VK_EXT_extension_461&quot;" name="VK_EXT_EXTENSION_461_EXTENSION_NAME"/>
+ <enum bitpos="39" extends="VkFormatFeatureFlagBits2" name="VK_FORMAT_FEATURE_2_RESERVED_39_BIT_EXT"/>
+ </require>
+ </extension>
+ <extension name="VK_EXT_extension_462" number="462" author="EXT" contact="Joshua Ashton @Joshua-Ashton,Liam Middlebrook @liam-middlebrook" supported="disabled">
+ <require>
+ <enum value="0" name="VK_EXT_EXTENSION_462_SPEC_VERSION"/>
+ <enum value="&quot;VK_EXT_extension_462&quot;" name="VK_EXT_EXTENSION_462_EXTENSION_NAME"/>
+ </require>
+ </extension>
+ <extension name="VK_EXT_shader_module_identifier" number="463" type="device" requires="VK_KHR_get_physical_device_properties2,VK_EXT_pipeline_creation_cache_control" author="EXT" contact="Hans-Kristian Arntzen @HansKristian-Work" supported="vulkan">
+ <require>
+ <enum value="1" name="VK_EXT_SHADER_MODULE_IDENTIFIER_SPEC_VERSION"/>
+ <enum value="&quot;VK_EXT_shader_module_identifier&quot;" name="VK_EXT_SHADER_MODULE_IDENTIFIER_EXTENSION_NAME"/>
+ <enum offset="0" extends="VkStructureType" name="VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_SHADER_MODULE_IDENTIFIER_FEATURES_EXT"/>
+ <enum offset="1" extends="VkStructureType" name="VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_SHADER_MODULE_IDENTIFIER_PROPERTIES_EXT"/>
+ <enum offset="2" extends="VkStructureType" name="VK_STRUCTURE_TYPE_PIPELINE_SHADER_STAGE_MODULE_IDENTIFIER_CREATE_INFO_EXT"/>
+ <enum offset="3" extends="VkStructureType" name="VK_STRUCTURE_TYPE_SHADER_MODULE_IDENTIFIER_EXT"/>
+ <enum name="VK_MAX_SHADER_MODULE_IDENTIFIER_SIZE_EXT"/>
+ <type name="VkPhysicalDeviceShaderModuleIdentifierFeaturesEXT"/>
+ <type name="VkPhysicalDeviceShaderModuleIdentifierPropertiesEXT"/>
+ <type name="VkPipelineShaderStageModuleIdentifierCreateInfoEXT"/>
+ <type name="VkShaderModuleIdentifierEXT"/>
+ <command name="vkGetShaderModuleIdentifierEXT"/>
+ <command name="vkGetShaderModuleCreateInfoIdentifierEXT"/>
+ </require>
+ </extension>
+ <extension name="VK_EXT_extension_464" number="464" author="EXT" contact="Jan-Harald Fredriksen @janharaldfredriksen-arm" supported="disabled">
+ <require>
+ <enum value="0" name="VK_EXT_EXTENSION_464_SPEC_VERSION"/>
+ <enum value="&quot;VK_EXT_extension_464&quot;" name="VK_EXT_EXTENSION_464_EXTENSION_NAME"/>
+ </require>
+ </extension>
+ <extension name="VK_NV_extension_465" number="465" author="NV" contact="Carsten Rohde @crohde" supported="disabled">
+ <require>
+ <enum value="0" name="VK_NV_EXTENSION_465_SPEC_VERSION"/>
+ <enum value="&quot;VK_NV_extension_465&quot;" name="VK_NV_EXTENSION_465_EXTENSION_NAME"/>
+ <enum bitpos="8" extends="VkQueueFlagBits" name="VK_QUEUE_RESERVED_8_BIT_NV"/>
+ <enum bitpos="29" extends="VkPipelineStageFlagBits2" name="VK_PIPELINE_STAGE_2_RESERVED_29_BIT_NV"/>
+ <enum bitpos="42" extends="VkAccessFlagBits2" name="VK_ACCESS_2_RESERVED_42_BIT_NV"/>
+ <enum bitpos="43" extends="VkAccessFlagBits2" name="VK_ACCESS_2_RESERVED_43_BIT_NV"/>
+ <enum bitpos="40" extends="VkFormatFeatureFlagBits2" name="VK_FORMAT_FEATURE_2_RESERVED_40_BIT_NV"/>
+ <enum bitpos="41" extends="VkFormatFeatureFlagBits2" name="VK_FORMAT_FEATURE_2_RESERVED_41_BIT_NV"/>
+ <enum bitpos="42" extends="VkFormatFeatureFlagBits2" name="VK_FORMAT_FEATURE_2_RESERVED_42_BIT_NV"/>
+ <enum bitpos="43" extends="VkFormatFeatureFlagBits2" name="VK_FORMAT_FEATURE_2_RESERVED_43_BIT_NV"/>
+ </require>
+ </extension>
+ <extension name="VK_EXT_extension_466" number="466" author="EXT" contact="Shahbaz Youssefi @syoussefi" supported="disabled">
+ <require>
+ <enum value="0" name="VK_EXT_EXTENSION_466_SPEC_VERSION"/>
+ <enum value="&quot;VK_EXT_extension_466&quot;" name="VK_EXT_EXTENSION_466_EXTENSION_NAME"/>
+ <enum bitpos="7" extends="VkSubpassDescriptionFlagBits" name="VK_SUBPASS_DESCRIPTION_RESERVED_7_BIT_EXT"/>
+ <enum bitpos="3" extends="VkRenderingFlagBits" name="VK_RENDERING_RESERVED_3_BIT_EXT"/>
+ </require>
+ </extension>
+ <extension name="VK_EXT_extension_467" number="467" author="EXT" contact="Shahbaz Youssefi @syoussefi" supported="disabled">
+ <require>
+ <enum value="0" name="VK_EXT_EXTENSION_467_SPEC_VERSION"/>
+ <enum value="&quot;VK_EXT_extension_467&quot;" name="VK_EXT_EXTENSION_467_EXTENSION_NAME"/>
+ <enum bitpos="27" extends="VkPipelineCreateFlagBits" name="VK_PIPELINE_CREATE_RESERVED_27_BIT_EXT"/>
+ </require>
+ </extension>
+ <extension name="VK_EXT_extension_468" number="468" author="EXT" contact="Shahbaz Youssefi @syoussefi" supported="disabled">
+ <require>
+ <enum value="0" name="VK_EXT_EXTENSION_468_SPEC_VERSION"/>
+ <enum value="&quot;VK_EXT_extension_468&quot;" name="VK_EXT_EXTENSION_468_EXTENSION_NAME"/>
+ </require>
+ </extension>
+ <extension name="VK_ANDROID_extension_469" number="469" type="device" platform="android" author="ANDROID" contact="Chris Forbes @chrisforbes" supported="disabled">
+ <require>
+ <enum value="0" name="VK_ANDROID_EXTENSION_469_SPEC_VERSION"/>
+ <enum value="&quot;VK_ANDROID_extension_469&quot;" name="VK_ANDROID_EXTENSION_469_EXTENSION_NAME"/>
+ </require>
+ </extension>
+ <extension name="VK_AMD_extension_470" number="470" author="AMD" contact="Stu Smith" supported="disabled">
+ <require>
+ <enum value="0" name="VK_AMD_EXTENSION_470_SPEC_VERSION"/>
+ <enum value="&quot;VK_AMD_extension_470&quot;" name="VK_AMD_EXTENSION_470_EXTENSION_NAME"/>
+ </require>
+ </extension>
+ <extension name="VK_AMD_extension_471" number="471" author="AMD" contact="Stu Smith" supported="disabled">
+ <require>
+ <enum value="0" name="VK_AMD_EXTENSION_471_SPEC_VERSION"/>
+ <enum value="&quot;VK_AMD_extension_471&quot;" name="VK_AMD_EXTENSION_471_EXTENSION_NAME"/>
+ </require>
+ </extension>
+ <extension name="VK_AMD_extension_472" number="472" author="AMD" contact="Stu Smith" supported="disabled">
+ <require>
+ <enum value="0" name="VK_AMD_EXTENSION_472_SPEC_VERSION"/>
+ <enum value="&quot;VK_AMD_extension_472&quot;" name="VK_AMD_EXTENSION_472_EXTENSION_NAME"/>
+ </require>
+ </extension>
+ <extension name="VK_AMD_extension_473" number="473" author="AMD" contact="Stu Smith" supported="disabled">
+ <require>
+ <enum value="0" name="VK_AMD_EXTENSION_473_SPEC_VERSION"/>
+ <enum value="&quot;VK_AMD_extension_473&quot;" name="VK_AMD_EXTENSION_473_EXTENSION_NAME"/>
+ </require>
+ </extension>
+ <extension name="VK_AMD_extension_474" number="474" author="AMD" contact="Stu Smith" supported="disabled">
+ <require>
+ <enum value="0" name="VK_AMD_EXTENSION_474_SPEC_VERSION"/>
+ <enum value="&quot;VK_AMD_extension_474&quot;" name="VK_AMD_EXTENSION_474_EXTENSION_NAME"/>
+ </require>
+ </extension>
+ <extension name="VK_AMD_extension_475" number="475" author="AMD" contact="Stu Smith" supported="disabled">
+ <require>
+ <enum value="0" name="VK_AMD_EXTENSION_475_SPEC_VERSION"/>
+ <enum value="&quot;VK_AMD_extension_475&quot;" name="VK_AMD_EXTENSION_475_EXTENSION_NAME"/>
+ </require>
+ </extension>
+ <extension name="VK_AMD_extension_476" number="476" author="AMD" contact="Stu Smith" supported="disabled">
+ <require>
+ <enum value="0" name="VK_AMD_EXTENSION_476_SPEC_VERSION"/>
+ <enum value="&quot;VK_AMD_extension_476&quot;" name="VK_AMD_EXTENSION_476_EXTENSION_NAME"/>
+ </require>
+ </extension>
+ <extension name="VK_AMD_extension_477" number="477" author="AMD" contact="Stu Smith" supported="disabled">
+ <require>
+ <enum value="0" name="VK_AMD_EXTENSION_477_SPEC_VERSION"/>
+ <enum value="&quot;VK_AMD_extension_477&quot;" name="VK_AMD_EXTENSION_477_EXTENSION_NAME"/>
+ </require>
+ </extension>
+ <extension name="VK_AMD_extension_478" number="478" author="AMD" contact="Stu Smith" supported="disabled">
+ <require>
+ <enum value="0" name="VK_AMD_EXTENSION_478_SPEC_VERSION"/>
+ <enum value="&quot;VK_AMD_extension_478&quot;" name="VK_AMD_EXTENSION_478_EXTENSION_NAME"/>
+ </require>
+ </extension>
+ <extension name="VK_AMD_extension_479" number="479" author="AMD" contact="Stu Smith" supported="disabled">
+ <require>
+ <enum value="0" name="VK_AMD_EXTENSION_479_SPEC_VERSION"/>
+ <enum value="&quot;VK_AMD_extension_479&quot;" name="VK_AMD_EXTENSION_479_EXTENSION_NAME"/>
+ </require>
+ </extension>
+ <extension name="VK_EXT_extension_480" number="480" author="EXT" contact="Daniel Stone" supported="disabled">
+ <require>
+ <enum value="0" name="VK_EXT_EXTENSION_480_SPEC_VERSION"/>
+ <enum value="&quot;VK_EXT_extension_480&quot;" name="VK_EXT_EXTENSION_480_EXTENSION_NAME"/>
+ </require>
+ </extension>
+ <extension name="VK_EXT_extension_481" number="481" author="EXT" contact="Daniel Stone" supported="disabled">
+ <require>
+ <enum value="0" name="VK_EXT_EXTENSION_481_SPEC_VERSION"/>
+ <enum value="&quot;VK_EXT_extension_481&quot;" name="VK_EXT_EXTENSION_481_EXTENSION_NAME"/>
+ </require>
+ </extension>
+ <extension name="VK_EXT_extension_482" number="482" author="KHR" contact="Eric Werness" supported="disabled">
+ <require>
+ <enum value="0" name="VK_EXT_EXTENSION_482_SPEC_VERSION"/>
+ <enum value="&quot;VK_EXT_extension_482&quot;" name="VK_EXT_EXTENSION_482_EXTENSION_NAME"/>
+ </require>
+ </extension>
+ <extension name="VK_EXT_extension_483" number="483" author="EXT" contact="Piers Daniell" supported="disabled">
+ <require>
+ <enum value="0" name="VK_EXT_EXTENSION_483_SPEC_VERSION"/>
+ <enum value="&quot;VK_EXT_extension_483&quot;" name="VK_EXT_EXTENSION_483_EXTENSION_NAME"/>
+ <enum bitpos="15" extends="VkShaderStageFlagBits" name="VK_SHADER_STAGE_EXT_483_RESERVE_15"/>
+ <enum bitpos="16" extends="VkShaderStageFlagBits" name="VK_SHADER_STAGE_EXT_483_RESERVE_16"/>
+ <enum bitpos="17" extends="VkShaderStageFlagBits" name="VK_SHADER_STAGE_EXT_483_RESERVE_17"/>
+ </require>
+ </extension>
+ <extension name="VK_EXT_extension_484" number="484" author="KHR" contact="Chris Glover @cdglove" supported="disabled">
+ <require>
+ <enum value="0" name="VK_EXT_EXTENSION_484_SPEC_VERSION"/>
+ <enum value="&quot;VK_EXT_extension_484&quot;" name="VK_EXT_EXTENSION_484_EXTENSION_NAME"/>
+ </require>
+ </extension>
+ <extension name="VK_QCOM_tile_properties" number="485" type="device" requires="VK_KHR_get_physical_device_properties2" author="QCOM" contact="Jeff Leger @jackohound" supported="vulkan">
+ <require>
+ <enum value="1" name="VK_QCOM_TILE_PROPERTIES_SPEC_VERSION"/>
+ <enum value="&quot;VK_QCOM_tile_properties&quot;" name="VK_QCOM_TILE_PROPERTIES_EXTENSION_NAME"/>
+ <command name="vkGetFramebufferTilePropertiesQCOM"/>
+ <command name="vkGetDynamicRenderingTilePropertiesQCOM"/>
+ <enum offset="0" extends="VkStructureType" name="VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_TILE_PROPERTIES_FEATURES_QCOM"/>
+ <enum offset="1" extends="VkStructureType" name="VK_STRUCTURE_TYPE_TILE_PROPERTIES_QCOM"/>
+ <type name="VkPhysicalDeviceTilePropertiesFeaturesQCOM"/>
+ <type name="VkTilePropertiesQCOM"/>
+ <type name="VkRenderingInfoKHR"/>
+ </require>
+ </extension>
</extensions>
+ <formats>
+ <format name="VK_FORMAT_R4G4_UNORM_PACK8" class="8-bit" blockSize="1" texelsPerBlock="1" packed="8">
+ <component name="R" bits="4" numericFormat="UNORM"/>
+ <component name="G" bits="4" numericFormat="UNORM"/>
+ </format>
+ <format name="VK_FORMAT_R4G4B4A4_UNORM_PACK16" class="16-bit" blockSize="2" texelsPerBlock="1" packed="16">
+ <component name="R" bits="4" numericFormat="UNORM"/>
+ <component name="G" bits="4" numericFormat="UNORM"/>
+ <component name="B" bits="4" numericFormat="UNORM"/>
+ <component name="A" bits="4" numericFormat="UNORM"/>
+ </format>
+ <format name="VK_FORMAT_B4G4R4A4_UNORM_PACK16" class="16-bit" blockSize="2" texelsPerBlock="1" packed="16">
+ <component name="B" bits="4" numericFormat="UNORM"/>
+ <component name="G" bits="4" numericFormat="UNORM"/>
+ <component name="R" bits="4" numericFormat="UNORM"/>
+ <component name="A" bits="4" numericFormat="UNORM"/>
+ </format>
+ <format name="VK_FORMAT_R5G6B5_UNORM_PACK16" class="16-bit" blockSize="2" texelsPerBlock="1" packed="16">
+ <component name="R" bits="5" numericFormat="UNORM"/>
+ <component name="G" bits="6" numericFormat="UNORM"/>
+ <component name="B" bits="5" numericFormat="UNORM"/>
+ </format>
+ <format name="VK_FORMAT_B5G6R5_UNORM_PACK16" class="16-bit" blockSize="2" texelsPerBlock="1" packed="16">
+ <component name="B" bits="5" numericFormat="UNORM"/>
+ <component name="G" bits="6" numericFormat="UNORM"/>
+ <component name="R" bits="5" numericFormat="UNORM"/>
+ </format>
+ <format name="VK_FORMAT_R5G5B5A1_UNORM_PACK16" class="16-bit" blockSize="2" texelsPerBlock="1" packed="16">
+ <component name="R" bits="5" numericFormat="UNORM"/>
+ <component name="G" bits="5" numericFormat="UNORM"/>
+ <component name="B" bits="5" numericFormat="UNORM"/>
+ <component name="A" bits="1" numericFormat="UNORM"/>
+ </format>
+ <format name="VK_FORMAT_B5G5R5A1_UNORM_PACK16" class="16-bit" blockSize="2" texelsPerBlock="1" packed="16">
+ <component name="B" bits="5" numericFormat="UNORM"/>
+ <component name="R" bits="5" numericFormat="UNORM"/>
+ <component name="G" bits="5" numericFormat="UNORM"/>
+ <component name="A" bits="1" numericFormat="UNORM"/>
+ </format>
+ <format name="VK_FORMAT_A1R5G5B5_UNORM_PACK16" class="16-bit" blockSize="2" texelsPerBlock="1" packed="16">
+ <component name="A" bits="1" numericFormat="UNORM"/>
+ <component name="R" bits="5" numericFormat="UNORM"/>
+ <component name="G" bits="5" numericFormat="UNORM"/>
+ <component name="B" bits="5" numericFormat="UNORM"/>
+ </format>
+ <format name="VK_FORMAT_R8_UNORM" class="8-bit" blockSize="1" texelsPerBlock="1">
+ <component name="R" bits="8" numericFormat="UNORM"/>
+ <spirvimageformat name="R8"/>
+ </format>
+ <format name="VK_FORMAT_R8_SNORM" class="8-bit" blockSize="1" texelsPerBlock="1">
+ <component name="R" bits="8" numericFormat="SNORM"/>
+ <spirvimageformat name="R8Snorm"/>
+ </format>
+ <format name="VK_FORMAT_R8_USCALED" class="8-bit" blockSize="1" texelsPerBlock="1">
+ <component name="R" bits="8" numericFormat="USCALED"/>
+ </format>
+ <format name="VK_FORMAT_R8_SSCALED" class="8-bit" blockSize="1" texelsPerBlock="1">
+ <component name="R" bits="8" numericFormat="SSCALED"/>
+ </format>
+ <format name="VK_FORMAT_R8_UINT" class="8-bit" blockSize="1" texelsPerBlock="1">
+ <component name="R" bits="8" numericFormat="UINT"/>
+ <spirvimageformat name="R8ui"/>
+ </format>
+ <format name="VK_FORMAT_R8_SINT" class="8-bit" blockSize="1" texelsPerBlock="1">
+ <component name="R" bits="8" numericFormat="SINT"/>
+ <spirvimageformat name="R8i"/>
+ </format>
+ <format name="VK_FORMAT_R8_SRGB" class="8-bit" blockSize="1" texelsPerBlock="1">
+ <component name="R" bits="8" numericFormat="SRGB"/>
+ </format>
+ <format name="VK_FORMAT_R8G8_UNORM" class="16-bit" blockSize="2" texelsPerBlock="1">
+ <component name="R" bits="8" numericFormat="UNORM"/>
+ <component name="G" bits="8" numericFormat="UNORM"/>
+ <spirvimageformat name="Rg8"/>
+ </format>
+ <format name="VK_FORMAT_R8G8_SNORM" class="16-bit" blockSize="2" texelsPerBlock="1">
+ <component name="R" bits="8" numericFormat="SNORM"/>
+ <component name="G" bits="8" numericFormat="SNORM"/>
+ <spirvimageformat name="Rg8Snorm"/>
+ </format>
+ <format name="VK_FORMAT_R8G8_USCALED" class="16-bit" blockSize="2" texelsPerBlock="1">
+ <component name="R" bits="8" numericFormat="USCALED"/>
+ <component name="G" bits="8" numericFormat="USCALED"/>
+ </format>
+ <format name="VK_FORMAT_R8G8_SSCALED" class="16-bit" blockSize="2" texelsPerBlock="1">
+ <component name="R" bits="8" numericFormat="SSCALED"/>
+ <component name="G" bits="8" numericFormat="SSCALED"/>
+ </format>
+ <format name="VK_FORMAT_R8G8_UINT" class="16-bit" blockSize="2" texelsPerBlock="1">
+ <component name="R" bits="8" numericFormat="UINT"/>
+ <component name="G" bits="8" numericFormat="UINT"/>
+ <spirvimageformat name="Rg8ui"/>
+ </format>
+ <format name="VK_FORMAT_R8G8_SINT" class="16-bit" blockSize="2" texelsPerBlock="1">
+ <component name="R" bits="8" numericFormat="SINT"/>
+ <component name="G" bits="8" numericFormat="SINT"/>
+ <spirvimageformat name="Rg8i"/>
+ </format>
+ <format name="VK_FORMAT_R8G8_SRGB" class="16-bit" blockSize="2" texelsPerBlock="1">
+ <component name="R" bits="8" numericFormat="SRGB"/>
+ <component name="G" bits="8" numericFormat="SRGB"/>
+ </format>
+ <format name="VK_FORMAT_R8G8B8_UNORM" class="24-bit" blockSize="3" texelsPerBlock="1">
+ <component name="R" bits="8" numericFormat="UNORM"/>
+ <component name="G" bits="8" numericFormat="UNORM"/>
+ <component name="B" bits="8" numericFormat="UNORM"/>
+ </format>
+ <format name="VK_FORMAT_R8G8B8_SNORM" class="24-bit" blockSize="3" texelsPerBlock="1">
+ <component name="R" bits="8" numericFormat="SNORM"/>
+ <component name="G" bits="8" numericFormat="SNORM"/>
+ <component name="B" bits="8" numericFormat="SNORM"/>
+ </format>
+ <format name="VK_FORMAT_R8G8B8_USCALED" class="24-bit" blockSize="3" texelsPerBlock="1">
+ <component name="R" bits="8" numericFormat="USCALED"/>
+ <component name="G" bits="8" numericFormat="USCALED"/>
+ <component name="B" bits="8" numericFormat="USCALED"/>
+ </format>
+ <format name="VK_FORMAT_R8G8B8_SSCALED" class="24-bit" blockSize="3" texelsPerBlock="1">
+ <component name="R" bits="8" numericFormat="SSCALED"/>
+ <component name="G" bits="8" numericFormat="SSCALED"/>
+ <component name="B" bits="8" numericFormat="SSCALED"/>
+ </format>
+ <format name="VK_FORMAT_R8G8B8_UINT" class="24-bit" blockSize="3" texelsPerBlock="1">
+ <component name="R" bits="8" numericFormat="UINT"/>
+ <component name="G" bits="8" numericFormat="UINT"/>
+ <component name="B" bits="8" numericFormat="UINT"/>
+ </format>
+ <format name="VK_FORMAT_R8G8B8_SINT" class="24-bit" blockSize="3" texelsPerBlock="1">
+ <component name="R" bits="8" numericFormat="SINT"/>
+ <component name="G" bits="8" numericFormat="SINT"/>
+ <component name="B" bits="8" numericFormat="SINT"/>
+ </format>
+ <format name="VK_FORMAT_R8G8B8_SRGB" class="24-bit" blockSize="3" texelsPerBlock="1">
+ <component name="R" bits="8" numericFormat="SRGB"/>
+ <component name="G" bits="8" numericFormat="SRGB"/>
+ <component name="B" bits="8" numericFormat="SRGB"/>
+ </format>
+ <format name="VK_FORMAT_B8G8R8_UNORM" class="24-bit" blockSize="3" texelsPerBlock="1">
+ <component name="B" bits="8" numericFormat="UNORM"/>
+ <component name="G" bits="8" numericFormat="UNORM"/>
+ <component name="R" bits="8" numericFormat="UNORM"/>
+ </format>
+ <format name="VK_FORMAT_B8G8R8_SNORM" class="24-bit" blockSize="3" texelsPerBlock="1">
+ <component name="B" bits="8" numericFormat="SNORM"/>
+ <component name="G" bits="8" numericFormat="SNORM"/>
+ <component name="R" bits="8" numericFormat="SNORM"/>
+ </format>
+ <format name="VK_FORMAT_B8G8R8_USCALED" class="24-bit" blockSize="3" texelsPerBlock="1">
+ <component name="B" bits="8" numericFormat="USCALED"/>
+ <component name="G" bits="8" numericFormat="USCALED"/>
+ <component name="R" bits="8" numericFormat="USCALED"/>
+ </format>
+ <format name="VK_FORMAT_B8G8R8_SSCALED" class="24-bit" blockSize="3" texelsPerBlock="1">
+ <component name="B" bits="8" numericFormat="SSCALED"/>
+ <component name="G" bits="8" numericFormat="SSCALED"/>
+ <component name="R" bits="8" numericFormat="SSCALED"/>
+ </format>
+ <format name="VK_FORMAT_B8G8R8_UINT" class="24-bit" blockSize="3" texelsPerBlock="1">
+ <component name="B" bits="8" numericFormat="UINT"/>
+ <component name="G" bits="8" numericFormat="UINT"/>
+ <component name="R" bits="8" numericFormat="UINT"/>
+ </format>
+ <format name="VK_FORMAT_B8G8R8_SINT" class="24-bit" blockSize="3" texelsPerBlock="1">
+ <component name="B" bits="8" numericFormat="SINT"/>
+ <component name="G" bits="8" numericFormat="SINT"/>
+ <component name="R" bits="8" numericFormat="SINT"/>
+ </format>
+ <format name="VK_FORMAT_B8G8R8_SRGB" class="24-bit" blockSize="3" texelsPerBlock="1">
+ <component name="B" bits="8" numericFormat="SRGB"/>
+ <component name="G" bits="8" numericFormat="SRGB"/>
+ <component name="R" bits="8" numericFormat="SRGB"/>
+ </format>
+ <format name="VK_FORMAT_R8G8B8A8_UNORM" class="32-bit" blockSize="4" texelsPerBlock="1">
+ <component name="R" bits="8" numericFormat="UNORM"/>
+ <component name="G" bits="8" numericFormat="UNORM"/>
+ <component name="B" bits="8" numericFormat="UNORM"/>
+ <component name="A" bits="8" numericFormat="UNORM"/>
+ <spirvimageformat name="Rgba8"/>
+ </format>
+ <format name="VK_FORMAT_R8G8B8A8_SNORM" class="32-bit" blockSize="4" texelsPerBlock="1">
+ <component name="R" bits="8" numericFormat="SNORM"/>
+ <component name="G" bits="8" numericFormat="SNORM"/>
+ <component name="B" bits="8" numericFormat="SNORM"/>
+ <component name="A" bits="8" numericFormat="SNORM"/>
+ <spirvimageformat name="Rgba8Snorm"/>
+ </format>
+ <format name="VK_FORMAT_R8G8B8A8_USCALED" class="32-bit" blockSize="4" texelsPerBlock="1">
+ <component name="R" bits="8" numericFormat="USCALED"/>
+ <component name="G" bits="8" numericFormat="USCALED"/>
+ <component name="B" bits="8" numericFormat="USCALED"/>
+ <component name="A" bits="8" numericFormat="USCALED"/>
+ </format>
+ <format name="VK_FORMAT_R8G8B8A8_SSCALED" class="32-bit" blockSize="4" texelsPerBlock="1">
+ <component name="R" bits="8" numericFormat="SSCALED"/>
+ <component name="G" bits="8" numericFormat="SSCALED"/>
+ <component name="B" bits="8" numericFormat="SSCALED"/>
+ <component name="A" bits="8" numericFormat="SSCALED"/>
+ </format>
+ <format name="VK_FORMAT_R8G8B8A8_UINT" class="32-bit" blockSize="4" texelsPerBlock="1">
+ <component name="R" bits="8" numericFormat="UINT"/>
+ <component name="G" bits="8" numericFormat="UINT"/>
+ <component name="B" bits="8" numericFormat="UINT"/>
+ <component name="A" bits="8" numericFormat="UINT"/>
+ <spirvimageformat name="Rgba8ui"/>
+ </format>
+ <format name="VK_FORMAT_R8G8B8A8_SINT" class="32-bit" blockSize="4" texelsPerBlock="1">
+ <component name="R" bits="8" numericFormat="SINT"/>
+ <component name="G" bits="8" numericFormat="SINT"/>
+ <component name="B" bits="8" numericFormat="SINT"/>
+ <component name="A" bits="8" numericFormat="SINT"/>
+ <spirvimageformat name="Rgba8i"/>
+ </format>
+ <format name="VK_FORMAT_R8G8B8A8_SRGB" class="32-bit" blockSize="4" texelsPerBlock="1">
+ <component name="R" bits="8" numericFormat="SRGB"/>
+ <component name="G" bits="8" numericFormat="SRGB"/>
+ <component name="B" bits="8" numericFormat="SRGB"/>
+ <component name="A" bits="8" numericFormat="SRGB"/>
+ </format>
+ <format name="VK_FORMAT_B8G8R8A8_UNORM" class="32-bit" blockSize="4" texelsPerBlock="1">
+ <component name="B" bits="8" numericFormat="UNORM"/>
+ <component name="G" bits="8" numericFormat="UNORM"/>
+ <component name="R" bits="8" numericFormat="UNORM"/>
+ <component name="A" bits="8" numericFormat="UNORM"/>
+ </format>
+ <format name="VK_FORMAT_B8G8R8A8_SNORM" class="32-bit" blockSize="4" texelsPerBlock="1">
+ <component name="B" bits="8" numericFormat="SNORM"/>
+ <component name="G" bits="8" numericFormat="SNORM"/>
+ <component name="R" bits="8" numericFormat="SNORM"/>
+ <component name="A" bits="8" numericFormat="SNORM"/>
+ </format>
+ <format name="VK_FORMAT_B8G8R8A8_USCALED" class="32-bit" blockSize="4" texelsPerBlock="1">
+ <component name="B" bits="8" numericFormat="USCALED"/>
+ <component name="G" bits="8" numericFormat="USCALED"/>
+ <component name="R" bits="8" numericFormat="USCALED"/>
+ <component name="A" bits="8" numericFormat="USCALED"/>
+ </format>
+ <format name="VK_FORMAT_B8G8R8A8_SSCALED" class="32-bit" blockSize="4" texelsPerBlock="1">
+ <component name="B" bits="8" numericFormat="SSCALED"/>
+ <component name="G" bits="8" numericFormat="SSCALED"/>
+ <component name="R" bits="8" numericFormat="SSCALED"/>
+ <component name="A" bits="8" numericFormat="SSCALED"/>
+ </format>
+ <format name="VK_FORMAT_B8G8R8A8_UINT" class="32-bit" blockSize="4" texelsPerBlock="1">
+ <component name="B" bits="8" numericFormat="UINT"/>
+ <component name="G" bits="8" numericFormat="UINT"/>
+ <component name="R" bits="8" numericFormat="UINT"/>
+ <component name="A" bits="8" numericFormat="UINT"/>
+ </format>
+ <format name="VK_FORMAT_B8G8R8A8_SINT" class="32-bit" blockSize="4" texelsPerBlock="1">
+ <component name="B" bits="8" numericFormat="SINT"/>
+ <component name="G" bits="8" numericFormat="SINT"/>
+ <component name="R" bits="8" numericFormat="SINT"/>
+ <component name="A" bits="8" numericFormat="SINT"/>
+ </format>
+ <format name="VK_FORMAT_B8G8R8A8_SRGB" class="32-bit" blockSize="4" texelsPerBlock="1">
+ <component name="B" bits="8" numericFormat="SRGB"/>
+ <component name="G" bits="8" numericFormat="SRGB"/>
+ <component name="R" bits="8" numericFormat="SRGB"/>
+ <component name="A" bits="8" numericFormat="SRGB"/>
+ </format>
+ <format name="VK_FORMAT_A8B8G8R8_UNORM_PACK32" class="32-bit" blockSize="4" texelsPerBlock="1" packed="32">
+ <component name="A" bits="8" numericFormat="UNORM"/>
+ <component name="B" bits="8" numericFormat="UNORM"/>
+ <component name="G" bits="8" numericFormat="UNORM"/>
+ <component name="R" bits="8" numericFormat="UNORM"/>
+ </format>
+ <format name="VK_FORMAT_A8B8G8R8_SNORM_PACK32" class="32-bit" blockSize="4" texelsPerBlock="1" packed="32">
+ <component name="A" bits="8" numericFormat="SNORM"/>
+ <component name="B" bits="8" numericFormat="SNORM"/>
+ <component name="G" bits="8" numericFormat="SNORM"/>
+ <component name="R" bits="8" numericFormat="SNORM"/>
+ </format>
+ <format name="VK_FORMAT_A8B8G8R8_USCALED_PACK32" class="32-bit" blockSize="4" texelsPerBlock="1" packed="32">
+ <component name="A" bits="8" numericFormat="USCALED"/>
+ <component name="B" bits="8" numericFormat="USCALED"/>
+ <component name="G" bits="8" numericFormat="USCALED"/>
+ <component name="R" bits="8" numericFormat="USCALED"/>
+ </format>
+ <format name="VK_FORMAT_A8B8G8R8_SSCALED_PACK32" class="32-bit" blockSize="4" texelsPerBlock="1" packed="32">
+ <component name="A" bits="8" numericFormat="SSCALED"/>
+ <component name="B" bits="8" numericFormat="SSCALED"/>
+ <component name="G" bits="8" numericFormat="SSCALED"/>
+ <component name="R" bits="8" numericFormat="SSCALED"/>
+ </format>
+ <format name="VK_FORMAT_A8B8G8R8_UINT_PACK32" class="32-bit" blockSize="4" texelsPerBlock="1" packed="32">
+ <component name="A" bits="8" numericFormat="UINT"/>
+ <component name="B" bits="8" numericFormat="UINT"/>
+ <component name="G" bits="8" numericFormat="UINT"/>
+ <component name="R" bits="8" numericFormat="UINT"/>
+ </format>
+ <format name="VK_FORMAT_A8B8G8R8_SINT_PACK32" class="32-bit" blockSize="4" texelsPerBlock="1" packed="32">
+ <component name="A" bits="8" numericFormat="SINT"/>
+ <component name="B" bits="8" numericFormat="SINT"/>
+ <component name="G" bits="8" numericFormat="SINT"/>
+ <component name="R" bits="8" numericFormat="SINT"/>
+ </format>
+ <format name="VK_FORMAT_A8B8G8R8_SRGB_PACK32" class="32-bit" blockSize="4" texelsPerBlock="1" packed="32">
+ <component name="A" bits="8" numericFormat="SRGB"/>
+ <component name="B" bits="8" numericFormat="SRGB"/>
+ <component name="G" bits="8" numericFormat="SRGB"/>
+ <component name="R" bits="8" numericFormat="SRGB"/>
+ </format>
+ <format name="VK_FORMAT_A2R10G10B10_UNORM_PACK32" class="32-bit" blockSize="4" texelsPerBlock="1" packed="32">
+ <component name="A" bits="2" numericFormat="UNORM"/>
+ <component name="R" bits="10" numericFormat="UNORM"/>
+ <component name="G" bits="10" numericFormat="UNORM"/>
+ <component name="B" bits="10" numericFormat="UNORM"/>
+ </format>
+ <format name="VK_FORMAT_A2R10G10B10_SNORM_PACK32" class="32-bit" blockSize="4" texelsPerBlock="1" packed="32">
+ <component name="A" bits="2" numericFormat="SNORM"/>
+ <component name="R" bits="10" numericFormat="SNORM"/>
+ <component name="G" bits="10" numericFormat="SNORM"/>
+ <component name="B" bits="10" numericFormat="SNORM"/>
+ </format>
+ <format name="VK_FORMAT_A2R10G10B10_USCALED_PACK32" class="32-bit" blockSize="4" texelsPerBlock="1" packed="32">
+ <component name="A" bits="2" numericFormat="USCALED"/>
+ <component name="R" bits="10" numericFormat="USCALED"/>
+ <component name="G" bits="10" numericFormat="USCALED"/>
+ <component name="B" bits="10" numericFormat="USCALED"/>
+ </format>
+ <format name="VK_FORMAT_A2R10G10B10_SSCALED_PACK32" class="32-bit" blockSize="4" texelsPerBlock="1" packed="32">
+ <component name="A" bits="2" numericFormat="SSCALED"/>
+ <component name="R" bits="10" numericFormat="SSCALED"/>
+ <component name="G" bits="10" numericFormat="SSCALED"/>
+ <component name="B" bits="10" numericFormat="SSCALED"/>
+ </format>
+ <format name="VK_FORMAT_A2R10G10B10_UINT_PACK32" class="32-bit" blockSize="4" texelsPerBlock="1" packed="32">
+ <component name="A" bits="2" numericFormat="UINT"/>
+ <component name="R" bits="10" numericFormat="UINT"/>
+ <component name="G" bits="10" numericFormat="UINT"/>
+ <component name="B" bits="10" numericFormat="UINT"/>
+ </format>
+ <format name="VK_FORMAT_A2R10G10B10_SINT_PACK32" class="32-bit" blockSize="4" texelsPerBlock="1" packed="32">
+ <component name="A" bits="2" numericFormat="SINT"/>
+ <component name="R" bits="10" numericFormat="SINT"/>
+ <component name="G" bits="10" numericFormat="SINT"/>
+ <component name="B" bits="10" numericFormat="SINT"/>
+ </format>
+ <format name="VK_FORMAT_A2B10G10R10_UNORM_PACK32" class="32-bit" blockSize="4" texelsPerBlock="1" packed="32">
+ <component name="A" bits="2" numericFormat="UNORM"/>
+ <component name="B" bits="10" numericFormat="UNORM"/>
+ <component name="G" bits="10" numericFormat="UNORM"/>
+ <component name="R" bits="10" numericFormat="UNORM"/>
+ <spirvimageformat name="Rgb10A2"/>
+ </format>
+ <format name="VK_FORMAT_A2B10G10R10_SNORM_PACK32" class="32-bit" blockSize="4" texelsPerBlock="1" packed="32">
+ <component name="A" bits="2" numericFormat="SNORM"/>
+ <component name="B" bits="10" numericFormat="SNORM"/>
+ <component name="G" bits="10" numericFormat="SNORM"/>
+ <component name="R" bits="10" numericFormat="SNORM"/>
+ </format>
+ <format name="VK_FORMAT_A2B10G10R10_USCALED_PACK32" class="32-bit" blockSize="4" texelsPerBlock="1" packed="32">
+ <component name="A" bits="2" numericFormat="USCALED"/>
+ <component name="B" bits="10" numericFormat="USCALED"/>
+ <component name="G" bits="10" numericFormat="USCALED"/>
+ <component name="R" bits="10" numericFormat="USCALED"/>
+ </format>
+ <format name="VK_FORMAT_A2B10G10R10_SSCALED_PACK32" class="32-bit" blockSize="4" texelsPerBlock="1" packed="32">
+ <component name="A" bits="2" numericFormat="SSCALED"/>
+ <component name="B" bits="10" numericFormat="SSCALED"/>
+ <component name="G" bits="10" numericFormat="SSCALED"/>
+ <component name="R" bits="10" numericFormat="SSCALED"/>
+ </format>
+ <format name="VK_FORMAT_A2B10G10R10_UINT_PACK32" class="32-bit" blockSize="4" texelsPerBlock="1" packed="32">
+ <component name="A" bits="2" numericFormat="UINT"/>
+ <component name="B" bits="10" numericFormat="UINT"/>
+ <component name="G" bits="10" numericFormat="UINT"/>
+ <component name="R" bits="10" numericFormat="UINT"/>
+ <spirvimageformat name="Rgb10a2ui"/>
+ </format>
+ <format name="VK_FORMAT_A2B10G10R10_SINT_PACK32" class="32-bit" blockSize="4" texelsPerBlock="1" packed="32">
+ <component name="A" bits="2" numericFormat="SINT"/>
+ <component name="B" bits="10" numericFormat="SINT"/>
+ <component name="G" bits="10" numericFormat="SINT"/>
+ <component name="R" bits="10" numericFormat="SINT"/>
+ </format>
+ <format name="VK_FORMAT_R16_UNORM" class="16-bit" blockSize="2" texelsPerBlock="1">
+ <component name="R" bits="16" numericFormat="UNORM"/>
+ <spirvimageformat name="R16"/>
+ </format>
+ <format name="VK_FORMAT_R16_SNORM" class="16-bit" blockSize="2" texelsPerBlock="1">
+ <component name="R" bits="16" numericFormat="SNORM"/>
+ <spirvimageformat name="R16Snorm"/>
+ </format>
+ <format name="VK_FORMAT_R16_USCALED" class="16-bit" blockSize="2" texelsPerBlock="1">
+ <component name="R" bits="16" numericFormat="USCALED"/>
+ </format>
+ <format name="VK_FORMAT_R16_SSCALED" class="16-bit" blockSize="2" texelsPerBlock="1">
+ <component name="R" bits="16" numericFormat="SSCALED"/>
+ </format>
+ <format name="VK_FORMAT_R16_UINT" class="16-bit" blockSize="2" texelsPerBlock="1">
+ <component name="R" bits="16" numericFormat="UINT"/>
+ <spirvimageformat name="R16ui"/>
+ </format>
+ <format name="VK_FORMAT_R16_SINT" class="16-bit" blockSize="2" texelsPerBlock="1">
+ <component name="R" bits="16" numericFormat="SINT"/>
+ <spirvimageformat name="R16i"/>
+ </format>
+ <format name="VK_FORMAT_R16_SFLOAT" class="16-bit" blockSize="2" texelsPerBlock="1">
+ <component name="R" bits="16" numericFormat="SFLOAT"/>
+ <spirvimageformat name="R16f"/>
+ </format>
+ <format name="VK_FORMAT_R16G16_UNORM" class="32-bit" blockSize="4" texelsPerBlock="1">
+ <component name="R" bits="16" numericFormat="UNORM"/>
+ <component name="G" bits="16" numericFormat="UNORM"/>
+ <spirvimageformat name="Rg16"/>
+ </format>
+ <format name="VK_FORMAT_R16G16_SNORM" class="32-bit" blockSize="4" texelsPerBlock="1">
+ <component name="R" bits="16" numericFormat="SNORM"/>
+ <component name="G" bits="16" numericFormat="SNORM"/>
+ <spirvimageformat name="Rg16Snorm"/>
+ </format>
+ <format name="VK_FORMAT_R16G16_USCALED" class="32-bit" blockSize="4" texelsPerBlock="1">
+ <component name="R" bits="16" numericFormat="USCALED"/>
+ <component name="G" bits="16" numericFormat="USCALED"/>
+ </format>
+ <format name="VK_FORMAT_R16G16_SSCALED" class="32-bit" blockSize="4" texelsPerBlock="1">
+ <component name="R" bits="16" numericFormat="SSCALED"/>
+ <component name="G" bits="16" numericFormat="SSCALED"/>
+ </format>
+ <format name="VK_FORMAT_R16G16_UINT" class="32-bit" blockSize="4" texelsPerBlock="1">
+ <component name="R" bits="16" numericFormat="UINT"/>
+ <component name="G" bits="16" numericFormat="UINT"/>
+ <spirvimageformat name="Rg16ui"/>
+ </format>
+ <format name="VK_FORMAT_R16G16_SINT" class="32-bit" blockSize="4" texelsPerBlock="1">
+ <component name="R" bits="16" numericFormat="SINT"/>
+ <component name="G" bits="16" numericFormat="SINT"/>
+ <spirvimageformat name="Rg16i"/>
+ </format>
+ <format name="VK_FORMAT_R16G16_SFLOAT" class="32-bit" blockSize="4" texelsPerBlock="1">
+ <component name="R" bits="16" numericFormat="SFLOAT"/>
+ <component name="G" bits="16" numericFormat="SFLOAT"/>
+ <spirvimageformat name="Rg16f"/>
+ </format>
+ <format name="VK_FORMAT_R16G16B16_UNORM" class="48-bit" blockSize="6" texelsPerBlock="1">
+ <component name="R" bits="16" numericFormat="UNORM"/>
+ <component name="G" bits="16" numericFormat="UNORM"/>
+ <component name="B" bits="16" numericFormat="UNORM"/>
+ </format>
+ <format name="VK_FORMAT_R16G16B16_SNORM" class="48-bit" blockSize="6" texelsPerBlock="1">
+ <component name="R" bits="16" numericFormat="SNORM"/>
+ <component name="G" bits="16" numericFormat="SNORM"/>
+ <component name="B" bits="16" numericFormat="SNORM"/>
+ </format>
+ <format name="VK_FORMAT_R16G16B16_USCALED" class="48-bit" blockSize="6" texelsPerBlock="1">
+ <component name="R" bits="16" numericFormat="USCALED"/>
+ <component name="G" bits="16" numericFormat="USCALED"/>
+ <component name="B" bits="16" numericFormat="USCALED"/>
+ </format>
+ <format name="VK_FORMAT_R16G16B16_SSCALED" class="48-bit" blockSize="6" texelsPerBlock="1">
+ <component name="R" bits="16" numericFormat="SSCALED"/>
+ <component name="G" bits="16" numericFormat="SSCALED"/>
+ <component name="B" bits="16" numericFormat="SSCALED"/>
+ </format>
+ <format name="VK_FORMAT_R16G16B16_UINT" class="48-bit" blockSize="6" texelsPerBlock="1">
+ <component name="R" bits="16" numericFormat="UINT"/>
+ <component name="G" bits="16" numericFormat="UINT"/>
+ <component name="B" bits="16" numericFormat="UINT"/>
+ </format>
+ <format name="VK_FORMAT_R16G16B16_SINT" class="48-bit" blockSize="6" texelsPerBlock="1">
+ <component name="R" bits="16" numericFormat="SINT"/>
+ <component name="G" bits="16" numericFormat="SINT"/>
+ <component name="B" bits="16" numericFormat="SINT"/>
+ </format>
+ <format name="VK_FORMAT_R16G16B16_SFLOAT" class="48-bit" blockSize="6" texelsPerBlock="1">
+ <component name="R" bits="16" numericFormat="SFLOAT"/>
+ <component name="G" bits="16" numericFormat="SFLOAT"/>
+ <component name="B" bits="16" numericFormat="SFLOAT"/>
+ </format>
+ <format name="VK_FORMAT_R16G16B16A16_UNORM" class="64-bit" blockSize="8" texelsPerBlock="1">
+ <component name="R" bits="16" numericFormat="UNORM"/>
+ <component name="G" bits="16" numericFormat="UNORM"/>
+ <component name="B" bits="16" numericFormat="UNORM"/>
+ <component name="A" bits="16" numericFormat="UNORM"/>
+ <spirvimageformat name="Rgba16"/>
+ </format>
+ <format name="VK_FORMAT_R16G16B16A16_SNORM" class="64-bit" blockSize="8" texelsPerBlock="1">
+ <component name="R" bits="16" numericFormat="SNORM"/>
+ <component name="G" bits="16" numericFormat="SNORM"/>
+ <component name="B" bits="16" numericFormat="SNORM"/>
+ <component name="A" bits="16" numericFormat="SNORM"/>
+ <spirvimageformat name="Rgba16Snorm"/>
+ </format>
+ <format name="VK_FORMAT_R16G16B16A16_USCALED" class="64-bit" blockSize="8" texelsPerBlock="1">
+ <component name="R" bits="16" numericFormat="USCALED"/>
+ <component name="G" bits="16" numericFormat="USCALED"/>
+ <component name="B" bits="16" numericFormat="USCALED"/>
+ <component name="A" bits="16" numericFormat="USCALED"/>
+ </format>
+ <format name="VK_FORMAT_R16G16B16A16_SSCALED" class="64-bit" blockSize="8" texelsPerBlock="1">
+ <component name="R" bits="16" numericFormat="SSCALED"/>
+ <component name="G" bits="16" numericFormat="SSCALED"/>
+ <component name="B" bits="16" numericFormat="SSCALED"/>
+ <component name="A" bits="16" numericFormat="SSCALED"/>
+ </format>
+ <format name="VK_FORMAT_R16G16B16A16_UINT" class="64-bit" blockSize="8" texelsPerBlock="1">
+ <component name="R" bits="16" numericFormat="UINT"/>
+ <component name="G" bits="16" numericFormat="UINT"/>
+ <component name="B" bits="16" numericFormat="UINT"/>
+ <component name="A" bits="16" numericFormat="UINT"/>
+ <spirvimageformat name="Rgba16ui"/>
+ </format>
+ <format name="VK_FORMAT_R16G16B16A16_SINT" class="64-bit" blockSize="8" texelsPerBlock="1">
+ <component name="R" bits="16" numericFormat="SINT"/>
+ <component name="G" bits="16" numericFormat="SINT"/>
+ <component name="B" bits="16" numericFormat="SINT"/>
+ <component name="A" bits="16" numericFormat="SINT"/>
+ <spirvimageformat name="Rgba16i"/>
+ </format>
+ <format name="VK_FORMAT_R16G16B16A16_SFLOAT" class="64-bit" blockSize="8" texelsPerBlock="1">
+ <component name="R" bits="16" numericFormat="SFLOAT"/>
+ <component name="G" bits="16" numericFormat="SFLOAT"/>
+ <component name="B" bits="16" numericFormat="SFLOAT"/>
+ <component name="A" bits="16" numericFormat="SFLOAT"/>
+ <spirvimageformat name="Rgba16f"/>
+ </format>
+ <format name="VK_FORMAT_R32_UINT" class="32-bit" blockSize="4" texelsPerBlock="1">
+ <component name="R" bits="32" numericFormat="UINT"/>
+ <spirvimageformat name="R32ui"/>
+ </format>
+ <format name="VK_FORMAT_R32_SINT" class="32-bit" blockSize="4" texelsPerBlock="1">
+ <component name="R" bits="32" numericFormat="SINT"/>
+ <spirvimageformat name="R32i"/>
+ </format>
+ <format name="VK_FORMAT_R32_SFLOAT" class="32-bit" blockSize="4" texelsPerBlock="1">
+ <component name="R" bits="32" numericFormat="SFLOAT"/>
+ <spirvimageformat name="R32f"/>
+ </format>
+ <format name="VK_FORMAT_R32G32_UINT" class="64-bit" blockSize="8" texelsPerBlock="1">
+ <component name="R" bits="32" numericFormat="UINT"/>
+ <component name="G" bits="32" numericFormat="UINT"/>
+ <spirvimageformat name="Rg32ui"/>
+ </format>
+ <format name="VK_FORMAT_R32G32_SINT" class="64-bit" blockSize="8" texelsPerBlock="1">
+ <component name="R" bits="32" numericFormat="SINT"/>
+ <component name="G" bits="32" numericFormat="SINT"/>
+ <spirvimageformat name="Rg32i"/>
+ </format>
+ <format name="VK_FORMAT_R32G32_SFLOAT" class="64-bit" blockSize="8" texelsPerBlock="1">
+ <component name="R" bits="32" numericFormat="SFLOAT"/>
+ <component name="G" bits="32" numericFormat="SFLOAT"/>
+ <spirvimageformat name="Rg32f"/>
+ </format>
+ <format name="VK_FORMAT_R32G32B32_UINT" class="96-bit" blockSize="12" texelsPerBlock="1">
+ <component name="R" bits="32" numericFormat="UINT"/>
+ <component name="G" bits="32" numericFormat="UINT"/>
+ <component name="B" bits="32" numericFormat="UINT"/>
+ </format>
+ <format name="VK_FORMAT_R32G32B32_SINT" class="96-bit" blockSize="12" texelsPerBlock="1">
+ <component name="R" bits="32" numericFormat="SINT"/>
+ <component name="G" bits="32" numericFormat="SINT"/>
+ <component name="B" bits="32" numericFormat="SINT"/>
+ </format>
+ <format name="VK_FORMAT_R32G32B32_SFLOAT" class="96-bit" blockSize="12" texelsPerBlock="1">
+ <component name="R" bits="32" numericFormat="SFLOAT"/>
+ <component name="G" bits="32" numericFormat="SFLOAT"/>
+ <component name="B" bits="32" numericFormat="SFLOAT"/>
+ </format>
+ <format name="VK_FORMAT_R32G32B32A32_UINT" class="128-bit" blockSize="16" texelsPerBlock="1">
+ <component name="R" bits="32" numericFormat="UINT"/>
+ <component name="G" bits="32" numericFormat="UINT"/>
+ <component name="B" bits="32" numericFormat="UINT"/>
+ <component name="A" bits="32" numericFormat="UINT"/>
+ <spirvimageformat name="Rgba32ui"/>
+ </format>
+ <format name="VK_FORMAT_R32G32B32A32_SINT" class="128-bit" blockSize="16" texelsPerBlock="1">
+ <component name="R" bits="32" numericFormat="SINT"/>
+ <component name="G" bits="32" numericFormat="SINT"/>
+ <component name="B" bits="32" numericFormat="SINT"/>
+ <component name="A" bits="32" numericFormat="SINT"/>
+ <spirvimageformat name="Rgba32i"/>
+ </format>
+ <format name="VK_FORMAT_R32G32B32A32_SFLOAT" class="128-bit" blockSize="16" texelsPerBlock="1">
+ <component name="R" bits="32" numericFormat="SFLOAT"/>
+ <component name="G" bits="32" numericFormat="SFLOAT"/>
+ <component name="B" bits="32" numericFormat="SFLOAT"/>
+ <component name="A" bits="32" numericFormat="SFLOAT"/>
+ <spirvimageformat name="Rgba32f"/>
+ </format>
+ <format name="VK_FORMAT_R64_UINT" class="64-bit" blockSize="8" texelsPerBlock="1">
+ <component name="R" bits="64" numericFormat="UINT"/>
+ <spirvimageformat name="R64ui"/>
+ </format>
+ <format name="VK_FORMAT_R64_SINT" class="64-bit" blockSize="8" texelsPerBlock="1">
+ <component name="R" bits="64" numericFormat="SINT"/>
+ <spirvimageformat name="R64i"/>
+ </format>
+ <format name="VK_FORMAT_R64_SFLOAT" class="64-bit" blockSize="8" texelsPerBlock="1">
+ <component name="R" bits="64" numericFormat="SFLOAT"/>
+ </format>
+ <format name="VK_FORMAT_R64G64_UINT" class="128-bit" blockSize="16" texelsPerBlock="1">
+ <component name="R" bits="64" numericFormat="UINT"/>
+ <component name="B" bits="64" numericFormat="UINT"/>
+ </format>
+ <format name="VK_FORMAT_R64G64_SINT" class="128-bit" blockSize="16" texelsPerBlock="1">
+ <component name="R" bits="64" numericFormat="SINT"/>
+ <component name="B" bits="64" numericFormat="SINT"/>
+ </format>
+ <format name="VK_FORMAT_R64G64_SFLOAT" class="128-bit" blockSize="16" texelsPerBlock="1">
+ <component name="R" bits="64" numericFormat="SFLOAT"/>
+ <component name="B" bits="64" numericFormat="SFLOAT"/>
+ </format>
+ <format name="VK_FORMAT_R64G64B64_UINT" class="192-bit" blockSize="24" texelsPerBlock="1">
+ <component name="R" bits="64" numericFormat="UINT"/>
+ <component name="G" bits="64" numericFormat="UINT"/>
+ <component name="B" bits="64" numericFormat="UINT"/>
+ </format>
+ <format name="VK_FORMAT_R64G64B64_SINT" class="192-bit" blockSize="24" texelsPerBlock="1">
+ <component name="R" bits="64" numericFormat="SINT"/>
+ <component name="G" bits="64" numericFormat="SINT"/>
+ <component name="B" bits="64" numericFormat="SINT"/>
+ </format>
+ <format name="VK_FORMAT_R64G64B64_SFLOAT" class="192-bit" blockSize="24" texelsPerBlock="1">
+ <component name="R" bits="64" numericFormat="SFLOAT"/>
+ <component name="G" bits="64" numericFormat="SFLOAT"/>
+ <component name="B" bits="64" numericFormat="SFLOAT"/>
+ </format>
+ <format name="VK_FORMAT_R64G64B64A64_UINT" class="256-bit" blockSize="32" texelsPerBlock="1">
+ <component name="R" bits="64" numericFormat="UINT"/>
+ <component name="G" bits="64" numericFormat="UINT"/>
+ <component name="B" bits="64" numericFormat="UINT"/>
+ <component name="A" bits="64" numericFormat="UINT"/>
+ </format>
+ <format name="VK_FORMAT_R64G64B64A64_SINT" class="256-bit" blockSize="32" texelsPerBlock="1">
+ <component name="R" bits="64" numericFormat="SINT"/>
+ <component name="G" bits="64" numericFormat="SINT"/>
+ <component name="B" bits="64" numericFormat="SINT"/>
+ <component name="A" bits="64" numericFormat="SINT"/>
+ </format>
+ <format name="VK_FORMAT_R64G64B64A64_SFLOAT" class="256-bit" blockSize="32" texelsPerBlock="1">
+ <component name="R" bits="64" numericFormat="SFLOAT"/>
+ <component name="G" bits="64" numericFormat="SFLOAT"/>
+ <component name="B" bits="64" numericFormat="SFLOAT"/>
+ <component name="A" bits="64" numericFormat="SFLOAT"/>
+ </format>
+ <format name="VK_FORMAT_B10G11R11_UFLOAT_PACK32" class="32-bit" blockSize="4" texelsPerBlock="1" packed="32">
+ <component name="B" bits="10" numericFormat="UFLOAT"/>
+ <component name="G" bits="11" numericFormat="UFLOAT"/>
+ <component name="R" bits="10" numericFormat="UFLOAT"/>
+ <spirvimageformat name="R11fG11fB10f"/>
+ </format>
+ <format name="VK_FORMAT_E5B9G9R9_UFLOAT_PACK32" class="32-bit" blockSize="4" texelsPerBlock="1" packed="32">
+ <component name="B" bits="9" numericFormat="UFLOAT"/>
+ <component name="G" bits="9" numericFormat="UFLOAT"/>
+ <component name="R" bits="9" numericFormat="UFLOAT"/>
+ </format>
+ <format name="VK_FORMAT_D16_UNORM" class="D16" blockSize="2" texelsPerBlock="1">
+ <component name="D" bits="16" numericFormat="UNORM"/>
+ </format>
+ <format name="VK_FORMAT_X8_D24_UNORM_PACK32" class="D24" blockSize="4" texelsPerBlock="1" packed="32">
+ <component name="D" bits="24" numericFormat="UNORM"/>
+ </format>
+ <format name="VK_FORMAT_D32_SFLOAT" class="D32" blockSize="4" texelsPerBlock="1">
+ <component name="D" bits="32" numericFormat="SFLOAT"/>
+ </format>
+ <format name="VK_FORMAT_S8_UINT" class="S8" blockSize="1" texelsPerBlock="1">
+ <component name="S" bits="8" numericFormat="UINT"/>
+ </format>
+ <format name="VK_FORMAT_D16_UNORM_S8_UINT" class="D16S8" blockSize="3" texelsPerBlock="1">
+ <component name="D" bits="16" numericFormat="UNORM"/>
+ <component name="S" bits="8" numericFormat="UINT"/>
+ </format>
+ <format name="VK_FORMAT_D24_UNORM_S8_UINT" class="D24S8" blockSize="4" texelsPerBlock="1">
+ <component name="D" bits="24" numericFormat="UNORM"/>
+ <component name="S" bits="8" numericFormat="UINT"/>
+ </format>
+ <format name="VK_FORMAT_D32_SFLOAT_S8_UINT" class="D32S8" blockSize="5" texelsPerBlock="1">
+ <component name="D" bits="32" numericFormat="SFLOAT"/>
+ <component name="S" bits="8" numericFormat="UINT"/>
+ </format>
+ <format name="VK_FORMAT_BC1_RGB_UNORM_BLOCK" class="BC1_RGB" blockSize="8" texelsPerBlock="16" blockExtent="4,4,1" compressed="BC">
+ <component name="R" bits="compressed" numericFormat="UNORM"/>
+ <component name="G" bits="compressed" numericFormat="UNORM"/>
+ <component name="B" bits="compressed" numericFormat="UNORM"/>
+ </format>
+ <format name="VK_FORMAT_BC1_RGB_SRGB_BLOCK" class="BC1_RGB" blockSize="8" texelsPerBlock="16" blockExtent="4,4,1" compressed="BC">
+ <component name="R" bits="compressed" numericFormat="SRGB"/>
+ <component name="G" bits="compressed" numericFormat="SRGB"/>
+ <component name="B" bits="compressed" numericFormat="SRGB"/>
+ </format>
+ <format name="VK_FORMAT_BC1_RGBA_UNORM_BLOCK" class="BC1_RGBA" blockSize="8" texelsPerBlock="16" blockExtent="4,4,1" compressed="BC">
+ <component name="R" bits="compressed" numericFormat="UNORM"/>
+ <component name="G" bits="compressed" numericFormat="UNORM"/>
+ <component name="B" bits="compressed" numericFormat="UNORM"/>
+ <component name="A" bits="compressed" numericFormat="UNORM"/>
+ </format>
+ <format name="VK_FORMAT_BC1_RGBA_SRGB_BLOCK" class="BC1_RGBA" blockSize="8" texelsPerBlock="16" blockExtent="4,4,1" compressed="BC">
+ <component name="R" bits="compressed" numericFormat="SRGB"/>
+ <component name="G" bits="compressed" numericFormat="SRGB"/>
+ <component name="B" bits="compressed" numericFormat="SRGB"/>
+ <component name="A" bits="compressed" numericFormat="SRGB"/>
+ </format>
+ <format name="VK_FORMAT_BC2_UNORM_BLOCK" class="BC2" blockSize="16" texelsPerBlock="16" blockExtent="4,4,1" compressed="BC">
+ <component name="R" bits="compressed" numericFormat="UNORM"/>
+ <component name="G" bits="compressed" numericFormat="UNORM"/>
+ <component name="B" bits="compressed" numericFormat="UNORM"/>
+ <component name="A" bits="compressed" numericFormat="UNORM"/>
+ </format>
+ <format name="VK_FORMAT_BC2_SRGB_BLOCK" class="BC2" blockSize="16" texelsPerBlock="16" blockExtent="4,4,1" compressed="BC">
+ <component name="R" bits="compressed" numericFormat="SRGB"/>
+ <component name="G" bits="compressed" numericFormat="SRGB"/>
+ <component name="B" bits="compressed" numericFormat="SRGB"/>
+ <component name="A" bits="compressed" numericFormat="SRGB"/>
+ </format>
+ <format name="VK_FORMAT_BC3_UNORM_BLOCK" class="BC3" blockSize="16" texelsPerBlock="16" blockExtent="4,4,1" compressed="BC">
+ <component name="R" bits="compressed" numericFormat="UNORM"/>
+ <component name="G" bits="compressed" numericFormat="UNORM"/>
+ <component name="B" bits="compressed" numericFormat="UNORM"/>
+ <component name="A" bits="compressed" numericFormat="UNORM"/>
+ </format>
+ <format name="VK_FORMAT_BC3_SRGB_BLOCK" class="BC3" blockSize="16" texelsPerBlock="16" blockExtent="4,4,1" compressed="BC">
+ <component name="R" bits="compressed" numericFormat="SRGB"/>
+ <component name="G" bits="compressed" numericFormat="SRGB"/>
+ <component name="B" bits="compressed" numericFormat="SRGB"/>
+ <component name="A" bits="compressed" numericFormat="SRGB"/>
+ </format>
+ <format name="VK_FORMAT_BC4_UNORM_BLOCK" class="BC4" blockSize="8" texelsPerBlock="16" blockExtent="4,4,1" compressed="BC">
+ <component name="R" bits="compressed" numericFormat="UNORM"/>
+ </format>
+ <format name="VK_FORMAT_BC4_SNORM_BLOCK" class="BC4" blockSize="8" texelsPerBlock="16" blockExtent="4,4,1" compressed="BC">
+ <component name="R" bits="compressed" numericFormat="SRGB"/>
+ </format>
+ <format name="VK_FORMAT_BC5_UNORM_BLOCK" class="BC5" blockSize="16" texelsPerBlock="16" blockExtent="4,4,1" compressed="BC">
+ <component name="R" bits="compressed" numericFormat="UNORM"/>
+ <component name="G" bits="compressed" numericFormat="UNORM"/>
+ </format>
+ <format name="VK_FORMAT_BC5_SNORM_BLOCK" class="BC5" blockSize="16" texelsPerBlock="16" blockExtent="4,4,1" compressed="BC">
+ <component name="R" bits="compressed" numericFormat="SRGB"/>
+ <component name="G" bits="compressed" numericFormat="SRGB"/>
+ </format>
+ <format name="VK_FORMAT_BC6H_UFLOAT_BLOCK" class="BC6H" blockSize="16" texelsPerBlock="16" blockExtent="4,4,1" compressed="BC">
+ <component name="R" bits="compressed" numericFormat="UFLOAT"/>
+ <component name="G" bits="compressed" numericFormat="UFLOAT"/>
+ <component name="B" bits="compressed" numericFormat="UFLOAT"/>
+ </format>
+ <format name="VK_FORMAT_BC6H_SFLOAT_BLOCK" class="BC6H" blockSize="16" texelsPerBlock="16" blockExtent="4,4,1" compressed="BC">
+ <component name="R" bits="compressed" numericFormat="SFLOAT"/>
+ <component name="G" bits="compressed" numericFormat="SFLOAT"/>
+ <component name="B" bits="compressed" numericFormat="SFLOAT"/>
+ </format>
+ <format name="VK_FORMAT_BC7_UNORM_BLOCK" class="BC7" blockSize="16" texelsPerBlock="16" blockExtent="4,4,1" compressed="BC">
+ <component name="R" bits="compressed" numericFormat="UNORM"/>
+ <component name="G" bits="compressed" numericFormat="UNORM"/>
+ <component name="B" bits="compressed" numericFormat="UNORM"/>
+ <component name="A" bits="compressed" numericFormat="UNORM"/>
+ </format>
+ <format name="VK_FORMAT_BC7_SRGB_BLOCK" class="BC7" blockSize="16" texelsPerBlock="16" blockExtent="4,4,1" compressed="BC">
+ <component name="R" bits="compressed" numericFormat="SRGB"/>
+ <component name="G" bits="compressed" numericFormat="SRGB"/>
+ <component name="B" bits="compressed" numericFormat="SRGB"/>
+ <component name="A" bits="compressed" numericFormat="SRGB"/>
+ </format>
+ <format name="VK_FORMAT_ETC2_R8G8B8_UNORM_BLOCK" class="ETC2_RGB" blockSize="8" texelsPerBlock="16" blockExtent="4,4,1" compressed="ETC2">
+ <component name="R" bits="compressed" numericFormat="UNORM"/>
+ <component name="G" bits="compressed" numericFormat="UNORM"/>
+ <component name="B" bits="compressed" numericFormat="UNORM"/>
+ </format>
+ <format name="VK_FORMAT_ETC2_R8G8B8_SRGB_BLOCK" class="ETC2_RGB" blockSize="8" texelsPerBlock="16" blockExtent="4,4,1" compressed="ETC2">
+ <component name="R" bits="compressed" numericFormat="SRGB"/>
+ <component name="G" bits="compressed" numericFormat="SRGB"/>
+ <component name="B" bits="compressed" numericFormat="SRGB"/>
+ </format>
+ <format name="VK_FORMAT_ETC2_R8G8B8A1_UNORM_BLOCK" class="ETC2_RGBA" blockSize="8" texelsPerBlock="16" blockExtent="4,4,1" compressed="ETC2">
+ <component name="R" bits="compressed" numericFormat="UNORM"/>
+ <component name="G" bits="compressed" numericFormat="UNORM"/>
+ <component name="B" bits="compressed" numericFormat="UNORM"/>
+ <component name="A" bits="compressed" numericFormat="UNORM"/>
+ </format>
+ <format name="VK_FORMAT_ETC2_R8G8B8A1_SRGB_BLOCK" class="ETC2_RGBA" blockSize="8" texelsPerBlock="16" blockExtent="4,4,1" compressed="ETC2">
+ <component name="R" bits="compressed" numericFormat="SRGB"/>
+ <component name="G" bits="compressed" numericFormat="SRGB"/>
+ <component name="B" bits="compressed" numericFormat="SRGB"/>
+ <component name="A" bits="compressed" numericFormat="SRGB"/>
+ </format>
+ <format name="VK_FORMAT_ETC2_R8G8B8A8_UNORM_BLOCK" class="ETC2_EAC_RGBA" blockSize="16" texelsPerBlock="16" blockExtent="4,4,1" compressed="ETC2">
+ <component name="R" bits="compressed" numericFormat="UNORM"/>
+ <component name="G" bits="compressed" numericFormat="UNORM"/>
+ <component name="B" bits="compressed" numericFormat="UNORM"/>
+ <component name="A" bits="compressed" numericFormat="UNORM"/>
+ </format>
+ <format name="VK_FORMAT_ETC2_R8G8B8A8_SRGB_BLOCK" class="ETC2_EAC_RGBA" blockSize="16" texelsPerBlock="16" blockExtent="4,4,1" compressed="ETC2">
+ <component name="R" bits="compressed" numericFormat="SRGB"/>
+ <component name="G" bits="compressed" numericFormat="SRGB"/>
+ <component name="B" bits="compressed" numericFormat="SRGB"/>
+ <component name="A" bits="compressed" numericFormat="SRGB"/>
+ </format>
+ <format name="VK_FORMAT_EAC_R11_UNORM_BLOCK" class="EAC_R" blockSize="8" texelsPerBlock="16" blockExtent="4,4,1" compressed="EAC">
+ <component name="R" bits="11" numericFormat="UNORM"/>
+ </format>
+ <format name="VK_FORMAT_EAC_R11_SNORM_BLOCK" class="EAC_R" blockSize="8" texelsPerBlock="16" blockExtent="4,4,1" compressed="EAC">
+ <component name="R" bits="11" numericFormat="SNORM"/>
+ </format>
+ <format name="VK_FORMAT_EAC_R11G11_UNORM_BLOCK" class="EAC_RG" blockSize="16" texelsPerBlock="16" blockExtent="4,4,1" compressed="EAC">
+ <component name="R" bits="11" numericFormat="UNORM"/>
+ <component name="G" bits="11" numericFormat="UNORM"/>
+ </format>
+ <format name="VK_FORMAT_EAC_R11G11_SNORM_BLOCK" class="EAC_RG" blockSize="16" texelsPerBlock="16" blockExtent="4,4,1" compressed="EAC">
+ <component name="R" bits="11" numericFormat="SNORM"/>
+ <component name="G" bits="11" numericFormat="SNORM"/>
+ </format>
+ <format name="VK_FORMAT_ASTC_4x4_UNORM_BLOCK" class="ASTC_4x4" blockSize="16" texelsPerBlock="16" blockExtent="4,4,1" compressed="ASTC LDR">
+ <component name="R" bits="compressed" numericFormat="UNORM"/>
+ <component name="G" bits="compressed" numericFormat="UNORM"/>
+ <component name="B" bits="compressed" numericFormat="UNORM"/>
+ <component name="A" bits="compressed" numericFormat="UNORM"/>
+ </format>
+ <format name="VK_FORMAT_ASTC_4x4_SRGB_BLOCK" class="ASTC_4x4" blockSize="16" texelsPerBlock="16" blockExtent="4,4,1" compressed="ASTC LDR">
+ <component name="R" bits="compressed" numericFormat="SRGB"/>
+ <component name="G" bits="compressed" numericFormat="SRGB"/>
+ <component name="B" bits="compressed" numericFormat="SRGB"/>
+ <component name="A" bits="compressed" numericFormat="SRGB"/>
+ </format>
+ <format name="VK_FORMAT_ASTC_5x4_UNORM_BLOCK" class="ASTC_5x4" blockSize="16" texelsPerBlock="20" blockExtent="5,4,1" compressed="ASTC LDR">
+ <component name="R" bits="compressed" numericFormat="UNORM"/>
+ <component name="G" bits="compressed" numericFormat="UNORM"/>
+ <component name="B" bits="compressed" numericFormat="UNORM"/>
+ <component name="A" bits="compressed" numericFormat="UNORM"/>
+ </format>
+ <format name="VK_FORMAT_ASTC_5x4_SRGB_BLOCK" class="ASTC_5x4" blockSize="16" texelsPerBlock="20" blockExtent="5,4,1" compressed="ASTC LDR">
+ <component name="R" bits="compressed" numericFormat="SRGB"/>
+ <component name="G" bits="compressed" numericFormat="SRGB"/>
+ <component name="B" bits="compressed" numericFormat="SRGB"/>
+ <component name="A" bits="compressed" numericFormat="SRGB"/>
+ </format>
+ <format name="VK_FORMAT_ASTC_5x5_UNORM_BLOCK" class="ASTC_5x5" blockSize="16" texelsPerBlock="25" blockExtent="5,5,1" compressed="ASTC LDR">
+ <component name="R" bits="compressed" numericFormat="UNORM"/>
+ <component name="G" bits="compressed" numericFormat="UNORM"/>
+ <component name="B" bits="compressed" numericFormat="UNORM"/>
+ <component name="A" bits="compressed" numericFormat="UNORM"/>
+ </format>
+ <format name="VK_FORMAT_ASTC_5x5_SRGB_BLOCK" class="ASTC_5x5" blockSize="16" texelsPerBlock="25" blockExtent="5,5,1" compressed="ASTC LDR">
+ <component name="R" bits="compressed" numericFormat="SRGB"/>
+ <component name="G" bits="compressed" numericFormat="SRGB"/>
+ <component name="B" bits="compressed" numericFormat="SRGB"/>
+ <component name="A" bits="compressed" numericFormat="SRGB"/>
+ </format>
+ <format name="VK_FORMAT_ASTC_6x5_UNORM_BLOCK" class="ASTC_6x5" blockSize="16" texelsPerBlock="30" blockExtent="6,5,1" compressed="ASTC LDR">
+ <component name="R" bits="compressed" numericFormat="UNORM"/>
+ <component name="G" bits="compressed" numericFormat="UNORM"/>
+ <component name="B" bits="compressed" numericFormat="UNORM"/>
+ <component name="A" bits="compressed" numericFormat="UNORM"/>
+ </format>
+ <format name="VK_FORMAT_ASTC_6x5_SRGB_BLOCK" class="ASTC_6x5" blockSize="16" texelsPerBlock="30" blockExtent="6,5,1" compressed="ASTC LDR">
+ <component name="R" bits="compressed" numericFormat="SRGB"/>
+ <component name="G" bits="compressed" numericFormat="SRGB"/>
+ <component name="B" bits="compressed" numericFormat="SRGB"/>
+ <component name="A" bits="compressed" numericFormat="SRGB"/>
+ </format>
+ <format name="VK_FORMAT_ASTC_6x6_UNORM_BLOCK" class="ASTC_6x6" blockSize="16" texelsPerBlock="36" blockExtent="6,6,1" compressed="ASTC LDR">
+ <component name="R" bits="compressed" numericFormat="UNORM"/>
+ <component name="G" bits="compressed" numericFormat="UNORM"/>
+ <component name="B" bits="compressed" numericFormat="UNORM"/>
+ <component name="A" bits="compressed" numericFormat="UNORM"/>
+ </format>
+ <format name="VK_FORMAT_ASTC_6x6_SRGB_BLOCK" class="ASTC_6x6" blockSize="16" texelsPerBlock="36" blockExtent="6,6,1" compressed="ASTC LDR">
+ <component name="R" bits="compressed" numericFormat="SRGB"/>
+ <component name="G" bits="compressed" numericFormat="SRGB"/>
+ <component name="B" bits="compressed" numericFormat="SRGB"/>
+ <component name="A" bits="compressed" numericFormat="SRGB"/>
+ </format>
+ <format name="VK_FORMAT_ASTC_8x5_UNORM_BLOCK" class="ASTC_8x5" blockSize="16" texelsPerBlock="40" blockExtent="8,5,1" compressed="ASTC LDR">
+ <component name="R" bits="compressed" numericFormat="UNORM"/>
+ <component name="G" bits="compressed" numericFormat="UNORM"/>
+ <component name="B" bits="compressed" numericFormat="UNORM"/>
+ <component name="A" bits="compressed" numericFormat="UNORM"/>
+ </format>
+ <format name="VK_FORMAT_ASTC_8x5_SRGB_BLOCK" class="ASTC_8x5" blockSize="16" texelsPerBlock="40" blockExtent="8,5,1" compressed="ASTC LDR">
+ <component name="R" bits="compressed" numericFormat="SRGB"/>
+ <component name="G" bits="compressed" numericFormat="SRGB"/>
+ <component name="B" bits="compressed" numericFormat="SRGB"/>
+ <component name="A" bits="compressed" numericFormat="SRGB"/>
+ </format>
+ <format name="VK_FORMAT_ASTC_8x6_UNORM_BLOCK" class="ASTC_8x6" blockSize="16" texelsPerBlock="48" blockExtent="8,6,1" compressed="ASTC LDR">
+ <component name="R" bits="compressed" numericFormat="UNORM"/>
+ <component name="G" bits="compressed" numericFormat="UNORM"/>
+ <component name="B" bits="compressed" numericFormat="UNORM"/>
+ <component name="A" bits="compressed" numericFormat="UNORM"/>
+ </format>
+ <format name="VK_FORMAT_ASTC_8x6_SRGB_BLOCK" class="ASTC_8x6" blockSize="16" texelsPerBlock="48" blockExtent="8,6,1" compressed="ASTC LDR">
+ <component name="R" bits="compressed" numericFormat="SRGB"/>
+ <component name="G" bits="compressed" numericFormat="SRGB"/>
+ <component name="B" bits="compressed" numericFormat="SRGB"/>
+ <component name="A" bits="compressed" numericFormat="SRGB"/>
+ </format>
+ <format name="VK_FORMAT_ASTC_8x8_UNORM_BLOCK" class="ASTC_8x8" blockSize="16" texelsPerBlock="64" blockExtent="8,8,1" compressed="ASTC LDR">
+ <component name="R" bits="compressed" numericFormat="UNORM"/>
+ <component name="G" bits="compressed" numericFormat="UNORM"/>
+ <component name="B" bits="compressed" numericFormat="UNORM"/>
+ <component name="A" bits="compressed" numericFormat="UNORM"/>
+ </format>
+ <format name="VK_FORMAT_ASTC_8x8_SRGB_BLOCK" class="ASTC_8x8" blockSize="16" texelsPerBlock="64" blockExtent="8,8,1" compressed="ASTC LDR">
+ <component name="R" bits="compressed" numericFormat="SRGB"/>
+ <component name="G" bits="compressed" numericFormat="SRGB"/>
+ <component name="B" bits="compressed" numericFormat="SRGB"/>
+ <component name="A" bits="compressed" numericFormat="SRGB"/>
+ </format>
+ <format name="VK_FORMAT_ASTC_10x5_UNORM_BLOCK" class="ASTC_10x5" blockSize="16" texelsPerBlock="50" blockExtent="10,5,1" compressed="ASTC LDR">
+ <component name="R" bits="compressed" numericFormat="UNORM"/>
+ <component name="G" bits="compressed" numericFormat="UNORM"/>
+ <component name="B" bits="compressed" numericFormat="UNORM"/>
+ <component name="A" bits="compressed" numericFormat="UNORM"/>
+ </format>
+ <format name="VK_FORMAT_ASTC_10x5_SRGB_BLOCK" class="ASTC_10x5" blockSize="16" texelsPerBlock="50" blockExtent="10,5,1" compressed="ASTC LDR">
+ <component name="R" bits="compressed" numericFormat="SRGB"/>
+ <component name="G" bits="compressed" numericFormat="SRGB"/>
+ <component name="B" bits="compressed" numericFormat="SRGB"/>
+ <component name="A" bits="compressed" numericFormat="SRGB"/>
+ </format>
+ <format name="VK_FORMAT_ASTC_10x6_UNORM_BLOCK" class="ASTC_10x6" blockSize="16" texelsPerBlock="60" blockExtent="10,6,1" compressed="ASTC LDR">
+ <component name="R" bits="compressed" numericFormat="UNORM"/>
+ <component name="G" bits="compressed" numericFormat="UNORM"/>
+ <component name="B" bits="compressed" numericFormat="UNORM"/>
+ <component name="A" bits="compressed" numericFormat="UNORM"/>
+ </format>
+ <format name="VK_FORMAT_ASTC_10x6_SRGB_BLOCK" class="ASTC_10x6" blockSize="16" texelsPerBlock="60" blockExtent="10,6,1" compressed="ASTC LDR">
+ <component name="R" bits="compressed" numericFormat="SRGB"/>
+ <component name="G" bits="compressed" numericFormat="SRGB"/>
+ <component name="B" bits="compressed" numericFormat="SRGB"/>
+ <component name="A" bits="compressed" numericFormat="SRGB"/>
+ </format>
+ <format name="VK_FORMAT_ASTC_10x8_UNORM_BLOCK" class="ASTC_10x8" blockSize="16" texelsPerBlock="80" blockExtent="10,8,1" compressed="ASTC LDR">
+ <component name="R" bits="compressed" numericFormat="UNORM"/>
+ <component name="G" bits="compressed" numericFormat="UNORM"/>
+ <component name="B" bits="compressed" numericFormat="UNORM"/>
+ <component name="A" bits="compressed" numericFormat="UNORM"/>
+ </format>
+ <format name="VK_FORMAT_ASTC_10x8_SRGB_BLOCK" class="ASTC_10x8" blockSize="16" texelsPerBlock="80" blockExtent="10,8,1" compressed="ASTC LDR">
+ <component name="R" bits="compressed" numericFormat="SRGB"/>
+ <component name="G" bits="compressed" numericFormat="SRGB"/>
+ <component name="B" bits="compressed" numericFormat="SRGB"/>
+ <component name="A" bits="compressed" numericFormat="SRGB"/>
+ </format>
+ <format name="VK_FORMAT_ASTC_10x10_UNORM_BLOCK" class="ASTC_10x10" blockSize="16" texelsPerBlock="100" blockExtent="10,10,1" compressed="ASTC LDR">
+ <component name="R" bits="compressed" numericFormat="UNORM"/>
+ <component name="G" bits="compressed" numericFormat="UNORM"/>
+ <component name="B" bits="compressed" numericFormat="UNORM"/>
+ <component name="A" bits="compressed" numericFormat="UNORM"/>
+ </format>
+ <format name="VK_FORMAT_ASTC_10x10_SRGB_BLOCK" class="ASTC_10x10" blockSize="16" texelsPerBlock="100" blockExtent="10,10,1" compressed="ASTC LDR">
+ <component name="R" bits="compressed" numericFormat="SRGB"/>
+ <component name="G" bits="compressed" numericFormat="SRGB"/>
+ <component name="B" bits="compressed" numericFormat="SRGB"/>
+ <component name="A" bits="compressed" numericFormat="SRGB"/>
+ </format>
+ <format name="VK_FORMAT_ASTC_12x10_UNORM_BLOCK" class="ASTC_12x10" blockSize="16" texelsPerBlock="120" blockExtent="12,10,1" compressed="ASTC LDR">
+ <component name="R" bits="compressed" numericFormat="UNORM"/>
+ <component name="G" bits="compressed" numericFormat="UNORM"/>
+ <component name="B" bits="compressed" numericFormat="UNORM"/>
+ <component name="A" bits="compressed" numericFormat="UNORM"/>
+ </format>
+ <format name="VK_FORMAT_ASTC_12x10_SRGB_BLOCK" class="ASTC_12x10" blockSize="16" texelsPerBlock="120" blockExtent="12,10,1" compressed="ASTC LDR">
+ <component name="R" bits="compressed" numericFormat="SRGB"/>
+ <component name="G" bits="compressed" numericFormat="SRGB"/>
+ <component name="B" bits="compressed" numericFormat="SRGB"/>
+ <component name="A" bits="compressed" numericFormat="SRGB"/>
+ </format>
+ <format name="VK_FORMAT_ASTC_12x12_UNORM_BLOCK" class="ASTC_12x12" blockSize="16" texelsPerBlock="144" blockExtent="12,12,1" compressed="ASTC LDR">
+ <component name="R" bits="compressed" numericFormat="UNORM"/>
+ <component name="G" bits="compressed" numericFormat="UNORM"/>
+ <component name="B" bits="compressed" numericFormat="UNORM"/>
+ <component name="A" bits="compressed" numericFormat="UNORM"/>
+ </format>
+ <format name="VK_FORMAT_ASTC_12x12_SRGB_BLOCK" class="ASTC_12x12" blockSize="16" texelsPerBlock="144" blockExtent="12,12,1" compressed="ASTC LDR">
+ <component name="R" bits="compressed" numericFormat="SRGB"/>
+ <component name="G" bits="compressed" numericFormat="SRGB"/>
+ <component name="B" bits="compressed" numericFormat="SRGB"/>
+ <component name="A" bits="compressed" numericFormat="SRGB"/>
+ </format>
+ <format name="VK_FORMAT_G8B8G8R8_422_UNORM" class="32-bit G8B8G8R8" blockSize="4" texelsPerBlock="1" blockExtent="2,1,1" chroma="422">
+ <component name="G" bits="8" numericFormat="UNORM"/>
+ <component name="B" bits="8" numericFormat="UNORM"/>
+ <component name="G" bits="8" numericFormat="UNORM"/>
+ <component name="R" bits="8" numericFormat="UNORM"/>
+ </format>
+ <format name="VK_FORMAT_B8G8R8G8_422_UNORM" class="32-bit B8G8R8G8" blockSize="4" texelsPerBlock="1" blockExtent="2,1,1" chroma="422">
+ <component name="B" bits="8" numericFormat="UNORM"/>
+ <component name="G" bits="8" numericFormat="UNORM"/>
+ <component name="R" bits="8" numericFormat="UNORM"/>
+ <component name="G" bits="8" numericFormat="UNORM"/>
+ </format>
+ <format name="VK_FORMAT_G8_B8_R8_3PLANE_420_UNORM" class="8-bit 3-plane 420" blockSize="3" texelsPerBlock="1" chroma="420">
+ <component name="G" bits="8" numericFormat="UNORM" planeIndex="0"/>
+ <component name="B" bits="8" numericFormat="UNORM" planeIndex="1"/>
+ <component name="R" bits="8" numericFormat="UNORM" planeIndex="2"/>
+ <plane index="0" widthDivisor="1" heightDivisor="1" compatible="VK_FORMAT_R8_UNORM"/>
+ <plane index="1" widthDivisor="2" heightDivisor="2" compatible="VK_FORMAT_R8_UNORM"/>
+ <plane index="2" widthDivisor="2" heightDivisor="2" compatible="VK_FORMAT_R8_UNORM"/>
+ </format>
+ <format name="VK_FORMAT_G8_B8R8_2PLANE_420_UNORM" class="8-bit 2-plane 420" blockSize="3" texelsPerBlock="1" chroma="420">
+ <component name="G" bits="8" numericFormat="UNORM" planeIndex="0"/>
+ <component name="B" bits="8" numericFormat="UNORM" planeIndex="1"/>
+ <component name="R" bits="8" numericFormat="UNORM" planeIndex="1"/>
+ <plane index="0" widthDivisor="1" heightDivisor="1" compatible="VK_FORMAT_R8_UNORM"/>
+ <plane index="1" widthDivisor="2" heightDivisor="2" compatible="VK_FORMAT_R8G8_UNORM"/>
+ </format>
+ <format name="VK_FORMAT_G8_B8_R8_3PLANE_422_UNORM" class="8-bit 3-plane 422" blockSize="3" texelsPerBlock="1" chroma="422">
+ <component name="G" bits="8" numericFormat="UNORM" planeIndex="0"/>
+ <component name="B" bits="8" numericFormat="UNORM" planeIndex="1"/>
+ <component name="R" bits="8" numericFormat="UNORM" planeIndex="2"/>
+ <plane index="0" widthDivisor="1" heightDivisor="1" compatible="VK_FORMAT_R8_UNORM"/>
+ <plane index="1" widthDivisor="2" heightDivisor="1" compatible="VK_FORMAT_R8_UNORM"/>
+ <plane index="2" widthDivisor="2" heightDivisor="1" compatible="VK_FORMAT_R8_UNORM"/>
+ </format>
+ <format name="VK_FORMAT_G8_B8R8_2PLANE_422_UNORM" class="8-bit 2-plane 422" blockSize="3" texelsPerBlock="1" chroma="422">
+ <component name="G" bits="8" numericFormat="UNORM" planeIndex="0"/>
+ <component name="B" bits="8" numericFormat="UNORM" planeIndex="1"/>
+ <component name="R" bits="8" numericFormat="UNORM" planeIndex="1"/>
+ <plane index="0" widthDivisor="1" heightDivisor="1" compatible="VK_FORMAT_R8_UNORM"/>
+ <plane index="1" widthDivisor="2" heightDivisor="1" compatible="VK_FORMAT_R8G8_UNORM"/>
+ </format>
+ <format name="VK_FORMAT_G8_B8_R8_3PLANE_444_UNORM" class="8-bit 3-plane 444" blockSize="3" texelsPerBlock="1" chroma="444">
+ <component name="G" bits="8" numericFormat="UNORM" planeIndex="0"/>
+ <component name="B" bits="8" numericFormat="UNORM" planeIndex="1"/>
+ <component name="R" bits="8" numericFormat="UNORM" planeIndex="2"/>
+ <plane index="0" widthDivisor="1" heightDivisor="1" compatible="VK_FORMAT_R8_UNORM"/>
+ <plane index="1" widthDivisor="1" heightDivisor="1" compatible="VK_FORMAT_R8_UNORM"/>
+ <plane index="2" widthDivisor="1" heightDivisor="1" compatible="VK_FORMAT_R8_UNORM"/>
+ </format>
+ <format name="VK_FORMAT_R10X6_UNORM_PACK16" class="16-bit" blockSize="2" texelsPerBlock="1" packed="16">
+ <component name="R" bits="10" numericFormat="UNORM"/>
+ </format>
+ <format name="VK_FORMAT_R10X6G10X6_UNORM_2PACK16" class="32-bit" blockSize="4" texelsPerBlock="1" packed="16">
+ <component name="R" bits="10" numericFormat="UNORM"/>
+ <component name="G" bits="10" numericFormat="UNORM"/>
+ </format>
+ <format name="VK_FORMAT_R10X6G10X6B10X6A10X6_UNORM_4PACK16" class="64-bit R10G10B10A10" blockSize="8" texelsPerBlock="1" packed="16" chroma="444">
+ <component name="R" bits="10" numericFormat="UNORM"/>
+ <component name="G" bits="10" numericFormat="UNORM"/>
+ <component name="B" bits="10" numericFormat="UNORM"/>
+ <component name="A" bits="10" numericFormat="UNORM"/>
+ </format>
+ <format name="VK_FORMAT_G10X6B10X6G10X6R10X6_422_UNORM_4PACK16" class="64-bit G10B10G10R10" blockSize="8" texelsPerBlock="1" blockExtent="2,1,1" packed="16" chroma="422">
+ <component name="G" bits="10" numericFormat="UNORM"/>
+ <component name="B" bits="10" numericFormat="UNORM"/>
+ <component name="G" bits="10" numericFormat="UNORM"/>
+ <component name="R" bits="10" numericFormat="UNORM"/>
+ </format>
+ <format name="VK_FORMAT_B10X6G10X6R10X6G10X6_422_UNORM_4PACK16" class="64-bit B10G10R10G10" blockSize="8" texelsPerBlock="1" blockExtent="2,1,1" packed="16" chroma="422">
+ <component name="B" bits="10" numericFormat="UNORM"/>
+ <component name="G" bits="10" numericFormat="UNORM"/>
+ <component name="R" bits="10" numericFormat="UNORM"/>
+ <component name="G" bits="10" numericFormat="UNORM"/>
+ </format>
+ <format name="VK_FORMAT_G10X6_B10X6_R10X6_3PLANE_420_UNORM_3PACK16" class="10-bit 3-plane 420" blockSize="6" texelsPerBlock="1" packed="16" chroma="420">
+ <component name="G" bits="10" numericFormat="UNORM" planeIndex="0"/>
+ <component name="B" bits="10" numericFormat="UNORM" planeIndex="1"/>
+ <component name="R" bits="10" numericFormat="UNORM" planeIndex="2"/>
+ <plane index="0" widthDivisor="1" heightDivisor="1" compatible="VK_FORMAT_R10X6_UNORM_PACK16"/>
+ <plane index="1" widthDivisor="2" heightDivisor="2" compatible="VK_FORMAT_R10X6_UNORM_PACK16"/>
+ <plane index="2" widthDivisor="2" heightDivisor="2" compatible="VK_FORMAT_R10X6_UNORM_PACK16"/>
+ </format>
+ <format name="VK_FORMAT_G10X6_B10X6R10X6_2PLANE_420_UNORM_3PACK16" class="10-bit 2-plane 420" blockSize="6" texelsPerBlock="1" packed="16" chroma="420">
+ <component name="G" bits="10" numericFormat="UNORM" planeIndex="0"/>
+ <component name="B" bits="10" numericFormat="UNORM" planeIndex="1"/>
+ <component name="R" bits="10" numericFormat="UNORM" planeIndex="1"/>
+ <plane index="0" widthDivisor="1" heightDivisor="1" compatible="VK_FORMAT_R10X6_UNORM_PACK16"/>
+ <plane index="1" widthDivisor="2" heightDivisor="2" compatible="VK_FORMAT_R10X6G10X6_UNORM_2PACK16"/>
+ </format>
+ <format name="VK_FORMAT_G10X6_B10X6_R10X6_3PLANE_422_UNORM_3PACK16" class="10-bit 3-plane 422" blockSize="6" texelsPerBlock="1" packed="16" chroma="422">
+ <component name="G" bits="10" numericFormat="UNORM" planeIndex="0"/>
+ <component name="B" bits="10" numericFormat="UNORM" planeIndex="1"/>
+ <component name="R" bits="10" numericFormat="UNORM" planeIndex="2"/>
+ <plane index="0" widthDivisor="1" heightDivisor="1" compatible="VK_FORMAT_R10X6_UNORM_PACK16"/>
+ <plane index="1" widthDivisor="2" heightDivisor="1" compatible="VK_FORMAT_R10X6_UNORM_PACK16"/>
+ <plane index="2" widthDivisor="2" heightDivisor="1" compatible="VK_FORMAT_R10X6_UNORM_PACK16"/>
+ </format>
+ <format name="VK_FORMAT_G10X6_B10X6R10X6_2PLANE_422_UNORM_3PACK16" class="10-bit 2-plane 422" blockSize="6" texelsPerBlock="1" packed="16" chroma="422">
+ <component name="G" bits="10" numericFormat="UNORM" planeIndex="0"/>
+ <component name="B" bits="10" numericFormat="UNORM" planeIndex="1"/>
+ <component name="R" bits="10" numericFormat="UNORM" planeIndex="1"/>
+ <plane index="0" widthDivisor="1" heightDivisor="1" compatible="VK_FORMAT_R10X6_UNORM_PACK16"/>
+ <plane index="1" widthDivisor="2" heightDivisor="1" compatible="VK_FORMAT_R10X6G10X6_UNORM_2PACK16"/>
+ </format>
+ <format name="VK_FORMAT_G10X6_B10X6_R10X6_3PLANE_444_UNORM_3PACK16" class="10-bit 3-plane 444" blockSize="6" texelsPerBlock="1" packed="16" chroma="444">
+ <component name="G" bits="10" numericFormat="UNORM" planeIndex="0"/>
+ <component name="B" bits="10" numericFormat="UNORM" planeIndex="1"/>
+ <component name="R" bits="10" numericFormat="UNORM" planeIndex="2"/>
+ <plane index="0" widthDivisor="1" heightDivisor="1" compatible="VK_FORMAT_R10X6_UNORM_PACK16"/>
+ <plane index="1" widthDivisor="1" heightDivisor="1" compatible="VK_FORMAT_R10X6_UNORM_PACK16"/>
+ <plane index="2" widthDivisor="1" heightDivisor="1" compatible="VK_FORMAT_R10X6_UNORM_PACK16"/>
+ </format>
+ <format name="VK_FORMAT_R12X4_UNORM_PACK16" class="16-bit" blockSize="2" texelsPerBlock="1" packed="16">
+ <component name="R" bits="12" numericFormat="UNORM"/>
+ </format>
+ <format name="VK_FORMAT_R12X4G12X4_UNORM_2PACK16" class="32-bit" blockSize="4" texelsPerBlock="1" packed="16">
+ <component name="R" bits="12" numericFormat="UNORM"/>
+ <component name="G" bits="12" numericFormat="UNORM"/>
+ </format>
+ <format name="VK_FORMAT_R12X4G12X4B12X4A12X4_UNORM_4PACK16" class="64-bit R12G12B12A12" blockSize="8" texelsPerBlock="1" packed="16" chroma="444">
+ <component name="R" bits="12" numericFormat="UNORM"/>
+ <component name="G" bits="12" numericFormat="UNORM"/>
+ <component name="B" bits="12" numericFormat="UNORM"/>
+ <component name="A" bits="12" numericFormat="UNORM"/>
+ </format>
+ <format name="VK_FORMAT_G12X4B12X4G12X4R12X4_422_UNORM_4PACK16" class="64-bit G12B12G12R12" blockSize="8" texelsPerBlock="1" blockExtent="2,1,1" packed="16" chroma="422">
+ <component name="G" bits="12" numericFormat="UNORM"/>
+ <component name="B" bits="12" numericFormat="UNORM"/>
+ <component name="G" bits="12" numericFormat="UNORM"/>
+ <component name="R" bits="12" numericFormat="UNORM"/>
+ </format>
+ <format name="VK_FORMAT_B12X4G12X4R12X4G12X4_422_UNORM_4PACK16" class="64-bit B12G12R12G12" blockSize="8" texelsPerBlock="1" blockExtent="2,1,1" packed="16" chroma="422">
+ <component name="B" bits="12" numericFormat="UNORM"/>
+ <component name="G" bits="12" numericFormat="UNORM"/>
+ <component name="R" bits="12" numericFormat="UNORM"/>
+ <component name="G" bits="12" numericFormat="UNORM"/>
+ </format>
+ <format name="VK_FORMAT_G12X4_B12X4_R12X4_3PLANE_420_UNORM_3PACK16" class="12-bit 3-plane 420" blockSize="6" texelsPerBlock="1" packed="16" chroma="420">
+ <component name="G" bits="12" numericFormat="UNORM" planeIndex="0"/>
+ <component name="B" bits="12" numericFormat="UNORM" planeIndex="1"/>
+ <component name="R" bits="12" numericFormat="UNORM" planeIndex="2"/>
+ <plane index="0" widthDivisor="1" heightDivisor="1" compatible="VK_FORMAT_R12X4_UNORM_PACK16"/>
+ <plane index="1" widthDivisor="2" heightDivisor="2" compatible="VK_FORMAT_R12X4_UNORM_PACK16"/>
+ <plane index="2" widthDivisor="2" heightDivisor="2" compatible="VK_FORMAT_R12X4_UNORM_PACK16"/>
+ </format>
+ <format name="VK_FORMAT_G12X4_B12X4R12X4_2PLANE_420_UNORM_3PACK16" class="12-bit 2-plane 420" blockSize="6" texelsPerBlock="1" packed="16" chroma="420">
+ <component name="G" bits="12" numericFormat="UNORM" planeIndex="0"/>
+ <component name="B" bits="12" numericFormat="UNORM" planeIndex="1"/>
+ <component name="R" bits="12" numericFormat="UNORM" planeIndex="1"/>
+ <plane index="0" widthDivisor="1" heightDivisor="1" compatible="VK_FORMAT_R12X4_UNORM_PACK16"/>
+ <plane index="1" widthDivisor="2" heightDivisor="2" compatible="VK_FORMAT_R12X4G12X4_UNORM_2PACK16"/>
+ </format>
+ <format name="VK_FORMAT_G12X4_B12X4_R12X4_3PLANE_422_UNORM_3PACK16" class="12-bit 3-plane 422" blockSize="6" texelsPerBlock="1" packed="16" chroma="422">
+ <component name="G" bits="12" numericFormat="UNORM" planeIndex="0"/>
+ <component name="B" bits="12" numericFormat="UNORM" planeIndex="1"/>
+ <component name="R" bits="12" numericFormat="UNORM" planeIndex="2"/>
+ <plane index="0" widthDivisor="1" heightDivisor="1" compatible="VK_FORMAT_R12X4_UNORM_PACK16"/>
+ <plane index="1" widthDivisor="2" heightDivisor="1" compatible="VK_FORMAT_R12X4_UNORM_PACK16"/>
+ <plane index="2" widthDivisor="2" heightDivisor="1" compatible="VK_FORMAT_R12X4_UNORM_PACK16"/>
+ </format>
+ <format name="VK_FORMAT_G12X4_B12X4R12X4_2PLANE_422_UNORM_3PACK16" class="12-bit 2-plane 422" blockSize="6" texelsPerBlock="1" packed="16" chroma="422">
+ <component name="G" bits="12" numericFormat="UNORM" planeIndex="0"/>
+ <component name="B" bits="12" numericFormat="UNORM" planeIndex="1"/>
+ <component name="R" bits="12" numericFormat="UNORM" planeIndex="1"/>
+ <plane index="0" widthDivisor="1" heightDivisor="1" compatible="VK_FORMAT_R12X4_UNORM_PACK16"/>
+ <plane index="1" widthDivisor="2" heightDivisor="1" compatible="VK_FORMAT_R12X4G12X4_UNORM_2PACK16"/>
+ </format>
+ <format name="VK_FORMAT_G12X4_B12X4_R12X4_3PLANE_444_UNORM_3PACK16" class="12-bit 3-plane 444" blockSize="6" texelsPerBlock="1" packed="16" chroma="444">
+ <component name="G" bits="12" numericFormat="UNORM" planeIndex="0"/>
+ <component name="B" bits="12" numericFormat="UNORM" planeIndex="1"/>
+ <component name="R" bits="12" numericFormat="UNORM" planeIndex="2"/>
+ <plane index="0" widthDivisor="1" heightDivisor="1" compatible="VK_FORMAT_R12X4_UNORM_PACK16"/>
+ <plane index="1" widthDivisor="1" heightDivisor="1" compatible="VK_FORMAT_R12X4_UNORM_PACK16"/>
+ <plane index="2" widthDivisor="1" heightDivisor="1" compatible="VK_FORMAT_R12X4_UNORM_PACK16"/>
+ </format>
+ <format name="VK_FORMAT_G16B16G16R16_422_UNORM" class="64-bit G16B16G16R16" blockSize="8" texelsPerBlock="1" blockExtent="2,1,1" chroma="422">
+ <component name="G" bits="16" numericFormat="UNORM"/>
+ <component name="B" bits="16" numericFormat="UNORM"/>
+ <component name="G" bits="16" numericFormat="UNORM"/>
+ <component name="R" bits="16" numericFormat="UNORM"/>
+ </format>
+ <format name="VK_FORMAT_B16G16R16G16_422_UNORM" class="64-bit B16G16R16G16" blockSize="8" texelsPerBlock="1" blockExtent="2,1,1" chroma="422">
+ <component name="B" bits="16" numericFormat="UNORM"/>
+ <component name="G" bits="16" numericFormat="UNORM"/>
+ <component name="R" bits="16" numericFormat="UNORM"/>
+ <component name="G" bits="16" numericFormat="UNORM"/>
+ </format>
+ <format name="VK_FORMAT_G16_B16_R16_3PLANE_420_UNORM" class="16-bit 3-plane 420" blockSize="6" texelsPerBlock="1" chroma="420">
+ <component name="G" bits="16" numericFormat="UNORM" planeIndex="0"/>
+ <component name="B" bits="16" numericFormat="UNORM" planeIndex="1"/>
+ <component name="R" bits="16" numericFormat="UNORM" planeIndex="2"/>
+ <plane index="0" widthDivisor="1" heightDivisor="1" compatible="VK_FORMAT_R16_UNORM"/>
+ <plane index="1" widthDivisor="2" heightDivisor="2" compatible="VK_FORMAT_R16_UNORM"/>
+ <plane index="2" widthDivisor="2" heightDivisor="2" compatible="VK_FORMAT_R16_UNORM"/>
+ </format>
+ <format name="VK_FORMAT_G16_B16R16_2PLANE_420_UNORM" class="16-bit 2-plane 420" blockSize="6" texelsPerBlock="1" chroma="420">
+ <component name="G" bits="16" numericFormat="UNORM" planeIndex="0"/>
+ <component name="B" bits="16" numericFormat="UNORM" planeIndex="1"/>
+ <component name="R" bits="16" numericFormat="UNORM" planeIndex="1"/>
+ <plane index="0" widthDivisor="1" heightDivisor="1" compatible="VK_FORMAT_R16_UNORM"/>
+ <plane index="1" widthDivisor="2" heightDivisor="2" compatible="VK_FORMAT_R16G16_UNORM"/>
+ </format>
+ <format name="VK_FORMAT_G16_B16_R16_3PLANE_422_UNORM" class="16-bit 3-plane 422" blockSize="6" texelsPerBlock="1" chroma="422">
+ <component name="G" bits="16" numericFormat="UNORM" planeIndex="0"/>
+ <component name="B" bits="16" numericFormat="UNORM" planeIndex="1"/>
+ <component name="R" bits="16" numericFormat="UNORM" planeIndex="2"/>
+ <plane index="0" widthDivisor="1" heightDivisor="1" compatible="VK_FORMAT_R16_UNORM"/>
+ <plane index="1" widthDivisor="2" heightDivisor="1" compatible="VK_FORMAT_R16_UNORM"/>
+ <plane index="2" widthDivisor="2" heightDivisor="1" compatible="VK_FORMAT_R16_UNORM"/>
+ </format>
+ <format name="VK_FORMAT_G16_B16R16_2PLANE_422_UNORM" class="16-bit 2-plane 422" blockSize="6" texelsPerBlock="1" chroma="422">
+ <component name="G" bits="16" numericFormat="UNORM" planeIndex="0"/>
+ <component name="B" bits="16" numericFormat="UNORM" planeIndex="1"/>
+ <component name="R" bits="16" numericFormat="UNORM" planeIndex="1"/>
+ <plane index="0" widthDivisor="1" heightDivisor="1" compatible="VK_FORMAT_R16_UNORM"/>
+ <plane index="1" widthDivisor="2" heightDivisor="1" compatible="VK_FORMAT_R16G16_UNORM"/>
+ </format>
+ <format name="VK_FORMAT_G16_B16_R16_3PLANE_444_UNORM" class="16-bit 3-plane 444" blockSize="6" texelsPerBlock="1" chroma="444">
+ <component name="G" bits="16" numericFormat="UNORM" planeIndex="0"/>
+ <component name="B" bits="16" numericFormat="UNORM" planeIndex="1"/>
+ <component name="R" bits="16" numericFormat="UNORM" planeIndex="2"/>
+ <plane index="0" widthDivisor="1" heightDivisor="1" compatible="VK_FORMAT_R16_UNORM"/>
+ <plane index="1" widthDivisor="1" heightDivisor="1" compatible="VK_FORMAT_R16_UNORM"/>
+ <plane index="2" widthDivisor="1" heightDivisor="1" compatible="VK_FORMAT_R16_UNORM"/>
+ </format>
+ <format name="VK_FORMAT_PVRTC1_2BPP_UNORM_BLOCK_IMG" class="PVRTC1_2BPP" blockSize="8" texelsPerBlock="1" blockExtent="8,4,1" compressed="PVRTC">
+ <component name="R" bits="compressed" numericFormat="UNORM"/>
+ <component name="G" bits="compressed" numericFormat="UNORM"/>
+ <component name="B" bits="compressed" numericFormat="UNORM"/>
+ <component name="A" bits="compressed" numericFormat="UNORM"/>
+ </format>
+ <format name="VK_FORMAT_PVRTC1_4BPP_UNORM_BLOCK_IMG" class="PVRTC1_4BPP" blockSize="8" texelsPerBlock="1" blockExtent="4,4,1" compressed="PVRTC">
+ <component name="R" bits="compressed" numericFormat="UNORM"/>
+ <component name="G" bits="compressed" numericFormat="UNORM"/>
+ <component name="B" bits="compressed" numericFormat="UNORM"/>
+ <component name="A" bits="compressed" numericFormat="UNORM"/>
+ </format>
+ <format name="VK_FORMAT_PVRTC2_2BPP_UNORM_BLOCK_IMG" class="PVRTC2_2BPP" blockSize="8" texelsPerBlock="1" blockExtent="8,4,1" compressed="PVRTC">
+ <component name="R" bits="compressed" numericFormat="UNORM"/>
+ <component name="G" bits="compressed" numericFormat="UNORM"/>
+ <component name="B" bits="compressed" numericFormat="UNORM"/>
+ <component name="A" bits="compressed" numericFormat="UNORM"/>
+ </format>
+ <format name="VK_FORMAT_PVRTC2_4BPP_UNORM_BLOCK_IMG" class="PVRTC2_4BPP" blockSize="8" texelsPerBlock="1" blockExtent="4,4,1" compressed="PVRTC">
+ <component name="R" bits="compressed" numericFormat="UNORM"/>
+ <component name="G" bits="compressed" numericFormat="UNORM"/>
+ <component name="B" bits="compressed" numericFormat="UNORM"/>
+ <component name="A" bits="compressed" numericFormat="UNORM"/>
+ </format>
+ <format name="VK_FORMAT_PVRTC1_2BPP_SRGB_BLOCK_IMG" class="PVRTC1_2BPP" blockSize="8" texelsPerBlock="1" blockExtent="8,4,1" compressed="PVRTC">
+ <component name="R" bits="compressed" numericFormat="SRGB"/>
+ <component name="G" bits="compressed" numericFormat="SRGB"/>
+ <component name="B" bits="compressed" numericFormat="SRGB"/>
+ <component name="A" bits="compressed" numericFormat="SRGB"/>
+ </format>
+ <format name="VK_FORMAT_PVRTC1_4BPP_SRGB_BLOCK_IMG" class="PVRTC1_4BPP" blockSize="8" texelsPerBlock="1" blockExtent="4,4,1" compressed="PVRTC">
+ <component name="R" bits="compressed" numericFormat="SRGB"/>
+ <component name="G" bits="compressed" numericFormat="SRGB"/>
+ <component name="B" bits="compressed" numericFormat="SRGB"/>
+ <component name="A" bits="compressed" numericFormat="SRGB"/>
+ </format>
+ <format name="VK_FORMAT_PVRTC2_2BPP_SRGB_BLOCK_IMG" class="PVRTC2_2BPP" blockSize="8" texelsPerBlock="1" blockExtent="8,4,1" compressed="PVRTC">
+ <component name="R" bits="compressed" numericFormat="SRGB"/>
+ <component name="G" bits="compressed" numericFormat="SRGB"/>
+ <component name="B" bits="compressed" numericFormat="SRGB"/>
+ <component name="A" bits="compressed" numericFormat="SRGB"/>
+ </format>
+ <format name="VK_FORMAT_PVRTC2_4BPP_SRGB_BLOCK_IMG" class="PVRTC2_4BPP" blockSize="8" texelsPerBlock="1" blockExtent="4,4,1" compressed="PVRTC">
+ <component name="R" bits="compressed" numericFormat="SRGB"/>
+ <component name="G" bits="compressed" numericFormat="SRGB"/>
+ <component name="B" bits="compressed" numericFormat="SRGB"/>
+ <component name="A" bits="compressed" numericFormat="SRGB"/>
+ </format>
+ <format name="VK_FORMAT_ASTC_4x4_SFLOAT_BLOCK" class="ASTC_4x4" blockSize="16" texelsPerBlock="16" blockExtent="4,4,1" compressed="ASTC HDR">
+ <component name="R" bits="compressed" numericFormat="SFLOAT"/>
+ <component name="G" bits="compressed" numericFormat="SFLOAT"/>
+ <component name="B" bits="compressed" numericFormat="SFLOAT"/>
+ <component name="A" bits="compressed" numericFormat="SFLOAT"/>
+ </format>
+ <format name="VK_FORMAT_ASTC_5x4_SFLOAT_BLOCK" class="ASTC_5x4" blockSize="16" texelsPerBlock="20" blockExtent="5,4,1" compressed="ASTC HDR">
+ <component name="R" bits="compressed" numericFormat="SFLOAT"/>
+ <component name="G" bits="compressed" numericFormat="SFLOAT"/>
+ <component name="B" bits="compressed" numericFormat="SFLOAT"/>
+ <component name="A" bits="compressed" numericFormat="SFLOAT"/>
+ </format>
+ <format name="VK_FORMAT_ASTC_5x5_SFLOAT_BLOCK" class="ASTC_5x5" blockSize="16" texelsPerBlock="25" blockExtent="5,5,1" compressed="ASTC HDR">
+ <component name="R" bits="compressed" numericFormat="SFLOAT"/>
+ <component name="G" bits="compressed" numericFormat="SFLOAT"/>
+ <component name="B" bits="compressed" numericFormat="SFLOAT"/>
+ <component name="A" bits="compressed" numericFormat="SFLOAT"/>
+ </format>
+ <format name="VK_FORMAT_ASTC_6x5_SFLOAT_BLOCK" class="ASTC_6x5" blockSize="16" texelsPerBlock="30" blockExtent="6,5,1" compressed="ASTC HDR">
+ <component name="R" bits="compressed" numericFormat="SFLOAT"/>
+ <component name="G" bits="compressed" numericFormat="SFLOAT"/>
+ <component name="B" bits="compressed" numericFormat="SFLOAT"/>
+ <component name="A" bits="compressed" numericFormat="SFLOAT"/>
+ </format>
+ <format name="VK_FORMAT_ASTC_6x6_SFLOAT_BLOCK" class="ASTC_6x6" blockSize="16" texelsPerBlock="36" blockExtent="6,6,1" compressed="ASTC HDR">
+ <component name="R" bits="compressed" numericFormat="SFLOAT"/>
+ <component name="G" bits="compressed" numericFormat="SFLOAT"/>
+ <component name="B" bits="compressed" numericFormat="SFLOAT"/>
+ <component name="A" bits="compressed" numericFormat="SFLOAT"/>
+ </format>
+ <format name="VK_FORMAT_ASTC_8x5_SFLOAT_BLOCK" class="ASTC_8x5" blockSize="16" texelsPerBlock="40" blockExtent="8,5,1" compressed="ASTC HDR">
+ <component name="R" bits="compressed" numericFormat="SFLOAT"/>
+ <component name="G" bits="compressed" numericFormat="SFLOAT"/>
+ <component name="B" bits="compressed" numericFormat="SFLOAT"/>
+ <component name="A" bits="compressed" numericFormat="SFLOAT"/>
+ </format>
+ <format name="VK_FORMAT_ASTC_8x6_SFLOAT_BLOCK" class="ASTC_8x6" blockSize="16" texelsPerBlock="48" blockExtent="8,6,1" compressed="ASTC HDR">
+ <component name="R" bits="compressed" numericFormat="SFLOAT"/>
+ <component name="G" bits="compressed" numericFormat="SFLOAT"/>
+ <component name="B" bits="compressed" numericFormat="SFLOAT"/>
+ <component name="A" bits="compressed" numericFormat="SFLOAT"/>
+ </format>
+ <format name="VK_FORMAT_ASTC_8x8_SFLOAT_BLOCK" class="ASTC_8x8" blockSize="16" texelsPerBlock="64" blockExtent="8,8,1" compressed="ASTC HDR">
+ <component name="R" bits="compressed" numericFormat="SFLOAT"/>
+ <component name="G" bits="compressed" numericFormat="SFLOAT"/>
+ <component name="B" bits="compressed" numericFormat="SFLOAT"/>
+ <component name="A" bits="compressed" numericFormat="SFLOAT"/>
+ </format>
+ <format name="VK_FORMAT_ASTC_10x5_SFLOAT_BLOCK" class="ASTC_10x5" blockSize="16" texelsPerBlock="50" blockExtent="10,5,1" compressed="ASTC HDR">
+ <component name="R" bits="compressed" numericFormat="SFLOAT"/>
+ <component name="G" bits="compressed" numericFormat="SFLOAT"/>
+ <component name="B" bits="compressed" numericFormat="SFLOAT"/>
+ <component name="A" bits="compressed" numericFormat="SFLOAT"/>
+ </format>
+ <format name="VK_FORMAT_ASTC_10x6_SFLOAT_BLOCK" class="ASTC_10x6" blockSize="16" texelsPerBlock="60" blockExtent="10,6,1" compressed="ASTC HDR">
+ <component name="R" bits="compressed" numericFormat="SFLOAT"/>
+ <component name="G" bits="compressed" numericFormat="SFLOAT"/>
+ <component name="B" bits="compressed" numericFormat="SFLOAT"/>
+ <component name="A" bits="compressed" numericFormat="SFLOAT"/>
+ </format>
+ <format name="VK_FORMAT_ASTC_10x8_SFLOAT_BLOCK" class="ASTC_10x8" blockSize="16" texelsPerBlock="80" blockExtent="10,8,1" compressed="ASTC HDR">
+ <component name="R" bits="compressed" numericFormat="SFLOAT"/>
+ <component name="G" bits="compressed" numericFormat="SFLOAT"/>
+ <component name="B" bits="compressed" numericFormat="SFLOAT"/>
+ <component name="A" bits="compressed" numericFormat="SFLOAT"/>
+ </format>
+ <format name="VK_FORMAT_ASTC_10x10_SFLOAT_BLOCK" class="ASTC_10x10" blockSize="16" texelsPerBlock="100" blockExtent="10,10,1" compressed="ASTC HDR">
+ <component name="R" bits="compressed" numericFormat="SFLOAT"/>
+ <component name="G" bits="compressed" numericFormat="SFLOAT"/>
+ <component name="B" bits="compressed" numericFormat="SFLOAT"/>
+ <component name="A" bits="compressed" numericFormat="SFLOAT"/>
+ </format>
+ <format name="VK_FORMAT_ASTC_12x10_SFLOAT_BLOCK" class="ASTC_12x10" blockSize="16" texelsPerBlock="120" blockExtent="12,10,1" compressed="ASTC HDR">
+ <component name="R" bits="compressed" numericFormat="SFLOAT"/>
+ <component name="G" bits="compressed" numericFormat="SFLOAT"/>
+ <component name="B" bits="compressed" numericFormat="SFLOAT"/>
+ <component name="A" bits="compressed" numericFormat="SFLOAT"/>
+ </format>
+ <format name="VK_FORMAT_ASTC_12x12_SFLOAT_BLOCK" class="ASTC_12x12" blockSize="16" texelsPerBlock="144" blockExtent="12,12,1" compressed="ASTC HDR">
+ <component name="R" bits="compressed" numericFormat="SFLOAT"/>
+ <component name="G" bits="compressed" numericFormat="SFLOAT"/>
+ <component name="B" bits="compressed" numericFormat="SFLOAT"/>
+ <component name="A" bits="compressed" numericFormat="SFLOAT"/>
+ </format>
+ <format name="VK_FORMAT_G8_B8R8_2PLANE_444_UNORM" class="8-bit 2-plane 444" blockSize="3" texelsPerBlock="1" chroma="444">
+ <component name="G" bits="8" numericFormat="UNORM" planeIndex="0"/>
+ <component name="B" bits="8" numericFormat="UNORM" planeIndex="1"/>
+ <component name="R" bits="8" numericFormat="UNORM" planeIndex="1"/>
+ <plane index="0" widthDivisor="1" heightDivisor="1" compatible="VK_FORMAT_R8_UNORM"/>
+ <plane index="1" widthDivisor="1" heightDivisor="1" compatible="VK_FORMAT_R8G8_UNORM"/>
+ </format>
+ <format name="VK_FORMAT_G10X6_B10X6R10X6_2PLANE_444_UNORM_3PACK16" class="10-bit 2-plane 444" blockSize="6" texelsPerBlock="1" packed="16" chroma="444">
+ <component name="G" bits="10" numericFormat="UNORM" planeIndex="0"/>
+ <component name="B" bits="10" numericFormat="UNORM" planeIndex="1"/>
+ <component name="R" bits="10" numericFormat="UNORM" planeIndex="1"/>
+ <plane index="0" widthDivisor="1" heightDivisor="1" compatible="VK_FORMAT_R10X6_UNORM_PACK16"/>
+ <plane index="1" widthDivisor="1" heightDivisor="1" compatible="VK_FORMAT_R10X6G10X6_UNORM_2PACK16"/>
+ </format>
+ <format name="VK_FORMAT_G12X4_B12X4R12X4_2PLANE_444_UNORM_3PACK16" class="12-bit 2-plane 444" blockSize="6" texelsPerBlock="1" packed="16" chroma="444">
+ <component name="G" bits="12" numericFormat="UNORM" planeIndex="0"/>
+ <component name="B" bits="12" numericFormat="UNORM" planeIndex="1"/>
+ <component name="R" bits="12" numericFormat="UNORM" planeIndex="1"/>
+ <plane index="0" widthDivisor="1" heightDivisor="1" compatible="VK_FORMAT_R12X4_UNORM_PACK16"/>
+ <plane index="1" widthDivisor="1" heightDivisor="1" compatible="VK_FORMAT_R12X4G12X4_UNORM_2PACK16"/>
+ </format>
+ <format name="VK_FORMAT_G16_B16R16_2PLANE_444_UNORM" class="16-bit 2-plane 444" blockSize="6" texelsPerBlock="1" chroma="444">
+ <component name="G" bits="16" numericFormat="UNORM" planeIndex="0"/>
+ <component name="B" bits="16" numericFormat="UNORM" planeIndex="1"/>
+ <component name="R" bits="16" numericFormat="UNORM" planeIndex="1"/>
+ <plane index="0" widthDivisor="1" heightDivisor="1" compatible="VK_FORMAT_R16_UNORM"/>
+ <plane index="1" widthDivisor="1" heightDivisor="1" compatible="VK_FORMAT_R16G16_UNORM"/>
+ </format>
+ <format name="VK_FORMAT_A4R4G4B4_UNORM_PACK16" class="16-bit" blockSize="2" texelsPerBlock="1" packed="16">
+ <component name="A" bits="4" numericFormat="UNORM"/>
+ <component name="R" bits="4" numericFormat="UNORM"/>
+ <component name="G" bits="4" numericFormat="UNORM"/>
+ <component name="B" bits="4" numericFormat="UNORM"/>
+ </format>
+ <format name="VK_FORMAT_A4B4G4R4_UNORM_PACK16" class="16-bit" blockSize="2" texelsPerBlock="1" packed="16">
+ <component name="A" bits="4" numericFormat="UNORM"/>
+ <component name="B" bits="4" numericFormat="UNORM"/>
+ <component name="G" bits="4" numericFormat="UNORM"/>
+ <component name="R" bits="4" numericFormat="UNORM"/>
+ </format>
+ </formats>
+ <spirvextensions comment="SPIR-V Extensions allowed in Vulkan and what is required to use it">
+ <spirvextension name="SPV_KHR_variable_pointers">
+ <enable version="VK_VERSION_1_1"/>
+ <enable extension="VK_KHR_variable_pointers"/>
+ </spirvextension>
+ <spirvextension name="SPV_AMD_shader_explicit_vertex_parameter">
+ <enable extension="VK_AMD_shader_explicit_vertex_parameter"/>
+ </spirvextension>
+ <spirvextension name="SPV_AMD_gcn_shader">
+ <enable extension="VK_AMD_gcn_shader"/>
+ </spirvextension>
+ <spirvextension name="SPV_AMD_gpu_shader_half_float">
+ <enable extension="VK_AMD_gpu_shader_half_float"/>
+ </spirvextension>
+ <spirvextension name="SPV_AMD_gpu_shader_int16">
+ <enable extension="VK_AMD_gpu_shader_int16"/>
+ </spirvextension>
+ <spirvextension name="SPV_AMD_shader_ballot">
+ <enable extension="VK_AMD_shader_ballot"/>
+ </spirvextension>
+ <spirvextension name="SPV_AMD_shader_fragment_mask">
+ <enable extension="VK_AMD_shader_fragment_mask"/>
+ </spirvextension>
+ <spirvextension name="SPV_AMD_shader_image_load_store_lod">
+ <enable extension="VK_AMD_shader_image_load_store_lod"/>
+ </spirvextension>
+ <spirvextension name="SPV_AMD_shader_trinary_minmax">
+ <enable extension="VK_AMD_shader_trinary_minmax"/>
+ </spirvextension>
+ <spirvextension name="SPV_AMD_texture_gather_bias_lod">
+ <enable extension="VK_AMD_texture_gather_bias_lod"/>
+ </spirvextension>
+ <spirvextension name="SPV_KHR_shader_draw_parameters">
+ <enable version="VK_VERSION_1_1"/>
+ <enable extension="VK_KHR_shader_draw_parameters"/>
+ </spirvextension>
+ <spirvextension name="SPV_KHR_8bit_storage">
+ <enable version="VK_VERSION_1_2"/>
+ <enable extension="VK_KHR_8bit_storage"/>
+ </spirvextension>
+ <spirvextension name="SPV_KHR_16bit_storage">
+ <enable version="VK_VERSION_1_1"/>
+ <enable extension="VK_KHR_16bit_storage"/>
+ </spirvextension>
+ <spirvextension name="SPV_KHR_shader_clock">
+ <enable extension="VK_KHR_shader_clock"/>
+ </spirvextension>
+ <spirvextension name="SPV_KHR_float_controls">
+ <enable version="VK_VERSION_1_2"/>
+ <enable extension="VK_KHR_shader_float_controls"/>
+ </spirvextension>
+ <spirvextension name="SPV_KHR_storage_buffer_storage_class">
+ <enable version="VK_VERSION_1_1"/>
+ <enable extension="VK_KHR_storage_buffer_storage_class"/>
+ </spirvextension>
+ <spirvextension name="SPV_KHR_post_depth_coverage">
+ <enable extension="VK_EXT_post_depth_coverage"/>
+ </spirvextension>
+ <spirvextension name="SPV_EXT_shader_stencil_export">
+ <enable extension="VK_EXT_shader_stencil_export"/>
+ </spirvextension>
+ <spirvextension name="SPV_KHR_shader_ballot">
+ <enable extension="VK_EXT_shader_subgroup_ballot"/>
+ </spirvextension>
+ <spirvextension name="SPV_KHR_subgroup_vote">
+ <enable extension="VK_EXT_shader_subgroup_vote"/>
+ </spirvextension>
+ <spirvextension name="SPV_NV_sample_mask_override_coverage">
+ <enable extension="VK_NV_sample_mask_override_coverage"/>
+ </spirvextension>
+ <spirvextension name="SPV_NV_geometry_shader_passthrough">
+ <enable extension="VK_NV_geometry_shader_passthrough"/>
+ </spirvextension>
+ <spirvextension name="SPV_NV_mesh_shader">
+ <enable extension="VK_NV_mesh_shader"/>
+ </spirvextension>
+ <spirvextension name="SPV_NV_viewport_array2">
+ <enable extension="VK_NV_viewport_array2"/>
+ </spirvextension>
+ <spirvextension name="SPV_NV_shader_subgroup_partitioned">
+ <enable extension="VK_NV_shader_subgroup_partitioned"/>
+ </spirvextension>
+ <spirvextension name="SPV_EXT_shader_viewport_index_layer">
+ <enable version="VK_VERSION_1_2"/>
+ <enable extension="VK_EXT_shader_viewport_index_layer"/>
+ </spirvextension>
+ <spirvextension name="SPV_NVX_multiview_per_view_attributes">
+ <enable extension="VK_NVX_multiview_per_view_attributes"/>
+ </spirvextension>
+ <spirvextension name="SPV_EXT_descriptor_indexing">
+ <enable version="VK_VERSION_1_2"/>
+ <enable extension="VK_EXT_descriptor_indexing"/>
+ </spirvextension>
+ <spirvextension name="SPV_KHR_vulkan_memory_model">
+ <enable version="VK_VERSION_1_2"/>
+ <enable extension="VK_KHR_vulkan_memory_model"/>
+ </spirvextension>
+ <spirvextension name="SPV_NV_compute_shader_derivatives">
+ <enable extension="VK_NV_compute_shader_derivatives"/>
+ </spirvextension>
+ <spirvextension name="SPV_NV_fragment_shader_barycentric">
+ <enable extension="VK_NV_fragment_shader_barycentric"/>
+ </spirvextension>
+ <spirvextension name="SPV_NV_shader_image_footprint">
+ <enable extension="VK_NV_shader_image_footprint"/>
+ </spirvextension>
+ <spirvextension name="SPV_NV_shading_rate">
+ <enable extension="VK_NV_shading_rate_image"/>
+ </spirvextension>
+ <spirvextension name="SPV_NV_ray_tracing">
+ <enable extension="VK_NV_ray_tracing"/>
+ </spirvextension>
+ <spirvextension name="SPV_KHR_ray_tracing">
+ <enable extension="VK_KHR_ray_tracing_pipeline"/>
+ </spirvextension>
+ <spirvextension name="SPV_KHR_ray_query">
+ <enable extension="VK_KHR_ray_query"/>
+ </spirvextension>
+ <spirvextension name="SPV_KHR_ray_cull_mask">
+ <enable extension="VK_KHR_ray_tracing_maintenance1"/>
+ </spirvextension>
+ <spirvextension name="SPV_GOOGLE_hlsl_functionality1">
+ <enable extension="VK_GOOGLE_hlsl_functionality1"/>
+ </spirvextension>
+ <spirvextension name="SPV_GOOGLE_user_type">
+ <enable extension="VK_GOOGLE_user_type"/>
+ </spirvextension>
+ <spirvextension name="SPV_GOOGLE_decorate_string">
+ <enable extension="VK_GOOGLE_decorate_string"/>
+ </spirvextension>
+ <spirvextension name="SPV_EXT_fragment_invocation_density">
+ <enable extension="VK_EXT_fragment_density_map"/>
+ </spirvextension>
+ <spirvextension name="SPV_KHR_physical_storage_buffer">
+ <enable version="VK_VERSION_1_2"/>
+ <enable extension="VK_KHR_buffer_device_address"/>
+ </spirvextension>
+ <spirvextension name="SPV_EXT_physical_storage_buffer">
+ <enable extension="VK_EXT_buffer_device_address"/>
+ </spirvextension>
+ <spirvextension name="SPV_NV_cooperative_matrix">
+ <enable extension="VK_NV_cooperative_matrix"/>
+ </spirvextension>
+ <spirvextension name="SPV_NV_shader_sm_builtins">
+ <enable extension="VK_NV_shader_sm_builtins"/>
+ </spirvextension>
+ <spirvextension name="SPV_EXT_fragment_shader_interlock">
+ <enable extension="VK_EXT_fragment_shader_interlock"/>
+ </spirvextension>
+ <spirvextension name="SPV_EXT_demote_to_helper_invocation">
+ <enable version="VK_API_VERSION_1_3"/>
+ <enable extension="VK_EXT_shader_demote_to_helper_invocation"/>
+ </spirvextension>
+ <spirvextension name="SPV_KHR_fragment_shading_rate">
+ <enable extension="VK_KHR_fragment_shading_rate"/>
+ </spirvextension>
+ <spirvextension name="SPV_KHR_non_semantic_info">
+ <enable version="VK_API_VERSION_1_3"/>
+ <enable extension="VK_KHR_shader_non_semantic_info"/>
+ </spirvextension>
+ <spirvextension name="SPV_EXT_shader_image_int64">
+ <enable extension="VK_EXT_shader_image_atomic_int64"/>
+ </spirvextension>
+ <spirvextension name="SPV_KHR_terminate_invocation">
+ <enable version="VK_API_VERSION_1_3"/>
+ <enable extension="VK_KHR_shader_terminate_invocation"/>
+ </spirvextension>
+ <spirvextension name="SPV_KHR_multiview">
+ <enable version="VK_VERSION_1_1"/>
+ <enable extension="VK_KHR_multiview"/>
+ </spirvextension>
+ <spirvextension name="SPV_KHR_workgroup_memory_explicit_layout">
+ <enable extension="VK_KHR_workgroup_memory_explicit_layout"/>
+ </spirvextension>
+ <spirvextension name="SPV_EXT_shader_atomic_float_add">
+ <enable extension="VK_EXT_shader_atomic_float"/>
+ </spirvextension>
+ <spirvextension name="SPV_KHR_fragment_shader_barycentric">
+ <enable extension="VK_KHR_fragment_shader_barycentric"/>
+ </spirvextension>
+ <spirvextension name="SPV_KHR_subgroup_uniform_control_flow">
+ <enable version="VK_API_VERSION_1_3"/>
+ <enable extension="VK_KHR_shader_subgroup_uniform_control_flow"/>
+ </spirvextension>
+ <spirvextension name="SPV_EXT_shader_atomic_float_min_max">
+ <enable extension="VK_EXT_shader_atomic_float2"/>
+ </spirvextension>
+ <spirvextension name="SPV_EXT_shader_atomic_float16_add">
+ <enable extension="VK_EXT_shader_atomic_float2"/>
+ </spirvextension>
+ <spirvextension name="SPV_KHR_integer_dot_product">
+ <enable version="VK_API_VERSION_1_3"/>
+ <enable extension="VK_KHR_shader_integer_dot_product"/>
+ </spirvextension>
+ <spirvextension name="SPV_INTEL_shader_integer_functions">
+ <enable extension="VK_INTEL_shader_integer_functions2"/>
+ </spirvextension>
+ <spirvextension name="SPV_KHR_device_group">
+ <enable version="VK_API_VERSION_1_1"/>
+ <enable extension="VK_KHR_device_group"/>
+ </spirvextension>
+ <spirvextension name="SPV_QCOM_image_processing">
+ <enable extension="VK_QCOM_image_processing"/>
+ </spirvextension>
+ </spirvextensions>
+ <spirvcapabilities comment="SPIR-V Capabilities allowed in Vulkan and what is required to use it">
+ <spirvcapability name="Matrix">
+ <enable version="VK_VERSION_1_0"/>
+ </spirvcapability>
+ <spirvcapability name="Shader">
+ <enable version="VK_VERSION_1_0"/>
+ </spirvcapability>
+ <spirvcapability name="InputAttachment">
+ <enable version="VK_VERSION_1_0"/>
+ </spirvcapability>
+ <spirvcapability name="Sampled1D">
+ <enable version="VK_VERSION_1_0"/>
+ </spirvcapability>
+ <spirvcapability name="Image1D">
+ <enable version="VK_VERSION_1_0"/>
+ </spirvcapability>
+ <spirvcapability name="SampledBuffer">
+ <enable version="VK_VERSION_1_0"/>
+ </spirvcapability>
+ <spirvcapability name="ImageBuffer">
+ <enable version="VK_VERSION_1_0"/>
+ </spirvcapability>
+ <spirvcapability name="ImageQuery">
+ <enable version="VK_VERSION_1_0"/>
+ </spirvcapability>
+ <spirvcapability name="DerivativeControl">
+ <enable version="VK_VERSION_1_0"/>
+ </spirvcapability>
+ <spirvcapability name="Geometry">
+ <enable struct="VkPhysicalDeviceFeatures" feature="geometryShader" requires="VK_VERSION_1_0"/>
+ </spirvcapability>
+ <spirvcapability name="Tessellation">
+ <enable struct="VkPhysicalDeviceFeatures" feature="tessellationShader" requires="VK_VERSION_1_0"/>
+ </spirvcapability>
+ <spirvcapability name="Float64">
+ <enable struct="VkPhysicalDeviceFeatures" feature="shaderFloat64" requires="VK_VERSION_1_0"/>
+ </spirvcapability>
+ <spirvcapability name="Int64">
+ <enable struct="VkPhysicalDeviceFeatures" feature="shaderInt64" requires="VK_VERSION_1_0"/>
+ </spirvcapability>
+ <spirvcapability name="Int64Atomics">
+ <enable struct="VkPhysicalDeviceVulkan12Features" feature="shaderBufferInt64Atomics" requires="VK_VERSION_1_2,VK_KHR_shader_atomic_int64"/>
+ <enable struct="VkPhysicalDeviceVulkan12Features" feature="shaderSharedInt64Atomics" requires="VK_VERSION_1_2,VK_KHR_shader_atomic_int64"/>
+ <enable struct="VkPhysicalDeviceShaderImageAtomicInt64FeaturesEXT" feature="shaderImageInt64Atomics" requires="VK_EXT_shader_image_atomic_int64"/>
+ </spirvcapability>
+ <spirvcapability name="AtomicFloat16AddEXT">
+ <enable struct="VkPhysicalDeviceShaderAtomicFloat2FeaturesEXT" feature="shaderBufferFloat16AtomicAdd" requires="VK_EXT_shader_atomic_float2"/>
+ <enable struct="VkPhysicalDeviceShaderAtomicFloat2FeaturesEXT" feature="shaderSharedFloat16AtomicAdd" requires="VK_EXT_shader_atomic_float2"/>
+ </spirvcapability>
+ <spirvcapability name="AtomicFloat32AddEXT">
+ <enable struct="VkPhysicalDeviceShaderAtomicFloatFeaturesEXT" feature="shaderBufferFloat32AtomicAdd" requires="VK_EXT_shader_atomic_float"/>
+ <enable struct="VkPhysicalDeviceShaderAtomicFloatFeaturesEXT" feature="shaderSharedFloat32AtomicAdd" requires="VK_EXT_shader_atomic_float"/>
+ <enable struct="VkPhysicalDeviceShaderAtomicFloatFeaturesEXT" feature="shaderImageFloat32AtomicAdd" requires="VK_EXT_shader_atomic_float"/>
+ </spirvcapability>
+ <spirvcapability name="AtomicFloat64AddEXT">
+ <enable struct="VkPhysicalDeviceShaderAtomicFloatFeaturesEXT" feature="shaderBufferFloat64AtomicAdd" requires="VK_EXT_shader_atomic_float"/>
+ <enable struct="VkPhysicalDeviceShaderAtomicFloatFeaturesEXT" feature="shaderSharedFloat64AtomicAdd" requires="VK_EXT_shader_atomic_float"/>
+ </spirvcapability>
+ <spirvcapability name="AtomicFloat16MinMaxEXT">
+ <enable struct="VkPhysicalDeviceShaderAtomicFloat2FeaturesEXT" feature="shaderBufferFloat16AtomicMinMax" requires="VK_EXT_shader_atomic_float2"/>
+ <enable struct="VkPhysicalDeviceShaderAtomicFloat2FeaturesEXT" feature="shaderSharedFloat16AtomicMinMax" requires="VK_EXT_shader_atomic_float2"/>
+ </spirvcapability>
+ <spirvcapability name="AtomicFloat32MinMaxEXT">
+ <enable struct="VkPhysicalDeviceShaderAtomicFloat2FeaturesEXT" feature="shaderBufferFloat32AtomicMinMax" requires="VK_EXT_shader_atomic_float2"/>
+ <enable struct="VkPhysicalDeviceShaderAtomicFloat2FeaturesEXT" feature="shaderSharedFloat32AtomicMinMax" requires="VK_EXT_shader_atomic_float2"/>
+ <enable struct="VkPhysicalDeviceShaderAtomicFloat2FeaturesEXT" feature="shaderImageFloat32AtomicMinMax" requires="VK_EXT_shader_atomic_float2"/>
+ </spirvcapability>
+ <spirvcapability name="AtomicFloat64MinMaxEXT">
+ <enable struct="VkPhysicalDeviceShaderAtomicFloat2FeaturesEXT" feature="shaderBufferFloat64AtomicMinMax" requires="VK_EXT_shader_atomic_float2"/>
+ <enable struct="VkPhysicalDeviceShaderAtomicFloat2FeaturesEXT" feature="shaderSharedFloat64AtomicMinMax" requires="VK_EXT_shader_atomic_float2"/>
+ </spirvcapability>
+ <spirvcapability name="Int64ImageEXT">
+ <enable struct="VkPhysicalDeviceShaderImageAtomicInt64FeaturesEXT" feature="shaderImageInt64Atomics" requires="VK_EXT_shader_image_atomic_int64"/>
+ </spirvcapability>
+ <spirvcapability name="Int16">
+ <enable struct="VkPhysicalDeviceFeatures" feature="shaderInt16" requires="VK_VERSION_1_0"/>
+ </spirvcapability>
+ <spirvcapability name="TessellationPointSize">
+ <enable struct="VkPhysicalDeviceFeatures" feature="shaderTessellationAndGeometryPointSize" requires="VK_VERSION_1_0"/>
+ </spirvcapability>
+ <spirvcapability name="GeometryPointSize">
+ <enable struct="VkPhysicalDeviceFeatures" feature="shaderTessellationAndGeometryPointSize" requires="VK_VERSION_1_0"/>
+ </spirvcapability>
+ <spirvcapability name="ImageGatherExtended">
+ <enable struct="VkPhysicalDeviceFeatures" feature="shaderImageGatherExtended" requires="VK_VERSION_1_0"/>
+ </spirvcapability>
+ <spirvcapability name="StorageImageMultisample">
+ <enable struct="VkPhysicalDeviceFeatures" feature="shaderStorageImageMultisample" requires="VK_VERSION_1_0"/>
+ </spirvcapability>
+ <spirvcapability name="UniformBufferArrayDynamicIndexing">
+ <enable struct="VkPhysicalDeviceFeatures" feature="shaderUniformBufferArrayDynamicIndexing" requires="VK_VERSION_1_0"/>
+ </spirvcapability>
+ <spirvcapability name="SampledImageArrayDynamicIndexing">
+ <enable struct="VkPhysicalDeviceFeatures" feature="shaderSampledImageArrayDynamicIndexing" requires="VK_VERSION_1_0"/>
+ </spirvcapability>
+ <spirvcapability name="StorageBufferArrayDynamicIndexing">
+ <enable struct="VkPhysicalDeviceFeatures" feature="shaderStorageBufferArrayDynamicIndexing" requires="VK_VERSION_1_0"/>
+ </spirvcapability>
+ <spirvcapability name="StorageImageArrayDynamicIndexing">
+ <enable struct="VkPhysicalDeviceFeatures" feature="shaderStorageImageArrayDynamicIndexing" requires="VK_VERSION_1_0"/>
+ </spirvcapability>
+ <spirvcapability name="ClipDistance">
+ <enable struct="VkPhysicalDeviceFeatures" feature="shaderClipDistance" requires="VK_VERSION_1_0"/>
+ </spirvcapability>
+ <spirvcapability name="CullDistance">
+ <enable struct="VkPhysicalDeviceFeatures" feature="shaderCullDistance" requires="VK_VERSION_1_0"/>
+ </spirvcapability>
+ <spirvcapability name="ImageCubeArray">
+ <enable struct="VkPhysicalDeviceFeatures" feature="imageCubeArray" requires="VK_VERSION_1_0"/>
+ </spirvcapability>
+ <spirvcapability name="SampleRateShading">
+ <enable struct="VkPhysicalDeviceFeatures" feature="sampleRateShading" requires="VK_VERSION_1_0"/>
+ </spirvcapability>
+ <spirvcapability name="SparseResidency">
+ <enable struct="VkPhysicalDeviceFeatures" feature="shaderResourceResidency" requires="VK_VERSION_1_0"/>
+ </spirvcapability>
+ <spirvcapability name="MinLod">
+ <enable struct="VkPhysicalDeviceFeatures" feature="shaderResourceMinLod" requires="VK_VERSION_1_0"/>
+ </spirvcapability>
+ <spirvcapability name="SampledCubeArray">
+ <enable struct="VkPhysicalDeviceFeatures" feature="imageCubeArray" requires="VK_VERSION_1_0"/>
+ </spirvcapability>
+ <spirvcapability name="ImageMSArray">
+ <enable struct="VkPhysicalDeviceFeatures" feature="shaderStorageImageMultisample" requires="VK_VERSION_1_0"/>
+ </spirvcapability>
+ <spirvcapability name="StorageImageExtendedFormats">
+ <enable version="VK_VERSION_1_0"/>
+ </spirvcapability>
+ <spirvcapability name="InterpolationFunction">
+ <enable struct="VkPhysicalDeviceFeatures" feature="sampleRateShading" requires="VK_VERSION_1_0"/>
+ </spirvcapability>
+ <spirvcapability name="StorageImageReadWithoutFormat">
+ <enable struct="VkPhysicalDeviceFeatures" feature="shaderStorageImageReadWithoutFormat" requires="VK_VERSION_1_0"/>
+ <enable version="VK_API_VERSION_1_3"/>
+ <enable extension="VK_KHR_format_feature_flags2"/>
+ </spirvcapability>
+ <spirvcapability name="StorageImageWriteWithoutFormat">
+ <enable struct="VkPhysicalDeviceFeatures" feature="shaderStorageImageWriteWithoutFormat" requires="VK_VERSION_1_0"/>
+ <enable version="VK_API_VERSION_1_3"/>
+ <enable extension="VK_KHR_format_feature_flags2"/>
+ </spirvcapability>
+ <spirvcapability name="MultiViewport">
+ <enable struct="VkPhysicalDeviceFeatures" feature="multiViewport" requires="VK_VERSION_1_0"/>
+ </spirvcapability>
+ <spirvcapability name="DrawParameters">
+ <enable struct="VkPhysicalDeviceVulkan11Features" feature="shaderDrawParameters" requires="VK_VERSION_1_2"/>
+ <enable struct="VkPhysicalDeviceShaderDrawParametersFeatures" feature="shaderDrawParameters" requires="VK_VERSION_1_1"/>
+ <enable extension="VK_KHR_shader_draw_parameters"/>
+ </spirvcapability>
+ <spirvcapability name="MultiView">
+ <enable struct="VkPhysicalDeviceVulkan11Features" feature="multiview" requires="VK_VERSION_1_2"/>
+ <enable struct="VkPhysicalDeviceMultiviewFeatures" feature="multiview" requires="VK_KHR_multiview"/>
+ </spirvcapability>
+ <spirvcapability name="DeviceGroup">
+ <enable version="VK_VERSION_1_1"/>
+ <enable extension="VK_KHR_device_group"/>
+ </spirvcapability>
+ <spirvcapability name="VariablePointersStorageBuffer">
+ <enable struct="VkPhysicalDeviceVulkan11Features" feature="variablePointersStorageBuffer" requires="VK_VERSION_1_2"/>
+ <enable struct="VkPhysicalDeviceVariablePointersFeatures" feature="variablePointersStorageBuffer" requires="VK_KHR_variable_pointers"/>
+ </spirvcapability>
+ <spirvcapability name="VariablePointers">
+ <enable struct="VkPhysicalDeviceVulkan11Features" feature="variablePointers" requires="VK_VERSION_1_2"/>
+ <enable struct="VkPhysicalDeviceVariablePointersFeatures" feature="variablePointers" requires="VK_KHR_variable_pointers"/>
+ </spirvcapability>
+ <spirvcapability name="ShaderClockKHR">
+ <enable extension="VK_KHR_shader_clock"/>
+ </spirvcapability>
+ <spirvcapability name="StencilExportEXT">
+ <enable extension="VK_EXT_shader_stencil_export"/>
+ </spirvcapability>
+ <spirvcapability name="SubgroupBallotKHR">
+ <enable extension="VK_EXT_shader_subgroup_ballot"/>
+ </spirvcapability>
+ <spirvcapability name="SubgroupVoteKHR">
+ <enable extension="VK_EXT_shader_subgroup_vote"/>
+ </spirvcapability>
+ <spirvcapability name="ImageReadWriteLodAMD">
+ <enable extension="VK_AMD_shader_image_load_store_lod"/>
+ </spirvcapability>
+ <spirvcapability name="ImageGatherBiasLodAMD">
+ <enable extension="VK_AMD_texture_gather_bias_lod"/>
+ </spirvcapability>
+ <spirvcapability name="FragmentMaskAMD">
+ <enable extension="VK_AMD_shader_fragment_mask"/>
+ </spirvcapability>
+ <spirvcapability name="SampleMaskOverrideCoverageNV">
+ <enable extension="VK_NV_sample_mask_override_coverage"/>
+ </spirvcapability>
+ <spirvcapability name="GeometryShaderPassthroughNV">
+ <enable extension="VK_NV_geometry_shader_passthrough"/>
+ </spirvcapability>
+ <spirvcapability name="ShaderViewportIndex">
+ <enable struct="VkPhysicalDeviceVulkan12Features" feature="shaderOutputViewportIndex" requires="VK_VERSION_1_2"/>
+ </spirvcapability>
+ <spirvcapability name="ShaderLayer">
+ <enable struct="VkPhysicalDeviceVulkan12Features" feature="shaderOutputLayer" requires="VK_VERSION_1_2"/>
+ </spirvcapability>
+ <spirvcapability name="ShaderViewportIndexLayerEXT">
+ <enable extension="VK_EXT_shader_viewport_index_layer"/>
+ </spirvcapability>
+ <spirvcapability name="ShaderViewportIndexLayerNV">
+ <enable extension="VK_NV_viewport_array2"/>
+ </spirvcapability>
+ <spirvcapability name="ShaderViewportMaskNV">
+ <enable extension="VK_NV_viewport_array2"/>
+ </spirvcapability>
+ <spirvcapability name="PerViewAttributesNV">
+ <enable extension="VK_NVX_multiview_per_view_attributes"/>
+ </spirvcapability>
+ <spirvcapability name="StorageBuffer16BitAccess">
+ <enable struct="VkPhysicalDeviceVulkan11Features" feature="storageBuffer16BitAccess" requires="VK_VERSION_1_2"/>
+ <enable struct="VkPhysicalDevice16BitStorageFeatures" feature="storageBuffer16BitAccess" requires="VK_KHR_16bit_storage"/>
+ </spirvcapability>
+ <spirvcapability name="UniformAndStorageBuffer16BitAccess">
+ <enable struct="VkPhysicalDeviceVulkan11Features" feature="uniformAndStorageBuffer16BitAccess" requires="VK_VERSION_1_2"/>
+ <enable struct="VkPhysicalDevice16BitStorageFeatures" feature="uniformAndStorageBuffer16BitAccess" requires="VK_KHR_16bit_storage"/>
+ </spirvcapability>
+ <spirvcapability name="StoragePushConstant16">
+ <enable struct="VkPhysicalDeviceVulkan11Features" feature="storagePushConstant16" requires="VK_VERSION_1_2"/>
+ <enable struct="VkPhysicalDevice16BitStorageFeatures" feature="storagePushConstant16" requires="VK_KHR_16bit_storage"/>
+ </spirvcapability>
+ <spirvcapability name="StorageInputOutput16">
+ <enable struct="VkPhysicalDeviceVulkan11Features" feature="storageInputOutput16" requires="VK_VERSION_1_2"/>
+ <enable struct="VkPhysicalDevice16BitStorageFeatures" feature="storageInputOutput16" requires="VK_KHR_16bit_storage"/>
+ </spirvcapability>
+ <spirvcapability name="GroupNonUniform">
+ <enable property="VkPhysicalDeviceVulkan11Properties" member="subgroupSupportedOperations" value="VK_SUBGROUP_FEATURE_BASIC_BIT" requires="VK_VERSION_1_1"/>
+ </spirvcapability>
+ <spirvcapability name="GroupNonUniformVote">
+ <enable property="VkPhysicalDeviceVulkan11Properties" member="subgroupSupportedOperations" value="VK_SUBGROUP_FEATURE_VOTE_BIT" requires="VK_VERSION_1_1"/>
+ </spirvcapability>
+ <spirvcapability name="GroupNonUniformArithmetic">
+ <enable property="VkPhysicalDeviceVulkan11Properties" member="subgroupSupportedOperations" value="VK_SUBGROUP_FEATURE_ARITHMETIC_BIT" requires="VK_VERSION_1_1"/>
+ </spirvcapability>
+ <spirvcapability name="GroupNonUniformBallot">
+ <enable property="VkPhysicalDeviceVulkan11Properties" member="subgroupSupportedOperations" value="VK_SUBGROUP_FEATURE_BALLOT_BIT" requires="VK_VERSION_1_1"/>
+ </spirvcapability>
+ <spirvcapability name="GroupNonUniformShuffle">
+ <enable property="VkPhysicalDeviceVulkan11Properties" member="subgroupSupportedOperations" value="VK_SUBGROUP_FEATURE_SHUFFLE_BIT" requires="VK_VERSION_1_1"/>
+ </spirvcapability>
+ <spirvcapability name="GroupNonUniformShuffleRelative">
+ <enable property="VkPhysicalDeviceVulkan11Properties" member="subgroupSupportedOperations" value="VK_SUBGROUP_FEATURE_SHUFFLE_RELATIVE_BIT" requires="VK_VERSION_1_1"/>
+ </spirvcapability>
+ <spirvcapability name="GroupNonUniformClustered">
+ <enable property="VkPhysicalDeviceVulkan11Properties" member="subgroupSupportedOperations" value="VK_SUBGROUP_FEATURE_CLUSTERED_BIT" requires="VK_VERSION_1_1"/>
+ </spirvcapability>
+ <spirvcapability name="GroupNonUniformQuad">
+ <enable property="VkPhysicalDeviceVulkan11Properties" member="subgroupSupportedOperations" value="VK_SUBGROUP_FEATURE_QUAD_BIT" requires="VK_VERSION_1_1"/>
+ </spirvcapability>
+ <spirvcapability name="GroupNonUniformPartitionedNV">
+ <enable property="VkPhysicalDeviceVulkan11Properties" member="subgroupSupportedOperations" value="VK_SUBGROUP_FEATURE_PARTITIONED_BIT_NV" requires="VK_NV_shader_subgroup_partitioned"/>
+ </spirvcapability>
+ <spirvcapability name="SampleMaskPostDepthCoverage">
+ <enable extension="VK_EXT_post_depth_coverage"/>
+ </spirvcapability>
+ <spirvcapability name="ShaderNonUniform">
+ <enable version="VK_VERSION_1_2"/>
+ <enable extension="VK_EXT_descriptor_indexing"/>
+ </spirvcapability>
+ <spirvcapability name="RuntimeDescriptorArray">
+ <enable struct="VkPhysicalDeviceVulkan12Features" feature="runtimeDescriptorArray" requires="VK_VERSION_1_2,VK_EXT_descriptor_indexing"/>
+ </spirvcapability>
+ <spirvcapability name="InputAttachmentArrayDynamicIndexing">
+ <enable struct="VkPhysicalDeviceVulkan12Features" feature="shaderInputAttachmentArrayDynamicIndexing" requires="VK_VERSION_1_2,VK_EXT_descriptor_indexing"/>
+ </spirvcapability>
+ <spirvcapability name="UniformTexelBufferArrayDynamicIndexing">
+ <enable struct="VkPhysicalDeviceVulkan12Features" feature="shaderUniformTexelBufferArrayDynamicIndexing" requires="VK_VERSION_1_2,VK_EXT_descriptor_indexing"/>
+ </spirvcapability>
+ <spirvcapability name="StorageTexelBufferArrayDynamicIndexing">
+ <enable struct="VkPhysicalDeviceVulkan12Features" feature="shaderStorageTexelBufferArrayDynamicIndexing" requires="VK_VERSION_1_2,VK_EXT_descriptor_indexing"/>
+ </spirvcapability>
+ <spirvcapability name="UniformBufferArrayNonUniformIndexing">
+ <enable struct="VkPhysicalDeviceVulkan12Features" feature="shaderUniformBufferArrayNonUniformIndexing" requires="VK_VERSION_1_2,VK_EXT_descriptor_indexing"/>
+ </spirvcapability>
+ <spirvcapability name="SampledImageArrayNonUniformIndexing">
+ <enable struct="VkPhysicalDeviceVulkan12Features" feature="shaderSampledImageArrayNonUniformIndexing" requires="VK_VERSION_1_2,VK_EXT_descriptor_indexing"/>
+ </spirvcapability>
+ <spirvcapability name="StorageBufferArrayNonUniformIndexing">
+ <enable struct="VkPhysicalDeviceVulkan12Features" feature="shaderStorageBufferArrayNonUniformIndexing" requires="VK_VERSION_1_2,VK_EXT_descriptor_indexing"/>
+ </spirvcapability>
+ <spirvcapability name="StorageImageArrayNonUniformIndexing">
+ <enable struct="VkPhysicalDeviceVulkan12Features" feature="shaderStorageImageArrayNonUniformIndexing" requires="VK_VERSION_1_2,VK_EXT_descriptor_indexing"/>
+ </spirvcapability>
+ <spirvcapability name="InputAttachmentArrayNonUniformIndexing">
+ <enable struct="VkPhysicalDeviceVulkan12Features" feature="shaderInputAttachmentArrayNonUniformIndexing" requires="VK_VERSION_1_2,VK_EXT_descriptor_indexing"/>
+ </spirvcapability>
+ <spirvcapability name="UniformTexelBufferArrayNonUniformIndexing">
+ <enable struct="VkPhysicalDeviceVulkan12Features" feature="shaderUniformTexelBufferArrayNonUniformIndexing" requires="VK_VERSION_1_2,VK_EXT_descriptor_indexing"/>
+ </spirvcapability>
+ <spirvcapability name="StorageTexelBufferArrayNonUniformIndexing">
+ <enable struct="VkPhysicalDeviceVulkan12Features" feature="shaderStorageTexelBufferArrayNonUniformIndexing" requires="VK_VERSION_1_2,VK_EXT_descriptor_indexing"/>
+ </spirvcapability>
+ <spirvcapability name="Float16">
+ <enable struct="VkPhysicalDeviceVulkan12Features" feature="shaderFloat16" requires="VK_VERSION_1_2,VK_KHR_shader_float16_int8"/>
+ <enable extension="VK_AMD_gpu_shader_half_float"/>
+ </spirvcapability>
+ <spirvcapability name="Int8">
+ <enable struct="VkPhysicalDeviceVulkan12Features" feature="shaderInt8" requires="VK_VERSION_1_2,VK_KHR_shader_float16_int8"/>
+ </spirvcapability>
+ <spirvcapability name="StorageBuffer8BitAccess">
+ <enable struct="VkPhysicalDeviceVulkan12Features" feature="storageBuffer8BitAccess" requires="VK_VERSION_1_2,VK_KHR_8bit_storage"/>
+ </spirvcapability>
+ <spirvcapability name="UniformAndStorageBuffer8BitAccess">
+ <enable struct="VkPhysicalDeviceVulkan12Features" feature="uniformAndStorageBuffer8BitAccess" requires="VK_VERSION_1_2,VK_KHR_8bit_storage"/>
+ </spirvcapability>
+ <spirvcapability name="StoragePushConstant8">
+ <enable struct="VkPhysicalDeviceVulkan12Features" feature="storagePushConstant8" requires="VK_VERSION_1_2,VK_KHR_8bit_storage"/>
+ </spirvcapability>
+ <spirvcapability name="VulkanMemoryModel">
+ <enable struct="VkPhysicalDeviceVulkan12Features" feature="vulkanMemoryModel" requires="VK_VERSION_1_2,VK_KHR_vulkan_memory_model"/>
+ </spirvcapability>
+ <spirvcapability name="VulkanMemoryModelDeviceScope">
+ <enable struct="VkPhysicalDeviceVulkan12Features" feature="vulkanMemoryModelDeviceScope" requires="VK_VERSION_1_2,VK_KHR_vulkan_memory_model"/>
+ </spirvcapability>
+ <spirvcapability name="DenormPreserve">
+ <enable property="VkPhysicalDeviceVulkan12Properties" member="shaderDenormPreserveFloat16" value="VK_TRUE" requires="VK_VERSION_1_2,VK_KHR_shader_float_controls"/>
+ <enable property="VkPhysicalDeviceVulkan12Properties" member="shaderDenormPreserveFloat32" value="VK_TRUE" requires="VK_VERSION_1_2,VK_KHR_shader_float_controls"/>
+ <enable property="VkPhysicalDeviceVulkan12Properties" member="shaderDenormPreserveFloat64" value="VK_TRUE" requires="VK_VERSION_1_2,VK_KHR_shader_float_controls"/>
+ </spirvcapability>
+ <spirvcapability name="DenormFlushToZero">
+ <enable property="VkPhysicalDeviceVulkan12Properties" member="shaderDenormFlushToZeroFloat16" value="VK_TRUE" requires="VK_VERSION_1_2,VK_KHR_shader_float_controls"/>
+ <enable property="VkPhysicalDeviceVulkan12Properties" member="shaderDenormFlushToZeroFloat32" value="VK_TRUE" requires="VK_VERSION_1_2,VK_KHR_shader_float_controls"/>
+ <enable property="VkPhysicalDeviceVulkan12Properties" member="shaderDenormFlushToZeroFloat64" value="VK_TRUE" requires="VK_VERSION_1_2,VK_KHR_shader_float_controls"/>
+ </spirvcapability>
+ <spirvcapability name="SignedZeroInfNanPreserve">
+ <enable property="VkPhysicalDeviceVulkan12Properties" member="shaderSignedZeroInfNanPreserveFloat16" value="VK_TRUE" requires="VK_VERSION_1_2,VK_KHR_shader_float_controls"/>
+ <enable property="VkPhysicalDeviceVulkan12Properties" member="shaderSignedZeroInfNanPreserveFloat32" value="VK_TRUE" requires="VK_VERSION_1_2,VK_KHR_shader_float_controls"/>
+ <enable property="VkPhysicalDeviceVulkan12Properties" member="shaderSignedZeroInfNanPreserveFloat64" value="VK_TRUE" requires="VK_VERSION_1_2,VK_KHR_shader_float_controls"/>
+ </spirvcapability>
+ <spirvcapability name="RoundingModeRTE">
+ <enable property="VkPhysicalDeviceVulkan12Properties" member="shaderRoundingModeRTEFloat16" value="VK_TRUE" requires="VK_VERSION_1_2,VK_KHR_shader_float_controls"/>
+ <enable property="VkPhysicalDeviceVulkan12Properties" member="shaderRoundingModeRTEFloat32" value="VK_TRUE" requires="VK_VERSION_1_2,VK_KHR_shader_float_controls"/>
+ <enable property="VkPhysicalDeviceVulkan12Properties" member="shaderRoundingModeRTEFloat64" value="VK_TRUE" requires="VK_VERSION_1_2,VK_KHR_shader_float_controls"/>
+ </spirvcapability>
+ <spirvcapability name="RoundingModeRTZ">
+ <enable property="VkPhysicalDeviceVulkan12Properties" member="shaderRoundingModeRTZFloat16" value="VK_TRUE" requires="VK_VERSION_1_2,VK_KHR_shader_float_controls"/>
+ <enable property="VkPhysicalDeviceVulkan12Properties" member="shaderRoundingModeRTZFloat32" value="VK_TRUE" requires="VK_VERSION_1_2,VK_KHR_shader_float_controls"/>
+ <enable property="VkPhysicalDeviceVulkan12Properties" member="shaderRoundingModeRTZFloat64" value="VK_TRUE" requires="VK_VERSION_1_2,VK_KHR_shader_float_controls"/>
+ </spirvcapability>
+ <spirvcapability name="ComputeDerivativeGroupQuadsNV">
+ <enable struct="VkPhysicalDeviceComputeShaderDerivativesFeaturesNV" feature="computeDerivativeGroupQuads" requires="VK_NV_compute_shader_derivatives"/>
+ </spirvcapability>
+ <spirvcapability name="ComputeDerivativeGroupLinearNV">
+ <enable struct="VkPhysicalDeviceComputeShaderDerivativesFeaturesNV" feature="computeDerivativeGroupLinear" requires="VK_NV_compute_shader_derivatives"/>
+ </spirvcapability>
+ <spirvcapability name="FragmentBarycentricNV">
+ <enable struct="VkPhysicalDeviceFragmentShaderBarycentricFeaturesNV" feature="fragmentShaderBarycentric" requires="VK_NV_fragment_shader_barycentric"/>
+ </spirvcapability>
+ <spirvcapability name="ImageFootprintNV">
+ <enable struct="VkPhysicalDeviceShaderImageFootprintFeaturesNV" feature="imageFootprint" requires="VK_NV_shader_image_footprint"/>
+ </spirvcapability>
+ <spirvcapability name="ShadingRateNV">
+ <enable struct="VkPhysicalDeviceShadingRateImageFeaturesNV" feature="shadingRateImage" requires="VK_NV_shading_rate_image"/>
+ </spirvcapability>
+ <spirvcapability name="MeshShadingNV">
+ <enable extension="VK_NV_mesh_shader"/>
+ </spirvcapability>
+ <spirvcapability name="RayTracingKHR">
+ <enable struct="VkPhysicalDeviceRayTracingPipelineFeaturesKHR" feature="rayTracingPipeline" requires="VK_KHR_ray_tracing_pipeline"/>
+ </spirvcapability>
+ <spirvcapability name="RayQueryKHR">
+ <enable struct="VkPhysicalDeviceRayQueryFeaturesKHR" feature="rayQuery" requires="VK_KHR_ray_query"/>
+ </spirvcapability>
+ <spirvcapability name="RayTraversalPrimitiveCullingKHR">
+ <enable struct="VkPhysicalDeviceRayTracingPipelineFeaturesKHR" feature="rayTraversalPrimitiveCulling" requires="VK_KHR_ray_tracing_pipeline"/>
+ <enable struct="VkPhysicalDeviceRayQueryFeaturesKHR" feature="rayQuery" requires="VK_KHR_ray_query"/>
+ </spirvcapability>
+ <spirvcapability name="RayCullMaskKHR">
+ <enable struct="VkPhysicalDeviceRayTracingMaintenance1FeaturesKHR" feature="rayTracingMaintenance1" requires="VK_KHR_ray_tracing_maintenance1"/>
+ </spirvcapability>
+ <spirvcapability name="RayTracingNV">
+ <enable extension="VK_NV_ray_tracing"/>
+ </spirvcapability>
+ <spirvcapability name="RayTracingMotionBlurNV">
+ <enable struct="VkPhysicalDeviceRayTracingMotionBlurFeaturesNV" feature="rayTracingMotionBlur" requires="VK_NV_ray_tracing_motion_blur"/>
+ </spirvcapability>
+ <spirvcapability name="TransformFeedback">
+ <enable struct="VkPhysicalDeviceTransformFeedbackFeaturesEXT" feature="transformFeedback" requires="VK_EXT_transform_feedback"/>
+ </spirvcapability>
+ <spirvcapability name="GeometryStreams">
+ <enable struct="VkPhysicalDeviceTransformFeedbackFeaturesEXT" feature="geometryStreams" requires="VK_EXT_transform_feedback"/>
+ </spirvcapability>
+ <spirvcapability name="FragmentDensityEXT">
+ <enable struct="VkPhysicalDeviceFragmentDensityMapFeaturesEXT" feature="fragmentDensityMap" requires="VK_EXT_fragment_density_map"/>
+ </spirvcapability>
+ <spirvcapability name="PhysicalStorageBufferAddresses">
+ <enable struct="VkPhysicalDeviceVulkan12Features" feature="bufferDeviceAddress" requires="VK_VERSION_1_2,VK_KHR_buffer_device_address"/>
+ <enable struct="VkPhysicalDeviceBufferDeviceAddressFeaturesEXT" feature="bufferDeviceAddress" requires="VK_EXT_buffer_device_address" alias="bufferDeviceAddressEXT"/>
+ </spirvcapability>
+ <spirvcapability name="CooperativeMatrixNV">
+ <enable struct="VkPhysicalDeviceCooperativeMatrixFeaturesNV" feature="cooperativeMatrix" requires="VK_NV_cooperative_matrix"/>
+ </spirvcapability>
+ <spirvcapability name="IntegerFunctions2INTEL">
+ <enable struct="VkPhysicalDeviceShaderIntegerFunctions2FeaturesINTEL" feature="shaderIntegerFunctions2" requires="VK_INTEL_shader_integer_functions2"/>
+ </spirvcapability>
+ <spirvcapability name="ShaderSMBuiltinsNV">
+ <enable struct="VkPhysicalDeviceShaderSMBuiltinsFeaturesNV" feature="shaderSMBuiltins" requires="VK_NV_shader_sm_builtins"/>
+ </spirvcapability>
+ <spirvcapability name="FragmentShaderSampleInterlockEXT">
+ <enable struct="VkPhysicalDeviceFragmentShaderInterlockFeaturesEXT" feature="fragmentShaderSampleInterlock" requires="VK_EXT_fragment_shader_interlock"/>
+ </spirvcapability>
+ <spirvcapability name="FragmentShaderPixelInterlockEXT">
+ <enable struct="VkPhysicalDeviceFragmentShaderInterlockFeaturesEXT" feature="fragmentShaderPixelInterlock" requires="VK_EXT_fragment_shader_interlock"/>
+ </spirvcapability>
+ <spirvcapability name="FragmentShaderShadingRateInterlockEXT">
+ <enable struct="VkPhysicalDeviceFragmentShaderInterlockFeaturesEXT" feature="fragmentShaderShadingRateInterlock" requires="VK_EXT_fragment_shader_interlock"/>
+ <enable struct="VkPhysicalDeviceShadingRateImageFeaturesNV" feature="shadingRateImage" requires="VK_NV_shading_rate_image"/>
+ </spirvcapability>
+ <spirvcapability name="DemoteToHelperInvocationEXT">
+ <enable struct="VkPhysicalDeviceVulkan13Features" feature="shaderDemoteToHelperInvocation" requires="VK_VERSION_1_3,VK_EXT_shader_demote_to_helper_invocation"/>
+ <enable struct="VkPhysicalDeviceShaderDemoteToHelperInvocationFeaturesEXT" feature="shaderDemoteToHelperInvocation" requires="VK_EXT_shader_demote_to_helper_invocation"/>
+ </spirvcapability>
+ <spirvcapability name="FragmentShadingRateKHR">
+ <enable struct="VkPhysicalDeviceFragmentShadingRateFeaturesKHR" feature="pipelineFragmentShadingRate" requires="VK_KHR_fragment_shading_rate"/>
+ <enable struct="VkPhysicalDeviceFragmentShadingRateFeaturesKHR" feature="primitiveFragmentShadingRate" requires="VK_KHR_fragment_shading_rate"/>
+ <enable struct="VkPhysicalDeviceFragmentShadingRateFeaturesKHR" feature="attachmentFragmentShadingRate" requires="VK_KHR_fragment_shading_rate"/>
+ </spirvcapability>
+ <spirvcapability name="WorkgroupMemoryExplicitLayoutKHR">
+ <enable struct="VkPhysicalDeviceWorkgroupMemoryExplicitLayoutFeaturesKHR" feature="workgroupMemoryExplicitLayout" requires="VK_KHR_workgroup_memory_explicit_layout"/>
+ </spirvcapability>
+ <spirvcapability name="WorkgroupMemoryExplicitLayout8BitAccessKHR">
+ <enable struct="VkPhysicalDeviceWorkgroupMemoryExplicitLayoutFeaturesKHR" feature="workgroupMemoryExplicitLayout8BitAccess" requires="VK_KHR_workgroup_memory_explicit_layout"/>
+ </spirvcapability>
+ <spirvcapability name="WorkgroupMemoryExplicitLayout16BitAccessKHR">
+ <enable struct="VkPhysicalDeviceWorkgroupMemoryExplicitLayoutFeaturesKHR" feature="workgroupMemoryExplicitLayout16BitAccess" requires="VK_KHR_workgroup_memory_explicit_layout"/>
+ </spirvcapability>
+ <spirvcapability name="DotProductInputAllKHR">
+ <enable struct="VkPhysicalDeviceVulkan13Features" feature="shaderIntegerDotProduct" requires="VK_VERSION_1_3,VK_KHR_shader_integer_dot_product"/>
+ <enable struct="VkPhysicalDeviceShaderIntegerDotProductFeaturesKHR" feature="shaderIntegerDotProduct" requires="VK_KHR_shader_integer_dot_product"/>
+ </spirvcapability>
+ <spirvcapability name="DotProductInput4x8BitKHR">
+ <enable struct="VkPhysicalDeviceVulkan13Features" feature="shaderIntegerDotProduct" requires="VK_VERSION_1_3,VK_KHR_shader_integer_dot_product"/>
+ <enable struct="VkPhysicalDeviceShaderIntegerDotProductFeaturesKHR" feature="shaderIntegerDotProduct" requires="VK_KHR_shader_integer_dot_product"/>
+ </spirvcapability>
+ <spirvcapability name="DotProductInput4x8BitPackedKHR">
+ <enable struct="VkPhysicalDeviceVulkan13Features" feature="shaderIntegerDotProduct" requires="VK_VERSION_1_3,VK_KHR_shader_integer_dot_product"/>
+ <enable struct="VkPhysicalDeviceShaderIntegerDotProductFeaturesKHR" feature="shaderIntegerDotProduct" requires="VK_KHR_shader_integer_dot_product"/>
+ </spirvcapability>
+ <spirvcapability name="DotProductKHR">
+ <enable struct="VkPhysicalDeviceVulkan13Features" feature="shaderIntegerDotProduct" requires="VK_VERSION_1_3,VK_KHR_shader_integer_dot_product"/>
+ <enable struct="VkPhysicalDeviceShaderIntegerDotProductFeaturesKHR" feature="shaderIntegerDotProduct" requires="VK_KHR_shader_integer_dot_product"/>
+ </spirvcapability>
+ <spirvcapability name="FragmentBarycentricKHR">
+ <enable struct="VkPhysicalDeviceFragmentShaderBarycentricFeaturesKHR" feature="fragmentShaderBarycentric" requires="VK_KHR_fragment_shader_barycentric"/>
+ </spirvcapability>
+ <spirvcapability name="TextureSampleWeightedQCOM">
+ <enable struct="VkPhysicalDeviceImageProcessingFeaturesQCOM" feature="textureSampleWeighted" requires="VK_QCOM_image_processing"/>
+ </spirvcapability>
+ <spirvcapability name="TextureBoxFilterQCOM">
+ <enable struct="VkPhysicalDeviceImageProcessingFeaturesQCOM" feature="textureBoxFilter" requires="VK_QCOM_image_processing"/>
+ </spirvcapability>
+ <spirvcapability name="TextureBlockMatchQCOM">
+ <enable struct="VkPhysicalDeviceImageProcessingFeaturesQCOM" feature="textureBlockMatch" requires="VK_QCOM_image_processing"/>
+ </spirvcapability>
+ </spirvcapabilities>
</registry>
diff --git a/src/gui/vulkan/vulkan.pri b/src/gui/vulkan/vulkan.pri
deleted file mode 100644
index 5c902e8b82..0000000000
--- a/src/gui/vulkan/vulkan.pri
+++ /dev/null
@@ -1,61 +0,0 @@
-qtConfig(vulkan) {
- CONFIG += generated_privates
-
- HEADERS += \
- vulkan/qvulkaninstance.h \
- vulkan/qplatformvulkaninstance.h \
- vulkan/qvulkanwindow.h \
- vulkan/qvulkanwindow_p.h
-
- SOURCES += \
- vulkan/qvulkaninstance.cpp \
- vulkan/qplatformvulkaninstance.cpp \
- vulkan/qvulkanfunctions.cpp \
- vulkan/qvulkanwindow.cpp
-
- # Applications must inherit the Vulkan header include path.
- QMAKE_USE += vulkan/nolink
-}
-
-qtConfig(vkgen) {
- # Generate qvulkanfunctions.h, qvulkanfunctions_p.h, qvulkanfunctions_p.cpp
- QMAKE_QVKGEN_INPUT = vulkan/vk.xml
- QMAKE_QVKGEN_LICENSE_HEADER = $$QT_SOURCE_TREE/header.LGPL
- qtPrepareTool(QMAKE_QVKGEN, qvkgen)
-
- qvkgen_h.commands = $$QMAKE_QVKGEN ${QMAKE_FILE_IN} $$shell_quote($$QMAKE_QVKGEN_LICENSE_HEADER) ${QMAKE_FILE_OUT_PATH}/${QMAKE_FILE_OUT_BASE}
- qvkgen_h.output = $$OUT_PWD/vulkan/qvulkanfunctions.h
- qvkgen_h.input = QMAKE_QVKGEN_INPUT
- qtConfig(vulkan): \
- qvkgen_h.variable_out = HEADERS
- else: \
- qvkgen_h.CONFIG += target_predeps no_link
- QMAKE_EXTRA_COMPILERS += qvkgen_h
-
- qvkgen_ph.commands = $$escape_expand(\\n)
- qvkgen_ph.output = $$OUT_PWD/vulkan/qvulkanfunctions_p.h
- qvkgen_ph.input = QMAKE_QVKGEN_INPUT
- qvkgen_ph.depends += $$OUT_PWD/vulkan/qvulkanfunctions.h
- qtConfig(vulkan): \
- qvkgen_ph.variable_out = HEADERS
- else: \
- qvkgen_ph.CONFIG += target_predeps no_link
- QMAKE_EXTRA_COMPILERS += qvkgen_ph
-
- qvkgen_pimpl.commands = $$escape_expand(\\n)
- qvkgen_pimpl.output = $$OUT_PWD/vulkan/qvulkanfunctions_p.cpp
- qvkgen_pimpl.input = QMAKE_QVKGEN_INPUT
- qvkgen_pimpl.depends += $$OUT_PWD/vulkan/qvulkanfunctions_p.h
- qtConfig(vulkan): \
- qvkgen_pimpl.variable_out = SOURCES
- else: \
- qvkgen_pimpl.CONFIG += target_predeps no_link
- QMAKE_EXTRA_COMPILERS += qvkgen_pimpl
-} else {
- # generate dummy files to make qmake happy
- write_file($$OUT_PWD/vulkan/qvulkanfunctions.h)
- write_file($$OUT_PWD/vulkan/qvulkanfunctions_p.h)
-}
-
-# Ensure qvulkanfunctions.h gets installed correctly
-targ_headers.CONFIG += no_check_exist